From: Cris Di Sclafani Date: Wed, 7 Jul 2021 10:31:00 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.31 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=45ebf47df1d686ee0eaa7f1aca53e8396d35e9cb;p=motion2.git Built motion from commit (unavailable).|2.5.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 225aeea..2d6aa3a 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-07T09:24:20.001Z", + "time": "2021-07-07T10:23:33.774Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 90a0d57..b3e8b03 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-07-07T09:24:20.001Z", + "time": "2021-07-07T10:23:33.774Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 4de476c..cdad021 100644 --- a/server/api/action/action.attributes.js +++ b/server/api/action/action.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbeb2=['getDataValue','STRING','contactManager','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports'];(function(_0x2e5801,_0x104997){var _0x164605=function(_0x218b22){while(--_0x218b22){_0x2e5801['push'](_0x2e5801['shift']());}};_0x164605(++_0x104997);}(_0xbeb2,0x16e));var _0x2beb=function(_0x5b8526,_0x9b6cc9){_0x5b8526=_0x5b8526-0x0;var _0x839211=_0xbeb2[_0x5b8526];return _0x839211;};'use strict';var Sequelize=require(_0x2beb('0x0'));module[_0x2beb('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x463e75){return this[_0x2beb('0x2')]('action');}},'action':{'type':Sequelize[_0x2beb('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2beb('0x4'),_0x2beb('0x5'),'motionbar',_0x2beb('0x6'),_0x2beb('0x7'),_0x2beb('0x8'),_0x2beb('0x9'),_0x2beb('0xa')]],'msg':_0x2beb('0xb')}},'comment':_0x2beb('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x2beb('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x2beb('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x2beb('0xe')},'data4':{'type':Sequelize[_0x2beb('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x2beb('0x3')]},'data7':{'type':Sequelize[_0x2beb('0xf')]}}; \ No newline at end of file +var _0x3b97=['jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration'];(function(_0x32a773,_0x57b5c7){var _0x430dcb=function(_0x209f30){while(--_0x209f30){_0x32a773['push'](_0x32a773['shift']());}};_0x430dcb(++_0x57b5c7);}(_0x3b97,0xc9));var _0x73b9=function(_0x5ea34f,_0xb3d1db){_0x5ea34f=_0x5ea34f-0x0;var _0x4b9e25=_0x3b97[_0x5ea34f];return _0x4b9e25;};'use strict';var Sequelize=require('sequelize');module[_0x73b9('0x0')]={'name':{'type':Sequelize[_0x73b9('0x1')],'get':function(_0x291179){return this[_0x73b9('0x2')](_0x73b9('0x3'));}},'action':{'type':Sequelize[_0x73b9('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x73b9('0x5'),_0x73b9('0x6'),'motionbar',_0x73b9('0x7'),_0x73b9('0x8'),_0x73b9('0x9'),_0x73b9('0xa'),_0x73b9('0xb')]],'msg':_0x73b9('0xc')}},'comment':_0x73b9('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x73b9('0xd')},'data2':{'type':Sequelize[_0x73b9('0x4')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x73b9('0x4')](0x1000),'comment':_0x73b9('0xe')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x73b9('0x4')]},'data7':{'type':Sequelize[_0x73b9('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index bffc3bd..dc9c52b 100644 --- a/server/api/action/action.controller.js +++ b/server/api/action/action.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abe=['apply','reject','save','update','error','stack','send','render','merge','body','contact','message','agent','interaction','account','find','then','destroy','Action','params','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x4b8df0,_0x5c59f1){var _0x2ad3fe=function(_0x2244ae){while(--_0x2244ae){_0x4b8df0['push'](_0x4b8df0['shift']());}};_0x2ad3fe(++_0x5c59f1);}(_0x0abe,0x188));var _0xe0ab=function(_0x45ceed,_0x55307){_0x45ceed=_0x45ceed-0x0;var _0x4099ab=_0x0abe[_0x45ceed];return _0x4099ab;};'use strict';var emlformat=require(_0xe0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0ab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0ab('0x2'));var moment=require(_0xe0ab('0x3'));var BPromise=require(_0xe0ab('0x4'));var Mustache=require(_0xe0ab('0x5'));var util=require(_0xe0ab('0x6'));var path=require(_0xe0ab('0x7'));var sox=require(_0xe0ab('0x8'));var csv=require('to-csv');var ejs=require(_0xe0ab('0x9'));var fs=require('fs');var fs_extra=require(_0xe0ab('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0ab('0xb'));var deskjs=require(_0xe0ab('0xc'));var toCsv=require(_0xe0ab('0xd'));var querystring=require('querystring');var Papa=require(_0xe0ab('0xe'));var Redis=require(_0xe0ab('0xf'));var authService=require(_0xe0ab('0x10'));var qs=require(_0xe0ab('0x11'));var as=require(_0xe0ab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe0ab('0x13'));var utils=require('../../config/utils');var config=require(_0xe0ab('0x14'));var licenseUtil=require(_0xe0ab('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ba06,_0x5aa1dc){_0x5aa1dc=_0x5aa1dc||0xcc;return function(_0x2d2812){if(_0x2d2812){return _0x11ba06[_0xe0ab('0x16')](_0x5aa1dc);}return _0x11ba06[_0xe0ab('0x17')](_0x5aa1dc)[_0xe0ab('0x18')]();};}function respondWithResult(_0x14d5ad,_0x5e0331){_0x5e0331=_0x5e0331||0xc8;return function(_0x536712){if(_0x536712){return _0x14d5ad[_0xe0ab('0x17')](_0x5e0331)[_0xe0ab('0x19')](_0x536712);}};}function respondWithFilteredResult(_0x59f487,_0x10fe05){return function(_0x12cce8){if(_0x12cce8){var _0x572f13=typeof _0x10fe05[_0xe0ab('0x1a')]===_0xe0ab('0x1b')&&typeof _0x10fe05['limit']===_0xe0ab('0x1b');var _0x2ed515=_0x12cce8[_0xe0ab('0x1c')];var _0x30fe41=_0x572f13?0x0:_0x10fe05[_0xe0ab('0x1a')];var _0x214b5a=_0x572f13?_0x12cce8[_0xe0ab('0x1c')]:_0x10fe05[_0xe0ab('0x1a')]+_0x10fe05[_0xe0ab('0x1d')];var _0x10e882;if(_0x214b5a>=_0x2ed515){_0x214b5a=_0x2ed515;_0x10e882=0xc8;}else{_0x10e882=0xce;}_0x59f487['status'](_0x10e882);return _0x59f487[_0xe0ab('0x1e')](_0xe0ab('0x1f'),_0x30fe41+'-'+_0x214b5a+'/'+_0x2ed515)[_0xe0ab('0x19')](_0x12cce8);}return null;};}function patchUpdates(_0x5853dc){return function(_0x10569a){try{jsonpatch[_0xe0ab('0x20')](_0x10569a,_0x5853dc,!![]);}catch(_0x816d3e){return BPromise[_0xe0ab('0x21')](_0x816d3e);}return _0x10569a[_0xe0ab('0x22')]();};}function saveUpdates(_0x13321f,_0x4cd955){return function(_0x192bdb){if(_0x192bdb){return _0x192bdb[_0xe0ab('0x23')](_0x13321f)['then'](function(_0x395c20){return _0x395c20;});}return null;};}function removeEntity(_0x1650c3,_0x1c85f1){return function(_0x5ebb27){if(_0x5ebb27){return _0x5ebb27['destroy']()['then'](function(){_0x1650c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x757f41,_0x54d607){return function(_0x497833){if(!_0x497833){_0x757f41[_0xe0ab('0x16')](0x194);}return _0x497833;};}function handleError(_0x1ac0c4,_0x5b2e35){_0x5b2e35=_0x5b2e35||0x1f4;return function(_0x5a2c1b){logger[_0xe0ab('0x24')](_0x5a2c1b[_0xe0ab('0x25')]);if(_0x5a2c1b['name']){delete _0x5a2c1b['name'];}_0x1ac0c4[_0xe0ab('0x17')](_0x5b2e35)[_0xe0ab('0x26')](_0x5a2c1b);};}function getMustacheRender(_0x304fa4,_0xa0e1c9){return Mustache[_0xe0ab('0x27')](_0x304fa4,_[_0xe0ab('0x28')](_0xa0e1c9[_0xe0ab('0x29')],{'contact':_0xa0e1c9[_0xe0ab('0x2a')],'message':_0xa0e1c9[_0xe0ab('0x2b')],'agent':_0xa0e1c9[_0xe0ab('0x2c')],'interaction':_0xa0e1c9[_0xe0ab('0x2d')],'account':_0xa0e1c9[_0xe0ab('0x2e')]}))||'';}exports['update']=function(_0x3d69ef,_0x4828ef){if(_0x3d69ef[_0xe0ab('0x29')]['id']){delete _0x3d69ef[_0xe0ab('0x29')]['id'];}return db['Action'][_0xe0ab('0x2f')]({'where':{'id':_0x3d69ef['params']['id']}})[_0xe0ab('0x30')](handleEntityNotFound(_0x4828ef,null))[_0xe0ab('0x30')](saveUpdates(_0x3d69ef[_0xe0ab('0x29')],null))[_0xe0ab('0x30')](respondWithResult(_0x4828ef,null))['catch'](handleError(_0x4828ef,null));};exports[_0xe0ab('0x31')]=function(_0x3cc202,_0x21a824){return db[_0xe0ab('0x32')][_0xe0ab('0x2f')]({'where':{'id':_0x3cc202[_0xe0ab('0x33')]['id']}})[_0xe0ab('0x30')](handleEntityNotFound(_0x21a824,null))['then'](removeEntity(_0x21a824,null))[_0xe0ab('0x34')](handleError(_0x21a824,null));}; \ No newline at end of file +var _0x117d=['account','Action','catch','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','send','render','merge','body','contact','message','agent','interaction'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0x117d,0xac));var _0xd117=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x117d[_0x20b29c];return _0x20d81b;};'use strict';var emlformat=require(_0xd117('0x0'));var rimraf=require(_0xd117('0x1'));var zipdir=require(_0xd117('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd117('0x3'));var moment=require(_0xd117('0x4'));var BPromise=require(_0xd117('0x5'));var Mustache=require(_0xd117('0x6'));var util=require(_0xd117('0x7'));var path=require('path');var sox=require(_0xd117('0x8'));var csv=require(_0xd117('0x9'));var ejs=require(_0xd117('0xa'));var fs=require('fs');var fs_extra=require(_0xd117('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd117('0xc'));var jsforce=require(_0xd117('0xd'));var deskjs=require(_0xd117('0xe'));var toCsv=require(_0xd117('0x9'));var querystring=require(_0xd117('0xf'));var Papa=require(_0xd117('0x10'));var Redis=require(_0xd117('0x11'));var authService=require(_0xd117('0x12'));var qs=require(_0xd117('0x13'));var as=require(_0xd117('0x14'));var hardwareService=require(_0xd117('0x15'));var logger=require(_0xd117('0x16'))(_0xd117('0x17'));var utils=require('../../config/utils');var config=require(_0xd117('0x18'));var licenseUtil=require(_0xd117('0x19'));var db=require(_0xd117('0x1a'))['db'];function respondWithStatusCode(_0x330927,_0x155a78){_0x155a78=_0x155a78||0xcc;return function(_0x4b61b6){if(_0x4b61b6){return _0x330927['sendStatus'](_0x155a78);}return _0x330927[_0xd117('0x1b')](_0x155a78)['end']();};}function respondWithResult(_0x2684f0,_0x58eee9){_0x58eee9=_0x58eee9||0xc8;return function(_0x1c7d8d){if(_0x1c7d8d){return _0x2684f0['status'](_0x58eee9)[_0xd117('0x1c')](_0x1c7d8d);}};}function respondWithFilteredResult(_0x46b3f3,_0x1825c4){return function(_0x59d636){if(_0x59d636){var _0xf4ec6=typeof _0x1825c4['offset']===_0xd117('0x1d')&&typeof _0x1825c4['limit']===_0xd117('0x1d');var _0x491e5f=_0x59d636['count'];var _0x14624b=_0xf4ec6?0x0:_0x1825c4[_0xd117('0x1e')];var _0x2a83c7=_0xf4ec6?_0x59d636[_0xd117('0x1f')]:_0x1825c4[_0xd117('0x1e')]+_0x1825c4[_0xd117('0x20')];var _0x47e18a;if(_0x2a83c7>=_0x491e5f){_0x2a83c7=_0x491e5f;_0x47e18a=0xc8;}else{_0x47e18a=0xce;}_0x46b3f3[_0xd117('0x1b')](_0x47e18a);return _0x46b3f3[_0xd117('0x21')](_0xd117('0x22'),_0x14624b+'-'+_0x2a83c7+'/'+_0x491e5f)[_0xd117('0x1c')](_0x59d636);}return null;};}function patchUpdates(_0x409fa7){return function(_0x19997d){try{jsonpatch[_0xd117('0x23')](_0x19997d,_0x409fa7,!![]);}catch(_0x11a3c2){return BPromise[_0xd117('0x24')](_0x11a3c2);}return _0x19997d[_0xd117('0x25')]();};}function saveUpdates(_0xe6af2,_0x34b994){return function(_0x96c5b4){if(_0x96c5b4){return _0x96c5b4[_0xd117('0x26')](_0xe6af2)['then'](function(_0x277991){return _0x277991;});}return null;};}function removeEntity(_0x4a9160,_0x17f3b0){return function(_0x59cbb5){if(_0x59cbb5){return _0x59cbb5[_0xd117('0x27')]()[_0xd117('0x28')](function(){_0x4a9160[_0xd117('0x1b')](0xcc)[_0xd117('0x29')]();});}};}function handleEntityNotFound(_0x371ed0,_0x427a68){return function(_0x5968e5){if(!_0x5968e5){_0x371ed0['sendStatus'](0x194);}return _0x5968e5;};}function handleError(_0x462e30,_0x561346){_0x561346=_0x561346||0x1f4;return function(_0x4f5b39){logger[_0xd117('0x2a')](_0x4f5b39['stack']);if(_0x4f5b39['name']){delete _0x4f5b39[_0xd117('0x2b')];}_0x462e30['status'](_0x561346)[_0xd117('0x2c')](_0x4f5b39);};}function getMustacheRender(_0x4fbcba,_0x57a9ce){return Mustache[_0xd117('0x2d')](_0x4fbcba,_[_0xd117('0x2e')](_0x57a9ce[_0xd117('0x2f')],{'contact':_0x57a9ce[_0xd117('0x30')],'message':_0x57a9ce[_0xd117('0x31')],'agent':_0x57a9ce[_0xd117('0x32')],'interaction':_0x57a9ce[_0xd117('0x33')],'account':_0x57a9ce[_0xd117('0x34')]}))||'';}exports[_0xd117('0x26')]=function(_0x4d1964,_0x33e0c9){if(_0x4d1964['body']['id']){delete _0x4d1964[_0xd117('0x2f')]['id'];}return db[_0xd117('0x35')]['find']({'where':{'id':_0x4d1964['params']['id']}})['then'](handleEntityNotFound(_0x33e0c9,null))[_0xd117('0x28')](saveUpdates(_0x4d1964[_0xd117('0x2f')],null))[_0xd117('0x28')](respondWithResult(_0x33e0c9,null))[_0xd117('0x36')](handleError(_0x33e0c9,null));};exports[_0xd117('0x27')]=function(_0x2db68a,_0x26ee94){return db['Action']['find']({'where':{'id':_0x2db68a[_0xd117('0x37')]['id']}})[_0xd117('0x28')](handleEntityNotFound(_0x26ee94,null))[_0xd117('0x28')](removeEntity(_0x26ee94,null))[_0xd117('0x36')](handleError(_0x26ee94,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index a8fa7ba..477a264 100644 --- a/server/api/action/action.model.js +++ b/server/api/action/action.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8189=['exports','define','Action','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13d49e,_0x2c9cac){var _0x4660f4=function(_0x1091cb){while(--_0x1091cb){_0x13d49e['push'](_0x13d49e['shift']());}};_0x4660f4(++_0x2c9cac);}(_0x8189,0x66));var _0x9818=function(_0x40051c,_0x5d563c){_0x40051c=_0x40051c-0x0;var _0x1d3f8b=_0x8189[_0x40051c];return _0x1d3f8b;};'use strict';var _=require(_0x9818('0x0'));var util=require(_0x9818('0x1'));var logger=require('../../config/logger')(_0x9818('0x2'));var moment=require('moment');var BPromise=require(_0x9818('0x3'));var rp=require(_0x9818('0x4'));var fs=require('fs');var path=require(_0x9818('0x5'));var rimraf=require(_0x9818('0x6'));var config=require(_0x9818('0x7'));var attributes=require('./action.attributes');module[_0x9818('0x8')]=function(_0x5d8d1f,_0x447550){return _0x5d8d1f[_0x9818('0x9')](_0x9818('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf652=['../../config/environment','./action.attributes','exports','Action','tools_actions','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x379de6,_0x46ce91){var _0x287d88=function(_0xd72c89){while(--_0xd72c89){_0x379de6['push'](_0x379de6['shift']());}};_0x287d88(++_0x46ce91);}(_0xf652,0xe1));var _0x2f65=function(_0x37fcda,_0x4c732a){_0x37fcda=_0x37fcda-0x0;var _0x2fc82c=_0xf652[_0x37fcda];return _0x2fc82c;};'use strict';var _=require('lodash');var util=require(_0x2f65('0x0'));var logger=require(_0x2f65('0x1'))(_0x2f65('0x2'));var moment=require(_0x2f65('0x3'));var BPromise=require(_0x2f65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2f65('0x5'));var config=require(_0x2f65('0x6'));var attributes=require(_0x2f65('0x7'));module[_0x2f65('0x8')]=function(_0x347213,_0x395cd3){return _0x347213['define'](_0x2f65('0x9'),attributes,{'tableName':_0x2f65('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index b2b26a9..ae2538f 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1bbfb6,_0x1bf29f){var _0x3a38c6=function(_0x1a3249){while(--_0x1a3249){_0x1bbfb6['push'](_0x1bbfb6['shift']());}};_0x3a38c6(++_0x1bf29f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x24e0d6,_0x5de89f){var _0x2dd79b=function(_0x733665){while(--_0x733665){_0x24e0d6['push'](_0x24e0d6['shift']());}};_0x2dd79b(++_0x5de89f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 02a2b70..c3c5403 100644 --- a/server/api/action/index.js +++ b/server/api/action/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f7c=['../../components/interaction/service','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x8f7c,0x133));var _0xc8f7=function(_0x58b603,_0x450f6d){_0x58b603=_0x58b603-0x0;var _0xf76126=_0x8f7c[_0x58b603];return _0xf76126;};'use strict';var multer=require(_0xc8f7('0x0'));var util=require(_0xc8f7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc8f7('0x2'));var router=express['Router']();var fs_extra=require(_0xc8f7('0x3'));var auth=require(_0xc8f7('0x4'));var interaction=require(_0xc8f7('0x5'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0xc8f7('0x6')]('/:id',auth[_0xc8f7('0x7')](),controller[_0xc8f7('0x8')]);router[_0xc8f7('0x9')](_0xc8f7('0xa'),auth[_0xc8f7('0x7')](),controller[_0xc8f7('0xb')]);module[_0xc8f7('0xc')]=router; \ No newline at end of file +var _0x8b2b=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x3e362,_0x4f3232){var _0x313f58=function(_0x10b597){while(--_0x10b597){_0x3e362['push'](_0x3e362['shift']());}};_0x313f58(++_0x4f3232);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x2fd30e,_0x514031){_0x2fd30e=_0x2fd30e-0x0;var _0x87d832=_0x8b2b[_0x2fd30e];return _0x87d832;};'use strict';var multer=require(_0xb8b2('0x0'));var util=require(_0xb8b2('0x1'));var path=require(_0xb8b2('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8b2('0x3'));var router=express[_0xb8b2('0x4')]();var fs_extra=require(_0xb8b2('0x5'));var auth=require(_0xb8b2('0x6'));var interaction=require(_0xb8b2('0x7'));var config=require(_0xb8b2('0x8'));var controller=require('./action.controller');router['put'](_0xb8b2('0x9'),auth[_0xb8b2('0xa')](),controller[_0xb8b2('0xb')]);router[_0xb8b2('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb8b2('0xd')]);module[_0xb8b2('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 439faf9..9fb0a82 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5c7=['TEXT','sequelize','STRING'];(function(_0x52b88f,_0x16d90d){var _0x42da99=function(_0x37533f){while(--_0x37533f){_0x52b88f['push'](_0x52b88f['shift']());}};_0x42da99(++_0x16d90d);}(_0xe5c7,0x1cf));var _0x7e5c=function(_0x2b8063,_0x27b6de){_0x2b8063=_0x2b8063-0x0;var _0x440ae3=_0xe5c7[_0x2b8063];return _0x440ae3;};'use strict';var Sequelize=require(_0x7e5c('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e5c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7e5c('0x1')]},'table':{'type':Sequelize[_0x7e5c('0x1')]},'conditions':{'type':Sequelize[_0x7e5c('0x2')]},'joins':{'type':Sequelize[_0x7e5c('0x2')]}}; \ No newline at end of file +var _0x7889=['STRING','TEXT','exports'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x7889,0x1eb));var _0x9788=function(_0x31fe05,_0x4c4081){_0x31fe05=_0x31fe05-0x0;var _0x4d6bca=_0x7889[_0x31fe05];return _0x4d6bca;};'use strict';var Sequelize=require('sequelize');module[_0x9788('0x0')]={'name':{'type':Sequelize[_0x9788('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9788('0x1')]},'parent':{'type':Sequelize[_0x9788('0x1')]},'table':{'type':Sequelize[_0x9788('0x1')]},'conditions':{'type':Sequelize[_0x9788('0x2')]},'joins':{'type':Sequelize[_0x9788('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b59831b..e500b3b 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.controller.js +++ b/server/api/analyticCustomReport/analyticCustomReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74d6=['COUNT(DISTINCT\x20%s)','IS\x20NOT\x20NULL','metric','debug','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','CustomReports','error','stack','name','render','merge','contact','message','interaction','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','includeAll','include','findAll','rows','catch','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','IS\x20EMPTY','Sequelize','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../files/reports','savename','COUNT(*)','run','runReport'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x74d6,0x14c));var _0x674d=function(_0x7f409f,_0x27bafd){_0x7f409f=_0x7f409f-0x0;var _0x55a058=_0x74d6[_0x7f409f];return _0x55a058;};'use strict';var emlformat=require(_0x674d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x674d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x674d('0x2'));var moment=require(_0x674d('0x3'));var BPromise=require(_0x674d('0x4'));var Mustache=require('mustache');var util=require(_0x674d('0x5'));var path=require(_0x674d('0x6'));var sox=require(_0x674d('0x7'));var csv=require(_0x674d('0x8'));var ejs=require(_0x674d('0x9'));var fs=require('fs');var fs_extra=require(_0x674d('0xa'));var _=require(_0x674d('0xb'));var squel=require(_0x674d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x674d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x674d('0xe'));var Redis=require(_0x674d('0xf'));var authService=require(_0x674d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x674d('0x11'));var logger=require('../../config/logger')(_0x674d('0x12'));var utils=require(_0x674d('0x13'));var config=require(_0x674d('0x14'));var licenseUtil=require(_0x674d('0x15'));var db=require(_0x674d('0x16'))['db'];var dbH=require('../../mysqldb')[_0x674d('0x17')];function respondWithStatusCode(_0x1ecbf0,_0x35b399){_0x35b399=_0x35b399||0xcc;return function(_0x30692c){if(_0x30692c){return _0x1ecbf0[_0x674d('0x18')](_0x35b399);}return _0x1ecbf0[_0x674d('0x19')](_0x35b399)[_0x674d('0x1a')]();};}function respondWithResult(_0x3b2a9d,_0x5a9aff){_0x5a9aff=_0x5a9aff||0xc8;return function(_0x2f4624){if(_0x2f4624){return _0x3b2a9d['status'](_0x5a9aff)['json'](_0x2f4624);}};}function respondWithFilteredResult(_0x5e95ba,_0xc66ffd){return function(_0xac4f85){if(_0xac4f85){var _0x3c904a=typeof _0xc66ffd[_0x674d('0x1b')]===_0x674d('0x1c')&&typeof _0xc66ffd[_0x674d('0x1d')]==='undefined';var _0x39d254=_0xac4f85['count'];var _0x37e681=_0x3c904a?0x0:_0xc66ffd[_0x674d('0x1b')];var _0x37c001=_0x3c904a?_0xac4f85[_0x674d('0x1e')]:_0xc66ffd['offset']+_0xc66ffd[_0x674d('0x1d')];var _0x36a682;if(_0x37c001>=_0x39d254){_0x37c001=_0x39d254;_0x36a682=0xc8;}else{_0x36a682=0xce;}_0x5e95ba[_0x674d('0x19')](_0x36a682);return _0x5e95ba[_0x674d('0x1f')](_0x674d('0x20'),_0x37e681+'-'+_0x37c001+'/'+_0x39d254)['json'](_0xac4f85);}return null;};}function patchUpdates(_0x40cf32){return function(_0x2d6f19){try{jsonpatch[_0x674d('0x21')](_0x2d6f19,_0x40cf32,!![]);}catch(_0x4ac6fb){return BPromise[_0x674d('0x22')](_0x4ac6fb);}return _0x2d6f19['save']();};}function saveUpdates(_0x5c9995,_0x1275dd){return function(_0x576013){if(_0x576013){return _0x576013['update'](_0x5c9995)[_0x674d('0x23')](function(_0x3d04f9){return _0x3d04f9;});}return null;};}function removeEntity(_0x566fbc,_0x271e5e){return function(_0x36f147){if(_0x36f147){return _0x36f147[_0x674d('0x24')]()[_0x674d('0x23')](function(){var _0x4b869b=_0x36f147[_0x674d('0x25')]({'plain':!![]});var _0x56136c=_0x674d('0x26');return db['UserProfileResource'][_0x674d('0x24')]({'where':{'type':_0x56136c,'resourceId':_0x4b869b['id']}})[_0x674d('0x23')](function(){return _0x36f147;});})[_0x674d('0x23')](function(){_0x566fbc[_0x674d('0x19')](0xcc)[_0x674d('0x1a')]();});}};}function handleEntityNotFound(_0x122241,_0x3e9d2c){return function(_0x10ff7e){if(!_0x10ff7e){_0x122241[_0x674d('0x18')](0x194);}return _0x10ff7e;};}function handleError(_0x2a1bc0,_0x582e95){_0x582e95=_0x582e95||0x1f4;return function(_0x53f631){logger[_0x674d('0x27')](_0x53f631[_0x674d('0x28')]);if(_0x53f631[_0x674d('0x29')]){delete _0x53f631['name'];}_0x2a1bc0[_0x674d('0x19')](_0x582e95)['send'](_0x53f631);};}function getMustacheRender(_0x206d5b,_0x2acc63){return Mustache[_0x674d('0x2a')](_0x206d5b,_[_0x674d('0x2b')](_0x2acc63['body'],{'contact':_0x2acc63[_0x674d('0x2c')],'message':_0x2acc63[_0x674d('0x2d')],'agent':_0x2acc63['agent'],'interaction':_0x2acc63[_0x674d('0x2e')],'account':_0x2acc63['account']}))||'';}exports['index']=function(_0x4f17a0,_0x3e340b){var _0xb9cea2={},_0x39b99a={},_0x3c51f4={'count':0x0,'rows':[]};var _0x5c7454=_[_0x674d('0x2f')](db[_0x674d('0x30')][_0x674d('0x31')],function(_0x572253){return{'name':_0x572253[_0x674d('0x32')],'type':_0x572253[_0x674d('0x33')][_0x674d('0x34')]};});_0x39b99a[_0x674d('0x35')]=_[_0x674d('0x2f')](_0x5c7454,_0x674d('0x29'));_0x39b99a[_0x674d('0x36')]=_[_0x674d('0x37')](_0x4f17a0['query']);_0x39b99a[_0x674d('0x38')]=_[_0x674d('0x39')](_0x39b99a[_0x674d('0x35')],_0x39b99a[_0x674d('0x36')]);_0xb9cea2['attributes']=_['intersection'](_0x39b99a[_0x674d('0x35')],qs[_0x674d('0x3a')](_0x4f17a0['query']['fields']));_0xb9cea2['attributes']=_0xb9cea2[_0x674d('0x3b')][_0x674d('0x3c')]?_0xb9cea2[_0x674d('0x3b')]:_0x39b99a[_0x674d('0x35')];if(!_0x4f17a0[_0x674d('0x36')][_0x674d('0x3d')](_0x674d('0x3e'))){_0xb9cea2[_0x674d('0x1d')]=qs[_0x674d('0x1d')](_0x4f17a0[_0x674d('0x36')][_0x674d('0x1d')]);_0xb9cea2[_0x674d('0x1b')]=qs[_0x674d('0x1b')](_0x4f17a0[_0x674d('0x36')][_0x674d('0x1b')]);}_0xb9cea2[_0x674d('0x3f')]=qs['sort'](_0x4f17a0['query'][_0x674d('0x40')]);_0xb9cea2['where']=qs['filters'](_[_0x674d('0x41')](_0x4f17a0[_0x674d('0x36')],_0x39b99a['filters']),_0x5c7454);if(_0x4f17a0[_0x674d('0x36')]['filter']){_0xb9cea2[_0x674d('0x42')]=_[_0x674d('0x2b')](_0xb9cea2[_0x674d('0x42')],{'$or':_[_0x674d('0x2f')](_0x5c7454,function(_0x16a82f){if(_0x16a82f[_0x674d('0x33')]!=='VIRTUAL'){var _0x384156={};_0x384156[_0x16a82f[_0x674d('0x29')]]={'$like':'%'+_0x4f17a0[_0x674d('0x36')]['filter']+'%'};return _0x384156;}})});}_0xb9cea2=_[_0x674d('0x2b')]({},_0xb9cea2,_0x4f17a0['options']);var _0x1aeb0f={'where':_0xb9cea2['where']};return db[_0x674d('0x30')][_0x674d('0x1e')](_0x1aeb0f)['then'](function(_0x223684){_0x3c51f4['count']=_0x223684;if(_0x4f17a0[_0x674d('0x36')][_0x674d('0x43')]){_0xb9cea2[_0x674d('0x44')]=[{'all':!![]}];}return db[_0x674d('0x30')][_0x674d('0x45')](_0xb9cea2);})[_0x674d('0x23')](function(_0x55333d){_0x3c51f4[_0x674d('0x46')]=_0x55333d;return _0x3c51f4;})[_0x674d('0x23')](respondWithFilteredResult(_0x3e340b,_0xb9cea2))[_0x674d('0x47')](handleError(_0x3e340b,null));};exports['show']=function(_0x7576dc,_0x381c03){var _0x1a18d3={'raw':![],'where':{'id':_0x7576dc['params']['id']}},_0x413f7d={};_0x413f7d[_0x674d('0x35')]=_[_0x674d('0x37')](db[_0x674d('0x30')][_0x674d('0x31')]);_0x413f7d['query']=_[_0x674d('0x37')](_0x7576dc[_0x674d('0x36')]);_0x413f7d[_0x674d('0x38')]=_[_0x674d('0x39')](_0x413f7d[_0x674d('0x35')],_0x413f7d[_0x674d('0x36')]);_0x1a18d3[_0x674d('0x3b')]=_[_0x674d('0x39')](_0x413f7d[_0x674d('0x35')],qs[_0x674d('0x3a')](_0x7576dc[_0x674d('0x36')][_0x674d('0x3a')]));_0x1a18d3['attributes']=_0x1a18d3[_0x674d('0x3b')]['length']?_0x1a18d3[_0x674d('0x3b')]:_0x413f7d[_0x674d('0x35')];if(_0x7576dc[_0x674d('0x36')][_0x674d('0x43')]){_0x1a18d3[_0x674d('0x44')]=[{'all':!![]}];}_0x1a18d3=_[_0x674d('0x2b')]({},_0x1a18d3,_0x7576dc[_0x674d('0x48')]);return db[_0x674d('0x30')][_0x674d('0x49')](_0x1a18d3)['then'](handleEntityNotFound(_0x381c03,null))[_0x674d('0x23')](respondWithResult(_0x381c03,null))[_0x674d('0x47')](handleError(_0x381c03,null));};exports[_0x674d('0x4a')]=function(_0x42e50c,_0x222f3f){return db[_0x674d('0x30')]['create'](_0x42e50c[_0x674d('0x4b')],{})[_0x674d('0x23')](function(_0x4e1790){var _0x16f318=_0x42e50c[_0x674d('0x4c')][_0x674d('0x25')]({'plain':!![]});if(!_0x16f318)throw new Error(_0x674d('0x4d'));if(_0x16f318['role']===_0x674d('0x4c')){var _0x1cc031=_0x4e1790['get']({'plain':!![]});var _0x3cacb9=_0x674d('0x4e');return db[_0x674d('0x4f')][_0x674d('0x49')]({'where':{'name':_0x3cacb9,'userProfileId':_0x16f318['userProfileId']},'raw':!![]})[_0x674d('0x23')](function(_0x49813a){if(_0x49813a&&_0x49813a[_0x674d('0x50')]===0x0){return db['UserProfileResource'][_0x674d('0x4a')]({'name':_0x1cc031[_0x674d('0x29')],'resourceId':_0x1cc031['id'],'type':_0x674d('0x26'),'sectionId':_0x49813a['id']},{})['then'](function(){return _0x4e1790;});}else{return _0x4e1790;}})['catch'](function(_0x48213d){logger[_0x674d('0x27')](_0x674d('0x51'),_0x48213d);throw _0x48213d;});}return _0x4e1790;})[_0x674d('0x23')](respondWithResult(_0x222f3f,0xc9))['catch'](handleError(_0x222f3f,null));};exports[_0x674d('0x52')]=function(_0x277650,_0x56e1e1){if(_0x277650['body']['id']){delete _0x277650[_0x674d('0x4b')]['id'];}return db[_0x674d('0x30')][_0x674d('0x49')]({'where':{'id':_0x277650[_0x674d('0x53')]['id']}})[_0x674d('0x23')](handleEntityNotFound(_0x56e1e1,null))[_0x674d('0x23')](saveUpdates(_0x277650[_0x674d('0x4b')],null))['then'](respondWithResult(_0x56e1e1,null))[_0x674d('0x47')](handleError(_0x56e1e1,null));};exports[_0x674d('0x24')]=function(_0x598993,_0x2f25e9){return db[_0x674d('0x30')][_0x674d('0x49')]({'where':{'id':_0x598993[_0x674d('0x53')]['id']}})[_0x674d('0x23')](handleEntityNotFound(_0x2f25e9,null))[_0x674d('0x23')](removeEntity(_0x2f25e9,null))[_0x674d('0x47')](handleError(_0x2f25e9,null));};exports[_0x674d('0x54')]=function(_0x4b35aa,_0x486ad2){var _0x246eaf=0xa;var _0x47ae04=[_0x674d('0x55'),_0x674d('0x56'),_0x674d('0x57'),'cross_join'];var _0x2fdd49={'SUM':_0x674d('0x58'),'COUNT':_0x674d('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x674d('0x5a'),'MIN':_0x674d('0x5b'),'AVG':_0x674d('0x5c'),'GROUP_CONCAT':_0x674d('0x5d'),'GROUP_CONCAT ASC':_0x674d('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x408bc9={'SEC_TO_TIME':_0x674d('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x674d('0x60'),'UNIX_TIMESTAMP':_0x674d('0x61')};var _0x49776f=function(_0x47c018){return!_[_0x674d('0x62')]([_0x674d('0x63'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x674d('0x64')],_0x47c018);};var _0xd80fc6=function(_0xb605ce){if(!_0xb605ce||!_0xb605ce[_0x674d('0x65')][_0x674d('0x3c')]){return'';}for(var _0x1f1f7f='(',_0x3f7bb5=0x0;_0x3f7bb5<_0xb605ce[_0x674d('0x65')][_0x674d('0x3c')];_0x3f7bb5+=0x1){_0x3f7bb5>0x0&&(_0x1f1f7f+='\x20'+_0xb605ce['operator']+'\x20');_0x1f1f7f+=_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x66')]?_0xd80fc6(_0xb605ce[_0x674d('0x65')][_0x3f7bb5]['group']):_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x67')]+'\x20'+_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x68')]+(_0x49776f(_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x68')])?'\x20'+_0xb605ce[_0x674d('0x65')][_0x3f7bb5][_0x674d('0x69')]:'');}return _0x1f1f7f+')';};var _0x10ffed={'where':{'id':_0x4b35aa[_0x674d('0x53')]['id']}},_0x328caf,_0x1ea901,_0x1d2c0a,_0x301d06,_0x56a503;_0x10ffed=_[_0x674d('0x2b')]({},_0x10ffed,_0x4b35aa[_0x674d('0x48')]);return db[_0x674d('0x30')][_0x674d('0x49')](_0x10ffed)['then'](function(_0x238598){if(_0x238598){_0x328caf=_0x238598;return _0x238598[_0x674d('0x6a')]();}return null;})[_0x674d('0x23')](function(_0x434de7){if(_0x434de7){if(!_0x434de7[_0x674d('0x3c')]){throw new db['Sequelize'][(_0x674d('0x6b'))](_0x674d('0x6c'),0x193);}_0x1ea901=_0x434de7;return db[_0x674d('0x6d')][_0x674d('0x45')]({'raw':!![]});}return null;})[_0x674d('0x23')](function(_0x503b93){if(_0x503b93){_0x1d2c0a=_[_0x674d('0x6e')](_0x503b93,'id');var _0x1f647a;var _0x4944fe=squel[_0x674d('0x6f')]();_0x4944fe[_0x674d('0x70')](_0x328caf[_0x674d('0x71')]);for(var _0x3411f2=0x0;_0x3411f2<_0x1ea901[_0x674d('0x3c')];_0x3411f2+=0x1){_0x1f647a=_0x1ea901[_0x3411f2]['MetricId']?_0x1d2c0a[_0x1ea901[_0x3411f2][_0x674d('0x72')]]['metric']:_0x1ea901[_0x3411f2]['field'];_0x1f647a=_0x1ea901[_0x3411f2]['function']?_[_0x674d('0x73')](_0x2fdd49[_0x1ea901[_0x3411f2][_0x674d('0x74')]],'%s',_0x1f647a):_0x1f647a;_0x1f647a=_0x1ea901[_0x3411f2][_0x674d('0x75')]?_['replace'](_0x408bc9[_0x1ea901[_0x3411f2][_0x674d('0x75')]],'%s',_0x1f647a):_0x1f647a;if(_0x1ea901[_0x3411f2][_0x674d('0x76')]){_0x4944fe[_0x674d('0x66')](_0x1f647a);}_0x1ea901[_0x3411f2]['orderBy']&&_0x4944fe[_0x674d('0x3f')](_0x1f647a,_0x1ea901[_0x3411f2][_0x674d('0x77')]===_0x674d('0x78')?![]:!![]);_0x4944fe[_0x674d('0x67')](_0x1f647a,_0x1ea901[_0x3411f2][_0x674d('0x79')]||_0x1f647a);}if(_0x328caf[_0x674d('0x7a')]){_0x328caf[_0x674d('0x7a')]=JSON[_0x674d('0x7b')](_0x328caf[_0x674d('0x7a')]);for(var _0x4768b2=0x0;_0x4768b2<_0x328caf[_0x674d('0x7a')][_0x674d('0x3c')];_0x4768b2+=0x1){if(_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x33')]&&_[_0x674d('0x62')](_0x47ae04,_0x328caf[_0x674d('0x7a')][_0x4768b2]['type'])&&_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7c')]&&_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7d')]&&_0x328caf['joins'][_0x4768b2][_0x674d('0x7e')]){_0x4944fe[_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x33')]](_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x328caf[_0x674d('0x71')],_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7c')],_0x328caf['joins'][_0x4768b2]['foreignTable'],_0x328caf[_0x674d('0x7a')][_0x4768b2][_0x674d('0x7e')]));}}}if(_0x328caf['conditions']){_0x328caf[_0x674d('0x7f')]=JSON[_0x674d('0x7b')](_0x328caf[_0x674d('0x7f')]);_0x4944fe['where'](_0xd80fc6(_0x328caf[_0x674d('0x7f')][_0x674d('0x66')]));}_0x56a503=_0x4944fe[_0x674d('0x80')]();_0x4944fe[_0x674d('0x1d')](_0x246eaf);_0x4944fe['offset'](0x0);logger['debug'](_0x674d('0x81'),_0x4944fe[_0x674d('0x82')]());return dbH[_0x674d('0x83')]['query'](_0x4944fe[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')][_0x674d('0x84')][_0x674d('0x85')]});}})[_0x674d('0x23')](respondWithResult(_0x486ad2,null))[_0x674d('0x47')](handleError(_0x486ad2,null));};function runReport(_0x3ba08b,_0x28e2ef,_0x34061d){var _0x159ff8=_0x28e2ef[_0x674d('0x29')];var _0x13f8d9=0xa;var _0x117865=[_0x674d('0x55'),_0x674d('0x56'),_0x674d('0x57'),_0x674d('0x86')];var _0x36c915={'SUM':_0x674d('0x58'),'COUNT':_0x674d('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x674d('0x5a'),'MIN':'MIN(%s)','AVG':_0x674d('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x674d('0x87')};var _0x5b4244={'SEC_TO_TIME':_0x674d('0x5f'),'DATE':_0x674d('0x88'),'HOUR':_0x674d('0x89'),'ROUND':_0x674d('0x60'),'UNIX_TIMESTAMP':_0x674d('0x61')};var _0x5269ec=function(_0x154dda){return!_[_0x674d('0x62')]([_0x674d('0x63'),'IS\x20NOT\x20NULL',_0x674d('0x8a'),_0x674d('0x64')],_0x154dda);};var _0x41c8fd=function(_0xe78c6c){if(!_0xe78c6c||!_0xe78c6c[_0x674d('0x65')][_0x674d('0x3c')]){return'';}for(var _0x3fa8f3='(',_0x3ba6a8=0x0;_0x3ba6a8<_0xe78c6c[_0x674d('0x65')][_0x674d('0x3c')];_0x3ba6a8+=0x1){_0x3ba6a8>0x0&&(_0x3fa8f3+='\x20'+_0xe78c6c['operator']+'\x20');_0x3fa8f3+=_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x66')]?_0x41c8fd(_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x66')]):_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x67')]+'\x20'+_0xe78c6c[_0x674d('0x65')][_0x3ba6a8][_0x674d('0x68')]+(_0x5269ec(_0xe78c6c[_0x674d('0x65')][_0x3ba6a8]['condition'])?'\x20'+_0xe78c6c[_0x674d('0x65')][_0x3ba6a8]['value']:'');}return _0x3fa8f3+')';};var _0x49efb1={'where':{'id':_0x3ba08b['id']}},_0x105cb0,_0x3ee242,_0xf8f66d,_0x41d871,_0x1c21a3;_0x49efb1=_[_0x674d('0x2b')]({},_0x49efb1,_0x34061d);return db[_0x674d('0x30')][_0x674d('0x49')](_0x49efb1)[_0x674d('0x23')](function(_0x39ce1b){if(_0x39ce1b){_0x105cb0=_0x39ce1b;return _0x39ce1b[_0x674d('0x6a')]();}return null;})[_0x674d('0x23')](function(_0x513e01){if(_0x513e01){if(!_0x513e01['length']){throw new db[(_0x674d('0x8b'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3ee242=_0x513e01;return db[_0x674d('0x6d')][_0x674d('0x45')]({'raw':!![]});}return null;})[_0x674d('0x23')](function(_0x10ecdd){if(_0x10ecdd){_0xf8f66d=_['keyBy'](_0x10ecdd,'id');var _0x584b24;var _0x5d8f8b=squel[_0x674d('0x6f')]();_0x5d8f8b[_0x674d('0x70')](_0x105cb0[_0x674d('0x71')]);for(var _0x461f73=0x0;_0x461f73<_0x3ee242[_0x674d('0x3c')];_0x461f73+=0x1){_0x584b24=_0x3ee242[_0x461f73][_0x674d('0x72')]?_0xf8f66d[_0x3ee242[_0x461f73]['MetricId']]['metric']:_0x3ee242[_0x461f73][_0x674d('0x67')];_0x584b24=_0x3ee242[_0x461f73][_0x674d('0x74')]?_[_0x674d('0x73')](_0x36c915[_0x3ee242[_0x461f73][_0x674d('0x74')]],'%s',_0x584b24):_0x584b24;_0x584b24=_0x3ee242[_0x461f73][_0x674d('0x75')]?_[_0x674d('0x73')](_0x5b4244[_0x3ee242[_0x461f73][_0x674d('0x75')]],'%s',_0x584b24):_0x584b24;if(_0x3ee242[_0x461f73][_0x674d('0x76')]){_0x5d8f8b[_0x674d('0x66')](_0x584b24);}_0x3ee242[_0x461f73][_0x674d('0x77')]&&_0x5d8f8b['order'](_0x584b24,_0x3ee242[_0x461f73][_0x674d('0x77')]==='DESC'?![]:!![]);_0x5d8f8b[_0x674d('0x67')](_0x584b24,_0x3ee242[_0x461f73]['alias']||_0x584b24);}if(_0x105cb0[_0x674d('0x7a')]){_0x105cb0[_0x674d('0x7a')]=JSON[_0x674d('0x7b')](_0x105cb0['joins']);for(var _0x23b1c6=0x0;_0x23b1c6<_0x105cb0['joins']['length'];_0x23b1c6+=0x1){if(_0x105cb0['joins'][_0x23b1c6]['type']&&_['includes'](_0x117865,_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x33')])&&_0x105cb0[_0x674d('0x7a')][_0x23b1c6]['parentKey']&&_0x105cb0['joins'][_0x23b1c6][_0x674d('0x7d')]&&_0x105cb0['joins'][_0x23b1c6][_0x674d('0x7e')]){_0x5d8f8b[_0x105cb0['joins'][_0x23b1c6][_0x674d('0x33')]](_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x7d')],null,util[_0x674d('0x75')](_0x674d('0x8c'),_0x105cb0[_0x674d('0x71')],_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x7c')],_0x105cb0['joins'][_0x23b1c6][_0x674d('0x7d')],_0x105cb0[_0x674d('0x7a')][_0x23b1c6][_0x674d('0x7e')]));}}}if(_0x105cb0[_0x674d('0x7f')]){_0x105cb0['conditions']=JSON['parse'](_0x105cb0[_0x674d('0x7f')]);_0x5d8f8b[_0x674d('0x42')](_0x41c8fd(_0x105cb0['conditions']['group']));}_0x1c21a3=_0x5d8f8b[_0x674d('0x80')]();_0x5d8f8b['limit'](_0x13f8d9);_0x5d8f8b[_0x674d('0x1b')](0x0);return;}})['then'](function(){if(_0x28e2ef[_0x674d('0x8d')]===_0x674d('0x8e')){return null;}var _0x2305c0=_[_0x674d('0x2b')](_0x28e2ef,{'name':_0x28e2ef[_0x674d('0x8f')]||_0x28e2ef[_0x674d('0x29')]||_0x105cb0[_0x674d('0x29')],'basename':_0x159ff8,'savename':util['format'](_0x674d('0x90'),_0x28e2ef[_0x674d('0x29')]||_0x105cb0[_0x674d('0x29')],require('randomstring')['generate'](0x4),_0x28e2ef[_0x674d('0x8d')]||_0x674d('0x91')),'reportId':_0x105cb0['id'],'reportType':'custom'});return db[_0x674d('0x92')][_0x674d('0x4a')](_0x2305c0,{'raw':!![]});})['then'](function(_0x539b38){if(_0x105cb0[_0x674d('0x71')]===_0x674d('0x93')){_0x1c21a3['where'](_0x105cb0['table']+_0x674d('0x94'),_0x28e2ef[_0x674d('0x95')],_0x28e2ef[_0x674d('0x96')]);}else{_0x1c21a3[_0x674d('0x42')](_0x105cb0[_0x674d('0x71')]+_0x674d('0x97'),_0x28e2ef[_0x674d('0x95')],_0x28e2ef[_0x674d('0x96')]);}if(_0x539b38){logger[_0x674d('0x98')](_0x674d('0x99'),_0x1c21a3['toString']());require(_0x674d('0x9a'))['fork'](path[_0x674d('0x55')](__dirname,'../../components/export/',_0x539b38[_0x674d('0x8d')]),[_0x539b38['id'],_0x1c21a3['toString'](),path['join'](__dirname,_0x674d('0x9b'),_0x539b38[_0x674d('0x9c')]),_0x159ff8]);return _0x539b38;}else{var _0x53c79d=squel[_0x674d('0x6f')]();_0x53c79d[_0x674d('0x70')]('('+_0x1c21a3[_0x674d('0x82')]()+')','countTable');_0x53c79d[_0x674d('0x67')](_0x674d('0x9d'),_0x674d('0x1e'));_0x1c21a3[_0x674d('0x1d')](_0x28e2ef[_0x674d('0x1d')]||_0x13f8d9);_0x1c21a3['offset'](_0x28e2ef[_0x674d('0x1b')]||0x0);return dbH[_0x674d('0x83')][_0x674d('0x36')](_0x53c79d[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')]['QueryTypes']['SELECT']})[_0x674d('0x23')](function(_0x9f2776){if(!_0x9f2776[_0x674d('0x3c')]){_0x41d871=0x0;}else{_0x41d871=_0x9f2776[0x0]['count']||0x0;}return dbH[_0x674d('0x83')][_0x674d('0x36')](_0x1c21a3[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')][_0x674d('0x84')]['SELECT']});})[_0x674d('0x23')](function(_0x37eb5b){return{'rows':_0x37eb5b||[],'count':_0x41d871};});}});}exports[_0x674d('0x9e')]=function(_0x1ca350,_0x12ccf9){return runReport(_0x1ca350[_0x674d('0x53')],_0x1ca350['query'],_0x1ca350[_0x674d('0x48')])[_0x674d('0x23')](respondWithResult(_0x12ccf9,null))['catch'](handleError(_0x12ccf9,null));};exports[_0x674d('0x9f')]=runReport;exports[_0x674d('0x36')]=function(_0x51908e,_0x83b310){var _0x3ce7c5=0xa;var _0x231853=[_0x674d('0x55'),_0x674d('0x56'),_0x674d('0x57'),_0x674d('0x86')];var _0x1da20b={'SUM':'SUM(%s)','COUNT':_0x674d('0x59'),'COUNT DISTINCT':_0x674d('0xa0'),'MAX':_0x674d('0x5a'),'MIN':'MIN(%s)','AVG':_0x674d('0x5c'),'GROUP_CONCAT':_0x674d('0x5d'),'GROUP_CONCAT ASC':_0x674d('0x5e'),'GROUP_CONCAT DESC':_0x674d('0x87')};var _0x14d7b7={'SEC_TO_TIME':_0x674d('0x5f'),'DATE':_0x674d('0x88'),'HOUR':'HOUR(%s)','ROUND':_0x674d('0x60'),'UNIX_TIMESTAMP':_0x674d('0x61')};var _0x171ec9=function(_0x16b8cb){return!_[_0x674d('0x62')]([_0x674d('0x63'),_0x674d('0xa1'),_0x674d('0x8a'),_0x674d('0x64')],_0x16b8cb);};var _0x363ed3=function(_0x3a916c){if(!_0x3a916c||!_0x3a916c[_0x674d('0x65')][_0x674d('0x3c')]){return'';}for(var _0x5015f7='(',_0x35ce13=0x0;_0x35ce13<_0x3a916c['rules'][_0x674d('0x3c')];_0x35ce13+=0x1){_0x35ce13>0x0&&(_0x5015f7+='\x20'+_0x3a916c['operator']+'\x20');_0x5015f7+=_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x66')]?_0x363ed3(_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x66')]):_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x67')]+'\x20'+_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x68')]+(_0x171ec9(_0x3a916c[_0x674d('0x65')][_0x35ce13][_0x674d('0x68')])?'\x20'+_0x3a916c['rules'][_0x35ce13][_0x674d('0x69')]:'');}return _0x5015f7+')';};var _0x18afa1={'where':{'id':_0x51908e[_0x674d('0x53')]['id']}},_0x35ede1,_0x1e5d5e,_0x58926d,_0x264853,_0x5e7ff4;_0x18afa1=_[_0x674d('0x2b')]({},_0x18afa1,_0x51908e[_0x674d('0x48')]);return db[_0x674d('0x30')][_0x674d('0x49')](_0x18afa1)['then'](function(_0x46241c){if(_0x46241c){_0x35ede1=_0x46241c;return _0x46241c[_0x674d('0x6a')]();}return null;})['then'](function(_0x3a6391){if(_0x3a6391){if(!_0x3a6391[_0x674d('0x3c')]){throw new db[(_0x674d('0x8b'))][(_0x674d('0x6b'))](_0x674d('0x6c'),0x193);}_0x1e5d5e=_0x3a6391;return db[_0x674d('0x6d')][_0x674d('0x45')]({'raw':!![]});}return null;})[_0x674d('0x23')](function(_0x25dcbb){if(_0x25dcbb){_0x58926d=_[_0x674d('0x6e')](_0x25dcbb,'id');var _0xa3ba8b;var _0x478c3a=squel['select']();_0x478c3a[_0x674d('0x70')](_0x35ede1[_0x674d('0x71')]);for(var _0x6ea95=0x0;_0x6ea95<_0x1e5d5e['length'];_0x6ea95+=0x1){_0xa3ba8b=_0x1e5d5e[_0x6ea95]['MetricId']?_0x58926d[_0x1e5d5e[_0x6ea95][_0x674d('0x72')]][_0x674d('0xa2')]:_0x1e5d5e[_0x6ea95][_0x674d('0x67')];_0xa3ba8b=_0x1e5d5e[_0x6ea95]['function']?_['replace'](_0x1da20b[_0x1e5d5e[_0x6ea95][_0x674d('0x74')]],'%s',_0xa3ba8b):_0xa3ba8b;_0xa3ba8b=_0x1e5d5e[_0x6ea95][_0x674d('0x75')]?_[_0x674d('0x73')](_0x14d7b7[_0x1e5d5e[_0x6ea95]['format']],'%s',_0xa3ba8b):_0xa3ba8b;if(_0x1e5d5e[_0x6ea95][_0x674d('0x76')]){_0x478c3a[_0x674d('0x66')](_0xa3ba8b);}_0x1e5d5e[_0x6ea95][_0x674d('0x77')]&&_0x478c3a[_0x674d('0x3f')](_0xa3ba8b,_0x1e5d5e[_0x6ea95][_0x674d('0x77')]===_0x674d('0x78')?![]:!![]);_0x478c3a[_0x674d('0x67')](_0xa3ba8b,_0x1e5d5e[_0x6ea95][_0x674d('0x79')]||_0xa3ba8b);}if(_0x35ede1['joins']){_0x35ede1[_0x674d('0x7a')]=JSON['parse'](_0x35ede1[_0x674d('0x7a')]);for(var _0x3ac0fb=0x0;_0x3ac0fb<_0x35ede1[_0x674d('0x7a')][_0x674d('0x3c')];_0x3ac0fb+=0x1){if(_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x33')]&&_[_0x674d('0x62')](_0x231853,_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x33')])&&_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7c')]&&_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7d')]&&_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7e')]){_0x478c3a[_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x33')]](_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7d')],null,util[_0x674d('0x75')](_0x674d('0x8c'),_0x35ede1[_0x674d('0x71')],_0x35ede1[_0x674d('0x7a')][_0x3ac0fb][_0x674d('0x7c')],_0x35ede1['joins'][_0x3ac0fb][_0x674d('0x7d')],_0x35ede1[_0x674d('0x7a')][_0x3ac0fb]['foreignKey']));}}}if(_0x35ede1[_0x674d('0x7f')]){_0x35ede1['conditions']=JSON['parse'](_0x35ede1[_0x674d('0x7f')]);_0x478c3a[_0x674d('0x42')](_0x363ed3(_0x35ede1[_0x674d('0x7f')]['group']));}_0x5e7ff4=_0x478c3a[_0x674d('0x80')]();_0x478c3a[_0x674d('0x1d')](_0x3ce7c5);_0x478c3a[_0x674d('0x1b')](0x0);logger[_0x674d('0xa3')](_0x674d('0x81'),_0x478c3a['toString']());return dbH['sequelize'][_0x674d('0x36')](_0x478c3a[_0x674d('0x82')](),{'type':dbH[_0x674d('0x83')][_0x674d('0x84')][_0x674d('0x85')]});}})[_0x674d('0x23')](function(){return{'sql':_0x5e7ff4[_0x674d('0x82')]()};})[_0x674d('0x23')](respondWithResult(_0x83b310,null))[_0x674d('0x47')](handleError(_0x83b310,null));}; \ No newline at end of file +var _0x975f=['GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','function','replace','format','orderBy','alias','joins','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','join','SEC_TO_TIME(%s)','value','groupBy','DESC','output','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','GROUP_CONCAT(%s)','metric','Limited\x20Query:','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','json','reject','update','destroy','then','get','UserProfileResource','name','merge','body','contact','agent','interaction','account','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','params','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x975f,0xf0));var _0xf975=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0x975f[_0x350258];return _0x3714b3;};'use strict';var emlformat=require(_0xf975('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf975('0x1'));var rp=require(_0xf975('0x2'));var moment=require(_0xf975('0x3'));var BPromise=require(_0xf975('0x4'));var Mustache=require('mustache');var util=require(_0xf975('0x5'));var path=require(_0xf975('0x6'));var sox=require(_0xf975('0x7'));var csv=require(_0xf975('0x8'));var ejs=require(_0xf975('0x9'));var fs=require('fs');var fs_extra=require(_0xf975('0xa'));var _=require('lodash');var squel=require(_0xf975('0xb'));var crypto=require(_0xf975('0xc'));var jsforce=require(_0xf975('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf975('0x8'));var querystring=require(_0xf975('0xe'));var Papa=require(_0xf975('0xf'));var Redis=require(_0xf975('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf975('0x11'));var as=require(_0xf975('0x12'));var hardwareService=require(_0xf975('0x13'));var logger=require(_0xf975('0x14'))(_0xf975('0x15'));var utils=require(_0xf975('0x16'));var config=require(_0xf975('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xf975('0x18'))['dbH'];function respondWithStatusCode(_0x3e0cae,_0x236983){_0x236983=_0x236983||0xcc;return function(_0x532402){if(_0x532402){return _0x3e0cae[_0xf975('0x19')](_0x236983);}return _0x3e0cae[_0xf975('0x1a')](_0x236983)[_0xf975('0x1b')]();};}function respondWithResult(_0x3e8475,_0x8d8b75){_0x8d8b75=_0x8d8b75||0xc8;return function(_0x3054f2){if(_0x3054f2){return _0x3e8475[_0xf975('0x1a')](_0x8d8b75)['json'](_0x3054f2);}};}function respondWithFilteredResult(_0x8d4602,_0x7f9411){return function(_0x3f3b57){if(_0x3f3b57){var _0x4d3305=typeof _0x7f9411['offset']===_0xf975('0x1c')&&typeof _0x7f9411[_0xf975('0x1d')]===_0xf975('0x1c');var _0x594949=_0x3f3b57['count'];var _0x455a9e=_0x4d3305?0x0:_0x7f9411[_0xf975('0x1e')];var _0x27d934=_0x4d3305?_0x3f3b57[_0xf975('0x1f')]:_0x7f9411[_0xf975('0x1e')]+_0x7f9411['limit'];var _0x1253dd;if(_0x27d934>=_0x594949){_0x27d934=_0x594949;_0x1253dd=0xc8;}else{_0x1253dd=0xce;}_0x8d4602[_0xf975('0x1a')](_0x1253dd);return _0x8d4602[_0xf975('0x20')]('Content-Range',_0x455a9e+'-'+_0x27d934+'/'+_0x594949)[_0xf975('0x21')](_0x3f3b57);}return null;};}function patchUpdates(_0x590008){return function(_0x1f585f){try{jsonpatch['apply'](_0x1f585f,_0x590008,!![]);}catch(_0x1982e3){return BPromise[_0xf975('0x22')](_0x1982e3);}return _0x1f585f['save']();};}function saveUpdates(_0xf0b32b,_0x4091f1){return function(_0x42d208){if(_0x42d208){return _0x42d208[_0xf975('0x23')](_0xf0b32b)['then'](function(_0x3307fc){return _0x3307fc;});}return null;};}function removeEntity(_0x2cefb7,_0x295ebf){return function(_0x36550a){if(_0x36550a){return _0x36550a[_0xf975('0x24')]()[_0xf975('0x25')](function(){var _0x2099d4=_0x36550a[_0xf975('0x26')]({'plain':!![]});var _0x205f6d='CustomReports';return db[_0xf975('0x27')][_0xf975('0x24')]({'where':{'type':_0x205f6d,'resourceId':_0x2099d4['id']}})[_0xf975('0x25')](function(){return _0x36550a;});})[_0xf975('0x25')](function(){_0x2cefb7['status'](0xcc)[_0xf975('0x1b')]();});}};}function handleEntityNotFound(_0x4e3176,_0x51445f){return function(_0x5b9133){if(!_0x5b9133){_0x4e3176[_0xf975('0x19')](0x194);}return _0x5b9133;};}function handleError(_0x37ac07,_0x17f052){_0x17f052=_0x17f052||0x1f4;return function(_0x468fb9){logger['error'](_0x468fb9['stack']);if(_0x468fb9[_0xf975('0x28')]){delete _0x468fb9['name'];}_0x37ac07[_0xf975('0x1a')](_0x17f052)['send'](_0x468fb9);};}function getMustacheRender(_0xc83474,_0x1b25c7){return Mustache['render'](_0xc83474,_[_0xf975('0x29')](_0x1b25c7[_0xf975('0x2a')],{'contact':_0x1b25c7[_0xf975('0x2b')],'message':_0x1b25c7['message'],'agent':_0x1b25c7[_0xf975('0x2c')],'interaction':_0x1b25c7[_0xf975('0x2d')],'account':_0x1b25c7[_0xf975('0x2e')]}))||'';}exports[_0xf975('0x2f')]=function(_0x47b8df,_0x104b78){var _0x1d47d3={},_0x40fa8c={},_0x21e0bc={'count':0x0,'rows':[]};var _0x11b6ff=_[_0xf975('0x30')](db[_0xf975('0x31')][_0xf975('0x32')],function(_0x21ebed){return{'name':_0x21ebed[_0xf975('0x33')],'type':_0x21ebed[_0xf975('0x34')]['key']};});_0x40fa8c[_0xf975('0x35')]=_[_0xf975('0x30')](_0x11b6ff,'name');_0x40fa8c[_0xf975('0x36')]=_[_0xf975('0x37')](_0x47b8df[_0xf975('0x36')]);_0x40fa8c[_0xf975('0x38')]=_[_0xf975('0x39')](_0x40fa8c['model'],_0x40fa8c[_0xf975('0x36')]);_0x1d47d3[_0xf975('0x3a')]=_[_0xf975('0x39')](_0x40fa8c[_0xf975('0x35')],qs[_0xf975('0x3b')](_0x47b8df[_0xf975('0x36')]['fields']));_0x1d47d3[_0xf975('0x3a')]=_0x1d47d3[_0xf975('0x3a')]['length']?_0x1d47d3[_0xf975('0x3a')]:_0x40fa8c['model'];if(!_0x47b8df['query']['hasOwnProperty'](_0xf975('0x3c'))){_0x1d47d3['limit']=qs['limit'](_0x47b8df[_0xf975('0x36')][_0xf975('0x1d')]);_0x1d47d3[_0xf975('0x1e')]=qs[_0xf975('0x1e')](_0x47b8df[_0xf975('0x36')][_0xf975('0x1e')]);}_0x1d47d3[_0xf975('0x3d')]=qs[_0xf975('0x3e')](_0x47b8df[_0xf975('0x36')]['sort']);_0x1d47d3['where']=qs[_0xf975('0x38')](_[_0xf975('0x3f')](_0x47b8df['query'],_0x40fa8c[_0xf975('0x38')]),_0x11b6ff);if(_0x47b8df[_0xf975('0x36')][_0xf975('0x40')]){_0x1d47d3['where']=_['merge'](_0x1d47d3[_0xf975('0x41')],{'$or':_['map'](_0x11b6ff,function(_0x50e78c){if(_0x50e78c[_0xf975('0x34')]!==_0xf975('0x42')){var _0x2a11db={};_0x2a11db[_0x50e78c[_0xf975('0x28')]]={'$like':'%'+_0x47b8df[_0xf975('0x36')][_0xf975('0x40')]+'%'};return _0x2a11db;}})});}_0x1d47d3=_[_0xf975('0x29')]({},_0x1d47d3,_0x47b8df[_0xf975('0x43')]);var _0x5bf98f={'where':_0x1d47d3['where']};return db['AnalyticCustomReport'][_0xf975('0x1f')](_0x5bf98f)[_0xf975('0x25')](function(_0x186e82){_0x21e0bc[_0xf975('0x1f')]=_0x186e82;if(_0x47b8df[_0xf975('0x36')][_0xf975('0x44')]){_0x1d47d3['include']=[{'all':!![]}];}return db[_0xf975('0x31')][_0xf975('0x45')](_0x1d47d3);})[_0xf975('0x25')](function(_0x566481){_0x21e0bc[_0xf975('0x46')]=_0x566481;return _0x21e0bc;})[_0xf975('0x25')](respondWithFilteredResult(_0x104b78,_0x1d47d3))['catch'](handleError(_0x104b78,null));};exports['show']=function(_0x40be6a,_0x41859d){var _0x25daf6={'raw':![],'where':{'id':_0x40be6a[_0xf975('0x47')]['id']}},_0x420fed={};_0x420fed[_0xf975('0x35')]=_[_0xf975('0x37')](db['AnalyticCustomReport']['rawAttributes']);_0x420fed[_0xf975('0x36')]=_[_0xf975('0x37')](_0x40be6a[_0xf975('0x36')]);_0x420fed[_0xf975('0x38')]=_['intersection'](_0x420fed['model'],_0x420fed[_0xf975('0x36')]);_0x25daf6[_0xf975('0x3a')]=_[_0xf975('0x39')](_0x420fed[_0xf975('0x35')],qs[_0xf975('0x3b')](_0x40be6a[_0xf975('0x36')][_0xf975('0x3b')]));_0x25daf6[_0xf975('0x3a')]=_0x25daf6[_0xf975('0x3a')]['length']?_0x25daf6['attributes']:_0x420fed[_0xf975('0x35')];if(_0x40be6a[_0xf975('0x36')][_0xf975('0x44')]){_0x25daf6[_0xf975('0x48')]=[{'all':!![]}];}_0x25daf6=_[_0xf975('0x29')]({},_0x25daf6,_0x40be6a[_0xf975('0x43')]);return db[_0xf975('0x31')][_0xf975('0x49')](_0x25daf6)['then'](handleEntityNotFound(_0x41859d,null))['then'](respondWithResult(_0x41859d,null))[_0xf975('0x4a')](handleError(_0x41859d,null));};exports['create']=function(_0xc3af63,_0x3a7b85){return db['AnalyticCustomReport'][_0xf975('0x4b')](_0xc3af63[_0xf975('0x2a')],{})[_0xf975('0x25')](function(_0x89c20d){var _0x34bbe4=_0xc3af63[_0xf975('0x4c')]['get']({'plain':!![]});if(!_0x34bbe4)throw new Error(_0xf975('0x4d'));if(_0x34bbe4[_0xf975('0x4e')]===_0xf975('0x4c')){var _0x18b44a=_0x89c20d[_0xf975('0x26')]({'plain':!![]});var _0x539c7d=_0xf975('0x4f');return db['UserProfileSection'][_0xf975('0x49')]({'where':{'name':_0x539c7d,'userProfileId':_0x34bbe4[_0xf975('0x50')]},'raw':!![]})['then'](function(_0x1aa5be){if(_0x1aa5be&&_0x1aa5be['autoAssociation']===0x0){return db[_0xf975('0x27')][_0xf975('0x4b')]({'name':_0x18b44a[_0xf975('0x28')],'resourceId':_0x18b44a['id'],'type':_0xf975('0x51'),'sectionId':_0x1aa5be['id']},{})[_0xf975('0x25')](function(){return _0x89c20d;});}else{return _0x89c20d;}})[_0xf975('0x4a')](function(_0xdeb37e){logger[_0xf975('0x52')](_0xf975('0x53'),_0xdeb37e);throw _0xdeb37e;});}return _0x89c20d;})['then'](respondWithResult(_0x3a7b85,0xc9))[_0xf975('0x4a')](handleError(_0x3a7b85,null));};exports[_0xf975('0x23')]=function(_0x4ccbff,_0x3be180){if(_0x4ccbff[_0xf975('0x2a')]['id']){delete _0x4ccbff['body']['id'];}return db['AnalyticCustomReport'][_0xf975('0x49')]({'where':{'id':_0x4ccbff[_0xf975('0x47')]['id']}})[_0xf975('0x25')](handleEntityNotFound(_0x3be180,null))[_0xf975('0x25')](saveUpdates(_0x4ccbff[_0xf975('0x2a')],null))['then'](respondWithResult(_0x3be180,null))['catch'](handleError(_0x3be180,null));};exports[_0xf975('0x24')]=function(_0x3ee2a6,_0x8de9c3){return db[_0xf975('0x31')]['find']({'where':{'id':_0x3ee2a6[_0xf975('0x47')]['id']}})[_0xf975('0x25')](handleEntityNotFound(_0x8de9c3,null))[_0xf975('0x25')](removeEntity(_0x8de9c3,null))[_0xf975('0x4a')](handleError(_0x8de9c3,null));};exports[_0xf975('0x54')]=function(_0x117684,_0x1ed59c){var _0x3b95b8=0xa;var _0x11ae85=['join',_0xf975('0x55'),_0xf975('0x56'),_0xf975('0x57')];var _0x5b1795={'SUM':_0xf975('0x58'),'COUNT':_0xf975('0x59'),'COUNT DISTINCT':_0xf975('0x5a'),'MAX':_0xf975('0x5b'),'MIN':_0xf975('0x5c'),'AVG':_0xf975('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf975('0x5e'),'GROUP_CONCAT DESC':_0xf975('0x5f')};var _0x30f7f3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf975('0x60'),'HOUR':_0xf975('0x61'),'ROUND':_0xf975('0x62'),'UNIX_TIMESTAMP':_0xf975('0x63')};var _0x2f1b59=function(_0x4f0692){return!_['includes']([_0xf975('0x64'),_0xf975('0x65'),_0xf975('0x66'),_0xf975('0x67')],_0x4f0692);};var _0x473cb4=function(_0x1e3606){if(!_0x1e3606||!_0x1e3606[_0xf975('0x68')][_0xf975('0x69')]){return'';}for(var _0x5561d2='(',_0x49fa23=0x0;_0x49fa23<_0x1e3606[_0xf975('0x68')]['length'];_0x49fa23+=0x1){_0x49fa23>0x0&&(_0x5561d2+='\x20'+_0x1e3606['operator']+'\x20');_0x5561d2+=_0x1e3606[_0xf975('0x68')][_0x49fa23][_0xf975('0x6a')]?_0x473cb4(_0x1e3606[_0xf975('0x68')][_0x49fa23]['group']):_0x1e3606['rules'][_0x49fa23][_0xf975('0x6b')]+'\x20'+_0x1e3606['rules'][_0x49fa23][_0xf975('0x6c')]+(_0x2f1b59(_0x1e3606[_0xf975('0x68')][_0x49fa23][_0xf975('0x6c')])?'\x20'+_0x1e3606[_0xf975('0x68')][_0x49fa23]['value']:'');}return _0x5561d2+')';};var _0x12b2be={'where':{'id':_0x117684['params']['id']}},_0x37c3f9,_0x153f4a,_0x259ac4,_0x1a8bf1,_0x53e059;_0x12b2be=_[_0xf975('0x29')]({},_0x12b2be,_0x117684[_0xf975('0x43')]);return db[_0xf975('0x31')][_0xf975('0x49')](_0x12b2be)[_0xf975('0x25')](function(_0x9aa782){if(_0x9aa782){_0x37c3f9=_0x9aa782;return _0x9aa782[_0xf975('0x6d')]();}return null;})[_0xf975('0x25')](function(_0x53394c){if(_0x53394c){if(!_0x53394c[_0xf975('0x69')]){throw new db[(_0xf975('0x6e'))][(_0xf975('0x6f'))](_0xf975('0x70'),0x193);}_0x153f4a=_0x53394c;return db['AnalyticMetric'][_0xf975('0x45')]({'raw':!![]});}return null;})[_0xf975('0x25')](function(_0x104772){if(_0x104772){_0x259ac4=_[_0xf975('0x71')](_0x104772,'id');var _0x56cac9;var _0x15a316=squel[_0xf975('0x72')]();_0x15a316[_0xf975('0x73')](_0x37c3f9['table']);for(var _0x15e508=0x0;_0x15e508<_0x153f4a['length'];_0x15e508+=0x1){_0x56cac9=_0x153f4a[_0x15e508]['MetricId']?_0x259ac4[_0x153f4a[_0x15e508][_0xf975('0x74')]]['metric']:_0x153f4a[_0x15e508][_0xf975('0x6b')];_0x56cac9=_0x153f4a[_0x15e508][_0xf975('0x75')]?_[_0xf975('0x76')](_0x5b1795[_0x153f4a[_0x15e508]['function']],'%s',_0x56cac9):_0x56cac9;_0x56cac9=_0x153f4a[_0x15e508][_0xf975('0x77')]?_[_0xf975('0x76')](_0x30f7f3[_0x153f4a[_0x15e508]['format']],'%s',_0x56cac9):_0x56cac9;if(_0x153f4a[_0x15e508]['groupBy']){_0x15a316[_0xf975('0x6a')](_0x56cac9);}_0x153f4a[_0x15e508][_0xf975('0x78')]&&_0x15a316['order'](_0x56cac9,_0x153f4a[_0x15e508]['orderBy']==='DESC'?![]:!![]);_0x15a316['field'](_0x56cac9,_0x153f4a[_0x15e508][_0xf975('0x79')]||_0x56cac9);}if(_0x37c3f9[_0xf975('0x7a')]){_0x37c3f9[_0xf975('0x7a')]=JSON['parse'](_0x37c3f9[_0xf975('0x7a')]);for(var _0x5e23e0=0x0;_0x5e23e0<_0x37c3f9[_0xf975('0x7a')][_0xf975('0x69')];_0x5e23e0+=0x1){if(_0x37c3f9[_0xf975('0x7a')][_0x5e23e0][_0xf975('0x34')]&&_[_0xf975('0x7b')](_0x11ae85,_0x37c3f9[_0xf975('0x7a')][_0x5e23e0][_0xf975('0x34')])&&_0x37c3f9['joins'][_0x5e23e0][_0xf975('0x7c')]&&_0x37c3f9[_0xf975('0x7a')][_0x5e23e0][_0xf975('0x7d')]&&_0x37c3f9[_0xf975('0x7a')][_0x5e23e0][_0xf975('0x7e')]){_0x15a316[_0x37c3f9[_0xf975('0x7a')][_0x5e23e0][_0xf975('0x34')]](_0x37c3f9[_0xf975('0x7a')][_0x5e23e0]['foreignTable'],null,util[_0xf975('0x77')](_0xf975('0x7f'),_0x37c3f9[_0xf975('0x80')],_0x37c3f9['joins'][_0x5e23e0]['parentKey'],_0x37c3f9['joins'][_0x5e23e0][_0xf975('0x7d')],_0x37c3f9[_0xf975('0x7a')][_0x5e23e0]['foreignKey']));}}}if(_0x37c3f9[_0xf975('0x81')]){_0x37c3f9[_0xf975('0x81')]=JSON[_0xf975('0x82')](_0x37c3f9['conditions']);_0x15a316[_0xf975('0x41')](_0x473cb4(_0x37c3f9[_0xf975('0x81')][_0xf975('0x6a')]));}_0x53e059=_0x15a316[_0xf975('0x83')]();_0x15a316[_0xf975('0x1d')](_0x3b95b8);_0x15a316[_0xf975('0x1e')](0x0);logger[_0xf975('0x84')]('Limited\x20Query:',_0x15a316[_0xf975('0x85')]());return dbH['sequelize'][_0xf975('0x36')](_0x15a316[_0xf975('0x85')](),{'type':dbH[_0xf975('0x86')]['QueryTypes']['SELECT']});}})[_0xf975('0x25')](respondWithResult(_0x1ed59c,null))['catch'](handleError(_0x1ed59c,null));};function runReport(_0x338e71,_0x45a498,_0xbbd624){var _0x2448e4=_0x45a498[_0xf975('0x28')];var _0x3c07b9=0xa;var _0x5b9574=[_0xf975('0x87'),_0xf975('0x55'),_0xf975('0x56'),_0xf975('0x57')];var _0x353b97={'SUM':_0xf975('0x58'),'COUNT':_0xf975('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf975('0x5b'),'MIN':_0xf975('0x5c'),'AVG':_0xf975('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf975('0x5e'),'GROUP_CONCAT DESC':_0xf975('0x5f')};var _0x371615={'SEC_TO_TIME':_0xf975('0x88'),'DATE':_0xf975('0x60'),'HOUR':_0xf975('0x61'),'ROUND':_0xf975('0x62'),'UNIX_TIMESTAMP':_0xf975('0x63')};var _0x32040a=function(_0x438a60){return!_['includes']([_0xf975('0x64'),'IS\x20NOT\x20NULL',_0xf975('0x66'),_0xf975('0x67')],_0x438a60);};var _0x3a5b84=function(_0xdaf66a){if(!_0xdaf66a||!_0xdaf66a[_0xf975('0x68')]['length']){return'';}for(var _0x4b020b='(',_0x265e0c=0x0;_0x265e0c<_0xdaf66a[_0xf975('0x68')][_0xf975('0x69')];_0x265e0c+=0x1){_0x265e0c>0x0&&(_0x4b020b+='\x20'+_0xdaf66a['operator']+'\x20');_0x4b020b+=_0xdaf66a[_0xf975('0x68')][_0x265e0c]['group']?_0x3a5b84(_0xdaf66a[_0xf975('0x68')][_0x265e0c]['group']):_0xdaf66a[_0xf975('0x68')][_0x265e0c][_0xf975('0x6b')]+'\x20'+_0xdaf66a[_0xf975('0x68')][_0x265e0c][_0xf975('0x6c')]+(_0x32040a(_0xdaf66a['rules'][_0x265e0c][_0xf975('0x6c')])?'\x20'+_0xdaf66a['rules'][_0x265e0c][_0xf975('0x89')]:'');}return _0x4b020b+')';};var _0x283316={'where':{'id':_0x338e71['id']}},_0x255876,_0x6e7586,_0x47670f,_0x588162,_0x12d0f7;_0x283316=_[_0xf975('0x29')]({},_0x283316,_0xbbd624);return db[_0xf975('0x31')][_0xf975('0x49')](_0x283316)[_0xf975('0x25')](function(_0x1d2c44){if(_0x1d2c44){_0x255876=_0x1d2c44;return _0x1d2c44[_0xf975('0x6d')]();}return null;})['then'](function(_0x415c1a){if(_0x415c1a){if(!_0x415c1a[_0xf975('0x69')]){throw new db[(_0xf975('0x6e'))][(_0xf975('0x6f'))](_0xf975('0x70'),0x193);}_0x6e7586=_0x415c1a;return db['AnalyticMetric'][_0xf975('0x45')]({'raw':!![]});}return null;})[_0xf975('0x25')](function(_0x90617f){if(_0x90617f){_0x47670f=_[_0xf975('0x71')](_0x90617f,'id');var _0x255ffd;var _0x4c3eb0=squel[_0xf975('0x72')]();_0x4c3eb0[_0xf975('0x73')](_0x255876[_0xf975('0x80')]);for(var _0x22795c=0x0;_0x22795c<_0x6e7586[_0xf975('0x69')];_0x22795c+=0x1){_0x255ffd=_0x6e7586[_0x22795c][_0xf975('0x74')]?_0x47670f[_0x6e7586[_0x22795c][_0xf975('0x74')]]['metric']:_0x6e7586[_0x22795c][_0xf975('0x6b')];_0x255ffd=_0x6e7586[_0x22795c][_0xf975('0x75')]?_[_0xf975('0x76')](_0x353b97[_0x6e7586[_0x22795c][_0xf975('0x75')]],'%s',_0x255ffd):_0x255ffd;_0x255ffd=_0x6e7586[_0x22795c][_0xf975('0x77')]?_[_0xf975('0x76')](_0x371615[_0x6e7586[_0x22795c][_0xf975('0x77')]],'%s',_0x255ffd):_0x255ffd;if(_0x6e7586[_0x22795c][_0xf975('0x8a')]){_0x4c3eb0[_0xf975('0x6a')](_0x255ffd);}_0x6e7586[_0x22795c][_0xf975('0x78')]&&_0x4c3eb0[_0xf975('0x3d')](_0x255ffd,_0x6e7586[_0x22795c][_0xf975('0x78')]===_0xf975('0x8b')?![]:!![]);_0x4c3eb0[_0xf975('0x6b')](_0x255ffd,_0x6e7586[_0x22795c]['alias']||_0x255ffd);}if(_0x255876[_0xf975('0x7a')]){_0x255876[_0xf975('0x7a')]=JSON[_0xf975('0x82')](_0x255876[_0xf975('0x7a')]);for(var _0x2616b9=0x0;_0x2616b9<_0x255876[_0xf975('0x7a')][_0xf975('0x69')];_0x2616b9+=0x1){if(_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x34')]&&_[_0xf975('0x7b')](_0x5b9574,_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x34')])&&_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x7c')]&&_0x255876['joins'][_0x2616b9][_0xf975('0x7d')]&&_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x7e')]){_0x4c3eb0[_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x34')]](_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x7d')],null,util[_0xf975('0x77')](_0xf975('0x7f'),_0x255876[_0xf975('0x80')],_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x7c')],_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x7d')],_0x255876[_0xf975('0x7a')][_0x2616b9][_0xf975('0x7e')]));}}}if(_0x255876[_0xf975('0x81')]){_0x255876[_0xf975('0x81')]=JSON[_0xf975('0x82')](_0x255876['conditions']);_0x4c3eb0[_0xf975('0x41')](_0x3a5b84(_0x255876[_0xf975('0x81')][_0xf975('0x6a')]));}_0x12d0f7=_0x4c3eb0[_0xf975('0x83')]();_0x4c3eb0[_0xf975('0x1d')](_0x3c07b9);_0x4c3eb0[_0xf975('0x1e')](0x0);return;}})['then'](function(){if(_0x45a498[_0xf975('0x8c')]===_0xf975('0x8d')){return null;}var _0x37d12d=_[_0xf975('0x29')](_0x45a498,{'name':_0x45a498['fullPath']||_0x45a498[_0xf975('0x28')]||_0x255876[_0xf975('0x28')],'basename':_0x2448e4,'savename':util[_0xf975('0x77')](_0xf975('0x8e'),_0x45a498['name']||_0x255876[_0xf975('0x28')],require('randomstring')[_0xf975('0x8f')](0x4),_0x45a498[_0xf975('0x8c')]||_0xf975('0x90')),'reportId':_0x255876['id'],'reportType':_0xf975('0x91')});return db[_0xf975('0x92')][_0xf975('0x4b')](_0x37d12d,{'raw':!![]});})[_0xf975('0x25')](function(_0x5487fb){if(_0x255876[_0xf975('0x80')]===_0xf975('0x93')){_0x12d0f7['where'](_0x255876[_0xf975('0x80')]+_0xf975('0x94'),_0x45a498[_0xf975('0x95')],_0x45a498[_0xf975('0x96')]);}else{_0x12d0f7[_0xf975('0x41')](_0x255876['table']+_0xf975('0x97'),_0x45a498[_0xf975('0x95')],_0x45a498[_0xf975('0x96')]);}if(_0x5487fb){logger[_0xf975('0x98')]('Run\x20Query:',_0x12d0f7[_0xf975('0x85')]());require(_0xf975('0x99'))[_0xf975('0x9a')](path[_0xf975('0x87')](__dirname,_0xf975('0x9b'),_0x5487fb[_0xf975('0x8c')]),[_0x5487fb['id'],_0x12d0f7['toString'](),path[_0xf975('0x87')](__dirname,_0xf975('0x9c'),_0x5487fb[_0xf975('0x9d')]),_0x2448e4]);return _0x5487fb;}else{var _0x6e9c71=squel[_0xf975('0x72')]();_0x6e9c71[_0xf975('0x73')]('('+_0x12d0f7[_0xf975('0x85')]()+')',_0xf975('0x9e'));_0x6e9c71[_0xf975('0x6b')](_0xf975('0x9f'),_0xf975('0x1f'));_0x12d0f7[_0xf975('0x1d')](_0x45a498[_0xf975('0x1d')]||_0x3c07b9);_0x12d0f7[_0xf975('0x1e')](_0x45a498[_0xf975('0x1e')]||0x0);return dbH['sequelize'][_0xf975('0x36')](_0x6e9c71['toString'](),{'type':dbH[_0xf975('0x86')][_0xf975('0xa0')]['SELECT']})[_0xf975('0x25')](function(_0x1c889b){if(!_0x1c889b['length']){_0x588162=0x0;}else{_0x588162=_0x1c889b[0x0][_0xf975('0x1f')]||0x0;}return dbH[_0xf975('0x86')][_0xf975('0x36')](_0x12d0f7['toString'](),{'type':dbH[_0xf975('0x86')]['QueryTypes'][_0xf975('0xa1')]});})['then'](function(_0x4487f6){return{'rows':_0x4487f6||[],'count':_0x588162};});}});}exports[_0xf975('0xa2')]=function(_0x4b76f6,_0x29d6dc){return runReport(_0x4b76f6[_0xf975('0x47')],_0x4b76f6[_0xf975('0x36')],_0x4b76f6[_0xf975('0x43')])[_0xf975('0x25')](respondWithResult(_0x29d6dc,null))[_0xf975('0x4a')](handleError(_0x29d6dc,null));};exports[_0xf975('0xa3')]=runReport;exports[_0xf975('0x36')]=function(_0x4c6c97,_0x1d3146){var _0x368238=0xa;var _0x172a81=[_0xf975('0x87'),_0xf975('0x55'),_0xf975('0x56'),_0xf975('0x57')];var _0x1bb03a={'SUM':_0xf975('0x58'),'COUNT':_0xf975('0x59'),'COUNT DISTINCT':_0xf975('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xf975('0x5d'),'GROUP_CONCAT':_0xf975('0xa4'),'GROUP_CONCAT ASC':_0xf975('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1840b2={'SEC_TO_TIME':_0xf975('0x88'),'DATE':_0xf975('0x60'),'HOUR':_0xf975('0x61'),'ROUND':_0xf975('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x13cd13=function(_0x2bfe26){return!_[_0xf975('0x7b')]([_0xf975('0x64'),_0xf975('0x65'),_0xf975('0x66'),'IS\x20NOT\x20EMPTY'],_0x2bfe26);};var _0x31a7ab=function(_0x488294){if(!_0x488294||!_0x488294[_0xf975('0x68')]['length']){return'';}for(var _0x2fb4fb='(',_0x69fbfc=0x0;_0x69fbfc<_0x488294[_0xf975('0x68')][_0xf975('0x69')];_0x69fbfc+=0x1){_0x69fbfc>0x0&&(_0x2fb4fb+='\x20'+_0x488294['operator']+'\x20');_0x2fb4fb+=_0x488294['rules'][_0x69fbfc][_0xf975('0x6a')]?_0x31a7ab(_0x488294['rules'][_0x69fbfc]['group']):_0x488294[_0xf975('0x68')][_0x69fbfc][_0xf975('0x6b')]+'\x20'+_0x488294['rules'][_0x69fbfc][_0xf975('0x6c')]+(_0x13cd13(_0x488294['rules'][_0x69fbfc][_0xf975('0x6c')])?'\x20'+_0x488294[_0xf975('0x68')][_0x69fbfc][_0xf975('0x89')]:'');}return _0x2fb4fb+')';};var _0x31d991={'where':{'id':_0x4c6c97['params']['id']}},_0x3e34ca,_0x468a57,_0x3fe06c,_0x1516e8,_0x124bbf;_0x31d991=_[_0xf975('0x29')]({},_0x31d991,_0x4c6c97[_0xf975('0x43')]);return db['AnalyticCustomReport'][_0xf975('0x49')](_0x31d991)[_0xf975('0x25')](function(_0x590c8c){if(_0x590c8c){_0x3e34ca=_0x590c8c;return _0x590c8c[_0xf975('0x6d')]();}return null;})[_0xf975('0x25')](function(_0x3ad79b){if(_0x3ad79b){if(!_0x3ad79b[_0xf975('0x69')]){throw new db[(_0xf975('0x6e'))][(_0xf975('0x6f'))](_0xf975('0x70'),0x193);}_0x468a57=_0x3ad79b;return db['AnalyticMetric'][_0xf975('0x45')]({'raw':!![]});}return null;})[_0xf975('0x25')](function(_0x10e03f){if(_0x10e03f){_0x3fe06c=_['keyBy'](_0x10e03f,'id');var _0x1e4b7d;var _0x3e780d=squel['select']();_0x3e780d[_0xf975('0x73')](_0x3e34ca[_0xf975('0x80')]);for(var _0x13fe8f=0x0;_0x13fe8f<_0x468a57[_0xf975('0x69')];_0x13fe8f+=0x1){_0x1e4b7d=_0x468a57[_0x13fe8f][_0xf975('0x74')]?_0x3fe06c[_0x468a57[_0x13fe8f][_0xf975('0x74')]][_0xf975('0xa5')]:_0x468a57[_0x13fe8f]['field'];_0x1e4b7d=_0x468a57[_0x13fe8f]['function']?_['replace'](_0x1bb03a[_0x468a57[_0x13fe8f][_0xf975('0x75')]],'%s',_0x1e4b7d):_0x1e4b7d;_0x1e4b7d=_0x468a57[_0x13fe8f]['format']?_[_0xf975('0x76')](_0x1840b2[_0x468a57[_0x13fe8f][_0xf975('0x77')]],'%s',_0x1e4b7d):_0x1e4b7d;if(_0x468a57[_0x13fe8f][_0xf975('0x8a')]){_0x3e780d[_0xf975('0x6a')](_0x1e4b7d);}_0x468a57[_0x13fe8f][_0xf975('0x78')]&&_0x3e780d['order'](_0x1e4b7d,_0x468a57[_0x13fe8f]['orderBy']==='DESC'?![]:!![]);_0x3e780d[_0xf975('0x6b')](_0x1e4b7d,_0x468a57[_0x13fe8f][_0xf975('0x79')]||_0x1e4b7d);}if(_0x3e34ca['joins']){_0x3e34ca[_0xf975('0x7a')]=JSON[_0xf975('0x82')](_0x3e34ca['joins']);for(var _0x529990=0x0;_0x529990<_0x3e34ca['joins'][_0xf975('0x69')];_0x529990+=0x1){if(_0x3e34ca['joins'][_0x529990][_0xf975('0x34')]&&_[_0xf975('0x7b')](_0x172a81,_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x34')])&&_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x7c')]&&_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x7d')]&&_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x7e')]){_0x3e780d[_0x3e34ca['joins'][_0x529990]['type']](_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x7d')],null,util[_0xf975('0x77')]('%s.%s\x20=\x20%s.%s',_0x3e34ca[_0xf975('0x80')],_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x7c')],_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x7d')],_0x3e34ca[_0xf975('0x7a')][_0x529990][_0xf975('0x7e')]));}}}if(_0x3e34ca[_0xf975('0x81')]){_0x3e34ca['conditions']=JSON[_0xf975('0x82')](_0x3e34ca[_0xf975('0x81')]);_0x3e780d['where'](_0x31a7ab(_0x3e34ca[_0xf975('0x81')][_0xf975('0x6a')]));}_0x124bbf=_0x3e780d[_0xf975('0x83')]();_0x3e780d[_0xf975('0x1d')](_0x368238);_0x3e780d['offset'](0x0);logger[_0xf975('0x84')](_0xf975('0xa6'),_0x3e780d[_0xf975('0x85')]());return dbH['sequelize'][_0xf975('0x36')](_0x3e780d[_0xf975('0x85')](),{'type':dbH['sequelize'][_0xf975('0xa0')][_0xf975('0xa1')]});}})[_0xf975('0x25')](function(){return{'sql':_0x124bbf[_0xf975('0x85')]()};})[_0xf975('0x25')](respondWithResult(_0x1d3146,null))['catch'](handleError(_0x1d3146,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ffb0aec..7897540 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.model.js +++ b/server/api/analyticCustomReport/analyticCustomReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6bd=['AnalyticCustomReport','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6bd,0x64));var _0xdd6b=function(_0x999d55,_0xcd1f58){_0x999d55=_0x999d55-0x0;var _0x150655=_0xd6bd[_0x999d55];return _0x150655;};'use strict';var _=require(_0xdd6b('0x0'));var util=require('util');var logger=require(_0xdd6b('0x1'))(_0xdd6b('0x2'));var moment=require(_0xdd6b('0x3'));var BPromise=require('bluebird');var rp=require(_0xdd6b('0x4'));var fs=require('fs');var path=require(_0xdd6b('0x5'));var rimraf=require(_0xdd6b('0x6'));var config=require(_0xdd6b('0x7'));var attributes=require(_0xdd6b('0x8'));module[_0xdd6b('0x9')]=function(_0x149f1b,_0x2c3752){return _0x149f1b['define'](_0xdd6b('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0f4=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','util','moment','bluebird','path'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xf0f4,0x182));var _0x4f0f=function(_0x467f41,_0x2ed016){_0x467f41=_0x467f41-0x0;var _0xfdc448=_0xf0f4[_0x467f41];return _0xfdc448;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4f0f('0x1'));var BPromise=require(_0x4f0f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f0f('0x3'));var rimraf=require(_0x4f0f('0x4'));var config=require(_0x4f0f('0x5'));var attributes=require(_0x4f0f('0x6'));module[_0x4f0f('0x7')]=function(_0x15e6cd,_0x3285cd){return _0x15e6cd['define'](_0x4f0f('0x8'),attributes,{'tableName':_0x4f0f('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 0823a6a..24d8b92 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.rpc.js +++ b/server/api/analyticCustomReport/analyticCustomReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73ad=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x127364,_0x591295){var _0x12c89a=function(_0x38d257){while(--_0x38d257){_0x127364['push'](_0x127364['shift']());}};_0x12c89a(++_0x591295);}(_0x73ad,0x1e0));var _0xd73a=function(_0x72d50b,_0x4db2d0){_0x72d50b=_0x72d50b-0x0;var _0x1a3ef1=_0x73ad[_0x72d50b];return _0x1a3ef1;};'use strict';var _=require(_0xd73a('0x0'));var util=require(_0xd73a('0x1'));var moment=require(_0xd73a('0x2'));var BPromise=require(_0xd73a('0x3'));var rs=require(_0xd73a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd73a('0x5'))['db'];var utils=require(_0xd73a('0x6'));var logger=require(_0xd73a('0x7'))('rpc');var config=require(_0xd73a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd73a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ebb57,_0x1fcb07,_0x3c1536){return new BPromise(function(_0x158298,_0x358cd3){return client['request'](_0x3ebb57,_0x3c1536)['then'](function(_0x4ed359){logger[_0xd73a('0xa')](_0xd73a('0xb'),_0x1fcb07,_0xd73a('0xc'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1fcb07,'request\x20sent',JSON['stringify'](_0x4ed359));if(_0x4ed359[_0xd73a('0xd')]){if(_0x4ed359[_0xd73a('0xd')][_0xd73a('0xe')]===0x1f4){logger['error'](_0xd73a('0xb'),_0x1fcb07,_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);return _0x358cd3(_0x4ed359['error']['message']);}logger[_0xd73a('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1fcb07,_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);return _0x158298(_0x4ed359[_0xd73a('0xd')][_0xd73a('0xf')]);}else{logger['info'](_0xd73a('0xb'),_0x1fcb07,'request\x20sent');_0x158298(_0x4ed359['result']['message']);}})[_0xd73a('0x10')](function(_0x39339f){logger[_0xd73a('0xd')](_0xd73a('0xb'),_0x1fcb07,_0x39339f);_0x358cd3(_0x39339f);});});} \ No newline at end of file +var _0x5574=['info','result','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x2d1823,_0x17491d){var _0x9ae968=function(_0x114f04){while(--_0x114f04){_0x2d1823['push'](_0x2d1823['shift']());}};_0x9ae968(++_0x17491d);}(_0x5574,0x135));var _0x4557=function(_0xa12175,_0x4bd987){_0xa12175=_0xa12175-0x0;var _0x2b61ca=_0x5574[_0xa12175];return _0x2b61ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4557('0x0'));var BPromise=require('bluebird');var rs=require(_0x4557('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4557('0x2'))['db'];var utils=require(_0x4557('0x3'));var logger=require('../../config/logger')(_0x4557('0x4'));var config=require(_0x4557('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4557('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568ad9,_0x1fe2ce,_0x14a743){return new BPromise(function(_0x4515de,_0x3c5ec3){return client[_0x4557('0x7')](_0x568ad9,_0x14a743)[_0x4557('0x8')](function(_0x1b353a){logger['info'](_0x4557('0x9'),_0x1fe2ce,'request\x20sent');logger[_0x4557('0xa')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1fe2ce,_0x4557('0xb'),JSON['stringify'](_0x1b353a));if(_0x1b353a[_0x4557('0xc')]){if(_0x1b353a['error'][_0x4557('0xd')]===0x1f4){logger[_0x4557('0xc')](_0x4557('0x9'),_0x1fe2ce,_0x1b353a[_0x4557('0xc')][_0x4557('0xe')]);return _0x3c5ec3(_0x1b353a[_0x4557('0xc')][_0x4557('0xe')]);}logger[_0x4557('0xc')](_0x4557('0x9'),_0x1fe2ce,_0x1b353a[_0x4557('0xc')][_0x4557('0xe')]);return _0x4515de(_0x1b353a['error']['message']);}else{logger[_0x4557('0xf')](_0x4557('0x9'),_0x1fe2ce,'request\x20sent');_0x4515de(_0x1b353a[_0x4557('0x10')]['message']);}})[_0x4557('0x11')](function(_0xfd409a){logger[_0x4557('0xc')](_0x4557('0x9'),_0x1fe2ce,_0xfd409a);_0x3c5ec3(_0xfd409a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 0cb9b54..c1ef06b 100644 --- a/server/api/analyticCustomReport/index.js +++ b/server/api/analyticCustomReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8654=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8654,0xfa));var _0x4865=function(_0x3623d3,_0x529b09){_0x3623d3=_0x3623d3-0x0;var _0x4c6a04=_0x8654[_0x3623d3];return _0x4c6a04;};'use strict';var multer=require('multer');var util=require(_0x4865('0x0'));var path=require(_0x4865('0x1'));var timeout=require(_0x4865('0x2'));var express=require(_0x4865('0x3'));var router=express[_0x4865('0x4')]();var fs_extra=require(_0x4865('0x5'));var auth=require(_0x4865('0x6'));var interaction=require(_0x4865('0x7'));var config=require(_0x4865('0x8'));var controller=require(_0x4865('0x9'));router['get']('/',auth[_0x4865('0xa')](),controller[_0x4865('0xb')]);router[_0x4865('0xc')](_0x4865('0xd'),auth['isAuthenticated'](),controller[_0x4865('0xe')]);router[_0x4865('0xc')](_0x4865('0xf'),auth[_0x4865('0xa')](),controller[_0x4865('0x10')]);router[_0x4865('0xc')](_0x4865('0x11'),auth[_0x4865('0xa')](),controller['run']);router[_0x4865('0xc')](_0x4865('0x12'),auth[_0x4865('0xa')](),controller[_0x4865('0x13')]);router[_0x4865('0x14')]('/',auth[_0x4865('0xa')](),controller[_0x4865('0x15')]);router[_0x4865('0x16')]('/:id',auth[_0x4865('0xa')](),controller[_0x4865('0x17')]);router[_0x4865('0x18')]('/:id',auth[_0x4865('0xa')](),controller[_0x4865('0x19')]);module[_0x4865('0x1a')]=router; \ No newline at end of file +var _0xcbe7=['/:id/query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/preview','preview'];(function(_0x162fe1,_0x4d44ab){var _0x304c7e=function(_0x4004b9){while(--_0x4004b9){_0x162fe1['push'](_0x162fe1['shift']());}};_0x304c7e(++_0x4d44ab);}(_0xcbe7,0x152));var _0x7cbe=function(_0x16b52a,_0x141ba2){_0x16b52a=_0x16b52a-0x0;var _0x5bc265=_0xcbe7[_0x16b52a];return _0x5bc265;};'use strict';var multer=require('multer');var util=require(_0x7cbe('0x0'));var path=require(_0x7cbe('0x1'));var timeout=require(_0x7cbe('0x2'));var express=require(_0x7cbe('0x3'));var router=express[_0x7cbe('0x4')]();var fs_extra=require(_0x7cbe('0x5'));var auth=require(_0x7cbe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7cbe('0x7'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x9')]);router[_0x7cbe('0xa')](_0x7cbe('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7cbe('0xa')](_0x7cbe('0xc'),auth[_0x7cbe('0x8')](),controller[_0x7cbe('0xd')]);router[_0x7cbe('0xa')]('/:id/run',auth[_0x7cbe('0x8')](),controller['run']);router[_0x7cbe('0xa')](_0x7cbe('0xe'),auth[_0x7cbe('0x8')](),controller['query']);router[_0x7cbe('0xf')]('/',auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x10')]);router[_0x7cbe('0x11')](_0x7cbe('0xb'),auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x12')]);router[_0x7cbe('0x13')]('/:id',auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x14')]);module[_0x7cbe('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index ba5e84a..22a3cea 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8870=['TEXT','sequelize','exports','STRING'];(function(_0x324cce,_0x492e4a){var _0x3b4a7c=function(_0x190cd1){while(--_0x190cd1){_0x324cce['push'](_0x324cce['shift']());}};_0x3b4a7c(++_0x492e4a);}(_0x8870,0x171));var _0x0887=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8870[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x0887('0x0'));module[_0x0887('0x1')]={'name':{'type':Sequelize[_0x0887('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0887('0x2')]},'parent':{'type':Sequelize[_0x0887('0x2')]},'table':{'type':Sequelize[_0x0887('0x2')]},'conditions':{'type':Sequelize[_0x0887('0x3')]},'joins':{'type':Sequelize[_0x0887('0x3')]}}; \ No newline at end of file +var _0x567e=['STRING','TEXT','sequelize','exports'];(function(_0x9af8fb,_0x1efe33){var _0xe903e1=function(_0x290c83){while(--_0x290c83){_0x9af8fb['push'](_0x9af8fb['shift']());}};_0xe903e1(++_0x1efe33);}(_0x567e,0xae));var _0xe567=function(_0x3ea124,_0x5af37d){_0x3ea124=_0x3ea124-0x0;var _0x582eec=_0x567e[_0x3ea124];return _0x582eec;};'use strict';var Sequelize=require(_0xe567('0x0'));module[_0xe567('0x1')]={'name':{'type':Sequelize[_0xe567('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe567('0x2')]},'parent':{'type':Sequelize[_0xe567('0x2')]},'table':{'type':Sequelize[_0xe567('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xe567('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 12dd60d..a338983 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdff2=['UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','from','function','output','web','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','fork','../../files/reports','savename','sequelize','QueryTypes','run','AVG(%s)','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','get','DefaultReports','destroy','sendStatus','error','name','send','render','body','contact','message','agent','interaction','account','index','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','map','options','AnalyticDefaultReport','findAll','rows','catch','show','includeAll','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)'];(function(_0x12eb81,_0x1fa5d1){var _0x1852f4=function(_0xae73a0){while(--_0xae73a0){_0x12eb81['push'](_0x12eb81['shift']());}};_0x1852f4(++_0x1fa5d1);}(_0xdff2,0xe9));var _0x2dff=function(_0x22ea7a,_0x36f82b){_0x22ea7a=_0x22ea7a-0x0;var _0x462110=_0xdff2[_0x22ea7a];return _0x462110;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2dff('0x0'));var jsonpatch=require(_0x2dff('0x1'));var rp=require(_0x2dff('0x2'));var moment=require(_0x2dff('0x3'));var BPromise=require(_0x2dff('0x4'));var Mustache=require(_0x2dff('0x5'));var util=require(_0x2dff('0x6'));var path=require(_0x2dff('0x7'));var sox=require('sox');var csv=require(_0x2dff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dff('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2dff('0xa'));var deskjs=require(_0x2dff('0xb'));var toCsv=require(_0x2dff('0x8'));var querystring=require(_0x2dff('0xc'));var Papa=require(_0x2dff('0xd'));var Redis=require(_0x2dff('0xe'));var authService=require(_0x2dff('0xf'));var qs=require(_0x2dff('0x10'));var as=require(_0x2dff('0x11'));var hardwareService=require(_0x2dff('0x12'));var logger=require(_0x2dff('0x13'))(_0x2dff('0x14'));var utils=require(_0x2dff('0x15'));var config=require(_0x2dff('0x16'));var licenseUtil=require(_0x2dff('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2dff('0x18'))[_0x2dff('0x19')];function respondWithStatusCode(_0x59bd46,_0x5a2358){_0x5a2358=_0x5a2358||0xcc;return function(_0xb20d45){if(_0xb20d45){return _0x59bd46['sendStatus'](_0x5a2358);}return _0x59bd46[_0x2dff('0x1a')](_0x5a2358)[_0x2dff('0x1b')]();};}function respondWithResult(_0x4f6d14,_0x179551){_0x179551=_0x179551||0xc8;return function(_0x236476){if(_0x236476){return _0x4f6d14[_0x2dff('0x1a')](_0x179551)[_0x2dff('0x1c')](_0x236476);}};}function respondWithFilteredResult(_0x2254bf,_0x43363b){return function(_0x484e70){if(_0x484e70){var _0x5479b9=typeof _0x43363b[_0x2dff('0x1d')]==='undefined'&&typeof _0x43363b[_0x2dff('0x1e')]===_0x2dff('0x1f');var _0x284039=_0x484e70['count'];var _0x4b9837=_0x5479b9?0x0:_0x43363b[_0x2dff('0x1d')];var _0x3d62f7=_0x5479b9?_0x484e70[_0x2dff('0x20')]:_0x43363b['offset']+_0x43363b[_0x2dff('0x1e')];var _0x3b90eb;if(_0x3d62f7>=_0x284039){_0x3d62f7=_0x284039;_0x3b90eb=0xc8;}else{_0x3b90eb=0xce;}_0x2254bf[_0x2dff('0x1a')](_0x3b90eb);return _0x2254bf[_0x2dff('0x21')](_0x2dff('0x22'),_0x4b9837+'-'+_0x3d62f7+'/'+_0x284039)[_0x2dff('0x1c')](_0x484e70);}return null;};}function patchUpdates(_0x3599c4){return function(_0x6546b){try{jsonpatch[_0x2dff('0x23')](_0x6546b,_0x3599c4,!![]);}catch(_0x3e352d){return BPromise['reject'](_0x3e352d);}return _0x6546b['save']();};}function saveUpdates(_0x2f73b4,_0x142b21){return function(_0x5f1118){if(_0x5f1118){return _0x5f1118[_0x2dff('0x24')](_0x2f73b4)[_0x2dff('0x25')](function(_0x50fa26){return _0x50fa26;});}return null;};}function removeEntity(_0x2d5588,_0x4d9c60){return function(_0x2ca02c){if(_0x2ca02c){return _0x2ca02c['destroy']()[_0x2dff('0x25')](function(){var _0x19e7fb=_0x2ca02c[_0x2dff('0x26')]({'plain':!![]});var _0x52a507=_0x2dff('0x27');return db['UserProfileResource'][_0x2dff('0x28')]({'where':{'type':_0x52a507,'resourceId':_0x19e7fb['id']}})[_0x2dff('0x25')](function(){return _0x2ca02c;});})[_0x2dff('0x25')](function(){_0x2d5588['status'](0xcc)[_0x2dff('0x1b')]();});}};}function handleEntityNotFound(_0xbb4cde,_0x4c7d0d){return function(_0x459ce3){if(!_0x459ce3){_0xbb4cde[_0x2dff('0x29')](0x194);}return _0x459ce3;};}function handleError(_0x3f0edc,_0x4d8b0c){_0x4d8b0c=_0x4d8b0c||0x1f4;return function(_0x8d3000){logger[_0x2dff('0x2a')](_0x8d3000['stack']);if(_0x8d3000[_0x2dff('0x2b')]){delete _0x8d3000[_0x2dff('0x2b')];}_0x3f0edc['status'](_0x4d8b0c)[_0x2dff('0x2c')](_0x8d3000);};}function getMustacheRender(_0x302c6d,_0x5ec408){return Mustache[_0x2dff('0x2d')](_0x302c6d,_['merge'](_0x5ec408[_0x2dff('0x2e')],{'contact':_0x5ec408[_0x2dff('0x2f')],'message':_0x5ec408[_0x2dff('0x30')],'agent':_0x5ec408[_0x2dff('0x31')],'interaction':_0x5ec408[_0x2dff('0x32')],'account':_0x5ec408[_0x2dff('0x33')]}))||'';}exports[_0x2dff('0x34')]=function(_0x22ac1c,_0x42ec35){var _0x4faabc={},_0x5e84c0={},_0x44805d={'count':0x0,'rows':[]};var _0x2a198c=_['map'](db['AnalyticDefaultReport'][_0x2dff('0x35')],function(_0x409898){return{'name':_0x409898[_0x2dff('0x36')],'type':_0x409898[_0x2dff('0x37')]['key']};});_0x5e84c0[_0x2dff('0x38')]=_['map'](_0x2a198c,_0x2dff('0x2b'));_0x5e84c0['query']=_[_0x2dff('0x39')](_0x22ac1c['query']);_0x5e84c0['filters']=_[_0x2dff('0x3a')](_0x5e84c0[_0x2dff('0x38')],_0x5e84c0[_0x2dff('0x3b')]);_0x4faabc[_0x2dff('0x3c')]=_[_0x2dff('0x3a')](_0x5e84c0[_0x2dff('0x38')],qs[_0x2dff('0x3d')](_0x22ac1c['query']['fields']));_0x4faabc['attributes']=_0x4faabc[_0x2dff('0x3c')][_0x2dff('0x3e')]?_0x4faabc[_0x2dff('0x3c')]:_0x5e84c0[_0x2dff('0x38')];if(!_0x22ac1c['query']['hasOwnProperty'](_0x2dff('0x3f'))){_0x4faabc['limit']=qs[_0x2dff('0x1e')](_0x22ac1c[_0x2dff('0x3b')][_0x2dff('0x1e')]);_0x4faabc[_0x2dff('0x1d')]=qs[_0x2dff('0x1d')](_0x22ac1c['query'][_0x2dff('0x1d')]);}_0x4faabc[_0x2dff('0x40')]=qs['sort'](_0x22ac1c[_0x2dff('0x3b')][_0x2dff('0x41')]);_0x4faabc[_0x2dff('0x42')]=qs[_0x2dff('0x43')](_[_0x2dff('0x44')](_0x22ac1c['query'],_0x5e84c0['filters']),_0x2a198c);if(_0x22ac1c[_0x2dff('0x3b')]['filter']){_0x4faabc[_0x2dff('0x42')]=_[_0x2dff('0x45')](_0x4faabc[_0x2dff('0x42')],{'$or':_[_0x2dff('0x46')](_0x2a198c,function(_0x3f7317){if(_0x3f7317[_0x2dff('0x37')]!=='VIRTUAL'){var _0x409650={};_0x409650[_0x3f7317[_0x2dff('0x2b')]]={'$like':'%'+_0x22ac1c['query']['filter']+'%'};return _0x409650;}})});}_0x4faabc=_['merge']({},_0x4faabc,_0x22ac1c[_0x2dff('0x47')]);var _0x36f87f={'where':_0x4faabc['where']};return db[_0x2dff('0x48')][_0x2dff('0x20')](_0x36f87f)['then'](function(_0x5f5669){_0x44805d[_0x2dff('0x20')]=_0x5f5669;if(_0x22ac1c[_0x2dff('0x3b')]['includeAll']){_0x4faabc['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x2dff('0x49')](_0x4faabc);})[_0x2dff('0x25')](function(_0x553d3b){_0x44805d[_0x2dff('0x4a')]=_0x553d3b;return _0x44805d;})['then'](respondWithFilteredResult(_0x42ec35,_0x4faabc))[_0x2dff('0x4b')](handleError(_0x42ec35,null));};exports[_0x2dff('0x4c')]=function(_0x325145,_0x355823){var _0x28f126={'raw':!![],'where':{'id':_0x325145['params']['id']}},_0x466cec={};_0x466cec[_0x2dff('0x38')]=_[_0x2dff('0x39')](db['AnalyticDefaultReport']['rawAttributes']);_0x466cec[_0x2dff('0x3b')]=_[_0x2dff('0x39')](_0x325145[_0x2dff('0x3b')]);_0x466cec[_0x2dff('0x43')]=_[_0x2dff('0x3a')](_0x466cec[_0x2dff('0x38')],_0x466cec['query']);_0x28f126['attributes']=_[_0x2dff('0x3a')](_0x466cec[_0x2dff('0x38')],qs[_0x2dff('0x3d')](_0x325145['query'][_0x2dff('0x3d')]));_0x28f126['attributes']=_0x28f126[_0x2dff('0x3c')]['length']?_0x28f126[_0x2dff('0x3c')]:_0x466cec['model'];if(_0x325145['query'][_0x2dff('0x4d')]){_0x28f126[_0x2dff('0x4e')]=[{'all':!![]}];}_0x28f126=_[_0x2dff('0x45')]({},_0x28f126,_0x325145['options']);return db[_0x2dff('0x48')][_0x2dff('0x4f')](_0x28f126)['then'](handleEntityNotFound(_0x355823,null))['then'](respondWithResult(_0x355823,null))[_0x2dff('0x4b')](handleError(_0x355823,null));};exports[_0x2dff('0x50')]=function(_0x158e0c,_0x3984f4){return db[_0x2dff('0x48')][_0x2dff('0x50')](_0x158e0c[_0x2dff('0x2e')],{})[_0x2dff('0x25')](function(_0x2d24b5){var _0x3d226e=_0x158e0c[_0x2dff('0x51')][_0x2dff('0x26')]({'plain':!![]});if(!_0x3d226e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d226e[_0x2dff('0x52')]==='user'){var _0x5c27a0=_0x2d24b5[_0x2dff('0x26')]({'plain':!![]});var _0xc14602='Reports';return db[_0x2dff('0x53')][_0x2dff('0x4f')]({'where':{'name':_0xc14602,'userProfileId':_0x3d226e[_0x2dff('0x54')]},'raw':!![]})[_0x2dff('0x25')](function(_0x15159c){if(_0x15159c&&_0x15159c[_0x2dff('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c27a0['name'],'resourceId':_0x5c27a0['id'],'type':'DefaultReports','sectionId':_0x15159c['id']},{})[_0x2dff('0x25')](function(){return _0x2d24b5;});}else{return _0x2d24b5;}})[_0x2dff('0x4b')](function(_0x24df1c){logger['error'](_0x2dff('0x56'),_0x24df1c);throw _0x24df1c;});}return _0x2d24b5;})[_0x2dff('0x25')](respondWithResult(_0x3984f4,0xc9))[_0x2dff('0x4b')](handleError(_0x3984f4,null));};exports[_0x2dff('0x24')]=function(_0x5cff10,_0x5709db){if(_0x5cff10[_0x2dff('0x2e')]['id']){delete _0x5cff10[_0x2dff('0x2e')]['id'];}return db[_0x2dff('0x48')]['find']({'where':{'id':_0x5cff10[_0x2dff('0x57')]['id']}})['then'](handleEntityNotFound(_0x5709db,null))[_0x2dff('0x25')](saveUpdates(_0x5cff10[_0x2dff('0x2e')],null))[_0x2dff('0x25')](respondWithResult(_0x5709db,null))[_0x2dff('0x4b')](handleError(_0x5709db,null));};exports[_0x2dff('0x28')]=function(_0x4dc108,_0x57e2a9){return db[_0x2dff('0x48')][_0x2dff('0x4f')]({'where':{'id':_0x4dc108[_0x2dff('0x57')]['id']}})[_0x2dff('0x25')](handleEntityNotFound(_0x57e2a9,null))[_0x2dff('0x25')](removeEntity(_0x57e2a9,null))[_0x2dff('0x4b')](handleError(_0x57e2a9,null));};exports[_0x2dff('0x58')]=function(_0x69e97,_0x585ab7){var _0x55ec2a=0xa;var _0xe0115e=[_0x2dff('0x59'),_0x2dff('0x5a'),_0x2dff('0x5b'),_0x2dff('0x5c')];var _0x32e8e2={'SUM':'SUM(%s)','COUNT':_0x2dff('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2dff('0x5e'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x2dff('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2dff('0x60')};var _0x1c6e33={'SEC_TO_TIME':_0x2dff('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x2dff('0x62'),'UNIX_TIMESTAMP':_0x2dff('0x63')};var _0x2db1f1=function(_0x490f6c){return!_[_0x2dff('0x64')]([_0x2dff('0x65'),_0x2dff('0x66'),_0x2dff('0x67'),_0x2dff('0x68')],_0x490f6c);};var _0x4dbe23=function(_0x3fc932){if(!_0x3fc932||!_0x3fc932[_0x2dff('0x69')][_0x2dff('0x3e')]){return'';}for(var _0x46624c='(',_0x5b5b73=0x0;_0x5b5b73<_0x3fc932['rules'][_0x2dff('0x3e')];_0x5b5b73+=0x1){_0x5b5b73>0x0&&(_0x46624c+='\x20'+_0x3fc932[_0x2dff('0x6a')]+'\x20');_0x46624c+=_0x3fc932[_0x2dff('0x69')][_0x5b5b73]['group']?_0x4dbe23(_0x3fc932['rules'][_0x5b5b73][_0x2dff('0x6b')]):_0x3fc932[_0x2dff('0x69')][_0x5b5b73][_0x2dff('0x6c')]+'\x20'+_0x3fc932[_0x2dff('0x69')][_0x5b5b73][_0x2dff('0x6d')]+(_0x2db1f1(_0x3fc932['rules'][_0x5b5b73]['condition'])?'\x20'+_0x3fc932[_0x2dff('0x69')][_0x5b5b73][_0x2dff('0x6e')]:'');}return _0x46624c+')';};var _0x14c4c9={'where':{'id':_0x69e97['params']['id']}},_0x105fc0,_0x13ae8c,_0x5ede45,_0x4ec52f,_0x5b29ce;_0x14c4c9=_[_0x2dff('0x45')]({},_0x14c4c9,_0x69e97['options']);return db[_0x2dff('0x48')][_0x2dff('0x4f')](_0x14c4c9)[_0x2dff('0x25')](function(_0x512cd8){if(_0x512cd8){_0x105fc0=_0x512cd8;return _0x512cd8[_0x2dff('0x6f')]();}return null;})['then'](function(_0x3e8111){if(_0x3e8111){if(!_0x3e8111['length']){throw new db['Sequelize'][(_0x2dff('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x13ae8c=_0x3e8111;return db[_0x2dff('0x71')][_0x2dff('0x49')]({'raw':!![]});}return null;})[_0x2dff('0x25')](function(_0x1c0948){if(_0x1c0948){_0x5ede45=_[_0x2dff('0x72')](_0x1c0948,'id');var _0x1f0a49;var _0x38f736=squel[_0x2dff('0x73')]();_0x38f736['from'](_0x105fc0[_0x2dff('0x74')]);for(var _0x246aed=0x0;_0x246aed<_0x13ae8c[_0x2dff('0x3e')];_0x246aed+=0x1){_0x1f0a49=_0x13ae8c[_0x246aed]['MetricId']?_0x5ede45[_0x13ae8c[_0x246aed][_0x2dff('0x75')]][_0x2dff('0x76')]:_0x13ae8c[_0x246aed][_0x2dff('0x6c')];_0x1f0a49=_0x13ae8c[_0x246aed]['function']?_[_0x2dff('0x77')](_0x32e8e2[_0x13ae8c[_0x246aed]['function']],'%s',_0x1f0a49):_0x1f0a49;_0x1f0a49=_0x13ae8c[_0x246aed][_0x2dff('0x78')]?_['replace'](_0x1c6e33[_0x13ae8c[_0x246aed][_0x2dff('0x78')]],'%s',_0x1f0a49):_0x1f0a49;if(_0x13ae8c[_0x246aed][_0x2dff('0x79')]){_0x38f736[_0x2dff('0x6b')](_0x1f0a49);}_0x13ae8c[_0x246aed]['orderBy']&&_0x38f736[_0x2dff('0x40')](_0x1f0a49,_0x13ae8c[_0x246aed][_0x2dff('0x7a')]===_0x2dff('0x7b')?![]:!![]);_0x38f736[_0x2dff('0x6c')](_0x1f0a49,_0x13ae8c[_0x246aed][_0x2dff('0x7c')]||_0x1f0a49);}if(_0x105fc0[_0x2dff('0x7d')]){_0x105fc0[_0x2dff('0x7d')]=JSON[_0x2dff('0x7e')](_0x105fc0[_0x2dff('0x7d')]);for(var _0x100726=0x0;_0x100726<_0x105fc0[_0x2dff('0x7d')][_0x2dff('0x3e')];_0x100726+=0x1){if(_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x37')]&&_['includes'](_0xe0115e,_0x105fc0[_0x2dff('0x7d')][_0x100726]['type'])&&_0x105fc0['joins'][_0x100726][_0x2dff('0x7f')]&&_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x80')]&&_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x81')]){_0x38f736[_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x37')]](_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x80')],null,util[_0x2dff('0x78')](_0x2dff('0x82'),_0x105fc0[_0x2dff('0x74')],_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x7f')],_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x80')],_0x105fc0[_0x2dff('0x7d')][_0x100726][_0x2dff('0x81')]));}}}if(_0x105fc0[_0x2dff('0x83')]){_0x105fc0[_0x2dff('0x83')]=JSON[_0x2dff('0x7e')](_0x105fc0[_0x2dff('0x83')]);_0x38f736[_0x2dff('0x42')](_0x4dbe23(_0x105fc0[_0x2dff('0x83')][_0x2dff('0x6b')]));}_0x5b29ce=_0x38f736[_0x2dff('0x84')]();_0x38f736['limit'](_0x55ec2a);_0x38f736[_0x2dff('0x1d')](0x0);logger[_0x2dff('0x85')](_0x2dff('0x86'),_0x38f736[_0x2dff('0x87')]());return dbH['sequelize'][_0x2dff('0x3b')](_0x38f736['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x2dff('0x88')]});}})['then'](respondWithResult(_0x585ab7,null))[_0x2dff('0x4b')](handleError(_0x585ab7,null));};function runReport(_0x2980a0,_0x327141,_0x51d26f){var _0x92c079=_0x327141[_0x2dff('0x2b')];var _0x402208=0xa;var _0x3ff63b=[_0x2dff('0x59'),_0x2dff('0x5a'),_0x2dff('0x5b'),_0x2dff('0x5c')];var _0x4adf5d={'SUM':_0x2dff('0x89'),'COUNT':_0x2dff('0x5d'),'COUNT DISTINCT':_0x2dff('0x8a'),'MAX':_0x2dff('0x5e'),'MIN':_0x2dff('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2dff('0x5f'),'GROUP_CONCAT ASC':_0x2dff('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58e5de={'SEC_TO_TIME':_0x2dff('0x61'),'DATE':_0x2dff('0x8d'),'HOUR':_0x2dff('0x8e'),'ROUND':_0x2dff('0x62'),'UNIX_TIMESTAMP':_0x2dff('0x63')};var _0x50b2c1=function(_0x3c8b9a){return!_[_0x2dff('0x64')]([_0x2dff('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2dff('0x68')],_0x3c8b9a);};var _0x218ef2=function(_0x34a01c){if(!_0x34a01c||!_0x34a01c['rules'][_0x2dff('0x3e')]){return'';}for(var _0x383d19='(',_0x24de26=0x0;_0x24de26<_0x34a01c[_0x2dff('0x69')][_0x2dff('0x3e')];_0x24de26+=0x1){_0x24de26>0x0&&(_0x383d19+='\x20'+_0x34a01c[_0x2dff('0x6a')]+'\x20');_0x383d19+=_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6b')]?_0x218ef2(_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6b')]):_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6c')]+'\x20'+_0x34a01c[_0x2dff('0x69')][_0x24de26][_0x2dff('0x6d')]+(_0x50b2c1(_0x34a01c['rules'][_0x24de26]['condition'])?'\x20'+_0x34a01c['rules'][_0x24de26]['value']:'');}return _0x383d19+')';};var _0x4ebc3a={'where':{'id':_0x2980a0['id']}},_0x1460de,_0x1c4810,_0x15854b,_0x44e516,_0x2a8d1b;_0x4ebc3a=_[_0x2dff('0x45')]({},_0x4ebc3a,_0x51d26f);return db['AnalyticDefaultReport'][_0x2dff('0x4f')](_0x4ebc3a)[_0x2dff('0x25')](function(_0x49b2b9){if(_0x49b2b9){_0x1460de=_0x49b2b9;return _0x49b2b9['getFields']();}return null;})[_0x2dff('0x25')](function(_0x212f94){if(_0x212f94){if(!_0x212f94[_0x2dff('0x3e')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1c4810=_0x212f94;return db[_0x2dff('0x71')]['findAll']({'raw':!![]});}return null;})[_0x2dff('0x25')](function(_0x474c7c){if(_0x474c7c){_0x15854b=_[_0x2dff('0x72')](_0x474c7c,'id');var _0x20d55e;var _0x2fba0e=squel[_0x2dff('0x73')]();_0x2fba0e[_0x2dff('0x8f')](_0x1460de[_0x2dff('0x74')]);for(var _0xcdc401=0x0;_0xcdc401<_0x1c4810[_0x2dff('0x3e')];_0xcdc401+=0x1){_0x20d55e=_0x1c4810[_0xcdc401]['MetricId']?_0x15854b[_0x1c4810[_0xcdc401][_0x2dff('0x75')]][_0x2dff('0x76')]:_0x1c4810[_0xcdc401][_0x2dff('0x6c')];_0x20d55e=_0x1c4810[_0xcdc401][_0x2dff('0x90')]?_[_0x2dff('0x77')](_0x4adf5d[_0x1c4810[_0xcdc401]['function']],'%s',_0x20d55e):_0x20d55e;_0x20d55e=_0x1c4810[_0xcdc401][_0x2dff('0x78')]?_['replace'](_0x58e5de[_0x1c4810[_0xcdc401][_0x2dff('0x78')]],'%s',_0x20d55e):_0x20d55e;if(_0x1c4810[_0xcdc401][_0x2dff('0x79')]){_0x2fba0e[_0x2dff('0x6b')](_0x20d55e);}_0x1c4810[_0xcdc401]['orderBy']&&_0x2fba0e[_0x2dff('0x40')](_0x20d55e,_0x1c4810[_0xcdc401][_0x2dff('0x7a')]===_0x2dff('0x7b')?![]:!![]);_0x2fba0e[_0x2dff('0x6c')](_0x20d55e,_0x1c4810[_0xcdc401][_0x2dff('0x7c')]||_0x20d55e);}if(_0x1460de[_0x2dff('0x7d')]){_0x1460de['joins']=JSON[_0x2dff('0x7e')](_0x1460de['joins']);for(var _0x4facf7=0x0;_0x4facf7<_0x1460de[_0x2dff('0x7d')][_0x2dff('0x3e')];_0x4facf7+=0x1){if(_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x37')]&&_[_0x2dff('0x64')](_0x3ff63b,_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x37')])&&_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x7f')]&&_0x1460de['joins'][_0x4facf7][_0x2dff('0x80')]&&_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x81')]){_0x2fba0e[_0x1460de[_0x2dff('0x7d')][_0x4facf7]['type']](_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x80')],null,util['format'](_0x2dff('0x82'),_0x1460de[_0x2dff('0x74')],_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x7f')],_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x80')],_0x1460de[_0x2dff('0x7d')][_0x4facf7][_0x2dff('0x81')]));}}}if(_0x1460de[_0x2dff('0x83')]){_0x1460de[_0x2dff('0x83')]=JSON['parse'](_0x1460de[_0x2dff('0x83')]);_0x2fba0e['where'](_0x218ef2(_0x1460de[_0x2dff('0x83')][_0x2dff('0x6b')]));}_0x2a8d1b=_0x2fba0e[_0x2dff('0x84')]();_0x2fba0e[_0x2dff('0x1e')](_0x402208);_0x2fba0e[_0x2dff('0x1d')](0x0);return;}})[_0x2dff('0x25')](function(){if(_0x327141[_0x2dff('0x91')]===_0x2dff('0x92')){return null;}var _0x441eb=_[_0x2dff('0x45')](_0x327141,{'name':_0x327141['fullPath']||_0x327141[_0x2dff('0x2b')]||_0x1460de['name'],'basename':_0x92c079,'savename':util['format'](_0x2dff('0x93'),_0x327141[_0x2dff('0x2b')]||_0x1460de[_0x2dff('0x2b')],require(_0x2dff('0x94'))[_0x2dff('0x95')](0x4),_0x327141[_0x2dff('0x91')]||_0x2dff('0x96')),'reportId':_0x1460de['id'],'reportType':_0x2dff('0x97')});return db[_0x2dff('0x98')][_0x2dff('0x50')](_0x441eb,{'raw':!![]});})[_0x2dff('0x25')](function(_0x2439ca){if(_0x1460de[_0x2dff('0x74')]==='cdr'){_0x2a8d1b[_0x2dff('0x42')](_0x1460de[_0x2dff('0x74')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x327141['startDate'],_0x327141[_0x2dff('0x99')]);}else{_0x2a8d1b[_0x2dff('0x42')](_0x1460de[_0x2dff('0x74')]+_0x2dff('0x9a'),_0x327141[_0x2dff('0x9b')],_0x327141['endDate']);}if(_0x2439ca){logger['info'](_0x2dff('0x9c'),_0x2a8d1b['toString']());require('child_process')[_0x2dff('0x9d')](path['join'](__dirname,'../../components/export/',_0x2439ca['output']),[_0x2439ca['id'],_0x2a8d1b[_0x2dff('0x87')](),path[_0x2dff('0x59')](__dirname,_0x2dff('0x9e'),_0x2439ca[_0x2dff('0x9f')]),_0x92c079]);return _0x2439ca;}else{var _0x493b0f=squel[_0x2dff('0x73')]();_0x493b0f[_0x2dff('0x8f')]('('+_0x2a8d1b[_0x2dff('0x87')]()+')','countTable');_0x493b0f[_0x2dff('0x6c')]('COUNT(*)',_0x2dff('0x20'));_0x2a8d1b[_0x2dff('0x1e')](_0x327141[_0x2dff('0x1e')]||_0x402208);_0x2a8d1b['offset'](_0x327141['offset']||0x0);return dbH['sequelize']['query'](_0x493b0f[_0x2dff('0x87')](),{'type':dbH[_0x2dff('0xa0')][_0x2dff('0xa1')]['SELECT']})[_0x2dff('0x25')](function(_0x38568d){if(!_0x38568d[_0x2dff('0x3e')]){_0x44e516=0x0;}else{_0x44e516=_0x38568d[0x0]['count']||0x0;}return dbH[_0x2dff('0xa0')]['query'](_0x2a8d1b[_0x2dff('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0x2dff('0x88')]});})[_0x2dff('0x25')](function(_0x59c5eb){return{'rows':_0x59c5eb||[],'count':_0x44e516};});}});}exports[_0x2dff('0xa2')]=function(_0xa6e0c8,_0x33b12f){return runReport(_0xa6e0c8['params'],_0xa6e0c8[_0x2dff('0x3b')],_0xa6e0c8[_0x2dff('0x47')])[_0x2dff('0x25')](respondWithResult(_0x33b12f,null))[_0x2dff('0x4b')](handleError(_0x33b12f,null));};exports['runReport']=runReport;exports[_0x2dff('0x3b')]=function(_0x2cf6da,_0x5255b1){var _0x34591e=0xa;var _0x367a04=[_0x2dff('0x59'),_0x2dff('0x5a'),'right_join',_0x2dff('0x5c')];var _0x5c1362={'SUM':_0x2dff('0x89'),'COUNT':_0x2dff('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2dff('0x5e'),'MIN':_0x2dff('0x8b'),'AVG':_0x2dff('0xa3'),'GROUP_CONCAT':_0x2dff('0x5f'),'GROUP_CONCAT ASC':_0x2dff('0x8c'),'GROUP_CONCAT DESC':_0x2dff('0x60')};var _0x4d4dd2={'SEC_TO_TIME':_0x2dff('0x61'),'DATE':'DATE(%s)','HOUR':_0x2dff('0x8e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x125769=function(_0x45047f){return!_['includes']([_0x2dff('0x65'),_0x2dff('0x66'),_0x2dff('0x67'),'IS\x20NOT\x20EMPTY'],_0x45047f);};var _0x3b4a74=function(_0x1ff10d){if(!_0x1ff10d||!_0x1ff10d[_0x2dff('0x69')][_0x2dff('0x3e')]){return'';}for(var _0x5a22c8='(',_0x370f1=0x0;_0x370f1<_0x1ff10d[_0x2dff('0x69')][_0x2dff('0x3e')];_0x370f1+=0x1){_0x370f1>0x0&&(_0x5a22c8+='\x20'+_0x1ff10d[_0x2dff('0x6a')]+'\x20');_0x5a22c8+=_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6b')]?_0x3b4a74(_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6b')]):_0x1ff10d['rules'][_0x370f1][_0x2dff('0x6c')]+'\x20'+_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6d')]+(_0x125769(_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6d')])?'\x20'+_0x1ff10d[_0x2dff('0x69')][_0x370f1][_0x2dff('0x6e')]:'');}return _0x5a22c8+')';};var _0x12674e={'where':{'id':_0x2cf6da[_0x2dff('0x57')]['id']}},_0x1964c0,_0x1cda7a,_0x41d06c,_0x5c21e7,_0x40650f;_0x12674e=_['merge']({},_0x12674e,_0x2cf6da[_0x2dff('0x47')]);return db['AnalyticDefaultReport'][_0x2dff('0x4f')](_0x12674e)['then'](function(_0x1c577f){if(_0x1c577f){_0x1964c0=_0x1c577f;return _0x1c577f['getFields']();}return null;})['then'](function(_0x289673){if(_0x289673){if(!_0x289673[_0x2dff('0x3e')]){throw new db[(_0x2dff('0xa4'))][(_0x2dff('0x70'))](_0x2dff('0xa5'),0x193);}_0x1cda7a=_0x289673;return db[_0x2dff('0x71')][_0x2dff('0x49')]({'raw':!![]});}return null;})[_0x2dff('0x25')](function(_0x1f69c1){if(_0x1f69c1){_0x41d06c=_[_0x2dff('0x72')](_0x1f69c1,'id');var _0x30b83f;var _0x489598=squel['select']();_0x489598['from'](_0x1964c0[_0x2dff('0x74')]);for(var _0xbaf60e=0x0;_0xbaf60e<_0x1cda7a[_0x2dff('0x3e')];_0xbaf60e+=0x1){_0x30b83f=_0x1cda7a[_0xbaf60e][_0x2dff('0x75')]?_0x41d06c[_0x1cda7a[_0xbaf60e][_0x2dff('0x75')]][_0x2dff('0x76')]:_0x1cda7a[_0xbaf60e][_0x2dff('0x6c')];_0x30b83f=_0x1cda7a[_0xbaf60e]['function']?_['replace'](_0x5c1362[_0x1cda7a[_0xbaf60e][_0x2dff('0x90')]],'%s',_0x30b83f):_0x30b83f;_0x30b83f=_0x1cda7a[_0xbaf60e][_0x2dff('0x78')]?_[_0x2dff('0x77')](_0x4d4dd2[_0x1cda7a[_0xbaf60e][_0x2dff('0x78')]],'%s',_0x30b83f):_0x30b83f;if(_0x1cda7a[_0xbaf60e][_0x2dff('0x79')]){_0x489598[_0x2dff('0x6b')](_0x30b83f);}_0x1cda7a[_0xbaf60e][_0x2dff('0x7a')]&&_0x489598[_0x2dff('0x40')](_0x30b83f,_0x1cda7a[_0xbaf60e][_0x2dff('0x7a')]===_0x2dff('0x7b')?![]:!![]);_0x489598['field'](_0x30b83f,_0x1cda7a[_0xbaf60e][_0x2dff('0x7c')]||_0x30b83f);}if(_0x1964c0[_0x2dff('0x7d')]){_0x1964c0['joins']=JSON[_0x2dff('0x7e')](_0x1964c0[_0x2dff('0x7d')]);for(var _0x54422e=0x0;_0x54422e<_0x1964c0['joins'][_0x2dff('0x3e')];_0x54422e+=0x1){if(_0x1964c0['joins'][_0x54422e]['type']&&_['includes'](_0x367a04,_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x37')])&&_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x7f')]&&_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x80')]&&_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x81')]){_0x489598[_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x37')]](_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x80')],null,util['format'](_0x2dff('0x82'),_0x1964c0[_0x2dff('0x74')],_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x7f')],_0x1964c0[_0x2dff('0x7d')][_0x54422e][_0x2dff('0x80')],_0x1964c0[_0x2dff('0x7d')][_0x54422e]['foreignKey']));}}}if(_0x1964c0[_0x2dff('0x83')]){_0x1964c0['conditions']=JSON[_0x2dff('0x7e')](_0x1964c0[_0x2dff('0x83')]);_0x489598[_0x2dff('0x42')](_0x3b4a74(_0x1964c0[_0x2dff('0x83')][_0x2dff('0x6b')]));}_0x40650f=_0x489598[_0x2dff('0x84')]();_0x489598['limit'](_0x34591e);_0x489598[_0x2dff('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0x489598[_0x2dff('0x87')]());return dbH[_0x2dff('0xa0')][_0x2dff('0x3b')](_0x489598[_0x2dff('0x87')](),{'type':dbH[_0x2dff('0xa0')][_0x2dff('0xa1')]['SELECT']});}})[_0x2dff('0x25')](function(){return{'sql':_0x40650f[_0x2dff('0x87')]()};})[_0x2dff('0x25')](respondWithResult(_0x5255b1,null))[_0x2dff('0x4b')](handleError(_0x5255b1,null));}; \ No newline at end of file +var _0x2899=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','sendStatus','name','send','render','merge','contact','message','agent','interaction','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','AnalyticMetric','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','left_join','COUNT(DISTINCT\x20%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','undefined','count'];(function(_0x204d67,_0x48889f){var _0xc988ae=function(_0x4bd8a7){while(--_0x4bd8a7){_0x204d67['push'](_0x204d67['shift']());}};_0xc988ae(++_0x48889f);}(_0x2899,0x135));var _0x9289=function(_0x1ffebd,_0x375666){_0x1ffebd=_0x1ffebd-0x0;var _0xc42f74=_0x2899[_0x1ffebd];return _0xc42f74;};'use strict';var emlformat=require(_0x9289('0x0'));var rimraf=require(_0x9289('0x1'));var zipdir=require(_0x9289('0x2'));var jsonpatch=require(_0x9289('0x3'));var rp=require(_0x9289('0x4'));var moment=require(_0x9289('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9289('0x6'));var util=require(_0x9289('0x7'));var path=require(_0x9289('0x8'));var sox=require(_0x9289('0x9'));var csv=require(_0x9289('0xa'));var ejs=require(_0x9289('0xb'));var fs=require('fs');var fs_extra=require(_0x9289('0xc'));var _=require(_0x9289('0xd'));var squel=require(_0x9289('0xe'));var crypto=require(_0x9289('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9289('0x10'));var toCsv=require(_0x9289('0xa'));var querystring=require(_0x9289('0x11'));var Papa=require(_0x9289('0x12'));var Redis=require(_0x9289('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9289('0x14'));var as=require(_0x9289('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9289('0x16'))(_0x9289('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9289('0x18'));var db=require(_0x9289('0x19'))['db'];var dbH=require(_0x9289('0x19'))[_0x9289('0x1a')];function respondWithStatusCode(_0x33992d,_0x64b930){_0x64b930=_0x64b930||0xcc;return function(_0x58f166){if(_0x58f166){return _0x33992d['sendStatus'](_0x64b930);}return _0x33992d['status'](_0x64b930)[_0x9289('0x1b')]();};}function respondWithResult(_0x23b722,_0x45f8b5){_0x45f8b5=_0x45f8b5||0xc8;return function(_0x51a03f){if(_0x51a03f){return _0x23b722[_0x9289('0x1c')](_0x45f8b5)[_0x9289('0x1d')](_0x51a03f);}};}function respondWithFilteredResult(_0x2ceb61,_0x588bbf){return function(_0x54704d){if(_0x54704d){var _0x140398=typeof _0x588bbf[_0x9289('0x1e')]===_0x9289('0x1f')&&typeof _0x588bbf['limit']==='undefined';var _0x19e2a0=_0x54704d[_0x9289('0x20')];var _0x4d7316=_0x140398?0x0:_0x588bbf[_0x9289('0x1e')];var _0x974d6a=_0x140398?_0x54704d[_0x9289('0x20')]:_0x588bbf[_0x9289('0x1e')]+_0x588bbf[_0x9289('0x21')];var _0x3f1bc0;if(_0x974d6a>=_0x19e2a0){_0x974d6a=_0x19e2a0;_0x3f1bc0=0xc8;}else{_0x3f1bc0=0xce;}_0x2ceb61['status'](_0x3f1bc0);return _0x2ceb61[_0x9289('0x22')](_0x9289('0x23'),_0x4d7316+'-'+_0x974d6a+'/'+_0x19e2a0)[_0x9289('0x1d')](_0x54704d);}return null;};}function patchUpdates(_0x51ae74){return function(_0x49f035){try{jsonpatch[_0x9289('0x24')](_0x49f035,_0x51ae74,!![]);}catch(_0x53dbe6){return BPromise[_0x9289('0x25')](_0x53dbe6);}return _0x49f035[_0x9289('0x26')]();};}function saveUpdates(_0x3b4309,_0x40f831){return function(_0x43af54){if(_0x43af54){return _0x43af54[_0x9289('0x27')](_0x3b4309)[_0x9289('0x28')](function(_0xed6c64){return _0xed6c64;});}return null;};}function removeEntity(_0x1442a7,_0x1696d){return function(_0x6789c1){if(_0x6789c1){return _0x6789c1[_0x9289('0x29')]()['then'](function(){var _0x45615d=_0x6789c1[_0x9289('0x2a')]({'plain':!![]});var _0x2b2182=_0x9289('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b2182,'resourceId':_0x45615d['id']}})[_0x9289('0x28')](function(){return _0x6789c1;});})[_0x9289('0x28')](function(){_0x1442a7[_0x9289('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f7759,_0x7e0e6f){return function(_0x357aa8){if(!_0x357aa8){_0x2f7759[_0x9289('0x2c')](0x194);}return _0x357aa8;};}function handleError(_0x1d0d5b,_0x46e75e){_0x46e75e=_0x46e75e||0x1f4;return function(_0x2007a5){logger['error'](_0x2007a5['stack']);if(_0x2007a5[_0x9289('0x2d')]){delete _0x2007a5['name'];}_0x1d0d5b[_0x9289('0x1c')](_0x46e75e)[_0x9289('0x2e')](_0x2007a5);};}function getMustacheRender(_0x2d4203,_0x47cf72){return Mustache[_0x9289('0x2f')](_0x2d4203,_[_0x9289('0x30')](_0x47cf72['body'],{'contact':_0x47cf72[_0x9289('0x31')],'message':_0x47cf72[_0x9289('0x32')],'agent':_0x47cf72[_0x9289('0x33')],'interaction':_0x47cf72[_0x9289('0x34')],'account':_0x47cf72['account']}))||'';}exports[_0x9289('0x35')]=function(_0x1d8ef6,_0x5c8d96){var _0x39449b={},_0x13a700={},_0x5b26f3={'count':0x0,'rows':[]};var _0x2c59d6=_['map'](db[_0x9289('0x36')][_0x9289('0x37')],function(_0x559131){return{'name':_0x559131[_0x9289('0x38')],'type':_0x559131[_0x9289('0x39')][_0x9289('0x3a')]};});_0x13a700[_0x9289('0x3b')]=_[_0x9289('0x3c')](_0x2c59d6,'name');_0x13a700['query']=_[_0x9289('0x3d')](_0x1d8ef6['query']);_0x13a700[_0x9289('0x3e')]=_[_0x9289('0x3f')](_0x13a700[_0x9289('0x3b')],_0x13a700[_0x9289('0x40')]);_0x39449b[_0x9289('0x41')]=_[_0x9289('0x3f')](_0x13a700[_0x9289('0x3b')],qs['fields'](_0x1d8ef6[_0x9289('0x40')][_0x9289('0x42')]));_0x39449b[_0x9289('0x41')]=_0x39449b[_0x9289('0x41')][_0x9289('0x43')]?_0x39449b[_0x9289('0x41')]:_0x13a700[_0x9289('0x3b')];if(!_0x1d8ef6[_0x9289('0x40')]['hasOwnProperty'](_0x9289('0x44'))){_0x39449b['limit']=qs[_0x9289('0x21')](_0x1d8ef6[_0x9289('0x40')][_0x9289('0x21')]);_0x39449b[_0x9289('0x1e')]=qs[_0x9289('0x1e')](_0x1d8ef6[_0x9289('0x40')][_0x9289('0x1e')]);}_0x39449b[_0x9289('0x45')]=qs[_0x9289('0x46')](_0x1d8ef6['query'][_0x9289('0x46')]);_0x39449b[_0x9289('0x47')]=qs[_0x9289('0x3e')](_['pick'](_0x1d8ef6[_0x9289('0x40')],_0x13a700[_0x9289('0x3e')]),_0x2c59d6);if(_0x1d8ef6[_0x9289('0x40')][_0x9289('0x48')]){_0x39449b['where']=_[_0x9289('0x30')](_0x39449b[_0x9289('0x47')],{'$or':_[_0x9289('0x3c')](_0x2c59d6,function(_0x395888){if(_0x395888[_0x9289('0x39')]!==_0x9289('0x49')){var _0x26bd16={};_0x26bd16[_0x395888[_0x9289('0x2d')]]={'$like':'%'+_0x1d8ef6[_0x9289('0x40')]['filter']+'%'};return _0x26bd16;}})});}_0x39449b=_['merge']({},_0x39449b,_0x1d8ef6[_0x9289('0x4a')]);var _0x20294f={'where':_0x39449b['where']};return db[_0x9289('0x36')][_0x9289('0x20')](_0x20294f)[_0x9289('0x28')](function(_0x3fddb7){_0x5b26f3['count']=_0x3fddb7;if(_0x1d8ef6[_0x9289('0x40')][_0x9289('0x4b')]){_0x39449b['include']=[{'all':!![]}];}return db[_0x9289('0x36')][_0x9289('0x4c')](_0x39449b);})['then'](function(_0xefac29){_0x5b26f3['rows']=_0xefac29;return _0x5b26f3;})[_0x9289('0x28')](respondWithFilteredResult(_0x5c8d96,_0x39449b))[_0x9289('0x4d')](handleError(_0x5c8d96,null));};exports[_0x9289('0x4e')]=function(_0xe16498,_0x401059){var _0x258321={'raw':!![],'where':{'id':_0xe16498[_0x9289('0x4f')]['id']}},_0x6bf7f={};_0x6bf7f[_0x9289('0x3b')]=_[_0x9289('0x3d')](db[_0x9289('0x36')][_0x9289('0x37')]);_0x6bf7f['query']=_[_0x9289('0x3d')](_0xe16498[_0x9289('0x40')]);_0x6bf7f[_0x9289('0x3e')]=_[_0x9289('0x3f')](_0x6bf7f[_0x9289('0x3b')],_0x6bf7f[_0x9289('0x40')]);_0x258321['attributes']=_[_0x9289('0x3f')](_0x6bf7f[_0x9289('0x3b')],qs[_0x9289('0x42')](_0xe16498[_0x9289('0x40')][_0x9289('0x42')]));_0x258321[_0x9289('0x41')]=_0x258321[_0x9289('0x41')]['length']?_0x258321[_0x9289('0x41')]:_0x6bf7f[_0x9289('0x3b')];if(_0xe16498[_0x9289('0x40')][_0x9289('0x4b')]){_0x258321['include']=[{'all':!![]}];}_0x258321=_[_0x9289('0x30')]({},_0x258321,_0xe16498[_0x9289('0x4a')]);return db[_0x9289('0x36')][_0x9289('0x50')](_0x258321)[_0x9289('0x28')](handleEntityNotFound(_0x401059,null))['then'](respondWithResult(_0x401059,null))[_0x9289('0x4d')](handleError(_0x401059,null));};exports[_0x9289('0x51')]=function(_0x26340d,_0x59b232){return db['AnalyticDefaultReport'][_0x9289('0x51')](_0x26340d['body'],{})[_0x9289('0x28')](function(_0x37f703){var _0x9c776d=_0x26340d[_0x9289('0x52')]['get']({'plain':!![]});if(!_0x9c776d)throw new Error(_0x9289('0x53'));if(_0x9c776d[_0x9289('0x54')]==='user'){var _0x2eb759=_0x37f703[_0x9289('0x2a')]({'plain':!![]});var _0xe53fea=_0x9289('0x55');return db['UserProfileSection'][_0x9289('0x50')]({'where':{'name':_0xe53fea,'userProfileId':_0x9c776d[_0x9289('0x56')]},'raw':!![]})[_0x9289('0x28')](function(_0x4c993d){if(_0x4c993d&&_0x4c993d['autoAssociation']===0x0){return db[_0x9289('0x57')][_0x9289('0x51')]({'name':_0x2eb759[_0x9289('0x2d')],'resourceId':_0x2eb759['id'],'type':_0x9289('0x2b'),'sectionId':_0x4c993d['id']},{})[_0x9289('0x28')](function(){return _0x37f703;});}else{return _0x37f703;}})['catch'](function(_0x5d077b){logger[_0x9289('0x58')](_0x9289('0x59'),_0x5d077b);throw _0x5d077b;});}return _0x37f703;})['then'](respondWithResult(_0x59b232,0xc9))['catch'](handleError(_0x59b232,null));};exports['update']=function(_0x3827d,_0x5c780c){if(_0x3827d[_0x9289('0x5a')]['id']){delete _0x3827d[_0x9289('0x5a')]['id'];}return db[_0x9289('0x36')][_0x9289('0x50')]({'where':{'id':_0x3827d[_0x9289('0x4f')]['id']}})[_0x9289('0x28')](handleEntityNotFound(_0x5c780c,null))['then'](saveUpdates(_0x3827d[_0x9289('0x5a')],null))[_0x9289('0x28')](respondWithResult(_0x5c780c,null))[_0x9289('0x4d')](handleError(_0x5c780c,null));};exports[_0x9289('0x29')]=function(_0xcb0324,_0x3f4ee3){return db['AnalyticDefaultReport'][_0x9289('0x50')]({'where':{'id':_0xcb0324['params']['id']}})[_0x9289('0x28')](handleEntityNotFound(_0x3f4ee3,null))[_0x9289('0x28')](removeEntity(_0x3f4ee3,null))[_0x9289('0x4d')](handleError(_0x3f4ee3,null));};exports[_0x9289('0x5b')]=function(_0x5d81e2,_0x4ccb5a){var _0xc83088=0xa;var _0x1d287a=[_0x9289('0x5c'),'left_join',_0x9289('0x5d'),_0x9289('0x5e')];var _0x594a48={'SUM':_0x9289('0x5f'),'COUNT':_0x9289('0x60'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9289('0x61'),'MIN':'MIN(%s)','AVG':_0x9289('0x62'),'GROUP_CONCAT':_0x9289('0x63'),'GROUP_CONCAT ASC':_0x9289('0x64'),'GROUP_CONCAT DESC':_0x9289('0x65')};var _0x34284d={'SEC_TO_TIME':_0x9289('0x66'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9289('0x67')};var _0x228144=function(_0x548d01){return!_[_0x9289('0x68')]([_0x9289('0x69'),_0x9289('0x6a'),_0x9289('0x6b'),_0x9289('0x6c')],_0x548d01);};var _0xf2037d=function(_0x43833e){if(!_0x43833e||!_0x43833e[_0x9289('0x6d')][_0x9289('0x43')]){return'';}for(var _0x49ebdd='(',_0x46ba2a=0x0;_0x46ba2a<_0x43833e['rules']['length'];_0x46ba2a+=0x1){_0x46ba2a>0x0&&(_0x49ebdd+='\x20'+_0x43833e[_0x9289('0x6e')]+'\x20');_0x49ebdd+=_0x43833e[_0x9289('0x6d')][_0x46ba2a][_0x9289('0x6f')]?_0xf2037d(_0x43833e['rules'][_0x46ba2a][_0x9289('0x6f')]):_0x43833e[_0x9289('0x6d')][_0x46ba2a][_0x9289('0x70')]+'\x20'+_0x43833e['rules'][_0x46ba2a][_0x9289('0x71')]+(_0x228144(_0x43833e[_0x9289('0x6d')][_0x46ba2a]['condition'])?'\x20'+_0x43833e[_0x9289('0x6d')][_0x46ba2a][_0x9289('0x72')]:'');}return _0x49ebdd+')';};var _0x411ea7={'where':{'id':_0x5d81e2['params']['id']}},_0x32aa9d,_0x13ae36,_0x192049,_0x1d17fe,_0x5de4c8;_0x411ea7=_['merge']({},_0x411ea7,_0x5d81e2[_0x9289('0x4a')]);return db[_0x9289('0x36')][_0x9289('0x50')](_0x411ea7)[_0x9289('0x28')](function(_0x314ffd){if(_0x314ffd){_0x32aa9d=_0x314ffd;return _0x314ffd[_0x9289('0x73')]();}return null;})[_0x9289('0x28')](function(_0x3d0937){if(_0x3d0937){if(!_0x3d0937[_0x9289('0x43')]){throw new db[(_0x9289('0x74'))][(_0x9289('0x75'))](_0x9289('0x76'),0x193);}_0x13ae36=_0x3d0937;return db['AnalyticMetric'][_0x9289('0x4c')]({'raw':!![]});}return null;})[_0x9289('0x28')](function(_0x475033){if(_0x475033){_0x192049=_[_0x9289('0x77')](_0x475033,'id');var _0x2c69fc;var _0x380412=squel[_0x9289('0x78')]();_0x380412[_0x9289('0x79')](_0x32aa9d[_0x9289('0x7a')]);for(var _0x120493=0x0;_0x120493<_0x13ae36['length'];_0x120493+=0x1){_0x2c69fc=_0x13ae36[_0x120493][_0x9289('0x7b')]?_0x192049[_0x13ae36[_0x120493][_0x9289('0x7b')]][_0x9289('0x7c')]:_0x13ae36[_0x120493][_0x9289('0x70')];_0x2c69fc=_0x13ae36[_0x120493][_0x9289('0x7d')]?_[_0x9289('0x7e')](_0x594a48[_0x13ae36[_0x120493][_0x9289('0x7d')]],'%s',_0x2c69fc):_0x2c69fc;_0x2c69fc=_0x13ae36[_0x120493]['format']?_[_0x9289('0x7e')](_0x34284d[_0x13ae36[_0x120493][_0x9289('0x7f')]],'%s',_0x2c69fc):_0x2c69fc;if(_0x13ae36[_0x120493][_0x9289('0x80')]){_0x380412[_0x9289('0x6f')](_0x2c69fc);}_0x13ae36[_0x120493][_0x9289('0x81')]&&_0x380412[_0x9289('0x45')](_0x2c69fc,_0x13ae36[_0x120493]['orderBy']==='DESC'?![]:!![]);_0x380412['field'](_0x2c69fc,_0x13ae36[_0x120493][_0x9289('0x82')]||_0x2c69fc);}if(_0x32aa9d[_0x9289('0x83')]){_0x32aa9d[_0x9289('0x83')]=JSON[_0x9289('0x84')](_0x32aa9d[_0x9289('0x83')]);for(var _0x3adf3e=0x0;_0x3adf3e<_0x32aa9d[_0x9289('0x83')][_0x9289('0x43')];_0x3adf3e+=0x1){if(_0x32aa9d[_0x9289('0x83')][_0x3adf3e][_0x9289('0x39')]&&_[_0x9289('0x68')](_0x1d287a,_0x32aa9d['joins'][_0x3adf3e][_0x9289('0x39')])&&_0x32aa9d[_0x9289('0x83')][_0x3adf3e][_0x9289('0x85')]&&_0x32aa9d[_0x9289('0x83')][_0x3adf3e][_0x9289('0x86')]&&_0x32aa9d[_0x9289('0x83')][_0x3adf3e][_0x9289('0x87')]){_0x380412[_0x32aa9d[_0x9289('0x83')][_0x3adf3e][_0x9289('0x39')]](_0x32aa9d['joins'][_0x3adf3e][_0x9289('0x86')],null,util[_0x9289('0x7f')](_0x9289('0x88'),_0x32aa9d[_0x9289('0x7a')],_0x32aa9d[_0x9289('0x83')][_0x3adf3e]['parentKey'],_0x32aa9d[_0x9289('0x83')][_0x3adf3e][_0x9289('0x86')],_0x32aa9d[_0x9289('0x83')][_0x3adf3e]['foreignKey']));}}}if(_0x32aa9d[_0x9289('0x89')]){_0x32aa9d[_0x9289('0x89')]=JSON['parse'](_0x32aa9d[_0x9289('0x89')]);_0x380412[_0x9289('0x47')](_0xf2037d(_0x32aa9d[_0x9289('0x89')][_0x9289('0x6f')]));}_0x5de4c8=_0x380412[_0x9289('0x8a')]();_0x380412[_0x9289('0x21')](_0xc83088);_0x380412[_0x9289('0x1e')](0x0);logger[_0x9289('0x8b')](_0x9289('0x8c'),_0x380412[_0x9289('0x8d')]());return dbH['sequelize'][_0x9289('0x40')](_0x380412[_0x9289('0x8d')](),{'type':dbH[_0x9289('0x8e')][_0x9289('0x8f')][_0x9289('0x90')]});}})[_0x9289('0x28')](respondWithResult(_0x4ccb5a,null))[_0x9289('0x4d')](handleError(_0x4ccb5a,null));};function runReport(_0x4a3368,_0x48c309,_0x315a4b){var _0x5aacf0=_0x48c309[_0x9289('0x2d')];var _0x4cc41a=0xa;var _0x185e02=[_0x9289('0x5c'),'left_join',_0x9289('0x5d'),_0x9289('0x5e')];var _0x124f0e={'SUM':_0x9289('0x5f'),'COUNT':_0x9289('0x60'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9289('0x61'),'MIN':_0x9289('0x91'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9289('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9289('0x65')};var _0x112465={'SEC_TO_TIME':_0x9289('0x66'),'DATE':_0x9289('0x92'),'HOUR':_0x9289('0x93'),'ROUND':_0x9289('0x94'),'UNIX_TIMESTAMP':_0x9289('0x67')};var _0x38a04a=function(_0x47fc34){return!_[_0x9289('0x68')]([_0x9289('0x69'),_0x9289('0x6a'),_0x9289('0x6b'),'IS\x20NOT\x20EMPTY'],_0x47fc34);};var _0x2af95d=function(_0x198fbe){if(!_0x198fbe||!_0x198fbe[_0x9289('0x6d')][_0x9289('0x43')]){return'';}for(var _0x5cef9d='(',_0x32ad7e=0x0;_0x32ad7e<_0x198fbe['rules'][_0x9289('0x43')];_0x32ad7e+=0x1){_0x32ad7e>0x0&&(_0x5cef9d+='\x20'+_0x198fbe['operator']+'\x20');_0x5cef9d+=_0x198fbe[_0x9289('0x6d')][_0x32ad7e]['group']?_0x2af95d(_0x198fbe[_0x9289('0x6d')][_0x32ad7e]['group']):_0x198fbe['rules'][_0x32ad7e][_0x9289('0x70')]+'\x20'+_0x198fbe[_0x9289('0x6d')][_0x32ad7e]['condition']+(_0x38a04a(_0x198fbe[_0x9289('0x6d')][_0x32ad7e][_0x9289('0x71')])?'\x20'+_0x198fbe['rules'][_0x32ad7e][_0x9289('0x72')]:'');}return _0x5cef9d+')';};var _0x4c302={'where':{'id':_0x4a3368['id']}},_0x5d6510,_0x488144,_0x17ccd7,_0x28792a,_0x28daef;_0x4c302=_[_0x9289('0x30')]({},_0x4c302,_0x315a4b);return db[_0x9289('0x36')][_0x9289('0x50')](_0x4c302)[_0x9289('0x28')](function(_0x43da5f){if(_0x43da5f){_0x5d6510=_0x43da5f;return _0x43da5f[_0x9289('0x73')]();}return null;})['then'](function(_0x472886){if(_0x472886){if(!_0x472886[_0x9289('0x43')]){throw new db['Sequelize'][(_0x9289('0x75'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x488144=_0x472886;return db[_0x9289('0x95')]['findAll']({'raw':!![]});}return null;})[_0x9289('0x28')](function(_0x44ea3a){if(_0x44ea3a){_0x17ccd7=_[_0x9289('0x77')](_0x44ea3a,'id');var _0x27e3f6;var _0x42c204=squel[_0x9289('0x78')]();_0x42c204['from'](_0x5d6510[_0x9289('0x7a')]);for(var _0x28d946=0x0;_0x28d946<_0x488144['length'];_0x28d946+=0x1){_0x27e3f6=_0x488144[_0x28d946][_0x9289('0x7b')]?_0x17ccd7[_0x488144[_0x28d946][_0x9289('0x7b')]][_0x9289('0x7c')]:_0x488144[_0x28d946][_0x9289('0x70')];_0x27e3f6=_0x488144[_0x28d946][_0x9289('0x7d')]?_[_0x9289('0x7e')](_0x124f0e[_0x488144[_0x28d946][_0x9289('0x7d')]],'%s',_0x27e3f6):_0x27e3f6;_0x27e3f6=_0x488144[_0x28d946][_0x9289('0x7f')]?_['replace'](_0x112465[_0x488144[_0x28d946][_0x9289('0x7f')]],'%s',_0x27e3f6):_0x27e3f6;if(_0x488144[_0x28d946][_0x9289('0x80')]){_0x42c204[_0x9289('0x6f')](_0x27e3f6);}_0x488144[_0x28d946][_0x9289('0x81')]&&_0x42c204[_0x9289('0x45')](_0x27e3f6,_0x488144[_0x28d946][_0x9289('0x81')]==='DESC'?![]:!![]);_0x42c204[_0x9289('0x70')](_0x27e3f6,_0x488144[_0x28d946][_0x9289('0x82')]||_0x27e3f6);}if(_0x5d6510[_0x9289('0x83')]){_0x5d6510[_0x9289('0x83')]=JSON[_0x9289('0x84')](_0x5d6510['joins']);for(var _0x2bb97a=0x0;_0x2bb97a<_0x5d6510['joins'][_0x9289('0x43')];_0x2bb97a+=0x1){if(_0x5d6510[_0x9289('0x83')][_0x2bb97a][_0x9289('0x39')]&&_[_0x9289('0x68')](_0x185e02,_0x5d6510['joins'][_0x2bb97a][_0x9289('0x39')])&&_0x5d6510[_0x9289('0x83')][_0x2bb97a][_0x9289('0x85')]&&_0x5d6510[_0x9289('0x83')][_0x2bb97a][_0x9289('0x86')]&&_0x5d6510['joins'][_0x2bb97a][_0x9289('0x87')]){_0x42c204[_0x5d6510['joins'][_0x2bb97a][_0x9289('0x39')]](_0x5d6510[_0x9289('0x83')][_0x2bb97a]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5d6510[_0x9289('0x7a')],_0x5d6510[_0x9289('0x83')][_0x2bb97a][_0x9289('0x85')],_0x5d6510[_0x9289('0x83')][_0x2bb97a]['foreignTable'],_0x5d6510[_0x9289('0x83')][_0x2bb97a][_0x9289('0x87')]));}}}if(_0x5d6510[_0x9289('0x89')]){_0x5d6510[_0x9289('0x89')]=JSON[_0x9289('0x84')](_0x5d6510['conditions']);_0x42c204[_0x9289('0x47')](_0x2af95d(_0x5d6510[_0x9289('0x89')][_0x9289('0x6f')]));}_0x28daef=_0x42c204[_0x9289('0x8a')]();_0x42c204[_0x9289('0x21')](_0x4cc41a);_0x42c204[_0x9289('0x1e')](0x0);return;}})['then'](function(){if(_0x48c309[_0x9289('0x96')]==='web'){return null;}var _0x3d6797=_['merge'](_0x48c309,{'name':_0x48c309[_0x9289('0x97')]||_0x48c309[_0x9289('0x2d')]||_0x5d6510[_0x9289('0x2d')],'basename':_0x5aacf0,'savename':util[_0x9289('0x7f')](_0x9289('0x98'),_0x48c309['name']||_0x5d6510[_0x9289('0x2d')],require(_0x9289('0x99'))[_0x9289('0x9a')](0x4),_0x48c309[_0x9289('0x96')]||_0x9289('0x9b')),'reportId':_0x5d6510['id'],'reportType':_0x9289('0x9c')});return db['AnalyticExtractedReport']['create'](_0x3d6797,{'raw':!![]});})[_0x9289('0x28')](function(_0x15c8f9){if(_0x5d6510[_0x9289('0x7a')]==='cdr'){_0x28daef[_0x9289('0x47')](_0x5d6510[_0x9289('0x7a')]+_0x9289('0x9d'),_0x48c309[_0x9289('0x9e')],_0x48c309[_0x9289('0x9f')]);}else{_0x28daef['where'](_0x5d6510[_0x9289('0x7a')]+_0x9289('0xa0'),_0x48c309[_0x9289('0x9e')],_0x48c309[_0x9289('0x9f')]);}if(_0x15c8f9){logger['info'](_0x9289('0xa1'),_0x28daef['toString']());require('child_process')[_0x9289('0xa2')](path['join'](__dirname,'../../components/export/',_0x15c8f9['output']),[_0x15c8f9['id'],_0x28daef['toString'](),path[_0x9289('0x5c')](__dirname,_0x9289('0xa3'),_0x15c8f9[_0x9289('0xa4')]),_0x5aacf0]);return _0x15c8f9;}else{var _0x70e977=squel[_0x9289('0x78')]();_0x70e977[_0x9289('0x79')]('('+_0x28daef['toString']()+')',_0x9289('0xa5'));_0x70e977[_0x9289('0x70')](_0x9289('0xa6'),_0x9289('0x20'));_0x28daef[_0x9289('0x21')](_0x48c309[_0x9289('0x21')]||_0x4cc41a);_0x28daef['offset'](_0x48c309['offset']||0x0);return dbH[_0x9289('0x8e')][_0x9289('0x40')](_0x70e977['toString'](),{'type':dbH[_0x9289('0x8e')][_0x9289('0x8f')]['SELECT']})['then'](function(_0x27b248){if(!_0x27b248[_0x9289('0x43')]){_0x28792a=0x0;}else{_0x28792a=_0x27b248[0x0]['count']||0x0;}return dbH[_0x9289('0x8e')]['query'](_0x28daef[_0x9289('0x8d')](),{'type':dbH[_0x9289('0x8e')]['QueryTypes'][_0x9289('0x90')]});})[_0x9289('0x28')](function(_0x306be4){return{'rows':_0x306be4||[],'count':_0x28792a};});}});}exports[_0x9289('0xa7')]=function(_0xb66f77,_0x33074f){return runReport(_0xb66f77[_0x9289('0x4f')],_0xb66f77[_0x9289('0x40')],_0xb66f77[_0x9289('0x4a')])[_0x9289('0x28')](respondWithResult(_0x33074f,null))[_0x9289('0x4d')](handleError(_0x33074f,null));};exports[_0x9289('0xa8')]=runReport;exports[_0x9289('0x40')]=function(_0xf407a8,_0x279a79){var _0x370f03=0xa;var _0x11f0b8=[_0x9289('0x5c'),_0x9289('0xa9'),_0x9289('0x5d'),_0x9289('0x5e')];var _0x3b7666={'SUM':_0x9289('0x5f'),'COUNT':_0x9289('0x60'),'COUNT DISTINCT':_0x9289('0xaa'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x9289('0x62'),'GROUP_CONCAT':_0x9289('0x63'),'GROUP_CONCAT ASC':_0x9289('0x64'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e114b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9289('0x92'),'HOUR':_0x9289('0x93'),'ROUND':_0x9289('0x94'),'UNIX_TIMESTAMP':_0x9289('0x67')};var _0x11fa0a=function(_0xbe4127){return!_['includes']([_0x9289('0x69'),_0x9289('0x6a'),_0x9289('0x6b'),'IS\x20NOT\x20EMPTY'],_0xbe4127);};var _0x44769c=function(_0x264824){if(!_0x264824||!_0x264824[_0x9289('0x6d')][_0x9289('0x43')]){return'';}for(var _0xb225d8='(',_0x8b19a6=0x0;_0x8b19a6<_0x264824[_0x9289('0x6d')]['length'];_0x8b19a6+=0x1){_0x8b19a6>0x0&&(_0xb225d8+='\x20'+_0x264824[_0x9289('0x6e')]+'\x20');_0xb225d8+=_0x264824[_0x9289('0x6d')][_0x8b19a6][_0x9289('0x6f')]?_0x44769c(_0x264824[_0x9289('0x6d')][_0x8b19a6][_0x9289('0x6f')]):_0x264824['rules'][_0x8b19a6][_0x9289('0x70')]+'\x20'+_0x264824[_0x9289('0x6d')][_0x8b19a6]['condition']+(_0x11fa0a(_0x264824[_0x9289('0x6d')][_0x8b19a6][_0x9289('0x71')])?'\x20'+_0x264824[_0x9289('0x6d')][_0x8b19a6][_0x9289('0x72')]:'');}return _0xb225d8+')';};var _0x9cbc70={'where':{'id':_0xf407a8[_0x9289('0x4f')]['id']}},_0x5cab38,_0x4e3df1,_0x28997c,_0x8da862,_0x19c13d;_0x9cbc70=_['merge']({},_0x9cbc70,_0xf407a8['options']);return db['AnalyticDefaultReport']['find'](_0x9cbc70)[_0x9289('0x28')](function(_0x5200f3){if(_0x5200f3){_0x5cab38=_0x5200f3;return _0x5200f3[_0x9289('0x73')]();}return null;})[_0x9289('0x28')](function(_0x440d1a){if(_0x440d1a){if(!_0x440d1a[_0x9289('0x43')]){throw new db[(_0x9289('0x74'))][(_0x9289('0x75'))](_0x9289('0x76'),0x193);}_0x4e3df1=_0x440d1a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x9289('0x28')](function(_0x18a6c6){if(_0x18a6c6){_0x28997c=_[_0x9289('0x77')](_0x18a6c6,'id');var _0x4357ad;var _0x21ea44=squel['select']();_0x21ea44[_0x9289('0x79')](_0x5cab38[_0x9289('0x7a')]);for(var _0x173cdf=0x0;_0x173cdf<_0x4e3df1['length'];_0x173cdf+=0x1){_0x4357ad=_0x4e3df1[_0x173cdf]['MetricId']?_0x28997c[_0x4e3df1[_0x173cdf][_0x9289('0x7b')]][_0x9289('0x7c')]:_0x4e3df1[_0x173cdf][_0x9289('0x70')];_0x4357ad=_0x4e3df1[_0x173cdf][_0x9289('0x7d')]?_['replace'](_0x3b7666[_0x4e3df1[_0x173cdf][_0x9289('0x7d')]],'%s',_0x4357ad):_0x4357ad;_0x4357ad=_0x4e3df1[_0x173cdf][_0x9289('0x7f')]?_['replace'](_0x2e114b[_0x4e3df1[_0x173cdf][_0x9289('0x7f')]],'%s',_0x4357ad):_0x4357ad;if(_0x4e3df1[_0x173cdf][_0x9289('0x80')]){_0x21ea44[_0x9289('0x6f')](_0x4357ad);}_0x4e3df1[_0x173cdf][_0x9289('0x81')]&&_0x21ea44['order'](_0x4357ad,_0x4e3df1[_0x173cdf][_0x9289('0x81')]==='DESC'?![]:!![]);_0x21ea44[_0x9289('0x70')](_0x4357ad,_0x4e3df1[_0x173cdf][_0x9289('0x82')]||_0x4357ad);}if(_0x5cab38[_0x9289('0x83')]){_0x5cab38[_0x9289('0x83')]=JSON['parse'](_0x5cab38[_0x9289('0x83')]);for(var _0xb0db71=0x0;_0xb0db71<_0x5cab38[_0x9289('0x83')][_0x9289('0x43')];_0xb0db71+=0x1){if(_0x5cab38['joins'][_0xb0db71][_0x9289('0x39')]&&_[_0x9289('0x68')](_0x11f0b8,_0x5cab38[_0x9289('0x83')][_0xb0db71]['type'])&&_0x5cab38[_0x9289('0x83')][_0xb0db71][_0x9289('0x85')]&&_0x5cab38[_0x9289('0x83')][_0xb0db71][_0x9289('0x86')]&&_0x5cab38[_0x9289('0x83')][_0xb0db71][_0x9289('0x87')]){_0x21ea44[_0x5cab38[_0x9289('0x83')][_0xb0db71]['type']](_0x5cab38[_0x9289('0x83')][_0xb0db71][_0x9289('0x86')],null,util[_0x9289('0x7f')](_0x9289('0x88'),_0x5cab38[_0x9289('0x7a')],_0x5cab38[_0x9289('0x83')][_0xb0db71][_0x9289('0x85')],_0x5cab38['joins'][_0xb0db71][_0x9289('0x86')],_0x5cab38[_0x9289('0x83')][_0xb0db71][_0x9289('0x87')]));}}}if(_0x5cab38['conditions']){_0x5cab38['conditions']=JSON['parse'](_0x5cab38[_0x9289('0x89')]);_0x21ea44[_0x9289('0x47')](_0x44769c(_0x5cab38[_0x9289('0x89')][_0x9289('0x6f')]));}_0x19c13d=_0x21ea44[_0x9289('0x8a')]();_0x21ea44['limit'](_0x370f03);_0x21ea44[_0x9289('0x1e')](0x0);logger[_0x9289('0x8b')](_0x9289('0x8c'),_0x21ea44[_0x9289('0x8d')]());return dbH[_0x9289('0x8e')][_0x9289('0x40')](_0x21ea44[_0x9289('0x8d')](),{'type':dbH[_0x9289('0x8e')][_0x9289('0x8f')][_0x9289('0x90')]});}})[_0x9289('0x28')](function(){return{'sql':_0x19c13d['toString']()};})[_0x9289('0x28')](respondWithResult(_0x279a79,null))[_0x9289('0x4d')](handleError(_0x279a79,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6cb5364..ff45e28 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2e1=['moment','bluebird','request-promise','path','../../config/environment','exports','define','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2e1,0xd4));var _0x1b2e=function(_0x3fccbb,_0x473396){_0x3fccbb=_0x3fccbb-0x0;var _0x11df6e=_0xb2e1[_0x3fccbb];return _0x11df6e;};'use strict';var _=require(_0x1b2e('0x0'));var util=require(_0x1b2e('0x1'));var logger=require(_0x1b2e('0x2'))(_0x1b2e('0x3'));var moment=require(_0x1b2e('0x4'));var BPromise=require(_0x1b2e('0x5'));var rp=require(_0x1b2e('0x6'));var fs=require('fs');var path=require(_0x1b2e('0x7'));var rimraf=require('rimraf');var config=require(_0x1b2e('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x1b2e('0x9')]=function(_0x41564f,_0x58e1a5){return _0x41564f[_0x1b2e('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x1b2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c68=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7c68,0x12a));var _0x87c6=function(_0x53dcc7,_0x56e2e1){_0x53dcc7=_0x53dcc7-0x0;var _0x57a3c2=_0x7c68[_0x53dcc7];return _0x57a3c2;};'use strict';var _=require('lodash');var util=require(_0x87c6('0x0'));var logger=require(_0x87c6('0x1'))(_0x87c6('0x2'));var moment=require(_0x87c6('0x3'));var BPromise=require(_0x87c6('0x4'));var rp=require(_0x87c6('0x5'));var fs=require('fs');var path=require(_0x87c6('0x6'));var rimraf=require(_0x87c6('0x7'));var config=require(_0x87c6('0x8'));var attributes=require(_0x87c6('0x9'));module[_0x87c6('0xa')]=function(_0x2ff19b,_0x1e7ebf){return _0x2ff19b['define'](_0x87c6('0xb'),attributes,{'tableName':_0x87c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 24fe7d6..a74a541 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7497=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var moment=require(_0x7749('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7749('0x3'))['db'];var utils=require(_0x7749('0x4'));var logger=require('../../config/logger')(_0x7749('0x5'));var config=require(_0x7749('0x6'));var jayson=require(_0x7749('0x7'));var client=jayson[_0x7749('0x8')][_0x7749('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29f84f,_0x37d7b9,_0x344fa8){return new BPromise(function(_0x38dd37,_0x3efd35){return client[_0x7749('0xa')](_0x29f84f,_0x344fa8)['then'](function(_0xb58b29){logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));logger[_0x7749('0xd')](_0x7749('0xe'),_0x37d7b9,_0x7749('0xc'),JSON[_0x7749('0xf')](_0xb58b29));if(_0xb58b29[_0x7749('0x10')]){if(_0xb58b29[_0x7749('0x10')][_0x7749('0x11')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x37d7b9,_0xb58b29[_0x7749('0x10')]['message']);return _0x3efd35(_0xb58b29['error'][_0x7749('0x12')]);}logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0xb58b29[_0x7749('0x10')][_0x7749('0x12')]);return _0x38dd37(_0xb58b29[_0x7749('0x10')]['message']);}else{logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));_0x38dd37(_0xb58b29['result'][_0x7749('0x12')]);}})[_0x7749('0x13')](function(_0x42c942){logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0x42c942);_0x3efd35(_0x42c942);});});} \ No newline at end of file +var _0xc5cf=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x475053,_0x3c02d2){_0x475053=_0x475053-0x0;var _0x3a091d=_0xc5cf[_0x475053];return _0x3a091d;};'use strict';var _=require(_0xfc5c('0x0'));var util=require(_0xfc5c('0x1'));var moment=require(_0xfc5c('0x2'));var BPromise=require(_0xfc5c('0x3'));var rs=require(_0xfc5c('0x4'));var fs=require('fs');var Redis=require(_0xfc5c('0x5'));var db=require(_0xfc5c('0x6'))['db'];var utils=require(_0xfc5c('0x7'));var logger=require(_0xfc5c('0x8'))('rpc');var config=require(_0xfc5c('0x9'));var jayson=require(_0xfc5c('0xa'));var client=jayson[_0xfc5c('0xb')][_0xfc5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e99e9,_0x5e2429,_0x56a628){return new BPromise(function(_0x5b53e1,_0x102495){return client[_0xfc5c('0xd')](_0x2e99e9,_0x56a628)[_0xfc5c('0xe')](function(_0x43bbc6){logger['info'](_0xfc5c('0xf'),_0x5e2429,_0xfc5c('0x10'));logger[_0xfc5c('0x11')](_0xfc5c('0x12'),_0x5e2429,_0xfc5c('0x10'),JSON[_0xfc5c('0x13')](_0x43bbc6));if(_0x43bbc6[_0xfc5c('0x14')]){if(_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x15')]===0x1f4){logger[_0xfc5c('0x14')](_0xfc5c('0xf'),_0x5e2429,_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x16')]);return _0x102495(_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x16')]);}logger['error'](_0xfc5c('0xf'),_0x5e2429,_0x43bbc6['error'][_0xfc5c('0x16')]);return _0x5b53e1(_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x16')]);}else{logger['info'](_0xfc5c('0xf'),_0x5e2429,'request\x20sent');_0x5b53e1(_0x43bbc6['result']['message']);}})['catch'](function(_0x86f98e){logger['error'](_0xfc5c('0xf'),_0x5e2429,_0x86f98e);_0x102495(_0x86f98e);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8c20348..989c296 100644 --- a/server/api/analyticDefaultReport/index.js +++ b/server/api/analyticDefaultReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xace0=['query','post','update','destroy','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','/:id','show','/:id/preview','get','/:id/run','/:id/query'];(function(_0x3dfbaa,_0x438725){var _0x3708f2=function(_0x272924){while(--_0x272924){_0x3dfbaa['push'](_0x3dfbaa['shift']());}};_0x3708f2(++_0x438725);}(_0xace0,0x1ad));var _0x0ace=function(_0x5b3447,_0x52bef4){_0x5b3447=_0x5b3447-0x0;var _0x2c10bf=_0xace0[_0x5b3447];return _0x2c10bf;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0ace('0x0'));var express=require('express');var router=express[_0x0ace('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x0ace('0x2'));var interaction=require(_0x0ace('0x3'));var config=require(_0x0ace('0x4'));var controller=require(_0x0ace('0x5'));router['get']('/',auth[_0x0ace('0x6')](),controller['index']);router['get'](_0x0ace('0x7'),auth[_0x0ace('0x6')](),controller[_0x0ace('0x8')]);router['get'](_0x0ace('0x9'),auth['isAuthenticated'](),controller['preview']);router[_0x0ace('0xa')](_0x0ace('0xb'),auth[_0x0ace('0x6')](),controller['run']);router[_0x0ace('0xa')](_0x0ace('0xc'),auth[_0x0ace('0x6')](),controller[_0x0ace('0xd')]);router[_0x0ace('0xe')]('/',auth[_0x0ace('0x6')](),controller['create']);router['put'](_0x0ace('0x7'),auth[_0x0ace('0x6')](),controller[_0x0ace('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0ace('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa634=['./analyticDefaultReport.controller','get','isAuthenticated','index','show','preview','/:id/run','run','/:id/query','query','put','/:id','update','delete','destroy','exports','multer','Router','fs-extra','../../config/environment'];(function(_0x3ac05c,_0x280c40){var _0x215a7a=function(_0x14c287){while(--_0x14c287){_0x3ac05c['push'](_0x3ac05c['shift']());}};_0x215a7a(++_0x280c40);}(_0xa634,0x178));var _0x4a63=function(_0x1bcdb,_0x587d38){_0x1bcdb=_0x1bcdb-0x0;var _0x1db6bc=_0xa634[_0x1bcdb];return _0x1db6bc;};'use strict';var multer=require(_0x4a63('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a63('0x1')]();var fs_extra=require(_0x4a63('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4a63('0x3'));var controller=require(_0x4a63('0x4'));router[_0x4a63('0x5')]('/',auth[_0x4a63('0x6')](),controller[_0x4a63('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4a63('0x8')]);router[_0x4a63('0x5')]('/:id/preview',auth[_0x4a63('0x6')](),controller[_0x4a63('0x9')]);router[_0x4a63('0x5')](_0x4a63('0xa'),auth[_0x4a63('0x6')](),controller[_0x4a63('0xb')]);router[_0x4a63('0x5')](_0x4a63('0xc'),auth[_0x4a63('0x6')](),controller[_0x4a63('0xd')]);router['post']('/',auth[_0x4a63('0x6')](),controller['create']);router[_0x4a63('0xe')](_0x4a63('0xf'),auth[_0x4a63('0x6')](),controller[_0x4a63('0x10')]);router[_0x4a63('0x11')](_0x4a63('0xf'),auth['isAuthenticated'](),controller[_0x4a63('0x12')]);module[_0x4a63('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 740df03..163ee02 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f3d=['xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x476a26,_0x43e6e9){var _0xac50d1=function(_0x30e888){while(--_0x30e888){_0x476a26['push'](_0x476a26['shift']());}};_0xac50d1(++_0x43e6e9);}(_0x1f3d,0x1b9));var _0xd1f3=function(_0x551e11,_0x2274ac){_0x551e11=_0x551e11-0x0;var _0x2fe05a=_0x1f3d[_0x551e11];return _0x2fe05a;};'use strict';var Sequelize=require(_0xd1f3('0x0'));var moment=require(_0xd1f3('0x1'));module[_0xd1f3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xd1f3('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xd1f3('0x4')](_0xd1f3('0x5'),_0xd1f3('0x6'),_0xd1f3('0x7')),'allowNull':![],'defaultValue':_0xd1f3('0x5')},'savename':{'type':Sequelize[_0xd1f3('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd1f3('0x8')]},'endDate':{'type':Sequelize[_0xd1f3('0x8')]},'status':{'type':Sequelize[_0xd1f3('0x3')],'defaultValue':_0xd1f3('0x9')},'type':{'type':Sequelize['ENUM'](_0xd1f3('0xa'),_0xd1f3('0xb')),'allowNull':![],'defaultValue':_0xd1f3('0xa')},'reportId':{'type':Sequelize[_0xd1f3('0xc')](0xb)[_0xd1f3('0xd')]},'reportType':{'type':Sequelize[_0xd1f3('0x3')]}}; \ No newline at end of file +var _0x7184=['DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','STRING','csv'];(function(_0x50bace,_0x16f8b7){var _0x25dc5e=function(_0x52340c){while(--_0x52340c){_0x50bace['push'](_0x50bace['shift']());}};_0x25dc5e(++_0x16f8b7);}(_0x7184,0x14b));var _0x4718=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0x7184[_0x4370c7];return _0xce78a9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x4718('0x0')],'allowNull':![]},'basename':{'type':Sequelize[_0x4718('0x0')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x4718('0x1'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x4718('0x1')},'savename':{'type':Sequelize[_0x4718('0x0')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4718('0x2')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0x4718('0x3')},'type':{'type':Sequelize[_0x4718('0x4')](_0x4718('0x5'),_0x4718('0x6')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x4718('0x7')](0xb)[_0x4718('0x8')]},'reportType':{'type':Sequelize[_0x4718('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2c749bd..28a8e4c 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc85d=['contact','agent','interaction','account','AnalyticExtractedReport','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','rawAttributes','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','download','savename','output','existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','stack','name','send','render','body'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0xc85d,0xfe));var _0xdc85=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0xc85d[_0x2c7dc6];return _0x10002b;};'use strict';var emlformat=require(_0xdc85('0x0'));var rimraf=require(_0xdc85('0x1'));var zipdir=require(_0xdc85('0x2'));var jsonpatch=require(_0xdc85('0x3'));var rp=require(_0xdc85('0x4'));var moment=require(_0xdc85('0x5'));var BPromise=require(_0xdc85('0x6'));var Mustache=require('mustache');var util=require(_0xdc85('0x7'));var path=require(_0xdc85('0x8'));var sox=require(_0xdc85('0x9'));var csv=require('to-csv');var ejs=require(_0xdc85('0xa'));var fs=require('fs');var fs_extra=require(_0xdc85('0xb'));var _=require(_0xdc85('0xc'));var squel=require(_0xdc85('0xd'));var crypto=require(_0xdc85('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdc85('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdc85('0x10'));var Papa=require(_0xdc85('0x11'));var Redis=require(_0xdc85('0x12'));var authService=require(_0xdc85('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdc85('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc85('0x15'))(_0xdc85('0x16'));var utils=require('../../config/utils');var config=require(_0xdc85('0x17'));var licenseUtil=require(_0xdc85('0x18'));var db=require(_0xdc85('0x19'))['db'];function respondWithStatusCode(_0x1a3179,_0x1e845b){_0x1e845b=_0x1e845b||0xcc;return function(_0xa9bc1a){if(_0xa9bc1a){return _0x1a3179['sendStatus'](_0x1e845b);}return _0x1a3179[_0xdc85('0x1a')](_0x1e845b)[_0xdc85('0x1b')]();};}function respondWithResult(_0x369e6c,_0x75f600){_0x75f600=_0x75f600||0xc8;return function(_0x434494){if(_0x434494){return _0x369e6c[_0xdc85('0x1a')](_0x75f600)[_0xdc85('0x1c')](_0x434494);}};}function respondWithFilteredResult(_0x5003f5,_0x22d56d){return function(_0x70b796){if(_0x70b796){var _0x4e378e=typeof _0x22d56d[_0xdc85('0x1d')]===_0xdc85('0x1e')&&typeof _0x22d56d[_0xdc85('0x1f')]===_0xdc85('0x1e');var _0x1f5d9b=_0x70b796[_0xdc85('0x20')];var _0x2f6c89=_0x4e378e?0x0:_0x22d56d[_0xdc85('0x1d')];var _0x33dc28=_0x4e378e?_0x70b796[_0xdc85('0x20')]:_0x22d56d[_0xdc85('0x1d')]+_0x22d56d['limit'];var _0x156d16;if(_0x33dc28>=_0x1f5d9b){_0x33dc28=_0x1f5d9b;_0x156d16=0xc8;}else{_0x156d16=0xce;}_0x5003f5[_0xdc85('0x1a')](_0x156d16);return _0x5003f5[_0xdc85('0x21')](_0xdc85('0x22'),_0x2f6c89+'-'+_0x33dc28+'/'+_0x1f5d9b)[_0xdc85('0x1c')](_0x70b796);}return null;};}function patchUpdates(_0x33bd24){return function(_0x46188f){try{jsonpatch[_0xdc85('0x23')](_0x46188f,_0x33bd24,!![]);}catch(_0x3db0be){return BPromise[_0xdc85('0x24')](_0x3db0be);}return _0x46188f[_0xdc85('0x25')]();};}function saveUpdates(_0x57d673,_0x2c71b6){return function(_0xec15db){if(_0xec15db){return _0xec15db['update'](_0x57d673)[_0xdc85('0x26')](function(_0x5be339){return _0x5be339;});}return null;};}function removeEntity(_0x430e28,_0x3086d0){return function(_0x3235cd){if(_0x3235cd){return _0x3235cd[_0xdc85('0x27')]()[_0xdc85('0x26')](function(){var _0x6f9f29=_0x3235cd[_0xdc85('0x28')]({'plain':!![]});var _0x3f7140=_0xdc85('0x29');return db[_0xdc85('0x2a')][_0xdc85('0x27')]({'where':{'type':_0x3f7140,'resourceId':_0x6f9f29['id']}})['then'](function(){return _0x3235cd;});})[_0xdc85('0x26')](function(){_0x430e28[_0xdc85('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x622cb2,_0x19ca2d){return function(_0x20be93){if(!_0x20be93){_0x622cb2[_0xdc85('0x2b')](0x194);}return _0x20be93;};}function handleError(_0x42bc1f,_0x4e68e7){_0x4e68e7=_0x4e68e7||0x1f4;return function(_0x296369){logger['error'](_0x296369[_0xdc85('0x2c')]);if(_0x296369[_0xdc85('0x2d')]){delete _0x296369[_0xdc85('0x2d')];}_0x42bc1f[_0xdc85('0x1a')](_0x4e68e7)[_0xdc85('0x2e')](_0x296369);};}function getMustacheRender(_0x26c941,_0x36b8ce){return Mustache[_0xdc85('0x2f')](_0x26c941,_['merge'](_0x36b8ce[_0xdc85('0x30')],{'contact':_0x36b8ce[_0xdc85('0x31')],'message':_0x36b8ce['message'],'agent':_0x36b8ce[_0xdc85('0x32')],'interaction':_0x36b8ce[_0xdc85('0x33')],'account':_0x36b8ce[_0xdc85('0x34')]}))||'';}exports['index']=function(_0x250e0c,_0x13fe47){var _0x2c3522={},_0x18c60a={},_0x208f2f={'count':0x0,'rows':[]};var _0x192d3e=_['map'](db[_0xdc85('0x35')]['rawAttributes'],function(_0x263f4c){return{'name':_0x263f4c['fieldName'],'type':_0x263f4c[_0xdc85('0x36')][_0xdc85('0x37')]};});_0x18c60a[_0xdc85('0x38')]=_[_0xdc85('0x39')](_0x192d3e,_0xdc85('0x2d'));_0x18c60a[_0xdc85('0x3a')]=_['keys'](_0x250e0c[_0xdc85('0x3a')]);_0x18c60a[_0xdc85('0x3b')]=_[_0xdc85('0x3c')](_0x18c60a[_0xdc85('0x38')],_0x18c60a[_0xdc85('0x3a')]);_0x2c3522[_0xdc85('0x3d')]=_['intersection'](_0x18c60a[_0xdc85('0x38')],qs[_0xdc85('0x3e')](_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x3e')]));_0x2c3522['attributes']=_0x2c3522[_0xdc85('0x3d')][_0xdc85('0x3f')]?_0x2c3522['attributes']:_0x18c60a[_0xdc85('0x38')];if(!_0x250e0c[_0xdc85('0x3a')]['hasOwnProperty'](_0xdc85('0x40'))){_0x2c3522[_0xdc85('0x1f')]=qs[_0xdc85('0x1f')](_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x1f')]);_0x2c3522[_0xdc85('0x1d')]=qs[_0xdc85('0x1d')](_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x1d')]);}_0x2c3522[_0xdc85('0x41')]=qs[_0xdc85('0x42')](_0x250e0c['query']['sort']);_0x2c3522[_0xdc85('0x43')]=qs['filters'](_[_0xdc85('0x44')](_0x250e0c['query'],_0x18c60a[_0xdc85('0x3b')]),_0x192d3e);if(_0x250e0c[_0xdc85('0x3a')][_0xdc85('0x45')]){_0x2c3522['where']=_[_0xdc85('0x46')](_0x2c3522[_0xdc85('0x43')],{'$or':_[_0xdc85('0x39')](_0x192d3e,function(_0x4f100c){if(_0x4f100c['type']!=='VIRTUAL'){var _0x51caf7={};_0x51caf7[_0x4f100c[_0xdc85('0x2d')]]={'$like':'%'+_0x250e0c['query']['filter']+'%'};return _0x51caf7;}})});}_0x2c3522=_[_0xdc85('0x46')]({},_0x2c3522,_0x250e0c[_0xdc85('0x47')]);var _0x2a4b34={'where':_0x2c3522[_0xdc85('0x43')]};return db[_0xdc85('0x35')][_0xdc85('0x20')](_0x2a4b34)[_0xdc85('0x26')](function(_0x84bd00){_0x208f2f[_0xdc85('0x20')]=_0x84bd00;if(_0x250e0c['query']['includeAll']){_0x2c3522[_0xdc85('0x48')]=[{'all':!![]}];}return db[_0xdc85('0x35')][_0xdc85('0x49')](_0x2c3522);})[_0xdc85('0x26')](function(_0x5d5084){_0x208f2f['rows']=_0x5d5084;return _0x208f2f;})['then'](respondWithFilteredResult(_0x13fe47,_0x2c3522))[_0xdc85('0x4a')](handleError(_0x13fe47,null));};exports[_0xdc85('0x4b')]=function(_0x294a32,_0xbafac4){var _0x474d3b={'raw':!![],'where':{'id':_0x294a32[_0xdc85('0x4c')]['id']}},_0xf39c80={};_0xf39c80[_0xdc85('0x38')]=_['keys'](db[_0xdc85('0x35')][_0xdc85('0x4d')]);_0xf39c80[_0xdc85('0x3a')]=_[_0xdc85('0x4e')](_0x294a32[_0xdc85('0x3a')]);_0xf39c80[_0xdc85('0x3b')]=_['intersection'](_0xf39c80[_0xdc85('0x38')],_0xf39c80['query']);_0x474d3b[_0xdc85('0x3d')]=_[_0xdc85('0x3c')](_0xf39c80[_0xdc85('0x38')],qs[_0xdc85('0x3e')](_0x294a32[_0xdc85('0x3a')][_0xdc85('0x3e')]));_0x474d3b[_0xdc85('0x3d')]=_0x474d3b[_0xdc85('0x3d')][_0xdc85('0x3f')]?_0x474d3b['attributes']:_0xf39c80[_0xdc85('0x38')];if(_0x294a32[_0xdc85('0x3a')][_0xdc85('0x4f')]){_0x474d3b[_0xdc85('0x48')]=[{'all':!![]}];}_0x474d3b=_[_0xdc85('0x46')]({},_0x474d3b,_0x294a32[_0xdc85('0x47')]);return db[_0xdc85('0x35')][_0xdc85('0x50')](_0x474d3b)[_0xdc85('0x26')](handleEntityNotFound(_0xbafac4,null))[_0xdc85('0x26')](respondWithResult(_0xbafac4,null))['catch'](handleError(_0xbafac4,null));};exports[_0xdc85('0x51')]=function(_0x34d754,_0x4f2fcd){return db[_0xdc85('0x35')][_0xdc85('0x51')](_0x34d754[_0xdc85('0x30')],{})[_0xdc85('0x26')](function(_0x1f293f){var _0x148b7d=_0x34d754[_0xdc85('0x52')]['get']({'plain':!![]});if(!_0x148b7d)throw new Error(_0xdc85('0x53'));if(_0x148b7d[_0xdc85('0x54')]===_0xdc85('0x52')){var _0x1acc56=_0x1f293f['get']({'plain':!![]});var _0x5da1cc=_0xdc85('0x29');return db[_0xdc85('0x55')]['find']({'where':{'name':_0x5da1cc,'userProfileId':_0x148b7d[_0xdc85('0x56')]},'raw':!![]})[_0xdc85('0x26')](function(_0xcf58b){if(_0xcf58b&&_0xcf58b[_0xdc85('0x57')]===0x0){return db[_0xdc85('0x2a')][_0xdc85('0x51')]({'name':_0x1acc56[_0xdc85('0x2d')],'resourceId':_0x1acc56['id'],'type':_0xcf58b['name'],'sectionId':_0xcf58b['id']},{})[_0xdc85('0x26')](function(){return _0x1f293f;});}else{return _0x1f293f;}})[_0xdc85('0x4a')](function(_0xee747a){logger[_0xdc85('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xee747a);throw _0xee747a;});}return _0x1f293f;})[_0xdc85('0x26')](respondWithResult(_0x4f2fcd,0xc9))[_0xdc85('0x4a')](handleError(_0x4f2fcd,null));};exports['update']=function(_0x1ccb1c,_0x5b9b64){if(_0x1ccb1c[_0xdc85('0x30')]['id']){delete _0x1ccb1c[_0xdc85('0x30')]['id'];}return db[_0xdc85('0x35')][_0xdc85('0x50')]({'where':{'id':_0x1ccb1c[_0xdc85('0x4c')]['id']}})[_0xdc85('0x26')](handleEntityNotFound(_0x5b9b64,null))[_0xdc85('0x26')](saveUpdates(_0x1ccb1c[_0xdc85('0x30')],null))[_0xdc85('0x26')](respondWithResult(_0x5b9b64,null))[_0xdc85('0x4a')](handleError(_0x5b9b64,null));};exports['destroy']=function(_0x395f54,_0x5bb7a7){return db[_0xdc85('0x35')][_0xdc85('0x50')]({'where':{'id':_0x395f54[_0xdc85('0x4c')]['id']}})[_0xdc85('0x26')](handleEntityNotFound(_0x5bb7a7,null))[_0xdc85('0x26')](removeEntity(_0x5bb7a7,null))[_0xdc85('0x4a')](handleError(_0x5bb7a7,null));};exports[_0xdc85('0x59')]=function(_0x2708ef,_0x1e27b4,_0x235a46){return db[_0xdc85('0x35')][_0xdc85('0x50')]({'where':{'id':_0x2708ef['params']['id']},'attributes':[_0xdc85('0x2d'),'basename',_0xdc85('0x5a'),_0xdc85('0x5b')],'raw':!![]})[_0xdc85('0x26')](handleEntityNotFound(_0x1e27b4,null))[_0xdc85('0x26')](function(_0x2d359a){if(_0x2d359a){if(!fs[_0xdc85('0x5c')](path[_0xdc85('0x5d')](config[_0xdc85('0x5e')],_0xdc85('0x5f'),_0x2d359a[_0xdc85('0x5a')]))){throw new db['Sequelize']['ValidationError'](_0xdc85('0x60'));}if(_0x2708ef['query'][_0xdc85('0x61')]){return _0x1e27b4[_0xdc85('0x2b')](0xc8);}return _0x1e27b4[_0xdc85('0x59')](path[_0xdc85('0x5d')](config[_0xdc85('0x5e')],_0xdc85('0x5f'),_0x2d359a['savename']),util['format'](_0xdc85('0x62'),_0x2d359a[_0xdc85('0x63')]||_0x2d359a[_0xdc85('0x2d')],_0x2d359a[_0xdc85('0x5b')][_0xdc85('0x64')]()));}})[_0xdc85('0x4a')](handleError(_0x1e27b4,null));}; \ No newline at end of file +var _0x4f07=['nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','output','existsSync','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','server/files/reports','%s.%s','toLowerCase','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','ExtractedReports','UserProfileResource','end','error','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x340a4d,_0x55f8c5){var _0x1e132d=function(_0x4481b5){while(--_0x4481b5){_0x340a4d['push'](_0x340a4d['shift']());}};_0x1e132d(++_0x55f8c5);}(_0x4f07,0xe9));var _0x74f0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4f07[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x74f0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74f0('0x1'));var moment=require('moment');var BPromise=require(_0x74f0('0x2'));var Mustache=require(_0x74f0('0x3'));var util=require('util');var path=require(_0x74f0('0x4'));var sox=require(_0x74f0('0x5'));var csv=require('to-csv');var ejs=require(_0x74f0('0x6'));var fs=require('fs');var fs_extra=require(_0x74f0('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74f0('0x8'));var deskjs=require(_0x74f0('0x9'));var toCsv=require(_0x74f0('0xa'));var querystring=require(_0x74f0('0xb'));var Papa=require(_0x74f0('0xc'));var Redis=require(_0x74f0('0xd'));var authService=require(_0x74f0('0xe'));var qs=require(_0x74f0('0xf'));var as=require(_0x74f0('0x10'));var hardwareService=require(_0x74f0('0x11'));var logger=require(_0x74f0('0x12'))(_0x74f0('0x13'));var utils=require(_0x74f0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x74f0('0x15'));var db=require(_0x74f0('0x16'))['db'];function respondWithStatusCode(_0x411155,_0x11fe1e){_0x11fe1e=_0x11fe1e||0xcc;return function(_0x2ab823){if(_0x2ab823){return _0x411155[_0x74f0('0x17')](_0x11fe1e);}return _0x411155[_0x74f0('0x18')](_0x11fe1e)['end']();};}function respondWithResult(_0x240d1e,_0x11af06){_0x11af06=_0x11af06||0xc8;return function(_0x14908b){if(_0x14908b){return _0x240d1e[_0x74f0('0x18')](_0x11af06)[_0x74f0('0x19')](_0x14908b);}};}function respondWithFilteredResult(_0xf81d44,_0x43dfd1){return function(_0x17f7e4){if(_0x17f7e4){var _0x55c6d6=typeof _0x43dfd1[_0x74f0('0x1a')]===_0x74f0('0x1b')&&typeof _0x43dfd1[_0x74f0('0x1c')]===_0x74f0('0x1b');var _0xaf859f=_0x17f7e4[_0x74f0('0x1d')];var _0x392e16=_0x55c6d6?0x0:_0x43dfd1['offset'];var _0x345d61=_0x55c6d6?_0x17f7e4[_0x74f0('0x1d')]:_0x43dfd1[_0x74f0('0x1a')]+_0x43dfd1[_0x74f0('0x1c')];var _0x5bd03a;if(_0x345d61>=_0xaf859f){_0x345d61=_0xaf859f;_0x5bd03a=0xc8;}else{_0x5bd03a=0xce;}_0xf81d44[_0x74f0('0x18')](_0x5bd03a);return _0xf81d44[_0x74f0('0x1e')](_0x74f0('0x1f'),_0x392e16+'-'+_0x345d61+'/'+_0xaf859f)[_0x74f0('0x19')](_0x17f7e4);}return null;};}function patchUpdates(_0x3b2ebb){return function(_0x4b7d8c){try{jsonpatch[_0x74f0('0x20')](_0x4b7d8c,_0x3b2ebb,!![]);}catch(_0x3893a1){return BPromise['reject'](_0x3893a1);}return _0x4b7d8c[_0x74f0('0x21')]();};}function saveUpdates(_0x5e6f4c,_0x1fe9bb){return function(_0x150484){if(_0x150484){return _0x150484[_0x74f0('0x22')](_0x5e6f4c)['then'](function(_0x4ef031){return _0x4ef031;});}return null;};}function removeEntity(_0x395bf0,_0x456cf8){return function(_0x229496){if(_0x229496){return _0x229496[_0x74f0('0x23')]()[_0x74f0('0x24')](function(){var _0xd961a2=_0x229496[_0x74f0('0x25')]({'plain':!![]});var _0x6be7d3=_0x74f0('0x26');return db[_0x74f0('0x27')][_0x74f0('0x23')]({'where':{'type':_0x6be7d3,'resourceId':_0xd961a2['id']}})[_0x74f0('0x24')](function(){return _0x229496;});})['then'](function(){_0x395bf0['status'](0xcc)[_0x74f0('0x28')]();});}};}function handleEntityNotFound(_0x73cd13,_0x40e71c){return function(_0x1669ee){if(!_0x1669ee){_0x73cd13[_0x74f0('0x17')](0x194);}return _0x1669ee;};}function handleError(_0x50bcc0,_0x2ce7b5){_0x2ce7b5=_0x2ce7b5||0x1f4;return function(_0x1d6c23){logger[_0x74f0('0x29')](_0x1d6c23['stack']);if(_0x1d6c23[_0x74f0('0x2a')]){delete _0x1d6c23[_0x74f0('0x2a')];}_0x50bcc0[_0x74f0('0x18')](_0x2ce7b5)[_0x74f0('0x2b')](_0x1d6c23);};}function getMustacheRender(_0x14fa6a,_0x514645){return Mustache[_0x74f0('0x2c')](_0x14fa6a,_[_0x74f0('0x2d')](_0x514645[_0x74f0('0x2e')],{'contact':_0x514645[_0x74f0('0x2f')],'message':_0x514645[_0x74f0('0x30')],'agent':_0x514645[_0x74f0('0x31')],'interaction':_0x514645[_0x74f0('0x32')],'account':_0x514645[_0x74f0('0x33')]}))||'';}exports[_0x74f0('0x34')]=function(_0x5ea544,_0x2b6ba5){var _0x392546={},_0x2bbaf4={},_0x4b7dab={'count':0x0,'rows':[]};var _0x14f2e0=_[_0x74f0('0x35')](db[_0x74f0('0x36')][_0x74f0('0x37')],function(_0x405088){return{'name':_0x405088['fieldName'],'type':_0x405088[_0x74f0('0x38')][_0x74f0('0x39')]};});_0x2bbaf4[_0x74f0('0x3a')]=_[_0x74f0('0x35')](_0x14f2e0,_0x74f0('0x2a'));_0x2bbaf4[_0x74f0('0x3b')]=_[_0x74f0('0x3c')](_0x5ea544['query']);_0x2bbaf4[_0x74f0('0x3d')]=_[_0x74f0('0x3e')](_0x2bbaf4['model'],_0x2bbaf4[_0x74f0('0x3b')]);_0x392546[_0x74f0('0x3f')]=_[_0x74f0('0x3e')](_0x2bbaf4['model'],qs[_0x74f0('0x40')](_0x5ea544[_0x74f0('0x3b')]['fields']));_0x392546['attributes']=_0x392546[_0x74f0('0x3f')][_0x74f0('0x41')]?_0x392546[_0x74f0('0x3f')]:_0x2bbaf4[_0x74f0('0x3a')];if(!_0x5ea544[_0x74f0('0x3b')][_0x74f0('0x42')](_0x74f0('0x43'))){_0x392546[_0x74f0('0x1c')]=qs['limit'](_0x5ea544['query'][_0x74f0('0x1c')]);_0x392546['offset']=qs[_0x74f0('0x1a')](_0x5ea544[_0x74f0('0x3b')][_0x74f0('0x1a')]);}_0x392546['order']=qs[_0x74f0('0x44')](_0x5ea544[_0x74f0('0x3b')][_0x74f0('0x44')]);_0x392546[_0x74f0('0x45')]=qs[_0x74f0('0x3d')](_[_0x74f0('0x46')](_0x5ea544[_0x74f0('0x3b')],_0x2bbaf4['filters']),_0x14f2e0);if(_0x5ea544[_0x74f0('0x3b')][_0x74f0('0x47')]){_0x392546['where']=_['merge'](_0x392546[_0x74f0('0x45')],{'$or':_[_0x74f0('0x35')](_0x14f2e0,function(_0x47c2d9){if(_0x47c2d9[_0x74f0('0x38')]!==_0x74f0('0x48')){var _0x397702={};_0x397702[_0x47c2d9[_0x74f0('0x2a')]]={'$like':'%'+_0x5ea544['query']['filter']+'%'};return _0x397702;}})});}_0x392546=_[_0x74f0('0x2d')]({},_0x392546,_0x5ea544[_0x74f0('0x49')]);var _0x47abf5={'where':_0x392546[_0x74f0('0x45')]};return db['AnalyticExtractedReport']['count'](_0x47abf5)[_0x74f0('0x24')](function(_0x887715){_0x4b7dab['count']=_0x887715;if(_0x5ea544[_0x74f0('0x3b')][_0x74f0('0x4a')]){_0x392546[_0x74f0('0x4b')]=[{'all':!![]}];}return db[_0x74f0('0x36')][_0x74f0('0x4c')](_0x392546);})[_0x74f0('0x24')](function(_0x3ce613){_0x4b7dab[_0x74f0('0x4d')]=_0x3ce613;return _0x4b7dab;})[_0x74f0('0x24')](respondWithFilteredResult(_0x2b6ba5,_0x392546))[_0x74f0('0x4e')](handleError(_0x2b6ba5,null));};exports['show']=function(_0x34efd1,_0x2821ae){var _0x36bdd3={'raw':!![],'where':{'id':_0x34efd1['params']['id']}},_0x5dd6ea={};_0x5dd6ea[_0x74f0('0x3a')]=_[_0x74f0('0x3c')](db[_0x74f0('0x36')][_0x74f0('0x37')]);_0x5dd6ea['query']=_[_0x74f0('0x3c')](_0x34efd1[_0x74f0('0x3b')]);_0x5dd6ea[_0x74f0('0x3d')]=_['intersection'](_0x5dd6ea[_0x74f0('0x3a')],_0x5dd6ea[_0x74f0('0x3b')]);_0x36bdd3[_0x74f0('0x3f')]=_['intersection'](_0x5dd6ea[_0x74f0('0x3a')],qs['fields'](_0x34efd1['query']['fields']));_0x36bdd3['attributes']=_0x36bdd3[_0x74f0('0x3f')][_0x74f0('0x41')]?_0x36bdd3[_0x74f0('0x3f')]:_0x5dd6ea['model'];if(_0x34efd1[_0x74f0('0x3b')][_0x74f0('0x4a')]){_0x36bdd3[_0x74f0('0x4b')]=[{'all':!![]}];}_0x36bdd3=_['merge']({},_0x36bdd3,_0x34efd1[_0x74f0('0x49')]);return db[_0x74f0('0x36')][_0x74f0('0x4f')](_0x36bdd3)['then'](handleEntityNotFound(_0x2821ae,null))[_0x74f0('0x24')](respondWithResult(_0x2821ae,null))[_0x74f0('0x4e')](handleError(_0x2821ae,null));};exports[_0x74f0('0x50')]=function(_0x219ba9,_0x531d03){return db['AnalyticExtractedReport'][_0x74f0('0x50')](_0x219ba9[_0x74f0('0x2e')],{})['then'](function(_0x517db4){var _0x4e25d1=_0x219ba9[_0x74f0('0x51')][_0x74f0('0x25')]({'plain':!![]});if(!_0x4e25d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e25d1[_0x74f0('0x52')]===_0x74f0('0x51')){var _0x52d2af=_0x517db4[_0x74f0('0x25')]({'plain':!![]});var _0x4b3d44=_0x74f0('0x26');return db[_0x74f0('0x53')]['find']({'where':{'name':_0x4b3d44,'userProfileId':_0x4e25d1['userProfileId']},'raw':!![]})['then'](function(_0x40e6f9){if(_0x40e6f9&&_0x40e6f9[_0x74f0('0x54')]===0x0){return db['UserProfileResource'][_0x74f0('0x50')]({'name':_0x52d2af[_0x74f0('0x2a')],'resourceId':_0x52d2af['id'],'type':_0x40e6f9[_0x74f0('0x2a')],'sectionId':_0x40e6f9['id']},{})[_0x74f0('0x24')](function(){return _0x517db4;});}else{return _0x517db4;}})[_0x74f0('0x4e')](function(_0x9cfb71){logger['error'](_0x74f0('0x55'),_0x9cfb71);throw _0x9cfb71;});}return _0x517db4;})[_0x74f0('0x24')](respondWithResult(_0x531d03,0xc9))['catch'](handleError(_0x531d03,null));};exports[_0x74f0('0x22')]=function(_0x1934ca,_0x42ec46){if(_0x1934ca[_0x74f0('0x2e')]['id']){delete _0x1934ca[_0x74f0('0x2e')]['id'];}return db[_0x74f0('0x36')][_0x74f0('0x4f')]({'where':{'id':_0x1934ca['params']['id']}})['then'](handleEntityNotFound(_0x42ec46,null))[_0x74f0('0x24')](saveUpdates(_0x1934ca['body'],null))[_0x74f0('0x24')](respondWithResult(_0x42ec46,null))[_0x74f0('0x4e')](handleError(_0x42ec46,null));};exports[_0x74f0('0x23')]=function(_0x535d6d,_0x43473e){return db[_0x74f0('0x36')][_0x74f0('0x4f')]({'where':{'id':_0x535d6d[_0x74f0('0x56')]['id']}})[_0x74f0('0x24')](handleEntityNotFound(_0x43473e,null))[_0x74f0('0x24')](removeEntity(_0x43473e,null))[_0x74f0('0x4e')](handleError(_0x43473e,null));};exports[_0x74f0('0x57')]=function(_0x1fd0a5,_0x3fa4ae,_0x3fa8eb){return db[_0x74f0('0x36')]['find']({'where':{'id':_0x1fd0a5[_0x74f0('0x56')]['id']},'attributes':[_0x74f0('0x2a'),_0x74f0('0x58'),'savename',_0x74f0('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x3fa4ae,null))['then'](function(_0xb640be){if(_0xb640be){if(!fs[_0x74f0('0x5a')](path[_0x74f0('0x5b')](config['root'],'server/files/reports',_0xb640be['savename']))){throw new db[(_0x74f0('0x5c'))][(_0x74f0('0x5d'))](_0x74f0('0x5e'));}if(_0x1fd0a5[_0x74f0('0x3b')][_0x74f0('0x5f')]){return _0x3fa4ae['sendStatus'](0xc8);}return _0x3fa4ae[_0x74f0('0x57')](path[_0x74f0('0x5b')](config[_0x74f0('0x60')],_0x74f0('0x61'),_0xb640be['savename']),util['format'](_0x74f0('0x62'),_0xb640be[_0x74f0('0x58')]||_0xb640be[_0x74f0('0x2a')],_0xb640be['output'][_0x74f0('0x63')]()));}})[_0x74f0('0x4e')](handleError(_0x3fa4ae,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index aebf434..026137f 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.model.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92c7=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','request-promise'];(function(_0x50417f,_0x35432e){var _0x4d2328=function(_0x228001){while(--_0x228001){_0x50417f['push'](_0x50417f['shift']());}};_0x4d2328(++_0x35432e);}(_0x92c7,0x10a));var _0x792c=function(_0x548121,_0xa3e5bb){_0x548121=_0x548121-0x0;var _0x201eba=_0x92c7[_0x548121];return _0x201eba;};'use strict';var _=require(_0x792c('0x0'));var util=require('util');var logger=require(_0x792c('0x1'))(_0x792c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x792c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x792c('0x4'));var config=require(_0x792c('0x5'));var attributes=require(_0x792c('0x6'));module[_0x792c('0x7')]=function(_0x5723b4,_0x2b484f){return _0x5723b4['define'](_0x792c('0x8'),attributes,{'tableName':_0x792c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0375=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','moment','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x4a8ede,_0x42bba8){var _0x1dd85b=function(_0x48fe1a){while(--_0x48fe1a){_0x4a8ede['push'](_0x4a8ede['shift']());}};_0x1dd85b(++_0x42bba8);}(_0x0375,0x72));var _0x5037=function(_0x4d000f,_0x1a88cc){_0x4d000f=_0x4d000f-0x0;var _0x1fc201=_0x0375[_0x4d000f];return _0x1fc201;};'use strict';var _=require(_0x5037('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5037('0x1'));var moment=require(_0x5037('0x2'));var BPromise=require('bluebird');var rp=require(_0x5037('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5037('0x4'));var config=require(_0x5037('0x5'));var attributes=require(_0x5037('0x6'));module[_0x5037('0x7')]=function(_0xb94afb,_0x45f6bb){return _0xb94afb[_0x5037('0x8')](_0x5037('0x9'),attributes,{'tableName':_0x5037('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 29a28e5..88714db 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9330=['request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x9330,0x1d8));var _0x0933=function(_0x345c73,_0x27c179){_0x345c73=_0x345c73-0x0;var _0x4b757f=_0x9330[_0x345c73];return _0x4b757f;};'use strict';var _=require(_0x0933('0x0'));var util=require(_0x0933('0x1'));var moment=require(_0x0933('0x2'));var BPromise=require(_0x0933('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0933('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0933('0x5'))(_0x0933('0x6'));var config=require(_0x0933('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba7b7,_0x3e339c,_0x465b74){return new BPromise(function(_0x3f5fb9,_0x4bc2af){return client[_0x0933('0x8')](_0x1ba7b7,_0x465b74)['then'](function(_0x2520f8){logger[_0x0933('0x9')](_0x0933('0xa'),_0x3e339c,_0x0933('0xb'));logger[_0x0933('0xc')](_0x0933('0xd'),_0x3e339c,_0x0933('0xb'),JSON[_0x0933('0xe')](_0x2520f8));if(_0x2520f8[_0x0933('0xf')]){if(_0x2520f8[_0x0933('0xf')][_0x0933('0x10')]===0x1f4){logger[_0x0933('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e339c,_0x2520f8[_0x0933('0xf')][_0x0933('0x11')]);return _0x4bc2af(_0x2520f8[_0x0933('0xf')][_0x0933('0x11')]);}logger[_0x0933('0xf')](_0x0933('0xa'),_0x3e339c,_0x2520f8['error'][_0x0933('0x11')]);return _0x3f5fb9(_0x2520f8[_0x0933('0xf')][_0x0933('0x11')]);}else{logger[_0x0933('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3e339c,_0x0933('0xb'));_0x3f5fb9(_0x2520f8[_0x0933('0x12')]['message']);}})[_0x0933('0x13')](function(_0x3800f5){logger[_0x0933('0xf')](_0x0933('0xa'),_0x3e339c,_0x3800f5);_0x4bc2af(_0x3800f5);});});} \ No newline at end of file +var _0x6847=['request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x438578,_0xeccb24){var _0x55f90b=function(_0x2ef1fd){while(--_0x2ef1fd){_0x438578['push'](_0x438578['shift']());}};_0x55f90b(++_0xeccb24);}(_0x6847,0x151));var _0x7684=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x6847[_0x13ac10];return _0x28eda2;};'use strict';var _=require(_0x7684('0x0'));var util=require(_0x7684('0x1'));var moment=require(_0x7684('0x2'));var BPromise=require(_0x7684('0x3'));var rs=require(_0x7684('0x4'));var fs=require('fs');var Redis=require(_0x7684('0x5'));var db=require(_0x7684('0x6'))['db'];var utils=require(_0x7684('0x7'));var logger=require('../../config/logger')(_0x7684('0x8'));var config=require(_0x7684('0x9'));var jayson=require(_0x7684('0xa'));var client=jayson[_0x7684('0xb')][_0x7684('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b0f7d,_0x4827f8,_0x1e630c){return new BPromise(function(_0x4d351a,_0x195657){return client[_0x7684('0xd')](_0x2b0f7d,_0x1e630c)['then'](function(_0x57f4f4){logger[_0x7684('0xe')](_0x7684('0xf'),_0x4827f8,_0x7684('0x10'));logger[_0x7684('0x11')](_0x7684('0x12'),_0x4827f8,_0x7684('0x10'),JSON[_0x7684('0x13')](_0x57f4f4));if(_0x57f4f4['error']){if(_0x57f4f4[_0x7684('0x14')][_0x7684('0x15')]===0x1f4){logger[_0x7684('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4827f8,_0x57f4f4[_0x7684('0x14')]['message']);return _0x195657(_0x57f4f4['error']['message']);}logger[_0x7684('0x14')](_0x7684('0xf'),_0x4827f8,_0x57f4f4['error'][_0x7684('0x16')]);return _0x4d351a(_0x57f4f4[_0x7684('0x14')][_0x7684('0x16')]);}else{logger[_0x7684('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4827f8,_0x7684('0x10'));_0x4d351a(_0x57f4f4[_0x7684('0x17')][_0x7684('0x16')]);}})[_0x7684('0x18')](function(_0x543d51){logger['error'](_0x7684('0xf'),_0x4827f8,_0x543d51);_0x195657(_0x543d51);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index bcfdce8..f2e20e5 100644 --- a/server/api/analyticExtractedReport/index.js +++ b/server/api/analyticExtractedReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5221=['/:id/download','download','post','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','show'];(function(_0x1621dd,_0x172229){var _0x3b0046=function(_0x53ab32){while(--_0x53ab32){_0x1621dd['push'](_0x1621dd['shift']());}};_0x3b0046(++_0x172229);}(_0x5221,0x8d));var _0x1522=function(_0x5d4786,_0x4f4db4){_0x5d4786=_0x5d4786-0x0;var _0x333bc0=_0x5221[_0x5d4786];return _0x333bc0;};'use strict';var multer=require(_0x1522('0x0'));var util=require(_0x1522('0x1'));var path=require('path');var timeout=require(_0x1522('0x2'));var express=require('express');var router=express[_0x1522('0x3')]();var fs_extra=require(_0x1522('0x4'));var auth=require(_0x1522('0x5'));var interaction=require(_0x1522('0x6'));var config=require(_0x1522('0x7'));var controller=require(_0x1522('0x8'));router['get']('/',auth[_0x1522('0x9')](),controller[_0x1522('0xa')]);router[_0x1522('0xb')]('/:id',auth[_0x1522('0x9')](),controller[_0x1522('0xc')]);router[_0x1522('0xb')](_0x1522('0xd'),auth[_0x1522('0x9')](),controller[_0x1522('0xe')]);router[_0x1522('0xf')]('/',auth[_0x1522('0x9')](),controller[_0x1522('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1522('0x11')]);router[_0x1522('0x12')](_0x1522('0x13'),auth['isAuthenticated'](),controller[_0x1522('0x14')]);module[_0x1522('0x15')]=router; \ No newline at end of file +var _0x6f97=['./analyticExtractedReport.controller','get','isAuthenticated','download','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f97,0x88));var _0x76f9=function(_0x38d3bd,_0x49f837){_0x38d3bd=_0x38d3bd-0x0;var _0x19022c=_0x6f97[_0x38d3bd];return _0x19022c;};'use strict';var multer=require(_0x76f9('0x0'));var util=require('util');var path=require(_0x76f9('0x1'));var timeout=require(_0x76f9('0x2'));var express=require('express');var router=express[_0x76f9('0x3')]();var fs_extra=require(_0x76f9('0x4'));var auth=require(_0x76f9('0x5'));var interaction=require(_0x76f9('0x6'));var config=require(_0x76f9('0x7'));var controller=require(_0x76f9('0x8'));router[_0x76f9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x76f9('0x9')]('/:id',auth[_0x76f9('0xa')](),controller['show']);router[_0x76f9('0x9')]('/:id/download',auth[_0x76f9('0xa')](),controller[_0x76f9('0xb')]);router['post']('/',auth[_0x76f9('0xa')](),controller['create']);router[_0x76f9('0xc')](_0x76f9('0xd'),auth[_0x76f9('0xa')](),controller[_0x76f9('0xe')]);router[_0x76f9('0xf')](_0x76f9('0xd'),auth[_0x76f9('0xa')](),controller[_0x76f9('0x10')]);module[_0x76f9('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index d8ec73b..e4b76d7 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x4ae2fb,_0x1c1c67){var _0x4f5268=function(_0x11236b){while(--_0x11236b){_0x4ae2fb['push'](_0x4ae2fb['shift']());}};_0x4f5268(++_0x1c1c67);}(_0x814b,0x1a2));var _0xb814=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x814b[_0x31a37b];return _0x49ae16;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x34c1ea,_0x5e3a54){var _0x3dcca5=function(_0x375eb3){while(--_0x375eb3){_0x34c1ea['push'](_0x34c1ea['shift']());}};_0x3dcca5(++_0x5e3a54);}(_0x326f,0xd1));var _0xf326=function(_0x57cd9b,_0x23ee15){_0x57cd9b=_0x57cd9b-0x0;var _0x26f133=_0x326f[_0x57cd9b];return _0x26f133;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xf326('0x1')]},'function':{'type':Sequelize[_0xf326('0x1')]},'format':{'type':Sequelize[_0xf326('0x1')]},'groupBy':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xf326('0x1')]},'custom':{'type':Sequelize[_0xf326('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 89b96bd..edb97df 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.controller.js +++ b/server/api/analyticFieldReport/analyticFieldReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x880f=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','body','contact','message','interaction','account','AnalyticFieldReport','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','rows','show','rawAttributes','find','create','bulkCreate','catch','params','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x880f,0x9b));var _0xf880=function(_0x1e0e72,_0x3cc752){_0x1e0e72=_0x1e0e72-0x0;var _0x4feba4=_0x880f[_0x1e0e72];return _0x4feba4;};'use strict';var emlformat=require(_0xf880('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf880('0x1'));var moment=require(_0xf880('0x2'));var BPromise=require(_0xf880('0x3'));var Mustache=require(_0xf880('0x4'));var util=require(_0xf880('0x5'));var path=require(_0xf880('0x6'));var sox=require(_0xf880('0x7'));var csv=require(_0xf880('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf880('0x9'));var _=require(_0xf880('0xa'));var squel=require(_0xf880('0xb'));var crypto=require('crypto');var jsforce=require(_0xf880('0xc'));var deskjs=require(_0xf880('0xd'));var toCsv=require(_0xf880('0x8'));var querystring=require('querystring');var Papa=require(_0xf880('0xe'));var Redis=require(_0xf880('0xf'));var authService=require(_0xf880('0x10'));var qs=require(_0xf880('0x11'));var as=require(_0xf880('0x12'));var hardwareService=require(_0xf880('0x13'));var logger=require(_0xf880('0x14'))(_0xf880('0x15'));var utils=require(_0xf880('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf880('0x17'));var db=require(_0xf880('0x18'))['db'];function respondWithStatusCode(_0x214083,_0x294150){_0x294150=_0x294150||0xcc;return function(_0x4ed8f7){if(_0x4ed8f7){return _0x214083['sendStatus'](_0x294150);}return _0x214083[_0xf880('0x19')](_0x294150)[_0xf880('0x1a')]();};}function respondWithResult(_0x5ea163,_0x1fd39d){_0x1fd39d=_0x1fd39d||0xc8;return function(_0x495af9){if(_0x495af9){return _0x5ea163[_0xf880('0x19')](_0x1fd39d)[_0xf880('0x1b')](_0x495af9);}};}function respondWithFilteredResult(_0x5cb312,_0x36aa83){return function(_0x37aa90){if(_0x37aa90){var _0x377a06=typeof _0x36aa83[_0xf880('0x1c')]===_0xf880('0x1d')&&typeof _0x36aa83[_0xf880('0x1e')]==='undefined';var _0xb96a4c=_0x37aa90[_0xf880('0x1f')];var _0x1789a0=_0x377a06?0x0:_0x36aa83['offset'];var _0x1e3b98=_0x377a06?_0x37aa90[_0xf880('0x1f')]:_0x36aa83['offset']+_0x36aa83[_0xf880('0x1e')];var _0x9b1975;if(_0x1e3b98>=_0xb96a4c){_0x1e3b98=_0xb96a4c;_0x9b1975=0xc8;}else{_0x9b1975=0xce;}_0x5cb312[_0xf880('0x19')](_0x9b1975);return _0x5cb312[_0xf880('0x20')](_0xf880('0x21'),_0x1789a0+'-'+_0x1e3b98+'/'+_0xb96a4c)[_0xf880('0x1b')](_0x37aa90);}return null;};}function patchUpdates(_0x1edf07){return function(_0x39b082){try{jsonpatch[_0xf880('0x22')](_0x39b082,_0x1edf07,!![]);}catch(_0x4e8f4a){return BPromise['reject'](_0x4e8f4a);}return _0x39b082[_0xf880('0x23')]();};}function saveUpdates(_0x4ccf84,_0xae5ec2){return function(_0x1d0ddd){if(_0x1d0ddd){return _0x1d0ddd[_0xf880('0x24')](_0x4ccf84)[_0xf880('0x25')](function(_0x1a8f33){return _0x1a8f33;});}return null;};}function removeEntity(_0x56305c,_0x132a37){return function(_0x247e08){if(_0x247e08){return _0x247e08[_0xf880('0x26')]()[_0xf880('0x25')](function(){_0x56305c[_0xf880('0x19')](0xcc)[_0xf880('0x1a')]();});}};}function handleEntityNotFound(_0x30ed0e,_0x59193f){return function(_0xf90cb0){if(!_0xf90cb0){_0x30ed0e[_0xf880('0x27')](0x194);}return _0xf90cb0;};}function handleError(_0x506e4a,_0x24ba90){_0x24ba90=_0x24ba90||0x1f4;return function(_0x15e944){logger['error'](_0x15e944[_0xf880('0x28')]);if(_0x15e944[_0xf880('0x29')]){delete _0x15e944[_0xf880('0x29')];}_0x506e4a['status'](_0x24ba90)[_0xf880('0x2a')](_0x15e944);};}function getMustacheRender(_0x4903ad,_0x5f24bb){return Mustache['render'](_0x4903ad,_['merge'](_0x5f24bb[_0xf880('0x2b')],{'contact':_0x5f24bb[_0xf880('0x2c')],'message':_0x5f24bb[_0xf880('0x2d')],'agent':_0x5f24bb['agent'],'interaction':_0x5f24bb[_0xf880('0x2e')],'account':_0x5f24bb[_0xf880('0x2f')]}))||'';}exports['index']=function(_0xd2a63d,_0x2953cf){var _0x570fc1={},_0x56c718={},_0x267abb={'count':0x0,'rows':[]};var _0x13539f=_['map'](db[_0xf880('0x30')]['rawAttributes'],function(_0x5660b6){return{'name':_0x5660b6[_0xf880('0x31')],'type':_0x5660b6[_0xf880('0x32')]['key']};});_0x56c718['model']=_[_0xf880('0x33')](_0x13539f,_0xf880('0x29'));_0x56c718[_0xf880('0x34')]=_[_0xf880('0x35')](_0xd2a63d[_0xf880('0x34')]);_0x56c718[_0xf880('0x36')]=_[_0xf880('0x37')](_0x56c718[_0xf880('0x38')],_0x56c718['query']);_0x570fc1['attributes']=_[_0xf880('0x37')](_0x56c718[_0xf880('0x38')],qs[_0xf880('0x39')](_0xd2a63d['query']['fields']));_0x570fc1[_0xf880('0x3a')]=_0x570fc1[_0xf880('0x3a')][_0xf880('0x3b')]?_0x570fc1['attributes']:_0x56c718[_0xf880('0x38')];if(!_0xd2a63d[_0xf880('0x34')][_0xf880('0x3c')](_0xf880('0x3d'))){_0x570fc1['limit']=qs['limit'](_0xd2a63d[_0xf880('0x34')][_0xf880('0x1e')]);_0x570fc1[_0xf880('0x1c')]=qs[_0xf880('0x1c')](_0xd2a63d['query'][_0xf880('0x1c')]);}_0x570fc1['order']=qs[_0xf880('0x3e')](_0xd2a63d[_0xf880('0x34')][_0xf880('0x3e')]);_0x570fc1[_0xf880('0x3f')]=qs[_0xf880('0x36')](_[_0xf880('0x40')](_0xd2a63d[_0xf880('0x34')],_0x56c718['filters']),_0x13539f);if(_0xd2a63d[_0xf880('0x34')]['filter']){_0x570fc1[_0xf880('0x3f')]=_[_0xf880('0x41')](_0x570fc1[_0xf880('0x3f')],{'$or':_[_0xf880('0x33')](_0x13539f,function(_0x3ac5c7){if(_0x3ac5c7[_0xf880('0x32')]!=='VIRTUAL'){var _0x53cb2e={};_0x53cb2e[_0x3ac5c7[_0xf880('0x29')]]={'$like':'%'+_0xd2a63d[_0xf880('0x34')]['filter']+'%'};return _0x53cb2e;}})});}_0x570fc1=_[_0xf880('0x41')]({},_0x570fc1,_0xd2a63d['options']);var _0x42908e={'where':_0x570fc1[_0xf880('0x3f')]};return db[_0xf880('0x30')][_0xf880('0x1f')](_0x42908e)[_0xf880('0x25')](function(_0x3e4c8e){_0x267abb[_0xf880('0x1f')]=_0x3e4c8e;if(_0xd2a63d[_0xf880('0x34')][_0xf880('0x42')]){_0x570fc1[_0xf880('0x43')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xf880('0x44')](_0x570fc1);})[_0xf880('0x25')](function(_0x2a96a6){_0x267abb[_0xf880('0x45')]=_0x2a96a6;return _0x267abb;})[_0xf880('0x25')](respondWithFilteredResult(_0x2953cf,_0x570fc1))['catch'](handleError(_0x2953cf,null));};exports[_0xf880('0x46')]=function(_0xbaa079,_0x5d78f5){var _0x1a9898={'raw':![],'where':{'id':_0xbaa079['params']['id']}},_0x4c0794={};_0x4c0794['model']=_[_0xf880('0x35')](db[_0xf880('0x30')][_0xf880('0x47')]);_0x4c0794[_0xf880('0x34')]=_['keys'](_0xbaa079[_0xf880('0x34')]);_0x4c0794[_0xf880('0x36')]=_[_0xf880('0x37')](_0x4c0794[_0xf880('0x38')],_0x4c0794[_0xf880('0x34')]);_0x1a9898[_0xf880('0x3a')]=_[_0xf880('0x37')](_0x4c0794[_0xf880('0x38')],qs['fields'](_0xbaa079[_0xf880('0x34')][_0xf880('0x39')]));_0x1a9898[_0xf880('0x3a')]=_0x1a9898[_0xf880('0x3a')]['length']?_0x1a9898[_0xf880('0x3a')]:_0x4c0794[_0xf880('0x38')];if(_0xbaa079[_0xf880('0x34')][_0xf880('0x42')]){_0x1a9898[_0xf880('0x43')]=[{'all':!![]}];}_0x1a9898=_[_0xf880('0x41')]({},_0x1a9898,_0xbaa079['options']);return db[_0xf880('0x30')][_0xf880('0x48')](_0x1a9898)[_0xf880('0x25')](handleEntityNotFound(_0x5d78f5,null))[_0xf880('0x25')](respondWithResult(_0x5d78f5,null))['catch'](handleError(_0x5d78f5,null));};exports[_0xf880('0x49')]=function(_0x1a8813,_0x1fe5e3){return db[_0xf880('0x30')][_0xf880('0x49')](_0x1a8813[_0xf880('0x2b')],{})[_0xf880('0x25')](respondWithResult(_0x1fe5e3,0xc9))['catch'](handleError(_0x1fe5e3,null));};exports[_0xf880('0x4a')]=function(_0x3ae8b6,_0x2edbf2){return db['AnalyticFieldReport']['bulkCreate'](_0x3ae8b6['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2edbf2,0xc9))[_0xf880('0x4b')](handleError(_0x2edbf2,null));};exports[_0xf880('0x24')]=function(_0x44b221,_0xefaaee){if(_0x44b221[_0xf880('0x2b')]['id']){delete _0x44b221[_0xf880('0x2b')]['id'];}return db[_0xf880('0x30')][_0xf880('0x48')]({'where':{'id':_0x44b221[_0xf880('0x4c')]['id']}})['then'](handleEntityNotFound(_0xefaaee,null))['then'](saveUpdates(_0x44b221[_0xf880('0x2b')],null))[_0xf880('0x25')](respondWithResult(_0xefaaee,null))[_0xf880('0x4b')](handleError(_0xefaaee,null));};exports['destroy']=function(_0x438384,_0x3ad0b2){return db[_0xf880('0x30')]['find']({'where':{'id':_0x438384[_0xf880('0x4c')]['id']}})[_0xf880('0x25')](handleEntityNotFound(_0x3ad0b2,null))[_0xf880('0x25')](removeEntity(_0x3ad0b2,null))['catch'](handleError(_0x3ad0b2,null));};exports[_0xf880('0x4d')]=function(_0x1164a0,_0x57dea8){return db[_0xf880('0x30')]['destroy']({'where':{'id':_0x1164a0[_0xf880('0x34')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xf880('0x25')](respondWithResult(_0x57dea8,0xcc))[_0xf880('0x4b')](handleError(_0x57dea8,null));};exports['addFields']=function(_0x505173,_0x5da767,_0x48b945){return db[_0xf880('0x4e')][_0xf880('0x4f')]({'where':{'id':_0x505173[_0xf880('0x4c')]['id']}})[_0xf880('0x25')](handleEntityNotFound(_0x5da767,null))[_0xf880('0x25')](function(_0x52c7e4){if(_0x52c7e4){return db[_0xf880('0x50')][_0xf880('0x51')](function(_0x1fc69c){return db['AnalyticFieldReport'][_0xf880('0x26')]({'where':{'CustomReportId':_0x505173[_0xf880('0x4c')]['id']},'transaction':_0x1fc69c})[_0xf880('0x25')](function(_0x44ef53){var _0x2962a8=_['map'](_0x505173[_0xf880('0x2b')],function(_0x483a94){delete _0x483a94['id'];_0x483a94['CustomReportId']=_0x505173[_0xf880('0x4c')]['id'];return _0x483a94;});return db[_0xf880('0x30')]['bulkCreate'](_0x2962a8,{'transaction':_0x1fc69c});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x505173[_0xf880('0x4c')]['id']}});});}})['then'](respondWithResult(_0x5da767,null))['catch'](handleError(_0x5da767,null));}; \ No newline at end of file +var _0x0991=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','render','body','message','agent','interaction','index','map','AnalyticFieldReport','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','rawAttributes','include','find','create','catch','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId'];(function(_0x5dc86b,_0x43e7e2){var _0x3645ab=function(_0x10a586){while(--_0x10a586){_0x5dc86b['push'](_0x5dc86b['shift']());}};_0x3645ab(++_0x43e7e2);}(_0x0991,0xb4));var _0x1099=function(_0x5f1d79,_0x31264f){_0x5f1d79=_0x5f1d79-0x0;var _0x5ed351=_0x0991[_0x5f1d79];return _0x5ed351;};'use strict';var emlformat=require(_0x1099('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1099('0x1'));var jsonpatch=require(_0x1099('0x2'));var rp=require(_0x1099('0x3'));var moment=require(_0x1099('0x4'));var BPromise=require(_0x1099('0x5'));var Mustache=require(_0x1099('0x6'));var util=require(_0x1099('0x7'));var path=require(_0x1099('0x8'));var sox=require(_0x1099('0x9'));var csv=require(_0x1099('0xa'));var ejs=require(_0x1099('0xb'));var fs=require('fs');var fs_extra=require(_0x1099('0xc'));var _=require(_0x1099('0xd'));var squel=require('squel');var crypto=require(_0x1099('0xe'));var jsforce=require(_0x1099('0xf'));var deskjs=require(_0x1099('0x10'));var toCsv=require(_0x1099('0xa'));var querystring=require(_0x1099('0x11'));var Papa=require(_0x1099('0x12'));var Redis=require(_0x1099('0x13'));var authService=require(_0x1099('0x14'));var qs=require(_0x1099('0x15'));var as=require(_0x1099('0x16'));var hardwareService=require(_0x1099('0x17'));var logger=require('../../config/logger')(_0x1099('0x18'));var utils=require(_0x1099('0x19'));var config=require(_0x1099('0x1a'));var licenseUtil=require(_0x1099('0x1b'));var db=require(_0x1099('0x1c'))['db'];function respondWithStatusCode(_0x5230e5,_0x10d4d8){_0x10d4d8=_0x10d4d8||0xcc;return function(_0x215e4c){if(_0x215e4c){return _0x5230e5[_0x1099('0x1d')](_0x10d4d8);}return _0x5230e5[_0x1099('0x1e')](_0x10d4d8)[_0x1099('0x1f')]();};}function respondWithResult(_0x3c7e2a,_0x376aa8){_0x376aa8=_0x376aa8||0xc8;return function(_0x1623c2){if(_0x1623c2){return _0x3c7e2a[_0x1099('0x1e')](_0x376aa8)[_0x1099('0x20')](_0x1623c2);}};}function respondWithFilteredResult(_0x43c3f5,_0x5c32e7){return function(_0x10939f){if(_0x10939f){var _0x25fdcd=typeof _0x5c32e7[_0x1099('0x21')]===_0x1099('0x22')&&typeof _0x5c32e7[_0x1099('0x23')]==='undefined';var _0x335a18=_0x10939f[_0x1099('0x24')];var _0x351dc1=_0x25fdcd?0x0:_0x5c32e7['offset'];var _0x12e247=_0x25fdcd?_0x10939f[_0x1099('0x24')]:_0x5c32e7['offset']+_0x5c32e7['limit'];var _0x2a6fbd;if(_0x12e247>=_0x335a18){_0x12e247=_0x335a18;_0x2a6fbd=0xc8;}else{_0x2a6fbd=0xce;}_0x43c3f5[_0x1099('0x1e')](_0x2a6fbd);return _0x43c3f5[_0x1099('0x25')](_0x1099('0x26'),_0x351dc1+'-'+_0x12e247+'/'+_0x335a18)['json'](_0x10939f);}return null;};}function patchUpdates(_0x264974){return function(_0x27f6d2){try{jsonpatch[_0x1099('0x27')](_0x27f6d2,_0x264974,!![]);}catch(_0x473415){return BPromise['reject'](_0x473415);}return _0x27f6d2['save']();};}function saveUpdates(_0x463e35,_0x1d0b9c){return function(_0x4efb11){if(_0x4efb11){return _0x4efb11[_0x1099('0x28')](_0x463e35)[_0x1099('0x29')](function(_0x36d2a7){return _0x36d2a7;});}return null;};}function removeEntity(_0x17041c,_0x131d62){return function(_0x1613b4){if(_0x1613b4){return _0x1613b4[_0x1099('0x2a')]()[_0x1099('0x29')](function(){_0x17041c[_0x1099('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x319728,_0x4b5f26){return function(_0x535745){if(!_0x535745){_0x319728[_0x1099('0x1d')](0x194);}return _0x535745;};}function handleError(_0x4e5d97,_0x5358e0){_0x5358e0=_0x5358e0||0x1f4;return function(_0x5aa914){logger[_0x1099('0x2b')](_0x5aa914[_0x1099('0x2c')]);if(_0x5aa914[_0x1099('0x2d')]){delete _0x5aa914['name'];}_0x4e5d97[_0x1099('0x1e')](_0x5358e0)['send'](_0x5aa914);};}function getMustacheRender(_0x5346bf,_0x1834bd){return Mustache[_0x1099('0x2e')](_0x5346bf,_['merge'](_0x1834bd[_0x1099('0x2f')],{'contact':_0x1834bd['contact'],'message':_0x1834bd[_0x1099('0x30')],'agent':_0x1834bd[_0x1099('0x31')],'interaction':_0x1834bd[_0x1099('0x32')],'account':_0x1834bd['account']}))||'';}exports[_0x1099('0x33')]=function(_0x5b66f5,_0x52dc80){var _0x5e5992={},_0x7ee05={},_0x5d2e90={'count':0x0,'rows':[]};var _0x542f72=_[_0x1099('0x34')](db[_0x1099('0x35')]['rawAttributes'],function(_0x35d048){return{'name':_0x35d048[_0x1099('0x36')],'type':_0x35d048[_0x1099('0x37')]['key']};});_0x7ee05[_0x1099('0x38')]=_['map'](_0x542f72,'name');_0x7ee05[_0x1099('0x39')]=_[_0x1099('0x3a')](_0x5b66f5[_0x1099('0x39')]);_0x7ee05[_0x1099('0x3b')]=_['intersection'](_0x7ee05[_0x1099('0x38')],_0x7ee05['query']);_0x5e5992[_0x1099('0x3c')]=_[_0x1099('0x3d')](_0x7ee05['model'],qs['fields'](_0x5b66f5['query'][_0x1099('0x3e')]));_0x5e5992[_0x1099('0x3c')]=_0x5e5992[_0x1099('0x3c')][_0x1099('0x3f')]?_0x5e5992['attributes']:_0x7ee05['model'];if(!_0x5b66f5['query'][_0x1099('0x40')]('nolimit')){_0x5e5992[_0x1099('0x23')]=qs[_0x1099('0x23')](_0x5b66f5[_0x1099('0x39')]['limit']);_0x5e5992[_0x1099('0x21')]=qs[_0x1099('0x21')](_0x5b66f5[_0x1099('0x39')][_0x1099('0x21')]);}_0x5e5992['order']=qs[_0x1099('0x41')](_0x5b66f5['query']['sort']);_0x5e5992[_0x1099('0x42')]=qs[_0x1099('0x3b')](_[_0x1099('0x43')](_0x5b66f5[_0x1099('0x39')],_0x7ee05[_0x1099('0x3b')]),_0x542f72);if(_0x5b66f5[_0x1099('0x39')]['filter']){_0x5e5992[_0x1099('0x42')]=_[_0x1099('0x44')](_0x5e5992[_0x1099('0x42')],{'$or':_[_0x1099('0x34')](_0x542f72,function(_0x23018b){if(_0x23018b[_0x1099('0x37')]!==_0x1099('0x45')){var _0x5cbb50={};_0x5cbb50[_0x23018b[_0x1099('0x2d')]]={'$like':'%'+_0x5b66f5['query'][_0x1099('0x46')]+'%'};return _0x5cbb50;}})});}_0x5e5992=_[_0x1099('0x44')]({},_0x5e5992,_0x5b66f5[_0x1099('0x47')]);var _0x37c10e={'where':_0x5e5992[_0x1099('0x42')]};return db[_0x1099('0x35')][_0x1099('0x24')](_0x37c10e)[_0x1099('0x29')](function(_0x4dae47){_0x5d2e90[_0x1099('0x24')]=_0x4dae47;if(_0x5b66f5[_0x1099('0x39')][_0x1099('0x48')]){_0x5e5992['include']=[{'all':!![]}];}return db[_0x1099('0x35')]['findAll'](_0x5e5992);})['then'](function(_0x225357){_0x5d2e90[_0x1099('0x49')]=_0x225357;return _0x5d2e90;})['then'](respondWithFilteredResult(_0x52dc80,_0x5e5992))['catch'](handleError(_0x52dc80,null));};exports[_0x1099('0x4a')]=function(_0x21fed2,_0x4c9790){var _0x18f100={'raw':![],'where':{'id':_0x21fed2[_0x1099('0x4b')]['id']}},_0x261322={};_0x261322[_0x1099('0x38')]=_[_0x1099('0x3a')](db[_0x1099('0x35')][_0x1099('0x4c')]);_0x261322[_0x1099('0x39')]=_['keys'](_0x21fed2[_0x1099('0x39')]);_0x261322[_0x1099('0x3b')]=_[_0x1099('0x3d')](_0x261322[_0x1099('0x38')],_0x261322['query']);_0x18f100[_0x1099('0x3c')]=_[_0x1099('0x3d')](_0x261322[_0x1099('0x38')],qs[_0x1099('0x3e')](_0x21fed2[_0x1099('0x39')][_0x1099('0x3e')]));_0x18f100[_0x1099('0x3c')]=_0x18f100['attributes'][_0x1099('0x3f')]?_0x18f100[_0x1099('0x3c')]:_0x261322[_0x1099('0x38')];if(_0x21fed2[_0x1099('0x39')][_0x1099('0x48')]){_0x18f100[_0x1099('0x4d')]=[{'all':!![]}];}_0x18f100=_[_0x1099('0x44')]({},_0x18f100,_0x21fed2[_0x1099('0x47')]);return db['AnalyticFieldReport'][_0x1099('0x4e')](_0x18f100)[_0x1099('0x29')](handleEntityNotFound(_0x4c9790,null))['then'](respondWithResult(_0x4c9790,null))['catch'](handleError(_0x4c9790,null));};exports[_0x1099('0x4f')]=function(_0x182f56,_0x16ba1b){return db[_0x1099('0x35')][_0x1099('0x4f')](_0x182f56[_0x1099('0x2f')],{})[_0x1099('0x29')](respondWithResult(_0x16ba1b,0xc9))[_0x1099('0x50')](handleError(_0x16ba1b,null));};exports[_0x1099('0x51')]=function(_0x431e08,_0x232d53){return db['AnalyticFieldReport']['bulkCreate'](_0x431e08[_0x1099('0x2f')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x232d53,0xc9))[_0x1099('0x50')](handleError(_0x232d53,null));};exports[_0x1099('0x28')]=function(_0x203341,_0xccaa7e){if(_0x203341[_0x1099('0x2f')]['id']){delete _0x203341[_0x1099('0x2f')]['id'];}return db[_0x1099('0x35')][_0x1099('0x4e')]({'where':{'id':_0x203341[_0x1099('0x4b')]['id']}})[_0x1099('0x29')](handleEntityNotFound(_0xccaa7e,null))[_0x1099('0x29')](saveUpdates(_0x203341[_0x1099('0x2f')],null))[_0x1099('0x29')](respondWithResult(_0xccaa7e,null))[_0x1099('0x50')](handleError(_0xccaa7e,null));};exports[_0x1099('0x2a')]=function(_0x341371,_0x556424){return db['AnalyticFieldReport'][_0x1099('0x4e')]({'where':{'id':_0x341371[_0x1099('0x4b')]['id']}})[_0x1099('0x29')](handleEntityNotFound(_0x556424,null))[_0x1099('0x29')](removeEntity(_0x556424,null))[_0x1099('0x50')](handleError(_0x556424,null));};exports[_0x1099('0x52')]=function(_0x10527d,_0x57cb58){return db['AnalyticFieldReport'][_0x1099('0x2a')]({'where':{'id':_0x10527d[_0x1099('0x39')][_0x1099('0x53')]||[]},'raw':![],'individualHooks':!![]})[_0x1099('0x29')](respondWithResult(_0x57cb58,0xcc))[_0x1099('0x50')](handleError(_0x57cb58,null));};exports[_0x1099('0x54')]=function(_0x5c8120,_0x8d5842,_0x6ea404){return db[_0x1099('0x55')][_0x1099('0x56')]({'where':{'id':_0x5c8120['params']['id']}})['then'](handleEntityNotFound(_0x8d5842,null))['then'](function(_0x134907){if(_0x134907){return db[_0x1099('0x57')][_0x1099('0x58')](function(_0x28371d){return db[_0x1099('0x35')]['destroy']({'where':{'CustomReportId':_0x5c8120[_0x1099('0x4b')]['id']},'transaction':_0x28371d})[_0x1099('0x29')](function(_0x3da4b2){var _0x5c4475=_[_0x1099('0x34')](_0x5c8120['body'],function(_0xd08b57){delete _0xd08b57['id'];_0xd08b57[_0x1099('0x59')]=_0x5c8120['params']['id'];return _0xd08b57;});return db['AnalyticFieldReport'][_0x1099('0x51')](_0x5c4475,{'transaction':_0x28371d});});})[_0x1099('0x29')](function(){return db[_0x1099('0x35')]['findAll']({'where':{'CustomReportId':_0x5c8120[_0x1099('0x4b')]['id']}});});}})[_0x1099('0x29')](respondWithResult(_0x8d5842,null))[_0x1099('0x50')](handleError(_0x8d5842,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7834735..a8ff2c3 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.model.js +++ b/server/api/analyticFieldReport/analyticFieldReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5cc=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe5cc,0x166));var _0xce5c=function(_0x18083e,_0x1979fb){_0x18083e=_0x18083e-0x0;var _0xdfd586=_0xe5cc[_0x18083e];return _0xdfd586;};'use strict';var _=require(_0xce5c('0x0'));var util=require(_0xce5c('0x1'));var logger=require(_0xce5c('0x2'))(_0xce5c('0x3'));var moment=require('moment');var BPromise=require(_0xce5c('0x4'));var rp=require(_0xce5c('0x5'));var fs=require('fs');var path=require(_0xce5c('0x6'));var rimraf=require('rimraf');var config=require(_0xce5c('0x7'));var attributes=require(_0xce5c('0x8'));module['exports']=function(_0x4534c2,_0x11c462){return _0x4534c2[_0xce5c('0x9')](_0xce5c('0xa'),attributes,{'tableName':_0xce5c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eee=['moment','request-promise','path','rimraf','../../config/environment','define','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x3eee,0x19e));var _0xe3ee=function(_0x4903e7,_0x2e9bf7){_0x4903e7=_0x4903e7-0x0;var _0x44d9b8=_0x3eee[_0x4903e7];return _0x44d9b8;};'use strict';var _=require(_0xe3ee('0x0'));var util=require(_0xe3ee('0x1'));var logger=require(_0xe3ee('0x2'))(_0xe3ee('0x3'));var moment=require(_0xe3ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xe3ee('0x5'));var fs=require('fs');var path=require(_0xe3ee('0x6'));var rimraf=require(_0xe3ee('0x7'));var config=require(_0xe3ee('0x8'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x2b0bf6,_0x1ca0cc){return _0x2b0bf6[_0xe3ee('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xe3ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 13619f9..a79566a 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.rpc.js +++ b/server/api/analyticFieldReport/analyticFieldReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f57=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f57,0x12b));var _0x74f5=function(_0xdcefa9,_0x7673c0){_0xdcefa9=_0xdcefa9-0x0;var _0x56b223=_0x4f57[_0xdcefa9];return _0x56b223;};'use strict';var _=require('lodash');var util=require(_0x74f5('0x0'));var moment=require(_0x74f5('0x1'));var BPromise=require(_0x74f5('0x2'));var rs=require(_0x74f5('0x3'));var fs=require('fs');var Redis=require(_0x74f5('0x4'));var db=require(_0x74f5('0x5'))['db'];var utils=require(_0x74f5('0x6'));var logger=require(_0x74f5('0x7'))(_0x74f5('0x8'));var config=require(_0x74f5('0x9'));var jayson=require(_0x74f5('0xa'));var client=jayson[_0x74f5('0xb')][_0x74f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1655a4,_0x544a6a,_0x4d68ea){return new BPromise(function(_0x3ac57d,_0x4d7d11){return client[_0x74f5('0xd')](_0x1655a4,_0x4d68ea)[_0x74f5('0xe')](function(_0x42771d){logger[_0x74f5('0xf')](_0x74f5('0x10'),_0x544a6a,'request\x20sent');logger[_0x74f5('0x11')](_0x74f5('0x12'),_0x544a6a,_0x74f5('0x13'),JSON['stringify'](_0x42771d));if(_0x42771d[_0x74f5('0x14')]){if(_0x42771d[_0x74f5('0x14')][_0x74f5('0x15')]===0x1f4){logger[_0x74f5('0x14')](_0x74f5('0x10'),_0x544a6a,_0x42771d[_0x74f5('0x14')][_0x74f5('0x16')]);return _0x4d7d11(_0x42771d[_0x74f5('0x14')][_0x74f5('0x16')]);}logger[_0x74f5('0x14')](_0x74f5('0x10'),_0x544a6a,_0x42771d[_0x74f5('0x14')]['message']);return _0x3ac57d(_0x42771d['error'][_0x74f5('0x16')]);}else{logger[_0x74f5('0xf')](_0x74f5('0x10'),_0x544a6a,_0x74f5('0x13'));_0x3ac57d(_0x42771d[_0x74f5('0x17')][_0x74f5('0x16')]);}})[_0x74f5('0x18')](function(_0x5d532d){logger[_0x74f5('0x14')](_0x74f5('0x10'),_0x544a6a,_0x5d532d);_0x4d7d11(_0x5d532d);});});} \ No newline at end of file +var _0xda3b=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then'];(function(_0x4789f0,_0x46b3c6){var _0x2cddcb=function(_0x51ef93){while(--_0x51ef93){_0x4789f0['push'](_0x4789f0['shift']());}};_0x2cddcb(++_0x46b3c6);}(_0xda3b,0x144));var _0xbda3=function(_0x2bd0f3,_0x259957){_0x2bd0f3=_0x2bd0f3-0x0;var _0x1aad5a=_0xda3b[_0x2bd0f3];return _0x1aad5a;};'use strict';var _=require(_0xbda3('0x0'));var util=require('util');var moment=require(_0xbda3('0x1'));var BPromise=require(_0xbda3('0x2'));var rs=require(_0xbda3('0x3'));var fs=require('fs');var Redis=require(_0xbda3('0x4'));var db=require(_0xbda3('0x5'))['db'];var utils=require(_0xbda3('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbda3('0x7'));var client=jayson[_0xbda3('0x8')][_0xbda3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e469f,_0x4e4d88,_0x8302c6){return new BPromise(function(_0x542ddf,_0x203e7b){return client[_0xbda3('0xa')](_0x1e469f,_0x8302c6)[_0xbda3('0xb')](function(_0x74d268){logger[_0xbda3('0xc')](_0xbda3('0xd'),_0x4e4d88,_0xbda3('0xe'));logger[_0xbda3('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x4e4d88,_0xbda3('0xe'),JSON[_0xbda3('0x10')](_0x74d268));if(_0x74d268[_0xbda3('0x11')]){if(_0x74d268['error'][_0xbda3('0x12')]===0x1f4){logger[_0xbda3('0x11')](_0xbda3('0xd'),_0x4e4d88,_0x74d268['error']['message']);return _0x203e7b(_0x74d268[_0xbda3('0x11')]['message']);}logger[_0xbda3('0x11')](_0xbda3('0xd'),_0x4e4d88,_0x74d268['error']['message']);return _0x542ddf(_0x74d268[_0xbda3('0x11')]['message']);}else{logger[_0xbda3('0xc')](_0xbda3('0xd'),_0x4e4d88,'request\x20sent');_0x542ddf(_0x74d268[_0xbda3('0x13')]['message']);}})[_0xbda3('0x14')](function(_0x5c06e){logger[_0xbda3('0x11')](_0xbda3('0xd'),_0x4e4d88,_0x5c06e);_0x203e7b(_0x5c06e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 27f09c0..2e09030 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0271=['bulkDestroy','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','/create_many','/:id/create_many','put','/:id','delete','/destroy_many'];(function(_0x467a1a,_0x163b60){var _0x23c960=function(_0x13b65f){while(--_0x13b65f){_0x467a1a['push'](_0x467a1a['shift']());}};_0x23c960(++_0x163b60);}(_0x0271,0x1bc));var _0x1027=function(_0x4ae611,_0x16970d){_0x4ae611=_0x4ae611-0x0;var _0x540126=_0x0271[_0x4ae611];return _0x540126;};'use strict';var multer=require('multer');var util=require(_0x1027('0x0'));var path=require(_0x1027('0x1'));var timeout=require(_0x1027('0x2'));var express=require('express');var router=express[_0x1027('0x3')]();var fs_extra=require(_0x1027('0x4'));var auth=require(_0x1027('0x5'));var interaction=require(_0x1027('0x6'));var config=require(_0x1027('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x1027('0x8')]('/',auth[_0x1027('0x9')](),controller[_0x1027('0xa')]);router[_0x1027('0x8')]('/:id',auth[_0x1027('0x9')](),controller['show']);router[_0x1027('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1027('0xb')](_0x1027('0xc'),auth[_0x1027('0x9')](),controller['bulkCreate']);router[_0x1027('0xb')](_0x1027('0xd'),auth['isAuthenticated'](),controller['addFields']);router[_0x1027('0xe')](_0x1027('0xf'),auth[_0x1027('0x9')](),controller['update']);router[_0x1027('0x10')](_0x1027('0x11'),auth['isAuthenticated'](),controller[_0x1027('0x12')]);router[_0x1027('0x10')](_0x1027('0xf'),auth[_0x1027('0x9')](),controller[_0x1027('0x13')]);module[_0x1027('0x14')]=router; \ No newline at end of file +var _0xa7f7=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','put','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xa7f7,0x11d));var _0x7a7f=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xa7f7[_0x236d24];return _0x1574cf;};'use strict';var multer=require(_0x7a7f('0x0'));var util=require(_0x7a7f('0x1'));var path=require(_0x7a7f('0x2'));var timeout=require(_0x7a7f('0x3'));var express=require(_0x7a7f('0x4'));var router=express[_0x7a7f('0x5')]();var fs_extra=require(_0x7a7f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7a7f('0x7'));var config=require(_0x7a7f('0x8'));var controller=require('./analyticFieldReport.controller');router['get']('/',auth[_0x7a7f('0x9')](),controller[_0x7a7f('0xa')]);router['get'](_0x7a7f('0xb'),auth[_0x7a7f('0x9')](),controller[_0x7a7f('0xc')]);router[_0x7a7f('0xd')]('/',auth[_0x7a7f('0x9')](),controller['create']);router[_0x7a7f('0xd')](_0x7a7f('0xe'),auth[_0x7a7f('0x9')](),controller[_0x7a7f('0xf')]);router[_0x7a7f('0xd')](_0x7a7f('0x10'),auth[_0x7a7f('0x9')](),controller[_0x7a7f('0x11')]);router[_0x7a7f('0x12')](_0x7a7f('0xb'),auth[_0x7a7f('0x9')](),controller['update']);router[_0x7a7f('0x13')](_0x7a7f('0x14'),auth[_0x7a7f('0x9')](),controller[_0x7a7f('0x15')]);router['delete'](_0x7a7f('0xb'),auth[_0x7a7f('0x9')](),controller[_0x7a7f('0x16')]);module[_0x7a7f('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 0f08c8d..8c829b1 100644 --- a/server/api/analyticMetric/analyticMetric.attributes.js +++ b/server/api/analyticMetric/analyticMetric.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb79a=['name','STRING','TEXT','sequelize','exports'];(function(_0x546821,_0x3f4194){var _0x156655=function(_0x12576b){while(--_0x12576b){_0x546821['push'](_0x546821['shift']());}};_0x156655(++_0x3f4194);}(_0xb79a,0x18e));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xab79('0x0'));module[_0xab79('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xab79('0x2')},'table':{'type':Sequelize[_0xab79('0x3')]},'metric':{'type':Sequelize[_0xab79('0x4')]},'description':{'type':Sequelize[_0xab79('0x3')]}}; \ No newline at end of file +var _0xa902=['name','sequelize','exports','STRING'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xa902,0x8d));var _0x2a90=function(_0x50173c,_0x46d901){_0x50173c=_0x50173c-0x0;var _0x539039=_0xa902[_0x50173c];return _0x539039;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'name':{'type':Sequelize[_0x2a90('0x2')],'allowNull':![],'unique':_0x2a90('0x3')},'table':{'type':Sequelize[_0x2a90('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x2a90('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b0eb428..c9de0a8 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf021=['crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','reject','save','update','then','Metrics','end','error','stack','send','render','merge','body','contact','message','agent','account','rawAttributes','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','options','count','includeAll','include','AnalyticMetric','findAll','catch','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel'];(function(_0x1fed62,_0x226377){var _0x17a4b3=function(_0x5df534){while(--_0x5df534){_0x1fed62['push'](_0x1fed62['shift']());}};_0x17a4b3(++_0x226377);}(_0xf021,0x18f));var _0x1f02=function(_0x305a6e,_0x1f4a40){_0x305a6e=_0x305a6e-0x0;var _0xd23128=_0xf021[_0x305a6e];return _0xd23128;};'use strict';var emlformat=require(_0x1f02('0x0'));var rimraf=require(_0x1f02('0x1'));var zipdir=require(_0x1f02('0x2'));var jsonpatch=require(_0x1f02('0x3'));var rp=require(_0x1f02('0x4'));var moment=require('moment');var BPromise=require(_0x1f02('0x5'));var Mustache=require('mustache');var util=require(_0x1f02('0x6'));var path=require(_0x1f02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f02('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f02('0x9'));var squel=require(_0x1f02('0xa'));var crypto=require(_0x1f02('0xb'));var jsforce=require(_0x1f02('0xc'));var deskjs=require(_0x1f02('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1f02('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f02('0xf'));var as=require(_0x1f02('0x10'));var hardwareService=require(_0x1f02('0x11'));var logger=require(_0x1f02('0x12'))(_0x1f02('0x13'));var utils=require('../../config/utils');var config=require(_0x1f02('0x14'));var licenseUtil=require(_0x1f02('0x15'));var db=require(_0x1f02('0x16'))['db'];function respondWithStatusCode(_0x56a2c2,_0x24e9b8){_0x24e9b8=_0x24e9b8||0xcc;return function(_0x1ac6eb){if(_0x1ac6eb){return _0x56a2c2[_0x1f02('0x17')](_0x24e9b8);}return _0x56a2c2['status'](_0x24e9b8)['end']();};}function respondWithResult(_0x4974bd,_0x11ba7e){_0x11ba7e=_0x11ba7e||0xc8;return function(_0x2c08ad){if(_0x2c08ad){return _0x4974bd[_0x1f02('0x18')](_0x11ba7e)[_0x1f02('0x19')](_0x2c08ad);}};}function respondWithFilteredResult(_0x1c16ce,_0x45bae1){return function(_0x440328){if(_0x440328){var _0x3b0a3d=typeof _0x45bae1['offset']===_0x1f02('0x1a')&&typeof _0x45bae1['limit']==='undefined';var _0x4a66a5=_0x440328['count'];var _0x4d1e4f=_0x3b0a3d?0x0:_0x45bae1[_0x1f02('0x1b')];var _0x3033a2=_0x3b0a3d?_0x440328['count']:_0x45bae1[_0x1f02('0x1b')]+_0x45bae1[_0x1f02('0x1c')];var _0x356444;if(_0x3033a2>=_0x4a66a5){_0x3033a2=_0x4a66a5;_0x356444=0xc8;}else{_0x356444=0xce;}_0x1c16ce[_0x1f02('0x18')](_0x356444);return _0x1c16ce['set']('Content-Range',_0x4d1e4f+'-'+_0x3033a2+'/'+_0x4a66a5)[_0x1f02('0x19')](_0x440328);}return null;};}function patchUpdates(_0x37393a){return function(_0x5e78c2){try{jsonpatch['apply'](_0x5e78c2,_0x37393a,!![]);}catch(_0x339c29){return BPromise[_0x1f02('0x1d')](_0x339c29);}return _0x5e78c2[_0x1f02('0x1e')]();};}function saveUpdates(_0xbabbd7,_0x480297){return function(_0x12c4af){if(_0x12c4af){return _0x12c4af[_0x1f02('0x1f')](_0xbabbd7)[_0x1f02('0x20')](function(_0x2f422c){return _0x2f422c;});}return null;};}function removeEntity(_0x43b3e7,_0x134398){return function(_0x1328ea){if(_0x1328ea){return _0x1328ea['destroy']()[_0x1f02('0x20')](function(){var _0x3a8c57=_0x1328ea['get']({'plain':!![]});var _0x25a8d1=_0x1f02('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x25a8d1,'resourceId':_0x3a8c57['id']}})[_0x1f02('0x20')](function(){return _0x1328ea;});})[_0x1f02('0x20')](function(){_0x43b3e7[_0x1f02('0x18')](0xcc)[_0x1f02('0x22')]();});}};}function handleEntityNotFound(_0x3f5c5e,_0x3f5577){return function(_0x297cf4){if(!_0x297cf4){_0x3f5c5e['sendStatus'](0x194);}return _0x297cf4;};}function handleError(_0x4d5f7e,_0x4e04f2){_0x4e04f2=_0x4e04f2||0x1f4;return function(_0x3ef4bf){logger[_0x1f02('0x23')](_0x3ef4bf[_0x1f02('0x24')]);if(_0x3ef4bf['name']){delete _0x3ef4bf['name'];}_0x4d5f7e[_0x1f02('0x18')](_0x4e04f2)[_0x1f02('0x25')](_0x3ef4bf);};}function getMustacheRender(_0x1605cf,_0x433a1e){return Mustache[_0x1f02('0x26')](_0x1605cf,_[_0x1f02('0x27')](_0x433a1e[_0x1f02('0x28')],{'contact':_0x433a1e[_0x1f02('0x29')],'message':_0x433a1e[_0x1f02('0x2a')],'agent':_0x433a1e[_0x1f02('0x2b')],'interaction':_0x433a1e['interaction'],'account':_0x433a1e[_0x1f02('0x2c')]}))||'';}exports['index']=function(_0xa61d8f,_0x3b3b57){var _0x8a3f1e={},_0x2bf78e={},_0x28a572={'count':0x0,'rows':[]};var _0x194c85=_['map'](db['AnalyticMetric'][_0x1f02('0x2d')],function(_0x15e655){return{'name':_0x15e655['fieldName'],'type':_0x15e655[_0x1f02('0x2e')]['key']};});_0x2bf78e[_0x1f02('0x2f')]=_['map'](_0x194c85,_0x1f02('0x30'));_0x2bf78e['query']=_['keys'](_0xa61d8f[_0x1f02('0x31')]);_0x2bf78e[_0x1f02('0x32')]=_[_0x1f02('0x33')](_0x2bf78e[_0x1f02('0x2f')],_0x2bf78e['query']);_0x8a3f1e[_0x1f02('0x34')]=_[_0x1f02('0x33')](_0x2bf78e[_0x1f02('0x2f')],qs['fields'](_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x35')]));_0x8a3f1e[_0x1f02('0x34')]=_0x8a3f1e[_0x1f02('0x34')][_0x1f02('0x36')]?_0x8a3f1e[_0x1f02('0x34')]:_0x2bf78e['model'];if(!_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x37')](_0x1f02('0x38'))){_0x8a3f1e['limit']=qs[_0x1f02('0x1c')](_0xa61d8f['query'][_0x1f02('0x1c')]);_0x8a3f1e['offset']=qs['offset'](_0xa61d8f[_0x1f02('0x31')]['offset']);}_0x8a3f1e['order']=qs[_0x1f02('0x39')](_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x39')]);_0x8a3f1e[_0x1f02('0x3a')]=qs['filters'](_[_0x1f02('0x3b')](_0xa61d8f['query'],_0x2bf78e[_0x1f02('0x32')]),_0x194c85);if(_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x3c')]){_0x8a3f1e[_0x1f02('0x3a')]=_[_0x1f02('0x27')](_0x8a3f1e[_0x1f02('0x3a')],{'$or':_[_0x1f02('0x3d')](_0x194c85,function(_0xffa05b){if(_0xffa05b[_0x1f02('0x2e')]!=='VIRTUAL'){var _0x31ca4d={};_0x31ca4d[_0xffa05b['name']]={'$like':'%'+_0xa61d8f[_0x1f02('0x31')]['filter']+'%'};return _0x31ca4d;}})});}_0x8a3f1e=_[_0x1f02('0x27')]({},_0x8a3f1e,_0xa61d8f[_0x1f02('0x3e')]);var _0x1c7182={'where':_0x8a3f1e['where']};return db['AnalyticMetric'][_0x1f02('0x3f')](_0x1c7182)[_0x1f02('0x20')](function(_0x37d6b5){_0x28a572[_0x1f02('0x3f')]=_0x37d6b5;if(_0xa61d8f[_0x1f02('0x31')][_0x1f02('0x40')]){_0x8a3f1e[_0x1f02('0x41')]=[{'all':!![]}];}return db[_0x1f02('0x42')][_0x1f02('0x43')](_0x8a3f1e);})['then'](function(_0x3202d8){_0x28a572['rows']=_0x3202d8;return _0x28a572;})['then'](respondWithFilteredResult(_0x3b3b57,_0x8a3f1e))[_0x1f02('0x44')](handleError(_0x3b3b57,null));};exports['show']=function(_0x584d9c,_0xe61000){var _0x55ad2b={'raw':!![],'where':{'id':_0x584d9c[_0x1f02('0x45')]['id']}},_0x4be37b={};_0x4be37b[_0x1f02('0x2f')]=_['keys'](db[_0x1f02('0x42')][_0x1f02('0x2d')]);_0x4be37b[_0x1f02('0x31')]=_[_0x1f02('0x46')](_0x584d9c['query']);_0x4be37b[_0x1f02('0x32')]=_[_0x1f02('0x33')](_0x4be37b[_0x1f02('0x2f')],_0x4be37b[_0x1f02('0x31')]);_0x55ad2b[_0x1f02('0x34')]=_[_0x1f02('0x33')](_0x4be37b[_0x1f02('0x2f')],qs[_0x1f02('0x35')](_0x584d9c[_0x1f02('0x31')][_0x1f02('0x35')]));_0x55ad2b[_0x1f02('0x34')]=_0x55ad2b[_0x1f02('0x34')][_0x1f02('0x36')]?_0x55ad2b[_0x1f02('0x34')]:_0x4be37b['model'];if(_0x584d9c[_0x1f02('0x31')]['includeAll']){_0x55ad2b[_0x1f02('0x41')]=[{'all':!![]}];}_0x55ad2b=_['merge']({},_0x55ad2b,_0x584d9c[_0x1f02('0x3e')]);return db[_0x1f02('0x42')][_0x1f02('0x47')](_0x55ad2b)[_0x1f02('0x20')](handleEntityNotFound(_0xe61000,null))[_0x1f02('0x20')](respondWithResult(_0xe61000,null))[_0x1f02('0x44')](handleError(_0xe61000,null));};exports[_0x1f02('0x48')]=function(_0x2178b2,_0x8eae3){return db[_0x1f02('0x42')][_0x1f02('0x48')](_0x2178b2['body'],{})[_0x1f02('0x20')](function(_0x297957){var _0x3f3e7c=_0x2178b2[_0x1f02('0x49')][_0x1f02('0x4a')]({'plain':!![]});if(!_0x3f3e7c)throw new Error(_0x1f02('0x4b'));if(_0x3f3e7c[_0x1f02('0x4c')]===_0x1f02('0x49')){var _0x15cd89=_0x297957['get']({'plain':!![]});var _0xa0b579=_0x1f02('0x21');return db[_0x1f02('0x4d')][_0x1f02('0x47')]({'where':{'name':_0xa0b579,'userProfileId':_0x3f3e7c[_0x1f02('0x4e')]},'raw':!![]})['then'](function(_0x12c1fb){if(_0x12c1fb&&_0x12c1fb['autoAssociation']===0x0){return db[_0x1f02('0x4f')][_0x1f02('0x48')]({'name':_0x15cd89[_0x1f02('0x30')],'resourceId':_0x15cd89['id'],'type':_0x12c1fb[_0x1f02('0x30')],'sectionId':_0x12c1fb['id']},{})[_0x1f02('0x20')](function(){return _0x297957;});}else{return _0x297957;}})[_0x1f02('0x44')](function(_0x41b024){logger[_0x1f02('0x23')](_0x1f02('0x50'),_0x41b024);throw _0x41b024;});}return _0x297957;})[_0x1f02('0x20')](respondWithResult(_0x8eae3,0xc9))['catch'](handleError(_0x8eae3,null));};exports['update']=function(_0x4d084c,_0x39dbee){if(_0x4d084c['body']['id']){delete _0x4d084c[_0x1f02('0x28')]['id'];}return db[_0x1f02('0x42')]['find']({'where':{'id':_0x4d084c[_0x1f02('0x45')]['id']}})['then'](handleEntityNotFound(_0x39dbee,null))['then'](saveUpdates(_0x4d084c['body'],null))[_0x1f02('0x20')](respondWithResult(_0x39dbee,null))[_0x1f02('0x44')](handleError(_0x39dbee,null));};exports[_0x1f02('0x51')]=function(_0x390df6,_0xbb603){return db[_0x1f02('0x42')]['find']({'where':{'id':_0x390df6[_0x1f02('0x45')]['id']}})[_0x1f02('0x20')](handleEntityNotFound(_0xbb603,null))['then'](removeEntity(_0xbb603,null))['catch'](handleError(_0xbb603,null));}; \ No newline at end of file +var _0xbc8b=['params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Metrics','UserProfileResource','end','sendStatus','error','name','send','render','merge','body','agent','interaction','account','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show'];(function(_0xd57444,_0x571c38){var _0x2ab09f=function(_0x4bf78c){while(--_0x4bf78c){_0xd57444['push'](_0xd57444['shift']());}};_0x2ab09f(++_0x571c38);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xbc8b[_0x1b5a05];return _0x347931;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc8('0x1'));var rp=require(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var Mustache=require(_0xbbc8('0x5'));var util=require(_0xbbc8('0x6'));var path=require('path');var sox=require(_0xbbc8('0x7'));var csv=require(_0xbbc8('0x8'));var ejs=require(_0xbbc8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xa'));var _=require(_0xbbc8('0xb'));var squel=require('squel');var crypto=require(_0xbbc8('0xc'));var jsforce=require(_0xbbc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbc8('0x8'));var querystring=require(_0xbbc8('0xe'));var Papa=require(_0xbbc8('0xf'));var Redis=require(_0xbbc8('0x10'));var authService=require(_0xbbc8('0x11'));var qs=require(_0xbbc8('0x12'));var as=require(_0xbbc8('0x13'));var hardwareService=require(_0xbbc8('0x14'));var logger=require(_0xbbc8('0x15'))(_0xbbc8('0x16'));var utils=require(_0xbbc8('0x17'));var config=require(_0xbbc8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbc8('0x19'))['db'];function respondWithStatusCode(_0xc702ca,_0x1c4b00){_0x1c4b00=_0x1c4b00||0xcc;return function(_0x55b386){if(_0x55b386){return _0xc702ca['sendStatus'](_0x1c4b00);}return _0xc702ca[_0xbbc8('0x1a')](_0x1c4b00)['end']();};}function respondWithResult(_0x290045,_0x2add43){_0x2add43=_0x2add43||0xc8;return function(_0x1c76df){if(_0x1c76df){return _0x290045[_0xbbc8('0x1a')](_0x2add43)[_0xbbc8('0x1b')](_0x1c76df);}};}function respondWithFilteredResult(_0x1e9c27,_0x292cc2){return function(_0x1cd58e){if(_0x1cd58e){var _0x38bf2f=typeof _0x292cc2[_0xbbc8('0x1c')]===_0xbbc8('0x1d')&&typeof _0x292cc2[_0xbbc8('0x1e')]===_0xbbc8('0x1d');var _0x21a44b=_0x1cd58e['count'];var _0xc9a328=_0x38bf2f?0x0:_0x292cc2[_0xbbc8('0x1c')];var _0x38e642=_0x38bf2f?_0x1cd58e[_0xbbc8('0x1f')]:_0x292cc2['offset']+_0x292cc2[_0xbbc8('0x1e')];var _0x4f754f;if(_0x38e642>=_0x21a44b){_0x38e642=_0x21a44b;_0x4f754f=0xc8;}else{_0x4f754f=0xce;}_0x1e9c27[_0xbbc8('0x1a')](_0x4f754f);return _0x1e9c27[_0xbbc8('0x20')]('Content-Range',_0xc9a328+'-'+_0x38e642+'/'+_0x21a44b)[_0xbbc8('0x1b')](_0x1cd58e);}return null;};}function patchUpdates(_0x1f7576){return function(_0x14b069){try{jsonpatch[_0xbbc8('0x21')](_0x14b069,_0x1f7576,!![]);}catch(_0x1ec180){return BPromise[_0xbbc8('0x22')](_0x1ec180);}return _0x14b069[_0xbbc8('0x23')]();};}function saveUpdates(_0x58d198,_0x14af5b){return function(_0x5a1e00){if(_0x5a1e00){return _0x5a1e00[_0xbbc8('0x24')](_0x58d198)[_0xbbc8('0x25')](function(_0x3f22f2){return _0x3f22f2;});}return null;};}function removeEntity(_0x37acb1,_0x354312){return function(_0x521c11){if(_0x521c11){return _0x521c11[_0xbbc8('0x26')]()[_0xbbc8('0x25')](function(){var _0x572940=_0x521c11['get']({'plain':!![]});var _0x4fba6e=_0xbbc8('0x27');return db[_0xbbc8('0x28')][_0xbbc8('0x26')]({'where':{'type':_0x4fba6e,'resourceId':_0x572940['id']}})[_0xbbc8('0x25')](function(){return _0x521c11;});})[_0xbbc8('0x25')](function(){_0x37acb1[_0xbbc8('0x1a')](0xcc)[_0xbbc8('0x29')]();});}};}function handleEntityNotFound(_0xb8bea0,_0x5bf78e){return function(_0x226028){if(!_0x226028){_0xb8bea0[_0xbbc8('0x2a')](0x194);}return _0x226028;};}function handleError(_0x2e7060,_0x50f61d){_0x50f61d=_0x50f61d||0x1f4;return function(_0x186572){logger[_0xbbc8('0x2b')](_0x186572['stack']);if(_0x186572[_0xbbc8('0x2c')]){delete _0x186572['name'];}_0x2e7060['status'](_0x50f61d)[_0xbbc8('0x2d')](_0x186572);};}function getMustacheRender(_0x34a8f1,_0xec7e05){return Mustache[_0xbbc8('0x2e')](_0x34a8f1,_[_0xbbc8('0x2f')](_0xec7e05[_0xbbc8('0x30')],{'contact':_0xec7e05['contact'],'message':_0xec7e05['message'],'agent':_0xec7e05[_0xbbc8('0x31')],'interaction':_0xec7e05[_0xbbc8('0x32')],'account':_0xec7e05[_0xbbc8('0x33')]}))||'';}exports['index']=function(_0x296cfc,_0x2db1ea){var _0x42a658={},_0x361d6a={},_0x2a4061={'count':0x0,'rows':[]};var _0x243dad=_[_0xbbc8('0x34')](db[_0xbbc8('0x35')][_0xbbc8('0x36')],function(_0x14eb32){return{'name':_0x14eb32[_0xbbc8('0x37')],'type':_0x14eb32['type'][_0xbbc8('0x38')]};});_0x361d6a[_0xbbc8('0x39')]=_[_0xbbc8('0x34')](_0x243dad,_0xbbc8('0x2c'));_0x361d6a[_0xbbc8('0x3a')]=_[_0xbbc8('0x3b')](_0x296cfc[_0xbbc8('0x3a')]);_0x361d6a[_0xbbc8('0x3c')]=_[_0xbbc8('0x3d')](_0x361d6a[_0xbbc8('0x39')],_0x361d6a['query']);_0x42a658[_0xbbc8('0x3e')]=_[_0xbbc8('0x3d')](_0x361d6a[_0xbbc8('0x39')],qs[_0xbbc8('0x3f')](_0x296cfc[_0xbbc8('0x3a')][_0xbbc8('0x3f')]));_0x42a658['attributes']=_0x42a658[_0xbbc8('0x3e')][_0xbbc8('0x40')]?_0x42a658[_0xbbc8('0x3e')]:_0x361d6a[_0xbbc8('0x39')];if(!_0x296cfc['query'][_0xbbc8('0x41')](_0xbbc8('0x42'))){_0x42a658[_0xbbc8('0x1e')]=qs[_0xbbc8('0x1e')](_0x296cfc[_0xbbc8('0x3a')]['limit']);_0x42a658[_0xbbc8('0x1c')]=qs[_0xbbc8('0x1c')](_0x296cfc[_0xbbc8('0x3a')][_0xbbc8('0x1c')]);}_0x42a658['order']=qs['sort'](_0x296cfc[_0xbbc8('0x3a')]['sort']);_0x42a658[_0xbbc8('0x43')]=qs[_0xbbc8('0x3c')](_[_0xbbc8('0x44')](_0x296cfc['query'],_0x361d6a[_0xbbc8('0x3c')]),_0x243dad);if(_0x296cfc['query']['filter']){_0x42a658[_0xbbc8('0x43')]=_[_0xbbc8('0x2f')](_0x42a658['where'],{'$or':_[_0xbbc8('0x34')](_0x243dad,function(_0x19580a){if(_0x19580a['type']!==_0xbbc8('0x45')){var _0x2abe67={};_0x2abe67[_0x19580a[_0xbbc8('0x2c')]]={'$like':'%'+_0x296cfc['query'][_0xbbc8('0x46')]+'%'};return _0x2abe67;}})});}_0x42a658=_[_0xbbc8('0x2f')]({},_0x42a658,_0x296cfc[_0xbbc8('0x47')]);var _0x4852a4={'where':_0x42a658[_0xbbc8('0x43')]};return db[_0xbbc8('0x35')][_0xbbc8('0x1f')](_0x4852a4)[_0xbbc8('0x25')](function(_0xdf92){_0x2a4061[_0xbbc8('0x1f')]=_0xdf92;if(_0x296cfc['query'][_0xbbc8('0x48')]){_0x42a658[_0xbbc8('0x49')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xbbc8('0x4a')](_0x42a658);})[_0xbbc8('0x25')](function(_0x243321){_0x2a4061['rows']=_0x243321;return _0x2a4061;})[_0xbbc8('0x25')](respondWithFilteredResult(_0x2db1ea,_0x42a658))[_0xbbc8('0x4b')](handleError(_0x2db1ea,null));};exports[_0xbbc8('0x4c')]=function(_0x5a89be,_0x1ae7db){var _0x5763f7={'raw':!![],'where':{'id':_0x5a89be[_0xbbc8('0x4d')]['id']}},_0x38f338={};_0x38f338[_0xbbc8('0x39')]=_['keys'](db[_0xbbc8('0x35')][_0xbbc8('0x36')]);_0x38f338[_0xbbc8('0x3a')]=_['keys'](_0x5a89be[_0xbbc8('0x3a')]);_0x38f338[_0xbbc8('0x3c')]=_[_0xbbc8('0x3d')](_0x38f338[_0xbbc8('0x39')],_0x38f338[_0xbbc8('0x3a')]);_0x5763f7['attributes']=_[_0xbbc8('0x3d')](_0x38f338['model'],qs[_0xbbc8('0x3f')](_0x5a89be[_0xbbc8('0x3a')]['fields']));_0x5763f7['attributes']=_0x5763f7[_0xbbc8('0x3e')]['length']?_0x5763f7[_0xbbc8('0x3e')]:_0x38f338[_0xbbc8('0x39')];if(_0x5a89be[_0xbbc8('0x3a')][_0xbbc8('0x48')]){_0x5763f7[_0xbbc8('0x49')]=[{'all':!![]}];}_0x5763f7=_[_0xbbc8('0x2f')]({},_0x5763f7,_0x5a89be[_0xbbc8('0x47')]);return db['AnalyticMetric'][_0xbbc8('0x4e')](_0x5763f7)[_0xbbc8('0x25')](handleEntityNotFound(_0x1ae7db,null))['then'](respondWithResult(_0x1ae7db,null))['catch'](handleError(_0x1ae7db,null));};exports[_0xbbc8('0x4f')]=function(_0x4bd7dd,_0x1556e){return db[_0xbbc8('0x35')][_0xbbc8('0x4f')](_0x4bd7dd[_0xbbc8('0x30')],{})[_0xbbc8('0x25')](function(_0x1efc2f){var _0xc0feec=_0x4bd7dd[_0xbbc8('0x50')][_0xbbc8('0x51')]({'plain':!![]});if(!_0xc0feec)throw new Error(_0xbbc8('0x52'));if(_0xc0feec[_0xbbc8('0x53')]==='user'){var _0x44510b=_0x1efc2f[_0xbbc8('0x51')]({'plain':!![]});var _0x241b89=_0xbbc8('0x27');return db[_0xbbc8('0x54')][_0xbbc8('0x4e')]({'where':{'name':_0x241b89,'userProfileId':_0xc0feec[_0xbbc8('0x55')]},'raw':!![]})[_0xbbc8('0x25')](function(_0x52d5a2){if(_0x52d5a2&&_0x52d5a2[_0xbbc8('0x56')]===0x0){return db[_0xbbc8('0x28')][_0xbbc8('0x4f')]({'name':_0x44510b[_0xbbc8('0x2c')],'resourceId':_0x44510b['id'],'type':_0x52d5a2[_0xbbc8('0x2c')],'sectionId':_0x52d5a2['id']},{})['then'](function(){return _0x1efc2f;});}else{return _0x1efc2f;}})[_0xbbc8('0x4b')](function(_0x489ad3){logger[_0xbbc8('0x2b')](_0xbbc8('0x57'),_0x489ad3);throw _0x489ad3;});}return _0x1efc2f;})[_0xbbc8('0x25')](respondWithResult(_0x1556e,0xc9))['catch'](handleError(_0x1556e,null));};exports[_0xbbc8('0x24')]=function(_0x56e79f,_0x27dfb0){if(_0x56e79f['body']['id']){delete _0x56e79f[_0xbbc8('0x30')]['id'];}return db[_0xbbc8('0x35')][_0xbbc8('0x4e')]({'where':{'id':_0x56e79f[_0xbbc8('0x4d')]['id']}})[_0xbbc8('0x25')](handleEntityNotFound(_0x27dfb0,null))[_0xbbc8('0x25')](saveUpdates(_0x56e79f[_0xbbc8('0x30')],null))[_0xbbc8('0x25')](respondWithResult(_0x27dfb0,null))[_0xbbc8('0x4b')](handleError(_0x27dfb0,null));};exports[_0xbbc8('0x26')]=function(_0x4a5db5,_0x24add2){return db['AnalyticMetric']['find']({'where':{'id':_0x4a5db5[_0xbbc8('0x4d')]['id']}})[_0xbbc8('0x25')](handleEntityNotFound(_0x24add2,null))[_0xbbc8('0x25')](removeEntity(_0x24add2,null))[_0xbbc8('0x4b')](handleError(_0x24add2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ccd7c8a..2a7d1dc 100644 --- a/server/api/analyticMetric/analyticMetric.model.js +++ b/server/api/analyticMetric/analyticMetric.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce36=['path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0xce36,0x96));var _0x6ce3=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xce36[_0x291d3f];return _0x242080;};'use strict';var _=require(_0x6ce3('0x0'));var util=require(_0x6ce3('0x1'));var logger=require(_0x6ce3('0x2'))('api');var moment=require(_0x6ce3('0x3'));var BPromise=require(_0x6ce3('0x4'));var rp=require(_0x6ce3('0x5'));var fs=require('fs');var path=require(_0x6ce3('0x6'));var rimraf=require(_0x6ce3('0x7'));var config=require(_0x6ce3('0x8'));var attributes=require(_0x6ce3('0x9'));module[_0x6ce3('0xa')]=function(_0x4a6dc9,_0x56e17b){return _0x4a6dc9[_0x6ce3('0xb')]('AnalyticMetric',attributes,{'tableName':_0x6ce3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e86=['AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','define'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x2e86,0x1ba));var _0x62e8=function(_0x5ea8ab,_0x355758){_0x5ea8ab=_0x5ea8ab-0x0;var _0x2bb550=_0x2e86[_0x5ea8ab];return _0x2bb550;};'use strict';var _=require(_0x62e8('0x0'));var util=require(_0x62e8('0x1'));var logger=require(_0x62e8('0x2'))(_0x62e8('0x3'));var moment=require(_0x62e8('0x4'));var BPromise=require(_0x62e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62e8('0x6'));var rimraf=require('rimraf');var config=require(_0x62e8('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x10e2e2,_0x370741){return _0x10e2e2[_0x62e8('0x8')](_0x62e8('0x9'),attributes,{'tableName':_0x62e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 600b3da..aec3e3c 100644 --- a/server/api/analyticMetric/analyticMetric.rpc.js +++ b/server/api/analyticMetric/analyticMetric.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4ca=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x53385d,_0x2fa75d){var _0x2a6624=function(_0x5d1eb5){while(--_0x5d1eb5){_0x53385d['push'](_0x53385d['shift']());}};_0x2a6624(++_0x2fa75d);}(_0xe4ca,0x79));var _0xae4c=function(_0x4bf5f6,_0x44e324){_0x4bf5f6=_0x4bf5f6-0x0;var _0x21c97e=_0xe4ca[_0x4bf5f6];return _0x21c97e;};'use strict';var _=require(_0xae4c('0x0'));var util=require(_0xae4c('0x1'));var moment=require(_0xae4c('0x2'));var BPromise=require(_0xae4c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae4c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae4c('0x5'));var logger=require(_0xae4c('0x6'))('rpc');var config=require(_0xae4c('0x7'));var jayson=require(_0xae4c('0x8'));var client=jayson[_0xae4c('0x9')][_0xae4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x260781,_0x611435,_0x48ab36){return new BPromise(function(_0x58a14d,_0x34d06d){return client[_0xae4c('0xb')](_0x260781,_0x48ab36)[_0xae4c('0xc')](function(_0x5d78e8){logger[_0xae4c('0xd')](_0xae4c('0xe'),_0x611435,_0xae4c('0xf'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x611435,'request\x20sent',JSON[_0xae4c('0x10')](_0x5d78e8));if(_0x5d78e8['error']){if(_0x5d78e8[_0xae4c('0x11')][_0xae4c('0x12')]===0x1f4){logger[_0xae4c('0x11')](_0xae4c('0xe'),_0x611435,_0x5d78e8['error']['message']);return _0x34d06d(_0x5d78e8['error'][_0xae4c('0x13')]);}logger[_0xae4c('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x611435,_0x5d78e8[_0xae4c('0x11')][_0xae4c('0x13')]);return _0x58a14d(_0x5d78e8[_0xae4c('0x11')][_0xae4c('0x13')]);}else{logger[_0xae4c('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x611435,_0xae4c('0xf'));_0x58a14d(_0x5d78e8[_0xae4c('0x14')]['message']);}})['catch'](function(_0x487b6a){logger[_0xae4c('0x11')](_0xae4c('0xe'),_0x611435,_0x487b6a);_0x34d06d(_0x487b6a);});});} \ No newline at end of file +var _0xb344=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','request','then'];(function(_0x4d92bd,_0x515717){var _0x17e175=function(_0x182133){while(--_0x182133){_0x4d92bd['push'](_0x4d92bd['shift']());}};_0x17e175(++_0x515717);}(_0xb344,0x117));var _0x4b34=function(_0x406459,_0x2a5eae){_0x406459=_0x406459-0x0;var _0x6895c3=_0xb344[_0x406459];return _0x6895c3;};'use strict';var _=require('lodash');var util=require(_0x4b34('0x0'));var moment=require(_0x4b34('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b34('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4b34('0x4'));var jayson=require(_0x4b34('0x5'));var client=jayson[_0x4b34('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d6fa,_0x5a9a87,_0x533035){return new BPromise(function(_0x3f5558,_0x10cd45){return client[_0x4b34('0x7')](_0x13d6fa,_0x533035)[_0x4b34('0x8')](function(_0x7d5320){logger['info'](_0x4b34('0x9'),_0x5a9a87,_0x4b34('0xa'));logger[_0x4b34('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5a9a87,_0x4b34('0xa'),JSON['stringify'](_0x7d5320));if(_0x7d5320[_0x4b34('0xc')]){if(_0x7d5320[_0x4b34('0xc')][_0x4b34('0xd')]===0x1f4){logger[_0x4b34('0xc')](_0x4b34('0x9'),_0x5a9a87,_0x7d5320['error'][_0x4b34('0xe')]);return _0x10cd45(_0x7d5320[_0x4b34('0xc')][_0x4b34('0xe')]);}logger[_0x4b34('0xc')](_0x4b34('0x9'),_0x5a9a87,_0x7d5320[_0x4b34('0xc')]['message']);return _0x3f5558(_0x7d5320[_0x4b34('0xc')][_0x4b34('0xe')]);}else{logger['info'](_0x4b34('0x9'),_0x5a9a87,'request\x20sent');_0x3f5558(_0x7d5320['result'][_0x4b34('0xe')]);}})[_0x4b34('0xf')](function(_0x8694d7){logger[_0x4b34('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x5a9a87,_0x8694d7);_0x10cd45(_0x8694d7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 30d8352..8507552 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x5a2436,_0x11375a){var _0x2d8468=function(_0x5b77b9){while(--_0x5b77b9){_0x5a2436['push'](_0x5a2436['shift']());}};_0x2d8468(++_0x11375a);}(_0xda3f,0xec));var _0xfda3=function(_0xeb4909,_0xe3946a){_0xeb4909=_0xeb4909-0x0;var _0x4b9835=_0xda3f[_0xeb4909];return _0x4b9835;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./analyticMetric.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0x4fc2,0x111));var _0x24fc=function(_0xfc5de,_0x210af9){_0xfc5de=_0xfc5de-0x0;var _0x25ece8=_0x4fc2[_0xfc5de];return _0x25ece8;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5d25491..8cddb5a 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cd8=['exports','TEXT'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x5cd8,0xf4));var _0x85cd=function(_0x5517c7,_0x14e9ba){_0x5517c7=_0x5517c7-0x0;var _0x13832d=_0x5cd8[_0x5517c7];return _0x13832d;};'use strict';var Sequelize=require('sequelize');module[_0x85cd('0x0')]={'tree':{'type':Sequelize[_0x85cd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x78a6=['sequelize','exports','TEXT'];(function(_0x6cfb82,_0x2ab126){var _0x445663=function(_0x102c4d){while(--_0x102c4d){_0x6cfb82['push'](_0x6cfb82['shift']());}};_0x445663(++_0x2ab126);}(_0x78a6,0x1ce));var _0x678a=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x78a6[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x678a('0x0'));module[_0x678a('0x1')]={'tree':{'type':Sequelize[_0x678a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index eda27d0..a5ec187 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.controller.js +++ b/server/api/analyticTreeReport/analyticTreeReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb612=['length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','include','create','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','render','body','contact','message','agent','interaction','account','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xb612,0x1a7));var _0x2b61=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0xb612[_0x5eb442];return _0x53aad0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b61('0x0'));var zipdir=require(_0x2b61('0x1'));var jsonpatch=require(_0x2b61('0x2'));var rp=require(_0x2b61('0x3'));var moment=require(_0x2b61('0x4'));var BPromise=require(_0x2b61('0x5'));var Mustache=require(_0x2b61('0x6'));var util=require(_0x2b61('0x7'));var path=require(_0x2b61('0x8'));var sox=require('sox');var csv=require(_0x2b61('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b61('0xa'));var _=require(_0x2b61('0xb'));var squel=require(_0x2b61('0xc'));var crypto=require(_0x2b61('0xd'));var jsforce=require(_0x2b61('0xe'));var deskjs=require(_0x2b61('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2b61('0x10'));var Papa=require(_0x2b61('0x11'));var Redis=require(_0x2b61('0x12'));var authService=require(_0x2b61('0x13'));var qs=require(_0x2b61('0x14'));var as=require(_0x2b61('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b61('0x16'))('api');var utils=require(_0x2b61('0x17'));var config=require(_0x2b61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b61('0x19'))['db'];function respondWithStatusCode(_0x532b91,_0xc4f55b){_0xc4f55b=_0xc4f55b||0xcc;return function(_0x298b8f){if(_0x298b8f){return _0x532b91[_0x2b61('0x1a')](_0xc4f55b);}return _0x532b91[_0x2b61('0x1b')](_0xc4f55b)['end']();};}function respondWithResult(_0x1190b5,_0x33d8ef){_0x33d8ef=_0x33d8ef||0xc8;return function(_0x550b5a){if(_0x550b5a){return _0x1190b5[_0x2b61('0x1b')](_0x33d8ef)[_0x2b61('0x1c')](_0x550b5a);}};}function respondWithFilteredResult(_0x45e460,_0xd11119){return function(_0xd6d128){if(_0xd6d128){var _0x3a3a58=typeof _0xd11119[_0x2b61('0x1d')]==='undefined'&&typeof _0xd11119[_0x2b61('0x1e')]===_0x2b61('0x1f');var _0x56c9c8=_0xd6d128[_0x2b61('0x20')];var _0x2263a0=_0x3a3a58?0x0:_0xd11119[_0x2b61('0x1d')];var _0x4de149=_0x3a3a58?_0xd6d128[_0x2b61('0x20')]:_0xd11119[_0x2b61('0x1d')]+_0xd11119[_0x2b61('0x1e')];var _0x2df3f4;if(_0x4de149>=_0x56c9c8){_0x4de149=_0x56c9c8;_0x2df3f4=0xc8;}else{_0x2df3f4=0xce;}_0x45e460[_0x2b61('0x1b')](_0x2df3f4);return _0x45e460[_0x2b61('0x21')](_0x2b61('0x22'),_0x2263a0+'-'+_0x4de149+'/'+_0x56c9c8)['json'](_0xd6d128);}return null;};}function patchUpdates(_0x51a94b){return function(_0x49875b){try{jsonpatch[_0x2b61('0x23')](_0x49875b,_0x51a94b,!![]);}catch(_0x3bd8ae){return BPromise[_0x2b61('0x24')](_0x3bd8ae);}return _0x49875b[_0x2b61('0x25')]();};}function saveUpdates(_0x1a9e63,_0x3dd5e5){return function(_0x10b7b8){if(_0x10b7b8){return _0x10b7b8[_0x2b61('0x26')](_0x1a9e63)[_0x2b61('0x27')](function(_0x424c05){return _0x424c05;});}return null;};}function removeEntity(_0x6a20eb,_0x10f270){return function(_0x91d695){if(_0x91d695){return _0x91d695['destroy']()['then'](function(){_0x6a20eb[_0x2b61('0x1b')](0xcc)[_0x2b61('0x28')]();});}};}function handleEntityNotFound(_0x13bff7,_0x143294){return function(_0xdf8345){if(!_0xdf8345){_0x13bff7['sendStatus'](0x194);}return _0xdf8345;};}function handleError(_0x2d843d,_0x37729a){_0x37729a=_0x37729a||0x1f4;return function(_0x11c8d4){logger['error'](_0x11c8d4[_0x2b61('0x29')]);if(_0x11c8d4[_0x2b61('0x2a')]){delete _0x11c8d4[_0x2b61('0x2a')];}_0x2d843d['status'](_0x37729a)[_0x2b61('0x2b')](_0x11c8d4);};}function getMustacheRender(_0x33fe5c,_0x43a317){return Mustache[_0x2b61('0x2c')](_0x33fe5c,_['merge'](_0x43a317[_0x2b61('0x2d')],{'contact':_0x43a317[_0x2b61('0x2e')],'message':_0x43a317[_0x2b61('0x2f')],'agent':_0x43a317[_0x2b61('0x30')],'interaction':_0x43a317[_0x2b61('0x31')],'account':_0x43a317[_0x2b61('0x32')]}))||'';}exports['index']=function(_0x190b0f,_0x5900c5){var _0x17ed56={},_0x555d9b={},_0x4823e1={'count':0x0,'rows':[]};var _0x1fef16=_[_0x2b61('0x33')](db[_0x2b61('0x34')][_0x2b61('0x35')],function(_0x432765){return{'name':_0x432765[_0x2b61('0x36')],'type':_0x432765[_0x2b61('0x37')][_0x2b61('0x38')]};});_0x555d9b[_0x2b61('0x39')]=_[_0x2b61('0x33')](_0x1fef16,_0x2b61('0x2a'));_0x555d9b[_0x2b61('0x3a')]=_[_0x2b61('0x3b')](_0x190b0f['query']);_0x555d9b['filters']=_[_0x2b61('0x3c')](_0x555d9b['model'],_0x555d9b[_0x2b61('0x3a')]);_0x17ed56['attributes']=_['intersection'](_0x555d9b[_0x2b61('0x39')],qs['fields'](_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x3d')]));_0x17ed56[_0x2b61('0x3e')]=_0x17ed56[_0x2b61('0x3e')][_0x2b61('0x3f')]?_0x17ed56[_0x2b61('0x3e')]:_0x555d9b['model'];if(!_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x40')](_0x2b61('0x41'))){_0x17ed56[_0x2b61('0x1e')]=qs[_0x2b61('0x1e')](_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x1e')]);_0x17ed56['offset']=qs[_0x2b61('0x1d')](_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x1d')]);}_0x17ed56['order']=qs[_0x2b61('0x42')](_0x190b0f[_0x2b61('0x3a')]['sort']);_0x17ed56['where']=qs['filters'](_['pick'](_0x190b0f[_0x2b61('0x3a')],_0x555d9b[_0x2b61('0x43')]),_0x1fef16);if(_0x190b0f['query'][_0x2b61('0x44')]){_0x17ed56[_0x2b61('0x45')]=_['merge'](_0x17ed56['where'],{'$or':_[_0x2b61('0x33')](_0x1fef16,function(_0x3ecaf0){if(_0x3ecaf0['type']!==_0x2b61('0x46')){var _0x325c2a={};_0x325c2a[_0x3ecaf0['name']]={'$like':'%'+_0x190b0f[_0x2b61('0x3a')][_0x2b61('0x44')]+'%'};return _0x325c2a;}})});}_0x17ed56=_[_0x2b61('0x47')]({},_0x17ed56,_0x190b0f[_0x2b61('0x48')]);var _0x288149={'where':_0x17ed56[_0x2b61('0x45')]};return db[_0x2b61('0x34')][_0x2b61('0x20')](_0x288149)['then'](function(_0x468e52){_0x4823e1[_0x2b61('0x20')]=_0x468e52;if(_0x190b0f['query'][_0x2b61('0x49')]){_0x17ed56['include']=[{'all':!![]}];}return db[_0x2b61('0x34')][_0x2b61('0x4a')](_0x17ed56);})[_0x2b61('0x27')](function(_0x27b197){_0x4823e1[_0x2b61('0x4b')]=_0x27b197;return _0x4823e1;})[_0x2b61('0x27')](respondWithFilteredResult(_0x5900c5,_0x17ed56))[_0x2b61('0x4c')](handleError(_0x5900c5,null));};exports['show']=function(_0x1ee809,_0x3f65a9){var _0x431bbb={'raw':!![],'where':{'id':_0x1ee809['params']['id']}},_0xfc56a2={};_0xfc56a2[_0x2b61('0x39')]=_[_0x2b61('0x3b')](db['AnalyticTreeReport']['rawAttributes']);_0xfc56a2[_0x2b61('0x3a')]=_[_0x2b61('0x3b')](_0x1ee809[_0x2b61('0x3a')]);_0xfc56a2[_0x2b61('0x43')]=_[_0x2b61('0x3c')](_0xfc56a2[_0x2b61('0x39')],_0xfc56a2[_0x2b61('0x3a')]);_0x431bbb[_0x2b61('0x3e')]=_['intersection'](_0xfc56a2[_0x2b61('0x39')],qs[_0x2b61('0x3d')](_0x1ee809[_0x2b61('0x3a')][_0x2b61('0x3d')]));_0x431bbb[_0x2b61('0x3e')]=_0x431bbb['attributes']['length']?_0x431bbb['attributes']:_0xfc56a2[_0x2b61('0x39')];if(_0x1ee809[_0x2b61('0x3a')][_0x2b61('0x49')]){_0x431bbb[_0x2b61('0x4d')]=[{'all':!![]}];}_0x431bbb=_[_0x2b61('0x47')]({},_0x431bbb,_0x1ee809[_0x2b61('0x48')]);return db[_0x2b61('0x34')]['find'](_0x431bbb)[_0x2b61('0x27')](handleEntityNotFound(_0x3f65a9,null))[_0x2b61('0x27')](respondWithResult(_0x3f65a9,null))[_0x2b61('0x4c')](handleError(_0x3f65a9,null));};exports['create']=function(_0x5344a7,_0x4e2b3f){return db['AnalyticTreeReport'][_0x2b61('0x4e')](_0x5344a7['body'],{})[_0x2b61('0x27')](respondWithResult(_0x4e2b3f,0xc9))[_0x2b61('0x4c')](handleError(_0x4e2b3f,null));};exports[_0x2b61('0x26')]=function(_0x168911,_0x527fa7){if(_0x168911[_0x2b61('0x2d')]['id']){delete _0x168911[_0x2b61('0x2d')]['id'];}return db[_0x2b61('0x34')]['find']({'where':{'id':_0x168911[_0x2b61('0x4f')]['id']}})[_0x2b61('0x27')](handleEntityNotFound(_0x527fa7,null))[_0x2b61('0x27')](saveUpdates(_0x168911[_0x2b61('0x2d')],null))['then'](respondWithResult(_0x527fa7,null))['catch'](handleError(_0x527fa7,null));};exports[_0x2b61('0x50')]=function(_0xe62f97,_0x4edb5f){return db[_0x2b61('0x34')]['find']({'where':{'id':_0xe62f97[_0x2b61('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4edb5f,null))[_0x2b61('0x27')](removeEntity(_0x4edb5f,null))[_0x2b61('0x4c')](handleError(_0x4edb5f,null));}; \ No newline at end of file +var _0x37f5=['undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','merge','body','contact','message','agent','interaction','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','sort','filter','where','VIRTUAL','options','include','then','rows','catch','fields','includeAll','find','create','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x37f5,0xd0));var _0x537f=function(_0x489ba0,_0x50eb73){_0x489ba0=_0x489ba0-0x0;var _0x3ecd6e=_0x37f5[_0x489ba0];return _0x3ecd6e;};'use strict';var emlformat=require(_0x537f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x537f('0x1'));var jsonpatch=require(_0x537f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x537f('0x3'));var Mustache=require(_0x537f('0x4'));var util=require(_0x537f('0x5'));var path=require(_0x537f('0x6'));var sox=require(_0x537f('0x7'));var csv=require(_0x537f('0x8'));var ejs=require(_0x537f('0x9'));var fs=require('fs');var fs_extra=require(_0x537f('0xa'));var _=require(_0x537f('0xb'));var squel=require(_0x537f('0xc'));var crypto=require(_0x537f('0xd'));var jsforce=require(_0x537f('0xe'));var deskjs=require(_0x537f('0xf'));var toCsv=require(_0x537f('0x8'));var querystring=require('querystring');var Papa=require(_0x537f('0x10'));var Redis=require(_0x537f('0x11'));var authService=require(_0x537f('0x12'));var qs=require(_0x537f('0x13'));var as=require(_0x537f('0x14'));var hardwareService=require(_0x537f('0x15'));var logger=require(_0x537f('0x16'))(_0x537f('0x17'));var utils=require(_0x537f('0x18'));var config=require(_0x537f('0x19'));var licenseUtil=require(_0x537f('0x1a'));var db=require(_0x537f('0x1b'))['db'];function respondWithStatusCode(_0x484e40,_0x2fb578){_0x2fb578=_0x2fb578||0xcc;return function(_0x18f53b){if(_0x18f53b){return _0x484e40['sendStatus'](_0x2fb578);}return _0x484e40[_0x537f('0x1c')](_0x2fb578)[_0x537f('0x1d')]();};}function respondWithResult(_0x13e3a5,_0x854237){_0x854237=_0x854237||0xc8;return function(_0x2e8fc5){if(_0x2e8fc5){return _0x13e3a5[_0x537f('0x1c')](_0x854237)[_0x537f('0x1e')](_0x2e8fc5);}};}function respondWithFilteredResult(_0x50ca09,_0xb87f41){return function(_0x165350){if(_0x165350){var _0x368f9e=typeof _0xb87f41[_0x537f('0x1f')]===_0x537f('0x20')&&typeof _0xb87f41[_0x537f('0x21')]===_0x537f('0x20');var _0xd84d8e=_0x165350[_0x537f('0x22')];var _0x2966d0=_0x368f9e?0x0:_0xb87f41[_0x537f('0x1f')];var _0x4f2e3a=_0x368f9e?_0x165350['count']:_0xb87f41[_0x537f('0x1f')]+_0xb87f41['limit'];var _0x342e20;if(_0x4f2e3a>=_0xd84d8e){_0x4f2e3a=_0xd84d8e;_0x342e20=0xc8;}else{_0x342e20=0xce;}_0x50ca09[_0x537f('0x1c')](_0x342e20);return _0x50ca09[_0x537f('0x23')](_0x537f('0x24'),_0x2966d0+'-'+_0x4f2e3a+'/'+_0xd84d8e)[_0x537f('0x1e')](_0x165350);}return null;};}function patchUpdates(_0x597fbb){return function(_0x2ef415){try{jsonpatch[_0x537f('0x25')](_0x2ef415,_0x597fbb,!![]);}catch(_0xd205ff){return BPromise[_0x537f('0x26')](_0xd205ff);}return _0x2ef415[_0x537f('0x27')]();};}function saveUpdates(_0x42c36e,_0x398ca8){return function(_0x1a8cd1){if(_0x1a8cd1){return _0x1a8cd1[_0x537f('0x28')](_0x42c36e)['then'](function(_0x3202c4){return _0x3202c4;});}return null;};}function removeEntity(_0x1a94fa,_0x954dac){return function(_0x2e42fd){if(_0x2e42fd){return _0x2e42fd[_0x537f('0x29')]()['then'](function(){_0x1a94fa[_0x537f('0x1c')](0xcc)[_0x537f('0x1d')]();});}};}function handleEntityNotFound(_0x334727,_0x384e5e){return function(_0x4e18b1){if(!_0x4e18b1){_0x334727[_0x537f('0x2a')](0x194);}return _0x4e18b1;};}function handleError(_0x4e7903,_0x7496a8){_0x7496a8=_0x7496a8||0x1f4;return function(_0x342aec){logger[_0x537f('0x2b')](_0x342aec[_0x537f('0x2c')]);if(_0x342aec[_0x537f('0x2d')]){delete _0x342aec[_0x537f('0x2d')];}_0x4e7903['status'](_0x7496a8)[_0x537f('0x2e')](_0x342aec);};}function getMustacheRender(_0x5c9ec9,_0x5ce583){return Mustache['render'](_0x5c9ec9,_[_0x537f('0x2f')](_0x5ce583[_0x537f('0x30')],{'contact':_0x5ce583[_0x537f('0x31')],'message':_0x5ce583[_0x537f('0x32')],'agent':_0x5ce583[_0x537f('0x33')],'interaction':_0x5ce583[_0x537f('0x34')],'account':_0x5ce583['account']}))||'';}exports['index']=function(_0x1a6a0e,_0x468ab3){var _0x15e3c7={},_0xe9a8dd={},_0x2b9b07={'count':0x0,'rows':[]};var _0x243234=_[_0x537f('0x35')](db[_0x537f('0x36')][_0x537f('0x37')],function(_0x83a255){return{'name':_0x83a255[_0x537f('0x38')],'type':_0x83a255[_0x537f('0x39')][_0x537f('0x3a')]};});_0xe9a8dd[_0x537f('0x3b')]=_[_0x537f('0x35')](_0x243234,_0x537f('0x2d'));_0xe9a8dd[_0x537f('0x3c')]=_[_0x537f('0x3d')](_0x1a6a0e[_0x537f('0x3c')]);_0xe9a8dd[_0x537f('0x3e')]=_[_0x537f('0x3f')](_0xe9a8dd[_0x537f('0x3b')],_0xe9a8dd['query']);_0x15e3c7['attributes']=_[_0x537f('0x3f')](_0xe9a8dd[_0x537f('0x3b')],qs['fields'](_0x1a6a0e[_0x537f('0x3c')]['fields']));_0x15e3c7['attributes']=_0x15e3c7[_0x537f('0x40')][_0x537f('0x41')]?_0x15e3c7[_0x537f('0x40')]:_0xe9a8dd[_0x537f('0x3b')];if(!_0x1a6a0e[_0x537f('0x3c')]['hasOwnProperty']('nolimit')){_0x15e3c7[_0x537f('0x21')]=qs['limit'](_0x1a6a0e[_0x537f('0x3c')][_0x537f('0x21')]);_0x15e3c7[_0x537f('0x1f')]=qs[_0x537f('0x1f')](_0x1a6a0e[_0x537f('0x3c')][_0x537f('0x1f')]);}_0x15e3c7['order']=qs[_0x537f('0x42')](_0x1a6a0e[_0x537f('0x3c')][_0x537f('0x42')]);_0x15e3c7['where']=qs[_0x537f('0x3e')](_['pick'](_0x1a6a0e['query'],_0xe9a8dd[_0x537f('0x3e')]),_0x243234);if(_0x1a6a0e[_0x537f('0x3c')][_0x537f('0x43')]){_0x15e3c7[_0x537f('0x44')]=_['merge'](_0x15e3c7['where'],{'$or':_['map'](_0x243234,function(_0x1e2d97){if(_0x1e2d97[_0x537f('0x39')]!==_0x537f('0x45')){var _0xfb2d67={};_0xfb2d67[_0x1e2d97[_0x537f('0x2d')]]={'$like':'%'+_0x1a6a0e[_0x537f('0x3c')][_0x537f('0x43')]+'%'};return _0xfb2d67;}})});}_0x15e3c7=_[_0x537f('0x2f')]({},_0x15e3c7,_0x1a6a0e[_0x537f('0x46')]);var _0x53d89e={'where':_0x15e3c7['where']};return db[_0x537f('0x36')][_0x537f('0x22')](_0x53d89e)['then'](function(_0x1746d8){_0x2b9b07[_0x537f('0x22')]=_0x1746d8;if(_0x1a6a0e[_0x537f('0x3c')]['includeAll']){_0x15e3c7[_0x537f('0x47')]=[{'all':!![]}];}return db[_0x537f('0x36')]['findAll'](_0x15e3c7);})[_0x537f('0x48')](function(_0x5e66c5){_0x2b9b07[_0x537f('0x49')]=_0x5e66c5;return _0x2b9b07;})[_0x537f('0x48')](respondWithFilteredResult(_0x468ab3,_0x15e3c7))[_0x537f('0x4a')](handleError(_0x468ab3,null));};exports['show']=function(_0x373a46,_0x198364){var _0x5f13ee={'raw':!![],'where':{'id':_0x373a46['params']['id']}},_0x38ac7d={};_0x38ac7d[_0x537f('0x3b')]=_[_0x537f('0x3d')](db[_0x537f('0x36')][_0x537f('0x37')]);_0x38ac7d['query']=_[_0x537f('0x3d')](_0x373a46['query']);_0x38ac7d[_0x537f('0x3e')]=_['intersection'](_0x38ac7d[_0x537f('0x3b')],_0x38ac7d[_0x537f('0x3c')]);_0x5f13ee['attributes']=_[_0x537f('0x3f')](_0x38ac7d[_0x537f('0x3b')],qs[_0x537f('0x4b')](_0x373a46[_0x537f('0x3c')][_0x537f('0x4b')]));_0x5f13ee[_0x537f('0x40')]=_0x5f13ee[_0x537f('0x40')]['length']?_0x5f13ee[_0x537f('0x40')]:_0x38ac7d[_0x537f('0x3b')];if(_0x373a46[_0x537f('0x3c')][_0x537f('0x4c')]){_0x5f13ee[_0x537f('0x47')]=[{'all':!![]}];}_0x5f13ee=_[_0x537f('0x2f')]({},_0x5f13ee,_0x373a46[_0x537f('0x46')]);return db[_0x537f('0x36')][_0x537f('0x4d')](_0x5f13ee)[_0x537f('0x48')](handleEntityNotFound(_0x198364,null))[_0x537f('0x48')](respondWithResult(_0x198364,null))[_0x537f('0x4a')](handleError(_0x198364,null));};exports[_0x537f('0x4e')]=function(_0x2dc987,_0x5795de){return db[_0x537f('0x36')][_0x537f('0x4e')](_0x2dc987['body'],{})[_0x537f('0x48')](respondWithResult(_0x5795de,0xc9))[_0x537f('0x4a')](handleError(_0x5795de,null));};exports['update']=function(_0x1e5bd8,_0x769450){if(_0x1e5bd8[_0x537f('0x30')]['id']){delete _0x1e5bd8['body']['id'];}return db[_0x537f('0x36')][_0x537f('0x4d')]({'where':{'id':_0x1e5bd8['params']['id']}})[_0x537f('0x48')](handleEntityNotFound(_0x769450,null))['then'](saveUpdates(_0x1e5bd8['body'],null))[_0x537f('0x48')](respondWithResult(_0x769450,null))[_0x537f('0x4a')](handleError(_0x769450,null));};exports[_0x537f('0x29')]=function(_0x5f07e2,_0x5354fd){return db[_0x537f('0x36')][_0x537f('0x4d')]({'where':{'id':_0x5f07e2[_0x537f('0x4f')]['id']}})[_0x537f('0x48')](handleEntityNotFound(_0x5354fd,null))[_0x537f('0x48')](removeEntity(_0x5354fd,null))[_0x537f('0x4a')](handleError(_0x5354fd,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 97cb70c..e2386b4 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.model.js +++ b/server/api/analyticTreeReport/analyticTreeReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2515=['rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20c397,_0x88b803){var _0xf414db=function(_0x291557){while(--_0x291557){_0x20c397['push'](_0x20c397['shift']());}};_0xf414db(++_0x88b803);}(_0x2515,0x1c2));var _0x5251=function(_0x9b89c1,_0x2a7e4f){_0x9b89c1=_0x9b89c1-0x0;var _0xf547ae=_0x2515[_0x9b89c1];return _0xf547ae;};'use strict';var _=require(_0x5251('0x0'));var util=require(_0x5251('0x1'));var logger=require('../../config/logger')(_0x5251('0x2'));var moment=require(_0x5251('0x3'));var BPromise=require(_0x5251('0x4'));var rp=require(_0x5251('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5251('0x6'));var config=require(_0x5251('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x5251('0x8')]=function(_0xa2b768,_0x228dcd){return _0xa2b768[_0x5251('0x9')](_0x5251('0xa'),attributes,{'tableName':_0x5251('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a1c=['analytics_report_trees','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0x4d560a,_0x48d9dd){var _0x368b51=function(_0x4124a8){while(--_0x4124a8){_0x4d560a['push'](_0x4d560a['shift']());}};_0x368b51(++_0x48d9dd);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x0a1c[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc0a1('0x0'))(_0xc0a1('0x1'));var moment=require(_0xc0a1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0a1('0x3'));var rimraf=require(_0xc0a1('0x4'));var config=require(_0xc0a1('0x5'));var attributes=require(_0xc0a1('0x6'));module[_0xc0a1('0x7')]=function(_0x3549cf,_0x2eec13){return _0x3549cf[_0xc0a1('0x8')](_0xc0a1('0x9'),attributes,{'tableName':_0xc0a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 74b8caa..f342479 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e77=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e77,0x11d));var _0x77e7=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x7e77[_0x31991b];return _0x307304;};'use strict';var _=require(_0x77e7('0x0'));var util=require(_0x77e7('0x1'));var moment=require(_0x77e7('0x2'));var BPromise=require(_0x77e7('0x3'));var rs=require(_0x77e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77e7('0x5'))['db'];var utils=require(_0x77e7('0x6'));var logger=require(_0x77e7('0x7'))('rpc');var config=require(_0x77e7('0x8'));var jayson=require(_0x77e7('0x9'));var client=jayson['client'][_0x77e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f4a8b,_0x2bcbe6,_0x4808df){return new BPromise(function(_0x29d430,_0x11da39){return client[_0x77e7('0xb')](_0x3f4a8b,_0x4808df)[_0x77e7('0xc')](function(_0x5d408e){logger[_0x77e7('0xd')](_0x77e7('0xe'),_0x2bcbe6,_0x77e7('0xf'));logger[_0x77e7('0x10')](_0x77e7('0x11'),_0x2bcbe6,_0x77e7('0xf'),JSON['stringify'](_0x5d408e));if(_0x5d408e[_0x77e7('0x12')]){if(_0x5d408e[_0x77e7('0x12')]['code']===0x1f4){logger['error'](_0x77e7('0xe'),_0x2bcbe6,_0x5d408e[_0x77e7('0x12')][_0x77e7('0x13')]);return _0x11da39(_0x5d408e['error'][_0x77e7('0x13')]);}logger[_0x77e7('0x12')](_0x77e7('0xe'),_0x2bcbe6,_0x5d408e[_0x77e7('0x12')]['message']);return _0x29d430(_0x5d408e[_0x77e7('0x12')][_0x77e7('0x13')]);}else{logger[_0x77e7('0xd')](_0x77e7('0xe'),_0x2bcbe6,'request\x20sent');_0x29d430(_0x5d408e[_0x77e7('0x14')][_0x77e7('0x13')]);}})[_0x77e7('0x15')](function(_0x23da00){logger[_0x77e7('0x12')](_0x77e7('0xe'),_0x2bcbe6,_0x23da00);_0x11da39(_0x23da00);});});} \ No newline at end of file +var _0x3f30=['jayson/promise','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x3f30,0x7b));var _0x03f3=function(_0x413a30,_0x4f479d){_0x413a30=_0x413a30-0x0;var _0x217acb=_0x3f30[_0x413a30];return _0x217acb;};'use strict';var _=require(_0x03f3('0x0'));var util=require(_0x03f3('0x1'));var moment=require(_0x03f3('0x2'));var BPromise=require(_0x03f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03f3('0x4'));var db=require(_0x03f3('0x5'))['db'];var utils=require(_0x03f3('0x6'));var logger=require(_0x03f3('0x7'))('rpc');var config=require(_0x03f3('0x8'));var jayson=require(_0x03f3('0x9'));var client=jayson['client'][_0x03f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x146e5e,_0x4d12bf,_0x3d0fd4){return new BPromise(function(_0x534454,_0x51e723){return client[_0x03f3('0xb')](_0x146e5e,_0x3d0fd4)[_0x03f3('0xc')](function(_0x3dfc60){logger['info'](_0x03f3('0xd'),_0x4d12bf,'request\x20sent');logger['debug'](_0x03f3('0xe'),_0x4d12bf,'request\x20sent',JSON[_0x03f3('0xf')](_0x3dfc60));if(_0x3dfc60[_0x03f3('0x10')]){if(_0x3dfc60['error'][_0x03f3('0x11')]===0x1f4){logger['error'](_0x03f3('0xd'),_0x4d12bf,_0x3dfc60['error'][_0x03f3('0x12')]);return _0x51e723(_0x3dfc60[_0x03f3('0x10')][_0x03f3('0x12')]);}logger[_0x03f3('0x10')](_0x03f3('0xd'),_0x4d12bf,_0x3dfc60['error'][_0x03f3('0x12')]);return _0x534454(_0x3dfc60['error']['message']);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x4d12bf,_0x03f3('0x13'));_0x534454(_0x3dfc60[_0x03f3('0x14')][_0x03f3('0x12')]);}})[_0x03f3('0x15')](function(_0x2d34f7){logger['error'](_0x03f3('0xd'),_0x4d12bf,_0x2d34f7);_0x51e723(_0x2d34f7);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d317443..db2ab59 100644 --- a/server/api/analyticTreeReport/index.js +++ b/server/api/analyticTreeReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf41a=['multer','util','path','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','create','put','update','destroy'];(function(_0x1a9f23,_0x5d3401){var _0x16bf9c=function(_0x5bbd70){while(--_0x5bbd70){_0x1a9f23['push'](_0x1a9f23['shift']());}};_0x16bf9c(++_0x5d3401);}(_0xf41a,0x1d4));var _0xaf41=function(_0x15411f,_0x42bef8){_0x15411f=_0x15411f-0x0;var _0x555650=_0xf41a[_0x15411f];return _0x555650;};'use strict';var multer=require(_0xaf41('0x0'));var util=require(_0xaf41('0x1'));var path=require(_0xaf41('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xaf41('0x3'));var auth=require(_0xaf41('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xaf41('0x5')]('/',auth['isAuthenticated'](),controller[_0xaf41('0x6')]);router[_0xaf41('0x5')](_0xaf41('0x7'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xaf41('0x8')](),controller[_0xaf41('0x9')]);router[_0xaf41('0xa')](_0xaf41('0x7'),auth[_0xaf41('0x8')](),controller[_0xaf41('0xb')]);router['delete']('/:id',auth[_0xaf41('0x8')](),controller[_0xaf41('0xc')]);module['exports']=router; \ No newline at end of file +var _0xd8c1=['/:id','isAuthenticated','show','post','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index'];(function(_0x3a0be0,_0xa01590){var _0x4f8b9a=function(_0x4ff304){while(--_0x4ff304){_0x3a0be0['push'](_0x3a0be0['shift']());}};_0x4f8b9a(++_0xa01590);}(_0xd8c1,0xc5));var _0x1d8c=function(_0x532bd0,_0x3eb7ec){_0x532bd0=_0x532bd0-0x0;var _0x1eddfe=_0xd8c1[_0x532bd0];return _0x1eddfe;};'use strict';var multer=require(_0x1d8c('0x0'));var util=require('util');var path=require(_0x1d8c('0x1'));var timeout=require(_0x1d8c('0x2'));var express=require(_0x1d8c('0x3'));var router=express[_0x1d8c('0x4')]();var fs_extra=require(_0x1d8c('0x5'));var auth=require(_0x1d8c('0x6'));var interaction=require(_0x1d8c('0x7'));var config=require('../../config/environment');var controller=require(_0x1d8c('0x8'));router[_0x1d8c('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d8c('0xa')]);router['get'](_0x1d8c('0xb'),auth[_0x1d8c('0xc')](),controller[_0x1d8c('0xd')]);router[_0x1d8c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1d8c('0xb'),auth[_0x1d8c('0xc')](),controller['update']);router['delete'](_0x1d8c('0xb'),auth[_0x1d8c('0xc')](),controller['destroy']);module[_0x1d8c('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ed8de39..19c5386 100644 --- a/server/api/attachment/attachment.attributes.js +++ b/server/api/attachment/attachment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7b9=['STRING','exports'];(function(_0x3b87f5,_0x1f79c1){var _0x4c61a1=function(_0x696b7d){while(--_0x696b7d){_0x3b87f5['push'](_0x3b87f5['shift']());}};_0x4c61a1(++_0x1f79c1);}(_0xb7b9,0x105));var _0x9b7b=function(_0x5b1681,_0x344273){_0x5b1681=_0x5b1681-0x0;var _0x41f5ee=_0xb7b9[_0x5b1681];return _0x41f5ee;};'use strict';var Sequelize=require('sequelize');module[_0x9b7b('0x0')]={'name':{'type':Sequelize[_0x9b7b('0x1')]},'basename':{'type':Sequelize[_0x9b7b('0x1')]},'type':{'type':Sequelize[_0x9b7b('0x1')]}}; \ No newline at end of file +var _0x0cdb=['exports','STRING','sequelize'];(function(_0x41fd63,_0xc19e97){var _0x187c6c=function(_0x2fceaf){while(--_0x2fceaf){_0x41fd63['push'](_0x41fd63['shift']());}};_0x187c6c(++_0xc19e97);}(_0x0cdb,0x185));var _0xb0cd=function(_0x2e5a8c,_0x35f4bf){_0x2e5a8c=_0x2e5a8c-0x0;var _0x5816ec=_0x0cdb[_0x2e5a8c];return _0x5816ec;};'use strict';var Sequelize=require(_0xb0cd('0x0'));module[_0xb0cd('0x1')]={'name':{'type':Sequelize[_0xb0cd('0x2')]},'basename':{'type':Sequelize[_0xb0cd('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 864c115..cb2f1be 100644 --- a/server/api/attachment/attachment.controller.js +++ b/server/api/attachment/attachment.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe818=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','message','agent','interaction','account','index','fieldName','key','filters','intersection','model','query','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','Attachment','includeAll','findAll','rows','catch','show','params','keys','include','find','clone','rawAttributes','get','omit','createdAt','updatedAt','create','originalname','basename','file','filename','type','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x19fec1,_0x1cc62f){var _0x29cd35=function(_0x712a4f){while(--_0x712a4f){_0x19fec1['push'](_0x19fec1['shift']());}};_0x29cd35(++_0x1cc62f);}(_0xe818,0x1e4));var _0x8e81=function(_0x286ba6,_0x4c1a64){_0x286ba6=_0x286ba6-0x0;var _0x4c09a7=_0xe818[_0x286ba6];return _0x4c09a7;};'use strict';var emlformat=require(_0x8e81('0x0'));var rimraf=require(_0x8e81('0x1'));var zipdir=require(_0x8e81('0x2'));var jsonpatch=require(_0x8e81('0x3'));var rp=require(_0x8e81('0x4'));var moment=require('moment');var BPromise=require(_0x8e81('0x5'));var Mustache=require('mustache');var util=require(_0x8e81('0x6'));var path=require(_0x8e81('0x7'));var sox=require(_0x8e81('0x8'));var csv=require(_0x8e81('0x9'));var ejs=require(_0x8e81('0xa'));var fs=require('fs');var fs_extra=require(_0x8e81('0xb'));var _=require(_0x8e81('0xc'));var squel=require(_0x8e81('0xd'));var crypto=require(_0x8e81('0xe'));var jsforce=require(_0x8e81('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8e81('0x9'));var querystring=require(_0x8e81('0x10'));var Papa=require(_0x8e81('0x11'));var Redis=require(_0x8e81('0x12'));var authService=require(_0x8e81('0x13'));var qs=require(_0x8e81('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e81('0x15'));var logger=require(_0x8e81('0x16'))(_0x8e81('0x17'));var utils=require('../../config/utils');var config=require(_0x8e81('0x18'));var licenseUtil=require(_0x8e81('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa4dc0f,_0x5f3747){_0x5f3747=_0x5f3747||0xcc;return function(_0x570725){if(_0x570725){return _0xa4dc0f[_0x8e81('0x1a')](_0x5f3747);}return _0xa4dc0f[_0x8e81('0x1b')](_0x5f3747)[_0x8e81('0x1c')]();};}function respondWithResult(_0x54cfb8,_0x4c20c5){_0x4c20c5=_0x4c20c5||0xc8;return function(_0x21e997){if(_0x21e997){return _0x54cfb8[_0x8e81('0x1b')](_0x4c20c5)['json'](_0x21e997);}};}function respondWithFilteredResult(_0x4420f5,_0x230da8){return function(_0x16142a){if(_0x16142a){var _0x2a1905=typeof _0x230da8[_0x8e81('0x1d')]===_0x8e81('0x1e')&&typeof _0x230da8[_0x8e81('0x1f')]===_0x8e81('0x1e');var _0x5217ee=_0x16142a[_0x8e81('0x20')];var _0x52979d=_0x2a1905?0x0:_0x230da8[_0x8e81('0x1d')];var _0x2a5563=_0x2a1905?_0x16142a[_0x8e81('0x20')]:_0x230da8[_0x8e81('0x1d')]+_0x230da8[_0x8e81('0x1f')];var _0x4619d3;if(_0x2a5563>=_0x5217ee){_0x2a5563=_0x5217ee;_0x4619d3=0xc8;}else{_0x4619d3=0xce;}_0x4420f5['status'](_0x4619d3);return _0x4420f5[_0x8e81('0x21')]('Content-Range',_0x52979d+'-'+_0x2a5563+'/'+_0x5217ee)[_0x8e81('0x22')](_0x16142a);}return null;};}function patchUpdates(_0x208710){return function(_0x40dcf8){try{jsonpatch[_0x8e81('0x23')](_0x40dcf8,_0x208710,!![]);}catch(_0x54d343){return BPromise[_0x8e81('0x24')](_0x54d343);}return _0x40dcf8[_0x8e81('0x25')]();};}function saveUpdates(_0x58d5cc,_0x165989){return function(_0x23b223){if(_0x23b223){return _0x23b223[_0x8e81('0x26')](_0x58d5cc)[_0x8e81('0x27')](function(_0x27e508){return _0x27e508;});}return null;};}function removeEntity(_0x1c1086,_0x4ab0f0){return function(_0x1e11f3){if(_0x1e11f3){return _0x1e11f3[_0x8e81('0x28')]()[_0x8e81('0x27')](function(){_0x1c1086[_0x8e81('0x1b')](0xcc)[_0x8e81('0x1c')]();});}};}function handleEntityNotFound(_0x42b990,_0x22c6f1){return function(_0x36acc3){if(!_0x36acc3){_0x42b990[_0x8e81('0x1a')](0x194);}return _0x36acc3;};}function handleError(_0x5f2995,_0x3bdbd8){_0x3bdbd8=_0x3bdbd8||0x1f4;return function(_0x2b764d){logger[_0x8e81('0x29')](_0x2b764d[_0x8e81('0x2a')]);if(_0x2b764d[_0x8e81('0x2b')]){delete _0x2b764d[_0x8e81('0x2b')];}_0x5f2995[_0x8e81('0x1b')](_0x3bdbd8)[_0x8e81('0x2c')](_0x2b764d);};}function getMustacheRender(_0x3ad769,_0x855489){return Mustache[_0x8e81('0x2d')](_0x3ad769,_[_0x8e81('0x2e')](_0x855489[_0x8e81('0x2f')],{'contact':_0x855489['contact'],'message':_0x855489[_0x8e81('0x30')],'agent':_0x855489[_0x8e81('0x31')],'interaction':_0x855489[_0x8e81('0x32')],'account':_0x855489[_0x8e81('0x33')]}))||'';}exports[_0x8e81('0x34')]=function(_0x1a7fd5,_0x2a8cee){var _0x36df5a={},_0x3d92ea={},_0x1c4092={'count':0x0,'rows':[]};var _0x1977fa=_['map'](db['Attachment']['rawAttributes'],function(_0x42ee11){return{'name':_0x42ee11[_0x8e81('0x35')],'type':_0x42ee11['type'][_0x8e81('0x36')]};});_0x3d92ea['model']=_['map'](_0x1977fa,_0x8e81('0x2b'));_0x3d92ea['query']=_['keys'](_0x1a7fd5['query']);_0x3d92ea[_0x8e81('0x37')]=_[_0x8e81('0x38')](_0x3d92ea[_0x8e81('0x39')],_0x3d92ea[_0x8e81('0x3a')]);_0x36df5a['attributes']=_[_0x8e81('0x38')](_0x3d92ea[_0x8e81('0x39')],qs[_0x8e81('0x3b')](_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x3b')]));_0x36df5a['attributes']=_0x36df5a['attributes'][_0x8e81('0x3c')]?_0x36df5a[_0x8e81('0x3d')]:_0x3d92ea[_0x8e81('0x39')];if(!_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x3e')](_0x8e81('0x3f'))){_0x36df5a['limit']=qs[_0x8e81('0x1f')](_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x1f')]);_0x36df5a['offset']=qs[_0x8e81('0x1d')](_0x1a7fd5['query'][_0x8e81('0x1d')]);}_0x36df5a['order']=qs[_0x8e81('0x40')](_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x40')]);_0x36df5a['where']=qs[_0x8e81('0x37')](_[_0x8e81('0x41')](_0x1a7fd5[_0x8e81('0x3a')],_0x3d92ea[_0x8e81('0x37')]),_0x1977fa);if(_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x42')]){_0x36df5a[_0x8e81('0x43')]=_[_0x8e81('0x2e')](_0x36df5a[_0x8e81('0x43')],{'$or':_['map'](_0x1977fa,function(_0x5ee653){if(_0x5ee653['type']!==_0x8e81('0x44')){var _0x496989={};_0x496989[_0x5ee653[_0x8e81('0x2b')]]={'$like':'%'+_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x42')]+'%'};return _0x496989;}})});}_0x36df5a=_[_0x8e81('0x2e')]({},_0x36df5a,_0x1a7fd5[_0x8e81('0x45')]);var _0x4208fa={'where':_0x36df5a[_0x8e81('0x43')]};return db[_0x8e81('0x46')][_0x8e81('0x20')](_0x4208fa)[_0x8e81('0x27')](function(_0x45c5b6){_0x1c4092[_0x8e81('0x20')]=_0x45c5b6;if(_0x1a7fd5[_0x8e81('0x3a')][_0x8e81('0x47')]){_0x36df5a['include']=[{'all':!![]}];}return db[_0x8e81('0x46')][_0x8e81('0x48')](_0x36df5a);})[_0x8e81('0x27')](function(_0x19e25c){_0x1c4092[_0x8e81('0x49')]=_0x19e25c;return _0x1c4092;})['then'](respondWithFilteredResult(_0x2a8cee,_0x36df5a))[_0x8e81('0x4a')](handleError(_0x2a8cee,null));};exports[_0x8e81('0x4b')]=function(_0x1bdcfb,_0x557af3){var _0x52645e={'raw':!![],'where':{'id':_0x1bdcfb[_0x8e81('0x4c')]['id']}},_0x223533={};_0x223533[_0x8e81('0x39')]=_[_0x8e81('0x4d')](db[_0x8e81('0x46')]['rawAttributes']);_0x223533[_0x8e81('0x3a')]=_['keys'](_0x1bdcfb[_0x8e81('0x3a')]);_0x223533[_0x8e81('0x37')]=_[_0x8e81('0x38')](_0x223533['model'],_0x223533[_0x8e81('0x3a')]);_0x52645e['attributes']=_[_0x8e81('0x38')](_0x223533[_0x8e81('0x39')],qs[_0x8e81('0x3b')](_0x1bdcfb['query'][_0x8e81('0x3b')]));_0x52645e['attributes']=_0x52645e['attributes'][_0x8e81('0x3c')]?_0x52645e[_0x8e81('0x3d')]:_0x223533['model'];if(_0x1bdcfb[_0x8e81('0x3a')][_0x8e81('0x47')]){_0x52645e[_0x8e81('0x4e')]=[{'all':!![]}];}_0x52645e=_[_0x8e81('0x2e')]({},_0x52645e,_0x1bdcfb[_0x8e81('0x45')]);return db['Attachment'][_0x8e81('0x4f')](_0x52645e)[_0x8e81('0x27')](handleEntityNotFound(_0x557af3,null))[_0x8e81('0x27')](respondWithResult(_0x557af3,null))[_0x8e81('0x4a')](handleError(_0x557af3,null));};exports[_0x8e81('0x50')]=function(_0x38e0fa,_0x9adca4){var _0x329b78={'where':{'id':_0x38e0fa[_0x8e81('0x4c')]['id']}},_0x36ba81={};_0x36ba81['model']=_[_0x8e81('0x4d')](db[_0x8e81('0x46')][_0x8e81('0x51')]);_0x329b78[_0x8e81('0x3d')]=_[_0x8e81('0x38')](_0x36ba81[_0x8e81('0x39')],qs[_0x8e81('0x3b')](_0x38e0fa[_0x8e81('0x3a')]['fields']));_0x329b78['attributes']=_0x329b78[_0x8e81('0x3d')]['length']?_0x329b78[_0x8e81('0x3d')]:_0x36ba81['model'];if(_0x38e0fa['query']['includeAll']){_0x329b78[_0x8e81('0x4e')]=[{'all':!![]}];}_0x329b78=_['merge']({},_0x329b78,_0x38e0fa[_0x8e81('0x45')]);return db[_0x8e81('0x46')][_0x8e81('0x4f')](_0x329b78)['then'](handleEntityNotFound(_0x9adca4,null))[_0x8e81('0x27')](function(_0x4ba11e){if(_0x4ba11e){var _0x2e46fc=_0x4ba11e[_0x8e81('0x52')]({'plain':!![]});_0x2e46fc=qs[_0x8e81('0x53')](_0x2e46fc,['id',_0x8e81('0x54'),_0x8e81('0x55')]);_0x38e0fa[_0x8e81('0x2f')]=_['omit'](_0x38e0fa[_0x8e81('0x2f')],['id','createdAt',_0x8e81('0x55')]);return db[_0x8e81('0x46')][_0x8e81('0x56')](_[_0x8e81('0x2e')](_0x2e46fc,_0x38e0fa[_0x8e81('0x2f')]),{'include':_0x38e0fa[_0x8e81('0x3a')][_0x8e81('0x47')]?[{'all':!![]}]:undefined});}})[_0x8e81('0x27')](respondWithResult(_0x9adca4,0xc9))['catch'](handleError(_0x9adca4,null));};exports['update']=function(_0x5ac625,_0x595d59){if(_0x5ac625[_0x8e81('0x2f')]['id']){delete _0x5ac625[_0x8e81('0x2f')]['id'];}return db[_0x8e81('0x46')][_0x8e81('0x4f')]({'where':{'id':_0x5ac625[_0x8e81('0x4c')]['id']}})[_0x8e81('0x27')](handleEntityNotFound(_0x595d59,null))[_0x8e81('0x27')](saveUpdates(_0x5ac625[_0x8e81('0x2f')],null))[_0x8e81('0x27')](respondWithResult(_0x595d59,null))['catch'](handleError(_0x595d59,null));};exports[_0x8e81('0x28')]=function(_0x30546a,_0x57be57){return db[_0x8e81('0x46')][_0x8e81('0x4f')]({'where':{'id':_0x30546a[_0x8e81('0x4c')]['id']}})[_0x8e81('0x27')](handleEntityNotFound(_0x57be57,null))['then'](removeEntity(_0x57be57,null))[_0x8e81('0x4a')](handleError(_0x57be57,null));};exports[_0x8e81('0x56')]=function(_0x55d2e9,_0x471898,_0x21d3d8){_0x55d2e9[_0x8e81('0x2f')][_0x8e81('0x2b')]=_0x55d2e9['file'][_0x8e81('0x57')];_0x55d2e9[_0x8e81('0x2f')][_0x8e81('0x58')]=_0x55d2e9[_0x8e81('0x59')][_0x8e81('0x5a')];_0x55d2e9[_0x8e81('0x2f')][_0x8e81('0x5b')]=_0x55d2e9[_0x8e81('0x59')][_0x8e81('0x5c')];return db[_0x8e81('0x46')][_0x8e81('0x56')](_0x55d2e9[_0x8e81('0x2f')])[_0x8e81('0x27')](respondWithResult(_0x471898,0xc9))[_0x8e81('0x4a')](handleError(_0x471898,null));};exports[_0x8e81('0x5d')]=function(_0x24d0c2,_0x384622,_0x14f7e2){return db[_0x8e81('0x46')][_0x8e81('0x5e')]({'where':{'id':_0x24d0c2['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x384622,null))[_0x8e81('0x27')](function(_0x525b76){if(_0x525b76){var _0x4d8073=_0x525b76[_0x8e81('0x5f')]!==null;var _0x15f1eb=path['join'](config[_0x8e81('0x60')],_0x8e81('0x61'));if(_0x4d8073){_0x15f1eb=path[_0x8e81('0x62')](_0x15f1eb,_0x8e81('0x63'));}var _0x3b46ed=path[_0x8e81('0x62')](_0x15f1eb,_0x525b76[_0x8e81('0x58')]);return _0x384622[_0x8e81('0x5d')](_0x3b46ed);}})[_0x8e81('0x4a')](handleError(_0x384622,null));}; \ No newline at end of file +var _0x0dec=['map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','get','createdAt','updatedAt','create','catch','file','originalname','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','eml-format','rimraf','request-promise','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','render','merge','body','contact','message','agent','interaction','account','index','Attachment','rawAttributes','fieldName','type','key','model'];(function(_0x425cd3,_0xbf3fbc){var _0x1e482a=function(_0x4ec99e){while(--_0x4ec99e){_0x425cd3['push'](_0x425cd3['shift']());}};_0x1e482a(++_0xbf3fbc);}(_0x0dec,0x13a));var _0xc0de=function(_0x33e815,_0x2d3ba3){_0x33e815=_0x33e815-0x0;var _0x4d55c0=_0x0dec[_0x33e815];return _0x4d55c0;};'use strict';var emlformat=require(_0xc0de('0x0'));var rimraf=require(_0xc0de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc0de('0x2'));var moment=require('moment');var BPromise=require(_0xc0de('0x3'));var Mustache=require(_0xc0de('0x4'));var util=require(_0xc0de('0x5'));var path=require(_0xc0de('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0de('0x7'));var _=require('lodash');var squel=require(_0xc0de('0x8'));var crypto=require(_0xc0de('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc0de('0xa'));var toCsv=require(_0xc0de('0xb'));var querystring=require(_0xc0de('0xc'));var Papa=require(_0xc0de('0xd'));var Redis=require('ioredis');var authService=require(_0xc0de('0xe'));var qs=require(_0xc0de('0xf'));var as=require(_0xc0de('0x10'));var hardwareService=require(_0xc0de('0x11'));var logger=require('../../config/logger')(_0xc0de('0x12'));var utils=require('../../config/utils');var config=require(_0xc0de('0x13'));var licenseUtil=require(_0xc0de('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x449f8e,_0xe3fbc0){_0xe3fbc0=_0xe3fbc0||0xcc;return function(_0x28c312){if(_0x28c312){return _0x449f8e['sendStatus'](_0xe3fbc0);}return _0x449f8e['status'](_0xe3fbc0)[_0xc0de('0x15')]();};}function respondWithResult(_0x30d303,_0xf502b5){_0xf502b5=_0xf502b5||0xc8;return function(_0x30c5d6){if(_0x30c5d6){return _0x30d303[_0xc0de('0x16')](_0xf502b5)[_0xc0de('0x17')](_0x30c5d6);}};}function respondWithFilteredResult(_0x4d7f23,_0x113437){return function(_0x1e7fb2){if(_0x1e7fb2){var _0xd5e057=typeof _0x113437[_0xc0de('0x18')]===_0xc0de('0x19')&&typeof _0x113437[_0xc0de('0x1a')]===_0xc0de('0x19');var _0x34d828=_0x1e7fb2[_0xc0de('0x1b')];var _0x4962b3=_0xd5e057?0x0:_0x113437[_0xc0de('0x18')];var _0x13726c=_0xd5e057?_0x1e7fb2[_0xc0de('0x1b')]:_0x113437['offset']+_0x113437[_0xc0de('0x1a')];var _0x323c7a;if(_0x13726c>=_0x34d828){_0x13726c=_0x34d828;_0x323c7a=0xc8;}else{_0x323c7a=0xce;}_0x4d7f23[_0xc0de('0x16')](_0x323c7a);return _0x4d7f23[_0xc0de('0x1c')](_0xc0de('0x1d'),_0x4962b3+'-'+_0x13726c+'/'+_0x34d828)['json'](_0x1e7fb2);}return null;};}function patchUpdates(_0x55881a){return function(_0xd071c5){try{jsonpatch[_0xc0de('0x1e')](_0xd071c5,_0x55881a,!![]);}catch(_0x3977ce){return BPromise['reject'](_0x3977ce);}return _0xd071c5[_0xc0de('0x1f')]();};}function saveUpdates(_0x33fb18,_0xcd540b){return function(_0x36c796){if(_0x36c796){return _0x36c796[_0xc0de('0x20')](_0x33fb18)[_0xc0de('0x21')](function(_0x242208){return _0x242208;});}return null;};}function removeEntity(_0x386028,_0x43829e){return function(_0xb2ee62){if(_0xb2ee62){return _0xb2ee62[_0xc0de('0x22')]()['then'](function(){_0x386028[_0xc0de('0x16')](0xcc)[_0xc0de('0x15')]();});}};}function handleEntityNotFound(_0x2e8282,_0x320507){return function(_0x21359d){if(!_0x21359d){_0x2e8282[_0xc0de('0x23')](0x194);}return _0x21359d;};}function handleError(_0x4eaf86,_0x18fffc){_0x18fffc=_0x18fffc||0x1f4;return function(_0x1d5a42){logger[_0xc0de('0x24')](_0x1d5a42[_0xc0de('0x25')]);if(_0x1d5a42[_0xc0de('0x26')]){delete _0x1d5a42[_0xc0de('0x26')];}_0x4eaf86[_0xc0de('0x16')](_0x18fffc)['send'](_0x1d5a42);};}function getMustacheRender(_0x432407,_0x239ec0){return Mustache[_0xc0de('0x27')](_0x432407,_[_0xc0de('0x28')](_0x239ec0[_0xc0de('0x29')],{'contact':_0x239ec0[_0xc0de('0x2a')],'message':_0x239ec0[_0xc0de('0x2b')],'agent':_0x239ec0[_0xc0de('0x2c')],'interaction':_0x239ec0[_0xc0de('0x2d')],'account':_0x239ec0[_0xc0de('0x2e')]}))||'';}exports[_0xc0de('0x2f')]=function(_0x49f2da,_0x481cc7){var _0x3a26e4={},_0x250443={},_0x2944ba={'count':0x0,'rows':[]};var _0x44637d=_['map'](db[_0xc0de('0x30')][_0xc0de('0x31')],function(_0x258651){return{'name':_0x258651[_0xc0de('0x32')],'type':_0x258651[_0xc0de('0x33')][_0xc0de('0x34')]};});_0x250443[_0xc0de('0x35')]=_[_0xc0de('0x36')](_0x44637d,'name');_0x250443[_0xc0de('0x37')]=_[_0xc0de('0x38')](_0x49f2da[_0xc0de('0x37')]);_0x250443[_0xc0de('0x39')]=_['intersection'](_0x250443[_0xc0de('0x35')],_0x250443[_0xc0de('0x37')]);_0x3a26e4[_0xc0de('0x3a')]=_[_0xc0de('0x3b')](_0x250443['model'],qs['fields'](_0x49f2da['query'][_0xc0de('0x3c')]));_0x3a26e4[_0xc0de('0x3a')]=_0x3a26e4[_0xc0de('0x3a')][_0xc0de('0x3d')]?_0x3a26e4[_0xc0de('0x3a')]:_0x250443[_0xc0de('0x35')];if(!_0x49f2da['query'][_0xc0de('0x3e')](_0xc0de('0x3f'))){_0x3a26e4['limit']=qs[_0xc0de('0x1a')](_0x49f2da[_0xc0de('0x37')][_0xc0de('0x1a')]);_0x3a26e4['offset']=qs[_0xc0de('0x18')](_0x49f2da[_0xc0de('0x37')]['offset']);}_0x3a26e4[_0xc0de('0x40')]=qs[_0xc0de('0x41')](_0x49f2da[_0xc0de('0x37')]['sort']);_0x3a26e4['where']=qs['filters'](_['pick'](_0x49f2da[_0xc0de('0x37')],_0x250443[_0xc0de('0x39')]),_0x44637d);if(_0x49f2da[_0xc0de('0x37')][_0xc0de('0x42')]){_0x3a26e4[_0xc0de('0x43')]=_[_0xc0de('0x28')](_0x3a26e4['where'],{'$or':_[_0xc0de('0x36')](_0x44637d,function(_0x33192d){if(_0x33192d['type']!==_0xc0de('0x44')){var _0x28e037={};_0x28e037[_0x33192d[_0xc0de('0x26')]]={'$like':'%'+_0x49f2da[_0xc0de('0x37')][_0xc0de('0x42')]+'%'};return _0x28e037;}})});}_0x3a26e4=_[_0xc0de('0x28')]({},_0x3a26e4,_0x49f2da[_0xc0de('0x45')]);var _0x25ade1={'where':_0x3a26e4[_0xc0de('0x43')]};return db[_0xc0de('0x30')][_0xc0de('0x1b')](_0x25ade1)[_0xc0de('0x21')](function(_0x4cc8d9){_0x2944ba[_0xc0de('0x1b')]=_0x4cc8d9;if(_0x49f2da[_0xc0de('0x37')][_0xc0de('0x46')]){_0x3a26e4[_0xc0de('0x47')]=[{'all':!![]}];}return db[_0xc0de('0x30')][_0xc0de('0x48')](_0x3a26e4);})[_0xc0de('0x21')](function(_0x4220fc){_0x2944ba[_0xc0de('0x49')]=_0x4220fc;return _0x2944ba;})[_0xc0de('0x21')](respondWithFilteredResult(_0x481cc7,_0x3a26e4))['catch'](handleError(_0x481cc7,null));};exports[_0xc0de('0x4a')]=function(_0x2f3bc9,_0x478db1){var _0xe7db5d={'raw':!![],'where':{'id':_0x2f3bc9[_0xc0de('0x4b')]['id']}},_0x21e7de={};_0x21e7de[_0xc0de('0x35')]=_[_0xc0de('0x38')](db[_0xc0de('0x30')]['rawAttributes']);_0x21e7de['query']=_[_0xc0de('0x38')](_0x2f3bc9[_0xc0de('0x37')]);_0x21e7de[_0xc0de('0x39')]=_[_0xc0de('0x3b')](_0x21e7de['model'],_0x21e7de['query']);_0xe7db5d[_0xc0de('0x3a')]=_[_0xc0de('0x3b')](_0x21e7de[_0xc0de('0x35')],qs['fields'](_0x2f3bc9[_0xc0de('0x37')][_0xc0de('0x3c')]));_0xe7db5d[_0xc0de('0x3a')]=_0xe7db5d[_0xc0de('0x3a')]['length']?_0xe7db5d[_0xc0de('0x3a')]:_0x21e7de[_0xc0de('0x35')];if(_0x2f3bc9[_0xc0de('0x37')][_0xc0de('0x46')]){_0xe7db5d[_0xc0de('0x47')]=[{'all':!![]}];}_0xe7db5d=_[_0xc0de('0x28')]({},_0xe7db5d,_0x2f3bc9[_0xc0de('0x45')]);return db[_0xc0de('0x30')][_0xc0de('0x4c')](_0xe7db5d)[_0xc0de('0x21')](handleEntityNotFound(_0x478db1,null))[_0xc0de('0x21')](respondWithResult(_0x478db1,null))['catch'](handleError(_0x478db1,null));};exports['clone']=function(_0x558c19,_0x466395){var _0x9d1c4c={'where':{'id':_0x558c19[_0xc0de('0x4b')]['id']}},_0x43d841={};_0x43d841[_0xc0de('0x35')]=_[_0xc0de('0x38')](db[_0xc0de('0x30')]['rawAttributes']);_0x9d1c4c[_0xc0de('0x3a')]=_[_0xc0de('0x3b')](_0x43d841[_0xc0de('0x35')],qs[_0xc0de('0x3c')](_0x558c19['query'][_0xc0de('0x3c')]));_0x9d1c4c[_0xc0de('0x3a')]=_0x9d1c4c[_0xc0de('0x3a')][_0xc0de('0x3d')]?_0x9d1c4c['attributes']:_0x43d841[_0xc0de('0x35')];if(_0x558c19['query'][_0xc0de('0x46')]){_0x9d1c4c[_0xc0de('0x47')]=[{'all':!![]}];}_0x9d1c4c=_[_0xc0de('0x28')]({},_0x9d1c4c,_0x558c19['options']);return db[_0xc0de('0x30')][_0xc0de('0x4c')](_0x9d1c4c)[_0xc0de('0x21')](handleEntityNotFound(_0x466395,null))['then'](function(_0x281aad){if(_0x281aad){var _0x3b64ad=_0x281aad[_0xc0de('0x4d')]({'plain':!![]});_0x3b64ad=qs['omit'](_0x3b64ad,['id',_0xc0de('0x4e'),_0xc0de('0x4f')]);_0x558c19[_0xc0de('0x29')]=_['omit'](_0x558c19[_0xc0de('0x29')],['id',_0xc0de('0x4e'),_0xc0de('0x4f')]);return db[_0xc0de('0x30')][_0xc0de('0x50')](_[_0xc0de('0x28')](_0x3b64ad,_0x558c19['body']),{'include':_0x558c19[_0xc0de('0x37')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xc0de('0x21')](respondWithResult(_0x466395,0xc9))[_0xc0de('0x51')](handleError(_0x466395,null));};exports[_0xc0de('0x20')]=function(_0x45f377,_0x193ab7){if(_0x45f377['body']['id']){delete _0x45f377[_0xc0de('0x29')]['id'];}return db[_0xc0de('0x30')][_0xc0de('0x4c')]({'where':{'id':_0x45f377[_0xc0de('0x4b')]['id']}})['then'](handleEntityNotFound(_0x193ab7,null))['then'](saveUpdates(_0x45f377['body'],null))[_0xc0de('0x21')](respondWithResult(_0x193ab7,null))[_0xc0de('0x51')](handleError(_0x193ab7,null));};exports[_0xc0de('0x22')]=function(_0x1734a6,_0x1e4836){return db['Attachment'][_0xc0de('0x4c')]({'where':{'id':_0x1734a6[_0xc0de('0x4b')]['id']}})[_0xc0de('0x21')](handleEntityNotFound(_0x1e4836,null))[_0xc0de('0x21')](removeEntity(_0x1e4836,null))['catch'](handleError(_0x1e4836,null));};exports[_0xc0de('0x50')]=function(_0x35e2f6,_0x50bac3,_0x5c9350){_0x35e2f6[_0xc0de('0x29')][_0xc0de('0x26')]=_0x35e2f6[_0xc0de('0x52')][_0xc0de('0x53')];_0x35e2f6[_0xc0de('0x29')][_0xc0de('0x54')]=_0x35e2f6[_0xc0de('0x52')][_0xc0de('0x55')];_0x35e2f6[_0xc0de('0x29')][_0xc0de('0x33')]=_0x35e2f6[_0xc0de('0x52')][_0xc0de('0x56')];return db['Attachment'][_0xc0de('0x50')](_0x35e2f6[_0xc0de('0x29')])[_0xc0de('0x21')](respondWithResult(_0x50bac3,0xc9))[_0xc0de('0x51')](handleError(_0x50bac3,null));};exports[_0xc0de('0x57')]=function(_0x532823,_0x14df13,_0x2e3941){return db['Attachment'][_0xc0de('0x58')]({'where':{'id':_0x532823['params']['id']},'raw':!![]})[_0xc0de('0x21')](handleEntityNotFound(_0x14df13,null))[_0xc0de('0x21')](function(_0x24033a){if(_0x24033a){var _0x4b6865=_0x24033a['ChatOfflineMessageId']!==null;var _0x3158cc=path[_0xc0de('0x59')](config[_0xc0de('0x5a')],_0xc0de('0x5b'));if(_0x4b6865){_0x3158cc=path[_0xc0de('0x59')](_0x3158cc,'offline-chat/');}var _0x17da34=path[_0xc0de('0x59')](_0x3158cc,_0x24033a['basename']);return _0x14df13['download'](_0x17da34);}})[_0xc0de('0x51')](handleError(_0x14df13,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c4de662..dd16093 100644 --- a/server/api/attachment/attachment.model.js +++ b/server/api/attachment/attachment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f18=['path','rimraf','./attachment.attributes','exports','define','attachments','lodash','../../config/logger','moment','bluebird'];(function(_0x5438c6,_0x4f6b04){var _0xb1672c=function(_0x571aa8){while(--_0x571aa8){_0x5438c6['push'](_0x5438c6['shift']());}};_0xb1672c(++_0x4f6b04);}(_0x6f18,0x1b4));var _0x86f1=function(_0x330786,_0x579ea1){_0x330786=_0x330786-0x0;var _0x31e5c1=_0x6f18[_0x330786];return _0x31e5c1;};'use strict';var _=require(_0x86f1('0x0'));var util=require('util');var logger=require(_0x86f1('0x1'))('api');var moment=require(_0x86f1('0x2'));var BPromise=require(_0x86f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86f1('0x4'));var rimraf=require(_0x86f1('0x5'));var config=require('../../config/environment');var attributes=require(_0x86f1('0x6'));module[_0x86f1('0x7')]=function(_0x3c91dc,_0x15a5e1){return _0x3c91dc[_0x86f1('0x8')]('Attachment',attributes,{'tableName':_0x86f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b17=['attachments','lodash','../../config/logger','moment','bluebird','path','./attachment.attributes','exports','define','Attachment'];(function(_0x5ebbf7,_0x2d327b){var _0x3954fd=function(_0x5d660b){while(--_0x5d660b){_0x5ebbf7['push'](_0x5ebbf7['shift']());}};_0x3954fd(++_0x2d327b);}(_0x4b17,0x10f));var _0x74b1=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0x4b17[_0x59145a];return _0xf04d7;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var logger=require(_0x74b1('0x1'))('api');var moment=require(_0x74b1('0x2'));var BPromise=require(_0x74b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74b1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74b1('0x5'));module[_0x74b1('0x6')]=function(_0x379dcc,_0x3873a6){return _0x379dcc[_0x74b1('0x7')](_0x74b1('0x8'),attributes,{'tableName':_0x74b1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 12754af..1a7cece 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7411=['Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','body','options','info','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7411,0x1ac));var _0x1741=function(_0x35bd0b,_0xc93fae){_0x35bd0b=_0x35bd0b-0x0;var _0x478117=_0x7411[_0x35bd0b];return _0x478117;};'use strict';var _=require('lodash');var util=require(_0x1741('0x0'));var moment=require(_0x1741('0x1'));var BPromise=require(_0x1741('0x2'));var rs=require(_0x1741('0x3'));var fs=require('fs');var Redis=require(_0x1741('0x4'));var db=require(_0x1741('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1741('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1741('0x7')][_0x1741('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x65bf27,_0x761002,_0x1c1af8){return new BPromise(function(_0x5b952e,_0x21c3d2){return client[_0x1741('0x9')](_0x65bf27,_0x1c1af8)[_0x1741('0xa')](function(_0x24b8f3){logger['info'](_0x1741('0xb'),_0x761002,_0x1741('0xc'));logger[_0x1741('0xd')](_0x1741('0xe'),_0x761002,_0x1741('0xc'),JSON['stringify'](_0x24b8f3));if(_0x24b8f3[_0x1741('0xf')]){if(_0x24b8f3[_0x1741('0xf')][_0x1741('0x10')]===0x1f4){logger[_0x1741('0xf')](_0x1741('0xb'),_0x761002,_0x24b8f3[_0x1741('0xf')]['message']);return _0x21c3d2(_0x24b8f3[_0x1741('0xf')][_0x1741('0x11')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x761002,_0x24b8f3['error'][_0x1741('0x11')]);return _0x5b952e(_0x24b8f3[_0x1741('0xf')]['message']);}else{logger['info'](_0x1741('0xb'),_0x761002,_0x1741('0xc'));_0x5b952e(_0x24b8f3[_0x1741('0x12')][_0x1741('0x11')]);}})['catch'](function(_0x2b4264){logger[_0x1741('0xf')](_0x1741('0xb'),_0x761002,_0x2b4264);_0x21c3d2(_0x2b4264);});});}exports[_0x1741('0x13')]=function(_0x1de625){var _0x4774f1=this;return new Promise(function(_0x579a3c,_0x406a78){return db[_0x1741('0x14')][_0x1741('0x15')](_0x1de625[_0x1741('0x16')],{'raw':_0x1de625[_0x1741('0x17')]?_0x1de625[_0x1741('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1741('0xa')](function(_0x489e44){logger[_0x1741('0x18')](_0x1741('0x13'),_0x1de625);logger[_0x1741('0xd')](_0x1741('0x13'),_0x1de625,JSON[_0x1741('0x19')](_0x489e44));_0x579a3c(_0x489e44);})['catch'](function(_0xf5e455){logger[_0x1741('0xf')](_0x1741('0x13'),_0xf5e455[_0x1741('0x11')],_0x1de625);_0x406a78(_0x4774f1['error'](0x1f4,_0xf5e455['message']));});});}; \ No newline at end of file +var _0x53e3=['error','code','message','result','catch','Attachment','create','options','then','CreateAttachment','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x42b3aa,_0x223f53){var _0x319157=function(_0x4e5c40){while(--_0x4e5c40){_0x42b3aa['push'](_0x42b3aa['shift']());}};_0x319157(++_0x223f53);}(_0x53e3,0x10e));var _0x353e=function(_0x2909b2,_0xd44594){_0x2909b2=_0x2909b2-0x0;var _0xee045c=_0x53e3[_0x2909b2];return _0xee045c;};'use strict';var _=require(_0x353e('0x0'));var util=require(_0x353e('0x1'));var moment=require(_0x353e('0x2'));var BPromise=require(_0x353e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x353e('0x4'))['db'];var utils=require(_0x353e('0x5'));var logger=require(_0x353e('0x6'))(_0x353e('0x7'));var config=require(_0x353e('0x8'));var jayson=require(_0x353e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x380d12,_0x27a93c,_0x1e85b3){return new BPromise(function(_0xdc341a,_0x693668){return client[_0x353e('0xa')](_0x380d12,_0x1e85b3)['then'](function(_0xccbc6f){logger[_0x353e('0xb')](_0x353e('0xc'),_0x27a93c,_0x353e('0xd'));logger[_0x353e('0xe')](_0x353e('0xf'),_0x27a93c,_0x353e('0xd'),JSON['stringify'](_0xccbc6f));if(_0xccbc6f[_0x353e('0x10')]){if(_0xccbc6f[_0x353e('0x10')][_0x353e('0x11')]===0x1f4){logger[_0x353e('0x10')]('Attachment,\x20%s,\x20%s',_0x27a93c,_0xccbc6f['error'][_0x353e('0x12')]);return _0x693668(_0xccbc6f['error'][_0x353e('0x12')]);}logger['error'](_0x353e('0xc'),_0x27a93c,_0xccbc6f[_0x353e('0x10')][_0x353e('0x12')]);return _0xdc341a(_0xccbc6f[_0x353e('0x10')][_0x353e('0x12')]);}else{logger[_0x353e('0xb')](_0x353e('0xc'),_0x27a93c,_0x353e('0xd'));_0xdc341a(_0xccbc6f[_0x353e('0x13')]['message']);}})[_0x353e('0x14')](function(_0x245505){logger[_0x353e('0x10')](_0x353e('0xc'),_0x27a93c,_0x245505);_0x693668(_0x245505);});});}exports['CreateAttachment']=function(_0x429fad){var _0x54bb0f=this;return new Promise(function(_0x3d9b56,_0x291b0f){return db[_0x353e('0x15')][_0x353e('0x16')](_0x429fad['body'],{'raw':_0x429fad['options']?_0x429fad[_0x353e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x353e('0x18')](function(_0xba4f8a){logger[_0x353e('0xb')](_0x353e('0x19'),_0x429fad);logger[_0x353e('0xe')](_0x353e('0x19'),_0x429fad,JSON['stringify'](_0xba4f8a));_0x3d9b56(_0xba4f8a);})[_0x353e('0x14')](function(_0x505fd0){logger[_0x353e('0x10')](_0x353e('0x19'),_0x505fd0[_0x353e('0x12')],_0x429fad);_0x291b0f(_0x54bb0f[_0x353e('0x10')](0x1f4,_0x505fd0['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 14395be..4e85ad2 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2884=['express','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','/:id','show','download','post','clone','diskStorage','join','root','format','now','originalname','file','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1985d1,_0x5cb51d){var _0x409ef1=function(_0x4d57f8){while(--_0x4d57f8){_0x1985d1['push'](_0x1985d1['shift']());}};_0x409ef1(++_0x5cb51d);}(_0x2884,0x1eb));var _0x4288=function(_0x5950bd,_0x103e16){_0x5950bd=_0x5950bd-0x0;var _0x33e816=_0x2884[_0x5950bd];return _0x33e816;};'use strict';var multer=require(_0x4288('0x0'));var util=require('util');var path=require(_0x4288('0x1'));var timeout=require(_0x4288('0x2'));var express=require(_0x4288('0x3'));var router=express['Router']();var fs_extra=require(_0x4288('0x4'));var auth=require(_0x4288('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4288('0x6'));router[_0x4288('0x7')]('/',auth[_0x4288('0x8')](),controller['index']);router['get'](_0x4288('0x9'),auth['isAuthenticated'](),controller[_0x4288('0xa')]);router[_0x4288('0x7')]('/:id/download',auth[_0x4288('0x8')](),controller[_0x4288('0xb')]);router[_0x4288('0xc')]('/:id/clone',auth['isAuthenticated'](),controller[_0x4288('0xd')]);var upload=multer({'storage':multer[_0x4288('0xe')]({'destination':function(_0x7095f1,_0x2345d5,_0x2445eb){_0x2445eb(null,path[_0x4288('0xf')](config[_0x4288('0x10')],'server/files/attachments/'));},'filename':function(_0x10eb55,_0x1c4bd0,_0xfa6eca){_0xfa6eca(null,util[_0x4288('0x11')]('%s-%s',Date[_0x4288('0x12')](),_0x1c4bd0[_0x4288('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4288('0xc')]('/',upload['single'](_0x4288('0x14')),controller['create']);router[_0x4288('0x15')](_0x4288('0x9'),auth[_0x4288('0x8')](),controller[_0x4288('0x16')]);router[_0x4288('0x17')](_0x4288('0x9'),auth[_0x4288('0x8')](),controller[_0x4288('0x18')]);module[_0x4288('0x19')]=router; \ No newline at end of file +var _0x8b29=['now','replace','create','put','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','/:id/clone','clone','diskStorage','join','root'];(function(_0x42d7eb,_0x497ba4){var _0x537fa8=function(_0x1114e8){while(--_0x1114e8){_0x42d7eb['push'](_0x42d7eb['shift']());}};_0x537fa8(++_0x497ba4);}(_0x8b29,0xbe));var _0x98b2=function(_0x15e82c,_0x2ebdd2){_0x15e82c=_0x15e82c-0x0;var _0x380c8b=_0x8b29[_0x15e82c];return _0x380c8b;};'use strict';var multer=require(_0x98b2('0x0'));var util=require('util');var path=require(_0x98b2('0x1'));var timeout=require(_0x98b2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x98b2('0x3'));var auth=require(_0x98b2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x98b2('0x5'));var controller=require('./attachment.controller');router[_0x98b2('0x6')]('/',auth[_0x98b2('0x7')](),controller[_0x98b2('0x8')]);router[_0x98b2('0x6')](_0x98b2('0x9'),auth[_0x98b2('0x7')](),controller[_0x98b2('0xa')]);router[_0x98b2('0x6')](_0x98b2('0xb'),auth[_0x98b2('0x7')](),controller['download']);router['post'](_0x98b2('0xc'),auth[_0x98b2('0x7')](),controller[_0x98b2('0xd')]);var upload=multer({'storage':multer[_0x98b2('0xe')]({'destination':function(_0x2d3751,_0x2e2f07,_0x54b03c){_0x54b03c(null,path[_0x98b2('0xf')](config[_0x98b2('0x10')],'server/files/attachments/'));},'filename':function(_0x27865e,_0x1180fe,_0x2a6337){_0x2a6337(null,util['format']('%s-%s',Date[_0x98b2('0x11')](),_0x1180fe['originalname'][_0x98b2('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single']('file'),controller[_0x98b2('0x13')]);router[_0x98b2('0x14')](_0x98b2('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x98b2('0x9'),auth[_0x98b2('0x7')](),controller[_0x98b2('0x15')]);module[_0x98b2('0x16')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1d86767..b4fc073 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8d=['agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','minutes','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','map','emails','value','user'];(function(_0x1b192c,_0xdbc44b){var _0x275caf=function(_0x6de7a9){while(--_0x6de7a9){_0x1b192c['push'](_0x1b192c['shift']());}};_0x275caf(++_0xdbc44b);}(_0x6b8d,0xbd));var _0xd6b8=function(_0x434506,_0x2f9c1c){_0x434506=_0x434506-0x0;var _0x1ac516=_0x6b8d[_0x434506];return _0x1ac516;};'use strict';var _=require('lodash');var passport=require(_0xd6b8('0x0'));var GoogleStrategy=require(_0xd6b8('0x1'))[_0xd6b8('0x2')];var moment=require(_0xd6b8('0x3'));var db=require(_0xd6b8('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xd6b8('0x5'))[_0xd6b8('0x6')];var utils=require(_0xd6b8('0x7'));exports[_0xd6b8('0x8')]=passport[_0xd6b8('0x9')](_0xd6b8('0xa'),{'failureRedirect':_0xd6b8('0xb'),'scope':['profile',_0xd6b8('0xc')],'session':![]});exports['callback']=passport[_0xd6b8('0x9')](_0xd6b8('0xa'),{'failureRedirect':'/login','session':![]});passport[_0xd6b8('0xd')](new GoogleStrategy({'clientID':config[_0xd6b8('0xa')]?config['google'][_0xd6b8('0xe')]:'id','clientSecret':config['google']?config['google']['clientSecret']:_0xd6b8('0xf'),'callbackURL':config[_0xd6b8('0xa')]?config['google'][_0xd6b8('0x10')]:''},function(_0x51dd0d,_0x1296af,_0x5b9402,_0x2582a5){var _0x35b2f9,_0x1953d7;return db[_0xd6b8('0x11')][_0xd6b8('0x12')]({'where':{'id':0x1},'attributes':[_0xd6b8('0x13'),'blockDuration'],'raw':!![]})[_0xd6b8('0x14')](function(_0x999776){_0x35b2f9=_0x999776;return db[_0xd6b8('0x15')][_0xd6b8('0x16')]({'where':{'email':_[_0xd6b8('0x17')](_0x5b9402[_0xd6b8('0x18')],_0xd6b8('0x19')),'role':{'$or':['admin',_0xd6b8('0x1a'),_0xd6b8('0x1b')]}}});})[_0xd6b8('0x14')](function(_0x1dd525){_0x1953d7=_0x1dd525;if(_0x1953d7){if(_0x1953d7[_0xd6b8('0x1c')]){return _0x2582a5(_0xd6b8('0x1d'));}else if(_0x35b2f9[_0xd6b8('0x1e')]>0x0){if(_0x1953d7[_0xd6b8('0x1f')]){if(moment(_0x1953d7[_0xd6b8('0x20')])['add'](_0x35b2f9[_0xd6b8('0x1e')],_0xd6b8('0x21'))>moment()){return _0x2582a5(_0xd6b8('0x1d'));}else{return utils[_0xd6b8('0x22')](_0x1953d7,0x0,![],null)[_0xd6b8('0x14')](function(){return utils['getLicense'](_0x1953d7);})[_0xd6b8('0x14')](function(){return _0x2582a5(null,_0x1953d7);});}}else{return utils[_0xd6b8('0x23')](_0x1953d7)[_0xd6b8('0x14')](function(){return _0x2582a5(null,_0x1953d7);});}}else{return utils['getLicense'](_0x1953d7)[_0xd6b8('0x14')](function(){return _0x2582a5(null,_0x1953d7);});}}return _0x2582a5(_0xd6b8('0x1d'));})['catch'](function(_0x469f18){_0x2582a5(_0x469f18);});})); \ No newline at end of file +var _0xd716=['signToken','../../config/utils','authenticate','/login','profile','email','callback','google','use','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../config/environment'];(function(_0x2c80c1,_0xf479b3){var _0x375cd8=function(_0xeb509a){while(--_0xeb509a){_0x2c80c1['push'](_0x2c80c1['shift']());}};_0x375cd8(++_0xf479b3);}(_0xd716,0x136));var _0x6d71=function(_0x28add8,_0x18d6bd){_0x28add8=_0x28add8-0x0;var _0x2b1f4f=_0xd716[_0x28add8];return _0x2b1f4f;};'use strict';var _=require('lodash');var passport=require(_0x6d71('0x0'));var GoogleStrategy=require(_0x6d71('0x1'))[_0x6d71('0x2')];var moment=require(_0x6d71('0x3'));var db=require('../../mysqldb')['db'];var config=require(_0x6d71('0x4'));var signToken=require('../../components/auth/service')[_0x6d71('0x5')];var utils=require(_0x6d71('0x6'));exports['login']=passport[_0x6d71('0x7')]('google',{'failureRedirect':_0x6d71('0x8'),'scope':[_0x6d71('0x9'),_0x6d71('0xa')],'session':![]});exports[_0x6d71('0xb')]=passport[_0x6d71('0x7')](_0x6d71('0xc'),{'failureRedirect':_0x6d71('0x8'),'session':![]});passport[_0x6d71('0xd')](new GoogleStrategy({'clientID':config[_0x6d71('0xc')]?config[_0x6d71('0xc')][_0x6d71('0xe')]:'id','clientSecret':config[_0x6d71('0xc')]?config[_0x6d71('0xc')][_0x6d71('0xf')]:'secret','callbackURL':config['google']?config[_0x6d71('0xc')][_0x6d71('0x10')]:''},function(_0x1ccb55,_0x18680f,_0xdd494b,_0x36ef62){var _0x46b1d9,_0x4d2d24;return db[_0x6d71('0x11')][_0x6d71('0x12')]({'where':{'id':0x1},'attributes':[_0x6d71('0x13'),_0x6d71('0x14')],'raw':!![]})[_0x6d71('0x15')](function(_0x318db2){_0x46b1d9=_0x318db2;return db[_0x6d71('0x16')][_0x6d71('0x17')]({'where':{'email':_[_0x6d71('0x18')](_0xdd494b[_0x6d71('0x19')],_0x6d71('0x1a')),'role':{'$or':[_0x6d71('0x1b'),'user','agent']}}});})[_0x6d71('0x15')](function(_0x414184){_0x4d2d24=_0x414184;if(_0x4d2d24){if(_0x4d2d24[_0x6d71('0x1c')]){return _0x36ef62(_0x6d71('0x1d'));}else if(_0x46b1d9['blockDuration']>0x0){if(_0x4d2d24['blocked']){if(moment(_0x4d2d24['blockedAt'])[_0x6d71('0x1e')](_0x46b1d9[_0x6d71('0x14')],_0x6d71('0x1f'))>moment()){return _0x36ef62(_0x6d71('0x1d'));}else{return utils[_0x6d71('0x20')](_0x4d2d24,0x0,![],null)[_0x6d71('0x15')](function(){return utils['getLicense'](_0x4d2d24);})['then'](function(){return _0x36ef62(null,_0x4d2d24);});}}else{return utils[_0x6d71('0x21')](_0x4d2d24)[_0x6d71('0x15')](function(){return _0x36ef62(null,_0x4d2d24);});}}else{return utils[_0x6d71('0x21')](_0x4d2d24)['then'](function(){return _0x36ef62(null,_0x4d2d24);});}}return _0x36ef62(_0x6d71('0x1d'));})[_0x6d71('0x22')](function(_0x1a2497){_0x36ef62(_0x1a2497);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7001ea5..796cee4 100644 --- a/server/api/authGoogle/index.js +++ b/server/api/authGoogle/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda55=['../../components/auth/service','get','login','callback','exports','express','passport','../user/user.controller.js'];(function(_0x5e7777,_0x5aec03){var _0xc8dfc3=function(_0x37b498){while(--_0x37b498){_0x5e7777['push'](_0x5e7777['shift']());}};_0xc8dfc3(++_0x5aec03);}(_0xda55,0x6d));var _0x5da5=function(_0x4800c4,_0x13b31e){_0x4800c4=_0x4800c4-0x0;var _0x5bd103=_0xda55[_0x4800c4];return _0x5bd103;};'use strict';var express=require(_0x5da5('0x0'));var passport=require(_0x5da5('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x5da5('0x2'));var authService=require(_0x5da5('0x3'));router[_0x5da5('0x4')]('/',controller[_0x5da5('0x5')]);router[_0x5da5('0x4')]('/callback',controller[_0x5da5('0x6')],authService['isMiddleware'],userController[_0x5da5('0x5')],authService['setTokenCookie']);module[_0x5da5('0x7')]=router; \ No newline at end of file +var _0x3f19=['express','../user/user.controller.js','get','login','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0x3f19,0xc0));var _0x93f1=function(_0x2262f5,_0x5a409f){_0x2262f5=_0x2262f5-0x0;var _0x25fc8c=_0x3f19[_0x2262f5];return _0x25fc8c;};'use strict';var express=require(_0x93f1('0x0'));var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x93f1('0x1'));var authService=require('../../components/auth/service');router[_0x93f1('0x2')]('/',controller[_0x93f1('0x3')]);router[_0x93f1('0x2')](_0x93f1('0x4'),controller['callback'],authService[_0x93f1('0x5')],userController[_0x93f1('0x3')],authService[_0x93f1('0x6')]);module[_0x93f1('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 7324785..31cc6d9 100644 --- a/server/api/authLocal/authLocal.controller.js +++ b/server/api/authLocal/authLocal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x583c=['merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','util','passport','passport-local','Strategy','lodash','randomstring','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass'];(function(_0x874a49,_0x5b07bc){var _0x343d2f=function(_0x351928){while(--_0x351928){_0x874a49['push'](_0x874a49['shift']());}};_0x343d2f(++_0x5b07bc);}(_0x583c,0x12b));var _0xc583=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x583c[_0x2ed7d1];return _0x38ae3c;};'use strict';var util=require(_0xc583('0x0'));var passport=require(_0xc583('0x1'));var LocalStrategy=require(_0xc583('0x2'))[_0xc583('0x3')];var jayson=require('jayson/promise');var _=require(_0xc583('0x4'));var rs=require(_0xc583('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xc583('0x6'));var utils=require(_0xc583('0x7'));var client=jayson['client'][_0xc583('0x8')]({'port':0x232b});function localAuthenticate(_0x365ed6,_0x2719df,_0x1dd37c,_0x48a8d4){var _0x21ed88,_0x26cec0;return db['Setting'][_0xc583('0x9')]({'where':{'id':0x1},'attributes':[_0xc583('0xa'),_0xc583('0xb')],'raw':!![]})[_0xc583('0xc')](function(_0x2d99ca){_0x21ed88=_0x2d99ca;return _0x365ed6['findOne']({'attributes':['id',_0xc583('0xd'),_0xc583('0xe'),'salt',_0xc583('0xf'),_0xc583('0x10'),'blocked',_0xc583('0x11'),_0xc583('0x12')],'where':{'name':_0x2719df,'role':{'$or':[_0xc583('0x13'),_0xc583('0x14'),_0xc583('0x15')]}}});})[_0xc583('0xc')](function(_0x183cca){if(!_0x183cca||_0x183cca&&_0x183cca[_0xc583('0xd')]!==_0x2719df){throw new Error(_0xc583('0x16'));}else{_0x26cec0=_0x183cca;return _0x26cec0;}})['then'](function(){_0x26cec0[_0xc583('0x17')](_0x1dd37c,function(_0x51ecd7,_0x19f46a){var _0x299fa1=_0x26cec0['loginAttempts']+0x1;if(_0x51ecd7){return _0x48a8d4(_0x51ecd7);}else if(!_0x19f46a){if(_0x26cec0[_0xc583('0x10')]){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else if(_0x21ed88['allowedLoginAttempts']>0x0){if(_0x26cec0[_0xc583('0x18')]){if(_0x21ed88[_0xc583('0xb')]>0x0){if(moment(_0x26cec0['blockedAt'])[_0xc583('0x19')](_0x21ed88[_0xc583('0xb')],_0xc583('0x1a'))>moment()){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else{return utils['clearBlockUser'](_0x26cec0,_0x299fa1,![],null)[_0xc583('0xc')](function(){return _0x48a8d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}}else{if(_0x299fa1>=_0x21ed88[_0xc583('0xa')]){return utils[_0xc583('0x1b')](_0x26cec0,0x0,!![],moment())[_0xc583('0xc')](function(){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});});}else{return utils[_0xc583('0x1b')](_0x26cec0,_0x299fa1,![],null)[_0xc583('0xc')](function(){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});});}}}else{return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}}else{if(_0x26cec0[_0xc583('0x10')]){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else if(_0x21ed88[_0xc583('0xa')]>0x0){if(_0x26cec0[_0xc583('0x18')]){if(_0x21ed88['blockDuration']>0x0){if(moment(_0x26cec0['blockedAt'])[_0xc583('0x19')](_0x21ed88[_0xc583('0xb')],_0xc583('0x1a'))>moment()){return _0x48a8d4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc583('0x1b')](_0x26cec0,0x0,![],null)[_0xc583('0xc')](function(){return utils[_0xc583('0x1c')](_0x26cec0);})[_0xc583('0xc')](function(){return _0x48a8d4(null,_0x26cec0);});}}else{return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}}else{return utils['clearBlockUser'](_0x26cec0,0x0,![],null)['then'](function(){return utils[_0xc583('0x1c')](_0x26cec0);})['then'](function(){return _0x48a8d4(null,_0x26cec0);})[_0xc583('0x1d')](function(_0xcbe9b2){return _0x48a8d4(null,![],_0xcbe9b2);});}}else{if(_0x26cec0[_0xc583('0x18')]){return _0x48a8d4(null,![],{'message':_0xc583('0x16')});}else{return utils[_0xc583('0x1c')](_0x26cec0)['then'](function(){return _0x48a8d4(null,_0x26cec0);});}}}});})[_0xc583('0x1d')](function(_0x44f76a){return _0x48a8d4(null,![],_0x44f76a);});}function sendServiceMail(_0x4adde3){return db[_0xc583('0x1e')]['find']({'where':{'service':!![]},'attributes':['id',_0xc583('0xd'),_0xc583('0x1f')],'include':[{'model':db[_0xc583('0x20')],'as':_0xc583('0x21')}]})[_0xc583('0xc')](function(_0x19079b){if(!_0x19079b){throw new Error(_0xc583('0x22'));}var _0x4a87b5={'tls':{'rejectUnauthorized':![]}};if(_0x19079b[_0xc583('0x21')][_0xc583('0x23')]){_0x4a87b5[_0xc583('0x23')]=_0x19079b[_0xc583('0x21')][_0xc583('0x23')];}else{_0x4a87b5[_0xc583('0x24')]=_0x19079b['Smtp'][_0xc583('0x24')];_0x4a87b5['port']=_0x19079b['Smtp'][_0xc583('0x25')];_0x4a87b5[_0xc583('0x26')]=_0x19079b[_0xc583('0x21')][_0xc583('0x26')];}if(_0x19079b[_0xc583('0x21')]['authentication']){_0x4a87b5[_0xc583('0x27')]={'user':_0x19079b[_0xc583('0x21')][_0xc583('0x14')],'pass':_0x19079b['Smtp'][_0xc583('0x28')]};}var _0x55bdca={'account':_0x4a87b5,'message':_[_0xc583('0x29')]({'from':util[_0xc583('0x2a')](_0xc583('0x2b'),_0x19079b[_0xc583('0xd')],_0x19079b[_0xc583('0x1f')]||_0x19079b['Smtp'][_0xc583('0x14')])},_0x4adde3)};return client['request'](_0xc583('0x2c'),_0x55bdca);})['then'](function(_0x2e96fc){if(_0x2e96fc[_0xc583('0x2d')]){throw new Error(util[_0xc583('0x2a')](_0xc583('0x2e'),_0x2e96fc[_0xc583('0x2d')][_0xc583('0x2f')]||JSON['stringify'](_0x2e96fc['error'])));}return!![];});}function handleError(_0x3720d6,_0xa02621,_0x56c4b6){return _0x3720d6[_0xc583('0x30')](_0xa02621||0x1f4)[_0xc583('0x31')]({'message':_0x56c4b6?_0x56c4b6[_0xc583('0x2f')]||_0x56c4b6:''});}exports[_0xc583('0x32')]=function(_0x37b8c7,_0x388a85,_0x4e11d9){passport[_0xc583('0x17')]('local',function(_0x1d9735,_0x22cc57,_0x39bed4){var _0x502b6d=_0x1d9735||_0x39bed4;if(_0x502b6d){return handleError(_0x388a85,0x191,_0x502b6d);}if(!_0x22cc57){return handleError(_0x388a85,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x518c90={'payload':{'id':_0x22cc57['id'],'role':_0x22cc57[_0xc583('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xc583('0x33')](_0x518c90)[_0xc583('0xc')](function(_0x342b66){_0x388a85['json']({'id':_0x22cc57['id'],'token':_0x342b66,'statusCall':'','isAlreadyLogged':_0x22cc57[_0xc583('0x34')]});});}})(_0x37b8c7,_0x388a85,_0x4e11d9);};exports[_0xc583('0x35')]=function(_0x594a0b,_0x48930a,_0x1ea5da){if(!_0x594a0b['body'][_0xc583('0x1f')]){return handleError(_0x48930a,0x1f4,{'message':_0xc583('0x36')});}var _0xe73752=rs[_0xc583('0x37')]();_0x594a0b['body'][_0xc583('0x1f')]=_0x594a0b[_0xc583('0x38')][_0xc583('0x1f')][_0xc583('0x39')]()[_0xc583('0x3a')]();var _0x5e6e7e;return db[_0xc583('0x3b')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc583('0xb')],'raw':!![]})[_0xc583('0xc')](function(_0x5788c7){_0x5e6e7e=_0x5788c7;return db['User'][_0xc583('0x3c')]({'where':{'email':_0x594a0b[_0xc583('0x38')][_0xc583('0x1f')]}});})[_0xc583('0xc')](function(_0x4b6d39){if(!_0x4b6d39){throw new Error(_0xc583('0x3d'));}if(_0x4b6d39['disabled']){throw new Error(_0xc583('0x3e'));}if(_0x4b6d39['blocked']){if(moment(_0x4b6d39[_0xc583('0x11')])[_0xc583('0x19')](_0x5e6e7e[_0xc583('0xb')],_0xc583('0x1a'))>moment()){throw new Error(_0xc583('0x3f'));}else{_0x4b6d39['blocked']=![];_0x4b6d39[_0xc583('0x11')]=null;}}_0x4b6d39[_0xc583('0x40')]=_0xe73752;_0x4b6d39[_0xc583('0x41')]=Date['now']()+0x36ee80;return _0x4b6d39['save']();})['then'](function(){return sendServiceMail({'to':_0x594a0b[_0xc583('0x38')]['email'],'subject':_0xc583('0x42'),'text':_0xc583('0x43')+_0xc583('0x44')+_0xc583('0x45')+_0x594a0b[_0xc583('0x46')][_0xc583('0x24')]+_0xc583('0x47')+_0xe73752+'\x0a\x0a'+_0xc583('0x48')});})[_0xc583('0xc')](function(){_0x48930a[_0xc583('0x30')](0xc8)[_0xc583('0x31')]({'message':'Reset\x20Email\x20sent!'});})[_0xc583('0x1d')](function(_0x121262){return handleError(_0x48930a,0x1f4,_0x121262);});};exports[_0xc583('0x49')]=function(_0x230a45,_0x56e370,_0xab8f73){return db[_0xc583('0x4a')][_0xc583('0x3c')]({'where':{'resetPasswordToken':_0x230a45[_0xc583('0x4b')][_0xc583('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xc583('0x4d')]()}}})[_0xc583('0xc')](function(_0x12291c){if(!_0x12291c){throw new Error(_0xc583('0x4e'));}return db['Setting'][_0xc583('0x9')]({'attributes':['id',_0xc583('0x4f'),_0xc583('0x50'),_0xc583('0x51')]})[_0xc583('0xc')](function(_0xc42b2a){if(_0xc42b2a[_0xc583('0x4f')])authService[_0xc583('0x52')](_0x230a45[_0xc583('0x38')][_0xc583('0xe')]);if(!_0xc42b2a[_0xc583('0x50')]||!_0x12291c[_0xc583('0x53')])return _0x12291c;authService[_0xc583('0x54')](_0x230a45['body'][_0xc583('0xe')],_0x12291c[_0xc583('0x53')],_0xc42b2a[_0xc583('0x51')]);return _0x12291c;})[_0xc583('0xc')](function(){_0x12291c[_0xc583('0xe')]=_0x230a45[_0xc583('0x38')][_0xc583('0xe')];_0x12291c[_0xc583('0x40')]=null;_0x12291c[_0xc583('0x41')]=null;return _0x12291c['save']();});})[_0xc583('0xc')](function(){_0x56e370[_0xc583('0x30')](0xc8)[_0xc583('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x2bb764){return handleError(_0x56e370,0x1f4,_0x2bb764);});};passport['use'](new LocalStrategy({'usernameField':_0xc583('0xd'),'passwordField':_0xc583('0xe')},function(_0x5613e7,_0x49e691,_0x282290){return localAuthenticate(db[_0xc583('0x4a')],_0x5613e7,_0x49e691,_0x282290);})); \ No newline at end of file +var _0xc6ac=['passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','signToken','json','online','forgot','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','Reset\x20Email\x20sent!','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','use','util'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2eaa51,_0x394993){_0x2eaa51=_0x2eaa51-0x0;var _0x5b35d8=_0xc6ac[_0x2eaa51];return _0x5b35d8;};'use strict';var util=require(_0xcc6a('0x0'));var passport=require(_0xcc6a('0x1'));var LocalStrategy=require(_0xcc6a('0x2'))[_0xcc6a('0x3')];var jayson=require(_0xcc6a('0x4'));var _=require(_0xcc6a('0x5'));var rs=require(_0xcc6a('0x6'));var moment=require(_0xcc6a('0x7'));var db=require(_0xcc6a('0x8'))['db'];var authService=require(_0xcc6a('0x9'));var utils=require(_0xcc6a('0xa'));var client=jayson[_0xcc6a('0xb')][_0xcc6a('0xc')]({'port':0x232b});function localAuthenticate(_0x197bd7,_0x5f3887,_0x3dd497,_0x11b919){var _0xf02261,_0x560cc4;return db[_0xcc6a('0xd')][_0xcc6a('0xe')]({'where':{'id':0x1},'attributes':[_0xcc6a('0xf'),_0xcc6a('0x10')],'raw':!![]})[_0xcc6a('0x11')](function(_0x5e91a2){_0xf02261=_0x5e91a2;return _0x197bd7[_0xcc6a('0xe')]({'attributes':['id',_0xcc6a('0x12'),_0xcc6a('0x13'),'salt',_0xcc6a('0x14'),_0xcc6a('0x15'),_0xcc6a('0x16'),'blockedAt','loginAttempts'],'where':{'name':_0x5f3887,'role':{'$or':[_0xcc6a('0x17'),_0xcc6a('0x18'),_0xcc6a('0x19')]}}});})['then'](function(_0x483ed4){if(!_0x483ed4||_0x483ed4&&_0x483ed4[_0xcc6a('0x12')]!==_0x5f3887){throw new Error(_0xcc6a('0x1a'));}else{_0x560cc4=_0x483ed4;return _0x560cc4;}})[_0xcc6a('0x11')](function(){_0x560cc4[_0xcc6a('0x1b')](_0x3dd497,function(_0x96f9de,_0x337ec5){var _0x4133fa=_0x560cc4[_0xcc6a('0x1c')]+0x1;if(_0x96f9de){return _0x11b919(_0x96f9de);}else if(!_0x337ec5){if(_0x560cc4['disabled']){return _0x11b919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xf02261['allowedLoginAttempts']>0x0){if(_0x560cc4[_0xcc6a('0x16')]){if(_0xf02261[_0xcc6a('0x10')]>0x0){if(moment(_0x560cc4[_0xcc6a('0x1d')])[_0xcc6a('0x1e')](_0xf02261[_0xcc6a('0x10')],_0xcc6a('0x1f'))>moment()){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}else{return utils[_0xcc6a('0x20')](_0x560cc4,_0x4133fa,![],null)[_0xcc6a('0x11')](function(){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});});}}else{return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}}else{if(_0x4133fa>=_0xf02261['allowedLoginAttempts']){return utils[_0xcc6a('0x20')](_0x560cc4,0x0,!![],moment())[_0xcc6a('0x11')](function(){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});});}else{return utils[_0xcc6a('0x20')](_0x560cc4,_0x4133fa,![],null)[_0xcc6a('0x11')](function(){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});});}}}else{return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}}else{if(_0x560cc4[_0xcc6a('0x15')]){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}else if(_0xf02261[_0xcc6a('0xf')]>0x0){if(_0x560cc4[_0xcc6a('0x16')]){if(_0xf02261[_0xcc6a('0x10')]>0x0){if(moment(_0x560cc4['blockedAt'])[_0xcc6a('0x1e')](_0xf02261[_0xcc6a('0x10')],_0xcc6a('0x1f'))>moment()){return _0x11b919(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xcc6a('0x20')](_0x560cc4,0x0,![],null)[_0xcc6a('0x11')](function(){return utils[_0xcc6a('0x21')](_0x560cc4);})[_0xcc6a('0x11')](function(){return _0x11b919(null,_0x560cc4);});}}else{return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}}else{return utils[_0xcc6a('0x20')](_0x560cc4,0x0,![],null)['then'](function(){return utils[_0xcc6a('0x21')](_0x560cc4);})[_0xcc6a('0x11')](function(){return _0x11b919(null,_0x560cc4);})[_0xcc6a('0x22')](function(_0x5f27e5){return _0x11b919(null,![],_0x5f27e5);});}}else{if(_0x560cc4[_0xcc6a('0x16')]){return _0x11b919(null,![],{'message':_0xcc6a('0x1a')});}else{return utils['getLicense'](_0x560cc4)[_0xcc6a('0x11')](function(){return _0x11b919(null,_0x560cc4);});}}}});})[_0xcc6a('0x22')](function(_0x3233d1){return _0x11b919(null,![],_0x3233d1);});}function sendServiceMail(_0x473f88){return db['MailAccount'][_0xcc6a('0x23')]({'where':{'service':!![]},'attributes':['id',_0xcc6a('0x12'),_0xcc6a('0x24')],'include':[{'model':db['MailServerOut'],'as':_0xcc6a('0x25')}]})['then'](function(_0x4f67d3){if(!_0x4f67d3){throw new Error(_0xcc6a('0x26'));}var _0x2e9f41={'tls':{'rejectUnauthorized':![]}};if(_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x27')]){_0x2e9f41[_0xcc6a('0x27')]=_0x4f67d3[_0xcc6a('0x25')]['service'];}else{_0x2e9f41[_0xcc6a('0x28')]=_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x28')];_0x2e9f41[_0xcc6a('0x29')]=_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x29')];_0x2e9f41[_0xcc6a('0x2a')]=_0x4f67d3[_0xcc6a('0x25')]['secure'];}if(_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x2b')]){_0x2e9f41[_0xcc6a('0x2c')]={'user':_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x18')],'pass':_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x2d')]};}var _0x5afbbc={'account':_0x2e9f41,'message':_[_0xcc6a('0x2e')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x4f67d3['name'],_0x4f67d3[_0xcc6a('0x24')]||_0x4f67d3[_0xcc6a('0x25')][_0xcc6a('0x18')])},_0x473f88)};return client[_0xcc6a('0x2f')](_0xcc6a('0x30'),_0x5afbbc);})['then'](function(_0x58f6ee){if(_0x58f6ee[_0xcc6a('0x31')]){throw new Error(util[_0xcc6a('0x32')](_0xcc6a('0x33'),_0x58f6ee['error'][_0xcc6a('0x34')]||JSON[_0xcc6a('0x35')](_0x58f6ee[_0xcc6a('0x31')])));}return!![];});}function handleError(_0xa326b2,_0x73bf0d,_0x24175b){return _0xa326b2[_0xcc6a('0x36')](_0x73bf0d||0x1f4)[_0xcc6a('0x37')]({'message':_0x24175b?_0x24175b[_0xcc6a('0x34')]||_0x24175b:''});}exports[_0xcc6a('0x38')]=function(_0x5b11c8,_0x2c14ba,_0x15d87f){passport[_0xcc6a('0x1b')](_0xcc6a('0x39'),function(_0x33e8c8,_0x11e5b1,_0x386cbc){var _0x57dafe=_0x33e8c8||_0x386cbc;if(_0x57dafe){return handleError(_0x2c14ba,0x191,_0x57dafe);}if(!_0x11e5b1){return handleError(_0x2c14ba,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1d3e45={'payload':{'id':_0x11e5b1['id'],'role':_0x11e5b1[_0xcc6a('0x14')]},'options':{'expiresIn':0x15180}};return authService[_0xcc6a('0x3a')](_0x1d3e45)[_0xcc6a('0x11')](function(_0x1e628b){_0x2c14ba[_0xcc6a('0x3b')]({'id':_0x11e5b1['id'],'token':_0x1e628b,'statusCall':'','isAlreadyLogged':_0x11e5b1[_0xcc6a('0x3c')]});});}})(_0x5b11c8,_0x2c14ba,_0x15d87f);};exports[_0xcc6a('0x3d')]=function(_0x49b65c,_0x56bc7d,_0x470e3b){if(!_0x49b65c['body']['email']){return handleError(_0x56bc7d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x674e04=rs[_0xcc6a('0x3e')]();_0x49b65c[_0xcc6a('0x3f')][_0xcc6a('0x24')]=_0x49b65c[_0xcc6a('0x3f')]['email'][_0xcc6a('0x40')]()[_0xcc6a('0x41')]();var _0x17e5a0;return db[_0xcc6a('0xd')][_0xcc6a('0xe')]({'where':{'id':0x1},'attributes':[_0xcc6a('0xf'),'blockDuration'],'raw':!![]})[_0xcc6a('0x11')](function(_0xa4d48a){_0x17e5a0=_0xa4d48a;return db[_0xcc6a('0x42')][_0xcc6a('0x23')]({'where':{'email':_0x49b65c['body'][_0xcc6a('0x24')]}});})['then'](function(_0x351529){if(!_0x351529){throw new Error(_0xcc6a('0x43'));}if(_0x351529[_0xcc6a('0x15')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x351529[_0xcc6a('0x16')]){if(moment(_0x351529[_0xcc6a('0x1d')])[_0xcc6a('0x1e')](_0x17e5a0['blockDuration'],'minutes')>moment()){throw new Error(_0xcc6a('0x44'));}else{_0x351529[_0xcc6a('0x16')]=![];_0x351529[_0xcc6a('0x1d')]=null;}}_0x351529[_0xcc6a('0x45')]=_0x674e04;_0x351529[_0xcc6a('0x46')]=Date['now']()+0x36ee80;return _0x351529[_0xcc6a('0x47')]();})[_0xcc6a('0x11')](function(){return sendServiceMail({'to':_0x49b65c['body'][_0xcc6a('0x24')],'subject':_0xcc6a('0x48'),'text':_0xcc6a('0x49')+_0xcc6a('0x4a')+_0xcc6a('0x4b')+_0x49b65c[_0xcc6a('0x4c')]['host']+'/reset/'+_0x674e04+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xcc6a('0x11')](function(){_0x56bc7d[_0xcc6a('0x36')](0xc8)[_0xcc6a('0x37')]({'message':_0xcc6a('0x4d')});})['catch'](function(_0x1c3bb8){return handleError(_0x56bc7d,0x1f4,_0x1c3bb8);});};exports['reset']=function(_0x3aa7dd,_0x4299ca,_0xcfc540){return db[_0xcc6a('0x42')][_0xcc6a('0x23')]({'where':{'resetPasswordToken':_0x3aa7dd[_0xcc6a('0x4e')]['token'],'resetPasswordExpires':{'$gt':Date[_0xcc6a('0x4f')]()}}})[_0xcc6a('0x11')](function(_0x681e75){if(!_0x681e75){throw new Error(_0xcc6a('0x50'));}return db[_0xcc6a('0xd')][_0xcc6a('0xe')]({'attributes':['id',_0xcc6a('0x51'),_0xcc6a('0x52'),_0xcc6a('0x53')]})[_0xcc6a('0x11')](function(_0x486072){if(_0x486072[_0xcc6a('0x51')])authService[_0xcc6a('0x54')](_0x3aa7dd[_0xcc6a('0x3f')][_0xcc6a('0x13')]);if(!_0x486072[_0xcc6a('0x52')]||!_0x681e75[_0xcc6a('0x55')])return _0x681e75;authService['validatePasswordHistory'](_0x3aa7dd['body'][_0xcc6a('0x13')],_0x681e75['previousPasswords'],_0x486072[_0xcc6a('0x53')]);return _0x681e75;})[_0xcc6a('0x11')](function(){_0x681e75[_0xcc6a('0x13')]=_0x3aa7dd[_0xcc6a('0x3f')][_0xcc6a('0x13')];_0x681e75[_0xcc6a('0x45')]=null;_0x681e75[_0xcc6a('0x46')]=null;return _0x681e75[_0xcc6a('0x47')]();});})[_0xcc6a('0x11')](function(){_0x4299ca[_0xcc6a('0x36')](0xc8)[_0xcc6a('0x37')]({'message':'Password\x20reset!'});})[_0xcc6a('0x22')](function(_0x48eed9){return handleError(_0x4299ca,0x1f4,_0x48eed9);});};passport[_0xcc6a('0x56')](new LocalStrategy({'usernameField':_0xcc6a('0x12'),'passwordField':_0xcc6a('0x13')},function(_0x571a0a,_0x446abb,_0x58ff89){return localAuthenticate(db[_0xcc6a('0x42')],_0x571a0a,_0x446abb,_0x58ff89);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 70bcd52..194f989 100644 --- a/server/api/authLocal/index.js +++ b/server/api/authLocal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab6d=['./authLocal.controller','post','/forgot','/reset/:token','exports','express','Router'];(function(_0xf5fef7,_0x4c878b){var _0x417aa9=function(_0x3134f1){while(--_0x3134f1){_0xf5fef7['push'](_0xf5fef7['shift']());}};_0x417aa9(++_0x4c878b);}(_0xab6d,0x1ef));var _0xdab6=function(_0x4d244b,_0x3c9d64){_0x4d244b=_0x4d244b-0x0;var _0x29a47c=_0xab6d[_0x4d244b];return _0x29a47c;};'use strict';var express=require(_0xdab6('0x0'));var router=express[_0xdab6('0x1')]();var controller=require(_0xdab6('0x2'));router['post']('/',controller['login']);router[_0xdab6('0x3')](_0xdab6('0x4'),controller['forgot']);router[_0xdab6('0x3')](_0xdab6('0x5'),controller['reset']);module[_0xdab6('0x6')]=router; \ No newline at end of file +var _0xa040=['post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0xa040,0x15b));var _0x0a04=function(_0xadc596,_0x129f68){_0xadc596=_0xadc596-0x0;var _0x1e126f=_0xa040[_0xadc596];return _0x1e126f;};'use strict';var express=require(_0x0a04('0x0'));var router=express[_0x0a04('0x1')]();var controller=require(_0x0a04('0x2'));router[_0x0a04('0x3')]('/',controller[_0x0a04('0x4')]);router[_0x0a04('0x3')](_0x0a04('0x5'),controller[_0x0a04('0x6')]);router[_0x0a04('0x3')](_0x0a04('0x7'),controller[_0x0a04('0x8')]);module[_0x0a04('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f4e56a0..ddb541b 100644 --- a/server/api/automation/automation.attributes.js +++ b/server/api/automation/automation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf400=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf400,0x16e));var _0x0f40=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf400[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require(_0x0f40('0x0'));module[_0x0f40('0x1')]={'name':{'type':Sequelize[_0x0f40('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0f40('0x2')]},'status':{'type':Sequelize[_0x0f40('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0f40('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x01b9=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x01b9,0x1bb));var _0x901b=function(_0x403728,_0x2aa30e){_0x403728=_0x403728-0x0;var _0x1d51df=_0x01b9[_0x403728];return _0x1d51df;};'use strict';var Sequelize=require(_0x901b('0x0'));module[_0x901b('0x1')]={'name':{'type':Sequelize[_0x901b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x901b('0x2')]},'description':{'type':Sequelize[_0x901b('0x2')]},'status':{'type':Sequelize[_0x901b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x901b('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fbdf160..4bc60d8 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','render','merge','body','contact','message','agent','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','create','find','destroy','addConditions','ids','omit','getConditions','findOne','Condition','hasOwnProperty','addActions','getActions','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x488e3d,_0x4f7e2a){var _0x3ee2b2=function(_0x5b6b37){while(--_0x5b6b37){_0x488e3d['push'](_0x488e3d['shift']());}};_0x3ee2b2(++_0x4f7e2a);}(_0xda3f,0xec));var _0xfda3=function(_0x3d0497,_0x41a640){_0x3d0497=_0x3d0497-0x0;var _0x2b2b42=_0xda3f[_0x3d0497];return _0x2b2b42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}function getMustacheRender(_0x5704c7,_0x3c1549){return Mustache[_0xfda3('0x28')](_0x5704c7,_[_0xfda3('0x29')](_0x3c1549[_0xfda3('0x2a')],{'contact':_0x3c1549[_0xfda3('0x2b')],'message':_0x3c1549[_0xfda3('0x2c')],'agent':_0x3c1549[_0xfda3('0x2d')],'interaction':_0x3c1549['interaction'],'account':_0x3c1549['account']}))||'';}exports[_0xfda3('0x2e')]=function(_0x4fd277,_0x4b9d90){var _0x16b4a2={},_0x2a5971={},_0x34f9d2={'count':0x0,'rows':[]};var _0xd7e1d6=_[_0xfda3('0x2f')](db[_0xfda3('0x30')][_0xfda3('0x31')],function(_0xd6b6d7){return{'name':_0xd6b6d7[_0xfda3('0x32')],'type':_0xd6b6d7['type'][_0xfda3('0x33')]};});_0x2a5971[_0xfda3('0x34')]=_[_0xfda3('0x2f')](_0xd7e1d6,_0xfda3('0x26'));_0x2a5971[_0xfda3('0x35')]=_[_0xfda3('0x36')](_0x4fd277[_0xfda3('0x35')]);_0x2a5971[_0xfda3('0x37')]=_[_0xfda3('0x38')](_0x2a5971['model'],_0x2a5971['query']);_0x16b4a2[_0xfda3('0x39')]=_[_0xfda3('0x38')](_0x2a5971['model'],qs[_0xfda3('0x3a')](_0x4fd277[_0xfda3('0x35')][_0xfda3('0x3a')]));_0x16b4a2['attributes']=_0x16b4a2[_0xfda3('0x39')][_0xfda3('0x3b')]?_0x16b4a2[_0xfda3('0x39')]:_0x2a5971[_0xfda3('0x34')];if(!_0x4fd277[_0xfda3('0x35')]['hasOwnProperty'](_0xfda3('0x3c'))){_0x16b4a2[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x4fd277['query'][_0xfda3('0x1b')]);_0x16b4a2['offset']=qs[_0xfda3('0x19')](_0x4fd277[_0xfda3('0x35')][_0xfda3('0x19')]);}_0x16b4a2[_0xfda3('0x3d')]=qs[_0xfda3('0x3e')](_0x4fd277[_0xfda3('0x35')][_0xfda3('0x3e')]);_0x16b4a2[_0xfda3('0x3f')]=qs['filters'](_[_0xfda3('0x40')](_0x4fd277[_0xfda3('0x35')],_0x2a5971[_0xfda3('0x37')]),_0xd7e1d6);if(_0x4fd277[_0xfda3('0x35')]['filter']){_0x16b4a2[_0xfda3('0x3f')]=_[_0xfda3('0x29')](_0x16b4a2[_0xfda3('0x3f')],{'$or':_['map'](_0xd7e1d6,function(_0x5ac61e){if(_0x5ac61e[_0xfda3('0x41')]!==_0xfda3('0x42')){var _0x14716a={};_0x14716a[_0x5ac61e[_0xfda3('0x26')]]={'$like':'%'+_0x4fd277[_0xfda3('0x35')][_0xfda3('0x43')]+'%'};return _0x14716a;}})});}_0x16b4a2=_[_0xfda3('0x29')]({},_0x16b4a2,_0x4fd277[_0xfda3('0x44')]);var _0x2620d0={'where':_0x16b4a2[_0xfda3('0x3f')]};return db['Automation'][_0xfda3('0x1c')](_0x2620d0)[_0xfda3('0x23')](function(_0x5c3ac5){_0x34f9d2[_0xfda3('0x1c')]=_0x5c3ac5;if(_0x4fd277['query']['includeAll']){_0x16b4a2['include']=[{'all':!![]}];}return db[_0xfda3('0x30')][_0xfda3('0x45')](_0x16b4a2);})[_0xfda3('0x23')](function(_0x209918){_0x34f9d2['rows']=_0x209918;return _0x34f9d2;})[_0xfda3('0x23')](respondWithFilteredResult(_0x4b9d90,_0x16b4a2))[_0xfda3('0x46')](handleError(_0x4b9d90,null));};exports[_0xfda3('0x47')]=function(_0x2ce504,_0x564ccd){var _0x10482a={'raw':![],'where':{'id':_0x2ce504[_0xfda3('0x48')]['id']}},_0x240c16={};_0x240c16['model']=_['keys'](db[_0xfda3('0x30')][_0xfda3('0x31')]);_0x240c16[_0xfda3('0x35')]=_[_0xfda3('0x36')](_0x2ce504[_0xfda3('0x35')]);_0x240c16[_0xfda3('0x37')]=_[_0xfda3('0x38')](_0x240c16[_0xfda3('0x34')],_0x240c16[_0xfda3('0x35')]);_0x10482a[_0xfda3('0x39')]=_[_0xfda3('0x38')](_0x240c16[_0xfda3('0x34')],qs[_0xfda3('0x3a')](_0x2ce504[_0xfda3('0x35')]['fields']));_0x10482a['attributes']=_0x10482a[_0xfda3('0x39')][_0xfda3('0x3b')]?_0x10482a[_0xfda3('0x39')]:_0x240c16[_0xfda3('0x34')];if(_0x2ce504[_0xfda3('0x35')][_0xfda3('0x49')]){_0x10482a[_0xfda3('0x4a')]=[{'all':!![]}];}_0x10482a=_[_0xfda3('0x29')]({},_0x10482a,_0x2ce504[_0xfda3('0x44')]);return db[_0xfda3('0x30')]['find'](_0x10482a)[_0xfda3('0x23')](handleEntityNotFound(_0x564ccd,null))[_0xfda3('0x23')](respondWithResult(_0x564ccd,null))[_0xfda3('0x46')](handleError(_0x564ccd,null));};exports[_0xfda3('0x4b')]=function(_0x26496a,_0x5b4817){return db[_0xfda3('0x30')][_0xfda3('0x4b')](_0x26496a[_0xfda3('0x2a')],{})['then'](respondWithResult(_0x5b4817,0xc9))[_0xfda3('0x46')](handleError(_0x5b4817,null));};exports[_0xfda3('0x22')]=function(_0x11addf,_0x4cd5cb){if(_0x11addf[_0xfda3('0x2a')]['id']){delete _0x11addf[_0xfda3('0x2a')]['id'];}return db[_0xfda3('0x30')][_0xfda3('0x4c')]({'where':{'id':_0x11addf[_0xfda3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cd5cb,null))[_0xfda3('0x23')](saveUpdates(_0x11addf['body'],null))[_0xfda3('0x23')](respondWithResult(_0x4cd5cb,null))['catch'](handleError(_0x4cd5cb,null));};exports[_0xfda3('0x4d')]=function(_0x6447,_0x322b66){return db[_0xfda3('0x30')]['find']({'where':{'id':_0x6447[_0xfda3('0x48')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x322b66,null))[_0xfda3('0x23')](removeEntity(_0x322b66,null))[_0xfda3('0x46')](handleError(_0x322b66,null));};exports[_0xfda3('0x4e')]=function(_0x2ab6e9,_0x1d051f,_0x54fba2){return db['Condition'][_0xfda3('0x4c')]({'where':{'id':_0x2ab6e9[_0xfda3('0x48')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x1d051f,null))['then'](function(_0x5057c9){if(_0x5057c9){return _0x5057c9[_0xfda3('0x4e')](_0x2ab6e9[_0xfda3('0x2a')][_0xfda3('0x4f')],_[_0xfda3('0x50')](_0x2ab6e9[_0xfda3('0x2a')],['ids','id'])||{});}})[_0xfda3('0x23')](respondWithResult(_0x1d051f,null))[_0xfda3('0x46')](handleError(_0x1d051f,null));};exports[_0xfda3('0x51')]=function(_0x375d8c,_0x27c3cb,_0x2f52e2){var _0x360653={};var _0x1c5073={};var _0x3a8c51;var _0x28b6dc;return db[_0xfda3('0x30')][_0xfda3('0x52')]({'where':{'id':_0x375d8c['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x27c3cb,null))[_0xfda3('0x23')](function(_0x33bc84){if(_0x33bc84){_0x3a8c51=_0x33bc84;_0x1c5073[_0xfda3('0x34')]=_[_0xfda3('0x36')](db[_0xfda3('0x53')][_0xfda3('0x31')]);_0x1c5073['query']=_['keys'](_0x375d8c[_0xfda3('0x35')]);_0x1c5073[_0xfda3('0x37')]=_['intersection'](_0x1c5073[_0xfda3('0x34')],_0x1c5073[_0xfda3('0x35')]);_0x360653[_0xfda3('0x39')]=_[_0xfda3('0x38')](_0x1c5073['model'],qs['fields'](_0x375d8c[_0xfda3('0x35')][_0xfda3('0x3a')]));_0x360653[_0xfda3('0x39')]=_0x360653['attributes'][_0xfda3('0x3b')]?_0x360653['attributes']:_0x1c5073[_0xfda3('0x34')];_0x360653[_0xfda3('0x3d')]=qs[_0xfda3('0x3e')](_0x375d8c[_0xfda3('0x35')][_0xfda3('0x3e')]);_0x360653[_0xfda3('0x3f')]=qs['filters'](_[_0xfda3('0x40')](_0x375d8c[_0xfda3('0x35')],_0x1c5073[_0xfda3('0x37')]));if(_0x375d8c[_0xfda3('0x35')][_0xfda3('0x43')]){_0x360653['where']=_['merge'](_0x360653[_0xfda3('0x3f')],{'$or':_[_0xfda3('0x2f')](_0x360653['attributes'],function(_0x550822){var _0x512d7b={};_0x512d7b[_0x550822]={'$like':'%'+_0x375d8c[_0xfda3('0x35')][_0xfda3('0x43')]+'%'};return _0x512d7b;})});}_0x360653=_['merge']({},_0x360653,_0x375d8c[_0xfda3('0x44')]);return _0x3a8c51[_0xfda3('0x51')](_0x360653);}})[_0xfda3('0x23')](function(_0x2e042b){if(_0x2e042b){_0x28b6dc=_0x2e042b['length'];if(!_0x375d8c[_0xfda3('0x35')][_0xfda3('0x54')](_0xfda3('0x3c'))){_0x360653[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x375d8c[_0xfda3('0x35')]['limit']);_0x360653['offset']=qs[_0xfda3('0x19')](_0x375d8c['query'][_0xfda3('0x19')]);}return _0x3a8c51[_0xfda3('0x51')](_0x360653);}})[_0xfda3('0x23')](function(_0x3884b1){if(_0x3884b1){return _0x3884b1?{'count':_0x28b6dc,'rows':_0x3884b1}:null;}})[_0xfda3('0x23')](respondWithResult(_0x27c3cb,null))[_0xfda3('0x46')](handleError(_0x27c3cb,null));};exports[_0xfda3('0x55')]=function(_0x10a200,_0x29b9fb,_0x1eb4dc){return db['Action'][_0xfda3('0x4c')]({'where':{'id':_0x10a200['params']['id']}})['then'](handleEntityNotFound(_0x29b9fb,null))[_0xfda3('0x23')](function(_0x238762){if(_0x238762){return _0x238762['addActions'](_0x10a200[_0xfda3('0x2a')][_0xfda3('0x4f')],_[_0xfda3('0x50')](_0x10a200['body'],[_0xfda3('0x4f'),'id'])||{});}})[_0xfda3('0x23')](respondWithResult(_0x29b9fb,null))[_0xfda3('0x46')](handleError(_0x29b9fb,null));};exports[_0xfda3('0x56')]=function(_0x2448b1,_0x4c7435,_0x5b06a5){var _0x53c2e9={};var _0x1a278c={};var _0xa032b5;var _0x4768dc;return db[_0xfda3('0x30')][_0xfda3('0x52')]({'where':{'id':_0x2448b1[_0xfda3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c7435,null))[_0xfda3('0x23')](function(_0x6c5e9d){if(_0x6c5e9d){_0xa032b5=_0x6c5e9d;_0x1a278c[_0xfda3('0x34')]=_[_0xfda3('0x36')](db['Action'][_0xfda3('0x31')]);_0x1a278c['query']=_[_0xfda3('0x36')](_0x2448b1[_0xfda3('0x35')]);_0x1a278c[_0xfda3('0x37')]=_[_0xfda3('0x38')](_0x1a278c[_0xfda3('0x34')],_0x1a278c[_0xfda3('0x35')]);_0x53c2e9[_0xfda3('0x39')]=_['intersection'](_0x1a278c[_0xfda3('0x34')],qs[_0xfda3('0x3a')](_0x2448b1[_0xfda3('0x35')][_0xfda3('0x3a')]));_0x53c2e9[_0xfda3('0x39')]=_0x53c2e9[_0xfda3('0x39')]['length']?_0x53c2e9[_0xfda3('0x39')]:_0x1a278c[_0xfda3('0x34')];_0x53c2e9[_0xfda3('0x3d')]=qs[_0xfda3('0x3e')](_0x2448b1[_0xfda3('0x35')]['sort']);_0x53c2e9[_0xfda3('0x3f')]=qs[_0xfda3('0x37')](_[_0xfda3('0x40')](_0x2448b1[_0xfda3('0x35')],_0x1a278c[_0xfda3('0x37')]));if(_0x2448b1[_0xfda3('0x35')][_0xfda3('0x43')]){_0x53c2e9[_0xfda3('0x3f')]=_[_0xfda3('0x29')](_0x53c2e9[_0xfda3('0x3f')],{'$or':_['map'](_0x53c2e9[_0xfda3('0x39')],function(_0x271403){var _0x46210d={};_0x46210d[_0x271403]={'$like':'%'+_0x2448b1[_0xfda3('0x35')][_0xfda3('0x43')]+'%'};return _0x46210d;})});}_0x53c2e9=_['merge']({},_0x53c2e9,_0x2448b1['options']);return _0xa032b5[_0xfda3('0x56')](_0x53c2e9);}})[_0xfda3('0x23')](function(_0x120fe9){if(_0x120fe9){_0x4768dc=_0x120fe9[_0xfda3('0x3b')];if(!_0x2448b1[_0xfda3('0x35')][_0xfda3('0x54')](_0xfda3('0x3c'))){_0x53c2e9[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x2448b1[_0xfda3('0x35')][_0xfda3('0x1b')]);_0x53c2e9['offset']=qs[_0xfda3('0x19')](_0x2448b1['query']['offset']);}return _0xa032b5['getActions'](_0x53c2e9);}})[_0xfda3('0x23')](function(_0x4a2c6a){if(_0x4a2c6a){return _0x4a2c6a?{'count':_0x4768dc,'rows':_0x4a2c6a}:null;}})[_0xfda3('0x23')](respondWithResult(_0x4c7435,null))[_0xfda3('0x46')](handleError(_0x4c7435,null));}; \ No newline at end of file +var _0xd8b0=['omit','getActions','Action','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','render','body','message','interaction','index','Automation','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','rows','params','rawAttributes','length','includeAll','include','find','catch','create','Condition','ids','getConditions','findOne','pick','addActions'];(function(_0x568b9f,_0x31ac8d){var _0x4cd0b6=function(_0x51efd7){while(--_0x51efd7){_0x568b9f['push'](_0x568b9f['shift']());}};_0x4cd0b6(++_0x31ac8d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}function getMustacheRender(_0xcbc4ac,_0x59aa83){return Mustache[_0x0d8b('0x28')](_0xcbc4ac,_['merge'](_0x59aa83[_0x0d8b('0x29')],{'contact':_0x59aa83['contact'],'message':_0x59aa83[_0x0d8b('0x2a')],'agent':_0x59aa83['agent'],'interaction':_0x59aa83[_0x0d8b('0x2b')],'account':_0x59aa83['account']}))||'';}exports[_0x0d8b('0x2c')]=function(_0x106e4c,_0x2c058d){var _0x56120a={},_0x4c80a2={},_0x51cf32={'count':0x0,'rows':[]};var _0x4e8992=_['map'](db[_0x0d8b('0x2d')]['rawAttributes'],function(_0x5d05fc){return{'name':_0x5d05fc[_0x0d8b('0x2e')],'type':_0x5d05fc[_0x0d8b('0x2f')][_0x0d8b('0x30')]};});_0x4c80a2[_0x0d8b('0x31')]=_[_0x0d8b('0x32')](_0x4e8992,_0x0d8b('0x27'));_0x4c80a2[_0x0d8b('0x33')]=_[_0x0d8b('0x34')](_0x106e4c['query']);_0x4c80a2[_0x0d8b('0x35')]=_[_0x0d8b('0x36')](_0x4c80a2['model'],_0x4c80a2[_0x0d8b('0x33')]);_0x56120a[_0x0d8b('0x37')]=_[_0x0d8b('0x36')](_0x4c80a2['model'],qs[_0x0d8b('0x38')](_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x56120a[_0x0d8b('0x37')]=_0x56120a[_0x0d8b('0x37')]['length']?_0x56120a[_0x0d8b('0x37')]:_0x4c80a2[_0x0d8b('0x31')];if(!_0x106e4c['query'][_0x0d8b('0x39')](_0x0d8b('0x3a'))){_0x56120a[_0x0d8b('0x3b')]=qs[_0x0d8b('0x3b')](_0x106e4c[_0x0d8b('0x33')]['limit']);_0x56120a['offset']=qs[_0x0d8b('0x1c')](_0x106e4c['query']['offset']);}_0x56120a[_0x0d8b('0x3c')]=qs[_0x0d8b('0x3d')](_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x3d')]);_0x56120a[_0x0d8b('0x3e')]=qs[_0x0d8b('0x35')](_['pick'](_0x106e4c[_0x0d8b('0x33')],_0x4c80a2[_0x0d8b('0x35')]),_0x4e8992);if(_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x3f')]){_0x56120a[_0x0d8b('0x3e')]=_[_0x0d8b('0x40')](_0x56120a[_0x0d8b('0x3e')],{'$or':_['map'](_0x4e8992,function(_0x1d06b6){if(_0x1d06b6[_0x0d8b('0x2f')]!==_0x0d8b('0x41')){var _0x1f196d={};_0x1f196d[_0x1d06b6['name']]={'$like':'%'+_0x106e4c[_0x0d8b('0x33')]['filter']+'%'};return _0x1f196d;}})});}_0x56120a=_[_0x0d8b('0x40')]({},_0x56120a,_0x106e4c[_0x0d8b('0x42')]);var _0x32d7d7={'where':_0x56120a[_0x0d8b('0x3e')]};return db[_0x0d8b('0x2d')][_0x0d8b('0x1e')](_0x32d7d7)[_0x0d8b('0x24')](function(_0x373f69){_0x51cf32[_0x0d8b('0x1e')]=_0x373f69;if(_0x106e4c[_0x0d8b('0x33')]['includeAll']){_0x56120a['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0x56120a);})['then'](function(_0x1a46f6){_0x51cf32[_0x0d8b('0x43')]=_0x1a46f6;return _0x51cf32;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x2c058d,_0x56120a))['catch'](handleError(_0x2c058d,null));};exports['show']=function(_0x1b216d,_0x192de1){var _0x344278={'raw':![],'where':{'id':_0x1b216d[_0x0d8b('0x44')]['id']}},_0x513b93={};_0x513b93[_0x0d8b('0x31')]=_['keys'](db['Automation'][_0x0d8b('0x45')]);_0x513b93['query']=_[_0x0d8b('0x34')](_0x1b216d['query']);_0x513b93['filters']=_[_0x0d8b('0x36')](_0x513b93[_0x0d8b('0x31')],_0x513b93['query']);_0x344278['attributes']=_['intersection'](_0x513b93['model'],qs[_0x0d8b('0x38')](_0x1b216d[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x344278['attributes']=_0x344278[_0x0d8b('0x37')][_0x0d8b('0x46')]?_0x344278[_0x0d8b('0x37')]:_0x513b93[_0x0d8b('0x31')];if(_0x1b216d[_0x0d8b('0x33')][_0x0d8b('0x47')]){_0x344278[_0x0d8b('0x48')]=[{'all':!![]}];}_0x344278=_[_0x0d8b('0x40')]({},_0x344278,_0x1b216d[_0x0d8b('0x42')]);return db[_0x0d8b('0x2d')][_0x0d8b('0x49')](_0x344278)[_0x0d8b('0x24')](handleEntityNotFound(_0x192de1,null))[_0x0d8b('0x24')](respondWithResult(_0x192de1,null))[_0x0d8b('0x4a')](handleError(_0x192de1,null));};exports[_0x0d8b('0x4b')]=function(_0xdfcf32,_0x245325){return db[_0x0d8b('0x2d')][_0x0d8b('0x4b')](_0xdfcf32['body'],{})[_0x0d8b('0x24')](respondWithResult(_0x245325,0xc9))['catch'](handleError(_0x245325,null));};exports['update']=function(_0x39a31d,_0x113fb7){if(_0x39a31d[_0x0d8b('0x29')]['id']){delete _0x39a31d[_0x0d8b('0x29')]['id'];}return db['Automation'][_0x0d8b('0x49')]({'where':{'id':_0x39a31d[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x113fb7,null))[_0x0d8b('0x24')](saveUpdates(_0x39a31d[_0x0d8b('0x29')],null))['then'](respondWithResult(_0x113fb7,null))['catch'](handleError(_0x113fb7,null));};exports['destroy']=function(_0x573f4f,_0x368ede){return db[_0x0d8b('0x2d')]['find']({'where':{'id':_0x573f4f['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x368ede,null))[_0x0d8b('0x24')](removeEntity(_0x368ede,null))['catch'](handleError(_0x368ede,null));};exports['addConditions']=function(_0x900906,_0xeeefd4,_0x3cd00a){return db[_0x0d8b('0x4c')][_0x0d8b('0x49')]({'where':{'id':_0x900906['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0xeeefd4,null))[_0x0d8b('0x24')](function(_0x5481fc){if(_0x5481fc){return _0x5481fc['addConditions'](_0x900906[_0x0d8b('0x29')][_0x0d8b('0x4d')],_['omit'](_0x900906['body'],[_0x0d8b('0x4d'),'id'])||{});}})[_0x0d8b('0x24')](respondWithResult(_0xeeefd4,null))[_0x0d8b('0x4a')](handleError(_0xeeefd4,null));};exports[_0x0d8b('0x4e')]=function(_0x4a2989,_0x356b3d,_0x598e03){var _0x5c271c={};var _0x38c24e={};var _0x44043b;var _0x54aa03;return db['Automation'][_0x0d8b('0x4f')]({'where':{'id':_0x4a2989[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x356b3d,null))[_0x0d8b('0x24')](function(_0x3afc3a){if(_0x3afc3a){_0x44043b=_0x3afc3a;_0x38c24e[_0x0d8b('0x31')]=_[_0x0d8b('0x34')](db[_0x0d8b('0x4c')]['rawAttributes']);_0x38c24e[_0x0d8b('0x33')]=_[_0x0d8b('0x34')](_0x4a2989[_0x0d8b('0x33')]);_0x38c24e[_0x0d8b('0x35')]=_[_0x0d8b('0x36')](_0x38c24e[_0x0d8b('0x31')],_0x38c24e[_0x0d8b('0x33')]);_0x5c271c[_0x0d8b('0x37')]=_[_0x0d8b('0x36')](_0x38c24e['model'],qs[_0x0d8b('0x38')](_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x5c271c[_0x0d8b('0x37')]=_0x5c271c[_0x0d8b('0x37')]['length']?_0x5c271c[_0x0d8b('0x37')]:_0x38c24e[_0x0d8b('0x31')];_0x5c271c[_0x0d8b('0x3c')]=qs[_0x0d8b('0x3d')](_0x4a2989[_0x0d8b('0x33')]['sort']);_0x5c271c['where']=qs[_0x0d8b('0x35')](_[_0x0d8b('0x50')](_0x4a2989[_0x0d8b('0x33')],_0x38c24e[_0x0d8b('0x35')]));if(_0x4a2989['query'][_0x0d8b('0x3f')]){_0x5c271c[_0x0d8b('0x3e')]=_[_0x0d8b('0x40')](_0x5c271c['where'],{'$or':_[_0x0d8b('0x32')](_0x5c271c['attributes'],function(_0x2fce07){var _0x3ed63e={};_0x3ed63e[_0x2fce07]={'$like':'%'+_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x3f')]+'%'};return _0x3ed63e;})});}_0x5c271c=_[_0x0d8b('0x40')]({},_0x5c271c,_0x4a2989[_0x0d8b('0x42')]);return _0x44043b['getConditions'](_0x5c271c);}})[_0x0d8b('0x24')](function(_0x4c074d){if(_0x4c074d){_0x54aa03=_0x4c074d[_0x0d8b('0x46')];if(!_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x39')](_0x0d8b('0x3a'))){_0x5c271c['limit']=qs[_0x0d8b('0x3b')](_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x3b')]);_0x5c271c[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x4a2989[_0x0d8b('0x33')][_0x0d8b('0x1c')]);}return _0x44043b[_0x0d8b('0x4e')](_0x5c271c);}})[_0x0d8b('0x24')](function(_0x34affb){if(_0x34affb){return _0x34affb?{'count':_0x54aa03,'rows':_0x34affb}:null;}})['then'](respondWithResult(_0x356b3d,null))['catch'](handleError(_0x356b3d,null));};exports[_0x0d8b('0x51')]=function(_0x3eb647,_0x53e399,_0xb1aa96){return db['Action']['find']({'where':{'id':_0x3eb647[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x53e399,null))['then'](function(_0x587128){if(_0x587128){return _0x587128[_0x0d8b('0x51')](_0x3eb647[_0x0d8b('0x29')][_0x0d8b('0x4d')],_[_0x0d8b('0x52')](_0x3eb647[_0x0d8b('0x29')],[_0x0d8b('0x4d'),'id'])||{});}})[_0x0d8b('0x24')](respondWithResult(_0x53e399,null))['catch'](handleError(_0x53e399,null));};exports[_0x0d8b('0x53')]=function(_0x5878c2,_0x1a203e,_0x2c6242){var _0x2bb690={};var _0x14a34b={};var _0x49f610;var _0x3fe47d;return db['Automation'][_0x0d8b('0x4f')]({'where':{'id':_0x5878c2[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x1a203e,null))[_0x0d8b('0x24')](function(_0xc5c35f){if(_0xc5c35f){_0x49f610=_0xc5c35f;_0x14a34b[_0x0d8b('0x31')]=_[_0x0d8b('0x34')](db[_0x0d8b('0x54')][_0x0d8b('0x45')]);_0x14a34b[_0x0d8b('0x33')]=_['keys'](_0x5878c2[_0x0d8b('0x33')]);_0x14a34b['filters']=_[_0x0d8b('0x36')](_0x14a34b[_0x0d8b('0x31')],_0x14a34b['query']);_0x2bb690[_0x0d8b('0x37')]=_['intersection'](_0x14a34b[_0x0d8b('0x31')],qs[_0x0d8b('0x38')](_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x38')]));_0x2bb690[_0x0d8b('0x37')]=_0x2bb690[_0x0d8b('0x37')][_0x0d8b('0x46')]?_0x2bb690[_0x0d8b('0x37')]:_0x14a34b['model'];_0x2bb690[_0x0d8b('0x3c')]=qs[_0x0d8b('0x3d')](_0x5878c2['query'][_0x0d8b('0x3d')]);_0x2bb690[_0x0d8b('0x3e')]=qs[_0x0d8b('0x35')](_[_0x0d8b('0x50')](_0x5878c2[_0x0d8b('0x33')],_0x14a34b[_0x0d8b('0x35')]));if(_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x3f')]){_0x2bb690[_0x0d8b('0x3e')]=_[_0x0d8b('0x40')](_0x2bb690[_0x0d8b('0x3e')],{'$or':_[_0x0d8b('0x32')](_0x2bb690['attributes'],function(_0x1ece98){var _0x93fc55={};_0x93fc55[_0x1ece98]={'$like':'%'+_0x5878c2[_0x0d8b('0x33')]['filter']+'%'};return _0x93fc55;})});}_0x2bb690=_['merge']({},_0x2bb690,_0x5878c2[_0x0d8b('0x42')]);return _0x49f610[_0x0d8b('0x53')](_0x2bb690);}})[_0x0d8b('0x24')](function(_0x5b76af){if(_0x5b76af){_0x3fe47d=_0x5b76af['length'];if(!_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x39')](_0x0d8b('0x3a'))){_0x2bb690[_0x0d8b('0x3b')]=qs[_0x0d8b('0x3b')](_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x3b')]);_0x2bb690[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x5878c2[_0x0d8b('0x33')][_0x0d8b('0x1c')]);}return _0x49f610[_0x0d8b('0x53')](_0x2bb690);}})[_0x0d8b('0x24')](function(_0x5dbc6b){if(_0x5dbc6b){return _0x5dbc6b?{'count':_0x3fe47d,'rows':_0x5dbc6b}:null;}})[_0x0d8b('0x24')](respondWithResult(_0x1a203e,null))[_0x0d8b('0x4a')](handleError(_0x1a203e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 37fd850..95f9b46 100644 --- a/server/api/automation/automation.model.js +++ b/server/api/automation/automation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17a4=['moment','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','api'];(function(_0x44c83b,_0x103aca){var _0x169eb4=function(_0x1c1a0d){while(--_0x1c1a0d){_0x44c83b['push'](_0x44c83b['shift']());}};_0x169eb4(++_0x103aca);}(_0x17a4,0x68));var _0x417a=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x17a4[_0x8e8ca7];return _0x561381;};'use strict';var _=require(_0x417a('0x0'));var util=require(_0x417a('0x1'));var logger=require(_0x417a('0x2'))(_0x417a('0x3'));var moment=require(_0x417a('0x4'));var BPromise=require('bluebird');var rp=require(_0x417a('0x5'));var fs=require('fs');var path=require(_0x417a('0x6'));var rimraf=require(_0x417a('0x7'));var config=require('../../config/environment');var attributes=require(_0x417a('0x8'));module[_0x417a('0x9')]=function(_0x17c98f,_0x46a712){return _0x17c98f[_0x417a('0xa')](_0x417a('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74c7=['moment','bluebird','path','rimraf','../../config/environment','define','tools_automations','lodash','api'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x74c7,0x7c));var _0x774c=function(_0xac64aa,_0x335c4){_0xac64aa=_0xac64aa-0x0;var _0x4d628d=_0x74c7[_0xac64aa];return _0x4d628d;};'use strict';var _=require(_0x774c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x774c('0x1'));var moment=require(_0x774c('0x2'));var BPromise=require(_0x774c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x774c('0x4'));var rimraf=require(_0x774c('0x5'));var config=require(_0x774c('0x6'));var attributes=require('./automation.attributes');module['exports']=function(_0x5aaeb7,_0x169a00){return _0x5aaeb7[_0x774c('0x7')]('Automation',attributes,{'tableName':_0x774c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 8340346..59378a0 100644 --- a/server/api/automation/automation.rpc.js +++ b/server/api/automation/automation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2260=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x50be30,_0x55a0ca){var _0x5a6441=function(_0x516a5d){while(--_0x516a5d){_0x50be30['push'](_0x50be30['shift']());}};_0x5a6441(++_0x55a0ca);}(_0x2260,0x156));var _0x0226=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2260[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0x0226('0x0'));var moment=require(_0x0226('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0226('0x2'));var db=require(_0x0226('0x3'))['db'];var utils=require(_0x0226('0x4'));var logger=require(_0x0226('0x5'))(_0x0226('0x6'));var config=require(_0x0226('0x7'));var jayson=require(_0x0226('0x8'));var client=jayson[_0x0226('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x591e2,_0x4e94df,_0x24a257){return new BPromise(function(_0xd1fa21,_0x35fd33){return client[_0x0226('0xa')](_0x591e2,_0x24a257)[_0x0226('0xb')](function(_0x443686){logger[_0x0226('0xc')](_0x0226('0xd'),_0x4e94df,_0x0226('0xe'));logger['debug'](_0x0226('0xf'),_0x4e94df,_0x0226('0xe'),JSON[_0x0226('0x10')](_0x443686));if(_0x443686['error']){if(_0x443686['error']['code']===0x1f4){logger[_0x0226('0x11')](_0x0226('0xd'),_0x4e94df,_0x443686[_0x0226('0x11')][_0x0226('0x12')]);return _0x35fd33(_0x443686[_0x0226('0x11')]['message']);}logger['error'](_0x0226('0xd'),_0x4e94df,_0x443686[_0x0226('0x11')][_0x0226('0x12')]);return _0xd1fa21(_0x443686[_0x0226('0x11')]['message']);}else{logger[_0x0226('0xc')]('Automation,\x20%s,\x20%s',_0x4e94df,_0x0226('0xe'));_0xd1fa21(_0x443686[_0x0226('0x13')][_0x0226('0x12')]);}})[_0x0226('0x14')](function(_0x2ce8d0){logger[_0x0226('0x11')](_0x0226('0xd'),_0x4e94df,_0x2ce8d0);_0x35fd33(_0x2ce8d0);});});} \ No newline at end of file +var _0x0be3=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x440c3f,_0x5e001b){var _0xdc80dc=function(_0x545346){while(--_0x545346){_0x440c3f['push'](_0x440c3f['shift']());}};_0xdc80dc(++_0x5e001b);}(_0x0be3,0x9a));var _0x30be=function(_0x29a132,_0x49c0cc){_0x29a132=_0x29a132-0x0;var _0x1443cf=_0x0be3[_0x29a132];return _0x1443cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30be('0x0'));var BPromise=require(_0x30be('0x1'));var rs=require(_0x30be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30be('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x30be('0x4'))(_0x30be('0x5'));var config=require(_0x30be('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdc3ff5,_0x4b45a7,_0x124baf){return new BPromise(function(_0x4207d3,_0x403e5c){return client['request'](_0xdc3ff5,_0x124baf)[_0x30be('0x8')](function(_0x3cc6e7){logger[_0x30be('0x9')](_0x30be('0xa'),_0x4b45a7,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x4b45a7,_0x30be('0xb'),JSON['stringify'](_0x3cc6e7));if(_0x3cc6e7[_0x30be('0xc')]){if(_0x3cc6e7[_0x30be('0xc')][_0x30be('0xd')]===0x1f4){logger[_0x30be('0xc')](_0x30be('0xa'),_0x4b45a7,_0x3cc6e7[_0x30be('0xc')][_0x30be('0xe')]);return _0x403e5c(_0x3cc6e7[_0x30be('0xc')][_0x30be('0xe')]);}logger['error'](_0x30be('0xa'),_0x4b45a7,_0x3cc6e7['error'][_0x30be('0xe')]);return _0x4207d3(_0x3cc6e7[_0x30be('0xc')]['message']);}else{logger[_0x30be('0x9')](_0x30be('0xa'),_0x4b45a7,'request\x20sent');_0x4207d3(_0x3cc6e7[_0x30be('0xf')][_0x30be('0xe')]);}})[_0x30be('0x10')](function(_0x40a4c7){logger[_0x30be('0xc')](_0x30be('0xa'),_0x4b45a7,_0x40a4c7);_0x403e5c(_0x40a4c7);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 550aa42..7472f8d 100644 --- a/server/api/automation/index.js +++ b/server/api/automation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a54=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','index','/:id','show','/:id/conditions','getConditions','/:id/actions','isAuthenticated','getActions','post','addConditions','addActions','delete','destroy'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x6a54,0xf1));var _0x46a5=function(_0x29f8a6,_0x307342){_0x29f8a6=_0x29f8a6-0x0;var _0x38d8fe=_0x6a54[_0x29f8a6];return _0x38d8fe;};'use strict';var multer=require(_0x46a5('0x0'));var util=require(_0x46a5('0x1'));var path=require(_0x46a5('0x2'));var timeout=require(_0x46a5('0x3'));var express=require(_0x46a5('0x4'));var router=express[_0x46a5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x46a5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x46a5('0x7'));var controller=require(_0x46a5('0x8'));router[_0x46a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x46a5('0xa')]);router[_0x46a5('0x9')](_0x46a5('0xb'),auth['isAuthenticated'](),controller[_0x46a5('0xc')]);router['get'](_0x46a5('0xd'),auth['isAuthenticated'](),controller[_0x46a5('0xe')]);router[_0x46a5('0x9')](_0x46a5('0xf'),auth[_0x46a5('0x10')](),controller[_0x46a5('0x11')]);router[_0x46a5('0x12')]('/',auth[_0x46a5('0x10')](),controller['create']);router[_0x46a5('0x12')]('/:id/conditions',auth[_0x46a5('0x10')](),controller[_0x46a5('0x13')]);router[_0x46a5('0x12')](_0x46a5('0xf'),auth[_0x46a5('0x10')](),controller[_0x46a5('0x14')]);router['put'](_0x46a5('0xb'),auth[_0x46a5('0x10')](),controller['update']);router[_0x46a5('0x15')](_0x46a5('0xb'),auth[_0x46a5('0x10')](),controller[_0x46a5('0x16')]);module[_0x46a5('0x17')]=router; \ No newline at end of file +var _0xf2da=['/:id/actions','getActions','create','addConditions','addActions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/conditions'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0xf2da,0xfc));var _0xaf2d=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0xf2da[_0x2ff739];return _0x12dc13;};'use strict';var multer=require(_0xaf2d('0x0'));var util=require('util');var path=require(_0xaf2d('0x1'));var timeout=require(_0xaf2d('0x2'));var express=require(_0xaf2d('0x3'));var router=express['Router']();var fs_extra=require(_0xaf2d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaf2d('0x5'));var config=require(_0xaf2d('0x6'));var controller=require('./automation.controller');router[_0xaf2d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaf2d('0x8'),auth[_0xaf2d('0x9')](),controller[_0xaf2d('0xa')]);router['get'](_0xaf2d('0xb'),auth[_0xaf2d('0x9')](),controller['getConditions']);router['get'](_0xaf2d('0xc'),auth['isAuthenticated'](),controller[_0xaf2d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaf2d('0xe')]);router['post'](_0xaf2d('0xb'),auth[_0xaf2d('0x9')](),controller[_0xaf2d('0xf')]);router['post']('/:id/actions',auth[_0xaf2d('0x9')](),controller[_0xaf2d('0x10')]);router[_0xaf2d('0x11')]('/:id',auth[_0xaf2d('0x9')](),controller[_0xaf2d('0x12')]);router[_0xaf2d('0x13')](_0xaf2d('0x8'),auth[_0xaf2d('0x9')](),controller[_0xaf2d('0x14')]);module[_0xaf2d('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c64dd71..23c9828 100644 --- a/server/api/campaign/campaign.attributes.js +++ b/server/api/campaign/campaign.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5c6=['UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','ENUM','ivr'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd5c6,0xa7));var _0x6d5c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd5c6[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d5c('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6d5c('0x1')]('ivr'),'allowNull':![],'defaultValue':_0x6d5c('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x6d5c('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6d5c('0x4')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6d5c('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6d5c('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x6')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x7')},'dialBusyMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x8')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0xa')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6d5c('0xb')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6d5c('0x0')],'defaultValue':_0x6d5c('0xc')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6d5c('0xd')],'defaultValue':0x0,'comment':_0x6d5c('0xe')},'dialAMDInitialSilence':{'type':Sequelize[_0x6d5c('0x5')](0x9)[_0x6d5c('0x3')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6d5c('0xf')},'dialAMDGreeting':{'type':Sequelize[_0x6d5c('0x5')](0x9)[_0x6d5c('0x3')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6d5c('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6d5c('0x5')](0x9)[_0x6d5c('0x3')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x6d5c('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6d5c('0x11')},'dialAMDMinWordLength':{'type':Sequelize[_0x6d5c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6d5c('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6d5c('0x12')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6d5c('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6d5c('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6d5c('0x3')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6d5c('0x15')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6d5c('0x16'),_0x6d5c('0x17')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x6d5c('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6d5c('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)[_0x6d5c('0x3')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6d5c('0x5')](0x3)[_0x6d5c('0x3')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6d5c('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6d5c('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6d5c('0x21')}}; \ No newline at end of file +var _0x3522=['sequelize','exports','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x21bcc8,_0x533e75){var _0xeabb88=function(_0x641df){while(--_0x641df){_0x21bcc8['push'](_0x21bcc8['shift']());}};_0xeabb88(++_0x533e75);}(_0x3522,0x66));var _0x2352=function(_0x3ac346,_0x3cc2ce){_0x3ac346=_0x3ac346-0x0;var _0x5cd185=_0x3522[_0x3ac346];return _0x5cd185;};'use strict';var Sequelize=require(_0x2352('0x0'));module[_0x2352('0x1')]={'name':{'type':Sequelize[_0x2352('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2352('0x3')](_0x2352('0x4')),'allowNull':![],'defaultValue':_0x2352('0x4')},'description':{'type':Sequelize[_0x2352('0x2')]},'active':{'type':Sequelize[_0x2352('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x2352('0x6')](0x4)[_0x2352('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x2352('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x2352('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)[_0x2352('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2352('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2352('0x6')](0x5)[_0x2352('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2352('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)[_0x2352('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2352('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2352('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2352('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2352('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2352('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x2352('0xc'),_0x2352('0xd'),_0x2352('0xe')),'defaultValue':_0x2352('0xc')},'dialAMDActive':{'type':Sequelize[_0x2352('0x5')],'defaultValue':0x0,'comment':_0x2352('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0x2352('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2352('0x10')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x2352('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2352('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2352('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2352('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2352('0x6')](0x9)[_0x2352('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2352('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2352('0x6')](0x9)[_0x2352('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2352('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2352('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2352('0x6')](0x5)[_0x2352('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2352('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2352('0x6')](0x9)[_0x2352('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x2352('0x3')](_0x2352('0x15'),_0x2352('0x16')),'defaultValue':_0x2352('0x15')},'dialPrefix':{'type':Sequelize[_0x2352('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x2352('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2352('0x17')},'dialCutDigit':{'type':Sequelize[_0x2352('0x6')](0x3)[_0x2352('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2352('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2352('0x6')](0x5)[_0x2352('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2352('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2352('0x1a')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2352('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2352('0x1b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)[_0x2352('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2352('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2352('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2352('0x1d')},'dialMachineMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2352('0x1e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2352('0x6')](0x5)[_0x2352('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2352('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2352('0x6')](0x3)[_0x2352('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2352('0x20')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2352('0x6')](0x5)[_0x2352('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2352('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e23e26a..2141011 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7544=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','get','IvrCampaigns','sendStatus','error','stack','name','render','merge','body','interaction','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','find','createdAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','toString','ListId','updatedAt','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','CmListId','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x6329b5,_0x372386){var _0x20e459=function(_0x1b3c8a){while(--_0x1b3c8a){_0x6329b5['push'](_0x6329b5['shift']());}};_0x20e459(++_0x372386);}(_0x7544,0x104));var _0x4754=function(_0x38cfa4,_0x1307b0){_0x38cfa4=_0x38cfa4-0x0;var _0x5be9e4=_0x7544[_0x38cfa4];return _0x5be9e4;};'use strict';var emlformat=require(_0x4754('0x0'));var rimraf=require(_0x4754('0x1'));var zipdir=require(_0x4754('0x2'));var jsonpatch=require(_0x4754('0x3'));var rp=require(_0x4754('0x4'));var moment=require(_0x4754('0x5'));var BPromise=require(_0x4754('0x6'));var Mustache=require(_0x4754('0x7'));var util=require(_0x4754('0x8'));var path=require(_0x4754('0x9'));var sox=require(_0x4754('0xa'));var csv=require(_0x4754('0xb'));var ejs=require(_0x4754('0xc'));var fs=require('fs');var fs_extra=require(_0x4754('0xd'));var _=require('lodash');var squel=require(_0x4754('0xe'));var crypto=require(_0x4754('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4754('0x10'));var toCsv=require(_0x4754('0xb'));var querystring=require(_0x4754('0x11'));var Papa=require('papaparse');var Redis=require(_0x4754('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4754('0x13'));var as=require(_0x4754('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4754('0x15'));var utils=require(_0x4754('0x16'));var config=require(_0x4754('0x17'));var licenseUtil=require(_0x4754('0x18'));var db=require(_0x4754('0x19'))['db'];function respondWithStatusCode(_0x5464d1,_0x49959b){_0x49959b=_0x49959b||0xcc;return function(_0x38c761){if(_0x38c761){return _0x5464d1['sendStatus'](_0x49959b);}return _0x5464d1[_0x4754('0x1a')](_0x49959b)[_0x4754('0x1b')]();};}function respondWithResult(_0x3a8bf7,_0x4cfcf3){_0x4cfcf3=_0x4cfcf3||0xc8;return function(_0x2a1026){if(_0x2a1026){return _0x3a8bf7[_0x4754('0x1a')](_0x4cfcf3)[_0x4754('0x1c')](_0x2a1026);}};}function respondWithFilteredResult(_0x55e46c,_0x289489){return function(_0x2a1fa3){if(_0x2a1fa3){var _0x4f2f85=typeof _0x289489[_0x4754('0x1d')]==='undefined'&&typeof _0x289489['limit']===_0x4754('0x1e');var _0x18fc4f=_0x2a1fa3[_0x4754('0x1f')];var _0x4cb9ef=_0x4f2f85?0x0:_0x289489[_0x4754('0x1d')];var _0x1a4782=_0x4f2f85?_0x2a1fa3['count']:_0x289489[_0x4754('0x1d')]+_0x289489[_0x4754('0x20')];var _0x2cef48;if(_0x1a4782>=_0x18fc4f){_0x1a4782=_0x18fc4f;_0x2cef48=0xc8;}else{_0x2cef48=0xce;}_0x55e46c['status'](_0x2cef48);return _0x55e46c[_0x4754('0x21')]('Content-Range',_0x4cb9ef+'-'+_0x1a4782+'/'+_0x18fc4f)[_0x4754('0x1c')](_0x2a1fa3);}return null;};}function patchUpdates(_0x1a07b9){return function(_0x322cab){try{jsonpatch[_0x4754('0x22')](_0x322cab,_0x1a07b9,!![]);}catch(_0x54fa93){return BPromise['reject'](_0x54fa93);}return _0x322cab[_0x4754('0x23')]();};}function saveUpdates(_0xa6c232,_0x3ac5cf){return function(_0x2ebe9a){if(_0x2ebe9a){return _0x2ebe9a[_0x4754('0x24')](_0xa6c232)[_0x4754('0x25')](function(_0x4a29e5){return _0x4a29e5;});}return null;};}function removeEntity(_0x2d1ea7,_0x45facd){return function(_0x1712c8){if(_0x1712c8){return _0x1712c8[_0x4754('0x26')]()['then'](function(){var _0x33130f=_0x1712c8[_0x4754('0x27')]({'plain':!![]});var _0x181509=_0x4754('0x28');return db['UserProfileResource'][_0x4754('0x26')]({'where':{'type':_0x181509,'resourceId':_0x33130f['id']}})[_0x4754('0x25')](function(){return _0x1712c8;});})[_0x4754('0x25')](function(){_0x2d1ea7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0855c,_0x2e8b84){return function(_0x5c3f9f){if(!_0x5c3f9f){_0xd0855c[_0x4754('0x29')](0x194);}return _0x5c3f9f;};}function handleError(_0x5743c5,_0x2d7098){_0x2d7098=_0x2d7098||0x1f4;return function(_0x509931){logger[_0x4754('0x2a')](_0x509931[_0x4754('0x2b')]);if(_0x509931[_0x4754('0x2c')]){delete _0x509931['name'];}_0x5743c5[_0x4754('0x1a')](_0x2d7098)['send'](_0x509931);};}function getMustacheRender(_0x3eaa3e,_0x46a84f){return Mustache[_0x4754('0x2d')](_0x3eaa3e,_[_0x4754('0x2e')](_0x46a84f[_0x4754('0x2f')],{'contact':_0x46a84f['contact'],'message':_0x46a84f['message'],'agent':_0x46a84f['agent'],'interaction':_0x46a84f[_0x4754('0x30')],'account':_0x46a84f['account']}))||'';}exports['index']=function(_0x4ffce8,_0x260ccf){var _0x112822={},_0x500767={},_0x57b5ca={'count':0x0,'rows':[]};var _0x3c17fc=_['map'](db[_0x4754('0x31')][_0x4754('0x32')],function(_0x4d6bee){return{'name':_0x4d6bee[_0x4754('0x33')],'type':_0x4d6bee[_0x4754('0x34')][_0x4754('0x35')]};});_0x500767[_0x4754('0x36')]=_[_0x4754('0x37')](_0x3c17fc,'name');_0x500767[_0x4754('0x38')]=_[_0x4754('0x39')](_0x4ffce8[_0x4754('0x38')]);_0x500767['filters']=_[_0x4754('0x3a')](_0x500767[_0x4754('0x36')],_0x500767['query']);_0x112822['attributes']=_[_0x4754('0x3a')](_0x500767['model'],qs[_0x4754('0x3b')](_0x4ffce8[_0x4754('0x38')]['fields']));_0x112822[_0x4754('0x3c')]=_0x112822[_0x4754('0x3c')]['length']?_0x112822[_0x4754('0x3c')]:_0x500767[_0x4754('0x36')];if(!_0x4ffce8[_0x4754('0x38')][_0x4754('0x3d')](_0x4754('0x3e'))){_0x112822[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x4ffce8[_0x4754('0x38')]['limit']);_0x112822[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x4ffce8[_0x4754('0x38')][_0x4754('0x1d')]);}_0x112822[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x4ffce8[_0x4754('0x38')][_0x4754('0x40')]);_0x112822[_0x4754('0x41')]=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x4ffce8[_0x4754('0x38')],_0x500767[_0x4754('0x42')]),_0x3c17fc);if(_0x4ffce8[_0x4754('0x38')]['filter']){_0x112822['where']=_[_0x4754('0x2e')](_0x112822['where'],{'$or':_['map'](_0x3c17fc,function(_0x3b65fe){if(_0x3b65fe['type']!==_0x4754('0x44')){var _0x115993={};_0x115993[_0x3b65fe['name']]={'$like':'%'+_0x4ffce8['query'][_0x4754('0x45')]+'%'};return _0x115993;}})});}_0x112822=_[_0x4754('0x2e')]({},_0x112822,_0x4ffce8[_0x4754('0x46')]);var _0x4f6fed={'where':_0x112822[_0x4754('0x41')]};return db[_0x4754('0x31')]['count'](_0x4f6fed)[_0x4754('0x25')](function(_0x11ed54){_0x57b5ca[_0x4754('0x1f')]=_0x11ed54;if(_0x4ffce8[_0x4754('0x38')][_0x4754('0x47')]){_0x112822[_0x4754('0x48')]=[{'all':!![]}];}return db['Campaign'][_0x4754('0x49')](_0x112822);})['then'](function(_0x1d5ac9){_0x57b5ca[_0x4754('0x4a')]=_0x1d5ac9;return _0x57b5ca;})[_0x4754('0x25')](respondWithFilteredResult(_0x260ccf,_0x112822))[_0x4754('0x4b')](handleError(_0x260ccf,null));};exports[_0x4754('0x4c')]=function(_0x4914f2,_0x33a321){var _0x1dfabd={'raw':![],'where':{'id':_0x4914f2[_0x4754('0x4d')]['id']}},_0x1e9a43={};_0x1e9a43[_0x4754('0x36')]=_[_0x4754('0x39')](db['Campaign']['rawAttributes']);_0x1e9a43[_0x4754('0x38')]=_['keys'](_0x4914f2[_0x4754('0x38')]);_0x1e9a43[_0x4754('0x42')]=_[_0x4754('0x3a')](_0x1e9a43[_0x4754('0x36')],_0x1e9a43['query']);_0x1dfabd['attributes']=_[_0x4754('0x3a')](_0x1e9a43[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x4914f2['query']['fields']));_0x1dfabd[_0x4754('0x3c')]=_0x1dfabd[_0x4754('0x3c')][_0x4754('0x4e')]?_0x1dfabd[_0x4754('0x3c')]:_0x1e9a43[_0x4754('0x36')];if(_0x4914f2['query'][_0x4754('0x47')]){_0x1dfabd['include']=[{'all':!![]}];}_0x1dfabd=_['merge']({},_0x1dfabd,_0x4914f2[_0x4754('0x46')]);return db['Campaign']['find'](_0x1dfabd)[_0x4754('0x25')](handleEntityNotFound(_0x33a321,null))[_0x4754('0x25')](respondWithResult(_0x33a321,null))['catch'](handleError(_0x33a321,null));};exports[_0x4754('0x4f')]=function(_0x5c224f,_0x1bf2d8){return db[_0x4754('0x31')][_0x4754('0x4f')](_0x5c224f[_0x4754('0x2f')],{})[_0x4754('0x25')](function(_0x40b476){var _0x845c43=_0x5c224f[_0x4754('0x50')][_0x4754('0x27')]({'plain':!![]});if(!_0x845c43)throw new Error(_0x4754('0x51'));if(_0x845c43[_0x4754('0x52')]==='user'){var _0x3d771c=_0x40b476['get']({'plain':!![]});var _0x550c2b=_0x4754('0x28');return db[_0x4754('0x53')]['find']({'where':{'name':_0x550c2b,'userProfileId':_0x845c43[_0x4754('0x54')]},'raw':!![]})[_0x4754('0x25')](function(_0x8ef37){if(_0x8ef37&&_0x8ef37[_0x4754('0x55')]===0x0){return db[_0x4754('0x56')][_0x4754('0x4f')]({'name':_0x3d771c['name'],'resourceId':_0x3d771c['id'],'type':_0x8ef37['name'],'sectionId':_0x8ef37['id']},{})['then'](function(){return _0x40b476;});}else{return _0x40b476;}})[_0x4754('0x4b')](function(_0x5ba911){logger[_0x4754('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ba911);throw _0x5ba911;});}return _0x40b476;})[_0x4754('0x25')](respondWithResult(_0x1bf2d8,0xc9))[_0x4754('0x4b')](handleError(_0x1bf2d8,null));};exports[_0x4754('0x57')]=function(_0x5eb488,_0x2e5c9a){var _0x2b16d2={'where':{'id':_0x5eb488['params']['id']}},_0x23d305={};_0x23d305['model']=_['keys'](db[_0x4754('0x31')]['rawAttributes']);_0x2b16d2[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x23d305['model'],qs[_0x4754('0x3b')](_0x5eb488[_0x4754('0x38')][_0x4754('0x3b')]));_0x2b16d2[_0x4754('0x3c')]=_0x2b16d2[_0x4754('0x3c')][_0x4754('0x4e')]?_0x2b16d2[_0x4754('0x3c')]:_0x23d305[_0x4754('0x36')];if(_0x5eb488[_0x4754('0x38')]['includeAll']){_0x2b16d2[_0x4754('0x48')]=[{'all':!![]}];}_0x2b16d2=_[_0x4754('0x2e')]({},_0x2b16d2,_0x5eb488['options']);return db[_0x4754('0x31')][_0x4754('0x58')](_0x2b16d2)[_0x4754('0x25')](handleEntityNotFound(_0x2e5c9a,null))[_0x4754('0x25')](function(_0xe6fab){if(_0xe6fab){var _0x301b8c=_0xe6fab[_0x4754('0x27')]({'plain':!![]});_0x301b8c=qs['omit'](_0x301b8c,['id',_0x4754('0x59'),'updatedAt']);_0x5eb488['body']=_[_0x4754('0x5a')](_0x5eb488[_0x4754('0x2f')],['id','createdAt','updatedAt']);return db[_0x4754('0x31')][_0x4754('0x4f')](_[_0x4754('0x2e')](_0x301b8c,_0x5eb488[_0x4754('0x2f')]),{'include':_0x5eb488[_0x4754('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x4754('0x25')](function(_0x59c602){var _0x3b9e3e=_0x5eb488['user'][_0x4754('0x27')]({'plain':!![]});if(!_0x3b9e3e)throw new Error(_0x4754('0x51'));if(_0x3b9e3e[_0x4754('0x52')]===_0x4754('0x50')){var _0x1d7c58=_0x59c602[_0x4754('0x27')]({'plain':!![]});var _0x54bdfb=_0x4754('0x28');return db['UserProfileSection'][_0x4754('0x58')]({'where':{'name':_0x54bdfb,'userProfileId':_0x3b9e3e[_0x4754('0x54')]},'raw':!![]})[_0x4754('0x25')](function(_0x2cbabc){if(_0x2cbabc&&_0x2cbabc[_0x4754('0x55')]===0x0){return db['UserProfileResource'][_0x4754('0x4f')]({'name':_0x1d7c58['name'],'resourceId':_0x1d7c58['id'],'type':_0x2cbabc[_0x4754('0x2c')],'sectionId':_0x2cbabc['id']},{})[_0x4754('0x25')](function(){return _0x59c602;});}else{return _0x59c602;}})[_0x4754('0x4b')](function(_0x2ff617){logger['error'](_0x4754('0x5b'),_0x2ff617);throw _0x2ff617;});}return _0x59c602;});}})[_0x4754('0x25')](respondWithResult(_0x2e5c9a,0xc9))[_0x4754('0x4b')](handleError(_0x2e5c9a,null));};exports[_0x4754('0x24')]=function(_0x3c2f9f,_0x14a004){if(_0x3c2f9f[_0x4754('0x2f')]['id']){delete _0x3c2f9f[_0x4754('0x2f')]['id'];}return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x3c2f9f[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x14a004,null))[_0x4754('0x25')](saveUpdates(_0x3c2f9f[_0x4754('0x2f')],null))[_0x4754('0x25')](respondWithResult(_0x14a004,null))['catch'](handleError(_0x14a004,null));};exports[_0x4754('0x26')]=function(_0x442b49,_0x54d13c){return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x442b49[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x54d13c,null))['then'](removeEntity(_0x54d13c,null))[_0x4754('0x4b')](handleError(_0x54d13c,null));};exports[_0x4754('0x5c')]=function(_0x310078,_0x522416,_0x5ea87b){var _0x2909aa={'raw':!![],'where':{}};var _0x48613c={};var _0x2e1ccf={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x310078[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x522416,null))[_0x4754('0x25')](function(_0x5038fa){if(_0x5038fa){_0x48613c[_0x4754('0x36')]=_['keys'](db['CmHopper'][_0x4754('0x32')]);_0x48613c['query']=_[_0x4754('0x39')](_0x310078['query']);_0x48613c['filters']=_[_0x4754('0x3a')](_0x48613c['model'],_0x48613c['query']);_0x2909aa[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x48613c[_0x4754('0x36')],qs['fields'](_0x310078[_0x4754('0x38')][_0x4754('0x3b')]));_0x2909aa[_0x4754('0x3c')]=_0x2909aa['attributes']['length']?_0x2909aa[_0x4754('0x3c')]:_0x48613c[_0x4754('0x36')];if(!_0x310078[_0x4754('0x38')]['hasOwnProperty'](_0x4754('0x3e'))){_0x2909aa[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x310078['query'][_0x4754('0x20')]);_0x2909aa[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x310078[_0x4754('0x38')][_0x4754('0x1d')]);}_0x2909aa[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x310078[_0x4754('0x38')][_0x4754('0x40')]);_0x2909aa[_0x4754('0x41')]=qs['filters'](_[_0x4754('0x43')](_0x310078['query'],_0x48613c[_0x4754('0x42')]));_0x2909aa[_0x4754('0x41')][_0x4754('0x5e')]=_0x5038fa['id'];if(_0x310078[_0x4754('0x38')]['filter']){_0x2909aa[_0x4754('0x41')]=_['merge'](_0x2909aa['where'],{'$or':_['map'](_0x2909aa[_0x4754('0x3c')],function(_0x52d913){var _0x38010f={};_0x38010f[_0x52d913]={'$like':'%'+_0x310078[_0x4754('0x38')][_0x4754('0x45')]+'%'};return _0x38010f;})});}_0x2909aa=_['merge']({},_0x2909aa,_0x310078[_0x4754('0x46')]);return db['CmHopper'][_0x4754('0x1f')]({'where':_0x2909aa[_0x4754('0x41')]})[_0x4754('0x25')](function(_0x466e73){_0x2e1ccf['count']=_0x466e73;if(_0x310078[_0x4754('0x38')][_0x4754('0x47')]){_0x2909aa['include']=[{'all':!![]}];}return db[_0x4754('0x5f')][_0x4754('0x49')](_0x2909aa);})[_0x4754('0x25')](function(_0x5ce62c){_0x2e1ccf[_0x4754('0x4a')]=_0x5ce62c;return _0x2e1ccf;});}})[_0x4754('0x25')](respondWithFilteredResult(_0x522416,_0x2909aa))[_0x4754('0x4b')](handleError(_0x522416,null));};exports[_0x4754('0x60')]=function(_0x204129,_0x15bd59,_0xb6c1f5){var _0x37af62={'raw':!![],'where':{}};var _0x4442df={};var _0x4198bd={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x204129[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x15bd59,null))[_0x4754('0x25')](function(_0x126b77){if(_0x126b77){_0x4442df[_0x4754('0x36')]=_['keys'](db['CmHopperHistory'][_0x4754('0x32')]);_0x4442df['query']=_['keys'](_0x204129[_0x4754('0x38')]);_0x4442df[_0x4754('0x42')]=_['intersection'](_0x4442df[_0x4754('0x36')],_0x4442df[_0x4754('0x38')]);_0x37af62[_0x4754('0x3c')]=_['intersection'](_0x4442df[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x204129[_0x4754('0x38')][_0x4754('0x3b')]));_0x37af62['attributes']=_0x37af62[_0x4754('0x3c')][_0x4754('0x4e')]?_0x37af62[_0x4754('0x3c')]:_0x4442df['model'];if(!_0x204129['query'][_0x4754('0x3d')](_0x4754('0x3e'))){_0x37af62[_0x4754('0x20')]=qs['limit'](_0x204129[_0x4754('0x38')][_0x4754('0x20')]);_0x37af62[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x204129[_0x4754('0x38')][_0x4754('0x1d')]);}_0x37af62[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x204129[_0x4754('0x38')]['sort']);_0x37af62[_0x4754('0x41')]=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x204129[_0x4754('0x38')],_0x4442df['filters']));_0x37af62[_0x4754('0x41')][_0x4754('0x5e')]=_0x126b77['id'];if(_0x204129[_0x4754('0x38')][_0x4754('0x45')]){_0x37af62[_0x4754('0x41')]=_[_0x4754('0x2e')](_0x37af62[_0x4754('0x41')],{'$or':_[_0x4754('0x37')](_0x37af62[_0x4754('0x3c')],function(_0x48725b){var _0x5e307a={};_0x5e307a[_0x48725b]={'$like':'%'+_0x204129[_0x4754('0x38')]['filter']+'%'};return _0x5e307a;})});}_0x37af62=_['merge']({},_0x37af62,_0x204129[_0x4754('0x46')]);return db[_0x4754('0x61')]['count']({'where':_0x37af62[_0x4754('0x41')]})[_0x4754('0x25')](function(_0x51cd1b){_0x4198bd[_0x4754('0x1f')]=_0x51cd1b;if(_0x204129['query'][_0x4754('0x47')]){_0x37af62[_0x4754('0x48')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x37af62);})[_0x4754('0x25')](function(_0x3e2a37){_0x4198bd[_0x4754('0x4a')]=_0x3e2a37;return _0x4198bd;});}})['then'](respondWithFilteredResult(_0x15bd59,_0x37af62))['catch'](handleError(_0x15bd59,null));};exports[_0x4754('0x62')]=function(_0x4fda2f,_0x57cdf3,_0x4b8e70){var _0x3cbb01={'raw':!![],'where':{}};var _0x390790={};var _0xda891e={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x4fda2f['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x57cdf3,null))[_0x4754('0x25')](function(_0x58844f){if(_0x58844f){_0x390790[_0x4754('0x36')]=_[_0x4754('0x39')](db[_0x4754('0x63')]['rawAttributes']);_0x390790[_0x4754('0x38')]=_[_0x4754('0x39')](_0x4fda2f['query']);_0x390790[_0x4754('0x42')]=_[_0x4754('0x3a')](_0x390790[_0x4754('0x36')],_0x390790['query']);_0x3cbb01[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x390790[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x4fda2f[_0x4754('0x38')][_0x4754('0x3b')]));_0x3cbb01[_0x4754('0x3c')]=_0x3cbb01['attributes'][_0x4754('0x4e')]?_0x3cbb01[_0x4754('0x3c')]:_0x390790[_0x4754('0x36')];if(!_0x4fda2f[_0x4754('0x38')][_0x4754('0x3d')]('nolimit')){_0x3cbb01['limit']=qs[_0x4754('0x20')](_0x4fda2f[_0x4754('0x38')]['limit']);_0x3cbb01[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x4fda2f[_0x4754('0x38')]['offset']);}_0x3cbb01[_0x4754('0x3f')]=qs['sort'](_0x4fda2f[_0x4754('0x38')]['sort']);_0x3cbb01[_0x4754('0x41')]=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x4fda2f[_0x4754('0x38')],_0x390790[_0x4754('0x42')]));_0x3cbb01[_0x4754('0x41')]['CampaignId']=_0x58844f['id'];if(_0x4fda2f['query'][_0x4754('0x45')]){_0x3cbb01['where']=_[_0x4754('0x2e')](_0x3cbb01[_0x4754('0x41')],{'$or':_[_0x4754('0x37')](_0x3cbb01[_0x4754('0x3c')],function(_0xbdbe90){var _0x1d8ad9={};_0x1d8ad9[_0xbdbe90]={'$like':'%'+_0x4fda2f['query'][_0x4754('0x45')]+'%'};return _0x1d8ad9;})});}_0x3cbb01=_['merge']({},_0x3cbb01,_0x4fda2f[_0x4754('0x46')]);return db[_0x4754('0x63')][_0x4754('0x1f')]({'where':_0x3cbb01['where']})['then'](function(_0x67e3ce){_0xda891e[_0x4754('0x1f')]=_0x67e3ce;if(_0x4fda2f[_0x4754('0x38')][_0x4754('0x47')]){_0x3cbb01[_0x4754('0x48')]=[{'all':!![]}];}return db[_0x4754('0x63')][_0x4754('0x49')](_0x3cbb01);})[_0x4754('0x25')](function(_0x37a1ae){_0xda891e[_0x4754('0x4a')]=_0x37a1ae;return _0xda891e;});}})['then'](respondWithFilteredResult(_0x57cdf3,_0x3cbb01))[_0x4754('0x4b')](handleError(_0x57cdf3,null));};exports['getHopperBlacks']=function(_0x40899b,_0x34d63b,_0x407cbd){var _0x40f806={'raw':!![],'where':{}};var _0x14729f={};var _0x21ec61={'count':0x0,'rows':[]};return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x40899b[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x34d63b,null))['then'](function(_0x329ca2){if(_0x329ca2){_0x14729f[_0x4754('0x36')]=_['keys'](db[_0x4754('0x64')][_0x4754('0x32')]);_0x14729f[_0x4754('0x38')]=_[_0x4754('0x39')](_0x40899b[_0x4754('0x38')]);_0x14729f[_0x4754('0x42')]=_[_0x4754('0x3a')](_0x14729f[_0x4754('0x36')],_0x14729f[_0x4754('0x38')]);_0x40f806[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x14729f[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x40899b['query'][_0x4754('0x3b')]));_0x40f806[_0x4754('0x3c')]=_0x40f806[_0x4754('0x3c')]['length']?_0x40f806[_0x4754('0x3c')]:_0x14729f[_0x4754('0x36')];if(!_0x40899b[_0x4754('0x38')][_0x4754('0x3d')](_0x4754('0x3e'))){_0x40f806[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x40899b[_0x4754('0x38')]['limit']);_0x40f806[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x40899b['query'][_0x4754('0x1d')]);}_0x40f806[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x40899b[_0x4754('0x38')][_0x4754('0x40')]);_0x40f806['where']=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x40899b['query'],_0x14729f[_0x4754('0x42')]));_0x40f806['where'][_0x4754('0x5e')]=_0x329ca2['id'];if(_0x40899b['query']['filter']){_0x40f806[_0x4754('0x41')]=_['merge'](_0x40f806['where'],{'$or':_[_0x4754('0x37')](_0x40f806[_0x4754('0x3c')],function(_0x1b28a8){var _0x4dcd61={};_0x4dcd61[_0x1b28a8]={'$like':'%'+_0x40899b[_0x4754('0x38')]['filter']+'%'};return _0x4dcd61;})});}_0x40f806=_[_0x4754('0x2e')]({},_0x40f806,_0x40899b['options']);return db['CmHopperBlack'][_0x4754('0x1f')]({'where':_0x40f806['where']})['then'](function(_0x12dec4){_0x21ec61['count']=_0x12dec4;if(_0x40899b[_0x4754('0x38')]['includeAll']){_0x40f806[_0x4754('0x48')]=[{'all':!![]}];}return db[_0x4754('0x64')]['findAll'](_0x40f806);})['then'](function(_0x25caad){_0x21ec61[_0x4754('0x4a')]=_0x25caad;return _0x21ec61;});}})[_0x4754('0x25')](respondWithFilteredResult(_0x34d63b,_0x40f806))[_0x4754('0x4b')](handleError(_0x34d63b,null));};exports[_0x4754('0x65')]=function(_0x3fcced,_0xd8849c,_0x537066){var _0x183d6e={};var _0x76facd={};var _0x4cbf89;var _0x3edbb7;return db[_0x4754('0x31')][_0x4754('0x5d')]({'where':{'id':_0x3fcced[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0xd8849c,null))[_0x4754('0x25')](function(_0x3e3d7b){if(_0x3e3d7b){_0x4cbf89=_0x3e3d7b;_0x76facd[_0x4754('0x36')]=_['keys'](db[_0x4754('0x66')][_0x4754('0x32')]);_0x76facd[_0x4754('0x38')]=_[_0x4754('0x39')](_0x3fcced[_0x4754('0x38')]);_0x76facd['filters']=_['intersection'](_0x76facd[_0x4754('0x36')],_0x76facd[_0x4754('0x38')]);_0x183d6e['attributes']=_['intersection'](_0x76facd[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x3fcced[_0x4754('0x38')]['fields']));_0x183d6e['attributes']=_0x183d6e[_0x4754('0x3c')]['length']?_0x183d6e[_0x4754('0x3c')]:_0x76facd[_0x4754('0x36')];_0x183d6e[_0x4754('0x3f')]=qs[_0x4754('0x40')](_0x3fcced['query'][_0x4754('0x40')]);_0x183d6e['where']=qs['filters'](_[_0x4754('0x43')](_0x3fcced[_0x4754('0x38')],_0x76facd[_0x4754('0x42')]));if(_0x3fcced[_0x4754('0x38')]['filter']){_0x183d6e[_0x4754('0x41')]=_['merge'](_0x183d6e['where'],{'$or':_['map'](_0x183d6e[_0x4754('0x3c')],function(_0x351b86){var _0x4adace={};_0x4adace[_0x351b86]={'$like':'%'+_0x3fcced['query']['filter']+'%'};return _0x4adace;})});}_0x183d6e=_[_0x4754('0x2e')]({},_0x183d6e,_0x3fcced['options']);return _0x4cbf89[_0x4754('0x65')](_0x183d6e);}})[_0x4754('0x25')](function(_0x46c450){if(_0x46c450){_0x3edbb7=_0x46c450[_0x4754('0x4e')];if(!_0x3fcced['query'][_0x4754('0x3d')](_0x4754('0x3e'))){_0x183d6e[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x3fcced[_0x4754('0x38')][_0x4754('0x20')]);_0x183d6e[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x3fcced['query'][_0x4754('0x1d')]);}return _0x4cbf89['getLists'](_0x183d6e);}})[_0x4754('0x25')](function(_0x5a1eaa){if(_0x5a1eaa){return _0x5a1eaa?{'count':_0x3edbb7,'rows':_0x5a1eaa}:null;}})[_0x4754('0x25')](respondWithResult(_0xd8849c,null))[_0x4754('0x4b')](handleError(_0xd8849c,null));};exports[_0x4754('0x67')]=function(_0x1050a5,_0x356763,_0x140527){var _0x2885bb,_0x44a151;return db[_0x4754('0x31')]['find']({'where':{'id':_0x1050a5[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x356763,null))['then'](function(_0x39b54f){if(_0x39b54f){_0x44a151=_0x39b54f;return _0x39b54f[_0x4754('0x67')](_0x1050a5[_0x4754('0x2f')][_0x4754('0x68')],_[_0x4754('0x5a')](_0x1050a5['body'],[_0x4754('0x68'),'id'])||{});}return null;})[_0x4754('0x69')](function(_0x578e1b){var _0x18c099;_0x2885bb=_0x578e1b||[];var _0x2a020b=[];if(_0x578e1b){for(var _0x295ff6=0x0;_0x295ff6<_0x578e1b['length'];_0x295ff6+=0x1){var _0x29dae4=_0x578e1b[_0x295ff6][_0x4754('0x27')]({'plain':!![]});_0x44a151[_0x4754('0x6a')]=_0x1050a5[_0x4754('0x2f')]['dialCheckDuplicateType']?_0x1050a5[_0x4754('0x2f')]['dialCheckDuplicateType']:_0x44a151[_0x4754('0x6a')];switch(_0x44a151[_0x4754('0x6a')]){case _0x4754('0x6b'):_0x18c099=squel[_0x4754('0x6c')]()[_0x4754('0x6d')](_0x4754('0x6e'))[_0x4754('0x6f')]([_0x4754('0x70'),_0x4754('0x71'),_0x4754('0x72'),'ListId',_0x4754('0x5e'),'createdAt','updatedAt'],squel[_0x4754('0x73')]()['field'](_0x4754('0x70'),_0x4754('0x70'))[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x71'))[_0x4754('0x74')]('id','ContactId')['field'](_0x29dae4['CmListId'][_0x4754('0x76')](),_0x4754('0x77'))['field'](_0x1050a5['params']['id'][_0x4754('0x76')](),_0x4754('0x5e'))[_0x4754('0x74')](_0x4754('0x75'),'createdAt')[_0x4754('0x74')]('NOW()',_0x4754('0x78'))[_0x4754('0x79')](_0x4754('0x7a'))[_0x4754('0x41')]('deletedAt\x20IS\x20NULL')[_0x4754('0x41')](_0x4754('0x7b'),_0x29dae4['CmListId'][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c'))[_0x4754('0x41')](_0x4754('0x7d'),squel[_0x4754('0x73')]()[_0x4754('0x74')](_0x4754('0x7e'))[_0x4754('0x79')](_0x4754('0x7f'))[_0x4754('0x41')]('CampaignId\x20=\x20?',_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x4754('0x74')]('COALESCE(phone,\x27\x27)')[_0x4754('0x79')](_0x4754('0x6e'))[_0x4754('0x41')](_0x4754('0x80'),_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')]())))[_0x4754('0x76')]();break;case'onlyIfOpen':_0x18c099=squel[_0x4754('0x6c')]()[_0x4754('0x6d')](_0x4754('0x6e'))[_0x4754('0x6f')](['phone',_0x4754('0x71'),_0x4754('0x72'),_0x4754('0x77'),_0x4754('0x5e'),_0x4754('0x59'),_0x4754('0x78')],squel[_0x4754('0x73')]()[_0x4754('0x74')]('phone',_0x4754('0x70'))[_0x4754('0x74')]('NOW()',_0x4754('0x71'))[_0x4754('0x74')]('id','ContactId')['field'](_0x29dae4[_0x4754('0x81')][_0x4754('0x76')](),_0x4754('0x77'))[_0x4754('0x74')](_0x1050a5['params']['id']['toString'](),_0x4754('0x5e'))['field']('NOW()',_0x4754('0x59'))['field'](_0x4754('0x75'),_0x4754('0x78'))['from'](_0x4754('0x7a'))[_0x4754('0x41')](_0x4754('0x82'))['where'](_0x4754('0x7b'),_0x29dae4[_0x4754('0x81')][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c'))[_0x4754('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4754('0x73')]()[_0x4754('0x74')](_0x4754('0x83'))[_0x4754('0x79')](_0x4754('0x6e'))['where'](_0x4754('0x80'),_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')]())))[_0x4754('0x76')]();break;default:_0x18c099=squel[_0x4754('0x6c')]()['into'](_0x4754('0x6e'))[_0x4754('0x6f')]([_0x4754('0x70'),_0x4754('0x71'),'ContactId',_0x4754('0x77'),_0x4754('0x5e'),_0x4754('0x59'),_0x4754('0x78')],squel[_0x4754('0x73')]()[_0x4754('0x74')](_0x4754('0x70'),_0x4754('0x70'))[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x71'))['field']('id',_0x4754('0x72'))[_0x4754('0x74')](_0x29dae4[_0x4754('0x81')][_0x4754('0x76')](),'ListId')[_0x4754('0x74')](_0x1050a5[_0x4754('0x4d')]['id'][_0x4754('0x76')](),_0x4754('0x5e'))[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x59'))['field'](_0x4754('0x75'),'updatedAt')['from']('cm_contacts')[_0x4754('0x41')](_0x4754('0x82'))[_0x4754('0x41')](_0x4754('0x7b'),_0x29dae4[_0x4754('0x81')][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c')))[_0x4754('0x76')]();}_0x2a020b['push'](db[_0x4754('0x84')][_0x4754('0x38')](_0x18c099));}return BPromise[_0x4754('0x85')](_0x2a020b);}})[_0x4754('0x25')](function(){return _0x2885bb;})[_0x4754('0x25')](respondWithResult(_0x356763,null))[_0x4754('0x4b')](handleError(_0x356763,null));};exports['removeLists']=function(_0x50ff20,_0x44f139,_0x2f073a){return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x50ff20['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x44f139,null))[_0x4754('0x25')](function(_0x3c28ba){if(_0x3c28ba){return _0x3c28ba[_0x4754('0x86')](_0x50ff20[_0x4754('0x38')][_0x4754('0x68')]);}})[_0x4754('0x25')](function(_0x39628d){if(_0x39628d){return db[_0x4754('0x5f')][_0x4754('0x26')]({'where':{'ListId':_0x50ff20[_0x4754('0x38')]['ids'],'CampaignId':_0x50ff20[_0x4754('0x4d')]['id']}})['then'](function(){return _0x39628d;});}})[_0x4754('0x25')](respondWithStatusCode(_0x44f139,null))[_0x4754('0x4b')](handleError(_0x44f139,null));};exports['getBlackLists']=function(_0x34fd3f,_0x35ac2a,_0x477b97){var _0x33a894={};var _0x3a19b2={};var _0x47006d;var _0x2d3be4;return db['Campaign']['findOne']({'where':{'id':_0x34fd3f[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x35ac2a,null))[_0x4754('0x25')](function(_0x59668f){if(_0x59668f){_0x47006d=_0x59668f;_0x3a19b2[_0x4754('0x36')]=_['keys'](db[_0x4754('0x66')][_0x4754('0x32')]);_0x3a19b2[_0x4754('0x38')]=_['keys'](_0x34fd3f[_0x4754('0x38')]);_0x3a19b2[_0x4754('0x42')]=_['intersection'](_0x3a19b2[_0x4754('0x36')],_0x3a19b2['query']);_0x33a894[_0x4754('0x3c')]=_[_0x4754('0x3a')](_0x3a19b2[_0x4754('0x36')],qs[_0x4754('0x3b')](_0x34fd3f['query'][_0x4754('0x3b')]));_0x33a894[_0x4754('0x3c')]=_0x33a894[_0x4754('0x3c')][_0x4754('0x4e')]?_0x33a894['attributes']:_0x3a19b2[_0x4754('0x36')];_0x33a894[_0x4754('0x3f')]=qs['sort'](_0x34fd3f[_0x4754('0x38')][_0x4754('0x40')]);_0x33a894['where']=qs[_0x4754('0x42')](_[_0x4754('0x43')](_0x34fd3f[_0x4754('0x38')],_0x3a19b2[_0x4754('0x42')]));if(_0x34fd3f[_0x4754('0x38')]['filter']){_0x33a894[_0x4754('0x41')]=_[_0x4754('0x2e')](_0x33a894[_0x4754('0x41')],{'$or':_[_0x4754('0x37')](_0x33a894[_0x4754('0x3c')],function(_0x3a5d65){var _0x3f37c5={};_0x3f37c5[_0x3a5d65]={'$like':'%'+_0x34fd3f['query'][_0x4754('0x45')]+'%'};return _0x3f37c5;})});}_0x33a894=_[_0x4754('0x2e')]({},_0x33a894,_0x34fd3f[_0x4754('0x46')]);return _0x47006d[_0x4754('0x87')](_0x33a894);}})[_0x4754('0x25')](function(_0x5e3953){if(_0x5e3953){_0x2d3be4=_0x5e3953['length'];if(!_0x34fd3f[_0x4754('0x38')]['hasOwnProperty'](_0x4754('0x3e'))){_0x33a894[_0x4754('0x20')]=qs[_0x4754('0x20')](_0x34fd3f['query']['limit']);_0x33a894[_0x4754('0x1d')]=qs[_0x4754('0x1d')](_0x34fd3f[_0x4754('0x38')]['offset']);}return _0x47006d[_0x4754('0x87')](_0x33a894);}})['then'](function(_0x513b3d){if(_0x513b3d){return _0x513b3d?{'count':_0x2d3be4,'rows':_0x513b3d}:null;}})['then'](respondWithResult(_0x35ac2a,null))[_0x4754('0x4b')](handleError(_0x35ac2a,null));};exports[_0x4754('0x88')]=function(_0x165b22,_0x139e53,_0x2fb100){var _0x2ce4b7,_0x103aed;return db[_0x4754('0x31')][_0x4754('0x58')]({'where':{'id':_0x165b22[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x139e53,null))[_0x4754('0x25')](function(_0x5ef8ef){if(_0x5ef8ef){_0x103aed=_0x5ef8ef;return _0x5ef8ef[_0x4754('0x88')](_0x165b22[_0x4754('0x2f')]['ids'],_[_0x4754('0x5a')](_0x165b22['body'],[_0x4754('0x68'),'id'])||{});}return null;})['spread'](function(_0x57bbf6){var _0x831893;_0x2ce4b7=_0x57bbf6||[];var _0x5d8e6b=[];if(_0x57bbf6){for(var _0x2126d8=0x0;_0x2126d8<_0x57bbf6[_0x4754('0x4e')];_0x2126d8+=0x1){var _0x2d30fb=_0x57bbf6[_0x2126d8][_0x4754('0x27')]({'plain':!![]});_0x831893=squel[_0x4754('0x6c')]()[_0x4754('0x6d')]('cm_hopper_black')[_0x4754('0x6f')]([_0x4754('0x70'),_0x4754('0x72'),_0x4754('0x77'),_0x4754('0x5e'),_0x4754('0x59'),'updatedAt'],squel['select']()['field'](_0x4754('0x70'),_0x4754('0x70'))['field']('id',_0x4754('0x72'))[_0x4754('0x74')](_0x2d30fb['CmListId'][_0x4754('0x76')](),_0x4754('0x77'))['field'](_0x165b22[_0x4754('0x4d')]['id']['toString'](),_0x4754('0x5e'))[_0x4754('0x74')](_0x4754('0x75'),'createdAt')[_0x4754('0x74')](_0x4754('0x75'),_0x4754('0x78'))[_0x4754('0x79')](_0x4754('0x7a'))[_0x4754('0x41')](_0x4754('0x82'))[_0x4754('0x41')](_0x4754('0x7b'),_0x2d30fb[_0x4754('0x81')][_0x4754('0x76')]())[_0x4754('0x41')](_0x4754('0x7c')))[_0x4754('0x76')]();_0x5d8e6b[_0x4754('0x89')](db[_0x4754('0x84')][_0x4754('0x38')](_0x831893));}return BPromise[_0x4754('0x85')](_0x5d8e6b);}})[_0x4754('0x25')](function(){return _0x2ce4b7;})[_0x4754('0x25')](respondWithResult(_0x139e53,null))['catch'](handleError(_0x139e53,null));};exports[_0x4754('0x8a')]=function(_0x47fba3,_0x46cbd5,_0x2de779){return db['Campaign'][_0x4754('0x58')]({'where':{'id':_0x47fba3[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x46cbd5,null))[_0x4754('0x25')](function(_0xee591c){if(_0xee591c){return _0xee591c[_0x4754('0x8a')](_0x47fba3[_0x4754('0x38')][_0x4754('0x68')]);}})[_0x4754('0x25')](function(_0x44d1ff){if(_0x44d1ff){return db[_0x4754('0x64')][_0x4754('0x26')]({'where':{'ListId':_0x47fba3[_0x4754('0x38')][_0x4754('0x68')],'CampaignId':_0x47fba3[_0x4754('0x4d')]['id']}})[_0x4754('0x25')](function(){return _0x44d1ff;});}})[_0x4754('0x25')](respondWithStatusCode(_0x46cbd5,null))['catch'](handleError(_0x46cbd5,null));}; \ No newline at end of file +var _0xe877=['pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','into','sequelize','all','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','status','error','stack','send','render','merge','body','contact','message','agent','interaction','map','Campaign','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','name','include','findAll','catch','show','params','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getHoppers','findOne','CmHopper'];(function(_0x4a4171,_0xc6330a){var _0x32e17d=function(_0x941ecd){while(--_0x941ecd){_0x4a4171['push'](_0x4a4171['shift']());}};_0x32e17d(++_0xc6330a);}(_0xe877,0x1dd));var _0x7e87=function(_0x3d11b0,_0x543298){_0x3d11b0=_0x3d11b0-0x0;var _0x1a6d0c=_0xe877[_0x3d11b0];return _0x1a6d0c;};'use strict';var emlformat=require(_0x7e87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e87('0x1'));var jsonpatch=require(_0x7e87('0x2'));var rp=require(_0x7e87('0x3'));var moment=require(_0x7e87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7e87('0x5'));var util=require(_0x7e87('0x6'));var path=require(_0x7e87('0x7'));var sox=require(_0x7e87('0x8'));var csv=require(_0x7e87('0x9'));var ejs=require(_0x7e87('0xa'));var fs=require('fs');var fs_extra=require(_0x7e87('0xb'));var _=require('lodash');var squel=require(_0x7e87('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e87('0xd'));var deskjs=require(_0x7e87('0xe'));var toCsv=require(_0x7e87('0x9'));var querystring=require(_0x7e87('0xf'));var Papa=require(_0x7e87('0x10'));var Redis=require(_0x7e87('0x11'));var authService=require(_0x7e87('0x12'));var qs=require(_0x7e87('0x13'));var as=require(_0x7e87('0x14'));var hardwareService=require(_0x7e87('0x15'));var logger=require(_0x7e87('0x16'))(_0x7e87('0x17'));var utils=require(_0x7e87('0x18'));var config=require(_0x7e87('0x19'));var licenseUtil=require(_0x7e87('0x1a'));var db=require(_0x7e87('0x1b'))['db'];function respondWithStatusCode(_0x39fcc5,_0x4b5740){_0x4b5740=_0x4b5740||0xcc;return function(_0x608b6f){if(_0x608b6f){return _0x39fcc5[_0x7e87('0x1c')](_0x4b5740);}return _0x39fcc5['status'](_0x4b5740)[_0x7e87('0x1d')]();};}function respondWithResult(_0x3e2866,_0xb0c281){_0xb0c281=_0xb0c281||0xc8;return function(_0x5c88eb){if(_0x5c88eb){return _0x3e2866['status'](_0xb0c281)[_0x7e87('0x1e')](_0x5c88eb);}};}function respondWithFilteredResult(_0x477e96,_0x46a4fa){return function(_0xf4eb59){if(_0xf4eb59){var _0x5adab5=typeof _0x46a4fa[_0x7e87('0x1f')]===_0x7e87('0x20')&&typeof _0x46a4fa['limit']===_0x7e87('0x20');var _0x588e44=_0xf4eb59[_0x7e87('0x21')];var _0x515aa9=_0x5adab5?0x0:_0x46a4fa[_0x7e87('0x1f')];var _0x944c2b=_0x5adab5?_0xf4eb59[_0x7e87('0x21')]:_0x46a4fa[_0x7e87('0x1f')]+_0x46a4fa[_0x7e87('0x22')];var _0x3fb15e;if(_0x944c2b>=_0x588e44){_0x944c2b=_0x588e44;_0x3fb15e=0xc8;}else{_0x3fb15e=0xce;}_0x477e96['status'](_0x3fb15e);return _0x477e96[_0x7e87('0x23')](_0x7e87('0x24'),_0x515aa9+'-'+_0x944c2b+'/'+_0x588e44)[_0x7e87('0x1e')](_0xf4eb59);}return null;};}function patchUpdates(_0xbbbaf6){return function(_0x5d5027){try{jsonpatch[_0x7e87('0x25')](_0x5d5027,_0xbbbaf6,!![]);}catch(_0x1cce62){return BPromise[_0x7e87('0x26')](_0x1cce62);}return _0x5d5027['save']();};}function saveUpdates(_0x18e3c1,_0x577d6d){return function(_0x35f3fe){if(_0x35f3fe){return _0x35f3fe[_0x7e87('0x27')](_0x18e3c1)[_0x7e87('0x28')](function(_0x5dd8cc){return _0x5dd8cc;});}return null;};}function removeEntity(_0x26754e,_0x261f9b){return function(_0x9c688){if(_0x9c688){return _0x9c688[_0x7e87('0x29')]()['then'](function(){var _0x6617d6=_0x9c688[_0x7e87('0x2a')]({'plain':!![]});var _0x274466=_0x7e87('0x2b');return db[_0x7e87('0x2c')][_0x7e87('0x29')]({'where':{'type':_0x274466,'resourceId':_0x6617d6['id']}})[_0x7e87('0x28')](function(){return _0x9c688;});})[_0x7e87('0x28')](function(){_0x26754e[_0x7e87('0x2d')](0xcc)[_0x7e87('0x1d')]();});}};}function handleEntityNotFound(_0x2d37b0,_0x29c36c){return function(_0x2849cb){if(!_0x2849cb){_0x2d37b0[_0x7e87('0x1c')](0x194);}return _0x2849cb;};}function handleError(_0x2088b4,_0x581f47){_0x581f47=_0x581f47||0x1f4;return function(_0x25055d){logger[_0x7e87('0x2e')](_0x25055d[_0x7e87('0x2f')]);if(_0x25055d['name']){delete _0x25055d['name'];}_0x2088b4[_0x7e87('0x2d')](_0x581f47)[_0x7e87('0x30')](_0x25055d);};}function getMustacheRender(_0x2c6631,_0x10920f){return Mustache[_0x7e87('0x31')](_0x2c6631,_[_0x7e87('0x32')](_0x10920f[_0x7e87('0x33')],{'contact':_0x10920f[_0x7e87('0x34')],'message':_0x10920f[_0x7e87('0x35')],'agent':_0x10920f[_0x7e87('0x36')],'interaction':_0x10920f[_0x7e87('0x37')],'account':_0x10920f['account']}))||'';}exports['index']=function(_0x4e57c4,_0x773207){var _0x3da854={},_0x5ee223={},_0x4a6cb8={'count':0x0,'rows':[]};var _0x3d38d1=_[_0x7e87('0x38')](db[_0x7e87('0x39')][_0x7e87('0x3a')],function(_0x344a50){return{'name':_0x344a50['fieldName'],'type':_0x344a50[_0x7e87('0x3b')][_0x7e87('0x3c')]};});_0x5ee223['model']=_[_0x7e87('0x38')](_0x3d38d1,'name');_0x5ee223[_0x7e87('0x3d')]=_[_0x7e87('0x3e')](_0x4e57c4[_0x7e87('0x3d')]);_0x5ee223[_0x7e87('0x3f')]=_[_0x7e87('0x40')](_0x5ee223[_0x7e87('0x41')],_0x5ee223[_0x7e87('0x3d')]);_0x3da854[_0x7e87('0x42')]=_[_0x7e87('0x40')](_0x5ee223[_0x7e87('0x41')],qs[_0x7e87('0x43')](_0x4e57c4[_0x7e87('0x3d')][_0x7e87('0x43')]));_0x3da854[_0x7e87('0x42')]=_0x3da854[_0x7e87('0x42')][_0x7e87('0x44')]?_0x3da854[_0x7e87('0x42')]:_0x5ee223[_0x7e87('0x41')];if(!_0x4e57c4['query'][_0x7e87('0x45')](_0x7e87('0x46'))){_0x3da854[_0x7e87('0x22')]=qs[_0x7e87('0x22')](_0x4e57c4[_0x7e87('0x3d')][_0x7e87('0x22')]);_0x3da854[_0x7e87('0x1f')]=qs['offset'](_0x4e57c4[_0x7e87('0x3d')][_0x7e87('0x1f')]);}_0x3da854[_0x7e87('0x47')]=qs[_0x7e87('0x48')](_0x4e57c4[_0x7e87('0x3d')][_0x7e87('0x48')]);_0x3da854[_0x7e87('0x49')]=qs['filters'](_['pick'](_0x4e57c4['query'],_0x5ee223[_0x7e87('0x3f')]),_0x3d38d1);if(_0x4e57c4['query'][_0x7e87('0x4a')]){_0x3da854['where']=_[_0x7e87('0x32')](_0x3da854[_0x7e87('0x49')],{'$or':_[_0x7e87('0x38')](_0x3d38d1,function(_0xb1b0f7){if(_0xb1b0f7[_0x7e87('0x3b')]!==_0x7e87('0x4b')){var _0x43b810={};_0x43b810[_0xb1b0f7[_0x7e87('0x4c')]]={'$like':'%'+_0x4e57c4['query'][_0x7e87('0x4a')]+'%'};return _0x43b810;}})});}_0x3da854=_['merge']({},_0x3da854,_0x4e57c4['options']);var _0x303aa8={'where':_0x3da854[_0x7e87('0x49')]};return db[_0x7e87('0x39')][_0x7e87('0x21')](_0x303aa8)[_0x7e87('0x28')](function(_0x11f1f9){_0x4a6cb8[_0x7e87('0x21')]=_0x11f1f9;if(_0x4e57c4[_0x7e87('0x3d')]['includeAll']){_0x3da854[_0x7e87('0x4d')]=[{'all':!![]}];}return db[_0x7e87('0x39')][_0x7e87('0x4e')](_0x3da854);})[_0x7e87('0x28')](function(_0x37dcef){_0x4a6cb8['rows']=_0x37dcef;return _0x4a6cb8;})['then'](respondWithFilteredResult(_0x773207,_0x3da854))[_0x7e87('0x4f')](handleError(_0x773207,null));};exports[_0x7e87('0x50')]=function(_0xf65ffc,_0x3cb407){var _0x499a18={'raw':![],'where':{'id':_0xf65ffc[_0x7e87('0x51')]['id']}},_0x6aac24={};_0x6aac24['model']=_[_0x7e87('0x3e')](db[_0x7e87('0x39')][_0x7e87('0x3a')]);_0x6aac24[_0x7e87('0x3d')]=_[_0x7e87('0x3e')](_0xf65ffc[_0x7e87('0x3d')]);_0x6aac24['filters']=_[_0x7e87('0x40')](_0x6aac24[_0x7e87('0x41')],_0x6aac24['query']);_0x499a18['attributes']=_[_0x7e87('0x40')](_0x6aac24[_0x7e87('0x41')],qs['fields'](_0xf65ffc[_0x7e87('0x3d')][_0x7e87('0x43')]));_0x499a18['attributes']=_0x499a18['attributes'][_0x7e87('0x44')]?_0x499a18[_0x7e87('0x42')]:_0x6aac24[_0x7e87('0x41')];if(_0xf65ffc['query'][_0x7e87('0x52')]){_0x499a18['include']=[{'all':!![]}];}_0x499a18=_['merge']({},_0x499a18,_0xf65ffc[_0x7e87('0x53')]);return db[_0x7e87('0x39')]['find'](_0x499a18)[_0x7e87('0x28')](handleEntityNotFound(_0x3cb407,null))[_0x7e87('0x28')](respondWithResult(_0x3cb407,null))[_0x7e87('0x4f')](handleError(_0x3cb407,null));};exports['create']=function(_0x3683ac,_0x520000){return db[_0x7e87('0x39')][_0x7e87('0x54')](_0x3683ac['body'],{})[_0x7e87('0x28')](function(_0x2655dc){var _0x48fa75=_0x3683ac[_0x7e87('0x55')][_0x7e87('0x2a')]({'plain':!![]});if(!_0x48fa75)throw new Error(_0x7e87('0x56'));if(_0x48fa75[_0x7e87('0x57')]===_0x7e87('0x55')){var _0x100f58=_0x2655dc[_0x7e87('0x2a')]({'plain':!![]});var _0x5f208b=_0x7e87('0x2b');return db[_0x7e87('0x58')][_0x7e87('0x59')]({'where':{'name':_0x5f208b,'userProfileId':_0x48fa75['userProfileId']},'raw':!![]})['then'](function(_0x5f49cc){if(_0x5f49cc&&_0x5f49cc[_0x7e87('0x5a')]===0x0){return db[_0x7e87('0x2c')][_0x7e87('0x54')]({'name':_0x100f58[_0x7e87('0x4c')],'resourceId':_0x100f58['id'],'type':_0x5f49cc[_0x7e87('0x4c')],'sectionId':_0x5f49cc['id']},{})['then'](function(){return _0x2655dc;});}else{return _0x2655dc;}})[_0x7e87('0x4f')](function(_0x46859d){logger[_0x7e87('0x2e')](_0x7e87('0x5b'),_0x46859d);throw _0x46859d;});}return _0x2655dc;})[_0x7e87('0x28')](respondWithResult(_0x520000,0xc9))['catch'](handleError(_0x520000,null));};exports[_0x7e87('0x5c')]=function(_0x1dc4a4,_0x27bc07){var _0x56aa87={'where':{'id':_0x1dc4a4[_0x7e87('0x51')]['id']}},_0x31173d={};_0x31173d[_0x7e87('0x41')]=_[_0x7e87('0x3e')](db[_0x7e87('0x39')][_0x7e87('0x3a')]);_0x56aa87['attributes']=_[_0x7e87('0x40')](_0x31173d[_0x7e87('0x41')],qs[_0x7e87('0x43')](_0x1dc4a4[_0x7e87('0x3d')][_0x7e87('0x43')]));_0x56aa87[_0x7e87('0x42')]=_0x56aa87[_0x7e87('0x42')][_0x7e87('0x44')]?_0x56aa87[_0x7e87('0x42')]:_0x31173d[_0x7e87('0x41')];if(_0x1dc4a4[_0x7e87('0x3d')][_0x7e87('0x52')]){_0x56aa87[_0x7e87('0x4d')]=[{'all':!![]}];}_0x56aa87=_['merge']({},_0x56aa87,_0x1dc4a4['options']);return db[_0x7e87('0x39')][_0x7e87('0x59')](_0x56aa87)[_0x7e87('0x28')](handleEntityNotFound(_0x27bc07,null))[_0x7e87('0x28')](function(_0x44541b){if(_0x44541b){var _0xb29315=_0x44541b['get']({'plain':!![]});_0xb29315=qs[_0x7e87('0x5d')](_0xb29315,['id','createdAt',_0x7e87('0x5e')]);_0x1dc4a4[_0x7e87('0x33')]=_[_0x7e87('0x5d')](_0x1dc4a4[_0x7e87('0x33')],['id',_0x7e87('0x5f'),_0x7e87('0x5e')]);return db[_0x7e87('0x39')][_0x7e87('0x54')](_[_0x7e87('0x32')](_0xb29315,_0x1dc4a4[_0x7e87('0x33')]),{'include':_0x1dc4a4[_0x7e87('0x3d')][_0x7e87('0x52')]?[{'all':!![]}]:undefined})[_0x7e87('0x28')](function(_0x4e4691){var _0x57c721=_0x1dc4a4['user'][_0x7e87('0x2a')]({'plain':!![]});if(!_0x57c721)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57c721[_0x7e87('0x57')]===_0x7e87('0x55')){var _0x457efd=_0x4e4691[_0x7e87('0x2a')]({'plain':!![]});var _0x58b813=_0x7e87('0x2b');return db[_0x7e87('0x58')][_0x7e87('0x59')]({'where':{'name':_0x58b813,'userProfileId':_0x57c721['userProfileId']},'raw':!![]})['then'](function(_0xd4ccfc){if(_0xd4ccfc&&_0xd4ccfc[_0x7e87('0x5a')]===0x0){return db[_0x7e87('0x2c')][_0x7e87('0x54')]({'name':_0x457efd['name'],'resourceId':_0x457efd['id'],'type':_0xd4ccfc[_0x7e87('0x4c')],'sectionId':_0xd4ccfc['id']},{})['then'](function(){return _0x4e4691;});}else{return _0x4e4691;}})[_0x7e87('0x4f')](function(_0x38f7b7){logger[_0x7e87('0x2e')](_0x7e87('0x5b'),_0x38f7b7);throw _0x38f7b7;});}return _0x4e4691;});}})['then'](respondWithResult(_0x27bc07,0xc9))[_0x7e87('0x4f')](handleError(_0x27bc07,null));};exports[_0x7e87('0x27')]=function(_0x1a7bd2,_0x21b5b6){if(_0x1a7bd2['body']['id']){delete _0x1a7bd2[_0x7e87('0x33')]['id'];}return db[_0x7e87('0x39')]['find']({'where':{'id':_0x1a7bd2[_0x7e87('0x51')]['id']}})[_0x7e87('0x28')](handleEntityNotFound(_0x21b5b6,null))[_0x7e87('0x28')](saveUpdates(_0x1a7bd2[_0x7e87('0x33')],null))[_0x7e87('0x28')](respondWithResult(_0x21b5b6,null))[_0x7e87('0x4f')](handleError(_0x21b5b6,null));};exports['destroy']=function(_0x382da7,_0x1a2d0a){return db[_0x7e87('0x39')]['find']({'where':{'id':_0x382da7[_0x7e87('0x51')]['id']}})['then'](handleEntityNotFound(_0x1a2d0a,null))[_0x7e87('0x28')](removeEntity(_0x1a2d0a,null))[_0x7e87('0x4f')](handleError(_0x1a2d0a,null));};exports[_0x7e87('0x60')]=function(_0x1693ac,_0x365d7d,_0x23c48f){var _0x511f11={'raw':!![],'where':{}};var _0x5d500d={};var _0x3f4717={'count':0x0,'rows':[]};return db[_0x7e87('0x39')][_0x7e87('0x61')]({'where':{'id':_0x1693ac[_0x7e87('0x51')]['id']}})[_0x7e87('0x28')](handleEntityNotFound(_0x365d7d,null))[_0x7e87('0x28')](function(_0x45a8a){if(_0x45a8a){_0x5d500d[_0x7e87('0x41')]=_[_0x7e87('0x3e')](db[_0x7e87('0x62')][_0x7e87('0x3a')]);_0x5d500d[_0x7e87('0x3d')]=_[_0x7e87('0x3e')](_0x1693ac[_0x7e87('0x3d')]);_0x5d500d[_0x7e87('0x3f')]=_['intersection'](_0x5d500d[_0x7e87('0x41')],_0x5d500d[_0x7e87('0x3d')]);_0x511f11[_0x7e87('0x42')]=_[_0x7e87('0x40')](_0x5d500d['model'],qs['fields'](_0x1693ac['query'][_0x7e87('0x43')]));_0x511f11[_0x7e87('0x42')]=_0x511f11[_0x7e87('0x42')]['length']?_0x511f11[_0x7e87('0x42')]:_0x5d500d[_0x7e87('0x41')];if(!_0x1693ac[_0x7e87('0x3d')][_0x7e87('0x45')](_0x7e87('0x46'))){_0x511f11[_0x7e87('0x22')]=qs[_0x7e87('0x22')](_0x1693ac['query'][_0x7e87('0x22')]);_0x511f11[_0x7e87('0x1f')]=qs['offset'](_0x1693ac[_0x7e87('0x3d')][_0x7e87('0x1f')]);}_0x511f11['order']=qs[_0x7e87('0x48')](_0x1693ac[_0x7e87('0x3d')][_0x7e87('0x48')]);_0x511f11[_0x7e87('0x49')]=qs[_0x7e87('0x3f')](_[_0x7e87('0x63')](_0x1693ac[_0x7e87('0x3d')],_0x5d500d[_0x7e87('0x3f')]));_0x511f11[_0x7e87('0x49')][_0x7e87('0x64')]=_0x45a8a['id'];if(_0x1693ac[_0x7e87('0x3d')][_0x7e87('0x4a')]){_0x511f11['where']=_[_0x7e87('0x32')](_0x511f11[_0x7e87('0x49')],{'$or':_[_0x7e87('0x38')](_0x511f11[_0x7e87('0x42')],function(_0x49d48a){var _0x27358a={};_0x27358a[_0x49d48a]={'$like':'%'+_0x1693ac[_0x7e87('0x3d')][_0x7e87('0x4a')]+'%'};return _0x27358a;})});}_0x511f11=_[_0x7e87('0x32')]({},_0x511f11,_0x1693ac[_0x7e87('0x53')]);return db[_0x7e87('0x62')][_0x7e87('0x21')]({'where':_0x511f11['where']})[_0x7e87('0x28')](function(_0x1b3f79){_0x3f4717[_0x7e87('0x21')]=_0x1b3f79;if(_0x1693ac[_0x7e87('0x3d')][_0x7e87('0x52')]){_0x511f11[_0x7e87('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0x7e87('0x4e')](_0x511f11);})[_0x7e87('0x28')](function(_0x5cb33b){_0x3f4717[_0x7e87('0x65')]=_0x5cb33b;return _0x3f4717;});}})['then'](respondWithFilteredResult(_0x365d7d,_0x511f11))[_0x7e87('0x4f')](handleError(_0x365d7d,null));};exports[_0x7e87('0x66')]=function(_0x9353ff,_0x182c87,_0x224da8){var _0x30a9ca={'raw':!![],'where':{}};var _0x2fc2da={};var _0x4349d6={'count':0x0,'rows':[]};return db['Campaign'][_0x7e87('0x61')]({'where':{'id':_0x9353ff[_0x7e87('0x51')]['id']}})['then'](handleEntityNotFound(_0x182c87,null))[_0x7e87('0x28')](function(_0x1d0607){if(_0x1d0607){_0x2fc2da['model']=_[_0x7e87('0x3e')](db[_0x7e87('0x67')][_0x7e87('0x3a')]);_0x2fc2da[_0x7e87('0x3d')]=_[_0x7e87('0x3e')](_0x9353ff[_0x7e87('0x3d')]);_0x2fc2da[_0x7e87('0x3f')]=_['intersection'](_0x2fc2da[_0x7e87('0x41')],_0x2fc2da['query']);_0x30a9ca[_0x7e87('0x42')]=_[_0x7e87('0x40')](_0x2fc2da[_0x7e87('0x41')],qs[_0x7e87('0x43')](_0x9353ff['query'][_0x7e87('0x43')]));_0x30a9ca[_0x7e87('0x42')]=_0x30a9ca[_0x7e87('0x42')]['length']?_0x30a9ca[_0x7e87('0x42')]:_0x2fc2da[_0x7e87('0x41')];if(!_0x9353ff[_0x7e87('0x3d')][_0x7e87('0x45')]('nolimit')){_0x30a9ca[_0x7e87('0x22')]=qs[_0x7e87('0x22')](_0x9353ff['query'][_0x7e87('0x22')]);_0x30a9ca[_0x7e87('0x1f')]=qs['offset'](_0x9353ff['query'][_0x7e87('0x1f')]);}_0x30a9ca[_0x7e87('0x47')]=qs[_0x7e87('0x48')](_0x9353ff[_0x7e87('0x3d')][_0x7e87('0x48')]);_0x30a9ca[_0x7e87('0x49')]=qs[_0x7e87('0x3f')](_['pick'](_0x9353ff[_0x7e87('0x3d')],_0x2fc2da[_0x7e87('0x3f')]));_0x30a9ca['where'][_0x7e87('0x64')]=_0x1d0607['id'];if(_0x9353ff[_0x7e87('0x3d')][_0x7e87('0x4a')]){_0x30a9ca[_0x7e87('0x49')]=_[_0x7e87('0x32')](_0x30a9ca[_0x7e87('0x49')],{'$or':_[_0x7e87('0x38')](_0x30a9ca[_0x7e87('0x42')],function(_0xe4e611){var _0x51e97e={};_0x51e97e[_0xe4e611]={'$like':'%'+_0x9353ff['query'][_0x7e87('0x4a')]+'%'};return _0x51e97e;})});}_0x30a9ca=_[_0x7e87('0x32')]({},_0x30a9ca,_0x9353ff['options']);return db['CmHopperHistory']['count']({'where':_0x30a9ca['where']})[_0x7e87('0x28')](function(_0x585be8){_0x4349d6[_0x7e87('0x21')]=_0x585be8;if(_0x9353ff[_0x7e87('0x3d')][_0x7e87('0x52')]){_0x30a9ca[_0x7e87('0x4d')]=[{'all':!![]}];}return db[_0x7e87('0x67')][_0x7e87('0x4e')](_0x30a9ca);})['then'](function(_0x4a68cd){_0x4349d6[_0x7e87('0x65')]=_0x4a68cd;return _0x4349d6;});}})[_0x7e87('0x28')](respondWithFilteredResult(_0x182c87,_0x30a9ca))['catch'](handleError(_0x182c87,null));};exports[_0x7e87('0x68')]=function(_0x58f7c5,_0x5d5cb9,_0x449448){var _0x20bddd={'raw':!![],'where':{}};var _0x4c528b={};var _0x152473={'count':0x0,'rows':[]};return db[_0x7e87('0x39')][_0x7e87('0x61')]({'where':{'id':_0x58f7c5[_0x7e87('0x51')]['id']}})[_0x7e87('0x28')](handleEntityNotFound(_0x5d5cb9,null))[_0x7e87('0x28')](function(_0x41f230){if(_0x41f230){_0x4c528b[_0x7e87('0x41')]=_[_0x7e87('0x3e')](db[_0x7e87('0x69')]['rawAttributes']);_0x4c528b[_0x7e87('0x3d')]=_['keys'](_0x58f7c5[_0x7e87('0x3d')]);_0x4c528b[_0x7e87('0x3f')]=_['intersection'](_0x4c528b[_0x7e87('0x41')],_0x4c528b['query']);_0x20bddd[_0x7e87('0x42')]=_[_0x7e87('0x40')](_0x4c528b['model'],qs['fields'](_0x58f7c5[_0x7e87('0x3d')][_0x7e87('0x43')]));_0x20bddd['attributes']=_0x20bddd[_0x7e87('0x42')][_0x7e87('0x44')]?_0x20bddd[_0x7e87('0x42')]:_0x4c528b['model'];if(!_0x58f7c5['query'][_0x7e87('0x45')]('nolimit')){_0x20bddd[_0x7e87('0x22')]=qs['limit'](_0x58f7c5[_0x7e87('0x3d')][_0x7e87('0x22')]);_0x20bddd[_0x7e87('0x1f')]=qs[_0x7e87('0x1f')](_0x58f7c5['query'][_0x7e87('0x1f')]);}_0x20bddd[_0x7e87('0x47')]=qs[_0x7e87('0x48')](_0x58f7c5[_0x7e87('0x3d')][_0x7e87('0x48')]);_0x20bddd[_0x7e87('0x49')]=qs[_0x7e87('0x3f')](_['pick'](_0x58f7c5[_0x7e87('0x3d')],_0x4c528b[_0x7e87('0x3f')]));_0x20bddd[_0x7e87('0x49')][_0x7e87('0x64')]=_0x41f230['id'];if(_0x58f7c5['query'][_0x7e87('0x4a')]){_0x20bddd['where']=_[_0x7e87('0x32')](_0x20bddd[_0x7e87('0x49')],{'$or':_[_0x7e87('0x38')](_0x20bddd['attributes'],function(_0x34cbd2){var _0x85e2be={};_0x85e2be[_0x34cbd2]={'$like':'%'+_0x58f7c5[_0x7e87('0x3d')][_0x7e87('0x4a')]+'%'};return _0x85e2be;})});}_0x20bddd=_['merge']({},_0x20bddd,_0x58f7c5[_0x7e87('0x53')]);return db[_0x7e87('0x69')][_0x7e87('0x21')]({'where':_0x20bddd['where']})['then'](function(_0x12a71f){_0x152473[_0x7e87('0x21')]=_0x12a71f;if(_0x58f7c5[_0x7e87('0x3d')]['includeAll']){_0x20bddd[_0x7e87('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x20bddd);})['then'](function(_0x9f91b3){_0x152473[_0x7e87('0x65')]=_0x9f91b3;return _0x152473;});}})[_0x7e87('0x28')](respondWithFilteredResult(_0x5d5cb9,_0x20bddd))[_0x7e87('0x4f')](handleError(_0x5d5cb9,null));};exports[_0x7e87('0x6a')]=function(_0xe7580d,_0x6ad9ed,_0x2de6c1){var _0x102058={'raw':!![],'where':{}};var _0x4bc30f={};var _0x2e5eda={'count':0x0,'rows':[]};return db['Campaign'][_0x7e87('0x61')]({'where':{'id':_0xe7580d['params']['id']}})[_0x7e87('0x28')](handleEntityNotFound(_0x6ad9ed,null))['then'](function(_0x2374af){if(_0x2374af){_0x4bc30f[_0x7e87('0x41')]=_[_0x7e87('0x3e')](db[_0x7e87('0x6b')][_0x7e87('0x3a')]);_0x4bc30f[_0x7e87('0x3d')]=_[_0x7e87('0x3e')](_0xe7580d['query']);_0x4bc30f[_0x7e87('0x3f')]=_[_0x7e87('0x40')](_0x4bc30f['model'],_0x4bc30f[_0x7e87('0x3d')]);_0x102058[_0x7e87('0x42')]=_[_0x7e87('0x40')](_0x4bc30f[_0x7e87('0x41')],qs[_0x7e87('0x43')](_0xe7580d[_0x7e87('0x3d')][_0x7e87('0x43')]));_0x102058['attributes']=_0x102058[_0x7e87('0x42')][_0x7e87('0x44')]?_0x102058[_0x7e87('0x42')]:_0x4bc30f['model'];if(!_0xe7580d['query'][_0x7e87('0x45')]('nolimit')){_0x102058[_0x7e87('0x22')]=qs['limit'](_0xe7580d[_0x7e87('0x3d')]['limit']);_0x102058[_0x7e87('0x1f')]=qs['offset'](_0xe7580d[_0x7e87('0x3d')][_0x7e87('0x1f')]);}_0x102058[_0x7e87('0x47')]=qs['sort'](_0xe7580d['query'][_0x7e87('0x48')]);_0x102058[_0x7e87('0x49')]=qs[_0x7e87('0x3f')](_[_0x7e87('0x63')](_0xe7580d[_0x7e87('0x3d')],_0x4bc30f['filters']));_0x102058[_0x7e87('0x49')][_0x7e87('0x64')]=_0x2374af['id'];if(_0xe7580d[_0x7e87('0x3d')][_0x7e87('0x4a')]){_0x102058['where']=_['merge'](_0x102058[_0x7e87('0x49')],{'$or':_[_0x7e87('0x38')](_0x102058[_0x7e87('0x42')],function(_0x2428d1){var _0x972aed={};_0x972aed[_0x2428d1]={'$like':'%'+_0xe7580d[_0x7e87('0x3d')][_0x7e87('0x4a')]+'%'};return _0x972aed;})});}_0x102058=_[_0x7e87('0x32')]({},_0x102058,_0xe7580d['options']);return db[_0x7e87('0x6b')][_0x7e87('0x21')]({'where':_0x102058[_0x7e87('0x49')]})[_0x7e87('0x28')](function(_0x1c3648){_0x2e5eda[_0x7e87('0x21')]=_0x1c3648;if(_0xe7580d[_0x7e87('0x3d')]['includeAll']){_0x102058['include']=[{'all':!![]}];}return db[_0x7e87('0x6b')][_0x7e87('0x4e')](_0x102058);})[_0x7e87('0x28')](function(_0x51129b){_0x2e5eda[_0x7e87('0x65')]=_0x51129b;return _0x2e5eda;});}})['then'](respondWithFilteredResult(_0x6ad9ed,_0x102058))['catch'](handleError(_0x6ad9ed,null));};exports[_0x7e87('0x6c')]=function(_0x2335f9,_0x11b7f0,_0x871ec){var _0xaf6743={};var _0x7344c2={};var _0x5258c0;var _0x249b51;return db[_0x7e87('0x39')][_0x7e87('0x61')]({'where':{'id':_0x2335f9['params']['id']}})[_0x7e87('0x28')](handleEntityNotFound(_0x11b7f0,null))[_0x7e87('0x28')](function(_0x4ec6f2){if(_0x4ec6f2){_0x5258c0=_0x4ec6f2;_0x7344c2[_0x7e87('0x41')]=_[_0x7e87('0x3e')](db[_0x7e87('0x6d')]['rawAttributes']);_0x7344c2['query']=_[_0x7e87('0x3e')](_0x2335f9[_0x7e87('0x3d')]);_0x7344c2[_0x7e87('0x3f')]=_[_0x7e87('0x40')](_0x7344c2['model'],_0x7344c2[_0x7e87('0x3d')]);_0xaf6743[_0x7e87('0x42')]=_[_0x7e87('0x40')](_0x7344c2[_0x7e87('0x41')],qs[_0x7e87('0x43')](_0x2335f9[_0x7e87('0x3d')][_0x7e87('0x43')]));_0xaf6743[_0x7e87('0x42')]=_0xaf6743[_0x7e87('0x42')][_0x7e87('0x44')]?_0xaf6743[_0x7e87('0x42')]:_0x7344c2[_0x7e87('0x41')];_0xaf6743['order']=qs[_0x7e87('0x48')](_0x2335f9['query']['sort']);_0xaf6743['where']=qs[_0x7e87('0x3f')](_[_0x7e87('0x63')](_0x2335f9[_0x7e87('0x3d')],_0x7344c2[_0x7e87('0x3f')]));if(_0x2335f9[_0x7e87('0x3d')][_0x7e87('0x4a')]){_0xaf6743[_0x7e87('0x49')]=_['merge'](_0xaf6743[_0x7e87('0x49')],{'$or':_['map'](_0xaf6743['attributes'],function(_0x423ee7){var _0x12dbff={};_0x12dbff[_0x423ee7]={'$like':'%'+_0x2335f9['query'][_0x7e87('0x4a')]+'%'};return _0x12dbff;})});}_0xaf6743=_['merge']({},_0xaf6743,_0x2335f9[_0x7e87('0x53')]);return _0x5258c0[_0x7e87('0x6c')](_0xaf6743);}})['then'](function(_0x3e1fc7){if(_0x3e1fc7){_0x249b51=_0x3e1fc7['length'];if(!_0x2335f9[_0x7e87('0x3d')]['hasOwnProperty'](_0x7e87('0x46'))){_0xaf6743[_0x7e87('0x22')]=qs['limit'](_0x2335f9[_0x7e87('0x3d')][_0x7e87('0x22')]);_0xaf6743[_0x7e87('0x1f')]=qs['offset'](_0x2335f9[_0x7e87('0x3d')]['offset']);}return _0x5258c0['getLists'](_0xaf6743);}})[_0x7e87('0x28')](function(_0x5c0ee7){if(_0x5c0ee7){return _0x5c0ee7?{'count':_0x249b51,'rows':_0x5c0ee7}:null;}})[_0x7e87('0x28')](respondWithResult(_0x11b7f0,null))[_0x7e87('0x4f')](handleError(_0x11b7f0,null));};exports[_0x7e87('0x6e')]=function(_0x1abb25,_0x574db,_0x544761){var _0x7a6217,_0x210825;return db['Campaign'][_0x7e87('0x59')]({'where':{'id':_0x1abb25[_0x7e87('0x51')]['id']}})['then'](handleEntityNotFound(_0x574db,null))[_0x7e87('0x28')](function(_0x1ca45e){if(_0x1ca45e){_0x210825=_0x1ca45e;return _0x1ca45e['addLists'](_0x1abb25[_0x7e87('0x33')][_0x7e87('0x6f')],_[_0x7e87('0x5d')](_0x1abb25[_0x7e87('0x33')],[_0x7e87('0x6f'),'id'])||{});}return null;})[_0x7e87('0x70')](function(_0x1f8bcc){var _0x15d96b;_0x7a6217=_0x1f8bcc||[];var _0x4c8267=[];if(_0x1f8bcc){for(var _0x55cb54=0x0;_0x55cb54<_0x1f8bcc[_0x7e87('0x44')];_0x55cb54+=0x1){var _0x1ac0af=_0x1f8bcc[_0x55cb54][_0x7e87('0x2a')]({'plain':!![]});_0x210825[_0x7e87('0x71')]=_0x1abb25['body'][_0x7e87('0x71')]?_0x1abb25[_0x7e87('0x33')][_0x7e87('0x71')]:_0x210825[_0x7e87('0x71')];switch(_0x210825[_0x7e87('0x71')]){case'always':_0x15d96b=squel[_0x7e87('0x72')]()['into'](_0x7e87('0x73'))[_0x7e87('0x74')]([_0x7e87('0x75'),'scheduledAt',_0x7e87('0x76'),_0x7e87('0x77'),_0x7e87('0x64'),_0x7e87('0x5f'),_0x7e87('0x5e')],squel[_0x7e87('0x78')]()[_0x7e87('0x79')](_0x7e87('0x75'),_0x7e87('0x75'))['field'](_0x7e87('0x7a'),_0x7e87('0x7b'))[_0x7e87('0x79')]('id','ContactId')[_0x7e87('0x79')](_0x1ac0af[_0x7e87('0x7c')][_0x7e87('0x7d')](),_0x7e87('0x77'))['field'](_0x1abb25[_0x7e87('0x51')]['id'][_0x7e87('0x7d')](),_0x7e87('0x64'))[_0x7e87('0x79')]('NOW()','createdAt')['field'](_0x7e87('0x7a'),_0x7e87('0x5e'))[_0x7e87('0x7e')](_0x7e87('0x7f'))['where'](_0x7e87('0x80'))[_0x7e87('0x49')](_0x7e87('0x81'),_0x1ac0af['CmListId'][_0x7e87('0x7d')]())[_0x7e87('0x49')](_0x7e87('0x82'))[_0x7e87('0x49')](_0x7e87('0x83'),squel[_0x7e87('0x78')]()['field'](_0x7e87('0x84'))['from'](_0x7e87('0x85'))[_0x7e87('0x49')]('CampaignId\x20=\x20?',_0x1abb25[_0x7e87('0x51')]['id'][_0x7e87('0x7d')]()))[_0x7e87('0x49')](_0x7e87('0x83'),squel['select']()[_0x7e87('0x79')](_0x7e87('0x86'))[_0x7e87('0x7e')](_0x7e87('0x73'))[_0x7e87('0x49')](_0x7e87('0x87'),_0x1abb25[_0x7e87('0x51')]['id']['toString']())))[_0x7e87('0x7d')]();break;case'onlyIfOpen':_0x15d96b=squel[_0x7e87('0x72')]()[_0x7e87('0x88')](_0x7e87('0x73'))['fromQuery'](['phone',_0x7e87('0x7b'),_0x7e87('0x76'),_0x7e87('0x77'),_0x7e87('0x64'),_0x7e87('0x5f'),'updatedAt'],squel['select']()[_0x7e87('0x79')](_0x7e87('0x75'),_0x7e87('0x75'))['field'](_0x7e87('0x7a'),_0x7e87('0x7b'))['field']('id',_0x7e87('0x76'))[_0x7e87('0x79')](_0x1ac0af[_0x7e87('0x7c')][_0x7e87('0x7d')](),_0x7e87('0x77'))[_0x7e87('0x79')](_0x1abb25[_0x7e87('0x51')]['id']['toString'](),_0x7e87('0x64'))['field'](_0x7e87('0x7a'),_0x7e87('0x5f'))[_0x7e87('0x79')](_0x7e87('0x7a'),'updatedAt')[_0x7e87('0x7e')](_0x7e87('0x7f'))[_0x7e87('0x49')](_0x7e87('0x80'))[_0x7e87('0x49')](_0x7e87('0x81'),_0x1ac0af[_0x7e87('0x7c')]['toString']())[_0x7e87('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0x7e87('0x49')](_0x7e87('0x83'),squel[_0x7e87('0x78')]()[_0x7e87('0x79')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x7e87('0x87'),_0x1abb25[_0x7e87('0x51')]['id'][_0x7e87('0x7d')]())))[_0x7e87('0x7d')]();break;default:_0x15d96b=squel['insert']()[_0x7e87('0x88')](_0x7e87('0x73'))[_0x7e87('0x74')]([_0x7e87('0x75'),'scheduledAt','ContactId',_0x7e87('0x77'),_0x7e87('0x64'),_0x7e87('0x5f'),_0x7e87('0x5e')],squel['select']()[_0x7e87('0x79')]('phone',_0x7e87('0x75'))[_0x7e87('0x79')](_0x7e87('0x7a'),_0x7e87('0x7b'))[_0x7e87('0x79')]('id',_0x7e87('0x76'))[_0x7e87('0x79')](_0x1ac0af['CmListId'][_0x7e87('0x7d')](),_0x7e87('0x77'))['field'](_0x1abb25[_0x7e87('0x51')]['id'][_0x7e87('0x7d')](),_0x7e87('0x64'))['field'](_0x7e87('0x7a'),_0x7e87('0x5f'))['field']('NOW()','updatedAt')[_0x7e87('0x7e')](_0x7e87('0x7f'))[_0x7e87('0x49')](_0x7e87('0x80'))[_0x7e87('0x49')]('ListId\x20=\x20?',_0x1ac0af[_0x7e87('0x7c')]['toString']())[_0x7e87('0x49')](_0x7e87('0x82')))['toString']();}_0x4c8267['push'](db[_0x7e87('0x89')][_0x7e87('0x3d')](_0x15d96b));}return BPromise[_0x7e87('0x8a')](_0x4c8267);}})['then'](function(){return _0x7a6217;})['then'](respondWithResult(_0x574db,null))[_0x7e87('0x4f')](handleError(_0x574db,null));};exports['removeLists']=function(_0x31e8ca,_0x32d789,_0x79f979){return db[_0x7e87('0x39')][_0x7e87('0x59')]({'where':{'id':_0x31e8ca[_0x7e87('0x51')]['id']}})[_0x7e87('0x28')](handleEntityNotFound(_0x32d789,null))[_0x7e87('0x28')](function(_0x242697){if(_0x242697){return _0x242697[_0x7e87('0x8b')](_0x31e8ca[_0x7e87('0x3d')][_0x7e87('0x6f')]);}})[_0x7e87('0x28')](function(_0xda40b3){if(_0xda40b3){return db['CmHopper'][_0x7e87('0x29')]({'where':{'ListId':_0x31e8ca[_0x7e87('0x3d')][_0x7e87('0x6f')],'CampaignId':_0x31e8ca['params']['id']}})[_0x7e87('0x28')](function(){return _0xda40b3;});}})[_0x7e87('0x28')](respondWithStatusCode(_0x32d789,null))[_0x7e87('0x4f')](handleError(_0x32d789,null));};exports['getBlackLists']=function(_0x195fdc,_0x456d90,_0x1a3a02){var _0x17756d={};var _0x411620={};var _0x4f1c1;var _0x4d850c;return db[_0x7e87('0x39')][_0x7e87('0x61')]({'where':{'id':_0x195fdc[_0x7e87('0x51')]['id']}})['then'](handleEntityNotFound(_0x456d90,null))[_0x7e87('0x28')](function(_0x14b49a){if(_0x14b49a){_0x4f1c1=_0x14b49a;_0x411620[_0x7e87('0x41')]=_[_0x7e87('0x3e')](db[_0x7e87('0x6d')][_0x7e87('0x3a')]);_0x411620['query']=_[_0x7e87('0x3e')](_0x195fdc[_0x7e87('0x3d')]);_0x411620[_0x7e87('0x3f')]=_[_0x7e87('0x40')](_0x411620[_0x7e87('0x41')],_0x411620['query']);_0x17756d[_0x7e87('0x42')]=_[_0x7e87('0x40')](_0x411620[_0x7e87('0x41')],qs[_0x7e87('0x43')](_0x195fdc[_0x7e87('0x3d')][_0x7e87('0x43')]));_0x17756d[_0x7e87('0x42')]=_0x17756d['attributes']['length']?_0x17756d[_0x7e87('0x42')]:_0x411620[_0x7e87('0x41')];_0x17756d[_0x7e87('0x47')]=qs[_0x7e87('0x48')](_0x195fdc[_0x7e87('0x3d')][_0x7e87('0x48')]);_0x17756d[_0x7e87('0x49')]=qs[_0x7e87('0x3f')](_[_0x7e87('0x63')](_0x195fdc[_0x7e87('0x3d')],_0x411620[_0x7e87('0x3f')]));if(_0x195fdc[_0x7e87('0x3d')][_0x7e87('0x4a')]){_0x17756d[_0x7e87('0x49')]=_['merge'](_0x17756d[_0x7e87('0x49')],{'$or':_[_0x7e87('0x38')](_0x17756d['attributes'],function(_0xf4774b){var _0x43d97b={};_0x43d97b[_0xf4774b]={'$like':'%'+_0x195fdc['query'][_0x7e87('0x4a')]+'%'};return _0x43d97b;})});}_0x17756d=_[_0x7e87('0x32')]({},_0x17756d,_0x195fdc[_0x7e87('0x53')]);return _0x4f1c1[_0x7e87('0x8c')](_0x17756d);}})[_0x7e87('0x28')](function(_0x1763dc){if(_0x1763dc){_0x4d850c=_0x1763dc[_0x7e87('0x44')];if(!_0x195fdc[_0x7e87('0x3d')][_0x7e87('0x45')](_0x7e87('0x46'))){_0x17756d[_0x7e87('0x22')]=qs[_0x7e87('0x22')](_0x195fdc[_0x7e87('0x3d')][_0x7e87('0x22')]);_0x17756d[_0x7e87('0x1f')]=qs[_0x7e87('0x1f')](_0x195fdc[_0x7e87('0x3d')]['offset']);}return _0x4f1c1[_0x7e87('0x8c')](_0x17756d);}})[_0x7e87('0x28')](function(_0x1c9a1d){if(_0x1c9a1d){return _0x1c9a1d?{'count':_0x4d850c,'rows':_0x1c9a1d}:null;}})[_0x7e87('0x28')](respondWithResult(_0x456d90,null))[_0x7e87('0x4f')](handleError(_0x456d90,null));};exports[_0x7e87('0x8d')]=function(_0x4ab7e6,_0x463fd5,_0x2eaa6c){var _0x1d0dfc,_0x16683e;return db[_0x7e87('0x39')][_0x7e87('0x59')]({'where':{'id':_0x4ab7e6[_0x7e87('0x51')]['id']}})['then'](handleEntityNotFound(_0x463fd5,null))[_0x7e87('0x28')](function(_0x11f323){if(_0x11f323){_0x16683e=_0x11f323;return _0x11f323[_0x7e87('0x8d')](_0x4ab7e6[_0x7e87('0x33')][_0x7e87('0x6f')],_[_0x7e87('0x5d')](_0x4ab7e6[_0x7e87('0x33')],[_0x7e87('0x6f'),'id'])||{});}return null;})[_0x7e87('0x70')](function(_0x5b0935){var _0xdecdfe;_0x1d0dfc=_0x5b0935||[];var _0xb0d2eb=[];if(_0x5b0935){for(var _0x2215e1=0x0;_0x2215e1<_0x5b0935[_0x7e87('0x44')];_0x2215e1+=0x1){var _0x5340df=_0x5b0935[_0x2215e1][_0x7e87('0x2a')]({'plain':!![]});_0xdecdfe=squel[_0x7e87('0x72')]()[_0x7e87('0x88')]('cm_hopper_black')[_0x7e87('0x74')]([_0x7e87('0x75'),_0x7e87('0x76'),_0x7e87('0x77'),'CampaignId',_0x7e87('0x5f'),_0x7e87('0x5e')],squel[_0x7e87('0x78')]()[_0x7e87('0x79')]('phone',_0x7e87('0x75'))['field']('id',_0x7e87('0x76'))[_0x7e87('0x79')](_0x5340df[_0x7e87('0x7c')]['toString'](),_0x7e87('0x77'))[_0x7e87('0x79')](_0x4ab7e6[_0x7e87('0x51')]['id'][_0x7e87('0x7d')](),'CampaignId')['field'](_0x7e87('0x7a'),_0x7e87('0x5f'))[_0x7e87('0x79')](_0x7e87('0x7a'),'updatedAt')[_0x7e87('0x7e')](_0x7e87('0x7f'))[_0x7e87('0x49')]('deletedAt\x20IS\x20NULL')['where'](_0x7e87('0x81'),_0x5340df[_0x7e87('0x7c')][_0x7e87('0x7d')]())[_0x7e87('0x49')](_0x7e87('0x82')))[_0x7e87('0x7d')]();_0xb0d2eb[_0x7e87('0x8e')](db[_0x7e87('0x89')][_0x7e87('0x3d')](_0xdecdfe));}return BPromise[_0x7e87('0x8a')](_0xb0d2eb);}})['then'](function(){return _0x1d0dfc;})['then'](respondWithResult(_0x463fd5,null))[_0x7e87('0x4f')](handleError(_0x463fd5,null));};exports[_0x7e87('0x8f')]=function(_0xf46e2d,_0x5aa55b,_0x391eb6){return db[_0x7e87('0x39')][_0x7e87('0x59')]({'where':{'id':_0xf46e2d[_0x7e87('0x51')]['id']}})[_0x7e87('0x28')](handleEntityNotFound(_0x5aa55b,null))[_0x7e87('0x28')](function(_0x226c84){if(_0x226c84){return _0x226c84['removeBlackLists'](_0xf46e2d[_0x7e87('0x3d')][_0x7e87('0x6f')]);}})['then'](function(_0xb85aa6){if(_0xb85aa6){return db['CmHopperBlack'][_0x7e87('0x29')]({'where':{'ListId':_0xf46e2d[_0x7e87('0x3d')][_0x7e87('0x6f')],'CampaignId':_0xf46e2d[_0x7e87('0x51')]['id']}})[_0x7e87('0x28')](function(){return _0xb85aa6;});}})[_0x7e87('0x28')](respondWithStatusCode(_0x5aa55b,null))['catch'](handleError(_0x5aa55b,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b3d49c0..63a07bd 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x125e=['Campaign','campaigns','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes','define'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x125e,0xc2));var _0xe125=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0x125e[_0x455150];return _0x12ca9c;};'use strict';var _=require(_0xe125('0x0'));var util=require(_0xe125('0x1'));var logger=require('../../config/logger')(_0xe125('0x2'));var moment=require(_0xe125('0x3'));var BPromise=require(_0xe125('0x4'));var rp=require(_0xe125('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe125('0x6'));var config=require(_0xe125('0x7'));var attributes=require(_0xe125('0x8'));module['exports']=function(_0x4bfcd3,_0x3d04e8){return _0x4bfcd3[_0xe125('0x9')](_0xe125('0xa'),attributes,{'tableName':_0xe125('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x939e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x224c50,_0x9bb251){var _0x42f51a=function(_0x413df1){while(--_0x413df1){_0x224c50['push'](_0x224c50['shift']());}};_0x42f51a(++_0x9bb251);}(_0x939e,0x9a));var _0xe939=function(_0x46390e,_0x39d20f){_0x46390e=_0x46390e-0x0;var _0x4db91c=_0x939e[_0x46390e];return _0x4db91c;};'use strict';var _=require(_0xe939('0x0'));var util=require(_0xe939('0x1'));var logger=require(_0xe939('0x2'))(_0xe939('0x3'));var moment=require(_0xe939('0x4'));var BPromise=require(_0xe939('0x5'));var rp=require(_0xe939('0x6'));var fs=require('fs');var path=require(_0xe939('0x7'));var rimraf=require(_0xe939('0x8'));var config=require(_0xe939('0x9'));var attributes=require('./campaign.attributes');module[_0xe939('0xa')]=function(_0x4b8682,_0x234deb){return _0x4b8682[_0xe939('0xb')]('Campaign',attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index c9e3442..1088311 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c63ef,_0x1dc339){var _0x16ade7=function(_0xf5bc43){while(--_0xf5bc43){_0x1c63ef['push'](_0x1c63ef['shift']());}};_0x16ade7(++_0x1dc339);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x6e7a0c,_0x12c79c){var _0x33b732=function(_0xecaeee){while(--_0xecaeee){_0x6e7a0c['push'](_0x6e7a0c['shift']());}};_0x33b732(++_0x12c79c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b6b61a2..1b6a89d 100644 --- a/server/api/campaign/index.js +++ b/server/api/campaign/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4be7=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','getBlackLists','post','/:id/clone','clone','/:id/blacklists','addBlackLists','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x4be7,0xc6));var _0x74be=function(_0x49693f,_0x4d994f){_0x49693f=_0x49693f-0x0;var _0x1b0f6e=_0x4be7[_0x49693f];return _0x1b0f6e;};'use strict';var multer=require(_0x74be('0x0'));var util=require(_0x74be('0x1'));var path=require(_0x74be('0x2'));var timeout=require(_0x74be('0x3'));var express=require(_0x74be('0x4'));var router=express['Router']();var fs_extra=require(_0x74be('0x5'));var auth=require(_0x74be('0x6'));var interaction=require(_0x74be('0x7'));var config=require(_0x74be('0x8'));var controller=require(_0x74be('0x9'));router[_0x74be('0xa')]('/',auth[_0x74be('0xb')](),controller['index']);router[_0x74be('0xa')](_0x74be('0xc'),auth[_0x74be('0xb')](),controller['show']);router[_0x74be('0xa')](_0x74be('0xd'),auth[_0x74be('0xb')](),controller['getHoppers']);router[_0x74be('0xa')](_0x74be('0xe'),auth[_0x74be('0xb')](),controller[_0x74be('0xf')]);router[_0x74be('0xa')](_0x74be('0x10'),auth[_0x74be('0xb')](),controller['getHopperFinals']);router[_0x74be('0xa')](_0x74be('0x11'),auth[_0x74be('0xb')](),controller[_0x74be('0x12')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x74be('0x13')]);router[_0x74be('0xa')]('/:id/blacklists',auth[_0x74be('0xb')](),controller[_0x74be('0x14')]);router[_0x74be('0x15')]('/',auth[_0x74be('0xb')](),controller['create']);router['post'](_0x74be('0x16'),auth[_0x74be('0xb')](),controller[_0x74be('0x17')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0x74be('0x15')](_0x74be('0x18'),auth['isAuthenticated'](),controller[_0x74be('0x19')]);router['put'](_0x74be('0xc'),auth[_0x74be('0xb')](),controller[_0x74be('0x1a')]);router[_0x74be('0x1b')](_0x74be('0xc'),auth[_0x74be('0xb')](),controller[_0x74be('0x1c')]);router[_0x74be('0x1b')](_0x74be('0x1d'),auth[_0x74be('0xb')](),controller[_0x74be('0x1e')]);router[_0x74be('0x1b')](_0x74be('0x18'),auth['isAuthenticated'](),controller[_0x74be('0x1f')]);module[_0x74be('0x20')]=router; \ No newline at end of file +var _0x7cee=['isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','put','update','delete','destroy','removeLists','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get'];(function(_0x3510ea,_0x20e9e0){var _0x1450ef=function(_0x14ec9f){while(--_0x14ec9f){_0x3510ea['push'](_0x3510ea['shift']());}};_0x1450ef(++_0x20e9e0);}(_0x7cee,0xf8));var _0xe7ce=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x7cee[_0x27d958];return _0x53e63e;};'use strict';var multer=require('multer');var util=require(_0xe7ce('0x0'));var path=require('path');var timeout=require(_0xe7ce('0x1'));var express=require('express');var router=express[_0xe7ce('0x2')]();var fs_extra=require(_0xe7ce('0x3'));var auth=require(_0xe7ce('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe7ce('0x5'));var controller=require(_0xe7ce('0x6'));router[_0xe7ce('0x7')]('/',auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x9')]);router[_0xe7ce('0x7')](_0xe7ce('0xa'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0xb')]);router[_0xe7ce('0x7')](_0xe7ce('0xc'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0xd')]);router[_0xe7ce('0x7')](_0xe7ce('0xe'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0xf')]);router[_0xe7ce('0x7')](_0xe7ce('0x10'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x11')]);router['get']('/:id/hopper_black',auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x12')]);router[_0xe7ce('0x7')](_0xe7ce('0x13'),auth[_0xe7ce('0x8')](),controller['getLists']);router[_0xe7ce('0x7')](_0xe7ce('0x14'),auth['isAuthenticated'](),controller[_0xe7ce('0x15')]);router['post']('/',auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x16')]);router[_0xe7ce('0x17')](_0xe7ce('0x18'),auth['isAuthenticated'](),controller[_0xe7ce('0x19')]);router[_0xe7ce('0x17')](_0xe7ce('0x13'),auth[_0xe7ce('0x8')](),controller['addLists']);router[_0xe7ce('0x17')](_0xe7ce('0x14'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xe7ce('0x1a')](_0xe7ce('0xa'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x1b')]);router[_0xe7ce('0x1c')](_0xe7ce('0xa'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x1d')]);router['delete'](_0xe7ce('0x13'),auth[_0xe7ce('0x8')](),controller[_0xe7ce('0x1e')]);router['delete'](_0xe7ce('0x14'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xe7ce('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 803ec93..8b1e0e4 100644 --- a/server/api/cannedAnswer/cannedAnswer.attributes.js +++ b/server/api/cannedAnswer/cannedAnswer.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7d7=['STRING','key','exports'];(function(_0x1f2d53,_0xb09b8c){var _0xdbedb9=function(_0x1e2041){while(--_0x1e2041){_0x1f2d53['push'](_0x1f2d53['shift']());}};_0xdbedb9(++_0xb09b8c);}(_0xb7d7,0xdd));var _0x7b7d=function(_0x9e0867,_0x2df073){_0x9e0867=_0x9e0867-0x0;var _0x31d1d2=_0xb7d7[_0x9e0867];return _0x31d1d2;};'use strict';var Sequelize=require('sequelize');module[_0x7b7d('0x0')]={'key':{'type':Sequelize[_0x7b7d('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x7b7d('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x7b7d('0x2'));}}}; \ No newline at end of file +var _0xc0bd=['key','sequelize','exports','STRING','TEXT','getDataValue'];(function(_0xa3c16f,_0x5196d8){var _0x47c70e=function(_0x5b4592){while(--_0x5b4592){_0xa3c16f['push'](_0xa3c16f['shift']());}};_0x47c70e(++_0x5196d8);}(_0xc0bd,0x187));var _0xdc0b=function(_0x3457ad,_0x254440){_0x3457ad=_0x3457ad-0x0;var _0x22d1ac=_0xc0bd[_0x3457ad];return _0x22d1ac;};'use strict';var Sequelize=require(_0xdc0b('0x0'));module[_0xdc0b('0x1')]={'key':{'type':Sequelize[_0xdc0b('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xdc0b('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xdc0b('0x4')](_0xdc0b('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ff2e6a3..f19355a 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c91=['send','render','merge','contact','message','agent','interaction','account','map','CannedAnswer','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','catch','params','intersection','length','options','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name'];(function(_0x5c5371,_0x3ac3ed){var _0x443bd2=function(_0x36c999){while(--_0x36c999){_0x5c5371['push'](_0x5c5371['shift']());}};_0x443bd2(++_0x3ac3ed);}(_0x2c91,0x158));var _0x12c9=function(_0x8fb908,_0x34e41c){_0x8fb908=_0x8fb908-0x0;var _0x312509=_0x2c91[_0x8fb908];return _0x312509;};'use strict';var emlformat=require(_0x12c9('0x0'));var rimraf=require(_0x12c9('0x1'));var zipdir=require(_0x12c9('0x2'));var jsonpatch=require(_0x12c9('0x3'));var rp=require(_0x12c9('0x4'));var moment=require(_0x12c9('0x5'));var BPromise=require(_0x12c9('0x6'));var Mustache=require(_0x12c9('0x7'));var util=require('util');var path=require(_0x12c9('0x8'));var sox=require(_0x12c9('0x9'));var csv=require(_0x12c9('0xa'));var ejs=require(_0x12c9('0xb'));var fs=require('fs');var fs_extra=require(_0x12c9('0xc'));var _=require(_0x12c9('0xd'));var squel=require(_0x12c9('0xe'));var crypto=require('crypto');var jsforce=require(_0x12c9('0xf'));var deskjs=require(_0x12c9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x12c9('0x11'));var Papa=require(_0x12c9('0x12'));var Redis=require('ioredis');var authService=require(_0x12c9('0x13'));var qs=require(_0x12c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12c9('0x15'));var logger=require(_0x12c9('0x16'))('api');var utils=require(_0x12c9('0x17'));var config=require(_0x12c9('0x18'));var licenseUtil=require(_0x12c9('0x19'));var db=require(_0x12c9('0x1a'))['db'];function respondWithStatusCode(_0x278da5,_0x2b239d){_0x2b239d=_0x2b239d||0xcc;return function(_0x5629b7){if(_0x5629b7){return _0x278da5[_0x12c9('0x1b')](_0x2b239d);}return _0x278da5[_0x12c9('0x1c')](_0x2b239d)[_0x12c9('0x1d')]();};}function respondWithResult(_0x4d0388,_0x4bf1a9){_0x4bf1a9=_0x4bf1a9||0xc8;return function(_0x490854){if(_0x490854){return _0x4d0388['status'](_0x4bf1a9)['json'](_0x490854);}};}function respondWithFilteredResult(_0x9fa35,_0x4e4cbf){return function(_0x3a83b4){if(_0x3a83b4){var _0x4460d5=typeof _0x4e4cbf[_0x12c9('0x1e')]===_0x12c9('0x1f')&&typeof _0x4e4cbf[_0x12c9('0x20')]==='undefined';var _0x2f704c=_0x3a83b4[_0x12c9('0x21')];var _0x1890d4=_0x4460d5?0x0:_0x4e4cbf[_0x12c9('0x1e')];var _0x44e9af=_0x4460d5?_0x3a83b4[_0x12c9('0x21')]:_0x4e4cbf[_0x12c9('0x1e')]+_0x4e4cbf[_0x12c9('0x20')];var _0x59b225;if(_0x44e9af>=_0x2f704c){_0x44e9af=_0x2f704c;_0x59b225=0xc8;}else{_0x59b225=0xce;}_0x9fa35[_0x12c9('0x1c')](_0x59b225);return _0x9fa35['set'](_0x12c9('0x22'),_0x1890d4+'-'+_0x44e9af+'/'+_0x2f704c)[_0x12c9('0x23')](_0x3a83b4);}return null;};}function patchUpdates(_0xd036ef){return function(_0x17675e){try{jsonpatch[_0x12c9('0x24')](_0x17675e,_0xd036ef,!![]);}catch(_0x4e767a){return BPromise[_0x12c9('0x25')](_0x4e767a);}return _0x17675e[_0x12c9('0x26')]();};}function saveUpdates(_0x2a324f,_0x36d400){return function(_0x370126){if(_0x370126){return _0x370126[_0x12c9('0x27')](_0x2a324f)[_0x12c9('0x28')](function(_0x1d7942){return _0x1d7942;});}return null;};}function removeEntity(_0x210a77,_0x2eecec){return function(_0x905751){if(_0x905751){return _0x905751['destroy']()[_0x12c9('0x28')](function(){var _0x1599a8=_0x905751[_0x12c9('0x29')]({'plain':!![]});var _0x1aa6a8=_0x12c9('0x2a');return db[_0x12c9('0x2b')][_0x12c9('0x2c')]({'where':{'type':_0x1aa6a8,'resourceId':_0x1599a8['id']}})[_0x12c9('0x28')](function(){return _0x905751;});})[_0x12c9('0x28')](function(){_0x210a77[_0x12c9('0x1c')](0xcc)[_0x12c9('0x1d')]();});}};}function handleEntityNotFound(_0x340f24,_0x447dec){return function(_0x2224ce){if(!_0x2224ce){_0x340f24[_0x12c9('0x1b')](0x194);}return _0x2224ce;};}function handleError(_0x4141db,_0x248bff){_0x248bff=_0x248bff||0x1f4;return function(_0xa53d40){logger[_0x12c9('0x2d')](_0xa53d40[_0x12c9('0x2e')]);if(_0xa53d40['name']){delete _0xa53d40[_0x12c9('0x2f')];}_0x4141db[_0x12c9('0x1c')](_0x248bff)[_0x12c9('0x30')](_0xa53d40);};}function getMustacheRender(_0x284224,_0x6ddf60){return Mustache[_0x12c9('0x31')](_0x284224,_[_0x12c9('0x32')](_0x6ddf60['body'],{'contact':_0x6ddf60[_0x12c9('0x33')],'message':_0x6ddf60[_0x12c9('0x34')],'agent':_0x6ddf60[_0x12c9('0x35')],'interaction':_0x6ddf60[_0x12c9('0x36')],'account':_0x6ddf60[_0x12c9('0x37')]}))||'';}exports['index']=function(_0x238239,_0x5aaf33){var _0x147d0c={},_0x1604b8={},_0x1763fd={'count':0x0,'rows':[]};var _0xadd087=_[_0x12c9('0x38')](db[_0x12c9('0x39')][_0x12c9('0x3a')],function(_0x2fdd28){return{'name':_0x2fdd28[_0x12c9('0x3b')],'type':_0x2fdd28['type']['key']};});_0x1604b8[_0x12c9('0x3c')]=_[_0x12c9('0x38')](_0xadd087,_0x12c9('0x2f'));_0x1604b8[_0x12c9('0x3d')]=_[_0x12c9('0x3e')](_0x238239[_0x12c9('0x3d')]);_0x1604b8[_0x12c9('0x3f')]=_['intersection'](_0x1604b8[_0x12c9('0x3c')],_0x1604b8[_0x12c9('0x3d')]);_0x147d0c[_0x12c9('0x40')]=_['intersection'](_0x1604b8[_0x12c9('0x3c')],qs[_0x12c9('0x41')](_0x238239['query'][_0x12c9('0x41')]));_0x147d0c[_0x12c9('0x40')]=_0x147d0c[_0x12c9('0x40')]['length']?_0x147d0c[_0x12c9('0x40')]:_0x1604b8[_0x12c9('0x3c')];if(!_0x238239[_0x12c9('0x3d')][_0x12c9('0x42')](_0x12c9('0x43'))){_0x147d0c[_0x12c9('0x20')]=qs[_0x12c9('0x20')](_0x238239[_0x12c9('0x3d')][_0x12c9('0x20')]);_0x147d0c[_0x12c9('0x1e')]=qs['offset'](_0x238239[_0x12c9('0x3d')][_0x12c9('0x1e')]);}_0x147d0c[_0x12c9('0x44')]=qs[_0x12c9('0x45')](_0x238239[_0x12c9('0x3d')]['sort']);_0x147d0c[_0x12c9('0x46')]=qs['filters'](_[_0x12c9('0x47')](_0x238239[_0x12c9('0x3d')],_0x1604b8[_0x12c9('0x3f')]),_0xadd087);if(_0x238239['query']['filter']){_0x147d0c[_0x12c9('0x46')]=_[_0x12c9('0x32')](_0x147d0c[_0x12c9('0x46')],{'$or':[{'key':{'$like':'%'+_0x238239[_0x12c9('0x3d')][_0x12c9('0x48')]+'%'}},{'value':{'$like':'%'+_0x238239['query'][_0x12c9('0x48')]+'%'}}]});}_0x147d0c=_[_0x12c9('0x32')]({},_0x147d0c,_0x238239['options']);var _0x18b73a={'where':_0x147d0c[_0x12c9('0x46')]};return db[_0x12c9('0x39')]['count'](_0x18b73a)[_0x12c9('0x28')](function(_0x179972){_0x1763fd['count']=_0x179972;if(_0x238239[_0x12c9('0x3d')][_0x12c9('0x49')]){_0x147d0c[_0x12c9('0x4a')]=[{'all':!![]}];}return db[_0x12c9('0x39')][_0x12c9('0x4b')](_0x147d0c);})[_0x12c9('0x28')](function(_0x11cbe8){_0x1763fd['rows']=_0x11cbe8;return _0x1763fd;})[_0x12c9('0x28')](respondWithFilteredResult(_0x5aaf33,_0x147d0c))[_0x12c9('0x4c')](handleError(_0x5aaf33,null));};exports['show']=function(_0xdc0408,_0x1c450c){var _0x171e41={'raw':!![],'where':{'id':_0xdc0408[_0x12c9('0x4d')]['id']}},_0x21a3fa={};_0x21a3fa[_0x12c9('0x3c')]=_[_0x12c9('0x3e')](db['CannedAnswer'][_0x12c9('0x3a')]);_0x21a3fa['query']=_[_0x12c9('0x3e')](_0xdc0408['query']);_0x21a3fa['filters']=_[_0x12c9('0x4e')](_0x21a3fa[_0x12c9('0x3c')],_0x21a3fa['query']);_0x171e41[_0x12c9('0x40')]=_[_0x12c9('0x4e')](_0x21a3fa[_0x12c9('0x3c')],qs[_0x12c9('0x41')](_0xdc0408[_0x12c9('0x3d')][_0x12c9('0x41')]));_0x171e41[_0x12c9('0x40')]=_0x171e41['attributes'][_0x12c9('0x4f')]?_0x171e41[_0x12c9('0x40')]:_0x21a3fa[_0x12c9('0x3c')];if(_0xdc0408[_0x12c9('0x3d')]['includeAll']){_0x171e41[_0x12c9('0x4a')]=[{'all':!![]}];}_0x171e41=_['merge']({},_0x171e41,_0xdc0408[_0x12c9('0x50')]);return db[_0x12c9('0x39')][_0x12c9('0x51')](_0x171e41)[_0x12c9('0x28')](handleEntityNotFound(_0x1c450c,null))['then'](respondWithResult(_0x1c450c,null))[_0x12c9('0x4c')](handleError(_0x1c450c,null));};exports[_0x12c9('0x27')]=function(_0x39b578,_0x58d2ff){if(_0x39b578[_0x12c9('0x52')]['id']){delete _0x39b578['body']['id'];}return db[_0x12c9('0x39')][_0x12c9('0x51')]({'where':{'id':_0x39b578['params']['id']}})['then'](handleEntityNotFound(_0x58d2ff,null))['then'](saveUpdates(_0x39b578[_0x12c9('0x52')],null))[_0x12c9('0x28')](respondWithResult(_0x58d2ff,null))[_0x12c9('0x4c')](handleError(_0x58d2ff,null));};exports['destroy']=function(_0x4babe8,_0x9db27b){return db[_0x12c9('0x39')]['find']({'where':{'id':_0x4babe8[_0x12c9('0x4d')]['id']}})[_0x12c9('0x28')](handleEntityNotFound(_0x9db27b,null))[_0x12c9('0x28')](removeEntity(_0x9db27b,null))[_0x12c9('0x4c')](handleError(_0x9db27b,null));};exports[_0x12c9('0x53')]=function(_0x19f865,_0x2750c9){var _0x434ab3={'key':_0x19f865['body'][_0x12c9('0x54')]};if(_0x19f865[_0x12c9('0x52')][_0x12c9('0x55')]){_0x434ab3[_0x12c9('0x55')]=_0x19f865[_0x12c9('0x52')]['MailAccountId'];}else if(_0x19f865['body'][_0x12c9('0x56')]){_0x434ab3['SmsAccountId']=_0x19f865['body'][_0x12c9('0x56')];}else if(_0x19f865[_0x12c9('0x52')]['OpenchannelAccountId']){_0x434ab3[_0x12c9('0x57')]=_0x19f865[_0x12c9('0x52')][_0x12c9('0x57')];}else if(_0x19f865[_0x12c9('0x52')][_0x12c9('0x58')]){_0x434ab3[_0x12c9('0x58')]=_0x19f865[_0x12c9('0x52')][_0x12c9('0x58')];}return db[_0x12c9('0x39')][_0x12c9('0x51')]({'where':_0x434ab3})[_0x12c9('0x28')](function(_0x461a06){if(_0x461a06){throw new db[(_0x12c9('0x59'))][(_0x12c9('0x5a'))](_0x12c9('0x5b'));}return db[_0x12c9('0x39')]['create'](_0x19f865[_0x12c9('0x52')]);})[_0x12c9('0x28')](function(_0x1aa875){var _0x5866f5=_0x19f865[_0x12c9('0x5c')][_0x12c9('0x29')]({'plain':!![]});if(!_0x5866f5)throw new Error(_0x12c9('0x5d'));if(_0x5866f5[_0x12c9('0x5e')]===_0x12c9('0x5c')){var _0x2e9637=_0x1aa875['get']({'plain':!![]});return db[_0x12c9('0x5f')]['find']({'where':{'name':_0x12c9('0x2a'),'userProfileId':_0x5866f5[_0x12c9('0x60')]},'raw':!![]})[_0x12c9('0x28')](function(_0x4493a5){if(_0x4493a5&&_0x4493a5['autoAssociation']===0x0){return db[_0x12c9('0x2b')][_0x12c9('0x53')]({'name':_0x2e9637[_0x12c9('0x2f')],'resourceId':_0x2e9637['id'],'type':_0x4493a5[_0x12c9('0x2f')],'sectionId':_0x4493a5['id']},{})['then'](function(){return _0x1aa875;});}else{return _0x1aa875;}})['catch'](function(_0x54ed8e){logger[_0x12c9('0x2d')](_0x12c9('0x61'),_0x54ed8e);throw _0x54ed8e;});}return _0x1aa875;})[_0x12c9('0x28')](respondWithResult(_0x2750c9,0xc9))[_0x12c9('0x4c')](handleError(_0x2750c9,null));}; \ No newline at end of file +var _0x49b9=['hasOwnProperty','order','sort','where','filter','merge','CannedAnswer','includeAll','include','findAll','catch','show','params','keys','options','find','create','MailAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','CannedAnswers','UserProfileResource','destroy','stack','name','send','render','body','message','agent','account','index','rawAttributes','key','model','query','filters','attributes','intersection','fields','length'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x49b9,0x1da));var _0x949b=function(_0x3a13ba,_0x1f5be5){_0x3a13ba=_0x3a13ba-0x0;var _0x1a4b54=_0x49b9[_0x3a13ba];return _0x1a4b54;};'use strict';var emlformat=require(_0x949b('0x0'));var rimraf=require(_0x949b('0x1'));var zipdir=require(_0x949b('0x2'));var jsonpatch=require(_0x949b('0x3'));var rp=require(_0x949b('0x4'));var moment=require(_0x949b('0x5'));var BPromise=require(_0x949b('0x6'));var Mustache=require('mustache');var util=require(_0x949b('0x7'));var path=require(_0x949b('0x8'));var sox=require(_0x949b('0x9'));var csv=require(_0x949b('0xa'));var ejs=require(_0x949b('0xb'));var fs=require('fs');var fs_extra=require(_0x949b('0xc'));var _=require(_0x949b('0xd'));var squel=require(_0x949b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x949b('0xf'));var toCsv=require(_0x949b('0xa'));var querystring=require(_0x949b('0x10'));var Papa=require('papaparse');var Redis=require(_0x949b('0x11'));var authService=require(_0x949b('0x12'));var qs=require(_0x949b('0x13'));var as=require(_0x949b('0x14'));var hardwareService=require(_0x949b('0x15'));var logger=require(_0x949b('0x16'))('api');var utils=require(_0x949b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x949b('0x18'));var db=require(_0x949b('0x19'))['db'];function respondWithStatusCode(_0x7462cd,_0x3a9071){_0x3a9071=_0x3a9071||0xcc;return function(_0x129f4e){if(_0x129f4e){return _0x7462cd[_0x949b('0x1a')](_0x3a9071);}return _0x7462cd[_0x949b('0x1b')](_0x3a9071)[_0x949b('0x1c')]();};}function respondWithResult(_0x5a4542,_0x397bd2){_0x397bd2=_0x397bd2||0xc8;return function(_0x447565){if(_0x447565){return _0x5a4542['status'](_0x397bd2)[_0x949b('0x1d')](_0x447565);}};}function respondWithFilteredResult(_0x32c9b8,_0x35e3a2){return function(_0x1726c5){if(_0x1726c5){var _0x36ef3c=typeof _0x35e3a2[_0x949b('0x1e')]==='undefined'&&typeof _0x35e3a2[_0x949b('0x1f')]==='undefined';var _0x2b3242=_0x1726c5[_0x949b('0x20')];var _0x277901=_0x36ef3c?0x0:_0x35e3a2[_0x949b('0x1e')];var _0x26fffb=_0x36ef3c?_0x1726c5['count']:_0x35e3a2['offset']+_0x35e3a2[_0x949b('0x1f')];var _0x357bba;if(_0x26fffb>=_0x2b3242){_0x26fffb=_0x2b3242;_0x357bba=0xc8;}else{_0x357bba=0xce;}_0x32c9b8[_0x949b('0x1b')](_0x357bba);return _0x32c9b8[_0x949b('0x21')](_0x949b('0x22'),_0x277901+'-'+_0x26fffb+'/'+_0x2b3242)['json'](_0x1726c5);}return null;};}function patchUpdates(_0x4f6ece){return function(_0x5b908f){try{jsonpatch[_0x949b('0x23')](_0x5b908f,_0x4f6ece,!![]);}catch(_0x194704){return BPromise['reject'](_0x194704);}return _0x5b908f[_0x949b('0x24')]();};}function saveUpdates(_0x1ed213,_0x1a8ed3){return function(_0x208dc3){if(_0x208dc3){return _0x208dc3[_0x949b('0x25')](_0x1ed213)['then'](function(_0x4abe7a){return _0x4abe7a;});}return null;};}function removeEntity(_0x4126d1,_0x2c2fdd){return function(_0x5840ce){if(_0x5840ce){return _0x5840ce['destroy']()[_0x949b('0x26')](function(){var _0x5362aa=_0x5840ce['get']({'plain':!![]});var _0x56bc14=_0x949b('0x27');return db[_0x949b('0x28')][_0x949b('0x29')]({'where':{'type':_0x56bc14,'resourceId':_0x5362aa['id']}})[_0x949b('0x26')](function(){return _0x5840ce;});})['then'](function(){_0x4126d1[_0x949b('0x1b')](0xcc)[_0x949b('0x1c')]();});}};}function handleEntityNotFound(_0x16b3b3,_0x5d2caf){return function(_0x5a0703){if(!_0x5a0703){_0x16b3b3['sendStatus'](0x194);}return _0x5a0703;};}function handleError(_0x38baf4,_0x45f952){_0x45f952=_0x45f952||0x1f4;return function(_0x530e40){logger['error'](_0x530e40[_0x949b('0x2a')]);if(_0x530e40[_0x949b('0x2b')]){delete _0x530e40[_0x949b('0x2b')];}_0x38baf4[_0x949b('0x1b')](_0x45f952)[_0x949b('0x2c')](_0x530e40);};}function getMustacheRender(_0xa31976,_0x487394){return Mustache[_0x949b('0x2d')](_0xa31976,_['merge'](_0x487394[_0x949b('0x2e')],{'contact':_0x487394['contact'],'message':_0x487394[_0x949b('0x2f')],'agent':_0x487394[_0x949b('0x30')],'interaction':_0x487394['interaction'],'account':_0x487394[_0x949b('0x31')]}))||'';}exports[_0x949b('0x32')]=function(_0x399016,_0xc49c74){var _0x63253f={},_0x467dd4={},_0x348262={'count':0x0,'rows':[]};var _0x4eb6da=_['map'](db['CannedAnswer'][_0x949b('0x33')],function(_0x538a2c){return{'name':_0x538a2c['fieldName'],'type':_0x538a2c['type'][_0x949b('0x34')]};});_0x467dd4[_0x949b('0x35')]=_['map'](_0x4eb6da,_0x949b('0x2b'));_0x467dd4[_0x949b('0x36')]=_['keys'](_0x399016[_0x949b('0x36')]);_0x467dd4[_0x949b('0x37')]=_['intersection'](_0x467dd4['model'],_0x467dd4[_0x949b('0x36')]);_0x63253f[_0x949b('0x38')]=_[_0x949b('0x39')](_0x467dd4['model'],qs[_0x949b('0x3a')](_0x399016['query'][_0x949b('0x3a')]));_0x63253f[_0x949b('0x38')]=_0x63253f['attributes'][_0x949b('0x3b')]?_0x63253f['attributes']:_0x467dd4['model'];if(!_0x399016[_0x949b('0x36')][_0x949b('0x3c')]('nolimit')){_0x63253f[_0x949b('0x1f')]=qs[_0x949b('0x1f')](_0x399016['query'][_0x949b('0x1f')]);_0x63253f[_0x949b('0x1e')]=qs[_0x949b('0x1e')](_0x399016[_0x949b('0x36')]['offset']);}_0x63253f[_0x949b('0x3d')]=qs[_0x949b('0x3e')](_0x399016[_0x949b('0x36')][_0x949b('0x3e')]);_0x63253f[_0x949b('0x3f')]=qs[_0x949b('0x37')](_['pick'](_0x399016[_0x949b('0x36')],_0x467dd4[_0x949b('0x37')]),_0x4eb6da);if(_0x399016[_0x949b('0x36')][_0x949b('0x40')]){_0x63253f[_0x949b('0x3f')]=_[_0x949b('0x41')](_0x63253f['where'],{'$or':[{'key':{'$like':'%'+_0x399016['query']['filter']+'%'}},{'value':{'$like':'%'+_0x399016[_0x949b('0x36')][_0x949b('0x40')]+'%'}}]});}_0x63253f=_[_0x949b('0x41')]({},_0x63253f,_0x399016['options']);var _0x43d73f={'where':_0x63253f['where']};return db[_0x949b('0x42')]['count'](_0x43d73f)[_0x949b('0x26')](function(_0x5cafff){_0x348262[_0x949b('0x20')]=_0x5cafff;if(_0x399016[_0x949b('0x36')][_0x949b('0x43')]){_0x63253f[_0x949b('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x949b('0x45')](_0x63253f);})[_0x949b('0x26')](function(_0x1ee7d6){_0x348262['rows']=_0x1ee7d6;return _0x348262;})['then'](respondWithFilteredResult(_0xc49c74,_0x63253f))[_0x949b('0x46')](handleError(_0xc49c74,null));};exports[_0x949b('0x47')]=function(_0xa1814d,_0x5ecb2a){var _0x54f430={'raw':!![],'where':{'id':_0xa1814d[_0x949b('0x48')]['id']}},_0x1dedde={};_0x1dedde[_0x949b('0x35')]=_[_0x949b('0x49')](db['CannedAnswer'][_0x949b('0x33')]);_0x1dedde['query']=_[_0x949b('0x49')](_0xa1814d[_0x949b('0x36')]);_0x1dedde[_0x949b('0x37')]=_[_0x949b('0x39')](_0x1dedde[_0x949b('0x35')],_0x1dedde['query']);_0x54f430[_0x949b('0x38')]=_[_0x949b('0x39')](_0x1dedde[_0x949b('0x35')],qs['fields'](_0xa1814d['query'][_0x949b('0x3a')]));_0x54f430[_0x949b('0x38')]=_0x54f430[_0x949b('0x38')][_0x949b('0x3b')]?_0x54f430[_0x949b('0x38')]:_0x1dedde['model'];if(_0xa1814d[_0x949b('0x36')][_0x949b('0x43')]){_0x54f430['include']=[{'all':!![]}];}_0x54f430=_[_0x949b('0x41')]({},_0x54f430,_0xa1814d[_0x949b('0x4a')]);return db[_0x949b('0x42')]['find'](_0x54f430)['then'](handleEntityNotFound(_0x5ecb2a,null))[_0x949b('0x26')](respondWithResult(_0x5ecb2a,null))[_0x949b('0x46')](handleError(_0x5ecb2a,null));};exports['update']=function(_0x32d301,_0x1dc94e){if(_0x32d301[_0x949b('0x2e')]['id']){delete _0x32d301['body']['id'];}return db['CannedAnswer'][_0x949b('0x4b')]({'where':{'id':_0x32d301[_0x949b('0x48')]['id']}})[_0x949b('0x26')](handleEntityNotFound(_0x1dc94e,null))['then'](saveUpdates(_0x32d301[_0x949b('0x2e')],null))[_0x949b('0x26')](respondWithResult(_0x1dc94e,null))['catch'](handleError(_0x1dc94e,null));};exports[_0x949b('0x29')]=function(_0x44db33,_0x4737ca){return db[_0x949b('0x42')]['find']({'where':{'id':_0x44db33[_0x949b('0x48')]['id']}})[_0x949b('0x26')](handleEntityNotFound(_0x4737ca,null))[_0x949b('0x26')](removeEntity(_0x4737ca,null))['catch'](handleError(_0x4737ca,null));};exports[_0x949b('0x4c')]=function(_0x418c13,_0xd782c9){var _0x58f316={'key':_0x418c13[_0x949b('0x2e')][_0x949b('0x34')]};if(_0x418c13['body'][_0x949b('0x4d')]){_0x58f316[_0x949b('0x4d')]=_0x418c13[_0x949b('0x2e')][_0x949b('0x4d')];}else if(_0x418c13[_0x949b('0x2e')]['SmsAccountId']){_0x58f316['SmsAccountId']=_0x418c13['body']['SmsAccountId'];}else if(_0x418c13[_0x949b('0x2e')]['OpenchannelAccountId']){_0x58f316[_0x949b('0x4e')]=_0x418c13[_0x949b('0x2e')]['OpenchannelAccountId'];}else if(_0x418c13[_0x949b('0x2e')][_0x949b('0x4f')]){_0x58f316[_0x949b('0x4f')]=_0x418c13[_0x949b('0x2e')][_0x949b('0x4f')];}return db[_0x949b('0x42')][_0x949b('0x4b')]({'where':_0x58f316})['then'](function(_0x19e7f7){if(_0x19e7f7){throw new db['Sequelize'][(_0x949b('0x50'))](_0x949b('0x51'));}return db['CannedAnswer'][_0x949b('0x4c')](_0x418c13['body']);})['then'](function(_0x15042d){var _0x27b01e=_0x418c13[_0x949b('0x52')]['get']({'plain':!![]});if(!_0x27b01e)throw new Error(_0x949b('0x53'));if(_0x27b01e[_0x949b('0x54')]===_0x949b('0x52')){var _0xef2757=_0x15042d[_0x949b('0x55')]({'plain':!![]});return db['UserProfileSection'][_0x949b('0x4b')]({'where':{'name':_0x949b('0x27'),'userProfileId':_0x27b01e[_0x949b('0x56')]},'raw':!![]})[_0x949b('0x26')](function(_0x344e1a){if(_0x344e1a&&_0x344e1a['autoAssociation']===0x0){return db['UserProfileResource'][_0x949b('0x4c')]({'name':_0xef2757[_0x949b('0x2b')],'resourceId':_0xef2757['id'],'type':_0x344e1a[_0x949b('0x2b')],'sectionId':_0x344e1a['id']},{})[_0x949b('0x26')](function(){return _0x15042d;});}else{return _0x15042d;}})['catch'](function(_0x2bcb5b){logger[_0x949b('0x57')](_0x949b('0x58'),_0x2bcb5b);throw _0x2bcb5b;});}return _0x15042d;})[_0x949b('0x26')](respondWithResult(_0xd782c9,0xc9))['catch'](handleError(_0xd782c9,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c1efa86..6f181a5 100644 --- a/server/api/cannedAnswer/cannedAnswer.model.js +++ b/server/api/cannedAnswer/cannedAnswer.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e5=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x3a63fd,_0x587403){var _0x57cae3=function(_0x315d1b){while(--_0x315d1b){_0x3a63fd['push'](_0x3a63fd['shift']());}};_0x57cae3(++_0x587403);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x29ee3f,_0x119406){_0x29ee3f=_0x29ee3f-0x0;var _0xe8b75e=_0xa9e5[_0x29ee3f];return _0xe8b75e;};'use strict';var _=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var logger=require('../../config/logger')(_0x5a9e('0x2'));var moment=require(_0x5a9e('0x3'));var BPromise=require(_0x5a9e('0x4'));var rp=require(_0x5a9e('0x5'));var fs=require('fs');var path=require(_0x5a9e('0x6'));var rimraf=require(_0x5a9e('0x7'));var config=require(_0x5a9e('0x8'));var attributes=require(_0x5a9e('0x9'));module[_0x5a9e('0xa')]=function(_0x34a9ed,_0x1fb122){return _0x34a9ed[_0x5a9e('0xb')](_0x5a9e('0xc'),attributes,{'tableName':_0x5a9e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5a9e('0xe')});}; \ No newline at end of file +var _0x9b15=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3f5238,_0x39e5b6){var _0x115624=function(_0x57db3a){while(--_0x57db3a){_0x3f5238['push'](_0x3f5238['shift']());}};_0x115624(++_0x39e5b6);}(_0x9b15,0x191));var _0x59b1=function(_0xb191b1,_0x39ba1f){_0xb191b1=_0xb191b1-0x0;var _0xcb8615=_0x9b15[_0xb191b1];return _0xcb8615;};'use strict';var _=require(_0x59b1('0x0'));var util=require(_0x59b1('0x1'));var logger=require(_0x59b1('0x2'))(_0x59b1('0x3'));var moment=require(_0x59b1('0x4'));var BPromise=require(_0x59b1('0x5'));var rp=require(_0x59b1('0x6'));var fs=require('fs');var path=require(_0x59b1('0x7'));var rimraf=require(_0x59b1('0x8'));var config=require(_0x59b1('0x9'));var attributes=require(_0x59b1('0xa'));module[_0x59b1('0xb')]=function(_0x3cea52,_0x354946){return _0x3cea52['define'](_0x59b1('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x59b1('0xd'),'collate':_0x59b1('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 100a014..29ec2b2 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2163=['http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2163,0x193));var _0x3216=function(_0x1dfc65,_0x2de3e9){_0x1dfc65=_0x1dfc65-0x0;var _0x1768f6=_0x2163[_0x1dfc65];return _0x1768f6;};'use strict';var _=require('lodash');var util=require(_0x3216('0x0'));var moment=require(_0x3216('0x1'));var BPromise=require(_0x3216('0x2'));var rs=require(_0x3216('0x3'));var fs=require('fs');var Redis=require(_0x3216('0x4'));var db=require(_0x3216('0x5'))['db'];var utils=require(_0x3216('0x6'));var logger=require(_0x3216('0x7'))(_0x3216('0x8'));var config=require(_0x3216('0x9'));var jayson=require(_0x3216('0xa'));var client=jayson['client'][_0x3216('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f5ce5,_0x4a7fb4,_0x45dedd){return new BPromise(function(_0x576e59,_0x3b8ca1){return client[_0x3216('0xc')](_0x4f5ce5,_0x45dedd)[_0x3216('0xd')](function(_0x4ea4b5){logger[_0x3216('0xe')](_0x3216('0xf'),_0x4a7fb4,_0x3216('0x10'));logger['debug'](_0x3216('0x11'),_0x4a7fb4,_0x3216('0x10'),JSON[_0x3216('0x12')](_0x4ea4b5));if(_0x4ea4b5[_0x3216('0x13')]){if(_0x4ea4b5[_0x3216('0x13')][_0x3216('0x14')]===0x1f4){logger[_0x3216('0x13')](_0x3216('0xf'),_0x4a7fb4,_0x4ea4b5['error'][_0x3216('0x15')]);return _0x3b8ca1(_0x4ea4b5[_0x3216('0x13')][_0x3216('0x15')]);}logger[_0x3216('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x4a7fb4,_0x4ea4b5['error'][_0x3216('0x15')]);return _0x576e59(_0x4ea4b5[_0x3216('0x13')][_0x3216('0x15')]);}else{logger['info'](_0x3216('0xf'),_0x4a7fb4,_0x3216('0x10'));_0x576e59(_0x4ea4b5[_0x3216('0x16')][_0x3216('0x15')]);}})['catch'](function(_0x1621c7){logger[_0x3216('0x13')](_0x3216('0xf'),_0x4a7fb4,_0x1621c7);_0x3b8ca1(_0x1621c7);});});} \ No newline at end of file +var _0xa33e=['http','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3c843b,_0x2938ec){var _0x49a863=function(_0x3329cd){while(--_0x3329cd){_0x3c843b['push'](_0x3c843b['shift']());}};_0x49a863(++_0x2938ec);}(_0xa33e,0x1ea));var _0xea33=function(_0x6fb551,_0x29f8af){_0x6fb551=_0x6fb551-0x0;var _0x5f2f2d=_0xa33e[_0x6fb551];return _0x5f2f2d;};'use strict';var _=require(_0xea33('0x0'));var util=require(_0xea33('0x1'));var moment=require('moment');var BPromise=require(_0xea33('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea33('0x3'));var db=require(_0xea33('0x4'))['db'];var utils=require(_0xea33('0x5'));var logger=require(_0xea33('0x6'))(_0xea33('0x7'));var config=require('../../config/environment');var jayson=require(_0xea33('0x8'));var client=jayson[_0xea33('0x9')][_0xea33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x553d45,_0x10628f,_0x4a4a2f){return new BPromise(function(_0x4d5c82,_0x5a618f){return client['request'](_0x553d45,_0x4a4a2f)['then'](function(_0x1a5dfb){logger[_0xea33('0xb')](_0xea33('0xc'),_0x10628f,'request\x20sent');logger[_0xea33('0xd')](_0xea33('0xe'),_0x10628f,_0xea33('0xf'),JSON['stringify'](_0x1a5dfb));if(_0x1a5dfb[_0xea33('0x10')]){if(_0x1a5dfb[_0xea33('0x10')][_0xea33('0x11')]===0x1f4){logger[_0xea33('0x10')](_0xea33('0xc'),_0x10628f,_0x1a5dfb[_0xea33('0x10')][_0xea33('0x12')]);return _0x5a618f(_0x1a5dfb['error']['message']);}logger[_0xea33('0x10')](_0xea33('0xc'),_0x10628f,_0x1a5dfb[_0xea33('0x10')][_0xea33('0x12')]);return _0x4d5c82(_0x1a5dfb[_0xea33('0x10')]['message']);}else{logger[_0xea33('0xb')](_0xea33('0xc'),_0x10628f,'request\x20sent');_0x4d5c82(_0x1a5dfb[_0xea33('0x13')][_0xea33('0x12')]);}})['catch'](function(_0x225fea){logger[_0xea33('0x10')](_0xea33('0xc'),_0x10628f,_0x225fea);_0x5a618f(_0x225fea);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index e082c15..066a8cc 100644 --- a/server/api/cannedAnswer/index.js +++ b/server/api/cannedAnswer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf07a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4374e8,_0x2fd1c5){var _0x10c4e2=function(_0x25d44e){while(--_0x25d44e){_0x4374e8['push'](_0x4374e8['shift']());}};_0x10c4e2(++_0x2fd1c5);}(_0xf07a,0x1e6));var _0xaf07=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0xf07a[_0x2ce6d5];return _0x32d272;};'use strict';var multer=require(_0xaf07('0x0'));var util=require(_0xaf07('0x1'));var path=require(_0xaf07('0x2'));var timeout=require(_0xaf07('0x3'));var express=require('express');var router=express[_0xaf07('0x4')]();var fs_extra=require(_0xaf07('0x5'));var auth=require(_0xaf07('0x6'));var interaction=require(_0xaf07('0x7'));var config=require(_0xaf07('0x8'));var controller=require('./cannedAnswer.controller');router[_0xaf07('0x9')]('/',auth[_0xaf07('0xa')](),controller[_0xaf07('0xb')]);router[_0xaf07('0x9')](_0xaf07('0xc'),auth['isAuthenticated'](),controller[_0xaf07('0xd')]);router['post']('/',auth[_0xaf07('0xa')](),controller['create']);router['put']('/:id',auth[_0xaf07('0xa')](),controller[_0xaf07('0xe')]);router[_0xaf07('0xf')](_0xaf07('0xc'),auth['isAuthenticated'](),controller[_0xaf07('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8c7e=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x8c7e,0xb3));var _0xe8c7=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x8c7e[_0x1fb1c1];return _0x1622df;};'use strict';var multer=require('multer');var util=require(_0xe8c7('0x0'));var path=require(_0xe8c7('0x1'));var timeout=require(_0xe8c7('0x2'));var express=require(_0xe8c7('0x3'));var router=express[_0xe8c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe8c7('0x5'));var config=require(_0xe8c7('0x6'));var controller=require(_0xe8c7('0x7'));router['get']('/',auth[_0xe8c7('0x8')](),controller[_0xe8c7('0x9')]);router[_0xe8c7('0xa')](_0xe8c7('0xb'),auth[_0xe8c7('0x8')](),controller[_0xe8c7('0xc')]);router[_0xe8c7('0xd')]('/',auth['isAuthenticated'](),controller[_0xe8c7('0xe')]);router[_0xe8c7('0xf')](_0xe8c7('0xb'),auth[_0xe8c7('0x8')](),controller['update']);router[_0xe8c7('0x10')](_0xe8c7('0xb'),auth[_0xe8c7('0x8')](),controller[_0xe8c7('0x11')]);module[_0xe8c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 85333e2..0a41aaa 100644 --- a/server/api/cdr/cdr.attributes.js +++ b/server/api/cdr/cdr.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb789=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1a35e6,_0x5d105c){var _0x1b4585=function(_0x10ab78){while(--_0x10ab78){_0x1a35e6['push'](_0x1a35e6['shift']());}};_0x1b4585(++_0x5d105c);}(_0xb789,0x197));var _0x9b78=function(_0x5c20ff,_0x3aa940){_0x5c20ff=_0x5c20ff-0x0;var _0x1cc3af=_0xb789[_0x5c20ff];return _0x1cc3af;};'use strict';var Sequelize=require('sequelize');module[_0x9b78('0x0')]={'calldate':{'type':Sequelize[_0x9b78('0x1')],'allowNull':![],'defaultValue':_0x9b78('0x2')},'clid':{'type':Sequelize[_0x9b78('0x3')]},'src':{'type':Sequelize[_0x9b78('0x3')]},'dst':{'type':Sequelize[_0x9b78('0x3')]},'dcontext':{'type':Sequelize[_0x9b78('0x3')]},'channel':{'type':Sequelize[_0x9b78('0x3')]},'dstchannel':{'type':Sequelize[_0x9b78('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x9b78('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9b78('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9b78('0x3')]},'amaflags':{'type':Sequelize[_0x9b78('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9b78('0x3')]},'userfield':{'type':Sequelize[_0x9b78('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9b78('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9b78('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9b78('0x3')]}}; \ No newline at end of file +var _0x2187=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0x5f058f,_0x18cc77){var _0x4cbd30=function(_0x13db62){while(--_0x13db62){_0x5f058f['push'](_0x5f058f['shift']());}};_0x4cbd30(++_0x18cc77);}(_0x2187,0x13e));var _0x7218=function(_0x39c3d8,_0xfbc6f8){_0x39c3d8=_0x39c3d8-0x0;var _0x29fad4=_0x2187[_0x39c3d8];return _0x29fad4;};'use strict';var Sequelize=require(_0x7218('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x7218('0x1')],'allowNull':![],'defaultValue':_0x7218('0x2')},'clid':{'type':Sequelize[_0x7218('0x3')]},'src':{'type':Sequelize[_0x7218('0x3')]},'dst':{'type':Sequelize[_0x7218('0x3')]},'dcontext':{'type':Sequelize[_0x7218('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x7218('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x7218('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7218('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7218('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7218('0x3')]},'userfield':{'type':Sequelize[_0x7218('0x3')]},'uniqueid':{'type':Sequelize[_0x7218('0x3')]},'linkedid':{'type':Sequelize[_0x7218('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x7218('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index c401bab..e57854e 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d54=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','render','merge','body','contact','agent','interaction','index','rawAttributes','type','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','Cdr','findAll','catch','show','params','intersection','find','create','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x55b86a,_0x9f9772){var _0x46f950=function(_0x3113b0){while(--_0x3113b0){_0x55b86a['push'](_0x55b86a['shift']());}};_0x46f950(++_0x9f9772);}(_0x0d54,0x125));var _0x40d5=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x0d54[_0x383356];return _0x32ee5a;};'use strict';var emlformat=require(_0x40d5('0x0'));var rimraf=require(_0x40d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40d5('0x2'));var rp=require(_0x40d5('0x3'));var moment=require('moment');var BPromise=require(_0x40d5('0x4'));var Mustache=require(_0x40d5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x40d5('0x6'));var csv=require(_0x40d5('0x7'));var ejs=require(_0x40d5('0x8'));var fs=require('fs');var fs_extra=require(_0x40d5('0x9'));var _=require(_0x40d5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x40d5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40d5('0x7'));var querystring=require(_0x40d5('0xc'));var Papa=require(_0x40d5('0xd'));var Redis=require('ioredis');var authService=require(_0x40d5('0xe'));var qs=require(_0x40d5('0xf'));var as=require(_0x40d5('0x10'));var hardwareService=require(_0x40d5('0x11'));var logger=require(_0x40d5('0x12'))(_0x40d5('0x13'));var utils=require('../../config/utils');var config=require(_0x40d5('0x14'));var licenseUtil=require(_0x40d5('0x15'));var db=require(_0x40d5('0x16'))['db'];function respondWithStatusCode(_0x427822,_0x44e7d3){_0x44e7d3=_0x44e7d3||0xcc;return function(_0x18820e){if(_0x18820e){return _0x427822[_0x40d5('0x17')](_0x44e7d3);}return _0x427822['status'](_0x44e7d3)[_0x40d5('0x18')]();};}function respondWithResult(_0x306ff9,_0x36b212){_0x36b212=_0x36b212||0xc8;return function(_0x19ad08){if(_0x19ad08){return _0x306ff9[_0x40d5('0x19')](_0x36b212)['json'](_0x19ad08);}};}function respondWithFilteredResult(_0x256454,_0x1d8ba4){return function(_0x592ee2){if(_0x592ee2){var _0x59dae2=typeof _0x1d8ba4[_0x40d5('0x1a')]==='undefined'&&typeof _0x1d8ba4[_0x40d5('0x1b')]===_0x40d5('0x1c');var _0x1430bd=_0x592ee2[_0x40d5('0x1d')];var _0x17b9f9=_0x59dae2?0x0:_0x1d8ba4[_0x40d5('0x1a')];var _0x18a5c8=_0x59dae2?_0x592ee2[_0x40d5('0x1d')]:_0x1d8ba4[_0x40d5('0x1a')]+_0x1d8ba4['limit'];var _0x1252fb;if(_0x18a5c8>=_0x1430bd){_0x18a5c8=_0x1430bd;_0x1252fb=0xc8;}else{_0x1252fb=0xce;}_0x256454[_0x40d5('0x19')](_0x1252fb);return _0x256454[_0x40d5('0x1e')](_0x40d5('0x1f'),_0x17b9f9+'-'+_0x18a5c8+'/'+_0x1430bd)[_0x40d5('0x20')](_0x592ee2);}return null;};}function patchUpdates(_0x33cd7d){return function(_0x5edb83){try{jsonpatch[_0x40d5('0x21')](_0x5edb83,_0x33cd7d,!![]);}catch(_0x4ecfab){return BPromise[_0x40d5('0x22')](_0x4ecfab);}return _0x5edb83[_0x40d5('0x23')]();};}function saveUpdates(_0x2df11f,_0x3e2211){return function(_0x2c67ef){if(_0x2c67ef){return _0x2c67ef[_0x40d5('0x24')](_0x2df11f)[_0x40d5('0x25')](function(_0x5a5898){return _0x5a5898;});}return null;};}function removeEntity(_0x2de4e8,_0x4528f6){return function(_0x3ed884){if(_0x3ed884){return _0x3ed884[_0x40d5('0x26')]()['then'](function(){_0x2de4e8['status'](0xcc)[_0x40d5('0x18')]();});}};}function handleEntityNotFound(_0x2f2abf,_0x397c4e){return function(_0x5606d2){if(!_0x5606d2){_0x2f2abf[_0x40d5('0x17')](0x194);}return _0x5606d2;};}function handleError(_0x4a4d67,_0x3a4eca){_0x3a4eca=_0x3a4eca||0x1f4;return function(_0x596b34){logger[_0x40d5('0x27')](_0x596b34[_0x40d5('0x28')]);if(_0x596b34[_0x40d5('0x29')]){delete _0x596b34[_0x40d5('0x29')];}_0x4a4d67[_0x40d5('0x19')](_0x3a4eca)['send'](_0x596b34);};}function getMustacheRender(_0x304045,_0x23191f){return Mustache[_0x40d5('0x2a')](_0x304045,_[_0x40d5('0x2b')](_0x23191f[_0x40d5('0x2c')],{'contact':_0x23191f[_0x40d5('0x2d')],'message':_0x23191f['message'],'agent':_0x23191f[_0x40d5('0x2e')],'interaction':_0x23191f[_0x40d5('0x2f')],'account':_0x23191f['account']}))||'';}exports[_0x40d5('0x30')]=function(_0x5f0bcd,_0x1f966f){var _0x36f167={},_0x546b33={},_0x2ee8fa={'count':0x0,'rows':[]};var _0x5b5ba6=_['map'](db['Cdr'][_0x40d5('0x31')],function(_0xeb0d65){return{'name':_0xeb0d65['fieldName'],'type':_0xeb0d65[_0x40d5('0x32')]['key']};});_0x546b33[_0x40d5('0x33')]=_[_0x40d5('0x34')](_0x5b5ba6,_0x40d5('0x29'));_0x546b33[_0x40d5('0x35')]=_[_0x40d5('0x36')](_0x5f0bcd[_0x40d5('0x35')]);_0x546b33['filters']=_['intersection'](_0x546b33[_0x40d5('0x33')],_0x546b33[_0x40d5('0x35')]);_0x36f167[_0x40d5('0x37')]=_['intersection'](_0x546b33[_0x40d5('0x33')],qs['fields'](_0x5f0bcd[_0x40d5('0x35')][_0x40d5('0x38')]));_0x36f167[_0x40d5('0x37')]=_0x36f167[_0x40d5('0x37')][_0x40d5('0x39')]?_0x36f167[_0x40d5('0x37')]:_0x546b33[_0x40d5('0x33')];if(!_0x5f0bcd['query'][_0x40d5('0x3a')](_0x40d5('0x3b'))){_0x36f167['limit']=qs[_0x40d5('0x1b')](_0x5f0bcd['query'][_0x40d5('0x1b')]);_0x36f167[_0x40d5('0x1a')]=qs['offset'](_0x5f0bcd['query'][_0x40d5('0x1a')]);}_0x36f167[_0x40d5('0x3c')]=qs[_0x40d5('0x3d')](_0x5f0bcd[_0x40d5('0x35')]['sort']);_0x36f167[_0x40d5('0x3e')]=qs[_0x40d5('0x3f')](_[_0x40d5('0x40')](_0x5f0bcd[_0x40d5('0x35')],_0x546b33[_0x40d5('0x3f')]),_0x5b5ba6);if(_0x5f0bcd[_0x40d5('0x35')][_0x40d5('0x41')]){_0x36f167[_0x40d5('0x3e')]=_['merge'](_0x36f167['where'],{'$or':_['map'](_0x5b5ba6,function(_0x5541b7){if(_0x5541b7['type']!==_0x40d5('0x42')){var _0x2d11f8={};_0x2d11f8[_0x5541b7[_0x40d5('0x29')]]={'$like':'%'+_0x5f0bcd['query'][_0x40d5('0x41')]+'%'};return _0x2d11f8;}})});}_0x36f167=_[_0x40d5('0x2b')]({},_0x36f167,_0x5f0bcd[_0x40d5('0x43')]);var _0x5e6567={'where':_0x36f167[_0x40d5('0x3e')]};return db[_0x40d5('0x44')]['count'](_0x5e6567)['then'](function(_0x42f944){_0x2ee8fa[_0x40d5('0x1d')]=_0x42f944;if(_0x5f0bcd[_0x40d5('0x35')]['includeAll']){_0x36f167['include']=[{'all':!![]}];}return db[_0x40d5('0x44')][_0x40d5('0x45')](_0x36f167);})[_0x40d5('0x25')](function(_0x44913e){_0x2ee8fa['rows']=_0x44913e;return _0x2ee8fa;})[_0x40d5('0x25')](respondWithFilteredResult(_0x1f966f,_0x36f167))[_0x40d5('0x46')](handleError(_0x1f966f,null));};exports[_0x40d5('0x47')]=function(_0x533a5d,_0x28f497){var _0x5a5d61={'raw':!![],'where':{'id':_0x533a5d[_0x40d5('0x48')]['id']}},_0x184ee2={};_0x184ee2[_0x40d5('0x33')]=_[_0x40d5('0x36')](db[_0x40d5('0x44')][_0x40d5('0x31')]);_0x184ee2[_0x40d5('0x35')]=_[_0x40d5('0x36')](_0x533a5d[_0x40d5('0x35')]);_0x184ee2['filters']=_[_0x40d5('0x49')](_0x184ee2[_0x40d5('0x33')],_0x184ee2['query']);_0x5a5d61[_0x40d5('0x37')]=_[_0x40d5('0x49')](_0x184ee2[_0x40d5('0x33')],qs[_0x40d5('0x38')](_0x533a5d[_0x40d5('0x35')][_0x40d5('0x38')]));_0x5a5d61[_0x40d5('0x37')]=_0x5a5d61[_0x40d5('0x37')]['length']?_0x5a5d61['attributes']:_0x184ee2[_0x40d5('0x33')];if(_0x533a5d[_0x40d5('0x35')]['includeAll']){_0x5a5d61['include']=[{'all':!![]}];}_0x5a5d61=_['merge']({},_0x5a5d61,_0x533a5d[_0x40d5('0x43')]);return db[_0x40d5('0x44')][_0x40d5('0x4a')](_0x5a5d61)[_0x40d5('0x25')](handleEntityNotFound(_0x28f497,null))['then'](respondWithResult(_0x28f497,null))[_0x40d5('0x46')](handleError(_0x28f497,null));};exports[_0x40d5('0x4b')]=function(_0x1d4bf3,_0x12b43d){return db['Cdr']['create'](_0x1d4bf3[_0x40d5('0x2c')],{})[_0x40d5('0x25')](respondWithResult(_0x12b43d,0xc9))[_0x40d5('0x46')](handleError(_0x12b43d,null));};exports[_0x40d5('0x24')]=function(_0x20e69d,_0x38f424){if(_0x20e69d[_0x40d5('0x2c')]['id']){delete _0x20e69d['body']['id'];}return db[_0x40d5('0x44')][_0x40d5('0x4a')]({'where':{'id':_0x20e69d[_0x40d5('0x48')]['id']}})[_0x40d5('0x25')](handleEntityNotFound(_0x38f424,null))[_0x40d5('0x25')](saveUpdates(_0x20e69d['body'],null))[_0x40d5('0x25')](respondWithResult(_0x38f424,null))[_0x40d5('0x46')](handleError(_0x38f424,null));};exports['destroy']=function(_0x5e4d5c,_0x387406){return db['Cdr']['find']({'where':{'id':_0x5e4d5c[_0x40d5('0x48')]['id']}})[_0x40d5('0x25')](handleEntityNotFound(_0x387406,null))[_0x40d5('0x25')](removeEntity(_0x387406,null))[_0x40d5('0x46')](handleError(_0x387406,null));};exports[_0x40d5('0x4c')]=function(_0x4b4999,_0x20afcc){return db[_0x40d5('0x44')][_0x40d5('0x4c')]()[_0x40d5('0x25')](respondWithResult(_0x20afcc,null))[_0x40d5('0x46')](handleError(_0x20afcc,null));}; \ No newline at end of file +var _0x6144=['render','body','contact','message','interaction','account','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','params','keys','include','find','destroy','describe','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send'];(function(_0x1a8a79,_0x57182d){var _0x436f4c=function(_0x4cc5c2){while(--_0x4cc5c2){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x436f4c(++_0x57182d);}(_0x6144,0x11a));var _0x4614=function(_0xa98117,_0xe5ed1c){_0xa98117=_0xa98117-0x0;var _0x9f196d=_0x6144[_0xa98117];return _0x9f196d;};'use strict';var emlformat=require(_0x4614('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4614('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4614('0x2'));var Mustache=require(_0x4614('0x3'));var util=require(_0x4614('0x4'));var path=require('path');var sox=require(_0x4614('0x5'));var csv=require(_0x4614('0x6'));var ejs=require(_0x4614('0x7'));var fs=require('fs');var fs_extra=require(_0x4614('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4614('0x9'));var jsforce=require(_0x4614('0xa'));var deskjs=require(_0x4614('0xb'));var toCsv=require(_0x4614('0x6'));var querystring=require(_0x4614('0xc'));var Papa=require(_0x4614('0xd'));var Redis=require(_0x4614('0xe'));var authService=require(_0x4614('0xf'));var qs=require(_0x4614('0x10'));var as=require(_0x4614('0x11'));var hardwareService=require(_0x4614('0x12'));var logger=require(_0x4614('0x13'))(_0x4614('0x14'));var utils=require(_0x4614('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4614('0x16'));var db=require(_0x4614('0x17'))['db'];function respondWithStatusCode(_0x4487ef,_0x13950f){_0x13950f=_0x13950f||0xcc;return function(_0x261a7a){if(_0x261a7a){return _0x4487ef[_0x4614('0x18')](_0x13950f);}return _0x4487ef[_0x4614('0x19')](_0x13950f)[_0x4614('0x1a')]();};}function respondWithResult(_0x255fed,_0x4a26c2){_0x4a26c2=_0x4a26c2||0xc8;return function(_0x149e92){if(_0x149e92){return _0x255fed[_0x4614('0x19')](_0x4a26c2)[_0x4614('0x1b')](_0x149e92);}};}function respondWithFilteredResult(_0x8601e3,_0x2000f9){return function(_0x350520){if(_0x350520){var _0x518f09=typeof _0x2000f9[_0x4614('0x1c')]===_0x4614('0x1d')&&typeof _0x2000f9[_0x4614('0x1e')]===_0x4614('0x1d');var _0x28893e=_0x350520[_0x4614('0x1f')];var _0x4b3fc3=_0x518f09?0x0:_0x2000f9['offset'];var _0x117a2a=_0x518f09?_0x350520[_0x4614('0x1f')]:_0x2000f9[_0x4614('0x1c')]+_0x2000f9[_0x4614('0x1e')];var _0x11037d;if(_0x117a2a>=_0x28893e){_0x117a2a=_0x28893e;_0x11037d=0xc8;}else{_0x11037d=0xce;}_0x8601e3[_0x4614('0x19')](_0x11037d);return _0x8601e3[_0x4614('0x20')](_0x4614('0x21'),_0x4b3fc3+'-'+_0x117a2a+'/'+_0x28893e)[_0x4614('0x1b')](_0x350520);}return null;};}function patchUpdates(_0x136f5a){return function(_0x3d9efc){try{jsonpatch[_0x4614('0x22')](_0x3d9efc,_0x136f5a,!![]);}catch(_0x6d8466){return BPromise[_0x4614('0x23')](_0x6d8466);}return _0x3d9efc[_0x4614('0x24')]();};}function saveUpdates(_0x1a57fc,_0x5ba78a){return function(_0x3a82e3){if(_0x3a82e3){return _0x3a82e3[_0x4614('0x25')](_0x1a57fc)['then'](function(_0x484259){return _0x484259;});}return null;};}function removeEntity(_0x4d5d06,_0x107981){return function(_0x510255){if(_0x510255){return _0x510255['destroy']()[_0x4614('0x26')](function(){_0x4d5d06[_0x4614('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x399bf2,_0xe44b2f){return function(_0x10992b){if(!_0x10992b){_0x399bf2[_0x4614('0x18')](0x194);}return _0x10992b;};}function handleError(_0x18ddf7,_0x1a017d){_0x1a017d=_0x1a017d||0x1f4;return function(_0x2a0a13){logger['error'](_0x2a0a13[_0x4614('0x27')]);if(_0x2a0a13[_0x4614('0x28')]){delete _0x2a0a13[_0x4614('0x28')];}_0x18ddf7[_0x4614('0x19')](_0x1a017d)[_0x4614('0x29')](_0x2a0a13);};}function getMustacheRender(_0x17a0d8,_0x555b6c){return Mustache[_0x4614('0x2a')](_0x17a0d8,_['merge'](_0x555b6c[_0x4614('0x2b')],{'contact':_0x555b6c[_0x4614('0x2c')],'message':_0x555b6c[_0x4614('0x2d')],'agent':_0x555b6c['agent'],'interaction':_0x555b6c[_0x4614('0x2e')],'account':_0x555b6c[_0x4614('0x2f')]}))||'';}exports['index']=function(_0x56cf8f,_0x272a0d){var _0xa92c2e={},_0xc8528c={},_0x3709cf={'count':0x0,'rows':[]};var _0x492463=_[_0x4614('0x30')](db[_0x4614('0x31')][_0x4614('0x32')],function(_0x1710c5){return{'name':_0x1710c5[_0x4614('0x33')],'type':_0x1710c5[_0x4614('0x34')][_0x4614('0x35')]};});_0xc8528c[_0x4614('0x36')]=_['map'](_0x492463,_0x4614('0x28'));_0xc8528c[_0x4614('0x37')]=_['keys'](_0x56cf8f[_0x4614('0x37')]);_0xc8528c[_0x4614('0x38')]=_[_0x4614('0x39')](_0xc8528c[_0x4614('0x36')],_0xc8528c[_0x4614('0x37')]);_0xa92c2e[_0x4614('0x3a')]=_['intersection'](_0xc8528c[_0x4614('0x36')],qs[_0x4614('0x3b')](_0x56cf8f[_0x4614('0x37')][_0x4614('0x3b')]));_0xa92c2e['attributes']=_0xa92c2e['attributes'][_0x4614('0x3c')]?_0xa92c2e[_0x4614('0x3a')]:_0xc8528c[_0x4614('0x36')];if(!_0x56cf8f[_0x4614('0x37')][_0x4614('0x3d')](_0x4614('0x3e'))){_0xa92c2e['limit']=qs[_0x4614('0x1e')](_0x56cf8f['query'][_0x4614('0x1e')]);_0xa92c2e[_0x4614('0x1c')]=qs[_0x4614('0x1c')](_0x56cf8f[_0x4614('0x37')][_0x4614('0x1c')]);}_0xa92c2e[_0x4614('0x3f')]=qs[_0x4614('0x40')](_0x56cf8f[_0x4614('0x37')]['sort']);_0xa92c2e[_0x4614('0x41')]=qs[_0x4614('0x38')](_[_0x4614('0x42')](_0x56cf8f[_0x4614('0x37')],_0xc8528c[_0x4614('0x38')]),_0x492463);if(_0x56cf8f[_0x4614('0x37')]['filter']){_0xa92c2e[_0x4614('0x41')]=_['merge'](_0xa92c2e[_0x4614('0x41')],{'$or':_['map'](_0x492463,function(_0x165139){if(_0x165139['type']!==_0x4614('0x43')){var _0x3b3137={};_0x3b3137[_0x165139['name']]={'$like':'%'+_0x56cf8f[_0x4614('0x37')][_0x4614('0x44')]+'%'};return _0x3b3137;}})});}_0xa92c2e=_[_0x4614('0x45')]({},_0xa92c2e,_0x56cf8f[_0x4614('0x46')]);var _0x2e8621={'where':_0xa92c2e[_0x4614('0x41')]};return db['Cdr'][_0x4614('0x1f')](_0x2e8621)['then'](function(_0x2542b9){_0x3709cf['count']=_0x2542b9;if(_0x56cf8f['query'][_0x4614('0x47')]){_0xa92c2e['include']=[{'all':!![]}];}return db[_0x4614('0x31')]['findAll'](_0xa92c2e);})[_0x4614('0x26')](function(_0x1cc257){_0x3709cf[_0x4614('0x48')]=_0x1cc257;return _0x3709cf;})[_0x4614('0x26')](respondWithFilteredResult(_0x272a0d,_0xa92c2e))[_0x4614('0x49')](handleError(_0x272a0d,null));};exports[_0x4614('0x4a')]=function(_0x599b95,_0x1c3a8a){var _0x5e771c={'raw':!![],'where':{'id':_0x599b95[_0x4614('0x4b')]['id']}},_0x12563c={};_0x12563c[_0x4614('0x36')]=_[_0x4614('0x4c')](db['Cdr'][_0x4614('0x32')]);_0x12563c[_0x4614('0x37')]=_[_0x4614('0x4c')](_0x599b95['query']);_0x12563c[_0x4614('0x38')]=_[_0x4614('0x39')](_0x12563c[_0x4614('0x36')],_0x12563c[_0x4614('0x37')]);_0x5e771c[_0x4614('0x3a')]=_['intersection'](_0x12563c[_0x4614('0x36')],qs[_0x4614('0x3b')](_0x599b95[_0x4614('0x37')][_0x4614('0x3b')]));_0x5e771c['attributes']=_0x5e771c[_0x4614('0x3a')]['length']?_0x5e771c[_0x4614('0x3a')]:_0x12563c[_0x4614('0x36')];if(_0x599b95['query'][_0x4614('0x47')]){_0x5e771c[_0x4614('0x4d')]=[{'all':!![]}];}_0x5e771c=_[_0x4614('0x45')]({},_0x5e771c,_0x599b95['options']);return db[_0x4614('0x31')]['find'](_0x5e771c)[_0x4614('0x26')](handleEntityNotFound(_0x1c3a8a,null))[_0x4614('0x26')](respondWithResult(_0x1c3a8a,null))[_0x4614('0x49')](handleError(_0x1c3a8a,null));};exports['create']=function(_0x123697,_0x2ee0b2){return db[_0x4614('0x31')]['create'](_0x123697['body'],{})[_0x4614('0x26')](respondWithResult(_0x2ee0b2,0xc9))[_0x4614('0x49')](handleError(_0x2ee0b2,null));};exports[_0x4614('0x25')]=function(_0x488e4b,_0xca4fc1){if(_0x488e4b[_0x4614('0x2b')]['id']){delete _0x488e4b[_0x4614('0x2b')]['id'];}return db[_0x4614('0x31')][_0x4614('0x4e')]({'where':{'id':_0x488e4b['params']['id']}})['then'](handleEntityNotFound(_0xca4fc1,null))[_0x4614('0x26')](saveUpdates(_0x488e4b['body'],null))[_0x4614('0x26')](respondWithResult(_0xca4fc1,null))[_0x4614('0x49')](handleError(_0xca4fc1,null));};exports[_0x4614('0x4f')]=function(_0x596e31,_0x560494){return db[_0x4614('0x31')][_0x4614('0x4e')]({'where':{'id':_0x596e31['params']['id']}})[_0x4614('0x26')](handleEntityNotFound(_0x560494,null))[_0x4614('0x26')](removeEntity(_0x560494,null))['catch'](handleError(_0x560494,null));};exports[_0x4614('0x50')]=function(_0x137c15,_0x5364e2){return db[_0x4614('0x31')]['describe']()[_0x4614('0x26')](respondWithResult(_0x5364e2,null))['catch'](handleError(_0x5364e2,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 78c3f41..d7faf70 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Cdr','accountcode','calldate','disposition','dst','uniqueid','lodash'];(function(_0x16dfb6,_0x24da6f){var _0x4c21fc=function(_0x4065cd){while(--_0x4065cd){_0x16dfb6['push'](_0x16dfb6['shift']());}};_0x4c21fc(++_0x24da6f);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cdr.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['accountcode']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'disposition','fields':[_0xee2f('0xc')]},{'name':_0xee2f('0xd'),'fields':['dst']},{'name':'src','fields':['src']},{'name':'uniqueid','fields':[_0xee2f('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x01d9=['Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define'];(function(_0x29bf80,_0x4af855){var _0x932096=function(_0x1528d7){while(--_0x1528d7){_0x29bf80['push'](_0x29bf80['shift']());}};_0x932096(++_0x4af855);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]},{'name':_0x901d('0x11'),'fields':[_0x901d('0x11')]},{'name':_0x901d('0x12'),'fields':['src']},{'name':_0x901d('0x13'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 79f9705..7f910ad 100644 --- a/server/api/cdr/cdr.rpc.js +++ b/server/api/cdr/cdr.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7738=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7738,0xec));var _0x8773=function(_0x21d650,_0x34649d){_0x21d650=_0x21d650-0x0;var _0x5e50a3=_0x7738[_0x21d650];return _0x5e50a3;};'use strict';var _=require(_0x8773('0x0'));var util=require(_0x8773('0x1'));var moment=require(_0x8773('0x2'));var BPromise=require(_0x8773('0x3'));var rs=require(_0x8773('0x4'));var fs=require('fs');var Redis=require(_0x8773('0x5'));var db=require(_0x8773('0x6'))['db'];var utils=require(_0x8773('0x7'));var logger=require('../../config/logger')(_0x8773('0x8'));var config=require(_0x8773('0x9'));var jayson=require(_0x8773('0xa'));var client=jayson[_0x8773('0xb')][_0x8773('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fae42,_0x5a15dc,_0x136598){return new BPromise(function(_0x10be6e,_0xd4480a){return client[_0x8773('0xd')](_0x4fae42,_0x136598)[_0x8773('0xe')](function(_0x25b733){logger[_0x8773('0xf')](_0x8773('0x10'),_0x5a15dc,_0x8773('0x11'));logger[_0x8773('0x12')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5a15dc,_0x8773('0x11'),JSON[_0x8773('0x13')](_0x25b733));if(_0x25b733[_0x8773('0x14')]){if(_0x25b733['error']['code']===0x1f4){logger[_0x8773('0x14')](_0x8773('0x10'),_0x5a15dc,_0x25b733[_0x8773('0x14')][_0x8773('0x15')]);return _0xd4480a(_0x25b733[_0x8773('0x14')][_0x8773('0x15')]);}logger[_0x8773('0x14')](_0x8773('0x10'),_0x5a15dc,_0x25b733['error'][_0x8773('0x15')]);return _0x10be6e(_0x25b733[_0x8773('0x14')][_0x8773('0x15')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x5a15dc,'request\x20sent');_0x10be6e(_0x25b733[_0x8773('0x16')][_0x8773('0x15')]);}})[_0x8773('0x17')](function(_0x39d0b9){logger[_0x8773('0x14')]('Cdr,\x20%s,\x20%s',_0x5a15dc,_0x39d0b9);_0xd4480a(_0x39d0b9);});});} \ No newline at end of file +var _0x7310=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x7310,0xb2));var _0x0731=function(_0x29f3ff,_0x3e70a4){_0x29f3ff=_0x29f3ff-0x0;var _0x25160a=_0x7310[_0x29f3ff];return _0x25160a;};'use strict';var _=require('lodash');var util=require(_0x0731('0x0'));var moment=require(_0x0731('0x1'));var BPromise=require('bluebird');var rs=require(_0x0731('0x2'));var fs=require('fs');var Redis=require(_0x0731('0x3'));var db=require(_0x0731('0x4'))['db'];var utils=require(_0x0731('0x5'));var logger=require(_0x0731('0x6'))(_0x0731('0x7'));var config=require(_0x0731('0x8'));var jayson=require(_0x0731('0x9'));var client=jayson[_0x0731('0xa')][_0x0731('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x879917,_0x4986e7,_0x42c5f4){return new BPromise(function(_0x56b523,_0x44b412){return client[_0x0731('0xc')](_0x879917,_0x42c5f4)[_0x0731('0xd')](function(_0x15086d){logger[_0x0731('0xe')](_0x0731('0xf'),_0x4986e7,_0x0731('0x10'));logger[_0x0731('0x11')](_0x0731('0x12'),_0x4986e7,'request\x20sent',JSON[_0x0731('0x13')](_0x15086d));if(_0x15086d[_0x0731('0x14')]){if(_0x15086d[_0x0731('0x14')][_0x0731('0x15')]===0x1f4){logger['error'](_0x0731('0xf'),_0x4986e7,_0x15086d['error'][_0x0731('0x16')]);return _0x44b412(_0x15086d[_0x0731('0x14')][_0x0731('0x16')]);}logger[_0x0731('0x14')]('Cdr,\x20%s,\x20%s',_0x4986e7,_0x15086d[_0x0731('0x14')]['message']);return _0x56b523(_0x15086d[_0x0731('0x14')][_0x0731('0x16')]);}else{logger[_0x0731('0xe')](_0x0731('0xf'),_0x4986e7,'request\x20sent');_0x56b523(_0x15086d['result'][_0x0731('0x16')]);}})[_0x0731('0x17')](function(_0x2c3253){logger['error']('Cdr,\x20%s,\x20%s',_0x4986e7,_0x2c3253);_0x44b412(_0x2c3253);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5004236..27050e7 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8caa=['../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x57c6cd,_0x281362){var _0xa191e4=function(_0x412748){while(--_0x412748){_0x57c6cd['push'](_0x57c6cd['shift']());}};_0xa191e4(++_0x281362);}(_0x8caa,0x161));var _0xa8ca=function(_0x4d8f6f,_0x559720){_0x4d8f6f=_0x4d8f6f-0x0;var _0x441c71=_0x8caa[_0x4d8f6f];return _0x441c71;};'use strict';var multer=require(_0xa8ca('0x0'));var util=require(_0xa8ca('0x1'));var path=require(_0xa8ca('0x2'));var timeout=require(_0xa8ca('0x3'));var express=require(_0xa8ca('0x4'));var router=express[_0xa8ca('0x5')]();var fs_extra=require(_0xa8ca('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa8ca('0x7'));var config=require(_0xa8ca('0x8'));var controller=require(_0xa8ca('0x9'));router[_0xa8ca('0xa')]('/',auth[_0xa8ca('0xb')](),controller[_0xa8ca('0xc')]);router[_0xa8ca('0xa')]('/describe',auth[_0xa8ca('0xb')](),controller['describe']);router[_0xa8ca('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa8ca('0xd')]('/',auth[_0xa8ca('0xb')](),controller[_0xa8ca('0xe')]);router[_0xa8ca('0xf')](_0xa8ca('0x10'),auth[_0xa8ca('0xb')](),controller[_0xa8ca('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa8ca('0x12')]);module[_0xa8ca('0x13')]=router; \ No newline at end of file +var _0xab15=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','multer','path','express','fs-extra'];(function(_0x48918f,_0xc04b98){var _0x4a62dd=function(_0x55c146){while(--_0x55c146){_0x48918f['push'](_0x48918f['shift']());}};_0x4a62dd(++_0xc04b98);}(_0xab15,0x176));var _0x5ab1=function(_0x49d49b,_0x2403ba){_0x49d49b=_0x49d49b-0x0;var _0x1263e4=_0xab15[_0x49d49b];return _0x1263e4;};'use strict';var multer=require(_0x5ab1('0x0'));var util=require('util');var path=require(_0x5ab1('0x1'));var timeout=require('connect-timeout');var express=require(_0x5ab1('0x2'));var router=express['Router']();var fs_extra=require(_0x5ab1('0x3'));var auth=require(_0x5ab1('0x4'));var interaction=require(_0x5ab1('0x5'));var config=require(_0x5ab1('0x6'));var controller=require(_0x5ab1('0x7'));router[_0x5ab1('0x8')]('/',auth[_0x5ab1('0x9')](),controller['index']);router[_0x5ab1('0x8')](_0x5ab1('0xa'),auth[_0x5ab1('0x9')](),controller['describe']);router[_0x5ab1('0x8')](_0x5ab1('0xb'),auth[_0x5ab1('0x9')](),controller[_0x5ab1('0xc')]);router[_0x5ab1('0xd')]('/',auth[_0x5ab1('0x9')](),controller[_0x5ab1('0xe')]);router[_0x5ab1('0xf')](_0x5ab1('0xb'),auth[_0x5ab1('0x9')](),controller[_0x5ab1('0x10')]);router['delete'](_0x5ab1('0xb'),auth['isAuthenticated'](),controller[_0x5ab1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d992801..0acc52d 100644 --- a/server/api/chatApplication/chatApplication.attributes.js +++ b/server/api/chatApplication/chatApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69b8=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x69b8,0x185));var _0x869b=function(_0xe2665b,_0x26db74){_0xe2665b=_0xe2665b-0x0;var _0x1888f5=_0x69b8[_0xe2665b];return _0x1888f5;};'use strict';var Sequelize=require(_0x869b('0x0'));module[_0x869b('0x1')]={'priority':{'type':Sequelize[_0x869b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x869b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x869b('0x4')]()},'description':{'type':Sequelize[_0x869b('0x3')]},'interval':{'type':Sequelize[_0x869b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd6d5=['TEXT','sequelize','INTEGER','STRING','noop'];(function(_0x243ebe,_0x25a4e0){var _0x5de2b9=function(_0x462adb){while(--_0x462adb){_0x243ebe['push'](_0x243ebe['shift']());}};_0x5de2b9(++_0x25a4e0);}(_0xd6d5,0x92));var _0x5d6d=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0xd6d5[_0x11ba46];return _0x1c8c6f;};'use strict';var Sequelize=require(_0x5d6d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5d6d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5d6d('0x2')],'allowNull':![],'defaultValue':_0x5d6d('0x3')},'appdata':{'type':Sequelize[_0x5d6d('0x4')]()},'description':{'type':Sequelize[_0x5d6d('0x2')]},'interval':{'type':Sequelize[_0x5d6d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 949a0ce..9b490cd 100644 --- a/server/api/chatApplication/chatApplication.controller.js +++ b/server/api/chatApplication/chatApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','merge','body','contact','message','agent','account','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1623,0xab));var _0x3162=function(_0x12120d,_0x3fd6ea){_0x12120d=_0x12120d-0x0;var _0x3f2894=_0x1623[_0x12120d];return _0x3f2894;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}function getMustacheRender(_0x10c90b,_0x57f567){return Mustache['render'](_0x10c90b,_[_0x3162('0x2a')](_0x57f567[_0x3162('0x2b')],{'contact':_0x57f567[_0x3162('0x2c')],'message':_0x57f567[_0x3162('0x2d')],'agent':_0x57f567[_0x3162('0x2e')],'interaction':_0x57f567['interaction'],'account':_0x57f567[_0x3162('0x2f')]}))||'';}exports['show']=function(_0xf11765,_0x3a188e){var _0x41e933={'raw':!![],'where':{'id':_0xf11765[_0x3162('0x30')]['id']}},_0x221b38={};_0x221b38[_0x3162('0x31')]=_[_0x3162('0x32')](db[_0x3162('0x33')]['rawAttributes']);_0x221b38[_0x3162('0x34')]=_[_0x3162('0x32')](_0xf11765['query']);_0x221b38[_0x3162('0x35')]=_[_0x3162('0x36')](_0x221b38['model'],_0x221b38['query']);_0x41e933[_0x3162('0x37')]=_['intersection'](_0x221b38[_0x3162('0x31')],qs[_0x3162('0x38')](_0xf11765[_0x3162('0x34')]['fields']));_0x41e933['attributes']=_0x41e933[_0x3162('0x37')][_0x3162('0x39')]?_0x41e933['attributes']:_0x221b38[_0x3162('0x31')];if(_0xf11765['query'][_0x3162('0x3a')]){_0x41e933[_0x3162('0x3b')]=[{'all':!![]}];}_0x41e933=_[_0x3162('0x2a')]({},_0x41e933,_0xf11765[_0x3162('0x3c')]);return db[_0x3162('0x33')][_0x3162('0x3d')](_0x41e933)[_0x3162('0x24')](handleEntityNotFound(_0x3a188e,null))[_0x3162('0x24')](respondWithResult(_0x3a188e,null))[_0x3162('0x3e')](handleError(_0x3a188e,null));};exports[_0x3162('0x23')]=function(_0x3fc06f,_0x5c39d9){if(_0x3fc06f[_0x3162('0x2b')]['id']){delete _0x3fc06f[_0x3162('0x2b')]['id'];}return db[_0x3162('0x33')]['find']({'where':{'id':_0x3fc06f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x5c39d9,null))[_0x3162('0x24')](saveUpdates(_0x3fc06f[_0x3162('0x2b')],null))[_0x3162('0x24')](respondWithResult(_0x5c39d9,null))['catch'](handleError(_0x5c39d9,null));};exports[_0x3162('0x25')]=function(_0x5ee3e2,_0x59e049){return db['ChatApplication'][_0x3162('0x3d')]({'where':{'id':_0x5ee3e2[_0x3162('0x30')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x59e049,null))['then'](removeEntity(_0x59e049,null))[_0x3162('0x3e')](handleError(_0x59e049,null));}; \ No newline at end of file +var _0x5d59=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','end','error','stack','name','render','merge','contact','agent','account','show','params','model','query','keys','filters','intersection','attributes','fields','length','includeAll','include','ChatApplication','catch','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash'];(function(_0x288c3b,_0x5afea4){var _0x53fb40=function(_0x21092e){while(--_0x21092e){_0x288c3b['push'](_0x288c3b['shift']());}};_0x53fb40(++_0x5afea4);}(_0x5d59,0x15f));var _0x95d5=function(_0x12c511,_0x2102cc){_0x12c511=_0x12c511-0x0;var _0x208ba2=_0x5d59[_0x12c511];return _0x208ba2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95d5('0x0'));var zipdir=require(_0x95d5('0x1'));var jsonpatch=require(_0x95d5('0x2'));var rp=require(_0x95d5('0x3'));var moment=require(_0x95d5('0x4'));var BPromise=require(_0x95d5('0x5'));var Mustache=require('mustache');var util=require(_0x95d5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x95d5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95d5('0x8'));var squel=require(_0x95d5('0x9'));var crypto=require(_0x95d5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x95d5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x95d5('0xc'));var Papa=require('papaparse');var Redis=require(_0x95d5('0xd'));var authService=require(_0x95d5('0xe'));var qs=require(_0x95d5('0xf'));var as=require(_0x95d5('0x10'));var hardwareService=require(_0x95d5('0x11'));var logger=require(_0x95d5('0x12'))(_0x95d5('0x13'));var utils=require(_0x95d5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x95d5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47fb16,_0x12b0ff){_0x12b0ff=_0x12b0ff||0xcc;return function(_0x30ad51){if(_0x30ad51){return _0x47fb16[_0x95d5('0x16')](_0x12b0ff);}return _0x47fb16[_0x95d5('0x17')](_0x12b0ff)['end']();};}function respondWithResult(_0x33d769,_0x2ce559){_0x2ce559=_0x2ce559||0xc8;return function(_0x3c0c3e){if(_0x3c0c3e){return _0x33d769[_0x95d5('0x17')](_0x2ce559)[_0x95d5('0x18')](_0x3c0c3e);}};}function respondWithFilteredResult(_0x3a59df,_0x3d8de7){return function(_0x1f03eb){if(_0x1f03eb){var _0x14d8a9=typeof _0x3d8de7['offset']==='undefined'&&typeof _0x3d8de7[_0x95d5('0x19')]==='undefined';var _0x34a382=_0x1f03eb[_0x95d5('0x1a')];var _0x5bdf14=_0x14d8a9?0x0:_0x3d8de7[_0x95d5('0x1b')];var _0x3793eb=_0x14d8a9?_0x1f03eb[_0x95d5('0x1a')]:_0x3d8de7[_0x95d5('0x1b')]+_0x3d8de7[_0x95d5('0x19')];var _0x11e905;if(_0x3793eb>=_0x34a382){_0x3793eb=_0x34a382;_0x11e905=0xc8;}else{_0x11e905=0xce;}_0x3a59df['status'](_0x11e905);return _0x3a59df[_0x95d5('0x1c')](_0x95d5('0x1d'),_0x5bdf14+'-'+_0x3793eb+'/'+_0x34a382)[_0x95d5('0x18')](_0x1f03eb);}return null;};}function patchUpdates(_0x5bd58d){return function(_0x5e8a19){try{jsonpatch[_0x95d5('0x1e')](_0x5e8a19,_0x5bd58d,!![]);}catch(_0x4023d3){return BPromise['reject'](_0x4023d3);}return _0x5e8a19[_0x95d5('0x1f')]();};}function saveUpdates(_0x2557e7,_0x2ca4b6){return function(_0x51ba73){if(_0x51ba73){return _0x51ba73[_0x95d5('0x20')](_0x2557e7)['then'](function(_0x5a5a7e){return _0x5a5a7e;});}return null;};}function removeEntity(_0x4f64ac,_0x554f4d){return function(_0x588825){if(_0x588825){return _0x588825['destroy']()[_0x95d5('0x21')](function(){_0x4f64ac[_0x95d5('0x17')](0xcc)[_0x95d5('0x22')]();});}};}function handleEntityNotFound(_0x260582,_0x54f64c){return function(_0x3fe6ef){if(!_0x3fe6ef){_0x260582[_0x95d5('0x16')](0x194);}return _0x3fe6ef;};}function handleError(_0x316d19,_0x1b8d73){_0x1b8d73=_0x1b8d73||0x1f4;return function(_0xe12a95){logger[_0x95d5('0x23')](_0xe12a95[_0x95d5('0x24')]);if(_0xe12a95[_0x95d5('0x25')]){delete _0xe12a95[_0x95d5('0x25')];}_0x316d19[_0x95d5('0x17')](_0x1b8d73)['send'](_0xe12a95);};}function getMustacheRender(_0x4d6a64,_0xd9b81c){return Mustache[_0x95d5('0x26')](_0x4d6a64,_[_0x95d5('0x27')](_0xd9b81c['body'],{'contact':_0xd9b81c[_0x95d5('0x28')],'message':_0xd9b81c['message'],'agent':_0xd9b81c[_0x95d5('0x29')],'interaction':_0xd9b81c['interaction'],'account':_0xd9b81c[_0x95d5('0x2a')]}))||'';}exports[_0x95d5('0x2b')]=function(_0x333459,_0x21d4ff){var _0x44d803={'raw':!![],'where':{'id':_0x333459[_0x95d5('0x2c')]['id']}},_0x362b8={};_0x362b8[_0x95d5('0x2d')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x362b8[_0x95d5('0x2e')]=_[_0x95d5('0x2f')](_0x333459[_0x95d5('0x2e')]);_0x362b8[_0x95d5('0x30')]=_[_0x95d5('0x31')](_0x362b8[_0x95d5('0x2d')],_0x362b8['query']);_0x44d803[_0x95d5('0x32')]=_[_0x95d5('0x31')](_0x362b8[_0x95d5('0x2d')],qs[_0x95d5('0x33')](_0x333459[_0x95d5('0x2e')][_0x95d5('0x33')]));_0x44d803[_0x95d5('0x32')]=_0x44d803[_0x95d5('0x32')][_0x95d5('0x34')]?_0x44d803['attributes']:_0x362b8['model'];if(_0x333459[_0x95d5('0x2e')][_0x95d5('0x35')]){_0x44d803[_0x95d5('0x36')]=[{'all':!![]}];}_0x44d803=_[_0x95d5('0x27')]({},_0x44d803,_0x333459['options']);return db[_0x95d5('0x37')]['find'](_0x44d803)[_0x95d5('0x21')](handleEntityNotFound(_0x21d4ff,null))[_0x95d5('0x21')](respondWithResult(_0x21d4ff,null))[_0x95d5('0x38')](handleError(_0x21d4ff,null));};exports['update']=function(_0x2b0891,_0x360edd){if(_0x2b0891[_0x95d5('0x39')]['id']){delete _0x2b0891[_0x95d5('0x39')]['id'];}return db[_0x95d5('0x37')][_0x95d5('0x3a')]({'where':{'id':_0x2b0891['params']['id']}})[_0x95d5('0x21')](handleEntityNotFound(_0x360edd,null))[_0x95d5('0x21')](saveUpdates(_0x2b0891[_0x95d5('0x39')],null))[_0x95d5('0x21')](respondWithResult(_0x360edd,null))[_0x95d5('0x38')](handleError(_0x360edd,null));};exports[_0x95d5('0x3b')]=function(_0x253815,_0x459059){return db[_0x95d5('0x37')][_0x95d5('0x3a')]({'where':{'id':_0x253815['params']['id']}})['then'](handleEntityNotFound(_0x459059,null))[_0x95d5('0x21')](removeEntity(_0x459059,null))[_0x95d5('0x38')](handleError(_0x459059,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index e501f1d..8f28f27 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index dbd8c77..1035b7c 100644 --- a/server/api/chatApplication/chatApplication.rpc.js +++ b/server/api/chatApplication/chatApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0d2=['then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1e4e8b,_0x59ecba){var _0x2d34c4=function(_0x522685){while(--_0x522685){_0x1e4e8b['push'](_0x1e4e8b['shift']());}};_0x2d34c4(++_0x59ecba);}(_0xc0d2,0x14d));var _0x2c0d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc0d2[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x2c0d('0x0'));var moment=require(_0x2c0d('0x1'));var BPromise=require('bluebird');var rs=require(_0x2c0d('0x2'));var fs=require('fs');var Redis=require(_0x2c0d('0x3'));var db=require(_0x2c0d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c0d('0x5'))(_0x2c0d('0x6'));var config=require(_0x2c0d('0x7'));var jayson=require(_0x2c0d('0x8'));var client=jayson[_0x2c0d('0x9')][_0x2c0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5a55,_0x47f00b,_0x2186be){return new BPromise(function(_0x212c02,_0x2e163c){return client[_0x2c0d('0xb')](_0x4c5a55,_0x2186be)[_0x2c0d('0xc')](function(_0x1898f7){logger['info']('ChatApplication,\x20%s,\x20%s',_0x47f00b,_0x2c0d('0xd'));logger[_0x2c0d('0xe')](_0x2c0d('0xf'),_0x47f00b,_0x2c0d('0xd'),JSON[_0x2c0d('0x10')](_0x1898f7));if(_0x1898f7[_0x2c0d('0x11')]){if(_0x1898f7[_0x2c0d('0x11')][_0x2c0d('0x12')]===0x1f4){logger[_0x2c0d('0x11')](_0x2c0d('0x13'),_0x47f00b,_0x1898f7['error'][_0x2c0d('0x14')]);return _0x2e163c(_0x1898f7[_0x2c0d('0x11')][_0x2c0d('0x14')]);}logger[_0x2c0d('0x11')](_0x2c0d('0x13'),_0x47f00b,_0x1898f7[_0x2c0d('0x11')]['message']);return _0x212c02(_0x1898f7['error'][_0x2c0d('0x14')]);}else{logger['info'](_0x2c0d('0x13'),_0x47f00b,_0x2c0d('0xd'));_0x212c02(_0x1898f7[_0x2c0d('0x15')][_0x2c0d('0x14')]);}})[_0x2c0d('0x16')](function(_0x2568d9){logger['error']('ChatApplication,\x20%s,\x20%s',_0x47f00b,_0x2568d9);_0x2e163c(_0x2568d9);});});} \ No newline at end of file +var _0x7b53=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x51c80b,_0x42d93a){var _0x5cb0d4=function(_0x18a82d){while(--_0x18a82d){_0x51c80b['push'](_0x51c80b['shift']());}};_0x5cb0d4(++_0x42d93a);}(_0x7b53,0x78));var _0x37b5=function(_0x255706,_0x4e7e0e){_0x255706=_0x255706-0x0;var _0xd7c8f3=_0x7b53[_0x255706];return _0xd7c8f3;};'use strict';var _=require(_0x37b5('0x0'));var util=require('util');var moment=require(_0x37b5('0x1'));var BPromise=require(_0x37b5('0x2'));var rs=require(_0x37b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x37b5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x37b5('0x5'));var config=require(_0x37b5('0x6'));var jayson=require(_0x37b5('0x7'));var client=jayson[_0x37b5('0x8')][_0x37b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2da23b,_0x2fe85f,_0x474faf){return new BPromise(function(_0x323d62,_0x8cd9ae){return client[_0x37b5('0xa')](_0x2da23b,_0x474faf)[_0x37b5('0xb')](function(_0x18313d){logger[_0x37b5('0xc')](_0x37b5('0xd'),_0x2fe85f,_0x37b5('0xe'));logger['debug'](_0x37b5('0xf'),_0x2fe85f,_0x37b5('0xe'),JSON[_0x37b5('0x10')](_0x18313d));if(_0x18313d[_0x37b5('0x11')]){if(_0x18313d[_0x37b5('0x11')][_0x37b5('0x12')]===0x1f4){logger[_0x37b5('0x11')](_0x37b5('0xd'),_0x2fe85f,_0x18313d[_0x37b5('0x11')][_0x37b5('0x13')]);return _0x8cd9ae(_0x18313d[_0x37b5('0x11')][_0x37b5('0x13')]);}logger[_0x37b5('0x11')](_0x37b5('0xd'),_0x2fe85f,_0x18313d[_0x37b5('0x11')][_0x37b5('0x13')]);return _0x323d62(_0x18313d[_0x37b5('0x11')][_0x37b5('0x13')]);}else{logger['info'](_0x37b5('0xd'),_0x2fe85f,_0x37b5('0xe'));_0x323d62(_0x18313d[_0x37b5('0x14')][_0x37b5('0x13')]);}})[_0x37b5('0x15')](function(_0x4bf2a5){logger['error']('ChatApplication,\x20%s,\x20%s',_0x2fe85f,_0x4bf2a5);_0x8cd9ae(_0x4bf2a5);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 100df0c..9950418 100644 --- a/server/api/chatApplication/index.js +++ b/server/api/chatApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe699=['../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xe699,0x15a));var _0x9e69=function(_0x334127,_0x35b19a){_0x334127=_0x334127-0x0;var _0x6b4dd9=_0xe699[_0x334127];return _0x6b4dd9;};'use strict';var multer=require(_0x9e69('0x0'));var util=require(_0x9e69('0x1'));var path=require(_0x9e69('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e69('0x3')]();var fs_extra=require(_0x9e69('0x4'));var auth=require(_0x9e69('0x5'));var interaction=require(_0x9e69('0x6'));var config=require(_0x9e69('0x7'));var controller=require(_0x9e69('0x8'));router['get'](_0x9e69('0x9'),auth[_0x9e69('0xa')](),controller[_0x9e69('0xb')]);router[_0x9e69('0xc')]('/:id',auth[_0x9e69('0xa')](),controller['update']);router[_0x9e69('0xd')](_0x9e69('0x9'),auth[_0x9e69('0xa')](),controller[_0x9e69('0xe')]);module[_0x9e69('0xf')]=router; \ No newline at end of file +var _0xfdb8=['fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','put','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x246cf2,_0x386e6f){var _0xe3760c=function(_0x30d869){while(--_0x30d869){_0x246cf2['push'](_0x246cf2['shift']());}};_0xe3760c(++_0x386e6f);}(_0xfdb8,0xdb));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8fdb('0x0'));var util=require('util');var path=require(_0x8fdb('0x1'));var timeout=require(_0x8fdb('0x2'));var express=require(_0x8fdb('0x3'));var router=express[_0x8fdb('0x4')]();var fs_extra=require(_0x8fdb('0x5'));var auth=require(_0x8fdb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8fdb('0x7'));var controller=require(_0x8fdb('0x8'));router[_0x8fdb('0x9')](_0x8fdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8fdb('0xb')]('/:id',auth[_0x8fdb('0xc')](),controller[_0x8fdb('0xd')]);router[_0x8fdb('0xe')](_0x8fdb('0xa'),auth[_0x8fdb('0xc')](),controller[_0x8fdb('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 2625a5d..d84dcda 100644 --- a/server/api/chatGroup/chatGroup.attributes.js +++ b/server/api/chatGroup/chatGroup.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bb0=['sequelize','exports','STRING'];(function(_0x3ff73b,_0x228451){var _0x191517=function(_0x325c6c){while(--_0x325c6c){_0x3ff73b['push'](_0x3ff73b['shift']());}};_0x191517(++_0x228451);}(_0x5bb0,0x12f));var _0x05bb=function(_0x389c69,_0x4ed7b5){_0x389c69=_0x389c69-0x0;var _0x12c459=_0x5bb0[_0x389c69];return _0x12c459;};'use strict';var Sequelize=require(_0x05bb('0x0'));module[_0x05bb('0x1')]={'name':{'type':Sequelize[_0x05bb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x05bb('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5bf2=['BOOLEAN','sequelize','STRING'];(function(_0x52ce5d,_0x3f83c1){var _0x237652=function(_0x4993c1){while(--_0x4993c1){_0x52ce5d['push'](_0x52ce5d['shift']());}};_0x237652(++_0x3f83c1);}(_0x5bf2,0x14b));var _0x25bf=function(_0x126021,_0x305f68){_0x126021=_0x126021-0x0;var _0x2bdb37=_0x5bf2[_0x126021];return _0x2bdb37;};'use strict';var Sequelize=require(_0x25bf('0x0'));module['exports']={'name':{'type':Sequelize[_0x25bf('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x25bf('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 8099188..6b79184 100644 --- a/server/api/chatGroup/chatGroup.controller.js +++ b/server/api/chatGroup/chatGroup.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac22=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','./chatGroup.socket','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','message','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','end','stack','name','send','merge','body','contact','interaction','account','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','where','filters','pick','filter','includeAll','include','findAll','rows','catch','show','params','find','create','update','describe','getUnread','user','addMembers','omit','getMembers','findOne','sort','options','nolimit','removeMembers','ids','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xac22,0x138));var _0x2ac2=function(_0x2427a7,_0x2a0f2e){_0x2427a7=_0x2427a7-0x0;var _0x54adad=_0xac22[_0x2427a7];return _0x54adad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ac2('0x0'));var zipdir=require(_0x2ac2('0x1'));var jsonpatch=require(_0x2ac2('0x2'));var rp=require(_0x2ac2('0x3'));var moment=require(_0x2ac2('0x4'));var BPromise=require(_0x2ac2('0x5'));var Mustache=require(_0x2ac2('0x6'));var util=require('util');var path=require(_0x2ac2('0x7'));var sox=require(_0x2ac2('0x8'));var csv=require(_0x2ac2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ac2('0xa'));var _=require(_0x2ac2('0xb'));var squel=require('squel');var crypto=require(_0x2ac2('0xc'));var jsforce=require(_0x2ac2('0xd'));var deskjs=require(_0x2ac2('0xe'));var toCsv=require(_0x2ac2('0x9'));var querystring=require(_0x2ac2('0xf'));var Papa=require(_0x2ac2('0x10'));var Redis=require(_0x2ac2('0x11'));var authService=require(_0x2ac2('0x12'));var qs=require(_0x2ac2('0x13'));var as=require(_0x2ac2('0x14'));var hardwareService=require(_0x2ac2('0x15'));var logger=require(_0x2ac2('0x16'))('api');var utils=require(_0x2ac2('0x17'));var config=require(_0x2ac2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ac2('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ac2('0x1a')]));require(_0x2ac2('0x1b'))[_0x2ac2('0x1c')](socket);var jayson=require(_0x2ac2('0x1d'));var client=jayson[_0x2ac2('0x1e')][_0x2ac2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x41fb58,_0x5c3458,_0x156864,_0x27a4de){return new BPromise(function(_0x55ef25,_0xa6f4c){var _0x496cf0=_0x27a4de||client;return _0x496cf0[_0x2ac2('0x20')](_0x41fb58,_0x156864)[_0x2ac2('0x21')](function(_0x32679c){logger[_0x2ac2('0x22')](_0x2ac2('0x23'),_0x5c3458,_0x2ac2('0x24'));logger[_0x2ac2('0x25')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5c3458,'request\x20sent',JSON['stringify'](_0x32679c));if(_0x32679c[_0x2ac2('0x26')]){if(_0x32679c[_0x2ac2('0x26')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5c3458,_0x32679c[_0x2ac2('0x26')][_0x2ac2('0x27')]);return _0xa6f4c(_0x32679c[_0x2ac2('0x26')][_0x2ac2('0x27')]);}logger[_0x2ac2('0x26')](_0x2ac2('0x23'),_0x5c3458,_0x32679c[_0x2ac2('0x26')]['message']);return _0x55ef25(_0x32679c[_0x2ac2('0x26')][_0x2ac2('0x27')]);}else{logger[_0x2ac2('0x22')](_0x2ac2('0x23'),_0x5c3458,_0x2ac2('0x24'));_0x55ef25(_0x32679c['result']['message']);}})['catch'](function(_0x4bf8e3){logger[_0x2ac2('0x26')](_0x2ac2('0x23'),_0x5c3458,_0x4bf8e3);_0xa6f4c(_0x4bf8e3);});});}function respondWithStatusCode(_0x260086,_0x24ac47){_0x24ac47=_0x24ac47||0xcc;return function(_0x4b2c3e){if(_0x4b2c3e){return _0x260086[_0x2ac2('0x28')](_0x24ac47);}return _0x260086['status'](_0x24ac47)['end']();};}function respondWithResult(_0x26a9c0,_0x46db0a){_0x46db0a=_0x46db0a||0xc8;return function(_0x135aa3){if(_0x135aa3){return _0x26a9c0[_0x2ac2('0x29')](_0x46db0a)['json'](_0x135aa3);}};}function respondWithFilteredResult(_0x40b2cd,_0x4d68a2){return function(_0x5dcb54){if(_0x5dcb54){var _0x580ca0=typeof _0x4d68a2[_0x2ac2('0x2a')]===_0x2ac2('0x2b')&&typeof _0x4d68a2[_0x2ac2('0x2c')]===_0x2ac2('0x2b');var _0x3649ab=_0x5dcb54['count'];var _0x3dfacc=_0x580ca0?0x0:_0x4d68a2['offset'];var _0x243a7d=_0x580ca0?_0x5dcb54[_0x2ac2('0x2d')]:_0x4d68a2[_0x2ac2('0x2a')]+_0x4d68a2[_0x2ac2('0x2c')];var _0x185cd8;if(_0x243a7d>=_0x3649ab){_0x243a7d=_0x3649ab;_0x185cd8=0xc8;}else{_0x185cd8=0xce;}_0x40b2cd['status'](_0x185cd8);return _0x40b2cd[_0x2ac2('0x2e')](_0x2ac2('0x2f'),_0x3dfacc+'-'+_0x243a7d+'/'+_0x3649ab)[_0x2ac2('0x30')](_0x5dcb54);}return null;};}function patchUpdates(_0x36e406){return function(_0x55e0b7){try{jsonpatch[_0x2ac2('0x31')](_0x55e0b7,_0x36e406,!![]);}catch(_0x4f156f){return BPromise[_0x2ac2('0x32')](_0x4f156f);}return _0x55e0b7['save']();};}function saveUpdates(_0x202a4d,_0x10b263){return function(_0x1f5148){if(_0x1f5148){return _0x1f5148['update'](_0x202a4d)['then'](function(_0x47f828){return _0x47f828;});}return null;};}function removeEntity(_0x28eac0,_0x54b3ff){return function(_0x74d930){if(_0x74d930){return _0x74d930[_0x2ac2('0x33')]()[_0x2ac2('0x21')](function(){_0x28eac0[_0x2ac2('0x29')](0xcc)[_0x2ac2('0x34')]();});}};}function handleEntityNotFound(_0x2af9de,_0x2ec7b3){return function(_0x57aaec){if(!_0x57aaec){_0x2af9de[_0x2ac2('0x28')](0x194);}return _0x57aaec;};}function handleError(_0x1279db,_0x4757dc){_0x4757dc=_0x4757dc||0x1f4;return function(_0x475fff){logger[_0x2ac2('0x26')](_0x475fff[_0x2ac2('0x35')]);if(_0x475fff[_0x2ac2('0x36')]){delete _0x475fff[_0x2ac2('0x36')];}_0x1279db[_0x2ac2('0x29')](_0x4757dc)[_0x2ac2('0x37')](_0x475fff);};}function getMustacheRender(_0x136abf,_0x3b4111){return Mustache['render'](_0x136abf,_[_0x2ac2('0x38')](_0x3b4111[_0x2ac2('0x39')],{'contact':_0x3b4111[_0x2ac2('0x3a')],'message':_0x3b4111['message'],'agent':_0x3b4111['agent'],'interaction':_0x3b4111[_0x2ac2('0x3b')],'account':_0x3b4111[_0x2ac2('0x3c')]}))||'';}exports[_0x2ac2('0x3d')]=function(_0x5ae1a6,_0x3d828a){var _0x4f5d66={},_0x16c4db={},_0x225e9b={'count':0x0,'rows':[]};var _0x34b15e=_[_0x2ac2('0x3e')](db[_0x2ac2('0x3f')][_0x2ac2('0x40')],function(_0x2c3de3){return{'name':_0x2c3de3[_0x2ac2('0x41')],'type':_0x2c3de3[_0x2ac2('0x42')][_0x2ac2('0x43')]};});_0x16c4db[_0x2ac2('0x44')]=_[_0x2ac2('0x3e')](_0x34b15e,_0x2ac2('0x36'));_0x16c4db[_0x2ac2('0x45')]=_[_0x2ac2('0x46')](_0x5ae1a6['query']);_0x16c4db['filters']=_[_0x2ac2('0x47')](_0x16c4db['model'],_0x16c4db[_0x2ac2('0x45')]);_0x4f5d66['attributes']=_['intersection'](_0x16c4db['model'],qs['fields'](_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x48')]));_0x4f5d66['attributes']=_0x4f5d66[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x4f5d66[_0x2ac2('0x49')]:_0x16c4db[_0x2ac2('0x44')];if(!_0x5ae1a6['query'][_0x2ac2('0x4b')]('nolimit')){_0x4f5d66[_0x2ac2('0x2c')]=qs[_0x2ac2('0x2c')](_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x2c')]);_0x4f5d66['offset']=qs[_0x2ac2('0x2a')](_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x2a')]);}_0x4f5d66[_0x2ac2('0x4c')]=qs['sort'](_0x5ae1a6[_0x2ac2('0x45')]['sort']);_0x4f5d66[_0x2ac2('0x4d')]=qs[_0x2ac2('0x4e')](_[_0x2ac2('0x4f')](_0x5ae1a6[_0x2ac2('0x45')],_0x16c4db['filters']),_0x34b15e);if(_0x5ae1a6['query'][_0x2ac2('0x50')]){_0x4f5d66[_0x2ac2('0x4d')]=_[_0x2ac2('0x38')](_0x4f5d66[_0x2ac2('0x4d')],{'$or':_[_0x2ac2('0x3e')](_0x34b15e,function(_0x19be9e){if(_0x19be9e[_0x2ac2('0x42')]!=='VIRTUAL'){var _0x3c42ff={};_0x3c42ff[_0x19be9e['name']]={'$like':'%'+_0x5ae1a6[_0x2ac2('0x45')]['filter']+'%'};return _0x3c42ff;}})});}_0x4f5d66=_['merge']({},_0x4f5d66,_0x5ae1a6['options']);var _0x3600c6={'where':_0x4f5d66[_0x2ac2('0x4d')]};return db[_0x2ac2('0x3f')][_0x2ac2('0x2d')](_0x3600c6)[_0x2ac2('0x21')](function(_0xe0765a){_0x225e9b[_0x2ac2('0x2d')]=_0xe0765a;if(_0x5ae1a6[_0x2ac2('0x45')][_0x2ac2('0x51')]){_0x4f5d66[_0x2ac2('0x52')]=[{'all':!![]}];}return db[_0x2ac2('0x3f')][_0x2ac2('0x53')](_0x4f5d66);})[_0x2ac2('0x21')](function(_0x1dc83e){_0x225e9b[_0x2ac2('0x54')]=_0x1dc83e;return _0x225e9b;})[_0x2ac2('0x21')](respondWithFilteredResult(_0x3d828a,_0x4f5d66))[_0x2ac2('0x55')](handleError(_0x3d828a,null));};exports[_0x2ac2('0x56')]=function(_0x4cfee9,_0x50d076){var _0x534858={'raw':!![],'where':{'id':_0x4cfee9[_0x2ac2('0x57')]['id']}},_0x35f874={};_0x35f874[_0x2ac2('0x44')]=_[_0x2ac2('0x46')](db[_0x2ac2('0x3f')][_0x2ac2('0x40')]);_0x35f874[_0x2ac2('0x45')]=_[_0x2ac2('0x46')](_0x4cfee9[_0x2ac2('0x45')]);_0x35f874[_0x2ac2('0x4e')]=_[_0x2ac2('0x47')](_0x35f874[_0x2ac2('0x44')],_0x35f874[_0x2ac2('0x45')]);_0x534858[_0x2ac2('0x49')]=_[_0x2ac2('0x47')](_0x35f874[_0x2ac2('0x44')],qs['fields'](_0x4cfee9[_0x2ac2('0x45')][_0x2ac2('0x48')]));_0x534858[_0x2ac2('0x49')]=_0x534858[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x534858[_0x2ac2('0x49')]:_0x35f874['model'];if(_0x4cfee9[_0x2ac2('0x45')]['includeAll']){_0x534858[_0x2ac2('0x52')]=[{'all':!![]}];}_0x534858=_[_0x2ac2('0x38')]({},_0x534858,_0x4cfee9['options']);return db['ChatGroup'][_0x2ac2('0x58')](_0x534858)[_0x2ac2('0x21')](handleEntityNotFound(_0x50d076,null))['then'](respondWithResult(_0x50d076,null))['catch'](handleError(_0x50d076,null));};exports[_0x2ac2('0x59')]=function(_0x5b02be,_0x4382d8){return db[_0x2ac2('0x3f')][_0x2ac2('0x59')](_0x5b02be['body'],{})[_0x2ac2('0x21')](respondWithResult(_0x4382d8,0xc9))[_0x2ac2('0x55')](handleError(_0x4382d8,null));};exports[_0x2ac2('0x5a')]=function(_0x4a3745,_0x5d84ba){if(_0x4a3745[_0x2ac2('0x39')]['id']){delete _0x4a3745[_0x2ac2('0x39')]['id'];}return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x4a3745[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x5d84ba,null))['then'](saveUpdates(_0x4a3745[_0x2ac2('0x39')],null))[_0x2ac2('0x21')](respondWithResult(_0x5d84ba,null))[_0x2ac2('0x55')](handleError(_0x5d84ba,null));};exports[_0x2ac2('0x33')]=function(_0x16fc54,_0x2983c2){return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x16fc54['params']['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x2983c2,null))[_0x2ac2('0x21')](removeEntity(_0x2983c2,null))[_0x2ac2('0x55')](handleError(_0x2983c2,null));};exports[_0x2ac2('0x5b')]=function(_0x1217d4,_0x46a9b6){return db[_0x2ac2('0x3f')][_0x2ac2('0x5b')]()[_0x2ac2('0x21')](respondWithResult(_0x46a9b6,null))[_0x2ac2('0x55')](handleError(_0x46a9b6,null));};exports[_0x2ac2('0x5c')]=function(_0x44e23f,_0x18df93,_0x29fd65){return db['ChatInternalMessage'][_0x2ac2('0x2d')]({'where':{'ChatGroupId':_0x44e23f[_0x2ac2('0x57')]['id'],'ToId':_0x44e23f[_0x2ac2('0x5d')]['id'],'read':![]}})['then'](function(_0x1c27e5){return{'id':_['toInteger'](_0x44e23f[_0x2ac2('0x57')]['id']),'count':_0x1c27e5};})['then'](respondWithResult(_0x18df93,null))['catch'](handleError(_0x18df93,null));};exports['addMembers']=function(_0x3c60d4,_0x721170,_0x39c0af){return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x3c60d4[_0x2ac2('0x57')]['id']}})['then'](handleEntityNotFound(_0x721170,null))[_0x2ac2('0x21')](function(_0x217b19){if(_0x217b19){return _0x217b19[_0x2ac2('0x5e')](_0x3c60d4[_0x2ac2('0x39')]['ids'],_[_0x2ac2('0x5f')](_0x3c60d4['body'],['ids','id'])||{});}})[_0x2ac2('0x21')](respondWithResult(_0x721170,null))[_0x2ac2('0x55')](handleError(_0x721170,null));};exports[_0x2ac2('0x60')]=function(_0x1ba21f,_0x2465aa,_0x58c8e4){var _0x131b54={};var _0x584a43={};var _0x586e22;var _0x2d4f89;return db[_0x2ac2('0x3f')][_0x2ac2('0x61')]({'where':{'id':_0x1ba21f[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x2465aa,null))['then'](function(_0x1be2d0){if(_0x1be2d0){_0x586e22=_0x1be2d0;_0x584a43[_0x2ac2('0x44')]=_[_0x2ac2('0x46')](db['User']['rawAttributes']);_0x584a43[_0x2ac2('0x45')]=_[_0x2ac2('0x46')](_0x1ba21f[_0x2ac2('0x45')]);_0x584a43[_0x2ac2('0x4e')]=_[_0x2ac2('0x47')](_0x584a43['model'],_0x584a43[_0x2ac2('0x45')]);_0x131b54[_0x2ac2('0x49')]=_['intersection'](_0x584a43['model'],qs[_0x2ac2('0x48')](_0x1ba21f['query'][_0x2ac2('0x48')]));_0x131b54[_0x2ac2('0x49')]=_0x131b54[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x131b54['attributes']:_0x584a43['model'];_0x131b54[_0x2ac2('0x4c')]=qs[_0x2ac2('0x62')](_0x1ba21f[_0x2ac2('0x45')][_0x2ac2('0x62')]);_0x131b54[_0x2ac2('0x4d')]=qs['filters'](_[_0x2ac2('0x4f')](_0x1ba21f[_0x2ac2('0x45')],_0x584a43['filters']));if(_0x1ba21f[_0x2ac2('0x45')][_0x2ac2('0x50')]){_0x131b54[_0x2ac2('0x4d')]=_[_0x2ac2('0x38')](_0x131b54['where'],{'$or':_[_0x2ac2('0x3e')](_0x131b54['attributes'],function(_0x55c1ae){var _0x594b79={};_0x594b79[_0x55c1ae]={'$like':'%'+_0x1ba21f['query'][_0x2ac2('0x50')]+'%'};return _0x594b79;})});}_0x131b54=_[_0x2ac2('0x38')]({},_0x131b54,_0x1ba21f[_0x2ac2('0x63')]);return _0x586e22[_0x2ac2('0x60')](_0x131b54);}})[_0x2ac2('0x21')](function(_0x65058a){if(_0x65058a){_0x2d4f89=_0x65058a[_0x2ac2('0x4a')];if(!_0x1ba21f['query']['hasOwnProperty'](_0x2ac2('0x64'))){_0x131b54[_0x2ac2('0x2c')]=qs[_0x2ac2('0x2c')](_0x1ba21f['query'][_0x2ac2('0x2c')]);_0x131b54['offset']=qs[_0x2ac2('0x2a')](_0x1ba21f[_0x2ac2('0x45')]['offset']);}return _0x586e22[_0x2ac2('0x60')](_0x131b54);}})[_0x2ac2('0x21')](function(_0x4c3313){if(_0x4c3313){return _0x4c3313?{'count':_0x2d4f89,'rows':_0x4c3313}:null;}})[_0x2ac2('0x21')](respondWithResult(_0x2465aa,null))[_0x2ac2('0x55')](handleError(_0x2465aa,null));};exports[_0x2ac2('0x65')]=function(_0x90eef9,_0x203e1f,_0x31dc42){return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x90eef9[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x203e1f,null))['then'](function(_0x1380b6){if(_0x1380b6){return _0x1380b6[_0x2ac2('0x65')](_0x90eef9[_0x2ac2('0x45')][_0x2ac2('0x66')]);}})[_0x2ac2('0x21')](respondWithStatusCode(_0x203e1f,null))[_0x2ac2('0x55')](handleError(_0x203e1f,null));};exports[_0x2ac2('0x67')]=function(_0x4aeae8,_0x36bebe,_0x4c489a){if(_0x4aeae8[_0x2ac2('0x39')]['id']){delete _0x4aeae8[_0x2ac2('0x39')]['id'];}return db[_0x2ac2('0x3f')][_0x2ac2('0x58')]({'where':{'id':_0x4aeae8[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x36bebe,null))['then'](function(_0x1419ca){if(_0x1419ca){_0x4aeae8[_0x2ac2('0x39')][_0x2ac2('0x68')]=_0x1419ca['id'];return db['ChatInternalMessage']['create'](_0x4aeae8['body']);}})['then'](respondWithResult(_0x36bebe,null))['catch'](handleError(_0x36bebe,null));};exports['getMessages']=function(_0x2b92c7,_0x2d6568,_0x2cea99){var _0x335475={};var _0x532639={};var _0x12a934;var _0x118270;return db['ChatGroup'][_0x2ac2('0x61')]({'where':{'id':_0x2b92c7[_0x2ac2('0x57')]['id']}})[_0x2ac2('0x21')](handleEntityNotFound(_0x2d6568,null))[_0x2ac2('0x21')](function(_0x295316){if(_0x295316){_0x12a934=_0x295316;_0x532639[_0x2ac2('0x44')]=_[_0x2ac2('0x46')](db['ChatInternalMessage'][_0x2ac2('0x40')]);_0x532639[_0x2ac2('0x45')]=_['keys'](_0x2b92c7[_0x2ac2('0x45')]);_0x532639[_0x2ac2('0x4e')]=_[_0x2ac2('0x47')](_0x532639['model'],_0x532639[_0x2ac2('0x45')]);_0x335475[_0x2ac2('0x49')]=_['intersection'](_0x532639[_0x2ac2('0x44')],qs[_0x2ac2('0x48')](_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x48')]));_0x335475[_0x2ac2('0x49')]=_0x335475[_0x2ac2('0x49')][_0x2ac2('0x4a')]?_0x335475['attributes']:_0x532639[_0x2ac2('0x44')];_0x335475[_0x2ac2('0x4c')]=qs['sort'](_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x62')]);_0x335475[_0x2ac2('0x4d')]=qs[_0x2ac2('0x4e')](_[_0x2ac2('0x4f')](_0x2b92c7['query'],_0x532639[_0x2ac2('0x4e')]));if(_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x50')]){_0x335475[_0x2ac2('0x4d')]=_['merge'](_0x335475[_0x2ac2('0x4d')],{'$or':_[_0x2ac2('0x3e')](_0x335475[_0x2ac2('0x49')],function(_0x420d7b){var _0x261538={};_0x261538[_0x420d7b]={'$like':'%'+_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x50')]+'%'};return _0x261538;})});}if(_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x69')]){var _0x1cb225=_0x2b92c7[_0x2ac2('0x45')][_0x2ac2('0x69')][_0x2ac2('0x6a')](',');var _0x12351f={};_0x12351f[_0x1cb225[0x0]]={'$gte':moment(_0x1cb225[0x1])[_0x2ac2('0x6b')](_0x2ac2('0x6c'))};_0x335475[_0x2ac2('0x4d')]=_['merge'](_0x335475[_0x2ac2('0x4d')],_0x12351f);}_0x335475=_[_0x2ac2('0x38')]({},_0x335475,_0x2b92c7['options']);return _0x12a934['getMessages'](_0x335475);}})[_0x2ac2('0x21')](function(_0x12edef){if(_0x12edef){_0x118270=_0x12edef[_0x2ac2('0x4a')];if(!_0x2b92c7['query'][_0x2ac2('0x4b')](_0x2ac2('0x64'))){_0x335475['limit']=qs[_0x2ac2('0x2c')](_0x2b92c7['query'][_0x2ac2('0x2c')]);_0x335475['offset']=qs[_0x2ac2('0x2a')](_0x2b92c7['query'][_0x2ac2('0x2a')]);}return _0x12a934[_0x2ac2('0x6d')](_0x335475);}})[_0x2ac2('0x21')](function(_0x7f59dc){if(_0x7f59dc){return _0x7f59dc?{'count':_0x118270,'rows':_0x7f59dc}:null;}})[_0x2ac2('0x21')](respondWithResult(_0x2d6568,null))[_0x2ac2('0x55')](handleError(_0x2d6568,null));}; \ No newline at end of file +var _0xecea=['user','addMembers','ids','omit','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','status','offset','undefined','limit','count','set','apply','reject','save','update','sendStatus','stack','render','merge','body','contact','interaction','map','ChatGroup','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','fields','include','find','create','destroy','params','describe','getUnread'];(function(_0x2577ac,_0x221bb5){var _0x2da5b7=function(_0x5b1a91){while(--_0x5b1a91){_0x2577ac['push'](_0x2577ac['shift']());}};_0x2da5b7(++_0x221bb5);}(_0xecea,0x7d));var _0xaece=function(_0x56df54,_0x268def){_0x56df54=_0x56df54-0x0;var _0x2b146b=_0xecea[_0x56df54];return _0x2b146b;};'use strict';var emlformat=require(_0xaece('0x0'));var rimraf=require(_0xaece('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaece('0x2'));var rp=require(_0xaece('0x3'));var moment=require(_0xaece('0x4'));var BPromise=require(_0xaece('0x5'));var Mustache=require(_0xaece('0x6'));var util=require(_0xaece('0x7'));var path=require(_0xaece('0x8'));var sox=require('sox');var csv=require(_0xaece('0x9'));var ejs=require(_0xaece('0xa'));var fs=require('fs');var fs_extra=require(_0xaece('0xb'));var _=require(_0xaece('0xc'));var squel=require(_0xaece('0xd'));var crypto=require(_0xaece('0xe'));var jsforce=require(_0xaece('0xf'));var deskjs=require(_0xaece('0x10'));var toCsv=require(_0xaece('0x9'));var querystring=require('querystring');var Papa=require(_0xaece('0x11'));var Redis=require(_0xaece('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaece('0x13'));var as=require(_0xaece('0x14'));var hardwareService=require(_0xaece('0x15'));var logger=require(_0xaece('0x16'))(_0xaece('0x17'));var utils=require(_0xaece('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaece('0x19'))['db'];config[_0xaece('0x1a')]=_[_0xaece('0x1b')](config[_0xaece('0x1a')],{'host':_0xaece('0x1c'),'port':0x18eb});var socket=require(_0xaece('0x1d'))(new Redis(config[_0xaece('0x1a')]));require(_0xaece('0x1e'))['register'](socket);var jayson=require(_0xaece('0x1f'));var client=jayson[_0xaece('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x421a71,_0x526d0c,_0x20b1f8,_0x23ab75){return new BPromise(function(_0x4c941a,_0x3839a0){var _0x29044c=_0x23ab75||client;return _0x29044c['request'](_0x421a71,_0x20b1f8)[_0xaece('0x21')](function(_0x3b2f5a){logger['info'](_0xaece('0x22'),_0x526d0c,_0xaece('0x23'));logger[_0xaece('0x24')](_0xaece('0x25'),_0x526d0c,_0xaece('0x23'),JSON[_0xaece('0x26')](_0x3b2f5a));if(_0x3b2f5a[_0xaece('0x27')]){if(_0x3b2f5a[_0xaece('0x27')]['code']===0x1f4){logger[_0xaece('0x27')](_0xaece('0x22'),_0x526d0c,_0x3b2f5a[_0xaece('0x27')][_0xaece('0x28')]);return _0x3839a0(_0x3b2f5a[_0xaece('0x27')][_0xaece('0x28')]);}logger[_0xaece('0x27')](_0xaece('0x22'),_0x526d0c,_0x3b2f5a[_0xaece('0x27')]['message']);return _0x4c941a(_0x3b2f5a[_0xaece('0x27')][_0xaece('0x28')]);}else{logger[_0xaece('0x29')](_0xaece('0x22'),_0x526d0c,_0xaece('0x23'));_0x4c941a(_0x3b2f5a[_0xaece('0x2a')][_0xaece('0x28')]);}})[_0xaece('0x2b')](function(_0x502457){logger['error'](_0xaece('0x22'),_0x526d0c,_0x502457);_0x3839a0(_0x502457);});});}function respondWithStatusCode(_0x5d9636,_0x1ed82b){_0x1ed82b=_0x1ed82b||0xcc;return function(_0x598626){if(_0x598626){return _0x5d9636['sendStatus'](_0x1ed82b);}return _0x5d9636['status'](_0x1ed82b)[_0xaece('0x2c')]();};}function respondWithResult(_0x1b250b,_0x2b7853){_0x2b7853=_0x2b7853||0xc8;return function(_0x495e40){if(_0x495e40){return _0x1b250b[_0xaece('0x2d')](_0x2b7853)['json'](_0x495e40);}};}function respondWithFilteredResult(_0x5e250d,_0x25a354){return function(_0x417567){if(_0x417567){var _0x3cb107=typeof _0x25a354[_0xaece('0x2e')]===_0xaece('0x2f')&&typeof _0x25a354[_0xaece('0x30')]===_0xaece('0x2f');var _0x409459=_0x417567[_0xaece('0x31')];var _0x4fa0cc=_0x3cb107?0x0:_0x25a354['offset'];var _0x4c6d44=_0x3cb107?_0x417567[_0xaece('0x31')]:_0x25a354[_0xaece('0x2e')]+_0x25a354[_0xaece('0x30')];var _0x1cb87f;if(_0x4c6d44>=_0x409459){_0x4c6d44=_0x409459;_0x1cb87f=0xc8;}else{_0x1cb87f=0xce;}_0x5e250d['status'](_0x1cb87f);return _0x5e250d[_0xaece('0x32')]('Content-Range',_0x4fa0cc+'-'+_0x4c6d44+'/'+_0x409459)['json'](_0x417567);}return null;};}function patchUpdates(_0x1062dc){return function(_0x14fa11){try{jsonpatch[_0xaece('0x33')](_0x14fa11,_0x1062dc,!![]);}catch(_0x3cc5ef){return BPromise[_0xaece('0x34')](_0x3cc5ef);}return _0x14fa11[_0xaece('0x35')]();};}function saveUpdates(_0x2d0828,_0x2b35a0){return function(_0x46bf63){if(_0x46bf63){return _0x46bf63[_0xaece('0x36')](_0x2d0828)[_0xaece('0x21')](function(_0x236ee5){return _0x236ee5;});}return null;};}function removeEntity(_0x40e20d,_0x3535af){return function(_0x4bacd9){if(_0x4bacd9){return _0x4bacd9['destroy']()[_0xaece('0x21')](function(){_0x40e20d[_0xaece('0x2d')](0xcc)[_0xaece('0x2c')]();});}};}function handleEntityNotFound(_0x4f208b,_0x5a549c){return function(_0x4d968b){if(!_0x4d968b){_0x4f208b[_0xaece('0x37')](0x194);}return _0x4d968b;};}function handleError(_0x4189bb,_0x4de755){_0x4de755=_0x4de755||0x1f4;return function(_0xc60a39){logger[_0xaece('0x27')](_0xc60a39[_0xaece('0x38')]);if(_0xc60a39['name']){delete _0xc60a39['name'];}_0x4189bb[_0xaece('0x2d')](_0x4de755)['send'](_0xc60a39);};}function getMustacheRender(_0x50a5ae,_0x10d351){return Mustache[_0xaece('0x39')](_0x50a5ae,_[_0xaece('0x3a')](_0x10d351[_0xaece('0x3b')],{'contact':_0x10d351[_0xaece('0x3c')],'message':_0x10d351['message'],'agent':_0x10d351['agent'],'interaction':_0x10d351[_0xaece('0x3d')],'account':_0x10d351['account']}))||'';}exports['index']=function(_0x3a9111,_0x1e05d7){var _0x4957a0={},_0x1cf960={},_0x50b1ba={'count':0x0,'rows':[]};var _0x36f6ea=_[_0xaece('0x3e')](db[_0xaece('0x3f')][_0xaece('0x40')],function(_0x11afac){return{'name':_0x11afac[_0xaece('0x41')],'type':_0x11afac[_0xaece('0x42')]['key']};});_0x1cf960[_0xaece('0x43')]=_['map'](_0x36f6ea,_0xaece('0x44'));_0x1cf960[_0xaece('0x45')]=_['keys'](_0x3a9111['query']);_0x1cf960[_0xaece('0x46')]=_[_0xaece('0x47')](_0x1cf960[_0xaece('0x43')],_0x1cf960['query']);_0x4957a0[_0xaece('0x48')]=_[_0xaece('0x47')](_0x1cf960[_0xaece('0x43')],qs['fields'](_0x3a9111[_0xaece('0x45')]['fields']));_0x4957a0['attributes']=_0x4957a0['attributes'][_0xaece('0x49')]?_0x4957a0[_0xaece('0x48')]:_0x1cf960[_0xaece('0x43')];if(!_0x3a9111[_0xaece('0x45')]['hasOwnProperty'](_0xaece('0x4a'))){_0x4957a0[_0xaece('0x30')]=qs[_0xaece('0x30')](_0x3a9111['query'][_0xaece('0x30')]);_0x4957a0['offset']=qs[_0xaece('0x2e')](_0x3a9111[_0xaece('0x45')][_0xaece('0x2e')]);}_0x4957a0[_0xaece('0x4b')]=qs[_0xaece('0x4c')](_0x3a9111[_0xaece('0x45')][_0xaece('0x4c')]);_0x4957a0[_0xaece('0x4d')]=qs[_0xaece('0x46')](_[_0xaece('0x4e')](_0x3a9111[_0xaece('0x45')],_0x1cf960[_0xaece('0x46')]),_0x36f6ea);if(_0x3a9111[_0xaece('0x45')]['filter']){_0x4957a0[_0xaece('0x4d')]=_['merge'](_0x4957a0[_0xaece('0x4d')],{'$or':_[_0xaece('0x3e')](_0x36f6ea,function(_0x1b4e4f){if(_0x1b4e4f[_0xaece('0x42')]!==_0xaece('0x4f')){var _0x1ab93a={};_0x1ab93a[_0x1b4e4f['name']]={'$like':'%'+_0x3a9111[_0xaece('0x45')][_0xaece('0x50')]+'%'};return _0x1ab93a;}})});}_0x4957a0=_[_0xaece('0x3a')]({},_0x4957a0,_0x3a9111[_0xaece('0x51')]);var _0x31aa28={'where':_0x4957a0[_0xaece('0x4d')]};return db[_0xaece('0x3f')][_0xaece('0x31')](_0x31aa28)[_0xaece('0x21')](function(_0x10050f){_0x50b1ba['count']=_0x10050f;if(_0x3a9111[_0xaece('0x45')][_0xaece('0x52')]){_0x4957a0['include']=[{'all':!![]}];}return db[_0xaece('0x3f')][_0xaece('0x53')](_0x4957a0);})[_0xaece('0x21')](function(_0x5574f2){_0x50b1ba[_0xaece('0x54')]=_0x5574f2;return _0x50b1ba;})[_0xaece('0x21')](respondWithFilteredResult(_0x1e05d7,_0x4957a0))[_0xaece('0x2b')](handleError(_0x1e05d7,null));};exports[_0xaece('0x55')]=function(_0x1f62a9,_0x4d6e6b){var _0x4482d5={'raw':!![],'where':{'id':_0x1f62a9['params']['id']}},_0x15be5e={};_0x15be5e[_0xaece('0x43')]=_[_0xaece('0x56')](db[_0xaece('0x3f')]['rawAttributes']);_0x15be5e['query']=_[_0xaece('0x56')](_0x1f62a9['query']);_0x15be5e['filters']=_[_0xaece('0x47')](_0x15be5e[_0xaece('0x43')],_0x15be5e[_0xaece('0x45')]);_0x4482d5[_0xaece('0x48')]=_[_0xaece('0x47')](_0x15be5e[_0xaece('0x43')],qs[_0xaece('0x57')](_0x1f62a9['query'][_0xaece('0x57')]));_0x4482d5[_0xaece('0x48')]=_0x4482d5[_0xaece('0x48')][_0xaece('0x49')]?_0x4482d5[_0xaece('0x48')]:_0x15be5e['model'];if(_0x1f62a9[_0xaece('0x45')][_0xaece('0x52')]){_0x4482d5[_0xaece('0x58')]=[{'all':!![]}];}_0x4482d5=_[_0xaece('0x3a')]({},_0x4482d5,_0x1f62a9[_0xaece('0x51')]);return db[_0xaece('0x3f')][_0xaece('0x59')](_0x4482d5)[_0xaece('0x21')](handleEntityNotFound(_0x4d6e6b,null))[_0xaece('0x21')](respondWithResult(_0x4d6e6b,null))[_0xaece('0x2b')](handleError(_0x4d6e6b,null));};exports[_0xaece('0x5a')]=function(_0x23eebb,_0x32ddbf){return db[_0xaece('0x3f')][_0xaece('0x5a')](_0x23eebb[_0xaece('0x3b')],{})[_0xaece('0x21')](respondWithResult(_0x32ddbf,0xc9))[_0xaece('0x2b')](handleError(_0x32ddbf,null));};exports[_0xaece('0x36')]=function(_0x14474a,_0x5b0cb7){if(_0x14474a[_0xaece('0x3b')]['id']){delete _0x14474a[_0xaece('0x3b')]['id'];}return db['ChatGroup'][_0xaece('0x59')]({'where':{'id':_0x14474a['params']['id']}})[_0xaece('0x21')](handleEntityNotFound(_0x5b0cb7,null))[_0xaece('0x21')](saveUpdates(_0x14474a[_0xaece('0x3b')],null))['then'](respondWithResult(_0x5b0cb7,null))[_0xaece('0x2b')](handleError(_0x5b0cb7,null));};exports[_0xaece('0x5b')]=function(_0xf7d5c1,_0x1d0f31){return db[_0xaece('0x3f')]['find']({'where':{'id':_0xf7d5c1[_0xaece('0x5c')]['id']}})[_0xaece('0x21')](handleEntityNotFound(_0x1d0f31,null))[_0xaece('0x21')](removeEntity(_0x1d0f31,null))[_0xaece('0x2b')](handleError(_0x1d0f31,null));};exports[_0xaece('0x5d')]=function(_0x188568,_0x58f817){return db['ChatGroup'][_0xaece('0x5d')]()[_0xaece('0x21')](respondWithResult(_0x58f817,null))[_0xaece('0x2b')](handleError(_0x58f817,null));};exports[_0xaece('0x5e')]=function(_0x180b79,_0x122d8a,_0xf1723f){return db['ChatInternalMessage'][_0xaece('0x31')]({'where':{'ChatGroupId':_0x180b79[_0xaece('0x5c')]['id'],'ToId':_0x180b79[_0xaece('0x5f')]['id'],'read':![]}})[_0xaece('0x21')](function(_0x938d0c){return{'id':_['toInteger'](_0x180b79[_0xaece('0x5c')]['id']),'count':_0x938d0c};})[_0xaece('0x21')](respondWithResult(_0x122d8a,null))[_0xaece('0x2b')](handleError(_0x122d8a,null));};exports['addMembers']=function(_0x5298c0,_0x57dfe7,_0x21c9a5){return db['ChatGroup'][_0xaece('0x59')]({'where':{'id':_0x5298c0[_0xaece('0x5c')]['id']}})['then'](handleEntityNotFound(_0x57dfe7,null))[_0xaece('0x21')](function(_0x1f936a){if(_0x1f936a){return _0x1f936a[_0xaece('0x60')](_0x5298c0[_0xaece('0x3b')][_0xaece('0x61')],_[_0xaece('0x62')](_0x5298c0['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x57dfe7,null))['catch'](handleError(_0x57dfe7,null));};exports['getMembers']=function(_0xa85134,_0x1f36f9,_0x380f2d){var _0x1f3033={};var _0x4996f0={};var _0x17bae9;var _0x4a2e40;return db[_0xaece('0x3f')][_0xaece('0x63')]({'where':{'id':_0xa85134[_0xaece('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f36f9,null))[_0xaece('0x21')](function(_0x5be2fa){if(_0x5be2fa){_0x17bae9=_0x5be2fa;_0x4996f0[_0xaece('0x43')]=_['keys'](db[_0xaece('0x64')]['rawAttributes']);_0x4996f0[_0xaece('0x45')]=_['keys'](_0xa85134[_0xaece('0x45')]);_0x4996f0[_0xaece('0x46')]=_[_0xaece('0x47')](_0x4996f0['model'],_0x4996f0[_0xaece('0x45')]);_0x1f3033[_0xaece('0x48')]=_['intersection'](_0x4996f0['model'],qs[_0xaece('0x57')](_0xa85134[_0xaece('0x45')][_0xaece('0x57')]));_0x1f3033['attributes']=_0x1f3033[_0xaece('0x48')]['length']?_0x1f3033['attributes']:_0x4996f0[_0xaece('0x43')];_0x1f3033[_0xaece('0x4b')]=qs[_0xaece('0x4c')](_0xa85134['query'][_0xaece('0x4c')]);_0x1f3033[_0xaece('0x4d')]=qs[_0xaece('0x46')](_['pick'](_0xa85134[_0xaece('0x45')],_0x4996f0[_0xaece('0x46')]));if(_0xa85134[_0xaece('0x45')][_0xaece('0x50')]){_0x1f3033[_0xaece('0x4d')]=_['merge'](_0x1f3033[_0xaece('0x4d')],{'$or':_[_0xaece('0x3e')](_0x1f3033['attributes'],function(_0x295463){var _0x5d7f28={};_0x5d7f28[_0x295463]={'$like':'%'+_0xa85134[_0xaece('0x45')][_0xaece('0x50')]+'%'};return _0x5d7f28;})});}_0x1f3033=_[_0xaece('0x3a')]({},_0x1f3033,_0xa85134[_0xaece('0x51')]);return _0x17bae9[_0xaece('0x65')](_0x1f3033);}})[_0xaece('0x21')](function(_0x3733ec){if(_0x3733ec){_0x4a2e40=_0x3733ec['length'];if(!_0xa85134['query'][_0xaece('0x66')](_0xaece('0x4a'))){_0x1f3033[_0xaece('0x30')]=qs[_0xaece('0x30')](_0xa85134['query']['limit']);_0x1f3033['offset']=qs[_0xaece('0x2e')](_0xa85134[_0xaece('0x45')][_0xaece('0x2e')]);}return _0x17bae9[_0xaece('0x65')](_0x1f3033);}})[_0xaece('0x21')](function(_0x1761db){if(_0x1761db){return _0x1761db?{'count':_0x4a2e40,'rows':_0x1761db}:null;}})[_0xaece('0x21')](respondWithResult(_0x1f36f9,null))[_0xaece('0x2b')](handleError(_0x1f36f9,null));};exports['removeMembers']=function(_0xe5fc61,_0x4c66ad,_0xe7ced1){return db['ChatGroup'][_0xaece('0x59')]({'where':{'id':_0xe5fc61[_0xaece('0x5c')]['id']}})[_0xaece('0x21')](handleEntityNotFound(_0x4c66ad,null))[_0xaece('0x21')](function(_0x53552c){if(_0x53552c){return _0x53552c[_0xaece('0x67')](_0xe5fc61[_0xaece('0x45')][_0xaece('0x61')]);}})[_0xaece('0x21')](respondWithStatusCode(_0x4c66ad,null))[_0xaece('0x2b')](handleError(_0x4c66ad,null));};exports[_0xaece('0x68')]=function(_0x539ed5,_0x426121,_0xf6596){if(_0x539ed5[_0xaece('0x3b')]['id']){delete _0x539ed5[_0xaece('0x3b')]['id'];}return db[_0xaece('0x3f')][_0xaece('0x59')]({'where':{'id':_0x539ed5[_0xaece('0x5c')]['id']}})['then'](handleEntityNotFound(_0x426121,null))['then'](function(_0x5ba5f6){if(_0x5ba5f6){_0x539ed5[_0xaece('0x3b')][_0xaece('0x69')]=_0x5ba5f6['id'];return db[_0xaece('0x6a')]['create'](_0x539ed5[_0xaece('0x3b')]);}})[_0xaece('0x21')](respondWithResult(_0x426121,null))[_0xaece('0x2b')](handleError(_0x426121,null));};exports['getMessages']=function(_0x3e7478,_0x3038b8,_0x5c2eff){var _0x55070d={};var _0x12f15c={};var _0x163ddd;var _0x55cbcb;return db[_0xaece('0x3f')][_0xaece('0x63')]({'where':{'id':_0x3e7478[_0xaece('0x5c')]['id']}})[_0xaece('0x21')](handleEntityNotFound(_0x3038b8,null))['then'](function(_0x18994a){if(_0x18994a){_0x163ddd=_0x18994a;_0x12f15c[_0xaece('0x43')]=_[_0xaece('0x56')](db['ChatInternalMessage'][_0xaece('0x40')]);_0x12f15c['query']=_[_0xaece('0x56')](_0x3e7478[_0xaece('0x45')]);_0x12f15c[_0xaece('0x46')]=_[_0xaece('0x47')](_0x12f15c[_0xaece('0x43')],_0x12f15c[_0xaece('0x45')]);_0x55070d[_0xaece('0x48')]=_[_0xaece('0x47')](_0x12f15c[_0xaece('0x43')],qs[_0xaece('0x57')](_0x3e7478[_0xaece('0x45')][_0xaece('0x57')]));_0x55070d['attributes']=_0x55070d['attributes']['length']?_0x55070d[_0xaece('0x48')]:_0x12f15c[_0xaece('0x43')];_0x55070d[_0xaece('0x4b')]=qs[_0xaece('0x4c')](_0x3e7478['query'][_0xaece('0x4c')]);_0x55070d[_0xaece('0x4d')]=qs[_0xaece('0x46')](_[_0xaece('0x4e')](_0x3e7478[_0xaece('0x45')],_0x12f15c[_0xaece('0x46')]));if(_0x3e7478[_0xaece('0x45')][_0xaece('0x50')]){_0x55070d[_0xaece('0x4d')]=_[_0xaece('0x3a')](_0x55070d[_0xaece('0x4d')],{'$or':_['map'](_0x55070d[_0xaece('0x48')],function(_0x713715){var _0x3ce44b={};_0x3ce44b[_0x713715]={'$like':'%'+_0x3e7478[_0xaece('0x45')]['filter']+'%'};return _0x3ce44b;})});}if(_0x3e7478[_0xaece('0x45')][_0xaece('0x6b')]){var _0x2a0cd0=_0x3e7478[_0xaece('0x45')]['$gte']['split'](',');var _0xfa5e31={};_0xfa5e31[_0x2a0cd0[0x0]]={'$gte':moment(_0x2a0cd0[0x1])['format'](_0xaece('0x6c'))};_0x55070d['where']=_[_0xaece('0x3a')](_0x55070d['where'],_0xfa5e31);}_0x55070d=_[_0xaece('0x3a')]({},_0x55070d,_0x3e7478[_0xaece('0x51')]);return _0x163ddd['getMessages'](_0x55070d);}})[_0xaece('0x21')](function(_0x5b6586){if(_0x5b6586){_0x55cbcb=_0x5b6586[_0xaece('0x49')];if(!_0x3e7478[_0xaece('0x45')][_0xaece('0x66')](_0xaece('0x4a'))){_0x55070d[_0xaece('0x30')]=qs[_0xaece('0x30')](_0x3e7478[_0xaece('0x45')][_0xaece('0x30')]);_0x55070d['offset']=qs[_0xaece('0x2e')](_0x3e7478[_0xaece('0x45')][_0xaece('0x2e')]);}return _0x163ddd[_0xaece('0x6d')](_0x55070d);}})[_0xaece('0x21')](function(_0x13197d){if(_0x13197d){return _0x13197d?{'count':_0x55cbcb,'rows':_0x13197d}:null;}})[_0xaece('0x21')](respondWithResult(_0x3038b8,null))[_0xaece('0x2b')](handleError(_0x3038b8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9f9e311..4b8badc 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3e41aa,_0x3b5f7e){var _0x28ab00=function(_0x2cb395){while(--_0x2cb395){_0x3e41aa['push'](_0x3e41aa['shift']());}};_0x28ab00(++_0x3b5f7e);}(_0xdb28,0x106));var _0x8db2=function(_0x925037,_0x3ed88d){_0x925037=_0x925037-0x0;var _0x5a0d9e=_0xdb28[_0x925037];return _0x5a0d9e;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0x1371c8,_0x76accb){var _0x51b7f7=function(_0x331dbd){while(--_0x331dbd){_0x1371c8['push'](_0x1371c8['shift']());}};_0x51b7f7(++_0x76accb);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ddb4e,_0x5d9ecf){_0x3ddb4e=_0x3ddb4e-0x0;var _0x16202e=_0xb10b[_0x3ddb4e];return _0x16202e;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 862335c..dae569e 100644 --- a/server/api/chatGroup/chatGroup.model.js +++ b/server/api/chatGroup/chatGroup.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fb8=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','bluebird'];(function(_0x645982,_0x37392d){var _0x5b0505=function(_0x33c2dd){while(--_0x33c2dd){_0x645982['push'](_0x645982['shift']());}};_0x5b0505(++_0x37392d);}(_0x6fb8,0x104));var _0x86fb=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x6fb8[_0xee3051];return _0x139e81;};'use strict';var _=require(_0x86fb('0x0'));var util=require('util');var logger=require(_0x86fb('0x1'))(_0x86fb('0x2'));var moment=require('moment');var BPromise=require(_0x86fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var attributes=require(_0x86fb('0x6'));module[_0x86fb('0x7')]=function(_0x1aa956,_0x7ba395){return _0x1aa956[_0x86fb('0x8')](_0x86fb('0x9'),attributes,{'tableName':_0x86fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87d3=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatGroup.attributes'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x87d3,0x86));var _0x387d=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0x87d3[_0xf4d05];return _0x47c971;};'use strict';var _=require(_0x387d('0x0'));var util=require(_0x387d('0x1'));var logger=require(_0x387d('0x2'))(_0x387d('0x3'));var moment=require(_0x387d('0x4'));var BPromise=require(_0x387d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x387d('0x6'));var rimraf=require('rimraf');var config=require(_0x387d('0x7'));var attributes=require(_0x387d('0x8'));module[_0x387d('0x9')]=function(_0x49d349,_0x3e0d03){return _0x49d349[_0x387d('0xa')](_0x387d('0xb'),attributes,{'tableName':_0x387d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 092b8e8..4683fe2 100644 --- a/server/api/chatGroup/chatGroup.rpc.js +++ b/server/api/chatGroup/chatGroup.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3087=['code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','defaults','localhost','redis','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x36d535,_0x5b8abb){var _0x263556=function(_0x1284de){while(--_0x1284de){_0x36d535['push'](_0x36d535['shift']());}};_0x263556(++_0x5b8abb);}(_0x3087,0x163));var _0x7308=function(_0x265307,_0x1705bf){_0x265307=_0x265307-0x0;var _0x4b2237=_0x3087[_0x265307];return _0x4b2237;};'use strict';var _=require(_0x7308('0x0'));var util=require('util');var moment=require(_0x7308('0x1'));var BPromise=require(_0x7308('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7308('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7308('0x4'));var logger=require(_0x7308('0x5'))('rpc');var config=require(_0x7308('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7308('0x7')]['http']({'port':0x232a});config['redis']=_[_0x7308('0x8')](config['redis'],{'host':_0x7308('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7308('0xa')]));require(_0x7308('0xb'))[_0x7308('0xc')](socket);function respondWithRpcPromise(_0x15d677,_0x5384c0,_0x1f735f){return new BPromise(function(_0x108d02,_0x157e9f){return client[_0x7308('0xd')](_0x15d677,_0x1f735f)[_0x7308('0xe')](function(_0xd8014f){logger['info'](_0x7308('0xf'),_0x5384c0,_0x7308('0x10'));logger[_0x7308('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5384c0,_0x7308('0x10'),JSON[_0x7308('0x12')](_0xd8014f));if(_0xd8014f[_0x7308('0x13')]){if(_0xd8014f['error'][_0x7308('0x14')]===0x1f4){logger['error'](_0x7308('0xf'),_0x5384c0,_0xd8014f[_0x7308('0x13')][_0x7308('0x15')]);return _0x157e9f(_0xd8014f[_0x7308('0x13')][_0x7308('0x15')]);}logger[_0x7308('0x13')](_0x7308('0xf'),_0x5384c0,_0xd8014f[_0x7308('0x13')][_0x7308('0x15')]);return _0x108d02(_0xd8014f[_0x7308('0x13')]['message']);}else{logger[_0x7308('0x16')](_0x7308('0xf'),_0x5384c0,'request\x20sent');_0x108d02(_0xd8014f[_0x7308('0x17')]['message']);}})[_0x7308('0x18')](function(_0x24ede2){logger['error'](_0x7308('0xf'),_0x5384c0,_0x24ede2);_0x157e9f(_0x24ede2);});});} \ No newline at end of file +var _0x9f19=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatGroup.socket','register','then'];(function(_0x5bb075,_0x4ad1a5){var _0x3e5f40=function(_0x8cc74f){while(--_0x8cc74f){_0x5bb075['push'](_0x5bb075['shift']());}};_0x3e5f40(++_0x4ad1a5);}(_0x9f19,0x134));var _0x99f1=function(_0xc7e1a4,_0xca8ef7){_0xc7e1a4=_0xc7e1a4-0x0;var _0x17c44d=_0x9f19[_0xc7e1a4];return _0x17c44d;};'use strict';var _=require('lodash');var util=require(_0x99f1('0x0'));var moment=require(_0x99f1('0x1'));var BPromise=require(_0x99f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x99f1('0x4'))(_0x99f1('0x5'));var config=require(_0x99f1('0x6'));var jayson=require(_0x99f1('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x99f1('0x8')]=_[_0x99f1('0x9')](config['redis'],{'host':_0x99f1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x99f1('0xb'))[_0x99f1('0xc')](socket);function respondWithRpcPromise(_0x24170e,_0xf7d278,_0x1f9e24){return new BPromise(function(_0x5e94aa,_0x2b590a){return client['request'](_0x24170e,_0x1f9e24)[_0x99f1('0xd')](function(_0x52273f){logger['info'](_0x99f1('0xe'),_0xf7d278,_0x99f1('0xf'));logger[_0x99f1('0x10')](_0x99f1('0x11'),_0xf7d278,'request\x20sent',JSON[_0x99f1('0x12')](_0x52273f));if(_0x52273f[_0x99f1('0x13')]){if(_0x52273f['error']['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0xf7d278,_0x52273f['error']['message']);return _0x2b590a(_0x52273f[_0x99f1('0x13')][_0x99f1('0x14')]);}logger[_0x99f1('0x13')](_0x99f1('0xe'),_0xf7d278,_0x52273f[_0x99f1('0x13')]['message']);return _0x5e94aa(_0x52273f['error'][_0x99f1('0x14')]);}else{logger['info'](_0x99f1('0xe'),_0xf7d278,_0x99f1('0xf'));_0x5e94aa(_0x52273f[_0x99f1('0x15')]['message']);}})[_0x99f1('0x16')](function(_0x123673){logger[_0x99f1('0x13')](_0x99f1('0xe'),_0xf7d278,_0x123673);_0x2b590a(_0x123673);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 67d717b..a1dbcc6 100644 --- a/server/api/chatGroup/chatGroup.socket.js +++ b/server/api/chatGroup/chatGroup.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83ed=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','emit'];(function(_0x4da11a,_0x9d013d){var _0x1ab4f6=function(_0x14fa64){while(--_0x14fa64){_0x4da11a['push'](_0x4da11a['shift']());}};_0x1ab4f6(++_0x9d013d);}(_0x83ed,0xd4));var _0xd83e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x83ed[_0x56482c];return _0x5aae7a;};'use strict';var ChatGroupEvents=require(_0xd83e('0x0'));var events=[_0xd83e('0x1'),_0xd83e('0x2'),'update'];function createListener(_0x1c24ce,_0x55af99){return function(_0x2948c3){_0x55af99[_0xd83e('0x3')](_0x1c24ce,_0x2948c3);};}function removeListener(_0x177c17,_0x118b3f){return function(){ChatGroupEvents[_0xd83e('0x4')](_0x177c17,_0x118b3f);};}exports[_0xd83e('0x5')]=function(_0x11cdc1){for(var _0xcb2473=0x0,_0x398089=events[_0xd83e('0x6')];_0xcb2473<_0x398089;_0xcb2473++){var _0x382d32=events[_0xcb2473];var _0x748e2d=createListener(_0xd83e('0x7')+_0x382d32,_0x11cdc1);ChatGroupEvents['on'](_0x382d32,_0x748e2d);}}; \ No newline at end of file +var _0x574c=['./chatGroup.events','save','update','removeListener','register','length','chatGroup:'];(function(_0xea5f2e,_0x5ab35e){var _0x15d63d=function(_0x17d61d){while(--_0x17d61d){_0xea5f2e['push'](_0xea5f2e['shift']());}};_0x15d63d(++_0x5ab35e);}(_0x574c,0x1b9));var _0xc574=function(_0x18eb8f,_0x4c17df){_0x18eb8f=_0x18eb8f-0x0;var _0x20bb68=_0x574c[_0x18eb8f];return _0x20bb68;};'use strict';var ChatGroupEvents=require(_0xc574('0x0'));var events=[_0xc574('0x1'),'remove',_0xc574('0x2')];function createListener(_0x596750,_0x134930){return function(_0x336c10){_0x134930['emit'](_0x596750,_0x336c10);};}function removeListener(_0x38bdd4,_0x3fcbf0){return function(){ChatGroupEvents[_0xc574('0x3')](_0x38bdd4,_0x3fcbf0);};}exports[_0xc574('0x4')]=function(_0x23f71b){for(var _0x1b9b9f=0x0,_0x4f9678=events[_0xc574('0x5')];_0x1b9b9f<_0x4f9678;_0x1b9b9f++){var _0x19778a=events[_0x1b9b9f];var _0xc1f4cf=createListener(_0xc574('0x6')+_0x19778a,_0x23f71b);ChatGroupEvents['on'](_0x19778a,_0xc1f4cf);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a1e35ff..9d0335f 100644 --- a/server/api/chatGroup/index.js +++ b/server/api/chatGroup/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5dd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','/:id/members','getMembers','getMessages','post','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express'];(function(_0x24add3,_0x37bab3){var _0x5c884f=function(_0x171955){while(--_0x171955){_0x24add3['push'](_0x24add3['shift']());}};_0x5c884f(++_0x37bab3);}(_0xf5dd,0x1ad));var _0xdf5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5dd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdf5d('0x0'));var util=require(_0xdf5d('0x1'));var path=require(_0xdf5d('0x2'));var timeout=require(_0xdf5d('0x3'));var express=require(_0xdf5d('0x4'));var router=express[_0xdf5d('0x5')]();var fs_extra=require(_0xdf5d('0x6'));var auth=require(_0xdf5d('0x7'));var interaction=require(_0xdf5d('0x8'));var config=require(_0xdf5d('0x9'));var controller=require(_0xdf5d('0xa'));router['get']('/',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0xc')]);router[_0xdf5d('0xd')](_0xdf5d('0xe'),auth[_0xdf5d('0xb')](),controller[_0xdf5d('0xf')]);router[_0xdf5d('0xd')](_0xdf5d('0x10'),auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x11')]);router[_0xdf5d('0xd')](_0xdf5d('0x12'),auth[_0xdf5d('0xb')](),controller['getUnread']);router[_0xdf5d('0xd')](_0xdf5d('0x13'),auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x14')]);router[_0xdf5d('0xd')]('/:id/messages',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x15')]);router[_0xdf5d('0x16')]('/',auth[_0xdf5d('0xb')](),controller['create']);router[_0xdf5d('0x16')](_0xdf5d('0x13'),auth['isAuthenticated'](),controller['addMembers']);router['post'](_0xdf5d('0x17'),auth['isAuthenticated'](),controller[_0xdf5d('0x18')]);router[_0xdf5d('0x19')](_0xdf5d('0x10'),auth['isAuthenticated'](),controller[_0xdf5d('0x1a')]);router[_0xdf5d('0x1b')]('/:id',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x1c')]);router['delete']('/:id/members',auth[_0xdf5d('0xb')](),controller[_0xdf5d('0x1d')]);module[_0xdf5d('0x1e')]=router; \ No newline at end of file +var _0x6e83=['exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','post','addMembers','/:id/messages','put','update','delete'];(function(_0x46c099,_0x3d793e){var _0x4e8c7b=function(_0x5baba9){while(--_0x5baba9){_0x46c099['push'](_0x46c099['shift']());}};_0x4e8c7b(++_0x3d793e);}(_0x6e83,0x16d));var _0x36e8=function(_0x54d2fb,_0x31fd9e){_0x54d2fb=_0x54d2fb-0x0;var _0x10cb87=_0x6e83[_0x54d2fb];return _0x10cb87;};'use strict';var multer=require(_0x36e8('0x0'));var util=require(_0x36e8('0x1'));var path=require(_0x36e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x36e8('0x3'));var router=express[_0x36e8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x36e8('0x5'));var config=require(_0x36e8('0x6'));var controller=require(_0x36e8('0x7'));router[_0x36e8('0x8')]('/',auth[_0x36e8('0x9')](),controller[_0x36e8('0xa')]);router['get'](_0x36e8('0xb'),auth[_0x36e8('0x9')](),controller[_0x36e8('0xc')]);router[_0x36e8('0x8')](_0x36e8('0xd'),auth[_0x36e8('0x9')](),controller[_0x36e8('0xe')]);router[_0x36e8('0x8')](_0x36e8('0xf'),auth[_0x36e8('0x9')](),controller[_0x36e8('0x10')]);router[_0x36e8('0x8')](_0x36e8('0x11'),auth[_0x36e8('0x9')](),controller[_0x36e8('0x12')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x36e8('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x36e8('0x11'),auth['isAuthenticated'](),controller[_0x36e8('0x14')]);router[_0x36e8('0x13')](_0x36e8('0x15'),auth[_0x36e8('0x9')](),controller['addMessage']);router[_0x36e8('0x16')](_0x36e8('0xd'),auth['isAuthenticated'](),controller[_0x36e8('0x17')]);router[_0x36e8('0x18')](_0x36e8('0xd'),auth[_0x36e8('0x9')](),controller['destroy']);router[_0x36e8('0x18')]('/:id/members',auth[_0x36e8('0x9')](),controller['removeMembers']);module[_0x36e8('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 957e5e1..4553bd1 100644 --- a/server/api/chatInteraction/chatInteraction.attributes.js +++ b/server/api/chatInteraction/chatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3646=['ENUM','star','thumb','TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x3646,0x1e8));var _0x6364=function(_0x3d1d0d,_0x320be1){_0x3d1d0d=_0x3d1d0d-0x0;var _0x463db4=_0x3646[_0x3d1d0d];return _0x463db4;};'use strict';var Sequelize=require(_0x6364('0x0'));module[_0x6364('0x1')]={'closed':{'type':Sequelize[_0x6364('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6364('0x3')]},'ratingType':{'type':Sequelize[_0x6364('0x4')](_0x6364('0x5'),_0x6364('0x6')),'defaultValue':_0x6364('0x5')},'ratingMessage':{'type':Sequelize[_0x6364('0x7')]},'pathTranscript':{'type':Sequelize[_0x6364('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6364('0x8')]},'disposition':{'type':Sequelize[_0x6364('0x9')]},'secondDisposition':{'type':Sequelize[_0x6364('0x9')]},'thirdDisposition':{'type':Sequelize[_0x6364('0x9')]},'note':{'type':Sequelize[_0x6364('0x9')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6364('0x9')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x6364('0x9')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6364('0x7')]},'customerIp':{'type':Sequelize[_0x6364('0x9')]},'formData':{'type':Sequelize[_0x6364('0x7')](_0x6364('0xa'))},'read1stAt':{'type':Sequelize[_0x6364('0x8')]},'lastMsgAt':{'type':Sequelize[_0x6364('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x6364('0x4')]('in',_0x6364('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6364('0x9')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xec09=['thumb','TEXT','DATE','STRING','long','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xec09,0x1cf));var _0x9ec0=function(_0x3b6873,_0x4c8bcf){_0x3b6873=_0x3b6873-0x0;var _0x278020=_0xec09[_0x3b6873];return _0x278020;};'use strict';var Sequelize=require(_0x9ec0('0x0'));module[_0x9ec0('0x1')]={'closed':{'type':Sequelize[_0x9ec0('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9ec0('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x9ec0('0x4'),_0x9ec0('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x9ec0('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x9ec0('0x7')]},'disposition':{'type':Sequelize[_0x9ec0('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9ec0('0x8')]},'browserName':{'type':Sequelize[_0x9ec0('0x8')]},'browserVersion':{'type':Sequelize[_0x9ec0('0x8')]},'osName':{'type':Sequelize[_0x9ec0('0x8')]},'osVersion':{'type':Sequelize[_0x9ec0('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x9ec0('0x8')]},'deviceType':{'type':Sequelize[_0x9ec0('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x9ec0('0x8')]},'formData':{'type':Sequelize[_0x9ec0('0x6')](_0x9ec0('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9ec0('0xa')]('in',_0x9ec0('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 8f0160d..ad6538e 100644 --- a/server/api/chatInteraction/chatInteraction.controller.js +++ b/server/api/chatInteraction/chatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbc7=['findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','closed','Unauthorized','root','join','download','mailTranscript','server/files/chat/upload/','format','now','CmContact','Messages','%s%d','agentAlias','System','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','service','Smtp','host','port','secure','authentication','pass','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','omit','nolimit','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','setTags','chatInteractionTags:save','removeTags','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Owner','Chat','Account','N.A.','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','stack','name','render','merge','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','push','ChatInteraction','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','select','color','tools_tags','u.id','field','ui.ChatInteractionId','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','order','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','rawAttributes','includeAll','include','options','create','params','destroy','createVidaooSession'];(function(_0x2f34d8,_0x164619){var _0x106898=function(_0x1f6e2f){while(--_0x1f6e2f){_0x2f34d8['push'](_0x2f34d8['shift']());}};_0x106898(++_0x164619);}(_0xcbc7,0x18f));var _0x7cbc=function(_0x182cbd,_0x3b513a){_0x182cbd=_0x182cbd-0x0;var _0x48ade4=_0xcbc7[_0x182cbd];return _0x48ade4;};'use strict';var emlformat=require(_0x7cbc('0x0'));var rimraf=require(_0x7cbc('0x1'));var zipdir=require(_0x7cbc('0x2'));var jsonpatch=require(_0x7cbc('0x3'));var rp=require(_0x7cbc('0x4'));var moment=require(_0x7cbc('0x5'));var BPromise=require(_0x7cbc('0x6'));var Mustache=require(_0x7cbc('0x7'));var util=require(_0x7cbc('0x8'));var path=require(_0x7cbc('0x9'));var sox=require(_0x7cbc('0xa'));var csv=require(_0x7cbc('0xb'));var ejs=require(_0x7cbc('0xc'));var fs=require('fs');var fs_extra=require(_0x7cbc('0xd'));var _=require(_0x7cbc('0xe'));var squel=require(_0x7cbc('0xf'));var crypto=require(_0x7cbc('0x10'));var jsforce=require(_0x7cbc('0x11'));var deskjs=require(_0x7cbc('0x12'));var toCsv=require(_0x7cbc('0xb'));var querystring=require(_0x7cbc('0x13'));var Papa=require(_0x7cbc('0x14'));var Redis=require(_0x7cbc('0x15'));var authService=require(_0x7cbc('0x16'));var qs=require(_0x7cbc('0x17'));var as=require(_0x7cbc('0x18'));var pdf=require(_0x7cbc('0x19'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cbc('0x1a'))(_0x7cbc('0x1b'));var utils=require(_0x7cbc('0x1c'));var config=require('../../config/environment');var licenseUtil=require(_0x7cbc('0x1d'));var db=require('../../mysqldb')['db'];config[_0x7cbc('0x1e')]=_[_0x7cbc('0x1f')](config[_0x7cbc('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cbc('0x20'))(new Redis(config[_0x7cbc('0x1e')]));require(_0x7cbc('0x21'))[_0x7cbc('0x22')](socket);var jayson=require(_0x7cbc('0x23'));var client=jayson[_0x7cbc('0x24')]['http']({'port':0x232b});var client9004=jayson['client'][_0x7cbc('0x25')]({'port':0x232c});function respondWithRpcPromise(_0x3629a0,_0x21e5bc,_0x1b0cef,_0x4b84dd){return new BPromise(function(_0x16c184,_0x227088){var _0x5e6c59=_0x4b84dd||client;return _0x5e6c59[_0x7cbc('0x26')](_0x3629a0,_0x1b0cef)['then'](function(_0x5d0bdc){logger['info'](_0x7cbc('0x27'),_0x21e5bc,_0x7cbc('0x28'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x21e5bc,_0x7cbc('0x28'),JSON[_0x7cbc('0x29')](_0x5d0bdc));if(_0x5d0bdc[_0x7cbc('0x2a')]){if(_0x5d0bdc[_0x7cbc('0x2a')][_0x7cbc('0x2b')]===0x1f4){logger[_0x7cbc('0x2a')](_0x7cbc('0x27'),_0x21e5bc,_0x5d0bdc['error'][_0x7cbc('0x2c')]);return _0x227088(_0x5d0bdc['error'][_0x7cbc('0x2c')]);}logger['error'](_0x7cbc('0x27'),_0x21e5bc,_0x5d0bdc[_0x7cbc('0x2a')][_0x7cbc('0x2c')]);return _0x16c184(_0x5d0bdc[_0x7cbc('0x2a')][_0x7cbc('0x2c')]);}else{logger['info'](_0x7cbc('0x27'),_0x21e5bc,_0x7cbc('0x28'));_0x16c184(_0x5d0bdc[_0x7cbc('0x2d')][_0x7cbc('0x2c')]);}})[_0x7cbc('0x2e')](function(_0x27eecd){logger[_0x7cbc('0x2a')](_0x7cbc('0x27'),_0x21e5bc,_0x27eecd);_0x227088(_0x27eecd);});});}function respondWithStatusCode(_0x5e2f2c,_0x23e038){_0x23e038=_0x23e038||0xcc;return function(_0x3b9842){if(_0x3b9842){return _0x5e2f2c[_0x7cbc('0x2f')](_0x23e038);}return _0x5e2f2c[_0x7cbc('0x30')](_0x23e038)[_0x7cbc('0x31')]();};}function respondWithResult(_0x5bc085,_0x2a5e4c){_0x2a5e4c=_0x2a5e4c||0xc8;return function(_0x4c33ca){if(_0x4c33ca){return _0x5bc085[_0x7cbc('0x30')](_0x2a5e4c)[_0x7cbc('0x32')](_0x4c33ca);}};}function respondWithFilteredResult(_0x21647a,_0x4ca15c){return function(_0x46f9ec){if(_0x46f9ec){var _0x800275=typeof _0x4ca15c['offset']==='undefined'&&typeof _0x4ca15c[_0x7cbc('0x33')]===_0x7cbc('0x34');var _0x1ea4b0=_0x46f9ec[_0x7cbc('0x35')];var _0x1f1256=_0x800275?0x0:_0x4ca15c[_0x7cbc('0x36')];var _0x174c1f=_0x800275?_0x46f9ec[_0x7cbc('0x35')]:_0x4ca15c[_0x7cbc('0x36')]+_0x4ca15c[_0x7cbc('0x33')];var _0xf6043;if(_0x174c1f>=_0x1ea4b0){_0x174c1f=_0x1ea4b0;_0xf6043=0xc8;}else{_0xf6043=0xce;}_0x21647a[_0x7cbc('0x30')](_0xf6043);return _0x21647a['set'](_0x7cbc('0x37'),_0x1f1256+'-'+_0x174c1f+'/'+_0x1ea4b0)[_0x7cbc('0x32')](_0x46f9ec);}return null;};}function patchUpdates(_0x22325f){return function(_0x1a6919){try{jsonpatch[_0x7cbc('0x38')](_0x1a6919,_0x22325f,!![]);}catch(_0x157677){return BPromise[_0x7cbc('0x39')](_0x157677);}return _0x1a6919[_0x7cbc('0x3a')]();};}function saveUpdates(_0x305745,_0x572ee2){return function(_0x1b645f){if(_0x1b645f){return _0x1b645f[_0x7cbc('0x3b')](_0x305745)[_0x7cbc('0x3c')](function(_0x24b466){return _0x24b466;});}return null;};}function removeEntity(_0x583727,_0x6165c9){return function(_0x2293bf){if(_0x2293bf){return _0x2293bf['destroy']()[_0x7cbc('0x3c')](function(){_0x583727[_0x7cbc('0x30')](0xcc)[_0x7cbc('0x31')]();});}};}function handleEntityNotFound(_0x6fae2e,_0x12bbe3){return function(_0x351f55){if(!_0x351f55){_0x6fae2e['sendStatus'](0x194);}return _0x351f55;};}function handleError(_0x381c74,_0x58cd2d){_0x58cd2d=_0x58cd2d||0x1f4;return function(_0x309ba6){logger['error'](_0x309ba6[_0x7cbc('0x3d')]);if(_0x309ba6[_0x7cbc('0x3e')]){delete _0x309ba6[_0x7cbc('0x3e')];}_0x381c74['status'](_0x58cd2d)['send'](_0x309ba6);};}function getMustacheRender(_0x152b49,_0xfd6677){return Mustache[_0x7cbc('0x3f')](_0x152b49,_[_0x7cbc('0x40')](_0xfd6677[_0x7cbc('0x41')],{'contact':_0xfd6677[_0x7cbc('0x42')],'message':_0xfd6677[_0x7cbc('0x2c')],'agent':_0xfd6677[_0x7cbc('0x43')],'interaction':_0xfd6677[_0x7cbc('0x44')],'account':_0xfd6677[_0x7cbc('0x45')]}))||'';}function getInteractionUsers(_0x1d86db,_0x59c7c4){return new BPromise(function(_0x2a38ff,_0x11d230){try{if(_0x59c7c4[_0x1d86db['id']]){_0x1d86db[_0x7cbc('0x46')]=_[_0x7cbc('0x47')](_0x59c7c4[_0x1d86db['id']],function(_0x537d5c){return{'id':_0x537d5c['id'],'fullname':_0x537d5c[_0x7cbc('0x48')]};});}}catch(_0xa07225){_0x11d230(_0xa07225);}_0x2a38ff(_0x1d86db);});}function getInteractionTags(_0x1663bc,_0x1c7847){return new BPromise(function(_0x2e23fd,_0x1e2d74){try{if(_0x1663bc[_0x7cbc('0x49')]){_0x1663bc[_0x7cbc('0x4a')]=[];_0x1663bc[_0x7cbc('0x49')][_0x7cbc('0x4b')](',')['forEach'](function(_0x153e37){_0x1663bc[_0x7cbc('0x4a')][_0x7cbc('0x4c')](_0x1c7847[_0x153e37]);});}delete _0x1663bc['TagIds'];}catch(_0x122f42){_0x1e2d74(_0x122f42);}_0x2e23fd(_0x1663bc);});}function updateChatInteraction(_0x17521b,_0x13144a,_0x51b03b){return new BPromise(function(_0x909e45,_0x45d5a9){return getInteractionUsers(_0x17521b,_0x51b03b)[_0x7cbc('0x3c')](function(_0x4c5a61){return getInteractionTags(_0x4c5a61,_0x13144a);})[_0x7cbc('0x3c')](function(_0x208e53){_0x909e45(_0x208e53);})[_0x7cbc('0x2e')](function(_0x2e1273){_0x45d5a9(_0x2e1273);});});}exports['index']=function(_0x574226,_0x1f0f27){var _0x24bed3={},_0x4c8395={},_0x1ff56e={'count':0x0,'rows':[]};var _0x231f30=_[_0x7cbc('0x47')](db[_0x7cbc('0x4d')]['rawAttributes'],function(_0x3d6161){return{'name':_0x3d6161['fieldName'],'type':_0x3d6161[_0x7cbc('0x4e')]['key']};});_0x4c8395[_0x7cbc('0x4f')]=_[_0x7cbc('0x47')](_0x231f30,_0x7cbc('0x3e'));_0x4c8395[_0x7cbc('0x50')]=_[_0x7cbc('0x51')](_0x574226[_0x7cbc('0x50')]);_0x4c8395['filters']=_[_0x7cbc('0x52')](_0x4c8395[_0x7cbc('0x4f')],_0x4c8395[_0x7cbc('0x50')]);_0x24bed3[_0x7cbc('0x53')]=_[_0x7cbc('0x52')](_0x4c8395['model'],qs[_0x7cbc('0x54')](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x54')]));_0x24bed3[_0x7cbc('0x53')]=_0x24bed3['attributes'][_0x7cbc('0x55')]?_0x24bed3['attributes']:_0x4c8395[_0x7cbc('0x4f')];if(!_0x574226[_0x7cbc('0x50')][_0x7cbc('0x56')]('nolimit')){_0x24bed3['limit']=qs[_0x7cbc('0x33')](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x33')]);_0x24bed3[_0x7cbc('0x36')]=qs[_0x7cbc('0x36')](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x36')]);}_0x24bed3['order']=qs['sort'](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x57')]);_0x24bed3['where']=qs[_0x7cbc('0x58')](_['pick'](_0x574226[_0x7cbc('0x50')],_0x4c8395[_0x7cbc('0x58')]),_0x231f30);var _0x56ee8d=[];var _0x52ecdb=squel[_0x7cbc('0x59')]()['field']('id')['field']('name')['field'](_0x7cbc('0x5a'))['from'](_0x7cbc('0x5b'));var _0x50e4b3=squel[_0x7cbc('0x59')]()['field'](_0x7cbc('0x5c'))[_0x7cbc('0x5d')]('u.fullname')[_0x7cbc('0x5d')](_0x7cbc('0x5e'))['from']('user_has_chat_interactions','ui')[_0x7cbc('0x5f')](_0x7cbc('0x60'),'u','u.id\x20=\x20ui.UserId');var _0x1bd078=squel['select']()['from'](_0x7cbc('0x61'),'i')['left_join']('cm_contacts','c',_0x7cbc('0x62'))[_0x7cbc('0x5f')](_0x7cbc('0x60'),'o','o.id\x20=\x20i.UserId')[_0x7cbc('0x5f')](_0x7cbc('0x63'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x7cbc('0x5f')]('chat_messages','me',_0x7cbc('0x64'))[_0x7cbc('0x5f')]('chat_interaction_has_tags','it',_0x7cbc('0x65'))[_0x7cbc('0x5f')](_0x7cbc('0x5b'),'t',_0x7cbc('0x66'));var _0x1b4254=squel[_0x7cbc('0x67')]();var _0x1edff5=[];var _0x2590ac=squel['expr']();var _0x9ed138;if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x68')]){_0x9ed138=as['parseSearch'](_0x574226[_0x7cbc('0x50')]['search']);var _0x313b44=_0x9ed138[_0x7cbc('0x69')];for(var _0xeef2b1=0x0;_0xeef2b1<_0x9ed138[_0x7cbc('0x6a')]['length'];_0xeef2b1++){var _0x28f2c5=_0x9ed138[_0x7cbc('0x6a')][_0xeef2b1];var _0x317960='i';var _0x4baa68=_[_0x7cbc('0x6b')](_0x231f30,[_0x7cbc('0x3e'),_0x28f2c5[_0x7cbc('0x5d')]]);if(!_0x4baa68){switch(_0x28f2c5['field']){case _0x7cbc('0x6c'):if(_0x28f2c5[_0x7cbc('0x6d')]==0x1){_0x1bd078['having']('`'+_0x28f2c5[_0x7cbc('0x5d')]+_0x7cbc('0x6e'));}else{_0x1bd078[_0x7cbc('0x6f')]('`'+_0x28f2c5[_0x7cbc('0x5d')]+'`\x20>\x200');}break;case _0x7cbc('0x70'):if(_0x28f2c5[_0x7cbc('0x71')]===_0x7cbc('0x72')){if(_0x28f2c5['value'][_0x7cbc('0x4b')]('\x20')[_0x7cbc('0x55')]>0x1){_0x1b4254[_0x313b44](_0x7cbc('0x73'),qs[_0x7cbc('0x74')](_0x28f2c5[_0x7cbc('0x6d')]),null);}else{var _0x23f52c='%'+_0x28f2c5['value']+'%';_0x1b4254[_0x313b44](_0x7cbc('0x75'),_0x23f52c,_0x23f52c,_0x23f52c);}}else{_0x4baa68=_[_0x7cbc('0x6b')](_0x231f30,['name',_0x7cbc('0x76')]);_0x28f2c5[_0x7cbc('0x5d')]=_0x7cbc('0x76');_0x46b5d1=as[_0x7cbc('0x77')](_0x317960,_0x4baa68[_0x7cbc('0x4e')],_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x79')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x31')]);}break;case _0x7cbc('0x7a'):var _0xcc5b3c=_0x28f2c5[_0x7cbc('0x6d')][_0x7cbc('0x4b')](',')['map'](function(_0x3f82e6){return Number(_0x3f82e6);});_0xcc5b3c[_0x7cbc('0x7b')](function(_0x18b099){_0x2590ac['or'](_0x7cbc('0x7c'),'%,'+_0x18b099+',%');});_0x1edff5=_[_0x7cbc('0x7d')](_0x1edff5,_0xcc5b3c);break;case _0x7cbc('0x7e'):if(_0x28f2c5['operator']===_0x7cbc('0x72')){_0x1b4254[_0x313b44](_0x7cbc('0x7f'),'%'+_0x28f2c5['value']+'%',null);}else{_0x4baa68=_[_0x7cbc('0x6b')](_0x231f30,[_0x7cbc('0x3e'),_0x7cbc('0x80')]);_0x28f2c5[_0x7cbc('0x5d')]=_0x7cbc('0x80');_0x46b5d1=as['buildExpression'](_0x317960,_0x4baa68['type'],_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x79')],_0x46b5d1['value']['end']);}break;case'body':_0x46b5d1=as[_0x7cbc('0x77')]('me',null,_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1['value'][_0x7cbc('0x79')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x31')]);break;}}else{var _0x46b5d1=as['buildExpression'](_0x317960,_0x4baa68['type'],_0x28f2c5);_0x1b4254[_0x313b44](_0x46b5d1[_0x7cbc('0x78')],_0x46b5d1['value'][_0x7cbc('0x79')],_0x46b5d1[_0x7cbc('0x6d')][_0x7cbc('0x31')]);}}}else{var _0x3d1ac6=_(_0x574226['query'])[_0x7cbc('0x51')]()[_0x7cbc('0x47')](function(_0x4957db){return _[_0x7cbc('0x81')](_0x231f30,['name',_0x4957db])?_0x4957db:undefined;})[_0x7cbc('0x82')]()['value']();if(!_['isEmpty'](_0x3d1ac6)){_0x3d1ac6[_0x7cbc('0x7b')](function(_0x3f126f){if(_0x3f126f===_0x7cbc('0x83')){_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0x85'),[]['concat'](_0x574226[_0x7cbc('0x50')][_0x3f126f]));}else if(_0x3f126f===_0x7cbc('0x86')){var _0x497f7a=JSON['parse'](_0x574226['query'][_0x3f126f])[_0x7cbc('0x87')];var _0x315d1e=JSON['parse'](_0x574226[_0x7cbc('0x50')][_0x3f126f])[_0x7cbc('0x88')];_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0x89'),_0x497f7a,_0x315d1e);}else{if(_0x574226[_0x7cbc('0x50')][_0x3f126f]==='null'){_0x1bd078[_0x7cbc('0x84')]('i.'+_0x3f126f+_0x7cbc('0x8a'));}else{_0x1bd078[_0x7cbc('0x84')]('i.'+_0x3f126f+_0x7cbc('0x8b'),_0x574226[_0x7cbc('0x50')][_0x3f126f]);}}});}if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8c')]){if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8c')]==0x1){_0x1bd078[_0x7cbc('0x6f')](_0x7cbc('0x8d'));}else{_0x1bd078[_0x7cbc('0x6f')](_0x7cbc('0x8e'));}}if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')]){_0x1edff5=_['isArray'](_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')])?_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')]:new Array(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x8f')]);_0x1edff5['forEach'](function(_0x680022){_0x2590ac['or'](_0x7cbc('0x7c'),'%,'+_0x680022+',%');});}if(_0x574226['query']['filter']){var _0x5bf9da=_0x574226[_0x7cbc('0x50')][_0x7cbc('0x90')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x7cbc('0x91')](_0x5bf9da)){_0x1b4254['or']('i.id\x20LIKE\x20?',_0x5bf9da+'%');}else{_0x1b4254['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7cbc('0x74')](_0x5bf9da))['or'](_0x7cbc('0x92'),_0x5bf9da+'%');}}}_0x1bd078[_0x7cbc('0x84')](_0x1b4254);_0x1bd078['group'](_0x7cbc('0x93'));var _0x2cf757={'type':db[_0x7cbc('0x94')][_0x7cbc('0x95')]['SELECT'],'raw':!![]};var _0x56ef1f=_0x1bd078[_0x7cbc('0x96')]();_0x56ef1f['field'](_0x7cbc('0x93'));_0x56ef1f[_0x7cbc('0x5d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x24bed3[_0x7cbc('0x97')]){_0x24bed3[_0x7cbc('0x97')][_0x7cbc('0x7b')](function(_0x1ce706){var _0x519398=_0x1ce706[0x0]===_0x7cbc('0x98')?_0x1ce706[0x0]:'i.'+_0x1ce706[0x0];_0x1bd078['order'](_0x519398,_0x1ce706[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7cbc('0x99')](_0x1edff5)){_0x1bd078['having'](_0x2590ac);_0x56ef1f[_0x7cbc('0x84')](_0x7cbc('0x9a'),_0x1edff5);}BPromise[_0x7cbc('0x9b')]()[_0x7cbc('0x3c')](function(){if(!_0x9ed138){if(_0x574226[_0x7cbc('0x50')][_0x7cbc('0x83')])return;_0x56ef1f[_0x7cbc('0x84')](_0x7cbc('0x9c'));_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0x9c'));return;}if(_0x574226[_0x7cbc('0x9d')][_0x7cbc('0x9e')]!==_0x7cbc('0x43'))return;return _0x574226[_0x7cbc('0x9d')][_0x7cbc('0x9f')]({'attributes':['id'],'raw':!![]})[_0x7cbc('0x3c')](function(_0x185d33){if(_[_0x7cbc('0x99')](_0x185d33)){_0x56ef1f['where'](_0x7cbc('0xa0'));_0x1bd078[_0x7cbc('0x84')](_0x7cbc('0xa0'));}else{_0x56ef1f[_0x7cbc('0x84')](_0x7cbc('0x85'),_[_0x7cbc('0x47')](_0x185d33,'id'));_0x1bd078['where'](_0x7cbc('0x85'),_[_0x7cbc('0x47')](_0x185d33,'id'));}});})[_0x7cbc('0x3c')](function(){if(_0x574226[_0x7cbc('0x9d')]['role']===_0x7cbc('0x43')&&!_0x9ed138&&!_0x574226[_0x7cbc('0x50')][_0x7cbc('0x83')])return[];return db[_0x7cbc('0xa1')][_0x7cbc('0x50')](_0x56ef1f[_0x7cbc('0xa2')](),_0x2cf757);})['then'](function(_0x56356a){_0x1ff56e[_0x7cbc('0x35')]=_0x56356a[_0x7cbc('0x55')];if(_0x1ff56e['count']===0x0)return[];return db['sequelize']['query'](_0x52ecdb[_0x7cbc('0xa2')](),_0x2cf757)[_0x7cbc('0x3c')](function(_0x5eda83){_0x56ee8d=_[_0x7cbc('0xa3')](_0x5eda83,'id');_0x2cf757=_[_0x7cbc('0x40')](_0x2cf757,{'model':db[_0x7cbc('0x4d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x574226['query'][_0x7cbc('0x54')]){_0x24bed3[_0x7cbc('0x53')]['forEach'](function(_0x37efa6){_0x1bd078[_0x7cbc('0x5d')]('i.'+_0x37efa6);});}else{_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa4'),'unreadMessages');_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa5'),'Account.key');_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa6'),_0x7cbc('0xa7'));_0x1bd078[_0x7cbc('0x5d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x7cbc('0x98'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa8'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xa9'),'Contact.firstName');_0x1bd078['field'](_0x7cbc('0xaa'),_0x7cbc('0xab'));_0x1bd078[_0x7cbc('0x5d')]('c.email',_0x7cbc('0xac'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xad'),'Contact.phone');_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xae'),_0x7cbc('0xaf'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xb0'),_0x7cbc('0xb1'));_0x1bd078[_0x7cbc('0x5d')]('o.fullname',_0x7cbc('0xb2'));_0x1bd078[_0x7cbc('0x5d')]('o.internal',_0x7cbc('0xb3'));_0x1bd078[_0x7cbc('0x5d')](_0x7cbc('0xb4'),_0x7cbc('0x49'));}if(_0x24bed3[_0x7cbc('0x33')])_0x1bd078['limit'](_0x24bed3[_0x7cbc('0x33')]);if(_0x24bed3[_0x7cbc('0x36')])_0x1bd078[_0x7cbc('0x36')](_0x24bed3[_0x7cbc('0x36')]);return db[_0x7cbc('0xa1')][_0x7cbc('0x50')](_0x1bd078['toString'](),_0x2cf757);})['then'](function(_0x26e574){if(_0x26e574['length']>0x0)_0x50e4b3['where'](_0x7cbc('0xb5'),_[_0x7cbc('0x47')](_0x26e574,'id'));return db[_0x7cbc('0xa1')][_0x7cbc('0x50')](_0x50e4b3[_0x7cbc('0xa2')](),_0x2cf757)[_0x7cbc('0x3c')](function(_0xc55707){var _0x432c6a=_[_0x7cbc('0xb6')](_0xc55707,_0x7cbc('0xb7'));var _0x1eb8d5=[];_0x26e574[_0x7cbc('0x7b')](function(_0x4d2dc4){_0x1eb8d5[_0x7cbc('0x4c')](updateChatInteraction(_0x4d2dc4,_0x56ee8d,_0x432c6a));});return BPromise['all'](_0x1eb8d5);});});})[_0x7cbc('0x3c')](function(_0x28cf80){_0x1ff56e[_0x7cbc('0xb8')]=_0x28cf80;return _0x1ff56e;})['then'](respondWithFilteredResult(_0x1f0f27,_0x24bed3))[_0x7cbc('0x2e')](handleError(_0x1f0f27,null));};exports['show']=function(_0x5beef5,_0x59c03f){var _0x4ff489={'raw':![],'where':{'id':_0x5beef5['params']['id']}},_0x22acb7={};_0x22acb7['model']=_[_0x7cbc('0x51')](db['ChatInteraction'][_0x7cbc('0xb9')]);_0x22acb7['query']=_[_0x7cbc('0x51')](_0x5beef5[_0x7cbc('0x50')]);_0x22acb7['filters']=_[_0x7cbc('0x52')](_0x22acb7[_0x7cbc('0x4f')],_0x22acb7[_0x7cbc('0x50')]);_0x4ff489[_0x7cbc('0x53')]=_[_0x7cbc('0x52')](_0x22acb7[_0x7cbc('0x4f')],qs['fields'](_0x5beef5['query'][_0x7cbc('0x54')]));_0x4ff489['attributes']=_0x4ff489['attributes'][_0x7cbc('0x55')]?_0x4ff489[_0x7cbc('0x53')]:_0x22acb7[_0x7cbc('0x4f')];if(_0x5beef5[_0x7cbc('0x50')][_0x7cbc('0xba')]){_0x4ff489[_0x7cbc('0xbb')]=[{'all':!![]}];}_0x4ff489=_[_0x7cbc('0x40')]({},_0x4ff489,_0x5beef5[_0x7cbc('0xbc')]);return db['ChatInteraction'][_0x7cbc('0x6b')](_0x4ff489)[_0x7cbc('0x3c')](handleEntityNotFound(_0x59c03f,null))['then'](respondWithResult(_0x59c03f,null))[_0x7cbc('0x2e')](handleError(_0x59c03f,null));};exports[_0x7cbc('0xbd')]=function(_0x3e14f7,_0x35b31b){return db['ChatInteraction'][_0x7cbc('0xbd')](_0x3e14f7[_0x7cbc('0x41')],{})['then'](respondWithResult(_0x35b31b,0xc9))['catch'](handleError(_0x35b31b,null));};exports[_0x7cbc('0x3b')]=function(_0x359d38,_0x1fc421){if(_0x359d38[_0x7cbc('0x41')]['id']){delete _0x359d38[_0x7cbc('0x41')]['id'];}return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x359d38[_0x7cbc('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1fc421,null))['then'](saveUpdates(_0x359d38[_0x7cbc('0x41')],null))[_0x7cbc('0x3c')](respondWithResult(_0x1fc421,null))['catch'](handleError(_0x1fc421,null));};exports[_0x7cbc('0xbf')]=function(_0x2c4b2d,_0x4e3f40){return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x2c4b2d[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x4e3f40,null))[_0x7cbc('0x3c')](removeEntity(_0x4e3f40,null))['catch'](handleError(_0x4e3f40,null));};exports['describe']=function(_0xc2d796,_0xcbf428){return db[_0x7cbc('0x4d')]['describe']()[_0x7cbc('0x3c')](respondWithResult(_0xcbf428,null))[_0x7cbc('0x2e')](handleError(_0xcbf428,null));};exports[_0x7cbc('0xc0')]=function(_0x34338e,_0x2d2bb8){var _0x3176f8=_0x34338e['params']['id'];var _0x376493;var _0x4fbdaf;var _0x24517c;return db[_0x7cbc('0x4d')][_0x7cbc('0xc1')]({'where':{'id':_0x3176f8}})[_0x7cbc('0x3c')](function(_0x11b39e){_0x376493=_0x11b39e;return db[_0x7cbc('0xc2')][_0x7cbc('0xc1')]({'where':{'id':_0x11b39e[_0x7cbc('0x83')]},'attributes':['id',_0x7cbc('0xc3'),_0x7cbc('0xc4'),'vidaooTopic',_0x7cbc('0xc5'),_0x7cbc('0xc6')],'raw':!![]});})[_0x7cbc('0x3c')](function(_0xc03641){if(_0xc03641&&_0xc03641['vidaooApiKey']&&_0xc03641[_0x7cbc('0xc4')]){_0x4fbdaf=_0xc03641;var _0x351fd0={'interaction':{'id':_0x3176f8},'agent':{'id':_0x34338e[_0x7cbc('0x9d')]['id'],'name':_0x34338e[_0x7cbc('0x9d')][_0x7cbc('0x3e')],'fullname':_0x34338e[_0x7cbc('0x9d')]['fullname'],'email':_0x34338e[_0x7cbc('0x9d')][_0x7cbc('0xc7')]},'contact':_0x34338e[_0x7cbc('0x41')][_0x7cbc('0x42')],'account':_0x34338e[_0x7cbc('0x41')][_0x7cbc('0x45')]};var _0x5002f3={'rejectUnauthorized':![],'method':_0x7cbc('0xc8'),'url':_0x7cbc('0xc9'),'headers':{'X-APIKEY':_0xc03641[_0x7cbc('0xc3')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x34338e[_0x7cbc('0x9d')][_0x7cbc('0xc7')]],'buttons':null,'topic':_0x4fbdaf[_0x7cbc('0xca')],'note':_[_0x7cbc('0xcb')](_0x4fbdaf[_0x7cbc('0xc5')])?null:getMustacheRender(_0x4fbdaf[_0x7cbc('0xc5')],_0x351fd0),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x7cbc('0xcb')](_0x4fbdaf['vidaooMetadata'])){var _0x37f7c3=getMustacheRender(_0x4fbdaf[_0x7cbc('0xc6')],_0x351fd0);var _0x1f0572=JSON[_0x7cbc('0xcc')](_0x37f7c3);_0x5002f3['body']['metadata']=_0x1f0572;}}catch(_0xf35cbd){throw new db[(_0x7cbc('0x94'))][(_0x7cbc('0xcd'))](_0x7cbc('0xce'));}return rp(_0x5002f3);}else{throw new db['Sequelize'][(_0x7cbc('0xcd'))](_0x7cbc('0xcf'));}})['then'](function(_0x27207f){_0x24517c=_0x27207f;if(_0x24517c['id']){var _0x18af8b={'body':_0x24517c[_0x7cbc('0xd0')],'ChatWebsiteId':_0x4fbdaf['id'],'ChatInteractionId':_0x376493['id'],'direction':_0x7cbc('0xd1'),'UserId':_0x34338e[_0x7cbc('0x9d')]['id']};return db[_0x7cbc('0xd2')][_0x7cbc('0xbd')](_0x18af8b,{});}else{throw new db[(_0x7cbc('0x94'))][(_0x7cbc('0xcd'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x7cbc('0x3c')](function(){return _0x376493['updateAttributes']({'vidaooSessionId':_0x24517c['id']});})[_0x7cbc('0x3c')](respondWithResult(_0x2d2bb8,null))[_0x7cbc('0x2e')](handleError(_0x2d2bb8,null));};exports[_0x7cbc('0xd3')]=function(_0x24857e,_0x5dff5a){if(_0x24857e[_0x7cbc('0x41')]['id']){delete _0x24857e[_0x7cbc('0x41')]['id'];}return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x24857e[_0x7cbc('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0x7cbc('0x70')}]})[_0x7cbc('0x3c')](handleEntityNotFound(_0x5dff5a,null))['then'](saveUpdates(_0x24857e[_0x7cbc('0x41')],null))[_0x7cbc('0x3c')](respondWithResult(_0x5dff5a,null))['catch'](handleError(_0x5dff5a,null));};exports[_0x7cbc('0xd4')]=function(_0x49345d,_0x2e210c,_0x3a8040){if(_0x49345d[_0x7cbc('0x41')]['id']){delete _0x49345d[_0x7cbc('0x41')]['id'];}return db[_0x7cbc('0x4d')]['find']({'where':{'id':_0x49345d[_0x7cbc('0xbe')]['id']}})['then'](function(_0x274728){if(!_0x274728){logger[_0x7cbc('0x2a')](_0x7cbc('0xd5'),_0x7cbc('0xd4'),0x194,_0x7cbc('0xd6'));_0x2e210c[_0x7cbc('0x2f')](0x194);}else{if(_0x274728[_0x7cbc('0x80')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0x274728;})[_0x7cbc('0x3c')](function(_0x425823){if(_0x425823){return _0x425823[_0x7cbc('0x3b')]({'closed':_0x49345d['body']['closed'],'disposition':_0x49345d[_0x7cbc('0x41')][_0x7cbc('0xd7')]})['then'](function(_0xe28d89){return _0xe28d89;});}})[_0x7cbc('0x3c')](function(_0x2a9cdf){return respondWithRpcPromise(_0x7cbc('0xd8'),_0x7cbc('0xd4'),_0x49345d[_0x7cbc('0x41')],client9004);})['then'](respondWithResult(_0x2e210c,null))[_0x7cbc('0x2e')](handleError(_0x2e210c,null));};exports[_0x7cbc('0xd9')]=function(_0x5885d9,_0x39b158,_0x177f88){_0x5885d9['body'][_0x7cbc('0x3e')]=_0x5885d9[_0x7cbc('0xda')][_0x7cbc('0xdb')];_0x5885d9[_0x7cbc('0x41')][_0x7cbc('0xdc')]=_0x5885d9[_0x7cbc('0xda')][_0x7cbc('0xdd')];_0x5885d9[_0x7cbc('0x41')][_0x7cbc('0x4e')]=_0x5885d9[_0x7cbc('0xda')][_0x7cbc('0xde')];return db[_0x7cbc('0xdf')][_0x7cbc('0xbd')](_0x5885d9[_0x7cbc('0x41')])[_0x7cbc('0x3c')](respondWithResult(_0x39b158,0xc9))['catch'](handleError(_0x39b158,null));};exports['attachmentDownload']=function(_0x254663,_0x51cc8d,_0x3be5ea){return db[_0x7cbc('0x4d')][_0x7cbc('0xc1')]({'where':{'id':_0x254663[_0x7cbc('0xbe')]['id']},'raw':!![]})[_0x7cbc('0x3c')](handleEntityNotFound(_0x51cc8d,null))[_0x7cbc('0x3c')](function(_0x5304c2){if(_0x5304c2){if(_0x5304c2[_0x7cbc('0xe0')]){return _0x51cc8d['status'](0x193)['json']({'status':0x193,'message':_0x7cbc('0xe1')});}return db['Attachment']['findOne']({'where':{'id':_0x254663[_0x7cbc('0x50')]['attachId']},'raw':!![]})[_0x7cbc('0x3c')](handleEntityNotFound(_0x51cc8d,null));}})[_0x7cbc('0x3c')](function(_0x5ecbde){if(_0x5ecbde){var _0x42eda3=_0x5ecbde['ChatOfflineMessageId']!==null;var _0x4b1c25=path['join'](config[_0x7cbc('0xe2')],'server/files/attachments/');if(_0x42eda3){_0x4b1c25=path[_0x7cbc('0xe3')](_0x4b1c25,'offline-chat/');}var _0x4e9b56=path[_0x7cbc('0xe3')](_0x4b1c25,_0x5ecbde[_0x7cbc('0xdc')]);return _0x51cc8d[_0x7cbc('0xe4')](_0x4e9b56);}})['catch'](handleError(_0x51cc8d,null));};exports['close']=function(_0x14e32d,_0xf051e6){var _0x3cb778=null;var _0x682d83=null;var _0x5ac96b=null;var _0xa1da71=null;if(_0x14e32d[_0x7cbc('0x41')]['id']){delete _0x14e32d[_0x7cbc('0x41')]['id'];}if(_0x14e32d['body'][_0x7cbc('0xe5')]){_0xa1da71=path[_0x7cbc('0xe3')](config[_0x7cbc('0xe2')],_0x7cbc('0xe6'),util[_0x7cbc('0xe7')]('transcript-%s.txt',Date[_0x7cbc('0xe8')]()));_0x14e32d[_0x7cbc('0x41')]['pathTranscript']=_0xa1da71;}return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x14e32d[_0x7cbc('0xbe')]['id']},'include':[{'model':db[_0x7cbc('0xd2')],'as':'Messages','include':[{'model':db[_0x7cbc('0x7e')],'as':_0x7cbc('0x7e')}]}]})[_0x7cbc('0x3c')](handleEntityNotFound(_0xf051e6,null))['then'](saveUpdates(_0x14e32d['body'],null))[_0x7cbc('0x3c')](function(_0x4fbb5d){if(_0x4fbb5d){_0x3cb778=_0x4fbb5d;return db[_0x7cbc('0xc2')][_0x7cbc('0x6b')]({'where':{'id':_0x3cb778['ChatWebsiteId']}});}})['then'](function(_0x324866){if(_0x324866){_0x5ac96b=_0x324866;return db[_0x7cbc('0xe9')][_0x7cbc('0x6b')]({'where':{'id':_0x3cb778['ContactId']}});}})[_0x7cbc('0x3c')](function(_0x12ea21){if(_0x12ea21){_0x682d83=_0x12ea21;if(_0xa1da71){var _0x142320=null;for(var _0x182d65=0x1;_0x182d65<_0x3cb778[_0x7cbc('0xea')]['length'];++_0x182d65){_0x142320=_0x3cb778[_0x7cbc('0xea')][_0x182d65];var _0x595533=_0x142320[_0x7cbc('0x80')]?util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),_0x5ac96b[_0x7cbc('0xec')],_0x142320[_0x7cbc('0x80')]):_0x7cbc('0xed');var _0x30cf48=_0x14e32d[_0x7cbc('0x41')]['customer']||util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),'Visitor',_0x142320[_0x7cbc('0x76')]);switch(_0x5ac96b['agentIdentifier']){case _0x7cbc('0xee'):_0x595533=_0x142320[_0x7cbc('0x80')]?util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),_0x5ac96b[_0x7cbc('0xec')],_0x142320[_0x7cbc('0x80')]):_0x7cbc('0xed');break;case _0x7cbc('0xef'):_0x595533=_0x142320[_0x7cbc('0x80')]?_0x142320[_0x7cbc('0x7e')][_0x7cbc('0xf0')]||_0x142320[_0x7cbc('0x7e')][_0x7cbc('0x48')]:'System';break;case _0x7cbc('0xf1'):_0x595533=_0x142320[_0x7cbc('0x80')]?_0x142320[_0x7cbc('0x7e')][_0x7cbc('0x48')]:_0x7cbc('0xed');break;default:_0x595533=_0x142320[_0x7cbc('0x80')]?util[_0x7cbc('0xe7')](_0x7cbc('0xeb'),_0x5ac96b[_0x7cbc('0xec')],_0x142320[_0x7cbc('0x80')]):_0x7cbc('0xed');}var _0x1d3fc5=util['format'](_0x7cbc('0xf2'),moment(_0x142320[_0x7cbc('0x86')])['format'](_0x7cbc('0xf3')),_0x142320['direction']==='in'?_0x30cf48:_0x595533,_0x142320[_0x7cbc('0x41')]);if(!_0x142320[_0x7cbc('0xf4')]){fs[_0x7cbc('0xf5')](_0xa1da71,_0x1d3fc5);}}return db[_0x7cbc('0xf6')][_0x7cbc('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0x7cbc('0xf7')],'as':'Smtp','raw':!![]}]});}}})[_0x7cbc('0x3c')](function(_0x4fdaa9){if(_0x4fdaa9&&_0x4fdaa9['Smtp']&&_0x14e32d['body']){var _0x699750={'tls':{'rejectUnauthorized':![]}};if(_0x4fdaa9['Smtp'][_0x7cbc('0xf8')]){_0x699750[_0x7cbc('0xf8')]=_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xf8')];}else{_0x699750[_0x7cbc('0xfa')]=_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfa')];_0x699750['port']=_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfb')];_0x699750[_0x7cbc('0xfc')]=_0x4fdaa9['Smtp'][_0x7cbc('0xfc')];}if(_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfd')]){_0x699750['auth']={'user':_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0x9d')],'pass':_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0xfe')]};}return respondWithRpcPromise(_0x7cbc('0xff'),_0x7cbc('0x100'),{'account':_0x699750,'message':{'from':util[_0x7cbc('0xe7')]('\x22%s\x22\x20<%s>',_0x4fdaa9['name'],_0x4fdaa9[_0x7cbc('0xc7')]||_0x4fdaa9[_0x7cbc('0xf9')][_0x7cbc('0x9d')]),'to':_0x14e32d[_0x7cbc('0x41')][_0x7cbc('0xe5')],'subject':_0x7cbc('0x101'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x14e32d['body'][_0x7cbc('0xe5')]),'attachments':[{'path':_0xa1da71}]}})[_0x7cbc('0x3c')](function(){return _0x3cb778;})['catch'](function(_0x496599){console[_0x7cbc('0x2a')](_0x496599);});}else{return _0x3cb778;}})['then'](respondWithStatusCode(_0xf051e6,0xc8))['catch'](handleError(_0xf051e6,null));};exports[_0x7cbc('0x102')]=function(_0x5d1ad2,_0x2fff24,_0x59ed3c){return db[_0x7cbc('0xd2')][_0x7cbc('0x6b')]({'where':{'id':_0x5d1ad2[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x2fff24,null))[_0x7cbc('0x3c')](function(_0x5b0a43){if(_0x5b0a43){return _0x5b0a43[_0x7cbc('0x102')](_0x5d1ad2[_0x7cbc('0x41')][_0x7cbc('0x103')],_[_0x7cbc('0x104')](_0x5d1ad2['body'],[_0x7cbc('0x103'),'id'])||{});}})[_0x7cbc('0x3c')](respondWithResult(_0x2fff24,null))['catch'](handleError(_0x2fff24,null));};exports['getMessages']=function(_0x1ba70a,_0x3bd088,_0x27fbe7){var _0x466b29={'raw':![],'where':{}};var _0x3e8769={};var _0x39f6a5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x7cbc('0xc1')]({'where':{'id':_0x1ba70a['params']['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x3bd088,null))[_0x7cbc('0x3c')](function(_0x5c682b){if(_0x5c682b){_0x3e8769['model']=_[_0x7cbc('0x51')](db[_0x7cbc('0xd2')][_0x7cbc('0xb9')]);_0x3e8769[_0x7cbc('0x50')]=_[_0x7cbc('0x51')](_0x1ba70a[_0x7cbc('0x50')]);_0x3e8769[_0x7cbc('0x58')]=_[_0x7cbc('0x52')](_0x3e8769[_0x7cbc('0x4f')],_0x3e8769[_0x7cbc('0x50')]);_0x466b29[_0x7cbc('0x53')]=_['intersection'](_0x3e8769[_0x7cbc('0x4f')],qs[_0x7cbc('0x54')](_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x54')]));_0x466b29[_0x7cbc('0x53')]=_0x466b29[_0x7cbc('0x53')][_0x7cbc('0x55')]?_0x466b29['attributes']:_0x3e8769[_0x7cbc('0x4f')];if(!_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x56')](_0x7cbc('0x105'))){_0x466b29[_0x7cbc('0x33')]=qs[_0x7cbc('0x33')](_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x33')]);_0x466b29[_0x7cbc('0x36')]=qs[_0x7cbc('0x36')](_0x1ba70a[_0x7cbc('0x50')]['offset']);}_0x466b29[_0x7cbc('0x97')]=qs[_0x7cbc('0x57')](_0x1ba70a['query']['sort']);_0x466b29[_0x7cbc('0x84')]=qs[_0x7cbc('0x58')](_[_0x7cbc('0x106')](_0x1ba70a['query'],_0x3e8769[_0x7cbc('0x58')]));_0x466b29[_0x7cbc('0x84')][_0x7cbc('0xb7')]=_0x5c682b['id'];if(_0x1ba70a[_0x7cbc('0x50')]['filter']){_0x466b29[_0x7cbc('0x84')]=_[_0x7cbc('0x40')](_0x466b29[_0x7cbc('0x84')],{'$or':_[_0x7cbc('0x47')](_0x466b29[_0x7cbc('0x53')],function(_0x485739){var _0x131e3e={};_0x131e3e[_0x485739]={'$like':'%'+_0x1ba70a['query'][_0x7cbc('0x90')]+'%'};return _0x131e3e;})});}if(_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x87')]){var _0x17807f=_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0x87')]['split'](',');var _0x28ee93={};_0x28ee93[_0x17807f[0x0]]={'$gte':moment(_0x17807f[0x1])[_0x7cbc('0xe7')](_0x7cbc('0x107'))};_0x466b29['where']=_['merge'](_0x466b29[_0x7cbc('0x84')],_0x28ee93);}_0x466b29=_[_0x7cbc('0x40')]({},_0x466b29,_0x1ba70a['options']);return db[_0x7cbc('0xd2')]['count']({'where':_0x466b29[_0x7cbc('0x84')]})[_0x7cbc('0x3c')](function(_0x3a082c){_0x39f6a5[_0x7cbc('0x35')]=_0x3a082c;if(_0x1ba70a[_0x7cbc('0x50')][_0x7cbc('0xba')]){_0x466b29[_0x7cbc('0xbb')]=[{'all':!![]}];}return db[_0x7cbc('0xd2')][_0x7cbc('0x108')](_0x466b29);})[_0x7cbc('0x3c')](function(_0x1a83e3){_0x39f6a5[_0x7cbc('0xb8')]=_0x1a83e3;return _0x39f6a5;});}})['then'](respondWithFilteredResult(_0x3bd088,_0x466b29))[_0x7cbc('0x2e')](handleError(_0x3bd088,null));};exports[_0x7cbc('0x109')]=function(_0x1f2bae,_0x336538,_0x339b76){var _0xf9e31f={'where':{}},_0x1bfa62={},_0x1b2c70={'count':0x0,'rows':[]};return db[_0x7cbc('0x4d')]['findOne']({'where':{'id':_0x1f2bae[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x336538,null))[_0x7cbc('0x3c')](function(_0x503911){if(_0x503911){_0x1bfa62[_0x7cbc('0x4f')]=_[_0x7cbc('0x51')](db[_0x7cbc('0xd2')][_0x7cbc('0xb9')]);_0x1bfa62['query']=_[_0x7cbc('0x51')](_0x1f2bae['query']);_0x1bfa62[_0x7cbc('0x58')]=_[_0x7cbc('0x52')](_0x1bfa62[_0x7cbc('0x4f')],_0x1bfa62['query']);_0xf9e31f[_0x7cbc('0x53')]=_['intersection'](_0x1bfa62[_0x7cbc('0x4f')],qs['fields'](_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0x54')]));_0xf9e31f[_0x7cbc('0x53')]=_0xf9e31f[_0x7cbc('0x53')]['length']?_0xf9e31f['attributes']:_0x1bfa62[_0x7cbc('0x4f')];if(!_0x1f2bae['query']['hasOwnProperty'](_0x7cbc('0x105'))){_0xf9e31f[_0x7cbc('0x33')]=qs['limit'](_0x1f2bae['query']['limit']);_0xf9e31f[_0x7cbc('0x36')]=qs[_0x7cbc('0x36')](_0x1f2bae[_0x7cbc('0x50')]['offset']);}_0xf9e31f['order']=qs[_0x7cbc('0x57')](_0x1f2bae[_0x7cbc('0x50')]['sort']);_0xf9e31f['where']=qs['filters'](_[_0x7cbc('0x106')](_0x1f2bae[_0x7cbc('0x50')],_0x1bfa62[_0x7cbc('0x58')]));_0xf9e31f[_0x7cbc('0x84')]['ChatInteractionId']=_0x503911['id'];if(_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0x90')]){_0xf9e31f[_0x7cbc('0x84')]=_[_0x7cbc('0x40')](_0xf9e31f[_0x7cbc('0x84')],{'$or':_[_0x7cbc('0x47')](_0xf9e31f[_0x7cbc('0x53')],function(_0xf0718f){var _0x571d8e={};_0x571d8e[_0xf0718f]={'$like':'%'+_0x1f2bae['query']['filter']+'%'};return _0x571d8e;})});}_0xf9e31f[_0x7cbc('0x84')][_0x7cbc('0xf4')]=![];if(_0x1f2bae[_0x7cbc('0x50')]['id']){_0xf9e31f['where']['id']={'$gt':_0x1f2bae['query']['id']};}_0xf9e31f=_['merge']({},_0xf9e31f,_0x1f2bae[_0x7cbc('0xbc')]);return db['ChatMessage'][_0x7cbc('0x35')]({'where':_0xf9e31f[_0x7cbc('0x84')]})[_0x7cbc('0x3c')](function(_0x39e435){_0x1b2c70[_0x7cbc('0x35')]=_0x39e435;_0xf9e31f[_0x7cbc('0xbb')]=[];if(_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0x10a')]){_0xf9e31f[_0x7cbc('0xbb')][_0x7cbc('0x4c')]({'model':db[_0x7cbc('0x7e')],'as':_0x7cbc('0x7e'),'attributes':['id',_0x7cbc('0x48'),_0x7cbc('0xf0')]});}if(_0x1f2bae[_0x7cbc('0x50')][_0x7cbc('0xba')]){_0xf9e31f[_0x7cbc('0xbb')]=[{'all':!![]}];}return db['ChatMessage'][_0x7cbc('0x108')](_0xf9e31f);})['then'](function(_0x11b068){_0x1b2c70['rows']=_0x11b068;return _0x1b2c70;});}})[_0x7cbc('0x3c')](respondWithFilteredResult(_0x336538,_0xf9e31f))[_0x7cbc('0x2e')](handleError(_0x336538,null));};exports[_0x7cbc('0x10b')]=function(_0x22a71c,_0x1a0ccb,_0x4f8177){return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x22a71c[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x1a0ccb,null))[_0x7cbc('0x3c')](function(_0x2dab8a){if(_0x2dab8a){return _0x2dab8a[_0x7cbc('0x10c')](_0x22a71c[_0x7cbc('0x41')][_0x7cbc('0x103')],_['omit'](_0x22a71c['body'],[_0x7cbc('0x103'),'id'])||{})['spread'](function(){return db[_0x7cbc('0x7a')]['findAll']({'attributes':['id',_0x7cbc('0x3e'),'color'],'where':{'id':_0x22a71c[_0x7cbc('0x41')][_0x7cbc('0x103')]}});})[_0x7cbc('0x3c')](function(_0x5c6d48){socket['emit'](_0x7cbc('0x10d'),{'id':Number(_0x22a71c[_0x7cbc('0xbe')]['id']),'tags':_0x5c6d48||[]});return{'id':Number(_0x22a71c['params']['id']),'tags':_0x5c6d48||[]};});}})[_0x7cbc('0x3c')](respondWithResult(_0x1a0ccb,null))['catch'](handleError(_0x1a0ccb,null));};exports[_0x7cbc('0x10e')]=function(_0xec4872,_0x27b522,_0x30b3ee){return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0xec4872[_0x7cbc('0xbe')]['id']}})[_0x7cbc('0x3c')](handleEntityNotFound(_0x27b522,null))[_0x7cbc('0x3c')](function(_0x54894d){if(_0x54894d){return _0x54894d[_0x7cbc('0x10e')](_0xec4872[_0x7cbc('0x50')][_0x7cbc('0x103')]);}})[_0x7cbc('0x3c')](respondWithStatusCode(_0x27b522,null))[_0x7cbc('0x2e')](handleError(_0x27b522,null));};exports[_0x7cbc('0xe4')]=function(_0x4a47aa,_0x3ea8d0){var _0x348396=moment()['unix']()['toString']();var _0x2b8162=path['join'](config[_0x7cbc('0xe2')],_0x7cbc('0x10f'),_0x7cbc('0x110'),'tmp');var _0x250841=path[_0x7cbc('0xe3')](config[_0x7cbc('0xe2')],_0x7cbc('0x10f'),_0x7cbc('0x110'),_0x7cbc('0x111'));var _0x43d71b=path[_0x7cbc('0xe3')](_0x2b8162,_0x348396);var _0x37d512=util[_0x7cbc('0xe7')](_0x7cbc('0x112'),_0x4a47aa[_0x7cbc('0xbe')]['id'],_0x348396);var _0x20aa92=path[_0x7cbc('0xe3')](_0x2b8162,_0x37d512);var _0x562670=[];_0x562670[_0x7cbc('0x4c')]({'model':db[_0x7cbc('0x7e')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x562670[_0x7cbc('0x4c')]({'model':db['CmContact'],'as':_0x7cbc('0x70'),'attributes':['id',_0x7cbc('0x113'),_0x7cbc('0x114')],'raw':!![]});if(_0x4a47aa[_0x7cbc('0x50')][_0x7cbc('0x111')]){_0x562670['push']({'model':db[_0x7cbc('0xdf')],'as':'Attachment','raw':!![]});}var _0x31ef1e=[{'model':db[_0x7cbc('0xd2')],'as':_0x7cbc('0xea'),'attributes':['id','body','createdAt',_0x7cbc('0x115'),_0x7cbc('0xf4'),'read'],'include':_0x562670}];_0x31ef1e[_0x7cbc('0x4c')]({'model':db[_0x7cbc('0xc2')],'as':'Account','attributes':['id',_0x7cbc('0x3e')]});_0x31ef1e[_0x7cbc('0x4c')]({'model':db[_0x7cbc('0x7e')],'as':_0x7cbc('0x116'),'attributes':['id','fullname']});return db[_0x7cbc('0x4d')][_0x7cbc('0x6b')]({'where':{'id':_0x4a47aa['params']['id']},'include':_0x31ef1e})[_0x7cbc('0x3c')](handleEntityNotFound(_0x3ea8d0,null))[_0x7cbc('0x3c')](function(_0x565d3b){if(_0x565d3b){var _0x284d95=_0x565d3b['get']({'plain':!![]});fs['mkdirSync'](_0x43d71b);var _0x301d18={'channel':_0x7cbc('0x117'),'account':_0x284d95[_0x7cbc('0x118')][_0x7cbc('0x3e')],'agent':_0x284d95[_0x7cbc('0x116')]?_0x284d95['Owner'][_0x7cbc('0x48')]:_0x7cbc('0x119'),'createdAt':moment(_0x284d95[_0x7cbc('0x86')])[_0x7cbc('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7cbc('0xa2')](),'closedAt':_0x284d95[_0x7cbc('0xe0')]?moment(_0x284d95['closedAt'])[_0x7cbc('0xe7')](_0x7cbc('0x107'))[_0x7cbc('0xa2')]():'','disposition':_0x284d95['disposition'],'chatInfo':{'browser':_0x284d95['browserName'],'os':_0x284d95[_0x7cbc('0x11a')],'referer':_0x284d95['referer'],'customerIp':_0x284d95[_0x7cbc('0x11b')],'customerPort':_0x284d95['customerPort']?_0x284d95[_0x7cbc('0x11c')]:_0x7cbc('0x119')},'messages':_(_0x284d95[_0x7cbc('0xea')])[_0x7cbc('0x11d')]()[_0x7cbc('0x90')]({'secret':![]})['map'](function(_0x5dca55){if(_0x5dca55[_0x7cbc('0xdf')]){var _0x21ea18=path[_0x7cbc('0xe3')](_0x250841,_0x5dca55[_0x7cbc('0xdf')]['basename']);if(fs[_0x7cbc('0x11e')](_0x21ea18)){fs[_0x7cbc('0x11f')](_0x21ea18)[_0x7cbc('0x120')](fs[_0x7cbc('0x121')](path[_0x7cbc('0xe3')](_0x43d71b,_0x5dca55[_0x7cbc('0xdf')][_0x7cbc('0xdc')])));}}return{'date':moment(_0x5dca55[_0x7cbc('0x86')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x7cbc('0xa2')](),'sender':_0x5dca55['direction']===_0x7cbc('0xd1')?_0x5dca55[_0x7cbc('0x7e')]?_0x5dca55[_0x7cbc('0x7e')][_0x7cbc('0x48')]:'System':_0x5dca55[_0x7cbc('0x70')]['firstName']+(_0x5dca55[_0x7cbc('0x70')][_0x7cbc('0x114')]?'\x20'+_0x5dca55[_0x7cbc('0x70')][_0x7cbc('0x114')]:''),'body':_0x5dca55[_0x7cbc('0xdf')]?_0x5dca55[_0x7cbc('0xdf')][_0x7cbc('0xdc')]:_0x5dca55[_0x7cbc('0x41')],'direction':_0x5dca55['direction']==='out'?'A':'C','secret':_0x5dca55['secret'],'read':_0x5dca55[_0x7cbc('0x8c')],'attachment':_0x5dca55[_0x7cbc('0xdf')]};})[_0x7cbc('0x6d')]()};return ejs[_0x7cbc('0x122')](path[_0x7cbc('0xe3')](config['root'],_0x7cbc('0x10f'),'views','downloadInteraction.html'),{'interaction':_0x301d18})[_0x7cbc('0x3c')](function(_0x10301c){var _0x2d0076=path[_0x7cbc('0xe3')](_0x43d71b,_0x7cbc('0x123')+_0x284d95['id']+'-'+_0x348396+_0x7cbc('0x124'));var _0xef22e2={'path':_0x2d0076,'channel':_0x7cbc('0x117'),'interactionId':_0x284d95['id']};return pdf[_0x7cbc('0x125')](_0x10301c,_0xef22e2);})[_0x7cbc('0x3c')](function(){return new BPromise(function(_0x359385,_0x1e9360){zipdir(_0x43d71b,{'saveTo':_0x20aa92},function(_0x2dfc03,_0x31412c){if(_0x2dfc03)return _0x1e9360(_0x2dfc03);return _0x359385(_0x31412c);});})[_0x7cbc('0x3c')](function(){return new BPromise(function(_0x1f84f7,_0x522775){rimraf(_0x43d71b,function(_0x3fb359){if(_0x3fb359)_0x522775(_0x3fb359);return _0x1f84f7();});});})['then'](function(){return _0x3ea8d0[_0x7cbc('0xe4')](_0x20aa92,_0x37d512,function(_0x39e07a){if(_0x39e07a){console['log'](_0x7cbc('0x126'),_0x39e07a);}else{fs[_0x7cbc('0x127')](_0x20aa92);}});});});}else{return _0x3ea8d0['sendStatus'](0xc8);}})[_0x7cbc('0x2e')](handleError(_0x3ea8d0,null));}; \ No newline at end of file +var _0xecdb=['`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','includeAll','options','create','update','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','ChatMessage','Messages','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','%s%d','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','includeAgent','setTags','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','browserName','osName','customerIp','customerPort','tail','existsSync','createWriteStream','renderFile','views','downloadInteraction.html','.pdf','Chat','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','destroy','stack','send','merge','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','ChatInteraction','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','length','conditions','find','having','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read'];(function(_0x5019c2,_0x21e430){var _0x1b28cc=function(_0x1fdc84){while(--_0x1fdc84){_0x5019c2['push'](_0x5019c2['shift']());}};_0x1b28cc(++_0x21e430);}(_0xecdb,0x1ea));var _0xbecd=function(_0x21dff0,_0x3297bf){_0x21dff0=_0x21dff0-0x0;var _0x22e07e=_0xecdb[_0x21dff0];return _0x22e07e;};'use strict';var emlformat=require(_0xbecd('0x0'));var rimraf=require(_0xbecd('0x1'));var zipdir=require(_0xbecd('0x2'));var jsonpatch=require(_0xbecd('0x3'));var rp=require('request-promise');var moment=require(_0xbecd('0x4'));var BPromise=require(_0xbecd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbecd('0x6'));var sox=require(_0xbecd('0x7'));var csv=require(_0xbecd('0x8'));var ejs=require(_0xbecd('0x9'));var fs=require('fs');var fs_extra=require(_0xbecd('0xa'));var _=require(_0xbecd('0xb'));var squel=require(_0xbecd('0xc'));var crypto=require('crypto');var jsforce=require(_0xbecd('0xd'));var deskjs=require(_0xbecd('0xe'));var toCsv=require(_0xbecd('0x8'));var querystring=require(_0xbecd('0xf'));var Papa=require(_0xbecd('0x10'));var Redis=require('ioredis');var authService=require(_0xbecd('0x11'));var qs=require(_0xbecd('0x12'));var as=require(_0xbecd('0x13'));var pdf=require(_0xbecd('0x14'));var hardwareService=require(_0xbecd('0x15'));var logger=require('../../config/logger')(_0xbecd('0x16'));var utils=require('../../config/utils');var config=require(_0xbecd('0x17'));var licenseUtil=require(_0xbecd('0x18'));var db=require(_0xbecd('0x19'))['db'];config[_0xbecd('0x1a')]=_[_0xbecd('0x1b')](config[_0xbecd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xbecd('0x1c'))(new Redis(config[_0xbecd('0x1a')]));require(_0xbecd('0x1d'))[_0xbecd('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0xbecd('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4d8894,_0x10daca,_0x21da0f,_0x202173){return new BPromise(function(_0x1e87e3,_0x3355e4){var _0x27cfcc=_0x202173||client;return _0x27cfcc['request'](_0x4d8894,_0x21da0f)[_0xbecd('0x20')](function(_0x39cadb){logger[_0xbecd('0x21')](_0xbecd('0x22'),_0x10daca,_0xbecd('0x23'));logger[_0xbecd('0x24')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x10daca,_0xbecd('0x23'),JSON[_0xbecd('0x25')](_0x39cadb));if(_0x39cadb['error']){if(_0x39cadb[_0xbecd('0x26')][_0xbecd('0x27')]===0x1f4){logger[_0xbecd('0x26')](_0xbecd('0x22'),_0x10daca,_0x39cadb[_0xbecd('0x26')][_0xbecd('0x28')]);return _0x3355e4(_0x39cadb[_0xbecd('0x26')][_0xbecd('0x28')]);}logger[_0xbecd('0x26')](_0xbecd('0x22'),_0x10daca,_0x39cadb[_0xbecd('0x26')]['message']);return _0x1e87e3(_0x39cadb['error']['message']);}else{logger[_0xbecd('0x21')](_0xbecd('0x22'),_0x10daca,_0xbecd('0x23'));_0x1e87e3(_0x39cadb['result'][_0xbecd('0x28')]);}})['catch'](function(_0x1a855e){logger['error'](_0xbecd('0x22'),_0x10daca,_0x1a855e);_0x3355e4(_0x1a855e);});});}function respondWithStatusCode(_0x2e9107,_0x549355){_0x549355=_0x549355||0xcc;return function(_0x1fe04d){if(_0x1fe04d){return _0x2e9107[_0xbecd('0x29')](_0x549355);}return _0x2e9107['status'](_0x549355)[_0xbecd('0x2a')]();};}function respondWithResult(_0x322ab3,_0x3d0685){_0x3d0685=_0x3d0685||0xc8;return function(_0x17da7c){if(_0x17da7c){return _0x322ab3['status'](_0x3d0685)['json'](_0x17da7c);}};}function respondWithFilteredResult(_0x184ee2,_0x5e1b4c){return function(_0x3f4ef1){if(_0x3f4ef1){var _0xcc2b0d=typeof _0x5e1b4c[_0xbecd('0x2b')]===_0xbecd('0x2c')&&typeof _0x5e1b4c[_0xbecd('0x2d')]===_0xbecd('0x2c');var _0x1e4184=_0x3f4ef1[_0xbecd('0x2e')];var _0x176593=_0xcc2b0d?0x0:_0x5e1b4c[_0xbecd('0x2b')];var _0x4b3c52=_0xcc2b0d?_0x3f4ef1[_0xbecd('0x2e')]:_0x5e1b4c[_0xbecd('0x2b')]+_0x5e1b4c[_0xbecd('0x2d')];var _0x4461b8;if(_0x4b3c52>=_0x1e4184){_0x4b3c52=_0x1e4184;_0x4461b8=0xc8;}else{_0x4461b8=0xce;}_0x184ee2[_0xbecd('0x2f')](_0x4461b8);return _0x184ee2[_0xbecd('0x30')](_0xbecd('0x31'),_0x176593+'-'+_0x4b3c52+'/'+_0x1e4184)['json'](_0x3f4ef1);}return null;};}function patchUpdates(_0xd2473f){return function(_0x1d9bd8){try{jsonpatch['apply'](_0x1d9bd8,_0xd2473f,!![]);}catch(_0x38842c){return BPromise['reject'](_0x38842c);}return _0x1d9bd8['save']();};}function saveUpdates(_0x3ee762,_0x2f49cb){return function(_0x5dbdc7){if(_0x5dbdc7){return _0x5dbdc7['update'](_0x3ee762)[_0xbecd('0x20')](function(_0x13e01c){return _0x13e01c;});}return null;};}function removeEntity(_0x1d7cc1,_0x4e8311){return function(_0x22f58f){if(_0x22f58f){return _0x22f58f[_0xbecd('0x32')]()[_0xbecd('0x20')](function(){_0x1d7cc1['status'](0xcc)[_0xbecd('0x2a')]();});}};}function handleEntityNotFound(_0x3f2567,_0x4d0b64){return function(_0xa3dfc){if(!_0xa3dfc){_0x3f2567[_0xbecd('0x29')](0x194);}return _0xa3dfc;};}function handleError(_0x59c5b8,_0x56d0a9){_0x56d0a9=_0x56d0a9||0x1f4;return function(_0x421d49){logger[_0xbecd('0x26')](_0x421d49[_0xbecd('0x33')]);if(_0x421d49['name']){delete _0x421d49['name'];}_0x59c5b8['status'](_0x56d0a9)[_0xbecd('0x34')](_0x421d49);};}function getMustacheRender(_0xd7535e,_0x2dc270){return Mustache['render'](_0xd7535e,_[_0xbecd('0x35')](_0x2dc270['body'],{'contact':_0x2dc270['contact'],'message':_0x2dc270[_0xbecd('0x28')],'agent':_0x2dc270[_0xbecd('0x36')],'interaction':_0x2dc270[_0xbecd('0x37')],'account':_0x2dc270[_0xbecd('0x38')]}))||'';}function getInteractionUsers(_0x46e24e,_0x12cc26){return new BPromise(function(_0xe901d1,_0x2917b7){try{if(_0x12cc26[_0x46e24e['id']]){_0x46e24e[_0xbecd('0x39')]=_['map'](_0x12cc26[_0x46e24e['id']],function(_0x15c245){return{'id':_0x15c245['id'],'fullname':_0x15c245[_0xbecd('0x3a')]};});}}catch(_0x19b771){_0x2917b7(_0x19b771);}_0xe901d1(_0x46e24e);});}function getInteractionTags(_0x46e253,_0x401501){return new BPromise(function(_0x536634,_0x37f83b){try{if(_0x46e253[_0xbecd('0x3b')]){_0x46e253[_0xbecd('0x3c')]=[];_0x46e253[_0xbecd('0x3b')][_0xbecd('0x3d')](',')[_0xbecd('0x3e')](function(_0x4accbf){_0x46e253['Tags'][_0xbecd('0x3f')](_0x401501[_0x4accbf]);});}delete _0x46e253[_0xbecd('0x3b')];}catch(_0x17abab){_0x37f83b(_0x17abab);}_0x536634(_0x46e253);});}function updateChatInteraction(_0x13a509,_0x371c8d,_0x31e906){return new BPromise(function(_0x26818e,_0x544154){return getInteractionUsers(_0x13a509,_0x31e906)[_0xbecd('0x20')](function(_0x25fefd){return getInteractionTags(_0x25fefd,_0x371c8d);})[_0xbecd('0x20')](function(_0x4629fc){_0x26818e(_0x4629fc);})[_0xbecd('0x40')](function(_0x57d4e2){_0x544154(_0x57d4e2);});});}exports['index']=function(_0x112405,_0x5ef998){var _0x2d578b={},_0x591bd2={},_0xa1dbe2={'count':0x0,'rows':[]};var _0x4942fa=_[_0xbecd('0x41')](db[_0xbecd('0x42')][_0xbecd('0x43')],function(_0x17d03e){return{'name':_0x17d03e[_0xbecd('0x44')],'type':_0x17d03e[_0xbecd('0x45')]['key']};});_0x591bd2[_0xbecd('0x46')]=_[_0xbecd('0x41')](_0x4942fa,_0xbecd('0x47'));_0x591bd2[_0xbecd('0x48')]=_['keys'](_0x112405[_0xbecd('0x48')]);_0x591bd2[_0xbecd('0x49')]=_[_0xbecd('0x4a')](_0x591bd2[_0xbecd('0x46')],_0x591bd2[_0xbecd('0x48')]);_0x2d578b[_0xbecd('0x4b')]=_[_0xbecd('0x4a')](_0x591bd2['model'],qs[_0xbecd('0x4c')](_0x112405[_0xbecd('0x48')][_0xbecd('0x4c')]));_0x2d578b[_0xbecd('0x4b')]=_0x2d578b[_0xbecd('0x4b')]['length']?_0x2d578b[_0xbecd('0x4b')]:_0x591bd2[_0xbecd('0x46')];if(!_0x112405[_0xbecd('0x48')][_0xbecd('0x4d')](_0xbecd('0x4e'))){_0x2d578b[_0xbecd('0x2d')]=qs[_0xbecd('0x2d')](_0x112405['query']['limit']);_0x2d578b['offset']=qs[_0xbecd('0x2b')](_0x112405[_0xbecd('0x48')][_0xbecd('0x2b')]);}_0x2d578b[_0xbecd('0x4f')]=qs[_0xbecd('0x50')](_0x112405[_0xbecd('0x48')]['sort']);_0x2d578b['where']=qs[_0xbecd('0x49')](_['pick'](_0x112405[_0xbecd('0x48')],_0x591bd2['filters']),_0x4942fa);var _0x473fad=[];var _0x46b9a7=squel[_0xbecd('0x51')]()['field']('id')[_0xbecd('0x52')](_0xbecd('0x47'))[_0xbecd('0x52')](_0xbecd('0x53'))['from'](_0xbecd('0x54'));var _0x4f6f4b=squel[_0xbecd('0x51')]()[_0xbecd('0x52')](_0xbecd('0x55'))[_0xbecd('0x52')](_0xbecd('0x56'))[_0xbecd('0x52')](_0xbecd('0x57'))[_0xbecd('0x58')](_0xbecd('0x59'),'ui')[_0xbecd('0x5a')](_0xbecd('0x5b'),'u',_0xbecd('0x5c'));var _0x578808=squel['select']()['from']('chat_interactions','i')[_0xbecd('0x5a')](_0xbecd('0x5d'),'c',_0xbecd('0x5e'))['left_join'](_0xbecd('0x5b'),'o',_0xbecd('0x5f'))[_0xbecd('0x5a')]('chat_websites','a',_0xbecd('0x60'))[_0xbecd('0x5a')]('chat_messages','me',_0xbecd('0x61'))['left_join'](_0xbecd('0x62'),'it',_0xbecd('0x63'))['left_join'](_0xbecd('0x54'),'t',_0xbecd('0x64'));var _0x467b00=squel[_0xbecd('0x65')]();var _0x124738=[];var _0x106444=squel[_0xbecd('0x65')]();var _0xab410d;if(_0x112405[_0xbecd('0x48')][_0xbecd('0x66')]){_0xab410d=as['parseSearch'](_0x112405['query'][_0xbecd('0x66')]);var _0x21e2fd=_0xab410d[_0xbecd('0x67')];for(var _0xe98125=0x0;_0xe98125<_0xab410d['conditions'][_0xbecd('0x68')];_0xe98125++){var _0x3f789c=_0xab410d[_0xbecd('0x69')][_0xe98125];var _0x167d01='i';var _0x5131b7=_[_0xbecd('0x6a')](_0x4942fa,[_0xbecd('0x47'),_0x3f789c[_0xbecd('0x52')]]);if(!_0x5131b7){switch(_0x3f789c[_0xbecd('0x52')]){case'unreadMessages':if(_0x3f789c['value']==0x1){_0x578808[_0xbecd('0x6b')]('`'+_0x3f789c['field']+'`\x20=\x200');}else{_0x578808[_0xbecd('0x6b')]('`'+_0x3f789c['field']+_0xbecd('0x6c'));}break;case _0xbecd('0x6d'):if(_0x3f789c['operator']===_0xbecd('0x6e')){if(_0x3f789c[_0xbecd('0x6f')][_0xbecd('0x3d')]('\x20')[_0xbecd('0x68')]>0x1){_0x467b00[_0x21e2fd](_0xbecd('0x70'),qs[_0xbecd('0x71')](_0x3f789c[_0xbecd('0x6f')]),null);}else{var _0x219b69='%'+_0x3f789c[_0xbecd('0x6f')]+'%';_0x467b00[_0x21e2fd]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x219b69,_0x219b69,_0x219b69);}}else{_0x5131b7=_['find'](_0x4942fa,['name',_0xbecd('0x72')]);_0x3f789c[_0xbecd('0x52')]=_0xbecd('0x72');_0x37953d=as[_0xbecd('0x73')](_0x167d01,_0x5131b7[_0xbecd('0x45')],_0x3f789c);_0x467b00[_0x21e2fd](_0x37953d[_0xbecd('0x74')],_0x37953d[_0xbecd('0x6f')][_0xbecd('0x75')],_0x37953d[_0xbecd('0x6f')][_0xbecd('0x2a')]);}break;case'Tag':var _0x1a0beb=_0x3f789c[_0xbecd('0x6f')][_0xbecd('0x3d')](',')[_0xbecd('0x41')](function(_0x562622){return Number(_0x562622);});_0x1a0beb[_0xbecd('0x3e')](function(_0x24e079){_0x106444['or'](_0xbecd('0x76'),'%,'+_0x24e079+',%');});_0x124738=_[_0xbecd('0x77')](_0x124738,_0x1a0beb);break;case _0xbecd('0x78'):if(_0x3f789c['operator']===_0xbecd('0x6e')){_0x467b00[_0x21e2fd](_0xbecd('0x79'),'%'+_0x3f789c[_0xbecd('0x6f')]+'%',null);}else{_0x5131b7=_['find'](_0x4942fa,[_0xbecd('0x47'),'UserId']);_0x3f789c[_0xbecd('0x52')]=_0xbecd('0x7a');_0x37953d=as[_0xbecd('0x73')](_0x167d01,_0x5131b7['type'],_0x3f789c);_0x467b00[_0x21e2fd](_0x37953d[_0xbecd('0x74')],_0x37953d[_0xbecd('0x6f')]['start'],_0x37953d[_0xbecd('0x6f')][_0xbecd('0x2a')]);}break;case _0xbecd('0x7b'):_0x37953d=as[_0xbecd('0x73')]('me',null,_0x3f789c);_0x467b00[_0x21e2fd](_0x37953d['text'],_0x37953d[_0xbecd('0x6f')][_0xbecd('0x75')],_0x37953d[_0xbecd('0x6f')][_0xbecd('0x2a')]);break;}}else{var _0x37953d=as[_0xbecd('0x73')](_0x167d01,_0x5131b7['type'],_0x3f789c);_0x467b00[_0x21e2fd](_0x37953d[_0xbecd('0x74')],_0x37953d[_0xbecd('0x6f')][_0xbecd('0x75')],_0x37953d[_0xbecd('0x6f')][_0xbecd('0x2a')]);}}}else{var _0x27d154=_(_0x112405[_0xbecd('0x48')])[_0xbecd('0x7c')]()[_0xbecd('0x41')](function(_0x30a710){return _[_0xbecd('0x7d')](_0x4942fa,[_0xbecd('0x47'),_0x30a710])?_0x30a710:undefined;})[_0xbecd('0x7e')]()[_0xbecd('0x6f')]();if(!_[_0xbecd('0x7f')](_0x27d154)){_0x27d154['forEach'](function(_0x4f8556){if(_0x4f8556==='ChatWebsiteId'){_0x578808[_0xbecd('0x80')](_0xbecd('0x81'),[][_0xbecd('0x82')](_0x112405[_0xbecd('0x48')][_0x4f8556]));}else if(_0x4f8556===_0xbecd('0x83')){var _0x46ea39=JSON[_0xbecd('0x84')](_0x112405[_0xbecd('0x48')][_0x4f8556])[_0xbecd('0x85')];var _0x36360b=JSON[_0xbecd('0x84')](_0x112405['query'][_0x4f8556])[_0xbecd('0x86')];_0x578808[_0xbecd('0x80')](_0xbecd('0x87'),_0x46ea39,_0x36360b);}else{if(_0x112405['query'][_0x4f8556]===_0xbecd('0x88')){_0x578808[_0xbecd('0x80')]('i.'+_0x4f8556+_0xbecd('0x89'));}else{_0x578808[_0xbecd('0x80')]('i.'+_0x4f8556+_0xbecd('0x8a'),_0x112405['query'][_0x4f8556]);}}});}if(_0x112405['query'][_0xbecd('0x8b')]){if(_0x112405['query']['read']==0x1){_0x578808[_0xbecd('0x6b')](_0xbecd('0x8c'));}else{_0x578808[_0xbecd('0x6b')](_0xbecd('0x8d'));}}if(_0x112405['query'][_0xbecd('0x8e')]){_0x124738=_[_0xbecd('0x8f')](_0x112405[_0xbecd('0x48')][_0xbecd('0x8e')])?_0x112405['query'][_0xbecd('0x8e')]:new Array(_0x112405[_0xbecd('0x48')][_0xbecd('0x8e')]);_0x124738[_0xbecd('0x3e')](function(_0x48a0a9){_0x106444['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x48a0a9+',%');});}if(_0x112405[_0xbecd('0x48')][_0xbecd('0x90')]){var _0x46876c=_0x112405['query'][_0xbecd('0x90')][_0xbecd('0x91')]('\x5c','\x5c\x5c')[_0xbecd('0x91')](/'/g,'\x27\x27');if(qs[_0xbecd('0x92')](_0x46876c)){_0x467b00['or'](_0xbecd('0x93'),_0x46876c+'%');}else{_0x467b00['or'](_0xbecd('0x94'),qs[_0xbecd('0x71')](_0x46876c))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x46876c+'%');}}}_0x578808[_0xbecd('0x80')](_0x467b00);_0x578808[_0xbecd('0x95')](_0xbecd('0x96'));var _0x2d4b31={'type':db[_0xbecd('0x97')][_0xbecd('0x98')]['SELECT'],'raw':!![]};var _0x5f299d=_0x578808['clone']();_0x5f299d['field'](_0xbecd('0x96'));_0x5f299d[_0xbecd('0x52')](_0xbecd('0x99'),'unreadMessages');if(_0x2d578b['order']){_0x2d578b[_0xbecd('0x4f')][_0xbecd('0x3e')](function(_0x29e071){var _0x53df7e=_0x29e071[0x0]===_0xbecd('0x9a')?_0x29e071[0x0]:'i.'+_0x29e071[0x0];_0x578808['order'](_0x53df7e,_0x29e071[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x124738)){_0x578808['having'](_0x106444);_0x5f299d[_0xbecd('0x80')](_0xbecd('0x9b'),_0x124738);}BPromise['resolve']()[_0xbecd('0x20')](function(){if(!_0xab410d){if(_0x112405[_0xbecd('0x48')][_0xbecd('0x9c')])return;_0x5f299d[_0xbecd('0x80')](_0xbecd('0x9d'));_0x578808[_0xbecd('0x80')](_0xbecd('0x9d'));return;}if(_0x112405[_0xbecd('0x9e')][_0xbecd('0x9f')]!==_0xbecd('0x36'))return;return _0x112405[_0xbecd('0x9e')][_0xbecd('0xa0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3b5d70){if(_[_0xbecd('0x7f')](_0x3b5d70)){_0x5f299d[_0xbecd('0x80')](_0xbecd('0xa1'));_0x578808['where'](_0xbecd('0xa1'));}else{_0x5f299d[_0xbecd('0x80')]('i.ChatWebsiteId\x20IN\x20?',_[_0xbecd('0x41')](_0x3b5d70,'id'));_0x578808['where'](_0xbecd('0x81'),_[_0xbecd('0x41')](_0x3b5d70,'id'));}});})['then'](function(){if(_0x112405[_0xbecd('0x9e')][_0xbecd('0x9f')]===_0xbecd('0x36')&&!_0xab410d&&!_0x112405['query'][_0xbecd('0x9c')])return[];return db[_0xbecd('0xa2')][_0xbecd('0x48')](_0x5f299d[_0xbecd('0xa3')](),_0x2d4b31);})['then'](function(_0x4526ac){_0xa1dbe2[_0xbecd('0x2e')]=_0x4526ac['length'];if(_0xa1dbe2['count']===0x0)return[];return db[_0xbecd('0xa2')]['query'](_0x46b9a7[_0xbecd('0xa3')](),_0x2d4b31)[_0xbecd('0x20')](function(_0x3aade4){_0x473fad=_[_0xbecd('0xa4')](_0x3aade4,'id');_0x2d4b31=_[_0xbecd('0x35')](_0x2d4b31,{'model':db[_0xbecd('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x112405[_0xbecd('0x48')][_0xbecd('0x4c')]){_0x2d578b[_0xbecd('0x4b')][_0xbecd('0x3e')](function(_0x4c16a7){_0x578808[_0xbecd('0x52')]('i.'+_0x4c16a7);});}else{_0x578808[_0xbecd('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x578808[_0xbecd('0x52')]('a.key','Account.key');_0x578808['field'](_0xbecd('0xa5'),_0xbecd('0xa6'));_0x578808[_0xbecd('0x52')](_0xbecd('0xa7'),_0xbecd('0x9a'));_0x578808['field'](_0xbecd('0xa8'));_0x578808[_0xbecd('0x52')](_0xbecd('0xa9'),_0xbecd('0xaa'));_0x578808[_0xbecd('0x52')](_0xbecd('0xab'),_0xbecd('0xac'));_0x578808[_0xbecd('0x52')](_0xbecd('0xad'),_0xbecd('0xae'));_0x578808[_0xbecd('0x52')](_0xbecd('0xaf'),_0xbecd('0xb0'));_0x578808['field']('c.mobile',_0xbecd('0xb1'));_0x578808['field'](_0xbecd('0xb2'),_0xbecd('0xb3'));_0x578808[_0xbecd('0x52')]('o.fullname',_0xbecd('0xb4'));_0x578808[_0xbecd('0x52')](_0xbecd('0xb5'),_0xbecd('0xb6'));_0x578808[_0xbecd('0x52')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbecd('0x3b'));}if(_0x2d578b[_0xbecd('0x2d')])_0x578808[_0xbecd('0x2d')](_0x2d578b[_0xbecd('0x2d')]);if(_0x2d578b[_0xbecd('0x2b')])_0x578808[_0xbecd('0x2b')](_0x2d578b[_0xbecd('0x2b')]);return db[_0xbecd('0xa2')][_0xbecd('0x48')](_0x578808[_0xbecd('0xa3')](),_0x2d4b31);})[_0xbecd('0x20')](function(_0x5eef6a){if(_0x5eef6a['length']>0x0)_0x4f6f4b[_0xbecd('0x80')](_0xbecd('0xb7'),_[_0xbecd('0x41')](_0x5eef6a,'id'));return db[_0xbecd('0xa2')][_0xbecd('0x48')](_0x4f6f4b[_0xbecd('0xa3')](),_0x2d4b31)[_0xbecd('0x20')](function(_0x1a63e1){var _0x4351ec=_[_0xbecd('0xb8')](_0x1a63e1,_0xbecd('0xb9'));var _0x4393fb=[];_0x5eef6a[_0xbecd('0x3e')](function(_0x437876){_0x4393fb[_0xbecd('0x3f')](updateChatInteraction(_0x437876,_0x473fad,_0x4351ec));});return BPromise[_0xbecd('0xba')](_0x4393fb);});});})['then'](function(_0x570905){_0xa1dbe2[_0xbecd('0xbb')]=_0x570905;return _0xa1dbe2;})[_0xbecd('0x20')](respondWithFilteredResult(_0x5ef998,_0x2d578b))['catch'](handleError(_0x5ef998,null));};exports[_0xbecd('0xbc')]=function(_0x4835ee,_0x48825b){var _0x136205={'raw':![],'where':{'id':_0x4835ee[_0xbecd('0xbd')]['id']}},_0x386c3e={};_0x386c3e[_0xbecd('0x46')]=_['keys'](db[_0xbecd('0x42')]['rawAttributes']);_0x386c3e[_0xbecd('0x48')]=_[_0xbecd('0x7c')](_0x4835ee['query']);_0x386c3e[_0xbecd('0x49')]=_[_0xbecd('0x4a')](_0x386c3e[_0xbecd('0x46')],_0x386c3e[_0xbecd('0x48')]);_0x136205[_0xbecd('0x4b')]=_[_0xbecd('0x4a')](_0x386c3e[_0xbecd('0x46')],qs[_0xbecd('0x4c')](_0x4835ee['query'][_0xbecd('0x4c')]));_0x136205[_0xbecd('0x4b')]=_0x136205['attributes']['length']?_0x136205[_0xbecd('0x4b')]:_0x386c3e[_0xbecd('0x46')];if(_0x4835ee[_0xbecd('0x48')][_0xbecd('0xbe')]){_0x136205['include']=[{'all':!![]}];}_0x136205=_[_0xbecd('0x35')]({},_0x136205,_0x4835ee[_0xbecd('0xbf')]);return db[_0xbecd('0x42')][_0xbecd('0x6a')](_0x136205)[_0xbecd('0x20')](handleEntityNotFound(_0x48825b,null))[_0xbecd('0x20')](respondWithResult(_0x48825b,null))[_0xbecd('0x40')](handleError(_0x48825b,null));};exports[_0xbecd('0xc0')]=function(_0x208fc9,_0x434c4b){return db['ChatInteraction'][_0xbecd('0xc0')](_0x208fc9[_0xbecd('0x7b')],{})['then'](respondWithResult(_0x434c4b,0xc9))['catch'](handleError(_0x434c4b,null));};exports[_0xbecd('0xc1')]=function(_0x298162,_0x314185){if(_0x298162[_0xbecd('0x7b')]['id']){delete _0x298162[_0xbecd('0x7b')]['id'];}return db['ChatInteraction'][_0xbecd('0x6a')]({'where':{'id':_0x298162[_0xbecd('0xbd')]['id']}})[_0xbecd('0x20')](handleEntityNotFound(_0x314185,null))[_0xbecd('0x20')](saveUpdates(_0x298162[_0xbecd('0x7b')],null))[_0xbecd('0x20')](respondWithResult(_0x314185,null))['catch'](handleError(_0x314185,null));};exports[_0xbecd('0x32')]=function(_0xad2c3b,_0x4cbf5a){return db[_0xbecd('0x42')][_0xbecd('0x6a')]({'where':{'id':_0xad2c3b[_0xbecd('0xbd')]['id']}})[_0xbecd('0x20')](handleEntityNotFound(_0x4cbf5a,null))[_0xbecd('0x20')](removeEntity(_0x4cbf5a,null))[_0xbecd('0x40')](handleError(_0x4cbf5a,null));};exports[_0xbecd('0xc2')]=function(_0x1b741e,_0x7748bb){return db[_0xbecd('0x42')]['describe']()[_0xbecd('0x20')](respondWithResult(_0x7748bb,null))[_0xbecd('0x40')](handleError(_0x7748bb,null));};exports[_0xbecd('0xc3')]=function(_0x2889f8,_0x4e8e1e){var _0x2ed784=_0x2889f8[_0xbecd('0xbd')]['id'];var _0x1b4916;var _0x261b0d;var _0x159494;return db[_0xbecd('0x42')]['findOne']({'where':{'id':_0x2ed784}})[_0xbecd('0x20')](function(_0x2bb6fc){_0x1b4916=_0x2bb6fc;return db[_0xbecd('0xc4')][_0xbecd('0xc5')]({'where':{'id':_0x2bb6fc['ChatWebsiteId']},'attributes':['id',_0xbecd('0xc6'),_0xbecd('0xc7'),_0xbecd('0xc8'),_0xbecd('0xc9'),'vidaooMetadata'],'raw':!![]});})[_0xbecd('0x20')](function(_0x4ffbeb){if(_0x4ffbeb&&_0x4ffbeb['vidaooApiKey']&&_0x4ffbeb[_0xbecd('0xc7')]){_0x261b0d=_0x4ffbeb;var _0x14e636={'interaction':{'id':_0x2ed784},'agent':{'id':_0x2889f8[_0xbecd('0x9e')]['id'],'name':_0x2889f8[_0xbecd('0x9e')][_0xbecd('0x47')],'fullname':_0x2889f8['user'][_0xbecd('0x3a')],'email':_0x2889f8[_0xbecd('0x9e')][_0xbecd('0xca')]},'contact':_0x2889f8[_0xbecd('0x7b')][_0xbecd('0xcb')],'account':_0x2889f8[_0xbecd('0x7b')][_0xbecd('0x38')]};var _0x3c8b84={'rejectUnauthorized':![],'method':_0xbecd('0xcc'),'url':_0xbecd('0xcd'),'headers':{'X-APIKEY':_0x4ffbeb[_0xbecd('0xc6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2889f8[_0xbecd('0x9e')][_0xbecd('0xca')]],'buttons':null,'topic':_0x261b0d[_0xbecd('0xc8')],'note':_['isNull'](_0x261b0d[_0xbecd('0xc9')])?null:getMustacheRender(_0x261b0d[_0xbecd('0xc9')],_0x14e636),'metadata':null},'redirect':_0xbecd('0xce'),'json':!![]};try{if(!_[_0xbecd('0xcf')](_0x261b0d[_0xbecd('0xd0')])){var _0x3f5b93=getMustacheRender(_0x261b0d[_0xbecd('0xd0')],_0x14e636);var _0x3c1fdc=JSON[_0xbecd('0x84')](_0x3f5b93);_0x3c8b84[_0xbecd('0x7b')]['metadata']=_0x3c1fdc;}}catch(_0x265285){throw new db[(_0xbecd('0x97'))][(_0xbecd('0xd1'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x3c8b84);}else{throw new db[(_0xbecd('0x97'))][(_0xbecd('0xd1'))](_0xbecd('0xd2'));}})[_0xbecd('0x20')](function(_0x185009){_0x159494=_0x185009;if(_0x159494['id']){var _0x2c601a={'body':_0x159494[_0xbecd('0xd3')],'ChatWebsiteId':_0x261b0d['id'],'ChatInteractionId':_0x1b4916['id'],'direction':_0xbecd('0xd4'),'UserId':_0x2889f8[_0xbecd('0x9e')]['id']};return db['ChatMessage'][_0xbecd('0xc0')](_0x2c601a,{});}else{throw new db[(_0xbecd('0x97'))][(_0xbecd('0xd1'))](_0xbecd('0xd5'));}})['then'](function(){return _0x1b4916[_0xbecd('0xd6')]({'vidaooSessionId':_0x159494['id']});})[_0xbecd('0x20')](respondWithResult(_0x4e8e1e,null))[_0xbecd('0x40')](handleError(_0x4e8e1e,null));};exports[_0xbecd('0xd7')]=function(_0xd10e40,_0x290d67){if(_0xd10e40['body']['id']){delete _0xd10e40[_0xbecd('0x7b')]['id'];}return db[_0xbecd('0x42')][_0xbecd('0x6a')]({'where':{'id':_0xd10e40[_0xbecd('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':_0xbecd('0x6d')}]})['then'](handleEntityNotFound(_0x290d67,null))['then'](saveUpdates(_0xd10e40[_0xbecd('0x7b')],null))[_0xbecd('0x20')](respondWithResult(_0x290d67,null))['catch'](handleError(_0x290d67,null));};exports['abandon']=function(_0x53944e,_0x1b5a30,_0x57ca31){if(_0x53944e[_0xbecd('0x7b')]['id']){delete _0x53944e[_0xbecd('0x7b')]['id'];}return db[_0xbecd('0x42')][_0xbecd('0x6a')]({'where':{'id':_0x53944e[_0xbecd('0xbd')]['id']}})[_0xbecd('0x20')](function(_0x50d244){if(!_0x50d244){logger['error'](_0xbecd('0xd8'),_0xbecd('0xd9'),0x194,_0xbecd('0xda'));_0x1b5a30[_0xbecd('0x29')](0x194);}else{if(_0x50d244[_0xbecd('0x7a')]){throw new db[(_0xbecd('0x97'))][(_0xbecd('0xd1'))](_0xbecd('0xdb'));}}return _0x50d244;})[_0xbecd('0x20')](function(_0x543481){if(_0x543481){return _0x543481[_0xbecd('0xc1')]({'closed':_0x53944e['body'][_0xbecd('0xdc')],'disposition':_0x53944e[_0xbecd('0x7b')]['disposition']})[_0xbecd('0x20')](function(_0x48b4e9){return _0x48b4e9;});}})[_0xbecd('0x20')](function(_0x125638){return respondWithRpcPromise(_0xbecd('0xdd'),_0xbecd('0xd9'),_0x53944e[_0xbecd('0x7b')],client9004);})[_0xbecd('0x20')](respondWithResult(_0x1b5a30,null))[_0xbecd('0x40')](handleError(_0x1b5a30,null));};exports[_0xbecd('0xde')]=function(_0x2194a1,_0x3ffabb,_0x28f1d7){_0x2194a1['body'][_0xbecd('0x47')]=_0x2194a1[_0xbecd('0xdf')][_0xbecd('0xe0')];_0x2194a1[_0xbecd('0x7b')]['basename']=_0x2194a1[_0xbecd('0xdf')]['filename'];_0x2194a1['body'][_0xbecd('0x45')]=_0x2194a1['file'][_0xbecd('0xe1')];return db[_0xbecd('0xe2')]['create'](_0x2194a1[_0xbecd('0x7b')])[_0xbecd('0x20')](respondWithResult(_0x3ffabb,0xc9))['catch'](handleError(_0x3ffabb,null));};exports[_0xbecd('0xe3')]=function(_0x27874b,_0x2b83da,_0xa632d4){return db[_0xbecd('0x42')][_0xbecd('0xc5')]({'where':{'id':_0x27874b[_0xbecd('0xbd')]['id']},'raw':!![]})[_0xbecd('0x20')](handleEntityNotFound(_0x2b83da,null))[_0xbecd('0x20')](function(_0x2eb44b){if(_0x2eb44b){if(_0x2eb44b[_0xbecd('0xdc')]){return _0x2b83da[_0xbecd('0x2f')](0x193)['json']({'status':0x193,'message':_0xbecd('0xe4')});}return db[_0xbecd('0xe2')][_0xbecd('0xc5')]({'where':{'id':_0x27874b[_0xbecd('0x48')][_0xbecd('0xe5')]},'raw':!![]})[_0xbecd('0x20')](handleEntityNotFound(_0x2b83da,null));}})[_0xbecd('0x20')](function(_0x391fa4){if(_0x391fa4){var _0x1432e9=_0x391fa4['ChatOfflineMessageId']!==null;var _0x349567=path[_0xbecd('0xe6')](config[_0xbecd('0xe7')],_0xbecd('0xe8'));if(_0x1432e9){_0x349567=path[_0xbecd('0xe6')](_0x349567,'offline-chat/');}var _0xf823b3=path['join'](_0x349567,_0x391fa4[_0xbecd('0xe9')]);return _0x2b83da[_0xbecd('0xea')](_0xf823b3);}})[_0xbecd('0x40')](handleError(_0x2b83da,null));};exports[_0xbecd('0xeb')]=function(_0x4793c9,_0x12d41a){var _0x26cfa4=null;var _0xa2b21d=null;var _0x1d3565=null;var _0x4a5bef=null;if(_0x4793c9[_0xbecd('0x7b')]['id']){delete _0x4793c9[_0xbecd('0x7b')]['id'];}if(_0x4793c9[_0xbecd('0x7b')][_0xbecd('0xec')]){_0x4a5bef=path[_0xbecd('0xe6')](config[_0xbecd('0xe7')],_0xbecd('0xed'),util[_0xbecd('0xee')](_0xbecd('0xef'),Date[_0xbecd('0xf0')]()));_0x4793c9[_0xbecd('0x7b')]['pathTranscript']=_0x4a5bef;}return db[_0xbecd('0x42')][_0xbecd('0x6a')]({'where':{'id':_0x4793c9['params']['id']},'include':[{'model':db[_0xbecd('0xf1')],'as':_0xbecd('0xf2'),'include':[{'model':db[_0xbecd('0x78')],'as':_0xbecd('0x78')}]}]})[_0xbecd('0x20')](handleEntityNotFound(_0x12d41a,null))[_0xbecd('0x20')](saveUpdates(_0x4793c9[_0xbecd('0x7b')],null))[_0xbecd('0x20')](function(_0x1147d3){if(_0x1147d3){_0x26cfa4=_0x1147d3;return db[_0xbecd('0xc4')][_0xbecd('0x6a')]({'where':{'id':_0x26cfa4[_0xbecd('0x9c')]}});}})['then'](function(_0x527c8c){if(_0x527c8c){_0x1d3565=_0x527c8c;return db['CmContact'][_0xbecd('0x6a')]({'where':{'id':_0x26cfa4[_0xbecd('0x72')]}});}})['then'](function(_0xcad16){if(_0xcad16){_0xa2b21d=_0xcad16;if(_0x4a5bef){var _0x1fd804=null;for(var _0x29ddbb=0x1;_0x29ddbb<_0x26cfa4[_0xbecd('0xf2')]['length'];++_0x29ddbb){_0x1fd804=_0x26cfa4['Messages'][_0x29ddbb];var _0x2dc2a0=_0x1fd804['UserId']?util['format']('%s%d',_0x1d3565[_0xbecd('0xf3')],_0x1fd804[_0xbecd('0x7a')]):_0xbecd('0xf4');var _0x2f12f5=_0x4793c9[_0xbecd('0x7b')][_0xbecd('0xf5')]||util[_0xbecd('0xee')]('%s%d',_0xbecd('0xf6'),_0x1fd804[_0xbecd('0x72')]);switch(_0x1d3565[_0xbecd('0xf7')]){case _0xbecd('0xf8'):_0x2dc2a0=_0x1fd804[_0xbecd('0x7a')]?util[_0xbecd('0xee')](_0xbecd('0xf9'),_0x1d3565[_0xbecd('0xf3')],_0x1fd804[_0xbecd('0x7a')]):_0xbecd('0xf4');break;case _0xbecd('0xfa'):_0x2dc2a0=_0x1fd804[_0xbecd('0x7a')]?_0x1fd804[_0xbecd('0x78')][_0xbecd('0xfb')]||_0x1fd804[_0xbecd('0x78')][_0xbecd('0x3a')]:_0xbecd('0xf4');break;case _0xbecd('0xfc'):_0x2dc2a0=_0x1fd804[_0xbecd('0x7a')]?_0x1fd804[_0xbecd('0x78')][_0xbecd('0x3a')]:_0xbecd('0xf4');break;default:_0x2dc2a0=_0x1fd804[_0xbecd('0x7a')]?util[_0xbecd('0xee')](_0xbecd('0xf9'),_0x1d3565['agentAlias'],_0x1fd804[_0xbecd('0x7a')]):_0xbecd('0xf4');}var _0x3c066c=util[_0xbecd('0xee')](_0xbecd('0xfd'),moment(_0x1fd804[_0xbecd('0x83')])[_0xbecd('0xee')](_0xbecd('0xfe')),_0x1fd804[_0xbecd('0xff')]==='in'?_0x2f12f5:_0x2dc2a0,_0x1fd804[_0xbecd('0x7b')]);if(!_0x1fd804[_0xbecd('0x100')]){fs['appendFileSync'](_0x4a5bef,_0x3c066c);}}return db[_0xbecd('0x101')][_0xbecd('0xc5')]({'where':{'service':!![]},'include':[{'model':db[_0xbecd('0x102')],'as':'Smtp','raw':!![]}]});}}})[_0xbecd('0x20')](function(_0x40aaee){if(_0x40aaee&&_0x40aaee[_0xbecd('0x103')]&&_0x4793c9[_0xbecd('0x7b')]){var _0x233d33={'tls':{'rejectUnauthorized':![]}};if(_0x40aaee[_0xbecd('0x103')][_0xbecd('0x104')]){_0x233d33[_0xbecd('0x104')]=_0x40aaee[_0xbecd('0x103')][_0xbecd('0x104')];}else{_0x233d33[_0xbecd('0x105')]=_0x40aaee[_0xbecd('0x103')]['host'];_0x233d33[_0xbecd('0x106')]=_0x40aaee[_0xbecd('0x103')][_0xbecd('0x106')];_0x233d33[_0xbecd('0x107')]=_0x40aaee['Smtp'][_0xbecd('0x107')];}if(_0x40aaee['Smtp']['authentication']){_0x233d33[_0xbecd('0x108')]={'user':_0x40aaee[_0xbecd('0x103')][_0xbecd('0x9e')],'pass':_0x40aaee['Smtp'][_0xbecd('0x109')]};}return respondWithRpcPromise(_0xbecd('0x10a'),_0xbecd('0x10b'),{'account':_0x233d33,'message':{'from':util[_0xbecd('0xee')](_0xbecd('0x10c'),_0x40aaee[_0xbecd('0x47')],_0x40aaee[_0xbecd('0xca')]||_0x40aaee[_0xbecd('0x103')][_0xbecd('0x9e')]),'to':_0x4793c9['body'][_0xbecd('0xec')],'subject':_0xbecd('0x10d'),'text':util[_0xbecd('0xee')](_0xbecd('0x10e'),_0x4793c9[_0xbecd('0x7b')][_0xbecd('0xec')]),'attachments':[{'path':_0x4a5bef}]}})[_0xbecd('0x20')](function(){return _0x26cfa4;})[_0xbecd('0x40')](function(_0x23cb54){console[_0xbecd('0x26')](_0x23cb54);});}else{return _0x26cfa4;}})[_0xbecd('0x20')](respondWithStatusCode(_0x12d41a,0xc8))[_0xbecd('0x40')](handleError(_0x12d41a,null));};exports['addMessage']=function(_0x4727e2,_0x3ae3d1,_0x44fa96){return db['ChatMessage'][_0xbecd('0x6a')]({'where':{'id':_0x4727e2[_0xbecd('0xbd')]['id']}})[_0xbecd('0x20')](handleEntityNotFound(_0x3ae3d1,null))[_0xbecd('0x20')](function(_0x47ff00){if(_0x47ff00){return _0x47ff00[_0xbecd('0x10f')](_0x4727e2[_0xbecd('0x7b')][_0xbecd('0x110')],_['omit'](_0x4727e2[_0xbecd('0x7b')],[_0xbecd('0x110'),'id'])||{});}})[_0xbecd('0x20')](respondWithResult(_0x3ae3d1,null))['catch'](handleError(_0x3ae3d1,null));};exports[_0xbecd('0x111')]=function(_0x2aaa92,_0x559883,_0x4221f4){var _0x1a38dd={'raw':![],'where':{}};var _0x4d2074={};var _0x390c1f={'count':0x0,'rows':[]};return db[_0xbecd('0x42')][_0xbecd('0xc5')]({'where':{'id':_0x2aaa92[_0xbecd('0xbd')]['id']}})[_0xbecd('0x20')](handleEntityNotFound(_0x559883,null))[_0xbecd('0x20')](function(_0x21e6ff){if(_0x21e6ff){_0x4d2074[_0xbecd('0x46')]=_[_0xbecd('0x7c')](db[_0xbecd('0xf1')]['rawAttributes']);_0x4d2074[_0xbecd('0x48')]=_[_0xbecd('0x7c')](_0x2aaa92[_0xbecd('0x48')]);_0x4d2074[_0xbecd('0x49')]=_[_0xbecd('0x4a')](_0x4d2074[_0xbecd('0x46')],_0x4d2074[_0xbecd('0x48')]);_0x1a38dd['attributes']=_['intersection'](_0x4d2074[_0xbecd('0x46')],qs[_0xbecd('0x4c')](_0x2aaa92['query'][_0xbecd('0x4c')]));_0x1a38dd[_0xbecd('0x4b')]=_0x1a38dd['attributes'][_0xbecd('0x68')]?_0x1a38dd[_0xbecd('0x4b')]:_0x4d2074[_0xbecd('0x46')];if(!_0x2aaa92[_0xbecd('0x48')]['hasOwnProperty']('nolimit')){_0x1a38dd[_0xbecd('0x2d')]=qs[_0xbecd('0x2d')](_0x2aaa92['query'][_0xbecd('0x2d')]);_0x1a38dd['offset']=qs[_0xbecd('0x2b')](_0x2aaa92[_0xbecd('0x48')][_0xbecd('0x2b')]);}_0x1a38dd[_0xbecd('0x4f')]=qs[_0xbecd('0x50')](_0x2aaa92[_0xbecd('0x48')][_0xbecd('0x50')]);_0x1a38dd[_0xbecd('0x80')]=qs[_0xbecd('0x49')](_[_0xbecd('0x112')](_0x2aaa92[_0xbecd('0x48')],_0x4d2074['filters']));_0x1a38dd[_0xbecd('0x80')]['ChatInteractionId']=_0x21e6ff['id'];if(_0x2aaa92[_0xbecd('0x48')][_0xbecd('0x90')]){_0x1a38dd[_0xbecd('0x80')]=_[_0xbecd('0x35')](_0x1a38dd[_0xbecd('0x80')],{'$or':_[_0xbecd('0x41')](_0x1a38dd['attributes'],function(_0x1cbe69){var _0x4adbf5={};_0x4adbf5[_0x1cbe69]={'$like':'%'+_0x2aaa92[_0xbecd('0x48')][_0xbecd('0x90')]+'%'};return _0x4adbf5;})});}if(_0x2aaa92['query'][_0xbecd('0x85')]){var _0x31f829=_0x2aaa92['query'][_0xbecd('0x85')][_0xbecd('0x3d')](',');var _0x21c581={};_0x21c581[_0x31f829[0x0]]={'$gte':moment(_0x31f829[0x1])[_0xbecd('0xee')](_0xbecd('0x113'))};_0x1a38dd[_0xbecd('0x80')]=_[_0xbecd('0x35')](_0x1a38dd[_0xbecd('0x80')],_0x21c581);}_0x1a38dd=_[_0xbecd('0x35')]({},_0x1a38dd,_0x2aaa92[_0xbecd('0xbf')]);return db[_0xbecd('0xf1')][_0xbecd('0x2e')]({'where':_0x1a38dd[_0xbecd('0x80')]})[_0xbecd('0x20')](function(_0x445594){_0x390c1f[_0xbecd('0x2e')]=_0x445594;if(_0x2aaa92[_0xbecd('0x48')][_0xbecd('0xbe')]){_0x1a38dd[_0xbecd('0x114')]=[{'all':!![]}];}return db[_0xbecd('0xf1')][_0xbecd('0x115')](_0x1a38dd);})[_0xbecd('0x20')](function(_0xd934df){_0x390c1f[_0xbecd('0xbb')]=_0xd934df;return _0x390c1f;});}})['then'](respondWithFilteredResult(_0x559883,_0x1a38dd))['catch'](handleError(_0x559883,null));};exports['getMyMessages']=function(_0x43563a,_0x426ace,_0x5d3e86){var _0x287ce0={'where':{}},_0x12c40a={},_0x365be1={'count':0x0,'rows':[]};return db[_0xbecd('0x42')][_0xbecd('0xc5')]({'where':{'id':_0x43563a[_0xbecd('0xbd')]['id']}})[_0xbecd('0x20')](handleEntityNotFound(_0x426ace,null))[_0xbecd('0x20')](function(_0x17e117){if(_0x17e117){_0x12c40a[_0xbecd('0x46')]=_[_0xbecd('0x7c')](db[_0xbecd('0xf1')][_0xbecd('0x43')]);_0x12c40a['query']=_[_0xbecd('0x7c')](_0x43563a['query']);_0x12c40a[_0xbecd('0x49')]=_[_0xbecd('0x4a')](_0x12c40a[_0xbecd('0x46')],_0x12c40a['query']);_0x287ce0[_0xbecd('0x4b')]=_[_0xbecd('0x4a')](_0x12c40a[_0xbecd('0x46')],qs[_0xbecd('0x4c')](_0x43563a[_0xbecd('0x48')]['fields']));_0x287ce0[_0xbecd('0x4b')]=_0x287ce0[_0xbecd('0x4b')]['length']?_0x287ce0[_0xbecd('0x4b')]:_0x12c40a[_0xbecd('0x46')];if(!_0x43563a[_0xbecd('0x48')]['hasOwnProperty']('nolimit')){_0x287ce0[_0xbecd('0x2d')]=qs[_0xbecd('0x2d')](_0x43563a[_0xbecd('0x48')][_0xbecd('0x2d')]);_0x287ce0[_0xbecd('0x2b')]=qs[_0xbecd('0x2b')](_0x43563a[_0xbecd('0x48')][_0xbecd('0x2b')]);}_0x287ce0['order']=qs['sort'](_0x43563a['query'][_0xbecd('0x50')]);_0x287ce0[_0xbecd('0x80')]=qs[_0xbecd('0x49')](_[_0xbecd('0x112')](_0x43563a[_0xbecd('0x48')],_0x12c40a[_0xbecd('0x49')]));_0x287ce0['where'][_0xbecd('0xb9')]=_0x17e117['id'];if(_0x43563a[_0xbecd('0x48')][_0xbecd('0x90')]){_0x287ce0[_0xbecd('0x80')]=_[_0xbecd('0x35')](_0x287ce0[_0xbecd('0x80')],{'$or':_[_0xbecd('0x41')](_0x287ce0[_0xbecd('0x4b')],function(_0x22c2ad){var _0x12ca6d={};_0x12ca6d[_0x22c2ad]={'$like':'%'+_0x43563a[_0xbecd('0x48')]['filter']+'%'};return _0x12ca6d;})});}_0x287ce0[_0xbecd('0x80')][_0xbecd('0x100')]=![];if(_0x43563a[_0xbecd('0x48')]['id']){_0x287ce0[_0xbecd('0x80')]['id']={'$gt':_0x43563a['query']['id']};}_0x287ce0=_[_0xbecd('0x35')]({},_0x287ce0,_0x43563a[_0xbecd('0xbf')]);return db[_0xbecd('0xf1')]['count']({'where':_0x287ce0[_0xbecd('0x80')]})[_0xbecd('0x20')](function(_0x1b7a6c){_0x365be1[_0xbecd('0x2e')]=_0x1b7a6c;_0x287ce0['include']=[];if(_0x43563a['query'][_0xbecd('0x116')]){_0x287ce0[_0xbecd('0x114')][_0xbecd('0x3f')]({'model':db[_0xbecd('0x78')],'as':_0xbecd('0x78'),'attributes':['id','fullname','alias']});}if(_0x43563a[_0xbecd('0x48')][_0xbecd('0xbe')]){_0x287ce0['include']=[{'all':!![]}];}return db[_0xbecd('0xf1')][_0xbecd('0x115')](_0x287ce0);})[_0xbecd('0x20')](function(_0x4c602f){_0x365be1[_0xbecd('0xbb')]=_0x4c602f;return _0x365be1;});}})[_0xbecd('0x20')](respondWithFilteredResult(_0x426ace,_0x287ce0))[_0xbecd('0x40')](handleError(_0x426ace,null));};exports['addTags']=function(_0x4e13a0,_0x217054,_0x36aef0){return db['ChatInteraction'][_0xbecd('0x6a')]({'where':{'id':_0x4e13a0['params']['id']}})[_0xbecd('0x20')](handleEntityNotFound(_0x217054,null))[_0xbecd('0x20')](function(_0x2d366c){if(_0x2d366c){return _0x2d366c[_0xbecd('0x117')](_0x4e13a0[_0xbecd('0x7b')]['ids'],_[_0xbecd('0x118')](_0x4e13a0[_0xbecd('0x7b')],[_0xbecd('0x110'),'id'])||{})[_0xbecd('0x119')](function(){return db[_0xbecd('0x11a')]['findAll']({'attributes':['id',_0xbecd('0x47'),_0xbecd('0x53')],'where':{'id':_0x4e13a0[_0xbecd('0x7b')][_0xbecd('0x110')]}});})[_0xbecd('0x20')](function(_0x19532e){socket[_0xbecd('0x11b')](_0xbecd('0x11c'),{'id':Number(_0x4e13a0[_0xbecd('0xbd')]['id']),'tags':_0x19532e||[]});return{'id':Number(_0x4e13a0[_0xbecd('0xbd')]['id']),'tags':_0x19532e||[]};});}})[_0xbecd('0x20')](respondWithResult(_0x217054,null))[_0xbecd('0x40')](handleError(_0x217054,null));};exports[_0xbecd('0x11d')]=function(_0x3a54f4,_0x3cb230,_0x49bea7){return db[_0xbecd('0x42')][_0xbecd('0x6a')]({'where':{'id':_0x3a54f4['params']['id']}})[_0xbecd('0x20')](handleEntityNotFound(_0x3cb230,null))['then'](function(_0x16242c){if(_0x16242c){return _0x16242c[_0xbecd('0x11d')](_0x3a54f4[_0xbecd('0x48')][_0xbecd('0x110')]);}})[_0xbecd('0x20')](respondWithStatusCode(_0x3cb230,null))['catch'](handleError(_0x3cb230,null));};exports[_0xbecd('0xea')]=function(_0xeb88e7,_0x4f48ef){var _0x3a4635=moment()['unix']()[_0xbecd('0xa3')]();var _0x2dfcad=path['join'](config[_0xbecd('0xe7')],_0xbecd('0x11e'),'files',_0xbecd('0x11f'));var _0x418753=path[_0xbecd('0xe6')](config[_0xbecd('0xe7')],_0xbecd('0x11e'),_0xbecd('0x120'),_0xbecd('0x121'));var _0x421cfc=path[_0xbecd('0xe6')](_0x2dfcad,_0x3a4635);var _0x11e000=util['format'](_0xbecd('0x122'),_0xeb88e7[_0xbecd('0xbd')]['id'],_0x3a4635);var _0x838e3d=path[_0xbecd('0xe6')](_0x2dfcad,_0x11e000);var _0x4e74da=[];_0x4e74da['push']({'model':db[_0xbecd('0x78')],'as':'User','attributes':['id',_0xbecd('0x3a')],'raw':!![]});_0x4e74da[_0xbecd('0x3f')]({'model':db[_0xbecd('0x123')],'as':'Contact','attributes':['id',_0xbecd('0x124'),_0xbecd('0x125')],'raw':!![]});if(_0xeb88e7['query'][_0xbecd('0x121')]){_0x4e74da[_0xbecd('0x3f')]({'model':db['Attachment'],'as':_0xbecd('0xe2'),'raw':!![]});}var _0xadd76f=[{'model':db['ChatMessage'],'as':_0xbecd('0xf2'),'attributes':['id',_0xbecd('0x7b'),_0xbecd('0x83'),_0xbecd('0xff'),'secret',_0xbecd('0x8b')],'include':_0x4e74da}];_0xadd76f['push']({'model':db['ChatWebsite'],'as':_0xbecd('0x126'),'attributes':['id','name']});_0xadd76f[_0xbecd('0x3f')]({'model':db['User'],'as':_0xbecd('0x127'),'attributes':['id','fullname']});return db[_0xbecd('0x42')][_0xbecd('0x6a')]({'where':{'id':_0xeb88e7['params']['id']},'include':_0xadd76f})[_0xbecd('0x20')](handleEntityNotFound(_0x4f48ef,null))['then'](function(_0x2a144d){if(_0x2a144d){var _0x1bc993=_0x2a144d[_0xbecd('0x128')]({'plain':!![]});fs[_0xbecd('0x129')](_0x421cfc);var _0x1e1707={'channel':'Chat','account':_0x1bc993[_0xbecd('0x126')][_0xbecd('0x47')],'agent':_0x1bc993['Owner']?_0x1bc993['Owner']['fullname']:_0xbecd('0x12a'),'createdAt':moment(_0x1bc993[_0xbecd('0x83')])[_0xbecd('0xee')](_0xbecd('0x113'))[_0xbecd('0xa3')](),'closedAt':_0x1bc993[_0xbecd('0xdc')]?moment(_0x1bc993[_0xbecd('0x12b')])[_0xbecd('0xee')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbecd('0xa3')]():'','disposition':_0x1bc993[_0xbecd('0x12c')],'chatInfo':{'browser':_0x1bc993[_0xbecd('0x12d')],'os':_0x1bc993[_0xbecd('0x12e')],'referer':_0x1bc993['referer'],'customerIp':_0x1bc993[_0xbecd('0x12f')],'customerPort':_0x1bc993[_0xbecd('0x130')]?_0x1bc993[_0xbecd('0x130')]:_0xbecd('0x12a')},'messages':_(_0x1bc993[_0xbecd('0xf2')])[_0xbecd('0x131')]()['filter']({'secret':![]})[_0xbecd('0x41')](function(_0x18d2b9){if(_0x18d2b9[_0xbecd('0xe2')]){var _0x439203=path['join'](_0x418753,_0x18d2b9[_0xbecd('0xe2')][_0xbecd('0xe9')]);if(fs[_0xbecd('0x132')](_0x439203)){fs['createReadStream'](_0x439203)['pipe'](fs[_0xbecd('0x133')](path[_0xbecd('0xe6')](_0x421cfc,_0x18d2b9['Attachment'][_0xbecd('0xe9')])));}}return{'date':moment(_0x18d2b9[_0xbecd('0x83')])[_0xbecd('0xee')](_0xbecd('0x113'))[_0xbecd('0xa3')](),'sender':_0x18d2b9[_0xbecd('0xff')]===_0xbecd('0xd4')?_0x18d2b9['User']?_0x18d2b9[_0xbecd('0x78')][_0xbecd('0x3a')]:_0xbecd('0xf4'):_0x18d2b9[_0xbecd('0x6d')][_0xbecd('0x124')]+(_0x18d2b9[_0xbecd('0x6d')]['lastName']?'\x20'+_0x18d2b9[_0xbecd('0x6d')][_0xbecd('0x125')]:''),'body':_0x18d2b9['Attachment']?_0x18d2b9[_0xbecd('0xe2')][_0xbecd('0xe9')]:_0x18d2b9['body'],'direction':_0x18d2b9[_0xbecd('0xff')]===_0xbecd('0xd4')?'A':'C','secret':_0x18d2b9[_0xbecd('0x100')],'read':_0x18d2b9['read'],'attachment':_0x18d2b9[_0xbecd('0xe2')]};})[_0xbecd('0x6f')]()};return ejs[_0xbecd('0x134')](path['join'](config[_0xbecd('0xe7')],_0xbecd('0x11e'),_0xbecd('0x135'),_0xbecd('0x136')),{'interaction':_0x1e1707})[_0xbecd('0x20')](function(_0x139016){var _0x2ac85b=path[_0xbecd('0xe6')](_0x421cfc,'transcript-'+_0x1bc993['id']+'-'+_0x3a4635+_0xbecd('0x137'));var _0x4d73b1={'path':_0x2ac85b,'channel':_0xbecd('0x138'),'interactionId':_0x1bc993['id']};return pdf[_0xbecd('0x139')](_0x139016,_0x4d73b1);})[_0xbecd('0x20')](function(){return new BPromise(function(_0x568b1a,_0x5d949d){zipdir(_0x421cfc,{'saveTo':_0x838e3d},function(_0x4531ea,_0x47e5c9){if(_0x4531ea)return _0x5d949d(_0x4531ea);return _0x568b1a(_0x47e5c9);});})[_0xbecd('0x20')](function(){return new BPromise(function(_0x3e9d77,_0x3568d5){rimraf(_0x421cfc,function(_0x17c845){if(_0x17c845)_0x3568d5(_0x17c845);return _0x3e9d77();});});})[_0xbecd('0x20')](function(){return _0x4f48ef[_0xbecd('0xea')](_0x838e3d,_0x11e000,function(_0x43de38){if(_0x43de38){console[_0xbecd('0x13a')]('err',_0x43de38);}else{fs['unlinkSync'](_0x838e3d);}});});});}else{return _0x4f48ef[_0xbecd('0x29')](0xc8);}})['catch'](handleError(_0x4f48ef,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e09d6e6..adb1bd2 100644 --- a/server/api/chatInteraction/chatInteraction.events.js +++ b/server/api/chatInteraction/chatInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0570=['Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','exports','../../mysqldb','ChatInteraction','setMaxListeners','update','getUsers'];(function(_0x52cafd,_0x46747c){var _0x597f07=function(_0x3eb067){while(--_0x3eb067){_0x52cafd['push'](_0x52cafd['shift']());}};_0x597f07(++_0x46747c);}(_0x0570,0x172));var _0x0057=function(_0x10b7ad,_0x506b66){_0x10b7ad=_0x10b7ad-0x0;var _0x97cecc=_0x0570[_0x10b7ad];return _0x97cecc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x0057('0x0'))['db'][_0x0057('0x1')];var ChatMessage=require(_0x0057('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0057('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0057('0x3'),'afterDestroy':'remove'};function emitEvent(_0x27f031){return function(_0x2161b9,_0x216a7a,_0x418a5a){_0x2161b9[_0x0057('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc86734){_0x2161b9['setDataValue'](_0x0057('0x5'),_0xc86734[_0x0057('0x6')](function(_0x25fb92){return{'id':_0x25fb92['id']};}));return ChatMessage[_0x0057('0x7')]({'where':{'ChatInteractionId':_0x2161b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0057('0x8')](function(_0x54f384){_0x2161b9[_0x0057('0x9')](_0x0057('0xa'),_0x54f384[_0x0057('0xb')]);ChatInteractionEvents['emit'](_0x27f031+':'+_0x2161b9['id'],_0x2161b9);ChatInteractionEvents[_0x0057('0xc')](_0x27f031,_0x2161b9);_0x418a5a(null);})[_0x0057('0xd')](_0x418a5a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x0057('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0x553f=['ChatInteraction','ChatMessage','update','getUsers','then','Users','map','setDataValue','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x4e6562,_0x43f75b){var _0x136221=function(_0x1fdf18){while(--_0x1fdf18){_0x4e6562['push'](_0x4e6562['shift']());}};_0x136221(++_0x43f75b);}(_0x553f,0x1c0));var _0xf553=function(_0x182365,_0x253c27){_0x182365=_0x182365-0x0;var _0x567813=_0x553f[_0x182365];return _0x567813;};'use strict';var EventEmitter=require(_0xf553('0x0'));var ChatInteraction=require(_0xf553('0x1'))['db'][_0xf553('0x2')];var ChatMessage=require(_0xf553('0x1'))['db'][_0xf553('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf553('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2864fd){return function(_0x3b3c90,_0x2959d1,_0x56afe9){_0x3b3c90[_0xf553('0x5')]({'attributes':['id'],'raw':!![]})[_0xf553('0x6')](function(_0x38573a){_0x3b3c90['setDataValue'](_0xf553('0x7'),_0x38573a[_0xf553('0x8')](function(_0x5d750a){return{'id':_0x5d750a['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3b3c90['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x389160){_0x3b3c90[_0xf553('0x9')]('unreadMessages',_0x389160[_0xf553('0xa')]);ChatInteractionEvents['emit'](_0x2864fd+':'+_0x3b3c90['id'],_0x3b3c90);ChatInteractionEvents[_0xf553('0xb')](_0x2864fd,_0x3b3c90);_0x56afe9(null);})[_0xf553('0xc')](_0x56afe9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xf553('0xd')](e,emitEvent(event));}}module[_0xf553('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index b64d314..a32e0c5 100644 --- a/server/api/chatInteraction/chatInteraction.model.js +++ b/server/api/chatInteraction/chatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3958=['api','moment','bluebird','request-promise','path','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3e8931,_0x204ba0){var _0x10fc99=function(_0x5504df){while(--_0x5504df){_0x3e8931['push'](_0x3e8931['shift']());}};_0x10fc99(++_0x204ba0);}(_0x3958,0x141));var _0x8395=function(_0x1e82c6,_0x2be4e4){_0x1e82c6=_0x1e82c6-0x0;var _0x5cd38e=_0x3958[_0x1e82c6];return _0x5cd38e;};'use strict';var _=require(_0x8395('0x0'));var util=require(_0x8395('0x1'));var logger=require(_0x8395('0x2'))(_0x8395('0x3'));var moment=require(_0x8395('0x4'));var BPromise=require(_0x8395('0x5'));var rp=require(_0x8395('0x6'));var fs=require('fs');var path=require(_0x8395('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8395('0x8'));module['exports']=function(_0x482651,_0x13f9b9){return _0x482651[_0x8395('0x9')](_0x8395('0xa'),attributes,{'tableName':_0x8395('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43e1d8,_0x50c6de,_0x27cf6a){if(_0x43e1d8['changed'](_0x8395('0xc'))){_0x43e1d8[_0x8395('0xd')]=moment()[_0x8395('0xe')](_0x8395('0xf'));}_0x27cf6a(null,_0x43e1d8);}},'charset':_0x8395('0x10'),'collate':_0x8395('0x11')});}; \ No newline at end of file +var _0xdff3=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x355d06,_0x3c9512){var _0x13b6d0=function(_0x1c845d){while(--_0x1c845d){_0x355d06['push'](_0x355d06['shift']());}};_0x13b6d0(++_0x3c9512);}(_0xdff3,0x1f0));var _0x3dff=function(_0x370ea3,_0x19bb47){_0x370ea3=_0x370ea3-0x0;var _0x21b2f6=_0xdff3[_0x370ea3];return _0x21b2f6;};'use strict';var _=require(_0x3dff('0x0'));var util=require(_0x3dff('0x1'));var logger=require(_0x3dff('0x2'))(_0x3dff('0x3'));var moment=require(_0x3dff('0x4'));var BPromise=require(_0x3dff('0x5'));var rp=require(_0x3dff('0x6'));var fs=require('fs');var path=require(_0x3dff('0x7'));var rimraf=require('rimraf');var config=require(_0x3dff('0x8'));var attributes=require('./chatInteraction.attributes');module[_0x3dff('0x9')]=function(_0xf7aff2,_0x209123){return _0xf7aff2[_0x3dff('0xa')](_0x3dff('0xb'),attributes,{'tableName':_0x3dff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e163e,_0x4efa8d,_0x3808df){if(_0x4e163e[_0x3dff('0xd')](_0x3dff('0xe'))){_0x4e163e['closedAt']=moment()[_0x3dff('0xf')](_0x3dff('0x10'));}_0x3808df(null,_0x4e163e);}},'charset':_0x3dff('0x11'),'collate':_0x3dff('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index fc29e92..166fcfd 100644 --- a/server/api/chatInteraction/chatInteraction.rpc.js +++ b/server/api/chatInteraction/chatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17a7=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','limit','find','omit','ids','spread','AddTags','stringify','lodash'];(function(_0x2bcf7c,_0x4ddbd9){var _0x553762=function(_0x3b3da4){while(--_0x3b3da4){_0x2bcf7c['push'](_0x2bcf7c['shift']());}};_0x553762(++_0x4ddbd9);}(_0x17a7,0x7d));var _0x717a=function(_0x505c01,_0x4cd33b){_0x505c01=_0x505c01-0x0;var _0x55e0dd=_0x17a7[_0x505c01];return _0x55e0dd;};'use strict';var _=require(_0x717a('0x0'));var util=require(_0x717a('0x1'));var moment=require(_0x717a('0x2'));var BPromise=require('bluebird');var rs=require(_0x717a('0x3'));var fs=require('fs');var Redis=require(_0x717a('0x4'));var db=require(_0x717a('0x5'))['db'];var utils=require(_0x717a('0x6'));var logger=require(_0x717a('0x7'))(_0x717a('0x8'));var config=require(_0x717a('0x9'));var jayson=require(_0x717a('0xa'));var client=jayson[_0x717a('0xb')][_0x717a('0xc')]({'port':0x232a});config['redis']=_[_0x717a('0xd')](config['redis'],{'host':_0x717a('0xe'),'port':0x18eb});var socket=require(_0x717a('0xf'))(new Redis(config[_0x717a('0x10')]));require('./chatInteraction.socket')[_0x717a('0x11')](socket);function respondWithRpcPromise(_0x11cd44,_0x548d8a,_0x16d10e){return new BPromise(function(_0x589a2d,_0x496dd7){return client['request'](_0x11cd44,_0x16d10e)[_0x717a('0x12')](function(_0x44d4f7){logger[_0x717a('0x13')](_0x717a('0x14'),_0x548d8a,'request\x20sent');logger[_0x717a('0x15')](_0x717a('0x16'),_0x548d8a,_0x717a('0x17'),JSON['stringify'](_0x44d4f7));if(_0x44d4f7[_0x717a('0x18')]){if(_0x44d4f7[_0x717a('0x18')][_0x717a('0x19')]===0x1f4){logger[_0x717a('0x18')](_0x717a('0x14'),_0x548d8a,_0x44d4f7[_0x717a('0x18')]['message']);return _0x496dd7(_0x44d4f7['error'][_0x717a('0x1a')]);}logger[_0x717a('0x18')](_0x717a('0x14'),_0x548d8a,_0x44d4f7['error'][_0x717a('0x1a')]);return _0x589a2d(_0x44d4f7[_0x717a('0x18')][_0x717a('0x1a')]);}else{logger[_0x717a('0x13')](_0x717a('0x14'),_0x548d8a,_0x717a('0x17'));_0x589a2d(_0x44d4f7[_0x717a('0x1b')]['message']);}})[_0x717a('0x1c')](function(_0xaca9b4){logger[_0x717a('0x18')](_0x717a('0x14'),_0x548d8a,_0xaca9b4);_0x496dd7(_0xaca9b4);});});}exports[_0x717a('0x1d')]=function(_0x39af1d){var _0x4bf3c2=this;return new Promise(function(_0x364a98,_0xd77f02){return db[_0x717a('0x1e')]['update'](_0x39af1d[_0x717a('0x1f')],{'raw':_0x39af1d[_0x717a('0x20')]?_0x39af1d[_0x717a('0x20')][_0x717a('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39af1d['options']?_0x39af1d[_0x717a('0x20')][_0x717a('0x22')]||null:null,'attributes':_0x39af1d[_0x717a('0x20')]?_0x39af1d[_0x717a('0x20')]['attributes']||null:null,'limit':_0x39af1d[_0x717a('0x20')]?_0x39af1d[_0x717a('0x20')][_0x717a('0x23')]||null:null})['then'](function(_0x89209a){logger[_0x717a('0x13')](_0x717a('0x1d'),_0x39af1d);logger[_0x717a('0x15')](_0x717a('0x1d'),_0x39af1d,JSON['stringify'](_0x89209a));_0x364a98(_0x89209a);})['catch'](function(_0x3ac33e){logger['error']('UpdateChatInteraction',_0x3ac33e['message'],_0x39af1d);_0xd77f02(_0x4bf3c2['error'](0x1f4,_0x3ac33e[_0x717a('0x1a')]));});});};exports['AddTagsToChatInteraction']=function(_0x3ac0cb){return new Promise(function(_0x328cb3,_0x4900cf){return db[_0x717a('0x1e')][_0x717a('0x24')]({'where':_0x3ac0cb['options']?_0x3ac0cb[_0x717a('0x20')][_0x717a('0x22')]||null:null})[_0x717a('0x12')](function(_0x56803a){if(_0x56803a){return _0x56803a['addTags'](_0x3ac0cb[_0x717a('0x1f')]['ids'],_[_0x717a('0x25')](_0x3ac0cb['body'],[_0x717a('0x26'),'id'])||{});}})[_0x717a('0x27')](function(_0x1a7738){logger[_0x717a('0x13')]('AddTags',_0x3ac0cb);logger[_0x717a('0x15')](_0x717a('0x28'),_0x3ac0cb,JSON[_0x717a('0x29')](_0x1a7738));_0x328cb3(_0x1a7738);})['catch'](function(_0x25be3b){logger[_0x717a('0x18')](_0x717a('0x28'),_0x25be3b[_0x717a('0x1a')],_0x3ac0cb);_0x4900cf(_this['error'](0x1f4,_0x25be3b[_0x717a('0x1a')]));});});}; \ No newline at end of file +var _0x6cd4=['raw','attributes','limit','then','stringify','find','where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options'];(function(_0x2031b2,_0x137ff4){var _0x17d816=function(_0x4eec0e){while(--_0x4eec0e){_0x2031b2['push'](_0x2031b2['shift']());}};_0x17d816(++_0x137ff4);}(_0x6cd4,0x16a));var _0x46cd=function(_0x1af11f,_0x1ea9da){_0x1af11f=_0x1af11f-0x0;var _0x1a1b50=_0x6cd4[_0x1af11f];return _0x1a1b50;};'use strict';var _=require(_0x46cd('0x0'));var util=require(_0x46cd('0x1'));var moment=require(_0x46cd('0x2'));var BPromise=require(_0x46cd('0x3'));var rs=require(_0x46cd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x46cd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x46cd('0x7')]['http']({'port':0x232a});config[_0x46cd('0x8')]=_[_0x46cd('0x9')](config[_0x46cd('0x8')],{'host':_0x46cd('0xa'),'port':0x18eb});var socket=require(_0x46cd('0xb'))(new Redis(config[_0x46cd('0x8')]));require('./chatInteraction.socket')[_0x46cd('0xc')](socket);function respondWithRpcPromise(_0x464d86,_0x14c785,_0x803e95){return new BPromise(function(_0x117fa2,_0xe46e76){return client[_0x46cd('0xd')](_0x464d86,_0x803e95)['then'](function(_0x3ffe3c){logger[_0x46cd('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x14c785,_0x46cd('0xf'));logger[_0x46cd('0x10')](_0x46cd('0x11'),_0x14c785,_0x46cd('0xf'),JSON['stringify'](_0x3ffe3c));if(_0x3ffe3c[_0x46cd('0x12')]){if(_0x3ffe3c[_0x46cd('0x12')]['code']===0x1f4){logger[_0x46cd('0x12')](_0x46cd('0x13'),_0x14c785,_0x3ffe3c[_0x46cd('0x12')][_0x46cd('0x14')]);return _0xe46e76(_0x3ffe3c[_0x46cd('0x12')]['message']);}logger[_0x46cd('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x14c785,_0x3ffe3c[_0x46cd('0x12')][_0x46cd('0x14')]);return _0x117fa2(_0x3ffe3c[_0x46cd('0x12')][_0x46cd('0x14')]);}else{logger[_0x46cd('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x14c785,_0x46cd('0xf'));_0x117fa2(_0x3ffe3c[_0x46cd('0x15')]['message']);}})[_0x46cd('0x16')](function(_0x2cdcb1){logger[_0x46cd('0x12')](_0x46cd('0x13'),_0x14c785,_0x2cdcb1);_0xe46e76(_0x2cdcb1);});});}exports[_0x46cd('0x17')]=function(_0x13f30b){var _0x3c0a02=this;return new Promise(function(_0x414e6f,_0x451619){return db[_0x46cd('0x18')][_0x46cd('0x19')](_0x13f30b[_0x46cd('0x1a')],{'raw':_0x13f30b[_0x46cd('0x1b')]?_0x13f30b['options'][_0x46cd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f30b[_0x46cd('0x1b')]?_0x13f30b[_0x46cd('0x1b')]['where']||null:null,'attributes':_0x13f30b[_0x46cd('0x1b')]?_0x13f30b[_0x46cd('0x1b')][_0x46cd('0x1d')]||null:null,'limit':_0x13f30b[_0x46cd('0x1b')]?_0x13f30b['options'][_0x46cd('0x1e')]||null:null})[_0x46cd('0x1f')](function(_0x9c30c1){logger[_0x46cd('0xe')]('UpdateChatInteraction',_0x13f30b);logger['debug'](_0x46cd('0x17'),_0x13f30b,JSON[_0x46cd('0x20')](_0x9c30c1));_0x414e6f(_0x9c30c1);})['catch'](function(_0x4a7b3e){logger['error'](_0x46cd('0x17'),_0x4a7b3e[_0x46cd('0x14')],_0x13f30b);_0x451619(_0x3c0a02[_0x46cd('0x12')](0x1f4,_0x4a7b3e[_0x46cd('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x159a57){return new Promise(function(_0x4cfefc,_0x450fe7){return db[_0x46cd('0x18')][_0x46cd('0x21')]({'where':_0x159a57[_0x46cd('0x1b')]?_0x159a57[_0x46cd('0x1b')][_0x46cd('0x22')]||null:null})[_0x46cd('0x1f')](function(_0x50823a){if(_0x50823a){return _0x50823a['addTags'](_0x159a57[_0x46cd('0x1a')][_0x46cd('0x23')],_[_0x46cd('0x24')](_0x159a57[_0x46cd('0x1a')],[_0x46cd('0x23'),'id'])||{});}})[_0x46cd('0x25')](function(_0x3f464b){logger[_0x46cd('0xe')](_0x46cd('0x26'),_0x159a57);logger['debug'](_0x46cd('0x26'),_0x159a57,JSON[_0x46cd('0x20')](_0x3f464b));_0x4cfefc(_0x3f464b);})[_0x46cd('0x16')](function(_0x1d434c){logger[_0x46cd('0x12')](_0x46cd('0x26'),_0x1d434c['message'],_0x159a57);_0x450fe7(_this[_0x46cd('0x12')](0x1f4,_0x1d434c[_0x46cd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ef38616..6f74846 100644 --- a/server/api/chatInteraction/chatInteraction.socket.js +++ b/server/api/chatInteraction/chatInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2455=['register','./chatInteraction.events','save','remove','update','removeListener'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2455,0xd3));var _0x5245=function(_0x50f92b,_0x32fab3){_0x50f92b=_0x50f92b-0x0;var _0x5cedbc=_0x2455[_0x50f92b];return _0x5cedbc;};'use strict';var ChatInteractionEvents=require(_0x5245('0x0'));var events=[_0x5245('0x1'),_0x5245('0x2'),_0x5245('0x3')];function createListener(_0x1f4446,_0x557700){return function(_0x5d7f64){_0x557700['emit'](_0x1f4446,_0x5d7f64);};}function removeListener(_0x3f1460,_0x1a162c){return function(){ChatInteractionEvents[_0x5245('0x4')](_0x3f1460,_0x1a162c);};}exports[_0x5245('0x5')]=function(_0x2f07d5){for(var _0x663a3=0x0,_0x5e2cde=events['length'];_0x663a3<_0x5e2cde;_0x663a3++){var _0x440eed=events[_0x663a3];var _0x313ef9=createListener('chatInteraction:'+_0x440eed,_0x2f07d5);ChatInteractionEvents['on'](_0x440eed,_0x313ef9);}}; \ No newline at end of file +var _0xb5fb=['./chatInteraction.events','remove','update','emit','removeListener','length','chatInteraction:'];(function(_0x1c473b,_0x2610c7){var _0x535bd7=function(_0x4bdfdb){while(--_0x4bdfdb){_0x1c473b['push'](_0x1c473b['shift']());}};_0x535bd7(++_0x2610c7);}(_0xb5fb,0xf5));var _0xbb5f=function(_0x48721b,_0x2063b7){_0x48721b=_0x48721b-0x0;var _0x5e2426=_0xb5fb[_0x48721b];return _0x5e2426;};'use strict';var ChatInteractionEvents=require(_0xbb5f('0x0'));var events=['save',_0xbb5f('0x1'),_0xbb5f('0x2')];function createListener(_0x1a6eb7,_0x456228){return function(_0x3493b9){_0x456228[_0xbb5f('0x3')](_0x1a6eb7,_0x3493b9);};}function removeListener(_0x2d683b,_0x22e1f0){return function(){ChatInteractionEvents[_0xbb5f('0x4')](_0x2d683b,_0x22e1f0);};}exports['register']=function(_0x2d7244){for(var _0x39276d=0x0,_0x142fe9=events[_0xbb5f('0x5')];_0x39276d<_0x142fe9;_0x39276d++){var _0x222802=events[_0x39276d];var _0x1c2a21=createListener(_0xbb5f('0x6')+_0x222802,_0x2d7244);ChatInteractionEvents['on'](_0x222802,_0x1c2a21);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a81b1f4..90a8c12 100644 --- a/server/api/chatInteraction/index.js +++ b/server/api/chatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f63=['join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','/:id','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','post','/:id/vidaoo','createVidaooSession','diskStorage'];(function(_0x3b29d5,_0x12faa2){var _0x20b96d=function(_0x284207){while(--_0x284207){_0x3b29d5['push'](_0x3b29d5['shift']());}};_0x20b96d(++_0x12faa2);}(_0x4f63,0xc2));var _0x34f6=function(_0x8ed2fe,_0x19ca78){_0x8ed2fe=_0x8ed2fe-0x0;var _0x23a751=_0x4f63[_0x8ed2fe];return _0x23a751;};'use strict';var multer=require(_0x34f6('0x0'));var util=require(_0x34f6('0x1'));var path=require(_0x34f6('0x2'));var timeout=require(_0x34f6('0x3'));var express=require(_0x34f6('0x4'));var router=express[_0x34f6('0x5')]();var fs_extra=require(_0x34f6('0x6'));var auth=require(_0x34f6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x34f6('0x8'));var controller=require('./chatInteraction.controller');router[_0x34f6('0x9')]('/',auth[_0x34f6('0xa')](),controller[_0x34f6('0xb')]);router['get'](_0x34f6('0xc'),auth[_0x34f6('0xa')](),controller[_0x34f6('0xd')]);router[_0x34f6('0x9')]('/:id',auth[_0x34f6('0xe')](),controller['show']);router[_0x34f6('0x9')]('/:id/attachment_download',auth[_0x34f6('0xe')](),controller[_0x34f6('0xf')]);router[_0x34f6('0x9')](_0x34f6('0x10'),auth[_0x34f6('0xa')](),controller[_0x34f6('0x11')]);router[_0x34f6('0x9')](_0x34f6('0x12'),auth[_0x34f6('0xe')](),controller[_0x34f6('0x13')]);router['get'](_0x34f6('0x14'),auth[_0x34f6('0xa')](),controller['download']);router['post']('/',auth[_0x34f6('0xa')](),controller[_0x34f6('0x15')]);router[_0x34f6('0x16')](_0x34f6('0x17'),auth[_0x34f6('0xa')](),controller[_0x34f6('0x18')]);var upload=multer({'storage':multer[_0x34f6('0x19')]({'destination':function(_0x4b223d,_0xfe1997,_0x3843f3){_0x3843f3(null,path[_0x34f6('0x1a')](config[_0x34f6('0x1b')],_0x34f6('0x1c')));},'filename':function(_0x335857,_0x27defb,_0x444714){_0x444714(null,util['format'](_0x34f6('0x1d'),Date[_0x34f6('0x1e')](),_0x27defb[_0x34f6('0x1f')][_0x34f6('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x34f6('0x16')](_0x34f6('0x21'),upload[_0x34f6('0x22')](_0x34f6('0x23')),controller[_0x34f6('0x24')]);router[_0x34f6('0x16')](_0x34f6('0x10'),auth[_0x34f6('0xe')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x34f6('0xa')](),interaction[_0x34f6('0x25')]('chat',_0x34f6('0x26')),controller[_0x34f6('0x27')]);router[_0x34f6('0x28')](_0x34f6('0x29'),auth[_0x34f6('0xa')](),interaction['tracked'](_0x34f6('0x2a'),_0x34f6('0x2b')),controller[_0x34f6('0x2c')]);router[_0x34f6('0x28')](_0x34f6('0x2d'),controller[_0x34f6('0x2e')]);router[_0x34f6('0x28')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x34f6('0x2f')]);router[_0x34f6('0x28')]('/:id/close',controller[_0x34f6('0x30')]);router[_0x34f6('0x31')](_0x34f6('0x29'),auth[_0x34f6('0xa')](),interaction[_0x34f6('0x25')](_0x34f6('0x2a'),_0x34f6('0x32')),controller[_0x34f6('0x33')]);router[_0x34f6('0x31')](_0x34f6('0x34'),auth[_0x34f6('0xa')](),controller[_0x34f6('0x35')]);module[_0x34f6('0x36')]=router; \ No newline at end of file +var _0x39e0=['originalname','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','put','/:id','update','/:id/custom_update','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now'];(function(_0x4c0dfa,_0x201044){var _0x50dcf4=function(_0x1b1899){while(--_0x1b1899){_0x4c0dfa['push'](_0x4c0dfa['shift']());}};_0x50dcf4(++_0x201044);}(_0x39e0,0x1a4));var _0x039e=function(_0x427d66,_0x385bab){_0x427d66=_0x427d66-0x0;var _0x105fcb=_0x39e0[_0x427d66];return _0x105fcb;};'use strict';var multer=require(_0x039e('0x0'));var util=require(_0x039e('0x1'));var path=require(_0x039e('0x2'));var timeout=require(_0x039e('0x3'));var express=require('express');var router=express[_0x039e('0x4')]();var fs_extra=require(_0x039e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x039e('0x6'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x039e('0x7')]('/',auth[_0x039e('0x8')](),controller[_0x039e('0x9')]);router[_0x039e('0x7')]('/describe',auth[_0x039e('0x8')](),controller[_0x039e('0xa')]);router['get']('/:id',auth[_0x039e('0xb')](),controller[_0x039e('0xc')]);router[_0x039e('0x7')](_0x039e('0xd'),auth[_0x039e('0xb')](),controller['attachmentDownload']);router[_0x039e('0x7')](_0x039e('0xe'),auth[_0x039e('0x8')](),controller[_0x039e('0xf')]);router[_0x039e('0x7')](_0x039e('0x10'),auth[_0x039e('0xb')](),controller[_0x039e('0x11')]);router[_0x039e('0x7')](_0x039e('0x12'),auth[_0x039e('0x8')](),controller[_0x039e('0x13')]);router[_0x039e('0x14')]('/',auth[_0x039e('0x8')](),controller[_0x039e('0x15')]);router[_0x039e('0x14')](_0x039e('0x16'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x039e('0x17')]({'destination':function(_0x1046ce,_0x268a69,_0x4257d8){_0x4257d8(null,path[_0x039e('0x18')](config[_0x039e('0x19')],_0x039e('0x1a')));},'filename':function(_0x25ecec,_0x16deef,_0x345f08){_0x345f08(null,util[_0x039e('0x1b')](_0x039e('0x1c'),Date[_0x039e('0x1d')](),_0x16deef[_0x039e('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x039e('0x1f')](_0x039e('0x20')),controller[_0x039e('0x21')]);router['post'](_0x039e('0xe'),auth[_0x039e('0xb')](),controller[_0x039e('0x22')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x039e('0x23')](_0x039e('0x24'),_0x039e('0x25')),controller['addTags']);router[_0x039e('0x26')](_0x039e('0x27'),auth['isAuthenticated'](),interaction[_0x039e('0x23')]('chat','chatinteraction:update'),controller[_0x039e('0x28')]);router[_0x039e('0x26')](_0x039e('0x29'),controller['customUpdate']);router[_0x039e('0x26')](_0x039e('0x2a'),auth[_0x039e('0xb')](),controller[_0x039e('0x2b')]);router['put']('/:id/close',controller[_0x039e('0x2c')]);router[_0x039e('0x2d')](_0x039e('0x27'),auth[_0x039e('0x8')](),interaction[_0x039e('0x23')](_0x039e('0x24'),_0x039e('0x2e')),controller[_0x039e('0x2f')]);router['delete']('/:id/tags',auth[_0x039e('0x8')](),controller[_0x039e('0x30')]);module[_0x039e('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7d08c16..c9d3a27 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x9a7375,_0x233724){var _0x24c588=function(_0x51e3f3){while(--_0x51e3f3){_0x9a7375['push'](_0x9a7375['shift']());}};_0x24c588(++_0x233724);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5bdab3,_0x3fa942){_0x5bdab3=_0x5bdab3-0x0;var _0x888f97=_0x5f2f[_0x5bdab3];return _0x888f97;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x14a0=['BOOLEAN','INTEGER','exports','TEXT','medium'];(function(_0x2e9e65,_0x5936fb){var _0x452c5a=function(_0x3647bd){while(--_0x3647bd){_0x2e9e65['push'](_0x2e9e65['shift']());}};_0x452c5a(++_0x5936fb);}(_0x14a0,0x8e));var _0x014a=function(_0x1e8ccb,_0x5cd3fa){_0x1e8ccb=_0x1e8ccb-0x0;var _0x53502c=_0x14a0[_0x1e8ccb];return _0x53502c;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'body':{'type':Sequelize[_0x014a('0x1')](_0x014a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x014a('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8f12adb..1fcbfd6 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.controller.js +++ b/server/api/chatInternalMessage/chatInternalMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','user','role','userpic','internal','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','render','merge','body','contact','message','agent','index','ChatInternalMessage','rawAttributes','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','intersection','find','params','describe'];(function(_0x4a392e,_0x44d3f2){var _0x4dd3b1=function(_0x2480d0){while(--_0x2480d0){_0x4a392e['push'](_0x4a392e['shift']());}};_0x4dd3b1(++_0x44d3f2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];config[_0x7995('0x1b')]=_[_0x7995('0x1c')](config[_0x7995('0x1b')],{'host':_0x7995('0x1d'),'port':0x18eb});var socket=require(_0x7995('0x1e'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x7995('0x1f')](socket);function respondWithStatusCode(_0x2233dd,_0x24b5bb){_0x24b5bb=_0x24b5bb||0xcc;return function(_0x321ae8){if(_0x321ae8){return _0x2233dd[_0x7995('0x20')](_0x24b5bb);}return _0x2233dd[_0x7995('0x21')](_0x24b5bb)[_0x7995('0x22')]();};}function respondWithResult(_0x41cbf0,_0x5377e5){_0x5377e5=_0x5377e5||0xc8;return function(_0x2eeacc){if(_0x2eeacc){return _0x41cbf0['status'](_0x5377e5)[_0x7995('0x23')](_0x2eeacc);}};}function respondWithFilteredResult(_0x37f297,_0x43d4b8){return function(_0x291317){if(_0x291317){var _0x1e1415=typeof _0x43d4b8[_0x7995('0x24')]==='undefined'&&typeof _0x43d4b8['limit']===_0x7995('0x25');var _0x5e6f90=_0x291317['count'];var _0x3ec178=_0x1e1415?0x0:_0x43d4b8[_0x7995('0x24')];var _0x4cbe10=_0x1e1415?_0x291317[_0x7995('0x26')]:_0x43d4b8['offset']+_0x43d4b8['limit'];var _0x3e4c54;if(_0x4cbe10>=_0x5e6f90){_0x4cbe10=_0x5e6f90;_0x3e4c54=0xc8;}else{_0x3e4c54=0xce;}_0x37f297[_0x7995('0x21')](_0x3e4c54);return _0x37f297[_0x7995('0x27')](_0x7995('0x28'),_0x3ec178+'-'+_0x4cbe10+'/'+_0x5e6f90)[_0x7995('0x23')](_0x291317);}return null;};}function patchUpdates(_0x1c278a){return function(_0x5d40ae){try{jsonpatch[_0x7995('0x29')](_0x5d40ae,_0x1c278a,!![]);}catch(_0x46ee4b){return BPromise[_0x7995('0x2a')](_0x46ee4b);}return _0x5d40ae[_0x7995('0x2b')]();};}function saveUpdates(_0x563799,_0x13bc35){return function(_0x475351){if(_0x475351){return _0x475351[_0x7995('0x2c')](_0x563799)['then'](function(_0x39df42){return _0x39df42;});}return null;};}function removeEntity(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(_0x268ce7){return _0x268ce7[_0x7995('0x2d')]()[_0x7995('0x2e')](function(){_0x34e70c['status'](0xcc)[_0x7995('0x22')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x20')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2f')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x30')]){delete _0x4b6f99[_0x7995('0x30')];}_0x132a42[_0x7995('0x21')](_0x11c1eb)['send'](_0x4b6f99);};}function getMustacheRender(_0x530611,_0x48e573){return Mustache[_0x7995('0x31')](_0x530611,_[_0x7995('0x32')](_0x48e573[_0x7995('0x33')],{'contact':_0x48e573[_0x7995('0x34')],'message':_0x48e573[_0x7995('0x35')],'agent':_0x48e573[_0x7995('0x36')],'interaction':_0x48e573['interaction'],'account':_0x48e573['account']}))||'';}exports[_0x7995('0x37')]=function(_0x5524af,_0x553671){var _0x3eb566={},_0x29fac5={},_0x1e9fa4={'count':0x0,'rows':[]};var _0x1f7d27=_['map'](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x5dd802){return{'name':_0x5dd802['fieldName'],'type':_0x5dd802['type'][_0x7995('0x3a')]};});_0x29fac5[_0x7995('0x3b')]=_['map'](_0x1f7d27,_0x7995('0x30'));_0x29fac5['query']=_[_0x7995('0x3c')](_0x5524af[_0x7995('0x3d')]);_0x29fac5[_0x7995('0x3e')]=_['intersection'](_0x29fac5['model'],_0x29fac5[_0x7995('0x3d')]);_0x3eb566['attributes']=_['intersection'](_0x29fac5[_0x7995('0x3b')],qs[_0x7995('0x3f')](_0x5524af['query'][_0x7995('0x3f')]));_0x3eb566[_0x7995('0x40')]=_0x3eb566[_0x7995('0x40')][_0x7995('0x41')]?_0x3eb566[_0x7995('0x40')]:_0x29fac5['model'];if(!_0x5524af[_0x7995('0x3d')][_0x7995('0x42')](_0x7995('0x43'))){_0x3eb566[_0x7995('0x44')]=qs['limit'](_0x5524af[_0x7995('0x3d')][_0x7995('0x44')]);_0x3eb566[_0x7995('0x24')]=qs[_0x7995('0x24')](_0x5524af[_0x7995('0x3d')][_0x7995('0x24')]);}_0x3eb566['order']=qs[_0x7995('0x45')](_0x5524af[_0x7995('0x3d')][_0x7995('0x45')]);_0x3eb566[_0x7995('0x46')]=qs[_0x7995('0x3e')](_[_0x7995('0x47')](_0x5524af[_0x7995('0x3d')],_0x29fac5[_0x7995('0x3e')]),_0x1f7d27);if(_0x5524af[_0x7995('0x3d')][_0x7995('0x48')]){_0x3eb566[_0x7995('0x46')]=_[_0x7995('0x32')](_0x3eb566[_0x7995('0x46')],{'$or':_['map'](_0x1f7d27,function(_0x50a98e){if(_0x50a98e[_0x7995('0x49')]!==_0x7995('0x4a')){var _0x58523e={};_0x58523e[_0x50a98e['name']]={'$like':'%'+_0x5524af[_0x7995('0x3d')]['filter']+'%'};return _0x58523e;}})});}_0x3eb566=_['merge']({},_0x3eb566,_0x5524af[_0x7995('0x4b')]);var _0x36e28b={'where':_0x3eb566[_0x7995('0x46')]};return db['ChatInternalMessage'][_0x7995('0x26')](_0x36e28b)['then'](function(_0x3993b5){_0x1e9fa4['count']=_0x3993b5;if(_0x5524af['query'][_0x7995('0x4c')]){_0x3eb566[_0x7995('0x4d')]=[{'all':!![]}];}return db[_0x7995('0x38')][_0x7995('0x4e')](_0x3eb566);})['then'](function(_0x3c5cde){_0x1e9fa4[_0x7995('0x4f')]=_0x3c5cde;return _0x1e9fa4;})[_0x7995('0x2e')](respondWithFilteredResult(_0x553671,_0x3eb566))[_0x7995('0x50')](handleError(_0x553671,null));};exports['show']=function(_0x5f28e7,_0x1c37c6){var _0x55791b={'raw':!![],'where':{'id':_0x5f28e7['params']['id']}},_0x23c41d={};_0x23c41d[_0x7995('0x3b')]=_['keys'](db[_0x7995('0x38')][_0x7995('0x39')]);_0x23c41d['query']=_[_0x7995('0x3c')](_0x5f28e7[_0x7995('0x3d')]);_0x23c41d[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x23c41d['model'],_0x23c41d[_0x7995('0x3d')]);_0x55791b[_0x7995('0x40')]=_[_0x7995('0x51')](_0x23c41d['model'],qs[_0x7995('0x3f')](_0x5f28e7[_0x7995('0x3d')][_0x7995('0x3f')]));_0x55791b[_0x7995('0x40')]=_0x55791b[_0x7995('0x40')]['length']?_0x55791b[_0x7995('0x40')]:_0x23c41d[_0x7995('0x3b')];if(_0x5f28e7['query'][_0x7995('0x4c')]){_0x55791b['include']=[{'all':!![]}];}_0x55791b=_[_0x7995('0x32')]({},_0x55791b,_0x5f28e7[_0x7995('0x4b')]);return db[_0x7995('0x38')][_0x7995('0x52')](_0x55791b)[_0x7995('0x2e')](handleEntityNotFound(_0x1c37c6,null))[_0x7995('0x2e')](respondWithResult(_0x1c37c6,null))[_0x7995('0x50')](handleError(_0x1c37c6,null));};exports['create']=function(_0x427dcf,_0x32f4be){return db[_0x7995('0x38')]['create'](_0x427dcf[_0x7995('0x33')],{})[_0x7995('0x2e')](respondWithResult(_0x32f4be,0xc9))[_0x7995('0x50')](handleError(_0x32f4be,null));};exports['update']=function(_0x4ec548,_0x5a592e){if(_0x4ec548[_0x7995('0x33')]['id']){delete _0x4ec548[_0x7995('0x33')]['id'];}return db['ChatInternalMessage'][_0x7995('0x52')]({'where':{'id':_0x4ec548[_0x7995('0x53')]['id']}})[_0x7995('0x2e')](handleEntityNotFound(_0x5a592e,null))[_0x7995('0x2e')](saveUpdates(_0x4ec548[_0x7995('0x33')],null))['then'](respondWithResult(_0x5a592e,null))[_0x7995('0x50')](handleError(_0x5a592e,null));};exports['destroy']=function(_0x14fe7f,_0x33c801){return db[_0x7995('0x38')]['find']({'where':{'id':_0x14fe7f['params']['id']}})['then'](handleEntityNotFound(_0x33c801,null))['then'](removeEntity(_0x33c801,null))[_0x7995('0x50')](handleError(_0x33c801,null));};exports[_0x7995('0x54')]=function(_0x1a861c,_0x150261){return db[_0x7995('0x38')][_0x7995('0x54')]()[_0x7995('0x2e')](respondWithResult(_0x150261,null))[_0x7995('0x50')](handleError(_0x150261,null));};function wrapUser(_0x328671){return function(_0x17ecd3){var _0xa7af8c=_0x328671[_0x7995('0x55')]({'plain':!![]});_0xa7af8c[_0x7995('0x56')]=[];if(_0x17ecd3){_0xa7af8c[_0x7995('0x57')]=_0x17ecd3[_0x7995('0x58')];_0xa7af8c[_0x7995('0x59')]=_0x17ecd3;}else{_0xa7af8c[_0x7995('0x57')]=moment(0x0)[_0x7995('0x5a')](_0x7995('0x5b'));_0xa7af8c['lastMessage']={};}return _0xa7af8c;};}exports[_0x7995('0x5c')]=function(_0x630737,_0x3b8a54,_0x32c0d3){var _0x5d160d=[];return db['User'][_0x7995('0x4e')]({'where':{'role':[_0x7995('0x36'),_0x7995('0x5d'),_0x7995('0x5e')]},'attributes':['id','fullname',_0x7995('0x30'),_0x7995('0x5f'),_0x7995('0x60'),_0x7995('0x61'),'online','lastLoginAt',_0x7995('0x62'),_0x7995('0x63')],'order':qs[_0x7995('0x45')](_0x7995('0x64')),'include':[{'model':db[_0x7995('0x65')],'as':_0x7995('0x66'),'attributes':['id',_0x7995('0x30'),_0x7995('0x49')],'through':{'attributes':[]}}]})[_0x7995('0x2e')](function(_0x50caf5){if(_0x50caf5){var _0x18f230=_0x630737[_0x7995('0x5e')][_0x7995('0x55')]({'plain':!![]});if(!_0x18f230)throw new Error(_0x7995('0x67'));if(_0x18f230['role']==='user'){return db[_0x7995('0x68')][_0x7995('0x52')]({'where':{'name':'Agents','userProfileId':_0x18f230[_0x7995('0x69')]},'raw':!![]})[_0x7995('0x2e')](function(_0x2e3421){if(_0x2e3421){if(_0x2e3421[_0x7995('0x6a')]===0x0){return db[_0x7995('0x6b')]['findAll']({'where':{'sectionId':_0x2e3421['id']},'raw':!![]})[_0x7995('0x2e')](function(_0x564fca){var _0x3e0a46=[];if(_[_0x7995('0x6c')](_0x564fca)){_0x3e0a46=_[_0x7995('0x48')](_0x50caf5,function(_0x25b534){if(_0x25b534[_0x7995('0x5f')]!==_0x7995('0x36')){return _0x25b534;}});return _0x3e0a46;}else{for(var _0x2b3c1d=0x0;_0x2b3c1d<_0x50caf5[_0x7995('0x41')];_0x2b3c1d++){var _0x10f012=_0x50caf5[_0x2b3c1d];if(_0x10f012[_0x7995('0x5f')]===_0x7995('0x36')){var _0x234d8d=_['find'](_0x564fca,function(_0x45351d){return _0x45351d[_0x7995('0x6d')]===_0x10f012['id'];});if(_0x234d8d)_0x3e0a46[_0x7995('0x6e')](_0x10f012);}else{_0x3e0a46[_0x7995('0x6e')](_0x10f012);}}return _0x3e0a46;}});}else{return _0x50caf5;}}else{var _0x2c6548=_['filter'](_0x50caf5,function(_0x4b54f2){if(_0x4b54f2[_0x7995('0x5f')]!==_0x7995('0x36')){return _0x4b54f2;}});return _0x2c6548;}});}else{return _0x50caf5;}}})[_0x7995('0x2e')](function(_0xae6166){var _0x5aa2ec=[];if(_0xae6166){_0x5d160d=_0xae6166;for(var _0x22d317=0x0;_0x22d317<_0xae6166['length'];_0x22d317+=0x1){_0x5d160d[_0x22d317]['messages']=[];_0x5aa2ec[_0x7995('0x6e')](db[_0x7995('0x38')][_0x7995('0x52')]({'where':{'FromId':[_0x630737[_0x7995('0x5e')]['id'],_0xae6166[_0x22d317]['id']],'ToId':[_0x630737[_0x7995('0x5e')]['id'],_0xae6166[_0x22d317]['id']],'ChatGroupId':null},'attributes':['id',_0x7995('0x58'),_0x7995('0x6f'),_0x7995('0x70'),_0x7995('0x71'),_0x7995('0x33')],'order':qs['sort'](_0x7995('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7995('0x2e')](wrapUser(_0xae6166[_0x22d317])));}return BPromise[_0x7995('0x73')](_0x5aa2ec);}return[];})['then'](function(_0x1fe1cb){return{'rows':_0x1fe1cb,'count':_0x1fe1cb[_0x7995('0x41')]};})[_0x7995('0x2e')](respondWithResult(_0x3b8a54,null))[_0x7995('0x50')](handleError(_0x3b8a54,null));}; \ No newline at end of file +var _0xed1f=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','update','then','name','render','merge','body','contact','agent','interaction','map','ChatInternalMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','admin','user','fullname','role','userpic','internal','online','allowmessenger','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xed1f,0x6a));var _0xfed1=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xed1f[_0x12f688];return _0x59c3de;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];config['redis']=_[_0xfed1('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfed1('0x1b'))(new Redis(config[_0xfed1('0x1c')]));require('./chatInternalMessage.socket')[_0xfed1('0x1d')](socket);function respondWithStatusCode(_0x5b9455,_0x4cd9d1){_0x4cd9d1=_0x4cd9d1||0xcc;return function(_0xde25db){if(_0xde25db){return _0x5b9455[_0xfed1('0x1e')](_0x4cd9d1);}return _0x5b9455[_0xfed1('0x1f')](_0x4cd9d1)[_0xfed1('0x20')]();};}function respondWithResult(_0x582e67,_0x1a00f6){_0x1a00f6=_0x1a00f6||0xc8;return function(_0x4af928){if(_0x4af928){return _0x582e67[_0xfed1('0x1f')](_0x1a00f6)[_0xfed1('0x21')](_0x4af928);}};}function respondWithFilteredResult(_0x489a0f,_0x3d0517){return function(_0xa72a20){if(_0xa72a20){var _0x5c0d9f=typeof _0x3d0517['offset']==='undefined'&&typeof _0x3d0517[_0xfed1('0x22')]==='undefined';var _0x201f18=_0xa72a20[_0xfed1('0x23')];var _0x51a860=_0x5c0d9f?0x0:_0x3d0517[_0xfed1('0x24')];var _0x65f14b=_0x5c0d9f?_0xa72a20['count']:_0x3d0517[_0xfed1('0x24')]+_0x3d0517[_0xfed1('0x22')];var _0xff4842;if(_0x65f14b>=_0x201f18){_0x65f14b=_0x201f18;_0xff4842=0xc8;}else{_0xff4842=0xce;}_0x489a0f[_0xfed1('0x1f')](_0xff4842);return _0x489a0f['set'](_0xfed1('0x25'),_0x51a860+'-'+_0x65f14b+'/'+_0x201f18)['json'](_0xa72a20);}return null;};}function patchUpdates(_0x446558){return function(_0x1317c8){try{jsonpatch[_0xfed1('0x26')](_0x1317c8,_0x446558,!![]);}catch(_0x532ec2){return BPromise[_0xfed1('0x27')](_0x532ec2);}return _0x1317c8['save']();};}function saveUpdates(_0x460555,_0x2793b7){return function(_0x1b7b22){if(_0x1b7b22){return _0x1b7b22[_0xfed1('0x28')](_0x460555)[_0xfed1('0x29')](function(_0x1199b7){return _0x1199b7;});}return null;};}function removeEntity(_0x527fc7,_0x465ce6){return function(_0xcb1cdc){if(_0xcb1cdc){return _0xcb1cdc['destroy']()[_0xfed1('0x29')](function(){_0x527fc7[_0xfed1('0x1f')](0xcc)[_0xfed1('0x20')]();});}};}function handleEntityNotFound(_0x1d62c5,_0x3b9122){return function(_0x1761d1){if(!_0x1761d1){_0x1d62c5['sendStatus'](0x194);}return _0x1761d1;};}function handleError(_0x4607e9,_0x5a4451){_0x5a4451=_0x5a4451||0x1f4;return function(_0x3106ee){logger['error'](_0x3106ee['stack']);if(_0x3106ee[_0xfed1('0x2a')]){delete _0x3106ee[_0xfed1('0x2a')];}_0x4607e9[_0xfed1('0x1f')](_0x5a4451)['send'](_0x3106ee);};}function getMustacheRender(_0x18e4e7,_0x437a25){return Mustache[_0xfed1('0x2b')](_0x18e4e7,_[_0xfed1('0x2c')](_0x437a25[_0xfed1('0x2d')],{'contact':_0x437a25[_0xfed1('0x2e')],'message':_0x437a25['message'],'agent':_0x437a25[_0xfed1('0x2f')],'interaction':_0x437a25[_0xfed1('0x30')],'account':_0x437a25['account']}))||'';}exports['index']=function(_0x28bd98,_0x2d10f5){var _0x2def09={},_0x71147f={},_0x44c24a={'count':0x0,'rows':[]};var _0x57ca74=_[_0xfed1('0x31')](db[_0xfed1('0x32')][_0xfed1('0x33')],function(_0x349de1){return{'name':_0x349de1[_0xfed1('0x34')],'type':_0x349de1['type'][_0xfed1('0x35')]};});_0x71147f['model']=_[_0xfed1('0x31')](_0x57ca74,_0xfed1('0x2a'));_0x71147f[_0xfed1('0x36')]=_[_0xfed1('0x37')](_0x28bd98[_0xfed1('0x36')]);_0x71147f[_0xfed1('0x38')]=_[_0xfed1('0x39')](_0x71147f[_0xfed1('0x3a')],_0x71147f['query']);_0x2def09[_0xfed1('0x3b')]=_[_0xfed1('0x39')](_0x71147f[_0xfed1('0x3a')],qs[_0xfed1('0x3c')](_0x28bd98['query']['fields']));_0x2def09[_0xfed1('0x3b')]=_0x2def09[_0xfed1('0x3b')][_0xfed1('0x3d')]?_0x2def09[_0xfed1('0x3b')]:_0x71147f[_0xfed1('0x3a')];if(!_0x28bd98[_0xfed1('0x36')][_0xfed1('0x3e')](_0xfed1('0x3f'))){_0x2def09['limit']=qs['limit'](_0x28bd98[_0xfed1('0x36')][_0xfed1('0x22')]);_0x2def09['offset']=qs[_0xfed1('0x24')](_0x28bd98[_0xfed1('0x36')][_0xfed1('0x24')]);}_0x2def09[_0xfed1('0x40')]=qs[_0xfed1('0x41')](_0x28bd98[_0xfed1('0x36')][_0xfed1('0x41')]);_0x2def09[_0xfed1('0x42')]=qs[_0xfed1('0x38')](_['pick'](_0x28bd98['query'],_0x71147f['filters']),_0x57ca74);if(_0x28bd98[_0xfed1('0x36')][_0xfed1('0x43')]){_0x2def09[_0xfed1('0x42')]=_['merge'](_0x2def09[_0xfed1('0x42')],{'$or':_['map'](_0x57ca74,function(_0x284215){if(_0x284215[_0xfed1('0x44')]!==_0xfed1('0x45')){var _0x4f042a={};_0x4f042a[_0x284215[_0xfed1('0x2a')]]={'$like':'%'+_0x28bd98[_0xfed1('0x36')][_0xfed1('0x43')]+'%'};return _0x4f042a;}})});}_0x2def09=_['merge']({},_0x2def09,_0x28bd98[_0xfed1('0x46')]);var _0x545f22={'where':_0x2def09[_0xfed1('0x42')]};return db[_0xfed1('0x32')][_0xfed1('0x23')](_0x545f22)[_0xfed1('0x29')](function(_0x1bfbe8){_0x44c24a[_0xfed1('0x23')]=_0x1bfbe8;if(_0x28bd98[_0xfed1('0x36')][_0xfed1('0x47')]){_0x2def09[_0xfed1('0x48')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xfed1('0x49')](_0x2def09);})[_0xfed1('0x29')](function(_0x41c7c3){_0x44c24a['rows']=_0x41c7c3;return _0x44c24a;})['then'](respondWithFilteredResult(_0x2d10f5,_0x2def09))[_0xfed1('0x4a')](handleError(_0x2d10f5,null));};exports[_0xfed1('0x4b')]=function(_0x46f9d3,_0xf39b8c){var _0x40c096={'raw':!![],'where':{'id':_0x46f9d3[_0xfed1('0x4c')]['id']}},_0x191278={};_0x191278[_0xfed1('0x3a')]=_[_0xfed1('0x37')](db[_0xfed1('0x32')][_0xfed1('0x33')]);_0x191278[_0xfed1('0x36')]=_['keys'](_0x46f9d3[_0xfed1('0x36')]);_0x191278[_0xfed1('0x38')]=_[_0xfed1('0x39')](_0x191278[_0xfed1('0x3a')],_0x191278[_0xfed1('0x36')]);_0x40c096[_0xfed1('0x3b')]=_['intersection'](_0x191278[_0xfed1('0x3a')],qs[_0xfed1('0x3c')](_0x46f9d3[_0xfed1('0x36')]['fields']));_0x40c096[_0xfed1('0x3b')]=_0x40c096[_0xfed1('0x3b')][_0xfed1('0x3d')]?_0x40c096[_0xfed1('0x3b')]:_0x191278['model'];if(_0x46f9d3[_0xfed1('0x36')][_0xfed1('0x47')]){_0x40c096[_0xfed1('0x48')]=[{'all':!![]}];}_0x40c096=_[_0xfed1('0x2c')]({},_0x40c096,_0x46f9d3[_0xfed1('0x46')]);return db[_0xfed1('0x32')][_0xfed1('0x4d')](_0x40c096)[_0xfed1('0x29')](handleEntityNotFound(_0xf39b8c,null))[_0xfed1('0x29')](respondWithResult(_0xf39b8c,null))[_0xfed1('0x4a')](handleError(_0xf39b8c,null));};exports[_0xfed1('0x4e')]=function(_0xb3a534,_0x1c6ea8){return db[_0xfed1('0x32')][_0xfed1('0x4e')](_0xb3a534[_0xfed1('0x2d')],{})[_0xfed1('0x29')](respondWithResult(_0x1c6ea8,0xc9))[_0xfed1('0x4a')](handleError(_0x1c6ea8,null));};exports['update']=function(_0x589feb,_0x1e1a8e){if(_0x589feb[_0xfed1('0x2d')]['id']){delete _0x589feb[_0xfed1('0x2d')]['id'];}return db[_0xfed1('0x32')]['find']({'where':{'id':_0x589feb[_0xfed1('0x4c')]['id']}})[_0xfed1('0x29')](handleEntityNotFound(_0x1e1a8e,null))['then'](saveUpdates(_0x589feb['body'],null))['then'](respondWithResult(_0x1e1a8e,null))[_0xfed1('0x4a')](handleError(_0x1e1a8e,null));};exports[_0xfed1('0x4f')]=function(_0x15e90f,_0x1d8ef2){return db[_0xfed1('0x32')][_0xfed1('0x4d')]({'where':{'id':_0x15e90f[_0xfed1('0x4c')]['id']}})[_0xfed1('0x29')](handleEntityNotFound(_0x1d8ef2,null))[_0xfed1('0x29')](removeEntity(_0x1d8ef2,null))[_0xfed1('0x4a')](handleError(_0x1d8ef2,null));};exports['describe']=function(_0x55490a,_0x30e869){return db[_0xfed1('0x32')][_0xfed1('0x50')]()[_0xfed1('0x29')](respondWithResult(_0x30e869,null))[_0xfed1('0x4a')](handleError(_0x30e869,null));};function wrapUser(_0x4cb43a){return function(_0x122702){var _0x3754df=_0x4cb43a[_0xfed1('0x51')]({'plain':!![]});_0x3754df[_0xfed1('0x52')]=[];if(_0x122702){_0x3754df[_0xfed1('0x53')]=_0x122702[_0xfed1('0x54')];_0x3754df[_0xfed1('0x55')]=_0x122702;}else{_0x3754df[_0xfed1('0x53')]=moment(0x0)[_0xfed1('0x56')](_0xfed1('0x57'));_0x3754df[_0xfed1('0x55')]={};}return _0x3754df;};}exports['getUsers']=function(_0x5b167b,_0x2fe019,_0x10d831){var _0x3d2cc4=[];return db[_0xfed1('0x58')][_0xfed1('0x49')]({'where':{'role':[_0xfed1('0x2f'),_0xfed1('0x59'),_0xfed1('0x5a')]},'attributes':['id',_0xfed1('0x5b'),_0xfed1('0x2a'),_0xfed1('0x5c'),_0xfed1('0x5d'),_0xfed1('0x5e'),_0xfed1('0x5f'),'lastLoginAt',_0xfed1('0x60'),'showWebBar'],'order':qs['sort'](_0xfed1('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0xfed1('0x62'),'attributes':['id','name',_0xfed1('0x44')],'through':{'attributes':[]}}]})[_0xfed1('0x29')](function(_0x53f0ab){if(_0x53f0ab){var _0x373214=_0x5b167b[_0xfed1('0x5a')]['get']({'plain':!![]});if(!_0x373214)throw new Error(_0xfed1('0x63'));if(_0x373214[_0xfed1('0x5c')]===_0xfed1('0x5a')){return db[_0xfed1('0x64')]['find']({'where':{'name':_0xfed1('0x65'),'userProfileId':_0x373214[_0xfed1('0x66')]},'raw':!![]})[_0xfed1('0x29')](function(_0x3b9c51){if(_0x3b9c51){if(_0x3b9c51[_0xfed1('0x67')]===0x0){return db[_0xfed1('0x68')][_0xfed1('0x49')]({'where':{'sectionId':_0x3b9c51['id']},'raw':!![]})[_0xfed1('0x29')](function(_0x5c043d){var _0x2d66ec=[];if(_[_0xfed1('0x69')](_0x5c043d)){_0x2d66ec=_[_0xfed1('0x43')](_0x53f0ab,function(_0x4112c1){if(_0x4112c1[_0xfed1('0x5c')]!==_0xfed1('0x2f')){return _0x4112c1;}});return _0x2d66ec;}else{for(var _0x53b7ed=0x0;_0x53b7ed<_0x53f0ab['length'];_0x53b7ed++){var _0x55d280=_0x53f0ab[_0x53b7ed];if(_0x55d280[_0xfed1('0x5c')]===_0xfed1('0x2f')){var _0x3aea22=_[_0xfed1('0x4d')](_0x5c043d,function(_0x4aaba6){return _0x4aaba6[_0xfed1('0x6a')]===_0x55d280['id'];});if(_0x3aea22)_0x2d66ec['push'](_0x55d280);}else{_0x2d66ec[_0xfed1('0x6b')](_0x55d280);}}return _0x2d66ec;}});}else{return _0x53f0ab;}}else{var _0xb399aa=_[_0xfed1('0x43')](_0x53f0ab,function(_0x3beef3){if(_0x3beef3[_0xfed1('0x5c')]!=='agent'){return _0x3beef3;}});return _0xb399aa;}});}else{return _0x53f0ab;}}})[_0xfed1('0x29')](function(_0x6b74cb){var _0x20c31f=[];if(_0x6b74cb){_0x3d2cc4=_0x6b74cb;for(var _0x525df1=0x0;_0x525df1<_0x6b74cb[_0xfed1('0x3d')];_0x525df1+=0x1){_0x3d2cc4[_0x525df1][_0xfed1('0x52')]=[];_0x20c31f[_0xfed1('0x6b')](db[_0xfed1('0x32')]['find']({'where':{'FromId':[_0x5b167b[_0xfed1('0x5a')]['id'],_0x6b74cb[_0x525df1]['id']],'ToId':[_0x5b167b['user']['id'],_0x6b74cb[_0x525df1]['id']],'ChatGroupId':null},'attributes':['id',_0xfed1('0x54'),_0xfed1('0x6c'),'ToId','read',_0xfed1('0x2d')],'order':qs[_0xfed1('0x41')](_0xfed1('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xfed1('0x29')](wrapUser(_0x6b74cb[_0x525df1])));}return BPromise['all'](_0x20c31f);}return[];})[_0xfed1('0x29')](function(_0x440e40){return{'rows':_0x440e40,'count':_0x440e40[_0xfed1('0x3d')]};})[_0xfed1('0x29')](respondWithResult(_0x2fe019,null))[_0xfed1('0x4a')](handleError(_0x2fe019,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4e845a2..3c3c2e3 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.events.js +++ b/server/api/chatInternalMessage/chatInternalMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb72d=['ChatInternalMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xb72d,0xc4));var _0xdb72=function(_0x2d123a,_0x2b258b){_0x2d123a=_0x2d123a-0x0;var _0x1cd0b3=_0xb72d[_0x2d123a];return _0x1cd0b3;};'use strict';var EventEmitter=require(_0xdb72('0x0'));var ChatInternalMessage=require(_0xdb72('0x1'))['db'][_0xdb72('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdb72('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb72('0x4'),'afterDestroy':'remove'};function emitEvent(_0x124742){return function(_0x326e71,_0x101d38,_0x4f988e){ChatInternalMessageEvents['emit'](_0x124742+':'+_0x326e71['id'],_0x326e71);ChatInternalMessageEvents[_0xdb72('0x5')](_0x124742,_0x326e71);_0x4f988e(null);};}for(var e in events){if(events[_0xdb72('0x6')](e)){var event=events[e];ChatInternalMessage[_0xdb72('0x7')](e,emitEvent(event));}}module[_0xdb72('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb613=['emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x1da7b,_0x3ce5ec){var _0x4bf8e3=function(_0x21bed2){while(--_0x21bed2){_0x1da7b['push'](_0x1da7b['shift']());}};_0x4bf8e3(++_0x3ce5ec);}(_0xb613,0x9d));var _0x3b61=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xb613[_0x3f88bc];return _0x4df1c4;};'use strict';var EventEmitter=require(_0x3b61('0x0'));var ChatInternalMessage=require(_0x3b61('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b61('0x2'),'afterUpdate':_0x3b61('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4110a2){return function(_0x37051e,_0x20747b,_0x190052){ChatInternalMessageEvents[_0x3b61('0x4')](_0x4110a2+':'+_0x37051e['id'],_0x37051e);ChatInternalMessageEvents[_0x3b61('0x4')](_0x4110a2,_0x37051e);_0x190052(null);};}for(var e in events){if(events[_0x3b61('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3b61('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f94cbe0..a49e8a5 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x42bbf5,_0x529769){var _0x3ec48c=function(_0xa1ca2b){while(--_0xa1ca2b){_0x42bbf5['push'](_0x42bbf5['shift']());}};_0x3ec48c(++_0x529769);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file +var _0x4fc2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x51a2a2,_0x399a1b){var _0x455319=function(_0x4a57e3){while(--_0x4a57e3){_0x51a2a2['push'](_0x51a2a2['shift']());}};_0x455319(++_0x399a1b);}(_0x4fc2,0x111));var _0x24fc=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x4fc2[_0x1f0724];return _0x253ffb;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24fc('0xb'),'collate':_0x24fc('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index f3d618e..7721091 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.rpc.js +++ b/server/api/chatInternalMessage/chatInternalMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18d7=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x105ecb,_0xeca91e){var _0xaa5025=function(_0x4aff9f){while(--_0x4aff9f){_0x105ecb['push'](_0x105ecb['shift']());}};_0xaa5025(++_0xeca91e);}(_0x18d7,0x1b7));var _0x718d=function(_0x407656,_0x551993){_0x407656=_0x407656-0x0;var _0x5706c8=_0x18d7[_0x407656];return _0x5706c8;};'use strict';var _=require('lodash');var util=require(_0x718d('0x0'));var moment=require(_0x718d('0x1'));var BPromise=require(_0x718d('0x2'));var rs=require(_0x718d('0x3'));var fs=require('fs');var Redis=require(_0x718d('0x4'));var db=require(_0x718d('0x5'))['db'];var utils=require(_0x718d('0x6'));var logger=require('../../config/logger')(_0x718d('0x7'));var config=require(_0x718d('0x8'));var jayson=require(_0x718d('0x9'));var client=jayson[_0x718d('0xa')][_0x718d('0xb')]({'port':0x232a});config[_0x718d('0xc')]=_[_0x718d('0xd')](config['redis'],{'host':_0x718d('0xe'),'port':0x18eb});var socket=require(_0x718d('0xf'))(new Redis(config[_0x718d('0xc')]));require(_0x718d('0x10'))[_0x718d('0x11')](socket);function respondWithRpcPromise(_0x2589d2,_0x44c858,_0x5b4c0){return new BPromise(function(_0x3603f8,_0x4db098){return client[_0x718d('0x12')](_0x2589d2,_0x5b4c0)['then'](function(_0x579b95){logger[_0x718d('0x13')](_0x718d('0x14'),_0x44c858,_0x718d('0x15'));logger['debug'](_0x718d('0x16'),_0x44c858,_0x718d('0x15'),JSON[_0x718d('0x17')](_0x579b95));if(_0x579b95['error']){if(_0x579b95[_0x718d('0x18')][_0x718d('0x19')]===0x1f4){logger[_0x718d('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x44c858,_0x579b95[_0x718d('0x18')][_0x718d('0x1a')]);return _0x4db098(_0x579b95['error'][_0x718d('0x1a')]);}logger[_0x718d('0x18')](_0x718d('0x14'),_0x44c858,_0x579b95[_0x718d('0x18')][_0x718d('0x1a')]);return _0x3603f8(_0x579b95[_0x718d('0x18')][_0x718d('0x1a')]);}else{logger[_0x718d('0x13')](_0x718d('0x14'),_0x44c858,'request\x20sent');_0x3603f8(_0x579b95[_0x718d('0x1b')][_0x718d('0x1a')]);}})[_0x718d('0x1c')](function(_0x412bdd){logger[_0x718d('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x44c858,_0x412bdd);_0x4db098(_0x412bdd);});});} \ No newline at end of file +var _0x7643=['../../mysqldb','../../config/utils','../../config/environment','client','http','redis','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x44573f,_0x98db32){var _0x55b09d=function(_0x56a2d1){while(--_0x56a2d1){_0x44573f['push'](_0x44573f['shift']());}};_0x55b09d(++_0x98db32);}(_0x7643,0x145));var _0x3764=function(_0x5a852b,_0x1694c2){_0x5a852b=_0x5a852b-0x0;var _0xd74d84=_0x7643[_0x5a852b];return _0xd74d84;};'use strict';var _=require(_0x3764('0x0'));var util=require(_0x3764('0x1'));var moment=require(_0x3764('0x2'));var BPromise=require(_0x3764('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3764('0x4'));var db=require(_0x3764('0x5'))['db'];var utils=require(_0x3764('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3764('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3764('0x8')][_0x3764('0x9')]({'port':0x232a});config[_0x3764('0xa')]=_['defaults'](config[_0x3764('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3764('0xa')]));require(_0x3764('0xb'))[_0x3764('0xc')](socket);function respondWithRpcPromise(_0x139779,_0x28d591,_0x3ab01d){return new BPromise(function(_0x310705,_0x1c3bad){return client[_0x3764('0xd')](_0x139779,_0x3ab01d)['then'](function(_0x5662c9){logger[_0x3764('0xe')](_0x3764('0xf'),_0x28d591,'request\x20sent');logger[_0x3764('0x10')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x28d591,'request\x20sent',JSON[_0x3764('0x11')](_0x5662c9));if(_0x5662c9[_0x3764('0x12')]){if(_0x5662c9['error']['code']===0x1f4){logger['error'](_0x3764('0xf'),_0x28d591,_0x5662c9[_0x3764('0x12')]['message']);return _0x1c3bad(_0x5662c9[_0x3764('0x12')]['message']);}logger['error'](_0x3764('0xf'),_0x28d591,_0x5662c9['error']['message']);return _0x310705(_0x5662c9[_0x3764('0x12')][_0x3764('0x13')]);}else{logger['info'](_0x3764('0xf'),_0x28d591,'request\x20sent');_0x310705(_0x5662c9[_0x3764('0x14')][_0x3764('0x13')]);}})[_0x3764('0x15')](function(_0x887f20){logger[_0x3764('0x12')](_0x3764('0xf'),_0x28d591,_0x887f20);_0x1c3bad(_0x887f20);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2b99083..0538903 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.socket.js +++ b/server/api/chatInternalMessage/chatInternalMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fad=['length','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x47a852,_0x215dc0){var _0x223c56=function(_0x43e6b7){while(--_0x43e6b7){_0x47a852['push'](_0x47a852['shift']());}};_0x223c56(++_0x215dc0);}(_0x6fad,0x174));var _0xd6fa=function(_0x5c6f53,_0x5f08f6){_0x5c6f53=_0x5c6f53-0x0;var _0x4b9fff=_0x6fad[_0x5c6f53];return _0x4b9fff;};'use strict';var ChatInternalMessageEvents=require(_0xd6fa('0x0'));var events=[_0xd6fa('0x1'),_0xd6fa('0x2'),_0xd6fa('0x3')];function createListener(_0x4f8a1c,_0x2f5f9b){return function(_0x4ae415){_0x2f5f9b[_0xd6fa('0x4')](_0x4f8a1c,_0x4ae415);};}function removeListener(_0x48f433,_0x3e76d0){return function(){ChatInternalMessageEvents[_0xd6fa('0x5')](_0x48f433,_0x3e76d0);};}exports['register']=function(_0x45dad4){for(var _0x329390=0x0,_0x291bd5=events[_0xd6fa('0x6')];_0x329390<_0x291bd5;_0x329390++){var _0x5a1bf0=events[_0x329390];var _0x1d2aaa=createListener('chatInternalMessage:'+_0x5a1bf0,_0x45dad4);ChatInternalMessageEvents['on'](_0x5a1bf0,_0x1d2aaa);}}; \ No newline at end of file +var _0xd0b5=['register','length','remove','update','emit','removeListener'];(function(_0xac884b,_0x1a582a){var _0x15c183=function(_0x53ca9d){while(--_0x53ca9d){_0xac884b['push'](_0xac884b['shift']());}};_0x15c183(++_0x1a582a);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x28aa11,_0x58a7a5){_0x28aa11=_0x28aa11-0x0;var _0x34d2e2=_0xd0b5[_0x28aa11];return _0x34d2e2;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x5d0b('0x0'),_0x5d0b('0x1')];function createListener(_0x4ec330,_0x279734){return function(_0x3e0e4a){_0x279734[_0x5d0b('0x2')](_0x4ec330,_0x3e0e4a);};}function removeListener(_0xb4d787,_0x417046){return function(){ChatInternalMessageEvents[_0x5d0b('0x3')](_0xb4d787,_0x417046);};}exports[_0x5d0b('0x4')]=function(_0x41b7c1){for(var _0xd514d0=0x0,_0x1db3b1=events[_0x5d0b('0x5')];_0xd514d0<_0x1db3b1;_0xd514d0++){var _0x1407d6=events[_0xd514d0];var _0x226be8=createListener('chatInternalMessage:'+_0x1407d6,_0x41b7c1);ChatInternalMessageEvents['on'](_0x1407d6,_0x226be8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 783164e..07c08f2 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aa0=['update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','getUsers','/:id','show','create','put'];(function(_0x585900,_0x453c01){var _0x4af5ee=function(_0x49a86c){while(--_0x49a86c){_0x585900['push'](_0x585900['shift']());}};_0x4af5ee(++_0x453c01);}(_0x2aa0,0x6c));var _0x02aa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2aa0[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x02aa('0x0'));var util=require(_0x02aa('0x1'));var path=require('path');var timeout=require(_0x02aa('0x2'));var express=require(_0x02aa('0x3'));var router=express['Router']();var fs_extra=require(_0x02aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x02aa('0x5'));var config=require(_0x02aa('0x6'));var controller=require(_0x02aa('0x7'));router[_0x02aa('0x8')]('/',auth[_0x02aa('0x9')](),controller[_0x02aa('0xa')]);router[_0x02aa('0x8')](_0x02aa('0xb'),auth[_0x02aa('0x9')](),controller[_0x02aa('0xc')]);router[_0x02aa('0x8')]('/users',auth[_0x02aa('0x9')](),controller[_0x02aa('0xd')]);router['get'](_0x02aa('0xe'),auth[_0x02aa('0x9')](),controller[_0x02aa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x02aa('0x10')]);router[_0x02aa('0x11')](_0x02aa('0xe'),controller[_0x02aa('0x12')]);router[_0x02aa('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x02aa('0x14')]=router; \ No newline at end of file +var _0x1157=['/describe','describe','get','/:id','show','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1157,0x137));var _0x7115=function(_0x5e40ce,_0x5893b6){_0x5e40ce=_0x5e40ce-0x0;var _0x40681c=_0x1157[_0x5e40ce];return _0x40681c;};'use strict';var multer=require(_0x7115('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7115('0x1'));var express=require(_0x7115('0x2'));var router=express[_0x7115('0x3')]();var fs_extra=require(_0x7115('0x4'));var auth=require(_0x7115('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7115('0x6'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0x7115('0x7')](),controller[_0x7115('0x8')]);router['get'](_0x7115('0x9'),auth['isAuthenticated'](),controller[_0x7115('0xa')]);router['get']('/users',auth[_0x7115('0x7')](),controller['getUsers']);router[_0x7115('0xb')](_0x7115('0xc'),auth[_0x7115('0x7')](),controller[_0x7115('0xd')]);router[_0x7115('0xe')]('/',auth['isAuthenticated'](),controller[_0x7115('0xf')]);router[_0x7115('0x10')](_0x7115('0xc'),controller[_0x7115('0x11')]);router['delete'](_0x7115('0xc'),auth[_0x7115('0x7')](),controller[_0x7115('0x12')]);module[_0x7115('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 725b02b..6d84615 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4847=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x4847,0x97));var _0x7484=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x4847[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x7484('0x0'));module[_0x7484('0x1')]={'body':{'type':Sequelize[_0x7484('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7484('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7484('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7484('0x4')),'defaultValue':_0x7484('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7484('0x5')]},'providerName':{'type':Sequelize[_0x7484('0x6')]},'providerResponse':{'type':Sequelize[_0x7484('0x2')]}}; \ No newline at end of file +var _0xbddf=['out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5af59e,_0x3771c1){var _0x4240df=function(_0x2267fd){while(--_0x2267fd){_0x5af59e['push'](_0x5af59e['shift']());}};_0x4240df(++_0x3771c1);}(_0xbddf,0xe3));var _0xfbdd=function(_0x1e783b,_0x212488){_0x1e783b=_0x1e783b-0x0;var _0x5294e0=_0xbddf[_0x1e783b];return _0x5294e0;};'use strict';var Sequelize=require(_0xfbdd('0x0'));module['exports']={'body':{'type':Sequelize[_0xfbdd('0x1')](_0xfbdd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfbdd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfbdd('0x4')]('in',_0xfbdd('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfbdd('0x6')]},'providerName':{'type':Sequelize[_0xfbdd('0x7')]},'providerResponse':{'type':Sequelize[_0xfbdd('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index eb6165d..3f3f17f 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','../../config/logger','chat-interactions','accept','chat','read','readAt','format','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','render','merge','body','agent','interaction','index','ChatMessage','rawAttributes','fieldName','model','map'];(function(_0x32161e,_0x578b70){var _0x382fe6=function(_0x76959f){while(--_0x76959f){_0x32161e['push'](_0x32161e['shift']());}};_0x382fe6(++_0x578b70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}function getMustacheRender(_0x5640eb,_0x24936a){return Mustache[_0x0a9e('0x3a')](_0x5640eb,_[_0x0a9e('0x3b')](_0x24936a[_0x0a9e('0x3c')],{'contact':_0x24936a['contact'],'message':_0x24936a[_0x0a9e('0x26')],'agent':_0x24936a[_0x0a9e('0x3d')],'interaction':_0x24936a[_0x0a9e('0x3e')],'account':_0x24936a['account']}))||'';}exports[_0x0a9e('0x3f')]=function(_0x1a180b,_0x289467){var _0x4c1c0e={},_0x546ef8={},_0x11b61d={'count':0x0,'rows':[]};var _0x40d766=_['map'](db[_0x0a9e('0x40')][_0x0a9e('0x41')],function(_0x2e1b3a){return{'name':_0x2e1b3a[_0x0a9e('0x42')],'type':_0x2e1b3a['type']['key']};});_0x546ef8[_0x0a9e('0x43')]=_[_0x0a9e('0x44')](_0x40d766,'name');_0x546ef8[_0x0a9e('0x45')]=_[_0x0a9e('0x46')](_0x1a180b[_0x0a9e('0x45')]);_0x546ef8['filters']=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],_0x546ef8[_0x0a9e('0x45')]);_0x4c1c0e[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],qs[_0x0a9e('0x49')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x49')]));_0x4c1c0e[_0x0a9e('0x48')]=_0x4c1c0e[_0x0a9e('0x48')][_0x0a9e('0x4a')]?_0x4c1c0e[_0x0a9e('0x48')]:_0x546ef8[_0x0a9e('0x43')];if(!_0x1a180b[_0x0a9e('0x45')]['hasOwnProperty']('nolimit')){_0x4c1c0e[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x30')]);_0x4c1c0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x2d')]);}_0x4c1c0e[_0x0a9e('0x4b')]=qs[_0x0a9e('0x4c')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4c')]);_0x4c1c0e['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x1a180b[_0x0a9e('0x45')],_0x546ef8[_0x0a9e('0x4d')]),_0x40d766);if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]){_0x4c1c0e[_0x0a9e('0x50')]=_[_0x0a9e('0x3b')](_0x4c1c0e['where'],{'$or':_[_0x0a9e('0x44')](_0x40d766,function(_0x48fd45){if(_0x48fd45[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0x8d6dd1={};_0x8d6dd1[_0x48fd45['name']]={'$like':'%'+_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]+'%'};return _0x8d6dd1;}})});}_0x4c1c0e=_[_0x0a9e('0x3b')]({},_0x4c1c0e,_0x1a180b[_0x0a9e('0x53')]);var _0x45c845={'where':_0x4c1c0e[_0x0a9e('0x50')]};return db[_0x0a9e('0x40')]['count'](_0x45c845)[_0x0a9e('0x1d')](function(_0x1bde3c){_0x11b61d[_0x0a9e('0x2f')]=_0x1bde3c;if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x54')]){_0x4c1c0e[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x40')][_0x0a9e('0x56')](_0x4c1c0e);})[_0x0a9e('0x1d')](function(_0x58a5c2){_0x11b61d[_0x0a9e('0x57')]=_0x58a5c2;return _0x11b61d;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x289467,_0x4c1c0e))['catch'](handleError(_0x289467,null));};exports['show']=function(_0x5ddf84,_0x1adfee){var _0x4317e3={'raw':!![],'where':{'id':_0x5ddf84[_0x0a9e('0x58')]['id']}},_0x37edaa={};_0x37edaa[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](db[_0x0a9e('0x40')][_0x0a9e('0x41')]);_0x37edaa['query']=_['keys'](_0x5ddf84['query']);_0x37edaa[_0x0a9e('0x4d')]=_[_0x0a9e('0x47')](_0x37edaa[_0x0a9e('0x43')],_0x37edaa['query']);_0x4317e3[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x37edaa['model'],qs['fields'](_0x5ddf84[_0x0a9e('0x45')]['fields']));_0x4317e3[_0x0a9e('0x48')]=_0x4317e3['attributes'][_0x0a9e('0x4a')]?_0x4317e3[_0x0a9e('0x48')]:_0x37edaa[_0x0a9e('0x43')];if(_0x5ddf84['query'][_0x0a9e('0x54')]){_0x4317e3[_0x0a9e('0x55')]=[{'all':!![]}];}_0x4317e3=_['merge']({},_0x4317e3,_0x5ddf84['options']);return db[_0x0a9e('0x40')][_0x0a9e('0x59')](_0x4317e3)['then'](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1d')](respondWithResult(_0x1adfee,null))['catch'](handleError(_0x1adfee,null));};exports[_0x0a9e('0x5a')]=function(_0x523cd2,_0xe22ccc){return db['ChatMessage']['create'](_0x523cd2['body'],{})[_0x0a9e('0x1d')](respondWithResult(_0xe22ccc,0xc9))['catch'](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x35')]=function(_0x65432,_0x3cfd00){if(_0x65432[_0x0a9e('0x3c')]['id']){delete _0x65432[_0x0a9e('0x3c')]['id'];}return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x65432[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x3cfd00,null))[_0x0a9e('0x1d')](saveUpdates(_0x65432[_0x0a9e('0x3c')],null))[_0x0a9e('0x1d')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x28')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x36')]=function(_0x156662,_0x5d86e9){return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x156662['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5d86e9,null))['then'](removeEntity(_0x5d86e9,null))[_0x0a9e('0x28')](handleError(_0x5d86e9,null));};exports['describe']=function(_0x4b3c1a,_0x5674ee){return db[_0x0a9e('0x40')]['describe']()[_0x0a9e('0x1d')](respondWithResult(_0x5674ee,null))[_0x0a9e('0x28')](handleError(_0x5674ee,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x5d')]=function(_0x26d7db,_0x49eed0,_0x1627a7){var _0x5854cc={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x26d7db[_0x0a9e('0x3c')]['id']){delete _0x26d7db[_0x0a9e('0x3c')]['id'];}_0x26d7db['body'][_0x0a9e('0x5f')]=!![];_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x60')]=moment()[_0x0a9e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x26d7db['body'][_0x0a9e('0x62')]||_0x26d7db[_0x0a9e('0x63')]['id'];_0x5854cc[_0x0a9e('0x3d')]['id']=_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db['ChatMessage'][_0x0a9e('0x59')]({'where':{'id':_0x26d7db[_0x0a9e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x64')],'as':'Contact'}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](saveUpdates(_0x26d7db['body'],null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x5854cc[_0x0a9e('0x26')]=_0x4556c5[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x4556c5[_0x0a9e('0x67')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x1d')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3[_0x0a9e('0x35')]({'UserId':_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')],'read1stAt':_[_0x0a9e('0x68')](_0x1cc4f3[_0x0a9e('0x69')])?moment()[_0x0a9e('0x61')](_0x0a9e('0x6a')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x5150a4){if(_0x5150a4){_0x5854cc[_0x0a9e('0x3e')]=_0x5150a4[_0x0a9e('0x65')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26d7db[_0x0a9e('0x63')]['id'],_0x26d7db[_0x0a9e('0x63')]['name'],_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x5854cc[_0x0a9e('0x3e')]['id'],_0x26d7db[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x26d7db['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0a9e('0x6c'),_0x5854cc);}return null;})[_0x0a9e('0x1d')](function(_0x1104ad){if(_0x1104ad){if(_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x6d')]){_0x5854cc[_0x0a9e('0x26')][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x38')]);_0x5854cc[_0x0a9e('0x26')]['channel']=_0x5854cc[_0x0a9e('0x6f')];_0x5854cc['message'][_0x0a9e('0x70')]=_0x0a9e('0x5d');return respondWithRpcPromise('EventManager',_0x0a9e('0x71'),{'event':_0x0a9e('0x72'),'message':_[_0x0a9e('0x3b')](_0x5854cc[_0x0a9e('0x26')],JSON['parse'](_0x5854cc[_0x0a9e('0x3e')][_0x0a9e('0x73')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x5854cc;});}return _0x5854cc;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x33')]=function(_0x361b21,_0x4abc8f,_0x290d43){var _0x3511c9={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x361b21[_0x0a9e('0x3c')]['id']){delete _0x361b21[_0x0a9e('0x3c')]['id'];}_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]||_0x361b21[_0x0a9e('0x63')]['id'];_0x3511c9[_0x0a9e('0x3d')]['id']=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db[_0x0a9e('0x40')]['find']({'where':{'id':_0x361b21[_0x0a9e('0x58')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x563627){if(_0x563627){_0x3511c9[_0x0a9e('0x26')]=_0x563627[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x563627['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x2bbdb5){if(_0x2bbdb5){_0x3511c9['interaction']=_0x2bbdb5[_0x0a9e('0x65')]({'plain':!![]});interaction_log['info'](_0x0a9e('0x74'),_0x361b21[_0x0a9e('0x63')]['id'],_0x361b21['user'][_0x0a9e('0x38')],_0x361b21[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x3511c9[_0x0a9e('0x3e')]['id'],_0x361b21[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x361b21[_0x0a9e('0x3c')]):'null');return respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x76'),_0x3511c9);}return null;})[_0x0a9e('0x1d')](function(_0x16e5b9){if(_0x16e5b9){_0x16e5b9['message'][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x361b21[_0x0a9e('0x63')]['name']);_0x16e5b9[_0x0a9e('0x26')][_0x0a9e('0x6f')]=_0x3511c9[_0x0a9e('0x6f')];_0x16e5b9[_0x0a9e('0x26')]['event']='reject';respondWithRpcPromise(_0x0a9e('0x71'),_0x0a9e('0x71'),{'event':_0x0a9e('0x77'),'message':_0x16e5b9['message']},client9002);return _0x3511c9;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4abc8f,null))[_0x0a9e('0x28')](handleError(_0x4abc8f,null));}; \ No newline at end of file +var _0xa9e0=['query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','../../config/logger','chat-interactions','accept','chat','read','readAt','format','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','render','merge','body','agent','interaction','index','ChatMessage','rawAttributes','fieldName','model','map'];(function(_0x57ae68,_0x1edcf3){var _0x45f81b=function(_0x18b09a){while(--_0x18b09a){_0x57ae68['push'](_0x57ae68['shift']());}};_0x45f81b(++_0x1edcf3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}function getMustacheRender(_0x5640eb,_0x24936a){return Mustache[_0x0a9e('0x3a')](_0x5640eb,_[_0x0a9e('0x3b')](_0x24936a[_0x0a9e('0x3c')],{'contact':_0x24936a['contact'],'message':_0x24936a[_0x0a9e('0x26')],'agent':_0x24936a[_0x0a9e('0x3d')],'interaction':_0x24936a[_0x0a9e('0x3e')],'account':_0x24936a['account']}))||'';}exports[_0x0a9e('0x3f')]=function(_0x1a180b,_0x289467){var _0x4c1c0e={},_0x546ef8={},_0x11b61d={'count':0x0,'rows':[]};var _0x40d766=_['map'](db[_0x0a9e('0x40')][_0x0a9e('0x41')],function(_0x2e1b3a){return{'name':_0x2e1b3a[_0x0a9e('0x42')],'type':_0x2e1b3a['type']['key']};});_0x546ef8[_0x0a9e('0x43')]=_[_0x0a9e('0x44')](_0x40d766,'name');_0x546ef8[_0x0a9e('0x45')]=_[_0x0a9e('0x46')](_0x1a180b[_0x0a9e('0x45')]);_0x546ef8['filters']=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],_0x546ef8[_0x0a9e('0x45')]);_0x4c1c0e[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x546ef8[_0x0a9e('0x43')],qs[_0x0a9e('0x49')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x49')]));_0x4c1c0e[_0x0a9e('0x48')]=_0x4c1c0e[_0x0a9e('0x48')][_0x0a9e('0x4a')]?_0x4c1c0e[_0x0a9e('0x48')]:_0x546ef8[_0x0a9e('0x43')];if(!_0x1a180b[_0x0a9e('0x45')]['hasOwnProperty']('nolimit')){_0x4c1c0e[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x30')]);_0x4c1c0e[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x2d')]);}_0x4c1c0e[_0x0a9e('0x4b')]=qs[_0x0a9e('0x4c')](_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4c')]);_0x4c1c0e['where']=qs[_0x0a9e('0x4d')](_[_0x0a9e('0x4e')](_0x1a180b[_0x0a9e('0x45')],_0x546ef8[_0x0a9e('0x4d')]),_0x40d766);if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]){_0x4c1c0e[_0x0a9e('0x50')]=_[_0x0a9e('0x3b')](_0x4c1c0e['where'],{'$or':_[_0x0a9e('0x44')](_0x40d766,function(_0x48fd45){if(_0x48fd45[_0x0a9e('0x51')]!==_0x0a9e('0x52')){var _0x8d6dd1={};_0x8d6dd1[_0x48fd45['name']]={'$like':'%'+_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x4f')]+'%'};return _0x8d6dd1;}})});}_0x4c1c0e=_[_0x0a9e('0x3b')]({},_0x4c1c0e,_0x1a180b[_0x0a9e('0x53')]);var _0x45c845={'where':_0x4c1c0e[_0x0a9e('0x50')]};return db[_0x0a9e('0x40')]['count'](_0x45c845)[_0x0a9e('0x1d')](function(_0x1bde3c){_0x11b61d[_0x0a9e('0x2f')]=_0x1bde3c;if(_0x1a180b[_0x0a9e('0x45')][_0x0a9e('0x54')]){_0x4c1c0e[_0x0a9e('0x55')]=[{'all':!![]}];}return db[_0x0a9e('0x40')][_0x0a9e('0x56')](_0x4c1c0e);})[_0x0a9e('0x1d')](function(_0x58a5c2){_0x11b61d[_0x0a9e('0x57')]=_0x58a5c2;return _0x11b61d;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x289467,_0x4c1c0e))['catch'](handleError(_0x289467,null));};exports['show']=function(_0x5ddf84,_0x1adfee){var _0x4317e3={'raw':!![],'where':{'id':_0x5ddf84[_0x0a9e('0x58')]['id']}},_0x37edaa={};_0x37edaa[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](db[_0x0a9e('0x40')][_0x0a9e('0x41')]);_0x37edaa['query']=_['keys'](_0x5ddf84['query']);_0x37edaa[_0x0a9e('0x4d')]=_[_0x0a9e('0x47')](_0x37edaa[_0x0a9e('0x43')],_0x37edaa['query']);_0x4317e3[_0x0a9e('0x48')]=_[_0x0a9e('0x47')](_0x37edaa['model'],qs['fields'](_0x5ddf84[_0x0a9e('0x45')]['fields']));_0x4317e3[_0x0a9e('0x48')]=_0x4317e3['attributes'][_0x0a9e('0x4a')]?_0x4317e3[_0x0a9e('0x48')]:_0x37edaa[_0x0a9e('0x43')];if(_0x5ddf84['query'][_0x0a9e('0x54')]){_0x4317e3[_0x0a9e('0x55')]=[{'all':!![]}];}_0x4317e3=_['merge']({},_0x4317e3,_0x5ddf84['options']);return db[_0x0a9e('0x40')][_0x0a9e('0x59')](_0x4317e3)['then'](handleEntityNotFound(_0x1adfee,null))[_0x0a9e('0x1d')](respondWithResult(_0x1adfee,null))['catch'](handleError(_0x1adfee,null));};exports[_0x0a9e('0x5a')]=function(_0x523cd2,_0xe22ccc){return db['ChatMessage']['create'](_0x523cd2['body'],{})[_0x0a9e('0x1d')](respondWithResult(_0xe22ccc,0xc9))['catch'](handleError(_0xe22ccc,null));};exports[_0x0a9e('0x35')]=function(_0x65432,_0x3cfd00){if(_0x65432[_0x0a9e('0x3c')]['id']){delete _0x65432[_0x0a9e('0x3c')]['id'];}return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x65432[_0x0a9e('0x58')]['id']}})['then'](handleEntityNotFound(_0x3cfd00,null))[_0x0a9e('0x1d')](saveUpdates(_0x65432[_0x0a9e('0x3c')],null))[_0x0a9e('0x1d')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x28')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x36')]=function(_0x156662,_0x5d86e9){return db[_0x0a9e('0x40')][_0x0a9e('0x59')]({'where':{'id':_0x156662['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x5d86e9,null))['then'](removeEntity(_0x5d86e9,null))[_0x0a9e('0x28')](handleError(_0x5d86e9,null));};exports['describe']=function(_0x4b3c1a,_0x5674ee){return db[_0x0a9e('0x40')]['describe']()[_0x0a9e('0x1d')](respondWithResult(_0x5674ee,null))[_0x0a9e('0x28')](handleError(_0x5674ee,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x5d')]=function(_0x26d7db,_0x49eed0,_0x1627a7){var _0x5854cc={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x26d7db[_0x0a9e('0x3c')]['id']){delete _0x26d7db[_0x0a9e('0x3c')]['id'];}_0x26d7db['body'][_0x0a9e('0x5f')]=!![];_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x60')]=moment()[_0x0a9e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x26d7db['body'][_0x0a9e('0x62')]||_0x26d7db[_0x0a9e('0x63')]['id'];_0x5854cc[_0x0a9e('0x3d')]['id']=_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db['ChatMessage'][_0x0a9e('0x59')]({'where':{'id':_0x26d7db[_0x0a9e('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x64')],'as':'Contact'}]})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))['then'](saveUpdates(_0x26d7db['body'],null))[_0x0a9e('0x1d')](function(_0x4556c5){if(_0x4556c5){_0x5854cc[_0x0a9e('0x26')]=_0x4556c5[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x4556c5[_0x0a9e('0x67')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x49eed0,null))[_0x0a9e('0x1d')](function(_0x1cc4f3){if(_0x1cc4f3){return _0x1cc4f3[_0x0a9e('0x35')]({'UserId':_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x62')],'read1stAt':_[_0x0a9e('0x68')](_0x1cc4f3[_0x0a9e('0x69')])?moment()[_0x0a9e('0x61')](_0x0a9e('0x6a')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x5150a4){if(_0x5150a4){_0x5854cc[_0x0a9e('0x3e')]=_0x5150a4[_0x0a9e('0x65')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26d7db[_0x0a9e('0x63')]['id'],_0x26d7db[_0x0a9e('0x63')]['name'],_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x5854cc[_0x0a9e('0x3e')]['id'],_0x26d7db[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x26d7db['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0a9e('0x6c'),_0x5854cc);}return null;})[_0x0a9e('0x1d')](function(_0x1104ad){if(_0x1104ad){if(_0x26d7db[_0x0a9e('0x3c')][_0x0a9e('0x6d')]){_0x5854cc[_0x0a9e('0x26')][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x26d7db[_0x0a9e('0x63')][_0x0a9e('0x38')]);_0x5854cc[_0x0a9e('0x26')]['channel']=_0x5854cc[_0x0a9e('0x6f')];_0x5854cc['message'][_0x0a9e('0x70')]=_0x0a9e('0x5d');return respondWithRpcPromise('EventManager',_0x0a9e('0x71'),{'event':_0x0a9e('0x72'),'message':_[_0x0a9e('0x3b')](_0x5854cc[_0x0a9e('0x26')],JSON['parse'](_0x5854cc[_0x0a9e('0x3e')][_0x0a9e('0x73')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x5854cc;});}return _0x5854cc;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x49eed0,null))['catch'](handleError(_0x49eed0,null));};var interaction_log=require(_0x0a9e('0x5b'))(_0x0a9e('0x5c'));exports[_0x0a9e('0x33')]=function(_0x361b21,_0x4abc8f,_0x290d43){var _0x3511c9={'agent':{},'channel':_0x0a9e('0x5e')};if(_0x361b21[_0x0a9e('0x3c')]['id']){delete _0x361b21[_0x0a9e('0x3c')]['id'];}_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')]||_0x361b21[_0x0a9e('0x63')]['id'];_0x3511c9[_0x0a9e('0x3d')]['id']=_0x361b21[_0x0a9e('0x3c')][_0x0a9e('0x62')];return db[_0x0a9e('0x40')]['find']({'where':{'id':_0x361b21[_0x0a9e('0x58')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x563627){if(_0x563627){_0x3511c9[_0x0a9e('0x26')]=_0x563627[_0x0a9e('0x65')]({'plain':!![]});return db[_0x0a9e('0x66')][_0x0a9e('0x59')]({'where':{'id':_0x563627['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4abc8f,null))[_0x0a9e('0x1d')](function(_0x2bbdb5){if(_0x2bbdb5){_0x3511c9['interaction']=_0x2bbdb5[_0x0a9e('0x65')]({'plain':!![]});interaction_log['info'](_0x0a9e('0x74'),_0x361b21[_0x0a9e('0x63')]['id'],_0x361b21['user'][_0x0a9e('0x38')],_0x361b21[_0x0a9e('0x63')][_0x0a9e('0x6b')],_0x3511c9[_0x0a9e('0x3e')]['id'],_0x361b21[_0x0a9e('0x3c')]?JSON[_0x0a9e('0x23')](_0x361b21[_0x0a9e('0x3c')]):'null');return respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x76'),_0x3511c9);}return null;})[_0x0a9e('0x1d')](function(_0x16e5b9){if(_0x16e5b9){_0x16e5b9['message'][_0x0a9e('0x6e')]=util[_0x0a9e('0x61')]('SIP/%s',_0x361b21[_0x0a9e('0x63')]['name']);_0x16e5b9[_0x0a9e('0x26')][_0x0a9e('0x6f')]=_0x3511c9[_0x0a9e('0x6f')];_0x16e5b9[_0x0a9e('0x26')]['event']='reject';respondWithRpcPromise(_0x0a9e('0x71'),_0x0a9e('0x71'),{'event':_0x0a9e('0x77'),'message':_0x16e5b9['message']},client9002);return _0x3511c9;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4abc8f,null))[_0x0a9e('0x28')](handleError(_0x4abc8f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8c37be9..b4fd9f7 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa35a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x5589ac,_0x43ea17){var _0x435500=function(_0x32077b){while(--_0x32077b){_0x5589ac['push'](_0x5589ac['shift']());}};_0x435500(++_0x43ea17);}(_0xa35a,0x10a));var _0xaa35=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa35a[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xaa35('0x0'))['db'][_0xaa35('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaa35('0x2')](0x0);var events={'afterCreate':_0xaa35('0x3'),'afterUpdate':_0xaa35('0x4'),'afterDestroy':_0xaa35('0x5')};function emitEvent(_0x554f02){return function(_0x5eb2e9,_0x4f0012,_0x2cdef8){ChatMessageEvents[_0xaa35('0x6')](_0x554f02+':'+_0x5eb2e9['id'],_0x5eb2e9);ChatMessageEvents[_0xaa35('0x6')](_0x554f02,_0x5eb2e9);_0x2cdef8(null);};}for(var e in events){if(events[_0xaa35('0x7')](e)){var event=events[e];ChatMessage[_0xaa35('0x8')](e,emitEvent(event));}}module[_0xaa35('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xe436=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xe436,0x193));var _0x6e43=function(_0x360232,_0x4248bd){_0x360232=_0x360232-0x0;var _0x54d21d=_0xe436[_0x360232];return _0x54d21d;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x6e43('0x0'))['db'][_0x6e43('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6e43('0x2')](0x0);var events={'afterCreate':_0x6e43('0x3'),'afterUpdate':_0x6e43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e354d){return function(_0x358fa6,_0x9c7743,_0x4b5fef){ChatMessageEvents[_0x6e43('0x5')](_0x5e354d+':'+_0x358fa6['id'],_0x358fa6);ChatMessageEvents[_0x6e43('0x5')](_0x5e354d,_0x358fa6);_0x4b5fef(null);};}for(var e in events){if(events[_0x6e43('0x6')](e)){var event=events[e];ChatMessage[_0x6e43('0x7')](e,emitEvent(event));}}module[_0x6e43('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c1bc7d4..11fc57c 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41d9=['UserId','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret'];(function(_0x284664,_0x455bfa){var _0x2e5d22=function(_0x40f40b){while(--_0x40f40b){_0x284664['push'](_0x284664['shift']());}};_0x2e5d22(++_0x455bfa);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var logger=require(_0x941d('0x2'))(_0x941d('0x3'));var moment=require(_0x941d('0x4'));var BPromise=require(_0x941d('0x5'));var rp=require(_0x941d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x941d('0x7'));var config=require(_0x941d('0x8'));var attributes=require('./chatMessage.attributes');module[_0x941d('0x9')]=function(_0x19dd41,_0x56e384){return _0x19dd41[_0x941d('0xa')]('ChatMessage',attributes,{'tableName':_0x941d('0xb'),'paranoid':![],'indexes':[{'name':_0x941d('0xc'),'fields':[_0x941d('0xd')],'type':_0x941d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28033a,_0x546a1a,_0x176430){var _0x1c5e4d=_0x19dd41[_0x941d('0xf')];var _0x10d08e=_0x28033a['get']({'plain':!![]});if(_0x10d08e[_0x941d('0x10')][_0x941d('0x11')]()==='in'||_0x10d08e[_0x941d('0x10')][_0x941d('0x11')]()===_0x941d('0x12')&&!_0x10d08e[_0x941d('0x13')]&&!_['isNil'](_0x10d08e[_0x941d('0x14')])){_0x1c5e4d['ChatInteraction']['findOne']({'where':{'id':_0x10d08e[_0x941d('0x15')]}})[_0x941d('0x16')](function(_0xbd3711){if(_0xbd3711){_0xbd3711[_0x941d('0x17')]({'lastMsgAt':_0x10d08e[_0x941d('0x18')],'lastMsgDirection':_0x10d08e[_0x941d('0x10')][_0x941d('0x11')]()});}})[_0x941d('0x19')](function(_0x369b0b){console[_0x941d('0x1a')](_0x369b0b);});}_0x176430();}},'charset':_0x941d('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x70e9=['direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','util','../../config/logger','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','body','FULLTEXT','get'];(function(_0x73e97c,_0x4b55e1){var _0x81290d=function(_0x46d41b){while(--_0x46d41b){_0x73e97c['push'](_0x73e97c['shift']());}};_0x81290d(++_0x4b55e1);}(_0x70e9,0x193));var _0x970e=function(_0x243d2d,_0x5ba871){_0x243d2d=_0x243d2d-0x0;var _0x23eaaa=_0x70e9[_0x243d2d];return _0x23eaaa;};'use strict';var _=require('lodash');var util=require(_0x970e('0x0'));var logger=require(_0x970e('0x1'))('api');var moment=require(_0x970e('0x2'));var BPromise=require(_0x970e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x970e('0x4'));var rimraf=require('rimraf');var config=require(_0x970e('0x5'));var attributes=require(_0x970e('0x6'));module[_0x970e('0x7')]=function(_0x2263b4,_0x2fb58d){return _0x2263b4[_0x970e('0x8')](_0x970e('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x970e('0xa')],'type':_0x970e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59e840,_0x38c7a0,_0x2140e5){var _0x1d3fec=_0x2263b4['models'];var _0x17256c=_0x59e840[_0x970e('0xc')]({'plain':!![]});if(_0x17256c[_0x970e('0xd')][_0x970e('0xe')]()==='in'||_0x17256c[_0x970e('0xd')][_0x970e('0xe')]()==='out'&&!_0x17256c[_0x970e('0xf')]&&!_[_0x970e('0x10')](_0x17256c[_0x970e('0x11')])){_0x1d3fec[_0x970e('0x12')][_0x970e('0x13')]({'where':{'id':_0x17256c[_0x970e('0x14')]}})[_0x970e('0x15')](function(_0x71dd35){if(_0x71dd35){_0x71dd35['update']({'lastMsgAt':_0x17256c[_0x970e('0x16')],'lastMsgDirection':_0x17256c[_0x970e('0xd')]['toLowerCase']()});}})[_0x970e('0x17')](function(_0x24c244){console[_0x970e('0x18')](_0x24c244);});}_0x2140e5();}},'charset':_0x970e('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 183f9d6..55925b1 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2198=['../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x2198,0x1da));var _0x8219=function(_0x11de22,_0x96e2f5){_0x11de22=_0x11de22-0x0;var _0x54aee9=_0x2198[_0x11de22];return _0x54aee9;};'use strict';var _=require(_0x8219('0x0'));var util=require(_0x8219('0x1'));var moment=require(_0x8219('0x2'));var BPromise=require('bluebird');var rs=require(_0x8219('0x3'));var fs=require('fs');var Redis=require(_0x8219('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8219('0x5'));var logger=require(_0x8219('0x6'))(_0x8219('0x7'));var config=require('../../config/environment');var jayson=require(_0x8219('0x8'));var client=jayson[_0x8219('0x9')][_0x8219('0xa')]({'port':0x232a});config[_0x8219('0xb')]=_['defaults'](config[_0x8219('0xb')],{'host':_0x8219('0xc'),'port':0x18eb});var socket=require(_0x8219('0xd'))(new Redis(config[_0x8219('0xb')]));require(_0x8219('0xe'))[_0x8219('0xf')](socket);function respondWithRpcPromise(_0x4438e3,_0xda39a6,_0x439f3f){return new BPromise(function(_0x432397,_0x2a11df){return client[_0x8219('0x10')](_0x4438e3,_0x439f3f)[_0x8219('0x11')](function(_0x5176bb){logger[_0x8219('0x12')](_0x8219('0x13'),_0xda39a6,_0x8219('0x14'));logger[_0x8219('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xda39a6,'request\x20sent',JSON[_0x8219('0x16')](_0x5176bb));if(_0x5176bb[_0x8219('0x17')]){if(_0x5176bb[_0x8219('0x17')]['code']===0x1f4){logger[_0x8219('0x17')]('ChatMessage,\x20%s,\x20%s',_0xda39a6,_0x5176bb[_0x8219('0x17')][_0x8219('0x18')]);return _0x2a11df(_0x5176bb['error'][_0x8219('0x18')]);}logger[_0x8219('0x17')]('ChatMessage,\x20%s,\x20%s',_0xda39a6,_0x5176bb[_0x8219('0x17')]['message']);return _0x432397(_0x5176bb[_0x8219('0x17')][_0x8219('0x18')]);}else{logger['info'](_0x8219('0x13'),_0xda39a6,'request\x20sent');_0x432397(_0x5176bb[_0x8219('0x19')][_0x8219('0x18')]);}})[_0x8219('0x1a')](function(_0x510be8){logger[_0x8219('0x17')](_0x8219('0x13'),_0xda39a6,_0x510be8);_0x2a11df(_0x510be8);});});}exports[_0x8219('0x1b')]=function(_0x105752){var _0xf6e5cc=this;return new Promise(function(_0x31be81,_0xeb73b7){return db['ChatMessage'][_0x8219('0x1c')](_0x105752[_0x8219('0x1d')],{'raw':_0x105752[_0x8219('0x1e')]?_0x105752[_0x8219('0x1e')][_0x8219('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3767f8){logger[_0x8219('0x12')](_0x8219('0x1b'),_0x105752);logger[_0x8219('0x15')](_0x8219('0x1b'),_0x105752,JSON[_0x8219('0x16')](_0x3767f8));_0x31be81(_0x3767f8);})[_0x8219('0x1a')](function(_0x19be98){logger[_0x8219('0x17')](_0x8219('0x1b'),_0x19be98['message'],_0x105752);_0xeb73b7(_0xf6e5cc[_0x8219('0x17')](0x1f4,_0x19be98[_0x8219('0x18')]));});});}; \ No newline at end of file +var _0xdf65=['client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','info','CreateChatMessage','create','body','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x323843,_0x4c3389){var _0x46ebc6=function(_0x26e600){while(--_0x26e600){_0x323843['push'](_0x323843['shift']());}};_0x46ebc6(++_0x4c3389);}(_0xdf65,0x9b));var _0x5df6=function(_0x3cbd84,_0x494ac1){_0x3cbd84=_0x3cbd84-0x0;var _0x321e0f=_0xdf65[_0x3cbd84];return _0x321e0f;};'use strict';var _=require(_0x5df6('0x0'));var util=require(_0x5df6('0x1'));var moment=require(_0x5df6('0x2'));var BPromise=require(_0x5df6('0x3'));var rs=require(_0x5df6('0x4'));var fs=require('fs');var Redis=require(_0x5df6('0x5'));var db=require(_0x5df6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5df6('0x7'))('rpc');var config=require(_0x5df6('0x8'));var jayson=require(_0x5df6('0x9'));var client=jayson[_0x5df6('0xa')][_0x5df6('0xb')]({'port':0x232a});config[_0x5df6('0xc')]=_[_0x5df6('0xd')](config['redis'],{'host':_0x5df6('0xe'),'port':0x18eb});var socket=require(_0x5df6('0xf'))(new Redis(config[_0x5df6('0xc')]));require(_0x5df6('0x10'))['register'](socket);function respondWithRpcPromise(_0x5b3a34,_0x29768d,_0x17ca6d){return new BPromise(function(_0x17861d,_0x1bbc15){return client['request'](_0x5b3a34,_0x17ca6d)[_0x5df6('0x11')](function(_0x2f0320){logger['info'](_0x5df6('0x12'),_0x29768d,_0x5df6('0x13'));logger[_0x5df6('0x14')](_0x5df6('0x15'),_0x29768d,'request\x20sent',JSON['stringify'](_0x2f0320));if(_0x2f0320['error']){if(_0x2f0320['error'][_0x5df6('0x16')]===0x1f4){logger[_0x5df6('0x17')](_0x5df6('0x12'),_0x29768d,_0x2f0320[_0x5df6('0x17')][_0x5df6('0x18')]);return _0x1bbc15(_0x2f0320[_0x5df6('0x17')]['message']);}logger['error'](_0x5df6('0x12'),_0x29768d,_0x2f0320[_0x5df6('0x17')]['message']);return _0x17861d(_0x2f0320['error'][_0x5df6('0x18')]);}else{logger[_0x5df6('0x19')](_0x5df6('0x12'),_0x29768d,_0x5df6('0x13'));_0x17861d(_0x2f0320['result'][_0x5df6('0x18')]);}})['catch'](function(_0x1306c0){logger[_0x5df6('0x17')](_0x5df6('0x12'),_0x29768d,_0x1306c0);_0x1bbc15(_0x1306c0);});});}exports[_0x5df6('0x1a')]=function(_0xa223b3){var _0x27525d=this;return new Promise(function(_0x4e0224,_0x225038){return db['ChatMessage'][_0x5df6('0x1b')](_0xa223b3[_0x5df6('0x1c')],{'raw':_0xa223b3[_0x5df6('0x1d')]?_0xa223b3[_0x5df6('0x1d')][_0x5df6('0x1e')]===undefined?!![]:![]:!![]})[_0x5df6('0x11')](function(_0x2e8976){logger[_0x5df6('0x19')](_0x5df6('0x1a'),_0xa223b3);logger[_0x5df6('0x14')](_0x5df6('0x1a'),_0xa223b3,JSON[_0x5df6('0x1f')](_0x2e8976));_0x4e0224(_0x2e8976);})[_0x5df6('0x20')](function(_0x279b83){logger[_0x5df6('0x17')](_0x5df6('0x1a'),_0x279b83['message'],_0xa223b3);_0x225038(_0x27525d[_0x5df6('0x17')](0x1f4,_0x279b83[_0x5df6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0fc1546..2090973 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['register','length','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x2675,0x75));var _0x5267=function(_0xb3a6f7,_0x1c8ec5){_0xb3a6f7=_0xb3a6f7-0x0;var _0x4c087f=_0x2675[_0xb3a6f7];return _0x4c087f;};'use strict';var ChatMessageEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){ChatMessageEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);ChatMessageEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file +var _0x7096=['emit','removeListener','register','length','save','update'];(function(_0x5317c9,_0x452161){var _0x29ee2c=function(_0x40581e){while(--_0x40581e){_0x5317c9['push'](_0x5317c9['shift']());}};_0x29ee2c(++_0x452161);}(_0x7096,0x10c));var _0x6709=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7096[_0x134c2e];return _0x2825db;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x6709('0x0'),'remove',_0x6709('0x1')];function createListener(_0x5c668a,_0x233cbf){return function(_0x9544e0){_0x233cbf[_0x6709('0x2')](_0x5c668a,_0x9544e0);};}function removeListener(_0xccdcb5,_0x3cd087){return function(){ChatMessageEvents[_0x6709('0x3')](_0xccdcb5,_0x3cd087);};}exports[_0x6709('0x4')]=function(_0x9d630f){for(var _0xa35832=0x0,_0x3e2223=events[_0x6709('0x5')];_0xa35832<_0x3e2223;_0xa35832++){var _0x985814=events[_0xa35832];var _0x30147f=createListener('chatMessage:'+_0x985814,_0x9d630f);ChatMessageEvents['on'](_0x985814,_0x30147f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b8cb1ce..eeed349 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8130=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','chatmessage:create','put','update','/:id/accept','/:id/reject','delete','destroy'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x8130,0x146));var _0x0813=function(_0x13a61c,_0x51f924){_0x13a61c=_0x13a61c-0x0;var _0x1ae767=_0x8130[_0x13a61c];return _0x1ae767;};'use strict';var multer=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var path=require('path');var timeout=require(_0x0813('0x2'));var express=require(_0x0813('0x3'));var router=express[_0x0813('0x4')]();var fs_extra=require(_0x0813('0x5'));var auth=require(_0x0813('0x6'));var interaction=require(_0x0813('0x7'));var config=require('../../config/environment');var controller=require(_0x0813('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0813('0x9')]);router[_0x0813('0xa')](_0x0813('0xb'),auth[_0x0813('0xc')](),controller[_0x0813('0xd')]);router[_0x0813('0xa')](_0x0813('0xe'),auth['isAuthenticated'](),controller[_0x0813('0xf')]);router[_0x0813('0x10')]('/',auth[_0x0813('0xc')](),interaction['tracked']('chat',_0x0813('0x11')),controller['create']);router[_0x0813('0x12')]('/:id',controller[_0x0813('0x13')]);router[_0x0813('0x12')](_0x0813('0x14'),auth[_0x0813('0xc')](),controller['accept']);router['put'](_0x0813('0x15'),auth[_0x0813('0xc')](),controller['reject']);router[_0x0813('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0813('0x17')]);module[_0x0813('0x18')]=router; \ No newline at end of file +var _0xe130=['tracked','chat','put','update','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/:id','post'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe130,0x127));var _0x0e13=function(_0x523c4b,_0x2521c2){_0x523c4b=_0x523c4b-0x0;var _0x24498b=_0xe130[_0x523c4b];return _0x24498b;};'use strict';var multer=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var path=require('path');var timeout=require(_0x0e13('0x2'));var express=require(_0x0e13('0x3'));var router=express[_0x0e13('0x4')]();var fs_extra=require(_0x0e13('0x5'));var auth=require(_0x0e13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0e13('0x7'));var controller=require(_0x0e13('0x8'));router[_0x0e13('0x9')]('/',auth[_0x0e13('0xa')](),controller['index']);router[_0x0e13('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0e13('0x9')](_0x0e13('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0e13('0xc')]('/',auth[_0x0e13('0xa')](),interaction[_0x0e13('0xd')](_0x0e13('0xe'),'chatmessage:create'),controller['create']);router[_0x0e13('0xf')](_0x0e13('0xb'),controller[_0x0e13('0x10')]);router[_0x0e13('0xf')]('/:id/accept',auth[_0x0e13('0xa')](),controller['accept']);router[_0x0e13('0xf')](_0x0e13('0x11'),auth[_0x0e13('0xa')](),controller[_0x0e13('0x12')]);router[_0x0e13('0x13')](_0x0e13('0xb'),auth[_0x0e13('0xa')](),controller[_0x0e13('0x14')]);module[_0x0e13('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 7225ce2..ca4ff3d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21a2=['TEXT','medium','sequelize','exports'];(function(_0x2c8208,_0x3600de){var _0x56afa7=function(_0x2e6943){while(--_0x2e6943){_0x2c8208['push'](_0x2c8208['shift']());}};_0x56afa7(++_0x3600de);}(_0x21a2,0x10e));var _0x221a=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x21a2[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x221a('0x0'));module[_0x221a('0x1')]={'body':{'type':Sequelize[_0x221a('0x2')](_0x221a('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x0a48=['sequelize','exports','TEXT','medium'];(function(_0x413f41,_0x4b1165){var _0x3caf82=function(_0x3cd6c0){while(--_0x3cd6c0){_0x413f41['push'](_0x413f41['shift']());}};_0x3caf82(++_0x4b1165);}(_0x0a48,0x1ac));var _0x80a4=function(_0x58e8dd,_0x1ef6ff){_0x58e8dd=_0x58e8dd-0x0;var _0x14989f=_0x0a48[_0x58e8dd];return _0x14989f;};'use strict';var Sequelize=require(_0x80a4('0x0'));module[_0x80a4('0x1')]={'body':{'type':Sequelize[_0x80a4('0x2')](_0x80a4('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 31a4be3..74ee4a7 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4325=['limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','message','account','index','map','ChatOfflineMessage','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','includeAll','rows','catch','show','params','include','options','find','create','findAll','join','root','files','offline-chat','existsSync','remove','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x564592,_0x41234e){var _0x198337=function(_0x191ee5){while(--_0x191ee5){_0x564592['push'](_0x564592['shift']());}};_0x198337(++_0x41234e);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){_0x4af9f6[_0x5432('0x18')](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x637582,_0x4b6ea5){return function(_0xd9928a){if(!_0xd9928a){_0x637582[_0x5432('0x17')](0x194);}return _0xd9928a;};}function handleError(_0xe7eda2,_0x520da1){_0x520da1=_0x520da1||0x1f4;return function(_0x4ab09d){logger[_0x5432('0x26')](_0x4ab09d[_0x5432('0x27')]);if(_0x4ab09d['name']){delete _0x4ab09d[_0x5432('0x28')];}_0xe7eda2[_0x5432('0x18')](_0x520da1)[_0x5432('0x29')](_0x4ab09d);};}function getMustacheRender(_0x4add5b,_0x29dc15){return Mustache['render'](_0x4add5b,_['merge'](_0x29dc15[_0x5432('0x2a')],{'contact':_0x29dc15['contact'],'message':_0x29dc15[_0x5432('0x2b')],'agent':_0x29dc15['agent'],'interaction':_0x29dc15['interaction'],'account':_0x29dc15[_0x5432('0x2c')]}))||'';}exports[_0x5432('0x2d')]=function(_0x345b51,_0x4e92d5){var _0x31490c={},_0x1d436c={},_0x214ed3={'count':0x0,'rows':[]};var _0x1d2fd4=_[_0x5432('0x2e')](db[_0x5432('0x2f')][_0x5432('0x30')],function(_0x444178){return{'name':_0x444178[_0x5432('0x31')],'type':_0x444178['type']['key']};});_0x1d436c[_0x5432('0x32')]=_[_0x5432('0x2e')](_0x1d2fd4,_0x5432('0x28'));_0x1d436c[_0x5432('0x33')]=_[_0x5432('0x34')](_0x345b51['query']);_0x1d436c[_0x5432('0x35')]=_['intersection'](_0x1d436c[_0x5432('0x32')],_0x1d436c[_0x5432('0x33')]);_0x31490c[_0x5432('0x36')]=_[_0x5432('0x37')](_0x1d436c[_0x5432('0x32')],qs[_0x5432('0x38')](_0x345b51['query'][_0x5432('0x38')]));_0x31490c[_0x5432('0x36')]=_0x31490c[_0x5432('0x36')][_0x5432('0x39')]?_0x31490c['attributes']:_0x1d436c[_0x5432('0x32')];if(!_0x345b51[_0x5432('0x33')][_0x5432('0x3a')](_0x5432('0x3b'))){_0x31490c[_0x5432('0x1e')]=qs[_0x5432('0x1e')](_0x345b51[_0x5432('0x33')][_0x5432('0x1e')]);_0x31490c[_0x5432('0x1d')]=qs[_0x5432('0x1d')](_0x345b51[_0x5432('0x33')][_0x5432('0x1d')]);}_0x31490c[_0x5432('0x3c')]=qs[_0x5432('0x3d')](_0x345b51['query'][_0x5432('0x3d')]);_0x31490c['where']=qs[_0x5432('0x35')](_[_0x5432('0x3e')](_0x345b51[_0x5432('0x33')],_0x1d436c[_0x5432('0x35')]),_0x1d2fd4);if(_0x345b51['query']['filter']){_0x31490c['where']=_[_0x5432('0x3f')](_0x31490c[_0x5432('0x40')],{'$or':_[_0x5432('0x2e')](_0x1d2fd4,function(_0x39c9c0){if(_0x39c9c0['type']!==_0x5432('0x41')){var _0x183d92={};_0x183d92[_0x39c9c0[_0x5432('0x28')]]={'$like':'%'+_0x345b51['query'][_0x5432('0x42')]+'%'};return _0x183d92;}})});}_0x31490c=_[_0x5432('0x3f')]({},_0x31490c,_0x345b51['options']);var _0x3eb446={'where':_0x31490c[_0x5432('0x40')]};return db['ChatOfflineMessage'][_0x5432('0x1c')](_0x3eb446)['then'](function(_0x2f1a51){_0x214ed3[_0x5432('0x1c')]=_0x2f1a51;if(_0x345b51[_0x5432('0x33')][_0x5432('0x43')]){_0x31490c['include']=[{'all':!![]}];}return db[_0x5432('0x2f')]['findAll'](_0x31490c);})[_0x5432('0x24')](function(_0x15f18d){_0x214ed3[_0x5432('0x44')]=_0x15f18d;return _0x214ed3;})[_0x5432('0x24')](respondWithFilteredResult(_0x4e92d5,_0x31490c))[_0x5432('0x45')](handleError(_0x4e92d5,null));};exports[_0x5432('0x46')]=function(_0x2234da,_0x4ab024){var _0x31fca4={'raw':!![],'where':{'id':_0x2234da[_0x5432('0x47')]['id']}},_0x534d47={};_0x534d47[_0x5432('0x32')]=_[_0x5432('0x34')](db[_0x5432('0x2f')][_0x5432('0x30')]);_0x534d47['query']=_[_0x5432('0x34')](_0x2234da[_0x5432('0x33')]);_0x534d47[_0x5432('0x35')]=_[_0x5432('0x37')](_0x534d47[_0x5432('0x32')],_0x534d47['query']);_0x31fca4[_0x5432('0x36')]=_['intersection'](_0x534d47[_0x5432('0x32')],qs[_0x5432('0x38')](_0x2234da['query'][_0x5432('0x38')]));_0x31fca4['attributes']=_0x31fca4[_0x5432('0x36')][_0x5432('0x39')]?_0x31fca4['attributes']:_0x534d47['model'];if(_0x2234da[_0x5432('0x33')][_0x5432('0x43')]){_0x31fca4[_0x5432('0x48')]=[{'all':!![]}];}_0x31fca4=_[_0x5432('0x3f')]({},_0x31fca4,_0x2234da[_0x5432('0x49')]);return db[_0x5432('0x2f')][_0x5432('0x4a')](_0x31fca4)['then'](handleEntityNotFound(_0x4ab024,null))[_0x5432('0x24')](respondWithResult(_0x4ab024,null))[_0x5432('0x45')](handleError(_0x4ab024,null));};exports[_0x5432('0x4b')]=function(_0x5b1355,_0x5ca992){return db['ChatOfflineMessage']['create'](_0x5b1355[_0x5432('0x2a')],{})[_0x5432('0x24')](respondWithResult(_0x5ca992,0xc9))[_0x5432('0x45')](handleError(_0x5ca992,null));};exports[_0x5432('0x23')]=function(_0x1beefd,_0x4bc716){if(_0x1beefd[_0x5432('0x2a')]['id']){delete _0x1beefd[_0x5432('0x2a')]['id'];}return db[_0x5432('0x2f')]['find']({'where':{'id':_0x1beefd[_0x5432('0x47')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x4bc716,null))[_0x5432('0x24')](saveUpdates(_0x1beefd[_0x5432('0x2a')],null))[_0x5432('0x24')](respondWithResult(_0x4bc716,null))['catch'](handleError(_0x4bc716,null));};exports[_0x5432('0x25')]=function(_0x5bbedb,_0x2fd527){return db['Attachment'][_0x5432('0x4c')]({'where':{'ChatOfflineMessageId':_0x5bbedb[_0x5432('0x47')]['id']},'raw':!![]})['then'](function(_0x7129e2){_0x7129e2['forEach'](function(_0x18fd03){var _0x2234fe=path[_0x5432('0x4d')](config[_0x5432('0x4e')],'server',_0x5432('0x4f'),'attachments',_0x5432('0x50'),_0x18fd03['basename']);var _0x1c5c5c=fs[_0x5432('0x51')](_0x2234fe);if(_0x1c5c5c)fs_extra[_0x5432('0x52')](_0x2234fe);});})[_0x5432('0x24')](function(){return db[_0x5432('0x2f')][_0x5432('0x4a')]({'where':{'id':_0x5bbedb[_0x5432('0x47')]['id']},'individualHooks':!![]});})[_0x5432('0x24')](handleEntityNotFound(_0x2fd527,null))[_0x5432('0x24')](removeEntity(_0x2fd527,null))[_0x5432('0x45')](handleError(_0x2fd527,null));};exports['describe']=function(_0x3d4afd,_0xb489e8){return db['ChatOfflineMessage'][_0x5432('0x53')]()[_0x5432('0x24')](respondWithResult(_0xb489e8,null))[_0x5432('0x45')](handleError(_0xb489e8,null));}; \ No newline at end of file +var _0x6cb4=['forEach','join','root','attachments','offline-chat','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','render','merge','body','contact','agent','interaction','map','ChatOfflineMessage','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','include','findAll','catch','params','options','find','create','destroy'];(function(_0x5be800,_0x38b91a){var _0x259163=function(_0x592ee3){while(--_0x592ee3){_0x5be800['push'](_0x5be800['shift']());}};_0x259163(++_0x38b91a);}(_0x6cb4,0xff));var _0x46cb=function(_0x10f2b3,_0x57cd20){_0x10f2b3=_0x10f2b3-0x0;var _0x1767a5=_0x6cb4[_0x10f2b3];return _0x1767a5;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];function respondWithStatusCode(_0x323ac2,_0x1058a8){_0x1058a8=_0x1058a8||0xcc;return function(_0xf22158){if(_0xf22158){return _0x323ac2['sendStatus'](_0x1058a8);}return _0x323ac2[_0x46cb('0x18')](_0x1058a8)[_0x46cb('0x19')]();};}function respondWithResult(_0x2a1f9d,_0x3c0071){_0x3c0071=_0x3c0071||0xc8;return function(_0x1f7150){if(_0x1f7150){return _0x2a1f9d[_0x46cb('0x18')](_0x3c0071)[_0x46cb('0x1a')](_0x1f7150);}};}function respondWithFilteredResult(_0x3c396b,_0x37d368){return function(_0x41e398){if(_0x41e398){var _0x136215=typeof _0x37d368['offset']===_0x46cb('0x1b')&&typeof _0x37d368['limit']===_0x46cb('0x1b');var _0x4ab22b=_0x41e398['count'];var _0x4e3454=_0x136215?0x0:_0x37d368[_0x46cb('0x1c')];var _0x1f2891=_0x136215?_0x41e398[_0x46cb('0x1d')]:_0x37d368[_0x46cb('0x1c')]+_0x37d368[_0x46cb('0x1e')];var _0x26e38d;if(_0x1f2891>=_0x4ab22b){_0x1f2891=_0x4ab22b;_0x26e38d=0xc8;}else{_0x26e38d=0xce;}_0x3c396b[_0x46cb('0x18')](_0x26e38d);return _0x3c396b[_0x46cb('0x1f')](_0x46cb('0x20'),_0x4e3454+'-'+_0x1f2891+'/'+_0x4ab22b)[_0x46cb('0x1a')](_0x41e398);}return null;};}function patchUpdates(_0x149483){return function(_0x46e541){try{jsonpatch[_0x46cb('0x21')](_0x46e541,_0x149483,!![]);}catch(_0x2f438b){return BPromise[_0x46cb('0x22')](_0x2f438b);}return _0x46e541[_0x46cb('0x23')]();};}function saveUpdates(_0x7084b2,_0x1fb467){return function(_0x41ecd2){if(_0x41ecd2){return _0x41ecd2[_0x46cb('0x24')](_0x7084b2)[_0x46cb('0x25')](function(_0x1e9e38){return _0x1e9e38;});}return null;};}function removeEntity(_0x309e4b,_0xadcad6){return function(_0x40e0e5){if(_0x40e0e5){return _0x40e0e5['destroy']()['then'](function(){_0x309e4b[_0x46cb('0x18')](0xcc)[_0x46cb('0x19')]();});}};}function handleEntityNotFound(_0x2711ac,_0xe078a8){return function(_0x6e6d9){if(!_0x6e6d9){_0x2711ac['sendStatus'](0x194);}return _0x6e6d9;};}function handleError(_0xc5a9a4,_0x578ffd){_0x578ffd=_0x578ffd||0x1f4;return function(_0x495886){logger['error'](_0x495886[_0x46cb('0x26')]);if(_0x495886[_0x46cb('0x27')]){delete _0x495886[_0x46cb('0x27')];}_0xc5a9a4[_0x46cb('0x18')](_0x578ffd)[_0x46cb('0x28')](_0x495886);};}function getMustacheRender(_0x33218b,_0x378dc7){return Mustache[_0x46cb('0x29')](_0x33218b,_[_0x46cb('0x2a')](_0x378dc7[_0x46cb('0x2b')],{'contact':_0x378dc7[_0x46cb('0x2c')],'message':_0x378dc7['message'],'agent':_0x378dc7[_0x46cb('0x2d')],'interaction':_0x378dc7[_0x46cb('0x2e')],'account':_0x378dc7['account']}))||'';}exports['index']=function(_0x15f5cf,_0x5cbb22){var _0x27c22d={},_0x6f7953={},_0xe7c112={'count':0x0,'rows':[]};var _0xd96713=_[_0x46cb('0x2f')](db[_0x46cb('0x30')]['rawAttributes'],function(_0x2e2d36){return{'name':_0x2e2d36['fieldName'],'type':_0x2e2d36[_0x46cb('0x31')][_0x46cb('0x32')]};});_0x6f7953['model']=_[_0x46cb('0x2f')](_0xd96713,_0x46cb('0x27'));_0x6f7953[_0x46cb('0x33')]=_[_0x46cb('0x34')](_0x15f5cf[_0x46cb('0x33')]);_0x6f7953['filters']=_[_0x46cb('0x35')](_0x6f7953['model'],_0x6f7953[_0x46cb('0x33')]);_0x27c22d[_0x46cb('0x36')]=_[_0x46cb('0x35')](_0x6f7953['model'],qs[_0x46cb('0x37')](_0x15f5cf[_0x46cb('0x33')]['fields']));_0x27c22d[_0x46cb('0x36')]=_0x27c22d[_0x46cb('0x36')][_0x46cb('0x38')]?_0x27c22d[_0x46cb('0x36')]:_0x6f7953[_0x46cb('0x39')];if(!_0x15f5cf[_0x46cb('0x33')][_0x46cb('0x3a')](_0x46cb('0x3b'))){_0x27c22d[_0x46cb('0x1e')]=qs[_0x46cb('0x1e')](_0x15f5cf[_0x46cb('0x33')]['limit']);_0x27c22d['offset']=qs['offset'](_0x15f5cf[_0x46cb('0x33')][_0x46cb('0x1c')]);}_0x27c22d[_0x46cb('0x3c')]=qs[_0x46cb('0x3d')](_0x15f5cf[_0x46cb('0x33')][_0x46cb('0x3d')]);_0x27c22d['where']=qs[_0x46cb('0x3e')](_['pick'](_0x15f5cf['query'],_0x6f7953[_0x46cb('0x3e')]),_0xd96713);if(_0x15f5cf['query']['filter']){_0x27c22d[_0x46cb('0x3f')]=_['merge'](_0x27c22d['where'],{'$or':_[_0x46cb('0x2f')](_0xd96713,function(_0x10017d){if(_0x10017d[_0x46cb('0x31')]!==_0x46cb('0x40')){var _0x300aeb={};_0x300aeb[_0x10017d[_0x46cb('0x27')]]={'$like':'%'+_0x15f5cf[_0x46cb('0x33')]['filter']+'%'};return _0x300aeb;}})});}_0x27c22d=_[_0x46cb('0x2a')]({},_0x27c22d,_0x15f5cf['options']);var _0x391a6b={'where':_0x27c22d['where']};return db[_0x46cb('0x30')][_0x46cb('0x1d')](_0x391a6b)[_0x46cb('0x25')](function(_0x577a34){_0xe7c112[_0x46cb('0x1d')]=_0x577a34;if(_0x15f5cf[_0x46cb('0x33')]['includeAll']){_0x27c22d[_0x46cb('0x41')]=[{'all':!![]}];}return db[_0x46cb('0x30')][_0x46cb('0x42')](_0x27c22d);})[_0x46cb('0x25')](function(_0x34fbdd){_0xe7c112['rows']=_0x34fbdd;return _0xe7c112;})['then'](respondWithFilteredResult(_0x5cbb22,_0x27c22d))[_0x46cb('0x43')](handleError(_0x5cbb22,null));};exports['show']=function(_0x1a9959,_0x41f76c){var _0x563e9b={'raw':!![],'where':{'id':_0x1a9959[_0x46cb('0x44')]['id']}},_0x3232d7={};_0x3232d7[_0x46cb('0x39')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x3232d7['query']=_[_0x46cb('0x34')](_0x1a9959[_0x46cb('0x33')]);_0x3232d7[_0x46cb('0x3e')]=_[_0x46cb('0x35')](_0x3232d7[_0x46cb('0x39')],_0x3232d7['query']);_0x563e9b['attributes']=_[_0x46cb('0x35')](_0x3232d7[_0x46cb('0x39')],qs['fields'](_0x1a9959[_0x46cb('0x33')][_0x46cb('0x37')]));_0x563e9b[_0x46cb('0x36')]=_0x563e9b[_0x46cb('0x36')][_0x46cb('0x38')]?_0x563e9b[_0x46cb('0x36')]:_0x3232d7[_0x46cb('0x39')];if(_0x1a9959['query']['includeAll']){_0x563e9b[_0x46cb('0x41')]=[{'all':!![]}];}_0x563e9b=_['merge']({},_0x563e9b,_0x1a9959[_0x46cb('0x45')]);return db[_0x46cb('0x30')][_0x46cb('0x46')](_0x563e9b)['then'](handleEntityNotFound(_0x41f76c,null))[_0x46cb('0x25')](respondWithResult(_0x41f76c,null))['catch'](handleError(_0x41f76c,null));};exports['create']=function(_0x16c500,_0x811912){return db[_0x46cb('0x30')][_0x46cb('0x47')](_0x16c500[_0x46cb('0x2b')],{})[_0x46cb('0x25')](respondWithResult(_0x811912,0xc9))[_0x46cb('0x43')](handleError(_0x811912,null));};exports['update']=function(_0x546a98,_0x40aff3){if(_0x546a98[_0x46cb('0x2b')]['id']){delete _0x546a98['body']['id'];}return db[_0x46cb('0x30')][_0x46cb('0x46')]({'where':{'id':_0x546a98[_0x46cb('0x44')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x40aff3,null))[_0x46cb('0x25')](saveUpdates(_0x546a98['body'],null))[_0x46cb('0x25')](respondWithResult(_0x40aff3,null))[_0x46cb('0x43')](handleError(_0x40aff3,null));};exports[_0x46cb('0x48')]=function(_0x52d1a7,_0x1f5c71){return db['Attachment']['findAll']({'where':{'ChatOfflineMessageId':_0x52d1a7[_0x46cb('0x44')]['id']},'raw':!![]})[_0x46cb('0x25')](function(_0x2fe0b1){_0x2fe0b1[_0x46cb('0x49')](function(_0x2848b8){var _0x4d2a39=path[_0x46cb('0x4a')](config[_0x46cb('0x4b')],'server','files',_0x46cb('0x4c'),_0x46cb('0x4d'),_0x2848b8[_0x46cb('0x4e')]);var _0x5c2190=fs[_0x46cb('0x4f')](_0x4d2a39);if(_0x5c2190)fs_extra[_0x46cb('0x50')](_0x4d2a39);});})[_0x46cb('0x25')](function(){return db[_0x46cb('0x30')][_0x46cb('0x46')]({'where':{'id':_0x52d1a7[_0x46cb('0x44')]['id']},'individualHooks':!![]});})[_0x46cb('0x25')](handleEntityNotFound(_0x1f5c71,null))[_0x46cb('0x25')](removeEntity(_0x1f5c71,null))[_0x46cb('0x43')](handleError(_0x1f5c71,null));};exports['describe']=function(_0x23f673,_0x5470b0){return db[_0x46cb('0x30')][_0x46cb('0x51')]()[_0x46cb('0x25')](respondWithResult(_0x5470b0,null))[_0x46cb('0x43')](handleError(_0x5470b0,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 093268d..e803cfc 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fd1=['exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x5fd1,0x155));var _0x15fd=function(_0x35d033,_0xf6140c){_0x35d033=_0x35d033-0x0;var _0x257ed1=_0x5fd1[_0x35d033];return _0x257ed1;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./chatOfflineMessage.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x15fd('0xa'),'collate':_0x15fd('0xb')});}; \ No newline at end of file +var _0x6737=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6737,0xe2));var _0x7673=function(_0x2a3c08,_0x221944){_0x2a3c08=_0x2a3c08-0x0;var _0x14e56f=_0x6737[_0x2a3c08];return _0x14e56f;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));module['exports']=function(_0x2f5edc,_0x15230f){return _0x2f5edc['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7673('0x8')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 9640e07..f948bff 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7ab=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3a6204,_0xc3d4d2){var _0x2f425d=function(_0x479c57){while(--_0x479c57){_0x3a6204['push'](_0x3a6204['shift']());}};_0x2f425d(++_0xc3d4d2);}(_0xa7ab,0x119));var _0xba7a=function(_0x3221cf,_0x58f4ec){_0x3221cf=_0x3221cf-0x0;var _0x2dd1da=_0xa7ab[_0x3221cf];return _0x2dd1da;};'use strict';var _=require(_0xba7a('0x0'));var util=require('util');var moment=require(_0xba7a('0x1'));var BPromise=require(_0xba7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba7a('0x3'));var db=require(_0xba7a('0x4'))['db'];var utils=require(_0xba7a('0x5'));var logger=require(_0xba7a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xba7a('0x7'));var client=jayson['client'][_0xba7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1da4cc,_0x911702,_0x2406fd){return new BPromise(function(_0x327daf,_0x29aa1f){return client['request'](_0x1da4cc,_0x2406fd)[_0xba7a('0x9')](function(_0x252970){logger['info'](_0xba7a('0xa'),_0x911702,_0xba7a('0xb'));logger[_0xba7a('0xc')](_0xba7a('0xd'),_0x911702,_0xba7a('0xb'),JSON[_0xba7a('0xe')](_0x252970));if(_0x252970[_0xba7a('0xf')]){if(_0x252970[_0xba7a('0xf')][_0xba7a('0x10')]===0x1f4){logger[_0xba7a('0xf')](_0xba7a('0xa'),_0x911702,_0x252970[_0xba7a('0xf')][_0xba7a('0x11')]);return _0x29aa1f(_0x252970[_0xba7a('0xf')][_0xba7a('0x11')]);}logger[_0xba7a('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x911702,_0x252970['error'][_0xba7a('0x11')]);return _0x327daf(_0x252970[_0xba7a('0xf')]['message']);}else{logger[_0xba7a('0x12')](_0xba7a('0xa'),_0x911702,_0xba7a('0xb'));_0x327daf(_0x252970[_0xba7a('0x13')][_0xba7a('0x11')]);}})[_0xba7a('0x14')](function(_0x45350f){logger[_0xba7a('0xf')](_0xba7a('0xa'),_0x911702,_0x45350f);_0x29aa1f(_0x45350f);});});} \ No newline at end of file +var _0xb87d=['rpc','../../config/environment','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger'];(function(_0x5acd51,_0x3bdd9e){var _0x2e8cfb=function(_0x1ab73a){while(--_0x1ab73a){_0x5acd51['push'](_0x5acd51['shift']());}};_0x2e8cfb(++_0x3bdd9e);}(_0xb87d,0x120));var _0xdb87=function(_0x547137,_0x59c665){_0x547137=_0x547137-0x0;var _0x355a43=_0xb87d[_0x547137];return _0x355a43;};'use strict';var _=require(_0xdb87('0x0'));var util=require(_0xdb87('0x1'));var moment=require(_0xdb87('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb87('0x3'));var fs=require('fs');var Redis=require(_0xdb87('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb87('0x5'))(_0xdb87('0x6'));var config=require(_0xdb87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdb87('0x8')][_0xdb87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33363c,_0x143769,_0x298848){return new BPromise(function(_0x54ca2a,_0x544ae5){return client['request'](_0x33363c,_0x298848)[_0xdb87('0xa')](function(_0x590c1e){logger[_0xdb87('0xb')](_0xdb87('0xc'),_0x143769,'request\x20sent');logger[_0xdb87('0xd')](_0xdb87('0xe'),_0x143769,_0xdb87('0xf'),JSON[_0xdb87('0x10')](_0x590c1e));if(_0x590c1e[_0xdb87('0x11')]){if(_0x590c1e[_0xdb87('0x11')]['code']===0x1f4){logger[_0xdb87('0x11')](_0xdb87('0xc'),_0x143769,_0x590c1e['error'][_0xdb87('0x12')]);return _0x544ae5(_0x590c1e[_0xdb87('0x11')][_0xdb87('0x12')]);}logger['error'](_0xdb87('0xc'),_0x143769,_0x590c1e[_0xdb87('0x11')][_0xdb87('0x12')]);return _0x54ca2a(_0x590c1e[_0xdb87('0x11')][_0xdb87('0x12')]);}else{logger[_0xdb87('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x143769,_0xdb87('0xf'));_0x54ca2a(_0x590c1e[_0xdb87('0x13')][_0xdb87('0x12')]);}})[_0xdb87('0x14')](function(_0x8d7939){logger['error'](_0xdb87('0xc'),_0x143769,_0x8d7939);_0x544ae5(_0x8d7939);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 66ff445..c7c14f1 100644 --- a/server/api/chatOfflineMessage/index.js +++ b/server/api/chatOfflineMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a28=['isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x83c716,_0x25152d){var _0xab9893=function(_0x9b3f0a){while(--_0x9b3f0a){_0x83c716['push'](_0x83c716['shift']());}};_0xab9893(++_0x25152d);}(_0x1a28,0x146));var _0x81a2=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x1a28[_0x16db8b];return _0x5ba017;};'use strict';var multer=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var path=require('path');var timeout=require(_0x81a2('0x2'));var express=require(_0x81a2('0x3'));var router=express[_0x81a2('0x4')]();var fs_extra=require(_0x81a2('0x5'));var auth=require(_0x81a2('0x6'));var interaction=require(_0x81a2('0x7'));var config=require(_0x81a2('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0x81a2('0x9')]('/',auth[_0x81a2('0xa')](),controller[_0x81a2('0xb')]);router[_0x81a2('0x9')](_0x81a2('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x81a2('0x9')](_0x81a2('0xd'),auth[_0x81a2('0xa')](),controller[_0x81a2('0xe')]);router['post']('/',auth[_0x81a2('0xa')](),controller[_0x81a2('0xf')]);router[_0x81a2('0x10')](_0x81a2('0xd'),auth['isAuthenticated'](),controller[_0x81a2('0x11')]);router[_0x81a2('0x12')](_0x81a2('0xd'),auth[_0x81a2('0xa')](),controller[_0x81a2('0x13')]);module[_0x81a2('0x14')]=router; \ No newline at end of file +var _0xce36=['util','path','connect-timeout','express','Router','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x4ed18b,_0x15dc31){var _0x34a1d3=function(_0xb0bacd){while(--_0xb0bacd){_0x4ed18b['push'](_0x4ed18b['shift']());}};_0x34a1d3(++_0x15dc31);}(_0xce36,0x9f));var _0x6ce3=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0xce36[_0x547ff4];return _0xe41057;};'use strict';var multer=require(_0x6ce3('0x0'));var util=require(_0x6ce3('0x1'));var path=require(_0x6ce3('0x2'));var timeout=require(_0x6ce3('0x3'));var express=require(_0x6ce3('0x4'));var router=express[_0x6ce3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6ce3('0x6'));var config=require('../../config/environment');var controller=require(_0x6ce3('0x7'));router[_0x6ce3('0x8')]('/',auth[_0x6ce3('0x9')](),controller[_0x6ce3('0xa')]);router[_0x6ce3('0x8')]('/describe',auth[_0x6ce3('0x9')](),controller[_0x6ce3('0xb')]);router['get'](_0x6ce3('0xc'),auth[_0x6ce3('0x9')](),controller[_0x6ce3('0xd')]);router[_0x6ce3('0xe')]('/',auth[_0x6ce3('0x9')](),controller[_0x6ce3('0xf')]);router[_0x6ce3('0x10')](_0x6ce3('0xc'),auth[_0x6ce3('0x9')](),controller[_0x6ce3('0x11')]);router[_0x6ce3('0x12')](_0x6ce3('0xc'),auth[_0x6ce3('0x9')](),controller['destroy']);module[_0x6ce3('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2a875ae..28a6d04 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js +++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7162=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7162,0xb3));var _0x2716=function(_0x444cbb,_0x2e4600){_0x444cbb=_0x444cbb-0x0;var _0x48237c=_0x7162[_0x444cbb];return _0x48237c;};'use strict';var Sequelize=require(_0x2716('0x0'));module[_0x2716('0x1')]={'name':{'type':Sequelize[_0x2716('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2716('0x3'),_0x2716('0x4')),'defaultValue':_0x2716('0x3')},'selector':{'type':Sequelize[_0x2716('0x2')]},'timeout':{'type':Sequelize[_0x2716('0x5')]}}; \ No newline at end of file +var _0x3cbe=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x4114d9,_0x203314){var _0x164727=function(_0x187ce5){while(--_0x187ce5){_0x4114d9['push'](_0x4114d9['shift']());}};_0x164727(++_0x203314);}(_0x3cbe,0xa4));var _0xe3cb=function(_0x4ded16,_0x23fcbf){_0x4ded16=_0x4ded16-0x0;var _0x4a525a=_0x3cbe[_0x4ded16];return _0x4a525a;};'use strict';var Sequelize=require(_0xe3cb('0x0'));module[_0xe3cb('0x1')]={'name':{'type':Sequelize[_0xe3cb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe3cb('0x3')](_0xe3cb('0x4'),_0xe3cb('0x5')),'defaultValue':_0xe3cb('0x4')},'selector':{'type':Sequelize[_0xe3cb('0x2')]},'timeout':{'type':Sequelize[_0xe3cb('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 98650e4..3c3941d 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b2d=['count','offset','limit','apply','reject','update','then','end','stack','name','send','render','merge','body','account','show','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','options','find','catch','create','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined'];(function(_0x45ae37,_0x3fbe69){var _0x2203f9=function(_0x374a11){while(--_0x374a11){_0x45ae37['push'](_0x45ae37['shift']());}};_0x2203f9(++_0x3fbe69);}(_0x3b2d,0xa1));var _0xd3b2=function(_0x394a82,_0x3f921a){_0x394a82=_0x394a82-0x0;var _0x592201=_0x3b2d[_0x394a82];return _0x592201;};'use strict';var emlformat=require(_0xd3b2('0x0'));var rimraf=require(_0xd3b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3b2('0x3'));var Mustache=require(_0xd3b2('0x4'));var util=require(_0xd3b2('0x5'));var path=require(_0xd3b2('0x6'));var sox=require(_0xd3b2('0x7'));var csv=require(_0xd3b2('0x8'));var ejs=require(_0xd3b2('0x9'));var fs=require('fs');var fs_extra=require(_0xd3b2('0xa'));var _=require(_0xd3b2('0xb'));var squel=require(_0xd3b2('0xc'));var crypto=require(_0xd3b2('0xd'));var jsforce=require(_0xd3b2('0xe'));var deskjs=require(_0xd3b2('0xf'));var toCsv=require(_0xd3b2('0x8'));var querystring=require(_0xd3b2('0x10'));var Papa=require(_0xd3b2('0x11'));var Redis=require(_0xd3b2('0x12'));var authService=require(_0xd3b2('0x13'));var qs=require(_0xd3b2('0x14'));var as=require(_0xd3b2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3b2('0x16'))(_0xd3b2('0x17'));var utils=require(_0xd3b2('0x18'));var config=require(_0xd3b2('0x19'));var licenseUtil=require(_0xd3b2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c6fc,_0x22e11a){_0x22e11a=_0x22e11a||0xcc;return function(_0x3ea71c){if(_0x3ea71c){return _0x25c6fc[_0xd3b2('0x1b')](_0x22e11a);}return _0x25c6fc['status'](_0x22e11a)['end']();};}function respondWithResult(_0x24f1d9,_0x3367c2){_0x3367c2=_0x3367c2||0xc8;return function(_0x5c1ff4){if(_0x5c1ff4){return _0x24f1d9[_0xd3b2('0x1c')](_0x3367c2)[_0xd3b2('0x1d')](_0x5c1ff4);}};}function respondWithFilteredResult(_0x419cdf,_0x581cfc){return function(_0x18dc60){if(_0x18dc60){var _0x2c1884=typeof _0x581cfc['offset']===_0xd3b2('0x1e')&&typeof _0x581cfc['limit']==='undefined';var _0x551336=_0x18dc60[_0xd3b2('0x1f')];var _0x1d2886=_0x2c1884?0x0:_0x581cfc[_0xd3b2('0x20')];var _0x29713c=_0x2c1884?_0x18dc60[_0xd3b2('0x1f')]:_0x581cfc[_0xd3b2('0x20')]+_0x581cfc[_0xd3b2('0x21')];var _0x134640;if(_0x29713c>=_0x551336){_0x29713c=_0x551336;_0x134640=0xc8;}else{_0x134640=0xce;}_0x419cdf[_0xd3b2('0x1c')](_0x134640);return _0x419cdf['set']('Content-Range',_0x1d2886+'-'+_0x29713c+'/'+_0x551336)[_0xd3b2('0x1d')](_0x18dc60);}return null;};}function patchUpdates(_0x47c492){return function(_0x372047){try{jsonpatch[_0xd3b2('0x22')](_0x372047,_0x47c492,!![]);}catch(_0x686245){return BPromise[_0xd3b2('0x23')](_0x686245);}return _0x372047['save']();};}function saveUpdates(_0x1c20f8,_0x33e428){return function(_0x29acd9){if(_0x29acd9){return _0x29acd9[_0xd3b2('0x24')](_0x1c20f8)['then'](function(_0x3a8e03){return _0x3a8e03;});}return null;};}function removeEntity(_0x3743b8,_0x2b607c){return function(_0x59a0c7){if(_0x59a0c7){return _0x59a0c7['destroy']()[_0xd3b2('0x25')](function(){_0x3743b8['status'](0xcc)[_0xd3b2('0x26')]();});}};}function handleEntityNotFound(_0x4292f0,_0x3ac31a){return function(_0x29ef8b){if(!_0x29ef8b){_0x4292f0[_0xd3b2('0x1b')](0x194);}return _0x29ef8b;};}function handleError(_0x81a168,_0x449fd4){_0x449fd4=_0x449fd4||0x1f4;return function(_0x3c5def){logger['error'](_0x3c5def[_0xd3b2('0x27')]);if(_0x3c5def[_0xd3b2('0x28')]){delete _0x3c5def[_0xd3b2('0x28')];}_0x81a168[_0xd3b2('0x1c')](_0x449fd4)[_0xd3b2('0x29')](_0x3c5def);};}function getMustacheRender(_0x1dd649,_0x104aa1){return Mustache[_0xd3b2('0x2a')](_0x1dd649,_[_0xd3b2('0x2b')](_0x104aa1[_0xd3b2('0x2c')],{'contact':_0x104aa1['contact'],'message':_0x104aa1['message'],'agent':_0x104aa1['agent'],'interaction':_0x104aa1['interaction'],'account':_0x104aa1[_0xd3b2('0x2d')]}))||'';}exports[_0xd3b2('0x2e')]=function(_0x23d44f,_0x5d446e){var _0x2303ea={'raw':!![],'where':{'id':_0x23d44f['params']['id']}},_0x56b437={};_0x56b437['model']=_['keys'](db[_0xd3b2('0x2f')][_0xd3b2('0x30')]);_0x56b437[_0xd3b2('0x31')]=_[_0xd3b2('0x32')](_0x23d44f[_0xd3b2('0x31')]);_0x56b437[_0xd3b2('0x33')]=_[_0xd3b2('0x34')](_0x56b437[_0xd3b2('0x35')],_0x56b437[_0xd3b2('0x31')]);_0x2303ea['attributes']=_[_0xd3b2('0x34')](_0x56b437['model'],qs[_0xd3b2('0x36')](_0x23d44f[_0xd3b2('0x31')]['fields']));_0x2303ea[_0xd3b2('0x37')]=_0x2303ea['attributes'][_0xd3b2('0x38')]?_0x2303ea[_0xd3b2('0x37')]:_0x56b437[_0xd3b2('0x35')];if(_0x23d44f[_0xd3b2('0x31')][_0xd3b2('0x39')]){_0x2303ea[_0xd3b2('0x3a')]=[{'all':!![]}];}_0x2303ea=_[_0xd3b2('0x2b')]({},_0x2303ea,_0x23d44f[_0xd3b2('0x3b')]);return db[_0xd3b2('0x2f')][_0xd3b2('0x3c')](_0x2303ea)[_0xd3b2('0x25')](handleEntityNotFound(_0x5d446e,null))[_0xd3b2('0x25')](respondWithResult(_0x5d446e,null))[_0xd3b2('0x3d')](handleError(_0x5d446e,null));};exports['create']=function(_0x25605d,_0x50d37b){return db[_0xd3b2('0x2f')][_0xd3b2('0x3e')](_0x25605d[_0xd3b2('0x2c')],{})[_0xd3b2('0x25')](respondWithResult(_0x50d37b,0xc9))[_0xd3b2('0x3d')](handleError(_0x50d37b,null));};exports['update']=function(_0x5c85f5,_0x4363a3){if(_0x5c85f5[_0xd3b2('0x2c')]['id']){delete _0x5c85f5[_0xd3b2('0x2c')]['id'];}return db[_0xd3b2('0x2f')][_0xd3b2('0x3c')]({'where':{'id':_0x5c85f5[_0xd3b2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4363a3,null))[_0xd3b2('0x25')](saveUpdates(_0x5c85f5['body'],null))[_0xd3b2('0x25')](respondWithResult(_0x4363a3,null))['catch'](handleError(_0x4363a3,null));};exports['destroy']=function(_0x557608,_0x4968c8){return db[_0xd3b2('0x2f')]['find']({'where':{'id':_0x557608[_0xd3b2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4968c8,null))[_0xd3b2('0x25')](removeEntity(_0x4968c8,null))[_0xd3b2('0x3d')](handleError(_0x4968c8,null));}; \ No newline at end of file +var _0xc316=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','render','merge','body','agent','interaction','account','show','params','model','keys','ChatProactiveAction','query','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','eml-format','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc316,0x19e));var _0x6c31=function(_0x5e2aaf,_0x5ee3e3){_0x5e2aaf=_0x5e2aaf-0x0;var _0x508383=_0xc316[_0x5e2aaf];return _0x508383;};'use strict';var emlformat=require(_0x6c31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c31('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c31('0x2'));var path=require(_0x6c31('0x3'));var sox=require(_0x6c31('0x4'));var csv=require(_0x6c31('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c31('0x6'));var _=require(_0x6c31('0x7'));var squel=require(_0x6c31('0x8'));var crypto=require(_0x6c31('0x9'));var jsforce=require(_0x6c31('0xa'));var deskjs=require(_0x6c31('0xb'));var toCsv=require(_0x6c31('0x5'));var querystring=require(_0x6c31('0xc'));var Papa=require(_0x6c31('0xd'));var Redis=require(_0x6c31('0xe'));var authService=require(_0x6c31('0xf'));var qs=require(_0x6c31('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c31('0x11'));var logger=require(_0x6c31('0x12'))(_0x6c31('0x13'));var utils=require(_0x6c31('0x14'));var config=require(_0x6c31('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c31('0x16'))['db'];function respondWithStatusCode(_0x49b673,_0x3b7ce6){_0x3b7ce6=_0x3b7ce6||0xcc;return function(_0x3f6263){if(_0x3f6263){return _0x49b673['sendStatus'](_0x3b7ce6);}return _0x49b673['status'](_0x3b7ce6)['end']();};}function respondWithResult(_0x34f03a,_0x1c78ef){_0x1c78ef=_0x1c78ef||0xc8;return function(_0x100b6e){if(_0x100b6e){return _0x34f03a[_0x6c31('0x17')](_0x1c78ef)[_0x6c31('0x18')](_0x100b6e);}};}function respondWithFilteredResult(_0x594712,_0x52e8c3){return function(_0x40d795){if(_0x40d795){var _0x2bdf28=typeof _0x52e8c3[_0x6c31('0x19')]===_0x6c31('0x1a')&&typeof _0x52e8c3[_0x6c31('0x1b')]===_0x6c31('0x1a');var _0x2ccc5c=_0x40d795[_0x6c31('0x1c')];var _0x4f2dcb=_0x2bdf28?0x0:_0x52e8c3[_0x6c31('0x19')];var _0x132f89=_0x2bdf28?_0x40d795[_0x6c31('0x1c')]:_0x52e8c3[_0x6c31('0x19')]+_0x52e8c3[_0x6c31('0x1b')];var _0x5ef359;if(_0x132f89>=_0x2ccc5c){_0x132f89=_0x2ccc5c;_0x5ef359=0xc8;}else{_0x5ef359=0xce;}_0x594712[_0x6c31('0x17')](_0x5ef359);return _0x594712[_0x6c31('0x1d')](_0x6c31('0x1e'),_0x4f2dcb+'-'+_0x132f89+'/'+_0x2ccc5c)[_0x6c31('0x18')](_0x40d795);}return null;};}function patchUpdates(_0x20ea3f){return function(_0x4bf6e4){try{jsonpatch[_0x6c31('0x1f')](_0x4bf6e4,_0x20ea3f,!![]);}catch(_0x5c8427){return BPromise[_0x6c31('0x20')](_0x5c8427);}return _0x4bf6e4[_0x6c31('0x21')]();};}function saveUpdates(_0x1d7351,_0x3217fe){return function(_0x56f2cb){if(_0x56f2cb){return _0x56f2cb[_0x6c31('0x22')](_0x1d7351)[_0x6c31('0x23')](function(_0x3fdb1d){return _0x3fdb1d;});}return null;};}function removeEntity(_0x347139,_0xba822d){return function(_0x9a3537){if(_0x9a3537){return _0x9a3537[_0x6c31('0x24')]()[_0x6c31('0x23')](function(){_0x347139[_0x6c31('0x17')](0xcc)[_0x6c31('0x25')]();});}};}function handleEntityNotFound(_0x536070,_0x4f63c0){return function(_0x1dca65){if(!_0x1dca65){_0x536070['sendStatus'](0x194);}return _0x1dca65;};}function handleError(_0x51dc0f,_0x5ee2de){_0x5ee2de=_0x5ee2de||0x1f4;return function(_0x33405f){logger['error'](_0x33405f['stack']);if(_0x33405f[_0x6c31('0x26')]){delete _0x33405f[_0x6c31('0x26')];}_0x51dc0f[_0x6c31('0x17')](_0x5ee2de)['send'](_0x33405f);};}function getMustacheRender(_0x44631d,_0x195ef6){return Mustache[_0x6c31('0x27')](_0x44631d,_[_0x6c31('0x28')](_0x195ef6[_0x6c31('0x29')],{'contact':_0x195ef6['contact'],'message':_0x195ef6['message'],'agent':_0x195ef6[_0x6c31('0x2a')],'interaction':_0x195ef6[_0x6c31('0x2b')],'account':_0x195ef6[_0x6c31('0x2c')]}))||'';}exports[_0x6c31('0x2d')]=function(_0xe984bc,_0x3ad6a0){var _0x1c35c8={'raw':!![],'where':{'id':_0xe984bc[_0x6c31('0x2e')]['id']}},_0x4f5418={};_0x4f5418[_0x6c31('0x2f')]=_[_0x6c31('0x30')](db[_0x6c31('0x31')]['rawAttributes']);_0x4f5418[_0x6c31('0x32')]=_['keys'](_0xe984bc[_0x6c31('0x32')]);_0x4f5418['filters']=_[_0x6c31('0x33')](_0x4f5418[_0x6c31('0x2f')],_0x4f5418[_0x6c31('0x32')]);_0x1c35c8[_0x6c31('0x34')]=_[_0x6c31('0x33')](_0x4f5418['model'],qs[_0x6c31('0x35')](_0xe984bc[_0x6c31('0x32')][_0x6c31('0x35')]));_0x1c35c8[_0x6c31('0x34')]=_0x1c35c8[_0x6c31('0x34')][_0x6c31('0x36')]?_0x1c35c8[_0x6c31('0x34')]:_0x4f5418[_0x6c31('0x2f')];if(_0xe984bc[_0x6c31('0x32')][_0x6c31('0x37')]){_0x1c35c8[_0x6c31('0x38')]=[{'all':!![]}];}_0x1c35c8=_['merge']({},_0x1c35c8,_0xe984bc[_0x6c31('0x39')]);return db[_0x6c31('0x31')][_0x6c31('0x3a')](_0x1c35c8)[_0x6c31('0x23')](handleEntityNotFound(_0x3ad6a0,null))[_0x6c31('0x23')](respondWithResult(_0x3ad6a0,null))[_0x6c31('0x3b')](handleError(_0x3ad6a0,null));};exports[_0x6c31('0x3c')]=function(_0x4490a8,_0x7386fe){return db[_0x6c31('0x31')]['create'](_0x4490a8[_0x6c31('0x29')],{})[_0x6c31('0x23')](respondWithResult(_0x7386fe,0xc9))['catch'](handleError(_0x7386fe,null));};exports[_0x6c31('0x22')]=function(_0x3aec8b,_0x3368c5){if(_0x3aec8b[_0x6c31('0x29')]['id']){delete _0x3aec8b[_0x6c31('0x29')]['id'];}return db[_0x6c31('0x31')][_0x6c31('0x3a')]({'where':{'id':_0x3aec8b['params']['id']}})[_0x6c31('0x23')](handleEntityNotFound(_0x3368c5,null))[_0x6c31('0x23')](saveUpdates(_0x3aec8b[_0x6c31('0x29')],null))['then'](respondWithResult(_0x3368c5,null))[_0x6c31('0x3b')](handleError(_0x3368c5,null));};exports[_0x6c31('0x24')]=function(_0x160c9d,_0x1f5a77){return db[_0x6c31('0x31')][_0x6c31('0x3a')]({'where':{'id':_0x160c9d[_0x6c31('0x2e')]['id']}})[_0x6c31('0x23')](handleEntityNotFound(_0x1f5a77,null))[_0x6c31('0x23')](removeEntity(_0x1f5a77,null))[_0x6c31('0x3b')](handleError(_0x1f5a77,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 339a693..1dd2f9c 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.model.js +++ b/server/api/chatProactiveAction/chatProactiveAction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc09=['moment','request-promise','path','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','api'];(function(_0x583d0c,_0x2f141c){var _0x35b1d3=function(_0x29c529){while(--_0x29c529){_0x583d0c['push'](_0x583d0c['shift']());}};_0x35b1d3(++_0x2f141c);}(_0xdc09,0x80));var _0x9dc0=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0xdc09[_0x234318];return _0x1ab719;};'use strict';var _=require(_0x9dc0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9dc0('0x1'));var moment=require(_0x9dc0('0x2'));var BPromise=require('bluebird');var rp=require(_0x9dc0('0x3'));var fs=require('fs');var path=require(_0x9dc0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9dc0('0x5'));module[_0x9dc0('0x6')]=function(_0x1a843b,_0x3ab47e){return _0x1a843b[_0x9dc0('0x7')](_0x9dc0('0x8'),attributes,{'tableName':_0x9dc0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb752=['define','chat_proactive_actions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x184e56,_0x26b26b){var _0x30c13e=function(_0x41e907){while(--_0x41e907){_0x184e56['push'](_0x184e56['shift']());}};_0x30c13e(++_0x26b26b);}(_0xb752,0x176));var _0x2b75=function(_0x1f8be5,_0x5ea1b8){_0x1f8be5=_0x1f8be5-0x0;var _0x41843c=_0xb752[_0x1f8be5];return _0x41843c;};'use strict';var _=require('lodash');var util=require(_0x2b75('0x0'));var logger=require(_0x2b75('0x1'))(_0x2b75('0x2'));var moment=require(_0x2b75('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b75('0x4'));var fs=require('fs');var path=require(_0x2b75('0x5'));var rimraf=require(_0x2b75('0x6'));var config=require(_0x2b75('0x7'));var attributes=require(_0x2b75('0x8'));module[_0x2b75('0x9')]=function(_0x4dcfc1,_0x32b693){return _0x4dcfc1[_0x2b75('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x2b75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index af60870..9dd42b9 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.rpc.js +++ b/server/api/chatProactiveAction/chatProactiveAction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cb4=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x0cb4,0x11d));var _0x40cb=function(_0x1ee909,_0xed48b4){_0x1ee909=_0x1ee909-0x0;var _0x2e5e9a=_0x0cb4[_0x1ee909];return _0x2e5e9a;};'use strict';var _=require(_0x40cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40cb('0x1'));var rs=require(_0x40cb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40cb('0x3'))['db'];var utils=require(_0x40cb('0x4'));var logger=require(_0x40cb('0x5'))(_0x40cb('0x6'));var config=require('../../config/environment');var jayson=require(_0x40cb('0x7'));var client=jayson[_0x40cb('0x8')][_0x40cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21841d,_0x249c35,_0x2e6638){return new BPromise(function(_0x497107,_0x432d44){return client[_0x40cb('0xa')](_0x21841d,_0x2e6638)[_0x40cb('0xb')](function(_0x583f74){logger[_0x40cb('0xc')](_0x40cb('0xd'),_0x249c35,'request\x20sent');logger[_0x40cb('0xe')](_0x40cb('0xf'),_0x249c35,_0x40cb('0x10'),JSON[_0x40cb('0x11')](_0x583f74));if(_0x583f74[_0x40cb('0x12')]){if(_0x583f74[_0x40cb('0x12')][_0x40cb('0x13')]===0x1f4){logger[_0x40cb('0x12')](_0x40cb('0xd'),_0x249c35,_0x583f74[_0x40cb('0x12')]['message']);return _0x432d44(_0x583f74['error'][_0x40cb('0x14')]);}logger[_0x40cb('0x12')](_0x40cb('0xd'),_0x249c35,_0x583f74['error'][_0x40cb('0x14')]);return _0x497107(_0x583f74['error'][_0x40cb('0x14')]);}else{logger[_0x40cb('0xc')](_0x40cb('0xd'),_0x249c35,_0x40cb('0x10'));_0x497107(_0x583f74[_0x40cb('0x15')][_0x40cb('0x14')]);}})[_0x40cb('0x16')](function(_0x5d601a){logger[_0x40cb('0x12')](_0x40cb('0xd'),_0x249c35,_0x5d601a);_0x432d44(_0x5d601a);});});} \ No newline at end of file +var _0xf721=['moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0xf721,0xb2));var _0x1f72=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0xf721[_0x15dbca];return _0x326533;};'use strict';var _=require(_0x1f72('0x0'));var util=require(_0x1f72('0x1'));var moment=require(_0x1f72('0x2'));var BPromise=require(_0x1f72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f72('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f72('0x5'));var jayson=require(_0x1f72('0x6'));var client=jayson[_0x1f72('0x7')][_0x1f72('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20a8d6,_0x44ce99,_0x24e3a0){return new BPromise(function(_0x56a6e1,_0x112be3){return client['request'](_0x20a8d6,_0x24e3a0)[_0x1f72('0x9')](function(_0x1fef55){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x44ce99,_0x1f72('0xa'));logger[_0x1f72('0xb')](_0x1f72('0xc'),_0x44ce99,_0x1f72('0xa'),JSON['stringify'](_0x1fef55));if(_0x1fef55[_0x1f72('0xd')]){if(_0x1fef55[_0x1f72('0xd')][_0x1f72('0xe')]===0x1f4){logger['error'](_0x1f72('0xf'),_0x44ce99,_0x1fef55['error'][_0x1f72('0x10')]);return _0x112be3(_0x1fef55[_0x1f72('0xd')][_0x1f72('0x10')]);}logger[_0x1f72('0xd')](_0x1f72('0xf'),_0x44ce99,_0x1fef55[_0x1f72('0xd')][_0x1f72('0x10')]);return _0x56a6e1(_0x1fef55[_0x1f72('0xd')][_0x1f72('0x10')]);}else{logger['info'](_0x1f72('0xf'),_0x44ce99,_0x1f72('0xa'));_0x56a6e1(_0x1fef55['result'][_0x1f72('0x10')]);}})[_0x1f72('0x11')](function(_0x5d864b){logger[_0x1f72('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x44ce99,_0x5d864b);_0x112be3(_0x5d864b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 399f286..c21a900 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8f7=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','create','put','delete'];(function(_0xd2678f,_0x175685){var _0x3d64cd=function(_0x374bd9){while(--_0x374bd9){_0xd2678f['push'](_0xd2678f['shift']());}};_0x3d64cd(++_0x175685);}(_0xc8f7,0x72));var _0x7c8f=function(_0xb867a8,_0x926a63){_0xb867a8=_0xb867a8-0x0;var _0x1e5dcd=_0xc8f7[_0xb867a8];return _0x1e5dcd;};'use strict';var multer=require(_0x7c8f('0x0'));var util=require(_0x7c8f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c8f('0x2'));var router=express[_0x7c8f('0x3')]();var fs_extra=require(_0x7c8f('0x4'));var auth=require(_0x7c8f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c8f('0x6'));var controller=require(_0x7c8f('0x7'));router[_0x7c8f('0x8')](_0x7c8f('0x9'),auth[_0x7c8f('0xa')](),controller['show']);router['post']('/',auth[_0x7c8f('0xa')](),controller[_0x7c8f('0xb')]);router[_0x7c8f('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7c8f('0xd')](_0x7c8f('0x9'),auth['isAuthenticated'](),controller[_0x7c8f('0xe')]);module[_0x7c8f('0xf')]=router; \ No newline at end of file +var _0x5a83=['../../config/environment','get','/:id','show','isAuthenticated','create','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa59f5f,_0x1a1744){var _0x12f010=function(_0x2873c8){while(--_0x2873c8){_0xa59f5f['push'](_0xa59f5f['shift']());}};_0x12f010(++_0x1a1744);}(_0x5a83,0xd6));var _0x35a8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5a83[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x35a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x35a8('0x1'));var express=require(_0x35a8('0x2'));var router=express[_0x35a8('0x3')]();var fs_extra=require(_0x35a8('0x4'));var auth=require(_0x35a8('0x5'));var interaction=require(_0x35a8('0x6'));var config=require(_0x35a8('0x7'));var controller=require('./chatProactiveAction.controller');router[_0x35a8('0x8')](_0x35a8('0x9'),auth['isAuthenticated'](),controller[_0x35a8('0xa')]);router['post']('/',auth[_0x35a8('0xb')](),controller[_0x35a8('0xc')]);router[_0x35a8('0xd')](_0x35a8('0x9'),auth['isAuthenticated'](),controller[_0x35a8('0xe')]);router['delete'](_0x35a8('0x9'),auth['isAuthenticated'](),controller[_0x35a8('0xf')]);module[_0x35a8('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 2937faa..41f187e 100644 --- a/server/api/chatQueue/chatQueue.attributes.js +++ b/server/api/chatQueue/chatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37c5=['rrmemory','beepall','name','STRING','INTEGER'];(function(_0x9e4a5e,_0x394a7b){var _0x167cb0=function(_0x41c200){while(--_0x41c200){_0x9e4a5e['push'](_0x9e4a5e['shift']());}};_0x167cb0(++_0x394a7b);}(_0x37c5,0x1e7));var _0x537c=function(_0x1bfee5,_0x35ccb0){_0x1bfee5=_0x1bfee5-0x0;var _0x4f0ff2=_0x37c5[_0x1bfee5];return _0x4f0ff2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x537c('0x0'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x537c('0x1')]},'timeout':{'type':Sequelize[_0x537c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x537c('0x3'),_0x537c('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x393b=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x4bf853,_0x1fc141){var _0x38994f=function(_0x2f84e0){while(--_0x2f84e0){_0x4bf853['push'](_0x4bf853['shift']());}};_0x38994f(++_0x1fc141);}(_0x393b,0x141));var _0xb393=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0x393b[_0x509dad];return _0x21e122;};'use strict';var Sequelize=require(_0xb393('0x0'));module[_0xb393('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb393('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb393('0x3')]},'timeout':{'type':Sequelize[_0xb393('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb393('0x5')](_0xb393('0x6'),_0xb393('0x7'),_0xb393('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 45c0273..0e09099 100644 --- a/server/api/chatQueue/chatQueue.controller.js +++ b/server/api/chatQueue/chatQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3595=['clone','ut.UserId\x20=\x20?','push','toString','TeamId','all','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','client','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','then','destroy','get','ChatQueues','UserProfileResource','name','send','body','contact','agent','interaction','account','index','map','ChatQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','include','rows','show','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserChatQueue','ChatQueueId','findAll','findAndCountAll','UserId','chatPause','createdAt','format','%s/%s','updatedAt','getTeams','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','each','forEach','emit','userChatQueue:save','removeTeams','User','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?'];(function(_0x5ba038,_0x31f47f){var _0x25b682=function(_0x4b8a5e){while(--_0x4b8a5e){_0x5ba038['push'](_0x5ba038['shift']());}};_0x25b682(++_0x31f47f);}(_0x3595,0x147));var _0x5359=function(_0x7a40d8,_0x16ce76){_0x7a40d8=_0x7a40d8-0x0;var _0x3a8746=_0x3595[_0x7a40d8];return _0x3a8746;};'use strict';var emlformat=require(_0x5359('0x0'));var rimraf=require(_0x5359('0x1'));var zipdir=require(_0x5359('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5359('0x3'));var moment=require(_0x5359('0x4'));var BPromise=require(_0x5359('0x5'));var Mustache=require(_0x5359('0x6'));var util=require(_0x5359('0x7'));var path=require(_0x5359('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5359('0x9'));var fs=require('fs');var fs_extra=require(_0x5359('0xa'));var _=require(_0x5359('0xb'));var squel=require(_0x5359('0xc'));var crypto=require(_0x5359('0xd'));var jsforce=require(_0x5359('0xe'));var deskjs=require(_0x5359('0xf'));var toCsv=require(_0x5359('0x10'));var querystring=require(_0x5359('0x11'));var Papa=require(_0x5359('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5359('0x13'));var logger=require(_0x5359('0x14'))(_0x5359('0x15'));var utils=require(_0x5359('0x16'));var config=require(_0x5359('0x17'));var licenseUtil=require(_0x5359('0x18'));var db=require(_0x5359('0x19'))['db'];config[_0x5359('0x1a')]=_[_0x5359('0x1b')](config[_0x5359('0x1a')],{'host':_0x5359('0x1c'),'port':0x18eb});var socket=require(_0x5359('0x1d'))(new Redis(config[_0x5359('0x1a')]));require(_0x5359('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5359('0x1f')][_0x5359('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x11d494,_0xa146f5,_0xcdc03e,_0x44c489){return new BPromise(function(_0x534c3e,_0x5399bb){var _0x267d4c=_0x44c489||client;return _0x267d4c[_0x5359('0x21')](_0x11d494,_0xcdc03e)['then'](function(_0x10007f){logger[_0x5359('0x22')](_0x5359('0x23'),_0xa146f5,_0x5359('0x24'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xa146f5,'request\x20sent',JSON[_0x5359('0x25')](_0x10007f));if(_0x10007f[_0x5359('0x26')]){if(_0x10007f['error'][_0x5359('0x27')]===0x1f4){logger[_0x5359('0x26')](_0x5359('0x23'),_0xa146f5,_0x10007f[_0x5359('0x26')]['message']);return _0x5399bb(_0x10007f[_0x5359('0x26')][_0x5359('0x28')]);}logger['error'](_0x5359('0x23'),_0xa146f5,_0x10007f[_0x5359('0x26')][_0x5359('0x28')]);return _0x534c3e(_0x10007f[_0x5359('0x26')][_0x5359('0x28')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0xa146f5,_0x5359('0x24'));_0x534c3e(_0x10007f[_0x5359('0x29')][_0x5359('0x28')]);}})[_0x5359('0x2a')](function(_0xe8cc42){logger[_0x5359('0x26')](_0x5359('0x23'),_0xa146f5,_0xe8cc42);_0x5399bb(_0xe8cc42);});});}function respondWithStatusCode(_0x2771ea,_0x3fea11){_0x3fea11=_0x3fea11||0xcc;return function(_0x550881){if(_0x550881){return _0x2771ea[_0x5359('0x2b')](_0x3fea11);}return _0x2771ea[_0x5359('0x2c')](_0x3fea11)[_0x5359('0x2d')]();};}function respondWithResult(_0x3753cb,_0x234c96){_0x234c96=_0x234c96||0xc8;return function(_0x402bce){if(_0x402bce){return _0x3753cb['status'](_0x234c96)[_0x5359('0x2e')](_0x402bce);}};}function respondWithFilteredResult(_0x47cda4,_0x3b0f9c){return function(_0x4b130a){if(_0x4b130a){var _0x1d6810=typeof _0x3b0f9c[_0x5359('0x2f')]==='undefined'&&typeof _0x3b0f9c[_0x5359('0x30')]==='undefined';var _0x20cd96=_0x4b130a[_0x5359('0x31')];var _0x1ac5ac=_0x1d6810?0x0:_0x3b0f9c[_0x5359('0x2f')];var _0x19c102=_0x1d6810?_0x4b130a[_0x5359('0x31')]:_0x3b0f9c[_0x5359('0x2f')]+_0x3b0f9c[_0x5359('0x30')];var _0x2acf23;if(_0x19c102>=_0x20cd96){_0x19c102=_0x20cd96;_0x2acf23=0xc8;}else{_0x2acf23=0xce;}_0x47cda4[_0x5359('0x2c')](_0x2acf23);return _0x47cda4[_0x5359('0x32')](_0x5359('0x33'),_0x1ac5ac+'-'+_0x19c102+'/'+_0x20cd96)[_0x5359('0x2e')](_0x4b130a);}return null;};}function patchUpdates(_0x212b58){return function(_0x17b26e){try{jsonpatch[_0x5359('0x34')](_0x17b26e,_0x212b58,!![]);}catch(_0x1981c7){return BPromise[_0x5359('0x35')](_0x1981c7);}return _0x17b26e['save']();};}function saveUpdates(_0x457c6e,_0x101ff9){return function(_0x4c07e0){if(_0x4c07e0){return _0x4c07e0['update'](_0x457c6e)[_0x5359('0x36')](function(_0x251dc6){return _0x251dc6;});}return null;};}function removeEntity(_0x2fc0bb,_0x35ceb9){return function(_0x4b6fdf){if(_0x4b6fdf){return _0x4b6fdf[_0x5359('0x37')]()['then'](function(){var _0x27f663=_0x4b6fdf[_0x5359('0x38')]({'plain':!![]});var _0x1faeaa=_0x5359('0x39');return db[_0x5359('0x3a')][_0x5359('0x37')]({'where':{'type':_0x1faeaa,'resourceId':_0x27f663['id']}})[_0x5359('0x36')](function(){return _0x4b6fdf;});})[_0x5359('0x36')](function(){_0x2fc0bb[_0x5359('0x2c')](0xcc)[_0x5359('0x2d')]();});}};}function handleEntityNotFound(_0x7ba0e5,_0x3392c9){return function(_0x56cbd4){if(!_0x56cbd4){_0x7ba0e5['sendStatus'](0x194);}return _0x56cbd4;};}function handleError(_0x567e0e,_0x38b429){_0x38b429=_0x38b429||0x1f4;return function(_0x3b5947){logger['error'](_0x3b5947['stack']);if(_0x3b5947[_0x5359('0x3b')]){delete _0x3b5947[_0x5359('0x3b')];}_0x567e0e[_0x5359('0x2c')](_0x38b429)[_0x5359('0x3c')](_0x3b5947);};}function getMustacheRender(_0x1aee86,_0x19fd15){return Mustache['render'](_0x1aee86,_['merge'](_0x19fd15[_0x5359('0x3d')],{'contact':_0x19fd15[_0x5359('0x3e')],'message':_0x19fd15[_0x5359('0x28')],'agent':_0x19fd15[_0x5359('0x3f')],'interaction':_0x19fd15[_0x5359('0x40')],'account':_0x19fd15[_0x5359('0x41')]}))||'';}exports[_0x5359('0x42')]=function(_0x45555b,_0x55e6f6){var _0x35b8b6={},_0x4b4a99={},_0x48250b={'count':0x0,'rows':[]};var _0x37fe85=_[_0x5359('0x43')](db[_0x5359('0x44')][_0x5359('0x45')],function(_0x1e74d6){return{'name':_0x1e74d6[_0x5359('0x46')],'type':_0x1e74d6['type'][_0x5359('0x47')]};});_0x4b4a99[_0x5359('0x48')]=_[_0x5359('0x43')](_0x37fe85,_0x5359('0x3b'));_0x4b4a99['query']=_[_0x5359('0x49')](_0x45555b['query']);_0x4b4a99[_0x5359('0x4a')]=_[_0x5359('0x4b')](_0x4b4a99[_0x5359('0x48')],_0x4b4a99[_0x5359('0x4c')]);_0x35b8b6[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x4b4a99[_0x5359('0x48')],qs[_0x5359('0x4e')](_0x45555b[_0x5359('0x4c')][_0x5359('0x4e')]));_0x35b8b6[_0x5359('0x4d')]=_0x35b8b6[_0x5359('0x4d')]['length']?_0x35b8b6[_0x5359('0x4d')]:_0x4b4a99[_0x5359('0x48')];if(!_0x45555b[_0x5359('0x4c')][_0x5359('0x4f')](_0x5359('0x50'))){_0x35b8b6[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x45555b['query'][_0x5359('0x30')]);_0x35b8b6['offset']=qs[_0x5359('0x2f')](_0x45555b[_0x5359('0x4c')][_0x5359('0x2f')]);}_0x35b8b6[_0x5359('0x51')]=qs[_0x5359('0x52')](_0x45555b['query'][_0x5359('0x52')]);_0x35b8b6[_0x5359('0x53')]=qs['filters'](_[_0x5359('0x54')](_0x45555b[_0x5359('0x4c')],_0x4b4a99[_0x5359('0x4a')]),_0x37fe85);if(_0x45555b[_0x5359('0x4c')]['filter']){_0x35b8b6[_0x5359('0x53')]=_[_0x5359('0x55')](_0x35b8b6[_0x5359('0x53')],{'$or':_[_0x5359('0x43')](_0x37fe85,function(_0x46462b){if(_0x46462b[_0x5359('0x56')]!==_0x5359('0x57')){var _0x2a043e={};_0x2a043e[_0x46462b['name']]={'$like':'%'+_0x45555b[_0x5359('0x4c')][_0x5359('0x58')]+'%'};return _0x2a043e;}})});}_0x35b8b6=_[_0x5359('0x55')]({},_0x35b8b6,_0x45555b['options']);var _0x8522a5={'where':_0x35b8b6[_0x5359('0x53')]};return db['ChatQueue'][_0x5359('0x31')](_0x8522a5)[_0x5359('0x36')](function(_0x3ac363){_0x48250b[_0x5359('0x31')]=_0x3ac363;if(_0x45555b['query']['includeAll']){_0x35b8b6[_0x5359('0x59')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x35b8b6);})['then'](function(_0x238197){_0x48250b[_0x5359('0x5a')]=_0x238197;return _0x48250b;})[_0x5359('0x36')](respondWithFilteredResult(_0x55e6f6,_0x35b8b6))[_0x5359('0x2a')](handleError(_0x55e6f6,null));};exports[_0x5359('0x5b')]=function(_0x1eeb88,_0x4ce838){var _0x28cc0d={'raw':!![],'where':{'id':_0x1eeb88['params']['id']}},_0x587453={};_0x587453[_0x5359('0x48')]=_[_0x5359('0x49')](db[_0x5359('0x44')]['rawAttributes']);_0x587453[_0x5359('0x4c')]=_['keys'](_0x1eeb88[_0x5359('0x4c')]);_0x587453['filters']=_[_0x5359('0x4b')](_0x587453['model'],_0x587453[_0x5359('0x4c')]);_0x28cc0d[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x587453[_0x5359('0x48')],qs[_0x5359('0x4e')](_0x1eeb88[_0x5359('0x4c')][_0x5359('0x4e')]));_0x28cc0d['attributes']=_0x28cc0d[_0x5359('0x4d')][_0x5359('0x5c')]?_0x28cc0d['attributes']:_0x587453[_0x5359('0x48')];if(_0x1eeb88[_0x5359('0x4c')]['includeAll']){_0x28cc0d['include']=[{'all':!![]}];}_0x28cc0d=_[_0x5359('0x55')]({},_0x28cc0d,_0x1eeb88[_0x5359('0x5d')]);return db[_0x5359('0x44')][_0x5359('0x5e')](_0x28cc0d)[_0x5359('0x36')](handleEntityNotFound(_0x4ce838,null))[_0x5359('0x36')](respondWithResult(_0x4ce838,null))[_0x5359('0x2a')](handleError(_0x4ce838,null));};exports['create']=function(_0x2c4685,_0x48d0fb){return db[_0x5359('0x44')][_0x5359('0x5f')](_0x2c4685[_0x5359('0x3d')],{})[_0x5359('0x36')](function(_0x285b5d){var _0x270714=_0x2c4685[_0x5359('0x60')]['get']({'plain':!![]});if(!_0x270714)throw new Error(_0x5359('0x61'));if(_0x270714[_0x5359('0x62')]==='user'){var _0x1f9e1b=_0x285b5d[_0x5359('0x38')]({'plain':!![]});var _0x3a30f0=_0x5359('0x39');return db['UserProfileSection'][_0x5359('0x5e')]({'where':{'name':_0x3a30f0,'userProfileId':_0x270714[_0x5359('0x63')]},'raw':!![]})['then'](function(_0x164995){if(_0x164995&&_0x164995[_0x5359('0x64')]===0x0){return db[_0x5359('0x3a')]['create']({'name':_0x1f9e1b[_0x5359('0x3b')],'resourceId':_0x1f9e1b['id'],'type':_0x164995[_0x5359('0x3b')],'sectionId':_0x164995['id']},{})[_0x5359('0x36')](function(){return _0x285b5d;});}else{return _0x285b5d;}})['catch'](function(_0x20d909){logger[_0x5359('0x26')](_0x5359('0x65'),_0x20d909);throw _0x20d909;});}return _0x285b5d;})[_0x5359('0x36')](respondWithResult(_0x48d0fb,0xc9))['catch'](handleError(_0x48d0fb,null));};exports[_0x5359('0x66')]=function(_0x2a2c47,_0x22c4ee){if(_0x2a2c47[_0x5359('0x3d')]['id']){delete _0x2a2c47[_0x5359('0x3d')]['id'];}return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x2a2c47[_0x5359('0x67')]['id']}})['then'](handleEntityNotFound(_0x22c4ee,null))[_0x5359('0x36')](saveUpdates(_0x2a2c47[_0x5359('0x3d')],null))[_0x5359('0x36')](respondWithResult(_0x22c4ee,null))['catch'](handleError(_0x22c4ee,null));};exports[_0x5359('0x37')]=function(_0x1c4978,_0x3fb997){return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x1c4978[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x3fb997,null))['then'](removeEntity(_0x3fb997,null))[_0x5359('0x2a')](handleError(_0x3fb997,null));};exports[_0x5359('0x68')]=function(_0x54eba5,_0x2e25b0){return db[_0x5359('0x44')][_0x5359('0x68')]()['then'](respondWithResult(_0x2e25b0,null))[_0x5359('0x2a')](handleError(_0x2e25b0,null));};exports[_0x5359('0x69')]=function(_0x502f66,_0x2ed277,_0x203ce4){var _0x336c53={'raw':!![],'where':{}},_0x31484f={},_0x3aaf77;return db[_0x5359('0x44')]['findOne']({'where':{'id':_0x502f66['params']['id']}})['then'](handleEntityNotFound(_0x2ed277,null))[_0x5359('0x36')](function(_0x29fef8){if(_0x29fef8){_0x3aaf77=_0x29fef8['get']({'plain':!![]});_0x31484f[_0x5359('0x48')]=_[_0x5359('0x49')](db[_0x5359('0x6a')][_0x5359('0x45')]);_0x31484f[_0x5359('0x4c')]=_[_0x5359('0x49')](_0x502f66['query']);_0x31484f[_0x5359('0x4a')]=_[_0x5359('0x4b')](_0x31484f[_0x5359('0x48')],_0x31484f[_0x5359('0x4c')]);_0x336c53['attributes']=_[_0x5359('0x4b')](_0x31484f[_0x5359('0x48')],qs['fields'](_0x502f66[_0x5359('0x4c')]['fields']));_0x336c53[_0x5359('0x4d')]=_0x336c53['attributes'][_0x5359('0x5c')]?_0x336c53[_0x5359('0x4d')]:_0x31484f['model'];if(!_0x502f66[_0x5359('0x4c')][_0x5359('0x4f')](_0x5359('0x50'))){_0x336c53[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x502f66[_0x5359('0x4c')][_0x5359('0x30')]);_0x336c53['offset']=qs[_0x5359('0x2f')](_0x502f66[_0x5359('0x4c')]['offset']);}_0x336c53[_0x5359('0x51')]=qs['sort'](_0x502f66[_0x5359('0x4c')][_0x5359('0x52')]);_0x336c53['where']=qs[_0x5359('0x4a')](_[_0x5359('0x54')](_0x502f66[_0x5359('0x4c')],_0x31484f[_0x5359('0x4a')]));_0x336c53[_0x5359('0x53')][_0x5359('0x6b')]=_0x29fef8['id'];if(_0x502f66[_0x5359('0x4c')][_0x5359('0x58')]){_0x336c53[_0x5359('0x53')]=_[_0x5359('0x55')](_0x336c53[_0x5359('0x53')],{'$or':_['map'](_0x336c53[_0x5359('0x4d')],function(_0x18a3de){var _0x54c278={};_0x54c278[_0x18a3de]={'$like':'%'+_0x502f66[_0x5359('0x4c')][_0x5359('0x58')]+'%'};return _0x54c278;})});}_0x336c53=_[_0x5359('0x55')]({},_0x336c53,_0x502f66[_0x5359('0x5d')]);return db[_0x5359('0x6a')][_0x5359('0x6c')](_0x336c53);}})[_0x5359('0x36')](function(_0x1486da){if(_0x1486da){return db['User'][_0x5359('0x6d')]({'where':{'id':_['map'](_0x1486da,_0x5359('0x6e')),'role':'agent'},'attributes':['id',_0x5359('0x3b'),_0x5359('0x6f'),'updatedAt',_0x5359('0x70')]});}})[_0x5359('0x36')](function(_0xd6f413){if(_0xd6f413){return{'count':_0xd6f413['count'],'rows':_[_0x5359('0x43')](_0xd6f413[_0x5359('0x5a')],function(_0x487642){return{'membername':_0x487642[_0x5359('0x3b')],'UserId':_0x487642['id'],'queue_name':_0x3aaf77['name'],'ChatQueueId':_0x3aaf77['id'],'interface':util[_0x5359('0x71')](_0x5359('0x72'),'SIP',_0x487642['name']),'penalty':0x0,'paused':_0x487642[_0x5359('0x6f')],'createdAt':_0x487642[_0x5359('0x70')],'updatedAt':_0x487642[_0x5359('0x73')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5359('0x36')](respondWithFilteredResult(_0x2ed277,_0x336c53))['catch'](handleError(_0x2ed277,null));};exports[_0x5359('0x74')]=function(_0x1b6e9f,_0x4bc760,_0x4ba96d){var _0x58f83b={};var _0x481fe9={};var _0x193140;var _0x1a9aea;return db[_0x5359('0x44')]['findOne']({'where':{'id':_0x1b6e9f[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x4bc760,null))['then'](function(_0x357e94){if(_0x357e94){_0x193140=_0x357e94;_0x481fe9[_0x5359('0x48')]=_['keys'](db['Team'][_0x5359('0x45')]);_0x481fe9[_0x5359('0x4c')]=_[_0x5359('0x49')](_0x1b6e9f[_0x5359('0x4c')]);_0x481fe9[_0x5359('0x4a')]=_[_0x5359('0x4b')](_0x481fe9[_0x5359('0x48')],_0x481fe9[_0x5359('0x4c')]);_0x58f83b[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x481fe9[_0x5359('0x48')],qs[_0x5359('0x4e')](_0x1b6e9f[_0x5359('0x4c')]['fields']));_0x58f83b['attributes']=_0x58f83b[_0x5359('0x4d')][_0x5359('0x5c')]?_0x58f83b['attributes']:_0x481fe9['model'];_0x58f83b['order']=qs[_0x5359('0x52')](_0x1b6e9f['query'][_0x5359('0x52')]);_0x58f83b[_0x5359('0x53')]=qs[_0x5359('0x4a')](_[_0x5359('0x54')](_0x1b6e9f[_0x5359('0x4c')],_0x481fe9['filters']));if(_0x1b6e9f['query'][_0x5359('0x58')]){_0x58f83b[_0x5359('0x53')]=_[_0x5359('0x55')](_0x58f83b[_0x5359('0x53')],{'$or':_[_0x5359('0x43')](_0x58f83b[_0x5359('0x4d')],function(_0x40f74c){var _0x5e0cce={};_0x5e0cce[_0x40f74c]={'$like':'%'+_0x1b6e9f['query']['filter']+'%'};return _0x5e0cce;})});}_0x58f83b=_[_0x5359('0x55')]({},_0x58f83b,_0x1b6e9f[_0x5359('0x5d')]);return _0x193140['getTeams'](_0x58f83b);}})[_0x5359('0x36')](function(_0x39f491){if(_0x39f491){_0x1a9aea=_0x39f491[_0x5359('0x5c')];if(!_0x1b6e9f[_0x5359('0x4c')][_0x5359('0x4f')](_0x5359('0x50'))){_0x58f83b[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x1b6e9f[_0x5359('0x4c')][_0x5359('0x30')]);_0x58f83b[_0x5359('0x2f')]=qs['offset'](_0x1b6e9f[_0x5359('0x4c')][_0x5359('0x2f')]);}return _0x193140[_0x5359('0x74')](_0x58f83b);}})[_0x5359('0x36')](function(_0x56d31d){if(_0x56d31d){return _0x56d31d?{'count':_0x1a9aea,'rows':_0x56d31d}:null;}})[_0x5359('0x36')](respondWithResult(_0x4bc760,null))['catch'](handleError(_0x4bc760,null));};exports[_0x5359('0x75')]=function(_0x28a905,_0x21c0f5,_0x1d66ff){var _0xaf262=_0x28a905[_0x5359('0x3d')][_0x5359('0x76')];return db['Team'][_0x5359('0x6c')]({'where':{'id':_0xaf262},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x5359('0x3b'),_0x5359('0x77'),_0x5359('0x78'),'interface'],'raw':!![]}]})[_0x5359('0x36')](function(_0x11664a){if(_0x11664a){var _0x10038a=_[_0x5359('0x79')](_0x11664a,function(_0xdfa718){var _0x10b84a=_0xdfa718[_0x5359('0x38')]({'plain':!![]});return _0x10b84a[_0x5359('0x7a')];});return db['ChatQueue'][_0x5359('0x5e')]({'where':{'id':_0x28a905[_0x5359('0x67')]['id']}})[_0x5359('0x36')](function(_0x494a94){return db[_0x5359('0x7b')]['transaction'](function(_0x21d0f1){return _0x494a94['addTeams'](_0xaf262,{'transaction':_0x21d0f1})[_0x5359('0x36')](function(){return BPromise[_0x5359('0x7c')](_0x10038a,function(_0x462551){return db[_0x5359('0x6a')]['findOrCreate']({'where':{'UserId':_0x462551['id'],'ChatQueueId':_0x28a905[_0x5359('0x67')]['id']},'transaction':_0x21d0f1});});})[_0x5359('0x36')](function(){_0x10038a[_0x5359('0x7d')](function(_0x22a52f){socket[_0x5359('0x7e')](_0x5359('0x7f'),{'UserId':_0x22a52f['id'],'ChatQueueId':_0x494a94['id']});});});});});}})[_0x5359('0x36')](respondWithStatusCode(_0x21c0f5,null))[_0x5359('0x2a')](handleError(_0x21c0f5,null));};exports[_0x5359('0x80')]=function(_0x40339c,_0x349c08,_0x10dff3){return db['Team'][_0x5359('0x6c')]({'where':{'id':_0x40339c[_0x5359('0x4c')][_0x5359('0x76')]},'attributes':['id'],'include':[{'model':db[_0x5359('0x81')],'as':_0x5359('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x5359('0x36')](handleEntityNotFound(_0x349c08,null))[_0x5359('0x36')](function(_0xdb3e42){var _0x42dfc6=_[_0x5359('0x43')](_0xdb3e42,'id');var _0x516f3d=[];var _0x598e32=[];var _0x291692=squel[_0x5359('0x82')]();_0x291692[_0x5359('0x83')](_0x5359('0x84'))['from'](_0x5359('0x85'),'tq')[_0x5359('0x86')](_0x5359('0x87'),'ut',_0x5359('0x88'))[_0x5359('0x53')](_0x5359('0x89'),_0x40339c[_0x5359('0x67')]['id']);for(var _0x31b11e=0x0;_0x31b11e<_0xdb3e42[_0x5359('0x5c')];_0x31b11e+=0x1){let _0x41e06e=_0xdb3e42[_0x31b11e];for(var _0x26b380=0x0;_0x26b380<_0x41e06e[_0x5359('0x7a')][_0x5359('0x5c')];_0x26b380+=0x1){let _0x58e23e=_0x41e06e[_0x5359('0x7a')][_0x26b380];var _0x22e8c5=_0x291692[_0x5359('0x8a')]();_0x22e8c5[_0x5359('0x53')](_0x5359('0x8b'),_0x58e23e['id']);_0x598e32[_0x5359('0x8c')](db[_0x5359('0x7b')][_0x5359('0x4c')](_0x22e8c5[_0x5359('0x8d')](),{'type':db[_0x5359('0x7b')]['QueryTypes']['SELECT']})[_0x5359('0x36')](function(_0x2e80d0){if(_0x2e80d0[_0x5359('0x5c')]===0x1){return _0x58e23e['id'];}else{var _0x20dc70=_['every'](_[_0x5359('0x43')](_0x2e80d0,_0x5359('0x8e')),function(_0x38f99e){return _['includes'](_0x42dfc6,_0x38f99e);});if(_0x20dc70){return _0x58e23e['id'];}}}));}}return BPromise[_0x5359('0x8f')](_0x598e32)[_0x5359('0x36')](function(_0xbe9b77){_0x516f3d=_(_0x516f3d)['union'](_0xbe9b77)['compact']()[_0x5359('0x90')]();return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x40339c['params']['id']}})['then'](function(_0x45d8c8){return db[_0x5359('0x7b')][_0x5359('0x91')](function(_0x5e73d7){return _0x45d8c8[_0x5359('0x80')](_0x40339c[_0x5359('0x4c')][_0x5359('0x76')],{'transaction':_0x5e73d7})[_0x5359('0x36')](function(){if(!_[_0x5359('0x92')](_0x516f3d)){return _0x45d8c8[_0x5359('0x93')](_0x516f3d,{'transaction':_0x5e73d7});}})['then'](function(){_0x516f3d[_0x5359('0x7d')](function(_0x2f6626){socket[_0x5359('0x7e')](_0x5359('0x94'),{'UserId':_0x2f6626,'ChatQueueId':_0x45d8c8['id']});});});});});});})['then'](respondWithStatusCode(_0x349c08,null))['catch'](handleError(_0x349c08,null));};exports[_0x5359('0x95')]=function(_0x12ba61,_0x119d5e,_0x1d3ed1){return db[_0x5359('0x44')][_0x5359('0x5e')]({'where':{'id':_0x12ba61[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x119d5e,null))[_0x5359('0x36')](function(_0x2a7517){if(_0x2a7517){return _0x2a7517[_0x5359('0x95')](_0x12ba61['body'][_0x5359('0x76')],_[_0x5359('0x96')](_0x12ba61[_0x5359('0x3d')],[_0x5359('0x76'),'id'])||{})[_0x5359('0x97')](function(_0x19bda2){for(var _0x4c3bb4=0x0;_0x4c3bb4<_0x12ba61[_0x5359('0x3d')][_0x5359('0x76')]['length'];_0x4c3bb4+=0x1){socket[_0x5359('0x7e')](_0x5359('0x7f'),{'UserId':_0x12ba61['body'][_0x5359('0x76')][_0x4c3bb4],'ChatQueueId':_0x12ba61[_0x5359('0x67')]['id']});}return _0x19bda2;});}})[_0x5359('0x36')](respondWithResult(_0x119d5e,null))[_0x5359('0x2a')](handleError(_0x119d5e,null));};exports[_0x5359('0x93')]=function(_0x1969cf,_0x4842bf,_0x13b136){return db['ChatQueue']['find']({'where':{'id':_0x1969cf[_0x5359('0x67')]['id']}})[_0x5359('0x36')](handleEntityNotFound(_0x4842bf,null))[_0x5359('0x36')](function(_0x4b8397){if(_0x4b8397){return _0x4b8397[_0x5359('0x93')](_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')])[_0x5359('0x36')](function(){if(_[_0x5359('0x98')](_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')])){for(var _0x189bf6=0x0;_0x189bf6<_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')][_0x5359('0x5c')];_0x189bf6+=0x1){socket[_0x5359('0x7e')](_0x5359('0x94'),{'UserId':Number(_0x1969cf[_0x5359('0x4c')][_0x5359('0x76')][_0x189bf6]),'ChatQueueId':Number(_0x1969cf['params']['id'])});}}else{socket['emit'](_0x5359('0x94'),{'UserId':Number(_0x1969cf[_0x5359('0x4c')]['ids']),'ChatQueueId':Number(_0x1969cf['params']['id'])});}});}})[_0x5359('0x36')](respondWithStatusCode(_0x4842bf,null))[_0x5359('0x2a')](handleError(_0x4842bf,null));};exports[_0x5359('0x99')]=function(_0x364601,_0x4ad3b9,_0x3a25e4){var _0x218c5d={};var _0x2f0de7={};var _0xa1ace7;var _0x1ee5fd;return db[_0x5359('0x44')][_0x5359('0x9a')]({'where':{'id':_0x364601['params']['id']}})['then'](handleEntityNotFound(_0x4ad3b9,null))['then'](function(_0x129609){if(_0x129609){_0xa1ace7=_0x129609;_0x2f0de7[_0x5359('0x48')]=_[_0x5359('0x49')](db['User']['rawAttributes']);_0x2f0de7[_0x5359('0x4c')]=_['keys'](_0x364601[_0x5359('0x4c')]);_0x2f0de7['filters']=_['intersection'](_0x2f0de7[_0x5359('0x48')],_0x2f0de7[_0x5359('0x4c')]);_0x218c5d[_0x5359('0x4d')]=_[_0x5359('0x4b')](_0x2f0de7[_0x5359('0x48')],qs['fields'](_0x364601['query']['fields']));_0x218c5d['attributes']=_0x218c5d['attributes']['length']?_0x218c5d[_0x5359('0x4d')]:_0x2f0de7[_0x5359('0x48')];_0x218c5d[_0x5359('0x51')]=qs[_0x5359('0x52')](_0x364601['query'][_0x5359('0x52')]);_0x218c5d[_0x5359('0x53')]=qs[_0x5359('0x4a')](_[_0x5359('0x54')](_0x364601[_0x5359('0x4c')],_0x2f0de7[_0x5359('0x4a')]));if(_0x364601['query'][_0x5359('0x58')]){_0x218c5d[_0x5359('0x53')]=_['merge'](_0x218c5d['where'],{'$or':_['map'](_0x218c5d['attributes'],function(_0x4fedbb){var _0x46b47d={};_0x46b47d[_0x4fedbb]={'$like':'%'+_0x364601[_0x5359('0x4c')][_0x5359('0x58')]+'%'};return _0x46b47d;})});}_0x218c5d=_[_0x5359('0x55')]({},_0x218c5d,_0x364601[_0x5359('0x5d')]);return _0xa1ace7[_0x5359('0x99')](_0x218c5d);}})[_0x5359('0x36')](function(_0x1932c5){if(_0x1932c5){_0x1ee5fd=_0x1932c5[_0x5359('0x5c')];if(!_0x364601['query'][_0x5359('0x4f')](_0x5359('0x50'))){_0x218c5d[_0x5359('0x30')]=qs[_0x5359('0x30')](_0x364601[_0x5359('0x4c')][_0x5359('0x30')]);_0x218c5d[_0x5359('0x2f')]=qs[_0x5359('0x2f')](_0x364601[_0x5359('0x4c')][_0x5359('0x2f')]);}return _0xa1ace7[_0x5359('0x99')](_0x218c5d);}})['then'](function(_0x9b26db){if(_0x9b26db){return _0x9b26db?{'count':_0x1ee5fd,'rows':_0x9b26db}:null;}})[_0x5359('0x36')](respondWithResult(_0x4ad3b9,null))['catch'](handleError(_0x4ad3b9,null));}; \ No newline at end of file +var _0xa23f=['stringify','error','code','message','ChatQueue,\x20%s,\x20%s','info','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','render','merge','body','agent','interaction','account','ChatQueue','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAll','findAndCountAll','UserId','chatPause','createdAt','%s/%s','SIP','Team','getTeams','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userChatQueue:save','select','field','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','ids','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./chatQueue.socket','register','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0xa23f,0x7c));var _0xfa23=function(_0x2a69c8,_0x44cdc6){_0x2a69c8=_0x2a69c8-0x0;var _0x2dfd63=_0xa23f[_0x2a69c8];return _0x2dfd63;};'use strict';var emlformat=require(_0xfa23('0x0'));var rimraf=require(_0xfa23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa23('0x2'));var moment=require(_0xfa23('0x3'));var BPromise=require(_0xfa23('0x4'));var Mustache=require(_0xfa23('0x5'));var util=require('util');var path=require(_0xfa23('0x6'));var sox=require('sox');var csv=require(_0xfa23('0x7'));var ejs=require(_0xfa23('0x8'));var fs=require('fs');var fs_extra=require(_0xfa23('0x9'));var _=require(_0xfa23('0xa'));var squel=require('squel');var crypto=require(_0xfa23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa23('0xc'));var toCsv=require(_0xfa23('0x7'));var querystring=require(_0xfa23('0xd'));var Papa=require(_0xfa23('0xe'));var Redis=require(_0xfa23('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa23('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa23('0x11'))('api');var utils=require(_0xfa23('0x12'));var config=require(_0xfa23('0x13'));var licenseUtil=require(_0xfa23('0x14'));var db=require('../../mysqldb')['db'];config[_0xfa23('0x15')]=_[_0xfa23('0x16')](config[_0xfa23('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa23('0x15')]));require(_0xfa23('0x17'))[_0xfa23('0x18')](socket);var jayson=require(_0xfa23('0x19'));var client=jayson['client'][_0xfa23('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xb7d11a,_0x2095a5,_0x9611e0,_0x542d9a){return new BPromise(function(_0x1c4882,_0x39729e){var _0x3ca6be=_0x542d9a||client;return _0x3ca6be[_0xfa23('0x1b')](_0xb7d11a,_0x9611e0)[_0xfa23('0x1c')](function(_0x4e5b77){logger['info']('ChatQueue,\x20%s,\x20%s',_0x2095a5,_0xfa23('0x1d'));logger[_0xfa23('0x1e')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2095a5,_0xfa23('0x1d'),JSON[_0xfa23('0x1f')](_0x4e5b77));if(_0x4e5b77[_0xfa23('0x20')]){if(_0x4e5b77['error'][_0xfa23('0x21')]===0x1f4){logger[_0xfa23('0x20')]('ChatQueue,\x20%s,\x20%s',_0x2095a5,_0x4e5b77[_0xfa23('0x20')][_0xfa23('0x22')]);return _0x39729e(_0x4e5b77[_0xfa23('0x20')][_0xfa23('0x22')]);}logger[_0xfa23('0x20')](_0xfa23('0x23'),_0x2095a5,_0x4e5b77[_0xfa23('0x20')]['message']);return _0x1c4882(_0x4e5b77[_0xfa23('0x20')][_0xfa23('0x22')]);}else{logger[_0xfa23('0x24')](_0xfa23('0x23'),_0x2095a5,'request\x20sent');_0x1c4882(_0x4e5b77[_0xfa23('0x25')]['message']);}})[_0xfa23('0x26')](function(_0x1abb42){logger[_0xfa23('0x20')](_0xfa23('0x23'),_0x2095a5,_0x1abb42);_0x39729e(_0x1abb42);});});}function respondWithStatusCode(_0x3362f3,_0x1340d9){_0x1340d9=_0x1340d9||0xcc;return function(_0x21bbc0){if(_0x21bbc0){return _0x3362f3[_0xfa23('0x27')](_0x1340d9);}return _0x3362f3['status'](_0x1340d9)[_0xfa23('0x28')]();};}function respondWithResult(_0x4ab34d,_0x1ae38a){_0x1ae38a=_0x1ae38a||0xc8;return function(_0x5de208){if(_0x5de208){return _0x4ab34d['status'](_0x1ae38a)[_0xfa23('0x29')](_0x5de208);}};}function respondWithFilteredResult(_0x1a9a90,_0xbf9d19){return function(_0x3b00a8){if(_0x3b00a8){var _0x374169=typeof _0xbf9d19[_0xfa23('0x2a')]===_0xfa23('0x2b')&&typeof _0xbf9d19['limit']===_0xfa23('0x2b');var _0x47ced6=_0x3b00a8[_0xfa23('0x2c')];var _0x6bf719=_0x374169?0x0:_0xbf9d19['offset'];var _0x1c83d0=_0x374169?_0x3b00a8[_0xfa23('0x2c')]:_0xbf9d19[_0xfa23('0x2a')]+_0xbf9d19[_0xfa23('0x2d')];var _0x213c26;if(_0x1c83d0>=_0x47ced6){_0x1c83d0=_0x47ced6;_0x213c26=0xc8;}else{_0x213c26=0xce;}_0x1a9a90[_0xfa23('0x2e')](_0x213c26);return _0x1a9a90[_0xfa23('0x2f')](_0xfa23('0x30'),_0x6bf719+'-'+_0x1c83d0+'/'+_0x47ced6)[_0xfa23('0x29')](_0x3b00a8);}return null;};}function patchUpdates(_0x55320e){return function(_0x2eb32e){try{jsonpatch['apply'](_0x2eb32e,_0x55320e,!![]);}catch(_0x9d0602){return BPromise[_0xfa23('0x31')](_0x9d0602);}return _0x2eb32e[_0xfa23('0x32')]();};}function saveUpdates(_0xaa1d77,_0x1801f1){return function(_0x8ac724){if(_0x8ac724){return _0x8ac724[_0xfa23('0x33')](_0xaa1d77)[_0xfa23('0x1c')](function(_0xaa329c){return _0xaa329c;});}return null;};}function removeEntity(_0x59aa98,_0x1571f8){return function(_0x4e82a3){if(_0x4e82a3){return _0x4e82a3[_0xfa23('0x34')]()[_0xfa23('0x1c')](function(){var _0x17c407=_0x4e82a3[_0xfa23('0x35')]({'plain':!![]});var _0x3fed37=_0xfa23('0x36');return db[_0xfa23('0x37')]['destroy']({'where':{'type':_0x3fed37,'resourceId':_0x17c407['id']}})[_0xfa23('0x1c')](function(){return _0x4e82a3;});})[_0xfa23('0x1c')](function(){_0x59aa98[_0xfa23('0x2e')](0xcc)[_0xfa23('0x28')]();});}};}function handleEntityNotFound(_0x4e286f,_0x47e47d){return function(_0x5179a3){if(!_0x5179a3){_0x4e286f[_0xfa23('0x27')](0x194);}return _0x5179a3;};}function handleError(_0x3e004f,_0x584fa2){_0x584fa2=_0x584fa2||0x1f4;return function(_0x22fd83){logger[_0xfa23('0x20')](_0x22fd83[_0xfa23('0x38')]);if(_0x22fd83['name']){delete _0x22fd83[_0xfa23('0x39')];}_0x3e004f['status'](_0x584fa2)[_0xfa23('0x3a')](_0x22fd83);};}function getMustacheRender(_0xb3ff14,_0x329985){return Mustache[_0xfa23('0x3b')](_0xb3ff14,_[_0xfa23('0x3c')](_0x329985[_0xfa23('0x3d')],{'contact':_0x329985['contact'],'message':_0x329985[_0xfa23('0x22')],'agent':_0x329985[_0xfa23('0x3e')],'interaction':_0x329985[_0xfa23('0x3f')],'account':_0x329985[_0xfa23('0x40')]}))||'';}exports['index']=function(_0x3cafea,_0xa4d21f){var _0x15480c={},_0x41682e={},_0x113552={'count':0x0,'rows':[]};var _0x18e73c=_['map'](db[_0xfa23('0x41')]['rawAttributes'],function(_0x5ec65a){return{'name':_0x5ec65a[_0xfa23('0x42')],'type':_0x5ec65a[_0xfa23('0x43')]['key']};});_0x41682e[_0xfa23('0x44')]=_[_0xfa23('0x45')](_0x18e73c,_0xfa23('0x39'));_0x41682e['query']=_[_0xfa23('0x46')](_0x3cafea[_0xfa23('0x47')]);_0x41682e[_0xfa23('0x48')]=_['intersection'](_0x41682e['model'],_0x41682e[_0xfa23('0x47')]);_0x15480c['attributes']=_[_0xfa23('0x49')](_0x41682e[_0xfa23('0x44')],qs[_0xfa23('0x4a')](_0x3cafea['query'][_0xfa23('0x4a')]));_0x15480c[_0xfa23('0x4b')]=_0x15480c[_0xfa23('0x4b')][_0xfa23('0x4c')]?_0x15480c['attributes']:_0x41682e[_0xfa23('0x44')];if(!_0x3cafea[_0xfa23('0x47')][_0xfa23('0x4d')]('nolimit')){_0x15480c['limit']=qs[_0xfa23('0x2d')](_0x3cafea['query'][_0xfa23('0x2d')]);_0x15480c[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0x3cafea[_0xfa23('0x47')][_0xfa23('0x2a')]);}_0x15480c[_0xfa23('0x4e')]=qs['sort'](_0x3cafea[_0xfa23('0x47')][_0xfa23('0x4f')]);_0x15480c[_0xfa23('0x50')]=qs[_0xfa23('0x48')](_[_0xfa23('0x51')](_0x3cafea[_0xfa23('0x47')],_0x41682e['filters']),_0x18e73c);if(_0x3cafea[_0xfa23('0x47')][_0xfa23('0x52')]){_0x15480c[_0xfa23('0x50')]=_[_0xfa23('0x3c')](_0x15480c[_0xfa23('0x50')],{'$or':_['map'](_0x18e73c,function(_0x1fbdff){if(_0x1fbdff[_0xfa23('0x43')]!==_0xfa23('0x53')){var _0x5e4633={};_0x5e4633[_0x1fbdff[_0xfa23('0x39')]]={'$like':'%'+_0x3cafea[_0xfa23('0x47')][_0xfa23('0x52')]+'%'};return _0x5e4633;}})});}_0x15480c=_[_0xfa23('0x3c')]({},_0x15480c,_0x3cafea[_0xfa23('0x54')]);var _0x312267={'where':_0x15480c[_0xfa23('0x50')]};return db['ChatQueue'][_0xfa23('0x2c')](_0x312267)['then'](function(_0x1cfd06){_0x113552[_0xfa23('0x2c')]=_0x1cfd06;if(_0x3cafea[_0xfa23('0x47')][_0xfa23('0x55')]){_0x15480c[_0xfa23('0x56')]=[{'all':!![]}];}return db[_0xfa23('0x41')]['findAll'](_0x15480c);})[_0xfa23('0x1c')](function(_0x2b7628){_0x113552[_0xfa23('0x57')]=_0x2b7628;return _0x113552;})[_0xfa23('0x1c')](respondWithFilteredResult(_0xa4d21f,_0x15480c))[_0xfa23('0x26')](handleError(_0xa4d21f,null));};exports[_0xfa23('0x58')]=function(_0x953ac7,_0x531c02){var _0x3e1d1a={'raw':!![],'where':{'id':_0x953ac7[_0xfa23('0x59')]['id']}},_0x18280a={};_0x18280a[_0xfa23('0x44')]=_['keys'](db[_0xfa23('0x41')][_0xfa23('0x5a')]);_0x18280a[_0xfa23('0x47')]=_[_0xfa23('0x46')](_0x953ac7[_0xfa23('0x47')]);_0x18280a[_0xfa23('0x48')]=_['intersection'](_0x18280a[_0xfa23('0x44')],_0x18280a['query']);_0x3e1d1a[_0xfa23('0x4b')]=_[_0xfa23('0x49')](_0x18280a['model'],qs[_0xfa23('0x4a')](_0x953ac7[_0xfa23('0x47')]['fields']));_0x3e1d1a[_0xfa23('0x4b')]=_0x3e1d1a[_0xfa23('0x4b')]['length']?_0x3e1d1a[_0xfa23('0x4b')]:_0x18280a[_0xfa23('0x44')];if(_0x953ac7[_0xfa23('0x47')][_0xfa23('0x55')]){_0x3e1d1a['include']=[{'all':!![]}];}_0x3e1d1a=_[_0xfa23('0x3c')]({},_0x3e1d1a,_0x953ac7[_0xfa23('0x54')]);return db['ChatQueue'][_0xfa23('0x5b')](_0x3e1d1a)[_0xfa23('0x1c')](handleEntityNotFound(_0x531c02,null))[_0xfa23('0x1c')](respondWithResult(_0x531c02,null))[_0xfa23('0x26')](handleError(_0x531c02,null));};exports[_0xfa23('0x5c')]=function(_0x30e92f,_0x53b605){return db[_0xfa23('0x41')][_0xfa23('0x5c')](_0x30e92f[_0xfa23('0x3d')],{})['then'](function(_0x125c46){var _0x2e859e=_0x30e92f[_0xfa23('0x5d')]['get']({'plain':!![]});if(!_0x2e859e)throw new Error(_0xfa23('0x5e'));if(_0x2e859e[_0xfa23('0x5f')]===_0xfa23('0x5d')){var _0x14657a=_0x125c46[_0xfa23('0x35')]({'plain':!![]});var _0x58224d='ChatQueues';return db[_0xfa23('0x60')][_0xfa23('0x5b')]({'where':{'name':_0x58224d,'userProfileId':_0x2e859e[_0xfa23('0x61')]},'raw':!![]})[_0xfa23('0x1c')](function(_0x4e86bd){if(_0x4e86bd&&_0x4e86bd['autoAssociation']===0x0){return db[_0xfa23('0x37')][_0xfa23('0x5c')]({'name':_0x14657a[_0xfa23('0x39')],'resourceId':_0x14657a['id'],'type':_0x4e86bd[_0xfa23('0x39')],'sectionId':_0x4e86bd['id']},{})['then'](function(){return _0x125c46;});}else{return _0x125c46;}})[_0xfa23('0x26')](function(_0x1cbc06){logger['error'](_0xfa23('0x62'),_0x1cbc06);throw _0x1cbc06;});}return _0x125c46;})[_0xfa23('0x1c')](respondWithResult(_0x53b605,0xc9))['catch'](handleError(_0x53b605,null));};exports[_0xfa23('0x33')]=function(_0x314137,_0xdd1af1){if(_0x314137[_0xfa23('0x3d')]['id']){delete _0x314137[_0xfa23('0x3d')]['id'];}return db[_0xfa23('0x41')]['find']({'where':{'id':_0x314137[_0xfa23('0x59')]['id']}})['then'](handleEntityNotFound(_0xdd1af1,null))[_0xfa23('0x1c')](saveUpdates(_0x314137[_0xfa23('0x3d')],null))[_0xfa23('0x1c')](respondWithResult(_0xdd1af1,null))[_0xfa23('0x26')](handleError(_0xdd1af1,null));};exports[_0xfa23('0x34')]=function(_0x1f9344,_0x338e17){return db[_0xfa23('0x41')][_0xfa23('0x5b')]({'where':{'id':_0x1f9344['params']['id']}})[_0xfa23('0x1c')](handleEntityNotFound(_0x338e17,null))['then'](removeEntity(_0x338e17,null))[_0xfa23('0x26')](handleError(_0x338e17,null));};exports[_0xfa23('0x63')]=function(_0x4c2103,_0x53d587){return db[_0xfa23('0x41')]['describe']()[_0xfa23('0x1c')](respondWithResult(_0x53d587,null))[_0xfa23('0x26')](handleError(_0x53d587,null));};exports[_0xfa23('0x64')]=function(_0x400fc9,_0x3d0f94,_0x2a624e){var _0x95f957={'raw':!![],'where':{}},_0x4d9d14={},_0x57a71c;return db[_0xfa23('0x41')][_0xfa23('0x65')]({'where':{'id':_0x400fc9[_0xfa23('0x59')]['id']}})[_0xfa23('0x1c')](handleEntityNotFound(_0x3d0f94,null))['then'](function(_0x43f59c){if(_0x43f59c){_0x57a71c=_0x43f59c['get']({'plain':!![]});_0x4d9d14[_0xfa23('0x44')]=_[_0xfa23('0x46')](db[_0xfa23('0x66')][_0xfa23('0x5a')]);_0x4d9d14[_0xfa23('0x47')]=_[_0xfa23('0x46')](_0x400fc9[_0xfa23('0x47')]);_0x4d9d14[_0xfa23('0x48')]=_[_0xfa23('0x49')](_0x4d9d14[_0xfa23('0x44')],_0x4d9d14['query']);_0x95f957['attributes']=_[_0xfa23('0x49')](_0x4d9d14['model'],qs[_0xfa23('0x4a')](_0x400fc9['query'][_0xfa23('0x4a')]));_0x95f957[_0xfa23('0x4b')]=_0x95f957['attributes'][_0xfa23('0x4c')]?_0x95f957['attributes']:_0x4d9d14['model'];if(!_0x400fc9[_0xfa23('0x47')][_0xfa23('0x4d')]('nolimit')){_0x95f957[_0xfa23('0x2d')]=qs[_0xfa23('0x2d')](_0x400fc9[_0xfa23('0x47')][_0xfa23('0x2d')]);_0x95f957[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0x400fc9[_0xfa23('0x47')]['offset']);}_0x95f957[_0xfa23('0x4e')]=qs[_0xfa23('0x4f')](_0x400fc9[_0xfa23('0x47')][_0xfa23('0x4f')]);_0x95f957[_0xfa23('0x50')]=qs['filters'](_[_0xfa23('0x51')](_0x400fc9['query'],_0x4d9d14['filters']));_0x95f957['where'][_0xfa23('0x67')]=_0x43f59c['id'];if(_0x400fc9[_0xfa23('0x47')][_0xfa23('0x52')]){_0x95f957['where']=_[_0xfa23('0x3c')](_0x95f957[_0xfa23('0x50')],{'$or':_['map'](_0x95f957[_0xfa23('0x4b')],function(_0x22ce00){var _0x281fd2={};_0x281fd2[_0x22ce00]={'$like':'%'+_0x400fc9[_0xfa23('0x47')]['filter']+'%'};return _0x281fd2;})});}_0x95f957=_['merge']({},_0x95f957,_0x400fc9[_0xfa23('0x54')]);return db['UserChatQueue'][_0xfa23('0x68')](_0x95f957);}})[_0xfa23('0x1c')](function(_0x3fb9d3){if(_0x3fb9d3){return db['User'][_0xfa23('0x69')]({'where':{'id':_[_0xfa23('0x45')](_0x3fb9d3,_0xfa23('0x6a')),'role':_0xfa23('0x3e')},'attributes':['id',_0xfa23('0x39'),_0xfa23('0x6b'),'updatedAt',_0xfa23('0x6c')]});}})[_0xfa23('0x1c')](function(_0x37548a){if(_0x37548a){return{'count':_0x37548a[_0xfa23('0x2c')],'rows':_[_0xfa23('0x45')](_0x37548a[_0xfa23('0x57')],function(_0x56b78d){return{'membername':_0x56b78d[_0xfa23('0x39')],'UserId':_0x56b78d['id'],'queue_name':_0x57a71c[_0xfa23('0x39')],'ChatQueueId':_0x57a71c['id'],'interface':util['format'](_0xfa23('0x6d'),_0xfa23('0x6e'),_0x56b78d[_0xfa23('0x39')]),'penalty':0x0,'paused':_0x56b78d[_0xfa23('0x6b')],'createdAt':_0x56b78d[_0xfa23('0x6c')],'updatedAt':_0x56b78d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa23('0x1c')](respondWithFilteredResult(_0x3d0f94,_0x95f957))['catch'](handleError(_0x3d0f94,null));};exports['getTeams']=function(_0x5e54bf,_0x5bc019,_0x23349e){var _0x50e6f5={};var _0x17cec3={};var _0x3affe5;var _0x8fe7e4;return db[_0xfa23('0x41')][_0xfa23('0x65')]({'where':{'id':_0x5e54bf[_0xfa23('0x59')]['id']}})[_0xfa23('0x1c')](handleEntityNotFound(_0x5bc019,null))[_0xfa23('0x1c')](function(_0x53d266){if(_0x53d266){_0x3affe5=_0x53d266;_0x17cec3[_0xfa23('0x44')]=_['keys'](db[_0xfa23('0x6f')][_0xfa23('0x5a')]);_0x17cec3['query']=_[_0xfa23('0x46')](_0x5e54bf[_0xfa23('0x47')]);_0x17cec3['filters']=_[_0xfa23('0x49')](_0x17cec3['model'],_0x17cec3[_0xfa23('0x47')]);_0x50e6f5['attributes']=_[_0xfa23('0x49')](_0x17cec3['model'],qs[_0xfa23('0x4a')](_0x5e54bf[_0xfa23('0x47')]['fields']));_0x50e6f5[_0xfa23('0x4b')]=_0x50e6f5[_0xfa23('0x4b')][_0xfa23('0x4c')]?_0x50e6f5['attributes']:_0x17cec3[_0xfa23('0x44')];_0x50e6f5['order']=qs[_0xfa23('0x4f')](_0x5e54bf[_0xfa23('0x47')][_0xfa23('0x4f')]);_0x50e6f5[_0xfa23('0x50')]=qs['filters'](_[_0xfa23('0x51')](_0x5e54bf['query'],_0x17cec3[_0xfa23('0x48')]));if(_0x5e54bf['query'][_0xfa23('0x52')]){_0x50e6f5[_0xfa23('0x50')]=_[_0xfa23('0x3c')](_0x50e6f5[_0xfa23('0x50')],{'$or':_[_0xfa23('0x45')](_0x50e6f5['attributes'],function(_0x1d747f){var _0x505033={};_0x505033[_0x1d747f]={'$like':'%'+_0x5e54bf['query'][_0xfa23('0x52')]+'%'};return _0x505033;})});}_0x50e6f5=_[_0xfa23('0x3c')]({},_0x50e6f5,_0x5e54bf[_0xfa23('0x54')]);return _0x3affe5[_0xfa23('0x70')](_0x50e6f5);}})['then'](function(_0x367701){if(_0x367701){_0x8fe7e4=_0x367701[_0xfa23('0x4c')];if(!_0x5e54bf[_0xfa23('0x47')][_0xfa23('0x4d')](_0xfa23('0x71'))){_0x50e6f5[_0xfa23('0x2d')]=qs[_0xfa23('0x2d')](_0x5e54bf[_0xfa23('0x47')][_0xfa23('0x2d')]);_0x50e6f5[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0x5e54bf[_0xfa23('0x47')]['offset']);}return _0x3affe5[_0xfa23('0x70')](_0x50e6f5);}})[_0xfa23('0x1c')](function(_0x250869){if(_0x250869){return _0x250869?{'count':_0x8fe7e4,'rows':_0x250869}:null;}})[_0xfa23('0x1c')](respondWithResult(_0x5bc019,null))[_0xfa23('0x26')](handleError(_0x5bc019,null));};exports[_0xfa23('0x72')]=function(_0x43ea,_0x5a4ec3,_0x16ad12){var _0x571f0a=_0x43ea['body']['ids'];return db['Team'][_0xfa23('0x68')]({'where':{'id':_0x571f0a},'attributes':['id'],'include':[{'model':db[_0xfa23('0x73')],'as':_0xfa23('0x74'),'attributes':['id','name',_0xfa23('0x75'),_0xfa23('0x76'),_0xfa23('0x77')],'raw':!![]}]})[_0xfa23('0x1c')](function(_0x382afe){if(_0x382afe){var _0x5d397f=_[_0xfa23('0x78')](_0x382afe,function(_0x45c355){var _0x19acfa=_0x45c355[_0xfa23('0x35')]({'plain':!![]});return _0x19acfa[_0xfa23('0x74')];});return db[_0xfa23('0x41')]['find']({'where':{'id':_0x43ea['params']['id']}})['then'](function(_0x590f3f){return db[_0xfa23('0x79')][_0xfa23('0x7a')](function(_0x27fedb){return _0x590f3f[_0xfa23('0x72')](_0x571f0a,{'transaction':_0x27fedb})[_0xfa23('0x1c')](function(){return BPromise['each'](_0x5d397f,function(_0x59507d){return db[_0xfa23('0x66')][_0xfa23('0x7b')]({'where':{'UserId':_0x59507d['id'],'ChatQueueId':_0x43ea['params']['id']},'transaction':_0x27fedb});});})[_0xfa23('0x1c')](function(){_0x5d397f['forEach'](function(_0x478c77){socket[_0xfa23('0x7c')](_0xfa23('0x7d'),{'UserId':_0x478c77['id'],'ChatQueueId':_0x590f3f['id']});});});});});}})[_0xfa23('0x1c')](respondWithStatusCode(_0x5a4ec3,null))[_0xfa23('0x26')](handleError(_0x5a4ec3,null));};exports['removeTeams']=function(_0x6bdaf0,_0x370cd0,_0x5c3d76){return db[_0xfa23('0x6f')][_0xfa23('0x68')]({'where':{'id':_0x6bdaf0['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xfa23('0x73')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfa23('0x1c')](handleEntityNotFound(_0x370cd0,null))[_0xfa23('0x1c')](function(_0x3913bb){var _0x1c5309=_[_0xfa23('0x45')](_0x3913bb,'id');var _0x3d566f=[];var _0x26ce87=[];var _0x1235e5=squel[_0xfa23('0x7e')]();_0x1235e5[_0xfa23('0x7f')](_0xfa23('0x80'))['from'](_0xfa23('0x81'),'tq')[_0xfa23('0x82')]('user_has_teams','ut',_0xfa23('0x83'))[_0xfa23('0x50')](_0xfa23('0x84'),_0x6bdaf0[_0xfa23('0x59')]['id']);for(var _0x49ab16=0x0;_0x49ab16<_0x3913bb['length'];_0x49ab16+=0x1){let _0x3c4fde=_0x3913bb[_0x49ab16];for(var _0xe9c198=0x0;_0xe9c198<_0x3c4fde[_0xfa23('0x74')][_0xfa23('0x4c')];_0xe9c198+=0x1){let _0x51dad6=_0x3c4fde['Agents'][_0xe9c198];var _0x393695=_0x1235e5[_0xfa23('0x85')]();_0x393695[_0xfa23('0x50')]('ut.UserId\x20=\x20?',_0x51dad6['id']);_0x26ce87[_0xfa23('0x86')](db[_0xfa23('0x79')]['query'](_0x393695[_0xfa23('0x87')](),{'type':db[_0xfa23('0x79')][_0xfa23('0x88')][_0xfa23('0x89')]})[_0xfa23('0x1c')](function(_0x456bb3){if(_0x456bb3[_0xfa23('0x4c')]===0x1){return _0x51dad6['id'];}else{var _0x3d5f5c=_[_0xfa23('0x8a')](_['map'](_0x456bb3,'TeamId'),function(_0x3aee02){return _[_0xfa23('0x8b')](_0x1c5309,_0x3aee02);});if(_0x3d5f5c){return _0x51dad6['id'];}}}));}}return BPromise[_0xfa23('0x8c')](_0x26ce87)['then'](function(_0x2e608b){_0x3d566f=_(_0x3d566f)[_0xfa23('0x8d')](_0x2e608b)[_0xfa23('0x8e')]()[_0xfa23('0x8f')]();return db[_0xfa23('0x41')][_0xfa23('0x5b')]({'where':{'id':_0x6bdaf0[_0xfa23('0x59')]['id']}})[_0xfa23('0x1c')](function(_0x5755d0){return db[_0xfa23('0x79')][_0xfa23('0x7a')](function(_0x1e3219){return _0x5755d0[_0xfa23('0x90')](_0x6bdaf0[_0xfa23('0x47')][_0xfa23('0x91')],{'transaction':_0x1e3219})['then'](function(){if(!_[_0xfa23('0x92')](_0x3d566f)){return _0x5755d0[_0xfa23('0x93')](_0x3d566f,{'transaction':_0x1e3219});}})['then'](function(){_0x3d566f[_0xfa23('0x94')](function(_0x389809){socket[_0xfa23('0x7c')](_0xfa23('0x95'),{'UserId':_0x389809,'ChatQueueId':_0x5755d0['id']});});});});});});})[_0xfa23('0x1c')](respondWithStatusCode(_0x370cd0,null))[_0xfa23('0x26')](handleError(_0x370cd0,null));};exports[_0xfa23('0x96')]=function(_0x14139c,_0x1f7928,_0x273e3b){return db[_0xfa23('0x41')][_0xfa23('0x5b')]({'where':{'id':_0x14139c[_0xfa23('0x59')]['id']}})[_0xfa23('0x1c')](handleEntityNotFound(_0x1f7928,null))[_0xfa23('0x1c')](function(_0x8a7fca){if(_0x8a7fca){return _0x8a7fca[_0xfa23('0x96')](_0x14139c[_0xfa23('0x3d')][_0xfa23('0x91')],_[_0xfa23('0x97')](_0x14139c[_0xfa23('0x3d')],['ids','id'])||{})[_0xfa23('0x98')](function(_0x37146b){for(var _0x3116f6=0x0;_0x3116f6<_0x14139c[_0xfa23('0x3d')][_0xfa23('0x91')]['length'];_0x3116f6+=0x1){socket[_0xfa23('0x7c')](_0xfa23('0x7d'),{'UserId':_0x14139c['body'][_0xfa23('0x91')][_0x3116f6],'ChatQueueId':_0x14139c[_0xfa23('0x59')]['id']});}return _0x37146b;});}})[_0xfa23('0x1c')](respondWithResult(_0x1f7928,null))[_0xfa23('0x26')](handleError(_0x1f7928,null));};exports[_0xfa23('0x93')]=function(_0x139ca1,_0x4c4332,_0x3f406b){return db[_0xfa23('0x41')][_0xfa23('0x5b')]({'where':{'id':_0x139ca1[_0xfa23('0x59')]['id']}})[_0xfa23('0x1c')](handleEntityNotFound(_0x4c4332,null))[_0xfa23('0x1c')](function(_0x8c9282){if(_0x8c9282){return _0x8c9282[_0xfa23('0x93')](_0x139ca1[_0xfa23('0x47')]['ids'])[_0xfa23('0x1c')](function(){if(_[_0xfa23('0x99')](_0x139ca1[_0xfa23('0x47')]['ids'])){for(var _0x3bb8eb=0x0;_0x3bb8eb<_0x139ca1[_0xfa23('0x47')][_0xfa23('0x91')][_0xfa23('0x4c')];_0x3bb8eb+=0x1){socket[_0xfa23('0x7c')](_0xfa23('0x95'),{'UserId':Number(_0x139ca1[_0xfa23('0x47')][_0xfa23('0x91')][_0x3bb8eb]),'ChatQueueId':Number(_0x139ca1[_0xfa23('0x59')]['id'])});}}else{socket[_0xfa23('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x139ca1[_0xfa23('0x47')][_0xfa23('0x91')]),'ChatQueueId':Number(_0x139ca1['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4c4332,null))[_0xfa23('0x26')](handleError(_0x4c4332,null));};exports[_0xfa23('0x9a')]=function(_0x341071,_0xdb4344,_0x47954d){var _0x204a8f={};var _0x499443={};var _0x1de2bb;var _0x59ca8a;return db[_0xfa23('0x41')][_0xfa23('0x65')]({'where':{'id':_0x341071['params']['id']}})[_0xfa23('0x1c')](handleEntityNotFound(_0xdb4344,null))[_0xfa23('0x1c')](function(_0x46d1ca){if(_0x46d1ca){_0x1de2bb=_0x46d1ca;_0x499443[_0xfa23('0x44')]=_[_0xfa23('0x46')](db[_0xfa23('0x73')][_0xfa23('0x5a')]);_0x499443[_0xfa23('0x47')]=_['keys'](_0x341071['query']);_0x499443[_0xfa23('0x48')]=_[_0xfa23('0x49')](_0x499443[_0xfa23('0x44')],_0x499443[_0xfa23('0x47')]);_0x204a8f[_0xfa23('0x4b')]=_[_0xfa23('0x49')](_0x499443[_0xfa23('0x44')],qs[_0xfa23('0x4a')](_0x341071[_0xfa23('0x47')][_0xfa23('0x4a')]));_0x204a8f[_0xfa23('0x4b')]=_0x204a8f[_0xfa23('0x4b')][_0xfa23('0x4c')]?_0x204a8f[_0xfa23('0x4b')]:_0x499443[_0xfa23('0x44')];_0x204a8f['order']=qs['sort'](_0x341071['query'][_0xfa23('0x4f')]);_0x204a8f['where']=qs[_0xfa23('0x48')](_[_0xfa23('0x51')](_0x341071[_0xfa23('0x47')],_0x499443[_0xfa23('0x48')]));if(_0x341071['query'][_0xfa23('0x52')]){_0x204a8f['where']=_[_0xfa23('0x3c')](_0x204a8f['where'],{'$or':_[_0xfa23('0x45')](_0x204a8f[_0xfa23('0x4b')],function(_0x3d7c9b){var _0x2a44ae={};_0x2a44ae[_0x3d7c9b]={'$like':'%'+_0x341071[_0xfa23('0x47')][_0xfa23('0x52')]+'%'};return _0x2a44ae;})});}_0x204a8f=_[_0xfa23('0x3c')]({},_0x204a8f,_0x341071[_0xfa23('0x54')]);return _0x1de2bb['getAgents'](_0x204a8f);}})[_0xfa23('0x1c')](function(_0xd31f63){if(_0xd31f63){_0x59ca8a=_0xd31f63[_0xfa23('0x4c')];if(!_0x341071[_0xfa23('0x47')]['hasOwnProperty'](_0xfa23('0x71'))){_0x204a8f[_0xfa23('0x2d')]=qs[_0xfa23('0x2d')](_0x341071[_0xfa23('0x47')][_0xfa23('0x2d')]);_0x204a8f[_0xfa23('0x2a')]=qs[_0xfa23('0x2a')](_0x341071[_0xfa23('0x47')][_0xfa23('0x2a')]);}return _0x1de2bb['getAgents'](_0x204a8f);}})[_0xfa23('0x1c')](function(_0x2adb54){if(_0x2adb54){return _0x2adb54?{'count':_0x59ca8a,'rows':_0x2adb54}:null;}})[_0xfa23('0x1c')](respondWithResult(_0xdb4344,null))['catch'](handleError(_0xdb4344,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8b27cb0..a961ae4 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x39c54e,_0x4ecf92){var _0x54a727=function(_0x375a56){while(--_0x375a56){_0x39c54e['push'](_0x39c54e['shift']());}};_0x54a727(++_0x4ecf92);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29e633,_0x4c2016){_0x29e633=_0x29e633-0x0;var _0x5a4e9b=_0x5f2f[_0x29e633];return _0x5a4e9b;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3a4b7f,_0x5b9726){var _0x542e8a=function(_0x558298){while(--_0x558298){_0x3a4b7f['push'](_0x3a4b7f['shift']());}};_0x542e8a(++_0x5b9726);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4f027d,_0x3f9587){_0x4f027d=_0x4f027d-0x0;var _0xc46890=_0x0b0e[_0x4f027d];return _0xc46890;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 34bdcc0..3790e98 100644 --- a/server/api/chatQueue/chatQueue.model.js +++ b/server/api/chatQueue/chatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49df=['../../config/environment','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3c3039,_0xd0a1dc){var _0xc9710d=function(_0x191211){while(--_0x191211){_0x3c3039['push'](_0x3c3039['shift']());}};_0xc9710d(++_0xd0a1dc);}(_0x49df,0x65));var _0xf49d=function(_0x51bd5c,_0x292789){_0x51bd5c=_0x51bd5c-0x0;var _0x5dd8b8=_0x49df[_0x51bd5c];return _0x5dd8b8;};'use strict';var _=require(_0xf49d('0x0'));var util=require('util');var logger=require(_0xf49d('0x1'))(_0xf49d('0x2'));var moment=require(_0xf49d('0x3'));var BPromise=require(_0xf49d('0x4'));var rp=require(_0xf49d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf49d('0x6'));var config=require(_0xf49d('0x7'));var attributes=require('./chatQueue.attributes');module[_0xf49d('0x8')]=function(_0x11b93d,_0x5a6f9c){return _0x11b93d[_0xf49d('0x9')](_0xf49d('0xa'),attributes,{'tableName':_0xf49d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa51c=['path','rimraf','../../config/environment','define','ChatQueue','util','../../config/logger','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa51c,0x165));var _0xca51=function(_0x3c64a4,_0x384162){_0x3c64a4=_0x3c64a4-0x0;var _0x10853c=_0xa51c[_0x3c64a4];return _0x10853c;};'use strict';var _=require('lodash');var util=require(_0xca51('0x0'));var logger=require(_0xca51('0x1'))('api');var moment=require(_0xca51('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xca51('0x3'));var rimraf=require(_0xca51('0x4'));var config=require(_0xca51('0x5'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x526989,_0x5b5edd){return _0x526989[_0xca51('0x6')](_0xca51('0x7'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 8cbb368..ffface8 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94d4=['model','then','debug','where','ShowChatQueue','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','register','request','info','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','attributes','limit','include','map'];(function(_0x512c4c,_0x4bd397){var _0x58c0f1=function(_0x405fad){while(--_0x405fad){_0x512c4c['push'](_0x512c4c['shift']());}};_0x58c0f1(++_0x4bd397);}(_0x94d4,0xa5));var _0x494d=function(_0x1b20bd,_0x474417){_0x1b20bd=_0x1b20bd-0x0;var _0x463f0c=_0x94d4[_0x1b20bd];return _0x463f0c;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x494d('0xc'),'port':0x18eb});var socket=require(_0x494d('0xd'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x494d('0xe')](socket);function respondWithRpcPromise(_0x1d4d21,_0x4f99d0,_0x376694){return new BPromise(function(_0x28bff7,_0x163bdb){return client[_0x494d('0xf')](_0x1d4d21,_0x376694)['then'](function(_0x28d3d1){logger[_0x494d('0x10')]('ChatQueue,\x20%s,\x20%s',_0x4f99d0,'request\x20sent');logger['debug'](_0x494d('0x11'),_0x4f99d0,_0x494d('0x12'),JSON[_0x494d('0x13')](_0x28d3d1));if(_0x28d3d1[_0x494d('0x14')]){if(_0x28d3d1[_0x494d('0x14')][_0x494d('0x15')]===0x1f4){logger[_0x494d('0x14')](_0x494d('0x16'),_0x4f99d0,_0x28d3d1[_0x494d('0x14')][_0x494d('0x17')]);return _0x163bdb(_0x28d3d1[_0x494d('0x14')]['message']);}logger[_0x494d('0x14')](_0x494d('0x16'),_0x4f99d0,_0x28d3d1[_0x494d('0x14')][_0x494d('0x17')]);return _0x28bff7(_0x28d3d1[_0x494d('0x14')][_0x494d('0x17')]);}else{logger[_0x494d('0x10')](_0x494d('0x16'),_0x4f99d0,_0x494d('0x12'));_0x28bff7(_0x28d3d1[_0x494d('0x18')][_0x494d('0x17')]);}})[_0x494d('0x19')](function(_0xb2fc39){logger[_0x494d('0x14')](_0x494d('0x16'),_0x4f99d0,_0xb2fc39);_0x163bdb(_0xb2fc39);});});}exports[_0x494d('0x1a')]=function(_0x134632){var _0x5bf90b=this;return new Promise(function(_0x2be3b5,_0x172763){return db[_0x494d('0x1b')][_0x494d('0x1c')]({'raw':_0x134632['options']?_0x134632['options'][_0x494d('0x1d')]===undefined?!![]:![]:!![],'where':_0x134632[_0x494d('0x1e')]?_0x134632['options']['where']||null:null,'attributes':_0x134632[_0x494d('0x1e')]?_0x134632['options'][_0x494d('0x1f')]||null:null,'limit':_0x134632['options']?_0x134632[_0x494d('0x1e')][_0x494d('0x20')]||null:null,'include':_0x134632['options']?_0x134632[_0x494d('0x1e')][_0x494d('0x21')]?_[_0x494d('0x22')](_0x134632[_0x494d('0x1e')][_0x494d('0x21')],function(_0x575f07){return{'model':db[_0x575f07[_0x494d('0x23')]],'as':_0x575f07['as'],'attributes':_0x575f07[_0x494d('0x1f')],'include':_0x575f07['include']?_['map'](_0x575f07[_0x494d('0x21')],function(_0x43a3a5){return{'model':db[_0x43a3a5[_0x494d('0x23')]],'as':_0x43a3a5['as'],'attributes':_0x43a3a5[_0x494d('0x1f')],'include':_0x43a3a5[_0x494d('0x21')]?_[_0x494d('0x22')](_0x43a3a5[_0x494d('0x21')],function(_0x347c58){return{'model':db[_0x347c58[_0x494d('0x23')]],'as':_0x347c58['as'],'attributes':_0x347c58[_0x494d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x494d('0x24')](function(_0x44f757){logger[_0x494d('0x10')]('GetChatQueue',_0x134632);logger[_0x494d('0x25')](_0x494d('0x1a'),_0x134632,JSON[_0x494d('0x13')](_0x44f757));_0x2be3b5(_0x44f757);})[_0x494d('0x19')](function(_0x2636ce){logger[_0x494d('0x14')](_0x494d('0x1a'),_0x2636ce[_0x494d('0x17')],_0x134632);_0x172763(_0x5bf90b[_0x494d('0x14')](0x1f4,_0x2636ce[_0x494d('0x17')]));});});};exports['ShowChatQueue']=function(_0x24d357){var _0x3692d3=this;return new Promise(function(_0x5de360,_0x3bd0fe){return db[_0x494d('0x1b')]['find']({'raw':_0x24d357['options']?_0x24d357[_0x494d('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x24d357[_0x494d('0x1e')]?_0x24d357[_0x494d('0x1e')][_0x494d('0x26')]||null:null,'attributes':_0x24d357[_0x494d('0x1e')]?_0x24d357['options']['attributes']||null:null,'include':_0x24d357[_0x494d('0x1e')]?_0x24d357[_0x494d('0x1e')][_0x494d('0x21')]?_['map'](_0x24d357['options'][_0x494d('0x21')],function(_0x153959){return{'model':db[_0x153959['model']],'as':_0x153959['as'],'attributes':_0x153959[_0x494d('0x1f')],'include':_0x153959[_0x494d('0x21')]?_[_0x494d('0x22')](_0x153959['include'],function(_0x571e87){return{'model':db[_0x571e87['model']],'as':_0x571e87['as'],'attributes':_0x571e87[_0x494d('0x1f')],'include':_0x571e87['include']?_['map'](_0x571e87[_0x494d('0x21')],function(_0x89b0a7){return{'model':db[_0x89b0a7[_0x494d('0x23')]],'as':_0x89b0a7['as'],'attributes':_0x89b0a7[_0x494d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x494d('0x24')](function(_0x5c20b1){logger[_0x494d('0x10')](_0x494d('0x27'),_0x24d357);logger[_0x494d('0x25')](_0x494d('0x27'),_0x24d357,JSON[_0x494d('0x13')](_0x5c20b1));_0x5de360(_0x5c20b1);})['catch'](function(_0x2a8d3a){logger[_0x494d('0x14')]('ShowChatQueue',_0x2a8d3a[_0x494d('0x17')],_0x24d357);_0x3bd0fe(_0x3692d3[_0x494d('0x14')](0x1f4,_0x2a8d3a[_0x494d('0x17')]));});});}; \ No newline at end of file +var _0x3f9b=['ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','options','raw','where','limit','map','include','model','attributes','ChatQueue','find','ShowChatQueue','moment','randomstring'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x3f9b,0x11e));var _0xb3f9=function(_0xfb90bd,_0x2a03fc){_0xfb90bd=_0xfb90bd-0x0;var _0x236def=_0x3f9b[_0xfb90bd];return _0x236def;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb3f9('0x0'));var BPromise=require('bluebird');var rs=require(_0xb3f9('0x1'));var fs=require('fs');var Redis=require(_0xb3f9('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb3f9('0x3'));var config=require(_0xb3f9('0x4'));var jayson=require(_0xb3f9('0x5'));var client=jayson['client'][_0xb3f9('0x6')]({'port':0x232a});config[_0xb3f9('0x7')]=_[_0xb3f9('0x8')](config[_0xb3f9('0x7')],{'host':_0xb3f9('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb3f9('0xa'))[_0xb3f9('0xb')](socket);function respondWithRpcPromise(_0x52452b,_0x2fba79,_0x4b7690){return new BPromise(function(_0x488a7b,_0x877c5e){return client[_0xb3f9('0xc')](_0x52452b,_0x4b7690)[_0xb3f9('0xd')](function(_0x18d43f){logger[_0xb3f9('0xe')](_0xb3f9('0xf'),_0x2fba79,'request\x20sent');logger[_0xb3f9('0x10')](_0xb3f9('0x11'),_0x2fba79,_0xb3f9('0x12'),JSON[_0xb3f9('0x13')](_0x18d43f));if(_0x18d43f[_0xb3f9('0x14')]){if(_0x18d43f[_0xb3f9('0x14')][_0xb3f9('0x15')]===0x1f4){logger[_0xb3f9('0x14')]('ChatQueue,\x20%s,\x20%s',_0x2fba79,_0x18d43f[_0xb3f9('0x14')]['message']);return _0x877c5e(_0x18d43f['error'][_0xb3f9('0x16')]);}logger[_0xb3f9('0x14')](_0xb3f9('0xf'),_0x2fba79,_0x18d43f[_0xb3f9('0x14')][_0xb3f9('0x16')]);return _0x488a7b(_0x18d43f[_0xb3f9('0x14')][_0xb3f9('0x16')]);}else{logger[_0xb3f9('0xe')]('ChatQueue,\x20%s,\x20%s',_0x2fba79,_0xb3f9('0x12'));_0x488a7b(_0x18d43f['result']['message']);}})[_0xb3f9('0x17')](function(_0x4c629f){logger[_0xb3f9('0x14')](_0xb3f9('0xf'),_0x2fba79,_0x4c629f);_0x877c5e(_0x4c629f);});});}exports[_0xb3f9('0x18')]=function(_0x1b15bc){var _0xe0b155=this;return new Promise(function(_0x23dc0f,_0x4b7da0){return db['ChatQueue']['findAll']({'raw':_0x1b15bc[_0xb3f9('0x19')]?_0x1b15bc[_0xb3f9('0x19')][_0xb3f9('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b15bc['options']?_0x1b15bc['options'][_0xb3f9('0x1b')]||null:null,'attributes':_0x1b15bc[_0xb3f9('0x19')]?_0x1b15bc[_0xb3f9('0x19')]['attributes']||null:null,'limit':_0x1b15bc[_0xb3f9('0x19')]?_0x1b15bc['options'][_0xb3f9('0x1c')]||null:null,'include':_0x1b15bc[_0xb3f9('0x19')]?_0x1b15bc[_0xb3f9('0x19')]['include']?_[_0xb3f9('0x1d')](_0x1b15bc[_0xb3f9('0x19')][_0xb3f9('0x1e')],function(_0x4d70e6){return{'model':db[_0x4d70e6[_0xb3f9('0x1f')]],'as':_0x4d70e6['as'],'attributes':_0x4d70e6[_0xb3f9('0x20')],'include':_0x4d70e6['include']?_[_0xb3f9('0x1d')](_0x4d70e6[_0xb3f9('0x1e')],function(_0x138f3d){return{'model':db[_0x138f3d[_0xb3f9('0x1f')]],'as':_0x138f3d['as'],'attributes':_0x138f3d[_0xb3f9('0x20')],'include':_0x138f3d['include']?_[_0xb3f9('0x1d')](_0x138f3d[_0xb3f9('0x1e')],function(_0x2939f8){return{'model':db[_0x2939f8[_0xb3f9('0x1f')]],'as':_0x2939f8['as'],'attributes':_0x2939f8[_0xb3f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb3f9('0xd')](function(_0xd634f7){logger[_0xb3f9('0xe')](_0xb3f9('0x18'),_0x1b15bc);logger[_0xb3f9('0x10')](_0xb3f9('0x18'),_0x1b15bc,JSON[_0xb3f9('0x13')](_0xd634f7));_0x23dc0f(_0xd634f7);})[_0xb3f9('0x17')](function(_0x564977){logger['error']('GetChatQueue',_0x564977[_0xb3f9('0x16')],_0x1b15bc);_0x4b7da0(_0xe0b155['error'](0x1f4,_0x564977['message']));});});};exports['ShowChatQueue']=function(_0x2728ea){var _0x16e5b8=this;return new Promise(function(_0x47905d,_0x1db8a6){return db[_0xb3f9('0x21')][_0xb3f9('0x22')]({'raw':_0x2728ea['options']?_0x2728ea['options'][_0xb3f9('0x1a')]===undefined?!![]:![]:!![],'where':_0x2728ea['options']?_0x2728ea[_0xb3f9('0x19')][_0xb3f9('0x1b')]||null:null,'attributes':_0x2728ea[_0xb3f9('0x19')]?_0x2728ea['options'][_0xb3f9('0x20')]||null:null,'include':_0x2728ea[_0xb3f9('0x19')]?_0x2728ea[_0xb3f9('0x19')]['include']?_[_0xb3f9('0x1d')](_0x2728ea[_0xb3f9('0x19')]['include'],function(_0x21f16a){return{'model':db[_0x21f16a['model']],'as':_0x21f16a['as'],'attributes':_0x21f16a['attributes'],'include':_0x21f16a[_0xb3f9('0x1e')]?_[_0xb3f9('0x1d')](_0x21f16a['include'],function(_0x5779e8){return{'model':db[_0x5779e8[_0xb3f9('0x1f')]],'as':_0x5779e8['as'],'attributes':_0x5779e8['attributes'],'include':_0x5779e8[_0xb3f9('0x1e')]?_[_0xb3f9('0x1d')](_0x5779e8[_0xb3f9('0x1e')],function(_0x3b8449){return{'model':db[_0x3b8449['model']],'as':_0x3b8449['as'],'attributes':_0x3b8449['attributes']};}):[]};}):[]};}):[]:[]})[_0xb3f9('0xd')](function(_0x56f13e){logger[_0xb3f9('0xe')]('ShowChatQueue',_0x2728ea);logger[_0xb3f9('0x10')](_0xb3f9('0x23'),_0x2728ea,JSON[_0xb3f9('0x13')](_0x56f13e));_0x47905d(_0x56f13e);})[_0xb3f9('0x17')](function(_0x3ae309){logger[_0xb3f9('0x14')](_0xb3f9('0x23'),_0x3ae309[_0xb3f9('0x16')],_0x2728ea);_0x1db8a6(_0x16e5b8[_0xb3f9('0x14')](0x1f4,_0x3ae309['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6409ddd..bfb9831 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x524cae,_0x5c8d1b){var _0xc61797=function(_0x39bb31){while(--_0x39bb31){_0x524cae['push'](_0x524cae['shift']());}};_0xc61797(++_0x5c8d1b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4eb7e6,_0x451464){_0x4eb7e6=_0x4eb7e6-0x0;var _0x3cf508=_0x0b0e[_0x4eb7e6];return _0x3cf508;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0x16ff0e,_0x4e7dc6){var _0x95bd68=function(_0x2b39ba){while(--_0x2b39ba){_0x16ff0e['push'](_0x16ff0e['shift']());}};_0x95bd68(++_0x4e7dc6);}(_0xadb5,0xad));var _0x5adb=function(_0x343a59,_0x37194a){_0x343a59=_0x343a59-0x0;var _0xc184=_0xadb5[_0x343a59];return _0xc184;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9e34285..96c31bf 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x895e=['Router','fs-extra','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getAgents','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','util','path','connect-timeout','express'];(function(_0x4604f0,_0x6de84f){var _0x3edd9e=function(_0x4135b5){while(--_0x4135b5){_0x4604f0['push'](_0x4604f0['shift']());}};_0x3edd9e(++_0x6de84f);}(_0x895e,0xab));var _0xe895=function(_0x24e924,_0x54df20){_0x24e924=_0x24e924-0x0;var _0x75c9cc=_0x895e[_0x24e924];return _0x75c9cc;};'use strict';var multer=require('multer');var util=require(_0xe895('0x0'));var path=require(_0xe895('0x1'));var timeout=require(_0xe895('0x2'));var express=require(_0xe895('0x3'));var router=express[_0xe895('0x4')]();var fs_extra=require(_0xe895('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe895('0x6'));var config=require('../../config/environment');var controller=require(_0xe895('0x7'));router[_0xe895('0x8')]('/',auth[_0xe895('0x9')](),controller['index']);router[_0xe895('0x8')](_0xe895('0xa'),auth['isAuthenticated'](),controller[_0xe895('0xb')]);router[_0xe895('0x8')](_0xe895('0xc'),auth[_0xe895('0x9')](),controller[_0xe895('0xd')]);router['get'](_0xe895('0xe'),auth[_0xe895('0x9')](),controller[_0xe895('0xf')]);router[_0xe895('0x8')]('/:id/teams',auth[_0xe895('0x9')](),controller['getTeams']);router[_0xe895('0x8')]('/:id/users',auth[_0xe895('0x9')](),controller[_0xe895('0x10')]);router[_0xe895('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe895('0x11')]('/:id/teams',auth[_0xe895('0x9')](),controller[_0xe895('0x12')]);router['post'](_0xe895('0x13'),auth[_0xe895('0x9')](),controller[_0xe895('0x14')]);router[_0xe895('0x15')]('/:id',auth[_0xe895('0x9')](),controller['update']);router[_0xe895('0x16')](_0xe895('0xc'),auth[_0xe895('0x9')](),controller[_0xe895('0x17')]);router[_0xe895('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe895('0x18')]);router[_0xe895('0x16')](_0xe895('0x13'),auth[_0xe895('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4123=['/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatQueue.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x31405e,_0x2bf822){var _0x2e146e=function(_0x7d0962){while(--_0x7d0962){_0x31405e['push'](_0x31405e['shift']());}};_0x2e146e(++_0x2bf822);}(_0x4123,0x87));var _0x3412=function(_0x4e4bb2,_0xee929e){_0x4e4bb2=_0x4e4bb2-0x0;var _0x3835db=_0x4123[_0x4e4bb2];return _0x3835db;};'use strict';var multer=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var path=require(_0x3412('0x2'));var timeout=require(_0x3412('0x3'));var express=require(_0x3412('0x4'));var router=express[_0x3412('0x5')]();var fs_extra=require(_0x3412('0x6'));var auth=require(_0x3412('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3412('0x8'));router[_0x3412('0x9')]('/',auth['isAuthenticated'](),controller[_0x3412('0xa')]);router[_0x3412('0x9')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0xd')]);router[_0x3412('0x9')]('/:id',auth[_0x3412('0xc')](),controller[_0x3412('0xe')]);router[_0x3412('0x9')](_0x3412('0xf'),auth[_0x3412('0xc')](),controller[_0x3412('0x10')]);router[_0x3412('0x9')](_0x3412('0x11'),auth[_0x3412('0xc')](),controller['getTeams']);router['get'](_0x3412('0x12'),auth[_0x3412('0xc')](),controller[_0x3412('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3412('0x14')](_0x3412('0x11'),auth[_0x3412('0xc')](),controller[_0x3412('0x15')]);router[_0x3412('0x14')](_0x3412('0x12'),auth[_0x3412('0xc')](),controller[_0x3412('0x16')]);router[_0x3412('0x17')](_0x3412('0x18'),auth[_0x3412('0xc')](),controller[_0x3412('0x19')]);router[_0x3412('0x1a')](_0x3412('0x18'),auth['isAuthenticated'](),controller[_0x3412('0x1b')]);router[_0x3412('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x3412('0x1a')](_0x3412('0x12'),auth[_0x3412('0xc')](),controller[_0x3412('0x1c')]);module[_0x3412('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1d7204f..31e73ca 100644 --- a/server/api/chatQueueReport/chatQueueReport.attributes.js +++ b/server/api/chatQueueReport/chatQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae5f=['sequelize','exports','STRING','DATE','moment'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xae5f,0x103));var _0xfae5=function(_0xed54ae,_0x2ce107){_0xed54ae=_0xed54ae-0x0;var _0x3f8120=_0xae5f[_0xed54ae];return _0x3f8120;};'use strict';var moment=require(_0xfae5('0x0'));var Sequelize=require(_0xfae5('0x1'));module[_0xfae5('0x2')]={'uniqueid':{'type':Sequelize[_0xfae5('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfae5('0x4')]},'leaveAt':{'type':Sequelize[_0xfae5('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfae5('0x4')]},'reason':{'type':Sequelize[_0xfae5('0x3')]}}; \ No newline at end of file +var _0x16e8=['STRING','DATE','sequelize'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x16e8,0x83));var _0x816e=function(_0x6feaa7,_0x195c2f){_0x6feaa7=_0x6feaa7-0x0;var _0x3edfcc=_0x16e8[_0x6feaa7];return _0x3edfcc;};'use strict';var moment=require('moment');var Sequelize=require(_0x816e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x816e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x816e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x816e('0x2')]},'acceptAt':{'type':Sequelize[_0x816e('0x2')]},'exitAt':{'type':Sequelize[_0x816e('0x2')]},'reason':{'type':Sequelize[_0x816e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 638ee95..16e30b2 100644 --- a/server/api/chatQueueReport/chatQueueReport.controller.js +++ b/server/api/chatQueueReport/chatQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40f7=['update','then','destroy','error','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','ChatQueueReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','params','describe','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save'];(function(_0x4ee3e0,_0x4f57f1){var _0x3bc180=function(_0x539bfc){while(--_0x539bfc){_0x4ee3e0['push'](_0x4ee3e0['shift']());}};_0x3bc180(++_0x4f57f1);}(_0x40f7,0x1b9));var _0x740f=function(_0x44c722,_0x3e3e7e){_0x44c722=_0x44c722-0x0;var _0x354b6f=_0x40f7[_0x44c722];return _0x354b6f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x740f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x740f('0x1'));var Mustache=require(_0x740f('0x2'));var util=require(_0x740f('0x3'));var path=require('path');var sox=require(_0x740f('0x4'));var csv=require(_0x740f('0x5'));var ejs=require(_0x740f('0x6'));var fs=require('fs');var fs_extra=require(_0x740f('0x7'));var _=require(_0x740f('0x8'));var squel=require(_0x740f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x740f('0xa'));var toCsv=require(_0x740f('0x5'));var querystring=require('querystring');var Papa=require(_0x740f('0xb'));var Redis=require(_0x740f('0xc'));var authService=require(_0x740f('0xd'));var qs=require(_0x740f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x740f('0xf'));var logger=require(_0x740f('0x10'))(_0x740f('0x11'));var utils=require(_0x740f('0x12'));var config=require(_0x740f('0x13'));var licenseUtil=require(_0x740f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a49bb,_0x48f003){_0x48f003=_0x48f003||0xcc;return function(_0x15e9ce){if(_0x15e9ce){return _0x5a49bb[_0x740f('0x15')](_0x48f003);}return _0x5a49bb[_0x740f('0x16')](_0x48f003)[_0x740f('0x17')]();};}function respondWithResult(_0x3ed47f,_0x9722a6){_0x9722a6=_0x9722a6||0xc8;return function(_0x441ef){if(_0x441ef){return _0x3ed47f[_0x740f('0x16')](_0x9722a6)['json'](_0x441ef);}};}function respondWithFilteredResult(_0x31b03c,_0x435d10){return function(_0x1b2f91){if(_0x1b2f91){var _0xc78e4b=typeof _0x435d10[_0x740f('0x18')]==='undefined'&&typeof _0x435d10[_0x740f('0x19')]===_0x740f('0x1a');var _0x52bd19=_0x1b2f91['count'];var _0x21ac01=_0xc78e4b?0x0:_0x435d10[_0x740f('0x18')];var _0x36fae1=_0xc78e4b?_0x1b2f91[_0x740f('0x1b')]:_0x435d10[_0x740f('0x18')]+_0x435d10[_0x740f('0x19')];var _0x25e723;if(_0x36fae1>=_0x52bd19){_0x36fae1=_0x52bd19;_0x25e723=0xc8;}else{_0x25e723=0xce;}_0x31b03c[_0x740f('0x16')](_0x25e723);return _0x31b03c[_0x740f('0x1c')](_0x740f('0x1d'),_0x21ac01+'-'+_0x36fae1+'/'+_0x52bd19)[_0x740f('0x1e')](_0x1b2f91);}return null;};}function patchUpdates(_0xdb4a13){return function(_0x27d0e8){try{jsonpatch[_0x740f('0x1f')](_0x27d0e8,_0xdb4a13,!![]);}catch(_0x41cf40){return BPromise['reject'](_0x41cf40);}return _0x27d0e8[_0x740f('0x20')]();};}function saveUpdates(_0x1fe8a7,_0x116634){return function(_0x322972){if(_0x322972){return _0x322972[_0x740f('0x21')](_0x1fe8a7)[_0x740f('0x22')](function(_0x1a394d){return _0x1a394d;});}return null;};}function removeEntity(_0x3d73cd,_0x2c9157){return function(_0xc581e1){if(_0xc581e1){return _0xc581e1[_0x740f('0x23')]()[_0x740f('0x22')](function(){_0x3d73cd['status'](0xcc)[_0x740f('0x17')]();});}};}function handleEntityNotFound(_0x8f4753,_0x17f192){return function(_0x2287be){if(!_0x2287be){_0x8f4753[_0x740f('0x15')](0x194);}return _0x2287be;};}function handleError(_0x18ac82,_0x3c9f5f){_0x3c9f5f=_0x3c9f5f||0x1f4;return function(_0x1df214){logger[_0x740f('0x24')](_0x1df214['stack']);if(_0x1df214['name']){delete _0x1df214[_0x740f('0x25')];}_0x18ac82[_0x740f('0x16')](_0x3c9f5f)[_0x740f('0x26')](_0x1df214);};}function getMustacheRender(_0x585860,_0x352d15){return Mustache[_0x740f('0x27')](_0x585860,_[_0x740f('0x28')](_0x352d15[_0x740f('0x29')],{'contact':_0x352d15[_0x740f('0x2a')],'message':_0x352d15[_0x740f('0x2b')],'agent':_0x352d15[_0x740f('0x2c')],'interaction':_0x352d15[_0x740f('0x2d')],'account':_0x352d15[_0x740f('0x2e')]}))||'';}exports[_0x740f('0x2f')]=function(_0x57ed92,_0x56cdc3){var _0x27ed6e={},_0x5e7f14={},_0x232b75={'count':0x0,'rows':[]};var _0x533a02=_[_0x740f('0x30')](db[_0x740f('0x31')][_0x740f('0x32')],function(_0x4d8e03){return{'name':_0x4d8e03['fieldName'],'type':_0x4d8e03[_0x740f('0x33')][_0x740f('0x34')]};});_0x5e7f14[_0x740f('0x35')]=_['map'](_0x533a02,_0x740f('0x25'));_0x5e7f14['query']=_[_0x740f('0x36')](_0x57ed92['query']);_0x5e7f14[_0x740f('0x37')]=_[_0x740f('0x38')](_0x5e7f14['model'],_0x5e7f14[_0x740f('0x39')]);_0x27ed6e[_0x740f('0x3a')]=_['intersection'](_0x5e7f14['model'],qs[_0x740f('0x3b')](_0x57ed92[_0x740f('0x39')][_0x740f('0x3b')]));_0x27ed6e[_0x740f('0x3a')]=_0x27ed6e['attributes'][_0x740f('0x3c')]?_0x27ed6e[_0x740f('0x3a')]:_0x5e7f14[_0x740f('0x35')];if(!_0x57ed92[_0x740f('0x39')][_0x740f('0x3d')](_0x740f('0x3e'))){_0x27ed6e[_0x740f('0x19')]=qs['limit'](_0x57ed92[_0x740f('0x39')]['limit']);_0x27ed6e['offset']=qs[_0x740f('0x18')](_0x57ed92[_0x740f('0x39')][_0x740f('0x18')]);}_0x27ed6e['order']=qs[_0x740f('0x3f')](_0x57ed92[_0x740f('0x39')][_0x740f('0x3f')]);_0x27ed6e[_0x740f('0x40')]=qs[_0x740f('0x37')](_[_0x740f('0x41')](_0x57ed92[_0x740f('0x39')],_0x5e7f14[_0x740f('0x37')]),_0x533a02);if(_0x57ed92[_0x740f('0x39')][_0x740f('0x42')]){_0x27ed6e[_0x740f('0x40')]=_[_0x740f('0x28')](_0x27ed6e[_0x740f('0x40')],{'$or':_[_0x740f('0x30')](_0x533a02,function(_0x427c09){if(_0x427c09[_0x740f('0x33')]!==_0x740f('0x43')){var _0x47ce31={};_0x47ce31[_0x427c09[_0x740f('0x25')]]={'$like':'%'+_0x57ed92['query'][_0x740f('0x42')]+'%'};return _0x47ce31;}})});}_0x27ed6e=_[_0x740f('0x28')]({},_0x27ed6e,_0x57ed92[_0x740f('0x44')]);var _0x1e4d96={'where':_0x27ed6e[_0x740f('0x40')]};return db['ChatQueueReport'][_0x740f('0x1b')](_0x1e4d96)[_0x740f('0x22')](function(_0xe17359){_0x232b75[_0x740f('0x1b')]=_0xe17359;if(_0x57ed92[_0x740f('0x39')]['includeAll']){_0x27ed6e[_0x740f('0x45')]=[{'all':!![]}];}return db[_0x740f('0x31')][_0x740f('0x46')](_0x27ed6e);})[_0x740f('0x22')](function(_0x37f339){_0x232b75[_0x740f('0x47')]=_0x37f339;return _0x232b75;})['then'](respondWithFilteredResult(_0x56cdc3,_0x27ed6e))[_0x740f('0x48')](handleError(_0x56cdc3,null));};exports[_0x740f('0x49')]=function(_0x40b9f8,_0x45fc97){var _0x3b16c4={'raw':!![],'where':{'id':_0x40b9f8['params']['id']}},_0x44bd9f={};_0x44bd9f[_0x740f('0x35')]=_['keys'](db[_0x740f('0x31')][_0x740f('0x32')]);_0x44bd9f[_0x740f('0x39')]=_['keys'](_0x40b9f8[_0x740f('0x39')]);_0x44bd9f['filters']=_[_0x740f('0x38')](_0x44bd9f['model'],_0x44bd9f[_0x740f('0x39')]);_0x3b16c4[_0x740f('0x3a')]=_[_0x740f('0x38')](_0x44bd9f[_0x740f('0x35')],qs[_0x740f('0x3b')](_0x40b9f8[_0x740f('0x39')][_0x740f('0x3b')]));_0x3b16c4[_0x740f('0x3a')]=_0x3b16c4['attributes']['length']?_0x3b16c4[_0x740f('0x3a')]:_0x44bd9f[_0x740f('0x35')];if(_0x40b9f8[_0x740f('0x39')][_0x740f('0x4a')]){_0x3b16c4[_0x740f('0x45')]=[{'all':!![]}];}_0x3b16c4=_['merge']({},_0x3b16c4,_0x40b9f8[_0x740f('0x44')]);return db['ChatQueueReport'][_0x740f('0x4b')](_0x3b16c4)[_0x740f('0x22')](handleEntityNotFound(_0x45fc97,null))['then'](respondWithResult(_0x45fc97,null))[_0x740f('0x48')](handleError(_0x45fc97,null));};exports[_0x740f('0x4c')]=function(_0x563c1d,_0x4a0276){return db[_0x740f('0x31')][_0x740f('0x4c')](_0x563c1d['body'],{})['then'](respondWithResult(_0x4a0276,0xc9))['catch'](handleError(_0x4a0276,null));};exports[_0x740f('0x21')]=function(_0x28075f,_0x4af8e3){if(_0x28075f[_0x740f('0x29')]['id']){delete _0x28075f[_0x740f('0x29')]['id'];}return db[_0x740f('0x31')][_0x740f('0x4b')]({'where':{'id':_0x28075f['params']['id']}})[_0x740f('0x22')](handleEntityNotFound(_0x4af8e3,null))[_0x740f('0x22')](saveUpdates(_0x28075f[_0x740f('0x29')],null))[_0x740f('0x22')](respondWithResult(_0x4af8e3,null))[_0x740f('0x48')](handleError(_0x4af8e3,null));};exports['destroy']=function(_0xdde2ba,_0xc79d52){return db[_0x740f('0x31')][_0x740f('0x4b')]({'where':{'id':_0xdde2ba[_0x740f('0x4d')]['id']}})[_0x740f('0x22')](handleEntityNotFound(_0xc79d52,null))[_0x740f('0x22')](removeEntity(_0xc79d52,null))[_0x740f('0x48')](handleError(_0xc79d52,null));};exports[_0x740f('0x4e')]=function(_0x43d3b0,_0x1f0d88){return db['ChatQueueReport'][_0x740f('0x4e')]()[_0x740f('0x22')](respondWithResult(_0x1f0d88,null))[_0x740f('0x48')](handleError(_0x1f0d88,null));}; \ No newline at end of file +var _0xab59=['limit','status','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','body','contact','message','interaction','account','ChatQueueReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','keys','create','find','params','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count'];(function(_0x153a9b,_0x3b0477){var _0x4718ec=function(_0x2c51dd){while(--_0x2c51dd){_0x153a9b['push'](_0x153a9b['shift']());}};_0x4718ec(++_0x3b0477);}(_0xab59,0x11c));var _0x9ab5=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xab59[_0x51c819];return _0x15c5d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ab5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9ab5('0x1'));var moment=require(_0x9ab5('0x2'));var BPromise=require(_0x9ab5('0x3'));var Mustache=require(_0x9ab5('0x4'));var util=require(_0x9ab5('0x5'));var path=require(_0x9ab5('0x6'));var sox=require('sox');var csv=require(_0x9ab5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ab5('0x8'));var _=require(_0x9ab5('0x9'));var squel=require('squel');var crypto=require(_0x9ab5('0xa'));var jsforce=require(_0x9ab5('0xb'));var deskjs=require(_0x9ab5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9ab5('0xd'));var Papa=require(_0x9ab5('0xe'));var Redis=require(_0x9ab5('0xf'));var authService=require(_0x9ab5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9ab5('0x11'));var hardwareService=require(_0x9ab5('0x12'));var logger=require(_0x9ab5('0x13'))(_0x9ab5('0x14'));var utils=require('../../config/utils');var config=require(_0x9ab5('0x15'));var licenseUtil=require(_0x9ab5('0x16'));var db=require(_0x9ab5('0x17'))['db'];function respondWithStatusCode(_0x1e41a1,_0x8dbaf0){_0x8dbaf0=_0x8dbaf0||0xcc;return function(_0x104bd9){if(_0x104bd9){return _0x1e41a1['sendStatus'](_0x8dbaf0);}return _0x1e41a1['status'](_0x8dbaf0)[_0x9ab5('0x18')]();};}function respondWithResult(_0x3e69de,_0x2ee35a){_0x2ee35a=_0x2ee35a||0xc8;return function(_0x382584){if(_0x382584){return _0x3e69de['status'](_0x2ee35a)[_0x9ab5('0x19')](_0x382584);}};}function respondWithFilteredResult(_0x427f22,_0x59ea34){return function(_0x57dabd){if(_0x57dabd){var _0x229122=typeof _0x59ea34['offset']===_0x9ab5('0x1a')&&typeof _0x59ea34['limit']==='undefined';var _0x3dcf4f=_0x57dabd[_0x9ab5('0x1b')];var _0xab53f4=_0x229122?0x0:_0x59ea34['offset'];var _0x459e70=_0x229122?_0x57dabd['count']:_0x59ea34['offset']+_0x59ea34[_0x9ab5('0x1c')];var _0x55311f;if(_0x459e70>=_0x3dcf4f){_0x459e70=_0x3dcf4f;_0x55311f=0xc8;}else{_0x55311f=0xce;}_0x427f22[_0x9ab5('0x1d')](_0x55311f);return _0x427f22[_0x9ab5('0x1e')](_0x9ab5('0x1f'),_0xab53f4+'-'+_0x459e70+'/'+_0x3dcf4f)[_0x9ab5('0x19')](_0x57dabd);}return null;};}function patchUpdates(_0xafa798){return function(_0x2d6bce){try{jsonpatch['apply'](_0x2d6bce,_0xafa798,!![]);}catch(_0x4699c5){return BPromise[_0x9ab5('0x20')](_0x4699c5);}return _0x2d6bce['save']();};}function saveUpdates(_0x33b3c3,_0x1cd571){return function(_0x931516){if(_0x931516){return _0x931516[_0x9ab5('0x21')](_0x33b3c3)[_0x9ab5('0x22')](function(_0x1b92a0){return _0x1b92a0;});}return null;};}function removeEntity(_0x2401f1,_0x1dc62a){return function(_0x437393){if(_0x437393){return _0x437393[_0x9ab5('0x23')]()[_0x9ab5('0x22')](function(){_0x2401f1[_0x9ab5('0x1d')](0xcc)[_0x9ab5('0x18')]();});}};}function handleEntityNotFound(_0x4123ae,_0x400b3f){return function(_0x9166ea){if(!_0x9166ea){_0x4123ae[_0x9ab5('0x24')](0x194);}return _0x9166ea;};}function handleError(_0x1d9e98,_0x42de5e){_0x42de5e=_0x42de5e||0x1f4;return function(_0x394fa0){logger[_0x9ab5('0x25')](_0x394fa0[_0x9ab5('0x26')]);if(_0x394fa0[_0x9ab5('0x27')]){delete _0x394fa0[_0x9ab5('0x27')];}_0x1d9e98['status'](_0x42de5e)['send'](_0x394fa0);};}function getMustacheRender(_0x124657,_0x889143){return Mustache['render'](_0x124657,_['merge'](_0x889143[_0x9ab5('0x28')],{'contact':_0x889143[_0x9ab5('0x29')],'message':_0x889143[_0x9ab5('0x2a')],'agent':_0x889143['agent'],'interaction':_0x889143[_0x9ab5('0x2b')],'account':_0x889143[_0x9ab5('0x2c')]}))||'';}exports['index']=function(_0x1fd858,_0x179e7b){var _0x48c370={},_0x5e2795={},_0x8fa3c8={'count':0x0,'rows':[]};var _0x3859ae=_['map'](db[_0x9ab5('0x2d')][_0x9ab5('0x2e')],function(_0x32fbff){return{'name':_0x32fbff['fieldName'],'type':_0x32fbff[_0x9ab5('0x2f')][_0x9ab5('0x30')]};});_0x5e2795[_0x9ab5('0x31')]=_['map'](_0x3859ae,_0x9ab5('0x27'));_0x5e2795[_0x9ab5('0x32')]=_['keys'](_0x1fd858['query']);_0x5e2795['filters']=_[_0x9ab5('0x33')](_0x5e2795[_0x9ab5('0x31')],_0x5e2795[_0x9ab5('0x32')]);_0x48c370[_0x9ab5('0x34')]=_[_0x9ab5('0x33')](_0x5e2795[_0x9ab5('0x31')],qs[_0x9ab5('0x35')](_0x1fd858[_0x9ab5('0x32')][_0x9ab5('0x35')]));_0x48c370[_0x9ab5('0x34')]=_0x48c370[_0x9ab5('0x34')][_0x9ab5('0x36')]?_0x48c370['attributes']:_0x5e2795[_0x9ab5('0x31')];if(!_0x1fd858[_0x9ab5('0x32')][_0x9ab5('0x37')](_0x9ab5('0x38'))){_0x48c370['limit']=qs[_0x9ab5('0x1c')](_0x1fd858['query']['limit']);_0x48c370['offset']=qs['offset'](_0x1fd858[_0x9ab5('0x32')][_0x9ab5('0x39')]);}_0x48c370[_0x9ab5('0x3a')]=qs[_0x9ab5('0x3b')](_0x1fd858[_0x9ab5('0x32')][_0x9ab5('0x3b')]);_0x48c370[_0x9ab5('0x3c')]=qs[_0x9ab5('0x3d')](_[_0x9ab5('0x3e')](_0x1fd858[_0x9ab5('0x32')],_0x5e2795[_0x9ab5('0x3d')]),_0x3859ae);if(_0x1fd858[_0x9ab5('0x32')]['filter']){_0x48c370[_0x9ab5('0x3c')]=_[_0x9ab5('0x3f')](_0x48c370[_0x9ab5('0x3c')],{'$or':_[_0x9ab5('0x40')](_0x3859ae,function(_0x49b98a){if(_0x49b98a[_0x9ab5('0x2f')]!=='VIRTUAL'){var _0x951639={};_0x951639[_0x49b98a[_0x9ab5('0x27')]]={'$like':'%'+_0x1fd858[_0x9ab5('0x32')][_0x9ab5('0x41')]+'%'};return _0x951639;}})});}_0x48c370=_['merge']({},_0x48c370,_0x1fd858[_0x9ab5('0x42')]);var _0xead54={'where':_0x48c370[_0x9ab5('0x3c')]};return db[_0x9ab5('0x2d')][_0x9ab5('0x1b')](_0xead54)['then'](function(_0x2ece40){_0x8fa3c8['count']=_0x2ece40;if(_0x1fd858[_0x9ab5('0x32')][_0x9ab5('0x43')]){_0x48c370[_0x9ab5('0x44')]=[{'all':!![]}];}return db[_0x9ab5('0x2d')][_0x9ab5('0x45')](_0x48c370);})[_0x9ab5('0x22')](function(_0x4ac7c3){_0x8fa3c8[_0x9ab5('0x46')]=_0x4ac7c3;return _0x8fa3c8;})[_0x9ab5('0x22')](respondWithFilteredResult(_0x179e7b,_0x48c370))[_0x9ab5('0x47')](handleError(_0x179e7b,null));};exports[_0x9ab5('0x48')]=function(_0x3c4125,_0x10a37a){var _0x1442db={'raw':!![],'where':{'id':_0x3c4125['params']['id']}},_0x151825={};_0x151825[_0x9ab5('0x31')]=_[_0x9ab5('0x49')](db[_0x9ab5('0x2d')][_0x9ab5('0x2e')]);_0x151825[_0x9ab5('0x32')]=_[_0x9ab5('0x49')](_0x3c4125[_0x9ab5('0x32')]);_0x151825[_0x9ab5('0x3d')]=_[_0x9ab5('0x33')](_0x151825[_0x9ab5('0x31')],_0x151825[_0x9ab5('0x32')]);_0x1442db[_0x9ab5('0x34')]=_[_0x9ab5('0x33')](_0x151825[_0x9ab5('0x31')],qs[_0x9ab5('0x35')](_0x3c4125[_0x9ab5('0x32')][_0x9ab5('0x35')]));_0x1442db[_0x9ab5('0x34')]=_0x1442db[_0x9ab5('0x34')][_0x9ab5('0x36')]?_0x1442db[_0x9ab5('0x34')]:_0x151825['model'];if(_0x3c4125['query']['includeAll']){_0x1442db[_0x9ab5('0x44')]=[{'all':!![]}];}_0x1442db=_[_0x9ab5('0x3f')]({},_0x1442db,_0x3c4125['options']);return db['ChatQueueReport']['find'](_0x1442db)[_0x9ab5('0x22')](handleEntityNotFound(_0x10a37a,null))['then'](respondWithResult(_0x10a37a,null))['catch'](handleError(_0x10a37a,null));};exports[_0x9ab5('0x4a')]=function(_0x7f516b,_0x2856ee){return db['ChatQueueReport'][_0x9ab5('0x4a')](_0x7f516b[_0x9ab5('0x28')],{})[_0x9ab5('0x22')](respondWithResult(_0x2856ee,0xc9))['catch'](handleError(_0x2856ee,null));};exports[_0x9ab5('0x21')]=function(_0x117ca7,_0x5783c4){if(_0x117ca7[_0x9ab5('0x28')]['id']){delete _0x117ca7[_0x9ab5('0x28')]['id'];}return db[_0x9ab5('0x2d')][_0x9ab5('0x4b')]({'where':{'id':_0x117ca7[_0x9ab5('0x4c')]['id']}})[_0x9ab5('0x22')](handleEntityNotFound(_0x5783c4,null))[_0x9ab5('0x22')](saveUpdates(_0x117ca7[_0x9ab5('0x28')],null))[_0x9ab5('0x22')](respondWithResult(_0x5783c4,null))['catch'](handleError(_0x5783c4,null));};exports['destroy']=function(_0x49f829,_0x3fbaaf){return db['ChatQueueReport'][_0x9ab5('0x4b')]({'where':{'id':_0x49f829[_0x9ab5('0x4c')]['id']}})[_0x9ab5('0x22')](handleEntityNotFound(_0x3fbaaf,null))[_0x9ab5('0x22')](removeEntity(_0x3fbaaf,null))[_0x9ab5('0x47')](handleError(_0x3fbaaf,null));};exports[_0x9ab5('0x4d')]=function(_0x6350c0,_0x2943ba){return db[_0x9ab5('0x2d')]['describe']()[_0x9ab5('0x22')](respondWithResult(_0x2943ba,null))['catch'](handleError(_0x2943ba,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 45e718f..4879489 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90e6=['request-promise','path','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x90e6,0x16f));var _0x690e=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x90e6[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0x690e('0x0'));var util=require(_0x690e('0x1'));var logger=require(_0x690e('0x2'))('api');var moment=require(_0x690e('0x3'));var BPromise=require(_0x690e('0x4'));var rp=require(_0x690e('0x5'));var fs=require('fs');var path=require(_0x690e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x690e('0x7'));module[_0x690e('0x8')]=function(_0xbcc6f7,_0x565dc6){return _0xbcc6f7[_0x690e('0x9')]('ChatQueueReport',attributes,{'tableName':_0x690e('0xa'),'paranoid':![],'indexes':[{'name':_0x690e('0xb'),'fields':[_0x690e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8a=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_chat_queue','uniqueid'];(function(_0xf3092c,_0x25c80e){var _0x4375aa=function(_0x5b7340){while(--_0x5b7340){_0xf3092c['push'](_0xf3092c['shift']());}};_0x4375aa(++_0x25c80e);}(_0x2c8a,0xc6));var _0xa2c8=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x2c8a[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xa2c8('0x0'));var util=require('util');var logger=require(_0xa2c8('0x1'))(_0xa2c8('0x2'));var moment=require('moment');var BPromise=require(_0xa2c8('0x3'));var rp=require(_0xa2c8('0x4'));var fs=require('fs');var path=require(_0xa2c8('0x5'));var rimraf=require(_0xa2c8('0x6'));var config=require(_0xa2c8('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0xa2c8('0x8')]=function(_0x452e1b,_0x2e4a03){return _0x452e1b['define']('ChatQueueReport',attributes,{'tableName':_0xa2c8('0x9'),'paranoid':![],'indexes':[{'name':_0xa2c8('0xa'),'fields':[_0xa2c8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 38ee76f..9405503 100644 --- a/server/api/chatQueueReport/chatQueueReport.rpc.js +++ b/server/api/chatQueueReport/chatQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7757=['then','debug','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','CreateChatQueueReport','body','options','UpdateChatQueueReport','ChatQueueReport','raw','where'];(function(_0x55a440,_0x5dacbc){var _0x1561b9=function(_0x92ebd4){while(--_0x92ebd4){_0x55a440['push'](_0x55a440['shift']());}};_0x1561b9(++_0x5dacbc);}(_0x7757,0xe2));var _0x7775=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7757[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7775('0x0'));var util=require('util');var moment=require(_0x7775('0x1'));var BPromise=require(_0x7775('0x2'));var rs=require(_0x7775('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7775('0x4'));var logger=require(_0x7775('0x5'))(_0x7775('0x6'));var config=require(_0x7775('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7775('0x8')][_0x7775('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52cc6f,_0x2c69d1,_0x28ea3a){return new BPromise(function(_0x61c4b1,_0x29fb5d){return client[_0x7775('0xa')](_0x52cc6f,_0x28ea3a)['then'](function(_0xd1c098){logger['info'](_0x7775('0xb'),_0x2c69d1,'request\x20sent');logger['debug'](_0x7775('0xc'),_0x2c69d1,_0x7775('0xd'),JSON[_0x7775('0xe')](_0xd1c098));if(_0xd1c098[_0x7775('0xf')]){if(_0xd1c098[_0x7775('0xf')]['code']===0x1f4){logger[_0x7775('0xf')](_0x7775('0xb'),_0x2c69d1,_0xd1c098[_0x7775('0xf')]['message']);return _0x29fb5d(_0xd1c098[_0x7775('0xf')][_0x7775('0x10')]);}logger[_0x7775('0xf')](_0x7775('0xb'),_0x2c69d1,_0xd1c098[_0x7775('0xf')][_0x7775('0x10')]);return _0x61c4b1(_0xd1c098[_0x7775('0xf')][_0x7775('0x10')]);}else{logger[_0x7775('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2c69d1,_0x7775('0xd'));_0x61c4b1(_0xd1c098['result']['message']);}})[_0x7775('0x12')](function(_0x5cef87){logger[_0x7775('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x2c69d1,_0x5cef87);_0x29fb5d(_0x5cef87);});});}exports[_0x7775('0x13')]=function(_0xcca1d2){var _0x3707fb=this;return new Promise(function(_0x15c096,_0xd72e64){return db['ChatQueueReport']['create'](_0xcca1d2[_0x7775('0x14')],{'raw':_0xcca1d2[_0x7775('0x15')]?_0xcca1d2['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xfe320e){logger[_0x7775('0x11')]('CreateChatQueueReport',_0xcca1d2);logger['debug'](_0x7775('0x13'),_0xcca1d2,JSON['stringify'](_0xfe320e));_0x15c096(_0xfe320e);})[_0x7775('0x12')](function(_0x37fbe7){logger[_0x7775('0xf')](_0x7775('0x13'),_0x37fbe7[_0x7775('0x10')],_0xcca1d2);_0xd72e64(_0x3707fb[_0x7775('0xf')](0x1f4,_0x37fbe7['message']));});});};exports[_0x7775('0x16')]=function(_0x48415e){var _0x2466c0=this;return new Promise(function(_0x10ece7,_0x4cbe6b){return db[_0x7775('0x17')]['update'](_0x48415e[_0x7775('0x14')],{'raw':_0x48415e['options']?_0x48415e['options'][_0x7775('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48415e[_0x7775('0x15')]?_0x48415e[_0x7775('0x15')][_0x7775('0x19')]||null:null,'attributes':_0x48415e[_0x7775('0x15')]?_0x48415e['options']['attributes']||null:null,'limit':_0x48415e[_0x7775('0x15')]?_0x48415e[_0x7775('0x15')]['limit']||null:null})[_0x7775('0x1a')](function(_0x3b5ccb){logger[_0x7775('0x11')]('UpdateChatQueueReport',_0x48415e);logger[_0x7775('0x1b')](_0x7775('0x16'),_0x48415e,JSON[_0x7775('0xe')](_0x3b5ccb));_0x10ece7(_0x3b5ccb);})[_0x7775('0x12')](function(_0x503455){logger[_0x7775('0xf')](_0x7775('0x16'),_0x503455['message'],_0x48415e);_0x4cbe6b(_0x2466c0[_0x7775('0xf')](0x1f4,_0x503455[_0x7775('0x10')]));});});}; \ No newline at end of file +var _0x3d7f=['rpc','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e498c,_0x417ed2){var _0x9a25df=function(_0x3454d7){while(--_0x3454d7){_0x1e498c['push'](_0x1e498c['shift']());}};_0x9a25df(++_0x417ed2);}(_0x3d7f,0x16d));var _0xf3d7=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x3d7f[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0xf3d7('0x0'));var util=require(_0xf3d7('0x1'));var moment=require(_0xf3d7('0x2'));var BPromise=require(_0xf3d7('0x3'));var rs=require(_0xf3d7('0x4'));var fs=require('fs');var Redis=require(_0xf3d7('0x5'));var db=require(_0xf3d7('0x6'))['db'];var utils=require(_0xf3d7('0x7'));var logger=require(_0xf3d7('0x8'))(_0xf3d7('0x9'));var config=require(_0xf3d7('0xa'));var jayson=require(_0xf3d7('0xb'));var client=jayson['client'][_0xf3d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd925e2,_0x128711,_0x4ad1ac){return new BPromise(function(_0x11d39f,_0x393538){return client[_0xf3d7('0xd')](_0xd925e2,_0x4ad1ac)[_0xf3d7('0xe')](function(_0x29a464){logger[_0xf3d7('0xf')](_0xf3d7('0x10'),_0x128711,'request\x20sent');logger['debug'](_0xf3d7('0x11'),_0x128711,_0xf3d7('0x12'),JSON['stringify'](_0x29a464));if(_0x29a464['error']){if(_0x29a464[_0xf3d7('0x13')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x128711,_0x29a464[_0xf3d7('0x13')]['message']);return _0x393538(_0x29a464[_0xf3d7('0x13')][_0xf3d7('0x14')]);}logger[_0xf3d7('0x13')](_0xf3d7('0x10'),_0x128711,_0x29a464[_0xf3d7('0x13')][_0xf3d7('0x14')]);return _0x11d39f(_0x29a464[_0xf3d7('0x13')][_0xf3d7('0x14')]);}else{logger[_0xf3d7('0xf')](_0xf3d7('0x10'),_0x128711,'request\x20sent');_0x11d39f(_0x29a464[_0xf3d7('0x15')][_0xf3d7('0x14')]);}})[_0xf3d7('0x16')](function(_0x33e13a){logger[_0xf3d7('0x13')](_0xf3d7('0x10'),_0x128711,_0x33e13a);_0x393538(_0x33e13a);});});}exports[_0xf3d7('0x17')]=function(_0x2b8c45){var _0xdc1798=this;return new Promise(function(_0x5dd312,_0x800c2f){return db[_0xf3d7('0x18')][_0xf3d7('0x19')](_0x2b8c45[_0xf3d7('0x1a')],{'raw':_0x2b8c45['options']?_0x2b8c45[_0xf3d7('0x1b')][_0xf3d7('0x1c')]===undefined?!![]:![]:!![]})[_0xf3d7('0xe')](function(_0x2075d5){logger[_0xf3d7('0xf')]('CreateChatQueueReport',_0x2b8c45);logger['debug'](_0xf3d7('0x17'),_0x2b8c45,JSON[_0xf3d7('0x1d')](_0x2075d5));_0x5dd312(_0x2075d5);})[_0xf3d7('0x16')](function(_0x556b24){logger['error'](_0xf3d7('0x17'),_0x556b24['message'],_0x2b8c45);_0x800c2f(_0xdc1798[_0xf3d7('0x13')](0x1f4,_0x556b24[_0xf3d7('0x14')]));});});};exports[_0xf3d7('0x1e')]=function(_0x564924){var _0x415532=this;return new Promise(function(_0x4ff85c,_0x3a9db7){return db[_0xf3d7('0x18')][_0xf3d7('0x1f')](_0x564924[_0xf3d7('0x1a')],{'raw':_0x564924[_0xf3d7('0x1b')]?_0x564924['options'][_0xf3d7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x564924[_0xf3d7('0x1b')]?_0x564924[_0xf3d7('0x1b')][_0xf3d7('0x20')]||null:null,'attributes':_0x564924[_0xf3d7('0x1b')]?_0x564924[_0xf3d7('0x1b')]['attributes']||null:null,'limit':_0x564924[_0xf3d7('0x1b')]?_0x564924[_0xf3d7('0x1b')][_0xf3d7('0x21')]||null:null})[_0xf3d7('0xe')](function(_0x7a5b38){logger[_0xf3d7('0xf')](_0xf3d7('0x1e'),_0x564924);logger['debug'](_0xf3d7('0x1e'),_0x564924,JSON[_0xf3d7('0x1d')](_0x7a5b38));_0x4ff85c(_0x7a5b38);})[_0xf3d7('0x16')](function(_0x564a49){logger['error'](_0xf3d7('0x1e'),_0x564a49['message'],_0x564924);_0x3a9db7(_0x415532[_0xf3d7('0x13')](0x1f4,_0x564a49['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 0874635..60be6c8 100644 --- a/server/api/chatQueueReport/index.js +++ b/server/api/chatQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdb28,0x106));var _0x8db2=function(_0x65141,_0xb291ca){_0x65141=_0x65141-0x0;var _0xe1e385=_0xdb28[_0x65141];return _0xe1e385;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./chatQueueReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x3a0c99,_0x1dfa70){var _0x351f0e=function(_0x16f498){while(--_0x16f498){_0x3a0c99['push'](_0x3a0c99['shift']());}};_0x351f0e(++_0x1dfa70);}(_0x7a54,0x106));var _0x47a5=function(_0x3586fa,_0x56e5f9){_0x3586fa=_0x3586fa-0x0;var _0x28c216=_0x7a54[_0x3586fa];return _0x28c216;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 89cd4b5..c6e3add 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x359f=['sequelize','exports','STRING','ENUM','account','queue','DATE','moment'];(function(_0x24ec36,_0x2f4b4c){var _0x3c7dbf=function(_0x3f3f92){while(--_0x3f3f92){_0x24ec36['push'](_0x24ec36['shift']());}};_0x3c7dbf(++_0x2f4b4c);}(_0x359f,0x15f));var _0xf359=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x359f[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0xf359('0x0'));var Sequelize=require(_0xf359('0x1'));module[_0xf359('0x2')]={'uniqueid':{'type':Sequelize[_0xf359('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf359('0x4')](_0xf359('0x5'),'agent',_0xf359('0x6')),'allowNull':![],'defaultValue':_0xf359('0x6')},'transferredAt':{'type':Sequelize[_0xf359('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xdbb4=['account','agent','queue','DATE','moment','sequelize','exports','STRING'];(function(_0x4bcc5c,_0xeddaa){var _0x15a090=function(_0x506e8a){while(--_0x506e8a){_0x4bcc5c['push'](_0x4bcc5c['shift']());}};_0x15a090(++_0xeddaa);}(_0xdbb4,0x1ec));var _0x4dbb=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0xdbb4[_0x2e913b];return _0x173899;};'use strict';var moment=require(_0x4dbb('0x0'));var Sequelize=require(_0x4dbb('0x1'));module[_0x4dbb('0x2')]={'uniqueid':{'type':Sequelize[_0x4dbb('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4dbb('0x4'),_0x4dbb('0x5'),_0x4dbb('0x6')),'allowNull':![],'defaultValue':_0x4dbb('0x6')},'transferredAt':{'type':Sequelize[_0x4dbb('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index abe6926..0e149ba 100644 --- a/server/api/chatTransferReport/chatTransferReport.controller.js +++ b/server/api/chatTransferReport/chatTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8a9=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','update','destroy','then','error','name','send','render','merge','body','contact','message','agent','interaction','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x18acf6,_0x3f096b){var _0x293a2e=function(_0x4b0d0b){while(--_0x4b0d0b){_0x18acf6['push'](_0x18acf6['shift']());}};_0x293a2e(++_0x3f096b);}(_0xf8a9,0xdf));var _0x9f8a=function(_0x2f4ac9,_0x95cf9c){_0x2f4ac9=_0x2f4ac9-0x0;var _0x161f38=_0xf8a9[_0x2f4ac9];return _0x161f38;};'use strict';var emlformat=require(_0x9f8a('0x0'));var rimraf=require(_0x9f8a('0x1'));var zipdir=require(_0x9f8a('0x2'));var jsonpatch=require(_0x9f8a('0x3'));var rp=require(_0x9f8a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f8a('0x5'));var util=require(_0x9f8a('0x6'));var path=require(_0x9f8a('0x7'));var sox=require(_0x9f8a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f8a('0x9'));var squel=require(_0x9f8a('0xa'));var crypto=require('crypto');var jsforce=require(_0x9f8a('0xb'));var deskjs=require(_0x9f8a('0xc'));var toCsv=require(_0x9f8a('0xd'));var querystring=require(_0x9f8a('0xe'));var Papa=require(_0x9f8a('0xf'));var Redis=require(_0x9f8a('0x10'));var authService=require(_0x9f8a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f8a('0x12'));var hardwareService=require(_0x9f8a('0x13'));var logger=require(_0x9f8a('0x14'))(_0x9f8a('0x15'));var utils=require(_0x9f8a('0x16'));var config=require(_0x9f8a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f8a('0x18'))['db'];function respondWithStatusCode(_0x3cfd22,_0x55c5de){_0x55c5de=_0x55c5de||0xcc;return function(_0x5cdb2b){if(_0x5cdb2b){return _0x3cfd22[_0x9f8a('0x19')](_0x55c5de);}return _0x3cfd22[_0x9f8a('0x1a')](_0x55c5de)[_0x9f8a('0x1b')]();};}function respondWithResult(_0xa4e754,_0x4e4528){_0x4e4528=_0x4e4528||0xc8;return function(_0x282454){if(_0x282454){return _0xa4e754[_0x9f8a('0x1a')](_0x4e4528)[_0x9f8a('0x1c')](_0x282454);}};}function respondWithFilteredResult(_0x3e3570,_0x5c42b9){return function(_0x4ec754){if(_0x4ec754){var _0x17e595=typeof _0x5c42b9['offset']===_0x9f8a('0x1d')&&typeof _0x5c42b9['limit']==='undefined';var _0x3b42ac=_0x4ec754[_0x9f8a('0x1e')];var _0x34004b=_0x17e595?0x0:_0x5c42b9[_0x9f8a('0x1f')];var _0x48fd64=_0x17e595?_0x4ec754['count']:_0x5c42b9['offset']+_0x5c42b9['limit'];var _0x4a1d0a;if(_0x48fd64>=_0x3b42ac){_0x48fd64=_0x3b42ac;_0x4a1d0a=0xc8;}else{_0x4a1d0a=0xce;}_0x3e3570[_0x9f8a('0x1a')](_0x4a1d0a);return _0x3e3570[_0x9f8a('0x20')]('Content-Range',_0x34004b+'-'+_0x48fd64+'/'+_0x3b42ac)[_0x9f8a('0x1c')](_0x4ec754);}return null;};}function patchUpdates(_0x1a10c3){return function(_0x5d3844){try{jsonpatch[_0x9f8a('0x21')](_0x5d3844,_0x1a10c3,!![]);}catch(_0x530f0c){return BPromise['reject'](_0x530f0c);}return _0x5d3844['save']();};}function saveUpdates(_0x4100d2,_0xc56de6){return function(_0xbb8055){if(_0xbb8055){return _0xbb8055[_0x9f8a('0x22')](_0x4100d2)['then'](function(_0x202a8d){return _0x202a8d;});}return null;};}function removeEntity(_0x4d4f7a,_0x1e7b96){return function(_0x2930d5){if(_0x2930d5){return _0x2930d5[_0x9f8a('0x23')]()[_0x9f8a('0x24')](function(){_0x4d4f7a[_0x9f8a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x397739,_0x4d4d0a){return function(_0x5105b3){if(!_0x5105b3){_0x397739['sendStatus'](0x194);}return _0x5105b3;};}function handleError(_0x37939b,_0x13753c){_0x13753c=_0x13753c||0x1f4;return function(_0x5a070c){logger[_0x9f8a('0x25')](_0x5a070c['stack']);if(_0x5a070c[_0x9f8a('0x26')]){delete _0x5a070c[_0x9f8a('0x26')];}_0x37939b[_0x9f8a('0x1a')](_0x13753c)[_0x9f8a('0x27')](_0x5a070c);};}function getMustacheRender(_0x29f7a2,_0x59320a){return Mustache[_0x9f8a('0x28')](_0x29f7a2,_[_0x9f8a('0x29')](_0x59320a[_0x9f8a('0x2a')],{'contact':_0x59320a[_0x9f8a('0x2b')],'message':_0x59320a[_0x9f8a('0x2c')],'agent':_0x59320a[_0x9f8a('0x2d')],'interaction':_0x59320a[_0x9f8a('0x2e')],'account':_0x59320a['account']}))||'';}exports[_0x9f8a('0x2f')]=function(_0x28fe45,_0x25ba96){var _0x2f5d34={},_0xa39e69={},_0x552e06={'count':0x0,'rows':[]};var _0x2f5aac=_[_0x9f8a('0x30')](db[_0x9f8a('0x31')][_0x9f8a('0x32')],function(_0x181eaf){return{'name':_0x181eaf[_0x9f8a('0x33')],'type':_0x181eaf[_0x9f8a('0x34')][_0x9f8a('0x35')]};});_0xa39e69[_0x9f8a('0x36')]=_['map'](_0x2f5aac,_0x9f8a('0x26'));_0xa39e69[_0x9f8a('0x37')]=_['keys'](_0x28fe45[_0x9f8a('0x37')]);_0xa39e69[_0x9f8a('0x38')]=_['intersection'](_0xa39e69[_0x9f8a('0x36')],_0xa39e69[_0x9f8a('0x37')]);_0x2f5d34[_0x9f8a('0x39')]=_[_0x9f8a('0x3a')](_0xa39e69['model'],qs[_0x9f8a('0x3b')](_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x3b')]));_0x2f5d34[_0x9f8a('0x39')]=_0x2f5d34['attributes']['length']?_0x2f5d34['attributes']:_0xa39e69[_0x9f8a('0x36')];if(!_0x28fe45[_0x9f8a('0x37')]['hasOwnProperty'](_0x9f8a('0x3c'))){_0x2f5d34[_0x9f8a('0x3d')]=qs[_0x9f8a('0x3d')](_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x3d')]);_0x2f5d34['offset']=qs[_0x9f8a('0x1f')](_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x1f')]);}_0x2f5d34['order']=qs[_0x9f8a('0x3e')](_0x28fe45['query'][_0x9f8a('0x3e')]);_0x2f5d34[_0x9f8a('0x3f')]=qs['filters'](_[_0x9f8a('0x40')](_0x28fe45[_0x9f8a('0x37')],_0xa39e69['filters']),_0x2f5aac);if(_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x41')]){_0x2f5d34[_0x9f8a('0x3f')]=_['merge'](_0x2f5d34[_0x9f8a('0x3f')],{'$or':_['map'](_0x2f5aac,function(_0x183e77){if(_0x183e77[_0x9f8a('0x34')]!==_0x9f8a('0x42')){var _0x292800={};_0x292800[_0x183e77['name']]={'$like':'%'+_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x41')]+'%'};return _0x292800;}})});}_0x2f5d34=_[_0x9f8a('0x29')]({},_0x2f5d34,_0x28fe45[_0x9f8a('0x43')]);var _0x168147={'where':_0x2f5d34[_0x9f8a('0x3f')]};return db[_0x9f8a('0x31')][_0x9f8a('0x1e')](_0x168147)[_0x9f8a('0x24')](function(_0x13b371){_0x552e06[_0x9f8a('0x1e')]=_0x13b371;if(_0x28fe45[_0x9f8a('0x37')][_0x9f8a('0x44')]){_0x2f5d34[_0x9f8a('0x45')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x9f8a('0x46')](_0x2f5d34);})['then'](function(_0x1d2a0e){_0x552e06[_0x9f8a('0x47')]=_0x1d2a0e;return _0x552e06;})[_0x9f8a('0x24')](respondWithFilteredResult(_0x25ba96,_0x2f5d34))['catch'](handleError(_0x25ba96,null));};exports[_0x9f8a('0x48')]=function(_0x37dc95,_0x4fa8ec){var _0x3447b0={'raw':!![],'where':{'id':_0x37dc95[_0x9f8a('0x49')]['id']}},_0x57b763={};_0x57b763['model']=_[_0x9f8a('0x4a')](db['ChatTransferReport'][_0x9f8a('0x32')]);_0x57b763[_0x9f8a('0x37')]=_['keys'](_0x37dc95[_0x9f8a('0x37')]);_0x57b763[_0x9f8a('0x38')]=_[_0x9f8a('0x3a')](_0x57b763['model'],_0x57b763['query']);_0x3447b0[_0x9f8a('0x39')]=_[_0x9f8a('0x3a')](_0x57b763[_0x9f8a('0x36')],qs[_0x9f8a('0x3b')](_0x37dc95['query']['fields']));_0x3447b0[_0x9f8a('0x39')]=_0x3447b0['attributes']['length']?_0x3447b0['attributes']:_0x57b763['model'];if(_0x37dc95['query'][_0x9f8a('0x44')]){_0x3447b0[_0x9f8a('0x45')]=[{'all':!![]}];}_0x3447b0=_[_0x9f8a('0x29')]({},_0x3447b0,_0x37dc95['options']);return db[_0x9f8a('0x31')][_0x9f8a('0x4b')](_0x3447b0)[_0x9f8a('0x24')](handleEntityNotFound(_0x4fa8ec,null))[_0x9f8a('0x24')](respondWithResult(_0x4fa8ec,null))[_0x9f8a('0x4c')](handleError(_0x4fa8ec,null));};exports[_0x9f8a('0x4d')]=function(_0xc8447c,_0x3ad8c2){return db['ChatTransferReport'][_0x9f8a('0x4d')](_0xc8447c[_0x9f8a('0x2a')],{})[_0x9f8a('0x24')](respondWithResult(_0x3ad8c2,0xc9))['catch'](handleError(_0x3ad8c2,null));};exports[_0x9f8a('0x22')]=function(_0x4947b3,_0xa0901d){if(_0x4947b3[_0x9f8a('0x2a')]['id']){delete _0x4947b3[_0x9f8a('0x2a')]['id'];}return db[_0x9f8a('0x31')]['find']({'where':{'id':_0x4947b3[_0x9f8a('0x49')]['id']}})[_0x9f8a('0x24')](handleEntityNotFound(_0xa0901d,null))[_0x9f8a('0x24')](saveUpdates(_0x4947b3[_0x9f8a('0x2a')],null))['then'](respondWithResult(_0xa0901d,null))[_0x9f8a('0x4c')](handleError(_0xa0901d,null));};exports[_0x9f8a('0x23')]=function(_0xea1e2e,_0x34e86f){return db[_0x9f8a('0x31')][_0x9f8a('0x4b')]({'where':{'id':_0xea1e2e[_0x9f8a('0x49')]['id']}})[_0x9f8a('0x24')](handleEntityNotFound(_0x34e86f,null))[_0x9f8a('0x24')](removeEntity(_0x34e86f,null))[_0x9f8a('0x4c')](handleError(_0x34e86f,null));};exports['describe']=function(_0x82b05e,_0x48c03b){return db[_0x9f8a('0x31')][_0x9f8a('0x4e')]()[_0x9f8a('0x24')](respondWithResult(_0x48c03b,null))[_0x9f8a('0x4c')](handleError(_0x48c03b,null));}; \ No newline at end of file +var _0x4ca3=['stack','name','render','body','message','agent','interaction','account','index','map','ChatTransferReport','fieldName','key','model','filters','query','attributes','intersection','fields','nolimit','order','sort','pick','where','type','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','length','include','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x4ca3,0x160));var _0x34ca=function(_0x2375f1,_0x4d5770){_0x2375f1=_0x2375f1-0x0;var _0x126982=_0x4ca3[_0x2375f1];return _0x126982;};'use strict';var emlformat=require(_0x34ca('0x0'));var rimraf=require(_0x34ca('0x1'));var zipdir=require(_0x34ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x34ca('0x3'));var BPromise=require(_0x34ca('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x34ca('0x5'));var sox=require(_0x34ca('0x6'));var csv=require(_0x34ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34ca('0x8'));var _=require('lodash');var squel=require(_0x34ca('0x9'));var crypto=require(_0x34ca('0xa'));var jsforce=require(_0x34ca('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x34ca('0x7'));var querystring=require(_0x34ca('0xc'));var Papa=require(_0x34ca('0xd'));var Redis=require(_0x34ca('0xe'));var authService=require(_0x34ca('0xf'));var qs=require(_0x34ca('0x10'));var as=require(_0x34ca('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x34ca('0x12'))(_0x34ca('0x13'));var utils=require(_0x34ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x34ca('0x15'));var db=require(_0x34ca('0x16'))['db'];function respondWithStatusCode(_0xc6ce2d,_0x5cfec9){_0x5cfec9=_0x5cfec9||0xcc;return function(_0x392f7c){if(_0x392f7c){return _0xc6ce2d[_0x34ca('0x17')](_0x5cfec9);}return _0xc6ce2d[_0x34ca('0x18')](_0x5cfec9)[_0x34ca('0x19')]();};}function respondWithResult(_0x6468ad,_0x57fcff){_0x57fcff=_0x57fcff||0xc8;return function(_0x153e34){if(_0x153e34){return _0x6468ad['status'](_0x57fcff)[_0x34ca('0x1a')](_0x153e34);}};}function respondWithFilteredResult(_0x26bf8c,_0x4802a5){return function(_0x288e92){if(_0x288e92){var _0x2e56a3=typeof _0x4802a5[_0x34ca('0x1b')]===_0x34ca('0x1c')&&typeof _0x4802a5[_0x34ca('0x1d')]==='undefined';var _0x52a0d7=_0x288e92['count'];var _0x24cd6c=_0x2e56a3?0x0:_0x4802a5[_0x34ca('0x1b')];var _0x264337=_0x2e56a3?_0x288e92['count']:_0x4802a5[_0x34ca('0x1b')]+_0x4802a5[_0x34ca('0x1d')];var _0x2b0821;if(_0x264337>=_0x52a0d7){_0x264337=_0x52a0d7;_0x2b0821=0xc8;}else{_0x2b0821=0xce;}_0x26bf8c['status'](_0x2b0821);return _0x26bf8c['set'](_0x34ca('0x1e'),_0x24cd6c+'-'+_0x264337+'/'+_0x52a0d7)[_0x34ca('0x1a')](_0x288e92);}return null;};}function patchUpdates(_0x2f9ae6){return function(_0x479252){try{jsonpatch[_0x34ca('0x1f')](_0x479252,_0x2f9ae6,!![]);}catch(_0x47dc98){return BPromise[_0x34ca('0x20')](_0x47dc98);}return _0x479252[_0x34ca('0x21')]();};}function saveUpdates(_0x27afc0,_0x38573b){return function(_0x4683f1){if(_0x4683f1){return _0x4683f1[_0x34ca('0x22')](_0x27afc0)[_0x34ca('0x23')](function(_0x29f914){return _0x29f914;});}return null;};}function removeEntity(_0x5b7515,_0x252c74){return function(_0x4b03ae){if(_0x4b03ae){return _0x4b03ae[_0x34ca('0x24')]()[_0x34ca('0x23')](function(){_0x5b7515[_0x34ca('0x18')](0xcc)[_0x34ca('0x19')]();});}};}function handleEntityNotFound(_0x27ec8f,_0x21e0fc){return function(_0x191619){if(!_0x191619){_0x27ec8f['sendStatus'](0x194);}return _0x191619;};}function handleError(_0x5d1577,_0x431d83){_0x431d83=_0x431d83||0x1f4;return function(_0x457d8e){logger[_0x34ca('0x25')](_0x457d8e[_0x34ca('0x26')]);if(_0x457d8e[_0x34ca('0x27')]){delete _0x457d8e[_0x34ca('0x27')];}_0x5d1577[_0x34ca('0x18')](_0x431d83)['send'](_0x457d8e);};}function getMustacheRender(_0x509608,_0x289d05){return Mustache[_0x34ca('0x28')](_0x509608,_['merge'](_0x289d05[_0x34ca('0x29')],{'contact':_0x289d05['contact'],'message':_0x289d05[_0x34ca('0x2a')],'agent':_0x289d05[_0x34ca('0x2b')],'interaction':_0x289d05[_0x34ca('0x2c')],'account':_0x289d05[_0x34ca('0x2d')]}))||'';}exports[_0x34ca('0x2e')]=function(_0x504329,_0x38d106){var _0x434bf4={},_0x5ba2eb={},_0x609acb={'count':0x0,'rows':[]};var _0x4620f7=_[_0x34ca('0x2f')](db[_0x34ca('0x30')]['rawAttributes'],function(_0x319baf){return{'name':_0x319baf[_0x34ca('0x31')],'type':_0x319baf['type'][_0x34ca('0x32')]};});_0x5ba2eb[_0x34ca('0x33')]=_[_0x34ca('0x2f')](_0x4620f7,_0x34ca('0x27'));_0x5ba2eb['query']=_['keys'](_0x504329['query']);_0x5ba2eb[_0x34ca('0x34')]=_['intersection'](_0x5ba2eb['model'],_0x5ba2eb[_0x34ca('0x35')]);_0x434bf4[_0x34ca('0x36')]=_[_0x34ca('0x37')](_0x5ba2eb[_0x34ca('0x33')],qs[_0x34ca('0x38')](_0x504329[_0x34ca('0x35')]['fields']));_0x434bf4[_0x34ca('0x36')]=_0x434bf4['attributes']['length']?_0x434bf4['attributes']:_0x5ba2eb[_0x34ca('0x33')];if(!_0x504329['query']['hasOwnProperty'](_0x34ca('0x39'))){_0x434bf4['limit']=qs['limit'](_0x504329[_0x34ca('0x35')][_0x34ca('0x1d')]);_0x434bf4[_0x34ca('0x1b')]=qs['offset'](_0x504329[_0x34ca('0x35')][_0x34ca('0x1b')]);}_0x434bf4[_0x34ca('0x3a')]=qs['sort'](_0x504329['query'][_0x34ca('0x3b')]);_0x434bf4['where']=qs['filters'](_[_0x34ca('0x3c')](_0x504329['query'],_0x5ba2eb[_0x34ca('0x34')]),_0x4620f7);if(_0x504329[_0x34ca('0x35')]['filter']){_0x434bf4[_0x34ca('0x3d')]=_['merge'](_0x434bf4[_0x34ca('0x3d')],{'$or':_[_0x34ca('0x2f')](_0x4620f7,function(_0x84f83e){if(_0x84f83e[_0x34ca('0x3e')]!==_0x34ca('0x3f')){var _0x3e8cef={};_0x3e8cef[_0x84f83e['name']]={'$like':'%'+_0x504329[_0x34ca('0x35')]['filter']+'%'};return _0x3e8cef;}})});}_0x434bf4=_[_0x34ca('0x40')]({},_0x434bf4,_0x504329[_0x34ca('0x41')]);var _0x21a036={'where':_0x434bf4[_0x34ca('0x3d')]};return db[_0x34ca('0x30')][_0x34ca('0x42')](_0x21a036)[_0x34ca('0x23')](function(_0x57e80d){_0x609acb['count']=_0x57e80d;if(_0x504329[_0x34ca('0x35')][_0x34ca('0x43')]){_0x434bf4['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x34ca('0x44')](_0x434bf4);})[_0x34ca('0x23')](function(_0xe67c5d){_0x609acb[_0x34ca('0x45')]=_0xe67c5d;return _0x609acb;})[_0x34ca('0x23')](respondWithFilteredResult(_0x38d106,_0x434bf4))[_0x34ca('0x46')](handleError(_0x38d106,null));};exports[_0x34ca('0x47')]=function(_0xdb5f57,_0x2ed7a8){var _0x28968e={'raw':!![],'where':{'id':_0xdb5f57[_0x34ca('0x48')]['id']}},_0x4cbe1f={};_0x4cbe1f[_0x34ca('0x33')]=_[_0x34ca('0x49')](db['ChatTransferReport']['rawAttributes']);_0x4cbe1f[_0x34ca('0x35')]=_[_0x34ca('0x49')](_0xdb5f57[_0x34ca('0x35')]);_0x4cbe1f[_0x34ca('0x34')]=_[_0x34ca('0x37')](_0x4cbe1f['model'],_0x4cbe1f['query']);_0x28968e[_0x34ca('0x36')]=_[_0x34ca('0x37')](_0x4cbe1f[_0x34ca('0x33')],qs[_0x34ca('0x38')](_0xdb5f57['query']['fields']));_0x28968e[_0x34ca('0x36')]=_0x28968e['attributes'][_0x34ca('0x4a')]?_0x28968e[_0x34ca('0x36')]:_0x4cbe1f['model'];if(_0xdb5f57['query'][_0x34ca('0x43')]){_0x28968e[_0x34ca('0x4b')]=[{'all':!![]}];}_0x28968e=_['merge']({},_0x28968e,_0xdb5f57[_0x34ca('0x41')]);return db[_0x34ca('0x30')][_0x34ca('0x4c')](_0x28968e)['then'](handleEntityNotFound(_0x2ed7a8,null))[_0x34ca('0x23')](respondWithResult(_0x2ed7a8,null))[_0x34ca('0x46')](handleError(_0x2ed7a8,null));};exports['create']=function(_0x31d429,_0x46f53e){return db[_0x34ca('0x30')]['create'](_0x31d429[_0x34ca('0x29')],{})[_0x34ca('0x23')](respondWithResult(_0x46f53e,0xc9))[_0x34ca('0x46')](handleError(_0x46f53e,null));};exports[_0x34ca('0x22')]=function(_0x18ec6f,_0x40983a){if(_0x18ec6f['body']['id']){delete _0x18ec6f['body']['id'];}return db[_0x34ca('0x30')][_0x34ca('0x4c')]({'where':{'id':_0x18ec6f[_0x34ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x40983a,null))['then'](saveUpdates(_0x18ec6f['body'],null))['then'](respondWithResult(_0x40983a,null))[_0x34ca('0x46')](handleError(_0x40983a,null));};exports[_0x34ca('0x24')]=function(_0x2f7181,_0x17fab8){return db['ChatTransferReport'][_0x34ca('0x4c')]({'where':{'id':_0x2f7181[_0x34ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x17fab8,null))[_0x34ca('0x23')](removeEntity(_0x17fab8,null))['catch'](handleError(_0x17fab8,null));};exports[_0x34ca('0x4d')]=function(_0x2d9461,_0x148ac3){return db['ChatTransferReport'][_0x34ca('0x4d')]()[_0x34ca('0x23')](respondWithResult(_0x148ac3,null))[_0x34ca('0x46')](handleError(_0x148ac3,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a8a3586..206dcda 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c24=['bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x476b47,_0x392e2f){var _0x462261=function(_0x5b1565){while(--_0x5b1565){_0x476b47['push'](_0x476b47['shift']());}};_0x462261(++_0x392e2f);}(_0x9c24,0xc0));var _0x49c2=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x9c24[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x49c2('0x0'));var util=require(_0x49c2('0x1'));var logger=require(_0x49c2('0x2'))('api');var moment=require(_0x49c2('0x3'));var BPromise=require(_0x49c2('0x4'));var rp=require(_0x49c2('0x5'));var fs=require('fs');var path=require(_0x49c2('0x6'));var rimraf=require(_0x49c2('0x7'));var config=require(_0x49c2('0x8'));var attributes=require(_0x49c2('0x9'));module[_0x49c2('0xa')]=function(_0x3928ec,_0x4724cc){return _0x3928ec[_0x49c2('0xb')](_0x49c2('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x49c2('0xd'),'fields':[_0x49c2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36eb=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x32fcb1,_0x26e280){var _0x3dafc2=function(_0x1f200a){while(--_0x1f200a){_0x32fcb1['push'](_0x32fcb1['shift']());}};_0x3dafc2(++_0x26e280);}(_0x36eb,0x187));var _0xb36e=function(_0x5ea566,_0x36a2d1){_0x5ea566=_0x5ea566-0x0;var _0x2a2553=_0x36eb[_0x5ea566];return _0x2a2553;};'use strict';var _=require(_0xb36e('0x0'));var util=require('util');var logger=require(_0xb36e('0x1'))(_0xb36e('0x2'));var moment=require(_0xb36e('0x3'));var BPromise=require(_0xb36e('0x4'));var rp=require(_0xb36e('0x5'));var fs=require('fs');var path=require(_0xb36e('0x6'));var rimraf=require(_0xb36e('0x7'));var config=require(_0xb36e('0x8'));var attributes=require(_0xb36e('0x9'));module[_0xb36e('0xa')]=function(_0x1eef04,_0x4add44){return _0x1eef04[_0xb36e('0xb')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xb36e('0xc'),'fields':[_0xb36e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 2d5a828..1b79c08 100644 --- a/server/api/chatTransferReport/chatTransferReport.rpc.js +++ b/server/api/chatTransferReport/chatTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5aab=['http','request','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','ChatTransferReport,\x20%s,\x20%s','result','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise'];(function(_0x1fdb8e,_0x265786){var _0x128c00=function(_0x50f2d7){while(--_0x50f2d7){_0x1fdb8e['push'](_0x1fdb8e['shift']());}};_0x128c00(++_0x265786);}(_0x5aab,0x1da));var _0xb5aa=function(_0xde1b69,_0x12a058){_0xde1b69=_0xde1b69-0x0;var _0x50f18f=_0x5aab[_0xde1b69];return _0x50f18f;};'use strict';var _=require('lodash');var util=require(_0xb5aa('0x0'));var moment=require(_0xb5aa('0x1'));var BPromise=require(_0xb5aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5aa('0x3'));var logger=require(_0xb5aa('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb5aa('0x5'));var client=jayson['client'][_0xb5aa('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x47cc59,_0x599a3e,_0x46e86a){return new BPromise(function(_0x4551bd,_0x25d0bd){return client[_0xb5aa('0x7')](_0x47cc59,_0x46e86a)['then'](function(_0x348a02){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x599a3e,_0xb5aa('0x8'));logger[_0xb5aa('0x9')](_0xb5aa('0xa'),_0x599a3e,_0xb5aa('0x8'),JSON['stringify'](_0x348a02));if(_0x348a02[_0xb5aa('0xb')]){if(_0x348a02[_0xb5aa('0xb')][_0xb5aa('0xc')]===0x1f4){logger[_0xb5aa('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x599a3e,_0x348a02[_0xb5aa('0xb')][_0xb5aa('0xd')]);return _0x25d0bd(_0x348a02[_0xb5aa('0xb')]['message']);}logger['error'](_0xb5aa('0xe'),_0x599a3e,_0x348a02[_0xb5aa('0xb')][_0xb5aa('0xd')]);return _0x4551bd(_0x348a02['error']['message']);}else{logger['info'](_0xb5aa('0xe'),_0x599a3e,'request\x20sent');_0x4551bd(_0x348a02[_0xb5aa('0xf')][_0xb5aa('0xd')]);}})['catch'](function(_0x463fe9){logger[_0xb5aa('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x599a3e,_0x463fe9);_0x25d0bd(_0x463fe9);});});} \ No newline at end of file +var _0x8da8=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x41594f,_0x32bc97){var _0x41a1ab=function(_0xd52aad){while(--_0xd52aad){_0x41594f['push'](_0x41594f['shift']());}};_0x41a1ab(++_0x32bc97);}(_0x8da8,0x187));var _0x88da=function(_0x38486b,_0x29eb00){_0x38486b=_0x38486b-0x0;var _0x1a4fe1=_0x8da8[_0x38486b];return _0x1a4fe1;};'use strict';var _=require(_0x88da('0x0'));var util=require(_0x88da('0x1'));var moment=require(_0x88da('0x2'));var BPromise=require(_0x88da('0x3'));var rs=require(_0x88da('0x4'));var fs=require('fs');var Redis=require(_0x88da('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x88da('0x6'));var logger=require(_0x88da('0x7'))(_0x88da('0x8'));var config=require(_0x88da('0x9'));var jayson=require(_0x88da('0xa'));var client=jayson[_0x88da('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6baa96,_0x33e3be,_0x3de109){return new BPromise(function(_0x3b2868,_0x58a969){return client['request'](_0x6baa96,_0x3de109)[_0x88da('0xc')](function(_0x10db86){logger[_0x88da('0xd')](_0x88da('0xe'),_0x33e3be,_0x88da('0xf'));logger[_0x88da('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x33e3be,_0x88da('0xf'),JSON[_0x88da('0x11')](_0x10db86));if(_0x10db86['error']){if(_0x10db86[_0x88da('0x12')][_0x88da('0x13')]===0x1f4){logger[_0x88da('0x12')](_0x88da('0xe'),_0x33e3be,_0x10db86['error'][_0x88da('0x14')]);return _0x58a969(_0x10db86['error']['message']);}logger['error'](_0x88da('0xe'),_0x33e3be,_0x10db86[_0x88da('0x12')][_0x88da('0x14')]);return _0x3b2868(_0x10db86[_0x88da('0x12')]['message']);}else{logger[_0x88da('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x33e3be,'request\x20sent');_0x3b2868(_0x10db86[_0x88da('0x15')][_0x88da('0x14')]);}})['catch'](function(_0x4d9ffd){logger[_0x88da('0x12')](_0x88da('0xe'),_0x33e3be,_0x4d9ffd);_0x58a969(_0x4d9ffd);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0cfa27b..1efa57f 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f5d=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x8f5d,0x10b));var _0xd8f5=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x8f5d[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0xd8f5('0x0'));var util=require('util');var path=require(_0xd8f5('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd8f5('0x3'));var interaction=require(_0xd8f5('0x4'));var config=require(_0xd8f5('0x5'));var controller=require(_0xd8f5('0x6'));router[_0xd8f5('0x7')]('/',auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x9')]);router[_0xd8f5('0x7')](_0xd8f5('0xa'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0xb')]);router[_0xd8f5('0x7')](_0xd8f5('0xc'),auth['isAuthenticated'](),controller[_0xd8f5('0xd')]);router[_0xd8f5('0xe')]('/',auth[_0xd8f5('0x8')](),controller[_0xd8f5('0xf')]);router['put'](_0xd8f5('0xc'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x10')]);router['delete'](_0xd8f5('0xc'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x11')]);module[_0xd8f5('0x12')]=router; \ No newline at end of file +var _0xfd0c=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','show','create','/:id','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34edad,_0x51f079){var _0x34b10a=function(_0x6bb036){while(--_0x6bb036){_0x34edad['push'](_0x34edad['shift']());}};_0x34b10a(++_0x51f079);}(_0xfd0c,0xe8));var _0xcfd0=function(_0x5c13d5,_0x38a129){_0x5c13d5=_0x5c13d5-0x0;var _0x361eb9=_0xfd0c[_0x5c13d5];return _0x361eb9;};'use strict';var multer=require('multer');var util=require(_0xcfd0('0x0'));var path=require(_0xcfd0('0x1'));var timeout=require(_0xcfd0('0x2'));var express=require(_0xcfd0('0x3'));var router=express[_0xcfd0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcfd0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcfd0('0x6'));var controller=require(_0xcfd0('0x7'));router[_0xcfd0('0x8')]('/',auth[_0xcfd0('0x9')](),controller['index']);router[_0xcfd0('0x8')](_0xcfd0('0xa'),auth[_0xcfd0('0x9')](),controller[_0xcfd0('0xb')]);router[_0xcfd0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcfd0('0xc')]);router['post']('/',auth[_0xcfd0('0x9')](),controller[_0xcfd0('0xd')]);router['put'](_0xcfd0('0xe'),auth[_0xcfd0('0x9')](),controller['update']);router[_0xcfd0('0xf')](_0xcfd0('0xe'),auth[_0xcfd0('0x9')](),controller[_0xcfd0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index b4a9bb5..4a23d18 100644 --- a/server/api/chatWebsite/chatWebsite.attributes.js +++ b/server/api/chatWebsite/chatWebsite.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x944e=['email','Agent','#011F6A','BOOLEAN','ENUM','rounded','Chat','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','name','text','input','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING'];(function(_0x53f28d,_0x521c75){var _0x48858a=function(_0x3cae32){while(--_0x3cae32){_0x53f28d['push'](_0x53f28d['shift']());}};_0x48858a(++_0x521c75);}(_0x944e,0x89));var _0xe944=function(_0x11b8ae,_0x485fa8){_0x11b8ae=_0x11b8ae-0x0;var _0x35a448=_0x944e[_0x11b8ae];return _0x35a448;};'use strict';var Sequelize=require(_0xe944('0x0'));var rs=require(_0xe944('0x1'));module[_0xe944('0x2')]={'name':{'type':Sequelize[_0xe944('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xe944('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xe944('0x3')]},'mapKey':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x4')},'key':{'type':Sequelize[_0xe944('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x5')},'customerAlias':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe944('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe944('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xe944('0x3')]},'animation':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe944('0x8')](_0xe944('0x9'),'squared'),'defaultValue':_0xe944('0x9')},'header_online':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0xa')},'offline_chat_button':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0xb')},'header_offline':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe944('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe944('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x11')},'noteTitle':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x12')},'closingMessageButton':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x13')},'conditionAgreement':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x14')},'ratingType':{'type':Sequelize[_0xe944('0x8')](_0xe944('0x15'),_0xe944('0x16')),'defaultValue':_0xe944('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xe944('0x17'),'type':_0xe944('0x18'),'required':!![]},'props':{'title':_0xe944('0x17'),'helpText':''}},{'type':_0xe944('0x19'),'props':{'title':_0xe944('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe944('0x4'),'type':_0xe944('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe944('0x1a')](_0xe944('0x1b'))?JSON['parse'](this[_0xe944('0x1a')]('onlineForm')):{};},'set':function(_0x179c12){return this[_0xe944('0x1c')](_0xe944('0x1b'),JSON[_0xe944('0x1d')](_0x179c12));}},'offlineForm':{'type':Sequelize[_0xe944('0xe')],'defaultValue':function(){return JSON[_0xe944('0x1d')]({'items':[{'type':_0xe944('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xe944('0x4'),'type':_0xe944('0x4')},'variable':null},{'type':_0xe944('0x1e'),'config':{'placeholder':_0xe944('0x1f')},'props':{'title':_0xe944('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xe944('0x1a')](_0xe944('0x20'))?JSON[_0xe944('0x21')](this['getDataValue'](_0xe944('0x20'))):{};},'set':function(_0xd95c57){return this['setDataValue'](_0xe944('0x20'),JSON[_0xe944('0x1d')](_0xd95c57));}},'token':{'type':Sequelize[_0xe944('0x3')],'defaultValue':function(){return rs[_0xe944('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe944('0x3')]},'waitingTitle':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x23')},'waitingMessage':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x24')},'offlineMessageBody':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x13')},'sendUnmanaged':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe944('0xe')],'defaultValue':function(){return _0xe944('0x25');}},'notificationSound':{'type':Sequelize[_0xe944('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xe944('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xe944('0x26')},'verticalAlignment':{'type':Sequelize[_0xe944('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x27')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xe944('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe944('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe944('0x3')],'allowNull':![],'defaultValue':_0xe944('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe944('0x3')],'defaultValue':_0xe944('0x29')},'systemAvatar':{'type':Sequelize[_0xe944('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe944('0xc')],'comment':_0xe944('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xe944('0x7')],'defaultValue':![],'comment':_0xe944('0x2b'),'set':function(_0x3a70d9){if(!_0x3a70d9)this[_0xe944('0x1c')]('mandatoryDispositionPauseId',null);this[_0xe944('0x1c')](_0xe944('0x2c'),_0x3a70d9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe944('0x3')],'defaultValue':![]},'vidaooTopic':{'type':Sequelize[_0xe944('0x3')],'allowNull':![],'defaultValue':_0xe944('0x2d')},'vidaooNote':{'type':Sequelize[_0xe944('0x3')],'defaultValue':function(){return _0xe944('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0xe944('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2ac3=['TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback','ENUM','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x2ac3,0x198));var _0x32ac=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2ac3[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x32ac('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![],'unique':_0x32ac('0x2')},'description':{'type':Sequelize[_0x32ac('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x32ac('0x3')},'mapKeyOffline':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x3')},'key':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x32ac('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![],'defaultValue':_0x32ac('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![],'defaultValue':_0x32ac('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x32ac('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x32ac('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x32ac('0x8'),'squared'),'defaultValue':_0x32ac('0x8')},'header_online':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x9')},'start_chat_button':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x32ac('0xb')},'header_offline':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0xc')},'download_transcript':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x32ac('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x32ac('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x32ac('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x11')},'noteTitle':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x32ac('0x13')},'closingMessage':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0xb')},'skipMessageButton':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x14')},'ratingType':{'type':Sequelize[_0x32ac('0x15')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x32ac('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x32ac('0xf')],'defaultValue':function(){return JSON[_0x32ac('0x16')]({'items':[{'type':_0x32ac('0x17'),'variable':null,'config':{'placeholder':_0x32ac('0x18'),'type':_0x32ac('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x32ac('0x3'),'type':_0x32ac('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x32ac('0x1a')](_0x32ac('0x1b'))?JSON[_0x32ac('0x1c')](this[_0x32ac('0x1a')](_0x32ac('0x1b'))):{};},'set':function(_0x1b9d70){return this['setDataValue'](_0x32ac('0x1b'),JSON[_0x32ac('0x16')](_0x1b9d70));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x32ac('0x17'),'props':{'title':_0x32ac('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x32ac('0x3'),'type':_0x32ac('0x3')},'variable':null},{'type':_0x32ac('0x1d'),'config':{'placeholder':_0x32ac('0x1e')},'props':{'title':'Comments','helpText':_0x32ac('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x32ac('0x1a')](_0x32ac('0x20'))?JSON['parse'](this[_0x32ac('0x1a')]('offlineForm')):{};},'set':function(_0x3e8da4){return this['setDataValue'](_0x32ac('0x20'),JSON['stringify'](_0x3e8da4));}},'token':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':function(){return rs[_0x32ac('0x21')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x32ac('0x1')]},'forwardOffline':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x32ac('0x1')]},'waitingTitle':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x22')},'waitingMessage':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x23')},'offlineMessageBody':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x32ac('0x25')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x32ac('0x26')},'sendUnmanaged':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x32ac('0xf')],'defaultValue':function(){return _0x32ac('0x27');}},'notificationSound':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x32ac('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x32ac('0x1')]},'customerAvatar':{'type':Sequelize[_0x32ac('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x32ac('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![],'defaultValue':_0x32ac('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':_0x32ac('0x2a')},'systemAvatar':{'type':Sequelize[_0x32ac('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![],'comment':_0x32ac('0x2b'),'set':function(_0x48bcbb){if(!_0x48bcbb)this[_0x32ac('0x2c')](_0x32ac('0x2d'),null);this[_0x32ac('0x2c')]('mandatoryDisposition',_0x48bcbb);}},'vidaooEscalation':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':![]},'vidaooTopic':{'type':Sequelize[_0x32ac('0x1')],'allowNull':![],'defaultValue':_0x32ac('0x2e')},'vidaooNote':{'type':Sequelize[_0x32ac('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x32ac('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x32ac('0xd')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d27c252..0d1f944 100644 --- a/server/api/chatWebsite/chatWebsite.controller.js +++ b/server/api/chatWebsite/chatWebsite.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61ac=['ids','addLogo','sitepic','filename','addAvatar','addCustomerAvatar','customerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','server/files/images/logos/','getAvatar','root','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','ChatApplication','applications','Applications','list','orderBy','priority','asc','mapKey','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','update','created','autoclose','push','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','toPairs','originalname','mimetype','server','files','attachments','offline-chat','transaction','bulkCreate','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','addInteraction','getInteractions','Owner','fullname','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','all','some','server/files/chat/iframe.js','remote','x-real-ip','remoteAddress','referer','replace','alignment','textColor','color_button','backgroundColor','sequelize','getApplications','chatProactiveAction','omit','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Contact','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','http','client','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','ChatWebsites','UserProfileResource','sendStatus','name','render','merge','contact','agent','account','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','getDispositions','findOne','options','rows','removeDispositions','CannedAnswer','getAnswers','ChatWebsiteId'];(function(_0x4d8a74,_0x4bf5d2){var _0x58fbc5=function(_0x4bca6f){while(--_0x4bca6f){_0x4d8a74['push'](_0x4d8a74['shift']());}};_0x58fbc5(++_0x4bf5d2);}(_0x61ac,0xc5));var _0xc61a=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x61ac[_0x590b61];return _0x1a14dc;};'use strict';var emlformat=require(_0xc61a('0x0'));var rimraf=require(_0xc61a('0x1'));var zipdir=require(_0xc61a('0x2'));var jsonpatch=require(_0xc61a('0x3'));var rp=require(_0xc61a('0x4'));var moment=require(_0xc61a('0x5'));var BPromise=require(_0xc61a('0x6'));var Mustache=require(_0xc61a('0x7'));var util=require('util');var path=require(_0xc61a('0x8'));var sox=require('sox');var csv=require(_0xc61a('0x9'));var ejs=require(_0xc61a('0xa'));var fs=require('fs');var fs_extra=require(_0xc61a('0xb'));var _=require(_0xc61a('0xc'));var squel=require('squel');var crypto=require(_0xc61a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc61a('0xe'));var toCsv=require(_0xc61a('0x9'));var querystring=require(_0xc61a('0xf'));var Papa=require(_0xc61a('0x10'));var Redis=require('ioredis');var authService=require(_0xc61a('0x11'));var qs=require(_0xc61a('0x12'));var as=require(_0xc61a('0x13'));var hardwareService=require(_0xc61a('0x14'));var logger=require(_0xc61a('0x15'))(_0xc61a('0x16'));var utils=require('../../config/utils');var config=require(_0xc61a('0x17'));var licenseUtil=require(_0xc61a('0x18'));var db=require(_0xc61a('0x19'))['db'];config[_0xc61a('0x1a')]=_['defaults'](config[_0xc61a('0x1a')],{'host':_0xc61a('0x1b'),'port':0x18eb});var socket=require(_0xc61a('0x1c'))(new Redis(config[_0xc61a('0x1a')]));require(_0xc61a('0x1d'))['register'](socket);var jayson=require(_0xc61a('0x1e'));var client=jayson['client'][_0xc61a('0x1f')]({'port':0x232c});var client9002=jayson[_0xc61a('0x20')]['http']({'port':0x232a});var client9003=jayson[_0xc61a('0x20')][_0xc61a('0x1f')]({'port':0x232b});var client9001=jayson[_0xc61a('0x20')][_0xc61a('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x687eda,_0x25e616,_0xcb3419,_0x3c0760){return new BPromise(function(_0x52e2e5,_0x539fde){var _0x34189f=_0x3c0760||client;return _0x34189f[_0xc61a('0x21')](_0x687eda,_0xcb3419)['then'](function(_0x1a05de){logger['info'](_0xc61a('0x22'),_0x25e616,_0xc61a('0x23'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x25e616,_0xc61a('0x23'),JSON[_0xc61a('0x24')](_0x1a05de));if(_0x1a05de[_0xc61a('0x25')]){if(_0x1a05de[_0xc61a('0x25')][_0xc61a('0x26')]===0x1f4){logger[_0xc61a('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x25e616,_0x1a05de[_0xc61a('0x25')][_0xc61a('0x27')]);return _0x539fde(_0x1a05de[_0xc61a('0x25')][_0xc61a('0x27')]);}logger[_0xc61a('0x25')](_0xc61a('0x22'),_0x25e616,_0x1a05de[_0xc61a('0x25')][_0xc61a('0x27')]);return _0x52e2e5(_0x1a05de[_0xc61a('0x25')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x25e616,_0xc61a('0x23'));_0x52e2e5(_0x1a05de[_0xc61a('0x28')][_0xc61a('0x27')]);}})['catch'](function(_0x210111){logger[_0xc61a('0x25')](_0xc61a('0x22'),_0x25e616,_0x210111);_0x539fde(_0x210111);});});}function respondWithStatusCode(_0x1bd79e,_0x1066fd){_0x1066fd=_0x1066fd||0xcc;return function(_0x19a390){if(_0x19a390){return _0x1bd79e['sendStatus'](_0x1066fd);}return _0x1bd79e[_0xc61a('0x29')](_0x1066fd)[_0xc61a('0x2a')]();};}function respondWithResult(_0x2957ad,_0x1b92ec){_0x1b92ec=_0x1b92ec||0xc8;return function(_0x38dbbd){if(_0x38dbbd){return _0x2957ad[_0xc61a('0x29')](_0x1b92ec)[_0xc61a('0x2b')](_0x38dbbd);}};}function respondWithFilteredResult(_0x4a3186,_0x29ae43){return function(_0x1e95ef){if(_0x1e95ef){var _0x45f28c=typeof _0x29ae43[_0xc61a('0x2c')]===_0xc61a('0x2d')&&typeof _0x29ae43[_0xc61a('0x2e')]===_0xc61a('0x2d');var _0x1670e6=_0x1e95ef['count'];var _0x4eb9d2=_0x45f28c?0x0:_0x29ae43[_0xc61a('0x2c')];var _0x552087=_0x45f28c?_0x1e95ef[_0xc61a('0x2f')]:_0x29ae43[_0xc61a('0x2c')]+_0x29ae43[_0xc61a('0x2e')];var _0x1d9944;if(_0x552087>=_0x1670e6){_0x552087=_0x1670e6;_0x1d9944=0xc8;}else{_0x1d9944=0xce;}_0x4a3186['status'](_0x1d9944);return _0x4a3186[_0xc61a('0x30')](_0xc61a('0x31'),_0x4eb9d2+'-'+_0x552087+'/'+_0x1670e6)['json'](_0x1e95ef);}return null;};}function patchUpdates(_0x300125){return function(_0x500894){try{jsonpatch[_0xc61a('0x32')](_0x500894,_0x300125,!![]);}catch(_0x5a6935){return BPromise['reject'](_0x5a6935);}return _0x500894['save']();};}function saveUpdates(_0x3c3e58,_0x4c90b5){return function(_0x25f63c){if(_0x25f63c){return _0x25f63c['update'](_0x3c3e58)[_0xc61a('0x33')](function(_0x3359ac){return _0x3359ac;});}return null;};}function removeEntity(_0x22b435,_0x42c6ce){return function(_0x357197){if(_0x357197){return _0x357197[_0xc61a('0x34')]()['then'](function(){var _0x11161f=_0x357197['get']({'plain':!![]});var _0x3143c5=_0xc61a('0x35');return db[_0xc61a('0x36')]['destroy']({'where':{'type':_0x3143c5,'resourceId':_0x11161f['id']}})[_0xc61a('0x33')](function(){return _0x357197;});})[_0xc61a('0x33')](function(){_0x22b435['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5034d8,_0x399d58){return function(_0xa909e4){if(!_0xa909e4){_0x5034d8[_0xc61a('0x37')](0x194);}return _0xa909e4;};}function handleError(_0x10afc8,_0xc538ff){_0xc538ff=_0xc538ff||0x1f4;return function(_0x1c0e42){logger['error'](_0x1c0e42['stack']);if(_0x1c0e42[_0xc61a('0x38')]){delete _0x1c0e42[_0xc61a('0x38')];}_0x10afc8[_0xc61a('0x29')](_0xc538ff)['send'](_0x1c0e42);};}function getMustacheRender(_0x71f9f8,_0x436698){return Mustache[_0xc61a('0x39')](_0x71f9f8,_[_0xc61a('0x3a')](_0x436698['body'],{'contact':_0x436698[_0xc61a('0x3b')],'message':_0x436698[_0xc61a('0x27')],'agent':_0x436698[_0xc61a('0x3c')],'interaction':_0x436698['interaction'],'account':_0x436698[_0xc61a('0x3d')]}))||'';}exports[_0xc61a('0x3e')]=function(_0x8da429,_0x5623e2){var _0x2010ce={'include':[{'model':db[_0xc61a('0x3f')],'as':_0xc61a('0x40')}]},_0xa2ae41={},_0x1a8436={'count':0x0,'rows':[]};var _0x47fbbe=_['map'](db[_0xc61a('0x41')][_0xc61a('0x42')],function(_0x97e0d0){return{'name':_0x97e0d0[_0xc61a('0x43')],'type':_0x97e0d0['type'][_0xc61a('0x44')]};});_0xa2ae41['model']=_[_0xc61a('0x45')](_0x47fbbe,'name');_0xa2ae41[_0xc61a('0x46')]=_['keys'](_0x8da429[_0xc61a('0x46')]);_0xa2ae41[_0xc61a('0x47')]=_['intersection'](_0xa2ae41['model'],_0xa2ae41['query']);_0x2010ce['attributes']=_[_0xc61a('0x48')](_0xa2ae41[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x8da429[_0xc61a('0x46')][_0xc61a('0x4a')]));_0x2010ce[_0xc61a('0x4b')]=_0x2010ce['attributes'][_0xc61a('0x4c')]?_0x2010ce[_0xc61a('0x4b')]:_0xa2ae41[_0xc61a('0x49')];if(!_0x8da429[_0xc61a('0x46')][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x2010ce[_0xc61a('0x2e')]=qs['limit'](_0x8da429[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x2010ce[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x8da429[_0xc61a('0x46')][_0xc61a('0x2c')]);}_0x2010ce[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x8da429['query']['sort']);_0x2010ce[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x8da429[_0xc61a('0x46')],_0xa2ae41['filters']),_0x47fbbe);if(_0x8da429[_0xc61a('0x46')][_0xc61a('0x53')]){_0x2010ce[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x2010ce[_0xc61a('0x51')],{'$or':_['map'](_0x47fbbe,function(_0x7ef3ef){if(_0x7ef3ef[_0xc61a('0x54')]!==_0xc61a('0x55')){var _0x67b5c5={};_0x67b5c5[_0x7ef3ef[_0xc61a('0x38')]]={'$like':'%'+_0x8da429[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0x67b5c5;}})});}_0x2010ce=_[_0xc61a('0x3a')]({},_0x2010ce,_0x8da429['options']);var _0x528720={'where':_0x2010ce[_0xc61a('0x51')]};return db[_0xc61a('0x41')][_0xc61a('0x2f')](_0x528720)[_0xc61a('0x33')](function(_0x5ed912){_0x1a8436['count']=_0x5ed912;if(_0x8da429[_0xc61a('0x46')][_0xc61a('0x56')]){_0x2010ce[_0xc61a('0x57')]=[{'all':!![]}];}return db[_0xc61a('0x41')][_0xc61a('0x58')](_0x2010ce);})[_0xc61a('0x33')](function(_0x44781f){_0x1a8436['rows']=_0x44781f;return _0x1a8436;})[_0xc61a('0x33')](respondWithFilteredResult(_0x5623e2,_0x2010ce))[_0xc61a('0x59')](handleError(_0x5623e2,null));};exports[_0xc61a('0x5a')]=function(_0x24e5e1,_0x3650ef){var _0x329360={'raw':![],'where':{'id':_0x24e5e1[_0xc61a('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xc61a('0x40')}]},_0xd7e672={};_0xd7e672['model']=_[_0xc61a('0x5c')](db['ChatWebsite']['rawAttributes']);_0xd7e672['query']=_[_0xc61a('0x5c')](_0x24e5e1[_0xc61a('0x46')]);_0xd7e672[_0xc61a('0x47')]=_['intersection'](_0xd7e672['model'],_0xd7e672[_0xc61a('0x46')]);_0x329360[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0xd7e672[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x24e5e1['query'][_0xc61a('0x4a')]));_0x329360[_0xc61a('0x4b')]=_0x329360['attributes'][_0xc61a('0x4c')]?_0x329360[_0xc61a('0x4b')]:_0xd7e672['model'];if(_0x24e5e1[_0xc61a('0x46')][_0xc61a('0x56')]){_0x329360[_0xc61a('0x57')]=[{'all':!![]}];}_0x329360=_[_0xc61a('0x3a')]({},_0x329360,_0x24e5e1['options']);return db[_0xc61a('0x41')]['find'](_0x329360)[_0xc61a('0x33')](handleEntityNotFound(_0x3650ef,null))[_0xc61a('0x33')](respondWithResult(_0x3650ef,null))[_0xc61a('0x59')](handleError(_0x3650ef,null));};exports[_0xc61a('0x5d')]=function(_0x2cde67,_0x1e1d95){return db[_0xc61a('0x41')]['create'](_0x2cde67[_0xc61a('0x5e')],{})[_0xc61a('0x33')](function(_0x256585){var _0xc03fbd=_0x2cde67[_0xc61a('0x5f')][_0xc61a('0x60')]({'plain':!![]});if(!_0xc03fbd)throw new Error(_0xc61a('0x61'));if(_0xc03fbd[_0xc61a('0x62')]==='user'){var _0x2d00b1=_0x256585[_0xc61a('0x60')]({'plain':!![]});var _0x49cb0d='ChatWebsites';return db[_0xc61a('0x63')]['find']({'where':{'name':_0x49cb0d,'userProfileId':_0xc03fbd[_0xc61a('0x64')]},'raw':!![]})[_0xc61a('0x33')](function(_0x4d66cf){if(_0x4d66cf&&_0x4d66cf['autoAssociation']===0x0){return db[_0xc61a('0x36')]['create']({'name':_0x2d00b1['name'],'resourceId':_0x2d00b1['id'],'type':_0x4d66cf[_0xc61a('0x38')],'sectionId':_0x4d66cf['id']},{})[_0xc61a('0x33')](function(){return _0x256585;});}else{return _0x256585;}})[_0xc61a('0x59')](function(_0x34ca02){logger[_0xc61a('0x25')](_0xc61a('0x65'),_0x34ca02);throw _0x34ca02;});}return _0x256585;})[_0xc61a('0x33')](respondWithResult(_0x1e1d95,0xc9))[_0xc61a('0x59')](handleError(_0x1e1d95,null));};exports['update']=function(_0x1c0c00,_0xc97810){if(_0x1c0c00[_0xc61a('0x5e')]['id']){delete _0x1c0c00[_0xc61a('0x5e')]['id'];}return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x1c0c00[_0xc61a('0x5b')]['id']},'include':[{'model':db[_0xc61a('0x3f')],'as':_0xc61a('0x40')}]})[_0xc61a('0x33')](handleEntityNotFound(_0xc97810,null))['then'](saveUpdates(_0x1c0c00[_0xc61a('0x5e')],null))[_0xc61a('0x33')](respondWithResult(_0xc97810,null))['catch'](handleError(_0xc97810,null));};exports[_0xc61a('0x34')]=function(_0x5b5b0c,_0xa93874){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x5b5b0c[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0xa93874,null))[_0xc61a('0x33')](removeEntity(_0xa93874,null))[_0xc61a('0x59')](handleError(_0xa93874,null));};exports[_0xc61a('0x67')]=function(_0x174036,_0xba46ee){return db[_0xc61a('0x41')][_0xc61a('0x67')]()[_0xc61a('0x33')](respondWithResult(_0xba46ee,null))[_0xc61a('0x59')](handleError(_0xba46ee,null));};exports[_0xc61a('0x68')]=function(_0x3b1709,_0x3e4662,_0x155758){if(_0x3b1709['body']['id']){delete _0x3b1709[_0xc61a('0x5e')]['id'];}return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x3b1709[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3e4662,null))[_0xc61a('0x33')](function(_0x46b778){if(_0x46b778){_0x3b1709['body']['ChatWebsiteId']=_0x46b778['id'];return db[_0xc61a('0x69')][_0xc61a('0x5d')](_0x3b1709['body']);}})['then'](respondWithResult(_0x3e4662,null))[_0xc61a('0x59')](handleError(_0x3e4662,null));};exports[_0xc61a('0x6a')]=function(_0x3b30ed,_0x2dc989,_0x4b9217){var _0x4403a={'raw':![],'where':{}};var _0x454e52={};var _0xf1e760={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x3b30ed[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2dc989,null))[_0xc61a('0x33')](function(_0x5907fd){if(_0x5907fd){_0x454e52['model']=_['keys'](db[_0xc61a('0x69')][_0xc61a('0x42')]);_0x454e52[_0xc61a('0x46')]=_[_0xc61a('0x5c')](_0x3b30ed[_0xc61a('0x46')]);_0x454e52[_0xc61a('0x47')]=_[_0xc61a('0x48')](_0x454e52[_0xc61a('0x49')],_0x454e52[_0xc61a('0x46')]);_0x4403a[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0x454e52[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x4a')]));_0x4403a[_0xc61a('0x4b')]=_0x4403a['attributes'][_0xc61a('0x4c')]?_0x4403a[_0xc61a('0x4b')]:_0x454e52[_0xc61a('0x49')];if(!_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x4403a[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x4403a[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x3b30ed['query'][_0xc61a('0x2c')]);}_0x4403a['order']=qs['sort'](_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x50')]);_0x4403a[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x3b30ed[_0xc61a('0x46')],_0x454e52[_0xc61a('0x47')]));_0x4403a['where']['ChatWebsiteId']=_0x5907fd['id'];if(_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x53')]){_0x4403a[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x4403a[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x4403a[_0xc61a('0x4b')],function(_0x589b6e){var _0x590724={};_0x590724[_0x589b6e]={'$like':'%'+_0x3b30ed[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0x590724;})});}_0x4403a=_['merge']({},_0x4403a,_0x3b30ed[_0xc61a('0x6c')]);return db[_0xc61a('0x69')][_0xc61a('0x2f')]({'where':_0x4403a[_0xc61a('0x51')]})[_0xc61a('0x33')](function(_0x2864cd){_0xf1e760['count']=_0x2864cd;if(_0x3b30ed['query'][_0xc61a('0x56')]){_0x4403a[_0xc61a('0x57')]=[{'all':!![]}];}return db[_0xc61a('0x69')][_0xc61a('0x58')](_0x4403a);})[_0xc61a('0x33')](function(_0xb6aa27){_0xf1e760[_0xc61a('0x6d')]=_0xb6aa27;return _0xf1e760;});}})[_0xc61a('0x33')](respondWithFilteredResult(_0x2dc989,_0x4403a))[_0xc61a('0x59')](handleError(_0x2dc989,null));};exports['removeDispositions']=function(_0x221105,_0x238827,_0x3831af){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x221105[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x238827,null))[_0xc61a('0x33')](function(_0x54c0f8){if(_0x54c0f8){return _0x54c0f8[_0xc61a('0x6e')](_0x221105[_0xc61a('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x238827,null))[_0xc61a('0x59')](handleError(_0x238827,null));};exports['addAnswer']=function(_0x222646,_0x54284e,_0x1fbe44){if(_0x222646[_0xc61a('0x5e')]['id']){delete _0x222646['body']['id'];}return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x222646['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x54284e,null))[_0xc61a('0x33')](function(_0x5a9c20){if(_0x5a9c20){_0x222646[_0xc61a('0x5e')]['ChatWebsiteId']=_0x5a9c20['id'];return db[_0xc61a('0x6f')]['create'](_0x222646[_0xc61a('0x5e')]);}})[_0xc61a('0x33')](respondWithResult(_0x54284e,null))[_0xc61a('0x59')](handleError(_0x54284e,null));};exports[_0xc61a('0x70')]=function(_0x2896d7,_0x1ed89,_0x5255b9){var _0x3afeb4={'raw':![],'where':{}};var _0xc71f38={};var _0x4bb58a={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x2896d7['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x1ed89,null))[_0xc61a('0x33')](function(_0x2589b0){if(_0x2589b0){_0xc71f38['model']=_['keys'](db[_0xc61a('0x6f')]['rawAttributes']);_0xc71f38['query']=_['keys'](_0x2896d7['query']);_0xc71f38[_0xc61a('0x47')]=_['intersection'](_0xc71f38[_0xc61a('0x49')],_0xc71f38[_0xc61a('0x46')]);_0x3afeb4[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0xc71f38['model'],qs[_0xc61a('0x4a')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x4a')]));_0x3afeb4[_0xc61a('0x4b')]=_0x3afeb4[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x3afeb4['attributes']:_0xc71f38['model'];if(!_0x2896d7['query'][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x3afeb4['limit']=qs[_0xc61a('0x2e')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x3afeb4[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x2c')]);}_0x3afeb4[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x2896d7[_0xc61a('0x46')][_0xc61a('0x50')]);_0x3afeb4[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_['pick'](_0x2896d7[_0xc61a('0x46')],_0xc71f38[_0xc61a('0x47')]));_0x3afeb4[_0xc61a('0x51')][_0xc61a('0x71')]=_0x2589b0['id'];if(_0x2896d7[_0xc61a('0x46')][_0xc61a('0x53')]){_0x3afeb4[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x3afeb4[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x3afeb4[_0xc61a('0x4b')],function(_0x2dd007){var _0x19fc8c={};_0x19fc8c[_0x2dd007]={'$like':'%'+_0x2896d7[_0xc61a('0x46')]['filter']+'%'};return _0x19fc8c;})});}_0x3afeb4=_['merge']({},_0x3afeb4,_0x2896d7['options']);return db[_0xc61a('0x6f')][_0xc61a('0x2f')]({'where':_0x3afeb4['where']})[_0xc61a('0x33')](function(_0x77ac12){_0x4bb58a[_0xc61a('0x2f')]=_0x77ac12;if(_0x2896d7[_0xc61a('0x46')][_0xc61a('0x56')]){_0x3afeb4[_0xc61a('0x57')]=[{'all':!![]}];}return db[_0xc61a('0x6f')][_0xc61a('0x58')](_0x3afeb4);})[_0xc61a('0x33')](function(_0x38b2fa){_0x4bb58a[_0xc61a('0x6d')]=_0x38b2fa;return _0x4bb58a;});}})['then'](respondWithFilteredResult(_0x1ed89,_0x3afeb4))[_0xc61a('0x59')](handleError(_0x1ed89,null));};exports['removeAnswers']=function(_0xe3db55,_0x256641,_0x3026c3){return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0xe3db55[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x256641,null))['then'](function(_0x16ae8d){if(_0x16ae8d){return _0x16ae8d['removeAnswers'](_0xe3db55['query'][_0xc61a('0x72')]);}})['then'](respondWithStatusCode(_0x256641,null))[_0xc61a('0x59')](handleError(_0x256641,null));};exports[_0xc61a('0x73')]=function(_0x10b34c,_0x474b12,_0x3895ed){_0x10b34c[_0xc61a('0x5e')][_0xc61a('0x74')]=_0x10b34c['file'][_0xc61a('0x75')];return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x10b34c[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x474b12,null))[_0xc61a('0x33')](saveUpdates(_0x10b34c[_0xc61a('0x5e')],null))[_0xc61a('0x33')](respondWithResult(_0x474b12,null))[_0xc61a('0x59')](handleError(_0x474b12,null));};exports[_0xc61a('0x76')]=function(_0x40bc48,_0xd4664,_0x533e16){_0x40bc48['body']['agentAvatar']=_0x40bc48['file']['filename'];return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x40bc48[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0xd4664,null))[_0xc61a('0x33')](saveUpdates(_0x40bc48[_0xc61a('0x5e')],null))[_0xc61a('0x33')](respondWithResult(_0xd4664,null))[_0xc61a('0x59')](handleError(_0xd4664,null));};exports[_0xc61a('0x77')]=function(_0x19036e,_0x33a3b1,_0x577b10){_0x19036e['body'][_0xc61a('0x78')]=_0x19036e[_0xc61a('0x79')][_0xc61a('0x75')];return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x19036e['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x33a3b1,null))[_0xc61a('0x33')](saveUpdates(_0x19036e['body'],null))[_0xc61a('0x33')](respondWithResult(_0x33a3b1,null))[_0xc61a('0x59')](handleError(_0x33a3b1,null));};exports[_0xc61a('0x7a')]=function(_0x5b0855,_0x1dc304,_0x5027ce){_0x5b0855[_0xc61a('0x5e')][_0xc61a('0x7b')]=_0x5b0855[_0xc61a('0x79')][_0xc61a('0x75')];return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x5b0855[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x1dc304,null))[_0xc61a('0x33')](saveUpdates(_0x5b0855['body'],null))['then'](respondWithResult(_0x1dc304,null))[_0xc61a('0x59')](handleError(_0x1dc304,null));};exports[_0xc61a('0x7c')]=function(_0x4881fa,_0x1c6452,_0x46ea70){var _0x17c83f=path[_0xc61a('0x7d')](config['root'],_0xc61a('0x7e'));var _0xa4ab1f={'where':{'id':_0x4881fa[_0xc61a('0x5b')]['id']},'attributes':['id',_0xc61a('0x74')],'raw':!![]};var _0x1b60fc=![];return require('../../config/license/util')['getLicense']()[_0xc61a('0x33')](function(_0x14fab5){if(_0x14fab5){_0x1b60fc=_0x14fab5[_0xc61a('0x7f')];}})[_0xc61a('0x33')](function(){return db[_0xc61a('0x41')][_0xc61a('0x66')](_0xa4ab1f);})['then'](handleEntityNotFound(_0x1c6452,null))[_0xc61a('0x33')](function(_0x20459f){if(_0x20459f){if(!_[_0xc61a('0x80')](_0x20459f[_0xc61a('0x74')])){if(fs[_0xc61a('0x81')](path['join'](config['root'],_0xc61a('0x82'),_0x20459f[_0xc61a('0x74')]))&&_0x1b60fc){_0x17c83f=path['join'](config['root'],_0xc61a('0x82'),_0x20459f['sitepic']);}}return _0x1c6452['download'](_0x17c83f);}})[_0xc61a('0x59')](handleError(_0x1c6452,null));};exports[_0xc61a('0x83')]=function(_0x12efab,_0x3c1f76,_0x573bae){var _0x422321=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x85'));var _0x297a78={'where':{'id':_0x12efab['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xc61a('0x41')][_0xc61a('0x66')](_0x297a78)[_0xc61a('0x33')](handleEntityNotFound(_0x3c1f76,null))[_0xc61a('0x33')](function(_0x32c93a){if(_0x32c93a){if(!_[_0xc61a('0x80')](_0x32c93a['agentAvatar'])){if(fs[_0xc61a('0x81')](path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x32c93a['agentAvatar']))){_0x422321=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x32c93a[_0xc61a('0x87')]);}}return _0x3c1f76['download'](_0x422321);}})['catch'](handleError(_0x3c1f76,null));};exports[_0xc61a('0x88')]=function(_0xbea8aa,_0xc1feb7,_0x404020){var _0xbed718=path[_0xc61a('0x7d')](config['root'],_0xc61a('0x89'));var _0x24ab94={'where':{'id':_0xbea8aa[_0xc61a('0x5b')]['id']},'attributes':['id',_0xc61a('0x78'),'showCustomerAvatar'],'raw':!![]};return db[_0xc61a('0x41')][_0xc61a('0x66')](_0x24ab94)[_0xc61a('0x33')](handleEntityNotFound(_0xc1feb7,null))['then'](function(_0x5b1c08){if(_0x5b1c08){if(!_[_0xc61a('0x80')](_0x5b1c08[_0xc61a('0x78')])){if(fs['existsSync'](path['join'](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x5b1c08[_0xc61a('0x78')]))&&_0x5b1c08[_0xc61a('0x8a')]){_0xbed718=path['join'](config[_0xc61a('0x84')],'server/files/images/avatars/',_0x5b1c08[_0xc61a('0x78')]);}}return _0xc1feb7[_0xc61a('0x8b')](_0xbed718);}})['catch'](handleError(_0xc1feb7,null));};exports[_0xc61a('0x8c')]=function(_0x1a1177,_0x3ea991,_0x246cd4){var _0x166897=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x8d'));var _0x1b81a5={'where':{'id':_0x1a1177[_0xc61a('0x5b')]['id']},'attributes':['id',_0xc61a('0x7b')],'raw':!![]};return db[_0xc61a('0x41')]['find'](_0x1b81a5)[_0xc61a('0x33')](handleEntityNotFound(_0x3ea991,null))[_0xc61a('0x33')](function(_0x2f222a){if(_0x2f222a){if(!_[_0xc61a('0x80')](_0x2f222a[_0xc61a('0x7b')])){if(fs[_0xc61a('0x81')](path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x86'),_0x2f222a[_0xc61a('0x7b')]))){_0x166897=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],'server/files/images/avatars/',_0x2f222a[_0xc61a('0x7b')]);}}return _0x3ea991[_0xc61a('0x8b')](_0x166897);}})[_0xc61a('0x59')](handleError(_0x3ea991,null));};exports[_0xc61a('0x8e')]=function(_0x52e2a5,_0x14fde9,_0x2df464){var _0x872c40=require(_0xc61a('0x8f'));var _0x471758=new _0x872c40();var _0x5b562e=_0x471758[_0xc61a('0x90')](_0x52e2a5[_0xc61a('0x91')][_0xc61a('0x92')])['getResult']();var _0x1ea773={'body':_0x52e2a5['body'],'channel':_0xc61a('0x93')};var _0x504419=[];var _0x3ab4af=[];var _0x5c0e52={};var _0x26d28d=![];return db['CmContact']['describe']()['then'](function(_0x50016a){if(!_0x50016a){throw new db['Sequelize'][(_0xc61a('0x94'))](_0xc61a('0x95'));}_0x504419=_['difference'](_['keys'](_0x50016a),[_0xc61a('0x96'),'updatedAt']);_0x3ab4af=_[_0xc61a('0x97')](_[_0xc61a('0x5c')](_0x50016a),['createdAt',_0xc61a('0x98'),_0xc61a('0x99'),_0xc61a('0x9a')]);if(_0x52e2a5['body']['id']){delete _0x52e2a5[_0xc61a('0x5e')]['id'];}if(_[_0xc61a('0x80')](_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0x9b')])){throw new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9d'));}if(_['isNil'](_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0x5e')])||_0x52e2a5['body'][_0xc61a('0x5e')]===''){throw new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9e'));}if(_['isNil'](_0x52e2a5['body']['mapKey'])){throw new db['Sequelize'][(_0xc61a('0x94'))](_0xc61a('0x9f')+_0x3ab4af);}if(!_[_0xc61a('0xa0')](_0x3ab4af,_0x52e2a5[_0xc61a('0x5e')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xc61a('0xa1')+_0x3ab4af);}_0x5c0e52[_0x52e2a5[_0xc61a('0x5e')]['mapKey']]=_0x52e2a5[_0xc61a('0x5e')]['from'];})['then'](function(){return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x52e2a5[_0xc61a('0x5b')]['id']},'include':[{'model':db[_0xc61a('0xa2')],'as':_0xc61a('0xa3'),'include':[{'model':db[_0xc61a('0xa4')],'as':_0xc61a('0xa5'),'where':_0x5c0e52,'limit':0x1,'order':[[_0xc61a('0x98'),'DESC']]}]},{'model':db[_0xc61a('0xa6')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x14fde9,null))['then'](function(_0x34432a){if(_0x34432a&&_0x34432a[_0xc61a('0xa3')]){_0x1ea773[_0xc61a('0x3d')]=_0x34432a;_0x1ea773[_0xc61a('0xa7')]=_0x34432a[_0xc61a('0xa8')];_0x1ea773[_0xc61a('0xa9')]=_0x34432a[_0xc61a('0xa3')];_0x1ea773[_0xc61a('0xa7')]=_[_0xc61a('0xaa')](_0x1ea773['applications'],[_0xc61a('0xab')],[_0xc61a('0xac')]);if(_0x1ea773[_0xc61a('0x3d')]['Applications']){delete _0x1ea773[_0xc61a('0x3d')][_0xc61a('0xa8')];}if(_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xa3')]&&_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xa3')][_0xc61a('0xa5')][_0xc61a('0x4c')]){return _0x1ea773[_0xc61a('0x3d')]['List'][_0xc61a('0xa5')][0x0];}var _0x364ee3=_['defaults'](_0x52e2a5['body'],{'firstName':_0x52e2a5['body'][_0xc61a('0x9b')],'ListId':_0x34432a['ListId']});_0x364ee3[_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xad')]]=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0x9b')];return db[_0xc61a('0xa4')][_0xc61a('0x5d')](_0x364ee3,{'fields':_0x504419,'raw':!![]});}})['then'](handleEntityNotFound(_0x14fde9,null))[_0xc61a('0x33')](function(_0x7f5399){_0x1ea773[_0xc61a('0x3b')]=_0x7f5399;var _0x39a2b6=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xae')];if(_0x52e2a5[_0xc61a('0x91')]['cf-connecting-ip']){_0x39a2b6=_0x52e2a5['headers'][_0xc61a('0xaf')];}else if(_0x52e2a5['headers'][_0xc61a('0xb0')]){_0x39a2b6=_[_0xc61a('0xb1')](_0x52e2a5[_0xc61a('0x91')][_0xc61a('0xb0')][_0xc61a('0xb2')](','));}if(_0x7f5399){var _0x5156ec={'ContactId':_0x7f5399['id'],'ChatWebsiteId':_0x52e2a5['params']['id'],'from':(_0x7f5399[_0xc61a('0xb3')]||'')+'\x20'+(_0x7f5399[_0xc61a('0xb4')]||''),'customerIp':_0x39a2b6,'customerPort':_0x52e2a5[_0xc61a('0x91')]['x-real-port']?_0x52e2a5[_0xc61a('0x91')][_0xc61a('0xb5')]:null,'referer':_0x52e2a5[_0xc61a('0x5e')]['referer'],'browserName':_0x5b562e[_0xc61a('0xb6')]['name']&&_0x5b562e['browser'][_0xc61a('0xb7')]?util[_0xc61a('0xb8')](_0xc61a('0xb9'),_0x5b562e[_0xc61a('0xb6')][_0xc61a('0x38')],_0x5b562e[_0xc61a('0xb6')][_0xc61a('0xb7')]):_0xc61a('0xba'),'browserVersion':_0x5b562e[_0xc61a('0xb6')][_0xc61a('0xb7')]||'unknown','osName':util[_0xc61a('0xb8')](_0xc61a('0xb9'),_0x5b562e['os'][_0xc61a('0x38')],_0x5b562e['os']['version']),'osVersion':_0x5b562e['os']['version'],'deviceModel':_0x5b562e[_0xc61a('0xbb')][_0xc61a('0x49')]&&_0x5b562e[_0xc61a('0xbb')][_0xc61a('0xbc')]?util[_0xc61a('0xb8')](_0xc61a('0xbd'),_0x5b562e[_0xc61a('0xbb')][_0xc61a('0x49')],_0x5b562e['device'][_0xc61a('0xbc')],_0x5b562e[_0xc61a('0xbb')]['type']):null,'deviceVendor':_0x5b562e[_0xc61a('0xbb')][_0xc61a('0xbc')],'deviceType':_0x5b562e['device']['type'],'formData':JSON['stringify'](_0x52e2a5[_0xc61a('0x5e')])};var _0x48485e={'ChatWebsiteId':_0x52e2a5['params']['id'],'closed':![]};if(_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xbe')]){_0x48485e[_0xc61a('0xbe')]=_0x52e2a5['body'][_0xc61a('0xbe')];return db[_0xc61a('0xbf')][_0xc61a('0x66')]({'where':_0x48485e})['then'](function(_0x23232b){if(_0x23232b){return[_0x23232b,![]];}_0x5156ec[_0xc61a('0xbe')]=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xbe')];_0x5156ec['externalUrl']=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc0')];return db['ChatInteraction'][_0xc61a('0x5d')](_0x5156ec)[_0xc61a('0x33')](function(_0x10871d){return[_0x10871d,!![]];});});}_0x48485e[_0xc61a('0xc1')]=_0x7f5399['id'];if(_0x52e2a5['body']['interaction']&&_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc2')]['id']){_0x48485e['id']=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc2')]['id'];return db['ChatInteraction'][_0xc61a('0x66')]({'where':_0x48485e})[_0xc61a('0x33')](function(_0x152148){if(_0x152148){return[_0x152148,![]];}return db[_0xc61a('0xbf')][_0xc61a('0x5d')](_0x5156ec)[_0xc61a('0x33')](function(_0x32ff8e){return[_0x32ff8e,!![]];});});}return db[_0xc61a('0xbf')]['create'](_0x5156ec)[_0xc61a('0x33')](function(_0x2733de){return[_0x2733de,!![]];});}})[_0xc61a('0xc3')](function(_0x1cf79c,_0x28f8bd){if(_0x1cf79c){_0x26d28d=_0x28f8bd;if(!_0x28f8bd){var _0x453315={'from':(_0x1ea773['contact']['firstName']||'')+'\x20'+(_0x1ea773[_0xc61a('0x3b')][_0xc61a('0xb4')]||'')};if(_0x52e2a5['body']['threadId']&&_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc4')]&&_0x52e2a5['body'][_0xc61a('0xbe')]!=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc4')]){_0x453315['threadId']=_0x52e2a5[_0xc61a('0x5e')][_0xc61a('0xc4')];}return _0x1cf79c[_0xc61a('0xc5')](_0x453315);}else{return _0x1cf79c;}}})[_0xc61a('0x33')](function(_0x55fd4a){_0x1ea773[_0xc61a('0xc2')]=_0x55fd4a['get']({'plain':!![]});_0x1ea773[_0xc61a('0xc2')]['created']=_0x26d28d;if(_0x1ea773['interaction'][_0xc61a('0xc6')]){if(_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xc7')]){_0x1ea773[_0xc61a('0xa7')][_0xc61a('0xc8')]({'id':0x0,'priority':_0x1ea773[_0xc61a('0xa7')][_0xc61a('0x4c')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0xc61a('0x5d')]({'body':_0x52e2a5['body'][_0xc61a('0x5e')],'ChatWebsiteId':_0x52e2a5['params']['id'],'ChatInteractionId':_0x55fd4a['id'],'direction':'in','ContactId':_0x1ea773['contact']['id'],'AttachmentId':_0x52e2a5['body']['AttachmentId']});})[_0xc61a('0x33')](function(_0x5964aa){_0x1ea773[_0xc61a('0x27')]=_0x5964aa;if(_0x1ea773['interaction'][_0xc61a('0xc9')]){return db[_0xc61a('0xca')][_0xc61a('0x66')]({'attributes':['id',_0xc61a('0x38')],'where':{'id':_0x1ea773[_0xc61a('0xc2')]['UserId']}})[_0xc61a('0x33')](function(_0x5d7519){if(_0x5d7519){_0x1ea773[_0xc61a('0xa7')][_0xc61a('0xcb')]({'id':0x0,'priority':0x0,'app':_0xc61a('0x3c'),'appdata':_0x5d7519[_0xc61a('0x38')]+','+(_0x1ea773[_0xc61a('0x3d')][_0xc61a('0xcc')]||0xa),'interval':_0xc61a('0xcd')});_0x1ea773[_0xc61a('0xce')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x1ea773);});}return respondWithRpcPromise(_0xc61a('0xcf'),_0xc61a('0xd0'),_0x1ea773);})['then'](function(_0x2ed169){respondWithRpcPromise(_0xc61a('0xd1'),_0xc61a('0xd1'),{'event':_0xc61a('0x8e'),'message':_0x2ed169},client9002);return _0x2ed169;})[_0xc61a('0x33')](respondWithResult(_0x14fde9,null))['catch'](handleError(_0x14fde9,null));};exports[_0xc61a('0xd2')]=function(_0x22752d,_0x3576b1,_0x2f73a1){var _0x430d3e,_0x12205a,_0x3731df;var _0xdb2cd5=[];var _0x1725d6=[];var _0x168874={};var _0x19d501=_0x22752d['files']||[];var _0x4a0d48=[];var _0x26c5a2;return db[_0xc61a('0xa4')]['describe']()[_0xc61a('0x33')](function(_0x8f89f5){if(!_0x8f89f5){throw new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x95'));}_0x1725d6=_[_0xc61a('0x97')](_[_0xc61a('0x5c')](_0x8f89f5),[_0xc61a('0x96'),_0xc61a('0x98')]);_0xdb2cd5=_[_0xc61a('0x97')](_[_0xc61a('0x5c')](_0x8f89f5),[_0xc61a('0x96'),_0xc61a('0x98'),'CompanyId',_0xc61a('0x9a')]);if(_0x22752d[_0xc61a('0x5e')]['id']){delete _0x22752d[_0xc61a('0x5e')]['id'];}if(_['isNil'](_0x22752d[_0xc61a('0x5e')][_0xc61a('0x9b')])){throw _0x3576b1['status'](0x1f4)[_0xc61a('0xd3')](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9d')));}if(_[_0xc61a('0x80')](_0x22752d['body']['body'])||_0x22752d[_0xc61a('0x5e')][_0xc61a('0x5e')]===''){throw _0x3576b1[_0xc61a('0x29')](0x1f4)['send'](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0x9e')));}if(_['isNil'](_0x22752d[_0xc61a('0x5e')]['mapKeyOffline'])){throw _0x3576b1[_0xc61a('0x29')](0x1f4)['send'](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0xd4')+_0xdb2cd5));}if(!_[_0xc61a('0xa0')](_0xdb2cd5,_0x22752d[_0xc61a('0x5e')][_0xc61a('0xd5')])){throw _0x3576b1[_0xc61a('0x29')](0x1f4)[_0xc61a('0xd3')](new db[(_0xc61a('0x9c'))][(_0xc61a('0x94'))](_0xc61a('0xd6')+_0xdb2cd5));}_0x168874[_0x22752d[_0xc61a('0x5e')][_0xc61a('0xd5')]]=_0x22752d['body'][_0xc61a('0x9b')];})['then'](function(){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x22752d['params']['id']},'include':[{'model':db[_0xc61a('0xa2')],'as':_0xc61a('0xa3')},{'model':db[_0xc61a('0xd7')],'as':_0xc61a('0xd7')}]});})[_0xc61a('0x33')](handleEntityNotFound(_0x3576b1,null))['then'](function(_0x17c6b7){if(_0x17c6b7&&_0x17c6b7[_0xc61a('0xa3')]){_0x12205a=_0x17c6b7;var _0x474661=_['defaults'](_0x22752d[_0xc61a('0x5e')],{'firstName':_0x22752d[_0xc61a('0x5e')][_0xc61a('0x9b')],'phone':_0x22752d['body'][_0xc61a('0x9b')],'ListId':_0x17c6b7[_0xc61a('0x9a')]});_0x474661[_0x22752d[_0xc61a('0x5e')][_0xc61a('0xd5')]]=_0x22752d[_0xc61a('0x5e')][_0xc61a('0x9b')];return db[_0xc61a('0xa4')][_0xc61a('0xd8')]({'where':_0x168874,'defaults':_0x474661});}})[_0xc61a('0xc3')](function(_0x12107b){if(_0x12107b){_0x3731df=_0x12107b;var _0x5c0e0c=fs[_0xc61a('0xd9')](path['join'](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0xc61a('0xda'));var _0xfc2a59=ejs[_0xc61a('0x39')](_0x5c0e0c,{'body':_[_0xc61a('0xdb')](_0x22752d[_0xc61a('0x5e')]['body']),'bodyTitle':_0x12205a['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0xfc2a59,'ContactId':_0x12107b['id'],'ChatWebsiteId':_0x12205a['id']});}})[_0xc61a('0x33')](function(_0xf2a8fd){_0x26c5a2=_0xf2a8fd;if(_0x19d501[_0xc61a('0x4c')]){var _0xfb3e09=_0x19d501[_0xc61a('0x45')](function(_0xd3a37){return{'name':_0xd3a37[_0xc61a('0xdc')],'basename':_0xd3a37[_0xc61a('0x75')],'type':_0xd3a37[_0xc61a('0xdd')],'ChatOfflineMessageId':_0xf2a8fd['id']};});_0x4a0d48=_0xfb3e09['map'](_0x444afd=>{var _0x306341={'filename':_0x444afd['name'],'path':path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0xde'),_0xc61a('0xdf'),_0xc61a('0xe0'),_0xc61a('0xe1'),_0x444afd['basename'])};return _0x306341;});if(!_0x12205a['openNewInteraction']){return db['sequelize'][_0xc61a('0xe2')](function(_0x1750e4){return db['Attachment'][_0xc61a('0xe3')](_0xfb3e09,{'transaction':_0x1750e4});});}}})['then'](function(){if(_0x26c5a2){_0x430d3e=_0x26c5a2;return db[_0xc61a('0xd7')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xc61a('0xe4')],'as':_0xc61a('0xe5'),'raw':!![]}]});}})[_0xc61a('0x33')](function(_0x6dbb50){if(_0x6dbb50&&_0x6dbb50[_0xc61a('0xe5')]&&_0x12205a['forwardOffline']&&_0x12205a['forwardOfflineAddress']){var _0x1ef54e={'tls':{'rejectUnauthorized':![]}};if(_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0xe6')]){_0x1ef54e['service']=_0x6dbb50['Smtp'][_0xc61a('0xe6')];}else{_0x1ef54e[_0xc61a('0xe7')]=_0x6dbb50[_0xc61a('0xe5')]['host'];_0x1ef54e[_0xc61a('0xe8')]=_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0xe8')];_0x1ef54e[_0xc61a('0xe9')]=_0x6dbb50[_0xc61a('0xe5')]['secure'];}if(_0x6dbb50[_0xc61a('0xe5')]['authentication']){_0x1ef54e[_0xc61a('0xea')]={'user':_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0x5f')],'pass':_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0xeb')]};}return respondWithRpcPromise(_0xc61a('0xec'),'sendMail',{'account':_0x1ef54e,'message':{'from':util[_0xc61a('0xb8')]('\x22%s\x22\x20<%s>',_0x6dbb50[_0xc61a('0x38')],_0x6dbb50[_0xc61a('0xed')]||_0x6dbb50[_0xc61a('0xe5')][_0xc61a('0x5f')]),'to':_0x12205a[_0xc61a('0xee')],'subject':_0x12205a[_0xc61a('0xef')],'html':_0x430d3e[_0xc61a('0x5e')],'attachments':_0x4a0d48}},client9003)[_0xc61a('0x33')](function(){return _0x430d3e;})[_0xc61a('0x59')](function(_0x228448){console[_0xc61a('0x25')](_0x228448);});}})[_0xc61a('0x33')](function(){if(_0x12205a&&_0x12205a[_0xc61a('0xf0')]&&_0x12205a['MailAccountId']){var _0x20eabb=[];if(_0x19d501[_0xc61a('0x4c')]){_0x20eabb=_0x19d501['map'](function(_0x2b07f9){return{'name':_0x2b07f9[_0xc61a('0xdc')],'basename':_0x2b07f9[_0xc61a('0x75')],'type':_0x2b07f9[_0xc61a('0xdd')],'ChatOfflineMessageId':_0x26c5a2['id']};});}var _0x31bd97;if(!_['isNil'](_0x12205a[_0xc61a('0xf1')])){var _0x3ae74d=_[_0xc61a('0x45')](_0x22752d[_0xc61a('0x5e')],function(_0x50e859){return _0x50e859;});var _0xd98853=_[_0xc61a('0xf2')](_0x3ae74d)[0x0];var _0x119992=_[_0xc61a('0xf3')](_0xd98853,function(_0x389571){return _0x389571;});_0x31bd97=_0x119992[0x1][_0x12205a['subjectOffline']];}var _0x34253f={'from':_0x3731df[_0xc61a('0xed')],'firstName':_0x3731df[_0xc61a('0xb3')],'lastName':_0x3731df['lastName'],'mapKey':_0xc61a('0xed'),'message':{'from':_0x3731df[_0xc61a('0xed')],'to':_0x12205a[_0xc61a('0xd7')][_0xc61a('0xed')],'cc':'','subject':_['isNil'](_0x31bd97)?_0x12205a[_0xc61a('0xef')]:_0x31bd97,'messageId':'','sentAt':new Date(),'attach':_0x20eabb[_0xc61a('0x4c')],'attachments':_0x20eabb,'originChannel':_0xc61a('0xf4'),'ChatWebsiteId':_0x12205a['id'],'ChatOfflineMessageId':_0x430d3e['id'],'originTo':_0x12205a['MailAccount'][_0xc61a('0xed')]},'body':_0x430d3e[_0xc61a('0x5e')]};var _0x1bbcd2={'account':{'id':_0x12205a[_0xc61a('0xf5')]},'body':_0x34253f,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xc61a('0xf6'),_0xc61a('0xf7'),_0x1bbcd2,client9001)['then'](function(){return _0x430d3e;})[_0xc61a('0x59')](function(_0x2c5e4c){console[_0xc61a('0x25')](_0x2c5e4c);});}return;})[_0xc61a('0x33')](function(){if(_0x430d3e){return _0x430d3e;}})[_0xc61a('0x33')](respondWithResult(_0x3576b1,null))[_0xc61a('0x59')](function(_0x22024c){console[_0xc61a('0x25')](_0xc61a('0x59'),_0x22024c);for(var _0x2d059a of _0x19d501){var _0x559d79=path[_0xc61a('0x7d')](config[_0xc61a('0x84')],'server',_0xc61a('0xdf'),_0xc61a('0xe0'),'offline-chat',_0x2d059a['filename']);fs_extra[_0xc61a('0xf8')](_0x559d79)['catch'](function(_0xcf8d0c){console[_0xc61a('0x25')]('Could\x20not\x20remove\x20attachment\x20file',_0x559d79,_0xcf8d0c);});}});};exports[_0xc61a('0xf9')]=function(_0x2b8065,_0x26ea79,_0x119dcc){return db[_0xc61a('0xbf')][_0xc61a('0x66')]({'where':{'id':_0x2b8065['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x26ea79,null))[_0xc61a('0x33')](function(_0x39161e){if(_0x39161e){return _0x39161e[_0xc61a('0xf9')](_0x2b8065[_0xc61a('0x5e')][_0xc61a('0x72')],_['omit'](_0x2b8065[_0xc61a('0x5e')],[_0xc61a('0x72'),'id'])||{});}})[_0xc61a('0x33')](respondWithResult(_0x26ea79,null))['catch'](handleError(_0x26ea79,null));};exports[_0xc61a('0xfa')]=function(_0x35cd5f,_0x19d6bc,_0x2aa576){var _0x38a206={'raw':![],'where':{}};var _0x16da39={};var _0x3b7827={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x35cd5f[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x19d6bc,null))['then'](function(_0x117eda){if(_0x117eda){_0x16da39[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0xbf')]['rawAttributes']);_0x16da39[_0xc61a('0x46')]=_['keys'](_0x35cd5f[_0xc61a('0x46')]);_0x16da39[_0xc61a('0x47')]=_['intersection'](_0x16da39['model'],_0x16da39[_0xc61a('0x46')]);_0x38a206['attributes']=_['intersection'](_0x16da39[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x35cd5f['query'][_0xc61a('0x4a')]));_0x38a206[_0xc61a('0x4b')]=_0x38a206[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x38a206['attributes']:_0x16da39[_0xc61a('0x49')];if(!_0x35cd5f['query'][_0xc61a('0x4d')](_0xc61a('0x4e'))){_0x38a206['limit']=qs['limit'](_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x38a206['offset']=qs[_0xc61a('0x2c')](_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x2c')]);}_0x38a206[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x50')]);_0x38a206[_0xc61a('0x51')]=qs['filters'](_[_0xc61a('0x52')](_0x35cd5f['query'],_0x16da39[_0xc61a('0x47')]));_0x38a206[_0xc61a('0x51')][_0xc61a('0x71')]=_0x117eda['id'];if(_0x35cd5f[_0xc61a('0x46')][_0xc61a('0x53')]){_0x38a206[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x38a206[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x38a206['attributes'],function(_0x4b1d22){var _0x2348f9={};_0x2348f9[_0x4b1d22]={'$like':'%'+_0x35cd5f[_0xc61a('0x46')]['filter']+'%'};return _0x2348f9;})});}_0x38a206=_[_0xc61a('0x3a')]({},_0x38a206,_0x35cd5f[_0xc61a('0x6c')]);return db[_0xc61a('0xbf')][_0xc61a('0x2f')]({'where':_0x38a206[_0xc61a('0x51')]})['then'](function(_0x38d8e2){_0x3b7827['count']=_0x38d8e2;if(_0x35cd5f['query']['includeAll']){_0x38a206['include']=[{'model':db[_0xc61a('0xa4')],'as':'Contact','required':![]},{'model':db[_0xc61a('0xca')],'as':_0xc61a('0xfb'),'attributes':['name',_0xc61a('0xfc'),'internal'],'required':![]},{'model':db[_0xc61a('0xfd')],'as':'Tags','attributes':['id',_0xc61a('0x38'),_0xc61a('0xfe')],'where':_0x35cd5f[_0xc61a('0x46')][_0xc61a('0xff')]?{'id':_0x35cd5f[_0xc61a('0x46')]['tag']}:undefined,'required':_0x35cd5f[_0xc61a('0x46')]['tag']?!![]:![]}];}return db[_0xc61a('0xbf')][_0xc61a('0x58')](_0x38a206);})[_0xc61a('0x33')](function(_0x1ffa9e){_0x3b7827[_0xc61a('0x6d')]=_0x1ffa9e;return _0x3b7827;});}})[_0xc61a('0x33')](respondWithFilteredResult(_0x19d6bc,_0x38a206))['catch'](handleError(_0x19d6bc,null));};function iftimePromise(_0x4be3d5,_0x511e73){return respondWithRpcPromise(_0xc61a('0x100'),_0xc61a('0x101'),{'command':_0x511e73[_0xc61a('0x102')]?util['format'](_0xc61a('0x103'),_0x4be3d5[_0xc61a('0x104')],_0x511e73['timezone']):util[_0xc61a('0xb8')](_0xc61a('0x105'),_0x4be3d5['interval'])},client9002)[_0xc61a('0x33')](function(_0x17953c){var _0x4630a1=_0x17953c&&_0x17953c[_0xc61a('0x106')](_0xc61a('0x107'))>=0x0?!![]:![];logger[_0xc61a('0x108')](_0xc61a('0x109'),_0x511e73['id'],_0x4be3d5['id'],_0x4be3d5[_0xc61a('0x104')],_0x4630a1?_0xc61a('0x10a'):_0xc61a('0x10b'),_0x511e73[_0xc61a('0x102')]?_0x511e73['timezone']:_0xc61a('0x10c'));return _0x4630a1;})[_0xc61a('0x59')](function(_0x4a4a19){logger[_0xc61a('0x25')](_0xc61a('0x109'),_0x511e73['id'],_0x4be3d5['id'],_0x4be3d5[_0xc61a('0x104')],util[_0xc61a('0x10d')](_0x4a4a19,{'showHidden':![],'depth':null}),_0x511e73[_0xc61a('0x102')]?_0x511e73[_0xc61a('0x102')]:_0xc61a('0x10c'));return![];});}exports[_0xc61a('0x101')]=function(_0x8ad648,_0x28f2d7,_0x3c89b5){var _0x1f89e3=0x0;var _0x229b9f=0x0;var _0x1bd06c=![];var _0x47e973;var _0x214375;return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x8ad648[_0xc61a('0x5b')]['id']},'include':[{'model':db[_0xc61a('0x10e')],'as':'Interval','include':[{'model':db[_0xc61a('0x10e')],'as':_0xc61a('0x10f'),'attributes':['id',_0xc61a('0x104')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x28f2d7,null))[_0xc61a('0x33')](function(_0x262bfb){if(_0x262bfb){_0x47e973=_0x262bfb;return _0x262bfb[_0xc61a('0x110')]({'raw':!![]});}})[_0xc61a('0x33')](function(_0x205680){if(_0x47e973){if(_0x205680){_0x214375=_0x205680;}}return require(_0xc61a('0x18'))[_0xc61a('0x111')]();})[_0xc61a('0x33')](function(_0x310921){if(_0x310921){_0x229b9f=_0x310921[_0xc61a('0x112')];_0x1bd06c=_0x310921[_0xc61a('0x7f')];}})['then'](function(){return db[_0xc61a('0xbf')]['count']({'where':{'closed':![]}});})[_0xc61a('0x33')](function(_0x4434c5){_0x1f89e3=_0x4434c5;if(_0x229b9f&&_0x4434c5>_0x229b9f){return db[_0xc61a('0x113')][_0xc61a('0x6b')]({'where':{'id':0x1}})[_0xc61a('0x33')](function(_0x3dc080){if(_0x3dc080){_0x3dc080['increment'](_0xc61a('0x114'));}});}})['then'](function(){if(_0x47e973[_0xc61a('0x10e')]&&_0x47e973['Interval'][_0xc61a('0x10f')]){var _0x5e32fe=[];for(var _0x4349a2=0x0;_0x4349a2<_0x47e973['Interval'][_0xc61a('0x10f')]['length'];_0x4349a2++){var _0x19d37e=_0x47e973['Interval']['Intervals'][_0x4349a2][_0xc61a('0x60')]({'plain':!![]});_0x5e32fe[_0xc61a('0xc8')](iftimePromise(_0x19d37e,_0x47e973));}return BPromise[_0xc61a('0x115')](_0x5e32fe)[_0xc61a('0x33')](function(_0x561515){return _[_0xc61a('0x116')](_0x561515);});}else{return!![];}})[_0xc61a('0x33')](function(_0x27f4f9){var _0x58f2ad=fs[_0xc61a('0xd9')](path[_0xc61a('0x7d')](config[_0xc61a('0x84')],_0xc61a('0x117')),_0xc61a('0xda'));var _0x4cd194={'remote':_0x47e973[_0xc61a('0x118')],'query':querystring[_0xc61a('0x24')](_[_0xc61a('0x3a')](_0x47e973['get']({'plain':!![]}),{'customerIp':_0x8ad648[_0xc61a('0x91')][_0xc61a('0xb0')]||_0x8ad648[_0xc61a('0x91')][_0xc61a('0x119')]||_0x8ad648['connection'][_0xc61a('0x11a')]||_0x8ad648['ip'],'referer':_0x8ad648['headers'][_0xc61a('0x11b')],'openedInteractions':_0x1f89e3,'maxInteractions':_0x229b9f,'virtual':_0x1bd06c['virtual'],'online':_0x27f4f9,'custom':_0x1bd06c}))[_0xc61a('0x11c')](/'/g,'\x5c\x27')};_0x28f2d7[_0xc61a('0xd3')](ejs[_0xc61a('0x39')](Mustache[_0xc61a('0x39')](_0x58f2ad,_0x4cd194),{'proactiveActions':_0x214375,'alignment':_0x47e973[_0xc61a('0x11d')],'verticalAlignment':_0x47e973['verticalAlignment'],'div_color':_0x47e973[_0xc61a('0xfe')],'text_color':_0x47e973[_0xc61a('0x11e')],'button_color':_0x47e973[_0xc61a('0x11f')],'background_color':_0x47e973[_0xc61a('0x120')]}));})[_0xc61a('0x59')](handleError(_0x28f2d7,null));};exports['addApplications']=function(_0x44dce8,_0x2fcabb,_0x27b2bb){return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x44dce8[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x2fcabb,null))[_0xc61a('0x33')](function(_0x13626d){if(_0x13626d){return db[_0xc61a('0x121')]['transaction'](function(_0x19f1b5){return db[_0xc61a('0xa6')][_0xc61a('0x34')]({'where':{'ChatWebsiteId':_0x44dce8[_0xc61a('0x5b')]['id']},'transaction':_0x19f1b5})[_0xc61a('0x33')](function(_0x3d16e9){var _0xc4f189=_['map'](_0x44dce8[_0xc61a('0x5e')],function(_0x2a3d1f){_0x2a3d1f[_0xc61a('0x71')]=_0x44dce8[_0xc61a('0x5b')]['id'];return _0x2a3d1f;});return db['ChatApplication']['bulkCreate'](_0xc4f189,{'transaction':_0x19f1b5});});})[_0xc61a('0x33')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x44dce8[_0xc61a('0x5b')]['id']},'order':_0xc61a('0xab')});});}})[_0xc61a('0x33')](respondWithResult(_0x2fcabb,null))[_0xc61a('0x59')](handleError(_0x2fcabb,null));};exports[_0xc61a('0x122')]=function(_0x5eecee,_0x50be69,_0x18ae33){var _0x1b8119={};var _0x4a9c3a={};var _0x413caf;var _0x5d05c4;return db['ChatWebsite'][_0xc61a('0x6b')]({'where':{'id':_0x5eecee['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x50be69,null))[_0xc61a('0x33')](function(_0xb5dccd){if(_0xb5dccd){_0x413caf=_0xb5dccd;_0x4a9c3a[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0xa6')][_0xc61a('0x42')]);_0x4a9c3a['query']=_['keys'](_0x5eecee[_0xc61a('0x46')]);_0x4a9c3a[_0xc61a('0x47')]=_['intersection'](_0x4a9c3a[_0xc61a('0x49')],_0x4a9c3a[_0xc61a('0x46')]);_0x1b8119[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0x4a9c3a['model'],qs[_0xc61a('0x4a')](_0x5eecee['query']['fields']));_0x1b8119[_0xc61a('0x4b')]=_0x1b8119[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x1b8119[_0xc61a('0x4b')]:_0x4a9c3a[_0xc61a('0x49')];_0x1b8119[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x5eecee[_0xc61a('0x46')][_0xc61a('0x50')]);_0x1b8119[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x5eecee[_0xc61a('0x46')],_0x4a9c3a[_0xc61a('0x47')]));if(_0x5eecee['query'][_0xc61a('0x53')]){_0x1b8119[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x1b8119[_0xc61a('0x51')],{'$or':_['map'](_0x1b8119['attributes'],function(_0x160d7b){var _0x4c9b8b={};_0x4c9b8b[_0x160d7b]={'$like':'%'+_0x5eecee['query'][_0xc61a('0x53')]+'%'};return _0x4c9b8b;})});}_0x1b8119=_[_0xc61a('0x3a')]({},_0x1b8119,_0x5eecee['options']);return _0x413caf['getApplications'](_0x1b8119);}})[_0xc61a('0x33')](function(_0x9c75b){if(_0x9c75b){_0x5d05c4=_0x9c75b[_0xc61a('0x4c')];if(!_0x5eecee['query']['hasOwnProperty'](_0xc61a('0x4e'))){_0x1b8119[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x5eecee['query'][_0xc61a('0x2e')]);_0x1b8119[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x5eecee[_0xc61a('0x46')][_0xc61a('0x2c')]);}return _0x413caf[_0xc61a('0x122')](_0x1b8119);}})[_0xc61a('0x33')](function(_0x3946b1){if(_0x3946b1){return _0x3946b1?{'count':_0x5d05c4,'rows':_0x3946b1}:null;}})[_0xc61a('0x33')](respondWithResult(_0x50be69,null))[_0xc61a('0x59')](handleError(_0x50be69,null));};exports['addProactiveActions']=function(_0x10dd90,_0x4a7814,_0x33a816){return db[_0xc61a('0x123')]['find']({'where':{'id':_0x10dd90[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x4a7814,null))[_0xc61a('0x33')](function(_0x19ec15){if(_0x19ec15){return _0x19ec15['addProactiveActions'](_0x10dd90['body'][_0xc61a('0x72')],_[_0xc61a('0x124')](_0x10dd90[_0xc61a('0x5e')],[_0xc61a('0x72'),'id'])||{});}})[_0xc61a('0x33')](respondWithResult(_0x4a7814,null))[_0xc61a('0x59')](handleError(_0x4a7814,null));};exports[_0xc61a('0x110')]=function(_0x282de7,_0x7a2712,_0xfe2396){var _0x2828ef={};var _0xbc994e={};var _0x2959b3;var _0x8b59fe;return db['ChatWebsite'][_0xc61a('0x6b')]({'where':{'id':_0x282de7[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x7a2712,null))[_0xc61a('0x33')](function(_0x33e828){if(_0x33e828){_0x2959b3=_0x33e828;_0xbc994e[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0x125')][_0xc61a('0x42')]);_0xbc994e[_0xc61a('0x46')]=_['keys'](_0x282de7[_0xc61a('0x46')]);_0xbc994e[_0xc61a('0x47')]=_['intersection'](_0xbc994e[_0xc61a('0x49')],_0xbc994e['query']);_0x2828ef[_0xc61a('0x4b')]=_[_0xc61a('0x48')](_0xbc994e['model'],qs[_0xc61a('0x4a')](_0x282de7[_0xc61a('0x46')]['fields']));_0x2828ef[_0xc61a('0x4b')]=_0x2828ef[_0xc61a('0x4b')][_0xc61a('0x4c')]?_0x2828ef[_0xc61a('0x4b')]:_0xbc994e['model'];_0x2828ef[_0xc61a('0x4f')]=qs['sort'](_0x282de7[_0xc61a('0x46')][_0xc61a('0x50')]);_0x2828ef[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_['pick'](_0x282de7[_0xc61a('0x46')],_0xbc994e[_0xc61a('0x47')]));if(_0x282de7[_0xc61a('0x46')]['filter']){_0x2828ef['where']=_[_0xc61a('0x3a')](_0x2828ef['where'],{'$or':_[_0xc61a('0x45')](_0x2828ef[_0xc61a('0x4b')],function(_0x3104dc){var _0xb2521b={};_0xb2521b[_0x3104dc]={'$like':'%'+_0x282de7['query'][_0xc61a('0x53')]+'%'};return _0xb2521b;})});}_0x2828ef=_['merge']({},_0x2828ef,_0x282de7['options']);return _0x2959b3['getProactiveActions'](_0x2828ef);}})['then'](function(_0x5af2f3){if(_0x5af2f3){_0x8b59fe=_0x5af2f3[_0xc61a('0x4c')];if(!_0x282de7[_0xc61a('0x46')]['hasOwnProperty'](_0xc61a('0x4e'))){_0x2828ef[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x282de7[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x2828ef[_0xc61a('0x2c')]=qs[_0xc61a('0x2c')](_0x282de7[_0xc61a('0x46')][_0xc61a('0x2c')]);}return _0x2959b3[_0xc61a('0x110')](_0x2828ef);}})[_0xc61a('0x33')](function(_0x99b0ae){if(_0x99b0ae){return _0x99b0ae?{'count':_0x8b59fe,'rows':_0x99b0ae}:null;}})[_0xc61a('0x33')](respondWithResult(_0x7a2712,null))[_0xc61a('0x59')](handleError(_0x7a2712,null));};exports[_0xc61a('0x126')]=function(_0x3b45b7,_0x3b9e36,_0x188244){var _0xecd723=_0x3b45b7[_0xc61a('0x46')]['online']===_0xc61a('0x127')?_0xc61a('0x128'):_0xc61a('0x129');return db['ChatWebsite'][_0xc61a('0x66')]({'attributes':['id',_0xecd723],'where':{'id':_0x3b45b7['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x3b9e36,null))[_0xc61a('0x33')](function(_0x46c2e1){if(_0x46c2e1){var _0x2f2596=_0x46c2e1[_0xecd723];var _0x3f02e6=_0x2f2596&&_0x2f2596['items']?_0x2f2596[_0xc61a('0x12a')]:[];_0x3b9e36[_0xc61a('0xd3')]({'fromKey':_[_0xc61a('0x80')](_0x2f2596[_0xc61a('0x12b')])?undefined:_0x2f2596[_0xc61a('0x12b')],'count':_0x3f02e6[_0xc61a('0x4c')],'rows':_0x3f02e6});}})[_0xc61a('0x59')](handleError(_0x3b9e36,null));};exports[_0xc61a('0x12c')]=function(_0x192331,_0x34e5b7,_0x12a215){var _0x23b93c={'raw':![],'where':{}};var _0x246f41={};var _0x1260b7={'count':0x0,'rows':[]};return db[_0xc61a('0x41')][_0xc61a('0x6b')]({'where':{'id':_0x192331['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x34e5b7,null))['then'](function(_0x10862f){if(_0x10862f){_0x246f41[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0x12d')][_0xc61a('0x42')]);_0x246f41[_0xc61a('0x46')]=_[_0xc61a('0x5c')](_0x192331['query']);_0x246f41['filters']=_[_0xc61a('0x48')](_0x246f41[_0xc61a('0x49')],_0x246f41[_0xc61a('0x46')]);_0x23b93c['attributes']=_['intersection'](_0x246f41[_0xc61a('0x49')],qs[_0xc61a('0x4a')](_0x192331['query'][_0xc61a('0x4a')]));_0x23b93c[_0xc61a('0x4b')]=_0x23b93c['attributes'][_0xc61a('0x4c')]?_0x23b93c[_0xc61a('0x4b')]:_0x246f41[_0xc61a('0x49')];if(!_0x192331['query'][_0xc61a('0x4d')]('nolimit')){_0x23b93c[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x192331[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x23b93c['offset']=qs['offset'](_0x192331['query']['offset']);}_0x23b93c['order']=qs['sort'](_0x192331['query'][_0xc61a('0x50')]);_0x23b93c['where']=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x192331[_0xc61a('0x46')],_0x246f41[_0xc61a('0x47')]));_0x23b93c[_0xc61a('0x51')][_0xc61a('0x71')]=_0x10862f['id'];if(_0x192331[_0xc61a('0x46')]['filter']){_0x23b93c[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x23b93c[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x23b93c[_0xc61a('0x4b')],function(_0x18e044){var _0x4e37ed={};_0x4e37ed[_0x18e044]={'$like':'%'+_0x192331[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0x4e37ed;})});}_0x23b93c=_['merge']({},_0x23b93c,_0x192331['options']);return db[_0xc61a('0x12d')]['count']({'where':_0x23b93c[_0xc61a('0x51')]})[_0xc61a('0x33')](function(_0x1fd318){_0x1260b7['count']=_0x1fd318;if(_0x192331[_0xc61a('0x46')][_0xc61a('0x56')]){_0x23b93c[_0xc61a('0x57')]=[{'all':!![]}];}else{_0x23b93c[_0xc61a('0x57')]=[{'model':db[_0xc61a('0xa4')],'as':_0xc61a('0x12e'),'required':![]},{'model':db[_0xc61a('0x12f')],'as':_0xc61a('0x130'),'required':![]}];}return db['ChatOfflineMessage'][_0xc61a('0x58')](_0x23b93c);})[_0xc61a('0x33')](function(_0x5b2db4){_0x1260b7[_0xc61a('0x6d')]=_0x5b2db4;return _0x1260b7;});}})[_0xc61a('0x33')](respondWithFilteredResult(_0x34e5b7,_0x23b93c))[_0xc61a('0x59')](handleError(_0x34e5b7,null));};exports[_0xc61a('0x131')]=function(_0x130a0b,_0x14aa3a,_0x2405ff){return db[_0xc61a('0x41')][_0xc61a('0x66')]({'where':{'id':_0x130a0b['params']['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x14aa3a,null))[_0xc61a('0x33')](function(_0x50337e){if(_0x50337e){return _0x50337e['addAgents'](_0x130a0b[_0xc61a('0x5e')][_0xc61a('0x72')],_[_0xc61a('0x124')](_0x130a0b['body'],[_0xc61a('0x72'),'id'])||{})[_0xc61a('0xc3')](function(_0x51f495){for(var _0x5b0d92=0x0;_0x5b0d92<_0x130a0b[_0xc61a('0x5e')][_0xc61a('0x72')][_0xc61a('0x4c')];_0x5b0d92+=0x1){socket[_0xc61a('0x132')](_0xc61a('0x133'),{'UserId':_0x130a0b[_0xc61a('0x5e')]['ids'][_0x5b0d92],'ChatWebsiteId':_0x130a0b['params']['id']});}return _0x51f495;});}})[_0xc61a('0x33')](respondWithResult(_0x14aa3a,null))[_0xc61a('0x59')](handleError(_0x14aa3a,null));};exports[_0xc61a('0x134')]=function(_0x55ae4c,_0x53b435,_0x5ed254){return db['ChatWebsite'][_0xc61a('0x66')]({'where':{'id':_0x55ae4c[_0xc61a('0x5b')]['id']}})[_0xc61a('0x33')](handleEntityNotFound(_0x53b435,null))[_0xc61a('0x33')](function(_0x49e698){if(_0x49e698){return _0x49e698[_0xc61a('0x134')](_0x55ae4c[_0xc61a('0x46')]['ids'])[_0xc61a('0x33')](function(){if(_['isArray'](_0x55ae4c['query'][_0xc61a('0x72')])){for(var _0x47bb2b=0x0;_0x47bb2b<_0x55ae4c['query'][_0xc61a('0x72')][_0xc61a('0x4c')];_0x47bb2b+=0x1){socket[_0xc61a('0x132')](_0xc61a('0x135'),{'UserId':Number(_0x55ae4c[_0xc61a('0x46')][_0xc61a('0x72')][_0x47bb2b]),'ChatWebsiteId':Number(_0x55ae4c[_0xc61a('0x5b')]['id'])});}}else{socket[_0xc61a('0x132')](_0xc61a('0x135'),{'UserId':Number(_0x55ae4c[_0xc61a('0x46')]['ids']),'ChatWebsiteId':Number(_0x55ae4c['params']['id'])});}});}})[_0xc61a('0x33')](respondWithStatusCode(_0x53b435,null))['catch'](handleError(_0x53b435,null));};exports[_0xc61a('0x136')]=function(_0x4ba4c6,_0x3c9550,_0x49ac31){var _0x2ad9be={};var _0x200528={};var _0x3035d3;var _0x4553ae;return db[_0xc61a('0x41')]['findOne']({'where':{'id':_0x4ba4c6[_0xc61a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c9550,null))[_0xc61a('0x33')](function(_0x2662e1){if(_0x2662e1){_0x3035d3=_0x2662e1;_0x200528[_0xc61a('0x49')]=_[_0xc61a('0x5c')](db[_0xc61a('0xca')]['rawAttributes']);_0x200528[_0xc61a('0x46')]=_[_0xc61a('0x5c')](_0x4ba4c6[_0xc61a('0x46')]);_0x200528['filters']=_['intersection'](_0x200528[_0xc61a('0x49')],_0x200528[_0xc61a('0x46')]);_0x2ad9be['attributes']=_[_0xc61a('0x48')](_0x200528['model'],qs[_0xc61a('0x4a')](_0x4ba4c6[_0xc61a('0x46')]['fields']));_0x2ad9be[_0xc61a('0x4b')]=_0x2ad9be[_0xc61a('0x4b')]['length']?_0x2ad9be[_0xc61a('0x4b')]:_0x200528[_0xc61a('0x49')];_0x2ad9be[_0xc61a('0x4f')]=qs[_0xc61a('0x50')](_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x50')]);_0x2ad9be[_0xc61a('0x51')]=qs[_0xc61a('0x47')](_[_0xc61a('0x52')](_0x4ba4c6[_0xc61a('0x46')],_0x200528['filters']));if(_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x53')]){_0x2ad9be[_0xc61a('0x51')]=_[_0xc61a('0x3a')](_0x2ad9be[_0xc61a('0x51')],{'$or':_[_0xc61a('0x45')](_0x2ad9be['attributes'],function(_0x2442fa){var _0xa7b9c6={};_0xa7b9c6[_0x2442fa]={'$like':'%'+_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x53')]+'%'};return _0xa7b9c6;})});}_0x2ad9be=_[_0xc61a('0x3a')]({},_0x2ad9be,_0x4ba4c6['options']);return _0x3035d3[_0xc61a('0x136')](_0x2ad9be);}})[_0xc61a('0x33')](function(_0x34e8c3){if(_0x34e8c3){_0x4553ae=_0x34e8c3[_0xc61a('0x4c')];if(!_0x4ba4c6[_0xc61a('0x46')]['hasOwnProperty'](_0xc61a('0x4e'))){_0x2ad9be[_0xc61a('0x2e')]=qs[_0xc61a('0x2e')](_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x2e')]);_0x2ad9be[_0xc61a('0x2c')]=qs['offset'](_0x4ba4c6[_0xc61a('0x46')][_0xc61a('0x2c')]);}return _0x3035d3[_0xc61a('0x136')](_0x2ad9be);}})[_0xc61a('0x33')](function(_0x51c3e2){if(_0x51c3e2){return _0x51c3e2?{'count':_0x4553ae,'rows':_0x51c3e2}:null;}})[_0xc61a('0x33')](respondWithResult(_0x3c9550,null))[_0xc61a('0x59')](handleError(_0x3c9550,null));}; \ No newline at end of file +var _0x8fad=['browser','version','unknown','format','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','status','end','json','offset','undefined','limit','set','reject','save','update','ChatWebsites','UserProfileResource','destroy','sendStatus','name','render','merge','contact','agent','interaction','account','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','ChatWebsite','findAll','rows','params','include','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','sitepic','file','addAvatar','customerAvatar','addSystemAvatar','filename','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','Applications','list','applications','orderBy','asc','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','%s\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fad,0x1b8));var _0xd8fa=function(_0x57746e,_0x30f1c9){_0x57746e=_0x57746e-0x0;var _0x455d76=_0x8fad[_0x57746e];return _0x455d76;};'use strict';var emlformat=require(_0xd8fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8fa('0x1'));var jsonpatch=require(_0xd8fa('0x2'));var rp=require(_0xd8fa('0x3'));var moment=require(_0xd8fa('0x4'));var BPromise=require(_0xd8fa('0x5'));var Mustache=require(_0xd8fa('0x6'));var util=require(_0xd8fa('0x7'));var path=require(_0xd8fa('0x8'));var sox=require(_0xd8fa('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8fa('0xa'));var _=require(_0xd8fa('0xb'));var squel=require(_0xd8fa('0xc'));var crypto=require(_0xd8fa('0xd'));var jsforce=require(_0xd8fa('0xe'));var deskjs=require(_0xd8fa('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8fa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd8fa('0x11'));var as=require(_0xd8fa('0x12'));var hardwareService=require(_0xd8fa('0x13'));var logger=require(_0xd8fa('0x14'))(_0xd8fa('0x15'));var utils=require(_0xd8fa('0x16'));var config=require(_0xd8fa('0x17'));var licenseUtil=require(_0xd8fa('0x18'));var db=require(_0xd8fa('0x19'))['db'];config[_0xd8fa('0x1a')]=_[_0xd8fa('0x1b')](config[_0xd8fa('0x1a')],{'host':_0xd8fa('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8fa('0x1a')]));require(_0xd8fa('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd8fa('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xd8fa('0x1e')]({'port':0x232a});var client9003=jayson[_0xd8fa('0x1f')]['http']({'port':0x232b});var client9001=jayson['client'][_0xd8fa('0x1e')]({'port':0x2329});function respondWithRpcPromise(_0x417641,_0x235b85,_0x3625cc,_0x39b9c9){return new BPromise(function(_0x59ad56,_0x3936e8){var _0x84197c=_0x39b9c9||client;return _0x84197c[_0xd8fa('0x20')](_0x417641,_0x3625cc)[_0xd8fa('0x21')](function(_0x10b14b){logger['info'](_0xd8fa('0x22'),_0x235b85,_0xd8fa('0x23'));logger[_0xd8fa('0x24')](_0xd8fa('0x25'),_0x235b85,_0xd8fa('0x23'),JSON[_0xd8fa('0x26')](_0x10b14b));if(_0x10b14b['error']){if(_0x10b14b['error']['code']===0x1f4){logger[_0xd8fa('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x235b85,_0x10b14b[_0xd8fa('0x27')][_0xd8fa('0x28')]);return _0x3936e8(_0x10b14b[_0xd8fa('0x27')][_0xd8fa('0x28')]);}logger[_0xd8fa('0x27')](_0xd8fa('0x22'),_0x235b85,_0x10b14b[_0xd8fa('0x27')][_0xd8fa('0x28')]);return _0x59ad56(_0x10b14b[_0xd8fa('0x27')][_0xd8fa('0x28')]);}else{logger[_0xd8fa('0x29')](_0xd8fa('0x22'),_0x235b85,'request\x20sent');_0x59ad56(_0x10b14b['result'][_0xd8fa('0x28')]);}})['catch'](function(_0x90350){logger['error'](_0xd8fa('0x22'),_0x235b85,_0x90350);_0x3936e8(_0x90350);});});}function respondWithStatusCode(_0x24a0bf,_0x4e2c37){_0x4e2c37=_0x4e2c37||0xcc;return function(_0x200fac){if(_0x200fac){return _0x24a0bf['sendStatus'](_0x4e2c37);}return _0x24a0bf[_0xd8fa('0x2a')](_0x4e2c37)[_0xd8fa('0x2b')]();};}function respondWithResult(_0x4c38d4,_0x289688){_0x289688=_0x289688||0xc8;return function(_0x9fff80){if(_0x9fff80){return _0x4c38d4[_0xd8fa('0x2a')](_0x289688)[_0xd8fa('0x2c')](_0x9fff80);}};}function respondWithFilteredResult(_0x230bbe,_0x449e7c){return function(_0x55a09f){if(_0x55a09f){var _0x97bc89=typeof _0x449e7c[_0xd8fa('0x2d')]===_0xd8fa('0x2e')&&typeof _0x449e7c[_0xd8fa('0x2f')]===_0xd8fa('0x2e');var _0x22c51f=_0x55a09f['count'];var _0x4f2276=_0x97bc89?0x0:_0x449e7c[_0xd8fa('0x2d')];var _0x20f5bb=_0x97bc89?_0x55a09f['count']:_0x449e7c[_0xd8fa('0x2d')]+_0x449e7c['limit'];var _0x15af6e;if(_0x20f5bb>=_0x22c51f){_0x20f5bb=_0x22c51f;_0x15af6e=0xc8;}else{_0x15af6e=0xce;}_0x230bbe[_0xd8fa('0x2a')](_0x15af6e);return _0x230bbe[_0xd8fa('0x30')]('Content-Range',_0x4f2276+'-'+_0x20f5bb+'/'+_0x22c51f)[_0xd8fa('0x2c')](_0x55a09f);}return null;};}function patchUpdates(_0x240f4b){return function(_0x2a8377){try{jsonpatch['apply'](_0x2a8377,_0x240f4b,!![]);}catch(_0x191519){return BPromise[_0xd8fa('0x31')](_0x191519);}return _0x2a8377[_0xd8fa('0x32')]();};}function saveUpdates(_0x266a38,_0x1e6057){return function(_0x97b7b3){if(_0x97b7b3){return _0x97b7b3[_0xd8fa('0x33')](_0x266a38)[_0xd8fa('0x21')](function(_0x379389){return _0x379389;});}return null;};}function removeEntity(_0x240975,_0xaf120d){return function(_0x2e1877){if(_0x2e1877){return _0x2e1877['destroy']()[_0xd8fa('0x21')](function(){var _0xfb2105=_0x2e1877['get']({'plain':!![]});var _0x88b2a1=_0xd8fa('0x34');return db[_0xd8fa('0x35')][_0xd8fa('0x36')]({'where':{'type':_0x88b2a1,'resourceId':_0xfb2105['id']}})[_0xd8fa('0x21')](function(){return _0x2e1877;});})[_0xd8fa('0x21')](function(){_0x240975['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x374241,_0x4f5e4f){return function(_0x19575d){if(!_0x19575d){_0x374241[_0xd8fa('0x37')](0x194);}return _0x19575d;};}function handleError(_0x3640c7,_0x4cafa6){_0x4cafa6=_0x4cafa6||0x1f4;return function(_0x341643){logger[_0xd8fa('0x27')](_0x341643['stack']);if(_0x341643[_0xd8fa('0x38')]){delete _0x341643[_0xd8fa('0x38')];}_0x3640c7[_0xd8fa('0x2a')](_0x4cafa6)['send'](_0x341643);};}function getMustacheRender(_0x43af40,_0x137344){return Mustache[_0xd8fa('0x39')](_0x43af40,_[_0xd8fa('0x3a')](_0x137344['body'],{'contact':_0x137344[_0xd8fa('0x3b')],'message':_0x137344[_0xd8fa('0x28')],'agent':_0x137344[_0xd8fa('0x3c')],'interaction':_0x137344[_0xd8fa('0x3d')],'account':_0x137344[_0xd8fa('0x3e')]}))||'';}exports[_0xd8fa('0x3f')]=function(_0x19e8ae,_0x232c42){var _0x1cfa8a={'include':[{'model':db[_0xd8fa('0x40')],'as':_0xd8fa('0x41')}]},_0x13d4bf={},_0x31965c={'count':0x0,'rows':[]};var _0x2b3f00=_['map'](db['ChatWebsite'][_0xd8fa('0x42')],function(_0x48264b){return{'name':_0x48264b[_0xd8fa('0x43')],'type':_0x48264b[_0xd8fa('0x44')][_0xd8fa('0x45')]};});_0x13d4bf[_0xd8fa('0x46')]=_[_0xd8fa('0x47')](_0x2b3f00,_0xd8fa('0x38'));_0x13d4bf[_0xd8fa('0x48')]=_[_0xd8fa('0x49')](_0x19e8ae[_0xd8fa('0x48')]);_0x13d4bf[_0xd8fa('0x4a')]=_[_0xd8fa('0x4b')](_0x13d4bf[_0xd8fa('0x46')],_0x13d4bf[_0xd8fa('0x48')]);_0x1cfa8a['attributes']=_['intersection'](_0x13d4bf[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x19e8ae[_0xd8fa('0x48')][_0xd8fa('0x4c')]));_0x1cfa8a['attributes']=_0x1cfa8a[_0xd8fa('0x4d')][_0xd8fa('0x4e')]?_0x1cfa8a[_0xd8fa('0x4d')]:_0x13d4bf[_0xd8fa('0x46')];if(!_0x19e8ae[_0xd8fa('0x48')][_0xd8fa('0x4f')](_0xd8fa('0x50'))){_0x1cfa8a[_0xd8fa('0x2f')]=qs[_0xd8fa('0x2f')](_0x19e8ae[_0xd8fa('0x48')][_0xd8fa('0x2f')]);_0x1cfa8a['offset']=qs[_0xd8fa('0x2d')](_0x19e8ae['query'][_0xd8fa('0x2d')]);}_0x1cfa8a['order']=qs[_0xd8fa('0x51')](_0x19e8ae[_0xd8fa('0x48')][_0xd8fa('0x51')]);_0x1cfa8a[_0xd8fa('0x52')]=qs['filters'](_[_0xd8fa('0x53')](_0x19e8ae[_0xd8fa('0x48')],_0x13d4bf[_0xd8fa('0x4a')]),_0x2b3f00);if(_0x19e8ae[_0xd8fa('0x48')][_0xd8fa('0x54')]){_0x1cfa8a['where']=_[_0xd8fa('0x3a')](_0x1cfa8a[_0xd8fa('0x52')],{'$or':_[_0xd8fa('0x47')](_0x2b3f00,function(_0x926666){if(_0x926666[_0xd8fa('0x44')]!==_0xd8fa('0x55')){var _0x409e7d={};_0x409e7d[_0x926666[_0xd8fa('0x38')]]={'$like':'%'+_0x19e8ae[_0xd8fa('0x48')][_0xd8fa('0x54')]+'%'};return _0x409e7d;}})});}_0x1cfa8a=_[_0xd8fa('0x3a')]({},_0x1cfa8a,_0x19e8ae[_0xd8fa('0x56')]);var _0x5a9d04={'where':_0x1cfa8a[_0xd8fa('0x52')]};return db['ChatWebsite'][_0xd8fa('0x57')](_0x5a9d04)[_0xd8fa('0x21')](function(_0x45757d){_0x31965c[_0xd8fa('0x57')]=_0x45757d;if(_0x19e8ae['query'][_0xd8fa('0x58')]){_0x1cfa8a['include']=[{'all':!![]}];}return db[_0xd8fa('0x59')][_0xd8fa('0x5a')](_0x1cfa8a);})[_0xd8fa('0x21')](function(_0x16985e){_0x31965c[_0xd8fa('0x5b')]=_0x16985e;return _0x31965c;})[_0xd8fa('0x21')](respondWithFilteredResult(_0x232c42,_0x1cfa8a))['catch'](handleError(_0x232c42,null));};exports['show']=function(_0x489c11,_0x41fcc7){var _0xff2666={'raw':![],'where':{'id':_0x489c11[_0xd8fa('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xd8fa('0x41')}]},_0x154446={};_0x154446[_0xd8fa('0x46')]=_[_0xd8fa('0x49')](db[_0xd8fa('0x59')][_0xd8fa('0x42')]);_0x154446[_0xd8fa('0x48')]=_[_0xd8fa('0x49')](_0x489c11['query']);_0x154446[_0xd8fa('0x4a')]=_[_0xd8fa('0x4b')](_0x154446['model'],_0x154446[_0xd8fa('0x48')]);_0xff2666['attributes']=_[_0xd8fa('0x4b')](_0x154446[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x489c11[_0xd8fa('0x48')]['fields']));_0xff2666[_0xd8fa('0x4d')]=_0xff2666['attributes']['length']?_0xff2666['attributes']:_0x154446[_0xd8fa('0x46')];if(_0x489c11['query']['includeAll']){_0xff2666[_0xd8fa('0x5d')]=[{'all':!![]}];}_0xff2666=_[_0xd8fa('0x3a')]({},_0xff2666,_0x489c11[_0xd8fa('0x56')]);return db['ChatWebsite'][_0xd8fa('0x5e')](_0xff2666)[_0xd8fa('0x21')](handleEntityNotFound(_0x41fcc7,null))[_0xd8fa('0x21')](respondWithResult(_0x41fcc7,null))[_0xd8fa('0x5f')](handleError(_0x41fcc7,null));};exports['create']=function(_0xe353c4,_0x1f56c2){return db[_0xd8fa('0x59')][_0xd8fa('0x60')](_0xe353c4['body'],{})[_0xd8fa('0x21')](function(_0xe376d6){var _0x29f8dd=_0xe353c4['user'][_0xd8fa('0x61')]({'plain':!![]});if(!_0x29f8dd)throw new Error(_0xd8fa('0x62'));if(_0x29f8dd[_0xd8fa('0x63')]===_0xd8fa('0x64')){var _0x175cc5=_0xe376d6['get']({'plain':!![]});var _0x1529b3=_0xd8fa('0x34');return db[_0xd8fa('0x65')]['find']({'where':{'name':_0x1529b3,'userProfileId':_0x29f8dd[_0xd8fa('0x66')]},'raw':!![]})[_0xd8fa('0x21')](function(_0x1d9718){if(_0x1d9718&&_0x1d9718[_0xd8fa('0x67')]===0x0){return db[_0xd8fa('0x35')]['create']({'name':_0x175cc5[_0xd8fa('0x38')],'resourceId':_0x175cc5['id'],'type':_0x1d9718[_0xd8fa('0x38')],'sectionId':_0x1d9718['id']},{})[_0xd8fa('0x21')](function(){return _0xe376d6;});}else{return _0xe376d6;}})[_0xd8fa('0x5f')](function(_0x488830){logger[_0xd8fa('0x27')](_0xd8fa('0x68'),_0x488830);throw _0x488830;});}return _0xe376d6;})[_0xd8fa('0x21')](respondWithResult(_0x1f56c2,0xc9))[_0xd8fa('0x5f')](handleError(_0x1f56c2,null));};exports[_0xd8fa('0x33')]=function(_0x88c6ad,_0x23cea1){if(_0x88c6ad[_0xd8fa('0x69')]['id']){delete _0x88c6ad['body']['id'];}return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x88c6ad['params']['id']},'include':[{'model':db[_0xd8fa('0x40')],'as':_0xd8fa('0x41')}]})[_0xd8fa('0x21')](handleEntityNotFound(_0x23cea1,null))[_0xd8fa('0x21')](saveUpdates(_0x88c6ad[_0xd8fa('0x69')],null))[_0xd8fa('0x21')](respondWithResult(_0x23cea1,null))[_0xd8fa('0x5f')](handleError(_0x23cea1,null));};exports['destroy']=function(_0x4958a0,_0xf8613a){return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x4958a0[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0xf8613a,null))['then'](removeEntity(_0xf8613a,null))['catch'](handleError(_0xf8613a,null));};exports[_0xd8fa('0x6a')]=function(_0x545270,_0x4f881f){return db['ChatWebsite'][_0xd8fa('0x6a')]()[_0xd8fa('0x21')](respondWithResult(_0x4f881f,null))[_0xd8fa('0x5f')](handleError(_0x4f881f,null));};exports[_0xd8fa('0x6b')]=function(_0x258345,_0x3573b0,_0x50c8b0){if(_0x258345[_0xd8fa('0x69')]['id']){delete _0x258345[_0xd8fa('0x69')]['id'];}return db['ChatWebsite'][_0xd8fa('0x5e')]({'where':{'id':_0x258345[_0xd8fa('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3573b0,null))[_0xd8fa('0x21')](function(_0x236f08){if(_0x236f08){_0x258345[_0xd8fa('0x69')][_0xd8fa('0x6c')]=_0x236f08['id'];return db[_0xd8fa('0x6d')]['create'](_0x258345['body']);}})['then'](respondWithResult(_0x3573b0,null))['catch'](handleError(_0x3573b0,null));};exports[_0xd8fa('0x6e')]=function(_0x201c93,_0x3ff8c5,_0x57edd6){var _0x1fd61f={'raw':![],'where':{}};var _0xae780d={};var _0x5ea69={'count':0x0,'rows':[]};return db[_0xd8fa('0x59')][_0xd8fa('0x6f')]({'where':{'id':_0x201c93[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x3ff8c5,null))['then'](function(_0x18761f){if(_0x18761f){_0xae780d['model']=_['keys'](db[_0xd8fa('0x6d')][_0xd8fa('0x42')]);_0xae780d[_0xd8fa('0x48')]=_['keys'](_0x201c93[_0xd8fa('0x48')]);_0xae780d['filters']=_[_0xd8fa('0x4b')](_0xae780d[_0xd8fa('0x46')],_0xae780d[_0xd8fa('0x48')]);_0x1fd61f[_0xd8fa('0x4d')]=_[_0xd8fa('0x4b')](_0xae780d[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x201c93[_0xd8fa('0x48')][_0xd8fa('0x4c')]));_0x1fd61f[_0xd8fa('0x4d')]=_0x1fd61f[_0xd8fa('0x4d')]['length']?_0x1fd61f[_0xd8fa('0x4d')]:_0xae780d[_0xd8fa('0x46')];if(!_0x201c93['query'][_0xd8fa('0x4f')](_0xd8fa('0x50'))){_0x1fd61f[_0xd8fa('0x2f')]=qs[_0xd8fa('0x2f')](_0x201c93['query'][_0xd8fa('0x2f')]);_0x1fd61f[_0xd8fa('0x2d')]=qs[_0xd8fa('0x2d')](_0x201c93[_0xd8fa('0x48')][_0xd8fa('0x2d')]);}_0x1fd61f['order']=qs[_0xd8fa('0x51')](_0x201c93[_0xd8fa('0x48')][_0xd8fa('0x51')]);_0x1fd61f[_0xd8fa('0x52')]=qs[_0xd8fa('0x4a')](_[_0xd8fa('0x53')](_0x201c93[_0xd8fa('0x48')],_0xae780d['filters']));_0x1fd61f[_0xd8fa('0x52')]['ChatWebsiteId']=_0x18761f['id'];if(_0x201c93['query'][_0xd8fa('0x54')]){_0x1fd61f[_0xd8fa('0x52')]=_[_0xd8fa('0x3a')](_0x1fd61f[_0xd8fa('0x52')],{'$or':_['map'](_0x1fd61f[_0xd8fa('0x4d')],function(_0x18abba){var _0x4e8344={};_0x4e8344[_0x18abba]={'$like':'%'+_0x201c93[_0xd8fa('0x48')][_0xd8fa('0x54')]+'%'};return _0x4e8344;})});}_0x1fd61f=_[_0xd8fa('0x3a')]({},_0x1fd61f,_0x201c93['options']);return db[_0xd8fa('0x6d')]['count']({'where':_0x1fd61f[_0xd8fa('0x52')]})[_0xd8fa('0x21')](function(_0x344250){_0x5ea69[_0xd8fa('0x57')]=_0x344250;if(_0x201c93[_0xd8fa('0x48')][_0xd8fa('0x58')]){_0x1fd61f[_0xd8fa('0x5d')]=[{'all':!![]}];}return db[_0xd8fa('0x6d')][_0xd8fa('0x5a')](_0x1fd61f);})[_0xd8fa('0x21')](function(_0x1c259d){_0x5ea69[_0xd8fa('0x5b')]=_0x1c259d;return _0x5ea69;});}})[_0xd8fa('0x21')](respondWithFilteredResult(_0x3ff8c5,_0x1fd61f))[_0xd8fa('0x5f')](handleError(_0x3ff8c5,null));};exports[_0xd8fa('0x70')]=function(_0x173d52,_0x26db84,_0x56af0f){return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x173d52[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x26db84,null))[_0xd8fa('0x21')](function(_0xa89771){if(_0xa89771){return _0xa89771[_0xd8fa('0x70')](_0x173d52[_0xd8fa('0x48')][_0xd8fa('0x71')]);}})['then'](respondWithStatusCode(_0x26db84,null))['catch'](handleError(_0x26db84,null));};exports[_0xd8fa('0x72')]=function(_0x50852b,_0x37a742,_0x491d2b){if(_0x50852b['body']['id']){delete _0x50852b[_0xd8fa('0x69')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x50852b[_0xd8fa('0x5c')]['id']}})['then'](handleEntityNotFound(_0x37a742,null))['then'](function(_0x466696){if(_0x466696){_0x50852b['body'][_0xd8fa('0x6c')]=_0x466696['id'];return db[_0xd8fa('0x73')][_0xd8fa('0x60')](_0x50852b[_0xd8fa('0x69')]);}})[_0xd8fa('0x21')](respondWithResult(_0x37a742,null))[_0xd8fa('0x5f')](handleError(_0x37a742,null));};exports[_0xd8fa('0x74')]=function(_0x8083c0,_0x4674e2,_0x4556b8){var _0x16fef1={'raw':![],'where':{}};var _0x38ce69={};var _0x1e01b8={'count':0x0,'rows':[]};return db[_0xd8fa('0x59')][_0xd8fa('0x6f')]({'where':{'id':_0x8083c0[_0xd8fa('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4674e2,null))[_0xd8fa('0x21')](function(_0x17bb14){if(_0x17bb14){_0x38ce69[_0xd8fa('0x46')]=_[_0xd8fa('0x49')](db[_0xd8fa('0x73')][_0xd8fa('0x42')]);_0x38ce69[_0xd8fa('0x48')]=_[_0xd8fa('0x49')](_0x8083c0[_0xd8fa('0x48')]);_0x38ce69[_0xd8fa('0x4a')]=_['intersection'](_0x38ce69[_0xd8fa('0x46')],_0x38ce69['query']);_0x16fef1[_0xd8fa('0x4d')]=_[_0xd8fa('0x4b')](_0x38ce69[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x8083c0[_0xd8fa('0x48')][_0xd8fa('0x4c')]));_0x16fef1['attributes']=_0x16fef1[_0xd8fa('0x4d')]['length']?_0x16fef1['attributes']:_0x38ce69[_0xd8fa('0x46')];if(!_0x8083c0[_0xd8fa('0x48')][_0xd8fa('0x4f')](_0xd8fa('0x50'))){_0x16fef1[_0xd8fa('0x2f')]=qs['limit'](_0x8083c0[_0xd8fa('0x48')]['limit']);_0x16fef1[_0xd8fa('0x2d')]=qs[_0xd8fa('0x2d')](_0x8083c0['query'][_0xd8fa('0x2d')]);}_0x16fef1[_0xd8fa('0x75')]=qs[_0xd8fa('0x51')](_0x8083c0[_0xd8fa('0x48')]['sort']);_0x16fef1[_0xd8fa('0x52')]=qs[_0xd8fa('0x4a')](_[_0xd8fa('0x53')](_0x8083c0[_0xd8fa('0x48')],_0x38ce69[_0xd8fa('0x4a')]));_0x16fef1['where'][_0xd8fa('0x6c')]=_0x17bb14['id'];if(_0x8083c0[_0xd8fa('0x48')][_0xd8fa('0x54')]){_0x16fef1[_0xd8fa('0x52')]=_['merge'](_0x16fef1[_0xd8fa('0x52')],{'$or':_['map'](_0x16fef1[_0xd8fa('0x4d')],function(_0x4510ae){var _0x3f0e4a={};_0x3f0e4a[_0x4510ae]={'$like':'%'+_0x8083c0[_0xd8fa('0x48')][_0xd8fa('0x54')]+'%'};return _0x3f0e4a;})});}_0x16fef1=_[_0xd8fa('0x3a')]({},_0x16fef1,_0x8083c0['options']);return db[_0xd8fa('0x73')][_0xd8fa('0x57')]({'where':_0x16fef1[_0xd8fa('0x52')]})['then'](function(_0x3e082d){_0x1e01b8[_0xd8fa('0x57')]=_0x3e082d;if(_0x8083c0['query'][_0xd8fa('0x58')]){_0x16fef1['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x16fef1);})[_0xd8fa('0x21')](function(_0x2343a5){_0x1e01b8['rows']=_0x2343a5;return _0x1e01b8;});}})[_0xd8fa('0x21')](respondWithFilteredResult(_0x4674e2,_0x16fef1))[_0xd8fa('0x5f')](handleError(_0x4674e2,null));};exports[_0xd8fa('0x76')]=function(_0xe15ddc,_0x24102e,_0x19328e){return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0xe15ddc['params']['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x24102e,null))[_0xd8fa('0x21')](function(_0x21ca36){if(_0x21ca36){return _0x21ca36[_0xd8fa('0x76')](_0xe15ddc[_0xd8fa('0x48')]['ids']);}})[_0xd8fa('0x21')](respondWithStatusCode(_0x24102e,null))[_0xd8fa('0x5f')](handleError(_0x24102e,null));};exports['addLogo']=function(_0x2e6f05,_0x3c4935,_0x10fe7c){_0x2e6f05['body'][_0xd8fa('0x77')]=_0x2e6f05[_0xd8fa('0x78')]['filename'];return db[_0xd8fa('0x59')]['find']({'where':{'id':_0x2e6f05['params']['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x3c4935,null))['then'](saveUpdates(_0x2e6f05[_0xd8fa('0x69')],null))[_0xd8fa('0x21')](respondWithResult(_0x3c4935,null))['catch'](handleError(_0x3c4935,null));};exports[_0xd8fa('0x79')]=function(_0x746883,_0x7aa9e1,_0x3b4f36){_0x746883[_0xd8fa('0x69')]['agentAvatar']=_0x746883['file']['filename'];return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x746883['params']['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x7aa9e1,null))[_0xd8fa('0x21')](saveUpdates(_0x746883[_0xd8fa('0x69')],null))[_0xd8fa('0x21')](respondWithResult(_0x7aa9e1,null))[_0xd8fa('0x5f')](handleError(_0x7aa9e1,null));};exports['addCustomerAvatar']=function(_0x227b88,_0x385e8f,_0x286ee0){_0x227b88[_0xd8fa('0x69')][_0xd8fa('0x7a')]=_0x227b88[_0xd8fa('0x78')]['filename'];return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x227b88[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x385e8f,null))[_0xd8fa('0x21')](saveUpdates(_0x227b88['body'],null))[_0xd8fa('0x21')](respondWithResult(_0x385e8f,null))[_0xd8fa('0x5f')](handleError(_0x385e8f,null));};exports[_0xd8fa('0x7b')]=function(_0x3048bc,_0x1b7000,_0x243b3e){_0x3048bc[_0xd8fa('0x69')]['systemAvatar']=_0x3048bc['file'][_0xd8fa('0x7c')];return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x3048bc[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x1b7000,null))['then'](saveUpdates(_0x3048bc[_0xd8fa('0x69')],null))[_0xd8fa('0x21')](respondWithResult(_0x1b7000,null))[_0xd8fa('0x5f')](handleError(_0x1b7000,null));};exports[_0xd8fa('0x7d')]=function(_0x5db02e,_0x2c655f,_0x402a57){var _0x5862b2=path[_0xd8fa('0x7e')](config[_0xd8fa('0x7f')],_0xd8fa('0x80'));var _0x397dde={'where':{'id':_0x5db02e[_0xd8fa('0x5c')]['id']},'attributes':['id',_0xd8fa('0x77')],'raw':!![]};var _0x41c05e=![];return require(_0xd8fa('0x18'))[_0xd8fa('0x81')]()[_0xd8fa('0x21')](function(_0x26c50d){if(_0x26c50d){_0x41c05e=_0x26c50d[_0xd8fa('0x82')];}})[_0xd8fa('0x21')](function(){return db[_0xd8fa('0x59')][_0xd8fa('0x5e')](_0x397dde);})[_0xd8fa('0x21')](handleEntityNotFound(_0x2c655f,null))[_0xd8fa('0x21')](function(_0x5af52b){if(_0x5af52b){if(!_[_0xd8fa('0x83')](_0x5af52b[_0xd8fa('0x77')])){if(fs[_0xd8fa('0x84')](path[_0xd8fa('0x7e')](config['root'],_0xd8fa('0x85'),_0x5af52b['sitepic']))&&_0x41c05e){_0x5862b2=path['join'](config[_0xd8fa('0x7f')],_0xd8fa('0x85'),_0x5af52b[_0xd8fa('0x77')]);}}return _0x2c655f['download'](_0x5862b2);}})[_0xd8fa('0x5f')](handleError(_0x2c655f,null));};exports[_0xd8fa('0x86')]=function(_0x3a146,_0x5968c3,_0x5b8785){var _0x18b8bb=path['join'](config[_0xd8fa('0x7f')],_0xd8fa('0x87'));var _0x332192={'where':{'id':_0x3a146[_0xd8fa('0x5c')]['id']},'attributes':['id',_0xd8fa('0x88')],'raw':!![]};return db[_0xd8fa('0x59')][_0xd8fa('0x5e')](_0x332192)[_0xd8fa('0x21')](handleEntityNotFound(_0x5968c3,null))[_0xd8fa('0x21')](function(_0x3b3eef){if(_0x3b3eef){if(!_[_0xd8fa('0x83')](_0x3b3eef['agentAvatar'])){if(fs[_0xd8fa('0x84')](path[_0xd8fa('0x7e')](config[_0xd8fa('0x7f')],_0xd8fa('0x89'),_0x3b3eef[_0xd8fa('0x88')]))){_0x18b8bb=path[_0xd8fa('0x7e')](config[_0xd8fa('0x7f')],_0xd8fa('0x89'),_0x3b3eef['agentAvatar']);}}return _0x5968c3[_0xd8fa('0x8a')](_0x18b8bb);}})[_0xd8fa('0x5f')](handleError(_0x5968c3,null));};exports[_0xd8fa('0x8b')]=function(_0x2647ce,_0x535554,_0x37dd78){var _0x414168=path['join'](config['root'],_0xd8fa('0x8c'));var _0x20b82a={'where':{'id':_0x2647ce[_0xd8fa('0x5c')]['id']},'attributes':['id',_0xd8fa('0x7a'),_0xd8fa('0x8d')],'raw':!![]};return db[_0xd8fa('0x59')][_0xd8fa('0x5e')](_0x20b82a)['then'](handleEntityNotFound(_0x535554,null))['then'](function(_0x34ecad){if(_0x34ecad){if(!_[_0xd8fa('0x83')](_0x34ecad['customerAvatar'])){if(fs[_0xd8fa('0x84')](path[_0xd8fa('0x7e')](config[_0xd8fa('0x7f')],_0xd8fa('0x89'),_0x34ecad[_0xd8fa('0x7a')]))&&_0x34ecad[_0xd8fa('0x8d')]){_0x414168=path[_0xd8fa('0x7e')](config['root'],_0xd8fa('0x89'),_0x34ecad[_0xd8fa('0x7a')]);}}return _0x535554[_0xd8fa('0x8a')](_0x414168);}})[_0xd8fa('0x5f')](handleError(_0x535554,null));};exports[_0xd8fa('0x8e')]=function(_0x23f664,_0x17af99,_0x19b54d){var _0x4160e5=path['join'](config[_0xd8fa('0x7f')],_0xd8fa('0x8f'));var _0x45ba7f={'where':{'id':_0x23f664['params']['id']},'attributes':['id',_0xd8fa('0x90')],'raw':!![]};return db['ChatWebsite'][_0xd8fa('0x5e')](_0x45ba7f)['then'](handleEntityNotFound(_0x17af99,null))[_0xd8fa('0x21')](function(_0x3aa5e1){if(_0x3aa5e1){if(!_[_0xd8fa('0x83')](_0x3aa5e1[_0xd8fa('0x90')])){if(fs[_0xd8fa('0x84')](path[_0xd8fa('0x7e')](config[_0xd8fa('0x7f')],'server/files/images/avatars/',_0x3aa5e1[_0xd8fa('0x90')]))){_0x4160e5=path[_0xd8fa('0x7e')](config['root'],_0xd8fa('0x89'),_0x3aa5e1[_0xd8fa('0x90')]);}}return _0x17af99['download'](_0x4160e5);}})[_0xd8fa('0x5f')](handleError(_0x17af99,null));};exports[_0xd8fa('0x91')]=function(_0x2dc504,_0x52e008,_0xa8ca40){var _0x251da0=require(_0xd8fa('0x92'));var _0xf6a399=new _0x251da0();var _0x49f3af=_0xf6a399[_0xd8fa('0x93')](_0x2dc504[_0xd8fa('0x94')][_0xd8fa('0x95')])['getResult']();var _0xa3c282={'body':_0x2dc504[_0xd8fa('0x69')],'channel':'chat'};var _0x26056c=[];var _0x28f385=[];var _0x49da66={};var _0x55cfb7=![];return db[_0xd8fa('0x96')][_0xd8fa('0x6a')]()[_0xd8fa('0x21')](function(_0x52d764){if(!_0x52d764){throw new db[(_0xd8fa('0x97'))][(_0xd8fa('0x98'))]('no\x20available\x20attributes');}_0x26056c=_[_0xd8fa('0x99')](_[_0xd8fa('0x49')](_0x52d764),[_0xd8fa('0x9a'),_0xd8fa('0x9b')]);_0x28f385=_[_0xd8fa('0x99')](_[_0xd8fa('0x49')](_0x52d764),[_0xd8fa('0x9a'),_0xd8fa('0x9b'),_0xd8fa('0x9c'),_0xd8fa('0x9d')]);if(_0x2dc504[_0xd8fa('0x69')]['id']){delete _0x2dc504[_0xd8fa('0x69')]['id'];}if(_[_0xd8fa('0x83')](_0x2dc504['body'][_0xd8fa('0x9e')])){throw new db['Sequelize'][(_0xd8fa('0x98'))](_0xd8fa('0x9f'));}if(_[_0xd8fa('0x83')](_0x2dc504[_0xd8fa('0x69')]['body'])||_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0x69')]===''){throw new db[(_0xd8fa('0x97'))][(_0xd8fa('0x98'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd8fa('0x83')](_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0xa0')])){throw new db[(_0xd8fa('0x97'))][(_0xd8fa('0x98'))](_0xd8fa('0xa1')+_0x28f385);}if(!_[_0xd8fa('0xa2')](_0x28f385,_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0xa0')])){throw new db[(_0xd8fa('0x97'))][(_0xd8fa('0x98'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28f385);}_0x49da66[_0x2dc504['body'][_0xd8fa('0xa0')]]=_0x2dc504['body'][_0xd8fa('0x9e')];})['then'](function(){return db['ChatWebsite'][_0xd8fa('0x5e')]({'where':{'id':_0x2dc504[_0xd8fa('0x5c')]['id']},'include':[{'model':db[_0xd8fa('0xa3')],'as':_0xd8fa('0xa4'),'include':[{'model':db[_0xd8fa('0x96')],'as':_0xd8fa('0xa5'),'where':_0x49da66,'limit':0x1,'order':[[_0xd8fa('0x9b'),_0xd8fa('0xa6')]]}]},{'model':db[_0xd8fa('0xa7')],'as':'Applications'}]});})[_0xd8fa('0x21')](handleEntityNotFound(_0x52e008,null))['then'](function(_0x35ca41){if(_0x35ca41&&_0x35ca41['List']){_0xa3c282[_0xd8fa('0x3e')]=_0x35ca41;_0xa3c282['applications']=_0x35ca41[_0xd8fa('0xa8')];_0xa3c282[_0xd8fa('0xa9')]=_0x35ca41[_0xd8fa('0xa4')];_0xa3c282[_0xd8fa('0xaa')]=_[_0xd8fa('0xab')](_0xa3c282[_0xd8fa('0xaa')],['priority'],[_0xd8fa('0xac')]);if(_0xa3c282[_0xd8fa('0x3e')][_0xd8fa('0xa8')]){delete _0xa3c282[_0xd8fa('0x3e')][_0xd8fa('0xa8')];}if(_0xa3c282['account']['List']&&_0xa3c282[_0xd8fa('0x3e')]['List']['Contacts'][_0xd8fa('0x4e')]){return _0xa3c282[_0xd8fa('0x3e')][_0xd8fa('0xa4')][_0xd8fa('0xa5')][0x0];}var _0x4dd5dc=_['defaults'](_0x2dc504[_0xd8fa('0x69')],{'firstName':_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0x9e')],'ListId':_0x35ca41[_0xd8fa('0x9d')]});_0x4dd5dc[_0x2dc504[_0xd8fa('0x69')]['mapKey']]=_0x2dc504['body'][_0xd8fa('0x9e')];return db[_0xd8fa('0x96')]['create'](_0x4dd5dc,{'fields':_0x26056c,'raw':!![]});}})[_0xd8fa('0x21')](handleEntityNotFound(_0x52e008,null))['then'](function(_0x16de74){_0xa3c282['contact']=_0x16de74;var _0x2a67d9=_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0xad')];if(_0x2dc504[_0xd8fa('0x94')]['cf-connecting-ip']){_0x2a67d9=_0x2dc504[_0xd8fa('0x94')][_0xd8fa('0xae')];}else if(_0x2dc504[_0xd8fa('0x94')][_0xd8fa('0xaf')]){_0x2a67d9=_[_0xd8fa('0xb0')](_0x2dc504[_0xd8fa('0x94')][_0xd8fa('0xaf')][_0xd8fa('0xb1')](','));}if(_0x16de74){var _0x406864={'ContactId':_0x16de74['id'],'ChatWebsiteId':_0x2dc504[_0xd8fa('0x5c')]['id'],'from':(_0x16de74[_0xd8fa('0xb2')]||'')+'\x20'+(_0x16de74[_0xd8fa('0xb3')]||''),'customerIp':_0x2a67d9,'customerPort':_0x2dc504['headers'][_0xd8fa('0xb4')]?_0x2dc504[_0xd8fa('0x94')][_0xd8fa('0xb4')]:null,'referer':_0x2dc504[_0xd8fa('0x69')]['referer'],'browserName':_0x49f3af['browser'][_0xd8fa('0x38')]&&_0x49f3af['browser']['version']?util['format'](_0xd8fa('0xb5'),_0x49f3af[_0xd8fa('0xb6')]['name'],_0x49f3af[_0xd8fa('0xb6')][_0xd8fa('0xb7')]):_0xd8fa('0xb8'),'browserVersion':_0x49f3af[_0xd8fa('0xb6')][_0xd8fa('0xb7')]||_0xd8fa('0xb8'),'osName':util[_0xd8fa('0xb9')]('%s\x20%s',_0x49f3af['os'][_0xd8fa('0x38')],_0x49f3af['os']['version']),'osVersion':_0x49f3af['os'][_0xd8fa('0xb7')],'deviceModel':_0x49f3af[_0xd8fa('0xba')][_0xd8fa('0x46')]&&_0x49f3af[_0xd8fa('0xba')]['vendor']?util[_0xd8fa('0xb9')](_0xd8fa('0xbb'),_0x49f3af[_0xd8fa('0xba')][_0xd8fa('0x46')],_0x49f3af[_0xd8fa('0xba')][_0xd8fa('0xbc')],_0x49f3af[_0xd8fa('0xba')][_0xd8fa('0x44')]):null,'deviceVendor':_0x49f3af[_0xd8fa('0xba')][_0xd8fa('0xbc')],'deviceType':_0x49f3af[_0xd8fa('0xba')][_0xd8fa('0x44')],'formData':JSON['stringify'](_0x2dc504[_0xd8fa('0x69')])};var _0x347240={'ChatWebsiteId':_0x2dc504['params']['id'],'closed':![]};if(_0x2dc504[_0xd8fa('0x69')]['threadId']){_0x347240['threadId']=_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0xbd')];return db[_0xd8fa('0xbe')][_0xd8fa('0x5e')]({'where':_0x347240})[_0xd8fa('0x21')](function(_0x55d9a0){if(_0x55d9a0){return[_0x55d9a0,![]];}_0x406864[_0xd8fa('0xbd')]=_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0xbd')];_0x406864[_0xd8fa('0xbf')]=_0x2dc504['body']['externalUrl'];return db[_0xd8fa('0xbe')][_0xd8fa('0x60')](_0x406864)['then'](function(_0x76c3d0){return[_0x76c3d0,!![]];});});}_0x347240[_0xd8fa('0xc0')]=_0x16de74['id'];if(_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0x3d')]&&_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0x3d')]['id']){_0x347240['id']=_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0x3d')]['id'];return db[_0xd8fa('0xbe')][_0xd8fa('0x5e')]({'where':_0x347240})['then'](function(_0x2d01d4){if(_0x2d01d4){return[_0x2d01d4,![]];}return db[_0xd8fa('0xbe')][_0xd8fa('0x60')](_0x406864)[_0xd8fa('0x21')](function(_0x5ef941){return[_0x5ef941,!![]];});});}return db['ChatInteraction']['create'](_0x406864)[_0xd8fa('0x21')](function(_0x5df18b){return[_0x5df18b,!![]];});}})[_0xd8fa('0xc1')](function(_0x9bb2d4,_0x163214){if(_0x9bb2d4){_0x55cfb7=_0x163214;if(!_0x163214){var _0x576ceb={'from':(_0xa3c282[_0xd8fa('0x3b')][_0xd8fa('0xb2')]||'')+'\x20'+(_0xa3c282[_0xd8fa('0x3b')][_0xd8fa('0xb3')]||'')};if(_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0xbd')]&&_0x2dc504[_0xd8fa('0x69')]['messageId']&&_0x2dc504[_0xd8fa('0x69')]['threadId']!=_0x2dc504[_0xd8fa('0x69')]['messageId']){_0x576ceb['threadId']=_0x2dc504[_0xd8fa('0x69')][_0xd8fa('0xc2')];}return _0x9bb2d4[_0xd8fa('0x33')](_0x576ceb);}else{return _0x9bb2d4;}}})[_0xd8fa('0x21')](function(_0x36d1b9){_0xa3c282['interaction']=_0x36d1b9[_0xd8fa('0x61')]({'plain':!![]});_0xa3c282[_0xd8fa('0x3d')][_0xd8fa('0xc3')]=_0x55cfb7;if(_0xa3c282[_0xd8fa('0x3d')][_0xd8fa('0xc3')]){if(_0xa3c282[_0xd8fa('0x3e')][_0xd8fa('0xc4')]){_0xa3c282[_0xd8fa('0xaa')][_0xd8fa('0xc5')]({'id':0x0,'priority':_0xa3c282['applications'][_0xd8fa('0x4e')]+0x1,'app':'close','appdata':_0xd8fa('0xc6'),'interval':_0xd8fa('0xc7')});}}return db[_0xd8fa('0xc8')][_0xd8fa('0x60')]({'body':_0x2dc504['body'][_0xd8fa('0x69')],'ChatWebsiteId':_0x2dc504['params']['id'],'ChatInteractionId':_0x36d1b9['id'],'direction':'in','ContactId':_0xa3c282[_0xd8fa('0x3b')]['id'],'AttachmentId':_0x2dc504['body'][_0xd8fa('0xc9')]});})[_0xd8fa('0x21')](function(_0x31b85b){_0xa3c282[_0xd8fa('0x28')]=_0x31b85b;if(_0xa3c282[_0xd8fa('0x3d')][_0xd8fa('0xca')]){return db[_0xd8fa('0xcb')][_0xd8fa('0x5e')]({'attributes':['id',_0xd8fa('0x38')],'where':{'id':_0xa3c282[_0xd8fa('0x3d')][_0xd8fa('0xca')]}})[_0xd8fa('0x21')](function(_0x2e179c){if(_0x2e179c){_0xa3c282[_0xd8fa('0xaa')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd8fa('0x3c'),'appdata':_0x2e179c['name']+','+(_0xa3c282['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd8fa('0xc7')});_0xa3c282[_0xd8fa('0xcc')]=!![];}return respondWithRpcPromise(_0xd8fa('0xcd'),'startRouting',_0xa3c282);});}return respondWithRpcPromise(_0xd8fa('0xcd'),_0xd8fa('0xce'),_0xa3c282);})[_0xd8fa('0x21')](function(_0x3218b7){respondWithRpcPromise(_0xd8fa('0xcf'),_0xd8fa('0xcf'),{'event':_0xd8fa('0x91'),'message':_0x3218b7},client9002);return _0x3218b7;})[_0xd8fa('0x21')](respondWithResult(_0x52e008,null))['catch'](handleError(_0x52e008,null));};exports[_0xd8fa('0xd0')]=function(_0x4a0cfc,_0xd6e5a9,_0x50c0e7){var _0x2604bf,_0x26d80,_0x1e365f;var _0x5e449c=[];var _0x3294ef=[];var _0x26e5e6={};var _0x50fe6d=_0x4a0cfc[_0xd8fa('0xd1')]||[];var _0x5808fd=[];var _0x2c2f9f;return db[_0xd8fa('0x96')]['describe']()[_0xd8fa('0x21')](function(_0x559297){if(!_0x559297){throw new db[(_0xd8fa('0x97'))][(_0xd8fa('0x98'))](_0xd8fa('0xd2'));}_0x3294ef=_[_0xd8fa('0x99')](_['keys'](_0x559297),[_0xd8fa('0x9a'),'updatedAt']);_0x5e449c=_[_0xd8fa('0x99')](_[_0xd8fa('0x49')](_0x559297),[_0xd8fa('0x9a'),_0xd8fa('0x9b'),'CompanyId','ListId']);if(_0x4a0cfc[_0xd8fa('0x69')]['id']){delete _0x4a0cfc[_0xd8fa('0x69')]['id'];}if(_[_0xd8fa('0x83')](_0x4a0cfc[_0xd8fa('0x69')][_0xd8fa('0x9e')])){throw _0xd6e5a9[_0xd8fa('0x2a')](0x1f4)['send'](new db[(_0xd8fa('0x97'))][(_0xd8fa('0x98'))]('from\x20is\x20mandatory'));}if(_[_0xd8fa('0x83')](_0x4a0cfc[_0xd8fa('0x69')][_0xd8fa('0x69')])||_0x4a0cfc['body'][_0xd8fa('0x69')]===''){throw _0xd6e5a9['status'](0x1f4)[_0xd8fa('0xd3')](new db[(_0xd8fa('0x97'))][(_0xd8fa('0x98'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x4a0cfc[_0xd8fa('0x69')][_0xd8fa('0xd4')])){throw _0xd6e5a9[_0xd8fa('0x2a')](0x1f4)['send'](new db['Sequelize']['ValidationError'](_0xd8fa('0xd5')+_0x5e449c));}if(!_[_0xd8fa('0xa2')](_0x5e449c,_0x4a0cfc[_0xd8fa('0x69')]['mapKeyOffline'])){throw _0xd6e5a9[_0xd8fa('0x2a')](0x1f4)['send'](new db[(_0xd8fa('0x97'))]['ValidationError'](_0xd8fa('0xd6')+_0x5e449c));}_0x26e5e6[_0x4a0cfc['body'][_0xd8fa('0xd4')]]=_0x4a0cfc['body'][_0xd8fa('0x9e')];})[_0xd8fa('0x21')](function(){return db['ChatWebsite'][_0xd8fa('0x5e')]({'where':{'id':_0x4a0cfc[_0xd8fa('0x5c')]['id']},'include':[{'model':db[_0xd8fa('0xa3')],'as':'List'},{'model':db[_0xd8fa('0xd7')],'as':_0xd8fa('0xd7')}]});})['then'](handleEntityNotFound(_0xd6e5a9,null))['then'](function(_0xea5780){if(_0xea5780&&_0xea5780[_0xd8fa('0xa4')]){_0x26d80=_0xea5780;var _0x396398=_[_0xd8fa('0x1b')](_0x4a0cfc[_0xd8fa('0x69')],{'firstName':_0x4a0cfc[_0xd8fa('0x69')][_0xd8fa('0x9e')],'phone':_0x4a0cfc['body']['from'],'ListId':_0xea5780['ListId']});_0x396398[_0x4a0cfc[_0xd8fa('0x69')][_0xd8fa('0xd4')]]=_0x4a0cfc[_0xd8fa('0x69')][_0xd8fa('0x9e')];return db['CmContact']['findOrCreate']({'where':_0x26e5e6,'defaults':_0x396398});}})[_0xd8fa('0xc1')](function(_0x525d7f){if(_0x525d7f){_0x1e365f=_0x525d7f;var _0x4f235d=fs[_0xd8fa('0xd8')](path[_0xd8fa('0x7e')](config['root'],_0xd8fa('0xd9')),_0xd8fa('0xda'));var _0x14c245=ejs[_0xd8fa('0x39')](_0x4f235d,{'body':_['toPairs'](_0x4a0cfc[_0xd8fa('0x69')][_0xd8fa('0x69')]),'bodyTitle':_0x26d80[_0xd8fa('0xdb')]});return db[_0xd8fa('0xdc')][_0xd8fa('0x60')]({'body':_0x14c245,'ContactId':_0x525d7f['id'],'ChatWebsiteId':_0x26d80['id']});}})[_0xd8fa('0x21')](function(_0xc69acf){_0x2c2f9f=_0xc69acf;if(_0x50fe6d['length']){var _0x502862=_0x50fe6d[_0xd8fa('0x47')](function(_0x2ebbcd){return{'name':_0x2ebbcd[_0xd8fa('0xdd')],'basename':_0x2ebbcd['filename'],'type':_0x2ebbcd[_0xd8fa('0xde')],'ChatOfflineMessageId':_0xc69acf['id']};});_0x5808fd=_0x502862['map'](_0x10720d=>{var _0x467779={'filename':_0x10720d[_0xd8fa('0x38')],'path':path[_0xd8fa('0x7e')](config[_0xd8fa('0x7f')],_0xd8fa('0xdf'),_0xd8fa('0xd1'),'attachments',_0xd8fa('0xe0'),_0x10720d[_0xd8fa('0xe1')])};return _0x467779;});if(!_0x26d80[_0xd8fa('0xe2')]){return db[_0xd8fa('0xe3')][_0xd8fa('0xe4')](function(_0x5d1d4a){return db[_0xd8fa('0xe5')][_0xd8fa('0xe6')](_0x502862,{'transaction':_0x5d1d4a});});}}})['then'](function(){if(_0x2c2f9f){_0x2604bf=_0x2c2f9f;return db[_0xd8fa('0xd7')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xd8fa('0xe7')],'as':_0xd8fa('0xe8'),'raw':!![]}]});}})[_0xd8fa('0x21')](function(_0x192d7c){if(_0x192d7c&&_0x192d7c[_0xd8fa('0xe8')]&&_0x26d80['forwardOffline']&&_0x26d80[_0xd8fa('0xe9')]){var _0x582798={'tls':{'rejectUnauthorized':![]}};if(_0x192d7c[_0xd8fa('0xe8')][_0xd8fa('0xea')]){_0x582798['service']=_0x192d7c[_0xd8fa('0xe8')]['service'];}else{_0x582798[_0xd8fa('0xeb')]=_0x192d7c['Smtp']['host'];_0x582798['port']=_0x192d7c[_0xd8fa('0xe8')][_0xd8fa('0xec')];_0x582798[_0xd8fa('0xed')]=_0x192d7c[_0xd8fa('0xe8')]['secure'];}if(_0x192d7c['Smtp'][_0xd8fa('0xee')]){_0x582798[_0xd8fa('0xef')]={'user':_0x192d7c[_0xd8fa('0xe8')][_0xd8fa('0x64')],'pass':_0x192d7c[_0xd8fa('0xe8')][_0xd8fa('0xf0')]};}return respondWithRpcPromise(_0xd8fa('0xf1'),_0xd8fa('0xf2'),{'account':_0x582798,'message':{'from':util[_0xd8fa('0xb9')](_0xd8fa('0xf3'),_0x192d7c[_0xd8fa('0x38')],_0x192d7c[_0xd8fa('0xf4')]||_0x192d7c['Smtp'][_0xd8fa('0x64')]),'to':_0x26d80[_0xd8fa('0xe9')],'subject':_0x26d80[_0xd8fa('0xf5')],'html':_0x2604bf[_0xd8fa('0x69')],'attachments':_0x5808fd}},client9003)[_0xd8fa('0x21')](function(){return _0x2604bf;})[_0xd8fa('0x5f')](function(_0x31ed66){console[_0xd8fa('0x27')](_0x31ed66);});}})[_0xd8fa('0x21')](function(){if(_0x26d80&&_0x26d80['openNewInteraction']&&_0x26d80[_0xd8fa('0xf6')]){var _0x296226=[];if(_0x50fe6d[_0xd8fa('0x4e')]){_0x296226=_0x50fe6d['map'](function(_0x554c3c){return{'name':_0x554c3c[_0xd8fa('0xdd')],'basename':_0x554c3c[_0xd8fa('0x7c')],'type':_0x554c3c[_0xd8fa('0xde')],'ChatOfflineMessageId':_0x2c2f9f['id']};});}var _0x700702;if(!_[_0xd8fa('0x83')](_0x26d80[_0xd8fa('0xf7')])){var _0x5e44fc=_[_0xd8fa('0x47')](_0x4a0cfc[_0xd8fa('0x69')],function(_0x5c8faf){return _0x5c8faf;});var _0x559578=_['toPairsIn'](_0x5e44fc)[0x0];var _0x432d69=_[_0xd8fa('0xf8')](_0x559578,function(_0xd71427){return _0xd71427;});_0x700702=_0x432d69[0x1][_0x26d80['subjectOffline']];}var _0x497aca={'from':_0x1e365f['email'],'firstName':_0x1e365f[_0xd8fa('0xb2')],'lastName':_0x1e365f[_0xd8fa('0xb3')],'mapKey':_0xd8fa('0xf4'),'message':{'from':_0x1e365f['email'],'to':_0x26d80['MailAccount'][_0xd8fa('0xf4')],'cc':'','subject':_[_0xd8fa('0x83')](_0x700702)?_0x26d80[_0xd8fa('0xf5')]:_0x700702,'messageId':'','sentAt':new Date(),'attach':_0x296226[_0xd8fa('0x4e')],'attachments':_0x296226,'originChannel':_0xd8fa('0xf9'),'ChatWebsiteId':_0x26d80['id'],'ChatOfflineMessageId':_0x2604bf['id'],'originTo':_0x26d80[_0xd8fa('0xd7')][_0xd8fa('0xf4')]},'body':_0x2604bf[_0xd8fa('0x69')]};var _0x58ec54={'account':{'id':_0x26d80[_0xd8fa('0xf6')]},'body':_0x497aca,'log':_0xd8fa('0xfa')};return respondWithRpcPromise(_0xd8fa('0xfa'),_0xd8fa('0xfb'),_0x58ec54,client9001)['then'](function(){return _0x2604bf;})[_0xd8fa('0x5f')](function(_0x4530ea){console[_0xd8fa('0x27')](_0x4530ea);});}return;})[_0xd8fa('0x21')](function(){if(_0x2604bf){return _0x2604bf;}})['then'](respondWithResult(_0xd6e5a9,null))[_0xd8fa('0x5f')](function(_0x2b6163){console[_0xd8fa('0x27')](_0xd8fa('0x5f'),_0x2b6163);for(var _0x2f1602 of _0x50fe6d){var _0x5e9c55=path[_0xd8fa('0x7e')](config[_0xd8fa('0x7f')],'server',_0xd8fa('0xd1'),_0xd8fa('0xfc'),_0xd8fa('0xe0'),_0x2f1602[_0xd8fa('0x7c')]);fs_extra[_0xd8fa('0xfd')](_0x5e9c55)[_0xd8fa('0x5f')](function(_0x3d557e){console[_0xd8fa('0x27')](_0xd8fa('0xfe'),_0x5e9c55,_0x3d557e);});}});};exports[_0xd8fa('0xff')]=function(_0x32688d,_0x458bf0,_0x24b5f0){return db[_0xd8fa('0xbe')]['find']({'where':{'id':_0x32688d[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x458bf0,null))[_0xd8fa('0x21')](function(_0x5dd287){if(_0x5dd287){return _0x5dd287[_0xd8fa('0xff')](_0x32688d[_0xd8fa('0x69')][_0xd8fa('0x71')],_['omit'](_0x32688d[_0xd8fa('0x69')],[_0xd8fa('0x71'),'id'])||{});}})[_0xd8fa('0x21')](respondWithResult(_0x458bf0,null))[_0xd8fa('0x5f')](handleError(_0x458bf0,null));};exports['getInteractions']=function(_0x29b579,_0x30c711,_0x3a0498){var _0x2882a6={'raw':![],'where':{}};var _0x499601={};var _0x2ce4b6={'count':0x0,'rows':[]};return db[_0xd8fa('0x59')][_0xd8fa('0x6f')]({'where':{'id':_0x29b579[_0xd8fa('0x5c')]['id']}})['then'](handleEntityNotFound(_0x30c711,null))['then'](function(_0x16be3c){if(_0x16be3c){_0x499601[_0xd8fa('0x46')]=_[_0xd8fa('0x49')](db[_0xd8fa('0xbe')][_0xd8fa('0x42')]);_0x499601[_0xd8fa('0x48')]=_[_0xd8fa('0x49')](_0x29b579[_0xd8fa('0x48')]);_0x499601[_0xd8fa('0x4a')]=_['intersection'](_0x499601[_0xd8fa('0x46')],_0x499601['query']);_0x2882a6[_0xd8fa('0x4d')]=_[_0xd8fa('0x4b')](_0x499601[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x29b579['query']['fields']));_0x2882a6[_0xd8fa('0x4d')]=_0x2882a6[_0xd8fa('0x4d')][_0xd8fa('0x4e')]?_0x2882a6[_0xd8fa('0x4d')]:_0x499601[_0xd8fa('0x46')];if(!_0x29b579[_0xd8fa('0x48')][_0xd8fa('0x4f')](_0xd8fa('0x50'))){_0x2882a6[_0xd8fa('0x2f')]=qs[_0xd8fa('0x2f')](_0x29b579[_0xd8fa('0x48')][_0xd8fa('0x2f')]);_0x2882a6[_0xd8fa('0x2d')]=qs[_0xd8fa('0x2d')](_0x29b579[_0xd8fa('0x48')][_0xd8fa('0x2d')]);}_0x2882a6['order']=qs['sort'](_0x29b579[_0xd8fa('0x48')]['sort']);_0x2882a6[_0xd8fa('0x52')]=qs[_0xd8fa('0x4a')](_[_0xd8fa('0x53')](_0x29b579[_0xd8fa('0x48')],_0x499601[_0xd8fa('0x4a')]));_0x2882a6[_0xd8fa('0x52')][_0xd8fa('0x6c')]=_0x16be3c['id'];if(_0x29b579[_0xd8fa('0x48')][_0xd8fa('0x54')]){_0x2882a6[_0xd8fa('0x52')]=_[_0xd8fa('0x3a')](_0x2882a6[_0xd8fa('0x52')],{'$or':_['map'](_0x2882a6[_0xd8fa('0x4d')],function(_0x596c2b){var _0x346460={};_0x346460[_0x596c2b]={'$like':'%'+_0x29b579[_0xd8fa('0x48')]['filter']+'%'};return _0x346460;})});}_0x2882a6=_[_0xd8fa('0x3a')]({},_0x2882a6,_0x29b579[_0xd8fa('0x56')]);return db['ChatInteraction'][_0xd8fa('0x57')]({'where':_0x2882a6['where']})[_0xd8fa('0x21')](function(_0x2c9720){_0x2ce4b6[_0xd8fa('0x57')]=_0x2c9720;if(_0x29b579[_0xd8fa('0x48')][_0xd8fa('0x58')]){_0x2882a6['include']=[{'model':db[_0xd8fa('0x96')],'as':_0xd8fa('0x100'),'required':![]},{'model':db[_0xd8fa('0xcb')],'as':'Owner','attributes':[_0xd8fa('0x38'),'fullname','internal'],'required':![]},{'model':db[_0xd8fa('0x101')],'as':'Tags','attributes':['id',_0xd8fa('0x38'),_0xd8fa('0x102')],'where':_0x29b579['query'][_0xd8fa('0x103')]?{'id':_0x29b579[_0xd8fa('0x48')][_0xd8fa('0x103')]}:undefined,'required':_0x29b579[_0xd8fa('0x48')][_0xd8fa('0x103')]?!![]:![]}];}return db[_0xd8fa('0xbe')][_0xd8fa('0x5a')](_0x2882a6);})[_0xd8fa('0x21')](function(_0x2b5cbf){_0x2ce4b6[_0xd8fa('0x5b')]=_0x2b5cbf;return _0x2ce4b6;});}})[_0xd8fa('0x21')](respondWithFilteredResult(_0x30c711,_0x2882a6))[_0xd8fa('0x5f')](handleError(_0x30c711,null));};function iftimePromise(_0x38bf88,_0x201015){return respondWithRpcPromise('Command',_0xd8fa('0x104'),{'command':_0x201015[_0xd8fa('0x105')]?util[_0xd8fa('0xb9')](_0xd8fa('0x106'),_0x38bf88['interval'],_0x201015[_0xd8fa('0x105')]):util[_0xd8fa('0xb9')](_0xd8fa('0x107'),_0x38bf88[_0xd8fa('0x108')])},client9002)[_0xd8fa('0x21')](function(_0x40992d){var _0x47a7da=_0x40992d&&_0x40992d[_0xd8fa('0x109')](_0xd8fa('0x10a'))>=0x0?!![]:![];logger[_0xd8fa('0x29')](_0xd8fa('0x10b'),_0x201015['id'],_0x38bf88['id'],_0x38bf88[_0xd8fa('0x108')],_0x47a7da?_0xd8fa('0x10c'):_0xd8fa('0x10d'),_0x201015[_0xd8fa('0x105')]?_0x201015['timezone']:'No\x20timezone');return _0x47a7da;})[_0xd8fa('0x5f')](function(_0x427d86){logger['error'](_0xd8fa('0x10b'),_0x201015['id'],_0x38bf88['id'],_0x38bf88[_0xd8fa('0x108')],util['inspect'](_0x427d86,{'showHidden':![],'depth':null}),_0x201015[_0xd8fa('0x105')]?_0x201015[_0xd8fa('0x105')]:'No\x20timezone');return![];});}exports[_0xd8fa('0x104')]=function(_0x2e5ab2,_0x1c05e2,_0xaa7c48){var _0x360269=0x0;var _0xb250e3=0x0;var _0x268c2c=![];var _0x3eaa3c;var _0x119e12;return db[_0xd8fa('0x59')]['find']({'where':{'id':_0x2e5ab2['params']['id']},'include':[{'model':db['Interval'],'as':_0xd8fa('0x10e'),'include':[{'model':db[_0xd8fa('0x10e')],'as':'Intervals','attributes':['id',_0xd8fa('0x108')],'raw':!![]}]}]})[_0xd8fa('0x21')](handleEntityNotFound(_0x1c05e2,null))[_0xd8fa('0x21')](function(_0x128a40){if(_0x128a40){_0x3eaa3c=_0x128a40;return _0x128a40[_0xd8fa('0x10f')]({'raw':!![]});}})['then'](function(_0x248a2e){if(_0x3eaa3c){if(_0x248a2e){_0x119e12=_0x248a2e;}}return require(_0xd8fa('0x18'))[_0xd8fa('0x81')]();})[_0xd8fa('0x21')](function(_0x3f72b5){if(_0x3f72b5){_0xb250e3=_0x3f72b5[_0xd8fa('0x110')];_0x268c2c=_0x3f72b5[_0xd8fa('0x82')];}})[_0xd8fa('0x21')](function(){return db[_0xd8fa('0xbe')][_0xd8fa('0x57')]({'where':{'closed':![]}});})[_0xd8fa('0x21')](function(_0x598b1e){_0x360269=_0x598b1e;if(_0xb250e3&&_0x598b1e>_0xb250e3){return db[_0xd8fa('0x111')][_0xd8fa('0x6f')]({'where':{'id':0x1}})['then'](function(_0x64e1f6){if(_0x64e1f6){_0x64e1f6[_0xd8fa('0x112')](_0xd8fa('0x113'));}});}})['then'](function(){if(_0x3eaa3c['Interval']&&_0x3eaa3c[_0xd8fa('0x10e')]['Intervals']){var _0x26937e=[];for(var _0x464329=0x0;_0x464329<_0x3eaa3c['Interval'][_0xd8fa('0x114')][_0xd8fa('0x4e')];_0x464329++){var _0x3a4362=_0x3eaa3c['Interval'][_0xd8fa('0x114')][_0x464329][_0xd8fa('0x61')]({'plain':!![]});_0x26937e[_0xd8fa('0xc5')](iftimePromise(_0x3a4362,_0x3eaa3c));}return BPromise[_0xd8fa('0x115')](_0x26937e)[_0xd8fa('0x21')](function(_0x224ed4){return _[_0xd8fa('0x116')](_0x224ed4);});}else{return!![];}})['then'](function(_0x394e43){var _0x314cb7=fs['readFileSync'](path[_0xd8fa('0x7e')](config['root'],_0xd8fa('0x117')),_0xd8fa('0xda'));var _0x96d07c={'remote':_0x3eaa3c['remote'],'query':querystring[_0xd8fa('0x26')](_['merge'](_0x3eaa3c[_0xd8fa('0x61')]({'plain':!![]}),{'customerIp':_0x2e5ab2['headers'][_0xd8fa('0xaf')]||_0x2e5ab2[_0xd8fa('0x94')][_0xd8fa('0x118')]||_0x2e5ab2[_0xd8fa('0x119')][_0xd8fa('0x11a')]||_0x2e5ab2['ip'],'referer':_0x2e5ab2['headers'][_0xd8fa('0x11b')],'openedInteractions':_0x360269,'maxInteractions':_0xb250e3,'virtual':_0x268c2c[_0xd8fa('0x110')],'online':_0x394e43,'custom':_0x268c2c}))[_0xd8fa('0x11c')](/'/g,'\x5c\x27')};_0x1c05e2[_0xd8fa('0xd3')](ejs[_0xd8fa('0x39')](Mustache[_0xd8fa('0x39')](_0x314cb7,_0x96d07c),{'proactiveActions':_0x119e12,'alignment':_0x3eaa3c[_0xd8fa('0x11d')],'verticalAlignment':_0x3eaa3c[_0xd8fa('0x11e')],'div_color':_0x3eaa3c[_0xd8fa('0x102')],'text_color':_0x3eaa3c[_0xd8fa('0x11f')],'button_color':_0x3eaa3c[_0xd8fa('0x120')],'background_color':_0x3eaa3c[_0xd8fa('0x121')]}));})[_0xd8fa('0x5f')](handleError(_0x1c05e2,null));};exports[_0xd8fa('0x122')]=function(_0x1580b7,_0x3fff4f,_0x2c49d0){return db[_0xd8fa('0x59')][_0xd8fa('0x6f')]({'where':{'id':_0x1580b7[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x3fff4f,null))[_0xd8fa('0x21')](function(_0x485f19){if(_0x485f19){return db[_0xd8fa('0xe3')][_0xd8fa('0xe4')](function(_0x2dc94c){return db['ChatApplication'][_0xd8fa('0x36')]({'where':{'ChatWebsiteId':_0x1580b7[_0xd8fa('0x5c')]['id']},'transaction':_0x2dc94c})[_0xd8fa('0x21')](function(_0x1ff96c){var _0x3ebcb1=_[_0xd8fa('0x47')](_0x1580b7[_0xd8fa('0x69')],function(_0x170891){_0x170891[_0xd8fa('0x6c')]=_0x1580b7[_0xd8fa('0x5c')]['id'];return _0x170891;});return db[_0xd8fa('0xa7')][_0xd8fa('0xe6')](_0x3ebcb1,{'transaction':_0x2dc94c});});})[_0xd8fa('0x21')](function(){return db['ChatApplication'][_0xd8fa('0x123')]({'where':{'ChatWebsiteId':_0x1580b7[_0xd8fa('0x5c')]['id']},'order':_0xd8fa('0x124')});});}})[_0xd8fa('0x21')](respondWithResult(_0x3fff4f,null))[_0xd8fa('0x5f')](handleError(_0x3fff4f,null));};exports[_0xd8fa('0x125')]=function(_0x440f9d,_0x3bf5e2,_0x1adf1d){var _0x560fc3={};var _0x40f197={};var _0x4c74aa;var _0x4217dd;return db[_0xd8fa('0x59')][_0xd8fa('0x6f')]({'where':{'id':_0x440f9d[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x3bf5e2,null))['then'](function(_0x5cf723){if(_0x5cf723){_0x4c74aa=_0x5cf723;_0x40f197['model']=_[_0xd8fa('0x49')](db[_0xd8fa('0xa7')][_0xd8fa('0x42')]);_0x40f197[_0xd8fa('0x48')]=_[_0xd8fa('0x49')](_0x440f9d[_0xd8fa('0x48')]);_0x40f197[_0xd8fa('0x4a')]=_['intersection'](_0x40f197['model'],_0x40f197[_0xd8fa('0x48')]);_0x560fc3[_0xd8fa('0x4d')]=_[_0xd8fa('0x4b')](_0x40f197[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x440f9d[_0xd8fa('0x48')][_0xd8fa('0x4c')]));_0x560fc3[_0xd8fa('0x4d')]=_0x560fc3[_0xd8fa('0x4d')][_0xd8fa('0x4e')]?_0x560fc3[_0xd8fa('0x4d')]:_0x40f197['model'];_0x560fc3[_0xd8fa('0x75')]=qs[_0xd8fa('0x51')](_0x440f9d['query'][_0xd8fa('0x51')]);_0x560fc3[_0xd8fa('0x52')]=qs[_0xd8fa('0x4a')](_[_0xd8fa('0x53')](_0x440f9d[_0xd8fa('0x48')],_0x40f197['filters']));if(_0x440f9d[_0xd8fa('0x48')][_0xd8fa('0x54')]){_0x560fc3[_0xd8fa('0x52')]=_[_0xd8fa('0x3a')](_0x560fc3[_0xd8fa('0x52')],{'$or':_['map'](_0x560fc3[_0xd8fa('0x4d')],function(_0x3ef568){var _0xf03130={};_0xf03130[_0x3ef568]={'$like':'%'+_0x440f9d[_0xd8fa('0x48')][_0xd8fa('0x54')]+'%'};return _0xf03130;})});}_0x560fc3=_[_0xd8fa('0x3a')]({},_0x560fc3,_0x440f9d['options']);return _0x4c74aa[_0xd8fa('0x125')](_0x560fc3);}})[_0xd8fa('0x21')](function(_0x5ca52b){if(_0x5ca52b){_0x4217dd=_0x5ca52b[_0xd8fa('0x4e')];if(!_0x440f9d['query'][_0xd8fa('0x4f')](_0xd8fa('0x50'))){_0x560fc3[_0xd8fa('0x2f')]=qs['limit'](_0x440f9d[_0xd8fa('0x48')][_0xd8fa('0x2f')]);_0x560fc3[_0xd8fa('0x2d')]=qs[_0xd8fa('0x2d')](_0x440f9d['query'][_0xd8fa('0x2d')]);}return _0x4c74aa[_0xd8fa('0x125')](_0x560fc3);}})[_0xd8fa('0x21')](function(_0x1bdf4e){if(_0x1bdf4e){return _0x1bdf4e?{'count':_0x4217dd,'rows':_0x1bdf4e}:null;}})['then'](respondWithResult(_0x3bf5e2,null))[_0xd8fa('0x5f')](handleError(_0x3bf5e2,null));};exports[_0xd8fa('0x126')]=function(_0x4ecfa0,_0x571bdd,_0x3083ce){return db[_0xd8fa('0x127')]['find']({'where':{'id':_0x4ecfa0[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x571bdd,null))[_0xd8fa('0x21')](function(_0x19981c){if(_0x19981c){return _0x19981c['addProactiveActions'](_0x4ecfa0['body'][_0xd8fa('0x71')],_[_0xd8fa('0x128')](_0x4ecfa0[_0xd8fa('0x69')],['ids','id'])||{});}})[_0xd8fa('0x21')](respondWithResult(_0x571bdd,null))[_0xd8fa('0x5f')](handleError(_0x571bdd,null));};exports[_0xd8fa('0x10f')]=function(_0x9109fa,_0x4631d8,_0x4cf24c){var _0x5c1ac1={};var _0x3c7be8={};var _0x4ceebb;var _0x1bb0c3;return db[_0xd8fa('0x59')][_0xd8fa('0x6f')]({'where':{'id':_0x9109fa[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x4631d8,null))['then'](function(_0x11a125){if(_0x11a125){_0x4ceebb=_0x11a125;_0x3c7be8['model']=_[_0xd8fa('0x49')](db[_0xd8fa('0x129')]['rawAttributes']);_0x3c7be8[_0xd8fa('0x48')]=_[_0xd8fa('0x49')](_0x9109fa[_0xd8fa('0x48')]);_0x3c7be8[_0xd8fa('0x4a')]=_[_0xd8fa('0x4b')](_0x3c7be8['model'],_0x3c7be8[_0xd8fa('0x48')]);_0x5c1ac1[_0xd8fa('0x4d')]=_[_0xd8fa('0x4b')](_0x3c7be8[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x9109fa[_0xd8fa('0x48')][_0xd8fa('0x4c')]));_0x5c1ac1[_0xd8fa('0x4d')]=_0x5c1ac1['attributes'][_0xd8fa('0x4e')]?_0x5c1ac1['attributes']:_0x3c7be8[_0xd8fa('0x46')];_0x5c1ac1[_0xd8fa('0x75')]=qs['sort'](_0x9109fa[_0xd8fa('0x48')][_0xd8fa('0x51')]);_0x5c1ac1['where']=qs[_0xd8fa('0x4a')](_['pick'](_0x9109fa[_0xd8fa('0x48')],_0x3c7be8[_0xd8fa('0x4a')]));if(_0x9109fa['query'][_0xd8fa('0x54')]){_0x5c1ac1['where']=_[_0xd8fa('0x3a')](_0x5c1ac1[_0xd8fa('0x52')],{'$or':_[_0xd8fa('0x47')](_0x5c1ac1[_0xd8fa('0x4d')],function(_0x48d0f3){var _0x2158a1={};_0x2158a1[_0x48d0f3]={'$like':'%'+_0x9109fa[_0xd8fa('0x48')][_0xd8fa('0x54')]+'%'};return _0x2158a1;})});}_0x5c1ac1=_['merge']({},_0x5c1ac1,_0x9109fa[_0xd8fa('0x56')]);return _0x4ceebb[_0xd8fa('0x10f')](_0x5c1ac1);}})[_0xd8fa('0x21')](function(_0x4674f1){if(_0x4674f1){_0x1bb0c3=_0x4674f1[_0xd8fa('0x4e')];if(!_0x9109fa[_0xd8fa('0x48')][_0xd8fa('0x4f')](_0xd8fa('0x50'))){_0x5c1ac1[_0xd8fa('0x2f')]=qs[_0xd8fa('0x2f')](_0x9109fa['query'][_0xd8fa('0x2f')]);_0x5c1ac1[_0xd8fa('0x2d')]=qs['offset'](_0x9109fa[_0xd8fa('0x48')]['offset']);}return _0x4ceebb[_0xd8fa('0x10f')](_0x5c1ac1);}})[_0xd8fa('0x21')](function(_0x143807){if(_0x143807){return _0x143807?{'count':_0x1bb0c3,'rows':_0x143807}:null;}})['then'](respondWithResult(_0x4631d8,null))[_0xd8fa('0x5f')](handleError(_0x4631d8,null));};exports['getFields']=function(_0x5dca5a,_0x3ab5c3,_0x2787f0){var _0x3227ac=_0x5dca5a[_0xd8fa('0x48')][_0xd8fa('0x12a')]==='false'?_0xd8fa('0x12b'):_0xd8fa('0x12c');return db[_0xd8fa('0x59')]['find']({'attributes':['id',_0x3227ac],'where':{'id':_0x5dca5a[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x3ab5c3,null))[_0xd8fa('0x21')](function(_0x157a0e){if(_0x157a0e){var _0x188a1a=_0x157a0e[_0x3227ac];var _0x4332cd=_0x188a1a&&_0x188a1a[_0xd8fa('0x12d')]?_0x188a1a['items']:[];_0x3ab5c3['send']({'fromKey':_[_0xd8fa('0x83')](_0x188a1a[_0xd8fa('0x12e')])?undefined:_0x188a1a[_0xd8fa('0x12e')],'count':_0x4332cd[_0xd8fa('0x4e')],'rows':_0x4332cd});}})[_0xd8fa('0x5f')](handleError(_0x3ab5c3,null));};exports[_0xd8fa('0x12f')]=function(_0x649398,_0x4df78d,_0x54c6a5){var _0x35cefb={'raw':![],'where':{}};var _0x1bc3bb={};var _0xe07f9={'count':0x0,'rows':[]};return db[_0xd8fa('0x59')][_0xd8fa('0x6f')]({'where':{'id':_0x649398[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x4df78d,null))[_0xd8fa('0x21')](function(_0x5f54a2){if(_0x5f54a2){_0x1bc3bb[_0xd8fa('0x46')]=_[_0xd8fa('0x49')](db[_0xd8fa('0xdc')][_0xd8fa('0x42')]);_0x1bc3bb[_0xd8fa('0x48')]=_['keys'](_0x649398[_0xd8fa('0x48')]);_0x1bc3bb[_0xd8fa('0x4a')]=_['intersection'](_0x1bc3bb[_0xd8fa('0x46')],_0x1bc3bb[_0xd8fa('0x48')]);_0x35cefb['attributes']=_['intersection'](_0x1bc3bb[_0xd8fa('0x46')],qs['fields'](_0x649398[_0xd8fa('0x48')][_0xd8fa('0x4c')]));_0x35cefb['attributes']=_0x35cefb[_0xd8fa('0x4d')][_0xd8fa('0x4e')]?_0x35cefb[_0xd8fa('0x4d')]:_0x1bc3bb['model'];if(!_0x649398[_0xd8fa('0x48')][_0xd8fa('0x4f')](_0xd8fa('0x50'))){_0x35cefb[_0xd8fa('0x2f')]=qs[_0xd8fa('0x2f')](_0x649398[_0xd8fa('0x48')]['limit']);_0x35cefb[_0xd8fa('0x2d')]=qs[_0xd8fa('0x2d')](_0x649398['query'][_0xd8fa('0x2d')]);}_0x35cefb[_0xd8fa('0x75')]=qs[_0xd8fa('0x51')](_0x649398[_0xd8fa('0x48')]['sort']);_0x35cefb[_0xd8fa('0x52')]=qs[_0xd8fa('0x4a')](_[_0xd8fa('0x53')](_0x649398['query'],_0x1bc3bb['filters']));_0x35cefb[_0xd8fa('0x52')]['ChatWebsiteId']=_0x5f54a2['id'];if(_0x649398['query'][_0xd8fa('0x54')]){_0x35cefb[_0xd8fa('0x52')]=_['merge'](_0x35cefb[_0xd8fa('0x52')],{'$or':_[_0xd8fa('0x47')](_0x35cefb[_0xd8fa('0x4d')],function(_0x96f3ff){var _0x5b1c63={};_0x5b1c63[_0x96f3ff]={'$like':'%'+_0x649398[_0xd8fa('0x48')]['filter']+'%'};return _0x5b1c63;})});}_0x35cefb=_[_0xd8fa('0x3a')]({},_0x35cefb,_0x649398[_0xd8fa('0x56')]);return db['ChatOfflineMessage'][_0xd8fa('0x57')]({'where':_0x35cefb[_0xd8fa('0x52')]})['then'](function(_0x269301){_0xe07f9[_0xd8fa('0x57')]=_0x269301;if(_0x649398[_0xd8fa('0x48')][_0xd8fa('0x58')]){_0x35cefb[_0xd8fa('0x5d')]=[{'all':!![]}];}else{_0x35cefb[_0xd8fa('0x5d')]=[{'model':db[_0xd8fa('0x96')],'as':_0xd8fa('0x100'),'required':![]},{'model':db['Attachment'],'as':_0xd8fa('0x130'),'required':![]}];}return db[_0xd8fa('0xdc')][_0xd8fa('0x5a')](_0x35cefb);})['then'](function(_0x1ddb3e){_0xe07f9[_0xd8fa('0x5b')]=_0x1ddb3e;return _0xe07f9;});}})['then'](respondWithFilteredResult(_0x4df78d,_0x35cefb))['catch'](handleError(_0x4df78d,null));};exports[_0xd8fa('0x131')]=function(_0x5687fb,_0x505d04,_0x2f3879){return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x5687fb[_0xd8fa('0x5c')]['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x505d04,null))[_0xd8fa('0x21')](function(_0x4b78bb){if(_0x4b78bb){return _0x4b78bb[_0xd8fa('0x131')](_0x5687fb[_0xd8fa('0x69')][_0xd8fa('0x71')],_[_0xd8fa('0x128')](_0x5687fb['body'],[_0xd8fa('0x71'),'id'])||{})[_0xd8fa('0xc1')](function(_0x3dcbf0){for(var _0x433323=0x0;_0x433323<_0x5687fb[_0xd8fa('0x69')][_0xd8fa('0x71')][_0xd8fa('0x4e')];_0x433323+=0x1){socket[_0xd8fa('0x132')](_0xd8fa('0x133'),{'UserId':_0x5687fb['body'][_0xd8fa('0x71')][_0x433323],'ChatWebsiteId':_0x5687fb[_0xd8fa('0x5c')]['id']});}return _0x3dcbf0;});}})[_0xd8fa('0x21')](respondWithResult(_0x505d04,null))['catch'](handleError(_0x505d04,null));};exports[_0xd8fa('0x134')]=function(_0x12bb5f,_0x53d998,_0x4f5f35){return db[_0xd8fa('0x59')][_0xd8fa('0x5e')]({'where':{'id':_0x12bb5f[_0xd8fa('0x5c')]['id']}})['then'](handleEntityNotFound(_0x53d998,null))[_0xd8fa('0x21')](function(_0x2dd4d4){if(_0x2dd4d4){return _0x2dd4d4[_0xd8fa('0x134')](_0x12bb5f[_0xd8fa('0x48')]['ids'])[_0xd8fa('0x21')](function(){if(_['isArray'](_0x12bb5f[_0xd8fa('0x48')][_0xd8fa('0x71')])){for(var _0x45e339=0x0;_0x45e339<_0x12bb5f['query'][_0xd8fa('0x71')][_0xd8fa('0x4e')];_0x45e339+=0x1){socket[_0xd8fa('0x132')](_0xd8fa('0x135'),{'UserId':Number(_0x12bb5f['query']['ids'][_0x45e339]),'ChatWebsiteId':Number(_0x12bb5f[_0xd8fa('0x5c')]['id'])});}}else{socket[_0xd8fa('0x132')]('userChatWebsite:remove',{'UserId':Number(_0x12bb5f[_0xd8fa('0x48')][_0xd8fa('0x71')]),'ChatWebsiteId':Number(_0x12bb5f['params']['id'])});}});}})[_0xd8fa('0x21')](respondWithStatusCode(_0x53d998,null))[_0xd8fa('0x5f')](handleError(_0x53d998,null));};exports[_0xd8fa('0x136')]=function(_0x2a233e,_0x4ea552,_0xa9a760){var _0x1d4611={};var _0xf214f4={};var _0x1495fe;var _0x3b83b3;return db['ChatWebsite'][_0xd8fa('0x6f')]({'where':{'id':_0x2a233e['params']['id']}})[_0xd8fa('0x21')](handleEntityNotFound(_0x4ea552,null))['then'](function(_0x2e8667){if(_0x2e8667){_0x1495fe=_0x2e8667;_0xf214f4[_0xd8fa('0x46')]=_[_0xd8fa('0x49')](db[_0xd8fa('0xcb')][_0xd8fa('0x42')]);_0xf214f4[_0xd8fa('0x48')]=_['keys'](_0x2a233e[_0xd8fa('0x48')]);_0xf214f4[_0xd8fa('0x4a')]=_[_0xd8fa('0x4b')](_0xf214f4[_0xd8fa('0x46')],_0xf214f4[_0xd8fa('0x48')]);_0x1d4611['attributes']=_[_0xd8fa('0x4b')](_0xf214f4[_0xd8fa('0x46')],qs[_0xd8fa('0x4c')](_0x2a233e[_0xd8fa('0x48')][_0xd8fa('0x4c')]));_0x1d4611[_0xd8fa('0x4d')]=_0x1d4611[_0xd8fa('0x4d')]['length']?_0x1d4611[_0xd8fa('0x4d')]:_0xf214f4[_0xd8fa('0x46')];_0x1d4611[_0xd8fa('0x75')]=qs['sort'](_0x2a233e['query'][_0xd8fa('0x51')]);_0x1d4611['where']=qs[_0xd8fa('0x4a')](_[_0xd8fa('0x53')](_0x2a233e[_0xd8fa('0x48')],_0xf214f4[_0xd8fa('0x4a')]));if(_0x2a233e[_0xd8fa('0x48')][_0xd8fa('0x54')]){_0x1d4611[_0xd8fa('0x52')]=_['merge'](_0x1d4611[_0xd8fa('0x52')],{'$or':_['map'](_0x1d4611['attributes'],function(_0x476f3f){var _0x4ef72a={};_0x4ef72a[_0x476f3f]={'$like':'%'+_0x2a233e[_0xd8fa('0x48')][_0xd8fa('0x54')]+'%'};return _0x4ef72a;})});}_0x1d4611=_['merge']({},_0x1d4611,_0x2a233e[_0xd8fa('0x56')]);return _0x1495fe[_0xd8fa('0x136')](_0x1d4611);}})[_0xd8fa('0x21')](function(_0x1a0d7c){if(_0x1a0d7c){_0x3b83b3=_0x1a0d7c['length'];if(!_0x2a233e[_0xd8fa('0x48')]['hasOwnProperty']('nolimit')){_0x1d4611[_0xd8fa('0x2f')]=qs['limit'](_0x2a233e['query'][_0xd8fa('0x2f')]);_0x1d4611[_0xd8fa('0x2d')]=qs[_0xd8fa('0x2d')](_0x2a233e[_0xd8fa('0x48')][_0xd8fa('0x2d')]);}return _0x1495fe[_0xd8fa('0x136')](_0x1d4611);}})[_0xd8fa('0x21')](function(_0x4c1050){if(_0x4c1050){return _0x4c1050?{'count':_0x3b83b3,'rows':_0x4c1050}:null;}})[_0xd8fa('0x21')](respondWithResult(_0x4ea552,null))['catch'](handleError(_0x4ea552,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9a1ad36..9d9d767 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc992=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite'];(function(_0xf3af93,_0x40fcb6){var _0x19a5b9=function(_0x46d597){while(--_0x46d597){_0xf3af93['push'](_0xf3af93['shift']());}};_0x19a5b9(++_0x40fcb6);}(_0xc992,0xbb));var _0x2c99=function(_0x384411,_0x5d9014){_0x384411=_0x384411-0x0;var _0x3c0380=_0xc992[_0x384411];return _0x3c0380;};'use strict';var EventEmitter=require(_0x2c99('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x2c99('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2c99('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c99('0x3'),'afterDestroy':_0x2c99('0x4')};function emitEvent(_0x36c8ed){return function(_0x50de49,_0x2b4abc,_0x5ede91){ChatWebsiteEvents[_0x2c99('0x5')](_0x36c8ed+':'+_0x50de49['id'],_0x50de49);ChatWebsiteEvents[_0x2c99('0x5')](_0x36c8ed,_0x50de49);_0x5ede91(null);};}for(var e in events){if(events[_0x2c99('0x6')](e)){var event=events[e];ChatWebsite[_0x2c99('0x7')](e,emitEvent(event));}}module[_0x2c99('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7fa9=['setMaxListeners','save','update','remove','hook','exports','events','ChatWebsite'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0x7fa9,0x76));var _0x97fa=function(_0x1c33d4,_0x16f3ec){_0x1c33d4=_0x1c33d4-0x0;var _0x38a53b=_0x7fa9[_0x1c33d4];return _0x38a53b;};'use strict';var EventEmitter=require(_0x97fa('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x97fa('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x97fa('0x2')](0x0);var events={'afterCreate':_0x97fa('0x3'),'afterUpdate':_0x97fa('0x4'),'afterDestroy':_0x97fa('0x5')};function emitEvent(_0x1dd8d0){return function(_0x10b141,_0x490b89,_0x6659a2){ChatWebsiteEvents['emit'](_0x1dd8d0+':'+_0x10b141['id'],_0x10b141);ChatWebsiteEvents['emit'](_0x1dd8d0,_0x10b141);_0x6659a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x97fa('0x6')](e,emitEvent(event));}}module[_0x97fa('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 90e6e4b..e403f84 100644 --- a/server/api/chatWebsite/chatWebsite.model.js +++ b/server/api/chatWebsite/chatWebsite.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger'];(function(_0xf48d27,_0xc761af){var _0x172722=function(_0x4722d1){while(--_0x4722d1){_0xf48d27['push'](_0xf48d27['shift']());}};_0x172722(++_0xc761af);}(_0x0427,0x137));var _0x7042=function(_0x1d5b68,_0x5540ba){_0x1d5b68=_0x1d5b68-0x0;var _0x2501c9=_0x0427[_0x1d5b68];return _0x2501c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffd=['ChatWebsite','chat_websites','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','define'];(function(_0x293a6b,_0x3b9ede){var _0x2d371c=function(_0x2b115a){while(--_0x2b115a){_0x293a6b['push'](_0x293a6b['shift']());}};_0x2d371c(++_0x3b9ede);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x463b37,_0x23ba6e){_0x463b37=_0x463b37-0x0;var _0x2d801b=_0x9ffd[_0x463b37];return _0x2d801b;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 9a0ef27..8f844d5 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xadb5,0xad));var _0x5adb=function(_0x733d6b,_0x5c9f21){_0x733d6b=_0x733d6b-0x0;var _0x2b0b7d=_0xadb5[_0x733d6b];return _0x2b0b7d;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});} \ No newline at end of file +var _0x1261=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util'];(function(_0x452890,_0xcd738e){var _0x3403b9=function(_0x259bb0){while(--_0x259bb0){_0x452890['push'](_0x452890['shift']());}};_0x3403b9(++_0xcd738e);}(_0x1261,0x144));var _0x1126=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x1261[_0x36f243];return _0x426436;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 3f70f0f..a27f40d 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x214023,_0x65e22b){var _0x10cf15=function(_0x3a05df){while(--_0x3a05df){_0x214023['push'](_0x214023['shift']());}};_0x10cf15(++_0x65e22b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x350f77,_0x12a9b8){_0x350f77=_0x350f77-0x0;var _0x1305b6=_0x5f2f[_0x350f77];return _0x1305b6;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x5528bc,_0x3fbeca){var _0x592eea=function(_0x3a2801){while(--_0x3a2801){_0x5528bc['push'](_0x5528bc['shift']());}};_0x592eea(++_0x3fbeca);}(_0x5f2f,0x73));var _0xf5f2=function(_0x113d58,_0x426c6c){_0x113d58=_0x113d58-0x0;var _0x135d6e=_0x5f2f[_0x113d58];return _0x135d6e;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c69f3a2..eaee673 100644 --- a/server/api/chatWebsite/index.js +++ b/server/api/chatWebsite/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b5c=['now','originalname','post','single','file','addLogo','root','server/files/images/avatars/','addAvatar','%s-%s','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addProactiveActions','/:id/users','addAgents','put','update','delete','/:id','destroy','/:id/dispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format'];(function(_0x27221f,_0x3f0125){var _0x1946d4=function(_0x2c7b20){while(--_0x2c7b20){_0x27221f['push'](_0x27221f['shift']());}};_0x1946d4(++_0x3f0125);}(_0x9b5c,0xb8));var _0xc9b5=function(_0x401821,_0x34e8c4){_0x401821=_0x401821-0x0;var _0x22c1eb=_0x9b5c[_0x401821];return _0x22c1eb;};'use strict';var multer=require(_0xc9b5('0x0'));var util=require(_0xc9b5('0x1'));var path=require('path');var timeout=require(_0xc9b5('0x2'));var express=require(_0xc9b5('0x3'));var router=express[_0xc9b5('0x4')]();var fs_extra=require(_0xc9b5('0x5'));var auth=require(_0xc9b5('0x6'));var interaction=require(_0xc9b5('0x7'));var config=require(_0xc9b5('0x8'));var controller=require(_0xc9b5('0x9'));router[_0xc9b5('0xa')]('/',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0xc')]);router[_0xc9b5('0xa')](_0xc9b5('0xd'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0xe')]);router['get']('/:id',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0xf')]);router[_0xc9b5('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc9b5('0x10')]);router[_0xc9b5('0xa')](_0xc9b5('0x11'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x12')]);router[_0xc9b5('0xa')](_0xc9b5('0x13'),controller[_0xc9b5('0x14')]);router[_0xc9b5('0xa')](_0xc9b5('0x15'),controller[_0xc9b5('0x16')]);router[_0xc9b5('0xa')]('/:id/customer_avatar',controller[_0xc9b5('0x17')]);router['get'](_0xc9b5('0x18'),controller[_0xc9b5('0x19')]);router['get'](_0xc9b5('0x1a'),auth['isAuthenticated'](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0xc9b5('0x1b')]);router[_0xc9b5('0xa')](_0xc9b5('0x1c'),auth[_0xc9b5('0xb')](),controller['getApplications']);router[_0xc9b5('0xa')](_0xc9b5('0x1d'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x1e')]);router[_0xc9b5('0xa')](_0xc9b5('0x1f'),controller[_0xc9b5('0x20')]);router[_0xc9b5('0xa')](_0xc9b5('0x21'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xc9b5('0xa')]('/:id/users',auth[_0xc9b5('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xc9b5('0x22')]);router['post']('/:id/dispositions',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x23')]);router['post'](_0xc9b5('0x11'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x24')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0xf8b7f5,_0x4c3cd5,_0xb891da){_0xb891da(null,path[_0xc9b5('0x26')](config['root'],_0xc9b5('0x27')));},'filename':function(_0x37a1a7,_0x32bc73,_0x200429){_0x200429(null,util[_0xc9b5('0x28')]('%s-%s',Date[_0xc9b5('0x29')](),_0x32bc73[_0xc9b5('0x2a')]));}})});router[_0xc9b5('0x2b')]('/:id/logo',upload[_0xc9b5('0x2c')](_0xc9b5('0x2d')),controller[_0xc9b5('0x2e')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0x5ae300,_0x53ed1c,_0x166184){_0x166184(null,path[_0xc9b5('0x26')](config[_0xc9b5('0x2f')],_0xc9b5('0x30')));},'filename':function(_0x33b058,_0x35a107,_0xdac692){_0xdac692(null,util[_0xc9b5('0x28')]('%s-%s',Date['now'](),_0x35a107[_0xc9b5('0x2a')]));}})});router['post'](_0xc9b5('0x15'),upload[_0xc9b5('0x2c')](_0xc9b5('0x2d')),controller[_0xc9b5('0x31')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0x131984,_0x5e2cf2,_0x1d079d){_0x1d079d(null,path[_0xc9b5('0x26')](config[_0xc9b5('0x2f')],_0xc9b5('0x30')));},'filename':function(_0x14071f,_0x4c0edb,_0x343b58){_0x343b58(null,util['format'](_0xc9b5('0x32'),Date[_0xc9b5('0x29')](),_0x4c0edb[_0xc9b5('0x2a')]));}})});router['post'](_0xc9b5('0x33'),upload['single']('file'),controller[_0xc9b5('0x34')]);var upload=multer({'storage':multer[_0xc9b5('0x25')]({'destination':function(_0x5b4c58,_0x39993d,_0x400bea){_0x400bea(null,path[_0xc9b5('0x26')](config[_0xc9b5('0x2f')],_0xc9b5('0x30')));},'filename':function(_0x5416fa,_0x32710e,_0x4abc64){_0x4abc64(null,util['format'](_0xc9b5('0x32'),Date[_0xc9b5('0x29')](),_0x32710e['originalname']));}})});router['post'](_0xc9b5('0x18'),upload[_0xc9b5('0x2c')](_0xc9b5('0x2d')),controller[_0xc9b5('0x35')]);router[_0xc9b5('0x2b')](_0xc9b5('0x36'),controller[_0xc9b5('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x4b3d9c,_0x4259a1,_0x248499){const _0x1b9e66=path['join'](config[_0xc9b5('0x2f')],'server/files','attachments',_0xc9b5('0x38'));fs_extra[_0xc9b5('0x39')](_0x1b9e66,function(){_0x248499(null,_0x1b9e66);});},'filename':function(_0x4a17b5,_0x419f9e,_0x4fa7ca){const _0x119955=_0x419f9e[_0xc9b5('0x2a')][_0xc9b5('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4aeeb2=path[_0xc9b5('0x3b')](_0x119955);const _0x27cb5a=Date[_0xc9b5('0x29')]()+'-'+_0x119955[_0xc9b5('0x3a')](_0x4aeeb2,'')+_0x4aeeb2;_0x4fa7ca(null,_0x27cb5a);}})});router['post'](_0xc9b5('0x3c'),offlineUploadMulter[_0xc9b5('0x3d')](),controller[_0xc9b5('0x3e')]);router[_0xc9b5('0x2b')](_0xc9b5('0x1a'),auth[_0xc9b5('0xb')](),controller['addInteraction']);router['post'](_0xc9b5('0x1c'),auth[_0xc9b5('0xb')](),controller['addApplications']);router[_0xc9b5('0x2b')](_0xc9b5('0x1d'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x3f')]);router['post'](_0xc9b5('0x40'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x41')]);router[_0xc9b5('0x42')]('/:id',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x43')]);router[_0xc9b5('0x44')](_0xc9b5('0x45'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x46')]);router[_0xc9b5('0x44')](_0xc9b5('0x47'),auth[_0xc9b5('0xb')](),controller['removeDispositions']);router[_0xc9b5('0x44')]('/:id/canned_answers',auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x48')]);router[_0xc9b5('0x44')](_0xc9b5('0x40'),auth[_0xc9b5('0xb')](),controller[_0xc9b5('0x49')]);module[_0xc9b5('0x4a')]=router; \ No newline at end of file +var _0xbcb0=['/:id/applications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','join','root','format','%s-%s','now','originalname','single','addLogo','diskStorage','server/files/images/avatars/','file','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','/:id/interactions','addInteraction','/:id','update','delete','destroy','removeAnswers','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet'];(function(_0x1b8524,_0x1bb669){var _0x81418d=function(_0x5f5795){while(--_0x5f5795){_0x1b8524['push'](_0x1b8524['shift']());}};_0x81418d(++_0x1bb669);}(_0xbcb0,0xa9));var _0x0bcb=function(_0x30e162,_0x3522f4){_0x30e162=_0x30e162-0x0;var _0x5965be=_0xbcb0[_0x30e162];return _0x5965be;};'use strict';var multer=require(_0x0bcb('0x0'));var util=require(_0x0bcb('0x1'));var path=require(_0x0bcb('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bcb('0x3'));var router=express[_0x0bcb('0x4')]();var fs_extra=require(_0x0bcb('0x5'));var auth=require(_0x0bcb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x0bcb('0x7')]('/',auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x9')]);router[_0x0bcb('0x7')]('/describe',auth[_0x0bcb('0x8')](),controller[_0x0bcb('0xa')]);router[_0x0bcb('0x7')]('/:id',auth[_0x0bcb('0x8')](),controller['show']);router[_0x0bcb('0x7')](_0x0bcb('0xb'),auth['isAuthenticated'](),controller[_0x0bcb('0xc')]);router[_0x0bcb('0x7')](_0x0bcb('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x0bcb('0x7')](_0x0bcb('0xe'),controller[_0x0bcb('0xf')]);router['get'](_0x0bcb('0x10'),controller[_0x0bcb('0x11')]);router[_0x0bcb('0x7')](_0x0bcb('0x12'),controller[_0x0bcb('0x13')]);router[_0x0bcb('0x7')]('/:id/system_avatar',controller[_0x0bcb('0x14')]);router[_0x0bcb('0x7')]('/:id/interactions',auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x15')]);router[_0x0bcb('0x7')](_0x0bcb('0x16'),controller['getSnippet']);router['get'](_0x0bcb('0x17'),auth[_0x0bcb('0x8')](),controller['getApplications']);router[_0x0bcb('0x7')](_0x0bcb('0x18'),auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x19')]);router['get']('/:id/fields',controller[_0x0bcb('0x1a')]);router[_0x0bcb('0x7')](_0x0bcb('0x1b'),auth['isAuthenticated'](),controller[_0x0bcb('0x1c')]);router[_0x0bcb('0x7')](_0x0bcb('0x1d'),auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x1e')]);router[_0x0bcb('0x1f')]('/',auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x20')]);router[_0x0bcb('0x1f')](_0x0bcb('0xb'),auth[_0x0bcb('0x8')](),controller['addDisposition']);router[_0x0bcb('0x1f')](_0x0bcb('0xd'),auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ff7ca,_0x308edd,_0x176a70){_0x176a70(null,path[_0x0bcb('0x22')](config[_0x0bcb('0x23')],'server/files/images/logos/'));},'filename':function(_0x4382fc,_0x201591,_0x49f54c){_0x49f54c(null,util[_0x0bcb('0x24')](_0x0bcb('0x25'),Date[_0x0bcb('0x26')](),_0x201591[_0x0bcb('0x27')]));}})});router[_0x0bcb('0x1f')]('/:id/logo',upload[_0x0bcb('0x28')]('file'),controller[_0x0bcb('0x29')]);var upload=multer({'storage':multer[_0x0bcb('0x2a')]({'destination':function(_0x407db2,_0x16e7d3,_0x2fc38b){_0x2fc38b(null,path[_0x0bcb('0x22')](config['root'],_0x0bcb('0x2b')));},'filename':function(_0x3d916f,_0x336fc5,_0x397f9f){_0x397f9f(null,util[_0x0bcb('0x24')](_0x0bcb('0x25'),Date[_0x0bcb('0x26')](),_0x336fc5['originalname']));}})});router[_0x0bcb('0x1f')](_0x0bcb('0x10'),upload[_0x0bcb('0x28')](_0x0bcb('0x2c')),controller[_0x0bcb('0x2d')]);var upload=multer({'storage':multer[_0x0bcb('0x2a')]({'destination':function(_0x5046f8,_0x4e7313,_0x5edff2){_0x5edff2(null,path[_0x0bcb('0x22')](config['root'],_0x0bcb('0x2b')));},'filename':function(_0x4de536,_0x24fc4b,_0x10b7ec){_0x10b7ec(null,util['format'](_0x0bcb('0x25'),Date['now'](),_0x24fc4b[_0x0bcb('0x27')]));}})});router[_0x0bcb('0x1f')](_0x0bcb('0x12'),upload[_0x0bcb('0x28')]('file'),controller[_0x0bcb('0x2e')]);var upload=multer({'storage':multer[_0x0bcb('0x2a')]({'destination':function(_0x4312cc,_0x3239d9,_0x10ab9a){_0x10ab9a(null,path[_0x0bcb('0x22')](config[_0x0bcb('0x23')],_0x0bcb('0x2b')));},'filename':function(_0x469505,_0x381f67,_0x5f5595){_0x5f5595(null,util['format'](_0x0bcb('0x25'),Date[_0x0bcb('0x26')](),_0x381f67[_0x0bcb('0x27')]));}})});router[_0x0bcb('0x1f')]('/:id/system_avatar',upload['single']('file'),controller[_0x0bcb('0x2f')]);router[_0x0bcb('0x1f')](_0x0bcb('0x30'),controller[_0x0bcb('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x0bcb('0x2a')]({'destination':function(_0x44d903,_0x37a0a2,_0x192d8b){const _0x32ff41=path[_0x0bcb('0x22')](config[_0x0bcb('0x23')],_0x0bcb('0x32'),_0x0bcb('0x33'),_0x0bcb('0x34'));fs_extra[_0x0bcb('0x35')](_0x32ff41,function(){_0x192d8b(null,_0x32ff41);});},'filename':function(_0x2ead6d,_0x258e9a,_0x57adbf){const _0x2e1dc9=_0x258e9a[_0x0bcb('0x27')][_0x0bcb('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5b89ba=path[_0x0bcb('0x37')](_0x2e1dc9);const _0x2b0f81=Date[_0x0bcb('0x26')]()+'-'+_0x2e1dc9[_0x0bcb('0x36')](_0x5b89ba,'')+_0x5b89ba;_0x57adbf(null,_0x2b0f81);}})});router[_0x0bcb('0x1f')](_0x0bcb('0x38'),offlineUploadMulter['any'](),controller['offline']);router[_0x0bcb('0x1f')](_0x0bcb('0x39'),auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x3a')]);router[_0x0bcb('0x1f')](_0x0bcb('0x17'),auth[_0x0bcb('0x8')](),controller['addApplications']);router[_0x0bcb('0x1f')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x0bcb('0x1f')](_0x0bcb('0x1d'),auth[_0x0bcb('0x8')](),controller['addAgents']);router['put'](_0x0bcb('0x3b'),auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x3c')]);router[_0x0bcb('0x3d')](_0x0bcb('0x3b'),auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x3e')]);router['delete'](_0x0bcb('0xb'),auth[_0x0bcb('0x8')](),controller['removeDispositions']);router[_0x0bcb('0x3d')]('/:id/canned_answers',auth[_0x0bcb('0x8')](),controller[_0x0bcb('0x3f')]);router[_0x0bcb('0x3d')](_0x0bcb('0x1d'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 388a61b..96566d0 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x5c8d8b,_0x299310){var _0x360828=function(_0x3d734d){while(--_0x3d734d){_0x5c8d8b['push'](_0x5c8d8b['shift']());}};_0x360828(++_0x299310);}(_0x53ec,0x192));var _0xc53e=function(_0x5f1de4,_0x47c201){_0x5f1de4=_0x5f1de4-0x0;var _0x1aeaf0=_0x53ec[_0x5f1de4];return _0x1aeaf0;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc53e('0x3')](_0xc53e('0x4'),_0xc53e('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc53e('0x2')]}}; \ No newline at end of file +var _0x0cfe=['sequelize','STRING','ENUM','AmazonAWS'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x50d10d,_0x497f05){_0x50d10d=_0x50d10d-0x0;var _0xac3241=_0x0cfe[_0x50d10d];return _0xac3241;};'use strict';var Sequelize=require(_0xe0cf('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0cf('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe0cf('0x2')](_0xe0cf('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe0cf('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 13e1d61..3dcffc2 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4147=['contact','message','agent','interaction','account','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','CloudProvider','include','findAll','rows','catch','show','params','keys','includeAll','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','error','name','send','merge'];(function(_0x41b66f,_0x199fd0){var _0x1b46dd=function(_0x690c4a){while(--_0x690c4a){_0x41b66f['push'](_0x41b66f['shift']());}};_0x1b46dd(++_0x199fd0);}(_0x4147,0x1a7));var _0x7414=function(_0x21352b,_0x499500){_0x21352b=_0x21352b-0x0;var _0x2073be=_0x4147[_0x21352b];return _0x2073be;};'use strict';var emlformat=require(_0x7414('0x0'));var rimraf=require(_0x7414('0x1'));var zipdir=require(_0x7414('0x2'));var jsonpatch=require(_0x7414('0x3'));var rp=require('request-promise');var moment=require(_0x7414('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7414('0x5'));var util=require('util');var path=require(_0x7414('0x6'));var sox=require(_0x7414('0x7'));var csv=require('to-csv');var ejs=require(_0x7414('0x8'));var fs=require('fs');var fs_extra=require(_0x7414('0x9'));var _=require('lodash');var squel=require(_0x7414('0xa'));var crypto=require(_0x7414('0xb'));var jsforce=require(_0x7414('0xc'));var deskjs=require(_0x7414('0xd'));var toCsv=require(_0x7414('0xe'));var querystring=require(_0x7414('0xf'));var Papa=require(_0x7414('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7414('0x11'));var as=require(_0x7414('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7414('0x13'))('api');var utils=require(_0x7414('0x14'));var config=require(_0x7414('0x15'));var licenseUtil=require(_0x7414('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36d9fe,_0x43a4a0){_0x43a4a0=_0x43a4a0||0xcc;return function(_0x445795){if(_0x445795){return _0x36d9fe[_0x7414('0x17')](_0x43a4a0);}return _0x36d9fe[_0x7414('0x18')](_0x43a4a0)[_0x7414('0x19')]();};}function respondWithResult(_0x30f8a4,_0x2edfa9){_0x2edfa9=_0x2edfa9||0xc8;return function(_0x58b964){if(_0x58b964){return _0x30f8a4[_0x7414('0x18')](_0x2edfa9)[_0x7414('0x1a')](_0x58b964);}};}function respondWithFilteredResult(_0x3fbbff,_0x8f561b){return function(_0x12dbc2){if(_0x12dbc2){var _0x63b4fe=typeof _0x8f561b[_0x7414('0x1b')]===_0x7414('0x1c')&&typeof _0x8f561b[_0x7414('0x1d')]==='undefined';var _0x34d66f=_0x12dbc2[_0x7414('0x1e')];var _0x431896=_0x63b4fe?0x0:_0x8f561b[_0x7414('0x1b')];var _0x1af1af=_0x63b4fe?_0x12dbc2[_0x7414('0x1e')]:_0x8f561b['offset']+_0x8f561b[_0x7414('0x1d')];var _0x2fc0bc;if(_0x1af1af>=_0x34d66f){_0x1af1af=_0x34d66f;_0x2fc0bc=0xc8;}else{_0x2fc0bc=0xce;}_0x3fbbff[_0x7414('0x18')](_0x2fc0bc);return _0x3fbbff['set'](_0x7414('0x1f'),_0x431896+'-'+_0x1af1af+'/'+_0x34d66f)['json'](_0x12dbc2);}return null;};}function patchUpdates(_0x128be6){return function(_0x242cf6){try{jsonpatch['apply'](_0x242cf6,_0x128be6,!![]);}catch(_0x328a14){return BPromise[_0x7414('0x20')](_0x328a14);}return _0x242cf6['save']();};}function saveUpdates(_0x3fa751,_0x4c976e){return function(_0x4628ab){if(_0x4628ab){return _0x4628ab[_0x7414('0x21')](_0x3fa751)[_0x7414('0x22')](function(_0x117524){return _0x117524;});}return null;};}function removeEntity(_0x166e1f,_0x40473f){return function(_0x38ca14){if(_0x38ca14){return _0x38ca14['destroy']()[_0x7414('0x22')](function(){_0x166e1f[_0x7414('0x18')](0xcc)[_0x7414('0x19')]();});}};}function handleEntityNotFound(_0xb79a39,_0x3da60c){return function(_0xcfcc0b){if(!_0xcfcc0b){_0xb79a39[_0x7414('0x17')](0x194);}return _0xcfcc0b;};}function handleError(_0x24170d,_0x1f98e0){_0x1f98e0=_0x1f98e0||0x1f4;return function(_0x1185a3){logger[_0x7414('0x23')](_0x1185a3['stack']);if(_0x1185a3[_0x7414('0x24')]){delete _0x1185a3['name'];}_0x24170d[_0x7414('0x18')](_0x1f98e0)[_0x7414('0x25')](_0x1185a3);};}function getMustacheRender(_0x2d44f6,_0x2d699e){return Mustache['render'](_0x2d44f6,_[_0x7414('0x26')](_0x2d699e['body'],{'contact':_0x2d699e[_0x7414('0x27')],'message':_0x2d699e[_0x7414('0x28')],'agent':_0x2d699e[_0x7414('0x29')],'interaction':_0x2d699e[_0x7414('0x2a')],'account':_0x2d699e[_0x7414('0x2b')]}))||'';}exports['index']=function(_0x400feb,_0x3f1e73){var _0x28353c={},_0x386472={},_0x273347={'count':0x0,'rows':[]};var _0x48a892=_[_0x7414('0x2c')](db['CloudProvider'][_0x7414('0x2d')],function(_0x3f358c){return{'name':_0x3f358c[_0x7414('0x2e')],'type':_0x3f358c[_0x7414('0x2f')][_0x7414('0x30')]};});_0x386472[_0x7414('0x31')]=_[_0x7414('0x2c')](_0x48a892,_0x7414('0x24'));_0x386472[_0x7414('0x32')]=_['keys'](_0x400feb[_0x7414('0x32')]);_0x386472['filters']=_[_0x7414('0x33')](_0x386472['model'],_0x386472[_0x7414('0x32')]);_0x28353c['attributes']=_[_0x7414('0x33')](_0x386472[_0x7414('0x31')],qs[_0x7414('0x34')](_0x400feb[_0x7414('0x32')][_0x7414('0x34')]));_0x28353c['attributes']=_0x28353c[_0x7414('0x35')][_0x7414('0x36')]?_0x28353c[_0x7414('0x35')]:_0x386472['model'];if(!_0x400feb[_0x7414('0x32')][_0x7414('0x37')](_0x7414('0x38'))){_0x28353c['limit']=qs[_0x7414('0x1d')](_0x400feb[_0x7414('0x32')][_0x7414('0x1d')]);_0x28353c[_0x7414('0x1b')]=qs['offset'](_0x400feb[_0x7414('0x32')][_0x7414('0x1b')]);}_0x28353c[_0x7414('0x39')]=qs[_0x7414('0x3a')](_0x400feb[_0x7414('0x32')][_0x7414('0x3a')]);_0x28353c['where']=qs[_0x7414('0x3b')](_[_0x7414('0x3c')](_0x400feb[_0x7414('0x32')],_0x386472[_0x7414('0x3b')]),_0x48a892);if(_0x400feb[_0x7414('0x32')][_0x7414('0x3d')]){_0x28353c[_0x7414('0x3e')]=_['merge'](_0x28353c['where'],{'$or':_[_0x7414('0x2c')](_0x48a892,function(_0x1b5f3f){if(_0x1b5f3f[_0x7414('0x2f')]!==_0x7414('0x3f')){var _0x3a4297={};_0x3a4297[_0x1b5f3f['name']]={'$like':'%'+_0x400feb[_0x7414('0x32')][_0x7414('0x3d')]+'%'};return _0x3a4297;}})});}_0x28353c=_['merge']({},_0x28353c,_0x400feb[_0x7414('0x40')]);var _0x3bba74={'where':_0x28353c['where']};return db[_0x7414('0x41')][_0x7414('0x1e')](_0x3bba74)[_0x7414('0x22')](function(_0x3ad9d6){_0x273347[_0x7414('0x1e')]=_0x3ad9d6;if(_0x400feb[_0x7414('0x32')]['includeAll']){_0x28353c[_0x7414('0x42')]=[{'all':!![]}];}return db[_0x7414('0x41')][_0x7414('0x43')](_0x28353c);})[_0x7414('0x22')](function(_0x1c84fe){_0x273347[_0x7414('0x44')]=_0x1c84fe;return _0x273347;})[_0x7414('0x22')](respondWithFilteredResult(_0x3f1e73,_0x28353c))[_0x7414('0x45')](handleError(_0x3f1e73,null));};exports[_0x7414('0x46')]=function(_0x37e293,_0x4757c0){var _0x11167e={'raw':!![],'where':{'id':_0x37e293[_0x7414('0x47')]['id']}},_0x2e9d4e={};_0x2e9d4e[_0x7414('0x31')]=_['keys'](db[_0x7414('0x41')][_0x7414('0x2d')]);_0x2e9d4e['query']=_[_0x7414('0x48')](_0x37e293[_0x7414('0x32')]);_0x2e9d4e[_0x7414('0x3b')]=_[_0x7414('0x33')](_0x2e9d4e['model'],_0x2e9d4e[_0x7414('0x32')]);_0x11167e[_0x7414('0x35')]=_[_0x7414('0x33')](_0x2e9d4e[_0x7414('0x31')],qs[_0x7414('0x34')](_0x37e293[_0x7414('0x32')][_0x7414('0x34')]));_0x11167e[_0x7414('0x35')]=_0x11167e[_0x7414('0x35')]['length']?_0x11167e[_0x7414('0x35')]:_0x2e9d4e[_0x7414('0x31')];if(_0x37e293[_0x7414('0x32')][_0x7414('0x49')]){_0x11167e['include']=[{'all':!![]}];}_0x11167e=_[_0x7414('0x26')]({},_0x11167e,_0x37e293['options']);return db[_0x7414('0x41')]['find'](_0x11167e)[_0x7414('0x22')](handleEntityNotFound(_0x4757c0,null))['then'](respondWithResult(_0x4757c0,null))[_0x7414('0x45')](handleError(_0x4757c0,null));};exports['create']=function(_0x371c66,_0x4b78e1){return db[_0x7414('0x41')]['create'](_0x371c66[_0x7414('0x4a')],{})['then'](respondWithResult(_0x4b78e1,0xc9))[_0x7414('0x45')](handleError(_0x4b78e1,null));};exports['update']=function(_0xe9045c,_0xf79684){if(_0xe9045c[_0x7414('0x4a')]['id']){delete _0xe9045c['body']['id'];}return db[_0x7414('0x41')]['find']({'where':{'id':_0xe9045c[_0x7414('0x47')]['id']}})[_0x7414('0x22')](handleEntityNotFound(_0xf79684,null))['then'](saveUpdates(_0xe9045c[_0x7414('0x4a')],null))[_0x7414('0x22')](respondWithResult(_0xf79684,null))[_0x7414('0x45')](handleError(_0xf79684,null));};exports[_0x7414('0x4b')]=function(_0x5043c6,_0x3664a6){return db[_0x7414('0x41')][_0x7414('0x4c')]({'where':{'id':_0x5043c6[_0x7414('0x47')]['id']}})[_0x7414('0x22')](handleEntityNotFound(_0x3664a6,null))[_0x7414('0x22')](removeEntity(_0x3664a6,null))['catch'](handleError(_0x3664a6,null));}; \ No newline at end of file +var _0x693e=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','interaction','index','map','CloudProvider','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','length','options','create','catch','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x2e6a7d,_0x51bcfa){var _0x8625be=function(_0x3e0ad5){while(--_0x3e0ad5){_0x2e6a7d['push'](_0x2e6a7d['shift']());}};_0x8625be(++_0x51bcfa);}(_0x693e,0xe6));var _0xe693=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x693e[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xe693('0x0'));var rimraf=require(_0xe693('0x1'));var zipdir=require(_0xe693('0x2'));var jsonpatch=require(_0xe693('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe693('0x4'));var Mustache=require(_0xe693('0x5'));var util=require(_0xe693('0x6'));var path=require(_0xe693('0x7'));var sox=require(_0xe693('0x8'));var csv=require('to-csv');var ejs=require(_0xe693('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe693('0xa'));var squel=require(_0xe693('0xb'));var crypto=require(_0xe693('0xc'));var jsforce=require(_0xe693('0xd'));var deskjs=require(_0xe693('0xe'));var toCsv=require(_0xe693('0xf'));var querystring=require(_0xe693('0x10'));var Papa=require(_0xe693('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe693('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe693('0x13'));var utils=require(_0xe693('0x14'));var config=require(_0xe693('0x15'));var licenseUtil=require(_0xe693('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x365a09,_0x4fa949){_0x4fa949=_0x4fa949||0xcc;return function(_0x5476b5){if(_0x5476b5){return _0x365a09[_0xe693('0x17')](_0x4fa949);}return _0x365a09[_0xe693('0x18')](_0x4fa949)[_0xe693('0x19')]();};}function respondWithResult(_0xedb362,_0x98faea){_0x98faea=_0x98faea||0xc8;return function(_0x599d8a){if(_0x599d8a){return _0xedb362['status'](_0x98faea)[_0xe693('0x1a')](_0x599d8a);}};}function respondWithFilteredResult(_0x37fa44,_0x2c6ae6){return function(_0x2218fc){if(_0x2218fc){var _0x35af0b=typeof _0x2c6ae6[_0xe693('0x1b')]===_0xe693('0x1c')&&typeof _0x2c6ae6['limit']===_0xe693('0x1c');var _0x5b4050=_0x2218fc[_0xe693('0x1d')];var _0x5e255c=_0x35af0b?0x0:_0x2c6ae6['offset'];var _0x266d6d=_0x35af0b?_0x2218fc[_0xe693('0x1d')]:_0x2c6ae6['offset']+_0x2c6ae6['limit'];var _0x21dc66;if(_0x266d6d>=_0x5b4050){_0x266d6d=_0x5b4050;_0x21dc66=0xc8;}else{_0x21dc66=0xce;}_0x37fa44[_0xe693('0x18')](_0x21dc66);return _0x37fa44[_0xe693('0x1e')](_0xe693('0x1f'),_0x5e255c+'-'+_0x266d6d+'/'+_0x5b4050)[_0xe693('0x1a')](_0x2218fc);}return null;};}function patchUpdates(_0x38bfd8){return function(_0x56acdf){try{jsonpatch[_0xe693('0x20')](_0x56acdf,_0x38bfd8,!![]);}catch(_0x1c9997){return BPromise[_0xe693('0x21')](_0x1c9997);}return _0x56acdf[_0xe693('0x22')]();};}function saveUpdates(_0x351ce3,_0x123cb4){return function(_0x5dc07b){if(_0x5dc07b){return _0x5dc07b[_0xe693('0x23')](_0x351ce3)[_0xe693('0x24')](function(_0x16ce17){return _0x16ce17;});}return null;};}function removeEntity(_0x2b010e,_0x5d8d00){return function(_0x237bdc){if(_0x237bdc){return _0x237bdc[_0xe693('0x25')]()[_0xe693('0x24')](function(){_0x2b010e[_0xe693('0x18')](0xcc)[_0xe693('0x19')]();});}};}function handleEntityNotFound(_0x382309,_0xd9a079){return function(_0x247b0c){if(!_0x247b0c){_0x382309[_0xe693('0x17')](0x194);}return _0x247b0c;};}function handleError(_0x7988ce,_0xac267d){_0xac267d=_0xac267d||0x1f4;return function(_0x792928){logger[_0xe693('0x26')](_0x792928[_0xe693('0x27')]);if(_0x792928[_0xe693('0x28')]){delete _0x792928['name'];}_0x7988ce[_0xe693('0x18')](_0xac267d)[_0xe693('0x29')](_0x792928);};}function getMustacheRender(_0x4ae858,_0x3cc978){return Mustache[_0xe693('0x2a')](_0x4ae858,_[_0xe693('0x2b')](_0x3cc978[_0xe693('0x2c')],{'contact':_0x3cc978[_0xe693('0x2d')],'message':_0x3cc978[_0xe693('0x2e')],'agent':_0x3cc978[_0xe693('0x2f')],'interaction':_0x3cc978[_0xe693('0x30')],'account':_0x3cc978['account']}))||'';}exports[_0xe693('0x31')]=function(_0x176504,_0x1ab712){var _0x2bf359={},_0x1be880={},_0x21fdfe={'count':0x0,'rows':[]};var _0x1ba3d6=_[_0xe693('0x32')](db[_0xe693('0x33')][_0xe693('0x34')],function(_0xa88b91){return{'name':_0xa88b91[_0xe693('0x35')],'type':_0xa88b91['type'][_0xe693('0x36')]};});_0x1be880['model']=_['map'](_0x1ba3d6,'name');_0x1be880[_0xe693('0x37')]=_[_0xe693('0x38')](_0x176504[_0xe693('0x37')]);_0x1be880[_0xe693('0x39')]=_[_0xe693('0x3a')](_0x1be880[_0xe693('0x3b')],_0x1be880[_0xe693('0x37')]);_0x2bf359['attributes']=_[_0xe693('0x3a')](_0x1be880[_0xe693('0x3b')],qs[_0xe693('0x3c')](_0x176504[_0xe693('0x37')][_0xe693('0x3c')]));_0x2bf359[_0xe693('0x3d')]=_0x2bf359[_0xe693('0x3d')]['length']?_0x2bf359['attributes']:_0x1be880[_0xe693('0x3b')];if(!_0x176504[_0xe693('0x37')][_0xe693('0x3e')](_0xe693('0x3f'))){_0x2bf359[_0xe693('0x40')]=qs[_0xe693('0x40')](_0x176504[_0xe693('0x37')][_0xe693('0x40')]);_0x2bf359[_0xe693('0x1b')]=qs['offset'](_0x176504[_0xe693('0x37')][_0xe693('0x1b')]);}_0x2bf359[_0xe693('0x41')]=qs[_0xe693('0x42')](_0x176504[_0xe693('0x37')][_0xe693('0x42')]);_0x2bf359[_0xe693('0x43')]=qs[_0xe693('0x39')](_[_0xe693('0x44')](_0x176504[_0xe693('0x37')],_0x1be880[_0xe693('0x39')]),_0x1ba3d6);if(_0x176504['query'][_0xe693('0x45')]){_0x2bf359[_0xe693('0x43')]=_[_0xe693('0x2b')](_0x2bf359[_0xe693('0x43')],{'$or':_[_0xe693('0x32')](_0x1ba3d6,function(_0xe34174){if(_0xe34174['type']!==_0xe693('0x46')){var _0x2a1305={};_0x2a1305[_0xe34174[_0xe693('0x28')]]={'$like':'%'+_0x176504[_0xe693('0x37')]['filter']+'%'};return _0x2a1305;}})});}_0x2bf359=_['merge']({},_0x2bf359,_0x176504['options']);var _0xae52cc={'where':_0x2bf359[_0xe693('0x43')]};return db[_0xe693('0x33')][_0xe693('0x1d')](_0xae52cc)[_0xe693('0x24')](function(_0x3e7432){_0x21fdfe[_0xe693('0x1d')]=_0x3e7432;if(_0x176504[_0xe693('0x37')][_0xe693('0x47')]){_0x2bf359[_0xe693('0x48')]=[{'all':!![]}];}return db[_0xe693('0x33')][_0xe693('0x49')](_0x2bf359);})[_0xe693('0x24')](function(_0x757ef){_0x21fdfe['rows']=_0x757ef;return _0x21fdfe;})[_0xe693('0x24')](respondWithFilteredResult(_0x1ab712,_0x2bf359))['catch'](handleError(_0x1ab712,null));};exports[_0xe693('0x4a')]=function(_0xa389b9,_0x24a702){var _0x2397c1={'raw':!![],'where':{'id':_0xa389b9['params']['id']}},_0x257c15={};_0x257c15[_0xe693('0x3b')]=_[_0xe693('0x38')](db[_0xe693('0x33')][_0xe693('0x34')]);_0x257c15[_0xe693('0x37')]=_[_0xe693('0x38')](_0xa389b9[_0xe693('0x37')]);_0x257c15[_0xe693('0x39')]=_[_0xe693('0x3a')](_0x257c15[_0xe693('0x3b')],_0x257c15[_0xe693('0x37')]);_0x2397c1[_0xe693('0x3d')]=_[_0xe693('0x3a')](_0x257c15[_0xe693('0x3b')],qs[_0xe693('0x3c')](_0xa389b9['query'][_0xe693('0x3c')]));_0x2397c1['attributes']=_0x2397c1[_0xe693('0x3d')][_0xe693('0x4b')]?_0x2397c1[_0xe693('0x3d')]:_0x257c15[_0xe693('0x3b')];if(_0xa389b9[_0xe693('0x37')][_0xe693('0x47')]){_0x2397c1[_0xe693('0x48')]=[{'all':!![]}];}_0x2397c1=_[_0xe693('0x2b')]({},_0x2397c1,_0xa389b9[_0xe693('0x4c')]);return db[_0xe693('0x33')]['find'](_0x2397c1)['then'](handleEntityNotFound(_0x24a702,null))[_0xe693('0x24')](respondWithResult(_0x24a702,null))['catch'](handleError(_0x24a702,null));};exports[_0xe693('0x4d')]=function(_0x380ad5,_0x4d3172){return db[_0xe693('0x33')][_0xe693('0x4d')](_0x380ad5[_0xe693('0x2c')],{})[_0xe693('0x24')](respondWithResult(_0x4d3172,0xc9))[_0xe693('0x4e')](handleError(_0x4d3172,null));};exports[_0xe693('0x23')]=function(_0x4302d7,_0x482419){if(_0x4302d7[_0xe693('0x2c')]['id']){delete _0x4302d7[_0xe693('0x2c')]['id'];}return db[_0xe693('0x33')][_0xe693('0x4f')]({'where':{'id':_0x4302d7[_0xe693('0x50')]['id']}})[_0xe693('0x24')](handleEntityNotFound(_0x482419,null))['then'](saveUpdates(_0x4302d7[_0xe693('0x2c')],null))[_0xe693('0x24')](respondWithResult(_0x482419,null))[_0xe693('0x4e')](handleError(_0x482419,null));};exports[_0xe693('0x25')]=function(_0x53f30d,_0x532b37){return db[_0xe693('0x33')]['find']({'where':{'id':_0x53f30d[_0xe693('0x50')]['id']}})['then'](handleEntityNotFound(_0x532b37,null))[_0xe693('0x24')](removeEntity(_0x532b37,null))['catch'](handleError(_0x532b37,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a7454ba..79526e1 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc10d=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc10d,0xec));var _0xdc10=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0xc10d[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0xdc10('0x0'));var util=require('util');var logger=require(_0xdc10('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdc10('0x2'));var rp=require(_0xdc10('0x3'));var fs=require('fs');var path=require(_0xdc10('0x4'));var rimraf=require(_0xdc10('0x5'));var config=require(_0xdc10('0x6'));var attributes=require(_0xdc10('0x7'));module[_0xdc10('0x8')]=function(_0x5df2b2,_0x74c530){return _0x5df2b2[_0xdc10('0x9')](_0xdc10('0xa'),attributes,{'tableName':_0xdc10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0561=['bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','api','moment'];(function(_0x2c3201,_0x1f76ff){var _0x564fc4=function(_0x424493){while(--_0x424493){_0x2c3201['push'](_0x2c3201['shift']());}};_0x564fc4(++_0x1f76ff);}(_0x0561,0x1dd));var _0x1056=function(_0x57b86a,_0x240a32){_0x57b86a=_0x57b86a-0x0;var _0x697f52=_0x0561[_0x57b86a];return _0x697f52;};'use strict';var _=require(_0x1056('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1056('0x1'));var moment=require(_0x1056('0x2'));var BPromise=require(_0x1056('0x3'));var rp=require(_0x1056('0x4'));var fs=require('fs');var path=require(_0x1056('0x5'));var rimraf=require('rimraf');var config=require(_0x1056('0x6'));var attributes=require(_0x1056('0x7'));module[_0x1056('0x8')]=function(_0x553847,_0x54b038){return _0x553847[_0x1056('0x9')](_0x1056('0xa'),attributes,{'tableName':_0x1056('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 771d2aa..d8585f5 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb70=['CloudProvider,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb70,0xb2));var _0x0fb7=function(_0x4360d8,_0x266dec){_0x4360d8=_0x4360d8-0x0;var _0x37bd31=_0xfb70[_0x4360d8];return _0x37bd31;};'use strict';var _=require(_0x0fb7('0x0'));var util=require(_0x0fb7('0x1'));var moment=require('moment');var BPromise=require(_0x0fb7('0x2'));var rs=require(_0x0fb7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fb7('0x4'))['db'];var utils=require(_0x0fb7('0x5'));var logger=require(_0x0fb7('0x6'))(_0x0fb7('0x7'));var config=require(_0x0fb7('0x8'));var jayson=require(_0x0fb7('0x9'));var client=jayson[_0x0fb7('0xa')][_0x0fb7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b1648,_0x1f83f8,_0x44dbc8){return new BPromise(function(_0x40dd63,_0x20347e){return client[_0x0fb7('0xc')](_0x1b1648,_0x44dbc8)['then'](function(_0x3920a4){logger[_0x0fb7('0xd')]('CloudProvider,\x20%s,\x20%s',_0x1f83f8,_0x0fb7('0xe'));logger['debug'](_0x0fb7('0xf'),_0x1f83f8,'request\x20sent',JSON[_0x0fb7('0x10')](_0x3920a4));if(_0x3920a4[_0x0fb7('0x11')]){if(_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x12')]===0x1f4){logger[_0x0fb7('0x11')]('CloudProvider,\x20%s,\x20%s',_0x1f83f8,_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);return _0x20347e(_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);}logger[_0x0fb7('0x11')](_0x0fb7('0x14'),_0x1f83f8,_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);return _0x40dd63(_0x3920a4[_0x0fb7('0x11')][_0x0fb7('0x13')]);}else{logger[_0x0fb7('0xd')](_0x0fb7('0x14'),_0x1f83f8,_0x0fb7('0xe'));_0x40dd63(_0x3920a4['result'][_0x0fb7('0x13')]);}})[_0x0fb7('0x15')](function(_0x1020d7){logger[_0x0fb7('0x11')](_0x0fb7('0x14'),_0x1f83f8,_0x1020d7);_0x20347e(_0x1020d7);});});} \ No newline at end of file +var _0xa292=['code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa292,0xd4));var _0x2a29=function(_0x587f2a,_0xf47df8){_0x587f2a=_0x587f2a-0x0;var _0x1c89f2=_0xa292[_0x587f2a];return _0x1c89f2;};'use strict';var _=require(_0x2a29('0x0'));var util=require(_0x2a29('0x1'));var moment=require(_0x2a29('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a29('0x3'));var fs=require('fs');var Redis=require(_0x2a29('0x4'));var db=require(_0x2a29('0x5'))['db'];var utils=require(_0x2a29('0x6'));var logger=require('../../config/logger')(_0x2a29('0x7'));var config=require(_0x2a29('0x8'));var jayson=require(_0x2a29('0x9'));var client=jayson[_0x2a29('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5582a3,_0x123015,_0x5e5cab){return new BPromise(function(_0x6d60d1,_0x32e64c){return client[_0x2a29('0xb')](_0x5582a3,_0x5e5cab)[_0x2a29('0xc')](function(_0x50de23){logger[_0x2a29('0xd')](_0x2a29('0xe'),_0x123015,'request\x20sent');logger[_0x2a29('0xf')](_0x2a29('0x10'),_0x123015,'request\x20sent',JSON['stringify'](_0x50de23));if(_0x50de23[_0x2a29('0x11')]){if(_0x50de23[_0x2a29('0x11')][_0x2a29('0x12')]===0x1f4){logger[_0x2a29('0x11')]('CloudProvider,\x20%s,\x20%s',_0x123015,_0x50de23[_0x2a29('0x11')][_0x2a29('0x13')]);return _0x32e64c(_0x50de23[_0x2a29('0x11')]['message']);}logger['error'](_0x2a29('0xe'),_0x123015,_0x50de23[_0x2a29('0x11')]['message']);return _0x6d60d1(_0x50de23[_0x2a29('0x11')][_0x2a29('0x13')]);}else{logger[_0x2a29('0xd')]('CloudProvider,\x20%s,\x20%s',_0x123015,_0x2a29('0x14'));_0x6d60d1(_0x50de23[_0x2a29('0x15')]['message']);}})[_0x2a29('0x16')](function(_0x40950c){logger[_0x2a29('0x11')]('CloudProvider,\x20%s,\x20%s',_0x123015,_0x40950c);_0x32e64c(_0x40950c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b4f5c89..d4007b8 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c4c=['./cloudProvider.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c4c,0xad));var _0xc4c4=function(_0x15571f,_0x592026){_0x15571f=_0x15571f-0x0;var _0x3b4708=_0x4c4c[_0x15571f];return _0x3b4708;};'use strict';var multer=require('multer');var util=require(_0xc4c4('0x0'));var path=require(_0xc4c4('0x1'));var timeout=require(_0xc4c4('0x2'));var express=require(_0xc4c4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc4c4('0x4'));var interaction=require(_0xc4c4('0x5'));var config=require(_0xc4c4('0x6'));var controller=require(_0xc4c4('0x7'));router['get']('/',auth[_0xc4c4('0x8')](),controller[_0xc4c4('0x9')]);router[_0xc4c4('0xa')](_0xc4c4('0xb'),auth[_0xc4c4('0x8')](),controller[_0xc4c4('0xc')]);router[_0xc4c4('0xd')]('/',auth[_0xc4c4('0x8')](),controller[_0xc4c4('0xe')]);router[_0xc4c4('0xf')](_0xc4c4('0xb'),auth['isAuthenticated'](),controller[_0xc4c4('0x10')]);router[_0xc4c4('0x11')](_0xc4c4('0xb'),auth['isAuthenticated'](),controller[_0xc4c4('0x12')]);module[_0xc4c4('0x13')]=router; \ No newline at end of file +var _0x6e84=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x21b74c,_0x2d2e4f){var _0x5158ca=function(_0x139024){while(--_0x139024){_0x21b74c['push'](_0x21b74c['shift']());}};_0x5158ca(++_0x2d2e4f);}(_0x6e84,0x159));var _0x46e8=function(_0xb2d08e,_0x5b3b31){_0xb2d08e=_0xb2d08e-0x0;var _0x438689=_0x6e84[_0xb2d08e];return _0x438689;};'use strict';var multer=require(_0x46e8('0x0'));var util=require(_0x46e8('0x1'));var path=require(_0x46e8('0x2'));var timeout=require(_0x46e8('0x3'));var express=require(_0x46e8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46e8('0x5'));var config=require(_0x46e8('0x6'));var controller=require('./cloudProvider.controller');router[_0x46e8('0x7')]('/',auth[_0x46e8('0x8')](),controller['index']);router[_0x46e8('0x7')](_0x46e8('0x9'),auth[_0x46e8('0x8')](),controller['show']);router['post']('/',auth[_0x46e8('0x8')](),controller[_0x46e8('0xa')]);router[_0x46e8('0xb')](_0x46e8('0x9'),auth[_0x46e8('0x8')](),controller[_0x46e8('0xc')]);router['delete'](_0x46e8('0x9'),auth['isAuthenticated'](),controller[_0x46e8('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 26e875a..82a8be1 100644 --- a/server/api/cmCompany/cmCompany.attributes.js +++ b/server/api/cmCompany/cmCompany.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27f5=['STRING','sequelize','exports'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x27f5,0x17b));var _0x527f=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x27f5[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require(_0x527f('0x0'));module[_0x527f('0x1')]={'name':{'type':Sequelize[_0x527f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x527f('0x2')]},'companyId':{'type':Sequelize[_0x527f('0x2')]},'website':{'type':Sequelize[_0x527f('0x2')]},'phone':{'type':Sequelize[_0x527f('0x2')]},'fax':{'type':Sequelize[_0x527f('0x2')]},'type':{'type':Sequelize[_0x527f('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x527f('0x2')]},'city':{'type':Sequelize[_0x527f('0x2')]},'country':{'type':Sequelize[_0x527f('0x2')]},'email':{'type':Sequelize[_0x527f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x527f('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x527f('0x2')]},'sCountry':{'type':Sequelize[_0x527f('0x2')]},'description':{'type':Sequelize[_0x527f('0x2')]}}; \ No newline at end of file +var _0xb146=['sequelize','STRING','name'];(function(_0x4170b4,_0x417f24){var _0x140d2c=function(_0x36571e){while(--_0x36571e){_0x4170b4['push'](_0x4170b4['shift']());}};_0x140d2c(++_0x417f24);}(_0xb146,0x129));var _0x6b14=function(_0x1a2b70,_0x53a888){_0x1a2b70=_0x1a2b70-0x0;var _0x2b8ae7=_0xb146[_0x1a2b70];return _0x2b8ae7;};'use strict';var Sequelize=require(_0x6b14('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b14('0x1')],'unique':_0x6b14('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6b14('0x1')]},'companyId':{'type':Sequelize[_0x6b14('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6b14('0x1')]},'type':{'type':Sequelize[_0x6b14('0x1')]},'street':{'type':Sequelize[_0x6b14('0x1')]},'postalCode':{'type':Sequelize[_0x6b14('0x1')]},'city':{'type':Sequelize[_0x6b14('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6b14('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6b14('0x1')]},'sStreet':{'type':Sequelize[_0x6b14('0x1')]},'sPostalCode':{'type':Sequelize[_0x6b14('0x1')]},'sCity':{'type':Sequelize[_0x6b14('0x1')]},'sCountry':{'type':Sequelize[_0x6b14('0x1')]},'description':{'type':Sequelize[_0x6b14('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0b73f01..f9ebbb2 100644 --- a/server/api/cmCompany/cmCompany.controller.js +++ b/server/api/cmCompany/cmCompany.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ff8=['catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','rimraf','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','stack','name','render','body','contact','message','agent','interaction','account','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','options','includeAll','include','CmCompany','findAll','rows'];(function(_0x5891aa,_0x2baf88){var _0xabe03d=function(_0x4b06b8){while(--_0x4b06b8){_0x5891aa['push'](_0x5891aa['shift']());}};_0xabe03d(++_0x2baf88);}(_0x6ff8,0x182));var _0x86ff=function(_0x1a4b42,_0x198645){_0x1a4b42=_0x1a4b42-0x0;var _0x4e78a9=_0x6ff8[_0x1a4b42];return _0x4e78a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86ff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86ff('0x1'));var Mustache=require(_0x86ff('0x2'));var util=require('util');var path=require(_0x86ff('0x3'));var sox=require('sox');var csv=require(_0x86ff('0x4'));var ejs=require(_0x86ff('0x5'));var fs=require('fs');var fs_extra=require(_0x86ff('0x6'));var _=require('lodash');var squel=require(_0x86ff('0x7'));var crypto=require(_0x86ff('0x8'));var jsforce=require(_0x86ff('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x86ff('0x4'));var querystring=require(_0x86ff('0xa'));var Papa=require(_0x86ff('0xb'));var Redis=require('ioredis');var authService=require(_0x86ff('0xc'));var qs=require(_0x86ff('0xd'));var as=require(_0x86ff('0xe'));var hardwareService=require(_0x86ff('0xf'));var logger=require(_0x86ff('0x10'))('api');var utils=require(_0x86ff('0x11'));var config=require(_0x86ff('0x12'));var licenseUtil=require(_0x86ff('0x13'));var db=require(_0x86ff('0x14'))['db'];function respondWithStatusCode(_0x1a42a6,_0x282fef){_0x282fef=_0x282fef||0xcc;return function(_0x15385d){if(_0x15385d){return _0x1a42a6[_0x86ff('0x15')](_0x282fef);}return _0x1a42a6[_0x86ff('0x16')](_0x282fef)['end']();};}function respondWithResult(_0x4e29b9,_0x31b878){_0x31b878=_0x31b878||0xc8;return function(_0xc06f23){if(_0xc06f23){return _0x4e29b9['status'](_0x31b878)['json'](_0xc06f23);}};}function respondWithFilteredResult(_0x384353,_0x333a41){return function(_0x45d432){if(_0x45d432){var _0xea1276=typeof _0x333a41['offset']===_0x86ff('0x17')&&typeof _0x333a41[_0x86ff('0x18')]==='undefined';var _0x37cdc2=_0x45d432['count'];var _0x3bbfeb=_0xea1276?0x0:_0x333a41[_0x86ff('0x19')];var _0x39bafa=_0xea1276?_0x45d432[_0x86ff('0x1a')]:_0x333a41[_0x86ff('0x19')]+_0x333a41[_0x86ff('0x18')];var _0x5003bc;if(_0x39bafa>=_0x37cdc2){_0x39bafa=_0x37cdc2;_0x5003bc=0xc8;}else{_0x5003bc=0xce;}_0x384353['status'](_0x5003bc);return _0x384353[_0x86ff('0x1b')](_0x86ff('0x1c'),_0x3bbfeb+'-'+_0x39bafa+'/'+_0x37cdc2)[_0x86ff('0x1d')](_0x45d432);}return null;};}function patchUpdates(_0x1fe04a){return function(_0x56a2e4){try{jsonpatch['apply'](_0x56a2e4,_0x1fe04a,!![]);}catch(_0x58047d){return BPromise[_0x86ff('0x1e')](_0x58047d);}return _0x56a2e4[_0x86ff('0x1f')]();};}function saveUpdates(_0x289ad6,_0x442f38){return function(_0x4c2589){if(_0x4c2589){return _0x4c2589[_0x86ff('0x20')](_0x289ad6)[_0x86ff('0x21')](function(_0x317f51){return _0x317f51;});}return null;};}function removeEntity(_0x3baca3,_0x3eab58){return function(_0x18ce58){if(_0x18ce58){return _0x18ce58[_0x86ff('0x22')]()[_0x86ff('0x21')](function(){var _0x4940b4=_0x18ce58[_0x86ff('0x23')]({'plain':!![]});var _0x16ec3a=_0x86ff('0x24');return db[_0x86ff('0x25')][_0x86ff('0x22')]({'where':{'type':_0x16ec3a,'resourceId':_0x4940b4['id']}})[_0x86ff('0x21')](function(){return _0x18ce58;});})[_0x86ff('0x21')](function(){_0x3baca3[_0x86ff('0x16')](0xcc)[_0x86ff('0x26')]();});}};}function handleEntityNotFound(_0x37ebd4,_0x23ff07){return function(_0x5f5ce3){if(!_0x5f5ce3){_0x37ebd4[_0x86ff('0x15')](0x194);}return _0x5f5ce3;};}function handleError(_0x407bbd,_0x3062d6){_0x3062d6=_0x3062d6||0x1f4;return function(_0x13623d){logger[_0x86ff('0x27')](_0x13623d[_0x86ff('0x28')]);if(_0x13623d['name']){delete _0x13623d[_0x86ff('0x29')];}_0x407bbd['status'](_0x3062d6)['send'](_0x13623d);};}function getMustacheRender(_0x296c2a,_0x140a23){return Mustache[_0x86ff('0x2a')](_0x296c2a,_['merge'](_0x140a23[_0x86ff('0x2b')],{'contact':_0x140a23[_0x86ff('0x2c')],'message':_0x140a23[_0x86ff('0x2d')],'agent':_0x140a23[_0x86ff('0x2e')],'interaction':_0x140a23[_0x86ff('0x2f')],'account':_0x140a23[_0x86ff('0x30')]}))||'';}exports[_0x86ff('0x31')]=function(_0x3d6039,_0x3136f5){var _0x4123a3={},_0x5f5422={},_0x39baf1={'count':0x0,'rows':[]};return db['CmCompany'][_0x86ff('0x32')]()[_0x86ff('0x21')](function(_0x46cc06){_0x5f5422[_0x86ff('0x33')]=_[_0x86ff('0x34')](_0x46cc06);_0x5f5422[_0x86ff('0x35')]=_[_0x86ff('0x34')](_0x3d6039['query']);_0x5f5422[_0x86ff('0x36')]=_[_0x86ff('0x37')](_0x5f5422[_0x86ff('0x33')],_0x5f5422[_0x86ff('0x35')]);_0x4123a3[_0x86ff('0x38')]=_['intersection'](_0x5f5422[_0x86ff('0x33')],qs[_0x86ff('0x39')](_0x3d6039[_0x86ff('0x35')][_0x86ff('0x39')]));_0x4123a3['attributes']=_0x4123a3['attributes'][_0x86ff('0x3a')]?_0x4123a3[_0x86ff('0x38')]:_0x5f5422[_0x86ff('0x33')];if(!_0x3d6039['query'][_0x86ff('0x3b')](_0x86ff('0x3c'))){_0x4123a3['limit']=qs[_0x86ff('0x18')](_0x3d6039['query']['limit']);_0x4123a3[_0x86ff('0x19')]=qs['offset'](_0x3d6039[_0x86ff('0x35')][_0x86ff('0x19')]);}_0x4123a3[_0x86ff('0x3d')]=qs[_0x86ff('0x3e')](_0x3d6039[_0x86ff('0x35')][_0x86ff('0x3e')]);_0x4123a3['where']=qs['filters'](_[_0x86ff('0x3f')](_0x3d6039[_0x86ff('0x35')],_0x5f5422[_0x86ff('0x36')]),_0x46cc06);if(_0x3d6039[_0x86ff('0x35')][_0x86ff('0x40')]){_0x4123a3[_0x86ff('0x41')]=_['merge'](_0x4123a3[_0x86ff('0x41')],{'$or':_[_0x86ff('0x42')](_0x4123a3[_0x86ff('0x38')],function(_0x55e952){var _0xacafa6={};_0xacafa6[_0x55e952]={'$like':'%'+_0x3d6039['query']['filter']+'%'};return _0xacafa6;})});}_0x4123a3=_[_0x86ff('0x43')]({},_0x4123a3,_0x3d6039[_0x86ff('0x44')]);var _0x35d667={'where':_0x4123a3[_0x86ff('0x41')]};return db['CmCompany']['count'](_0x35d667)[_0x86ff('0x21')](function(_0x22e263){_0x39baf1['count']=_0x22e263;if(_0x3d6039[_0x86ff('0x35')][_0x86ff('0x45')]){_0x4123a3[_0x86ff('0x46')]=[{'all':!![]}];}return db[_0x86ff('0x47')][_0x86ff('0x48')](_0x4123a3);})[_0x86ff('0x21')](function(_0x3e5efa){_0x39baf1[_0x86ff('0x49')]=_0x3e5efa;return _0x39baf1;})[_0x86ff('0x21')](respondWithFilteredResult(_0x3136f5,_0x4123a3))[_0x86ff('0x4a')](handleError(_0x3136f5,null));})[_0x86ff('0x4a')](handleError(_0x3136f5,null));};exports[_0x86ff('0x4b')]=function(_0x446757,_0x4e3a51){var _0x53b86c={'raw':![],'where':{'id':_0x446757[_0x86ff('0x4c')]['id']}},_0x3d6a08={};_0x3d6a08[_0x86ff('0x33')]=_[_0x86ff('0x34')](db[_0x86ff('0x47')][_0x86ff('0x4d')]);_0x3d6a08['query']=_['keys'](_0x446757['query']);_0x3d6a08[_0x86ff('0x36')]=_[_0x86ff('0x37')](_0x3d6a08[_0x86ff('0x33')],_0x3d6a08[_0x86ff('0x35')]);_0x53b86c[_0x86ff('0x38')]=_['intersection'](_0x3d6a08[_0x86ff('0x33')],qs[_0x86ff('0x39')](_0x446757[_0x86ff('0x35')][_0x86ff('0x39')]));_0x53b86c['attributes']=_0x53b86c['attributes']['length']?_0x53b86c[_0x86ff('0x38')]:_0x3d6a08[_0x86ff('0x33')];if(_0x446757[_0x86ff('0x35')][_0x86ff('0x45')]){_0x53b86c[_0x86ff('0x46')]=[{'all':!![]}];}_0x53b86c=_[_0x86ff('0x43')]({},_0x53b86c,_0x446757[_0x86ff('0x44')]);return db[_0x86ff('0x47')][_0x86ff('0x4e')](_0x53b86c)[_0x86ff('0x21')](handleEntityNotFound(_0x4e3a51,null))['then'](respondWithResult(_0x4e3a51,null))[_0x86ff('0x4a')](handleError(_0x4e3a51,null));};exports['create']=function(_0x469bfc,_0x376a16){return db[_0x86ff('0x47')][_0x86ff('0x4f')](_0x469bfc[_0x86ff('0x2b')],{})['then'](function(_0x3e1946){var _0x3615e9=_0x469bfc[_0x86ff('0x50')][_0x86ff('0x23')]({'plain':!![]});if(!_0x3615e9)throw new Error(_0x86ff('0x51'));if(_0x3615e9[_0x86ff('0x52')]===_0x86ff('0x50')){var _0x5b3d4d=_0x3e1946['get']({'plain':!![]});var _0x858cc0=_0x86ff('0x24');return db[_0x86ff('0x53')]['find']({'where':{'name':_0x858cc0,'userProfileId':_0x3615e9['userProfileId']},'raw':!![]})['then'](function(_0x270dce){if(_0x270dce&&_0x270dce[_0x86ff('0x54')]===0x0){return db[_0x86ff('0x25')][_0x86ff('0x4f')]({'name':_0x5b3d4d['name'],'resourceId':_0x5b3d4d['id'],'type':_0x270dce[_0x86ff('0x29')],'sectionId':_0x270dce['id']},{})[_0x86ff('0x21')](function(){return _0x3e1946;});}else{return _0x3e1946;}})[_0x86ff('0x4a')](function(_0x41987f){logger[_0x86ff('0x27')](_0x86ff('0x55'),_0x41987f);throw _0x41987f;});}return _0x3e1946;})[_0x86ff('0x21')](respondWithResult(_0x376a16,0xc9))[_0x86ff('0x4a')](handleError(_0x376a16,null));};exports['update']=function(_0x4134c3,_0x10c329){if(_0x4134c3[_0x86ff('0x2b')]['id']){delete _0x4134c3[_0x86ff('0x2b')]['id'];}return db[_0x86ff('0x47')][_0x86ff('0x4e')]({'where':{'id':_0x4134c3[_0x86ff('0x4c')]['id']}})[_0x86ff('0x21')](handleEntityNotFound(_0x10c329,null))['then'](saveUpdates(_0x4134c3[_0x86ff('0x2b')],null))['then'](respondWithResult(_0x10c329,null))['catch'](handleError(_0x10c329,null));};exports[_0x86ff('0x22')]=function(_0x4df6bd,_0x1a2667){return db[_0x86ff('0x47')][_0x86ff('0x4e')]({'where':{'id':_0x4df6bd[_0x86ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a2667,null))[_0x86ff('0x21')](removeEntity(_0x1a2667,null))['catch'](handleError(_0x1a2667,null));};exports['describe']=function(_0x3b89ed,_0x100eb2){return db['CmCompany'][_0x86ff('0x32')]()[_0x86ff('0x21')](respondWithResult(_0x100eb2,null))[_0x86ff('0x4a')](handleError(_0x100eb2,null));};exports[_0x86ff('0x56')]=function(_0x280c44,_0x5b3db8,_0x58ba11){return db[_0x86ff('0x57')][_0x86ff('0x4e')]({'where':{'id':_0x280c44[_0x86ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b3db8,null))[_0x86ff('0x21')](function(_0x15772c){if(_0x15772c){return _0x15772c['addContacts'](_0x280c44[_0x86ff('0x2b')][_0x86ff('0x58')],_[_0x86ff('0x59')](_0x280c44['body'],[_0x86ff('0x58'),'id'])||{});}})[_0x86ff('0x21')](respondWithResult(_0x5b3db8,null))[_0x86ff('0x4a')](handleError(_0x5b3db8,null));};exports[_0x86ff('0x5a')]=function(_0x314825,_0x345f37,_0x27d136){var _0xff6d90={};var _0x293b5c={};var _0x2e99a2;var _0x3bec7c;return db[_0x86ff('0x47')][_0x86ff('0x5b')]({'where':{'id':_0x314825['params']['id']}})[_0x86ff('0x21')](handleEntityNotFound(_0x345f37,null))['then'](function(_0x5df964){if(_0x5df964){_0x2e99a2=_0x5df964;_0x293b5c[_0x86ff('0x33')]=_[_0x86ff('0x34')](db['CmContact'][_0x86ff('0x4d')]);_0x293b5c[_0x86ff('0x35')]=_[_0x86ff('0x34')](_0x314825[_0x86ff('0x35')]);_0x293b5c[_0x86ff('0x36')]=_[_0x86ff('0x37')](_0x293b5c[_0x86ff('0x33')],_0x293b5c['query']);_0xff6d90[_0x86ff('0x38')]=_[_0x86ff('0x37')](_0x293b5c[_0x86ff('0x33')],qs[_0x86ff('0x39')](_0x314825[_0x86ff('0x35')][_0x86ff('0x39')]));_0xff6d90[_0x86ff('0x38')]=_0xff6d90[_0x86ff('0x38')][_0x86ff('0x3a')]?_0xff6d90['attributes']:_0x293b5c[_0x86ff('0x33')];_0xff6d90[_0x86ff('0x3d')]=qs[_0x86ff('0x3e')](_0x314825[_0x86ff('0x35')][_0x86ff('0x3e')]);_0xff6d90[_0x86ff('0x41')]=qs[_0x86ff('0x36')](_[_0x86ff('0x3f')](_0x314825[_0x86ff('0x35')],_0x293b5c[_0x86ff('0x36')]));if(_0x314825[_0x86ff('0x35')][_0x86ff('0x40')]){_0xff6d90[_0x86ff('0x41')]=_[_0x86ff('0x43')](_0xff6d90[_0x86ff('0x41')],{'$or':_[_0x86ff('0x42')](_0xff6d90[_0x86ff('0x38')],function(_0x3c3cd2){var _0x5b34c2={};_0x5b34c2[_0x3c3cd2]={'$like':'%'+_0x314825[_0x86ff('0x35')]['filter']+'%'};return _0x5b34c2;})});}_0xff6d90=_['merge']({},_0xff6d90,_0x314825[_0x86ff('0x44')]);return _0x2e99a2[_0x86ff('0x5a')](_0xff6d90);}})[_0x86ff('0x21')](function(_0x141545){if(_0x141545){_0x3bec7c=_0x141545[_0x86ff('0x3a')];if(!_0x314825[_0x86ff('0x35')][_0x86ff('0x3b')]('nolimit')){_0xff6d90[_0x86ff('0x18')]=qs['limit'](_0x314825[_0x86ff('0x35')][_0x86ff('0x18')]);_0xff6d90[_0x86ff('0x19')]=qs['offset'](_0x314825[_0x86ff('0x35')]['offset']);}return _0x2e99a2[_0x86ff('0x5a')](_0xff6d90);}})[_0x86ff('0x21')](function(_0x52a121){if(_0x52a121){return _0x52a121?{'count':_0x3bec7c,'rows':_0x52a121}:null;}})[_0x86ff('0x21')](respondWithResult(_0x345f37,null))[_0x86ff('0x4a')](handleError(_0x345f37,null));}; \ No newline at end of file +var _0x3145=['to-csv','ejs','squel','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','render','contact','message','interaction','account','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','params','ids','getContacts','findOne','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x17d727,_0x1396f0){var _0xd4a676=function(_0x7f285c){while(--_0x7f285c){_0x17d727['push'](_0x17d727['shift']());}};_0xd4a676(++_0x1396f0);}(_0x3145,0x1b9));var _0x5314=function(_0x37fbfb,_0x55e9aa){_0x37fbfb=_0x37fbfb-0x0;var _0xf1bf83=_0x3145[_0x37fbfb];return _0xf1bf83;};'use strict';var emlformat=require(_0x5314('0x0'));var rimraf=require(_0x5314('0x1'));var zipdir=require(_0x5314('0x2'));var jsonpatch=require(_0x5314('0x3'));var rp=require(_0x5314('0x4'));var moment=require(_0x5314('0x5'));var BPromise=require(_0x5314('0x6'));var Mustache=require('mustache');var util=require(_0x5314('0x7'));var path=require('path');var sox=require(_0x5314('0x8'));var csv=require(_0x5314('0x9'));var ejs=require(_0x5314('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5314('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5314('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5314('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5314('0xe'));var hardwareService=require(_0x5314('0xf'));var logger=require(_0x5314('0x10'))(_0x5314('0x11'));var utils=require(_0x5314('0x12'));var config=require(_0x5314('0x13'));var licenseUtil=require(_0x5314('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5579ca,_0x429997){_0x429997=_0x429997||0xcc;return function(_0x472d98){if(_0x472d98){return _0x5579ca[_0x5314('0x15')](_0x429997);}return _0x5579ca[_0x5314('0x16')](_0x429997)[_0x5314('0x17')]();};}function respondWithResult(_0x23a368,_0x145832){_0x145832=_0x145832||0xc8;return function(_0x3f48b9){if(_0x3f48b9){return _0x23a368[_0x5314('0x16')](_0x145832)[_0x5314('0x18')](_0x3f48b9);}};}function respondWithFilteredResult(_0x2f1b97,_0xfe61f7){return function(_0x39a053){if(_0x39a053){var _0x565707=typeof _0xfe61f7[_0x5314('0x19')]===_0x5314('0x1a')&&typeof _0xfe61f7[_0x5314('0x1b')]==='undefined';var _0x2d635d=_0x39a053['count'];var _0x4f63b3=_0x565707?0x0:_0xfe61f7['offset'];var _0x24d6f9=_0x565707?_0x39a053[_0x5314('0x1c')]:_0xfe61f7['offset']+_0xfe61f7[_0x5314('0x1b')];var _0xaa6b72;if(_0x24d6f9>=_0x2d635d){_0x24d6f9=_0x2d635d;_0xaa6b72=0xc8;}else{_0xaa6b72=0xce;}_0x2f1b97[_0x5314('0x16')](_0xaa6b72);return _0x2f1b97['set']('Content-Range',_0x4f63b3+'-'+_0x24d6f9+'/'+_0x2d635d)['json'](_0x39a053);}return null;};}function patchUpdates(_0x2f5051){return function(_0x539eba){try{jsonpatch[_0x5314('0x1d')](_0x539eba,_0x2f5051,!![]);}catch(_0x479c07){return BPromise[_0x5314('0x1e')](_0x479c07);}return _0x539eba[_0x5314('0x1f')]();};}function saveUpdates(_0x526fb4,_0x1caa89){return function(_0x9ef851){if(_0x9ef851){return _0x9ef851[_0x5314('0x20')](_0x526fb4)[_0x5314('0x21')](function(_0x5e5917){return _0x5e5917;});}return null;};}function removeEntity(_0x545f0e,_0x1c2a48){return function(_0x13595e){if(_0x13595e){return _0x13595e[_0x5314('0x22')]()['then'](function(){var _0x3cfb0e=_0x13595e[_0x5314('0x23')]({'plain':!![]});var _0x116058='Companies';return db[_0x5314('0x24')][_0x5314('0x22')]({'where':{'type':_0x116058,'resourceId':_0x3cfb0e['id']}})[_0x5314('0x21')](function(){return _0x13595e;});})[_0x5314('0x21')](function(){_0x545f0e[_0x5314('0x16')](0xcc)[_0x5314('0x17')]();});}};}function handleEntityNotFound(_0x3fd33c,_0x2cee44){return function(_0x41d98a){if(!_0x41d98a){_0x3fd33c['sendStatus'](0x194);}return _0x41d98a;};}function handleError(_0x224cff,_0x371196){_0x371196=_0x371196||0x1f4;return function(_0x30ab67){logger[_0x5314('0x25')](_0x30ab67[_0x5314('0x26')]);if(_0x30ab67[_0x5314('0x27')]){delete _0x30ab67[_0x5314('0x27')];}_0x224cff[_0x5314('0x16')](_0x371196)[_0x5314('0x28')](_0x30ab67);};}function getMustacheRender(_0xbbff67,_0x5aaae9){return Mustache[_0x5314('0x29')](_0xbbff67,_['merge'](_0x5aaae9['body'],{'contact':_0x5aaae9[_0x5314('0x2a')],'message':_0x5aaae9[_0x5314('0x2b')],'agent':_0x5aaae9['agent'],'interaction':_0x5aaae9[_0x5314('0x2c')],'account':_0x5aaae9[_0x5314('0x2d')]}))||'';}exports['index']=function(_0x6e7c9b,_0x2c618){var _0x5df9df={},_0x4925e7={},_0x230f52={'count':0x0,'rows':[]};return db[_0x5314('0x2e')][_0x5314('0x2f')]()[_0x5314('0x21')](function(_0x1a05b1){_0x4925e7[_0x5314('0x30')]=_[_0x5314('0x31')](_0x1a05b1);_0x4925e7[_0x5314('0x32')]=_[_0x5314('0x31')](_0x6e7c9b[_0x5314('0x32')]);_0x4925e7[_0x5314('0x33')]=_[_0x5314('0x34')](_0x4925e7[_0x5314('0x30')],_0x4925e7[_0x5314('0x32')]);_0x5df9df[_0x5314('0x35')]=_[_0x5314('0x34')](_0x4925e7[_0x5314('0x30')],qs[_0x5314('0x36')](_0x6e7c9b[_0x5314('0x32')][_0x5314('0x36')]));_0x5df9df['attributes']=_0x5df9df[_0x5314('0x35')][_0x5314('0x37')]?_0x5df9df[_0x5314('0x35')]:_0x4925e7['model'];if(!_0x6e7c9b[_0x5314('0x32')][_0x5314('0x38')](_0x5314('0x39'))){_0x5df9df[_0x5314('0x1b')]=qs[_0x5314('0x1b')](_0x6e7c9b[_0x5314('0x32')][_0x5314('0x1b')]);_0x5df9df[_0x5314('0x19')]=qs['offset'](_0x6e7c9b[_0x5314('0x32')][_0x5314('0x19')]);}_0x5df9df[_0x5314('0x3a')]=qs[_0x5314('0x3b')](_0x6e7c9b[_0x5314('0x32')][_0x5314('0x3b')]);_0x5df9df[_0x5314('0x3c')]=qs[_0x5314('0x33')](_[_0x5314('0x3d')](_0x6e7c9b[_0x5314('0x32')],_0x4925e7['filters']),_0x1a05b1);if(_0x6e7c9b[_0x5314('0x32')][_0x5314('0x3e')]){_0x5df9df[_0x5314('0x3c')]=_[_0x5314('0x3f')](_0x5df9df['where'],{'$or':_[_0x5314('0x40')](_0x5df9df[_0x5314('0x35')],function(_0x5ef205){var _0x505c7d={};_0x505c7d[_0x5ef205]={'$like':'%'+_0x6e7c9b['query']['filter']+'%'};return _0x505c7d;})});}_0x5df9df=_[_0x5314('0x3f')]({},_0x5df9df,_0x6e7c9b[_0x5314('0x41')]);var _0x4ecf10={'where':_0x5df9df[_0x5314('0x3c')]};return db[_0x5314('0x2e')][_0x5314('0x1c')](_0x4ecf10)['then'](function(_0x30574e){_0x230f52[_0x5314('0x1c')]=_0x30574e;if(_0x6e7c9b[_0x5314('0x32')][_0x5314('0x42')]){_0x5df9df[_0x5314('0x43')]=[{'all':!![]}];}return db['CmCompany'][_0x5314('0x44')](_0x5df9df);})[_0x5314('0x21')](function(_0xbdc6aa){_0x230f52[_0x5314('0x45')]=_0xbdc6aa;return _0x230f52;})[_0x5314('0x21')](respondWithFilteredResult(_0x2c618,_0x5df9df))[_0x5314('0x46')](handleError(_0x2c618,null));})[_0x5314('0x46')](handleError(_0x2c618,null));};exports[_0x5314('0x47')]=function(_0x16487e,_0x50bec0){var _0x18e29e={'raw':![],'where':{'id':_0x16487e['params']['id']}},_0x5c9108={};_0x5c9108[_0x5314('0x30')]=_[_0x5314('0x31')](db['CmCompany']['rawAttributes']);_0x5c9108[_0x5314('0x32')]=_[_0x5314('0x31')](_0x16487e[_0x5314('0x32')]);_0x5c9108['filters']=_[_0x5314('0x34')](_0x5c9108[_0x5314('0x30')],_0x5c9108[_0x5314('0x32')]);_0x18e29e[_0x5314('0x35')]=_[_0x5314('0x34')](_0x5c9108[_0x5314('0x30')],qs[_0x5314('0x36')](_0x16487e['query'][_0x5314('0x36')]));_0x18e29e[_0x5314('0x35')]=_0x18e29e[_0x5314('0x35')][_0x5314('0x37')]?_0x18e29e[_0x5314('0x35')]:_0x5c9108[_0x5314('0x30')];if(_0x16487e['query'][_0x5314('0x42')]){_0x18e29e['include']=[{'all':!![]}];}_0x18e29e=_[_0x5314('0x3f')]({},_0x18e29e,_0x16487e['options']);return db[_0x5314('0x2e')]['find'](_0x18e29e)['then'](handleEntityNotFound(_0x50bec0,null))[_0x5314('0x21')](respondWithResult(_0x50bec0,null))[_0x5314('0x46')](handleError(_0x50bec0,null));};exports[_0x5314('0x48')]=function(_0x89dde1,_0xabe793){return db[_0x5314('0x2e')][_0x5314('0x48')](_0x89dde1[_0x5314('0x49')],{})[_0x5314('0x21')](function(_0x4bee7d){var _0x278c47=_0x89dde1[_0x5314('0x4a')][_0x5314('0x23')]({'plain':!![]});if(!_0x278c47)throw new Error(_0x5314('0x4b'));if(_0x278c47[_0x5314('0x4c')]===_0x5314('0x4a')){var _0x4cdb21=_0x4bee7d[_0x5314('0x23')]({'plain':!![]});var _0x20caa2=_0x5314('0x4d');return db[_0x5314('0x4e')][_0x5314('0x4f')]({'where':{'name':_0x20caa2,'userProfileId':_0x278c47[_0x5314('0x50')]},'raw':!![]})[_0x5314('0x21')](function(_0x4505e2){if(_0x4505e2&&_0x4505e2[_0x5314('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x4cdb21[_0x5314('0x27')],'resourceId':_0x4cdb21['id'],'type':_0x4505e2[_0x5314('0x27')],'sectionId':_0x4505e2['id']},{})['then'](function(){return _0x4bee7d;});}else{return _0x4bee7d;}})[_0x5314('0x46')](function(_0x3d6305){logger[_0x5314('0x25')](_0x5314('0x52'),_0x3d6305);throw _0x3d6305;});}return _0x4bee7d;})[_0x5314('0x21')](respondWithResult(_0xabe793,0xc9))[_0x5314('0x46')](handleError(_0xabe793,null));};exports[_0x5314('0x20')]=function(_0x1c898f,_0xecf3ec){if(_0x1c898f[_0x5314('0x49')]['id']){delete _0x1c898f[_0x5314('0x49')]['id'];}return db[_0x5314('0x2e')][_0x5314('0x4f')]({'where':{'id':_0x1c898f['params']['id']}})[_0x5314('0x21')](handleEntityNotFound(_0xecf3ec,null))[_0x5314('0x21')](saveUpdates(_0x1c898f['body'],null))[_0x5314('0x21')](respondWithResult(_0xecf3ec,null))[_0x5314('0x46')](handleError(_0xecf3ec,null));};exports[_0x5314('0x22')]=function(_0x56e856,_0x2d792b){return db[_0x5314('0x2e')][_0x5314('0x4f')]({'where':{'id':_0x56e856['params']['id']}})[_0x5314('0x21')](handleEntityNotFound(_0x2d792b,null))[_0x5314('0x21')](removeEntity(_0x2d792b,null))[_0x5314('0x46')](handleError(_0x2d792b,null));};exports[_0x5314('0x2f')]=function(_0xe3e70f,_0x47000d){return db[_0x5314('0x2e')]['describe']()[_0x5314('0x21')](respondWithResult(_0x47000d,null))[_0x5314('0x46')](handleError(_0x47000d,null));};exports[_0x5314('0x53')]=function(_0x3cad9c,_0x42d39d,_0x20a46e){return db[_0x5314('0x54')][_0x5314('0x4f')]({'where':{'id':_0x3cad9c[_0x5314('0x55')]['id']}})[_0x5314('0x21')](handleEntityNotFound(_0x42d39d,null))[_0x5314('0x21')](function(_0x469e9d){if(_0x469e9d){return _0x469e9d[_0x5314('0x53')](_0x3cad9c['body'][_0x5314('0x56')],_['omit'](_0x3cad9c[_0x5314('0x49')],['ids','id'])||{});}})['then'](respondWithResult(_0x42d39d,null))['catch'](handleError(_0x42d39d,null));};exports[_0x5314('0x57')]=function(_0x44d190,_0x202bdc,_0x30031d){var _0x1384ff={};var _0x1d6fb4={};var _0x572a91;var _0x14fe7c;return db[_0x5314('0x2e')][_0x5314('0x58')]({'where':{'id':_0x44d190[_0x5314('0x55')]['id']}})[_0x5314('0x21')](handleEntityNotFound(_0x202bdc,null))[_0x5314('0x21')](function(_0x5b8c91){if(_0x5b8c91){_0x572a91=_0x5b8c91;_0x1d6fb4[_0x5314('0x30')]=_[_0x5314('0x31')](db['CmContact'][_0x5314('0x59')]);_0x1d6fb4[_0x5314('0x32')]=_[_0x5314('0x31')](_0x44d190[_0x5314('0x32')]);_0x1d6fb4[_0x5314('0x33')]=_[_0x5314('0x34')](_0x1d6fb4[_0x5314('0x30')],_0x1d6fb4[_0x5314('0x32')]);_0x1384ff['attributes']=_[_0x5314('0x34')](_0x1d6fb4[_0x5314('0x30')],qs['fields'](_0x44d190['query']['fields']));_0x1384ff[_0x5314('0x35')]=_0x1384ff[_0x5314('0x35')][_0x5314('0x37')]?_0x1384ff[_0x5314('0x35')]:_0x1d6fb4[_0x5314('0x30')];_0x1384ff[_0x5314('0x3a')]=qs[_0x5314('0x3b')](_0x44d190['query'][_0x5314('0x3b')]);_0x1384ff[_0x5314('0x3c')]=qs[_0x5314('0x33')](_['pick'](_0x44d190[_0x5314('0x32')],_0x1d6fb4['filters']));if(_0x44d190[_0x5314('0x32')][_0x5314('0x3e')]){_0x1384ff[_0x5314('0x3c')]=_[_0x5314('0x3f')](_0x1384ff[_0x5314('0x3c')],{'$or':_['map'](_0x1384ff[_0x5314('0x35')],function(_0x3492c8){var _0x216550={};_0x216550[_0x3492c8]={'$like':'%'+_0x44d190[_0x5314('0x32')]['filter']+'%'};return _0x216550;})});}_0x1384ff=_[_0x5314('0x3f')]({},_0x1384ff,_0x44d190[_0x5314('0x41')]);return _0x572a91['getContacts'](_0x1384ff);}})[_0x5314('0x21')](function(_0x1291f1){if(_0x1291f1){_0x14fe7c=_0x1291f1['length'];if(!_0x44d190[_0x5314('0x32')][_0x5314('0x38')]('nolimit')){_0x1384ff[_0x5314('0x1b')]=qs[_0x5314('0x1b')](_0x44d190[_0x5314('0x32')][_0x5314('0x1b')]);_0x1384ff[_0x5314('0x19')]=qs['offset'](_0x44d190[_0x5314('0x32')][_0x5314('0x19')]);}return _0x572a91['getContacts'](_0x1384ff);}})[_0x5314('0x21')](function(_0x40094f){if(_0x40094f){return _0x40094f?{'count':_0x14fe7c,'rows':_0x40094f}:null;}})['then'](respondWithResult(_0x202bdc,null))[_0x5314('0x46')](handleError(_0x202bdc,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b7de441..d5eb613 100644 --- a/server/api/cmCompany/cmCompany.model.js +++ b/server/api/cmCompany/cmCompany.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc03e=['rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','api','bluebird','path'];(function(_0x4edf50,_0x40a7c9){var _0x3d89be=function(_0x2064d3){while(--_0x2064d3){_0x4edf50['push'](_0x4edf50['shift']());}};_0x3d89be(++_0x40a7c9);}(_0xc03e,0x15a));var _0xec03=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xc03e[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ef=['api','moment','bluebird','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x32ef,0xf9));var _0xf32e=function(_0x4a8669,_0x336aed){_0x4a8669=_0x4a8669-0x0;var _0x1347b1=_0x32ef[_0x4a8669];return _0x1347b1;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var logger=require(_0xf32e('0x2'))(_0xf32e('0x3'));var moment=require(_0xf32e('0x4'));var BPromise=require(_0xf32e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf32e('0x6'));var rimraf=require(_0xf32e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf32e('0x8'));module[_0xf32e('0x9')]=function(_0x1a7d35,_0x1062c8){return _0x1a7d35[_0xf32e('0xa')](_0xf32e('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 6bca80d..a7bcb40 100644 --- a/server/api/cmCompany/cmCompany.rpc.js +++ b/server/api/cmCompany/cmCompany.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x957f=['client','http','then','request\x20sent','debug','stringify','error','CmCompany,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x957f,0x1c5));var _0xf957=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x957f[_0x315b61];return _0x3521e8;};'use strict';var _=require('lodash');var util=require(_0xf957('0x0'));var moment=require('moment');var BPromise=require(_0xf957('0x1'));var rs=require(_0xf957('0x2'));var fs=require('fs');var Redis=require(_0xf957('0x3'));var db=require(_0xf957('0x4'))['db'];var utils=require(_0xf957('0x5'));var logger=require('../../config/logger')(_0xf957('0x6'));var config=require(_0xf957('0x7'));var jayson=require(_0xf957('0x8'));var client=jayson[_0xf957('0x9')][_0xf957('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1496d5,_0xa83fce,_0x22ccf7){return new BPromise(function(_0x221a64,_0x7a5ed6){return client['request'](_0x1496d5,_0x22ccf7)[_0xf957('0xb')](function(_0x24103e){logger['info']('CmCompany,\x20%s,\x20%s',_0xa83fce,_0xf957('0xc'));logger[_0xf957('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xa83fce,'request\x20sent',JSON[_0xf957('0xe')](_0x24103e));if(_0x24103e[_0xf957('0xf')]){if(_0x24103e[_0xf957('0xf')]['code']===0x1f4){logger[_0xf957('0xf')](_0xf957('0x10'),_0xa83fce,_0x24103e['error'][_0xf957('0x11')]);return _0x7a5ed6(_0x24103e['error']['message']);}logger[_0xf957('0xf')](_0xf957('0x10'),_0xa83fce,_0x24103e['error']['message']);return _0x221a64(_0x24103e[_0xf957('0xf')][_0xf957('0x11')]);}else{logger[_0xf957('0x12')](_0xf957('0x10'),_0xa83fce,_0xf957('0xc'));_0x221a64(_0x24103e[_0xf957('0x13')][_0xf957('0x11')]);}})[_0xf957('0x14')](function(_0xf7a819){logger[_0xf957('0xf')](_0xf957('0x10'),_0xa83fce,_0xf7a819);_0x7a5ed6(_0xf7a819);});});} \ No newline at end of file +var _0xf4fc=['CmCompany,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','CmCompany,\x20%s,\x20%s','debug'];(function(_0x1b39f7,_0x219cab){var _0x407328=function(_0x5f510a){while(--_0x5f510a){_0x1b39f7['push'](_0x1b39f7['shift']());}};_0x407328(++_0x219cab);}(_0xf4fc,0x1be));var _0xcf4f=function(_0x509669,_0x1648c5){_0x509669=_0x509669-0x0;var _0x3bb48b=_0xf4fc[_0x509669];return _0x3bb48b;};'use strict';var _=require(_0xcf4f('0x0'));var util=require(_0xcf4f('0x1'));var moment=require(_0xcf4f('0x2'));var BPromise=require(_0xcf4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf4f('0x4'));var db=require(_0xcf4f('0x5'))['db'];var utils=require(_0xcf4f('0x6'));var logger=require('../../config/logger')(_0xcf4f('0x7'));var config=require(_0xcf4f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54186d,_0x21a099,_0x11bb76){return new BPromise(function(_0x30e18c,_0x1e8be8){return client[_0xcf4f('0xa')](_0x54186d,_0x11bb76)[_0xcf4f('0xb')](function(_0x4eb257){logger['info'](_0xcf4f('0xc'),_0x21a099,'request\x20sent');logger[_0xcf4f('0xd')](_0xcf4f('0xe'),_0x21a099,'request\x20sent',JSON['stringify'](_0x4eb257));if(_0x4eb257[_0xcf4f('0xf')]){if(_0x4eb257['error']['code']===0x1f4){logger[_0xcf4f('0xf')]('CmCompany,\x20%s,\x20%s',_0x21a099,_0x4eb257[_0xcf4f('0xf')]['message']);return _0x1e8be8(_0x4eb257[_0xcf4f('0xf')][_0xcf4f('0x10')]);}logger[_0xcf4f('0xf')](_0xcf4f('0xc'),_0x21a099,_0x4eb257[_0xcf4f('0xf')][_0xcf4f('0x10')]);return _0x30e18c(_0x4eb257[_0xcf4f('0xf')]['message']);}else{logger[_0xcf4f('0x11')](_0xcf4f('0xc'),_0x21a099,_0xcf4f('0x12'));_0x30e18c(_0x4eb257[_0xcf4f('0x13')][_0xcf4f('0x10')]);}})['catch'](function(_0x2a9a4e){logger['error'](_0xcf4f('0xc'),_0x21a099,_0x2a9a4e);_0x1e8be8(_0x2a9a4e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 9dce25d..35222eb 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe11a=['express','Router','fs-extra','../../components/auth/service','./cmCompany.controller','get','/describe','isAuthenticated','show','/:id/contacts','post','create','/:id','delete','destroy','util','path','connect-timeout'];(function(_0x480224,_0x4a0331){var _0x3b83e2=function(_0x1b3101){while(--_0x1b3101){_0x480224['push'](_0x480224['shift']());}};_0x3b83e2(++_0x4a0331);}(_0xe11a,0x153));var _0xae11=function(_0x5ca716,_0x3ad8f0){_0x5ca716=_0x5ca716-0x0;var _0x2176ca=_0xe11a[_0x5ca716];return _0x2176ca;};'use strict';var multer=require('multer');var util=require(_0xae11('0x0'));var path=require(_0xae11('0x1'));var timeout=require(_0xae11('0x2'));var express=require(_0xae11('0x3'));var router=express[_0xae11('0x4')]();var fs_extra=require(_0xae11('0x5'));var auth=require(_0xae11('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae11('0x7'));router[_0xae11('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae11('0x8')](_0xae11('0x9'),auth[_0xae11('0xa')](),controller['describe']);router[_0xae11('0x8')]('/:id',auth[_0xae11('0xa')](),controller[_0xae11('0xb')]);router[_0xae11('0x8')](_0xae11('0xc'),auth[_0xae11('0xa')](),controller['getContacts']);router[_0xae11('0xd')]('/',auth[_0xae11('0xa')](),controller[_0xae11('0xe')]);router[_0xae11('0xd')]('/:id/contacts',auth[_0xae11('0xa')](),controller['addContacts']);router['put'](_0xae11('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xae11('0x10')](_0xae11('0xf'),auth[_0xae11('0xa')](),controller[_0xae11('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8275=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','/describe','describe','/:id','isAuthenticated','show','post','/:id/contacts','put','update','destroy','exports','multer','path'];(function(_0x16cbfb,_0x5e858f){var _0x58e725=function(_0x1d0a63){while(--_0x1d0a63){_0x16cbfb['push'](_0x16cbfb['shift']());}};_0x58e725(++_0x5e858f);}(_0x8275,0x178));var _0x5827=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0x8275[_0x12833b];return _0x3acad3;};'use strict';var multer=require(_0x5827('0x0'));var util=require('util');var path=require(_0x5827('0x1'));var timeout=require(_0x5827('0x2'));var express=require(_0x5827('0x3'));var router=express[_0x5827('0x4')]();var fs_extra=require(_0x5827('0x5'));var auth=require(_0x5827('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5827('0x7'));var controller=require(_0x5827('0x8'));router[_0x5827('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5827('0x9')](_0x5827('0xa'),auth['isAuthenticated'](),controller[_0x5827('0xb')]);router['get'](_0x5827('0xc'),auth[_0x5827('0xd')](),controller[_0x5827('0xe')]);router[_0x5827('0x9')]('/:id/contacts',auth[_0x5827('0xd')](),controller['getContacts']);router[_0x5827('0xf')]('/',auth[_0x5827('0xd')](),controller['create']);router['post'](_0x5827('0x10'),auth[_0x5827('0xd')](),controller['addContacts']);router[_0x5827('0x11')](_0x5827('0xc'),auth[_0x5827('0xd')](),controller[_0x5827('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5827('0x13')]);module[_0x5827('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2abbb9b..b70c938 100644 --- a/server/api/cmContact/cmContact.attributes.js +++ b/server/api/cmContact/cmContact.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd421=['TEXT','INTEGER','DATE','NOW','sequelize','STRING'];(function(_0x348ff3,_0x113767){var _0x20e02c=function(_0x5a8d06){while(--_0x5a8d06){_0x348ff3['push'](_0x348ff3['shift']());}};_0x20e02c(++_0x113767);}(_0xd421,0x9a));var _0x1d42=function(_0x2462f5,_0x57fed4){_0x2462f5=_0x2462f5-0x0;var _0x226292=_0xd421[_0x2462f5];return _0x226292;};'use strict';var _=require('lodash');var Sequelize=require(_0x1d42('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x1d42('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1d42('0x1')]},'street':{'type':Sequelize[_0x1d42('0x1')]},'postalCode':{'type':Sequelize[_0x1d42('0x1')]},'city':{'type':Sequelize[_0x1d42('0x1')]},'country':{'type':Sequelize[_0x1d42('0x1')]},'dateOfBirth':{'type':Sequelize[_0x1d42('0x1')]},'description':{'type':Sequelize[_0x1d42('0x2')]},'phone':{'type':Sequelize[_0x1d42('0x1')]},'mobile':{'type':Sequelize[_0x1d42('0x1')]},'fax':{'type':Sequelize[_0x1d42('0x1')]},'email':{'type':Sequelize[_0x1d42('0x1')]},'url':{'type':Sequelize[_0x1d42('0x1')]},'facebook':{'type':Sequelize[_0x1d42('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x1d42('0x1')]},'skype':{'type':Sequelize[_0x1d42('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x1d42('0x1')]},'wechat':{'type':Sequelize[_0x1d42('0x1')]},'telegram':{'type':Sequelize[_0x1d42('0x1')]},'UserId':{'type':Sequelize[_0x1d42('0x3')]},'priority':{'type':Sequelize[_0x1d42('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1d42('0x4')],'defaultValue':Sequelize[_0x1d42('0x5')]}}; \ No newline at end of file +var _0x5e6d=['UNSIGNED','NOW','lodash','STRING','TEXT','INTEGER'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x5e6d,0x74));var _0xd5e6=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x5e6d[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xd5e6('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xd5e6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xd5e6('0x1')]},'street':{'type':Sequelize[_0xd5e6('0x1')]},'postalCode':{'type':Sequelize[_0xd5e6('0x1')]},'city':{'type':Sequelize[_0xd5e6('0x1')]},'country':{'type':Sequelize[_0xd5e6('0x1')]},'dateOfBirth':{'type':Sequelize[_0xd5e6('0x1')]},'description':{'type':Sequelize[_0xd5e6('0x2')]},'phone':{'type':Sequelize[_0xd5e6('0x1')]},'mobile':{'type':Sequelize[_0xd5e6('0x1')]},'fax':{'type':Sequelize[_0xd5e6('0x1')]},'email':{'type':Sequelize[_0xd5e6('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xd5e6('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xd5e6('0x1')]},'viber':{'type':Sequelize[_0xd5e6('0x1')]},'line':{'type':Sequelize[_0xd5e6('0x1')]},'wechat':{'type':Sequelize[_0xd5e6('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xd5e6('0x3')]},'priority':{'type':Sequelize[_0xd5e6('0x3')](0x2)[_0xd5e6('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xd5e6('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 258d04a..db4a97d 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f1f=['OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','findOrCreate','spread','error','show','find','color','$and','omit','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','getTags','rawAttributes','pick','options','setTags','ids','include','getHopperHistories','ContactId','includeAll','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','zipObject','phone','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','parse','meta','import','binding','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','chat','fax','whatsapp','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','uniqueid','source','callerid','starttime','endtime','duration','note','createdAt','userThirdDisposition','UserId','fullname','startCase','Website','Account','closed','disposition','secondDisposition','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','mail','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','slice','eml-format','rimraf','moment','bluebird','util','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','sendStatus','end','status','json','offset','limit','count','set','apply','update','then','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','CmContact','describe','keys','startsWith','cf_','CmCustomField','findOne','all','fieldType','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','tools_tags','from','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','clone','DESC','having','t.id\x20IN\x20?','resolve','some','User','c.ListId\x20IS\x20NULL','user','role','sequelize','toString','keyBy','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','push','rows','catch','params','columnName','displayName','findAll','alias','custom','values','get','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage'];(function(_0x442ccd,_0x415d61){var _0x1a2c10=function(_0x4ddd45){while(--_0x4ddd45){_0x442ccd['push'](_0x442ccd['shift']());}};_0x1a2c10(++_0x415d61);}(_0x5f1f,0x1a0));var _0xf5f1=function(_0x33c8cb,_0x56cff2){_0x33c8cb=_0x33c8cb-0x0;var _0x2d28bb=_0x5f1f[_0x33c8cb];return _0x2d28bb;};'use strict';var emlformat=require(_0xf5f1('0x0'));var rimraf=require(_0xf5f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf5f1('0x2'));var BPromise=require(_0xf5f1('0x3'));var Mustache=require('mustache');var util=require(_0xf5f1('0x4'));var path=require(_0xf5f1('0x5'));var sox=require(_0xf5f1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5f1('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf5f1('0x8'));var jsforce=require(_0xf5f1('0x9'));var deskjs=require(_0xf5f1('0xa'));var toCsv=require(_0xf5f1('0xb'));var querystring=require(_0xf5f1('0xc'));var Papa=require(_0xf5f1('0xd'));var Redis=require(_0xf5f1('0xe'));var authService=require(_0xf5f1('0xf'));var qs=require(_0xf5f1('0x10'));var as=require(_0xf5f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f1('0x12'))(_0xf5f1('0x13'));var utils=require(_0xf5f1('0x14'));var config=require(_0xf5f1('0x15'));var licenseUtil=require(_0xf5f1('0x16'));var db=require(_0xf5f1('0x17'))['db'];config[_0xf5f1('0x18')]=_['defaults'](config[_0xf5f1('0x18')],{'host':_0xf5f1('0x19'),'port':0x18eb});var socket=require(_0xf5f1('0x1a'))(new Redis(config[_0xf5f1('0x18')]));require(_0xf5f1('0x1b'))['register'](socket);function respondWithStatusCode(_0x253494,_0x5cd129){_0x5cd129=_0x5cd129||0xcc;return function(_0x438935){if(_0x438935){return _0x253494[_0xf5f1('0x1c')](_0x5cd129);}return _0x253494['status'](_0x5cd129)[_0xf5f1('0x1d')]();};}function respondWithResult(_0x8d9a30,_0x92715d){_0x92715d=_0x92715d||0xc8;return function(_0x2ed2ba){if(_0x2ed2ba){return _0x8d9a30[_0xf5f1('0x1e')](_0x92715d)[_0xf5f1('0x1f')](_0x2ed2ba);}};}function respondWithFilteredResult(_0x809f7b,_0x152a5a){return function(_0x5d1442){if(_0x5d1442){var _0x10f3cc=typeof _0x152a5a[_0xf5f1('0x20')]==='undefined'&&typeof _0x152a5a[_0xf5f1('0x21')]==='undefined';var _0x18c860=_0x5d1442[_0xf5f1('0x22')];var _0x5cd7f6=_0x10f3cc?0x0:_0x152a5a[_0xf5f1('0x20')];var _0x354de9=_0x10f3cc?_0x5d1442[_0xf5f1('0x22')]:_0x152a5a['offset']+_0x152a5a[_0xf5f1('0x21')];var _0x227e6c;if(_0x354de9>=_0x18c860){_0x354de9=_0x18c860;_0x227e6c=0xc8;}else{_0x227e6c=0xce;}_0x809f7b[_0xf5f1('0x1e')](_0x227e6c);return _0x809f7b[_0xf5f1('0x23')]('Content-Range',_0x5cd7f6+'-'+_0x354de9+'/'+_0x18c860)[_0xf5f1('0x1f')](_0x5d1442);}return null;};}function patchUpdates(_0x17d7bf){return function(_0x2fd45b){try{jsonpatch[_0xf5f1('0x24')](_0x2fd45b,_0x17d7bf,!![]);}catch(_0x43f5c5){return BPromise['reject'](_0x43f5c5);}return _0x2fd45b['save']();};}function saveUpdates(_0x4e283b,_0x3830cd){return function(_0x399480){if(_0x399480){return _0x399480[_0xf5f1('0x25')](_0x4e283b)['then'](function(_0x10e0a1){return _0x10e0a1;});}return null;};}function removeEntity(_0x1ef1ae,_0x4bd768){return function(_0x464f34){if(_0x464f34){return _0x464f34['destroy']()[_0xf5f1('0x26')](function(){_0x1ef1ae[_0xf5f1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8e28,_0x2f68b0){return function(_0x23f03e){if(!_0x23f03e){_0x4e8e28[_0xf5f1('0x1c')](0x194);}return _0x23f03e;};}function handleError(_0x44810d,_0x19c2b3){_0x19c2b3=_0x19c2b3||0x1f4;return function(_0x4de9e7){logger['error'](_0x4de9e7[_0xf5f1('0x27')]);if(_0x4de9e7[_0xf5f1('0x28')]){delete _0x4de9e7[_0xf5f1('0x28')];}_0x44810d[_0xf5f1('0x1e')](_0x19c2b3)[_0xf5f1('0x29')](_0x4de9e7);};}function getMustacheRender(_0x486006,_0x894d5e){return Mustache[_0xf5f1('0x2a')](_0x486006,_[_0xf5f1('0x2b')](_0x894d5e[_0xf5f1('0x2c')],{'contact':_0x894d5e[_0xf5f1('0x2d')],'message':_0x894d5e[_0xf5f1('0x2e')],'agent':_0x894d5e[_0xf5f1('0x2f')],'interaction':_0x894d5e[_0xf5f1('0x30')],'account':_0x894d5e[_0xf5f1('0x31')]}))||'';}exports[_0xf5f1('0x32')]=function(_0x427a2b,_0x1313a1){var _0x35396e={},_0x22518b={},_0x478493={'count':0x0,'rows':[]};return db[_0xf5f1('0x33')][_0xf5f1('0x34')]()[_0xf5f1('0x26')](function(_0x5e1b76){var _0x32ffbd=[];for(var _0x384c4e=0x0;_0x384c4e0x1){_0x49a513['or'](_0xf5f1('0x70'),qs[_0xf5f1('0x71')](_0x929c18),null);}else{if(qs['isNumeric'](_0x929c18)){_0x49a513['or'](_0xf5f1('0x72'),_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x73'),_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x74'),_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x75'),_0x929c18+'%');}else if(qs['isEmail'](_0x929c18)){_0x49a513['or']('c.email\x20LIKE\x20?',_0x929c18+'%');}else{_0x49a513['or'](_0xf5f1('0x76'),'%'+_0x929c18+'%');_0x49a513['or'](_0xf5f1('0x77'),'%'+_0x929c18+'%');_0x49a513['or']('c.email\x20LIKE\x20?','%'+_0x929c18+'%');}}}}_0x52a90e[_0xf5f1('0x48')](_0x49a513);_0x52a90e[_0xf5f1('0x78')](_0xf5f1('0x79'));var _0x373be9={'type':db[_0xf5f1('0x7a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4d82b1=_0x52a90e[_0xf5f1('0x7b')]()['field'](_0xf5f1('0x79'));if(_0x35396e[_0xf5f1('0x46')]){_0x35396e[_0xf5f1('0x46')][_0xf5f1('0x59')](function(_0x394ebc){_0x52a90e[_0xf5f1('0x46')]('c.'+_0x394ebc[0x0],_0x394ebc[0x1]===_0xf5f1('0x7c')?![]:!![]);});}if(!_[_0xf5f1('0x67')](_0xff687c)){_0x52a90e[_0xf5f1('0x7d')](_0x56986d);_0x4d82b1[_0xf5f1('0x48')](_0xf5f1('0x7e'),_0xff687c);}BPromise[_0xf5f1('0x7f')]()[_0xf5f1('0x26')](function(){if(!_0x16e470)return;if(_0x427a2b['user']['role']!==_0xf5f1('0x2f'))return;if(!_[_0xf5f1('0x80')](_0x16e470['conditions'],[_0xf5f1('0x4a'),_0xf5f1('0x81')])){return _0x427a2b['user']['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x176966){if(_[_0xf5f1('0x67')](_0x176966)){_0x4d82b1[_0xf5f1('0x48')](_0xf5f1('0x82'));_0x52a90e[_0xf5f1('0x48')](_0xf5f1('0x82'));}else{_0x4d82b1[_0xf5f1('0x48')]('c.ListId\x20IN\x20?',_[_0xf5f1('0x58')](_0x176966,'id'));_0x52a90e[_0xf5f1('0x48')](_0xf5f1('0x69'),_['map'](_0x176966,'id'));}});}})[_0xf5f1('0x26')](function(){if(_0x427a2b[_0xf5f1('0x83')][_0xf5f1('0x84')]==='agent'&&!_0x16e470&&!_0x427a2b[_0xf5f1('0x3e')][_0xf5f1('0x68')])return[];return db[_0xf5f1('0x85')][_0xf5f1('0x3e')](_0x4d82b1[_0xf5f1('0x86')](),_0x373be9);})[_0xf5f1('0x26')](function(_0x45116c){_0x478493[_0xf5f1('0x22')]=_0x45116c[_0xf5f1('0x43')];if(_0x478493[_0xf5f1('0x22')]===0x0)return[];return db['sequelize']['query'](_0x5ec80e[_0xf5f1('0x86')](),_0x373be9)[_0xf5f1('0x26')](function(_0x4c9ca5){_0x271e20=_[_0xf5f1('0x87')](_0x4c9ca5,'id');_0x373be9=_[_0xf5f1('0x2b')](_0x373be9,{'model':db[_0xf5f1('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x427a2b[_0xf5f1('0x3e')][_0xf5f1('0x42')]){_0x35396e[_0xf5f1('0x41')][_0xf5f1('0x59')](function(_0x584b9b){_0x52a90e['field']('c.'+_0x584b9b);});}else{_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x79'));_0x52a90e['field']('c.firstName');_0x52a90e['field']('c.lastName');_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x88'));_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x89'));_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x8a'));_0x52a90e[_0xf5f1('0x4a')]('c.email');_0x52a90e['field'](_0xf5f1('0x8b'));_0x52a90e[_0xf5f1('0x4a')](_0xf5f1('0x8c'));_0x52a90e['field']('c.deletedAt');_0x52a90e[_0xf5f1('0x4a')]('c.CompanyId');_0x52a90e['field'](_0xf5f1('0x8d'),'TagIds');}if(_0x35396e[_0xf5f1('0x21')])_0x52a90e[_0xf5f1('0x21')](_0x35396e[_0xf5f1('0x21')]);if(_0x35396e['offset'])_0x52a90e[_0xf5f1('0x20')](_0x35396e[_0xf5f1('0x20')]);return db[_0xf5f1('0x85')][_0xf5f1('0x3e')](_0x52a90e[_0xf5f1('0x86')](),_0x373be9);});})['then'](function(_0x101c06){_0x101c06[_0xf5f1('0x59')](function(_0x5ca476){if(_0x5ca476[_0xf5f1('0x8e')]){_0x5ca476[_0xf5f1('0x8f')]=[];_0x5ca476[_0xf5f1('0x8e')]['split'](',')['forEach'](function(_0xd5d21d){_0x5ca476[_0xf5f1('0x8f')][_0xf5f1('0x90')](_0x271e20[_0xd5d21d]);});}delete _0x5ca476[_0xf5f1('0x8e')];});_0x478493[_0xf5f1('0x91')]=_0x101c06;return _0x478493;})[_0xf5f1('0x26')](respondWithFilteredResult(_0x1313a1,_0x35396e));})[_0xf5f1('0x92')](handleError(_0x1313a1,null));};exports['destroy']=function(_0x2d427b,_0x2712cd){return db['CmContact']['find']({'where':{'id':_0x2d427b[_0xf5f1('0x93')]['id']}})[_0xf5f1('0x26')](handleEntityNotFound(_0x2712cd,null))[_0xf5f1('0x26')](removeEntity(_0x2712cd,null))[_0xf5f1('0x92')](handleError(_0x2712cd,null));};exports[_0xf5f1('0x34')]=function(_0x389f45,_0x65df33){return db[_0xf5f1('0x33')][_0xf5f1('0x34')]()[_0xf5f1('0x26')](function(_0x17eda1){delete _0x17eda1['tags'];for(var _0x3eb57b=0x0;_0x3eb57b=_0x3c7d3f){_0x406dce=_0x3c7d3f;_0x223892=0xc8;}else{_0x223892=0xce;}_0x5eb446[_0xbc81('0x1e')](_0x223892);return _0x5eb446[_0xbc81('0x25')](_0xbc81('0x26'),_0x282b54+'-'+_0x406dce+'/'+_0x3c7d3f)[_0xbc81('0x20')](_0x39e431);}return null;};}function patchUpdates(_0x36d7fc){return function(_0xc079ac){try{jsonpatch[_0xbc81('0x27')](_0xc079ac,_0x36d7fc,!![]);}catch(_0x5cfe8d){return BPromise[_0xbc81('0x28')](_0x5cfe8d);}return _0xc079ac[_0xbc81('0x29')]();};}function saveUpdates(_0x4bd566,_0x33cc98){return function(_0x51f16f){if(_0x51f16f){return _0x51f16f[_0xbc81('0x2a')](_0x4bd566)['then'](function(_0x422b8f){return _0x422b8f;});}return null;};}function removeEntity(_0xf607dd,_0x5df1fa){return function(_0x26d1ae){if(_0x26d1ae){return _0x26d1ae[_0xbc81('0x2b')]()['then'](function(){_0xf607dd[_0xbc81('0x1e')](0xcc)[_0xbc81('0x1f')]();});}};}function handleEntityNotFound(_0x2b330d,_0x27150a){return function(_0x331300){if(!_0x331300){_0x2b330d[_0xbc81('0x1d')](0x194);}return _0x331300;};}function handleError(_0x2179a4,_0x2e44be){_0x2e44be=_0x2e44be||0x1f4;return function(_0x5b0ec3){logger[_0xbc81('0x2c')](_0x5b0ec3[_0xbc81('0x2d')]);if(_0x5b0ec3[_0xbc81('0x2e')]){delete _0x5b0ec3[_0xbc81('0x2e')];}_0x2179a4[_0xbc81('0x1e')](_0x2e44be)[_0xbc81('0x2f')](_0x5b0ec3);};}function getMustacheRender(_0x104688,_0x286f2e){return Mustache['render'](_0x104688,_[_0xbc81('0x30')](_0x286f2e[_0xbc81('0x31')],{'contact':_0x286f2e[_0xbc81('0x32')],'message':_0x286f2e['message'],'agent':_0x286f2e[_0xbc81('0x33')],'interaction':_0x286f2e[_0xbc81('0x34')],'account':_0x286f2e[_0xbc81('0x35')]}))||'';}exports[_0xbc81('0x36')]=function(_0x1e7ef3,_0x3492af){var _0x4386c1={},_0x2c8f41={},_0x1b8df2={'count':0x0,'rows':[]};return db[_0xbc81('0x37')]['describe']()[_0xbc81('0x38')](function(_0x172533){var _0x4c813b=[];for(var _0x32a679=0x0;_0x32a6790x1){_0x2ff792['or'](_0xbc81('0x78'),qs['getFullTextValue'](_0x2672b3),null);}else{if(qs[_0xbc81('0x79')](_0x2672b3)){_0x2ff792['or'](_0xbc81('0x7a'),_0x2672b3+'%');_0x2ff792['or'](_0xbc81('0x7b'),_0x2672b3+'%');_0x2ff792['or'](_0xbc81('0x7c'),_0x2672b3+'%');_0x2ff792['or']('c.fax\x20LIKE\x20?',_0x2672b3+'%');}else if(qs['isEmail'](_0x2672b3)){_0x2ff792['or'](_0xbc81('0x7d'),_0x2672b3+'%');}else{_0x2ff792['or'](_0xbc81('0x7e'),'%'+_0x2672b3+'%');_0x2ff792['or']('c.lastName\x20LIKE\x20?','%'+_0x2672b3+'%');_0x2ff792['or'](_0xbc81('0x7d'),'%'+_0x2672b3+'%');}}}}_0x4925fa[_0xbc81('0x4b')](_0x2ff792);_0x4925fa[_0xbc81('0x7f')]('c.id');var _0x5eb566={'type':db[_0xbc81('0x80')][_0xbc81('0x81')]['SELECT'],'raw':!![]};var _0xa9f714=_0x4925fa['clone']()[_0xbc81('0x4e')](_0xbc81('0x82'));if(_0x4386c1['order']){_0x4386c1[_0xbc81('0x49')][_0xbc81('0x62')](function(_0xa94733){_0x4925fa[_0xbc81('0x49')]('c.'+_0xa94733[0x0],_0xa94733[0x1]===_0xbc81('0x83')?![]:!![]);});}if(!_[_0xbc81('0x70')](_0x58c6cc)){_0x4925fa[_0xbc81('0x84')](_0x168063);_0xa9f714[_0xbc81('0x4b')]('t.id\x20IN\x20?',_0x58c6cc);}BPromise['resolve']()[_0xbc81('0x38')](function(){if(!_0x2529e6)return;if(_0x1e7ef3['user'][_0xbc81('0x85')]!==_0xbc81('0x33'))return;if(!_[_0xbc81('0x86')](_0x2529e6[_0xbc81('0x5c')],[_0xbc81('0x4e'),_0xbc81('0x65')])){return _0x1e7ef3['user'][_0xbc81('0x87')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1dba70){if(_['isEmpty'](_0x1dba70)){_0xa9f714[_0xbc81('0x4b')](_0xbc81('0x88'));_0x4925fa['where']('c.ListId\x20IS\x20NULL');}else{_0xa9f714[_0xbc81('0x4b')](_0xbc81('0x72'),_[_0xbc81('0x61')](_0x1dba70,'id'));_0x4925fa[_0xbc81('0x4b')](_0xbc81('0x72'),_[_0xbc81('0x61')](_0x1dba70,'id'));}});}})[_0xbc81('0x38')](function(){if(_0x1e7ef3['user'][_0xbc81('0x85')]===_0xbc81('0x33')&&!_0x2529e6&&!_0x1e7ef3[_0xbc81('0x43')][_0xbc81('0x71')])return[];return db[_0xbc81('0x89')][_0xbc81('0x43')](_0xa9f714[_0xbc81('0x8a')](),_0x5eb566);})['then'](function(_0x81275d){_0x1b8df2[_0xbc81('0x24')]=_0x81275d[_0xbc81('0x3a')];if(_0x1b8df2[_0xbc81('0x24')]===0x0)return[];return db[_0xbc81('0x89')][_0xbc81('0x43')](_0x91e0c2[_0xbc81('0x8a')](),_0x5eb566)[_0xbc81('0x38')](function(_0x45ec48){_0x4b493a=_[_0xbc81('0x8b')](_0x45ec48,'id');_0x5eb566=_[_0xbc81('0x30')](_0x5eb566,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e7ef3[_0xbc81('0x43')]['fields']){_0x4386c1[_0xbc81('0x46')][_0xbc81('0x62')](function(_0x541e27){_0x4925fa[_0xbc81('0x4e')]('c.'+_0x541e27);});}else{_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x82'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x8c'));_0x4925fa['field'](_0xbc81('0x8d'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x8e'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x8f'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x90'));_0x4925fa['field'](_0xbc81('0x91'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x92'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x93'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x94'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x95'));_0x4925fa[_0xbc81('0x4e')](_0xbc81('0x96'),'TagIds');}if(_0x4386c1[_0xbc81('0x23')])_0x4925fa[_0xbc81('0x23')](_0x4386c1['limit']);if(_0x4386c1[_0xbc81('0x21')])_0x4925fa[_0xbc81('0x21')](_0x4386c1[_0xbc81('0x21')]);return db[_0xbc81('0x89')][_0xbc81('0x43')](_0x4925fa[_0xbc81('0x8a')](),_0x5eb566);});})[_0xbc81('0x38')](function(_0x55f10c){_0x55f10c['forEach'](function(_0x1a4de3){if(_0x1a4de3[_0xbc81('0x97')]){_0x1a4de3['Tags']=[];_0x1a4de3['TagIds']['split'](',')[_0xbc81('0x62')](function(_0x4c291a){_0x1a4de3['Tags'][_0xbc81('0x3d')](_0x4b493a[_0x4c291a]);});}delete _0x1a4de3[_0xbc81('0x97')];});_0x1b8df2[_0xbc81('0x98')]=_0x55f10c;return _0x1b8df2;})[_0xbc81('0x38')](respondWithFilteredResult(_0x3492af,_0x4386c1));})[_0xbc81('0x99')](handleError(_0x3492af,null));};exports[_0xbc81('0x2b')]=function(_0x125dfc,_0x23dc6c){return db[_0xbc81('0x37')]['find']({'where':{'id':_0x125dfc[_0xbc81('0x9a')]['id']}})[_0xbc81('0x38')](handleEntityNotFound(_0x23dc6c,null))[_0xbc81('0x38')](removeEntity(_0x23dc6c,null))['catch'](handleError(_0x23dc6c,null));};exports[_0xbc81('0x9b')]=function(_0x59b37b,_0x41f137){return db['CmContact'][_0xbc81('0x9b')]()[_0xbc81('0x38')](function(_0xee9f3){delete _0xee9f3[_0xbc81('0x9c')];for(var _0x80edbd=0x0;_0x80edbd{}\s\\|]/g,'-');_0x7b2015(null,util[_0x1a04('0x24')](_0x1a04('0x25'),path[_0x1a04('0x26')](_0x5d147a[_0x1a04('0x22')],path['extname'](_0x5d147a[_0x1a04('0x22')])),Date['now'](),path['extname'](_0x5d147a[_0x1a04('0x22')])));}})});router[_0x1a04('0x18')](_0x1a04('0x27'),upload[_0x1a04('0x28')]('file'),controller[_0x1a04('0x29')]);var upload=multer({'storage':multer[_0x1a04('0x1e')]({'destination':function(_0x3688dc,_0x3e1a6a,_0x1bb6db){_0x1bb6db(null,path[_0x1a04('0x1f')](config['root'],_0x1a04('0x21')));},'filename':function(_0x3b2bf8,_0x2762e9,_0x4c3af1){_0x2762e9['originalname']=_0x2762e9[_0x1a04('0x22')][_0x1a04('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4c3af1(null,util[_0x1a04('0x24')](_0x1a04('0x25'),path[_0x1a04('0x26')](_0x2762e9[_0x1a04('0x22')],path[_0x1a04('0x2a')](_0x2762e9[_0x1a04('0x22')])),Date[_0x1a04('0x2b')](),path[_0x1a04('0x2a')](_0x2762e9[_0x1a04('0x22')])));}})});router['post'](_0x1a04('0x2c'),upload['single'](_0x1a04('0x2d')),controller[_0x1a04('0x2e')]);router[_0x1a04('0x18')](_0x1a04('0x2f'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x30')]);router[_0x1a04('0x31')](_0x1a04('0xd'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x32')]);router[_0x1a04('0x33')](_0x1a04('0xd'),auth[_0x1a04('0xa')](),controller[_0x1a04('0x34')]);module[_0x1a04('0x35')]=router; \ No newline at end of file +var _0xfa28=['getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','create','/create_many','bulkCreate','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','uploadCsv','file','upload','/upload/:id','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/tags'];(function(_0x2bfbe9,_0x302e1a){var _0x23f804=function(_0x53aad2){while(--_0x53aad2){_0x2bfbe9['push'](_0x2bfbe9['shift']());}};_0x23f804(++_0x302e1a);}(_0xfa28,0x1e7));var _0x8fa2=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xfa28[_0x45bf86];return _0x1f02b7;};'use strict';var multer=require(_0x8fa2('0x0'));var util=require(_0x8fa2('0x1'));var path=require('path');var timeout=require(_0x8fa2('0x2'));var express=require(_0x8fa2('0x3'));var router=express[_0x8fa2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8fa2('0x5'));var interaction=require(_0x8fa2('0x6'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0x8fa2('0x7')]('/',auth[_0x8fa2('0x8')](),controller['index']);router[_0x8fa2('0x7')](_0x8fa2('0x9'),auth['isAuthenticated'](),controller[_0x8fa2('0xa')]);router['get'](_0x8fa2('0xb'),auth[_0x8fa2('0x8')](),controller['show']);router['get'](_0x8fa2('0xc'),auth[_0x8fa2('0x8')](),controller[_0x8fa2('0xd')]);router[_0x8fa2('0x7')](_0x8fa2('0xe'),auth[_0x8fa2('0x8')](),controller[_0x8fa2('0xf')]);router[_0x8fa2('0x7')](_0x8fa2('0x10'),auth['isAuthenticated'](),controller[_0x8fa2('0x11')]);router['get'](_0x8fa2('0x12'),auth[_0x8fa2('0x8')](),controller[_0x8fa2('0x13')]);router[_0x8fa2('0x7')](_0x8fa2('0x14'),auth[_0x8fa2('0x8')](),controller[_0x8fa2('0x15')]);router[_0x8fa2('0x7')](_0x8fa2('0x16'),auth['isAuthenticated'](),controller[_0x8fa2('0x17')]);router[_0x8fa2('0x18')](_0x8fa2('0x19'),auth[_0x8fa2('0x8')](),controller['merge']);router['post']('/',auth[_0x8fa2('0x8')](),controller[_0x8fa2('0x1a')]);router['post'](_0x8fa2('0x1b'),auth[_0x8fa2('0x8')](),controller[_0x8fa2('0x1c')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller['setTags']);var upload=multer({'storage':multer[_0x8fa2('0x1d')]({'destination':function(_0x521280,_0x3601e7,_0x37483e){_0x37483e(null,path[_0x8fa2('0x1e')](config[_0x8fa2('0x1f')],_0x8fa2('0x20')));},'filename':function(_0x5a6f4a,_0x4431c6,_0x292a3d){_0x4431c6['originalname']=_0x4431c6[_0x8fa2('0x21')][_0x8fa2('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x292a3d(null,util[_0x8fa2('0x23')](_0x8fa2('0x24'),path[_0x8fa2('0x25')](_0x4431c6[_0x8fa2('0x21')],path[_0x8fa2('0x26')](_0x4431c6['originalname'])),Date[_0x8fa2('0x27')](),path[_0x8fa2('0x26')](_0x4431c6['originalname'])));}})});router[_0x8fa2('0x18')](_0x8fa2('0x28'),upload[_0x8fa2('0x29')]('file'),controller[_0x8fa2('0x2a')]);var upload=multer({'storage':multer[_0x8fa2('0x1d')]({'destination':function(_0x39f06b,_0x25d1e7,_0x49f8aa){_0x49f8aa(null,path[_0x8fa2('0x1e')](config['root'],_0x8fa2('0x20')));},'filename':function(_0x4e5122,_0x1840ba,_0x373006){_0x1840ba[_0x8fa2('0x21')]=_0x1840ba[_0x8fa2('0x21')][_0x8fa2('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x373006(null,util['format'](_0x8fa2('0x24'),path[_0x8fa2('0x25')](_0x1840ba[_0x8fa2('0x21')],path[_0x8fa2('0x26')](_0x1840ba['originalname'])),Date[_0x8fa2('0x27')](),path[_0x8fa2('0x26')](_0x1840ba[_0x8fa2('0x21')])));}})});router['post']('/upload',upload[_0x8fa2('0x29')](_0x8fa2('0x2b')),controller[_0x8fa2('0x2c')]);router['post'](_0x8fa2('0x2d'),auth[_0x8fa2('0x8')](),controller['import']);router[_0x8fa2('0x2e')](_0x8fa2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8fa2('0x2f')](_0x8fa2('0xb'),auth[_0x8fa2('0x8')](),controller[_0x8fa2('0x30')]);module[_0x8fa2('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 97ffe82..c6b399a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8aa5=['INTEGER','PHONE','sequelize','exports'];(function(_0x5608c8,_0x5cd32a){var _0x34572d=function(_0x52483d){while(--_0x52483d){_0x5608c8['push'](_0x5608c8['shift']());}};_0x34572d(++_0x5cd32a);}(_0x8aa5,0x13e));var _0x58aa=function(_0x1dca7f,_0x2e101a){_0x1dca7f=_0x1dca7f-0x0;var _0x4abf6a=_0x8aa5[_0x1dca7f];return _0x4abf6a;};'use strict';var Sequelize=require(_0x58aa('0x0'));module[_0x58aa('0x1')]={'CmContactId':{'type':Sequelize[_0x58aa('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x58aa('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x58aa('0x3')},'OrderBy':{'type':Sequelize[_0x58aa('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x9ce7=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x1f70f7,_0x24b161){var _0x189b1f=function(_0x2543bb){while(--_0x2543bb){_0x1f70f7['push'](_0x1f70f7['shift']());}};_0x189b1f(++_0x24b161);}(_0x9ce7,0x11f));var _0x79ce=function(_0x50f9c9,_0x444601){_0x50f9c9=_0x50f9c9-0x0;var _0x41d680=_0x9ce7[_0x50f9c9];return _0x41d680;};'use strict';var Sequelize=require(_0x79ce('0x0'));module[_0x79ce('0x1')]={'CmContactId':{'type':Sequelize[_0x79ce('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x79ce('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x79ce('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x79ce('0x3')],'defaultValue':_0x79ce('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x79ce('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index e5a0b83..983542f 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x808b=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmContactHasItem','includeAll','include','findAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','body','contact','message','interaction','account','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x808b,0xd3));var _0xb808=function(_0x10393a,_0x2371f2){_0x10393a=_0x10393a-0x0;var _0x4eba0b=_0x808b[_0x10393a];return _0x4eba0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb808('0x0'));var jsonpatch=require(_0xb808('0x1'));var rp=require(_0xb808('0x2'));var moment=require(_0xb808('0x3'));var BPromise=require(_0xb808('0x4'));var Mustache=require(_0xb808('0x5'));var util=require(_0xb808('0x6'));var path=require(_0xb808('0x7'));var sox=require(_0xb808('0x8'));var csv=require(_0xb808('0x9'));var ejs=require(_0xb808('0xa'));var fs=require('fs');var fs_extra=require(_0xb808('0xb'));var _=require(_0xb808('0xc'));var squel=require('squel');var crypto=require(_0xb808('0xd'));var jsforce=require(_0xb808('0xe'));var deskjs=require(_0xb808('0xf'));var toCsv=require(_0xb808('0x9'));var querystring=require('querystring');var Papa=require(_0xb808('0x10'));var Redis=require('ioredis');var authService=require(_0xb808('0x11'));var qs=require(_0xb808('0x12'));var as=require(_0xb808('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb808('0x14'))(_0xb808('0x15'));var utils=require(_0xb808('0x16'));var config=require(_0xb808('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f13ae,_0xd2e0b2){_0xd2e0b2=_0xd2e0b2||0xcc;return function(_0x255c08){if(_0x255c08){return _0x4f13ae[_0xb808('0x18')](_0xd2e0b2);}return _0x4f13ae[_0xb808('0x19')](_0xd2e0b2)[_0xb808('0x1a')]();};}function respondWithResult(_0x14f70e,_0x188e47){_0x188e47=_0x188e47||0xc8;return function(_0x273237){if(_0x273237){return _0x14f70e[_0xb808('0x19')](_0x188e47)[_0xb808('0x1b')](_0x273237);}};}function respondWithFilteredResult(_0x115ce8,_0x2b32dd){return function(_0x521f75){if(_0x521f75){var _0x329c57=typeof _0x2b32dd[_0xb808('0x1c')]===_0xb808('0x1d')&&typeof _0x2b32dd[_0xb808('0x1e')]===_0xb808('0x1d');var _0x33c917=_0x521f75[_0xb808('0x1f')];var _0x5b70e0=_0x329c57?0x0:_0x2b32dd['offset'];var _0x5662bf=_0x329c57?_0x521f75['count']:_0x2b32dd['offset']+_0x2b32dd[_0xb808('0x1e')];var _0x33b7f0;if(_0x5662bf>=_0x33c917){_0x5662bf=_0x33c917;_0x33b7f0=0xc8;}else{_0x33b7f0=0xce;}_0x115ce8[_0xb808('0x19')](_0x33b7f0);return _0x115ce8[_0xb808('0x20')](_0xb808('0x21'),_0x5b70e0+'-'+_0x5662bf+'/'+_0x33c917)[_0xb808('0x1b')](_0x521f75);}return null;};}function patchUpdates(_0x476461){return function(_0x1a5573){try{jsonpatch[_0xb808('0x22')](_0x1a5573,_0x476461,!![]);}catch(_0x525c8c){return BPromise[_0xb808('0x23')](_0x525c8c);}return _0x1a5573[_0xb808('0x24')]();};}function saveUpdates(_0x552003,_0x367e2d){return function(_0x50637a){if(_0x50637a){return _0x50637a[_0xb808('0x25')](_0x552003)[_0xb808('0x26')](function(_0x269829){return _0x269829;});}return null;};}function removeEntity(_0x515704,_0x59d294){return function(_0x46eef1){if(_0x46eef1){return _0x46eef1[_0xb808('0x27')]()['then'](function(){var _0x2a8491=_0x46eef1['get']({'plain':!![]});var _0x48988f='CmContactHasItems';return db[_0xb808('0x28')][_0xb808('0x27')]({'where':{'type':_0x48988f,'resourceId':_0x2a8491['id']}})[_0xb808('0x26')](function(){return _0x46eef1;});})[_0xb808('0x26')](function(){_0x515704['status'](0xcc)[_0xb808('0x1a')]();});}};}function handleEntityNotFound(_0x3f29e9,_0x283bd6){return function(_0x3440e3){if(!_0x3440e3){_0x3f29e9[_0xb808('0x18')](0x194);}return _0x3440e3;};}function handleError(_0x35b7a7,_0x88237c){_0x88237c=_0x88237c||0x1f4;return function(_0x567245){logger['error'](_0x567245[_0xb808('0x29')]);if(_0x567245[_0xb808('0x2a')]){delete _0x567245[_0xb808('0x2a')];}_0x35b7a7[_0xb808('0x19')](_0x88237c)[_0xb808('0x2b')](_0x567245);};}function getMustacheRender(_0x38e78b,_0x349a80){return Mustache['render'](_0x38e78b,_['merge'](_0x349a80[_0xb808('0x2c')],{'contact':_0x349a80[_0xb808('0x2d')],'message':_0x349a80[_0xb808('0x2e')],'agent':_0x349a80['agent'],'interaction':_0x349a80[_0xb808('0x2f')],'account':_0x349a80[_0xb808('0x30')]}))||'';}exports[_0xb808('0x31')]=function(_0x4886e0,_0x4accd1){var _0x27cf4e={},_0x689acd={},_0x5205e3={'count':0x0,'rows':[]};var _0x40bf73=_[_0xb808('0x32')](db['CmContactHasItem'][_0xb808('0x33')],function(_0xa973e8){return{'name':_0xa973e8['fieldName'],'type':_0xa973e8[_0xb808('0x34')]['key']};});_0x689acd['model']=_[_0xb808('0x32')](_0x40bf73,_0xb808('0x2a'));_0x689acd[_0xb808('0x35')]=_[_0xb808('0x36')](_0x4886e0[_0xb808('0x35')]);_0x689acd[_0xb808('0x37')]=_[_0xb808('0x38')](_0x689acd[_0xb808('0x39')],_0x689acd['query']);_0x27cf4e[_0xb808('0x3a')]=_['intersection'](_0x689acd[_0xb808('0x39')],qs[_0xb808('0x3b')](_0x4886e0[_0xb808('0x35')][_0xb808('0x3b')]));_0x27cf4e[_0xb808('0x3a')]=_0x27cf4e[_0xb808('0x3a')][_0xb808('0x3c')]?_0x27cf4e[_0xb808('0x3a')]:_0x689acd[_0xb808('0x39')];if(!_0x4886e0[_0xb808('0x35')][_0xb808('0x3d')](_0xb808('0x3e'))){_0x27cf4e['limit']=qs['limit'](_0x4886e0['query'][_0xb808('0x1e')]);_0x27cf4e['offset']=qs['offset'](_0x4886e0[_0xb808('0x35')][_0xb808('0x1c')]);}_0x27cf4e[_0xb808('0x3f')]=qs[_0xb808('0x40')](_0x4886e0[_0xb808('0x35')][_0xb808('0x40')]);_0x27cf4e[_0xb808('0x41')]=qs[_0xb808('0x37')](_[_0xb808('0x42')](_0x4886e0['query'],_0x689acd[_0xb808('0x37')]),_0x40bf73);if(_0x4886e0[_0xb808('0x35')]['filter']){_0x27cf4e[_0xb808('0x41')]=_[_0xb808('0x43')](_0x27cf4e[_0xb808('0x41')],{'$or':_[_0xb808('0x32')](_0x40bf73,function(_0x15cf60){if(_0x15cf60[_0xb808('0x34')]!==_0xb808('0x44')){var _0x177876={};_0x177876[_0x15cf60['name']]={'$like':'%'+_0x4886e0[_0xb808('0x35')][_0xb808('0x45')]+'%'};return _0x177876;}})});}_0x27cf4e=_[_0xb808('0x43')]({},_0x27cf4e,_0x4886e0[_0xb808('0x46')]);var _0x3d5c78={'where':_0x27cf4e['where']};return db[_0xb808('0x47')][_0xb808('0x1f')](_0x3d5c78)[_0xb808('0x26')](function(_0x302cbc){_0x5205e3[_0xb808('0x1f')]=_0x302cbc;if(_0x4886e0[_0xb808('0x35')][_0xb808('0x48')]){_0x27cf4e[_0xb808('0x49')]=[{'all':!![]}];}return db[_0xb808('0x47')][_0xb808('0x4a')](_0x27cf4e);})[_0xb808('0x26')](function(_0x4ef3ec){_0x5205e3[_0xb808('0x4b')]=_0x4ef3ec;return _0x5205e3;})[_0xb808('0x26')](respondWithFilteredResult(_0x4accd1,_0x27cf4e))['catch'](handleError(_0x4accd1,null));};exports[_0xb808('0x4c')]=function(_0x683b6,_0x3d9081){var _0x499879={'raw':!![],'where':{'id':_0x683b6[_0xb808('0x4d')]['id']}},_0x2c2ec7={};_0x2c2ec7['model']=_[_0xb808('0x36')](db[_0xb808('0x47')]['rawAttributes']);_0x2c2ec7['query']=_['keys'](_0x683b6['query']);_0x2c2ec7[_0xb808('0x37')]=_['intersection'](_0x2c2ec7[_0xb808('0x39')],_0x2c2ec7[_0xb808('0x35')]);_0x499879[_0xb808('0x3a')]=_['intersection'](_0x2c2ec7['model'],qs[_0xb808('0x3b')](_0x683b6[_0xb808('0x35')]['fields']));_0x499879[_0xb808('0x3a')]=_0x499879[_0xb808('0x3a')][_0xb808('0x3c')]?_0x499879[_0xb808('0x3a')]:_0x2c2ec7[_0xb808('0x39')];if(_0x683b6[_0xb808('0x35')][_0xb808('0x48')]){_0x499879['include']=[{'all':!![]}];}_0x499879=_['merge']({},_0x499879,_0x683b6[_0xb808('0x46')]);return db[_0xb808('0x47')][_0xb808('0x4e')](_0x499879)[_0xb808('0x26')](handleEntityNotFound(_0x3d9081,null))[_0xb808('0x26')](respondWithResult(_0x3d9081,null))[_0xb808('0x4f')](handleError(_0x3d9081,null));};exports[_0xb808('0x50')]=function(_0x11808c,_0x18e6e4){return db['CmContactHasItem']['create'](_0x11808c['body'],{})[_0xb808('0x26')](function(_0x5b69c6){var _0x478689=_0x11808c['user']['get']({'plain':!![]});if(!_0x478689)throw new Error(_0xb808('0x51'));if(_0x478689[_0xb808('0x52')]===_0xb808('0x53')){var _0x5cff96=_0x5b69c6[_0xb808('0x54')]({'plain':!![]});var _0x5e64da=_0xb808('0x55');return db[_0xb808('0x56')][_0xb808('0x4e')]({'where':{'name':_0x5e64da,'userProfileId':_0x478689[_0xb808('0x57')]},'raw':!![]})[_0xb808('0x26')](function(_0x5d8b41){if(_0x5d8b41&&_0x5d8b41[_0xb808('0x58')]===0x0){return db[_0xb808('0x28')]['create']({'name':_0x5cff96[_0xb808('0x2a')],'resourceId':_0x5cff96['id'],'type':_0x5d8b41['name'],'sectionId':_0x5d8b41['id']},{})[_0xb808('0x26')](function(){return _0x5b69c6;});}else{return _0x5b69c6;}})['catch'](function(_0x588720){logger[_0xb808('0x59')](_0xb808('0x5a'),_0x588720);throw _0x588720;});}return _0x5b69c6;})['then'](respondWithResult(_0x18e6e4,0xc9))['catch'](handleError(_0x18e6e4,null));};exports['update']=function(_0x2c7a33,_0x299fdf){if(_0x2c7a33[_0xb808('0x2c')]['id']){delete _0x2c7a33['body']['id'];}return db[_0xb808('0x47')][_0xb808('0x4e')]({'where':{'id':_0x2c7a33['params']['id']}})[_0xb808('0x26')](handleEntityNotFound(_0x299fdf,null))[_0xb808('0x26')](saveUpdates(_0x2c7a33[_0xb808('0x2c')],null))['then'](respondWithResult(_0x299fdf,null))[_0xb808('0x4f')](handleError(_0x299fdf,null));};exports['destroy']=function(_0x4bff18,_0x2d98e8){return db[_0xb808('0x47')][_0xb808('0x4e')]({'where':{'id':_0x4bff18[_0xb808('0x4d')]['id']}})[_0xb808('0x26')](handleEntityNotFound(_0x2d98e8,null))[_0xb808('0x26')](removeEntity(_0x2d98e8,null))['catch'](handleError(_0x2d98e8,null));}; \ No newline at end of file +var _0xfe27=['UserProfileResource','error','name','merge','body','message','index','map','CmContactHasItem','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','catch','show','params','rawAttributes','keys','includeAll','include','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','CmContactHasItems'];(function(_0x5483d2,_0x49c98d){var _0x157947=function(_0x3f8fb4){while(--_0x3f8fb4){_0x5483d2['push'](_0x5483d2['shift']());}};_0x157947(++_0x49c98d);}(_0xfe27,0x82));var _0x7fe2=function(_0x44e491,_0x1e7815){_0x44e491=_0x44e491-0x0;var _0x155f9e=_0xfe27[_0x44e491];return _0x155f9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fe2('0x0'));var zipdir=require(_0x7fe2('0x1'));var jsonpatch=require(_0x7fe2('0x2'));var rp=require(_0x7fe2('0x3'));var moment=require('moment');var BPromise=require(_0x7fe2('0x4'));var Mustache=require(_0x7fe2('0x5'));var util=require(_0x7fe2('0x6'));var path=require(_0x7fe2('0x7'));var sox=require(_0x7fe2('0x8'));var csv=require(_0x7fe2('0x9'));var ejs=require(_0x7fe2('0xa'));var fs=require('fs');var fs_extra=require(_0x7fe2('0xb'));var _=require('lodash');var squel=require(_0x7fe2('0xc'));var crypto=require('crypto');var jsforce=require(_0x7fe2('0xd'));var deskjs=require(_0x7fe2('0xe'));var toCsv=require(_0x7fe2('0x9'));var querystring=require(_0x7fe2('0xf'));var Papa=require(_0x7fe2('0x10'));var Redis=require(_0x7fe2('0x11'));var authService=require(_0x7fe2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7fe2('0x13'));var hardwareService=require(_0x7fe2('0x14'));var logger=require(_0x7fe2('0x15'))('api');var utils=require(_0x7fe2('0x16'));var config=require(_0x7fe2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32acb4,_0x442b1e){_0x442b1e=_0x442b1e||0xcc;return function(_0x16a70d){if(_0x16a70d){return _0x32acb4[_0x7fe2('0x18')](_0x442b1e);}return _0x32acb4['status'](_0x442b1e)[_0x7fe2('0x19')]();};}function respondWithResult(_0x47e516,_0x1b5168){_0x1b5168=_0x1b5168||0xc8;return function(_0x1e8336){if(_0x1e8336){return _0x47e516[_0x7fe2('0x1a')](_0x1b5168)[_0x7fe2('0x1b')](_0x1e8336);}};}function respondWithFilteredResult(_0x1dbfa4,_0x10f6a0){return function(_0x1f6b69){if(_0x1f6b69){var _0x2e0bef=typeof _0x10f6a0[_0x7fe2('0x1c')]===_0x7fe2('0x1d')&&typeof _0x10f6a0['limit']===_0x7fe2('0x1d');var _0x540d7b=_0x1f6b69[_0x7fe2('0x1e')];var _0x399a28=_0x2e0bef?0x0:_0x10f6a0[_0x7fe2('0x1c')];var _0x3251fd=_0x2e0bef?_0x1f6b69[_0x7fe2('0x1e')]:_0x10f6a0[_0x7fe2('0x1c')]+_0x10f6a0[_0x7fe2('0x1f')];var _0xe4d502;if(_0x3251fd>=_0x540d7b){_0x3251fd=_0x540d7b;_0xe4d502=0xc8;}else{_0xe4d502=0xce;}_0x1dbfa4['status'](_0xe4d502);return _0x1dbfa4[_0x7fe2('0x20')](_0x7fe2('0x21'),_0x399a28+'-'+_0x3251fd+'/'+_0x540d7b)[_0x7fe2('0x1b')](_0x1f6b69);}return null;};}function patchUpdates(_0x2d5a60){return function(_0x302424){try{jsonpatch[_0x7fe2('0x22')](_0x302424,_0x2d5a60,!![]);}catch(_0x254420){return BPromise[_0x7fe2('0x23')](_0x254420);}return _0x302424['save']();};}function saveUpdates(_0x4b35c2,_0x57c813){return function(_0x2da447){if(_0x2da447){return _0x2da447['update'](_0x4b35c2)[_0x7fe2('0x24')](function(_0x53e2c3){return _0x53e2c3;});}return null;};}function removeEntity(_0x1851dd,_0x429fff){return function(_0xdce4d6){if(_0xdce4d6){return _0xdce4d6[_0x7fe2('0x25')]()['then'](function(){var _0x2e7bda=_0xdce4d6[_0x7fe2('0x26')]({'plain':!![]});var _0x55c821=_0x7fe2('0x27');return db[_0x7fe2('0x28')][_0x7fe2('0x25')]({'where':{'type':_0x55c821,'resourceId':_0x2e7bda['id']}})[_0x7fe2('0x24')](function(){return _0xdce4d6;});})[_0x7fe2('0x24')](function(){_0x1851dd['status'](0xcc)[_0x7fe2('0x19')]();});}};}function handleEntityNotFound(_0x4fcba5,_0x4072b6){return function(_0x2e6c67){if(!_0x2e6c67){_0x4fcba5[_0x7fe2('0x18')](0x194);}return _0x2e6c67;};}function handleError(_0x569e70,_0x5d2d65){_0x5d2d65=_0x5d2d65||0x1f4;return function(_0x19d545){logger[_0x7fe2('0x29')](_0x19d545['stack']);if(_0x19d545[_0x7fe2('0x2a')]){delete _0x19d545[_0x7fe2('0x2a')];}_0x569e70[_0x7fe2('0x1a')](_0x5d2d65)['send'](_0x19d545);};}function getMustacheRender(_0x68f56b,_0x1172fb){return Mustache['render'](_0x68f56b,_[_0x7fe2('0x2b')](_0x1172fb[_0x7fe2('0x2c')],{'contact':_0x1172fb['contact'],'message':_0x1172fb[_0x7fe2('0x2d')],'agent':_0x1172fb['agent'],'interaction':_0x1172fb['interaction'],'account':_0x1172fb['account']}))||'';}exports[_0x7fe2('0x2e')]=function(_0x1f0477,_0x2fa0b1){var _0x582917={},_0x6bc462={},_0x171da4={'count':0x0,'rows':[]};var _0xbbf9eb=_[_0x7fe2('0x2f')](db[_0x7fe2('0x30')]['rawAttributes'],function(_0x47edcb){return{'name':_0x47edcb[_0x7fe2('0x31')],'type':_0x47edcb[_0x7fe2('0x32')][_0x7fe2('0x33')]};});_0x6bc462['model']=_[_0x7fe2('0x2f')](_0xbbf9eb,_0x7fe2('0x2a'));_0x6bc462[_0x7fe2('0x34')]=_['keys'](_0x1f0477[_0x7fe2('0x34')]);_0x6bc462[_0x7fe2('0x35')]=_[_0x7fe2('0x36')](_0x6bc462['model'],_0x6bc462['query']);_0x582917['attributes']=_[_0x7fe2('0x36')](_0x6bc462[_0x7fe2('0x37')],qs[_0x7fe2('0x38')](_0x1f0477[_0x7fe2('0x34')][_0x7fe2('0x38')]));_0x582917[_0x7fe2('0x39')]=_0x582917[_0x7fe2('0x39')][_0x7fe2('0x3a')]?_0x582917[_0x7fe2('0x39')]:_0x6bc462['model'];if(!_0x1f0477[_0x7fe2('0x34')][_0x7fe2('0x3b')](_0x7fe2('0x3c'))){_0x582917[_0x7fe2('0x1f')]=qs[_0x7fe2('0x1f')](_0x1f0477[_0x7fe2('0x34')]['limit']);_0x582917[_0x7fe2('0x1c')]=qs[_0x7fe2('0x1c')](_0x1f0477[_0x7fe2('0x34')]['offset']);}_0x582917[_0x7fe2('0x3d')]=qs[_0x7fe2('0x3e')](_0x1f0477['query'][_0x7fe2('0x3e')]);_0x582917[_0x7fe2('0x3f')]=qs[_0x7fe2('0x35')](_[_0x7fe2('0x40')](_0x1f0477[_0x7fe2('0x34')],_0x6bc462[_0x7fe2('0x35')]),_0xbbf9eb);if(_0x1f0477[_0x7fe2('0x34')][_0x7fe2('0x41')]){_0x582917[_0x7fe2('0x3f')]=_[_0x7fe2('0x2b')](_0x582917[_0x7fe2('0x3f')],{'$or':_[_0x7fe2('0x2f')](_0xbbf9eb,function(_0x46a916){if(_0x46a916[_0x7fe2('0x32')]!==_0x7fe2('0x42')){var _0x3bc0b8={};_0x3bc0b8[_0x46a916[_0x7fe2('0x2a')]]={'$like':'%'+_0x1f0477[_0x7fe2('0x34')][_0x7fe2('0x41')]+'%'};return _0x3bc0b8;}})});}_0x582917=_[_0x7fe2('0x2b')]({},_0x582917,_0x1f0477[_0x7fe2('0x43')]);var _0x3ca3bf={'where':_0x582917[_0x7fe2('0x3f')]};return db['CmContactHasItem']['count'](_0x3ca3bf)[_0x7fe2('0x24')](function(_0x4444f2){_0x171da4[_0x7fe2('0x1e')]=_0x4444f2;if(_0x1f0477['query']['includeAll']){_0x582917['include']=[{'all':!![]}];}return db[_0x7fe2('0x30')][_0x7fe2('0x44')](_0x582917);})[_0x7fe2('0x24')](function(_0x60d0a3){_0x171da4['rows']=_0x60d0a3;return _0x171da4;})[_0x7fe2('0x24')](respondWithFilteredResult(_0x2fa0b1,_0x582917))[_0x7fe2('0x45')](handleError(_0x2fa0b1,null));};exports[_0x7fe2('0x46')]=function(_0x49816e,_0x329be2){var _0x5bfcb5={'raw':!![],'where':{'id':_0x49816e[_0x7fe2('0x47')]['id']}},_0x443a36={};_0x443a36[_0x7fe2('0x37')]=_['keys'](db[_0x7fe2('0x30')][_0x7fe2('0x48')]);_0x443a36[_0x7fe2('0x34')]=_[_0x7fe2('0x49')](_0x49816e[_0x7fe2('0x34')]);_0x443a36[_0x7fe2('0x35')]=_[_0x7fe2('0x36')](_0x443a36[_0x7fe2('0x37')],_0x443a36[_0x7fe2('0x34')]);_0x5bfcb5[_0x7fe2('0x39')]=_[_0x7fe2('0x36')](_0x443a36['model'],qs['fields'](_0x49816e[_0x7fe2('0x34')][_0x7fe2('0x38')]));_0x5bfcb5[_0x7fe2('0x39')]=_0x5bfcb5[_0x7fe2('0x39')][_0x7fe2('0x3a')]?_0x5bfcb5[_0x7fe2('0x39')]:_0x443a36[_0x7fe2('0x37')];if(_0x49816e[_0x7fe2('0x34')][_0x7fe2('0x4a')]){_0x5bfcb5[_0x7fe2('0x4b')]=[{'all':!![]}];}_0x5bfcb5=_[_0x7fe2('0x2b')]({},_0x5bfcb5,_0x49816e[_0x7fe2('0x43')]);return db[_0x7fe2('0x30')]['find'](_0x5bfcb5)[_0x7fe2('0x24')](handleEntityNotFound(_0x329be2,null))[_0x7fe2('0x24')](respondWithResult(_0x329be2,null))[_0x7fe2('0x45')](handleError(_0x329be2,null));};exports['create']=function(_0x728a3e,_0x2f5e06){return db[_0x7fe2('0x30')]['create'](_0x728a3e['body'],{})['then'](function(_0x5d97c5){var _0x3bf988=_0x728a3e[_0x7fe2('0x4c')][_0x7fe2('0x26')]({'plain':!![]});if(!_0x3bf988)throw new Error(_0x7fe2('0x4d'));if(_0x3bf988[_0x7fe2('0x4e')]===_0x7fe2('0x4c')){var _0xb67f80=_0x5d97c5[_0x7fe2('0x26')]({'plain':!![]});var _0x3982b9='CmContactHasItems';return db[_0x7fe2('0x4f')][_0x7fe2('0x50')]({'where':{'name':_0x3982b9,'userProfileId':_0x3bf988[_0x7fe2('0x51')]},'raw':!![]})[_0x7fe2('0x24')](function(_0x3d607a){if(_0x3d607a&&_0x3d607a[_0x7fe2('0x52')]===0x0){return db['UserProfileResource'][_0x7fe2('0x53')]({'name':_0xb67f80[_0x7fe2('0x2a')],'resourceId':_0xb67f80['id'],'type':_0x3d607a[_0x7fe2('0x2a')],'sectionId':_0x3d607a['id']},{})[_0x7fe2('0x24')](function(){return _0x5d97c5;});}else{return _0x5d97c5;}})[_0x7fe2('0x45')](function(_0x573783){logger['error'](_0x7fe2('0x54'),_0x573783);throw _0x573783;});}return _0x5d97c5;})[_0x7fe2('0x24')](respondWithResult(_0x2f5e06,0xc9))[_0x7fe2('0x45')](handleError(_0x2f5e06,null));};exports['update']=function(_0x3a4fd5,_0x528244){if(_0x3a4fd5[_0x7fe2('0x2c')]['id']){delete _0x3a4fd5[_0x7fe2('0x2c')]['id'];}return db[_0x7fe2('0x30')]['find']({'where':{'id':_0x3a4fd5['params']['id']}})[_0x7fe2('0x24')](handleEntityNotFound(_0x528244,null))['then'](saveUpdates(_0x3a4fd5['body'],null))[_0x7fe2('0x24')](respondWithResult(_0x528244,null))[_0x7fe2('0x45')](handleError(_0x528244,null));};exports[_0x7fe2('0x25')]=function(_0x227cc7,_0x171d22){return db[_0x7fe2('0x30')][_0x7fe2('0x50')]({'where':{'id':_0x227cc7['params']['id']}})[_0x7fe2('0x24')](handleEntityNotFound(_0x171d22,null))[_0x7fe2('0x24')](removeEntity(_0x171d22,null))[_0x7fe2('0x45')](handleError(_0x171d22,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 23d047a..2770d2e 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_contact_has_items','lodash'];(function(_0x4b688f,_0x476f40){var _0x4ccc2b=function(_0x266227){while(--_0x266227){_0x4b688f['push'](_0x4b688f['shift']());}};_0x4ccc2b(++_0x476f40);}(_0x7da7,0x10d));var _0x77da=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0x7da7[_0x595604];return _0x1466f3;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('CmContactHasItem',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9d=['define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x8f9d,0x93));var _0xd8f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f9d[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var logger=require(_0xd8f9('0x1'))('api');var moment=require(_0xd8f9('0x2'));var BPromise=require(_0xd8f9('0x3'));var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require(_0xd8f9('0x8'));module['exports']=function(_0x1c37be,_0x24dd1e){return _0x1c37be[_0xd8f9('0x9')](_0xd8f9('0xa'),attributes,{'tableName':_0xd8f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index a4d2927..446e914 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8af=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','error','message','request\x20sent','result','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8af,0x142));var _0xfd8a=function(_0x145f05,_0x5b3ea3){_0x145f05=_0x145f05-0x0;var _0x18dcac=_0xd8af[_0x145f05];return _0x18dcac;};'use strict';var _=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var moment=require(_0xfd8a('0x2'));var BPromise=require(_0xfd8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd8a('0x4'));var db=require(_0xfd8a('0x5'))['db'];var utils=require(_0xfd8a('0x6'));var logger=require('../../config/logger')(_0xfd8a('0x7'));var config=require('../../config/environment');var jayson=require(_0xfd8a('0x8'));var client=jayson[_0xfd8a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5260c4,_0x1f132d,_0x344457){return new BPromise(function(_0x20a4fa,_0x4a32e3){return client[_0xfd8a('0xa')](_0x5260c4,_0x344457)[_0xfd8a('0xb')](function(_0x124962){logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0x1f132d,'request\x20sent');logger[_0xfd8a('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x1f132d,'request\x20sent',JSON['stringify'](_0x124962));if(_0x124962[_0xfd8a('0xf')]){if(_0x124962[_0xfd8a('0xf')]['code']===0x1f4){logger[_0xfd8a('0xf')](_0xfd8a('0xd'),_0x1f132d,_0x124962[_0xfd8a('0xf')]['message']);return _0x4a32e3(_0x124962[_0xfd8a('0xf')][_0xfd8a('0x10')]);}logger[_0xfd8a('0xf')](_0xfd8a('0xd'),_0x1f132d,_0x124962[_0xfd8a('0xf')]['message']);return _0x20a4fa(_0x124962[_0xfd8a('0xf')][_0xfd8a('0x10')]);}else{logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0x1f132d,_0xfd8a('0x11'));_0x20a4fa(_0x124962[_0xfd8a('0x12')]['message']);}})['catch'](function(_0x240770){logger['error'](_0xfd8a('0xd'),_0x1f132d,_0x240770);_0x4a32e3(_0x240770);});});} \ No newline at end of file +var _0x395d=['rpc','../../config/environment','jayson/promise','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2b3ff4,_0x571d5d){var _0x3bfec9=function(_0x306c8a){while(--_0x306c8a){_0x2b3ff4['push'](_0x2b3ff4['shift']());}};_0x3bfec9(++_0x571d5d);}(_0x395d,0x1da));var _0xd395=function(_0x4cb37d,_0x1d711a){_0x4cb37d=_0x4cb37d-0x0;var _0x4bdf8c=_0x395d[_0x4cb37d];return _0x4bdf8c;};'use strict';var _=require('lodash');var util=require(_0xd395('0x0'));var moment=require(_0xd395('0x1'));var BPromise=require('bluebird');var rs=require(_0xd395('0x2'));var fs=require('fs');var Redis=require(_0xd395('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd395('0x4'));var logger=require(_0xd395('0x5'))(_0xd395('0x6'));var config=require(_0xd395('0x7'));var jayson=require(_0xd395('0x8'));var client=jayson['client'][_0xd395('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3415,_0x487cf3,_0x4428e4){return new BPromise(function(_0x53e288,_0xdabbea){return client['request'](_0x5b3415,_0x4428e4)[_0xd395('0xa')](function(_0xdc7c17){logger[_0xd395('0xb')](_0xd395('0xc'),_0x487cf3,_0xd395('0xd'));logger[_0xd395('0xe')](_0xd395('0xf'),_0x487cf3,_0xd395('0xd'),JSON[_0xd395('0x10')](_0xdc7c17));if(_0xdc7c17[_0xd395('0x11')]){if(_0xdc7c17['error']['code']===0x1f4){logger[_0xd395('0x11')](_0xd395('0xc'),_0x487cf3,_0xdc7c17[_0xd395('0x11')][_0xd395('0x12')]);return _0xdabbea(_0xdc7c17[_0xd395('0x11')]['message']);}logger[_0xd395('0x11')](_0xd395('0xc'),_0x487cf3,_0xdc7c17[_0xd395('0x11')][_0xd395('0x12')]);return _0x53e288(_0xdc7c17[_0xd395('0x11')][_0xd395('0x12')]);}else{logger['info'](_0xd395('0xc'),_0x487cf3,'request\x20sent');_0x53e288(_0xdc7c17['result'][_0xd395('0x12')]);}})[_0xd395('0x13')](function(_0x3a4453){logger[_0xd395('0x11')](_0xd395('0xc'),_0x487cf3,_0x3a4453);_0xdabbea(_0x3a4453);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b5e7f63..dd21f8d 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x709b=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','get','/:id','show','post','update','delete','destroy','exports','multer','path'];(function(_0x26de68,_0x1721f1){var _0x40308a=function(_0x2ecf99){while(--_0x2ecf99){_0x26de68['push'](_0x26de68['shift']());}};_0x40308a(++_0x1721f1);}(_0x709b,0xfe));var _0xb709=function(_0x2c0a8b,_0x415a60){_0x2c0a8b=_0x2c0a8b-0x0;var _0x2df1db=_0x709b[_0x2c0a8b];return _0x2df1db;};'use strict';var multer=require(_0xb709('0x0'));var util=require('util');var path=require(_0xb709('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb709('0x2')]();var fs_extra=require(_0xb709('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb709('0x4'));var config=require(_0xb709('0x5'));var controller=require(_0xb709('0x6'));router['get']('/',auth[_0xb709('0x7')](),controller['index']);router[_0xb709('0x8')](_0xb709('0x9'),auth[_0xb709('0x7')](),controller[_0xb709('0xa')]);router[_0xb709('0xb')]('/',auth[_0xb709('0x7')](),controller['create']);router['put'](_0xb709('0x9'),auth[_0xb709('0x7')](),controller[_0xb709('0xc')]);router[_0xb709('0xd')](_0xb709('0x9'),auth[_0xb709('0x7')](),controller[_0xb709('0xe')]);module[_0xb709('0xf')]=router; \ No newline at end of file +var _0xaa1d=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1f21a4,_0x1dfad2){var _0x27cff8=function(_0x69722c){while(--_0x69722c){_0x1f21a4['push'](_0x1f21a4['shift']());}};_0x27cff8(++_0x1dfad2);}(_0xaa1d,0xa6));var _0xdaa1=function(_0x387d23,_0x455e57){_0x387d23=_0x387d23-0x0;var _0x506f7a=_0xaa1d[_0x387d23];return _0x506f7a;};'use strict';var multer=require(_0xdaa1('0x0'));var util=require(_0xdaa1('0x1'));var path=require(_0xdaa1('0x2'));var timeout=require(_0xdaa1('0x3'));var express=require(_0xdaa1('0x4'));var router=express[_0xdaa1('0x5')]();var fs_extra=require(_0xdaa1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdaa1('0x7'));var config=require(_0xdaa1('0x8'));var controller=require(_0xdaa1('0x9'));router[_0xdaa1('0xa')]('/',auth[_0xdaa1('0xb')](),controller[_0xdaa1('0xc')]);router[_0xdaa1('0xa')]('/:id',auth[_0xdaa1('0xb')](),controller[_0xdaa1('0xd')]);router[_0xdaa1('0xe')]('/',auth[_0xdaa1('0xb')](),controller[_0xdaa1('0xf')]);router['put']('/:id',auth[_0xdaa1('0xb')](),controller['update']);router['delete'](_0xdaa1('0x10'),auth[_0xdaa1('0xb')](),controller[_0xdaa1('0x11')]);module[_0xdaa1('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 95b7378..0512fba 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc384=['STRING','sequelize','exports','INTEGER'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xc384,0x12d));var _0x4c38=function(_0x900c2d,_0xfcc1d){_0x900c2d=_0x900c2d-0x0;var _0x326c0b=_0xc384[_0x900c2d];return _0x326c0b;};'use strict';var Sequelize=require(_0x4c38('0x0'));module[_0x4c38('0x1')]={'CmContactId':{'type':Sequelize[_0x4c38('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x4c38('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xb071=['STRING','sequelize','exports','INTEGER'];(function(_0x83e24f,_0x40e321){var _0x2f44ee=function(_0x1ac841){while(--_0x1ac841){_0x83e24f['push'](_0x83e24f['shift']());}};_0x2f44ee(++_0x40e321);}(_0xb071,0xb9));var _0x1b07=function(_0xfca93a,_0x49c794){_0xfca93a=_0xfca93a-0x0;var _0xc7bcb9=_0xb071[_0xfca93a];return _0xc7bcb9;};'use strict';var Sequelize=require(_0x1b07('0x0'));module[_0x1b07('0x1')]={'CmContactId':{'type':Sequelize[_0x1b07('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x1b07('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index e7cc212..3142ed4 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d67=['index','map','CmContactHasPhone','fieldName','type','key','model','query','intersection','attributes','fields','order','sort','where','filters','filter','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','keys','length','includeAll','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasPhones','UserProfileResource','error','stack','name','send','render','merge','contact','message','agent','interaction','account'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x0d67,0x7c));var _0x70d6=function(_0x1acb27,_0x346885){_0x1acb27=_0x1acb27-0x0;var _0x3fbad9=_0x0d67[_0x1acb27];return _0x3fbad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70d6('0x0'));var zipdir=require(_0x70d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x70d6('0x2'));var BPromise=require(_0x70d6('0x3'));var Mustache=require(_0x70d6('0x4'));var util=require(_0x70d6('0x5'));var path=require('path');var sox=require(_0x70d6('0x6'));var csv=require(_0x70d6('0x7'));var ejs=require(_0x70d6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70d6('0x9'));var squel=require('squel');var crypto=require(_0x70d6('0xa'));var jsforce=require(_0x70d6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x70d6('0xc'));var Papa=require(_0x70d6('0xd'));var Redis=require('ioredis');var authService=require(_0x70d6('0xe'));var qs=require(_0x70d6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70d6('0x10'));var logger=require(_0x70d6('0x11'))(_0x70d6('0x12'));var utils=require(_0x70d6('0x13'));var config=require(_0x70d6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x70d6('0x15'))['db'];function respondWithStatusCode(_0x53096e,_0x4325f5){_0x4325f5=_0x4325f5||0xcc;return function(_0x5ae9d6){if(_0x5ae9d6){return _0x53096e[_0x70d6('0x16')](_0x4325f5);}return _0x53096e['status'](_0x4325f5)[_0x70d6('0x17')]();};}function respondWithResult(_0x2c0679,_0x354af8){_0x354af8=_0x354af8||0xc8;return function(_0x1a882f){if(_0x1a882f){return _0x2c0679[_0x70d6('0x18')](_0x354af8)[_0x70d6('0x19')](_0x1a882f);}};}function respondWithFilteredResult(_0x2e8e3a,_0x580ff9){return function(_0x191cc5){if(_0x191cc5){var _0x2a5418=typeof _0x580ff9[_0x70d6('0x1a')]==='undefined'&&typeof _0x580ff9[_0x70d6('0x1b')]===_0x70d6('0x1c');var _0x476f0b=_0x191cc5['count'];var _0x50024d=_0x2a5418?0x0:_0x580ff9[_0x70d6('0x1a')];var _0x31a296=_0x2a5418?_0x191cc5[_0x70d6('0x1d')]:_0x580ff9[_0x70d6('0x1a')]+_0x580ff9[_0x70d6('0x1b')];var _0x3727f9;if(_0x31a296>=_0x476f0b){_0x31a296=_0x476f0b;_0x3727f9=0xc8;}else{_0x3727f9=0xce;}_0x2e8e3a[_0x70d6('0x18')](_0x3727f9);return _0x2e8e3a[_0x70d6('0x1e')](_0x70d6('0x1f'),_0x50024d+'-'+_0x31a296+'/'+_0x476f0b)[_0x70d6('0x19')](_0x191cc5);}return null;};}function patchUpdates(_0x313360){return function(_0x1265cf){try{jsonpatch[_0x70d6('0x20')](_0x1265cf,_0x313360,!![]);}catch(_0x1157c4){return BPromise[_0x70d6('0x21')](_0x1157c4);}return _0x1265cf[_0x70d6('0x22')]();};}function saveUpdates(_0x49f8f1,_0x1bf52c){return function(_0x42da7b){if(_0x42da7b){return _0x42da7b[_0x70d6('0x23')](_0x49f8f1)[_0x70d6('0x24')](function(_0x41eef1){return _0x41eef1;});}return null;};}function removeEntity(_0x510188,_0x1645fd){return function(_0x2bfba6){if(_0x2bfba6){return _0x2bfba6[_0x70d6('0x25')]()[_0x70d6('0x24')](function(){var _0x42ce68=_0x2bfba6[_0x70d6('0x26')]({'plain':!![]});var _0x47b657=_0x70d6('0x27');return db[_0x70d6('0x28')][_0x70d6('0x25')]({'where':{'type':_0x47b657,'resourceId':_0x42ce68['id']}})[_0x70d6('0x24')](function(){return _0x2bfba6;});})['then'](function(){_0x510188[_0x70d6('0x18')](0xcc)[_0x70d6('0x17')]();});}};}function handleEntityNotFound(_0x546fcd,_0x350573){return function(_0x194a90){if(!_0x194a90){_0x546fcd[_0x70d6('0x16')](0x194);}return _0x194a90;};}function handleError(_0x9edf6f,_0x67066b){_0x67066b=_0x67066b||0x1f4;return function(_0x353d3f){logger[_0x70d6('0x29')](_0x353d3f[_0x70d6('0x2a')]);if(_0x353d3f['name']){delete _0x353d3f[_0x70d6('0x2b')];}_0x9edf6f['status'](_0x67066b)[_0x70d6('0x2c')](_0x353d3f);};}function getMustacheRender(_0x4a75fc,_0x489d51){return Mustache[_0x70d6('0x2d')](_0x4a75fc,_[_0x70d6('0x2e')](_0x489d51['body'],{'contact':_0x489d51[_0x70d6('0x2f')],'message':_0x489d51[_0x70d6('0x30')],'agent':_0x489d51[_0x70d6('0x31')],'interaction':_0x489d51[_0x70d6('0x32')],'account':_0x489d51[_0x70d6('0x33')]}))||'';}exports[_0x70d6('0x34')]=function(_0x275465,_0x1d8ee1){var _0x153757={},_0xb4301f={},_0x32f808={'count':0x0,'rows':[]};var _0x554137=_[_0x70d6('0x35')](db[_0x70d6('0x36')]['rawAttributes'],function(_0x44143b){return{'name':_0x44143b[_0x70d6('0x37')],'type':_0x44143b[_0x70d6('0x38')][_0x70d6('0x39')]};});_0xb4301f[_0x70d6('0x3a')]=_[_0x70d6('0x35')](_0x554137,_0x70d6('0x2b'));_0xb4301f[_0x70d6('0x3b')]=_['keys'](_0x275465[_0x70d6('0x3b')]);_0xb4301f['filters']=_[_0x70d6('0x3c')](_0xb4301f[_0x70d6('0x3a')],_0xb4301f['query']);_0x153757[_0x70d6('0x3d')]=_[_0x70d6('0x3c')](_0xb4301f[_0x70d6('0x3a')],qs[_0x70d6('0x3e')](_0x275465[_0x70d6('0x3b')][_0x70d6('0x3e')]));_0x153757['attributes']=_0x153757[_0x70d6('0x3d')]['length']?_0x153757[_0x70d6('0x3d')]:_0xb4301f[_0x70d6('0x3a')];if(!_0x275465[_0x70d6('0x3b')]['hasOwnProperty']('nolimit')){_0x153757[_0x70d6('0x1b')]=qs[_0x70d6('0x1b')](_0x275465[_0x70d6('0x3b')][_0x70d6('0x1b')]);_0x153757['offset']=qs[_0x70d6('0x1a')](_0x275465['query'][_0x70d6('0x1a')]);}_0x153757[_0x70d6('0x3f')]=qs[_0x70d6('0x40')](_0x275465[_0x70d6('0x3b')]['sort']);_0x153757[_0x70d6('0x41')]=qs[_0x70d6('0x42')](_['pick'](_0x275465[_0x70d6('0x3b')],_0xb4301f[_0x70d6('0x42')]),_0x554137);if(_0x275465['query'][_0x70d6('0x43')]){_0x153757[_0x70d6('0x41')]=_[_0x70d6('0x2e')](_0x153757[_0x70d6('0x41')],{'$or':_['map'](_0x554137,function(_0x5187bd){if(_0x5187bd['type']!==_0x70d6('0x44')){var _0x58c114={};_0x58c114[_0x5187bd[_0x70d6('0x2b')]]={'$like':'%'+_0x275465[_0x70d6('0x3b')]['filter']+'%'};return _0x58c114;}})});}_0x153757=_[_0x70d6('0x2e')]({},_0x153757,_0x275465['options']);var _0x4c8617={'where':_0x153757[_0x70d6('0x41')]};return db[_0x70d6('0x36')][_0x70d6('0x1d')](_0x4c8617)[_0x70d6('0x24')](function(_0x946ffc){_0x32f808['count']=_0x946ffc;if(_0x275465[_0x70d6('0x3b')]['includeAll']){_0x153757[_0x70d6('0x45')]=[{'all':!![]}];}return db[_0x70d6('0x36')][_0x70d6('0x46')](_0x153757);})[_0x70d6('0x24')](function(_0x2a1cd9){_0x32f808[_0x70d6('0x47')]=_0x2a1cd9;return _0x32f808;})[_0x70d6('0x24')](respondWithFilteredResult(_0x1d8ee1,_0x153757))[_0x70d6('0x48')](handleError(_0x1d8ee1,null));};exports[_0x70d6('0x49')]=function(_0x21de8e,_0x3bb2dc){var _0x3d555e={'raw':!![],'where':{'id':_0x21de8e[_0x70d6('0x4a')]['id']}},_0x116d6c={};_0x116d6c[_0x70d6('0x3a')]=_['keys'](db[_0x70d6('0x36')][_0x70d6('0x4b')]);_0x116d6c[_0x70d6('0x3b')]=_[_0x70d6('0x4c')](_0x21de8e[_0x70d6('0x3b')]);_0x116d6c[_0x70d6('0x42')]=_[_0x70d6('0x3c')](_0x116d6c[_0x70d6('0x3a')],_0x116d6c[_0x70d6('0x3b')]);_0x3d555e[_0x70d6('0x3d')]=_['intersection'](_0x116d6c[_0x70d6('0x3a')],qs[_0x70d6('0x3e')](_0x21de8e[_0x70d6('0x3b')]['fields']));_0x3d555e[_0x70d6('0x3d')]=_0x3d555e[_0x70d6('0x3d')][_0x70d6('0x4d')]?_0x3d555e[_0x70d6('0x3d')]:_0x116d6c['model'];if(_0x21de8e[_0x70d6('0x3b')][_0x70d6('0x4e')]){_0x3d555e[_0x70d6('0x45')]=[{'all':!![]}];}_0x3d555e=_['merge']({},_0x3d555e,_0x21de8e[_0x70d6('0x4f')]);return db[_0x70d6('0x36')][_0x70d6('0x50')](_0x3d555e)[_0x70d6('0x24')](handleEntityNotFound(_0x3bb2dc,null))[_0x70d6('0x24')](respondWithResult(_0x3bb2dc,null))['catch'](handleError(_0x3bb2dc,null));};exports[_0x70d6('0x51')]=function(_0x57f283,_0xd4116d){return db[_0x70d6('0x36')][_0x70d6('0x51')](_0x57f283[_0x70d6('0x52')],{})[_0x70d6('0x24')](function(_0x1d36d2){var _0x1842db=_0x57f283[_0x70d6('0x53')]['get']({'plain':!![]});if(!_0x1842db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1842db['role']===_0x70d6('0x53')){var _0x25c61b=_0x1d36d2['get']({'plain':!![]});var _0x353e62='CmContactHasPhones';return db[_0x70d6('0x54')][_0x70d6('0x50')]({'where':{'name':_0x353e62,'userProfileId':_0x1842db[_0x70d6('0x55')]},'raw':!![]})[_0x70d6('0x24')](function(_0x1f65fc){if(_0x1f65fc&&_0x1f65fc[_0x70d6('0x56')]===0x0){return db[_0x70d6('0x28')][_0x70d6('0x51')]({'name':_0x25c61b[_0x70d6('0x2b')],'resourceId':_0x25c61b['id'],'type':_0x1f65fc['name'],'sectionId':_0x1f65fc['id']},{})[_0x70d6('0x24')](function(){return _0x1d36d2;});}else{return _0x1d36d2;}})['catch'](function(_0x5a2fc6){logger[_0x70d6('0x29')](_0x70d6('0x57'),_0x5a2fc6);throw _0x5a2fc6;});}return _0x1d36d2;})[_0x70d6('0x24')](respondWithResult(_0xd4116d,0xc9))['catch'](handleError(_0xd4116d,null));};exports[_0x70d6('0x23')]=function(_0x43fd33,_0x2864d3){if(_0x43fd33['body']['id']){delete _0x43fd33[_0x70d6('0x52')]['id'];}return db['CmContactHasPhone'][_0x70d6('0x50')]({'where':{'id':_0x43fd33[_0x70d6('0x4a')]['id']}})[_0x70d6('0x24')](handleEntityNotFound(_0x2864d3,null))['then'](saveUpdates(_0x43fd33['body'],null))[_0x70d6('0x24')](respondWithResult(_0x2864d3,null))[_0x70d6('0x48')](handleError(_0x2864d3,null));};exports[_0x70d6('0x25')]=function(_0x3c31a2,_0x2fae8c){return db[_0x70d6('0x36')][_0x70d6('0x50')]({'where':{'id':_0x3c31a2[_0x70d6('0x4a')]['id']}})[_0x70d6('0x24')](handleEntityNotFound(_0x2fae8c,null))[_0x70d6('0x24')](removeEntity(_0x2fae8c,null))[_0x70d6('0x48')](handleError(_0x2fae8c,null));}; \ No newline at end of file +var _0xcbee=['get','CmContactHasPhones','UserProfileResource','end','sendStatus','error','name','send','merge','contact','agent','index','map','CmContactHasPhone','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','type','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','update','then'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcbee,0x1d8));var _0xecbe=function(_0x279132,_0x374ea0){_0x279132=_0x279132-0x0;var _0x375e2d=_0xcbee[_0x279132];return _0x375e2d;};'use strict';var emlformat=require(_0xecbe('0x0'));var rimraf=require(_0xecbe('0x1'));var zipdir=require(_0xecbe('0x2'));var jsonpatch=require(_0xecbe('0x3'));var rp=require(_0xecbe('0x4'));var moment=require(_0xecbe('0x5'));var BPromise=require(_0xecbe('0x6'));var Mustache=require(_0xecbe('0x7'));var util=require(_0xecbe('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xecbe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecbe('0xa'));var _=require(_0xecbe('0xb'));var squel=require(_0xecbe('0xc'));var crypto=require(_0xecbe('0xd'));var jsforce=require(_0xecbe('0xe'));var deskjs=require(_0xecbe('0xf'));var toCsv=require(_0xecbe('0x9'));var querystring=require('querystring');var Papa=require(_0xecbe('0x10'));var Redis=require(_0xecbe('0x11'));var authService=require(_0xecbe('0x12'));var qs=require(_0xecbe('0x13'));var as=require(_0xecbe('0x14'));var hardwareService=require(_0xecbe('0x15'));var logger=require(_0xecbe('0x16'))(_0xecbe('0x17'));var utils=require(_0xecbe('0x18'));var config=require(_0xecbe('0x19'));var licenseUtil=require(_0xecbe('0x1a'));var db=require(_0xecbe('0x1b'))['db'];function respondWithStatusCode(_0x419640,_0x308741){_0x308741=_0x308741||0xcc;return function(_0x29a58f){if(_0x29a58f){return _0x419640['sendStatus'](_0x308741);}return _0x419640['status'](_0x308741)['end']();};}function respondWithResult(_0x2cebd7,_0x2b38f6){_0x2b38f6=_0x2b38f6||0xc8;return function(_0x197671){if(_0x197671){return _0x2cebd7[_0xecbe('0x1c')](_0x2b38f6)[_0xecbe('0x1d')](_0x197671);}};}function respondWithFilteredResult(_0x14e4b3,_0x1296a6){return function(_0x842ee3){if(_0x842ee3){var _0x2dff2b=typeof _0x1296a6[_0xecbe('0x1e')]===_0xecbe('0x1f')&&typeof _0x1296a6[_0xecbe('0x20')]==='undefined';var _0x3e5702=_0x842ee3['count'];var _0x1118e2=_0x2dff2b?0x0:_0x1296a6[_0xecbe('0x1e')];var _0x3ee931=_0x2dff2b?_0x842ee3[_0xecbe('0x21')]:_0x1296a6[_0xecbe('0x1e')]+_0x1296a6[_0xecbe('0x20')];var _0x317776;if(_0x3ee931>=_0x3e5702){_0x3ee931=_0x3e5702;_0x317776=0xc8;}else{_0x317776=0xce;}_0x14e4b3[_0xecbe('0x1c')](_0x317776);return _0x14e4b3[_0xecbe('0x22')]('Content-Range',_0x1118e2+'-'+_0x3ee931+'/'+_0x3e5702)[_0xecbe('0x1d')](_0x842ee3);}return null;};}function patchUpdates(_0x5bd9ec){return function(_0x3e0af7){try{jsonpatch[_0xecbe('0x23')](_0x3e0af7,_0x5bd9ec,!![]);}catch(_0x314de2){return BPromise['reject'](_0x314de2);}return _0x3e0af7['save']();};}function saveUpdates(_0x28f92d,_0x4fba88){return function(_0x420bf9){if(_0x420bf9){return _0x420bf9[_0xecbe('0x24')](_0x28f92d)[_0xecbe('0x25')](function(_0x447c55){return _0x447c55;});}return null;};}function removeEntity(_0x5d59a8,_0x35df57){return function(_0x494bca){if(_0x494bca){return _0x494bca['destroy']()[_0xecbe('0x25')](function(){var _0x8f165a=_0x494bca[_0xecbe('0x26')]({'plain':!![]});var _0x316eca=_0xecbe('0x27');return db[_0xecbe('0x28')]['destroy']({'where':{'type':_0x316eca,'resourceId':_0x8f165a['id']}})[_0xecbe('0x25')](function(){return _0x494bca;});})[_0xecbe('0x25')](function(){_0x5d59a8[_0xecbe('0x1c')](0xcc)[_0xecbe('0x29')]();});}};}function handleEntityNotFound(_0x5e2106,_0x4b1716){return function(_0x5be3de){if(!_0x5be3de){_0x5e2106[_0xecbe('0x2a')](0x194);}return _0x5be3de;};}function handleError(_0x5dec02,_0x5e4653){_0x5e4653=_0x5e4653||0x1f4;return function(_0x2dcc0f){logger[_0xecbe('0x2b')](_0x2dcc0f['stack']);if(_0x2dcc0f[_0xecbe('0x2c')]){delete _0x2dcc0f[_0xecbe('0x2c')];}_0x5dec02[_0xecbe('0x1c')](_0x5e4653)[_0xecbe('0x2d')](_0x2dcc0f);};}function getMustacheRender(_0x348479,_0x518dab){return Mustache['render'](_0x348479,_[_0xecbe('0x2e')](_0x518dab['body'],{'contact':_0x518dab[_0xecbe('0x2f')],'message':_0x518dab['message'],'agent':_0x518dab[_0xecbe('0x30')],'interaction':_0x518dab['interaction'],'account':_0x518dab['account']}))||'';}exports[_0xecbe('0x31')]=function(_0x57ec5d,_0x20cc6a){var _0x36261d={},_0x2db1dc={},_0x45a4c7={'count':0x0,'rows':[]};var _0x445c86=_[_0xecbe('0x32')](db[_0xecbe('0x33')][_0xecbe('0x34')],function(_0x5640eb){return{'name':_0x5640eb['fieldName'],'type':_0x5640eb['type'][_0xecbe('0x35')]};});_0x2db1dc[_0xecbe('0x36')]=_['map'](_0x445c86,_0xecbe('0x2c'));_0x2db1dc[_0xecbe('0x37')]=_[_0xecbe('0x38')](_0x57ec5d[_0xecbe('0x37')]);_0x2db1dc[_0xecbe('0x39')]=_[_0xecbe('0x3a')](_0x2db1dc['model'],_0x2db1dc[_0xecbe('0x37')]);_0x36261d['attributes']=_[_0xecbe('0x3a')](_0x2db1dc['model'],qs[_0xecbe('0x3b')](_0x57ec5d['query']['fields']));_0x36261d[_0xecbe('0x3c')]=_0x36261d[_0xecbe('0x3c')][_0xecbe('0x3d')]?_0x36261d[_0xecbe('0x3c')]:_0x2db1dc[_0xecbe('0x36')];if(!_0x57ec5d[_0xecbe('0x37')]['hasOwnProperty'](_0xecbe('0x3e'))){_0x36261d['limit']=qs['limit'](_0x57ec5d['query'][_0xecbe('0x20')]);_0x36261d[_0xecbe('0x1e')]=qs[_0xecbe('0x1e')](_0x57ec5d[_0xecbe('0x37')]['offset']);}_0x36261d[_0xecbe('0x3f')]=qs[_0xecbe('0x40')](_0x57ec5d['query'][_0xecbe('0x40')]);_0x36261d[_0xecbe('0x41')]=qs[_0xecbe('0x39')](_['pick'](_0x57ec5d[_0xecbe('0x37')],_0x2db1dc[_0xecbe('0x39')]),_0x445c86);if(_0x57ec5d[_0xecbe('0x37')][_0xecbe('0x42')]){_0x36261d[_0xecbe('0x41')]=_[_0xecbe('0x2e')](_0x36261d[_0xecbe('0x41')],{'$or':_['map'](_0x445c86,function(_0x407aa1){if(_0x407aa1[_0xecbe('0x43')]!==_0xecbe('0x44')){var _0x5762fa={};_0x5762fa[_0x407aa1[_0xecbe('0x2c')]]={'$like':'%'+_0x57ec5d['query'][_0xecbe('0x42')]+'%'};return _0x5762fa;}})});}_0x36261d=_[_0xecbe('0x2e')]({},_0x36261d,_0x57ec5d[_0xecbe('0x45')]);var _0x2dc572={'where':_0x36261d[_0xecbe('0x41')]};return db[_0xecbe('0x33')]['count'](_0x2dc572)[_0xecbe('0x25')](function(_0x452d29){_0x45a4c7[_0xecbe('0x21')]=_0x452d29;if(_0x57ec5d[_0xecbe('0x37')]['includeAll']){_0x36261d[_0xecbe('0x46')]=[{'all':!![]}];}return db[_0xecbe('0x33')][_0xecbe('0x47')](_0x36261d);})[_0xecbe('0x25')](function(_0x350ad3){_0x45a4c7[_0xecbe('0x48')]=_0x350ad3;return _0x45a4c7;})['then'](respondWithFilteredResult(_0x20cc6a,_0x36261d))[_0xecbe('0x49')](handleError(_0x20cc6a,null));};exports[_0xecbe('0x4a')]=function(_0xc47507,_0x171d83){var _0x1993b7={'raw':!![],'where':{'id':_0xc47507[_0xecbe('0x4b')]['id']}},_0x1164cf={};_0x1164cf['model']=_[_0xecbe('0x38')](db[_0xecbe('0x33')]['rawAttributes']);_0x1164cf['query']=_[_0xecbe('0x38')](_0xc47507[_0xecbe('0x37')]);_0x1164cf[_0xecbe('0x39')]=_[_0xecbe('0x3a')](_0x1164cf[_0xecbe('0x36')],_0x1164cf[_0xecbe('0x37')]);_0x1993b7[_0xecbe('0x3c')]=_[_0xecbe('0x3a')](_0x1164cf[_0xecbe('0x36')],qs[_0xecbe('0x3b')](_0xc47507[_0xecbe('0x37')]['fields']));_0x1993b7['attributes']=_0x1993b7[_0xecbe('0x3c')][_0xecbe('0x3d')]?_0x1993b7[_0xecbe('0x3c')]:_0x1164cf['model'];if(_0xc47507['query']['includeAll']){_0x1993b7[_0xecbe('0x46')]=[{'all':!![]}];}_0x1993b7=_['merge']({},_0x1993b7,_0xc47507['options']);return db[_0xecbe('0x33')]['find'](_0x1993b7)[_0xecbe('0x25')](handleEntityNotFound(_0x171d83,null))[_0xecbe('0x25')](respondWithResult(_0x171d83,null))[_0xecbe('0x49')](handleError(_0x171d83,null));};exports['create']=function(_0x24f40c,_0x35d755){return db[_0xecbe('0x33')][_0xecbe('0x4c')](_0x24f40c[_0xecbe('0x4d')],{})['then'](function(_0x57abde){var _0x3e4429=_0x24f40c[_0xecbe('0x4e')][_0xecbe('0x26')]({'plain':!![]});if(!_0x3e4429)throw new Error(_0xecbe('0x4f'));if(_0x3e4429[_0xecbe('0x50')]===_0xecbe('0x4e')){var _0x15dc02=_0x57abde[_0xecbe('0x26')]({'plain':!![]});var _0x161478='CmContactHasPhones';return db[_0xecbe('0x51')][_0xecbe('0x52')]({'where':{'name':_0x161478,'userProfileId':_0x3e4429[_0xecbe('0x53')]},'raw':!![]})[_0xecbe('0x25')](function(_0x4dffe0){if(_0x4dffe0&&_0x4dffe0['autoAssociation']===0x0){return db[_0xecbe('0x28')][_0xecbe('0x4c')]({'name':_0x15dc02[_0xecbe('0x2c')],'resourceId':_0x15dc02['id'],'type':_0x4dffe0[_0xecbe('0x2c')],'sectionId':_0x4dffe0['id']},{})['then'](function(){return _0x57abde;});}else{return _0x57abde;}})[_0xecbe('0x49')](function(_0xa9fb7b){logger[_0xecbe('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa9fb7b);throw _0xa9fb7b;});}return _0x57abde;})[_0xecbe('0x25')](respondWithResult(_0x35d755,0xc9))['catch'](handleError(_0x35d755,null));};exports[_0xecbe('0x24')]=function(_0x313d86,_0x251bc9){if(_0x313d86['body']['id']){delete _0x313d86['body']['id'];}return db[_0xecbe('0x33')]['find']({'where':{'id':_0x313d86[_0xecbe('0x4b')]['id']}})[_0xecbe('0x25')](handleEntityNotFound(_0x251bc9,null))[_0xecbe('0x25')](saveUpdates(_0x313d86[_0xecbe('0x4d')],null))[_0xecbe('0x25')](respondWithResult(_0x251bc9,null))[_0xecbe('0x49')](handleError(_0x251bc9,null));};exports[_0xecbe('0x54')]=function(_0x26cfd4,_0x280165){return db[_0xecbe('0x33')]['find']({'where':{'id':_0x26cfd4['params']['id']}})[_0xecbe('0x25')](handleEntityNotFound(_0x280165,null))[_0xecbe('0x25')](removeEntity(_0x280165,null))[_0xecbe('0x49')](handleError(_0x280165,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 61a1845..473f00a 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50e3=['util','api','moment','bluebird','path','rimraf','exports','CmContactHasPhone','cm_contact_has_phones'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0x50e3,0xea));var _0x350e=function(_0xbf2339,_0x127f98){_0xbf2339=_0xbf2339-0x0;var _0x2d34a2=_0x50e3[_0xbf2339];return _0x2d34a2;};'use strict';var _=require('lodash');var util=require(_0x350e('0x0'));var logger=require('../../config/logger')(_0x350e('0x1'));var moment=require(_0x350e('0x2'));var BPromise=require(_0x350e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x350e('0x4'));var rimraf=require(_0x350e('0x5'));var config=require('../../config/environment');var attributes=require('./cmContactHasPhone.attributes');module[_0x350e('0x6')]=function(_0x4cc5be,_0x29d3c9){return _0x4cc5be['define'](_0x350e('0x7'),attributes,{'tableName':_0x350e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb757=['../../config/environment','./cmContactHasPhone.attributes','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5a96c4,_0x282c99){var _0x32bc81=function(_0x175754){while(--_0x175754){_0x5a96c4['push'](_0x5a96c4['shift']());}};_0x32bc81(++_0x282c99);}(_0xb757,0x1d9));var _0x7b75=function(_0x3094c2,_0x47196c){_0x3094c2=_0x3094c2-0x0;var _0x371e8f=_0xb757[_0x3094c2];return _0x371e8f;};'use strict';var _=require(_0x7b75('0x0'));var util=require(_0x7b75('0x1'));var logger=require(_0x7b75('0x2'))('api');var moment=require(_0x7b75('0x3'));var BPromise=require(_0x7b75('0x4'));var rp=require(_0x7b75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b75('0x6'));var config=require(_0x7b75('0x7'));var attributes=require(_0x7b75('0x8'));module['exports']=function(_0x49a7cd,_0x26665b){return _0x49a7cd[_0x7b75('0x9')](_0x7b75('0xa'),attributes,{'tableName':_0x7b75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index b921f25..3783294 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda15=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x26e43d,_0x384011){var _0x3552a7=function(_0x44ca2d){while(--_0x44ca2d){_0x26e43d['push'](_0x26e43d['shift']());}};_0x3552a7(++_0x384011);}(_0xda15,0xf8));var _0x5da1=function(_0xc066e8,_0x4b4943){_0xc066e8=_0xc066e8-0x0;var _0x4ba074=_0xda15[_0xc066e8];return _0x4ba074;};'use strict';var _=require(_0x5da1('0x0'));var util=require('util');var moment=require(_0x5da1('0x1'));var BPromise=require(_0x5da1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5da1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5da1('0x4'));var logger=require(_0x5da1('0x5'))(_0x5da1('0x6'));var config=require(_0x5da1('0x7'));var jayson=require(_0x5da1('0x8'));var client=jayson[_0x5da1('0x9')][_0x5da1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe02369,_0x3ba713,_0x204a02){return new BPromise(function(_0x40e9e1,_0x889b67){return client[_0x5da1('0xb')](_0xe02369,_0x204a02)[_0x5da1('0xc')](function(_0x3ba1f5){logger[_0x5da1('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x3ba713,_0x5da1('0xe'));logger[_0x5da1('0xf')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x3ba713,_0x5da1('0xe'),JSON[_0x5da1('0x10')](_0x3ba1f5));if(_0x3ba1f5['error']){if(_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x12')]===0x1f4){logger[_0x5da1('0x11')](_0x5da1('0x13'),_0x3ba713,_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x14')]);return _0x889b67(_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x14')]);}logger[_0x5da1('0x11')](_0x5da1('0x13'),_0x3ba713,_0x3ba1f5['error']['message']);return _0x40e9e1(_0x3ba1f5[_0x5da1('0x11')][_0x5da1('0x14')]);}else{logger[_0x5da1('0xd')](_0x5da1('0x13'),_0x3ba713,_0x5da1('0xe'));_0x40e9e1(_0x3ba1f5[_0x5da1('0x15')][_0x5da1('0x14')]);}})[_0x5da1('0x16')](function(_0x8440a7){logger['error'](_0x5da1('0x13'),_0x3ba713,_0x8440a7);_0x889b67(_0x8440a7);});});} \ No newline at end of file +var _0x7353=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','moment'];(function(_0x117289,_0x44a47a){var _0x48405f=function(_0x5d11c1){while(--_0x5d11c1){_0x117289['push'](_0x117289['shift']());}};_0x48405f(++_0x44a47a);}(_0x7353,0x1f2));var _0x3735=function(_0x1bb0f6,_0x570b08){_0x1bb0f6=_0x1bb0f6-0x0;var _0x5f3b55=_0x7353[_0x1bb0f6];return _0x5f3b55;};'use strict';var _=require('lodash');var util=require(_0x3735('0x0'));var moment=require(_0x3735('0x1'));var BPromise=require(_0x3735('0x2'));var rs=require(_0x3735('0x3'));var fs=require('fs');var Redis=require(_0x3735('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3735('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3735('0x6'));var jayson=require(_0x3735('0x7'));var client=jayson['client'][_0x3735('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x242efe,_0x5e2ad1,_0x32c53f){return new BPromise(function(_0x2177a1,_0x5e0df9){return client[_0x3735('0x9')](_0x242efe,_0x32c53f)[_0x3735('0xa')](function(_0x25ebda){logger['info'](_0x3735('0xb'),_0x5e2ad1,_0x3735('0xc'));logger[_0x3735('0xd')](_0x3735('0xe'),_0x5e2ad1,_0x3735('0xc'),JSON[_0x3735('0xf')](_0x25ebda));if(_0x25ebda['error']){if(_0x25ebda[_0x3735('0x10')][_0x3735('0x11')]===0x1f4){logger[_0x3735('0x10')](_0x3735('0xb'),_0x5e2ad1,_0x25ebda[_0x3735('0x10')]['message']);return _0x5e0df9(_0x25ebda[_0x3735('0x10')][_0x3735('0x12')]);}logger[_0x3735('0x10')](_0x3735('0xb'),_0x5e2ad1,_0x25ebda['error']['message']);return _0x2177a1(_0x25ebda['error'][_0x3735('0x12')]);}else{logger[_0x3735('0x13')](_0x3735('0xb'),_0x5e2ad1,_0x3735('0xc'));_0x2177a1(_0x25ebda['result'][_0x3735('0x12')]);}})['catch'](function(_0x19d12c){logger[_0x3735('0x10')](_0x3735('0xb'),_0x5e2ad1,_0x19d12c);_0x5e0df9(_0x19d12c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index b7f3833..b3837be 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf736=['isAuthenticated','index','get','/:id','post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasPhone.controller'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0xf736,0x191));var _0x6f73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf736[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6f73('0x0'));var path=require(_0x6f73('0x1'));var timeout=require(_0x6f73('0x2'));var express=require('express');var router=express[_0x6f73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f73('0x4'));var interaction=require(_0x6f73('0x5'));var config=require('../../config/environment');var controller=require(_0x6f73('0x6'));router['get']('/',auth[_0x6f73('0x7')](),controller[_0x6f73('0x8')]);router[_0x6f73('0x9')](_0x6f73('0xa'),auth[_0x6f73('0x7')](),controller['show']);router[_0x6f73('0xb')]('/',auth[_0x6f73('0x7')](),controller[_0x6f73('0xc')]);router[_0x6f73('0xd')](_0x6f73('0xa'),auth[_0x6f73('0x7')](),controller[_0x6f73('0xe')]);router[_0x6f73('0xf')](_0x6f73('0xa'),auth[_0x6f73('0x7')](),controller['destroy']);module[_0x6f73('0x10')]=router; \ No newline at end of file +var _0xde74=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xde74,0xc0));var _0x4de7=function(_0x6732d7,_0x399cf4){_0x6732d7=_0x6732d7-0x0;var _0x444ed4=_0xde74[_0x6732d7];return _0x444ed4;};'use strict';var multer=require(_0x4de7('0x0'));var util=require(_0x4de7('0x1'));var path=require(_0x4de7('0x2'));var timeout=require(_0x4de7('0x3'));var express=require(_0x4de7('0x4'));var router=express[_0x4de7('0x5')]();var fs_extra=require(_0x4de7('0x6'));var auth=require(_0x4de7('0x7'));var interaction=require(_0x4de7('0x8'));var config=require(_0x4de7('0x9'));var controller=require(_0x4de7('0xa'));router[_0x4de7('0xb')]('/',auth[_0x4de7('0xc')](),controller[_0x4de7('0xd')]);router[_0x4de7('0xb')](_0x4de7('0xe'),auth['isAuthenticated'](),controller[_0x4de7('0xf')]);router[_0x4de7('0x10')]('/',auth['isAuthenticated'](),controller[_0x4de7('0x11')]);router[_0x4de7('0x12')]('/:id',auth[_0x4de7('0xc')](),controller[_0x4de7('0x13')]);router[_0x4de7('0x14')](_0x4de7('0xe'),auth[_0x4de7('0xc')](),controller[_0x4de7('0x15')]);module[_0x4de7('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 26a5752..803d9f3 100644 --- a/server/api/cmCustomField/cmCustomField.attributes.js +++ b/server/api/cmCustomField/cmCustomField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ef0=['sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','name','TEXT','type','select','parse','values','setDataValue','stringify','BOOLEAN','voice'];(function(_0x3f288d,_0x3c7a97){var _0x5e8468=function(_0xb0189c){while(--_0xb0189c){_0x3f288d['push'](_0x3f288d['shift']());}};_0x5e8468(++_0x3c7a97);}(_0x0ef0,0x80));var _0x00ef=function(_0xc68650,_0x258343){_0xc68650=_0xc68650-0x0;var _0x57bd40=_0x0ef0[_0xc68650];return _0x57bd40;};'use strict';var Sequelize=require(_0x00ef('0x0'));var _=require(_0x00ef('0x1'));module['exports']={'name':{'type':Sequelize[_0x00ef('0x2')],'get':function(_0x282cce){return this[_0x00ef('0x3')](_0x00ef('0x4'));}},'alias':{'type':Sequelize[_0x00ef('0x5')],'allowNull':![],'set':function(_0x92e0b){this['setDataValue']('alias',_0x92e0b?_0x92e0b:this[_0x00ef('0x3')](_0x00ef('0x6')));}},'type':{'type':Sequelize[_0x00ef('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x00ef('0x7')]('long'),'get':function(){if(this[_0x00ef('0x3')](_0x00ef('0x8'))===_0x00ef('0x9')){return JSON[_0x00ef('0xa')](this[_0x00ef('0x3')]('values'));}else{return this[_0x00ef('0x3')](_0x00ef('0xb'));}},'set':function(_0x2dce41){if(Array['isArray'](_0x2dce41)){this[_0x00ef('0xc')]('values',JSON[_0x00ef('0xd')](_0x2dce41));}else{this[_0x00ef('0xc')](_0x00ef('0xb'),_0x2dce41);}}},'required':{'type':Sequelize[_0x00ef('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x00ef('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x00ef('0xf'))}}; \ No newline at end of file +var _0xec46=['stringify','setDataValue','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING','getDataValue','long','type','select','parse','values','isArray'];(function(_0x189d12,_0x17aafc){var _0x39b0ad=function(_0x21a7de){while(--_0x21a7de){_0x189d12['push'](_0x189d12['shift']());}};_0x39b0ad(++_0x17aafc);}(_0xec46,0x19c));var _0x6ec4=function(_0x241fc2,_0xe233db){_0x241fc2=_0x241fc2-0x0;var _0x3b15d9=_0xec46[_0x241fc2];return _0x3b15d9;};'use strict';var Sequelize=require(_0x6ec4('0x0'));var _=require(_0x6ec4('0x1'));module[_0x6ec4('0x2')]={'name':{'type':Sequelize[_0x6ec4('0x3')],'get':function(_0x5e854b){return this['getDataValue'](_0x6ec4('0x4'));}},'alias':{'type':Sequelize[_0x6ec4('0x5')],'allowNull':![],'set':function(_0x86b9f8){this['setDataValue'](_0x6ec4('0x4'),_0x86b9f8?_0x86b9f8:this[_0x6ec4('0x6')]('name'));}},'type':{'type':Sequelize[_0x6ec4('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x6ec4('0x7')),'get':function(){if(this[_0x6ec4('0x6')](_0x6ec4('0x8'))===_0x6ec4('0x9')){return JSON[_0x6ec4('0xa')](this[_0x6ec4('0x6')](_0x6ec4('0xb')));}else{return this[_0x6ec4('0x6')](_0x6ec4('0xb'));}},'set':function(_0x259d07){if(Array[_0x6ec4('0xc')](_0x259d07)){this['setDataValue']('values',JSON[_0x6ec4('0xd')](_0x259d07));}else{this[_0x6ec4('0xe')](_0x6ec4('0xb'),_0x259d07);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6ec4('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x6ec4('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 135fa77..13d73ee 100644 --- a/server/api/cmCustomField/cmCustomField.controller.js +++ b/server/api/cmCustomField/cmCustomField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['cf_%d','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','render','merge','body','message','agent','interaction','account','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','queryInterface','cm_contacts','format'];(function(_0x4bb429,_0x4c1363){var _0x4a824b=function(_0x57c840){while(--_0x57c840){_0x4bb429['push'](_0x4bb429['shift']());}};_0x4a824b(++_0x4c1363);}(_0x31f0,0xb7));var _0x031f=function(_0x3e5dcc,_0x54a7a6){_0x3e5dcc=_0x3e5dcc-0x0;var _0x37eecc=_0x31f0[_0x3e5dcc];return _0x37eecc;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=typeof _0x1f08db[_0x031f('0x1b')]==='undefined'&&typeof _0x1f08db[_0x031f('0x1c')]===_0x031f('0x1d');var _0x5d0c70=_0x3a10aa[_0x031f('0x1e')];var _0x535e70=_0xe4fc1d?0x0:_0x1f08db[_0x031f('0x1b')];var _0x5f2199=_0xe4fc1d?_0x3a10aa[_0x031f('0x1e')]:_0x1f08db[_0x031f('0x1b')]+_0x1f08db[_0x031f('0x1c')];var _0x26cb5e;if(_0x5f2199>=_0x5d0c70){_0x5f2199=_0x5d0c70;_0x26cb5e=0xc8;}else{_0x26cb5e=0xce;}_0x4b7011[_0x031f('0x1a')](_0x26cb5e);return _0x4b7011[_0x031f('0x1f')](_0x031f('0x20'),_0x535e70+'-'+_0x5f2199+'/'+_0x5d0c70)[_0x031f('0x21')](_0x3a10aa);}return null;};}function patchUpdates(_0x29dd6e){return function(_0x48a76e){try{jsonpatch[_0x031f('0x22')](_0x48a76e,_0x29dd6e,!![]);}catch(_0x33926c){return BPromise[_0x031f('0x23')](_0x33926c);}return _0x48a76e['save']();};}function saveUpdates(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x24')](_0x5c4184)['then'](function(_0x54d054){return _0x54d054;});}return null;};}function removeEntity(_0x47d639,_0x971691){return function(_0x12c406){if(_0x12c406){return _0x12c406[_0x031f('0x25')]()[_0x031f('0x26')](function(){_0x47d639['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(!_0x1f5a14){_0x5a64c0[_0x031f('0x18')](0x194);}return _0x1f5a14;};}function handleError(_0x567666,_0x35af16){_0x35af16=_0x35af16||0x1f4;return function(_0x3b2a51){logger['error'](_0x3b2a51[_0x031f('0x27')]);if(_0x3b2a51[_0x031f('0x28')]){delete _0x3b2a51[_0x031f('0x28')];}_0x567666['status'](_0x35af16)[_0x031f('0x29')](_0x3b2a51);};}function getMustacheRender(_0x114e34,_0xb6ed6c){return Mustache[_0x031f('0x2a')](_0x114e34,_[_0x031f('0x2b')](_0xb6ed6c[_0x031f('0x2c')],{'contact':_0xb6ed6c['contact'],'message':_0xb6ed6c[_0x031f('0x2d')],'agent':_0xb6ed6c[_0x031f('0x2e')],'interaction':_0xb6ed6c[_0x031f('0x2f')],'account':_0xb6ed6c[_0x031f('0x30')]}))||'';}exports[_0x031f('0x31')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x32')][_0x031f('0x33')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x34')],'type':_0xb3a6bd[_0x031f('0x35')][_0x031f('0x36')]};});_0x2034ac[_0x031f('0x37')]=_[_0x031f('0x38')](_[_0x031f('0x39')](_0x2cf3a8,_0x031f('0x28')),[_0x031f('0x28')]);_0x2034ac[_0x031f('0x3a')]=_[_0x031f('0x3b')](_0x2d24f0['query']);_0x2034ac[_0x031f('0x3c')]=_[_0x031f('0x3d')](_0x2034ac['model'],_0x2034ac[_0x031f('0x3a')]);_0x87dc07[_0x031f('0x3e')]=_['intersection'](_0x2034ac[_0x031f('0x37')],qs[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x3a')][_0x031f('0x3f')]));_0x87dc07['attributes']=_0x87dc07['attributes'][_0x031f('0x40')]?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x37')];if(!_0x2d24f0[_0x031f('0x3a')][_0x031f('0x41')]('nolimit')){_0x87dc07['limit']=qs[_0x031f('0x1c')](_0x2d24f0['query']['limit']);_0x87dc07[_0x031f('0x1b')]=qs[_0x031f('0x1b')](_0x2d24f0[_0x031f('0x3a')][_0x031f('0x1b')]);}_0x87dc07[_0x031f('0x42')]=qs[_0x031f('0x43')](_0x2d24f0[_0x031f('0x3a')]['sort']);_0x87dc07[_0x031f('0x44')]=qs[_0x031f('0x3c')](_[_0x031f('0x45')](_0x2d24f0[_0x031f('0x3a')],_0x2034ac['filters']),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x3a')][_0x031f('0x46')]){_0x87dc07[_0x031f('0x44')]=_['merge'](_0x87dc07[_0x031f('0x44')],{'$or':_[_0x031f('0x39')](_0x2cf3a8,function(_0x5d6826){if(_0x5d6826[_0x031f('0x35')]!==_0x031f('0x47')){var _0x56a8f3={};_0x56a8f3[_0x5d6826['name']]={'$like':'%'+_0x2d24f0[_0x031f('0x3a')][_0x031f('0x46')]+'%'};return _0x56a8f3;}})});}_0x87dc07=_[_0x031f('0x2b')]({},_0x87dc07,_0x2d24f0[_0x031f('0x48')]);var _0x2691b7={'where':_0x87dc07[_0x031f('0x44')]};return db[_0x031f('0x32')]['count'](_0x2691b7)[_0x031f('0x26')](function(_0xe71615){_0xfc4a89['count']=_0xe71615;if(_0x2d24f0[_0x031f('0x3a')]['includeAll']){_0x87dc07[_0x031f('0x49')]=[{'all':!![]}];}return db[_0x031f('0x32')]['findAll'](_0x87dc07);})[_0x031f('0x26')](function(_0x391cd1){_0xfc4a89[_0x031f('0x4a')]=_0x391cd1;return _0xfc4a89;})['then'](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x4b')](handleError(_0x378692,null));};exports[_0x031f('0x4c')]=function(_0x1d3324,_0x2a6cba){var _0x177306={'raw':!![],'where':{'id':_0x1d3324[_0x031f('0x4d')]['id']}},_0x193b8f={};_0x193b8f[_0x031f('0x37')]=_[_0x031f('0x3b')](db['CmCustomField'][_0x031f('0x33')]);_0x193b8f[_0x031f('0x3a')]=_[_0x031f('0x3b')](_0x1d3324[_0x031f('0x3a')]);_0x193b8f[_0x031f('0x3c')]=_[_0x031f('0x3d')](_0x193b8f[_0x031f('0x37')],_0x193b8f[_0x031f('0x3a')]);_0x177306[_0x031f('0x3e')]=_['intersection'](_0x193b8f[_0x031f('0x37')],qs['fields'](_0x1d3324['query'][_0x031f('0x3f')]));_0x177306[_0x031f('0x3e')]=_0x177306[_0x031f('0x3e')][_0x031f('0x40')]?_0x177306[_0x031f('0x3e')]:_0x193b8f['model'];if(_0x1d3324[_0x031f('0x3a')][_0x031f('0x4e')]){_0x177306[_0x031f('0x49')]=[{'all':!![]}];}_0x177306=_['merge']({},_0x177306,_0x1d3324[_0x031f('0x48')]);return db[_0x031f('0x32')][_0x031f('0x4f')](_0x177306)[_0x031f('0x26')](handleEntityNotFound(_0x2a6cba,null))[_0x031f('0x26')](respondWithResult(_0x2a6cba,null))[_0x031f('0x4b')](handleError(_0x2a6cba,null));};exports['update']=function(_0x569d8f,_0xd28ade){if(_0x569d8f['body']['id']){delete _0x569d8f[_0x031f('0x2c')]['id'];}return db[_0x031f('0x32')]['find']({'where':{'id':_0x569d8f[_0x031f('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd28ade,null))['then'](saveUpdates(_0x569d8f[_0x031f('0x2c')],null))['then'](respondWithResult(_0xd28ade,null))[_0x031f('0x4b')](handleError(_0xd28ade,null));};exports['destroy']=function(_0x11bf43,_0x2137c3){return db['CmCustomField'][_0x031f('0x4f')]({'where':{'id':_0x11bf43[_0x031f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2137c3,null))[_0x031f('0x26')](removeEntity(_0x2137c3,null))['catch'](handleError(_0x2137c3,null));};exports[_0x031f('0x50')]=function(_0x5e18f0,_0x1464df){var _0x24848b;return db[_0x031f('0x51')][_0x031f('0x52')](function(_0x691a68){return db['CmCustomField'][_0x031f('0x50')](_0x5e18f0['body'],{'transaction':_0x691a68})[_0x031f('0x26')](function(_0x414350){_0x24848b=_0x414350;var _0x4d49f8={'type':db[_0x031f('0x53')][_0x031f('0x54')],'transaction':_0x691a68};switch(_0x5e18f0['body'][_0x031f('0x35')]){case _0x031f('0x55'):_0x4d49f8[_0x031f('0x35')]=db['Sequelize'][_0x031f('0x54')];break;case'number':_0x4d49f8[_0x031f('0x35')]=db['Sequelize'][_0x031f('0x56')];break;case'switch':_0x4d49f8[_0x031f('0x35')]=db[_0x031f('0x53')]['BOOLEAN'];_0x4d49f8['defaultValue']=![];break;default:}return db[_0x031f('0x51')][_0x031f('0x57')]['addColumn'](_0x031f('0x58'),util[_0x031f('0x59')](_0x031f('0x5a'),_0x24848b['id']),_0x4d49f8);})[_0x031f('0x26')](function(){return _0x24848b;});})[_0x031f('0x26')](respondWithResult(_0x1464df,0xc9))[_0x031f('0x4b')](handleError(_0x1464df,null));}; \ No newline at end of file +var _0x8958=['limit','count','offset','apply','reject','save','update','then','error','name','send','merge','body','contact','message','agent','index','CmCustomField','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','filter','options','includeAll','include','catch','show','rawAttributes','find','destroy','params','create','sequelize','transaction','Sequelize','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x1831ca,_0x33fdd6){var _0x58dfcb=function(_0x302eaa){while(--_0x302eaa){_0x1831ca['push'](_0x1831ca['shift']());}};_0x58dfcb(++_0x33fdd6);}(_0x8958,0x93));var _0x8895=function(_0x104b77,_0x4c9182){_0x104b77=_0x104b77-0x0;var _0x156025=_0x8958[_0x104b77];return _0x156025;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}function getMustacheRender(_0x153220,_0x5c03ea){return Mustache['render'](_0x153220,_[_0x8895('0x28')](_0x5c03ea[_0x8895('0x29')],{'contact':_0x5c03ea[_0x8895('0x2a')],'message':_0x5c03ea[_0x8895('0x2b')],'agent':_0x5c03ea[_0x8895('0x2c')],'interaction':_0x5c03ea['interaction'],'account':_0x5c03ea['account']}))||'';}exports[_0x8895('0x2d')]=function(_0x848a11,_0x1c16f6){var _0x29f565={},_0x1eabb6={},_0x52f2ac={'count':0x0,'rows':[]};var _0x1da939=_['map'](db[_0x8895('0x2e')]['rawAttributes'],function(_0x40ba14){return{'name':_0x40ba14[_0x8895('0x2f')],'type':_0x40ba14[_0x8895('0x30')][_0x8895('0x31')]};});_0x1eabb6[_0x8895('0x32')]=_['differenceBy'](_[_0x8895('0x33')](_0x1da939,_0x8895('0x26')),[_0x8895('0x26')]);_0x1eabb6[_0x8895('0x34')]=_[_0x8895('0x35')](_0x848a11['query']);_0x1eabb6[_0x8895('0x36')]=_['intersection'](_0x1eabb6[_0x8895('0x32')],_0x1eabb6['query']);_0x29f565[_0x8895('0x37')]=_[_0x8895('0x38')](_0x1eabb6[_0x8895('0x32')],qs[_0x8895('0x39')](_0x848a11[_0x8895('0x34')]['fields']));_0x29f565[_0x8895('0x37')]=_0x29f565['attributes'][_0x8895('0x3a')]?_0x29f565[_0x8895('0x37')]:_0x1eabb6[_0x8895('0x32')];if(!_0x848a11[_0x8895('0x34')][_0x8895('0x3b')](_0x8895('0x3c'))){_0x29f565['limit']=qs[_0x8895('0x1d')](_0x848a11[_0x8895('0x34')]['limit']);_0x29f565[_0x8895('0x1f')]=qs['offset'](_0x848a11[_0x8895('0x34')][_0x8895('0x1f')]);}_0x29f565['order']=qs[_0x8895('0x3d')](_0x848a11[_0x8895('0x34')]['sort']);_0x29f565['where']=qs[_0x8895('0x36')](_[_0x8895('0x3e')](_0x848a11[_0x8895('0x34')],_0x1eabb6[_0x8895('0x36')]),_0x1da939);if(_0x848a11[_0x8895('0x34')]['filter']){_0x29f565[_0x8895('0x3f')]=_[_0x8895('0x28')](_0x29f565[_0x8895('0x3f')],{'$or':_[_0x8895('0x33')](_0x1da939,function(_0x1d9e26){if(_0x1d9e26[_0x8895('0x30')]!=='VIRTUAL'){var _0x174be1={};_0x174be1[_0x1d9e26['name']]={'$like':'%'+_0x848a11[_0x8895('0x34')][_0x8895('0x40')]+'%'};return _0x174be1;}})});}_0x29f565=_['merge']({},_0x29f565,_0x848a11[_0x8895('0x41')]);var _0x4e8fbc={'where':_0x29f565[_0x8895('0x3f')]};return db['CmCustomField']['count'](_0x4e8fbc)['then'](function(_0x4cd625){_0x52f2ac['count']=_0x4cd625;if(_0x848a11['query'][_0x8895('0x42')]){_0x29f565[_0x8895('0x43')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x29f565);})[_0x8895('0x24')](function(_0x3d765d){_0x52f2ac['rows']=_0x3d765d;return _0x52f2ac;})[_0x8895('0x24')](respondWithFilteredResult(_0x1c16f6,_0x29f565))[_0x8895('0x44')](handleError(_0x1c16f6,null));};exports[_0x8895('0x45')]=function(_0x3b873b,_0x2d07d6){var _0x598ed5={'raw':!![],'where':{'id':_0x3b873b['params']['id']}},_0x549080={};_0x549080[_0x8895('0x32')]=_['keys'](db[_0x8895('0x2e')][_0x8895('0x46')]);_0x549080[_0x8895('0x34')]=_[_0x8895('0x35')](_0x3b873b['query']);_0x549080[_0x8895('0x36')]=_[_0x8895('0x38')](_0x549080[_0x8895('0x32')],_0x549080[_0x8895('0x34')]);_0x598ed5[_0x8895('0x37')]=_[_0x8895('0x38')](_0x549080[_0x8895('0x32')],qs[_0x8895('0x39')](_0x3b873b['query'][_0x8895('0x39')]));_0x598ed5[_0x8895('0x37')]=_0x598ed5['attributes'][_0x8895('0x3a')]?_0x598ed5['attributes']:_0x549080['model'];if(_0x3b873b[_0x8895('0x34')][_0x8895('0x42')]){_0x598ed5[_0x8895('0x43')]=[{'all':!![]}];}_0x598ed5=_['merge']({},_0x598ed5,_0x3b873b[_0x8895('0x41')]);return db['CmCustomField'][_0x8895('0x47')](_0x598ed5)[_0x8895('0x24')](handleEntityNotFound(_0x2d07d6,null))[_0x8895('0x24')](respondWithResult(_0x2d07d6,null))[_0x8895('0x44')](handleError(_0x2d07d6,null));};exports[_0x8895('0x23')]=function(_0x21c954,_0xebb0c4){if(_0x21c954['body']['id']){delete _0x21c954['body']['id'];}return db[_0x8895('0x2e')][_0x8895('0x47')]({'where':{'id':_0x21c954['params']['id']}})[_0x8895('0x24')](handleEntityNotFound(_0xebb0c4,null))['then'](saveUpdates(_0x21c954['body'],null))[_0x8895('0x24')](respondWithResult(_0xebb0c4,null))['catch'](handleError(_0xebb0c4,null));};exports[_0x8895('0x48')]=function(_0x2c2979,_0x43aada){return db[_0x8895('0x2e')][_0x8895('0x47')]({'where':{'id':_0x2c2979[_0x8895('0x49')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x43aada,null))[_0x8895('0x24')](removeEntity(_0x43aada,null))['catch'](handleError(_0x43aada,null));};exports[_0x8895('0x4a')]=function(_0x3e25e7,_0x2f81f7){var _0x5a5bc6;return db[_0x8895('0x4b')][_0x8895('0x4c')](function(_0xd7ffeb){return db[_0x8895('0x2e')][_0x8895('0x4a')](_0x3e25e7[_0x8895('0x29')],{'transaction':_0xd7ffeb})[_0x8895('0x24')](function(_0x216e6e){_0x5a5bc6=_0x216e6e;var _0x13488f={'type':db[_0x8895('0x4d')]['TEXT'],'transaction':_0xd7ffeb};switch(_0x3e25e7[_0x8895('0x29')][_0x8895('0x30')]){case _0x8895('0x4e'):_0x13488f[_0x8895('0x30')]=db[_0x8895('0x4d')]['TEXT'];break;case _0x8895('0x4f'):_0x13488f[_0x8895('0x30')]=db[_0x8895('0x4d')][_0x8895('0x50')];break;case _0x8895('0x51'):_0x13488f['type']=db[_0x8895('0x4d')][_0x8895('0x52')];_0x13488f[_0x8895('0x53')]=![];break;default:}return db['sequelize'][_0x8895('0x54')][_0x8895('0x55')](_0x8895('0x56'),util['format'](_0x8895('0x57'),_0x5a5bc6['id']),_0x13488f);})[_0x8895('0x24')](function(){return _0x5a5bc6;});})['then'](respondWithResult(_0x2f81f7,0xc9))[_0x8895('0x44')](handleError(_0x2f81f7,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 02f6411..0a15636 100644 --- a/server/api/cmCustomField/cmCustomField.model.js +++ b/server/api/cmCustomField/cmCustomField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x564d=['define','CmCustomField','util','../../config/logger','moment','bluebird','path','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x208f9d,_0x3c5881){var _0x200fb3=function(_0x4ae500){while(--_0x4ae500){_0x208f9d['push'](_0x208f9d['shift']());}};_0x200fb3(++_0x3c5881);}(_0x564d,0x66));var _0xd564=function(_0x545731,_0x1b9f4e){_0x545731=_0x545731-0x0;var _0x2e3b57=_0x564d[_0x545731];return _0x2e3b57;};'use strict';var _=require('lodash');var util=require(_0xd564('0x0'));var logger=require(_0xd564('0x1'))('api');var moment=require(_0xd564('0x2'));var BPromise=require(_0xd564('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd564('0x4'));var rimraf=require('rimraf');var config=require(_0xd564('0x5'));var attributes=require(_0xd564('0x6'));module[_0xd564('0x7')]=function(_0x15592f,_0x460fb3){return _0x15592f[_0xd564('0x8')](_0xd564('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x223e=['rimraf','../../config/environment','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x576811,_0x28f89f){var _0x5d6c1a=function(_0x1ba88e){while(--_0x1ba88e){_0x576811['push'](_0x576811['shift']());}};_0x5d6c1a(++_0x28f89f);}(_0x223e,0x1b1));var _0xe223=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x223e[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0xe223('0x0'));var util=require(_0xe223('0x1'));var logger=require(_0xe223('0x2'))('api');var moment=require(_0xe223('0x3'));var BPromise=require(_0xe223('0x4'));var rp=require(_0xe223('0x5'));var fs=require('fs');var path=require(_0xe223('0x6'));var rimraf=require(_0xe223('0x7'));var config=require(_0xe223('0x8'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x3084b0,_0xde7d70){return _0x3084b0['define'](_0xe223('0x9'),attributes,{'tableName':_0xe223('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 88548bd..4df2b05 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x984b=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info'];(function(_0x1250e9,_0x1a05f8){var _0x41756c=function(_0xb64c9d){while(--_0xb64c9d){_0x1250e9['push'](_0x1250e9['shift']());}};_0x41756c(++_0x1a05f8);}(_0x984b,0xee));var _0xb984=function(_0x493309,_0x1a94a4){_0x493309=_0x493309-0x0;var _0x1e705b=_0x984b[_0x493309];return _0x1e705b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});} \ No newline at end of file +var _0x68fc=['stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x35d712,_0x133520){var _0x5e286d=function(_0x2d0007){while(--_0x2d0007){_0x35d712['push'](_0x35d712['shift']());}};_0x5e286d(++_0x133520);}(_0x68fc,0xa5));var _0xc68f=function(_0x48db3d,_0x5e0a31){_0x48db3d=_0x48db3d-0x0;var _0x43aa57=_0x68fc[_0x48db3d];return _0x43aa57;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var moment=require(_0xc68f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc68f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc68f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc68f('0x5'));var jayson=require(_0xc68f('0x6'));var client=jayson[_0xc68f('0x7')][_0xc68f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fcce4,_0x4a6f7d,_0x9f2705){return new BPromise(function(_0x2bf3fd,_0x370977){return client[_0xc68f('0x9')](_0x4fcce4,_0x9f2705)[_0xc68f('0xa')](function(_0x1ee022){logger[_0xc68f('0xb')](_0xc68f('0xc'),_0x4a6f7d,_0xc68f('0xd'));logger[_0xc68f('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4a6f7d,_0xc68f('0xd'),JSON[_0xc68f('0xf')](_0x1ee022));if(_0x1ee022[_0xc68f('0x10')]){if(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x11')]===0x1f4){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0x4a6f7d,_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);return _0x370977(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);}logger['error'](_0xc68f('0xc'),_0x4a6f7d,_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);return _0x2bf3fd(_0x1ee022[_0xc68f('0x10')][_0xc68f('0x12')]);}else{logger[_0xc68f('0xb')](_0xc68f('0xc'),_0x4a6f7d,_0xc68f('0xd'));_0x2bf3fd(_0x1ee022[_0xc68f('0x13')]['message']);}})['catch'](function(_0x3a6c06){logger[_0xc68f('0x10')](_0xc68f('0xc'),_0x4a6f7d,_0x3a6c06);_0x370977(_0x3a6c06);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a49befc..f52d8a1 100644 --- a/server/api/cmCustomField/index.js +++ b/server/api/cmCustomField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58c1=['index','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0x4640bc,_0x444c26){var _0x3cafa0=function(_0xf24e13){while(--_0xf24e13){_0x4640bc['push'](_0x4640bc['shift']());}};_0x3cafa0(++_0x444c26);}(_0x58c1,0x1e4));var _0x158c=function(_0x3ac90d,_0x55da04){_0x3ac90d=_0x3ac90d-0x0;var _0x1b8acf=_0x58c1[_0x3ac90d];return _0x1b8acf;};'use strict';var multer=require(_0x158c('0x0'));var util=require(_0x158c('0x1'));var path=require(_0x158c('0x2'));var timeout=require('connect-timeout');var express=require(_0x158c('0x3'));var router=express[_0x158c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x158c('0x5'));var config=require(_0x158c('0x6'));var controller=require(_0x158c('0x7'));router[_0x158c('0x8')]('/',auth[_0x158c('0x9')](),controller[_0x158c('0xa')]);router[_0x158c('0x8')]('/:id',auth[_0x158c('0x9')](),controller[_0x158c('0xb')]);router[_0x158c('0xc')]('/',auth[_0x158c('0x9')](),controller['create']);router[_0x158c('0xd')]('/:id',auth[_0x158c('0x9')](),controller[_0x158c('0xe')]);router[_0x158c('0xf')](_0x158c('0x10'),auth['isAuthenticated'](),controller[_0x158c('0x11')]);module[_0x158c('0x12')]=router; \ No newline at end of file +var _0xfda1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','express'];(function(_0x2b88a6,_0x8cfbe2){var _0x177c9e=function(_0xef1e63){while(--_0xef1e63){_0x2b88a6['push'](_0x2b88a6['shift']());}};_0x177c9e(++_0x8cfbe2);}(_0xfda1,0x1d0));var _0x1fda=function(_0x30ff16,_0x9b3593){_0x30ff16=_0x30ff16-0x0;var _0x3b8d36=_0xfda1[_0x30ff16];return _0x3b8d36;};'use strict';var multer=require(_0x1fda('0x0'));var util=require(_0x1fda('0x1'));var path=require(_0x1fda('0x2'));var timeout=require('connect-timeout');var express=require(_0x1fda('0x3'));var router=express[_0x1fda('0x4')]();var fs_extra=require(_0x1fda('0x5'));var auth=require(_0x1fda('0x6'));var interaction=require(_0x1fda('0x7'));var config=require('../../config/environment');var controller=require(_0x1fda('0x8'));router[_0x1fda('0x9')]('/',auth[_0x1fda('0xa')](),controller['index']);router[_0x1fda('0x9')](_0x1fda('0xb'),auth['isAuthenticated'](),controller[_0x1fda('0xc')]);router[_0x1fda('0xd')]('/',auth[_0x1fda('0xa')](),controller[_0x1fda('0xe')]);router[_0x1fda('0xf')](_0x1fda('0xb'),auth[_0x1fda('0xa')](),controller[_0x1fda('0x10')]);router[_0x1fda('0x11')]('/:id',auth[_0x1fda('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 25e3ad9..3bcf072 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabce,0x103));var _0xeabc=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xabce[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require(_0xeabc('0x0'));var Sequelize=require(_0xeabc('0x1'));module[_0xeabc('0x2')]={'phone':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xeabc('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xeabc('0x5'))},'countbusyretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xeabc('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xeabc('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xeabc('0x6')],'unique':_0xeabc('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xeabc('0x7')},'UserId':{'type':Sequelize[_0xeabc('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xeabc('0x6')],'unique':_0xeabc('0x7')},'CampaignId':{'type':Sequelize[_0xeabc('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeabc('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x885a=['INTEGER','DATE','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x885a,0x180));var _0xa885=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x885a[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require('moment');var Sequelize=require(_0xa885('0x0'));module[_0xa885('0x1')]={'phone':{'type':Sequelize[_0xa885('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa885('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xa885('0x4')](_0xa885('0x5'))},'countbusyretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa885('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa885('0x7')]},'priority':{'type':Sequelize[_0xa885('0x6')](0x2)[_0xa885('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa885('0x6')],'unique':_0xa885('0x9')},'ListId':{'type':Sequelize[_0xa885('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xa885('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xa885('0x6')],'unique':_0xa885('0x9')},'CampaignId':{'type':Sequelize[_0xa885('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa885('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index a3c39ad..d33b7cb 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x183f=['List','Queue','dialActive','getOpenContacts','isNumber','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','stack','name','send','render','merge','body','message','interaction','index','map','CmHopper','rawAttributes','type','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','campaign','membername','UserId','user','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x183f,0x9d));var _0xf183=function(_0x255bea,_0x298ba8){_0x255bea=_0x255bea-0x0;var _0x5151a9=_0x183f[_0x255bea];return _0x5151a9;};'use strict';var emlformat=require(_0xf183('0x0'));var rimraf=require(_0xf183('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf183('0x2'));var rp=require(_0xf183('0x3'));var moment=require(_0xf183('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf183('0x5'));var util=require(_0xf183('0x6'));var path=require(_0xf183('0x7'));var sox=require(_0xf183('0x8'));var csv=require(_0xf183('0x9'));var ejs=require(_0xf183('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf183('0xb'));var squel=require('squel');var crypto=require(_0xf183('0xc'));var jsforce=require(_0xf183('0xd'));var deskjs=require(_0xf183('0xe'));var toCsv=require(_0xf183('0x9'));var querystring=require(_0xf183('0xf'));var Papa=require(_0xf183('0x10'));var Redis=require(_0xf183('0x11'));var authService=require(_0xf183('0x12'));var qs=require(_0xf183('0x13'));var as=require(_0xf183('0x14'));var hardwareService=require(_0xf183('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf183('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf183('0x17'));var db=require(_0xf183('0x18'))['db'];function respondWithStatusCode(_0x3af97a,_0x362ff4){_0x362ff4=_0x362ff4||0xcc;return function(_0x3d7a7b){if(_0x3d7a7b){return _0x3af97a[_0xf183('0x19')](_0x362ff4);}return _0x3af97a[_0xf183('0x1a')](_0x362ff4)['end']();};}function respondWithResult(_0x27a066,_0x3eaa19){_0x3eaa19=_0x3eaa19||0xc8;return function(_0x30fbbf){if(_0x30fbbf){return _0x27a066[_0xf183('0x1a')](_0x3eaa19)[_0xf183('0x1b')](_0x30fbbf);}};}function respondWithFilteredResult(_0x568c55,_0x402ccc){return function(_0x3624d5){if(_0x3624d5){var _0x1e7713=typeof _0x402ccc[_0xf183('0x1c')]===_0xf183('0x1d')&&typeof _0x402ccc['limit']===_0xf183('0x1d');var _0x2f0f48=_0x3624d5[_0xf183('0x1e')];var _0x2fb253=_0x1e7713?0x0:_0x402ccc[_0xf183('0x1c')];var _0x876ae5=_0x1e7713?_0x3624d5[_0xf183('0x1e')]:_0x402ccc[_0xf183('0x1c')]+_0x402ccc[_0xf183('0x1f')];var _0x173a64;if(_0x876ae5>=_0x2f0f48){_0x876ae5=_0x2f0f48;_0x173a64=0xc8;}else{_0x173a64=0xce;}_0x568c55['status'](_0x173a64);return _0x568c55[_0xf183('0x20')]('Content-Range',_0x2fb253+'-'+_0x876ae5+'/'+_0x2f0f48)[_0xf183('0x1b')](_0x3624d5);}return null;};}function patchUpdates(_0x24956){return function(_0xed90b9){try{jsonpatch[_0xf183('0x21')](_0xed90b9,_0x24956,!![]);}catch(_0x6fc4e0){return BPromise[_0xf183('0x22')](_0x6fc4e0);}return _0xed90b9[_0xf183('0x23')]();};}function saveUpdates(_0x11e48d,_0x6da37a){return function(_0x21dd72){if(_0x21dd72){return _0x21dd72[_0xf183('0x24')](_0x11e48d)[_0xf183('0x25')](function(_0x13217c){return _0x13217c;});}return null;};}function removeEntity(_0x1696ae,_0x5d5380){return function(_0x42c0df){if(_0x42c0df){return _0x42c0df['destroy']()[_0xf183('0x25')](function(){_0x1696ae['status'](0xcc)[_0xf183('0x26')]();});}};}function handleEntityNotFound(_0x38fbf0,_0x39fa80){return function(_0x5bf195){if(!_0x5bf195){_0x38fbf0[_0xf183('0x19')](0x194);}return _0x5bf195;};}function handleError(_0x370dae,_0x38501f){_0x38501f=_0x38501f||0x1f4;return function(_0x2b4970){logger[_0xf183('0x27')](_0x2b4970[_0xf183('0x28')]);if(_0x2b4970[_0xf183('0x29')]){delete _0x2b4970[_0xf183('0x29')];}_0x370dae[_0xf183('0x1a')](_0x38501f)[_0xf183('0x2a')](_0x2b4970);};}function getMustacheRender(_0x2fd7fe,_0x26ba2c){return Mustache[_0xf183('0x2b')](_0x2fd7fe,_[_0xf183('0x2c')](_0x26ba2c[_0xf183('0x2d')],{'contact':_0x26ba2c['contact'],'message':_0x26ba2c[_0xf183('0x2e')],'agent':_0x26ba2c['agent'],'interaction':_0x26ba2c[_0xf183('0x2f')],'account':_0x26ba2c['account']}))||'';}exports[_0xf183('0x30')]=function(_0x32dc03,_0x9c6191){var _0x415f1b={},_0x24554f={},_0x5e411e={'count':0x0,'rows':[]};var _0x28c123=_[_0xf183('0x31')](db[_0xf183('0x32')][_0xf183('0x33')],function(_0x2eafd7){return{'name':_0x2eafd7['fieldName'],'type':_0x2eafd7[_0xf183('0x34')]['key']};});_0x24554f[_0xf183('0x35')]=_[_0xf183('0x31')](_0x28c123,_0xf183('0x29'));_0x24554f[_0xf183('0x36')]=_[_0xf183('0x37')](_0x32dc03['query']);_0x24554f[_0xf183('0x38')]=_[_0xf183('0x39')](_0x24554f[_0xf183('0x35')],_0x24554f['query']);_0x24554f['filters']=_[_0xf183('0x3a')](_0x24554f[_0xf183('0x38')],[_0xf183('0x3b'),'$or',_0xf183('0x3c'),_0xf183('0x3d'),_0xf183('0x3e'),'$lte','$ne',_0xf183('0x3f'),_0xf183('0x40'),_0xf183('0x41'),_0xf183('0x42'),_0xf183('0x43'),'$notIn','$like',_0xf183('0x44'),'$iLike','$notILike','$like',_0xf183('0x45'),_0xf183('0x46'),_0xf183('0x47'),_0xf183('0x48')]);_0x415f1b[_0xf183('0x49')]=_[_0xf183('0x39')](_0x24554f[_0xf183('0x35')],qs[_0xf183('0x4a')](_0x32dc03[_0xf183('0x36')][_0xf183('0x4a')]));_0x415f1b[_0xf183('0x49')]=_0x415f1b['attributes'][_0xf183('0x4b')]?_0x415f1b[_0xf183('0x49')]:_0x24554f['model'];if(!_0x32dc03['query'][_0xf183('0x4c')](_0xf183('0x4d'))){_0x415f1b[_0xf183('0x1f')]=qs['limit'](_0x32dc03[_0xf183('0x36')][_0xf183('0x1f')]);_0x415f1b[_0xf183('0x1c')]=qs['offset'](_0x32dc03[_0xf183('0x36')][_0xf183('0x1c')]);}_0x415f1b[_0xf183('0x4e')]=qs[_0xf183('0x4f')](_0x32dc03[_0xf183('0x36')]['sort']);_0x415f1b[_0xf183('0x50')]=qs['filters'](_[_0xf183('0x51')](_0x32dc03[_0xf183('0x36')],_0x24554f[_0xf183('0x38')]),_0x28c123);if(_0x32dc03[_0xf183('0x36')][_0xf183('0x52')]){_0x415f1b[_0xf183('0x50')]=_[_0xf183('0x2c')](_0x415f1b[_0xf183('0x50')],{'$or':_[_0xf183('0x31')](_0x28c123,function(_0x17299f){if(_0x17299f[_0xf183('0x34')]!==_0xf183('0x53')){var _0x1b07dd={};_0x1b07dd[_0x17299f[_0xf183('0x29')]]={'$like':'%'+_0x32dc03[_0xf183('0x36')][_0xf183('0x52')]+'%'};return _0x1b07dd;}})});}_0x415f1b=_[_0xf183('0x2c')]({},_0x415f1b,_0x32dc03[_0xf183('0x54')]);var _0x30e9f7={'where':_0x415f1b['where']};return db['CmHopper'][_0xf183('0x1e')](_0x30e9f7)[_0xf183('0x25')](function(_0xb5afda){_0x5e411e[_0xf183('0x1e')]=_0xb5afda;if(_0x32dc03['query'][_0xf183('0x55')]){_0x415f1b[_0xf183('0x56')]=[{'all':!![]}];}return db['CmHopper'][_0xf183('0x57')](_0x415f1b);})[_0xf183('0x25')](function(_0x3ff740){_0x5e411e[_0xf183('0x58')]=_0x3ff740;return _0x5e411e;})[_0xf183('0x25')](respondWithFilteredResult(_0x9c6191,_0x415f1b))[_0xf183('0x59')](handleError(_0x9c6191,null));};exports[_0xf183('0x5a')]=function(_0x1b591b,_0x3c6228){var _0x5f287f={'raw':!![],'where':{'id':_0x1b591b[_0xf183('0x5b')]['id']}},_0x4af299={};_0x4af299[_0xf183('0x35')]=_[_0xf183('0x37')](db['CmHopper']['rawAttributes']);_0x4af299[_0xf183('0x36')]=_['keys'](_0x1b591b[_0xf183('0x36')]);_0x4af299[_0xf183('0x38')]=_[_0xf183('0x39')](_0x4af299[_0xf183('0x35')],_0x4af299[_0xf183('0x36')]);_0x5f287f[_0xf183('0x49')]=_[_0xf183('0x39')](_0x4af299[_0xf183('0x35')],qs['fields'](_0x1b591b[_0xf183('0x36')]['fields']));_0x5f287f[_0xf183('0x49')]=_0x5f287f[_0xf183('0x49')]['length']?_0x5f287f[_0xf183('0x49')]:_0x4af299[_0xf183('0x35')];if(_0x1b591b[_0xf183('0x36')][_0xf183('0x55')]){_0x5f287f[_0xf183('0x56')]=[{'all':!![]}];}_0x5f287f=_[_0xf183('0x2c')]({},_0x5f287f,_0x1b591b[_0xf183('0x54')]);return db[_0xf183('0x32')][_0xf183('0x5c')](_0x5f287f)[_0xf183('0x25')](handleEntityNotFound(_0x3c6228,null))['then'](respondWithResult(_0x3c6228,null))[_0xf183('0x59')](handleError(_0x3c6228,null));};exports[_0xf183('0x5d')]=function(_0x34f2ab,_0x14b413){return db[_0xf183('0x32')][_0xf183('0x5d')](_0x34f2ab[_0xf183('0x2d')],{})[_0xf183('0x25')](respondWithResult(_0x14b413,0xc9))[_0xf183('0x59')](handleError(_0x14b413,null));};exports[_0xf183('0x24')]=function(_0x5dab07,_0x24a696){if(_0x5dab07['body']['id']){delete _0x5dab07[_0xf183('0x2d')]['id'];}return db[_0xf183('0x32')][_0xf183('0x5c')]({'where':{'id':_0x5dab07[_0xf183('0x5b')]['id']}})['then'](handleEntityNotFound(_0x24a696,null))[_0xf183('0x25')](saveUpdates(_0x5dab07['body'],null))['then'](respondWithResult(_0x24a696,null))[_0xf183('0x59')](handleError(_0x24a696,null));};exports[_0xf183('0x5e')]=function(_0x6ffe49,_0x47a615){return db[_0xf183('0x32')]['describe']()['then'](respondWithResult(_0x47a615,null))[_0xf183('0x59')](handleError(_0x47a615,null));};exports[_0xf183('0x5f')]=function(_0x44c7ea,_0x26f3fe){var _0xebbf7a;return db[_0xf183('0x32')]['find']({'where':{'id':_0x44c7ea[_0xf183('0x5b')]['id']}})['then'](handleEntityNotFound(_0x26f3fe,null))[_0xf183('0x25')](function(_0x53b562){if(_0x53b562){return _0x53b562[_0xf183('0x5f')]()['then'](function(_0x1cbafa){return _0x1cbafa;});}})[_0xf183('0x25')](function(_0x26f0d3){_0xebbf7a=_0x26f0d3;if(_0x26f0d3){if(_0x26f0d3[_0xf183('0x60')]||_0x26f0d3[_0xf183('0x61')]){return db[_0x26f0d3[_0xf183('0x60')]?_0xf183('0x62'):_0xf183('0x63')][_0xf183('0x5c')]({'where':{'id':_0x26f0d3[_0xf183('0x60')]?_0x26f0d3[_0xf183('0x60')]:_0x26f0d3[_0xf183('0x61')]},'attributes':['id',_0xf183('0x29')],'raw':!![]});}}})[_0xf183('0x25')](function(_0x222998){var _0x48cc77={};if(_0x222998){_[_0xf183('0x2c')](_0x48cc77,_[_0xf183('0x64')](_0xebbf7a['dataValues'],['createdAt',_0xf183('0x65'),'id']));_0x48cc77[_0xf183('0x66')]=0x15;_0x48cc77[_0xf183('0x67')]='deleted';_0x48cc77[_0xf183('0x68')]=_0x222998[_0xf183('0x29')];_0x48cc77[_0xf183('0x69')]=_0x44c7ea['user'][_0xf183('0x29')];_0x48cc77[_0xf183('0x6a')]=_0x44c7ea[_0xf183('0x6b')]['id'];_0x48cc77[_0xf183('0x6c')]=!![];_0x48cc77[_0xf183('0x6d')]=moment()['format'](_0xf183('0x6e'));_0x48cc77[_0xf183('0x6f')]=_0xebbf7a[_0xf183('0x70')];_0x48cc77['campaigntype']=_0xebbf7a[_0xf183('0x60')]?_0xf183('0x71'):_0xf183('0x72');return db[_0xf183('0x73')][_0xf183('0x5c')]({'where':{'id':_0x48cc77[_0xf183('0x74')]},'attributes':[_0xf183('0x75'),_0xf183('0x76')]})[_0xf183('0x25')](function(_0x1b64eb){if(!_['isNil'](_0x26f3fe)&&!_[_0xf183('0x77')](_0x1b64eb['firstName'])){_0x48cc77['calleridname']=_0x1b64eb[_0xf183('0x75')];if(!_[_0xf183('0x77')](_0x1b64eb[_0xf183('0x76')])){_0x48cc77[_0xf183('0x78')]+='\x20'+_0x1b64eb[_0xf183('0x76')];}}})[_0xf183('0x79')](function(){return db[_0xf183('0x7a')]['create'](_0x48cc77);});}})['then'](function(){return _0x26f3fe['status'](0xcc)[_0xf183('0x26')]();})[_0xf183('0x59')](handleError(_0x26f3fe,null));};exports[_0xf183('0x7b')]=function(_0x2ce8c7,_0x3f63a6,_0x415455){var _0x5b482f=[];return db[_0xf183('0x73')][_0xf183('0x5e')]()['then'](function(_0x32e4c9){_0x5b482f=_[_0xf183('0x37')](_0x32e4c9);return _0x2ce8c7[_0xf183('0x6b')][_0xf183('0x7c')]({'where':{'type':_0xf183('0x7d'),'dialActive':!![],'dialMethod':_0xf183('0x7e')},'attributes':['id',_0xf183('0x7f')],'raw':!![]});})[_0xf183('0x25')](function(_0x6e742){if(_0x6e742&&_0x6e742[_0xf183('0x4b')]){return db[_0xf183('0x80')][_0xf183('0x81')](function(_0x2373ed){var _0x2695c5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf183('0x82')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xf183('0x31')](_0x6e742,'id')},'$or':[{'UserId':null},{'UserId':_0x2ce8c7[_0xf183('0x6b')]['id']}]};var _0x3f55d8=[];if(_0x2ce8c7[_0xf183('0x2d')]['direction']&&_0x2ce8c7[_0xf183('0x2d')][_0xf183('0x83')]===_0xf183('0x84')){if(!_[_0xf183('0x85')](_0x2ce8c7[_0xf183('0x2d')][_0xf183('0x86')])){_0x2695c5['id']={'$in':_0x2ce8c7[_0xf183('0x2d')][_0xf183('0x86')]};}_0x3f55d8=[[_0xf183('0x87'),'ASC'],['scheduledAt',_0x6e742[0x0][_0xf183('0x7f')]==='ASC'?_0xf183('0x88'):_0xf183('0x89')],db['sequelize'][_0xf183('0x8a')](_0xf183('0x8b')),['id',_0xf183('0x88')]];}else{if(!_['isEmpty'](_0x2ce8c7[_0xf183('0x2d')]['hopperIds'])){_0x2695c5['id']={'$notIn':_0x2ce8c7['body'][_0xf183('0x86')]};}_0x3f55d8=[[_0xf183('0x87'),'DESC'],[_0xf183('0x8c'),_0x6e742[0x0][_0xf183('0x7f')]],db[_0xf183('0x80')][_0xf183('0x8a')](_0xf183('0x8d')),['id','ASC']];}return db['CmHopper'][_0xf183('0x8e')]({'attributes':['id',_0xf183('0x8f')],'where':_0x2695c5,'order':_0x3f55d8,'transaction':_0x2373ed,'lock':_0x2373ed['LOCK'][_0xf183('0x90')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5b482f,'include':[{'model':db[_0xf183('0x91')],'as':_0xf183('0x92'),'attributes':['id',_0xf183('0x29')]}]},{'model':db['CmList'],'as':_0xf183('0x93'),'attributes':['id',_0xf183('0x29')]},{'model':db[_0xf183('0x62')],'as':_0xf183('0x94'),'attributes':['id',_0xf183('0x29'),_0xf183('0x95')]}]})[_0xf183('0x25')](function(_0x454a74){if(_0x454a74){return _0x454a74[_0xf183('0x24')]({'UserId':_0x2ce8c7[_0xf183('0x6b')]['id']},{'transaction':_0x2373ed});}});});}})['then'](handleEntityNotFound(_0x3f63a6,null))[_0xf183('0x25')](respondWithResult(_0x3f63a6,null))[_0xf183('0x59')](handleError(_0x3f63a6,null));};exports[_0xf183('0x96')]=function(_0x23b0d0,_0x5f0d91,_0x2eeea3){return _0x23b0d0[_0xf183('0x6b')][_0xf183('0x7c')]({'where':{'type':_0xf183('0x7d'),'dialActive':!![],'dialMethod':_0xf183('0x7e')},'attributes':['id'],'raw':!![]})['then'](function(_0x1c16cd){if(_0x1c16cd&&_0x1c16cd[_0xf183('0x4b')]){return db[_0xf183('0x32')][_0xf183('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf183('0x82')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x1c16cd,'id')},'$or':[{'UserId':null},{'UserId':_0x23b0d0['user']['id']}]}});}return 0x0;})['then'](function(_0x543d31){if(!_[_0xf183('0x77')](_0x543d31)&&_[_0xf183('0x97')](_0x543d31)){return _0x5f0d91[_0xf183('0x1a')](0xc8)[_0xf183('0x1b')]({'contacts':_0x543d31});}else{logger[_0xf183('0x27')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xf183('0x96'),0x194,'entity\x20not\x20found');_0x5f0d91[_0xf183('0x19')](0x194);}})[_0xf183('0x59')](handleError(_0x5f0d91,null));}; \ No newline at end of file +var _0x72d7=['papaparse','ioredis','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','reject','update','then','destroy','error','stack','name','render','merge','body','contact','message','agent','account','index','map','CmHopper','rawAttributes','type','query','keys','intersection','filters','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','length','attributes','model','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','describe','CampaignId','VoiceQueueId','Campaign','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','calleridnum','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','create','getPreview','CmContact','getVoiceQueues','outbound','preview','sequelize','transaction','direction','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','Company','List','VoiceQueue','Queue','dialActive','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js'];(function(_0x40b7ec,_0x307707){var _0x72b976=function(_0x5bfcc3){while(--_0x5bfcc3){_0x40b7ec['push'](_0x40b7ec['shift']());}};_0x72b976(++_0x307707);}(_0x72d7,0x81));var _0x772d=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x72d7[_0x487b0c];return _0x1adbdc;};'use strict';var emlformat=require(_0x772d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x772d('0x1'));var jsonpatch=require(_0x772d('0x2'));var rp=require(_0x772d('0x3'));var moment=require(_0x772d('0x4'));var BPromise=require(_0x772d('0x5'));var Mustache=require('mustache');var util=require(_0x772d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x772d('0x7'));var ejs=require(_0x772d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x772d('0x9'));var squel=require('squel');var crypto=require(_0x772d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x772d('0xb'));var toCsv=require(_0x772d('0x7'));var querystring=require('querystring');var Papa=require(_0x772d('0xc'));var Redis=require(_0x772d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x772d('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x772d('0xf'));var db=require(_0x772d('0x10'))['db'];function respondWithStatusCode(_0x420cd5,_0x3767ef){_0x3767ef=_0x3767ef||0xcc;return function(_0x355ae8){if(_0x355ae8){return _0x420cd5[_0x772d('0x11')](_0x3767ef);}return _0x420cd5['status'](_0x3767ef)[_0x772d('0x12')]();};}function respondWithResult(_0x5636b3,_0x41e2f7){_0x41e2f7=_0x41e2f7||0xc8;return function(_0x1d5cd0){if(_0x1d5cd0){return _0x5636b3[_0x772d('0x13')](_0x41e2f7)['json'](_0x1d5cd0);}};}function respondWithFilteredResult(_0x13b7b0,_0x3da2cb){return function(_0xe3791e){if(_0xe3791e){var _0x5accae=typeof _0x3da2cb[_0x772d('0x14')]==='undefined'&&typeof _0x3da2cb['limit']===_0x772d('0x15');var _0x47f71b=_0xe3791e['count'];var _0x563664=_0x5accae?0x0:_0x3da2cb[_0x772d('0x14')];var _0x29b9a2=_0x5accae?_0xe3791e[_0x772d('0x16')]:_0x3da2cb[_0x772d('0x14')]+_0x3da2cb[_0x772d('0x17')];var _0x3ca6f4;if(_0x29b9a2>=_0x47f71b){_0x29b9a2=_0x47f71b;_0x3ca6f4=0xc8;}else{_0x3ca6f4=0xce;}_0x13b7b0[_0x772d('0x13')](_0x3ca6f4);return _0x13b7b0['set'](_0x772d('0x18'),_0x563664+'-'+_0x29b9a2+'/'+_0x47f71b)[_0x772d('0x19')](_0xe3791e);}return null;};}function patchUpdates(_0x420460){return function(_0x1c29b4){try{jsonpatch['apply'](_0x1c29b4,_0x420460,!![]);}catch(_0x353369){return BPromise[_0x772d('0x1a')](_0x353369);}return _0x1c29b4['save']();};}function saveUpdates(_0x9f2e66,_0x4f2e21){return function(_0x11af86){if(_0x11af86){return _0x11af86[_0x772d('0x1b')](_0x9f2e66)[_0x772d('0x1c')](function(_0xa0217d){return _0xa0217d;});}return null;};}function removeEntity(_0x27e609,_0x21956f){return function(_0x307f61){if(_0x307f61){return _0x307f61[_0x772d('0x1d')]()[_0x772d('0x1c')](function(){_0x27e609[_0x772d('0x13')](0xcc)[_0x772d('0x12')]();});}};}function handleEntityNotFound(_0x33006d,_0x3215f4){return function(_0x108baf){if(!_0x108baf){_0x33006d[_0x772d('0x11')](0x194);}return _0x108baf;};}function handleError(_0x20f3dd,_0x423b96){_0x423b96=_0x423b96||0x1f4;return function(_0x17704f){logger[_0x772d('0x1e')](_0x17704f[_0x772d('0x1f')]);if(_0x17704f[_0x772d('0x20')]){delete _0x17704f[_0x772d('0x20')];}_0x20f3dd[_0x772d('0x13')](_0x423b96)['send'](_0x17704f);};}function getMustacheRender(_0x45f401,_0x47b4bb){return Mustache[_0x772d('0x21')](_0x45f401,_[_0x772d('0x22')](_0x47b4bb[_0x772d('0x23')],{'contact':_0x47b4bb[_0x772d('0x24')],'message':_0x47b4bb[_0x772d('0x25')],'agent':_0x47b4bb[_0x772d('0x26')],'interaction':_0x47b4bb['interaction'],'account':_0x47b4bb[_0x772d('0x27')]}))||'';}exports[_0x772d('0x28')]=function(_0x228b8d,_0x44aa6d){var _0x10c9b7={},_0x3c3e5f={},_0x76fa74={'count':0x0,'rows':[]};var _0x915485=_[_0x772d('0x29')](db[_0x772d('0x2a')][_0x772d('0x2b')],function(_0x28d323){return{'name':_0x28d323['fieldName'],'type':_0x28d323[_0x772d('0x2c')]['key']};});_0x3c3e5f['model']=_['map'](_0x915485,_0x772d('0x20'));_0x3c3e5f[_0x772d('0x2d')]=_[_0x772d('0x2e')](_0x228b8d[_0x772d('0x2d')]);_0x3c3e5f['filters']=_[_0x772d('0x2f')](_0x3c3e5f['model'],_0x3c3e5f[_0x772d('0x2d')]);_0x3c3e5f[_0x772d('0x30')]=_['concat'](_0x3c3e5f[_0x772d('0x30')],[_0x772d('0x31'),_0x772d('0x32'),'$gt',_0x772d('0x33'),_0x772d('0x34'),_0x772d('0x35'),_0x772d('0x36'),_0x772d('0x37'),_0x772d('0x38'),'$between','$notBetween','$in',_0x772d('0x39'),_0x772d('0x3a'),_0x772d('0x3b'),_0x772d('0x3c'),_0x772d('0x3d'),'$like',_0x772d('0x3e'),_0x772d('0x3f'),_0x772d('0x40'),_0x772d('0x41')]);_0x10c9b7['attributes']=_['intersection'](_0x3c3e5f['model'],qs['fields'](_0x228b8d[_0x772d('0x2d')][_0x772d('0x42')]));_0x10c9b7['attributes']=_0x10c9b7['attributes'][_0x772d('0x43')]?_0x10c9b7[_0x772d('0x44')]:_0x3c3e5f[_0x772d('0x45')];if(!_0x228b8d[_0x772d('0x2d')]['hasOwnProperty'](_0x772d('0x46'))){_0x10c9b7[_0x772d('0x17')]=qs['limit'](_0x228b8d[_0x772d('0x2d')][_0x772d('0x17')]);_0x10c9b7[_0x772d('0x14')]=qs[_0x772d('0x14')](_0x228b8d[_0x772d('0x2d')][_0x772d('0x14')]);}_0x10c9b7[_0x772d('0x47')]=qs['sort'](_0x228b8d[_0x772d('0x2d')][_0x772d('0x48')]);_0x10c9b7[_0x772d('0x49')]=qs['filters'](_[_0x772d('0x4a')](_0x228b8d[_0x772d('0x2d')],_0x3c3e5f[_0x772d('0x30')]),_0x915485);if(_0x228b8d[_0x772d('0x2d')][_0x772d('0x4b')]){_0x10c9b7[_0x772d('0x49')]=_[_0x772d('0x22')](_0x10c9b7[_0x772d('0x49')],{'$or':_[_0x772d('0x29')](_0x915485,function(_0x58d024){if(_0x58d024[_0x772d('0x2c')]!==_0x772d('0x4c')){var _0x45f322={};_0x45f322[_0x58d024['name']]={'$like':'%'+_0x228b8d['query'][_0x772d('0x4b')]+'%'};return _0x45f322;}})});}_0x10c9b7=_[_0x772d('0x22')]({},_0x10c9b7,_0x228b8d['options']);var _0x2bbef1={'where':_0x10c9b7[_0x772d('0x49')]};return db[_0x772d('0x2a')][_0x772d('0x16')](_0x2bbef1)['then'](function(_0x33c71d){_0x76fa74[_0x772d('0x16')]=_0x33c71d;if(_0x228b8d[_0x772d('0x2d')][_0x772d('0x4d')]){_0x10c9b7[_0x772d('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x772d('0x4f')](_0x10c9b7);})[_0x772d('0x1c')](function(_0x15e8a3){_0x76fa74[_0x772d('0x50')]=_0x15e8a3;return _0x76fa74;})['then'](respondWithFilteredResult(_0x44aa6d,_0x10c9b7))[_0x772d('0x51')](handleError(_0x44aa6d,null));};exports[_0x772d('0x52')]=function(_0xcec145,_0x5bf4db){var _0x18fc94={'raw':!![],'where':{'id':_0xcec145[_0x772d('0x53')]['id']}},_0x336821={};_0x336821[_0x772d('0x45')]=_[_0x772d('0x2e')](db[_0x772d('0x2a')][_0x772d('0x2b')]);_0x336821[_0x772d('0x2d')]=_[_0x772d('0x2e')](_0xcec145[_0x772d('0x2d')]);_0x336821[_0x772d('0x30')]=_[_0x772d('0x2f')](_0x336821[_0x772d('0x45')],_0x336821[_0x772d('0x2d')]);_0x18fc94[_0x772d('0x44')]=_[_0x772d('0x2f')](_0x336821[_0x772d('0x45')],qs[_0x772d('0x42')](_0xcec145[_0x772d('0x2d')][_0x772d('0x42')]));_0x18fc94[_0x772d('0x44')]=_0x18fc94[_0x772d('0x44')][_0x772d('0x43')]?_0x18fc94[_0x772d('0x44')]:_0x336821[_0x772d('0x45')];if(_0xcec145[_0x772d('0x2d')][_0x772d('0x4d')]){_0x18fc94[_0x772d('0x4e')]=[{'all':!![]}];}_0x18fc94=_[_0x772d('0x22')]({},_0x18fc94,_0xcec145[_0x772d('0x54')]);return db[_0x772d('0x2a')]['find'](_0x18fc94)[_0x772d('0x1c')](handleEntityNotFound(_0x5bf4db,null))[_0x772d('0x1c')](respondWithResult(_0x5bf4db,null))[_0x772d('0x51')](handleError(_0x5bf4db,null));};exports['create']=function(_0x156acd,_0x17d980){return db['CmHopper']['create'](_0x156acd[_0x772d('0x23')],{})['then'](respondWithResult(_0x17d980,0xc9))[_0x772d('0x51')](handleError(_0x17d980,null));};exports[_0x772d('0x1b')]=function(_0x5a3a57,_0x1c0ff1){if(_0x5a3a57[_0x772d('0x23')]['id']){delete _0x5a3a57[_0x772d('0x23')]['id'];}return db[_0x772d('0x2a')][_0x772d('0x55')]({'where':{'id':_0x5a3a57[_0x772d('0x53')]['id']}})[_0x772d('0x1c')](handleEntityNotFound(_0x1c0ff1,null))['then'](saveUpdates(_0x5a3a57[_0x772d('0x23')],null))['then'](respondWithResult(_0x1c0ff1,null))[_0x772d('0x51')](handleError(_0x1c0ff1,null));};exports[_0x772d('0x56')]=function(_0x7660ef,_0x87efca){return db[_0x772d('0x2a')][_0x772d('0x56')]()['then'](respondWithResult(_0x87efca,null))['catch'](handleError(_0x87efca,null));};exports[_0x772d('0x1d')]=function(_0x15ae3d,_0x54347b){var _0x455bc5;return db['CmHopper'][_0x772d('0x55')]({'where':{'id':_0x15ae3d[_0x772d('0x53')]['id']}})[_0x772d('0x1c')](handleEntityNotFound(_0x54347b,null))[_0x772d('0x1c')](function(_0x1c127f){if(_0x1c127f){return _0x1c127f[_0x772d('0x1d')]()[_0x772d('0x1c')](function(_0x3c6a0f){return _0x3c6a0f;});}})[_0x772d('0x1c')](function(_0x3c7d9a){_0x455bc5=_0x3c7d9a;if(_0x3c7d9a){if(_0x3c7d9a['VoiceQueueId']||_0x3c7d9a[_0x772d('0x57')]){return db[_0x3c7d9a[_0x772d('0x58')]?'VoiceQueue':_0x772d('0x59')][_0x772d('0x55')]({'where':{'id':_0x3c7d9a[_0x772d('0x58')]?_0x3c7d9a['VoiceQueueId']:_0x3c7d9a[_0x772d('0x57')]},'attributes':['id',_0x772d('0x20')],'raw':!![]});}}})[_0x772d('0x1c')](function(_0x319114){var _0x33d491={};if(_0x319114){_['merge'](_0x33d491,_['omit'](_0x455bc5['dataValues'],[_0x772d('0x5a'),_0x772d('0x5b'),'id']));_0x33d491[_0x772d('0x5c')]=0x15;_0x33d491[_0x772d('0x5d')]=_0x772d('0x5e');_0x33d491[_0x772d('0x5f')]=_0x319114[_0x772d('0x20')];_0x33d491[_0x772d('0x60')]=_0x15ae3d['user'][_0x772d('0x20')];_0x33d491[_0x772d('0x61')]=_0x15ae3d[_0x772d('0x62')]['id'];_0x33d491[_0x772d('0x5e')]=!![];_0x33d491[_0x772d('0x63')]=moment()[_0x772d('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x33d491[_0x772d('0x65')]=_0x455bc5['phone'];_0x33d491['campaigntype']=_0x455bc5[_0x772d('0x58')]?_0x772d('0x66'):_0x772d('0x67');return db['CmContact']['find']({'where':{'id':_0x33d491[_0x772d('0x68')]},'attributes':[_0x772d('0x69'),_0x772d('0x6a')]})[_0x772d('0x1c')](function(_0x45359e){if(!_[_0x772d('0x6b')](_0x54347b)&&!_[_0x772d('0x6b')](_0x45359e[_0x772d('0x69')])){_0x33d491[_0x772d('0x6c')]=_0x45359e[_0x772d('0x69')];if(!_[_0x772d('0x6b')](_0x45359e[_0x772d('0x6a')])){_0x33d491[_0x772d('0x6c')]+='\x20'+_0x45359e['lastName'];}}})[_0x772d('0x6d')](function(){return db['CmHopperFinal'][_0x772d('0x6e')](_0x33d491);});}})[_0x772d('0x1c')](function(){return _0x54347b[_0x772d('0x13')](0xcc)[_0x772d('0x12')]();})[_0x772d('0x51')](handleError(_0x54347b,null));};exports[_0x772d('0x6f')]=function(_0x55747f,_0x22714f,_0x56c043){var _0x1da65c=[];return db[_0x772d('0x70')]['describe']()[_0x772d('0x1c')](function(_0x28eec4){_0x1da65c=_[_0x772d('0x2e')](_0x28eec4);return _0x55747f[_0x772d('0x62')][_0x772d('0x71')]({'where':{'type':_0x772d('0x72'),'dialActive':!![],'dialMethod':_0x772d('0x73')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x772d('0x1c')](function(_0x2232bd){if(_0x2232bd&&_0x2232bd[_0x772d('0x43')]){return db[_0x772d('0x74')][_0x772d('0x75')](function(_0x5614f8){var _0xbd3c91={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x772d('0x29')](_0x2232bd,'id')},'$or':[{'UserId':null},{'UserId':_0x55747f['user']['id']}]};var _0x1b9de3=[];if(_0x55747f[_0x772d('0x23')]['direction']&&_0x55747f['body'][_0x772d('0x76')]==='prev'){if(!_[_0x772d('0x77')](_0x55747f[_0x772d('0x23')][_0x772d('0x78')])){_0xbd3c91['id']={'$in':_0x55747f[_0x772d('0x23')][_0x772d('0x78')]};}_0x1b9de3=[[_0x772d('0x79'),'ASC'],[_0x772d('0x7a'),_0x2232bd[0x0][_0x772d('0x7b')]===_0x772d('0x7c')?_0x772d('0x7d'):_0x772d('0x7c')],db[_0x772d('0x74')]['literal'](_0x772d('0x7e')),['id',_0x772d('0x7d')]];}else{if(!_[_0x772d('0x77')](_0x55747f[_0x772d('0x23')][_0x772d('0x78')])){_0xbd3c91['id']={'$notIn':_0x55747f[_0x772d('0x23')][_0x772d('0x78')]};}_0x1b9de3=[[_0x772d('0x79'),_0x772d('0x7d')],[_0x772d('0x7a'),_0x2232bd[0x0][_0x772d('0x7b')]],db[_0x772d('0x74')]['literal'](_0x772d('0x7f')),['id',_0x772d('0x7c')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x772d('0x80')],'where':_0xbd3c91,'order':_0x1b9de3,'transaction':_0x5614f8,'lock':_0x5614f8[_0x772d('0x81')][_0x772d('0x82')],'include':[{'model':db[_0x772d('0x70')],'as':_0x772d('0x83'),'attributes':_0x1da65c,'include':[{'model':db['CmCompany'],'as':_0x772d('0x84'),'attributes':['id',_0x772d('0x20')]}]},{'model':db['CmList'],'as':_0x772d('0x85'),'attributes':['id',_0x772d('0x20')]},{'model':db[_0x772d('0x86')],'as':_0x772d('0x87'),'attributes':['id',_0x772d('0x20'),_0x772d('0x88')]}]})[_0x772d('0x1c')](function(_0x1c8c48){if(_0x1c8c48){return _0x1c8c48['update']({'UserId':_0x55747f[_0x772d('0x62')]['id']},{'transaction':_0x5614f8});}});});}})['then'](handleEntityNotFound(_0x22714f,null))[_0x772d('0x1c')](respondWithResult(_0x22714f,null))['catch'](handleError(_0x22714f,null));};exports[_0x772d('0x89')]=function(_0x3a2645,_0x207619,_0x2e5961){return _0x3a2645[_0x772d('0x62')][_0x772d('0x71')]({'where':{'type':_0x772d('0x72'),'dialActive':!![],'dialMethod':_0x772d('0x73')},'attributes':['id'],'raw':!![]})[_0x772d('0x1c')](function(_0x3187d4){if(_0x3187d4&&_0x3187d4[_0x772d('0x43')]){return db[_0x772d('0x2a')][_0x772d('0x16')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x772d('0x64')](_0x772d('0x8a'))},'VoiceQueueId':{'$in':_['map'](_0x3187d4,'id')},'$or':[{'UserId':null},{'UserId':_0x3a2645[_0x772d('0x62')]['id']}]}});}return 0x0;})['then'](function(_0x49b9d2){if(!_[_0x772d('0x6b')](_0x49b9d2)&&_[_0x772d('0x8b')](_0x49b9d2)){return _0x207619[_0x772d('0x13')](0xc8)['json']({'contacts':_0x49b9d2});}else{logger[_0x772d('0x1e')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x772d('0x89'),0x194,_0x772d('0x8c'));_0x207619[_0x772d('0x11')](0x194);}})[_0x772d('0x51')](handleError(_0x207619,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 65e0d1e..30f60b4 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x350f=['api','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x350f,0x97));var _0xf350=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x350f[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xf350('0x0'));var util=require(_0xf350('0x1'));var logger=require(_0xf350('0x2'))(_0xf350('0x3'));var moment=require(_0xf350('0x4'));var BPromise=require(_0xf350('0x5'));var rp=require(_0xf350('0x6'));var fs=require('fs');var path=require(_0xf350('0x7'));var rimraf=require('rimraf');var config=require(_0xf350('0x8'));var attributes=require(_0xf350('0x9'));module[_0xf350('0xa')]=function(_0x3b2d56,_0x339799){return _0x3b2d56['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0xf350('0xb')]},{'name':_0xf350('0xc'),'fields':[_0xf350('0xc')]},{'name':_0xf350('0xd'),'fields':[_0xf350('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa081=['lodash','../../config/logger','api','moment','path','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x3398b7,_0x59c0f2){var _0x1090b7=function(_0x121c15){while(--_0x121c15){_0x3398b7['push'](_0x3398b7['shift']());}};_0x1090b7(++_0x59c0f2);}(_0xa081,0xa9));var _0x1a08=function(_0x57cba7,_0x2238a1){_0x57cba7=_0x57cba7-0x0;var _0x512171=_0xa081[_0x57cba7];return _0x512171;};'use strict';var _=require(_0x1a08('0x0'));var util=require('util');var logger=require(_0x1a08('0x1'))(_0x1a08('0x2'));var moment=require(_0x1a08('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a08('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1a08('0x5'));module[_0x1a08('0x6')]=function(_0x3baeb3,_0x4e0381){return _0x3baeb3[_0x1a08('0x7')](_0x1a08('0x8'),attributes,{'tableName':_0x1a08('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x1a08('0xa')]},{'name':_0x1a08('0xb'),'fields':[_0x1a08('0xb')]},{'name':_0x1a08('0xc'),'fields':[_0x1a08('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c309362..2623a27 100644 --- a/server/api/cmHopper/cmHopper.rpc.js +++ b/server/api/cmHopper/cmHopper.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe096=['model','catch','CmHopper','find','ShowCmHopper','CreateCmHopper','create','body','stringify','UpdateCmHopper','update','limit','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','Contact','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','message','GetCmHopper','findAll','options','raw','where','attributes','include','map'];(function(_0x109294,_0x35122c){var _0x788554=function(_0x2e33b4){while(--_0x2e33b4){_0x109294['push'](_0x109294['shift']());}};_0x788554(++_0x35122c);}(_0xe096,0x198));var _0x6e09=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0xe096[_0x3de4f8];return _0x3d81fc;};'use strict';var _=require(_0x6e09('0x0'));var util=require(_0x6e09('0x1'));var moment=require(_0x6e09('0x2'));var BPromise=require(_0x6e09('0x3'));var rs=require(_0x6e09('0x4'));var fs=require('fs');var Redis=require(_0x6e09('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e09('0x6'));var logger=require(_0x6e09('0x7'))(_0x6e09('0x8'));var config=require(_0x6e09('0x9'));var jayson=require(_0x6e09('0xa'));var client=jayson[_0x6e09('0xb')][_0x6e09('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55d2e8,_0xccd0ba,_0x14b58e){return new BPromise(function(_0x5443ee,_0x11b680){return client[_0x6e09('0xd')](_0x55d2e8,_0x14b58e)[_0x6e09('0xe')](function(_0x549554){logger[_0x6e09('0xf')](_0x6e09('0x10'),_0xccd0ba,_0x6e09('0x11'));logger[_0x6e09('0x12')](_0x6e09('0x13'),_0xccd0ba,_0x6e09('0x11'),JSON['stringify'](_0x549554));if(_0x549554[_0x6e09('0x14')]){if(_0x549554[_0x6e09('0x14')]['code']===0x1f4){logger['error'](_0x6e09('0x10'),_0xccd0ba,_0x549554[_0x6e09('0x14')][_0x6e09('0x15')]);return _0x11b680(_0x549554['error'][_0x6e09('0x15')]);}logger[_0x6e09('0x14')](_0x6e09('0x10'),_0xccd0ba,_0x549554[_0x6e09('0x14')]['message']);return _0x5443ee(_0x549554['error']['message']);}else{logger[_0x6e09('0xf')](_0x6e09('0x10'),_0xccd0ba,_0x6e09('0x11'));_0x5443ee(_0x549554['result'][_0x6e09('0x15')]);}})['catch'](function(_0x11d7ce){logger[_0x6e09('0x14')](_0x6e09('0x10'),_0xccd0ba,_0x11d7ce);_0x11b680(_0x11d7ce);});});}exports[_0x6e09('0x16')]=function(_0x5ac8aa){var _0x34de8c=this;return new Promise(function(_0x2f1330,_0x1be2ad){return db['CmHopper'][_0x6e09('0x17')]({'raw':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'where':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x1a')]||null:null,'attributes':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa[_0x6e09('0x18')]['limit']||null:null,'include':_0x5ac8aa[_0x6e09('0x18')]?_0x5ac8aa['options'][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x5ac8aa[_0x6e09('0x18')][_0x6e09('0x1c')],function(_0x224a8e){return{'model':db[_0x224a8e['model']],'as':_0x224a8e['as'],'attributes':_0x224a8e[_0x6e09('0x1b')],'include':_0x224a8e['include']?_['map'](_0x224a8e[_0x6e09('0x1c')],function(_0x404f9d){return{'model':db[_0x404f9d[_0x6e09('0x1e')]],'as':_0x404f9d['as'],'attributes':_0x404f9d['attributes'],'include':_0x404f9d[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x404f9d[_0x6e09('0x1c')],function(_0x4224aa){return{'model':db[_0x4224aa[_0x6e09('0x1e')]],'as':_0x4224aa['as'],'attributes':_0x4224aa[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d40bb){logger[_0x6e09('0xf')](_0x6e09('0x16'),_0x5ac8aa);logger['debug'](_0x6e09('0x16'),_0x5ac8aa,JSON['stringify'](_0x5d40bb));_0x2f1330(_0x5d40bb);})[_0x6e09('0x1f')](function(_0x3bfb08){logger[_0x6e09('0x14')](_0x6e09('0x16'),_0x3bfb08[_0x6e09('0x15')],_0x5ac8aa);_0x1be2ad(_0x34de8c[_0x6e09('0x14')](0x1f4,_0x3bfb08['message']));});});};exports['ShowCmHopper']=function(_0x120cbb){var _0x42d4be=this;return new Promise(function(_0x378a8c,_0x116477){return db[_0x6e09('0x20')][_0x6e09('0x21')]({'raw':_0x120cbb['options']?_0x120cbb[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'where':_0x120cbb['options']?_0x120cbb[_0x6e09('0x18')][_0x6e09('0x1a')]||null:null,'attributes':_0x120cbb['options']?_0x120cbb['options'][_0x6e09('0x1b')]||null:null,'include':_0x120cbb[_0x6e09('0x18')]?_0x120cbb[_0x6e09('0x18')][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x120cbb[_0x6e09('0x18')]['include'],function(_0x11a296){return{'model':db[_0x11a296[_0x6e09('0x1e')]],'as':_0x11a296['as'],'attributes':_0x11a296[_0x6e09('0x1b')],'include':_0x11a296['include']?_[_0x6e09('0x1d')](_0x11a296[_0x6e09('0x1c')],function(_0x234d44){return{'model':db[_0x234d44['model']],'as':_0x234d44['as'],'attributes':_0x234d44[_0x6e09('0x1b')],'include':_0x234d44[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x234d44[_0x6e09('0x1c')],function(_0x53552a){return{'model':db[_0x53552a['model']],'as':_0x53552a['as'],'attributes':_0x53552a[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6e09('0xe')](function(_0x26634f){logger['info'](_0x6e09('0x22'),_0x120cbb);logger[_0x6e09('0x12')]('ShowCmHopper',_0x120cbb,JSON['stringify'](_0x26634f));_0x378a8c(_0x26634f);})[_0x6e09('0x1f')](function(_0x208894){logger[_0x6e09('0x14')](_0x6e09('0x22'),_0x208894[_0x6e09('0x15')],_0x120cbb);_0x116477(_0x42d4be[_0x6e09('0x14')](0x1f4,_0x208894[_0x6e09('0x15')]));});});};exports[_0x6e09('0x23')]=function(_0x248bc0){var _0x1e1395=this;return new Promise(function(_0x20246e,_0x41e98d){return db[_0x6e09('0x20')][_0x6e09('0x24')](_0x248bc0[_0x6e09('0x25')],{'raw':_0x248bc0['options']?_0x248bc0[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![]})[_0x6e09('0xe')](function(_0x2ba826){logger[_0x6e09('0xf')](_0x6e09('0x23'),_0x248bc0);logger[_0x6e09('0x12')](_0x6e09('0x23'),_0x248bc0,JSON[_0x6e09('0x26')](_0x2ba826));_0x20246e(_0x2ba826);})[_0x6e09('0x1f')](function(_0x666fce){logger['error'](_0x6e09('0x23'),_0x666fce['message'],_0x248bc0);_0x41e98d(_0x1e1395[_0x6e09('0x14')](0x1f4,_0x666fce['message']));});});};exports[_0x6e09('0x27')]=function(_0x3a9c8e){var _0x313d60=this;return new Promise(function(_0x39b6a6,_0x5551a5){return db[_0x6e09('0x20')][_0x6e09('0x28')](_0x3a9c8e[_0x6e09('0x25')],{'raw':_0x3a9c8e[_0x6e09('0x18')]?_0x3a9c8e[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9c8e[_0x6e09('0x18')]?_0x3a9c8e['options'][_0x6e09('0x1a')]||null:null,'attributes':_0x3a9c8e['options']?_0x3a9c8e[_0x6e09('0x18')]['attributes']||null:null,'limit':_0x3a9c8e[_0x6e09('0x18')]?_0x3a9c8e[_0x6e09('0x18')][_0x6e09('0x29')]||null:null})['then'](function(_0x2b1154){logger[_0x6e09('0xf')](_0x6e09('0x27'),_0x3a9c8e);logger[_0x6e09('0x12')](_0x6e09('0x27'),_0x3a9c8e,JSON[_0x6e09('0x26')](_0x2b1154));_0x39b6a6(_0x2b1154);})[_0x6e09('0x1f')](function(_0x54cd46){logger[_0x6e09('0x14')](_0x6e09('0x27'),_0x54cd46[_0x6e09('0x15')],_0x3a9c8e);_0x5551a5(_0x313d60[_0x6e09('0x14')](0x1f4,_0x54cd46[_0x6e09('0x15')]));});});};exports[_0x6e09('0x2a')]=function(_0x4be4cc){var _0x22a6a2=this;return new Promise(function(_0x33b4b7,_0x514e2a){return db[_0x6e09('0x20')]['destroy']({'where':_0x4be4cc[_0x6e09('0x18')]?_0x4be4cc['options'][_0x6e09('0x1a')]||null:null})[_0x6e09('0xe')](function(_0x17954f){logger[_0x6e09('0xf')]('DestroyCmHopper',_0x4be4cc);logger[_0x6e09('0x12')]('DestroyCmHopper',_0x4be4cc,JSON[_0x6e09('0x26')](_0x17954f));_0x33b4b7(_0x17954f);})['catch'](function(_0x948a55){logger[_0x6e09('0x14')](_0x6e09('0x2a'),_0x948a55[_0x6e09('0x15')],_0x4be4cc);_0x514e2a(_0x22a6a2[_0x6e09('0x14')](0x1f4,_0x948a55[_0x6e09('0x15')]));});});};exports[_0x6e09('0x2b')]=function(_0x371fdd){var _0x1e9655=this;return new Promise(function(_0x4c1fd3,_0x2f7ffe){return db[_0x6e09('0x2c')][_0x6e09('0x2d')]()[_0x6e09('0xe')](function(_0x5a5f30){return db[_0x6e09('0x2e')][_0x6e09('0x2f')](function(_0x537018){return db[_0x6e09('0x20')]['findAll']({'where':_0x371fdd[_0x6e09('0x18')]?_0x371fdd[_0x6e09('0x18')]['where']||null:null,'attributes':_0x371fdd[_0x6e09('0x18')]?_0x371fdd[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':_0x371fdd[_0x6e09('0x18')]?_0x371fdd[_0x6e09('0x18')][_0x6e09('0x29')]||null:null,'order':_0x371fdd[_0x6e09('0x18')]?_0x371fdd['options'][_0x6e09('0x30')]||null:null,'transaction':_0x537018,'lock':_0x537018[_0x6e09('0x31')]['UPDATE'],'include':[{'model':db[_0x6e09('0x2c')],'as':'Contact','attributes':_[_0x6e09('0x32')](_0x5a5f30)},{'model':db[_0x6e09('0x33')],'as':_0x6e09('0x34'),'attributes':['id',_0x6e09('0x35'),_0x6e09('0x36')]}]})[_0x6e09('0xe')](function(_0x3d9b84){var _0x32a48c=[];var _0x13f6f1=[];for(var _0x4ab7ab=0x0;_0x4ab7ab<_0x3d9b84[_0x6e09('0x37')];_0x4ab7ab+=0x1){var _0x5346f2=_0x3d9b84[_0x4ab7ab][_0x6e09('0x38')];if(_0x5346f2===null){_0x32a48c[_0x6e09('0x39')](_0x3d9b84[_0x4ab7ab][_0x6e09('0x28')](_0x371fdd[_0x6e09('0x25')],{'transaction':_0x537018}));}else if(!_0x13f6f1[_0x6e09('0x3a')](_0x5346f2)){_0x13f6f1[_0x6e09('0x39')](_0x5346f2);_0x32a48c[_0x6e09('0x39')](_0x3d9b84[_0x4ab7ab][_0x6e09('0x28')](_0x371fdd['body'],{'transaction':_0x537018}));}}return BPromise[_0x6e09('0x3b')](_0x32a48c);});})[_0x6e09('0xe')](function(_0x180e27){logger[_0x6e09('0xf')](_0x6e09('0x2b'),_0x371fdd);logger[_0x6e09('0x12')](_0x6e09('0x2b'),_0x371fdd,JSON[_0x6e09('0x26')](_0x180e27));_0x4c1fd3(_0x180e27);})[_0x6e09('0x1f')](function(_0x3f8bdc){logger['error'](_0x6e09('0x2b'),_0x3f8bdc[_0x6e09('0x15')],_0x371fdd);_0x2f7ffe(_0x1e9655[_0x6e09('0x14')](0x1f4,_0x3f8bdc[_0x6e09('0x15')]));});});});};exports[_0x6e09('0x3c')]=function(_0xc4f15b){var _0x37d9d4=this;return new Promise(function(_0x58cf11,_0x4756b1){return db[_0x6e09('0x2e')][_0x6e09('0x2f')](function(_0x2d4e39){return db[_0x6e09('0x3d')][_0x6e09('0x24')](_0xc4f15b['body'],{'raw':_0xc4f15b['options']?_0xc4f15b['options'][_0x6e09('0x19')]===undefined?!![]:![]:!![],'transaction':_0x2d4e39})['then'](function(){return db[_0x6e09('0x20')][_0x6e09('0x3e')]({'where':_0xc4f15b[_0x6e09('0x18')]?_0xc4f15b[_0x6e09('0x18')][_0x6e09('0x1a')]||null:null,'transaction':_0x2d4e39});});})[_0x6e09('0xe')](function(_0xbcade7){logger[_0x6e09('0xf')](_0x6e09('0x3c'),_0xc4f15b);logger[_0x6e09('0x12')](_0x6e09('0x3c'),_0xc4f15b,JSON[_0x6e09('0x26')](_0xbcade7));_0x58cf11(_0xbcade7);})[_0x6e09('0x1f')](function(_0x351b4a){logger[_0x6e09('0x14')](_0x6e09('0x3c'),_0x351b4a[_0x6e09('0x15')],_0xc4f15b);_0x4756b1(_0x37d9d4[_0x6e09('0x14')](0x1f4,_0x351b4a[_0x6e09('0x15')]));});});};exports[_0x6e09('0x3f')]=function(_0x292223){var _0xe50cf6=this;return new Promise(function(_0x3b6e5c,_0x5b5cf9){return db[_0x6e09('0x20')][_0x6e09('0x17')]({'raw':_0x292223[_0x6e09('0x18')]?_0x292223[_0x6e09('0x18')][_0x6e09('0x19')]===undefined?!![]:![]:!![],'where':_0x292223['options']?_0x292223['options'][_0x6e09('0x1a')]||null:null,'attributes':[[db[_0x6e09('0x2e')]['fn'](_0x6e09('0x40'),db['sequelize']['fn']('IF',db[_0x6e09('0x2e')][_0x6e09('0x41')](_0x6e09('0x42')+util[_0x6e09('0x43')]('\x22%s\x22',moment()[_0x6e09('0x43')](_0x6e09('0x44')))+_0x6e09('0x45')))),'contactsRescheduled']]})[_0x6e09('0xe')](function(_0x1029c9){logger[_0x6e09('0xf')](_0x6e09('0x3f'),_0x292223);logger[_0x6e09('0x12')](_0x6e09('0x3f'),_0x292223,JSON[_0x6e09('0x26')](_0x1029c9));_0x3b6e5c(_0x1029c9);})[_0x6e09('0x1f')](function(_0x264c23){logger[_0x6e09('0x14')](_0x6e09('0x3f'),_0x264c23['message'],_0x292223);_0x5b5cf9(_0xe50cf6['error'](0x1f4,_0x264c23[_0x6e09('0x15')]));});});};exports[_0x6e09('0x46')]=function(_0xaed3c5){var _0x423805=this;return new Promise(function(_0x5cfec3,_0x1b36b6){return db[_0x6e09('0x2c')][_0x6e09('0x2d')]()[_0x6e09('0xe')](function(_0x5bd39b){return db[_0x6e09('0x2e')][_0x6e09('0x2f')](function(_0x1de486){return db[_0x6e09('0x20')][_0x6e09('0x17')]({'where':_0xaed3c5[_0x6e09('0x18')]?_0xaed3c5[_0x6e09('0x18')]['where']||null:null,'attributes':_0xaed3c5['options']?_0xaed3c5[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':0x1,'order':_0xaed3c5[_0x6e09('0x18')]?_0xaed3c5[_0x6e09('0x18')]['order']||null:null,'group':db[_0x6e09('0x20')][_0x6e09('0x38')],'transaction':_0x1de486,'lock':_0x1de486[_0x6e09('0x31')]['UPDATE'],'include':_0xaed3c5[_0x6e09('0x18')]?_0xaed3c5[_0x6e09('0x18')][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0xaed3c5[_0x6e09('0x18')]['include'],function(_0x168c66){return{'model':db[_0x168c66[_0x6e09('0x1e')]],'as':_0x168c66['as'],'attributes':_0x168c66[_0x6e09('0x1b')],'include':_0x168c66[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x168c66[_0x6e09('0x1c')],function(_0xb1344f){return{'model':db[_0xb1344f[_0x6e09('0x1e')]],'as':_0xb1344f['as'],'attributes':_0xb1344f[_0x6e09('0x1b')],'include':_0xb1344f[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0xb1344f[_0x6e09('0x1c')],function(_0x490fc2){return{'model':db[_0x490fc2[_0x6e09('0x1e')]],'as':_0x490fc2['as'],'attributes':_0x490fc2[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6e09('0xe')](function(_0x56615a){var _0x10fa68=[];for(var _0x1e150c=0x0;_0x1e150c<_0x56615a['length'];_0x1e150c+=0x1){_0x10fa68[_0x6e09('0x39')](_0x56615a[_0x1e150c][_0x6e09('0x28')](_0xaed3c5['body'],{'transaction':_0x1de486}));}return BPromise[_0x6e09('0x3b')](_0x10fa68);});})[_0x6e09('0xe')](function(_0x2411f3){logger[_0x6e09('0xf')]('GetContactRecallMe',_0xaed3c5);logger[_0x6e09('0x12')](_0x6e09('0x46'),_0xaed3c5,JSON[_0x6e09('0x26')](_0x2411f3));_0x5cfec3(_0x2411f3);})[_0x6e09('0x1f')](function(_0x432c0a){logger['error'](_0x6e09('0x46'),_0x432c0a[_0x6e09('0x15')],_0xaed3c5);_0x1b36b6(_0x423805[_0x6e09('0x14')](0x1f4,_0x432c0a[_0x6e09('0x15')]));});});});};exports[_0x6e09('0x47')]=function(_0x28430c){var _0x9103b0=this;return new Promise(function(_0x149e8e,_0x52cace){db['CmContact'][_0x6e09('0x2d')]()[_0x6e09('0xe')](function(_0x4d91a4){return db[_0x6e09('0x20')][_0x6e09('0x17')]({'raw':_0x28430c['options']?_0x28430c['options']['raw']===undefined?!![]:![]:!![],'where':_0x28430c[_0x6e09('0x18')]?_0x28430c[_0x6e09('0x18')]['where']||null:null,'attributes':_0x28430c[_0x6e09('0x18')]?_0x28430c[_0x6e09('0x18')][_0x6e09('0x1b')]||null:null,'limit':_0x28430c[_0x6e09('0x18')]?_0x28430c[_0x6e09('0x18')]['limit']||null:null,'include':_0x28430c[_0x6e09('0x18')]?_0x28430c['options'][_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x28430c[_0x6e09('0x18')][_0x6e09('0x1c')],function(_0x1454a7){return{'model':db[_0x1454a7[_0x6e09('0x1e')]],'as':_0x1454a7['as'],'attributes':_0x1454a7['as']===_0x6e09('0x48')?_[_0x6e09('0x32')](_0x4d91a4):_0x1454a7[_0x6e09('0x1b')],'include':_0x1454a7['include']?_[_0x6e09('0x1d')](_0x1454a7[_0x6e09('0x1c')],function(_0x4d4776){return{'model':db[_0x4d4776['model']],'as':_0x4d4776['as'],'attributes':_0x4d4776[_0x6e09('0x1b')],'include':_0x4d4776[_0x6e09('0x1c')]?_[_0x6e09('0x1d')](_0x4d4776[_0x6e09('0x1c')],function(_0x1510bc){return{'model':db[_0x1510bc['model']],'as':_0x1510bc['as'],'attributes':_0x1510bc[_0x6e09('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6e09('0xe')](function(_0x2d462f){logger[_0x6e09('0xf')]('GetCmHopper',_0x28430c);logger[_0x6e09('0x12')](_0x6e09('0x16'),_0x28430c,JSON[_0x6e09('0x26')](_0x2d462f));_0x149e8e(_0x2d462f);})['catch'](function(_0x44b5f6){logger[_0x6e09('0x14')](_0x6e09('0x16'),_0x44b5f6['message'],_0x28430c);_0x52cace(_0x9103b0[_0x6e09('0x14')](0x1f4,_0x44b5f6[_0x6e09('0x15')]));});});});}; \ No newline at end of file +var _0x9738=['MoveContactManagedDialer','CountReScheduled','COUNT','literal','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','all','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','model','include','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','includes','CmHopperFinal'];(function(_0x49400e,_0x92d09d){var _0x4f4513=function(_0x1f5d72){while(--_0x1f5d72){_0x49400e['push'](_0x49400e['shift']());}};_0x4f4513(++_0x92d09d);}(_0x9738,0x128));var _0x8973=function(_0x352bb5,_0x1354ef){_0x352bb5=_0x352bb5-0x0;var _0x1805c8=_0x9738[_0x352bb5];return _0x1805c8;};'use strict';var _=require(_0x8973('0x0'));var util=require(_0x8973('0x1'));var moment=require(_0x8973('0x2'));var BPromise=require(_0x8973('0x3'));var rs=require(_0x8973('0x4'));var fs=require('fs');var Redis=require(_0x8973('0x5'));var db=require(_0x8973('0x6'))['db'];var utils=require(_0x8973('0x7'));var logger=require(_0x8973('0x8'))(_0x8973('0x9'));var config=require('../../config/environment');var jayson=require(_0x8973('0xa'));var client=jayson[_0x8973('0xb')][_0x8973('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2367be,_0x50a9d7,_0x3ace03){return new BPromise(function(_0x15b90e,_0x3d1272){return client['request'](_0x2367be,_0x3ace03)[_0x8973('0xd')](function(_0x18458e){logger[_0x8973('0xe')](_0x8973('0xf'),_0x50a9d7,_0x8973('0x10'));logger[_0x8973('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x50a9d7,_0x8973('0x10'),JSON[_0x8973('0x12')](_0x18458e));if(_0x18458e[_0x8973('0x13')]){if(_0x18458e[_0x8973('0x13')][_0x8973('0x14')]===0x1f4){logger[_0x8973('0x13')](_0x8973('0xf'),_0x50a9d7,_0x18458e[_0x8973('0x13')][_0x8973('0x15')]);return _0x3d1272(_0x18458e[_0x8973('0x13')][_0x8973('0x15')]);}logger[_0x8973('0x13')]('CmHopper,\x20%s,\x20%s',_0x50a9d7,_0x18458e[_0x8973('0x13')][_0x8973('0x15')]);return _0x15b90e(_0x18458e[_0x8973('0x13')][_0x8973('0x15')]);}else{logger['info'](_0x8973('0xf'),_0x50a9d7,_0x8973('0x10'));_0x15b90e(_0x18458e['result'][_0x8973('0x15')]);}})[_0x8973('0x16')](function(_0x56c69c){logger[_0x8973('0x13')](_0x8973('0xf'),_0x50a9d7,_0x56c69c);_0x3d1272(_0x56c69c);});});}exports[_0x8973('0x17')]=function(_0x5099fe){var _0x4b5fea=this;return new Promise(function(_0x52c472,_0x2623fa){return db[_0x8973('0x18')][_0x8973('0x19')]({'raw':_0x5099fe[_0x8973('0x1a')]?_0x5099fe[_0x8973('0x1a')][_0x8973('0x1b')]===undefined?!![]:![]:!![],'where':_0x5099fe[_0x8973('0x1a')]?_0x5099fe[_0x8973('0x1a')][_0x8973('0x1c')]||null:null,'attributes':_0x5099fe['options']?_0x5099fe[_0x8973('0x1a')][_0x8973('0x1d')]||null:null,'limit':_0x5099fe[_0x8973('0x1a')]?_0x5099fe[_0x8973('0x1a')][_0x8973('0x1e')]||null:null,'include':_0x5099fe[_0x8973('0x1a')]?_0x5099fe[_0x8973('0x1a')]['include']?_[_0x8973('0x1f')](_0x5099fe[_0x8973('0x1a')]['include'],function(_0x4a4318){return{'model':db[_0x4a4318[_0x8973('0x20')]],'as':_0x4a4318['as'],'attributes':_0x4a4318['attributes'],'include':_0x4a4318[_0x8973('0x21')]?_[_0x8973('0x1f')](_0x4a4318['include'],function(_0x325775){return{'model':db[_0x325775[_0x8973('0x20')]],'as':_0x325775['as'],'attributes':_0x325775[_0x8973('0x1d')],'include':_0x325775[_0x8973('0x21')]?_['map'](_0x325775[_0x8973('0x21')],function(_0x3ffcc1){return{'model':db[_0x3ffcc1[_0x8973('0x20')]],'as':_0x3ffcc1['as'],'attributes':_0x3ffcc1[_0x8973('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8973('0xd')](function(_0x2244d0){logger[_0x8973('0xe')]('GetCmHopper',_0x5099fe);logger[_0x8973('0x11')](_0x8973('0x17'),_0x5099fe,JSON[_0x8973('0x12')](_0x2244d0));_0x52c472(_0x2244d0);})[_0x8973('0x16')](function(_0x4e6a64){logger[_0x8973('0x13')](_0x8973('0x17'),_0x4e6a64[_0x8973('0x15')],_0x5099fe);_0x2623fa(_0x4b5fea[_0x8973('0x13')](0x1f4,_0x4e6a64[_0x8973('0x15')]));});});};exports[_0x8973('0x22')]=function(_0x35d171){var _0xb418f=this;return new Promise(function(_0x3b6034,_0x1f6cdb){return db['CmHopper'][_0x8973('0x23')]({'raw':_0x35d171['options']?_0x35d171[_0x8973('0x1a')][_0x8973('0x1b')]===undefined?!![]:![]:!![],'where':_0x35d171[_0x8973('0x1a')]?_0x35d171[_0x8973('0x1a')]['where']||null:null,'attributes':_0x35d171[_0x8973('0x1a')]?_0x35d171[_0x8973('0x1a')]['attributes']||null:null,'include':_0x35d171[_0x8973('0x1a')]?_0x35d171[_0x8973('0x1a')][_0x8973('0x21')]?_[_0x8973('0x1f')](_0x35d171['options'][_0x8973('0x21')],function(_0x4f0f59){return{'model':db[_0x4f0f59['model']],'as':_0x4f0f59['as'],'attributes':_0x4f0f59[_0x8973('0x1d')],'include':_0x4f0f59[_0x8973('0x21')]?_[_0x8973('0x1f')](_0x4f0f59['include'],function(_0x564746){return{'model':db[_0x564746[_0x8973('0x20')]],'as':_0x564746['as'],'attributes':_0x564746[_0x8973('0x1d')],'include':_0x564746[_0x8973('0x21')]?_[_0x8973('0x1f')](_0x564746['include'],function(_0x339e6a){return{'model':db[_0x339e6a['model']],'as':_0x339e6a['as'],'attributes':_0x339e6a[_0x8973('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8973('0xd')](function(_0x33fdcc){logger[_0x8973('0xe')](_0x8973('0x22'),_0x35d171);logger[_0x8973('0x11')]('ShowCmHopper',_0x35d171,JSON[_0x8973('0x12')](_0x33fdcc));_0x3b6034(_0x33fdcc);})['catch'](function(_0x5aa19a){logger[_0x8973('0x13')]('ShowCmHopper',_0x5aa19a['message'],_0x35d171);_0x1f6cdb(_0xb418f[_0x8973('0x13')](0x1f4,_0x5aa19a[_0x8973('0x15')]));});});};exports[_0x8973('0x24')]=function(_0x35e2a9){var _0x5c4198=this;return new Promise(function(_0x49d6ff,_0x1bebcc){return db[_0x8973('0x18')][_0x8973('0x25')](_0x35e2a9[_0x8973('0x26')],{'raw':_0x35e2a9[_0x8973('0x1a')]?_0x35e2a9[_0x8973('0x1a')][_0x8973('0x1b')]===undefined?!![]:![]:!![]})[_0x8973('0xd')](function(_0x755e74){logger[_0x8973('0xe')]('CreateCmHopper',_0x35e2a9);logger[_0x8973('0x11')](_0x8973('0x24'),_0x35e2a9,JSON[_0x8973('0x12')](_0x755e74));_0x49d6ff(_0x755e74);})[_0x8973('0x16')](function(_0x293cb0){logger[_0x8973('0x13')](_0x8973('0x24'),_0x293cb0[_0x8973('0x15')],_0x35e2a9);_0x1bebcc(_0x5c4198[_0x8973('0x13')](0x1f4,_0x293cb0[_0x8973('0x15')]));});});};exports[_0x8973('0x27')]=function(_0x342fae){var _0x5a9aad=this;return new Promise(function(_0xc975e1,_0x11c48f){return db[_0x8973('0x18')][_0x8973('0x28')](_0x342fae[_0x8973('0x26')],{'raw':_0x342fae[_0x8973('0x1a')]?_0x342fae[_0x8973('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x342fae[_0x8973('0x1a')]?_0x342fae[_0x8973('0x1a')][_0x8973('0x1c')]||null:null,'attributes':_0x342fae[_0x8973('0x1a')]?_0x342fae[_0x8973('0x1a')]['attributes']||null:null,'limit':_0x342fae[_0x8973('0x1a')]?_0x342fae[_0x8973('0x1a')][_0x8973('0x1e')]||null:null})['then'](function(_0x3747ab){logger[_0x8973('0xe')]('UpdateCmHopper',_0x342fae);logger['debug'](_0x8973('0x27'),_0x342fae,JSON['stringify'](_0x3747ab));_0xc975e1(_0x3747ab);})[_0x8973('0x16')](function(_0x397ef0){logger[_0x8973('0x13')](_0x8973('0x27'),_0x397ef0[_0x8973('0x15')],_0x342fae);_0x11c48f(_0x5a9aad[_0x8973('0x13')](0x1f4,_0x397ef0[_0x8973('0x15')]));});});};exports['DestroyCmHopper']=function(_0x15d6ef){var _0x1d4b34=this;return new Promise(function(_0x3bcbea,_0x501358){return db[_0x8973('0x18')]['destroy']({'where':_0x15d6ef['options']?_0x15d6ef[_0x8973('0x1a')][_0x8973('0x1c')]||null:null})[_0x8973('0xd')](function(_0x1fdd96){logger[_0x8973('0xe')](_0x8973('0x29'),_0x15d6ef);logger['debug'](_0x8973('0x29'),_0x15d6ef,JSON[_0x8973('0x12')](_0x1fdd96));_0x3bcbea(_0x1fdd96);})['catch'](function(_0x4a3378){logger[_0x8973('0x13')](_0x8973('0x29'),_0x4a3378[_0x8973('0x15')],_0x15d6ef);_0x501358(_0x1d4b34[_0x8973('0x13')](0x1f4,_0x4a3378[_0x8973('0x15')]));});});};exports[_0x8973('0x2a')]=function(_0xab23ca){var _0x75c93e=this;return new Promise(function(_0x2397ba,_0xe11632){return db[_0x8973('0x2b')]['describe']()[_0x8973('0xd')](function(_0xbb7947){return db[_0x8973('0x2c')][_0x8973('0x2d')](function(_0x299a4f){return db[_0x8973('0x18')][_0x8973('0x19')]({'where':_0xab23ca[_0x8973('0x1a')]?_0xab23ca[_0x8973('0x1a')][_0x8973('0x1c')]||null:null,'attributes':_0xab23ca[_0x8973('0x1a')]?_0xab23ca[_0x8973('0x1a')][_0x8973('0x1d')]||null:null,'limit':_0xab23ca[_0x8973('0x1a')]?_0xab23ca[_0x8973('0x1a')][_0x8973('0x1e')]||null:null,'order':_0xab23ca[_0x8973('0x1a')]?_0xab23ca[_0x8973('0x1a')][_0x8973('0x2e')]||null:null,'transaction':_0x299a4f,'lock':_0x299a4f[_0x8973('0x2f')][_0x8973('0x30')],'include':[{'model':db[_0x8973('0x2b')],'as':_0x8973('0x31'),'attributes':_[_0x8973('0x32')](_0xbb7947)},{'model':db[_0x8973('0x33')],'as':_0x8973('0x34'),'attributes':['id',_0x8973('0x35'),_0x8973('0x36')]}]})[_0x8973('0xd')](function(_0x56bb0c){var _0x24330c=[];var _0x1eb4f8=[];for(var _0xec63e6=0x0;_0xec63e6<_0x56bb0c[_0x8973('0x37')];_0xec63e6+=0x1){var _0x562c03=_0x56bb0c[_0xec63e6]['UserId'];if(_0x562c03===null){_0x24330c[_0x8973('0x38')](_0x56bb0c[_0xec63e6][_0x8973('0x28')](_0xab23ca[_0x8973('0x26')],{'transaction':_0x299a4f}));}else if(!_0x1eb4f8[_0x8973('0x39')](_0x562c03)){_0x1eb4f8['push'](_0x562c03);_0x24330c[_0x8973('0x38')](_0x56bb0c[_0xec63e6][_0x8973('0x28')](_0xab23ca['body'],{'transaction':_0x299a4f}));}}return BPromise['all'](_0x24330c);});})[_0x8973('0xd')](function(_0x2f9389){logger[_0x8973('0xe')](_0x8973('0x2a'),_0xab23ca);logger[_0x8973('0x11')]('GetContactDialer',_0xab23ca,JSON['stringify'](_0x2f9389));_0x2397ba(_0x2f9389);})[_0x8973('0x16')](function(_0x1c1905){logger['error']('GetContactDialer',_0x1c1905['message'],_0xab23ca);_0xe11632(_0x75c93e[_0x8973('0x13')](0x1f4,_0x1c1905['message']));});});});};exports['MoveContactManagedDialer']=function(_0x388e3d){var _0x122ed5=this;return new Promise(function(_0xb0c8b0,_0x56394c){return db[_0x8973('0x2c')][_0x8973('0x2d')](function(_0x6e81d2){return db[_0x8973('0x3a')]['create'](_0x388e3d['body'],{'raw':_0x388e3d[_0x8973('0x1a')]?_0x388e3d['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x6e81d2})[_0x8973('0xd')](function(){return db[_0x8973('0x18')]['destroy']({'where':_0x388e3d[_0x8973('0x1a')]?_0x388e3d[_0x8973('0x1a')][_0x8973('0x1c')]||null:null,'transaction':_0x6e81d2});});})[_0x8973('0xd')](function(_0x5f118e){logger[_0x8973('0xe')](_0x8973('0x3b'),_0x388e3d);logger[_0x8973('0x11')](_0x8973('0x3b'),_0x388e3d,JSON[_0x8973('0x12')](_0x5f118e));_0xb0c8b0(_0x5f118e);})['catch'](function(_0x1e83a6){logger[_0x8973('0x13')]('MoveContactManagedDialer',_0x1e83a6['message'],_0x388e3d);_0x56394c(_0x122ed5['error'](0x1f4,_0x1e83a6[_0x8973('0x15')]));});});};exports[_0x8973('0x3c')]=function(_0x211eb0){var _0x3b250d=this;return new Promise(function(_0x236ce3,_0x1b028a){return db['CmHopper'][_0x8973('0x19')]({'raw':_0x211eb0[_0x8973('0x1a')]?_0x211eb0['options']['raw']===undefined?!![]:![]:!![],'where':_0x211eb0['options']?_0x211eb0[_0x8973('0x1a')][_0x8973('0x1c')]||null:null,'attributes':[[db[_0x8973('0x2c')]['fn'](_0x8973('0x3d'),db[_0x8973('0x2c')]['fn']('IF',db[_0x8973('0x2c')][_0x8973('0x3e')]('`scheduledat`\x20>=\x20'+util['format'](_0x8973('0x3f'),moment()['format'](_0x8973('0x40')))+_0x8973('0x41')))),_0x8973('0x42')]]})[_0x8973('0xd')](function(_0x58ec5f){logger[_0x8973('0xe')](_0x8973('0x3c'),_0x211eb0);logger[_0x8973('0x11')](_0x8973('0x3c'),_0x211eb0,JSON[_0x8973('0x12')](_0x58ec5f));_0x236ce3(_0x58ec5f);})[_0x8973('0x16')](function(_0x4bd3f3){logger[_0x8973('0x13')](_0x8973('0x3c'),_0x4bd3f3[_0x8973('0x15')],_0x211eb0);_0x1b028a(_0x3b250d[_0x8973('0x13')](0x1f4,_0x4bd3f3['message']));});});};exports[_0x8973('0x43')]=function(_0x1eb6c9){var _0x1c69a3=this;return new Promise(function(_0x617c89,_0x5e5089){return db[_0x8973('0x2b')][_0x8973('0x44')]()[_0x8973('0xd')](function(_0x2e2c8d){return db[_0x8973('0x2c')][_0x8973('0x2d')](function(_0x50474c){return db['CmHopper'][_0x8973('0x19')]({'where':_0x1eb6c9[_0x8973('0x1a')]?_0x1eb6c9['options'][_0x8973('0x1c')]||null:null,'attributes':_0x1eb6c9[_0x8973('0x1a')]?_0x1eb6c9[_0x8973('0x1a')][_0x8973('0x1d')]||null:null,'limit':0x1,'order':_0x1eb6c9[_0x8973('0x1a')]?_0x1eb6c9[_0x8973('0x1a')][_0x8973('0x2e')]||null:null,'group':db[_0x8973('0x18')]['UserId'],'transaction':_0x50474c,'lock':_0x50474c['LOCK'][_0x8973('0x30')],'include':_0x1eb6c9[_0x8973('0x1a')]?_0x1eb6c9[_0x8973('0x1a')]['include']?_['map'](_0x1eb6c9[_0x8973('0x1a')][_0x8973('0x21')],function(_0x341b00){return{'model':db[_0x341b00[_0x8973('0x20')]],'as':_0x341b00['as'],'attributes':_0x341b00['attributes'],'include':_0x341b00[_0x8973('0x21')]?_['map'](_0x341b00[_0x8973('0x21')],function(_0x120ba7){return{'model':db[_0x120ba7[_0x8973('0x20')]],'as':_0x120ba7['as'],'attributes':_0x120ba7[_0x8973('0x1d')],'include':_0x120ba7[_0x8973('0x21')]?_[_0x8973('0x1f')](_0x120ba7[_0x8973('0x21')],function(_0x4cc01b){return{'model':db[_0x4cc01b['model']],'as':_0x4cc01b['as'],'attributes':_0x4cc01b[_0x8973('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8973('0xd')](function(_0x4ea629){var _0x2a11fb=[];for(var _0x4713fc=0x0;_0x4713fc<_0x4ea629[_0x8973('0x37')];_0x4713fc+=0x1){_0x2a11fb[_0x8973('0x38')](_0x4ea629[_0x4713fc][_0x8973('0x28')](_0x1eb6c9[_0x8973('0x26')],{'transaction':_0x50474c}));}return BPromise[_0x8973('0x45')](_0x2a11fb);});})['then'](function(_0x1e7ff0){logger[_0x8973('0xe')]('GetContactRecallMe',_0x1eb6c9);logger[_0x8973('0x11')]('GetContactRecallMe',_0x1eb6c9,JSON[_0x8973('0x12')](_0x1e7ff0));_0x617c89(_0x1e7ff0);})['catch'](function(_0x4fbe9e){logger[_0x8973('0x13')]('GetContactRecallMe',_0x4fbe9e[_0x8973('0x15')],_0x1eb6c9);_0x5e5089(_0x1c69a3[_0x8973('0x13')](0x1f4,_0x4fbe9e[_0x8973('0x15')]));});});});};exports[_0x8973('0x46')]=function(_0x23a349){var _0x138736=this;return new Promise(function(_0x4046b4,_0x3692ed){db[_0x8973('0x2b')][_0x8973('0x44')]()[_0x8973('0xd')](function(_0xdbdfd5){return db[_0x8973('0x18')][_0x8973('0x19')]({'raw':_0x23a349[_0x8973('0x1a')]?_0x23a349['options'][_0x8973('0x1b')]===undefined?!![]:![]:!![],'where':_0x23a349['options']?_0x23a349[_0x8973('0x1a')][_0x8973('0x1c')]||null:null,'attributes':_0x23a349[_0x8973('0x1a')]?_0x23a349[_0x8973('0x1a')][_0x8973('0x1d')]||null:null,'limit':_0x23a349['options']?_0x23a349[_0x8973('0x1a')][_0x8973('0x1e')]||null:null,'include':_0x23a349[_0x8973('0x1a')]?_0x23a349[_0x8973('0x1a')][_0x8973('0x21')]?_['map'](_0x23a349[_0x8973('0x1a')]['include'],function(_0x2a228d){return{'model':db[_0x2a228d[_0x8973('0x20')]],'as':_0x2a228d['as'],'attributes':_0x2a228d['as']===_0x8973('0x31')?_[_0x8973('0x32')](_0xdbdfd5):_0x2a228d['attributes'],'include':_0x2a228d[_0x8973('0x21')]?_['map'](_0x2a228d[_0x8973('0x21')],function(_0x33f3af){return{'model':db[_0x33f3af[_0x8973('0x20')]],'as':_0x33f3af['as'],'attributes':_0x33f3af[_0x8973('0x1d')],'include':_0x33f3af[_0x8973('0x21')]?_[_0x8973('0x1f')](_0x33f3af[_0x8973('0x21')],function(_0x4ae48d){return{'model':db[_0x4ae48d['model']],'as':_0x4ae48d['as'],'attributes':_0x4ae48d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8973('0xd')](function(_0x153b07){logger[_0x8973('0xe')](_0x8973('0x17'),_0x23a349);logger['debug'](_0x8973('0x17'),_0x23a349,JSON[_0x8973('0x12')](_0x153b07));_0x4046b4(_0x153b07);})[_0x8973('0x16')](function(_0x8fa6a){logger[_0x8973('0x13')](_0x8973('0x17'),_0x8fa6a[_0x8973('0x15')],_0x23a349);_0x3692ed(_0x138736[_0x8973('0x13')](0x1f4,_0x8fa6a[_0x8973('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2e29562..b4c3c3f 100644 --- a/server/api/cmHopper/index.js +++ b/server/api/cmHopper/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['/describe','/opencontacts','/:id','show','post','create','/preview','getPreview','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index'];(function(_0x2ec842,_0x296cf2){var _0x100825=function(_0x582dc9){while(--_0x582dc9){_0x2ec842['push'](_0x2ec842['shift']());}};_0x100825(++_0x296cf2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x24ca[_0x5ac84c];return _0x3c53d2;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['getOpenContacts']);router[_0xa24c('0x9')](_0xa24c('0xe'),auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x10')](_0xa24c('0x12'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);router[_0xa24c('0x14')](_0xa24c('0xe'),auth[_0xa24c('0xa')](),controller['update']);router[_0xa24c('0x15')](_0xa24c('0xe'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x16')]);module[_0xa24c('0x17')]=router; \ No newline at end of file +var _0xfafd=['index','/describe','describe','/opencontacts','getOpenContacts','/:id','post','create','/preview','getPreview','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0xfafd,0xcc));var _0xdfaf=function(_0x1f2946,_0x2bbb34){_0x1f2946=_0x1f2946-0x0;var _0x3276f9=_0xfafd[_0x1f2946];return _0x3276f9;};'use strict';var multer=require('multer');var util=require(_0xdfaf('0x0'));var path=require(_0xdfaf('0x1'));var timeout=require(_0xdfaf('0x2'));var express=require(_0xdfaf('0x3'));var router=express[_0xdfaf('0x4')]();var fs_extra=require(_0xdfaf('0x5'));var auth=require(_0xdfaf('0x6'));var interaction=require(_0xdfaf('0x7'));var config=require(_0xdfaf('0x8'));var controller=require(_0xdfaf('0x9'));router[_0xdfaf('0xa')]('/',auth[_0xdfaf('0xb')](),controller[_0xdfaf('0xc')]);router[_0xdfaf('0xa')](_0xdfaf('0xd'),auth['isAuthenticated'](),controller[_0xdfaf('0xe')]);router[_0xdfaf('0xa')](_0xdfaf('0xf'),auth[_0xdfaf('0xb')](),controller[_0xdfaf('0x10')]);router[_0xdfaf('0xa')](_0xdfaf('0x11'),auth[_0xdfaf('0xb')](),controller['show']);router[_0xdfaf('0x12')]('/',auth[_0xdfaf('0xb')](),controller[_0xdfaf('0x13')]);router[_0xdfaf('0x12')](_0xdfaf('0x14'),auth['isAuthenticated'](),controller[_0xdfaf('0x15')]);router[_0xdfaf('0x16')](_0xdfaf('0x11'),auth[_0xdfaf('0xb')](),controller[_0xdfaf('0x17')]);router[_0xdfaf('0x18')](_0xdfaf('0x11'),auth[_0xdfaf('0xb')](),controller[_0xdfaf('0x19')]);module[_0xdfaf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 30fe533..33c40a1 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05d9=['exports','INTEGER','STRING','DATE','moment','sequelize'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0x05d9,0xca));var _0x905d=function(_0x223b67,_0x18f77f){_0x223b67=_0x223b67-0x0;var _0x16bfc1=_0x05d9[_0x223b67];return _0x16bfc1;};'use strict';var moment=require(_0x905d('0x0'));var Sequelize=require(_0x905d('0x1'));module[_0x905d('0x2')]={'CmHopperId':{'type':Sequelize[_0x905d('0x3')]},'phone':{'type':Sequelize[_0x905d('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x905d('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x905d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8e69=['exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x1de075,_0x470580){var _0x3a5fa7=function(_0x1fb698){while(--_0x1fb698){_0x1de075['push'](_0x1de075['shift']());}};_0x3a5fa7(++_0x470580);}(_0x8e69,0x1f1));var _0x98e6=function(_0x506685,_0x5dab2c){_0x506685=_0x506685-0x0;var _0x130ed7=_0x8e69[_0x506685];return _0x130ed7;};'use strict';var moment=require('moment');var Sequelize=require(_0x98e6('0x0'));module[_0x98e6('0x1')]={'CmHopperId':{'type':Sequelize[_0x98e6('0x2')]},'phone':{'type':Sequelize[_0x98e6('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x98e6('0x4')](_0x98e6('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x98e6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 6267276..e1c9f47 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f66=['error','stack','send','merge','body','contact','message','agent','interaction','account','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','name','includeAll','include','findAll','catch','show','params','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','reject','save','update','then','destroy'];(function(_0x3e9b35,_0x468198){var _0x1cf06c=function(_0x15e8da){while(--_0x15e8da){_0x3e9b35['push'](_0x3e9b35['shift']());}};_0x1cf06c(++_0x468198);}(_0x9f66,0x17d));var _0x69f6=function(_0x590e5a,_0x5d556b){_0x590e5a=_0x590e5a-0x0;var _0x6a49c6=_0x9f66[_0x590e5a];return _0x6a49c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69f6('0x0'));var zipdir=require(_0x69f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x69f6('0x2'));var moment=require(_0x69f6('0x3'));var BPromise=require(_0x69f6('0x4'));var Mustache=require(_0x69f6('0x5'));var util=require('util');var path=require(_0x69f6('0x6'));var sox=require(_0x69f6('0x7'));var csv=require('to-csv');var ejs=require(_0x69f6('0x8'));var fs=require('fs');var fs_extra=require(_0x69f6('0x9'));var _=require('lodash');var squel=require(_0x69f6('0xa'));var crypto=require(_0x69f6('0xb'));var jsforce=require(_0x69f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x69f6('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69f6('0xe'));var as=require(_0x69f6('0xf'));var hardwareService=require(_0x69f6('0x10'));var logger=require(_0x69f6('0x11'))(_0x69f6('0x12'));var utils=require(_0x69f6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69f6('0x14'))['db'];function respondWithStatusCode(_0x29645e,_0x1c2f0a){_0x1c2f0a=_0x1c2f0a||0xcc;return function(_0x4ce887){if(_0x4ce887){return _0x29645e[_0x69f6('0x15')](_0x1c2f0a);}return _0x29645e[_0x69f6('0x16')](_0x1c2f0a)[_0x69f6('0x17')]();};}function respondWithResult(_0x1335dc,_0x389127){_0x389127=_0x389127||0xc8;return function(_0x4d3eb4){if(_0x4d3eb4){return _0x1335dc[_0x69f6('0x16')](_0x389127)['json'](_0x4d3eb4);}};}function respondWithFilteredResult(_0x569b88,_0x2e5490){return function(_0x4c63aa){if(_0x4c63aa){var _0x3b5efb=typeof _0x2e5490[_0x69f6('0x18')]==='undefined'&&typeof _0x2e5490[_0x69f6('0x19')]===_0x69f6('0x1a');var _0x3c5973=_0x4c63aa[_0x69f6('0x1b')];var _0x591642=_0x3b5efb?0x0:_0x2e5490[_0x69f6('0x18')];var _0x6884f4=_0x3b5efb?_0x4c63aa[_0x69f6('0x1b')]:_0x2e5490[_0x69f6('0x18')]+_0x2e5490[_0x69f6('0x19')];var _0x189cf1;if(_0x6884f4>=_0x3c5973){_0x6884f4=_0x3c5973;_0x189cf1=0xc8;}else{_0x189cf1=0xce;}_0x569b88[_0x69f6('0x16')](_0x189cf1);return _0x569b88['set']('Content-Range',_0x591642+'-'+_0x6884f4+'/'+_0x3c5973)[_0x69f6('0x1c')](_0x4c63aa);}return null;};}function patchUpdates(_0x862f2e){return function(_0x5c8db2){try{jsonpatch['apply'](_0x5c8db2,_0x862f2e,!![]);}catch(_0x54d813){return BPromise[_0x69f6('0x1d')](_0x54d813);}return _0x5c8db2[_0x69f6('0x1e')]();};}function saveUpdates(_0x1726f9,_0x2ca812){return function(_0x1dfc2f){if(_0x1dfc2f){return _0x1dfc2f[_0x69f6('0x1f')](_0x1726f9)[_0x69f6('0x20')](function(_0x5dd7be){return _0x5dd7be;});}return null;};}function removeEntity(_0x44db72,_0x348d56){return function(_0x4220ee){if(_0x4220ee){return _0x4220ee[_0x69f6('0x21')]()[_0x69f6('0x20')](function(){var _0x330ac9=_0x4220ee['get']({'plain':!![]});var _0x112c4f='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x69f6('0x21')]({'where':{'type':_0x112c4f,'resourceId':_0x330ac9['id']}})['then'](function(){return _0x4220ee;});})['then'](function(){_0x44db72[_0x69f6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120f9b,_0x43bba3){return function(_0x1fc640){if(!_0x1fc640){_0x120f9b['sendStatus'](0x194);}return _0x1fc640;};}function handleError(_0x177673,_0x59cd2a){_0x59cd2a=_0x59cd2a||0x1f4;return function(_0x2cb709){logger[_0x69f6('0x22')](_0x2cb709[_0x69f6('0x23')]);if(_0x2cb709['name']){delete _0x2cb709['name'];}_0x177673[_0x69f6('0x16')](_0x59cd2a)[_0x69f6('0x24')](_0x2cb709);};}function getMustacheRender(_0x9d4f69,_0x494858){return Mustache['render'](_0x9d4f69,_[_0x69f6('0x25')](_0x494858[_0x69f6('0x26')],{'contact':_0x494858[_0x69f6('0x27')],'message':_0x494858[_0x69f6('0x28')],'agent':_0x494858[_0x69f6('0x29')],'interaction':_0x494858[_0x69f6('0x2a')],'account':_0x494858[_0x69f6('0x2b')]}))||'';}exports[_0x69f6('0x2c')]=function(_0xce1197,_0x21a522){var _0x5890be={},_0x20cc61={},_0x9c8bd8={'count':0x0,'rows':[]};var _0x251e8b=_[_0x69f6('0x2d')](db[_0x69f6('0x2e')][_0x69f6('0x2f')],function(_0x31b980){return{'name':_0x31b980['fieldName'],'type':_0x31b980[_0x69f6('0x30')][_0x69f6('0x31')]};});_0x20cc61[_0x69f6('0x32')]=_[_0x69f6('0x2d')](_0x251e8b,'name');_0x20cc61[_0x69f6('0x33')]=_[_0x69f6('0x34')](_0xce1197['query']);_0x20cc61[_0x69f6('0x35')]=_[_0x69f6('0x36')](_0x20cc61[_0x69f6('0x32')],_0x20cc61['query']);_0x5890be[_0x69f6('0x37')]=_[_0x69f6('0x36')](_0x20cc61[_0x69f6('0x32')],qs[_0x69f6('0x38')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x38')]));_0x5890be[_0x69f6('0x37')]=_0x5890be[_0x69f6('0x37')][_0x69f6('0x39')]?_0x5890be[_0x69f6('0x37')]:_0x20cc61[_0x69f6('0x32')];if(!_0xce1197['query']['hasOwnProperty'](_0x69f6('0x3a'))){_0x5890be['limit']=qs[_0x69f6('0x19')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x19')]);_0x5890be[_0x69f6('0x18')]=qs[_0x69f6('0x18')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x18')]);}_0x5890be[_0x69f6('0x3b')]=qs[_0x69f6('0x3c')](_0xce1197[_0x69f6('0x33')][_0x69f6('0x3c')]);_0x5890be[_0x69f6('0x3d')]=qs[_0x69f6('0x35')](_[_0x69f6('0x3e')](_0xce1197[_0x69f6('0x33')],_0x20cc61['filters']),_0x251e8b);if(_0xce1197[_0x69f6('0x33')][_0x69f6('0x3f')]){_0x5890be[_0x69f6('0x3d')]=_[_0x69f6('0x25')](_0x5890be[_0x69f6('0x3d')],{'$or':_[_0x69f6('0x2d')](_0x251e8b,function(_0x261885){if(_0x261885[_0x69f6('0x30')]!=='VIRTUAL'){var _0x1b8d3a={};_0x1b8d3a[_0x261885[_0x69f6('0x40')]]={'$like':'%'+_0xce1197[_0x69f6('0x33')][_0x69f6('0x3f')]+'%'};return _0x1b8d3a;}})});}_0x5890be=_[_0x69f6('0x25')]({},_0x5890be,_0xce1197['options']);var _0x568040={'where':_0x5890be[_0x69f6('0x3d')]};return db[_0x69f6('0x2e')][_0x69f6('0x1b')](_0x568040)[_0x69f6('0x20')](function(_0x1e6cea){_0x9c8bd8[_0x69f6('0x1b')]=_0x1e6cea;if(_0xce1197[_0x69f6('0x33')][_0x69f6('0x41')]){_0x5890be[_0x69f6('0x42')]=[{'all':!![]}];}return db[_0x69f6('0x2e')][_0x69f6('0x43')](_0x5890be);})[_0x69f6('0x20')](function(_0x1b7350){_0x9c8bd8['rows']=_0x1b7350;return _0x9c8bd8;})[_0x69f6('0x20')](respondWithFilteredResult(_0x21a522,_0x5890be))[_0x69f6('0x44')](handleError(_0x21a522,null));};exports[_0x69f6('0x45')]=function(_0x5fead0,_0x2e48b2){var _0x36e1b4={'raw':!![],'where':{'id':_0x5fead0[_0x69f6('0x46')]['id']}},_0x559b5d={};_0x559b5d[_0x69f6('0x32')]=_['keys'](db[_0x69f6('0x2e')][_0x69f6('0x2f')]);_0x559b5d['query']=_[_0x69f6('0x34')](_0x5fead0[_0x69f6('0x33')]);_0x559b5d[_0x69f6('0x35')]=_[_0x69f6('0x36')](_0x559b5d[_0x69f6('0x32')],_0x559b5d[_0x69f6('0x33')]);_0x36e1b4['attributes']=_[_0x69f6('0x36')](_0x559b5d[_0x69f6('0x32')],qs['fields'](_0x5fead0[_0x69f6('0x33')][_0x69f6('0x38')]));_0x36e1b4[_0x69f6('0x37')]=_0x36e1b4[_0x69f6('0x37')][_0x69f6('0x39')]?_0x36e1b4[_0x69f6('0x37')]:_0x559b5d[_0x69f6('0x32')];if(_0x5fead0[_0x69f6('0x33')][_0x69f6('0x41')]){_0x36e1b4[_0x69f6('0x42')]=[{'all':!![]}];}_0x36e1b4=_[_0x69f6('0x25')]({},_0x36e1b4,_0x5fead0[_0x69f6('0x47')]);return db[_0x69f6('0x2e')]['find'](_0x36e1b4)[_0x69f6('0x20')](handleEntityNotFound(_0x2e48b2,null))[_0x69f6('0x20')](respondWithResult(_0x2e48b2,null))[_0x69f6('0x44')](handleError(_0x2e48b2,null));};exports[_0x69f6('0x48')]=function(_0x2e109b,_0x2d9995){return db[_0x69f6('0x2e')][_0x69f6('0x48')](_0x2e109b[_0x69f6('0x26')],{})[_0x69f6('0x20')](function(_0x589960){var _0x5bca6d=_0x2e109b[_0x69f6('0x49')][_0x69f6('0x4a')]({'plain':!![]});if(!_0x5bca6d)throw new Error(_0x69f6('0x4b'));if(_0x5bca6d[_0x69f6('0x4c')]===_0x69f6('0x49')){var _0x42412f=_0x589960[_0x69f6('0x4a')]({'plain':!![]});var _0x3d3f31='CmHopperAdditionalPhones';return db[_0x69f6('0x4d')][_0x69f6('0x4e')]({'where':{'name':_0x3d3f31,'userProfileId':_0x5bca6d[_0x69f6('0x4f')]},'raw':!![]})[_0x69f6('0x20')](function(_0x295ce3){if(_0x295ce3&&_0x295ce3[_0x69f6('0x50')]===0x0){return db[_0x69f6('0x51')]['create']({'name':_0x42412f['name'],'resourceId':_0x42412f['id'],'type':_0x295ce3[_0x69f6('0x40')],'sectionId':_0x295ce3['id']},{})[_0x69f6('0x20')](function(){return _0x589960;});}else{return _0x589960;}})['catch'](function(_0x5bd98e){logger[_0x69f6('0x22')](_0x69f6('0x52'),_0x5bd98e);throw _0x5bd98e;});}return _0x589960;})[_0x69f6('0x20')](respondWithResult(_0x2d9995,0xc9))[_0x69f6('0x44')](handleError(_0x2d9995,null));};exports['update']=function(_0x161848,_0x4d9bf1){if(_0x161848[_0x69f6('0x26')]['id']){delete _0x161848[_0x69f6('0x26')]['id'];}return db[_0x69f6('0x2e')][_0x69f6('0x4e')]({'where':{'id':_0x161848[_0x69f6('0x46')]['id']}})[_0x69f6('0x20')](handleEntityNotFound(_0x4d9bf1,null))['then'](saveUpdates(_0x161848[_0x69f6('0x26')],null))[_0x69f6('0x20')](respondWithResult(_0x4d9bf1,null))['catch'](handleError(_0x4d9bf1,null));};exports[_0x69f6('0x21')]=function(_0x475773,_0x343327){return db['CmHopperAdditionalPhone'][_0x69f6('0x4e')]({'where':{'id':_0x475773[_0x69f6('0x46')]['id']}})[_0x69f6('0x20')](handleEntityNotFound(_0x343327,null))[_0x69f6('0x20')](removeEntity(_0x343327,null))[_0x69f6('0x44')](handleError(_0x343327,null));}; \ No newline at end of file +var _0x66bd=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','CmHopperAdditionalPhones','UserProfileResource','destroy','status','sendStatus','error','name','send','render','message','agent','interaction','account','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4c6c91,_0x36ba7d){var _0x89a2fa=function(_0xf20c57){while(--_0xf20c57){_0x4c6c91['push'](_0x4c6c91['shift']());}};_0x89a2fa(++_0x36ba7d);}(_0x66bd,0xdd));var _0xd66b=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0x66bd[_0x3b8f2e];return _0x1433d5;};'use strict';var emlformat=require(_0xd66b('0x0'));var rimraf=require(_0xd66b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd66b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd66b('0x3'));var Mustache=require('mustache');var util=require(_0xd66b('0x4'));var path=require(_0xd66b('0x5'));var sox=require(_0xd66b('0x6'));var csv=require(_0xd66b('0x7'));var ejs=require(_0xd66b('0x8'));var fs=require('fs');var fs_extra=require(_0xd66b('0x9'));var _=require(_0xd66b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd66b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd66b('0xc'));var Papa=require('papaparse');var Redis=require(_0xd66b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd66b('0xe'));var as=require(_0xd66b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd66b('0x10'))(_0xd66b('0x11'));var utils=require(_0xd66b('0x12'));var config=require(_0xd66b('0x13'));var licenseUtil=require(_0xd66b('0x14'));var db=require(_0xd66b('0x15'))['db'];function respondWithStatusCode(_0x11c64b,_0x201f6a){_0x201f6a=_0x201f6a||0xcc;return function(_0xa1a44b){if(_0xa1a44b){return _0x11c64b['sendStatus'](_0x201f6a);}return _0x11c64b['status'](_0x201f6a)[_0xd66b('0x16')]();};}function respondWithResult(_0x2ff62e,_0xc31a0f){_0xc31a0f=_0xc31a0f||0xc8;return function(_0x3b3793){if(_0x3b3793){return _0x2ff62e['status'](_0xc31a0f)[_0xd66b('0x17')](_0x3b3793);}};}function respondWithFilteredResult(_0x30d214,_0x558c76){return function(_0x144e82){if(_0x144e82){var _0x360a3e=typeof _0x558c76[_0xd66b('0x18')]===_0xd66b('0x19')&&typeof _0x558c76[_0xd66b('0x1a')]===_0xd66b('0x19');var _0x56409a=_0x144e82['count'];var _0x2e4af6=_0x360a3e?0x0:_0x558c76[_0xd66b('0x18')];var _0x1ac846=_0x360a3e?_0x144e82[_0xd66b('0x1b')]:_0x558c76['offset']+_0x558c76[_0xd66b('0x1a')];var _0x1cf6d9;if(_0x1ac846>=_0x56409a){_0x1ac846=_0x56409a;_0x1cf6d9=0xc8;}else{_0x1cf6d9=0xce;}_0x30d214['status'](_0x1cf6d9);return _0x30d214[_0xd66b('0x1c')](_0xd66b('0x1d'),_0x2e4af6+'-'+_0x1ac846+'/'+_0x56409a)[_0xd66b('0x17')](_0x144e82);}return null;};}function patchUpdates(_0x499db1){return function(_0x4b9013){try{jsonpatch[_0xd66b('0x1e')](_0x4b9013,_0x499db1,!![]);}catch(_0x18299e){return BPromise[_0xd66b('0x1f')](_0x18299e);}return _0x4b9013['save']();};}function saveUpdates(_0x459d8a,_0x33dc71){return function(_0xb0b10a){if(_0xb0b10a){return _0xb0b10a[_0xd66b('0x20')](_0x459d8a)[_0xd66b('0x21')](function(_0x5b8989){return _0x5b8989;});}return null;};}function removeEntity(_0x20c714,_0x55e710){return function(_0x3652bf){if(_0x3652bf){return _0x3652bf['destroy']()[_0xd66b('0x21')](function(){var _0x1bba08=_0x3652bf['get']({'plain':!![]});var _0x474d1c=_0xd66b('0x22');return db[_0xd66b('0x23')][_0xd66b('0x24')]({'where':{'type':_0x474d1c,'resourceId':_0x1bba08['id']}})['then'](function(){return _0x3652bf;});})[_0xd66b('0x21')](function(){_0x20c714[_0xd66b('0x25')](0xcc)[_0xd66b('0x16')]();});}};}function handleEntityNotFound(_0x130655,_0x379a32){return function(_0xffda45){if(!_0xffda45){_0x130655[_0xd66b('0x26')](0x194);}return _0xffda45;};}function handleError(_0x467ecc,_0x28e7ea){_0x28e7ea=_0x28e7ea||0x1f4;return function(_0x494ede){logger[_0xd66b('0x27')](_0x494ede['stack']);if(_0x494ede[_0xd66b('0x28')]){delete _0x494ede['name'];}_0x467ecc[_0xd66b('0x25')](_0x28e7ea)[_0xd66b('0x29')](_0x494ede);};}function getMustacheRender(_0x1b2315,_0x5ad4bd){return Mustache[_0xd66b('0x2a')](_0x1b2315,_['merge'](_0x5ad4bd['body'],{'contact':_0x5ad4bd['contact'],'message':_0x5ad4bd[_0xd66b('0x2b')],'agent':_0x5ad4bd[_0xd66b('0x2c')],'interaction':_0x5ad4bd[_0xd66b('0x2d')],'account':_0x5ad4bd[_0xd66b('0x2e')]}))||'';}exports['index']=function(_0x4a261a,_0x5c363b){var _0x1e929b={},_0x14b269={},_0x47274f={'count':0x0,'rows':[]};var _0x2b7ebd=_[_0xd66b('0x2f')](db[_0xd66b('0x30')][_0xd66b('0x31')],function(_0x120a50){return{'name':_0x120a50['fieldName'],'type':_0x120a50[_0xd66b('0x32')][_0xd66b('0x33')]};});_0x14b269['model']=_['map'](_0x2b7ebd,_0xd66b('0x28'));_0x14b269[_0xd66b('0x34')]=_[_0xd66b('0x35')](_0x4a261a['query']);_0x14b269[_0xd66b('0x36')]=_[_0xd66b('0x37')](_0x14b269[_0xd66b('0x38')],_0x14b269[_0xd66b('0x34')]);_0x1e929b['attributes']=_[_0xd66b('0x37')](_0x14b269['model'],qs[_0xd66b('0x39')](_0x4a261a[_0xd66b('0x34')][_0xd66b('0x39')]));_0x1e929b['attributes']=_0x1e929b[_0xd66b('0x3a')][_0xd66b('0x3b')]?_0x1e929b[_0xd66b('0x3a')]:_0x14b269[_0xd66b('0x38')];if(!_0x4a261a[_0xd66b('0x34')]['hasOwnProperty'](_0xd66b('0x3c'))){_0x1e929b[_0xd66b('0x1a')]=qs['limit'](_0x4a261a[_0xd66b('0x34')][_0xd66b('0x1a')]);_0x1e929b[_0xd66b('0x18')]=qs[_0xd66b('0x18')](_0x4a261a[_0xd66b('0x34')][_0xd66b('0x18')]);}_0x1e929b[_0xd66b('0x3d')]=qs[_0xd66b('0x3e')](_0x4a261a[_0xd66b('0x34')][_0xd66b('0x3e')]);_0x1e929b[_0xd66b('0x3f')]=qs[_0xd66b('0x36')](_['pick'](_0x4a261a[_0xd66b('0x34')],_0x14b269[_0xd66b('0x36')]),_0x2b7ebd);if(_0x4a261a[_0xd66b('0x34')]['filter']){_0x1e929b['where']=_[_0xd66b('0x40')](_0x1e929b['where'],{'$or':_[_0xd66b('0x2f')](_0x2b7ebd,function(_0x329b0e){if(_0x329b0e[_0xd66b('0x32')]!==_0xd66b('0x41')){var _0x54ba92={};_0x54ba92[_0x329b0e[_0xd66b('0x28')]]={'$like':'%'+_0x4a261a[_0xd66b('0x34')]['filter']+'%'};return _0x54ba92;}})});}_0x1e929b=_['merge']({},_0x1e929b,_0x4a261a['options']);var _0x10cdd3={'where':_0x1e929b[_0xd66b('0x3f')]};return db[_0xd66b('0x30')][_0xd66b('0x1b')](_0x10cdd3)[_0xd66b('0x21')](function(_0x47cc0c){_0x47274f[_0xd66b('0x1b')]=_0x47cc0c;if(_0x4a261a[_0xd66b('0x34')][_0xd66b('0x42')]){_0x1e929b[_0xd66b('0x43')]=[{'all':!![]}];}return db[_0xd66b('0x30')][_0xd66b('0x44')](_0x1e929b);})[_0xd66b('0x21')](function(_0xebd94c){_0x47274f[_0xd66b('0x45')]=_0xebd94c;return _0x47274f;})[_0xd66b('0x21')](respondWithFilteredResult(_0x5c363b,_0x1e929b))['catch'](handleError(_0x5c363b,null));};exports[_0xd66b('0x46')]=function(_0x1e36ad,_0x336ba2){var _0x2835e4={'raw':!![],'where':{'id':_0x1e36ad[_0xd66b('0x47')]['id']}},_0x4a603b={};_0x4a603b['model']=_[_0xd66b('0x35')](db[_0xd66b('0x30')][_0xd66b('0x31')]);_0x4a603b[_0xd66b('0x34')]=_[_0xd66b('0x35')](_0x1e36ad['query']);_0x4a603b[_0xd66b('0x36')]=_['intersection'](_0x4a603b[_0xd66b('0x38')],_0x4a603b[_0xd66b('0x34')]);_0x2835e4[_0xd66b('0x3a')]=_[_0xd66b('0x37')](_0x4a603b[_0xd66b('0x38')],qs['fields'](_0x1e36ad['query']['fields']));_0x2835e4[_0xd66b('0x3a')]=_0x2835e4[_0xd66b('0x3a')][_0xd66b('0x3b')]?_0x2835e4[_0xd66b('0x3a')]:_0x4a603b[_0xd66b('0x38')];if(_0x1e36ad[_0xd66b('0x34')][_0xd66b('0x42')]){_0x2835e4[_0xd66b('0x43')]=[{'all':!![]}];}_0x2835e4=_[_0xd66b('0x40')]({},_0x2835e4,_0x1e36ad[_0xd66b('0x48')]);return db[_0xd66b('0x30')][_0xd66b('0x49')](_0x2835e4)['then'](handleEntityNotFound(_0x336ba2,null))[_0xd66b('0x21')](respondWithResult(_0x336ba2,null))[_0xd66b('0x4a')](handleError(_0x336ba2,null));};exports[_0xd66b('0x4b')]=function(_0x517e6a,_0x18a099){return db[_0xd66b('0x30')][_0xd66b('0x4b')](_0x517e6a[_0xd66b('0x4c')],{})[_0xd66b('0x21')](function(_0x104fd9){var _0x279e0e=_0x517e6a[_0xd66b('0x4d')][_0xd66b('0x4e')]({'plain':!![]});if(!_0x279e0e)throw new Error(_0xd66b('0x4f'));if(_0x279e0e['role']==='user'){var _0xd239db=_0x104fd9[_0xd66b('0x4e')]({'plain':!![]});var _0x15a1ed=_0xd66b('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x15a1ed,'userProfileId':_0x279e0e[_0xd66b('0x50')]},'raw':!![]})[_0xd66b('0x21')](function(_0x455eb4){if(_0x455eb4&&_0x455eb4['autoAssociation']===0x0){return db[_0xd66b('0x23')][_0xd66b('0x4b')]({'name':_0xd239db[_0xd66b('0x28')],'resourceId':_0xd239db['id'],'type':_0x455eb4[_0xd66b('0x28')],'sectionId':_0x455eb4['id']},{})['then'](function(){return _0x104fd9;});}else{return _0x104fd9;}})['catch'](function(_0x3c4860){logger[_0xd66b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c4860);throw _0x3c4860;});}return _0x104fd9;})[_0xd66b('0x21')](respondWithResult(_0x18a099,0xc9))[_0xd66b('0x4a')](handleError(_0x18a099,null));};exports[_0xd66b('0x20')]=function(_0x25768b,_0x5da090){if(_0x25768b[_0xd66b('0x4c')]['id']){delete _0x25768b[_0xd66b('0x4c')]['id'];}return db['CmHopperAdditionalPhone'][_0xd66b('0x49')]({'where':{'id':_0x25768b[_0xd66b('0x47')]['id']}})['then'](handleEntityNotFound(_0x5da090,null))[_0xd66b('0x21')](saveUpdates(_0x25768b[_0xd66b('0x4c')],null))[_0xd66b('0x21')](respondWithResult(_0x5da090,null))[_0xd66b('0x4a')](handleError(_0x5da090,null));};exports[_0xd66b('0x24')]=function(_0x43dc76,_0x310af1){return db['CmHopperAdditionalPhone'][_0xd66b('0x49')]({'where':{'id':_0x43dc76[_0xd66b('0x47')]['id']}})[_0xd66b('0x21')](handleEntityNotFound(_0x310af1,null))[_0xd66b('0x21')](removeEntity(_0x310af1,null))[_0xd66b('0x4a')](handleError(_0x310af1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index df74b4b..409b574 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca79=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x43ec95,_0x7d0644){var _0x54a880=function(_0x560d87){while(--_0x560d87){_0x43ec95['push'](_0x43ec95['shift']());}};_0x54a880(++_0x7d0644);}(_0xca79,0x185));var _0x9ca7=function(_0x53c34d,_0x39f4ba){_0x53c34d=_0x53c34d-0x0;var _0x47fa3f=_0xca79[_0x53c34d];return _0x47fa3f;};'use strict';var _=require(_0x9ca7('0x0'));var util=require(_0x9ca7('0x1'));var logger=require(_0x9ca7('0x2'))(_0x9ca7('0x3'));var moment=require('moment');var BPromise=require(_0x9ca7('0x4'));var rp=require(_0x9ca7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ca7('0x6'));var config=require(_0x9ca7('0x7'));var attributes=require(_0x9ca7('0x8'));module[_0x9ca7('0x9')]=function(_0x4a44f9,_0x2728dc){return _0x4a44f9[_0x9ca7('0xa')](_0x9ca7('0xb'),attributes,{'tableName':_0x9ca7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f58=['cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone'];(function(_0x5a287c,_0x2c73e0){var _0x49a27a=function(_0x3125ed){while(--_0x3125ed){_0x5a287c['push'](_0x5a287c['shift']());}};_0x49a27a(++_0x2c73e0);}(_0x2f58,0x9b));var _0x82f5=function(_0xaef0c3,_0xc4b2df){_0xaef0c3=_0xaef0c3-0x0;var _0x3d576e=_0x2f58[_0xaef0c3];return _0x3d576e;};'use strict';var _=require(_0x82f5('0x0'));var util=require(_0x82f5('0x1'));var logger=require(_0x82f5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x82f5('0x3'));var rp=require(_0x82f5('0x4'));var fs=require('fs');var path=require(_0x82f5('0x5'));var rimraf=require(_0x82f5('0x6'));var config=require(_0x82f5('0x7'));var attributes=require(_0x82f5('0x8'));module['exports']=function(_0x97f241,_0x5d99f8){return _0x97f241['define'](_0x82f5('0x9'),attributes,{'tableName':_0x82f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 81dd72b..9ca842a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6705=['../../config/utils','rpc','jayson/promise','client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','SwapAdditionalPhones','ListId','duration','waitTime','add','minutes','scheduledat','phone','countnoanswerretry','createdAt','updatedAt','isNil','additionalToHop','transaction','update','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x48deac,_0x4d8ab8){var _0x3b5eaa=function(_0x91c61e){while(--_0x91c61e){_0x48deac['push'](_0x48deac['shift']());}};_0x3b5eaa(++_0x4d8ab8);}(_0x6705,0x14a));var _0x5670=function(_0x5f433a,_0x2e6d64){_0x5f433a=_0x5f433a-0x0;var _0x2fd980=_0x6705[_0x5f433a];return _0x2fd980;};'use strict';var _=require(_0x5670('0x0'));var util=require('util');var moment=require(_0x5670('0x1'));var BPromise=require(_0x5670('0x2'));var rs=require(_0x5670('0x3'));var fs=require('fs');var Redis=require(_0x5670('0x4'));var db=require(_0x5670('0x5'))['db'];var utils=require(_0x5670('0x6'));var logger=require('../../config/logger')(_0x5670('0x7'));var config=require('../../config/environment');var jayson=require(_0x5670('0x8'));var client=jayson[_0x5670('0x9')][_0x5670('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1213dc,_0x303c05,_0x1af140){return new BPromise(function(_0x1d380d,_0x1cab62){return client[_0x5670('0xb')](_0x1213dc,_0x1af140)['then'](function(_0x532779){logger[_0x5670('0xc')](_0x5670('0xd'),_0x303c05,_0x5670('0xe'));logger[_0x5670('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x303c05,'request\x20sent',JSON[_0x5670('0x10')](_0x532779));if(_0x532779[_0x5670('0x11')]){if(_0x532779['error']['code']===0x1f4){logger[_0x5670('0x11')](_0x5670('0xd'),_0x303c05,_0x532779['error']['message']);return _0x1cab62(_0x532779[_0x5670('0x11')][_0x5670('0x12')]);}logger[_0x5670('0x11')](_0x5670('0xd'),_0x303c05,_0x532779[_0x5670('0x11')][_0x5670('0x12')]);return _0x1d380d(_0x532779[_0x5670('0x11')][_0x5670('0x12')]);}else{logger[_0x5670('0xc')](_0x5670('0xd'),_0x303c05,_0x5670('0xe'));_0x1d380d(_0x532779['result'][_0x5670('0x12')]);}})[_0x5670('0x13')](function(_0x2b98c0){logger[_0x5670('0x11')](_0x5670('0xd'),_0x303c05,_0x2b98c0);_0x1cab62(_0x2b98c0);});});}exports[_0x5670('0x14')]=function(_0x39ae3b){var _0x276df1=this;return new Promise(function(_0x22eea7,_0x214a28){return db[_0x5670('0x15')][_0x5670('0x16')]({'raw':!![],'where':{'ContactId':_0x39ae3b[_0x5670('0x17')][_0x5670('0x18')],'ListId':_0x39ae3b['body']['ListId'],'VoiceQueueId':_0x39ae3b[_0x5670('0x17')]['VoiceQueueId']===undefined?null:_0x39ae3b[_0x5670('0x17')][_0x5670('0x19')],'CampaignId':_0x39ae3b[_0x5670('0x17')][_0x5670('0x1a')]===undefined?null:_0x39ae3b[_0x5670('0x17')][_0x5670('0x1a')]}})[_0x5670('0x1b')](function(_0xfe3857){if(_0xfe3857!=null){return db['CmHopperAdditionalPhone'][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0xfe3857['id'],'OrderBy':{'$gt':_0xfe3857[_0x5670('0x1c')]}},'order':[[_0x5670('0x1c'),_0x5670('0x1d')]]})['then'](function(_0x8ef9f){var _0x32cb85=0x0;if(_0x8ef9f){if(_0x8ef9f[_0x5670('0x1e')]+_0x8ef9f['countcongestionretry']+_0x8ef9f['countnoanswerretry']+_0x8ef9f[_0x5670('0x1f')]+_0x8ef9f[_0x5670('0x20')]+_0x8ef9f[_0x5670('0x21')]+_0x8ef9f[_0x5670('0x22')]+_0x8ef9f[_0x5670('0x23')]<_0x39ae3b[_0x5670('0x24')][_0x5670('0x25')])_0x32cb85=0x1;_0x22eea7({'additional':_0x32cb85});}else{return db[_0x5670('0x26')][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0xfe3857['id']},'order':[[_0x5670('0x1c'),_0x5670('0x1d')]]})[_0x5670('0x1b')](function(_0x25d3b3){var _0x1c2acb=0x0;if(_0x25d3b3){if(_0x25d3b3[_0x5670('0x1e')]+_0x25d3b3[_0x5670('0x27')]+_0x25d3b3['countnoanswerretry']+_0x25d3b3[_0x5670('0x1f')]+_0x25d3b3['countdropretry']+_0x25d3b3[_0x5670('0x21')]+_0x25d3b3['countmachineretry']+_0x25d3b3[_0x5670('0x23')]<_0x39ae3b[_0x5670('0x24')][_0x5670('0x25')])_0x1c2acb=0x1;_0x22eea7({'additional':_0x1c2acb});}else{_0x22eea7({'additional':0x0});}})['catch'](function(_0xee9fd5){logger[_0x5670('0x11')]('VerifyAdditionalPhones',_0xee9fd5[_0x5670('0x12')],_0x39ae3b);_0x214a28(_0x276df1['error'](0x1f4,_0xee9fd5[_0x5670('0x12')]));});}})[_0x5670('0x13')](function(_0x10a8b6){logger['error']('VerifyAdditionalPhones',_0x10a8b6[_0x5670('0x12')],_0x39ae3b);_0x214a28(_0x276df1[_0x5670('0x11')](0x1f4,_0x10a8b6[_0x5670('0x12')]));});}else _0x22eea7({'additional':0x0});});});};exports[_0x5670('0x28')]=function(_0x2cb704){var _0x5b6a6f=this;return new Promise(function(_0x56d348,_0x2c3097){return db[_0x5670('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x2cb704[_0x5670('0x17')][_0x5670('0x18')],'ListId':_0x2cb704[_0x5670('0x17')][_0x5670('0x29')],'VoiceQueueId':_0x2cb704[_0x5670('0x17')][_0x5670('0x19')]===undefined?null:_0x2cb704[_0x5670('0x17')]['VoiceQueueId'],'CampaignId':_0x2cb704[_0x5670('0x17')][_0x5670('0x1a')]===undefined?null:_0x2cb704[_0x5670('0x17')]['CampaignId']}})[_0x5670('0x1b')](function(_0x561739){if(_0x561739!=null){return db['CmHopperAdditionalPhone'][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0x561739['id'],'OrderBy':{'$gt':_0x561739['OrderBy']}},'order':[['OrderBy',_0x5670('0x1d')]]})[_0x5670('0x1b')](function(_0x22937d){if(_0x22937d)return activateAdditionalPhone(_0x561739,_0x2cb704[_0x5670('0x17')],_0x22937d,_0x2cb704[_0x5670('0x2a')],_0x2cb704[_0x5670('0x2b')])['then'](function(_0xefa4a1){_0x56d348(_0xefa4a1);});else{return db[_0x5670('0x26')][_0x5670('0x16')]({'raw':!![],'where':{'CmHopperId':_0x561739['id']},'order':[[_0x5670('0x1c'),'ASC']]})[_0x5670('0x1b')](function(_0x2efefa){if(_0x2efefa)return activateAdditionalPhone(_0x561739,_0x2cb704[_0x5670('0x17')],_0x2efefa,_0x2cb704[_0x5670('0x2a')],_0x2cb704['waitTime'])['then'](function(_0x975214){_0x56d348(_0x975214);});else{_0x56d348({'id':_0x561739['id'],'phone':''});}})[_0x5670('0x13')](function(_0xe6c4a6){logger[_0x5670('0x11')](_0x5670('0x14'),_0xe6c4a6[_0x5670('0x12')],_0x2cb704);_0x2c3097(_0x5b6a6f[_0x5670('0x11')](0x1f4,_0xe6c4a6['message']));});}})['catch'](function(_0x758362){logger[_0x5670('0x11')](_0x5670('0x14'),_0x758362[_0x5670('0x12')],_0x2cb704);_0x2c3097(_0x5b6a6f[_0x5670('0x11')](0x1f4,_0x758362[_0x5670('0x12')]));});}else _0x56d348(0x1);});});};function activateAdditionalPhone(_0x54acd6,_0xaba4e3,_0x181f0d,_0x3830be,_0x2ec023){return new Promise(function(_0x264459,_0x17b6ea){logger[_0x5670('0xc')](_0x5670('0x14'),_0x181f0d);var _0x466401;if(moment()>moment(_0x181f0d['scheduledat'])){_0x466401=moment()[_0x5670('0x2c')](_0x2ec023||0x3,_0x5670('0x2d'));}else{if(_0x181f0d[_0x5670('0x1c')]==0x0){_0x466401=moment(_0x181f0d[_0x5670('0x2e')]);}else{_0x466401=moment()[_0x5670('0x2c')](_0x2ec023||0x3,_0x5670('0x2d'));}}var _0x4579fd={'phone':_0x54acd6[_0x5670('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x54acd6[_0x5670('0x1c')])?0x0:_0x54acd6[_0x5670('0x1c')],'scheduledat':moment()[_0x5670('0x2c')](_0x3830be||0x1,_0x5670('0x2d')),'countbusyretry':_0xaba4e3['countbusyretry'],'countcongestionretry':_0xaba4e3[_0x5670('0x27')],'countnoanswerretry':_0xaba4e3[_0x5670('0x30')],'countnosuchnumberretry':_0xaba4e3[_0x5670('0x1f')],'countdropretry':_0xaba4e3[_0x5670('0x20')],'countabandonedretry':_0xaba4e3[_0x5670('0x21')],'countmachineretry':_0xaba4e3[_0x5670('0x22')],'countagentrejectretry':_0xaba4e3['countagentrejectretry'],'createdAt':_0xaba4e3[_0x5670('0x31')],'updatedAt':_0xaba4e3[_0x5670('0x32')]};var _0x95c8b8={'CmHopperId':_0x54acd6['id'],'phone':_0x181f0d['phone'],'active':0x0,'OrderBy':_[_0x5670('0x33')](_0x181f0d[_0x5670('0x1c')])?0x0:_0x181f0d[_0x5670('0x1c')],'scheduledat':_0x466401,'countbusyretry':_0x181f0d[_0x5670('0x1e')],'countcongestionretry':_0x181f0d[_0x5670('0x27')],'countnoanswerretry':_0x181f0d[_0x5670('0x30')],'countnosuchnumberretry':_0xaba4e3[_0x5670('0x1f')],'countdropretry':_0xaba4e3[_0x5670('0x20')],'countabandonedretry':_0xaba4e3[_0x5670('0x21')],'countmachineretry':_0xaba4e3['countmachineretry'],'countagentrejectretry':_0xaba4e3[_0x5670('0x23')],'createdAt':_0x181f0d[_0x5670('0x31')],'updatedAt':_0x181f0d['updatedAt']};logger[_0x5670('0xc')]('hopperToAdd',_0x4579fd);logger[_0x5670('0xc')](_0x5670('0x34'),_0x95c8b8);return db['sequelize'][_0x5670('0x35')](function(_0x46e9d3){return db[_0x5670('0x26')][_0x5670('0x36')](_0x4579fd,{'where':{'id':_0x181f0d['id']}},{'transaction':_0x46e9d3})[_0x5670('0x1b')](function(){return db[_0x5670('0x15')][_0x5670('0x36')](_0x95c8b8,{'where':{'id':_0x54acd6['id']}},{'transaction':_0x46e9d3});});})[_0x5670('0x1b')](function(_0x26c3dc){_0x264459({'id':_0x54acd6['id'],'phone':_0x181f0d[_0x5670('0x2f')]});})[_0x5670('0x13')](function(_0x5c03f7){logger[_0x5670('0x11')](_0x5670('0x14'),_0x5c03f7[_0x5670('0x12')],req);_0x17b6ea(_this[_0x5670('0x11')](0x1f4,_0x5c03f7[_0x5670('0x12')]));});});}exports['IncrementPreviewCounters']=function(_0x410797){var _0x32079e=this;return new Promise(function(_0x5da997,_0x533817){return db[_0x5670('0x15')][_0x5670('0x36')](_0x410797[_0x5670('0x17')]['field'],{'where':{'id':_0x410797[_0x5670('0x17')]['id']}})[_0x5670('0x1b')](function(_0xf85db4){_0x5da997(_0xf85db4);})[_0x5670('0x13')](function(_0x5cce2d){logger[_0x5670('0x11')](_0x5670('0x37'),_0x5cce2d['message'],_0x410797);_0x533817(_0x32079e['error'](0x1f4,_0x5cce2d[_0x5670('0x12')]));});});}; \ No newline at end of file +var _0x25d5=['then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','error','message','info','request\x20sent','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','countnosuchnumberretry','catch','ASC','duration','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','hopperToAdd','sequelize','update','IncrementPreviewCounters','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1deeb7,_0x5b1b34){var _0x3ec5d2=function(_0x258904){while(--_0x258904){_0x1deeb7['push'](_0x1deeb7['shift']());}};_0x3ec5d2(++_0x5b1b34);}(_0x25d5,0x91));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x525d('0x0'));var util=require('util');var moment=require(_0x525d('0x1'));var BPromise=require('bluebird');var rs=require(_0x525d('0x2'));var fs=require('fs');var Redis=require(_0x525d('0x3'));var db=require(_0x525d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x525d('0x5'))(_0x525d('0x6'));var config=require(_0x525d('0x7'));var jayson=require(_0x525d('0x8'));var client=jayson['client'][_0x525d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x273141,_0x1a0233,_0x260f76){return new BPromise(function(_0x289b02,_0x119257){return client[_0x525d('0xa')](_0x273141,_0x260f76)[_0x525d('0xb')](function(_0x127ecf){logger['info'](_0x525d('0xc'),_0x1a0233,'request\x20sent');logger[_0x525d('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1a0233,'request\x20sent',JSON['stringify'](_0x127ecf));if(_0x127ecf[_0x525d('0xe')]){if(_0x127ecf[_0x525d('0xe')]['code']===0x1f4){logger[_0x525d('0xe')](_0x525d('0xc'),_0x1a0233,_0x127ecf[_0x525d('0xe')]['message']);return _0x119257(_0x127ecf[_0x525d('0xe')][_0x525d('0xf')]);}logger[_0x525d('0xe')](_0x525d('0xc'),_0x1a0233,_0x127ecf['error'][_0x525d('0xf')]);return _0x289b02(_0x127ecf[_0x525d('0xe')][_0x525d('0xf')]);}else{logger[_0x525d('0x10')](_0x525d('0xc'),_0x1a0233,_0x525d('0x11'));_0x289b02(_0x127ecf[_0x525d('0x12')][_0x525d('0xf')]);}})['catch'](function(_0x51dfca){logger[_0x525d('0xe')](_0x525d('0xc'),_0x1a0233,_0x51dfca);_0x119257(_0x51dfca);});});}exports[_0x525d('0x13')]=function(_0x2321ea){var _0x8abf8c=this;return new Promise(function(_0x849052,_0x53325b){return db[_0x525d('0x14')][_0x525d('0x15')]({'raw':!![],'where':{'ContactId':_0x2321ea[_0x525d('0x16')][_0x525d('0x17')],'ListId':_0x2321ea[_0x525d('0x16')][_0x525d('0x18')],'VoiceQueueId':_0x2321ea['body'][_0x525d('0x19')]===undefined?null:_0x2321ea['body']['VoiceQueueId'],'CampaignId':_0x2321ea['body'][_0x525d('0x1a')]===undefined?null:_0x2321ea['body'][_0x525d('0x1a')]}})[_0x525d('0xb')](function(_0x5f1319){if(_0x5f1319!=null){return db[_0x525d('0x1b')][_0x525d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5f1319['id'],'OrderBy':{'$gt':_0x5f1319['OrderBy']}},'order':[[_0x525d('0x1c'),'ASC']]})['then'](function(_0x45ea09){var _0x3ec829=0x0;if(_0x45ea09){if(_0x45ea09['countbusyretry']+_0x45ea09['countcongestionretry']+_0x45ea09[_0x525d('0x1d')]+_0x45ea09['countnosuchnumberretry']+_0x45ea09[_0x525d('0x1e')]+_0x45ea09[_0x525d('0x1f')]+_0x45ea09[_0x525d('0x20')]+_0x45ea09[_0x525d('0x21')]<_0x2321ea[_0x525d('0x22')][_0x525d('0x23')])_0x3ec829=0x1;_0x849052({'additional':_0x3ec829});}else{return db[_0x525d('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f1319['id']},'order':[[_0x525d('0x1c'),'ASC']]})[_0x525d('0xb')](function(_0x1aaf92){var _0x512d9f=0x0;if(_0x1aaf92){if(_0x1aaf92['countbusyretry']+_0x1aaf92[_0x525d('0x24')]+_0x1aaf92['countnoanswerretry']+_0x1aaf92[_0x525d('0x25')]+_0x1aaf92[_0x525d('0x1e')]+_0x1aaf92[_0x525d('0x1f')]+_0x1aaf92[_0x525d('0x20')]+_0x1aaf92['countagentrejectretry']<_0x2321ea['entity'][_0x525d('0x23')])_0x512d9f=0x1;_0x849052({'additional':_0x512d9f});}else{_0x849052({'additional':0x0});}})[_0x525d('0x26')](function(_0x1f10bd){logger[_0x525d('0xe')](_0x525d('0x13'),_0x1f10bd[_0x525d('0xf')],_0x2321ea);_0x53325b(_0x8abf8c[_0x525d('0xe')](0x1f4,_0x1f10bd[_0x525d('0xf')]));});}})[_0x525d('0x26')](function(_0x5b345a){logger[_0x525d('0xe')]('VerifyAdditionalPhones',_0x5b345a[_0x525d('0xf')],_0x2321ea);_0x53325b(_0x8abf8c['error'](0x1f4,_0x5b345a[_0x525d('0xf')]));});}else _0x849052({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x13dd7b){var _0xef8484=this;return new Promise(function(_0x37827c,_0x55c026){return db['CmHopper'][_0x525d('0x15')]({'raw':!![],'where':{'ContactId':_0x13dd7b[_0x525d('0x16')][_0x525d('0x17')],'ListId':_0x13dd7b[_0x525d('0x16')][_0x525d('0x18')],'VoiceQueueId':_0x13dd7b[_0x525d('0x16')]['VoiceQueueId']===undefined?null:_0x13dd7b[_0x525d('0x16')][_0x525d('0x19')],'CampaignId':_0x13dd7b[_0x525d('0x16')][_0x525d('0x1a')]===undefined?null:_0x13dd7b[_0x525d('0x16')][_0x525d('0x1a')]}})[_0x525d('0xb')](function(_0x2522ab){if(_0x2522ab!=null){return db[_0x525d('0x1b')][_0x525d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2522ab['id'],'OrderBy':{'$gt':_0x2522ab['OrderBy']}},'order':[[_0x525d('0x1c'),_0x525d('0x27')]]})[_0x525d('0xb')](function(_0x45fd5c){if(_0x45fd5c)return activateAdditionalPhone(_0x2522ab,_0x13dd7b[_0x525d('0x16')],_0x45fd5c,_0x13dd7b[_0x525d('0x28')],_0x13dd7b[_0x525d('0x29')])['then'](function(_0x2dbaf3){_0x37827c(_0x2dbaf3);});else{return db[_0x525d('0x1b')][_0x525d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2522ab['id']},'order':[[_0x525d('0x1c'),_0x525d('0x27')]]})[_0x525d('0xb')](function(_0x8eadaf){if(_0x8eadaf)return activateAdditionalPhone(_0x2522ab,_0x13dd7b[_0x525d('0x16')],_0x8eadaf,_0x13dd7b[_0x525d('0x28')],_0x13dd7b[_0x525d('0x29')])[_0x525d('0xb')](function(_0x557684){_0x37827c(_0x557684);});else{_0x37827c({'id':_0x2522ab['id'],'phone':''});}})[_0x525d('0x26')](function(_0x471566){logger['error'](_0x525d('0x13'),_0x471566[_0x525d('0xf')],_0x13dd7b);_0x55c026(_0xef8484[_0x525d('0xe')](0x1f4,_0x471566[_0x525d('0xf')]));});}})['catch'](function(_0x5adad8){logger[_0x525d('0xe')](_0x525d('0x13'),_0x5adad8['message'],_0x13dd7b);_0x55c026(_0xef8484[_0x525d('0xe')](0x1f4,_0x5adad8[_0x525d('0xf')]));});}else _0x37827c(0x1);});});};function activateAdditionalPhone(_0x3b96d4,_0x3e4aed,_0x5985cd,_0x1d4dcf,_0x32df07){return new Promise(function(_0x11a0f9,_0x56ddff){logger['info']('VerifyAdditionalPhones',_0x5985cd);var _0x5b51d4;if(moment()>moment(_0x5985cd[_0x525d('0x2a')])){_0x5b51d4=moment()[_0x525d('0x2b')](_0x32df07||0x3,_0x525d('0x2c'));}else{if(_0x5985cd[_0x525d('0x1c')]==0x0){_0x5b51d4=moment(_0x5985cd[_0x525d('0x2a')]);}else{_0x5b51d4=moment()[_0x525d('0x2b')](_0x32df07||0x3,'minutes');}}var _0x3ec20d={'phone':_0x3b96d4[_0x525d('0x2d')],'active':0x0,'OrderBy':_[_0x525d('0x2e')](_0x3b96d4[_0x525d('0x1c')])?0x0:_0x3b96d4[_0x525d('0x1c')],'scheduledat':moment()['add'](_0x1d4dcf||0x1,_0x525d('0x2c')),'countbusyretry':_0x3e4aed['countbusyretry'],'countcongestionretry':_0x3e4aed[_0x525d('0x24')],'countnoanswerretry':_0x3e4aed[_0x525d('0x1d')],'countnosuchnumberretry':_0x3e4aed[_0x525d('0x25')],'countdropretry':_0x3e4aed['countdropretry'],'countabandonedretry':_0x3e4aed[_0x525d('0x1f')],'countmachineretry':_0x3e4aed['countmachineretry'],'countagentrejectretry':_0x3e4aed[_0x525d('0x21')],'createdAt':_0x3e4aed['createdAt'],'updatedAt':_0x3e4aed[_0x525d('0x2f')]};var _0x453af9={'CmHopperId':_0x3b96d4['id'],'phone':_0x5985cd[_0x525d('0x2d')],'active':0x0,'OrderBy':_[_0x525d('0x2e')](_0x5985cd['OrderBy'])?0x0:_0x5985cd['OrderBy'],'scheduledat':_0x5b51d4,'countbusyretry':_0x5985cd['countbusyretry'],'countcongestionretry':_0x5985cd[_0x525d('0x24')],'countnoanswerretry':_0x5985cd[_0x525d('0x1d')],'countnosuchnumberretry':_0x3e4aed[_0x525d('0x25')],'countdropretry':_0x3e4aed[_0x525d('0x1e')],'countabandonedretry':_0x3e4aed[_0x525d('0x1f')],'countmachineretry':_0x3e4aed[_0x525d('0x20')],'countagentrejectretry':_0x3e4aed[_0x525d('0x21')],'createdAt':_0x5985cd['createdAt'],'updatedAt':_0x5985cd['updatedAt']};logger[_0x525d('0x10')](_0x525d('0x30'),_0x3ec20d);logger['info']('additionalToHop',_0x453af9);return db[_0x525d('0x31')]['transaction'](function(_0x4a7a5b){return db[_0x525d('0x1b')][_0x525d('0x32')](_0x3ec20d,{'where':{'id':_0x5985cd['id']}},{'transaction':_0x4a7a5b})[_0x525d('0xb')](function(){return db[_0x525d('0x14')][_0x525d('0x32')](_0x453af9,{'where':{'id':_0x3b96d4['id']}},{'transaction':_0x4a7a5b});});})[_0x525d('0xb')](function(_0x3175f9){_0x11a0f9({'id':_0x3b96d4['id'],'phone':_0x5985cd[_0x525d('0x2d')]});})['catch'](function(_0x27ae1f){logger[_0x525d('0xe')](_0x525d('0x13'),_0x27ae1f['message'],req);_0x56ddff(_this[_0x525d('0xe')](0x1f4,_0x27ae1f[_0x525d('0xf')]));});});}exports[_0x525d('0x33')]=function(_0x5a709b){var _0x3533d8=this;return new Promise(function(_0x56c48f,_0x29016b){return db[_0x525d('0x14')][_0x525d('0x32')](_0x5a709b[_0x525d('0x16')]['field'],{'where':{'id':_0x5a709b[_0x525d('0x16')]['id']}})[_0x525d('0xb')](function(_0x3e0885){_0x56c48f(_0x3e0885);})[_0x525d('0x26')](function(_0x4d1799){logger[_0x525d('0xe')](_0x525d('0x33'),_0x4d1799[_0x525d('0xf')],_0x5a709b);_0x29016b(_0x3533d8[_0x525d('0xe')](0x1f4,_0x4d1799[_0x525d('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 9d8d245..1e00c7c 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa244=['../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3aeb13,_0x3c5496){var _0x97f334=function(_0x52ed42){while(--_0x52ed42){_0x3aeb13['push'](_0x3aeb13['shift']());}};_0x97f334(++_0x3c5496);}(_0xa244,0xa4));var _0x4a24=function(_0x2ceb8e,_0x19ba8e){_0x2ceb8e=_0x2ceb8e-0x0;var _0xe283bb=_0xa244[_0x2ceb8e];return _0xe283bb;};'use strict';var multer=require(_0x4a24('0x0'));var util=require(_0x4a24('0x1'));var path=require(_0x4a24('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a24('0x3'));var router=express[_0x4a24('0x4')]();var fs_extra=require(_0x4a24('0x5'));var auth=require(_0x4a24('0x6'));var interaction=require(_0x4a24('0x7'));var config=require('../../config/environment');var controller=require(_0x4a24('0x8'));router[_0x4a24('0x9')]('/',auth[_0x4a24('0xa')](),controller[_0x4a24('0xb')]);router[_0x4a24('0x9')](_0x4a24('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4a24('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4a24('0xc'),auth[_0x4a24('0xa')](),controller[_0x4a24('0xe')]);router['delete']('/:id',auth[_0x4a24('0xa')](),controller[_0x4a24('0xf')]);module[_0x4a24('0x10')]=router; \ No newline at end of file +var _0x3c84=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4575db,_0x505dab){var _0x3bad6f=function(_0x356eca){while(--_0x356eca){_0x4575db['push'](_0x4575db['shift']());}};_0x3bad6f(++_0x505dab);}(_0x3c84,0x175));var _0x43c8=function(_0x343c26,_0x52ec0f){_0x343c26=_0x343c26-0x0;var _0x57771d=_0x3c84[_0x343c26];return _0x57771d;};'use strict';var multer=require(_0x43c8('0x0'));var util=require(_0x43c8('0x1'));var path=require(_0x43c8('0x2'));var timeout=require('connect-timeout');var express=require(_0x43c8('0x3'));var router=express[_0x43c8('0x4')]();var fs_extra=require(_0x43c8('0x5'));var auth=require(_0x43c8('0x6'));var interaction=require(_0x43c8('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router[_0x43c8('0x8')]('/',auth[_0x43c8('0x9')](),controller[_0x43c8('0xa')]);router[_0x43c8('0x8')](_0x43c8('0xb'),auth[_0x43c8('0x9')](),controller[_0x43c8('0xc')]);router[_0x43c8('0xd')]('/',auth[_0x43c8('0x9')](),controller['create']);router[_0x43c8('0xe')](_0x43c8('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x43c8('0xf')](_0x43c8('0xb'),auth['isAuthenticated'](),controller[_0x43c8('0x10')]);module[_0x43c8('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a5afac3..1728213 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.attributes.js +++ b/server/api/cmHopperBlack/cmHopperBlack.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7b9=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa7b9,0x7c));var _0x9a7b=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xa7b9[_0x266618];return _0x54dbf5;};'use strict';var moment=require(_0x9a7b('0x0'));var Sequelize=require(_0x9a7b('0x1'));module[_0x9a7b('0x2')]={'phone':{'type':Sequelize[_0x9a7b('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9a7b('0x4')],'unique':_0x9a7b('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9a7b('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9a7b('0x4')],'unique':_0x9a7b('0x5')}}; \ No newline at end of file +var _0xb994=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb994,0xd6));var _0x4b99=function(_0x451e46,_0x43d53b){_0x451e46=_0x451e46-0x0;var _0x4338e2=_0xb994[_0x451e46];return _0x4338e2;};'use strict';var moment=require(_0x4b99('0x0'));var Sequelize=require('sequelize');module[_0x4b99('0x1')]={'phone':{'type':Sequelize[_0x4b99('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4b99('0x3')],'unique':_0x4b99('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4b99('0x4')},'VoiceQueueId':{'type':Sequelize[_0x4b99('0x3')],'unique':_0x4b99('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 285cbed..39f2ae0 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf70f=['type','VIRTUAL','options','CmHopperBlack','includeAll','include','rows','catch','show','params','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','end','error','stack','name','send','render','contact','message','agent','interaction','account','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge'];(function(_0x308d28,_0x1eb3f9){var _0x3a150f=function(_0x58fbc3){while(--_0x58fbc3){_0x308d28['push'](_0x308d28['shift']());}};_0x3a150f(++_0x1eb3f9);}(_0xf70f,0x194));var _0xff70=function(_0x1e08fa,_0x2177b8){_0x1e08fa=_0x1e08fa-0x0;var _0x48a80f=_0xf70f[_0x1e08fa];return _0x48a80f;};'use strict';var emlformat=require(_0xff70('0x0'));var rimraf=require(_0xff70('0x1'));var zipdir=require(_0xff70('0x2'));var jsonpatch=require(_0xff70('0x3'));var rp=require('request-promise');var moment=require(_0xff70('0x4'));var BPromise=require(_0xff70('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xff70('0x6'));var sox=require(_0xff70('0x7'));var csv=require(_0xff70('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff70('0x9'));var _=require(_0xff70('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xff70('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xff70('0x8'));var querystring=require(_0xff70('0xc'));var Papa=require(_0xff70('0xd'));var Redis=require(_0xff70('0xe'));var authService=require(_0xff70('0xf'));var qs=require(_0xff70('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff70('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xff70('0x12'));var config=require(_0xff70('0x13'));var licenseUtil=require(_0xff70('0x14'));var db=require(_0xff70('0x15'))['db'];function respondWithStatusCode(_0x34ed3a,_0x29a42e){_0x29a42e=_0x29a42e||0xcc;return function(_0x32b59e){if(_0x32b59e){return _0x34ed3a[_0xff70('0x16')](_0x29a42e);}return _0x34ed3a[_0xff70('0x17')](_0x29a42e)['end']();};}function respondWithResult(_0x19dcd1,_0x35b778){_0x35b778=_0x35b778||0xc8;return function(_0x4902db){if(_0x4902db){return _0x19dcd1[_0xff70('0x17')](_0x35b778)['json'](_0x4902db);}};}function respondWithFilteredResult(_0x2a13c5,_0xdaeeac){return function(_0x5d40ea){if(_0x5d40ea){var _0x517558=typeof _0xdaeeac[_0xff70('0x18')]===_0xff70('0x19')&&typeof _0xdaeeac[_0xff70('0x1a')]===_0xff70('0x19');var _0xa8f578=_0x5d40ea[_0xff70('0x1b')];var _0x3a8bb1=_0x517558?0x0:_0xdaeeac['offset'];var _0x1100b5=_0x517558?_0x5d40ea[_0xff70('0x1b')]:_0xdaeeac[_0xff70('0x18')]+_0xdaeeac[_0xff70('0x1a')];var _0x3629e4;if(_0x1100b5>=_0xa8f578){_0x1100b5=_0xa8f578;_0x3629e4=0xc8;}else{_0x3629e4=0xce;}_0x2a13c5[_0xff70('0x17')](_0x3629e4);return _0x2a13c5[_0xff70('0x1c')](_0xff70('0x1d'),_0x3a8bb1+'-'+_0x1100b5+'/'+_0xa8f578)['json'](_0x5d40ea);}return null;};}function patchUpdates(_0x748121){return function(_0x1c6de0){try{jsonpatch[_0xff70('0x1e')](_0x1c6de0,_0x748121,!![]);}catch(_0x33606b){return BPromise[_0xff70('0x1f')](_0x33606b);}return _0x1c6de0['save']();};}function saveUpdates(_0x499c40,_0x218cba){return function(_0x4291a3){if(_0x4291a3){return _0x4291a3['update'](_0x499c40)['then'](function(_0x3fcc69){return _0x3fcc69;});}return null;};}function removeEntity(_0x1414ff,_0x5eb694){return function(_0x49361e){if(_0x49361e){return _0x49361e['destroy']()[_0xff70('0x20')](function(){_0x1414ff[_0xff70('0x17')](0xcc)[_0xff70('0x21')]();});}};}function handleEntityNotFound(_0x109d2c,_0x1c9ecf){return function(_0x348074){if(!_0x348074){_0x109d2c[_0xff70('0x16')](0x194);}return _0x348074;};}function handleError(_0x179054,_0x523580){_0x523580=_0x523580||0x1f4;return function(_0x39bd6b){logger[_0xff70('0x22')](_0x39bd6b[_0xff70('0x23')]);if(_0x39bd6b[_0xff70('0x24')]){delete _0x39bd6b[_0xff70('0x24')];}_0x179054[_0xff70('0x17')](_0x523580)[_0xff70('0x25')](_0x39bd6b);};}function getMustacheRender(_0x44046f,_0xc5b289){return Mustache[_0xff70('0x26')](_0x44046f,_['merge'](_0xc5b289['body'],{'contact':_0xc5b289[_0xff70('0x27')],'message':_0xc5b289[_0xff70('0x28')],'agent':_0xc5b289[_0xff70('0x29')],'interaction':_0xc5b289[_0xff70('0x2a')],'account':_0xc5b289[_0xff70('0x2b')]}))||'';}exports[_0xff70('0x2c')]=function(_0x4261a4,_0x55dc03){var _0x1edbc1={},_0x4db6d3={},_0x144e54={'count':0x0,'rows':[]};var _0x5b76c5=_[_0xff70('0x2d')](db['CmHopperBlack'][_0xff70('0x2e')],function(_0xfc5846){return{'name':_0xfc5846[_0xff70('0x2f')],'type':_0xfc5846['type'][_0xff70('0x30')]};});_0x4db6d3[_0xff70('0x31')]=_['map'](_0x5b76c5,'name');_0x4db6d3[_0xff70('0x32')]=_[_0xff70('0x33')](_0x4261a4[_0xff70('0x32')]);_0x4db6d3['filters']=_['intersection'](_0x4db6d3[_0xff70('0x31')],_0x4db6d3[_0xff70('0x32')]);_0x1edbc1[_0xff70('0x34')]=_[_0xff70('0x35')](_0x4db6d3['model'],qs['fields'](_0x4261a4['query'][_0xff70('0x36')]));_0x1edbc1[_0xff70('0x34')]=_0x1edbc1[_0xff70('0x34')][_0xff70('0x37')]?_0x1edbc1[_0xff70('0x34')]:_0x4db6d3[_0xff70('0x31')];if(!_0x4261a4['query'][_0xff70('0x38')]('nolimit')){_0x1edbc1[_0xff70('0x1a')]=qs[_0xff70('0x1a')](_0x4261a4[_0xff70('0x32')][_0xff70('0x1a')]);_0x1edbc1['offset']=qs['offset'](_0x4261a4[_0xff70('0x32')][_0xff70('0x18')]);}_0x1edbc1[_0xff70('0x39')]=qs[_0xff70('0x3a')](_0x4261a4['query'][_0xff70('0x3a')]);_0x1edbc1[_0xff70('0x3b')]=qs[_0xff70('0x3c')](_[_0xff70('0x3d')](_0x4261a4['query'],_0x4db6d3[_0xff70('0x3c')]),_0x5b76c5);if(_0x4261a4[_0xff70('0x32')][_0xff70('0x3e')]){_0x1edbc1[_0xff70('0x3b')]=_[_0xff70('0x3f')](_0x1edbc1[_0xff70('0x3b')],{'$or':_[_0xff70('0x2d')](_0x5b76c5,function(_0x27c9b2){if(_0x27c9b2[_0xff70('0x40')]!==_0xff70('0x41')){var _0x4533e9={};_0x4533e9[_0x27c9b2[_0xff70('0x24')]]={'$like':'%'+_0x4261a4['query'][_0xff70('0x3e')]+'%'};return _0x4533e9;}})});}_0x1edbc1=_['merge']({},_0x1edbc1,_0x4261a4[_0xff70('0x42')]);var _0x5d0f0b={'where':_0x1edbc1['where']};return db[_0xff70('0x43')][_0xff70('0x1b')](_0x5d0f0b)[_0xff70('0x20')](function(_0x3c621f){_0x144e54[_0xff70('0x1b')]=_0x3c621f;if(_0x4261a4[_0xff70('0x32')][_0xff70('0x44')]){_0x1edbc1[_0xff70('0x45')]=[{'all':!![]}];}return db[_0xff70('0x43')]['findAll'](_0x1edbc1);})['then'](function(_0x3d9678){_0x144e54[_0xff70('0x46')]=_0x3d9678;return _0x144e54;})[_0xff70('0x20')](respondWithFilteredResult(_0x55dc03,_0x1edbc1))[_0xff70('0x47')](handleError(_0x55dc03,null));};exports[_0xff70('0x48')]=function(_0x1faae5,_0x1ac031){var _0x30c6a7={'raw':!![],'where':{'id':_0x1faae5[_0xff70('0x49')]['id']}},_0x2db861={};_0x2db861[_0xff70('0x31')]=_[_0xff70('0x33')](db[_0xff70('0x43')][_0xff70('0x2e')]);_0x2db861[_0xff70('0x32')]=_[_0xff70('0x33')](_0x1faae5['query']);_0x2db861[_0xff70('0x3c')]=_[_0xff70('0x35')](_0x2db861[_0xff70('0x31')],_0x2db861[_0xff70('0x32')]);_0x30c6a7[_0xff70('0x34')]=_['intersection'](_0x2db861[_0xff70('0x31')],qs[_0xff70('0x36')](_0x1faae5[_0xff70('0x32')][_0xff70('0x36')]));_0x30c6a7[_0xff70('0x34')]=_0x30c6a7[_0xff70('0x34')]['length']?_0x30c6a7[_0xff70('0x34')]:_0x2db861[_0xff70('0x31')];if(_0x1faae5['query'][_0xff70('0x44')]){_0x30c6a7[_0xff70('0x45')]=[{'all':!![]}];}_0x30c6a7=_[_0xff70('0x3f')]({},_0x30c6a7,_0x1faae5[_0xff70('0x42')]);return db['CmHopperBlack'][_0xff70('0x4a')](_0x30c6a7)['then'](handleEntityNotFound(_0x1ac031,null))[_0xff70('0x20')](respondWithResult(_0x1ac031,null))['catch'](handleError(_0x1ac031,null));};exports[_0xff70('0x4b')]=function(_0x1ca329,_0x42aa66){if(_0x1ca329[_0xff70('0x4c')]['id']){delete _0x1ca329[_0xff70('0x4c')]['id'];}return db[_0xff70('0x43')][_0xff70('0x4a')]({'where':{'id':_0x1ca329[_0xff70('0x49')]['id']}})[_0xff70('0x20')](handleEntityNotFound(_0x42aa66,null))[_0xff70('0x20')](saveUpdates(_0x1ca329['body'],null))[_0xff70('0x20')](respondWithResult(_0x42aa66,null))[_0xff70('0x47')](handleError(_0x42aa66,null));};exports['destroy']=function(_0x1472e0,_0x546ead){return db['CmHopperBlack'][_0xff70('0x4a')]({'where':{'id':_0x1472e0['params']['id']}})[_0xff70('0x20')](handleEntityNotFound(_0x546ead,null))[_0xff70('0x20')](removeEntity(_0x546ead,null))[_0xff70('0x47')](handleError(_0x546ead,null));};exports[_0xff70('0x4d')]=function(_0x594828,_0x2bb2dc){return db['CmHopperBlack'][_0xff70('0x4d')]()[_0xff70('0x20')](respondWithResult(_0x2bb2dc,null))[_0xff70('0x47')](handleError(_0x2bb2dc,null));}; \ No newline at end of file +var _0xf914=['where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','name','render','merge','body','contact','message','agent','account','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter'];(function(_0x382c5c,_0x1b2d5f){var _0x3a5514=function(_0x2135f4){while(--_0x2135f4){_0x382c5c['push'](_0x382c5c['shift']());}};_0x3a5514(++_0x1b2d5f);}(_0xf914,0x1d0));var _0x4f91=function(_0x2a9ec5,_0xed23b){_0x2a9ec5=_0x2a9ec5-0x0;var _0x52c7c0=_0xf914[_0x2a9ec5];return _0x52c7c0;};'use strict';var emlformat=require(_0x4f91('0x0'));var rimraf=require(_0x4f91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4f91('0x2'));var moment=require(_0x4f91('0x3'));var BPromise=require(_0x4f91('0x4'));var Mustache=require(_0x4f91('0x5'));var util=require(_0x4f91('0x6'));var path=require('path');var sox=require(_0x4f91('0x7'));var csv=require(_0x4f91('0x8'));var ejs=require(_0x4f91('0x9'));var fs=require('fs');var fs_extra=require(_0x4f91('0xa'));var _=require('lodash');var squel=require(_0x4f91('0xb'));var crypto=require('crypto');var jsforce=require(_0x4f91('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4f91('0x8'));var querystring=require('querystring');var Papa=require(_0x4f91('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4f91('0xe'));var hardwareService=require(_0x4f91('0xf'));var logger=require(_0x4f91('0x10'))(_0x4f91('0x11'));var utils=require(_0x4f91('0x12'));var config=require(_0x4f91('0x13'));var licenseUtil=require(_0x4f91('0x14'));var db=require(_0x4f91('0x15'))['db'];function respondWithStatusCode(_0x1efe4e,_0x324bb4){_0x324bb4=_0x324bb4||0xcc;return function(_0x43cd4f){if(_0x43cd4f){return _0x1efe4e[_0x4f91('0x16')](_0x324bb4);}return _0x1efe4e['status'](_0x324bb4)[_0x4f91('0x17')]();};}function respondWithResult(_0xb87fd2,_0x3657d6){_0x3657d6=_0x3657d6||0xc8;return function(_0x43df8b){if(_0x43df8b){return _0xb87fd2[_0x4f91('0x18')](_0x3657d6)['json'](_0x43df8b);}};}function respondWithFilteredResult(_0x9df882,_0x3f4fc2){return function(_0x4b76df){if(_0x4b76df){var _0x58034a=typeof _0x3f4fc2[_0x4f91('0x19')]===_0x4f91('0x1a')&&typeof _0x3f4fc2['limit']==='undefined';var _0x1463e2=_0x4b76df[_0x4f91('0x1b')];var _0x33b596=_0x58034a?0x0:_0x3f4fc2[_0x4f91('0x19')];var _0x411d9f=_0x58034a?_0x4b76df[_0x4f91('0x1b')]:_0x3f4fc2[_0x4f91('0x19')]+_0x3f4fc2[_0x4f91('0x1c')];var _0x3cd123;if(_0x411d9f>=_0x1463e2){_0x411d9f=_0x1463e2;_0x3cd123=0xc8;}else{_0x3cd123=0xce;}_0x9df882['status'](_0x3cd123);return _0x9df882[_0x4f91('0x1d')](_0x4f91('0x1e'),_0x33b596+'-'+_0x411d9f+'/'+_0x1463e2)['json'](_0x4b76df);}return null;};}function patchUpdates(_0x476186){return function(_0x32ae5a){try{jsonpatch[_0x4f91('0x1f')](_0x32ae5a,_0x476186,!![]);}catch(_0x1dd4f3){return BPromise[_0x4f91('0x20')](_0x1dd4f3);}return _0x32ae5a['save']();};}function saveUpdates(_0x507d82,_0x5e847c){return function(_0xad0074){if(_0xad0074){return _0xad0074['update'](_0x507d82)[_0x4f91('0x21')](function(_0x44a96b){return _0x44a96b;});}return null;};}function removeEntity(_0x61a791,_0x39d9d9){return function(_0x160820){if(_0x160820){return _0x160820[_0x4f91('0x22')]()['then'](function(){_0x61a791[_0x4f91('0x18')](0xcc)[_0x4f91('0x17')]();});}};}function handleEntityNotFound(_0x269732,_0x92cf81){return function(_0x22171e){if(!_0x22171e){_0x269732[_0x4f91('0x16')](0x194);}return _0x22171e;};}function handleError(_0x486c76,_0x596533){_0x596533=_0x596533||0x1f4;return function(_0x13cb89){logger[_0x4f91('0x23')](_0x13cb89['stack']);if(_0x13cb89[_0x4f91('0x24')]){delete _0x13cb89['name'];}_0x486c76[_0x4f91('0x18')](_0x596533)['send'](_0x13cb89);};}function getMustacheRender(_0x43be9d,_0x1c081a){return Mustache[_0x4f91('0x25')](_0x43be9d,_[_0x4f91('0x26')](_0x1c081a[_0x4f91('0x27')],{'contact':_0x1c081a[_0x4f91('0x28')],'message':_0x1c081a[_0x4f91('0x29')],'agent':_0x1c081a[_0x4f91('0x2a')],'interaction':_0x1c081a['interaction'],'account':_0x1c081a[_0x4f91('0x2b')]}))||'';}exports['index']=function(_0x1f4699,_0x55193a){var _0x36e4c3={},_0xefafdb={},_0x52b5d7={'count':0x0,'rows':[]};var _0x86bc6f=_['map'](db[_0x4f91('0x2c')][_0x4f91('0x2d')],function(_0x1c5d86){return{'name':_0x1c5d86[_0x4f91('0x2e')],'type':_0x1c5d86[_0x4f91('0x2f')][_0x4f91('0x30')]};});_0xefafdb[_0x4f91('0x31')]=_[_0x4f91('0x32')](_0x86bc6f,_0x4f91('0x24'));_0xefafdb['query']=_[_0x4f91('0x33')](_0x1f4699[_0x4f91('0x34')]);_0xefafdb[_0x4f91('0x35')]=_['intersection'](_0xefafdb['model'],_0xefafdb[_0x4f91('0x34')]);_0x36e4c3[_0x4f91('0x36')]=_[_0x4f91('0x37')](_0xefafdb[_0x4f91('0x31')],qs[_0x4f91('0x38')](_0x1f4699[_0x4f91('0x34')][_0x4f91('0x38')]));_0x36e4c3[_0x4f91('0x36')]=_0x36e4c3[_0x4f91('0x36')]['length']?_0x36e4c3[_0x4f91('0x36')]:_0xefafdb['model'];if(!_0x1f4699[_0x4f91('0x34')][_0x4f91('0x39')](_0x4f91('0x3a'))){_0x36e4c3[_0x4f91('0x1c')]=qs[_0x4f91('0x1c')](_0x1f4699[_0x4f91('0x34')][_0x4f91('0x1c')]);_0x36e4c3['offset']=qs[_0x4f91('0x19')](_0x1f4699[_0x4f91('0x34')][_0x4f91('0x19')]);}_0x36e4c3['order']=qs[_0x4f91('0x3b')](_0x1f4699['query']['sort']);_0x36e4c3['where']=qs[_0x4f91('0x35')](_['pick'](_0x1f4699['query'],_0xefafdb[_0x4f91('0x35')]),_0x86bc6f);if(_0x1f4699[_0x4f91('0x34')][_0x4f91('0x3c')]){_0x36e4c3[_0x4f91('0x3d')]=_[_0x4f91('0x26')](_0x36e4c3['where'],{'$or':_[_0x4f91('0x32')](_0x86bc6f,function(_0xcdd690){if(_0xcdd690['type']!==_0x4f91('0x3e')){var _0x5df7dd={};_0x5df7dd[_0xcdd690[_0x4f91('0x24')]]={'$like':'%'+_0x1f4699[_0x4f91('0x34')][_0x4f91('0x3c')]+'%'};return _0x5df7dd;}})});}_0x36e4c3=_['merge']({},_0x36e4c3,_0x1f4699[_0x4f91('0x3f')]);var _0x2b186a={'where':_0x36e4c3[_0x4f91('0x3d')]};return db[_0x4f91('0x2c')][_0x4f91('0x1b')](_0x2b186a)[_0x4f91('0x21')](function(_0x944b3d){_0x52b5d7[_0x4f91('0x1b')]=_0x944b3d;if(_0x1f4699[_0x4f91('0x34')][_0x4f91('0x40')]){_0x36e4c3[_0x4f91('0x41')]=[{'all':!![]}];}return db[_0x4f91('0x2c')][_0x4f91('0x42')](_0x36e4c3);})[_0x4f91('0x21')](function(_0x15e58e){_0x52b5d7[_0x4f91('0x43')]=_0x15e58e;return _0x52b5d7;})[_0x4f91('0x21')](respondWithFilteredResult(_0x55193a,_0x36e4c3))[_0x4f91('0x44')](handleError(_0x55193a,null));};exports[_0x4f91('0x45')]=function(_0xb33914,_0x47d525){var _0xdd0ccd={'raw':!![],'where':{'id':_0xb33914[_0x4f91('0x46')]['id']}},_0x455a20={};_0x455a20[_0x4f91('0x31')]=_[_0x4f91('0x33')](db[_0x4f91('0x2c')][_0x4f91('0x2d')]);_0x455a20[_0x4f91('0x34')]=_[_0x4f91('0x33')](_0xb33914[_0x4f91('0x34')]);_0x455a20['filters']=_[_0x4f91('0x37')](_0x455a20[_0x4f91('0x31')],_0x455a20['query']);_0xdd0ccd[_0x4f91('0x36')]=_[_0x4f91('0x37')](_0x455a20[_0x4f91('0x31')],qs[_0x4f91('0x38')](_0xb33914[_0x4f91('0x34')][_0x4f91('0x38')]));_0xdd0ccd[_0x4f91('0x36')]=_0xdd0ccd['attributes'][_0x4f91('0x47')]?_0xdd0ccd[_0x4f91('0x36')]:_0x455a20[_0x4f91('0x31')];if(_0xb33914[_0x4f91('0x34')][_0x4f91('0x40')]){_0xdd0ccd[_0x4f91('0x41')]=[{'all':!![]}];}_0xdd0ccd=_[_0x4f91('0x26')]({},_0xdd0ccd,_0xb33914[_0x4f91('0x3f')]);return db[_0x4f91('0x2c')][_0x4f91('0x48')](_0xdd0ccd)[_0x4f91('0x21')](handleEntityNotFound(_0x47d525,null))[_0x4f91('0x21')](respondWithResult(_0x47d525,null))[_0x4f91('0x44')](handleError(_0x47d525,null));};exports[_0x4f91('0x49')]=function(_0x12bc80,_0xa46241){if(_0x12bc80[_0x4f91('0x27')]['id']){delete _0x12bc80['body']['id'];}return db[_0x4f91('0x2c')][_0x4f91('0x48')]({'where':{'id':_0x12bc80['params']['id']}})['then'](handleEntityNotFound(_0xa46241,null))['then'](saveUpdates(_0x12bc80['body'],null))[_0x4f91('0x21')](respondWithResult(_0xa46241,null))[_0x4f91('0x44')](handleError(_0xa46241,null));};exports[_0x4f91('0x22')]=function(_0x3023b0,_0x571fb6){return db[_0x4f91('0x2c')]['find']({'where':{'id':_0x3023b0[_0x4f91('0x46')]['id']}})[_0x4f91('0x21')](handleEntityNotFound(_0x571fb6,null))[_0x4f91('0x21')](removeEntity(_0x571fb6,null))[_0x4f91('0x44')](handleError(_0x571fb6,null));};exports['describe']=function(_0x302dd8,_0x48be2a){return db[_0x4f91('0x2c')][_0x4f91('0x4a')]()[_0x4f91('0x21')](respondWithResult(_0x48be2a,null))[_0x4f91('0x44')](handleError(_0x48be2a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e6fc0e3..7658374 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85e2=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x85e2,0xbb));var _0x285e=function(_0x1ae5dc,_0x31a664){_0x1ae5dc=_0x1ae5dc-0x0;var _0x137f77=_0x85e2[_0x1ae5dc];return _0x137f77;};'use strict';var _=require(_0x285e('0x0'));var util=require(_0x285e('0x1'));var logger=require(_0x285e('0x2'))(_0x285e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x285e('0x4'));var rimraf=require(_0x285e('0x5'));var config=require(_0x285e('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x285e('0x7')]=function(_0x40939d,_0x5bf3f5){return _0x40939d[_0x285e('0x8')](_0x285e('0x9'),attributes,{'tableName':_0x285e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e98=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','cm_hopper_black'];(function(_0x1a1003,_0x2aa772){var _0x4d16a2=function(_0x2e2822){while(--_0x2e2822){_0x1a1003['push'](_0x1a1003['shift']());}};_0x4d16a2(++_0x2aa772);}(_0x8e98,0x168));var _0x88e9=function(_0x5cacba,_0x4ae479){_0x5cacba=_0x5cacba-0x0;var _0x518d50=_0x8e98[_0x5cacba];return _0x518d50;};'use strict';var _=require(_0x88e9('0x0'));var util=require(_0x88e9('0x1'));var logger=require(_0x88e9('0x2'))(_0x88e9('0x3'));var moment=require(_0x88e9('0x4'));var BPromise=require(_0x88e9('0x5'));var rp=require(_0x88e9('0x6'));var fs=require('fs');var path=require(_0x88e9('0x7'));var rimraf=require(_0x88e9('0x8'));var config=require(_0x88e9('0x9'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x4a67c8,_0x2dd81f){return _0x4a67c8[_0x88e9('0xa')]('CmHopperBlack',attributes,{'tableName':_0x88e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index e578def..d3e7683 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.rpc.js +++ b/server/api/cmHopperBlack/cmHopperBlack.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e63=['DestroyCmHopperBlack','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','model','attributes','then','UpdateCmHopperBlack','body','destroy','where'];(function(_0x2b5904,_0xc1a4c2){var _0x1717fe=function(_0xc25128){while(--_0xc25128){_0x2b5904['push'](_0x2b5904['shift']());}};_0x1717fe(++_0xc1a4c2);}(_0x3e63,0x96));var _0x33e6=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x3e63[_0x3cf053];return _0x3b55a0;};'use strict';var _=require(_0x33e6('0x0'));var util=require(_0x33e6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33e6('0x2'));var fs=require('fs');var Redis=require(_0x33e6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x33e6('0x4'));var logger=require(_0x33e6('0x5'))(_0x33e6('0x6'));var config=require(_0x33e6('0x7'));var jayson=require(_0x33e6('0x8'));var client=jayson[_0x33e6('0x9')][_0x33e6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19f700,_0x2cb464,_0x3da3d9){return new BPromise(function(_0x246f0b,_0x6f9180){return client[_0x33e6('0xb')](_0x19f700,_0x3da3d9)['then'](function(_0x25b2d1){logger[_0x33e6('0xc')](_0x33e6('0xd'),_0x2cb464,_0x33e6('0xe'));logger[_0x33e6('0xf')](_0x33e6('0x10'),_0x2cb464,_0x33e6('0xe'),JSON[_0x33e6('0x11')](_0x25b2d1));if(_0x25b2d1[_0x33e6('0x12')]){if(_0x25b2d1[_0x33e6('0x12')]['code']===0x1f4){logger['error'](_0x33e6('0xd'),_0x2cb464,_0x25b2d1[_0x33e6('0x12')][_0x33e6('0x13')]);return _0x6f9180(_0x25b2d1[_0x33e6('0x12')][_0x33e6('0x13')]);}logger[_0x33e6('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2cb464,_0x25b2d1['error'][_0x33e6('0x13')]);return _0x246f0b(_0x25b2d1['error']['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x2cb464,'request\x20sent');_0x246f0b(_0x25b2d1['result'][_0x33e6('0x13')]);}})['catch'](function(_0x3c8f85){logger[_0x33e6('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2cb464,_0x3c8f85);_0x6f9180(_0x3c8f85);});});}exports[_0x33e6('0x14')]=function(_0x51d09d){var _0x3c7067=this;return new Promise(function(_0x577ea7,_0x4c3834){return db[_0x33e6('0x15')][_0x33e6('0x16')]({'raw':_0x51d09d[_0x33e6('0x17')]?_0x51d09d['options'][_0x33e6('0x18')]===undefined?!![]:![]:!![],'where':_0x51d09d['options']?_0x51d09d['options']['where']||null:null,'attributes':_0x51d09d['options']?_0x51d09d[_0x33e6('0x17')]['attributes']||null:null,'limit':_0x51d09d['options']?_0x51d09d[_0x33e6('0x17')][_0x33e6('0x19')]||null:null,'include':_0x51d09d[_0x33e6('0x17')]?_0x51d09d[_0x33e6('0x17')][_0x33e6('0x1a')]?_[_0x33e6('0x1b')](_0x51d09d[_0x33e6('0x17')]['include'],function(_0x338a3f){return{'model':db[_0x338a3f[_0x33e6('0x1c')]],'as':_0x338a3f['as'],'attributes':_0x338a3f['attributes'],'include':_0x338a3f[_0x33e6('0x1a')]?_[_0x33e6('0x1b')](_0x338a3f['include'],function(_0x4a5a8b){return{'model':db[_0x4a5a8b[_0x33e6('0x1c')]],'as':_0x4a5a8b['as'],'attributes':_0x4a5a8b[_0x33e6('0x1d')],'include':_0x4a5a8b['include']?_[_0x33e6('0x1b')](_0x4a5a8b[_0x33e6('0x1a')],function(_0x36cef8){return{'model':db[_0x36cef8['model']],'as':_0x36cef8['as'],'attributes':_0x36cef8[_0x33e6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x33e6('0x1e')](function(_0x2db1f1){logger['info'](_0x33e6('0x14'),_0x51d09d);logger[_0x33e6('0xf')](_0x33e6('0x14'),_0x51d09d,JSON['stringify'](_0x2db1f1));_0x577ea7(_0x2db1f1);})['catch'](function(_0x321c78){logger[_0x33e6('0x12')](_0x33e6('0x14'),_0x321c78[_0x33e6('0x13')],_0x51d09d);_0x4c3834(_0x3c7067[_0x33e6('0x12')](0x1f4,_0x321c78[_0x33e6('0x13')]));});});};exports[_0x33e6('0x1f')]=function(_0x4fdec2){var _0x5c2b9e=this;return new Promise(function(_0x663f9b,_0x5af9ac){return db[_0x33e6('0x15')]['update'](_0x4fdec2[_0x33e6('0x20')],{'raw':_0x4fdec2[_0x33e6('0x17')]?_0x4fdec2[_0x33e6('0x17')][_0x33e6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fdec2[_0x33e6('0x17')]?_0x4fdec2[_0x33e6('0x17')]['where']||null:null,'attributes':_0x4fdec2[_0x33e6('0x17')]?_0x4fdec2['options'][_0x33e6('0x1d')]||null:null,'limit':_0x4fdec2['options']?_0x4fdec2[_0x33e6('0x17')]['limit']||null:null})['then'](function(_0x369f2e){logger[_0x33e6('0xc')](_0x33e6('0x1f'),_0x4fdec2);logger[_0x33e6('0xf')]('UpdateCmHopperBlack',_0x4fdec2,JSON[_0x33e6('0x11')](_0x369f2e));_0x663f9b(_0x369f2e);})['catch'](function(_0x2dd645){logger[_0x33e6('0x12')](_0x33e6('0x1f'),_0x2dd645[_0x33e6('0x13')],_0x4fdec2);_0x5af9ac(_0x5c2b9e['error'](0x1f4,_0x2dd645[_0x33e6('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x33c50c){var _0x342718=this;return new Promise(function(_0x47718b,_0x5060f8){return db[_0x33e6('0x15')][_0x33e6('0x21')]({'where':_0x33c50c[_0x33e6('0x17')]?_0x33c50c[_0x33e6('0x17')][_0x33e6('0x22')]||null:null})[_0x33e6('0x1e')](function(_0x774cce){logger[_0x33e6('0xc')](_0x33e6('0x23'),_0x33c50c);logger[_0x33e6('0xf')]('DestroyCmHopperBlack',_0x33c50c,JSON[_0x33e6('0x11')](_0x774cce));_0x47718b(_0x774cce);})[_0x33e6('0x24')](function(_0x5813be){logger[_0x33e6('0x12')](_0x33e6('0x23'),_0x5813be[_0x33e6('0x13')],_0x33c50c);_0x5060f8(_0x342718[_0x33e6('0x12')](0x1f4,_0x5813be[_0x33e6('0x13')]));});});}; \ No newline at end of file +var _0x3363=['jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model','map','then','UpdateCmHopperBlack','update','body','stringify','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3363,0x115));var _0x3336=function(_0x4bc9b0,_0x42609d){_0x4bc9b0=_0x4bc9b0-0x0;var _0x456441=_0x3363[_0x4bc9b0];return _0x456441;};'use strict';var _=require('lodash');var util=require(_0x3336('0x0'));var moment=require(_0x3336('0x1'));var BPromise=require(_0x3336('0x2'));var rs=require(_0x3336('0x3'));var fs=require('fs');var Redis=require(_0x3336('0x4'));var db=require(_0x3336('0x5'))['db'];var utils=require(_0x3336('0x6'));var logger=require(_0x3336('0x7'))(_0x3336('0x8'));var config=require(_0x3336('0x9'));var jayson=require(_0x3336('0xa'));var client=jayson[_0x3336('0xb')][_0x3336('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17694a,_0x46f90e,_0x2eb7b0){return new BPromise(function(_0x16b86f,_0x321505){return client[_0x3336('0xd')](_0x17694a,_0x2eb7b0)['then'](function(_0x495be8){logger[_0x3336('0xe')](_0x3336('0xf'),_0x46f90e,'request\x20sent');logger[_0x3336('0x10')](_0x3336('0x11'),_0x46f90e,_0x3336('0x12'),JSON['stringify'](_0x495be8));if(_0x495be8['error']){if(_0x495be8[_0x3336('0x13')][_0x3336('0x14')]===0x1f4){logger[_0x3336('0x13')](_0x3336('0xf'),_0x46f90e,_0x495be8['error'][_0x3336('0x15')]);return _0x321505(_0x495be8[_0x3336('0x13')][_0x3336('0x15')]);}logger[_0x3336('0x13')](_0x3336('0xf'),_0x46f90e,_0x495be8['error']['message']);return _0x16b86f(_0x495be8['error'][_0x3336('0x15')]);}else{logger[_0x3336('0xe')](_0x3336('0xf'),_0x46f90e,_0x3336('0x12'));_0x16b86f(_0x495be8[_0x3336('0x16')][_0x3336('0x15')]);}})[_0x3336('0x17')](function(_0x5aae25){logger['error'](_0x3336('0xf'),_0x46f90e,_0x5aae25);_0x321505(_0x5aae25);});});}exports[_0x3336('0x18')]=function(_0x5db9d0){var _0x59e060=this;return new Promise(function(_0x4031c6,_0x7c7298){return db[_0x3336('0x19')]['findAll']({'raw':_0x5db9d0['options']?_0x5db9d0[_0x3336('0x1a')][_0x3336('0x1b')]===undefined?!![]:![]:!![],'where':_0x5db9d0['options']?_0x5db9d0[_0x3336('0x1a')][_0x3336('0x1c')]||null:null,'attributes':_0x5db9d0[_0x3336('0x1a')]?_0x5db9d0[_0x3336('0x1a')][_0x3336('0x1d')]||null:null,'limit':_0x5db9d0[_0x3336('0x1a')]?_0x5db9d0[_0x3336('0x1a')][_0x3336('0x1e')]||null:null,'include':_0x5db9d0[_0x3336('0x1a')]?_0x5db9d0[_0x3336('0x1a')][_0x3336('0x1f')]?_['map'](_0x5db9d0['options'][_0x3336('0x1f')],function(_0x166e81){return{'model':db[_0x166e81[_0x3336('0x20')]],'as':_0x166e81['as'],'attributes':_0x166e81[_0x3336('0x1d')],'include':_0x166e81[_0x3336('0x1f')]?_[_0x3336('0x21')](_0x166e81['include'],function(_0x5621d6){return{'model':db[_0x5621d6[_0x3336('0x20')]],'as':_0x5621d6['as'],'attributes':_0x5621d6[_0x3336('0x1d')],'include':_0x5621d6['include']?_[_0x3336('0x21')](_0x5621d6['include'],function(_0x1637a4){return{'model':db[_0x1637a4['model']],'as':_0x1637a4['as'],'attributes':_0x1637a4['attributes']};}):[]};}):[]};}):[]:[]})[_0x3336('0x22')](function(_0x177386){logger[_0x3336('0xe')](_0x3336('0x18'),_0x5db9d0);logger[_0x3336('0x10')](_0x3336('0x18'),_0x5db9d0,JSON['stringify'](_0x177386));_0x4031c6(_0x177386);})[_0x3336('0x17')](function(_0x4b3fcc){logger[_0x3336('0x13')](_0x3336('0x18'),_0x4b3fcc[_0x3336('0x15')],_0x5db9d0);_0x7c7298(_0x59e060['error'](0x1f4,_0x4b3fcc[_0x3336('0x15')]));});});};exports[_0x3336('0x23')]=function(_0x17caaa){var _0x1e18c1=this;return new Promise(function(_0x110c39,_0x42cf11){return db[_0x3336('0x19')][_0x3336('0x24')](_0x17caaa[_0x3336('0x25')],{'raw':_0x17caaa[_0x3336('0x1a')]?_0x17caaa[_0x3336('0x1a')][_0x3336('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17caaa[_0x3336('0x1a')]?_0x17caaa[_0x3336('0x1a')]['where']||null:null,'attributes':_0x17caaa[_0x3336('0x1a')]?_0x17caaa[_0x3336('0x1a')]['attributes']||null:null,'limit':_0x17caaa[_0x3336('0x1a')]?_0x17caaa['options'][_0x3336('0x1e')]||null:null})[_0x3336('0x22')](function(_0x26d476){logger[_0x3336('0xe')](_0x3336('0x23'),_0x17caaa);logger['debug'](_0x3336('0x23'),_0x17caaa,JSON[_0x3336('0x26')](_0x26d476));_0x110c39(_0x26d476);})[_0x3336('0x17')](function(_0x103939){logger[_0x3336('0x13')](_0x3336('0x23'),_0x103939[_0x3336('0x15')],_0x17caaa);_0x42cf11(_0x1e18c1['error'](0x1f4,_0x103939[_0x3336('0x15')]));});});};exports[_0x3336('0x27')]=function(_0xf8bd26){var _0x5afe06=this;return new Promise(function(_0x28bfc8,_0x51f5d0){return db['CmHopperBlack'][_0x3336('0x28')]({'where':_0xf8bd26['options']?_0xf8bd26[_0x3336('0x1a')]['where']||null:null})[_0x3336('0x22')](function(_0xf290be){logger[_0x3336('0xe')](_0x3336('0x27'),_0xf8bd26);logger['debug'](_0x3336('0x27'),_0xf8bd26,JSON['stringify'](_0xf290be));_0x28bfc8(_0xf290be);})[_0x3336('0x17')](function(_0x4f1d3c){logger[_0x3336('0x13')](_0x3336('0x27'),_0x4f1d3c[_0x3336('0x15')],_0xf8bd26);_0x51f5d0(_0x5afe06[_0x3336('0x13')](0x1f4,_0x4f1d3c[_0x3336('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5e82987..62fb9b3 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./cmHopperBlack.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7046=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','show','put','/:id','update','delete'];(function(_0x47b7c6,_0x389cf7){var _0x54ace1=function(_0x5b1da7){while(--_0x5b1da7){_0x47b7c6['push'](_0x47b7c6['shift']());}};_0x54ace1(++_0x389cf7);}(_0x7046,0x144));var _0x6704=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7046[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0xe')](_0x6704('0xf'),auth[_0x6704('0xa')](),controller[_0x6704('0x10')]);router[_0x6704('0x11')](_0x6704('0xf'),auth[_0x6704('0xa')](),controller['destroy']);module[_0x6704('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index deba028..3d270a3 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.attributes.js +++ b/server/api/cmHopperFinal/cmHopperFinal.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe385=['STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe385,0x11c));var _0x5e38=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe385[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5e38('0x0'));module[_0x5e38('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5e38('0x2')]},'scheduledat':{'type':Sequelize[_0x5e38('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5e38('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x5e38('0x2')]},'originatecalleridname':{'type':Sequelize[_0x5e38('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5e38('0x2')]},'starttime':{'type':Sequelize[_0x5e38('0x3')]},'responsetime':{'type':Sequelize[_0x5e38('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x5e38('0x3')]},'endtime':{'type':Sequelize[_0x5e38('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5e38('0x2')]},'campaign':{'type':Sequelize[_0x5e38('0x2')]},'campaigntype':{'type':Sequelize[_0x5e38('0x2')]},'membername':{'type':Sequelize[_0x5e38('0x2')]},'reason':{'type':Sequelize[_0x5e38('0x2')]},'disposition':{'type':Sequelize[_0x5e38('0x2')]},'secondDisposition':{'type':Sequelize[_0x5e38('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x5e38('0x3')],'set':function(_0x422ff1){var _0x3d33b0=this[_0x5e38('0x5')](_0x5e38('0x6'));if(_0x3d33b0&&_0x422ff1){this[_0x5e38('0x7')](_0x5e38('0x8'),moment(_0x422ff1)[_0x5e38('0x9')](moment(_0x3d33b0),_0x5e38('0xa')));}return this['setDataValue'](_0x5e38('0xb'),_0x422ff1);}},'amd':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5e38('0x3')]},'deleted':{'type':Sequelize[_0x5e38('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5e38('0x3')]},'recallme':{'type':Sequelize[_0x5e38('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5e38('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa3e9=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x17e7bd,_0x37f1dd){var _0x550244=function(_0x39b88b){while(--_0x39b88b){_0x17e7bd['push'](_0x17e7bd['shift']());}};_0x550244(++_0x37f1dd);}(_0xa3e9,0xc2));var _0x9a3e=function(_0x242f87,_0x2471de){_0x242f87=_0x242f87-0x0;var _0x346d86=_0xa3e9[_0x242f87];return _0x346d86;};'use strict';var Sequelize=require(_0x9a3e('0x0'));var moment=require(_0x9a3e('0x1'));module[_0x9a3e('0x2')]={'state':{'type':Sequelize[_0x9a3e('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x9a3e('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9a3e('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x9a3e('0x4')]},'originatecalleridname':{'type':Sequelize[_0x9a3e('0x4')]},'calleridnum':{'type':Sequelize[_0x9a3e('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9a3e('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9a3e('0x5')]},'droptime':{'type':Sequelize[_0x9a3e('0x5')]},'endtime':{'type':Sequelize[_0x9a3e('0x5')]},'ringtime':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9a3e('0x4')]},'campaign':{'type':Sequelize[_0x9a3e('0x4')]},'campaigntype':{'type':Sequelize[_0x9a3e('0x4')]},'membername':{'type':Sequelize[_0x9a3e('0x4')]},'reason':{'type':Sequelize[_0x9a3e('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9a3e('0x4')]},'dispositionat':{'type':Sequelize[_0x9a3e('0x5')],'set':function(_0x51632d){var _0x36654f=this[_0x9a3e('0x6')](_0x9a3e('0x7'));if(_0x36654f&&_0x51632d){this[_0x9a3e('0x8')](_0x9a3e('0x9'),moment(_0x51632d)[_0x9a3e('0xa')](moment(_0x36654f),_0x9a3e('0xb')));}return this[_0x9a3e('0x8')](_0x9a3e('0xc'),_0x51632d);}},'amd':{'type':Sequelize[_0x9a3e('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9a3e('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9a3e('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9a3e('0xd')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9a3e('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9a3e('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9a3e('0x5')]},'deleted':{'type':Sequelize[_0x9a3e('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9a3e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 7aabdf0..0cb413f 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dc1=['json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','render','merge','message','agent','interaction','CmHopperFinal','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','options','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','state\x20=\x204','group','Campaign','into','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x7dc1,0xf6));var _0x17dc=function(_0x1d9e3d,_0x236dd2){_0x1d9e3d=_0x1d9e3d-0x0;var _0x25ecee=_0x7dc1[_0x1d9e3d];return _0x25ecee;};'use strict';var emlformat=require(_0x17dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17dc('0x1'));var jsonpatch=require(_0x17dc('0x2'));var rp=require(_0x17dc('0x3'));var moment=require('moment');var BPromise=require(_0x17dc('0x4'));var Mustache=require(_0x17dc('0x5'));var util=require(_0x17dc('0x6'));var path=require(_0x17dc('0x7'));var sox=require(_0x17dc('0x8'));var csv=require(_0x17dc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x17dc('0xa'));var crypto=require(_0x17dc('0xb'));var jsforce=require(_0x17dc('0xc'));var deskjs=require(_0x17dc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x17dc('0xe'));var Papa=require(_0x17dc('0xf'));var Redis=require(_0x17dc('0x10'));var authService=require(_0x17dc('0x11'));var qs=require(_0x17dc('0x12'));var as=require(_0x17dc('0x13'));var hardwareService=require(_0x17dc('0x14'));var logger=require(_0x17dc('0x15'))(_0x17dc('0x16'));var utils=require(_0x17dc('0x17'));var config=require(_0x17dc('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29be3a,_0x419068){_0x419068=_0x419068||0xcc;return function(_0x462049){if(_0x462049){return _0x29be3a[_0x17dc('0x19')](_0x419068);}return _0x29be3a[_0x17dc('0x1a')](_0x419068)[_0x17dc('0x1b')]();};}function respondWithResult(_0x4836d9,_0x473508){_0x473508=_0x473508||0xc8;return function(_0x3665bd){if(_0x3665bd){return _0x4836d9[_0x17dc('0x1a')](_0x473508)[_0x17dc('0x1c')](_0x3665bd);}};}function respondWithFilteredResult(_0xac41c0,_0x29f933){return function(_0x328e1d){if(_0x328e1d){var _0x56df0a=typeof _0x29f933['offset']===_0x17dc('0x1d')&&typeof _0x29f933['limit']===_0x17dc('0x1d');var _0x36f4b6=_0x328e1d[_0x17dc('0x1e')];var _0x3984b9=_0x56df0a?0x0:_0x29f933[_0x17dc('0x1f')];var _0x301a83=_0x56df0a?_0x328e1d[_0x17dc('0x1e')]:_0x29f933[_0x17dc('0x1f')]+_0x29f933[_0x17dc('0x20')];var _0x4e3aa1;if(_0x301a83>=_0x36f4b6){_0x301a83=_0x36f4b6;_0x4e3aa1=0xc8;}else{_0x4e3aa1=0xce;}_0xac41c0[_0x17dc('0x1a')](_0x4e3aa1);return _0xac41c0[_0x17dc('0x21')](_0x17dc('0x22'),_0x3984b9+'-'+_0x301a83+'/'+_0x36f4b6)[_0x17dc('0x1c')](_0x328e1d);}return null;};}function patchUpdates(_0x49f056){return function(_0x35233e){try{jsonpatch['apply'](_0x35233e,_0x49f056,!![]);}catch(_0xe41f45){return BPromise[_0x17dc('0x23')](_0xe41f45);}return _0x35233e[_0x17dc('0x24')]();};}function saveUpdates(_0x13a825,_0x181c2a){return function(_0x50df09){if(_0x50df09){return _0x50df09[_0x17dc('0x25')](_0x13a825)[_0x17dc('0x26')](function(_0x253750){return _0x253750;});}return null;};}function removeEntity(_0x47883b,_0x1871fb){return function(_0xf76643){if(_0xf76643){return _0xf76643[_0x17dc('0x27')]()[_0x17dc('0x26')](function(){_0x47883b[_0x17dc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1260d4,_0x5771be){return function(_0x71b94c){if(!_0x71b94c){_0x1260d4[_0x17dc('0x19')](0x194);}return _0x71b94c;};}function handleError(_0x3fdc15,_0x3195da){_0x3195da=_0x3195da||0x1f4;return function(_0x28986d){logger[_0x17dc('0x28')](_0x28986d[_0x17dc('0x29')]);if(_0x28986d[_0x17dc('0x2a')]){delete _0x28986d[_0x17dc('0x2a')];}_0x3fdc15[_0x17dc('0x1a')](_0x3195da)[_0x17dc('0x2b')](_0x28986d);};}function getMustacheRender(_0x50fc53,_0xacd07f){return Mustache[_0x17dc('0x2c')](_0x50fc53,_[_0x17dc('0x2d')](_0xacd07f['body'],{'contact':_0xacd07f['contact'],'message':_0xacd07f[_0x17dc('0x2e')],'agent':_0xacd07f[_0x17dc('0x2f')],'interaction':_0xacd07f[_0x17dc('0x30')],'account':_0xacd07f['account']}))||'';}exports['index']=function(_0x569176,_0x212398){var _0x50032d={},_0x181880={},_0x1f4098={'count':0x0,'rows':[]};var _0x386d0f=_['map'](db[_0x17dc('0x31')]['rawAttributes'],function(_0x4047c1){return{'name':_0x4047c1[_0x17dc('0x32')],'type':_0x4047c1[_0x17dc('0x33')][_0x17dc('0x34')]};});_0x181880['model']=_[_0x17dc('0x35')](_0x386d0f,_0x17dc('0x2a'));_0x181880[_0x17dc('0x36')]=_['keys'](_0x569176['query']);_0x181880[_0x17dc('0x37')]=_[_0x17dc('0x38')](_0x181880['model'],_0x181880['query']);_0x50032d[_0x17dc('0x39')]=_[_0x17dc('0x38')](_0x181880[_0x17dc('0x3a')],qs['fields'](_0x569176[_0x17dc('0x36')][_0x17dc('0x3b')]));_0x50032d[_0x17dc('0x39')]=_0x50032d[_0x17dc('0x39')][_0x17dc('0x3c')]?_0x50032d['attributes']:_0x181880[_0x17dc('0x3a')];if(!_0x569176[_0x17dc('0x36')][_0x17dc('0x3d')](_0x17dc('0x3e'))){_0x50032d[_0x17dc('0x20')]=qs['limit'](_0x569176[_0x17dc('0x36')][_0x17dc('0x20')]);_0x50032d[_0x17dc('0x1f')]=qs[_0x17dc('0x1f')](_0x569176[_0x17dc('0x36')][_0x17dc('0x1f')]);}_0x50032d[_0x17dc('0x3f')]=qs[_0x17dc('0x40')](_0x569176['query']['sort']);_0x50032d['where']=qs[_0x17dc('0x37')](_[_0x17dc('0x41')](_0x569176['query'],_0x181880[_0x17dc('0x37')]),_0x386d0f);if(_0x569176[_0x17dc('0x36')][_0x17dc('0x42')]){_0x50032d[_0x17dc('0x43')]=_[_0x17dc('0x2d')](_0x50032d[_0x17dc('0x43')],{'$or':_[_0x17dc('0x35')](_0x386d0f,function(_0x632243){if(_0x632243[_0x17dc('0x33')]!==_0x17dc('0x44')){var _0x1122ab={};_0x1122ab[_0x632243[_0x17dc('0x2a')]]={'$like':'%'+_0x569176[_0x17dc('0x36')][_0x17dc('0x42')]+'%'};return _0x1122ab;}})});}_0x50032d=_[_0x17dc('0x2d')]({},_0x50032d,_0x569176['options']);var _0x58b364={'where':_0x50032d['where']};return db[_0x17dc('0x31')][_0x17dc('0x1e')](_0x58b364)[_0x17dc('0x26')](function(_0x477ad9){_0x1f4098[_0x17dc('0x1e')]=_0x477ad9;if(_0x569176[_0x17dc('0x36')][_0x17dc('0x45')]){_0x50032d[_0x17dc('0x46')]=[{'all':!![]}];}return db[_0x17dc('0x31')][_0x17dc('0x47')](_0x50032d);})[_0x17dc('0x26')](function(_0xe1d801){_0x1f4098[_0x17dc('0x48')]=_0xe1d801;return _0x1f4098;})['then'](respondWithFilteredResult(_0x212398,_0x50032d))[_0x17dc('0x49')](handleError(_0x212398,null));};exports['show']=function(_0x46f499,_0x1976af){var _0x1859e3={'raw':!![],'where':{'id':_0x46f499[_0x17dc('0x4a')]['id']}},_0x51ea59={};_0x51ea59[_0x17dc('0x3a')]=_['keys'](db[_0x17dc('0x31')][_0x17dc('0x4b')]);_0x51ea59['query']=_[_0x17dc('0x4c')](_0x46f499[_0x17dc('0x36')]);_0x51ea59[_0x17dc('0x37')]=_[_0x17dc('0x38')](_0x51ea59[_0x17dc('0x3a')],_0x51ea59[_0x17dc('0x36')]);_0x1859e3[_0x17dc('0x39')]=_[_0x17dc('0x38')](_0x51ea59['model'],qs[_0x17dc('0x3b')](_0x46f499[_0x17dc('0x36')]['fields']));_0x1859e3[_0x17dc('0x39')]=_0x1859e3['attributes'][_0x17dc('0x3c')]?_0x1859e3['attributes']:_0x51ea59[_0x17dc('0x3a')];if(_0x46f499[_0x17dc('0x36')]['includeAll']){_0x1859e3['include']=[{'all':!![]}];}_0x1859e3=_[_0x17dc('0x2d')]({},_0x1859e3,_0x46f499[_0x17dc('0x4d')]);return db[_0x17dc('0x31')]['find'](_0x1859e3)[_0x17dc('0x26')](handleEntityNotFound(_0x1976af,null))[_0x17dc('0x26')](respondWithResult(_0x1976af,null))['catch'](handleError(_0x1976af,null));};exports[_0x17dc('0x4e')]=function(_0x4962dc,_0x571d4f){return db[_0x17dc('0x31')]['describe']()[_0x17dc('0x26')](respondWithResult(_0x571d4f,null))[_0x17dc('0x49')](handleError(_0x571d4f,null));};exports['update']=function(_0x4506d6,_0xdb4d38){if(_0x4506d6[_0x17dc('0x4f')]['uniqueid']){delete _0x4506d6[_0x17dc('0x4f')][_0x17dc('0x50')];}return db[_0x17dc('0x31')][_0x17dc('0x51')]({'where':{'uniqueid':_0x4506d6[_0x17dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdb4d38,null))[_0x17dc('0x26')](saveUpdates(_0x4506d6[_0x17dc('0x4f')],null))[_0x17dc('0x26')](respondWithResult(_0xdb4d38,null))['catch'](handleError(_0xdb4d38,null));};exports[_0x17dc('0x52')]=function(_0x551849,_0x4f43b6,_0x15692a){return db[_0x17dc('0x31')][_0x17dc('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x551849[_0x17dc('0x4a')]['id']},'attributes':[[db['sequelize']['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x56')))),_0x17dc('0x57')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db['sequelize'][_0x17dc('0x55')](_0x17dc('0x58')))),_0x17dc('0x59')],[db['sequelize']['fn']('COUNT',db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5a')))),'busyContacts'],[db['sequelize']['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')]['literal'](_0x17dc('0x5b')))),_0x17dc('0x5c')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5d')))),_0x17dc('0x5e')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5f')))),_0x17dc('0x60')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x61')))),'answeringMachine']]})[_0x17dc('0x26')](handleEntityNotFound(_0x4f43b6,null))[_0x17dc('0x26')](respondWithResult(_0x4f43b6,null))['catch'](handleError(_0x4f43b6,null));};exports[_0x17dc('0x62')]=function(_0x56938b,_0xf823f9,_0x5af00a){return db[_0x17dc('0x31')][_0x17dc('0x47')]({'raw':![],'where':{'CampaignId':_0x56938b['params']['id']},'attributes':[[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x56')))),_0x17dc('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')]('`state`\x20=\x205,\x201,\x20null'))),_0x17dc('0x63')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')]('`state`\x20=\x208,\x201,\x20null'))),_0x17dc('0x5c')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x5d')))),_0x17dc('0x5e')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db['sequelize'][_0x17dc('0x55')](_0x17dc('0x5f')))),_0x17dc('0x60')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db[_0x17dc('0x54')]['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x64')))),_0x17dc('0x65')],[db[_0x17dc('0x54')]['fn'](_0x17dc('0x53'),db['sequelize']['fn']('IF',db[_0x17dc('0x54')][_0x17dc('0x55')](_0x17dc('0x61')))),_0x17dc('0x66')]]})['then'](handleEntityNotFound(_0xf823f9,null))[_0x17dc('0x26')](respondWithResult(_0xf823f9,null))[_0x17dc('0x49')](handleError(_0xf823f9,null));};exports[_0x17dc('0x67')]=function(_0x38e2ab,_0x1a5190,_0x14ffde){return db[_0x17dc('0x68')]['find']({'where':{'id':_0x38e2ab[_0x17dc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a5190,null))['then'](function(_0x13d45e){var _0x5ba14a;if(_0x13d45e){_0x5ba14a=squel[_0x17dc('0x69')]()['into'](_0x17dc('0x6a'))[_0x17dc('0x6b')]([_0x17dc('0x6c'),_0x17dc('0x6d'),_0x17dc('0x6e'),_0x17dc('0x6f'),_0x17dc('0x70'),'createdAt',_0x17dc('0x71')],squel['select']()[_0x17dc('0x72')](_0x17dc('0x73'),_0x17dc('0x6c'))[_0x17dc('0x72')](_0x17dc('0x74'),_0x17dc('0x6d'))[_0x17dc('0x72')]('ANY_VALUE(ContactId)',_0x17dc('0x6e'))[_0x17dc('0x72')](_0x17dc('0x75'),'ListId')[_0x17dc('0x72')](_0x17dc('0x76'),'VoiceQueueId')[_0x17dc('0x72')]('NOW()','createdAt')[_0x17dc('0x72')](_0x17dc('0x74'),_0x17dc('0x71'))[_0x17dc('0x77')](_0x17dc('0x78'))[_0x17dc('0x43')](_0x17dc('0x79'),_0x38e2ab[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]())['where'](_0x17dc('0x7b'),_0x38e2ab[_0x17dc('0x4f')]['state'][_0x17dc('0x7a')]())['where'](_0x17dc('0x7c'))[_0x17dc('0x43')](_0x17dc('0x7d'),squel['select']()[_0x17dc('0x72')]('phone')[_0x17dc('0x77')]('cm_hopper')[_0x17dc('0x43')](_0x17dc('0x79'),_0x38e2ab[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]()))[_0x17dc('0x43')](_0x17dc('0x7d'),squel[_0x17dc('0x7e')]()[_0x17dc('0x72')]('calleridnum')['from'](_0x17dc('0x78'))[_0x17dc('0x43')](_0x17dc('0x79'),_0x38e2ab[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]())[_0x17dc('0x43')](_0x17dc('0x7f')))[_0x17dc('0x80')](_0x17dc('0x6e')))[_0x17dc('0x7a')]();return db[_0x17dc('0x54')]['query'](_0x5ba14a);}return[];})[_0x17dc('0x26')](respondWithResult(_0x1a5190,null))[_0x17dc('0x49')](handleError(_0x1a5190,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2cb99e,_0x7749bd,_0x400650){return db[_0x17dc('0x81')][_0x17dc('0x51')]({'where':{'id':_0x2cb99e[_0x17dc('0x4a')]['id']}})[_0x17dc('0x26')](handleEntityNotFound(_0x7749bd,null))[_0x17dc('0x26')](function(_0x48085a){var _0x36a633;if(_0x48085a){_0x36a633=squel['insert']()[_0x17dc('0x82')](_0x17dc('0x6a'))[_0x17dc('0x6b')](['phone',_0x17dc('0x6d'),_0x17dc('0x6e'),'ListId','CampaignId','createdAt',_0x17dc('0x71')],squel[_0x17dc('0x7e')]()[_0x17dc('0x72')](_0x17dc('0x73'),_0x17dc('0x6c'))[_0x17dc('0x72')]('NOW()',_0x17dc('0x6d'))[_0x17dc('0x72')](_0x17dc('0x83'),_0x17dc('0x6e'))['field'](_0x17dc('0x75'),'ListId')[_0x17dc('0x72')](_0x17dc('0x84'),'CampaignId')[_0x17dc('0x72')](_0x17dc('0x74'),'createdAt')[_0x17dc('0x72')](_0x17dc('0x74'),'updatedAt')['from'](_0x17dc('0x78'))[_0x17dc('0x43')](_0x17dc('0x85'),_0x2cb99e['params']['id']['toString']())['where']('state\x20=\x20?',_0x2cb99e[_0x17dc('0x4f')]['state']['toString']())[_0x17dc('0x43')](_0x17dc('0x7c'))['where'](_0x17dc('0x7d'),squel[_0x17dc('0x7e')]()[_0x17dc('0x72')](_0x17dc('0x6c'))[_0x17dc('0x77')](_0x17dc('0x6a'))['where'](_0x17dc('0x85'),_0x2cb99e[_0x17dc('0x4a')]['id'][_0x17dc('0x7a')]()))[_0x17dc('0x43')](_0x17dc('0x7d'),squel['select']()[_0x17dc('0x72')](_0x17dc('0x86'))[_0x17dc('0x77')]('cm_hopper_final')['where'](_0x17dc('0x85'),_0x2cb99e['params']['id']['toString']())[_0x17dc('0x43')](_0x17dc('0x7f')))[_0x17dc('0x80')](_0x17dc('0x6e')))[_0x17dc('0x7a')]();return db['sequelize']['query'](_0x36a633);}return[];})[_0x17dc('0x26')](respondWithResult(_0x7749bd,null))['catch'](handleError(_0x7749bd,null));};exports['checkContactHopper']=function(_0x35af36,_0x218b61,_0x16ecc7){return db[_0x17dc('0x87')][_0x17dc('0x88')]({'where':{'VoiceQueueId':_0x35af36[_0x17dc('0x4f')]['VoiceQueueId'],'CampaignId':_0x35af36[_0x17dc('0x4f')]['CampaignId'],'ContactId':_0x35af36[_0x17dc('0x4f')]['ContactId']}})[_0x17dc('0x26')](handleEntityNotFound(_0x218b61,null))[_0x17dc('0x26')](function(_0x4a333f){if(_0x4a333f){return _0x4a333f;}return null;})[_0x17dc('0x26')](respondWithResult(_0x218b61,null))['catch'](handleError(_0x218b61,null));}; \ No newline at end of file +var _0xd24c=['send','render','contact','message','agent','interaction','account','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','calleridnum','group','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','state\x20=\x204','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','sendStatus','error','name'];(function(_0x7f61d2,_0x1b3d8e){var _0x444421=function(_0x53a381){while(--_0x53a381){_0x7f61d2['push'](_0x7f61d2['shift']());}};_0x444421(++_0x1b3d8e);}(_0xd24c,0xe3));var _0xcd24=function(_0x3c451f,_0x2b5065){_0x3c451f=_0x3c451f-0x0;var _0x31ecd6=_0xd24c[_0x3c451f];return _0x31ecd6;};'use strict';var emlformat=require(_0xcd24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd24('0x1'));var jsonpatch=require(_0xcd24('0x2'));var rp=require(_0xcd24('0x3'));var moment=require(_0xcd24('0x4'));var BPromise=require(_0xcd24('0x5'));var Mustache=require('mustache');var util=require(_0xcd24('0x6'));var path=require('path');var sox=require(_0xcd24('0x7'));var csv=require(_0xcd24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd24('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd24('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcd24('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcd24('0xc'));var Papa=require('papaparse');var Redis=require(_0xcd24('0xd'));var authService=require(_0xcd24('0xe'));var qs=require(_0xcd24('0xf'));var as=require(_0xcd24('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd24('0x11'))(_0xcd24('0x12'));var utils=require(_0xcd24('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcd24('0x14'));var db=require(_0xcd24('0x15'))['db'];function respondWithStatusCode(_0xa59626,_0x31e74f){_0x31e74f=_0x31e74f||0xcc;return function(_0x4e89a8){if(_0x4e89a8){return _0xa59626['sendStatus'](_0x31e74f);}return _0xa59626['status'](_0x31e74f)[_0xcd24('0x16')]();};}function respondWithResult(_0x3151b3,_0x2d994c){_0x2d994c=_0x2d994c||0xc8;return function(_0x37b959){if(_0x37b959){return _0x3151b3[_0xcd24('0x17')](_0x2d994c)[_0xcd24('0x18')](_0x37b959);}};}function respondWithFilteredResult(_0x541465,_0x5cb438){return function(_0x59198b){if(_0x59198b){var _0x1d7873=typeof _0x5cb438[_0xcd24('0x19')]==='undefined'&&typeof _0x5cb438[_0xcd24('0x1a')]===_0xcd24('0x1b');var _0x2d4d36=_0x59198b[_0xcd24('0x1c')];var _0x4df62a=_0x1d7873?0x0:_0x5cb438[_0xcd24('0x19')];var _0x5400f2=_0x1d7873?_0x59198b['count']:_0x5cb438['offset']+_0x5cb438[_0xcd24('0x1a')];var _0x5a7882;if(_0x5400f2>=_0x2d4d36){_0x5400f2=_0x2d4d36;_0x5a7882=0xc8;}else{_0x5a7882=0xce;}_0x541465[_0xcd24('0x17')](_0x5a7882);return _0x541465[_0xcd24('0x1d')](_0xcd24('0x1e'),_0x4df62a+'-'+_0x5400f2+'/'+_0x2d4d36)[_0xcd24('0x18')](_0x59198b);}return null;};}function patchUpdates(_0x50d6d5){return function(_0x2766e5){try{jsonpatch['apply'](_0x2766e5,_0x50d6d5,!![]);}catch(_0x103fcb){return BPromise[_0xcd24('0x1f')](_0x103fcb);}return _0x2766e5['save']();};}function saveUpdates(_0x3da2a2,_0x10a260){return function(_0x451708){if(_0x451708){return _0x451708[_0xcd24('0x20')](_0x3da2a2)[_0xcd24('0x21')](function(_0x52411d){return _0x52411d;});}return null;};}function removeEntity(_0x16fc7a,_0x60e35){return function(_0x38ecec){if(_0x38ecec){return _0x38ecec['destroy']()[_0xcd24('0x21')](function(){_0x16fc7a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x61b7b5,_0x3c90e4){return function(_0xedfd39){if(!_0xedfd39){_0x61b7b5[_0xcd24('0x22')](0x194);}return _0xedfd39;};}function handleError(_0x3e8346,_0x1b4b8a){_0x1b4b8a=_0x1b4b8a||0x1f4;return function(_0xf1b634){logger[_0xcd24('0x23')](_0xf1b634['stack']);if(_0xf1b634[_0xcd24('0x24')]){delete _0xf1b634[_0xcd24('0x24')];}_0x3e8346[_0xcd24('0x17')](_0x1b4b8a)[_0xcd24('0x25')](_0xf1b634);};}function getMustacheRender(_0x468963,_0x2091ca){return Mustache[_0xcd24('0x26')](_0x468963,_['merge'](_0x2091ca['body'],{'contact':_0x2091ca[_0xcd24('0x27')],'message':_0x2091ca[_0xcd24('0x28')],'agent':_0x2091ca[_0xcd24('0x29')],'interaction':_0x2091ca[_0xcd24('0x2a')],'account':_0x2091ca[_0xcd24('0x2b')]}))||'';}exports[_0xcd24('0x2c')]=function(_0x47d659,_0x36623c){var _0x36c178={},_0x17492d={},_0x128101={'count':0x0,'rows':[]};var _0x20cd09=_[_0xcd24('0x2d')](db[_0xcd24('0x2e')][_0xcd24('0x2f')],function(_0x1ac17a){return{'name':_0x1ac17a['fieldName'],'type':_0x1ac17a['type'][_0xcd24('0x30')]};});_0x17492d[_0xcd24('0x31')]=_['map'](_0x20cd09,_0xcd24('0x24'));_0x17492d[_0xcd24('0x32')]=_[_0xcd24('0x33')](_0x47d659[_0xcd24('0x32')]);_0x17492d[_0xcd24('0x34')]=_[_0xcd24('0x35')](_0x17492d['model'],_0x17492d['query']);_0x36c178[_0xcd24('0x36')]=_[_0xcd24('0x35')](_0x17492d[_0xcd24('0x31')],qs[_0xcd24('0x37')](_0x47d659['query'][_0xcd24('0x37')]));_0x36c178[_0xcd24('0x36')]=_0x36c178[_0xcd24('0x36')]['length']?_0x36c178[_0xcd24('0x36')]:_0x17492d[_0xcd24('0x31')];if(!_0x47d659['query']['hasOwnProperty'](_0xcd24('0x38'))){_0x36c178[_0xcd24('0x1a')]=qs[_0xcd24('0x1a')](_0x47d659['query'][_0xcd24('0x1a')]);_0x36c178[_0xcd24('0x19')]=qs[_0xcd24('0x19')](_0x47d659[_0xcd24('0x32')][_0xcd24('0x19')]);}_0x36c178[_0xcd24('0x39')]=qs['sort'](_0x47d659[_0xcd24('0x32')][_0xcd24('0x3a')]);_0x36c178[_0xcd24('0x3b')]=qs['filters'](_['pick'](_0x47d659[_0xcd24('0x32')],_0x17492d[_0xcd24('0x34')]),_0x20cd09);if(_0x47d659[_0xcd24('0x32')]['filter']){_0x36c178[_0xcd24('0x3b')]=_[_0xcd24('0x3c')](_0x36c178['where'],{'$or':_[_0xcd24('0x2d')](_0x20cd09,function(_0x4af575){if(_0x4af575[_0xcd24('0x3d')]!==_0xcd24('0x3e')){var _0x249734={};_0x249734[_0x4af575[_0xcd24('0x24')]]={'$like':'%'+_0x47d659[_0xcd24('0x32')][_0xcd24('0x3f')]+'%'};return _0x249734;}})});}_0x36c178=_['merge']({},_0x36c178,_0x47d659[_0xcd24('0x40')]);var _0x23cfa8={'where':_0x36c178[_0xcd24('0x3b')]};return db['CmHopperFinal'][_0xcd24('0x1c')](_0x23cfa8)[_0xcd24('0x21')](function(_0x90f7a8){_0x128101[_0xcd24('0x1c')]=_0x90f7a8;if(_0x47d659['query'][_0xcd24('0x41')]){_0x36c178[_0xcd24('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xcd24('0x43')](_0x36c178);})[_0xcd24('0x21')](function(_0x44cdd1){_0x128101['rows']=_0x44cdd1;return _0x128101;})['then'](respondWithFilteredResult(_0x36623c,_0x36c178))[_0xcd24('0x44')](handleError(_0x36623c,null));};exports[_0xcd24('0x45')]=function(_0x153575,_0x1ce4e1){var _0x4bf52e={'raw':!![],'where':{'id':_0x153575[_0xcd24('0x46')]['id']}},_0x5ca33e={};_0x5ca33e[_0xcd24('0x31')]=_[_0xcd24('0x33')](db['CmHopperFinal'][_0xcd24('0x2f')]);_0x5ca33e[_0xcd24('0x32')]=_[_0xcd24('0x33')](_0x153575[_0xcd24('0x32')]);_0x5ca33e['filters']=_[_0xcd24('0x35')](_0x5ca33e[_0xcd24('0x31')],_0x5ca33e[_0xcd24('0x32')]);_0x4bf52e[_0xcd24('0x36')]=_[_0xcd24('0x35')](_0x5ca33e[_0xcd24('0x31')],qs['fields'](_0x153575[_0xcd24('0x32')][_0xcd24('0x37')]));_0x4bf52e[_0xcd24('0x36')]=_0x4bf52e['attributes'][_0xcd24('0x47')]?_0x4bf52e[_0xcd24('0x36')]:_0x5ca33e[_0xcd24('0x31')];if(_0x153575[_0xcd24('0x32')][_0xcd24('0x41')]){_0x4bf52e[_0xcd24('0x42')]=[{'all':!![]}];}_0x4bf52e=_[_0xcd24('0x3c')]({},_0x4bf52e,_0x153575['options']);return db[_0xcd24('0x2e')][_0xcd24('0x48')](_0x4bf52e)[_0xcd24('0x21')](handleEntityNotFound(_0x1ce4e1,null))[_0xcd24('0x21')](respondWithResult(_0x1ce4e1,null))[_0xcd24('0x44')](handleError(_0x1ce4e1,null));};exports[_0xcd24('0x49')]=function(_0x36e876,_0x2eec87){return db[_0xcd24('0x2e')]['describe']()['then'](respondWithResult(_0x2eec87,null))[_0xcd24('0x44')](handleError(_0x2eec87,null));};exports[_0xcd24('0x20')]=function(_0x1b78f8,_0x5da38c){if(_0x1b78f8[_0xcd24('0x4a')][_0xcd24('0x4b')]){delete _0x1b78f8['body'][_0xcd24('0x4b')];}return db[_0xcd24('0x2e')][_0xcd24('0x48')]({'where':{'uniqueid':_0x1b78f8[_0xcd24('0x46')]['id']}})[_0xcd24('0x21')](handleEntityNotFound(_0x5da38c,null))[_0xcd24('0x21')](saveUpdates(_0x1b78f8[_0xcd24('0x4a')],null))[_0xcd24('0x21')](respondWithResult(_0x5da38c,null))[_0xcd24('0x44')](handleError(_0x5da38c,null));};exports[_0xcd24('0x4c')]=function(_0x35f32c,_0x4ca3d7,_0x154890){return db[_0xcd24('0x2e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x35f32c[_0xcd24('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xcd24('0x4d'),db['sequelize']['fn']('IF',db[_0xcd24('0x4e')]['literal'](_0xcd24('0x4f')))),_0xcd24('0x50')],[db[_0xcd24('0x4e')]['fn']('COUNT',db[_0xcd24('0x4e')]['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0xcd24('0x52')],[db[_0xcd24('0x4e')]['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')](_0xcd24('0x53')))),_0xcd24('0x54')],[db['sequelize']['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')]('`state`\x20=\x208,\x201,\x20null'))),_0xcd24('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')](_0xcd24('0x56')))),_0xcd24('0x57')],[db[_0xcd24('0x4e')]['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db['sequelize'][_0xcd24('0x51')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xcd24('0x58')],[db[_0xcd24('0x4e')]['fn'](_0xcd24('0x4d'),db['sequelize']['fn']('IF',db[_0xcd24('0x4e')]['literal'](_0xcd24('0x59')))),_0xcd24('0x5a')],[db[_0xcd24('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')](_0xcd24('0x5b')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x4ca3d7,null))[_0xcd24('0x21')](respondWithResult(_0x4ca3d7,null))[_0xcd24('0x44')](handleError(_0x4ca3d7,null));};exports[_0xcd24('0x5c')]=function(_0x3e88f0,_0x267110,_0x156458){return db[_0xcd24('0x2e')][_0xcd24('0x43')]({'raw':![],'where':{'CampaignId':_0x3e88f0[_0xcd24('0x46')]['id']},'attributes':[[db[_0xcd24('0x4e')]['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xcd24('0x50')],[db[_0xcd24('0x4e')]['fn']('COUNT',db[_0xcd24('0x4e')]['fn']('IF',db['sequelize'][_0xcd24('0x51')](_0xcd24('0x5d')))),_0xcd24('0x52')],[db[_0xcd24('0x4e')]['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')](_0xcd24('0x53')))),'busyContacts'],[db['sequelize']['fn'](_0xcd24('0x4d'),db['sequelize']['fn']('IF',db['sequelize'][_0xcd24('0x51')](_0xcd24('0x5e')))),_0xcd24('0x55')],[db[_0xcd24('0x4e')]['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db['sequelize'][_0xcd24('0x51')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xcd24('0x57')],[db[_0xcd24('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')](_0xcd24('0x5f')))),_0xcd24('0x58')],[db[_0xcd24('0x4e')]['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db[_0xcd24('0x4e')]['literal'](_0xcd24('0x59')))),_0xcd24('0x5a')],[db['sequelize']['fn'](_0xcd24('0x4d'),db[_0xcd24('0x4e')]['fn']('IF',db[_0xcd24('0x4e')][_0xcd24('0x51')](_0xcd24('0x5b')))),'answeringMachine']]})[_0xcd24('0x21')](handleEntityNotFound(_0x267110,null))[_0xcd24('0x21')](respondWithResult(_0x267110,null))['catch'](handleError(_0x267110,null));};exports[_0xcd24('0x60')]=function(_0x2878bc,_0x39110d,_0x4942e6){return db['VoiceQueue'][_0xcd24('0x48')]({'where':{'id':_0x2878bc[_0xcd24('0x46')]['id']}})[_0xcd24('0x21')](handleEntityNotFound(_0x39110d,null))[_0xcd24('0x21')](function(_0x5d6950){var _0x530aa3;if(_0x5d6950){_0x530aa3=squel[_0xcd24('0x61')]()[_0xcd24('0x62')](_0xcd24('0x63'))['fromQuery']([_0xcd24('0x64'),_0xcd24('0x65'),_0xcd24('0x66'),_0xcd24('0x67'),_0xcd24('0x68'),_0xcd24('0x69'),_0xcd24('0x6a')],squel[_0xcd24('0x6b')]()[_0xcd24('0x6c')](_0xcd24('0x6d'),'phone')[_0xcd24('0x6c')](_0xcd24('0x6e'),'scheduledAt')[_0xcd24('0x6c')](_0xcd24('0x6f'),_0xcd24('0x66'))['field'](_0xcd24('0x70'),_0xcd24('0x67'))['field'](_0xcd24('0x71'),'VoiceQueueId')[_0xcd24('0x6c')](_0xcd24('0x6e'),'createdAt')['field'](_0xcd24('0x6e'),_0xcd24('0x6a'))[_0xcd24('0x72')](_0xcd24('0x73'))[_0xcd24('0x3b')](_0xcd24('0x74'),_0x2878bc['params']['id']['toString']())[_0xcd24('0x3b')]('state\x20=\x20?',_0x2878bc[_0xcd24('0x4a')][_0xcd24('0x75')]['toString']())['where'](_0xcd24('0x76'))[_0xcd24('0x3b')](_0xcd24('0x77'),squel[_0xcd24('0x6b')]()[_0xcd24('0x6c')](_0xcd24('0x64'))['from'](_0xcd24('0x63'))[_0xcd24('0x3b')]('VoiceQueueId\x20=\x20?',_0x2878bc[_0xcd24('0x46')]['id'][_0xcd24('0x78')]()))['where'](_0xcd24('0x77'),squel[_0xcd24('0x6b')]()[_0xcd24('0x6c')](_0xcd24('0x79'))[_0xcd24('0x72')]('cm_hopper_final')['where'](_0xcd24('0x74'),_0x2878bc[_0xcd24('0x46')]['id'][_0xcd24('0x78')]())[_0xcd24('0x3b')]('state\x20=\x204'))[_0xcd24('0x7a')](_0xcd24('0x66')))['toString']();return db['sequelize'][_0xcd24('0x32')](_0x530aa3);}return[];})['then'](respondWithResult(_0x39110d,null))[_0xcd24('0x44')](handleError(_0x39110d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1e7786,_0xfcae44,_0x35a793){return db[_0xcd24('0x7b')][_0xcd24('0x48')]({'where':{'id':_0x1e7786['params']['id']}})[_0xcd24('0x21')](handleEntityNotFound(_0xfcae44,null))[_0xcd24('0x21')](function(_0x1e1958){var _0x5aebb2;if(_0x1e1958){_0x5aebb2=squel['insert']()[_0xcd24('0x62')](_0xcd24('0x63'))['fromQuery'](['phone',_0xcd24('0x65'),_0xcd24('0x66'),_0xcd24('0x67'),_0xcd24('0x7c'),_0xcd24('0x69'),_0xcd24('0x6a')],squel['select']()[_0xcd24('0x6c')]('ANY_VALUE(calleridnum)',_0xcd24('0x64'))[_0xcd24('0x6c')](_0xcd24('0x6e'),'scheduledAt')[_0xcd24('0x6c')](_0xcd24('0x6f'),_0xcd24('0x66'))[_0xcd24('0x6c')](_0xcd24('0x70'),'ListId')[_0xcd24('0x6c')](_0xcd24('0x7d'),_0xcd24('0x7c'))['field'](_0xcd24('0x6e'),_0xcd24('0x69'))['field'](_0xcd24('0x6e'),_0xcd24('0x6a'))[_0xcd24('0x72')](_0xcd24('0x73'))[_0xcd24('0x3b')](_0xcd24('0x7e'),_0x1e7786['params']['id']['toString']())[_0xcd24('0x3b')](_0xcd24('0x7f'),_0x1e7786['body']['state'][_0xcd24('0x78')]())['where'](_0xcd24('0x76'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xcd24('0x6c')](_0xcd24('0x64'))[_0xcd24('0x72')]('cm_hopper')[_0xcd24('0x3b')](_0xcd24('0x7e'),_0x1e7786[_0xcd24('0x46')]['id'][_0xcd24('0x78')]()))[_0xcd24('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcd24('0x6b')]()['field']('calleridnum')[_0xcd24('0x72')](_0xcd24('0x73'))[_0xcd24('0x3b')](_0xcd24('0x7e'),_0x1e7786[_0xcd24('0x46')]['id']['toString']())[_0xcd24('0x3b')](_0xcd24('0x80')))[_0xcd24('0x7a')](_0xcd24('0x66')))[_0xcd24('0x78')]();return db['sequelize']['query'](_0x5aebb2);}return[];})[_0xcd24('0x21')](respondWithResult(_0xfcae44,null))[_0xcd24('0x44')](handleError(_0xfcae44,null));};exports[_0xcd24('0x81')]=function(_0xcf4528,_0x1233e3,_0x27148a){return db[_0xcd24('0x82')][_0xcd24('0x83')]({'where':{'VoiceQueueId':_0xcf4528[_0xcd24('0x4a')]['VoiceQueueId'],'CampaignId':_0xcf4528[_0xcd24('0x4a')][_0xcd24('0x7c')],'ContactId':_0xcf4528[_0xcd24('0x4a')]['ContactId']}})[_0xcd24('0x21')](handleEntityNotFound(_0x1233e3,null))[_0xcd24('0x21')](function(_0x5d9f9b){if(_0x5d9f9b){return _0x5d9f9b;}return null;})[_0xcd24('0x21')](respondWithResult(_0x1233e3,null))[_0xcd24('0x44')](handleError(_0x1233e3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d06acbb..cd6f591 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.model.js +++ b/server/api/cmHopperFinal/cmHopperFinal.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb105=['uniqueid','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','calleridnum'];(function(_0x203e61,_0x2f08ce){var _0x13822a=function(_0x370910){while(--_0x370910){_0x203e61['push'](_0x203e61['shift']());}};_0x13822a(++_0x2f08ce);}(_0xb105,0x135));var _0x5b10=function(_0x273412,_0x578e4c){_0x273412=_0x273412-0x0;var _0x114851=_0xb105[_0x273412];return _0x114851;};'use strict';var _=require(_0x5b10('0x0'));var util=require('util');var logger=require(_0x5b10('0x1'))(_0x5b10('0x2'));var moment=require(_0x5b10('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b10('0x4'));var rimraf=require(_0x5b10('0x5'));var config=require(_0x5b10('0x6'));var attributes=require(_0x5b10('0x7'));module[_0x5b10('0x8')]=function(_0x5c5b8f,_0x145431){return _0x5c5b8f['define']('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x5b10('0x9'),'fields':[_0x5b10('0x9')]},{'name':_0x5b10('0xa'),'fields':[_0x5b10('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x891b=['bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api'];(function(_0x308c00,_0x3cbd67){var _0x2b21b2=function(_0x4ce3fc){while(--_0x4ce3fc){_0x308c00['push'](_0x308c00['shift']());}};_0x2b21b2(++_0x3cbd67);}(_0x891b,0x123));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb891('0x0'));var util=require('util');var logger=require(_0xb891('0x1'))(_0xb891('0x2'));var moment=require('moment');var BPromise=require(_0xb891('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb891('0x4'));var rimraf=require(_0xb891('0x5'));var config=require(_0xb891('0x6'));var attributes=require(_0xb891('0x7'));module[_0xb891('0x8')]=function(_0x1e6e7c,_0x406859){return _0x1e6e7c[_0xb891('0x9')](_0xb891('0xa'),attributes,{'tableName':_0xb891('0xb'),'paranoid':![],'indexes':[{'name':_0xb891('0xc'),'fields':[_0xb891('0xc')]},{'name':_0xb891('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 2607829..a7f1d80 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e07=['http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x58b93b,_0x9ba2b0){var _0x875fd0=function(_0x2c2c53){while(--_0x2c2c53){_0x58b93b['push'](_0x58b93b['shift']());}};_0x875fd0(++_0x9ba2b0);}(_0x4e07,0x1ee));var _0x74e0=function(_0x4d5a9d,_0x5d732b){_0x4d5a9d=_0x4d5a9d-0x0;var _0x4f1911=_0x4e07[_0x4d5a9d];return _0x4f1911;};'use strict';var _=require(_0x74e0('0x0'));var util=require(_0x74e0('0x1'));var moment=require('moment');var BPromise=require(_0x74e0('0x2'));var rs=require(_0x74e0('0x3'));var fs=require('fs');var Redis=require(_0x74e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74e0('0x5'));var logger=require(_0x74e0('0x6'))(_0x74e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x74e0('0x8'));var client=jayson[_0x74e0('0x9')][_0x74e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a78a,_0x317e19,_0x3b45c1){return new BPromise(function(_0x4b8aa4,_0x4df14f){return client[_0x74e0('0xb')](_0x16a78a,_0x3b45c1)[_0x74e0('0xc')](function(_0x56e8b6){logger['info'](_0x74e0('0xd'),_0x317e19,_0x74e0('0xe'));logger[_0x74e0('0xf')](_0x74e0('0x10'),_0x317e19,_0x74e0('0xe'),JSON[_0x74e0('0x11')](_0x56e8b6));if(_0x56e8b6[_0x74e0('0x12')]){if(_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x13')]===0x1f4){logger[_0x74e0('0x12')](_0x74e0('0xd'),_0x317e19,_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x14')]);return _0x4df14f(_0x56e8b6['error'][_0x74e0('0x14')]);}logger[_0x74e0('0x12')](_0x74e0('0xd'),_0x317e19,_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x14')]);return _0x4b8aa4(_0x56e8b6[_0x74e0('0x12')][_0x74e0('0x14')]);}else{logger[_0x74e0('0x15')]('CmHopperFinal,\x20%s,\x20%s',_0x317e19,_0x74e0('0xe'));_0x4b8aa4(_0x56e8b6['result']['message']);}})[_0x74e0('0x16')](function(_0x4225a8){logger[_0x74e0('0x12')](_0x74e0('0xd'),_0x317e19,_0x4225a8);_0x4df14f(_0x4225a8);});});}exports[_0x74e0('0x17')]=function(_0x4d5fce){var _0x2255f7=this;return new Promise(function(_0x176f9b,_0x2a15b5){return db[_0x74e0('0x18')][_0x74e0('0x19')](_0x4d5fce[_0x74e0('0x1a')],{'raw':_0x4d5fce[_0x74e0('0x1b')]?_0x4d5fce['options']['raw']===undefined?!![]:![]:!![]})[_0x74e0('0xc')](function(_0x5f0bd1){logger[_0x74e0('0x15')]('CreateCmHopperFinal',_0x4d5fce);logger[_0x74e0('0xf')]('CreateCmHopperFinal',_0x4d5fce,JSON[_0x74e0('0x11')](_0x5f0bd1));_0x176f9b(_0x5f0bd1);})['catch'](function(_0x16b13e){logger[_0x74e0('0x12')](_0x74e0('0x17'),_0x16b13e[_0x74e0('0x14')],_0x4d5fce);_0x2a15b5(_0x2255f7['error'](0x1f4,_0x16b13e[_0x74e0('0x14')]));});});}; \ No newline at end of file +var _0x1b06=['create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal'];(function(_0x528633,_0x3a1579){var _0x1bd2fe=function(_0x4f5f68){while(--_0x4f5f68){_0x528633['push'](_0x528633['shift']());}};_0x1bd2fe(++_0x3a1579);}(_0x1b06,0xd7));var _0x61b0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1b06[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x61b0('0x0'));var util=require(_0x61b0('0x1'));var moment=require(_0x61b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x61b0('0x3'));var fs=require('fs');var Redis=require(_0x61b0('0x4'));var db=require(_0x61b0('0x5'))['db'];var utils=require(_0x61b0('0x6'));var logger=require(_0x61b0('0x7'))(_0x61b0('0x8'));var config=require(_0x61b0('0x9'));var jayson=require(_0x61b0('0xa'));var client=jayson[_0x61b0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ab8a7,_0x5811ce,_0x5a000b){return new BPromise(function(_0x140be5,_0x24fb54){return client[_0x61b0('0xc')](_0x4ab8a7,_0x5a000b)[_0x61b0('0xd')](function(_0x4ba65e){logger['info'](_0x61b0('0xe'),_0x5811ce,_0x61b0('0xf'));logger['debug'](_0x61b0('0x10'),_0x5811ce,'request\x20sent',JSON[_0x61b0('0x11')](_0x4ba65e));if(_0x4ba65e[_0x61b0('0x12')]){if(_0x4ba65e['error'][_0x61b0('0x13')]===0x1f4){logger['error'](_0x61b0('0xe'),_0x5811ce,_0x4ba65e['error']['message']);return _0x24fb54(_0x4ba65e['error'][_0x61b0('0x14')]);}logger[_0x61b0('0x12')](_0x61b0('0xe'),_0x5811ce,_0x4ba65e[_0x61b0('0x12')][_0x61b0('0x14')]);return _0x140be5(_0x4ba65e['error'][_0x61b0('0x14')]);}else{logger['info'](_0x61b0('0xe'),_0x5811ce,'request\x20sent');_0x140be5(_0x4ba65e[_0x61b0('0x15')][_0x61b0('0x14')]);}})[_0x61b0('0x16')](function(_0x23153a){logger[_0x61b0('0x12')](_0x61b0('0xe'),_0x5811ce,_0x23153a);_0x24fb54(_0x23153a);});});}exports[_0x61b0('0x17')]=function(_0x1d6691){var _0x49cf05=this;return new Promise(function(_0x854f4c,_0x3f3a29){return db[_0x61b0('0x18')][_0x61b0('0x19')](_0x1d6691[_0x61b0('0x1a')],{'raw':_0x1d6691['options']?_0x1d6691[_0x61b0('0x1b')][_0x61b0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x299f05){logger['info']('CreateCmHopperFinal',_0x1d6691);logger[_0x61b0('0x1d')](_0x61b0('0x17'),_0x1d6691,JSON[_0x61b0('0x11')](_0x299f05));_0x854f4c(_0x299f05);})[_0x61b0('0x16')](function(_0x2c1e31){logger[_0x61b0('0x12')](_0x61b0('0x17'),_0x2c1e31[_0x61b0('0x14')],_0x1d6691);_0x3f3a29(_0x49cf05['error'](0x1f4,_0x2c1e31[_0x61b0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f9cf834..dee927b 100644 --- a/server/api/cmHopperFinal/index.js +++ b/server/api/cmHopperFinal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcaa=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xdcaa,0x127));var _0xadca=function(_0x219375,_0x376e0d){_0x219375=_0x219375-0x0;var _0x56ef25=_0xdcaa[_0x219375];return _0x56ef25;};'use strict';var multer=require(_0xadca('0x0'));var util=require('util');var path=require(_0xadca('0x1'));var timeout=require(_0xadca('0x2'));var express=require(_0xadca('0x3'));var router=express['Router']();var fs_extra=require(_0xadca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadca('0x5'));var config=require(_0xadca('0x6'));var controller=require(_0xadca('0x7'));router[_0xadca('0x8')]('/',auth[_0xadca('0x9')](),controller[_0xadca('0xa')]);router['get'](_0xadca('0xb'),auth[_0xadca('0x9')](),controller[_0xadca('0xc')]);router[_0xadca('0x8')](_0xadca('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xadca('0x8')]('/voice/queue/countAttributes/:id',auth[_0xadca('0x9')](),controller[_0xadca('0xe')]);router[_0xadca('0x8')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xadca('0xf')]);router[_0xadca('0x10')]('/voice/queue/moveContacts/:id',auth[_0xadca('0x9')](),controller[_0xadca('0x11')]);router[_0xadca('0x10')](_0xadca('0x12'),auth[_0xadca('0x9')](),controller[_0xadca('0x13')]);router['post'](_0xadca('0x14'),auth[_0xadca('0x9')](),controller[_0xadca('0x15')]);router[_0xadca('0x16')]('/:id',auth[_0xadca('0x9')](),controller[_0xadca('0x17')]);module[_0xadca('0x18')]=router; \ No newline at end of file +var _0xbad7=['/checkContactHopper','checkContactHopper','put','update','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xbad7,0x9a));var _0x7bad=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xbad7[_0x152121];return _0x592a85;};'use strict';var multer=require('multer');var util=require(_0x7bad('0x0'));var path=require(_0x7bad('0x1'));var timeout=require(_0x7bad('0x2'));var express=require(_0x7bad('0x3'));var router=express[_0x7bad('0x4')]();var fs_extra=require(_0x7bad('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7bad('0x6'));var controller=require(_0x7bad('0x7'));router[_0x7bad('0x8')]('/',auth[_0x7bad('0x9')](),controller[_0x7bad('0xa')]);router[_0x7bad('0x8')](_0x7bad('0xb'),auth[_0x7bad('0x9')](),controller[_0x7bad('0xc')]);router[_0x7bad('0x8')](_0x7bad('0xd'),auth[_0x7bad('0x9')](),controller[_0x7bad('0xe')]);router['get'](_0x7bad('0xf'),auth[_0x7bad('0x9')](),controller[_0x7bad('0x10')]);router['get']('/campaign/countAttributes/:id',auth[_0x7bad('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x7bad('0x11'),auth[_0x7bad('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x7bad('0x12')](_0x7bad('0x13'),auth[_0x7bad('0x9')](),controller[_0x7bad('0x14')]);router[_0x7bad('0x12')](_0x7bad('0x15'),auth['isAuthenticated'](),controller[_0x7bad('0x16')]);router[_0x7bad('0x17')](_0x7bad('0xd'),auth[_0x7bad('0x9')](),controller[_0x7bad('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b4de428..3382902 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.attributes.js +++ b/server/api/cmHopperHistory/cmHopperHistory.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7a4=['DATE','BOOLEAN','exports','INTEGER','STRING'];(function(_0x491199,_0x42e8f5){var _0x36c9cd=function(_0x2a1d3f){while(--_0x2a1d3f){_0x491199['push'](_0x491199['shift']());}};_0x36c9cd(++_0x42e8f5);}(_0xf7a4,0x1ab));var _0x4f7a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xf7a4[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require('sequelize');module[_0x4f7a('0x0')]={'state':{'type':Sequelize[_0x4f7a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4f7a('0x2')]},'scheduledat':{'type':Sequelize[_0x4f7a('0x3')]},'countbusyretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4f7a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4f7a('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4f7a('0x2')]},'calleridnum':{'type':Sequelize[_0x4f7a('0x2')]},'calleridname':{'type':Sequelize[_0x4f7a('0x2')]},'starttime':{'type':Sequelize[_0x4f7a('0x3')]},'responsetime':{'type':Sequelize[_0x4f7a('0x3')]},'answertime':{'type':Sequelize[_0x4f7a('0x3')]},'droptime':{'type':Sequelize[_0x4f7a('0x3')]},'endtime':{'type':Sequelize[_0x4f7a('0x3')]},'ringtime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4f7a('0x2')]},'campaign':{'type':Sequelize[_0x4f7a('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4f7a('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x4f7a('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4f7a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4f7a('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4f7a('0x3')]},'edited':{'type':Sequelize[_0x4f7a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4f7a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5de3=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x4bfe20,_0x875b9f){var _0x113040=function(_0x4107b1){while(--_0x4107b1){_0x4bfe20['push'](_0x4bfe20['shift']());}};_0x113040(++_0x875b9f);}(_0x5de3,0x130));var _0x35de=function(_0x14bcdf,_0x19c402){_0x14bcdf=_0x14bcdf-0x0;var _0x3605fc=_0x5de3[_0x14bcdf];return _0x3605fc;};'use strict';var Sequelize=require(_0x35de('0x0'));module[_0x35de('0x1')]={'state':{'type':Sequelize[_0x35de('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x35de('0x3')]},'scheduledat':{'type':Sequelize[_0x35de('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x35de('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x35de('0x3')]},'calleridnum':{'type':Sequelize[_0x35de('0x3')]},'calleridname':{'type':Sequelize[_0x35de('0x3')]},'starttime':{'type':Sequelize[_0x35de('0x4')]},'responsetime':{'type':Sequelize[_0x35de('0x4')]},'answertime':{'type':Sequelize[_0x35de('0x4')]},'droptime':{'type':Sequelize[_0x35de('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x35de('0x3')]},'campaigntype':{'type':Sequelize[_0x35de('0x3')]},'membername':{'type':Sequelize[_0x35de('0x3')]},'reason':{'type':Sequelize[_0x35de('0x3')]},'amd':{'type':Sequelize[_0x35de('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x35de('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x35de('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x35de('0x4')]},'edited':{'type':Sequelize[_0x35de('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x35de('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f2b47c4..7d1fb54 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.controller.js +++ b/server/api/cmHopperHistory/cmHopperHistory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','destroy','then','error','send','render','merge','message','agent','interaction','account','index','map','CmHopperHistory','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','update','uniqueid','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x43907c,_0x4ab831){var _0x42b194=function(_0x3e6552){while(--_0x3e6552){_0x43907c['push'](_0x43907c['shift']());}};_0x42b194(++_0x4ab831);}(_0x24ca,0x8c));var _0xa24c=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x24ca[_0x212bf5];return _0xfcad21;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa24c('0x1'));var rp=require('request-promise');var moment=require(_0xa24c('0x2'));var BPromise=require(_0xa24c('0x3'));var Mustache=require(_0xa24c('0x4'));var util=require('util');var path=require(_0xa24c('0x5'));var sox=require(_0xa24c('0x6'));var csv=require(_0xa24c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0x7'));var querystring=require(_0xa24c('0xc'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xd'));var authService=require(_0xa24c('0xe'));var qs=require(_0xa24c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x10'))(_0xa24c('0x11'));var utils=require(_0xa24c('0x12'));var config=require(_0xa24c('0x13'));var licenseUtil=require(_0xa24c('0x14'));var db=require(_0xa24c('0x15'))['db'];function respondWithStatusCode(_0x566313,_0x5bb631){_0x5bb631=_0x5bb631||0xcc;return function(_0x4907f6){if(_0x4907f6){return _0x566313[_0xa24c('0x16')](_0x5bb631);}return _0x566313[_0xa24c('0x17')](_0x5bb631)[_0xa24c('0x18')]();};}function respondWithResult(_0x9fe9e3,_0x4351a8){_0x4351a8=_0x4351a8||0xc8;return function(_0x4971af){if(_0x4971af){return _0x9fe9e3[_0xa24c('0x17')](_0x4351a8)['json'](_0x4971af);}};}function respondWithFilteredResult(_0x493bcb,_0x588acf){return function(_0x2e8dc9){if(_0x2e8dc9){var _0x2a4270=typeof _0x588acf[_0xa24c('0x19')]===_0xa24c('0x1a')&&typeof _0x588acf[_0xa24c('0x1b')]===_0xa24c('0x1a');var _0x2197da=_0x2e8dc9[_0xa24c('0x1c')];var _0x14f0aa=_0x2a4270?0x0:_0x588acf[_0xa24c('0x19')];var _0x1970fc=_0x2a4270?_0x2e8dc9[_0xa24c('0x1c')]:_0x588acf[_0xa24c('0x19')]+_0x588acf[_0xa24c('0x1b')];var _0x5276b6;if(_0x1970fc>=_0x2197da){_0x1970fc=_0x2197da;_0x5276b6=0xc8;}else{_0x5276b6=0xce;}_0x493bcb[_0xa24c('0x17')](_0x5276b6);return _0x493bcb['set'](_0xa24c('0x1d'),_0x14f0aa+'-'+_0x1970fc+'/'+_0x2197da)[_0xa24c('0x1e')](_0x2e8dc9);}return null;};}function patchUpdates(_0x8c3949){return function(_0x37e20e){try{jsonpatch[_0xa24c('0x1f')](_0x37e20e,_0x8c3949,!![]);}catch(_0x416dea){return BPromise[_0xa24c('0x20')](_0x416dea);}return _0x37e20e[_0xa24c('0x21')]();};}function saveUpdates(_0xba710,_0x2ec5ad){return function(_0x2b471a){if(_0x2b471a){return _0x2b471a['update'](_0xba710)['then'](function(_0x10fa25){return _0x10fa25;});}return null;};}function removeEntity(_0xdd32a8,_0x316a68){return function(_0x1a04ff){if(_0x1a04ff){return _0x1a04ff[_0xa24c('0x22')]()[_0xa24c('0x23')](function(){_0xdd32a8[_0xa24c('0x17')](0xcc)[_0xa24c('0x18')]();});}};}function handleEntityNotFound(_0x304d6c,_0x4dc3dc){return function(_0x2290e1){if(!_0x2290e1){_0x304d6c['sendStatus'](0x194);}return _0x2290e1;};}function handleError(_0x1f347b,_0x256fbc){_0x256fbc=_0x256fbc||0x1f4;return function(_0x471421){logger[_0xa24c('0x24')](_0x471421['stack']);if(_0x471421['name']){delete _0x471421['name'];}_0x1f347b['status'](_0x256fbc)[_0xa24c('0x25')](_0x471421);};}function getMustacheRender(_0x39e0be,_0xab6197){return Mustache[_0xa24c('0x26')](_0x39e0be,_[_0xa24c('0x27')](_0xab6197['body'],{'contact':_0xab6197['contact'],'message':_0xab6197[_0xa24c('0x28')],'agent':_0xab6197[_0xa24c('0x29')],'interaction':_0xab6197[_0xa24c('0x2a')],'account':_0xab6197[_0xa24c('0x2b')]}))||'';}exports[_0xa24c('0x2c')]=function(_0x3f7102,_0xc0db8f){var _0x1e30a9={},_0x29f539={},_0x17a001={'count':0x0,'rows':[]};var _0x59526b=_[_0xa24c('0x2d')](db[_0xa24c('0x2e')]['rawAttributes'],function(_0x3c9649){return{'name':_0x3c9649[_0xa24c('0x2f')],'type':_0x3c9649[_0xa24c('0x30')][_0xa24c('0x31')]};});_0x29f539[_0xa24c('0x32')]=_[_0xa24c('0x2d')](_0x59526b,_0xa24c('0x33'));_0x29f539[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x3f7102[_0xa24c('0x34')]);_0x29f539['filters']=_['intersection'](_0x29f539['model'],_0x29f539[_0xa24c('0x34')]);_0x1e30a9['attributes']=_[_0xa24c('0x36')](_0x29f539[_0xa24c('0x32')],qs[_0xa24c('0x37')](_0x3f7102['query'][_0xa24c('0x37')]));_0x1e30a9[_0xa24c('0x38')]=_0x1e30a9[_0xa24c('0x38')]['length']?_0x1e30a9[_0xa24c('0x38')]:_0x29f539[_0xa24c('0x32')];if(!_0x3f7102['query'][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x1e30a9[_0xa24c('0x1b')]=qs['limit'](_0x3f7102[_0xa24c('0x34')][_0xa24c('0x1b')]);_0x1e30a9[_0xa24c('0x19')]=qs[_0xa24c('0x19')](_0x3f7102[_0xa24c('0x34')]['offset']);}_0x1e30a9[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x3f7102['query'][_0xa24c('0x3c')]);_0x1e30a9[_0xa24c('0x3d')]=qs[_0xa24c('0x3e')](_['pick'](_0x3f7102['query'],_0x29f539[_0xa24c('0x3e')]),_0x59526b);if(_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3f')]){_0x1e30a9[_0xa24c('0x3d')]=_[_0xa24c('0x27')](_0x1e30a9[_0xa24c('0x3d')],{'$or':_['map'](_0x59526b,function(_0x46c0bf){if(_0x46c0bf[_0xa24c('0x30')]!==_0xa24c('0x40')){var _0x137a1d={};_0x137a1d[_0x46c0bf['name']]={'$like':'%'+_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3f')]+'%'};return _0x137a1d;}})});}_0x1e30a9=_[_0xa24c('0x27')]({},_0x1e30a9,_0x3f7102[_0xa24c('0x41')]);var _0x103b50={'where':_0x1e30a9[_0xa24c('0x3d')]};return db[_0xa24c('0x2e')]['count'](_0x103b50)['then'](function(_0x22c57e){_0x17a001['count']=_0x22c57e;if(_0x3f7102[_0xa24c('0x34')]['includeAll']){_0x1e30a9[_0xa24c('0x42')]=[{'all':!![]}];}return db[_0xa24c('0x2e')][_0xa24c('0x43')](_0x1e30a9);})[_0xa24c('0x23')](function(_0x21328f){_0x17a001[_0xa24c('0x44')]=_0x21328f;return _0x17a001;})[_0xa24c('0x23')](respondWithFilteredResult(_0xc0db8f,_0x1e30a9))[_0xa24c('0x45')](handleError(_0xc0db8f,null));};exports[_0xa24c('0x46')]=function(_0x38791c,_0x45dd80){var _0x1f87b7={'raw':!![],'where':{'id':_0x38791c[_0xa24c('0x47')]['id']}},_0x2e2f06={};_0x2e2f06[_0xa24c('0x32')]=_[_0xa24c('0x35')](db['CmHopperHistory'][_0xa24c('0x48')]);_0x2e2f06[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x38791c['query']);_0x2e2f06[_0xa24c('0x3e')]=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x32')],_0x2e2f06[_0xa24c('0x34')]);_0x1f87b7['attributes']=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x32')],qs[_0xa24c('0x37')](_0x38791c[_0xa24c('0x34')][_0xa24c('0x37')]));_0x1f87b7[_0xa24c('0x38')]=_0x1f87b7[_0xa24c('0x38')][_0xa24c('0x49')]?_0x1f87b7[_0xa24c('0x38')]:_0x2e2f06[_0xa24c('0x32')];if(_0x38791c[_0xa24c('0x34')][_0xa24c('0x4a')]){_0x1f87b7[_0xa24c('0x42')]=[{'all':!![]}];}_0x1f87b7=_['merge']({},_0x1f87b7,_0x38791c[_0xa24c('0x41')]);return db['CmHopperHistory'][_0xa24c('0x4b')](_0x1f87b7)[_0xa24c('0x23')](handleEntityNotFound(_0x45dd80,null))[_0xa24c('0x23')](respondWithResult(_0x45dd80,null))[_0xa24c('0x45')](handleError(_0x45dd80,null));};exports[_0xa24c('0x4c')]=function(_0x42d84b,_0x338877){return db[_0xa24c('0x2e')][_0xa24c('0x4c')](_0x42d84b[_0xa24c('0x4d')],{})[_0xa24c('0x23')](respondWithResult(_0x338877,0xc9))[_0xa24c('0x45')](handleError(_0x338877,null));};exports[_0xa24c('0x4e')]=function(_0x5974b3,_0x19785a){return db[_0xa24c('0x2e')][_0xa24c('0x4e')]()[_0xa24c('0x23')](respondWithResult(_0x19785a,null))['catch'](handleError(_0x19785a,null));};exports[_0xa24c('0x4f')]=function(_0xd09fd4,_0x2a8182){if(_0xd09fd4['body']['uniqueid']){delete _0xd09fd4[_0xa24c('0x4d')][_0xa24c('0x50')];}return db['CmHopperHistory'][_0xa24c('0x4b')]({'where':{'uniqueid':_0xd09fd4[_0xa24c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a8182,null))[_0xa24c('0x23')](saveUpdates(_0xd09fd4['body'],null))['then'](respondWithResult(_0x2a8182,null))[_0xa24c('0x45')](handleError(_0x2a8182,null));}; \ No newline at end of file +var _0x32ef=['fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','merge','contact','message','agent','interaction','account','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','describe','body','uniqueid','eml-format','rimraf','zip-dir'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x32ef,0xf9));var _0xf32e=function(_0x19b2d1,_0x49d3c0){_0x19b2d1=_0x19b2d1-0x0;var _0x145b3c=_0x32ef[_0x19b2d1];return _0x145b3c;};'use strict';var emlformat=require(_0xf32e('0x0'));var rimraf=require(_0xf32e('0x1'));var zipdir=require(_0xf32e('0x2'));var jsonpatch=require(_0xf32e('0x3'));var rp=require(_0xf32e('0x4'));var moment=require(_0xf32e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf32e('0x6'));var util=require(_0xf32e('0x7'));var path=require('path');var sox=require(_0xf32e('0x8'));var csv=require(_0xf32e('0x9'));var ejs=require(_0xf32e('0xa'));var fs=require('fs');var fs_extra=require(_0xf32e('0xb'));var _=require(_0xf32e('0xc'));var squel=require(_0xf32e('0xd'));var crypto=require('crypto');var jsforce=require(_0xf32e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf32e('0x9'));var querystring=require(_0xf32e('0xf'));var Papa=require(_0xf32e('0x10'));var Redis=require(_0xf32e('0x11'));var authService=require(_0xf32e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf32e('0x13'));var hardwareService=require(_0xf32e('0x14'));var logger=require(_0xf32e('0x15'))(_0xf32e('0x16'));var utils=require(_0xf32e('0x17'));var config=require(_0xf32e('0x18'));var licenseUtil=require(_0xf32e('0x19'));var db=require(_0xf32e('0x1a'))['db'];function respondWithStatusCode(_0x319616,_0x1c1f52){_0x1c1f52=_0x1c1f52||0xcc;return function(_0xf7dc32){if(_0xf7dc32){return _0x319616['sendStatus'](_0x1c1f52);}return _0x319616[_0xf32e('0x1b')](_0x1c1f52)[_0xf32e('0x1c')]();};}function respondWithResult(_0x543072,_0x336e26){_0x336e26=_0x336e26||0xc8;return function(_0x35988d){if(_0x35988d){return _0x543072[_0xf32e('0x1b')](_0x336e26)['json'](_0x35988d);}};}function respondWithFilteredResult(_0xe324ad,_0x299efa){return function(_0x1dd008){if(_0x1dd008){var _0x400d25=typeof _0x299efa[_0xf32e('0x1d')]===_0xf32e('0x1e')&&typeof _0x299efa[_0xf32e('0x1f')]===_0xf32e('0x1e');var _0x21aa73=_0x1dd008['count'];var _0x3510ec=_0x400d25?0x0:_0x299efa[_0xf32e('0x1d')];var _0xb828b8=_0x400d25?_0x1dd008[_0xf32e('0x20')]:_0x299efa[_0xf32e('0x1d')]+_0x299efa[_0xf32e('0x1f')];var _0x2f909b;if(_0xb828b8>=_0x21aa73){_0xb828b8=_0x21aa73;_0x2f909b=0xc8;}else{_0x2f909b=0xce;}_0xe324ad[_0xf32e('0x1b')](_0x2f909b);return _0xe324ad[_0xf32e('0x21')](_0xf32e('0x22'),_0x3510ec+'-'+_0xb828b8+'/'+_0x21aa73)[_0xf32e('0x23')](_0x1dd008);}return null;};}function patchUpdates(_0x1b169e){return function(_0x3202e1){try{jsonpatch[_0xf32e('0x24')](_0x3202e1,_0x1b169e,!![]);}catch(_0x5f2e99){return BPromise['reject'](_0x5f2e99);}return _0x3202e1[_0xf32e('0x25')]();};}function saveUpdates(_0x57a8cb,_0x27b92c){return function(_0x2aaabf){if(_0x2aaabf){return _0x2aaabf[_0xf32e('0x26')](_0x57a8cb)[_0xf32e('0x27')](function(_0x35e34c){return _0x35e34c;});}return null;};}function removeEntity(_0x5409b4,_0x227405){return function(_0x4407f8){if(_0x4407f8){return _0x4407f8[_0xf32e('0x28')]()[_0xf32e('0x27')](function(){_0x5409b4['status'](0xcc)[_0xf32e('0x1c')]();});}};}function handleEntityNotFound(_0x1eb413,_0x2e8c34){return function(_0xe0a285){if(!_0xe0a285){_0x1eb413[_0xf32e('0x29')](0x194);}return _0xe0a285;};}function handleError(_0x15103f,_0x2f925b){_0x2f925b=_0x2f925b||0x1f4;return function(_0x1eb42e){logger[_0xf32e('0x2a')](_0x1eb42e[_0xf32e('0x2b')]);if(_0x1eb42e['name']){delete _0x1eb42e[_0xf32e('0x2c')];}_0x15103f[_0xf32e('0x1b')](_0x2f925b)[_0xf32e('0x2d')](_0x1eb42e);};}function getMustacheRender(_0x4a873c,_0x419d13){return Mustache['render'](_0x4a873c,_[_0xf32e('0x2e')](_0x419d13['body'],{'contact':_0x419d13[_0xf32e('0x2f')],'message':_0x419d13[_0xf32e('0x30')],'agent':_0x419d13[_0xf32e('0x31')],'interaction':_0x419d13[_0xf32e('0x32')],'account':_0x419d13[_0xf32e('0x33')]}))||'';}exports['index']=function(_0x2e2ea4,_0x1d3c7a){var _0x175096={},_0x498c9c={},_0x2fa18d={'count':0x0,'rows':[]};var _0x251bf6=_[_0xf32e('0x34')](db[_0xf32e('0x35')][_0xf32e('0x36')],function(_0x3f4362){return{'name':_0x3f4362[_0xf32e('0x37')],'type':_0x3f4362[_0xf32e('0x38')][_0xf32e('0x39')]};});_0x498c9c[_0xf32e('0x3a')]=_[_0xf32e('0x34')](_0x251bf6,_0xf32e('0x2c'));_0x498c9c[_0xf32e('0x3b')]=_['keys'](_0x2e2ea4[_0xf32e('0x3b')]);_0x498c9c['filters']=_[_0xf32e('0x3c')](_0x498c9c['model'],_0x498c9c['query']);_0x175096[_0xf32e('0x3d')]=_[_0xf32e('0x3c')](_0x498c9c[_0xf32e('0x3a')],qs[_0xf32e('0x3e')](_0x2e2ea4[_0xf32e('0x3b')]['fields']));_0x175096[_0xf32e('0x3d')]=_0x175096[_0xf32e('0x3d')][_0xf32e('0x3f')]?_0x175096[_0xf32e('0x3d')]:_0x498c9c['model'];if(!_0x2e2ea4[_0xf32e('0x3b')][_0xf32e('0x40')](_0xf32e('0x41'))){_0x175096[_0xf32e('0x1f')]=qs[_0xf32e('0x1f')](_0x2e2ea4['query'][_0xf32e('0x1f')]);_0x175096[_0xf32e('0x1d')]=qs[_0xf32e('0x1d')](_0x2e2ea4['query'][_0xf32e('0x1d')]);}_0x175096['order']=qs[_0xf32e('0x42')](_0x2e2ea4[_0xf32e('0x3b')][_0xf32e('0x42')]);_0x175096['where']=qs[_0xf32e('0x43')](_[_0xf32e('0x44')](_0x2e2ea4[_0xf32e('0x3b')],_0x498c9c[_0xf32e('0x43')]),_0x251bf6);if(_0x2e2ea4[_0xf32e('0x3b')][_0xf32e('0x45')]){_0x175096['where']=_[_0xf32e('0x2e')](_0x175096[_0xf32e('0x46')],{'$or':_[_0xf32e('0x34')](_0x251bf6,function(_0x1f258b){if(_0x1f258b[_0xf32e('0x38')]!==_0xf32e('0x47')){var _0x399a04={};_0x399a04[_0x1f258b['name']]={'$like':'%'+_0x2e2ea4[_0xf32e('0x3b')][_0xf32e('0x45')]+'%'};return _0x399a04;}})});}_0x175096=_[_0xf32e('0x2e')]({},_0x175096,_0x2e2ea4[_0xf32e('0x48')]);var _0x1576a1={'where':_0x175096[_0xf32e('0x46')]};return db[_0xf32e('0x35')]['count'](_0x1576a1)[_0xf32e('0x27')](function(_0x43882c){_0x2fa18d[_0xf32e('0x20')]=_0x43882c;if(_0x2e2ea4[_0xf32e('0x3b')][_0xf32e('0x49')]){_0x175096[_0xf32e('0x4a')]=[{'all':!![]}];}return db[_0xf32e('0x35')][_0xf32e('0x4b')](_0x175096);})[_0xf32e('0x27')](function(_0xc2b51a){_0x2fa18d['rows']=_0xc2b51a;return _0x2fa18d;})[_0xf32e('0x27')](respondWithFilteredResult(_0x1d3c7a,_0x175096))[_0xf32e('0x4c')](handleError(_0x1d3c7a,null));};exports[_0xf32e('0x4d')]=function(_0x2146e8,_0x159dfd){var _0x120410={'raw':!![],'where':{'id':_0x2146e8[_0xf32e('0x4e')]['id']}},_0x58f8d5={};_0x58f8d5[_0xf32e('0x3a')]=_[_0xf32e('0x4f')](db[_0xf32e('0x35')][_0xf32e('0x36')]);_0x58f8d5['query']=_[_0xf32e('0x4f')](_0x2146e8['query']);_0x58f8d5[_0xf32e('0x43')]=_[_0xf32e('0x3c')](_0x58f8d5['model'],_0x58f8d5[_0xf32e('0x3b')]);_0x120410['attributes']=_['intersection'](_0x58f8d5['model'],qs[_0xf32e('0x3e')](_0x2146e8[_0xf32e('0x3b')][_0xf32e('0x3e')]));_0x120410[_0xf32e('0x3d')]=_0x120410[_0xf32e('0x3d')][_0xf32e('0x3f')]?_0x120410[_0xf32e('0x3d')]:_0x58f8d5[_0xf32e('0x3a')];if(_0x2146e8[_0xf32e('0x3b')][_0xf32e('0x49')]){_0x120410[_0xf32e('0x4a')]=[{'all':!![]}];}_0x120410=_[_0xf32e('0x2e')]({},_0x120410,_0x2146e8[_0xf32e('0x48')]);return db[_0xf32e('0x35')]['find'](_0x120410)[_0xf32e('0x27')](handleEntityNotFound(_0x159dfd,null))[_0xf32e('0x27')](respondWithResult(_0x159dfd,null))[_0xf32e('0x4c')](handleError(_0x159dfd,null));};exports['create']=function(_0x49b1f7,_0x49e5a1){return db[_0xf32e('0x35')][_0xf32e('0x50')](_0x49b1f7['body'],{})[_0xf32e('0x27')](respondWithResult(_0x49e5a1,0xc9))[_0xf32e('0x4c')](handleError(_0x49e5a1,null));};exports['describe']=function(_0x5b1841,_0x11ecb6){return db[_0xf32e('0x35')][_0xf32e('0x51')]()[_0xf32e('0x27')](respondWithResult(_0x11ecb6,null))[_0xf32e('0x4c')](handleError(_0x11ecb6,null));};exports['update']=function(_0x412def,_0xcd2fc2){if(_0x412def[_0xf32e('0x52')]['uniqueid']){delete _0x412def[_0xf32e('0x52')][_0xf32e('0x53')];}return db[_0xf32e('0x35')]['find']({'where':{'uniqueid':_0x412def['params']['id']}})['then'](handleEntityNotFound(_0xcd2fc2,null))[_0xf32e('0x27')](saveUpdates(_0x412def[_0xf32e('0x52')],null))[_0xf32e('0x27')](respondWithResult(_0xcd2fc2,null))[_0xf32e('0x4c')](handleError(_0xcd2fc2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 8064d57..336d714 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.model.js +++ b/server/api/cmHopperHistory/cmHopperHistory.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb361=['path','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','util','../../config/logger','bluebird','request-promise'];(function(_0x33d5f1,_0x10a37b){var _0x54a379=function(_0x5803ca){while(--_0x5803ca){_0x33d5f1['push'](_0x33d5f1['shift']());}};_0x54a379(++_0x10a37b);}(_0xb361,0x17c));var _0x1b36=function(_0x9a0cd8,_0x4af85b){_0x9a0cd8=_0x9a0cd8-0x0;var _0x11179b=_0xb361[_0x9a0cd8];return _0x11179b;};'use strict';var _=require('lodash');var util=require(_0x1b36('0x0'));var logger=require(_0x1b36('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b36('0x2'));var rp=require(_0x1b36('0x3'));var fs=require('fs');var path=require(_0x1b36('0x4'));var rimraf=require(_0x1b36('0x5'));var config=require(_0x1b36('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x1b36('0x7')]=function(_0x4e97ba,_0x3a6920){return _0x4e97ba[_0x1b36('0x8')](_0x1b36('0x9'),attributes,{'tableName':_0x1b36('0xa'),'paranoid':![],'indexes':[{'name':_0x1b36('0xb'),'fields':['endtime']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0eb8=['uniqueid','api','moment','bluebird','path','../../config/environment','./cmHopperHistory.attributes','exports','endtime'];(function(_0x309c1f,_0x8b0838){var _0x36e68c=function(_0x2f1054){while(--_0x2f1054){_0x309c1f['push'](_0x309c1f['shift']());}};_0x36e68c(++_0x8b0838);}(_0x0eb8,0xc7));var _0x80eb=function(_0x5e1511,_0x4ca465){_0x5e1511=_0x5e1511-0x0;var _0x3f3168=_0x0eb8[_0x5e1511];return _0x3f3168;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x80eb('0x0'));var moment=require(_0x80eb('0x1'));var BPromise=require(_0x80eb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80eb('0x3'));var rimraf=require('rimraf');var config=require(_0x80eb('0x4'));var attributes=require(_0x80eb('0x5'));module[_0x80eb('0x6')]=function(_0x3e6959,_0xd6742f){return _0x3e6959['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x80eb('0x7'),'fields':[_0x80eb('0x7')]},{'name':'uniqueid','fields':[_0x80eb('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 931bba2..336cedc 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38b6=['error','code','message','info','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x256662,_0xcbc858){var _0x2a7aaa=function(_0x5d40ca){while(--_0x5d40ca){_0x256662['push'](_0x256662['shift']());}};_0x2a7aaa(++_0xcbc858);}(_0x38b6,0x177));var _0x638b=function(_0x1595ae,_0x18356c){_0x1595ae=_0x1595ae-0x0;var _0x47e6e2=_0x38b6[_0x1595ae];return _0x47e6e2;};'use strict';var _=require(_0x638b('0x0'));var util=require(_0x638b('0x1'));var moment=require(_0x638b('0x2'));var BPromise=require(_0x638b('0x3'));var rs=require(_0x638b('0x4'));var fs=require('fs');var Redis=require(_0x638b('0x5'));var db=require(_0x638b('0x6'))['db'];var utils=require(_0x638b('0x7'));var logger=require(_0x638b('0x8'))(_0x638b('0x9'));var config=require(_0x638b('0xa'));var jayson=require(_0x638b('0xb'));var client=jayson[_0x638b('0xc')][_0x638b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x34a362,_0x3d8c49,_0x57388c){return new BPromise(function(_0x4dffae,_0x401498){return client[_0x638b('0xe')](_0x34a362,_0x57388c)[_0x638b('0xf')](function(_0x510a9d){logger['info'](_0x638b('0x10'),_0x3d8c49,'request\x20sent');logger[_0x638b('0x11')](_0x638b('0x12'),_0x3d8c49,_0x638b('0x13'),JSON[_0x638b('0x14')](_0x510a9d));if(_0x510a9d['error']){if(_0x510a9d[_0x638b('0x15')][_0x638b('0x16')]===0x1f4){logger['error'](_0x638b('0x10'),_0x3d8c49,_0x510a9d['error'][_0x638b('0x17')]);return _0x401498(_0x510a9d[_0x638b('0x15')][_0x638b('0x17')]);}logger[_0x638b('0x15')](_0x638b('0x10'),_0x3d8c49,_0x510a9d[_0x638b('0x15')][_0x638b('0x17')]);return _0x4dffae(_0x510a9d[_0x638b('0x15')][_0x638b('0x17')]);}else{logger[_0x638b('0x18')](_0x638b('0x10'),_0x3d8c49,_0x638b('0x13'));_0x4dffae(_0x510a9d['result']['message']);}})[_0x638b('0x19')](function(_0x52eedb){logger[_0x638b('0x15')](_0x638b('0x10'),_0x3d8c49,_0x52eedb);_0x401498(_0x52eedb);});});}exports[_0x638b('0x1a')]=function(_0x5c86a9){var _0x3bb367=this;return new Promise(function(_0x53cef7,_0x332cf1){return db[_0x638b('0x1b')]['create'](_0x5c86a9['body'],{'raw':_0x5c86a9['options']?_0x5c86a9[_0x638b('0x1c')][_0x638b('0x1d')]===undefined?!![]:![]:!![]})[_0x638b('0xf')](function(_0x5218d9){logger[_0x638b('0x18')](_0x638b('0x1a'),_0x5c86a9);logger[_0x638b('0x11')](_0x638b('0x1a'),_0x5c86a9,JSON[_0x638b('0x14')](_0x5218d9));_0x53cef7(_0x5218d9);})['catch'](function(_0x11fdb8){logger['error'](_0x638b('0x1a'),_0x11fdb8[_0x638b('0x17')],_0x5c86a9);_0x332cf1(_0x3bb367[_0x638b('0x15')](0x1f4,_0x11fdb8['message']));});});};exports[_0x638b('0x1e')]=function(_0x1e3fb7){var _0x56f3b9=this;return new Promise(function(_0x15a6e8,_0x2b5ef4){return db['CmHopperHistory'][_0x638b('0x1f')]({'raw':_0x1e3fb7['options']?_0x1e3fb7['options'][_0x638b('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e3fb7[_0x638b('0x1c')]?_0x1e3fb7['options']['where']||null:null,'attributes':[[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')][_0x638b('0x22')]('id')),_0x638b('0x23')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db['sequelize'][_0x638b('0x24')](_0x638b('0x25')))),_0x638b('0x26')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x28')))),_0x638b('0x29')],[db[_0x638b('0x20')]['fn']('AVG',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x638b('0x2a')],[db[_0x638b('0x20')]['fn']('AVG',db['sequelize']['fn']('IF',db['sequelize'][_0x638b('0x24')](_0x638b('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0x638b('0xf')](function(_0x17414c){logger[_0x638b('0x18')](_0x638b('0x1e'),_0x1e3fb7);logger[_0x638b('0x11')]('AvgHandleTime',_0x1e3fb7,JSON['stringify'](_0x17414c));_0x15a6e8(_0x17414c);})[_0x638b('0x19')](function(_0x50c9fa){logger[_0x638b('0x15')](_0x638b('0x1e'),_0x50c9fa[_0x638b('0x17')],_0x1e3fb7);_0x2b5ef4(_0x56f3b9[_0x638b('0x15')](0x1f4,_0x50c9fa[_0x638b('0x17')]));});});};exports[_0x638b('0x2c')]=function(_0x33cf15){var _0x108b30=this;return new Promise(function(_0xeb54ee,_0x54e1ce){return db[_0x638b('0x1b')][_0x638b('0x1f')]({'raw':_0x33cf15[_0x638b('0x1c')]?_0x33cf15[_0x638b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x33cf15[_0x638b('0x1c')]?_0x33cf15[_0x638b('0x1c')]['where']||null:null,'attributes':[[_0x638b('0x2d'),_0x638b('0x2e')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')]['literal'](_0x638b('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x30')))),_0x638b('0x31')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x25')))),'outboundAnswerCallsDay'],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x32')))),'outboundBusyCallsDay'],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')]['literal'](_0x638b('0x33')))),_0x638b('0x34')],[db[_0x638b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x35')))),_0x638b('0x36')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x638b('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x638b('0x37')))),'outboundUnknownCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x38')))),_0x638b('0x39')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x3a')))),_0x638b('0x3b')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0x638b('0x3d')],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0x638b('0x3e')],[db[_0x638b('0x20')]['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x638b('0x3f')]],'group':['campaign']})[_0x638b('0xf')](function(_0x2eeb19){logger[_0x638b('0x18')](_0x638b('0x2c'),_0x33cf15);logger[_0x638b('0x11')]('GetVoiceQueueHopperHistory',_0x33cf15,JSON['stringify'](_0x2eeb19));_0xeb54ee(_0x2eeb19);})[_0x638b('0x19')](function(_0x2b8975){logger[_0x638b('0x15')]('GetVoiceQueueHopperHistory',_0x2b8975[_0x638b('0x17')],_0x33cf15);_0x54e1ce(_0x108b30[_0x638b('0x15')](0x1f4,_0x2b8975[_0x638b('0x17')]));});});};exports[_0x638b('0x40')]=function(_0x47f844){var _0x43efdf=this;return new Promise(function(_0x5d25e2,_0x5d27f8){return db['CmHopperHistory'][_0x638b('0x1f')]({'raw':_0x47f844[_0x638b('0x1c')]?_0x47f844[_0x638b('0x1c')][_0x638b('0x1d')]===undefined?!![]:![]:!![],'where':_0x47f844[_0x638b('0x1c')]?_0x47f844[_0x638b('0x1c')]['where']||null:null,'attributes':[['campaign',_0x638b('0x2e')],[db['sequelize']['fn'](_0x638b('0x21'),db[_0x638b('0x20')]['col']('id')),'ivrTotalCallsDays'],[db[_0x638b('0x20')]['fn']('COUNT',db[_0x638b('0x20')]['fn']('IF',db[_0x638b('0x20')][_0x638b('0x24')](_0x638b('0x25')))),_0x638b('0x41')]],'group':[_0x638b('0x2d')]})[_0x638b('0xf')](function(_0x58d859){logger['info']('GetCampaignHopperHistory',_0x47f844);logger[_0x638b('0x11')](_0x638b('0x40'),_0x47f844,JSON[_0x638b('0x14')](_0x58d859));_0x5d25e2(_0x58d859);})['catch'](function(_0x225fba){logger[_0x638b('0x15')](_0x638b('0x40'),_0x225fba[_0x638b('0x17')],_0x47f844);_0x5d27f8(_0x43efdf[_0x638b('0x15')](0x1f4,_0x225fba[_0x638b('0x17')]));});});}; \ No newline at end of file +var _0xb75e=['predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','findAll','where','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','CmHopperHistory','create','body','options','raw','info','CreateCmHopperHistory','stringify','AvgHandleTime','sequelize','COUNT','col','`state`\x20=\x204,\x201,\x20null'];(function(_0x5e96e8,_0x3a9dad){var _0x489e49=function(_0x3f2685){while(--_0x3f2685){_0x5e96e8['push'](_0x5e96e8['shift']());}};_0x489e49(++_0x3a9dad);}(_0xb75e,0xfc));var _0xeb75=function(_0x6e0ebb,_0x415056){_0x6e0ebb=_0x6e0ebb-0x0;var _0x110839=_0xb75e[_0x6e0ebb];return _0x110839;};'use strict';var _=require(_0xeb75('0x0'));var util=require(_0xeb75('0x1'));var moment=require(_0xeb75('0x2'));var BPromise=require(_0xeb75('0x3'));var rs=require(_0xeb75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb75('0x5'))(_0xeb75('0x6'));var config=require('../../config/environment');var jayson=require(_0xeb75('0x7'));var client=jayson[_0xeb75('0x8')][_0xeb75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x72e4b,_0x2fc6de,_0x363ef2){return new BPromise(function(_0x2d2aa2,_0x12cd1e){return client[_0xeb75('0xa')](_0x72e4b,_0x363ef2)[_0xeb75('0xb')](function(_0xcc13e3){logger['info'](_0xeb75('0xc'),_0x2fc6de,'request\x20sent');logger[_0xeb75('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2fc6de,_0xeb75('0xe'),JSON['stringify'](_0xcc13e3));if(_0xcc13e3['error']){if(_0xcc13e3[_0xeb75('0xf')][_0xeb75('0x10')]===0x1f4){logger[_0xeb75('0xf')](_0xeb75('0xc'),_0x2fc6de,_0xcc13e3['error'][_0xeb75('0x11')]);return _0x12cd1e(_0xcc13e3[_0xeb75('0xf')][_0xeb75('0x11')]);}logger['error'](_0xeb75('0xc'),_0x2fc6de,_0xcc13e3['error']['message']);return _0x2d2aa2(_0xcc13e3[_0xeb75('0xf')]['message']);}else{logger['info'](_0xeb75('0xc'),_0x2fc6de,'request\x20sent');_0x2d2aa2(_0xcc13e3[_0xeb75('0x12')][_0xeb75('0x11')]);}})['catch'](function(_0x56e142){logger[_0xeb75('0xf')](_0xeb75('0xc'),_0x2fc6de,_0x56e142);_0x12cd1e(_0x56e142);});});}exports['CreateCmHopperHistory']=function(_0x3571b2){var _0x415460=this;return new Promise(function(_0x425253,_0x216320){return db[_0xeb75('0x13')][_0xeb75('0x14')](_0x3571b2[_0xeb75('0x15')],{'raw':_0x3571b2[_0xeb75('0x16')]?_0x3571b2[_0xeb75('0x16')][_0xeb75('0x17')]===undefined?!![]:![]:!![]})[_0xeb75('0xb')](function(_0x5d7cbb){logger[_0xeb75('0x18')](_0xeb75('0x19'),_0x3571b2);logger['debug'](_0xeb75('0x19'),_0x3571b2,JSON[_0xeb75('0x1a')](_0x5d7cbb));_0x425253(_0x5d7cbb);})['catch'](function(_0x1815c5){logger[_0xeb75('0xf')](_0xeb75('0x19'),_0x1815c5[_0xeb75('0x11')],_0x3571b2);_0x216320(_0x415460['error'](0x1f4,_0x1815c5[_0xeb75('0x11')]));});});};exports[_0xeb75('0x1b')]=function(_0x1e5f5e){var _0x52e696=this;return new Promise(function(_0x22e24d,_0x2397ee){return db[_0xeb75('0x13')]['findAll']({'raw':_0x1e5f5e[_0xeb75('0x16')]?_0x1e5f5e[_0xeb75('0x16')][_0xeb75('0x17')]===undefined?!![]:![]:!![],'where':_0x1e5f5e[_0xeb75('0x16')]?_0x1e5f5e[_0xeb75('0x16')]['where']||null:null,'attributes':[[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db[_0xeb75('0x1c')][_0xeb75('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xeb75('0x1f')))),_0xeb75('0x20')],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db['sequelize']['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0xeb75('0x22')],[db['sequelize']['fn'](_0xeb75('0x1d'),db['sequelize']['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x23')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xeb75('0x24'),db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xeb75('0x25')],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x24'),db[_0xeb75('0x1c')]['fn']('IF',db['sequelize']['literal'](_0xeb75('0x26')))),_0xeb75('0x27')]]})[_0xeb75('0xb')](function(_0x20886e){logger[_0xeb75('0x18')](_0xeb75('0x1b'),_0x1e5f5e);logger[_0xeb75('0xd')](_0xeb75('0x1b'),_0x1e5f5e,JSON[_0xeb75('0x1a')](_0x20886e));_0x22e24d(_0x20886e);})[_0xeb75('0x28')](function(_0x5c6aa4){logger[_0xeb75('0xf')]('AvgHandleTime',_0x5c6aa4[_0xeb75('0x11')],_0x1e5f5e);_0x2397ee(_0x52e696[_0xeb75('0xf')](0x1f4,_0x5c6aa4[_0xeb75('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5d8cac){var _0x4a74ba=this;return new Promise(function(_0x3ff256,_0x485311){return db[_0xeb75('0x13')][_0xeb75('0x29')]({'raw':_0x5d8cac['options']?_0x5d8cac[_0xeb75('0x16')][_0xeb75('0x17')]===undefined?!![]:![]:!![],'where':_0x5d8cac[_0xeb75('0x16')]?_0x5d8cac[_0xeb75('0x16')][_0xeb75('0x2a')]||null:null,'attributes':[['campaign','name'],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x2b')))),_0xeb75('0x2c')],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x2d')))),'outboundNoAnswerCallsDay'],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db[_0xeb75('0x1c')]['fn']('IF',db['sequelize'][_0xeb75('0x21')](_0xeb75('0x1f')))),_0xeb75('0x2e')],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')]['literal'](_0xeb75('0x2f')))),_0xeb75('0x30')],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')]('`state`\x20=\x208,\x201,\x20null'))),_0xeb75('0x31')],[db['sequelize']['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')]['literal'](_0xeb75('0x32')))),_0xeb75('0x33')],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xeb75('0x34')],[db['sequelize']['fn'](_0xeb75('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xeb75('0x21')](_0xeb75('0x35')))),_0xeb75('0x36')],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x37')))),_0xeb75('0x38')],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')]['literal'](_0xeb75('0x39')))),_0xeb75('0x3a')],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')]['literal'](_0xeb75('0x3b')))),_0xeb75('0x3c')],[db[_0xeb75('0x1c')]['fn'](_0xeb75('0x1d'),db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x3d')))),_0xeb75('0x3e')],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x3f')))),'outboundRejectCallsDay'],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x40')))),'outboundReCallsDay']],'group':[_0xeb75('0x41')]})[_0xeb75('0xb')](function(_0x4d8854){logger[_0xeb75('0x18')](_0xeb75('0x42'),_0x5d8cac);logger[_0xeb75('0xd')](_0xeb75('0x42'),_0x5d8cac,JSON[_0xeb75('0x1a')](_0x4d8854));_0x3ff256(_0x4d8854);})[_0xeb75('0x28')](function(_0x4beff1){logger[_0xeb75('0xf')]('GetVoiceQueueHopperHistory',_0x4beff1[_0xeb75('0x11')],_0x5d8cac);_0x485311(_0x4a74ba[_0xeb75('0xf')](0x1f4,_0x4beff1[_0xeb75('0x11')]));});});};exports[_0xeb75('0x43')]=function(_0x4892ea){var _0x54f6b1=this;return new Promise(function(_0x204ffb,_0x92a7cd){return db[_0xeb75('0x13')]['findAll']({'raw':_0x4892ea[_0xeb75('0x16')]?_0x4892ea[_0xeb75('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4892ea[_0xeb75('0x16')]?_0x4892ea[_0xeb75('0x16')][_0xeb75('0x2a')]||null:null,'attributes':[[_0xeb75('0x41'),_0xeb75('0x44')],[db[_0xeb75('0x1c')]['fn']('COUNT',db[_0xeb75('0x1c')][_0xeb75('0x1e')]('id')),_0xeb75('0x45')],[db['sequelize']['fn']('COUNT',db[_0xeb75('0x1c')]['fn']('IF',db[_0xeb75('0x1c')][_0xeb75('0x21')](_0xeb75('0x1f')))),_0xeb75('0x46')]],'group':[_0xeb75('0x41')]})[_0xeb75('0xb')](function(_0x460940){logger['info'](_0xeb75('0x43'),_0x4892ea);logger[_0xeb75('0xd')](_0xeb75('0x43'),_0x4892ea,JSON[_0xeb75('0x1a')](_0x460940));_0x204ffb(_0x460940);})[_0xeb75('0x28')](function(_0x3b9fa7){logger[_0xeb75('0xf')](_0xeb75('0x43'),_0x3b9fa7[_0xeb75('0x11')],_0x4892ea);_0x92a7cd(_0x54f6b1[_0xeb75('0xf')](0x1f4,_0x3b9fa7[_0xeb75('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e4b1e83..14b30b5 100644 --- a/server/api/cmHopperHistory/index.js +++ b/server/api/cmHopperHistory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b8c=['get','isAuthenticated','index','/:id','show','post','put','update','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperHistory.controller'];(function(_0x25dda3,_0x4c0e93){var _0x20b001=function(_0x50ac35){while(--_0x50ac35){_0x25dda3['push'](_0x25dda3['shift']());}};_0x20b001(++_0x4c0e93);}(_0x1b8c,0x134));var _0xc1b8=function(_0x38ef2d,_0x4d58ff){_0x38ef2d=_0x38ef2d-0x0;var _0x2de5ca=_0x1b8c[_0x38ef2d];return _0x2de5ca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1b8('0x0'));var timeout=require(_0xc1b8('0x1'));var express=require(_0xc1b8('0x2'));var router=express[_0xc1b8('0x3')]();var fs_extra=require(_0xc1b8('0x4'));var auth=require(_0xc1b8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1b8('0x6'));router[_0xc1b8('0x7')]('/',auth[_0xc1b8('0x8')](),controller[_0xc1b8('0x9')]);router[_0xc1b8('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc1b8('0x7')](_0xc1b8('0xa'),auth['isAuthenticated'](),controller[_0xc1b8('0xb')]);router[_0xc1b8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc1b8('0xd')]('/:id',auth[_0xc1b8('0x8')](),controller[_0xc1b8('0xe')]);module['exports']=router; \ No newline at end of file +var _0xae5b=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update','exports','multer','util','express','Router','fs-extra'];(function(_0x4634ca,_0x599fe5){var _0x3695d1=function(_0x1417db){while(--_0x1417db){_0x4634ca['push'](_0x4634ca['shift']());}};_0x3695d1(++_0x599fe5);}(_0xae5b,0xe9));var _0xbae5=function(_0x2d9b03,_0x538b7b){_0x2d9b03=_0x2d9b03-0x0;var _0x22296b=_0xae5b[_0x2d9b03];return _0x22296b;};'use strict';var multer=require(_0xbae5('0x0'));var util=require(_0xbae5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbae5('0x2'));var router=express[_0xbae5('0x3')]();var fs_extra=require(_0xbae5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbae5('0x5'));var controller=require(_0xbae5('0x6'));router[_0xbae5('0x7')]('/',auth[_0xbae5('0x8')](),controller[_0xbae5('0x9')]);router[_0xbae5('0x7')](_0xbae5('0xa'),auth[_0xbae5('0x8')](),controller[_0xbae5('0xb')]);router[_0xbae5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xbae5('0xc')]);router['post']('/',auth[_0xbae5('0x8')](),controller[_0xbae5('0xd')]);router[_0xbae5('0xe')]('/:id',auth[_0xbae5('0x8')](),controller[_0xbae5('0xf')]);module[_0xbae5('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 354b33f..e2f2c97 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e12=['STRING','sequelize','exports'];(function(_0x1c5765,_0x51d576){var _0x303166=function(_0x15fad6){while(--_0x15fad6){_0x1c5765['push'](_0x1c5765['shift']());}};_0x303166(++_0x51d576);}(_0x9e12,0xdc));var _0x29e1=function(_0x8590da,_0xbbe20f){_0x8590da=_0x8590da-0x0;var _0x203f0f=_0x9e12[_0x8590da];return _0x203f0f;};'use strict';var Sequelize=require(_0x29e1('0x0'));module[_0x29e1('0x1')]={'name':{'type':Sequelize[_0x29e1('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x29e1('0x2')]}}; \ No newline at end of file +var _0x889d=['exports','STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x889d,0x122));var _0xd889=function(_0x3857e2,_0x448f5f){_0x3857e2=_0x3857e2-0x0;var _0x26f8cd=_0x889d[_0x3857e2];return _0x26f8cd;};'use strict';var Sequelize=require(_0xd889('0x0'));module[_0xd889('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd889('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fd910e5..318bb99 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0092=['squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./cmList.socket','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','Lists','sendStatus','error','name','render','body','contact','message','interaction','account','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','params','keys','intersection','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','tags','join','each','CmContact','omit','push','dataValues','errors','Malformed\x20request\x20syntax','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','attachment;\x20filename=','setHeader','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','type','text','TEXT','number','INTEGER','queryInterface','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','removeAgents','isArray','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0xf9c2a4,_0x569900){var _0x1179e8=function(_0x32d20e){while(--_0x32d20e){_0xf9c2a4['push'](_0xf9c2a4['shift']());}};_0x1179e8(++_0x569900);}(_0x0092,0x123));var _0x2009=function(_0x5bde78,_0xef666d){_0x5bde78=_0x5bde78-0x0;var _0x587f12=_0x0092[_0x5bde78];return _0x587f12;};'use strict';var emlformat=require(_0x2009('0x0'));var rimraf=require(_0x2009('0x1'));var zipdir=require(_0x2009('0x2'));var jsonpatch=require(_0x2009('0x3'));var rp=require(_0x2009('0x4'));var moment=require('moment');var BPromise=require(_0x2009('0x5'));var Mustache=require(_0x2009('0x6'));var util=require(_0x2009('0x7'));var path=require(_0x2009('0x8'));var sox=require(_0x2009('0x9'));var csv=require('to-csv');var ejs=require(_0x2009('0xa'));var fs=require('fs');var fs_extra=require(_0x2009('0xb'));var _=require(_0x2009('0xc'));var squel=require(_0x2009('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2009('0xe'));var toCsv=require(_0x2009('0xf'));var querystring=require(_0x2009('0x10'));var Papa=require(_0x2009('0x11'));var Redis=require(_0x2009('0x12'));var authService=require(_0x2009('0x13'));var qs=require(_0x2009('0x14'));var as=require(_0x2009('0x15'));var hardwareService=require(_0x2009('0x16'));var logger=require(_0x2009('0x17'))('api');var utils=require(_0x2009('0x18'));var config=require(_0x2009('0x19'));var licenseUtil=require(_0x2009('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2009('0x1b')](config[_0x2009('0x1c')],{'host':_0x2009('0x1d'),'port':0x18eb});var socket=require(_0x2009('0x1e'))(new Redis(config['redis']));require(_0x2009('0x1f'))['register'](socket);function respondWithStatusCode(_0x5a1712,_0x2a357a){_0x2a357a=_0x2a357a||0xcc;return function(_0x5e44da){if(_0x5e44da){return _0x5a1712['sendStatus'](_0x2a357a);}return _0x5a1712[_0x2009('0x20')](_0x2a357a)[_0x2009('0x21')]();};}function respondWithResult(_0x4b0820,_0x4c7972){_0x4c7972=_0x4c7972||0xc8;return function(_0x58465){if(_0x58465){return _0x4b0820['status'](_0x4c7972)['json'](_0x58465);}};}function respondWithFilteredResult(_0x4e1646,_0x1d8b19){return function(_0x9967ac){if(_0x9967ac){var _0x4cd502=typeof _0x1d8b19[_0x2009('0x22')]===_0x2009('0x23')&&typeof _0x1d8b19['limit']===_0x2009('0x23');var _0x300fae=_0x9967ac[_0x2009('0x24')];var _0x2078c9=_0x4cd502?0x0:_0x1d8b19[_0x2009('0x22')];var _0x40dd22=_0x4cd502?_0x9967ac['count']:_0x1d8b19[_0x2009('0x22')]+_0x1d8b19[_0x2009('0x25')];var _0x26c18a;if(_0x40dd22>=_0x300fae){_0x40dd22=_0x300fae;_0x26c18a=0xc8;}else{_0x26c18a=0xce;}_0x4e1646[_0x2009('0x20')](_0x26c18a);return _0x4e1646[_0x2009('0x26')]('Content-Range',_0x2078c9+'-'+_0x40dd22+'/'+_0x300fae)[_0x2009('0x27')](_0x9967ac);}return null;};}function patchUpdates(_0x4dc39c){return function(_0x1737bf){try{jsonpatch[_0x2009('0x28')](_0x1737bf,_0x4dc39c,!![]);}catch(_0x413d34){return BPromise[_0x2009('0x29')](_0x413d34);}return _0x1737bf[_0x2009('0x2a')]();};}function saveUpdates(_0x43ab85,_0x4cdbf6){return function(_0x5a718a){if(_0x5a718a){return _0x5a718a['update'](_0x43ab85)[_0x2009('0x2b')](function(_0x3a8e75){return _0x3a8e75;});}return null;};}function removeEntity(_0xcdae89,_0x4a9a53){return function(_0x21c31d){if(_0x21c31d){return _0x21c31d[_0x2009('0x2c')]()['then'](function(){var _0x13425e=_0x21c31d['get']({'plain':!![]});var _0x56a841=_0x2009('0x2d');return db['UserProfileResource'][_0x2009('0x2c')]({'where':{'type':_0x56a841,'resourceId':_0x13425e['id']}})[_0x2009('0x2b')](function(){return _0x21c31d;});})[_0x2009('0x2b')](function(){_0xcdae89['status'](0xcc)[_0x2009('0x21')]();});}};}function handleEntityNotFound(_0x16d116,_0x319b1d){return function(_0x415dfb){if(!_0x415dfb){_0x16d116[_0x2009('0x2e')](0x194);}return _0x415dfb;};}function handleError(_0x15b7b2,_0x8873b8){_0x8873b8=_0x8873b8||0x1f4;return function(_0x26548c){logger[_0x2009('0x2f')](_0x26548c['stack']);if(_0x26548c[_0x2009('0x30')]){delete _0x26548c[_0x2009('0x30')];}_0x15b7b2['status'](_0x8873b8)['send'](_0x26548c);};}function getMustacheRender(_0x2e60ff,_0x20bb2b){return Mustache[_0x2009('0x31')](_0x2e60ff,_['merge'](_0x20bb2b[_0x2009('0x32')],{'contact':_0x20bb2b[_0x2009('0x33')],'message':_0x20bb2b[_0x2009('0x34')],'agent':_0x20bb2b['agent'],'interaction':_0x20bb2b[_0x2009('0x35')],'account':_0x20bb2b[_0x2009('0x36')]}))||'';}exports[_0x2009('0x37')]=function(_0x584830,_0x41d8ee){var _0x2e9720={},_0x24a835={},_0x41e894={'count':0x0,'rows':[]};var _0x138e4a=_[_0x2009('0x38')](db[_0x2009('0x39')][_0x2009('0x3a')],function(_0x1f3738){return{'name':_0x1f3738[_0x2009('0x3b')],'type':_0x1f3738['type'][_0x2009('0x3c')]};});_0x24a835[_0x2009('0x3d')]=_[_0x2009('0x38')](_0x138e4a,_0x2009('0x30'));_0x24a835[_0x2009('0x3e')]=_['keys'](_0x584830['query']);_0x24a835[_0x2009('0x3f')]=_['intersection'](_0x24a835[_0x2009('0x3d')],_0x24a835[_0x2009('0x3e')]);_0x2e9720[_0x2009('0x40')]=_['intersection'](_0x24a835[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x584830[_0x2009('0x3e')][_0x2009('0x41')]));_0x2e9720['attributes']=_0x2e9720[_0x2009('0x40')][_0x2009('0x42')]?_0x2e9720[_0x2009('0x40')]:_0x24a835['model'];if(!_0x584830[_0x2009('0x3e')][_0x2009('0x43')](_0x2009('0x44'))){_0x2e9720[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x584830[_0x2009('0x3e')][_0x2009('0x25')]);_0x2e9720[_0x2009('0x22')]=qs[_0x2009('0x22')](_0x584830['query'][_0x2009('0x22')]);}_0x2e9720[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x584830[_0x2009('0x3e')]['sort']);_0x2e9720['where']=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x584830[_0x2009('0x3e')],_0x24a835['filters']),_0x138e4a);if(_0x584830['query'][_0x2009('0x48')]){_0x2e9720[_0x2009('0x49')]=_['merge'](_0x2e9720[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x138e4a,function(_0x570a50){if(_0x570a50['type']!==_0x2009('0x4a')){var _0x238442={};_0x238442[_0x570a50[_0x2009('0x30')]]={'$like':'%'+_0x584830['query'][_0x2009('0x48')]+'%'};return _0x238442;}})});}_0x2e9720=_[_0x2009('0x4b')]({},_0x2e9720,_0x584830['options']);var _0x4291b6={'where':_0x2e9720['where']};return db[_0x2009('0x39')]['count'](_0x4291b6)[_0x2009('0x2b')](function(_0x45b21b){_0x41e894[_0x2009('0x24')]=_0x45b21b;if(_0x584830[_0x2009('0x3e')][_0x2009('0x4c')]){_0x2e9720[_0x2009('0x4d')]=[{'all':!![]}];}return db[_0x2009('0x39')]['findAll'](_0x2e9720);})[_0x2009('0x2b')](function(_0x3016ed){_0x41e894[_0x2009('0x4e')]=_0x3016ed;return _0x41e894;})[_0x2009('0x2b')](respondWithFilteredResult(_0x41d8ee,_0x2e9720))[_0x2009('0x4f')](handleError(_0x41d8ee,null));};exports[_0x2009('0x50')]=function(_0xa5472e,_0x1797c7){var _0x5f10b9={'raw':![],'where':{'id':_0xa5472e[_0x2009('0x51')]['id']}},_0x2640e5={};_0x2640e5['model']=_[_0x2009('0x52')](db[_0x2009('0x39')][_0x2009('0x3a')]);_0x2640e5[_0x2009('0x3e')]=_[_0x2009('0x52')](_0xa5472e[_0x2009('0x3e')]);_0x2640e5[_0x2009('0x3f')]=_[_0x2009('0x53')](_0x2640e5[_0x2009('0x3d')],_0x2640e5[_0x2009('0x3e')]);_0x5f10b9['attributes']=_[_0x2009('0x53')](_0x2640e5[_0x2009('0x3d')],qs[_0x2009('0x41')](_0xa5472e[_0x2009('0x3e')]['fields']));_0x5f10b9[_0x2009('0x40')]=_0x5f10b9[_0x2009('0x40')][_0x2009('0x42')]?_0x5f10b9[_0x2009('0x40')]:_0x2640e5[_0x2009('0x3d')];if(_0xa5472e[_0x2009('0x3e')][_0x2009('0x4c')]){_0x5f10b9[_0x2009('0x4d')]=[{'all':!![]}];}_0x5f10b9=_[_0x2009('0x4b')]({},_0x5f10b9,_0xa5472e[_0x2009('0x54')]);return db[_0x2009('0x39')][_0x2009('0x55')](_0x5f10b9)[_0x2009('0x2b')](handleEntityNotFound(_0x1797c7,null))[_0x2009('0x2b')](respondWithResult(_0x1797c7,null))['catch'](handleError(_0x1797c7,null));};exports[_0x2009('0x56')]=function(_0x5252f9,_0xd87015){return db[_0x2009('0x39')][_0x2009('0x56')](_0x5252f9[_0x2009('0x32')],{})[_0x2009('0x2b')](function(_0x76f83c){var _0x18db54=_0x5252f9[_0x2009('0x57')][_0x2009('0x58')]({'plain':!![]});if(!_0x18db54)throw new Error(_0x2009('0x59'));if(_0x18db54[_0x2009('0x5a')]===_0x2009('0x57')){var _0x3b459d=_0x76f83c[_0x2009('0x58')]({'plain':!![]});var _0x51e777=_0x2009('0x2d');return db[_0x2009('0x5b')][_0x2009('0x55')]({'where':{'name':_0x51e777,'userProfileId':_0x18db54[_0x2009('0x5c')]},'raw':!![]})[_0x2009('0x2b')](function(_0x3e0da0){if(_0x3e0da0&&_0x3e0da0['autoAssociation']===0x0){return db[_0x2009('0x5d')][_0x2009('0x56')]({'name':_0x3b459d[_0x2009('0x30')],'resourceId':_0x3b459d['id'],'type':_0x3e0da0[_0x2009('0x30')],'sectionId':_0x3e0da0['id']},{})[_0x2009('0x2b')](function(){return _0x76f83c;});}else{return _0x76f83c;}})[_0x2009('0x4f')](function(_0x4935da){logger[_0x2009('0x2f')](_0x2009('0x5e'),_0x4935da);throw _0x4935da;});}return _0x76f83c;})[_0x2009('0x2b')](respondWithResult(_0xd87015,0xc9))[_0x2009('0x4f')](handleError(_0xd87015,null));};exports[_0x2009('0x5f')]=function(_0x270984,_0xb53ccb){if(_0x270984[_0x2009('0x32')]['id']){delete _0x270984['body']['id'];}return db[_0x2009('0x39')]['find']({'where':{'id':_0x270984[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0xb53ccb,null))[_0x2009('0x2b')](saveUpdates(_0x270984[_0x2009('0x32')],null))['then'](respondWithResult(_0xb53ccb,null))[_0x2009('0x4f')](handleError(_0xb53ccb,null));};exports[_0x2009('0x2c')]=function(_0x558e7a,_0x1c3c41){return db[_0x2009('0x39')]['find']({'where':{'id':_0x558e7a['params']['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x1c3c41,null))[_0x2009('0x2b')](removeEntity(_0x1c3c41,null))[_0x2009('0x4f')](handleError(_0x1c3c41,null));};exports[_0x2009('0x60')]=function(_0x72df50,_0x58c5c1){return db[_0x2009('0x39')]['describe']()['then'](respondWithResult(_0x58c5c1,null))['catch'](handleError(_0x58c5c1,null));};exports[_0x2009('0x61')]=function(_0x1d4fc3,_0xac42e9,_0x2692a0){if(_0x1d4fc3['body']['id']){delete _0x1d4fc3[_0x2009('0x32')]['id'];}return db[_0x2009('0x39')][_0x2009('0x55')]({'where':{'id':_0x1d4fc3['params']['id']}})['then'](handleEntityNotFound(_0xac42e9,null))['then'](function(_0x1c82b1){if(_0x1c82b1){_0x1d4fc3[_0x2009('0x32')][_0x2009('0x62')]=_0x1c82b1['id'];return db[_0x2009('0x63')]['create'](_0x1d4fc3[_0x2009('0x32')]);}})[_0x2009('0x2b')](respondWithResult(_0xac42e9,null))['catch'](handleError(_0xac42e9,null));};exports[_0x2009('0x64')]=function(_0x27f89f,_0x5f5de8,_0x2cd46d){var _0xccc318={'raw':![],'where':{}};var _0x474227={};var _0x4fd7af={'count':0x0,'rows':[]};return db['CmList'][_0x2009('0x65')]({'where':{'id':_0x27f89f[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x5f5de8,null))[_0x2009('0x2b')](function(_0x9855a6){if(_0x9855a6){_0x474227[_0x2009('0x3d')]=_[_0x2009('0x52')](db[_0x2009('0x63')][_0x2009('0x3a')]);_0x474227[_0x2009('0x3e')]=_[_0x2009('0x52')](_0x27f89f[_0x2009('0x3e')]);_0x474227['filters']=_[_0x2009('0x53')](_0x474227['model'],_0x474227[_0x2009('0x3e')]);_0xccc318[_0x2009('0x40')]=_['intersection'](_0x474227[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x27f89f[_0x2009('0x3e')][_0x2009('0x41')]));_0xccc318[_0x2009('0x40')]=_0xccc318['attributes'][_0x2009('0x42')]?_0xccc318[_0x2009('0x40')]:_0x474227[_0x2009('0x3d')];if(!_0x27f89f[_0x2009('0x3e')][_0x2009('0x43')](_0x2009('0x44'))){_0xccc318[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x27f89f['query']['limit']);_0xccc318[_0x2009('0x22')]=qs['offset'](_0x27f89f[_0x2009('0x3e')]['offset']);}_0xccc318[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x27f89f[_0x2009('0x3e')][_0x2009('0x46')]);_0xccc318[_0x2009('0x49')]=qs[_0x2009('0x3f')](_['pick'](_0x27f89f[_0x2009('0x3e')],_0x474227[_0x2009('0x3f')]));_0xccc318[_0x2009('0x49')][_0x2009('0x62')]=_0x9855a6['id'];if(_0x27f89f[_0x2009('0x3e')][_0x2009('0x48')]){_0xccc318[_0x2009('0x49')]=_[_0x2009('0x4b')](_0xccc318[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0xccc318[_0x2009('0x40')],function(_0x158a36){var _0x34ad0d={};_0x34ad0d[_0x158a36]={'$like':'%'+_0x27f89f[_0x2009('0x3e')]['filter']+'%'};return _0x34ad0d;})});}_0xccc318=_['merge']({},_0xccc318,_0x27f89f[_0x2009('0x54')]);return db[_0x2009('0x63')][_0x2009('0x24')]({'where':_0xccc318[_0x2009('0x49')]})[_0x2009('0x2b')](function(_0x4996ac){_0x4fd7af[_0x2009('0x24')]=_0x4996ac;if(_0x27f89f[_0x2009('0x3e')][_0x2009('0x4c')]){_0xccc318[_0x2009('0x4d')]=[{'all':!![]}];}return db[_0x2009('0x63')]['findAll'](_0xccc318);})['then'](function(_0x195827){_0x4fd7af['rows']=_0x195827;return _0x4fd7af;});}})[_0x2009('0x2b')](respondWithFilteredResult(_0x5f5de8,_0xccc318))['catch'](handleError(_0x5f5de8,null));};exports[_0x2009('0x66')]=function(_0x2b6d59,_0x49242e,_0x2b89de){return db[_0x2009('0x39')][_0x2009('0x55')]({'where':{'id':_0x2b6d59[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x49242e,null))[_0x2009('0x2b')](function(_0x3825dd){if(_0x3825dd){return _0x3825dd[_0x2009('0x66')](_0x2b6d59['query'][_0x2009('0x67')]);}})[_0x2009('0x2b')](respondWithStatusCode(_0x49242e,null))['catch'](handleError(_0x49242e,null));};exports[_0x2009('0x68')]=function(_0x3b70aa,_0x2db702,_0x353400){return db['CmList'][_0x2009('0x55')]({'where':{'id':_0x3b70aa[_0x2009('0x51')]['id']}})['then'](handleEntityNotFound(_0x2db702,null))[_0x2009('0x2b')](function(_0x1f547b){if(_0x1f547b){var _0x11b089=[];var _0x14746d={'success':[],'errors':[]};return db['CmContact'][_0x2009('0x60')]()[_0x2009('0x2b')](function(_0x5548ca){if(_0x3b70aa['body'][_0x2009('0x69')]&&_['isArray'](_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')])){if(_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')][_0x2009('0x42')]){_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')]=_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')][_0x2009('0x6a')](';')+';';}else{_0x3b70aa[_0x2009('0x32')]['tags']=null;}}else{_0x3b70aa[_0x2009('0x32')][_0x2009('0x69')]=null;}if(_0x3b70aa[_0x2009('0x32')]&&_['isArray'](_0x3b70aa['body'])){for(var _0x546bff=0x0;_0x546bff<_0x3b70aa[_0x2009('0x32')][_0x2009('0x42')];_0x546bff+=0x1){_0x3b70aa[_0x2009('0x32')][_0x546bff]['ListId']=_0x3b70aa[_0x2009('0x51')]['id'];_0x11b089['push'](_0x3b70aa['body'][_0x546bff]);}return BPromise[_0x2009('0x6b')](_0x11b089,function(_0x2c3180){return db[_0x2009('0x6c')][_0x2009('0x56')](_[_0x2009('0x6d')](_0x2c3180,[_0x2009('0x67'),'id'])||{},{'fields':_[_0x2009('0x52')](_0x5548ca),'raw':!![]})[_0x2009('0x2b')](function(_0x5b6236){_0x14746d['success'][_0x2009('0x6e')](_0x5b6236[_0x2009('0x6f')]);})[_0x2009('0x4f')](function(_0x4337a0){_0x14746d[_0x2009('0x70')][_0x2009('0x6e')]({'data':_0x2c3180,'error':_0x4337a0[_0x2009('0x34')]});});})[_0x2009('0x2b')](function(_0xc8e6ca){return _0x14746d;})[_0x2009('0x4f')](function(_0x3cc77e){return _0x3cc77e;});}else{_0x2db702[_0x2009('0x20')](0x190)[_0x2009('0x27')]({'message':_0x2009('0x71')});}});}})['then'](respondWithResult(_0x2db702,null))[_0x2009('0x4f')](handleError(_0x2db702,null));};exports['getContacts']=function(_0x3ee1bc,_0x5530df,_0x5859dc){var _0x10da90;return db[_0x2009('0x39')]['find']({'where':{'id':_0x3ee1bc['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x2009('0x72')}]})[_0x2009('0x2b')](handleEntityNotFound(_0x5530df,null))[_0x2009('0x2b')](function(_0x569cc6){if(_0x569cc6){_0x10da90=_0x569cc6;return db[_0x2009('0x6c')][_0x2009('0x3a')];}})[_0x2009('0x2b')](function(_0x4f87aa){if(_0x4f87aa){var _0x259ecb={};var _0xce7bdc={};_0xce7bdc[_0x2009('0x3d')]=_[_0x2009('0x73')](_[_0x2009('0x52')](_0x4f87aa),_[_0x2009('0x38')](_0x10da90['CustomFields'],function(_0x2e809a){return util[_0x2009('0x74')](_0x2009('0x75'),_0x2e809a['id']);}));_0xce7bdc[_0x2009('0x3e')]=_['keys'](_0x3ee1bc[_0x2009('0x3e')]);_0xce7bdc[_0x2009('0x3f')]=_[_0x2009('0x53')](_0xce7bdc[_0x2009('0x3d')],_0xce7bdc[_0x2009('0x3e')]);_0x259ecb[_0x2009('0x40')]=_[_0x2009('0x53')](_0xce7bdc[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x41')]));_0x259ecb[_0x2009('0x40')]=_0x259ecb[_0x2009('0x40')][_0x2009('0x42')]?_0x259ecb[_0x2009('0x40')]:_0xce7bdc[_0x2009('0x3d')];if(!_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x43')]('nolimit')){_0x259ecb[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x3ee1bc['query'][_0x2009('0x25')]);_0x259ecb[_0x2009('0x22')]=qs[_0x2009('0x22')](_0x3ee1bc[_0x2009('0x3e')]['offset']);}_0x259ecb[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x46')]);_0x259ecb[_0x2009('0x49')]=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x3ee1bc[_0x2009('0x3e')],_0xce7bdc['filters']));_0x259ecb[_0x2009('0x76')]=!![];if(_0x3ee1bc[_0x2009('0x3e')][_0x2009('0x48')]){_0x259ecb[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x259ecb[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x259ecb[_0x2009('0x40')],function(_0x28a7f3){var _0x3fca07={};_0x3fca07[_0x28a7f3]={'$like':'%'+_0x3ee1bc[_0x2009('0x3e')]['filter']+'%'};return _0x3fca07;})});}_0x259ecb=_['merge']({},_0x259ecb,_0x3ee1bc[_0x2009('0x54')]);return _0x10da90[_0x2009('0x77')](_0x259ecb);}})[_0x2009('0x2b')](respondWithResult(_0x5530df,null))[_0x2009('0x4f')](handleError(_0x5530df,null));};exports[_0x2009('0x78')]=function(_0x21e0ef,_0x4b0465,_0x48b0af){var _0x5221bf;return db['CmList']['find']({'where':{'id':_0x21e0ef[_0x2009('0x51')]['id']},'include':[{'model':db[_0x2009('0x79')],'as':_0x2009('0x72')}]})[_0x2009('0x2b')](handleEntityNotFound(_0x4b0465,null))[_0x2009('0x2b')](function(_0x420949){if(_0x420949){_0x5221bf=_0x420949;return db['CmContact'][_0x2009('0x3a')];}})[_0x2009('0x2b')](function(_0x3160ad){if(_0x3160ad){var _0x17672a={};var _0x457530={};_0x457530[_0x2009('0x3d')]=_[_0x2009('0x73')](_[_0x2009('0x52')](_0x3160ad),_[_0x2009('0x38')](_0x5221bf['CustomFields'],function(_0x1f72be){return util['format'](_0x2009('0x75'),_0x1f72be['id']);}));_0x457530[_0x2009('0x3e')]=_['keys'](_0x21e0ef['query']);_0x457530[_0x2009('0x3f')]=_[_0x2009('0x53')](_0x457530[_0x2009('0x3d')],_0x457530[_0x2009('0x3e')]);_0x17672a[_0x2009('0x40')]=_['intersection'](_0x457530[_0x2009('0x3d')],qs[_0x2009('0x41')](_0x21e0ef[_0x2009('0x3e')]['fields']));_0x17672a[_0x2009('0x40')]=_0x17672a[_0x2009('0x40')]['length']?_0x17672a[_0x2009('0x40')]:_0x457530[_0x2009('0x3d')];if(!_0x21e0ef['query'][_0x2009('0x43')](_0x2009('0x44'))){_0x17672a[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x21e0ef[_0x2009('0x3e')]['limit']);_0x17672a[_0x2009('0x22')]=qs['offset'](_0x21e0ef[_0x2009('0x3e')]['offset']);}_0x17672a[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x21e0ef[_0x2009('0x3e')][_0x2009('0x46')]);_0x17672a[_0x2009('0x49')]=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x21e0ef['query'],_0x457530[_0x2009('0x3f')]));_0x17672a[_0x2009('0x76')]=!![];if(_0x21e0ef['query'][_0x2009('0x48')]){_0x17672a[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x17672a[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x17672a[_0x2009('0x40')],function(_0x2f3c53){var _0x8a525f={};_0x8a525f[_0x2f3c53]={'$like':'%'+_0x21e0ef[_0x2009('0x3e')][_0x2009('0x48')]+'%'};return _0x8a525f;})});}_0x17672a=_[_0x2009('0x4b')]({},_0x17672a,_0x21e0ef[_0x2009('0x54')]);return _0x5221bf[_0x2009('0x77')](_0x17672a);}})[_0x2009('0x2b')](function(_0xe2f1da){if(!_[_0x2009('0x7a')](_0xe2f1da)){var _0x461836=toCsv(_0xe2f1da);var _0x212662=Date[_0x2009('0x7b')]();fs[_0x2009('0x7c')](util[_0x2009('0x74')](_0x2009('0x7d'),_0x5221bf['id'],_0x212662),_0x461836);_0x4b0465['setHeader']('Content-disposition',_0x2009('0x7e')+util[_0x2009('0x74')]('list_%d_%s.csv',_0x5221bf['id'],_0x212662));_0x4b0465[_0x2009('0x7f')](_0x2009('0x80'),'text/csv');return _0x4b0465[_0x2009('0x81')](util[_0x2009('0x74')](_0x2009('0x7d'),_0x5221bf['id'],_0x212662));}else{return _0x4b0465[_0x2009('0x2e')](0xcc);}})['catch'](handleError(_0x4b0465,null));};exports[_0x2009('0x82')]=function(_0x52d75b,_0x20badb,_0x5dea1){var _0x5d11c2;delete _0x52d75b['body']['id'];return db[_0x2009('0x39')]['findOne']({'where':{'id':_0x52d75b[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x20badb,null))[_0x2009('0x2b')](function(_0x1f34aa){if(_0x1f34aa){return db[_0x2009('0x83')][_0x2009('0x84')](function(_0x2e700b){return db['CmCustomField']['create'](_0x52d75b[_0x2009('0x32')],{'transaction':_0x2e700b})[_0x2009('0x2b')](function(_0x38760d){_0x5d11c2=_0x38760d;return _0x1f34aa[_0x2009('0x85')](_0x38760d,{'transaction':_0x2e700b});})['then'](function(){var _0x458aea={'type':db[_0x2009('0x86')]['TEXT'],'transaction':_0x2e700b};switch(_0x52d75b[_0x2009('0x32')][_0x2009('0x87')]){case _0x2009('0x88'):_0x458aea[_0x2009('0x87')]=db[_0x2009('0x86')][_0x2009('0x89')];break;case _0x2009('0x8a'):_0x458aea[_0x2009('0x87')]=db[_0x2009('0x86')][_0x2009('0x8b')];break;case'switch':_0x458aea[_0x2009('0x87')]=db[_0x2009('0x86')]['BOOLEAN'];_0x458aea['defaultValue']=![];break;default:}return db[_0x2009('0x83')][_0x2009('0x8c')]['addColumn'](_0x2009('0x8d'),util['format'](_0x2009('0x8e'),_0x5d11c2['id']),_0x458aea);})['then'](function(){return _0x5d11c2;});});}})[_0x2009('0x2b')](respondWithResult(_0x20badb,null))['catch'](handleError(_0x20badb,null));};exports[_0x2009('0x8f')]=function(_0x40b666,_0x2126b9,_0x2347ac){var _0x5bc2e0={};var _0xe2147={};var _0x5f04b5;var _0x1d4ee9;return db[_0x2009('0x39')]['findOne']({'where':{'id':_0x40b666[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x2126b9,null))['then'](function(_0x96d493){if(_0x96d493){_0x5f04b5=_0x96d493;_0xe2147[_0x2009('0x3d')]=_[_0x2009('0x52')](db[_0x2009('0x79')][_0x2009('0x3a')]);_0xe2147['query']=_['keys'](_0x40b666[_0x2009('0x3e')]);_0xe2147[_0x2009('0x3f')]=_['intersection'](_0xe2147['model'],_0xe2147[_0x2009('0x3e')]);_0x5bc2e0[_0x2009('0x40')]=_['intersection'](_0xe2147[_0x2009('0x3d')],qs['fields'](_0x40b666[_0x2009('0x3e')][_0x2009('0x41')]));_0x5bc2e0[_0x2009('0x40')]=_0x5bc2e0[_0x2009('0x40')][_0x2009('0x42')]?_0x5bc2e0['attributes']:_0xe2147[_0x2009('0x3d')];_0x5bc2e0[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x40b666[_0x2009('0x3e')][_0x2009('0x46')]);_0x5bc2e0[_0x2009('0x49')]=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x40b666[_0x2009('0x3e')],_0xe2147[_0x2009('0x3f')]));_0x5bc2e0[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x5bc2e0['where'],{'$or':[{'ListId':_0x96d493['id']},{'ListId':null}]});if(_0x40b666['query']['filter']){_0x5bc2e0[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x5bc2e0['where'],{'$or':_['map'](_0x5bc2e0[_0x2009('0x40')],function(_0x449597){var _0x2135d0={};_0x2135d0[_0x449597]={'$like':'%'+_0x40b666['query'][_0x2009('0x48')]+'%'};return _0x2135d0;})});}_0x5bc2e0=_['merge']({},_0x5bc2e0,_0x40b666[_0x2009('0x54')]);return db[_0x2009('0x79')]['findAndCountAll'](_0x5bc2e0);}})['then'](respondWithResult(_0x2126b9,null))[_0x2009('0x4f')](handleError(_0x2126b9,null));};exports['addAgents']=function(_0x1025ca,_0x3a0389,_0x145689){return db[_0x2009('0x39')]['find']({'where':{'id':_0x1025ca[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x3a0389,null))[_0x2009('0x2b')](function(_0x2f0cec){if(_0x2f0cec){return _0x2f0cec[_0x2009('0x90')](_0x1025ca[_0x2009('0x32')]['ids'],_['omit'](_0x1025ca[_0x2009('0x32')],[_0x2009('0x67'),'id'])||{})[_0x2009('0x91')](function(_0x4648b9){for(var _0x418d02=0x0;_0x418d02<_0x1025ca[_0x2009('0x32')][_0x2009('0x67')]['length'];_0x418d02+=0x1){socket[_0x2009('0x92')]('userCmList:save',{'UserId':_0x1025ca[_0x2009('0x32')]['ids'][_0x418d02],'CmListId':_0x1025ca[_0x2009('0x51')]['id']});}return _0x4648b9;});}})[_0x2009('0x2b')](respondWithResult(_0x3a0389,null))[_0x2009('0x4f')](handleError(_0x3a0389,null));};exports[_0x2009('0x93')]=function(_0x4e2b32,_0x617c07,_0x268751){return db[_0x2009('0x39')][_0x2009('0x55')]({'where':{'id':_0x4e2b32[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x617c07,null))[_0x2009('0x2b')](function(_0x11e147){if(_0x11e147){return _0x11e147[_0x2009('0x93')](_0x4e2b32[_0x2009('0x3e')][_0x2009('0x67')])['then'](function(){if(_[_0x2009('0x94')](_0x4e2b32['query']['ids'])){for(var _0x5a4a1b=0x0;_0x5a4a1b<_0x4e2b32[_0x2009('0x3e')]['ids'][_0x2009('0x42')];_0x5a4a1b+=0x1){socket['emit'](_0x2009('0x95'),{'UserId':Number(_0x4e2b32[_0x2009('0x3e')][_0x2009('0x67')][_0x5a4a1b]),'CmListId':Number(_0x4e2b32['params']['id'])});}}else{socket[_0x2009('0x92')](_0x2009('0x95'),{'UserId':Number(_0x4e2b32[_0x2009('0x3e')][_0x2009('0x67')]),'CmListId':Number(_0x4e2b32[_0x2009('0x51')]['id'])});}});}})[_0x2009('0x2b')](respondWithStatusCode(_0x617c07,null))[_0x2009('0x4f')](handleError(_0x617c07,null));};exports['getAgents']=function(_0x23fb90,_0x1b7472,_0x3bb978){var _0x403ce8={};var _0x53d0b4={};var _0x43eebd;var _0x156a63;return db[_0x2009('0x39')][_0x2009('0x65')]({'where':{'id':_0x23fb90[_0x2009('0x51')]['id']}})[_0x2009('0x2b')](handleEntityNotFound(_0x1b7472,null))[_0x2009('0x2b')](function(_0x1f9df9){if(_0x1f9df9){_0x43eebd=_0x1f9df9;_0x53d0b4[_0x2009('0x3d')]=_[_0x2009('0x52')](db[_0x2009('0x96')][_0x2009('0x3a')]);_0x53d0b4[_0x2009('0x3e')]=_[_0x2009('0x52')](_0x23fb90[_0x2009('0x3e')]);_0x53d0b4[_0x2009('0x3f')]=_[_0x2009('0x53')](_0x53d0b4[_0x2009('0x3d')],_0x53d0b4[_0x2009('0x3e')]);_0x403ce8['attributes']=_[_0x2009('0x53')](_0x53d0b4['model'],qs['fields'](_0x23fb90[_0x2009('0x3e')][_0x2009('0x41')]));_0x403ce8[_0x2009('0x40')]=_0x403ce8[_0x2009('0x40')][_0x2009('0x42')]?_0x403ce8[_0x2009('0x40')]:_0x53d0b4['model'];_0x403ce8[_0x2009('0x45')]=qs[_0x2009('0x46')](_0x23fb90[_0x2009('0x3e')][_0x2009('0x46')]);_0x403ce8['where']=qs[_0x2009('0x3f')](_[_0x2009('0x47')](_0x23fb90['query'],_0x53d0b4['filters']));if(_0x23fb90[_0x2009('0x3e')][_0x2009('0x48')]){_0x403ce8[_0x2009('0x49')]=_[_0x2009('0x4b')](_0x403ce8[_0x2009('0x49')],{'$or':_[_0x2009('0x38')](_0x403ce8[_0x2009('0x40')],function(_0x2bb6d1){var _0x26cda4={};_0x26cda4[_0x2bb6d1]={'$like':'%'+_0x23fb90[_0x2009('0x3e')][_0x2009('0x48')]+'%'};return _0x26cda4;})});}_0x403ce8=_[_0x2009('0x4b')]({},_0x403ce8,_0x23fb90[_0x2009('0x54')]);return _0x43eebd[_0x2009('0x97')](_0x403ce8);}})['then'](function(_0x32a93e){if(_0x32a93e){_0x156a63=_0x32a93e[_0x2009('0x42')];if(!_0x23fb90['query'][_0x2009('0x43')](_0x2009('0x44'))){_0x403ce8[_0x2009('0x25')]=qs[_0x2009('0x25')](_0x23fb90[_0x2009('0x3e')][_0x2009('0x25')]);_0x403ce8[_0x2009('0x22')]=qs[_0x2009('0x22')](_0x23fb90[_0x2009('0x3e')][_0x2009('0x22')]);}return _0x43eebd['getAgents'](_0x403ce8);}})[_0x2009('0x2b')](function(_0x414fa0){if(_0x414fa0){return _0x414fa0?{'count':_0x156a63,'rows':_0x414fa0}:null;}})[_0x2009('0x2b')](respondWithResult(_0x1b7472,null))[_0x2009('0x4f')](handleError(_0x1b7472,null));}; \ No newline at end of file +var _0x207b=['CmCustomField','CustomFields','CmContact','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','stack','name','send','render','merge','contact','message','agent','account','index','CmList','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','length','attributes','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','getDispositions','hasOwnProperty','order','removeDispositions','addContacts','describe','isArray','tags','join','push','each','omit','ids','dataValues','errors','Malformed\x20request\x20syntax'];(function(_0x29d849,_0x209ceb){var _0x30b104=function(_0x2a1669){while(--_0x2a1669){_0x29d849['push'](_0x29d849['shift']());}};_0x30b104(++_0x209ceb);}(_0x207b,0xc6));var _0xb207=function(_0xebd98e,_0x43b39d){_0xebd98e=_0xebd98e-0x0;var _0x5f4f75=_0x207b[_0xebd98e];return _0x5f4f75;};'use strict';var emlformat=require(_0xb207('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb207('0x1'));var moment=require(_0xb207('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb207('0x3'));var util=require(_0xb207('0x4'));var path=require(_0xb207('0x5'));var sox=require(_0xb207('0x6'));var csv=require(_0xb207('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb207('0x8'));var _=require('lodash');var squel=require(_0xb207('0x9'));var crypto=require(_0xb207('0xa'));var jsforce=require(_0xb207('0xb'));var deskjs=require(_0xb207('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb207('0xd'));var Redis=require('ioredis');var authService=require(_0xb207('0xe'));var qs=require(_0xb207('0xf'));var as=require(_0xb207('0x10'));var hardwareService=require(_0xb207('0x11'));var logger=require(_0xb207('0x12'))(_0xb207('0x13'));var utils=require('../../config/utils');var config=require(_0xb207('0x14'));var licenseUtil=require(_0xb207('0x15'));var db=require(_0xb207('0x16'))['db'];config[_0xb207('0x17')]=_[_0xb207('0x18')](config[_0xb207('0x17')],{'host':_0xb207('0x19'),'port':0x18eb});var socket=require(_0xb207('0x1a'))(new Redis(config['redis']));require(_0xb207('0x1b'))[_0xb207('0x1c')](socket);function respondWithStatusCode(_0x47bf78,_0x170637){_0x170637=_0x170637||0xcc;return function(_0x4e36cb){if(_0x4e36cb){return _0x47bf78[_0xb207('0x1d')](_0x170637);}return _0x47bf78[_0xb207('0x1e')](_0x170637)[_0xb207('0x1f')]();};}function respondWithResult(_0x5dfd32,_0x42a804){_0x42a804=_0x42a804||0xc8;return function(_0x5dc73c){if(_0x5dc73c){return _0x5dfd32[_0xb207('0x1e')](_0x42a804)[_0xb207('0x20')](_0x5dc73c);}};}function respondWithFilteredResult(_0x23aeec,_0x48b248){return function(_0x5e67e4){if(_0x5e67e4){var _0x3151c1=typeof _0x48b248[_0xb207('0x21')]==='undefined'&&typeof _0x48b248['limit']===_0xb207('0x22');var _0x3bada1=_0x5e67e4[_0xb207('0x23')];var _0x12cb6c=_0x3151c1?0x0:_0x48b248['offset'];var _0x24fef9=_0x3151c1?_0x5e67e4[_0xb207('0x23')]:_0x48b248[_0xb207('0x21')]+_0x48b248[_0xb207('0x24')];var _0x2d3c43;if(_0x24fef9>=_0x3bada1){_0x24fef9=_0x3bada1;_0x2d3c43=0xc8;}else{_0x2d3c43=0xce;}_0x23aeec[_0xb207('0x1e')](_0x2d3c43);return _0x23aeec[_0xb207('0x25')](_0xb207('0x26'),_0x12cb6c+'-'+_0x24fef9+'/'+_0x3bada1)[_0xb207('0x20')](_0x5e67e4);}return null;};}function patchUpdates(_0x13c8ed){return function(_0x31332b){try{jsonpatch[_0xb207('0x27')](_0x31332b,_0x13c8ed,!![]);}catch(_0x360671){return BPromise[_0xb207('0x28')](_0x360671);}return _0x31332b[_0xb207('0x29')]();};}function saveUpdates(_0x2deda3,_0x5c19a3){return function(_0x18be63){if(_0x18be63){return _0x18be63[_0xb207('0x2a')](_0x2deda3)[_0xb207('0x2b')](function(_0x5d3443){return _0x5d3443;});}return null;};}function removeEntity(_0x4af819,_0x3945f3){return function(_0x524c32){if(_0x524c32){return _0x524c32[_0xb207('0x2c')]()['then'](function(){var _0x5d6b18=_0x524c32[_0xb207('0x2d')]({'plain':!![]});var _0x1d8e11=_0xb207('0x2e');return db[_0xb207('0x2f')][_0xb207('0x2c')]({'where':{'type':_0x1d8e11,'resourceId':_0x5d6b18['id']}})['then'](function(){return _0x524c32;});})['then'](function(){_0x4af819['status'](0xcc)[_0xb207('0x1f')]();});}};}function handleEntityNotFound(_0xc51914,_0x1bce47){return function(_0xb37a4e){if(!_0xb37a4e){_0xc51914[_0xb207('0x1d')](0x194);}return _0xb37a4e;};}function handleError(_0x1261dd,_0x2bfdb2){_0x2bfdb2=_0x2bfdb2||0x1f4;return function(_0x33c98a){logger['error'](_0x33c98a[_0xb207('0x30')]);if(_0x33c98a[_0xb207('0x31')]){delete _0x33c98a['name'];}_0x1261dd[_0xb207('0x1e')](_0x2bfdb2)[_0xb207('0x32')](_0x33c98a);};}function getMustacheRender(_0x1f3c0a,_0x2cf0d0){return Mustache[_0xb207('0x33')](_0x1f3c0a,_[_0xb207('0x34')](_0x2cf0d0['body'],{'contact':_0x2cf0d0[_0xb207('0x35')],'message':_0x2cf0d0[_0xb207('0x36')],'agent':_0x2cf0d0[_0xb207('0x37')],'interaction':_0x2cf0d0['interaction'],'account':_0x2cf0d0[_0xb207('0x38')]}))||'';}exports[_0xb207('0x39')]=function(_0xc77e61,_0x537fd5){var _0x57bbbd={},_0x4c3878={},_0x38215f={'count':0x0,'rows':[]};var _0x143fd3=_['map'](db[_0xb207('0x3a')][_0xb207('0x3b')],function(_0x3d291b){return{'name':_0x3d291b[_0xb207('0x3c')],'type':_0x3d291b[_0xb207('0x3d')]['key']};});_0x4c3878['model']=_[_0xb207('0x3e')](_0x143fd3,_0xb207('0x31'));_0x4c3878[_0xb207('0x3f')]=_[_0xb207('0x40')](_0xc77e61[_0xb207('0x3f')]);_0x4c3878[_0xb207('0x41')]=_[_0xb207('0x42')](_0x4c3878['model'],_0x4c3878[_0xb207('0x3f')]);_0x57bbbd['attributes']=_['intersection'](_0x4c3878[_0xb207('0x43')],qs[_0xb207('0x44')](_0xc77e61[_0xb207('0x3f')][_0xb207('0x44')]));_0x57bbbd['attributes']=_0x57bbbd['attributes'][_0xb207('0x45')]?_0x57bbbd[_0xb207('0x46')]:_0x4c3878[_0xb207('0x43')];if(!_0xc77e61[_0xb207('0x3f')]['hasOwnProperty'](_0xb207('0x47'))){_0x57bbbd[_0xb207('0x24')]=qs['limit'](_0xc77e61[_0xb207('0x3f')][_0xb207('0x24')]);_0x57bbbd[_0xb207('0x21')]=qs[_0xb207('0x21')](_0xc77e61[_0xb207('0x3f')][_0xb207('0x21')]);}_0x57bbbd['order']=qs['sort'](_0xc77e61[_0xb207('0x3f')][_0xb207('0x48')]);_0x57bbbd[_0xb207('0x49')]=qs[_0xb207('0x41')](_[_0xb207('0x4a')](_0xc77e61['query'],_0x4c3878['filters']),_0x143fd3);if(_0xc77e61[_0xb207('0x3f')][_0xb207('0x4b')]){_0x57bbbd[_0xb207('0x49')]=_[_0xb207('0x34')](_0x57bbbd[_0xb207('0x49')],{'$or':_[_0xb207('0x3e')](_0x143fd3,function(_0x570db7){if(_0x570db7[_0xb207('0x3d')]!==_0xb207('0x4c')){var _0x4f6d50={};_0x4f6d50[_0x570db7[_0xb207('0x31')]]={'$like':'%'+_0xc77e61[_0xb207('0x3f')][_0xb207('0x4b')]+'%'};return _0x4f6d50;}})});}_0x57bbbd=_[_0xb207('0x34')]({},_0x57bbbd,_0xc77e61[_0xb207('0x4d')]);var _0x142702={'where':_0x57bbbd['where']};return db[_0xb207('0x3a')][_0xb207('0x23')](_0x142702)[_0xb207('0x2b')](function(_0x1872d1){_0x38215f[_0xb207('0x23')]=_0x1872d1;if(_0xc77e61[_0xb207('0x3f')][_0xb207('0x4e')]){_0x57bbbd['include']=[{'all':!![]}];}return db[_0xb207('0x3a')][_0xb207('0x4f')](_0x57bbbd);})[_0xb207('0x2b')](function(_0x47a5bb){_0x38215f[_0xb207('0x50')]=_0x47a5bb;return _0x38215f;})[_0xb207('0x2b')](respondWithFilteredResult(_0x537fd5,_0x57bbbd))['catch'](handleError(_0x537fd5,null));};exports[_0xb207('0x51')]=function(_0x2a51fe,_0x442056){var _0x47c974={'raw':![],'where':{'id':_0x2a51fe[_0xb207('0x52')]['id']}},_0x502f8f={};_0x502f8f['model']=_[_0xb207('0x40')](db[_0xb207('0x3a')][_0xb207('0x3b')]);_0x502f8f[_0xb207('0x3f')]=_[_0xb207('0x40')](_0x2a51fe[_0xb207('0x3f')]);_0x502f8f[_0xb207('0x41')]=_[_0xb207('0x42')](_0x502f8f[_0xb207('0x43')],_0x502f8f[_0xb207('0x3f')]);_0x47c974[_0xb207('0x46')]=_[_0xb207('0x42')](_0x502f8f[_0xb207('0x43')],qs[_0xb207('0x44')](_0x2a51fe[_0xb207('0x3f')][_0xb207('0x44')]));_0x47c974[_0xb207('0x46')]=_0x47c974[_0xb207('0x46')][_0xb207('0x45')]?_0x47c974[_0xb207('0x46')]:_0x502f8f[_0xb207('0x43')];if(_0x2a51fe[_0xb207('0x3f')][_0xb207('0x4e')]){_0x47c974[_0xb207('0x53')]=[{'all':!![]}];}_0x47c974=_[_0xb207('0x34')]({},_0x47c974,_0x2a51fe['options']);return db[_0xb207('0x3a')][_0xb207('0x54')](_0x47c974)['then'](handleEntityNotFound(_0x442056,null))['then'](respondWithResult(_0x442056,null))[_0xb207('0x55')](handleError(_0x442056,null));};exports[_0xb207('0x56')]=function(_0x78b894,_0x11cb0c){return db[_0xb207('0x3a')][_0xb207('0x56')](_0x78b894[_0xb207('0x57')],{})[_0xb207('0x2b')](function(_0x392293){var _0x163fec=_0x78b894['user']['get']({'plain':!![]});if(!_0x163fec)throw new Error(_0xb207('0x58'));if(_0x163fec['role']===_0xb207('0x59')){var _0x75bd8c=_0x392293[_0xb207('0x2d')]({'plain':!![]});var _0x178d87='Lists';return db[_0xb207('0x5a')][_0xb207('0x54')]({'where':{'name':_0x178d87,'userProfileId':_0x163fec[_0xb207('0x5b')]},'raw':!![]})[_0xb207('0x2b')](function(_0x56a171){if(_0x56a171&&_0x56a171[_0xb207('0x5c')]===0x0){return db[_0xb207('0x2f')]['create']({'name':_0x75bd8c[_0xb207('0x31')],'resourceId':_0x75bd8c['id'],'type':_0x56a171[_0xb207('0x31')],'sectionId':_0x56a171['id']},{})[_0xb207('0x2b')](function(){return _0x392293;});}else{return _0x392293;}})[_0xb207('0x55')](function(_0x1827e3){logger[_0xb207('0x5d')](_0xb207('0x5e'),_0x1827e3);throw _0x1827e3;});}return _0x392293;})[_0xb207('0x2b')](respondWithResult(_0x11cb0c,0xc9))[_0xb207('0x55')](handleError(_0x11cb0c,null));};exports[_0xb207('0x2a')]=function(_0x2cca7c,_0x1c108d){if(_0x2cca7c[_0xb207('0x57')]['id']){delete _0x2cca7c['body']['id'];}return db[_0xb207('0x3a')]['find']({'where':{'id':_0x2cca7c[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x1c108d,null))[_0xb207('0x2b')](saveUpdates(_0x2cca7c[_0xb207('0x57')],null))[_0xb207('0x2b')](respondWithResult(_0x1c108d,null))[_0xb207('0x55')](handleError(_0x1c108d,null));};exports[_0xb207('0x2c')]=function(_0x14ce70,_0x47fe66){return db['CmList']['find']({'where':{'id':_0x14ce70['params']['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x47fe66,null))[_0xb207('0x2b')](removeEntity(_0x47fe66,null))[_0xb207('0x55')](handleError(_0x47fe66,null));};exports['describe']=function(_0x2cb7fe,_0x3dae50){return db[_0xb207('0x3a')]['describe']()[_0xb207('0x2b')](respondWithResult(_0x3dae50,null))[_0xb207('0x55')](handleError(_0x3dae50,null));};exports[_0xb207('0x5f')]=function(_0x645e82,_0x28ce68,_0x216954){if(_0x645e82['body']['id']){delete _0x645e82[_0xb207('0x57')]['id'];}return db[_0xb207('0x3a')][_0xb207('0x54')]({'where':{'id':_0x645e82[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x28ce68,null))[_0xb207('0x2b')](function(_0x57c45b){if(_0x57c45b){_0x645e82[_0xb207('0x57')][_0xb207('0x60')]=_0x57c45b['id'];return db[_0xb207('0x61')]['create'](_0x645e82[_0xb207('0x57')]);}})[_0xb207('0x2b')](respondWithResult(_0x28ce68,null))['catch'](handleError(_0x28ce68,null));};exports[_0xb207('0x62')]=function(_0x2bf98c,_0x2edd9f,_0x5c3e5c){var _0x22aff5={'raw':![],'where':{}};var _0x47e409={};var _0x31ad10={'count':0x0,'rows':[]};return db[_0xb207('0x3a')]['findOne']({'where':{'id':_0x2bf98c[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x2edd9f,null))[_0xb207('0x2b')](function(_0x3ff255){if(_0x3ff255){_0x47e409[_0xb207('0x43')]=_[_0xb207('0x40')](db[_0xb207('0x61')]['rawAttributes']);_0x47e409[_0xb207('0x3f')]=_[_0xb207('0x40')](_0x2bf98c[_0xb207('0x3f')]);_0x47e409[_0xb207('0x41')]=_[_0xb207('0x42')](_0x47e409[_0xb207('0x43')],_0x47e409[_0xb207('0x3f')]);_0x22aff5[_0xb207('0x46')]=_[_0xb207('0x42')](_0x47e409['model'],qs[_0xb207('0x44')](_0x2bf98c[_0xb207('0x3f')][_0xb207('0x44')]));_0x22aff5[_0xb207('0x46')]=_0x22aff5[_0xb207('0x46')][_0xb207('0x45')]?_0x22aff5['attributes']:_0x47e409[_0xb207('0x43')];if(!_0x2bf98c[_0xb207('0x3f')][_0xb207('0x63')](_0xb207('0x47'))){_0x22aff5[_0xb207('0x24')]=qs[_0xb207('0x24')](_0x2bf98c[_0xb207('0x3f')][_0xb207('0x24')]);_0x22aff5['offset']=qs[_0xb207('0x21')](_0x2bf98c[_0xb207('0x3f')][_0xb207('0x21')]);}_0x22aff5[_0xb207('0x64')]=qs[_0xb207('0x48')](_0x2bf98c[_0xb207('0x3f')][_0xb207('0x48')]);_0x22aff5[_0xb207('0x49')]=qs[_0xb207('0x41')](_[_0xb207('0x4a')](_0x2bf98c[_0xb207('0x3f')],_0x47e409['filters']));_0x22aff5[_0xb207('0x49')]['ListId']=_0x3ff255['id'];if(_0x2bf98c[_0xb207('0x3f')][_0xb207('0x4b')]){_0x22aff5[_0xb207('0x49')]=_[_0xb207('0x34')](_0x22aff5[_0xb207('0x49')],{'$or':_[_0xb207('0x3e')](_0x22aff5[_0xb207('0x46')],function(_0x327c68){var _0x5eb242={};_0x5eb242[_0x327c68]={'$like':'%'+_0x2bf98c[_0xb207('0x3f')][_0xb207('0x4b')]+'%'};return _0x5eb242;})});}_0x22aff5=_['merge']({},_0x22aff5,_0x2bf98c['options']);return db[_0xb207('0x61')]['count']({'where':_0x22aff5[_0xb207('0x49')]})[_0xb207('0x2b')](function(_0x30aba0){_0x31ad10[_0xb207('0x23')]=_0x30aba0;if(_0x2bf98c[_0xb207('0x3f')]['includeAll']){_0x22aff5['include']=[{'all':!![]}];}return db[_0xb207('0x61')][_0xb207('0x4f')](_0x22aff5);})[_0xb207('0x2b')](function(_0x58cfc2){_0x31ad10['rows']=_0x58cfc2;return _0x31ad10;});}})[_0xb207('0x2b')](respondWithFilteredResult(_0x2edd9f,_0x22aff5))['catch'](handleError(_0x2edd9f,null));};exports[_0xb207('0x65')]=function(_0x23040e,_0xe08674,_0x2d968d){return db[_0xb207('0x3a')][_0xb207('0x54')]({'where':{'id':_0x23040e[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0xe08674,null))['then'](function(_0x1617a6){if(_0x1617a6){return _0x1617a6[_0xb207('0x65')](_0x23040e[_0xb207('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0xe08674,null))['catch'](handleError(_0xe08674,null));};exports[_0xb207('0x66')]=function(_0x221f38,_0x52902e,_0x2bce5f){return db[_0xb207('0x3a')]['find']({'where':{'id':_0x221f38['params']['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x52902e,null))[_0xb207('0x2b')](function(_0x4e916c){if(_0x4e916c){var _0x375516=[];var _0x41c3b7={'success':[],'errors':[]};return db['CmContact'][_0xb207('0x67')]()[_0xb207('0x2b')](function(_0x789f61){if(_0x221f38['body']['tags']&&_[_0xb207('0x68')](_0x221f38[_0xb207('0x57')][_0xb207('0x69')])){if(_0x221f38[_0xb207('0x57')][_0xb207('0x69')][_0xb207('0x45')]){_0x221f38['body'][_0xb207('0x69')]=_0x221f38[_0xb207('0x57')][_0xb207('0x69')][_0xb207('0x6a')](';')+';';}else{_0x221f38[_0xb207('0x57')][_0xb207('0x69')]=null;}}else{_0x221f38['body']['tags']=null;}if(_0x221f38[_0xb207('0x57')]&&_[_0xb207('0x68')](_0x221f38[_0xb207('0x57')])){for(var _0x11c8a6=0x0;_0x11c8a6<_0x221f38[_0xb207('0x57')][_0xb207('0x45')];_0x11c8a6+=0x1){_0x221f38['body'][_0x11c8a6][_0xb207('0x60')]=_0x221f38[_0xb207('0x52')]['id'];_0x375516[_0xb207('0x6b')](_0x221f38['body'][_0x11c8a6]);}return BPromise[_0xb207('0x6c')](_0x375516,function(_0x4fb771){return db['CmContact'][_0xb207('0x56')](_[_0xb207('0x6d')](_0x4fb771,[_0xb207('0x6e'),'id'])||{},{'fields':_[_0xb207('0x40')](_0x789f61),'raw':!![]})[_0xb207('0x2b')](function(_0x17e415){_0x41c3b7['success']['push'](_0x17e415[_0xb207('0x6f')]);})[_0xb207('0x55')](function(_0x2c2874){_0x41c3b7[_0xb207('0x70')][_0xb207('0x6b')]({'data':_0x4fb771,'error':_0x2c2874[_0xb207('0x36')]});});})[_0xb207('0x2b')](function(_0x471d1b){return _0x41c3b7;})['catch'](function(_0x2a8fb1){return _0x2a8fb1;});}else{_0x52902e['status'](0x190)['json']({'message':_0xb207('0x71')});}});}})[_0xb207('0x2b')](respondWithResult(_0x52902e,null))[_0xb207('0x55')](handleError(_0x52902e,null));};exports['getContacts']=function(_0x52be76,_0x4e78a6,_0xb42d26){var _0x44e53e;return db[_0xb207('0x3a')]['find']({'where':{'id':_0x52be76['params']['id']},'include':[{'model':db[_0xb207('0x72')],'as':_0xb207('0x73')}]})[_0xb207('0x2b')](handleEntityNotFound(_0x4e78a6,null))['then'](function(_0x1bcdf5){if(_0x1bcdf5){_0x44e53e=_0x1bcdf5;return db[_0xb207('0x74')]['rawAttributes'];}})['then'](function(_0x415da9){if(_0x415da9){var _0x42d91c={};var _0x3efb97={};_0x3efb97['model']=_[_0xb207('0x75')](_[_0xb207('0x40')](_0x415da9),_[_0xb207('0x3e')](_0x44e53e[_0xb207('0x73')],function(_0x3eaa78){return util[_0xb207('0x76')](_0xb207('0x77'),_0x3eaa78['id']);}));_0x3efb97[_0xb207('0x3f')]=_['keys'](_0x52be76['query']);_0x3efb97['filters']=_['intersection'](_0x3efb97[_0xb207('0x43')],_0x3efb97[_0xb207('0x3f')]);_0x42d91c['attributes']=_[_0xb207('0x42')](_0x3efb97[_0xb207('0x43')],qs[_0xb207('0x44')](_0x52be76[_0xb207('0x3f')][_0xb207('0x44')]));_0x42d91c[_0xb207('0x46')]=_0x42d91c[_0xb207('0x46')][_0xb207('0x45')]?_0x42d91c['attributes']:_0x3efb97[_0xb207('0x43')];if(!_0x52be76[_0xb207('0x3f')][_0xb207('0x63')](_0xb207('0x47'))){_0x42d91c['limit']=qs['limit'](_0x52be76[_0xb207('0x3f')][_0xb207('0x24')]);_0x42d91c[_0xb207('0x21')]=qs['offset'](_0x52be76['query'][_0xb207('0x21')]);}_0x42d91c[_0xb207('0x64')]=qs['sort'](_0x52be76[_0xb207('0x3f')]['sort']);_0x42d91c['where']=qs[_0xb207('0x41')](_[_0xb207('0x4a')](_0x52be76[_0xb207('0x3f')],_0x3efb97[_0xb207('0x41')]));_0x42d91c[_0xb207('0x78')]=!![];if(_0x52be76[_0xb207('0x3f')]['filter']){_0x42d91c[_0xb207('0x49')]=_[_0xb207('0x34')](_0x42d91c[_0xb207('0x49')],{'$or':_[_0xb207('0x3e')](_0x42d91c['attributes'],function(_0x4b84cd){var _0x21f5ab={};_0x21f5ab[_0x4b84cd]={'$like':'%'+_0x52be76[_0xb207('0x3f')][_0xb207('0x4b')]+'%'};return _0x21f5ab;})});}_0x42d91c=_['merge']({},_0x42d91c,_0x52be76['options']);return _0x44e53e[_0xb207('0x79')](_0x42d91c);}})[_0xb207('0x2b')](respondWithResult(_0x4e78a6,null))['catch'](handleError(_0x4e78a6,null));};exports[_0xb207('0x7a')]=function(_0x286169,_0x568af4,_0xa2e34b){var _0x379b79;return db[_0xb207('0x3a')][_0xb207('0x54')]({'where':{'id':_0x286169[_0xb207('0x52')]['id']},'include':[{'model':db[_0xb207('0x72')],'as':_0xb207('0x73')}]})[_0xb207('0x2b')](handleEntityNotFound(_0x568af4,null))['then'](function(_0x1752f5){if(_0x1752f5){_0x379b79=_0x1752f5;return db[_0xb207('0x74')][_0xb207('0x3b')];}})[_0xb207('0x2b')](function(_0x37f063){if(_0x37f063){var _0x365548={};var _0x161082={};_0x161082[_0xb207('0x43')]=_['concat'](_['keys'](_0x37f063),_[_0xb207('0x3e')](_0x379b79[_0xb207('0x73')],function(_0x3b6880){return util[_0xb207('0x76')]('cf_%d',_0x3b6880['id']);}));_0x161082['query']=_['keys'](_0x286169[_0xb207('0x3f')]);_0x161082['filters']=_[_0xb207('0x42')](_0x161082[_0xb207('0x43')],_0x161082['query']);_0x365548[_0xb207('0x46')]=_['intersection'](_0x161082[_0xb207('0x43')],qs['fields'](_0x286169['query'][_0xb207('0x44')]));_0x365548[_0xb207('0x46')]=_0x365548[_0xb207('0x46')]['length']?_0x365548[_0xb207('0x46')]:_0x161082[_0xb207('0x43')];if(!_0x286169['query'][_0xb207('0x63')]('nolimit')){_0x365548[_0xb207('0x24')]=qs[_0xb207('0x24')](_0x286169[_0xb207('0x3f')][_0xb207('0x24')]);_0x365548['offset']=qs['offset'](_0x286169[_0xb207('0x3f')][_0xb207('0x21')]);}_0x365548[_0xb207('0x64')]=qs[_0xb207('0x48')](_0x286169[_0xb207('0x3f')]['sort']);_0x365548['where']=qs[_0xb207('0x41')](_[_0xb207('0x4a')](_0x286169[_0xb207('0x3f')],_0x161082[_0xb207('0x41')]));_0x365548[_0xb207('0x78')]=!![];if(_0x286169[_0xb207('0x3f')][_0xb207('0x4b')]){_0x365548[_0xb207('0x49')]=_[_0xb207('0x34')](_0x365548[_0xb207('0x49')],{'$or':_[_0xb207('0x3e')](_0x365548['attributes'],function(_0x528dbb){var _0x386af3={};_0x386af3[_0x528dbb]={'$like':'%'+_0x286169[_0xb207('0x3f')][_0xb207('0x4b')]+'%'};return _0x386af3;})});}_0x365548=_['merge']({},_0x365548,_0x286169[_0xb207('0x4d')]);return _0x379b79[_0xb207('0x79')](_0x365548);}})[_0xb207('0x2b')](function(_0x54b600){if(!_[_0xb207('0x7b')](_0x54b600)){var _0x2f5f73=toCsv(_0x54b600);var _0x256fac=Date[_0xb207('0x7c')]();fs[_0xb207('0x7d')](util[_0xb207('0x76')]('/tmp/list_%d_%s.csv',_0x379b79['id'],_0x256fac),_0x2f5f73);_0x568af4[_0xb207('0x7e')](_0xb207('0x7f'),_0xb207('0x80')+util[_0xb207('0x76')]('list_%d_%s.csv',_0x379b79['id'],_0x256fac));_0x568af4[_0xb207('0x7e')]('Content-type',_0xb207('0x81'));return _0x568af4[_0xb207('0x82')](util[_0xb207('0x76')](_0xb207('0x83'),_0x379b79['id'],_0x256fac));}else{return _0x568af4[_0xb207('0x1d')](0xcc);}})[_0xb207('0x55')](handleError(_0x568af4,null));};exports[_0xb207('0x84')]=function(_0x706d5e,_0x9dfb23,_0x142953){var _0xcffcf;delete _0x706d5e[_0xb207('0x57')]['id'];return db[_0xb207('0x3a')][_0xb207('0x85')]({'where':{'id':_0x706d5e[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x9dfb23,null))[_0xb207('0x2b')](function(_0x3db35a){if(_0x3db35a){return db[_0xb207('0x86')][_0xb207('0x87')](function(_0x1a79e2){return db[_0xb207('0x72')][_0xb207('0x56')](_0x706d5e[_0xb207('0x57')],{'transaction':_0x1a79e2})[_0xb207('0x2b')](function(_0x166427){_0xcffcf=_0x166427;return _0x3db35a[_0xb207('0x88')](_0x166427,{'transaction':_0x1a79e2});})['then'](function(){var _0x2f9bbf={'type':db[_0xb207('0x89')]['TEXT'],'transaction':_0x1a79e2};switch(_0x706d5e['body']['type']){case _0xb207('0x8a'):_0x2f9bbf[_0xb207('0x3d')]=db[_0xb207('0x89')]['TEXT'];break;case _0xb207('0x8b'):_0x2f9bbf[_0xb207('0x3d')]=db['Sequelize'][_0xb207('0x8c')];break;case _0xb207('0x8d'):_0x2f9bbf[_0xb207('0x3d')]=db[_0xb207('0x89')]['BOOLEAN'];_0x2f9bbf[_0xb207('0x8e')]=![];break;default:}return db['sequelize'][_0xb207('0x8f')][_0xb207('0x90')](_0xb207('0x91'),util[_0xb207('0x76')]('cf_%s',_0xcffcf['id']),_0x2f9bbf);})[_0xb207('0x2b')](function(){return _0xcffcf;});});}})['then'](respondWithResult(_0x9dfb23,null))[_0xb207('0x55')](handleError(_0x9dfb23,null));};exports[_0xb207('0x92')]=function(_0x7c0e52,_0x5997a0,_0x2ce3b6){var _0x15e3e5={};var _0x10cbbf={};var _0x1fad4f;var _0x51fc33;return db[_0xb207('0x3a')][_0xb207('0x85')]({'where':{'id':_0x7c0e52[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x5997a0,null))[_0xb207('0x2b')](function(_0x47c4ae){if(_0x47c4ae){_0x1fad4f=_0x47c4ae;_0x10cbbf[_0xb207('0x43')]=_[_0xb207('0x40')](db['CmCustomField'][_0xb207('0x3b')]);_0x10cbbf[_0xb207('0x3f')]=_[_0xb207('0x40')](_0x7c0e52['query']);_0x10cbbf[_0xb207('0x41')]=_[_0xb207('0x42')](_0x10cbbf[_0xb207('0x43')],_0x10cbbf[_0xb207('0x3f')]);_0x15e3e5[_0xb207('0x46')]=_[_0xb207('0x42')](_0x10cbbf[_0xb207('0x43')],qs[_0xb207('0x44')](_0x7c0e52[_0xb207('0x3f')][_0xb207('0x44')]));_0x15e3e5[_0xb207('0x46')]=_0x15e3e5[_0xb207('0x46')][_0xb207('0x45')]?_0x15e3e5[_0xb207('0x46')]:_0x10cbbf[_0xb207('0x43')];_0x15e3e5[_0xb207('0x64')]=qs[_0xb207('0x48')](_0x7c0e52['query'][_0xb207('0x48')]);_0x15e3e5[_0xb207('0x49')]=qs[_0xb207('0x41')](_[_0xb207('0x4a')](_0x7c0e52['query'],_0x10cbbf[_0xb207('0x41')]));_0x15e3e5['where']=_[_0xb207('0x34')](_0x15e3e5[_0xb207('0x49')],{'$or':[{'ListId':_0x47c4ae['id']},{'ListId':null}]});if(_0x7c0e52['query'][_0xb207('0x4b')]){_0x15e3e5[_0xb207('0x49')]=_[_0xb207('0x34')](_0x15e3e5['where'],{'$or':_[_0xb207('0x3e')](_0x15e3e5['attributes'],function(_0x430aec){var _0x14b1a9={};_0x14b1a9[_0x430aec]={'$like':'%'+_0x7c0e52[_0xb207('0x3f')]['filter']+'%'};return _0x14b1a9;})});}_0x15e3e5=_[_0xb207('0x34')]({},_0x15e3e5,_0x7c0e52[_0xb207('0x4d')]);return db[_0xb207('0x72')][_0xb207('0x93')](_0x15e3e5);}})[_0xb207('0x2b')](respondWithResult(_0x5997a0,null))['catch'](handleError(_0x5997a0,null));};exports[_0xb207('0x94')]=function(_0x5ed5d1,_0x5142d8,_0x2a6a4e){return db[_0xb207('0x3a')]['find']({'where':{'id':_0x5ed5d1[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x5142d8,null))[_0xb207('0x2b')](function(_0x19670c){if(_0x19670c){return _0x19670c[_0xb207('0x94')](_0x5ed5d1[_0xb207('0x57')][_0xb207('0x6e')],_[_0xb207('0x6d')](_0x5ed5d1[_0xb207('0x57')],['ids','id'])||{})[_0xb207('0x95')](function(_0x2750de){for(var _0x49ab1e=0x0;_0x49ab1e<_0x5ed5d1['body'][_0xb207('0x6e')][_0xb207('0x45')];_0x49ab1e+=0x1){socket[_0xb207('0x96')](_0xb207('0x97'),{'UserId':_0x5ed5d1['body'][_0xb207('0x6e')][_0x49ab1e],'CmListId':_0x5ed5d1[_0xb207('0x52')]['id']});}return _0x2750de;});}})[_0xb207('0x2b')](respondWithResult(_0x5142d8,null))['catch'](handleError(_0x5142d8,null));};exports['removeAgents']=function(_0x531bce,_0x32e57b,_0xcfd851){return db[_0xb207('0x3a')][_0xb207('0x54')]({'where':{'id':_0x531bce[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x32e57b,null))['then'](function(_0x3ce1b8){if(_0x3ce1b8){return _0x3ce1b8[_0xb207('0x98')](_0x531bce[_0xb207('0x3f')][_0xb207('0x6e')])[_0xb207('0x2b')](function(){if(_[_0xb207('0x68')](_0x531bce[_0xb207('0x3f')]['ids'])){for(var _0x11923a=0x0;_0x11923a<_0x531bce[_0xb207('0x3f')][_0xb207('0x6e')][_0xb207('0x45')];_0x11923a+=0x1){socket[_0xb207('0x96')](_0xb207('0x99'),{'UserId':Number(_0x531bce[_0xb207('0x3f')][_0xb207('0x6e')][_0x11923a]),'CmListId':Number(_0x531bce[_0xb207('0x52')]['id'])});}}else{socket['emit'](_0xb207('0x99'),{'UserId':Number(_0x531bce['query'][_0xb207('0x6e')]),'CmListId':Number(_0x531bce[_0xb207('0x52')]['id'])});}});}})[_0xb207('0x2b')](respondWithStatusCode(_0x32e57b,null))[_0xb207('0x55')](handleError(_0x32e57b,null));};exports['getAgents']=function(_0x5f34a9,_0x3dc188,_0xb2c9cd){var _0x1d704f={};var _0x499853={};var _0x82f02c;var _0x1d3dd3;return db[_0xb207('0x3a')][_0xb207('0x85')]({'where':{'id':_0x5f34a9[_0xb207('0x52')]['id']}})[_0xb207('0x2b')](handleEntityNotFound(_0x3dc188,null))[_0xb207('0x2b')](function(_0xeb6c2b){if(_0xeb6c2b){_0x82f02c=_0xeb6c2b;_0x499853['model']=_[_0xb207('0x40')](db[_0xb207('0x9a')][_0xb207('0x3b')]);_0x499853[_0xb207('0x3f')]=_[_0xb207('0x40')](_0x5f34a9[_0xb207('0x3f')]);_0x499853['filters']=_['intersection'](_0x499853[_0xb207('0x43')],_0x499853[_0xb207('0x3f')]);_0x1d704f['attributes']=_[_0xb207('0x42')](_0x499853[_0xb207('0x43')],qs[_0xb207('0x44')](_0x5f34a9[_0xb207('0x3f')][_0xb207('0x44')]));_0x1d704f['attributes']=_0x1d704f[_0xb207('0x46')][_0xb207('0x45')]?_0x1d704f[_0xb207('0x46')]:_0x499853[_0xb207('0x43')];_0x1d704f[_0xb207('0x64')]=qs[_0xb207('0x48')](_0x5f34a9[_0xb207('0x3f')][_0xb207('0x48')]);_0x1d704f[_0xb207('0x49')]=qs[_0xb207('0x41')](_['pick'](_0x5f34a9[_0xb207('0x3f')],_0x499853[_0xb207('0x41')]));if(_0x5f34a9['query'][_0xb207('0x4b')]){_0x1d704f[_0xb207('0x49')]=_[_0xb207('0x34')](_0x1d704f[_0xb207('0x49')],{'$or':_[_0xb207('0x3e')](_0x1d704f[_0xb207('0x46')],function(_0xfb7ae7){var _0x3cb9d9={};_0x3cb9d9[_0xfb7ae7]={'$like':'%'+_0x5f34a9[_0xb207('0x3f')][_0xb207('0x4b')]+'%'};return _0x3cb9d9;})});}_0x1d704f=_[_0xb207('0x34')]({},_0x1d704f,_0x5f34a9[_0xb207('0x4d')]);return _0x82f02c[_0xb207('0x9b')](_0x1d704f);}})[_0xb207('0x2b')](function(_0x3a73fa){if(_0x3a73fa){_0x1d3dd3=_0x3a73fa[_0xb207('0x45')];if(!_0x5f34a9[_0xb207('0x3f')][_0xb207('0x63')](_0xb207('0x47'))){_0x1d704f[_0xb207('0x24')]=qs['limit'](_0x5f34a9[_0xb207('0x3f')]['limit']);_0x1d704f['offset']=qs[_0xb207('0x21')](_0x5f34a9['query']['offset']);}return _0x82f02c[_0xb207('0x9b')](_0x1d704f);}})[_0xb207('0x2b')](function(_0x1bb816){if(_0x1bb816){return _0x1bb816?{'count':_0x1d3dd3,'rows':_0x1bb816}:null;}})[_0xb207('0x2b')](respondWithResult(_0x3dc188,null))[_0xb207('0x55')](handleError(_0x3dc188,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a8204cb..6ab8c18 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95df=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','remove'];(function(_0x32aea7,_0x4130ea){var _0x2a480b=function(_0x27b068){while(--_0x27b068){_0x32aea7['push'](_0x32aea7['shift']());}};_0x2a480b(++_0x4130ea);}(_0x95df,0x137));var _0xf95d=function(_0x3e8479,_0xcacd11){_0x3e8479=_0x3e8479-0x0;var _0x28e20e=_0x95df[_0x3e8479];return _0x28e20e;};'use strict';var EventEmitter=require('events');var CmList=require(_0xf95d('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf95d('0x1')](0x0);var events={'afterCreate':_0xf95d('0x2'),'afterUpdate':'update','afterDestroy':_0xf95d('0x3')};function emitEvent(_0x1b1eab){return function(_0xa8fdc7,_0x1c33b9,_0x246270){CmListEvents[_0xf95d('0x4')](_0x1b1eab+':'+_0xa8fdc7['id'],_0xa8fdc7);CmListEvents[_0xf95d('0x4')](_0x1b1eab,_0xa8fdc7);_0x246270(null);};}for(var e in events){if(events[_0xf95d('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xf95d('0x6')]=CmListEvents; \ No newline at end of file +var _0x7554=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7554,0xcd));var _0x4755=function(_0x40a94e,_0x21cbfd){_0x40a94e=_0x40a94e-0x0;var _0x1359c0=_0x7554[_0x40a94e];return _0x1359c0;};'use strict';var EventEmitter=require(_0x4755('0x0'));var CmList=require(_0x4755('0x1'))['db'][_0x4755('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4755('0x3'),'afterUpdate':_0x4755('0x4'),'afterDestroy':_0x4755('0x5')};function emitEvent(_0x7ba9cb){return function(_0x3a4a4c,_0x1c11b1,_0x6dd7d9){CmListEvents[_0x4755('0x6')](_0x7ba9cb+':'+_0x3a4a4c['id'],_0x3a4a4c);CmListEvents['emit'](_0x7ba9cb,_0x3a4a4c);_0x6dd7d9(null);};}for(var e in events){if(events[_0x4755('0x7')](e)){var event=events[e];CmList[_0x4755('0x8')](e,emitEvent(event));}}module[_0x4755('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 067b74f..8da014c 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24d0=['../../config/environment','./cmList.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x24d0,0x13c));var _0x024d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x24d0[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x024d('0x0'));var util=require('util');var logger=require(_0x024d('0x1'))(_0x024d('0x2'));var moment=require(_0x024d('0x3'));var BPromise=require(_0x024d('0x4'));var rp=require(_0x024d('0x5'));var fs=require('fs');var path=require(_0x024d('0x6'));var rimraf=require(_0x024d('0x7'));var config=require(_0x024d('0x8'));var attributes=require(_0x024d('0x9'));module[_0x024d('0xa')]=function(_0x400cf1,_0x332e2c){return _0x400cf1[_0x024d('0xb')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70fe=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0xb36148,_0x44b586){var _0x483f6b=function(_0x2a51b8){while(--_0x2a51b8){_0xb36148['push'](_0xb36148['shift']());}};_0x483f6b(++_0x44b586);}(_0x70fe,0x191));var _0xe70f=function(_0x253935,_0x43d337){_0x253935=_0x253935-0x0;var _0x4680b6=_0x70fe[_0x253935];return _0x4680b6;};'use strict';var _=require(_0xe70f('0x0'));var util=require(_0xe70f('0x1'));var logger=require(_0xe70f('0x2'))(_0xe70f('0x3'));var moment=require(_0xe70f('0x4'));var BPromise=require(_0xe70f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe70f('0x6'));var config=require(_0xe70f('0x7'));var attributes=require(_0xe70f('0x8'));module[_0xe70f('0x9')]=function(_0x333f4a,_0x53e882){return _0x333f4a[_0xe70f('0xa')](_0xe70f('0xb'),attributes,{'tableName':_0xe70f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index e6fbd98..58c6fde 100644 --- a/server/api/cmList/cmList.rpc.js +++ b/server/api/cmList/cmList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cf1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmList,\x20%s,\x20%s','lodash','moment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7cf1,0xce));var _0x17cf=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7cf1[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x17cf('0x0'));var util=require('util');var moment=require(_0x17cf('0x1'));var BPromise=require('bluebird');var rs=require(_0x17cf('0x2'));var fs=require('fs');var Redis=require(_0x17cf('0x3'));var db=require(_0x17cf('0x4'))['db'];var utils=require(_0x17cf('0x5'));var logger=require('../../config/logger')(_0x17cf('0x6'));var config=require(_0x17cf('0x7'));var jayson=require(_0x17cf('0x8'));var client=jayson['client'][_0x17cf('0x9')]({'port':0x232a});config[_0x17cf('0xa')]=_[_0x17cf('0xb')](config[_0x17cf('0xa')],{'host':_0x17cf('0xc'),'port':0x18eb});var socket=require(_0x17cf('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0x17cf('0xe')](socket);function respondWithRpcPromise(_0x599e6b,_0x444f4a,_0x54e620){return new BPromise(function(_0x4fc8be,_0x12361f){return client[_0x17cf('0xf')](_0x599e6b,_0x54e620)['then'](function(_0x29878b){logger[_0x17cf('0x10')]('CmList,\x20%s,\x20%s',_0x444f4a,_0x17cf('0x11'));logger[_0x17cf('0x12')](_0x17cf('0x13'),_0x444f4a,'request\x20sent',JSON[_0x17cf('0x14')](_0x29878b));if(_0x29878b[_0x17cf('0x15')]){if(_0x29878b['error']['code']===0x1f4){logger[_0x17cf('0x15')]('CmList,\x20%s,\x20%s',_0x444f4a,_0x29878b[_0x17cf('0x15')][_0x17cf('0x16')]);return _0x12361f(_0x29878b[_0x17cf('0x15')]['message']);}logger[_0x17cf('0x15')]('CmList,\x20%s,\x20%s',_0x444f4a,_0x29878b[_0x17cf('0x15')][_0x17cf('0x16')]);return _0x4fc8be(_0x29878b[_0x17cf('0x15')][_0x17cf('0x16')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x444f4a,'request\x20sent');_0x4fc8be(_0x29878b[_0x17cf('0x17')][_0x17cf('0x16')]);}})[_0x17cf('0x18')](function(_0x2e7885){logger['error'](_0x17cf('0x19'),_0x444f4a,_0x2e7885);_0x12361f(_0x2e7885);});});} \ No newline at end of file +var _0xcb28=['info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xcb28,0x13d));var _0x8cb2=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0xcb28[_0x1d04b5];return _0x161342;};'use strict';var _=require(_0x8cb2('0x0'));var util=require(_0x8cb2('0x1'));var moment=require(_0x8cb2('0x2'));var BPromise=require(_0x8cb2('0x3'));var rs=require(_0x8cb2('0x4'));var fs=require('fs');var Redis=require(_0x8cb2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cb2('0x6'));var logger=require(_0x8cb2('0x7'))('rpc');var config=require(_0x8cb2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8cb2('0x9')][_0x8cb2('0xa')]({'port':0x232a});config[_0x8cb2('0xb')]=_[_0x8cb2('0xc')](config[_0x8cb2('0xb')],{'host':_0x8cb2('0xd'),'port':0x18eb});var socket=require(_0x8cb2('0xe'))(new Redis(config[_0x8cb2('0xb')]));require(_0x8cb2('0xf'))[_0x8cb2('0x10')](socket);function respondWithRpcPromise(_0x4b7a1a,_0x16d3a7,_0x4fd0a0){return new BPromise(function(_0x310d34,_0x3a6d5c){return client[_0x8cb2('0x11')](_0x4b7a1a,_0x4fd0a0)[_0x8cb2('0x12')](function(_0x411c3b){logger[_0x8cb2('0x13')](_0x8cb2('0x14'),_0x16d3a7,_0x8cb2('0x15'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x16d3a7,_0x8cb2('0x15'),JSON[_0x8cb2('0x16')](_0x411c3b));if(_0x411c3b[_0x8cb2('0x17')]){if(_0x411c3b[_0x8cb2('0x17')][_0x8cb2('0x18')]===0x1f4){logger[_0x8cb2('0x17')]('CmList,\x20%s,\x20%s',_0x16d3a7,_0x411c3b['error']['message']);return _0x3a6d5c(_0x411c3b[_0x8cb2('0x17')][_0x8cb2('0x19')]);}logger[_0x8cb2('0x17')]('CmList,\x20%s,\x20%s',_0x16d3a7,_0x411c3b[_0x8cb2('0x17')]['message']);return _0x310d34(_0x411c3b[_0x8cb2('0x17')][_0x8cb2('0x19')]);}else{logger['info'](_0x8cb2('0x14'),_0x16d3a7,'request\x20sent');_0x310d34(_0x411c3b[_0x8cb2('0x1a')][_0x8cb2('0x19')]);}})[_0x8cb2('0x1b')](function(_0xc490b6){logger[_0x8cb2('0x17')](_0x8cb2('0x14'),_0x16d3a7,_0xc490b6);_0x3a6d5c(_0xc490b6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 09d21a0..2288d06 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e4b=['save','update','emit','removeListener','register','cmList:','./cmList.events'];(function(_0x23753e,_0x341e20){var _0x2d941c=function(_0x462950){while(--_0x462950){_0x23753e['push'](_0x23753e['shift']());}};_0x2d941c(++_0x341e20);}(_0x7e4b,0x84));var _0xb7e4=function(_0x4a5c33,_0x40a5a3){_0x4a5c33=_0x4a5c33-0x0;var _0x52bf41=_0x7e4b[_0x4a5c33];return _0x52bf41;};'use strict';var CmListEvents=require(_0xb7e4('0x0'));var events=[_0xb7e4('0x1'),'remove',_0xb7e4('0x2')];function createListener(_0x802d62,_0x546114){return function(_0x3d3eed){_0x546114[_0xb7e4('0x3')](_0x802d62,_0x3d3eed);};}function removeListener(_0x2fca1d,_0x32f781){return function(){CmListEvents[_0xb7e4('0x4')](_0x2fca1d,_0x32f781);};}exports[_0xb7e4('0x5')]=function(_0x39c1fd){for(var _0x2f1b05=0x0,_0x1d49a7=events['length'];_0x2f1b05<_0x1d49a7;_0x2f1b05++){var _0x334af2=events[_0x2f1b05];var _0x5e4a34=createListener(_0xb7e4('0x6')+_0x334af2,_0x39c1fd);CmListEvents['on'](_0x334af2,_0x5e4a34);}}; \ No newline at end of file +var _0xa4dc=['register','cmList:','./cmList.events','save','emit','removeListener'];(function(_0x365b14,_0x4161a1){var _0x34f9d2=function(_0x407810){while(--_0x407810){_0x365b14['push'](_0x365b14['shift']());}};_0x34f9d2(++_0x4161a1);}(_0xa4dc,0x16a));var _0xca4d=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xa4dc[_0x5d6456];return _0x4d66c1;};'use strict';var CmListEvents=require(_0xca4d('0x0'));var events=[_0xca4d('0x1'),'remove','update'];function createListener(_0x3e9b62,_0x3e51a4){return function(_0xf35655){_0x3e51a4[_0xca4d('0x2')](_0x3e9b62,_0xf35655);};}function removeListener(_0x22d0cf,_0x504f4a){return function(){CmListEvents[_0xca4d('0x3')](_0x22d0cf,_0x504f4a);};}exports[_0xca4d('0x4')]=function(_0x1b60f4){for(var _0x51470b=0x0,_0x299f58=events['length'];_0x51470b<_0x299f58;_0x51470b++){var _0x35b21a=events[_0x51470b];var _0x2fa52a=createListener(_0xca4d('0x5')+_0x35b21a,_0x1b60f4);CmListEvents['on'](_0x35b21a,_0x2fa52a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d8acf0c..fcaf015 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f93=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','post','create','addDisposition','addContacts','/:id/fields','addCustomField','/:id/users','addAgents','put','update','delete','removeAgents'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x7f93,0xc1));var _0x37f9=function(_0x5ae34b,_0x37f3e9){_0x5ae34b=_0x5ae34b-0x0;var _0x4f1420=_0x7f93[_0x5ae34b];return _0x4f1420;};'use strict';var multer=require('multer');var util=require(_0x37f9('0x0'));var path=require(_0x37f9('0x1'));var timeout=require(_0x37f9('0x2'));var express=require('express');var router=express[_0x37f9('0x3')]();var fs_extra=require(_0x37f9('0x4'));var auth=require(_0x37f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37f9('0x6'));var controller=require(_0x37f9('0x7'));router[_0x37f9('0x8')]('/',auth[_0x37f9('0x9')](),controller['index']);router[_0x37f9('0x8')](_0x37f9('0xa'),auth[_0x37f9('0x9')](),controller[_0x37f9('0xb')]);router[_0x37f9('0x8')](_0x37f9('0xc'),auth[_0x37f9('0x9')](),controller[_0x37f9('0xd')]);router['get'](_0x37f9('0xe'),auth[_0x37f9('0x9')](),controller[_0x37f9('0xf')]);router['get'](_0x37f9('0x10'),auth[_0x37f9('0x9')](),controller['getContacts']);router['get'](_0x37f9('0x11'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x12')]);router['get']('/:id/fields',auth[_0x37f9('0x9')](),controller['getCustomFields']);router[_0x37f9('0x8')]('/:id/users',auth[_0x37f9('0x9')](),controller['getAgents']);router[_0x37f9('0x13')]('/',auth[_0x37f9('0x9')](),controller[_0x37f9('0x14')]);router[_0x37f9('0x13')]('/:id/dispositions',auth[_0x37f9('0x9')](),controller[_0x37f9('0x15')]);router['post']('/:id/contacts',auth[_0x37f9('0x9')](),controller[_0x37f9('0x16')]);router[_0x37f9('0x13')](_0x37f9('0x17'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x18')]);router[_0x37f9('0x13')](_0x37f9('0x19'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x1a')]);router[_0x37f9('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x37f9('0x1c')]);router[_0x37f9('0x1d')]('/:id',auth[_0x37f9('0x9')](),controller['destroy']);router[_0x37f9('0x1d')](_0x37f9('0xe'),auth[_0x37f9('0x9')](),controller['removeDispositions']);router[_0x37f9('0x1d')](_0x37f9('0x19'),auth[_0x37f9('0x9')](),controller[_0x37f9('0x1e')]);module[_0x37f9('0x1f')]=router; \ No newline at end of file +var _0x304e=['../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getAgents','post','create','addContacts','addCustomField','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x50d44e,_0x590515){var _0xd7d0c9=function(_0x194ad3){while(--_0x194ad3){_0x50d44e['push'](_0x50d44e['shift']());}};_0xd7d0c9(++_0x590515);}(_0x304e,0x78));var _0xe304=function(_0x34e690,_0x1371f4){_0x34e690=_0x34e690-0x0;var _0x30a2b8=_0x304e[_0x34e690];return _0x30a2b8;};'use strict';var multer=require(_0xe304('0x0'));var util=require(_0xe304('0x1'));var path=require(_0xe304('0x2'));var timeout=require(_0xe304('0x3'));var express=require(_0xe304('0x4'));var router=express[_0xe304('0x5')]();var fs_extra=require(_0xe304('0x6'));var auth=require(_0xe304('0x7'));var interaction=require(_0xe304('0x8'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0xe304('0x9')]('/',auth[_0xe304('0xa')](),controller[_0xe304('0xb')]);router[_0xe304('0x9')](_0xe304('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xe304('0xd'),auth[_0xe304('0xa')](),controller[_0xe304('0xe')]);router[_0xe304('0x9')](_0xe304('0xf'),auth[_0xe304('0xa')](),controller[_0xe304('0x10')]);router[_0xe304('0x9')](_0xe304('0x11'),auth[_0xe304('0xa')](),controller['getContacts']);router['get'](_0xe304('0x12'),auth[_0xe304('0xa')](),controller['getContactsCsv']);router[_0xe304('0x9')](_0xe304('0x13'),auth[_0xe304('0xa')](),controller['getCustomFields']);router[_0xe304('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xe304('0x14')]);router[_0xe304('0x15')]('/',auth['isAuthenticated'](),controller[_0xe304('0x16')]);router['post'](_0xe304('0xf'),auth[_0xe304('0xa')](),controller['addDisposition']);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0xe304('0x17')]);router[_0xe304('0x15')](_0xe304('0x13'),auth[_0xe304('0xa')](),controller[_0xe304('0x18')]);router[_0xe304('0x15')](_0xe304('0x19'),auth[_0xe304('0xa')](),controller[_0xe304('0x1a')]);router[_0xe304('0x1b')](_0xe304('0xd'),auth[_0xe304('0xa')](),controller[_0xe304('0x1c')]);router['delete']('/:id',auth[_0xe304('0xa')](),controller['destroy']);router[_0xe304('0x1d')](_0xe304('0xf'),auth[_0xe304('0xa')](),controller['removeDispositions']);router[_0xe304('0x1d')](_0xe304('0x19'),auth[_0xe304('0xa')](),controller[_0xe304('0x1e')]);module[_0xe304('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b693aac..3f669b1 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x51474d,_0x41bc55){var _0x22cfe5=function(_0x1dcc0d){while(--_0x1dcc0d){_0x51474d['push'](_0x51474d['shift']());}};_0x22cfe5(++_0x41bc55);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x4533db,_0x41b112){var _0x36d47f=function(_0x1fcc48){while(--_0x1fcc48){_0x4533db['push'](_0x4533db['shift']());}};_0x36d47f(++_0x41b112);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 9d27c3f..eb648a9 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ff9=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end','error','stack','name','send','merge','body','contact','message','agent','interaction','account','update','Condition','find','params','then','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x686b46,_0x1a497f){_0x686b46=_0x686b46-0x0;var _0x53f174=_0x8ff9[_0x686b46];return _0x53f174;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require(_0x98ff('0x3'));var rp=require(_0x98ff('0x4'));var moment=require(_0x98ff('0x5'));var BPromise=require(_0x98ff('0x6'));var Mustache=require(_0x98ff('0x7'));var util=require(_0x98ff('0x8'));var path=require(_0x98ff('0x9'));var sox=require(_0x98ff('0xa'));var csv=require('to-csv');var ejs=require(_0x98ff('0xb'));var fs=require('fs');var fs_extra=require(_0x98ff('0xc'));var _=require(_0x98ff('0xd'));var squel=require(_0x98ff('0xe'));var crypto=require(_0x98ff('0xf'));var jsforce=require(_0x98ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98ff('0x12'));var authService=require(_0x98ff('0x13'));var qs=require(_0x98ff('0x14'));var as=require(_0x98ff('0x15'));var hardwareService=require(_0x98ff('0x16'));var logger=require('../../config/logger')(_0x98ff('0x17'));var utils=require('../../config/utils');var config=require(_0x98ff('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc547f8,_0x1529cf){_0x1529cf=_0x1529cf||0xcc;return function(_0x24a64e){if(_0x24a64e){return _0xc547f8['sendStatus'](_0x1529cf);}return _0xc547f8[_0x98ff('0x19')](_0x1529cf)['end']();};}function respondWithResult(_0x7af35,_0x373e14){_0x373e14=_0x373e14||0xc8;return function(_0x2c4e4d){if(_0x2c4e4d){return _0x7af35[_0x98ff('0x19')](_0x373e14)[_0x98ff('0x1a')](_0x2c4e4d);}};}function respondWithFilteredResult(_0x2ebc89,_0x4c319c){return function(_0x3573a4){if(_0x3573a4){var _0x196f27=typeof _0x4c319c[_0x98ff('0x1b')]===_0x98ff('0x1c')&&typeof _0x4c319c[_0x98ff('0x1d')]===_0x98ff('0x1c');var _0x1f3044=_0x3573a4[_0x98ff('0x1e')];var _0x268121=_0x196f27?0x0:_0x4c319c[_0x98ff('0x1b')];var _0x91e31c=_0x196f27?_0x3573a4[_0x98ff('0x1e')]:_0x4c319c[_0x98ff('0x1b')]+_0x4c319c[_0x98ff('0x1d')];var _0x4c235b;if(_0x91e31c>=_0x1f3044){_0x91e31c=_0x1f3044;_0x4c235b=0xc8;}else{_0x4c235b=0xce;}_0x2ebc89[_0x98ff('0x19')](_0x4c235b);return _0x2ebc89[_0x98ff('0x1f')](_0x98ff('0x20'),_0x268121+'-'+_0x91e31c+'/'+_0x1f3044)[_0x98ff('0x1a')](_0x3573a4);}return null;};}function patchUpdates(_0x41b840){return function(_0x26e589){try{jsonpatch[_0x98ff('0x21')](_0x26e589,_0x41b840,!![]);}catch(_0x3a6c52){return BPromise[_0x98ff('0x22')](_0x3a6c52);}return _0x26e589[_0x98ff('0x23')]();};}function saveUpdates(_0xf0f062,_0x2b21be){return function(_0x2fdbc2){if(_0x2fdbc2){return _0x2fdbc2['update'](_0xf0f062)['then'](function(_0x4c6ddc){return _0x4c6ddc;});}return null;};}function removeEntity(_0x27a070,_0x3ee01b){return function(_0x547fab){if(_0x547fab){return _0x547fab[_0x98ff('0x24')]()['then'](function(){_0x27a070[_0x98ff('0x19')](0xcc)[_0x98ff('0x25')]();});}};}function handleEntityNotFound(_0x308efd,_0x2b3ee9){return function(_0x4003de){if(!_0x4003de){_0x308efd['sendStatus'](0x194);}return _0x4003de;};}function handleError(_0x577ca7,_0xf53ff7){_0xf53ff7=_0xf53ff7||0x1f4;return function(_0x1a4ebd){logger[_0x98ff('0x26')](_0x1a4ebd[_0x98ff('0x27')]);if(_0x1a4ebd[_0x98ff('0x28')]){delete _0x1a4ebd[_0x98ff('0x28')];}_0x577ca7[_0x98ff('0x19')](_0xf53ff7)[_0x98ff('0x29')](_0x1a4ebd);};}function getMustacheRender(_0xda7649,_0x25a658){return Mustache['render'](_0xda7649,_[_0x98ff('0x2a')](_0x25a658[_0x98ff('0x2b')],{'contact':_0x25a658[_0x98ff('0x2c')],'message':_0x25a658[_0x98ff('0x2d')],'agent':_0x25a658[_0x98ff('0x2e')],'interaction':_0x25a658[_0x98ff('0x2f')],'account':_0x25a658[_0x98ff('0x30')]}))||'';}exports[_0x98ff('0x31')]=function(_0x42213a,_0x205d85){if(_0x42213a[_0x98ff('0x2b')]['id']){delete _0x42213a[_0x98ff('0x2b')]['id'];}return db[_0x98ff('0x32')][_0x98ff('0x33')]({'where':{'id':_0x42213a[_0x98ff('0x34')]['id']}})[_0x98ff('0x35')](handleEntityNotFound(_0x205d85,null))[_0x98ff('0x35')](saveUpdates(_0x42213a[_0x98ff('0x2b')],null))[_0x98ff('0x35')](respondWithResult(_0x205d85,null))[_0x98ff('0x36')](handleError(_0x205d85,null));};exports[_0x98ff('0x24')]=function(_0x492652,_0x364371){return db[_0x98ff('0x32')][_0x98ff('0x33')]({'where':{'id':_0x492652[_0x98ff('0x34')]['id']}})[_0x98ff('0x35')](handleEntityNotFound(_0x364371,null))['then'](removeEntity(_0x364371,null))[_0x98ff('0x36')](handleError(_0x364371,null));}; \ No newline at end of file +var _0x9ab8=['Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','Condition','params','catch','find','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x3b726c,_0x163aa2){var _0x38d420=function(_0x5e8596){while(--_0x5e8596){_0x3b726c['push'](_0x3b726c['shift']());}};_0x38d420(++_0x163aa2);}(_0x9ab8,0x81));var _0x89ab=function(_0x4a420d,_0x553bf0){_0x4a420d=_0x4a420d-0x0;var _0x24bb28=_0x9ab8[_0x4a420d];return _0x24bb28;};'use strict';var emlformat=require(_0x89ab('0x0'));var rimraf=require(_0x89ab('0x1'));var zipdir=require(_0x89ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x89ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89ab('0x4'));var util=require(_0x89ab('0x5'));var path=require('path');var sox=require(_0x89ab('0x6'));var csv=require(_0x89ab('0x7'));var ejs=require(_0x89ab('0x8'));var fs=require('fs');var fs_extra=require(_0x89ab('0x9'));var _=require(_0x89ab('0xa'));var squel=require(_0x89ab('0xb'));var crypto=require(_0x89ab('0xc'));var jsforce=require(_0x89ab('0xd'));var deskjs=require(_0x89ab('0xe'));var toCsv=require(_0x89ab('0x7'));var querystring=require(_0x89ab('0xf'));var Papa=require(_0x89ab('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x89ab('0x11'))(_0x89ab('0x12'));var utils=require(_0x89ab('0x13'));var config=require(_0x89ab('0x14'));var licenseUtil=require(_0x89ab('0x15'));var db=require(_0x89ab('0x16'))['db'];function respondWithStatusCode(_0x9f2616,_0x55a2eb){_0x55a2eb=_0x55a2eb||0xcc;return function(_0x15e7bc){if(_0x15e7bc){return _0x9f2616[_0x89ab('0x17')](_0x55a2eb);}return _0x9f2616[_0x89ab('0x18')](_0x55a2eb)[_0x89ab('0x19')]();};}function respondWithResult(_0x6ac355,_0x5c8310){_0x5c8310=_0x5c8310||0xc8;return function(_0x2bcab1){if(_0x2bcab1){return _0x6ac355[_0x89ab('0x18')](_0x5c8310)['json'](_0x2bcab1);}};}function respondWithFilteredResult(_0x585cf8,_0x5d70d9){return function(_0x57037f){if(_0x57037f){var _0x4fd002=typeof _0x5d70d9['offset']===_0x89ab('0x1a')&&typeof _0x5d70d9[_0x89ab('0x1b')]===_0x89ab('0x1a');var _0xd486ae=_0x57037f[_0x89ab('0x1c')];var _0x141b86=_0x4fd002?0x0:_0x5d70d9[_0x89ab('0x1d')];var _0x2af38f=_0x4fd002?_0x57037f[_0x89ab('0x1c')]:_0x5d70d9['offset']+_0x5d70d9[_0x89ab('0x1b')];var _0x23395e;if(_0x2af38f>=_0xd486ae){_0x2af38f=_0xd486ae;_0x23395e=0xc8;}else{_0x23395e=0xce;}_0x585cf8['status'](_0x23395e);return _0x585cf8['set'](_0x89ab('0x1e'),_0x141b86+'-'+_0x2af38f+'/'+_0xd486ae)[_0x89ab('0x1f')](_0x57037f);}return null;};}function patchUpdates(_0x58a14c){return function(_0x96817){try{jsonpatch[_0x89ab('0x20')](_0x96817,_0x58a14c,!![]);}catch(_0x2a5b01){return BPromise[_0x89ab('0x21')](_0x2a5b01);}return _0x96817[_0x89ab('0x22')]();};}function saveUpdates(_0x419363,_0x1be6d9){return function(_0x251a70){if(_0x251a70){return _0x251a70[_0x89ab('0x23')](_0x419363)[_0x89ab('0x24')](function(_0x1a361b){return _0x1a361b;});}return null;};}function removeEntity(_0x418aa7,_0x257aec){return function(_0x1b9e75){if(_0x1b9e75){return _0x1b9e75[_0x89ab('0x25')]()[_0x89ab('0x24')](function(){_0x418aa7['status'](0xcc)[_0x89ab('0x19')]();});}};}function handleEntityNotFound(_0x548430,_0x13359b){return function(_0x599422){if(!_0x599422){_0x548430['sendStatus'](0x194);}return _0x599422;};}function handleError(_0xd22b9c,_0x539709){_0x539709=_0x539709||0x1f4;return function(_0x5c2c79){logger[_0x89ab('0x26')](_0x5c2c79[_0x89ab('0x27')]);if(_0x5c2c79[_0x89ab('0x28')]){delete _0x5c2c79[_0x89ab('0x28')];}_0xd22b9c['status'](_0x539709)[_0x89ab('0x29')](_0x5c2c79);};}function getMustacheRender(_0x2535c7,_0x1919ee){return Mustache[_0x89ab('0x2a')](_0x2535c7,_['merge'](_0x1919ee[_0x89ab('0x2b')],{'contact':_0x1919ee[_0x89ab('0x2c')],'message':_0x1919ee[_0x89ab('0x2d')],'agent':_0x1919ee[_0x89ab('0x2e')],'interaction':_0x1919ee[_0x89ab('0x2f')],'account':_0x1919ee[_0x89ab('0x30')]}))||'';}exports[_0x89ab('0x23')]=function(_0x34550c,_0x2103b7){if(_0x34550c[_0x89ab('0x2b')]['id']){delete _0x34550c[_0x89ab('0x2b')]['id'];}return db[_0x89ab('0x31')]['find']({'where':{'id':_0x34550c[_0x89ab('0x32')]['id']}})[_0x89ab('0x24')](handleEntityNotFound(_0x2103b7,null))['then'](saveUpdates(_0x34550c[_0x89ab('0x2b')],null))['then'](respondWithResult(_0x2103b7,null))[_0x89ab('0x33')](handleError(_0x2103b7,null));};exports['destroy']=function(_0x2fb969,_0x3ec796){return db[_0x89ab('0x31')][_0x89ab('0x34')]({'where':{'id':_0x2fb969['params']['id']}})[_0x89ab('0x24')](handleEntityNotFound(_0x3ec796,null))[_0x89ab('0x24')](removeEntity(_0x3ec796,null))['catch'](handleError(_0x3ec796,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 326b7d0..3a57503 100644 --- a/server/api/condition/condition.model.js +++ b/server/api/condition/condition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0a2=['Condition','lodash','util','../../config/logger','api','moment','path','./condition.attributes','define'];(function(_0x50aa4b,_0x77f234){var _0x20fbd9=function(_0x52c967){while(--_0x52c967){_0x50aa4b['push'](_0x50aa4b['shift']());}};_0x20fbd9(++_0x77f234);}(_0xd0a2,0x160));var _0x2d0a=function(_0x4d3835,_0x4f5f50){_0x4d3835=_0x4d3835-0x0;var _0x823439=_0xd0a2[_0x4d3835];return _0x823439;};'use strict';var _=require(_0x2d0a('0x0'));var util=require(_0x2d0a('0x1'));var logger=require(_0x2d0a('0x2'))(_0x2d0a('0x3'));var moment=require(_0x2d0a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d0a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2d0a('0x6'));module['exports']=function(_0x1e5dd9,_0x12b8fa){return _0x1e5dd9[_0x2d0a('0x7')](_0x2d0a('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe576=['./condition.attributes','exports','define','Condition','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x405e03,_0x25c7c9){var _0x3653d9=function(_0x143739){while(--_0x143739){_0x405e03['push'](_0x405e03['shift']());}};_0x3653d9(++_0x25c7c9);}(_0xe576,0x197));var _0x6e57=function(_0x5b2cff,_0x43db7a){_0x5b2cff=_0x5b2cff-0x0;var _0x1a1288=_0xe576[_0x5b2cff];return _0x1a1288;};'use strict';var _=require('lodash');var util=require(_0x6e57('0x0'));var logger=require(_0x6e57('0x1'))(_0x6e57('0x2'));var moment=require(_0x6e57('0x3'));var BPromise=require(_0x6e57('0x4'));var rp=require(_0x6e57('0x5'));var fs=require('fs');var path=require(_0x6e57('0x6'));var rimraf=require(_0x6e57('0x7'));var config=require(_0x6e57('0x8'));var attributes=require(_0x6e57('0x9'));module[_0x6e57('0xa')]=function(_0x172066,_0x4eb5aa){return _0x172066[_0x6e57('0xb')](_0x6e57('0xc'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 12b89a5..f771ba7 100644 --- a/server/api/condition/condition.rpc.js +++ b/server/api/condition/condition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4978=['info','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x4978,0x13e));var _0x8497=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x4978[_0x5037ab];return _0x512adb;};'use strict';var _=require('lodash');var util=require(_0x8497('0x0'));var moment=require(_0x8497('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8497('0x2'))['db'];var utils=require(_0x8497('0x3'));var logger=require(_0x8497('0x4'))(_0x8497('0x5'));var config=require(_0x8497('0x6'));var jayson=require(_0x8497('0x7'));var client=jayson[_0x8497('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3357ec,_0x456093,_0x2f090d){return new BPromise(function(_0x4d894f,_0x66effe){return client[_0x8497('0x9')](_0x3357ec,_0x2f090d)[_0x8497('0xa')](function(_0xe2a0d8){logger['info'](_0x8497('0xb'),_0x456093,_0x8497('0xc'));logger[_0x8497('0xd')](_0x8497('0xe'),_0x456093,_0x8497('0xc'),JSON['stringify'](_0xe2a0d8));if(_0xe2a0d8[_0x8497('0xf')]){if(_0xe2a0d8['error'][_0x8497('0x10')]===0x1f4){logger[_0x8497('0xf')]('Condition,\x20%s,\x20%s',_0x456093,_0xe2a0d8[_0x8497('0xf')][_0x8497('0x11')]);return _0x66effe(_0xe2a0d8['error'][_0x8497('0x11')]);}logger[_0x8497('0xf')](_0x8497('0xb'),_0x456093,_0xe2a0d8[_0x8497('0xf')][_0x8497('0x11')]);return _0x4d894f(_0xe2a0d8['error']['message']);}else{logger[_0x8497('0x12')](_0x8497('0xb'),_0x456093,_0x8497('0xc'));_0x4d894f(_0xe2a0d8[_0x8497('0x13')][_0x8497('0x11')]);}})[_0x8497('0x14')](function(_0x26869c){logger[_0x8497('0xf')](_0x8497('0xb'),_0x456093,_0x26869c);_0x66effe(_0x26869c);});});} \ No newline at end of file +var _0x177a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x177a,0x7e));var _0xa177=function(_0x341f6a,_0x588615){_0x341f6a=_0x341f6a-0x0;var _0x3891d3=_0x177a[_0x341f6a];return _0x3891d3;};'use strict';var _=require(_0xa177('0x0'));var util=require(_0xa177('0x1'));var moment=require(_0xa177('0x2'));var BPromise=require('bluebird');var rs=require(_0xa177('0x3'));var fs=require('fs');var Redis=require(_0xa177('0x4'));var db=require(_0xa177('0x5'))['db'];var utils=require(_0xa177('0x6'));var logger=require(_0xa177('0x7'))(_0xa177('0x8'));var config=require('../../config/environment');var jayson=require(_0xa177('0x9'));var client=jayson[_0xa177('0xa')][_0xa177('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dba7b,_0x2b5fa0,_0x16273e){return new BPromise(function(_0x3a30ad,_0x52cefb){return client[_0xa177('0xc')](_0x2dba7b,_0x16273e)['then'](function(_0x15d8f2){logger[_0xa177('0xd')]('Condition,\x20%s,\x20%s',_0x2b5fa0,_0xa177('0xe'));logger[_0xa177('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x2b5fa0,_0xa177('0xe'),JSON[_0xa177('0x10')](_0x15d8f2));if(_0x15d8f2['error']){if(_0x15d8f2[_0xa177('0x11')][_0xa177('0x12')]===0x1f4){logger[_0xa177('0x11')](_0xa177('0x13'),_0x2b5fa0,_0x15d8f2[_0xa177('0x11')][_0xa177('0x14')]);return _0x52cefb(_0x15d8f2[_0xa177('0x11')][_0xa177('0x14')]);}logger[_0xa177('0x11')](_0xa177('0x13'),_0x2b5fa0,_0x15d8f2['error'][_0xa177('0x14')]);return _0x3a30ad(_0x15d8f2[_0xa177('0x11')][_0xa177('0x14')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x2b5fa0,_0xa177('0xe'));_0x3a30ad(_0x15d8f2[_0xa177('0x15')]['message']);}})['catch'](function(_0x2a3a05){logger[_0xa177('0x11')](_0xa177('0x13'),_0x2b5fa0,_0x2a3a05);_0x52cefb(_0x2a3a05);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index efc0ee9..03a423b 100644 --- a/server/api/condition/index.js +++ b/server/api/condition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index e85df6c..d8d7e86 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c32=['sequelize','exports','STRING','name','INTEGER'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module[_0x26c3('0x1')]={'name':{'type':Sequelize[_0x26c3('0x2')],'allowNull':![],'unique':_0x26c3('0x3')},'OrderBy':{'type':Sequelize[_0x26c3('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x26c3('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xae79=['name','INTEGER','sequelize','exports','STRING'];(function(_0x34c38e,_0xf289b2){var _0x281499=function(_0x555369){while(--_0x555369){_0x34c38e['push'](_0x34c38e['shift']());}};_0x281499(++_0xf289b2);}(_0xae79,0x1d3));var _0x9ae7=function(_0x51e872,_0x5db677){_0x51e872=_0x51e872-0x0;var _0x276f11=_0xae79[_0x51e872];return _0x276f11;};'use strict';var Sequelize=require(_0x9ae7('0x0'));module[_0x9ae7('0x1')]={'name':{'type':Sequelize[_0x9ae7('0x2')],'allowNull':![],'unique':_0x9ae7('0x3')},'OrderBy':{'type':Sequelize[_0x9ae7('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9ae7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 35a5caf..94cd805 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70b8=['limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','account','index','map','ContactItemType','rawAttributes','key','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','user','role','ContactItemTypes','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70b8,0xf4));var _0x870b=function(_0x699d31,_0x513869){_0x699d31=_0x699d31-0x0;var _0x3365eb=_0x70b8[_0x699d31];return _0x3365eb;};'use strict';var emlformat=require(_0x870b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x870b('0x1'));var jsonpatch=require(_0x870b('0x2'));var rp=require(_0x870b('0x3'));var moment=require(_0x870b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x870b('0x5'));var util=require(_0x870b('0x6'));var path=require(_0x870b('0x7'));var sox=require(_0x870b('0x8'));var csv=require('to-csv');var ejs=require(_0x870b('0x9'));var fs=require('fs');var fs_extra=require(_0x870b('0xa'));var _=require('lodash');var squel=require(_0x870b('0xb'));var crypto=require(_0x870b('0xc'));var jsforce=require(_0x870b('0xd'));var deskjs=require(_0x870b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x870b('0xf'));var Papa=require(_0x870b('0x10'));var Redis=require(_0x870b('0x11'));var authService=require(_0x870b('0x12'));var qs=require(_0x870b('0x13'));var as=require(_0x870b('0x14'));var hardwareService=require(_0x870b('0x15'));var logger=require(_0x870b('0x16'))(_0x870b('0x17'));var utils=require(_0x870b('0x18'));var config=require(_0x870b('0x19'));var licenseUtil=require(_0x870b('0x1a'));var db=require(_0x870b('0x1b'))['db'];function respondWithStatusCode(_0x173828,_0x2c0908){_0x2c0908=_0x2c0908||0xcc;return function(_0x4fb015){if(_0x4fb015){return _0x173828[_0x870b('0x1c')](_0x2c0908);}return _0x173828[_0x870b('0x1d')](_0x2c0908)[_0x870b('0x1e')]();};}function respondWithResult(_0x2ea5ad,_0x33e84b){_0x33e84b=_0x33e84b||0xc8;return function(_0x395aeb){if(_0x395aeb){return _0x2ea5ad[_0x870b('0x1d')](_0x33e84b)[_0x870b('0x1f')](_0x395aeb);}};}function respondWithFilteredResult(_0x5289ed,_0x2a1021){return function(_0x4df387){if(_0x4df387){var _0x14e820=typeof _0x2a1021[_0x870b('0x20')]===_0x870b('0x21')&&typeof _0x2a1021['limit']===_0x870b('0x21');var _0x30734b=_0x4df387[_0x870b('0x22')];var _0x1051fd=_0x14e820?0x0:_0x2a1021[_0x870b('0x20')];var _0x4a3c9f=_0x14e820?_0x4df387[_0x870b('0x22')]:_0x2a1021[_0x870b('0x20')]+_0x2a1021[_0x870b('0x23')];var _0x3a01d3;if(_0x4a3c9f>=_0x30734b){_0x4a3c9f=_0x30734b;_0x3a01d3=0xc8;}else{_0x3a01d3=0xce;}_0x5289ed[_0x870b('0x1d')](_0x3a01d3);return _0x5289ed[_0x870b('0x24')](_0x870b('0x25'),_0x1051fd+'-'+_0x4a3c9f+'/'+_0x30734b)[_0x870b('0x1f')](_0x4df387);}return null;};}function patchUpdates(_0x534641){return function(_0x5d449f){try{jsonpatch[_0x870b('0x26')](_0x5d449f,_0x534641,!![]);}catch(_0x4682e0){return BPromise['reject'](_0x4682e0);}return _0x5d449f[_0x870b('0x27')]();};}function saveUpdates(_0x21f4e5,_0x1a1c2b){return function(_0x3904d7){if(_0x3904d7){return _0x3904d7['update'](_0x21f4e5)[_0x870b('0x28')](function(_0x318435){return _0x318435;});}return null;};}function removeEntity(_0x479d86,_0x4a058a){return function(_0x55b567){if(_0x55b567){return _0x55b567[_0x870b('0x29')]()['then'](function(){var _0x3e9cd8=_0x55b567[_0x870b('0x2a')]({'plain':!![]});var _0x169d61='ContactItemTypes';return db[_0x870b('0x2b')]['destroy']({'where':{'type':_0x169d61,'resourceId':_0x3e9cd8['id']}})['then'](function(){return _0x55b567;});})['then'](function(){_0x479d86[_0x870b('0x1d')](0xcc)[_0x870b('0x1e')]();});}};}function handleEntityNotFound(_0x395e91,_0x1f071a){return function(_0x30f22b){if(!_0x30f22b){_0x395e91[_0x870b('0x1c')](0x194);}return _0x30f22b;};}function handleError(_0x3c9a48,_0x367002){_0x367002=_0x367002||0x1f4;return function(_0x58e04b){logger[_0x870b('0x2c')](_0x58e04b[_0x870b('0x2d')]);if(_0x58e04b[_0x870b('0x2e')]){delete _0x58e04b[_0x870b('0x2e')];}_0x3c9a48[_0x870b('0x1d')](_0x367002)[_0x870b('0x2f')](_0x58e04b);};}function getMustacheRender(_0x15c9a7,_0x16988f){return Mustache[_0x870b('0x30')](_0x15c9a7,_[_0x870b('0x31')](_0x16988f[_0x870b('0x32')],{'contact':_0x16988f[_0x870b('0x33')],'message':_0x16988f[_0x870b('0x34')],'agent':_0x16988f[_0x870b('0x35')],'interaction':_0x16988f['interaction'],'account':_0x16988f[_0x870b('0x36')]}))||'';}exports[_0x870b('0x37')]=function(_0x14126e,_0x5e08d8){var _0x2cf62e={},_0x1a4ada={},_0x46aa77={'count':0x0,'rows':[]};var _0x7a473c=_[_0x870b('0x38')](db[_0x870b('0x39')][_0x870b('0x3a')],function(_0x3096d8){return{'name':_0x3096d8['fieldName'],'type':_0x3096d8['type'][_0x870b('0x3b')]};});_0x1a4ada['model']=_[_0x870b('0x38')](_0x7a473c,_0x870b('0x2e'));_0x1a4ada['query']=_['keys'](_0x14126e['query']);_0x1a4ada[_0x870b('0x3c')]=_[_0x870b('0x3d')](_0x1a4ada[_0x870b('0x3e')],_0x1a4ada[_0x870b('0x3f')]);_0x2cf62e[_0x870b('0x40')]=_[_0x870b('0x3d')](_0x1a4ada[_0x870b('0x3e')],qs[_0x870b('0x41')](_0x14126e['query'][_0x870b('0x41')]));_0x2cf62e['attributes']=_0x2cf62e[_0x870b('0x40')]['length']?_0x2cf62e['attributes']:_0x1a4ada['model'];if(!_0x14126e[_0x870b('0x3f')]['hasOwnProperty'](_0x870b('0x42'))){_0x2cf62e[_0x870b('0x23')]=qs[_0x870b('0x23')](_0x14126e[_0x870b('0x3f')]['limit']);_0x2cf62e[_0x870b('0x20')]=qs['offset'](_0x14126e['query']['offset']);}_0x2cf62e[_0x870b('0x43')]=qs[_0x870b('0x44')](_0x14126e[_0x870b('0x3f')][_0x870b('0x44')]);_0x2cf62e[_0x870b('0x45')]=qs[_0x870b('0x3c')](_[_0x870b('0x46')](_0x14126e[_0x870b('0x3f')],_0x1a4ada[_0x870b('0x3c')]),_0x7a473c);if(_0x14126e['query']['filter']){_0x2cf62e[_0x870b('0x45')]=_[_0x870b('0x31')](_0x2cf62e[_0x870b('0x45')],{'$or':_[_0x870b('0x38')](_0x7a473c,function(_0x2e1b7c){if(_0x2e1b7c[_0x870b('0x47')]!==_0x870b('0x48')){var _0x1787d1={};_0x1787d1[_0x2e1b7c['name']]={'$like':'%'+_0x14126e[_0x870b('0x3f')][_0x870b('0x49')]+'%'};return _0x1787d1;}})});}_0x2cf62e=_[_0x870b('0x31')]({},_0x2cf62e,_0x14126e[_0x870b('0x4a')]);var _0x105665={'where':_0x2cf62e[_0x870b('0x45')]};return db['ContactItemType']['count'](_0x105665)[_0x870b('0x28')](function(_0x3e1c5e){_0x46aa77[_0x870b('0x22')]=_0x3e1c5e;if(_0x14126e['query'][_0x870b('0x4b')]){_0x2cf62e[_0x870b('0x4c')]=[{'all':!![]}];}return db[_0x870b('0x39')][_0x870b('0x4d')](_0x2cf62e);})[_0x870b('0x28')](function(_0x3f4e57){_0x46aa77[_0x870b('0x4e')]=_0x3f4e57;return _0x46aa77;})[_0x870b('0x28')](respondWithFilteredResult(_0x5e08d8,_0x2cf62e))['catch'](handleError(_0x5e08d8,null));};exports[_0x870b('0x4f')]=function(_0x5212fb,_0x31241f){var _0x268513={'raw':!![],'where':{'id':_0x5212fb[_0x870b('0x50')]['id']}},_0x9adbcb={};_0x9adbcb['model']=_['keys'](db[_0x870b('0x39')][_0x870b('0x3a')]);_0x9adbcb[_0x870b('0x3f')]=_[_0x870b('0x51')](_0x5212fb[_0x870b('0x3f')]);_0x9adbcb[_0x870b('0x3c')]=_['intersection'](_0x9adbcb[_0x870b('0x3e')],_0x9adbcb['query']);_0x268513['attributes']=_['intersection'](_0x9adbcb[_0x870b('0x3e')],qs[_0x870b('0x41')](_0x5212fb['query']['fields']));_0x268513[_0x870b('0x40')]=_0x268513[_0x870b('0x40')][_0x870b('0x52')]?_0x268513[_0x870b('0x40')]:_0x9adbcb[_0x870b('0x3e')];if(_0x5212fb['query'][_0x870b('0x4b')]){_0x268513['include']=[{'all':!![]}];}_0x268513=_[_0x870b('0x31')]({},_0x268513,_0x5212fb[_0x870b('0x4a')]);return db[_0x870b('0x39')][_0x870b('0x53')](_0x268513)['then'](handleEntityNotFound(_0x31241f,null))['then'](respondWithResult(_0x31241f,null))['catch'](handleError(_0x31241f,null));};exports[_0x870b('0x54')]=function(_0x5e44bf,_0xd318d1){return db[_0x870b('0x39')][_0x870b('0x54')](_0x5e44bf[_0x870b('0x32')],{})[_0x870b('0x28')](function(_0x114333){var _0x3afc42=_0x5e44bf[_0x870b('0x55')]['get']({'plain':!![]});if(!_0x3afc42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3afc42[_0x870b('0x56')]===_0x870b('0x55')){var _0xbf7b76=_0x114333['get']({'plain':!![]});var _0x5aae11=_0x870b('0x57');return db[_0x870b('0x58')][_0x870b('0x53')]({'where':{'name':_0x5aae11,'userProfileId':_0x3afc42['userProfileId']},'raw':!![]})['then'](function(_0x1d1a9b){if(_0x1d1a9b&&_0x1d1a9b[_0x870b('0x59')]===0x0){return db['UserProfileResource'][_0x870b('0x54')]({'name':_0xbf7b76[_0x870b('0x2e')],'resourceId':_0xbf7b76['id'],'type':_0x1d1a9b[_0x870b('0x2e')],'sectionId':_0x1d1a9b['id']},{})[_0x870b('0x28')](function(){return _0x114333;});}else{return _0x114333;}})[_0x870b('0x5a')](function(_0x2e633e){logger[_0x870b('0x2c')](_0x870b('0x5b'),_0x2e633e);throw _0x2e633e;});}return _0x114333;})[_0x870b('0x28')](respondWithResult(_0xd318d1,0xc9))[_0x870b('0x5a')](handleError(_0xd318d1,null));};exports[_0x870b('0x5c')]=function(_0x5b696b,_0x2e3249){if(_0x5b696b['body']['id']){delete _0x5b696b[_0x870b('0x32')]['id'];}return db[_0x870b('0x39')][_0x870b('0x53')]({'where':{'id':_0x5b696b['params']['id']}})[_0x870b('0x28')](handleEntityNotFound(_0x2e3249,null))[_0x870b('0x28')](saveUpdates(_0x5b696b['body'],null))['then'](respondWithResult(_0x2e3249,null))[_0x870b('0x5a')](handleError(_0x2e3249,null));};exports[_0x870b('0x29')]=function(_0x56d416,_0x13aa8c){return db['ContactItemType']['find']({'where':{'id':_0x56d416[_0x870b('0x50')]['id']}})[_0x870b('0x28')](handleEntityNotFound(_0x13aa8c,null))[_0x870b('0x28')](removeEntity(_0x13aa8c,null))['catch'](handleError(_0x13aa8c,null));}; \ No newline at end of file +var _0xf092=['apply','reject','save','then','destroy','get','stack','name','render','merge','contact','message','agent','interaction','account','index','map','rawAttributes','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ContactItemType','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x32552e,_0x2035bd){var _0x2631d8=function(_0x3cef7e){while(--_0x3cef7e){_0x32552e['push'](_0x32552e['shift']());}};_0x2631d8(++_0x2035bd);}(_0xf092,0x18d));var _0x2f09=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xf092[_0x1ca9e9];return _0x309f3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f09('0x0'));var jsonpatch=require(_0x2f09('0x1'));var rp=require(_0x2f09('0x2'));var moment=require(_0x2f09('0x3'));var BPromise=require(_0x2f09('0x4'));var Mustache=require(_0x2f09('0x5'));var util=require('util');var path=require(_0x2f09('0x6'));var sox=require(_0x2f09('0x7'));var csv=require(_0x2f09('0x8'));var ejs=require(_0x2f09('0x9'));var fs=require('fs');var fs_extra=require(_0x2f09('0xa'));var _=require('lodash');var squel=require(_0x2f09('0xb'));var crypto=require(_0x2f09('0xc'));var jsforce=require(_0x2f09('0xd'));var deskjs=require(_0x2f09('0xe'));var toCsv=require(_0x2f09('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2f09('0xf'));var qs=require(_0x2f09('0x10'));var as=require(_0x2f09('0x11'));var hardwareService=require(_0x2f09('0x12'));var logger=require(_0x2f09('0x13'))(_0x2f09('0x14'));var utils=require(_0x2f09('0x15'));var config=require(_0x2f09('0x16'));var licenseUtil=require(_0x2f09('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d6e79,_0x1ceeef){_0x1ceeef=_0x1ceeef||0xcc;return function(_0xd78f67){if(_0xd78f67){return _0x4d6e79[_0x2f09('0x18')](_0x1ceeef);}return _0x4d6e79['status'](_0x1ceeef)[_0x2f09('0x19')]();};}function respondWithResult(_0x510538,_0x3032b9){_0x3032b9=_0x3032b9||0xc8;return function(_0x2c9da3){if(_0x2c9da3){return _0x510538[_0x2f09('0x1a')](_0x3032b9)[_0x2f09('0x1b')](_0x2c9da3);}};}function respondWithFilteredResult(_0x4e69d5,_0x7a979c){return function(_0x489ff0){if(_0x489ff0){var _0x3450be=typeof _0x7a979c[_0x2f09('0x1c')]==='undefined'&&typeof _0x7a979c[_0x2f09('0x1d')]===_0x2f09('0x1e');var _0x2ab541=_0x489ff0[_0x2f09('0x1f')];var _0x1ea4a3=_0x3450be?0x0:_0x7a979c[_0x2f09('0x1c')];var _0x4a111b=_0x3450be?_0x489ff0[_0x2f09('0x1f')]:_0x7a979c[_0x2f09('0x1c')]+_0x7a979c[_0x2f09('0x1d')];var _0x745c2d;if(_0x4a111b>=_0x2ab541){_0x4a111b=_0x2ab541;_0x745c2d=0xc8;}else{_0x745c2d=0xce;}_0x4e69d5[_0x2f09('0x1a')](_0x745c2d);return _0x4e69d5['set'](_0x2f09('0x20'),_0x1ea4a3+'-'+_0x4a111b+'/'+_0x2ab541)[_0x2f09('0x1b')](_0x489ff0);}return null;};}function patchUpdates(_0x5a041d){return function(_0x2ab26e){try{jsonpatch[_0x2f09('0x21')](_0x2ab26e,_0x5a041d,!![]);}catch(_0x2f66b3){return BPromise[_0x2f09('0x22')](_0x2f66b3);}return _0x2ab26e[_0x2f09('0x23')]();};}function saveUpdates(_0x28bdbc,_0x256760){return function(_0x4b8837){if(_0x4b8837){return _0x4b8837['update'](_0x28bdbc)[_0x2f09('0x24')](function(_0x56ec22){return _0x56ec22;});}return null;};}function removeEntity(_0x1fb9a7,_0x81a4f4){return function(_0x2f64ac){if(_0x2f64ac){return _0x2f64ac[_0x2f09('0x25')]()['then'](function(){var _0x301139=_0x2f64ac[_0x2f09('0x26')]({'plain':!![]});var _0x1aa3ab='ContactItemTypes';return db['UserProfileResource'][_0x2f09('0x25')]({'where':{'type':_0x1aa3ab,'resourceId':_0x301139['id']}})[_0x2f09('0x24')](function(){return _0x2f64ac;});})[_0x2f09('0x24')](function(){_0x1fb9a7[_0x2f09('0x1a')](0xcc)[_0x2f09('0x19')]();});}};}function handleEntityNotFound(_0x462719,_0x8ef0fe){return function(_0x233f45){if(!_0x233f45){_0x462719[_0x2f09('0x18')](0x194);}return _0x233f45;};}function handleError(_0x2603c0,_0x3b8aa6){_0x3b8aa6=_0x3b8aa6||0x1f4;return function(_0x216774){logger['error'](_0x216774[_0x2f09('0x27')]);if(_0x216774['name']){delete _0x216774[_0x2f09('0x28')];}_0x2603c0[_0x2f09('0x1a')](_0x3b8aa6)['send'](_0x216774);};}function getMustacheRender(_0x17fde4,_0x211651){return Mustache[_0x2f09('0x29')](_0x17fde4,_[_0x2f09('0x2a')](_0x211651['body'],{'contact':_0x211651[_0x2f09('0x2b')],'message':_0x211651[_0x2f09('0x2c')],'agent':_0x211651[_0x2f09('0x2d')],'interaction':_0x211651[_0x2f09('0x2e')],'account':_0x211651[_0x2f09('0x2f')]}))||'';}exports[_0x2f09('0x30')]=function(_0xfce90f,_0x3b6023){var _0x8672b3={},_0x590f8d={},_0x43f452={'count':0x0,'rows':[]};var _0x57d73b=_[_0x2f09('0x31')](db['ContactItemType'][_0x2f09('0x32')],function(_0x2e2133){return{'name':_0x2e2133['fieldName'],'type':_0x2e2133[_0x2f09('0x33')]['key']};});_0x590f8d[_0x2f09('0x34')]=_[_0x2f09('0x31')](_0x57d73b,_0x2f09('0x28'));_0x590f8d['query']=_[_0x2f09('0x35')](_0xfce90f[_0x2f09('0x36')]);_0x590f8d[_0x2f09('0x37')]=_['intersection'](_0x590f8d['model'],_0x590f8d[_0x2f09('0x36')]);_0x8672b3[_0x2f09('0x38')]=_['intersection'](_0x590f8d[_0x2f09('0x34')],qs[_0x2f09('0x39')](_0xfce90f[_0x2f09('0x36')][_0x2f09('0x39')]));_0x8672b3[_0x2f09('0x38')]=_0x8672b3[_0x2f09('0x38')][_0x2f09('0x3a')]?_0x8672b3[_0x2f09('0x38')]:_0x590f8d['model'];if(!_0xfce90f[_0x2f09('0x36')][_0x2f09('0x3b')](_0x2f09('0x3c'))){_0x8672b3[_0x2f09('0x1d')]=qs[_0x2f09('0x1d')](_0xfce90f[_0x2f09('0x36')][_0x2f09('0x1d')]);_0x8672b3[_0x2f09('0x1c')]=qs[_0x2f09('0x1c')](_0xfce90f[_0x2f09('0x36')][_0x2f09('0x1c')]);}_0x8672b3[_0x2f09('0x3d')]=qs['sort'](_0xfce90f['query'][_0x2f09('0x3e')]);_0x8672b3[_0x2f09('0x3f')]=qs[_0x2f09('0x37')](_[_0x2f09('0x40')](_0xfce90f[_0x2f09('0x36')],_0x590f8d['filters']),_0x57d73b);if(_0xfce90f[_0x2f09('0x36')][_0x2f09('0x41')]){_0x8672b3[_0x2f09('0x3f')]=_[_0x2f09('0x2a')](_0x8672b3[_0x2f09('0x3f')],{'$or':_[_0x2f09('0x31')](_0x57d73b,function(_0x3dbb3c){if(_0x3dbb3c['type']!==_0x2f09('0x42')){var _0x59f322={};_0x59f322[_0x3dbb3c[_0x2f09('0x28')]]={'$like':'%'+_0xfce90f['query'][_0x2f09('0x41')]+'%'};return _0x59f322;}})});}_0x8672b3=_[_0x2f09('0x2a')]({},_0x8672b3,_0xfce90f[_0x2f09('0x43')]);var _0x2c6ed6={'where':_0x8672b3[_0x2f09('0x3f')]};return db[_0x2f09('0x44')][_0x2f09('0x1f')](_0x2c6ed6)[_0x2f09('0x24')](function(_0x2d6b4e){_0x43f452['count']=_0x2d6b4e;if(_0xfce90f['query']['includeAll']){_0x8672b3[_0x2f09('0x45')]=[{'all':!![]}];}return db[_0x2f09('0x44')][_0x2f09('0x46')](_0x8672b3);})[_0x2f09('0x24')](function(_0x4fdf0e){_0x43f452[_0x2f09('0x47')]=_0x4fdf0e;return _0x43f452;})['then'](respondWithFilteredResult(_0x3b6023,_0x8672b3))[_0x2f09('0x48')](handleError(_0x3b6023,null));};exports[_0x2f09('0x49')]=function(_0x196d0d,_0x1241b2){var _0x9cb32a={'raw':!![],'where':{'id':_0x196d0d['params']['id']}},_0x4f0584={};_0x4f0584[_0x2f09('0x34')]=_[_0x2f09('0x35')](db[_0x2f09('0x44')][_0x2f09('0x32')]);_0x4f0584['query']=_[_0x2f09('0x35')](_0x196d0d[_0x2f09('0x36')]);_0x4f0584['filters']=_['intersection'](_0x4f0584['model'],_0x4f0584[_0x2f09('0x36')]);_0x9cb32a[_0x2f09('0x38')]=_['intersection'](_0x4f0584[_0x2f09('0x34')],qs[_0x2f09('0x39')](_0x196d0d[_0x2f09('0x36')][_0x2f09('0x39')]));_0x9cb32a[_0x2f09('0x38')]=_0x9cb32a[_0x2f09('0x38')][_0x2f09('0x3a')]?_0x9cb32a[_0x2f09('0x38')]:_0x4f0584['model'];if(_0x196d0d[_0x2f09('0x36')]['includeAll']){_0x9cb32a[_0x2f09('0x45')]=[{'all':!![]}];}_0x9cb32a=_[_0x2f09('0x2a')]({},_0x9cb32a,_0x196d0d[_0x2f09('0x43')]);return db['ContactItemType'][_0x2f09('0x4a')](_0x9cb32a)[_0x2f09('0x24')](handleEntityNotFound(_0x1241b2,null))[_0x2f09('0x24')](respondWithResult(_0x1241b2,null))[_0x2f09('0x48')](handleError(_0x1241b2,null));};exports[_0x2f09('0x4b')]=function(_0x513bba,_0x2ee4c1){return db[_0x2f09('0x44')]['create'](_0x513bba['body'],{})[_0x2f09('0x24')](function(_0x5a1d2b){var _0x12ed1b=_0x513bba[_0x2f09('0x4c')][_0x2f09('0x26')]({'plain':!![]});if(!_0x12ed1b)throw new Error(_0x2f09('0x4d'));if(_0x12ed1b[_0x2f09('0x4e')]===_0x2f09('0x4c')){var _0x47407c=_0x5a1d2b[_0x2f09('0x26')]({'plain':!![]});var _0x402677='ContactItemTypes';return db['UserProfileSection'][_0x2f09('0x4a')]({'where':{'name':_0x402677,'userProfileId':_0x12ed1b[_0x2f09('0x4f')]},'raw':!![]})['then'](function(_0x342a08){if(_0x342a08&&_0x342a08[_0x2f09('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x47407c['name'],'resourceId':_0x47407c['id'],'type':_0x342a08[_0x2f09('0x28')],'sectionId':_0x342a08['id']},{})[_0x2f09('0x24')](function(){return _0x5a1d2b;});}else{return _0x5a1d2b;}})[_0x2f09('0x48')](function(_0x12c522){logger[_0x2f09('0x51')](_0x2f09('0x52'),_0x12c522);throw _0x12c522;});}return _0x5a1d2b;})[_0x2f09('0x24')](respondWithResult(_0x2ee4c1,0xc9))[_0x2f09('0x48')](handleError(_0x2ee4c1,null));};exports[_0x2f09('0x53')]=function(_0x32a544,_0xde3692){if(_0x32a544[_0x2f09('0x54')]['id']){delete _0x32a544[_0x2f09('0x54')]['id'];}return db[_0x2f09('0x44')][_0x2f09('0x4a')]({'where':{'id':_0x32a544[_0x2f09('0x55')]['id']}})[_0x2f09('0x24')](handleEntityNotFound(_0xde3692,null))[_0x2f09('0x24')](saveUpdates(_0x32a544['body'],null))[_0x2f09('0x24')](respondWithResult(_0xde3692,null))[_0x2f09('0x48')](handleError(_0xde3692,null));};exports[_0x2f09('0x25')]=function(_0x564f8f,_0x4a821a){return db[_0x2f09('0x44')][_0x2f09('0x4a')]({'where':{'id':_0x564f8f[_0x2f09('0x55')]['id']}})[_0x2f09('0x24')](handleEntityNotFound(_0x4a821a,null))['then'](removeEntity(_0x4a821a,null))[_0x2f09('0x48')](handleError(_0x4a821a,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 83e7969..aadf509 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a2a=['tools_contact_item_types','lodash','util','../../config/logger','api','path','rimraf','./contactItemType.attributes','exports','define'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x256d9c,_0x1e9546){_0x256d9c=_0x256d9c-0x0;var _0x586003=_0x5a2a[_0x256d9c];return _0x586003;};'use strict';var _=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var logger=require(_0xa5a2('0x2'))(_0xa5a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a2('0x4'));var rimraf=require(_0xa5a2('0x5'));var config=require('../../config/environment');var attributes=require(_0xa5a2('0x6'));module[_0xa5a2('0x7')]=function(_0x2e97d3,_0x55728b){return _0x2e97d3[_0xa5a2('0x8')]('ContactItemType',attributes,{'tableName':_0xa5a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa498=['./contactItemType.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1f1f07,_0x37ac52){var _0x149c31=function(_0x241ab2){while(--_0x241ab2){_0x1f1f07['push'](_0x1f1f07['shift']());}};_0x149c31(++_0x37ac52);}(_0xa498,0x179));var _0x8a49=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xa498[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x8a49('0x0'));var util=require(_0x8a49('0x1'));var logger=require(_0x8a49('0x2'))('api');var moment=require(_0x8a49('0x3'));var BPromise=require(_0x8a49('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a49('0x5'));var rimraf=require(_0x8a49('0x6'));var config=require(_0x8a49('0x7'));var attributes=require(_0x8a49('0x8'));module[_0x8a49('0x9')]=function(_0x35a826,_0x580bd3){return _0x35a826[_0x8a49('0xa')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 570f205..36dbb58 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x823c=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x3efb47,_0x1d4196){var _0x434e88=function(_0x2274b0){while(--_0x2274b0){_0x3efb47['push'](_0x3efb47['shift']());}};_0x434e88(++_0x1d4196);}(_0x823c,0x143));var _0xc823=function(_0x3aa7e9,_0x90038c){_0x3aa7e9=_0x3aa7e9-0x0;var _0x146884=_0x823c[_0x3aa7e9];return _0x146884;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var moment=require(_0xc823('0x1'));var BPromise=require(_0xc823('0x2'));var rs=require(_0xc823('0x3'));var fs=require('fs');var Redis=require(_0xc823('0x4'));var db=require(_0xc823('0x5'))['db'];var utils=require(_0xc823('0x6'));var logger=require('../../config/logger')(_0xc823('0x7'));var config=require(_0xc823('0x8'));var jayson=require(_0xc823('0x9'));var client=jayson[_0xc823('0xa')][_0xc823('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49e861,_0xba407e,_0x472007){return new BPromise(function(_0x5daab9,_0x52bb76){return client[_0xc823('0xc')](_0x49e861,_0x472007)[_0xc823('0xd')](function(_0x53d48d){logger[_0xc823('0xe')](_0xc823('0xf'),_0xba407e,'request\x20sent');logger['debug'](_0xc823('0x10'),_0xba407e,_0xc823('0x11'),JSON[_0xc823('0x12')](_0x53d48d));if(_0x53d48d[_0xc823('0x13')]){if(_0x53d48d[_0xc823('0x13')]['code']===0x1f4){logger[_0xc823('0x13')](_0xc823('0xf'),_0xba407e,_0x53d48d[_0xc823('0x13')][_0xc823('0x14')]);return _0x52bb76(_0x53d48d[_0xc823('0x13')][_0xc823('0x14')]);}logger['error'](_0xc823('0xf'),_0xba407e,_0x53d48d[_0xc823('0x13')][_0xc823('0x14')]);return _0x5daab9(_0x53d48d[_0xc823('0x13')]['message']);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0xba407e,'request\x20sent');_0x5daab9(_0x53d48d[_0xc823('0x15')]['message']);}})[_0xc823('0x16')](function(_0x122510){logger[_0xc823('0x13')](_0xc823('0xf'),_0xba407e,_0x122510);_0x52bb76(_0x122510);});});} \ No newline at end of file +var _0x2bb0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','randomstring'];(function(_0x1ef699,_0x57dcbd){var _0x384b86=function(_0x22fc2b){while(--_0x22fc2b){_0x1ef699['push'](_0x1ef699['shift']());}};_0x384b86(++_0x57dcbd);}(_0x2bb0,0xf3));var _0x02bb=function(_0x1c4e53,_0x3566b6){_0x1c4e53=_0x1c4e53-0x0;var _0x267f8d=_0x2bb0[_0x1c4e53];return _0x267f8d;};'use strict';var _=require(_0x02bb('0x0'));var util=require(_0x02bb('0x1'));var moment=require(_0x02bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x02bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02bb('0x4'));var logger=require('../../config/logger')(_0x02bb('0x5'));var config=require(_0x02bb('0x6'));var jayson=require(_0x02bb('0x7'));var client=jayson[_0x02bb('0x8')][_0x02bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16bb7c,_0x440f9c,_0x47d7ae){return new BPromise(function(_0x6d064a,_0x15e425){return client[_0x02bb('0xa')](_0x16bb7c,_0x47d7ae)['then'](function(_0x3d28d5){logger['info'](_0x02bb('0xb'),_0x440f9c,_0x02bb('0xc'));logger['debug'](_0x02bb('0xd'),_0x440f9c,_0x02bb('0xc'),JSON[_0x02bb('0xe')](_0x3d28d5));if(_0x3d28d5['error']){if(_0x3d28d5[_0x02bb('0xf')]['code']===0x1f4){logger[_0x02bb('0xf')](_0x02bb('0xb'),_0x440f9c,_0x3d28d5[_0x02bb('0xf')]['message']);return _0x15e425(_0x3d28d5[_0x02bb('0xf')][_0x02bb('0x10')]);}logger[_0x02bb('0xf')]('ContactItemType,\x20%s,\x20%s',_0x440f9c,_0x3d28d5[_0x02bb('0xf')]['message']);return _0x6d064a(_0x3d28d5[_0x02bb('0xf')][_0x02bb('0x10')]);}else{logger[_0x02bb('0x11')](_0x02bb('0xb'),_0x440f9c,_0x02bb('0xc'));_0x6d064a(_0x3d28d5[_0x02bb('0x12')]['message']);}})['catch'](function(_0x4711fb){logger[_0x02bb('0xf')](_0x02bb('0xb'),_0x440f9c,_0x4711fb);_0x15e425(_0x4711fb);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 2422fca..53c5268 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x424a=['delete','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','post','create','put','update'];(function(_0x48ac7f,_0xb8ec44){var _0x50a9b6=function(_0x46d1fa){while(--_0x46d1fa){_0x48ac7f['push'](_0x48ac7f['shift']());}};_0x50a9b6(++_0xb8ec44);}(_0x424a,0x192));var _0xa424=function(_0x165ece,_0x1f0a42){_0x165ece=_0x165ece-0x0;var _0x545fe6=_0x424a[_0x165ece];return _0x545fe6;};'use strict';var multer=require(_0xa424('0x0'));var util=require(_0xa424('0x1'));var path=require(_0xa424('0x2'));var timeout=require('connect-timeout');var express=require(_0xa424('0x3'));var router=express[_0xa424('0x4')]();var fs_extra=require(_0xa424('0x5'));var auth=require(_0xa424('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa424('0x7'));var controller=require(_0xa424('0x8'));router[_0xa424('0x9')]('/',auth[_0xa424('0xa')](),controller[_0xa424('0xb')]);router[_0xa424('0x9')]('/:id',auth[_0xa424('0xa')](),controller['show']);router[_0xa424('0xc')]('/',auth[_0xa424('0xa')](),controller[_0xa424('0xd')]);router[_0xa424('0xe')]('/:id',auth[_0xa424('0xa')](),controller[_0xa424('0xf')]);router[_0xa424('0x10')](_0xa424('0x11'),auth[_0xa424('0xa')](),controller['destroy']);module[_0xa424('0x12')]=router; \ No newline at end of file +var _0x7649=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','create','update'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x7649,0x124));var _0x9764=function(_0x51ea1b,_0x1c5a3b){_0x51ea1b=_0x51ea1b-0x0;var _0x56d914=_0x7649[_0x51ea1b];return _0x56d914;};'use strict';var multer=require(_0x9764('0x0'));var util=require(_0x9764('0x1'));var path=require(_0x9764('0x2'));var timeout=require(_0x9764('0x3'));var express=require('express');var router=express[_0x9764('0x4')]();var fs_extra=require(_0x9764('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9764('0x6'));var controller=require(_0x9764('0x7'));router[_0x9764('0x8')]('/',auth[_0x9764('0x9')](),controller['index']);router[_0x9764('0x8')](_0x9764('0xa'),auth[_0x9764('0x9')](),controller[_0x9764('0xb')]);router['post']('/',auth[_0x9764('0x9')](),controller[_0x9764('0xc')]);router['put'](_0x9764('0xa'),auth[_0x9764('0x9')](),controller[_0x9764('0xd')]);router[_0x9764('0xe')](_0x9764('0xa'),auth['isAuthenticated'](),controller[_0x9764('0xf')]);module[_0x9764('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index e4efc69..92a6c1d 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4397=['sequelize','exports','STRING','name'];(function(_0x4b8aa8,_0x1cc2b6){var _0x51040e=function(_0x35ca67){while(--_0x35ca67){_0x4b8aa8['push'](_0x4b8aa8['shift']());}};_0x51040e(++_0x1cc2b6);}(_0x4397,0xe4));var _0x7439=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x4397[_0x32b993];return _0x482780;};'use strict';var Sequelize=require(_0x7439('0x0'));module[_0x7439('0x1')]={'name':{'type':Sequelize[_0x7439('0x2')],'allowNull':![],'unique':_0x7439('0x3')},'description':{'type':Sequelize[_0x7439('0x2')]}}; \ No newline at end of file +var _0x0683=['exports','name','STRING'];(function(_0x2300a1,_0x3c924a){var _0x3e9d33=function(_0x1ad1b5){while(--_0x1ad1b5){_0x2300a1['push'](_0x2300a1['shift']());}};_0x3e9d33(++_0x3c924a);}(_0x0683,0xe1));var _0x3068=function(_0x1f805a,_0xf79448){_0x1f805a=_0x1f805a-0x0;var _0x5eef98=_0x0683[_0x1f805a];return _0x5eef98;};'use strict';var Sequelize=require('sequelize');module[_0x3068('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3068('0x1')},'description':{'type':Sequelize[_0x3068('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 93269b5..0b24868 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x311b=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','iframe','attrUrl','attrs','https://','custom','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','render','contact','message','agent','account','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','then','include','findAll','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','clone','omit','updatedAt','createdAt'];(function(_0x48bc1a,_0xa1e621){var _0x49d785=function(_0x308694){while(--_0x308694){_0x48bc1a['push'](_0x48bc1a['shift']());}};_0x49d785(++_0xa1e621);}(_0x311b,0xa1));var _0xb311=function(_0xefb70a,_0x41640c){_0xefb70a=_0xefb70a-0x0;var _0x2a7dae=_0x311b[_0xefb70a];return _0x2a7dae;};'use strict';var emlformat=require(_0xb311('0x0'));var rimraf=require(_0xb311('0x1'));var zipdir=require(_0xb311('0x2'));var jsonpatch=require(_0xb311('0x3'));var rp=require('request-promise');var moment=require(_0xb311('0x4'));var BPromise=require(_0xb311('0x5'));var Mustache=require('mustache');var util=require(_0xb311('0x6'));var path=require(_0xb311('0x7'));var sox=require(_0xb311('0x8'));var csv=require(_0xb311('0x9'));var ejs=require(_0xb311('0xa'));var fs=require('fs');var fs_extra=require(_0xb311('0xb'));var _=require(_0xb311('0xc'));var squel=require(_0xb311('0xd'));var crypto=require('crypto');var jsforce=require(_0xb311('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb311('0xf'));var Papa=require('papaparse');var Redis=require(_0xb311('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb311('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb311('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb311('0x13'));var licenseUtil=require(_0xb311('0x14'));var db=require(_0xb311('0x15'))['db'];config[_0xb311('0x16')]=_[_0xb311('0x17')](config[_0xb311('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb311('0x18'))(new Redis(config[_0xb311('0x16')]));require(_0xb311('0x19'))[_0xb311('0x1a')](socket);function respondWithStatusCode(_0x118142,_0x17b04d){_0x17b04d=_0x17b04d||0xcc;return function(_0x324914){if(_0x324914){return _0x118142[_0xb311('0x1b')](_0x17b04d);}return _0x118142[_0xb311('0x1c')](_0x17b04d)['end']();};}function respondWithResult(_0x315800,_0xa592b2){_0xa592b2=_0xa592b2||0xc8;return function(_0x4f524b){if(_0x4f524b){return _0x315800['status'](_0xa592b2)[_0xb311('0x1d')](_0x4f524b);}};}function respondWithFilteredResult(_0x3e8e0d,_0x3478f7){return function(_0x3693cc){if(_0x3693cc){var _0x289d1e=typeof _0x3478f7[_0xb311('0x1e')]===_0xb311('0x1f')&&typeof _0x3478f7[_0xb311('0x20')]===_0xb311('0x1f');var _0xf3c5a=_0x3693cc['count'];var _0x5c6875=_0x289d1e?0x0:_0x3478f7[_0xb311('0x1e')];var _0x4d9c6f=_0x289d1e?_0x3693cc[_0xb311('0x21')]:_0x3478f7[_0xb311('0x1e')]+_0x3478f7['limit'];var _0x4fb5c2;if(_0x4d9c6f>=_0xf3c5a){_0x4d9c6f=_0xf3c5a;_0x4fb5c2=0xc8;}else{_0x4fb5c2=0xce;}_0x3e8e0d[_0xb311('0x1c')](_0x4fb5c2);return _0x3e8e0d[_0xb311('0x22')](_0xb311('0x23'),_0x5c6875+'-'+_0x4d9c6f+'/'+_0xf3c5a)[_0xb311('0x1d')](_0x3693cc);}return null;};}function patchUpdates(_0x37d563){return function(_0x1e0631){try{jsonpatch[_0xb311('0x24')](_0x1e0631,_0x37d563,!![]);}catch(_0x5776be){return BPromise[_0xb311('0x25')](_0x5776be);}return _0x1e0631[_0xb311('0x26')]();};}function saveUpdates(_0x5f42a1,_0x59c485){return function(_0x2794d9){if(_0x2794d9){return _0x2794d9[_0xb311('0x27')](_0x5f42a1)['then'](function(_0x50aeb7){return _0x50aeb7;});}return null;};}function removeEntity(_0x5b9bd3,_0x23de0a){return function(_0x48f8e0){if(_0x48f8e0){return _0x48f8e0[_0xb311('0x28')]()['then'](function(){var _0x203c79=_0x48f8e0[_0xb311('0x29')]({'plain':!![]});var _0x298ab3=_0xb311('0x2a');return db[_0xb311('0x2b')]['destroy']({'where':{'type':_0x298ab3,'resourceId':_0x203c79['id']}})['then'](function(){return _0x48f8e0;});})['then'](function(){_0x5b9bd3[_0xb311('0x1c')](0xcc)[_0xb311('0x2c')]();});}};}function handleEntityNotFound(_0x18beb4,_0x3e5463){return function(_0x20da5f){if(!_0x20da5f){_0x18beb4[_0xb311('0x1b')](0x194);}return _0x20da5f;};}function handleError(_0x849391,_0x476cfc){_0x476cfc=_0x476cfc||0x1f4;return function(_0x42e2d2){logger[_0xb311('0x2d')](_0x42e2d2[_0xb311('0x2e')]);if(_0x42e2d2[_0xb311('0x2f')]){delete _0x42e2d2[_0xb311('0x2f')];}_0x849391[_0xb311('0x1c')](_0x476cfc)[_0xb311('0x30')](_0x42e2d2);};}function getMustacheRender(_0x21b3e1,_0x245afc){return Mustache[_0xb311('0x31')](_0x21b3e1,_['merge'](_0x245afc['body'],{'contact':_0x245afc[_0xb311('0x32')],'message':_0x245afc[_0xb311('0x33')],'agent':_0x245afc[_0xb311('0x34')],'interaction':_0x245afc['interaction'],'account':_0x245afc[_0xb311('0x35')]}))||'';}exports[_0xb311('0x36')]=function(_0x76449a,_0x213ef5){var _0x48e6d4={},_0x5955e0={},_0xa2a557={'count':0x0,'rows':[]};var _0xdc14e2=_[_0xb311('0x37')](db[_0xb311('0x38')][_0xb311('0x39')],function(_0x5c2959){return{'name':_0x5c2959[_0xb311('0x3a')],'type':_0x5c2959[_0xb311('0x3b')][_0xb311('0x3c')]};});_0x5955e0[_0xb311('0x3d')]=_[_0xb311('0x37')](_0xdc14e2,'name');_0x5955e0[_0xb311('0x3e')]=_[_0xb311('0x3f')](_0x76449a['query']);_0x5955e0[_0xb311('0x40')]=_[_0xb311('0x41')](_0x5955e0[_0xb311('0x3d')],_0x5955e0[_0xb311('0x3e')]);_0x48e6d4[_0xb311('0x42')]=_[_0xb311('0x41')](_0x5955e0[_0xb311('0x3d')],qs[_0xb311('0x43')](_0x76449a[_0xb311('0x3e')][_0xb311('0x43')]));_0x48e6d4[_0xb311('0x42')]=_0x48e6d4['attributes'][_0xb311('0x44')]?_0x48e6d4['attributes']:_0x5955e0[_0xb311('0x3d')];if(!_0x76449a['query'][_0xb311('0x45')](_0xb311('0x46'))){_0x48e6d4[_0xb311('0x20')]=qs[_0xb311('0x20')](_0x76449a[_0xb311('0x3e')][_0xb311('0x20')]);_0x48e6d4[_0xb311('0x1e')]=qs[_0xb311('0x1e')](_0x76449a[_0xb311('0x3e')][_0xb311('0x1e')]);}_0x48e6d4[_0xb311('0x47')]=qs[_0xb311('0x48')](_0x76449a['query'][_0xb311('0x48')]);_0x48e6d4[_0xb311('0x49')]=qs[_0xb311('0x40')](_[_0xb311('0x4a')](_0x76449a[_0xb311('0x3e')],_0x5955e0[_0xb311('0x40')]),_0xdc14e2);if(_0x76449a['query'][_0xb311('0x4b')]){_0x48e6d4[_0xb311('0x49')]=_[_0xb311('0x4c')](_0x48e6d4[_0xb311('0x49')],{'$or':_[_0xb311('0x37')](_0xdc14e2,function(_0x2259aa){if(_0x2259aa[_0xb311('0x3b')]!=='VIRTUAL'){var _0x1ddd71={};_0x1ddd71[_0x2259aa[_0xb311('0x2f')]]={'$like':'%'+_0x76449a[_0xb311('0x3e')][_0xb311('0x4b')]+'%'};return _0x1ddd71;}})});}_0x48e6d4=_[_0xb311('0x4c')]({},_0x48e6d4,_0x76449a['options']);var _0xe85ea9={'where':_0x48e6d4['where']};return db[_0xb311('0x38')]['count'](_0xe85ea9)[_0xb311('0x4d')](function(_0x31a751){_0xa2a557[_0xb311('0x21')]=_0x31a751;if(_0x76449a[_0xb311('0x3e')]['includeAll']){_0x48e6d4[_0xb311('0x4e')]=[{'all':!![]}];}return db[_0xb311('0x38')][_0xb311('0x4f')](_0x48e6d4);})['then'](function(_0x541564){_0xa2a557[_0xb311('0x50')]=_0x541564;return _0xa2a557;})['then'](respondWithFilteredResult(_0x213ef5,_0x48e6d4))[_0xb311('0x51')](handleError(_0x213ef5,null));};exports[_0xb311('0x52')]=function(_0x15ba6a,_0x265997){var _0x91369e={'raw':![],'where':{'id':_0x15ba6a['params']['id']}},_0x39f594={};_0x39f594[_0xb311('0x3d')]=_[_0xb311('0x3f')](db[_0xb311('0x38')]['rawAttributes']);_0x39f594[_0xb311('0x3e')]=_[_0xb311('0x3f')](_0x15ba6a[_0xb311('0x3e')]);_0x39f594[_0xb311('0x40')]=_[_0xb311('0x41')](_0x39f594[_0xb311('0x3d')],_0x39f594['query']);_0x91369e[_0xb311('0x42')]=_[_0xb311('0x41')](_0x39f594['model'],qs['fields'](_0x15ba6a['query'][_0xb311('0x43')]));_0x91369e['attributes']=_0x91369e[_0xb311('0x42')][_0xb311('0x44')]?_0x91369e[_0xb311('0x42')]:_0x39f594[_0xb311('0x3d')];if(_0x15ba6a['query'][_0xb311('0x53')]){_0x91369e[_0xb311('0x4e')]=[{'all':!![]}];}_0x91369e=_[_0xb311('0x4c')]({},_0x91369e,_0x15ba6a[_0xb311('0x54')]);return db[_0xb311('0x38')][_0xb311('0x55')](_0x91369e)[_0xb311('0x4d')](handleEntityNotFound(_0x265997,null))['then'](respondWithResult(_0x265997,null))[_0xb311('0x51')](handleError(_0x265997,null));};exports[_0xb311('0x56')]=function(_0x40c4aa,_0x87404){return db[_0xb311('0x38')][_0xb311('0x56')](_0x40c4aa[_0xb311('0x57')],{})[_0xb311('0x4d')](function(_0x4c53ec){var _0x368a20=_0x40c4aa[_0xb311('0x58')][_0xb311('0x29')]({'plain':!![]});if(!_0x368a20)throw new Error(_0xb311('0x59'));if(_0x368a20[_0xb311('0x5a')]==='user'){var _0x1bd503=_0x4c53ec[_0xb311('0x29')]({'plain':!![]});var _0x3caba8=_0xb311('0x2a');return db[_0xb311('0x5b')][_0xb311('0x55')]({'where':{'name':_0x3caba8,'userProfileId':_0x368a20[_0xb311('0x5c')]},'raw':!![]})['then'](function(_0x4f5750){if(_0x4f5750&&_0x4f5750['autoAssociation']===0x0){return db[_0xb311('0x2b')]['create']({'name':_0x1bd503[_0xb311('0x2f')],'resourceId':_0x1bd503['id'],'type':_0x4f5750['name'],'sectionId':_0x4f5750['id']},{})[_0xb311('0x4d')](function(){return _0x4c53ec;});}else{return _0x4c53ec;}})['catch'](function(_0x432ff9){logger[_0xb311('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x432ff9);throw _0x432ff9;});}return _0x4c53ec;})['then'](respondWithResult(_0x87404,0xc9))[_0xb311('0x51')](handleError(_0x87404,null));};exports[_0xb311('0x5d')]=function(_0x1a5b21,_0x38c7ff){var _0x5878b0={'where':{'id':_0x1a5b21['params']['id']}},_0x3fab5c={};_0x3fab5c[_0xb311('0x3d')]=_[_0xb311('0x3f')](db['Dashboard'][_0xb311('0x39')]);_0x5878b0[_0xb311('0x42')]=_[_0xb311('0x41')](_0x3fab5c[_0xb311('0x3d')],qs['fields'](_0x1a5b21[_0xb311('0x3e')]['fields']));_0x5878b0[_0xb311('0x42')]=_0x5878b0['attributes'][_0xb311('0x44')]?_0x5878b0[_0xb311('0x42')]:_0x3fab5c[_0xb311('0x3d')];if(_0x1a5b21[_0xb311('0x3e')][_0xb311('0x53')]){_0x5878b0['include']=[{'all':!![]}];}_0x5878b0=_[_0xb311('0x4c')]({},_0x5878b0,_0x1a5b21['options']);return db[_0xb311('0x38')][_0xb311('0x55')](_0x5878b0)[_0xb311('0x4d')](handleEntityNotFound(_0x38c7ff,null))[_0xb311('0x4d')](function(_0x870c3){if(_0x870c3){var _0x884c8b=_0x870c3[_0xb311('0x29')]({'plain':!![]});_0x884c8b=qs[_0xb311('0x5e')](_0x884c8b,['id','createdAt',_0xb311('0x5f')]);_0x1a5b21['body']=_[_0xb311('0x5e')](_0x1a5b21[_0xb311('0x57')],['id',_0xb311('0x60'),_0xb311('0x5f')]);return db[_0xb311('0x38')][_0xb311('0x56')](_[_0xb311('0x4c')](_0x884c8b,_0x1a5b21[_0xb311('0x57')]),{'include':_0x1a5b21[_0xb311('0x3e')][_0xb311('0x53')]?[{'all':!![]}]:undefined})[_0xb311('0x4d')](function(_0x23c558){var _0x4f375f=_0x1a5b21['user'][_0xb311('0x29')]({'plain':!![]});if(!_0x4f375f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f375f['role']===_0xb311('0x58')){var _0x3d2214=_0x23c558['get']({'plain':!![]});var _0x5b8fbd=_0xb311('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x5b8fbd,'userProfileId':_0x4f375f['userProfileId']},'raw':!![]})[_0xb311('0x4d')](function(_0x127b71){if(_0x127b71&&_0x127b71[_0xb311('0x61')]===0x0){return db[_0xb311('0x2b')]['create']({'name':_0x3d2214[_0xb311('0x2f')],'resourceId':_0x3d2214['id'],'type':_0x127b71['name'],'sectionId':_0x127b71['id']},{})[_0xb311('0x4d')](function(){return _0x23c558;});}else{return _0x23c558;}})['catch'](function(_0x113cbf){logger[_0xb311('0x2d')](_0xb311('0x62'),_0x113cbf);throw _0x113cbf;});}return _0x23c558;});}})[_0xb311('0x4d')](respondWithResult(_0x38c7ff,0xc9))['catch'](handleError(_0x38c7ff,null));};exports['update']=function(_0x1c7b5e,_0x21eb63){if(_0x1c7b5e[_0xb311('0x57')]['id']){delete _0x1c7b5e['body']['id'];}return db[_0xb311('0x38')][_0xb311('0x55')]({'where':{'id':_0x1c7b5e[_0xb311('0x63')]['id']}})['then'](handleEntityNotFound(_0x21eb63,null))[_0xb311('0x4d')](saveUpdates(_0x1c7b5e[_0xb311('0x57')],null))[_0xb311('0x4d')](respondWithResult(_0x21eb63,null))['catch'](handleError(_0x21eb63,null));};exports['destroy']=function(_0x366185,_0x47f1da){return db[_0xb311('0x38')][_0xb311('0x55')]({'where':{'id':_0x366185[_0xb311('0x63')]['id']}})['then'](handleEntityNotFound(_0x47f1da,null))['then'](removeEntity(_0x47f1da,null))[_0xb311('0x51')](handleError(_0x47f1da,null));};function widgetAttributes(_0x2f4d0f){try{switch(_0x2f4d0f['type']){case _0xb311('0x64'):return[{'name':_0xb311('0x65'),'value':_0x2f4d0f[_0xb311('0x65')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f['attrs'][0x0]['value']:undefined)||_0xb311('0x67')}];case _0xb311('0x68'):return[{'name':'attrPath','value':_0x2f4d0f['attrPath']||(_0x2f4d0f['attrs']&&_0x2f4d0f['attrs'][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||''}];case _0xb311('0x6a'):return[{'name':_0xb311('0x6b'),'value':_0x2f4d0f[_0xb311('0x6b')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||'HH:mm:ss'},{'name':_0xb311('0x6c'),'value':_0x2f4d0f[_0xb311('0x6c')]||(_0x2f4d0f['attrs']&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f[_0xb311('0x66')][0x1][_0xb311('0x69')]:undefined)||_0xb311('0x6d')},{'name':_0xb311('0x6e'),'value':_0x2f4d0f['attrFontSize']||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f['attrs'][0x2]?_0x2f4d0f[_0xb311('0x66')][0x2][_0xb311('0x69')]:undefined)||0xc}];case _0xb311('0x6f'):return[{'name':'attrMetric','value':_0x2f4d0f[_0xb311('0x70')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||_0xb311('0x71')},{'name':_0xb311('0x72'),'value':_0x2f4d0f[_0xb311('0x72')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f[_0xb311('0x66')][0x1][_0xb311('0x69')]:undefined)||[]},{'name':_0xb311('0x6e'),'value':_0x2f4d0f['attrFontSize']||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x2]?_0x2f4d0f['attrs'][0x2][_0xb311('0x69')]:undefined)||0x14}];case _0xb311('0x73'):case _0xb311('0x74'):return[{'name':_0xb311('0x75'),'value':_0x2f4d0f[_0xb311('0x75')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f['attrs'][0x0][_0xb311('0x69')]:undefined)||_0xb311('0x71')},{'name':_0xb311('0x76'),'value':_0x2f4d0f[_0xb311('0x76')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f['attrs'][0x1]['value']:undefined)||null},{'name':_0xb311('0x77'),'value':_0x2f4d0f[_0xb311('0x77')]||(_0x2f4d0f['attrs']&&_0x2f4d0f[_0xb311('0x66')][0x2]?_0x2f4d0f[_0xb311('0x66')][0x2][_0xb311('0x69')]:undefined)||null},{'name':_0xb311('0x72'),'value':_0x2f4d0f['attrVoiceQueues']||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f['attrs'][0x3]?_0x2f4d0f[_0xb311('0x66')][0x3][_0xb311('0x69')]:undefined)||[]}];case _0xb311('0x78'):return[{'name':_0xb311('0x79'),'type':_0x2f4d0f[_0xb311('0x7a')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x0]?_0x2f4d0f['attrs'][0x0][_0xb311('0x3b')]:undefined)||null,'value':_0x2f4d0f[_0xb311('0x79')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f['attrs'][0x0]?_0x2f4d0f[_0xb311('0x66')][0x0][_0xb311('0x69')]:undefined)||null},{'name':_0xb311('0x7b'),'value':_0x2f4d0f[_0xb311('0x7b')]||(_0x2f4d0f[_0xb311('0x66')]&&_0x2f4d0f[_0xb311('0x66')][0x1]?_0x2f4d0f[_0xb311('0x66')][0x1][_0xb311('0x69')]:undefined)||0x0}];default:return[];}}catch(_0xa3b053){logger[_0xb311('0x2d')](_0xb311('0x7c'),JSON['stringify'](_0xa3b053));return[];}}exports['addItem']=function(_0x18df0e,_0x1356ec,_0x5dc5ca){if(_0x18df0e[_0xb311('0x57')]['id']){delete _0x18df0e[_0xb311('0x57')]['id'];}return db[_0xb311('0x38')][_0xb311('0x55')]({'where':{'id':_0x18df0e['params']['id']}})['then'](handleEntityNotFound(_0x1356ec,null))[_0xb311('0x4d')](function(_0x3d608b){if(_0x3d608b){_0x18df0e[_0xb311('0x57')][_0xb311('0x7d')]=_0x3d608b['id'];_0x18df0e[_0xb311('0x57')]['attrs']=widgetAttributes(_0x18df0e['body']);return db[_0xb311('0x7e')][_0xb311('0x56')](_0x18df0e['body']);}})[_0xb311('0x4d')](respondWithResult(_0x1356ec,null))[_0xb311('0x51')](handleError(_0x1356ec,null));};exports[_0xb311('0x7f')]=function(_0x5853ae,_0x19e647,_0x3b121b){var _0x4e92b7={};var _0x2e0fc2={};var _0x1a40cc;var _0x41ad26;return db[_0xb311('0x38')][_0xb311('0x80')]({'where':{'id':_0x5853ae[_0xb311('0x63')]['id']}})[_0xb311('0x4d')](handleEntityNotFound(_0x19e647,null))['then'](function(_0x5bf9ec){if(_0x5bf9ec){_0x1a40cc=_0x5bf9ec;_0x2e0fc2[_0xb311('0x3d')]=_[_0xb311('0x3f')](db[_0xb311('0x7e')][_0xb311('0x39')]);_0x2e0fc2[_0xb311('0x3e')]=_['keys'](_0x5853ae[_0xb311('0x3e')]);_0x2e0fc2[_0xb311('0x40')]=_[_0xb311('0x41')](_0x2e0fc2[_0xb311('0x3d')],_0x2e0fc2[_0xb311('0x3e')]);_0x4e92b7['attributes']=_[_0xb311('0x41')](_0x2e0fc2[_0xb311('0x3d')],qs[_0xb311('0x43')](_0x5853ae[_0xb311('0x3e')][_0xb311('0x43')]));_0x4e92b7['attributes']=_0x4e92b7[_0xb311('0x42')][_0xb311('0x44')]?_0x4e92b7['attributes']:_0x2e0fc2[_0xb311('0x3d')];_0x4e92b7[_0xb311('0x47')]=qs[_0xb311('0x48')](_0x5853ae[_0xb311('0x3e')]['sort']);_0x4e92b7['where']=qs[_0xb311('0x40')](_[_0xb311('0x4a')](_0x5853ae[_0xb311('0x3e')],_0x2e0fc2[_0xb311('0x40')]));if(_0x5853ae[_0xb311('0x3e')][_0xb311('0x4b')]){_0x4e92b7[_0xb311('0x49')]=_[_0xb311('0x4c')](_0x4e92b7['where'],{'$or':_[_0xb311('0x37')](_0x4e92b7[_0xb311('0x42')],function(_0x4ea1b4){var _0x181783={};_0x181783[_0x4ea1b4]={'$like':'%'+_0x5853ae[_0xb311('0x3e')]['filter']+'%'};return _0x181783;})});}_0x4e92b7=_['merge']({},_0x4e92b7,_0x5853ae[_0xb311('0x54')]);return _0x1a40cc[_0xb311('0x7f')](_0x4e92b7);}})[_0xb311('0x4d')](function(_0x59cff0){if(_0x59cff0){_0x41ad26=_0x59cff0[_0xb311('0x44')];if(!_0x5853ae[_0xb311('0x3e')][_0xb311('0x45')](_0xb311('0x46'))){_0x4e92b7[_0xb311('0x20')]=qs[_0xb311('0x20')](_0x5853ae['query'][_0xb311('0x20')]);_0x4e92b7['offset']=qs[_0xb311('0x1e')](_0x5853ae['query']['offset']);}return _0x1a40cc[_0xb311('0x7f')](_0x4e92b7);}})[_0xb311('0x4d')](function(_0x3c0058){if(_0x3c0058){return _0x3c0058?{'count':_0x41ad26,'rows':_0x3c0058}:null;}})[_0xb311('0x4d')](respondWithResult(_0x19e647,null))[_0xb311('0x51')](handleError(_0x19e647,null));}; \ No newline at end of file +var _0xaf68=['count','offset','set','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','map','Dashboard','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','create','user','role','userProfileId','autoAssociation','clone','params','find','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','undefined','limit'];(function(_0x4c9278,_0x324a88){var _0x7844a9=function(_0x24e5dc){while(--_0x24e5dc){_0x4c9278['push'](_0x4c9278['shift']());}};_0x7844a9(++_0x324a88);}(_0xaf68,0x1d1));var _0x8af6=function(_0x1b637f,_0x42dc24){_0x1b637f=_0x1b637f-0x0;var _0x4d98f5=_0xaf68[_0x1b637f];return _0x4d98f5;};'use strict';var emlformat=require(_0x8af6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8af6('0x1'));var jsonpatch=require(_0x8af6('0x2'));var rp=require(_0x8af6('0x3'));var moment=require(_0x8af6('0x4'));var BPromise=require(_0x8af6('0x5'));var Mustache=require(_0x8af6('0x6'));var util=require('util');var path=require(_0x8af6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8af6('0x8'));var fs=require('fs');var fs_extra=require(_0x8af6('0x9'));var _=require(_0x8af6('0xa'));var squel=require(_0x8af6('0xb'));var crypto=require(_0x8af6('0xc'));var jsforce=require(_0x8af6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8af6('0xe'));var querystring=require(_0x8af6('0xf'));var Papa=require(_0x8af6('0x10'));var Redis=require(_0x8af6('0x11'));var authService=require(_0x8af6('0x12'));var qs=require(_0x8af6('0x13'));var as=require(_0x8af6('0x14'));var hardwareService=require(_0x8af6('0x15'));var logger=require('../../config/logger')(_0x8af6('0x16'));var utils=require(_0x8af6('0x17'));var config=require(_0x8af6('0x18'));var licenseUtil=require(_0x8af6('0x19'));var db=require(_0x8af6('0x1a'))['db'];config[_0x8af6('0x1b')]=_['defaults'](config[_0x8af6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x8af6('0x1c'))(new Redis(config['redis']));require('./dashboard.socket')[_0x8af6('0x1d')](socket);function respondWithStatusCode(_0x1a7bb8,_0x31448a){_0x31448a=_0x31448a||0xcc;return function(_0x253daa){if(_0x253daa){return _0x1a7bb8[_0x8af6('0x1e')](_0x31448a);}return _0x1a7bb8[_0x8af6('0x1f')](_0x31448a)[_0x8af6('0x20')]();};}function respondWithResult(_0x2e9b03,_0x135061){_0x135061=_0x135061||0xc8;return function(_0x3a3e14){if(_0x3a3e14){return _0x2e9b03[_0x8af6('0x1f')](_0x135061)['json'](_0x3a3e14);}};}function respondWithFilteredResult(_0x1a9aa6,_0x24fa24){return function(_0x232912){if(_0x232912){var _0x1fe47e=typeof _0x24fa24['offset']===_0x8af6('0x21')&&typeof _0x24fa24[_0x8af6('0x22')]===_0x8af6('0x21');var _0x28941a=_0x232912[_0x8af6('0x23')];var _0x1adcb2=_0x1fe47e?0x0:_0x24fa24[_0x8af6('0x24')];var _0x55db67=_0x1fe47e?_0x232912[_0x8af6('0x23')]:_0x24fa24[_0x8af6('0x24')]+_0x24fa24[_0x8af6('0x22')];var _0x176167;if(_0x55db67>=_0x28941a){_0x55db67=_0x28941a;_0x176167=0xc8;}else{_0x176167=0xce;}_0x1a9aa6[_0x8af6('0x1f')](_0x176167);return _0x1a9aa6[_0x8af6('0x25')]('Content-Range',_0x1adcb2+'-'+_0x55db67+'/'+_0x28941a)[_0x8af6('0x26')](_0x232912);}return null;};}function patchUpdates(_0x1ccb79){return function(_0x5cd791){try{jsonpatch[_0x8af6('0x27')](_0x5cd791,_0x1ccb79,!![]);}catch(_0x3471f5){return BPromise[_0x8af6('0x28')](_0x3471f5);}return _0x5cd791[_0x8af6('0x29')]();};}function saveUpdates(_0x3968e4,_0x5475c4){return function(_0x46c5ca){if(_0x46c5ca){return _0x46c5ca[_0x8af6('0x2a')](_0x3968e4)[_0x8af6('0x2b')](function(_0x589f52){return _0x589f52;});}return null;};}function removeEntity(_0x572d47,_0x2286f5){return function(_0x32cad3){if(_0x32cad3){return _0x32cad3['destroy']()[_0x8af6('0x2b')](function(){var _0x591d72=_0x32cad3[_0x8af6('0x2c')]({'plain':!![]});var _0x229b27='CustomDashboards';return db[_0x8af6('0x2d')][_0x8af6('0x2e')]({'where':{'type':_0x229b27,'resourceId':_0x591d72['id']}})[_0x8af6('0x2b')](function(){return _0x32cad3;});})[_0x8af6('0x2b')](function(){_0x572d47[_0x8af6('0x1f')](0xcc)[_0x8af6('0x20')]();});}};}function handleEntityNotFound(_0x37378d,_0x554f58){return function(_0x523864){if(!_0x523864){_0x37378d[_0x8af6('0x1e')](0x194);}return _0x523864;};}function handleError(_0x8f3a8a,_0x1171b3){_0x1171b3=_0x1171b3||0x1f4;return function(_0x5b550d){logger[_0x8af6('0x2f')](_0x5b550d[_0x8af6('0x30')]);if(_0x5b550d[_0x8af6('0x31')]){delete _0x5b550d[_0x8af6('0x31')];}_0x8f3a8a[_0x8af6('0x1f')](_0x1171b3)[_0x8af6('0x32')](_0x5b550d);};}function getMustacheRender(_0x1de9f0,_0xe77400){return Mustache[_0x8af6('0x33')](_0x1de9f0,_[_0x8af6('0x34')](_0xe77400[_0x8af6('0x35')],{'contact':_0xe77400[_0x8af6('0x36')],'message':_0xe77400[_0x8af6('0x37')],'agent':_0xe77400[_0x8af6('0x38')],'interaction':_0xe77400[_0x8af6('0x39')],'account':_0xe77400[_0x8af6('0x3a')]}))||'';}exports['index']=function(_0x4b997c,_0x1baf92){var _0x536505={},_0x4f362f={},_0x37957f={'count':0x0,'rows':[]};var _0x49315f=_[_0x8af6('0x3b')](db[_0x8af6('0x3c')][_0x8af6('0x3d')],function(_0x88391c){return{'name':_0x88391c[_0x8af6('0x3e')],'type':_0x88391c['type']['key']};});_0x4f362f['model']=_['map'](_0x49315f,_0x8af6('0x31'));_0x4f362f[_0x8af6('0x3f')]=_[_0x8af6('0x40')](_0x4b997c['query']);_0x4f362f[_0x8af6('0x41')]=_[_0x8af6('0x42')](_0x4f362f[_0x8af6('0x43')],_0x4f362f[_0x8af6('0x3f')]);_0x536505['attributes']=_[_0x8af6('0x42')](_0x4f362f[_0x8af6('0x43')],qs['fields'](_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x44')]));_0x536505[_0x8af6('0x45')]=_0x536505['attributes'][_0x8af6('0x46')]?_0x536505['attributes']:_0x4f362f[_0x8af6('0x43')];if(!_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x47')](_0x8af6('0x48'))){_0x536505[_0x8af6('0x22')]=qs[_0x8af6('0x22')](_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x22')]);_0x536505['offset']=qs[_0x8af6('0x24')](_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x24')]);}_0x536505[_0x8af6('0x49')]=qs['sort'](_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x4a')]);_0x536505[_0x8af6('0x4b')]=qs[_0x8af6('0x41')](_['pick'](_0x4b997c[_0x8af6('0x3f')],_0x4f362f['filters']),_0x49315f);if(_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x4c')]){_0x536505[_0x8af6('0x4b')]=_[_0x8af6('0x34')](_0x536505['where'],{'$or':_[_0x8af6('0x3b')](_0x49315f,function(_0x573794){if(_0x573794[_0x8af6('0x4d')]!==_0x8af6('0x4e')){var _0x2ed3e3={};_0x2ed3e3[_0x573794[_0x8af6('0x31')]]={'$like':'%'+_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x4c')]+'%'};return _0x2ed3e3;}})});}_0x536505=_[_0x8af6('0x34')]({},_0x536505,_0x4b997c[_0x8af6('0x4f')]);var _0x4d62c2={'where':_0x536505[_0x8af6('0x4b')]};return db['Dashboard'][_0x8af6('0x23')](_0x4d62c2)[_0x8af6('0x2b')](function(_0x1659c4){_0x37957f[_0x8af6('0x23')]=_0x1659c4;if(_0x4b997c[_0x8af6('0x3f')][_0x8af6('0x50')]){_0x536505[_0x8af6('0x51')]=[{'all':!![]}];}return db[_0x8af6('0x3c')][_0x8af6('0x52')](_0x536505);})[_0x8af6('0x2b')](function(_0x267866){_0x37957f['rows']=_0x267866;return _0x37957f;})[_0x8af6('0x2b')](respondWithFilteredResult(_0x1baf92,_0x536505))[_0x8af6('0x53')](handleError(_0x1baf92,null));};exports['show']=function(_0x1edea6,_0x232037){var _0xa15ab1={'raw':![],'where':{'id':_0x1edea6['params']['id']}},_0xaa7cb3={};_0xaa7cb3[_0x8af6('0x43')]=_['keys'](db['Dashboard'][_0x8af6('0x3d')]);_0xaa7cb3[_0x8af6('0x3f')]=_[_0x8af6('0x40')](_0x1edea6[_0x8af6('0x3f')]);_0xaa7cb3[_0x8af6('0x41')]=_[_0x8af6('0x42')](_0xaa7cb3[_0x8af6('0x43')],_0xaa7cb3[_0x8af6('0x3f')]);_0xa15ab1[_0x8af6('0x45')]=_['intersection'](_0xaa7cb3[_0x8af6('0x43')],qs[_0x8af6('0x44')](_0x1edea6[_0x8af6('0x3f')][_0x8af6('0x44')]));_0xa15ab1[_0x8af6('0x45')]=_0xa15ab1[_0x8af6('0x45')]['length']?_0xa15ab1[_0x8af6('0x45')]:_0xaa7cb3[_0x8af6('0x43')];if(_0x1edea6[_0x8af6('0x3f')][_0x8af6('0x50')]){_0xa15ab1[_0x8af6('0x51')]=[{'all':!![]}];}_0xa15ab1=_[_0x8af6('0x34')]({},_0xa15ab1,_0x1edea6[_0x8af6('0x4f')]);return db['Dashboard']['find'](_0xa15ab1)[_0x8af6('0x2b')](handleEntityNotFound(_0x232037,null))[_0x8af6('0x2b')](respondWithResult(_0x232037,null))[_0x8af6('0x53')](handleError(_0x232037,null));};exports[_0x8af6('0x54')]=function(_0x2d4db5,_0x55f231){return db[_0x8af6('0x3c')][_0x8af6('0x54')](_0x2d4db5[_0x8af6('0x35')],{})[_0x8af6('0x2b')](function(_0xb082){var _0x15a9ba=_0x2d4db5[_0x8af6('0x55')]['get']({'plain':!![]});if(!_0x15a9ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15a9ba[_0x8af6('0x56')]==='user'){var _0x3ab5ff=_0xb082[_0x8af6('0x2c')]({'plain':!![]});var _0x290ef9='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x290ef9,'userProfileId':_0x15a9ba[_0x8af6('0x57')]},'raw':!![]})[_0x8af6('0x2b')](function(_0x44cd3d){if(_0x44cd3d&&_0x44cd3d[_0x8af6('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x3ab5ff['name'],'resourceId':_0x3ab5ff['id'],'type':_0x44cd3d['name'],'sectionId':_0x44cd3d['id']},{})['then'](function(){return _0xb082;});}else{return _0xb082;}})['catch'](function(_0x2847d5){logger[_0x8af6('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2847d5);throw _0x2847d5;});}return _0xb082;})[_0x8af6('0x2b')](respondWithResult(_0x55f231,0xc9))[_0x8af6('0x53')](handleError(_0x55f231,null));};exports[_0x8af6('0x59')]=function(_0xb53107,_0x266cf1){var _0x3f75f2={'where':{'id':_0xb53107[_0x8af6('0x5a')]['id']}},_0x419c05={};_0x419c05[_0x8af6('0x43')]=_[_0x8af6('0x40')](db[_0x8af6('0x3c')][_0x8af6('0x3d')]);_0x3f75f2['attributes']=_[_0x8af6('0x42')](_0x419c05[_0x8af6('0x43')],qs['fields'](_0xb53107[_0x8af6('0x3f')][_0x8af6('0x44')]));_0x3f75f2['attributes']=_0x3f75f2['attributes'][_0x8af6('0x46')]?_0x3f75f2[_0x8af6('0x45')]:_0x419c05[_0x8af6('0x43')];if(_0xb53107[_0x8af6('0x3f')][_0x8af6('0x50')]){_0x3f75f2[_0x8af6('0x51')]=[{'all':!![]}];}_0x3f75f2=_['merge']({},_0x3f75f2,_0xb53107[_0x8af6('0x4f')]);return db[_0x8af6('0x3c')][_0x8af6('0x5b')](_0x3f75f2)[_0x8af6('0x2b')](handleEntityNotFound(_0x266cf1,null))[_0x8af6('0x2b')](function(_0x2b63b1){if(_0x2b63b1){var _0x3256df=_0x2b63b1['get']({'plain':!![]});_0x3256df=qs[_0x8af6('0x5c')](_0x3256df,['id',_0x8af6('0x5d'),_0x8af6('0x5e')]);_0xb53107[_0x8af6('0x35')]=_[_0x8af6('0x5c')](_0xb53107[_0x8af6('0x35')],['id','createdAt','updatedAt']);return db[_0x8af6('0x3c')][_0x8af6('0x54')](_[_0x8af6('0x34')](_0x3256df,_0xb53107[_0x8af6('0x35')]),{'include':_0xb53107[_0x8af6('0x3f')][_0x8af6('0x50')]?[{'all':!![]}]:undefined})[_0x8af6('0x2b')](function(_0x129ac3){var _0x42e9fa=_0xb53107[_0x8af6('0x55')]['get']({'plain':!![]});if(!_0x42e9fa)throw new Error(_0x8af6('0x5f'));if(_0x42e9fa[_0x8af6('0x56')]===_0x8af6('0x55')){var _0x47ffaf=_0x129ac3[_0x8af6('0x2c')]({'plain':!![]});var _0xe3d0ec=_0x8af6('0x60');return db['UserProfileSection'][_0x8af6('0x5b')]({'where':{'name':_0xe3d0ec,'userProfileId':_0x42e9fa['userProfileId']},'raw':!![]})['then'](function(_0x4cb611){if(_0x4cb611&&_0x4cb611[_0x8af6('0x58')]===0x0){return db['UserProfileResource'][_0x8af6('0x54')]({'name':_0x47ffaf[_0x8af6('0x31')],'resourceId':_0x47ffaf['id'],'type':_0x4cb611[_0x8af6('0x31')],'sectionId':_0x4cb611['id']},{})[_0x8af6('0x2b')](function(){return _0x129ac3;});}else{return _0x129ac3;}})[_0x8af6('0x53')](function(_0x5a3efa){logger['error'](_0x8af6('0x61'),_0x5a3efa);throw _0x5a3efa;});}return _0x129ac3;});}})[_0x8af6('0x2b')](respondWithResult(_0x266cf1,0xc9))['catch'](handleError(_0x266cf1,null));};exports[_0x8af6('0x2a')]=function(_0x3ddc86,_0x3db62d){if(_0x3ddc86[_0x8af6('0x35')]['id']){delete _0x3ddc86['body']['id'];}return db['Dashboard'][_0x8af6('0x5b')]({'where':{'id':_0x3ddc86[_0x8af6('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3db62d,null))['then'](saveUpdates(_0x3ddc86[_0x8af6('0x35')],null))[_0x8af6('0x2b')](respondWithResult(_0x3db62d,null))[_0x8af6('0x53')](handleError(_0x3db62d,null));};exports[_0x8af6('0x2e')]=function(_0xbe550d,_0x214d13){return db[_0x8af6('0x3c')][_0x8af6('0x5b')]({'where':{'id':_0xbe550d[_0x8af6('0x5a')]['id']}})[_0x8af6('0x2b')](handleEntityNotFound(_0x214d13,null))[_0x8af6('0x2b')](removeEntity(_0x214d13,null))[_0x8af6('0x53')](handleError(_0x214d13,null));};function widgetAttributes(_0xf9d8b){try{switch(_0xf9d8b[_0x8af6('0x4d')]){case _0x8af6('0x62'):return[{'name':_0x8af6('0x63'),'value':_0xf9d8b[_0x8af6('0x63')]||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b['attrs'][0x0]?_0xf9d8b[_0x8af6('0x64')][0x0][_0x8af6('0x65')]:undefined)||_0x8af6('0x66')}];case _0x8af6('0x67'):return[{'name':_0x8af6('0x68'),'value':_0xf9d8b[_0x8af6('0x68')]||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x0]?_0xf9d8b[_0x8af6('0x64')][0x0][_0x8af6('0x65')]:undefined)||''}];case _0x8af6('0x69'):return[{'name':_0x8af6('0x6a'),'value':_0xf9d8b[_0x8af6('0x6a')]||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x0]?_0xf9d8b[_0x8af6('0x64')][0x0][_0x8af6('0x65')]:undefined)||'HH:mm:ss'},{'name':_0x8af6('0x6b'),'value':_0xf9d8b['attrTimezone']||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b['attrs'][0x1]?_0xf9d8b[_0x8af6('0x64')][0x1][_0x8af6('0x65')]:undefined)||_0x8af6('0x6c')},{'name':_0x8af6('0x6d'),'value':_0xf9d8b[_0x8af6('0x6d')]||(_0xf9d8b['attrs']&&_0xf9d8b['attrs'][0x2]?_0xf9d8b[_0x8af6('0x64')][0x2]['value']:undefined)||0xc}];case _0x8af6('0x6e'):return[{'name':_0x8af6('0x6f'),'value':_0xf9d8b[_0x8af6('0x6f')]||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x0]?_0xf9d8b['attrs'][0x0][_0x8af6('0x65')]:undefined)||_0x8af6('0x70')},{'name':_0x8af6('0x71'),'value':_0xf9d8b[_0x8af6('0x71')]||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b['attrs'][0x1]?_0xf9d8b[_0x8af6('0x64')][0x1]['value']:undefined)||[]},{'name':_0x8af6('0x6d'),'value':_0xf9d8b['attrFontSize']||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x2]?_0xf9d8b[_0x8af6('0x64')][0x2][_0x8af6('0x65')]:undefined)||0x14}];case'multibar-chart':case _0x8af6('0x72'):return[{'name':'attrSerie1','value':_0xf9d8b[_0x8af6('0x73')]||(_0xf9d8b['attrs']&&_0xf9d8b[_0x8af6('0x64')][0x0]?_0xf9d8b[_0x8af6('0x64')][0x0]['value']:undefined)||_0x8af6('0x70')},{'name':_0x8af6('0x74'),'value':_0xf9d8b[_0x8af6('0x74')]||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x1]?_0xf9d8b[_0x8af6('0x64')][0x1][_0x8af6('0x65')]:undefined)||null},{'name':_0x8af6('0x75'),'value':_0xf9d8b['attrSerie3']||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x2]?_0xf9d8b[_0x8af6('0x64')][0x2][_0x8af6('0x65')]:undefined)||null},{'name':_0x8af6('0x71'),'value':_0xf9d8b[_0x8af6('0x71')]||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x3]?_0xf9d8b['attrs'][0x3][_0x8af6('0x65')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0xf9d8b['reportType']||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b[_0x8af6('0x64')][0x0]?_0xf9d8b[_0x8af6('0x64')][0x0][_0x8af6('0x4d')]:undefined)||null,'value':_0xf9d8b['attrReport']||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b['attrs'][0x0]?_0xf9d8b[_0x8af6('0x64')][0x0][_0x8af6('0x65')]:undefined)||null},{'name':_0x8af6('0x76'),'value':_0xf9d8b['attrRefresh']||(_0xf9d8b[_0x8af6('0x64')]&&_0xf9d8b['attrs'][0x1]?_0xf9d8b[_0x8af6('0x64')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xc2f1cb){logger['error'](_0x8af6('0x77'),JSON[_0x8af6('0x78')](_0xc2f1cb));return[];}}exports[_0x8af6('0x79')]=function(_0x557aba,_0xfc52a5,_0x48731b){if(_0x557aba[_0x8af6('0x35')]['id']){delete _0x557aba[_0x8af6('0x35')]['id'];}return db['Dashboard'][_0x8af6('0x5b')]({'where':{'id':_0x557aba[_0x8af6('0x5a')]['id']}})[_0x8af6('0x2b')](handleEntityNotFound(_0xfc52a5,null))[_0x8af6('0x2b')](function(_0x41cb34){if(_0x41cb34){_0x557aba[_0x8af6('0x35')]['DashboardId']=_0x41cb34['id'];_0x557aba[_0x8af6('0x35')]['attrs']=widgetAttributes(_0x557aba[_0x8af6('0x35')]);return db[_0x8af6('0x7a')][_0x8af6('0x54')](_0x557aba[_0x8af6('0x35')]);}})[_0x8af6('0x2b')](respondWithResult(_0xfc52a5,null))[_0x8af6('0x53')](handleError(_0xfc52a5,null));};exports['getItems']=function(_0x1f59ed,_0x3973a5,_0x42488e){var _0x35f12e={};var _0x3263ba={};var _0x540e39;var _0x98c65;return db[_0x8af6('0x3c')][_0x8af6('0x7b')]({'where':{'id':_0x1f59ed['params']['id']}})[_0x8af6('0x2b')](handleEntityNotFound(_0x3973a5,null))['then'](function(_0x4d0ae1){if(_0x4d0ae1){_0x540e39=_0x4d0ae1;_0x3263ba[_0x8af6('0x43')]=_[_0x8af6('0x40')](db[_0x8af6('0x7a')]['rawAttributes']);_0x3263ba['query']=_[_0x8af6('0x40')](_0x1f59ed[_0x8af6('0x3f')]);_0x3263ba[_0x8af6('0x41')]=_[_0x8af6('0x42')](_0x3263ba[_0x8af6('0x43')],_0x3263ba[_0x8af6('0x3f')]);_0x35f12e['attributes']=_[_0x8af6('0x42')](_0x3263ba[_0x8af6('0x43')],qs[_0x8af6('0x44')](_0x1f59ed[_0x8af6('0x3f')][_0x8af6('0x44')]));_0x35f12e[_0x8af6('0x45')]=_0x35f12e[_0x8af6('0x45')]['length']?_0x35f12e[_0x8af6('0x45')]:_0x3263ba[_0x8af6('0x43')];_0x35f12e[_0x8af6('0x49')]=qs[_0x8af6('0x4a')](_0x1f59ed[_0x8af6('0x3f')][_0x8af6('0x4a')]);_0x35f12e[_0x8af6('0x4b')]=qs[_0x8af6('0x41')](_['pick'](_0x1f59ed[_0x8af6('0x3f')],_0x3263ba[_0x8af6('0x41')]));if(_0x1f59ed[_0x8af6('0x3f')][_0x8af6('0x4c')]){_0x35f12e[_0x8af6('0x4b')]=_[_0x8af6('0x34')](_0x35f12e[_0x8af6('0x4b')],{'$or':_['map'](_0x35f12e['attributes'],function(_0x473382){var _0x4271d4={};_0x4271d4[_0x473382]={'$like':'%'+_0x1f59ed['query']['filter']+'%'};return _0x4271d4;})});}_0x35f12e=_['merge']({},_0x35f12e,_0x1f59ed[_0x8af6('0x4f')]);return _0x540e39[_0x8af6('0x7c')](_0x35f12e);}})[_0x8af6('0x2b')](function(_0x5ce3eb){if(_0x5ce3eb){_0x98c65=_0x5ce3eb['length'];if(!_0x1f59ed[_0x8af6('0x3f')][_0x8af6('0x47')]('nolimit')){_0x35f12e[_0x8af6('0x22')]=qs[_0x8af6('0x22')](_0x1f59ed[_0x8af6('0x3f')]['limit']);_0x35f12e[_0x8af6('0x24')]=qs['offset'](_0x1f59ed[_0x8af6('0x3f')]['offset']);}return _0x540e39[_0x8af6('0x7c')](_0x35f12e);}})[_0x8af6('0x2b')](function(_0x4dfb88){if(_0x4dfb88){return _0x4dfb88?{'count':_0x98c65,'rows':_0x4dfb88}:null;}})['then'](respondWithResult(_0x3973a5,null))[_0x8af6('0x53')](handleError(_0x3973a5,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 49119be..0c0fa41 100644 --- a/server/api/dashboard/dashboard.events.js +++ b/server/api/dashboard/dashboard.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c21=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2f1dda,_0x15500c){var _0x2cba50=function(_0x5a4d84){while(--_0x5a4d84){_0x2f1dda['push'](_0x2f1dda['shift']());}};_0x2cba50(++_0x15500c);}(_0x9c21,0x10c));var _0x19c2=function(_0x6f52d7,_0x111b46){_0x6f52d7=_0x6f52d7-0x0;var _0x18b5f4=_0x9c21[_0x6f52d7];return _0x18b5f4;};'use strict';var EventEmitter=require(_0x19c2('0x0'));var Dashboard=require(_0x19c2('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x19c2('0x2')](0x0);var events={'afterCreate':_0x19c2('0x3'),'afterUpdate':_0x19c2('0x4'),'afterDestroy':_0x19c2('0x5')};function emitEvent(_0x2241c2){return function(_0x136a61,_0x6901e3,_0x2427e1){DashboardEvents[_0x19c2('0x6')](_0x2241c2+':'+_0x136a61['id'],_0x136a61);DashboardEvents[_0x19c2('0x6')](_0x2241c2,_0x136a61);_0x2427e1(null);};}for(var e in events){if(events[_0x19c2('0x7')](e)){var event=events[e];Dashboard[_0x19c2('0x8')](e,emitEvent(event));}}module[_0x19c2('0x9')]=DashboardEvents; \ No newline at end of file +var _0x45e7=['../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x45e7,0x12b));var _0x745e=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x45e7[_0x5c72ee];return _0x231876;};'use strict';var EventEmitter=require(_0x745e('0x0'));var Dashboard=require(_0x745e('0x1'))['db'][_0x745e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x745e('0x3')](0x0);var events={'afterCreate':_0x745e('0x4'),'afterUpdate':_0x745e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5dc903){return function(_0x5d8c54,_0x7a4664,_0x1e9098){DashboardEvents[_0x745e('0x6')](_0x5dc903+':'+_0x5d8c54['id'],_0x5d8c54);DashboardEvents[_0x745e('0x6')](_0x5dc903,_0x5d8c54);_0x1e9098(null);};}for(var e in events){if(events[_0x745e('0x7')](e)){var event=events[e];Dashboard[_0x745e('0x8')](e,emitEvent(event));}}module[_0x745e('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 28fc06d..75cecfa 100644 --- a/server/api/dashboard/dashboard.model.js +++ b/server/api/dashboard/dashboard.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8a3=['moment','bluebird','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd8a3,0x189));var _0x3d8a=function(_0x45ea51,_0x35bbc6){_0x45ea51=_0x45ea51-0x0;var _0x3afe93=_0xd8a3[_0x45ea51];return _0x3afe93;};'use strict';var _=require(_0x3d8a('0x0'));var util=require(_0x3d8a('0x1'));var logger=require('../../config/logger')(_0x3d8a('0x2'));var moment=require(_0x3d8a('0x3'));var BPromise=require(_0x3d8a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3d8a('0x5'));var attributes=require(_0x3d8a('0x6'));module[_0x3d8a('0x7')]=function(_0x5f3fe2,_0x14ffc3){return _0x5f3fe2[_0x3d8a('0x8')](_0x3d8a('0x9'),attributes,{'tableName':_0x3d8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaef9=['bluebird','request-promise','path','../../config/environment','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment'];(function(_0x372ee1,_0x45c637){var _0x31ea06=function(_0x3aba6a){while(--_0x3aba6a){_0x372ee1['push'](_0x372ee1['shift']());}};_0x31ea06(++_0x45c637);}(_0xaef9,0x80));var _0x9aef=function(_0x2f32ad,_0x41a394){_0x2f32ad=_0x2f32ad-0x0;var _0xe5e48c=_0xaef9[_0x2f32ad];return _0xe5e48c;};'use strict';var _=require('lodash');var util=require(_0x9aef('0x0'));var logger=require(_0x9aef('0x1'))(_0x9aef('0x2'));var moment=require(_0x9aef('0x3'));var BPromise=require(_0x9aef('0x4'));var rp=require(_0x9aef('0x5'));var fs=require('fs');var path=require(_0x9aef('0x6'));var rimraf=require('rimraf');var config=require(_0x9aef('0x7'));var attributes=require('./dashboard.attributes');module[_0x9aef('0x8')]=function(_0x38f1d3,_0x449f84){return _0x38f1d3[_0x9aef('0x9')](_0x9aef('0xa'),attributes,{'tableName':_0x9aef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 3a999e2..4a7d4be 100644 --- a/server/api/dashboard/dashboard.rpc.js +++ b/server/api/dashboard/dashboard.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x460a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','util','moment'];(function(_0x95e3ac,_0x4aa242){var _0xb1fad0=function(_0x5739de){while(--_0x5739de){_0x95e3ac['push'](_0x95e3ac['shift']());}};_0xb1fad0(++_0x4aa242);}(_0x460a,0x69));var _0xa460=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x460a[_0x581960];return _0x4ee892;};'use strict';var _=require(_0xa460('0x0'));var util=require(_0xa460('0x1'));var moment=require(_0xa460('0x2'));var BPromise=require(_0xa460('0x3'));var rs=require(_0xa460('0x4'));var fs=require('fs');var Redis=require(_0xa460('0x5'));var db=require(_0xa460('0x6'))['db'];var utils=require(_0xa460('0x7'));var logger=require(_0xa460('0x8'))(_0xa460('0x9'));var config=require(_0xa460('0xa'));var jayson=require(_0xa460('0xb'));var client=jayson[_0xa460('0xc')]['http']({'port':0x232a});config[_0xa460('0xd')]=_[_0xa460('0xe')](config[_0xa460('0xd')],{'host':_0xa460('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa460('0xd')]));require(_0xa460('0x10'))[_0xa460('0x11')](socket);function respondWithRpcPromise(_0x426df6,_0x2e7e44,_0x3b9768){return new BPromise(function(_0x4427ca,_0x5dbe69){return client['request'](_0x426df6,_0x3b9768)[_0xa460('0x12')](function(_0x3d5df0){logger['info'](_0xa460('0x13'),_0x2e7e44,'request\x20sent');logger[_0xa460('0x14')](_0xa460('0x15'),_0x2e7e44,_0xa460('0x16'),JSON['stringify'](_0x3d5df0));if(_0x3d5df0[_0xa460('0x17')]){if(_0x3d5df0['error']['code']===0x1f4){logger[_0xa460('0x17')](_0xa460('0x13'),_0x2e7e44,_0x3d5df0['error'][_0xa460('0x18')]);return _0x5dbe69(_0x3d5df0[_0xa460('0x17')][_0xa460('0x18')]);}logger[_0xa460('0x17')]('Dashboard,\x20%s,\x20%s',_0x2e7e44,_0x3d5df0[_0xa460('0x17')][_0xa460('0x18')]);return _0x4427ca(_0x3d5df0[_0xa460('0x17')][_0xa460('0x18')]);}else{logger[_0xa460('0x19')](_0xa460('0x13'),_0x2e7e44,_0xa460('0x16'));_0x4427ca(_0x3d5df0['result']['message']);}})[_0xa460('0x1a')](function(_0x4c3d95){logger[_0xa460('0x17')](_0xa460('0x13'),_0x2e7e44,_0x4c3d95);_0x5dbe69(_0x4c3d95);});});} \ No newline at end of file +var _0xe4e1=['../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x332923,_0x504b2f){var _0x8d39e9=function(_0x40aae9){while(--_0x40aae9){_0x332923['push'](_0x332923['shift']());}};_0x8d39e9(++_0x504b2f);}(_0xe4e1,0x126));var _0x1e4e=function(_0x1828a9,_0x3d1a2e){_0x1828a9=_0x1828a9-0x0;var _0x550b95=_0xe4e1[_0x1828a9];return _0x550b95;};'use strict';var _=require('lodash');var util=require(_0x1e4e('0x0'));var moment=require(_0x1e4e('0x1'));var BPromise=require(_0x1e4e('0x2'));var rs=require(_0x1e4e('0x3'));var fs=require('fs');var Redis=require(_0x1e4e('0x4'));var db=require(_0x1e4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1e4e('0x6'));var jayson=require(_0x1e4e('0x7'));var client=jayson[_0x1e4e('0x8')][_0x1e4e('0x9')]({'port':0x232a});config[_0x1e4e('0xa')]=_['defaults'](config[_0x1e4e('0xa')],{'host':_0x1e4e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e4e('0xa')]));require(_0x1e4e('0xc'))['register'](socket);function respondWithRpcPromise(_0x50214a,_0x1d3a8d,_0x22f349){return new BPromise(function(_0x272ec2,_0x287a2c){return client[_0x1e4e('0xd')](_0x50214a,_0x22f349)[_0x1e4e('0xe')](function(_0x19cb82){logger[_0x1e4e('0xf')](_0x1e4e('0x10'),_0x1d3a8d,_0x1e4e('0x11'));logger[_0x1e4e('0x12')](_0x1e4e('0x13'),_0x1d3a8d,'request\x20sent',JSON['stringify'](_0x19cb82));if(_0x19cb82[_0x1e4e('0x14')]){if(_0x19cb82['error']['code']===0x1f4){logger['error'](_0x1e4e('0x10'),_0x1d3a8d,_0x19cb82[_0x1e4e('0x14')][_0x1e4e('0x15')]);return _0x287a2c(_0x19cb82[_0x1e4e('0x14')]['message']);}logger['error'](_0x1e4e('0x10'),_0x1d3a8d,_0x19cb82[_0x1e4e('0x14')][_0x1e4e('0x15')]);return _0x272ec2(_0x19cb82['error'][_0x1e4e('0x15')]);}else{logger[_0x1e4e('0xf')](_0x1e4e('0x10'),_0x1d3a8d,_0x1e4e('0x11'));_0x272ec2(_0x19cb82['result'][_0x1e4e('0x15')]);}})[_0x1e4e('0x16')](function(_0x3fa88a){logger[_0x1e4e('0x14')](_0x1e4e('0x10'),_0x1d3a8d,_0x3fa88a);_0x287a2c(_0x3fa88a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 40f6a45..15ad3d8 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37ec=['dashboard:','./dashboard.events','save','update','removeListener','register'];(function(_0x12156e,_0x550b21){var _0x55ada7=function(_0x29e36c){while(--_0x29e36c){_0x12156e['push'](_0x12156e['shift']());}};_0x55ada7(++_0x550b21);}(_0x37ec,0x73));var _0xc37e=function(_0xf5ace8,_0x278384){_0xf5ace8=_0xf5ace8-0x0;var _0x1ca591=_0x37ec[_0xf5ace8];return _0x1ca591;};'use strict';var DashboardEvents=require(_0xc37e('0x0'));var events=[_0xc37e('0x1'),'remove',_0xc37e('0x2')];function createListener(_0x689f57,_0x33674c){return function(_0x11ed2a){_0x33674c['emit'](_0x689f57,_0x11ed2a);};}function removeListener(_0x1637e1,_0x1f0b91){return function(){DashboardEvents[_0xc37e('0x3')](_0x1637e1,_0x1f0b91);};}exports[_0xc37e('0x4')]=function(_0xdf1710){for(var _0x10d6dd=0x0,_0x2d24bb=events['length'];_0x10d6dd<_0x2d24bb;_0x10d6dd++){var _0x100a91=events[_0x10d6dd];var _0x59ba69=createListener(_0xc37e('0x5')+_0x100a91,_0xdf1710);DashboardEvents['on'](_0x100a91,_0x59ba69);}}; \ No newline at end of file +var _0x92fe=['./dashboard.events','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x1257e8,_0x42ce63){var _0x4d2777=function(_0xaccbc0){while(--_0xaccbc0){_0x1257e8['push'](_0x1257e8['shift']());}};_0x4d2777(++_0x42ce63);}(_0x92fe,0x1b8));var _0xe92f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92fe[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xe92f('0x0'));var events=['save',_0xe92f('0x1'),_0xe92f('0x2')];function createListener(_0x528d68,_0x4a339c){return function(_0x10f8c7){_0x4a339c[_0xe92f('0x3')](_0x528d68,_0x10f8c7);};}function removeListener(_0x555b41,_0x2228f3){return function(){DashboardEvents[_0xe92f('0x4')](_0x555b41,_0x2228f3);};}exports[_0xe92f('0x5')]=function(_0xe4b30e){for(var _0x157124=0x0,_0x517365=events[_0xe92f('0x6')];_0x157124<_0x517365;_0x157124++){var _0x1dc46e=events[_0x157124];var _0x2cba23=createListener(_0xe92f('0x7')+_0x1dc46e,_0xe4b30e);DashboardEvents['on'](_0x1dc46e,_0x2cba23);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 75a54c3..70af82b 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','clone','/:id/items','addItem','put','delete','destroy'];(function(_0x45f23c,_0x2781ac){var _0x2b364d=function(_0x48e11f){while(--_0x48e11f){_0x45f23c['push'](_0x45f23c['shift']());}};_0x2b364d(++_0x2781ac);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x4b84[_0x3747ae];return _0x339035;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x44b8('0x3'));var interaction=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var controller=require('./dashboard.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x44b8('0x6')]);router['get'](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router['get']('/:id/items',auth[_0x44b8('0x9')](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth['isAuthenticated'](),controller[_0x44b8('0xc')]);router[_0x44b8('0xb')](_0x44b8('0xd'),auth[_0x44b8('0x9')](),controller[_0x44b8('0xe')]);router[_0x44b8('0xb')](_0x44b8('0xf'),auth['isAuthenticated'](),controller[_0x44b8('0x10')]);router[_0x44b8('0x11')]('/:id',auth[_0x44b8('0x9')](),controller['update']);router[_0x44b8('0x12')](_0x44b8('0x7'),auth['isAuthenticated'](),controller[_0x44b8('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb903=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','isAuthenticated','show','/:id/items','/:id/clone','post','addItem','put','/:id','delete','destroy','exports','multer','util'];(function(_0x44ffcf,_0x1d8f90){var _0x1d00fc=function(_0x16e7de){while(--_0x16e7de){_0x44ffcf['push'](_0x44ffcf['shift']());}};_0x1d00fc(++_0x1d8f90);}(_0xb903,0x185));var _0x3b90=function(_0x23d9a1,_0x283dca){_0x23d9a1=_0x23d9a1-0x0;var _0x29b9bc=_0xb903[_0x23d9a1];return _0x29b9bc;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/:id',auth[_0x3b90('0xc')](),controller[_0x3b90('0xd')]);router[_0x3b90('0xa')](_0x3b90('0xe'),auth['isAuthenticated'](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3b90('0xf'),auth[_0x3b90('0xc')](),controller['clone']);router[_0x3b90('0x10')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0x11')]);router[_0x3b90('0x12')](_0x3b90('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x3b90('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3b90('0x15')]);module[_0x3b90('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b630d6e..3b4b200 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dca=['getDataValue','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','STRING','long','parse'];(function(_0x208fba,_0x393244){var _0x317733=function(_0x49ea85){while(--_0x49ea85){_0x208fba['push'](_0x208fba['shift']());}};_0x317733(++_0x393244);}(_0x1dca,0x186));var _0xa1dc=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x1dca[_0xe15270];return _0x1e813b;};'use strict';var Sequelize=require(_0xa1dc('0x0'));var squel=require(_0xa1dc('0x1'));var _=require(_0xa1dc('0x2'));module['exports']={'title':{'type':Sequelize[_0xa1dc('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xa1dc('0x4')),'get':function(){try{return JSON[_0xa1dc('0x5')](this[_0xa1dc('0x6')](_0xa1dc('0x7')));}catch(_0x275d63){return[];}},'set':function(_0x2f2bd8){try{this['setDataValue'](_0xa1dc('0x7'),JSON[_0xa1dc('0x8')](_0x2f2bd8));}catch(_0x1b2938){this[_0xa1dc('0x9')](_0xa1dc('0x7'),JSON[_0xa1dc('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xa1dc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa1dc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xa1dc('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa1dc('0x3')],'allowNull':![],'defaultValue':_0xa1dc('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa1dc('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x15fa=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','attrs','setDataValue','stringify','INTEGER'];(function(_0x5ded5e,_0x57f27f){var _0xb5e5fb=function(_0x5a8269){while(--_0x5a8269){_0x5ded5e['push'](_0x5ded5e['shift']());}};_0xb5e5fb(++_0x57f27f);}(_0x15fa,0xab));var _0xa15f=function(_0x6255f,_0x11e39f){_0x6255f=_0x6255f-0x0;var _0x213d1b=_0x15fa[_0x6255f];return _0x213d1b;};'use strict';var Sequelize=require(_0xa15f('0x0'));var squel=require(_0xa15f('0x1'));var _=require(_0xa15f('0x2'));module[_0xa15f('0x3')]={'title':{'type':Sequelize[_0xa15f('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xa15f('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa15f('0x5')](_0xa15f('0x6')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0xa15f('0x7')));}catch(_0xe67db7){return[];}},'set':function(_0x4b5634){try{this[_0xa15f('0x8')](_0xa15f('0x7'),JSON[_0xa15f('0x9')](_0x4b5634));}catch(_0x1e6b26){this[_0xa15f('0x8')](_0xa15f('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xa15f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa15f('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xa15f('0xa')]},'col':{'type':Sequelize[_0xa15f('0xa')]},'background':{'type':Sequelize[_0xa15f('0x4')],'allowNull':![],'defaultValue':_0xa15f('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa15f('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa15f('0x4')]},'titleFontSize':{'type':Sequelize[_0xa15f('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 6263211..41202e4 100644 --- a/server/api/dashboardItem/dashboardItem.controller.js +++ b/server/api/dashboardItem/dashboardItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd18=['agent','interaction','account','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','length','includeAll','include','merge','options','catch','find','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','name','contact','message'];(function(_0x424b40,_0x14217b){var _0x435866=function(_0x8a1283){while(--_0x8a1283){_0x424b40['push'](_0x424b40['shift']());}};_0x435866(++_0x14217b);}(_0xcd18,0x13c));var _0x8cd1=function(_0x8c7710,_0x7e2cba){_0x8c7710=_0x8c7710-0x0;var _0x3280a2=_0xcd18[_0x8c7710];return _0x3280a2;};'use strict';var emlformat=require(_0x8cd1('0x0'));var rimraf=require(_0x8cd1('0x1'));var zipdir=require(_0x8cd1('0x2'));var jsonpatch=require(_0x8cd1('0x3'));var rp=require(_0x8cd1('0x4'));var moment=require(_0x8cd1('0x5'));var BPromise=require(_0x8cd1('0x6'));var Mustache=require(_0x8cd1('0x7'));var util=require('util');var path=require(_0x8cd1('0x8'));var sox=require(_0x8cd1('0x9'));var csv=require(_0x8cd1('0xa'));var ejs=require(_0x8cd1('0xb'));var fs=require('fs');var fs_extra=require(_0x8cd1('0xc'));var _=require(_0x8cd1('0xd'));var squel=require(_0x8cd1('0xe'));var crypto=require(_0x8cd1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cd1('0xa'));var querystring=require(_0x8cd1('0x10'));var Papa=require(_0x8cd1('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8cd1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cd1('0x13'));var logger=require('../../config/logger')(_0x8cd1('0x14'));var utils=require('../../config/utils');var config=require(_0x8cd1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cd1('0x16'))['db'];config[_0x8cd1('0x17')]=_[_0x8cd1('0x18')](config[_0x8cd1('0x17')],{'host':_0x8cd1('0x19'),'port':0x18eb});var socket=require(_0x8cd1('0x1a'))(new Redis(config['redis']));require(_0x8cd1('0x1b'))['register'](socket);function respondWithStatusCode(_0x368c46,_0x3869f3){_0x3869f3=_0x3869f3||0xcc;return function(_0x1a51a6){if(_0x1a51a6){return _0x368c46['sendStatus'](_0x3869f3);}return _0x368c46[_0x8cd1('0x1c')](_0x3869f3)[_0x8cd1('0x1d')]();};}function respondWithResult(_0x2f341d,_0x43704f){_0x43704f=_0x43704f||0xc8;return function(_0x26434d){if(_0x26434d){return _0x2f341d[_0x8cd1('0x1c')](_0x43704f)[_0x8cd1('0x1e')](_0x26434d);}};}function respondWithFilteredResult(_0x3fe7ac,_0x3a1871){return function(_0x1d3cd5){if(_0x1d3cd5){var _0x143c5c=typeof _0x3a1871[_0x8cd1('0x1f')]===_0x8cd1('0x20')&&typeof _0x3a1871[_0x8cd1('0x21')]===_0x8cd1('0x20');var _0x2e9cb7=_0x1d3cd5['count'];var _0x489f19=_0x143c5c?0x0:_0x3a1871[_0x8cd1('0x1f')];var _0x2e840a=_0x143c5c?_0x1d3cd5[_0x8cd1('0x22')]:_0x3a1871[_0x8cd1('0x1f')]+_0x3a1871[_0x8cd1('0x21')];var _0x457d2f;if(_0x2e840a>=_0x2e9cb7){_0x2e840a=_0x2e9cb7;_0x457d2f=0xc8;}else{_0x457d2f=0xce;}_0x3fe7ac[_0x8cd1('0x1c')](_0x457d2f);return _0x3fe7ac[_0x8cd1('0x23')](_0x8cd1('0x24'),_0x489f19+'-'+_0x2e840a+'/'+_0x2e9cb7)['json'](_0x1d3cd5);}return null;};}function patchUpdates(_0x1ab684){return function(_0x5d8f9c){try{jsonpatch['apply'](_0x5d8f9c,_0x1ab684,!![]);}catch(_0xdfcf7a){return BPromise['reject'](_0xdfcf7a);}return _0x5d8f9c[_0x8cd1('0x25')]();};}function saveUpdates(_0x221fdf,_0x2bcdff){return function(_0x2950ec){if(_0x2950ec){return _0x2950ec['update'](_0x221fdf)[_0x8cd1('0x26')](function(_0x3e96c7){return _0x3e96c7;});}return null;};}function removeEntity(_0x5d68c4,_0x2115d5){return function(_0x56e5c3){if(_0x56e5c3){return _0x56e5c3[_0x8cd1('0x27')]()[_0x8cd1('0x26')](function(){_0x5d68c4[_0x8cd1('0x1c')](0xcc)[_0x8cd1('0x1d')]();});}};}function handleEntityNotFound(_0x384dbf,_0x20c05b){return function(_0x67a753){if(!_0x67a753){_0x384dbf['sendStatus'](0x194);}return _0x67a753;};}function handleError(_0x5ed211,_0x4bfdac){_0x4bfdac=_0x4bfdac||0x1f4;return function(_0x5bb385){logger[_0x8cd1('0x28')](_0x5bb385['stack']);if(_0x5bb385[_0x8cd1('0x29')]){delete _0x5bb385[_0x8cd1('0x29')];}_0x5ed211[_0x8cd1('0x1c')](_0x4bfdac)['send'](_0x5bb385);};}function getMustacheRender(_0x2208da,_0x23464f){return Mustache['render'](_0x2208da,_['merge'](_0x23464f['body'],{'contact':_0x23464f[_0x8cd1('0x2a')],'message':_0x23464f[_0x8cd1('0x2b')],'agent':_0x23464f[_0x8cd1('0x2c')],'interaction':_0x23464f[_0x8cd1('0x2d')],'account':_0x23464f[_0x8cd1('0x2e')]}))||'';}exports[_0x8cd1('0x2f')]=function(_0x24e4f6,_0x111574){var _0x22ab48={'raw':![],'where':{'id':_0x24e4f6[_0x8cd1('0x30')]['id']}},_0x234e57={};_0x234e57[_0x8cd1('0x31')]=_[_0x8cd1('0x32')](db[_0x8cd1('0x33')][_0x8cd1('0x34')]);_0x234e57['query']=_['keys'](_0x24e4f6[_0x8cd1('0x35')]);_0x234e57[_0x8cd1('0x36')]=_['intersection'](_0x234e57[_0x8cd1('0x31')],_0x234e57[_0x8cd1('0x35')]);_0x22ab48[_0x8cd1('0x37')]=_[_0x8cd1('0x38')](_0x234e57['model'],qs['fields'](_0x24e4f6[_0x8cd1('0x35')]['fields']));_0x22ab48['attributes']=_0x22ab48[_0x8cd1('0x37')][_0x8cd1('0x39')]?_0x22ab48[_0x8cd1('0x37')]:_0x234e57[_0x8cd1('0x31')];if(_0x24e4f6[_0x8cd1('0x35')][_0x8cd1('0x3a')]){_0x22ab48[_0x8cd1('0x3b')]=[{'all':!![]}];}_0x22ab48=_[_0x8cd1('0x3c')]({},_0x22ab48,_0x24e4f6[_0x8cd1('0x3d')]);return db['DashboardItem']['find'](_0x22ab48)['then'](handleEntityNotFound(_0x111574,null))[_0x8cd1('0x26')](respondWithResult(_0x111574,null))[_0x8cd1('0x3e')](handleError(_0x111574,null));};exports['destroy']=function(_0x5aff0c,_0x160818){return db[_0x8cd1('0x33')][_0x8cd1('0x3f')]({'where':{'id':_0x5aff0c[_0x8cd1('0x30')]['id']}})[_0x8cd1('0x26')](handleEntityNotFound(_0x160818,null))['then'](removeEntity(_0x160818,null))[_0x8cd1('0x3e')](handleError(_0x160818,null));};function widgetAttributes(_0x5f1157){try{switch(_0x5f1157[_0x8cd1('0x40')]){case'iframe':return[{'name':'attrUrl','value':_0x5f1157[_0x8cd1('0x41')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157['attrs'][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||'https://'}];case _0x8cd1('0x44'):return[{'name':_0x8cd1('0x45'),'value':_0x5f1157['attrPath']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157['attrs'][0x0][_0x8cd1('0x43')]:undefined)||''}];case _0x8cd1('0x46'):return[{'name':_0x8cd1('0x47'),'value':_0x5f1157['attrHourFormat']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157['attrs'][0x0][_0x8cd1('0x43')]:undefined)||'HH:mm:ss'},{'name':_0x8cd1('0x48'),'value':_0x5f1157['attrTimezone']||(_0x5f1157['attrs']&&_0x5f1157[_0x8cd1('0x42')][0x1]?_0x5f1157['attrs'][0x1][_0x8cd1('0x43')]:undefined)||'0.00'},{'name':_0x8cd1('0x49'),'value':_0x5f1157['attrFontSize']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157['attrs'][0x2]?_0x5f1157[_0x8cd1('0x42')][0x2][_0x8cd1('0x43')]:undefined)||0xc}];case _0x8cd1('0x4a'):return[{'name':_0x8cd1('0x4b'),'value':_0x5f1157[_0x8cd1('0x4b')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||'total'},{'name':_0x8cd1('0x4c'),'value':_0x5f1157[_0x8cd1('0x4c')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157['attrs'][0x1]?_0x5f1157[_0x8cd1('0x42')][0x1][_0x8cd1('0x43')]:undefined)||[]},{'name':_0x8cd1('0x49'),'value':_0x5f1157[_0x8cd1('0x49')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x2]?_0x5f1157[_0x8cd1('0x42')][0x2][_0x8cd1('0x43')]:undefined)||0x14}];case _0x8cd1('0x4d'):case _0x8cd1('0x4e'):return[{'name':_0x8cd1('0x4f'),'value':_0x5f1157['attrSerie1']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||_0x8cd1('0x50')},{'name':'attrSerie2','value':_0x5f1157[_0x8cd1('0x51')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x1]?_0x5f1157['attrs'][0x1]['value']:undefined)||null},{'name':_0x8cd1('0x52'),'value':_0x5f1157[_0x8cd1('0x52')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x2]?_0x5f1157[_0x8cd1('0x42')][0x2][_0x8cd1('0x43')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5f1157['attrVoiceQueues']||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x3]?_0x5f1157[_0x8cd1('0x42')][0x3][_0x8cd1('0x43')]:undefined)||[]}];case _0x8cd1('0x53'):return[{'name':_0x8cd1('0x54'),'type':_0x5f1157[_0x8cd1('0x55')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0]['type']:undefined)||null,'value':_0x5f1157[_0x8cd1('0x54')]||(_0x5f1157[_0x8cd1('0x42')]&&_0x5f1157[_0x8cd1('0x42')][0x0]?_0x5f1157[_0x8cd1('0x42')][0x0][_0x8cd1('0x43')]:undefined)||null},{'name':_0x8cd1('0x56'),'value':_0x5f1157[_0x8cd1('0x56')]||(_0x5f1157['attrs']&&_0x5f1157['attrs'][0x1]?_0x5f1157[_0x8cd1('0x42')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4b2db4){logger[_0x8cd1('0x28')]('widgetAttributes:\x20%s',JSON['stringify'](_0x4b2db4));return[];}}exports['create']=function(_0x485ef3,_0x20538e){if(_0x485ef3[_0x8cd1('0x57')]){_0x485ef3[_0x8cd1('0x57')]['attrs']=widgetAttributes(_0x485ef3[_0x8cd1('0x57')]);}return db[_0x8cd1('0x33')][_0x8cd1('0x58')](_0x485ef3[_0x8cd1('0x57')],{})['then'](respondWithResult(_0x20538e,0xc9))[_0x8cd1('0x3e')](handleError(_0x20538e,null));};exports[_0x8cd1('0x59')]=function(_0x20102d,_0x52462b){if(_0x20102d[_0x8cd1('0x57')]['id']){delete _0x20102d[_0x8cd1('0x57')]['id'];}_0x20102d[_0x8cd1('0x57')]['attrs']=widgetAttributes(_0x20102d[_0x8cd1('0x57')]);return db[_0x8cd1('0x33')][_0x8cd1('0x3f')]({'where':{'id':_0x20102d[_0x8cd1('0x30')]['id']}})[_0x8cd1('0x26')](handleEntityNotFound(_0x52462b,null))[_0x8cd1('0x26')](saveUpdates(_0x20102d[_0x8cd1('0x57')],null))['then'](respondWithResult(_0x52462b,null))[_0x8cd1('0x3e')](handleError(_0x52462b,null));}; \ No newline at end of file +var _0x69cd=['body','contact','message','interaction','account','params','keys','DashboardItem','query','filters','intersection','model','fields','attributes','length','includeAll','include','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','render','merge'];(function(_0x506d2b,_0x51eba7){var _0x1198da=function(_0xa1c688){while(--_0xa1c688){_0x506d2b['push'](_0x506d2b['shift']());}};_0x1198da(++_0x51eba7);}(_0x69cd,0x13d));var _0xd69c=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x69cd[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd69c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd69c('0x1'));var moment=require('moment');var BPromise=require(_0xd69c('0x2'));var Mustache=require(_0xd69c('0x3'));var util=require(_0xd69c('0x4'));var path=require(_0xd69c('0x5'));var sox=require(_0xd69c('0x6'));var csv=require(_0xd69c('0x7'));var ejs=require(_0xd69c('0x8'));var fs=require('fs');var fs_extra=require(_0xd69c('0x9'));var _=require(_0xd69c('0xa'));var squel=require('squel');var crypto=require(_0xd69c('0xb'));var jsforce=require(_0xd69c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd69c('0x7'));var querystring=require('querystring');var Papa=require(_0xd69c('0xd'));var Redis=require(_0xd69c('0xe'));var authService=require(_0xd69c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd69c('0x10'));var logger=require(_0xd69c('0x11'))(_0xd69c('0x12'));var utils=require(_0xd69c('0x13'));var config=require(_0xd69c('0x14'));var licenseUtil=require(_0xd69c('0x15'));var db=require(_0xd69c('0x16'))['db'];config[_0xd69c('0x17')]=_['defaults'](config[_0xd69c('0x17')],{'host':_0xd69c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd69c('0x19'))[_0xd69c('0x1a')](socket);function respondWithStatusCode(_0x3bf435,_0x53e25e){_0x53e25e=_0x53e25e||0xcc;return function(_0x45a153){if(_0x45a153){return _0x3bf435[_0xd69c('0x1b')](_0x53e25e);}return _0x3bf435[_0xd69c('0x1c')](_0x53e25e)[_0xd69c('0x1d')]();};}function respondWithResult(_0x12c2cf,_0x41dddc){_0x41dddc=_0x41dddc||0xc8;return function(_0x37a942){if(_0x37a942){return _0x12c2cf[_0xd69c('0x1c')](_0x41dddc)[_0xd69c('0x1e')](_0x37a942);}};}function respondWithFilteredResult(_0x246f93,_0x46b7c3){return function(_0x53c789){if(_0x53c789){var _0x371666=typeof _0x46b7c3[_0xd69c('0x1f')]===_0xd69c('0x20')&&typeof _0x46b7c3[_0xd69c('0x21')]===_0xd69c('0x20');var _0x31b209=_0x53c789['count'];var _0x42e9dd=_0x371666?0x0:_0x46b7c3[_0xd69c('0x1f')];var _0x4e43b2=_0x371666?_0x53c789['count']:_0x46b7c3[_0xd69c('0x1f')]+_0x46b7c3[_0xd69c('0x21')];var _0x5c4772;if(_0x4e43b2>=_0x31b209){_0x4e43b2=_0x31b209;_0x5c4772=0xc8;}else{_0x5c4772=0xce;}_0x246f93['status'](_0x5c4772);return _0x246f93[_0xd69c('0x22')](_0xd69c('0x23'),_0x42e9dd+'-'+_0x4e43b2+'/'+_0x31b209)[_0xd69c('0x1e')](_0x53c789);}return null;};}function patchUpdates(_0x276f7b){return function(_0x3a4878){try{jsonpatch[_0xd69c('0x24')](_0x3a4878,_0x276f7b,!![]);}catch(_0x4da304){return BPromise['reject'](_0x4da304);}return _0x3a4878[_0xd69c('0x25')]();};}function saveUpdates(_0x3293ff,_0x2145be){return function(_0x59cbdb){if(_0x59cbdb){return _0x59cbdb[_0xd69c('0x26')](_0x3293ff)[_0xd69c('0x27')](function(_0x478009){return _0x478009;});}return null;};}function removeEntity(_0x5be754,_0xc1f6bc){return function(_0x2bdc3a){if(_0x2bdc3a){return _0x2bdc3a[_0xd69c('0x28')]()[_0xd69c('0x27')](function(){_0x5be754[_0xd69c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a06e,_0x5851e9){return function(_0x304f3a){if(!_0x304f3a){_0x16a06e[_0xd69c('0x1b')](0x194);}return _0x304f3a;};}function handleError(_0x448c66,_0x47806d){_0x47806d=_0x47806d||0x1f4;return function(_0x20d3f1){logger[_0xd69c('0x29')](_0x20d3f1[_0xd69c('0x2a')]);if(_0x20d3f1[_0xd69c('0x2b')]){delete _0x20d3f1['name'];}_0x448c66[_0xd69c('0x1c')](_0x47806d)[_0xd69c('0x2c')](_0x20d3f1);};}function getMustacheRender(_0x216c28,_0x2b04a5){return Mustache[_0xd69c('0x2d')](_0x216c28,_[_0xd69c('0x2e')](_0x2b04a5[_0xd69c('0x2f')],{'contact':_0x2b04a5[_0xd69c('0x30')],'message':_0x2b04a5[_0xd69c('0x31')],'agent':_0x2b04a5['agent'],'interaction':_0x2b04a5[_0xd69c('0x32')],'account':_0x2b04a5[_0xd69c('0x33')]}))||'';}exports['show']=function(_0x343099,_0x692383){var _0x293da1={'raw':![],'where':{'id':_0x343099[_0xd69c('0x34')]['id']}},_0x18ab20={};_0x18ab20['model']=_[_0xd69c('0x35')](db[_0xd69c('0x36')]['rawAttributes']);_0x18ab20[_0xd69c('0x37')]=_[_0xd69c('0x35')](_0x343099[_0xd69c('0x37')]);_0x18ab20[_0xd69c('0x38')]=_[_0xd69c('0x39')](_0x18ab20[_0xd69c('0x3a')],_0x18ab20['query']);_0x293da1['attributes']=_[_0xd69c('0x39')](_0x18ab20['model'],qs[_0xd69c('0x3b')](_0x343099['query'][_0xd69c('0x3b')]));_0x293da1[_0xd69c('0x3c')]=_0x293da1[_0xd69c('0x3c')][_0xd69c('0x3d')]?_0x293da1['attributes']:_0x18ab20['model'];if(_0x343099[_0xd69c('0x37')][_0xd69c('0x3e')]){_0x293da1[_0xd69c('0x3f')]=[{'all':!![]}];}_0x293da1=_['merge']({},_0x293da1,_0x343099['options']);return db['DashboardItem'][_0xd69c('0x40')](_0x293da1)[_0xd69c('0x27')](handleEntityNotFound(_0x692383,null))[_0xd69c('0x27')](respondWithResult(_0x692383,null))[_0xd69c('0x41')](handleError(_0x692383,null));};exports[_0xd69c('0x28')]=function(_0xd9c5bc,_0x5e67cd){return db[_0xd69c('0x36')]['find']({'where':{'id':_0xd9c5bc[_0xd69c('0x34')]['id']}})['then'](handleEntityNotFound(_0x5e67cd,null))[_0xd69c('0x27')](removeEntity(_0x5e67cd,null))[_0xd69c('0x41')](handleError(_0x5e67cd,null));};function widgetAttributes(_0x101713){try{switch(_0x101713[_0xd69c('0x42')]){case _0xd69c('0x43'):return[{'name':_0xd69c('0x44'),'value':_0x101713[_0xd69c('0x44')]||(_0x101713[_0xd69c('0x45')]&&_0x101713[_0xd69c('0x45')][0x0]?_0x101713[_0xd69c('0x45')][0x0]['value']:undefined)||_0xd69c('0x46')}];case _0xd69c('0x47'):return[{'name':'attrPath','value':_0x101713[_0xd69c('0x48')]||(_0x101713['attrs']&&_0x101713['attrs'][0x0]?_0x101713[_0xd69c('0x45')][0x0][_0xd69c('0x49')]:undefined)||''}];case _0xd69c('0x4a'):return[{'name':'attrHourFormat','value':_0x101713[_0xd69c('0x4b')]||(_0x101713[_0xd69c('0x45')]&&_0x101713[_0xd69c('0x45')][0x0]?_0x101713['attrs'][0x0][_0xd69c('0x49')]:undefined)||'HH:mm:ss'},{'name':_0xd69c('0x4c'),'value':_0x101713[_0xd69c('0x4c')]||(_0x101713[_0xd69c('0x45')]&&_0x101713['attrs'][0x1]?_0x101713[_0xd69c('0x45')][0x1][_0xd69c('0x49')]:undefined)||'0.00'},{'name':_0xd69c('0x4d'),'value':_0x101713['attrFontSize']||(_0x101713[_0xd69c('0x45')]&&_0x101713['attrs'][0x2]?_0x101713[_0xd69c('0x45')][0x2][_0xd69c('0x49')]:undefined)||0xc}];case'counter':return[{'name':_0xd69c('0x4e'),'value':_0x101713[_0xd69c('0x4e')]||(_0x101713[_0xd69c('0x45')]&&_0x101713[_0xd69c('0x45')][0x0]?_0x101713[_0xd69c('0x45')][0x0]['value']:undefined)||_0xd69c('0x4f')},{'name':'attrVoiceQueues','value':_0x101713[_0xd69c('0x50')]||(_0x101713[_0xd69c('0x45')]&&_0x101713[_0xd69c('0x45')][0x1]?_0x101713[_0xd69c('0x45')][0x1][_0xd69c('0x49')]:undefined)||[]},{'name':_0xd69c('0x4d'),'value':_0x101713[_0xd69c('0x4d')]||(_0x101713[_0xd69c('0x45')]&&_0x101713['attrs'][0x2]?_0x101713[_0xd69c('0x45')][0x2]['value']:undefined)||0x14}];case _0xd69c('0x51'):case'pie-chart':return[{'name':_0xd69c('0x52'),'value':_0x101713[_0xd69c('0x52')]||(_0x101713['attrs']&&_0x101713['attrs'][0x0]?_0x101713['attrs'][0x0]['value']:undefined)||'total'},{'name':_0xd69c('0x53'),'value':_0x101713[_0xd69c('0x53')]||(_0x101713[_0xd69c('0x45')]&&_0x101713['attrs'][0x1]?_0x101713[_0xd69c('0x45')][0x1][_0xd69c('0x49')]:undefined)||null},{'name':_0xd69c('0x54'),'value':_0x101713['attrSerie3']||(_0x101713[_0xd69c('0x45')]&&_0x101713['attrs'][0x2]?_0x101713[_0xd69c('0x45')][0x2][_0xd69c('0x49')]:undefined)||null},{'name':_0xd69c('0x50'),'value':_0x101713['attrVoiceQueues']||(_0x101713[_0xd69c('0x45')]&&_0x101713[_0xd69c('0x45')][0x3]?_0x101713['attrs'][0x3][_0xd69c('0x49')]:undefined)||[]}];case _0xd69c('0x55'):return[{'name':_0xd69c('0x56'),'type':_0x101713['reportType']||(_0x101713['attrs']&&_0x101713[_0xd69c('0x45')][0x0]?_0x101713[_0xd69c('0x45')][0x0]['type']:undefined)||null,'value':_0x101713[_0xd69c('0x56')]||(_0x101713[_0xd69c('0x45')]&&_0x101713[_0xd69c('0x45')][0x0]?_0x101713[_0xd69c('0x45')][0x0]['value']:undefined)||null},{'name':_0xd69c('0x57'),'value':_0x101713[_0xd69c('0x57')]||(_0x101713['attrs']&&_0x101713['attrs'][0x1]?_0x101713[_0xd69c('0x45')][0x1][_0xd69c('0x49')]:undefined)||0x0}];default:return[];}}catch(_0x358059){logger['error'](_0xd69c('0x58'),JSON[_0xd69c('0x59')](_0x358059));return[];}}exports['create']=function(_0x5256dd,_0x464c7a){if(_0x5256dd['body']){_0x5256dd[_0xd69c('0x2f')]['attrs']=widgetAttributes(_0x5256dd['body']);}return db['DashboardItem'][_0xd69c('0x5a')](_0x5256dd[_0xd69c('0x2f')],{})[_0xd69c('0x27')](respondWithResult(_0x464c7a,0xc9))[_0xd69c('0x41')](handleError(_0x464c7a,null));};exports[_0xd69c('0x26')]=function(_0x500edc,_0x1f4bca){if(_0x500edc[_0xd69c('0x2f')]['id']){delete _0x500edc[_0xd69c('0x2f')]['id'];}_0x500edc['body'][_0xd69c('0x45')]=widgetAttributes(_0x500edc[_0xd69c('0x2f')]);return db[_0xd69c('0x36')][_0xd69c('0x40')]({'where':{'id':_0x500edc['params']['id']}})['then'](handleEntityNotFound(_0x1f4bca,null))['then'](saveUpdates(_0x500edc['body'],null))[_0xd69c('0x27')](respondWithResult(_0x1f4bca,null))['catch'](handleError(_0x1f4bca,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index b9ea01e..1762c8b 100644 --- a/server/api/dashboardItem/dashboardItem.events.js +++ b/server/api/dashboardItem/dashboardItem.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c6e=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4a7767,_0x15666c){var _0x58c6fd=function(_0x2c4425){while(--_0x2c4425){_0x4a7767['push'](_0x4a7767['shift']());}};_0x58c6fd(++_0x15666c);}(_0x6c6e,0x1ef));var _0xe6c6=function(_0x5e4741,_0x3e70fc){_0x5e4741=_0x5e4741-0x0;var _0x165638=_0x6c6e[_0x5e4741];return _0x165638;};'use strict';var EventEmitter=require(_0xe6c6('0x0'));var DashboardItem=require(_0xe6c6('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe6c6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe6c6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b3ccc){return function(_0x498e74,_0x3a438d,_0x1a8e4c){DashboardItemEvents[_0xe6c6('0x4')](_0x4b3ccc+':'+_0x498e74['id'],_0x498e74);DashboardItemEvents['emit'](_0x4b3ccc,_0x498e74);_0x1a8e4c(null);};}for(var e in events){if(events[_0xe6c6('0x5')](e)){var event=events[e];DashboardItem[_0xe6c6('0x6')](e,emitEvent(event));}}module[_0xe6c6('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x8255=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x38bca5,_0x382a4a){var _0x38bd18=function(_0x32b386){while(--_0x32b386){_0x38bca5['push'](_0x38bca5['shift']());}};_0x38bd18(++_0x382a4a);}(_0x8255,0x176));var _0x5825=function(_0x50c6e2,_0x30fd2a){_0x50c6e2=_0x50c6e2-0x0;var _0xa252a7=_0x8255[_0x50c6e2];return _0xa252a7;};'use strict';var EventEmitter=require(_0x5825('0x0'));var DashboardItem=require(_0x5825('0x1'))['db'][_0x5825('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5825('0x3')](0x0);var events={'afterCreate':_0x5825('0x4'),'afterUpdate':_0x5825('0x5'),'afterDestroy':_0x5825('0x6')};function emitEvent(_0x4b18ba){return function(_0x4d1534,_0x5f2bc3,_0x29b5f3){DashboardItemEvents[_0x5825('0x7')](_0x4b18ba+':'+_0x4d1534['id'],_0x4d1534);DashboardItemEvents[_0x5825('0x7')](_0x4b18ba,_0x4d1534);_0x29b5f3(null);};}for(var e in events){if(events[_0x5825('0x8')](e)){var event=events[e];DashboardItem[_0x5825('0x9')](e,emitEvent(event));}}module[_0x5825('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index dba59b1..4ca769a 100644 --- a/server/api/dashboardItem/dashboardItem.model.js +++ b/server/api/dashboardItem/dashboardItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x273e=['util','../../config/logger','api','rimraf','../../config/environment','./dashboardItem.attributes','dashboard_items'];(function(_0x32c166,_0x4654a0){var _0x15ff50=function(_0x36e7ba){while(--_0x36e7ba){_0x32c166['push'](_0x32c166['shift']());}};_0x15ff50(++_0x4654a0);}(_0x273e,0x1f1));var _0xe273=function(_0x583233,_0x66fc6){_0x583233=_0x583233-0x0;var _0x22d35c=_0x273e[_0x583233];return _0x22d35c;};'use strict';var _=require('lodash');var util=require(_0xe273('0x0'));var logger=require(_0xe273('0x1'))(_0xe273('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe273('0x3'));var config=require(_0xe273('0x4'));var attributes=require(_0xe273('0x5'));module['exports']=function(_0x17cee0,_0x224b7c){return _0x17cee0['define']('DashboardItem',attributes,{'tableName':_0xe273('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaf3=['DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./dashboardItem.attributes','exports'];(function(_0x29fe0e,_0x22e4da){var _0x37402a=function(_0x4f9d0b){while(--_0x4f9d0b){_0x29fe0e['push'](_0x29fe0e['shift']());}};_0x37402a(++_0x22e4da);}(_0xaaf3,0x70));var _0x3aaf=function(_0x20dd28,_0x49bb3c){_0x20dd28=_0x20dd28-0x0;var _0x269874=_0xaaf3[_0x20dd28];return _0x269874;};'use strict';var _=require(_0x3aaf('0x0'));var util=require(_0x3aaf('0x1'));var logger=require(_0x3aaf('0x2'))('api');var moment=require(_0x3aaf('0x3'));var BPromise=require('bluebird');var rp=require(_0x3aaf('0x4'));var fs=require('fs');var path=require(_0x3aaf('0x5'));var rimraf=require(_0x3aaf('0x6'));var config=require('../../config/environment');var attributes=require(_0x3aaf('0x7'));module[_0x3aaf('0x8')]=function(_0x54dd6e,_0x206b7b){return _0x54dd6e['define'](_0x3aaf('0x9'),attributes,{'tableName':_0x3aaf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index fad3fc8..4ec23fa 100644 --- a/server/api/dashboardItem/dashboardItem.rpc.js +++ b/server/api/dashboardItem/dashboardItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1c8=['rpc','client','http','redis','defaults','localhost','register','request','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xe1c8,0xf3));var _0x8e1c=function(_0xaa8045,_0x249502){_0xaa8045=_0xaa8045-0x0;var _0x11a308=_0xe1c8[_0xaa8045];return _0x11a308;};'use strict';var _=require('lodash');var util=require(_0x8e1c('0x0'));var moment=require(_0x8e1c('0x1'));var BPromise=require(_0x8e1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1c('0x3'));var db=require(_0x8e1c('0x4'))['db'];var utils=require(_0x8e1c('0x5'));var logger=require(_0x8e1c('0x6'))(_0x8e1c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e1c('0x8')][_0x8e1c('0x9')]({'port':0x232a});config[_0x8e1c('0xa')]=_[_0x8e1c('0xb')](config[_0x8e1c('0xa')],{'host':_0x8e1c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x8e1c('0xd')](socket);function respondWithRpcPromise(_0x3eba0e,_0x42edbe,_0x94f9c9){return new BPromise(function(_0x5bddb,_0x4ff327){return client[_0x8e1c('0xe')](_0x3eba0e,_0x94f9c9)['then'](function(_0x6b87e4){logger['info']('DashboardItem,\x20%s,\x20%s',_0x42edbe,_0x8e1c('0xf'));logger[_0x8e1c('0x10')](_0x8e1c('0x11'),_0x42edbe,_0x8e1c('0xf'),JSON[_0x8e1c('0x12')](_0x6b87e4));if(_0x6b87e4[_0x8e1c('0x13')]){if(_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x14')]===0x1f4){logger[_0x8e1c('0x13')]('DashboardItem,\x20%s,\x20%s',_0x42edbe,_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x15')]);return _0x4ff327(_0x6b87e4['error'][_0x8e1c('0x15')]);}logger[_0x8e1c('0x13')]('DashboardItem,\x20%s,\x20%s',_0x42edbe,_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x15')]);return _0x5bddb(_0x6b87e4[_0x8e1c('0x13')][_0x8e1c('0x15')]);}else{logger['info'](_0x8e1c('0x16'),_0x42edbe,_0x8e1c('0xf'));_0x5bddb(_0x6b87e4[_0x8e1c('0x17')][_0x8e1c('0x15')]);}})[_0x8e1c('0x18')](function(_0xe19728){logger[_0x8e1c('0x13')](_0x8e1c('0x16'),_0x42edbe,_0xe19728);_0x4ff327(_0xe19728);});});} \ No newline at end of file +var _0xe8a1=['stringify','code','DashboardItem,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x596125,_0x32ec22){var _0x1f5b3f=function(_0x50f0c0){while(--_0x50f0c0){_0x596125['push'](_0x596125['shift']());}};_0x1f5b3f(++_0x32ec22);}(_0xe8a1,0xd2));var _0x1e8a=function(_0x40a015,_0x416def){_0x40a015=_0x40a015-0x0;var _0x32b80e=_0xe8a1[_0x40a015];return _0x32b80e;};'use strict';var _=require(_0x1e8a('0x0'));var util=require(_0x1e8a('0x1'));var moment=require(_0x1e8a('0x2'));var BPromise=require(_0x1e8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e8a('0x4'));var db=require(_0x1e8a('0x5'))['db'];var utils=require(_0x1e8a('0x6'));var logger=require(_0x1e8a('0x7'))(_0x1e8a('0x8'));var config=require(_0x1e8a('0x9'));var jayson=require(_0x1e8a('0xa'));var client=jayson[_0x1e8a('0xb')][_0x1e8a('0xc')]({'port':0x232a});config[_0x1e8a('0xd')]=_[_0x1e8a('0xe')](config[_0x1e8a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e8a('0xf'))(new Redis(config[_0x1e8a('0xd')]));require(_0x1e8a('0x10'))[_0x1e8a('0x11')](socket);function respondWithRpcPromise(_0x1625bd,_0x80ad5,_0x2fe55a){return new BPromise(function(_0x676f82,_0x82ec8e){return client[_0x1e8a('0x12')](_0x1625bd,_0x2fe55a)[_0x1e8a('0x13')](function(_0x438d69){logger['info']('DashboardItem,\x20%s,\x20%s',_0x80ad5,_0x1e8a('0x14'));logger['debug'](_0x1e8a('0x15'),_0x80ad5,_0x1e8a('0x14'),JSON[_0x1e8a('0x16')](_0x438d69));if(_0x438d69['error']){if(_0x438d69['error'][_0x1e8a('0x17')]===0x1f4){logger['error'](_0x1e8a('0x18'),_0x80ad5,_0x438d69[_0x1e8a('0x19')][_0x1e8a('0x1a')]);return _0x82ec8e(_0x438d69[_0x1e8a('0x19')]['message']);}logger[_0x1e8a('0x19')]('DashboardItem,\x20%s,\x20%s',_0x80ad5,_0x438d69[_0x1e8a('0x19')][_0x1e8a('0x1a')]);return _0x676f82(_0x438d69['error'][_0x1e8a('0x1a')]);}else{logger[_0x1e8a('0x1b')](_0x1e8a('0x18'),_0x80ad5,_0x1e8a('0x14'));_0x676f82(_0x438d69['result']['message']);}})[_0x1e8a('0x1c')](function(_0x150d21){logger[_0x1e8a('0x19')](_0x1e8a('0x18'),_0x80ad5,_0x150d21);_0x82ec8e(_0x150d21);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5f489b8..b5d8f93 100644 --- a/server/api/dashboardItem/dashboardItem.socket.js +++ b/server/api/dashboardItem/dashboardItem.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5720=['register','length','dashboardItem:','save','update','emit','removeListener'];(function(_0x17f629,_0x45ec13){var _0x50af36=function(_0x47d96d){while(--_0x47d96d){_0x17f629['push'](_0x17f629['shift']());}};_0x50af36(++_0x45ec13);}(_0x5720,0x8f));var _0x0572=function(_0x5defc1,_0x3b17e1){_0x5defc1=_0x5defc1-0x0;var _0x568dde=_0x5720[_0x5defc1];return _0x568dde;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x0572('0x0'),'remove',_0x0572('0x1')];function createListener(_0x27fb4a,_0x1c658e){return function(_0x3030e2){_0x1c658e[_0x0572('0x2')](_0x27fb4a,_0x3030e2);};}function removeListener(_0x1301e7,_0x334ba0){return function(){DashboardItemEvents[_0x0572('0x3')](_0x1301e7,_0x334ba0);};}exports[_0x0572('0x4')]=function(_0x34d5d1){for(var _0x1c6640=0x0,_0x2c2c84=events[_0x0572('0x5')];_0x1c6640<_0x2c2c84;_0x1c6640++){var _0x520adf=events[_0x1c6640];var _0x527478=createListener(_0x0572('0x6')+_0x520adf,_0x34d5d1);DashboardItemEvents['on'](_0x520adf,_0x527478);}}; \ No newline at end of file +var _0xb21a=['length','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x31cee8,_0x454762){var _0x58fabd=function(_0x8c6a34){while(--_0x8c6a34){_0x31cee8['push'](_0x31cee8['shift']());}};_0x58fabd(++_0x454762);}(_0xb21a,0x89));var _0xab21=function(_0x4e8a8b,_0x40ff3c){_0x4e8a8b=_0x4e8a8b-0x0;var _0xb7457a=_0xb21a[_0x4e8a8b];return _0xb7457a;};'use strict';var DashboardItemEvents=require(_0xab21('0x0'));var events=[_0xab21('0x1'),_0xab21('0x2'),_0xab21('0x3')];function createListener(_0x4f0642,_0x124c9c){return function(_0x44964a){_0x124c9c[_0xab21('0x4')](_0x4f0642,_0x44964a);};}function removeListener(_0x3b80d8,_0x12279f){return function(){DashboardItemEvents[_0xab21('0x5')](_0x3b80d8,_0x12279f);};}exports[_0xab21('0x6')]=function(_0x5d5a11){for(var _0x5d654e=0x0,_0xeeaddf=events[_0xab21('0x7')];_0x5d654e<_0xeeaddf;_0x5d654e++){var _0x3bccb9=events[_0x5d654e];var _0x1e995b=createListener('dashboardItem:'+_0x3bccb9,_0x5d5a11);DashboardItemEvents['on'](_0x3bccb9,_0x1e995b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1274912..33671f6 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb74d=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0xb74d,0x12e));var _0xdb74=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xb74d[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0xdb74('0x0'));var util=require(_0xdb74('0x1'));var path=require(_0xdb74('0x2'));var timeout=require(_0xdb74('0x3'));var express=require(_0xdb74('0x4'));var router=express[_0xdb74('0x5')]();var fs_extra=require(_0xdb74('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb74('0x7'));var config=require(_0xdb74('0x8'));var controller=require(_0xdb74('0x9'));router[_0xdb74('0xa')](_0xdb74('0xb'),auth[_0xdb74('0xc')](),controller[_0xdb74('0xd')]);router['post']('/',auth[_0xdb74('0xc')](),controller[_0xdb74('0xe')]);router[_0xdb74('0xf')](_0xdb74('0xb'),auth[_0xdb74('0xc')](),controller[_0xdb74('0x10')]);router[_0xdb74('0x11')]('/:id',auth[_0xdb74('0xc')](),controller[_0xdb74('0x12')]);module[_0xdb74('0x13')]=router; \ No newline at end of file +var _0xad23=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','update','delete','exports'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xad23,0x1b5));var _0x3ad2=function(_0x523348,_0x4129ea){_0x523348=_0x523348-0x0;var _0x442bca=_0xad23[_0x523348];return _0x442bca;};'use strict';var multer=require(_0x3ad2('0x0'));var util=require(_0x3ad2('0x1'));var path=require(_0x3ad2('0x2'));var timeout=require(_0x3ad2('0x3'));var express=require(_0x3ad2('0x4'));var router=express[_0x3ad2('0x5')]();var fs_extra=require(_0x3ad2('0x6'));var auth=require(_0x3ad2('0x7'));var interaction=require(_0x3ad2('0x8'));var config=require(_0x3ad2('0x9'));var controller=require('./dashboardItem.controller');router[_0x3ad2('0xa')](_0x3ad2('0xb'),auth[_0x3ad2('0xc')](),controller[_0x3ad2('0xd')]);router[_0x3ad2('0xe')]('/',auth['isAuthenticated'](),controller[_0x3ad2('0xf')]);router['put'](_0x3ad2('0xb'),auth[_0x3ad2('0xc')](),controller[_0x3ad2('0x10')]);router[_0x3ad2('0x11')](_0x3ad2('0xb'),auth[_0x3ad2('0xc')](),controller['destroy']);module[_0x3ad2('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4f092e2..edf271a 100644 --- a/server/api/disposition/disposition.attributes.js +++ b/server/api/disposition/disposition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b6b=['exports','first','second','third','STRING','sequelize'];(function(_0x3e78eb,_0x198a0d){var _0x11257e=function(_0x307e7e){while(--_0x307e7e){_0x3e78eb['push'](_0x3e78eb['shift']());}};_0x11257e(++_0x198a0d);}(_0x4b6b,0x1eb));var _0xb4b6=function(_0x4e56f2,_0x33b905){_0x4e56f2=_0x4e56f2-0x0;var _0x1f5f79=_0x4b6b[_0x4e56f2];return _0x1f5f79;};'use strict';var Sequelize=require(_0xb4b6('0x0'));module[_0xb4b6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xb4b6('0x2'),_0xb4b6('0x3'),_0xb4b6('0x4')),'allowNull':![],'defaultValue':_0xb4b6('0x2')},'description':{'type':Sequelize[_0xb4b6('0x5')]}}; \ No newline at end of file +var _0x81ca=['exports','ENUM','first','second','third','STRING','sequelize'];(function(_0x34da95,_0x1ce53b){var _0xae9cff=function(_0x107bbf){while(--_0x107bbf){_0x34da95['push'](_0x34da95['shift']());}};_0xae9cff(++_0x1ce53b);}(_0x81ca,0x68));var _0xa81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81ca[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa81c('0x0'));module[_0xa81c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xa81c('0x2')](_0xa81c('0x3'),_0xa81c('0x4'),_0xa81c('0x5')),'allowNull':![],'defaultValue':_0xa81c('0x3')},'description':{'type':Sequelize[_0xa81c('0x6')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f78a707..bbe36ad 100644 --- a/server/api/disposition/disposition.controller.js +++ b/server/api/disposition/disposition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87cf=['../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','render','merge','contact','message','agent','interaction','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','options','includeAll','include','Disposition','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x525fc5,_0x115f96){var _0x1c9be7=function(_0x18eb5c){while(--_0x18eb5c){_0x525fc5['push'](_0x525fc5['shift']());}};_0x1c9be7(++_0x115f96);}(_0x87cf,0x19d));var _0xf87c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x87cf[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xf87c('0x0'));var rimraf=require(_0xf87c('0x1'));var zipdir=require(_0xf87c('0x2'));var jsonpatch=require(_0xf87c('0x3'));var rp=require(_0xf87c('0x4'));var moment=require(_0xf87c('0x5'));var BPromise=require(_0xf87c('0x6'));var Mustache=require(_0xf87c('0x7'));var util=require(_0xf87c('0x8'));var path=require('path');var sox=require(_0xf87c('0x9'));var csv=require('to-csv');var ejs=require(_0xf87c('0xa'));var fs=require('fs');var fs_extra=require(_0xf87c('0xb'));var _=require(_0xf87c('0xc'));var squel=require(_0xf87c('0xd'));var crypto=require(_0xf87c('0xe'));var jsforce=require(_0xf87c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf87c('0x10'));var Papa=require(_0xf87c('0x11'));var Redis=require(_0xf87c('0x12'));var authService=require(_0xf87c('0x13'));var qs=require(_0xf87c('0x14'));var as=require(_0xf87c('0x15'));var hardwareService=require(_0xf87c('0x16'));var logger=require(_0xf87c('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf87c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf87c('0x19'))['db'];function respondWithStatusCode(_0x1cde1f,_0x24a111){_0x24a111=_0x24a111||0xcc;return function(_0x19b281){if(_0x19b281){return _0x1cde1f['sendStatus'](_0x24a111);}return _0x1cde1f['status'](_0x24a111)['end']();};}function respondWithResult(_0x2ead94,_0x1d2ce9){_0x1d2ce9=_0x1d2ce9||0xc8;return function(_0x7e7d89){if(_0x7e7d89){return _0x2ead94[_0xf87c('0x1a')](_0x1d2ce9)[_0xf87c('0x1b')](_0x7e7d89);}};}function respondWithFilteredResult(_0x51cc3e,_0x25125a){return function(_0x1efa29){if(_0x1efa29){var _0x2837ac=typeof _0x25125a[_0xf87c('0x1c')]===_0xf87c('0x1d')&&typeof _0x25125a[_0xf87c('0x1e')]===_0xf87c('0x1d');var _0x3f93a6=_0x1efa29[_0xf87c('0x1f')];var _0x31d463=_0x2837ac?0x0:_0x25125a[_0xf87c('0x1c')];var _0x20eb92=_0x2837ac?_0x1efa29[_0xf87c('0x1f')]:_0x25125a[_0xf87c('0x1c')]+_0x25125a['limit'];var _0x50722c;if(_0x20eb92>=_0x3f93a6){_0x20eb92=_0x3f93a6;_0x50722c=0xc8;}else{_0x50722c=0xce;}_0x51cc3e[_0xf87c('0x1a')](_0x50722c);return _0x51cc3e[_0xf87c('0x20')](_0xf87c('0x21'),_0x31d463+'-'+_0x20eb92+'/'+_0x3f93a6)['json'](_0x1efa29);}return null;};}function patchUpdates(_0x46070a){return function(_0x142e60){try{jsonpatch['apply'](_0x142e60,_0x46070a,!![]);}catch(_0x36f59a){return BPromise[_0xf87c('0x22')](_0x36f59a);}return _0x142e60[_0xf87c('0x23')]();};}function saveUpdates(_0x1811d7,_0x349549){return function(_0xfd779f){if(_0xfd779f){return _0xfd779f['update'](_0x1811d7)[_0xf87c('0x24')](function(_0x12adae){return _0x12adae;});}return null;};}function removeEntity(_0xf78ca8,_0x3c26a3){return function(_0x5263ef){if(_0x5263ef){return _0x5263ef[_0xf87c('0x25')]()[_0xf87c('0x24')](function(){var _0x3250ec=_0x5263ef[_0xf87c('0x26')]({'plain':!![]});var _0x20749e=_0xf87c('0x27');return db[_0xf87c('0x28')][_0xf87c('0x25')]({'where':{'type':_0x20749e,'resourceId':_0x3250ec['id']}})[_0xf87c('0x24')](function(){return _0x5263ef;});})[_0xf87c('0x24')](function(){_0xf78ca8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x966757,_0x59e1e9){return function(_0xfe9f93){if(!_0xfe9f93){_0x966757[_0xf87c('0x29')](0x194);}return _0xfe9f93;};}function handleError(_0x6e4743,_0x1e1b0c){_0x1e1b0c=_0x1e1b0c||0x1f4;return function(_0x41ab25){logger[_0xf87c('0x2a')](_0x41ab25[_0xf87c('0x2b')]);if(_0x41ab25[_0xf87c('0x2c')]){delete _0x41ab25[_0xf87c('0x2c')];}_0x6e4743[_0xf87c('0x1a')](_0x1e1b0c)['send'](_0x41ab25);};}function getMustacheRender(_0x133b34,_0x5839b1){return Mustache[_0xf87c('0x2d')](_0x133b34,_[_0xf87c('0x2e')](_0x5839b1['body'],{'contact':_0x5839b1[_0xf87c('0x2f')],'message':_0x5839b1[_0xf87c('0x30')],'agent':_0x5839b1[_0xf87c('0x31')],'interaction':_0x5839b1[_0xf87c('0x32')],'account':_0x5839b1['account']}))||'';}exports[_0xf87c('0x33')]=function(_0x3081de,_0x1f82c6){var _0x4a7cb6={},_0x5dcc04={},_0x457fc6={'count':0x0,'rows':[]};var _0x1d834c=_[_0xf87c('0x34')](db['Disposition']['rawAttributes'],function(_0x1352b7){return{'name':_0x1352b7[_0xf87c('0x35')],'type':_0x1352b7[_0xf87c('0x36')]['key']};});_0x5dcc04[_0xf87c('0x37')]=_[_0xf87c('0x34')](_0x1d834c,'name');_0x5dcc04[_0xf87c('0x38')]=_['keys'](_0x3081de[_0xf87c('0x38')]);_0x5dcc04[_0xf87c('0x39')]=_[_0xf87c('0x3a')](_0x5dcc04[_0xf87c('0x37')],_0x5dcc04[_0xf87c('0x38')]);_0x4a7cb6[_0xf87c('0x3b')]=_[_0xf87c('0x3a')](_0x5dcc04[_0xf87c('0x37')],qs[_0xf87c('0x3c')](_0x3081de[_0xf87c('0x38')][_0xf87c('0x3c')]));_0x4a7cb6[_0xf87c('0x3b')]=_0x4a7cb6['attributes'][_0xf87c('0x3d')]?_0x4a7cb6['attributes']:_0x5dcc04[_0xf87c('0x37')];if(!_0x3081de['query']['hasOwnProperty'](_0xf87c('0x3e'))){_0x4a7cb6[_0xf87c('0x1e')]=qs[_0xf87c('0x1e')](_0x3081de['query']['limit']);_0x4a7cb6[_0xf87c('0x1c')]=qs[_0xf87c('0x1c')](_0x3081de[_0xf87c('0x38')][_0xf87c('0x1c')]);}_0x4a7cb6['order']=qs[_0xf87c('0x3f')](_0x3081de[_0xf87c('0x38')][_0xf87c('0x3f')]);_0x4a7cb6[_0xf87c('0x40')]=qs[_0xf87c('0x39')](_['pick'](_0x3081de[_0xf87c('0x38')],_0x5dcc04[_0xf87c('0x39')]),_0x1d834c);if(_0x3081de['query']['filter']){_0x4a7cb6[_0xf87c('0x40')]=_[_0xf87c('0x2e')](_0x4a7cb6[_0xf87c('0x40')],{'$or':_[_0xf87c('0x34')](_0x1d834c,function(_0x2eb180){if(_0x2eb180[_0xf87c('0x36')]!=='VIRTUAL'){var _0x1978af={};_0x1978af[_0x2eb180[_0xf87c('0x2c')]]={'$like':'%'+_0x3081de[_0xf87c('0x38')][_0xf87c('0x41')]+'%'};return _0x1978af;}})});}_0x4a7cb6=_[_0xf87c('0x2e')]({},_0x4a7cb6,_0x3081de[_0xf87c('0x42')]);var _0x234403={'where':_0x4a7cb6['where']};return db['Disposition'][_0xf87c('0x1f')](_0x234403)['then'](function(_0x333338){_0x457fc6[_0xf87c('0x1f')]=_0x333338;if(_0x3081de[_0xf87c('0x38')][_0xf87c('0x43')]){_0x4a7cb6[_0xf87c('0x44')]=[{'all':!![]}];}return db[_0xf87c('0x45')][_0xf87c('0x46')](_0x4a7cb6);})[_0xf87c('0x24')](function(_0x336f3f){_0x457fc6[_0xf87c('0x47')]=_0x336f3f;return _0x457fc6;})[_0xf87c('0x24')](respondWithFilteredResult(_0x1f82c6,_0x4a7cb6))[_0xf87c('0x48')](handleError(_0x1f82c6,null));};exports[_0xf87c('0x49')]=function(_0x2e4e3b,_0x25bfab){var _0x4d4dd0={'raw':!![],'where':{'id':_0x2e4e3b[_0xf87c('0x4a')]['id']}},_0x503904={};_0x503904[_0xf87c('0x37')]=_['keys'](db['Disposition'][_0xf87c('0x4b')]);_0x503904[_0xf87c('0x38')]=_[_0xf87c('0x4c')](_0x2e4e3b['query']);_0x503904['filters']=_[_0xf87c('0x3a')](_0x503904['model'],_0x503904[_0xf87c('0x38')]);_0x4d4dd0[_0xf87c('0x3b')]=_[_0xf87c('0x3a')](_0x503904[_0xf87c('0x37')],qs[_0xf87c('0x3c')](_0x2e4e3b[_0xf87c('0x38')]['fields']));_0x4d4dd0[_0xf87c('0x3b')]=_0x4d4dd0[_0xf87c('0x3b')][_0xf87c('0x3d')]?_0x4d4dd0[_0xf87c('0x3b')]:_0x503904[_0xf87c('0x37')];if(_0x2e4e3b[_0xf87c('0x38')]['includeAll']){_0x4d4dd0[_0xf87c('0x44')]=[{'all':!![]}];}_0x4d4dd0=_[_0xf87c('0x2e')]({},_0x4d4dd0,_0x2e4e3b['options']);return db[_0xf87c('0x45')][_0xf87c('0x4d')](_0x4d4dd0)['then'](handleEntityNotFound(_0x25bfab,null))[_0xf87c('0x24')](respondWithResult(_0x25bfab,null))['catch'](handleError(_0x25bfab,null));};exports['create']=function(_0x4ec6b6,_0x1d8708){return db[_0xf87c('0x45')][_0xf87c('0x4e')](_0x4ec6b6[_0xf87c('0x4f')],{})[_0xf87c('0x24')](function(_0x21580c){var _0x58736d=_0x4ec6b6[_0xf87c('0x50')][_0xf87c('0x26')]({'plain':!![]});if(!_0x58736d)throw new Error(_0xf87c('0x51'));if(_0x58736d[_0xf87c('0x52')]===_0xf87c('0x50')){var _0x227bd4=_0x21580c[_0xf87c('0x26')]({'plain':!![]});var _0x5f215a=_0xf87c('0x27');return db[_0xf87c('0x53')][_0xf87c('0x4d')]({'where':{'name':_0x5f215a,'userProfileId':_0x58736d[_0xf87c('0x54')]},'raw':!![]})['then'](function(_0x4bd4e3){if(_0x4bd4e3&&_0x4bd4e3['autoAssociation']===0x0){return db[_0xf87c('0x28')][_0xf87c('0x4e')]({'name':_0x227bd4[_0xf87c('0x2c')],'resourceId':_0x227bd4['id'],'type':_0x4bd4e3[_0xf87c('0x2c')],'sectionId':_0x4bd4e3['id']},{})[_0xf87c('0x24')](function(){return _0x21580c;});}else{return _0x21580c;}})['catch'](function(_0x14b1ed){logger['error'](_0xf87c('0x55'),_0x14b1ed);throw _0x14b1ed;});}return _0x21580c;})[_0xf87c('0x24')](respondWithResult(_0x1d8708,0xc9))[_0xf87c('0x48')](handleError(_0x1d8708,null));};exports[_0xf87c('0x56')]=function(_0x46d428,_0x5e06ca){if(_0x46d428['body']['id']){delete _0x46d428[_0xf87c('0x4f')]['id'];}return db['Disposition'][_0xf87c('0x4d')]({'where':{'id':_0x46d428[_0xf87c('0x4a')]['id']}})[_0xf87c('0x24')](handleEntityNotFound(_0x5e06ca,null))[_0xf87c('0x24')](saveUpdates(_0x46d428[_0xf87c('0x4f')],null))[_0xf87c('0x24')](respondWithResult(_0x5e06ca,null))[_0xf87c('0x48')](handleError(_0x5e06ca,null));};exports[_0xf87c('0x25')]=function(_0x20b87f,_0x2856df){return db[_0xf87c('0x45')][_0xf87c('0x4d')]({'where':{'id':_0x20b87f[_0xf87c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2856df,null))[_0xf87c('0x24')](removeEntity(_0x2856df,null))[_0xf87c('0x48')](handleError(_0x2856df,null));}; \ No newline at end of file +var _0xebdc=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','merge','body','contact','message','agent','account','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','Disposition','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','squel','jsforce','desk.js'];(function(_0x26cea9,_0xcbfbd9){var _0x49addb=function(_0x512dff){while(--_0x512dff){_0x26cea9['push'](_0x26cea9['shift']());}};_0x49addb(++_0xcbfbd9);}(_0xebdc,0x158));var _0xcebd=function(_0x40372f,_0x580770){_0x40372f=_0x40372f-0x0;var _0x39f675=_0xebdc[_0x40372f];return _0x39f675;};'use strict';var emlformat=require(_0xcebd('0x0'));var rimraf=require(_0xcebd('0x1'));var zipdir=require(_0xcebd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcebd('0x3'));var moment=require(_0xcebd('0x4'));var BPromise=require(_0xcebd('0x5'));var Mustache=require(_0xcebd('0x6'));var util=require(_0xcebd('0x7'));var path=require('path');var sox=require(_0xcebd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcebd('0x9'));var crypto=require('crypto');var jsforce=require(_0xcebd('0xa'));var deskjs=require(_0xcebd('0xb'));var toCsv=require(_0xcebd('0xc'));var querystring=require(_0xcebd('0xd'));var Papa=require(_0xcebd('0xe'));var Redis=require(_0xcebd('0xf'));var authService=require(_0xcebd('0x10'));var qs=require(_0xcebd('0x11'));var as=require(_0xcebd('0x12'));var hardwareService=require(_0xcebd('0x13'));var logger=require(_0xcebd('0x14'))(_0xcebd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcebd('0x16'));var db=require(_0xcebd('0x17'))['db'];function respondWithStatusCode(_0x592c16,_0x59449f){_0x59449f=_0x59449f||0xcc;return function(_0x3dd095){if(_0x3dd095){return _0x592c16[_0xcebd('0x18')](_0x59449f);}return _0x592c16['status'](_0x59449f)[_0xcebd('0x19')]();};}function respondWithResult(_0x43baa7,_0x2441ce){_0x2441ce=_0x2441ce||0xc8;return function(_0x201de6){if(_0x201de6){return _0x43baa7[_0xcebd('0x1a')](_0x2441ce)['json'](_0x201de6);}};}function respondWithFilteredResult(_0x907048,_0x5e49e7){return function(_0x23bf70){if(_0x23bf70){var _0x4f544c=typeof _0x5e49e7['offset']===_0xcebd('0x1b')&&typeof _0x5e49e7[_0xcebd('0x1c')]==='undefined';var _0x4834a6=_0x23bf70[_0xcebd('0x1d')];var _0x17d7b2=_0x4f544c?0x0:_0x5e49e7[_0xcebd('0x1e')];var _0x39abb0=_0x4f544c?_0x23bf70[_0xcebd('0x1d')]:_0x5e49e7['offset']+_0x5e49e7[_0xcebd('0x1c')];var _0x2bc4aa;if(_0x39abb0>=_0x4834a6){_0x39abb0=_0x4834a6;_0x2bc4aa=0xc8;}else{_0x2bc4aa=0xce;}_0x907048[_0xcebd('0x1a')](_0x2bc4aa);return _0x907048['set'](_0xcebd('0x1f'),_0x17d7b2+'-'+_0x39abb0+'/'+_0x4834a6)[_0xcebd('0x20')](_0x23bf70);}return null;};}function patchUpdates(_0x59f51a){return function(_0x289b9b){try{jsonpatch[_0xcebd('0x21')](_0x289b9b,_0x59f51a,!![]);}catch(_0x313fba){return BPromise[_0xcebd('0x22')](_0x313fba);}return _0x289b9b[_0xcebd('0x23')]();};}function saveUpdates(_0x58eac3,_0x2f58e9){return function(_0x256429){if(_0x256429){return _0x256429[_0xcebd('0x24')](_0x58eac3)[_0xcebd('0x25')](function(_0xa7a05a){return _0xa7a05a;});}return null;};}function removeEntity(_0x1e25b3,_0x17698f){return function(_0x56af33){if(_0x56af33){return _0x56af33[_0xcebd('0x26')]()[_0xcebd('0x25')](function(){var _0x24ff89=_0x56af33[_0xcebd('0x27')]({'plain':!![]});var _0x136cf3=_0xcebd('0x28');return db[_0xcebd('0x29')]['destroy']({'where':{'type':_0x136cf3,'resourceId':_0x24ff89['id']}})[_0xcebd('0x25')](function(){return _0x56af33;});})[_0xcebd('0x25')](function(){_0x1e25b3[_0xcebd('0x1a')](0xcc)[_0xcebd('0x19')]();});}};}function handleEntityNotFound(_0x16db21,_0x1b976e){return function(_0x5b5e77){if(!_0x5b5e77){_0x16db21['sendStatus'](0x194);}return _0x5b5e77;};}function handleError(_0x53c10a,_0x251801){_0x251801=_0x251801||0x1f4;return function(_0x4db2b2){logger[_0xcebd('0x2a')](_0x4db2b2[_0xcebd('0x2b')]);if(_0x4db2b2['name']){delete _0x4db2b2[_0xcebd('0x2c')];}_0x53c10a[_0xcebd('0x1a')](_0x251801)[_0xcebd('0x2d')](_0x4db2b2);};}function getMustacheRender(_0x35691b,_0x337312){return Mustache['render'](_0x35691b,_[_0xcebd('0x2e')](_0x337312[_0xcebd('0x2f')],{'contact':_0x337312[_0xcebd('0x30')],'message':_0x337312[_0xcebd('0x31')],'agent':_0x337312[_0xcebd('0x32')],'interaction':_0x337312['interaction'],'account':_0x337312[_0xcebd('0x33')]}))||'';}exports[_0xcebd('0x34')]=function(_0x512f90,_0x45984a){var _0x1a5aff={},_0x78bb27={},_0x1c34fc={'count':0x0,'rows':[]};var _0x11eabc=_[_0xcebd('0x35')](db['Disposition'][_0xcebd('0x36')],function(_0x111054){return{'name':_0x111054['fieldName'],'type':_0x111054[_0xcebd('0x37')][_0xcebd('0x38')]};});_0x78bb27[_0xcebd('0x39')]=_[_0xcebd('0x35')](_0x11eabc,_0xcebd('0x2c'));_0x78bb27['query']=_[_0xcebd('0x3a')](_0x512f90[_0xcebd('0x3b')]);_0x78bb27[_0xcebd('0x3c')]=_['intersection'](_0x78bb27[_0xcebd('0x39')],_0x78bb27[_0xcebd('0x3b')]);_0x1a5aff[_0xcebd('0x3d')]=_[_0xcebd('0x3e')](_0x78bb27[_0xcebd('0x39')],qs[_0xcebd('0x3f')](_0x512f90[_0xcebd('0x3b')][_0xcebd('0x3f')]));_0x1a5aff[_0xcebd('0x3d')]=_0x1a5aff[_0xcebd('0x3d')][_0xcebd('0x40')]?_0x1a5aff[_0xcebd('0x3d')]:_0x78bb27[_0xcebd('0x39')];if(!_0x512f90['query'][_0xcebd('0x41')](_0xcebd('0x42'))){_0x1a5aff['limit']=qs[_0xcebd('0x1c')](_0x512f90[_0xcebd('0x3b')][_0xcebd('0x1c')]);_0x1a5aff[_0xcebd('0x1e')]=qs['offset'](_0x512f90['query'][_0xcebd('0x1e')]);}_0x1a5aff[_0xcebd('0x43')]=qs[_0xcebd('0x44')](_0x512f90['query']['sort']);_0x1a5aff[_0xcebd('0x45')]=qs[_0xcebd('0x3c')](_[_0xcebd('0x46')](_0x512f90[_0xcebd('0x3b')],_0x78bb27['filters']),_0x11eabc);if(_0x512f90[_0xcebd('0x3b')][_0xcebd('0x47')]){_0x1a5aff[_0xcebd('0x45')]=_[_0xcebd('0x2e')](_0x1a5aff['where'],{'$or':_[_0xcebd('0x35')](_0x11eabc,function(_0x1a9beb){if(_0x1a9beb[_0xcebd('0x37')]!==_0xcebd('0x48')){var _0xcddeee={};_0xcddeee[_0x1a9beb[_0xcebd('0x2c')]]={'$like':'%'+_0x512f90[_0xcebd('0x3b')][_0xcebd('0x47')]+'%'};return _0xcddeee;}})});}_0x1a5aff=_[_0xcebd('0x2e')]({},_0x1a5aff,_0x512f90['options']);var _0x22a4a2={'where':_0x1a5aff[_0xcebd('0x45')]};return db[_0xcebd('0x49')][_0xcebd('0x1d')](_0x22a4a2)[_0xcebd('0x25')](function(_0x4bd2ad){_0x1c34fc['count']=_0x4bd2ad;if(_0x512f90[_0xcebd('0x3b')][_0xcebd('0x4a')]){_0x1a5aff[_0xcebd('0x4b')]=[{'all':!![]}];}return db[_0xcebd('0x49')][_0xcebd('0x4c')](_0x1a5aff);})['then'](function(_0x52b642){_0x1c34fc[_0xcebd('0x4d')]=_0x52b642;return _0x1c34fc;})[_0xcebd('0x25')](respondWithFilteredResult(_0x45984a,_0x1a5aff))[_0xcebd('0x4e')](handleError(_0x45984a,null));};exports[_0xcebd('0x4f')]=function(_0xbe88a0,_0x22c302){var _0x45d360={'raw':!![],'where':{'id':_0xbe88a0[_0xcebd('0x50')]['id']}},_0x2ff3e9={};_0x2ff3e9['model']=_[_0xcebd('0x3a')](db[_0xcebd('0x49')][_0xcebd('0x36')]);_0x2ff3e9[_0xcebd('0x3b')]=_[_0xcebd('0x3a')](_0xbe88a0[_0xcebd('0x3b')]);_0x2ff3e9[_0xcebd('0x3c')]=_[_0xcebd('0x3e')](_0x2ff3e9[_0xcebd('0x39')],_0x2ff3e9[_0xcebd('0x3b')]);_0x45d360[_0xcebd('0x3d')]=_[_0xcebd('0x3e')](_0x2ff3e9['model'],qs['fields'](_0xbe88a0['query']['fields']));_0x45d360[_0xcebd('0x3d')]=_0x45d360[_0xcebd('0x3d')][_0xcebd('0x40')]?_0x45d360[_0xcebd('0x3d')]:_0x2ff3e9['model'];if(_0xbe88a0[_0xcebd('0x3b')][_0xcebd('0x4a')]){_0x45d360[_0xcebd('0x4b')]=[{'all':!![]}];}_0x45d360=_[_0xcebd('0x2e')]({},_0x45d360,_0xbe88a0[_0xcebd('0x51')]);return db['Disposition'][_0xcebd('0x52')](_0x45d360)[_0xcebd('0x25')](handleEntityNotFound(_0x22c302,null))[_0xcebd('0x25')](respondWithResult(_0x22c302,null))[_0xcebd('0x4e')](handleError(_0x22c302,null));};exports[_0xcebd('0x53')]=function(_0x594dbf,_0xdce656){return db['Disposition'][_0xcebd('0x53')](_0x594dbf[_0xcebd('0x2f')],{})[_0xcebd('0x25')](function(_0x57893b){var _0x334066=_0x594dbf[_0xcebd('0x54')][_0xcebd('0x27')]({'plain':!![]});if(!_0x334066)throw new Error(_0xcebd('0x55'));if(_0x334066[_0xcebd('0x56')]==='user'){var _0x4eb905=_0x57893b[_0xcebd('0x27')]({'plain':!![]});var _0x445a85='Dispositions';return db[_0xcebd('0x57')][_0xcebd('0x52')]({'where':{'name':_0x445a85,'userProfileId':_0x334066['userProfileId']},'raw':!![]})['then'](function(_0x672cbb){if(_0x672cbb&&_0x672cbb[_0xcebd('0x58')]===0x0){return db[_0xcebd('0x29')]['create']({'name':_0x4eb905[_0xcebd('0x2c')],'resourceId':_0x4eb905['id'],'type':_0x672cbb['name'],'sectionId':_0x672cbb['id']},{})[_0xcebd('0x25')](function(){return _0x57893b;});}else{return _0x57893b;}})[_0xcebd('0x4e')](function(_0x537feb){logger[_0xcebd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x537feb);throw _0x537feb;});}return _0x57893b;})[_0xcebd('0x25')](respondWithResult(_0xdce656,0xc9))[_0xcebd('0x4e')](handleError(_0xdce656,null));};exports[_0xcebd('0x24')]=function(_0x31aa2c,_0x782189){if(_0x31aa2c[_0xcebd('0x2f')]['id']){delete _0x31aa2c[_0xcebd('0x2f')]['id'];}return db[_0xcebd('0x49')][_0xcebd('0x52')]({'where':{'id':_0x31aa2c[_0xcebd('0x50')]['id']}})['then'](handleEntityNotFound(_0x782189,null))['then'](saveUpdates(_0x31aa2c[_0xcebd('0x2f')],null))[_0xcebd('0x25')](respondWithResult(_0x782189,null))[_0xcebd('0x4e')](handleError(_0x782189,null));};exports[_0xcebd('0x26')]=function(_0x43819a,_0x306d6d){return db[_0xcebd('0x49')][_0xcebd('0x52')]({'where':{'id':_0x43819a[_0xcebd('0x50')]['id']}})[_0xcebd('0x25')](handleEntityNotFound(_0x306d6d,null))['then'](removeEntity(_0x306d6d,null))[_0xcebd('0x4e')](handleError(_0x306d6d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 1c08987..54e3646 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe181=['tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','define','Disposition'];(function(_0x1f88b3,_0x3560e0){var _0x5e0463=function(_0x8999c6){while(--_0x8999c6){_0x1f88b3['push'](_0x1f88b3['shift']());}};_0x5e0463(++_0x3560e0);}(_0xe181,0x68));var _0x1e18=function(_0xaaa123,_0x4c23e3){_0xaaa123=_0xaaa123-0x0;var _0x44d6d7=_0xe181[_0xaaa123];return _0x44d6d7;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var logger=require(_0x1e18('0x1'))(_0x1e18('0x2'));var moment=require(_0x1e18('0x3'));var BPromise=require(_0x1e18('0x4'));var rp=require(_0x1e18('0x5'));var fs=require('fs');var path=require(_0x1e18('0x6'));var rimraf=require(_0x1e18('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e18('0x8'));module['exports']=function(_0x512343,_0x18fabb){return _0x512343[_0x1e18('0x9')](_0x1e18('0xa'),attributes,{'tableName':_0x1e18('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1e18('0xc'),'fields':[_0x1e18('0xd'),'ListId']},{'unique':!![],'name':_0x1e18('0xe'),'fields':[_0x1e18('0xd'),_0x1e18('0xf')]},{'unique':!![],'name':_0x1e18('0x10'),'fields':[_0x1e18('0xd'),_0x1e18('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x1e18('0xd'),_0x1e18('0x12')]},{'unique':!![],'name':_0x1e18('0x13'),'fields':[_0x1e18('0xd'),_0x1e18('0x14')]},{'unique':!![],'name':_0x1e18('0x15'),'fields':[_0x1e18('0xd'),_0x1e18('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x1e18('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bac=['./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name_chat','name_sms','name','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0xf8ecbc,_0x44ddf0){var _0x43cd87=function(_0x52b65f){while(--_0x52b65f){_0xf8ecbc['push'](_0xf8ecbc['shift']());}};_0x43cd87(++_0x44ddf0);}(_0x6bac,0xa5));var _0xc6ba=function(_0x35d477,_0x494cf5){_0x35d477=_0x35d477-0x0;var _0x26b223=_0x6bac[_0x35d477];return _0x26b223;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var logger=require(_0xc6ba('0x1'))(_0xc6ba('0x2'));var moment=require(_0xc6ba('0x3'));var BPromise=require(_0xc6ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6ba('0x5'));var attributes=require(_0xc6ba('0x6'));module['exports']=function(_0x222f20,_0x2a16af){return _0x222f20[_0xc6ba('0x7')](_0xc6ba('0x8'),attributes,{'tableName':_0xc6ba('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc6ba('0xa'),'fields':['name','ListId']},{'unique':!![],'name':_0xc6ba('0xb'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0xc6ba('0xc'),'fields':[_0xc6ba('0xd'),_0xc6ba('0xe')]},{'unique':!![],'name':_0xc6ba('0xf'),'fields':[_0xc6ba('0xd'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xc6ba('0xd'),_0xc6ba('0x10')]},{'unique':!![],'name':_0xc6ba('0x11'),'fields':[_0xc6ba('0xd'),_0xc6ba('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 04140af..b36c763 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d80=['message','lodash','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','result'];(function(_0x66c3a8,_0x186d44){var _0x481590=function(_0x26429b){while(--_0x26429b){_0x66c3a8['push'](_0x66c3a8['shift']());}};_0x481590(++_0x186d44);}(_0x3d80,0xb5));var _0x03d8=function(_0x45f3be,_0x2b377d){_0x45f3be=_0x45f3be-0x0;var _0x2026f5=_0x3d80[_0x45f3be];return _0x2026f5;};'use strict';var _=require(_0x03d8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x03d8('0x1'));var fs=require('fs');var Redis=require(_0x03d8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x03d8('0x3'))(_0x03d8('0x4'));var config=require(_0x03d8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x03d8('0x6')][_0x03d8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f9d3d,_0x1915ee,_0x254d94){return new BPromise(function(_0x55cc6e,_0x53fd88){return client['request'](_0x3f9d3d,_0x254d94)[_0x03d8('0x8')](function(_0x59d13b){logger[_0x03d8('0x9')](_0x03d8('0xa'),_0x1915ee,_0x03d8('0xb'));logger[_0x03d8('0xc')]('Disposition,\x20%s,\x20%s,\x20%s',_0x1915ee,'request\x20sent',JSON[_0x03d8('0xd')](_0x59d13b));if(_0x59d13b[_0x03d8('0xe')]){if(_0x59d13b[_0x03d8('0xe')][_0x03d8('0xf')]===0x1f4){logger[_0x03d8('0xe')](_0x03d8('0xa'),_0x1915ee,_0x59d13b[_0x03d8('0xe')]['message']);return _0x53fd88(_0x59d13b['error']['message']);}logger[_0x03d8('0xe')]('Disposition,\x20%s,\x20%s',_0x1915ee,_0x59d13b[_0x03d8('0xe')]['message']);return _0x55cc6e(_0x59d13b[_0x03d8('0xe')]['message']);}else{logger[_0x03d8('0x9')](_0x03d8('0xa'),_0x1915ee,_0x03d8('0xb'));_0x55cc6e(_0x59d13b[_0x03d8('0x10')][_0x03d8('0x11')]);}})['catch'](function(_0x492fd4){logger['error']('Disposition,\x20%s,\x20%s',_0x1915ee,_0x492fd4);_0x53fd88(_0x492fd4);});});} \ No newline at end of file +var _0xb4ec=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','error','code','Disposition,\x20%s,\x20%s','message','lodash'];(function(_0x19921b,_0x5c0c2d){var _0x273545=function(_0x387462){while(--_0x387462){_0x19921b['push'](_0x19921b['shift']());}};_0x273545(++_0x5c0c2d);}(_0xb4ec,0x179));var _0xcb4e=function(_0x5eeea4,_0x3d7b14){_0x5eeea4=_0x5eeea4-0x0;var _0x2c508b=_0xb4ec[_0x5eeea4];return _0x2c508b;};'use strict';var _=require(_0xcb4e('0x0'));var util=require(_0xcb4e('0x1'));var moment=require(_0xcb4e('0x2'));var BPromise=require(_0xcb4e('0x3'));var rs=require(_0xcb4e('0x4'));var fs=require('fs');var Redis=require(_0xcb4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb4e('0x6'));var logger=require(_0xcb4e('0x7'))(_0xcb4e('0x8'));var config=require(_0xcb4e('0x9'));var jayson=require(_0xcb4e('0xa'));var client=jayson[_0xcb4e('0xb')][_0xcb4e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59bec6,_0xceb751,_0x57ae00){return new BPromise(function(_0xfa49cb,_0x24d28c){return client[_0xcb4e('0xd')](_0x59bec6,_0x57ae00)['then'](function(_0x2a8c8c){logger[_0xcb4e('0xe')]('Disposition,\x20%s,\x20%s',_0xceb751,_0xcb4e('0xf'));logger['debug'](_0xcb4e('0x10'),_0xceb751,_0xcb4e('0xf'),JSON['stringify'](_0x2a8c8c));if(_0x2a8c8c[_0xcb4e('0x11')]){if(_0x2a8c8c[_0xcb4e('0x11')][_0xcb4e('0x12')]===0x1f4){logger[_0xcb4e('0x11')](_0xcb4e('0x13'),_0xceb751,_0x2a8c8c[_0xcb4e('0x11')]['message']);return _0x24d28c(_0x2a8c8c[_0xcb4e('0x11')][_0xcb4e('0x14')]);}logger[_0xcb4e('0x11')]('Disposition,\x20%s,\x20%s',_0xceb751,_0x2a8c8c[_0xcb4e('0x11')][_0xcb4e('0x14')]);return _0xfa49cb(_0x2a8c8c[_0xcb4e('0x11')][_0xcb4e('0x14')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0xceb751,'request\x20sent');_0xfa49cb(_0x2a8c8c['result']['message']);}})['catch'](function(_0x3f8e74){logger[_0xcb4e('0x11')](_0xcb4e('0x13'),_0xceb751,_0x3f8e74);_0x24d28c(_0x3f8e74);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 4efe6c9..8ec2b0c 100644 --- a/server/api/disposition/index.js +++ b/server/api/disposition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ad7=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x32017e,_0x546c4c){var _0x19981c=function(_0x4f15fd){while(--_0x4f15fd){_0x32017e['push'](_0x32017e['shift']());}};_0x19981c(++_0x546c4c);}(_0x1ad7,0x11e));var _0x71ad=function(_0x3cc563,_0x1598d3){_0x3cc563=_0x3cc563-0x0;var _0x11c044=_0x1ad7[_0x3cc563];return _0x11c044;};'use strict';var multer=require('multer');var util=require(_0x71ad('0x0'));var path=require('path');var timeout=require(_0x71ad('0x1'));var express=require(_0x71ad('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x71ad('0x3'));var interaction=require(_0x71ad('0x4'));var config=require(_0x71ad('0x5'));var controller=require(_0x71ad('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x71ad('0x7')]);router['get'](_0x71ad('0x8'),auth[_0x71ad('0x9')](),controller[_0x71ad('0xa')]);router[_0x71ad('0xb')]('/',auth['isAuthenticated'](),controller[_0x71ad('0xc')]);router[_0x71ad('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x71ad('0xe')]);router[_0x71ad('0xf')](_0x71ad('0x8'),auth['isAuthenticated'](),controller[_0x71ad('0x10')]);module[_0x71ad('0x11')]=router; \ No newline at end of file +var _0xc0d2=['get','isAuthenticated','index','post','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x14886c,_0x5350e6){var _0x4610bc=function(_0x1413f5){while(--_0x1413f5){_0x14886c['push'](_0x14886c['shift']());}};_0x4610bc(++_0x5350e6);}(_0xc0d2,0x91));var _0x2c0d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc0d2[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x2c0d('0x0'));var util=require(_0x2c0d('0x1'));var path=require('path');var timeout=require(_0x2c0d('0x2'));var express=require(_0x2c0d('0x3'));var router=express[_0x2c0d('0x4')]();var fs_extra=require(_0x2c0d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2c0d('0x6'));var config=require(_0x2c0d('0x7'));var controller=require('./disposition.controller');router[_0x2c0d('0x8')]('/',auth[_0x2c0d('0x9')](),controller[_0x2c0d('0xa')]);router[_0x2c0d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2c0d('0xb')]('/',auth[_0x2c0d('0x9')](),controller['create']);router[_0x2c0d('0xc')]('/:id',auth[_0x2c0d('0x9')](),controller[_0x2c0d('0xd')]);router['delete'](_0x2c0d('0xe'),auth[_0x2c0d('0x9')](),controller[_0x2c0d('0xf')]);module[_0x2c0d('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7c85f49..2b79838 100644 --- a/server/api/faxAccount/faxAccount.attributes.js +++ b/server/api/faxAccount/faxAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7c0=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x523196,_0x1d6d0a){var _0x3c75a1=function(_0x5f5ac5){while(--_0x5f5ac5){_0x523196['push'](_0x523196['shift']());}};_0x3c75a1(++_0x1d6d0a);}(_0xf7c0,0x1b5));var _0x0f7c=function(_0x11a164,_0x274dd7){_0x11a164=_0x11a164-0x0;var _0x5e359b=_0xf7c0[_0x11a164];return _0x5e359b;};'use strict';var Sequelize=require('sequelize');module[_0x0f7c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f7c('0x1')]},'ecm':{'type':Sequelize[_0x0f7c('0x2')]('yes','no'),'defaultValue':_0x0f7c('0x3')},'headerinfo':{'type':Sequelize[_0x0f7c('0x1')],'defaultValue':_0x0f7c('0x4')},'localstationid':{'type':Sequelize[_0x0f7c('0x1')],'unique':_0x0f7c('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x0f7c('0x6'),_0x0f7c('0x7'),'7200','9600','12000','14400'),'defaultValue':_0x0f7c('0x7')},'maxrate':{'type':Sequelize[_0x0f7c('0x2')](_0x0f7c('0x6'),_0x0f7c('0x7'),_0x0f7c('0x8'),_0x0f7c('0x9'),_0x0f7c('0xa'),_0x0f7c('0xb')),'defaultValue':_0x0f7c('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x0f7c('0xc')},'gateway':{'type':Sequelize[_0x0f7c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x0f7c('0xd'),_0x0f7c('0xe'),'DADHI',_0x0f7c('0xf')),'defaultValue':_0x0f7c('0xd')},'key':{'type':Sequelize[_0x0f7c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0f7c('0x10')],'defaultValue':function(){return _0x0f7c('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0f7c('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0f7c('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0f7c('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0f7c('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0f7c('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x0f7c('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x18bbf7){if(!_0x18bbf7)this[_0x0f7c('0x15')](_0x0f7c('0x16'),null);this[_0x0f7c('0x15')](_0x0f7c('0x17'),_0x18bbf7);}}}; \ No newline at end of file +var _0x8a1e=['ENUM','yes','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING'];(function(_0x524294,_0x5e51f2){var _0x1fdcb2=function(_0x50aaaa){while(--_0x50aaaa){_0x524294['push'](_0x524294['shift']());}};_0x1fdcb2(++_0x5e51f2);}(_0x8a1e,0x1b6));var _0xe8a1=function(_0x596838,_0x176ef2){_0x596838=_0x596838-0x0;var _0x5e17db=_0x8a1e[_0x596838];return _0x5e17db;};'use strict';var Sequelize=require('sequelize');module[_0xe8a1('0x0')]={'name':{'type':Sequelize[_0xe8a1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe8a1('0x1')]},'ecm':{'type':Sequelize[_0xe8a1('0x2')](_0xe8a1('0x3'),'no'),'defaultValue':_0xe8a1('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xe8a1('0x4')},'minrate':{'type':Sequelize[_0xe8a1('0x2')]('2400',_0xe8a1('0x5'),_0xe8a1('0x6'),_0xe8a1('0x7'),_0xe8a1('0x8'),_0xe8a1('0x9')),'defaultValue':_0xe8a1('0x5')},'maxrate':{'type':Sequelize[_0xe8a1('0x2')](_0xe8a1('0xa'),'4800',_0xe8a1('0x6'),_0xe8a1('0x7'),_0xe8a1('0x8'),_0xe8a1('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xe8a1('0xb')},'gateway':{'type':Sequelize[_0xe8a1('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe8a1('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe8a1('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0xe8a1('0xd'),_0xe8a1('0xe')),'defaultValue':_0xe8a1('0xf')},'key':{'type':Sequelize[_0xe8a1('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe8a1('0x10')],'defaultValue':function(){return _0xe8a1('0x11');}},'notificationSound':{'type':Sequelize[_0xe8a1('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe8a1('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe8a1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe8a1('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe8a1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe8a1('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe8a1('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x531764){if(!_0x531764)this[_0xe8a1('0x13')](_0xe8a1('0x14'),null);this[_0xe8a1('0x13')](_0xe8a1('0x15'),_0x531764);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5095b9d..4c64ab4 100644 --- a/server/api/faxAccount/faxAccount.controller.js +++ b/server/api/faxAccount/faxAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f40=['role','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','sort','rows','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','nolimit','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','CheckAfterSend','isNil','from','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','spread','userFaxAccount:save','isArray','emit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','jayson/promise','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','get','FaxAccounts','UserProfileResource','then','stack','name','send','render','body','contact','agent','interaction','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x4f40,0x64));var _0x04f4=function(_0x509698,_0x6a77ae){_0x509698=_0x509698-0x0;var _0x5495bd=_0x4f40[_0x509698];return _0x5495bd;};'use strict';var emlformat=require(_0x04f4('0x0'));var rimraf=require(_0x04f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04f4('0x2'));var rp=require(_0x04f4('0x3'));var moment=require(_0x04f4('0x4'));var BPromise=require(_0x04f4('0x5'));var Mustache=require(_0x04f4('0x6'));var util=require(_0x04f4('0x7'));var path=require(_0x04f4('0x8'));var sox=require(_0x04f4('0x9'));var csv=require(_0x04f4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x04f4('0xb'));var _=require(_0x04f4('0xc'));var squel=require(_0x04f4('0xd'));var crypto=require(_0x04f4('0xe'));var jsforce=require(_0x04f4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x04f4('0xa'));var querystring=require(_0x04f4('0x10'));var Papa=require(_0x04f4('0x11'));var Redis=require(_0x04f4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x04f4('0x13'));var as=require(_0x04f4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04f4('0x15'))(_0x04f4('0x16'));var utils=require('../../config/utils');var config=require(_0x04f4('0x17'));var licenseUtil=require(_0x04f4('0x18'));var db=require('../../mysqldb')['db'];config[_0x04f4('0x19')]=_['defaults'](config['redis'],{'host':_0x04f4('0x1a'),'port':0x18eb});var socket=require(_0x04f4('0x1b'))(new Redis(config[_0x04f4('0x19')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x04f4('0x1c'));var client=jayson[_0x04f4('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x04f4('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369d23,_0x5e009e,_0x22dfeb,_0x4621dd){return new BPromise(function(_0x2eb71b,_0xbdebc){var _0x272d81=_0x4621dd||client;return _0x272d81[_0x04f4('0x1e')](_0x369d23,_0x22dfeb)['then'](function(_0x588a02){logger[_0x04f4('0x1f')](_0x04f4('0x20'),_0x5e009e,_0x04f4('0x21'));logger[_0x04f4('0x22')](_0x04f4('0x23'),_0x5e009e,_0x04f4('0x21'),JSON['stringify'](_0x588a02));if(_0x588a02[_0x04f4('0x24')]){if(_0x588a02['error'][_0x04f4('0x25')]===0x1f4){logger[_0x04f4('0x24')](_0x04f4('0x20'),_0x5e009e,_0x588a02['error'][_0x04f4('0x26')]);return _0xbdebc(_0x588a02['error'][_0x04f4('0x26')]);}logger[_0x04f4('0x24')]('FaxAccount,\x20%s,\x20%s',_0x5e009e,_0x588a02['error'][_0x04f4('0x26')]);return _0x2eb71b(_0x588a02['error'][_0x04f4('0x26')]);}else{logger[_0x04f4('0x1f')](_0x04f4('0x20'),_0x5e009e,_0x04f4('0x21'));_0x2eb71b(_0x588a02['result']['message']);}})[_0x04f4('0x27')](function(_0x104d7d){logger[_0x04f4('0x24')](_0x04f4('0x20'),_0x5e009e,_0x104d7d);_0xbdebc(_0x104d7d);});});}function respondWithStatusCode(_0x22adb5,_0x2ead7){_0x2ead7=_0x2ead7||0xcc;return function(_0x49af05){if(_0x49af05){return _0x22adb5[_0x04f4('0x28')](_0x2ead7);}return _0x22adb5[_0x04f4('0x29')](_0x2ead7)[_0x04f4('0x2a')]();};}function respondWithResult(_0x5d18db,_0x4139fa){_0x4139fa=_0x4139fa||0xc8;return function(_0xea9663){if(_0xea9663){return _0x5d18db[_0x04f4('0x29')](_0x4139fa)['json'](_0xea9663);}};}function respondWithFilteredResult(_0x4a1f6c,_0x421ff0){return function(_0x20f0e0){if(_0x20f0e0){var _0x546e14=typeof _0x421ff0[_0x04f4('0x2b')]===_0x04f4('0x2c')&&typeof _0x421ff0[_0x04f4('0x2d')]===_0x04f4('0x2c');var _0xc7c8e8=_0x20f0e0[_0x04f4('0x2e')];var _0x3fcdd3=_0x546e14?0x0:_0x421ff0[_0x04f4('0x2b')];var _0x24bc5e=_0x546e14?_0x20f0e0[_0x04f4('0x2e')]:_0x421ff0[_0x04f4('0x2b')]+_0x421ff0[_0x04f4('0x2d')];var _0x4bdd72;if(_0x24bc5e>=_0xc7c8e8){_0x24bc5e=_0xc7c8e8;_0x4bdd72=0xc8;}else{_0x4bdd72=0xce;}_0x4a1f6c['status'](_0x4bdd72);return _0x4a1f6c['set'](_0x04f4('0x2f'),_0x3fcdd3+'-'+_0x24bc5e+'/'+_0xc7c8e8)[_0x04f4('0x30')](_0x20f0e0);}return null;};}function patchUpdates(_0x49f211){return function(_0x4abe99){try{jsonpatch[_0x04f4('0x31')](_0x4abe99,_0x49f211,!![]);}catch(_0x424191){return BPromise[_0x04f4('0x32')](_0x424191);}return _0x4abe99['save']();};}function saveUpdates(_0x4ac161,_0x2d8d4f){return function(_0x544345){if(_0x544345){return _0x544345['update'](_0x4ac161)['then'](function(_0x3033ff){return _0x3033ff;});}return null;};}function removeEntity(_0xa7e95a,_0x4527ed){return function(_0x2a8321){if(_0x2a8321){return _0x2a8321[_0x04f4('0x33')]()['then'](function(){var _0x3ce4d5=_0x2a8321[_0x04f4('0x34')]({'plain':!![]});var _0x28c0ab=_0x04f4('0x35');return db[_0x04f4('0x36')][_0x04f4('0x33')]({'where':{'type':_0x28c0ab,'resourceId':_0x3ce4d5['id']}})[_0x04f4('0x37')](function(){return _0x2a8321;});})[_0x04f4('0x37')](function(){_0xa7e95a[_0x04f4('0x29')](0xcc)[_0x04f4('0x2a')]();});}};}function handleEntityNotFound(_0x3e0515,_0x4d3ff6){return function(_0x3e2763){if(!_0x3e2763){_0x3e0515[_0x04f4('0x28')](0x194);}return _0x3e2763;};}function handleError(_0x493b14,_0x574922){_0x574922=_0x574922||0x1f4;return function(_0x5be55a){logger['error'](_0x5be55a[_0x04f4('0x38')]);if(_0x5be55a[_0x04f4('0x39')]){delete _0x5be55a[_0x04f4('0x39')];}_0x493b14[_0x04f4('0x29')](_0x574922)[_0x04f4('0x3a')](_0x5be55a);};}function getMustacheRender(_0x2f261b,_0x23a047){return Mustache[_0x04f4('0x3b')](_0x2f261b,_['merge'](_0x23a047[_0x04f4('0x3c')],{'contact':_0x23a047[_0x04f4('0x3d')],'message':_0x23a047['message'],'agent':_0x23a047[_0x04f4('0x3e')],'interaction':_0x23a047[_0x04f4('0x3f')],'account':_0x23a047['account']}))||'';}exports[_0x04f4('0x40')]=function(_0x108f52,_0x5e5056){var _0x516fb5={'include':[{'model':db[_0x04f4('0x41')],'as':_0x04f4('0x42')}]},_0x26983b={},_0x21d5c9={'count':0x0,'rows':[]};var _0x1ab905=_[_0x04f4('0x43')](db[_0x04f4('0x44')][_0x04f4('0x45')],function(_0x369f3c){return{'name':_0x369f3c['fieldName'],'type':_0x369f3c[_0x04f4('0x46')][_0x04f4('0x47')]};});_0x26983b[_0x04f4('0x48')]=_[_0x04f4('0x43')](_0x1ab905,_0x04f4('0x39'));_0x26983b[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x108f52[_0x04f4('0x49')]);_0x26983b[_0x04f4('0x4b')]=_['intersection'](_0x26983b[_0x04f4('0x48')],_0x26983b[_0x04f4('0x49')]);_0x516fb5[_0x04f4('0x4c')]=_[_0x04f4('0x4d')](_0x26983b[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x108f52[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x516fb5[_0x04f4('0x4c')]=_0x516fb5[_0x04f4('0x4c')]['length']?_0x516fb5[_0x04f4('0x4c')]:_0x26983b[_0x04f4('0x48')];if(!_0x108f52[_0x04f4('0x49')]['hasOwnProperty']('nolimit')){_0x516fb5[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x108f52[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x516fb5['offset']=qs[_0x04f4('0x2b')](_0x108f52[_0x04f4('0x49')]['offset']);}_0x516fb5[_0x04f4('0x4f')]=qs['sort'](_0x108f52[_0x04f4('0x49')]['sort']);_0x516fb5['where']=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x108f52[_0x04f4('0x49')],_0x26983b['filters']),_0x1ab905);if(_0x108f52[_0x04f4('0x49')][_0x04f4('0x51')]){_0x516fb5[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x516fb5[_0x04f4('0x52')],{'$or':_[_0x04f4('0x43')](_0x1ab905,function(_0xcc39b){if(_0xcc39b[_0x04f4('0x46')]!==_0x04f4('0x54')){var _0x2d4a73={};_0x2d4a73[_0xcc39b[_0x04f4('0x39')]]={'$like':'%'+_0x108f52[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x2d4a73;}})});}_0x516fb5=_[_0x04f4('0x53')]({},_0x516fb5,_0x108f52[_0x04f4('0x55')]);var _0x5b61d0={'where':_0x516fb5[_0x04f4('0x52')]};return db['FaxAccount'][_0x04f4('0x2e')](_0x5b61d0)['then'](function(_0x503977){_0x21d5c9[_0x04f4('0x2e')]=_0x503977;if(_0x108f52['query'][_0x04f4('0x56')]){_0x516fb5[_0x04f4('0x57')]=[{'all':!![]}];}return db[_0x04f4('0x44')][_0x04f4('0x58')](_0x516fb5);})[_0x04f4('0x37')](function(_0x505170){_0x21d5c9['rows']=_0x505170;return _0x21d5c9;})[_0x04f4('0x37')](respondWithFilteredResult(_0x5e5056,_0x516fb5))[_0x04f4('0x27')](handleError(_0x5e5056,null));};exports[_0x04f4('0x59')]=function(_0x8fb198,_0x38b851){var _0x419b47={'raw':![],'where':{'id':_0x8fb198[_0x04f4('0x5a')]['id']},'include':[{'model':db[_0x04f4('0x41')],'as':'mandatoryDispositionPause'}]},_0x48c56c={};_0x48c56c[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db[_0x04f4('0x44')][_0x04f4('0x45')]);_0x48c56c['query']=_[_0x04f4('0x4a')](_0x8fb198[_0x04f4('0x49')]);_0x48c56c[_0x04f4('0x4b')]=_[_0x04f4('0x4d')](_0x48c56c[_0x04f4('0x48')],_0x48c56c[_0x04f4('0x49')]);_0x419b47[_0x04f4('0x4c')]=_['intersection'](_0x48c56c[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x8fb198[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x419b47[_0x04f4('0x4c')]=_0x419b47[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x419b47[_0x04f4('0x4c')]:_0x48c56c['model'];if(_0x8fb198['query'][_0x04f4('0x56')]){_0x419b47[_0x04f4('0x57')]=[{'all':!![]}];}_0x419b47=_[_0x04f4('0x53')]({},_0x419b47,_0x8fb198[_0x04f4('0x55')]);return db[_0x04f4('0x44')][_0x04f4('0x5c')](_0x419b47)[_0x04f4('0x37')](handleEntityNotFound(_0x38b851,null))[_0x04f4('0x37')](respondWithResult(_0x38b851,null))['catch'](handleError(_0x38b851,null));};exports[_0x04f4('0x5d')]=function(_0x574dfa,_0x167d54){return db[_0x04f4('0x44')][_0x04f4('0x5d')](_0x574dfa['body'],{})[_0x04f4('0x37')](function(_0x827236){var _0x7a0d57=_0x574dfa[_0x04f4('0x5e')][_0x04f4('0x34')]({'plain':!![]});if(!_0x7a0d57)throw new Error(_0x04f4('0x5f'));if(_0x7a0d57[_0x04f4('0x60')]===_0x04f4('0x5e')){var _0x577b5d=_0x827236[_0x04f4('0x34')]({'plain':!![]});var _0x42ac92=_0x04f4('0x35');return db[_0x04f4('0x61')][_0x04f4('0x5c')]({'where':{'name':_0x42ac92,'userProfileId':_0x7a0d57[_0x04f4('0x62')]},'raw':!![]})[_0x04f4('0x37')](function(_0x5f3272){if(_0x5f3272&&_0x5f3272[_0x04f4('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x577b5d['name'],'resourceId':_0x577b5d['id'],'type':_0x5f3272[_0x04f4('0x39')],'sectionId':_0x5f3272['id']},{})[_0x04f4('0x37')](function(){return _0x827236;});}else{return _0x827236;}})[_0x04f4('0x27')](function(_0x36c0cf){logger[_0x04f4('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c0cf);throw _0x36c0cf;});}return _0x827236;})[_0x04f4('0x37')](respondWithResult(_0x167d54,0xc9))[_0x04f4('0x27')](handleError(_0x167d54,null));};exports[_0x04f4('0x64')]=function(_0x675c92,_0x3d3f69){if(_0x675c92['body']['id']){delete _0x675c92[_0x04f4('0x3c')]['id'];}return db['FaxAccount'][_0x04f4('0x5c')]({'where':{'id':_0x675c92[_0x04f4('0x5a')]['id']},'include':[{'model':db[_0x04f4('0x41')],'as':_0x04f4('0x42')}]})[_0x04f4('0x37')](handleEntityNotFound(_0x3d3f69,null))['then'](saveUpdates(_0x675c92[_0x04f4('0x3c')],null))[_0x04f4('0x37')](respondWithResult(_0x3d3f69,null))[_0x04f4('0x27')](handleError(_0x3d3f69,null));};exports[_0x04f4('0x33')]=function(_0x4f92cc,_0x341334){return db[_0x04f4('0x44')]['find']({'where':{'id':_0x4f92cc[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x341334,null))['then'](removeEntity(_0x341334,null))[_0x04f4('0x27')](handleError(_0x341334,null));};exports[_0x04f4('0x65')]=function(_0x3d96f8,_0x3e78c5){return db[_0x04f4('0x44')][_0x04f4('0x65')]()[_0x04f4('0x37')](respondWithResult(_0x3e78c5,null))['catch'](handleError(_0x3e78c5,null));};exports[_0x04f4('0x66')]=function(_0x256c58,_0x41e149,_0x391e66){if(_0x256c58[_0x04f4('0x3c')]['id']){delete _0x256c58[_0x04f4('0x3c')]['id'];}return db[_0x04f4('0x44')]['find']({'where':{'id':_0x256c58[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x41e149,null))[_0x04f4('0x37')](function(_0xb18e03){if(_0xb18e03){_0x256c58[_0x04f4('0x3c')][_0x04f4('0x67')]=_0xb18e03['id'];return db[_0x04f4('0x68')][_0x04f4('0x5d')](_0x256c58['body']);}})['then'](respondWithResult(_0x41e149,null))[_0x04f4('0x27')](handleError(_0x41e149,null));};exports[_0x04f4('0x69')]=function(_0x3e0710,_0x99cda5,_0x2359d3){var _0x191fee={'raw':![],'where':{}};var _0x1f109c={};var _0x2df3dd={'count':0x0,'rows':[]};return db[_0x04f4('0x44')]['findOne']({'where':{'id':_0x3e0710[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x99cda5,null))[_0x04f4('0x37')](function(_0x264cca){if(_0x264cca){_0x1f109c[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db['Disposition'][_0x04f4('0x45')]);_0x1f109c[_0x04f4('0x49')]=_['keys'](_0x3e0710[_0x04f4('0x49')]);_0x1f109c[_0x04f4('0x4b')]=_[_0x04f4('0x4d')](_0x1f109c[_0x04f4('0x48')],_0x1f109c[_0x04f4('0x49')]);_0x191fee[_0x04f4('0x4c')]=_[_0x04f4('0x4d')](_0x1f109c['model'],qs[_0x04f4('0x4e')](_0x3e0710[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x191fee['attributes']=_0x191fee[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x191fee[_0x04f4('0x4c')]:_0x1f109c[_0x04f4('0x48')];if(!_0x3e0710[_0x04f4('0x49')]['hasOwnProperty']('nolimit')){_0x191fee[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x3e0710['query'][_0x04f4('0x2d')]);_0x191fee[_0x04f4('0x2b')]=qs['offset'](_0x3e0710[_0x04f4('0x49')]['offset']);}_0x191fee['order']=qs[_0x04f4('0x6a')](_0x3e0710['query'][_0x04f4('0x6a')]);_0x191fee['where']=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x3e0710[_0x04f4('0x49')],_0x1f109c[_0x04f4('0x4b')]));_0x191fee[_0x04f4('0x52')][_0x04f4('0x67')]=_0x264cca['id'];if(_0x3e0710[_0x04f4('0x49')][_0x04f4('0x51')]){_0x191fee[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x191fee['where'],{'$or':_['map'](_0x191fee['attributes'],function(_0x118513){var _0x282c14={};_0x282c14[_0x118513]={'$like':'%'+_0x3e0710[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x282c14;})});}_0x191fee=_['merge']({},_0x191fee,_0x3e0710[_0x04f4('0x55')]);return db[_0x04f4('0x68')][_0x04f4('0x2e')]({'where':_0x191fee['where']})[_0x04f4('0x37')](function(_0x5daf8f){_0x2df3dd[_0x04f4('0x2e')]=_0x5daf8f;if(_0x3e0710[_0x04f4('0x49')][_0x04f4('0x56')]){_0x191fee[_0x04f4('0x57')]=[{'all':!![]}];}return db[_0x04f4('0x68')]['findAll'](_0x191fee);})[_0x04f4('0x37')](function(_0x5ce488){_0x2df3dd[_0x04f4('0x6b')]=_0x5ce488;return _0x2df3dd;});}})[_0x04f4('0x37')](respondWithFilteredResult(_0x99cda5,_0x191fee))[_0x04f4('0x27')](handleError(_0x99cda5,null));};exports['removeDispositions']=function(_0x4721f0,_0x1c0a80,_0x46435b){return db[_0x04f4('0x44')][_0x04f4('0x5c')]({'where':{'id':_0x4721f0[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1c0a80,null))[_0x04f4('0x37')](function(_0x2f2cfa){if(_0x2f2cfa){return _0x2f2cfa['removeDispositions'](_0x4721f0['query'][_0x04f4('0x6c')]);}})[_0x04f4('0x37')](respondWithStatusCode(_0x1c0a80,null))[_0x04f4('0x27')](handleError(_0x1c0a80,null));};exports[_0x04f4('0x6d')]=function(_0x13c3a9,_0x53316a,_0x245b8d){if(_0x13c3a9[_0x04f4('0x3c')]['id']){delete _0x13c3a9[_0x04f4('0x3c')]['id'];}return db[_0x04f4('0x44')]['find']({'where':{'id':_0x13c3a9[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x53316a,null))[_0x04f4('0x37')](function(_0x1b7c24){if(_0x1b7c24){_0x13c3a9[_0x04f4('0x3c')][_0x04f4('0x67')]=_0x1b7c24['id'];return db[_0x04f4('0x6e')][_0x04f4('0x5d')](_0x13c3a9[_0x04f4('0x3c')]);}})[_0x04f4('0x37')](respondWithResult(_0x53316a,null))[_0x04f4('0x27')](handleError(_0x53316a,null));};exports[_0x04f4('0x6f')]=function(_0x5b446b,_0x332518,_0x5da121){var _0x402676={'raw':![],'where':{}};var _0x416ab2={};var _0x197b8a={'count':0x0,'rows':[]};return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x5b446b[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x332518,null))[_0x04f4('0x37')](function(_0x28bcaf){if(_0x28bcaf){_0x416ab2[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db[_0x04f4('0x6e')][_0x04f4('0x45')]);_0x416ab2[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x5b446b[_0x04f4('0x49')]);_0x416ab2['filters']=_['intersection'](_0x416ab2[_0x04f4('0x48')],_0x416ab2['query']);_0x402676['attributes']=_[_0x04f4('0x4d')](_0x416ab2[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x5b446b['query'][_0x04f4('0x4e')]));_0x402676[_0x04f4('0x4c')]=_0x402676[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x402676[_0x04f4('0x4c')]:_0x416ab2[_0x04f4('0x48')];if(!_0x5b446b['query'][_0x04f4('0x71')](_0x04f4('0x72'))){_0x402676[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x5b446b[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x402676[_0x04f4('0x2b')]=qs[_0x04f4('0x2b')](_0x5b446b['query'][_0x04f4('0x2b')]);}_0x402676[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x5b446b[_0x04f4('0x49')][_0x04f4('0x6a')]);_0x402676[_0x04f4('0x52')]=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x5b446b['query'],_0x416ab2[_0x04f4('0x4b')]));_0x402676[_0x04f4('0x52')][_0x04f4('0x67')]=_0x28bcaf['id'];if(_0x5b446b['query']['filter']){_0x402676[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x402676[_0x04f4('0x52')],{'$or':_['map'](_0x402676['attributes'],function(_0x3afc2c){var _0x131583={};_0x131583[_0x3afc2c]={'$like':'%'+_0x5b446b[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x131583;})});}_0x402676=_[_0x04f4('0x53')]({},_0x402676,_0x5b446b[_0x04f4('0x55')]);return db[_0x04f4('0x6e')]['count']({'where':_0x402676[_0x04f4('0x52')]})[_0x04f4('0x37')](function(_0x4f0b69){_0x197b8a[_0x04f4('0x2e')]=_0x4f0b69;if(_0x5b446b['query']['includeAll']){_0x402676[_0x04f4('0x57')]=[{'all':!![]}];}return db[_0x04f4('0x6e')][_0x04f4('0x58')](_0x402676);})[_0x04f4('0x37')](function(_0x394cdd){_0x197b8a[_0x04f4('0x6b')]=_0x394cdd;return _0x197b8a;});}})[_0x04f4('0x37')](respondWithFilteredResult(_0x332518,_0x402676))[_0x04f4('0x27')](handleError(_0x332518,null));};exports[_0x04f4('0x73')]=function(_0x4c2950,_0x29bd2e,_0xbe4ddd){return db['FaxAccount']['find']({'where':{'id':_0x4c2950['params']['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x29bd2e,null))[_0x04f4('0x37')](function(_0x2ecaca){if(_0x2ecaca){return _0x2ecaca[_0x04f4('0x73')](_0x4c2950[_0x04f4('0x49')][_0x04f4('0x6c')]);}})['then'](respondWithStatusCode(_0x29bd2e,null))['catch'](handleError(_0x29bd2e,null));};exports[_0x04f4('0x74')]=function(_0x2d972c,_0x11c757,_0x1a0c07){return db[_0x04f4('0x75')][_0x04f4('0x5c')]({'where':{'id':_0x2d972c[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x11c757,null))[_0x04f4('0x37')](function(_0x5165fb){if(_0x5165fb){return _0x5165fb['addInteraction'](_0x2d972c[_0x04f4('0x3c')]['ids'],_[_0x04f4('0x76')](_0x2d972c[_0x04f4('0x3c')],['ids','id'])||{});}})[_0x04f4('0x37')](respondWithResult(_0x11c757,null))[_0x04f4('0x27')](handleError(_0x11c757,null));};exports[_0x04f4('0x77')]=function(_0x377cd3,_0x388f86,_0x5e7a80){var _0x36af06={'raw':![],'where':{}};var _0x3827c1={};var _0x4fcf2b={'count':0x0,'rows':[]};return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x377cd3[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x388f86,null))[_0x04f4('0x37')](function(_0x3bade4){if(_0x3bade4){_0x3827c1[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db['FaxInteraction']['rawAttributes']);_0x3827c1[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x377cd3[_0x04f4('0x49')]);_0x3827c1[_0x04f4('0x4b')]=_['intersection'](_0x3827c1[_0x04f4('0x48')],_0x3827c1['query']);_0x36af06[_0x04f4('0x4c')]=_['intersection'](_0x3827c1[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x377cd3[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x36af06['attributes']=_0x36af06[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x36af06['attributes']:_0x3827c1['model'];if(!_0x377cd3['query'][_0x04f4('0x71')](_0x04f4('0x72'))){_0x36af06[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x377cd3['query'][_0x04f4('0x2d')]);_0x36af06[_0x04f4('0x2b')]=qs['offset'](_0x377cd3[_0x04f4('0x49')][_0x04f4('0x2b')]);}_0x36af06[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x377cd3['query']['sort']);_0x36af06[_0x04f4('0x52')]=qs['filters'](_[_0x04f4('0x50')](_0x377cd3['query'],_0x3827c1['filters']));_0x36af06[_0x04f4('0x52')][_0x04f4('0x67')]=_0x3bade4['id'];if(_0x377cd3[_0x04f4('0x49')][_0x04f4('0x51')]){_0x36af06[_0x04f4('0x52')]=_['merge'](_0x36af06['where'],{'$or':_[_0x04f4('0x43')](_0x36af06[_0x04f4('0x4c')],function(_0x2c093e){var _0x4f061a={};_0x4f061a[_0x2c093e]={'$like':'%'+_0x377cd3['query'][_0x04f4('0x51')]+'%'};return _0x4f061a;})});}_0x36af06=_[_0x04f4('0x53')]({},_0x36af06,_0x377cd3[_0x04f4('0x55')]);return db['FaxInteraction'][_0x04f4('0x2e')]({'where':_0x36af06[_0x04f4('0x52')]})[_0x04f4('0x37')](function(_0x12b320){_0x4fcf2b['count']=_0x12b320;if(_0x377cd3[_0x04f4('0x49')][_0x04f4('0x56')]){_0x36af06[_0x04f4('0x57')]=[{'model':db[_0x04f4('0x78')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x04f4('0x79'),'attributes':[_0x04f4('0x39'),_0x04f4('0x7a'),_0x04f4('0x7b')],'required':![]},{'model':db[_0x04f4('0x7c')],'as':'Tags','attributes':['id',_0x04f4('0x39'),'color'],'where':_0x377cd3[_0x04f4('0x49')][_0x04f4('0x7d')]?{'id':_0x377cd3[_0x04f4('0x49')][_0x04f4('0x7d')]}:undefined,'required':_0x377cd3[_0x04f4('0x49')][_0x04f4('0x7d')]?!![]:![]}];}return db[_0x04f4('0x75')]['findAll'](_0x36af06);})['then'](function(_0xf67122){_0x4fcf2b[_0x04f4('0x6b')]=_0xf67122;return _0x4fcf2b;});}})[_0x04f4('0x37')](respondWithFilteredResult(_0x388f86,_0x36af06))['catch'](handleError(_0x388f86,null));};exports[_0x04f4('0x7e')]=function(_0x4c86f5,_0x5976e2,_0x3ff69f){return db[_0x04f4('0x44')]['findOne']({'where':{'id':_0x4c86f5[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x5976e2,null))[_0x04f4('0x37')](function(_0x55f6f7){if(_0x55f6f7){return db[_0x04f4('0x7f')][_0x04f4('0x80')](function(_0x14639c){return db[_0x04f4('0x81')][_0x04f4('0x33')]({'where':{'FaxAccountId':_0x4c86f5[_0x04f4('0x5a')]['id']},'transaction':_0x14639c})[_0x04f4('0x37')](function(_0x58ce2d){var _0x1478a3=_['map'](_0x4c86f5[_0x04f4('0x3c')],function(_0x413e4e){_0x413e4e[_0x04f4('0x67')]=_0x4c86f5[_0x04f4('0x5a')]['id'];return _0x413e4e;});return db[_0x04f4('0x81')][_0x04f4('0x82')](_0x1478a3,{'transaction':_0x14639c});});})[_0x04f4('0x37')](function(){return db[_0x04f4('0x81')][_0x04f4('0x83')]({'where':{'FaxAccountId':_0x4c86f5[_0x04f4('0x5a')]['id']},'order':_0x04f4('0x84')});});}})[_0x04f4('0x37')](respondWithResult(_0x5976e2,null))['catch'](handleError(_0x5976e2,null));};exports[_0x04f4('0x85')]=function(_0x5c9bf1,_0x1907dd,_0x23cebd){var _0x312b03={};var _0x24915c={};var _0x5605e6;var _0x3f49a2;return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x5c9bf1[_0x04f4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1907dd,null))[_0x04f4('0x37')](function(_0x2cf664){if(_0x2cf664){_0x5605e6=_0x2cf664;_0x24915c['model']=_[_0x04f4('0x4a')](db[_0x04f4('0x81')][_0x04f4('0x45')]);_0x24915c[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x5c9bf1[_0x04f4('0x49')]);_0x24915c[_0x04f4('0x4b')]=_['intersection'](_0x24915c[_0x04f4('0x48')],_0x24915c[_0x04f4('0x49')]);_0x312b03[_0x04f4('0x4c')]=_['intersection'](_0x24915c[_0x04f4('0x48')],qs['fields'](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x312b03[_0x04f4('0x4c')]=_0x312b03['attributes'][_0x04f4('0x5b')]?_0x312b03[_0x04f4('0x4c')]:_0x24915c[_0x04f4('0x48')];_0x312b03[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x6a')]);_0x312b03[_0x04f4('0x52')]=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x5c9bf1[_0x04f4('0x49')],_0x24915c[_0x04f4('0x4b')]));if(_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x51')]){_0x312b03['where']=_['merge'](_0x312b03['where'],{'$or':_[_0x04f4('0x43')](_0x312b03[_0x04f4('0x4c')],function(_0x3d4a41){var _0x975be={};_0x975be[_0x3d4a41]={'$like':'%'+_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x975be;})});}_0x312b03=_['merge']({},_0x312b03,_0x5c9bf1[_0x04f4('0x55')]);return _0x5605e6[_0x04f4('0x85')](_0x312b03);}})[_0x04f4('0x37')](function(_0x2815a6){if(_0x2815a6){_0x3f49a2=_0x2815a6[_0x04f4('0x5b')];if(!_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x71')](_0x04f4('0x72'))){_0x312b03[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x312b03[_0x04f4('0x2b')]=qs[_0x04f4('0x2b')](_0x5c9bf1[_0x04f4('0x49')][_0x04f4('0x2b')]);}return _0x5605e6[_0x04f4('0x85')](_0x312b03);}})[_0x04f4('0x37')](function(_0x454b94){if(_0x454b94){return _0x454b94?{'count':_0x3f49a2,'rows':_0x454b94}:null;}})[_0x04f4('0x37')](respondWithResult(_0x1907dd,null))[_0x04f4('0x27')](handleError(_0x1907dd,null));};function Extension(_0x4c4682,_0xf83887,_0x4f30fe,_0x3807d4){this[_0x04f4('0x86')]=_0x04f4('0x87');this[_0x04f4('0x88')]=_0x4c4682[_0x04f4('0x89')];this[_0x04f4('0x8a')]=_0x3807d4;this[_0x04f4('0x46')]=_0x04f4('0x8b');this[_0x04f4('0x8c')]=_0x04f4('0x8d');this['FaxAccountId']=_0x4c4682['id'];this[_0x04f4('0x84')]=_0xf83887;this[_0x04f4('0x8e')]=_0x4f30fe;}function createExtensionsReciveFax(_0xdb825c){var _0x8feae=0x1;var _0x53f414=[];_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,'',_0x04f4('0x90')));_0x8feae+=0x1;_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,_0x04f4('0x91'),_0x04f4('0x92')));_0x8feae+=0x1;for(var _0x427a1a in _0xdb825c){if(_0xdb825c[_0x04f4('0x71')](_0x427a1a)&&(_0x427a1a===_0x04f4('0x93')||_0x427a1a==='localstationid'||_0x427a1a===_0x04f4('0x94')||_0x427a1a===_0x04f4('0x95')||_0x427a1a===_0x04f4('0x96')||_0x427a1a===_0x04f4('0x97')||_0x427a1a===_0x04f4('0x98')||_0x427a1a===_0x04f4('0x99')||_0x427a1a===_0x04f4('0x9a'))){_0x53f414['push'](new Extension(_0xdb825c,_0x8feae,_0x04f4('0x9b')+_0x427a1a+')='+_0xdb825c[_0x427a1a],_0x04f4('0x92')));_0x8feae+=0x1;}}_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,'6',_0x04f4('0x9c')));_0x8feae+=0x1;_0x53f414[_0x04f4('0x8f')](new Extension(_0xdb825c,_0x8feae,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0x04f4('0x9d')));_0x8feae=0x0;return _0x53f414;}exports[_0x04f4('0x9e')]=function(_0x41e7e9,_0x2f95c5,_0x4bf429){var _0x1b14fa;return db[_0x04f4('0x7f')][_0x04f4('0x80')](function(_0x2020c3){return db[_0x04f4('0x44')][_0x04f4('0x5d')](_0x41e7e9['body'],{'transaction':_0x2020c3})[_0x04f4('0x37')](function(_0x1a64a9){_0x1b14fa=_0x1a64a9[_0x04f4('0x34')]({'plain':!![]});return db['VoiceExtension'][_0x04f4('0x82')](createExtensionsReciveFax(_0x1b14fa),{'transaction':_0x2020c3});});})['then'](function(){return _0x1b14fa;})[_0x04f4('0x37')](respondWithResult(_0x2f95c5,null))[_0x04f4('0x27')](handleError(_0x2f95c5,null));};exports[_0x04f4('0x9f')]=function(_0xb6382,_0x480883,_0x106397){var _0xed9e53;return db['sequelize'][_0x04f4('0x80')](function(_0x51d64b){return db[_0x04f4('0x44')][_0x04f4('0x64')](_0xb6382[_0x04f4('0x3c')],{'where':{'id':_0xb6382[_0x04f4('0x3c')]['id']},'transaction':_0x51d64b})[_0x04f4('0x37')](function(_0x1d8e20){return db[_0x04f4('0xa0')]['destroy']({'where':{'FaxAccountId':_0xb6382['body']['id']},'transaction':_0x51d64b})[_0x04f4('0x37')](function(_0x47c18a){return db[_0x04f4('0xa0')][_0x04f4('0x82')](createExtensionsReciveFax(_[_0x04f4('0x76')](_0xb6382[_0x04f4('0x3c')],['tech',_0x04f4('0x47'),_0x04f4('0xa1'),_0x04f4('0xa2'),_0x04f4('0xa3'),_0x04f4('0xa4')])),{'transaction':_0x51d64b});});});})[_0x04f4('0x37')](function(){return db['FaxAccount']['findById'](_0xb6382['body']['id']);})[_0x04f4('0x37')](respondWithResult(_0x480883,null))[_0x04f4('0x27')](handleError(_0x480883,null));};exports[_0x04f4('0xa5')]=function(_0x547541,_0x2819e7,_0x149a01){var _0x52dbca={'raw':!![],'where':{}};var _0x155403={};var _0x383a80={'count':0x0,'rows':[]};return db[_0x04f4('0x44')][_0x04f4('0x70')]({'where':{'id':_0x547541[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x2819e7,null))[_0x04f4('0x37')](function(_0x35a3d0){if(_0x35a3d0){_0x155403[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db[_0x04f4('0xa6')][_0x04f4('0x45')]);_0x155403['query']=_[_0x04f4('0x4a')](_0x547541[_0x04f4('0x49')]);_0x155403[_0x04f4('0x4b')]=_['intersection'](_0x155403[_0x04f4('0x48')],_0x155403['query']);_0x52dbca['attributes']=_[_0x04f4('0x4d')](_0x155403[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x547541['query']['fields']));_0x52dbca[_0x04f4('0x4c')]=_0x52dbca[_0x04f4('0x4c')][_0x04f4('0x5b')]?_0x52dbca[_0x04f4('0x4c')]:_0x155403['model'];if(!_0x547541[_0x04f4('0x49')][_0x04f4('0x71')](_0x04f4('0x72'))){_0x52dbca[_0x04f4('0x2d')]=qs['limit'](_0x547541['query'][_0x04f4('0x2d')]);_0x52dbca['offset']=qs[_0x04f4('0x2b')](_0x547541[_0x04f4('0x49')][_0x04f4('0x2b')]);}_0x52dbca[_0x04f4('0x4f')]=qs[_0x04f4('0x6a')](_0x547541[_0x04f4('0x49')][_0x04f4('0x6a')]);_0x52dbca[_0x04f4('0x52')]=qs['filters'](_['pick'](_0x547541[_0x04f4('0x49')],_0x155403[_0x04f4('0x4b')]));_0x52dbca[_0x04f4('0x52')][_0x04f4('0x67')]=_0x35a3d0['id'];if(_0x547541[_0x04f4('0x49')][_0x04f4('0x51')]){_0x52dbca['where']=_[_0x04f4('0x53')](_0x52dbca[_0x04f4('0x52')],{'$or':_[_0x04f4('0x43')](_0x52dbca[_0x04f4('0x4c')],function(_0x136d31){var _0x364d17={};_0x364d17[_0x136d31]={'$like':'%'+_0x547541[_0x04f4('0x49')][_0x04f4('0x51')]+'%'};return _0x364d17;})});}if(_0x547541['query'][_0x04f4('0xa7')]){var _0x253d59=_0x547541[_0x04f4('0x49')][_0x04f4('0xa7')][_0x04f4('0xa8')](',');var _0x133187={};_0x133187[_0x253d59[0x0]]={'$gte':moment(_0x253d59[0x1])[_0x04f4('0xa9')](_0x04f4('0xaa'))};_0x52dbca[_0x04f4('0x52')]=_[_0x04f4('0x53')](_0x52dbca[_0x04f4('0x52')],_0x133187);}_0x52dbca=_['merge']({},_0x52dbca,_0x547541[_0x04f4('0x55')]);return db[_0x04f4('0xa6')][_0x04f4('0x2e')]({'where':_0x52dbca[_0x04f4('0x52')]})[_0x04f4('0x37')](function(_0x295c72){_0x383a80[_0x04f4('0x2e')]=_0x295c72;if(_0x547541['query'][_0x04f4('0x56')]){_0x52dbca[_0x04f4('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0x04f4('0x58')](_0x52dbca);})[_0x04f4('0x37')](function(_0x1bb167){_0x383a80[_0x04f4('0x6b')]=_0x1bb167;return _0x383a80;});}})['then'](respondWithFilteredResult(_0x2819e7,_0x52dbca))[_0x04f4('0x27')](handleError(_0x2819e7,null));};exports[_0x04f4('0x3a')]=function(_0x4502cd,_0x2c84e4,_0x4bb62e){var _0x368cfa,_0x5bd1f7={},_0x221cfd;if(_0x4502cd[_0x04f4('0x3c')]['to']){_0x221cfd=_0x4502cd[_0x04f4('0x3c')]['to'][0x0];}return db[_0x04f4('0x44')][_0x04f4('0x5c')]({'where':{'id':_0x4502cd[_0x04f4('0x5a')]['id']},'include':[{'model':db[_0x04f4('0xab')],'as':'List','include':[{'model':db[_0x04f4('0x78')],'as':_0x04f4('0xac'),'where':{'fax':_0x221cfd},'limit':0x1,'order':[['updatedAt',_0x04f4('0xad')]]}]}]})[_0x04f4('0x37')](handleEntityNotFound(_0x2c84e4,null))[_0x04f4('0x37')](function(_0x1108ef){_0x368cfa=_0x1108ef;if(_0x4502cd[_0x04f4('0x3c')]['attachments']&&_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0x04f4('0x5b')]){for(var _0xcb9458=0x0;_0xcb9458<_0x4502cd[_0x04f4('0x3c')]['attachments']['length'];_0xcb9458+=0x1){_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0xcb9458]={'filename':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0xcb9458][_0x04f4('0x39')],'id':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][_0xcb9458]['id'],'path':path[_0x04f4('0xaf')](config[_0x04f4('0xb0')],'server/files/attachments',_0x4502cd[_0x04f4('0x3c')]['attachments'][_0xcb9458]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x04f4('0xb1'),{'FaxAccountId':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x5a')]['id'])?undefined:_0x4502cd['params']['id'],'path':_[_0x04f4('0xb2')](_0x4502cd['body'][_0x04f4('0xae')][0x0][_0x04f4('0x8')])?undefined:_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0][_0x04f4('0x8')],'fax':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x3c')]['to'][0x0])?undefined:_0x4502cd['body']['to'][0x0]},client9002);})[_0x04f4('0x37')](function(){if(_0x368cfa){if(_['isNil'](_0x4502cd['body'][_0x04f4('0xb3')])){_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xb3')]=util['format']('\x22%s\x22\x20<%s>',_0x368cfa['name'],_0x368cfa[_0x04f4('0xb4')]);}if(_0x368cfa['List']){if(_0x368cfa['List'][_0x04f4('0xac')][_0x04f4('0x5b')]){return _0x368cfa['List']['Contacts'][0x0];}else{return db[_0x04f4('0x78')][_0x04f4('0x5d')](_[_0x04f4('0xb5')](_0x4502cd['body'],{'firstName':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'phone':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'fax':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'ListId':_0x368cfa[_0x04f4('0xa4')]}));}}else{throw new Error(_0x04f4('0xb6'));}}else{throw new Error(_0x04f4('0xb7'));}})['then'](function(_0xd6d23){if(_0xd6d23){return db[_0x04f4('0x75')][_0x04f4('0x5c')]({'where':{'ContactId':_0xd6d23['id'],'closed':![],'FaxAccountId':_0x368cfa['id']}})[_0x04f4('0x37')](function(_0x2c149e){if(_0x2c149e){return[_0x2c149e,![]];}return db[_0x04f4('0x75')][_0x04f4('0x5d')]({'UserId':_0x4502cd[_0x04f4('0x5e')]['id'],'ContactId':_0xd6d23['id'],'FaxAccountId':_0x368cfa['id'],'fax':_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'firstMsgDirection':_0x04f4('0xb8'),'Messages':[_['merge'](_0x4502cd[_0x04f4('0x3c')],{'read':![],'body':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0][_0x04f4('0xb9')],'FaxAccountId':_0x368cfa['id'],'UserId':_0x4502cd[_0x04f4('0x5e')]['id'],'ContactId':_0xd6d23['id'],'AttachmentId':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x04f4('0xa6')],'as':_0x04f4('0xba')}]})['then'](function(_0x3761ed){return[_0x3761ed,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5edd28,_0x2868b6){if(_0x2868b6){return _0x5edd28;}return db[_0x04f4('0xa6')][_0x04f4('0x5d')]({'direction':'out','read':![],'body':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0][_0x04f4('0xb9')],'FaxAccountId':_0x368cfa['id'],'FaxInteractionId':_0x5edd28['id'],'UserId':_0x4502cd['user']['id'],'ContactId':_0x5edd28[_0x04f4('0xbb')],'AttachmentId':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['id']})[_0x04f4('0x37')](function(_0x232d31){_0x5edd28['dataValues']['Messages']=[];_0x5edd28[_0x04f4('0xbc')][_0x04f4('0xba')]['push'](_0x232d31[_0x04f4('0xbc')]);return _0x5edd28;});})['then'](function(_0x1ea3b3){respondWithRpcPromise(_0x04f4('0xbd'),_0x04f4('0xbd'),{'FaxAccountId':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x5a')]['id'])?undefined:_0x4502cd[_0x04f4('0x5a')]['id'],'path':_[_0x04f4('0xb2')](_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['path'])?undefined:_0x4502cd['body']['attachments'][0x0][_0x04f4('0x8')],'fax':_[_0x04f4('0xb2')](_0x4502cd['body']['to'][0x0])?undefined:_0x4502cd[_0x04f4('0x3c')]['to'][0x0],'AttachmentId':_0x4502cd[_0x04f4('0x3c')][_0x04f4('0xae')][0x0]['id']},client9002)[_0x04f4('0x37')](function(_0x10428f){logger['info'](_0x04f4('0xbe'),_0x10428f);})[_0x04f4('0x27')](function(_0x420cc6){logger[_0x04f4('0x1f')]('SendFaxRpc,\x20%s',_0x420cc6);});return _0x1ea3b3;})['then'](respondWithResult(_0x2c84e4,null))[_0x04f4('0x27')](handleError(_0x2c84e4,null));};exports['addAgents']=function(_0x2f68df,_0x36a6d8,_0x487e8a){return db[_0x04f4('0x44')][_0x04f4('0x5c')]({'where':{'id':_0x2f68df[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x36a6d8,null))['then'](function(_0x2a6da1){if(_0x2a6da1){return _0x2a6da1['addAgents'](_0x2f68df[_0x04f4('0x3c')]['ids'],_[_0x04f4('0x76')](_0x2f68df[_0x04f4('0x3c')],[_0x04f4('0x6c'),'id'])||{})[_0x04f4('0xbf')](function(_0x2f07cc){for(var _0x17bc1a=0x0;_0x17bc1a<_0x2f68df[_0x04f4('0x3c')][_0x04f4('0x6c')][_0x04f4('0x5b')];_0x17bc1a+=0x1){socket['emit'](_0x04f4('0xc0'),{'UserId':_0x2f68df[_0x04f4('0x3c')][_0x04f4('0x6c')][_0x17bc1a],'FaxAccountId':_0x2f68df[_0x04f4('0x5a')]['id']});}return _0x2f07cc;});}})['then'](respondWithResult(_0x36a6d8,null))['catch'](handleError(_0x36a6d8,null));};exports['removeAgents']=function(_0x37e8c9,_0x1d0e7f,_0x2daf3a){return db['FaxAccount'][_0x04f4('0x5c')]({'where':{'id':_0x37e8c9[_0x04f4('0x5a')]['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x1d0e7f,null))['then'](function(_0x37aeff){if(_0x37aeff){return _0x37aeff['removeAgents'](_0x37e8c9['query'][_0x04f4('0x6c')])[_0x04f4('0x37')](function(){if(_[_0x04f4('0xc1')](_0x37e8c9[_0x04f4('0x49')][_0x04f4('0x6c')])){for(var _0x5bf4ad=0x0;_0x5bf4ad<_0x37e8c9[_0x04f4('0x49')][_0x04f4('0x6c')]['length'];_0x5bf4ad+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x37e8c9[_0x04f4('0x49')][_0x04f4('0x6c')][_0x5bf4ad]),'FaxAccountId':Number(_0x37e8c9[_0x04f4('0x5a')]['id'])});}}else{socket[_0x04f4('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x37e8c9[_0x04f4('0x49')]['ids']),'FaxAccountId':Number(_0x37e8c9[_0x04f4('0x5a')]['id'])});}});}})[_0x04f4('0x37')](respondWithStatusCode(_0x1d0e7f,null))['catch'](handleError(_0x1d0e7f,null));};exports[_0x04f4('0xc3')]=function(_0x3c75ea,_0x3a28f5,_0xaa8306){var _0x4a6c0e={};var _0x3197d0={};var _0x18494d;var _0x4b1c86;return db['FaxAccount']['findOne']({'where':{'id':_0x3c75ea['params']['id']}})[_0x04f4('0x37')](handleEntityNotFound(_0x3a28f5,null))['then'](function(_0x4dea5e){if(_0x4dea5e){_0x18494d=_0x4dea5e;_0x3197d0[_0x04f4('0x48')]=_[_0x04f4('0x4a')](db['User'][_0x04f4('0x45')]);_0x3197d0[_0x04f4('0x49')]=_[_0x04f4('0x4a')](_0x3c75ea[_0x04f4('0x49')]);_0x3197d0[_0x04f4('0x4b')]=_[_0x04f4('0x4d')](_0x3197d0[_0x04f4('0x48')],_0x3197d0[_0x04f4('0x49')]);_0x4a6c0e[_0x04f4('0x4c')]=_[_0x04f4('0x4d')](_0x3197d0[_0x04f4('0x48')],qs[_0x04f4('0x4e')](_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x4e')]));_0x4a6c0e[_0x04f4('0x4c')]=_0x4a6c0e[_0x04f4('0x4c')]['length']?_0x4a6c0e[_0x04f4('0x4c')]:_0x3197d0[_0x04f4('0x48')];_0x4a6c0e[_0x04f4('0x4f')]=qs['sort'](_0x3c75ea['query'][_0x04f4('0x6a')]);_0x4a6c0e[_0x04f4('0x52')]=qs[_0x04f4('0x4b')](_[_0x04f4('0x50')](_0x3c75ea[_0x04f4('0x49')],_0x3197d0[_0x04f4('0x4b')]));if(_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x51')]){_0x4a6c0e['where']=_[_0x04f4('0x53')](_0x4a6c0e[_0x04f4('0x52')],{'$or':_[_0x04f4('0x43')](_0x4a6c0e['attributes'],function(_0x5c89d8){var _0x535dc0={};_0x535dc0[_0x5c89d8]={'$like':'%'+_0x3c75ea['query'][_0x04f4('0x51')]+'%'};return _0x535dc0;})});}_0x4a6c0e=_[_0x04f4('0x53')]({},_0x4a6c0e,_0x3c75ea[_0x04f4('0x55')]);return _0x18494d['getAgents'](_0x4a6c0e);}})[_0x04f4('0x37')](function(_0x48b33a){if(_0x48b33a){_0x4b1c86=_0x48b33a[_0x04f4('0x5b')];if(!_0x3c75ea[_0x04f4('0x49')]['hasOwnProperty'](_0x04f4('0x72'))){_0x4a6c0e[_0x04f4('0x2d')]=qs[_0x04f4('0x2d')](_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x2d')]);_0x4a6c0e[_0x04f4('0x2b')]=qs['offset'](_0x3c75ea[_0x04f4('0x49')][_0x04f4('0x2b')]);}return _0x18494d[_0x04f4('0xc3')](_0x4a6c0e);}})[_0x04f4('0x37')](function(_0x1cddf0){if(_0x1cddf0){return _0x1cddf0?{'count':_0x4b1c86,'rows':_0x1cddf0}:null;}})['then'](respondWithResult(_0x3a28f5,null))[_0x04f4('0x27')](handleError(_0x3a28f5,null));}; \ No newline at end of file +var _0x1034=['key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','FaxAccount','includeAll','include','rows','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','options','removeDispositions','ids','addAnswer','CannedAnswer','findOne','order','findAll','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','fullname','Tag','color','tag','addApplications','FaxApplication','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','sequelize','transaction','VoiceExtension','bulkCreate','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','Contacts','List\x20not\x20found','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','send','render','body','agent','interaction','account','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1034,0x138));var _0x4103=function(_0x5f5af5,_0x3d7577){_0x5f5af5=_0x5f5af5-0x0;var _0x39ef06=_0x1034[_0x5f5af5];return _0x39ef06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4103('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4103('0x1'));var moment=require(_0x4103('0x2'));var BPromise=require(_0x4103('0x3'));var Mustache=require(_0x4103('0x4'));var util=require(_0x4103('0x5'));var path=require('path');var sox=require(_0x4103('0x6'));var csv=require(_0x4103('0x7'));var ejs=require(_0x4103('0x8'));var fs=require('fs');var fs_extra=require(_0x4103('0x9'));var _=require(_0x4103('0xa'));var squel=require(_0x4103('0xb'));var crypto=require(_0x4103('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4103('0xd'));var Redis=require(_0x4103('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4103('0xf'));var hardwareService=require(_0x4103('0x10'));var logger=require(_0x4103('0x11'))(_0x4103('0x12'));var utils=require(_0x4103('0x13'));var config=require(_0x4103('0x14'));var licenseUtil=require(_0x4103('0x15'));var db=require(_0x4103('0x16'))['db'];config[_0x4103('0x17')]=_[_0x4103('0x18')](config[_0x4103('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x4103('0x19'))(new Redis(config[_0x4103('0x17')]));require(_0x4103('0x1a'))['register'](socket);var jayson=require(_0x4103('0x1b'));var client=jayson[_0x4103('0x1c')][_0x4103('0x1d')]({'port':0x232c});var client9002=jayson[_0x4103('0x1c')][_0x4103('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5dc449,_0x2d65ba,_0x465a24,_0x2c67e6){return new BPromise(function(_0x26a33a,_0x12b441){var _0x4fe088=_0x2c67e6||client;return _0x4fe088['request'](_0x5dc449,_0x465a24)[_0x4103('0x1e')](function(_0x2f54b2){logger[_0x4103('0x1f')](_0x4103('0x20'),_0x2d65ba,'request\x20sent');logger['debug'](_0x4103('0x21'),_0x2d65ba,_0x4103('0x22'),JSON['stringify'](_0x2f54b2));if(_0x2f54b2[_0x4103('0x23')]){if(_0x2f54b2['error'][_0x4103('0x24')]===0x1f4){logger['error'](_0x4103('0x20'),_0x2d65ba,_0x2f54b2[_0x4103('0x23')][_0x4103('0x25')]);return _0x12b441(_0x2f54b2['error'][_0x4103('0x25')]);}logger[_0x4103('0x23')](_0x4103('0x20'),_0x2d65ba,_0x2f54b2[_0x4103('0x23')][_0x4103('0x25')]);return _0x26a33a(_0x2f54b2[_0x4103('0x23')][_0x4103('0x25')]);}else{logger['info'](_0x4103('0x20'),_0x2d65ba,_0x4103('0x22'));_0x26a33a(_0x2f54b2[_0x4103('0x26')]['message']);}})[_0x4103('0x27')](function(_0x4943b3){logger[_0x4103('0x23')](_0x4103('0x20'),_0x2d65ba,_0x4943b3);_0x12b441(_0x4943b3);});});}function respondWithStatusCode(_0x350767,_0x5ba827){_0x5ba827=_0x5ba827||0xcc;return function(_0x2be53a){if(_0x2be53a){return _0x350767[_0x4103('0x28')](_0x5ba827);}return _0x350767[_0x4103('0x29')](_0x5ba827)[_0x4103('0x2a')]();};}function respondWithResult(_0x4db0ea,_0x284f4e){_0x284f4e=_0x284f4e||0xc8;return function(_0x20edc3){if(_0x20edc3){return _0x4db0ea[_0x4103('0x29')](_0x284f4e)[_0x4103('0x2b')](_0x20edc3);}};}function respondWithFilteredResult(_0x46911b,_0x55431d){return function(_0x58907b){if(_0x58907b){var _0xc05466=typeof _0x55431d[_0x4103('0x2c')]===_0x4103('0x2d')&&typeof _0x55431d[_0x4103('0x2e')]===_0x4103('0x2d');var _0xf3863f=_0x58907b[_0x4103('0x2f')];var _0x7d511e=_0xc05466?0x0:_0x55431d[_0x4103('0x2c')];var _0x498b18=_0xc05466?_0x58907b['count']:_0x55431d['offset']+_0x55431d['limit'];var _0x513b72;if(_0x498b18>=_0xf3863f){_0x498b18=_0xf3863f;_0x513b72=0xc8;}else{_0x513b72=0xce;}_0x46911b['status'](_0x513b72);return _0x46911b[_0x4103('0x30')](_0x4103('0x31'),_0x7d511e+'-'+_0x498b18+'/'+_0xf3863f)[_0x4103('0x2b')](_0x58907b);}return null;};}function patchUpdates(_0x32c723){return function(_0x2a2dcb){try{jsonpatch[_0x4103('0x32')](_0x2a2dcb,_0x32c723,!![]);}catch(_0x19f89f){return BPromise[_0x4103('0x33')](_0x19f89f);}return _0x2a2dcb[_0x4103('0x34')]();};}function saveUpdates(_0x35b4a0,_0x13fab3){return function(_0x424f0c){if(_0x424f0c){return _0x424f0c[_0x4103('0x35')](_0x35b4a0)['then'](function(_0x54ed55){return _0x54ed55;});}return null;};}function removeEntity(_0x5e7031,_0x36c421){return function(_0x38dd50){if(_0x38dd50){return _0x38dd50[_0x4103('0x36')]()['then'](function(){var _0x504201=_0x38dd50[_0x4103('0x37')]({'plain':!![]});var _0x18d984=_0x4103('0x38');return db['UserProfileResource'][_0x4103('0x36')]({'where':{'type':_0x18d984,'resourceId':_0x504201['id']}})[_0x4103('0x1e')](function(){return _0x38dd50;});})[_0x4103('0x1e')](function(){_0x5e7031[_0x4103('0x29')](0xcc)[_0x4103('0x2a')]();});}};}function handleEntityNotFound(_0x1cfbc2,_0x1397cc){return function(_0x10eee7){if(!_0x10eee7){_0x1cfbc2[_0x4103('0x28')](0x194);}return _0x10eee7;};}function handleError(_0x41d4f4,_0x8bfa0a){_0x8bfa0a=_0x8bfa0a||0x1f4;return function(_0x48898b){logger[_0x4103('0x23')](_0x48898b[_0x4103('0x39')]);if(_0x48898b[_0x4103('0x3a')]){delete _0x48898b[_0x4103('0x3a')];}_0x41d4f4['status'](_0x8bfa0a)[_0x4103('0x3b')](_0x48898b);};}function getMustacheRender(_0x1d36ba,_0x2e76c3){return Mustache[_0x4103('0x3c')](_0x1d36ba,_['merge'](_0x2e76c3[_0x4103('0x3d')],{'contact':_0x2e76c3['contact'],'message':_0x2e76c3[_0x4103('0x25')],'agent':_0x2e76c3[_0x4103('0x3e')],'interaction':_0x2e76c3[_0x4103('0x3f')],'account':_0x2e76c3[_0x4103('0x40')]}))||'';}exports['index']=function(_0x2ca45c,_0x30a99b){var _0x1bd01d={'include':[{'model':db[_0x4103('0x41')],'as':_0x4103('0x42')}]},_0x2272ad={},_0x2e32d3={'count':0x0,'rows':[]};var _0x12c19d=_['map'](db['FaxAccount'][_0x4103('0x43')],function(_0x472bcb){return{'name':_0x472bcb[_0x4103('0x44')],'type':_0x472bcb[_0x4103('0x45')][_0x4103('0x46')]};});_0x2272ad['model']=_[_0x4103('0x47')](_0x12c19d,_0x4103('0x3a'));_0x2272ad[_0x4103('0x48')]=_[_0x4103('0x49')](_0x2ca45c[_0x4103('0x48')]);_0x2272ad[_0x4103('0x4a')]=_[_0x4103('0x4b')](_0x2272ad[_0x4103('0x4c')],_0x2272ad['query']);_0x1bd01d['attributes']=_['intersection'](_0x2272ad[_0x4103('0x4c')],qs['fields'](_0x2ca45c['query'][_0x4103('0x4d')]));_0x1bd01d[_0x4103('0x4e')]=_0x1bd01d[_0x4103('0x4e')][_0x4103('0x4f')]?_0x1bd01d[_0x4103('0x4e')]:_0x2272ad['model'];if(!_0x2ca45c[_0x4103('0x48')]['hasOwnProperty'](_0x4103('0x50'))){_0x1bd01d['limit']=qs[_0x4103('0x2e')](_0x2ca45c[_0x4103('0x48')]['limit']);_0x1bd01d[_0x4103('0x2c')]=qs['offset'](_0x2ca45c[_0x4103('0x48')]['offset']);}_0x1bd01d['order']=qs['sort'](_0x2ca45c[_0x4103('0x48')][_0x4103('0x51')]);_0x1bd01d[_0x4103('0x52')]=qs[_0x4103('0x4a')](_[_0x4103('0x53')](_0x2ca45c[_0x4103('0x48')],_0x2272ad['filters']),_0x12c19d);if(_0x2ca45c[_0x4103('0x48')][_0x4103('0x54')]){_0x1bd01d['where']=_[_0x4103('0x55')](_0x1bd01d[_0x4103('0x52')],{'$or':_['map'](_0x12c19d,function(_0x1bf486){if(_0x1bf486[_0x4103('0x45')]!==_0x4103('0x56')){var _0x46fb6a={};_0x46fb6a[_0x1bf486[_0x4103('0x3a')]]={'$like':'%'+_0x2ca45c['query'][_0x4103('0x54')]+'%'};return _0x46fb6a;}})});}_0x1bd01d=_['merge']({},_0x1bd01d,_0x2ca45c['options']);var _0x4e743d={'where':_0x1bd01d[_0x4103('0x52')]};return db[_0x4103('0x57')][_0x4103('0x2f')](_0x4e743d)[_0x4103('0x1e')](function(_0xc8ac5c){_0x2e32d3[_0x4103('0x2f')]=_0xc8ac5c;if(_0x2ca45c[_0x4103('0x48')][_0x4103('0x58')]){_0x1bd01d[_0x4103('0x59')]=[{'all':!![]}];}return db[_0x4103('0x57')]['findAll'](_0x1bd01d);})[_0x4103('0x1e')](function(_0x318897){_0x2e32d3[_0x4103('0x5a')]=_0x318897;return _0x2e32d3;})[_0x4103('0x1e')](respondWithFilteredResult(_0x30a99b,_0x1bd01d))[_0x4103('0x27')](handleError(_0x30a99b,null));};exports['show']=function(_0x2dc662,_0x87db6d){var _0x227140={'raw':![],'where':{'id':_0x2dc662['params']['id']},'include':[{'model':db[_0x4103('0x41')],'as':_0x4103('0x42')}]},_0x5454e={};_0x5454e[_0x4103('0x4c')]=_[_0x4103('0x49')](db[_0x4103('0x57')]['rawAttributes']);_0x5454e[_0x4103('0x48')]=_['keys'](_0x2dc662[_0x4103('0x48')]);_0x5454e[_0x4103('0x4a')]=_[_0x4103('0x4b')](_0x5454e[_0x4103('0x4c')],_0x5454e[_0x4103('0x48')]);_0x227140[_0x4103('0x4e')]=_[_0x4103('0x4b')](_0x5454e[_0x4103('0x4c')],qs[_0x4103('0x4d')](_0x2dc662[_0x4103('0x48')][_0x4103('0x4d')]));_0x227140[_0x4103('0x4e')]=_0x227140[_0x4103('0x4e')][_0x4103('0x4f')]?_0x227140[_0x4103('0x4e')]:_0x5454e['model'];if(_0x2dc662[_0x4103('0x48')]['includeAll']){_0x227140['include']=[{'all':!![]}];}_0x227140=_['merge']({},_0x227140,_0x2dc662['options']);return db[_0x4103('0x57')][_0x4103('0x5b')](_0x227140)[_0x4103('0x1e')](handleEntityNotFound(_0x87db6d,null))['then'](respondWithResult(_0x87db6d,null))['catch'](handleError(_0x87db6d,null));};exports[_0x4103('0x5c')]=function(_0x1a83dc,_0x851bc8){return db[_0x4103('0x57')]['create'](_0x1a83dc['body'],{})['then'](function(_0x52d004){var _0x38145c=_0x1a83dc['user'][_0x4103('0x37')]({'plain':!![]});if(!_0x38145c)throw new Error(_0x4103('0x5d'));if(_0x38145c['role']===_0x4103('0x5e')){var _0xa63f79=_0x52d004[_0x4103('0x37')]({'plain':!![]});var _0x4b3328=_0x4103('0x38');return db[_0x4103('0x5f')]['find']({'where':{'name':_0x4b3328,'userProfileId':_0x38145c['userProfileId']},'raw':!![]})[_0x4103('0x1e')](function(_0x1bb244){if(_0x1bb244&&_0x1bb244[_0x4103('0x60')]===0x0){return db['UserProfileResource'][_0x4103('0x5c')]({'name':_0xa63f79[_0x4103('0x3a')],'resourceId':_0xa63f79['id'],'type':_0x1bb244['name'],'sectionId':_0x1bb244['id']},{})[_0x4103('0x1e')](function(){return _0x52d004;});}else{return _0x52d004;}})['catch'](function(_0x36f4af){logger[_0x4103('0x23')](_0x4103('0x61'),_0x36f4af);throw _0x36f4af;});}return _0x52d004;})[_0x4103('0x1e')](respondWithResult(_0x851bc8,0xc9))['catch'](handleError(_0x851bc8,null));};exports[_0x4103('0x35')]=function(_0x3e8e0e,_0x2d81d3){if(_0x3e8e0e['body']['id']){delete _0x3e8e0e[_0x4103('0x3d')]['id'];}return db['FaxAccount'][_0x4103('0x5b')]({'where':{'id':_0x3e8e0e[_0x4103('0x62')]['id']},'include':[{'model':db[_0x4103('0x41')],'as':_0x4103('0x42')}]})['then'](handleEntityNotFound(_0x2d81d3,null))['then'](saveUpdates(_0x3e8e0e[_0x4103('0x3d')],null))[_0x4103('0x1e')](respondWithResult(_0x2d81d3,null))['catch'](handleError(_0x2d81d3,null));};exports[_0x4103('0x36')]=function(_0x5b192d,_0x4c2e4a){return db[_0x4103('0x57')][_0x4103('0x5b')]({'where':{'id':_0x5b192d[_0x4103('0x62')]['id']}})['then'](handleEntityNotFound(_0x4c2e4a,null))['then'](removeEntity(_0x4c2e4a,null))[_0x4103('0x27')](handleError(_0x4c2e4a,null));};exports[_0x4103('0x63')]=function(_0x535708,_0xaa5b2e){return db[_0x4103('0x57')]['describe']()[_0x4103('0x1e')](respondWithResult(_0xaa5b2e,null))[_0x4103('0x27')](handleError(_0xaa5b2e,null));};exports[_0x4103('0x64')]=function(_0x543855,_0x230996,_0x48f7b7){if(_0x543855[_0x4103('0x3d')]['id']){delete _0x543855['body']['id'];}return db[_0x4103('0x57')]['find']({'where':{'id':_0x543855[_0x4103('0x62')]['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0x230996,null))['then'](function(_0xa716b4){if(_0xa716b4){_0x543855['body'][_0x4103('0x65')]=_0xa716b4['id'];return db[_0x4103('0x66')][_0x4103('0x5c')](_0x543855[_0x4103('0x3d')]);}})[_0x4103('0x1e')](respondWithResult(_0x230996,null))[_0x4103('0x27')](handleError(_0x230996,null));};exports[_0x4103('0x67')]=function(_0x230bbd,_0x4a88e4,_0x520e9b){var _0xa8647a={'raw':![],'where':{}};var _0x558888={};var _0xaa4301={'count':0x0,'rows':[]};return db[_0x4103('0x57')]['findOne']({'where':{'id':_0x230bbd[_0x4103('0x62')]['id']}})['then'](handleEntityNotFound(_0x4a88e4,null))[_0x4103('0x1e')](function(_0xcc4305){if(_0xcc4305){_0x558888[_0x4103('0x4c')]=_[_0x4103('0x49')](db[_0x4103('0x66')]['rawAttributes']);_0x558888[_0x4103('0x48')]=_[_0x4103('0x49')](_0x230bbd[_0x4103('0x48')]);_0x558888[_0x4103('0x4a')]=_[_0x4103('0x4b')](_0x558888[_0x4103('0x4c')],_0x558888[_0x4103('0x48')]);_0xa8647a[_0x4103('0x4e')]=_[_0x4103('0x4b')](_0x558888['model'],qs['fields'](_0x230bbd['query']['fields']));_0xa8647a['attributes']=_0xa8647a[_0x4103('0x4e')][_0x4103('0x4f')]?_0xa8647a[_0x4103('0x4e')]:_0x558888[_0x4103('0x4c')];if(!_0x230bbd['query'][_0x4103('0x68')]('nolimit')){_0xa8647a[_0x4103('0x2e')]=qs['limit'](_0x230bbd[_0x4103('0x48')][_0x4103('0x2e')]);_0xa8647a['offset']=qs[_0x4103('0x2c')](_0x230bbd[_0x4103('0x48')][_0x4103('0x2c')]);}_0xa8647a['order']=qs['sort'](_0x230bbd[_0x4103('0x48')][_0x4103('0x51')]);_0xa8647a[_0x4103('0x52')]=qs[_0x4103('0x4a')](_[_0x4103('0x53')](_0x230bbd[_0x4103('0x48')],_0x558888[_0x4103('0x4a')]));_0xa8647a['where'][_0x4103('0x65')]=_0xcc4305['id'];if(_0x230bbd[_0x4103('0x48')][_0x4103('0x54')]){_0xa8647a[_0x4103('0x52')]=_[_0x4103('0x55')](_0xa8647a[_0x4103('0x52')],{'$or':_['map'](_0xa8647a['attributes'],function(_0x2cf11e){var _0x3dff00={};_0x3dff00[_0x2cf11e]={'$like':'%'+_0x230bbd[_0x4103('0x48')][_0x4103('0x54')]+'%'};return _0x3dff00;})});}_0xa8647a=_[_0x4103('0x55')]({},_0xa8647a,_0x230bbd[_0x4103('0x69')]);return db['Disposition'][_0x4103('0x2f')]({'where':_0xa8647a[_0x4103('0x52')]})[_0x4103('0x1e')](function(_0x1f8926){_0xaa4301['count']=_0x1f8926;if(_0x230bbd[_0x4103('0x48')][_0x4103('0x58')]){_0xa8647a['include']=[{'all':!![]}];}return db[_0x4103('0x66')]['findAll'](_0xa8647a);})[_0x4103('0x1e')](function(_0x3f5b40){_0xaa4301[_0x4103('0x5a')]=_0x3f5b40;return _0xaa4301;});}})[_0x4103('0x1e')](respondWithFilteredResult(_0x4a88e4,_0xa8647a))['catch'](handleError(_0x4a88e4,null));};exports[_0x4103('0x6a')]=function(_0x2f4747,_0x48f495,_0x4c5aa8){return db['FaxAccount'][_0x4103('0x5b')]({'where':{'id':_0x2f4747[_0x4103('0x62')]['id']}})['then'](handleEntityNotFound(_0x48f495,null))[_0x4103('0x1e')](function(_0x2b87d5){if(_0x2b87d5){return _0x2b87d5['removeDispositions'](_0x2f4747[_0x4103('0x48')][_0x4103('0x6b')]);}})[_0x4103('0x1e')](respondWithStatusCode(_0x48f495,null))[_0x4103('0x27')](handleError(_0x48f495,null));};exports[_0x4103('0x6c')]=function(_0x5b5901,_0x4876cf,_0x3a132d){if(_0x5b5901[_0x4103('0x3d')]['id']){delete _0x5b5901[_0x4103('0x3d')]['id'];}return db['FaxAccount'][_0x4103('0x5b')]({'where':{'id':_0x5b5901[_0x4103('0x62')]['id']}})['then'](handleEntityNotFound(_0x4876cf,null))[_0x4103('0x1e')](function(_0x599837){if(_0x599837){_0x5b5901[_0x4103('0x3d')][_0x4103('0x65')]=_0x599837['id'];return db[_0x4103('0x6d')]['create'](_0x5b5901[_0x4103('0x3d')]);}})[_0x4103('0x1e')](respondWithResult(_0x4876cf,null))[_0x4103('0x27')](handleError(_0x4876cf,null));};exports['getAnswers']=function(_0x3880b5,_0x83000c,_0x5cc4a5){var _0x39663d={'raw':![],'where':{}};var _0x2a8ecf={};var _0x202f3b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4103('0x6e')]({'where':{'id':_0x3880b5['params']['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0x83000c,null))['then'](function(_0x46e8c8){if(_0x46e8c8){_0x2a8ecf[_0x4103('0x4c')]=_[_0x4103('0x49')](db['CannedAnswer'][_0x4103('0x43')]);_0x2a8ecf[_0x4103('0x48')]=_[_0x4103('0x49')](_0x3880b5[_0x4103('0x48')]);_0x2a8ecf[_0x4103('0x4a')]=_[_0x4103('0x4b')](_0x2a8ecf[_0x4103('0x4c')],_0x2a8ecf[_0x4103('0x48')]);_0x39663d[_0x4103('0x4e')]=_['intersection'](_0x2a8ecf[_0x4103('0x4c')],qs[_0x4103('0x4d')](_0x3880b5[_0x4103('0x48')][_0x4103('0x4d')]));_0x39663d[_0x4103('0x4e')]=_0x39663d[_0x4103('0x4e')][_0x4103('0x4f')]?_0x39663d['attributes']:_0x2a8ecf[_0x4103('0x4c')];if(!_0x3880b5['query']['hasOwnProperty'](_0x4103('0x50'))){_0x39663d[_0x4103('0x2e')]=qs[_0x4103('0x2e')](_0x3880b5[_0x4103('0x48')][_0x4103('0x2e')]);_0x39663d[_0x4103('0x2c')]=qs['offset'](_0x3880b5[_0x4103('0x48')][_0x4103('0x2c')]);}_0x39663d[_0x4103('0x6f')]=qs[_0x4103('0x51')](_0x3880b5[_0x4103('0x48')][_0x4103('0x51')]);_0x39663d[_0x4103('0x52')]=qs[_0x4103('0x4a')](_['pick'](_0x3880b5[_0x4103('0x48')],_0x2a8ecf[_0x4103('0x4a')]));_0x39663d['where'][_0x4103('0x65')]=_0x46e8c8['id'];if(_0x3880b5[_0x4103('0x48')]['filter']){_0x39663d[_0x4103('0x52')]=_['merge'](_0x39663d[_0x4103('0x52')],{'$or':_[_0x4103('0x47')](_0x39663d[_0x4103('0x4e')],function(_0x4dde4c){var _0x37ff7a={};_0x37ff7a[_0x4dde4c]={'$like':'%'+_0x3880b5['query'][_0x4103('0x54')]+'%'};return _0x37ff7a;})});}_0x39663d=_[_0x4103('0x55')]({},_0x39663d,_0x3880b5[_0x4103('0x69')]);return db[_0x4103('0x6d')][_0x4103('0x2f')]({'where':_0x39663d[_0x4103('0x52')]})[_0x4103('0x1e')](function(_0x1044c5){_0x202f3b[_0x4103('0x2f')]=_0x1044c5;if(_0x3880b5[_0x4103('0x48')][_0x4103('0x58')]){_0x39663d[_0x4103('0x59')]=[{'all':!![]}];}return db[_0x4103('0x6d')][_0x4103('0x70')](_0x39663d);})[_0x4103('0x1e')](function(_0x4d39b6){_0x202f3b[_0x4103('0x5a')]=_0x4d39b6;return _0x202f3b;});}})[_0x4103('0x1e')](respondWithFilteredResult(_0x83000c,_0x39663d))[_0x4103('0x27')](handleError(_0x83000c,null));};exports['removeAnswers']=function(_0x173bfa,_0x10b97c,_0xb3dc3c){return db['FaxAccount'][_0x4103('0x5b')]({'where':{'id':_0x173bfa[_0x4103('0x62')]['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0x10b97c,null))[_0x4103('0x1e')](function(_0x2f5d7b){if(_0x2f5d7b){return _0x2f5d7b[_0x4103('0x71')](_0x173bfa[_0x4103('0x48')][_0x4103('0x6b')]);}})['then'](respondWithStatusCode(_0x10b97c,null))[_0x4103('0x27')](handleError(_0x10b97c,null));};exports[_0x4103('0x72')]=function(_0x6fcf3a,_0x2c9e85,_0x2e27ec){return db['FaxInteraction'][_0x4103('0x5b')]({'where':{'id':_0x6fcf3a['params']['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0x2c9e85,null))['then'](function(_0x5f40a8){if(_0x5f40a8){return _0x5f40a8[_0x4103('0x72')](_0x6fcf3a[_0x4103('0x3d')]['ids'],_[_0x4103('0x73')](_0x6fcf3a[_0x4103('0x3d')],[_0x4103('0x6b'),'id'])||{});}})[_0x4103('0x1e')](respondWithResult(_0x2c9e85,null))[_0x4103('0x27')](handleError(_0x2c9e85,null));};exports[_0x4103('0x74')]=function(_0x3e6692,_0x19e2dd,_0x2d7691){var _0x1a5ffa={'raw':![],'where':{}};var _0x51df05={};var _0x4a03de={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4103('0x6e')]({'where':{'id':_0x3e6692[_0x4103('0x62')]['id']}})['then'](handleEntityNotFound(_0x19e2dd,null))[_0x4103('0x1e')](function(_0x436a2d){if(_0x436a2d){_0x51df05['model']=_[_0x4103('0x49')](db[_0x4103('0x75')]['rawAttributes']);_0x51df05[_0x4103('0x48')]=_['keys'](_0x3e6692[_0x4103('0x48')]);_0x51df05[_0x4103('0x4a')]=_[_0x4103('0x4b')](_0x51df05[_0x4103('0x4c')],_0x51df05[_0x4103('0x48')]);_0x1a5ffa[_0x4103('0x4e')]=_[_0x4103('0x4b')](_0x51df05[_0x4103('0x4c')],qs[_0x4103('0x4d')](_0x3e6692[_0x4103('0x48')][_0x4103('0x4d')]));_0x1a5ffa['attributes']=_0x1a5ffa[_0x4103('0x4e')][_0x4103('0x4f')]?_0x1a5ffa[_0x4103('0x4e')]:_0x51df05[_0x4103('0x4c')];if(!_0x3e6692[_0x4103('0x48')][_0x4103('0x68')](_0x4103('0x50'))){_0x1a5ffa[_0x4103('0x2e')]=qs[_0x4103('0x2e')](_0x3e6692[_0x4103('0x48')][_0x4103('0x2e')]);_0x1a5ffa[_0x4103('0x2c')]=qs[_0x4103('0x2c')](_0x3e6692[_0x4103('0x48')][_0x4103('0x2c')]);}_0x1a5ffa['order']=qs['sort'](_0x3e6692[_0x4103('0x48')][_0x4103('0x51')]);_0x1a5ffa['where']=qs[_0x4103('0x4a')](_[_0x4103('0x53')](_0x3e6692[_0x4103('0x48')],_0x51df05['filters']));_0x1a5ffa[_0x4103('0x52')][_0x4103('0x65')]=_0x436a2d['id'];if(_0x3e6692['query']['filter']){_0x1a5ffa[_0x4103('0x52')]=_[_0x4103('0x55')](_0x1a5ffa['where'],{'$or':_[_0x4103('0x47')](_0x1a5ffa['attributes'],function(_0x141b26){var _0x11c3c1={};_0x11c3c1[_0x141b26]={'$like':'%'+_0x3e6692[_0x4103('0x48')][_0x4103('0x54')]+'%'};return _0x11c3c1;})});}_0x1a5ffa=_[_0x4103('0x55')]({},_0x1a5ffa,_0x3e6692['options']);return db['FaxInteraction']['count']({'where':_0x1a5ffa[_0x4103('0x52')]})['then'](function(_0x231fa8){_0x4a03de[_0x4103('0x2f')]=_0x231fa8;if(_0x3e6692[_0x4103('0x48')][_0x4103('0x58')]){_0x1a5ffa[_0x4103('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4103('0x3a'),_0x4103('0x76'),'internal'],'required':![]},{'model':db[_0x4103('0x77')],'as':'Tags','attributes':['id','name',_0x4103('0x78')],'where':_0x3e6692[_0x4103('0x48')][_0x4103('0x79')]?{'id':_0x3e6692['query'][_0x4103('0x79')]}:undefined,'required':_0x3e6692[_0x4103('0x48')]['tag']?!![]:![]}];}return db[_0x4103('0x75')]['findAll'](_0x1a5ffa);})[_0x4103('0x1e')](function(_0x3d6062){_0x4a03de[_0x4103('0x5a')]=_0x3d6062;return _0x4a03de;});}})[_0x4103('0x1e')](respondWithFilteredResult(_0x19e2dd,_0x1a5ffa))[_0x4103('0x27')](handleError(_0x19e2dd,null));};exports[_0x4103('0x7a')]=function(_0x43ce09,_0x52e88c,_0x1cea93){return db[_0x4103('0x57')]['findOne']({'where':{'id':_0x43ce09[_0x4103('0x62')]['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0x52e88c,null))[_0x4103('0x1e')](function(_0x5dcbb2){if(_0x5dcbb2){return db['sequelize']['transaction'](function(_0x3339dd){return db['FaxApplication'][_0x4103('0x36')]({'where':{'FaxAccountId':_0x43ce09[_0x4103('0x62')]['id']},'transaction':_0x3339dd})[_0x4103('0x1e')](function(_0x2f0949){var _0x271eb1=_['map'](_0x43ce09[_0x4103('0x3d')],function(_0xdeccaf){_0xdeccaf[_0x4103('0x65')]=_0x43ce09[_0x4103('0x62')]['id'];return _0xdeccaf;});return db[_0x4103('0x7b')]['bulkCreate'](_0x271eb1,{'transaction':_0x3339dd});});})[_0x4103('0x1e')](function(){return db['FaxApplication'][_0x4103('0x7c')]({'where':{'FaxAccountId':_0x43ce09[_0x4103('0x62')]['id']},'order':_0x4103('0x7d')});});}})[_0x4103('0x1e')](respondWithResult(_0x52e88c,null))['catch'](handleError(_0x52e88c,null));};exports[_0x4103('0x7e')]=function(_0x2d4612,_0x1bc6fa,_0x2b4fb4){var _0x48f4d7={};var _0x5eef21={};var _0x11f0c7;var _0x17c926;return db[_0x4103('0x57')][_0x4103('0x6e')]({'where':{'id':_0x2d4612[_0x4103('0x62')]['id']}})['then'](handleEntityNotFound(_0x1bc6fa,null))[_0x4103('0x1e')](function(_0x3664bf){if(_0x3664bf){_0x11f0c7=_0x3664bf;_0x5eef21[_0x4103('0x4c')]=_['keys'](db[_0x4103('0x7b')]['rawAttributes']);_0x5eef21['query']=_['keys'](_0x2d4612[_0x4103('0x48')]);_0x5eef21[_0x4103('0x4a')]=_['intersection'](_0x5eef21[_0x4103('0x4c')],_0x5eef21[_0x4103('0x48')]);_0x48f4d7[_0x4103('0x4e')]=_[_0x4103('0x4b')](_0x5eef21[_0x4103('0x4c')],qs[_0x4103('0x4d')](_0x2d4612[_0x4103('0x48')][_0x4103('0x4d')]));_0x48f4d7[_0x4103('0x4e')]=_0x48f4d7[_0x4103('0x4e')][_0x4103('0x4f')]?_0x48f4d7[_0x4103('0x4e')]:_0x5eef21[_0x4103('0x4c')];_0x48f4d7[_0x4103('0x6f')]=qs[_0x4103('0x51')](_0x2d4612[_0x4103('0x48')][_0x4103('0x51')]);_0x48f4d7[_0x4103('0x52')]=qs[_0x4103('0x4a')](_['pick'](_0x2d4612['query'],_0x5eef21['filters']));if(_0x2d4612[_0x4103('0x48')][_0x4103('0x54')]){_0x48f4d7['where']=_[_0x4103('0x55')](_0x48f4d7['where'],{'$or':_[_0x4103('0x47')](_0x48f4d7[_0x4103('0x4e')],function(_0x35c086){var _0x43cc7b={};_0x43cc7b[_0x35c086]={'$like':'%'+_0x2d4612[_0x4103('0x48')][_0x4103('0x54')]+'%'};return _0x43cc7b;})});}_0x48f4d7=_['merge']({},_0x48f4d7,_0x2d4612[_0x4103('0x69')]);return _0x11f0c7[_0x4103('0x7e')](_0x48f4d7);}})['then'](function(_0x454417){if(_0x454417){_0x17c926=_0x454417[_0x4103('0x4f')];if(!_0x2d4612[_0x4103('0x48')][_0x4103('0x68')](_0x4103('0x50'))){_0x48f4d7[_0x4103('0x2e')]=qs[_0x4103('0x2e')](_0x2d4612[_0x4103('0x48')]['limit']);_0x48f4d7[_0x4103('0x2c')]=qs[_0x4103('0x2c')](_0x2d4612[_0x4103('0x48')][_0x4103('0x2c')]);}return _0x11f0c7['getApplications'](_0x48f4d7);}})['then'](function(_0x3d04b3){if(_0x3d04b3){return _0x3d04b3?{'count':_0x17c926,'rows':_0x3d04b3}:null;}})[_0x4103('0x1e')](respondWithResult(_0x1bc6fa,null))[_0x4103('0x27')](handleError(_0x1bc6fa,null));};function Extension(_0x23985e,_0x500691,_0x6beea4,_0x3f1ac8){this['context']=_0x4103('0x7f');this[_0x4103('0x80')]=_0x23985e[_0x4103('0x81')];this[_0x4103('0x82')]=_0x3f1ac8;this[_0x4103('0x45')]='system';this[_0x4103('0x83')]=_0x4103('0x84');this[_0x4103('0x65')]=_0x23985e['id'];this[_0x4103('0x7d')]=_0x500691;this['appdata']=_0x6beea4;}function createExtensionsReciveFax(_0x5e45b2){var _0x8a4003=0x1;var _0x344113=[];_0x344113[_0x4103('0x85')](new Extension(_0x5e45b2,_0x8a4003,'',_0x4103('0x86')));_0x8a4003+=0x1;_0x344113['push'](new Extension(_0x5e45b2,_0x8a4003,'CDR(type)=inbound-fax',_0x4103('0x87')));_0x8a4003+=0x1;for(var _0x295808 in _0x5e45b2){if(_0x5e45b2[_0x4103('0x68')](_0x295808)&&(_0x295808===_0x4103('0x88')||_0x295808==='localstationid'||_0x295808===_0x4103('0x89')||_0x295808===_0x4103('0x8a')||_0x295808===_0x4103('0x8b')||_0x295808==='maxrate'||_0x295808==='minrate'||_0x295808===_0x4103('0x8c')||_0x295808===_0x4103('0x8d'))){_0x344113[_0x4103('0x85')](new Extension(_0x5e45b2,_0x8a4003,'FAXOPT('+_0x295808+')='+_0x5e45b2[_0x295808],'Set'));_0x8a4003+=0x1;}}_0x344113[_0x4103('0x85')](new Extension(_0x5e45b2,_0x8a4003,'6',_0x4103('0x8e')));_0x8a4003+=0x1;_0x344113['push'](new Extension(_0x5e45b2,_0x8a4003,_0x4103('0x8f'),_0x4103('0x90')));_0x8a4003=0x0;return _0x344113;}exports['addAccountApplications']=function(_0x57fa2e,_0xda5b5b,_0x178629){var _0x1f8042;return db[_0x4103('0x91')][_0x4103('0x92')](function(_0x29cf3d){return db[_0x4103('0x57')][_0x4103('0x5c')](_0x57fa2e[_0x4103('0x3d')],{'transaction':_0x29cf3d})[_0x4103('0x1e')](function(_0x1fbcf4){_0x1f8042=_0x1fbcf4[_0x4103('0x37')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x1f8042),{'transaction':_0x29cf3d});});})[_0x4103('0x1e')](function(){return _0x1f8042;})[_0x4103('0x1e')](respondWithResult(_0xda5b5b,null))[_0x4103('0x27')](handleError(_0xda5b5b,null));};exports['updateAccountApplications']=function(_0x514af1,_0x1f1399,_0x1c4047){var _0x299746;return db[_0x4103('0x91')][_0x4103('0x92')](function(_0x77269e){return db[_0x4103('0x57')][_0x4103('0x35')](_0x514af1[_0x4103('0x3d')],{'where':{'id':_0x514af1[_0x4103('0x3d')]['id']},'transaction':_0x77269e})[_0x4103('0x1e')](function(_0x2a4ddd){return db[_0x4103('0x93')][_0x4103('0x36')]({'where':{'FaxAccountId':_0x514af1[_0x4103('0x3d')]['id']},'transaction':_0x77269e})[_0x4103('0x1e')](function(_0x1d5c9a){return db['VoiceExtension'][_0x4103('0x94')](createExtensionsReciveFax(_[_0x4103('0x73')](_0x514af1[_0x4103('0x3d')],['tech',_0x4103('0x46'),_0x4103('0x95'),_0x4103('0x96'),_0x4103('0x97'),_0x4103('0x98')])),{'transaction':_0x77269e});});});})['then'](function(){return db[_0x4103('0x57')][_0x4103('0x99')](_0x514af1[_0x4103('0x3d')]['id']);})[_0x4103('0x1e')](respondWithResult(_0x1f1399,null))[_0x4103('0x27')](handleError(_0x1f1399,null));};exports[_0x4103('0x9a')]=function(_0x15db64,_0x40e8f4,_0x97dedd){var _0x14032a={'raw':!![],'where':{}};var _0x3f9cec={};var _0x1dcc4e={'count':0x0,'rows':[]};return db[_0x4103('0x57')][_0x4103('0x6e')]({'where':{'id':_0x15db64[_0x4103('0x62')]['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0x40e8f4,null))[_0x4103('0x1e')](function(_0x1d841f){if(_0x1d841f){_0x3f9cec[_0x4103('0x4c')]=_[_0x4103('0x49')](db[_0x4103('0x9b')][_0x4103('0x43')]);_0x3f9cec[_0x4103('0x48')]=_[_0x4103('0x49')](_0x15db64[_0x4103('0x48')]);_0x3f9cec[_0x4103('0x4a')]=_[_0x4103('0x4b')](_0x3f9cec[_0x4103('0x4c')],_0x3f9cec[_0x4103('0x48')]);_0x14032a[_0x4103('0x4e')]=_[_0x4103('0x4b')](_0x3f9cec[_0x4103('0x4c')],qs['fields'](_0x15db64[_0x4103('0x48')][_0x4103('0x4d')]));_0x14032a[_0x4103('0x4e')]=_0x14032a[_0x4103('0x4e')][_0x4103('0x4f')]?_0x14032a[_0x4103('0x4e')]:_0x3f9cec[_0x4103('0x4c')];if(!_0x15db64[_0x4103('0x48')][_0x4103('0x68')]('nolimit')){_0x14032a[_0x4103('0x2e')]=qs[_0x4103('0x2e')](_0x15db64[_0x4103('0x48')][_0x4103('0x2e')]);_0x14032a['offset']=qs[_0x4103('0x2c')](_0x15db64['query'][_0x4103('0x2c')]);}_0x14032a[_0x4103('0x6f')]=qs[_0x4103('0x51')](_0x15db64['query'][_0x4103('0x51')]);_0x14032a[_0x4103('0x52')]=qs[_0x4103('0x4a')](_[_0x4103('0x53')](_0x15db64['query'],_0x3f9cec['filters']));_0x14032a[_0x4103('0x52')][_0x4103('0x65')]=_0x1d841f['id'];if(_0x15db64[_0x4103('0x48')][_0x4103('0x54')]){_0x14032a[_0x4103('0x52')]=_[_0x4103('0x55')](_0x14032a['where'],{'$or':_[_0x4103('0x47')](_0x14032a[_0x4103('0x4e')],function(_0x403d8e){var _0x56f4e9={};_0x56f4e9[_0x403d8e]={'$like':'%'+_0x15db64[_0x4103('0x48')][_0x4103('0x54')]+'%'};return _0x56f4e9;})});}if(_0x15db64[_0x4103('0x48')][_0x4103('0x9c')]){var _0x41b329=_0x15db64[_0x4103('0x48')]['$gte']['split'](',');var _0x17a847={};_0x17a847[_0x41b329[0x0]]={'$gte':moment(_0x41b329[0x1])[_0x4103('0x9d')](_0x4103('0x9e'))};_0x14032a[_0x4103('0x52')]=_['merge'](_0x14032a[_0x4103('0x52')],_0x17a847);}_0x14032a=_['merge']({},_0x14032a,_0x15db64[_0x4103('0x69')]);return db[_0x4103('0x9b')]['count']({'where':_0x14032a[_0x4103('0x52')]})[_0x4103('0x1e')](function(_0x254d3b){_0x1dcc4e[_0x4103('0x2f')]=_0x254d3b;if(_0x15db64['query'][_0x4103('0x58')]){_0x14032a[_0x4103('0x59')]=[{'all':!![]}];}return db[_0x4103('0x9b')]['findAll'](_0x14032a);})[_0x4103('0x1e')](function(_0x33f737){_0x1dcc4e[_0x4103('0x5a')]=_0x33f737;return _0x1dcc4e;});}})['then'](respondWithFilteredResult(_0x40e8f4,_0x14032a))['catch'](handleError(_0x40e8f4,null));};exports[_0x4103('0x3b')]=function(_0x5c6232,_0x3956cf,_0x5b1856){var _0x5a0e6b,_0x14bbbe={},_0x3957f6;if(_0x5c6232[_0x4103('0x3d')]['to']){_0x3957f6=_0x5c6232['body']['to'][0x0];}return db[_0x4103('0x57')][_0x4103('0x5b')]({'where':{'id':_0x5c6232[_0x4103('0x62')]['id']},'include':[{'model':db[_0x4103('0x9f')],'as':_0x4103('0xa0'),'include':[{'model':db[_0x4103('0xa1')],'as':'Contacts','where':{'fax':_0x3957f6},'limit':0x1,'order':[[_0x4103('0x96'),_0x4103('0xa2')]]}]}]})[_0x4103('0x1e')](handleEntityNotFound(_0x3956cf,null))[_0x4103('0x1e')](function(_0x535e92){_0x5a0e6b=_0x535e92;if(_0x5c6232[_0x4103('0x3d')]['attachments']&&_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][_0x4103('0x4f')]){for(var _0x5b0fd5=0x0;_0x5b0fd5<_0x5c6232['body']['attachments'][_0x4103('0x4f')];_0x5b0fd5+=0x1){_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][_0x5b0fd5]={'filename':_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][_0x5b0fd5]['name'],'id':_0x5c6232[_0x4103('0x3d')]['attachments'][_0x5b0fd5]['id'],'path':path[_0x4103('0xa4')](config[_0x4103('0xa5')],_0x4103('0xa6'),_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][_0x5b0fd5][_0x4103('0xa7')])};}}return respondWithRpcPromise(_0x4103('0xa8'),_0x4103('0xa8'),{'FaxAccountId':_[_0x4103('0xa9')](_0x5c6232['params']['id'])?undefined:_0x5c6232[_0x4103('0x62')]['id'],'path':_['isNil'](_0x5c6232['body'][_0x4103('0xa3')][0x0]['path'])?undefined:_0x5c6232['body'][_0x4103('0xa3')][0x0][_0x4103('0xaa')],'fax':_[_0x4103('0xa9')](_0x5c6232[_0x4103('0x3d')]['to'][0x0])?undefined:_0x5c6232[_0x4103('0x3d')]['to'][0x0]},client9002);})['then'](function(){if(_0x5a0e6b){if(_[_0x4103('0xa9')](_0x5c6232['body'][_0x4103('0xab')])){_0x5c6232['body'][_0x4103('0xab')]=util[_0x4103('0x9d')](_0x4103('0xac'),_0x5a0e6b[_0x4103('0x3a')],_0x5a0e6b['fax']);}if(_0x5a0e6b[_0x4103('0xa0')]){if(_0x5a0e6b[_0x4103('0xa0')][_0x4103('0xad')]['length']){return _0x5a0e6b[_0x4103('0xa0')][_0x4103('0xad')][0x0];}else{return db['CmContact']['create'](_[_0x4103('0x18')](_0x5c6232[_0x4103('0x3d')],{'firstName':_0x5c6232[_0x4103('0x3d')]['to'][0x0],'phone':_0x5c6232[_0x4103('0x3d')]['to'][0x0],'fax':_0x5c6232[_0x4103('0x3d')]['to'][0x0],'ListId':_0x5a0e6b[_0x4103('0x98')]}));}}else{throw new Error(_0x4103('0xae'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x365016){if(_0x365016){return db[_0x4103('0x75')]['find']({'where':{'ContactId':_0x365016['id'],'closed':![],'FaxAccountId':_0x5a0e6b['id']}})[_0x4103('0x1e')](function(_0x3cce31){if(_0x3cce31){return[_0x3cce31,![]];}return db[_0x4103('0x75')]['create']({'UserId':_0x5c6232[_0x4103('0x5e')]['id'],'ContactId':_0x365016['id'],'FaxAccountId':_0x5a0e6b['id'],'fax':_0x5c6232[_0x4103('0x3d')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x4103('0x55')](_0x5c6232['body'],{'read':![],'body':_0x5c6232['body'][_0x4103('0xa3')][0x0]['filename'],'FaxAccountId':_0x5a0e6b['id'],'UserId':_0x5c6232[_0x4103('0x5e')]['id'],'ContactId':_0x365016['id'],'AttachmentId':_0x5c6232['body'][_0x4103('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0x4103('0x9b')],'as':_0x4103('0xaf')}]})[_0x4103('0x1e')](function(_0x20366d){return[_0x20366d,!![]];});});}else{throw new Error(_0x4103('0xb0'));}})[_0x4103('0xb1')](function(_0x4f6359,_0x4aff91){if(_0x4aff91){return _0x4f6359;}return db[_0x4103('0x9b')][_0x4103('0x5c')]({'direction':_0x4103('0xb2'),'read':![],'body':_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][0x0][_0x4103('0xb3')],'FaxAccountId':_0x5a0e6b['id'],'FaxInteractionId':_0x4f6359['id'],'UserId':_0x5c6232[_0x4103('0x5e')]['id'],'ContactId':_0x4f6359[_0x4103('0xb4')],'AttachmentId':_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][0x0]['id']})[_0x4103('0x1e')](function(_0x402a13){_0x4f6359[_0x4103('0xb5')][_0x4103('0xaf')]=[];_0x4f6359[_0x4103('0xb5')][_0x4103('0xaf')]['push'](_0x402a13['dataValues']);return _0x4f6359;});})['then'](function(_0x5562a5){respondWithRpcPromise(_0x4103('0xb6'),_0x4103('0xb6'),{'FaxAccountId':_[_0x4103('0xa9')](_0x5c6232[_0x4103('0x62')]['id'])?undefined:_0x5c6232[_0x4103('0x62')]['id'],'path':_[_0x4103('0xa9')](_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][0x0][_0x4103('0xaa')])?undefined:_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][0x0][_0x4103('0xaa')],'fax':_[_0x4103('0xa9')](_0x5c6232['body']['to'][0x0])?undefined:_0x5c6232[_0x4103('0x3d')]['to'][0x0],'AttachmentId':_0x5c6232[_0x4103('0x3d')][_0x4103('0xa3')][0x0]['id']},client9002)[_0x4103('0x1e')](function(_0x2e12cf){logger[_0x4103('0x1f')](_0x4103('0xb7'),_0x2e12cf);})[_0x4103('0x27')](function(_0x66f463){logger[_0x4103('0x1f')](_0x4103('0xb7'),_0x66f463);});return _0x5562a5;})[_0x4103('0x1e')](respondWithResult(_0x3956cf,null))['catch'](handleError(_0x3956cf,null));};exports[_0x4103('0xb8')]=function(_0x10f3ef,_0x48faa7,_0x798127){return db[_0x4103('0x57')][_0x4103('0x5b')]({'where':{'id':_0x10f3ef[_0x4103('0x62')]['id']}})['then'](handleEntityNotFound(_0x48faa7,null))['then'](function(_0xe0e4c){if(_0xe0e4c){return _0xe0e4c['addAgents'](_0x10f3ef['body'][_0x4103('0x6b')],_[_0x4103('0x73')](_0x10f3ef['body'],[_0x4103('0x6b'),'id'])||{})[_0x4103('0xb1')](function(_0x3f7ff1){for(var _0x31f128=0x0;_0x31f128<_0x10f3ef[_0x4103('0x3d')][_0x4103('0x6b')][_0x4103('0x4f')];_0x31f128+=0x1){socket[_0x4103('0xb9')](_0x4103('0xba'),{'UserId':_0x10f3ef[_0x4103('0x3d')][_0x4103('0x6b')][_0x31f128],'FaxAccountId':_0x10f3ef[_0x4103('0x62')]['id']});}return _0x3f7ff1;});}})[_0x4103('0x1e')](respondWithResult(_0x48faa7,null))[_0x4103('0x27')](handleError(_0x48faa7,null));};exports[_0x4103('0xbb')]=function(_0x274045,_0x5ee0e5,_0x5df951){return db[_0x4103('0x57')]['find']({'where':{'id':_0x274045['params']['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0x5ee0e5,null))[_0x4103('0x1e')](function(_0x3ca35e){if(_0x3ca35e){return _0x3ca35e['removeAgents'](_0x274045['query'][_0x4103('0x6b')])['then'](function(){if(_[_0x4103('0xbc')](_0x274045['query']['ids'])){for(var _0x2c2b54=0x0;_0x2c2b54<_0x274045['query'][_0x4103('0x6b')]['length'];_0x2c2b54+=0x1){socket['emit'](_0x4103('0xbd'),{'UserId':Number(_0x274045[_0x4103('0x48')][_0x4103('0x6b')][_0x2c2b54]),'FaxAccountId':Number(_0x274045[_0x4103('0x62')]['id'])});}}else{socket[_0x4103('0xb9')](_0x4103('0xbd'),{'UserId':Number(_0x274045['query']['ids']),'FaxAccountId':Number(_0x274045[_0x4103('0x62')]['id'])});}});}})[_0x4103('0x1e')](respondWithStatusCode(_0x5ee0e5,null))[_0x4103('0x27')](handleError(_0x5ee0e5,null));};exports[_0x4103('0xbe')]=function(_0x2bf1d3,_0xc9d419,_0x360482){var _0x38e8c7={};var _0x43c9b4={};var _0x300ae7;var _0x49b7e7;return db['FaxAccount'][_0x4103('0x6e')]({'where':{'id':_0x2bf1d3[_0x4103('0x62')]['id']}})[_0x4103('0x1e')](handleEntityNotFound(_0xc9d419,null))[_0x4103('0x1e')](function(_0x53a58d){if(_0x53a58d){_0x300ae7=_0x53a58d;_0x43c9b4[_0x4103('0x4c')]=_['keys'](db['User'][_0x4103('0x43')]);_0x43c9b4[_0x4103('0x48')]=_[_0x4103('0x49')](_0x2bf1d3[_0x4103('0x48')]);_0x43c9b4[_0x4103('0x4a')]=_['intersection'](_0x43c9b4[_0x4103('0x4c')],_0x43c9b4[_0x4103('0x48')]);_0x38e8c7[_0x4103('0x4e')]=_[_0x4103('0x4b')](_0x43c9b4[_0x4103('0x4c')],qs['fields'](_0x2bf1d3[_0x4103('0x48')][_0x4103('0x4d')]));_0x38e8c7[_0x4103('0x4e')]=_0x38e8c7[_0x4103('0x4e')][_0x4103('0x4f')]?_0x38e8c7[_0x4103('0x4e')]:_0x43c9b4[_0x4103('0x4c')];_0x38e8c7['order']=qs[_0x4103('0x51')](_0x2bf1d3[_0x4103('0x48')][_0x4103('0x51')]);_0x38e8c7['where']=qs[_0x4103('0x4a')](_[_0x4103('0x53')](_0x2bf1d3[_0x4103('0x48')],_0x43c9b4['filters']));if(_0x2bf1d3[_0x4103('0x48')][_0x4103('0x54')]){_0x38e8c7[_0x4103('0x52')]=_['merge'](_0x38e8c7[_0x4103('0x52')],{'$or':_['map'](_0x38e8c7[_0x4103('0x4e')],function(_0xd97ee0){var _0x5fac68={};_0x5fac68[_0xd97ee0]={'$like':'%'+_0x2bf1d3[_0x4103('0x48')]['filter']+'%'};return _0x5fac68;})});}_0x38e8c7=_[_0x4103('0x55')]({},_0x38e8c7,_0x2bf1d3[_0x4103('0x69')]);return _0x300ae7['getAgents'](_0x38e8c7);}})['then'](function(_0x33e053){if(_0x33e053){_0x49b7e7=_0x33e053['length'];if(!_0x2bf1d3[_0x4103('0x48')]['hasOwnProperty'](_0x4103('0x50'))){_0x38e8c7[_0x4103('0x2e')]=qs[_0x4103('0x2e')](_0x2bf1d3[_0x4103('0x48')]['limit']);_0x38e8c7[_0x4103('0x2c')]=qs['offset'](_0x2bf1d3['query'][_0x4103('0x2c')]);}return _0x300ae7[_0x4103('0xbe')](_0x38e8c7);}})[_0x4103('0x1e')](function(_0x1703fa){if(_0x1703fa){return _0x1703fa?{'count':_0x49b7e7,'rows':_0x1703fa}:null;}})[_0x4103('0x1e')](respondWithResult(_0xc9d419,null))[_0x4103('0x27')](handleError(_0xc9d419,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c4ac64e..8e541d5 100644 --- a/server/api/faxAccount/faxAccount.events.js +++ b/server/api/faxAccount/faxAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb576=['exports','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x4173cc,_0x3b224f){var _0x171776=function(_0x173472){while(--_0x173472){_0x4173cc['push'](_0x4173cc['shift']());}};_0x171776(++_0x3b224f);}(_0xb576,0x1cf));var _0x6b57=function(_0x36006d,_0x206c39){_0x36006d=_0x36006d-0x0;var _0x10f33f=_0xb576[_0x36006d];return _0x10f33f;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x6b57('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b57('0x1'),'afterUpdate':'update','afterDestroy':_0x6b57('0x2')};function emitEvent(_0x4e044e){return function(_0x2f8f0b,_0x34e19a,_0x2566ac){FaxAccountEvents[_0x6b57('0x3')](_0x4e044e+':'+_0x2f8f0b['id'],_0x2f8f0b);FaxAccountEvents[_0x6b57('0x3')](_0x4e044e,_0x2f8f0b);_0x2566ac(null);};}for(var e in events){if(events[_0x6b57('0x4')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x6b57('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0x3290=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x3807a2,_0x12365e){var _0x42f5af=function(_0x5a2465){while(--_0x5a2465){_0x3807a2['push'](_0x3807a2['shift']());}};_0x42f5af(++_0x12365e);}(_0x3290,0x1b1));var _0x0329=function(_0x313820,_0x567344){_0x313820=_0x313820-0x0;var _0x3ee6dd=_0x3290[_0x313820];return _0x3ee6dd;};'use strict';var EventEmitter=require(_0x0329('0x0'));var FaxAccount=require(_0x0329('0x1'))['db'][_0x0329('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0329('0x3')](0x0);var events={'afterCreate':_0x0329('0x4'),'afterUpdate':_0x0329('0x5'),'afterDestroy':_0x0329('0x6')};function emitEvent(_0x1d714b){return function(_0x3db536,_0x4bbb6c,_0x29b2a2){FaxAccountEvents[_0x0329('0x7')](_0x1d714b+':'+_0x3db536['id'],_0x3db536);FaxAccountEvents[_0x0329('0x7')](_0x1d714b,_0x3db536);_0x29b2a2(null);};}for(var e in events){if(events[_0x0329('0x8')](e)){var event=events[e];FaxAccount[_0x0329('0x9')](e,emitEvent(event));}}module[_0x0329('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 2c96152..611fb6b 100644 --- a/server/api/faxAccount/faxAccount.model.js +++ b/server/api/faxAccount/faxAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf54a=['exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf54a,0x1cb));var _0xaf54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf54a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaf54('0x0'));var util=require(_0xaf54('0x1'));var logger=require(_0xaf54('0x2'))(_0xaf54('0x3'));var moment=require(_0xaf54('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf54('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf54('0x6'));var config=require(_0xaf54('0x7'));var attributes=require(_0xaf54('0x8'));module[_0xaf54('0x9')]=function(_0x53eb3b,_0x478fe3){return _0x53eb3b['define'](_0xaf54('0xa'),attributes,{'tableName':_0xaf54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86ba=['path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5a36dd,_0x5b2d2c){var _0x15503d=function(_0x59d3c7){while(--_0x59d3c7){_0x5a36dd['push'](_0x5a36dd['shift']());}};_0x15503d(++_0x5b2d2c);}(_0x86ba,0x180));var _0xa86b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x86ba[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xa86b('0x0'));var util=require(_0xa86b('0x1'));var logger=require('../../config/logger')(_0xa86b('0x2'));var moment=require(_0xa86b('0x3'));var BPromise=require(_0xa86b('0x4'));var rp=require(_0xa86b('0x5'));var fs=require('fs');var path=require(_0xa86b('0x6'));var rimraf=require(_0xa86b('0x7'));var config=require('../../config/environment');var attributes=require(_0xa86b('0x8'));module[_0xa86b('0x9')]=function(_0x3384e7,_0x146997){return _0x3384e7[_0xa86b('0xa')](_0xa86b('0xb'),attributes,{'tableName':_0xa86b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index e26c64c..9cc70bc 100644 --- a/server/api/faxAccount/faxAccount.rpc.js +++ b/server/api/faxAccount/faxAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71f7=['where','attributes','limit','include','model','map','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','CmList','Contacts','DESC','FaxApplication','List','get','applications','list','orderBy','priority','asc','Applications','length','create','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x71f7,0x1a7));var _0x771f=function(_0x8cd896,_0x1b28ba){_0x8cd896=_0x8cd896-0x0;var _0xc4af92=_0x71f7[_0x8cd896];return _0xc4af92;};'use strict';var _=require(_0x771f('0x0'));var util=require(_0x771f('0x1'));var moment=require('moment');var BPromise=require(_0x771f('0x2'));var rs=require(_0x771f('0x3'));var fs=require('fs');var Redis=require(_0x771f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x771f('0x5'));var config=require('../../config/environment');var jayson=require(_0x771f('0x6'));var client=jayson[_0x771f('0x7')][_0x771f('0x8')]({'port':0x232c});config[_0x771f('0x9')]=_[_0x771f('0xa')](config[_0x771f('0x9')],{'host':_0x771f('0xb'),'port':0x18eb});var socket=require(_0x771f('0xc'))(new Redis(config[_0x771f('0x9')]));require(_0x771f('0xd'))[_0x771f('0xe')](socket);function respondWithRpcPromise(_0xa1508d,_0x1847f8,_0x72a1a0){return new BPromise(function(_0x29a041,_0x3a49ae){return client[_0x771f('0xf')](_0xa1508d,_0x72a1a0)['then'](function(_0x59af22){logger[_0x771f('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1847f8,_0x771f('0x11'));logger[_0x771f('0x12')](_0x771f('0x13'),_0x1847f8,'request\x20sent',JSON[_0x771f('0x14')](_0x59af22));if(_0x59af22[_0x771f('0x15')]){if(_0x59af22[_0x771f('0x15')][_0x771f('0x16')]===0x1f4){logger[_0x771f('0x15')](_0x771f('0x17'),_0x1847f8,_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);return _0x3a49ae(_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);}logger['error'](_0x771f('0x17'),_0x1847f8,_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);return _0x29a041(_0x59af22[_0x771f('0x15')][_0x771f('0x18')]);}else{logger[_0x771f('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1847f8,_0x771f('0x11'));_0x29a041(_0x59af22[_0x771f('0x19')][_0x771f('0x18')]);}})[_0x771f('0x1a')](function(_0xdfc895){logger[_0x771f('0x15')](_0x771f('0x17'),_0x1847f8,_0xdfc895);_0x3a49ae(_0xdfc895);});});}exports[_0x771f('0x1b')]=function(_0x16f227){var _0xbff02a=this;return new Promise(function(_0x490816,_0x36c565){return db[_0x771f('0x1c')][_0x771f('0x1d')]({'raw':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x1f')]===undefined?!![]:![]:!![],'where':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x20')]||null:null,'attributes':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x21')]||null:null,'limit':_0x16f227[_0x771f('0x1e')]?_0x16f227[_0x771f('0x1e')][_0x771f('0x22')]||null:null,'include':_0x16f227['options']?_0x16f227[_0x771f('0x1e')][_0x771f('0x23')]?_['map'](_0x16f227[_0x771f('0x1e')]['include'],function(_0x3162af){return{'model':db[_0x3162af[_0x771f('0x24')]],'as':_0x3162af['as'],'attributes':_0x3162af[_0x771f('0x21')],'include':_0x3162af[_0x771f('0x23')]?_['map'](_0x3162af[_0x771f('0x23')],function(_0x557ce1){return{'model':db[_0x557ce1[_0x771f('0x24')]],'as':_0x557ce1['as'],'attributes':_0x557ce1[_0x771f('0x21')],'include':_0x557ce1['include']?_[_0x771f('0x25')](_0x557ce1[_0x771f('0x23')],function(_0x2b7e95){return{'model':db[_0x2b7e95['model']],'as':_0x2b7e95['as'],'attributes':_0x2b7e95['attributes']};}):[]};}):[]};}):[]:[]})[_0x771f('0x26')](function(_0x18f821){logger['info']('GetFaxAccount',_0x16f227);logger[_0x771f('0x12')]('GetFaxAccount',_0x16f227,JSON[_0x771f('0x14')](_0x18f821));_0x490816(_0x18f821);})['catch'](function(_0x3c0853){logger[_0x771f('0x15')](_0x771f('0x1b'),_0x3c0853['message'],_0x16f227);_0x36c565(_0xbff02a[_0x771f('0x15')](0x1f4,_0x3c0853[_0x771f('0x18')]));});});};exports[_0x771f('0x27')]=function(_0x4a4c4a,_0x3cf9e1,_0x2b3ef8){var _0x586075=this;return new Promise(function(_0x4935c7,_0x380dc6){var _0x572f34={'body':_0x4a4c4a[_0x771f('0x28')],'channel':_0x771f('0x29')};var _0xed3bb8=[];var _0x3f3ab2=[];var _0x1ac4dc={};return db[_0x771f('0x2a')][_0x771f('0x2b')]()[_0x771f('0x26')](function(_0x2f3d50){if(!_0x2f3d50){throw new db[(_0x771f('0x2c'))][(_0x771f('0x2d'))](_0x771f('0x2e'));}_0xed3bb8=_[_0x771f('0x2f')](_[_0x771f('0x30')](_0x2f3d50),[_0x771f('0x31'),'updatedAt']);_0x3f3ab2=_[_0x771f('0x2f')](_[_0x771f('0x30')](_0x2f3d50),['createdAt',_0x771f('0x32'),_0x771f('0x33'),_0x771f('0x34')]);if(_0x4a4c4a['body']['id']){delete _0x4a4c4a[_0x771f('0x28')]['id'];}if(_['isNil'](_0x4a4c4a['body']['from'])){throw new db[(_0x771f('0x2c'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x4a4c4a[_0x771f('0x28')][_0x771f('0x28')])||_0x4a4c4a[_0x771f('0x28')][_0x771f('0x28')]===''){throw new db[(_0x771f('0x2c'))][(_0x771f('0x2d'))](_0x771f('0x35'));}if(_['isNil'](_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')])){throw new db['Sequelize'][(_0x771f('0x2d'))](_0x771f('0x37')+_0x3f3ab2);}if(!_[_0x771f('0x38')](_0x3f3ab2,_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')])){throw new db['Sequelize'][(_0x771f('0x2d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f3ab2);}_0x1ac4dc[_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')]]=_0x4a4c4a['body']['from'];})['then'](function(){return db[_0x771f('0x1c')][_0x771f('0x39')]({'where':{'id':_0x4a4c4a[_0x771f('0x3a')]['id']},'include':[{'model':db[_0x771f('0x3b')],'as':'List','include':[{'model':db[_0x771f('0x2a')],'as':_0x771f('0x3c'),'where':_0x1ac4dc,'limit':0x1,'order':[['updatedAt',_0x771f('0x3d')]]}]},{'model':db[_0x771f('0x3e')],'as':'Applications'}]});})[_0x771f('0x26')](function(_0x3d9476){if(_0x3d9476&&_0x3d9476[_0x771f('0x3f')]){var _0x5b941f=_0x3d9476[_0x771f('0x40')]({'plain':!![]});_0x572f34[_0x771f('0x3a')]=_0x5b941f;_0x572f34[_0x771f('0x41')]=_0x5b941f['Applications'];_0x572f34[_0x771f('0x42')]=_0x5b941f[_0x771f('0x3f')];_0x572f34[_0x771f('0x41')]=_[_0x771f('0x43')](_0x572f34[_0x771f('0x41')],[_0x771f('0x44')],[_0x771f('0x45')]);if(_0x572f34[_0x771f('0x3a')][_0x771f('0x46')]){delete _0x572f34[_0x771f('0x3a')][_0x771f('0x46')];}if(_0x572f34['account']['List']&&_0x572f34[_0x771f('0x3a')]['List'][_0x771f('0x3c')][_0x771f('0x47')]){return _0x572f34[_0x771f('0x3a')][_0x771f('0x3f')][_0x771f('0x3c')][0x0];}var _0x4db24e=_['defaults'](_0x4a4c4a['body'],{'firstName':_0x4a4c4a[_0x771f('0x28')]['from'],'ListId':_0x5b941f[_0x771f('0x34')]});_0x4db24e[_0x4a4c4a[_0x771f('0x28')][_0x771f('0x36')]]=_0x4a4c4a[_0x771f('0x28')]['from'];return db[_0x771f('0x2a')][_0x771f('0x48')](_0x4db24e,{'fields':_0xed3bb8,'raw':!![]});}})[_0x771f('0x26')](function(_0x276c66){_0x572f34['contact']=_0x276c66;if(_0x276c66){var _0x40f775={'ContactId':_0x276c66['id'],'FaxAccountId':_0x4a4c4a[_0x771f('0x3a')]['id'],'fax':_0x276c66['fax']};return db['FaxInteraction']['find']({'where':{'ContactId':_0x276c66['id'],'closed':![],'FaxAccountId':_0x4a4c4a['account']['id']}})['then'](function(_0x4e48ca){if(_0x4e48ca){return[_0x4e48ca,![]];}return db[_0x771f('0x49')]['create'](_0x40f775)[_0x771f('0x26')](function(_0x576d39){return[_0x576d39,!![]];});});}else{throw new Error(_0x771f('0x4a'));}})['spread'](function(_0x460d01,_0x2f344c){var _0xef3e47=_0x460d01[_0x771f('0x40')]({'plain':!![]});if(_0x2f344c){if(_0x572f34['account']['autoclose']){_0x572f34[_0x771f('0x41')][_0x771f('0x4b')]({'id':0x0,'priority':_0x572f34['applications']['length']+0x1,'app':_0x771f('0x4c'),'appdata':_0x771f('0x4d'),'interval':_0x771f('0x4e')});}_0xef3e47[_0x771f('0x4f')]=!![];}else{_0xef3e47[_0x771f('0x4f')]=![];}_0x572f34[_0x771f('0x50')]=_0xef3e47;return db[_0x771f('0x51')][_0x771f('0x48')]({'body':_0x4a4c4a[_0x771f('0x28')][_0x771f('0x28')],'FaxAccountId':_0x4a4c4a['account']['id'],'FaxInteractionId':_0x460d01['id'],'direction':'in','ContactId':_0x460d01[_0x771f('0x52')],'AttachmentId':_0x4a4c4a[_0x771f('0x28')][_0x771f('0x53')]});})['then'](function(_0xf11165){_0x572f34[_0x771f('0x18')]=_0xf11165;if(_0x572f34[_0x771f('0x50')][_0x771f('0x54')]){return db[_0x771f('0x55')][_0x771f('0x39')]({'attributes':['id','name'],'where':{'id':_0x572f34[_0x771f('0x50')][_0x771f('0x54')]}})['then'](function(_0x9d8c58){if(_0x9d8c58){_0x572f34[_0x771f('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0x771f('0x56'),'appdata':_0x9d8c58[_0x771f('0x57')]+','+(_0x572f34[_0x771f('0x3a')][_0x771f('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x771f('0x59'),_0x771f('0x5a'),_0x572f34);});}return respondWithRpcPromise(_0x771f('0x59'),_0x771f('0x5a'),_0x572f34);})[_0x771f('0x26')](function(_0xb2d590){_0x4935c7(_0xb2d590);})[_0x771f('0x1a')](function(_0x363b92){_0x380dc6(_0x586075['error'](0x1f4,_0x363b92[_0x771f('0x18')]));});});}; \ No newline at end of file +var _0x3f91=['request\x20sent','error','code','message','info','result','catch','GetFaxAccount','findAll','options','raw','include','map','model','attributes','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','keys','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','updatedAt','DESC','FaxApplication','get','applications','Applications','list','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','unshift','Start','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s'];(function(_0x383cbc,_0xeaa783){var _0x48d876=function(_0x266321){while(--_0x266321){_0x383cbc['push'](_0x383cbc['shift']());}};_0x48d876(++_0xeaa783);}(_0x3f91,0x99));var _0x13f9=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3f91[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x13f9('0x0'));var BPromise=require(_0x13f9('0x1'));var rs=require(_0x13f9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13f9('0x3'))['db'];var utils=require(_0x13f9('0x4'));var logger=require(_0x13f9('0x5'))(_0x13f9('0x6'));var config=require(_0x13f9('0x7'));var jayson=require(_0x13f9('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x13f9('0x9')]=_[_0x13f9('0xa')](config[_0x13f9('0x9')],{'host':_0x13f9('0xb'),'port':0x18eb});var socket=require(_0x13f9('0xc'))(new Redis(config[_0x13f9('0x9')]));require(_0x13f9('0xd'))[_0x13f9('0xe')](socket);function respondWithRpcPromise(_0x2fc598,_0x115cb7,_0x56f492){return new BPromise(function(_0x13d79a,_0x1fb558){return client[_0x13f9('0xf')](_0x2fc598,_0x56f492)['then'](function(_0x36cc63){logger['info'](_0x13f9('0x10'),_0x115cb7,'request\x20sent');logger[_0x13f9('0x11')](_0x13f9('0x12'),_0x115cb7,_0x13f9('0x13'),JSON['stringify'](_0x36cc63));if(_0x36cc63[_0x13f9('0x14')]){if(_0x36cc63[_0x13f9('0x14')][_0x13f9('0x15')]===0x1f4){logger[_0x13f9('0x14')](_0x13f9('0x10'),_0x115cb7,_0x36cc63['error']['message']);return _0x1fb558(_0x36cc63[_0x13f9('0x14')][_0x13f9('0x16')]);}logger[_0x13f9('0x14')](_0x13f9('0x10'),_0x115cb7,_0x36cc63['error']['message']);return _0x13d79a(_0x36cc63[_0x13f9('0x14')][_0x13f9('0x16')]);}else{logger[_0x13f9('0x17')](_0x13f9('0x10'),_0x115cb7,_0x13f9('0x13'));_0x13d79a(_0x36cc63[_0x13f9('0x18')][_0x13f9('0x16')]);}})[_0x13f9('0x19')](function(_0x5c2da2){logger['error'](_0x13f9('0x10'),_0x115cb7,_0x5c2da2);_0x1fb558(_0x5c2da2);});});}exports[_0x13f9('0x1a')]=function(_0x5dc95e){var _0x15ecc3=this;return new Promise(function(_0x3f5226,_0xf06a13){return db['FaxAccount'][_0x13f9('0x1b')]({'raw':_0x5dc95e['options']?_0x5dc95e[_0x13f9('0x1c')][_0x13f9('0x1d')]===undefined?!![]:![]:!![],'where':_0x5dc95e['options']?_0x5dc95e[_0x13f9('0x1c')]['where']||null:null,'attributes':_0x5dc95e[_0x13f9('0x1c')]?_0x5dc95e[_0x13f9('0x1c')]['attributes']||null:null,'limit':_0x5dc95e['options']?_0x5dc95e[_0x13f9('0x1c')]['limit']||null:null,'include':_0x5dc95e[_0x13f9('0x1c')]?_0x5dc95e[_0x13f9('0x1c')][_0x13f9('0x1e')]?_[_0x13f9('0x1f')](_0x5dc95e[_0x13f9('0x1c')][_0x13f9('0x1e')],function(_0x292d26){return{'model':db[_0x292d26[_0x13f9('0x20')]],'as':_0x292d26['as'],'attributes':_0x292d26[_0x13f9('0x21')],'include':_0x292d26['include']?_['map'](_0x292d26[_0x13f9('0x1e')],function(_0x76700f){return{'model':db[_0x76700f[_0x13f9('0x20')]],'as':_0x76700f['as'],'attributes':_0x76700f[_0x13f9('0x21')],'include':_0x76700f[_0x13f9('0x1e')]?_[_0x13f9('0x1f')](_0x76700f[_0x13f9('0x1e')],function(_0x54e108){return{'model':db[_0x54e108['model']],'as':_0x54e108['as'],'attributes':_0x54e108[_0x13f9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x13f9('0x22')](function(_0x3f03e7){logger['info'](_0x13f9('0x1a'),_0x5dc95e);logger[_0x13f9('0x11')]('GetFaxAccount',_0x5dc95e,JSON['stringify'](_0x3f03e7));_0x3f5226(_0x3f03e7);})['catch'](function(_0xd30005){logger[_0x13f9('0x14')](_0x13f9('0x1a'),_0xd30005[_0x13f9('0x16')],_0x5dc95e);_0xf06a13(_0x15ecc3[_0x13f9('0x14')](0x1f4,_0xd30005[_0x13f9('0x16')]));});});};exports[_0x13f9('0x23')]=function(_0xf67ec3,_0x172f6a,_0xf0c1a1){var _0x5306c8=this;return new Promise(function(_0x33026f,_0x2eb84d){var _0x415f87={'body':_0xf67ec3[_0x13f9('0x24')],'channel':_0x13f9('0x25')};var _0x3ba5e6=[];var _0xb14908=[];var _0x603ed5={};return db[_0x13f9('0x26')][_0x13f9('0x27')]()['then'](function(_0x209c63){if(!_0x209c63){throw new db[(_0x13f9('0x28'))][(_0x13f9('0x29'))]('no\x20available\x20attributes');}_0x3ba5e6=_['difference'](_[_0x13f9('0x2a')](_0x209c63),[_0x13f9('0x2b'),'updatedAt']);_0xb14908=_['difference'](_[_0x13f9('0x2a')](_0x209c63),['createdAt','updatedAt',_0x13f9('0x2c'),_0x13f9('0x2d')]);if(_0xf67ec3[_0x13f9('0x24')]['id']){delete _0xf67ec3['body']['id'];}if(_['isNil'](_0xf67ec3[_0x13f9('0x24')][_0x13f9('0x2e')])){throw new db[(_0x13f9('0x28'))][(_0x13f9('0x29'))](_0x13f9('0x2f'));}if(_[_0x13f9('0x30')](_0xf67ec3['body'][_0x13f9('0x24')])||_0xf67ec3['body'][_0x13f9('0x24')]===''){throw new db['Sequelize'][(_0x13f9('0x29'))](_0x13f9('0x31'));}if(_[_0x13f9('0x30')](_0xf67ec3[_0x13f9('0x24')][_0x13f9('0x32')])){throw new db[(_0x13f9('0x28'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb14908);}if(!_[_0x13f9('0x33')](_0xb14908,_0xf67ec3[_0x13f9('0x24')][_0x13f9('0x32')])){throw new db[(_0x13f9('0x28'))][(_0x13f9('0x29'))](_0x13f9('0x34')+_0xb14908);}_0x603ed5[_0xf67ec3['body'][_0x13f9('0x32')]]=_0xf67ec3[_0x13f9('0x24')]['from'];})[_0x13f9('0x22')](function(){return db[_0x13f9('0x35')][_0x13f9('0x36')]({'where':{'id':_0xf67ec3[_0x13f9('0x37')]['id']},'include':[{'model':db[_0x13f9('0x38')],'as':_0x13f9('0x39'),'include':[{'model':db[_0x13f9('0x26')],'as':_0x13f9('0x3a'),'where':_0x603ed5,'limit':0x1,'order':[[_0x13f9('0x3b'),_0x13f9('0x3c')]]}]},{'model':db[_0x13f9('0x3d')],'as':'Applications'}]});})[_0x13f9('0x22')](function(_0x1e8542){if(_0x1e8542&&_0x1e8542[_0x13f9('0x39')]){var _0x2d96bd=_0x1e8542[_0x13f9('0x3e')]({'plain':!![]});_0x415f87['account']=_0x2d96bd;_0x415f87[_0x13f9('0x3f')]=_0x2d96bd[_0x13f9('0x40')];_0x415f87[_0x13f9('0x41')]=_0x2d96bd[_0x13f9('0x39')];_0x415f87['applications']=_['orderBy'](_0x415f87[_0x13f9('0x3f')],[_0x13f9('0x42')],['asc']);if(_0x415f87[_0x13f9('0x37')]['Applications']){delete _0x415f87[_0x13f9('0x37')][_0x13f9('0x40')];}if(_0x415f87[_0x13f9('0x37')][_0x13f9('0x39')]&&_0x415f87['account'][_0x13f9('0x39')][_0x13f9('0x3a')][_0x13f9('0x43')]){return _0x415f87[_0x13f9('0x37')][_0x13f9('0x39')][_0x13f9('0x3a')][0x0];}var _0x137148=_['defaults'](_0xf67ec3[_0x13f9('0x24')],{'firstName':_0xf67ec3[_0x13f9('0x24')][_0x13f9('0x2e')],'ListId':_0x2d96bd[_0x13f9('0x2d')]});_0x137148[_0xf67ec3['body'][_0x13f9('0x32')]]=_0xf67ec3[_0x13f9('0x24')][_0x13f9('0x2e')];return db[_0x13f9('0x26')][_0x13f9('0x44')](_0x137148,{'fields':_0x3ba5e6,'raw':!![]});}})[_0x13f9('0x22')](function(_0x44ea69){_0x415f87[_0x13f9('0x45')]=_0x44ea69;if(_0x44ea69){var _0x7a6cc4={'ContactId':_0x44ea69['id'],'FaxAccountId':_0xf67ec3[_0x13f9('0x37')]['id'],'fax':_0x44ea69[_0x13f9('0x25')]};return db[_0x13f9('0x46')][_0x13f9('0x36')]({'where':{'ContactId':_0x44ea69['id'],'closed':![],'FaxAccountId':_0xf67ec3[_0x13f9('0x37')]['id']}})[_0x13f9('0x22')](function(_0x46f997){if(_0x46f997){return[_0x46f997,![]];}return db[_0x13f9('0x46')][_0x13f9('0x44')](_0x7a6cc4)['then'](function(_0xce91b5){return[_0xce91b5,!![]];});});}else{throw new Error(_0x13f9('0x47'));}})[_0x13f9('0x48')](function(_0x4a9e52,_0x437ed2){var _0x431c15=_0x4a9e52['get']({'plain':!![]});if(_0x437ed2){if(_0x415f87[_0x13f9('0x37')][_0x13f9('0x49')]){_0x415f87[_0x13f9('0x3f')]['push']({'id':0x0,'priority':_0x415f87[_0x13f9('0x3f')][_0x13f9('0x43')]+0x1,'app':_0x13f9('0x4a'),'appdata':_0x13f9('0x4b'),'interval':_0x13f9('0x4c')});}_0x431c15[_0x13f9('0x4d')]=!![];}else{_0x431c15[_0x13f9('0x4d')]=![];}_0x415f87[_0x13f9('0x4e')]=_0x431c15;return db['FaxMessage'][_0x13f9('0x44')]({'body':_0xf67ec3['body'][_0x13f9('0x24')],'FaxAccountId':_0xf67ec3[_0x13f9('0x37')]['id'],'FaxInteractionId':_0x4a9e52['id'],'direction':'in','ContactId':_0x4a9e52[_0x13f9('0x4f')],'AttachmentId':_0xf67ec3['body'][_0x13f9('0x50')]});})[_0x13f9('0x22')](function(_0x34dada){_0x415f87[_0x13f9('0x16')]=_0x34dada;if(_0x415f87[_0x13f9('0x4e')][_0x13f9('0x51')]){return db[_0x13f9('0x52')][_0x13f9('0x36')]({'attributes':['id','name'],'where':{'id':_0x415f87[_0x13f9('0x4e')][_0x13f9('0x51')]}})[_0x13f9('0x22')](function(_0x537dd9){if(_0x537dd9){_0x415f87[_0x13f9('0x3f')][_0x13f9('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x537dd9['name']+','+(_0x415f87[_0x13f9('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x13f9('0x4c')});}return respondWithRpcPromise(_0x13f9('0x54'),_0x13f9('0x55'),_0x415f87);});}return respondWithRpcPromise('Start','startRouting',_0x415f87);})[_0x13f9('0x22')](function(_0x4003f7){_0x33026f(_0x4003f7);})[_0x13f9('0x19')](function(_0x1f6336){_0x2eb84d(_0x5306c8[_0x13f9('0x14')](0x1f4,_0x1f6336[_0x13f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a877a38..f9d40df 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d04=['remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events','save'];(function(_0x2ba11a,_0x44e5ea){var _0x5c63e6=function(_0x5ca06f){while(--_0x5ca06f){_0x2ba11a['push'](_0x2ba11a['shift']());}};_0x5c63e6(++_0x44e5ea);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var FaxAccountEvents=require(_0x43d0('0x0'));var events=[_0x43d0('0x1'),_0x43d0('0x2'),_0x43d0('0x3')];function createListener(_0x191de5,_0x143fea){return function(_0x3d6e62){_0x143fea[_0x43d0('0x4')](_0x191de5,_0x3d6e62);};}function removeListener(_0x5a9e1d,_0x2a4d4c){return function(){FaxAccountEvents[_0x43d0('0x5')](_0x5a9e1d,_0x2a4d4c);};}exports[_0x43d0('0x6')]=function(_0x617bf){for(var _0x5e284f=0x0,_0x484271=events['length'];_0x5e284f<_0x484271;_0x5e284f++){var _0x5efb95=events[_0x5e284f];var _0x457550=createListener(_0x43d0('0x7')+_0x5efb95,_0x617bf);FaxAccountEvents['on'](_0x5efb95,_0x457550);}}; \ No newline at end of file +var _0x4991=['length','faxAccount:','./faxAccount.events','remove','emit','removeListener','register'];(function(_0x482396,_0x2c242b){var _0x50bc94=function(_0x561651){while(--_0x561651){_0x482396['push'](_0x482396['shift']());}};_0x50bc94(++_0x2c242b);}(_0x4991,0xf7));var _0x1499=function(_0x588b1f,_0x4f2d01){_0x588b1f=_0x588b1f-0x0;var _0x3d9ce6=_0x4991[_0x588b1f];return _0x3d9ce6;};'use strict';var FaxAccountEvents=require(_0x1499('0x0'));var events=['save',_0x1499('0x1'),'update'];function createListener(_0x30d640,_0x256e41){return function(_0x16ac22){_0x256e41[_0x1499('0x2')](_0x30d640,_0x16ac22);};}function removeListener(_0x1b291f,_0x158134){return function(){FaxAccountEvents[_0x1499('0x3')](_0x1b291f,_0x158134);};}exports[_0x1499('0x4')]=function(_0x4b6154){for(var _0x2a8e96=0x0,_0x1c3bd7=events[_0x1499('0x5')];_0x2a8e96<_0x1c3bd7;_0x2a8e96++){var _0x33b261=events[_0x2a8e96];var _0x133bae=createListener(_0x1499('0x6')+_0x33b261,_0x4b6154);FaxAccountEvents['on'](_0x33b261,_0x133bae);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index c1a1680..f778d7a 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17c5=['updateAccountApplications','/:id/send','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications'];(function(_0x580e94,_0x38c54a){var _0x47e041=function(_0x50d99c){while(--_0x50d99c){_0x580e94['push'](_0x580e94['shift']());}};_0x47e041(++_0x38c54a);}(_0x17c5,0xbe));var _0x517c=function(_0x408b34,_0x868761){_0x408b34=_0x408b34-0x0;var _0x2b40fa=_0x17c5[_0x408b34];return _0x2b40fa;};'use strict';var multer=require(_0x517c('0x0'));var util=require(_0x517c('0x1'));var path=require('path');var timeout=require(_0x517c('0x2'));var express=require(_0x517c('0x3'));var router=express[_0x517c('0x4')]();var fs_extra=require(_0x517c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x517c('0x6'));var config=require(_0x517c('0x7'));var controller=require(_0x517c('0x8'));router[_0x517c('0x9')]('/',auth[_0x517c('0xa')](),controller[_0x517c('0xb')]);router['get'](_0x517c('0xc'),auth[_0x517c('0xa')](),controller[_0x517c('0xd')]);router['get'](_0x517c('0xe'),auth[_0x517c('0xa')](),controller[_0x517c('0xf')]);router[_0x517c('0x9')](_0x517c('0x10'),auth[_0x517c('0xa')](),controller[_0x517c('0x11')]);router[_0x517c('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x517c('0x9')](_0x517c('0x12'),auth[_0x517c('0xa')](),controller[_0x517c('0x13')]);router[_0x517c('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x517c('0x14')]);router[_0x517c('0x9')](_0x517c('0x15'),auth[_0x517c('0xa')](),controller[_0x517c('0x16')]);router['get']('/:id/users',auth[_0x517c('0xa')](),controller[_0x517c('0x17')]);router[_0x517c('0x18')]('/',auth['isAuthenticated'](),controller[_0x517c('0x19')]);router['post']('/:id/dispositions',auth[_0x517c('0xa')](),controller[_0x517c('0x1a')]);router['post'](_0x517c('0x1b'),auth['isAuthenticated'](),controller[_0x517c('0x1c')]);router['post'](_0x517c('0x12'),auth['isAuthenticated'](),controller[_0x517c('0x1d')]);router[_0x517c('0x18')](_0x517c('0x1e'),auth['isAuthenticated'](),controller[_0x517c('0x1f')]);router[_0x517c('0x18')](_0x517c('0x20'),auth['isAuthenticated'](),controller[_0x517c('0x21')]);router[_0x517c('0x18')](_0x517c('0x22'),auth['isAuthenticated'](),controller[_0x517c('0x23')]);router[_0x517c('0x18')](_0x517c('0x24'),auth[_0x517c('0xa')](),controller['send']);router[_0x517c('0x18')](_0x517c('0x25'),auth[_0x517c('0xa')](),controller[_0x517c('0x26')]);router[_0x517c('0x27')](_0x517c('0xe'),auth[_0x517c('0xa')](),controller['update']);router[_0x517c('0x28')](_0x517c('0xe'),auth['isAuthenticated'](),controller[_0x517c('0x29')]);router[_0x517c('0x28')](_0x517c('0x10'),auth['isAuthenticated'](),controller[_0x517c('0x2a')]);router[_0x517c('0x28')](_0x517c('0x1b'),auth[_0x517c('0xa')](),controller[_0x517c('0x2b')]);router['delete'](_0x517c('0x25'),auth[_0x517c('0xa')](),controller['removeAgents']);module[_0x517c('0x2c')]=router; \ No newline at end of file +var _0xa581=['removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','addDisposition','post','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xa581,0xa8));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1a58('0x0'));var path=require('path');var timeout=require(_0x1a58('0x1'));var express=require(_0x1a58('0x2'));var router=express[_0x1a58('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1a58('0x4'));var interaction=require(_0x1a58('0x5'));var config=require(_0x1a58('0x6'));var controller=require(_0x1a58('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1a58('0x8')](_0x1a58('0x9'),auth[_0x1a58('0xa')](),controller[_0x1a58('0xb')]);router['get'](_0x1a58('0xc'),auth[_0x1a58('0xa')](),controller['show']);router['get'](_0x1a58('0xd'),auth[_0x1a58('0xa')](),controller[_0x1a58('0xe')]);router[_0x1a58('0x8')](_0x1a58('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x1a58('0x8')](_0x1a58('0x10'),auth[_0x1a58('0xa')](),controller['getInteractions']);router[_0x1a58('0x8')](_0x1a58('0x11'),auth[_0x1a58('0xa')](),controller[_0x1a58('0x12')]);router[_0x1a58('0x8')]('/:id/messages',auth[_0x1a58('0xa')](),controller[_0x1a58('0x13')]);router[_0x1a58('0x8')](_0x1a58('0x14'),auth[_0x1a58('0xa')](),controller['getAgents']);router['post']('/',auth[_0x1a58('0xa')](),controller['create']);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1a58('0x15')]);router[_0x1a58('0x16')](_0x1a58('0xf'),auth[_0x1a58('0xa')](),controller[_0x1a58('0x17')]);router[_0x1a58('0x16')]('/:id/interactions',auth[_0x1a58('0xa')](),controller[_0x1a58('0x18')]);router[_0x1a58('0x16')](_0x1a58('0x11'),auth['isAuthenticated'](),controller[_0x1a58('0x19')]);router[_0x1a58('0x16')](_0x1a58('0x1a'),auth[_0x1a58('0xa')](),controller[_0x1a58('0x1b')]);router['post'](_0x1a58('0x1c'),auth['isAuthenticated'](),controller[_0x1a58('0x1d')]);router['post'](_0x1a58('0x1e'),auth[_0x1a58('0xa')](),controller[_0x1a58('0x1f')]);router[_0x1a58('0x16')](_0x1a58('0x14'),auth[_0x1a58('0xa')](),controller[_0x1a58('0x20')]);router[_0x1a58('0x21')]('/:id',auth[_0x1a58('0xa')](),controller[_0x1a58('0x22')]);router[_0x1a58('0x23')](_0x1a58('0xc'),auth[_0x1a58('0xa')](),controller[_0x1a58('0x24')]);router[_0x1a58('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1a58('0x25')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1a58('0x26')]);router[_0x1a58('0x23')](_0x1a58('0x14'),auth[_0x1a58('0xa')](),controller[_0x1a58('0x27')]);module[_0x1a58('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index ce7242a..96854ad 100644 --- a/server/api/faxApplication/faxApplication.attributes.js +++ b/server/api/faxApplication/faxApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a6e=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x4b6d85,_0x3cacc2){var _0x295a59=function(_0x456686){while(--_0x456686){_0x4b6d85['push'](_0x4b6d85['shift']());}};_0x295a59(++_0x3cacc2);}(_0x6a6e,0xe3));var _0xe6a6=function(_0x3ddefb,_0x2641f9){_0x3ddefb=_0x3ddefb-0x0;var _0x206cfc=_0x6a6e[_0x3ddefb];return _0x206cfc;};'use strict';var Sequelize=require(_0xe6a6('0x0'));module[_0xe6a6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe6a6('0x2')],'allowNull':![],'defaultValue':_0xe6a6('0x3')},'appdata':{'type':Sequelize[_0xe6a6('0x4')]()},'description':{'type':Sequelize[_0xe6a6('0x2')]},'interval':{'type':Sequelize[_0xe6a6('0x2')],'defaultValue':_0xe6a6('0x5')}}; \ No newline at end of file +var _0x7ea9=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0xeb5df6,_0x643353){var _0x1fea06=function(_0x4b4617){while(--_0x4b4617){_0xeb5df6['push'](_0xeb5df6['shift']());}};_0x1fea06(++_0x643353);}(_0x7ea9,0xec));var _0x97ea=function(_0x41fa7b,_0x48a986){_0x41fa7b=_0x41fa7b-0x0;var _0x2e14bc=_0x7ea9[_0x41fa7b];return _0x2e14bc;};'use strict';var Sequelize=require('sequelize');module[_0x97ea('0x0')]={'priority':{'type':Sequelize[_0x97ea('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x97ea('0x2')],'allowNull':![],'defaultValue':_0x97ea('0x3')},'appdata':{'type':Sequelize[_0x97ea('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x97ea('0x2')],'defaultValue':_0x97ea('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d395cb8..dc19c60 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3593=['fieldName','type','key','map','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','options','FaxApplication','includeAll','include','rows','catch','show','params','length','create','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','then','stack','name','send','render','merge','body','contact','message','agent','account','index','rawAttributes'];(function(_0x1a3ab3,_0x128a5b){var _0x482da8=function(_0x1bacec){while(--_0x1bacec){_0x1a3ab3['push'](_0x1a3ab3['shift']());}};_0x482da8(++_0x128a5b);}(_0x3593,0xb8));var _0x3359=function(_0x32f9ce,_0x3937be){_0x32f9ce=_0x32f9ce-0x0;var _0x3de330=_0x3593[_0x32f9ce];return _0x3de330;};'use strict';var emlformat=require(_0x3359('0x0'));var rimraf=require(_0x3359('0x1'));var zipdir=require(_0x3359('0x2'));var jsonpatch=require(_0x3359('0x3'));var rp=require(_0x3359('0x4'));var moment=require(_0x3359('0x5'));var BPromise=require(_0x3359('0x6'));var Mustache=require('mustache');var util=require(_0x3359('0x7'));var path=require('path');var sox=require(_0x3359('0x8'));var csv=require('to-csv');var ejs=require(_0x3359('0x9'));var fs=require('fs');var fs_extra=require(_0x3359('0xa'));var _=require(_0x3359('0xb'));var squel=require(_0x3359('0xc'));var crypto=require('crypto');var jsforce=require(_0x3359('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3359('0xe'));var querystring=require('querystring');var Papa=require(_0x3359('0xf'));var Redis=require(_0x3359('0x10'));var authService=require(_0x3359('0x11'));var qs=require(_0x3359('0x12'));var as=require(_0x3359('0x13'));var hardwareService=require(_0x3359('0x14'));var logger=require(_0x3359('0x15'))(_0x3359('0x16'));var utils=require(_0x3359('0x17'));var config=require(_0x3359('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3359('0x19'))['db'];function respondWithStatusCode(_0x3c7291,_0x29629d){_0x29629d=_0x29629d||0xcc;return function(_0x21f6fb){if(_0x21f6fb){return _0x3c7291[_0x3359('0x1a')](_0x29629d);}return _0x3c7291[_0x3359('0x1b')](_0x29629d)[_0x3359('0x1c')]();};}function respondWithResult(_0x40d524,_0x19ad13){_0x19ad13=_0x19ad13||0xc8;return function(_0x3a565d){if(_0x3a565d){return _0x40d524[_0x3359('0x1b')](_0x19ad13)[_0x3359('0x1d')](_0x3a565d);}};}function respondWithFilteredResult(_0x99344d,_0x16ae2a){return function(_0xd2f214){if(_0xd2f214){var _0x59a816=typeof _0x16ae2a[_0x3359('0x1e')]==='undefined'&&typeof _0x16ae2a[_0x3359('0x1f')]===_0x3359('0x20');var _0x3d04a6=_0xd2f214[_0x3359('0x21')];var _0x1c08e8=_0x59a816?0x0:_0x16ae2a[_0x3359('0x1e')];var _0xa22db=_0x59a816?_0xd2f214[_0x3359('0x21')]:_0x16ae2a['offset']+_0x16ae2a[_0x3359('0x1f')];var _0x303c74;if(_0xa22db>=_0x3d04a6){_0xa22db=_0x3d04a6;_0x303c74=0xc8;}else{_0x303c74=0xce;}_0x99344d[_0x3359('0x1b')](_0x303c74);return _0x99344d['set']('Content-Range',_0x1c08e8+'-'+_0xa22db+'/'+_0x3d04a6)[_0x3359('0x1d')](_0xd2f214);}return null;};}function patchUpdates(_0xd2b4e7){return function(_0x11025e){try{jsonpatch['apply'](_0x11025e,_0xd2b4e7,!![]);}catch(_0xf2bd1a){return BPromise[_0x3359('0x22')](_0xf2bd1a);}return _0x11025e[_0x3359('0x23')]();};}function saveUpdates(_0x3aa06a,_0x90034){return function(_0x3caa65){if(_0x3caa65){return _0x3caa65[_0x3359('0x24')](_0x3aa06a)[_0x3359('0x25')](function(_0x4d68e5){return _0x4d68e5;});}return null;};}function removeEntity(_0xf60dc9,_0x291977){return function(_0x3ef16d){if(_0x3ef16d){return _0x3ef16d['destroy']()[_0x3359('0x25')](function(){_0xf60dc9[_0x3359('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d9c7,_0x2263c3){return function(_0x12ac08){if(!_0x12ac08){_0x52d9c7[_0x3359('0x1a')](0x194);}return _0x12ac08;};}function handleError(_0xff1b68,_0x2e831e){_0x2e831e=_0x2e831e||0x1f4;return function(_0x343874){logger['error'](_0x343874[_0x3359('0x26')]);if(_0x343874['name']){delete _0x343874[_0x3359('0x27')];}_0xff1b68['status'](_0x2e831e)[_0x3359('0x28')](_0x343874);};}function getMustacheRender(_0x32ad12,_0x25cb53){return Mustache[_0x3359('0x29')](_0x32ad12,_[_0x3359('0x2a')](_0x25cb53[_0x3359('0x2b')],{'contact':_0x25cb53[_0x3359('0x2c')],'message':_0x25cb53[_0x3359('0x2d')],'agent':_0x25cb53[_0x3359('0x2e')],'interaction':_0x25cb53['interaction'],'account':_0x25cb53[_0x3359('0x2f')]}))||'';}exports[_0x3359('0x30')]=function(_0xcd8309,_0x5902c3){var _0x42be09={},_0x40a0e0={},_0x181b42={'count':0x0,'rows':[]};var _0x26aeb2=_['map'](db['FaxApplication'][_0x3359('0x31')],function(_0x49b713){return{'name':_0x49b713[_0x3359('0x32')],'type':_0x49b713[_0x3359('0x33')][_0x3359('0x34')]};});_0x40a0e0['model']=_[_0x3359('0x35')](_0x26aeb2,_0x3359('0x27'));_0x40a0e0['query']=_[_0x3359('0x36')](_0xcd8309[_0x3359('0x37')]);_0x40a0e0[_0x3359('0x38')]=_[_0x3359('0x39')](_0x40a0e0['model'],_0x40a0e0[_0x3359('0x37')]);_0x42be09[_0x3359('0x3a')]=_[_0x3359('0x39')](_0x40a0e0[_0x3359('0x3b')],qs[_0x3359('0x3c')](_0xcd8309[_0x3359('0x37')]['fields']));_0x42be09[_0x3359('0x3a')]=_0x42be09[_0x3359('0x3a')]['length']?_0x42be09['attributes']:_0x40a0e0[_0x3359('0x3b')];if(!_0xcd8309[_0x3359('0x37')][_0x3359('0x3d')]('nolimit')){_0x42be09[_0x3359('0x1f')]=qs[_0x3359('0x1f')](_0xcd8309['query'][_0x3359('0x1f')]);_0x42be09['offset']=qs[_0x3359('0x1e')](_0xcd8309[_0x3359('0x37')][_0x3359('0x1e')]);}_0x42be09[_0x3359('0x3e')]=qs[_0x3359('0x3f')](_0xcd8309['query'][_0x3359('0x3f')]);_0x42be09[_0x3359('0x40')]=qs[_0x3359('0x38')](_[_0x3359('0x41')](_0xcd8309[_0x3359('0x37')],_0x40a0e0['filters']),_0x26aeb2);if(_0xcd8309[_0x3359('0x37')][_0x3359('0x42')]){_0x42be09[_0x3359('0x40')]=_[_0x3359('0x2a')](_0x42be09[_0x3359('0x40')],{'$or':_[_0x3359('0x35')](_0x26aeb2,function(_0x448643){if(_0x448643[_0x3359('0x33')]!=='VIRTUAL'){var _0x1a28d9={};_0x1a28d9[_0x448643[_0x3359('0x27')]]={'$like':'%'+_0xcd8309[_0x3359('0x37')][_0x3359('0x42')]+'%'};return _0x1a28d9;}})});}_0x42be09=_[_0x3359('0x2a')]({},_0x42be09,_0xcd8309[_0x3359('0x43')]);var _0x30fbcd={'where':_0x42be09[_0x3359('0x40')]};return db[_0x3359('0x44')]['count'](_0x30fbcd)[_0x3359('0x25')](function(_0x4d7235){_0x181b42['count']=_0x4d7235;if(_0xcd8309[_0x3359('0x37')][_0x3359('0x45')]){_0x42be09[_0x3359('0x46')]=[{'all':!![]}];}return db[_0x3359('0x44')]['findAll'](_0x42be09);})[_0x3359('0x25')](function(_0x193063){_0x181b42[_0x3359('0x47')]=_0x193063;return _0x181b42;})[_0x3359('0x25')](respondWithFilteredResult(_0x5902c3,_0x42be09))[_0x3359('0x48')](handleError(_0x5902c3,null));};exports[_0x3359('0x49')]=function(_0x6f30,_0x223979){var _0x4d47a6={'raw':!![],'where':{'id':_0x6f30[_0x3359('0x4a')]['id']}},_0xe6910e={};_0xe6910e[_0x3359('0x3b')]=_[_0x3359('0x36')](db[_0x3359('0x44')]['rawAttributes']);_0xe6910e[_0x3359('0x37')]=_[_0x3359('0x36')](_0x6f30[_0x3359('0x37')]);_0xe6910e['filters']=_['intersection'](_0xe6910e[_0x3359('0x3b')],_0xe6910e[_0x3359('0x37')]);_0x4d47a6[_0x3359('0x3a')]=_['intersection'](_0xe6910e[_0x3359('0x3b')],qs[_0x3359('0x3c')](_0x6f30[_0x3359('0x37')][_0x3359('0x3c')]));_0x4d47a6[_0x3359('0x3a')]=_0x4d47a6[_0x3359('0x3a')][_0x3359('0x4b')]?_0x4d47a6[_0x3359('0x3a')]:_0xe6910e[_0x3359('0x3b')];if(_0x6f30[_0x3359('0x37')]['includeAll']){_0x4d47a6[_0x3359('0x46')]=[{'all':!![]}];}_0x4d47a6=_[_0x3359('0x2a')]({},_0x4d47a6,_0x6f30['options']);return db['FaxApplication']['find'](_0x4d47a6)[_0x3359('0x25')](handleEntityNotFound(_0x223979,null))[_0x3359('0x25')](respondWithResult(_0x223979,null))[_0x3359('0x48')](handleError(_0x223979,null));};exports[_0x3359('0x4c')]=function(_0x4fff7b,_0x31981e){return db[_0x3359('0x44')][_0x3359('0x4c')](_0x4fff7b[_0x3359('0x2b')],{})[_0x3359('0x25')](respondWithResult(_0x31981e,0xc9))[_0x3359('0x48')](handleError(_0x31981e,null));};exports[_0x3359('0x24')]=function(_0x4218bf,_0x40c4c2){if(_0x4218bf['body']['id']){delete _0x4218bf['body']['id'];}return db[_0x3359('0x44')][_0x3359('0x4d')]({'where':{'id':_0x4218bf['params']['id']}})[_0x3359('0x25')](handleEntityNotFound(_0x40c4c2,null))[_0x3359('0x25')](saveUpdates(_0x4218bf['body'],null))[_0x3359('0x25')](respondWithResult(_0x40c4c2,null))[_0x3359('0x48')](handleError(_0x40c4c2,null));};exports['destroy']=function(_0x383622,_0x38f852){return db[_0x3359('0x44')]['find']({'where':{'id':_0x383622[_0x3359('0x4a')]['id']}})[_0x3359('0x25')](handleEntityNotFound(_0x38f852,null))[_0x3359('0x25')](removeEntity(_0x38f852,null))[_0x3359('0x48')](handleError(_0x38f852,null));}; \ No newline at end of file +var _0x6869=['create','body','find','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','update','then','error','stack','name','merge','message','agent','interaction','account','index','FaxApplication','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','type','VIRTUAL','options','where','includeAll','include','findAll','catch','show','params'];(function(_0x1fbbdc,_0x402840){var _0xcdf649=function(_0x5b630e){while(--_0x5b630e){_0x1fbbdc['push'](_0x1fbbdc['shift']());}};_0xcdf649(++_0x402840);}(_0x6869,0x1c5));var _0x9686=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6869[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9686('0x0'));var zipdir=require(_0x9686('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9686('0x2'));var moment=require(_0x9686('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9686('0x4'));var util=require(_0x9686('0x5'));var path=require(_0x9686('0x6'));var sox=require(_0x9686('0x7'));var csv=require(_0x9686('0x8'));var ejs=require(_0x9686('0x9'));var fs=require('fs');var fs_extra=require(_0x9686('0xa'));var _=require(_0x9686('0xb'));var squel=require(_0x9686('0xc'));var crypto=require('crypto');var jsforce=require(_0x9686('0xd'));var deskjs=require(_0x9686('0xe'));var toCsv=require(_0x9686('0x8'));var querystring=require(_0x9686('0xf'));var Papa=require(_0x9686('0x10'));var Redis=require(_0x9686('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9686('0x12'));var as=require(_0x9686('0x13'));var hardwareService=require(_0x9686('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9686('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9686('0x16'))['db'];function respondWithStatusCode(_0x221774,_0x288554){_0x288554=_0x288554||0xcc;return function(_0x4b6423){if(_0x4b6423){return _0x221774[_0x9686('0x17')](_0x288554);}return _0x221774['status'](_0x288554)[_0x9686('0x18')]();};}function respondWithResult(_0x2bc40b,_0x31467d){_0x31467d=_0x31467d||0xc8;return function(_0x6944e1){if(_0x6944e1){return _0x2bc40b['status'](_0x31467d)[_0x9686('0x19')](_0x6944e1);}};}function respondWithFilteredResult(_0x55e6c8,_0xb9e42e){return function(_0x29716f){if(_0x29716f){var _0x4eced1=typeof _0xb9e42e['offset']===_0x9686('0x1a')&&typeof _0xb9e42e['limit']===_0x9686('0x1a');var _0xe3af72=_0x29716f[_0x9686('0x1b')];var _0x291d8c=_0x4eced1?0x0:_0xb9e42e[_0x9686('0x1c')];var _0x2378b5=_0x4eced1?_0x29716f['count']:_0xb9e42e[_0x9686('0x1c')]+_0xb9e42e[_0x9686('0x1d')];var _0x90eb1f;if(_0x2378b5>=_0xe3af72){_0x2378b5=_0xe3af72;_0x90eb1f=0xc8;}else{_0x90eb1f=0xce;}_0x55e6c8[_0x9686('0x1e')](_0x90eb1f);return _0x55e6c8[_0x9686('0x1f')]('Content-Range',_0x291d8c+'-'+_0x2378b5+'/'+_0xe3af72)[_0x9686('0x19')](_0x29716f);}return null;};}function patchUpdates(_0x347618){return function(_0x1df0a0){try{jsonpatch[_0x9686('0x20')](_0x1df0a0,_0x347618,!![]);}catch(_0x38f63c){return BPromise['reject'](_0x38f63c);}return _0x1df0a0['save']();};}function saveUpdates(_0x5e29a5,_0x58e817){return function(_0x23f60a){if(_0x23f60a){return _0x23f60a[_0x9686('0x21')](_0x5e29a5)[_0x9686('0x22')](function(_0x22378f){return _0x22378f;});}return null;};}function removeEntity(_0x37beb3,_0x576aa2){return function(_0xf8cbc9){if(_0xf8cbc9){return _0xf8cbc9['destroy']()[_0x9686('0x22')](function(){_0x37beb3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4114bd,_0xccf422){return function(_0x184d6d){if(!_0x184d6d){_0x4114bd[_0x9686('0x17')](0x194);}return _0x184d6d;};}function handleError(_0x48a0c8,_0x3e1e4d){_0x3e1e4d=_0x3e1e4d||0x1f4;return function(_0x2a1f7c){logger[_0x9686('0x23')](_0x2a1f7c[_0x9686('0x24')]);if(_0x2a1f7c[_0x9686('0x25')]){delete _0x2a1f7c[_0x9686('0x25')];}_0x48a0c8[_0x9686('0x1e')](_0x3e1e4d)['send'](_0x2a1f7c);};}function getMustacheRender(_0x6369dd,_0x104f9b){return Mustache['render'](_0x6369dd,_[_0x9686('0x26')](_0x104f9b['body'],{'contact':_0x104f9b['contact'],'message':_0x104f9b[_0x9686('0x27')],'agent':_0x104f9b[_0x9686('0x28')],'interaction':_0x104f9b[_0x9686('0x29')],'account':_0x104f9b[_0x9686('0x2a')]}))||'';}exports[_0x9686('0x2b')]=function(_0x1261cf,_0xcd57c9){var _0x419781={},_0x5dd341={},_0x5851f8={'count':0x0,'rows':[]};var _0x50a15a=_['map'](db[_0x9686('0x2c')][_0x9686('0x2d')],function(_0x5be8d8){return{'name':_0x5be8d8[_0x9686('0x2e')],'type':_0x5be8d8['type'][_0x9686('0x2f')]};});_0x5dd341[_0x9686('0x30')]=_[_0x9686('0x31')](_0x50a15a,'name');_0x5dd341['query']=_[_0x9686('0x32')](_0x1261cf['query']);_0x5dd341[_0x9686('0x33')]=_[_0x9686('0x34')](_0x5dd341[_0x9686('0x30')],_0x5dd341[_0x9686('0x35')]);_0x419781[_0x9686('0x36')]=_[_0x9686('0x34')](_0x5dd341[_0x9686('0x30')],qs[_0x9686('0x37')](_0x1261cf['query'][_0x9686('0x37')]));_0x419781[_0x9686('0x36')]=_0x419781[_0x9686('0x36')][_0x9686('0x38')]?_0x419781[_0x9686('0x36')]:_0x5dd341[_0x9686('0x30')];if(!_0x1261cf[_0x9686('0x35')][_0x9686('0x39')](_0x9686('0x3a'))){_0x419781[_0x9686('0x1d')]=qs[_0x9686('0x1d')](_0x1261cf['query'][_0x9686('0x1d')]);_0x419781['offset']=qs['offset'](_0x1261cf[_0x9686('0x35')][_0x9686('0x1c')]);}_0x419781[_0x9686('0x3b')]=qs['sort'](_0x1261cf[_0x9686('0x35')][_0x9686('0x3c')]);_0x419781['where']=qs[_0x9686('0x33')](_['pick'](_0x1261cf['query'],_0x5dd341['filters']),_0x50a15a);if(_0x1261cf[_0x9686('0x35')][_0x9686('0x3d')]){_0x419781['where']=_['merge'](_0x419781['where'],{'$or':_[_0x9686('0x31')](_0x50a15a,function(_0x233743){if(_0x233743[_0x9686('0x3e')]!==_0x9686('0x3f')){var _0x75a3bf={};_0x75a3bf[_0x233743[_0x9686('0x25')]]={'$like':'%'+_0x1261cf['query'][_0x9686('0x3d')]+'%'};return _0x75a3bf;}})});}_0x419781=_[_0x9686('0x26')]({},_0x419781,_0x1261cf[_0x9686('0x40')]);var _0xd1556d={'where':_0x419781[_0x9686('0x41')]};return db[_0x9686('0x2c')][_0x9686('0x1b')](_0xd1556d)[_0x9686('0x22')](function(_0x239579){_0x5851f8[_0x9686('0x1b')]=_0x239579;if(_0x1261cf[_0x9686('0x35')][_0x9686('0x42')]){_0x419781[_0x9686('0x43')]=[{'all':!![]}];}return db['FaxApplication'][_0x9686('0x44')](_0x419781);})[_0x9686('0x22')](function(_0x2af4c7){_0x5851f8['rows']=_0x2af4c7;return _0x5851f8;})[_0x9686('0x22')](respondWithFilteredResult(_0xcd57c9,_0x419781))[_0x9686('0x45')](handleError(_0xcd57c9,null));};exports[_0x9686('0x46')]=function(_0x339b8c,_0x10a379){var _0x58c6af={'raw':!![],'where':{'id':_0x339b8c[_0x9686('0x47')]['id']}},_0x245f42={};_0x245f42['model']=_[_0x9686('0x32')](db['FaxApplication'][_0x9686('0x2d')]);_0x245f42['query']=_[_0x9686('0x32')](_0x339b8c[_0x9686('0x35')]);_0x245f42['filters']=_[_0x9686('0x34')](_0x245f42[_0x9686('0x30')],_0x245f42[_0x9686('0x35')]);_0x58c6af[_0x9686('0x36')]=_[_0x9686('0x34')](_0x245f42['model'],qs['fields'](_0x339b8c[_0x9686('0x35')][_0x9686('0x37')]));_0x58c6af[_0x9686('0x36')]=_0x58c6af[_0x9686('0x36')][_0x9686('0x38')]?_0x58c6af[_0x9686('0x36')]:_0x245f42[_0x9686('0x30')];if(_0x339b8c[_0x9686('0x35')]['includeAll']){_0x58c6af[_0x9686('0x43')]=[{'all':!![]}];}_0x58c6af=_[_0x9686('0x26')]({},_0x58c6af,_0x339b8c[_0x9686('0x40')]);return db[_0x9686('0x2c')]['find'](_0x58c6af)[_0x9686('0x22')](handleEntityNotFound(_0x10a379,null))[_0x9686('0x22')](respondWithResult(_0x10a379,null))['catch'](handleError(_0x10a379,null));};exports[_0x9686('0x48')]=function(_0x2dc2fc,_0x2765a2){return db[_0x9686('0x2c')][_0x9686('0x48')](_0x2dc2fc[_0x9686('0x49')],{})[_0x9686('0x22')](respondWithResult(_0x2765a2,0xc9))[_0x9686('0x45')](handleError(_0x2765a2,null));};exports[_0x9686('0x21')]=function(_0x1d7d90,_0x4e0e87){if(_0x1d7d90[_0x9686('0x49')]['id']){delete _0x1d7d90['body']['id'];}return db[_0x9686('0x2c')][_0x9686('0x4a')]({'where':{'id':_0x1d7d90[_0x9686('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e0e87,null))[_0x9686('0x22')](saveUpdates(_0x1d7d90['body'],null))['then'](respondWithResult(_0x4e0e87,null))[_0x9686('0x45')](handleError(_0x4e0e87,null));};exports['destroy']=function(_0x4b7412,_0x4b2d69){return db['FaxApplication'][_0x9686('0x4a')]({'where':{'id':_0x4b7412[_0x9686('0x47')]['id']}})[_0x9686('0x22')](handleEntityNotFound(_0x4b2d69,null))['then'](removeEntity(_0x4b2d69,null))[_0x9686('0x45')](handleError(_0x4b2d69,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 727a705..e12d89e 100644 --- a/server/api/faxApplication/faxApplication.model.js +++ b/server/api/faxApplication/faxApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3e4=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x52975d,_0x127968){var _0x3baabc=function(_0x3b80e6){while(--_0x3b80e6){_0x52975d['push'](_0x52975d['shift']());}};_0x3baabc(++_0x127968);}(_0xb3e4,0x137));var _0x4b3e=function(_0x335db0,_0x37654c){_0x335db0=_0x335db0-0x0;var _0x2765d1=_0xb3e4[_0x335db0];return _0x2765d1;};'use strict';var _=require('lodash');var util=require(_0x4b3e('0x0'));var logger=require(_0x4b3e('0x1'))(_0x4b3e('0x2'));var moment=require(_0x4b3e('0x3'));var BPromise=require(_0x4b3e('0x4'));var rp=require(_0x4b3e('0x5'));var fs=require('fs');var path=require(_0x4b3e('0x6'));var rimraf=require(_0x4b3e('0x7'));var config=require(_0x4b3e('0x8'));var attributes=require(_0x4b3e('0x9'));module[_0x4b3e('0xa')]=function(_0xe9f578,_0x1604db){return _0xe9f578[_0x4b3e('0xb')](_0x4b3e('0xc'),attributes,{'tableName':_0x4b3e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b3e('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd4a2=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports'];(function(_0x4990d5,_0xe2c486){var _0x275e25=function(_0x4de73e){while(--_0x4de73e){_0x4990d5['push'](_0x4990d5['shift']());}};_0x275e25(++_0xe2c486);}(_0xd4a2,0x121));var _0x2d4a=function(_0x14fdc2,_0x1e9ae7){_0x14fdc2=_0x14fdc2-0x0;var _0x3bec2e=_0xd4a2[_0x14fdc2];return _0x3bec2e;};'use strict';var _=require(_0x2d4a('0x0'));var util=require(_0x2d4a('0x1'));var logger=require('../../config/logger')(_0x2d4a('0x2'));var moment=require(_0x2d4a('0x3'));var BPromise=require(_0x2d4a('0x4'));var rp=require(_0x2d4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d4a('0x6'));var config=require(_0x2d4a('0x7'));var attributes=require(_0x2d4a('0x8'));module[_0x2d4a('0x9')]=function(_0x2bcf12,_0x55ef2f){return _0x2bcf12['define']('FaxApplication',attributes,{'tableName':_0x2d4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d4a('0xb'),'collate':_0x2d4a('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0cba34b..60ad942 100644 --- a/server/api/faxApplication/faxApplication.rpc.js +++ b/server/api/faxApplication/faxApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8117=['client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','message','error','catch','FaxApplication','options','raw','where','attributes','limit','debug','UpdateFaxApplication','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x35885e,_0x2bd900){var _0xce29e1=function(_0x3a714c){while(--_0x3a714c){_0x35885e['push'](_0x35885e['shift']());}};_0xce29e1(++_0x2bd900);}(_0x8117,0x10e));var _0x7811=function(_0x160ce8,_0x221ea2){_0x160ce8=_0x160ce8-0x0;var _0x2bf5b2=_0x8117[_0x160ce8];return _0x2bf5b2;};'use strict';var _=require('lodash');var util=require(_0x7811('0x0'));var moment=require(_0x7811('0x1'));var BPromise=require('bluebird');var rs=require(_0x7811('0x2'));var fs=require('fs');var Redis=require(_0x7811('0x3'));var db=require(_0x7811('0x4'))['db'];var utils=require(_0x7811('0x5'));var logger=require(_0x7811('0x6'))(_0x7811('0x7'));var config=require(_0x7811('0x8'));var jayson=require(_0x7811('0x9'));var client=jayson[_0x7811('0xa')][_0x7811('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365815,_0x19b809,_0x251f93){return new BPromise(function(_0x447a04,_0x5d84bc){return client['request'](_0x365815,_0x251f93)['then'](function(_0xb2c97b){logger[_0x7811('0xc')](_0x7811('0xd'),_0x19b809,_0x7811('0xe'));logger['debug'](_0x7811('0xf'),_0x19b809,_0x7811('0xe'),JSON[_0x7811('0x10')](_0xb2c97b));if(_0xb2c97b['error']){if(_0xb2c97b['error']['code']===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x19b809,_0xb2c97b['error'][_0x7811('0x11')]);return _0x5d84bc(_0xb2c97b[_0x7811('0x12')]['message']);}logger[_0x7811('0x12')](_0x7811('0xd'),_0x19b809,_0xb2c97b[_0x7811('0x12')][_0x7811('0x11')]);return _0x447a04(_0xb2c97b['error'][_0x7811('0x11')]);}else{logger[_0x7811('0xc')](_0x7811('0xd'),_0x19b809,'request\x20sent');_0x447a04(_0xb2c97b['result']['message']);}})[_0x7811('0x13')](function(_0x2c33e9){logger[_0x7811('0x12')](_0x7811('0xd'),_0x19b809,_0x2c33e9);_0x5d84bc(_0x2c33e9);});});}exports['UpdateFaxApplication']=function(_0x122f3b){var _0x574c10=this;return new Promise(function(_0x408331,_0x4f0a27){return db[_0x7811('0x14')]['update'](_0x122f3b['body'],{'raw':_0x122f3b['options']?_0x122f3b[_0x7811('0x15')][_0x7811('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x122f3b['options']?_0x122f3b['options'][_0x7811('0x17')]||null:null,'attributes':_0x122f3b[_0x7811('0x15')]?_0x122f3b[_0x7811('0x15')][_0x7811('0x18')]||null:null,'limit':_0x122f3b[_0x7811('0x15')]?_0x122f3b[_0x7811('0x15')][_0x7811('0x19')]||null:null})['then'](function(_0x20ca7a){logger[_0x7811('0xc')]('UpdateFaxApplication',_0x122f3b);logger[_0x7811('0x1a')](_0x7811('0x1b'),_0x122f3b,JSON[_0x7811('0x10')](_0x20ca7a));_0x408331(_0x20ca7a);})[_0x7811('0x13')](function(_0x358e0f){logger['error'](_0x7811('0x1b'),_0x358e0f[_0x7811('0x11')],_0x122f3b);_0x4f0a27(_0x574c10['error'](0x1f4,_0x358e0f['message']));});});}; \ No newline at end of file +var _0xe9fc=['FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2e514d,_0x372fda){var _0x4519b6=function(_0x37ab4d){while(--_0x37ab4d){_0x2e514d['push'](_0x2e514d['shift']());}};_0x4519b6(++_0x372fda);}(_0xe9fc,0x187));var _0xce9f=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xe9fc[_0x1bc0ae];return _0x501104;};'use strict';var _=require(_0xce9f('0x0'));var util=require(_0xce9f('0x1'));var moment=require('moment');var BPromise=require(_0xce9f('0x2'));var rs=require(_0xce9f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce9f('0x4'))['db'];var utils=require(_0xce9f('0x5'));var logger=require('../../config/logger')(_0xce9f('0x6'));var config=require(_0xce9f('0x7'));var jayson=require(_0xce9f('0x8'));var client=jayson[_0xce9f('0x9')][_0xce9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f6c07,_0x31825a,_0x30a83d){return new BPromise(function(_0xb78e86,_0x97c17f){return client['request'](_0x4f6c07,_0x30a83d)[_0xce9f('0xb')](function(_0x529a3f){logger['info'](_0xce9f('0xc'),_0x31825a,_0xce9f('0xd'));logger[_0xce9f('0xe')](_0xce9f('0xf'),_0x31825a,_0xce9f('0xd'),JSON[_0xce9f('0x10')](_0x529a3f));if(_0x529a3f['error']){if(_0x529a3f[_0xce9f('0x11')]['code']===0x1f4){logger[_0xce9f('0x11')](_0xce9f('0xc'),_0x31825a,_0x529a3f['error']['message']);return _0x97c17f(_0x529a3f[_0xce9f('0x11')][_0xce9f('0x12')]);}logger[_0xce9f('0x11')](_0xce9f('0xc'),_0x31825a,_0x529a3f[_0xce9f('0x11')][_0xce9f('0x12')]);return _0xb78e86(_0x529a3f[_0xce9f('0x11')][_0xce9f('0x12')]);}else{logger[_0xce9f('0x13')](_0xce9f('0xc'),_0x31825a,'request\x20sent');_0xb78e86(_0x529a3f['result'][_0xce9f('0x12')]);}})[_0xce9f('0x14')](function(_0x110113){logger['error'](_0xce9f('0xc'),_0x31825a,_0x110113);_0x97c17f(_0x110113);});});}exports[_0xce9f('0x15')]=function(_0x5dd0f9){var _0x100310=this;return new Promise(function(_0x52bee4,_0x24f1c5){return db[_0xce9f('0x16')][_0xce9f('0x17')](_0x5dd0f9[_0xce9f('0x18')],{'raw':_0x5dd0f9[_0xce9f('0x19')]?_0x5dd0f9[_0xce9f('0x19')][_0xce9f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dd0f9[_0xce9f('0x19')]?_0x5dd0f9['options'][_0xce9f('0x1b')]||null:null,'attributes':_0x5dd0f9[_0xce9f('0x19')]?_0x5dd0f9['options']['attributes']||null:null,'limit':_0x5dd0f9[_0xce9f('0x19')]?_0x5dd0f9['options'][_0xce9f('0x1c')]||null:null})[_0xce9f('0xb')](function(_0x4db8a6){logger[_0xce9f('0x13')](_0xce9f('0x15'),_0x5dd0f9);logger['debug'](_0xce9f('0x15'),_0x5dd0f9,JSON[_0xce9f('0x10')](_0x4db8a6));_0x52bee4(_0x4db8a6);})[_0xce9f('0x14')](function(_0x461bd4){logger[_0xce9f('0x11')]('UpdateFaxApplication',_0x461bd4[_0xce9f('0x12')],_0x5dd0f9);_0x24f1c5(_0x100310[_0xce9f('0x11')](0x1f4,_0x461bd4[_0xce9f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 55e08b8..4e5a68d 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc34=['update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfc34,0x135));var _0x4fc3=function(_0x24d560,_0x2e0e7b){_0x24d560=_0x24d560-0x0;var _0x18f7b3=_0xfc34[_0x24d560];return _0x18f7b3;};'use strict';var multer=require(_0x4fc3('0x0'));var util=require(_0x4fc3('0x1'));var path=require(_0x4fc3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4fc3('0x3')]();var fs_extra=require(_0x4fc3('0x4'));var auth=require(_0x4fc3('0x5'));var interaction=require(_0x4fc3('0x6'));var config=require(_0x4fc3('0x7'));var controller=require('./faxApplication.controller');router[_0x4fc3('0x8')]('/',auth[_0x4fc3('0x9')](),controller['index']);router[_0x4fc3('0x8')](_0x4fc3('0xa'),auth[_0x4fc3('0x9')](),controller[_0x4fc3('0xb')]);router[_0x4fc3('0xc')]('/',auth[_0x4fc3('0x9')](),controller['create']);router[_0x4fc3('0xd')](_0x4fc3('0xa'),auth[_0x4fc3('0x9')](),controller[_0x4fc3('0xe')]);router[_0x4fc3('0xf')](_0x4fc3('0xa'),auth['isAuthenticated'](),controller[_0x4fc3('0x10')]);module['exports']=router; \ No newline at end of file +var _0xc3fc=['delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','show','post','create','put','update'];(function(_0x14476b,_0xd1a7a4){var _0x24e2e8=function(_0x52ed26){while(--_0x52ed26){_0x14476b['push'](_0x14476b['shift']());}};_0x24e2e8(++_0xd1a7a4);}(_0xc3fc,0x11b));var _0xcc3f=function(_0x783ad1,_0x53c550){_0x783ad1=_0x783ad1-0x0;var _0x7517ef=_0xc3fc[_0x783ad1];return _0x7517ef;};'use strict';var multer=require(_0xcc3f('0x0'));var util=require(_0xcc3f('0x1'));var path=require(_0xcc3f('0x2'));var timeout=require(_0xcc3f('0x3'));var express=require(_0xcc3f('0x4'));var router=express[_0xcc3f('0x5')]();var fs_extra=require(_0xcc3f('0x6'));var auth=require(_0xcc3f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcc3f('0x8'));router[_0xcc3f('0x9')]('/',auth[_0xcc3f('0xa')](),controller[_0xcc3f('0xb')]);router[_0xcc3f('0x9')]('/:id',auth[_0xcc3f('0xa')](),controller[_0xcc3f('0xc')]);router[_0xcc3f('0xd')]('/',auth[_0xcc3f('0xa')](),controller[_0xcc3f('0xe')]);router[_0xcc3f('0xf')]('/:id',auth[_0xcc3f('0xa')](),controller[_0xcc3f('0x10')]);router[_0xcc3f('0x11')](_0xcc3f('0x12'),auth[_0xcc3f('0xa')](),controller[_0xcc3f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 9b7d4e3..d44b4c6 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dd6=['STRING','ENUM','out','DATE'];(function(_0x2771ab,_0x571f8b){var _0x48ff7c=function(_0x10fc9b){while(--_0x10fc9b){_0x2771ab['push'](_0x2771ab['shift']());}};_0x48ff7c(++_0x571f8b);}(_0x3dd6,0xcf));var _0x63dd=function(_0xffad61,_0x5f0282){_0xffad61=_0xffad61-0x0;var _0x33ef10=_0x3dd6[_0xffad61];return _0x33ef10;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x63dd('0x0')]},'disposition':{'type':Sequelize[_0x63dd('0x1')]},'secondDisposition':{'type':Sequelize[_0x63dd('0x1')]},'thirdDisposition':{'type':Sequelize[_0x63dd('0x1')]},'note':{'type':Sequelize[_0x63dd('0x1')]},'read1stAt':{'type':Sequelize[_0x63dd('0x0')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x63dd('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x63dd('0x0')]},'lastMsgDirection':{'type':Sequelize[_0x63dd('0x2')]('in',_0x63dd('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3baf=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x428425,_0x32cd76){var _0x4e0421=function(_0x271a69){while(--_0x271a69){_0x428425['push'](_0x428425['shift']());}};_0x4e0421(++_0x32cd76);}(_0x3baf,0xf7));var _0xf3ba=function(_0x1ae0f5,_0x25d756){_0x1ae0f5=_0x1ae0f5-0x0;var _0xa96dc1=_0x3baf[_0x1ae0f5];return _0xa96dc1;};'use strict';var Sequelize=require(_0xf3ba('0x0'));module[_0xf3ba('0x1')]={'closed':{'type':Sequelize[_0xf3ba('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf3ba('0x3')]},'disposition':{'type':Sequelize[_0xf3ba('0x4')]},'secondDisposition':{'type':Sequelize[_0xf3ba('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf3ba('0x4')]},'note':{'type':Sequelize[_0xf3ba('0x4')]},'read1stAt':{'type':Sequelize[_0xf3ba('0x3')]},'fax':{'type':Sequelize[_0xf3ba('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf3ba('0x5')]('in',_0xf3ba('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf3ba('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf3ba('0x5')]('in',_0xf3ba('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 8b9d5e6..06a655f 100644 --- a/server/api/faxInteraction/faxInteraction.controller.js +++ b/server/api/faxInteraction/faxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa91d=['\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','includeAll','include','options','create','describe','FaxMessage','omit','ids','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','removeTags','unix','root','server','files','tmp','attachments','join','format','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','account','map','fullname','TagIds','Tags','split','forEach','catch','FaxInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','left_join','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL'];(function(_0x27c87a,_0x22a763){var _0x979632=function(_0x101c1c){while(--_0x101c1c){_0x27c87a['push'](_0x27c87a['shift']());}};_0x979632(++_0x22a763);}(_0xa91d,0x134));var _0xda91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa91d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xda91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda91('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda91('0x2'));var moment=require(_0xda91('0x3'));var BPromise=require(_0xda91('0x4'));var Mustache=require(_0xda91('0x5'));var util=require(_0xda91('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda91('0x7'));var _=require(_0xda91('0x8'));var squel=require(_0xda91('0x9'));var crypto=require(_0xda91('0xa'));var jsforce=require(_0xda91('0xb'));var deskjs=require(_0xda91('0xc'));var toCsv=require(_0xda91('0xd'));var querystring=require(_0xda91('0xe'));var Papa=require(_0xda91('0xf'));var Redis=require(_0xda91('0x10'));var authService=require(_0xda91('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xda91('0x12'));var hardwareService=require(_0xda91('0x13'));var logger=require(_0xda91('0x14'))('api');var utils=require(_0xda91('0x15'));var config=require(_0xda91('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xda91('0x17'))['db'];config[_0xda91('0x18')]=_[_0xda91('0x19')](config[_0xda91('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xda91('0x1a'))(new Redis(config[_0xda91('0x18')]));require(_0xda91('0x1b'))['register'](socket);function respondWithStatusCode(_0x5b3694,_0x4582ce){_0x4582ce=_0x4582ce||0xcc;return function(_0x590497){if(_0x590497){return _0x5b3694[_0xda91('0x1c')](_0x4582ce);}return _0x5b3694[_0xda91('0x1d')](_0x4582ce)[_0xda91('0x1e')]();};}function respondWithResult(_0x4cd17b,_0x48f5cc){_0x48f5cc=_0x48f5cc||0xc8;return function(_0x12a804){if(_0x12a804){return _0x4cd17b[_0xda91('0x1d')](_0x48f5cc)['json'](_0x12a804);}};}function respondWithFilteredResult(_0x5e6332,_0x5d4104){return function(_0x49e8c1){if(_0x49e8c1){var _0x2015b3=typeof _0x5d4104[_0xda91('0x1f')]===_0xda91('0x20')&&typeof _0x5d4104[_0xda91('0x21')]===_0xda91('0x20');var _0x576195=_0x49e8c1['count'];var _0x5c7d98=_0x2015b3?0x0:_0x5d4104[_0xda91('0x1f')];var _0x4699bf=_0x2015b3?_0x49e8c1[_0xda91('0x22')]:_0x5d4104['offset']+_0x5d4104[_0xda91('0x21')];var _0x24cd57;if(_0x4699bf>=_0x576195){_0x4699bf=_0x576195;_0x24cd57=0xc8;}else{_0x24cd57=0xce;}_0x5e6332['status'](_0x24cd57);return _0x5e6332['set'](_0xda91('0x23'),_0x5c7d98+'-'+_0x4699bf+'/'+_0x576195)[_0xda91('0x24')](_0x49e8c1);}return null;};}function patchUpdates(_0x4d4643){return function(_0x1d6d43){try{jsonpatch[_0xda91('0x25')](_0x1d6d43,_0x4d4643,!![]);}catch(_0x3ce572){return BPromise['reject'](_0x3ce572);}return _0x1d6d43[_0xda91('0x26')]();};}function saveUpdates(_0x553f56,_0x1760b3){return function(_0x5b6edd){if(_0x5b6edd){return _0x5b6edd[_0xda91('0x27')](_0x553f56)[_0xda91('0x28')](function(_0x25af0f){return _0x25af0f;});}return null;};}function removeEntity(_0x2b8e28,_0x203aa8){return function(_0x289983){if(_0x289983){return _0x289983[_0xda91('0x29')]()[_0xda91('0x28')](function(){_0x2b8e28[_0xda91('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a915,_0xe36e9c){return function(_0x137adb){if(!_0x137adb){_0x42a915['sendStatus'](0x194);}return _0x137adb;};}function handleError(_0x3194ae,_0x2b0c25){_0x2b0c25=_0x2b0c25||0x1f4;return function(_0x7d257f){logger[_0xda91('0x2a')](_0x7d257f[_0xda91('0x2b')]);if(_0x7d257f['name']){delete _0x7d257f[_0xda91('0x2c')];}_0x3194ae['status'](_0x2b0c25)[_0xda91('0x2d')](_0x7d257f);};}function getMustacheRender(_0x5b59a0,_0x828961){return Mustache[_0xda91('0x2e')](_0x5b59a0,_[_0xda91('0x2f')](_0x828961[_0xda91('0x30')],{'contact':_0x828961[_0xda91('0x31')],'message':_0x828961[_0xda91('0x32')],'agent':_0x828961[_0xda91('0x33')],'interaction':_0x828961['interaction'],'account':_0x828961[_0xda91('0x34')]}))||'';}function getInteractionUsers(_0x4818b3,_0x11796a){return new BPromise(function(_0x40fd6d,_0x4df6c9){try{if(_0x11796a[_0x4818b3['id']]){_0x4818b3['Users']=_[_0xda91('0x35')](_0x11796a[_0x4818b3['id']],function(_0x334558){return{'id':_0x334558['id'],'fullname':_0x334558[_0xda91('0x36')]};});}}catch(_0x3e6e9d){_0x4df6c9(_0x3e6e9d);}_0x40fd6d(_0x4818b3);});}function getInteractionTags(_0x57ce28,_0x37d857){return new BPromise(function(_0xaf14fe,_0x24a6d4){try{if(_0x57ce28[_0xda91('0x37')]){_0x57ce28[_0xda91('0x38')]=[];_0x57ce28['TagIds'][_0xda91('0x39')](',')[_0xda91('0x3a')](function(_0x40ca9d){_0x57ce28['Tags']['push'](_0x37d857[_0x40ca9d]);});}delete _0x57ce28['TagIds'];}catch(_0x442487){_0x24a6d4(_0x442487);}_0xaf14fe(_0x57ce28);});}function updateFaxInteraction(_0x4c0a2c,_0x11fdf8,_0x299b02){return new BPromise(function(_0x2325a3,_0x16cc6a){return getInteractionUsers(_0x4c0a2c,_0x299b02)[_0xda91('0x28')](function(_0x252c7c){return getInteractionTags(_0x252c7c,_0x11fdf8);})[_0xda91('0x28')](function(_0x58ac98){_0x2325a3(_0x58ac98);})[_0xda91('0x3b')](function(_0x23369f){_0x16cc6a(_0x23369f);});});}exports['index']=function(_0x31390b,_0x46c456){var _0x30d523={},_0x3d2346={},_0x4b0a19={'count':0x0,'rows':[]};var _0x81e6a5=_[_0xda91('0x35')](db[_0xda91('0x3c')][_0xda91('0x3d')],function(_0x3f6d93){return{'name':_0x3f6d93[_0xda91('0x3e')],'type':_0x3f6d93[_0xda91('0x3f')][_0xda91('0x40')]};});_0x3d2346[_0xda91('0x41')]=_[_0xda91('0x35')](_0x81e6a5,_0xda91('0x2c'));_0x3d2346[_0xda91('0x42')]=_['keys'](_0x31390b['query']);_0x3d2346[_0xda91('0x43')]=_[_0xda91('0x44')](_0x3d2346[_0xda91('0x41')],_0x3d2346[_0xda91('0x42')]);_0x30d523[_0xda91('0x45')]=_[_0xda91('0x44')](_0x3d2346['model'],qs[_0xda91('0x46')](_0x31390b[_0xda91('0x42')][_0xda91('0x46')]));_0x30d523['attributes']=_0x30d523[_0xda91('0x45')]['length']?_0x30d523[_0xda91('0x45')]:_0x3d2346[_0xda91('0x41')];if(!_0x31390b[_0xda91('0x42')]['hasOwnProperty'](_0xda91('0x47'))){_0x30d523[_0xda91('0x21')]=qs[_0xda91('0x21')](_0x31390b[_0xda91('0x42')][_0xda91('0x21')]);_0x30d523[_0xda91('0x1f')]=qs[_0xda91('0x1f')](_0x31390b[_0xda91('0x42')][_0xda91('0x1f')]);}_0x30d523['order']=qs[_0xda91('0x48')](_0x31390b['query']['sort']);_0x30d523[_0xda91('0x49')]=qs['filters'](_[_0xda91('0x4a')](_0x31390b[_0xda91('0x42')],_0x3d2346[_0xda91('0x43')]),_0x81e6a5);var _0x4b94e3=[];var _0x4b8e18=squel[_0xda91('0x4b')]()[_0xda91('0x4c')]('id')[_0xda91('0x4c')](_0xda91('0x2c'))[_0xda91('0x4c')](_0xda91('0x4d'))[_0xda91('0x4e')]('tools_tags');var _0x2f789d=squel[_0xda91('0x4b')]()[_0xda91('0x4c')]('u.id')[_0xda91('0x4c')](_0xda91('0x4f'))[_0xda91('0x4c')](_0xda91('0x50'))[_0xda91('0x4e')](_0xda91('0x51'),'ui')['left_join'](_0xda91('0x52'),'u',_0xda91('0x53'));var _0x51e0c3=squel[_0xda91('0x4b')]()['from'](_0xda91('0x54'),'i')['left_join']('cm_contacts','c',_0xda91('0x55'))['left_join']('users','o',_0xda91('0x56'))[_0xda91('0x57')](_0xda91('0x58'),'a','a.id\x20=\x20i.FaxAccountId')[_0xda91('0x57')]('fax_messages','me',_0xda91('0x59'))[_0xda91('0x57')](_0xda91('0x5a'),'it',_0xda91('0x5b'))[_0xda91('0x57')](_0xda91('0x5c'),'t',_0xda91('0x5d'));var _0x5ac32d=squel[_0xda91('0x5e')]();var _0x3196a8=[];var _0x3382b9=squel[_0xda91('0x5e')]();var _0x5ddf91;if(_0x31390b[_0xda91('0x42')]['search']){_0x5ddf91=as[_0xda91('0x5f')](_0x31390b[_0xda91('0x42')][_0xda91('0x60')]);var _0x3bf52c=_0x5ddf91[_0xda91('0x61')];for(var _0x2e073d=0x0;_0x2e073d<_0x5ddf91[_0xda91('0x62')][_0xda91('0x63')];_0x2e073d++){var _0x3edbe7=_0x5ddf91[_0xda91('0x62')][_0x2e073d];var _0xe5decf='i';var _0x49ada9=_[_0xda91('0x64')](_0x81e6a5,[_0xda91('0x2c'),_0x3edbe7['field']]);if(!_0x49ada9){switch(_0x3edbe7[_0xda91('0x4c')]){case _0xda91('0x65'):if(_0x3edbe7[_0xda91('0x66')]==0x1){_0x51e0c3[_0xda91('0x67')]('`'+_0x3edbe7[_0xda91('0x4c')]+'`\x20=\x200');}else{_0x51e0c3[_0xda91('0x67')]('`'+_0x3edbe7[_0xda91('0x4c')]+_0xda91('0x68'));}break;case _0xda91('0x69'):if(_0x3edbe7[_0xda91('0x6a')]===_0xda91('0x6b')){if(_0x3edbe7['value'][_0xda91('0x39')]('\x20')['length']>0x1){_0x5ac32d[_0x3bf52c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3edbe7[_0xda91('0x66')]),null);}else{var _0x26a8b1='%'+_0x3edbe7[_0xda91('0x66')]+'%';_0x5ac32d[_0x3bf52c]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26a8b1,_0x26a8b1,_0x26a8b1);}}else{_0x49ada9=_[_0xda91('0x64')](_0x81e6a5,[_0xda91('0x2c'),'ContactId']);_0x3edbe7[_0xda91('0x4c')]=_0xda91('0x6c');_0x5717e6=as[_0xda91('0x6d')](_0xe5decf,_0x49ada9[_0xda91('0x3f')],_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6[_0xda91('0x6e')],_0x5717e6[_0xda91('0x66')][_0xda91('0x6f')],_0x5717e6[_0xda91('0x66')][_0xda91('0x1e')]);}break;case'Tag':var _0x23e6ee=_0x3edbe7[_0xda91('0x66')][_0xda91('0x39')](',')['map'](function(_0x43a74f){return Number(_0x43a74f);});_0x23e6ee[_0xda91('0x3a')](function(_0x10aade){_0x3382b9['or'](_0xda91('0x70'),'%,'+_0x10aade+',%');});_0x3196a8=_[_0xda91('0x71')](_0x3196a8,_0x23e6ee);break;case _0xda91('0x72'):if(_0x3edbe7[_0xda91('0x6a')]===_0xda91('0x6b')){_0x5ac32d[_0x3bf52c](_0xda91('0x73'),'%'+_0x3edbe7[_0xda91('0x66')]+'%',null);}else{_0x49ada9=_[_0xda91('0x64')](_0x81e6a5,['name',_0xda91('0x74')]);_0x3edbe7[_0xda91('0x4c')]='UserId';_0x5717e6=as['buildExpression'](_0xe5decf,_0x49ada9[_0xda91('0x3f')],_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6[_0xda91('0x6e')],_0x5717e6[_0xda91('0x66')]['start'],_0x5717e6['value'][_0xda91('0x1e')]);}break;case'body':_0x5717e6=as[_0xda91('0x6d')]('me',null,_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6['text'],_0x5717e6[_0xda91('0x66')][_0xda91('0x6f')],_0x5717e6[_0xda91('0x66')]['end']);break;}}else{var _0x5717e6=as[_0xda91('0x6d')](_0xe5decf,_0x49ada9[_0xda91('0x3f')],_0x3edbe7);_0x5ac32d[_0x3bf52c](_0x5717e6[_0xda91('0x6e')],_0x5717e6[_0xda91('0x66')][_0xda91('0x6f')],_0x5717e6[_0xda91('0x66')][_0xda91('0x1e')]);}}}else{var _0x177eb0=_(_0x31390b[_0xda91('0x42')])[_0xda91('0x75')]()[_0xda91('0x35')](function(_0x587e44){return _[_0xda91('0x76')](_0x81e6a5,[_0xda91('0x2c'),_0x587e44])?_0x587e44:undefined;})[_0xda91('0x77')]()[_0xda91('0x66')]();if(!_['isEmpty'](_0x177eb0)){_0x177eb0[_0xda91('0x3a')](function(_0x51d00b){if(_0x51d00b===_0xda91('0x78')){_0x51e0c3[_0xda91('0x49')](_0xda91('0x79'),[][_0xda91('0x7a')](_0x31390b[_0xda91('0x42')][_0x51d00b]));}else if(_0x51d00b===_0xda91('0x7b')){var _0xaf2ea5=JSON[_0xda91('0x7c')](_0x31390b[_0xda91('0x42')][_0x51d00b])[_0xda91('0x7d')];var _0x44aa73=JSON[_0xda91('0x7c')](_0x31390b[_0xda91('0x42')][_0x51d00b])[_0xda91('0x7e')];_0x51e0c3[_0xda91('0x49')](_0xda91('0x7f'),_0xaf2ea5,_0x44aa73);}else{if(_0x31390b[_0xda91('0x42')][_0x51d00b]===_0xda91('0x80')){_0x51e0c3[_0xda91('0x49')]('i.'+_0x51d00b+_0xda91('0x81'));}else{_0x51e0c3[_0xda91('0x49')]('i.'+_0x51d00b+_0xda91('0x82'),_0x31390b['query'][_0x51d00b]);}}});}if(_0x31390b['query'][_0xda91('0x83')]){if(_0x31390b[_0xda91('0x42')]['read']==0x1){_0x51e0c3[_0xda91('0x67')]('`unreadMessages`\x20=\x200');}else{_0x51e0c3['having'](_0xda91('0x84'));}}if(_0x31390b[_0xda91('0x42')][_0xda91('0x85')]){_0x3196a8=_['isArray'](_0x31390b[_0xda91('0x42')]['tag'])?_0x31390b[_0xda91('0x42')]['tag']:new Array(_0x31390b[_0xda91('0x42')][_0xda91('0x85')]);_0x3196a8[_0xda91('0x3a')](function(_0x28d328){_0x3382b9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x28d328+',%');});}if(_0x31390b[_0xda91('0x42')][_0xda91('0x86')]){var _0x49ab6e=_0x31390b[_0xda91('0x42')][_0xda91('0x86')][_0xda91('0x87')]('\x5c','\x5c\x5c')[_0xda91('0x87')](/'/g,'\x27\x27');if(qs[_0xda91('0x88')](_0x49ab6e)){_0x5ac32d['or'](_0xda91('0x89'),_0x49ab6e+'%')['or'](_0xda91('0x8a'),_0x49ab6e+'%');}_0x5ac32d['or'](_0xda91('0x8b'),_0x49ab6e+'%');}}_0x51e0c3[_0xda91('0x49')](_0x5ac32d);_0x51e0c3[_0xda91('0x8c')](_0xda91('0x8d'));var _0x21f0b4={'type':db['Sequelize'][_0xda91('0x8e')]['SELECT'],'raw':!![]};var _0x695bce=_0x51e0c3[_0xda91('0x8f')]();_0x695bce[_0xda91('0x4c')](_0xda91('0x8d'));_0x695bce[_0xda91('0x4c')](_0xda91('0x90'),'unreadMessages');if(_0x30d523[_0xda91('0x91')]){_0x30d523[_0xda91('0x91')]['forEach'](function(_0x237eeb){var _0x3e9e0a=_0x237eeb[0x0]==='contactName'?_0x237eeb[0x0]:'i.'+_0x237eeb[0x0];_0x51e0c3[_0xda91('0x91')](_0x3e9e0a,_0x237eeb[0x1]===_0xda91('0x92')?![]:!![]);});}if(!_[_0xda91('0x93')](_0x3196a8)){_0x51e0c3[_0xda91('0x67')](_0x3382b9);_0x695bce[_0xda91('0x49')]('t.id\x20IN\x20?',_0x3196a8);}BPromise[_0xda91('0x94')]()[_0xda91('0x28')](function(){if(!_0x5ddf91){if(_0x31390b['query'][_0xda91('0x78')])return;_0x695bce[_0xda91('0x49')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x51e0c3[_0xda91('0x49')](_0xda91('0x95'));return;}if(_0x31390b[_0xda91('0x96')][_0xda91('0x97')]!==_0xda91('0x33'))return;return _0x31390b[_0xda91('0x96')][_0xda91('0x98')]({'attributes':['id'],'raw':!![]})[_0xda91('0x28')](function(_0x2f0c5a){if(_['isEmpty'](_0x2f0c5a)){_0x695bce[_0xda91('0x49')](_0xda91('0x99'));_0x51e0c3[_0xda91('0x49')](_0xda91('0x99'));}else{_0x695bce[_0xda91('0x49')](_0xda91('0x79'),_[_0xda91('0x35')](_0x2f0c5a,'id'));_0x51e0c3['where'](_0xda91('0x79'),_['map'](_0x2f0c5a,'id'));}});})['then'](function(){if(_0x31390b[_0xda91('0x96')][_0xda91('0x97')]===_0xda91('0x33')&&!_0x5ddf91&&!_0x31390b['query'][_0xda91('0x78')])return[];return db['sequelize'][_0xda91('0x42')](_0x695bce[_0xda91('0x9a')](),_0x21f0b4);})[_0xda91('0x28')](function(_0x1ac1e6){_0x4b0a19['count']=_0x1ac1e6[_0xda91('0x63')];if(_0x4b0a19[_0xda91('0x22')]===0x0)return[];return db[_0xda91('0x9b')][_0xda91('0x42')](_0x4b8e18[_0xda91('0x9a')](),_0x21f0b4)[_0xda91('0x28')](function(_0xe6dd02){_0x4b94e3=_['keyBy'](_0xe6dd02,'id');_0x21f0b4=_[_0xda91('0x2f')](_0x21f0b4,{'model':db[_0xda91('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31390b[_0xda91('0x42')][_0xda91('0x46')]){_0x30d523['attributes'][_0xda91('0x3a')](function(_0x33c3c0){_0x51e0c3[_0xda91('0x4c')]('i.'+_0x33c3c0);});}else{_0x51e0c3[_0xda91('0x4c')](_0xda91('0x90'),_0xda91('0x65'));_0x51e0c3['field']('a.key','Account.key');_0x51e0c3['field']('a.mandatoryDisposition',_0xda91('0x9c'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0x9d'),'contactName');_0x51e0c3[_0xda91('0x4c')](_0xda91('0x9e'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0x9f'),'Contact.firstName');_0x51e0c3[_0xda91('0x4c')]('c.lastName',_0xda91('0xa0'));_0x51e0c3['field'](_0xda91('0xa1'),_0xda91('0xa2'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa3'),_0xda91('0xa4'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa5'),_0xda91('0xa6'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa7'),_0xda91('0xa8'));_0x51e0c3[_0xda91('0x4c')]('o.fullname','Owner.fullname');_0x51e0c3[_0xda91('0x4c')](_0xda91('0xa9'),_0xda91('0xaa'));_0x51e0c3[_0xda91('0x4c')](_0xda91('0xab'),_0xda91('0x37'));}if(_0x30d523[_0xda91('0x21')])_0x51e0c3['limit'](_0x30d523[_0xda91('0x21')]);if(_0x30d523[_0xda91('0x1f')])_0x51e0c3[_0xda91('0x1f')](_0x30d523[_0xda91('0x1f')]);return db[_0xda91('0x9b')][_0xda91('0x42')](_0x51e0c3[_0xda91('0x9a')](),_0x21f0b4);})['then'](function(_0x57f278){if(_0x57f278['length']>0x0)_0x2f789d[_0xda91('0x49')](_0xda91('0xac'),_[_0xda91('0x35')](_0x57f278,'id'));return db['sequelize'][_0xda91('0x42')](_0x2f789d['toString'](),_0x21f0b4)['then'](function(_0x3b8e9d){var _0x5cf8b9=_[_0xda91('0xad')](_0x3b8e9d,_0xda91('0xae'));var _0x1fef18=[];_0x57f278[_0xda91('0x3a')](function(_0x6435b2){_0x1fef18['push'](updateFaxInteraction(_0x6435b2,_0x4b94e3,_0x5cf8b9));});return BPromise[_0xda91('0xaf')](_0x1fef18);});});})[_0xda91('0x28')](function(_0x1779bd){_0x4b0a19['rows']=_0x1779bd;return _0x4b0a19;})['then'](respondWithFilteredResult(_0x46c456,_0x30d523))[_0xda91('0x3b')](handleError(_0x46c456,null));};exports[_0xda91('0xb0')]=function(_0x573809,_0x5592d0){var _0x3e4aa0={'raw':![],'where':{'id':_0x573809[_0xda91('0xb1')]['id']}},_0x588b11={};_0x588b11[_0xda91('0x41')]=_[_0xda91('0x75')](db[_0xda91('0x3c')][_0xda91('0x3d')]);_0x588b11['query']=_[_0xda91('0x75')](_0x573809['query']);_0x588b11['filters']=_['intersection'](_0x588b11[_0xda91('0x41')],_0x588b11['query']);_0x3e4aa0['attributes']=_[_0xda91('0x44')](_0x588b11[_0xda91('0x41')],qs['fields'](_0x573809[_0xda91('0x42')][_0xda91('0x46')]));_0x3e4aa0[_0xda91('0x45')]=_0x3e4aa0[_0xda91('0x45')][_0xda91('0x63')]?_0x3e4aa0['attributes']:_0x588b11[_0xda91('0x41')];if(_0x573809[_0xda91('0x42')][_0xda91('0xb2')]){_0x3e4aa0[_0xda91('0xb3')]=[{'all':!![]}];}_0x3e4aa0=_[_0xda91('0x2f')]({},_0x3e4aa0,_0x573809[_0xda91('0xb4')]);return db[_0xda91('0x3c')][_0xda91('0x64')](_0x3e4aa0)[_0xda91('0x28')](handleEntityNotFound(_0x5592d0,null))[_0xda91('0x28')](respondWithResult(_0x5592d0,null))[_0xda91('0x3b')](handleError(_0x5592d0,null));};exports[_0xda91('0xb5')]=function(_0x4b4d9a,_0xee6674){return db['FaxInteraction'][_0xda91('0xb5')](_0x4b4d9a[_0xda91('0x30')],{})[_0xda91('0x28')](respondWithResult(_0xee6674,0xc9))['catch'](handleError(_0xee6674,null));};exports[_0xda91('0x27')]=function(_0x94304,_0x1fc676){if(_0x94304['body']['id']){delete _0x94304[_0xda91('0x30')]['id'];}return db[_0xda91('0x3c')][_0xda91('0x64')]({'where':{'id':_0x94304[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x1fc676,null))[_0xda91('0x28')](saveUpdates(_0x94304[_0xda91('0x30')],null))[_0xda91('0x28')](respondWithResult(_0x1fc676,null))[_0xda91('0x3b')](handleError(_0x1fc676,null));};exports[_0xda91('0x29')]=function(_0x3346d1,_0x1920f2){return db['FaxInteraction'][_0xda91('0x64')]({'where':{'id':_0x3346d1[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x1920f2,null))[_0xda91('0x28')](removeEntity(_0x1920f2,null))[_0xda91('0x3b')](handleError(_0x1920f2,null));};exports[_0xda91('0xb6')]=function(_0x3e5746,_0x195bfb){return db[_0xda91('0x3c')]['describe']()[_0xda91('0x28')](respondWithResult(_0x195bfb,null))['catch'](handleError(_0x195bfb,null));};exports['addMessage']=function(_0x23c25e,_0x1000cd,_0x42c7ee){return db[_0xda91('0xb7')][_0xda91('0x64')]({'where':{'id':_0x23c25e[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x1000cd,null))[_0xda91('0x28')](function(_0x330ab7){if(_0x330ab7){return _0x330ab7['addMessage'](_0x23c25e[_0xda91('0x30')]['ids'],_[_0xda91('0xb8')](_0x23c25e[_0xda91('0x30')],[_0xda91('0xb9'),'id'])||{});}})[_0xda91('0x28')](respondWithResult(_0x1000cd,null))[_0xda91('0x3b')](handleError(_0x1000cd,null));};exports[_0xda91('0xba')]=function(_0x19a86b,_0x5be6e1,_0xd377a0){var _0x477b3e={'raw':![],'where':{}};var _0x497f01={};var _0xbde48={'count':0x0,'rows':[]};return db[_0xda91('0x3c')][_0xda91('0xbb')]({'where':{'id':_0x19a86b['params']['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x5be6e1,null))[_0xda91('0x28')](function(_0x45a292){if(_0x45a292){_0x497f01[_0xda91('0x41')]=_[_0xda91('0x75')](db[_0xda91('0xb7')][_0xda91('0x3d')]);_0x497f01[_0xda91('0x42')]=_[_0xda91('0x75')](_0x19a86b[_0xda91('0x42')]);_0x497f01[_0xda91('0x43')]=_['intersection'](_0x497f01[_0xda91('0x41')],_0x497f01['query']);_0x477b3e[_0xda91('0x45')]=_[_0xda91('0x44')](_0x497f01[_0xda91('0x41')],qs['fields'](_0x19a86b['query'][_0xda91('0x46')]));_0x477b3e['attributes']=_0x477b3e['attributes'][_0xda91('0x63')]?_0x477b3e[_0xda91('0x45')]:_0x497f01[_0xda91('0x41')];if(!_0x19a86b[_0xda91('0x42')][_0xda91('0xbc')](_0xda91('0x47'))){_0x477b3e[_0xda91('0x21')]=qs[_0xda91('0x21')](_0x19a86b[_0xda91('0x42')]['limit']);_0x477b3e[_0xda91('0x1f')]=qs[_0xda91('0x1f')](_0x19a86b[_0xda91('0x42')][_0xda91('0x1f')]);}_0x477b3e[_0xda91('0x91')]=qs[_0xda91('0x48')](_0x19a86b[_0xda91('0x42')][_0xda91('0x48')]);_0x477b3e['where']=qs[_0xda91('0x43')](_['pick'](_0x19a86b['query'],_0x497f01['filters']));_0x477b3e[_0xda91('0x49')][_0xda91('0xae')]=_0x45a292['id'];if(_0x19a86b[_0xda91('0x42')][_0xda91('0x86')]){_0x477b3e[_0xda91('0x49')]=_[_0xda91('0x2f')](_0x477b3e[_0xda91('0x49')],{'$or':_['map'](_0x477b3e['attributes'],function(_0x41d48a){var _0x31205a={};_0x31205a[_0x41d48a]={'$like':'%'+_0x19a86b['query']['filter']+'%'};return _0x31205a;})});}if(_0x19a86b['query']['$gte']){var _0x2a3268=_0x19a86b[_0xda91('0x42')]['$gte'][_0xda91('0x39')](',');var _0x2f5b37={};_0x2f5b37[_0x2a3268[0x0]]={'$gte':moment(_0x2a3268[0x1])['format'](_0xda91('0xbd'))};_0x477b3e['where']=_[_0xda91('0x2f')](_0x477b3e[_0xda91('0x49')],_0x2f5b37);}_0x477b3e=_[_0xda91('0x2f')]({},_0x477b3e,_0x19a86b[_0xda91('0xb4')]);return db[_0xda91('0xb7')]['count']({'where':_0x477b3e[_0xda91('0x49')]})[_0xda91('0x28')](function(_0x477307){_0xbde48[_0xda91('0x22')]=_0x477307;if(_0x19a86b[_0xda91('0x42')][_0xda91('0xb2')]){_0x477b3e['include']=[{'all':!![]}];}return db['FaxMessage'][_0xda91('0xbe')](_0x477b3e);})['then'](function(_0x2c2244){_0xbde48[_0xda91('0xbf')]=_0x2c2244;return _0xbde48;});}})[_0xda91('0x28')](respondWithFilteredResult(_0x5be6e1,_0x477b3e))[_0xda91('0x3b')](handleError(_0x5be6e1,null));};exports[_0xda91('0xc0')]=function(_0x3b7cef,_0x119fb6,_0x56a8f6){return db['FaxInteraction'][_0xda91('0x64')]({'where':{'id':_0x3b7cef[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x119fb6,null))['then'](function(_0x265a2e){if(_0x265a2e){return _0x265a2e[_0xda91('0xc1')](_0x3b7cef[_0xda91('0x30')]['ids'],_[_0xda91('0xb8')](_0x3b7cef['body'],[_0xda91('0xb9'),'id'])||{})[_0xda91('0xc2')](function(){return db['Tag'][_0xda91('0xbe')]({'attributes':['id','name','color'],'where':{'id':_0x3b7cef['body'][_0xda91('0xb9')]}});})['then'](function(_0x4a6ca0){socket[_0xda91('0xc3')]('faxInteractionTags:save',{'id':Number(_0x3b7cef[_0xda91('0xb1')]['id']),'tags':_0x4a6ca0||[]});return{'id':Number(_0x3b7cef[_0xda91('0xb1')]['id']),'tags':_0x4a6ca0||[]};});}})[_0xda91('0x28')](respondWithResult(_0x119fb6,null))[_0xda91('0x3b')](handleError(_0x119fb6,null));};exports[_0xda91('0xc4')]=function(_0x638343,_0x77bdd7,_0x2d47c3){return db['FaxInteraction'][_0xda91('0x64')]({'where':{'id':_0x638343[_0xda91('0xb1')]['id']}})[_0xda91('0x28')](handleEntityNotFound(_0x77bdd7,null))[_0xda91('0x28')](function(_0x2290d1){if(_0x2290d1){return _0x2290d1[_0xda91('0xc4')](_0x638343[_0xda91('0x42')][_0xda91('0xb9')]);}})[_0xda91('0x28')](respondWithStatusCode(_0x77bdd7,null))[_0xda91('0x3b')](handleError(_0x77bdd7,null));};exports['download']=function(_0x397eff,_0x25a20f){var _0x3d12e4=moment()[_0xda91('0xc5')]()[_0xda91('0x9a')]();var _0x40d9cc=path['join'](config[_0xda91('0xc6')],_0xda91('0xc7'),_0xda91('0xc8'),_0xda91('0xc9'));var _0x4fa7bc=path['join'](config['root'],_0xda91('0xc7'),'files',_0xda91('0xca'));var _0x44a7ea=path[_0xda91('0xcb')](_0x40d9cc,_0x3d12e4);var _0x52f868=util[_0xda91('0xcc')]('transcript-%d-%s.zip',_0x397eff[_0xda91('0xb1')]['id'],_0x3d12e4);var _0x2397d7=path[_0xda91('0xcb')](_0x40d9cc,_0x52f868);var _0x12fc4c=[];_0x12fc4c[_0xda91('0xcd')]({'model':db[_0xda91('0xce')],'as':'Attachment','raw':!![]});var _0xe258f6=[{'model':db[_0xda91('0xb7')],'as':'Messages','attributes':['id',_0xda91('0x30'),_0xda91('0x7b')],'include':_0x12fc4c}];return db[_0xda91('0x3c')][_0xda91('0x64')]({'where':{'id':_0x397eff[_0xda91('0xb1')]['id']},'include':_0xe258f6})[_0xda91('0x28')](handleEntityNotFound(_0x25a20f,null))['then'](function(_0x33ef63){if(_0x33ef63&&_0x33ef63[_0xda91('0xcf')]){var _0x37c168=_0x33ef63[_0xda91('0xd0')]({'plain':!![]});fs[_0xda91('0xd1')](_0x44a7ea);for(var _0x379bb4=0x0;_0x379bb4<_0x37c168[_0xda91('0xcf')][_0xda91('0x63')];_0x379bb4++){var _0x42860f=_0x37c168[_0xda91('0xcf')][_0x379bb4][_0xda91('0xce')];if(_0x42860f){var _0x501d90=path[_0xda91('0xcb')](_0x4fa7bc,_0x42860f[_0xda91('0xd2')]);if(fs[_0xda91('0xd3')](_0x501d90)){fs[_0xda91('0xd4')](_0x501d90)[_0xda91('0xd5')](fs[_0xda91('0xd6')](path['join'](_0x44a7ea,_0x42860f[_0xda91('0xd2')])));}}}return BPromise['resolve']()[_0xda91('0x28')](function(){return new BPromise(function(_0x221acc,_0x56e642){zipdir(_0x44a7ea,{'saveTo':_0x2397d7},function(_0x160e6c,_0xa0939e){if(_0x160e6c)return _0x56e642(_0x160e6c);return _0x221acc(_0xa0939e);});})[_0xda91('0x28')](function(){return new BPromise(function(_0x681be9,_0x3d59dd){rimraf(_0x44a7ea,function(_0x5b79ea){if(_0x5b79ea)_0x3d59dd(_0x5b79ea);return _0x681be9();});});})[_0xda91('0x28')](function(){return _0x25a20f[_0xda91('0xd7')](_0x2397d7,_0x52f868,function(_0xfc30ff){if(_0xfc30ff){console[_0xda91('0xd8')](_0xda91('0xd9'),_0xfc30ff);}else{fs[_0xda91('0xda')](_0x2397d7);}});});});}else{return _0x25a20f['sendStatus'](0xc8);}})['catch'](handleError(_0x25a20f,null));}; \ No newline at end of file +var _0xa1f1=['find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','FaxAccountId','where','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','contactName','order','DESC','isEmpty','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','user','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','catch','show','params','includeAll','create','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','Attachment','Messages','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','send','render','merge','contact','message','agent','interaction','Users','map','fullname','Tags','TagIds','push','FaxInteraction','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','select','color','from','tools_tags','field','u.id','ui.FaxInteractionId','user_has_fax_interactions','users','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa1f1,0x7b));var _0x1a1f=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xa1f1[_0x576266];return _0x18234f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a1f('0x0'));var zipdir=require(_0x1a1f('0x1'));var jsonpatch=require(_0x1a1f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1a1f('0x3'));var Mustache=require(_0x1a1f('0x4'));var util=require(_0x1a1f('0x5'));var path=require(_0x1a1f('0x6'));var sox=require(_0x1a1f('0x7'));var csv=require(_0x1a1f('0x8'));var ejs=require(_0x1a1f('0x9'));var fs=require('fs');var fs_extra=require(_0x1a1f('0xa'));var _=require(_0x1a1f('0xb'));var squel=require(_0x1a1f('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a1f('0xd'));var deskjs=require(_0x1a1f('0xe'));var toCsv=require(_0x1a1f('0x8'));var querystring=require('querystring');var Papa=require(_0x1a1f('0xf'));var Redis=require(_0x1a1f('0x10'));var authService=require(_0x1a1f('0x11'));var qs=require(_0x1a1f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a1f('0x13'));var logger=require(_0x1a1f('0x14'))(_0x1a1f('0x15'));var utils=require(_0x1a1f('0x16'));var config=require(_0x1a1f('0x17'));var licenseUtil=require(_0x1a1f('0x18'));var db=require(_0x1a1f('0x19'))['db'];config['redis']=_[_0x1a1f('0x1a')](config[_0x1a1f('0x1b')],{'host':_0x1a1f('0x1c'),'port':0x18eb});var socket=require(_0x1a1f('0x1d'))(new Redis(config[_0x1a1f('0x1b')]));require(_0x1a1f('0x1e'))[_0x1a1f('0x1f')](socket);function respondWithStatusCode(_0x22c119,_0xb9c8c6){_0xb9c8c6=_0xb9c8c6||0xcc;return function(_0x431049){if(_0x431049){return _0x22c119['sendStatus'](_0xb9c8c6);}return _0x22c119[_0x1a1f('0x20')](_0xb9c8c6)[_0x1a1f('0x21')]();};}function respondWithResult(_0x4edb94,_0x4307d8){_0x4307d8=_0x4307d8||0xc8;return function(_0x24fe40){if(_0x24fe40){return _0x4edb94[_0x1a1f('0x20')](_0x4307d8)['json'](_0x24fe40);}};}function respondWithFilteredResult(_0x5a77c7,_0x323f15){return function(_0x44d4b8){if(_0x44d4b8){var _0x593d42=typeof _0x323f15[_0x1a1f('0x22')]===_0x1a1f('0x23')&&typeof _0x323f15['limit']==='undefined';var _0x32f86a=_0x44d4b8[_0x1a1f('0x24')];var _0x3435b2=_0x593d42?0x0:_0x323f15[_0x1a1f('0x22')];var _0x5b656f=_0x593d42?_0x44d4b8[_0x1a1f('0x24')]:_0x323f15[_0x1a1f('0x22')]+_0x323f15[_0x1a1f('0x25')];var _0x24f2d0;if(_0x5b656f>=_0x32f86a){_0x5b656f=_0x32f86a;_0x24f2d0=0xc8;}else{_0x24f2d0=0xce;}_0x5a77c7['status'](_0x24f2d0);return _0x5a77c7[_0x1a1f('0x26')](_0x1a1f('0x27'),_0x3435b2+'-'+_0x5b656f+'/'+_0x32f86a)['json'](_0x44d4b8);}return null;};}function patchUpdates(_0xe77dcf){return function(_0x962360){try{jsonpatch[_0x1a1f('0x28')](_0x962360,_0xe77dcf,!![]);}catch(_0x1dedb2){return BPromise['reject'](_0x1dedb2);}return _0x962360[_0x1a1f('0x29')]();};}function saveUpdates(_0x56c4ae,_0xe4161a){return function(_0x39c629){if(_0x39c629){return _0x39c629[_0x1a1f('0x2a')](_0x56c4ae)[_0x1a1f('0x2b')](function(_0x3d0440){return _0x3d0440;});}return null;};}function removeEntity(_0x11e222,_0x4870e2){return function(_0x418e71){if(_0x418e71){return _0x418e71[_0x1a1f('0x2c')]()[_0x1a1f('0x2b')](function(){_0x11e222[_0x1a1f('0x20')](0xcc)[_0x1a1f('0x21')]();});}};}function handleEntityNotFound(_0x1b1db8,_0x5bccfe){return function(_0x48e156){if(!_0x48e156){_0x1b1db8[_0x1a1f('0x2d')](0x194);}return _0x48e156;};}function handleError(_0x3711db,_0xb4f0ce){_0xb4f0ce=_0xb4f0ce||0x1f4;return function(_0x4e1012){logger[_0x1a1f('0x2e')](_0x4e1012[_0x1a1f('0x2f')]);if(_0x4e1012['name']){delete _0x4e1012['name'];}_0x3711db[_0x1a1f('0x20')](_0xb4f0ce)[_0x1a1f('0x30')](_0x4e1012);};}function getMustacheRender(_0x2a0db3,_0x2ec14b){return Mustache[_0x1a1f('0x31')](_0x2a0db3,_[_0x1a1f('0x32')](_0x2ec14b['body'],{'contact':_0x2ec14b[_0x1a1f('0x33')],'message':_0x2ec14b[_0x1a1f('0x34')],'agent':_0x2ec14b[_0x1a1f('0x35')],'interaction':_0x2ec14b[_0x1a1f('0x36')],'account':_0x2ec14b['account']}))||'';}function getInteractionUsers(_0x4b58f3,_0x53c9a4){return new BPromise(function(_0x2ea4c8,_0x27f167){try{if(_0x53c9a4[_0x4b58f3['id']]){_0x4b58f3[_0x1a1f('0x37')]=_[_0x1a1f('0x38')](_0x53c9a4[_0x4b58f3['id']],function(_0x185d13){return{'id':_0x185d13['id'],'fullname':_0x185d13[_0x1a1f('0x39')]};});}}catch(_0x4be2af){_0x27f167(_0x4be2af);}_0x2ea4c8(_0x4b58f3);});}function getInteractionTags(_0x531ac7,_0x19c91e){return new BPromise(function(_0x43599a,_0x401652){try{if(_0x531ac7['TagIds']){_0x531ac7[_0x1a1f('0x3a')]=[];_0x531ac7[_0x1a1f('0x3b')]['split'](',')['forEach'](function(_0xf54a09){_0x531ac7[_0x1a1f('0x3a')][_0x1a1f('0x3c')](_0x19c91e[_0xf54a09]);});}delete _0x531ac7[_0x1a1f('0x3b')];}catch(_0xa54b93){_0x401652(_0xa54b93);}_0x43599a(_0x531ac7);});}function updateFaxInteraction(_0x504797,_0x347fe0,_0x1552d9){return new BPromise(function(_0x3c5db2,_0x27cd75){return getInteractionUsers(_0x504797,_0x1552d9)['then'](function(_0x5de67a){return getInteractionTags(_0x5de67a,_0x347fe0);})[_0x1a1f('0x2b')](function(_0x1e88ad){_0x3c5db2(_0x1e88ad);})['catch'](function(_0x39c8a0){_0x27cd75(_0x39c8a0);});});}exports['index']=function(_0x548bbf,_0x1a858f){var _0x20fa3a={},_0x2a5f6c={},_0x348076={'count':0x0,'rows':[]};var _0x39f202=_['map'](db[_0x1a1f('0x3d')][_0x1a1f('0x3e')],function(_0x478e0){return{'name':_0x478e0['fieldName'],'type':_0x478e0[_0x1a1f('0x3f')][_0x1a1f('0x40')]};});_0x2a5f6c[_0x1a1f('0x41')]=_[_0x1a1f('0x38')](_0x39f202,_0x1a1f('0x42'));_0x2a5f6c[_0x1a1f('0x43')]=_['keys'](_0x548bbf[_0x1a1f('0x43')]);_0x2a5f6c[_0x1a1f('0x44')]=_[_0x1a1f('0x45')](_0x2a5f6c[_0x1a1f('0x41')],_0x2a5f6c[_0x1a1f('0x43')]);_0x20fa3a[_0x1a1f('0x46')]=_['intersection'](_0x2a5f6c[_0x1a1f('0x41')],qs[_0x1a1f('0x47')](_0x548bbf['query'][_0x1a1f('0x47')]));_0x20fa3a[_0x1a1f('0x46')]=_0x20fa3a[_0x1a1f('0x46')][_0x1a1f('0x48')]?_0x20fa3a[_0x1a1f('0x46')]:_0x2a5f6c[_0x1a1f('0x41')];if(!_0x548bbf['query']['hasOwnProperty'](_0x1a1f('0x49'))){_0x20fa3a['limit']=qs['limit'](_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x25')]);_0x20fa3a[_0x1a1f('0x22')]=qs[_0x1a1f('0x22')](_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x22')]);}_0x20fa3a['order']=qs[_0x1a1f('0x4a')](_0x548bbf[_0x1a1f('0x43')]['sort']);_0x20fa3a['where']=qs[_0x1a1f('0x44')](_[_0x1a1f('0x4b')](_0x548bbf[_0x1a1f('0x43')],_0x2a5f6c[_0x1a1f('0x44')]),_0x39f202);var _0x390f0b=[];var _0x19676f=squel[_0x1a1f('0x4c')]()['field']('id')['field'](_0x1a1f('0x42'))['field'](_0x1a1f('0x4d'))[_0x1a1f('0x4e')](_0x1a1f('0x4f'));var _0x529b6d=squel[_0x1a1f('0x4c')]()[_0x1a1f('0x50')](_0x1a1f('0x51'))[_0x1a1f('0x50')]('u.fullname')[_0x1a1f('0x50')](_0x1a1f('0x52'))[_0x1a1f('0x4e')](_0x1a1f('0x53'),'ui')['left_join'](_0x1a1f('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x235a88=squel[_0x1a1f('0x4c')]()[_0x1a1f('0x4e')](_0x1a1f('0x55'),'i')[_0x1a1f('0x56')]('cm_contacts','c',_0x1a1f('0x57'))[_0x1a1f('0x56')]('users','o','o.id\x20=\x20i.UserId')[_0x1a1f('0x56')]('fax_accounts','a',_0x1a1f('0x58'))[_0x1a1f('0x56')]('fax_messages','me',_0x1a1f('0x59'))[_0x1a1f('0x56')](_0x1a1f('0x5a'),'it',_0x1a1f('0x5b'))['left_join'](_0x1a1f('0x4f'),'t',_0x1a1f('0x5c'));var _0x1f7d12=squel[_0x1a1f('0x5d')]();var _0x474f6c=[];var _0x37a1ac=squel[_0x1a1f('0x5d')]();var _0x55a4d7;if(_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x5e')]){_0x55a4d7=as[_0x1a1f('0x5f')](_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x5e')]);var _0x3f0bc3=_0x55a4d7[_0x1a1f('0x60')];for(var _0x3fa30e=0x0;_0x3fa30e<_0x55a4d7['conditions']['length'];_0x3fa30e++){var _0x46bc5d=_0x55a4d7['conditions'][_0x3fa30e];var _0x29a984='i';var _0x1f2bd2=_[_0x1a1f('0x61')](_0x39f202,['name',_0x46bc5d['field']]);if(!_0x1f2bd2){switch(_0x46bc5d[_0x1a1f('0x50')]){case _0x1a1f('0x62'):if(_0x46bc5d[_0x1a1f('0x63')]==0x1){_0x235a88[_0x1a1f('0x64')]('`'+_0x46bc5d['field']+_0x1a1f('0x65'));}else{_0x235a88[_0x1a1f('0x64')]('`'+_0x46bc5d['field']+_0x1a1f('0x66'));}break;case _0x1a1f('0x67'):if(_0x46bc5d[_0x1a1f('0x68')]===_0x1a1f('0x69')){if(_0x46bc5d[_0x1a1f('0x63')][_0x1a1f('0x6a')]('\x20')[_0x1a1f('0x48')]>0x1){_0x1f7d12[_0x3f0bc3](_0x1a1f('0x6b'),qs['getFullTextValue'](_0x46bc5d[_0x1a1f('0x63')]),null);}else{var _0x4f44ff='%'+_0x46bc5d[_0x1a1f('0x63')]+'%';_0x1f7d12[_0x3f0bc3](_0x1a1f('0x6c'),_0x4f44ff,_0x4f44ff,_0x4f44ff);}}else{_0x1f2bd2=_[_0x1a1f('0x61')](_0x39f202,['name',_0x1a1f('0x6d')]);_0x46bc5d[_0x1a1f('0x50')]=_0x1a1f('0x6d');_0x3aa117=as[_0x1a1f('0x6e')](_0x29a984,_0x1f2bd2['type'],_0x46bc5d);_0x1f7d12[_0x3f0bc3](_0x3aa117[_0x1a1f('0x6f')],_0x3aa117['value'][_0x1a1f('0x70')],_0x3aa117[_0x1a1f('0x63')][_0x1a1f('0x21')]);}break;case _0x1a1f('0x71'):var _0x459c9a=_0x46bc5d[_0x1a1f('0x63')]['split'](',')['map'](function(_0x56b94a){return Number(_0x56b94a);});_0x459c9a[_0x1a1f('0x72')](function(_0x3dbb6b){_0x37a1ac['or'](_0x1a1f('0x73'),'%,'+_0x3dbb6b+',%');});_0x474f6c=_[_0x1a1f('0x74')](_0x474f6c,_0x459c9a);break;case _0x1a1f('0x75'):if(_0x46bc5d[_0x1a1f('0x68')]===_0x1a1f('0x69')){_0x1f7d12[_0x3f0bc3](_0x1a1f('0x76'),'%'+_0x46bc5d[_0x1a1f('0x63')]+'%',null);}else{_0x1f2bd2=_['find'](_0x39f202,['name',_0x1a1f('0x77')]);_0x46bc5d[_0x1a1f('0x50')]=_0x1a1f('0x77');_0x3aa117=as[_0x1a1f('0x6e')](_0x29a984,_0x1f2bd2[_0x1a1f('0x3f')],_0x46bc5d);_0x1f7d12[_0x3f0bc3](_0x3aa117['text'],_0x3aa117['value'][_0x1a1f('0x70')],_0x3aa117[_0x1a1f('0x63')][_0x1a1f('0x21')]);}break;case _0x1a1f('0x78'):_0x3aa117=as[_0x1a1f('0x6e')]('me',null,_0x46bc5d);_0x1f7d12[_0x3f0bc3](_0x3aa117[_0x1a1f('0x6f')],_0x3aa117['value'][_0x1a1f('0x70')],_0x3aa117['value']['end']);break;}}else{var _0x3aa117=as[_0x1a1f('0x6e')](_0x29a984,_0x1f2bd2[_0x1a1f('0x3f')],_0x46bc5d);_0x1f7d12[_0x3f0bc3](_0x3aa117[_0x1a1f('0x6f')],_0x3aa117[_0x1a1f('0x63')]['start'],_0x3aa117[_0x1a1f('0x63')][_0x1a1f('0x21')]);}}}else{var _0x211e75=_(_0x548bbf[_0x1a1f('0x43')])[_0x1a1f('0x79')]()[_0x1a1f('0x38')](function(_0x39f7af){return _[_0x1a1f('0x7a')](_0x39f202,[_0x1a1f('0x42'),_0x39f7af])?_0x39f7af:undefined;})['compact']()[_0x1a1f('0x63')]();if(!_['isEmpty'](_0x211e75)){_0x211e75[_0x1a1f('0x72')](function(_0x25149f){if(_0x25149f===_0x1a1f('0x7b')){_0x235a88[_0x1a1f('0x7c')]('i.FaxAccountId\x20IN\x20?',[][_0x1a1f('0x7d')](_0x548bbf[_0x1a1f('0x43')][_0x25149f]));}else if(_0x25149f===_0x1a1f('0x7e')){var _0x47770c=JSON[_0x1a1f('0x7f')](_0x548bbf[_0x1a1f('0x43')][_0x25149f])[_0x1a1f('0x80')];var _0x4e6ce1=JSON[_0x1a1f('0x7f')](_0x548bbf[_0x1a1f('0x43')][_0x25149f])['$lte'];_0x235a88[_0x1a1f('0x7c')](_0x1a1f('0x81'),_0x47770c,_0x4e6ce1);}else{if(_0x548bbf['query'][_0x25149f]===_0x1a1f('0x82')){_0x235a88[_0x1a1f('0x7c')]('i.'+_0x25149f+_0x1a1f('0x83'));}else{_0x235a88['where']('i.'+_0x25149f+_0x1a1f('0x84'),_0x548bbf['query'][_0x25149f]);}}});}if(_0x548bbf['query']['read']){if(_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x85')]==0x1){_0x235a88[_0x1a1f('0x64')](_0x1a1f('0x86'));}else{_0x235a88[_0x1a1f('0x64')](_0x1a1f('0x87'));}}if(_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x88')]){_0x474f6c=_['isArray'](_0x548bbf['query'][_0x1a1f('0x88')])?_0x548bbf[_0x1a1f('0x43')]['tag']:new Array(_0x548bbf['query'][_0x1a1f('0x88')]);_0x474f6c[_0x1a1f('0x72')](function(_0x523c75){_0x37a1ac['or'](_0x1a1f('0x73'),'%,'+_0x523c75+',%');});}if(_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x89')]){var _0x2a21f8=_0x548bbf[_0x1a1f('0x43')]['filter'][_0x1a1f('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1a1f('0x8b')](_0x2a21f8)){_0x1f7d12['or'](_0x1a1f('0x8c'),_0x2a21f8+'%')['or']('i.fax\x20LIKE\x20?',_0x2a21f8+'%');}_0x1f7d12['or'](_0x1a1f('0x8d'),_0x2a21f8+'%');}}_0x235a88[_0x1a1f('0x7c')](_0x1f7d12);_0x235a88['group'](_0x1a1f('0x8e'));var _0x28e870={'type':db['Sequelize']['QueryTypes'][_0x1a1f('0x8f')],'raw':!![]};var _0x1da96f=_0x235a88[_0x1a1f('0x90')]();_0x1da96f['field'](_0x1a1f('0x8e'));_0x1da96f[_0x1a1f('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1a1f('0x62'));if(_0x20fa3a['order']){_0x20fa3a['order'][_0x1a1f('0x72')](function(_0x4c3f99){var _0x319157=_0x4c3f99[0x0]===_0x1a1f('0x91')?_0x4c3f99[0x0]:'i.'+_0x4c3f99[0x0];_0x235a88[_0x1a1f('0x92')](_0x319157,_0x4c3f99[0x1]===_0x1a1f('0x93')?![]:!![]);});}if(!_[_0x1a1f('0x94')](_0x474f6c)){_0x235a88['having'](_0x37a1ac);_0x1da96f[_0x1a1f('0x7c')](_0x1a1f('0x95'),_0x474f6c);}BPromise['resolve']()['then'](function(){if(!_0x55a4d7){if(_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x7b')])return;_0x1da96f[_0x1a1f('0x7c')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x235a88[_0x1a1f('0x7c')](_0x1a1f('0x96'));return;}if(_0x548bbf['user'][_0x1a1f('0x97')]!==_0x1a1f('0x35'))return;return _0x548bbf[_0x1a1f('0x98')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x1a1f('0x2b')](function(_0x1e7fba){if(_[_0x1a1f('0x94')](_0x1e7fba)){_0x1da96f[_0x1a1f('0x7c')]('i.FaxAccountId\x20IS\x20NULL');_0x235a88[_0x1a1f('0x7c')](_0x1a1f('0x99'));}else{_0x1da96f[_0x1a1f('0x7c')](_0x1a1f('0x9a'),_['map'](_0x1e7fba,'id'));_0x235a88[_0x1a1f('0x7c')](_0x1a1f('0x9a'),_['map'](_0x1e7fba,'id'));}});})[_0x1a1f('0x2b')](function(){if(_0x548bbf['user'][_0x1a1f('0x97')]===_0x1a1f('0x35')&&!_0x55a4d7&&!_0x548bbf[_0x1a1f('0x43')]['FaxAccountId'])return[];return db[_0x1a1f('0x9b')]['query'](_0x1da96f[_0x1a1f('0x9c')](),_0x28e870);})[_0x1a1f('0x2b')](function(_0x2b4185){_0x348076[_0x1a1f('0x24')]=_0x2b4185['length'];if(_0x348076[_0x1a1f('0x24')]===0x0)return[];return db[_0x1a1f('0x9b')][_0x1a1f('0x43')](_0x19676f['toString'](),_0x28e870)[_0x1a1f('0x2b')](function(_0x342624){_0x390f0b=_[_0x1a1f('0x9d')](_0x342624,'id');_0x28e870=_[_0x1a1f('0x32')](_0x28e870,{'model':db[_0x1a1f('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x548bbf[_0x1a1f('0x43')][_0x1a1f('0x47')]){_0x20fa3a[_0x1a1f('0x46')][_0x1a1f('0x72')](function(_0x397d61){_0x235a88[_0x1a1f('0x50')]('i.'+_0x397d61);});}else{_0x235a88[_0x1a1f('0x50')](_0x1a1f('0x9e'),'unreadMessages');_0x235a88[_0x1a1f('0x50')](_0x1a1f('0x9f'),_0x1a1f('0xa0'));_0x235a88['field']('a.mandatoryDisposition',_0x1a1f('0xa1'));_0x235a88['field'](_0x1a1f('0xa2'),_0x1a1f('0x91'));_0x235a88['field']('i.*');_0x235a88['field']('c.firstName',_0x1a1f('0xa3'));_0x235a88['field'](_0x1a1f('0xa4'),_0x1a1f('0xa5'));_0x235a88[_0x1a1f('0x50')]('c.email',_0x1a1f('0xa6'));_0x235a88['field'](_0x1a1f('0xa7'),_0x1a1f('0xa8'));_0x235a88[_0x1a1f('0x50')](_0x1a1f('0xa9'),_0x1a1f('0xaa'));_0x235a88[_0x1a1f('0x50')](_0x1a1f('0xab'),_0x1a1f('0xac'));_0x235a88['field'](_0x1a1f('0xad'),'Owner.fullname');_0x235a88[_0x1a1f('0x50')](_0x1a1f('0xae'),'Owner.internal');_0x235a88[_0x1a1f('0x50')](_0x1a1f('0xaf'),_0x1a1f('0x3b'));}if(_0x20fa3a[_0x1a1f('0x25')])_0x235a88[_0x1a1f('0x25')](_0x20fa3a[_0x1a1f('0x25')]);if(_0x20fa3a[_0x1a1f('0x22')])_0x235a88['offset'](_0x20fa3a[_0x1a1f('0x22')]);return db[_0x1a1f('0x9b')]['query'](_0x235a88[_0x1a1f('0x9c')](),_0x28e870);})[_0x1a1f('0x2b')](function(_0x35d857){if(_0x35d857[_0x1a1f('0x48')]>0x0)_0x529b6d['where'](_0x1a1f('0xb0'),_[_0x1a1f('0x38')](_0x35d857,'id'));return db[_0x1a1f('0x9b')][_0x1a1f('0x43')](_0x529b6d[_0x1a1f('0x9c')](),_0x28e870)[_0x1a1f('0x2b')](function(_0x484376){var _0x2b87d0=_[_0x1a1f('0xb1')](_0x484376,_0x1a1f('0xb2'));var _0x313c27=[];_0x35d857['forEach'](function(_0xe47133){_0x313c27['push'](updateFaxInteraction(_0xe47133,_0x390f0b,_0x2b87d0));});return BPromise['all'](_0x313c27);});});})[_0x1a1f('0x2b')](function(_0x10ad97){_0x348076[_0x1a1f('0xb3')]=_0x10ad97;return _0x348076;})[_0x1a1f('0x2b')](respondWithFilteredResult(_0x1a858f,_0x20fa3a))[_0x1a1f('0xb4')](handleError(_0x1a858f,null));};exports[_0x1a1f('0xb5')]=function(_0x59a992,_0x1fbc9b){var _0x387f1f={'raw':![],'where':{'id':_0x59a992[_0x1a1f('0xb6')]['id']}},_0x2ccf36={};_0x2ccf36[_0x1a1f('0x41')]=_[_0x1a1f('0x79')](db[_0x1a1f('0x3d')]['rawAttributes']);_0x2ccf36['query']=_[_0x1a1f('0x79')](_0x59a992['query']);_0x2ccf36[_0x1a1f('0x44')]=_[_0x1a1f('0x45')](_0x2ccf36[_0x1a1f('0x41')],_0x2ccf36[_0x1a1f('0x43')]);_0x387f1f[_0x1a1f('0x46')]=_[_0x1a1f('0x45')](_0x2ccf36[_0x1a1f('0x41')],qs[_0x1a1f('0x47')](_0x59a992['query'][_0x1a1f('0x47')]));_0x387f1f[_0x1a1f('0x46')]=_0x387f1f[_0x1a1f('0x46')][_0x1a1f('0x48')]?_0x387f1f[_0x1a1f('0x46')]:_0x2ccf36[_0x1a1f('0x41')];if(_0x59a992[_0x1a1f('0x43')][_0x1a1f('0xb7')]){_0x387f1f['include']=[{'all':!![]}];}_0x387f1f=_['merge']({},_0x387f1f,_0x59a992['options']);return db[_0x1a1f('0x3d')][_0x1a1f('0x61')](_0x387f1f)['then'](handleEntityNotFound(_0x1fbc9b,null))['then'](respondWithResult(_0x1fbc9b,null))[_0x1a1f('0xb4')](handleError(_0x1fbc9b,null));};exports[_0x1a1f('0xb8')]=function(_0x10e90f,_0x448bc0){return db['FaxInteraction']['create'](_0x10e90f[_0x1a1f('0x78')],{})[_0x1a1f('0x2b')](respondWithResult(_0x448bc0,0xc9))[_0x1a1f('0xb4')](handleError(_0x448bc0,null));};exports[_0x1a1f('0x2a')]=function(_0x4a5b37,_0x5ecdc7){if(_0x4a5b37[_0x1a1f('0x78')]['id']){delete _0x4a5b37['body']['id'];}return db['FaxInteraction'][_0x1a1f('0x61')]({'where':{'id':_0x4a5b37[_0x1a1f('0xb6')]['id']}})[_0x1a1f('0x2b')](handleEntityNotFound(_0x5ecdc7,null))['then'](saveUpdates(_0x4a5b37[_0x1a1f('0x78')],null))[_0x1a1f('0x2b')](respondWithResult(_0x5ecdc7,null))[_0x1a1f('0xb4')](handleError(_0x5ecdc7,null));};exports[_0x1a1f('0x2c')]=function(_0x2b218b,_0x3de191){return db[_0x1a1f('0x3d')]['find']({'where':{'id':_0x2b218b[_0x1a1f('0xb6')]['id']}})[_0x1a1f('0x2b')](handleEntityNotFound(_0x3de191,null))[_0x1a1f('0x2b')](removeEntity(_0x3de191,null))[_0x1a1f('0xb4')](handleError(_0x3de191,null));};exports['describe']=function(_0x16806c,_0x46eb88){return db[_0x1a1f('0x3d')][_0x1a1f('0xb9')]()[_0x1a1f('0x2b')](respondWithResult(_0x46eb88,null))[_0x1a1f('0xb4')](handleError(_0x46eb88,null));};exports[_0x1a1f('0xba')]=function(_0x773db3,_0xd3b91b,_0x4874c3){return db[_0x1a1f('0xbb')][_0x1a1f('0x61')]({'where':{'id':_0x773db3[_0x1a1f('0xb6')]['id']}})[_0x1a1f('0x2b')](handleEntityNotFound(_0xd3b91b,null))['then'](function(_0x1d1d80){if(_0x1d1d80){return _0x1d1d80[_0x1a1f('0xba')](_0x773db3[_0x1a1f('0x78')][_0x1a1f('0xbc')],_[_0x1a1f('0xbd')](_0x773db3[_0x1a1f('0x78')],[_0x1a1f('0xbc'),'id'])||{});}})[_0x1a1f('0x2b')](respondWithResult(_0xd3b91b,null))[_0x1a1f('0xb4')](handleError(_0xd3b91b,null));};exports[_0x1a1f('0xbe')]=function(_0x44e432,_0x407a60,_0x561b01){var _0x3059b1={'raw':![],'where':{}};var _0x3695c0={};var _0x393022={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x1a1f('0xbf')]({'where':{'id':_0x44e432[_0x1a1f('0xb6')]['id']}})['then'](handleEntityNotFound(_0x407a60,null))[_0x1a1f('0x2b')](function(_0x4fe446){if(_0x4fe446){_0x3695c0[_0x1a1f('0x41')]=_[_0x1a1f('0x79')](db['FaxMessage'][_0x1a1f('0x3e')]);_0x3695c0[_0x1a1f('0x43')]=_[_0x1a1f('0x79')](_0x44e432[_0x1a1f('0x43')]);_0x3695c0[_0x1a1f('0x44')]=_[_0x1a1f('0x45')](_0x3695c0[_0x1a1f('0x41')],_0x3695c0[_0x1a1f('0x43')]);_0x3059b1['attributes']=_[_0x1a1f('0x45')](_0x3695c0[_0x1a1f('0x41')],qs[_0x1a1f('0x47')](_0x44e432[_0x1a1f('0x43')][_0x1a1f('0x47')]));_0x3059b1[_0x1a1f('0x46')]=_0x3059b1[_0x1a1f('0x46')][_0x1a1f('0x48')]?_0x3059b1[_0x1a1f('0x46')]:_0x3695c0[_0x1a1f('0x41')];if(!_0x44e432[_0x1a1f('0x43')][_0x1a1f('0xc0')](_0x1a1f('0x49'))){_0x3059b1['limit']=qs[_0x1a1f('0x25')](_0x44e432[_0x1a1f('0x43')][_0x1a1f('0x25')]);_0x3059b1[_0x1a1f('0x22')]=qs[_0x1a1f('0x22')](_0x44e432[_0x1a1f('0x43')][_0x1a1f('0x22')]);}_0x3059b1[_0x1a1f('0x92')]=qs[_0x1a1f('0x4a')](_0x44e432['query'][_0x1a1f('0x4a')]);_0x3059b1['where']=qs[_0x1a1f('0x44')](_[_0x1a1f('0x4b')](_0x44e432[_0x1a1f('0x43')],_0x3695c0[_0x1a1f('0x44')]));_0x3059b1['where'][_0x1a1f('0xb2')]=_0x4fe446['id'];if(_0x44e432[_0x1a1f('0x43')]['filter']){_0x3059b1['where']=_['merge'](_0x3059b1[_0x1a1f('0x7c')],{'$or':_['map'](_0x3059b1['attributes'],function(_0x326c9){var _0x235100={};_0x235100[_0x326c9]={'$like':'%'+_0x44e432['query'][_0x1a1f('0x89')]+'%'};return _0x235100;})});}if(_0x44e432['query']['$gte']){var _0x8053a7=_0x44e432[_0x1a1f('0x43')][_0x1a1f('0x80')]['split'](',');var _0x368cdf={};_0x368cdf[_0x8053a7[0x0]]={'$gte':moment(_0x8053a7[0x1])[_0x1a1f('0xc1')](_0x1a1f('0xc2'))};_0x3059b1[_0x1a1f('0x7c')]=_[_0x1a1f('0x32')](_0x3059b1[_0x1a1f('0x7c')],_0x368cdf);}_0x3059b1=_[_0x1a1f('0x32')]({},_0x3059b1,_0x44e432['options']);return db[_0x1a1f('0xbb')][_0x1a1f('0x24')]({'where':_0x3059b1[_0x1a1f('0x7c')]})['then'](function(_0x9f20da){_0x393022[_0x1a1f('0x24')]=_0x9f20da;if(_0x44e432[_0x1a1f('0x43')]['includeAll']){_0x3059b1['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3059b1);})[_0x1a1f('0x2b')](function(_0x3f21a4){_0x393022['rows']=_0x3f21a4;return _0x393022;});}})[_0x1a1f('0x2b')](respondWithFilteredResult(_0x407a60,_0x3059b1))[_0x1a1f('0xb4')](handleError(_0x407a60,null));};exports['addTags']=function(_0x1a4842,_0x323baf,_0x3af12e){return db['FaxInteraction'][_0x1a1f('0x61')]({'where':{'id':_0x1a4842[_0x1a1f('0xb6')]['id']}})[_0x1a1f('0x2b')](handleEntityNotFound(_0x323baf,null))['then'](function(_0xb0aacf){if(_0xb0aacf){return _0xb0aacf[_0x1a1f('0xc3')](_0x1a4842[_0x1a1f('0x78')][_0x1a1f('0xbc')],_[_0x1a1f('0xbd')](_0x1a4842[_0x1a1f('0x78')],['ids','id'])||{})[_0x1a1f('0xc4')](function(){return db['Tag'][_0x1a1f('0xc5')]({'attributes':['id',_0x1a1f('0x42'),_0x1a1f('0x4d')],'where':{'id':_0x1a4842[_0x1a1f('0x78')]['ids']}});})[_0x1a1f('0x2b')](function(_0xebb088){socket[_0x1a1f('0xc6')](_0x1a1f('0xc7'),{'id':Number(_0x1a4842[_0x1a1f('0xb6')]['id']),'tags':_0xebb088||[]});return{'id':Number(_0x1a4842[_0x1a1f('0xb6')]['id']),'tags':_0xebb088||[]};});}})[_0x1a1f('0x2b')](respondWithResult(_0x323baf,null))[_0x1a1f('0xb4')](handleError(_0x323baf,null));};exports[_0x1a1f('0xc8')]=function(_0xea48d3,_0x320a74,_0x12a788){return db[_0x1a1f('0x3d')][_0x1a1f('0x61')]({'where':{'id':_0xea48d3['params']['id']}})[_0x1a1f('0x2b')](handleEntityNotFound(_0x320a74,null))[_0x1a1f('0x2b')](function(_0x5c0bd9){if(_0x5c0bd9){return _0x5c0bd9['removeTags'](_0xea48d3[_0x1a1f('0x43')]['ids']);}})[_0x1a1f('0x2b')](respondWithStatusCode(_0x320a74,null))['catch'](handleError(_0x320a74,null));};exports['download']=function(_0x3f74a9,_0x199ef2){var _0x51daa0=moment()[_0x1a1f('0xc9')]()[_0x1a1f('0x9c')]();var _0x2bc84d=path[_0x1a1f('0xca')](config[_0x1a1f('0xcb')],_0x1a1f('0xcc'),_0x1a1f('0xcd'),_0x1a1f('0xce'));var _0x55787d=path[_0x1a1f('0xca')](config[_0x1a1f('0xcb')],'server',_0x1a1f('0xcd'),_0x1a1f('0xcf'));var _0x227f67=path[_0x1a1f('0xca')](_0x2bc84d,_0x51daa0);var _0x431a32=util[_0x1a1f('0xc1')]('transcript-%d-%s.zip',_0x3f74a9['params']['id'],_0x51daa0);var _0x4774ab=path[_0x1a1f('0xca')](_0x2bc84d,_0x431a32);var _0xcc0a15=[];_0xcc0a15[_0x1a1f('0x3c')]({'model':db['Attachment'],'as':_0x1a1f('0xd0'),'raw':!![]});var _0x5b1775=[{'model':db[_0x1a1f('0xbb')],'as':'Messages','attributes':['id',_0x1a1f('0x78'),_0x1a1f('0x7e')],'include':_0xcc0a15}];return db[_0x1a1f('0x3d')][_0x1a1f('0x61')]({'where':{'id':_0x3f74a9['params']['id']},'include':_0x5b1775})[_0x1a1f('0x2b')](handleEntityNotFound(_0x199ef2,null))['then'](function(_0x512eee){if(_0x512eee&&_0x512eee[_0x1a1f('0xd1')]){var _0x3a43b7=_0x512eee['get']({'plain':!![]});fs[_0x1a1f('0xd2')](_0x227f67);for(var _0x439eb7=0x0;_0x439eb7<_0x3a43b7[_0x1a1f('0xd1')][_0x1a1f('0x48')];_0x439eb7++){var _0x5274c6=_0x3a43b7[_0x1a1f('0xd1')][_0x439eb7][_0x1a1f('0xd0')];if(_0x5274c6){var _0x6b3e23=path[_0x1a1f('0xca')](_0x55787d,_0x5274c6['basename']);if(fs[_0x1a1f('0xd3')](_0x6b3e23)){fs[_0x1a1f('0xd4')](_0x6b3e23)[_0x1a1f('0xd5')](fs[_0x1a1f('0xd6')](path[_0x1a1f('0xca')](_0x227f67,_0x5274c6[_0x1a1f('0xd7')])));}}}return BPromise['resolve']()[_0x1a1f('0x2b')](function(){return new BPromise(function(_0x49173a,_0x3aad92){zipdir(_0x227f67,{'saveTo':_0x4774ab},function(_0x301098,_0x49213c){if(_0x301098)return _0x3aad92(_0x301098);return _0x49173a(_0x49213c);});})[_0x1a1f('0x2b')](function(){return new BPromise(function(_0x45f641,_0x4046f7){rimraf(_0x227f67,function(_0x11ff66){if(_0x11ff66)_0x4046f7(_0x11ff66);return _0x45f641();});});})[_0x1a1f('0x2b')](function(){return _0x199ef2[_0x1a1f('0xd8')](_0x4774ab,_0x431a32,function(_0x2b4a1b){if(_0x2b4a1b){console[_0x1a1f('0xd9')](_0x1a1f('0xda'),_0x2b4a1b);}else{fs[_0x1a1f('0xdb')](_0x4774ab);}});});});}else{return _0x199ef2[_0x1a1f('0x2d')](0xc8);}})[_0x1a1f('0xb4')](handleError(_0x199ef2,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d8971fc..b2f3eca 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x542bae,_0x530d98){var _0x5e0a23=function(_0x2d1cc3){while(--_0x2d1cc3){_0x542bae['push'](_0x542bae['shift']());}};_0x5e0a23(++_0x530d98);}(_0x1261,0x144));var _0x1126=function(_0x209511,_0x231622){_0x209511=_0x209511-0x0;var _0x39b937=_0x1261[_0x209511];return _0x39b937;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x3e6c33,_0x344279){var _0x528063=function(_0x2cf32c){while(--_0x2cf32c){_0x3e6c33['push'](_0x3e6c33['shift']());}};_0x528063(++_0x344279);}(_0x326f,0xd1));var _0xf326=function(_0x37faa4,_0x365868){_0x37faa4=_0x37faa4-0x0;var _0x4a20fd=_0x326f[_0x37faa4];return _0x4a20fd;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 58f1456..e75acf8 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f64=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f64,0x15b));var _0x41f6=function(_0x2ff8e4,_0x122d8f){_0x2ff8e4=_0x2ff8e4-0x0;var _0x210cbf=_0x1f64[_0x2ff8e4];return _0x210cbf;};'use strict';var _=require(_0x41f6('0x0'));var util=require(_0x41f6('0x1'));var logger=require(_0x41f6('0x2'))('api');var moment=require(_0x41f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x41f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41f6('0x5'));var config=require(_0x41f6('0x6'));var attributes=require(_0x41f6('0x7'));module[_0x41f6('0x8')]=function(_0x23b5ae,_0x431e3d){return _0x23b5ae[_0x41f6('0x9')](_0x41f6('0xa'),attributes,{'tableName':_0x41f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x181845,_0x2d860b,_0x4a9f05){if(_0x181845[_0x41f6('0xc')](_0x41f6('0xd'))){_0x181845[_0x41f6('0xe')]=moment()[_0x41f6('0xf')](_0x41f6('0x10'));}_0x4a9f05(null,_0x181845);}}});}; \ No newline at end of file +var _0x3f84=['FaxInteraction','fax_interactions','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x1cb9f5,_0x560ea0){var _0x476f4a=function(_0x20d23b){while(--_0x20d23b){_0x1cb9f5['push'](_0x1cb9f5['shift']());}};_0x476f4a(++_0x560ea0);}(_0x3f84,0x12a));var _0x43f8=function(_0x56562d,_0x578183){_0x56562d=_0x56562d-0x0;var _0xdafef9=_0x3f84[_0x56562d];return _0xdafef9;};'use strict';var _=require('lodash');var util=require(_0x43f8('0x0'));var logger=require(_0x43f8('0x1'))(_0x43f8('0x2'));var moment=require('moment');var BPromise=require(_0x43f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43f8('0x4'));var rimraf=require(_0x43f8('0x5'));var config=require(_0x43f8('0x6'));var attributes=require(_0x43f8('0x7'));module[_0x43f8('0x8')]=function(_0x141dce,_0x57ea6c){return _0x141dce[_0x43f8('0x9')](_0x43f8('0xa'),attributes,{'tableName':_0x43f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5246f9,_0x5738d8,_0xec402f){if(_0x5246f9['changed']('closed')){_0x5246f9['closedAt']=moment()[_0x43f8('0xc')](_0x43f8('0xd'));}_0xec402f(null,_0x5246f9);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 1a29145..3edb127 100644 --- a/server/api/faxInteraction/faxInteraction.rpc.js +++ b/server/api/faxInteraction/faxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0747=['register','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','info','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','socket.io-emitter','./faxInteraction.socket'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x0747,0x1d3));var _0x7074=function(_0x23cd3b,_0x1a4ce4){_0x23cd3b=_0x23cd3b-0x0;var _0x1c80a1=_0x0747[_0x23cd3b];return _0x1c80a1;};'use strict';var _=require(_0x7074('0x0'));var util=require('util');var moment=require(_0x7074('0x1'));var BPromise=require('bluebird');var rs=require(_0x7074('0x2'));var fs=require('fs');var Redis=require(_0x7074('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7074('0x4'));var logger=require(_0x7074('0x5'))(_0x7074('0x6'));var config=require('../../config/environment');var jayson=require(_0x7074('0x7'));var client=jayson[_0x7074('0x8')][_0x7074('0x9')]({'port':0x232a});config['redis']=_[_0x7074('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7074('0xb'))(new Redis(config['redis']));require(_0x7074('0xc'))[_0x7074('0xd')](socket);function respondWithRpcPromise(_0x1b0b91,_0x7b5645,_0x4c1fd3){return new BPromise(function(_0x4cff33,_0x1994dd){return client['request'](_0x1b0b91,_0x4c1fd3)[_0x7074('0xe')](function(_0x3e14bd){logger['info'](_0x7074('0xf'),_0x7b5645,'request\x20sent');logger[_0x7074('0x10')](_0x7074('0x11'),_0x7b5645,_0x7074('0x12'),JSON[_0x7074('0x13')](_0x3e14bd));if(_0x3e14bd[_0x7074('0x14')]){if(_0x3e14bd['error'][_0x7074('0x15')]===0x1f4){logger[_0x7074('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x7b5645,_0x3e14bd[_0x7074('0x14')][_0x7074('0x16')]);return _0x1994dd(_0x3e14bd['error'][_0x7074('0x16')]);}logger['error'](_0x7074('0xf'),_0x7b5645,_0x3e14bd[_0x7074('0x14')][_0x7074('0x16')]);return _0x4cff33(_0x3e14bd[_0x7074('0x14')]['message']);}else{logger['info'](_0x7074('0xf'),_0x7b5645,'request\x20sent');_0x4cff33(_0x3e14bd['result'][_0x7074('0x16')]);}})[_0x7074('0x17')](function(_0x2b4465){logger['error'](_0x7074('0xf'),_0x7b5645,_0x2b4465);_0x1994dd(_0x2b4465);});});}exports[_0x7074('0x18')]=function(_0x3f7dbb){var _0x3610c3=this;return new Promise(function(_0x2f9959,_0x5ef995){return db[_0x7074('0x19')][_0x7074('0x1a')](_0x3f7dbb[_0x7074('0x1b')],{'raw':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb[_0x7074('0x1c')][_0x7074('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb[_0x7074('0x1c')][_0x7074('0x1e')]||null:null,'attributes':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb['options'][_0x7074('0x1f')]||null:null,'limit':_0x3f7dbb[_0x7074('0x1c')]?_0x3f7dbb[_0x7074('0x1c')][_0x7074('0x20')]||null:null})[_0x7074('0xe')](function(_0x96cd1d){logger[_0x7074('0x21')](_0x7074('0x18'),_0x3f7dbb);logger[_0x7074('0x10')](_0x7074('0x18'),_0x3f7dbb,JSON[_0x7074('0x13')](_0x96cd1d));_0x2f9959(_0x96cd1d);})[_0x7074('0x17')](function(_0x598f6d){logger[_0x7074('0x14')](_0x7074('0x18'),_0x598f6d['message'],_0x3f7dbb);_0x5ef995(_0x3610c3[_0x7074('0x14')](0x1f4,_0x598f6d[_0x7074('0x16')]));});});};exports[_0x7074('0x22')]=function(_0x9a844d){return new Promise(function(_0x3c4df0,_0x2c889c){return db['FaxInteraction'][_0x7074('0x23')]({'where':_0x9a844d[_0x7074('0x1c')]?_0x9a844d[_0x7074('0x1c')][_0x7074('0x1e')]||null:null})['then'](function(_0x3116c7){if(_0x3116c7){return _0x3116c7['addTags'](_0x9a844d['body'][_0x7074('0x24')],_[_0x7074('0x25')](_0x9a844d[_0x7074('0x1b')],[_0x7074('0x24'),'id'])||{});}})[_0x7074('0x26')](function(_0x47aa83){logger[_0x7074('0x21')]('AddTags',_0x9a844d);logger['debug'](_0x7074('0x27'),_0x9a844d,JSON['stringify'](_0x47aa83));_0x3c4df0(_0x47aa83);})[_0x7074('0x17')](function(_0x5e32e3){logger[_0x7074('0x14')](_0x7074('0x27'),_0x5e32e3['message'],_0x9a844d);_0x2c889c(_this[_0x7074('0x14')](0x1f4,_0x5e32e3[_0x7074('0x16')]));});});}; \ No newline at end of file +var _0xba53=['raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxInteraction','update','body','options'];(function(_0x7192c3,_0x29d1aa){var _0x79a6ed=function(_0x3feb55){while(--_0x3feb55){_0x7192c3['push'](_0x7192c3['shift']());}};_0x79a6ed(++_0x29d1aa);}(_0xba53,0x1ce));var _0x3ba5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xba53[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x3ba5('0x0'));var util=require(_0x3ba5('0x1'));var moment=require('moment');var BPromise=require(_0x3ba5('0x2'));var rs=require(_0x3ba5('0x3'));var fs=require('fs');var Redis=require(_0x3ba5('0x4'));var db=require(_0x3ba5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3ba5('0x6'));var config=require(_0x3ba5('0x7'));var jayson=require(_0x3ba5('0x8'));var client=jayson[_0x3ba5('0x9')][_0x3ba5('0xa')]({'port':0x232a});config['redis']=_[_0x3ba5('0xb')](config[_0x3ba5('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ba5('0xc')]));require(_0x3ba5('0xd'))['register'](socket);function respondWithRpcPromise(_0x30ba82,_0x76c8e9,_0x1acd40){return new BPromise(function(_0x9a81fb,_0x246295){return client[_0x3ba5('0xe')](_0x30ba82,_0x1acd40)[_0x3ba5('0xf')](function(_0x49fe63){logger[_0x3ba5('0x10')](_0x3ba5('0x11'),_0x76c8e9,_0x3ba5('0x12'));logger[_0x3ba5('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x76c8e9,_0x3ba5('0x12'),JSON[_0x3ba5('0x14')](_0x49fe63));if(_0x49fe63[_0x3ba5('0x15')]){if(_0x49fe63[_0x3ba5('0x15')][_0x3ba5('0x16')]===0x1f4){logger['error'](_0x3ba5('0x11'),_0x76c8e9,_0x49fe63['error'][_0x3ba5('0x17')]);return _0x246295(_0x49fe63[_0x3ba5('0x15')][_0x3ba5('0x17')]);}logger[_0x3ba5('0x15')](_0x3ba5('0x11'),_0x76c8e9,_0x49fe63[_0x3ba5('0x15')][_0x3ba5('0x17')]);return _0x9a81fb(_0x49fe63['error'][_0x3ba5('0x17')]);}else{logger[_0x3ba5('0x10')](_0x3ba5('0x11'),_0x76c8e9,_0x3ba5('0x12'));_0x9a81fb(_0x49fe63[_0x3ba5('0x18')][_0x3ba5('0x17')]);}})[_0x3ba5('0x19')](function(_0x22e811){logger[_0x3ba5('0x15')](_0x3ba5('0x11'),_0x76c8e9,_0x22e811);_0x246295(_0x22e811);});});}exports['UpdateFaxInteraction']=function(_0x184128){var _0x15b757=this;return new Promise(function(_0x1bfe36,_0x10a592){return db[_0x3ba5('0x1a')][_0x3ba5('0x1b')](_0x184128[_0x3ba5('0x1c')],{'raw':_0x184128[_0x3ba5('0x1d')]?_0x184128[_0x3ba5('0x1d')][_0x3ba5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x184128['options']?_0x184128[_0x3ba5('0x1d')][_0x3ba5('0x1f')]||null:null,'attributes':_0x184128['options']?_0x184128[_0x3ba5('0x1d')][_0x3ba5('0x20')]||null:null,'limit':_0x184128['options']?_0x184128['options'][_0x3ba5('0x21')]||null:null})['then'](function(_0x4dc8ac){logger[_0x3ba5('0x10')](_0x3ba5('0x22'),_0x184128);logger['debug'](_0x3ba5('0x22'),_0x184128,JSON[_0x3ba5('0x14')](_0x4dc8ac));_0x1bfe36(_0x4dc8ac);})[_0x3ba5('0x19')](function(_0x25542e){logger['error'](_0x3ba5('0x22'),_0x25542e[_0x3ba5('0x17')],_0x184128);_0x10a592(_0x15b757[_0x3ba5('0x15')](0x1f4,_0x25542e['message']));});});};exports[_0x3ba5('0x23')]=function(_0x338634){return new Promise(function(_0x29415f,_0x4652cf){return db[_0x3ba5('0x1a')][_0x3ba5('0x24')]({'where':_0x338634[_0x3ba5('0x1d')]?_0x338634[_0x3ba5('0x1d')]['where']||null:null})['then'](function(_0x572f42){if(_0x572f42){return _0x572f42[_0x3ba5('0x25')](_0x338634[_0x3ba5('0x1c')][_0x3ba5('0x26')],_['omit'](_0x338634['body'],[_0x3ba5('0x26'),'id'])||{});}})[_0x3ba5('0x27')](function(_0x4a2ff3){logger['info']('AddTags',_0x338634);logger[_0x3ba5('0x13')](_0x3ba5('0x28'),_0x338634,JSON[_0x3ba5('0x14')](_0x4a2ff3));_0x29415f(_0x4a2ff3);})['catch'](function(_0x1d13f5){logger['error']('AddTags',_0x1d13f5[_0x3ba5('0x17')],_0x338634);_0x4652cf(_this[_0x3ba5('0x15')](0x1f4,_0x1d13f5[_0x3ba5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6877641..f1f5d85 100644 --- a/server/api/faxInteraction/faxInteraction.socket.js +++ b/server/api/faxInteraction/faxInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb573=['length','faxInteraction:','./faxInteraction.events','remove','update'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xb573,0x101));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var FaxInteractionEvents=require(_0x3b57('0x0'));var events=['save',_0x3b57('0x1'),_0x3b57('0x2')];function createListener(_0x5a2b11,_0x2f5613){return function(_0x2b4e86){_0x2f5613['emit'](_0x5a2b11,_0x2b4e86);};}function removeListener(_0x5d4cf8,_0x1ef2be){return function(){FaxInteractionEvents['removeListener'](_0x5d4cf8,_0x1ef2be);};}exports['register']=function(_0x19028e){for(var _0x2d272d=0x0,_0x1cb7f7=events[_0x3b57('0x3')];_0x2d272d<_0x1cb7f7;_0x2d272d++){var _0x119202=events[_0x2d272d];var _0x54b9b7=createListener(_0x3b57('0x4')+_0x119202,_0x19028e);FaxInteractionEvents['on'](_0x119202,_0x54b9b7);}}; \ No newline at end of file +var _0x2161=['removeListener','register','length','./faxInteraction.events','update'];(function(_0x454ea9,_0xad0c26){var _0x8cea23=function(_0x1dafc5){while(--_0x1dafc5){_0x454ea9['push'](_0x454ea9['shift']());}};_0x8cea23(++_0xad0c26);}(_0x2161,0x1f2));var _0x1216=function(_0x4066c2,_0xad48e8){_0x4066c2=_0x4066c2-0x0;var _0x3870a0=_0x2161[_0x4066c2];return _0x3870a0;};'use strict';var FaxInteractionEvents=require(_0x1216('0x0'));var events=['save','remove',_0x1216('0x1')];function createListener(_0x598a44,_0x2eea91){return function(_0x19d712){_0x2eea91['emit'](_0x598a44,_0x19d712);};}function removeListener(_0x3f7834,_0x1bec79){return function(){FaxInteractionEvents[_0x1216('0x2')](_0x3f7834,_0x1bec79);};}exports[_0x1216('0x3')]=function(_0xef9c45){for(var _0xb45838=0x0,_0x5e563b=events[_0x1216('0x4')];_0xb45838<_0x5e563b;_0xb45838++){var _0x54d2d7=events[_0xb45838];var _0xeb8cf1=createListener('faxInteraction:'+_0x54d2d7,_0xef9c45);FaxInteractionEvents['on'](_0x54d2d7,_0xeb8cf1);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index d5825c6..831815b 100644 --- a/server/api/faxInteraction/index.js +++ b/server/api/faxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b33=['getMessages','/:id/download','download','post','create','/:id/messages','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','faxinteraction:destroy','destroy','delete','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2cf620,_0x49f37f){var _0x4370a6=function(_0x21a030){while(--_0x21a030){_0x2cf620['push'](_0x2cf620['shift']());}};_0x4370a6(++_0x49f37f);}(_0x9b33,0x1c2));var _0x39b3=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x9b33[_0x49ca18];return _0x145d54;};'use strict';var multer=require('multer');var util=require(_0x39b3('0x0'));var path=require('path');var timeout=require(_0x39b3('0x1'));var express=require(_0x39b3('0x2'));var router=express[_0x39b3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x39b3('0x4'));var config=require(_0x39b3('0x5'));var controller=require(_0x39b3('0x6'));router[_0x39b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x39b3('0x8')]);router[_0x39b3('0x7')](_0x39b3('0x9'),auth[_0x39b3('0xa')](),controller[_0x39b3('0xb')]);router[_0x39b3('0x7')](_0x39b3('0xc'),auth[_0x39b3('0xa')](),controller[_0x39b3('0xd')]);router[_0x39b3('0x7')]('/:id/messages',auth[_0x39b3('0xa')](),controller[_0x39b3('0xe')]);router['get'](_0x39b3('0xf'),auth[_0x39b3('0xa')](),controller[_0x39b3('0x10')]);router[_0x39b3('0x11')]('/',auth[_0x39b3('0xa')](),controller[_0x39b3('0x12')]);router[_0x39b3('0x11')](_0x39b3('0x13'),auth[_0x39b3('0xa')](),controller['addMessage']);router[_0x39b3('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x39b3('0x14')](_0x39b3('0x15'),_0x39b3('0x16')),controller[_0x39b3('0x17')]);router[_0x39b3('0x18')](_0x39b3('0xc'),auth['isAuthenticated'](),interaction[_0x39b3('0x14')]('fax',_0x39b3('0x19')),controller['update']);router['delete'](_0x39b3('0xc'),auth[_0x39b3('0xa')](),interaction[_0x39b3('0x14')]('fax',_0x39b3('0x1a')),controller[_0x39b3('0x1b')]);router[_0x39b3('0x1c')]('/:id/tags',auth[_0x39b3('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x613e=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x569ddb,_0x599798){var _0x50189a=function(_0x441d58){while(--_0x441d58){_0x569ddb['push'](_0x569ddb['shift']());}};_0x50189a(++_0x599798);}(_0x613e,0x133));var _0xe613=function(_0x589b88,_0x7846d3){_0x589b88=_0x589b88-0x0;var _0x1f656f=_0x613e[_0x589b88];return _0x1f656f;};'use strict';var multer=require(_0xe613('0x0'));var util=require(_0xe613('0x1'));var path=require(_0xe613('0x2'));var timeout=require(_0xe613('0x3'));var express=require(_0xe613('0x4'));var router=express[_0xe613('0x5')]();var fs_extra=require(_0xe613('0x6'));var auth=require(_0xe613('0x7'));var interaction=require(_0xe613('0x8'));var config=require(_0xe613('0x9'));var controller=require(_0xe613('0xa'));router[_0xe613('0xb')]('/',auth[_0xe613('0xc')](),controller[_0xe613('0xd')]);router[_0xe613('0xb')](_0xe613('0xe'),auth[_0xe613('0xc')](),controller[_0xe613('0xf')]);router[_0xe613('0xb')](_0xe613('0x10'),auth['isAuthenticated'](),controller[_0xe613('0x11')]);router['get'](_0xe613('0x12'),auth[_0xe613('0xc')](),controller[_0xe613('0x13')]);router[_0xe613('0xb')](_0xe613('0x14'),auth[_0xe613('0xc')](),controller[_0xe613('0x15')]);router[_0xe613('0x16')]('/',auth[_0xe613('0xc')](),controller[_0xe613('0x17')]);router[_0xe613('0x16')](_0xe613('0x12'),auth[_0xe613('0xc')](),controller['addMessage']);router[_0xe613('0x16')](_0xe613('0x18'),auth[_0xe613('0xc')](),interaction[_0xe613('0x19')](_0xe613('0x1a'),_0xe613('0x1b')),controller[_0xe613('0x1c')]);router[_0xe613('0x1d')](_0xe613('0x10'),auth[_0xe613('0xc')](),interaction[_0xe613('0x19')](_0xe613('0x1a'),_0xe613('0x1e')),controller['update']);router[_0xe613('0x1f')](_0xe613('0x10'),auth['isAuthenticated'](),interaction[_0xe613('0x19')](_0xe613('0x1a'),'faxinteraction:destroy'),controller[_0xe613('0x20')]);router['delete']('/:id/tags',auth[_0xe613('0xc')](),controller[_0xe613('0x21')]);module[_0xe613('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7cfeeaa..8f38a9c 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cea=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3b98a9,_0x2ecb8c){var _0x289b79=function(_0x36d967){while(--_0x36d967){_0x3b98a9['push'](_0x3b98a9['shift']());}};_0x289b79(++_0x2ecb8c);}(_0x5cea,0x13c));var _0xa5ce=function(_0x8784aa,_0x8dd51b){_0x8784aa=_0x8784aa-0x0;var _0x14e1ba=_0x5cea[_0x8784aa];return _0x14e1ba;};'use strict';var Sequelize=require('sequelize');module[_0xa5ce('0x0')]={'body':{'type':Sequelize[_0xa5ce('0x1')](_0xa5ce('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa5ce('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5ce('0x4')]('in','out'),'defaultValue':_0xa5ce('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa5ce('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa5ce('0x6')]}}; \ No newline at end of file +var _0xcc8a=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xd8eadb,_0x2f9783){var _0x4b9be2=function(_0x14c345){while(--_0x14c345){_0xd8eadb['push'](_0xd8eadb['shift']());}};_0x4b9be2(++_0x2f9783);}(_0xcc8a,0x149));var _0xacc8=function(_0x28a160,_0x2664b2){_0x28a160=_0x28a160-0x0;var _0x5c8dbc=_0xcc8a[_0x28a160];return _0x5c8dbc;};'use strict';var Sequelize=require(_0xacc8('0x0'));module[_0xacc8('0x1')]={'body':{'type':Sequelize[_0xacc8('0x2')](_0xacc8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xacc8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xacc8('0x5')]('in',_0xacc8('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 9876990..4688b79 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb45=['bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','offset','limit','undefined','count','status','json','apply','update','destroy','stack','name','send','render','merge','body','contact','agent','account','map','FaxMessage','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','SendFax','FaxAccountId','basename','download','server','files','attachments','zip-dir','fast-json-patch','moment'];(function(_0x1764dc,_0x2a6a26){var _0x232256=function(_0x452ffa){while(--_0x452ffa){_0x1764dc['push'](_0x1764dc['shift']());}};_0x232256(++_0x2a6a26);}(_0xdb45,0x10f));var _0x5db4=function(_0x9a752,_0x21804b){_0x9a752=_0x9a752-0x0;var _0x433b74=_0xdb45[_0x9a752];return _0x433b74;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5db4('0x0'));var jsonpatch=require(_0x5db4('0x1'));var rp=require('request-promise');var moment=require(_0x5db4('0x2'));var BPromise=require(_0x5db4('0x3'));var Mustache=require(_0x5db4('0x4'));var util=require(_0x5db4('0x5'));var path=require(_0x5db4('0x6'));var sox=require(_0x5db4('0x7'));var csv=require(_0x5db4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5db4('0x9'));var _=require(_0x5db4('0xa'));var squel=require('squel');var crypto=require(_0x5db4('0xb'));var jsforce=require(_0x5db4('0xc'));var deskjs=require(_0x5db4('0xd'));var toCsv=require(_0x5db4('0x8'));var querystring=require(_0x5db4('0xe'));var Papa=require('papaparse');var Redis=require(_0x5db4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5db4('0x10'));var as=require(_0x5db4('0x11'));var hardwareService=require(_0x5db4('0x12'));var logger=require('../../config/logger')(_0x5db4('0x13'));var utils=require(_0x5db4('0x14'));var config=require(_0x5db4('0x15'));var licenseUtil=require(_0x5db4('0x16'));var db=require('../../mysqldb')['db'];config[_0x5db4('0x17')]=_[_0x5db4('0x18')](config[_0x5db4('0x17')],{'host':_0x5db4('0x19'),'port':0x18eb});var socket=require(_0x5db4('0x1a'))(new Redis(config['redis']));require(_0x5db4('0x1b'))[_0x5db4('0x1c')](socket);var jayson=require(_0x5db4('0x1d'));var client=jayson['client'][_0x5db4('0x1e')]({'port':0x232c});var client9002=jayson[_0x5db4('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21c2e7,_0x2c6167,_0xf169ba,_0x10de51){return new BPromise(function(_0x5c33ff,_0x3e843d){var _0x458798=_0x10de51||client;return _0x458798[_0x5db4('0x20')](_0x21c2e7,_0xf169ba)[_0x5db4('0x21')](function(_0x2f1d25){logger[_0x5db4('0x22')](_0x5db4('0x23'),_0x2c6167,_0x5db4('0x24'));logger[_0x5db4('0x25')](_0x5db4('0x26'),_0x2c6167,_0x5db4('0x24'),JSON[_0x5db4('0x27')](_0x2f1d25));if(_0x2f1d25['error']){if(_0x2f1d25[_0x5db4('0x28')][_0x5db4('0x29')]===0x1f4){logger['error'](_0x5db4('0x23'),_0x2c6167,_0x2f1d25[_0x5db4('0x28')]['message']);return _0x3e843d(_0x2f1d25['error'][_0x5db4('0x2a')]);}logger[_0x5db4('0x28')](_0x5db4('0x23'),_0x2c6167,_0x2f1d25[_0x5db4('0x28')][_0x5db4('0x2a')]);return _0x5c33ff(_0x2f1d25[_0x5db4('0x28')]['message']);}else{logger[_0x5db4('0x22')]('FaxMessage,\x20%s,\x20%s',_0x2c6167,_0x5db4('0x24'));_0x5c33ff(_0x2f1d25[_0x5db4('0x2b')][_0x5db4('0x2a')]);}})[_0x5db4('0x2c')](function(_0x353992){logger[_0x5db4('0x28')](_0x5db4('0x23'),_0x2c6167,_0x353992);_0x3e843d(_0x353992);});});}function respondWithStatusCode(_0xd9d9f6,_0x1ea535){_0x1ea535=_0x1ea535||0xcc;return function(_0x3bee9a){if(_0x3bee9a){return _0xd9d9f6[_0x5db4('0x2d')](_0x1ea535);}return _0xd9d9f6['status'](_0x1ea535)['end']();};}function respondWithResult(_0x29b5b7,_0x3fa5d5){_0x3fa5d5=_0x3fa5d5||0xc8;return function(_0x562838){if(_0x562838){return _0x29b5b7['status'](_0x3fa5d5)['json'](_0x562838);}};}function respondWithFilteredResult(_0x8a2598,_0x1fbe30){return function(_0x45e46f){if(_0x45e46f){var _0xbdec59=typeof _0x1fbe30[_0x5db4('0x2e')]==='undefined'&&typeof _0x1fbe30[_0x5db4('0x2f')]===_0x5db4('0x30');var _0x27d35a=_0x45e46f['count'];var _0x29d845=_0xbdec59?0x0:_0x1fbe30[_0x5db4('0x2e')];var _0x4be531=_0xbdec59?_0x45e46f[_0x5db4('0x31')]:_0x1fbe30['offset']+_0x1fbe30[_0x5db4('0x2f')];var _0x4d9b90;if(_0x4be531>=_0x27d35a){_0x4be531=_0x27d35a;_0x4d9b90=0xc8;}else{_0x4d9b90=0xce;}_0x8a2598[_0x5db4('0x32')](_0x4d9b90);return _0x8a2598['set']('Content-Range',_0x29d845+'-'+_0x4be531+'/'+_0x27d35a)[_0x5db4('0x33')](_0x45e46f);}return null;};}function patchUpdates(_0x53a134){return function(_0xf2dfb1){try{jsonpatch[_0x5db4('0x34')](_0xf2dfb1,_0x53a134,!![]);}catch(_0x44cbcb){return BPromise['reject'](_0x44cbcb);}return _0xf2dfb1['save']();};}function saveUpdates(_0x646ae6,_0x3aeec5){return function(_0x4b138d){if(_0x4b138d){return _0x4b138d[_0x5db4('0x35')](_0x646ae6)[_0x5db4('0x21')](function(_0x4c7809){return _0x4c7809;});}return null;};}function removeEntity(_0x1f3a7d,_0x28b060){return function(_0x982707){if(_0x982707){return _0x982707[_0x5db4('0x36')]()[_0x5db4('0x21')](function(){_0x1f3a7d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cff45,_0x53cfe2){return function(_0x588e68){if(!_0x588e68){_0x3cff45[_0x5db4('0x2d')](0x194);}return _0x588e68;};}function handleError(_0x5c4214,_0x14154d){_0x14154d=_0x14154d||0x1f4;return function(_0x1ab426){logger[_0x5db4('0x28')](_0x1ab426[_0x5db4('0x37')]);if(_0x1ab426[_0x5db4('0x38')]){delete _0x1ab426['name'];}_0x5c4214[_0x5db4('0x32')](_0x14154d)[_0x5db4('0x39')](_0x1ab426);};}function getMustacheRender(_0x314cd2,_0x2410aa){return Mustache[_0x5db4('0x3a')](_0x314cd2,_[_0x5db4('0x3b')](_0x2410aa[_0x5db4('0x3c')],{'contact':_0x2410aa[_0x5db4('0x3d')],'message':_0x2410aa['message'],'agent':_0x2410aa[_0x5db4('0x3e')],'interaction':_0x2410aa['interaction'],'account':_0x2410aa[_0x5db4('0x3f')]}))||'';}exports['index']=function(_0x4a5dba,_0x1d178b){var _0x5755b4={},_0x3f3606={},_0x18f62e={'count':0x0,'rows':[]};var _0x466ac1=_[_0x5db4('0x40')](db[_0x5db4('0x41')]['rawAttributes'],function(_0x4f64e9){return{'name':_0x4f64e9[_0x5db4('0x42')],'type':_0x4f64e9[_0x5db4('0x43')][_0x5db4('0x44')]};});_0x3f3606[_0x5db4('0x45')]=_['map'](_0x466ac1,_0x5db4('0x38'));_0x3f3606[_0x5db4('0x46')]=_['keys'](_0x4a5dba['query']);_0x3f3606['filters']=_['intersection'](_0x3f3606[_0x5db4('0x45')],_0x3f3606[_0x5db4('0x46')]);_0x5755b4[_0x5db4('0x47')]=_[_0x5db4('0x48')](_0x3f3606['model'],qs[_0x5db4('0x49')](_0x4a5dba['query'][_0x5db4('0x49')]));_0x5755b4[_0x5db4('0x47')]=_0x5755b4[_0x5db4('0x47')][_0x5db4('0x4a')]?_0x5755b4['attributes']:_0x3f3606[_0x5db4('0x45')];if(!_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x4b')]('nolimit')){_0x5755b4['limit']=qs[_0x5db4('0x2f')](_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x2f')]);_0x5755b4[_0x5db4('0x2e')]=qs[_0x5db4('0x2e')](_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x2e')]);}_0x5755b4[_0x5db4('0x4c')]=qs[_0x5db4('0x4d')](_0x4a5dba['query'][_0x5db4('0x4d')]);_0x5755b4['where']=qs[_0x5db4('0x4e')](_['pick'](_0x4a5dba[_0x5db4('0x46')],_0x3f3606['filters']),_0x466ac1);if(_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x4f')]){_0x5755b4['where']=_['merge'](_0x5755b4[_0x5db4('0x50')],{'$or':_[_0x5db4('0x40')](_0x466ac1,function(_0x518018){if(_0x518018[_0x5db4('0x43')]!==_0x5db4('0x51')){var _0x26443f={};_0x26443f[_0x518018['name']]={'$like':'%'+_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x4f')]+'%'};return _0x26443f;}})});}_0x5755b4=_[_0x5db4('0x3b')]({},_0x5755b4,_0x4a5dba[_0x5db4('0x52')]);var _0xa15420={'where':_0x5755b4[_0x5db4('0x50')]};return db[_0x5db4('0x41')][_0x5db4('0x31')](_0xa15420)['then'](function(_0x4a2082){_0x18f62e['count']=_0x4a2082;if(_0x4a5dba[_0x5db4('0x46')][_0x5db4('0x53')]){_0x5755b4[_0x5db4('0x54')]=[{'all':!![]}];}return db[_0x5db4('0x41')][_0x5db4('0x55')](_0x5755b4);})[_0x5db4('0x21')](function(_0x316389){_0x18f62e[_0x5db4('0x56')]=_0x316389;return _0x18f62e;})[_0x5db4('0x21')](respondWithFilteredResult(_0x1d178b,_0x5755b4))['catch'](handleError(_0x1d178b,null));};exports[_0x5db4('0x57')]=function(_0x3f38a1,_0x129a90){var _0x320e75={'raw':!![],'where':{'id':_0x3f38a1[_0x5db4('0x58')]['id']}},_0x3941c8={};_0x3941c8[_0x5db4('0x45')]=_[_0x5db4('0x59')](db[_0x5db4('0x41')][_0x5db4('0x5a')]);_0x3941c8[_0x5db4('0x46')]=_[_0x5db4('0x59')](_0x3f38a1[_0x5db4('0x46')]);_0x3941c8[_0x5db4('0x4e')]=_['intersection'](_0x3941c8[_0x5db4('0x45')],_0x3941c8[_0x5db4('0x46')]);_0x320e75[_0x5db4('0x47')]=_[_0x5db4('0x48')](_0x3941c8['model'],qs[_0x5db4('0x49')](_0x3f38a1[_0x5db4('0x46')]['fields']));_0x320e75[_0x5db4('0x47')]=_0x320e75[_0x5db4('0x47')][_0x5db4('0x4a')]?_0x320e75[_0x5db4('0x47')]:_0x3941c8[_0x5db4('0x45')];if(_0x3f38a1[_0x5db4('0x46')][_0x5db4('0x53')]){_0x320e75[_0x5db4('0x54')]=[{'all':!![]}];}_0x320e75=_[_0x5db4('0x3b')]({},_0x320e75,_0x3f38a1['options']);return db[_0x5db4('0x41')][_0x5db4('0x5b')](_0x320e75)[_0x5db4('0x21')](handleEntityNotFound(_0x129a90,null))[_0x5db4('0x21')](respondWithResult(_0x129a90,null))[_0x5db4('0x2c')](handleError(_0x129a90,null));};exports[_0x5db4('0x35')]=function(_0x5efe2c,_0x1c586e){if(_0x5efe2c['body']['id']){delete _0x5efe2c[_0x5db4('0x3c')]['id'];}return db[_0x5db4('0x41')]['find']({'where':{'id':_0x5efe2c[_0x5db4('0x58')]['id']}})[_0x5db4('0x21')](handleEntityNotFound(_0x1c586e,null))[_0x5db4('0x21')](saveUpdates(_0x5efe2c[_0x5db4('0x3c')],null))[_0x5db4('0x21')](respondWithResult(_0x1c586e,null))['catch'](handleError(_0x1c586e,null));};exports[_0x5db4('0x36')]=function(_0x5f4889,_0x3d45de){return db[_0x5db4('0x41')][_0x5db4('0x5b')]({'where':{'id':_0x5f4889[_0x5db4('0x58')]['id']}})[_0x5db4('0x21')](handleEntityNotFound(_0x3d45de,null))[_0x5db4('0x21')](removeEntity(_0x3d45de,null))[_0x5db4('0x2c')](handleError(_0x3d45de,null));};exports[_0x5db4('0x5c')]=function(_0x4a84d0,_0x3caac7){return db[_0x5db4('0x41')][_0x5db4('0x5c')]()[_0x5db4('0x21')](respondWithResult(_0x3caac7,null))[_0x5db4('0x2c')](handleError(_0x3caac7,null));};var interaction_log=require(_0x5db4('0x5d'))(_0x5db4('0x5e'));exports[_0x5db4('0x5f')]=function(_0x2103cf,_0x245238,_0x1b917b){var _0x552812={'agent':{},'channel':_0x5db4('0x60')};if(_0x2103cf['body']['id']){delete _0x2103cf[_0x5db4('0x3c')]['id'];}_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x61')]=!![];_0x2103cf['body']['readAt']=moment()[_0x5db4('0x62')](_0x5db4('0x63'));_0x2103cf['body'][_0x5db4('0x64')]=_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x64')]||_0x2103cf[_0x5db4('0x65')]['id'];_0x552812['agent']['id']=_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x64')];return db['FaxMessage'][_0x5db4('0x5b')]({'where':{'id':_0x2103cf['params']['id'],'UserId':null},'include':[{'model':db[_0x5db4('0x66')],'as':'Contact'}]})[_0x5db4('0x21')](handleEntityNotFound(_0x245238,null))[_0x5db4('0x21')](saveUpdates(_0x2103cf['body'],null))['then'](function(_0x5a0d59){if(_0x5a0d59){_0x552812['message']=_0x5a0d59[_0x5db4('0x67')]({'plain':!![]});return db[_0x5db4('0x68')][_0x5db4('0x5b')]({'where':{'id':_0x5a0d59[_0x5db4('0x69')]}});}return null;})[_0x5db4('0x21')](handleEntityNotFound(_0x245238,null))[_0x5db4('0x21')](function(_0x4544a5){if(_0x4544a5){return _0x4544a5[_0x5db4('0x35')]({'UserId':_0x2103cf['body']['UserId'],'read1stAt':_[_0x5db4('0x6a')](_0x4544a5[_0x5db4('0x6b')])?moment()[_0x5db4('0x62')](_0x5db4('0x63')):undefined});}return null;})[_0x5db4('0x21')](function(_0x1018b0){if(_0x1018b0){_0x552812[_0x5db4('0x6c')]=_0x1018b0[_0x5db4('0x67')]({'plain':!![]});interaction_log[_0x5db4('0x22')](_0x5db4('0x6d'),_0x2103cf[_0x5db4('0x65')]['id'],_0x2103cf[_0x5db4('0x65')][_0x5db4('0x38')],_0x2103cf[_0x5db4('0x65')]['role'],_0x552812['interaction']['id'],_0x2103cf[_0x5db4('0x3c')]?JSON[_0x5db4('0x27')](_0x2103cf[_0x5db4('0x3c')]):'null');return respondWithRpcPromise(_0x5db4('0x6e'),_0x5db4('0x6f'),_0x552812);}return null;})[_0x5db4('0x21')](function(_0x98cad2){if(_0x98cad2){if(_0x2103cf[_0x5db4('0x3c')][_0x5db4('0x70')]){_0x552812[_0x5db4('0x2a')][_0x5db4('0x71')]=util[_0x5db4('0x62')](_0x5db4('0x72'),_0x2103cf[_0x5db4('0x65')][_0x5db4('0x38')]);_0x552812[_0x5db4('0x2a')][_0x5db4('0x73')]=_0x552812[_0x5db4('0x73')];_0x552812[_0x5db4('0x2a')][_0x5db4('0x74')]=_0x5db4('0x5f');return respondWithRpcPromise(_0x5db4('0x75'),_0x5db4('0x75'),{'event':_0x5db4('0x76'),'message':_0x552812[_0x5db4('0x2a')]},client9002)[_0x5db4('0x21')](function(){return _0x552812;});}return _0x552812;}return null;})['then'](respondWithResult(_0x245238,null))[_0x5db4('0x2c')](handleError(_0x245238,null));};var interaction_log=require(_0x5db4('0x5d'))(_0x5db4('0x5e'));exports[_0x5db4('0x77')]=function(_0x42f3b3,_0x1e7870,_0x2b5831){var _0x21d76b={'agent':{},'channel':'fax'};if(_0x42f3b3['body']['id']){delete _0x42f3b3[_0x5db4('0x3c')]['id'];}_0x42f3b3[_0x5db4('0x3c')][_0x5db4('0x64')]=_0x42f3b3[_0x5db4('0x3c')][_0x5db4('0x64')]||_0x42f3b3[_0x5db4('0x65')]['id'];_0x21d76b['agent']['id']=_0x42f3b3[_0x5db4('0x3c')][_0x5db4('0x64')];return db[_0x5db4('0x41')][_0x5db4('0x5b')]({'where':{'id':_0x42f3b3[_0x5db4('0x58')]['id'],'UserId':null}})[_0x5db4('0x21')](handleEntityNotFound(_0x1e7870,null))[_0x5db4('0x21')](function(_0x515980){if(_0x515980){_0x21d76b[_0x5db4('0x2a')]=_0x515980['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x515980['FaxInteractionId']}});}return null;})[_0x5db4('0x21')](handleEntityNotFound(_0x1e7870,null))[_0x5db4('0x21')](function(_0x174066){if(_0x174066){_0x21d76b[_0x5db4('0x6c')]=_0x174066['get']({'plain':!![]});interaction_log[_0x5db4('0x22')](_0x5db4('0x78'),_0x42f3b3[_0x5db4('0x65')]['id'],_0x42f3b3['user'][_0x5db4('0x38')],_0x42f3b3[_0x5db4('0x65')][_0x5db4('0x79')],_0x21d76b[_0x5db4('0x6c')]['id'],_0x42f3b3[_0x5db4('0x3c')]?JSON['stringify'](_0x42f3b3[_0x5db4('0x3c')]):_0x5db4('0x7a'));return respondWithRpcPromise(_0x5db4('0x7b'),_0x5db4('0x7c'),_0x21d76b);}return null;})[_0x5db4('0x21')](function(_0x196f11){if(_0x196f11){_0x196f11[_0x5db4('0x2a')]['interface']=util[_0x5db4('0x62')](_0x5db4('0x72'),_0x42f3b3[_0x5db4('0x65')][_0x5db4('0x38')]);_0x196f11[_0x5db4('0x2a')][_0x5db4('0x73')]=_0x21d76b['channel'];_0x196f11[_0x5db4('0x2a')]['event']='reject';respondWithRpcPromise('EventManager',_0x5db4('0x75'),{'event':_0x5db4('0x7d'),'message':_0x196f11['message']},client9002);return _0x21d76b;}return null;})['then'](respondWithResult(_0x1e7870,null))[_0x5db4('0x2c')](handleError(_0x1e7870,null));};exports[_0x5db4('0x7e')]=function(_0xe0e2d,_0x5ebdb3){var _0x5b0740;return db[_0x5db4('0x41')]['create'](_0xe0e2d[_0x5db4('0x3c')],{})[_0x5db4('0x21')](function(_0x56155f){_0x5b0740=_0x56155f;return db['CmContact'][_0x5db4('0x7f')]({'where':{'id':_0x5b0740[_0x5db4('0x80')]}});})[_0x5db4('0x21')](function(_0xf2b257){if(_[_0x5db4('0x6a')](_0xf2b257)){return;}else{_0x5b0740[_0x5db4('0x60')]=_0xf2b257['fax'];return db[_0x5db4('0x81')][_0x5db4('0x7f')]({'where':{'id':_0x5b0740['AttachmentId']}});}})['then'](function(_0x18b208){return respondWithRpcPromise(_0x5db4('0x82'),_0x5db4('0x82'),{'FaxAccountId':_[_0x5db4('0x6a')](_0xe0e2d['body'])?undefined:_0xe0e2d[_0x5db4('0x3c')][_0x5db4('0x83')],'path':_[_0x5db4('0x6a')](_0x18b208)?undefined:util[_0x5db4('0x62')]('/var/opt/motion2/server/files/attachments/%s',_0x18b208[_0x5db4('0x84')]),'fax':_['isNil'](_0x5b0740['fax'])?undefined:_0x5b0740[_0x5db4('0x60')],'AttachmentId':_0x5b0740['AttachmentId']},client9002);})[_0x5db4('0x21')](respondWithResult(_0x5ebdb3,0xc9))[_0x5db4('0x2c')](handleError(_0x5ebdb3,null));};exports[_0x5db4('0x85')]=function(_0x545ff4,_0x5288e5){var _0x434a82=path['join'](config['root'],_0x5db4('0x86'),_0x5db4('0x87'),_0x5db4('0x88'));return db['FaxMessage'][_0x5db4('0x5b')]({'where':{'id':_0x545ff4['params']['id']},'include':[{'model':db[_0x5db4('0x81')],'as':'Attachment'}]})[_0x5db4('0x21')](handleEntityNotFound(_0x5288e5,null))[_0x5db4('0x21')](function(_0x139e8e){if(_0x139e8e){return _0x5288e5[_0x5db4('0x85')](path['join'](_0x434a82,_0x139e8e[_0x5db4('0x81')][_0x5db4('0x84')]));}})['catch'](handleError(_0x5288e5,null));}; \ No newline at end of file +var _0x9f06=['hasOwnProperty','nolimit','order','sort','where','filter','options','FaxMessage','count','include','findAll','rows','show','params','intersection','includeAll','find','catch','../../config/logger','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','FaxInteractionId','isNil','read1stAt','get','user','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','interface','create','CmContact','findOne','ContactId','Attachment','AttachmentId','FaxAccountId','basename','download','join','server','files','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','destroy','stack','name','render','merge','body','contact','agent','interaction','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length'];(function(_0x2f5d1f,_0x242bca){var _0x1f21f4=function(_0x2f329f){while(--_0x2f329f){_0x2f5d1f['push'](_0x2f5d1f['shift']());}};_0x1f21f4(++_0x242bca);}(_0x9f06,0x13a));var _0x69f0=function(_0x2e3600,_0x556215){_0x2e3600=_0x2e3600-0x0;var _0x2e46bd=_0x9f06[_0x2e3600];return _0x2e46bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x69f0('0x0'));var jsonpatch=require(_0x69f0('0x1'));var rp=require(_0x69f0('0x2'));var moment=require(_0x69f0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x69f0('0x4'));var path=require(_0x69f0('0x5'));var sox=require(_0x69f0('0x6'));var csv=require(_0x69f0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x69f0('0x8'));var _=require('lodash');var squel=require(_0x69f0('0x9'));var crypto=require(_0x69f0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x69f0('0xb'));var toCsv=require(_0x69f0('0x7'));var querystring=require(_0x69f0('0xc'));var Papa=require(_0x69f0('0xd'));var Redis=require(_0x69f0('0xe'));var authService=require(_0x69f0('0xf'));var qs=require(_0x69f0('0x10'));var as=require(_0x69f0('0x11'));var hardwareService=require(_0x69f0('0x12'));var logger=require('../../config/logger')(_0x69f0('0x13'));var utils=require(_0x69f0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x69f0('0x15'));var db=require(_0x69f0('0x16'))['db'];config[_0x69f0('0x17')]=_['defaults'](config[_0x69f0('0x17')],{'host':_0x69f0('0x18'),'port':0x18eb});var socket=require(_0x69f0('0x19'))(new Redis(config[_0x69f0('0x17')]));require('./faxMessage.socket')[_0x69f0('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x69f0('0x1b')][_0x69f0('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x69f0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x582747,_0x52383d,_0x553d3b,_0x546323){return new BPromise(function(_0x11dc8e,_0x5e71c8){var _0x38d0e4=_0x546323||client;return _0x38d0e4[_0x69f0('0x1d')](_0x582747,_0x553d3b)[_0x69f0('0x1e')](function(_0x301386){logger[_0x69f0('0x1f')](_0x69f0('0x20'),_0x52383d,_0x69f0('0x21'));logger[_0x69f0('0x22')](_0x69f0('0x23'),_0x52383d,_0x69f0('0x21'),JSON[_0x69f0('0x24')](_0x301386));if(_0x301386[_0x69f0('0x25')]){if(_0x301386['error']['code']===0x1f4){logger[_0x69f0('0x25')](_0x69f0('0x20'),_0x52383d,_0x301386[_0x69f0('0x25')][_0x69f0('0x26')]);return _0x5e71c8(_0x301386[_0x69f0('0x25')]['message']);}logger[_0x69f0('0x25')]('FaxMessage,\x20%s,\x20%s',_0x52383d,_0x301386['error']['message']);return _0x11dc8e(_0x301386['error'][_0x69f0('0x26')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x52383d,_0x69f0('0x21'));_0x11dc8e(_0x301386[_0x69f0('0x27')][_0x69f0('0x26')]);}})['catch'](function(_0x178a31){logger[_0x69f0('0x25')](_0x69f0('0x20'),_0x52383d,_0x178a31);_0x5e71c8(_0x178a31);});});}function respondWithStatusCode(_0x14139b,_0x5190a2){_0x5190a2=_0x5190a2||0xcc;return function(_0x23e641){if(_0x23e641){return _0x14139b[_0x69f0('0x28')](_0x5190a2);}return _0x14139b[_0x69f0('0x29')](_0x5190a2)[_0x69f0('0x2a')]();};}function respondWithResult(_0x565fd2,_0x29b5ea){_0x29b5ea=_0x29b5ea||0xc8;return function(_0x2338ec){if(_0x2338ec){return _0x565fd2[_0x69f0('0x29')](_0x29b5ea)[_0x69f0('0x2b')](_0x2338ec);}};}function respondWithFilteredResult(_0x113d9b,_0x26d5ac){return function(_0xb6b69e){if(_0xb6b69e){var _0x233025=typeof _0x26d5ac[_0x69f0('0x2c')]==='undefined'&&typeof _0x26d5ac['limit']===_0x69f0('0x2d');var _0x2bdbe4=_0xb6b69e['count'];var _0x1d9bd3=_0x233025?0x0:_0x26d5ac[_0x69f0('0x2c')];var _0x3a3e5d=_0x233025?_0xb6b69e['count']:_0x26d5ac[_0x69f0('0x2c')]+_0x26d5ac[_0x69f0('0x2e')];var _0x1c7af3;if(_0x3a3e5d>=_0x2bdbe4){_0x3a3e5d=_0x2bdbe4;_0x1c7af3=0xc8;}else{_0x1c7af3=0xce;}_0x113d9b['status'](_0x1c7af3);return _0x113d9b[_0x69f0('0x2f')](_0x69f0('0x30'),_0x1d9bd3+'-'+_0x3a3e5d+'/'+_0x2bdbe4)[_0x69f0('0x2b')](_0xb6b69e);}return null;};}function patchUpdates(_0x494a03){return function(_0x2787cf){try{jsonpatch['apply'](_0x2787cf,_0x494a03,!![]);}catch(_0x15b4bb){return BPromise['reject'](_0x15b4bb);}return _0x2787cf[_0x69f0('0x31')]();};}function saveUpdates(_0x223e4f,_0x309db1){return function(_0x48f4e9){if(_0x48f4e9){return _0x48f4e9['update'](_0x223e4f)[_0x69f0('0x1e')](function(_0x31d69e){return _0x31d69e;});}return null;};}function removeEntity(_0xd7a361,_0x5759bc){return function(_0x356f23){if(_0x356f23){return _0x356f23[_0x69f0('0x32')]()[_0x69f0('0x1e')](function(){_0xd7a361[_0x69f0('0x29')](0xcc)[_0x69f0('0x2a')]();});}};}function handleEntityNotFound(_0x4f2521,_0x55aa38){return function(_0x5ee19b){if(!_0x5ee19b){_0x4f2521[_0x69f0('0x28')](0x194);}return _0x5ee19b;};}function handleError(_0x42beb0,_0x193eef){_0x193eef=_0x193eef||0x1f4;return function(_0x2d1518){logger[_0x69f0('0x25')](_0x2d1518[_0x69f0('0x33')]);if(_0x2d1518[_0x69f0('0x34')]){delete _0x2d1518[_0x69f0('0x34')];}_0x42beb0[_0x69f0('0x29')](_0x193eef)['send'](_0x2d1518);};}function getMustacheRender(_0x9a4b9e,_0xee48f4){return Mustache[_0x69f0('0x35')](_0x9a4b9e,_[_0x69f0('0x36')](_0xee48f4[_0x69f0('0x37')],{'contact':_0xee48f4[_0x69f0('0x38')],'message':_0xee48f4['message'],'agent':_0xee48f4[_0x69f0('0x39')],'interaction':_0xee48f4[_0x69f0('0x3a')],'account':_0xee48f4['account']}))||'';}exports['index']=function(_0x3eff8e,_0x2702a3){var _0x55f2d7={},_0x456a8d={},_0x6be8da={'count':0x0,'rows':[]};var _0x30b559=_[_0x69f0('0x3b')](db['FaxMessage'][_0x69f0('0x3c')],function(_0x27da5c){return{'name':_0x27da5c[_0x69f0('0x3d')],'type':_0x27da5c[_0x69f0('0x3e')]['key']};});_0x456a8d[_0x69f0('0x3f')]=_[_0x69f0('0x3b')](_0x30b559,_0x69f0('0x34'));_0x456a8d[_0x69f0('0x40')]=_[_0x69f0('0x41')](_0x3eff8e['query']);_0x456a8d[_0x69f0('0x42')]=_['intersection'](_0x456a8d[_0x69f0('0x3f')],_0x456a8d['query']);_0x55f2d7[_0x69f0('0x43')]=_['intersection'](_0x456a8d[_0x69f0('0x3f')],qs[_0x69f0('0x44')](_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x44')]));_0x55f2d7[_0x69f0('0x43')]=_0x55f2d7['attributes'][_0x69f0('0x45')]?_0x55f2d7['attributes']:_0x456a8d[_0x69f0('0x3f')];if(!_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x46')](_0x69f0('0x47'))){_0x55f2d7[_0x69f0('0x2e')]=qs[_0x69f0('0x2e')](_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x2e')]);_0x55f2d7['offset']=qs['offset'](_0x3eff8e[_0x69f0('0x40')]['offset']);}_0x55f2d7[_0x69f0('0x48')]=qs['sort'](_0x3eff8e[_0x69f0('0x40')][_0x69f0('0x49')]);_0x55f2d7[_0x69f0('0x4a')]=qs[_0x69f0('0x42')](_['pick'](_0x3eff8e[_0x69f0('0x40')],_0x456a8d[_0x69f0('0x42')]),_0x30b559);if(_0x3eff8e['query'][_0x69f0('0x4b')]){_0x55f2d7[_0x69f0('0x4a')]=_[_0x69f0('0x36')](_0x55f2d7[_0x69f0('0x4a')],{'$or':_['map'](_0x30b559,function(_0x3208ec){if(_0x3208ec['type']!=='VIRTUAL'){var _0x48885c={};_0x48885c[_0x3208ec[_0x69f0('0x34')]]={'$like':'%'+_0x3eff8e[_0x69f0('0x40')]['filter']+'%'};return _0x48885c;}})});}_0x55f2d7=_[_0x69f0('0x36')]({},_0x55f2d7,_0x3eff8e[_0x69f0('0x4c')]);var _0x45defc={'where':_0x55f2d7[_0x69f0('0x4a')]};return db[_0x69f0('0x4d')][_0x69f0('0x4e')](_0x45defc)[_0x69f0('0x1e')](function(_0x1c8bd2){_0x6be8da['count']=_0x1c8bd2;if(_0x3eff8e[_0x69f0('0x40')]['includeAll']){_0x55f2d7[_0x69f0('0x4f')]=[{'all':!![]}];}return db[_0x69f0('0x4d')][_0x69f0('0x50')](_0x55f2d7);})[_0x69f0('0x1e')](function(_0x24875c){_0x6be8da[_0x69f0('0x51')]=_0x24875c;return _0x6be8da;})['then'](respondWithFilteredResult(_0x2702a3,_0x55f2d7))['catch'](handleError(_0x2702a3,null));};exports[_0x69f0('0x52')]=function(_0x11d642,_0x17d7bd){var _0x58e472={'raw':!![],'where':{'id':_0x11d642[_0x69f0('0x53')]['id']}},_0x2cfd5d={};_0x2cfd5d[_0x69f0('0x3f')]=_[_0x69f0('0x41')](db[_0x69f0('0x4d')]['rawAttributes']);_0x2cfd5d[_0x69f0('0x40')]=_[_0x69f0('0x41')](_0x11d642['query']);_0x2cfd5d[_0x69f0('0x42')]=_[_0x69f0('0x54')](_0x2cfd5d[_0x69f0('0x3f')],_0x2cfd5d['query']);_0x58e472[_0x69f0('0x43')]=_['intersection'](_0x2cfd5d[_0x69f0('0x3f')],qs['fields'](_0x11d642[_0x69f0('0x40')][_0x69f0('0x44')]));_0x58e472[_0x69f0('0x43')]=_0x58e472['attributes'][_0x69f0('0x45')]?_0x58e472[_0x69f0('0x43')]:_0x2cfd5d[_0x69f0('0x3f')];if(_0x11d642['query'][_0x69f0('0x55')]){_0x58e472[_0x69f0('0x4f')]=[{'all':!![]}];}_0x58e472=_[_0x69f0('0x36')]({},_0x58e472,_0x11d642[_0x69f0('0x4c')]);return db[_0x69f0('0x4d')][_0x69f0('0x56')](_0x58e472)['then'](handleEntityNotFound(_0x17d7bd,null))[_0x69f0('0x1e')](respondWithResult(_0x17d7bd,null))['catch'](handleError(_0x17d7bd,null));};exports['update']=function(_0x4d0900,_0xfd93f6){if(_0x4d0900[_0x69f0('0x37')]['id']){delete _0x4d0900[_0x69f0('0x37')]['id'];}return db[_0x69f0('0x4d')]['find']({'where':{'id':_0x4d0900[_0x69f0('0x53')]['id']}})[_0x69f0('0x1e')](handleEntityNotFound(_0xfd93f6,null))[_0x69f0('0x1e')](saveUpdates(_0x4d0900['body'],null))['then'](respondWithResult(_0xfd93f6,null))[_0x69f0('0x57')](handleError(_0xfd93f6,null));};exports[_0x69f0('0x32')]=function(_0x5afc49,_0x4bf3b8){return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x5afc49['params']['id']}})[_0x69f0('0x1e')](handleEntityNotFound(_0x4bf3b8,null))['then'](removeEntity(_0x4bf3b8,null))[_0x69f0('0x57')](handleError(_0x4bf3b8,null));};exports['describe']=function(_0x3eb54f,_0x155439){return db[_0x69f0('0x4d')]['describe']()['then'](respondWithResult(_0x155439,null))[_0x69f0('0x57')](handleError(_0x155439,null));};var interaction_log=require(_0x69f0('0x58'))(_0x69f0('0x59'));exports[_0x69f0('0x5a')]=function(_0x64f567,_0x22700a,_0x5b1aa6){var _0x231b88={'agent':{},'channel':'fax'};if(_0x64f567['body']['id']){delete _0x64f567[_0x69f0('0x37')]['id'];}_0x64f567[_0x69f0('0x37')]['read']=!![];_0x64f567['body'][_0x69f0('0x5b')]=moment()[_0x69f0('0x5c')](_0x69f0('0x5d'));_0x64f567[_0x69f0('0x37')][_0x69f0('0x5e')]=_0x64f567[_0x69f0('0x37')][_0x69f0('0x5e')]||_0x64f567['user']['id'];_0x231b88['agent']['id']=_0x64f567[_0x69f0('0x37')][_0x69f0('0x5e')];return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x64f567['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x69f0('0x1e')](handleEntityNotFound(_0x22700a,null))['then'](saveUpdates(_0x64f567[_0x69f0('0x37')],null))[_0x69f0('0x1e')](function(_0x4fc421){if(_0x4fc421){_0x231b88[_0x69f0('0x26')]=_0x4fc421['get']({'plain':!![]});return db['FaxInteraction'][_0x69f0('0x56')]({'where':{'id':_0x4fc421[_0x69f0('0x5f')]}});}return null;})[_0x69f0('0x1e')](handleEntityNotFound(_0x22700a,null))['then'](function(_0x46c79e){if(_0x46c79e){return _0x46c79e['update']({'UserId':_0x64f567['body']['UserId'],'read1stAt':_[_0x69f0('0x60')](_0x46c79e[_0x69f0('0x61')])?moment()[_0x69f0('0x5c')](_0x69f0('0x5d')):undefined});}return null;})[_0x69f0('0x1e')](function(_0x26bd1f){if(_0x26bd1f){_0x231b88[_0x69f0('0x3a')]=_0x26bd1f[_0x69f0('0x62')]({'plain':!![]});interaction_log[_0x69f0('0x1f')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x64f567[_0x69f0('0x63')]['id'],_0x64f567[_0x69f0('0x63')][_0x69f0('0x34')],_0x64f567[_0x69f0('0x63')][_0x69f0('0x64')],_0x231b88['interaction']['id'],_0x64f567['body']?JSON[_0x69f0('0x24')](_0x64f567[_0x69f0('0x37')]):'null');return respondWithRpcPromise(_0x69f0('0x65'),_0x69f0('0x66'),_0x231b88);}return null;})[_0x69f0('0x1e')](function(_0x566c94){if(_0x566c94){if(_0x64f567[_0x69f0('0x37')][_0x69f0('0x67')]){_0x231b88[_0x69f0('0x26')]['interface']=util[_0x69f0('0x5c')](_0x69f0('0x68'),_0x64f567['user'][_0x69f0('0x34')]);_0x231b88[_0x69f0('0x26')]['channel']=_0x231b88[_0x69f0('0x69')];_0x231b88[_0x69f0('0x26')][_0x69f0('0x6a')]='accept';return respondWithRpcPromise('EventManager',_0x69f0('0x6b'),{'event':_0x69f0('0x6c'),'message':_0x231b88['message']},client9002)[_0x69f0('0x1e')](function(){return _0x231b88;});}return _0x231b88;}return null;})['then'](respondWithResult(_0x22700a,null))[_0x69f0('0x57')](handleError(_0x22700a,null));};var interaction_log=require(_0x69f0('0x58'))(_0x69f0('0x59'));exports[_0x69f0('0x6d')]=function(_0x41088a,_0x567d99,_0x2f3862){var _0x19ea92={'agent':{},'channel':_0x69f0('0x6e')};if(_0x41088a[_0x69f0('0x37')]['id']){delete _0x41088a[_0x69f0('0x37')]['id'];}_0x41088a[_0x69f0('0x37')]['UserId']=_0x41088a['body'][_0x69f0('0x5e')]||_0x41088a[_0x69f0('0x63')]['id'];_0x19ea92[_0x69f0('0x39')]['id']=_0x41088a[_0x69f0('0x37')][_0x69f0('0x5e')];return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x41088a[_0x69f0('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x567d99,null))[_0x69f0('0x1e')](function(_0x23023d){if(_0x23023d){_0x19ea92[_0x69f0('0x26')]=_0x23023d[_0x69f0('0x62')]({'plain':!![]});return db[_0x69f0('0x6f')][_0x69f0('0x56')]({'where':{'id':_0x23023d[_0x69f0('0x5f')]}});}return null;})[_0x69f0('0x1e')](handleEntityNotFound(_0x567d99,null))[_0x69f0('0x1e')](function(_0x2e6207){if(_0x2e6207){_0x19ea92['interaction']=_0x2e6207[_0x69f0('0x62')]({'plain':!![]});interaction_log['info'](_0x69f0('0x70'),_0x41088a[_0x69f0('0x63')]['id'],_0x41088a[_0x69f0('0x63')][_0x69f0('0x34')],_0x41088a['user']['role'],_0x19ea92[_0x69f0('0x3a')]['id'],_0x41088a['body']?JSON[_0x69f0('0x24')](_0x41088a[_0x69f0('0x37')]):_0x69f0('0x71'));return respondWithRpcPromise('RejectMessage',_0x69f0('0x72'),_0x19ea92);}return null;})[_0x69f0('0x1e')](function(_0x3953f6){if(_0x3953f6){_0x3953f6['message'][_0x69f0('0x73')]=util[_0x69f0('0x5c')](_0x69f0('0x68'),_0x41088a[_0x69f0('0x63')][_0x69f0('0x34')]);_0x3953f6[_0x69f0('0x26')][_0x69f0('0x69')]=_0x19ea92[_0x69f0('0x69')];_0x3953f6[_0x69f0('0x26')][_0x69f0('0x6a')]=_0x69f0('0x6d');respondWithRpcPromise(_0x69f0('0x6b'),_0x69f0('0x6b'),{'event':'rejectmessage','message':_0x3953f6[_0x69f0('0x26')]},client9002);return _0x19ea92;}return null;})[_0x69f0('0x1e')](respondWithResult(_0x567d99,null))[_0x69f0('0x57')](handleError(_0x567d99,null));};exports[_0x69f0('0x74')]=function(_0x118aea,_0x35381d){var _0xf1d697;return db[_0x69f0('0x4d')][_0x69f0('0x74')](_0x118aea[_0x69f0('0x37')],{})[_0x69f0('0x1e')](function(_0xa50546){_0xf1d697=_0xa50546;return db[_0x69f0('0x75')][_0x69f0('0x76')]({'where':{'id':_0xf1d697[_0x69f0('0x77')]}});})[_0x69f0('0x1e')](function(_0x5406ff){if(_[_0x69f0('0x60')](_0x5406ff)){return;}else{_0xf1d697[_0x69f0('0x6e')]=_0x5406ff['fax'];return db[_0x69f0('0x78')][_0x69f0('0x76')]({'where':{'id':_0xf1d697[_0x69f0('0x79')]}});}})[_0x69f0('0x1e')](function(_0x5add1c){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x118aea[_0x69f0('0x37')])?undefined:_0x118aea[_0x69f0('0x37')][_0x69f0('0x7a')],'path':_[_0x69f0('0x60')](_0x5add1c)?undefined:util[_0x69f0('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x5add1c[_0x69f0('0x7b')]),'fax':_[_0x69f0('0x60')](_0xf1d697[_0x69f0('0x6e')])?undefined:_0xf1d697['fax'],'AttachmentId':_0xf1d697[_0x69f0('0x79')]},client9002);})[_0x69f0('0x1e')](respondWithResult(_0x35381d,0xc9))[_0x69f0('0x57')](handleError(_0x35381d,null));};exports[_0x69f0('0x7c')]=function(_0x4c3880,_0x551c32){var _0x3ad1a5=path[_0x69f0('0x7d')](config['root'],_0x69f0('0x7e'),_0x69f0('0x7f'),'attachments');return db[_0x69f0('0x4d')][_0x69f0('0x56')]({'where':{'id':_0x4c3880[_0x69f0('0x53')]['id']},'include':[{'model':db[_0x69f0('0x78')],'as':_0x69f0('0x78')}]})[_0x69f0('0x1e')](handleEntityNotFound(_0x551c32,null))[_0x69f0('0x1e')](function(_0x10e86a){if(_0x10e86a){return _0x551c32[_0x69f0('0x7c')](path[_0x69f0('0x7d')](_0x3ad1a5,_0x10e86a[_0x69f0('0x78')]['basename']));}})[_0x69f0('0x57')](handleError(_0x551c32,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 391cd37..730f880 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x34e8,0x12c));var _0x834e=function(_0x565b4f,_0x5465c8){_0x565b4f=_0x565b4f-0x0;var _0x2cbe0e=_0x34e8[_0x565b4f];return _0x2cbe0e;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x5fc3,0xa8));var _0x35fc=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x5fc3[_0x15cbce];return _0x257f29;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 8aa5dfa..2afb8fb 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31ac=['findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x31ac,0xbc));var _0xc31a=function(_0x516577,_0x2c3de1){_0x516577=_0x516577-0x0;var _0x5c9d39=_0x31ac[_0x516577];return _0x5c9d39;};'use strict';var _=require('lodash');var util=require(_0xc31a('0x0'));var logger=require(_0xc31a('0x1'))(_0xc31a('0x2'));var moment=require(_0xc31a('0x3'));var BPromise=require(_0xc31a('0x4'));var rp=require(_0xc31a('0x5'));var fs=require('fs');var path=require(_0xc31a('0x6'));var rimraf=require('rimraf');var config=require(_0xc31a('0x7'));var attributes=require('./faxMessage.attributes');module[_0xc31a('0x8')]=function(_0x5c2eb3,_0x7a6d12){return _0x5c2eb3[_0xc31a('0x9')](_0xc31a('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xc31a('0xb'),'fields':[_0xc31a('0xc')],'type':_0xc31a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c2f02,_0x3e587f,_0x545ffa){var _0x3551d6=_0x5c2eb3[_0xc31a('0xe')];var _0x5a9e7e=_0x4c2f02['get']({'plain':!![]});if(_0x5a9e7e[_0xc31a('0xf')][_0xc31a('0x10')]()==='in'||_0x5a9e7e[_0xc31a('0xf')][_0xc31a('0x10')]()===_0xc31a('0x11')&&!_0x5a9e7e[_0xc31a('0x12')]&&!_[_0xc31a('0x13')](_0x5a9e7e[_0xc31a('0x14')])){_0x3551d6[_0xc31a('0x15')][_0xc31a('0x16')]({'where':{'id':_0x5a9e7e[_0xc31a('0x17')]}})[_0xc31a('0x18')](function(_0x9e90e5){if(_0x9e90e5){_0x9e90e5[_0xc31a('0x19')]({'lastMsgAt':_0x5a9e7e['createdAt'],'lastMsgDirection':_0x5a9e7e[_0xc31a('0xf')]['toLowerCase']()});}})[_0xc31a('0x1a')](function(_0x307bdd){console[_0xc31a('0x1b')](_0x307bdd);});}_0x545ffa();}},'charset':_0xc31a('0x1c'),'collate':_0xc31a('0x1d')});}; \ No newline at end of file +var _0xf340=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define'];(function(_0x185aa5,_0x4b1bf1){var _0x4b1fca=function(_0x509896){while(--_0x509896){_0x185aa5['push'](_0x185aa5['shift']());}};_0x4b1fca(++_0x4b1bf1);}(_0xf340,0x10b));var _0x0f34=function(_0x31be25,_0x4dbdee){_0x31be25=_0x31be25-0x0;var _0x51d444=_0xf340[_0x31be25];return _0x51d444;};'use strict';var _=require(_0x0f34('0x0'));var util=require(_0x0f34('0x1'));var logger=require(_0x0f34('0x2'))(_0x0f34('0x3'));var moment=require(_0x0f34('0x4'));var BPromise=require(_0x0f34('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f34('0x6'));var rimraf=require(_0x0f34('0x7'));var config=require(_0x0f34('0x8'));var attributes=require(_0x0f34('0x9'));module[_0x0f34('0xa')]=function(_0x402e26,_0x1d0576){return _0x402e26[_0x0f34('0xb')](_0x0f34('0xc'),attributes,{'tableName':_0x0f34('0xd'),'paranoid':![],'indexes':[{'name':_0x0f34('0xe'),'fields':[_0x0f34('0xf')],'type':_0x0f34('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x455af9,_0x1d0716,_0x4ea55f){var _0x1a1849=_0x402e26[_0x0f34('0x11')];var _0x161ecb=_0x455af9[_0x0f34('0x12')]({'plain':!![]});if(_0x161ecb['direction'][_0x0f34('0x13')]()==='in'||_0x161ecb[_0x0f34('0x14')]['toLowerCase']()===_0x0f34('0x15')&&!_0x161ecb[_0x0f34('0x16')]&&!_['isNil'](_0x161ecb['UserId'])){_0x1a1849[_0x0f34('0x17')][_0x0f34('0x18')]({'where':{'id':_0x161ecb[_0x0f34('0x19')]}})[_0x0f34('0x1a')](function(_0x41dfdb){if(_0x41dfdb){_0x41dfdb[_0x0f34('0x1b')]({'lastMsgAt':_0x161ecb[_0x0f34('0x1c')],'lastMsgDirection':_0x161ecb[_0x0f34('0x14')][_0x0f34('0x13')]()});}})[_0x0f34('0x1d')](function(_0x4592d9){console['error'](_0x4592d9);});}_0x4ea55f();}},'charset':'utf8mb4','collate':_0x0f34('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6d92c23..a61a6e6 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa342=['info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','create','body','catch','UpdateFaxMessage','update','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxMessage.socket','then'];(function(_0x3b44e6,_0x535a52){var _0x29b17e=function(_0x264588){while(--_0x264588){_0x3b44e6['push'](_0x3b44e6['shift']());}};_0x29b17e(++_0x535a52);}(_0xa342,0x14e));var _0x2a34=function(_0x5382ca,_0x3ee668){_0x5382ca=_0x5382ca-0x0;var _0x37083c=_0xa342[_0x5382ca];return _0x37083c;};'use strict';var _=require(_0x2a34('0x0'));var util=require(_0x2a34('0x1'));var moment=require(_0x2a34('0x2'));var BPromise=require(_0x2a34('0x3'));var rs=require(_0x2a34('0x4'));var fs=require('fs');var Redis=require(_0x2a34('0x5'));var db=require(_0x2a34('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a34('0x7'))(_0x2a34('0x8'));var config=require(_0x2a34('0x9'));var jayson=require(_0x2a34('0xa'));var client=jayson[_0x2a34('0xb')][_0x2a34('0xc')]({'port':0x232a});config[_0x2a34('0xd')]=_['defaults'](config[_0x2a34('0xd')],{'host':_0x2a34('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a34('0xd')]));require(_0x2a34('0xf'))['register'](socket);function respondWithRpcPromise(_0x25e5ef,_0x1590be,_0x5d357f){return new BPromise(function(_0x4fbad0,_0x39515e){return client['request'](_0x25e5ef,_0x5d357f)[_0x2a34('0x10')](function(_0x5715fd){logger[_0x2a34('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1590be,_0x2a34('0x12'));logger[_0x2a34('0x13')](_0x2a34('0x14'),_0x1590be,_0x2a34('0x12'),JSON[_0x2a34('0x15')](_0x5715fd));if(_0x5715fd[_0x2a34('0x16')]){if(_0x5715fd[_0x2a34('0x16')][_0x2a34('0x17')]===0x1f4){logger[_0x2a34('0x16')](_0x2a34('0x18'),_0x1590be,_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);return _0x39515e(_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);}logger[_0x2a34('0x16')](_0x2a34('0x18'),_0x1590be,_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);return _0x4fbad0(_0x5715fd[_0x2a34('0x16')][_0x2a34('0x19')]);}else{logger['info'](_0x2a34('0x18'),_0x1590be,_0x2a34('0x12'));_0x4fbad0(_0x5715fd[_0x2a34('0x1a')]['message']);}})['catch'](function(_0x5dd6c9){logger['error'](_0x2a34('0x18'),_0x1590be,_0x5dd6c9);_0x39515e(_0x5dd6c9);});});}exports[_0x2a34('0x1b')]=function(_0xea5465){var _0x1861aa=this;return new Promise(function(_0x40dba4,_0x169b13){return db[_0x2a34('0x1c')][_0x2a34('0x1d')](_0xea5465[_0x2a34('0x1e')],{'raw':_0xea5465['options']?_0xea5465['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x256711){logger[_0x2a34('0x11')](_0x2a34('0x1b'),_0xea5465);logger[_0x2a34('0x13')](_0x2a34('0x1b'),_0xea5465,JSON[_0x2a34('0x15')](_0x256711));_0x40dba4(_0x256711);})[_0x2a34('0x1f')](function(_0x48697d){logger[_0x2a34('0x16')]('CreateFaxMessage',_0x48697d[_0x2a34('0x19')],_0xea5465);_0x169b13(_0x1861aa['error'](0x1f4,_0x48697d['message']));});});};exports[_0x2a34('0x20')]=function(_0x3f7853){var _0x25da32=this;return new Promise(function(_0x16d9cc,_0x87be2b){return db[_0x2a34('0x1c')][_0x2a34('0x21')](_0x3f7853['body'],{'raw':_0x3f7853[_0x2a34('0x22')]?_0x3f7853['options'][_0x2a34('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7853[_0x2a34('0x22')]?_0x3f7853['options'][_0x2a34('0x24')]||null:null,'attributes':_0x3f7853[_0x2a34('0x22')]?_0x3f7853['options'][_0x2a34('0x25')]||null:null,'limit':_0x3f7853[_0x2a34('0x22')]?_0x3f7853[_0x2a34('0x22')][_0x2a34('0x26')]||null:null})['then'](function(_0x548781){logger[_0x2a34('0x11')](_0x2a34('0x20'),_0x3f7853);logger[_0x2a34('0x13')](_0x2a34('0x20'),_0x3f7853,JSON['stringify'](_0x548781));_0x16d9cc(_0x548781);})[_0x2a34('0x1f')](function(_0x44474c){logger[_0x2a34('0x16')](_0x2a34('0x20'),_0x44474c['message'],_0x3f7853);_0x87be2b(_0x25da32[_0x2a34('0x16')](0x1f4,_0x44474c['message']));});});}; \ No newline at end of file +var _0x4bac=['../../config/logger','rpc','jayson/promise','client','http','defaults','redis','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','CreateFaxMessage','UpdateFaxMessage','FaxMessage','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x46cda0,_0x14728f){var _0x2b6093=function(_0x17acca){while(--_0x17acca){_0x46cda0['push'](_0x46cda0['shift']());}};_0x2b6093(++_0x14728f);}(_0x4bac,0xd6));var _0xc4ba=function(_0x3333e5,_0x11fb18){_0x3333e5=_0x3333e5-0x0;var _0x37d564=_0x4bac[_0x3333e5];return _0x37d564;};'use strict';var _=require(_0xc4ba('0x0'));var util=require(_0xc4ba('0x1'));var moment=require(_0xc4ba('0x2'));var BPromise=require(_0xc4ba('0x3'));var rs=require(_0xc4ba('0x4'));var fs=require('fs');var Redis=require(_0xc4ba('0x5'));var db=require(_0xc4ba('0x6'))['db'];var utils=require(_0xc4ba('0x7'));var logger=require(_0xc4ba('0x8'))(_0xc4ba('0x9'));var config=require('../../config/environment');var jayson=require(_0xc4ba('0xa'));var client=jayson[_0xc4ba('0xb')][_0xc4ba('0xc')]({'port':0x232a});config['redis']=_[_0xc4ba('0xd')](config[_0xc4ba('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4ba('0xe')]));require(_0xc4ba('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ba794,_0x325f1a,_0x252c2a){return new BPromise(function(_0x3ef386,_0x33cd0b){return client['request'](_0x5ba794,_0x252c2a)[_0xc4ba('0x10')](function(_0x471abe){logger[_0xc4ba('0x11')](_0xc4ba('0x12'),_0x325f1a,_0xc4ba('0x13'));logger[_0xc4ba('0x14')](_0xc4ba('0x15'),_0x325f1a,_0xc4ba('0x13'),JSON[_0xc4ba('0x16')](_0x471abe));if(_0x471abe[_0xc4ba('0x17')]){if(_0x471abe[_0xc4ba('0x17')][_0xc4ba('0x18')]===0x1f4){logger[_0xc4ba('0x17')](_0xc4ba('0x12'),_0x325f1a,_0x471abe[_0xc4ba('0x17')][_0xc4ba('0x19')]);return _0x33cd0b(_0x471abe[_0xc4ba('0x17')]['message']);}logger[_0xc4ba('0x17')](_0xc4ba('0x12'),_0x325f1a,_0x471abe[_0xc4ba('0x17')][_0xc4ba('0x19')]);return _0x3ef386(_0x471abe[_0xc4ba('0x17')][_0xc4ba('0x19')]);}else{logger[_0xc4ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0x325f1a,_0xc4ba('0x13'));_0x3ef386(_0x471abe[_0xc4ba('0x1a')]['message']);}})[_0xc4ba('0x1b')](function(_0x58d956){logger[_0xc4ba('0x17')](_0xc4ba('0x12'),_0x325f1a,_0x58d956);_0x33cd0b(_0x58d956);});});}exports['CreateFaxMessage']=function(_0x4b1836){var _0x194940=this;return new Promise(function(_0x9d76c,_0x332fc4){return db['FaxMessage'][_0xc4ba('0x1c')](_0x4b1836[_0xc4ba('0x1d')],{'raw':_0x4b1836[_0xc4ba('0x1e')]?_0x4b1836[_0xc4ba('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xc4ba('0x10')](function(_0x432ea6){logger['info'](_0xc4ba('0x1f'),_0x4b1836);logger['debug'](_0xc4ba('0x1f'),_0x4b1836,JSON[_0xc4ba('0x16')](_0x432ea6));_0x9d76c(_0x432ea6);})[_0xc4ba('0x1b')](function(_0x2a0335){logger[_0xc4ba('0x17')](_0xc4ba('0x1f'),_0x2a0335['message'],_0x4b1836);_0x332fc4(_0x194940[_0xc4ba('0x17')](0x1f4,_0x2a0335['message']));});});};exports[_0xc4ba('0x20')]=function(_0x4ba9a7){var _0x5e5211=this;return new Promise(function(_0x42c75a,_0x365c91){return db[_0xc4ba('0x21')][_0xc4ba('0x22')](_0x4ba9a7[_0xc4ba('0x1d')],{'raw':_0x4ba9a7[_0xc4ba('0x1e')]?_0x4ba9a7[_0xc4ba('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ba9a7[_0xc4ba('0x1e')]?_0x4ba9a7[_0xc4ba('0x1e')][_0xc4ba('0x23')]||null:null,'attributes':_0x4ba9a7[_0xc4ba('0x1e')]?_0x4ba9a7[_0xc4ba('0x1e')]['attributes']||null:null,'limit':_0x4ba9a7[_0xc4ba('0x1e')]?_0x4ba9a7['options'][_0xc4ba('0x24')]||null:null})[_0xc4ba('0x10')](function(_0x328357){logger[_0xc4ba('0x11')](_0xc4ba('0x20'),_0x4ba9a7);logger[_0xc4ba('0x14')](_0xc4ba('0x20'),_0x4ba9a7,JSON['stringify'](_0x328357));_0x42c75a(_0x328357);})['catch'](function(_0x30d215){logger['error'](_0xc4ba('0x20'),_0x30d215['message'],_0x4ba9a7);_0x365c91(_0x5e5211['error'](0x1f4,_0x30d215[_0xc4ba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index df3bf74..c919e05 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 90f28c7..f754987 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa06a=['reject','delete','multer','util','connect-timeout','express','../../components/interaction/service','./faxMessage.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/download','post','fax','faxmessage:create','create','update','/:id/accept','accept','put','/:id/reject'];(function(_0xba5c11,_0x42854b){var _0x52503e=function(_0x2176e5){while(--_0x2176e5){_0xba5c11['push'](_0xba5c11['shift']());}};_0x52503e(++_0x42854b);}(_0xa06a,0x122));var _0xaa06=function(_0x3a2043,_0x5d3bf6){_0x3a2043=_0x3a2043-0x0;var _0x3723ae=_0xa06a[_0x3a2043];return _0x3723ae;};'use strict';var multer=require(_0xaa06('0x0'));var util=require(_0xaa06('0x1'));var path=require('path');var timeout=require(_0xaa06('0x2'));var express=require(_0xaa06('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa06('0x4'));var config=require('../../config/environment');var controller=require(_0xaa06('0x5'));router['get']('/',auth[_0xaa06('0x6')](),controller[_0xaa06('0x7')]);router[_0xaa06('0x8')](_0xaa06('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xaa06('0xa'),auth[_0xaa06('0x6')](),controller[_0xaa06('0xb')]);router[_0xaa06('0x8')](_0xaa06('0xc'),auth[_0xaa06('0x6')](),controller['download']);router[_0xaa06('0xd')]('/',auth[_0xaa06('0x6')](),interaction['tracked'](_0xaa06('0xe'),_0xaa06('0xf')),controller[_0xaa06('0x10')]);router['put'](_0xaa06('0xa'),auth[_0xaa06('0x6')](),controller[_0xaa06('0x11')]);router['put'](_0xaa06('0x12'),auth[_0xaa06('0x6')](),controller[_0xaa06('0x13')]);router[_0xaa06('0x14')](_0xaa06('0x15'),auth['isAuthenticated'](),controller[_0xaa06('0x16')]);router[_0xaa06('0x17')](_0xaa06('0xa'),auth[_0xaa06('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4bbb=['get','/describe','describe','/:id','download','tracked','fax','faxmessage:create','put','update','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','../../components/auth/service','./faxMessage.controller','isAuthenticated','index'];(function(_0x2bbb70,_0x340918){var _0x370c83=function(_0x27cfdd){while(--_0x27cfdd){_0x2bbb70['push'](_0x2bbb70['shift']());}};_0x370c83(++_0x340918);}(_0x4bbb,0x167));var _0xb4bb=function(_0xb12380,_0x3817b5){_0xb12380=_0xb12380-0x0;var _0x4278df=_0x4bbb[_0xb12380];return _0x4278df;};'use strict';var multer=require(_0xb4bb('0x0'));var util=require(_0xb4bb('0x1'));var path=require(_0xb4bb('0x2'));var timeout=require(_0xb4bb('0x3'));var express=require(_0xb4bb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb4bb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb4bb('0x6'));router['get']('/',auth[_0xb4bb('0x7')](),controller[_0xb4bb('0x8')]);router[_0xb4bb('0x9')](_0xb4bb('0xa'),auth[_0xb4bb('0x7')](),controller[_0xb4bb('0xb')]);router['get'](_0xb4bb('0xc'),auth[_0xb4bb('0x7')](),controller['show']);router[_0xb4bb('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xb4bb('0xd')]);router['post']('/',auth[_0xb4bb('0x7')](),interaction[_0xb4bb('0xe')](_0xb4bb('0xf'),_0xb4bb('0x10')),controller['create']);router[_0xb4bb('0x11')](_0xb4bb('0xc'),auth[_0xb4bb('0x7')](),controller[_0xb4bb('0x12')]);router['put']('/:id/accept',auth[_0xb4bb('0x7')](),controller[_0xb4bb('0x13')]);router[_0xb4bb('0x11')](_0xb4bb('0x14'),auth['isAuthenticated'](),controller[_0xb4bb('0x15')]);router[_0xb4bb('0x16')](_0xb4bb('0xc'),auth[_0xb4bb('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 765c036..b9e00ea 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d59=['roundrobin','sequelize','exports','STRING','INTEGER','beepall'];(function(_0x10b719,_0x5b4b37){var _0x1037ca=function(_0x153d31){while(--_0x153d31){_0x10b719['push'](_0x10b719['shift']());}};_0x1037ca(++_0x5b4b37);}(_0x4d59,0x6d));var _0x94d5=function(_0x499b42,_0x287e10){_0x499b42=_0x499b42-0x0;var _0x32945f=_0x4d59[_0x499b42];return _0x32945f;};'use strict';var Sequelize=require(_0x94d5('0x0'));module[_0x94d5('0x1')]={'name':{'type':Sequelize[_0x94d5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x94d5('0x2')]},'timeout':{'type':Sequelize[_0x94d5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x94d5('0x4'),_0x94d5('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x94d5('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d23=['ENUM','rrmemory','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x10d7c2,_0x4bc6f4){var _0x436cac=function(_0x6378f4){while(--_0x6378f4){_0x10d7c2['push'](_0x10d7c2['shift']());}};_0x436cac(++_0x4bc6f4);}(_0x6d23,0x6b));var _0x36d2=function(_0x5bf3ce,_0x3abb42){_0x5bf3ce=_0x5bf3ce-0x0;var _0xf6179e=_0x6d23[_0x5bf3ce];return _0xf6179e;};'use strict';var Sequelize=require(_0x36d2('0x0'));module[_0x36d2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x36d2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x36d2('0x3')]},'timeout':{'type':Sequelize[_0x36d2('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36d2('0x5')](_0x36d2('0x6'),'beepall',_0x36d2('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x36d2('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 01573f6..66df0a0 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c4e=['UserProfileSection','find','userProfileId','autoAssociation','error','update','describe','getMembers','findOne','length','nolimit','FaxQueueId','UserFaxQueue','User','UserId','faxPause','format','%s/%s','createdAt','updatedAt','Team','getTeams','addTeams','ids','findAll','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','union','value','transaction','removeTeams','removeAgents','emit','addAgents','omit','userFaxQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','UserProfileResource','name','send','render','merge','contact','message','agent','account','map','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c4e,0x152));var _0xe4c4=function(_0x52dc8c,_0x4b1a69){_0x52dc8c=_0x52dc8c-0x0;var _0x24ecea=_0x4c4e[_0x52dc8c];return _0x24ecea;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];config['redis']=_[_0xe4c4('0x1a')](config[_0xe4c4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4c4('0x1c'))(new Redis(config[_0xe4c4('0x1b')]));require('./faxQueue.socket')[_0xe4c4('0x1d')](socket);function respondWithStatusCode(_0x29766a,_0x5e263c){_0x5e263c=_0x5e263c||0xcc;return function(_0x307aa8){if(_0x307aa8){return _0x29766a[_0xe4c4('0x1e')](_0x5e263c);}return _0x29766a[_0xe4c4('0x1f')](_0x5e263c)[_0xe4c4('0x20')]();};}function respondWithResult(_0x19e59b,_0x882be2){_0x882be2=_0x882be2||0xc8;return function(_0x1f637e){if(_0x1f637e){return _0x19e59b[_0xe4c4('0x1f')](_0x882be2)[_0xe4c4('0x21')](_0x1f637e);}};}function respondWithFilteredResult(_0x36b10c,_0x23b7e6){return function(_0x42242c){if(_0x42242c){var _0x3820c7=typeof _0x23b7e6[_0xe4c4('0x22')]===_0xe4c4('0x23')&&typeof _0x23b7e6['limit']===_0xe4c4('0x23');var _0x24f946=_0x42242c[_0xe4c4('0x24')];var _0x317cc8=_0x3820c7?0x0:_0x23b7e6['offset'];var _0x3d5856=_0x3820c7?_0x42242c[_0xe4c4('0x24')]:_0x23b7e6[_0xe4c4('0x22')]+_0x23b7e6[_0xe4c4('0x25')];var _0x2c5aea;if(_0x3d5856>=_0x24f946){_0x3d5856=_0x24f946;_0x2c5aea=0xc8;}else{_0x2c5aea=0xce;}_0x36b10c[_0xe4c4('0x1f')](_0x2c5aea);return _0x36b10c[_0xe4c4('0x26')](_0xe4c4('0x27'),_0x317cc8+'-'+_0x3d5856+'/'+_0x24f946)[_0xe4c4('0x21')](_0x42242c);}return null;};}function patchUpdates(_0x1a7690){return function(_0x210ee1){try{jsonpatch[_0xe4c4('0x28')](_0x210ee1,_0x1a7690,!![]);}catch(_0x138ead){return BPromise[_0xe4c4('0x29')](_0x138ead);}return _0x210ee1[_0xe4c4('0x2a')]();};}function saveUpdates(_0x59498e,_0x49cadc){return function(_0x403a2c){if(_0x403a2c){return _0x403a2c['update'](_0x59498e)[_0xe4c4('0x2b')](function(_0x5374fd){return _0x5374fd;});}return null;};}function removeEntity(_0x3adfcb,_0x5efc4c){return function(_0x34d667){if(_0x34d667){return _0x34d667['destroy']()[_0xe4c4('0x2b')](function(){var _0x4a0199=_0x34d667['get']({'plain':!![]});var _0x4cea1f='FaxQueues';return db[_0xe4c4('0x2c')]['destroy']({'where':{'type':_0x4cea1f,'resourceId':_0x4a0199['id']}})['then'](function(){return _0x34d667;});})[_0xe4c4('0x2b')](function(){_0x3adfcb[_0xe4c4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57ba43,_0x7428ad){return function(_0x33de43){if(!_0x33de43){_0x57ba43['sendStatus'](0x194);}return _0x33de43;};}function handleError(_0x158432,_0x2d0e2){_0x2d0e2=_0x2d0e2||0x1f4;return function(_0x3f60fc){logger['error'](_0x3f60fc['stack']);if(_0x3f60fc[_0xe4c4('0x2d')]){delete _0x3f60fc[_0xe4c4('0x2d')];}_0x158432[_0xe4c4('0x1f')](_0x2d0e2)[_0xe4c4('0x2e')](_0x3f60fc);};}function getMustacheRender(_0x5391f6,_0x49c913){return Mustache[_0xe4c4('0x2f')](_0x5391f6,_[_0xe4c4('0x30')](_0x49c913['body'],{'contact':_0x49c913[_0xe4c4('0x31')],'message':_0x49c913[_0xe4c4('0x32')],'agent':_0x49c913[_0xe4c4('0x33')],'interaction':_0x49c913['interaction'],'account':_0x49c913[_0xe4c4('0x34')]}))||'';}exports['index']=function(_0x45fc76,_0x4239ba){var _0x3bb6cf={},_0x35717a={},_0x2bd5c1={'count':0x0,'rows':[]};var _0x43c1ec=_[_0xe4c4('0x35')](db[_0xe4c4('0x36')][_0xe4c4('0x37')],function(_0x18b2a8){return{'name':_0x18b2a8[_0xe4c4('0x38')],'type':_0x18b2a8[_0xe4c4('0x39')]['key']};});_0x35717a[_0xe4c4('0x3a')]=_[_0xe4c4('0x35')](_0x43c1ec,_0xe4c4('0x2d'));_0x35717a['query']=_[_0xe4c4('0x3b')](_0x45fc76[_0xe4c4('0x3c')]);_0x35717a[_0xe4c4('0x3d')]=_['intersection'](_0x35717a[_0xe4c4('0x3a')],_0x35717a[_0xe4c4('0x3c')]);_0x3bb6cf[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x35717a[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x40')]));_0x3bb6cf[_0xe4c4('0x3e')]=_0x3bb6cf[_0xe4c4('0x3e')]['length']?_0x3bb6cf[_0xe4c4('0x3e')]:_0x35717a[_0xe4c4('0x3a')];if(!_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x41')]('nolimit')){_0x3bb6cf[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x45fc76['query'][_0xe4c4('0x25')]);_0x3bb6cf[_0xe4c4('0x22')]=qs['offset'](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}_0x3bb6cf[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x43')]);_0x3bb6cf[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_[_0xe4c4('0x45')](_0x45fc76[_0xe4c4('0x3c')],_0x35717a[_0xe4c4('0x3d')]),_0x43c1ec);if(_0x45fc76[_0xe4c4('0x3c')]['filter']){_0x3bb6cf[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3bb6cf[_0xe4c4('0x44')],{'$or':_[_0xe4c4('0x35')](_0x43c1ec,function(_0x260141){if(_0x260141[_0xe4c4('0x39')]!=='VIRTUAL'){var _0x312a49={};_0x312a49[_0x260141['name']]={'$like':'%'+_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x46')]+'%'};return _0x312a49;}})});}_0x3bb6cf=_[_0xe4c4('0x30')]({},_0x3bb6cf,_0x45fc76[_0xe4c4('0x47')]);var _0x48177f={'where':_0x3bb6cf['where']};return db['FaxQueue'][_0xe4c4('0x24')](_0x48177f)[_0xe4c4('0x2b')](function(_0x5aeded){_0x2bd5c1['count']=_0x5aeded;if(_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x48')]){_0x3bb6cf[_0xe4c4('0x49')]=[{'all':!![]}];}return db[_0xe4c4('0x36')]['findAll'](_0x3bb6cf);})[_0xe4c4('0x2b')](function(_0xd8e246){_0x2bd5c1[_0xe4c4('0x4a')]=_0xd8e246;return _0x2bd5c1;})[_0xe4c4('0x2b')](respondWithFilteredResult(_0x4239ba,_0x3bb6cf))[_0xe4c4('0x4b')](handleError(_0x4239ba,null));};exports[_0xe4c4('0x4c')]=function(_0x1eda5e,_0x176712){var _0x3ee4db={'raw':!![],'where':{'id':_0x1eda5e[_0xe4c4('0x4d')]['id']}},_0x5c7c4d={};_0x5c7c4d['model']=_[_0xe4c4('0x3b')](db[_0xe4c4('0x36')][_0xe4c4('0x37')]);_0x5c7c4d[_0xe4c4('0x3c')]=_[_0xe4c4('0x3b')](_0x1eda5e[_0xe4c4('0x3c')]);_0x5c7c4d[_0xe4c4('0x3d')]=_[_0xe4c4('0x3f')](_0x5c7c4d[_0xe4c4('0x3a')],_0x5c7c4d[_0xe4c4('0x3c')]);_0x3ee4db[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x5c7c4d[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x1eda5e['query']['fields']));_0x3ee4db[_0xe4c4('0x3e')]=_0x3ee4db[_0xe4c4('0x3e')]['length']?_0x3ee4db[_0xe4c4('0x3e')]:_0x5c7c4d[_0xe4c4('0x3a')];if(_0x1eda5e[_0xe4c4('0x3c')][_0xe4c4('0x48')]){_0x3ee4db[_0xe4c4('0x49')]=[{'all':!![]}];}_0x3ee4db=_['merge']({},_0x3ee4db,_0x1eda5e[_0xe4c4('0x47')]);return db[_0xe4c4('0x36')]['find'](_0x3ee4db)[_0xe4c4('0x2b')](handleEntityNotFound(_0x176712,null))[_0xe4c4('0x2b')](respondWithResult(_0x176712,null))['catch'](handleError(_0x176712,null));};exports[_0xe4c4('0x4e')]=function(_0x53699d,_0xa66376){return db[_0xe4c4('0x36')][_0xe4c4('0x4e')](_0x53699d[_0xe4c4('0x4f')],{})[_0xe4c4('0x2b')](function(_0x525534){var _0x1c8b2e=_0x53699d[_0xe4c4('0x50')][_0xe4c4('0x51')]({'plain':!![]});if(!_0x1c8b2e)throw new Error(_0xe4c4('0x52'));if(_0x1c8b2e[_0xe4c4('0x53')]===_0xe4c4('0x50')){var _0x3ddcbe=_0x525534[_0xe4c4('0x51')]({'plain':!![]});var _0x1a96ba=_0xe4c4('0x54');return db[_0xe4c4('0x55')][_0xe4c4('0x56')]({'where':{'name':_0x1a96ba,'userProfileId':_0x1c8b2e[_0xe4c4('0x57')]},'raw':!![]})[_0xe4c4('0x2b')](function(_0x466882){if(_0x466882&&_0x466882[_0xe4c4('0x58')]===0x0){return db['UserProfileResource'][_0xe4c4('0x4e')]({'name':_0x3ddcbe[_0xe4c4('0x2d')],'resourceId':_0x3ddcbe['id'],'type':_0x466882[_0xe4c4('0x2d')],'sectionId':_0x466882['id']},{})['then'](function(){return _0x525534;});}else{return _0x525534;}})[_0xe4c4('0x4b')](function(_0xb7e4da){logger[_0xe4c4('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7e4da);throw _0xb7e4da;});}return _0x525534;})[_0xe4c4('0x2b')](respondWithResult(_0xa66376,0xc9))['catch'](handleError(_0xa66376,null));};exports[_0xe4c4('0x5a')]=function(_0xfbfff6,_0x1cef48){if(_0xfbfff6['body']['id']){delete _0xfbfff6['body']['id'];}return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0xfbfff6[_0xe4c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1cef48,null))[_0xe4c4('0x2b')](saveUpdates(_0xfbfff6['body'],null))['then'](respondWithResult(_0x1cef48,null))['catch'](handleError(_0x1cef48,null));};exports['destroy']=function(_0x1ca931,_0x3a06da){return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x1ca931[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x3a06da,null))['then'](removeEntity(_0x3a06da,null))[_0xe4c4('0x4b')](handleError(_0x3a06da,null));};exports[_0xe4c4('0x5b')]=function(_0x184c5b,_0x125652){return db[_0xe4c4('0x36')][_0xe4c4('0x5b')]()['then'](respondWithResult(_0x125652,null))['catch'](handleError(_0x125652,null));};exports[_0xe4c4('0x5c')]=function(_0x6f374e,_0x1986ab,_0x3c8e44){var _0x3ccf42={'raw':!![],'where':{}},_0x2a575d={},_0x1dfc2d;return db[_0xe4c4('0x36')][_0xe4c4('0x5d')]({'where':{'id':_0x6f374e['params']['id']}})['then'](handleEntityNotFound(_0x1986ab,null))[_0xe4c4('0x2b')](function(_0x56f32e){if(_0x56f32e){_0x1dfc2d=_0x56f32e[_0xe4c4('0x51')]({'plain':!![]});_0x2a575d[_0xe4c4('0x3a')]=_[_0xe4c4('0x3b')](db['UserFaxQueue'][_0xe4c4('0x37')]);_0x2a575d['query']=_[_0xe4c4('0x3b')](_0x6f374e['query']);_0x2a575d['filters']=_[_0xe4c4('0x3f')](_0x2a575d[_0xe4c4('0x3a')],_0x2a575d[_0xe4c4('0x3c')]);_0x3ccf42['attributes']=_['intersection'](_0x2a575d['model'],qs[_0xe4c4('0x40')](_0x6f374e[_0xe4c4('0x3c')]['fields']));_0x3ccf42[_0xe4c4('0x3e')]=_0x3ccf42[_0xe4c4('0x3e')][_0xe4c4('0x5e')]?_0x3ccf42['attributes']:_0x2a575d['model'];if(!_0x6f374e[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x3ccf42[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x6f374e[_0xe4c4('0x3c')]['limit']);_0x3ccf42[_0xe4c4('0x22')]=qs[_0xe4c4('0x22')](_0x6f374e[_0xe4c4('0x3c')]['offset']);}_0x3ccf42[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x6f374e[_0xe4c4('0x3c')]['sort']);_0x3ccf42['where']=qs[_0xe4c4('0x3d')](_['pick'](_0x6f374e['query'],_0x2a575d[_0xe4c4('0x3d')]));_0x3ccf42[_0xe4c4('0x44')][_0xe4c4('0x60')]=_0x56f32e['id'];if(_0x6f374e[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x3ccf42[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3ccf42[_0xe4c4('0x44')],{'$or':_['map'](_0x3ccf42[_0xe4c4('0x3e')],function(_0x475c2b){var _0x4bb16e={};_0x4bb16e[_0x475c2b]={'$like':'%'+_0x6f374e['query'][_0xe4c4('0x46')]+'%'};return _0x4bb16e;})});}_0x3ccf42=_[_0xe4c4('0x30')]({},_0x3ccf42,_0x6f374e[_0xe4c4('0x47')]);return db[_0xe4c4('0x61')]['findAll'](_0x3ccf42);}})[_0xe4c4('0x2b')](function(_0x25e84f){if(_0x25e84f){return db[_0xe4c4('0x62')]['findAndCountAll']({'where':{'id':_['map'](_0x25e84f,_0xe4c4('0x63')),'role':_0xe4c4('0x33')},'attributes':['id',_0xe4c4('0x2d'),_0xe4c4('0x64'),'updatedAt','createdAt']});}})[_0xe4c4('0x2b')](function(_0xe41a6d){if(_0xe41a6d){return{'count':_0xe41a6d[_0xe4c4('0x24')],'rows':_[_0xe4c4('0x35')](_0xe41a6d[_0xe4c4('0x4a')],function(_0x515e24){return{'membername':_0x515e24[_0xe4c4('0x2d')],'UserId':_0x515e24['id'],'queue_name':_0x1dfc2d['name'],'FaxQueueId':_0x1dfc2d['id'],'interface':util[_0xe4c4('0x65')](_0xe4c4('0x66'),'SIP',_0x515e24['name']),'penalty':0x0,'paused':_0x515e24[_0xe4c4('0x64')],'createdAt':_0x515e24[_0xe4c4('0x67')],'updatedAt':_0x515e24[_0xe4c4('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4c4('0x2b')](respondWithFilteredResult(_0x1986ab,_0x3ccf42))[_0xe4c4('0x4b')](handleError(_0x1986ab,null));};exports['getTeams']=function(_0x4a71e9,_0x4e2b6b,_0x376c8e){var _0x3285f4={};var _0x4c10ef={};var _0x203f11;var _0x11faa3;return db[_0xe4c4('0x36')][_0xe4c4('0x5d')]({'where':{'id':_0x4a71e9['params']['id']}})['then'](handleEntityNotFound(_0x4e2b6b,null))[_0xe4c4('0x2b')](function(_0x32f019){if(_0x32f019){_0x203f11=_0x32f019;_0x4c10ef[_0xe4c4('0x3a')]=_[_0xe4c4('0x3b')](db[_0xe4c4('0x69')][_0xe4c4('0x37')]);_0x4c10ef[_0xe4c4('0x3c')]=_['keys'](_0x4a71e9[_0xe4c4('0x3c')]);_0x4c10ef[_0xe4c4('0x3d')]=_[_0xe4c4('0x3f')](_0x4c10ef[_0xe4c4('0x3a')],_0x4c10ef['query']);_0x3285f4[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x4c10ef[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x4a71e9['query'][_0xe4c4('0x40')]));_0x3285f4[_0xe4c4('0x3e')]=_0x3285f4['attributes']['length']?_0x3285f4[_0xe4c4('0x3e')]:_0x4c10ef[_0xe4c4('0x3a')];_0x3285f4[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x43')]);_0x3285f4[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_['pick'](_0x4a71e9['query'],_0x4c10ef[_0xe4c4('0x3d')]));if(_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x3285f4[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3285f4['where'],{'$or':_[_0xe4c4('0x35')](_0x3285f4[_0xe4c4('0x3e')],function(_0x425f38){var _0x295e2b={};_0x295e2b[_0x425f38]={'$like':'%'+_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x46')]+'%'};return _0x295e2b;})});}_0x3285f4=_[_0xe4c4('0x30')]({},_0x3285f4,_0x4a71e9[_0xe4c4('0x47')]);return _0x203f11[_0xe4c4('0x6a')](_0x3285f4);}})[_0xe4c4('0x2b')](function(_0x272345){if(_0x272345){_0x11faa3=_0x272345[_0xe4c4('0x5e')];if(!_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x3285f4[_0xe4c4('0x25')]=qs['limit'](_0x4a71e9['query'][_0xe4c4('0x25')]);_0x3285f4['offset']=qs[_0xe4c4('0x22')](_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}return _0x203f11[_0xe4c4('0x6a')](_0x3285f4);}})[_0xe4c4('0x2b')](function(_0x2f0664){if(_0x2f0664){return _0x2f0664?{'count':_0x11faa3,'rows':_0x2f0664}:null;}})[_0xe4c4('0x2b')](respondWithResult(_0x4e2b6b,null))[_0xe4c4('0x4b')](handleError(_0x4e2b6b,null));};exports[_0xe4c4('0x6b')]=function(_0x1579fe,_0x37bf48,_0x27a6e1){var _0x3030f6=_0x1579fe['body'][_0xe4c4('0x6c')];return db[_0xe4c4('0x69')][_0xe4c4('0x6d')]({'where':{'id':_0x3030f6},'attributes':['id'],'include':[{'model':db[_0xe4c4('0x62')],'as':_0xe4c4('0x6e'),'attributes':['id','name',_0xe4c4('0x6f'),_0xe4c4('0x70'),'interface'],'raw':!![]}]})[_0xe4c4('0x2b')](function(_0x32d704){if(_0x32d704){var _0x4f597a=_['flatMap'](_0x32d704,function(_0x4e63a5){var _0xaa2136=_0x4e63a5['get']({'plain':!![]});return _0xaa2136[_0xe4c4('0x6e')];});return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x1579fe['params']['id']}})[_0xe4c4('0x2b')](function(_0x37cb8b){return db[_0xe4c4('0x71')]['transaction'](function(_0x52c9a4){return _0x37cb8b['addTeams'](_0x3030f6,{'transaction':_0x52c9a4})[_0xe4c4('0x2b')](function(){return BPromise[_0xe4c4('0x72')](_0x4f597a,function(_0x3c6b54){return db['UserFaxQueue'][_0xe4c4('0x73')]({'where':{'UserId':_0x3c6b54['id'],'FaxQueueId':_0x1579fe[_0xe4c4('0x4d')]['id']},'transaction':_0x52c9a4});});})[_0xe4c4('0x2b')](function(){_0x4f597a[_0xe4c4('0x74')](function(_0x325913){socket['emit'](_0xe4c4('0x75'),{'UserId':_0x325913['id'],'FaxQueueId':_0x37cb8b['id']});});});});});}})[_0xe4c4('0x2b')](respondWithStatusCode(_0x37bf48,null))[_0xe4c4('0x4b')](handleError(_0x37bf48,null));};exports['removeTeams']=function(_0x157c61,_0x21d8ca,_0x144e09){return db['Team'][_0xe4c4('0x6d')]({'where':{'id':_0x157c61[_0xe4c4('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe4c4('0x62')],'as':_0xe4c4('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xe4c4('0x2b')](handleEntityNotFound(_0x21d8ca,null))[_0xe4c4('0x2b')](function(_0x60f0fd){var _0x429ba6=_[_0xe4c4('0x35')](_0x60f0fd,'id');var _0x4df5c1=[];var _0x54abc3=[];var _0x1545e2=squel[_0xe4c4('0x76')]();_0x1545e2[_0xe4c4('0x77')](_0xe4c4('0x78'))[_0xe4c4('0x79')]('team_has_fax_queues','tq')[_0xe4c4('0x7a')]('user_has_teams','ut',_0xe4c4('0x7b'))[_0xe4c4('0x44')](_0xe4c4('0x7c'),_0x157c61['params']['id']);for(var _0x562aeb=0x0;_0x562aeb<_0x60f0fd['length'];_0x562aeb+=0x1){let _0xbac7c=_0x60f0fd[_0x562aeb];for(var _0x22147f=0x0;_0x22147f<_0xbac7c[_0xe4c4('0x6e')][_0xe4c4('0x5e')];_0x22147f+=0x1){let _0x551d45=_0xbac7c[_0xe4c4('0x6e')][_0x22147f];var _0xd024e8=_0x1545e2[_0xe4c4('0x7d')]();_0xd024e8[_0xe4c4('0x44')]('ut.UserId\x20=\x20?',_0x551d45['id']);_0x54abc3[_0xe4c4('0x7e')](db[_0xe4c4('0x71')]['query'](_0xd024e8['toString'](),{'type':db['sequelize'][_0xe4c4('0x7f')][_0xe4c4('0x80')]})[_0xe4c4('0x2b')](function(_0x339703){if(_0x339703[_0xe4c4('0x5e')]===0x1){return _0x551d45['id'];}else{var _0x24555b=_[_0xe4c4('0x81')](_[_0xe4c4('0x35')](_0x339703,_0xe4c4('0x82')),function(_0xcc6a14){return _['includes'](_0x429ba6,_0xcc6a14);});if(_0x24555b){return _0x551d45['id'];}}}));}}return BPromise['all'](_0x54abc3)[_0xe4c4('0x2b')](function(_0x2d159e){_0x4df5c1=_(_0x4df5c1)[_0xe4c4('0x83')](_0x2d159e)['compact']()[_0xe4c4('0x84')]();return db[_0xe4c4('0x36')]['find']({'where':{'id':_0x157c61[_0xe4c4('0x4d')]['id']}})['then'](function(_0x1e8e64){return db['sequelize'][_0xe4c4('0x85')](function(_0xfa8f93){return _0x1e8e64[_0xe4c4('0x86')](_0x157c61[_0xe4c4('0x3c')][_0xe4c4('0x6c')],{'transaction':_0xfa8f93})['then'](function(){if(!_['isEmpty'](_0x4df5c1)){return _0x1e8e64[_0xe4c4('0x87')](_0x4df5c1,{'transaction':_0xfa8f93});}})['then'](function(){_0x4df5c1[_0xe4c4('0x74')](function(_0x8bbdb9){socket[_0xe4c4('0x88')]('userFaxQueue:remove',{'UserId':_0x8bbdb9,'FaxQueueId':_0x1e8e64['id']});});});});});});})[_0xe4c4('0x2b')](respondWithStatusCode(_0x21d8ca,null))['catch'](handleError(_0x21d8ca,null));};exports[_0xe4c4('0x89')]=function(_0x5cc465,_0x551ddd,_0x2fb74b){return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x5cc465['params']['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x551ddd,null))[_0xe4c4('0x2b')](function(_0x123aab){if(_0x123aab){return _0x123aab[_0xe4c4('0x89')](_0x5cc465['body'][_0xe4c4('0x6c')],_[_0xe4c4('0x8a')](_0x5cc465[_0xe4c4('0x4f')],[_0xe4c4('0x6c'),'id'])||{})['spread'](function(_0x51c62f){for(var _0x3b14c8=0x0;_0x3b14c8<_0x5cc465['body'][_0xe4c4('0x6c')][_0xe4c4('0x5e')];_0x3b14c8+=0x1){socket[_0xe4c4('0x88')](_0xe4c4('0x75'),{'UserId':_0x5cc465['body'][_0xe4c4('0x6c')][_0x3b14c8],'FaxQueueId':_0x5cc465[_0xe4c4('0x4d')]['id']});}return _0x51c62f;});}})[_0xe4c4('0x2b')](respondWithResult(_0x551ddd,null))[_0xe4c4('0x4b')](handleError(_0x551ddd,null));};exports['removeAgents']=function(_0xa36f3e,_0x58d2cb,_0x592915){return db['FaxQueue']['find']({'where':{'id':_0xa36f3e[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x58d2cb,null))['then'](function(_0x24c63c){if(_0x24c63c){return _0x24c63c[_0xe4c4('0x87')](_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')])['then'](function(){if(_['isArray'](_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')])){for(var _0xc8168b=0x0;_0xc8168b<_0xa36f3e[_0xe4c4('0x3c')]['ids'][_0xe4c4('0x5e')];_0xc8168b+=0x1){socket[_0xe4c4('0x88')](_0xe4c4('0x8b'),{'UserId':Number(_0xa36f3e['query'][_0xe4c4('0x6c')][_0xc8168b]),'FaxQueueId':Number(_0xa36f3e[_0xe4c4('0x4d')]['id'])});}}else{socket[_0xe4c4('0x88')](_0xe4c4('0x8b'),{'UserId':Number(_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')]),'FaxQueueId':Number(_0xa36f3e[_0xe4c4('0x4d')]['id'])});}});}})[_0xe4c4('0x2b')](respondWithStatusCode(_0x58d2cb,null))['catch'](handleError(_0x58d2cb,null));};exports[_0xe4c4('0x8c')]=function(_0x32153f,_0x38a27a,_0x57a800){var _0x40178a={};var _0x2006e1={};var _0x56ddaf;var _0x27add4;return db['FaxQueue']['findOne']({'where':{'id':_0x32153f[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x38a27a,null))[_0xe4c4('0x2b')](function(_0x573e32){if(_0x573e32){_0x56ddaf=_0x573e32;_0x2006e1[_0xe4c4('0x3a')]=_['keys'](db[_0xe4c4('0x62')][_0xe4c4('0x37')]);_0x2006e1[_0xe4c4('0x3c')]=_[_0xe4c4('0x3b')](_0x32153f[_0xe4c4('0x3c')]);_0x2006e1[_0xe4c4('0x3d')]=_['intersection'](_0x2006e1[_0xe4c4('0x3a')],_0x2006e1[_0xe4c4('0x3c')]);_0x40178a[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x2006e1[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x32153f['query'][_0xe4c4('0x40')]));_0x40178a[_0xe4c4('0x3e')]=_0x40178a['attributes'][_0xe4c4('0x5e')]?_0x40178a[_0xe4c4('0x3e')]:_0x2006e1['model'];_0x40178a[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x32153f['query'][_0xe4c4('0x43')]);_0x40178a[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_[_0xe4c4('0x45')](_0x32153f['query'],_0x2006e1[_0xe4c4('0x3d')]));if(_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x40178a[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x40178a[_0xe4c4('0x44')],{'$or':_[_0xe4c4('0x35')](_0x40178a[_0xe4c4('0x3e')],function(_0x69d886){var _0x5ba93d={};_0x5ba93d[_0x69d886]={'$like':'%'+_0x32153f['query']['filter']+'%'};return _0x5ba93d;})});}_0x40178a=_[_0xe4c4('0x30')]({},_0x40178a,_0x32153f[_0xe4c4('0x47')]);return _0x56ddaf[_0xe4c4('0x8c')](_0x40178a);}})['then'](function(_0x33e8a7){if(_0x33e8a7){_0x27add4=_0x33e8a7[_0xe4c4('0x5e')];if(!_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x40178a[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x25')]);_0x40178a['offset']=qs[_0xe4c4('0x22')](_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}return _0x56ddaf[_0xe4c4('0x8c')](_0x40178a);}})[_0xe4c4('0x2b')](function(_0x249246){if(_0x249246){return _0x249246?{'count':_0x27add4,'rows':_0x249246}:null;}})[_0xe4c4('0x2b')](respondWithResult(_0x38a27a,null))[_0xe4c4('0x4b')](handleError(_0x38a27a,null));}; \ No newline at end of file +var _0x4c4e=['UserProfileSection','find','userProfileId','autoAssociation','error','update','describe','getMembers','findOne','length','nolimit','FaxQueueId','UserFaxQueue','User','UserId','faxPause','format','%s/%s','createdAt','updatedAt','Team','getTeams','addTeams','ids','findAll','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','union','value','transaction','removeTeams','removeAgents','emit','addAgents','omit','userFaxQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','UserProfileResource','name','send','render','merge','contact','message','agent','account','map','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4c4e,0x152));var _0xe4c4=function(_0x3a592a,_0x68332){_0x3a592a=_0x3a592a-0x0;var _0x196371=_0x4c4e[_0x3a592a];return _0x196371;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];config['redis']=_[_0xe4c4('0x1a')](config[_0xe4c4('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4c4('0x1c'))(new Redis(config[_0xe4c4('0x1b')]));require('./faxQueue.socket')[_0xe4c4('0x1d')](socket);function respondWithStatusCode(_0x29766a,_0x5e263c){_0x5e263c=_0x5e263c||0xcc;return function(_0x307aa8){if(_0x307aa8){return _0x29766a[_0xe4c4('0x1e')](_0x5e263c);}return _0x29766a[_0xe4c4('0x1f')](_0x5e263c)[_0xe4c4('0x20')]();};}function respondWithResult(_0x19e59b,_0x882be2){_0x882be2=_0x882be2||0xc8;return function(_0x1f637e){if(_0x1f637e){return _0x19e59b[_0xe4c4('0x1f')](_0x882be2)[_0xe4c4('0x21')](_0x1f637e);}};}function respondWithFilteredResult(_0x36b10c,_0x23b7e6){return function(_0x42242c){if(_0x42242c){var _0x3820c7=typeof _0x23b7e6[_0xe4c4('0x22')]===_0xe4c4('0x23')&&typeof _0x23b7e6['limit']===_0xe4c4('0x23');var _0x24f946=_0x42242c[_0xe4c4('0x24')];var _0x317cc8=_0x3820c7?0x0:_0x23b7e6['offset'];var _0x3d5856=_0x3820c7?_0x42242c[_0xe4c4('0x24')]:_0x23b7e6[_0xe4c4('0x22')]+_0x23b7e6[_0xe4c4('0x25')];var _0x2c5aea;if(_0x3d5856>=_0x24f946){_0x3d5856=_0x24f946;_0x2c5aea=0xc8;}else{_0x2c5aea=0xce;}_0x36b10c[_0xe4c4('0x1f')](_0x2c5aea);return _0x36b10c[_0xe4c4('0x26')](_0xe4c4('0x27'),_0x317cc8+'-'+_0x3d5856+'/'+_0x24f946)[_0xe4c4('0x21')](_0x42242c);}return null;};}function patchUpdates(_0x1a7690){return function(_0x210ee1){try{jsonpatch[_0xe4c4('0x28')](_0x210ee1,_0x1a7690,!![]);}catch(_0x138ead){return BPromise[_0xe4c4('0x29')](_0x138ead);}return _0x210ee1[_0xe4c4('0x2a')]();};}function saveUpdates(_0x59498e,_0x49cadc){return function(_0x403a2c){if(_0x403a2c){return _0x403a2c['update'](_0x59498e)[_0xe4c4('0x2b')](function(_0x5374fd){return _0x5374fd;});}return null;};}function removeEntity(_0x3adfcb,_0x5efc4c){return function(_0x34d667){if(_0x34d667){return _0x34d667['destroy']()[_0xe4c4('0x2b')](function(){var _0x4a0199=_0x34d667['get']({'plain':!![]});var _0x4cea1f='FaxQueues';return db[_0xe4c4('0x2c')]['destroy']({'where':{'type':_0x4cea1f,'resourceId':_0x4a0199['id']}})['then'](function(){return _0x34d667;});})[_0xe4c4('0x2b')](function(){_0x3adfcb[_0xe4c4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57ba43,_0x7428ad){return function(_0x33de43){if(!_0x33de43){_0x57ba43['sendStatus'](0x194);}return _0x33de43;};}function handleError(_0x158432,_0x2d0e2){_0x2d0e2=_0x2d0e2||0x1f4;return function(_0x3f60fc){logger['error'](_0x3f60fc['stack']);if(_0x3f60fc[_0xe4c4('0x2d')]){delete _0x3f60fc[_0xe4c4('0x2d')];}_0x158432[_0xe4c4('0x1f')](_0x2d0e2)[_0xe4c4('0x2e')](_0x3f60fc);};}function getMustacheRender(_0x5391f6,_0x49c913){return Mustache[_0xe4c4('0x2f')](_0x5391f6,_[_0xe4c4('0x30')](_0x49c913['body'],{'contact':_0x49c913[_0xe4c4('0x31')],'message':_0x49c913[_0xe4c4('0x32')],'agent':_0x49c913[_0xe4c4('0x33')],'interaction':_0x49c913['interaction'],'account':_0x49c913[_0xe4c4('0x34')]}))||'';}exports['index']=function(_0x45fc76,_0x4239ba){var _0x3bb6cf={},_0x35717a={},_0x2bd5c1={'count':0x0,'rows':[]};var _0x43c1ec=_[_0xe4c4('0x35')](db[_0xe4c4('0x36')][_0xe4c4('0x37')],function(_0x18b2a8){return{'name':_0x18b2a8[_0xe4c4('0x38')],'type':_0x18b2a8[_0xe4c4('0x39')]['key']};});_0x35717a[_0xe4c4('0x3a')]=_[_0xe4c4('0x35')](_0x43c1ec,_0xe4c4('0x2d'));_0x35717a['query']=_[_0xe4c4('0x3b')](_0x45fc76[_0xe4c4('0x3c')]);_0x35717a[_0xe4c4('0x3d')]=_['intersection'](_0x35717a[_0xe4c4('0x3a')],_0x35717a[_0xe4c4('0x3c')]);_0x3bb6cf[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x35717a[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x40')]));_0x3bb6cf[_0xe4c4('0x3e')]=_0x3bb6cf[_0xe4c4('0x3e')]['length']?_0x3bb6cf[_0xe4c4('0x3e')]:_0x35717a[_0xe4c4('0x3a')];if(!_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x41')]('nolimit')){_0x3bb6cf[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x45fc76['query'][_0xe4c4('0x25')]);_0x3bb6cf[_0xe4c4('0x22')]=qs['offset'](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}_0x3bb6cf[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x43')]);_0x3bb6cf[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_[_0xe4c4('0x45')](_0x45fc76[_0xe4c4('0x3c')],_0x35717a[_0xe4c4('0x3d')]),_0x43c1ec);if(_0x45fc76[_0xe4c4('0x3c')]['filter']){_0x3bb6cf[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3bb6cf[_0xe4c4('0x44')],{'$or':_[_0xe4c4('0x35')](_0x43c1ec,function(_0x260141){if(_0x260141[_0xe4c4('0x39')]!=='VIRTUAL'){var _0x312a49={};_0x312a49[_0x260141['name']]={'$like':'%'+_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x46')]+'%'};return _0x312a49;}})});}_0x3bb6cf=_[_0xe4c4('0x30')]({},_0x3bb6cf,_0x45fc76[_0xe4c4('0x47')]);var _0x48177f={'where':_0x3bb6cf['where']};return db['FaxQueue'][_0xe4c4('0x24')](_0x48177f)[_0xe4c4('0x2b')](function(_0x5aeded){_0x2bd5c1['count']=_0x5aeded;if(_0x45fc76[_0xe4c4('0x3c')][_0xe4c4('0x48')]){_0x3bb6cf[_0xe4c4('0x49')]=[{'all':!![]}];}return db[_0xe4c4('0x36')]['findAll'](_0x3bb6cf);})[_0xe4c4('0x2b')](function(_0xd8e246){_0x2bd5c1[_0xe4c4('0x4a')]=_0xd8e246;return _0x2bd5c1;})[_0xe4c4('0x2b')](respondWithFilteredResult(_0x4239ba,_0x3bb6cf))[_0xe4c4('0x4b')](handleError(_0x4239ba,null));};exports[_0xe4c4('0x4c')]=function(_0x1eda5e,_0x176712){var _0x3ee4db={'raw':!![],'where':{'id':_0x1eda5e[_0xe4c4('0x4d')]['id']}},_0x5c7c4d={};_0x5c7c4d['model']=_[_0xe4c4('0x3b')](db[_0xe4c4('0x36')][_0xe4c4('0x37')]);_0x5c7c4d[_0xe4c4('0x3c')]=_[_0xe4c4('0x3b')](_0x1eda5e[_0xe4c4('0x3c')]);_0x5c7c4d[_0xe4c4('0x3d')]=_[_0xe4c4('0x3f')](_0x5c7c4d[_0xe4c4('0x3a')],_0x5c7c4d[_0xe4c4('0x3c')]);_0x3ee4db[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x5c7c4d[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x1eda5e['query']['fields']));_0x3ee4db[_0xe4c4('0x3e')]=_0x3ee4db[_0xe4c4('0x3e')]['length']?_0x3ee4db[_0xe4c4('0x3e')]:_0x5c7c4d[_0xe4c4('0x3a')];if(_0x1eda5e[_0xe4c4('0x3c')][_0xe4c4('0x48')]){_0x3ee4db[_0xe4c4('0x49')]=[{'all':!![]}];}_0x3ee4db=_['merge']({},_0x3ee4db,_0x1eda5e[_0xe4c4('0x47')]);return db[_0xe4c4('0x36')]['find'](_0x3ee4db)[_0xe4c4('0x2b')](handleEntityNotFound(_0x176712,null))[_0xe4c4('0x2b')](respondWithResult(_0x176712,null))['catch'](handleError(_0x176712,null));};exports[_0xe4c4('0x4e')]=function(_0x53699d,_0xa66376){return db[_0xe4c4('0x36')][_0xe4c4('0x4e')](_0x53699d[_0xe4c4('0x4f')],{})[_0xe4c4('0x2b')](function(_0x525534){var _0x1c8b2e=_0x53699d[_0xe4c4('0x50')][_0xe4c4('0x51')]({'plain':!![]});if(!_0x1c8b2e)throw new Error(_0xe4c4('0x52'));if(_0x1c8b2e[_0xe4c4('0x53')]===_0xe4c4('0x50')){var _0x3ddcbe=_0x525534[_0xe4c4('0x51')]({'plain':!![]});var _0x1a96ba=_0xe4c4('0x54');return db[_0xe4c4('0x55')][_0xe4c4('0x56')]({'where':{'name':_0x1a96ba,'userProfileId':_0x1c8b2e[_0xe4c4('0x57')]},'raw':!![]})[_0xe4c4('0x2b')](function(_0x466882){if(_0x466882&&_0x466882[_0xe4c4('0x58')]===0x0){return db['UserProfileResource'][_0xe4c4('0x4e')]({'name':_0x3ddcbe[_0xe4c4('0x2d')],'resourceId':_0x3ddcbe['id'],'type':_0x466882[_0xe4c4('0x2d')],'sectionId':_0x466882['id']},{})['then'](function(){return _0x525534;});}else{return _0x525534;}})[_0xe4c4('0x4b')](function(_0xb7e4da){logger[_0xe4c4('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7e4da);throw _0xb7e4da;});}return _0x525534;})[_0xe4c4('0x2b')](respondWithResult(_0xa66376,0xc9))['catch'](handleError(_0xa66376,null));};exports[_0xe4c4('0x5a')]=function(_0xfbfff6,_0x1cef48){if(_0xfbfff6['body']['id']){delete _0xfbfff6['body']['id'];}return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0xfbfff6[_0xe4c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1cef48,null))[_0xe4c4('0x2b')](saveUpdates(_0xfbfff6['body'],null))['then'](respondWithResult(_0x1cef48,null))['catch'](handleError(_0x1cef48,null));};exports['destroy']=function(_0x1ca931,_0x3a06da){return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x1ca931[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x3a06da,null))['then'](removeEntity(_0x3a06da,null))[_0xe4c4('0x4b')](handleError(_0x3a06da,null));};exports[_0xe4c4('0x5b')]=function(_0x184c5b,_0x125652){return db[_0xe4c4('0x36')][_0xe4c4('0x5b')]()['then'](respondWithResult(_0x125652,null))['catch'](handleError(_0x125652,null));};exports[_0xe4c4('0x5c')]=function(_0x6f374e,_0x1986ab,_0x3c8e44){var _0x3ccf42={'raw':!![],'where':{}},_0x2a575d={},_0x1dfc2d;return db[_0xe4c4('0x36')][_0xe4c4('0x5d')]({'where':{'id':_0x6f374e['params']['id']}})['then'](handleEntityNotFound(_0x1986ab,null))[_0xe4c4('0x2b')](function(_0x56f32e){if(_0x56f32e){_0x1dfc2d=_0x56f32e[_0xe4c4('0x51')]({'plain':!![]});_0x2a575d[_0xe4c4('0x3a')]=_[_0xe4c4('0x3b')](db['UserFaxQueue'][_0xe4c4('0x37')]);_0x2a575d['query']=_[_0xe4c4('0x3b')](_0x6f374e['query']);_0x2a575d['filters']=_[_0xe4c4('0x3f')](_0x2a575d[_0xe4c4('0x3a')],_0x2a575d[_0xe4c4('0x3c')]);_0x3ccf42['attributes']=_['intersection'](_0x2a575d['model'],qs[_0xe4c4('0x40')](_0x6f374e[_0xe4c4('0x3c')]['fields']));_0x3ccf42[_0xe4c4('0x3e')]=_0x3ccf42[_0xe4c4('0x3e')][_0xe4c4('0x5e')]?_0x3ccf42['attributes']:_0x2a575d['model'];if(!_0x6f374e[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x3ccf42[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x6f374e[_0xe4c4('0x3c')]['limit']);_0x3ccf42[_0xe4c4('0x22')]=qs[_0xe4c4('0x22')](_0x6f374e[_0xe4c4('0x3c')]['offset']);}_0x3ccf42[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x6f374e[_0xe4c4('0x3c')]['sort']);_0x3ccf42['where']=qs[_0xe4c4('0x3d')](_['pick'](_0x6f374e['query'],_0x2a575d[_0xe4c4('0x3d')]));_0x3ccf42[_0xe4c4('0x44')][_0xe4c4('0x60')]=_0x56f32e['id'];if(_0x6f374e[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x3ccf42[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3ccf42[_0xe4c4('0x44')],{'$or':_['map'](_0x3ccf42[_0xe4c4('0x3e')],function(_0x475c2b){var _0x4bb16e={};_0x4bb16e[_0x475c2b]={'$like':'%'+_0x6f374e['query'][_0xe4c4('0x46')]+'%'};return _0x4bb16e;})});}_0x3ccf42=_[_0xe4c4('0x30')]({},_0x3ccf42,_0x6f374e[_0xe4c4('0x47')]);return db[_0xe4c4('0x61')]['findAll'](_0x3ccf42);}})[_0xe4c4('0x2b')](function(_0x25e84f){if(_0x25e84f){return db[_0xe4c4('0x62')]['findAndCountAll']({'where':{'id':_['map'](_0x25e84f,_0xe4c4('0x63')),'role':_0xe4c4('0x33')},'attributes':['id',_0xe4c4('0x2d'),_0xe4c4('0x64'),'updatedAt','createdAt']});}})[_0xe4c4('0x2b')](function(_0xe41a6d){if(_0xe41a6d){return{'count':_0xe41a6d[_0xe4c4('0x24')],'rows':_[_0xe4c4('0x35')](_0xe41a6d[_0xe4c4('0x4a')],function(_0x515e24){return{'membername':_0x515e24[_0xe4c4('0x2d')],'UserId':_0x515e24['id'],'queue_name':_0x1dfc2d['name'],'FaxQueueId':_0x1dfc2d['id'],'interface':util[_0xe4c4('0x65')](_0xe4c4('0x66'),'SIP',_0x515e24['name']),'penalty':0x0,'paused':_0x515e24[_0xe4c4('0x64')],'createdAt':_0x515e24[_0xe4c4('0x67')],'updatedAt':_0x515e24[_0xe4c4('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe4c4('0x2b')](respondWithFilteredResult(_0x1986ab,_0x3ccf42))[_0xe4c4('0x4b')](handleError(_0x1986ab,null));};exports['getTeams']=function(_0x4a71e9,_0x4e2b6b,_0x376c8e){var _0x3285f4={};var _0x4c10ef={};var _0x203f11;var _0x11faa3;return db[_0xe4c4('0x36')][_0xe4c4('0x5d')]({'where':{'id':_0x4a71e9['params']['id']}})['then'](handleEntityNotFound(_0x4e2b6b,null))[_0xe4c4('0x2b')](function(_0x32f019){if(_0x32f019){_0x203f11=_0x32f019;_0x4c10ef[_0xe4c4('0x3a')]=_[_0xe4c4('0x3b')](db[_0xe4c4('0x69')][_0xe4c4('0x37')]);_0x4c10ef[_0xe4c4('0x3c')]=_['keys'](_0x4a71e9[_0xe4c4('0x3c')]);_0x4c10ef[_0xe4c4('0x3d')]=_[_0xe4c4('0x3f')](_0x4c10ef[_0xe4c4('0x3a')],_0x4c10ef['query']);_0x3285f4[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x4c10ef[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x4a71e9['query'][_0xe4c4('0x40')]));_0x3285f4[_0xe4c4('0x3e')]=_0x3285f4['attributes']['length']?_0x3285f4[_0xe4c4('0x3e')]:_0x4c10ef[_0xe4c4('0x3a')];_0x3285f4[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x43')]);_0x3285f4[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_['pick'](_0x4a71e9['query'],_0x4c10ef[_0xe4c4('0x3d')]));if(_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x3285f4[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x3285f4['where'],{'$or':_[_0xe4c4('0x35')](_0x3285f4[_0xe4c4('0x3e')],function(_0x425f38){var _0x295e2b={};_0x295e2b[_0x425f38]={'$like':'%'+_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x46')]+'%'};return _0x295e2b;})});}_0x3285f4=_[_0xe4c4('0x30')]({},_0x3285f4,_0x4a71e9[_0xe4c4('0x47')]);return _0x203f11[_0xe4c4('0x6a')](_0x3285f4);}})[_0xe4c4('0x2b')](function(_0x272345){if(_0x272345){_0x11faa3=_0x272345[_0xe4c4('0x5e')];if(!_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x3285f4[_0xe4c4('0x25')]=qs['limit'](_0x4a71e9['query'][_0xe4c4('0x25')]);_0x3285f4['offset']=qs[_0xe4c4('0x22')](_0x4a71e9[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}return _0x203f11[_0xe4c4('0x6a')](_0x3285f4);}})[_0xe4c4('0x2b')](function(_0x2f0664){if(_0x2f0664){return _0x2f0664?{'count':_0x11faa3,'rows':_0x2f0664}:null;}})[_0xe4c4('0x2b')](respondWithResult(_0x4e2b6b,null))[_0xe4c4('0x4b')](handleError(_0x4e2b6b,null));};exports[_0xe4c4('0x6b')]=function(_0x1579fe,_0x37bf48,_0x27a6e1){var _0x3030f6=_0x1579fe['body'][_0xe4c4('0x6c')];return db[_0xe4c4('0x69')][_0xe4c4('0x6d')]({'where':{'id':_0x3030f6},'attributes':['id'],'include':[{'model':db[_0xe4c4('0x62')],'as':_0xe4c4('0x6e'),'attributes':['id','name',_0xe4c4('0x6f'),_0xe4c4('0x70'),'interface'],'raw':!![]}]})[_0xe4c4('0x2b')](function(_0x32d704){if(_0x32d704){var _0x4f597a=_['flatMap'](_0x32d704,function(_0x4e63a5){var _0xaa2136=_0x4e63a5['get']({'plain':!![]});return _0xaa2136[_0xe4c4('0x6e')];});return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x1579fe['params']['id']}})[_0xe4c4('0x2b')](function(_0x37cb8b){return db[_0xe4c4('0x71')]['transaction'](function(_0x52c9a4){return _0x37cb8b['addTeams'](_0x3030f6,{'transaction':_0x52c9a4})[_0xe4c4('0x2b')](function(){return BPromise[_0xe4c4('0x72')](_0x4f597a,function(_0x3c6b54){return db['UserFaxQueue'][_0xe4c4('0x73')]({'where':{'UserId':_0x3c6b54['id'],'FaxQueueId':_0x1579fe[_0xe4c4('0x4d')]['id']},'transaction':_0x52c9a4});});})[_0xe4c4('0x2b')](function(){_0x4f597a[_0xe4c4('0x74')](function(_0x325913){socket['emit'](_0xe4c4('0x75'),{'UserId':_0x325913['id'],'FaxQueueId':_0x37cb8b['id']});});});});});}})[_0xe4c4('0x2b')](respondWithStatusCode(_0x37bf48,null))[_0xe4c4('0x4b')](handleError(_0x37bf48,null));};exports['removeTeams']=function(_0x157c61,_0x21d8ca,_0x144e09){return db['Team'][_0xe4c4('0x6d')]({'where':{'id':_0x157c61[_0xe4c4('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe4c4('0x62')],'as':_0xe4c4('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xe4c4('0x2b')](handleEntityNotFound(_0x21d8ca,null))[_0xe4c4('0x2b')](function(_0x60f0fd){var _0x429ba6=_[_0xe4c4('0x35')](_0x60f0fd,'id');var _0x4df5c1=[];var _0x54abc3=[];var _0x1545e2=squel[_0xe4c4('0x76')]();_0x1545e2[_0xe4c4('0x77')](_0xe4c4('0x78'))[_0xe4c4('0x79')]('team_has_fax_queues','tq')[_0xe4c4('0x7a')]('user_has_teams','ut',_0xe4c4('0x7b'))[_0xe4c4('0x44')](_0xe4c4('0x7c'),_0x157c61['params']['id']);for(var _0x562aeb=0x0;_0x562aeb<_0x60f0fd['length'];_0x562aeb+=0x1){let _0xbac7c=_0x60f0fd[_0x562aeb];for(var _0x22147f=0x0;_0x22147f<_0xbac7c[_0xe4c4('0x6e')][_0xe4c4('0x5e')];_0x22147f+=0x1){let _0x551d45=_0xbac7c[_0xe4c4('0x6e')][_0x22147f];var _0xd024e8=_0x1545e2[_0xe4c4('0x7d')]();_0xd024e8[_0xe4c4('0x44')]('ut.UserId\x20=\x20?',_0x551d45['id']);_0x54abc3[_0xe4c4('0x7e')](db[_0xe4c4('0x71')]['query'](_0xd024e8['toString'](),{'type':db['sequelize'][_0xe4c4('0x7f')][_0xe4c4('0x80')]})[_0xe4c4('0x2b')](function(_0x339703){if(_0x339703[_0xe4c4('0x5e')]===0x1){return _0x551d45['id'];}else{var _0x24555b=_[_0xe4c4('0x81')](_[_0xe4c4('0x35')](_0x339703,_0xe4c4('0x82')),function(_0xcc6a14){return _['includes'](_0x429ba6,_0xcc6a14);});if(_0x24555b){return _0x551d45['id'];}}}));}}return BPromise['all'](_0x54abc3)[_0xe4c4('0x2b')](function(_0x2d159e){_0x4df5c1=_(_0x4df5c1)[_0xe4c4('0x83')](_0x2d159e)['compact']()[_0xe4c4('0x84')]();return db[_0xe4c4('0x36')]['find']({'where':{'id':_0x157c61[_0xe4c4('0x4d')]['id']}})['then'](function(_0x1e8e64){return db['sequelize'][_0xe4c4('0x85')](function(_0xfa8f93){return _0x1e8e64[_0xe4c4('0x86')](_0x157c61[_0xe4c4('0x3c')][_0xe4c4('0x6c')],{'transaction':_0xfa8f93})['then'](function(){if(!_['isEmpty'](_0x4df5c1)){return _0x1e8e64[_0xe4c4('0x87')](_0x4df5c1,{'transaction':_0xfa8f93});}})['then'](function(){_0x4df5c1[_0xe4c4('0x74')](function(_0x8bbdb9){socket[_0xe4c4('0x88')]('userFaxQueue:remove',{'UserId':_0x8bbdb9,'FaxQueueId':_0x1e8e64['id']});});});});});});})[_0xe4c4('0x2b')](respondWithStatusCode(_0x21d8ca,null))['catch'](handleError(_0x21d8ca,null));};exports[_0xe4c4('0x89')]=function(_0x5cc465,_0x551ddd,_0x2fb74b){return db[_0xe4c4('0x36')][_0xe4c4('0x56')]({'where':{'id':_0x5cc465['params']['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x551ddd,null))[_0xe4c4('0x2b')](function(_0x123aab){if(_0x123aab){return _0x123aab[_0xe4c4('0x89')](_0x5cc465['body'][_0xe4c4('0x6c')],_[_0xe4c4('0x8a')](_0x5cc465[_0xe4c4('0x4f')],[_0xe4c4('0x6c'),'id'])||{})['spread'](function(_0x51c62f){for(var _0x3b14c8=0x0;_0x3b14c8<_0x5cc465['body'][_0xe4c4('0x6c')][_0xe4c4('0x5e')];_0x3b14c8+=0x1){socket[_0xe4c4('0x88')](_0xe4c4('0x75'),{'UserId':_0x5cc465['body'][_0xe4c4('0x6c')][_0x3b14c8],'FaxQueueId':_0x5cc465[_0xe4c4('0x4d')]['id']});}return _0x51c62f;});}})[_0xe4c4('0x2b')](respondWithResult(_0x551ddd,null))[_0xe4c4('0x4b')](handleError(_0x551ddd,null));};exports['removeAgents']=function(_0xa36f3e,_0x58d2cb,_0x592915){return db['FaxQueue']['find']({'where':{'id':_0xa36f3e[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x58d2cb,null))['then'](function(_0x24c63c){if(_0x24c63c){return _0x24c63c[_0xe4c4('0x87')](_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')])['then'](function(){if(_['isArray'](_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')])){for(var _0xc8168b=0x0;_0xc8168b<_0xa36f3e[_0xe4c4('0x3c')]['ids'][_0xe4c4('0x5e')];_0xc8168b+=0x1){socket[_0xe4c4('0x88')](_0xe4c4('0x8b'),{'UserId':Number(_0xa36f3e['query'][_0xe4c4('0x6c')][_0xc8168b]),'FaxQueueId':Number(_0xa36f3e[_0xe4c4('0x4d')]['id'])});}}else{socket[_0xe4c4('0x88')](_0xe4c4('0x8b'),{'UserId':Number(_0xa36f3e[_0xe4c4('0x3c')][_0xe4c4('0x6c')]),'FaxQueueId':Number(_0xa36f3e[_0xe4c4('0x4d')]['id'])});}});}})[_0xe4c4('0x2b')](respondWithStatusCode(_0x58d2cb,null))['catch'](handleError(_0x58d2cb,null));};exports[_0xe4c4('0x8c')]=function(_0x32153f,_0x38a27a,_0x57a800){var _0x40178a={};var _0x2006e1={};var _0x56ddaf;var _0x27add4;return db['FaxQueue']['findOne']({'where':{'id':_0x32153f[_0xe4c4('0x4d')]['id']}})[_0xe4c4('0x2b')](handleEntityNotFound(_0x38a27a,null))[_0xe4c4('0x2b')](function(_0x573e32){if(_0x573e32){_0x56ddaf=_0x573e32;_0x2006e1[_0xe4c4('0x3a')]=_['keys'](db[_0xe4c4('0x62')][_0xe4c4('0x37')]);_0x2006e1[_0xe4c4('0x3c')]=_[_0xe4c4('0x3b')](_0x32153f[_0xe4c4('0x3c')]);_0x2006e1[_0xe4c4('0x3d')]=_['intersection'](_0x2006e1[_0xe4c4('0x3a')],_0x2006e1[_0xe4c4('0x3c')]);_0x40178a[_0xe4c4('0x3e')]=_[_0xe4c4('0x3f')](_0x2006e1[_0xe4c4('0x3a')],qs[_0xe4c4('0x40')](_0x32153f['query'][_0xe4c4('0x40')]));_0x40178a[_0xe4c4('0x3e')]=_0x40178a['attributes'][_0xe4c4('0x5e')]?_0x40178a[_0xe4c4('0x3e')]:_0x2006e1['model'];_0x40178a[_0xe4c4('0x42')]=qs[_0xe4c4('0x43')](_0x32153f['query'][_0xe4c4('0x43')]);_0x40178a[_0xe4c4('0x44')]=qs[_0xe4c4('0x3d')](_[_0xe4c4('0x45')](_0x32153f['query'],_0x2006e1[_0xe4c4('0x3d')]));if(_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x46')]){_0x40178a[_0xe4c4('0x44')]=_[_0xe4c4('0x30')](_0x40178a[_0xe4c4('0x44')],{'$or':_[_0xe4c4('0x35')](_0x40178a[_0xe4c4('0x3e')],function(_0x69d886){var _0x5ba93d={};_0x5ba93d[_0x69d886]={'$like':'%'+_0x32153f['query']['filter']+'%'};return _0x5ba93d;})});}_0x40178a=_[_0xe4c4('0x30')]({},_0x40178a,_0x32153f[_0xe4c4('0x47')]);return _0x56ddaf[_0xe4c4('0x8c')](_0x40178a);}})['then'](function(_0x33e8a7){if(_0x33e8a7){_0x27add4=_0x33e8a7[_0xe4c4('0x5e')];if(!_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x41')](_0xe4c4('0x5f'))){_0x40178a[_0xe4c4('0x25')]=qs[_0xe4c4('0x25')](_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x25')]);_0x40178a['offset']=qs[_0xe4c4('0x22')](_0x32153f[_0xe4c4('0x3c')][_0xe4c4('0x22')]);}return _0x56ddaf[_0xe4c4('0x8c')](_0x40178a);}})[_0xe4c4('0x2b')](function(_0x249246){if(_0x249246){return _0x249246?{'count':_0x27add4,'rows':_0x249246}:null;}})[_0xe4c4('0x2b')](respondWithResult(_0x38a27a,null))[_0xe4c4('0x4b')](handleError(_0x38a27a,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8d2e8ab..79ce104 100644 --- a/server/api/faxQueue/faxQueue.events.js +++ b/server/api/faxQueue/faxQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdc7=['emit','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x498d4f,_0x6e928e){var _0x1c81a8=function(_0x11dd33){while(--_0x11dd33){_0x498d4f['push'](_0x498d4f['shift']());}};_0x1c81a8(++_0x6e928e);}(_0xbdc7,0x197));var _0x7bdc=function(_0x439030,_0x2a3193){_0x439030=_0x439030-0x0;var _0x20511a=_0xbdc7[_0x439030];return _0x20511a;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x7bdc('0x0'))['db'][_0x7bdc('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7bdc('0x2')](0x0);var events={'afterCreate':_0x7bdc('0x3'),'afterUpdate':_0x7bdc('0x4'),'afterDestroy':_0x7bdc('0x5')};function emitEvent(_0x7466be){return function(_0x4cbe6a,_0x521d0f,_0x414355){FaxQueueEvents[_0x7bdc('0x6')](_0x7466be+':'+_0x4cbe6a['id'],_0x4cbe6a);FaxQueueEvents[_0x7bdc('0x6')](_0x7466be,_0x4cbe6a);_0x414355(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xb3b1=['remove','emit','hasOwnProperty','hook','events','FaxQueue','setMaxListeners','update'];(function(_0x4b4451,_0x52ec75){var _0x366392=function(_0x597974){while(--_0x597974){_0x4b4451['push'](_0x4b4451['shift']());}};_0x366392(++_0x52ec75);}(_0xb3b1,0xbc));var _0x1b3b=function(_0x173e51,_0x4ef02d){_0x173e51=_0x173e51-0x0;var _0x4f06d7=_0xb3b1[_0x173e51];return _0x4f06d7;};'use strict';var EventEmitter=require(_0x1b3b('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x1b3b('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1b3b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b3b('0x3'),'afterDestroy':_0x1b3b('0x4')};function emitEvent(_0x505e13){return function(_0x1e1f05,_0x3cd648,_0x176895){FaxQueueEvents[_0x1b3b('0x5')](_0x505e13+':'+_0x1e1f05['id'],_0x1e1f05);FaxQueueEvents[_0x1b3b('0x5')](_0x505e13,_0x1e1f05);_0x176895(null);};}for(var e in events){if(events[_0x1b3b('0x6')](e)){var event=events[e];FaxQueue[_0x1b3b('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 8da5ca7..b30fa8a 100644 --- a/server/api/faxQueue/faxQueue.model.js +++ b/server/api/faxQueue/faxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda56=['exports','define','FaxQueue','fax_queues','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1c352e,_0x2bc428){var _0x5a57f6=function(_0x279bca){while(--_0x279bca){_0x1c352e['push'](_0x1c352e['shift']());}};_0x5a57f6(++_0x2bc428);}(_0xda56,0xf4));var _0x6da5=function(_0x5659f4,_0x3a072a){_0x5659f4=_0x5659f4-0x0;var _0x18e9a5=_0xda56[_0x5659f4];return _0x18e9a5;};'use strict';var _=require('lodash');var util=require(_0x6da5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6da5('0x1'));var rp=require(_0x6da5('0x2'));var fs=require('fs');var path=require(_0x6da5('0x3'));var rimraf=require(_0x6da5('0x4'));var config=require(_0x6da5('0x5'));var attributes=require('./faxQueue.attributes');module[_0x6da5('0x6')]=function(_0x41e7b3,_0x224103){return _0x41e7b3[_0x6da5('0x7')](_0x6da5('0x8'),attributes,{'tableName':_0x6da5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa555=['../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3c875c,_0x470923){var _0x440902=function(_0x43bf50){while(--_0x43bf50){_0x3c875c['push'](_0x3c875c['shift']());}};_0x440902(++_0x470923);}(_0xa555,0x19c));var _0x5a55=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0xa555[_0x3a60b8];return _0x4eb583;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a55('0x0'))(_0x5a55('0x1'));var moment=require('moment');var BPromise=require(_0x5a55('0x2'));var rp=require(_0x5a55('0x3'));var fs=require('fs');var path=require(_0x5a55('0x4'));var rimraf=require(_0x5a55('0x5'));var config=require(_0x5a55('0x6'));var attributes=require(_0x5a55('0x7'));module[_0x5a55('0x8')]=function(_0x24f78a,_0x271347){return _0x24f78a['define'](_0x5a55('0x9'),attributes,{'tableName':_0x5a55('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 93edb8d..5c1df90 100644 --- a/server/api/faxQueue/faxQueue.rpc.js +++ b/server/api/faxQueue/faxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8b7=['defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxQueue','findAll','options','raw','where','attributes','map','include','model','GetFaxQueue','ShowFaxQueue','find','then','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0xf3fb4e,_0x1f8665){var _0x561bdb=function(_0x2a538c){while(--_0x2a538c){_0xf3fb4e['push'](_0xf3fb4e['shift']());}};_0x561bdb(++_0x1f8665);}(_0xc8b7,0x186));var _0x7c8b=function(_0x42652b,_0x46573a){_0x42652b=_0x42652b-0x0;var _0xa299f9=_0xc8b7[_0x42652b];return _0xa299f9;};'use strict';var _=require(_0x7c8b('0x0'));var util=require(_0x7c8b('0x1'));var moment=require(_0x7c8b('0x2'));var BPromise=require(_0x7c8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c8b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c8b('0x5'))(_0x7c8b('0x6'));var config=require(_0x7c8b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c8b('0x8')]({'port':0x232a});config[_0x7c8b('0x9')]=_[_0x7c8b('0xa')](config[_0x7c8b('0x9')],{'host':_0x7c8b('0xb'),'port':0x18eb});var socket=require(_0x7c8b('0xc'))(new Redis(config[_0x7c8b('0x9')]));require(_0x7c8b('0xd'))[_0x7c8b('0xe')](socket);function respondWithRpcPromise(_0x4093a7,_0x2d24ab,_0x279b77){return new BPromise(function(_0x42b47c,_0x46519a){return client[_0x7c8b('0xf')](_0x4093a7,_0x279b77)['then'](function(_0x4ef17f){logger['info'](_0x7c8b('0x10'),_0x2d24ab,_0x7c8b('0x11'));logger[_0x7c8b('0x12')](_0x7c8b('0x13'),_0x2d24ab,_0x7c8b('0x11'),JSON[_0x7c8b('0x14')](_0x4ef17f));if(_0x4ef17f[_0x7c8b('0x15')]){if(_0x4ef17f[_0x7c8b('0x15')][_0x7c8b('0x16')]===0x1f4){logger['error'](_0x7c8b('0x10'),_0x2d24ab,_0x4ef17f[_0x7c8b('0x15')][_0x7c8b('0x17')]);return _0x46519a(_0x4ef17f['error'][_0x7c8b('0x17')]);}logger[_0x7c8b('0x15')](_0x7c8b('0x10'),_0x2d24ab,_0x4ef17f['error'][_0x7c8b('0x17')]);return _0x42b47c(_0x4ef17f[_0x7c8b('0x15')][_0x7c8b('0x17')]);}else{logger[_0x7c8b('0x18')](_0x7c8b('0x10'),_0x2d24ab,_0x7c8b('0x11'));_0x42b47c(_0x4ef17f[_0x7c8b('0x19')][_0x7c8b('0x17')]);}})[_0x7c8b('0x1a')](function(_0x4c03f7){logger[_0x7c8b('0x15')]('FaxQueue,\x20%s,\x20%s',_0x2d24ab,_0x4c03f7);_0x46519a(_0x4c03f7);});});}exports['GetFaxQueue']=function(_0x5b350f){var _0x56f67a=this;return new Promise(function(_0x5d35f3,_0x58c572){return db[_0x7c8b('0x1b')][_0x7c8b('0x1c')]({'raw':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x1f')]||null:null,'attributes':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x20')]||null:null,'limit':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f[_0x7c8b('0x1d')]['limit']||null:null,'include':_0x5b350f[_0x7c8b('0x1d')]?_0x5b350f['options']['include']?_[_0x7c8b('0x21')](_0x5b350f[_0x7c8b('0x1d')][_0x7c8b('0x22')],function(_0x1951b3){return{'model':db[_0x1951b3[_0x7c8b('0x23')]],'as':_0x1951b3['as'],'attributes':_0x1951b3[_0x7c8b('0x20')],'include':_0x1951b3[_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x1951b3[_0x7c8b('0x22')],function(_0x40c166){return{'model':db[_0x40c166['model']],'as':_0x40c166['as'],'attributes':_0x40c166['attributes'],'include':_0x40c166[_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x40c166[_0x7c8b('0x22')],function(_0x19e01){return{'model':db[_0x19e01['model']],'as':_0x19e01['as'],'attributes':_0x19e01[_0x7c8b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35dc21){logger['info'](_0x7c8b('0x24'),_0x5b350f);logger[_0x7c8b('0x12')](_0x7c8b('0x24'),_0x5b350f,JSON['stringify'](_0x35dc21));_0x5d35f3(_0x35dc21);})[_0x7c8b('0x1a')](function(_0x2d0f91){logger[_0x7c8b('0x15')](_0x7c8b('0x24'),_0x2d0f91[_0x7c8b('0x17')],_0x5b350f);_0x58c572(_0x56f67a[_0x7c8b('0x15')](0x1f4,_0x2d0f91[_0x7c8b('0x17')]));});});};exports[_0x7c8b('0x25')]=function(_0x3099bf){var _0x2e316c=this;return new Promise(function(_0x1bb2f2,_0x147ae8){return db[_0x7c8b('0x1b')][_0x7c8b('0x26')]({'raw':_0x3099bf['options']?_0x3099bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x3099bf['options']?_0x3099bf[_0x7c8b('0x1d')]['where']||null:null,'attributes':_0x3099bf['options']?_0x3099bf[_0x7c8b('0x1d')][_0x7c8b('0x20')]||null:null,'include':_0x3099bf[_0x7c8b('0x1d')]?_0x3099bf[_0x7c8b('0x1d')][_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x3099bf[_0x7c8b('0x1d')]['include'],function(_0x12219d){return{'model':db[_0x12219d[_0x7c8b('0x23')]],'as':_0x12219d['as'],'attributes':_0x12219d[_0x7c8b('0x20')],'include':_0x12219d[_0x7c8b('0x22')]?_['map'](_0x12219d[_0x7c8b('0x22')],function(_0x54b889){return{'model':db[_0x54b889[_0x7c8b('0x23')]],'as':_0x54b889['as'],'attributes':_0x54b889[_0x7c8b('0x20')],'include':_0x54b889[_0x7c8b('0x22')]?_[_0x7c8b('0x21')](_0x54b889[_0x7c8b('0x22')],function(_0x265ba4){return{'model':db[_0x265ba4[_0x7c8b('0x23')]],'as':_0x265ba4['as'],'attributes':_0x265ba4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c8b('0x27')](function(_0x352346){logger[_0x7c8b('0x18')]('ShowFaxQueue',_0x3099bf);logger['debug'](_0x7c8b('0x25'),_0x3099bf,JSON[_0x7c8b('0x14')](_0x352346));_0x1bb2f2(_0x352346);})[_0x7c8b('0x1a')](function(_0x31ee58){logger[_0x7c8b('0x15')](_0x7c8b('0x25'),_0x31ee58[_0x7c8b('0x17')],_0x3099bf);_0x147ae8(_0x2e316c[_0x7c8b('0x15')](0x1f4,_0x31ee58[_0x7c8b('0x17')]));});});}; \ No newline at end of file +var _0xc75d=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','attributes','limit','map','include','model','then','catch','ShowFaxQueue','FaxQueue','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3c74cc,_0x57ec4b){var _0x75aa2a=function(_0x1a5c6e){while(--_0x1a5c6e){_0x3c74cc['push'](_0x3c74cc['shift']());}};_0x75aa2a(++_0x57ec4b);}(_0xc75d,0x14e));var _0xdc75=function(_0x5bf773,_0x14da53){_0x5bf773=_0x5bf773-0x0;var _0x2b6a71=_0xc75d[_0x5bf773];return _0x2b6a71;};'use strict';var _=require(_0xdc75('0x0'));var util=require('util');var moment=require(_0xdc75('0x1'));var BPromise=require('bluebird');var rs=require(_0xdc75('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc75('0x3'))['db'];var utils=require(_0xdc75('0x4'));var logger=require('../../config/logger')(_0xdc75('0x5'));var config=require(_0xdc75('0x6'));var jayson=require(_0xdc75('0x7'));var client=jayson[_0xdc75('0x8')][_0xdc75('0x9')]({'port':0x232a});config[_0xdc75('0xa')]=_[_0xdc75('0xb')](config[_0xdc75('0xa')],{'host':_0xdc75('0xc'),'port':0x18eb});var socket=require(_0xdc75('0xd'))(new Redis(config[_0xdc75('0xa')]));require('./faxQueue.socket')[_0xdc75('0xe')](socket);function respondWithRpcPromise(_0x4dab4a,_0x2549c8,_0x357b66){return new BPromise(function(_0x51950d,_0x5d588c){return client[_0xdc75('0xf')](_0x4dab4a,_0x357b66)['then'](function(_0x281b56){logger[_0xdc75('0x10')](_0xdc75('0x11'),_0x2549c8,_0xdc75('0x12'));logger[_0xdc75('0x13')](_0xdc75('0x14'),_0x2549c8,_0xdc75('0x12'),JSON[_0xdc75('0x15')](_0x281b56));if(_0x281b56[_0xdc75('0x16')]){if(_0x281b56['error'][_0xdc75('0x17')]===0x1f4){logger[_0xdc75('0x16')](_0xdc75('0x11'),_0x2549c8,_0x281b56[_0xdc75('0x16')]['message']);return _0x5d588c(_0x281b56['error'][_0xdc75('0x18')]);}logger['error'](_0xdc75('0x11'),_0x2549c8,_0x281b56[_0xdc75('0x16')][_0xdc75('0x18')]);return _0x51950d(_0x281b56['error']['message']);}else{logger[_0xdc75('0x10')](_0xdc75('0x11'),_0x2549c8,_0xdc75('0x12'));_0x51950d(_0x281b56[_0xdc75('0x19')]['message']);}})['catch'](function(_0x4548fa){logger['error']('FaxQueue,\x20%s,\x20%s',_0x2549c8,_0x4548fa);_0x5d588c(_0x4548fa);});});}exports['GetFaxQueue']=function(_0x2210ad){var _0x3d349b=this;return new Promise(function(_0x4513da,_0x47a8a2){return db['FaxQueue'][_0xdc75('0x1a')]({'raw':_0x2210ad['options']?_0x2210ad['options']['raw']===undefined?!![]:![]:!![],'where':_0x2210ad[_0xdc75('0x1b')]?_0x2210ad[_0xdc75('0x1b')]['where']||null:null,'attributes':_0x2210ad[_0xdc75('0x1b')]?_0x2210ad[_0xdc75('0x1b')][_0xdc75('0x1c')]||null:null,'limit':_0x2210ad[_0xdc75('0x1b')]?_0x2210ad[_0xdc75('0x1b')][_0xdc75('0x1d')]||null:null,'include':_0x2210ad['options']?_0x2210ad[_0xdc75('0x1b')]['include']?_[_0xdc75('0x1e')](_0x2210ad[_0xdc75('0x1b')][_0xdc75('0x1f')],function(_0x5a5b09){return{'model':db[_0x5a5b09[_0xdc75('0x20')]],'as':_0x5a5b09['as'],'attributes':_0x5a5b09[_0xdc75('0x1c')],'include':_0x5a5b09[_0xdc75('0x1f')]?_[_0xdc75('0x1e')](_0x5a5b09[_0xdc75('0x1f')],function(_0x7595c7){return{'model':db[_0x7595c7[_0xdc75('0x20')]],'as':_0x7595c7['as'],'attributes':_0x7595c7[_0xdc75('0x1c')],'include':_0x7595c7[_0xdc75('0x1f')]?_[_0xdc75('0x1e')](_0x7595c7['include'],function(_0x3087cb){return{'model':db[_0x3087cb['model']],'as':_0x3087cb['as'],'attributes':_0x3087cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc75('0x21')](function(_0x3d5a9a){logger[_0xdc75('0x10')]('GetFaxQueue',_0x2210ad);logger[_0xdc75('0x13')]('GetFaxQueue',_0x2210ad,JSON['stringify'](_0x3d5a9a));_0x4513da(_0x3d5a9a);})[_0xdc75('0x22')](function(_0x2e0c6b){logger[_0xdc75('0x16')]('GetFaxQueue',_0x2e0c6b['message'],_0x2210ad);_0x47a8a2(_0x3d349b[_0xdc75('0x16')](0x1f4,_0x2e0c6b['message']));});});};exports[_0xdc75('0x23')]=function(_0x165289){var _0x1b773d=this;return new Promise(function(_0xb1858e,_0x337ab8){return db[_0xdc75('0x24')][_0xdc75('0x25')]({'raw':_0x165289['options']?_0x165289[_0xdc75('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x165289['options']?_0x165289[_0xdc75('0x1b')]['where']||null:null,'attributes':_0x165289[_0xdc75('0x1b')]?_0x165289[_0xdc75('0x1b')][_0xdc75('0x1c')]||null:null,'include':_0x165289['options']?_0x165289[_0xdc75('0x1b')][_0xdc75('0x1f')]?_['map'](_0x165289[_0xdc75('0x1b')][_0xdc75('0x1f')],function(_0x289c86){return{'model':db[_0x289c86['model']],'as':_0x289c86['as'],'attributes':_0x289c86[_0xdc75('0x1c')],'include':_0x289c86[_0xdc75('0x1f')]?_['map'](_0x289c86[_0xdc75('0x1f')],function(_0x2cad54){return{'model':db[_0x2cad54[_0xdc75('0x20')]],'as':_0x2cad54['as'],'attributes':_0x2cad54[_0xdc75('0x1c')],'include':_0x2cad54[_0xdc75('0x1f')]?_['map'](_0x2cad54['include'],function(_0x4a9be1){return{'model':db[_0x4a9be1[_0xdc75('0x20')]],'as':_0x4a9be1['as'],'attributes':_0x4a9be1[_0xdc75('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdc75('0x21')](function(_0x3f5890){logger[_0xdc75('0x10')](_0xdc75('0x23'),_0x165289);logger[_0xdc75('0x13')](_0xdc75('0x23'),_0x165289,JSON[_0xdc75('0x15')](_0x3f5890));_0xb1858e(_0x3f5890);})['catch'](function(_0x14665d){logger[_0xdc75('0x16')](_0xdc75('0x23'),_0x14665d[_0xdc75('0x18')],_0x165289);_0x337ab8(_0x1b773d[_0xdc75('0x16')](0x1f4,_0x14665d[_0xdc75('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c324482..915d0f9 100644 --- a/server/api/faxQueue/faxQueue.socket.js +++ b/server/api/faxQueue/faxQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5444=['remove','update','removeListener','register','length','faxQueue:','save'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x5444,0x164));var _0x4544=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5444[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x4544('0x0'),_0x4544('0x1'),_0x4544('0x2')];function createListener(_0x147b07,_0x31bb4b){return function(_0x2fd86b){_0x31bb4b['emit'](_0x147b07,_0x2fd86b);};}function removeListener(_0x44ef1f,_0x211883){return function(){FaxQueueEvents[_0x4544('0x3')](_0x44ef1f,_0x211883);};}exports[_0x4544('0x4')]=function(_0x127b85){for(var _0x33d467=0x0,_0x330f8f=events[_0x4544('0x5')];_0x33d467<_0x330f8f;_0x33d467++){var _0xec02e8=events[_0x33d467];var _0x247c3a=createListener(_0x4544('0x6')+_0xec02e8,_0x127b85);FaxQueueEvents['on'](_0xec02e8,_0x247c3a);}}; \ No newline at end of file +var _0x4740=['register','length','faxQueue:','./faxQueue.events','save','remove','update','removeListener'];(function(_0x1b2e24,_0x4640f9){var _0x4cd396=function(_0x58a82a){while(--_0x58a82a){_0x1b2e24['push'](_0x1b2e24['shift']());}};_0x4cd396(++_0x4640f9);}(_0x4740,0xb3));var _0x0474=function(_0x15c25f,_0x583d8b){_0x15c25f=_0x15c25f-0x0;var _0x33e9f5=_0x4740[_0x15c25f];return _0x33e9f5;};'use strict';var FaxQueueEvents=require(_0x0474('0x0'));var events=[_0x0474('0x1'),_0x0474('0x2'),_0x0474('0x3')];function createListener(_0x1b4696,_0xaf477f){return function(_0xb5401b){_0xaf477f['emit'](_0x1b4696,_0xb5401b);};}function removeListener(_0x24ca02,_0x4dd8a1){return function(){FaxQueueEvents[_0x0474('0x4')](_0x24ca02,_0x4dd8a1);};}exports[_0x0474('0x5')]=function(_0x262637){for(var _0x434f3f=0x0,_0x20b887=events[_0x0474('0x6')];_0x434f3f<_0x20b887;_0x434f3f++){var _0x2fd195=events[_0x434f3f];var _0x3377fb=createListener(_0x0474('0x7')+_0x2fd195,_0x262637);FaxQueueEvents['on'](_0x2fd195,_0x3377fb);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d75b436..c57a684 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27af=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x27af,0xbe));var _0xf27a=function(_0x272830,_0x25698e){_0x272830=_0x272830-0x0;var _0x12173c=_0x27af[_0x272830];return _0x12173c;};'use strict';var multer=require(_0xf27a('0x0'));var util=require(_0xf27a('0x1'));var path=require(_0xf27a('0x2'));var timeout=require(_0xf27a('0x3'));var express=require(_0xf27a('0x4'));var router=express[_0xf27a('0x5')]();var fs_extra=require(_0xf27a('0x6'));var auth=require(_0xf27a('0x7'));var interaction=require(_0xf27a('0x8'));var config=require(_0xf27a('0x9'));var controller=require(_0xf27a('0xa'));router[_0xf27a('0xb')]('/',auth[_0xf27a('0xc')](),controller[_0xf27a('0xd')]);router['get'](_0xf27a('0xe'),auth[_0xf27a('0xc')](),controller[_0xf27a('0xf')]);router[_0xf27a('0xb')](_0xf27a('0x10'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x11')]);router[_0xf27a('0xb')]('/:id/members',auth[_0xf27a('0xc')](),controller[_0xf27a('0x12')]);router['get'](_0xf27a('0x13'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x14')]);router[_0xf27a('0xb')](_0xf27a('0x15'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x16')]);router['post']('/',auth[_0xf27a('0xc')](),controller['create']);router[_0xf27a('0x17')](_0xf27a('0x13'),auth[_0xf27a('0xc')](),controller['addTeams']);router[_0xf27a('0x17')](_0xf27a('0x15'),auth['isAuthenticated'](),controller[_0xf27a('0x18')]);router[_0xf27a('0x19')](_0xf27a('0x10'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x1a')]);router['delete'](_0xf27a('0x10'),auth[_0xf27a('0xc')](),controller[_0xf27a('0x1b')]);router[_0xf27a('0x1c')](_0xf27a('0x13'),auth['isAuthenticated'](),controller[_0xf27a('0x1d')]);router[_0xf27a('0x1c')](_0xf27a('0x15'),auth['isAuthenticated'](),controller[_0xf27a('0x1e')]);module[_0xf27a('0x1f')]=router; \ No newline at end of file +var _0x172f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer'];(function(_0x1066e8,_0x359cf8){var _0x354c09=function(_0xdbc53){while(--_0xdbc53){_0x1066e8['push'](_0x1066e8['shift']());}};_0x354c09(++_0x359cf8);}(_0x172f,0x13e));var _0xf172=function(_0x5e9f09,_0x20e03c){_0x5e9f09=_0x5e9f09-0x0;var _0x1143bb=_0x172f[_0x5e9f09];return _0x1143bb;};'use strict';var multer=require(_0xf172('0x0'));var util=require(_0xf172('0x1'));var path=require(_0xf172('0x2'));var timeout=require(_0xf172('0x3'));var express=require(_0xf172('0x4'));var router=express[_0xf172('0x5')]();var fs_extra=require(_0xf172('0x6'));var auth=require(_0xf172('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf172('0x8'));router[_0xf172('0x9')]('/',auth[_0xf172('0xa')](),controller[_0xf172('0xb')]);router['get'](_0xf172('0xc'),auth[_0xf172('0xa')](),controller[_0xf172('0xd')]);router['get'](_0xf172('0xe'),auth[_0xf172('0xa')](),controller[_0xf172('0xf')]);router[_0xf172('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xf172('0x10')]);router[_0xf172('0x9')](_0xf172('0x11'),auth[_0xf172('0xa')](),controller[_0xf172('0x12')]);router[_0xf172('0x9')](_0xf172('0x13'),auth[_0xf172('0xa')](),controller[_0xf172('0x14')]);router[_0xf172('0x15')]('/',auth[_0xf172('0xa')](),controller['create']);router[_0xf172('0x15')](_0xf172('0x11'),auth['isAuthenticated'](),controller[_0xf172('0x16')]);router['post'](_0xf172('0x13'),auth['isAuthenticated'](),controller[_0xf172('0x17')]);router[_0xf172('0x18')]('/:id',auth[_0xf172('0xa')](),controller['update']);router[_0xf172('0x19')](_0xf172('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xf172('0x19')]('/:id/teams',auth[_0xf172('0xa')](),controller[_0xf172('0x1a')]);router[_0xf172('0x19')](_0xf172('0x13'),auth[_0xf172('0xa')](),controller[_0xf172('0x1b')]);module[_0xf172('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 39bc0be..e328db3 100644 --- a/server/api/faxQueueReport/faxQueueReport.attributes.js +++ b/server/api/faxQueueReport/faxQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x938c=['STRING','DATE','moment','sequelize'];(function(_0x269bbf,_0x42dcac){var _0x23caa3=function(_0x21bdb2){while(--_0x21bdb2){_0x269bbf['push'](_0x269bbf['shift']());}};_0x23caa3(++_0x42dcac);}(_0x938c,0xae));var _0xc938=function(_0x5e1c90,_0x3ea0b9){_0x5e1c90=_0x5e1c90-0x0;var _0x520011=_0x938c[_0x5e1c90];return _0x520011;};'use strict';var moment=require(_0xc938('0x0'));var Sequelize=require(_0xc938('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc938('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc938('0x3')]},'acceptAt':{'type':Sequelize[_0xc938('0x3')]},'exitAt':{'type':Sequelize[_0xc938('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda51=['exports','STRING','DATE','moment'];(function(_0xffd8b0,_0x12c51f){var _0x301ba0=function(_0x103c05){while(--_0x103c05){_0xffd8b0['push'](_0xffd8b0['shift']());}};_0x301ba0(++_0x12c51f);}(_0xda51,0x133));var _0x1da5=function(_0x5a037a,_0x44a3fc){_0x5a037a=_0x5a037a-0x0;var _0x28ff57=_0xda51[_0x5a037a];return _0x28ff57;};'use strict';var moment=require(_0x1da5('0x0'));var Sequelize=require('sequelize');module[_0x1da5('0x1')]={'uniqueid':{'type':Sequelize[_0x1da5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1da5('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1da5('0x3')]},'exitAt':{'type':Sequelize[_0x1da5('0x3')]},'reason':{'type':Sequelize[_0x1da5('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2b30be0..da8973a 100644 --- a/server/api/faxQueueReport/faxQueueReport.controller.js +++ b/server/api/faxQueueReport/faxQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5636=['fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','count','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','render','merge','body','message','account','index','map','FaxQueueReport'];(function(_0x25bb5c,_0x398eed){var _0x3db377=function(_0x5b678e){while(--_0x5b678e){_0x25bb5c['push'](_0x25bb5c['shift']());}};_0x3db377(++_0x398eed);}(_0x5636,0x102));var _0x6563=function(_0x96a983,_0x301b99){_0x96a983=_0x96a983-0x0;var _0x596ecc=_0x5636[_0x96a983];return _0x596ecc;};'use strict';var emlformat=require(_0x6563('0x0'));var rimraf=require(_0x6563('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6563('0x2'));var BPromise=require(_0x6563('0x3'));var Mustache=require(_0x6563('0x4'));var util=require('util');var path=require(_0x6563('0x5'));var sox=require(_0x6563('0x6'));var csv=require(_0x6563('0x7'));var ejs=require(_0x6563('0x8'));var fs=require('fs');var fs_extra=require(_0x6563('0x9'));var _=require(_0x6563('0xa'));var squel=require(_0x6563('0xb'));var crypto=require(_0x6563('0xc'));var jsforce=require(_0x6563('0xd'));var deskjs=require(_0x6563('0xe'));var toCsv=require(_0x6563('0x7'));var querystring=require(_0x6563('0xf'));var Papa=require(_0x6563('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6563('0x11'));var as=require(_0x6563('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6563('0x13'));var config=require(_0x6563('0x14'));var licenseUtil=require(_0x6563('0x15'));var db=require(_0x6563('0x16'))['db'];function respondWithStatusCode(_0x33816e,_0x2ed676){_0x2ed676=_0x2ed676||0xcc;return function(_0x31d3fa){if(_0x31d3fa){return _0x33816e[_0x6563('0x17')](_0x2ed676);}return _0x33816e[_0x6563('0x18')](_0x2ed676)['end']();};}function respondWithResult(_0xa0a0b6,_0x5e9329){_0x5e9329=_0x5e9329||0xc8;return function(_0x37131e){if(_0x37131e){return _0xa0a0b6[_0x6563('0x18')](_0x5e9329)[_0x6563('0x19')](_0x37131e);}};}function respondWithFilteredResult(_0x10d08c,_0x5af5d0){return function(_0x26f26e){if(_0x26f26e){var _0x11baa2=typeof _0x5af5d0[_0x6563('0x1a')]===_0x6563('0x1b')&&typeof _0x5af5d0['limit']===_0x6563('0x1b');var _0x589632=_0x26f26e['count'];var _0x47972a=_0x11baa2?0x0:_0x5af5d0[_0x6563('0x1a')];var _0x4f5609=_0x11baa2?_0x26f26e['count']:_0x5af5d0[_0x6563('0x1a')]+_0x5af5d0[_0x6563('0x1c')];var _0x17a29f;if(_0x4f5609>=_0x589632){_0x4f5609=_0x589632;_0x17a29f=0xc8;}else{_0x17a29f=0xce;}_0x10d08c[_0x6563('0x18')](_0x17a29f);return _0x10d08c[_0x6563('0x1d')](_0x6563('0x1e'),_0x47972a+'-'+_0x4f5609+'/'+_0x589632)[_0x6563('0x19')](_0x26f26e);}return null;};}function patchUpdates(_0x93a45){return function(_0x2a70f0){try{jsonpatch['apply'](_0x2a70f0,_0x93a45,!![]);}catch(_0x2f2905){return BPromise[_0x6563('0x1f')](_0x2f2905);}return _0x2a70f0[_0x6563('0x20')]();};}function saveUpdates(_0x5a335c,_0x293db2){return function(_0x5c37bb){if(_0x5c37bb){return _0x5c37bb[_0x6563('0x21')](_0x5a335c)[_0x6563('0x22')](function(_0x5610b0){return _0x5610b0;});}return null;};}function removeEntity(_0x5773e2,_0x3ab7f6){return function(_0x492f45){if(_0x492f45){return _0x492f45[_0x6563('0x23')]()[_0x6563('0x22')](function(){_0x5773e2[_0x6563('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd860d5,_0x51ff06){return function(_0x7ea857){if(!_0x7ea857){_0xd860d5[_0x6563('0x17')](0x194);}return _0x7ea857;};}function handleError(_0x5e5aeb,_0x365b16){_0x365b16=_0x365b16||0x1f4;return function(_0x28252d){logger['error'](_0x28252d[_0x6563('0x24')]);if(_0x28252d['name']){delete _0x28252d[_0x6563('0x25')];}_0x5e5aeb['status'](_0x365b16)['send'](_0x28252d);};}function getMustacheRender(_0x30f05a,_0x118d31){return Mustache[_0x6563('0x26')](_0x30f05a,_[_0x6563('0x27')](_0x118d31[_0x6563('0x28')],{'contact':_0x118d31['contact'],'message':_0x118d31[_0x6563('0x29')],'agent':_0x118d31['agent'],'interaction':_0x118d31['interaction'],'account':_0x118d31[_0x6563('0x2a')]}))||'';}exports[_0x6563('0x2b')]=function(_0x1e2ecb,_0xdbbdda){var _0x116605={},_0x305861={},_0x41f53e={'count':0x0,'rows':[]};var _0x334874=_[_0x6563('0x2c')](db[_0x6563('0x2d')]['rawAttributes'],function(_0x9b3d86){return{'name':_0x9b3d86[_0x6563('0x2e')],'type':_0x9b3d86[_0x6563('0x2f')][_0x6563('0x30')]};});_0x305861[_0x6563('0x31')]=_[_0x6563('0x2c')](_0x334874,_0x6563('0x25'));_0x305861['query']=_[_0x6563('0x32')](_0x1e2ecb[_0x6563('0x33')]);_0x305861[_0x6563('0x34')]=_[_0x6563('0x35')](_0x305861[_0x6563('0x31')],_0x305861[_0x6563('0x33')]);_0x116605['attributes']=_[_0x6563('0x35')](_0x305861[_0x6563('0x31')],qs[_0x6563('0x36')](_0x1e2ecb[_0x6563('0x33')][_0x6563('0x36')]));_0x116605[_0x6563('0x37')]=_0x116605[_0x6563('0x37')]['length']?_0x116605[_0x6563('0x37')]:_0x305861[_0x6563('0x31')];if(!_0x1e2ecb['query'][_0x6563('0x38')](_0x6563('0x39'))){_0x116605['limit']=qs['limit'](_0x1e2ecb[_0x6563('0x33')][_0x6563('0x1c')]);_0x116605[_0x6563('0x1a')]=qs[_0x6563('0x1a')](_0x1e2ecb['query'][_0x6563('0x1a')]);}_0x116605[_0x6563('0x3a')]=qs['sort'](_0x1e2ecb[_0x6563('0x33')][_0x6563('0x3b')]);_0x116605[_0x6563('0x3c')]=qs[_0x6563('0x34')](_[_0x6563('0x3d')](_0x1e2ecb[_0x6563('0x33')],_0x305861[_0x6563('0x34')]),_0x334874);if(_0x1e2ecb[_0x6563('0x33')][_0x6563('0x3e')]){_0x116605['where']=_[_0x6563('0x27')](_0x116605[_0x6563('0x3c')],{'$or':_[_0x6563('0x2c')](_0x334874,function(_0x1c53c4){if(_0x1c53c4['type']!=='VIRTUAL'){var _0x13bbbb={};_0x13bbbb[_0x1c53c4[_0x6563('0x25')]]={'$like':'%'+_0x1e2ecb[_0x6563('0x33')]['filter']+'%'};return _0x13bbbb;}})});}_0x116605=_[_0x6563('0x27')]({},_0x116605,_0x1e2ecb['options']);var _0x36d1aa={'where':_0x116605[_0x6563('0x3c')]};return db['FaxQueueReport'][_0x6563('0x3f')](_0x36d1aa)[_0x6563('0x22')](function(_0xea186){_0x41f53e[_0x6563('0x3f')]=_0xea186;if(_0x1e2ecb[_0x6563('0x33')][_0x6563('0x40')]){_0x116605[_0x6563('0x41')]=[{'all':!![]}];}return db[_0x6563('0x2d')][_0x6563('0x42')](_0x116605);})[_0x6563('0x22')](function(_0x2acb52){_0x41f53e['rows']=_0x2acb52;return _0x41f53e;})['then'](respondWithFilteredResult(_0xdbbdda,_0x116605))[_0x6563('0x43')](handleError(_0xdbbdda,null));};exports[_0x6563('0x44')]=function(_0x43a33e,_0x2f2aa6){var _0x14d134={'raw':!![],'where':{'id':_0x43a33e[_0x6563('0x45')]['id']}},_0x464d45={};_0x464d45['model']=_[_0x6563('0x32')](db[_0x6563('0x2d')][_0x6563('0x46')]);_0x464d45[_0x6563('0x33')]=_['keys'](_0x43a33e[_0x6563('0x33')]);_0x464d45[_0x6563('0x34')]=_[_0x6563('0x35')](_0x464d45[_0x6563('0x31')],_0x464d45[_0x6563('0x33')]);_0x14d134['attributes']=_['intersection'](_0x464d45[_0x6563('0x31')],qs[_0x6563('0x36')](_0x43a33e[_0x6563('0x33')]['fields']));_0x14d134[_0x6563('0x37')]=_0x14d134[_0x6563('0x37')][_0x6563('0x47')]?_0x14d134[_0x6563('0x37')]:_0x464d45['model'];if(_0x43a33e[_0x6563('0x33')][_0x6563('0x40')]){_0x14d134[_0x6563('0x41')]=[{'all':!![]}];}_0x14d134=_['merge']({},_0x14d134,_0x43a33e[_0x6563('0x48')]);return db['FaxQueueReport'][_0x6563('0x49')](_0x14d134)['then'](handleEntityNotFound(_0x2f2aa6,null))['then'](respondWithResult(_0x2f2aa6,null))[_0x6563('0x43')](handleError(_0x2f2aa6,null));};exports[_0x6563('0x4a')]=function(_0x2ebab0,_0xb84325){return db[_0x6563('0x2d')][_0x6563('0x4a')](_0x2ebab0[_0x6563('0x28')],{})[_0x6563('0x22')](respondWithResult(_0xb84325,0xc9))[_0x6563('0x43')](handleError(_0xb84325,null));};exports[_0x6563('0x21')]=function(_0x4951a6,_0x9469fe){if(_0x4951a6['body']['id']){delete _0x4951a6[_0x6563('0x28')]['id'];}return db[_0x6563('0x2d')][_0x6563('0x49')]({'where':{'id':_0x4951a6['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0x9469fe,null))[_0x6563('0x22')](saveUpdates(_0x4951a6['body'],null))[_0x6563('0x22')](respondWithResult(_0x9469fe,null))[_0x6563('0x43')](handleError(_0x9469fe,null));};exports[_0x6563('0x23')]=function(_0x3883f3,_0xbd920a){return db['FaxQueueReport'][_0x6563('0x49')]({'where':{'id':_0x3883f3['params']['id']}})[_0x6563('0x22')](handleEntityNotFound(_0xbd920a,null))['then'](removeEntity(_0xbd920a,null))[_0x6563('0x43')](handleError(_0xbd920a,null));};exports['describe']=function(_0x55e002,_0x5c8274){return db['FaxQueueReport'][_0x6563('0x4b')]()['then'](respondWithResult(_0x5c8274,null))[_0x6563('0x43')](handleError(_0x5c8274,null));}; \ No newline at end of file +var _0x41bb=['then','name','send','render','body','contact','agent','account','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update'];(function(_0x1534bd,_0x24bb44){var _0x2e8d1d=function(_0x2bdb3b){while(--_0x2bdb3b){_0x1534bd['push'](_0x1534bd['shift']());}};_0x2e8d1d(++_0x24bb44);}(_0x41bb,0xc5));var _0xb41b=function(_0x45bec0,_0x573804){_0x45bec0=_0x45bec0-0x0;var _0x2123c4=_0x41bb[_0x45bec0];return _0x2123c4;};'use strict';var emlformat=require(_0xb41b('0x0'));var rimraf=require(_0xb41b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb41b('0x2'));var rp=require('request-promise');var moment=require(_0xb41b('0x3'));var BPromise=require(_0xb41b('0x4'));var Mustache=require(_0xb41b('0x5'));var util=require(_0xb41b('0x6'));var path=require('path');var sox=require(_0xb41b('0x7'));var csv=require(_0xb41b('0x8'));var ejs=require(_0xb41b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x8'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var licenseUtil=require(_0xb41b('0x15'));var db=require(_0xb41b('0x16'))['db'];function respondWithStatusCode(_0x2066d5,_0x5f1ea4){_0x5f1ea4=_0x5f1ea4||0xcc;return function(_0x353ba3){if(_0x353ba3){return _0x2066d5[_0xb41b('0x17')](_0x5f1ea4);}return _0x2066d5[_0xb41b('0x18')](_0x5f1ea4)[_0xb41b('0x19')]();};}function respondWithResult(_0x3be1ec,_0x4e8603){_0x4e8603=_0x4e8603||0xc8;return function(_0x4e7f11){if(_0x4e7f11){return _0x3be1ec['status'](_0x4e8603)[_0xb41b('0x1a')](_0x4e7f11);}};}function respondWithFilteredResult(_0xdc5fb0,_0x143a81){return function(_0x338920){if(_0x338920){var _0x29ea51=typeof _0x143a81['offset']===_0xb41b('0x1b')&&typeof _0x143a81[_0xb41b('0x1c')]===_0xb41b('0x1b');var _0xcf0728=_0x338920[_0xb41b('0x1d')];var _0x47154d=_0x29ea51?0x0:_0x143a81[_0xb41b('0x1e')];var _0x5df8c2=_0x29ea51?_0x338920['count']:_0x143a81['offset']+_0x143a81[_0xb41b('0x1c')];var _0x503e86;if(_0x5df8c2>=_0xcf0728){_0x5df8c2=_0xcf0728;_0x503e86=0xc8;}else{_0x503e86=0xce;}_0xdc5fb0[_0xb41b('0x18')](_0x503e86);return _0xdc5fb0[_0xb41b('0x1f')](_0xb41b('0x20'),_0x47154d+'-'+_0x5df8c2+'/'+_0xcf0728)['json'](_0x338920);}return null;};}function patchUpdates(_0x53bc44){return function(_0x1a1386){try{jsonpatch[_0xb41b('0x21')](_0x1a1386,_0x53bc44,!![]);}catch(_0xd1bc61){return BPromise[_0xb41b('0x22')](_0xd1bc61);}return _0x1a1386[_0xb41b('0x23')]();};}function saveUpdates(_0x42dccb,_0x4c73da){return function(_0x58f149){if(_0x58f149){return _0x58f149[_0xb41b('0x24')](_0x42dccb)[_0xb41b('0x25')](function(_0x871b35){return _0x871b35;});}return null;};}function removeEntity(_0x583741,_0x14e9c8){return function(_0x2441d6){if(_0x2441d6){return _0x2441d6['destroy']()[_0xb41b('0x25')](function(){_0x583741[_0xb41b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed3c7e,_0x4a7992){return function(_0x2d0f27){if(!_0x2d0f27){_0xed3c7e[_0xb41b('0x17')](0x194);}return _0x2d0f27;};}function handleError(_0x53e3a2,_0x3af2c){_0x3af2c=_0x3af2c||0x1f4;return function(_0x4265b8){logger['error'](_0x4265b8['stack']);if(_0x4265b8[_0xb41b('0x26')]){delete _0x4265b8[_0xb41b('0x26')];}_0x53e3a2[_0xb41b('0x18')](_0x3af2c)[_0xb41b('0x27')](_0x4265b8);};}function getMustacheRender(_0x2c7e1f,_0x181cbd){return Mustache[_0xb41b('0x28')](_0x2c7e1f,_['merge'](_0x181cbd[_0xb41b('0x29')],{'contact':_0x181cbd[_0xb41b('0x2a')],'message':_0x181cbd['message'],'agent':_0x181cbd[_0xb41b('0x2b')],'interaction':_0x181cbd['interaction'],'account':_0x181cbd[_0xb41b('0x2c')]}))||'';}exports[_0xb41b('0x2d')]=function(_0x597a35,_0x23a6ed){var _0x4a95e7={},_0x29da9f={},_0x37c142={'count':0x0,'rows':[]};var _0x5aae1d=_[_0xb41b('0x2e')](db[_0xb41b('0x2f')][_0xb41b('0x30')],function(_0x4503cf){return{'name':_0x4503cf[_0xb41b('0x31')],'type':_0x4503cf[_0xb41b('0x32')][_0xb41b('0x33')]};});_0x29da9f[_0xb41b('0x34')]=_[_0xb41b('0x2e')](_0x5aae1d,_0xb41b('0x26'));_0x29da9f['query']=_[_0xb41b('0x35')](_0x597a35['query']);_0x29da9f['filters']=_[_0xb41b('0x36')](_0x29da9f[_0xb41b('0x34')],_0x29da9f[_0xb41b('0x37')]);_0x4a95e7[_0xb41b('0x38')]=_[_0xb41b('0x36')](_0x29da9f[_0xb41b('0x34')],qs[_0xb41b('0x39')](_0x597a35[_0xb41b('0x37')][_0xb41b('0x39')]));_0x4a95e7[_0xb41b('0x38')]=_0x4a95e7[_0xb41b('0x38')]['length']?_0x4a95e7[_0xb41b('0x38')]:_0x29da9f[_0xb41b('0x34')];if(!_0x597a35[_0xb41b('0x37')][_0xb41b('0x3a')](_0xb41b('0x3b'))){_0x4a95e7[_0xb41b('0x1c')]=qs['limit'](_0x597a35['query'][_0xb41b('0x1c')]);_0x4a95e7[_0xb41b('0x1e')]=qs['offset'](_0x597a35[_0xb41b('0x37')][_0xb41b('0x1e')]);}_0x4a95e7[_0xb41b('0x3c')]=qs[_0xb41b('0x3d')](_0x597a35[_0xb41b('0x37')]['sort']);_0x4a95e7[_0xb41b('0x3e')]=qs['filters'](_[_0xb41b('0x3f')](_0x597a35[_0xb41b('0x37')],_0x29da9f[_0xb41b('0x40')]),_0x5aae1d);if(_0x597a35[_0xb41b('0x37')][_0xb41b('0x41')]){_0x4a95e7[_0xb41b('0x3e')]=_[_0xb41b('0x42')](_0x4a95e7[_0xb41b('0x3e')],{'$or':_[_0xb41b('0x2e')](_0x5aae1d,function(_0x578b67){if(_0x578b67['type']!=='VIRTUAL'){var _0x3a4e31={};_0x3a4e31[_0x578b67['name']]={'$like':'%'+_0x597a35['query'][_0xb41b('0x41')]+'%'};return _0x3a4e31;}})});}_0x4a95e7=_['merge']({},_0x4a95e7,_0x597a35[_0xb41b('0x43')]);var _0x17b009={'where':_0x4a95e7[_0xb41b('0x3e')]};return db[_0xb41b('0x2f')][_0xb41b('0x1d')](_0x17b009)[_0xb41b('0x25')](function(_0xddb59c){_0x37c142['count']=_0xddb59c;if(_0x597a35[_0xb41b('0x37')][_0xb41b('0x44')]){_0x4a95e7[_0xb41b('0x45')]=[{'all':!![]}];}return db[_0xb41b('0x2f')]['findAll'](_0x4a95e7);})[_0xb41b('0x25')](function(_0x4be746){_0x37c142[_0xb41b('0x46')]=_0x4be746;return _0x37c142;})[_0xb41b('0x25')](respondWithFilteredResult(_0x23a6ed,_0x4a95e7))[_0xb41b('0x47')](handleError(_0x23a6ed,null));};exports['show']=function(_0x59d172,_0xe71120){var _0x28ea6f={'raw':!![],'where':{'id':_0x59d172[_0xb41b('0x48')]['id']}},_0x25d6e2={};_0x25d6e2[_0xb41b('0x34')]=_[_0xb41b('0x35')](db[_0xb41b('0x2f')]['rawAttributes']);_0x25d6e2['query']=_[_0xb41b('0x35')](_0x59d172['query']);_0x25d6e2[_0xb41b('0x40')]=_['intersection'](_0x25d6e2[_0xb41b('0x34')],_0x25d6e2['query']);_0x28ea6f[_0xb41b('0x38')]=_['intersection'](_0x25d6e2[_0xb41b('0x34')],qs[_0xb41b('0x39')](_0x59d172[_0xb41b('0x37')][_0xb41b('0x39')]));_0x28ea6f['attributes']=_0x28ea6f[_0xb41b('0x38')][_0xb41b('0x49')]?_0x28ea6f['attributes']:_0x25d6e2[_0xb41b('0x34')];if(_0x59d172['query']['includeAll']){_0x28ea6f['include']=[{'all':!![]}];}_0x28ea6f=_['merge']({},_0x28ea6f,_0x59d172[_0xb41b('0x43')]);return db[_0xb41b('0x2f')][_0xb41b('0x4a')](_0x28ea6f)[_0xb41b('0x25')](handleEntityNotFound(_0xe71120,null))[_0xb41b('0x25')](respondWithResult(_0xe71120,null))[_0xb41b('0x47')](handleError(_0xe71120,null));};exports[_0xb41b('0x4b')]=function(_0x3852ae,_0x1913b4){return db[_0xb41b('0x2f')][_0xb41b('0x4b')](_0x3852ae[_0xb41b('0x29')],{})[_0xb41b('0x25')](respondWithResult(_0x1913b4,0xc9))[_0xb41b('0x47')](handleError(_0x1913b4,null));};exports[_0xb41b('0x24')]=function(_0x19893d,_0x587270){if(_0x19893d[_0xb41b('0x29')]['id']){delete _0x19893d['body']['id'];}return db['FaxQueueReport'][_0xb41b('0x4a')]({'where':{'id':_0x19893d[_0xb41b('0x48')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x587270,null))[_0xb41b('0x25')](saveUpdates(_0x19893d[_0xb41b('0x29')],null))[_0xb41b('0x25')](respondWithResult(_0x587270,null))[_0xb41b('0x47')](handleError(_0x587270,null));};exports[_0xb41b('0x4c')]=function(_0x2befc7,_0x1977b1){return db[_0xb41b('0x2f')][_0xb41b('0x4a')]({'where':{'id':_0x2befc7[_0xb41b('0x48')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x1977b1,null))[_0xb41b('0x25')](removeEntity(_0x1977b1,null))[_0xb41b('0x47')](handleError(_0x1977b1,null));};exports[_0xb41b('0x4d')]=function(_0x454e03,_0x3973e7){return db[_0xb41b('0x2f')][_0xb41b('0x4d')]()['then'](respondWithResult(_0x3973e7,null))[_0xb41b('0x47')](handleError(_0x3973e7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 16e655e..c9ce9f7 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bc2=['request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bc2,0xa9));var _0x26bc=function(_0x51c1c8,_0x2072dd){_0x51c1c8=_0x51c1c8-0x0;var _0x144be9=_0x6bc2[_0x51c1c8];return _0x144be9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x26bc('0x0'));var rp=require(_0x26bc('0x1'));var fs=require('fs');var path=require(_0x26bc('0x2'));var rimraf=require(_0x26bc('0x3'));var config=require(_0x26bc('0x4'));var attributes=require(_0x26bc('0x5'));module[_0x26bc('0x6')]=function(_0x578c17,_0x44c53a){return _0x578c17['define'](_0x26bc('0x7'),attributes,{'tableName':_0x26bc('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x26bc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x35ae=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2c49bd,_0x1d14eb){var _0x8fd534=function(_0xdb672d){while(--_0xdb672d){_0x2c49bd['push'](_0x2c49bd['shift']());}};_0x8fd534(++_0x1d14eb);}(_0x35ae,0x17c));var _0xe35a=function(_0x591ed6,_0x97613c){_0x591ed6=_0x591ed6-0x0;var _0x2e9e35=_0x35ae[_0x591ed6];return _0x2e9e35;};'use strict';var _=require(_0xe35a('0x0'));var util=require(_0xe35a('0x1'));var logger=require(_0xe35a('0x2'))(_0xe35a('0x3'));var moment=require(_0xe35a('0x4'));var BPromise=require(_0xe35a('0x5'));var rp=require(_0xe35a('0x6'));var fs=require('fs');var path=require(_0xe35a('0x7'));var rimraf=require(_0xe35a('0x8'));var config=require(_0xe35a('0x9'));var attributes=require(_0xe35a('0xa'));module[_0xe35a('0xb')]=function(_0x3f39ff,_0x215f11){return _0x3f39ff[_0xe35a('0xc')](_0xe35a('0xd'),attributes,{'tableName':_0xe35a('0xe'),'paranoid':![],'indexes':[{'name':_0xe35a('0xf'),'fields':[_0xe35a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 22a2d0a..3d971c5 100644 --- a/server/api/faxQueueReport/faxQueueReport.rpc.js +++ b/server/api/faxQueueReport/faxQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f27=['client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2b5aec,_0x2fa6e1){var _0x8ec4ac=function(_0x34b3d9){while(--_0x34b3d9){_0x2b5aec['push'](_0x2b5aec['shift']());}};_0x8ec4ac(++_0x2fa6e1);}(_0x6f27,0xd6));var _0x76f2=function(_0x13033f,_0x2045af){_0x13033f=_0x13033f-0x0;var _0x2ed576=_0x6f27[_0x13033f];return _0x2ed576;};'use strict';var _=require(_0x76f2('0x0'));var util=require(_0x76f2('0x1'));var moment=require('moment');var BPromise=require(_0x76f2('0x2'));var rs=require(_0x76f2('0x3'));var fs=require('fs');var Redis=require(_0x76f2('0x4'));var db=require(_0x76f2('0x5'))['db'];var utils=require(_0x76f2('0x6'));var logger=require('../../config/logger')(_0x76f2('0x7'));var config=require(_0x76f2('0x8'));var jayson=require(_0x76f2('0x9'));var client=jayson[_0x76f2('0xa')][_0x76f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53f6f0,_0x5048fd,_0x57bc87){return new BPromise(function(_0x4743b0,_0x54ca97){return client[_0x76f2('0xc')](_0x53f6f0,_0x57bc87)[_0x76f2('0xd')](function(_0x3b17f2){logger[_0x76f2('0xe')](_0x76f2('0xf'),_0x5048fd,_0x76f2('0x10'));logger[_0x76f2('0x11')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5048fd,_0x76f2('0x10'),JSON[_0x76f2('0x12')](_0x3b17f2));if(_0x3b17f2['error']){if(_0x3b17f2['error'][_0x76f2('0x13')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5048fd,_0x3b17f2[_0x76f2('0x14')][_0x76f2('0x15')]);return _0x54ca97(_0x3b17f2[_0x76f2('0x14')][_0x76f2('0x15')]);}logger[_0x76f2('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x5048fd,_0x3b17f2[_0x76f2('0x14')]['message']);return _0x4743b0(_0x3b17f2[_0x76f2('0x14')][_0x76f2('0x15')]);}else{logger[_0x76f2('0xe')](_0x76f2('0xf'),_0x5048fd,_0x76f2('0x10'));_0x4743b0(_0x3b17f2[_0x76f2('0x16')][_0x76f2('0x15')]);}})[_0x76f2('0x17')](function(_0x369e2a){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5048fd,_0x369e2a);_0x54ca97(_0x369e2a);});});}exports[_0x76f2('0x18')]=function(_0x147a73){var _0x5776de=this;return new Promise(function(_0x4a01d9,_0x278461){return db[_0x76f2('0x19')]['create'](_0x147a73[_0x76f2('0x1a')],{'raw':_0x147a73[_0x76f2('0x1b')]?_0x147a73['options'][_0x76f2('0x1c')]===undefined?!![]:![]:!![]})[_0x76f2('0xd')](function(_0x65ff3f){logger[_0x76f2('0xe')](_0x76f2('0x18'),_0x147a73);logger[_0x76f2('0x11')](_0x76f2('0x18'),_0x147a73,JSON[_0x76f2('0x12')](_0x65ff3f));_0x4a01d9(_0x65ff3f);})[_0x76f2('0x17')](function(_0x18ad6e){logger[_0x76f2('0x14')](_0x76f2('0x18'),_0x18ad6e[_0x76f2('0x15')],_0x147a73);_0x278461(_0x5776de[_0x76f2('0x14')](0x1f4,_0x18ad6e[_0x76f2('0x15')]));});});};exports[_0x76f2('0x1d')]=function(_0x918cd6){var _0x4007f5=this;return new Promise(function(_0x5b7f51,_0x2cf48f){return db[_0x76f2('0x19')]['update'](_0x918cd6[_0x76f2('0x1a')],{'raw':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6[_0x76f2('0x1b')][_0x76f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6[_0x76f2('0x1b')][_0x76f2('0x1e')]||null:null,'attributes':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6[_0x76f2('0x1b')]['attributes']||null:null,'limit':_0x918cd6[_0x76f2('0x1b')]?_0x918cd6['options'][_0x76f2('0x1f')]||null:null})[_0x76f2('0xd')](function(_0xb191c1){logger[_0x76f2('0xe')](_0x76f2('0x1d'),_0x918cd6);logger[_0x76f2('0x11')]('UpdateFaxQueueReport',_0x918cd6,JSON[_0x76f2('0x12')](_0xb191c1));_0x5b7f51(_0xb191c1);})[_0x76f2('0x17')](function(_0x54465c){logger[_0x76f2('0x14')]('UpdateFaxQueueReport',_0x54465c[_0x76f2('0x15')],_0x918cd6);_0x2cf48f(_0x4007f5[_0x76f2('0x14')](0x1f4,_0x54465c[_0x76f2('0x15')]));});});}; \ No newline at end of file +var _0x1856=['then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxQueueReport','options','CreateFaxQueueReport','debug','catch','UpdateFaxQueueReport','update','body','raw','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0x1856,0xd5));var _0x6185=function(_0x307742,_0x20440d){_0x307742=_0x307742-0x0;var _0x342786=_0x1856[_0x307742];return _0x342786;};'use strict';var _=require(_0x6185('0x0'));var util=require(_0x6185('0x1'));var moment=require(_0x6185('0x2'));var BPromise=require('bluebird');var rs=require(_0x6185('0x3'));var fs=require('fs');var Redis=require(_0x6185('0x4'));var db=require(_0x6185('0x5'))['db'];var utils=require(_0x6185('0x6'));var logger=require('../../config/logger')(_0x6185('0x7'));var config=require(_0x6185('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6185('0x9')][_0x6185('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3659a3,_0x332f96,_0x7c6fb6){return new BPromise(function(_0x5b01e6,_0x3bd28d){return client['request'](_0x3659a3,_0x7c6fb6)[_0x6185('0xb')](function(_0x3f23f5){logger[_0x6185('0xc')](_0x6185('0xd'),_0x332f96,_0x6185('0xe'));logger['debug'](_0x6185('0xf'),_0x332f96,_0x6185('0xe'),JSON[_0x6185('0x10')](_0x3f23f5));if(_0x3f23f5[_0x6185('0x11')]){if(_0x3f23f5[_0x6185('0x11')][_0x6185('0x12')]===0x1f4){logger['error'](_0x6185('0xd'),_0x332f96,_0x3f23f5['error'][_0x6185('0x13')]);return _0x3bd28d(_0x3f23f5[_0x6185('0x11')][_0x6185('0x13')]);}logger[_0x6185('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x332f96,_0x3f23f5[_0x6185('0x11')][_0x6185('0x13')]);return _0x5b01e6(_0x3f23f5[_0x6185('0x11')][_0x6185('0x13')]);}else{logger['info'](_0x6185('0xd'),_0x332f96,_0x6185('0xe'));_0x5b01e6(_0x3f23f5[_0x6185('0x14')][_0x6185('0x13')]);}})['catch'](function(_0x4cd7ff){logger[_0x6185('0x11')](_0x6185('0xd'),_0x332f96,_0x4cd7ff);_0x3bd28d(_0x4cd7ff);});});}exports['CreateFaxQueueReport']=function(_0xde67a0){var _0x2e9667=this;return new Promise(function(_0x47a876,_0x140975){return db[_0x6185('0x15')]['create'](_0xde67a0['body'],{'raw':_0xde67a0[_0x6185('0x16')]?_0xde67a0['options']['raw']===undefined?!![]:![]:!![]})[_0x6185('0xb')](function(_0x535898){logger[_0x6185('0xc')](_0x6185('0x17'),_0xde67a0);logger[_0x6185('0x18')](_0x6185('0x17'),_0xde67a0,JSON[_0x6185('0x10')](_0x535898));_0x47a876(_0x535898);})[_0x6185('0x19')](function(_0x31aa82){logger[_0x6185('0x11')](_0x6185('0x17'),_0x31aa82[_0x6185('0x13')],_0xde67a0);_0x140975(_0x2e9667[_0x6185('0x11')](0x1f4,_0x31aa82['message']));});});};exports[_0x6185('0x1a')]=function(_0x2a43b5){var _0x24991f=this;return new Promise(function(_0x48a328,_0x20120a){return db[_0x6185('0x15')][_0x6185('0x1b')](_0x2a43b5[_0x6185('0x1c')],{'raw':_0x2a43b5[_0x6185('0x16')]?_0x2a43b5[_0x6185('0x16')][_0x6185('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a43b5[_0x6185('0x16')]?_0x2a43b5[_0x6185('0x16')]['where']||null:null,'attributes':_0x2a43b5[_0x6185('0x16')]?_0x2a43b5[_0x6185('0x16')][_0x6185('0x1e')]||null:null,'limit':_0x2a43b5[_0x6185('0x16')]?_0x2a43b5['options'][_0x6185('0x1f')]||null:null})['then'](function(_0x56dc52){logger[_0x6185('0xc')]('UpdateFaxQueueReport',_0x2a43b5);logger[_0x6185('0x18')]('UpdateFaxQueueReport',_0x2a43b5,JSON[_0x6185('0x10')](_0x56dc52));_0x48a328(_0x56dc52);})[_0x6185('0x19')](function(_0x12a16b){logger[_0x6185('0x11')](_0x6185('0x1a'),_0x12a16b[_0x6185('0x13')],_0x2a43b5);_0x20120a(_0x24991f['error'](0x1f4,_0x12a16b[_0x6185('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 45a15cc..dc9dae2 100644 --- a/server/api/faxQueueReport/index.js +++ b/server/api/faxQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x947e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports'];(function(_0x1540b1,_0xb25088){var _0x1d020d=function(_0x51ac71){while(--_0x51ac71){_0x1540b1['push'](_0x1540b1['shift']());}};_0x1d020d(++_0xb25088);}(_0x947e,0x168));var _0xe947=function(_0xbfd350,_0x3a3694){_0xbfd350=_0xbfd350-0x0;var _0x55f5d3=_0x947e[_0xbfd350];return _0x55f5d3;};'use strict';var multer=require(_0xe947('0x0'));var util=require(_0xe947('0x1'));var path=require(_0xe947('0x2'));var timeout=require(_0xe947('0x3'));var express=require(_0xe947('0x4'));var router=express[_0xe947('0x5')]();var fs_extra=require(_0xe947('0x6'));var auth=require(_0xe947('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0xe947('0x8')]('/',auth[_0xe947('0x9')](),controller[_0xe947('0xa')]);router[_0xe947('0x8')](_0xe947('0xb'),auth['isAuthenticated'](),controller[_0xe947('0xc')]);router[_0xe947('0x8')](_0xe947('0xd'),auth['isAuthenticated'](),controller[_0xe947('0xe')]);router[_0xe947('0xf')]('/',auth[_0xe947('0x9')](),controller['create']);router[_0xe947('0x10')](_0xe947('0xd'),auth[_0xe947('0x9')](),controller[_0xe947('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe947('0x12')]);module[_0xe947('0x13')]=router; \ No newline at end of file +var _0x0324=['/:id','isAuthenticated','post','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x31441b,_0x5ec2ee){var _0x1f4f80=function(_0x4d2515){while(--_0x4d2515){_0x31441b['push'](_0x31441b['shift']());}};_0x1f4f80(++_0x5ec2ee);}(_0x0324,0xc2));var _0x4032=function(_0x4ca7e9,_0x507186){_0x4ca7e9=_0x4ca7e9-0x0;var _0x5eaedd=_0x0324[_0x4ca7e9];return _0x5eaedd;};'use strict';var multer=require('multer');var util=require(_0x4032('0x0'));var path=require('path');var timeout=require(_0x4032('0x1'));var express=require(_0x4032('0x2'));var router=express[_0x4032('0x3')]();var fs_extra=require(_0x4032('0x4'));var auth=require(_0x4032('0x5'));var interaction=require(_0x4032('0x6'));var config=require(_0x4032('0x7'));var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4032('0x8')]);router[_0x4032('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4032('0x9')](_0x4032('0xa'),auth[_0x4032('0xb')](),controller['show']);router[_0x4032('0xc')]('/',auth[_0x4032('0xb')](),controller['create']);router[_0x4032('0xd')](_0x4032('0xa'),auth[_0x4032('0xb')](),controller['update']);router[_0x4032('0xe')](_0x4032('0xa'),auth[_0x4032('0xb')](),controller[_0x4032('0xf')]);module[_0x4032('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 04c4b15..a4247b9 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa73c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa73c,0x149));var _0xca73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa73c[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xca73('0x0'));var Sequelize=require(_0xca73('0x1'));module[_0xca73('0x2')]={'uniqueid':{'type':Sequelize[_0xca73('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xca73('0x4')]('account',_0xca73('0x5'),'queue'),'allowNull':![],'defaultValue':_0xca73('0x6')},'transferredAt':{'type':Sequelize[_0xca73('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xca73('0x8')]}}; \ No newline at end of file +var _0xccae=['STRING','account','agent','queue','NOW','moment','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xccae,0x145));var _0xecca=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xccae[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0xecca('0x0'));var Sequelize=require(_0xecca('0x1'));module[_0xecca('0x2')]={'uniqueid':{'type':Sequelize[_0xecca('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xecca('0x4'),_0xecca('0x5'),_0xecca('0x6')),'allowNull':![],'defaultValue':_0xecca('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xecca('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ac1103d..7d526d6 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','FaxTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x3d2da5,_0x569886){var _0x21e9f0=function(_0x2323d2){while(--_0x2323d2){_0x3d2da5['push'](_0x3d2da5['shift']());}};_0x21e9f0(++_0x569886);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}function getMustacheRender(_0x372a47,_0x5987ae){return Mustache[_0x49c4('0x28')](_0x372a47,_[_0x49c4('0x29')](_0x5987ae[_0x49c4('0x2a')],{'contact':_0x5987ae[_0x49c4('0x2b')],'message':_0x5987ae[_0x49c4('0x2c')],'agent':_0x5987ae[_0x49c4('0x2d')],'interaction':_0x5987ae[_0x49c4('0x2e')],'account':_0x5987ae[_0x49c4('0x2f')]}))||'';}exports[_0x49c4('0x30')]=function(_0x2cbd88,_0x46f7ea){var _0x4ea6ea={},_0x4f4495={},_0x59eb84={'count':0x0,'rows':[]};var _0x134928=_[_0x49c4('0x31')](db[_0x49c4('0x32')][_0x49c4('0x33')],function(_0x28eb47){return{'name':_0x28eb47['fieldName'],'type':_0x28eb47[_0x49c4('0x34')][_0x49c4('0x35')]};});_0x4f4495[_0x49c4('0x36')]=_[_0x49c4('0x31')](_0x134928,'name');_0x4f4495['query']=_[_0x49c4('0x37')](_0x2cbd88[_0x49c4('0x38')]);_0x4f4495[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x4f4495[_0x49c4('0x36')],_0x4f4495['query']);_0x4ea6ea[_0x49c4('0x3b')]=_[_0x49c4('0x3a')](_0x4f4495[_0x49c4('0x36')],qs['fields'](_0x2cbd88['query'][_0x49c4('0x3c')]));_0x4ea6ea[_0x49c4('0x3b')]=_0x4ea6ea[_0x49c4('0x3b')][_0x49c4('0x3d')]?_0x4ea6ea[_0x49c4('0x3b')]:_0x4f4495[_0x49c4('0x36')];if(!_0x2cbd88[_0x49c4('0x38')][_0x49c4('0x3e')](_0x49c4('0x3f'))){_0x4ea6ea['limit']=qs[_0x49c4('0x1b')](_0x2cbd88['query'][_0x49c4('0x1b')]);_0x4ea6ea[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x2cbd88[_0x49c4('0x38')]['offset']);}_0x4ea6ea[_0x49c4('0x40')]=qs[_0x49c4('0x41')](_0x2cbd88[_0x49c4('0x38')]['sort']);_0x4ea6ea[_0x49c4('0x42')]=qs[_0x49c4('0x39')](_[_0x49c4('0x43')](_0x2cbd88[_0x49c4('0x38')],_0x4f4495[_0x49c4('0x39')]),_0x134928);if(_0x2cbd88[_0x49c4('0x38')][_0x49c4('0x44')]){_0x4ea6ea[_0x49c4('0x42')]=_[_0x49c4('0x29')](_0x4ea6ea[_0x49c4('0x42')],{'$or':_[_0x49c4('0x31')](_0x134928,function(_0x4e0663){if(_0x4e0663[_0x49c4('0x34')]!==_0x49c4('0x45')){var _0x32b172={};_0x32b172[_0x4e0663[_0x49c4('0x26')]]={'$like':'%'+_0x2cbd88[_0x49c4('0x38')][_0x49c4('0x44')]+'%'};return _0x32b172;}})});}_0x4ea6ea=_[_0x49c4('0x29')]({},_0x4ea6ea,_0x2cbd88[_0x49c4('0x46')]);var _0x248c0a={'where':_0x4ea6ea[_0x49c4('0x42')]};return db[_0x49c4('0x32')][_0x49c4('0x1c')](_0x248c0a)[_0x49c4('0x47')](function(_0x4e38bc){_0x59eb84[_0x49c4('0x1c')]=_0x4e38bc;if(_0x2cbd88['query'][_0x49c4('0x48')]){_0x4ea6ea[_0x49c4('0x49')]=[{'all':!![]}];}return db[_0x49c4('0x32')][_0x49c4('0x4a')](_0x4ea6ea);})[_0x49c4('0x47')](function(_0x281b83){_0x59eb84['rows']=_0x281b83;return _0x59eb84;})['then'](respondWithFilteredResult(_0x46f7ea,_0x4ea6ea))[_0x49c4('0x4b')](handleError(_0x46f7ea,null));};exports[_0x49c4('0x4c')]=function(_0x38349b,_0x117151){var _0x490823={'raw':!![],'where':{'id':_0x38349b[_0x49c4('0x4d')]['id']}},_0x3baff9={};_0x3baff9[_0x49c4('0x36')]=_[_0x49c4('0x37')](db[_0x49c4('0x32')][_0x49c4('0x33')]);_0x3baff9[_0x49c4('0x38')]=_[_0x49c4('0x37')](_0x38349b[_0x49c4('0x38')]);_0x3baff9['filters']=_[_0x49c4('0x3a')](_0x3baff9['model'],_0x3baff9[_0x49c4('0x38')]);_0x490823[_0x49c4('0x3b')]=_[_0x49c4('0x3a')](_0x3baff9[_0x49c4('0x36')],qs[_0x49c4('0x3c')](_0x38349b['query'][_0x49c4('0x3c')]));_0x490823[_0x49c4('0x3b')]=_0x490823[_0x49c4('0x3b')][_0x49c4('0x3d')]?_0x490823[_0x49c4('0x3b')]:_0x3baff9[_0x49c4('0x36')];if(_0x38349b[_0x49c4('0x38')]['includeAll']){_0x490823[_0x49c4('0x49')]=[{'all':!![]}];}_0x490823=_['merge']({},_0x490823,_0x38349b[_0x49c4('0x46')]);return db[_0x49c4('0x32')][_0x49c4('0x4e')](_0x490823)[_0x49c4('0x47')](handleEntityNotFound(_0x117151,null))[_0x49c4('0x47')](respondWithResult(_0x117151,null))[_0x49c4('0x4b')](handleError(_0x117151,null));};exports[_0x49c4('0x4f')]=function(_0x506c71,_0x3b731f){return db[_0x49c4('0x32')]['create'](_0x506c71[_0x49c4('0x2a')],{})[_0x49c4('0x47')](respondWithResult(_0x3b731f,0xc9))[_0x49c4('0x4b')](handleError(_0x3b731f,null));};exports[_0x49c4('0x22')]=function(_0x52a8f7,_0x5d8bf0){if(_0x52a8f7[_0x49c4('0x2a')]['id']){delete _0x52a8f7['body']['id'];}return db[_0x49c4('0x32')][_0x49c4('0x4e')]({'where':{'id':_0x52a8f7[_0x49c4('0x4d')]['id']}})[_0x49c4('0x47')](handleEntityNotFound(_0x5d8bf0,null))[_0x49c4('0x47')](saveUpdates(_0x52a8f7[_0x49c4('0x2a')],null))[_0x49c4('0x47')](respondWithResult(_0x5d8bf0,null))['catch'](handleError(_0x5d8bf0,null));};exports[_0x49c4('0x23')]=function(_0x1550ce,_0x3936d3){return db[_0x49c4('0x32')][_0x49c4('0x4e')]({'where':{'id':_0x1550ce[_0x49c4('0x4d')]['id']}})[_0x49c4('0x47')](handleEntityNotFound(_0x3936d3,null))[_0x49c4('0x47')](removeEntity(_0x3936d3,null))[_0x49c4('0x4b')](handleError(_0x3936d3,null));};exports[_0x49c4('0x50')]=function(_0x5b822f,_0x5e63f0){return db[_0x49c4('0x32')][_0x49c4('0x50')]()['then'](respondWithResult(_0x5e63f0,null))['catch'](handleError(_0x5e63f0,null));}; \ No newline at end of file +var _0xc831=['merge','body','contact','message','interaction','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','then','error','name','send','render'];(function(_0x225491,_0x25f13){var _0x45d8ad=function(_0xeb83bc){while(--_0xeb83bc){_0x225491['push'](_0x225491['shift']());}};_0x45d8ad(++_0x25f13);}(_0xc831,0x103));var _0x1c83=function(_0x2ac193,_0x210ab0){_0x2ac193=_0x2ac193-0x0;var _0x56759d=_0xc831[_0x2ac193];return _0x56759d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c83('0x0'));var zipdir=require(_0x1c83('0x1'));var jsonpatch=require(_0x1c83('0x2'));var rp=require(_0x1c83('0x3'));var moment=require(_0x1c83('0x4'));var BPromise=require(_0x1c83('0x5'));var Mustache=require(_0x1c83('0x6'));var util=require(_0x1c83('0x7'));var path=require(_0x1c83('0x8'));var sox=require(_0x1c83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c83('0xa'));var _=require('lodash');var squel=require(_0x1c83('0xb'));var crypto=require(_0x1c83('0xc'));var jsforce=require(_0x1c83('0xd'));var deskjs=require(_0x1c83('0xe'));var toCsv=require(_0x1c83('0xf'));var querystring=require('querystring');var Papa=require(_0x1c83('0x10'));var Redis=require(_0x1c83('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c83('0x12'));var hardwareService=require(_0x1c83('0x13'));var logger=require(_0x1c83('0x14'))('api');var utils=require(_0x1c83('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c83('0x16'))['db'];function respondWithStatusCode(_0x276377,_0x3128ec){_0x3128ec=_0x3128ec||0xcc;return function(_0x20a59f){if(_0x20a59f){return _0x276377[_0x1c83('0x17')](_0x3128ec);}return _0x276377[_0x1c83('0x18')](_0x3128ec)[_0x1c83('0x19')]();};}function respondWithResult(_0x5d5742,_0x43f74e){_0x43f74e=_0x43f74e||0xc8;return function(_0x1be133){if(_0x1be133){return _0x5d5742[_0x1c83('0x18')](_0x43f74e)[_0x1c83('0x1a')](_0x1be133);}};}function respondWithFilteredResult(_0x37ba9b,_0x4e1620){return function(_0x11acf1){if(_0x11acf1){var _0x18a06d=typeof _0x4e1620[_0x1c83('0x1b')]===_0x1c83('0x1c')&&typeof _0x4e1620['limit']===_0x1c83('0x1c');var _0x4a5025=_0x11acf1['count'];var _0x3b3369=_0x18a06d?0x0:_0x4e1620[_0x1c83('0x1b')];var _0x2ec743=_0x18a06d?_0x11acf1[_0x1c83('0x1d')]:_0x4e1620['offset']+_0x4e1620[_0x1c83('0x1e')];var _0x5642aa;if(_0x2ec743>=_0x4a5025){_0x2ec743=_0x4a5025;_0x5642aa=0xc8;}else{_0x5642aa=0xce;}_0x37ba9b[_0x1c83('0x18')](_0x5642aa);return _0x37ba9b[_0x1c83('0x1f')]('Content-Range',_0x3b3369+'-'+_0x2ec743+'/'+_0x4a5025)[_0x1c83('0x1a')](_0x11acf1);}return null;};}function patchUpdates(_0x1b5a71){return function(_0x5aa566){try{jsonpatch['apply'](_0x5aa566,_0x1b5a71,!![]);}catch(_0x4cd6bb){return BPromise['reject'](_0x4cd6bb);}return _0x5aa566['save']();};}function saveUpdates(_0x19abb8,_0x3e216d){return function(_0x5daab4){if(_0x5daab4){return _0x5daab4['update'](_0x19abb8)[_0x1c83('0x20')](function(_0x3c8123){return _0x3c8123;});}return null;};}function removeEntity(_0x2d041f,_0x58a7d5){return function(_0xb21f06){if(_0xb21f06){return _0xb21f06['destroy']()[_0x1c83('0x20')](function(){_0x2d041f[_0x1c83('0x18')](0xcc)[_0x1c83('0x19')]();});}};}function handleEntityNotFound(_0x1096ed,_0x2e452b){return function(_0x2982d3){if(!_0x2982d3){_0x1096ed[_0x1c83('0x17')](0x194);}return _0x2982d3;};}function handleError(_0x2beb2b,_0x2ed4a3){_0x2ed4a3=_0x2ed4a3||0x1f4;return function(_0x578c37){logger[_0x1c83('0x21')](_0x578c37['stack']);if(_0x578c37[_0x1c83('0x22')]){delete _0x578c37['name'];}_0x2beb2b[_0x1c83('0x18')](_0x2ed4a3)[_0x1c83('0x23')](_0x578c37);};}function getMustacheRender(_0x46ff26,_0x341d8d){return Mustache[_0x1c83('0x24')](_0x46ff26,_[_0x1c83('0x25')](_0x341d8d[_0x1c83('0x26')],{'contact':_0x341d8d[_0x1c83('0x27')],'message':_0x341d8d[_0x1c83('0x28')],'agent':_0x341d8d['agent'],'interaction':_0x341d8d[_0x1c83('0x29')],'account':_0x341d8d['account']}))||'';}exports['index']=function(_0x3e9814,_0x23210c){var _0x39f492={},_0x15bc67={},_0x29049a={'count':0x0,'rows':[]};var _0x63e3e0=_[_0x1c83('0x2a')](db[_0x1c83('0x2b')]['rawAttributes'],function(_0x334c96){return{'name':_0x334c96[_0x1c83('0x2c')],'type':_0x334c96[_0x1c83('0x2d')][_0x1c83('0x2e')]};});_0x15bc67[_0x1c83('0x2f')]=_['map'](_0x63e3e0,_0x1c83('0x22'));_0x15bc67[_0x1c83('0x30')]=_[_0x1c83('0x31')](_0x3e9814['query']);_0x15bc67[_0x1c83('0x32')]=_[_0x1c83('0x33')](_0x15bc67[_0x1c83('0x2f')],_0x15bc67[_0x1c83('0x30')]);_0x39f492[_0x1c83('0x34')]=_[_0x1c83('0x33')](_0x15bc67[_0x1c83('0x2f')],qs[_0x1c83('0x35')](_0x3e9814[_0x1c83('0x30')]['fields']));_0x39f492[_0x1c83('0x34')]=_0x39f492[_0x1c83('0x34')][_0x1c83('0x36')]?_0x39f492[_0x1c83('0x34')]:_0x15bc67[_0x1c83('0x2f')];if(!_0x3e9814['query']['hasOwnProperty']('nolimit')){_0x39f492[_0x1c83('0x1e')]=qs['limit'](_0x3e9814[_0x1c83('0x30')][_0x1c83('0x1e')]);_0x39f492[_0x1c83('0x1b')]=qs[_0x1c83('0x1b')](_0x3e9814[_0x1c83('0x30')]['offset']);}_0x39f492['order']=qs['sort'](_0x3e9814[_0x1c83('0x30')][_0x1c83('0x37')]);_0x39f492[_0x1c83('0x38')]=qs[_0x1c83('0x32')](_[_0x1c83('0x39')](_0x3e9814[_0x1c83('0x30')],_0x15bc67[_0x1c83('0x32')]),_0x63e3e0);if(_0x3e9814['query']['filter']){_0x39f492[_0x1c83('0x38')]=_[_0x1c83('0x25')](_0x39f492[_0x1c83('0x38')],{'$or':_[_0x1c83('0x2a')](_0x63e3e0,function(_0x393a0f){if(_0x393a0f[_0x1c83('0x2d')]!==_0x1c83('0x3a')){var _0x4c1144={};_0x4c1144[_0x393a0f[_0x1c83('0x22')]]={'$like':'%'+_0x3e9814[_0x1c83('0x30')][_0x1c83('0x3b')]+'%'};return _0x4c1144;}})});}_0x39f492=_[_0x1c83('0x25')]({},_0x39f492,_0x3e9814[_0x1c83('0x3c')]);var _0xe50dbf={'where':_0x39f492[_0x1c83('0x38')]};return db[_0x1c83('0x2b')][_0x1c83('0x1d')](_0xe50dbf)[_0x1c83('0x20')](function(_0x230175){_0x29049a[_0x1c83('0x1d')]=_0x230175;if(_0x3e9814[_0x1c83('0x30')][_0x1c83('0x3d')]){_0x39f492['include']=[{'all':!![]}];}return db[_0x1c83('0x2b')][_0x1c83('0x3e')](_0x39f492);})['then'](function(_0x37aef3){_0x29049a[_0x1c83('0x3f')]=_0x37aef3;return _0x29049a;})[_0x1c83('0x20')](respondWithFilteredResult(_0x23210c,_0x39f492))[_0x1c83('0x40')](handleError(_0x23210c,null));};exports[_0x1c83('0x41')]=function(_0x413f5c,_0x1201eb){var _0xf5cd63={'raw':!![],'where':{'id':_0x413f5c[_0x1c83('0x42')]['id']}},_0x577fb3={};_0x577fb3[_0x1c83('0x2f')]=_[_0x1c83('0x31')](db[_0x1c83('0x2b')][_0x1c83('0x43')]);_0x577fb3[_0x1c83('0x30')]=_[_0x1c83('0x31')](_0x413f5c[_0x1c83('0x30')]);_0x577fb3['filters']=_['intersection'](_0x577fb3[_0x1c83('0x2f')],_0x577fb3[_0x1c83('0x30')]);_0xf5cd63[_0x1c83('0x34')]=_[_0x1c83('0x33')](_0x577fb3[_0x1c83('0x2f')],qs['fields'](_0x413f5c[_0x1c83('0x30')]['fields']));_0xf5cd63['attributes']=_0xf5cd63['attributes'][_0x1c83('0x36')]?_0xf5cd63['attributes']:_0x577fb3[_0x1c83('0x2f')];if(_0x413f5c[_0x1c83('0x30')][_0x1c83('0x3d')]){_0xf5cd63[_0x1c83('0x44')]=[{'all':!![]}];}_0xf5cd63=_[_0x1c83('0x25')]({},_0xf5cd63,_0x413f5c[_0x1c83('0x3c')]);return db[_0x1c83('0x2b')][_0x1c83('0x45')](_0xf5cd63)['then'](handleEntityNotFound(_0x1201eb,null))[_0x1c83('0x20')](respondWithResult(_0x1201eb,null))[_0x1c83('0x40')](handleError(_0x1201eb,null));};exports[_0x1c83('0x46')]=function(_0xf2bbc5,_0xcb0961){return db['FaxTransferReport']['create'](_0xf2bbc5[_0x1c83('0x26')],{})[_0x1c83('0x20')](respondWithResult(_0xcb0961,0xc9))[_0x1c83('0x40')](handleError(_0xcb0961,null));};exports[_0x1c83('0x47')]=function(_0xcc39fa,_0x4ef7e8){if(_0xcc39fa[_0x1c83('0x26')]['id']){delete _0xcc39fa[_0x1c83('0x26')]['id'];}return db[_0x1c83('0x2b')]['find']({'where':{'id':_0xcc39fa[_0x1c83('0x42')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x4ef7e8,null))[_0x1c83('0x20')](saveUpdates(_0xcc39fa[_0x1c83('0x26')],null))[_0x1c83('0x20')](respondWithResult(_0x4ef7e8,null))[_0x1c83('0x40')](handleError(_0x4ef7e8,null));};exports[_0x1c83('0x48')]=function(_0x370291,_0x57904c){return db[_0x1c83('0x2b')][_0x1c83('0x45')]({'where':{'id':_0x370291[_0x1c83('0x42')]['id']}})['then'](handleEntityNotFound(_0x57904c,null))['then'](removeEntity(_0x57904c,null))['catch'](handleError(_0x57904c,null));};exports[_0x1c83('0x49')]=function(_0x41e7d5,_0x50b485){return db[_0x1c83('0x2b')][_0x1c83('0x49')]()[_0x1c83('0x20')](respondWithResult(_0x50b485,null))[_0x1c83('0x40')](handleError(_0x50b485,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 3429e2b..050a484 100644 --- a/server/api/faxTransferReport/faxTransferReport.model.js +++ b/server/api/faxTransferReport/faxTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43ec=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x5b271b,_0x568567){var _0x5c60d8=function(_0x38f6bf){while(--_0x38f6bf){_0x5b271b['push'](_0x5b271b['shift']());}};_0x5c60d8(++_0x568567);}(_0x43ec,0x1e1));var _0xc43e=function(_0x534b49,_0x464ea8){_0x534b49=_0x534b49-0x0;var _0x107e16=_0x43ec[_0x534b49];return _0x107e16;};'use strict';var _=require(_0xc43e('0x0'));var util=require('util');var logger=require(_0xc43e('0x1'))(_0xc43e('0x2'));var moment=require(_0xc43e('0x3'));var BPromise=require(_0xc43e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc43e('0x5'));var rimraf=require('rimraf');var config=require(_0xc43e('0x6'));var attributes=require(_0xc43e('0x7'));module[_0xc43e('0x8')]=function(_0x22a075,_0x4617cf){return _0x22a075[_0xc43e('0x9')](_0xc43e('0xa'),attributes,{'tableName':_0xc43e('0xb'),'paranoid':![],'indexes':[{'name':_0xc43e('0xc'),'fields':[_0xc43e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3810=['api','moment','bluebird','request-promise','rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','lodash','util','../../config/logger'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x3810,0x195));var _0x0381=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x3810[_0x507c81];return _0x368a25;};'use strict';var _=require(_0x0381('0x0'));var util=require(_0x0381('0x1'));var logger=require(_0x0381('0x2'))(_0x0381('0x3'));var moment=require(_0x0381('0x4'));var BPromise=require(_0x0381('0x5'));var rp=require(_0x0381('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0381('0x7'));var config=require('../../config/environment');var attributes=require(_0x0381('0x8'));module['exports']=function(_0x4ccb2b,_0x3a1c67){return _0x4ccb2b[_0x0381('0x9')](_0x0381('0xa'),attributes,{'tableName':_0x0381('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 79af001..75ef69f 100644 --- a/server/api/faxTransferReport/faxTransferReport.rpc.js +++ b/server/api/faxTransferReport/faxTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x490f=['FaxTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','FaxTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x1adebd,_0x4ac472){var _0x162d8f=function(_0x355e91){while(--_0x355e91){_0x1adebd['push'](_0x1adebd['shift']());}};_0x162d8f(++_0x4ac472);}(_0x490f,0xe3));var _0xf490=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x490f[_0x210d7f];return _0x42d687;};'use strict';var _=require('lodash');var util=require(_0xf490('0x0'));var moment=require(_0xf490('0x1'));var BPromise=require(_0xf490('0x2'));var rs=require(_0xf490('0x3'));var fs=require('fs');var Redis=require(_0xf490('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf490('0x5'))(_0xf490('0x6'));var config=require(_0xf490('0x7'));var jayson=require(_0xf490('0x8'));var client=jayson[_0xf490('0x9')][_0xf490('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1daaa3,_0x39346e,_0x3e8702){return new BPromise(function(_0x314794,_0x33c1ad){return client['request'](_0x1daaa3,_0x3e8702)[_0xf490('0xb')](function(_0x2c0f59){logger[_0xf490('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x39346e,_0xf490('0xd'));logger[_0xf490('0xe')](_0xf490('0xf'),_0x39346e,_0xf490('0xd'),JSON['stringify'](_0x2c0f59));if(_0x2c0f59['error']){if(_0x2c0f59['error'][_0xf490('0x10')]===0x1f4){logger[_0xf490('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x39346e,_0x2c0f59[_0xf490('0x11')][_0xf490('0x12')]);return _0x33c1ad(_0x2c0f59['error']['message']);}logger[_0xf490('0x11')](_0xf490('0x13'),_0x39346e,_0x2c0f59[_0xf490('0x11')]['message']);return _0x314794(_0x2c0f59[_0xf490('0x11')][_0xf490('0x12')]);}else{logger[_0xf490('0xc')](_0xf490('0x13'),_0x39346e,'request\x20sent');_0x314794(_0x2c0f59[_0xf490('0x14')][_0xf490('0x12')]);}})[_0xf490('0x15')](function(_0x26fad9){logger[_0xf490('0x11')](_0xf490('0x13'),_0x39346e,_0x26fad9);_0x33c1ad(_0x26fad9);});});} \ No newline at end of file +var _0x162b=['then','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0xfac5eb,_0x4ad2ed){var _0x43c9f4=function(_0x581864){while(--_0x581864){_0xfac5eb['push'](_0xfac5eb['shift']());}};_0x43c9f4(++_0x4ad2ed);}(_0x162b,0x1ed));var _0xb162=function(_0x456492,_0x41ea6f){_0x456492=_0x456492-0x0;var _0x36dbb3=_0x162b[_0x456492];return _0x36dbb3;};'use strict';var _=require(_0xb162('0x0'));var util=require(_0xb162('0x1'));var moment=require(_0xb162('0x2'));var BPromise=require(_0xb162('0x3'));var rs=require(_0xb162('0x4'));var fs=require('fs');var Redis=require(_0xb162('0x5'));var db=require(_0xb162('0x6'))['db'];var utils=require(_0xb162('0x7'));var logger=require(_0xb162('0x8'))('rpc');var config=require(_0xb162('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb162('0xa')][_0xb162('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x570bc4,_0x55118c,_0x2f8981){return new BPromise(function(_0x24593d,_0x23e67f){return client[_0xb162('0xc')](_0x570bc4,_0x2f8981)[_0xb162('0xd')](function(_0x2ab7e9){logger[_0xb162('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x55118c,'request\x20sent');logger[_0xb162('0xf')](_0xb162('0x10'),_0x55118c,_0xb162('0x11'),JSON[_0xb162('0x12')](_0x2ab7e9));if(_0x2ab7e9[_0xb162('0x13')]){if(_0x2ab7e9[_0xb162('0x13')][_0xb162('0x14')]===0x1f4){logger[_0xb162('0x13')](_0xb162('0x15'),_0x55118c,_0x2ab7e9[_0xb162('0x13')][_0xb162('0x16')]);return _0x23e67f(_0x2ab7e9['error'][_0xb162('0x16')]);}logger[_0xb162('0x13')](_0xb162('0x15'),_0x55118c,_0x2ab7e9[_0xb162('0x13')]['message']);return _0x24593d(_0x2ab7e9[_0xb162('0x13')][_0xb162('0x16')]);}else{logger[_0xb162('0xe')](_0xb162('0x15'),_0x55118c,_0xb162('0x11'));_0x24593d(_0x2ab7e9['result'][_0xb162('0x16')]);}})['catch'](function(_0x4ac46e){logger[_0xb162('0x13')](_0xb162('0x15'),_0x55118c,_0x4ac46e);_0x23e67f(_0x4ac46e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 88236b0..9d76544 100644 --- a/server/api/faxTransferReport/index.js +++ b/server/api/faxTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30f2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','multer','path','connect-timeout','Router'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x30f2,0x188));var _0x230f=function(_0x2d1d7f,_0x5a45d1){_0x2d1d7f=_0x2d1d7f-0x0;var _0x2f7276=_0x30f2[_0x2d1d7f];return _0x2f7276;};'use strict';var multer=require(_0x230f('0x0'));var util=require('util');var path=require(_0x230f('0x1'));var timeout=require(_0x230f('0x2'));var express=require('express');var router=express[_0x230f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x230f('0x4'));var interaction=require(_0x230f('0x5'));var config=require(_0x230f('0x6'));var controller=require(_0x230f('0x7'));router[_0x230f('0x8')]('/',auth[_0x230f('0x9')](),controller[_0x230f('0xa')]);router[_0x230f('0x8')](_0x230f('0xb'),auth[_0x230f('0x9')](),controller[_0x230f('0xc')]);router['get'](_0x230f('0xd'),auth[_0x230f('0x9')](),controller[_0x230f('0xe')]);router[_0x230f('0xf')]('/',auth[_0x230f('0x9')](),controller[_0x230f('0x10')]);router['put'](_0x230f('0xd'),auth[_0x230f('0x9')](),controller['update']);router[_0x230f('0x11')](_0x230f('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc032=['get','isAuthenticated','index','describe','/:id','show','create','update','destroy','util','path','Router','fs-extra','../../config/environment','./faxTransferReport.controller'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc032,0x19e));var _0x2c03=function(_0x252dcb,_0x4003a9){_0x252dcb=_0x252dcb-0x0;var _0x3ab82a=_0xc032[_0x252dcb];return _0x3ab82a;};'use strict';var multer=require('multer');var util=require(_0x2c03('0x0'));var path=require(_0x2c03('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c03('0x2')]();var fs_extra=require(_0x2c03('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c03('0x4'));var controller=require(_0x2c03('0x5'));router[_0x2c03('0x6')]('/',auth[_0x2c03('0x7')](),controller[_0x2c03('0x8')]);router['get']('/describe',auth[_0x2c03('0x7')](),controller[_0x2c03('0x9')]);router[_0x2c03('0x6')](_0x2c03('0xa'),auth[_0x2c03('0x7')](),controller[_0x2c03('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2c03('0xc')]);router['put']('/:id',auth[_0x2c03('0x7')](),controller[_0x2c03('0xd')]);router['delete'](_0x2c03('0xa'),auth[_0x2c03('0x7')](),controller[_0x2c03('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f25a83c..3fd4e1a 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5d8=['create','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x2f0710,_0x95b261){var _0x194be7=function(_0x5bd664){while(--_0x5bd664){_0x2f0710['push'](_0x2f0710['shift']());}};_0x194be7(++_0x95b261);}(_0xb5d8,0xe0));var _0x8b5d=function(_0x21317f,_0x4dee3f){_0x21317f=_0x21317f-0x0;var _0x7f0ddb=_0xb5d8[_0x21317f];return _0x7f0ddb;};'use strict';var multer=require(_0x8b5d('0x0'));var util=require('util');var path=require(_0x8b5d('0x1'));var timeout=require(_0x8b5d('0x2'));var express=require('express');var router=express[_0x8b5d('0x3')]();var fs_extra=require(_0x8b5d('0x4'));var auth=require(_0x8b5d('0x5'));var interaction=require(_0x8b5d('0x6'));var config=require(_0x8b5d('0x7'));var controller=require(_0x8b5d('0x8'));router[_0x8b5d('0x9')]('/',auth[_0x8b5d('0xa')](),controller['index']);router[_0x8b5d('0x9')](_0x8b5d('0xb'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0xc')]);router[_0x8b5d('0x9')](_0x8b5d('0xd'),auth[_0x8b5d('0xa')](),controller['getConfigurations']);router['get'](_0x8b5d('0xe'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0xf')]);router['post']('/',auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x10')]);router[_0x8b5d('0x11')](_0x8b5d('0xd'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x12')]);router[_0x8b5d('0x13')](_0x8b5d('0xb'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x14')]);router[_0x8b5d('0x15')](_0x8b5d('0xb'),auth[_0x8b5d('0xa')](),controller[_0x8b5d('0x16')]);module[_0x8b5d('0x17')]=router; \ No newline at end of file +var _0x1e3d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','path'];(function(_0x2e820e,_0xad482d){var _0x2b7a57=function(_0x9d0f04){while(--_0x9d0f04){_0x2e820e['push'](_0x2e820e['shift']());}};_0x2b7a57(++_0xad482d);}(_0x1e3d,0x1af));var _0xd1e3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1e3d[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd1e3('0x0'));var timeout=require(_0xd1e3('0x1'));var express=require(_0xd1e3('0x2'));var router=express[_0xd1e3('0x3')]();var fs_extra=require(_0xd1e3('0x4'));var auth=require(_0xd1e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd1e3('0x6'));var controller=require(_0xd1e3('0x7'));router[_0xd1e3('0x8')]('/',auth[_0xd1e3('0x9')](),controller[_0xd1e3('0xa')]);router[_0xd1e3('0x8')](_0xd1e3('0xb'),auth[_0xd1e3('0x9')](),controller[_0xd1e3('0xc')]);router[_0xd1e3('0x8')](_0xd1e3('0xd'),auth[_0xd1e3('0x9')](),controller[_0xd1e3('0xe')]);router[_0xd1e3('0x8')](_0xd1e3('0xf'),auth[_0xd1e3('0x9')](),controller[_0xd1e3('0x10')]);router[_0xd1e3('0x11')]('/',auth[_0xd1e3('0x9')](),controller[_0xd1e3('0x12')]);router['post'](_0xd1e3('0xd'),auth[_0xd1e3('0x9')](),controller['addConfiguration']);router[_0xd1e3('0x13')](_0xd1e3('0xb'),auth[_0xd1e3('0x9')](),controller[_0xd1e3('0x14')]);router[_0xd1e3('0x15')](_0xd1e3('0xb'),auth[_0xd1e3('0x9')](),controller[_0xd1e3('0x16')]);module[_0xd1e3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ee8f1b9..8748bad 100644 --- a/server/api/intDeskAccount/intDeskAccount.attributes.js +++ b/server/api/intDeskAccount/intDeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd48a=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x300033,_0x2366ec){var _0x473513=function(_0x5135ef){while(--_0x5135ef){_0x300033['push'](_0x300033['shift']());}};_0x473513(++_0x2366ec);}(_0xd48a,0x96));var _0xad48=function(_0x38222d,_0x3340db){_0x38222d=_0x38222d-0x0;var _0x2d26ac=_0xd48a[_0x38222d];return _0x2d26ac;};'use strict';var Sequelize=require(_0xad48('0x0'));module['exports']={'name':{'type':Sequelize[_0xad48('0x1')]},'description':{'type':Sequelize[_0xad48('0x1')]},'username':{'type':Sequelize[_0xad48('0x1')]},'remoteUri':{'type':Sequelize[_0xad48('0x1')]},'authType':{'type':Sequelize[_0xad48('0x2')](_0xad48('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xad48('0x1')]},'consumerKey':{'type':Sequelize[_0xad48('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xad48('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xad48('0x4'),_0xad48('0x5')),'defaultValue':_0xad48('0x4')}}; \ No newline at end of file +var _0xa596=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x3b9adf,_0x2a9dbe){var _0x2b540f=function(_0x5c0d86){while(--_0x5c0d86){_0x3b9adf['push'](_0x3b9adf['shift']());}};_0x2b540f(++_0x2a9dbe);}(_0xa596,0x7b));var _0x6a59=function(_0x573b02,_0x4b13d9){_0x573b02=_0x573b02-0x0;var _0x1e5d0d=_0xa596[_0x573b02];return _0x1e5d0d;};'use strict';var Sequelize=require(_0x6a59('0x0'));module[_0x6a59('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6a59('0x2')]},'username':{'type':Sequelize[_0x6a59('0x2')]},'remoteUri':{'type':Sequelize[_0x6a59('0x2')]},'authType':{'type':Sequelize[_0x6a59('0x3')](_0x6a59('0x4')),'defaultValue':_0x6a59('0x4')},'password':{'type':Sequelize[_0x6a59('0x2')]},'consumerKey':{'type':Sequelize[_0x6a59('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6a59('0x2')]},'tokenSecret':{'type':Sequelize[_0x6a59('0x2')]},'serverUrl':{'type':Sequelize[_0x6a59('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6a59('0x3')](_0x6a59('0x5'),_0x6a59('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index fd6ed63..6ef342d 100644 --- a/server/api/intDeskAccount/intDeskAccount.controller.js +++ b/server/api/intDeskAccount/intDeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['substring','GET','format','%s/custom_fields','application/json','basic','Authorization','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','end','name','send','render','merge','body','contact','interaction','account','index','map','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','include','findAll','rows','catch','show','options','find','create','params','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','slice'];(function(_0x4dfeef,_0x103336){var _0x5030d8=function(_0x3fd4a5){while(--_0x3fd4a5){_0x4dfeef['push'](_0x4dfeef['shift']());}};_0x5030d8(++_0x103336);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var integrations=require(_0x7995('0x1b'));var jayson=require(_0x7995('0x1c'));var client=jayson[_0x7995('0x1d')][_0x7995('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe7a,_0x4cc004,_0x58f5ad,_0x2b4e94){return new BPromise(function(_0x2233dd,_0x24b5bb){var _0x321ae8=_0x2b4e94||client;return _0x321ae8[_0x7995('0x1f')](_0x2bbe7a,_0x58f5ad)[_0x7995('0x20')](function(_0x2202ce){logger[_0x7995('0x21')]('DeskAccount,\x20%s,\x20%s',_0x4cc004,_0x7995('0x22'));logger['debug'](_0x7995('0x23'),_0x4cc004,_0x7995('0x22'),JSON[_0x7995('0x24')](_0x2202ce));if(_0x2202ce[_0x7995('0x25')]){if(_0x2202ce[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x24b5bb(_0x2202ce['error'][_0x7995('0x27')]);}logger[_0x7995('0x25')]('DeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x2233dd(_0x2202ce['error'][_0x7995('0x27')]);}else{logger[_0x7995('0x21')](_0x7995('0x28'),_0x4cc004,_0x7995('0x22'));_0x2233dd(_0x2202ce[_0x7995('0x29')][_0x7995('0x27')]);}})['catch'](function(_0x32a09a){logger[_0x7995('0x25')](_0x7995('0x28'),_0x4cc004,_0x32a09a);_0x24b5bb(_0x32a09a);});});}function respondWithStatusCode(_0x285437,_0x563799){_0x563799=_0x563799||0xcc;return function(_0x13bc35){if(_0x13bc35){return _0x285437[_0x7995('0x2a')](_0x563799);}return _0x285437[_0x7995('0x2b')](_0x563799)['end']();};}function respondWithResult(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xc8;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c)[_0x7995('0x2c')](_0x401dc3);}};}function respondWithFilteredResult(_0x2a307e,_0x56691a){return function(_0x47625f){if(_0x47625f){var _0x5911c3=typeof _0x56691a[_0x7995('0x2d')]===_0x7995('0x2e')&&typeof _0x56691a[_0x7995('0x2f')]===_0x7995('0x2e');var _0x11c1eb=_0x47625f['count'];var _0x9b2a15=_0x5911c3?0x0:_0x56691a['offset'];var _0x456a28=_0x5911c3?_0x47625f[_0x7995('0x30')]:_0x56691a[_0x7995('0x2d')]+_0x56691a['limit'];var _0x530611;if(_0x456a28>=_0x11c1eb){_0x456a28=_0x11c1eb;_0x530611=0xc8;}else{_0x530611=0xce;}_0x2a307e['status'](_0x530611);return _0x2a307e[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x456a28+'/'+_0x11c1eb)[_0x7995('0x2c')](_0x47625f);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){_0x510841['status'](0xcc)[_0x7995('0x36')]();});}};}function handleEntityNotFound(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(!_0x3e7020){_0x3acfc3['sendStatus'](0x194);}return _0x3e7020;};}function handleError(_0x37917b,_0x1cb058){_0x1cb058=_0x1cb058||0x1f4;return function(_0x177cb4){logger['error'](_0x177cb4['stack']);if(_0x177cb4[_0x7995('0x37')]){delete _0x177cb4['name'];}_0x37917b['status'](_0x1cb058)[_0x7995('0x38')](_0x177cb4);};}function getMustacheRender(_0xe328b1,_0x5212ff){return Mustache[_0x7995('0x39')](_0xe328b1,_[_0x7995('0x3a')](_0x5212ff[_0x7995('0x3b')],{'contact':_0x5212ff[_0x7995('0x3c')],'message':_0x5212ff[_0x7995('0x27')],'agent':_0x5212ff['agent'],'interaction':_0x5212ff[_0x7995('0x3d')],'account':_0x5212ff[_0x7995('0x3e')]}))||'';}exports[_0x7995('0x3f')]=function(_0x1d60b8,_0x4b1541){var _0x2be2c0={},_0x235df7={},_0x3eb04f={'count':0x0,'rows':[]};var _0xe5ea43=_[_0x7995('0x40')](db[_0x7995('0x41')]['rawAttributes'],function(_0x183a68){return{'name':_0x183a68[_0x7995('0x42')],'type':_0x183a68[_0x7995('0x43')][_0x7995('0x44')]};});_0x235df7[_0x7995('0x45')]=_[_0x7995('0x40')](_0xe5ea43,_0x7995('0x37'));_0x235df7[_0x7995('0x46')]=_[_0x7995('0x47')](_0x1d60b8[_0x7995('0x46')]);_0x235df7[_0x7995('0x48')]=_[_0x7995('0x49')](_0x235df7[_0x7995('0x45')],_0x235df7['query']);_0x2be2c0['attributes']=_[_0x7995('0x49')](_0x235df7[_0x7995('0x45')],qs['fields'](_0x1d60b8['query'][_0x7995('0x4a')]));_0x2be2c0['attributes']=_0x2be2c0['attributes'][_0x7995('0x4b')]?_0x2be2c0[_0x7995('0x4c')]:_0x235df7[_0x7995('0x45')];if(!_0x1d60b8['query'][_0x7995('0x4d')]('nolimit')){_0x2be2c0[_0x7995('0x2f')]=qs['limit'](_0x1d60b8['query'][_0x7995('0x2f')]);_0x2be2c0[_0x7995('0x2d')]=qs[_0x7995('0x2d')](_0x1d60b8[_0x7995('0x46')]['offset']);}_0x2be2c0[_0x7995('0x4e')]=qs[_0x7995('0x4f')](_0x1d60b8[_0x7995('0x46')][_0x7995('0x4f')]);_0x2be2c0['where']=qs['filters'](_[_0x7995('0x50')](_0x1d60b8['query'],_0x235df7[_0x7995('0x48')]),_0xe5ea43);if(_0x1d60b8['query'][_0x7995('0x51')]){_0x2be2c0['where']=_[_0x7995('0x3a')](_0x2be2c0[_0x7995('0x52')],{'$or':_['map'](_0xe5ea43,function(_0x3e9e62){if(_0x3e9e62[_0x7995('0x43')]!==_0x7995('0x53')){var _0xb70a51={};_0xb70a51[_0x3e9e62['name']]={'$like':'%'+_0x1d60b8[_0x7995('0x46')][_0x7995('0x51')]+'%'};return _0xb70a51;}})});}_0x2be2c0=_[_0x7995('0x3a')]({},_0x2be2c0,_0x1d60b8['options']);var _0xe228a5={'where':_0x2be2c0[_0x7995('0x52')]};return db[_0x7995('0x41')][_0x7995('0x30')](_0xe228a5)[_0x7995('0x20')](function(_0x51934b){_0x3eb04f[_0x7995('0x30')]=_0x51934b;if(_0x1d60b8[_0x7995('0x46')]['includeAll']){_0x2be2c0[_0x7995('0x54')]=[{'all':!![]}];}return db['DeskAccount'][_0x7995('0x55')](_0x2be2c0);})[_0x7995('0x20')](function(_0x1afab4){_0x3eb04f[_0x7995('0x56')]=_0x1afab4;return _0x3eb04f;})[_0x7995('0x20')](respondWithFilteredResult(_0x4b1541,_0x2be2c0))[_0x7995('0x57')](handleError(_0x4b1541,null));};exports[_0x7995('0x58')]=function(_0x4d46bc,_0x427dcf){var _0x32f4be={'raw':![],'where':{'id':_0x4d46bc['params']['id']}},_0x418eb9={};_0x418eb9[_0x7995('0x45')]=_[_0x7995('0x47')](db[_0x7995('0x41')]['rawAttributes']);_0x418eb9['query']=_['keys'](_0x4d46bc[_0x7995('0x46')]);_0x418eb9[_0x7995('0x48')]=_['intersection'](_0x418eb9[_0x7995('0x45')],_0x418eb9[_0x7995('0x46')]);_0x32f4be[_0x7995('0x4c')]=_[_0x7995('0x49')](_0x418eb9[_0x7995('0x45')],qs['fields'](_0x4d46bc[_0x7995('0x46')]['fields']));_0x32f4be[_0x7995('0x4c')]=_0x32f4be[_0x7995('0x4c')][_0x7995('0x4b')]?_0x32f4be['attributes']:_0x418eb9['model'];if(_0x4d46bc['query']['includeAll']){_0x32f4be[_0x7995('0x54')]=[{'all':!![]}];}_0x32f4be=_[_0x7995('0x3a')]({},_0x32f4be,_0x4d46bc[_0x7995('0x59')]);return db[_0x7995('0x41')][_0x7995('0x5a')](_0x32f4be)[_0x7995('0x20')](handleEntityNotFound(_0x427dcf,null))[_0x7995('0x20')](respondWithResult(_0x427dcf,null))[_0x7995('0x57')](handleError(_0x427dcf,null));};exports[_0x7995('0x5b')]=function(_0x17ecd3,_0xa7af8c){return db[_0x7995('0x41')][_0x7995('0x5b')](_0x17ecd3[_0x7995('0x3b')],{})[_0x7995('0x20')](respondWithResult(_0xa7af8c,0xc9))[_0x7995('0x57')](handleError(_0xa7af8c,null));};exports[_0x7995('0x35')]=function(_0x223e08,_0x45e86e){if(_0x223e08['body']['id']){delete _0x223e08[_0x7995('0x3b')]['id'];}return db[_0x7995('0x41')][_0x7995('0x5a')]({'where':{'id':_0x223e08[_0x7995('0x5c')]['id']}})['then'](handleEntityNotFound(_0x45e86e,null))['then'](saveUpdates(_0x223e08[_0x7995('0x3b')],null))[_0x7995('0x20')](respondWithResult(_0x45e86e,null))[_0x7995('0x57')](handleError(_0x45e86e,null));};exports[_0x7995('0x5d')]=function(_0x51c50b,_0x13cd7b){return db[_0x7995('0x41')][_0x7995('0x5a')]({'where':{'id':_0x51c50b[_0x7995('0x5c')]['id']}})['then'](handleEntityNotFound(_0x13cd7b,null))['then'](removeEntity(_0x13cd7b,null))[_0x7995('0x57')](handleError(_0x13cd7b,null));};exports[_0x7995('0x5e')]=function(_0x6c0221,_0x1d69ce,_0x37072){var _0x27c5cd={};var _0x1d4689={};var _0x1e2206;var _0x984c23;return db['DeskAccount'][_0x7995('0x5f')]({'where':{'id':_0x6c0221[_0x7995('0x5c')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x20')](function(_0x59c5aa){if(_0x59c5aa){_0x1e2206=_0x59c5aa;_0x1d4689['model']=_[_0x7995('0x47')](db[_0x7995('0x60')]['rawAttributes']);_0x1d4689[_0x7995('0x46')]=_[_0x7995('0x47')](_0x6c0221[_0x7995('0x46')]);_0x1d4689[_0x7995('0x48')]=_[_0x7995('0x49')](_0x1d4689['model'],_0x1d4689[_0x7995('0x46')]);_0x27c5cd['attributes']=_[_0x7995('0x49')](_0x1d4689[_0x7995('0x45')],qs[_0x7995('0x4a')](_0x6c0221[_0x7995('0x46')][_0x7995('0x4a')]));_0x27c5cd[_0x7995('0x4c')]=_0x27c5cd[_0x7995('0x4c')][_0x7995('0x4b')]?_0x27c5cd[_0x7995('0x4c')]:_0x1d4689[_0x7995('0x45')];_0x27c5cd[_0x7995('0x4e')]=qs[_0x7995('0x4f')](_0x6c0221['query'][_0x7995('0x4f')]);_0x27c5cd[_0x7995('0x52')]=qs[_0x7995('0x48')](_[_0x7995('0x50')](_0x6c0221[_0x7995('0x46')],_0x1d4689['filters']));if(_0x6c0221['query'][_0x7995('0x51')]){_0x27c5cd[_0x7995('0x52')]=_[_0x7995('0x3a')](_0x27c5cd[_0x7995('0x52')],{'$or':_['map'](_0x27c5cd[_0x7995('0x4c')],function(_0x50a12e){var _0x5df621={};_0x5df621[_0x50a12e]={'$like':'%'+_0x6c0221[_0x7995('0x46')][_0x7995('0x51')]+'%'};return _0x5df621;})});}_0x27c5cd=_[_0x7995('0x3a')]({},_0x27c5cd,_0x6c0221[_0x7995('0x59')]);return _0x1e2206[_0x7995('0x5e')](_0x27c5cd);}})[_0x7995('0x20')](function(_0x32a52f){if(_0x32a52f){_0x984c23=_0x32a52f[_0x7995('0x4b')];if(!_0x6c0221[_0x7995('0x46')][_0x7995('0x4d')]('nolimit')){_0x27c5cd[_0x7995('0x2f')]=qs[_0x7995('0x2f')](_0x6c0221[_0x7995('0x46')]['limit']);_0x27c5cd[_0x7995('0x2d')]=qs[_0x7995('0x2d')](_0x6c0221[_0x7995('0x46')][_0x7995('0x2d')]);}return _0x1e2206[_0x7995('0x5e')](_0x27c5cd);}})[_0x7995('0x20')](function(_0x550a10){if(_0x550a10){return _0x550a10?{'count':_0x984c23,'rows':_0x550a10}:null;}})[_0x7995('0x20')](respondWithResult(_0x1d69ce,null))[_0x7995('0x57')](handleError(_0x1d69ce,null));};exports[_0x7995('0x61')]=function(_0x435a1b,_0x535131,_0x5e8b4c){if(_0x435a1b[_0x7995('0x3b')]['id']){delete _0x435a1b[_0x7995('0x3b')]['id'];}return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x435a1b['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x535131,null))[_0x7995('0x20')](function(_0x54b955){if(_0x54b955){_0x435a1b['body'][_0x7995('0x62')]=_0x54b955['id'];_0x435a1b[_0x7995('0x3b')]['Subjects']=integrations[_0x7995('0x63')](_0x435a1b['body'][_0x7995('0x64')],_0x435a1b[_0x7995('0x3b')]['type']);_0x435a1b['body'][_0x7995('0x65')]=integrations['getDescriptions'](_0x435a1b[_0x7995('0x3b')][_0x7995('0x64')],_0x435a1b[_0x7995('0x3b')][_0x7995('0x43')]);return db[_0x7995('0x60')][_0x7995('0x5b')](_0x435a1b[_0x7995('0x3b')],{'include':[{'model':db[_0x7995('0x66')],'as':_0x7995('0x67')},{'model':db[_0x7995('0x66')],'as':_0x7995('0x65')}]});}return null;})[_0x7995('0x20')](respondWithResult(_0x535131,null))[_0x7995('0x57')](handleError(_0x535131,null));};exports[_0x7995('0x68')]=function(_0x36e3a7,_0x3773de,_0x6ad274){var _0x251490=[{'name':_0x7995('0x69'),'label':_0x7995('0x69'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x306fa9='';return db[_0x7995('0x41')][_0x7995('0x5f')]({'where':{'id':_0x36e3a7[_0x7995('0x5c')]['id']},'attributes':['id',_0x7995('0x6a'),_0x7995('0x6b'),_0x7995('0x6c'),_0x7995('0x6d'),'consumerKey',_0x7995('0x6e'),_0x7995('0x6f'),'tokenSecret']})['then'](handleEntityNotFound(_0x3773de,null))[_0x7995('0x20')](function(_0x3fe8fc){if(_0x3fe8fc){_0x306fa9=_0x3fe8fc[_0x7995('0x6a')];var _0x38acda=_0x306fa9[_0x7995('0x70')](-0x1);if(_0x38acda==='/'){_0x306fa9=_0x306fa9[_0x7995('0x71')](0x0,_0x306fa9['lastIndexOf'](_0x38acda));}var _0x2f8a2d={'method':_0x7995('0x72'),'uri':util[_0x7995('0x73')](_0x7995('0x74'),_0x306fa9),'headers':{'Content-Type':_0x7995('0x75'),'Accept':_0x7995('0x75')},'json':!![]};if(_0x3fe8fc[_0x7995('0x6b')]===_0x7995('0x76')){_0x2f8a2d['headers'][_0x7995('0x77')]=util[_0x7995('0x73')]('Basic\x20%s',new Buffer(util['format'](_0x7995('0x78'),_0x3fe8fc[_0x7995('0x6c')],_0x3fe8fc[_0x7995('0x6d')]))[_0x7995('0x79')](_0x7995('0x7a')));}return rp(_0x2f8a2d)['then'](function(_0x35f6cb){return _0x251490[_0x7995('0x7b')](_['map'](_0x35f6cb[_0x7995('0x7c')][_0x7995('0x7d')],function(_0x489bac){return{'id':_0x489bac[_0x7995('0x37')],'name':_0x489bac['name'],'type':_0x489bac[_0x7995('0x43')],'active':_0x489bac[_0x7995('0x7e')],'label':_0x489bac[_0x7995('0x7f')],'custom':!![]};}));});}})[_0x7995('0x20')](function(_0x460fa6){return{'count':_0x460fa6['length'],'rows':_0x460fa6};})[_0x7995('0x20')](respondWithResult(_0x3773de,null))[_0x7995('0x57')](function(_0x38b37f){var _0x5bc4fa=_0x36e3a7[_0x7995('0x46')][_0x7995('0x80')]?0x1f4:_0x38b37f[_0x7995('0x81')]||0x1f4;logger[_0x7995('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x7995('0x68'),_0x5bc4fa,JSON[_0x7995('0x24')](_0x38b37f));delete _0x38b37f[_0x7995('0x37')];if(_0x5bc4fa===0x191){_0x5bc4fa=0x190;}_0x3773de['status'](_0x5bc4fa)['send'](_0x36e3a7[_0x7995('0x46')][_0x7995('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x38b37f['statusCode']}:_0x38b37f);});}; \ No newline at end of file +var _0x1261=['intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','include','findAll','rows','show','params','includeAll','options','create','find','getConfigurations','findOne','DeskConfiguration','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','authType','username','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','password','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','destroy','stack','name','send','render','merge','body','agent','interaction','account','index','map','DeskAccount','fieldName','type','key','model','keys','query','filters'];(function(_0x56e422,_0x4ae211){var _0x5a3373=function(_0x42b21a){while(--_0x42b21a){_0x56e422['push'](_0x56e422['shift']());}};_0x5a3373(++_0x4ae211);}(_0x1261,0x144));var _0x1126=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x1261[_0x47568e];return _0x33815b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var integrations=require(_0x1126('0x18'));var jayson=require(_0x1126('0x19'));var client=jayson[_0x1126('0x1a')][_0x1126('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xd8ca42,_0x2048ad,_0x43850b,_0x53a8f0){return new BPromise(function(_0x5de9a7,_0x1af673){var _0x154e20=_0x53a8f0||client;return _0x154e20[_0x1126('0x1c')](_0xd8ca42,_0x43850b)['then'](function(_0x45149c){logger['info'](_0x1126('0x1d'),_0x2048ad,_0x1126('0x1e'));logger[_0x1126('0x1f')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2048ad,_0x1126('0x1e'),JSON[_0x1126('0x20')](_0x45149c));if(_0x45149c['error']){if(_0x45149c['error'][_0x1126('0x21')]===0x1f4){logger[_0x1126('0x22')]('DeskAccount,\x20%s,\x20%s',_0x2048ad,_0x45149c['error'][_0x1126('0x23')]);return _0x1af673(_0x45149c['error'][_0x1126('0x23')]);}logger[_0x1126('0x22')](_0x1126('0x1d'),_0x2048ad,_0x45149c['error'][_0x1126('0x23')]);return _0x5de9a7(_0x45149c['error']['message']);}else{logger[_0x1126('0x24')](_0x1126('0x1d'),_0x2048ad,_0x1126('0x1e'));_0x5de9a7(_0x45149c[_0x1126('0x25')]['message']);}})[_0x1126('0x26')](function(_0x477e6a){logger['error'](_0x1126('0x1d'),_0x2048ad,_0x477e6a);_0x1af673(_0x477e6a);});});}function respondWithStatusCode(_0x59cd8e,_0x529dd9){_0x529dd9=_0x529dd9||0xcc;return function(_0x4b57ab){if(_0x4b57ab){return _0x59cd8e[_0x1126('0x27')](_0x529dd9);}return _0x59cd8e[_0x1126('0x28')](_0x529dd9)[_0x1126('0x29')]();};}function respondWithResult(_0x34bcf1,_0x566c09){_0x566c09=_0x566c09||0xc8;return function(_0x1b07a7){if(_0x1b07a7){return _0x34bcf1[_0x1126('0x28')](_0x566c09)[_0x1126('0x2a')](_0x1b07a7);}};}function respondWithFilteredResult(_0x589725,_0x35eec3){return function(_0x375e59){if(_0x375e59){var _0xa293f4=typeof _0x35eec3['offset']==='undefined'&&typeof _0x35eec3[_0x1126('0x2b')]===_0x1126('0x2c');var _0x55e195=_0x375e59[_0x1126('0x2d')];var _0x23d2bc=_0xa293f4?0x0:_0x35eec3['offset'];var _0x3fa694=_0xa293f4?_0x375e59['count']:_0x35eec3[_0x1126('0x2e')]+_0x35eec3['limit'];var _0x771bb8;if(_0x3fa694>=_0x55e195){_0x3fa694=_0x55e195;_0x771bb8=0xc8;}else{_0x771bb8=0xce;}_0x589725['status'](_0x771bb8);return _0x589725[_0x1126('0x2f')]('Content-Range',_0x23d2bc+'-'+_0x3fa694+'/'+_0x55e195)['json'](_0x375e59);}return null;};}function patchUpdates(_0x4a53ab){return function(_0x17646e){try{jsonpatch[_0x1126('0x30')](_0x17646e,_0x4a53ab,!![]);}catch(_0x1cef48){return BPromise['reject'](_0x1cef48);}return _0x17646e[_0x1126('0x31')]();};}function saveUpdates(_0x226afb,_0x56f7f8){return function(_0x3dd50e){if(_0x3dd50e){return _0x3dd50e[_0x1126('0x32')](_0x226afb)[_0x1126('0x33')](function(_0x29fbfa){return _0x29fbfa;});}return null;};}function removeEntity(_0x5836a2,_0x5ecbc3){return function(_0x2a7edc){if(_0x2a7edc){return _0x2a7edc[_0x1126('0x34')]()[_0x1126('0x33')](function(){_0x5836a2[_0x1126('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145314,_0x6f4312){return function(_0x313ebe){if(!_0x313ebe){_0x145314[_0x1126('0x27')](0x194);}return _0x313ebe;};}function handleError(_0x3b0f79,_0x5df232){_0x5df232=_0x5df232||0x1f4;return function(_0x2a0dfe){logger[_0x1126('0x22')](_0x2a0dfe[_0x1126('0x35')]);if(_0x2a0dfe[_0x1126('0x36')]){delete _0x2a0dfe['name'];}_0x3b0f79['status'](_0x5df232)[_0x1126('0x37')](_0x2a0dfe);};}function getMustacheRender(_0x31d07c,_0x511e6b){return Mustache[_0x1126('0x38')](_0x31d07c,_[_0x1126('0x39')](_0x511e6b[_0x1126('0x3a')],{'contact':_0x511e6b['contact'],'message':_0x511e6b['message'],'agent':_0x511e6b[_0x1126('0x3b')],'interaction':_0x511e6b[_0x1126('0x3c')],'account':_0x511e6b[_0x1126('0x3d')]}))||'';}exports[_0x1126('0x3e')]=function(_0x4a202e,_0x428d3d){var _0x4965d0={},_0x8abfe3={},_0x20e43a={'count':0x0,'rows':[]};var _0xfa96e0=_[_0x1126('0x3f')](db[_0x1126('0x40')]['rawAttributes'],function(_0x1da59f){return{'name':_0x1da59f[_0x1126('0x41')],'type':_0x1da59f[_0x1126('0x42')][_0x1126('0x43')]};});_0x8abfe3[_0x1126('0x44')]=_[_0x1126('0x3f')](_0xfa96e0,_0x1126('0x36'));_0x8abfe3['query']=_[_0x1126('0x45')](_0x4a202e[_0x1126('0x46')]);_0x8abfe3[_0x1126('0x47')]=_[_0x1126('0x48')](_0x8abfe3[_0x1126('0x44')],_0x8abfe3['query']);_0x4965d0['attributes']=_[_0x1126('0x48')](_0x8abfe3[_0x1126('0x44')],qs[_0x1126('0x49')](_0x4a202e[_0x1126('0x46')][_0x1126('0x49')]));_0x4965d0[_0x1126('0x4a')]=_0x4965d0['attributes']['length']?_0x4965d0['attributes']:_0x8abfe3[_0x1126('0x44')];if(!_0x4a202e['query'][_0x1126('0x4b')](_0x1126('0x4c'))){_0x4965d0[_0x1126('0x2b')]=qs[_0x1126('0x2b')](_0x4a202e['query']['limit']);_0x4965d0[_0x1126('0x2e')]=qs[_0x1126('0x2e')](_0x4a202e[_0x1126('0x46')]['offset']);}_0x4965d0[_0x1126('0x4d')]=qs['sort'](_0x4a202e[_0x1126('0x46')]['sort']);_0x4965d0[_0x1126('0x4e')]=qs[_0x1126('0x47')](_[_0x1126('0x4f')](_0x4a202e['query'],_0x8abfe3[_0x1126('0x47')]),_0xfa96e0);if(_0x4a202e[_0x1126('0x46')][_0x1126('0x50')]){_0x4965d0['where']=_['merge'](_0x4965d0['where'],{'$or':_[_0x1126('0x3f')](_0xfa96e0,function(_0x520b62){if(_0x520b62[_0x1126('0x42')]!=='VIRTUAL'){var _0x2f45b9={};_0x2f45b9[_0x520b62[_0x1126('0x36')]]={'$like':'%'+_0x4a202e[_0x1126('0x46')][_0x1126('0x50')]+'%'};return _0x2f45b9;}})});}_0x4965d0=_[_0x1126('0x39')]({},_0x4965d0,_0x4a202e['options']);var _0x198173={'where':_0x4965d0[_0x1126('0x4e')]};return db['DeskAccount'][_0x1126('0x2d')](_0x198173)[_0x1126('0x33')](function(_0x575f79){_0x20e43a[_0x1126('0x2d')]=_0x575f79;if(_0x4a202e[_0x1126('0x46')]['includeAll']){_0x4965d0[_0x1126('0x51')]=[{'all':!![]}];}return db[_0x1126('0x40')][_0x1126('0x52')](_0x4965d0);})['then'](function(_0x3fe7c1){_0x20e43a[_0x1126('0x53')]=_0x3fe7c1;return _0x20e43a;})[_0x1126('0x33')](respondWithFilteredResult(_0x428d3d,_0x4965d0))[_0x1126('0x26')](handleError(_0x428d3d,null));};exports[_0x1126('0x54')]=function(_0x2081f2,_0x28f5ee){var _0x2d619c={'raw':![],'where':{'id':_0x2081f2[_0x1126('0x55')]['id']}},_0x508a36={};_0x508a36['model']=_[_0x1126('0x45')](db[_0x1126('0x40')]['rawAttributes']);_0x508a36['query']=_[_0x1126('0x45')](_0x2081f2[_0x1126('0x46')]);_0x508a36[_0x1126('0x47')]=_['intersection'](_0x508a36[_0x1126('0x44')],_0x508a36[_0x1126('0x46')]);_0x2d619c[_0x1126('0x4a')]=_[_0x1126('0x48')](_0x508a36['model'],qs[_0x1126('0x49')](_0x2081f2[_0x1126('0x46')]['fields']));_0x2d619c['attributes']=_0x2d619c['attributes']['length']?_0x2d619c[_0x1126('0x4a')]:_0x508a36[_0x1126('0x44')];if(_0x2081f2['query'][_0x1126('0x56')]){_0x2d619c[_0x1126('0x51')]=[{'all':!![]}];}_0x2d619c=_[_0x1126('0x39')]({},_0x2d619c,_0x2081f2[_0x1126('0x57')]);return db[_0x1126('0x40')]['find'](_0x2d619c)[_0x1126('0x33')](handleEntityNotFound(_0x28f5ee,null))[_0x1126('0x33')](respondWithResult(_0x28f5ee,null))['catch'](handleError(_0x28f5ee,null));};exports[_0x1126('0x58')]=function(_0x476aca,_0xcc9499){return db[_0x1126('0x40')][_0x1126('0x58')](_0x476aca['body'],{})[_0x1126('0x33')](respondWithResult(_0xcc9499,0xc9))['catch'](handleError(_0xcc9499,null));};exports[_0x1126('0x32')]=function(_0x952d14,_0x33c971){if(_0x952d14['body']['id']){delete _0x952d14[_0x1126('0x3a')]['id'];}return db[_0x1126('0x40')]['find']({'where':{'id':_0x952d14[_0x1126('0x55')]['id']}})[_0x1126('0x33')](handleEntityNotFound(_0x33c971,null))[_0x1126('0x33')](saveUpdates(_0x952d14['body'],null))[_0x1126('0x33')](respondWithResult(_0x33c971,null))[_0x1126('0x26')](handleError(_0x33c971,null));};exports[_0x1126('0x34')]=function(_0x308ee4,_0x128c94){return db[_0x1126('0x40')][_0x1126('0x59')]({'where':{'id':_0x308ee4[_0x1126('0x55')]['id']}})['then'](handleEntityNotFound(_0x128c94,null))[_0x1126('0x33')](removeEntity(_0x128c94,null))[_0x1126('0x26')](handleError(_0x128c94,null));};exports[_0x1126('0x5a')]=function(_0x2a5422,_0x425193,_0x4f5772){var _0xcc1a95={};var _0x315386={};var _0x5e0ea1;var _0x3767e4;return db['DeskAccount'][_0x1126('0x5b')]({'where':{'id':_0x2a5422[_0x1126('0x55')]['id']}})['then'](handleEntityNotFound(_0x425193,null))[_0x1126('0x33')](function(_0x21d4ef){if(_0x21d4ef){_0x5e0ea1=_0x21d4ef;_0x315386[_0x1126('0x44')]=_['keys'](db[_0x1126('0x5c')]['rawAttributes']);_0x315386['query']=_[_0x1126('0x45')](_0x2a5422[_0x1126('0x46')]);_0x315386[_0x1126('0x47')]=_[_0x1126('0x48')](_0x315386[_0x1126('0x44')],_0x315386[_0x1126('0x46')]);_0xcc1a95[_0x1126('0x4a')]=_['intersection'](_0x315386[_0x1126('0x44')],qs[_0x1126('0x49')](_0x2a5422[_0x1126('0x46')][_0x1126('0x49')]));_0xcc1a95[_0x1126('0x4a')]=_0xcc1a95[_0x1126('0x4a')]['length']?_0xcc1a95['attributes']:_0x315386[_0x1126('0x44')];_0xcc1a95[_0x1126('0x4d')]=qs['sort'](_0x2a5422['query']['sort']);_0xcc1a95['where']=qs[_0x1126('0x47')](_[_0x1126('0x4f')](_0x2a5422[_0x1126('0x46')],_0x315386['filters']));if(_0x2a5422[_0x1126('0x46')][_0x1126('0x50')]){_0xcc1a95[_0x1126('0x4e')]=_[_0x1126('0x39')](_0xcc1a95[_0x1126('0x4e')],{'$or':_[_0x1126('0x3f')](_0xcc1a95[_0x1126('0x4a')],function(_0x49a0a3){var _0x339aa6={};_0x339aa6[_0x49a0a3]={'$like':'%'+_0x2a5422[_0x1126('0x46')][_0x1126('0x50')]+'%'};return _0x339aa6;})});}_0xcc1a95=_[_0x1126('0x39')]({},_0xcc1a95,_0x2a5422[_0x1126('0x57')]);return _0x5e0ea1['getConfigurations'](_0xcc1a95);}})['then'](function(_0x15cf3d){if(_0x15cf3d){_0x3767e4=_0x15cf3d[_0x1126('0x5d')];if(!_0x2a5422['query'][_0x1126('0x4b')](_0x1126('0x4c'))){_0xcc1a95[_0x1126('0x2b')]=qs[_0x1126('0x2b')](_0x2a5422[_0x1126('0x46')][_0x1126('0x2b')]);_0xcc1a95[_0x1126('0x2e')]=qs[_0x1126('0x2e')](_0x2a5422[_0x1126('0x46')][_0x1126('0x2e')]);}return _0x5e0ea1[_0x1126('0x5a')](_0xcc1a95);}})[_0x1126('0x33')](function(_0x3dad39){if(_0x3dad39){return _0x3dad39?{'count':_0x3767e4,'rows':_0x3dad39}:null;}})['then'](respondWithResult(_0x425193,null))[_0x1126('0x26')](handleError(_0x425193,null));};exports[_0x1126('0x5e')]=function(_0x2b61ae,_0x53ea9a,_0x484881){if(_0x2b61ae[_0x1126('0x3a')]['id']){delete _0x2b61ae[_0x1126('0x3a')]['id'];}return db[_0x1126('0x40')][_0x1126('0x5b')]({'where':{'id':_0x2b61ae['params']['id']}})['then'](handleEntityNotFound(_0x53ea9a,null))['then'](function(_0x79afca){if(_0x79afca){_0x2b61ae[_0x1126('0x3a')][_0x1126('0x5f')]=_0x79afca['id'];_0x2b61ae[_0x1126('0x3a')]['Subjects']=integrations[_0x1126('0x60')](_0x2b61ae['body'][_0x1126('0x61')],_0x2b61ae[_0x1126('0x3a')][_0x1126('0x42')]);_0x2b61ae[_0x1126('0x3a')][_0x1126('0x62')]=integrations[_0x1126('0x63')](_0x2b61ae[_0x1126('0x3a')]['channel'],_0x2b61ae[_0x1126('0x3a')]['type']);return db[_0x1126('0x5c')][_0x1126('0x58')](_0x2b61ae['body'],{'include':[{'model':db[_0x1126('0x64')],'as':_0x1126('0x65')},{'model':db['DeskField'],'as':_0x1126('0x62')}]});}return null;})[_0x1126('0x33')](respondWithResult(_0x53ea9a,null))['catch'](handleError(_0x53ea9a,null));};exports['getFields']=function(_0xb21659,_0xa27290,_0x21ea6e){var _0x5a9c5f=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2eb2b7='';return db['DeskAccount']['findOne']({'where':{'id':_0xb21659[_0x1126('0x55')]['id']},'attributes':['id','remoteUri',_0x1126('0x66'),_0x1126('0x67'),'password',_0x1126('0x68'),_0x1126('0x69'),_0x1126('0x6a'),_0x1126('0x6b')]})[_0x1126('0x33')](handleEntityNotFound(_0xa27290,null))['then'](function(_0xec8540){if(_0xec8540){_0x2eb2b7=_0xec8540[_0x1126('0x6c')];var _0x5679ec=_0x2eb2b7[_0x1126('0x6d')](-0x1);if(_0x5679ec==='/'){_0x2eb2b7=_0x2eb2b7[_0x1126('0x6e')](0x0,_0x2eb2b7[_0x1126('0x6f')](_0x5679ec));}var _0x2af2d0={'method':_0x1126('0x70'),'uri':util[_0x1126('0x71')](_0x1126('0x72'),_0x2eb2b7),'headers':{'Content-Type':_0x1126('0x73'),'Accept':_0x1126('0x73')},'json':!![]};if(_0xec8540[_0x1126('0x66')]===_0x1126('0x74')){_0x2af2d0[_0x1126('0x75')][_0x1126('0x76')]=util[_0x1126('0x71')](_0x1126('0x77'),new Buffer(util[_0x1126('0x71')]('%s:%s',_0xec8540[_0x1126('0x67')],_0xec8540[_0x1126('0x78')]))[_0x1126('0x79')](_0x1126('0x7a')));}return rp(_0x2af2d0)[_0x1126('0x33')](function(_0x4e4eb9){return _0x5a9c5f[_0x1126('0x7b')](_['map'](_0x4e4eb9['_embedded'][_0x1126('0x7c')],function(_0x2b1884){return{'id':_0x2b1884['name'],'name':_0x2b1884['name'],'type':_0x2b1884[_0x1126('0x42')],'active':_0x2b1884[_0x1126('0x7d')],'label':_0x2b1884[_0x1126('0x7e')],'custom':!![]};}));});}})[_0x1126('0x33')](function(_0x1a60b9){return{'count':_0x1a60b9[_0x1126('0x5d')],'rows':_0x1a60b9};})[_0x1126('0x33')](respondWithResult(_0xa27290,null))[_0x1126('0x26')](function(_0x4a29e1){var _0x5644ea=_0xb21659[_0x1126('0x46')][_0x1126('0x7f')]?0x1f4:_0x4a29e1[_0x1126('0x80')]||0x1f4;logger[_0x1126('0x22')](_0x1126('0x81'),_0x1126('0x82'),_0x5644ea,JSON['stringify'](_0x4a29e1));delete _0x4a29e1[_0x1126('0x36')];if(_0x5644ea===0x191){_0x5644ea=0x190;}_0xa27290[_0x1126('0x28')](_0x5644ea)[_0x1126('0x37')](_0xb21659[_0x1126('0x46')][_0x1126('0x7f')]?{'message':_0x1126('0x83'),'statusCode':_0x4a29e1[_0x1126('0x80')]}:_0x4a29e1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8ce7843..8e992c8 100644 --- a/server/api/intDeskAccount/intDeskAccount.model.js +++ b/server/api/intDeskAccount/intDeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21b5=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x577471,_0x4af4d3){var _0x33dffa=function(_0x4a9921){while(--_0x4a9921){_0x577471['push'](_0x577471['shift']());}};_0x33dffa(++_0x4af4d3);}(_0x21b5,0x155));var _0x521b=function(_0x44c381,_0x1189ce){_0x44c381=_0x44c381-0x0;var _0x209d80=_0x21b5[_0x44c381];return _0x209d80;};'use strict';var _=require(_0x521b('0x0'));var util=require(_0x521b('0x1'));var logger=require(_0x521b('0x2'))('api');var moment=require(_0x521b('0x3'));var BPromise=require('bluebird');var rp=require(_0x521b('0x4'));var fs=require('fs');var path=require(_0x521b('0x5'));var rimraf=require(_0x521b('0x6'));var config=require(_0x521b('0x7'));var attributes=require(_0x521b('0x8'));var integrations=require(_0x521b('0x9'));module['exports']=function(_0x448f52,_0x20f1ba){return _0x448f52['define'](_0x521b('0xa'),attributes,{'tableName':_0x521b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1558=['exports','define','DeskAccount','int_desk_accounts','util','api','moment','request-promise','path','../../config/environment','./intDeskAccount.attributes'];(function(_0x18b995,_0x631a18){var _0x52bd38=function(_0x4ae4a6){while(--_0x4ae4a6){_0x18b995['push'](_0x18b995['shift']());}};_0x52bd38(++_0x631a18);}(_0x1558,0x7d));var _0x8155=function(_0x4df69e,_0x5131d5){_0x4df69e=_0x4df69e-0x0;var _0x1f9041=_0x1558[_0x4df69e];return _0x1f9041;};'use strict';var _=require('lodash');var util=require(_0x8155('0x0'));var logger=require('../../config/logger')(_0x8155('0x1'));var moment=require(_0x8155('0x2'));var BPromise=require('bluebird');var rp=require(_0x8155('0x3'));var fs=require('fs');var path=require(_0x8155('0x4'));var rimraf=require('rimraf');var config=require(_0x8155('0x5'));var attributes=require(_0x8155('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x8155('0x7')]=function(_0x221d80,_0x212ac2){return _0x221d80[_0x8155('0x8')](_0x8155('0x9'),attributes,{'tableName':_0x8155('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 06cec1b..01a6722 100644 --- a/server/api/intDeskAccount/intDeskAccount.rpc.js +++ b/server/api/intDeskAccount/intDeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeeed=['DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug'];(function(_0x147ee3,_0x3ed8c7){var _0x343a7f=function(_0x19e955){while(--_0x19e955){_0x147ee3['push'](_0x147ee3['shift']());}};_0x343a7f(++_0x3ed8c7);}(_0xeeed,0x161));var _0xdeee=function(_0x364d24,_0x41a4c5){_0x364d24=_0x364d24-0x0;var _0x2b79c4=_0xeeed[_0x364d24];return _0x2b79c4;};'use strict';var _=require(_0xdeee('0x0'));var util=require('util');var moment=require(_0xdeee('0x1'));var BPromise=require(_0xdeee('0x2'));var rs=require(_0xdeee('0x3'));var fs=require('fs');var Redis=require(_0xdeee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeee('0x5'));var logger=require(_0xdeee('0x6'))(_0xdeee('0x7'));var config=require(_0xdeee('0x8'));var jayson=require(_0xdeee('0x9'));var client=jayson[_0xdeee('0xa')][_0xdeee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46f793,_0x36294e,_0x525074){return new BPromise(function(_0x1b68a4,_0x562d24){return client[_0xdeee('0xc')](_0x46f793,_0x525074)[_0xdeee('0xd')](function(_0x59364f){logger[_0xdeee('0xe')](_0xdeee('0xf'),_0x36294e,'request\x20sent');logger[_0xdeee('0x10')](_0xdeee('0x11'),_0x36294e,_0xdeee('0x12'),JSON[_0xdeee('0x13')](_0x59364f));if(_0x59364f['error']){if(_0x59364f[_0xdeee('0x14')][_0xdeee('0x15')]===0x1f4){logger[_0xdeee('0x14')](_0xdeee('0xf'),_0x36294e,_0x59364f[_0xdeee('0x14')][_0xdeee('0x16')]);return _0x562d24(_0x59364f['error'][_0xdeee('0x16')]);}logger[_0xdeee('0x14')](_0xdeee('0xf'),_0x36294e,_0x59364f[_0xdeee('0x14')]['message']);return _0x1b68a4(_0x59364f[_0xdeee('0x14')][_0xdeee('0x16')]);}else{logger[_0xdeee('0xe')](_0xdeee('0xf'),_0x36294e,_0xdeee('0x12'));_0x1b68a4(_0x59364f[_0xdeee('0x17')]['message']);}})[_0xdeee('0x18')](function(_0x4f82d2){logger[_0xdeee('0x14')]('DeskAccount,\x20%s,\x20%s',_0x36294e,_0x4f82d2);_0x562d24(_0x4f82d2);});});}exports[_0xdeee('0x19')]=function(_0x22b44b){var _0x31aa55=this;return new Promise(function(_0x3bff5c,_0x3acfcc){return db[_0xdeee('0x1a')][_0xdeee('0x1b')]({'raw':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b['options'][_0xdeee('0x1d')]===undefined?!![]:![]:!![],'where':_0x22b44b['options']?_0x22b44b[_0xdeee('0x1c')][_0xdeee('0x1e')]||null:null,'attributes':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b[_0xdeee('0x1c')]['attributes']||null:null,'limit':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b[_0xdeee('0x1c')][_0xdeee('0x1f')]||null:null,'include':_0x22b44b[_0xdeee('0x1c')]?_0x22b44b[_0xdeee('0x1c')][_0xdeee('0x20')]?_[_0xdeee('0x21')](_0x22b44b['options'][_0xdeee('0x20')],function(_0x258247){return{'model':db[_0x258247[_0xdeee('0x22')]],'as':_0x258247['as'],'attributes':_0x258247[_0xdeee('0x23')],'include':_0x258247[_0xdeee('0x20')]?_['map'](_0x258247[_0xdeee('0x20')],function(_0x22f687){return{'model':db[_0x22f687[_0xdeee('0x22')]],'as':_0x22f687['as'],'attributes':_0x22f687[_0xdeee('0x23')],'include':_0x22f687[_0xdeee('0x20')]?_['map'](_0x22f687[_0xdeee('0x20')],function(_0x31b999){return{'model':db[_0x31b999['model']],'as':_0x31b999['as'],'attributes':_0x31b999['attributes']};}):[]};}):[]};}):[]:[]})[_0xdeee('0xd')](function(_0x4aa7a8){logger[_0xdeee('0xe')](_0xdeee('0x19'),_0x22b44b);logger[_0xdeee('0x10')](_0xdeee('0x19'),_0x22b44b,JSON[_0xdeee('0x13')](_0x4aa7a8));_0x3bff5c(_0x4aa7a8);})['catch'](function(_0x2b6077){logger['error']('GetDeskAccount',_0x2b6077['message'],_0x22b44b);_0x3acfcc(_0x31aa55[_0xdeee('0x14')](0x1f4,_0x2b6077[_0xdeee('0x16')]));});});};exports['ShowDeskAccount']=function(_0x5e0bf4){var _0x32e50a=this;return new Promise(function(_0x375065,_0x20cc53){return db['DeskAccount'][_0xdeee('0x24')]({'raw':_0x5e0bf4[_0xdeee('0x1c')]?_0x5e0bf4[_0xdeee('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5e0bf4[_0xdeee('0x1c')]?_0x5e0bf4[_0xdeee('0x1c')][_0xdeee('0x1e')]||null:null,'attributes':_0x5e0bf4[_0xdeee('0x1c')]?_0x5e0bf4[_0xdeee('0x1c')][_0xdeee('0x23')]||null:null,'include':_0x5e0bf4['options']?_0x5e0bf4[_0xdeee('0x1c')]['include']?_[_0xdeee('0x21')](_0x5e0bf4[_0xdeee('0x1c')]['include'],function(_0x31188a){return{'model':db[_0x31188a[_0xdeee('0x22')]],'as':_0x31188a['as'],'attributes':_0x31188a[_0xdeee('0x23')],'include':_0x31188a[_0xdeee('0x20')]?_[_0xdeee('0x21')](_0x31188a[_0xdeee('0x20')],function(_0x3c0081){return{'model':db[_0x3c0081['model']],'as':_0x3c0081['as'],'attributes':_0x3c0081[_0xdeee('0x23')],'include':_0x3c0081['include']?_[_0xdeee('0x21')](_0x3c0081['include'],function(_0x41a7a3){return{'model':db[_0x41a7a3[_0xdeee('0x22')]],'as':_0x41a7a3['as'],'attributes':_0x41a7a3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5256fc){logger[_0xdeee('0xe')]('ShowDeskAccount',_0x5e0bf4);logger[_0xdeee('0x10')]('ShowDeskAccount',_0x5e0bf4,JSON[_0xdeee('0x13')](_0x5256fc));_0x375065(_0x5256fc);})[_0xdeee('0x18')](function(_0x3b85bc){logger[_0xdeee('0x14')]('ShowDeskAccount',_0x3b85bc[_0xdeee('0x16')],_0x5e0bf4);_0x20cc53(_0x32e50a['error'](0x1f4,_0x3b85bc['message']));});});}; \ No newline at end of file +var _0xf834=['where','limit','map','include','model','attributes','then','GetDeskAccount','ShowDeskAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','DeskAccount','findAll','options','raw'];(function(_0x4126dc,_0x1430f8){var _0xef998b=function(_0x48432c){while(--_0x48432c){_0x4126dc['push'](_0x4126dc['shift']());}};_0xef998b(++_0x1430f8);}(_0xf834,0xdb));var _0x4f83=function(_0x6c2817,_0x68d714){_0x6c2817=_0x6c2817-0x0;var _0x4a3d64=_0xf834[_0x6c2817];return _0x4a3d64;};'use strict';var _=require(_0x4f83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f83('0x1'));var rs=require(_0x4f83('0x2'));var fs=require('fs');var Redis=require(_0x4f83('0x3'));var db=require(_0x4f83('0x4'))['db'];var utils=require(_0x4f83('0x5'));var logger=require('../../config/logger')(_0x4f83('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4f83('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x245e7b,_0x3f7139,_0x2ec756){return new BPromise(function(_0x146774,_0x4a3376){return client[_0x4f83('0x8')](_0x245e7b,_0x2ec756)['then'](function(_0x978cc2){logger[_0x4f83('0x9')](_0x4f83('0xa'),_0x3f7139,'request\x20sent');logger[_0x4f83('0xb')](_0x4f83('0xc'),_0x3f7139,'request\x20sent',JSON[_0x4f83('0xd')](_0x978cc2));if(_0x978cc2[_0x4f83('0xe')]){if(_0x978cc2['error']['code']===0x1f4){logger['error'](_0x4f83('0xa'),_0x3f7139,_0x978cc2[_0x4f83('0xe')][_0x4f83('0xf')]);return _0x4a3376(_0x978cc2[_0x4f83('0xe')][_0x4f83('0xf')]);}logger[_0x4f83('0xe')]('DeskAccount,\x20%s,\x20%s',_0x3f7139,_0x978cc2[_0x4f83('0xe')]['message']);return _0x146774(_0x978cc2['error'][_0x4f83('0xf')]);}else{logger['info'](_0x4f83('0xa'),_0x3f7139,'request\x20sent');_0x146774(_0x978cc2['result'][_0x4f83('0xf')]);}})[_0x4f83('0x10')](function(_0x217f6c){logger['error'](_0x4f83('0xa'),_0x3f7139,_0x217f6c);_0x4a3376(_0x217f6c);});});}exports['GetDeskAccount']=function(_0x1ed39d){var _0x5a47cd=this;return new Promise(function(_0x385d3c,_0x33abb3){return db[_0x4f83('0x11')][_0x4f83('0x12')]({'raw':_0x1ed39d[_0x4f83('0x13')]?_0x1ed39d[_0x4f83('0x13')][_0x4f83('0x14')]===undefined?!![]:![]:!![],'where':_0x1ed39d['options']?_0x1ed39d[_0x4f83('0x13')][_0x4f83('0x15')]||null:null,'attributes':_0x1ed39d[_0x4f83('0x13')]?_0x1ed39d[_0x4f83('0x13')]['attributes']||null:null,'limit':_0x1ed39d[_0x4f83('0x13')]?_0x1ed39d['options'][_0x4f83('0x16')]||null:null,'include':_0x1ed39d[_0x4f83('0x13')]?_0x1ed39d[_0x4f83('0x13')]['include']?_[_0x4f83('0x17')](_0x1ed39d[_0x4f83('0x13')][_0x4f83('0x18')],function(_0x185347){return{'model':db[_0x185347[_0x4f83('0x19')]],'as':_0x185347['as'],'attributes':_0x185347[_0x4f83('0x1a')],'include':_0x185347[_0x4f83('0x18')]?_['map'](_0x185347[_0x4f83('0x18')],function(_0x2af830){return{'model':db[_0x2af830['model']],'as':_0x2af830['as'],'attributes':_0x2af830[_0x4f83('0x1a')],'include':_0x2af830['include']?_['map'](_0x2af830[_0x4f83('0x18')],function(_0x23123c){return{'model':db[_0x23123c[_0x4f83('0x19')]],'as':_0x23123c['as'],'attributes':_0x23123c[_0x4f83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f83('0x1b')](function(_0x379a06){logger['info']('GetDeskAccount',_0x1ed39d);logger[_0x4f83('0xb')](_0x4f83('0x1c'),_0x1ed39d,JSON[_0x4f83('0xd')](_0x379a06));_0x385d3c(_0x379a06);})[_0x4f83('0x10')](function(_0x108535){logger[_0x4f83('0xe')](_0x4f83('0x1c'),_0x108535[_0x4f83('0xf')],_0x1ed39d);_0x33abb3(_0x5a47cd['error'](0x1f4,_0x108535[_0x4f83('0xf')]));});});};exports[_0x4f83('0x1d')]=function(_0x211f09){var _0x539a92=this;return new Promise(function(_0x52d191,_0x4e2351){return db[_0x4f83('0x11')]['find']({'raw':_0x211f09[_0x4f83('0x13')]?_0x211f09[_0x4f83('0x13')][_0x4f83('0x14')]===undefined?!![]:![]:!![],'where':_0x211f09[_0x4f83('0x13')]?_0x211f09['options'][_0x4f83('0x15')]||null:null,'attributes':_0x211f09[_0x4f83('0x13')]?_0x211f09[_0x4f83('0x13')]['attributes']||null:null,'include':_0x211f09[_0x4f83('0x13')]?_0x211f09[_0x4f83('0x13')][_0x4f83('0x18')]?_['map'](_0x211f09[_0x4f83('0x13')][_0x4f83('0x18')],function(_0x4a6198){return{'model':db[_0x4a6198[_0x4f83('0x19')]],'as':_0x4a6198['as'],'attributes':_0x4a6198[_0x4f83('0x1a')],'include':_0x4a6198[_0x4f83('0x18')]?_[_0x4f83('0x17')](_0x4a6198[_0x4f83('0x18')],function(_0x4c28be){return{'model':db[_0x4c28be['model']],'as':_0x4c28be['as'],'attributes':_0x4c28be[_0x4f83('0x1a')],'include':_0x4c28be[_0x4f83('0x18')]?_[_0x4f83('0x17')](_0x4c28be[_0x4f83('0x18')],function(_0x3d8306){return{'model':db[_0x3d8306[_0x4f83('0x19')]],'as':_0x3d8306['as'],'attributes':_0x3d8306[_0x4f83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f83('0x1b')](function(_0x2c229c){logger[_0x4f83('0x9')](_0x4f83('0x1d'),_0x211f09);logger['debug'](_0x4f83('0x1d'),_0x211f09,JSON[_0x4f83('0xd')](_0x2c229c));_0x52d191(_0x2c229c);})[_0x4f83('0x10')](function(_0x13e5e7){logger['error']('ShowDeskAccount',_0x13e5e7[_0x4f83('0xf')],_0x211f09);_0x4e2351(_0x539a92[_0x4f83('0xe')](0x1f4,_0x13e5e7[_0x4f83('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 2673193..2e0b4d3 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5d9=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','delete'];(function(_0x3619,_0x1ac6b9){var _0x490897=function(_0x1ead4f){while(--_0x1ead4f){_0x3619['push'](_0x3619['shift']());}};_0x490897(++_0x1ac6b9);}(_0xf5d9,0x72));var _0x9f5d=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xf5d9[_0x377a6e];return _0x37f751;};'use strict';var multer=require('multer');var util=require(_0x9f5d('0x0'));var path=require(_0x9f5d('0x1'));var timeout=require(_0x9f5d('0x2'));var express=require(_0x9f5d('0x3'));var router=express[_0x9f5d('0x4')]();var fs_extra=require(_0x9f5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f5d('0x6'));var config=require(_0x9f5d('0x7'));var controller=require(_0x9f5d('0x8'));router[_0x9f5d('0x9')]('/',auth[_0x9f5d('0xa')](),controller[_0x9f5d('0xb')]);router[_0x9f5d('0x9')](_0x9f5d('0xc'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0xd')]);router[_0x9f5d('0x9')](_0x9f5d('0xe'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0xf')]);router[_0x9f5d('0x9')](_0x9f5d('0x10'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x11')]);router[_0x9f5d('0x9')](_0x9f5d('0x12'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x13')]);router['get'](_0x9f5d('0x14'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x15')]);router[_0x9f5d('0x16')]('/',auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x17')]);router['post'](_0x9f5d('0x14'),auth[_0x9f5d('0xa')](),controller[_0x9f5d('0x18')]);router['put'](_0x9f5d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9f5d('0x19')](_0x9f5d('0xc'),auth['isAuthenticated'](),controller[_0x9f5d('0x1a')]);module[_0x9f5d('0x1b')]=router; \ No newline at end of file +var _0xe557=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags'];(function(_0x187897,_0x19ba21){var _0x4327a5=function(_0x2de9d7){while(--_0x2de9d7){_0x187897['push'](_0x187897['shift']());}};_0x4327a5(++_0x19ba21);}(_0xe557,0xa1));var _0x7e55=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe557[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x7e55('0x0'));var util=require(_0x7e55('0x1'));var path=require(_0x7e55('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e55('0x3'));var router=express[_0x7e55('0x4')]();var fs_extra=require(_0x7e55('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e55('0x6'));var config=require(_0x7e55('0x7'));var controller=require(_0x7e55('0x8'));router['get']('/',auth[_0x7e55('0x9')](),controller['index']);router[_0x7e55('0xa')](_0x7e55('0xb'),auth[_0x7e55('0x9')](),controller[_0x7e55('0xc')]);router[_0x7e55('0xa')](_0x7e55('0xd'),auth[_0x7e55('0x9')](),controller[_0x7e55('0xe')]);router[_0x7e55('0xa')]('/:id/subjects',auth[_0x7e55('0x9')](),controller[_0x7e55('0xf')]);router['get'](_0x7e55('0x10'),auth[_0x7e55('0x9')](),controller['getDescriptions']);router['get'](_0x7e55('0x11'),auth[_0x7e55('0x9')](),controller[_0x7e55('0x12')]);router[_0x7e55('0x13')]('/',auth[_0x7e55('0x9')](),controller['create']);router['post'](_0x7e55('0x11'),auth[_0x7e55('0x9')](),controller[_0x7e55('0x14')]);router[_0x7e55('0x15')](_0x7e55('0xb'),auth['isAuthenticated'](),controller[_0x7e55('0x16')]);router[_0x7e55('0x17')](_0x7e55('0xb'),auth[_0x7e55('0x9')](),controller[_0x7e55('0x18')]);module[_0x7e55('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index b1efbd1..d297a74 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2d7=['sequelize','exports','STRING'];(function(_0x103d29,_0x560bc6){var _0x558e81=function(_0xbc2499){while(--_0xbc2499){_0x103d29['push'](_0x103d29['shift']());}};_0x558e81(++_0x560bc6);}(_0xe2d7,0x66));var _0x7e2d=function(_0x32e5a3,_0x237cdb){_0x32e5a3=_0x32e5a3-0x0;var _0x378cc1=_0xe2d7[_0x32e5a3];return _0x378cc1;};'use strict';var Sequelize=require(_0x7e2d('0x0'));module[_0x7e2d('0x1')]={'name':{'type':Sequelize[_0x7e2d('0x2')]},'description':{'type':Sequelize[_0x7e2d('0x2')]}}; \ No newline at end of file +var _0xd2d1=['exports','STRING'];(function(_0x1c232f,_0x141226){var _0x179e67=function(_0x38aa1a){while(--_0x38aa1a){_0x1c232f['push'](_0x1c232f['shift']());}};_0x179e67(++_0x141226);}(_0xd2d1,0xf4));var _0x1d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x1d2d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1d2d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7b625ca..3ce88ea 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['DeskField','order','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','end','sendStatus','stack','name','render','merge','contact','agent','account','index','map','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','options','DeskConfiguration','include','findAll','params','rawAttributes','length','create','body','find','getFields','findOne'];(function(_0x3e72b3,_0x549d13){var _0x2a3804=function(_0x58013f){while(--_0x58013f){_0x3e72b3['push'](_0x3e72b3['shift']());}};_0x2a3804(++_0x549d13);}(_0x55ca,0x126));var _0xa55c=function(_0x5a42d9,_0x2d397e){_0x5a42d9=_0x5a42d9-0x0;var _0x190cf2=_0x55ca[_0x5a42d9];return _0x190cf2;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){_0x24d44d['status'](0xcc)[_0xa55c('0x30')]();});}};}function handleEntityNotFound(_0x19733e,_0x4932d0){return function(_0x30fadd){if(!_0x30fadd){_0x19733e[_0xa55c('0x31')](0x194);}return _0x30fadd;};}function handleError(_0x2e9623,_0x1839ac){_0x1839ac=_0x1839ac||0x1f4;return function(_0x30d4f8){logger[_0xa55c('0x21')](_0x30d4f8[_0xa55c('0x32')]);if(_0x30d4f8[_0xa55c('0x33')]){delete _0x30d4f8[_0xa55c('0x33')];}_0x2e9623['status'](_0x1839ac)['send'](_0x30d4f8);};}function getMustacheRender(_0x4b23d3,_0x3fd75f){return Mustache[_0xa55c('0x34')](_0x4b23d3,_[_0xa55c('0x35')](_0x3fd75f['body'],{'contact':_0x3fd75f[_0xa55c('0x36')],'message':_0x3fd75f['message'],'agent':_0x3fd75f[_0xa55c('0x37')],'interaction':_0x3fd75f['interaction'],'account':_0x3fd75f[_0xa55c('0x38')]}))||'';}exports[_0xa55c('0x39')]=function(_0x3c0ec1,_0x4d3eb5){var _0x7c4a47={},_0x30f23b={},_0x47e93c={'count':0x0,'rows':[]};var _0x6f9c4c=_[_0xa55c('0x3a')](db['DeskConfiguration']['rawAttributes'],function(_0x235f6b){return{'name':_0x235f6b['fieldName'],'type':_0x235f6b[_0xa55c('0x3b')][_0xa55c('0x3c')]};});_0x30f23b['model']=_['map'](_0x6f9c4c,'name');_0x30f23b['query']=_[_0xa55c('0x3d')](_0x3c0ec1[_0xa55c('0x3e')]);_0x30f23b[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0x30f23b[_0xa55c('0x41')],_0x30f23b['query']);_0x7c4a47[_0xa55c('0x42')]=_[_0xa55c('0x40')](_0x30f23b[_0xa55c('0x41')],qs[_0xa55c('0x43')](_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x7c4a47['attributes']=_0x7c4a47[_0xa55c('0x42')]['length']?_0x7c4a47['attributes']:_0x30f23b[_0xa55c('0x41')];if(!_0x3c0ec1[_0xa55c('0x3e')]['hasOwnProperty'](_0xa55c('0x44'))){_0x7c4a47['limit']=qs['limit'](_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x7c4a47[_0xa55c('0x27')]=qs['offset'](_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x27')]);}_0x7c4a47['order']=qs[_0xa55c('0x45')](_0x3c0ec1['query'][_0xa55c('0x45')]);_0x7c4a47[_0xa55c('0x46')]=qs['filters'](_[_0xa55c('0x47')](_0x3c0ec1[_0xa55c('0x3e')],_0x30f23b['filters']),_0x6f9c4c);if(_0x3c0ec1[_0xa55c('0x3e')][_0xa55c('0x48')]){_0x7c4a47[_0xa55c('0x46')]=_['merge'](_0x7c4a47[_0xa55c('0x46')],{'$or':_['map'](_0x6f9c4c,function(_0x2f9717){if(_0x2f9717[_0xa55c('0x3b')]!==_0xa55c('0x49')){var _0x51d663={};_0x51d663[_0x2f9717[_0xa55c('0x33')]]={'$like':'%'+_0x3c0ec1[_0xa55c('0x3e')]['filter']+'%'};return _0x51d663;}})});}_0x7c4a47=_[_0xa55c('0x35')]({},_0x7c4a47,_0x3c0ec1[_0xa55c('0x4a')]);var _0x5d5cf6={'where':_0x7c4a47[_0xa55c('0x46')]};return db[_0xa55c('0x4b')]['count'](_0x5d5cf6)[_0xa55c('0x1a')](function(_0x81cee8){_0x47e93c[_0xa55c('0x29')]=_0x81cee8;if(_0x3c0ec1[_0xa55c('0x3e')]['includeAll']){_0x7c4a47[_0xa55c('0x4c')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xa55c('0x4d')](_0x7c4a47);})[_0xa55c('0x1a')](function(_0x194a79){_0x47e93c['rows']=_0x194a79;return _0x47e93c;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x4d3eb5,_0x7c4a47))[_0xa55c('0x24')](handleError(_0x4d3eb5,null));};exports['show']=function(_0x5be06,_0x34de95){var _0x3822b7={'raw':![],'where':{'id':_0x5be06[_0xa55c('0x4e')]['id']}},_0xcd78c5={};_0xcd78c5[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x4b')][_0xa55c('0x4f')]);_0xcd78c5[_0xa55c('0x3e')]=_['keys'](_0x5be06[_0xa55c('0x3e')]);_0xcd78c5[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0xcd78c5['model'],_0xcd78c5[_0xa55c('0x3e')]);_0x3822b7[_0xa55c('0x42')]=_['intersection'](_0xcd78c5[_0xa55c('0x41')],qs['fields'](_0x5be06[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x3822b7[_0xa55c('0x42')]=_0x3822b7[_0xa55c('0x42')][_0xa55c('0x50')]?_0x3822b7['attributes']:_0xcd78c5[_0xa55c('0x41')];if(_0x5be06[_0xa55c('0x3e')]['includeAll']){_0x3822b7[_0xa55c('0x4c')]=[{'all':!![]}];}_0x3822b7=_[_0xa55c('0x35')]({},_0x3822b7,_0x5be06[_0xa55c('0x4a')]);return db[_0xa55c('0x4b')]['find'](_0x3822b7)['then'](handleEntityNotFound(_0x34de95,null))[_0xa55c('0x1a')](respondWithResult(_0x34de95,null))[_0xa55c('0x24')](handleError(_0x34de95,null));};exports[_0xa55c('0x51')]=function(_0x44ac57,_0x54cbde){return db[_0xa55c('0x4b')]['create'](_0x44ac57[_0xa55c('0x52')],{})[_0xa55c('0x1a')](respondWithResult(_0x54cbde,0xc9))[_0xa55c('0x24')](handleError(_0x54cbde,null));};exports[_0xa55c('0x2e')]=function(_0xec640,_0x53b2f7){if(_0xec640[_0xa55c('0x52')]['id']){delete _0xec640['body']['id'];}return db[_0xa55c('0x4b')][_0xa55c('0x53')]({'where':{'id':_0xec640[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x53b2f7,null))[_0xa55c('0x1a')](saveUpdates(_0xec640[_0xa55c('0x52')],null))[_0xa55c('0x1a')](respondWithResult(_0x53b2f7,null))['catch'](handleError(_0x53b2f7,null));};exports[_0xa55c('0x2f')]=function(_0x449e00,_0x2f2d21){return db[_0xa55c('0x4b')][_0xa55c('0x53')]({'where':{'id':_0x449e00['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x2f2d21,null))[_0xa55c('0x1a')](removeEntity(_0x2f2d21,null))[_0xa55c('0x24')](handleError(_0x2f2d21,null));};exports[_0xa55c('0x54')]=function(_0x3cbb63,_0x493f51,_0xdd92c1){var _0x21725b={};var _0x43136b={};var _0x16d9b2;var _0x3ba56d;return db['DeskConfiguration'][_0xa55c('0x55')]({'where':{'id':_0x3cbb63['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x493f51,null))['then'](function(_0x3495a7){if(_0x3495a7){_0x16d9b2=_0x3495a7;_0x43136b['model']=_[_0xa55c('0x3d')](db[_0xa55c('0x56')][_0xa55c('0x4f')]);_0x43136b[_0xa55c('0x3e')]=_[_0xa55c('0x3d')](_0x3cbb63[_0xa55c('0x3e')]);_0x43136b[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0x43136b[_0xa55c('0x41')],_0x43136b[_0xa55c('0x3e')]);_0x21725b['attributes']=_[_0xa55c('0x40')](_0x43136b[_0xa55c('0x41')],qs['fields'](_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x21725b[_0xa55c('0x42')]=_0x21725b[_0xa55c('0x42')][_0xa55c('0x50')]?_0x21725b[_0xa55c('0x42')]:_0x43136b[_0xa55c('0x41')];_0x21725b[_0xa55c('0x57')]=qs['sort'](_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x21725b[_0xa55c('0x46')]=qs[_0xa55c('0x3f')](_[_0xa55c('0x47')](_0x3cbb63[_0xa55c('0x3e')],_0x43136b[_0xa55c('0x3f')]));if(_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x48')]){_0x21725b['where']=_[_0xa55c('0x35')](_0x21725b[_0xa55c('0x46')],{'$or':_[_0xa55c('0x3a')](_0x21725b[_0xa55c('0x42')],function(_0x3a269d){var _0x10e711={};_0x10e711[_0x3a269d]={'$like':'%'+_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x48')]+'%'};return _0x10e711;})});}_0x21725b=_[_0xa55c('0x35')]({},_0x21725b,_0x3cbb63[_0xa55c('0x4a')]);return _0x16d9b2[_0xa55c('0x54')](_0x21725b);}})['then'](function(_0xe42233){if(_0xe42233){_0x3ba56d=_0xe42233['length'];if(!_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x58')](_0xa55c('0x44'))){_0x21725b['limit']=qs['limit'](_0x3cbb63[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x21725b[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x3cbb63['query'][_0xa55c('0x27')]);}return _0x16d9b2[_0xa55c('0x54')](_0x21725b);}})[_0xa55c('0x1a')](function(_0x3a9910){if(_0x3a9910){return _0x3a9910?{'count':_0x3ba56d,'rows':_0x3a9910}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x493f51,null))['catch'](handleError(_0x493f51,null));};exports['getSubjects']=function(_0x3f7fca,_0x38689e,_0x3f9d0a){var _0x36ee32={};var _0x1af9d5={};var _0x4b2032;var _0x14febc;return db[_0xa55c('0x4b')]['findOne']({'where':{'id':_0x3f7fca[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x38689e,null))[_0xa55c('0x1a')](function(_0x4dcb93){if(_0x4dcb93){_0x4b2032=_0x4dcb93;_0x1af9d5[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x56')][_0xa55c('0x4f')]);_0x1af9d5[_0xa55c('0x3e')]=_['keys'](_0x3f7fca[_0xa55c('0x3e')]);_0x1af9d5[_0xa55c('0x3f')]=_['intersection'](_0x1af9d5['model'],_0x1af9d5[_0xa55c('0x3e')]);_0x36ee32['attributes']=_[_0xa55c('0x40')](_0x1af9d5[_0xa55c('0x41')],qs[_0xa55c('0x43')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x36ee32[_0xa55c('0x42')]=_0x36ee32[_0xa55c('0x42')][_0xa55c('0x50')]?_0x36ee32[_0xa55c('0x42')]:_0x1af9d5['model'];_0x36ee32[_0xa55c('0x57')]=qs[_0xa55c('0x45')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x36ee32['where']=qs[_0xa55c('0x3f')](_[_0xa55c('0x47')](_0x3f7fca[_0xa55c('0x3e')],_0x1af9d5[_0xa55c('0x3f')]));if(_0x3f7fca['query']['filter']){_0x36ee32[_0xa55c('0x46')]=_[_0xa55c('0x35')](_0x36ee32[_0xa55c('0x46')],{'$or':_[_0xa55c('0x3a')](_0x36ee32['attributes'],function(_0x55ee0d){var _0x40663={};_0x40663[_0x55ee0d]={'$like':'%'+_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x48')]+'%'};return _0x40663;})});}_0x36ee32=_[_0xa55c('0x35')]({},_0x36ee32,_0x3f7fca[_0xa55c('0x4a')]);return _0x4b2032[_0xa55c('0x59')](_0x36ee32);}})[_0xa55c('0x1a')](function(_0x51b58e){if(_0x51b58e){_0x14febc=_0x51b58e[_0xa55c('0x50')];if(!_0x3f7fca['query'][_0xa55c('0x58')]('nolimit')){_0x36ee32[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x36ee32[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x3f7fca[_0xa55c('0x3e')][_0xa55c('0x27')]);}return _0x4b2032['getSubjects'](_0x36ee32);}})['then'](function(_0x14cb74){if(_0x14cb74){return _0x14cb74?{'count':_0x14febc,'rows':_0x14cb74}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x38689e,null))[_0xa55c('0x24')](handleError(_0x38689e,null));};exports[_0xa55c('0x5a')]=function(_0x1622cb,_0x137728,_0x47e8e2){var _0x889869={};var _0x124740={};var _0x301e56;var _0x3b117e;return db[_0xa55c('0x4b')][_0xa55c('0x55')]({'where':{'id':_0x1622cb[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x137728,null))['then'](function(_0x25d09d){if(_0x25d09d){_0x301e56=_0x25d09d;_0x124740[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x56')][_0xa55c('0x4f')]);_0x124740['query']=_[_0xa55c('0x3d')](_0x1622cb[_0xa55c('0x3e')]);_0x124740['filters']=_['intersection'](_0x124740[_0xa55c('0x41')],_0x124740[_0xa55c('0x3e')]);_0x889869['attributes']=_['intersection'](_0x124740['model'],qs['fields'](_0x1622cb[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x889869[_0xa55c('0x42')]=_0x889869[_0xa55c('0x42')][_0xa55c('0x50')]?_0x889869[_0xa55c('0x42')]:_0x124740['model'];_0x889869[_0xa55c('0x57')]=qs[_0xa55c('0x45')](_0x1622cb[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x889869['where']=qs[_0xa55c('0x3f')](_[_0xa55c('0x47')](_0x1622cb[_0xa55c('0x3e')],_0x124740['filters']));if(_0x1622cb[_0xa55c('0x3e')]['filter']){_0x889869['where']=_[_0xa55c('0x35')](_0x889869[_0xa55c('0x46')],{'$or':_[_0xa55c('0x3a')](_0x889869[_0xa55c('0x42')],function(_0x2544c1){var _0x45d068={};_0x45d068[_0x2544c1]={'$like':'%'+_0x1622cb[_0xa55c('0x3e')]['filter']+'%'};return _0x45d068;})});}_0x889869=_['merge']({},_0x889869,_0x1622cb[_0xa55c('0x4a')]);return _0x301e56[_0xa55c('0x5a')](_0x889869);}})[_0xa55c('0x1a')](function(_0x1f4bc8){if(_0x1f4bc8){_0x3b117e=_0x1f4bc8[_0xa55c('0x50')];if(!_0x1622cb[_0xa55c('0x3e')][_0xa55c('0x58')](_0xa55c('0x44'))){_0x889869[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x1622cb['query'][_0xa55c('0x2a')]);_0x889869[_0xa55c('0x27')]=qs['offset'](_0x1622cb[_0xa55c('0x3e')]['offset']);}return _0x301e56[_0xa55c('0x5a')](_0x889869);}})[_0xa55c('0x1a')](function(_0x3fe34d){if(_0x3fe34d){return _0x3fe34d?{'count':_0x3b117e,'rows':_0x3fe34d}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x137728,null))[_0xa55c('0x24')](handleError(_0x137728,null));};exports['getTags']=function(_0x22092a,_0x12e516,_0x1f2f86){var _0x376c1f={};var _0x3300a9={};var _0x31287c;var _0x193208;return db['DeskConfiguration']['findOne']({'where':{'id':_0x22092a['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x12e516,null))['then'](function(_0x266014){if(_0x266014){_0x31287c=_0x266014;_0x3300a9[_0xa55c('0x41')]=_[_0xa55c('0x3d')](db[_0xa55c('0x5b')][_0xa55c('0x4f')]);_0x3300a9['query']=_[_0xa55c('0x3d')](_0x22092a['query']);_0x3300a9[_0xa55c('0x3f')]=_[_0xa55c('0x40')](_0x3300a9[_0xa55c('0x41')],_0x3300a9[_0xa55c('0x3e')]);_0x376c1f['attributes']=_[_0xa55c('0x40')](_0x3300a9[_0xa55c('0x41')],qs[_0xa55c('0x43')](_0x22092a[_0xa55c('0x3e')][_0xa55c('0x43')]));_0x376c1f[_0xa55c('0x42')]=_0x376c1f[_0xa55c('0x42')][_0xa55c('0x50')]?_0x376c1f['attributes']:_0x3300a9[_0xa55c('0x41')];_0x376c1f[_0xa55c('0x57')]=qs[_0xa55c('0x45')](_0x22092a[_0xa55c('0x3e')][_0xa55c('0x45')]);_0x376c1f[_0xa55c('0x46')]=qs['filters'](_[_0xa55c('0x47')](_0x22092a['query'],_0x3300a9[_0xa55c('0x3f')]));if(_0x22092a['query'][_0xa55c('0x48')]){_0x376c1f[_0xa55c('0x46')]=_[_0xa55c('0x35')](_0x376c1f['where'],{'$or':_[_0xa55c('0x3a')](_0x376c1f[_0xa55c('0x42')],function(_0x156959){var _0x5133bd={};_0x5133bd[_0x156959]={'$like':'%'+_0x22092a[_0xa55c('0x3e')]['filter']+'%'};return _0x5133bd;})});}_0x376c1f=_[_0xa55c('0x35')]({},_0x376c1f,_0x22092a[_0xa55c('0x4a')]);return _0x31287c['getTags'](_0x376c1f);}})[_0xa55c('0x1a')](function(_0x4d7e6c){if(_0x4d7e6c){_0x193208=_0x4d7e6c[_0xa55c('0x50')];if(!_0x22092a[_0xa55c('0x3e')]['hasOwnProperty'](_0xa55c('0x44'))){_0x376c1f[_0xa55c('0x2a')]=qs['limit'](_0x22092a[_0xa55c('0x3e')][_0xa55c('0x2a')]);_0x376c1f['offset']=qs[_0xa55c('0x27')](_0x22092a['query']['offset']);}return _0x31287c[_0xa55c('0x5c')](_0x376c1f);}})[_0xa55c('0x1a')](function(_0x28a71e){if(_0x28a71e){return _0x28a71e?{'count':_0x193208,'rows':_0x28a71e}:null;}})[_0xa55c('0x1a')](respondWithResult(_0x12e516,null))['catch'](handleError(_0x12e516,null));};exports[_0xa55c('0x5d')]=function(_0x5c08a9,_0x2f1fc7,_0x48004b){if(_0x5c08a9['body']['id']){delete _0x5c08a9['body']['id'];}return db[_0xa55c('0x4b')]['findOne']({'where':{'id':_0x5c08a9['params']['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x2f1fc7,null))[_0xa55c('0x1a')](function(_0x1744ad){if(_0x1744ad){return _0x1744ad[_0xa55c('0x5d')](_0x5c08a9[_0xa55c('0x52')][_0xa55c('0x5e')]||[]);}return null;})[_0xa55c('0x1a')](respondWithResult(_0x2f1fc7,null))[_0xa55c('0x24')](handleError(_0x2f1fc7,null));}; \ No newline at end of file +var _0x5178=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','send','body','contact','interaction','account','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','getFields','findOne','pick','nolimit','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x59f4eb,_0x25d793){var _0x1d614c=function(_0x425171){while(--_0x425171){_0x59f4eb['push'](_0x59f4eb['shift']());}};_0x1d614c(++_0x25d793);}(_0x5178,0x171));var _0x8517=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5178[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8517('0x0'));var zipdir=require(_0x8517('0x1'));var jsonpatch=require(_0x8517('0x2'));var rp=require(_0x8517('0x3'));var moment=require(_0x8517('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8517('0x5'));var path=require(_0x8517('0x6'));var sox=require('sox');var csv=require(_0x8517('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8517('0x8'));var _=require(_0x8517('0x9'));var squel=require(_0x8517('0xa'));var crypto=require(_0x8517('0xb'));var jsforce=require(_0x8517('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8517('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8517('0xd'));var authService=require(_0x8517('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8517('0xf'));var hardwareService=require(_0x8517('0x10'));var logger=require(_0x8517('0x11'))(_0x8517('0x12'));var utils=require(_0x8517('0x13'));var config=require(_0x8517('0x14'));var licenseUtil=require(_0x8517('0x15'));var db=require(_0x8517('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8517('0x17')][_0x8517('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x268128,_0x170214,_0x284a05,_0x49eba7){return new BPromise(function(_0x385219,_0x19dd9d){var _0x126e0b=_0x49eba7||client;return _0x126e0b[_0x8517('0x19')](_0x268128,_0x284a05)[_0x8517('0x1a')](function(_0x18a984){logger[_0x8517('0x1b')](_0x8517('0x1c'),_0x170214,_0x8517('0x1d'));logger[_0x8517('0x1e')](_0x8517('0x1f'),_0x170214,_0x8517('0x1d'),JSON['stringify'](_0x18a984));if(_0x18a984[_0x8517('0x20')]){if(_0x18a984[_0x8517('0x20')][_0x8517('0x21')]===0x1f4){logger[_0x8517('0x20')](_0x8517('0x1c'),_0x170214,_0x18a984[_0x8517('0x20')][_0x8517('0x22')]);return _0x19dd9d(_0x18a984['error'][_0x8517('0x22')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x170214,_0x18a984[_0x8517('0x20')][_0x8517('0x22')]);return _0x385219(_0x18a984[_0x8517('0x20')][_0x8517('0x22')]);}else{logger[_0x8517('0x1b')](_0x8517('0x1c'),_0x170214,'request\x20sent');_0x385219(_0x18a984['result'][_0x8517('0x22')]);}})[_0x8517('0x23')](function(_0x2c594f){logger[_0x8517('0x20')](_0x8517('0x1c'),_0x170214,_0x2c594f);_0x19dd9d(_0x2c594f);});});}function respondWithStatusCode(_0x2e6e47,_0x5f02ee){_0x5f02ee=_0x5f02ee||0xcc;return function(_0x181500){if(_0x181500){return _0x2e6e47[_0x8517('0x24')](_0x5f02ee);}return _0x2e6e47['status'](_0x5f02ee)[_0x8517('0x25')]();};}function respondWithResult(_0x2febd5,_0x42c779){_0x42c779=_0x42c779||0xc8;return function(_0x5492f6){if(_0x5492f6){return _0x2febd5[_0x8517('0x26')](_0x42c779)['json'](_0x5492f6);}};}function respondWithFilteredResult(_0x2880b6,_0x2a2b7e){return function(_0x448211){if(_0x448211){var _0x2b0c19=typeof _0x2a2b7e[_0x8517('0x27')]===_0x8517('0x28')&&typeof _0x2a2b7e['limit']===_0x8517('0x28');var _0x51d516=_0x448211[_0x8517('0x29')];var _0x70ee9d=_0x2b0c19?0x0:_0x2a2b7e[_0x8517('0x27')];var _0x355aa6=_0x2b0c19?_0x448211[_0x8517('0x29')]:_0x2a2b7e[_0x8517('0x27')]+_0x2a2b7e['limit'];var _0x20ec0a;if(_0x355aa6>=_0x51d516){_0x355aa6=_0x51d516;_0x20ec0a=0xc8;}else{_0x20ec0a=0xce;}_0x2880b6['status'](_0x20ec0a);return _0x2880b6[_0x8517('0x2a')](_0x8517('0x2b'),_0x70ee9d+'-'+_0x355aa6+'/'+_0x51d516)[_0x8517('0x2c')](_0x448211);}return null;};}function patchUpdates(_0x2d360c){return function(_0x3cf945){try{jsonpatch[_0x8517('0x2d')](_0x3cf945,_0x2d360c,!![]);}catch(_0x273b27){return BPromise[_0x8517('0x2e')](_0x273b27);}return _0x3cf945[_0x8517('0x2f')]();};}function saveUpdates(_0x559707,_0x3e8f81){return function(_0x1031b3){if(_0x1031b3){return _0x1031b3[_0x8517('0x30')](_0x559707)['then'](function(_0x5db173){return _0x5db173;});}return null;};}function removeEntity(_0x5cb78c,_0x25eb4c){return function(_0x4102b4){if(_0x4102b4){return _0x4102b4[_0x8517('0x31')]()[_0x8517('0x1a')](function(){_0x5cb78c[_0x8517('0x26')](0xcc)[_0x8517('0x25')]();});}};}function handleEntityNotFound(_0x5d9d04,_0x19dd26){return function(_0x234da4){if(!_0x234da4){_0x5d9d04[_0x8517('0x24')](0x194);}return _0x234da4;};}function handleError(_0x55785d,_0x43290c){_0x43290c=_0x43290c||0x1f4;return function(_0x5756d7){logger[_0x8517('0x20')](_0x5756d7[_0x8517('0x32')]);if(_0x5756d7['name']){delete _0x5756d7['name'];}_0x55785d[_0x8517('0x26')](_0x43290c)[_0x8517('0x33')](_0x5756d7);};}function getMustacheRender(_0x2c1292,_0x67c412){return Mustache['render'](_0x2c1292,_['merge'](_0x67c412[_0x8517('0x34')],{'contact':_0x67c412[_0x8517('0x35')],'message':_0x67c412[_0x8517('0x22')],'agent':_0x67c412['agent'],'interaction':_0x67c412[_0x8517('0x36')],'account':_0x67c412[_0x8517('0x37')]}))||'';}exports['index']=function(_0x209235,_0x58c759){var _0x15e5f0={},_0x29fa73={},_0x57ca29={'count':0x0,'rows':[]};var _0x9925db=_[_0x8517('0x38')](db[_0x8517('0x39')][_0x8517('0x3a')],function(_0x285955){return{'name':_0x285955[_0x8517('0x3b')],'type':_0x285955[_0x8517('0x3c')][_0x8517('0x3d')]};});_0x29fa73[_0x8517('0x3e')]=_[_0x8517('0x38')](_0x9925db,_0x8517('0x3f'));_0x29fa73[_0x8517('0x40')]=_[_0x8517('0x41')](_0x209235['query']);_0x29fa73['filters']=_[_0x8517('0x42')](_0x29fa73[_0x8517('0x3e')],_0x29fa73[_0x8517('0x40')]);_0x15e5f0[_0x8517('0x43')]=_[_0x8517('0x42')](_0x29fa73['model'],qs[_0x8517('0x44')](_0x209235[_0x8517('0x40')]['fields']));_0x15e5f0[_0x8517('0x43')]=_0x15e5f0[_0x8517('0x43')][_0x8517('0x45')]?_0x15e5f0[_0x8517('0x43')]:_0x29fa73['model'];if(!_0x209235[_0x8517('0x40')][_0x8517('0x46')]('nolimit')){_0x15e5f0[_0x8517('0x47')]=qs[_0x8517('0x47')](_0x209235[_0x8517('0x40')]['limit']);_0x15e5f0[_0x8517('0x27')]=qs[_0x8517('0x27')](_0x209235[_0x8517('0x40')][_0x8517('0x27')]);}_0x15e5f0[_0x8517('0x48')]=qs[_0x8517('0x49')](_0x209235[_0x8517('0x40')]['sort']);_0x15e5f0[_0x8517('0x4a')]=qs[_0x8517('0x4b')](_['pick'](_0x209235[_0x8517('0x40')],_0x29fa73[_0x8517('0x4b')]),_0x9925db);if(_0x209235[_0x8517('0x40')][_0x8517('0x4c')]){_0x15e5f0[_0x8517('0x4a')]=_[_0x8517('0x4d')](_0x15e5f0['where'],{'$or':_[_0x8517('0x38')](_0x9925db,function(_0x10c07a){if(_0x10c07a[_0x8517('0x3c')]!=='VIRTUAL'){var _0x2ebecc={};_0x2ebecc[_0x10c07a[_0x8517('0x3f')]]={'$like':'%'+_0x209235['query'][_0x8517('0x4c')]+'%'};return _0x2ebecc;}})});}_0x15e5f0=_[_0x8517('0x4d')]({},_0x15e5f0,_0x209235['options']);var _0x54b346={'where':_0x15e5f0['where']};return db[_0x8517('0x39')][_0x8517('0x29')](_0x54b346)['then'](function(_0x13a3a4){_0x57ca29['count']=_0x13a3a4;if(_0x209235['query'][_0x8517('0x4e')]){_0x15e5f0[_0x8517('0x4f')]=[{'all':!![]}];}return db[_0x8517('0x39')][_0x8517('0x50')](_0x15e5f0);})['then'](function(_0x282601){_0x57ca29[_0x8517('0x51')]=_0x282601;return _0x57ca29;})[_0x8517('0x1a')](respondWithFilteredResult(_0x58c759,_0x15e5f0))['catch'](handleError(_0x58c759,null));};exports[_0x8517('0x52')]=function(_0x8ef7a8,_0x2276ed){var _0x22321c={'raw':![],'where':{'id':_0x8ef7a8[_0x8517('0x53')]['id']}},_0x3f2a31={};_0x3f2a31[_0x8517('0x3e')]=_['keys'](db[_0x8517('0x39')]['rawAttributes']);_0x3f2a31['query']=_[_0x8517('0x41')](_0x8ef7a8[_0x8517('0x40')]);_0x3f2a31[_0x8517('0x4b')]=_[_0x8517('0x42')](_0x3f2a31['model'],_0x3f2a31[_0x8517('0x40')]);_0x22321c[_0x8517('0x43')]=_['intersection'](_0x3f2a31['model'],qs[_0x8517('0x44')](_0x8ef7a8[_0x8517('0x40')][_0x8517('0x44')]));_0x22321c['attributes']=_0x22321c[_0x8517('0x43')]['length']?_0x22321c[_0x8517('0x43')]:_0x3f2a31[_0x8517('0x3e')];if(_0x8ef7a8[_0x8517('0x40')][_0x8517('0x4e')]){_0x22321c[_0x8517('0x4f')]=[{'all':!![]}];}_0x22321c=_[_0x8517('0x4d')]({},_0x22321c,_0x8ef7a8[_0x8517('0x54')]);return db[_0x8517('0x39')][_0x8517('0x55')](_0x22321c)['then'](handleEntityNotFound(_0x2276ed,null))['then'](respondWithResult(_0x2276ed,null))[_0x8517('0x23')](handleError(_0x2276ed,null));};exports[_0x8517('0x56')]=function(_0x260aa9,_0x5e82ab){return db[_0x8517('0x39')][_0x8517('0x56')](_0x260aa9[_0x8517('0x34')],{})['then'](respondWithResult(_0x5e82ab,0xc9))['catch'](handleError(_0x5e82ab,null));};exports[_0x8517('0x30')]=function(_0x345e02,_0x919ff8){if(_0x345e02[_0x8517('0x34')]['id']){delete _0x345e02[_0x8517('0x34')]['id'];}return db[_0x8517('0x39')][_0x8517('0x55')]({'where':{'id':_0x345e02[_0x8517('0x53')]['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x919ff8,null))[_0x8517('0x1a')](saveUpdates(_0x345e02[_0x8517('0x34')],null))[_0x8517('0x1a')](respondWithResult(_0x919ff8,null))[_0x8517('0x23')](handleError(_0x919ff8,null));};exports[_0x8517('0x31')]=function(_0x3bab4e,_0x46e6bb){return db['DeskConfiguration'][_0x8517('0x55')]({'where':{'id':_0x3bab4e[_0x8517('0x53')]['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x46e6bb,null))[_0x8517('0x1a')](removeEntity(_0x46e6bb,null))[_0x8517('0x23')](handleError(_0x46e6bb,null));};exports[_0x8517('0x57')]=function(_0x322682,_0x50b037,_0x2e505a){var _0x46829c={};var _0x1264db={};var _0x461640;var _0x4240d0;return db['DeskConfiguration'][_0x8517('0x58')]({'where':{'id':_0x322682['params']['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x50b037,null))[_0x8517('0x1a')](function(_0x4147cf){if(_0x4147cf){_0x461640=_0x4147cf;_0x1264db[_0x8517('0x3e')]=_[_0x8517('0x41')](db['DeskField'][_0x8517('0x3a')]);_0x1264db[_0x8517('0x40')]=_[_0x8517('0x41')](_0x322682[_0x8517('0x40')]);_0x1264db['filters']=_['intersection'](_0x1264db[_0x8517('0x3e')],_0x1264db['query']);_0x46829c[_0x8517('0x43')]=_[_0x8517('0x42')](_0x1264db['model'],qs[_0x8517('0x44')](_0x322682[_0x8517('0x40')]['fields']));_0x46829c[_0x8517('0x43')]=_0x46829c[_0x8517('0x43')][_0x8517('0x45')]?_0x46829c[_0x8517('0x43')]:_0x1264db[_0x8517('0x3e')];_0x46829c[_0x8517('0x48')]=qs[_0x8517('0x49')](_0x322682[_0x8517('0x40')]['sort']);_0x46829c[_0x8517('0x4a')]=qs[_0x8517('0x4b')](_[_0x8517('0x59')](_0x322682[_0x8517('0x40')],_0x1264db['filters']));if(_0x322682[_0x8517('0x40')]['filter']){_0x46829c[_0x8517('0x4a')]=_[_0x8517('0x4d')](_0x46829c[_0x8517('0x4a')],{'$or':_[_0x8517('0x38')](_0x46829c['attributes'],function(_0x56d267){var _0x23be4d={};_0x23be4d[_0x56d267]={'$like':'%'+_0x322682[_0x8517('0x40')][_0x8517('0x4c')]+'%'};return _0x23be4d;})});}_0x46829c=_[_0x8517('0x4d')]({},_0x46829c,_0x322682['options']);return _0x461640[_0x8517('0x57')](_0x46829c);}})[_0x8517('0x1a')](function(_0x2d5808){if(_0x2d5808){_0x4240d0=_0x2d5808[_0x8517('0x45')];if(!_0x322682[_0x8517('0x40')][_0x8517('0x46')](_0x8517('0x5a'))){_0x46829c[_0x8517('0x47')]=qs[_0x8517('0x47')](_0x322682[_0x8517('0x40')]['limit']);_0x46829c[_0x8517('0x27')]=qs[_0x8517('0x27')](_0x322682[_0x8517('0x40')]['offset']);}return _0x461640[_0x8517('0x57')](_0x46829c);}})['then'](function(_0x2a3d87){if(_0x2a3d87){return _0x2a3d87?{'count':_0x4240d0,'rows':_0x2a3d87}:null;}})[_0x8517('0x1a')](respondWithResult(_0x50b037,null))['catch'](handleError(_0x50b037,null));};exports[_0x8517('0x5b')]=function(_0x5e973c,_0x2c2e5d,_0x88c069){var _0x1c7f45={};var _0x1236ba={};var _0x53525c;var _0x258280;return db['DeskConfiguration'][_0x8517('0x58')]({'where':{'id':_0x5e973c[_0x8517('0x53')]['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x2c2e5d,null))[_0x8517('0x1a')](function(_0x5c6498){if(_0x5c6498){_0x53525c=_0x5c6498;_0x1236ba[_0x8517('0x3e')]=_[_0x8517('0x41')](db[_0x8517('0x5c')]['rawAttributes']);_0x1236ba[_0x8517('0x40')]=_[_0x8517('0x41')](_0x5e973c[_0x8517('0x40')]);_0x1236ba[_0x8517('0x4b')]=_[_0x8517('0x42')](_0x1236ba[_0x8517('0x3e')],_0x1236ba[_0x8517('0x40')]);_0x1c7f45['attributes']=_[_0x8517('0x42')](_0x1236ba['model'],qs['fields'](_0x5e973c[_0x8517('0x40')][_0x8517('0x44')]));_0x1c7f45[_0x8517('0x43')]=_0x1c7f45['attributes'][_0x8517('0x45')]?_0x1c7f45[_0x8517('0x43')]:_0x1236ba['model'];_0x1c7f45[_0x8517('0x48')]=qs['sort'](_0x5e973c['query'][_0x8517('0x49')]);_0x1c7f45[_0x8517('0x4a')]=qs[_0x8517('0x4b')](_[_0x8517('0x59')](_0x5e973c[_0x8517('0x40')],_0x1236ba['filters']));if(_0x5e973c[_0x8517('0x40')][_0x8517('0x4c')]){_0x1c7f45['where']=_['merge'](_0x1c7f45[_0x8517('0x4a')],{'$or':_[_0x8517('0x38')](_0x1c7f45[_0x8517('0x43')],function(_0x17e72d){var _0x433b2a={};_0x433b2a[_0x17e72d]={'$like':'%'+_0x5e973c[_0x8517('0x40')]['filter']+'%'};return _0x433b2a;})});}_0x1c7f45=_['merge']({},_0x1c7f45,_0x5e973c[_0x8517('0x54')]);return _0x53525c[_0x8517('0x5b')](_0x1c7f45);}})['then'](function(_0x2967e7){if(_0x2967e7){_0x258280=_0x2967e7[_0x8517('0x45')];if(!_0x5e973c['query'][_0x8517('0x46')](_0x8517('0x5a'))){_0x1c7f45[_0x8517('0x47')]=qs['limit'](_0x5e973c['query'][_0x8517('0x47')]);_0x1c7f45[_0x8517('0x27')]=qs[_0x8517('0x27')](_0x5e973c[_0x8517('0x40')][_0x8517('0x27')]);}return _0x53525c['getSubjects'](_0x1c7f45);}})[_0x8517('0x1a')](function(_0x1c7d18){if(_0x1c7d18){return _0x1c7d18?{'count':_0x258280,'rows':_0x1c7d18}:null;}})['then'](respondWithResult(_0x2c2e5d,null))[_0x8517('0x23')](handleError(_0x2c2e5d,null));};exports[_0x8517('0x5d')]=function(_0x1da121,_0x330c55,_0xdbc754){var _0x276be5={};var _0x2ccb21={};var _0x259bf5;var _0x2df2e5;return db[_0x8517('0x39')][_0x8517('0x58')]({'where':{'id':_0x1da121[_0x8517('0x53')]['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x330c55,null))[_0x8517('0x1a')](function(_0x42d6e9){if(_0x42d6e9){_0x259bf5=_0x42d6e9;_0x2ccb21[_0x8517('0x3e')]=_[_0x8517('0x41')](db[_0x8517('0x5c')][_0x8517('0x3a')]);_0x2ccb21['query']=_[_0x8517('0x41')](_0x1da121[_0x8517('0x40')]);_0x2ccb21[_0x8517('0x4b')]=_[_0x8517('0x42')](_0x2ccb21[_0x8517('0x3e')],_0x2ccb21[_0x8517('0x40')]);_0x276be5[_0x8517('0x43')]=_['intersection'](_0x2ccb21[_0x8517('0x3e')],qs[_0x8517('0x44')](_0x1da121[_0x8517('0x40')][_0x8517('0x44')]));_0x276be5[_0x8517('0x43')]=_0x276be5[_0x8517('0x43')]['length']?_0x276be5[_0x8517('0x43')]:_0x2ccb21[_0x8517('0x3e')];_0x276be5[_0x8517('0x48')]=qs[_0x8517('0x49')](_0x1da121[_0x8517('0x40')]['sort']);_0x276be5[_0x8517('0x4a')]=qs[_0x8517('0x4b')](_[_0x8517('0x59')](_0x1da121[_0x8517('0x40')],_0x2ccb21['filters']));if(_0x1da121[_0x8517('0x40')]['filter']){_0x276be5[_0x8517('0x4a')]=_[_0x8517('0x4d')](_0x276be5[_0x8517('0x4a')],{'$or':_[_0x8517('0x38')](_0x276be5[_0x8517('0x43')],function(_0x386d47){var _0x2eef89={};_0x2eef89[_0x386d47]={'$like':'%'+_0x1da121[_0x8517('0x40')][_0x8517('0x4c')]+'%'};return _0x2eef89;})});}_0x276be5=_['merge']({},_0x276be5,_0x1da121[_0x8517('0x54')]);return _0x259bf5[_0x8517('0x5d')](_0x276be5);}})[_0x8517('0x1a')](function(_0x24119d){if(_0x24119d){_0x2df2e5=_0x24119d['length'];if(!_0x1da121[_0x8517('0x40')][_0x8517('0x46')](_0x8517('0x5a'))){_0x276be5[_0x8517('0x47')]=qs[_0x8517('0x47')](_0x1da121[_0x8517('0x40')][_0x8517('0x47')]);_0x276be5[_0x8517('0x27')]=qs[_0x8517('0x27')](_0x1da121[_0x8517('0x40')][_0x8517('0x27')]);}return _0x259bf5[_0x8517('0x5d')](_0x276be5);}})['then'](function(_0x31d1f4){if(_0x31d1f4){return _0x31d1f4?{'count':_0x2df2e5,'rows':_0x31d1f4}:null;}})[_0x8517('0x1a')](respondWithResult(_0x330c55,null))['catch'](handleError(_0x330c55,null));};exports[_0x8517('0x5e')]=function(_0x26f366,_0x52b91d,_0x5df022){var _0x52f0f6={};var _0xb7066f={};var _0x532cec;var _0x104a90;return db['DeskConfiguration'][_0x8517('0x58')]({'where':{'id':_0x26f366['params']['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x52b91d,null))['then'](function(_0x1b085b){if(_0x1b085b){_0x532cec=_0x1b085b;_0xb7066f[_0x8517('0x3e')]=_['keys'](db[_0x8517('0x5f')][_0x8517('0x3a')]);_0xb7066f[_0x8517('0x40')]=_[_0x8517('0x41')](_0x26f366[_0x8517('0x40')]);_0xb7066f['filters']=_['intersection'](_0xb7066f['model'],_0xb7066f[_0x8517('0x40')]);_0x52f0f6[_0x8517('0x43')]=_[_0x8517('0x42')](_0xb7066f[_0x8517('0x3e')],qs['fields'](_0x26f366['query'][_0x8517('0x44')]));_0x52f0f6[_0x8517('0x43')]=_0x52f0f6['attributes'][_0x8517('0x45')]?_0x52f0f6[_0x8517('0x43')]:_0xb7066f[_0x8517('0x3e')];_0x52f0f6[_0x8517('0x48')]=qs['sort'](_0x26f366[_0x8517('0x40')][_0x8517('0x49')]);_0x52f0f6[_0x8517('0x4a')]=qs[_0x8517('0x4b')](_[_0x8517('0x59')](_0x26f366[_0x8517('0x40')],_0xb7066f['filters']));if(_0x26f366[_0x8517('0x40')][_0x8517('0x4c')]){_0x52f0f6[_0x8517('0x4a')]=_[_0x8517('0x4d')](_0x52f0f6[_0x8517('0x4a')],{'$or':_['map'](_0x52f0f6[_0x8517('0x43')],function(_0x348d64){var _0x490eb7={};_0x490eb7[_0x348d64]={'$like':'%'+_0x26f366[_0x8517('0x40')][_0x8517('0x4c')]+'%'};return _0x490eb7;})});}_0x52f0f6=_[_0x8517('0x4d')]({},_0x52f0f6,_0x26f366['options']);return _0x532cec[_0x8517('0x5e')](_0x52f0f6);}})['then'](function(_0x43e746){if(_0x43e746){_0x104a90=_0x43e746['length'];if(!_0x26f366['query'][_0x8517('0x46')](_0x8517('0x5a'))){_0x52f0f6[_0x8517('0x47')]=qs[_0x8517('0x47')](_0x26f366[_0x8517('0x40')]['limit']);_0x52f0f6[_0x8517('0x27')]=qs[_0x8517('0x27')](_0x26f366[_0x8517('0x40')][_0x8517('0x27')]);}return _0x532cec['getTags'](_0x52f0f6);}})['then'](function(_0x4850dd){if(_0x4850dd){return _0x4850dd?{'count':_0x104a90,'rows':_0x4850dd}:null;}})[_0x8517('0x1a')](respondWithResult(_0x52b91d,null))[_0x8517('0x23')](handleError(_0x52b91d,null));};exports[_0x8517('0x60')]=function(_0x4ac946,_0x36254b,_0x5bdb7d){if(_0x4ac946['body']['id']){delete _0x4ac946[_0x8517('0x34')]['id'];}return db[_0x8517('0x39')]['findOne']({'where':{'id':_0x4ac946['params']['id']}})[_0x8517('0x1a')](handleEntityNotFound(_0x36254b,null))['then'](function(_0x56f948){if(_0x56f948){return _0x56f948[_0x8517('0x60')](_0x4ac946[_0x8517('0x34')]['ids']||[]);}return null;})['then'](respondWithResult(_0x36254b,null))['catch'](handleError(_0x36254b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b228ea0..69322cf 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.model.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x200b=['int_desk_configurations','util','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x183d0e,_0x1f520f){var _0x278ff8=function(_0x49b6d1){while(--_0x49b6d1){_0x183d0e['push'](_0x183d0e['shift']());}};_0x278ff8(++_0x1f520f);}(_0x200b,0x91));var _0xb200=function(_0x3e03bd,_0x39f41b){_0x3e03bd=_0x3e03bd-0x0;var _0x181b15=_0x200b[_0x3e03bd];return _0x181b15;};'use strict';var _=require('lodash');var util=require(_0xb200('0x0'));var logger=require('../../config/logger')(_0xb200('0x1'));var moment=require(_0xb200('0x2'));var BPromise=require('bluebird');var rp=require(_0xb200('0x3'));var fs=require('fs');var path=require(_0xb200('0x4'));var rimraf=require(_0xb200('0x5'));var config=require(_0xb200('0x6'));var attributes=require(_0xb200('0x7'));module[_0xb200('0x8')]=function(_0x43dda1,_0x137506){return _0x43dda1[_0xb200('0x9')](_0xb200('0xa'),attributes,{'tableName':_0xb200('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4641=['./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','path','rimraf'];(function(_0x3bc01d,_0x315559){var _0xb91152=function(_0x1da7d4){while(--_0x1da7d4){_0x3bc01d['push'](_0x3bc01d['shift']());}};_0xb91152(++_0x315559);}(_0x4641,0x16c));var _0x1464=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4641[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x1464('0x0'));var util=require(_0x1464('0x1'));var logger=require(_0x1464('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1464('0x3'));var rimraf=require(_0x1464('0x4'));var config=require('../../config/environment');var attributes=require(_0x1464('0x5'));module[_0x1464('0x6')]=function(_0x17233e,_0x56df60){return _0x17233e['define'](_0x1464('0x7'),attributes,{'tableName':_0x1464('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 629f1da..4346f9e 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x456be1,_0x248c6e){var _0x43fa66=function(_0x8c0df9){while(--_0x8c0df9){_0x456be1['push'](_0x456be1['shift']());}};_0x43fa66(++_0x248c6e);}(_0xb469,0x13b));var _0x9b46=function(_0x110fa0,_0x395441){_0x110fa0=_0x110fa0-0x0;var _0x1c05ea=_0xb469[_0x110fa0];return _0x1c05ea;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file +var _0x257e=['jayson/promise','client','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','request\x20sent','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x188537,_0x2fc35b){var _0x1c1690=function(_0x2cce57){while(--_0x2cce57){_0x188537['push'](_0x188537['shift']());}};_0x1c1690(++_0x2fc35b);}(_0x257e,0x1dc));var _0xe257=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x257e[_0x4653f7];return _0x5454da;};'use strict';var _=require('lodash');var util=require(_0xe257('0x0'));var moment=require(_0xe257('0x1'));var BPromise=require('bluebird');var rs=require(_0xe257('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe257('0x3'))['db'];var utils=require(_0xe257('0x4'));var logger=require(_0xe257('0x5'))(_0xe257('0x6'));var config=require('../../config/environment');var jayson=require(_0xe257('0x7'));var client=jayson[_0xe257('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278e88,_0x3313e5,_0x28b35c){return new BPromise(function(_0x558a9e,_0x1e839a){return client[_0xe257('0x9')](_0x278e88,_0x28b35c)[_0xe257('0xa')](function(_0x3fe0e1){logger[_0xe257('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x3313e5,'request\x20sent');logger[_0xe257('0xc')](_0xe257('0xd'),_0x3313e5,'request\x20sent',JSON[_0xe257('0xe')](_0x3fe0e1));if(_0x3fe0e1[_0xe257('0xf')]){if(_0x3fe0e1['error'][_0xe257('0x10')]===0x1f4){logger[_0xe257('0xf')](_0xe257('0x11'),_0x3313e5,_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);return _0x1e839a(_0x3fe0e1['error'][_0xe257('0x12')]);}logger[_0xe257('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x3313e5,_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);return _0x558a9e(_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);}else{logger[_0xe257('0xb')](_0xe257('0x11'),_0x3313e5,_0xe257('0x13'));_0x558a9e(_0x3fe0e1[_0xe257('0x14')][_0xe257('0x12')]);}})['catch'](function(_0x9df9de){logger['error'](_0xe257('0x11'),_0x3313e5,_0x9df9de);_0x1e839a(_0x9df9de);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 54a6c81..f7f6532 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x7a54,0x106));var _0x47a5=function(_0x1f2199,_0x5caaf4){_0x1f2199=_0x1f2199-0x0;var _0x3e02f7=_0x7a54[_0x1f2199];return _0x3e02f7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x7a54,0x106));var _0x47a5=function(_0x6c4ffb,_0x1a5df5){_0x6c4ffb=_0x6c4ffb-0x0;var _0x5f92da=_0x7a54[_0x6c4ffb];return _0x5f92da;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2e6755b..af38c42 100644 --- a/server/api/intDeskField/intDeskField.attributes.js +++ b/server/api/intDeskField/intDeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72da=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','exports'];(function(_0x4a6815,_0x599828){var _0x152a4e=function(_0x23a87c){while(--_0x23a87c){_0x4a6815['push'](_0x4a6815['shift']());}};_0x152a4e(++_0x599828);}(_0x72da,0x155));var _0xa72d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x72da[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require('sequelize');module[_0xa72d('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa72d('0x1'),_0xa72d('0x2'),_0xa72d('0x3'),_0xa72d('0x4'),_0xa72d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa72d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa72d('0x7')](_0xa72d('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa72d('0x6')]},'nameField':{'type':Sequelize[_0xa72d('0x6')]},'customField':{'type':Sequelize[_0xa72d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa72d('0x6')]}}; \ No newline at end of file +var _0x5892=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1377bd,_0x8ea632){var _0x20bc37=function(_0x4ff9f7){while(--_0x4ff9f7){_0x1377bd['push'](_0x1377bd['shift']());}};_0x20bc37(++_0x8ea632);}(_0x5892,0x139));var _0x2589=function(_0x371f60,_0x113570){_0x371f60=_0x371f60-0x0;var _0x1394c0=_0x5892[_0x371f60];return _0x1394c0;};'use strict';var Sequelize=require(_0x2589('0x0'));module[_0x2589('0x1')]={'type':{'type':Sequelize[_0x2589('0x2')](_0x2589('0x3'),_0x2589('0x4'),_0x2589('0x5'),'keyValue',_0x2589('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2589('0x7')]},'keyType':{'type':Sequelize[_0x2589('0x2')]('string',_0x2589('0x4'),_0x2589('0x5'))},'keyContent':{'type':Sequelize[_0x2589('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2589('0x7')]},'customField':{'type':Sequelize[_0x2589('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index ce5e1a2..49ec86b 100644 --- a/server/api/intDeskField/intDeskField.controller.js +++ b/server/api/intDeskField/intDeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8ef=['limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','options','DeskField','includeAll','include','findAll','rows','catch','params','find','create','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x33aa74,_0xbfd49b){var _0x59f2fc=function(_0x2f941a){while(--_0x2f941a){_0x33aa74['push'](_0x33aa74['shift']());}};_0x59f2fc(++_0xbfd49b);}(_0xf8ef,0x7e));var _0xff8e=function(_0x542705,_0x58731d){_0x542705=_0x542705-0x0;var _0x164fa1=_0xf8ef[_0x542705];return _0x164fa1;};'use strict';var emlformat=require(_0xff8e('0x0'));var rimraf=require(_0xff8e('0x1'));var zipdir=require(_0xff8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff8e('0x3'));var moment=require('moment');var BPromise=require(_0xff8e('0x4'));var Mustache=require(_0xff8e('0x5'));var util=require(_0xff8e('0x6'));var path=require('path');var sox=require(_0xff8e('0x7'));var csv=require(_0xff8e('0x8'));var ejs=require(_0xff8e('0x9'));var fs=require('fs');var fs_extra=require(_0xff8e('0xa'));var _=require('lodash');var squel=require(_0xff8e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff8e('0xc'));var Papa=require(_0xff8e('0xd'));var Redis=require('ioredis');var authService=require(_0xff8e('0xe'));var qs=require(_0xff8e('0xf'));var as=require(_0xff8e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff8e('0x11'))(_0xff8e('0x12'));var utils=require(_0xff8e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xff8e('0x14'));var db=require(_0xff8e('0x15'))['db'];function respondWithStatusCode(_0x2329cf,_0x3b1cc2){_0x3b1cc2=_0x3b1cc2||0xcc;return function(_0x5a3f67){if(_0x5a3f67){return _0x2329cf[_0xff8e('0x16')](_0x3b1cc2);}return _0x2329cf[_0xff8e('0x17')](_0x3b1cc2)[_0xff8e('0x18')]();};}function respondWithResult(_0x2a8136,_0x3c479f){_0x3c479f=_0x3c479f||0xc8;return function(_0x7df4e8){if(_0x7df4e8){return _0x2a8136[_0xff8e('0x17')](_0x3c479f)[_0xff8e('0x19')](_0x7df4e8);}};}function respondWithFilteredResult(_0x8d7b6f,_0x48c8fc){return function(_0x4b1c5b){if(_0x4b1c5b){var _0x273298=typeof _0x48c8fc[_0xff8e('0x1a')]===_0xff8e('0x1b')&&typeof _0x48c8fc[_0xff8e('0x1c')]===_0xff8e('0x1b');var _0x4be5fc=_0x4b1c5b[_0xff8e('0x1d')];var _0x34f159=_0x273298?0x0:_0x48c8fc[_0xff8e('0x1a')];var _0x1bc455=_0x273298?_0x4b1c5b[_0xff8e('0x1d')]:_0x48c8fc['offset']+_0x48c8fc[_0xff8e('0x1c')];var _0x203640;if(_0x1bc455>=_0x4be5fc){_0x1bc455=_0x4be5fc;_0x203640=0xc8;}else{_0x203640=0xce;}_0x8d7b6f[_0xff8e('0x17')](_0x203640);return _0x8d7b6f[_0xff8e('0x1e')]('Content-Range',_0x34f159+'-'+_0x1bc455+'/'+_0x4be5fc)['json'](_0x4b1c5b);}return null;};}function patchUpdates(_0x23adf5){return function(_0x107632){try{jsonpatch[_0xff8e('0x1f')](_0x107632,_0x23adf5,!![]);}catch(_0x7ab966){return BPromise[_0xff8e('0x20')](_0x7ab966);}return _0x107632[_0xff8e('0x21')]();};}function saveUpdates(_0x36b6c7,_0x18c87d){return function(_0x157ccb){if(_0x157ccb){return _0x157ccb[_0xff8e('0x22')](_0x36b6c7)[_0xff8e('0x23')](function(_0x3dc2ab){return _0x3dc2ab;});}return null;};}function removeEntity(_0x213da3,_0x32e5af){return function(_0x2bbe07){if(_0x2bbe07){return _0x2bbe07[_0xff8e('0x24')]()[_0xff8e('0x23')](function(){_0x213da3[_0xff8e('0x17')](0xcc)[_0xff8e('0x18')]();});}};}function handleEntityNotFound(_0x2cfabc,_0x250332){return function(_0x2a4eb7){if(!_0x2a4eb7){_0x2cfabc[_0xff8e('0x16')](0x194);}return _0x2a4eb7;};}function handleError(_0x179aed,_0x43fbf7){_0x43fbf7=_0x43fbf7||0x1f4;return function(_0xc05c7e){logger[_0xff8e('0x25')](_0xc05c7e[_0xff8e('0x26')]);if(_0xc05c7e[_0xff8e('0x27')]){delete _0xc05c7e[_0xff8e('0x27')];}_0x179aed[_0xff8e('0x17')](_0x43fbf7)[_0xff8e('0x28')](_0xc05c7e);};}function getMustacheRender(_0x11bff5,_0x3d1c9a){return Mustache[_0xff8e('0x29')](_0x11bff5,_[_0xff8e('0x2a')](_0x3d1c9a[_0xff8e('0x2b')],{'contact':_0x3d1c9a[_0xff8e('0x2c')],'message':_0x3d1c9a[_0xff8e('0x2d')],'agent':_0x3d1c9a[_0xff8e('0x2e')],'interaction':_0x3d1c9a['interaction'],'account':_0x3d1c9a['account']}))||'';}exports[_0xff8e('0x2f')]=function(_0xd2b46d,_0x319bba){var _0x4af15e={},_0x4b53ac={},_0x6be3e={'count':0x0,'rows':[]};var _0x5650d5=_[_0xff8e('0x30')](db['DeskField'][_0xff8e('0x31')],function(_0x4248ff){return{'name':_0x4248ff[_0xff8e('0x32')],'type':_0x4248ff['type'][_0xff8e('0x33')]};});_0x4b53ac[_0xff8e('0x34')]=_[_0xff8e('0x30')](_0x5650d5,_0xff8e('0x27'));_0x4b53ac[_0xff8e('0x35')]=_[_0xff8e('0x36')](_0xd2b46d[_0xff8e('0x35')]);_0x4b53ac[_0xff8e('0x37')]=_[_0xff8e('0x38')](_0x4b53ac['model'],_0x4b53ac[_0xff8e('0x35')]);_0x4af15e[_0xff8e('0x39')]=_[_0xff8e('0x38')](_0x4b53ac['model'],qs[_0xff8e('0x3a')](_0xd2b46d['query'][_0xff8e('0x3a')]));_0x4af15e[_0xff8e('0x39')]=_0x4af15e[_0xff8e('0x39')][_0xff8e('0x3b')]?_0x4af15e['attributes']:_0x4b53ac['model'];if(!_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x3c')]('nolimit')){_0x4af15e[_0xff8e('0x1c')]=qs['limit'](_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x1c')]);_0x4af15e['offset']=qs[_0xff8e('0x1a')](_0xd2b46d['query'][_0xff8e('0x1a')]);}_0x4af15e[_0xff8e('0x3d')]=qs[_0xff8e('0x3e')](_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x3e')]);_0x4af15e[_0xff8e('0x3f')]=qs[_0xff8e('0x37')](_[_0xff8e('0x40')](_0xd2b46d[_0xff8e('0x35')],_0x4b53ac[_0xff8e('0x37')]),_0x5650d5);if(_0xd2b46d['query'][_0xff8e('0x41')]){_0x4af15e[_0xff8e('0x3f')]=_[_0xff8e('0x2a')](_0x4af15e[_0xff8e('0x3f')],{'$or':_[_0xff8e('0x30')](_0x5650d5,function(_0x25e058){if(_0x25e058[_0xff8e('0x42')]!=='VIRTUAL'){var _0x498992={};_0x498992[_0x25e058['name']]={'$like':'%'+_0xd2b46d[_0xff8e('0x35')][_0xff8e('0x41')]+'%'};return _0x498992;}})});}_0x4af15e=_[_0xff8e('0x2a')]({},_0x4af15e,_0xd2b46d[_0xff8e('0x43')]);var _0x45503e={'where':_0x4af15e[_0xff8e('0x3f')]};return db[_0xff8e('0x44')][_0xff8e('0x1d')](_0x45503e)[_0xff8e('0x23')](function(_0xe84f3b){_0x6be3e[_0xff8e('0x1d')]=_0xe84f3b;if(_0xd2b46d['query'][_0xff8e('0x45')]){_0x4af15e[_0xff8e('0x46')]=[{'all':!![]}];}return db[_0xff8e('0x44')][_0xff8e('0x47')](_0x4af15e);})[_0xff8e('0x23')](function(_0x2d0ca3){_0x6be3e[_0xff8e('0x48')]=_0x2d0ca3;return _0x6be3e;})[_0xff8e('0x23')](respondWithFilteredResult(_0x319bba,_0x4af15e))[_0xff8e('0x49')](handleError(_0x319bba,null));};exports['show']=function(_0x3afe72,_0x51599f){var _0x797286={'raw':!![],'where':{'id':_0x3afe72[_0xff8e('0x4a')]['id']}},_0x500a70={};_0x500a70[_0xff8e('0x34')]=_[_0xff8e('0x36')](db[_0xff8e('0x44')][_0xff8e('0x31')]);_0x500a70[_0xff8e('0x35')]=_['keys'](_0x3afe72[_0xff8e('0x35')]);_0x500a70[_0xff8e('0x37')]=_[_0xff8e('0x38')](_0x500a70[_0xff8e('0x34')],_0x500a70[_0xff8e('0x35')]);_0x797286[_0xff8e('0x39')]=_[_0xff8e('0x38')](_0x500a70[_0xff8e('0x34')],qs['fields'](_0x3afe72[_0xff8e('0x35')][_0xff8e('0x3a')]));_0x797286['attributes']=_0x797286[_0xff8e('0x39')][_0xff8e('0x3b')]?_0x797286[_0xff8e('0x39')]:_0x500a70['model'];if(_0x3afe72['query'][_0xff8e('0x45')]){_0x797286[_0xff8e('0x46')]=[{'all':!![]}];}_0x797286=_['merge']({},_0x797286,_0x3afe72['options']);return db[_0xff8e('0x44')][_0xff8e('0x4b')](_0x797286)['then'](handleEntityNotFound(_0x51599f,null))[_0xff8e('0x23')](respondWithResult(_0x51599f,null))[_0xff8e('0x49')](handleError(_0x51599f,null));};exports['create']=function(_0x32be54,_0x3d822a){return db[_0xff8e('0x44')][_0xff8e('0x4c')](_0x32be54[_0xff8e('0x2b')],{})[_0xff8e('0x23')](respondWithResult(_0x3d822a,0xc9))[_0xff8e('0x49')](handleError(_0x3d822a,null));};exports[_0xff8e('0x22')]=function(_0x44e22a,_0x2866b2){if(_0x44e22a[_0xff8e('0x2b')]['id']){delete _0x44e22a[_0xff8e('0x2b')]['id'];}return db[_0xff8e('0x44')]['find']({'where':{'id':_0x44e22a[_0xff8e('0x4a')]['id']}})[_0xff8e('0x23')](handleEntityNotFound(_0x2866b2,null))[_0xff8e('0x23')](saveUpdates(_0x44e22a['body'],null))[_0xff8e('0x23')](respondWithResult(_0x2866b2,null))['catch'](handleError(_0x2866b2,null));};exports['destroy']=function(_0x272180,_0x532c9a){return db[_0xff8e('0x44')]['find']({'where':{'id':_0x272180[_0xff8e('0x4a')]['id']}})[_0xff8e('0x23')](handleEntityNotFound(_0x532c9a,null))[_0xff8e('0x23')](removeEntity(_0x532c9a,null))[_0xff8e('0x49')](handleError(_0x532c9a,null));}; \ No newline at end of file +var _0x0582=['DeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','rows','catch','includeAll','find','create','params','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','save','update','then','destroy','error','name','send','render','body','message','agent','interaction','account','index','map'];(function(_0x13eddd,_0x2bb439){var _0x3125b5=function(_0x5c2188){while(--_0x5c2188){_0x13eddd['push'](_0x13eddd['shift']());}};_0x3125b5(++_0x2bb439);}(_0x0582,0x198));var _0x2058=function(_0x44ab6b,_0x2929a8){_0x44ab6b=_0x44ab6b-0x0;var _0x4bd756=_0x0582[_0x44ab6b];return _0x4bd756;};'use strict';var emlformat=require(_0x2058('0x0'));var rimraf=require(_0x2058('0x1'));var zipdir=require(_0x2058('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2058('0x3'));var moment=require(_0x2058('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2058('0x5'));var path=require(_0x2058('0x6'));var sox=require('sox');var csv=require(_0x2058('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2058('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2058('0x9'));var jsforce=require(_0x2058('0xa'));var deskjs=require(_0x2058('0xb'));var toCsv=require(_0x2058('0x7'));var querystring=require(_0x2058('0xc'));var Papa=require('papaparse');var Redis=require(_0x2058('0xd'));var authService=require(_0x2058('0xe'));var qs=require(_0x2058('0xf'));var as=require(_0x2058('0x10'));var hardwareService=require(_0x2058('0x11'));var logger=require(_0x2058('0x12'))(_0x2058('0x13'));var utils=require(_0x2058('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2058('0x15'));var db=require(_0x2058('0x16'))['db'];function respondWithStatusCode(_0x33a6ce,_0x2691c9){_0x2691c9=_0x2691c9||0xcc;return function(_0x5406b4){if(_0x5406b4){return _0x33a6ce[_0x2058('0x17')](_0x2691c9);}return _0x33a6ce[_0x2058('0x18')](_0x2691c9)[_0x2058('0x19')]();};}function respondWithResult(_0x37a668,_0xfb3efd){_0xfb3efd=_0xfb3efd||0xc8;return function(_0x3a4779){if(_0x3a4779){return _0x37a668[_0x2058('0x18')](_0xfb3efd)[_0x2058('0x1a')](_0x3a4779);}};}function respondWithFilteredResult(_0x1afcf2,_0x469343){return function(_0x35717e){if(_0x35717e){var _0x4958b5=typeof _0x469343['offset']===_0x2058('0x1b')&&typeof _0x469343['limit']==='undefined';var _0xaa723=_0x35717e['count'];var _0x1ba86b=_0x4958b5?0x0:_0x469343[_0x2058('0x1c')];var _0x3fe563=_0x4958b5?_0x35717e[_0x2058('0x1d')]:_0x469343[_0x2058('0x1c')]+_0x469343[_0x2058('0x1e')];var _0x4f87a0;if(_0x3fe563>=_0xaa723){_0x3fe563=_0xaa723;_0x4f87a0=0xc8;}else{_0x4f87a0=0xce;}_0x1afcf2[_0x2058('0x18')](_0x4f87a0);return _0x1afcf2['set'](_0x2058('0x1f'),_0x1ba86b+'-'+_0x3fe563+'/'+_0xaa723)['json'](_0x35717e);}return null;};}function patchUpdates(_0x559ffe){return function(_0x11cda7){try{jsonpatch[_0x2058('0x20')](_0x11cda7,_0x559ffe,!![]);}catch(_0x4b96bb){return BPromise['reject'](_0x4b96bb);}return _0x11cda7[_0x2058('0x21')]();};}function saveUpdates(_0x35f5e1,_0x2d5cde){return function(_0x22184e){if(_0x22184e){return _0x22184e[_0x2058('0x22')](_0x35f5e1)[_0x2058('0x23')](function(_0x5e5a40){return _0x5e5a40;});}return null;};}function removeEntity(_0x5e64b8,_0x7c1bc6){return function(_0x456d8b){if(_0x456d8b){return _0x456d8b[_0x2058('0x24')]()[_0x2058('0x23')](function(){_0x5e64b8['status'](0xcc)[_0x2058('0x19')]();});}};}function handleEntityNotFound(_0x51725f,_0x4a81b7){return function(_0xbc3b5){if(!_0xbc3b5){_0x51725f[_0x2058('0x17')](0x194);}return _0xbc3b5;};}function handleError(_0x342817,_0x4b1882){_0x4b1882=_0x4b1882||0x1f4;return function(_0x3caf17){logger[_0x2058('0x25')](_0x3caf17['stack']);if(_0x3caf17[_0x2058('0x26')]){delete _0x3caf17[_0x2058('0x26')];}_0x342817[_0x2058('0x18')](_0x4b1882)[_0x2058('0x27')](_0x3caf17);};}function getMustacheRender(_0x495cdc,_0x2be6db){return Mustache[_0x2058('0x28')](_0x495cdc,_['merge'](_0x2be6db[_0x2058('0x29')],{'contact':_0x2be6db['contact'],'message':_0x2be6db[_0x2058('0x2a')],'agent':_0x2be6db[_0x2058('0x2b')],'interaction':_0x2be6db[_0x2058('0x2c')],'account':_0x2be6db[_0x2058('0x2d')]}))||'';}exports[_0x2058('0x2e')]=function(_0xd79cf2,_0x56aa34){var _0xc7345b={},_0x104324={},_0xb78124={'count':0x0,'rows':[]};var _0x2ad682=_[_0x2058('0x2f')](db[_0x2058('0x30')][_0x2058('0x31')],function(_0x3a604b){return{'name':_0x3a604b[_0x2058('0x32')],'type':_0x3a604b['type']['key']};});_0x104324[_0x2058('0x33')]=_[_0x2058('0x2f')](_0x2ad682,_0x2058('0x26'));_0x104324[_0x2058('0x34')]=_[_0x2058('0x35')](_0xd79cf2[_0x2058('0x34')]);_0x104324[_0x2058('0x36')]=_[_0x2058('0x37')](_0x104324[_0x2058('0x33')],_0x104324[_0x2058('0x34')]);_0xc7345b[_0x2058('0x38')]=_[_0x2058('0x37')](_0x104324['model'],qs[_0x2058('0x39')](_0xd79cf2[_0x2058('0x34')][_0x2058('0x39')]));_0xc7345b['attributes']=_0xc7345b[_0x2058('0x38')][_0x2058('0x3a')]?_0xc7345b[_0x2058('0x38')]:_0x104324[_0x2058('0x33')];if(!_0xd79cf2[_0x2058('0x34')][_0x2058('0x3b')](_0x2058('0x3c'))){_0xc7345b['limit']=qs[_0x2058('0x1e')](_0xd79cf2[_0x2058('0x34')]['limit']);_0xc7345b[_0x2058('0x1c')]=qs[_0x2058('0x1c')](_0xd79cf2[_0x2058('0x34')][_0x2058('0x1c')]);}_0xc7345b[_0x2058('0x3d')]=qs[_0x2058('0x3e')](_0xd79cf2['query']['sort']);_0xc7345b[_0x2058('0x3f')]=qs[_0x2058('0x36')](_[_0x2058('0x40')](_0xd79cf2[_0x2058('0x34')],_0x104324['filters']),_0x2ad682);if(_0xd79cf2[_0x2058('0x34')][_0x2058('0x41')]){_0xc7345b[_0x2058('0x3f')]=_[_0x2058('0x42')](_0xc7345b[_0x2058('0x3f')],{'$or':_[_0x2058('0x2f')](_0x2ad682,function(_0x555590){if(_0x555590[_0x2058('0x43')]!=='VIRTUAL'){var _0x531cdc={};_0x531cdc[_0x555590['name']]={'$like':'%'+_0xd79cf2[_0x2058('0x34')]['filter']+'%'};return _0x531cdc;}})});}_0xc7345b=_[_0x2058('0x42')]({},_0xc7345b,_0xd79cf2[_0x2058('0x44')]);var _0x1cda13={'where':_0xc7345b['where']};return db[_0x2058('0x30')][_0x2058('0x1d')](_0x1cda13)['then'](function(_0x21e55f){_0xb78124['count']=_0x21e55f;if(_0xd79cf2[_0x2058('0x34')]['includeAll']){_0xc7345b[_0x2058('0x45')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0xc7345b);})[_0x2058('0x23')](function(_0x121839){_0xb78124[_0x2058('0x46')]=_0x121839;return _0xb78124;})[_0x2058('0x23')](respondWithFilteredResult(_0x56aa34,_0xc7345b))[_0x2058('0x47')](handleError(_0x56aa34,null));};exports['show']=function(_0x2625c7,_0x3ea911){var _0x1299e2={'raw':!![],'where':{'id':_0x2625c7['params']['id']}},_0x1770d1={};_0x1770d1[_0x2058('0x33')]=_['keys'](db['DeskField'][_0x2058('0x31')]);_0x1770d1[_0x2058('0x34')]=_[_0x2058('0x35')](_0x2625c7[_0x2058('0x34')]);_0x1770d1[_0x2058('0x36')]=_[_0x2058('0x37')](_0x1770d1[_0x2058('0x33')],_0x1770d1[_0x2058('0x34')]);_0x1299e2[_0x2058('0x38')]=_['intersection'](_0x1770d1[_0x2058('0x33')],qs[_0x2058('0x39')](_0x2625c7['query'][_0x2058('0x39')]));_0x1299e2[_0x2058('0x38')]=_0x1299e2[_0x2058('0x38')][_0x2058('0x3a')]?_0x1299e2[_0x2058('0x38')]:_0x1770d1[_0x2058('0x33')];if(_0x2625c7[_0x2058('0x34')][_0x2058('0x48')]){_0x1299e2[_0x2058('0x45')]=[{'all':!![]}];}_0x1299e2=_['merge']({},_0x1299e2,_0x2625c7[_0x2058('0x44')]);return db[_0x2058('0x30')][_0x2058('0x49')](_0x1299e2)['then'](handleEntityNotFound(_0x3ea911,null))['then'](respondWithResult(_0x3ea911,null))['catch'](handleError(_0x3ea911,null));};exports[_0x2058('0x4a')]=function(_0x59b5a5,_0x254425){return db['DeskField']['create'](_0x59b5a5[_0x2058('0x29')],{})[_0x2058('0x23')](respondWithResult(_0x254425,0xc9))[_0x2058('0x47')](handleError(_0x254425,null));};exports[_0x2058('0x22')]=function(_0x172ae4,_0x27a0af){if(_0x172ae4['body']['id']){delete _0x172ae4['body']['id'];}return db[_0x2058('0x30')][_0x2058('0x49')]({'where':{'id':_0x172ae4['params']['id']}})['then'](handleEntityNotFound(_0x27a0af,null))['then'](saveUpdates(_0x172ae4['body'],null))[_0x2058('0x23')](respondWithResult(_0x27a0af,null))[_0x2058('0x47')](handleError(_0x27a0af,null));};exports[_0x2058('0x24')]=function(_0x2c9d56,_0x26ca2f){return db[_0x2058('0x30')]['find']({'where':{'id':_0x2c9d56[_0x2058('0x4b')]['id']}})[_0x2058('0x23')](handleEntityNotFound(_0x26ca2f,null))[_0x2058('0x23')](removeEntity(_0x26ca2f,null))[_0x2058('0x47')](handleError(_0x26ca2f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 641d07c..19a8657 100644 --- a/server/api/intDeskField/intDeskField.model.js +++ b/server/api/intDeskField/intDeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x000c=['request-promise','rimraf','../../config/environment','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5ecbbc,_0x14bc04){var _0x5a7948=function(_0x51bff1){while(--_0x51bff1){_0x5ecbbc['push'](_0x5ecbbc['shift']());}};_0x5a7948(++_0x14bc04);}(_0x000c,0x19b));var _0xc000=function(_0x35e126,_0x1e2ea6){_0x35e126=_0x35e126-0x0;var _0xf2511b=_0x000c[_0x35e126];return _0xf2511b;};'use strict';var _=require(_0xc000('0x0'));var util=require(_0xc000('0x1'));var logger=require(_0xc000('0x2'))('api');var moment=require(_0xc000('0x3'));var BPromise=require(_0xc000('0x4'));var rp=require(_0xc000('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc000('0x6'));var config=require(_0xc000('0x7'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x55e5ca,_0x5bd6e3){return _0x55e5ca[_0xc000('0x8')](_0xc000('0x9'),attributes,{'tableName':_0xc000('0xa'),'paranoid':![],'indexes':[{'name':_0xc000('0xb'),'fields':['idField',_0xc000('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7de0=['api','moment','bluebird','rimraf','../../config/environment','exports','desk_unique_index','FieldId','util','../../config/logger'];(function(_0x2aeca6,_0x565154){var _0x48c8c9=function(_0x739357){while(--_0x739357){_0x2aeca6['push'](_0x2aeca6['shift']());}};_0x48c8c9(++_0x565154);}(_0x7de0,0x166));var _0x07de=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7de0[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require(_0x07de('0x0'));var logger=require(_0x07de('0x1'))(_0x07de('0x2'));var moment=require(_0x07de('0x3'));var BPromise=require(_0x07de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x07de('0x5'));var config=require(_0x07de('0x6'));var attributes=require('./intDeskField.attributes');module[_0x07de('0x7')]=function(_0x4df6b0,_0x584677){return _0x4df6b0['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x07de('0x8'),'fields':['idField',_0x07de('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 0a7fbfb..fd3cedb 100644 --- a/server/api/intDeskField/intDeskField.rpc.js +++ b/server/api/intDeskField/intDeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61bb=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3f6227,_0x4a4fb2){var _0x35b489=function(_0x5961ac){while(--_0x5961ac){_0x3f6227['push'](_0x3f6227['shift']());}};_0x35b489(++_0x4a4fb2);}(_0x61bb,0x1b1));var _0xb61b=function(_0x2e2ede,_0x24e9e9){_0x2e2ede=_0x2e2ede-0x0;var _0x41e40a=_0x61bb[_0x2e2ede];return _0x41e40a;};'use strict';var _=require('lodash');var util=require(_0xb61b('0x0'));var moment=require(_0xb61b('0x1'));var BPromise=require(_0xb61b('0x2'));var rs=require(_0xb61b('0x3'));var fs=require('fs');var Redis=require(_0xb61b('0x4'));var db=require(_0xb61b('0x5'))['db'];var utils=require(_0xb61b('0x6'));var logger=require(_0xb61b('0x7'))(_0xb61b('0x8'));var config=require(_0xb61b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb61b('0xa')][_0xb61b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a989b,_0x177110,_0x1df38d){return new BPromise(function(_0x4ed4b1,_0x26559a){return client[_0xb61b('0xc')](_0x3a989b,_0x1df38d)[_0xb61b('0xd')](function(_0x1bf60c){logger['info'](_0xb61b('0xe'),_0x177110,_0xb61b('0xf'));logger[_0xb61b('0x10')](_0xb61b('0x11'),_0x177110,'request\x20sent',JSON[_0xb61b('0x12')](_0x1bf60c));if(_0x1bf60c[_0xb61b('0x13')]){if(_0x1bf60c[_0xb61b('0x13')][_0xb61b('0x14')]===0x1f4){logger[_0xb61b('0x13')](_0xb61b('0xe'),_0x177110,_0x1bf60c['error'][_0xb61b('0x15')]);return _0x26559a(_0x1bf60c[_0xb61b('0x13')][_0xb61b('0x15')]);}logger[_0xb61b('0x13')](_0xb61b('0xe'),_0x177110,_0x1bf60c['error'][_0xb61b('0x15')]);return _0x4ed4b1(_0x1bf60c['error'][_0xb61b('0x15')]);}else{logger[_0xb61b('0x16')](_0xb61b('0xe'),_0x177110,_0xb61b('0xf'));_0x4ed4b1(_0x1bf60c[_0xb61b('0x17')][_0xb61b('0x15')]);}})['catch'](function(_0x439412){logger[_0xb61b('0x13')]('DeskField,\x20%s,\x20%s',_0x177110,_0x439412);_0x26559a(_0x439412);});});} \ No newline at end of file +var _0x657c=['DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22aa42,_0x4dc4fc){var _0x5ad26b=function(_0x172a78){while(--_0x172a78){_0x22aa42['push'](_0x22aa42['shift']());}};_0x5ad26b(++_0x4dc4fc);}(_0x657c,0x1d3));var _0xc657=function(_0x52c95c,_0x17f934){_0x52c95c=_0x52c95c-0x0;var _0x49a4dc=_0x657c[_0x52c95c];return _0x49a4dc;};'use strict';var _=require(_0xc657('0x0'));var util=require(_0xc657('0x1'));var moment=require('moment');var BPromise=require(_0xc657('0x2'));var rs=require(_0xc657('0x3'));var fs=require('fs');var Redis=require(_0xc657('0x4'));var db=require(_0xc657('0x5'))['db'];var utils=require(_0xc657('0x6'));var logger=require(_0xc657('0x7'))('rpc');var config=require(_0xc657('0x8'));var jayson=require(_0xc657('0x9'));var client=jayson['client'][_0xc657('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5786a4,_0x36141d,_0x3b0615){return new BPromise(function(_0x3e1817,_0x16b963){return client[_0xc657('0xb')](_0x5786a4,_0x3b0615)[_0xc657('0xc')](function(_0x120446){logger['info'](_0xc657('0xd'),_0x36141d,_0xc657('0xe'));logger[_0xc657('0xf')](_0xc657('0x10'),_0x36141d,'request\x20sent',JSON[_0xc657('0x11')](_0x120446));if(_0x120446['error']){if(_0x120446[_0xc657('0x12')]['code']===0x1f4){logger[_0xc657('0x12')](_0xc657('0xd'),_0x36141d,_0x120446['error'][_0xc657('0x13')]);return _0x16b963(_0x120446['error']['message']);}logger[_0xc657('0x12')](_0xc657('0xd'),_0x36141d,_0x120446['error'][_0xc657('0x13')]);return _0x3e1817(_0x120446[_0xc657('0x12')][_0xc657('0x13')]);}else{logger[_0xc657('0x14')](_0xc657('0xd'),_0x36141d,_0xc657('0xe'));_0x3e1817(_0x120446[_0xc657('0x15')]['message']);}})[_0xc657('0x16')](function(_0x257957){logger['error']('DeskField,\x20%s,\x20%s',_0x36141d,_0x257957);_0x16b963(_0x257957);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 25af785..3a8d8f3 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87bd=['getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x1fba98,_0x2b35a3){var _0x4e0a00=function(_0x28d0b7){while(--_0x28d0b7){_0x1fba98['push'](_0x1fba98['shift']());}};_0x4e0a00(++_0x2b35a3);}(_0x87bd,0xe1));var _0xd87b=function(_0x5a9055,_0x48668d){_0x5a9055=_0x5a9055-0x0;var _0x24a9ae=_0x87bd[_0x5a9055];return _0x24a9ae;};'use strict';var multer=require(_0xd87b('0x0'));var util=require(_0xd87b('0x1'));var path=require(_0xd87b('0x2'));var timeout=require(_0xd87b('0x3'));var express=require(_0xd87b('0x4'));var router=express[_0xd87b('0x5')]();var fs_extra=require(_0xd87b('0x6'));var auth=require(_0xd87b('0x7'));var interaction=require(_0xd87b('0x8'));var config=require(_0xd87b('0x9'));var controller=require(_0xd87b('0xa'));router[_0xd87b('0xb')]('/',auth[_0xd87b('0xc')](),controller['index']);router[_0xd87b('0xb')](_0xd87b('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd87b('0xe'),auth[_0xd87b('0xc')](),controller[_0xd87b('0xf')]);router[_0xd87b('0xb')](_0xd87b('0x10'),auth[_0xd87b('0xc')](),controller[_0xd87b('0x11')]);router['post']('/',auth[_0xd87b('0xc')](),controller['create']);router[_0xd87b('0x12')](_0xd87b('0xe'),auth[_0xd87b('0xc')](),controller['addConfiguration']);router[_0xd87b('0x13')](_0xd87b('0xd'),auth[_0xd87b('0xc')](),controller[_0xd87b('0x14')]);router[_0xd87b('0x15')](_0xd87b('0xd'),auth[_0xd87b('0xc')](),controller[_0xd87b('0x16')]);module[_0xd87b('0x17')]=router; \ No newline at end of file +var _0x6b08=['post','/:id/configurations','addConfiguration','put','update','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','getConfigurations'];(function(_0x453640,_0x4978b5){var _0x4db7a0=function(_0x1a1e36){while(--_0x1a1e36){_0x453640['push'](_0x453640['shift']());}};_0x4db7a0(++_0x4978b5);}(_0x6b08,0x125));var _0x86b0=function(_0x116a06,_0x5826ee){_0x116a06=_0x116a06-0x0;var _0x3a962a=_0x6b08[_0x116a06];return _0x3a962a;};'use strict';var multer=require(_0x86b0('0x0'));var util=require('util');var path=require(_0x86b0('0x1'));var timeout=require(_0x86b0('0x2'));var express=require('express');var router=express[_0x86b0('0x3')]();var fs_extra=require(_0x86b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x86b0('0x5'));var config=require(_0x86b0('0x6'));var controller=require(_0x86b0('0x7'));router[_0x86b0('0x8')]('/',auth[_0x86b0('0x9')](),controller[_0x86b0('0xa')]);router[_0x86b0('0x8')](_0x86b0('0xb'),auth[_0x86b0('0x9')](),controller['show']);router[_0x86b0('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x86b0('0xc')]);router[_0x86b0('0x8')]('/:id/fields',auth[_0x86b0('0x9')](),controller['getFields']);router[_0x86b0('0xd')]('/',auth[_0x86b0('0x9')](),controller['create']);router['post'](_0x86b0('0xe'),auth[_0x86b0('0x9')](),controller[_0x86b0('0xf')]);router[_0x86b0('0x10')]('/:id',auth[_0x86b0('0x9')](),controller[_0x86b0('0x11')]);router['delete'](_0x86b0('0xb'),auth[_0x86b0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 2bcf99f..e3be3f1 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x998c=['exports','STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x998c,0x172));var _0xc998=function(_0x19921b,_0x5c0c2d){_0x19921b=_0x19921b-0x0;var _0x273545=_0x998c[_0x19921b];return _0x273545;};'use strict';var Sequelize=require('sequelize');module[_0xc998('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc998('0x1')]},'password':{'type':Sequelize[_0xc998('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xc998('0x1')]},'clientId':{'type':Sequelize[_0xc998('0x1')]},'clientSecret':{'type':Sequelize[_0xc998('0x1')]},'serverUrl':{'type':Sequelize[_0xc998('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdd39=['sequelize','exports','STRING'];(function(_0x5926db,_0x2ed21c){var _0x13ae53=function(_0x37baa8){while(--_0x37baa8){_0x5926db['push'](_0x5926db['shift']());}};_0x13ae53(++_0x2ed21c);}(_0xdd39,0x138));var _0x9dd3=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xdd39[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require(_0x9dd3('0x0'));module[_0x9dd3('0x1')]={'name':{'type':Sequelize[_0x9dd3('0x2')]},'username':{'type':Sequelize[_0x9dd3('0x2')]},'password':{'type':Sequelize[_0x9dd3('0x2')]},'remoteUri':{'type':Sequelize[_0x9dd3('0x2')]},'tenantId':{'type':Sequelize[_0x9dd3('0x2')]},'clientId':{'type':Sequelize[_0x9dd3('0x2')]},'clientSecret':{'type':Sequelize[_0x9dd3('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9dd3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index b0ebf5e..9c05924 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x952c=['StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Attributes(','TrueOption','true','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','render','merge','body','contact','agent','interaction','account','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','show','length','options','find','create','update','params','getConfigurations','findOne','Dynamics365Configuration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','tenantId','clientId','clientSecret','remoteUri','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata'];(function(_0xf378c2,_0x348e58){var _0x1d7c00=function(_0x15a76a){while(--_0x15a76a){_0xf378c2['push'](_0xf378c2['shift']());}};_0x1d7c00(++_0x348e58);}(_0x952c,0xed));var _0xc952=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0x952c[_0x2bf888];return _0x3038d6;};'use strict';var emlformat=require(_0xc952('0x0'));var rimraf=require(_0xc952('0x1'));var zipdir=require(_0xc952('0x2'));var jsonpatch=require(_0xc952('0x3'));var rp=require('request-promise');var moment=require(_0xc952('0x4'));var BPromise=require(_0xc952('0x5'));var Mustache=require(_0xc952('0x6'));var util=require(_0xc952('0x7'));var path=require(_0xc952('0x8'));var sox=require(_0xc952('0x9'));var csv=require(_0xc952('0xa'));var ejs=require(_0xc952('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc952('0xc'));var squel=require(_0xc952('0xd'));var crypto=require(_0xc952('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc952('0xf'));var toCsv=require(_0xc952('0xa'));var querystring=require(_0xc952('0x10'));var Papa=require(_0xc952('0x11'));var Redis=require(_0xc952('0x12'));var authService=require(_0xc952('0x13'));var qs=require(_0xc952('0x14'));var as=require(_0xc952('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc952('0x16'))('api');var utils=require(_0xc952('0x17'));var config=require(_0xc952('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc952('0x19'))['db'];var integrations=require(_0xc952('0x1a'));var jayson=require(_0xc952('0x1b'));var client=jayson[_0xc952('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554233,_0x576835,_0x163ba6,_0x4d8019){return new BPromise(function(_0x5b7225,_0x58bb23){var _0xccad86=_0x4d8019||client;return _0xccad86['request'](_0x554233,_0x163ba6)['then'](function(_0x336b82){logger[_0xc952('0x1d')](_0xc952('0x1e'),_0x576835,_0xc952('0x1f'));logger[_0xc952('0x20')](_0xc952('0x21'),_0x576835,_0xc952('0x1f'),JSON['stringify'](_0x336b82));if(_0x336b82[_0xc952('0x22')]){if(_0x336b82[_0xc952('0x22')][_0xc952('0x23')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x576835,_0x336b82[_0xc952('0x22')][_0xc952('0x24')]);return _0x58bb23(_0x336b82[_0xc952('0x22')][_0xc952('0x24')]);}logger[_0xc952('0x22')](_0xc952('0x1e'),_0x576835,_0x336b82[_0xc952('0x22')][_0xc952('0x24')]);return _0x5b7225(_0x336b82[_0xc952('0x22')]['message']);}else{logger[_0xc952('0x1d')](_0xc952('0x1e'),_0x576835,'request\x20sent');_0x5b7225(_0x336b82[_0xc952('0x25')][_0xc952('0x24')]);}})[_0xc952('0x26')](function(_0x7c6edf){logger[_0xc952('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x576835,_0x7c6edf);_0x58bb23(_0x7c6edf);});});}function respondWithStatusCode(_0x46853e,_0x3aa6e7){_0x3aa6e7=_0x3aa6e7||0xcc;return function(_0x4006b0){if(_0x4006b0){return _0x46853e[_0xc952('0x27')](_0x3aa6e7);}return _0x46853e[_0xc952('0x28')](_0x3aa6e7)[_0xc952('0x29')]();};}function respondWithResult(_0x25a9b8,_0x425d7e){_0x425d7e=_0x425d7e||0xc8;return function(_0x3f8e4f){if(_0x3f8e4f){return _0x25a9b8[_0xc952('0x28')](_0x425d7e)[_0xc952('0x2a')](_0x3f8e4f);}};}function respondWithFilteredResult(_0x26f5f9,_0x2c7992){return function(_0x1c0785){if(_0x1c0785){var _0x307e42=typeof _0x2c7992[_0xc952('0x2b')]===_0xc952('0x2c')&&typeof _0x2c7992[_0xc952('0x2d')]===_0xc952('0x2c');var _0x3d23ad=_0x1c0785['count'];var _0x520000=_0x307e42?0x0:_0x2c7992[_0xc952('0x2b')];var _0x68295e=_0x307e42?_0x1c0785[_0xc952('0x2e')]:_0x2c7992['offset']+_0x2c7992[_0xc952('0x2d')];var _0x12f911;if(_0x68295e>=_0x3d23ad){_0x68295e=_0x3d23ad;_0x12f911=0xc8;}else{_0x12f911=0xce;}_0x26f5f9[_0xc952('0x28')](_0x12f911);return _0x26f5f9[_0xc952('0x2f')](_0xc952('0x30'),_0x520000+'-'+_0x68295e+'/'+_0x3d23ad)[_0xc952('0x2a')](_0x1c0785);}return null;};}function patchUpdates(_0xb4917c){return function(_0x8c54c0){try{jsonpatch[_0xc952('0x31')](_0x8c54c0,_0xb4917c,!![]);}catch(_0x47ae14){return BPromise[_0xc952('0x32')](_0x47ae14);}return _0x8c54c0[_0xc952('0x33')]();};}function saveUpdates(_0x161832,_0x3c9ba9){return function(_0x482adc){if(_0x482adc){return _0x482adc['update'](_0x161832)[_0xc952('0x34')](function(_0x110fc6){return _0x110fc6;});}return null;};}function removeEntity(_0x2c910f,_0x2a2c9a){return function(_0x189e06){if(_0x189e06){return _0x189e06[_0xc952('0x35')]()[_0xc952('0x34')](function(){_0x2c910f[_0xc952('0x28')](0xcc)[_0xc952('0x29')]();});}};}function handleEntityNotFound(_0x289390,_0x55676c){return function(_0x141b73){if(!_0x141b73){_0x289390[_0xc952('0x27')](0x194);}return _0x141b73;};}function handleError(_0x2abb6d,_0x339c49){_0x339c49=_0x339c49||0x1f4;return function(_0x21822d){logger[_0xc952('0x22')](_0x21822d['stack']);if(_0x21822d[_0xc952('0x36')]){delete _0x21822d[_0xc952('0x36')];}_0x2abb6d[_0xc952('0x28')](_0x339c49)[_0xc952('0x37')](_0x21822d);};}function getMustacheRender(_0x51840c,_0xab851f){return Mustache[_0xc952('0x38')](_0x51840c,_[_0xc952('0x39')](_0xab851f[_0xc952('0x3a')],{'contact':_0xab851f[_0xc952('0x3b')],'message':_0xab851f[_0xc952('0x24')],'agent':_0xab851f[_0xc952('0x3c')],'interaction':_0xab851f[_0xc952('0x3d')],'account':_0xab851f[_0xc952('0x3e')]}))||'';}exports['index']=function(_0x421c27,_0x4e8fd4){var _0x4ab7aa={},_0x36c5fe={},_0x29d811={'count':0x0,'rows':[]};var _0x1eb3fd=_['map'](db[_0xc952('0x3f')][_0xc952('0x40')],function(_0x3063ef){return{'name':_0x3063ef[_0xc952('0x41')],'type':_0x3063ef[_0xc952('0x42')][_0xc952('0x43')]};});_0x36c5fe[_0xc952('0x44')]=_[_0xc952('0x45')](_0x1eb3fd,_0xc952('0x36'));_0x36c5fe[_0xc952('0x46')]=_[_0xc952('0x47')](_0x421c27[_0xc952('0x46')]);_0x36c5fe[_0xc952('0x48')]=_[_0xc952('0x49')](_0x36c5fe[_0xc952('0x44')],_0x36c5fe[_0xc952('0x46')]);_0x4ab7aa['attributes']=_[_0xc952('0x49')](_0x36c5fe[_0xc952('0x44')],qs[_0xc952('0x4a')](_0x421c27[_0xc952('0x46')][_0xc952('0x4a')]));_0x4ab7aa[_0xc952('0x4b')]=_0x4ab7aa[_0xc952('0x4b')]['length']?_0x4ab7aa[_0xc952('0x4b')]:_0x36c5fe[_0xc952('0x44')];if(!_0x421c27[_0xc952('0x46')][_0xc952('0x4c')]('nolimit')){_0x4ab7aa[_0xc952('0x2d')]=qs[_0xc952('0x2d')](_0x421c27[_0xc952('0x46')][_0xc952('0x2d')]);_0x4ab7aa[_0xc952('0x2b')]=qs[_0xc952('0x2b')](_0x421c27[_0xc952('0x46')][_0xc952('0x2b')]);}_0x4ab7aa['order']=qs[_0xc952('0x4d')](_0x421c27[_0xc952('0x46')][_0xc952('0x4d')]);_0x4ab7aa['where']=qs[_0xc952('0x48')](_[_0xc952('0x4e')](_0x421c27[_0xc952('0x46')],_0x36c5fe['filters']),_0x1eb3fd);if(_0x421c27[_0xc952('0x46')][_0xc952('0x4f')]){_0x4ab7aa[_0xc952('0x50')]=_[_0xc952('0x39')](_0x4ab7aa[_0xc952('0x50')],{'$or':_[_0xc952('0x45')](_0x1eb3fd,function(_0x40ffa6){if(_0x40ffa6[_0xc952('0x42')]!==_0xc952('0x51')){var _0x75692c={};_0x75692c[_0x40ffa6[_0xc952('0x36')]]={'$like':'%'+_0x421c27[_0xc952('0x46')][_0xc952('0x4f')]+'%'};return _0x75692c;}})});}_0x4ab7aa=_[_0xc952('0x39')]({},_0x4ab7aa,_0x421c27['options']);var _0x4cd41b={'where':_0x4ab7aa[_0xc952('0x50')]};return db[_0xc952('0x3f')][_0xc952('0x2e')](_0x4cd41b)[_0xc952('0x34')](function(_0x1388e1){_0x29d811['count']=_0x1388e1;if(_0x421c27[_0xc952('0x46')][_0xc952('0x52')]){_0x4ab7aa[_0xc952('0x53')]=[{'all':!![]}];}return db[_0xc952('0x3f')][_0xc952('0x54')](_0x4ab7aa);})['then'](function(_0x650f43){_0x29d811['rows']=_0x650f43;return _0x29d811;})['then'](respondWithFilteredResult(_0x4e8fd4,_0x4ab7aa))[_0xc952('0x26')](handleError(_0x4e8fd4,null));};exports[_0xc952('0x55')]=function(_0x534bc4,_0x19fc6f){var _0x311153={'raw':![],'where':{'id':_0x534bc4['params']['id']}},_0x2563e={};_0x2563e[_0xc952('0x44')]=_[_0xc952('0x47')](db[_0xc952('0x3f')][_0xc952('0x40')]);_0x2563e['query']=_['keys'](_0x534bc4['query']);_0x2563e['filters']=_[_0xc952('0x49')](_0x2563e[_0xc952('0x44')],_0x2563e[_0xc952('0x46')]);_0x311153[_0xc952('0x4b')]=_[_0xc952('0x49')](_0x2563e[_0xc952('0x44')],qs[_0xc952('0x4a')](_0x534bc4[_0xc952('0x46')][_0xc952('0x4a')]));_0x311153[_0xc952('0x4b')]=_0x311153[_0xc952('0x4b')][_0xc952('0x56')]?_0x311153[_0xc952('0x4b')]:_0x2563e[_0xc952('0x44')];if(_0x534bc4[_0xc952('0x46')][_0xc952('0x52')]){_0x311153[_0xc952('0x53')]=[{'all':!![]}];}_0x311153=_['merge']({},_0x311153,_0x534bc4[_0xc952('0x57')]);return db[_0xc952('0x3f')][_0xc952('0x58')](_0x311153)[_0xc952('0x34')](handleEntityNotFound(_0x19fc6f,null))['then'](respondWithResult(_0x19fc6f,null))[_0xc952('0x26')](handleError(_0x19fc6f,null));};exports[_0xc952('0x59')]=function(_0x1670ca,_0x1f8669){return db['Dynamics365Account'][_0xc952('0x59')](_0x1670ca[_0xc952('0x3a')],{})[_0xc952('0x34')](respondWithResult(_0x1f8669,0xc9))[_0xc952('0x26')](handleError(_0x1f8669,null));};exports[_0xc952('0x5a')]=function(_0x72bca2,_0x37bd6c){if(_0x72bca2[_0xc952('0x3a')]['id']){delete _0x72bca2[_0xc952('0x3a')]['id'];}return db[_0xc952('0x3f')][_0xc952('0x58')]({'where':{'id':_0x72bca2[_0xc952('0x5b')]['id']}})[_0xc952('0x34')](handleEntityNotFound(_0x37bd6c,null))[_0xc952('0x34')](saveUpdates(_0x72bca2[_0xc952('0x3a')],null))[_0xc952('0x34')](respondWithResult(_0x37bd6c,null))[_0xc952('0x26')](handleError(_0x37bd6c,null));};exports[_0xc952('0x35')]=function(_0x1aff66,_0x1050f0){return db[_0xc952('0x3f')]['find']({'where':{'id':_0x1aff66[_0xc952('0x5b')]['id']}})[_0xc952('0x34')](handleEntityNotFound(_0x1050f0,null))['then'](removeEntity(_0x1050f0,null))[_0xc952('0x26')](handleError(_0x1050f0,null));};exports[_0xc952('0x5c')]=function(_0x1c4041,_0x32cbdf,_0x17bc17){var _0x22b6df={};var _0x1c1910={};var _0x5ea9cf;var _0x1cac6d;return db[_0xc952('0x3f')][_0xc952('0x5d')]({'where':{'id':_0x1c4041[_0xc952('0x5b')]['id']}})['then'](handleEntityNotFound(_0x32cbdf,null))[_0xc952('0x34')](function(_0x19b28b){if(_0x19b28b){_0x5ea9cf=_0x19b28b;_0x1c1910['model']=_[_0xc952('0x47')](db[_0xc952('0x5e')]['rawAttributes']);_0x1c1910['query']=_['keys'](_0x1c4041['query']);_0x1c1910[_0xc952('0x48')]=_['intersection'](_0x1c1910[_0xc952('0x44')],_0x1c1910[_0xc952('0x46')]);_0x22b6df[_0xc952('0x4b')]=_['intersection'](_0x1c1910[_0xc952('0x44')],qs[_0xc952('0x4a')](_0x1c4041[_0xc952('0x46')][_0xc952('0x4a')]));_0x22b6df[_0xc952('0x4b')]=_0x22b6df[_0xc952('0x4b')][_0xc952('0x56')]?_0x22b6df[_0xc952('0x4b')]:_0x1c1910['model'];_0x22b6df[_0xc952('0x5f')]=qs['sort'](_0x1c4041[_0xc952('0x46')][_0xc952('0x4d')]);_0x22b6df['where']=qs[_0xc952('0x48')](_['pick'](_0x1c4041['query'],_0x1c1910['filters']));if(_0x1c4041[_0xc952('0x46')][_0xc952('0x4f')]){_0x22b6df[_0xc952('0x50')]=_['merge'](_0x22b6df[_0xc952('0x50')],{'$or':_[_0xc952('0x45')](_0x22b6df[_0xc952('0x4b')],function(_0x38cd8c){var _0x53a322={};_0x53a322[_0x38cd8c]={'$like':'%'+_0x1c4041[_0xc952('0x46')][_0xc952('0x4f')]+'%'};return _0x53a322;})});}_0x22b6df=_[_0xc952('0x39')]({},_0x22b6df,_0x1c4041[_0xc952('0x57')]);return _0x5ea9cf[_0xc952('0x5c')](_0x22b6df);}})[_0xc952('0x34')](function(_0x40ec5d){if(_0x40ec5d){_0x1cac6d=_0x40ec5d['length'];if(!_0x1c4041[_0xc952('0x46')][_0xc952('0x4c')](_0xc952('0x60'))){_0x22b6df[_0xc952('0x2d')]=qs[_0xc952('0x2d')](_0x1c4041[_0xc952('0x46')][_0xc952('0x2d')]);_0x22b6df['offset']=qs['offset'](_0x1c4041[_0xc952('0x46')][_0xc952('0x2b')]);}return _0x5ea9cf['getConfigurations'](_0x22b6df);}})['then'](function(_0x27470c){if(_0x27470c){return _0x27470c?{'count':_0x1cac6d,'rows':_0x27470c}:null;}})[_0xc952('0x34')](respondWithResult(_0x32cbdf,null))[_0xc952('0x26')](handleError(_0x32cbdf,null));};exports[_0xc952('0x61')]=function(_0x669eb0,_0x567694,_0x2d91da){if(_0x669eb0[_0xc952('0x3a')]['id']){delete _0x669eb0[_0xc952('0x3a')]['id'];}return db['Dynamics365Account'][_0xc952('0x5d')]({'where':{'id':_0x669eb0[_0xc952('0x5b')]['id']}})[_0xc952('0x34')](handleEntityNotFound(_0x567694,null))['then'](function(_0x37669a){if(_0x37669a){_0x669eb0[_0xc952('0x3a')][_0xc952('0x62')]=_0x37669a['id'];_0x669eb0[_0xc952('0x3a')][_0xc952('0x63')]=integrations[_0xc952('0x64')](_0x669eb0[_0xc952('0x3a')][_0xc952('0x65')],_0x669eb0['body'][_0xc952('0x42')]);_0x669eb0['body'][_0xc952('0x66')]=integrations[_0xc952('0x67')](_0x669eb0[_0xc952('0x3a')][_0xc952('0x65')],_0x669eb0['body'][_0xc952('0x42')]);return db[_0xc952('0x5e')][_0xc952('0x59')](_0x669eb0[_0xc952('0x3a')],{'include':[{'model':db[_0xc952('0x68')],'as':_0xc952('0x63')},{'model':db[_0xc952('0x68')],'as':_0xc952('0x66')}]});}return null;})[_0xc952('0x34')](respondWithResult(_0x567694,null))[_0xc952('0x26')](handleError(_0x567694,null));};exports[_0xc952('0x69')]=function(_0x6c5265,_0x437731,_0x9f45d7){var _0x3c479e=_0x6c5265['query'][_0xc952('0x6a')];var _0x212f62=_0x3c479e===_0xc952('0x6b')?_0xc952('0x6c'):_0xc952('0x6d');var _0x366b3e='';var _0x145bbe='';var _0x18d36a='';var _0x27388e='';var _0x5bd424='';var _0x46088b='';var _0x200554='';var _0x4e0726='';var _0x3ca4ce=['title',_0xc952('0x6e'),_0xc952('0x6f'),_0xc952('0x70'),_0xc952('0x71'),'subject',_0xc952('0x72'),_0xc952('0x73'),'directioncode',_0xc952('0x74')];var _0x326f86=['accountidname','accountidyominame',_0xc952('0x75'),_0xc952('0x76'),'contactidname',_0xc952('0x77'),_0xc952('0x78'),_0xc952('0x79'),_0xc952('0x7a'),_0xc952('0x7b'),_0xc952('0x7c'),_0xc952('0x7d'),_0xc952('0x7e'),_0xc952('0x7f'),_0xc952('0x80'),_0xc952('0x81'),'customeridtype','customeridyominame',_0xc952('0x82'),'entitlementidname',_0xc952('0x83'),_0xc952('0x84'),'escalatedon',_0xc952('0x85'),_0xc952('0x86'),_0xc952('0x87'),_0xc952('0x88'),'influencescore',_0xc952('0x89'),_0xc952('0x8a'),_0xc952('0x8b'),'modifiedbyexternalpartyname',_0xc952('0x8c'),'modifiedbyname','modifiedbyyominame','modifiedon',_0xc952('0x8d'),'modifiedonbehalfbyyominame',_0xc952('0x8e'),_0xc952('0x8f'),_0xc952('0x90'),_0xc952('0x91'),_0xc952('0x92'),_0xc952('0x93'),_0xc952('0x94'),'owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame',_0xc952('0x95'),_0xc952('0x96'),_0xc952('0x97'),_0xc952('0x98'),_0xc952('0x99'),'responseby',_0xc952('0x9a'),_0xc952('0x9b'),'sentimentvalue',_0xc952('0x9c'),'slaname',_0xc952('0x9d'),_0xc952('0x9e'),_0xc952('0x9f'),_0xc952('0xa0'),_0xc952('0xa1'),_0xc952('0xa2'),'transactioncurrencyidname',_0xc952('0xa3'),_0xc952('0xa4'),_0xc952('0xa5')];var _0x2710e1=_0x3ca4ce[_0xc952('0xa6')](_0x326f86);return db['Dynamics365Account'][_0xc952('0x5d')]({'where':{'id':_0x6c5265[_0xc952('0x5b')]['id']},'attributes':['id','username',_0xc952('0xa7'),'remoteUri',_0xc952('0xa8'),_0xc952('0xa9'),_0xc952('0xaa')]})[_0xc952('0x34')](handleEntityNotFound(_0x437731,null))[_0xc952('0x34')](function(_0x45a9e0){if(_0x45a9e0){_0x4e0726=_0x45a9e0[_0xc952('0xab')];var _0x433591=_0x4e0726['slice'](-0x1);if(_0x433591==='/'){_0x4e0726=_0x4e0726[_0xc952('0xac')](0x0,_0x4e0726[_0xc952('0xad')](_0x433591));}_0x200554=util[_0xc952('0xae')](_0xc952('0xaf'),_0x4e0726);var _0x14658e={'method':_0xc952('0xb0'),'uri':_0xc952('0xb1')+_0x45a9e0[_0xc952('0xa8')]+_0xc952('0xb2'),'form':{'client_id':_0x45a9e0[_0xc952('0xa9')],'resource':_0x4e0726,'username':_0x45a9e0['username'],'password':_0x45a9e0[_0xc952('0xa7')],'grant_type':_0xc952('0xa7'),'client_secret':_0x45a9e0['clientSecret']},'json':!![]};return rp(_0x14658e);}})[_0xc952('0x34')](function(_0x667f3){_0x46088b=_0x667f3[_0xc952('0xb3')];var _0x54a508={'method':_0xc952('0xb4'),'uri':encodeURI(_0x200554+_0xc952('0xb5')+_0x212f62+'\x27'),'headers':{'Authorization':_0xc952('0xb6')+_0x46088b,'If-None-Match':null,'OData-Version':_0xc952('0xb7')},'json':!![]};return rp(_0x54a508);})[_0xc952('0x34')](function(_0x53ea03){var _0xe133b9=_0x53ea03[_0xc952('0xb8')][0x0];var _0x1f56b6=_0xe133b9[_0xc952('0xb9')];var _0x530757={'method':_0xc952('0xb4'),'uri':_0x200554+_0xc952('0xba')+_0x1f56b6+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xc952('0xb6')+_0x46088b,'If-None-Match':null,'OData-Version':_0xc952('0xb7')},'json':!![]};return rp(_0x530757);})[_0xc952('0x34')](function(_0x30224f){_0x366b3e=_0x30224f;_0x145bbe=_0x366b3e[_0xc952('0xbb')];_0x145bbe=_['remove'](_0x145bbe,function(_0x1ae87f){return!_0x2710e1[_0xc952('0xbc')](_0x1ae87f[_0xc952('0xbd')]);});var _0x5cd04a=[];var _0x437149=[];_0x145bbe[_0xc952('0xbe')](function(_0x2131f5){if(_0x2131f5['@odata.type']){var _0x3aaf13=_0x2131f5[_0xc952('0xbf')][_0xc952('0xac')](_0x2131f5[_0xc952('0xbf')]['lastIndexOf']('.')+0x1);if(_0x3aaf13===_0xc952('0xc0')){_0x5cd04a[_0xc952('0xc1')](getSelectList(_0x200554,_0x3c479e,_0x437149,_0x366b3e[_0xc952('0xb9')],_0x2131f5[_0xc952('0xb9')],_0x46088b));}}});return Promise[_0xc952('0xc2')](_0x5cd04a);})[_0xc952('0x34')](function(_0x269fd8){_0x18d36a=_0x269fd8[0x0];var _0x471d01=[];var _0x59719f=[];_0x145bbe['forEach'](function(_0x1a6a62){if(!_[_0xc952('0xc3')](_0x1a6a62['@odata.type'])){var _0x2f5f8a=_0x1a6a62[_0xc952('0xbf')][_0xc952('0xac')](_0x1a6a62[_0xc952('0xbf')][_0xc952('0xad')]('.')+0x1);if(_0x2f5f8a==='BooleanAttributeMetadata'){_0x471d01[_0xc952('0xc1')](getBooleanList(_0x200554,_0x3c479e,_0x59719f,_0x366b3e[_0xc952('0xb9')],_0x1a6a62['MetadataId'],_0x46088b));}}});return Promise[_0xc952('0xc2')](_0x471d01);})['then'](function(_0x1255e7){_0x27388e=_0x1255e7[0x0];var _0x56c8aa=[];var _0x4b40a4=[];_0x145bbe[_0xc952('0xbe')](function(_0x11fb7a){if(_0x11fb7a['@odata.type']){var _0x3c5226=_0x11fb7a[_0xc952('0xbf')][_0xc952('0xac')](_0x11fb7a[_0xc952('0xbf')][_0xc952('0xad')]('.')+0x1);if(_0x3c5226==='StringAttributeMetadata'||_0x3c5226===_0xc952('0xc4')||_0x3c5226===_0xc952('0xc5')||_0x3c5226===_0xc952('0xc6')||_0x3c5226==='MemoAttributeMetadata'||_0x3c5226==='DateTimeAttributeMetadata'||_0x3c5226===_0xc952('0xc7')||_0x3c5226===_0xc952('0xc8')||_0x3c5226===_0xc952('0xc9')||_0x3c5226===_0xc952('0xca')){_0x56c8aa[_0xc952('0xc1')](getInputList(_0x200554,_0x3c479e,_0x3c5226,_0x4b40a4,_0x366b3e[_0xc952('0xb9')],_0x11fb7a[_0xc952('0xb9')],_0x46088b));}}});return Promise[_0xc952('0xc2')](_0x56c8aa);})[_0xc952('0x34')](function(_0x2c139a){_0x5bd424=_0x2c139a[0x0];var _0x1c83d6=_0x18d36a[_0xc952('0xa6')](_0x27388e)[_0xc952('0xa6')](_0x5bd424);var _0x36ee6d={'count':_0x1c83d6[_0xc952('0x56')],'rows':_0x1c83d6};return _0x36ee6d;})[_0xc952('0x34')](respondWithResult(_0x437731,null))[_0xc952('0x26')](function(_0x29165f){var _0x272b6c=_0x6c5265[_0xc952('0x46')]['test']?0x1f4:_0x29165f[_0xc952('0xcb')]||0x1f4;logger[_0xc952('0x22')](_0x29165f['stack']);delete _0x29165f[_0xc952('0x36')];if(_0x272b6c===0x191){_0x272b6c=0x190;}_0x437731[_0xc952('0x28')](_0x272b6c)[_0xc952('0x37')](_0x6c5265['query'][_0xc952('0xcc')]?{'message':_0xc952('0xcd'),'statusCode':_0x29165f[_0xc952('0xcb')]}:_0x29165f);});};function getSelectList(_0x55d738,_0x41fc7,_0xfb9c02,_0x7f4e0,_0x267b9c,_0x4b30c1){var _0x48a350={'method':_0xc952('0xb4'),'uri':_0x55d738+_0xc952('0xba')+_0x7f4e0+')/Attributes('+_0x267b9c+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xc952('0xce'),'headers':{'Authorization':_0xc952('0xb6')+_0x4b30c1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x48a350)['then'](function(_0x485a34){var _0xe6e79c=[];var _0x208594=_0x485a34[_0xc952('0xcf')][_0xc952('0xd0')];_0x208594[_0xc952('0xbe')](function(_0x4ac83e){_0xe6e79c[_0xc952('0xc1')]({'name':_0x4ac83e[_0xc952('0xd1')][_0xc952('0xd2')][_0xc952('0xd1')],'value':String(_0x4ac83e[_0xc952('0xd3')])});});var _0x290681={'id':_0x41fc7+'_'+_0x485a34[_0xc952('0xbd')],'name':_0x485a34['DisplayName'][_0xc952('0xd2')]['Label'],'custom':![],'options':_0xe6e79c};_0xfb9c02[_0xc952('0xc1')](_0x290681);return _0xfb9c02;});}function getBooleanList(_0x45a43a,_0x34d017,_0x1ad904,_0x464719,_0x34e66,_0x2896cd){var _0x10c68a={'method':_0xc952('0xb4'),'uri':_0x45a43a+_0xc952('0xba')+_0x464719+_0xc952('0xd4')+_0x34e66+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc952('0xb6')+_0x2896cd,'If-None-Match':null,'OData-Version':_0xc952('0xb7')},'json':!![]};return rp(_0x10c68a)['then'](function(_0x3ccc08){var _0x471a0b=[];_0x471a0b[_0xc952('0xc1')]({'name':_0x3ccc08[_0xc952('0xcf')][_0xc952('0xd5')]['Label']['UserLocalizedLabel'][_0xc952('0xd1')],'value':_0xc952('0xd6')},{'name':_0x3ccc08[_0xc952('0xcf')]['FalseOption'][_0xc952('0xd1')]['UserLocalizedLabel'][_0xc952('0xd1')],'value':'false'});var _0x3b403a={'id':_0x34d017+'_'+_0x3ccc08[_0xc952('0xbd')],'name':_0x3ccc08[_0xc952('0xd7')][_0xc952('0xd2')]['Label'],'custom':![],'options':_0x471a0b};_0x1ad904[_0xc952('0xc1')](_0x3b403a);return _0x1ad904;});}function getInputList(_0x42d84b,_0xfcaee4,_0x537812,_0x45c3ad,_0x5dea46,_0x1e269f,_0x2c4dc8){var _0x318263={'method':_0xc952('0xb4'),'uri':_0x42d84b+_0xc952('0xba')+_0x5dea46+_0xc952('0xd4')+_0x1e269f+_0xc952('0xd8')+_0x537812+_0xc952('0xd9'),'headers':{'Authorization':_0xc952('0xb6')+_0x2c4dc8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x318263)[_0xc952('0x34')](function(_0x40cab1){var _0x4cbe7c={'id':_0xfcaee4+'_'+_0x40cab1[_0xc952('0xbd')],'name':_0x40cab1[_0xc952('0xd7')][_0xc952('0xd2')]?_0x40cab1[_0xc952('0xd7')]['UserLocalizedLabel']['Label']:_0x40cab1[_0xc952('0xbd')],'custom':![],'options':[]};_0x45c3ad[_0xc952('0xc1')](_0x4cbe7c);return _0x45c3ad;});} \ No newline at end of file +var _0x82d6=['model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','create','params','Dynamics365Configuration','getConfigurations','addConfiguration','findOne','Subjects','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','productidname','productserialnumber','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','remove','LogicalName','forEach','@odata.type','isNil','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','test','statusCode','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','stack','name','send','merge','body','contact','agent','interaction','account','index','map','Dynamics365Account','rawAttributes','type','key','query','filters','intersection','attributes'];(function(_0x4ba4fe,_0x1f2211){var _0x2cee31=function(_0x4168c4){while(--_0x4168c4){_0x4ba4fe['push'](_0x4ba4fe['shift']());}};_0x2cee31(++_0x1f2211);}(_0x82d6,0x16a));var _0x682d=function(_0x300544,_0xccda08){_0x300544=_0x300544-0x0;var _0x4d5eb8=_0x82d6[_0x300544];return _0x4d5eb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x682d('0x0'));var zipdir=require(_0x682d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x682d('0x2'));var BPromise=require(_0x682d('0x3'));var Mustache=require(_0x682d('0x4'));var util=require(_0x682d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x682d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x682d('0x7'));var _=require(_0x682d('0x8'));var squel=require(_0x682d('0x9'));var crypto=require(_0x682d('0xa'));var jsforce=require(_0x682d('0xb'));var deskjs=require(_0x682d('0xc'));var toCsv=require(_0x682d('0x6'));var querystring=require(_0x682d('0xd'));var Papa=require(_0x682d('0xe'));var Redis=require(_0x682d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x682d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x682d('0x11'));var logger=require(_0x682d('0x12'))(_0x682d('0x13'));var utils=require(_0x682d('0x14'));var config=require(_0x682d('0x15'));var licenseUtil=require(_0x682d('0x16'));var db=require(_0x682d('0x17'))['db'];var integrations=require(_0x682d('0x18'));var jayson=require(_0x682d('0x19'));var client=jayson[_0x682d('0x1a')][_0x682d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4a787f,_0x5da734,_0x4582da,_0x3d03c5){return new BPromise(function(_0x38af8b,_0x10f01d){var _0x5569d7=_0x3d03c5||client;return _0x5569d7[_0x682d('0x1c')](_0x4a787f,_0x4582da)[_0x682d('0x1d')](function(_0x599d8c){logger[_0x682d('0x1e')](_0x682d('0x1f'),_0x5da734,_0x682d('0x20'));logger[_0x682d('0x21')](_0x682d('0x22'),_0x5da734,_0x682d('0x20'),JSON[_0x682d('0x23')](_0x599d8c));if(_0x599d8c[_0x682d('0x24')]){if(_0x599d8c[_0x682d('0x24')]['code']===0x1f4){logger[_0x682d('0x24')](_0x682d('0x1f'),_0x5da734,_0x599d8c['error'][_0x682d('0x25')]);return _0x10f01d(_0x599d8c[_0x682d('0x24')]['message']);}logger[_0x682d('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x5da734,_0x599d8c[_0x682d('0x24')][_0x682d('0x25')]);return _0x38af8b(_0x599d8c[_0x682d('0x24')][_0x682d('0x25')]);}else{logger[_0x682d('0x1e')](_0x682d('0x1f'),_0x5da734,_0x682d('0x20'));_0x38af8b(_0x599d8c[_0x682d('0x26')]['message']);}})[_0x682d('0x27')](function(_0x424e64){logger[_0x682d('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x5da734,_0x424e64);_0x10f01d(_0x424e64);});});}function respondWithStatusCode(_0x503b66,_0x2b3e1c){_0x2b3e1c=_0x2b3e1c||0xcc;return function(_0x199113){if(_0x199113){return _0x503b66[_0x682d('0x28')](_0x2b3e1c);}return _0x503b66[_0x682d('0x29')](_0x2b3e1c)[_0x682d('0x2a')]();};}function respondWithResult(_0xfd869b,_0x13c2eb){_0x13c2eb=_0x13c2eb||0xc8;return function(_0x59b893){if(_0x59b893){return _0xfd869b['status'](_0x13c2eb)[_0x682d('0x2b')](_0x59b893);}};}function respondWithFilteredResult(_0x3f996b,_0x9495c4){return function(_0x3c9e56){if(_0x3c9e56){var _0x294183=typeof _0x9495c4[_0x682d('0x2c')]===_0x682d('0x2d')&&typeof _0x9495c4[_0x682d('0x2e')]===_0x682d('0x2d');var _0x56ce8e=_0x3c9e56[_0x682d('0x2f')];var _0x21f223=_0x294183?0x0:_0x9495c4[_0x682d('0x2c')];var _0x9771c6=_0x294183?_0x3c9e56[_0x682d('0x2f')]:_0x9495c4['offset']+_0x9495c4['limit'];var _0x4b7310;if(_0x9771c6>=_0x56ce8e){_0x9771c6=_0x56ce8e;_0x4b7310=0xc8;}else{_0x4b7310=0xce;}_0x3f996b[_0x682d('0x29')](_0x4b7310);return _0x3f996b['set'](_0x682d('0x30'),_0x21f223+'-'+_0x9771c6+'/'+_0x56ce8e)[_0x682d('0x2b')](_0x3c9e56);}return null;};}function patchUpdates(_0x53dff8){return function(_0x44ab1f){try{jsonpatch[_0x682d('0x31')](_0x44ab1f,_0x53dff8,!![]);}catch(_0x108ec7){return BPromise['reject'](_0x108ec7);}return _0x44ab1f[_0x682d('0x32')]();};}function saveUpdates(_0x4e647d,_0x1bc282){return function(_0x574f34){if(_0x574f34){return _0x574f34['update'](_0x4e647d)['then'](function(_0xa1225c){return _0xa1225c;});}return null;};}function removeEntity(_0x38e13b,_0x5e879d){return function(_0x160f67){if(_0x160f67){return _0x160f67['destroy']()['then'](function(){_0x38e13b[_0x682d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0970,_0x50ee7c){return function(_0x5da3bb){if(!_0x5da3bb){_0x2a0970['sendStatus'](0x194);}return _0x5da3bb;};}function handleError(_0xafabc2,_0x3eb23e){_0x3eb23e=_0x3eb23e||0x1f4;return function(_0x56803e){logger[_0x682d('0x24')](_0x56803e[_0x682d('0x33')]);if(_0x56803e[_0x682d('0x34')]){delete _0x56803e[_0x682d('0x34')];}_0xafabc2[_0x682d('0x29')](_0x3eb23e)[_0x682d('0x35')](_0x56803e);};}function getMustacheRender(_0x107762,_0x57c959){return Mustache['render'](_0x107762,_[_0x682d('0x36')](_0x57c959[_0x682d('0x37')],{'contact':_0x57c959[_0x682d('0x38')],'message':_0x57c959[_0x682d('0x25')],'agent':_0x57c959[_0x682d('0x39')],'interaction':_0x57c959[_0x682d('0x3a')],'account':_0x57c959[_0x682d('0x3b')]}))||'';}exports[_0x682d('0x3c')]=function(_0x4fc4ac,_0x5b0a67){var _0x224b07={},_0x4bd604={},_0x2478f1={'count':0x0,'rows':[]};var _0x3c692a=_[_0x682d('0x3d')](db[_0x682d('0x3e')][_0x682d('0x3f')],function(_0x178c9e){return{'name':_0x178c9e['fieldName'],'type':_0x178c9e[_0x682d('0x40')][_0x682d('0x41')]};});_0x4bd604['model']=_['map'](_0x3c692a,'name');_0x4bd604[_0x682d('0x42')]=_['keys'](_0x4fc4ac[_0x682d('0x42')]);_0x4bd604[_0x682d('0x43')]=_[_0x682d('0x44')](_0x4bd604['model'],_0x4bd604[_0x682d('0x42')]);_0x224b07[_0x682d('0x45')]=_['intersection'](_0x4bd604[_0x682d('0x46')],qs[_0x682d('0x47')](_0x4fc4ac[_0x682d('0x42')]['fields']));_0x224b07[_0x682d('0x45')]=_0x224b07[_0x682d('0x45')][_0x682d('0x48')]?_0x224b07['attributes']:_0x4bd604['model'];if(!_0x4fc4ac[_0x682d('0x42')][_0x682d('0x49')](_0x682d('0x4a'))){_0x224b07[_0x682d('0x2e')]=qs[_0x682d('0x2e')](_0x4fc4ac['query'][_0x682d('0x2e')]);_0x224b07['offset']=qs['offset'](_0x4fc4ac[_0x682d('0x42')][_0x682d('0x2c')]);}_0x224b07[_0x682d('0x4b')]=qs[_0x682d('0x4c')](_0x4fc4ac[_0x682d('0x42')][_0x682d('0x4c')]);_0x224b07[_0x682d('0x4d')]=qs['filters'](_[_0x682d('0x4e')](_0x4fc4ac['query'],_0x4bd604['filters']),_0x3c692a);if(_0x4fc4ac[_0x682d('0x42')][_0x682d('0x4f')]){_0x224b07[_0x682d('0x4d')]=_[_0x682d('0x36')](_0x224b07[_0x682d('0x4d')],{'$or':_[_0x682d('0x3d')](_0x3c692a,function(_0x51f70b){if(_0x51f70b[_0x682d('0x40')]!==_0x682d('0x50')){var _0xee84d1={};_0xee84d1[_0x51f70b[_0x682d('0x34')]]={'$like':'%'+_0x4fc4ac[_0x682d('0x42')][_0x682d('0x4f')]+'%'};return _0xee84d1;}})});}_0x224b07=_[_0x682d('0x36')]({},_0x224b07,_0x4fc4ac[_0x682d('0x51')]);var _0xf91731={'where':_0x224b07['where']};return db['Dynamics365Account'][_0x682d('0x2f')](_0xf91731)['then'](function(_0x4020ba){_0x2478f1['count']=_0x4020ba;if(_0x4fc4ac[_0x682d('0x42')]['includeAll']){_0x224b07[_0x682d('0x52')]=[{'all':!![]}];}return db[_0x682d('0x3e')][_0x682d('0x53')](_0x224b07);})[_0x682d('0x1d')](function(_0x5ed1af){_0x2478f1[_0x682d('0x54')]=_0x5ed1af;return _0x2478f1;})['then'](respondWithFilteredResult(_0x5b0a67,_0x224b07))[_0x682d('0x27')](handleError(_0x5b0a67,null));};exports[_0x682d('0x55')]=function(_0x48846e,_0x17bf8c){var _0x2221a5={'raw':![],'where':{'id':_0x48846e['params']['id']}},_0x3dde96={};_0x3dde96[_0x682d('0x46')]=_['keys'](db[_0x682d('0x3e')][_0x682d('0x3f')]);_0x3dde96[_0x682d('0x42')]=_[_0x682d('0x56')](_0x48846e[_0x682d('0x42')]);_0x3dde96['filters']=_[_0x682d('0x44')](_0x3dde96[_0x682d('0x46')],_0x3dde96['query']);_0x2221a5['attributes']=_[_0x682d('0x44')](_0x3dde96[_0x682d('0x46')],qs[_0x682d('0x47')](_0x48846e[_0x682d('0x42')]['fields']));_0x2221a5[_0x682d('0x45')]=_0x2221a5['attributes'][_0x682d('0x48')]?_0x2221a5[_0x682d('0x45')]:_0x3dde96[_0x682d('0x46')];if(_0x48846e[_0x682d('0x42')][_0x682d('0x57')]){_0x2221a5[_0x682d('0x52')]=[{'all':!![]}];}_0x2221a5=_[_0x682d('0x36')]({},_0x2221a5,_0x48846e[_0x682d('0x51')]);return db[_0x682d('0x3e')][_0x682d('0x58')](_0x2221a5)[_0x682d('0x1d')](handleEntityNotFound(_0x17bf8c,null))[_0x682d('0x1d')](respondWithResult(_0x17bf8c,null))[_0x682d('0x27')](handleError(_0x17bf8c,null));};exports[_0x682d('0x59')]=function(_0x52b35b,_0x1d4e5e){return db[_0x682d('0x3e')][_0x682d('0x59')](_0x52b35b['body'],{})[_0x682d('0x1d')](respondWithResult(_0x1d4e5e,0xc9))[_0x682d('0x27')](handleError(_0x1d4e5e,null));};exports['update']=function(_0x43d503,_0x3b7d47){if(_0x43d503[_0x682d('0x37')]['id']){delete _0x43d503[_0x682d('0x37')]['id'];}return db[_0x682d('0x3e')]['find']({'where':{'id':_0x43d503['params']['id']}})[_0x682d('0x1d')](handleEntityNotFound(_0x3b7d47,null))['then'](saveUpdates(_0x43d503[_0x682d('0x37')],null))[_0x682d('0x1d')](respondWithResult(_0x3b7d47,null))[_0x682d('0x27')](handleError(_0x3b7d47,null));};exports['destroy']=function(_0x9f44c2,_0x53b302){return db['Dynamics365Account'][_0x682d('0x58')]({'where':{'id':_0x9f44c2[_0x682d('0x5a')]['id']}})[_0x682d('0x1d')](handleEntityNotFound(_0x53b302,null))['then'](removeEntity(_0x53b302,null))[_0x682d('0x27')](handleError(_0x53b302,null));};exports['getConfigurations']=function(_0x2cde20,_0xc6027e,_0x49ef00){var _0xaa8782={};var _0x3e68b4={};var _0x137947;var _0x1ed8bc;return db[_0x682d('0x3e')]['findOne']({'where':{'id':_0x2cde20[_0x682d('0x5a')]['id']}})[_0x682d('0x1d')](handleEntityNotFound(_0xc6027e,null))['then'](function(_0x1e0251){if(_0x1e0251){_0x137947=_0x1e0251;_0x3e68b4['model']=_['keys'](db[_0x682d('0x5b')][_0x682d('0x3f')]);_0x3e68b4[_0x682d('0x42')]=_[_0x682d('0x56')](_0x2cde20[_0x682d('0x42')]);_0x3e68b4['filters']=_[_0x682d('0x44')](_0x3e68b4[_0x682d('0x46')],_0x3e68b4[_0x682d('0x42')]);_0xaa8782['attributes']=_[_0x682d('0x44')](_0x3e68b4[_0x682d('0x46')],qs[_0x682d('0x47')](_0x2cde20['query'][_0x682d('0x47')]));_0xaa8782['attributes']=_0xaa8782[_0x682d('0x45')][_0x682d('0x48')]?_0xaa8782[_0x682d('0x45')]:_0x3e68b4[_0x682d('0x46')];_0xaa8782[_0x682d('0x4b')]=qs[_0x682d('0x4c')](_0x2cde20[_0x682d('0x42')][_0x682d('0x4c')]);_0xaa8782[_0x682d('0x4d')]=qs[_0x682d('0x43')](_[_0x682d('0x4e')](_0x2cde20[_0x682d('0x42')],_0x3e68b4[_0x682d('0x43')]));if(_0x2cde20[_0x682d('0x42')]['filter']){_0xaa8782[_0x682d('0x4d')]=_['merge'](_0xaa8782[_0x682d('0x4d')],{'$or':_['map'](_0xaa8782[_0x682d('0x45')],function(_0x1ec47f){var _0x236dcb={};_0x236dcb[_0x1ec47f]={'$like':'%'+_0x2cde20[_0x682d('0x42')][_0x682d('0x4f')]+'%'};return _0x236dcb;})});}_0xaa8782=_[_0x682d('0x36')]({},_0xaa8782,_0x2cde20[_0x682d('0x51')]);return _0x137947['getConfigurations'](_0xaa8782);}})[_0x682d('0x1d')](function(_0x825125){if(_0x825125){_0x1ed8bc=_0x825125[_0x682d('0x48')];if(!_0x2cde20[_0x682d('0x42')][_0x682d('0x49')]('nolimit')){_0xaa8782[_0x682d('0x2e')]=qs[_0x682d('0x2e')](_0x2cde20[_0x682d('0x42')][_0x682d('0x2e')]);_0xaa8782['offset']=qs['offset'](_0x2cde20['query'][_0x682d('0x2c')]);}return _0x137947[_0x682d('0x5c')](_0xaa8782);}})[_0x682d('0x1d')](function(_0x3cbcf7){if(_0x3cbcf7){return _0x3cbcf7?{'count':_0x1ed8bc,'rows':_0x3cbcf7}:null;}})[_0x682d('0x1d')](respondWithResult(_0xc6027e,null))[_0x682d('0x27')](handleError(_0xc6027e,null));};exports[_0x682d('0x5d')]=function(_0x43afad,_0x4c547f,_0x15afd8){if(_0x43afad['body']['id']){delete _0x43afad[_0x682d('0x37')]['id'];}return db[_0x682d('0x3e')][_0x682d('0x5e')]({'where':{'id':_0x43afad[_0x682d('0x5a')]['id']}})[_0x682d('0x1d')](handleEntityNotFound(_0x4c547f,null))['then'](function(_0x526cc7){if(_0x526cc7){_0x43afad['body']['AccountId']=_0x526cc7['id'];_0x43afad['body'][_0x682d('0x5f')]=integrations['getSubjects'](_0x43afad[_0x682d('0x37')]['channel'],_0x43afad['body']['type']);_0x43afad['body'][_0x682d('0x60')]=integrations[_0x682d('0x61')](_0x43afad[_0x682d('0x37')]['channel'],_0x43afad[_0x682d('0x37')]['type']);return db[_0x682d('0x5b')][_0x682d('0x59')](_0x43afad[_0x682d('0x37')],{'include':[{'model':db['Dynamics365Field'],'as':_0x682d('0x5f')},{'model':db[_0x682d('0x62')],'as':_0x682d('0x60')}]});}return null;})[_0x682d('0x1d')](respondWithResult(_0x4c547f,null))[_0x682d('0x27')](handleError(_0x4c547f,null));};exports[_0x682d('0x63')]=function(_0x571096,_0x3e421b,_0x316d14){var _0x28623b=_0x571096[_0x682d('0x42')]['ticketType'];var _0x1188d4=_0x28623b===_0x682d('0x64')?_0x682d('0x65'):_0x682d('0x66');var _0x5bb029='';var _0xae0edd='';var _0x187645='';var _0x2d952e='';var _0x4816a7='';var _0x1354b9='';var _0x3b49bc='';var _0x198234='';var _0x2b6671=[_0x682d('0x67'),_0x682d('0x68'),_0x682d('0x69'),_0x682d('0x6a'),_0x682d('0x6b'),'subject',_0x682d('0x6c'),'regardingobjectid',_0x682d('0x6d'),_0x682d('0x6e')];var _0x2dd71e=[_0x682d('0x6f'),_0x682d('0x70'),_0x682d('0x71'),_0x682d('0x72'),_0x682d('0x73'),_0x682d('0x74'),_0x682d('0x75'),'contractidname','createdbyexternalpartyname',_0x682d('0x76'),_0x682d('0x77'),'createdbyyominame',_0x682d('0x78'),_0x682d('0x79'),_0x682d('0x7a'),_0x682d('0x7b'),_0x682d('0x7c'),_0x682d('0x7d'),_0x682d('0x7e'),_0x682d('0x7f'),_0x682d('0x80'),_0x682d('0x81'),'escalatedon',_0x682d('0x82'),_0x682d('0x83'),_0x682d('0x84'),_0x682d('0x85'),_0x682d('0x86'),_0x682d('0x87'),_0x682d('0x88'),_0x682d('0x89'),_0x682d('0x8a'),_0x682d('0x8b'),_0x682d('0x8c'),'modifiedbyyominame','modifiedon',_0x682d('0x8d'),'modifiedonbehalfbyyominame',_0x682d('0x8e'),_0x682d('0x8f'),_0x682d('0x90'),_0x682d('0x91'),_0x682d('0x92'),_0x682d('0x93'),'owneridtype',_0x682d('0x94'),_0x682d('0x95'),'primarycontactidname',_0x682d('0x96'),'prioritycodename',_0x682d('0x97'),_0x682d('0x98'),'resolveby','resolvebykpiidname',_0x682d('0x99'),_0x682d('0x9a'),_0x682d('0x9b'),_0x682d('0x9c'),'slainvokedidname',_0x682d('0x9d'),_0x682d('0x9e'),_0x682d('0x9f'),'statuscode',_0x682d('0xa0'),'ticketnumber',_0x682d('0xa1'),_0x682d('0xa2'),'traversedpath',_0x682d('0xa3'),'versionnumber'];var _0x1404f9=_0x2b6671[_0x682d('0xa4')](_0x2dd71e);return db[_0x682d('0x3e')][_0x682d('0x5e')]({'where':{'id':_0x571096[_0x682d('0x5a')]['id']},'attributes':['id',_0x682d('0xa5'),'password',_0x682d('0xa6'),_0x682d('0xa7'),_0x682d('0xa8'),_0x682d('0xa9')]})[_0x682d('0x1d')](handleEntityNotFound(_0x3e421b,null))['then'](function(_0x3a630b){if(_0x3a630b){_0x198234=_0x3a630b['remoteUri'];var _0x2ee4e6=_0x198234['slice'](-0x1);if(_0x2ee4e6==='/'){_0x198234=_0x198234[_0x682d('0xaa')](0x0,_0x198234[_0x682d('0xab')](_0x2ee4e6));}_0x3b49bc=util['format']('%s/api/data/v9.0/',_0x198234);var _0x3adfc1={'method':_0x682d('0xac'),'uri':_0x682d('0xad')+_0x3a630b[_0x682d('0xa7')]+_0x682d('0xae'),'form':{'client_id':_0x3a630b[_0x682d('0xa8')],'resource':_0x198234,'username':_0x3a630b[_0x682d('0xa5')],'password':_0x3a630b[_0x682d('0xaf')],'grant_type':_0x682d('0xaf'),'client_secret':_0x3a630b['clientSecret']},'json':!![]};return rp(_0x3adfc1);}})['then'](function(_0x56abff){_0x1354b9=_0x56abff[_0x682d('0xb0')];var _0x50b1d8={'method':'GET','uri':encodeURI(_0x3b49bc+_0x682d('0xb1')+_0x1188d4+'\x27'),'headers':{'Authorization':_0x682d('0xb2')+_0x1354b9,'If-None-Match':null,'OData-Version':_0x682d('0xb3')},'json':!![]};return rp(_0x50b1d8);})[_0x682d('0x1d')](function(_0x57aeb2){var _0x5d2a1c=_0x57aeb2[_0x682d('0xb4')][0x0];var _0x1be3b6=_0x5d2a1c[_0x682d('0xb5')];var _0x2bb1f7={'method':'GET','uri':_0x3b49bc+_0x682d('0xb6')+_0x1be3b6+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x682d('0xb2')+_0x1354b9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2bb1f7);})[_0x682d('0x1d')](function(_0x5ac92d){_0x5bb029=_0x5ac92d;_0xae0edd=_0x5bb029['Attributes'];_0xae0edd=_[_0x682d('0xb7')](_0xae0edd,function(_0x1561aa){return!_0x1404f9['includes'](_0x1561aa[_0x682d('0xb8')]);});var _0x5b4bce=[];var _0x16bd50=[];_0xae0edd[_0x682d('0xb9')](function(_0x17c17b){if(_0x17c17b['@odata.type']){var _0x4e37f2=_0x17c17b[_0x682d('0xba')]['substring'](_0x17c17b[_0x682d('0xba')]['lastIndexOf']('.')+0x1);if(_0x4e37f2==='PicklistAttributeMetadata'){_0x5b4bce['push'](getSelectList(_0x3b49bc,_0x28623b,_0x16bd50,_0x5bb029['MetadataId'],_0x17c17b[_0x682d('0xb5')],_0x1354b9));}}});return Promise['all'](_0x5b4bce);})['then'](function(_0x74dec7){_0x187645=_0x74dec7[0x0];var _0x3894fb=[];var _0x43f032=[];_0xae0edd[_0x682d('0xb9')](function(_0x416d6c){if(!_[_0x682d('0xbb')](_0x416d6c['@odata.type'])){var _0x528178=_0x416d6c[_0x682d('0xba')]['substring'](_0x416d6c[_0x682d('0xba')][_0x682d('0xab')]('.')+0x1);if(_0x528178==='BooleanAttributeMetadata'){_0x3894fb['push'](getBooleanList(_0x3b49bc,_0x28623b,_0x43f032,_0x5bb029[_0x682d('0xb5')],_0x416d6c[_0x682d('0xb5')],_0x1354b9));}}});return Promise[_0x682d('0xbc')](_0x3894fb);})[_0x682d('0x1d')](function(_0x122509){_0x2d952e=_0x122509[0x0];var _0x3384cc=[];var _0x4325a1=[];_0xae0edd['forEach'](function(_0x293007){if(_0x293007[_0x682d('0xba')]){var _0x27cf3a=_0x293007[_0x682d('0xba')][_0x682d('0xaa')](_0x293007['@odata.type']['lastIndexOf']('.')+0x1);if(_0x27cf3a==='StringAttributeMetadata'||_0x27cf3a===_0x682d('0xbd')||_0x27cf3a===_0x682d('0xbe')||_0x27cf3a===_0x682d('0xbf')||_0x27cf3a===_0x682d('0xc0')||_0x27cf3a===_0x682d('0xc1')||_0x27cf3a==='StatusAttributeMetadata'||_0x27cf3a===_0x682d('0xc2')||_0x27cf3a===_0x682d('0xc3')||_0x27cf3a===_0x682d('0xc4')){_0x3384cc[_0x682d('0xc5')](getInputList(_0x3b49bc,_0x28623b,_0x27cf3a,_0x4325a1,_0x5bb029['MetadataId'],_0x293007['MetadataId'],_0x1354b9));}}});return Promise[_0x682d('0xbc')](_0x3384cc);})['then'](function(_0x57e763){_0x4816a7=_0x57e763[0x0];var _0x17c519=_0x187645[_0x682d('0xa4')](_0x2d952e)[_0x682d('0xa4')](_0x4816a7);var _0x346e73={'count':_0x17c519['length'],'rows':_0x17c519};return _0x346e73;})['then'](respondWithResult(_0x3e421b,null))[_0x682d('0x27')](function(_0x3e58fe){var _0x45f87f=_0x571096[_0x682d('0x42')][_0x682d('0xc6')]?0x1f4:_0x3e58fe[_0x682d('0xc7')]||0x1f4;logger['error'](_0x3e58fe[_0x682d('0x33')]);delete _0x3e58fe[_0x682d('0x34')];if(_0x45f87f===0x191){_0x45f87f=0x190;}_0x3e421b[_0x682d('0x29')](_0x45f87f)[_0x682d('0x35')](_0x571096['query'][_0x682d('0xc6')]?{'message':_0x682d('0xc8'),'statusCode':_0x3e58fe[_0x682d('0xc7')]}:_0x3e58fe);});};function getSelectList(_0x7dd11c,_0x378a7a,_0x4b016e,_0x4b29be,_0x1aef9d,_0x4d47b4){var _0x2e48a5={'method':_0x682d('0xc9'),'uri':_0x7dd11c+_0x682d('0xb6')+_0x4b29be+_0x682d('0xca')+_0x1aef9d+_0x682d('0xcb')+_0x682d('0xcc'),'headers':{'Authorization':'Bearer\x20'+_0x4d47b4,'If-None-Match':null,'OData-Version':_0x682d('0xb3')},'json':!![]};return rp(_0x2e48a5)['then'](function(_0x13f494){var _0x43750b=[];var _0xe15036=_0x13f494[_0x682d('0xcd')]['Options'];_0xe15036[_0x682d('0xb9')](function(_0x3ea5f7){_0x43750b[_0x682d('0xc5')]({'name':_0x3ea5f7[_0x682d('0xce')][_0x682d('0xcf')][_0x682d('0xce')],'value':String(_0x3ea5f7['Value'])});});var _0x133e91={'id':_0x378a7a+'_'+_0x13f494[_0x682d('0xb8')],'name':_0x13f494['DisplayName'][_0x682d('0xcf')][_0x682d('0xce')],'custom':![],'options':_0x43750b};_0x4b016e[_0x682d('0xc5')](_0x133e91);return _0x4b016e;});}function getBooleanList(_0x512067,_0x249915,_0x160994,_0x1ad4c1,_0x34acfd,_0x3405aa){var _0x340f34={'method':_0x682d('0xc9'),'uri':_0x512067+'EntityDefinitions('+_0x1ad4c1+_0x682d('0xca')+_0x34acfd+_0x682d('0xd0'),'headers':{'Authorization':'Bearer\x20'+_0x3405aa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x340f34)[_0x682d('0x1d')](function(_0x50f6a1){var _0x5c0185=[];_0x5c0185[_0x682d('0xc5')]({'name':_0x50f6a1[_0x682d('0xcd')][_0x682d('0xd1')][_0x682d('0xce')][_0x682d('0xcf')][_0x682d('0xce')],'value':_0x682d('0xd2')},{'name':_0x50f6a1[_0x682d('0xcd')][_0x682d('0xd3')][_0x682d('0xce')]['UserLocalizedLabel']['Label'],'value':_0x682d('0xd4')});var _0x4e0181={'id':_0x249915+'_'+_0x50f6a1['LogicalName'],'name':_0x50f6a1[_0x682d('0xd5')][_0x682d('0xcf')][_0x682d('0xce')],'custom':![],'options':_0x5c0185};_0x160994[_0x682d('0xc5')](_0x4e0181);return _0x160994;});}function getInputList(_0x893d81,_0x50d22e,_0x21f2ae,_0x1dc3f3,_0x9319d1,_0x1a4fbd,_0x2a7ecf){var _0x33fb12={'method':'GET','uri':_0x893d81+_0x682d('0xb6')+_0x9319d1+_0x682d('0xca')+_0x1a4fbd+_0x682d('0xd6')+_0x21f2ae+_0x682d('0xd7'),'headers':{'Authorization':_0x682d('0xb2')+_0x2a7ecf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x33fb12)['then'](function(_0x210e1a){var _0x2f1595={'id':_0x50d22e+'_'+_0x210e1a[_0x682d('0xb8')],'name':_0x210e1a['DisplayName'][_0x682d('0xcf')]?_0x210e1a[_0x682d('0xd5')][_0x682d('0xcf')][_0x682d('0xce')]:_0x210e1a[_0x682d('0xb8')],'custom':![],'options':[]};_0x1dc3f3['push'](_0x2f1595);return _0x1dc3f3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 51f4f19..5308963 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30d1=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x1ba4a7,_0x5d02d9){var _0x5b231d=function(_0xfdfa7b){while(--_0xfdfa7b){_0x1ba4a7['push'](_0x1ba4a7['shift']());}};_0x5b231d(++_0x5d02d9);}(_0x30d1,0xa4));var _0x130d=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x30d1[_0x30cc1a];return _0xb3f18f;};'use strict';var _=require('lodash');var util=require(_0x130d('0x0'));var logger=require('../../config/logger')(_0x130d('0x1'));var moment=require(_0x130d('0x2'));var BPromise=require(_0x130d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x130d('0x4'));var config=require(_0x130d('0x5'));var attributes=require(_0x130d('0x6'));var integrations=require(_0x130d('0x7'));module[_0x130d('0x8')]=function(_0x3db444,_0x38d3e8){return _0x3db444['define'](_0x130d('0x9'),attributes,{'tableName':_0x130d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36d0=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_dynamics365_accounts','lodash','../../config/logger','api','moment'];(function(_0x51df0d,_0x3b8fd9){var _0x4291de=function(_0x45880d){while(--_0x45880d){_0x51df0d['push'](_0x51df0d['shift']());}};_0x4291de(++_0x3b8fd9);}(_0x36d0,0x1a0));var _0x036d=function(_0x5022ad,_0x27105f){_0x5022ad=_0x5022ad-0x0;var _0x44a8af=_0x36d0[_0x5022ad];return _0x44a8af;};'use strict';var _=require(_0x036d('0x0'));var util=require('util');var logger=require(_0x036d('0x1'))(_0x036d('0x2'));var moment=require(_0x036d('0x3'));var BPromise=require(_0x036d('0x4'));var rp=require(_0x036d('0x5'));var fs=require('fs');var path=require(_0x036d('0x6'));var rimraf=require(_0x036d('0x7'));var config=require(_0x036d('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x036d('0x9'));module[_0x036d('0xa')]=function(_0x17bc5e,_0xda9d72){return _0x17bc5e['define']('Dynamics365Account',attributes,{'tableName':_0x036d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 65f020e..64968f0 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d4b=['stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','limit','include','model','map','attributes','then','debug','ShowDynamics365Account','find','where','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x5e40e5,_0x167823){var _0x188e19=function(_0x45ccd6){while(--_0x45ccd6){_0x5e40e5['push'](_0x5e40e5['shift']());}};_0x188e19(++_0x167823);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x152314,_0x3891bb){_0x152314=_0x152314-0x0;var _0x49bac4=_0x3d4b[_0x152314];return _0x49bac4;};'use strict';var _=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var moment=require('moment');var BPromise=require(_0xb3d4('0x2'));var rs=require(_0xb3d4('0x3'));var fs=require('fs');var Redis=require(_0xb3d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3d4('0x5'));var logger=require(_0xb3d4('0x6'))(_0xb3d4('0x7'));var config=require(_0xb3d4('0x8'));var jayson=require(_0xb3d4('0x9'));var client=jayson[_0xb3d4('0xa')][_0xb3d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c49,_0x43bc45,_0x35e0b3){return new BPromise(function(_0xd1d4c4,_0x2eb3b3){return client['request'](_0x448c49,_0x35e0b3)['then'](function(_0x343c8d){logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,_0xb3d4('0xe'));logger['debug'](_0xb3d4('0xf'),_0x43bc45,_0xb3d4('0xe'),JSON[_0xb3d4('0x10')](_0x343c8d));if(_0x343c8d[_0xb3d4('0x11')]){if(_0x343c8d[_0xb3d4('0x11')][_0xb3d4('0x12')]===0x1f4){logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d[_0xb3d4('0x11')]['message']);return _0x2eb3b3(_0x343c8d['error'][_0xb3d4('0x13')]);}logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d['error'][_0xb3d4('0x13')]);return _0xd1d4c4(_0x343c8d[_0xb3d4('0x11')]['message']);}else{logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,'request\x20sent');_0xd1d4c4(_0x343c8d[_0xb3d4('0x14')]['message']);}})['catch'](function(_0x539d5){logger['error'](_0xb3d4('0xd'),_0x43bc45,_0x539d5);_0x2eb3b3(_0x539d5);});});}exports[_0xb3d4('0x15')]=function(_0x1676a5){var _0x270298=this;return new Promise(function(_0x233adc,_0x5688d4){return db[_0xb3d4('0x16')][_0xb3d4('0x17')]({'raw':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'where':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['where']||null:null,'attributes':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['attributes']||null:null,'limit':_0x1676a5['options']?_0x1676a5['options'][_0xb3d4('0x1a')]||null:null,'include':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x1b')]?_['map'](_0x1676a5['options'][_0xb3d4('0x1b')],function(_0x51c3a9){return{'model':db[_0x51c3a9[_0xb3d4('0x1c')]],'as':_0x51c3a9['as'],'attributes':_0x51c3a9['attributes'],'include':_0x51c3a9['include']?_[_0xb3d4('0x1d')](_0x51c3a9[_0xb3d4('0x1b')],function(_0x1fdbf6){return{'model':db[_0x1fdbf6['model']],'as':_0x1fdbf6['as'],'attributes':_0x1fdbf6[_0xb3d4('0x1e')],'include':_0x1fdbf6['include']?_['map'](_0x1fdbf6[_0xb3d4('0x1b')],function(_0x5482a4){return{'model':db[_0x5482a4[_0xb3d4('0x1c')]],'as':_0x5482a4['as'],'attributes':_0x5482a4[_0xb3d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3d4('0x1f')](function(_0x552da8){logger['info'](_0xb3d4('0x15'),_0x1676a5);logger[_0xb3d4('0x20')](_0xb3d4('0x15'),_0x1676a5,JSON['stringify'](_0x552da8));_0x233adc(_0x552da8);})['catch'](function(_0x4921c1){logger[_0xb3d4('0x11')](_0xb3d4('0x15'),_0x4921c1[_0xb3d4('0x13')],_0x1676a5);_0x5688d4(_0x270298['error'](0x1f4,_0x4921c1[_0xb3d4('0x13')]));});});};exports[_0xb3d4('0x21')]=function(_0x37cff4){var _0x5a3fe7=this;return new Promise(function(_0x447200,_0x98a5ff){return db['Dynamics365Account'][_0xb3d4('0x22')]({'raw':_0x37cff4['options']?_0x37cff4['options'][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'where':_0x37cff4[_0xb3d4('0x18')]?_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x23')]||null:null,'attributes':_0x37cff4[_0xb3d4('0x18')]?_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x1e')]||null:null,'include':_0x37cff4[_0xb3d4('0x18')]?_0x37cff4[_0xb3d4('0x18')]['include']?_[_0xb3d4('0x1d')](_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x1b')],function(_0x4e6473){return{'model':db[_0x4e6473[_0xb3d4('0x1c')]],'as':_0x4e6473['as'],'attributes':_0x4e6473['attributes'],'include':_0x4e6473['include']?_['map'](_0x4e6473[_0xb3d4('0x1b')],function(_0x359084){return{'model':db[_0x359084['model']],'as':_0x359084['as'],'attributes':_0x359084[_0xb3d4('0x1e')],'include':_0x359084['include']?_[_0xb3d4('0x1d')](_0x359084[_0xb3d4('0x1b')],function(_0x4d61cf){return{'model':db[_0x4d61cf[_0xb3d4('0x1c')]],'as':_0x4d61cf['as'],'attributes':_0x4d61cf[_0xb3d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3d4('0x1f')](function(_0x1e0941){logger['info'](_0xb3d4('0x21'),_0x37cff4);logger[_0xb3d4('0x20')](_0xb3d4('0x21'),_0x37cff4,JSON[_0xb3d4('0x10')](_0x1e0941));_0x447200(_0x1e0941);})[_0xb3d4('0x24')](function(_0x330517){logger[_0xb3d4('0x11')]('ShowDynamics365Account',_0x330517['message'],_0x37cff4);_0x98a5ff(_0x5a3fe7[_0xb3d4('0x11')](0x1f4,_0x330517['message']));});});}; \ No newline at end of file +var _0x41d0=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','info','debug','ShowDynamics365Account','lodash','util'];(function(_0x1c600f,_0x53d04f){var _0x40df8c=function(_0x37a4b9){while(--_0x37a4b9){_0x1c600f['push'](_0x1c600f['shift']());}};_0x40df8c(++_0x53d04f);}(_0x41d0,0x1c6));var _0x041d=function(_0x2627c5,_0x3a0394){_0x2627c5=_0x2627c5-0x0;var _0x4f11fd=_0x41d0[_0x2627c5];return _0x4f11fd;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var moment=require(_0x041d('0x2'));var BPromise=require(_0x041d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x041d('0x4'));var db=require(_0x041d('0x5'))['db'];var utils=require(_0x041d('0x6'));var logger=require(_0x041d('0x7'))(_0x041d('0x8'));var config=require(_0x041d('0x9'));var jayson=require(_0x041d('0xa'));var client=jayson[_0x041d('0xb')][_0x041d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f083c,_0x372840,_0x50dae8){return new BPromise(function(_0xae8b94,_0x584adf){return client[_0x041d('0xd')](_0x5f083c,_0x50dae8)[_0x041d('0xe')](function(_0x556017){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x372840,_0x041d('0xf'));logger['debug'](_0x041d('0x10'),_0x372840,'request\x20sent',JSON[_0x041d('0x11')](_0x556017));if(_0x556017[_0x041d('0x12')]){if(_0x556017[_0x041d('0x12')][_0x041d('0x13')]===0x1f4){logger[_0x041d('0x12')](_0x041d('0x14'),_0x372840,_0x556017[_0x041d('0x12')][_0x041d('0x15')]);return _0x584adf(_0x556017[_0x041d('0x12')]['message']);}logger[_0x041d('0x12')](_0x041d('0x14'),_0x372840,_0x556017[_0x041d('0x12')][_0x041d('0x15')]);return _0xae8b94(_0x556017[_0x041d('0x12')][_0x041d('0x15')]);}else{logger['info'](_0x041d('0x14'),_0x372840,_0x041d('0xf'));_0xae8b94(_0x556017[_0x041d('0x16')][_0x041d('0x15')]);}})[_0x041d('0x17')](function(_0x1c581b){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x372840,_0x1c581b);_0x584adf(_0x1c581b);});});}exports[_0x041d('0x18')]=function(_0x32a20e){var _0x4fb80b=this;return new Promise(function(_0x15b10b,_0x5b73ef){return db[_0x041d('0x19')][_0x041d('0x1a')]({'raw':_0x32a20e[_0x041d('0x1b')]?_0x32a20e['options'][_0x041d('0x1c')]===undefined?!![]:![]:!![],'where':_0x32a20e['options']?_0x32a20e['options'][_0x041d('0x1d')]||null:null,'attributes':_0x32a20e['options']?_0x32a20e[_0x041d('0x1b')][_0x041d('0x1e')]||null:null,'limit':_0x32a20e[_0x041d('0x1b')]?_0x32a20e[_0x041d('0x1b')][_0x041d('0x1f')]||null:null,'include':_0x32a20e[_0x041d('0x1b')]?_0x32a20e[_0x041d('0x1b')][_0x041d('0x20')]?_['map'](_0x32a20e[_0x041d('0x1b')][_0x041d('0x20')],function(_0x6058d7){return{'model':db[_0x6058d7[_0x041d('0x21')]],'as':_0x6058d7['as'],'attributes':_0x6058d7[_0x041d('0x1e')],'include':_0x6058d7['include']?_[_0x041d('0x22')](_0x6058d7[_0x041d('0x20')],function(_0x3e04e3){return{'model':db[_0x3e04e3[_0x041d('0x21')]],'as':_0x3e04e3['as'],'attributes':_0x3e04e3[_0x041d('0x1e')],'include':_0x3e04e3[_0x041d('0x20')]?_[_0x041d('0x22')](_0x3e04e3[_0x041d('0x20')],function(_0x1ca19c){return{'model':db[_0x1ca19c[_0x041d('0x21')]],'as':_0x1ca19c['as'],'attributes':_0x1ca19c[_0x041d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x041d('0xe')](function(_0x9d3655){logger[_0x041d('0x23')](_0x041d('0x18'),_0x32a20e);logger[_0x041d('0x24')](_0x041d('0x18'),_0x32a20e,JSON[_0x041d('0x11')](_0x9d3655));_0x15b10b(_0x9d3655);})[_0x041d('0x17')](function(_0x18b06b){logger[_0x041d('0x12')](_0x041d('0x18'),_0x18b06b[_0x041d('0x15')],_0x32a20e);_0x5b73ef(_0x4fb80b['error'](0x1f4,_0x18b06b[_0x041d('0x15')]));});});};exports[_0x041d('0x25')]=function(_0x4c06b0){var _0x39c4e3=this;return new Promise(function(_0x543d39,_0x4fb8e8){return db[_0x041d('0x19')]['find']({'raw':_0x4c06b0[_0x041d('0x1b')]?_0x4c06b0[_0x041d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4c06b0[_0x041d('0x1b')]?_0x4c06b0[_0x041d('0x1b')][_0x041d('0x1d')]||null:null,'attributes':_0x4c06b0[_0x041d('0x1b')]?_0x4c06b0['options'][_0x041d('0x1e')]||null:null,'include':_0x4c06b0[_0x041d('0x1b')]?_0x4c06b0[_0x041d('0x1b')][_0x041d('0x20')]?_[_0x041d('0x22')](_0x4c06b0['options'][_0x041d('0x20')],function(_0x53a8a0){return{'model':db[_0x53a8a0[_0x041d('0x21')]],'as':_0x53a8a0['as'],'attributes':_0x53a8a0[_0x041d('0x1e')],'include':_0x53a8a0['include']?_['map'](_0x53a8a0[_0x041d('0x20')],function(_0x14ea07){return{'model':db[_0x14ea07[_0x041d('0x21')]],'as':_0x14ea07['as'],'attributes':_0x14ea07['attributes'],'include':_0x14ea07[_0x041d('0x20')]?_[_0x041d('0x22')](_0x14ea07[_0x041d('0x20')],function(_0x26167d){return{'model':db[_0x26167d['model']],'as':_0x26167d['as'],'attributes':_0x26167d[_0x041d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x314e13){logger[_0x041d('0x23')]('ShowDynamics365Account',_0x4c06b0);logger[_0x041d('0x24')]('ShowDynamics365Account',_0x4c06b0,JSON[_0x041d('0x11')](_0x314e13));_0x543d39(_0x314e13);})[_0x041d('0x17')](function(_0x4bf62e){logger[_0x041d('0x12')](_0x041d('0x25'),_0x4bf62e['message'],_0x4c06b0);_0x4fb8e8(_0x39c4e3[_0x041d('0x12')](0x1f4,_0x4bf62e[_0x041d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6940357..4245623 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeba1=['get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x56e4f7,_0x860f5){var _0x1f15e6=function(_0x103a45){while(--_0x103a45){_0x56e4f7['push'](_0x56e4f7['shift']());}};_0x1f15e6(++_0x860f5);}(_0xeba1,0x12f));var _0x1eba=function(_0x175f6f,_0x1a4a05){_0x175f6f=_0x175f6f-0x0;var _0x1aa501=_0xeba1[_0x175f6f];return _0x1aa501;};'use strict';var multer=require(_0x1eba('0x0'));var util=require(_0x1eba('0x1'));var path=require(_0x1eba('0x2'));var timeout=require('connect-timeout');var express=require(_0x1eba('0x3'));var router=express[_0x1eba('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1eba('0x5'));var interaction=require(_0x1eba('0x6'));var config=require(_0x1eba('0x7'));var controller=require(_0x1eba('0x8'));router[_0x1eba('0x9')]('/',auth[_0x1eba('0xa')](),controller['index']);router[_0x1eba('0x9')]('/:id',auth[_0x1eba('0xa')](),controller[_0x1eba('0xb')]);router[_0x1eba('0x9')](_0x1eba('0xc'),auth['isAuthenticated'](),controller[_0x1eba('0xd')]);router[_0x1eba('0x9')](_0x1eba('0xe'),auth[_0x1eba('0xa')](),controller[_0x1eba('0xf')]);router['get'](_0x1eba('0x10'),auth['isAuthenticated'](),controller[_0x1eba('0x11')]);router[_0x1eba('0x12')]('/',auth[_0x1eba('0xa')](),controller[_0x1eba('0x13')]);router[_0x1eba('0x14')](_0x1eba('0x15'),auth[_0x1eba('0xa')](),controller[_0x1eba('0x16')]);router[_0x1eba('0x17')](_0x1eba('0x15'),auth[_0x1eba('0xa')](),controller[_0x1eba('0x18')]);module[_0x1eba('0x19')]=router; \ No newline at end of file +var _0xc6a5=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x38489c,_0x5c4f93){var _0x1452b2=function(_0x5e673b){while(--_0x5e673b){_0x38489c['push'](_0x38489c['shift']());}};_0x1452b2(++_0x5c4f93);}(_0xc6a5,0x7d));var _0x5c6a=function(_0x1561cc,_0x4ece5a){_0x1561cc=_0x1561cc-0x0;var _0xda1f16=_0xc6a5[_0x1561cc];return _0xda1f16;};'use strict';var multer=require(_0x5c6a('0x0'));var util=require(_0x5c6a('0x1'));var path=require('path');var timeout=require(_0x5c6a('0x2'));var express=require(_0x5c6a('0x3'));var router=express[_0x5c6a('0x4')]();var fs_extra=require(_0x5c6a('0x5'));var auth=require(_0x5c6a('0x6'));var interaction=require(_0x5c6a('0x7'));var config=require(_0x5c6a('0x8'));var controller=require(_0x5c6a('0x9'));router[_0x5c6a('0xa')]('/',auth[_0x5c6a('0xb')](),controller[_0x5c6a('0xc')]);router[_0x5c6a('0xa')](_0x5c6a('0xd'),auth[_0x5c6a('0xb')](),controller[_0x5c6a('0xe')]);router[_0x5c6a('0xa')]('/:id/fields',auth[_0x5c6a('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x5c6a('0xf')]);router[_0x5c6a('0xa')](_0x5c6a('0x10'),auth[_0x5c6a('0xb')](),controller[_0x5c6a('0x11')]);router[_0x5c6a('0x12')]('/',auth['isAuthenticated'](),controller[_0x5c6a('0x13')]);router[_0x5c6a('0x14')](_0x5c6a('0xd'),auth['isAuthenticated'](),controller[_0x5c6a('0x15')]);router[_0x5c6a('0x16')](_0x5c6a('0xd'),auth['isAuthenticated'](),controller[_0x5c6a('0x17')]);module[_0x5c6a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 177b2bb..61f1d20 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x50cf=['sequelize','exports','STRING','ENUM','phonecall','incident'];(function(_0x3d817d,_0x2d9dde){var _0xbad350=function(_0x413635){while(--_0x413635){_0x3d817d['push'](_0x3d817d['shift']());}};_0xbad350(++_0x2d9dde);}(_0x50cf,0xd2));var _0xf50c=function(_0x5da723,_0x26a51b){_0x5da723=_0x5da723-0x0;var _0x433626=_0x50cf[_0x5da723];return _0x433626;};'use strict';var Sequelize=require(_0xf50c('0x0'));module[_0xf50c('0x1')]={'name':{'type':Sequelize[_0xf50c('0x2')]},'description':{'type':Sequelize[_0xf50c('0x2')]},'ticketType':{'type':Sequelize[_0xf50c('0x3')]('incident',_0xf50c('0x4')),'defaultValue':_0xf50c('0x5')}}; \ No newline at end of file +var _0x6701=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x34f3d8,_0x353c95){var _0x52dc16=function(_0x45cc68){while(--_0x45cc68){_0x34f3d8['push'](_0x34f3d8['shift']());}};_0x52dc16(++_0x353c95);}(_0x6701,0x195));var _0x1670=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x6701[_0x5db99b];return _0x4b2d0e;};'use strict';var Sequelize=require(_0x1670('0x0'));module[_0x1670('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1670('0x2')]},'ticketType':{'type':Sequelize[_0x1670('0x3')](_0x1670('0x4'),_0x1670('0x5')),'defaultValue':_0x1670('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 67390b2..25fb432 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','sendStatus','name','send','render','merge','contact','interaction','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','Dynamics365Field','length','getSubjects','nolimit','getDescriptions','rimraf','zip-dir'];(function(_0x12bb35,_0x12ba36){var _0x48bbfe=function(_0x1c0a7a){while(--_0x1c0a7a){_0x12bb35['push'](_0x12bb35['shift']());}};_0x48bbfe(++_0x12ba36);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x0baf('0x1b'));var client=jayson[_0x0baf('0x1c')][_0x0baf('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x13df17,_0x5a0583,_0x2ab33e,_0x49e44b){return new BPromise(function(_0x1c76a8,_0x1f50c3){var _0x7fbf67=_0x49e44b||client;return _0x7fbf67[_0x0baf('0x1e')](_0x13df17,_0x2ab33e)[_0x0baf('0x1f')](function(_0x469599){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5a0583,_0x0baf('0x20'));logger[_0x0baf('0x21')](_0x0baf('0x22'),_0x5a0583,_0x0baf('0x20'),JSON[_0x0baf('0x23')](_0x469599));if(_0x469599[_0x0baf('0x24')]){if(_0x469599['error'][_0x0baf('0x25')]===0x1f4){logger[_0x0baf('0x24')](_0x0baf('0x26'),_0x5a0583,_0x469599[_0x0baf('0x24')][_0x0baf('0x27')]);return _0x1f50c3(_0x469599[_0x0baf('0x24')]['message']);}logger['error'](_0x0baf('0x26'),_0x5a0583,_0x469599[_0x0baf('0x24')][_0x0baf('0x27')]);return _0x1c76a8(_0x469599[_0x0baf('0x24')][_0x0baf('0x27')]);}else{logger[_0x0baf('0x28')](_0x0baf('0x26'),_0x5a0583,_0x0baf('0x20'));_0x1c76a8(_0x469599[_0x0baf('0x29')][_0x0baf('0x27')]);}})['catch'](function(_0x334bd6){logger['error'](_0x0baf('0x26'),_0x5a0583,_0x334bd6);_0x1f50c3(_0x334bd6);});});}function respondWithStatusCode(_0x5dbf00,_0x4de74c){_0x4de74c=_0x4de74c||0xcc;return function(_0x2ef0aa){if(_0x2ef0aa){return _0x5dbf00['sendStatus'](_0x4de74c);}return _0x5dbf00['status'](_0x4de74c)[_0x0baf('0x2a')]();};}function respondWithResult(_0x27b59c,_0x34e264){_0x34e264=_0x34e264||0xc8;return function(_0x19d9fd){if(_0x19d9fd){return _0x27b59c[_0x0baf('0x2b')](_0x34e264)['json'](_0x19d9fd);}};}function respondWithFilteredResult(_0x448617,_0x4681c5){return function(_0x1ca35a){if(_0x1ca35a){var _0x366e71=typeof _0x4681c5[_0x0baf('0x2c')]===_0x0baf('0x2d')&&typeof _0x4681c5[_0x0baf('0x2e')]==='undefined';var _0x1590b4=_0x1ca35a[_0x0baf('0x2f')];var _0xcaf13d=_0x366e71?0x0:_0x4681c5[_0x0baf('0x2c')];var _0x55c715=_0x366e71?_0x1ca35a[_0x0baf('0x2f')]:_0x4681c5[_0x0baf('0x2c')]+_0x4681c5['limit'];var _0x44ec31;if(_0x55c715>=_0x1590b4){_0x55c715=_0x1590b4;_0x44ec31=0xc8;}else{_0x44ec31=0xce;}_0x448617[_0x0baf('0x2b')](_0x44ec31);return _0x448617[_0x0baf('0x30')](_0x0baf('0x31'),_0xcaf13d+'-'+_0x55c715+'/'+_0x1590b4)[_0x0baf('0x32')](_0x1ca35a);}return null;};}function patchUpdates(_0x366924){return function(_0x213a6a){try{jsonpatch['apply'](_0x213a6a,_0x366924,!![]);}catch(_0xe92c2c){return BPromise[_0x0baf('0x33')](_0xe92c2c);}return _0x213a6a[_0x0baf('0x34')]();};}function saveUpdates(_0x3ed995,_0x24ecee){return function(_0x275ea1){if(_0x275ea1){return _0x275ea1[_0x0baf('0x35')](_0x3ed995)[_0x0baf('0x1f')](function(_0x59431b){return _0x59431b;});}return null;};}function removeEntity(_0x3ded64,_0x2adfd7){return function(_0x165d14){if(_0x165d14){return _0x165d14[_0x0baf('0x36')]()[_0x0baf('0x1f')](function(){_0x3ded64['status'](0xcc)[_0x0baf('0x2a')]();});}};}function handleEntityNotFound(_0x53ae1d,_0x1aa474){return function(_0x2b205b){if(!_0x2b205b){_0x53ae1d[_0x0baf('0x37')](0x194);}return _0x2b205b;};}function handleError(_0x3d65f2,_0x5300a5){_0x5300a5=_0x5300a5||0x1f4;return function(_0x1a2b03){logger[_0x0baf('0x24')](_0x1a2b03['stack']);if(_0x1a2b03[_0x0baf('0x38')]){delete _0x1a2b03[_0x0baf('0x38')];}_0x3d65f2[_0x0baf('0x2b')](_0x5300a5)[_0x0baf('0x39')](_0x1a2b03);};}function getMustacheRender(_0x1f60bd,_0x1b0991){return Mustache[_0x0baf('0x3a')](_0x1f60bd,_[_0x0baf('0x3b')](_0x1b0991['body'],{'contact':_0x1b0991[_0x0baf('0x3c')],'message':_0x1b0991[_0x0baf('0x27')],'agent':_0x1b0991['agent'],'interaction':_0x1b0991[_0x0baf('0x3d')],'account':_0x1b0991['account']}))||'';}exports['index']=function(_0x11bc49,_0x81af83){var _0x5d3ad1={},_0x49e792={},_0x628603={'count':0x0,'rows':[]};var _0x2243f1=_[_0x0baf('0x3e')](db[_0x0baf('0x3f')][_0x0baf('0x40')],function(_0x2028ad){return{'name':_0x2028ad[_0x0baf('0x41')],'type':_0x2028ad[_0x0baf('0x42')][_0x0baf('0x43')]};});_0x49e792[_0x0baf('0x44')]=_[_0x0baf('0x3e')](_0x2243f1,_0x0baf('0x38'));_0x49e792[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x11bc49['query']);_0x49e792[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0x49e792['model'],_0x49e792[_0x0baf('0x45')]);_0x5d3ad1[_0x0baf('0x49')]=_[_0x0baf('0x48')](_0x49e792[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x11bc49[_0x0baf('0x45')]['fields']));_0x5d3ad1[_0x0baf('0x49')]=_0x5d3ad1[_0x0baf('0x49')]['length']?_0x5d3ad1[_0x0baf('0x49')]:_0x49e792[_0x0baf('0x44')];if(!_0x11bc49[_0x0baf('0x45')][_0x0baf('0x4b')]('nolimit')){_0x5d3ad1[_0x0baf('0x2e')]=qs[_0x0baf('0x2e')](_0x11bc49[_0x0baf('0x45')][_0x0baf('0x2e')]);_0x5d3ad1[_0x0baf('0x2c')]=qs[_0x0baf('0x2c')](_0x11bc49[_0x0baf('0x45')][_0x0baf('0x2c')]);}_0x5d3ad1[_0x0baf('0x4c')]=qs[_0x0baf('0x4d')](_0x11bc49['query'][_0x0baf('0x4d')]);_0x5d3ad1[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x11bc49[_0x0baf('0x45')],_0x49e792['filters']),_0x2243f1);if(_0x11bc49[_0x0baf('0x45')][_0x0baf('0x50')]){_0x5d3ad1[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x5d3ad1[_0x0baf('0x4e')],{'$or':_['map'](_0x2243f1,function(_0x2a0924){if(_0x2a0924[_0x0baf('0x42')]!==_0x0baf('0x51')){var _0x1522b0={};_0x1522b0[_0x2a0924[_0x0baf('0x38')]]={'$like':'%'+_0x11bc49[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x1522b0;}})});}_0x5d3ad1=_['merge']({},_0x5d3ad1,_0x11bc49[_0x0baf('0x52')]);var _0x167fb8={'where':_0x5d3ad1[_0x0baf('0x4e')]};return db['Dynamics365Configuration'][_0x0baf('0x2f')](_0x167fb8)[_0x0baf('0x1f')](function(_0x10fa62){_0x628603[_0x0baf('0x2f')]=_0x10fa62;if(_0x11bc49[_0x0baf('0x45')][_0x0baf('0x53')]){_0x5d3ad1[_0x0baf('0x54')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x0baf('0x55')](_0x5d3ad1);})[_0x0baf('0x1f')](function(_0x214a1d){_0x628603[_0x0baf('0x56')]=_0x214a1d;return _0x628603;})[_0x0baf('0x1f')](respondWithFilteredResult(_0x81af83,_0x5d3ad1))[_0x0baf('0x57')](handleError(_0x81af83,null));};exports[_0x0baf('0x58')]=function(_0x1af4aa,_0x2be7fe){var _0x19c008={'raw':![],'where':{'id':_0x1af4aa['params']['id']}},_0x2c6cdf={};_0x2c6cdf['model']=_[_0x0baf('0x46')](db[_0x0baf('0x3f')][_0x0baf('0x40')]);_0x2c6cdf[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x1af4aa[_0x0baf('0x45')]);_0x2c6cdf[_0x0baf('0x47')]=_['intersection'](_0x2c6cdf[_0x0baf('0x44')],_0x2c6cdf[_0x0baf('0x45')]);_0x19c008[_0x0baf('0x49')]=_[_0x0baf('0x48')](_0x2c6cdf[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x1af4aa['query'][_0x0baf('0x4a')]));_0x19c008['attributes']=_0x19c008[_0x0baf('0x49')]['length']?_0x19c008[_0x0baf('0x49')]:_0x2c6cdf['model'];if(_0x1af4aa[_0x0baf('0x45')]['includeAll']){_0x19c008[_0x0baf('0x54')]=[{'all':!![]}];}_0x19c008=_[_0x0baf('0x3b')]({},_0x19c008,_0x1af4aa[_0x0baf('0x52')]);return db[_0x0baf('0x3f')][_0x0baf('0x59')](_0x19c008)['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x1f')](respondWithResult(_0x2be7fe,null))[_0x0baf('0x57')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x5a')]=function(_0xb45360,_0x5fbabf){return db[_0x0baf('0x3f')]['create'](_0xb45360[_0x0baf('0x5b')],{})[_0x0baf('0x1f')](respondWithResult(_0x5fbabf,0xc9))[_0x0baf('0x57')](handleError(_0x5fbabf,null));};exports[_0x0baf('0x35')]=function(_0xbc7cc2,_0x1a7ffb){if(_0xbc7cc2[_0x0baf('0x5b')]['id']){delete _0xbc7cc2['body']['id'];}return db['Dynamics365Configuration'][_0x0baf('0x59')]({'where':{'id':_0xbc7cc2[_0x0baf('0x5c')]['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x1a7ffb,null))[_0x0baf('0x1f')](saveUpdates(_0xbc7cc2[_0x0baf('0x5b')],null))[_0x0baf('0x1f')](respondWithResult(_0x1a7ffb,null))[_0x0baf('0x57')](handleError(_0x1a7ffb,null));};exports[_0x0baf('0x36')]=function(_0x3d9a32,_0x585969){return db[_0x0baf('0x3f')][_0x0baf('0x59')]({'where':{'id':_0x3d9a32[_0x0baf('0x5c')]['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x585969,null))[_0x0baf('0x1f')](removeEntity(_0x585969,null))[_0x0baf('0x57')](handleError(_0x585969,null));};exports[_0x0baf('0x5d')]=function(_0x51d75f,_0x17189d,_0x27f580){var _0x437980={};var _0x37f313={};var _0x1c7d88;var _0x1a6d22;return db[_0x0baf('0x3f')][_0x0baf('0x5e')]({'where':{'id':_0x51d75f['params']['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x17189d,null))['then'](function(_0x3c00e7){if(_0x3c00e7){_0x1c7d88=_0x3c00e7;_0x37f313['model']=_['keys'](db[_0x0baf('0x5f')]['rawAttributes']);_0x37f313[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x51d75f['query']);_0x37f313[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0x37f313[_0x0baf('0x44')],_0x37f313['query']);_0x437980['attributes']=_[_0x0baf('0x48')](_0x37f313[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x51d75f[_0x0baf('0x45')][_0x0baf('0x4a')]));_0x437980['attributes']=_0x437980[_0x0baf('0x49')]['length']?_0x437980['attributes']:_0x37f313['model'];_0x437980[_0x0baf('0x4c')]=qs['sort'](_0x51d75f['query'][_0x0baf('0x4d')]);_0x437980[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x51d75f[_0x0baf('0x45')],_0x37f313[_0x0baf('0x47')]));if(_0x51d75f['query'][_0x0baf('0x50')]){_0x437980[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x437980[_0x0baf('0x4e')],{'$or':_[_0x0baf('0x3e')](_0x437980[_0x0baf('0x49')],function(_0x5cf3d3){var _0x42e8ad={};_0x42e8ad[_0x5cf3d3]={'$like':'%'+_0x51d75f[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x42e8ad;})});}_0x437980=_['merge']({},_0x437980,_0x51d75f[_0x0baf('0x52')]);return _0x1c7d88[_0x0baf('0x5d')](_0x437980);}})[_0x0baf('0x1f')](function(_0x2c20fe){if(_0x2c20fe){_0x1a6d22=_0x2c20fe[_0x0baf('0x60')];if(!_0x51d75f[_0x0baf('0x45')][_0x0baf('0x4b')]('nolimit')){_0x437980['limit']=qs['limit'](_0x51d75f[_0x0baf('0x45')][_0x0baf('0x2e')]);_0x437980[_0x0baf('0x2c')]=qs[_0x0baf('0x2c')](_0x51d75f[_0x0baf('0x45')][_0x0baf('0x2c')]);}return _0x1c7d88['getFields'](_0x437980);}})['then'](function(_0x34c1f4){if(_0x34c1f4){return _0x34c1f4?{'count':_0x1a6d22,'rows':_0x34c1f4}:null;}})['then'](respondWithResult(_0x17189d,null))[_0x0baf('0x57')](handleError(_0x17189d,null));};exports[_0x0baf('0x61')]=function(_0x4cca39,_0xf45ec3,_0x44dfe2){var _0x147f98={};var _0xb1d719={};var _0x115ff5;var _0x33a5af;return db[_0x0baf('0x3f')][_0x0baf('0x5e')]({'where':{'id':_0x4cca39[_0x0baf('0x5c')]['id']}})['then'](handleEntityNotFound(_0xf45ec3,null))['then'](function(_0x58a079){if(_0x58a079){_0x115ff5=_0x58a079;_0xb1d719['model']=_['keys'](db[_0x0baf('0x5f')][_0x0baf('0x40')]);_0xb1d719[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x4cca39['query']);_0xb1d719[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0xb1d719['model'],_0xb1d719['query']);_0x147f98[_0x0baf('0x49')]=_[_0x0baf('0x48')](_0xb1d719[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x4cca39[_0x0baf('0x45')][_0x0baf('0x4a')]));_0x147f98[_0x0baf('0x49')]=_0x147f98[_0x0baf('0x49')]['length']?_0x147f98[_0x0baf('0x49')]:_0xb1d719[_0x0baf('0x44')];_0x147f98['order']=qs[_0x0baf('0x4d')](_0x4cca39[_0x0baf('0x45')]['sort']);_0x147f98[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x4cca39[_0x0baf('0x45')],_0xb1d719[_0x0baf('0x47')]));if(_0x4cca39['query']['filter']){_0x147f98[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x147f98['where'],{'$or':_[_0x0baf('0x3e')](_0x147f98[_0x0baf('0x49')],function(_0x21ad25){var _0x574833={};_0x574833[_0x21ad25]={'$like':'%'+_0x4cca39[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x574833;})});}_0x147f98=_[_0x0baf('0x3b')]({},_0x147f98,_0x4cca39['options']);return _0x115ff5[_0x0baf('0x61')](_0x147f98);}})['then'](function(_0x316397){if(_0x316397){_0x33a5af=_0x316397[_0x0baf('0x60')];if(!_0x4cca39[_0x0baf('0x45')][_0x0baf('0x4b')](_0x0baf('0x62'))){_0x147f98['limit']=qs[_0x0baf('0x2e')](_0x4cca39[_0x0baf('0x45')]['limit']);_0x147f98[_0x0baf('0x2c')]=qs[_0x0baf('0x2c')](_0x4cca39[_0x0baf('0x45')][_0x0baf('0x2c')]);}return _0x115ff5[_0x0baf('0x61')](_0x147f98);}})[_0x0baf('0x1f')](function(_0xa4fd1b){if(_0xa4fd1b){return _0xa4fd1b?{'count':_0x33a5af,'rows':_0xa4fd1b}:null;}})[_0x0baf('0x1f')](respondWithResult(_0xf45ec3,null))[_0x0baf('0x57')](handleError(_0xf45ec3,null));};exports[_0x0baf('0x63')]=function(_0x3b7abf,_0x2c2f09,_0x5985f9){var _0x599ac0={};var _0x29a036={};var _0x322a09;var _0x384c29;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3b7abf[_0x0baf('0x5c')]['id']}})[_0x0baf('0x1f')](handleEntityNotFound(_0x2c2f09,null))[_0x0baf('0x1f')](function(_0x371b78){if(_0x371b78){_0x322a09=_0x371b78;_0x29a036[_0x0baf('0x44')]=_[_0x0baf('0x46')](db[_0x0baf('0x5f')][_0x0baf('0x40')]);_0x29a036[_0x0baf('0x45')]=_['keys'](_0x3b7abf[_0x0baf('0x45')]);_0x29a036[_0x0baf('0x47')]=_[_0x0baf('0x48')](_0x29a036[_0x0baf('0x44')],_0x29a036['query']);_0x599ac0['attributes']=_['intersection'](_0x29a036[_0x0baf('0x44')],qs[_0x0baf('0x4a')](_0x3b7abf['query']['fields']));_0x599ac0[_0x0baf('0x49')]=_0x599ac0[_0x0baf('0x49')]['length']?_0x599ac0[_0x0baf('0x49')]:_0x29a036[_0x0baf('0x44')];_0x599ac0[_0x0baf('0x4c')]=qs[_0x0baf('0x4d')](_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x4d')]);_0x599ac0[_0x0baf('0x4e')]=qs[_0x0baf('0x47')](_[_0x0baf('0x4f')](_0x3b7abf[_0x0baf('0x45')],_0x29a036[_0x0baf('0x47')]));if(_0x3b7abf[_0x0baf('0x45')]['filter']){_0x599ac0[_0x0baf('0x4e')]=_[_0x0baf('0x3b')](_0x599ac0[_0x0baf('0x4e')],{'$or':_[_0x0baf('0x3e')](_0x599ac0[_0x0baf('0x49')],function(_0x195303){var _0x49d411={};_0x49d411[_0x195303]={'$like':'%'+_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x50')]+'%'};return _0x49d411;})});}_0x599ac0=_[_0x0baf('0x3b')]({},_0x599ac0,_0x3b7abf[_0x0baf('0x52')]);return _0x322a09[_0x0baf('0x63')](_0x599ac0);}})['then'](function(_0x3761b5){if(_0x3761b5){_0x384c29=_0x3761b5[_0x0baf('0x60')];if(!_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x4b')](_0x0baf('0x62'))){_0x599ac0['limit']=qs['limit'](_0x3b7abf[_0x0baf('0x45')]['limit']);_0x599ac0[_0x0baf('0x2c')]=qs['offset'](_0x3b7abf[_0x0baf('0x45')][_0x0baf('0x2c')]);}return _0x322a09[_0x0baf('0x63')](_0x599ac0);}})[_0x0baf('0x1f')](function(_0x4f4385){if(_0x4f4385){return _0x4f4385?{'count':_0x384c29,'rows':_0x4f4385}:null;}})[_0x0baf('0x1f')](respondWithResult(_0x2c2f09,null))[_0x0baf('0x57')](handleError(_0x2c2f09,null));}; \ No newline at end of file +var _0x2032=['limit','undefined','count','Content-Range','reject','stack','name','merge','body','contact','interaction','index','map','Dynamics365Configuration','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','findAll','rows','params','rawAttributes','length','include','find','destroy','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset'];(function(_0x2fbb8c,_0x15bc93){var _0x1005b4=function(_0x1a3f97){while(--_0x1a3f97){_0x2fbb8c['push'](_0x2fbb8c['shift']());}};_0x1005b4(++_0x15bc93);}(_0x2032,0xd9));var _0x2203=function(_0x520c06,_0x563743){_0x520c06=_0x520c06-0x0;var _0x7dd20a=_0x2032[_0x520c06];return _0x7dd20a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f56ff,_0x4bad7c,_0x238772,_0x538b30){return new BPromise(function(_0x592e47,_0x21a3af){var _0x472265=_0x538b30||client;return _0x472265[_0x2203('0x18')](_0x5f56ff,_0x238772)[_0x2203('0x19')](function(_0x226209){logger[_0x2203('0x1a')](_0x2203('0x1b'),_0x4bad7c,_0x2203('0x1c'));logger[_0x2203('0x1d')](_0x2203('0x1e'),_0x4bad7c,'request\x20sent',JSON[_0x2203('0x1f')](_0x226209));if(_0x226209[_0x2203('0x20')]){if(_0x226209['error'][_0x2203('0x21')]===0x1f4){logger[_0x2203('0x20')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4bad7c,_0x226209[_0x2203('0x20')]['message']);return _0x21a3af(_0x226209[_0x2203('0x20')][_0x2203('0x22')]);}logger[_0x2203('0x20')](_0x2203('0x1b'),_0x4bad7c,_0x226209[_0x2203('0x20')][_0x2203('0x22')]);return _0x592e47(_0x226209['error'][_0x2203('0x22')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4bad7c,_0x2203('0x1c'));_0x592e47(_0x226209['result'][_0x2203('0x22')]);}})[_0x2203('0x23')](function(_0x5d4c4e){logger[_0x2203('0x20')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4bad7c,_0x5d4c4e);_0x21a3af(_0x5d4c4e);});});}function respondWithStatusCode(_0x5c8da9,_0x226374){_0x226374=_0x226374||0xcc;return function(_0x2718f5){if(_0x2718f5){return _0x5c8da9[_0x2203('0x24')](_0x226374);}return _0x5c8da9[_0x2203('0x25')](_0x226374)[_0x2203('0x26')]();};}function respondWithResult(_0x3114ef,_0x49c12){_0x49c12=_0x49c12||0xc8;return function(_0x250349){if(_0x250349){return _0x3114ef['status'](_0x49c12)[_0x2203('0x27')](_0x250349);}};}function respondWithFilteredResult(_0x36b958,_0x39a11a){return function(_0x5f11bf){if(_0x5f11bf){var _0xb2071b=typeof _0x39a11a[_0x2203('0x28')]==='undefined'&&typeof _0x39a11a[_0x2203('0x29')]===_0x2203('0x2a');var _0x1c6a77=_0x5f11bf[_0x2203('0x2b')];var _0x28ae02=_0xb2071b?0x0:_0x39a11a[_0x2203('0x28')];var _0x9c53f=_0xb2071b?_0x5f11bf['count']:_0x39a11a[_0x2203('0x28')]+_0x39a11a[_0x2203('0x29')];var _0x406ce9;if(_0x9c53f>=_0x1c6a77){_0x9c53f=_0x1c6a77;_0x406ce9=0xc8;}else{_0x406ce9=0xce;}_0x36b958[_0x2203('0x25')](_0x406ce9);return _0x36b958['set'](_0x2203('0x2c'),_0x28ae02+'-'+_0x9c53f+'/'+_0x1c6a77)[_0x2203('0x27')](_0x5f11bf);}return null;};}function patchUpdates(_0x287c95){return function(_0xf59954){try{jsonpatch['apply'](_0xf59954,_0x287c95,!![]);}catch(_0xea1637){return BPromise[_0x2203('0x2d')](_0xea1637);}return _0xf59954['save']();};}function saveUpdates(_0x5c0157,_0x1d5f74){return function(_0x52fafc){if(_0x52fafc){return _0x52fafc['update'](_0x5c0157)[_0x2203('0x19')](function(_0x464c88){return _0x464c88;});}return null;};}function removeEntity(_0x191894,_0x1e0aa9){return function(_0xf2801d){if(_0xf2801d){return _0xf2801d['destroy']()[_0x2203('0x19')](function(){_0x191894[_0x2203('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2ee7,_0x20fbe1){return function(_0x9a335d){if(!_0x9a335d){_0x2a2ee7[_0x2203('0x24')](0x194);}return _0x9a335d;};}function handleError(_0x43fee1,_0x24d138){_0x24d138=_0x24d138||0x1f4;return function(_0x29da55){logger[_0x2203('0x20')](_0x29da55[_0x2203('0x2e')]);if(_0x29da55['name']){delete _0x29da55[_0x2203('0x2f')];}_0x43fee1[_0x2203('0x25')](_0x24d138)['send'](_0x29da55);};}function getMustacheRender(_0x54b90b,_0x2c58b1){return Mustache['render'](_0x54b90b,_[_0x2203('0x30')](_0x2c58b1[_0x2203('0x31')],{'contact':_0x2c58b1[_0x2203('0x32')],'message':_0x2c58b1['message'],'agent':_0x2c58b1['agent'],'interaction':_0x2c58b1[_0x2203('0x33')],'account':_0x2c58b1['account']}))||'';}exports[_0x2203('0x34')]=function(_0x5cfe5e,_0x11451e){var _0x4b6fc5={},_0x86097c={},_0x13ed9e={'count':0x0,'rows':[]};var _0x4311d1=_[_0x2203('0x35')](db[_0x2203('0x36')]['rawAttributes'],function(_0x5f1561){return{'name':_0x5f1561['fieldName'],'type':_0x5f1561[_0x2203('0x37')][_0x2203('0x38')]};});_0x86097c[_0x2203('0x39')]=_[_0x2203('0x35')](_0x4311d1,_0x2203('0x2f'));_0x86097c[_0x2203('0x3a')]=_[_0x2203('0x3b')](_0x5cfe5e['query']);_0x86097c[_0x2203('0x3c')]=_[_0x2203('0x3d')](_0x86097c[_0x2203('0x39')],_0x86097c[_0x2203('0x3a')]);_0x4b6fc5['attributes']=_['intersection'](_0x86097c[_0x2203('0x39')],qs['fields'](_0x5cfe5e[_0x2203('0x3a')][_0x2203('0x3e')]));_0x4b6fc5[_0x2203('0x3f')]=_0x4b6fc5['attributes']['length']?_0x4b6fc5[_0x2203('0x3f')]:_0x86097c[_0x2203('0x39')];if(!_0x5cfe5e[_0x2203('0x3a')][_0x2203('0x40')](_0x2203('0x41'))){_0x4b6fc5[_0x2203('0x29')]=qs['limit'](_0x5cfe5e[_0x2203('0x3a')][_0x2203('0x29')]);_0x4b6fc5[_0x2203('0x28')]=qs[_0x2203('0x28')](_0x5cfe5e[_0x2203('0x3a')][_0x2203('0x28')]);}_0x4b6fc5[_0x2203('0x42')]=qs[_0x2203('0x43')](_0x5cfe5e[_0x2203('0x3a')][_0x2203('0x43')]);_0x4b6fc5['where']=qs[_0x2203('0x3c')](_[_0x2203('0x44')](_0x5cfe5e[_0x2203('0x3a')],_0x86097c[_0x2203('0x3c')]),_0x4311d1);if(_0x5cfe5e['query']['filter']){_0x4b6fc5[_0x2203('0x45')]=_['merge'](_0x4b6fc5[_0x2203('0x45')],{'$or':_[_0x2203('0x35')](_0x4311d1,function(_0xc2944f){if(_0xc2944f[_0x2203('0x37')]!=='VIRTUAL'){var _0x289146={};_0x289146[_0xc2944f[_0x2203('0x2f')]]={'$like':'%'+_0x5cfe5e['query'][_0x2203('0x46')]+'%'};return _0x289146;}})});}_0x4b6fc5=_[_0x2203('0x30')]({},_0x4b6fc5,_0x5cfe5e[_0x2203('0x47')]);var _0x2600a9={'where':_0x4b6fc5['where']};return db['Dynamics365Configuration'][_0x2203('0x2b')](_0x2600a9)['then'](function(_0x543fde){_0x13ed9e[_0x2203('0x2b')]=_0x543fde;if(_0x5cfe5e[_0x2203('0x3a')][_0x2203('0x48')]){_0x4b6fc5['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x2203('0x49')](_0x4b6fc5);})[_0x2203('0x19')](function(_0x12d7fa){_0x13ed9e[_0x2203('0x4a')]=_0x12d7fa;return _0x13ed9e;})[_0x2203('0x19')](respondWithFilteredResult(_0x11451e,_0x4b6fc5))[_0x2203('0x23')](handleError(_0x11451e,null));};exports['show']=function(_0x747dce,_0x557659){var _0x3f7685={'raw':![],'where':{'id':_0x747dce[_0x2203('0x4b')]['id']}},_0x39ff6f={};_0x39ff6f[_0x2203('0x39')]=_['keys'](db['Dynamics365Configuration'][_0x2203('0x4c')]);_0x39ff6f[_0x2203('0x3a')]=_[_0x2203('0x3b')](_0x747dce[_0x2203('0x3a')]);_0x39ff6f['filters']=_['intersection'](_0x39ff6f['model'],_0x39ff6f[_0x2203('0x3a')]);_0x3f7685[_0x2203('0x3f')]=_['intersection'](_0x39ff6f[_0x2203('0x39')],qs[_0x2203('0x3e')](_0x747dce['query'][_0x2203('0x3e')]));_0x3f7685[_0x2203('0x3f')]=_0x3f7685[_0x2203('0x3f')][_0x2203('0x4d')]?_0x3f7685['attributes']:_0x39ff6f[_0x2203('0x39')];if(_0x747dce['query'][_0x2203('0x48')]){_0x3f7685[_0x2203('0x4e')]=[{'all':!![]}];}_0x3f7685=_['merge']({},_0x3f7685,_0x747dce[_0x2203('0x47')]);return db[_0x2203('0x36')][_0x2203('0x4f')](_0x3f7685)[_0x2203('0x19')](handleEntityNotFound(_0x557659,null))[_0x2203('0x19')](respondWithResult(_0x557659,null))[_0x2203('0x23')](handleError(_0x557659,null));};exports['create']=function(_0x562a3d,_0x2f2537){return db['Dynamics365Configuration']['create'](_0x562a3d[_0x2203('0x31')],{})[_0x2203('0x19')](respondWithResult(_0x2f2537,0xc9))[_0x2203('0x23')](handleError(_0x2f2537,null));};exports['update']=function(_0x213c24,_0x4b2788){if(_0x213c24['body']['id']){delete _0x213c24[_0x2203('0x31')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x213c24['params']['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x4b2788,null))[_0x2203('0x19')](saveUpdates(_0x213c24[_0x2203('0x31')],null))[_0x2203('0x19')](respondWithResult(_0x4b2788,null))[_0x2203('0x23')](handleError(_0x4b2788,null));};exports[_0x2203('0x50')]=function(_0x2baea2,_0x91f70c){return db[_0x2203('0x36')][_0x2203('0x4f')]({'where':{'id':_0x2baea2[_0x2203('0x4b')]['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x91f70c,null))['then'](removeEntity(_0x91f70c,null))['catch'](handleError(_0x91f70c,null));};exports[_0x2203('0x51')]=function(_0x43d8c0,_0x2511bd,_0x2446be){var _0x26382f={};var _0x147196={};var _0x4f8b8e;var _0x5486f9;return db[_0x2203('0x36')][_0x2203('0x52')]({'where':{'id':_0x43d8c0[_0x2203('0x4b')]['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x2511bd,null))[_0x2203('0x19')](function(_0x7b0b9c){if(_0x7b0b9c){_0x4f8b8e=_0x7b0b9c;_0x147196[_0x2203('0x39')]=_[_0x2203('0x3b')](db[_0x2203('0x53')][_0x2203('0x4c')]);_0x147196[_0x2203('0x3a')]=_['keys'](_0x43d8c0[_0x2203('0x3a')]);_0x147196[_0x2203('0x3c')]=_[_0x2203('0x3d')](_0x147196[_0x2203('0x39')],_0x147196[_0x2203('0x3a')]);_0x26382f[_0x2203('0x3f')]=_[_0x2203('0x3d')](_0x147196[_0x2203('0x39')],qs[_0x2203('0x3e')](_0x43d8c0[_0x2203('0x3a')][_0x2203('0x3e')]));_0x26382f[_0x2203('0x3f')]=_0x26382f[_0x2203('0x3f')][_0x2203('0x4d')]?_0x26382f[_0x2203('0x3f')]:_0x147196[_0x2203('0x39')];_0x26382f[_0x2203('0x42')]=qs[_0x2203('0x43')](_0x43d8c0[_0x2203('0x3a')][_0x2203('0x43')]);_0x26382f['where']=qs[_0x2203('0x3c')](_[_0x2203('0x44')](_0x43d8c0[_0x2203('0x3a')],_0x147196['filters']));if(_0x43d8c0[_0x2203('0x3a')][_0x2203('0x46')]){_0x26382f[_0x2203('0x45')]=_[_0x2203('0x30')](_0x26382f[_0x2203('0x45')],{'$or':_['map'](_0x26382f[_0x2203('0x3f')],function(_0x11243d){var _0x1c63bf={};_0x1c63bf[_0x11243d]={'$like':'%'+_0x43d8c0['query']['filter']+'%'};return _0x1c63bf;})});}_0x26382f=_['merge']({},_0x26382f,_0x43d8c0['options']);return _0x4f8b8e['getFields'](_0x26382f);}})[_0x2203('0x19')](function(_0xbc9f88){if(_0xbc9f88){_0x5486f9=_0xbc9f88[_0x2203('0x4d')];if(!_0x43d8c0[_0x2203('0x3a')][_0x2203('0x40')](_0x2203('0x41'))){_0x26382f[_0x2203('0x29')]=qs[_0x2203('0x29')](_0x43d8c0['query']['limit']);_0x26382f[_0x2203('0x28')]=qs[_0x2203('0x28')](_0x43d8c0[_0x2203('0x3a')][_0x2203('0x28')]);}return _0x4f8b8e[_0x2203('0x51')](_0x26382f);}})[_0x2203('0x19')](function(_0x45cc3a){if(_0x45cc3a){return _0x45cc3a?{'count':_0x5486f9,'rows':_0x45cc3a}:null;}})[_0x2203('0x19')](respondWithResult(_0x2511bd,null))[_0x2203('0x23')](handleError(_0x2511bd,null));};exports[_0x2203('0x54')]=function(_0x361388,_0xf16e1d,_0x347455){var _0xae45a5={};var _0x288786={};var _0x10a611;var _0x3fe739;return db[_0x2203('0x36')][_0x2203('0x52')]({'where':{'id':_0x361388['params']['id']}})[_0x2203('0x19')](handleEntityNotFound(_0xf16e1d,null))['then'](function(_0x3382b7){if(_0x3382b7){_0x10a611=_0x3382b7;_0x288786['model']=_[_0x2203('0x3b')](db[_0x2203('0x53')][_0x2203('0x4c')]);_0x288786[_0x2203('0x3a')]=_[_0x2203('0x3b')](_0x361388[_0x2203('0x3a')]);_0x288786[_0x2203('0x3c')]=_[_0x2203('0x3d')](_0x288786['model'],_0x288786['query']);_0xae45a5[_0x2203('0x3f')]=_[_0x2203('0x3d')](_0x288786[_0x2203('0x39')],qs['fields'](_0x361388['query']['fields']));_0xae45a5[_0x2203('0x3f')]=_0xae45a5[_0x2203('0x3f')][_0x2203('0x4d')]?_0xae45a5[_0x2203('0x3f')]:_0x288786['model'];_0xae45a5[_0x2203('0x42')]=qs['sort'](_0x361388[_0x2203('0x3a')][_0x2203('0x43')]);_0xae45a5[_0x2203('0x45')]=qs[_0x2203('0x3c')](_[_0x2203('0x44')](_0x361388['query'],_0x288786[_0x2203('0x3c')]));if(_0x361388[_0x2203('0x3a')][_0x2203('0x46')]){_0xae45a5['where']=_[_0x2203('0x30')](_0xae45a5[_0x2203('0x45')],{'$or':_[_0x2203('0x35')](_0xae45a5[_0x2203('0x3f')],function(_0x1c65f9){var _0x4356fe={};_0x4356fe[_0x1c65f9]={'$like':'%'+_0x361388[_0x2203('0x3a')][_0x2203('0x46')]+'%'};return _0x4356fe;})});}_0xae45a5=_[_0x2203('0x30')]({},_0xae45a5,_0x361388[_0x2203('0x47')]);return _0x10a611[_0x2203('0x54')](_0xae45a5);}})['then'](function(_0x1adfa6){if(_0x1adfa6){_0x3fe739=_0x1adfa6[_0x2203('0x4d')];if(!_0x361388[_0x2203('0x3a')][_0x2203('0x40')](_0x2203('0x41'))){_0xae45a5[_0x2203('0x29')]=qs[_0x2203('0x29')](_0x361388[_0x2203('0x3a')][_0x2203('0x29')]);_0xae45a5[_0x2203('0x28')]=qs[_0x2203('0x28')](_0x361388[_0x2203('0x3a')]['offset']);}return _0x10a611['getSubjects'](_0xae45a5);}})[_0x2203('0x19')](function(_0x3a1c63){if(_0x3a1c63){return _0x3a1c63?{'count':_0x3fe739,'rows':_0x3a1c63}:null;}})[_0x2203('0x19')](respondWithResult(_0xf16e1d,null))[_0x2203('0x23')](handleError(_0xf16e1d,null));};exports[_0x2203('0x55')]=function(_0x4fd029,_0x16e518,_0x3cb792){var _0x4e539b={};var _0x511689={};var _0x4edac6;var _0x4fc51a;return db['Dynamics365Configuration'][_0x2203('0x52')]({'where':{'id':_0x4fd029[_0x2203('0x4b')]['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x16e518,null))['then'](function(_0x48a5d6){if(_0x48a5d6){_0x4edac6=_0x48a5d6;_0x511689['model']=_[_0x2203('0x3b')](db[_0x2203('0x53')][_0x2203('0x4c')]);_0x511689[_0x2203('0x3a')]=_[_0x2203('0x3b')](_0x4fd029[_0x2203('0x3a')]);_0x511689[_0x2203('0x3c')]=_['intersection'](_0x511689[_0x2203('0x39')],_0x511689[_0x2203('0x3a')]);_0x4e539b[_0x2203('0x3f')]=_[_0x2203('0x3d')](_0x511689[_0x2203('0x39')],qs[_0x2203('0x3e')](_0x4fd029[_0x2203('0x3a')]['fields']));_0x4e539b[_0x2203('0x3f')]=_0x4e539b['attributes']['length']?_0x4e539b[_0x2203('0x3f')]:_0x511689['model'];_0x4e539b[_0x2203('0x42')]=qs[_0x2203('0x43')](_0x4fd029['query'][_0x2203('0x43')]);_0x4e539b[_0x2203('0x45')]=qs[_0x2203('0x3c')](_[_0x2203('0x44')](_0x4fd029[_0x2203('0x3a')],_0x511689[_0x2203('0x3c')]));if(_0x4fd029['query'][_0x2203('0x46')]){_0x4e539b[_0x2203('0x45')]=_['merge'](_0x4e539b['where'],{'$or':_[_0x2203('0x35')](_0x4e539b[_0x2203('0x3f')],function(_0x383d3e){var _0xa88b4f={};_0xa88b4f[_0x383d3e]={'$like':'%'+_0x4fd029[_0x2203('0x3a')][_0x2203('0x46')]+'%'};return _0xa88b4f;})});}_0x4e539b=_[_0x2203('0x30')]({},_0x4e539b,_0x4fd029[_0x2203('0x47')]);return _0x4edac6[_0x2203('0x55')](_0x4e539b);}})[_0x2203('0x19')](function(_0x74d185){if(_0x74d185){_0x4fc51a=_0x74d185[_0x2203('0x4d')];if(!_0x4fd029[_0x2203('0x3a')][_0x2203('0x40')](_0x2203('0x41'))){_0x4e539b[_0x2203('0x29')]=qs['limit'](_0x4fd029['query'][_0x2203('0x29')]);_0x4e539b[_0x2203('0x28')]=qs['offset'](_0x4fd029[_0x2203('0x3a')][_0x2203('0x28')]);}return _0x4edac6['getDescriptions'](_0x4e539b);}})[_0x2203('0x19')](function(_0x2f499d){if(_0x2f499d){return _0x2f499d?{'count':_0x4fc51a,'rows':_0x2f499d}:null;}})['then'](respondWithResult(_0x16e518,null))[_0x2203('0x23')](handleError(_0x16e518,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4c4a715..57ff3a2 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb41e=['Dynamics365Configuration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x3f3f19,_0x18179b){var _0x2214f3=function(_0x29cec4){while(--_0x29cec4){_0x3f3f19['push'](_0x3f3f19['shift']());}};_0x2214f3(++_0x18179b);}(_0xb41e,0x1f0));var _0xeb41=function(_0x463d71,_0x4cd285){_0x463d71=_0x463d71-0x0;var _0x5f4d10=_0xb41e[_0x463d71];return _0x5f4d10;};'use strict';var _=require(_0xeb41('0x0'));var util=require('util');var logger=require(_0xeb41('0x1'))(_0xeb41('0x2'));var moment=require(_0xeb41('0x3'));var BPromise=require(_0xeb41('0x4'));var rp=require(_0xeb41('0x5'));var fs=require('fs');var path=require(_0xeb41('0x6'));var rimraf=require('rimraf');var config=require(_0xeb41('0x7'));var attributes=require(_0xeb41('0x8'));module[_0xeb41('0x9')]=function(_0x2c29a8,_0x265fe7){return _0x2c29a8['define'](_0xeb41('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e64=['api','moment','bluebird','../../config/environment','exports','Dynamics365Configuration','lodash','util'];(function(_0x10e6d3,_0x44fe4e){var _0x448fca=function(_0x4a02fc){while(--_0x4a02fc){_0x10e6d3['push'](_0x10e6d3['shift']());}};_0x448fca(++_0x44fe4e);}(_0x3e64,0xa6));var _0x43e6=function(_0x236c6f,_0x509933){_0x236c6f=_0x236c6f-0x0;var _0x2d481f=_0x3e64[_0x236c6f];return _0x2d481f;};'use strict';var _=require(_0x43e6('0x0'));var util=require(_0x43e6('0x1'));var logger=require('../../config/logger')(_0x43e6('0x2'));var moment=require(_0x43e6('0x3'));var BPromise=require(_0x43e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x43e6('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x43e6('0x6')]=function(_0x289e2e,_0x38208a){return _0x289e2e['define'](_0x43e6('0x7'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 71fbab3..500bcdb 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21e8=['../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x21e8,0x1db));var _0x821e=function(_0x927da7,_0x2e04ee){_0x927da7=_0x927da7-0x0;var _0x2ea06c=_0x21e8[_0x927da7];return _0x2ea06c;};'use strict';var _=require(_0x821e('0x0'));var util=require(_0x821e('0x1'));var moment=require(_0x821e('0x2'));var BPromise=require(_0x821e('0x3'));var rs=require(_0x821e('0x4'));var fs=require('fs');var Redis=require(_0x821e('0x5'));var db=require(_0x821e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x821e('0x7'))(_0x821e('0x8'));var config=require(_0x821e('0x9'));var jayson=require(_0x821e('0xa'));var client=jayson[_0x821e('0xb')][_0x821e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55e811,_0x3ab16d,_0x4dbca9){return new BPromise(function(_0x47524d,_0x344fe5){return client['request'](_0x55e811,_0x4dbca9)['then'](function(_0x30be8c){logger[_0x821e('0xd')](_0x821e('0xe'),_0x3ab16d,_0x821e('0xf'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3ab16d,_0x821e('0xf'),JSON[_0x821e('0x10')](_0x30be8c));if(_0x30be8c[_0x821e('0x11')]){if(_0x30be8c[_0x821e('0x11')][_0x821e('0x12')]===0x1f4){logger[_0x821e('0x11')](_0x821e('0xe'),_0x3ab16d,_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);return _0x344fe5(_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);}logger[_0x821e('0x11')](_0x821e('0xe'),_0x3ab16d,_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);return _0x47524d(_0x30be8c[_0x821e('0x11')][_0x821e('0x13')]);}else{logger[_0x821e('0xd')](_0x821e('0xe'),_0x3ab16d,'request\x20sent');_0x47524d(_0x30be8c[_0x821e('0x14')][_0x821e('0x13')]);}})[_0x821e('0x15')](function(_0x27e8d9){logger[_0x821e('0x11')](_0x821e('0xe'),_0x3ab16d,_0x27e8d9);_0x344fe5(_0x27e8d9);});});} \ No newline at end of file +var _0xc950=['rpc','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c47e0,_0x4fcc47){var _0x4dff0a=function(_0x3d0cbc){while(--_0x3d0cbc){_0x2c47e0['push'](_0x2c47e0['shift']());}};_0x4dff0a(++_0x4fcc47);}(_0xc950,0x81));var _0x0c95=function(_0x5c700f,_0x5ccc8b){_0x5c700f=_0x5c700f-0x0;var _0x1643e0=_0xc950[_0x5c700f];return _0x1643e0;};'use strict';var _=require(_0x0c95('0x0'));var util=require(_0x0c95('0x1'));var moment=require(_0x0c95('0x2'));var BPromise=require(_0x0c95('0x3'));var rs=require(_0x0c95('0x4'));var fs=require('fs');var Redis=require(_0x0c95('0x5'));var db=require(_0x0c95('0x6'))['db'];var utils=require(_0x0c95('0x7'));var logger=require(_0x0c95('0x8'))(_0x0c95('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0c95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x534cbe,_0x1f8c81,_0x556921){return new BPromise(function(_0x59dfaa,_0x41cef8){return client[_0x0c95('0xb')](_0x534cbe,_0x556921)[_0x0c95('0xc')](function(_0x5386fe){logger[_0x0c95('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1f8c81,'request\x20sent');logger['debug'](_0x0c95('0xe'),_0x1f8c81,_0x0c95('0xf'),JSON[_0x0c95('0x10')](_0x5386fe));if(_0x5386fe[_0x0c95('0x11')]){if(_0x5386fe['error'][_0x0c95('0x12')]===0x1f4){logger[_0x0c95('0x11')](_0x0c95('0x13'),_0x1f8c81,_0x5386fe[_0x0c95('0x11')][_0x0c95('0x14')]);return _0x41cef8(_0x5386fe[_0x0c95('0x11')]['message']);}logger[_0x0c95('0x11')](_0x0c95('0x13'),_0x1f8c81,_0x5386fe[_0x0c95('0x11')][_0x0c95('0x14')]);return _0x59dfaa(_0x5386fe['error'][_0x0c95('0x14')]);}else{logger[_0x0c95('0xd')](_0x0c95('0x13'),_0x1f8c81,_0x0c95('0xf'));_0x59dfaa(_0x5386fe[_0x0c95('0x15')][_0x0c95('0x14')]);}})[_0x0c95('0x16')](function(_0x416abe){logger[_0x0c95('0x11')](_0x0c95('0x13'),_0x1f8c81,_0x416abe);_0x41cef8(_0x416abe);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9049e7e..4dd93b4 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa4b=['/:id','isAuthenticated','show','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x4a9a28,_0x18c27f){var _0x3b29e1=function(_0x2c6109){while(--_0x2c6109){_0x4a9a28['push'](_0x4a9a28['shift']());}};_0x3b29e1(++_0x18c27f);}(_0xfa4b,0x175));var _0xbfa4=function(_0xa0c6b5,_0x1d9855){_0xa0c6b5=_0xa0c6b5-0x0;var _0x4b4fb3=_0xfa4b[_0xa0c6b5];return _0x4b4fb3;};'use strict';var multer=require(_0xbfa4('0x0'));var util=require(_0xbfa4('0x1'));var path=require(_0xbfa4('0x2'));var timeout=require(_0xbfa4('0x3'));var express=require(_0xbfa4('0x4'));var router=express[_0xbfa4('0x5')]();var fs_extra=require(_0xbfa4('0x6'));var auth=require(_0xbfa4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbfa4('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xbfa4('0x9')]('/',auth['isAuthenticated'](),controller[_0xbfa4('0xa')]);router[_0xbfa4('0x9')](_0xbfa4('0xb'),auth[_0xbfa4('0xc')](),controller[_0xbfa4('0xd')]);router['post']('/',auth[_0xbfa4('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbfa4('0xe')]);router['delete'](_0xbfa4('0xb'),auth[_0xbfa4('0xc')](),controller[_0xbfa4('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe1a8=['get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe1a8,0x6f));var _0x8e1a=function(_0x4060b4,_0x82eb25){_0x4060b4=_0x4060b4-0x0;var _0x32aaa1=_0xe1a8[_0x4060b4];return _0x32aaa1;};'use strict';var multer=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var path=require(_0x8e1a('0x2'));var timeout=require(_0x8e1a('0x3'));var express=require(_0x8e1a('0x4'));var router=express[_0x8e1a('0x5')]();var fs_extra=require(_0x8e1a('0x6'));var auth=require(_0x8e1a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8e1a('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x8e1a('0x9')]('/',auth['isAuthenticated'](),controller[_0x8e1a('0xa')]);router['get'](_0x8e1a('0xb'),auth[_0x8e1a('0xc')](),controller[_0x8e1a('0xd')]);router[_0x8e1a('0xe')]('/',auth[_0x8e1a('0xc')](),controller[_0x8e1a('0xf')]);router['put'](_0x8e1a('0xb'),auth[_0x8e1a('0xc')](),controller[_0x8e1a('0x10')]);router[_0x8e1a('0x11')](_0x8e1a('0xb'),auth['isAuthenticated'](),controller[_0x8e1a('0x12')]);module[_0x8e1a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 99be48b..b5aa6a1 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac9d=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x21bf0f,_0x512d7c){var _0x19410e=function(_0x33013){while(--_0x33013){_0x21bf0f['push'](_0x21bf0f['shift']());}};_0x19410e(++_0x512d7c);}(_0xac9d,0x14d));var _0xdac9=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0xac9d[_0x568cf0];return _0x360f81;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'type':{'type':Sequelize[_0xdac9('0x2')](_0xdac9('0x3'),_0xdac9('0x4'),_0xdac9('0x5'),_0xdac9('0x6'),_0xdac9('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdac9('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdac9('0x2')](_0xdac9('0x3'),_0xdac9('0x4'),_0xdac9('0x5'))},'keyContent':{'type':Sequelize[_0xdac9('0x8')]},'idField':{'type':Sequelize[_0xdac9('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdac9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbf5=['exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN'];(function(_0x849e7c,_0x34014e){var _0x11722f=function(_0x1a3fa3){while(--_0x1a3fa3){_0x849e7c['push'](_0x849e7c['shift']());}};_0x11722f(++_0x34014e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x6c8772,_0xa5e0b9){_0x6c8772=_0x6c8772-0x0;var _0x364314=_0xdbf5[_0x6c8772];return _0x364314;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x5dbf('0x1'),_0x5dbf('0x2'),_0x5dbf('0x3'),_0x5dbf('0x4')),'defaultValue':_0x5dbf('0x5')},'content':{'type':Sequelize[_0x5dbf('0x6')]},'key':{'type':Sequelize[_0x5dbf('0x6')]},'keyType':{'type':Sequelize[_0x5dbf('0x7')](_0x5dbf('0x5'),_0x5dbf('0x1'),_0x5dbf('0x2'))},'keyContent':{'type':Sequelize[_0x5dbf('0x6')]},'idField':{'type':Sequelize[_0x5dbf('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5dbf('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 03565de..082f406 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x163e=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','Dynamics365Field','includeAll','findAll','rows','show','rawAttributes','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','render','contact','interaction','account','index','map','fieldName','key','model'];(function(_0x3ff491,_0x287ece){var _0xa5b633=function(_0x1e565f){while(--_0x1e565f){_0x3ff491['push'](_0x3ff491['shift']());}};_0xa5b633(++_0x287ece);}(_0x163e,0x6a));var _0xe163=function(_0x51c938,_0x7b322){_0x51c938=_0x51c938-0x0;var _0x4bb8b2=_0x163e[_0x51c938];return _0x4bb8b2;};'use strict';var emlformat=require(_0xe163('0x0'));var rimraf=require(_0xe163('0x1'));var zipdir=require(_0xe163('0x2'));var jsonpatch=require(_0xe163('0x3'));var rp=require(_0xe163('0x4'));var moment=require(_0xe163('0x5'));var BPromise=require(_0xe163('0x6'));var Mustache=require('mustache');var util=require(_0xe163('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe163('0x8'));var ejs=require(_0xe163('0x9'));var fs=require('fs');var fs_extra=require(_0xe163('0xa'));var _=require(_0xe163('0xb'));var squel=require(_0xe163('0xc'));var crypto=require(_0xe163('0xd'));var jsforce=require(_0xe163('0xe'));var deskjs=require(_0xe163('0xf'));var toCsv=require(_0xe163('0x8'));var querystring=require('querystring');var Papa=require(_0xe163('0x10'));var Redis=require('ioredis');var authService=require(_0xe163('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe163('0x12'));var utils=require(_0xe163('0x13'));var config=require(_0xe163('0x14'));var licenseUtil=require(_0xe163('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4365d5,_0x3116b0){_0x3116b0=_0x3116b0||0xcc;return function(_0x5c69ca){if(_0x5c69ca){return _0x4365d5['sendStatus'](_0x3116b0);}return _0x4365d5['status'](_0x3116b0)['end']();};}function respondWithResult(_0x58f6e1,_0x5d0c87){_0x5d0c87=_0x5d0c87||0xc8;return function(_0x48950d){if(_0x48950d){return _0x58f6e1['status'](_0x5d0c87)[_0xe163('0x16')](_0x48950d);}};}function respondWithFilteredResult(_0x229c95,_0x113a74){return function(_0x30cf29){if(_0x30cf29){var _0x20b342=typeof _0x113a74[_0xe163('0x17')]==='undefined'&&typeof _0x113a74[_0xe163('0x18')]===_0xe163('0x19');var _0x57e2e9=_0x30cf29[_0xe163('0x1a')];var _0x372c1b=_0x20b342?0x0:_0x113a74[_0xe163('0x17')];var _0x1cfa03=_0x20b342?_0x30cf29['count']:_0x113a74[_0xe163('0x17')]+_0x113a74[_0xe163('0x18')];var _0x4b6022;if(_0x1cfa03>=_0x57e2e9){_0x1cfa03=_0x57e2e9;_0x4b6022=0xc8;}else{_0x4b6022=0xce;}_0x229c95[_0xe163('0x1b')](_0x4b6022);return _0x229c95[_0xe163('0x1c')](_0xe163('0x1d'),_0x372c1b+'-'+_0x1cfa03+'/'+_0x57e2e9)[_0xe163('0x16')](_0x30cf29);}return null;};}function patchUpdates(_0x563b18){return function(_0x47296a){try{jsonpatch[_0xe163('0x1e')](_0x47296a,_0x563b18,!![]);}catch(_0x5cc9ac){return BPromise[_0xe163('0x1f')](_0x5cc9ac);}return _0x47296a[_0xe163('0x20')]();};}function saveUpdates(_0x7c1148,_0x4138f0){return function(_0x1ae1b6){if(_0x1ae1b6){return _0x1ae1b6[_0xe163('0x21')](_0x7c1148)[_0xe163('0x22')](function(_0x13d811){return _0x13d811;});}return null;};}function removeEntity(_0x343c16,_0x2467fe){return function(_0x2480c7){if(_0x2480c7){return _0x2480c7[_0xe163('0x23')]()[_0xe163('0x22')](function(){_0x343c16[_0xe163('0x1b')](0xcc)[_0xe163('0x24')]();});}};}function handleEntityNotFound(_0x5c124e,_0xdae913){return function(_0x3f0602){if(!_0x3f0602){_0x5c124e[_0xe163('0x25')](0x194);}return _0x3f0602;};}function handleError(_0x2fe0be,_0x507939){_0x507939=_0x507939||0x1f4;return function(_0x7437f6){logger['error'](_0x7437f6[_0xe163('0x26')]);if(_0x7437f6[_0xe163('0x27')]){delete _0x7437f6[_0xe163('0x27')];}_0x2fe0be[_0xe163('0x1b')](_0x507939)[_0xe163('0x28')](_0x7437f6);};}function getMustacheRender(_0x456ca9,_0x459712){return Mustache[_0xe163('0x29')](_0x456ca9,_['merge'](_0x459712['body'],{'contact':_0x459712[_0xe163('0x2a')],'message':_0x459712['message'],'agent':_0x459712['agent'],'interaction':_0x459712[_0xe163('0x2b')],'account':_0x459712[_0xe163('0x2c')]}))||'';}exports[_0xe163('0x2d')]=function(_0x28cedc,_0x24a7c3){var _0xf7320e={},_0x583d86={},_0x15a31b={'count':0x0,'rows':[]};var _0x44759f=_[_0xe163('0x2e')](db['Dynamics365Field']['rawAttributes'],function(_0x4c5792){return{'name':_0x4c5792[_0xe163('0x2f')],'type':_0x4c5792['type'][_0xe163('0x30')]};});_0x583d86[_0xe163('0x31')]=_[_0xe163('0x2e')](_0x44759f,_0xe163('0x27'));_0x583d86[_0xe163('0x32')]=_[_0xe163('0x33')](_0x28cedc[_0xe163('0x32')]);_0x583d86['filters']=_[_0xe163('0x34')](_0x583d86[_0xe163('0x31')],_0x583d86['query']);_0xf7320e[_0xe163('0x35')]=_[_0xe163('0x34')](_0x583d86['model'],qs[_0xe163('0x36')](_0x28cedc[_0xe163('0x32')][_0xe163('0x36')]));_0xf7320e[_0xe163('0x35')]=_0xf7320e['attributes'][_0xe163('0x37')]?_0xf7320e[_0xe163('0x35')]:_0x583d86[_0xe163('0x31')];if(!_0x28cedc['query'][_0xe163('0x38')](_0xe163('0x39'))){_0xf7320e['limit']=qs[_0xe163('0x18')](_0x28cedc[_0xe163('0x32')]['limit']);_0xf7320e[_0xe163('0x17')]=qs[_0xe163('0x17')](_0x28cedc[_0xe163('0x32')][_0xe163('0x17')]);}_0xf7320e[_0xe163('0x3a')]=qs[_0xe163('0x3b')](_0x28cedc[_0xe163('0x32')][_0xe163('0x3b')]);_0xf7320e[_0xe163('0x3c')]=qs[_0xe163('0x3d')](_[_0xe163('0x3e')](_0x28cedc['query'],_0x583d86['filters']),_0x44759f);if(_0x28cedc[_0xe163('0x32')][_0xe163('0x3f')]){_0xf7320e['where']=_['merge'](_0xf7320e['where'],{'$or':_[_0xe163('0x2e')](_0x44759f,function(_0x46daf3){if(_0x46daf3[_0xe163('0x40')]!==_0xe163('0x41')){var _0x3d87e2={};_0x3d87e2[_0x46daf3['name']]={'$like':'%'+_0x28cedc['query'][_0xe163('0x3f')]+'%'};return _0x3d87e2;}})});}_0xf7320e=_['merge']({},_0xf7320e,_0x28cedc['options']);var _0x5aa771={'where':_0xf7320e[_0xe163('0x3c')]};return db[_0xe163('0x42')]['count'](_0x5aa771)[_0xe163('0x22')](function(_0x685987){_0x15a31b[_0xe163('0x1a')]=_0x685987;if(_0x28cedc['query'][_0xe163('0x43')]){_0xf7320e['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xe163('0x44')](_0xf7320e);})[_0xe163('0x22')](function(_0x459223){_0x15a31b[_0xe163('0x45')]=_0x459223;return _0x15a31b;})[_0xe163('0x22')](respondWithFilteredResult(_0x24a7c3,_0xf7320e))['catch'](handleError(_0x24a7c3,null));};exports[_0xe163('0x46')]=function(_0xcf246b,_0x3ac5c1){var _0x34cdde={'raw':!![],'where':{'id':_0xcf246b['params']['id']}},_0x30f46e={};_0x30f46e[_0xe163('0x31')]=_['keys'](db['Dynamics365Field'][_0xe163('0x47')]);_0x30f46e[_0xe163('0x32')]=_[_0xe163('0x33')](_0xcf246b[_0xe163('0x32')]);_0x30f46e[_0xe163('0x3d')]=_['intersection'](_0x30f46e['model'],_0x30f46e['query']);_0x34cdde[_0xe163('0x35')]=_['intersection'](_0x30f46e[_0xe163('0x31')],qs[_0xe163('0x36')](_0xcf246b[_0xe163('0x32')][_0xe163('0x36')]));_0x34cdde['attributes']=_0x34cdde['attributes'][_0xe163('0x37')]?_0x34cdde[_0xe163('0x35')]:_0x30f46e['model'];if(_0xcf246b['query'][_0xe163('0x43')]){_0x34cdde['include']=[{'all':!![]}];}_0x34cdde=_['merge']({},_0x34cdde,_0xcf246b[_0xe163('0x48')]);return db[_0xe163('0x42')][_0xe163('0x49')](_0x34cdde)[_0xe163('0x22')](handleEntityNotFound(_0x3ac5c1,null))['then'](respondWithResult(_0x3ac5c1,null))[_0xe163('0x4a')](handleError(_0x3ac5c1,null));};exports[_0xe163('0x4b')]=function(_0x121a38,_0x21b106){return db[_0xe163('0x42')][_0xe163('0x4b')](_0x121a38[_0xe163('0x4c')],{})[_0xe163('0x22')](respondWithResult(_0x21b106,0xc9))[_0xe163('0x4a')](handleError(_0x21b106,null));};exports['update']=function(_0x88bfa8,_0x353223){if(_0x88bfa8[_0xe163('0x4c')]['id']){delete _0x88bfa8[_0xe163('0x4c')]['id'];}return db[_0xe163('0x42')][_0xe163('0x49')]({'where':{'id':_0x88bfa8[_0xe163('0x4d')]['id']}})[_0xe163('0x22')](handleEntityNotFound(_0x353223,null))['then'](saveUpdates(_0x88bfa8[_0xe163('0x4c')],null))[_0xe163('0x22')](respondWithResult(_0x353223,null))[_0xe163('0x4a')](handleError(_0x353223,null));};exports[_0xe163('0x23')]=function(_0x349612,_0x40bd51){return db[_0xe163('0x42')][_0xe163('0x49')]({'where':{'id':_0x349612['params']['id']}})[_0xe163('0x22')](handleEntityNotFound(_0x40bd51,null))[_0xe163('0x22')](removeEntity(_0x40bd51,null))[_0xe163('0x4a')](handleError(_0x40bd51,null));}; \ No newline at end of file +var _0xd0ba=['catch','params','create','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0xd0ba,0x1e4));var _0xad0b=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xd0ba[_0x32d457];return _0x338386;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad0b('0x0'));var zipdir=require(_0xad0b('0x1'));var jsonpatch=require(_0xad0b('0x2'));var rp=require(_0xad0b('0x3'));var moment=require(_0xad0b('0x4'));var BPromise=require(_0xad0b('0x5'));var Mustache=require(_0xad0b('0x6'));var util=require(_0xad0b('0x7'));var path=require(_0xad0b('0x8'));var sox=require(_0xad0b('0x9'));var csv=require(_0xad0b('0xa'));var ejs=require(_0xad0b('0xb'));var fs=require('fs');var fs_extra=require(_0xad0b('0xc'));var _=require(_0xad0b('0xd'));var squel=require(_0xad0b('0xe'));var crypto=require(_0xad0b('0xf'));var jsforce=require(_0xad0b('0x10'));var deskjs=require(_0xad0b('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xad0b('0x12'));var Redis=require(_0xad0b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xad0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad0b('0x15'));var logger=require(_0xad0b('0x16'))(_0xad0b('0x17'));var utils=require(_0xad0b('0x18'));var config=require(_0xad0b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xad0b('0x1a'))['db'];function respondWithStatusCode(_0x1f9b8a,_0x53d8af){_0x53d8af=_0x53d8af||0xcc;return function(_0x2ce216){if(_0x2ce216){return _0x1f9b8a[_0xad0b('0x1b')](_0x53d8af);}return _0x1f9b8a[_0xad0b('0x1c')](_0x53d8af)[_0xad0b('0x1d')]();};}function respondWithResult(_0x40a671,_0x3375a8){_0x3375a8=_0x3375a8||0xc8;return function(_0x301265){if(_0x301265){return _0x40a671[_0xad0b('0x1c')](_0x3375a8)[_0xad0b('0x1e')](_0x301265);}};}function respondWithFilteredResult(_0x3e75dd,_0x7d0c1e){return function(_0x18b429){if(_0x18b429){var _0x53c055=typeof _0x7d0c1e['offset']===_0xad0b('0x1f')&&typeof _0x7d0c1e[_0xad0b('0x20')]===_0xad0b('0x1f');var _0x391098=_0x18b429[_0xad0b('0x21')];var _0x62bb50=_0x53c055?0x0:_0x7d0c1e['offset'];var _0x1fc384=_0x53c055?_0x18b429[_0xad0b('0x21')]:_0x7d0c1e[_0xad0b('0x22')]+_0x7d0c1e[_0xad0b('0x20')];var _0x53eaa9;if(_0x1fc384>=_0x391098){_0x1fc384=_0x391098;_0x53eaa9=0xc8;}else{_0x53eaa9=0xce;}_0x3e75dd[_0xad0b('0x1c')](_0x53eaa9);return _0x3e75dd['set'](_0xad0b('0x23'),_0x62bb50+'-'+_0x1fc384+'/'+_0x391098)[_0xad0b('0x1e')](_0x18b429);}return null;};}function patchUpdates(_0x4af12c){return function(_0x57f82e){try{jsonpatch[_0xad0b('0x24')](_0x57f82e,_0x4af12c,!![]);}catch(_0x2f0ba9){return BPromise['reject'](_0x2f0ba9);}return _0x57f82e['save']();};}function saveUpdates(_0x2bbeee,_0x130bd8){return function(_0x35e89b){if(_0x35e89b){return _0x35e89b[_0xad0b('0x25')](_0x2bbeee)[_0xad0b('0x26')](function(_0x143d65){return _0x143d65;});}return null;};}function removeEntity(_0x543a9e,_0x562e5a){return function(_0x1e343a){if(_0x1e343a){return _0x1e343a[_0xad0b('0x27')]()[_0xad0b('0x26')](function(){_0x543a9e[_0xad0b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbd828d,_0x191451){return function(_0x105e54){if(!_0x105e54){_0xbd828d[_0xad0b('0x1b')](0x194);}return _0x105e54;};}function handleError(_0x3087e2,_0xea0c78){_0xea0c78=_0xea0c78||0x1f4;return function(_0xa22101){logger[_0xad0b('0x28')](_0xa22101[_0xad0b('0x29')]);if(_0xa22101[_0xad0b('0x2a')]){delete _0xa22101[_0xad0b('0x2a')];}_0x3087e2[_0xad0b('0x1c')](_0xea0c78)[_0xad0b('0x2b')](_0xa22101);};}function getMustacheRender(_0x3d515e,_0x107f4a){return Mustache[_0xad0b('0x2c')](_0x3d515e,_['merge'](_0x107f4a[_0xad0b('0x2d')],{'contact':_0x107f4a[_0xad0b('0x2e')],'message':_0x107f4a[_0xad0b('0x2f')],'agent':_0x107f4a[_0xad0b('0x30')],'interaction':_0x107f4a[_0xad0b('0x31')],'account':_0x107f4a[_0xad0b('0x32')]}))||'';}exports['index']=function(_0x727844,_0x5b940f){var _0x2e967a={},_0x155590={},_0x3970bc={'count':0x0,'rows':[]};var _0x3009b9=_[_0xad0b('0x33')](db[_0xad0b('0x34')][_0xad0b('0x35')],function(_0xe923fe){return{'name':_0xe923fe[_0xad0b('0x36')],'type':_0xe923fe['type'][_0xad0b('0x37')]};});_0x155590[_0xad0b('0x38')]=_[_0xad0b('0x33')](_0x3009b9,'name');_0x155590[_0xad0b('0x39')]=_[_0xad0b('0x3a')](_0x727844['query']);_0x155590[_0xad0b('0x3b')]=_['intersection'](_0x155590['model'],_0x155590['query']);_0x2e967a[_0xad0b('0x3c')]=_[_0xad0b('0x3d')](_0x155590[_0xad0b('0x38')],qs[_0xad0b('0x3e')](_0x727844[_0xad0b('0x39')][_0xad0b('0x3e')]));_0x2e967a['attributes']=_0x2e967a['attributes'][_0xad0b('0x3f')]?_0x2e967a[_0xad0b('0x3c')]:_0x155590[_0xad0b('0x38')];if(!_0x727844[_0xad0b('0x39')][_0xad0b('0x40')](_0xad0b('0x41'))){_0x2e967a[_0xad0b('0x20')]=qs[_0xad0b('0x20')](_0x727844[_0xad0b('0x39')][_0xad0b('0x20')]);_0x2e967a[_0xad0b('0x22')]=qs[_0xad0b('0x22')](_0x727844[_0xad0b('0x39')][_0xad0b('0x22')]);}_0x2e967a[_0xad0b('0x42')]=qs['sort'](_0x727844[_0xad0b('0x39')][_0xad0b('0x43')]);_0x2e967a[_0xad0b('0x44')]=qs['filters'](_[_0xad0b('0x45')](_0x727844[_0xad0b('0x39')],_0x155590[_0xad0b('0x3b')]),_0x3009b9);if(_0x727844['query'][_0xad0b('0x46')]){_0x2e967a[_0xad0b('0x44')]=_['merge'](_0x2e967a['where'],{'$or':_[_0xad0b('0x33')](_0x3009b9,function(_0x5af3f2){if(_0x5af3f2['type']!==_0xad0b('0x47')){var _0x54aa0b={};_0x54aa0b[_0x5af3f2[_0xad0b('0x2a')]]={'$like':'%'+_0x727844[_0xad0b('0x39')]['filter']+'%'};return _0x54aa0b;}})});}_0x2e967a=_['merge']({},_0x2e967a,_0x727844[_0xad0b('0x48')]);var _0x1414ae={'where':_0x2e967a['where']};return db[_0xad0b('0x34')][_0xad0b('0x21')](_0x1414ae)[_0xad0b('0x26')](function(_0x1459cf){_0x3970bc['count']=_0x1459cf;if(_0x727844[_0xad0b('0x39')][_0xad0b('0x49')]){_0x2e967a[_0xad0b('0x4a')]=[{'all':!![]}];}return db[_0xad0b('0x34')]['findAll'](_0x2e967a);})[_0xad0b('0x26')](function(_0x29e6d7){_0x3970bc[_0xad0b('0x4b')]=_0x29e6d7;return _0x3970bc;})[_0xad0b('0x26')](respondWithFilteredResult(_0x5b940f,_0x2e967a))[_0xad0b('0x4c')](handleError(_0x5b940f,null));};exports['show']=function(_0x2b69c6,_0x4e6761){var _0x5f28f0={'raw':!![],'where':{'id':_0x2b69c6[_0xad0b('0x4d')]['id']}},_0x1ee444={};_0x1ee444[_0xad0b('0x38')]=_[_0xad0b('0x3a')](db[_0xad0b('0x34')]['rawAttributes']);_0x1ee444[_0xad0b('0x39')]=_[_0xad0b('0x3a')](_0x2b69c6[_0xad0b('0x39')]);_0x1ee444[_0xad0b('0x3b')]=_[_0xad0b('0x3d')](_0x1ee444[_0xad0b('0x38')],_0x1ee444[_0xad0b('0x39')]);_0x5f28f0[_0xad0b('0x3c')]=_['intersection'](_0x1ee444[_0xad0b('0x38')],qs[_0xad0b('0x3e')](_0x2b69c6['query'][_0xad0b('0x3e')]));_0x5f28f0[_0xad0b('0x3c')]=_0x5f28f0[_0xad0b('0x3c')]['length']?_0x5f28f0[_0xad0b('0x3c')]:_0x1ee444[_0xad0b('0x38')];if(_0x2b69c6[_0xad0b('0x39')]['includeAll']){_0x5f28f0[_0xad0b('0x4a')]=[{'all':!![]}];}_0x5f28f0=_['merge']({},_0x5f28f0,_0x2b69c6[_0xad0b('0x48')]);return db[_0xad0b('0x34')]['find'](_0x5f28f0)[_0xad0b('0x26')](handleEntityNotFound(_0x4e6761,null))[_0xad0b('0x26')](respondWithResult(_0x4e6761,null))[_0xad0b('0x4c')](handleError(_0x4e6761,null));};exports['create']=function(_0x542c37,_0x506595){return db['Dynamics365Field'][_0xad0b('0x4e')](_0x542c37[_0xad0b('0x2d')],{})[_0xad0b('0x26')](respondWithResult(_0x506595,0xc9))[_0xad0b('0x4c')](handleError(_0x506595,null));};exports[_0xad0b('0x25')]=function(_0x2daf19,_0x1d2191){if(_0x2daf19[_0xad0b('0x2d')]['id']){delete _0x2daf19[_0xad0b('0x2d')]['id'];}return db['Dynamics365Field'][_0xad0b('0x4f')]({'where':{'id':_0x2daf19[_0xad0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d2191,null))[_0xad0b('0x26')](saveUpdates(_0x2daf19['body'],null))[_0xad0b('0x26')](respondWithResult(_0x1d2191,null))[_0xad0b('0x4c')](handleError(_0x1d2191,null));};exports[_0xad0b('0x27')]=function(_0x5802f0,_0x24a31e){return db[_0xad0b('0x34')]['find']({'where':{'id':_0x5802f0[_0xad0b('0x4d')]['id']}})[_0xad0b('0x26')](handleEntityNotFound(_0x24a31e,null))[_0xad0b('0x26')](removeEntity(_0x24a31e,null))[_0xad0b('0x4c')](handleError(_0x24a31e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7f085ce..cb8c9d5 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x212c=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','define'];(function(_0xb58b99,_0x5249a9){var _0x5b9949=function(_0x979d74){while(--_0x979d74){_0xb58b99['push'](_0xb58b99['shift']());}};_0x5b9949(++_0x5249a9);}(_0x212c,0xb9));var _0xc212=function(_0x53e311,_0x17c0f9){_0x53e311=_0x53e311-0x0;var _0x5bb62d=_0x212c[_0x53e311];return _0x5bb62d;};'use strict';var _=require(_0xc212('0x0'));var util=require(_0xc212('0x1'));var logger=require(_0xc212('0x2'))(_0xc212('0x3'));var moment=require(_0xc212('0x4'));var BPromise=require(_0xc212('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc212('0x6'));var rimraf=require(_0xc212('0x7'));var config=require('../../config/environment');var attributes=require(_0xc212('0x8'));module['exports']=function(_0x96156,_0x34eb27){return _0x96156[_0xc212('0x9')](_0xc212('0xa'),attributes,{'tableName':_0xc212('0xb'),'paranoid':![],'indexes':[{'name':_0xc212('0xc'),'fields':[_0xc212('0xd'),_0xc212('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb757=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','FieldId'];(function(_0x171fbf,_0x55e8a0){var _0x48b75f=function(_0x3de474){while(--_0x3de474){_0x171fbf['push'](_0x171fbf['shift']());}};_0x48b75f(++_0x55e8a0);}(_0xb757,0x1d4));var _0x7b75=function(_0x5cb06a,_0x49c88f){_0x5cb06a=_0x5cb06a-0x0;var _0xec4a93=_0xb757[_0x5cb06a];return _0xec4a93;};'use strict';var _=require(_0x7b75('0x0'));var util=require('util');var logger=require(_0x7b75('0x1'))(_0x7b75('0x2'));var moment=require(_0x7b75('0x3'));var BPromise=require(_0x7b75('0x4'));var rp=require(_0x7b75('0x5'));var fs=require('fs');var path=require(_0x7b75('0x6'));var rimraf=require(_0x7b75('0x7'));var config=require(_0x7b75('0x8'));var attributes=require(_0x7b75('0x9'));module[_0x7b75('0xa')]=function(_0x10be1b,_0x24efc3){return _0x10be1b['define']('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x7b75('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 36cdcb8..c832be4 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d2c=['jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x5c3ea5,_0xa9ed0c){_0x5c3ea5=_0x5c3ea5-0x0;var _0x102b61=_0x2d2c[_0x5c3ea5];return _0x102b61;};'use strict';var _=require(_0xc2d2('0x0'));var util=require(_0xc2d2('0x1'));var moment=require(_0xc2d2('0x2'));var BPromise=require(_0xc2d2('0x3'));var rs=require(_0xc2d2('0x4'));var fs=require('fs');var Redis=require(_0xc2d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2d2('0x6'));var logger=require('../../config/logger')(_0xc2d2('0x7'));var config=require(_0xc2d2('0x8'));var jayson=require(_0xc2d2('0x9'));var client=jayson[_0xc2d2('0xa')][_0xc2d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d2d3f,_0x54136b,_0x241c02){return new BPromise(function(_0x13c6c6,_0x2ebe63){return client[_0xc2d2('0xc')](_0x5d2d3f,_0x241c02)[_0xc2d2('0xd')](function(_0xf5fcf2){logger[_0xc2d2('0xe')](_0xc2d2('0xf'),_0x54136b,_0xc2d2('0x10'));logger[_0xc2d2('0x11')](_0xc2d2('0x12'),_0x54136b,_0xc2d2('0x10'),JSON['stringify'](_0xf5fcf2));if(_0xf5fcf2[_0xc2d2('0x13')]){if(_0xf5fcf2[_0xc2d2('0x13')][_0xc2d2('0x14')]===0x1f4){logger['error'](_0xc2d2('0xf'),_0x54136b,_0xf5fcf2[_0xc2d2('0x13')]['message']);return _0x2ebe63(_0xf5fcf2[_0xc2d2('0x13')][_0xc2d2('0x15')]);}logger['error'](_0xc2d2('0xf'),_0x54136b,_0xf5fcf2['error']['message']);return _0x13c6c6(_0xf5fcf2[_0xc2d2('0x13')][_0xc2d2('0x15')]);}else{logger[_0xc2d2('0xe')](_0xc2d2('0xf'),_0x54136b,_0xc2d2('0x10'));_0x13c6c6(_0xf5fcf2[_0xc2d2('0x16')][_0xc2d2('0x15')]);}})[_0xc2d2('0x17')](function(_0x34f5a9){logger[_0xc2d2('0x13')](_0xc2d2('0xf'),_0x54136b,_0x34f5a9);_0x2ebe63(_0x34f5a9);});});} \ No newline at end of file +var _0xf0f4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x10622d,_0xc8819e){var _0x48fa4c=function(_0x4ac8ee){while(--_0x4ac8ee){_0x10622d['push'](_0x10622d['shift']());}};_0x48fa4c(++_0xc8819e);}(_0xf0f4,0x182));var _0x4f0f=function(_0x2c0a48,_0x545473){_0x2c0a48=_0x2c0a48-0x0;var _0x56b65c=_0xf0f4[_0x2c0a48];return _0x56b65c;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47faf5,_0x39ad76,_0x1dd6bd){return new BPromise(function(_0x95b1cf,_0x5da92f){return client[_0x4f0f('0xa')](_0x47faf5,_0x1dd6bd)[_0x4f0f('0xb')](function(_0x19cecb){logger[_0x4f0f('0xc')](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));logger[_0x4f0f('0xf')](_0x4f0f('0x10'),_0x39ad76,'request\x20sent',JSON[_0x4f0f('0x11')](_0x19cecb));if(_0x19cecb[_0x4f0f('0x12')]){if(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x13')]===0x1f4){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x5da92f(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}logger[_0x4f0f('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x95b1cf(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}else{logger['info'](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));_0x95b1cf(_0x19cecb[_0x4f0f('0x15')][_0x4f0f('0x14')]);}})[_0x4f0f('0x16')](function(_0x5f171b){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x5f171b);_0x5da92f(_0x5f171b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 28731de..c117728 100644 --- a/server/api/intFreshdeskAccount/index.js +++ b/server/api/intFreshdeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32fb=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x32fb,0x1f0));var _0xb32f=function(_0x2840a5,_0x1444e4){_0x2840a5=_0x2840a5-0x0;var _0x43d2d5=_0x32fb[_0x2840a5];return _0x43d2d5;};'use strict';var multer=require(_0xb32f('0x0'));var util=require(_0xb32f('0x1'));var path=require(_0xb32f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb32f('0x3')]();var fs_extra=require(_0xb32f('0x4'));var auth=require(_0xb32f('0x5'));var interaction=require(_0xb32f('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xb32f('0x7')]('/',auth[_0xb32f('0x8')](),controller[_0xb32f('0x9')]);router[_0xb32f('0x7')](_0xb32f('0xa'),auth[_0xb32f('0x8')](),controller['show']);router[_0xb32f('0x7')](_0xb32f('0xb'),auth[_0xb32f('0x8')](),controller[_0xb32f('0xc')]);router[_0xb32f('0x7')](_0xb32f('0xd'),auth[_0xb32f('0x8')](),controller[_0xb32f('0xe')]);router[_0xb32f('0xf')]('/',auth[_0xb32f('0x8')](),controller[_0xb32f('0x10')]);router[_0xb32f('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb32f('0x11')]);router[_0xb32f('0x12')]('/:id',auth[_0xb32f('0x8')](),controller[_0xb32f('0x13')]);router[_0xb32f('0x14')](_0xb32f('0xa'),auth[_0xb32f('0x8')](),controller[_0xb32f('0x15')]);module[_0xb32f('0x16')]=router; \ No newline at end of file +var _0x2dd9=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x2dd9,0x78));var _0x92dd=function(_0x658709,_0x6d0e0f){_0x658709=_0x658709-0x0;var _0x3e034d=_0x2dd9[_0x658709];return _0x3e034d;};'use strict';var multer=require(_0x92dd('0x0'));var util=require(_0x92dd('0x1'));var path=require(_0x92dd('0x2'));var timeout=require(_0x92dd('0x3'));var express=require('express');var router=express[_0x92dd('0x4')]();var fs_extra=require(_0x92dd('0x5'));var auth=require(_0x92dd('0x6'));var interaction=require(_0x92dd('0x7'));var config=require(_0x92dd('0x8'));var controller=require(_0x92dd('0x9'));router[_0x92dd('0xa')]('/',auth['isAuthenticated'](),controller[_0x92dd('0xb')]);router[_0x92dd('0xa')](_0x92dd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x92dd('0xa')](_0x92dd('0xd'),auth[_0x92dd('0xe')](),controller[_0x92dd('0xf')]);router[_0x92dd('0xa')](_0x92dd('0x10'),auth[_0x92dd('0xe')](),controller[_0x92dd('0x11')]);router[_0x92dd('0x12')]('/',auth[_0x92dd('0xe')](),controller[_0x92dd('0x13')]);router['post'](_0x92dd('0xd'),auth[_0x92dd('0xe')](),controller[_0x92dd('0x14')]);router[_0x92dd('0x15')](_0x92dd('0xc'),auth[_0x92dd('0xe')](),controller[_0x92dd('0x16')]);router[_0x92dd('0x17')](_0x92dd('0xc'),auth[_0x92dd('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 33b71a1..d35fc6c 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63cd=['sequelize','exports','STRING','remoteUri'];(function(_0x5b4296,_0x48ca4f){var _0x59fe7c=function(_0x4092b6){while(--_0x4092b6){_0x5b4296['push'](_0x5b4296['shift']());}};_0x59fe7c(++_0x48ca4f);}(_0x63cd,0x16c));var _0xd63c=function(_0x1dd9d1,_0x820055){_0x1dd9d1=_0x1dd9d1-0x0;var _0x352f5d=_0x63cd[_0x1dd9d1];return _0x352f5d;};'use strict';var Sequelize=require(_0xd63c('0x0'));module[_0xd63c('0x1')]={'name':{'type':Sequelize[_0xd63c('0x2')]},'description':{'type':Sequelize[_0xd63c('0x2')]},'username':{'type':Sequelize[_0xd63c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xd63c('0x2')]},'remoteUri':{'type':Sequelize[_0xd63c('0x2')],'unique':_0xd63c('0x3')},'serverUrl':{'type':Sequelize[_0xd63c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3ecd=['STRING','remoteUri','sequelize','exports'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x3ecd,0x1d6));var _0xd3ec=function(_0x563512,_0x2f0c90){_0x563512=_0x563512-0x0;var _0xf9375c=_0x3ecd[_0x563512];return _0xf9375c;};'use strict';var Sequelize=require(_0xd3ec('0x0'));module[_0xd3ec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3ec('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0xd3ec('0x2')]},'remoteUri':{'type':Sequelize[_0xd3ec('0x2')],'unique':_0xd3ec('0x3')},'serverUrl':{'type':Sequelize[_0xd3ec('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 58ade5a..48229be 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94df=['Descriptions','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','description','priority','ticket_type','group','company','includes','default','custom_dropdown','label','capitalize','statusCode','getFields','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','count','set','Content-Range','apply','update','stack','name','render','merge','body','contact','agent','interaction','account','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','includeAll','include','rows','show','params','find','create','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField'];(function(_0x407d0f,_0x5cafa2){var _0xdeeb73=function(_0x476b28){while(--_0x476b28){_0x407d0f['push'](_0x407d0f['shift']());}};_0xdeeb73(++_0x5cafa2);}(_0x94df,0xa3));var _0xf94d=function(_0xeccf44,_0x525eb7){_0xeccf44=_0xeccf44-0x0;var _0x468b78=_0x94df[_0xeccf44];return _0x468b78;};'use strict';var emlformat=require(_0xf94d('0x0'));var rimraf=require(_0xf94d('0x1'));var zipdir=require(_0xf94d('0x2'));var jsonpatch=require(_0xf94d('0x3'));var rp=require(_0xf94d('0x4'));var moment=require(_0xf94d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf94d('0x6'));var util=require(_0xf94d('0x7'));var path=require(_0xf94d('0x8'));var sox=require(_0xf94d('0x9'));var csv=require(_0xf94d('0xa'));var ejs=require(_0xf94d('0xb'));var fs=require('fs');var fs_extra=require(_0xf94d('0xc'));var _=require(_0xf94d('0xd'));var squel=require(_0xf94d('0xe'));var crypto=require(_0xf94d('0xf'));var jsforce=require(_0xf94d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf94d('0xa'));var querystring=require(_0xf94d('0x11'));var Papa=require(_0xf94d('0x12'));var Redis=require(_0xf94d('0x13'));var authService=require(_0xf94d('0x14'));var qs=require(_0xf94d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf94d('0x16'));var logger=require(_0xf94d('0x17'))(_0xf94d('0x18'));var utils=require(_0xf94d('0x19'));var config=require(_0xf94d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf94d('0x1b'));var jayson=require(_0xf94d('0x1c'));var client=jayson[_0xf94d('0x1d')][_0xf94d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x186034,_0x381a5f,_0x509c69,_0x596da8){return new BPromise(function(_0x36ff94,_0x17234f){var _0x305c5f=_0x596da8||client;return _0x305c5f[_0xf94d('0x1f')](_0x186034,_0x509c69)[_0xf94d('0x20')](function(_0x14020b){logger[_0xf94d('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x381a5f,_0xf94d('0x22'));logger['debug'](_0xf94d('0x23'),_0x381a5f,'request\x20sent',JSON[_0xf94d('0x24')](_0x14020b));if(_0x14020b['error']){if(_0x14020b[_0xf94d('0x25')][_0xf94d('0x26')]===0x1f4){logger[_0xf94d('0x25')](_0xf94d('0x27'),_0x381a5f,_0x14020b['error'][_0xf94d('0x28')]);return _0x17234f(_0x14020b['error'][_0xf94d('0x28')]);}logger[_0xf94d('0x25')](_0xf94d('0x27'),_0x381a5f,_0x14020b[_0xf94d('0x25')]['message']);return _0x36ff94(_0x14020b[_0xf94d('0x25')]['message']);}else{logger[_0xf94d('0x21')](_0xf94d('0x27'),_0x381a5f,_0xf94d('0x22'));_0x36ff94(_0x14020b['result'][_0xf94d('0x28')]);}})[_0xf94d('0x29')](function(_0x2142a1){logger[_0xf94d('0x25')](_0xf94d('0x27'),_0x381a5f,_0x2142a1);_0x17234f(_0x2142a1);});});}function respondWithStatusCode(_0x533714,_0x301d2e){_0x301d2e=_0x301d2e||0xcc;return function(_0x51f7f8){if(_0x51f7f8){return _0x533714[_0xf94d('0x2a')](_0x301d2e);}return _0x533714[_0xf94d('0x2b')](_0x301d2e)[_0xf94d('0x2c')]();};}function respondWithResult(_0x6a2879,_0x997b6c){_0x997b6c=_0x997b6c||0xc8;return function(_0x1c4bdf){if(_0x1c4bdf){return _0x6a2879[_0xf94d('0x2b')](_0x997b6c)[_0xf94d('0x2d')](_0x1c4bdf);}};}function respondWithFilteredResult(_0x3c9fe3,_0x13c229){return function(_0x18ccd7){if(_0x18ccd7){var _0x4545b4=typeof _0x13c229[_0xf94d('0x2e')]==='undefined'&&typeof _0x13c229['limit']==='undefined';var _0x5e63bb=_0x18ccd7[_0xf94d('0x2f')];var _0x1e8242=_0x4545b4?0x0:_0x13c229['offset'];var _0x167585=_0x4545b4?_0x18ccd7[_0xf94d('0x2f')]:_0x13c229[_0xf94d('0x2e')]+_0x13c229['limit'];var _0x41b863;if(_0x167585>=_0x5e63bb){_0x167585=_0x5e63bb;_0x41b863=0xc8;}else{_0x41b863=0xce;}_0x3c9fe3['status'](_0x41b863);return _0x3c9fe3[_0xf94d('0x30')](_0xf94d('0x31'),_0x1e8242+'-'+_0x167585+'/'+_0x5e63bb)['json'](_0x18ccd7);}return null;};}function patchUpdates(_0x2378b0){return function(_0x4a0dd7){try{jsonpatch[_0xf94d('0x32')](_0x4a0dd7,_0x2378b0,!![]);}catch(_0x5ece47){return BPromise['reject'](_0x5ece47);}return _0x4a0dd7['save']();};}function saveUpdates(_0x20a270,_0x92e253){return function(_0x4b8b8f){if(_0x4b8b8f){return _0x4b8b8f[_0xf94d('0x33')](_0x20a270)['then'](function(_0x42a266){return _0x42a266;});}return null;};}function removeEntity(_0x251608,_0x56bfa4){return function(_0x458f27){if(_0x458f27){return _0x458f27['destroy']()[_0xf94d('0x20')](function(){_0x251608['status'](0xcc)[_0xf94d('0x2c')]();});}};}function handleEntityNotFound(_0x48c214,_0x3afb42){return function(_0x1ada36){if(!_0x1ada36){_0x48c214[_0xf94d('0x2a')](0x194);}return _0x1ada36;};}function handleError(_0x162163,_0x580939){_0x580939=_0x580939||0x1f4;return function(_0x5c9b2e){logger['error'](_0x5c9b2e[_0xf94d('0x34')]);if(_0x5c9b2e[_0xf94d('0x35')]){delete _0x5c9b2e[_0xf94d('0x35')];}_0x162163[_0xf94d('0x2b')](_0x580939)['send'](_0x5c9b2e);};}function getMustacheRender(_0x47efbc,_0x5db44c){return Mustache[_0xf94d('0x36')](_0x47efbc,_[_0xf94d('0x37')](_0x5db44c[_0xf94d('0x38')],{'contact':_0x5db44c[_0xf94d('0x39')],'message':_0x5db44c['message'],'agent':_0x5db44c[_0xf94d('0x3a')],'interaction':_0x5db44c[_0xf94d('0x3b')],'account':_0x5db44c[_0xf94d('0x3c')]}))||'';}exports[_0xf94d('0x3d')]=function(_0x565907,_0x446189){var _0x19d52={},_0x11e155={},_0x430d67={'count':0x0,'rows':[]};var _0x371110=_[_0xf94d('0x3e')](db[_0xf94d('0x3f')][_0xf94d('0x40')],function(_0xe9510e){return{'name':_0xe9510e[_0xf94d('0x41')],'type':_0xe9510e['type']['key']};});_0x11e155[_0xf94d('0x42')]=_['map'](_0x371110,_0xf94d('0x35'));_0x11e155['query']=_[_0xf94d('0x43')](_0x565907[_0xf94d('0x44')]);_0x11e155[_0xf94d('0x45')]=_[_0xf94d('0x46')](_0x11e155[_0xf94d('0x42')],_0x11e155['query']);_0x19d52[_0xf94d('0x47')]=_['intersection'](_0x11e155[_0xf94d('0x42')],qs['fields'](_0x565907[_0xf94d('0x44')][_0xf94d('0x48')]));_0x19d52[_0xf94d('0x47')]=_0x19d52[_0xf94d('0x47')][_0xf94d('0x49')]?_0x19d52[_0xf94d('0x47')]:_0x11e155[_0xf94d('0x42')];if(!_0x565907['query'][_0xf94d('0x4a')](_0xf94d('0x4b'))){_0x19d52[_0xf94d('0x4c')]=qs['limit'](_0x565907[_0xf94d('0x44')][_0xf94d('0x4c')]);_0x19d52[_0xf94d('0x2e')]=qs[_0xf94d('0x2e')](_0x565907[_0xf94d('0x44')][_0xf94d('0x2e')]);}_0x19d52[_0xf94d('0x4d')]=qs['sort'](_0x565907[_0xf94d('0x44')][_0xf94d('0x4e')]);_0x19d52[_0xf94d('0x4f')]=qs[_0xf94d('0x45')](_[_0xf94d('0x50')](_0x565907[_0xf94d('0x44')],_0x11e155['filters']),_0x371110);if(_0x565907['query'][_0xf94d('0x51')]){_0x19d52[_0xf94d('0x4f')]=_[_0xf94d('0x37')](_0x19d52[_0xf94d('0x4f')],{'$or':_[_0xf94d('0x3e')](_0x371110,function(_0x568036){if(_0x568036[_0xf94d('0x52')]!=='VIRTUAL'){var _0x319255={};_0x319255[_0x568036[_0xf94d('0x35')]]={'$like':'%'+_0x565907[_0xf94d('0x44')][_0xf94d('0x51')]+'%'};return _0x319255;}})});}_0x19d52=_[_0xf94d('0x37')]({},_0x19d52,_0x565907['options']);var _0x1c2247={'where':_0x19d52[_0xf94d('0x4f')]};return db[_0xf94d('0x3f')][_0xf94d('0x2f')](_0x1c2247)['then'](function(_0x159fb8){_0x430d67['count']=_0x159fb8;if(_0x565907['query'][_0xf94d('0x53')]){_0x19d52[_0xf94d('0x54')]=[{'all':!![]}];}return db[_0xf94d('0x3f')]['findAll'](_0x19d52);})[_0xf94d('0x20')](function(_0x560a26){_0x430d67[_0xf94d('0x55')]=_0x560a26;return _0x430d67;})[_0xf94d('0x20')](respondWithFilteredResult(_0x446189,_0x19d52))[_0xf94d('0x29')](handleError(_0x446189,null));};exports[_0xf94d('0x56')]=function(_0x1c0fbc,_0x24aceb){var _0x5c18f0={'raw':![],'where':{'id':_0x1c0fbc[_0xf94d('0x57')]['id']}},_0x213c7={};_0x213c7[_0xf94d('0x42')]=_[_0xf94d('0x43')](db['FreshdeskAccount'][_0xf94d('0x40')]);_0x213c7['query']=_[_0xf94d('0x43')](_0x1c0fbc['query']);_0x213c7[_0xf94d('0x45')]=_[_0xf94d('0x46')](_0x213c7[_0xf94d('0x42')],_0x213c7[_0xf94d('0x44')]);_0x5c18f0[_0xf94d('0x47')]=_['intersection'](_0x213c7['model'],qs[_0xf94d('0x48')](_0x1c0fbc[_0xf94d('0x44')][_0xf94d('0x48')]));_0x5c18f0[_0xf94d('0x47')]=_0x5c18f0[_0xf94d('0x47')][_0xf94d('0x49')]?_0x5c18f0['attributes']:_0x213c7[_0xf94d('0x42')];if(_0x1c0fbc[_0xf94d('0x44')][_0xf94d('0x53')]){_0x5c18f0[_0xf94d('0x54')]=[{'all':!![]}];}_0x5c18f0=_['merge']({},_0x5c18f0,_0x1c0fbc['options']);return db[_0xf94d('0x3f')][_0xf94d('0x58')](_0x5c18f0)[_0xf94d('0x20')](handleEntityNotFound(_0x24aceb,null))['then'](respondWithResult(_0x24aceb,null))[_0xf94d('0x29')](handleError(_0x24aceb,null));};exports[_0xf94d('0x59')]=function(_0xf716d1,_0x21f188){return db[_0xf94d('0x3f')][_0xf94d('0x59')](_0xf716d1[_0xf94d('0x38')],{})[_0xf94d('0x20')](respondWithResult(_0x21f188,0xc9))[_0xf94d('0x29')](handleError(_0x21f188,null));};exports['update']=function(_0x138089,_0x5d397d){if(_0x138089[_0xf94d('0x38')]['id']){delete _0x138089['body']['id'];}return db[_0xf94d('0x3f')][_0xf94d('0x58')]({'where':{'id':_0x138089[_0xf94d('0x57')]['id']}})['then'](handleEntityNotFound(_0x5d397d,null))[_0xf94d('0x20')](saveUpdates(_0x138089[_0xf94d('0x38')],null))[_0xf94d('0x20')](respondWithResult(_0x5d397d,null))[_0xf94d('0x29')](handleError(_0x5d397d,null));};exports['destroy']=function(_0x4bbbea,_0x35411b){return db['FreshdeskAccount']['find']({'where':{'id':_0x4bbbea[_0xf94d('0x57')]['id']}})[_0xf94d('0x20')](handleEntityNotFound(_0x35411b,null))['then'](removeEntity(_0x35411b,null))[_0xf94d('0x29')](handleError(_0x35411b,null));};exports['getConfigurations']=function(_0x5121ed,_0x5d6af6,_0xd0f734){var _0x4fe495={};var _0x2a1f61={};var _0x5caa6e;var _0x54f0c4;return db['FreshdeskAccount'][_0xf94d('0x5a')]({'where':{'id':_0x5121ed['params']['id']}})['then'](handleEntityNotFound(_0x5d6af6,null))[_0xf94d('0x20')](function(_0x5dff88){if(_0x5dff88){_0x5caa6e=_0x5dff88;_0x2a1f61[_0xf94d('0x42')]=_[_0xf94d('0x43')](db['FreshdeskConfiguration'][_0xf94d('0x40')]);_0x2a1f61['query']=_['keys'](_0x5121ed[_0xf94d('0x44')]);_0x2a1f61['filters']=_[_0xf94d('0x46')](_0x2a1f61[_0xf94d('0x42')],_0x2a1f61[_0xf94d('0x44')]);_0x4fe495[_0xf94d('0x47')]=_['intersection'](_0x2a1f61[_0xf94d('0x42')],qs[_0xf94d('0x48')](_0x5121ed[_0xf94d('0x44')][_0xf94d('0x48')]));_0x4fe495[_0xf94d('0x47')]=_0x4fe495[_0xf94d('0x47')]['length']?_0x4fe495[_0xf94d('0x47')]:_0x2a1f61[_0xf94d('0x42')];_0x4fe495[_0xf94d('0x4d')]=qs[_0xf94d('0x4e')](_0x5121ed[_0xf94d('0x44')]['sort']);_0x4fe495[_0xf94d('0x4f')]=qs[_0xf94d('0x45')](_[_0xf94d('0x50')](_0x5121ed[_0xf94d('0x44')],_0x2a1f61['filters']));if(_0x5121ed[_0xf94d('0x44')][_0xf94d('0x51')]){_0x4fe495[_0xf94d('0x4f')]=_[_0xf94d('0x37')](_0x4fe495[_0xf94d('0x4f')],{'$or':_[_0xf94d('0x3e')](_0x4fe495[_0xf94d('0x47')],function(_0x25faca){var _0x170a3f={};_0x170a3f[_0x25faca]={'$like':'%'+_0x5121ed[_0xf94d('0x44')][_0xf94d('0x51')]+'%'};return _0x170a3f;})});}_0x4fe495=_[_0xf94d('0x37')]({},_0x4fe495,_0x5121ed[_0xf94d('0x5b')]);return _0x5caa6e[_0xf94d('0x5c')](_0x4fe495);}})[_0xf94d('0x20')](function(_0x663aed){if(_0x663aed){_0x54f0c4=_0x663aed[_0xf94d('0x49')];if(!_0x5121ed[_0xf94d('0x44')][_0xf94d('0x4a')](_0xf94d('0x4b'))){_0x4fe495[_0xf94d('0x4c')]=qs[_0xf94d('0x4c')](_0x5121ed[_0xf94d('0x44')]['limit']);_0x4fe495['offset']=qs[_0xf94d('0x2e')](_0x5121ed[_0xf94d('0x44')][_0xf94d('0x2e')]);}return _0x5caa6e[_0xf94d('0x5c')](_0x4fe495);}})['then'](function(_0x203e5e){if(_0x203e5e){return _0x203e5e?{'count':_0x54f0c4,'rows':_0x203e5e}:null;}})[_0xf94d('0x20')](respondWithResult(_0x5d6af6,null))['catch'](handleError(_0x5d6af6,null));};exports[_0xf94d('0x5d')]=function(_0x5dca3e,_0x4383dd,_0xa20522){if(_0x5dca3e[_0xf94d('0x38')]['id']){delete _0x5dca3e[_0xf94d('0x38')]['id'];}return db[_0xf94d('0x3f')][_0xf94d('0x5a')]({'where':{'id':_0x5dca3e[_0xf94d('0x57')]['id']}})[_0xf94d('0x20')](handleEntityNotFound(_0x4383dd,null))['then'](function(_0x20551b){if(_0x20551b){_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x5e')]=_0x20551b['id'];_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x5f')]=integrations[_0xf94d('0x60')](_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x61')],_0x5dca3e['body'][_0xf94d('0x52')]);_0x5dca3e[_0xf94d('0x38')]['Descriptions']=integrations[_0xf94d('0x62')](_0x5dca3e[_0xf94d('0x38')][_0xf94d('0x61')],_0x5dca3e['body']['type']);return db[_0xf94d('0x63')][_0xf94d('0x59')](_0x5dca3e[_0xf94d('0x38')],{'include':[{'model':db[_0xf94d('0x64')],'as':'Subjects'},{'model':db[_0xf94d('0x64')],'as':_0xf94d('0x65')}]});}return null;})[_0xf94d('0x20')](respondWithResult(_0x4383dd,null))[_0xf94d('0x29')](handleError(_0x4383dd,null));};exports['getFields']=function(_0x2445e1,_0x19f9ff,_0x4e5011){var _0x42fbc4='';return db[_0xf94d('0x3f')]['findOne']({'where':{'id':_0x2445e1[_0xf94d('0x57')]['id']},'attributes':['id',_0xf94d('0x66'),'apiKey']})[_0xf94d('0x20')](handleEntityNotFound(_0x19f9ff,null))['then'](function(_0x19cad4){if(_0x19cad4){_0x42fbc4=_0x19cad4[_0xf94d('0x66')];var _0x27329a=_0x42fbc4[_0xf94d('0x67')](-0x1);if(_0x27329a==='/'){_0x42fbc4=_0x42fbc4[_0xf94d('0x68')](0x0,_0x42fbc4[_0xf94d('0x69')](_0x27329a));}return rp({'method':_0xf94d('0x6a'),'uri':util[_0xf94d('0x6b')](_0xf94d('0x6c'),_0x42fbc4,_0xf94d('0x6d')),'headers':{'Authorization':util[_0xf94d('0x6b')](_0xf94d('0x6e'),new Buffer(util['format'](_0xf94d('0x6f'),_0x19cad4[_0xf94d('0x70')]))[_0xf94d('0x71')](_0xf94d('0x72')))},'json':!![]});}})[_0xf94d('0x20')](function(_0x212e6d){if(_0x212e6d){var _0x2f7b93=[_0xf94d('0x73'),_0xf94d('0x74'),_0xf94d('0x3a'),_0xf94d('0x75'),_0xf94d('0x2b'),_0xf94d('0x76'),'group','source',_0xf94d('0x77'),_0xf94d('0x78'),_0xf94d('0x79')];_['remove'](_0x212e6d,function(_0x5ce347){return _0x2f7b93[_0xf94d('0x7a')](_0x5ce347[_0xf94d('0x35')])||!_0x5ce347[_0xf94d('0x7b')]&&_0x5ce347[_0xf94d('0x52')]!=='custom_text'&&_0x5ce347['type']!==_0xf94d('0x7c');});return{'count':_0x212e6d[_0xf94d('0x49')],'rows':_[_0xf94d('0x3e')](_0x212e6d,function(_0x2f0881){return{'id':_0x2f0881[_0xf94d('0x35')],'name':_0x2f0881[_0xf94d('0x7d')],'custom':!_0x2f0881[_0xf94d('0x7b')],'options':_0x2f0881['choices']?_['map'](_0x2f0881['choices'],function(_0x3860ee){return{'name':_[_0xf94d('0x7e')](_0x3860ee),'value':_0x3860ee};}):[]};})};}})[_0xf94d('0x20')](respondWithResult(_0x19f9ff,null))[_0xf94d('0x29')](function(_0x80ec55){var _0x4025c9=_0x2445e1[_0xf94d('0x44')]['test']?0x1f4:_0x80ec55[_0xf94d('0x7f')]||0x1f4;logger[_0xf94d('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xf94d('0x80'),_0x4025c9,JSON[_0xf94d('0x24')](_0x80ec55));delete _0x80ec55[_0xf94d('0x35')];if(_0x4025c9===0x191){_0x4025c9=0x190;}_0x19f9ff[_0xf94d('0x2b')](_0x4025c9)[_0xf94d('0x81')](_0x2445e1[_0xf94d('0x44')][_0xf94d('0x82')]?{'message':_0xf94d('0x83'),'statusCode':_0x80ec55[_0xf94d('0x7f')]}:_0x80ec55);});}; \ No newline at end of file +var _0x063c=['name','send','merge','body','contact','agent','interaction','account','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','apiKey','requester','subject','priority','group','source','ticket_type','remove','default','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x063c,0xba));var _0xc063=function(_0x313516,_0x3c096c){_0x313516=_0x313516-0x0;var _0x6e127c=_0x063c[_0x313516];return _0x6e127c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc063('0x0'));var zipdir=require(_0xc063('0x1'));var jsonpatch=require(_0xc063('0x2'));var rp=require(_0xc063('0x3'));var moment=require(_0xc063('0x4'));var BPromise=require(_0xc063('0x5'));var Mustache=require('mustache');var util=require(_0xc063('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc063('0x7'));var fs=require('fs');var fs_extra=require(_0xc063('0x8'));var _=require('lodash');var squel=require(_0xc063('0x9'));var crypto=require(_0xc063('0xa'));var jsforce=require(_0xc063('0xb'));var deskjs=require(_0xc063('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc063('0xd'));var Papa=require(_0xc063('0xe'));var Redis=require('ioredis');var authService=require(_0xc063('0xf'));var qs=require(_0xc063('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc063('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc063('0x12'));var licenseUtil=require(_0xc063('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc063('0x14'));var jayson=require('jayson/promise');var client=jayson[_0xc063('0x15')][_0xc063('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2f2816,_0x531f14,_0x364264,_0x1249b2){return new BPromise(function(_0x21b8da,_0x1fb110){var _0x332689=_0x1249b2||client;return _0x332689[_0xc063('0x17')](_0x2f2816,_0x364264)[_0xc063('0x18')](function(_0xac1724){logger[_0xc063('0x19')]('FreshdeskAccount,\x20%s,\x20%s',_0x531f14,_0xc063('0x1a'));logger[_0xc063('0x1b')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x531f14,_0xc063('0x1a'),JSON[_0xc063('0x1c')](_0xac1724));if(_0xac1724['error']){if(_0xac1724[_0xc063('0x1d')][_0xc063('0x1e')]===0x1f4){logger[_0xc063('0x1d')](_0xc063('0x1f'),_0x531f14,_0xac1724['error'][_0xc063('0x20')]);return _0x1fb110(_0xac1724[_0xc063('0x1d')][_0xc063('0x20')]);}logger['error'](_0xc063('0x1f'),_0x531f14,_0xac1724[_0xc063('0x1d')]['message']);return _0x21b8da(_0xac1724[_0xc063('0x1d')][_0xc063('0x20')]);}else{logger[_0xc063('0x19')](_0xc063('0x1f'),_0x531f14,_0xc063('0x1a'));_0x21b8da(_0xac1724['result']['message']);}})['catch'](function(_0x2a6d90){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x531f14,_0x2a6d90);_0x1fb110(_0x2a6d90);});});}function respondWithStatusCode(_0x481a6b,_0x382f79){_0x382f79=_0x382f79||0xcc;return function(_0x3e1040){if(_0x3e1040){return _0x481a6b[_0xc063('0x21')](_0x382f79);}return _0x481a6b[_0xc063('0x22')](_0x382f79)[_0xc063('0x23')]();};}function respondWithResult(_0x49f26e,_0x5a0d10){_0x5a0d10=_0x5a0d10||0xc8;return function(_0x7317e7){if(_0x7317e7){return _0x49f26e['status'](_0x5a0d10)[_0xc063('0x24')](_0x7317e7);}};}function respondWithFilteredResult(_0x43e592,_0x7db21a){return function(_0x93a4b1){if(_0x93a4b1){var _0x3bb999=typeof _0x7db21a[_0xc063('0x25')]===_0xc063('0x26')&&typeof _0x7db21a[_0xc063('0x27')]==='undefined';var _0x3a8663=_0x93a4b1[_0xc063('0x28')];var _0x5a623d=_0x3bb999?0x0:_0x7db21a[_0xc063('0x25')];var _0x3359cd=_0x3bb999?_0x93a4b1[_0xc063('0x28')]:_0x7db21a[_0xc063('0x25')]+_0x7db21a[_0xc063('0x27')];var _0x4e1e37;if(_0x3359cd>=_0x3a8663){_0x3359cd=_0x3a8663;_0x4e1e37=0xc8;}else{_0x4e1e37=0xce;}_0x43e592[_0xc063('0x22')](_0x4e1e37);return _0x43e592[_0xc063('0x29')]('Content-Range',_0x5a623d+'-'+_0x3359cd+'/'+_0x3a8663)['json'](_0x93a4b1);}return null;};}function patchUpdates(_0x5b0ed3){return function(_0x1bb941){try{jsonpatch['apply'](_0x1bb941,_0x5b0ed3,!![]);}catch(_0x391cef){return BPromise[_0xc063('0x2a')](_0x391cef);}return _0x1bb941[_0xc063('0x2b')]();};}function saveUpdates(_0x370f25,_0x5a1615){return function(_0x42940c){if(_0x42940c){return _0x42940c[_0xc063('0x2c')](_0x370f25)[_0xc063('0x18')](function(_0x5662d0){return _0x5662d0;});}return null;};}function removeEntity(_0x148e61,_0x4abb18){return function(_0x3e275e){if(_0x3e275e){return _0x3e275e[_0xc063('0x2d')]()['then'](function(){_0x148e61['status'](0xcc)[_0xc063('0x23')]();});}};}function handleEntityNotFound(_0x48395b,_0x9f3c15){return function(_0x70ed91){if(!_0x70ed91){_0x48395b[_0xc063('0x21')](0x194);}return _0x70ed91;};}function handleError(_0x492d58,_0x4e1bbe){_0x4e1bbe=_0x4e1bbe||0x1f4;return function(_0x584e44){logger[_0xc063('0x1d')](_0x584e44['stack']);if(_0x584e44[_0xc063('0x2e')]){delete _0x584e44['name'];}_0x492d58[_0xc063('0x22')](_0x4e1bbe)[_0xc063('0x2f')](_0x584e44);};}function getMustacheRender(_0x23fda1,_0x243e5f){return Mustache['render'](_0x23fda1,_[_0xc063('0x30')](_0x243e5f[_0xc063('0x31')],{'contact':_0x243e5f[_0xc063('0x32')],'message':_0x243e5f['message'],'agent':_0x243e5f[_0xc063('0x33')],'interaction':_0x243e5f[_0xc063('0x34')],'account':_0x243e5f[_0xc063('0x35')]}))||'';}exports[_0xc063('0x36')]=function(_0x364aa4,_0x281e07){var _0x3336b7={},_0x2ce6a8={},_0x1a775c={'count':0x0,'rows':[]};var _0x23414e=_['map'](db[_0xc063('0x37')][_0xc063('0x38')],function(_0x37ad4e){return{'name':_0x37ad4e[_0xc063('0x39')],'type':_0x37ad4e[_0xc063('0x3a')][_0xc063('0x3b')]};});_0x2ce6a8[_0xc063('0x3c')]=_[_0xc063('0x3d')](_0x23414e,'name');_0x2ce6a8['query']=_['keys'](_0x364aa4['query']);_0x2ce6a8[_0xc063('0x3e')]=_[_0xc063('0x3f')](_0x2ce6a8[_0xc063('0x3c')],_0x2ce6a8[_0xc063('0x40')]);_0x3336b7[_0xc063('0x41')]=_[_0xc063('0x3f')](_0x2ce6a8[_0xc063('0x3c')],qs[_0xc063('0x42')](_0x364aa4['query'][_0xc063('0x42')]));_0x3336b7[_0xc063('0x41')]=_0x3336b7[_0xc063('0x41')][_0xc063('0x43')]?_0x3336b7[_0xc063('0x41')]:_0x2ce6a8['model'];if(!_0x364aa4['query']['hasOwnProperty'](_0xc063('0x44'))){_0x3336b7[_0xc063('0x27')]=qs[_0xc063('0x27')](_0x364aa4[_0xc063('0x40')][_0xc063('0x27')]);_0x3336b7[_0xc063('0x25')]=qs[_0xc063('0x25')](_0x364aa4[_0xc063('0x40')]['offset']);}_0x3336b7[_0xc063('0x45')]=qs[_0xc063('0x46')](_0x364aa4['query'][_0xc063('0x46')]);_0x3336b7[_0xc063('0x47')]=qs['filters'](_[_0xc063('0x48')](_0x364aa4[_0xc063('0x40')],_0x2ce6a8[_0xc063('0x3e')]),_0x23414e);if(_0x364aa4[_0xc063('0x40')]['filter']){_0x3336b7[_0xc063('0x47')]=_[_0xc063('0x30')](_0x3336b7[_0xc063('0x47')],{'$or':_['map'](_0x23414e,function(_0x48da17){if(_0x48da17[_0xc063('0x3a')]!==_0xc063('0x49')){var _0x11cc18={};_0x11cc18[_0x48da17[_0xc063('0x2e')]]={'$like':'%'+_0x364aa4[_0xc063('0x40')]['filter']+'%'};return _0x11cc18;}})});}_0x3336b7=_[_0xc063('0x30')]({},_0x3336b7,_0x364aa4[_0xc063('0x4a')]);var _0x4008e6={'where':_0x3336b7[_0xc063('0x47')]};return db['FreshdeskAccount'][_0xc063('0x28')](_0x4008e6)[_0xc063('0x18')](function(_0x5f4260){_0x1a775c[_0xc063('0x28')]=_0x5f4260;if(_0x364aa4['query'][_0xc063('0x4b')]){_0x3336b7[_0xc063('0x4c')]=[{'all':!![]}];}return db[_0xc063('0x37')][_0xc063('0x4d')](_0x3336b7);})['then'](function(_0x356345){_0x1a775c[_0xc063('0x4e')]=_0x356345;return _0x1a775c;})[_0xc063('0x18')](respondWithFilteredResult(_0x281e07,_0x3336b7))[_0xc063('0x4f')](handleError(_0x281e07,null));};exports[_0xc063('0x50')]=function(_0x47ba3d,_0x29df07){var _0x4865d7={'raw':![],'where':{'id':_0x47ba3d[_0xc063('0x51')]['id']}},_0x2b6670={};_0x2b6670[_0xc063('0x3c')]=_[_0xc063('0x52')](db[_0xc063('0x37')][_0xc063('0x38')]);_0x2b6670[_0xc063('0x40')]=_[_0xc063('0x52')](_0x47ba3d[_0xc063('0x40')]);_0x2b6670[_0xc063('0x3e')]=_['intersection'](_0x2b6670['model'],_0x2b6670[_0xc063('0x40')]);_0x4865d7[_0xc063('0x41')]=_[_0xc063('0x3f')](_0x2b6670[_0xc063('0x3c')],qs['fields'](_0x47ba3d[_0xc063('0x40')][_0xc063('0x42')]));_0x4865d7[_0xc063('0x41')]=_0x4865d7[_0xc063('0x41')][_0xc063('0x43')]?_0x4865d7[_0xc063('0x41')]:_0x2b6670['model'];if(_0x47ba3d['query'][_0xc063('0x4b')]){_0x4865d7[_0xc063('0x4c')]=[{'all':!![]}];}_0x4865d7=_[_0xc063('0x30')]({},_0x4865d7,_0x47ba3d[_0xc063('0x4a')]);return db[_0xc063('0x37')][_0xc063('0x53')](_0x4865d7)[_0xc063('0x18')](handleEntityNotFound(_0x29df07,null))[_0xc063('0x18')](respondWithResult(_0x29df07,null))[_0xc063('0x4f')](handleError(_0x29df07,null));};exports[_0xc063('0x54')]=function(_0x1813be,_0x2fa6d3){return db['FreshdeskAccount'][_0xc063('0x54')](_0x1813be[_0xc063('0x31')],{})['then'](respondWithResult(_0x2fa6d3,0xc9))[_0xc063('0x4f')](handleError(_0x2fa6d3,null));};exports['update']=function(_0x153262,_0x3c08ba){if(_0x153262[_0xc063('0x31')]['id']){delete _0x153262['body']['id'];}return db[_0xc063('0x37')]['find']({'where':{'id':_0x153262[_0xc063('0x51')]['id']}})[_0xc063('0x18')](handleEntityNotFound(_0x3c08ba,null))[_0xc063('0x18')](saveUpdates(_0x153262[_0xc063('0x31')],null))[_0xc063('0x18')](respondWithResult(_0x3c08ba,null))[_0xc063('0x4f')](handleError(_0x3c08ba,null));};exports[_0xc063('0x2d')]=function(_0xf1824d,_0x5df57e){return db[_0xc063('0x37')][_0xc063('0x53')]({'where':{'id':_0xf1824d['params']['id']}})['then'](handleEntityNotFound(_0x5df57e,null))[_0xc063('0x18')](removeEntity(_0x5df57e,null))[_0xc063('0x4f')](handleError(_0x5df57e,null));};exports[_0xc063('0x55')]=function(_0x93f286,_0x157a48,_0x390239){var _0x5ad317={};var _0x2e5222={};var _0x2b051e;var _0x19381d;return db[_0xc063('0x37')][_0xc063('0x56')]({'where':{'id':_0x93f286[_0xc063('0x51')]['id']}})[_0xc063('0x18')](handleEntityNotFound(_0x157a48,null))[_0xc063('0x18')](function(_0xa20a43){if(_0xa20a43){_0x2b051e=_0xa20a43;_0x2e5222[_0xc063('0x3c')]=_[_0xc063('0x52')](db[_0xc063('0x57')]['rawAttributes']);_0x2e5222[_0xc063('0x40')]=_[_0xc063('0x52')](_0x93f286['query']);_0x2e5222['filters']=_[_0xc063('0x3f')](_0x2e5222[_0xc063('0x3c')],_0x2e5222[_0xc063('0x40')]);_0x5ad317[_0xc063('0x41')]=_['intersection'](_0x2e5222[_0xc063('0x3c')],qs[_0xc063('0x42')](_0x93f286[_0xc063('0x40')][_0xc063('0x42')]));_0x5ad317[_0xc063('0x41')]=_0x5ad317[_0xc063('0x41')][_0xc063('0x43')]?_0x5ad317['attributes']:_0x2e5222[_0xc063('0x3c')];_0x5ad317[_0xc063('0x45')]=qs[_0xc063('0x46')](_0x93f286[_0xc063('0x40')][_0xc063('0x46')]);_0x5ad317[_0xc063('0x47')]=qs[_0xc063('0x3e')](_[_0xc063('0x48')](_0x93f286['query'],_0x2e5222[_0xc063('0x3e')]));if(_0x93f286[_0xc063('0x40')]['filter']){_0x5ad317[_0xc063('0x47')]=_['merge'](_0x5ad317[_0xc063('0x47')],{'$or':_[_0xc063('0x3d')](_0x5ad317[_0xc063('0x41')],function(_0x51a8b6){var _0x30d202={};_0x30d202[_0x51a8b6]={'$like':'%'+_0x93f286['query']['filter']+'%'};return _0x30d202;})});}_0x5ad317=_[_0xc063('0x30')]({},_0x5ad317,_0x93f286[_0xc063('0x4a')]);return _0x2b051e[_0xc063('0x55')](_0x5ad317);}})[_0xc063('0x18')](function(_0x153408){if(_0x153408){_0x19381d=_0x153408[_0xc063('0x43')];if(!_0x93f286[_0xc063('0x40')]['hasOwnProperty'](_0xc063('0x44'))){_0x5ad317[_0xc063('0x27')]=qs[_0xc063('0x27')](_0x93f286[_0xc063('0x40')][_0xc063('0x27')]);_0x5ad317['offset']=qs[_0xc063('0x25')](_0x93f286[_0xc063('0x40')][_0xc063('0x25')]);}return _0x2b051e['getConfigurations'](_0x5ad317);}})[_0xc063('0x18')](function(_0x26fa1a){if(_0x26fa1a){return _0x26fa1a?{'count':_0x19381d,'rows':_0x26fa1a}:null;}})[_0xc063('0x18')](respondWithResult(_0x157a48,null))['catch'](handleError(_0x157a48,null));};exports[_0xc063('0x58')]=function(_0x14071e,_0x3091a5,_0x10b187){if(_0x14071e[_0xc063('0x31')]['id']){delete _0x14071e[_0xc063('0x31')]['id'];}return db[_0xc063('0x37')][_0xc063('0x56')]({'where':{'id':_0x14071e['params']['id']}})[_0xc063('0x18')](handleEntityNotFound(_0x3091a5,null))[_0xc063('0x18')](function(_0x1075bb){if(_0x1075bb){_0x14071e[_0xc063('0x31')]['AccountId']=_0x1075bb['id'];_0x14071e[_0xc063('0x31')][_0xc063('0x59')]=integrations['getSubjects'](_0x14071e[_0xc063('0x31')][_0xc063('0x5a')],_0x14071e[_0xc063('0x31')][_0xc063('0x3a')]);_0x14071e[_0xc063('0x31')]['Descriptions']=integrations['getDescriptions'](_0x14071e[_0xc063('0x31')]['channel'],_0x14071e[_0xc063('0x31')]['type']);return db[_0xc063('0x57')][_0xc063('0x54')](_0x14071e['body'],{'include':[{'model':db[_0xc063('0x5b')],'as':_0xc063('0x59')},{'model':db[_0xc063('0x5b')],'as':_0xc063('0x5c')}]});}return null;})[_0xc063('0x18')](respondWithResult(_0x3091a5,null))[_0xc063('0x4f')](handleError(_0x3091a5,null));};exports[_0xc063('0x5d')]=function(_0x5542bc,_0x3c70c8,_0x513725){var _0x57cc3a='';return db['FreshdeskAccount'][_0xc063('0x56')]({'where':{'id':_0x5542bc[_0xc063('0x51')]['id']},'attributes':['id',_0xc063('0x5e'),'apiKey']})[_0xc063('0x18')](handleEntityNotFound(_0x3c70c8,null))[_0xc063('0x18')](function(_0x458044){if(_0x458044){_0x57cc3a=_0x458044[_0xc063('0x5e')];var _0x15cfe3=_0x57cc3a[_0xc063('0x5f')](-0x1);if(_0x15cfe3==='/'){_0x57cc3a=_0x57cc3a[_0xc063('0x60')](0x0,_0x57cc3a['lastIndexOf'](_0x15cfe3));}return rp({'method':_0xc063('0x61'),'uri':util[_0xc063('0x62')](_0xc063('0x63'),_0x57cc3a,_0xc063('0x64')),'headers':{'Authorization':util[_0xc063('0x62')](_0xc063('0x65'),new Buffer(util[_0xc063('0x62')]('%s:X',_0x458044[_0xc063('0x66')]))['toString']('base64'))},'json':!![]});}})[_0xc063('0x18')](function(_0x155aac){if(_0x155aac){var _0xee3766=[_0xc063('0x67'),_0xc063('0x68'),_0xc063('0x33'),'description',_0xc063('0x22'),_0xc063('0x69'),_0xc063('0x6a'),_0xc063('0x6b'),_0xc063('0x6c'),_0xc063('0x6a'),'company'];_[_0xc063('0x6d')](_0x155aac,function(_0x20c4f1){return _0xee3766['includes'](_0x20c4f1[_0xc063('0x2e')])||!_0x20c4f1[_0xc063('0x6e')]&&_0x20c4f1[_0xc063('0x3a')]!=='custom_text'&&_0x20c4f1[_0xc063('0x3a')]!=='custom_dropdown';});return{'count':_0x155aac[_0xc063('0x43')],'rows':_['map'](_0x155aac,function(_0x4a0d92){return{'id':_0x4a0d92[_0xc063('0x2e')],'name':_0x4a0d92[_0xc063('0x6f')],'custom':!_0x4a0d92['default'],'options':_0x4a0d92[_0xc063('0x70')]?_[_0xc063('0x3d')](_0x4a0d92['choices'],function(_0xd5b6b1){return{'name':_['capitalize'](_0xd5b6b1),'value':_0xd5b6b1};}):[]};})};}})[_0xc063('0x18')](respondWithResult(_0x3c70c8,null))[_0xc063('0x4f')](function(_0x42884e){var _0x53d711=_0x5542bc[_0xc063('0x40')][_0xc063('0x71')]?0x1f4:_0x42884e[_0xc063('0x72')]||0x1f4;logger[_0xc063('0x1d')](_0xc063('0x73'),'getFields',_0x53d711,JSON[_0xc063('0x1c')](_0x42884e));delete _0x42884e[_0xc063('0x2e')];if(_0x53d711===0x191){_0x53d711=0x190;}_0x3c70c8[_0xc063('0x22')](_0x53d711)[_0xc063('0x2f')](_0x5542bc[_0xc063('0x40')][_0xc063('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x42884e[_0xc063('0x72')]}:_0x42884e);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f72be99..b3616c0 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3261=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x261b7e,_0x4f830a){var _0x5c4ff8=function(_0x262093){while(--_0x262093){_0x261b7e['push'](_0x261b7e['shift']());}};_0x5c4ff8(++_0x4f830a);}(_0x3261,0xbb));var _0x1326=function(_0x249d21,_0x1e9ae4){_0x249d21=_0x249d21-0x0;var _0x44e285=_0x3261[_0x249d21];return _0x44e285;};'use strict';var _=require(_0x1326('0x0'));var util=require(_0x1326('0x1'));var logger=require(_0x1326('0x2'))('api');var moment=require(_0x1326('0x3'));var BPromise=require(_0x1326('0x4'));var rp=require(_0x1326('0x5'));var fs=require('fs');var path=require(_0x1326('0x6'));var rimraf=require(_0x1326('0x7'));var config=require(_0x1326('0x8'));var attributes=require(_0x1326('0x9'));var integrations=require(_0x1326('0xa'));module['exports']=function(_0x259603,_0x468a4e){return _0x259603['define']('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41a9=['../../components/integrations/configuration','define','FreshdeskAccount','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x41a9,0x161));var _0x941a=function(_0x544ce8,_0x4c612d){_0x544ce8=_0x544ce8-0x0;var _0x454eda=_0x41a9[_0x544ce8];return _0x454eda;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x941a('0x0'))(_0x941a('0x1'));var moment=require('moment');var BPromise=require(_0x941a('0x2'));var rp=require(_0x941a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x941a('0x4'));var config=require(_0x941a('0x5'));var attributes=require(_0x941a('0x6'));var integrations=require(_0x941a('0x7'));module['exports']=function(_0x21a9dc,_0x530b15){return _0x21a9dc[_0x941a('0x8')](_0x941a('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index e344106..1e6c3e5 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c29=['options','raw','where','attributes','include','map','model','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','find','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','FreshdeskAccount','findAll'];(function(_0xa14087,_0x3fe52c){var _0xdc789d=function(_0x1a78f2){while(--_0x1a78f2){_0xa14087['push'](_0xa14087['shift']());}};_0xdc789d(++_0x3fe52c);}(_0x6c29,0x135));var _0x96c2=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x6c29[_0x582f72];return _0x4cd5fe;};'use strict';var _=require(_0x96c2('0x0'));var util=require(_0x96c2('0x1'));var moment=require(_0x96c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x96c2('0x3'));var fs=require('fs');var Redis=require(_0x96c2('0x4'));var db=require(_0x96c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x96c2('0x6'))('rpc');var config=require(_0x96c2('0x7'));var jayson=require(_0x96c2('0x8'));var client=jayson[_0x96c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x560ff5,_0x45ed8f,_0x5e0f60){return new BPromise(function(_0x44d503,_0x289fa3){return client[_0x96c2('0xa')](_0x560ff5,_0x5e0f60)[_0x96c2('0xb')](function(_0x37f50b){logger[_0x96c2('0xc')](_0x96c2('0xd'),_0x45ed8f,_0x96c2('0xe'));logger[_0x96c2('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x45ed8f,'request\x20sent',JSON['stringify'](_0x37f50b));if(_0x37f50b[_0x96c2('0x10')]){if(_0x37f50b[_0x96c2('0x10')][_0x96c2('0x11')]===0x1f4){logger[_0x96c2('0x10')](_0x96c2('0xd'),_0x45ed8f,_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);return _0x289fa3(_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);}logger[_0x96c2('0x10')](_0x96c2('0xd'),_0x45ed8f,_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);return _0x44d503(_0x37f50b[_0x96c2('0x10')][_0x96c2('0x12')]);}else{logger[_0x96c2('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x45ed8f,_0x96c2('0xe'));_0x44d503(_0x37f50b['result'][_0x96c2('0x12')]);}})['catch'](function(_0x3a0dd3){logger['error'](_0x96c2('0xd'),_0x45ed8f,_0x3a0dd3);_0x289fa3(_0x3a0dd3);});});}exports['GetFreshdeskAccount']=function(_0xd2872b){var _0x15c826=this;return new Promise(function(_0x89f20,_0x4729a7){return db[_0x96c2('0x13')][_0x96c2('0x14')]({'raw':_0xd2872b[_0x96c2('0x15')]?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x16')]===undefined?!![]:![]:!![],'where':_0xd2872b[_0x96c2('0x15')]?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x17')]||null:null,'attributes':_0xd2872b['options']?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x18')]||null:null,'limit':_0xd2872b[_0x96c2('0x15')]?_0xd2872b['options']['limit']||null:null,'include':_0xd2872b['options']?_0xd2872b[_0x96c2('0x15')][_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0xd2872b[_0x96c2('0x15')][_0x96c2('0x19')],function(_0x2e2750){return{'model':db[_0x2e2750[_0x96c2('0x1b')]],'as':_0x2e2750['as'],'attributes':_0x2e2750[_0x96c2('0x18')],'include':_0x2e2750[_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0x2e2750[_0x96c2('0x19')],function(_0x38230a){return{'model':db[_0x38230a[_0x96c2('0x1b')]],'as':_0x38230a['as'],'attributes':_0x38230a[_0x96c2('0x18')],'include':_0x38230a[_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0x38230a['include'],function(_0x15c99d){return{'model':db[_0x15c99d[_0x96c2('0x1b')]],'as':_0x15c99d['as'],'attributes':_0x15c99d[_0x96c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x96c2('0xb')](function(_0x5e5b3f){logger[_0x96c2('0xc')](_0x96c2('0x1c'),_0xd2872b);logger[_0x96c2('0xf')]('GetFreshdeskAccount',_0xd2872b,JSON[_0x96c2('0x1d')](_0x5e5b3f));_0x89f20(_0x5e5b3f);})['catch'](function(_0x540a07){logger[_0x96c2('0x10')](_0x96c2('0x1c'),_0x540a07[_0x96c2('0x12')],_0xd2872b);_0x4729a7(_0x15c826[_0x96c2('0x10')](0x1f4,_0x540a07[_0x96c2('0x12')]));});});};exports[_0x96c2('0x1e')]=function(_0x3a22aa){var _0x3274cb=this;return new Promise(function(_0x4d68d7,_0x3262b3){return db[_0x96c2('0x13')][_0x96c2('0x1f')]({'raw':_0x3a22aa[_0x96c2('0x15')]?_0x3a22aa[_0x96c2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3a22aa['options']?_0x3a22aa[_0x96c2('0x15')][_0x96c2('0x17')]||null:null,'attributes':_0x3a22aa[_0x96c2('0x15')]?_0x3a22aa['options'][_0x96c2('0x18')]||null:null,'include':_0x3a22aa[_0x96c2('0x15')]?_0x3a22aa[_0x96c2('0x15')][_0x96c2('0x19')]?_['map'](_0x3a22aa[_0x96c2('0x15')][_0x96c2('0x19')],function(_0x37d0e1){return{'model':db[_0x37d0e1[_0x96c2('0x1b')]],'as':_0x37d0e1['as'],'attributes':_0x37d0e1[_0x96c2('0x18')],'include':_0x37d0e1['include']?_['map'](_0x37d0e1[_0x96c2('0x19')],function(_0x60b6a8){return{'model':db[_0x60b6a8[_0x96c2('0x1b')]],'as':_0x60b6a8['as'],'attributes':_0x60b6a8[_0x96c2('0x18')],'include':_0x60b6a8[_0x96c2('0x19')]?_[_0x96c2('0x1a')](_0x60b6a8[_0x96c2('0x19')],function(_0x5c4838){return{'model':db[_0x5c4838['model']],'as':_0x5c4838['as'],'attributes':_0x5c4838[_0x96c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0x96c2('0xb')](function(_0x1aba03){logger[_0x96c2('0xc')](_0x96c2('0x1e'),_0x3a22aa);logger[_0x96c2('0xf')](_0x96c2('0x1e'),_0x3a22aa,JSON[_0x96c2('0x1d')](_0x1aba03));_0x4d68d7(_0x1aba03);})[_0x96c2('0x20')](function(_0x2e871e){logger['error']('ShowFreshdeskAccount',_0x2e871e[_0x96c2('0x12')],_0x3a22aa);_0x3262b3(_0x3274cb['error'](0x1f4,_0x2e871e[_0x96c2('0x12')]));});});}; \ No newline at end of file +var _0xd6ff=['model','ShowFreshdeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options','where','attributes','include','map'];(function(_0x5c1c4d,_0x26e9b3){var _0x5e9034=function(_0xfe6a96){while(--_0xfe6a96){_0x5c1c4d['push'](_0x5c1c4d['shift']());}};_0x5e9034(++_0x26e9b3);}(_0xd6ff,0xb2));var _0xfd6f=function(_0x989986,_0x268417){_0x989986=_0x989986-0x0;var _0x444ed7=_0xd6ff[_0x989986];return _0x444ed7;};'use strict';var _=require(_0xfd6f('0x0'));var util=require(_0xfd6f('0x1'));var moment=require('moment');var BPromise=require(_0xfd6f('0x2'));var rs=require(_0xfd6f('0x3'));var fs=require('fs');var Redis=require(_0xfd6f('0x4'));var db=require(_0xfd6f('0x5'))['db'];var utils=require(_0xfd6f('0x6'));var logger=require(_0xfd6f('0x7'))(_0xfd6f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd6f('0x9')][_0xfd6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10eae3,_0x3db361,_0x438ad7){return new BPromise(function(_0x2dd003,_0x46e1e0){return client[_0xfd6f('0xb')](_0x10eae3,_0x438ad7)[_0xfd6f('0xc')](function(_0x4f01f9){logger[_0xfd6f('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x3db361,_0xfd6f('0xe'));logger[_0xfd6f('0xf')](_0xfd6f('0x10'),_0x3db361,_0xfd6f('0xe'),JSON[_0xfd6f('0x11')](_0x4f01f9));if(_0x4f01f9[_0xfd6f('0x12')]){if(_0x4f01f9[_0xfd6f('0x12')]['code']===0x1f4){logger[_0xfd6f('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x3db361,_0x4f01f9['error'][_0xfd6f('0x13')]);return _0x46e1e0(_0x4f01f9['error'][_0xfd6f('0x13')]);}logger['error'](_0xfd6f('0x14'),_0x3db361,_0x4f01f9[_0xfd6f('0x12')][_0xfd6f('0x13')]);return _0x2dd003(_0x4f01f9[_0xfd6f('0x12')][_0xfd6f('0x13')]);}else{logger[_0xfd6f('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x3db361,_0xfd6f('0xe'));_0x2dd003(_0x4f01f9[_0xfd6f('0x15')][_0xfd6f('0x13')]);}})[_0xfd6f('0x16')](function(_0x39cc13){logger[_0xfd6f('0x12')](_0xfd6f('0x14'),_0x3db361,_0x39cc13);_0x46e1e0(_0x39cc13);});});}exports[_0xfd6f('0x17')]=function(_0xc1eb09){var _0x3f2dba=this;return new Promise(function(_0x4f56d9,_0x4ecc7d){return db[_0xfd6f('0x18')][_0xfd6f('0x19')]({'raw':_0xc1eb09['options']?_0xc1eb09['options'][_0xfd6f('0x1a')]===undefined?!![]:![]:!![],'where':_0xc1eb09[_0xfd6f('0x1b')]?_0xc1eb09['options'][_0xfd6f('0x1c')]||null:null,'attributes':_0xc1eb09['options']?_0xc1eb09[_0xfd6f('0x1b')][_0xfd6f('0x1d')]||null:null,'limit':_0xc1eb09['options']?_0xc1eb09['options']['limit']||null:null,'include':_0xc1eb09['options']?_0xc1eb09[_0xfd6f('0x1b')][_0xfd6f('0x1e')]?_[_0xfd6f('0x1f')](_0xc1eb09[_0xfd6f('0x1b')][_0xfd6f('0x1e')],function(_0x23fc6f){return{'model':db[_0x23fc6f[_0xfd6f('0x20')]],'as':_0x23fc6f['as'],'attributes':_0x23fc6f[_0xfd6f('0x1d')],'include':_0x23fc6f[_0xfd6f('0x1e')]?_[_0xfd6f('0x1f')](_0x23fc6f['include'],function(_0x43ad3d){return{'model':db[_0x43ad3d[_0xfd6f('0x20')]],'as':_0x43ad3d['as'],'attributes':_0x43ad3d['attributes'],'include':_0x43ad3d[_0xfd6f('0x1e')]?_[_0xfd6f('0x1f')](_0x43ad3d['include'],function(_0x239c16){return{'model':db[_0x239c16[_0xfd6f('0x20')]],'as':_0x239c16['as'],'attributes':_0x239c16[_0xfd6f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfd6f('0xc')](function(_0x1804f4){logger[_0xfd6f('0xd')](_0xfd6f('0x17'),_0xc1eb09);logger[_0xfd6f('0xf')](_0xfd6f('0x17'),_0xc1eb09,JSON[_0xfd6f('0x11')](_0x1804f4));_0x4f56d9(_0x1804f4);})[_0xfd6f('0x16')](function(_0x154662){logger['error']('GetFreshdeskAccount',_0x154662[_0xfd6f('0x13')],_0xc1eb09);_0x4ecc7d(_0x3f2dba[_0xfd6f('0x12')](0x1f4,_0x154662[_0xfd6f('0x13')]));});});};exports[_0xfd6f('0x21')]=function(_0x3f17ff){var _0x357664=this;return new Promise(function(_0x4d2d84,_0x11b700){return db[_0xfd6f('0x18')][_0xfd6f('0x22')]({'raw':_0x3f17ff[_0xfd6f('0x1b')]?_0x3f17ff[_0xfd6f('0x1b')][_0xfd6f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f17ff[_0xfd6f('0x1b')]?_0x3f17ff[_0xfd6f('0x1b')][_0xfd6f('0x1c')]||null:null,'attributes':_0x3f17ff[_0xfd6f('0x1b')]?_0x3f17ff[_0xfd6f('0x1b')]['attributes']||null:null,'include':_0x3f17ff[_0xfd6f('0x1b')]?_0x3f17ff[_0xfd6f('0x1b')][_0xfd6f('0x1e')]?_[_0xfd6f('0x1f')](_0x3f17ff[_0xfd6f('0x1b')][_0xfd6f('0x1e')],function(_0x182586){return{'model':db[_0x182586[_0xfd6f('0x20')]],'as':_0x182586['as'],'attributes':_0x182586['attributes'],'include':_0x182586[_0xfd6f('0x1e')]?_[_0xfd6f('0x1f')](_0x182586['include'],function(_0xc475b0){return{'model':db[_0xc475b0['model']],'as':_0xc475b0['as'],'attributes':_0xc475b0[_0xfd6f('0x1d')],'include':_0xc475b0[_0xfd6f('0x1e')]?_[_0xfd6f('0x1f')](_0xc475b0[_0xfd6f('0x1e')],function(_0x1e0ff0){return{'model':db[_0x1e0ff0[_0xfd6f('0x20')]],'as':_0x1e0ff0['as'],'attributes':_0x1e0ff0[_0xfd6f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfd6f('0xc')](function(_0x5af146){logger[_0xfd6f('0xd')](_0xfd6f('0x21'),_0x3f17ff);logger[_0xfd6f('0xf')](_0xfd6f('0x21'),_0x3f17ff,JSON['stringify'](_0x5af146));_0x4d2d84(_0x5af146);})[_0xfd6f('0x16')](function(_0x1130d1){logger['error'](_0xfd6f('0x21'),_0x1130d1[_0xfd6f('0x13')],_0x3f17ff);_0x11b700(_0x357664[_0xfd6f('0x12')](0x1f4,_0x1130d1[_0xfd6f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index bc56239..55c7b7a 100644 --- a/server/api/intFreshdeskConfiguration/index.js +++ b/server/api/intFreshdeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7162=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x3f4f44,_0x59b2fd){var _0x3e2e14=function(_0x4bd8db){while(--_0x4bd8db){_0x3f4f44['push'](_0x3f4f44['shift']());}};_0x3e2e14(++_0x59b2fd);}(_0x7162,0xe2));var _0x2716=function(_0x1aaee5,_0x24d737){_0x1aaee5=_0x1aaee5-0x0;var _0x1985a2=_0x7162[_0x1aaee5];return _0x1985a2;};'use strict';var multer=require(_0x2716('0x0'));var util=require(_0x2716('0x1'));var path=require('path');var timeout=require(_0x2716('0x2'));var express=require(_0x2716('0x3'));var router=express[_0x2716('0x4')]();var fs_extra=require(_0x2716('0x5'));var auth=require(_0x2716('0x6'));var interaction=require(_0x2716('0x7'));var config=require(_0x2716('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x2716('0x9')]('/',auth[_0x2716('0xa')](),controller[_0x2716('0xb')]);router['get'](_0x2716('0xc'),auth[_0x2716('0xa')](),controller[_0x2716('0xd')]);router[_0x2716('0x9')](_0x2716('0xe'),auth[_0x2716('0xa')](),controller[_0x2716('0xf')]);router[_0x2716('0x9')]('/:id/subjects',auth[_0x2716('0xa')](),controller[_0x2716('0x10')]);router[_0x2716('0x9')](_0x2716('0x11'),auth[_0x2716('0xa')](),controller[_0x2716('0x12')]);router['get'](_0x2716('0x13'),auth[_0x2716('0xa')](),controller[_0x2716('0x14')]);router[_0x2716('0x15')]('/',auth[_0x2716('0xa')](),controller['create']);router['post'](_0x2716('0x13'),auth[_0x2716('0xa')](),controller[_0x2716('0x16')]);router['put'](_0x2716('0xc'),auth[_0x2716('0xa')](),controller[_0x2716('0x17')]);router[_0x2716('0x18')](_0x2716('0xc'),auth['isAuthenticated'](),controller[_0x2716('0x19')]);module[_0x2716('0x1a')]=router; \ No newline at end of file +var _0x8742=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0xc14fe0,_0x329cda){var _0x35ad73=function(_0x1e1b4e){while(--_0x1e1b4e){_0xc14fe0['push'](_0xc14fe0['shift']());}};_0x35ad73(++_0x329cda);}(_0x8742,0xd5));var _0x2874=function(_0x969378,_0x4c659c){_0x969378=_0x969378-0x0;var _0x4428eb=_0x8742[_0x969378];return _0x4428eb;};'use strict';var multer=require(_0x2874('0x0'));var util=require(_0x2874('0x1'));var path=require(_0x2874('0x2'));var timeout=require(_0x2874('0x3'));var express=require(_0x2874('0x4'));var router=express[_0x2874('0x5')]();var fs_extra=require(_0x2874('0x6'));var auth=require(_0x2874('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2874('0x8'));var controller=require(_0x2874('0x9'));router[_0x2874('0xa')]('/',auth[_0x2874('0xb')](),controller['index']);router[_0x2874('0xa')]('/:id',auth[_0x2874('0xb')](),controller[_0x2874('0xc')]);router[_0x2874('0xa')](_0x2874('0xd'),auth['isAuthenticated'](),controller[_0x2874('0xe')]);router[_0x2874('0xa')](_0x2874('0xf'),auth['isAuthenticated'](),controller[_0x2874('0x10')]);router['get']('/:id/descriptions',auth[_0x2874('0xb')](),controller[_0x2874('0x11')]);router[_0x2874('0xa')](_0x2874('0x12'),auth['isAuthenticated'](),controller[_0x2874('0x13')]);router['post']('/',auth[_0x2874('0xb')](),controller[_0x2874('0x14')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x2874('0x15')]('/:id',auth[_0x2874('0xb')](),controller[_0x2874('0x16')]);router[_0x2874('0x17')](_0x2874('0x18'),auth[_0x2874('0xb')](),controller[_0x2874('0x19')]);module[_0x2874('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 31688fb..2d6d26b 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x527b=['STRING','sequelize','exports'];(function(_0x46bbdf,_0xa1f48f){var _0x262c71=function(_0x52c9d6){while(--_0x52c9d6){_0x46bbdf['push'](_0x46bbdf['shift']());}};_0x262c71(++_0xa1f48f);}(_0x527b,0xf1));var _0xb527=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x527b[_0x1314d4];return _0x584ba5;};'use strict';var Sequelize=require(_0xb527('0x0'));module[_0xb527('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb527('0x2')]}}; \ No newline at end of file +var _0x69a5=['STRING','sequelize','exports'];(function(_0x5a7d3b,_0x4bbbca){var _0x29a881=function(_0x60a1bf){while(--_0x60a1bf){_0x5a7d3b['push'](_0x5a7d3b['shift']());}};_0x29a881(++_0x4bbbca);}(_0x69a5,0xc7));var _0x569a=function(_0x312d0d,_0x327629){_0x312d0d=_0x312d0d-0x0;var _0x3b7c09=_0x69a5[_0x312d0d];return _0x3b7c09;};'use strict';var Sequelize=require(_0x569a('0x0'));module[_0x569a('0x1')]={'name':{'type':Sequelize[_0x569a('0x2')]},'description':{'type':Sequelize[_0x569a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4d0702d..06594b5 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd591=['options','getFields','getSubjects','FreshdeskField','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','set','json','apply','save','update','destroy','stack','name','render','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','FreshdeskConfiguration','include','findAll','rows','show','params','keys','includeAll','find','create','order'];(function(_0x1f8bfa,_0x5e2757){var _0x33d0aa=function(_0x32d871){while(--_0x32d871){_0x1f8bfa['push'](_0x1f8bfa['shift']());}};_0x33d0aa(++_0x5e2757);}(_0xd591,0xd1));var _0x1d59=function(_0x54df83,_0x18c243){_0x54df83=_0x54df83-0x0;var _0x56ad3b=_0xd591[_0x54df83];return _0x56ad3b;};'use strict';var emlformat=require(_0x1d59('0x0'));var rimraf=require(_0x1d59('0x1'));var zipdir=require(_0x1d59('0x2'));var jsonpatch=require(_0x1d59('0x3'));var rp=require(_0x1d59('0x4'));var moment=require('moment');var BPromise=require(_0x1d59('0x5'));var Mustache=require('mustache');var util=require(_0x1d59('0x6'));var path=require(_0x1d59('0x7'));var sox=require('sox');var csv=require(_0x1d59('0x8'));var ejs=require(_0x1d59('0x9'));var fs=require('fs');var fs_extra=require(_0x1d59('0xa'));var _=require(_0x1d59('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1d59('0xc'));var deskjs=require(_0x1d59('0xd'));var toCsv=require(_0x1d59('0x8'));var querystring=require(_0x1d59('0xe'));var Papa=require(_0x1d59('0xf'));var Redis=require(_0x1d59('0x10'));var authService=require(_0x1d59('0x11'));var qs=require(_0x1d59('0x12'));var as=require(_0x1d59('0x13'));var hardwareService=require(_0x1d59('0x14'));var logger=require('../../config/logger')(_0x1d59('0x15'));var utils=require(_0x1d59('0x16'));var config=require(_0x1d59('0x17'));var licenseUtil=require(_0x1d59('0x18'));var db=require(_0x1d59('0x19'))['db'];var jayson=require(_0x1d59('0x1a'));var client=jayson[_0x1d59('0x1b')][_0x1d59('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5093aa,_0x47655b,_0x33fa9d,_0x4928b1){return new BPromise(function(_0x3d9d89,_0x29d574){var _0x160cb7=_0x4928b1||client;return _0x160cb7['request'](_0x5093aa,_0x33fa9d)[_0x1d59('0x1d')](function(_0x274628){logger[_0x1d59('0x1e')](_0x1d59('0x1f'),_0x47655b,_0x1d59('0x20'));logger[_0x1d59('0x21')](_0x1d59('0x22'),_0x47655b,_0x1d59('0x20'),JSON[_0x1d59('0x23')](_0x274628));if(_0x274628[_0x1d59('0x24')]){if(_0x274628[_0x1d59('0x24')][_0x1d59('0x25')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x47655b,_0x274628['error'][_0x1d59('0x26')]);return _0x29d574(_0x274628[_0x1d59('0x24')][_0x1d59('0x26')]);}logger[_0x1d59('0x24')](_0x1d59('0x1f'),_0x47655b,_0x274628[_0x1d59('0x24')][_0x1d59('0x26')]);return _0x3d9d89(_0x274628[_0x1d59('0x24')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x47655b,_0x1d59('0x20'));_0x3d9d89(_0x274628['result'][_0x1d59('0x26')]);}})[_0x1d59('0x27')](function(_0x22ec94){logger[_0x1d59('0x24')](_0x1d59('0x1f'),_0x47655b,_0x22ec94);_0x29d574(_0x22ec94);});});}function respondWithStatusCode(_0x529d2a,_0x369916){_0x369916=_0x369916||0xcc;return function(_0x5a4905){if(_0x5a4905){return _0x529d2a[_0x1d59('0x28')](_0x369916);}return _0x529d2a[_0x1d59('0x29')](_0x369916)[_0x1d59('0x2a')]();};}function respondWithResult(_0x3db51e,_0xdd8efd){_0xdd8efd=_0xdd8efd||0xc8;return function(_0x5ca755){if(_0x5ca755){return _0x3db51e[_0x1d59('0x29')](_0xdd8efd)['json'](_0x5ca755);}};}function respondWithFilteredResult(_0x2e3bc0,_0x39098b){return function(_0x4484a1){if(_0x4484a1){var _0x46e647=typeof _0x39098b[_0x1d59('0x2b')]===_0x1d59('0x2c')&&typeof _0x39098b[_0x1d59('0x2d')]===_0x1d59('0x2c');var _0x4f3cd4=_0x4484a1['count'];var _0x3083ca=_0x46e647?0x0:_0x39098b[_0x1d59('0x2b')];var _0x5a3f4b=_0x46e647?_0x4484a1['count']:_0x39098b[_0x1d59('0x2b')]+_0x39098b[_0x1d59('0x2d')];var _0x2cd5da;if(_0x5a3f4b>=_0x4f3cd4){_0x5a3f4b=_0x4f3cd4;_0x2cd5da=0xc8;}else{_0x2cd5da=0xce;}_0x2e3bc0['status'](_0x2cd5da);return _0x2e3bc0[_0x1d59('0x2e')]('Content-Range',_0x3083ca+'-'+_0x5a3f4b+'/'+_0x4f3cd4)[_0x1d59('0x2f')](_0x4484a1);}return null;};}function patchUpdates(_0x15c52b){return function(_0x4283ae){try{jsonpatch[_0x1d59('0x30')](_0x4283ae,_0x15c52b,!![]);}catch(_0x3f62b1){return BPromise['reject'](_0x3f62b1);}return _0x4283ae[_0x1d59('0x31')]();};}function saveUpdates(_0x279afb,_0x3a39b1){return function(_0xb84328){if(_0xb84328){return _0xb84328[_0x1d59('0x32')](_0x279afb)[_0x1d59('0x1d')](function(_0x43a870){return _0x43a870;});}return null;};}function removeEntity(_0x7cb3f6,_0x3610fa){return function(_0x5c5f6b){if(_0x5c5f6b){return _0x5c5f6b[_0x1d59('0x33')]()[_0x1d59('0x1d')](function(){_0x7cb3f6[_0x1d59('0x29')](0xcc)[_0x1d59('0x2a')]();});}};}function handleEntityNotFound(_0x5931c3,_0x390222){return function(_0x3262b9){if(!_0x3262b9){_0x5931c3[_0x1d59('0x28')](0x194);}return _0x3262b9;};}function handleError(_0x28af71,_0x27c7c3){_0x27c7c3=_0x27c7c3||0x1f4;return function(_0x4e5f81){logger[_0x1d59('0x24')](_0x4e5f81[_0x1d59('0x34')]);if(_0x4e5f81[_0x1d59('0x35')]){delete _0x4e5f81[_0x1d59('0x35')];}_0x28af71['status'](_0x27c7c3)['send'](_0x4e5f81);};}function getMustacheRender(_0x39a129,_0x5903bc){return Mustache[_0x1d59('0x36')](_0x39a129,_['merge'](_0x5903bc[_0x1d59('0x37')],{'contact':_0x5903bc[_0x1d59('0x38')],'message':_0x5903bc['message'],'agent':_0x5903bc[_0x1d59('0x39')],'interaction':_0x5903bc[_0x1d59('0x3a')],'account':_0x5903bc[_0x1d59('0x3b')]}))||'';}exports[_0x1d59('0x3c')]=function(_0x48851c,_0x2c8f0b){var _0x33b32f={},_0x4e6db4={},_0x977a27={'count':0x0,'rows':[]};var _0x240479=_[_0x1d59('0x3d')](db['FreshdeskConfiguration'][_0x1d59('0x3e')],function(_0x2e5ca1){return{'name':_0x2e5ca1[_0x1d59('0x3f')],'type':_0x2e5ca1[_0x1d59('0x40')]['key']};});_0x4e6db4['model']=_[_0x1d59('0x3d')](_0x240479,_0x1d59('0x35'));_0x4e6db4[_0x1d59('0x41')]=_['keys'](_0x48851c['query']);_0x4e6db4['filters']=_[_0x1d59('0x42')](_0x4e6db4[_0x1d59('0x43')],_0x4e6db4['query']);_0x33b32f['attributes']=_[_0x1d59('0x42')](_0x4e6db4['model'],qs[_0x1d59('0x44')](_0x48851c[_0x1d59('0x41')][_0x1d59('0x44')]));_0x33b32f[_0x1d59('0x45')]=_0x33b32f[_0x1d59('0x45')][_0x1d59('0x46')]?_0x33b32f[_0x1d59('0x45')]:_0x4e6db4[_0x1d59('0x43')];if(!_0x48851c[_0x1d59('0x41')][_0x1d59('0x47')](_0x1d59('0x48'))){_0x33b32f[_0x1d59('0x2d')]=qs['limit'](_0x48851c[_0x1d59('0x41')][_0x1d59('0x2d')]);_0x33b32f[_0x1d59('0x2b')]=qs[_0x1d59('0x2b')](_0x48851c[_0x1d59('0x41')][_0x1d59('0x2b')]);}_0x33b32f['order']=qs[_0x1d59('0x49')](_0x48851c[_0x1d59('0x41')][_0x1d59('0x49')]);_0x33b32f[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_[_0x1d59('0x4c')](_0x48851c[_0x1d59('0x41')],_0x4e6db4[_0x1d59('0x4b')]),_0x240479);if(_0x48851c[_0x1d59('0x41')]['filter']){_0x33b32f[_0x1d59('0x4a')]=_['merge'](_0x33b32f['where'],{'$or':_['map'](_0x240479,function(_0x3755b5){if(_0x3755b5[_0x1d59('0x40')]!==_0x1d59('0x4d')){var _0xfb0168={};_0xfb0168[_0x3755b5[_0x1d59('0x35')]]={'$like':'%'+_0x48851c[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0xfb0168;}})});}_0x33b32f=_[_0x1d59('0x4f')]({},_0x33b32f,_0x48851c['options']);var _0x3a3d55={'where':_0x33b32f[_0x1d59('0x4a')]};return db[_0x1d59('0x50')]['count'](_0x3a3d55)['then'](function(_0x4855e5){_0x977a27['count']=_0x4855e5;if(_0x48851c[_0x1d59('0x41')]['includeAll']){_0x33b32f[_0x1d59('0x51')]=[{'all':!![]}];}return db[_0x1d59('0x50')][_0x1d59('0x52')](_0x33b32f);})[_0x1d59('0x1d')](function(_0x4ee2c0){_0x977a27[_0x1d59('0x53')]=_0x4ee2c0;return _0x977a27;})[_0x1d59('0x1d')](respondWithFilteredResult(_0x2c8f0b,_0x33b32f))[_0x1d59('0x27')](handleError(_0x2c8f0b,null));};exports[_0x1d59('0x54')]=function(_0x3af766,_0x4df0f0){var _0x582ef3={'raw':![],'where':{'id':_0x3af766[_0x1d59('0x55')]['id']}},_0xdde678={};_0xdde678[_0x1d59('0x43')]=_[_0x1d59('0x56')](db[_0x1d59('0x50')][_0x1d59('0x3e')]);_0xdde678[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0x3af766[_0x1d59('0x41')]);_0xdde678[_0x1d59('0x4b')]=_[_0x1d59('0x42')](_0xdde678[_0x1d59('0x43')],_0xdde678['query']);_0x582ef3['attributes']=_['intersection'](_0xdde678['model'],qs[_0x1d59('0x44')](_0x3af766['query']['fields']));_0x582ef3['attributes']=_0x582ef3[_0x1d59('0x45')][_0x1d59('0x46')]?_0x582ef3[_0x1d59('0x45')]:_0xdde678[_0x1d59('0x43')];if(_0x3af766[_0x1d59('0x41')][_0x1d59('0x57')]){_0x582ef3['include']=[{'all':!![]}];}_0x582ef3=_[_0x1d59('0x4f')]({},_0x582ef3,_0x3af766['options']);return db[_0x1d59('0x50')][_0x1d59('0x58')](_0x582ef3)[_0x1d59('0x1d')](handleEntityNotFound(_0x4df0f0,null))['then'](respondWithResult(_0x4df0f0,null))[_0x1d59('0x27')](handleError(_0x4df0f0,null));};exports[_0x1d59('0x59')]=function(_0xf069fd,_0x12cbf5){return db['FreshdeskConfiguration']['create'](_0xf069fd[_0x1d59('0x37')],{})[_0x1d59('0x1d')](respondWithResult(_0x12cbf5,0xc9))[_0x1d59('0x27')](handleError(_0x12cbf5,null));};exports['update']=function(_0x2e59ec,_0x5c9859){if(_0x2e59ec[_0x1d59('0x37')]['id']){delete _0x2e59ec[_0x1d59('0x37')]['id'];}return db['FreshdeskConfiguration'][_0x1d59('0x58')]({'where':{'id':_0x2e59ec[_0x1d59('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c9859,null))['then'](saveUpdates(_0x2e59ec[_0x1d59('0x37')],null))[_0x1d59('0x1d')](respondWithResult(_0x5c9859,null))[_0x1d59('0x27')](handleError(_0x5c9859,null));};exports[_0x1d59('0x33')]=function(_0x41ea6a,_0x2c5c97){return db[_0x1d59('0x50')][_0x1d59('0x58')]({'where':{'id':_0x41ea6a[_0x1d59('0x55')]['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x2c5c97,null))[_0x1d59('0x1d')](removeEntity(_0x2c5c97,null))[_0x1d59('0x27')](handleError(_0x2c5c97,null));};exports['getFields']=function(_0xb476ae,_0x134164,_0x20e38a){var _0x3d1ed2={};var _0x5d7a87={};var _0x11794c;var _0x58f4e2;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xb476ae['params']['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x134164,null))[_0x1d59('0x1d')](function(_0x173b7e){if(_0x173b7e){_0x11794c=_0x173b7e;_0x5d7a87[_0x1d59('0x43')]=_[_0x1d59('0x56')](db['FreshdeskField'][_0x1d59('0x3e')]);_0x5d7a87[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0xb476ae[_0x1d59('0x41')]);_0x5d7a87['filters']=_['intersection'](_0x5d7a87[_0x1d59('0x43')],_0x5d7a87['query']);_0x3d1ed2['attributes']=_[_0x1d59('0x42')](_0x5d7a87[_0x1d59('0x43')],qs[_0x1d59('0x44')](_0xb476ae[_0x1d59('0x41')][_0x1d59('0x44')]));_0x3d1ed2[_0x1d59('0x45')]=_0x3d1ed2['attributes']['length']?_0x3d1ed2['attributes']:_0x5d7a87[_0x1d59('0x43')];_0x3d1ed2[_0x1d59('0x5a')]=qs[_0x1d59('0x49')](_0xb476ae[_0x1d59('0x41')][_0x1d59('0x49')]);_0x3d1ed2[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_[_0x1d59('0x4c')](_0xb476ae['query'],_0x5d7a87[_0x1d59('0x4b')]));if(_0xb476ae[_0x1d59('0x41')][_0x1d59('0x4e')]){_0x3d1ed2[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x3d1ed2['where'],{'$or':_['map'](_0x3d1ed2[_0x1d59('0x45')],function(_0x51aa3f){var _0x5e9cce={};_0x5e9cce[_0x51aa3f]={'$like':'%'+_0xb476ae[_0x1d59('0x41')]['filter']+'%'};return _0x5e9cce;})});}_0x3d1ed2=_[_0x1d59('0x4f')]({},_0x3d1ed2,_0xb476ae[_0x1d59('0x5b')]);return _0x11794c[_0x1d59('0x5c')](_0x3d1ed2);}})['then'](function(_0x113148){if(_0x113148){_0x58f4e2=_0x113148[_0x1d59('0x46')];if(!_0xb476ae[_0x1d59('0x41')][_0x1d59('0x47')]('nolimit')){_0x3d1ed2[_0x1d59('0x2d')]=qs[_0x1d59('0x2d')](_0xb476ae['query'][_0x1d59('0x2d')]);_0x3d1ed2[_0x1d59('0x2b')]=qs[_0x1d59('0x2b')](_0xb476ae[_0x1d59('0x41')]['offset']);}return _0x11794c[_0x1d59('0x5c')](_0x3d1ed2);}})[_0x1d59('0x1d')](function(_0x251f27){if(_0x251f27){return _0x251f27?{'count':_0x58f4e2,'rows':_0x251f27}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x134164,null))[_0x1d59('0x27')](handleError(_0x134164,null));};exports[_0x1d59('0x5d')]=function(_0x291dae,_0x3fe479,_0x12be4d){var _0x8505e0={};var _0x1c43a7={};var _0x59f61a;var _0x2755c5;return db[_0x1d59('0x50')]['findOne']({'where':{'id':_0x291dae['params']['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x3fe479,null))[_0x1d59('0x1d')](function(_0x3d1d58){if(_0x3d1d58){_0x59f61a=_0x3d1d58;_0x1c43a7[_0x1d59('0x43')]=_['keys'](db[_0x1d59('0x5e')][_0x1d59('0x3e')]);_0x1c43a7[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0x291dae['query']);_0x1c43a7[_0x1d59('0x4b')]=_[_0x1d59('0x42')](_0x1c43a7[_0x1d59('0x43')],_0x1c43a7[_0x1d59('0x41')]);_0x8505e0[_0x1d59('0x45')]=_[_0x1d59('0x42')](_0x1c43a7[_0x1d59('0x43')],qs[_0x1d59('0x44')](_0x291dae[_0x1d59('0x41')][_0x1d59('0x44')]));_0x8505e0['attributes']=_0x8505e0['attributes'][_0x1d59('0x46')]?_0x8505e0[_0x1d59('0x45')]:_0x1c43a7[_0x1d59('0x43')];_0x8505e0[_0x1d59('0x5a')]=qs[_0x1d59('0x49')](_0x291dae[_0x1d59('0x41')][_0x1d59('0x49')]);_0x8505e0[_0x1d59('0x4a')]=qs['filters'](_[_0x1d59('0x4c')](_0x291dae[_0x1d59('0x41')],_0x1c43a7[_0x1d59('0x4b')]));if(_0x291dae[_0x1d59('0x41')]['filter']){_0x8505e0[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x8505e0['where'],{'$or':_[_0x1d59('0x3d')](_0x8505e0[_0x1d59('0x45')],function(_0x2a2336){var _0x2cf95d={};_0x2cf95d[_0x2a2336]={'$like':'%'+_0x291dae[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0x2cf95d;})});}_0x8505e0=_['merge']({},_0x8505e0,_0x291dae[_0x1d59('0x5b')]);return _0x59f61a[_0x1d59('0x5d')](_0x8505e0);}})[_0x1d59('0x1d')](function(_0x2834c4){if(_0x2834c4){_0x2755c5=_0x2834c4[_0x1d59('0x46')];if(!_0x291dae[_0x1d59('0x41')][_0x1d59('0x47')](_0x1d59('0x48'))){_0x8505e0['limit']=qs[_0x1d59('0x2d')](_0x291dae[_0x1d59('0x41')][_0x1d59('0x2d')]);_0x8505e0[_0x1d59('0x2b')]=qs['offset'](_0x291dae['query']['offset']);}return _0x59f61a[_0x1d59('0x5d')](_0x8505e0);}})[_0x1d59('0x1d')](function(_0x339187){if(_0x339187){return _0x339187?{'count':_0x2755c5,'rows':_0x339187}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x3fe479,null))[_0x1d59('0x27')](handleError(_0x3fe479,null));};exports['getDescriptions']=function(_0x328c68,_0x4dc6b5,_0x27fed7){var _0x57e257={};var _0x401e43={};var _0x1c3d31;var _0x2b21e5;return db['FreshdeskConfiguration'][_0x1d59('0x5f')]({'where':{'id':_0x328c68['params']['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x4dc6b5,null))[_0x1d59('0x1d')](function(_0xcfb4b9){if(_0xcfb4b9){_0x1c3d31=_0xcfb4b9;_0x401e43[_0x1d59('0x43')]=_[_0x1d59('0x56')](db[_0x1d59('0x5e')][_0x1d59('0x3e')]);_0x401e43[_0x1d59('0x41')]=_[_0x1d59('0x56')](_0x328c68[_0x1d59('0x41')]);_0x401e43[_0x1d59('0x4b')]=_['intersection'](_0x401e43[_0x1d59('0x43')],_0x401e43['query']);_0x57e257['attributes']=_[_0x1d59('0x42')](_0x401e43[_0x1d59('0x43')],qs[_0x1d59('0x44')](_0x328c68['query']['fields']));_0x57e257[_0x1d59('0x45')]=_0x57e257[_0x1d59('0x45')][_0x1d59('0x46')]?_0x57e257[_0x1d59('0x45')]:_0x401e43[_0x1d59('0x43')];_0x57e257[_0x1d59('0x5a')]=qs['sort'](_0x328c68['query'][_0x1d59('0x49')]);_0x57e257[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_['pick'](_0x328c68[_0x1d59('0x41')],_0x401e43[_0x1d59('0x4b')]));if(_0x328c68['query'][_0x1d59('0x4e')]){_0x57e257[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x57e257[_0x1d59('0x4a')],{'$or':_['map'](_0x57e257[_0x1d59('0x45')],function(_0x56f50a){var _0x1d1bbe={};_0x1d1bbe[_0x56f50a]={'$like':'%'+_0x328c68[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0x1d1bbe;})});}_0x57e257=_[_0x1d59('0x4f')]({},_0x57e257,_0x328c68[_0x1d59('0x5b')]);return _0x1c3d31[_0x1d59('0x60')](_0x57e257);}})[_0x1d59('0x1d')](function(_0x29a56d){if(_0x29a56d){_0x2b21e5=_0x29a56d[_0x1d59('0x46')];if(!_0x328c68[_0x1d59('0x41')][_0x1d59('0x47')](_0x1d59('0x48'))){_0x57e257[_0x1d59('0x2d')]=qs[_0x1d59('0x2d')](_0x328c68[_0x1d59('0x41')]['limit']);_0x57e257[_0x1d59('0x2b')]=qs['offset'](_0x328c68[_0x1d59('0x41')][_0x1d59('0x2b')]);}return _0x1c3d31[_0x1d59('0x60')](_0x57e257);}})['then'](function(_0x28e367){if(_0x28e367){return _0x28e367?{'count':_0x2b21e5,'rows':_0x28e367}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x4dc6b5,null))[_0x1d59('0x27')](handleError(_0x4dc6b5,null));};exports[_0x1d59('0x61')]=function(_0x14472c,_0x29607d,_0x3e1501){var _0x5c1dd2={};var _0x44804f={};var _0xcb74d9;var _0x29c06b;return db[_0x1d59('0x50')][_0x1d59('0x5f')]({'where':{'id':_0x14472c[_0x1d59('0x55')]['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x29607d,null))[_0x1d59('0x1d')](function(_0x1f1c25){if(_0x1f1c25){_0xcb74d9=_0x1f1c25;_0x44804f[_0x1d59('0x43')]=_[_0x1d59('0x56')](db['Tag']['rawAttributes']);_0x44804f[_0x1d59('0x41')]=_['keys'](_0x14472c[_0x1d59('0x41')]);_0x44804f[_0x1d59('0x4b')]=_[_0x1d59('0x42')](_0x44804f[_0x1d59('0x43')],_0x44804f[_0x1d59('0x41')]);_0x5c1dd2[_0x1d59('0x45')]=_[_0x1d59('0x42')](_0x44804f['model'],qs[_0x1d59('0x44')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x44')]));_0x5c1dd2[_0x1d59('0x45')]=_0x5c1dd2[_0x1d59('0x45')][_0x1d59('0x46')]?_0x5c1dd2[_0x1d59('0x45')]:_0x44804f[_0x1d59('0x43')];_0x5c1dd2['order']=qs[_0x1d59('0x49')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x49')]);_0x5c1dd2[_0x1d59('0x4a')]=qs[_0x1d59('0x4b')](_[_0x1d59('0x4c')](_0x14472c[_0x1d59('0x41')],_0x44804f[_0x1d59('0x4b')]));if(_0x14472c[_0x1d59('0x41')][_0x1d59('0x4e')]){_0x5c1dd2[_0x1d59('0x4a')]=_[_0x1d59('0x4f')](_0x5c1dd2['where'],{'$or':_[_0x1d59('0x3d')](_0x5c1dd2[_0x1d59('0x45')],function(_0x559f3e){var _0x3d9482={};_0x3d9482[_0x559f3e]={'$like':'%'+_0x14472c[_0x1d59('0x41')][_0x1d59('0x4e')]+'%'};return _0x3d9482;})});}_0x5c1dd2=_['merge']({},_0x5c1dd2,_0x14472c['options']);return _0xcb74d9[_0x1d59('0x61')](_0x5c1dd2);}})[_0x1d59('0x1d')](function(_0x1ee52d){if(_0x1ee52d){_0x29c06b=_0x1ee52d[_0x1d59('0x46')];if(!_0x14472c['query'][_0x1d59('0x47')](_0x1d59('0x48'))){_0x5c1dd2[_0x1d59('0x2d')]=qs[_0x1d59('0x2d')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x2d')]);_0x5c1dd2['offset']=qs[_0x1d59('0x2b')](_0x14472c[_0x1d59('0x41')][_0x1d59('0x2b')]);}return _0xcb74d9[_0x1d59('0x61')](_0x5c1dd2);}})[_0x1d59('0x1d')](function(_0x1fadc7){if(_0x1fadc7){return _0x1fadc7?{'count':_0x29c06b,'rows':_0x1fadc7}:null;}})[_0x1d59('0x1d')](respondWithResult(_0x29607d,null))[_0x1d59('0x27')](handleError(_0x29607d,null));};exports[_0x1d59('0x62')]=function(_0x2832ef,_0x148ab0,_0x3fba93){if(_0x2832ef[_0x1d59('0x37')]['id']){delete _0x2832ef['body']['id'];}return db[_0x1d59('0x50')]['findOne']({'where':{'id':_0x2832ef[_0x1d59('0x55')]['id']}})[_0x1d59('0x1d')](handleEntityNotFound(_0x148ab0,null))[_0x1d59('0x1d')](function(_0x3b9a56){if(_0x3b9a56){return _0x3b9a56[_0x1d59('0x62')](_0x2832ef[_0x1d59('0x37')][_0x1d59('0x63')]||[]);}return null;})[_0x1d59('0x1d')](respondWithResult(_0x148ab0,null))[_0x1d59('0x27')](handleError(_0x148ab0,null));}; \ No newline at end of file +var _0x28d4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','end','stack','name','send','render','body','contact','agent','account','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x28d4,0x13b));var _0x428d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x28d4[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x428d('0x0'));var rimraf=require(_0x428d('0x1'));var zipdir=require(_0x428d('0x2'));var jsonpatch=require(_0x428d('0x3'));var rp=require(_0x428d('0x4'));var moment=require(_0x428d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x428d('0x6'));var util=require(_0x428d('0x7'));var path=require(_0x428d('0x8'));var sox=require(_0x428d('0x9'));var csv=require('to-csv');var ejs=require(_0x428d('0xa'));var fs=require('fs');var fs_extra=require(_0x428d('0xb'));var _=require(_0x428d('0xc'));var squel=require(_0x428d('0xd'));var crypto=require(_0x428d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x428d('0xf'));var toCsv=require(_0x428d('0x10'));var querystring=require(_0x428d('0x11'));var Papa=require('papaparse');var Redis=require(_0x428d('0x12'));var authService=require(_0x428d('0x13'));var qs=require(_0x428d('0x14'));var as=require(_0x428d('0x15'));var hardwareService=require(_0x428d('0x16'));var logger=require(_0x428d('0x17'))(_0x428d('0x18'));var utils=require(_0x428d('0x19'));var config=require(_0x428d('0x1a'));var licenseUtil=require(_0x428d('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x428d('0x1c'));var client=jayson[_0x428d('0x1d')][_0x428d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3357bd,_0x11f87d,_0x57ae48,_0x10e631){return new BPromise(function(_0x2fb23e,_0x555af5){var _0x433f17=_0x10e631||client;return _0x433f17[_0x428d('0x1f')](_0x3357bd,_0x57ae48)['then'](function(_0x4a3af6){logger[_0x428d('0x20')](_0x428d('0x21'),_0x11f87d,_0x428d('0x22'));logger[_0x428d('0x23')](_0x428d('0x24'),_0x11f87d,_0x428d('0x22'),JSON[_0x428d('0x25')](_0x4a3af6));if(_0x4a3af6['error']){if(_0x4a3af6[_0x428d('0x26')][_0x428d('0x27')]===0x1f4){logger[_0x428d('0x26')](_0x428d('0x21'),_0x11f87d,_0x4a3af6[_0x428d('0x26')][_0x428d('0x28')]);return _0x555af5(_0x4a3af6[_0x428d('0x26')]['message']);}logger[_0x428d('0x26')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x11f87d,_0x4a3af6['error'][_0x428d('0x28')]);return _0x2fb23e(_0x4a3af6[_0x428d('0x26')][_0x428d('0x28')]);}else{logger[_0x428d('0x20')](_0x428d('0x21'),_0x11f87d,'request\x20sent');_0x2fb23e(_0x4a3af6[_0x428d('0x29')]['message']);}})[_0x428d('0x2a')](function(_0x4de076){logger[_0x428d('0x26')](_0x428d('0x21'),_0x11f87d,_0x4de076);_0x555af5(_0x4de076);});});}function respondWithStatusCode(_0x50e484,_0x1d81be){_0x1d81be=_0x1d81be||0xcc;return function(_0xcde1b9){if(_0xcde1b9){return _0x50e484[_0x428d('0x2b')](_0x1d81be);}return _0x50e484[_0x428d('0x2c')](_0x1d81be)['end']();};}function respondWithResult(_0x38fc44,_0x4868e4){_0x4868e4=_0x4868e4||0xc8;return function(_0x4592d0){if(_0x4592d0){return _0x38fc44['status'](_0x4868e4)[_0x428d('0x2d')](_0x4592d0);}};}function respondWithFilteredResult(_0x39a1f2,_0x1710dc){return function(_0x1e2b8c){if(_0x1e2b8c){var _0xcc981b=typeof _0x1710dc[_0x428d('0x2e')]==='undefined'&&typeof _0x1710dc[_0x428d('0x2f')]===_0x428d('0x30');var _0x4d0230=_0x1e2b8c[_0x428d('0x31')];var _0xe1778e=_0xcc981b?0x0:_0x1710dc['offset'];var _0x5eb852=_0xcc981b?_0x1e2b8c[_0x428d('0x31')]:_0x1710dc[_0x428d('0x2e')]+_0x1710dc[_0x428d('0x2f')];var _0x22f70c;if(_0x5eb852>=_0x4d0230){_0x5eb852=_0x4d0230;_0x22f70c=0xc8;}else{_0x22f70c=0xce;}_0x39a1f2[_0x428d('0x2c')](_0x22f70c);return _0x39a1f2[_0x428d('0x32')](_0x428d('0x33'),_0xe1778e+'-'+_0x5eb852+'/'+_0x4d0230)[_0x428d('0x2d')](_0x1e2b8c);}return null;};}function patchUpdates(_0x17d51b){return function(_0x4f51b2){try{jsonpatch['apply'](_0x4f51b2,_0x17d51b,!![]);}catch(_0x3ea60c){return BPromise['reject'](_0x3ea60c);}return _0x4f51b2[_0x428d('0x34')]();};}function saveUpdates(_0x596667,_0x4d72d1){return function(_0x38a415){if(_0x38a415){return _0x38a415['update'](_0x596667)[_0x428d('0x35')](function(_0x278864){return _0x278864;});}return null;};}function removeEntity(_0x1471fe,_0x46dd7e){return function(_0x1eb04a){if(_0x1eb04a){return _0x1eb04a[_0x428d('0x36')]()[_0x428d('0x35')](function(){_0x1471fe[_0x428d('0x2c')](0xcc)[_0x428d('0x37')]();});}};}function handleEntityNotFound(_0x543c7a,_0xb62bca){return function(_0x2c812d){if(!_0x2c812d){_0x543c7a[_0x428d('0x2b')](0x194);}return _0x2c812d;};}function handleError(_0x40ec44,_0x102d0c){_0x102d0c=_0x102d0c||0x1f4;return function(_0x59825a){logger[_0x428d('0x26')](_0x59825a[_0x428d('0x38')]);if(_0x59825a[_0x428d('0x39')]){delete _0x59825a['name'];}_0x40ec44['status'](_0x102d0c)[_0x428d('0x3a')](_0x59825a);};}function getMustacheRender(_0xb91255,_0x3087c7){return Mustache[_0x428d('0x3b')](_0xb91255,_['merge'](_0x3087c7[_0x428d('0x3c')],{'contact':_0x3087c7[_0x428d('0x3d')],'message':_0x3087c7['message'],'agent':_0x3087c7[_0x428d('0x3e')],'interaction':_0x3087c7['interaction'],'account':_0x3087c7[_0x428d('0x3f')]}))||'';}exports[_0x428d('0x40')]=function(_0x57463f,_0x3c7dbf){var _0x1a8651={},_0x16143c={},_0x2b6a02={'count':0x0,'rows':[]};var _0x25e7b6=_[_0x428d('0x41')](db[_0x428d('0x42')][_0x428d('0x43')],function(_0x52fa70){return{'name':_0x52fa70[_0x428d('0x44')],'type':_0x52fa70[_0x428d('0x45')][_0x428d('0x46')]};});_0x16143c[_0x428d('0x47')]=_[_0x428d('0x41')](_0x25e7b6,_0x428d('0x39'));_0x16143c[_0x428d('0x48')]=_[_0x428d('0x49')](_0x57463f['query']);_0x16143c[_0x428d('0x4a')]=_[_0x428d('0x4b')](_0x16143c['model'],_0x16143c[_0x428d('0x48')]);_0x1a8651[_0x428d('0x4c')]=_['intersection'](_0x16143c['model'],qs[_0x428d('0x4d')](_0x57463f[_0x428d('0x48')][_0x428d('0x4d')]));_0x1a8651[_0x428d('0x4c')]=_0x1a8651[_0x428d('0x4c')][_0x428d('0x4e')]?_0x1a8651[_0x428d('0x4c')]:_0x16143c['model'];if(!_0x57463f[_0x428d('0x48')][_0x428d('0x4f')](_0x428d('0x50'))){_0x1a8651[_0x428d('0x2f')]=qs[_0x428d('0x2f')](_0x57463f[_0x428d('0x48')][_0x428d('0x2f')]);_0x1a8651['offset']=qs['offset'](_0x57463f[_0x428d('0x48')]['offset']);}_0x1a8651[_0x428d('0x51')]=qs[_0x428d('0x52')](_0x57463f[_0x428d('0x48')][_0x428d('0x52')]);_0x1a8651[_0x428d('0x53')]=qs[_0x428d('0x4a')](_[_0x428d('0x54')](_0x57463f[_0x428d('0x48')],_0x16143c['filters']),_0x25e7b6);if(_0x57463f[_0x428d('0x48')][_0x428d('0x55')]){_0x1a8651['where']=_[_0x428d('0x56')](_0x1a8651[_0x428d('0x53')],{'$or':_['map'](_0x25e7b6,function(_0x53f5fd){if(_0x53f5fd[_0x428d('0x45')]!=='VIRTUAL'){var _0x3f3384={};_0x3f3384[_0x53f5fd[_0x428d('0x39')]]={'$like':'%'+_0x57463f[_0x428d('0x48')][_0x428d('0x55')]+'%'};return _0x3f3384;}})});}_0x1a8651=_[_0x428d('0x56')]({},_0x1a8651,_0x57463f[_0x428d('0x57')]);var _0xe43133={'where':_0x1a8651[_0x428d('0x53')]};return db[_0x428d('0x42')][_0x428d('0x31')](_0xe43133)['then'](function(_0x2024df){_0x2b6a02[_0x428d('0x31')]=_0x2024df;if(_0x57463f[_0x428d('0x48')][_0x428d('0x58')]){_0x1a8651[_0x428d('0x59')]=[{'all':!![]}];}return db[_0x428d('0x42')][_0x428d('0x5a')](_0x1a8651);})[_0x428d('0x35')](function(_0xa5d678){_0x2b6a02[_0x428d('0x5b')]=_0xa5d678;return _0x2b6a02;})[_0x428d('0x35')](respondWithFilteredResult(_0x3c7dbf,_0x1a8651))['catch'](handleError(_0x3c7dbf,null));};exports[_0x428d('0x5c')]=function(_0xa4a65e,_0x49c57f){var _0xb1e373={'raw':![],'where':{'id':_0xa4a65e[_0x428d('0x5d')]['id']}},_0x589e4d={};_0x589e4d[_0x428d('0x47')]=_[_0x428d('0x49')](db['FreshdeskConfiguration']['rawAttributes']);_0x589e4d['query']=_['keys'](_0xa4a65e[_0x428d('0x48')]);_0x589e4d[_0x428d('0x4a')]=_[_0x428d('0x4b')](_0x589e4d[_0x428d('0x47')],_0x589e4d[_0x428d('0x48')]);_0xb1e373['attributes']=_[_0x428d('0x4b')](_0x589e4d[_0x428d('0x47')],qs[_0x428d('0x4d')](_0xa4a65e[_0x428d('0x48')][_0x428d('0x4d')]));_0xb1e373[_0x428d('0x4c')]=_0xb1e373['attributes'][_0x428d('0x4e')]?_0xb1e373[_0x428d('0x4c')]:_0x589e4d[_0x428d('0x47')];if(_0xa4a65e[_0x428d('0x48')][_0x428d('0x58')]){_0xb1e373[_0x428d('0x59')]=[{'all':!![]}];}_0xb1e373=_[_0x428d('0x56')]({},_0xb1e373,_0xa4a65e[_0x428d('0x57')]);return db[_0x428d('0x42')][_0x428d('0x5e')](_0xb1e373)[_0x428d('0x35')](handleEntityNotFound(_0x49c57f,null))['then'](respondWithResult(_0x49c57f,null))[_0x428d('0x2a')](handleError(_0x49c57f,null));};exports[_0x428d('0x5f')]=function(_0xfb51bf,_0x52396c){return db[_0x428d('0x42')][_0x428d('0x5f')](_0xfb51bf[_0x428d('0x3c')],{})['then'](respondWithResult(_0x52396c,0xc9))[_0x428d('0x2a')](handleError(_0x52396c,null));};exports['update']=function(_0x1c1fbd,_0x10b4aa){if(_0x1c1fbd[_0x428d('0x3c')]['id']){delete _0x1c1fbd[_0x428d('0x3c')]['id'];}return db[_0x428d('0x42')][_0x428d('0x5e')]({'where':{'id':_0x1c1fbd[_0x428d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x10b4aa,null))[_0x428d('0x35')](saveUpdates(_0x1c1fbd[_0x428d('0x3c')],null))[_0x428d('0x35')](respondWithResult(_0x10b4aa,null))[_0x428d('0x2a')](handleError(_0x10b4aa,null));};exports[_0x428d('0x36')]=function(_0x17223a,_0x539660){return db['FreshdeskConfiguration'][_0x428d('0x5e')]({'where':{'id':_0x17223a[_0x428d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x539660,null))[_0x428d('0x35')](removeEntity(_0x539660,null))[_0x428d('0x2a')](handleError(_0x539660,null));};exports[_0x428d('0x60')]=function(_0x443cfc,_0x2b5c97,_0x1333ff){var _0x4dda80={};var _0x116cf0={};var _0x15137d;var _0x2a075a;return db[_0x428d('0x42')][_0x428d('0x61')]({'where':{'id':_0x443cfc['params']['id']}})[_0x428d('0x35')](handleEntityNotFound(_0x2b5c97,null))[_0x428d('0x35')](function(_0x151fc5){if(_0x151fc5){_0x15137d=_0x151fc5;_0x116cf0['model']=_[_0x428d('0x49')](db[_0x428d('0x62')][_0x428d('0x43')]);_0x116cf0[_0x428d('0x48')]=_[_0x428d('0x49')](_0x443cfc[_0x428d('0x48')]);_0x116cf0['filters']=_[_0x428d('0x4b')](_0x116cf0['model'],_0x116cf0['query']);_0x4dda80[_0x428d('0x4c')]=_[_0x428d('0x4b')](_0x116cf0[_0x428d('0x47')],qs[_0x428d('0x4d')](_0x443cfc[_0x428d('0x48')][_0x428d('0x4d')]));_0x4dda80[_0x428d('0x4c')]=_0x4dda80[_0x428d('0x4c')][_0x428d('0x4e')]?_0x4dda80[_0x428d('0x4c')]:_0x116cf0[_0x428d('0x47')];_0x4dda80['order']=qs[_0x428d('0x52')](_0x443cfc[_0x428d('0x48')][_0x428d('0x52')]);_0x4dda80[_0x428d('0x53')]=qs[_0x428d('0x4a')](_[_0x428d('0x54')](_0x443cfc['query'],_0x116cf0[_0x428d('0x4a')]));if(_0x443cfc['query'][_0x428d('0x55')]){_0x4dda80[_0x428d('0x53')]=_[_0x428d('0x56')](_0x4dda80[_0x428d('0x53')],{'$or':_[_0x428d('0x41')](_0x4dda80[_0x428d('0x4c')],function(_0x5b19be){var _0x5f122b={};_0x5f122b[_0x5b19be]={'$like':'%'+_0x443cfc['query'][_0x428d('0x55')]+'%'};return _0x5f122b;})});}_0x4dda80=_[_0x428d('0x56')]({},_0x4dda80,_0x443cfc[_0x428d('0x57')]);return _0x15137d['getFields'](_0x4dda80);}})[_0x428d('0x35')](function(_0x164bf7){if(_0x164bf7){_0x2a075a=_0x164bf7[_0x428d('0x4e')];if(!_0x443cfc[_0x428d('0x48')][_0x428d('0x4f')]('nolimit')){_0x4dda80[_0x428d('0x2f')]=qs['limit'](_0x443cfc[_0x428d('0x48')][_0x428d('0x2f')]);_0x4dda80[_0x428d('0x2e')]=qs['offset'](_0x443cfc[_0x428d('0x48')][_0x428d('0x2e')]);}return _0x15137d[_0x428d('0x60')](_0x4dda80);}})[_0x428d('0x35')](function(_0x30cc06){if(_0x30cc06){return _0x30cc06?{'count':_0x2a075a,'rows':_0x30cc06}:null;}})['then'](respondWithResult(_0x2b5c97,null))[_0x428d('0x2a')](handleError(_0x2b5c97,null));};exports[_0x428d('0x63')]=function(_0x14744a,_0x4fa133,_0x5694ef){var _0x4e5681={};var _0x5cdbb4={};var _0x395511;var _0x142426;return db['FreshdeskConfiguration'][_0x428d('0x61')]({'where':{'id':_0x14744a[_0x428d('0x5d')]['id']}})[_0x428d('0x35')](handleEntityNotFound(_0x4fa133,null))[_0x428d('0x35')](function(_0x26b34f){if(_0x26b34f){_0x395511=_0x26b34f;_0x5cdbb4['model']=_[_0x428d('0x49')](db[_0x428d('0x62')][_0x428d('0x43')]);_0x5cdbb4[_0x428d('0x48')]=_[_0x428d('0x49')](_0x14744a['query']);_0x5cdbb4[_0x428d('0x4a')]=_[_0x428d('0x4b')](_0x5cdbb4[_0x428d('0x47')],_0x5cdbb4['query']);_0x4e5681[_0x428d('0x4c')]=_[_0x428d('0x4b')](_0x5cdbb4[_0x428d('0x47')],qs[_0x428d('0x4d')](_0x14744a[_0x428d('0x48')][_0x428d('0x4d')]));_0x4e5681['attributes']=_0x4e5681[_0x428d('0x4c')][_0x428d('0x4e')]?_0x4e5681[_0x428d('0x4c')]:_0x5cdbb4[_0x428d('0x47')];_0x4e5681[_0x428d('0x51')]=qs[_0x428d('0x52')](_0x14744a['query'][_0x428d('0x52')]);_0x4e5681[_0x428d('0x53')]=qs[_0x428d('0x4a')](_[_0x428d('0x54')](_0x14744a[_0x428d('0x48')],_0x5cdbb4[_0x428d('0x4a')]));if(_0x14744a[_0x428d('0x48')][_0x428d('0x55')]){_0x4e5681['where']=_['merge'](_0x4e5681[_0x428d('0x53')],{'$or':_['map'](_0x4e5681['attributes'],function(_0x596178){var _0x17c7ad={};_0x17c7ad[_0x596178]={'$like':'%'+_0x14744a[_0x428d('0x48')]['filter']+'%'};return _0x17c7ad;})});}_0x4e5681=_[_0x428d('0x56')]({},_0x4e5681,_0x14744a['options']);return _0x395511['getSubjects'](_0x4e5681);}})[_0x428d('0x35')](function(_0x1766f6){if(_0x1766f6){_0x142426=_0x1766f6[_0x428d('0x4e')];if(!_0x14744a['query'][_0x428d('0x4f')](_0x428d('0x50'))){_0x4e5681[_0x428d('0x2f')]=qs[_0x428d('0x2f')](_0x14744a[_0x428d('0x48')][_0x428d('0x2f')]);_0x4e5681[_0x428d('0x2e')]=qs[_0x428d('0x2e')](_0x14744a[_0x428d('0x48')]['offset']);}return _0x395511['getSubjects'](_0x4e5681);}})[_0x428d('0x35')](function(_0x913ecc){if(_0x913ecc){return _0x913ecc?{'count':_0x142426,'rows':_0x913ecc}:null;}})[_0x428d('0x35')](respondWithResult(_0x4fa133,null))[_0x428d('0x2a')](handleError(_0x4fa133,null));};exports[_0x428d('0x64')]=function(_0x5cfb15,_0x2b3cc3,_0xdd3221){var _0x5b98c5={};var _0x5938fe={};var _0x3c632b;var _0x16bbd1;return db[_0x428d('0x42')]['findOne']({'where':{'id':_0x5cfb15['params']['id']}})[_0x428d('0x35')](handleEntityNotFound(_0x2b3cc3,null))[_0x428d('0x35')](function(_0x5f0783){if(_0x5f0783){_0x3c632b=_0x5f0783;_0x5938fe[_0x428d('0x47')]=_['keys'](db[_0x428d('0x62')][_0x428d('0x43')]);_0x5938fe['query']=_[_0x428d('0x49')](_0x5cfb15[_0x428d('0x48')]);_0x5938fe[_0x428d('0x4a')]=_[_0x428d('0x4b')](_0x5938fe[_0x428d('0x47')],_0x5938fe[_0x428d('0x48')]);_0x5b98c5[_0x428d('0x4c')]=_[_0x428d('0x4b')](_0x5938fe['model'],qs['fields'](_0x5cfb15[_0x428d('0x48')][_0x428d('0x4d')]));_0x5b98c5[_0x428d('0x4c')]=_0x5b98c5[_0x428d('0x4c')][_0x428d('0x4e')]?_0x5b98c5[_0x428d('0x4c')]:_0x5938fe[_0x428d('0x47')];_0x5b98c5[_0x428d('0x51')]=qs[_0x428d('0x52')](_0x5cfb15[_0x428d('0x48')][_0x428d('0x52')]);_0x5b98c5[_0x428d('0x53')]=qs['filters'](_[_0x428d('0x54')](_0x5cfb15[_0x428d('0x48')],_0x5938fe[_0x428d('0x4a')]));if(_0x5cfb15[_0x428d('0x48')]['filter']){_0x5b98c5[_0x428d('0x53')]=_[_0x428d('0x56')](_0x5b98c5[_0x428d('0x53')],{'$or':_[_0x428d('0x41')](_0x5b98c5[_0x428d('0x4c')],function(_0x44494c){var _0x3c7802={};_0x3c7802[_0x44494c]={'$like':'%'+_0x5cfb15[_0x428d('0x48')][_0x428d('0x55')]+'%'};return _0x3c7802;})});}_0x5b98c5=_[_0x428d('0x56')]({},_0x5b98c5,_0x5cfb15[_0x428d('0x57')]);return _0x3c632b['getDescriptions'](_0x5b98c5);}})[_0x428d('0x35')](function(_0x1a2a4f){if(_0x1a2a4f){_0x16bbd1=_0x1a2a4f[_0x428d('0x4e')];if(!_0x5cfb15[_0x428d('0x48')][_0x428d('0x4f')](_0x428d('0x50'))){_0x5b98c5[_0x428d('0x2f')]=qs[_0x428d('0x2f')](_0x5cfb15[_0x428d('0x48')]['limit']);_0x5b98c5['offset']=qs[_0x428d('0x2e')](_0x5cfb15[_0x428d('0x48')][_0x428d('0x2e')]);}return _0x3c632b['getDescriptions'](_0x5b98c5);}})[_0x428d('0x35')](function(_0x1681fc){if(_0x1681fc){return _0x1681fc?{'count':_0x16bbd1,'rows':_0x1681fc}:null;}})[_0x428d('0x35')](respondWithResult(_0x2b3cc3,null))[_0x428d('0x2a')](handleError(_0x2b3cc3,null));};exports[_0x428d('0x65')]=function(_0x219f29,_0x1e1b31,_0x3ef136){var _0x2746fd={};var _0x484e93={};var _0x18f175;var _0x52af16;return db[_0x428d('0x42')][_0x428d('0x61')]({'where':{'id':_0x219f29[_0x428d('0x5d')]['id']}})[_0x428d('0x35')](handleEntityNotFound(_0x1e1b31,null))[_0x428d('0x35')](function(_0xb45418){if(_0xb45418){_0x18f175=_0xb45418;_0x484e93[_0x428d('0x47')]=_[_0x428d('0x49')](db[_0x428d('0x66')][_0x428d('0x43')]);_0x484e93[_0x428d('0x48')]=_[_0x428d('0x49')](_0x219f29[_0x428d('0x48')]);_0x484e93[_0x428d('0x4a')]=_[_0x428d('0x4b')](_0x484e93['model'],_0x484e93[_0x428d('0x48')]);_0x2746fd[_0x428d('0x4c')]=_[_0x428d('0x4b')](_0x484e93[_0x428d('0x47')],qs['fields'](_0x219f29['query'][_0x428d('0x4d')]));_0x2746fd[_0x428d('0x4c')]=_0x2746fd['attributes'][_0x428d('0x4e')]?_0x2746fd[_0x428d('0x4c')]:_0x484e93[_0x428d('0x47')];_0x2746fd[_0x428d('0x51')]=qs['sort'](_0x219f29[_0x428d('0x48')][_0x428d('0x52')]);_0x2746fd[_0x428d('0x53')]=qs[_0x428d('0x4a')](_[_0x428d('0x54')](_0x219f29['query'],_0x484e93['filters']));if(_0x219f29[_0x428d('0x48')][_0x428d('0x55')]){_0x2746fd['where']=_[_0x428d('0x56')](_0x2746fd[_0x428d('0x53')],{'$or':_['map'](_0x2746fd[_0x428d('0x4c')],function(_0x599949){var _0x5d60f3={};_0x5d60f3[_0x599949]={'$like':'%'+_0x219f29['query'][_0x428d('0x55')]+'%'};return _0x5d60f3;})});}_0x2746fd=_['merge']({},_0x2746fd,_0x219f29[_0x428d('0x57')]);return _0x18f175['getTags'](_0x2746fd);}})[_0x428d('0x35')](function(_0x1217b6){if(_0x1217b6){_0x52af16=_0x1217b6[_0x428d('0x4e')];if(!_0x219f29['query']['hasOwnProperty'](_0x428d('0x50'))){_0x2746fd[_0x428d('0x2f')]=qs['limit'](_0x219f29[_0x428d('0x48')][_0x428d('0x2f')]);_0x2746fd[_0x428d('0x2e')]=qs[_0x428d('0x2e')](_0x219f29[_0x428d('0x48')][_0x428d('0x2e')]);}return _0x18f175[_0x428d('0x65')](_0x2746fd);}})[_0x428d('0x35')](function(_0x187ccf){if(_0x187ccf){return _0x187ccf?{'count':_0x52af16,'rows':_0x187ccf}:null;}})['then'](respondWithResult(_0x1e1b31,null))[_0x428d('0x2a')](handleError(_0x1e1b31,null));};exports[_0x428d('0x67')]=function(_0x58f829,_0x5b5050,_0x21d34c){if(_0x58f829[_0x428d('0x3c')]['id']){delete _0x58f829[_0x428d('0x3c')]['id'];}return db['FreshdeskConfiguration'][_0x428d('0x61')]({'where':{'id':_0x58f829[_0x428d('0x5d')]['id']}})[_0x428d('0x35')](handleEntityNotFound(_0x5b5050,null))[_0x428d('0x35')](function(_0x54cb74){if(_0x54cb74){return _0x54cb74[_0x428d('0x67')](_0x58f829[_0x428d('0x3c')][_0x428d('0x68')]||[]);}return null;})['then'](respondWithResult(_0x5b5050,null))[_0x428d('0x2a')](handleError(_0x5b5050,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c190067..41afc8d 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb647=['int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb647,0x119));var _0x7b64=function(_0xdf7918,_0x2ed746){_0xdf7918=_0xdf7918-0x0;var _0x485651=_0xb647[_0xdf7918];return _0x485651;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var logger=require(_0x7b64('0x2'))(_0x7b64('0x3'));var moment=require(_0x7b64('0x4'));var BPromise=require(_0x7b64('0x5'));var rp=require(_0x7b64('0x6'));var fs=require('fs');var path=require(_0x7b64('0x7'));var rimraf=require(_0x7b64('0x8'));var config=require(_0x7b64('0x9'));var attributes=require(_0x7b64('0xa'));module['exports']=function(_0x42b12a,_0x2e2633){return _0x42b12a[_0x7b64('0xb')](_0x7b64('0xc'),attributes,{'tableName':_0x7b64('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc282=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration'];(function(_0x1d391b,_0x5eb124){var _0x4ee328=function(_0x4dec93){while(--_0x4dec93){_0x1d391b['push'](_0x1d391b['shift']());}};_0x4ee328(++_0x5eb124);}(_0xc282,0x12c));var _0x2c28=function(_0xbf3b03,_0x76e67){_0xbf3b03=_0xbf3b03-0x0;var _0x154d9d=_0xc282[_0xbf3b03];return _0x154d9d;};'use strict';var _=require('lodash');var util=require(_0x2c28('0x0'));var logger=require(_0x2c28('0x1'))(_0x2c28('0x2'));var moment=require('moment');var BPromise=require(_0x2c28('0x3'));var rp=require(_0x2c28('0x4'));var fs=require('fs');var path=require(_0x2c28('0x5'));var rimraf=require(_0x2c28('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c28('0x7'));module['exports']=function(_0x2b0c36,_0x47e67d){return _0x2b0c36[_0x2c28('0x8')](_0x2c28('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 005a944..7442115 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd16=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x38c874,_0x4e0365){var _0x59bf52=function(_0x544692){while(--_0x544692){_0x38c874['push'](_0x38c874['shift']());}};_0x59bf52(++_0x4e0365);}(_0xdd16,0x1ed));var _0x6dd1=function(_0x870b1e,_0x58c16e){_0x870b1e=_0x870b1e-0x0;var _0x3a63b0=_0xdd16[_0x870b1e];return _0x3a63b0;};'use strict';var _=require(_0x6dd1('0x0'));var util=require(_0x6dd1('0x1'));var moment=require('moment');var BPromise=require(_0x6dd1('0x2'));var rs=require(_0x6dd1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6dd1('0x4'));var logger=require(_0x6dd1('0x5'))('rpc');var config=require(_0x6dd1('0x6'));var jayson=require(_0x6dd1('0x7'));var client=jayson[_0x6dd1('0x8')][_0x6dd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d4d3,_0x1e2fc9,_0xc3864f){return new BPromise(function(_0x2df023,_0x44735d){return client[_0x6dd1('0xa')](_0x52d4d3,_0xc3864f)['then'](function(_0x1df70e){logger[_0x6dd1('0xb')](_0x6dd1('0xc'),_0x1e2fc9,_0x6dd1('0xd'));logger[_0x6dd1('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1e2fc9,_0x6dd1('0xd'),JSON[_0x6dd1('0xf')](_0x1df70e));if(_0x1df70e[_0x6dd1('0x10')]){if(_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x11')]===0x1f4){logger[_0x6dd1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);return _0x44735d(_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);}logger[_0x6dd1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);return _0x2df023(_0x1df70e[_0x6dd1('0x10')][_0x6dd1('0x12')]);}else{logger[_0x6dd1('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x6dd1('0xd'));_0x2df023(_0x1df70e[_0x6dd1('0x13')][_0x6dd1('0x12')]);}})[_0x6dd1('0x14')](function(_0x4e3a68){logger[_0x6dd1('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e2fc9,_0x4e3a68);_0x44735d(_0x4e3a68);});});} \ No newline at end of file +var _0x1e06=['FreshdeskConfiguration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e06,0x13c));var _0x61e0=function(_0x2b9efb,_0x1bdadc){_0x2b9efb=_0x2b9efb-0x0;var _0x4db5b2=_0x1e06[_0x2b9efb];return _0x4db5b2;};'use strict';var _=require(_0x61e0('0x0'));var util=require(_0x61e0('0x1'));var moment=require(_0x61e0('0x2'));var BPromise=require(_0x61e0('0x3'));var rs=require(_0x61e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61e0('0x5'))['db'];var utils=require(_0x61e0('0x6'));var logger=require('../../config/logger')(_0x61e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x61e0('0x8'));var client=jayson[_0x61e0('0x9')][_0x61e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e6710,_0x38455a,_0x3b3639){return new BPromise(function(_0x518455,_0x46de31){return client[_0x61e0('0xb')](_0x2e6710,_0x3b3639)[_0x61e0('0xc')](function(_0x4ea3c3){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x38455a,_0x61e0('0xd'));logger[_0x61e0('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x38455a,'request\x20sent',JSON[_0x61e0('0xf')](_0x4ea3c3));if(_0x4ea3c3['error']){if(_0x4ea3c3[_0x61e0('0x10')][_0x61e0('0x11')]===0x1f4){logger[_0x61e0('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x38455a,_0x4ea3c3[_0x61e0('0x10')]['message']);return _0x46de31(_0x4ea3c3[_0x61e0('0x10')][_0x61e0('0x12')]);}logger[_0x61e0('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x38455a,_0x4ea3c3['error'][_0x61e0('0x12')]);return _0x518455(_0x4ea3c3['error']['message']);}else{logger[_0x61e0('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x38455a,_0x61e0('0xd'));_0x518455(_0x4ea3c3['result']['message']);}})['catch'](function(_0x3dc6de){logger[_0x61e0('0x10')](_0x61e0('0x14'),_0x38455a,_0x3dc6de);_0x46de31(_0x3dc6de);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 9bf4421..bd31c7b 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bf1=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x399ca8,_0x5b6ff3){var _0x4a4530=function(_0x5c9585){while(--_0x5c9585){_0x399ca8['push'](_0x399ca8['shift']());}};_0x4a4530(++_0x5b6ff3);}(_0x8bf1,0x187));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x18bf('0x0'));var path=require(_0x18bf('0x1'));var timeout=require(_0x18bf('0x2'));var express=require(_0x18bf('0x3'));var router=express[_0x18bf('0x4')]();var fs_extra=require(_0x18bf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x18bf('0x6'));var controller=require(_0x18bf('0x7'));router[_0x18bf('0x8')]('/',auth[_0x18bf('0x9')](),controller['index']);router[_0x18bf('0x8')](_0x18bf('0xa'),auth[_0x18bf('0x9')](),controller[_0x18bf('0xb')]);router[_0x18bf('0xc')]('/',auth[_0x18bf('0x9')](),controller[_0x18bf('0xd')]);router[_0x18bf('0xe')]('/:id',auth[_0x18bf('0x9')](),controller[_0x18bf('0xf')]);router[_0x18bf('0x10')]('/:id',auth[_0x18bf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x63f4=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x63f4,0xfa));var _0x463f=function(_0x1a9a90,_0x31977b){_0x1a9a90=_0x1a9a90-0x0;var _0x113cb8=_0x63f4[_0x1a9a90];return _0x113cb8;};'use strict';var multer=require(_0x463f('0x0'));var util=require(_0x463f('0x1'));var path=require(_0x463f('0x2'));var timeout=require('connect-timeout');var express=require(_0x463f('0x3'));var router=express['Router']();var fs_extra=require(_0x463f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x463f('0x5'));var config=require(_0x463f('0x6'));var controller=require(_0x463f('0x7'));router[_0x463f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x463f('0x8')](_0x463f('0x9'),auth[_0x463f('0xa')](),controller['show']);router[_0x463f('0xb')]('/',auth[_0x463f('0xa')](),controller['create']);router[_0x463f('0xc')](_0x463f('0x9'),auth[_0x463f('0xa')](),controller[_0x463f('0xd')]);router[_0x463f('0xe')](_0x463f('0x9'),auth['isAuthenticated'](),controller[_0x463f('0xf')]);module[_0x463f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f56884e..a88c01d 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ce3=['keyValue','picklist','STRING','sequelize','exports','string','variable','customVariable'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x8ce3,0xc3));var _0x38ce=function(_0x1b3251,_0x58f958){_0x1b3251=_0x1b3251-0x0;var _0x370769=_0x8ce3[_0x1b3251];return _0x370769;};'use strict';var Sequelize=require(_0x38ce('0x0'));module[_0x38ce('0x1')]={'type':{'type':Sequelize['ENUM'](_0x38ce('0x2'),_0x38ce('0x3'),_0x38ce('0x4'),_0x38ce('0x5'),_0x38ce('0x6')),'defaultValue':_0x38ce('0x2')},'content':{'type':Sequelize[_0x38ce('0x7')]},'key':{'type':Sequelize[_0x38ce('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x38ce('0x2'),_0x38ce('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x38ce('0x7')]},'idField':{'type':Sequelize[_0x38ce('0x7')]},'nameField':{'type':Sequelize[_0x38ce('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x38ce('0x7')]}}; \ No newline at end of file +var _0xb28a=['BOOLEAN','exports','ENUM','variable','string','STRING','customVariable'];(function(_0x45dbcc,_0x516621){var _0x5e3042=function(_0x1d60f3){while(--_0x1d60f3){_0x45dbcc['push'](_0x45dbcc['shift']());}};_0x5e3042(++_0x516621);}(_0xb28a,0x166));var _0xab28=function(_0x3e19fd,_0x41e593){_0x3e19fd=_0x3e19fd-0x0;var _0x56e530=_0xb28a[_0x3e19fd];return _0x56e530;};'use strict';var Sequelize=require('sequelize');module[_0xab28('0x0')]={'type':{'type':Sequelize[_0xab28('0x1')]('string',_0xab28('0x2'),'customVariable','keyValue','picklist'),'defaultValue':_0xab28('0x3')},'content':{'type':Sequelize[_0xab28('0x4')]},'key':{'type':Sequelize[_0xab28('0x4')]},'keyType':{'type':Sequelize[_0xab28('0x1')](_0xab28('0x3'),_0xab28('0x2'),_0xab28('0x5'))},'keyContent':{'type':Sequelize[_0xab28('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xab28('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab28('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 56bcc21..c375d6b 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x424b=['undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','send','render','merge','body','contact','message','interaction','account','map','FreshdeskField','rawAttributes','type','name','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','includeAll','include','findAll','rows','catch','keys','fields','length','options','create','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset'];(function(_0x54ba07,_0x763a12){var _0x277595=function(_0x2f9fd4){while(--_0x2f9fd4){_0x54ba07['push'](_0x54ba07['shift']());}};_0x277595(++_0x763a12);}(_0x424b,0x7c));var _0xb424=function(_0x46b7c4,_0x119ebc){_0x46b7c4=_0x46b7c4-0x0;var _0x7ab83=_0x424b[_0x46b7c4];return _0x7ab83;};'use strict';var emlformat=require(_0xb424('0x0'));var rimraf=require(_0xb424('0x1'));var zipdir=require(_0xb424('0x2'));var jsonpatch=require(_0xb424('0x3'));var rp=require(_0xb424('0x4'));var moment=require(_0xb424('0x5'));var BPromise=require(_0xb424('0x6'));var Mustache=require(_0xb424('0x7'));var util=require(_0xb424('0x8'));var path=require(_0xb424('0x9'));var sox=require(_0xb424('0xa'));var csv=require(_0xb424('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb424('0xc'));var _=require(_0xb424('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb424('0xe'));var deskjs=require(_0xb424('0xf'));var toCsv=require(_0xb424('0xb'));var querystring=require(_0xb424('0x10'));var Papa=require(_0xb424('0x11'));var Redis=require(_0xb424('0x12'));var authService=require(_0xb424('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb424('0x14'));var utils=require(_0xb424('0x15'));var config=require(_0xb424('0x16'));var licenseUtil=require(_0xb424('0x17'));var db=require(_0xb424('0x18'))['db'];function respondWithStatusCode(_0x5cf6e9,_0x4a73c5){_0x4a73c5=_0x4a73c5||0xcc;return function(_0x47ea1b){if(_0x47ea1b){return _0x5cf6e9[_0xb424('0x19')](_0x4a73c5);}return _0x5cf6e9[_0xb424('0x1a')](_0x4a73c5)['end']();};}function respondWithResult(_0x560e53,_0x15a864){_0x15a864=_0x15a864||0xc8;return function(_0x317a64){if(_0x317a64){return _0x560e53[_0xb424('0x1a')](_0x15a864)['json'](_0x317a64);}};}function respondWithFilteredResult(_0x2b022c,_0x5d5929){return function(_0x572286){if(_0x572286){var _0x33bf5f=typeof _0x5d5929[_0xb424('0x1b')]===_0xb424('0x1c')&&typeof _0x5d5929['limit']===_0xb424('0x1c');var _0x11fd59=_0x572286[_0xb424('0x1d')];var _0x52413b=_0x33bf5f?0x0:_0x5d5929[_0xb424('0x1b')];var _0x2e6081=_0x33bf5f?_0x572286[_0xb424('0x1d')]:_0x5d5929[_0xb424('0x1b')]+_0x5d5929[_0xb424('0x1e')];var _0x33a4ca;if(_0x2e6081>=_0x11fd59){_0x2e6081=_0x11fd59;_0x33a4ca=0xc8;}else{_0x33a4ca=0xce;}_0x2b022c[_0xb424('0x1a')](_0x33a4ca);return _0x2b022c[_0xb424('0x1f')](_0xb424('0x20'),_0x52413b+'-'+_0x2e6081+'/'+_0x11fd59)['json'](_0x572286);}return null;};}function patchUpdates(_0x38c535){return function(_0x25c0f8){try{jsonpatch[_0xb424('0x21')](_0x25c0f8,_0x38c535,!![]);}catch(_0x20d8e4){return BPromise['reject'](_0x20d8e4);}return _0x25c0f8[_0xb424('0x22')]();};}function saveUpdates(_0x2d690f,_0x3917ba){return function(_0x331c99){if(_0x331c99){return _0x331c99[_0xb424('0x23')](_0x2d690f)[_0xb424('0x24')](function(_0x41a18b){return _0x41a18b;});}return null;};}function removeEntity(_0x241c3d,_0x3c2574){return function(_0x1eecd1){if(_0x1eecd1){return _0x1eecd1['destroy']()[_0xb424('0x24')](function(){_0x241c3d[_0xb424('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473387,_0x44f9cf){return function(_0x4eaac4){if(!_0x4eaac4){_0x473387[_0xb424('0x19')](0x194);}return _0x4eaac4;};}function handleError(_0x454f1c,_0x5f108c){_0x5f108c=_0x5f108c||0x1f4;return function(_0x4b97cd){logger[_0xb424('0x25')](_0x4b97cd[_0xb424('0x26')]);if(_0x4b97cd['name']){delete _0x4b97cd['name'];}_0x454f1c[_0xb424('0x1a')](_0x5f108c)[_0xb424('0x27')](_0x4b97cd);};}function getMustacheRender(_0x3f0de0,_0x1cd2c3){return Mustache[_0xb424('0x28')](_0x3f0de0,_[_0xb424('0x29')](_0x1cd2c3[_0xb424('0x2a')],{'contact':_0x1cd2c3[_0xb424('0x2b')],'message':_0x1cd2c3[_0xb424('0x2c')],'agent':_0x1cd2c3['agent'],'interaction':_0x1cd2c3[_0xb424('0x2d')],'account':_0x1cd2c3[_0xb424('0x2e')]}))||'';}exports['index']=function(_0x28a574,_0x18b242){var _0x1c6381={},_0x39f09f={},_0x3c6b9a={'count':0x0,'rows':[]};var _0x4ac34c=_[_0xb424('0x2f')](db[_0xb424('0x30')][_0xb424('0x31')],function(_0x3710dd){return{'name':_0x3710dd['fieldName'],'type':_0x3710dd[_0xb424('0x32')]['key']};});_0x39f09f['model']=_[_0xb424('0x2f')](_0x4ac34c,_0xb424('0x33'));_0x39f09f['query']=_['keys'](_0x28a574['query']);_0x39f09f['filters']=_[_0xb424('0x34')](_0x39f09f[_0xb424('0x35')],_0x39f09f[_0xb424('0x36')]);_0x1c6381['attributes']=_[_0xb424('0x34')](_0x39f09f[_0xb424('0x35')],qs['fields'](_0x28a574['query']['fields']));_0x1c6381[_0xb424('0x37')]=_0x1c6381['attributes']['length']?_0x1c6381[_0xb424('0x37')]:_0x39f09f[_0xb424('0x35')];if(!_0x28a574[_0xb424('0x36')][_0xb424('0x38')](_0xb424('0x39'))){_0x1c6381[_0xb424('0x1e')]=qs[_0xb424('0x1e')](_0x28a574[_0xb424('0x36')][_0xb424('0x1e')]);_0x1c6381[_0xb424('0x1b')]=qs[_0xb424('0x1b')](_0x28a574[_0xb424('0x36')]['offset']);}_0x1c6381[_0xb424('0x3a')]=qs[_0xb424('0x3b')](_0x28a574[_0xb424('0x36')]['sort']);_0x1c6381[_0xb424('0x3c')]=qs['filters'](_[_0xb424('0x3d')](_0x28a574[_0xb424('0x36')],_0x39f09f[_0xb424('0x3e')]),_0x4ac34c);if(_0x28a574[_0xb424('0x36')]['filter']){_0x1c6381[_0xb424('0x3c')]=_[_0xb424('0x29')](_0x1c6381[_0xb424('0x3c')],{'$or':_[_0xb424('0x2f')](_0x4ac34c,function(_0x3df53e){if(_0x3df53e[_0xb424('0x32')]!==_0xb424('0x3f')){var _0x44a026={};_0x44a026[_0x3df53e[_0xb424('0x33')]]={'$like':'%'+_0x28a574[_0xb424('0x36')][_0xb424('0x40')]+'%'};return _0x44a026;}})});}_0x1c6381=_[_0xb424('0x29')]({},_0x1c6381,_0x28a574['options']);var _0x57fc44={'where':_0x1c6381[_0xb424('0x3c')]};return db[_0xb424('0x30')][_0xb424('0x1d')](_0x57fc44)[_0xb424('0x24')](function(_0x483e7e){_0x3c6b9a[_0xb424('0x1d')]=_0x483e7e;if(_0x28a574[_0xb424('0x36')][_0xb424('0x41')]){_0x1c6381[_0xb424('0x42')]=[{'all':!![]}];}return db[_0xb424('0x30')][_0xb424('0x43')](_0x1c6381);})[_0xb424('0x24')](function(_0x51053e){_0x3c6b9a[_0xb424('0x44')]=_0x51053e;return _0x3c6b9a;})['then'](respondWithFilteredResult(_0x18b242,_0x1c6381))[_0xb424('0x45')](handleError(_0x18b242,null));};exports['show']=function(_0x57fbe2,_0x511619){var _0xd2f137={'raw':!![],'where':{'id':_0x57fbe2['params']['id']}},_0x2c138d={};_0x2c138d['model']=_[_0xb424('0x46')](db[_0xb424('0x30')][_0xb424('0x31')]);_0x2c138d[_0xb424('0x36')]=_[_0xb424('0x46')](_0x57fbe2[_0xb424('0x36')]);_0x2c138d['filters']=_['intersection'](_0x2c138d[_0xb424('0x35')],_0x2c138d[_0xb424('0x36')]);_0xd2f137[_0xb424('0x37')]=_['intersection'](_0x2c138d[_0xb424('0x35')],qs[_0xb424('0x47')](_0x57fbe2[_0xb424('0x36')][_0xb424('0x47')]));_0xd2f137[_0xb424('0x37')]=_0xd2f137['attributes'][_0xb424('0x48')]?_0xd2f137[_0xb424('0x37')]:_0x2c138d[_0xb424('0x35')];if(_0x57fbe2[_0xb424('0x36')]['includeAll']){_0xd2f137['include']=[{'all':!![]}];}_0xd2f137=_[_0xb424('0x29')]({},_0xd2f137,_0x57fbe2[_0xb424('0x49')]);return db[_0xb424('0x30')]['find'](_0xd2f137)[_0xb424('0x24')](handleEntityNotFound(_0x511619,null))[_0xb424('0x24')](respondWithResult(_0x511619,null))[_0xb424('0x45')](handleError(_0x511619,null));};exports[_0xb424('0x4a')]=function(_0x5e0847,_0x3d5fb2){return db[_0xb424('0x30')][_0xb424('0x4a')](_0x5e0847[_0xb424('0x2a')],{})[_0xb424('0x24')](respondWithResult(_0x3d5fb2,0xc9))[_0xb424('0x45')](handleError(_0x3d5fb2,null));};exports[_0xb424('0x23')]=function(_0x172f14,_0x551491){if(_0x172f14['body']['id']){delete _0x172f14[_0xb424('0x2a')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x172f14['params']['id']}})[_0xb424('0x24')](handleEntityNotFound(_0x551491,null))['then'](saveUpdates(_0x172f14[_0xb424('0x2a')],null))['then'](respondWithResult(_0x551491,null))['catch'](handleError(_0x551491,null));};exports['destroy']=function(_0x338349,_0x3c9ce8){return db[_0xb424('0x30')]['find']({'where':{'id':_0x338349[_0xb424('0x4b')]['id']}})[_0xb424('0x24')](handleEntityNotFound(_0x3c9ce8,null))[_0xb424('0x24')](removeEntity(_0x3c9ce8,null))[_0xb424('0x45')](handleError(_0x3c9ce8,null));}; \ No newline at end of file +var _0xddb9=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','render','merge','message','interaction','account','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','count','findAll','rows','catch','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0xfac521,_0x42cbc1){var _0x1a19a5=function(_0x3e6fa1){while(--_0x3e6fa1){_0xfac521['push'](_0xfac521['shift']());}};_0x1a19a5(++_0x42cbc1);}(_0xddb9,0x16d));var _0x9ddb=function(_0x4f0371,_0x5217c1){_0x4f0371=_0x4f0371-0x0;var _0x12a594=_0xddb9[_0x4f0371];return _0x12a594;};'use strict';var emlformat=require(_0x9ddb('0x0'));var rimraf=require(_0x9ddb('0x1'));var zipdir=require(_0x9ddb('0x2'));var jsonpatch=require(_0x9ddb('0x3'));var rp=require(_0x9ddb('0x4'));var moment=require(_0x9ddb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9ddb('0x6'));var path=require(_0x9ddb('0x7'));var sox=require(_0x9ddb('0x8'));var csv=require(_0x9ddb('0x9'));var ejs=require(_0x9ddb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ddb('0xb'));var squel=require(_0x9ddb('0xc'));var crypto=require(_0x9ddb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9ddb('0xe'));var toCsv=require(_0x9ddb('0x9'));var querystring=require(_0x9ddb('0xf'));var Papa=require(_0x9ddb('0x10'));var Redis=require('ioredis');var authService=require(_0x9ddb('0x11'));var qs=require(_0x9ddb('0x12'));var as=require(_0x9ddb('0x13'));var hardwareService=require(_0x9ddb('0x14'));var logger=require('../../config/logger')(_0x9ddb('0x15'));var utils=require('../../config/utils');var config=require(_0x9ddb('0x16'));var licenseUtil=require(_0x9ddb('0x17'));var db=require(_0x9ddb('0x18'))['db'];function respondWithStatusCode(_0x3c4568,_0x3982ef){_0x3982ef=_0x3982ef||0xcc;return function(_0x39bc1d){if(_0x39bc1d){return _0x3c4568[_0x9ddb('0x19')](_0x3982ef);}return _0x3c4568[_0x9ddb('0x1a')](_0x3982ef)[_0x9ddb('0x1b')]();};}function respondWithResult(_0x536561,_0x3a5385){_0x3a5385=_0x3a5385||0xc8;return function(_0x100e14){if(_0x100e14){return _0x536561[_0x9ddb('0x1a')](_0x3a5385)[_0x9ddb('0x1c')](_0x100e14);}};}function respondWithFilteredResult(_0x3a8cc8,_0x29b4cf){return function(_0x26a6d9){if(_0x26a6d9){var _0x1819bc=typeof _0x29b4cf[_0x9ddb('0x1d')]===_0x9ddb('0x1e')&&typeof _0x29b4cf[_0x9ddb('0x1f')]===_0x9ddb('0x1e');var _0x416058=_0x26a6d9['count'];var _0x463aa6=_0x1819bc?0x0:_0x29b4cf['offset'];var _0x2fb7d5=_0x1819bc?_0x26a6d9['count']:_0x29b4cf[_0x9ddb('0x1d')]+_0x29b4cf[_0x9ddb('0x1f')];var _0xd042d7;if(_0x2fb7d5>=_0x416058){_0x2fb7d5=_0x416058;_0xd042d7=0xc8;}else{_0xd042d7=0xce;}_0x3a8cc8['status'](_0xd042d7);return _0x3a8cc8[_0x9ddb('0x20')](_0x9ddb('0x21'),_0x463aa6+'-'+_0x2fb7d5+'/'+_0x416058)[_0x9ddb('0x1c')](_0x26a6d9);}return null;};}function patchUpdates(_0x5596f6){return function(_0x57f8b0){try{jsonpatch[_0x9ddb('0x22')](_0x57f8b0,_0x5596f6,!![]);}catch(_0x205c30){return BPromise['reject'](_0x205c30);}return _0x57f8b0[_0x9ddb('0x23')]();};}function saveUpdates(_0x12a5bb,_0x49d729){return function(_0x1222ac){if(_0x1222ac){return _0x1222ac[_0x9ddb('0x24')](_0x12a5bb)[_0x9ddb('0x25')](function(_0x38eda3){return _0x38eda3;});}return null;};}function removeEntity(_0x78805b,_0x1f6cdf){return function(_0x2734bc){if(_0x2734bc){return _0x2734bc[_0x9ddb('0x26')]()['then'](function(){_0x78805b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d590e,_0x137614){return function(_0x55b5bb){if(!_0x55b5bb){_0x5d590e[_0x9ddb('0x19')](0x194);}return _0x55b5bb;};}function handleError(_0x6f927d,_0x541074){_0x541074=_0x541074||0x1f4;return function(_0x1e79fa){logger[_0x9ddb('0x27')](_0x1e79fa[_0x9ddb('0x28')]);if(_0x1e79fa[_0x9ddb('0x29')]){delete _0x1e79fa['name'];}_0x6f927d[_0x9ddb('0x1a')](_0x541074)['send'](_0x1e79fa);};}function getMustacheRender(_0x5e93fb,_0x258a25){return Mustache[_0x9ddb('0x2a')](_0x5e93fb,_[_0x9ddb('0x2b')](_0x258a25['body'],{'contact':_0x258a25['contact'],'message':_0x258a25[_0x9ddb('0x2c')],'agent':_0x258a25['agent'],'interaction':_0x258a25[_0x9ddb('0x2d')],'account':_0x258a25[_0x9ddb('0x2e')]}))||'';}exports[_0x9ddb('0x2f')]=function(_0xa4139b,_0x4aa68e){var _0x2fde67={},_0x1390e1={},_0x1d732c={'count':0x0,'rows':[]};var _0x30674b=_[_0x9ddb('0x30')](db[_0x9ddb('0x31')][_0x9ddb('0x32')],function(_0x430d6f){return{'name':_0x430d6f[_0x9ddb('0x33')],'type':_0x430d6f[_0x9ddb('0x34')][_0x9ddb('0x35')]};});_0x1390e1[_0x9ddb('0x36')]=_[_0x9ddb('0x30')](_0x30674b,_0x9ddb('0x29'));_0x1390e1[_0x9ddb('0x37')]=_[_0x9ddb('0x38')](_0xa4139b[_0x9ddb('0x37')]);_0x1390e1[_0x9ddb('0x39')]=_[_0x9ddb('0x3a')](_0x1390e1['model'],_0x1390e1[_0x9ddb('0x37')]);_0x2fde67[_0x9ddb('0x3b')]=_[_0x9ddb('0x3a')](_0x1390e1[_0x9ddb('0x36')],qs[_0x9ddb('0x3c')](_0xa4139b[_0x9ddb('0x37')]['fields']));_0x2fde67[_0x9ddb('0x3b')]=_0x2fde67['attributes'][_0x9ddb('0x3d')]?_0x2fde67[_0x9ddb('0x3b')]:_0x1390e1[_0x9ddb('0x36')];if(!_0xa4139b[_0x9ddb('0x37')]['hasOwnProperty']('nolimit')){_0x2fde67[_0x9ddb('0x1f')]=qs[_0x9ddb('0x1f')](_0xa4139b[_0x9ddb('0x37')]['limit']);_0x2fde67[_0x9ddb('0x1d')]=qs['offset'](_0xa4139b[_0x9ddb('0x37')][_0x9ddb('0x1d')]);}_0x2fde67[_0x9ddb('0x3e')]=qs['sort'](_0xa4139b[_0x9ddb('0x37')][_0x9ddb('0x3f')]);_0x2fde67[_0x9ddb('0x40')]=qs[_0x9ddb('0x39')](_['pick'](_0xa4139b['query'],_0x1390e1[_0x9ddb('0x39')]),_0x30674b);if(_0xa4139b[_0x9ddb('0x37')]['filter']){_0x2fde67[_0x9ddb('0x40')]=_['merge'](_0x2fde67[_0x9ddb('0x40')],{'$or':_[_0x9ddb('0x30')](_0x30674b,function(_0x2513c9){if(_0x2513c9[_0x9ddb('0x34')]!=='VIRTUAL'){var _0xf064a8={};_0xf064a8[_0x2513c9[_0x9ddb('0x29')]]={'$like':'%'+_0xa4139b[_0x9ddb('0x37')][_0x9ddb('0x41')]+'%'};return _0xf064a8;}})});}_0x2fde67=_[_0x9ddb('0x2b')]({},_0x2fde67,_0xa4139b['options']);var _0x510e3c={'where':_0x2fde67[_0x9ddb('0x40')]};return db[_0x9ddb('0x31')]['count'](_0x510e3c)['then'](function(_0x2a0861){_0x1d732c[_0x9ddb('0x42')]=_0x2a0861;if(_0xa4139b[_0x9ddb('0x37')]['includeAll']){_0x2fde67['include']=[{'all':!![]}];}return db[_0x9ddb('0x31')][_0x9ddb('0x43')](_0x2fde67);})[_0x9ddb('0x25')](function(_0x1c6edb){_0x1d732c[_0x9ddb('0x44')]=_0x1c6edb;return _0x1d732c;})[_0x9ddb('0x25')](respondWithFilteredResult(_0x4aa68e,_0x2fde67))[_0x9ddb('0x45')](handleError(_0x4aa68e,null));};exports['show']=function(_0x503941,_0x55813d){var _0xfac3c0={'raw':!![],'where':{'id':_0x503941[_0x9ddb('0x46')]['id']}},_0x322751={};_0x322751[_0x9ddb('0x36')]=_[_0x9ddb('0x38')](db[_0x9ddb('0x31')][_0x9ddb('0x32')]);_0x322751[_0x9ddb('0x37')]=_[_0x9ddb('0x38')](_0x503941[_0x9ddb('0x37')]);_0x322751[_0x9ddb('0x39')]=_[_0x9ddb('0x3a')](_0x322751[_0x9ddb('0x36')],_0x322751[_0x9ddb('0x37')]);_0xfac3c0[_0x9ddb('0x3b')]=_[_0x9ddb('0x3a')](_0x322751[_0x9ddb('0x36')],qs[_0x9ddb('0x3c')](_0x503941['query'][_0x9ddb('0x3c')]));_0xfac3c0[_0x9ddb('0x3b')]=_0xfac3c0[_0x9ddb('0x3b')]['length']?_0xfac3c0['attributes']:_0x322751[_0x9ddb('0x36')];if(_0x503941[_0x9ddb('0x37')]['includeAll']){_0xfac3c0[_0x9ddb('0x47')]=[{'all':!![]}];}_0xfac3c0=_[_0x9ddb('0x2b')]({},_0xfac3c0,_0x503941[_0x9ddb('0x48')]);return db['FreshdeskField'][_0x9ddb('0x49')](_0xfac3c0)[_0x9ddb('0x25')](handleEntityNotFound(_0x55813d,null))[_0x9ddb('0x25')](respondWithResult(_0x55813d,null))[_0x9ddb('0x45')](handleError(_0x55813d,null));};exports[_0x9ddb('0x4a')]=function(_0x4e02b3,_0x361a3f){return db[_0x9ddb('0x31')][_0x9ddb('0x4a')](_0x4e02b3['body'],{})[_0x9ddb('0x25')](respondWithResult(_0x361a3f,0xc9))[_0x9ddb('0x45')](handleError(_0x361a3f,null));};exports[_0x9ddb('0x24')]=function(_0xd7e0e9,_0x1d381b){if(_0xd7e0e9['body']['id']){delete _0xd7e0e9[_0x9ddb('0x4b')]['id'];}return db[_0x9ddb('0x31')][_0x9ddb('0x49')]({'where':{'id':_0xd7e0e9[_0x9ddb('0x46')]['id']}})[_0x9ddb('0x25')](handleEntityNotFound(_0x1d381b,null))[_0x9ddb('0x25')](saveUpdates(_0xd7e0e9['body'],null))[_0x9ddb('0x25')](respondWithResult(_0x1d381b,null))[_0x9ddb('0x45')](handleError(_0x1d381b,null));};exports['destroy']=function(_0xcd92a,_0x491734){return db[_0x9ddb('0x31')][_0x9ddb('0x49')]({'where':{'id':_0xcd92a[_0x9ddb('0x46')]['id']}})[_0x9ddb('0x25')](handleEntityNotFound(_0x491734,null))[_0x9ddb('0x25')](removeEntity(_0x491734,null))[_0x9ddb('0x45')](handleError(_0x491734,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 1278835..ad3f93f 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.model.js +++ b/server/api/intFreshdeskField/intFreshdeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dbb=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x2dbb,0x188));var _0xb2db=function(_0x29e661,_0x536def){_0x29e661=_0x29e661-0x0;var _0x3361a7=_0x2dbb[_0x29e661];return _0x3361a7;};'use strict';var _=require(_0xb2db('0x0'));var util=require(_0xb2db('0x1'));var logger=require(_0xb2db('0x2'))(_0xb2db('0x3'));var moment=require(_0xb2db('0x4'));var BPromise=require(_0xb2db('0x5'));var rp=require(_0xb2db('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2db('0x7'));var config=require('../../config/environment');var attributes=require(_0xb2db('0x8'));module[_0xb2db('0x9')]=function(_0x23a112,_0x1e4086){return _0x23a112[_0xb2db('0xa')]('FreshdeskField',attributes,{'tableName':_0xb2db('0xb'),'paranoid':![],'indexes':[{'name':_0xb2db('0xc'),'fields':[_0xb2db('0xd'),_0xb2db('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe35=['define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x3f9ea9,_0x19840d){var _0x291e7f=function(_0x8012b4){while(--_0x8012b4){_0x3f9ea9['push'](_0x3f9ea9['shift']());}};_0x291e7f(++_0x19840d);}(_0xfe35,0x155));var _0x5fe3=function(_0x4c6be0,_0x2b3f7b){_0x4c6be0=_0x4c6be0-0x0;var _0x4ddbb7=_0xfe35[_0x4c6be0];return _0x4ddbb7;};'use strict';var _=require(_0x5fe3('0x0'));var util=require(_0x5fe3('0x1'));var logger=require(_0x5fe3('0x2'))(_0x5fe3('0x3'));var moment=require(_0x5fe3('0x4'));var BPromise=require('bluebird');var rp=require(_0x5fe3('0x5'));var fs=require('fs');var path=require(_0x5fe3('0x6'));var rimraf=require(_0x5fe3('0x7'));var config=require(_0x5fe3('0x8'));var attributes=require(_0x5fe3('0x9'));module[_0x5fe3('0xa')]=function(_0x3aefc8,_0x6ddd25){return _0x3aefc8[_0x5fe3('0xb')](_0x5fe3('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x5fe3('0xd'),'fields':[_0x5fe3('0xe'),_0x5fe3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 8c57edd..cb654ef 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x19d7d9,_0x3974e9){var _0xc951e7=function(_0x2a8923){while(--_0x2a8923){_0x19d7d9['push'](_0x19d7d9['shift']());}};_0xc951e7(++_0x3974e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x14bbf3,_0xca820f){_0x14bbf3=_0x14bbf3-0x0;var _0x1b280c=_0xb10b[_0x14bbf3];return _0x1b280c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5c4613,_0x2e6eeb){var _0x2f9f39=function(_0x209936){while(--_0x209936){_0x5c4613['push'](_0x5c4613['shift']());}};_0x2f9f39(++_0x2e6eeb);}(_0xb10b,0x12a));var _0xbb10=function(_0x348b29,_0x3be5e9){_0x348b29=_0x348b29-0x0;var _0xc260c5=_0xb10b[_0x348b29];return _0xc260c5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d3c2ddd..72aa401 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcba0=['/:id','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x2c5b7a,_0x26a264){var _0x394296=function(_0x286f36){while(--_0x286f36){_0x2c5b7a['push'](_0x2c5b7a['shift']());}};_0x394296(++_0x26a264);}(_0xcba0,0xe3));var _0x0cba=function(_0xab910e,_0x24bf22){_0xab910e=_0xab910e-0x0;var _0x486256=_0xcba0[_0xab910e];return _0x486256;};'use strict';var multer=require(_0x0cba('0x0'));var util=require(_0x0cba('0x1'));var path=require(_0x0cba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0cba('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0cba('0x4'));var config=require(_0x0cba('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0x0cba('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0cba('0x7'),auth[_0x0cba('0x8')](),controller['show']);router[_0x0cba('0x6')](_0x0cba('0x9'),auth[_0x0cba('0x8')](),controller['getConfigurations']);router[_0x0cba('0x6')]('/:id/fields',auth[_0x0cba('0x8')](),controller[_0x0cba('0xa')]);router[_0x0cba('0xb')]('/',auth[_0x0cba('0x8')](),controller[_0x0cba('0xc')]);router[_0x0cba('0xb')]('/:id/configurations',auth[_0x0cba('0x8')](),controller[_0x0cba('0xd')]);router['put'](_0x0cba('0x7'),auth[_0x0cba('0x8')](),controller[_0x0cba('0xe')]);router[_0x0cba('0xf')](_0x0cba('0x7'),auth[_0x0cba('0x8')](),controller[_0x0cba('0x10')]);module[_0x0cba('0x11')]=router; \ No newline at end of file +var _0xcf3f=['/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x5dbdca,_0x1941b3){var _0x2119c9=function(_0x85a342){while(--_0x85a342){_0x5dbdca['push'](_0x5dbdca['shift']());}};_0x2119c9(++_0x1941b3);}(_0xcf3f,0xb1));var _0xfcf3=function(_0x4539b6,_0xddf92a){_0x4539b6=_0x4539b6-0x0;var _0x2fea36=_0xcf3f[_0x4539b6];return _0x2fea36;};'use strict';var multer=require(_0xfcf3('0x0'));var util=require(_0xfcf3('0x1'));var path=require(_0xfcf3('0x2'));var timeout=require(_0xfcf3('0x3'));var express=require(_0xfcf3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfcf3('0x5'));var config=require(_0xfcf3('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0xfcf3('0x7')]('/',auth['isAuthenticated'](),controller[_0xfcf3('0x8')]);router[_0xfcf3('0x7')](_0xfcf3('0x9'),auth[_0xfcf3('0xa')](),controller[_0xfcf3('0xb')]);router[_0xfcf3('0x7')](_0xfcf3('0xc'),auth[_0xfcf3('0xa')](),controller[_0xfcf3('0xd')]);router[_0xfcf3('0x7')]('/:id/fields',auth[_0xfcf3('0xa')](),controller[_0xfcf3('0xe')]);router[_0xfcf3('0xf')]('/',auth[_0xfcf3('0xa')](),controller[_0xfcf3('0x10')]);router['post']('/:id/configurations',auth[_0xfcf3('0xa')](),controller[_0xfcf3('0x11')]);router['put']('/:id',auth[_0xfcf3('0xa')](),controller[_0xfcf3('0x12')]);router['delete']('/:id',auth[_0xfcf3('0xa')](),controller[_0xfcf3('0x13')]);module[_0xfcf3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 10b7c70..1af10ec 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f36=['exports','STRING','username','remoteUri','sequelize'];(function(_0x472072,_0x5add18){var _0x38ca35=function(_0x197592){while(--_0x197592){_0x472072['push'](_0x472072['shift']());}};_0x38ca35(++_0x5add18);}(_0x7f36,0x1d0));var _0x67f3=function(_0x4ceb68,_0x429b5a){_0x4ceb68=_0x4ceb68-0x0;var _0x17bf7e=_0x7f36[_0x4ceb68];return _0x17bf7e;};'use strict';var Sequelize=require(_0x67f3('0x0'));module[_0x67f3('0x1')]={'name':{'type':Sequelize[_0x67f3('0x2')]},'description':{'type':Sequelize[_0x67f3('0x2')]},'username':{'type':Sequelize[_0x67f3('0x2')],'unique':_0x67f3('0x3')},'apiKey':{'type':Sequelize[_0x67f3('0x2')]},'remoteUri':{'type':Sequelize[_0x67f3('0x2')],'unique':_0x67f3('0x4')},'serverUrl':{'type':Sequelize[_0x67f3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x91d5=['STRING','username','remoteUri','exports'];(function(_0x1fec1e,_0xce18d2){var _0x31f9ec=function(_0x347a9a){while(--_0x347a9a){_0x1fec1e['push'](_0x1fec1e['shift']());}};_0x31f9ec(++_0xce18d2);}(_0x91d5,0x7b));var _0x591d=function(_0x4b4461,_0x2f8553){_0x4b4461=_0x4b4461-0x0;var _0x329323=_0x91d5[_0x4b4461];return _0x329323;};'use strict';var Sequelize=require('sequelize');module[_0x591d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x591d('0x1')]},'username':{'type':Sequelize[_0x591d('0x1')],'unique':_0x591d('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x591d('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3a64fab..2e874ef 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['merge','body','contact','interaction','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','show','intersection','find','create','params','getConfigurations','FreshsalesConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render'];(function(_0x4adaf8,_0x5b8c48){var _0x174112=function(_0x35bdc7){while(--_0x35bdc7){_0x4adaf8['push'](_0x4adaf8['shift']());}};_0x174112(++_0x5b8c48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var integrations=require(_0x0a9e('0x15'));var jayson=require(_0x0a9e('0x16'));var client=jayson[_0x0a9e('0x17')][_0x0a9e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5db4b0,_0x4283ce,_0x239b12,_0x2b4227){return new BPromise(function(_0x281129,_0x44dcfd){var _0x4d5611=_0x2b4227||client;return _0x4d5611['request'](_0x5db4b0,_0x239b12)[_0x0a9e('0x19')](function(_0x5d0880){logger[_0x0a9e('0x1a')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'));logger[_0x0a9e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'),JSON['stringify'](_0x5d0880));if(_0x5d0880[_0x0a9e('0x1d')]){if(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x44dcfd(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')]['message']);return _0x281129(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}else{logger['info'](_0x0a9e('0x1f'),_0x4283ce,'request\x20sent');_0x281129(_0x5d0880['result'][_0x0a9e('0x20')]);}})[_0x0a9e('0x21')](function(_0x38e7c4){logger[_0x0a9e('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x38e7c4);_0x44dcfd(_0x38e7c4);});});}function respondWithStatusCode(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0xcc;return function(_0x3b45bc){if(_0x3b45bc){return _0xfb6e48[_0x0a9e('0x22')](_0x2fb0e4);}return _0xfb6e48[_0x0a9e('0x23')](_0x2fb0e4)[_0x0a9e('0x24')]();};}function respondWithResult(_0x16b1ca,_0x5ea472){_0x5ea472=_0x5ea472||0xc8;return function(_0x59181e){if(_0x59181e){return _0x16b1ca[_0x0a9e('0x23')](_0x5ea472)[_0x0a9e('0x25')](_0x59181e);}};}function respondWithFilteredResult(_0x40c424,_0x33161b){return function(_0x526cf3){if(_0x526cf3){var _0x384319=typeof _0x33161b['offset']===_0x0a9e('0x26')&&typeof _0x33161b['limit']===_0x0a9e('0x26');var _0x34dc65=_0x526cf3[_0x0a9e('0x27')];var _0x14433c=_0x384319?0x0:_0x33161b[_0x0a9e('0x28')];var _0x1538a4=_0x384319?_0x526cf3[_0x0a9e('0x27')]:_0x33161b[_0x0a9e('0x28')]+_0x33161b['limit'];var _0x3652a7;if(_0x1538a4>=_0x34dc65){_0x1538a4=_0x34dc65;_0x3652a7=0xc8;}else{_0x3652a7=0xce;}_0x40c424[_0x0a9e('0x23')](_0x3652a7);return _0x40c424[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x14433c+'-'+_0x1538a4+'/'+_0x34dc65)['json'](_0x526cf3);}return null;};}function patchUpdates(_0x15b200){return function(_0x40e7a3){try{jsonpatch[_0x0a9e('0x2b')](_0x40e7a3,_0x15b200,!![]);}catch(_0x824a4f){return BPromise[_0x0a9e('0x2c')](_0x824a4f);}return _0x40e7a3[_0x0a9e('0x2d')]();};}function saveUpdates(_0x296f41,_0x2e8759){return function(_0x1dbde2){if(_0x1dbde2){return _0x1dbde2['update'](_0x296f41)[_0x0a9e('0x19')](function(_0x5d1e0e){return _0x5d1e0e;});}return null;};}function removeEntity(_0x2407f9,_0x3ae878){return function(_0x1122db){if(_0x1122db){return _0x1122db[_0x0a9e('0x2e')]()[_0x0a9e('0x19')](function(){_0x2407f9['status'](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(!_0x2da5c0){_0x46f0a5[_0x0a9e('0x22')](0x194);}return _0x2da5c0;};}function handleError(_0x409319,_0x332d35){_0x332d35=_0x332d35||0x1f4;return function(_0x39e565){logger['error'](_0x39e565[_0x0a9e('0x2f')]);if(_0x39e565['name']){delete _0x39e565[_0x0a9e('0x30')];}_0x409319[_0x0a9e('0x23')](_0x332d35)[_0x0a9e('0x31')](_0x39e565);};}function getMustacheRender(_0x3f3d41,_0x567193){return Mustache[_0x0a9e('0x32')](_0x3f3d41,_[_0x0a9e('0x33')](_0x567193[_0x0a9e('0x34')],{'contact':_0x567193[_0x0a9e('0x35')],'message':_0x567193['message'],'agent':_0x567193['agent'],'interaction':_0x567193[_0x0a9e('0x36')],'account':_0x567193['account']}))||'';}exports[_0x0a9e('0x37')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x38')](db['FreshsalesAccount'][_0x0a9e('0x39')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3a')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x38')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x3c')]);_0x4f41ae[_0x0a9e('0x3e')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3c')]);_0x1ef87a[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')]['fields']));_0x1ef87a[_0x0a9e('0x3f')]=_0x1ef87a[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x1ef87a[_0x0a9e('0x3f')]:_0x4f41ae[_0x0a9e('0x3b')];if(!_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x1ef87a[_0x0a9e('0x44')]=qs[_0x0a9e('0x44')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x1ef87a[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x3d9717[_0x0a9e('0x3c')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3c')],_0x4f41ae[_0x0a9e('0x3e')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x33')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x38')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x49')]!==_0x0a9e('0x4a')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x30')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4b')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4c')][_0x0a9e('0x27')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x27')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x4d')]){_0x1ef87a[_0x0a9e('0x4e')]=[{'all':!![]}];}return db[_0x0a9e('0x4c')][_0x0a9e('0x4f')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x50')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x21')](handleError(_0x381c37,null));};exports[_0x0a9e('0x51')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3d')](_0x992c77[_0x0a9e('0x3c')]);_0x34febd[_0x0a9e('0x3e')]=_[_0x0a9e('0x52')](_0x34febd[_0x0a9e('0x3b')],_0x34febd[_0x0a9e('0x3c')]);_0x19383e[_0x0a9e('0x3f')]=_[_0x0a9e('0x52')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x40')]));_0x19383e[_0x0a9e('0x3f')]=_0x19383e[_0x0a9e('0x3f')]['length']?_0x19383e[_0x0a9e('0x3f')]:_0x34febd[_0x0a9e('0x3b')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x4e')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4b')]);return db['FreshsalesAccount'][_0x0a9e('0x53')](_0x19383e)[_0x0a9e('0x19')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x19')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x54')]=function(_0x1bf38a,_0x508b47){return db['FreshsalesAccount'][_0x0a9e('0x54')](_0x1bf38a[_0x0a9e('0x34')],{})['then'](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x21')](handleError(_0x508b47,null));};exports['update']=function(_0x211ef9,_0x523cd2){if(_0x211ef9[_0x0a9e('0x34')]['id']){delete _0x211ef9['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x211ef9[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x19')](saveUpdates(_0x211ef9[_0x0a9e('0x34')],null))[_0x0a9e('0x19')](respondWithResult(_0x523cd2,null))[_0x0a9e('0x21')](handleError(_0x523cd2,null));};exports[_0x0a9e('0x2e')]=function(_0x272738,_0xd10662){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x272738[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0xd10662,null))[_0x0a9e('0x19')](removeEntity(_0xd10662,null))[_0x0a9e('0x21')](handleError(_0xd10662,null));};exports[_0x0a9e('0x56')]=function(_0x156662,_0x5d86e9,_0x956fbe){var _0x26bc80={};var _0x5239ef={};var _0x3649cc;var _0x5cc8fb;return db[_0x0a9e('0x4c')]['findOne']({'where':{'id':_0x156662['params']['id']}})['then'](handleEntityNotFound(_0x5d86e9,null))[_0x0a9e('0x19')](function(_0x49d231){if(_0x49d231){_0x3649cc=_0x49d231;_0x5239ef[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db[_0x0a9e('0x57')][_0x0a9e('0x39')]);_0x5239ef[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x156662['query']);_0x5239ef[_0x0a9e('0x3e')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],_0x5239ef[_0x0a9e('0x3c')]);_0x26bc80[_0x0a9e('0x3f')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x40')]));_0x26bc80['attributes']=_0x26bc80[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x26bc80['attributes']:_0x5239ef[_0x0a9e('0x3b')];_0x26bc80[_0x0a9e('0x58')]=qs[_0x0a9e('0x45')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x26bc80['where']=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x156662[_0x0a9e('0x3c')],_0x5239ef['filters']));if(_0x156662[_0x0a9e('0x3c')]['filter']){_0x26bc80['where']=_[_0x0a9e('0x33')](_0x26bc80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x38')](_0x26bc80[_0x0a9e('0x3f')],function(_0x186f39){var _0xc8c264={};_0xc8c264[_0x186f39]={'$like':'%'+_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0xc8c264;})});}_0x26bc80=_[_0x0a9e('0x33')]({},_0x26bc80,_0x156662[_0x0a9e('0x4b')]);return _0x3649cc[_0x0a9e('0x56')](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x5cc8fb=_0x2bbb86[_0x0a9e('0x41')];if(!_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x26bc80[_0x0a9e('0x44')]=qs['limit'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x26bc80[_0x0a9e('0x28')]=qs['offset'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x28')]);}return _0x3649cc['getConfigurations'](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){return _0x56e31e?{'count':_0x5cc8fb,'rows':_0x56e31e}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x5d86e9,null))[_0x0a9e('0x21')](handleError(_0x5d86e9,null));};exports[_0x0a9e('0x59')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){if(_0x4a43a8[_0x0a9e('0x34')]['id']){delete _0x4a43a8[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x4a43a8[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x19')](function(_0x1a0677){if(_0x1a0677){_0x4a43a8['body'][_0x0a9e('0x5b')]=_0x1a0677['id'];_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5c')]=integrations['getSubjects'](_0x4a43a8[_0x0a9e('0x34')]['channel'],_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x49')]);_0x4a43a8['body'][_0x0a9e('0x5d')]=integrations[_0x0a9e('0x5e')](_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5f')],_0x4a43a8['body'][_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x54')](_0x4a43a8[_0x0a9e('0x34')],{'include':[{'model':db['FreshsalesField'],'as':_0x0a9e('0x5c')},{'model':db[_0x0a9e('0x60')],'as':_0x0a9e('0x5d')}]});}return null;})[_0x0a9e('0x19')](respondWithResult(_0x50cdce,null))['catch'](handleError(_0x50cdce,null));};exports[_0x0a9e('0x61')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){var _0x332367='';var _0xdb98ca='';return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x3511c9[_0x0a9e('0x55')]['id']},'attributes':['id',_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x19')](function(_0x5b35db){if(_0x5b35db){_0xdb98ca=_0x5b35db[_0x0a9e('0x62')];_0x332367=_0x5b35db[_0x0a9e('0x63')];var _0xc599b3=_0x5b35db['remoteUri'][_0x0a9e('0x65')](-0x1);if(_0xc599b3==='/'){_0x332367=_0x332367[_0x0a9e('0x66')](0x0,_0x332367[_0x0a9e('0x67')](_0xc599b3));}return rp({'method':_0x0a9e('0x68'),'uri':util['format']('%s%s',_0x332367,_0x0a9e('0x69')),'headers':{'Authorization':_0x0a9e('0x6a')+_0x5b35db['apiKey']},'json':!![]});}})[_0x0a9e('0x19')](function(_0x53a6a1){if(_0x53a6a1){var _0x260f4b=_0x53a6a1[_0x0a9e('0x6b')];var _0x5637a1=![];var _0x28a942=null;for(_0x28a942=0x0;_0x28a942<_0x260f4b[_0x0a9e('0x41')];_0x28a942++){if(_0x260f4b[_0x28a942][_0x0a9e('0x6c')]===_0xdb98ca){_0x5637a1=!![];}}if(_0x5637a1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0a9e('0x6d')});}}})[_0x0a9e('0x19')](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x21')](function(_0x444f1f){var _0x482ca2=_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?0x1f4:_0x444f1f[_0x0a9e('0x6f')]||0x1f4;logger[_0x0a9e('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x61'),_0x482ca2,JSON[_0x0a9e('0x70')](_0x444f1f));delete _0x444f1f['name'];if(_0x482ca2===0x191){_0x482ca2=0x190;}_0x30a4c7[_0x0a9e('0x23')](_0x482ca2)['send'](_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?{'message':_0x0a9e('0x71'),'statusCode':_0x444f1f[_0x0a9e('0x6f')]}:_0x444f1f);});}; \ No newline at end of file +var _0xa9e0=['merge','body','contact','interaction','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','show','intersection','find','create','params','getConfigurations','FreshsalesConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render'];(function(_0x29c2ea,_0x46b76a){var _0x2d9126=function(_0x5a33c5){while(--_0x5a33c5){_0x29c2ea['push'](_0x29c2ea['shift']());}};_0x2d9126(++_0x46b76a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var integrations=require(_0x0a9e('0x15'));var jayson=require(_0x0a9e('0x16'));var client=jayson[_0x0a9e('0x17')][_0x0a9e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5db4b0,_0x4283ce,_0x239b12,_0x2b4227){return new BPromise(function(_0x281129,_0x44dcfd){var _0x4d5611=_0x2b4227||client;return _0x4d5611['request'](_0x5db4b0,_0x239b12)[_0x0a9e('0x19')](function(_0x5d0880){logger[_0x0a9e('0x1a')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'));logger[_0x0a9e('0x1c')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4283ce,_0x0a9e('0x1b'),JSON['stringify'](_0x5d0880));if(_0x5d0880[_0x0a9e('0x1d')]){if(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);return _0x44dcfd(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x1f'),_0x4283ce,_0x5d0880[_0x0a9e('0x1d')]['message']);return _0x281129(_0x5d0880[_0x0a9e('0x1d')][_0x0a9e('0x20')]);}else{logger['info'](_0x0a9e('0x1f'),_0x4283ce,'request\x20sent');_0x281129(_0x5d0880['result'][_0x0a9e('0x20')]);}})[_0x0a9e('0x21')](function(_0x38e7c4){logger[_0x0a9e('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x4283ce,_0x38e7c4);_0x44dcfd(_0x38e7c4);});});}function respondWithStatusCode(_0xfb6e48,_0x2fb0e4){_0x2fb0e4=_0x2fb0e4||0xcc;return function(_0x3b45bc){if(_0x3b45bc){return _0xfb6e48[_0x0a9e('0x22')](_0x2fb0e4);}return _0xfb6e48[_0x0a9e('0x23')](_0x2fb0e4)[_0x0a9e('0x24')]();};}function respondWithResult(_0x16b1ca,_0x5ea472){_0x5ea472=_0x5ea472||0xc8;return function(_0x59181e){if(_0x59181e){return _0x16b1ca[_0x0a9e('0x23')](_0x5ea472)[_0x0a9e('0x25')](_0x59181e);}};}function respondWithFilteredResult(_0x40c424,_0x33161b){return function(_0x526cf3){if(_0x526cf3){var _0x384319=typeof _0x33161b['offset']===_0x0a9e('0x26')&&typeof _0x33161b['limit']===_0x0a9e('0x26');var _0x34dc65=_0x526cf3[_0x0a9e('0x27')];var _0x14433c=_0x384319?0x0:_0x33161b[_0x0a9e('0x28')];var _0x1538a4=_0x384319?_0x526cf3[_0x0a9e('0x27')]:_0x33161b[_0x0a9e('0x28')]+_0x33161b['limit'];var _0x3652a7;if(_0x1538a4>=_0x34dc65){_0x1538a4=_0x34dc65;_0x3652a7=0xc8;}else{_0x3652a7=0xce;}_0x40c424[_0x0a9e('0x23')](_0x3652a7);return _0x40c424[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x14433c+'-'+_0x1538a4+'/'+_0x34dc65)['json'](_0x526cf3);}return null;};}function patchUpdates(_0x15b200){return function(_0x40e7a3){try{jsonpatch[_0x0a9e('0x2b')](_0x40e7a3,_0x15b200,!![]);}catch(_0x824a4f){return BPromise[_0x0a9e('0x2c')](_0x824a4f);}return _0x40e7a3[_0x0a9e('0x2d')]();};}function saveUpdates(_0x296f41,_0x2e8759){return function(_0x1dbde2){if(_0x1dbde2){return _0x1dbde2['update'](_0x296f41)[_0x0a9e('0x19')](function(_0x5d1e0e){return _0x5d1e0e;});}return null;};}function removeEntity(_0x2407f9,_0x3ae878){return function(_0x1122db){if(_0x1122db){return _0x1122db[_0x0a9e('0x2e')]()[_0x0a9e('0x19')](function(){_0x2407f9['status'](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x46f0a5,_0x40cb85){return function(_0x2da5c0){if(!_0x2da5c0){_0x46f0a5[_0x0a9e('0x22')](0x194);}return _0x2da5c0;};}function handleError(_0x409319,_0x332d35){_0x332d35=_0x332d35||0x1f4;return function(_0x39e565){logger['error'](_0x39e565[_0x0a9e('0x2f')]);if(_0x39e565['name']){delete _0x39e565[_0x0a9e('0x30')];}_0x409319[_0x0a9e('0x23')](_0x332d35)[_0x0a9e('0x31')](_0x39e565);};}function getMustacheRender(_0x3f3d41,_0x567193){return Mustache[_0x0a9e('0x32')](_0x3f3d41,_[_0x0a9e('0x33')](_0x567193[_0x0a9e('0x34')],{'contact':_0x567193[_0x0a9e('0x35')],'message':_0x567193['message'],'agent':_0x567193['agent'],'interaction':_0x567193[_0x0a9e('0x36')],'account':_0x567193['account']}))||'';}exports[_0x0a9e('0x37')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x38')](db['FreshsalesAccount'][_0x0a9e('0x39')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3a')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x38')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x3c')]);_0x4f41ae[_0x0a9e('0x3e')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3c')]);_0x1ef87a[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x3d9717[_0x0a9e('0x3c')]['fields']));_0x1ef87a[_0x0a9e('0x3f')]=_0x1ef87a[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x1ef87a[_0x0a9e('0x3f')]:_0x4f41ae[_0x0a9e('0x3b')];if(!_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x1ef87a[_0x0a9e('0x44')]=qs[_0x0a9e('0x44')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x1ef87a[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x3d9717[_0x0a9e('0x3c')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3c')],_0x4f41ae[_0x0a9e('0x3e')]),_0x3bfce8);if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x33')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x38')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x49')]!==_0x0a9e('0x4a')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x30')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4b')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4c')][_0x0a9e('0x27')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x27')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3c')][_0x0a9e('0x4d')]){_0x1ef87a[_0x0a9e('0x4e')]=[{'all':!![]}];}return db[_0x0a9e('0x4c')][_0x0a9e('0x4f')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x50')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x21')](handleError(_0x381c37,null));};exports[_0x0a9e('0x51')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3d')](_0x992c77[_0x0a9e('0x3c')]);_0x34febd[_0x0a9e('0x3e')]=_[_0x0a9e('0x52')](_0x34febd[_0x0a9e('0x3b')],_0x34febd[_0x0a9e('0x3c')]);_0x19383e[_0x0a9e('0x3f')]=_[_0x0a9e('0x52')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x40')]));_0x19383e[_0x0a9e('0x3f')]=_0x19383e[_0x0a9e('0x3f')]['length']?_0x19383e[_0x0a9e('0x3f')]:_0x34febd[_0x0a9e('0x3b')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x4e')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4b')]);return db['FreshsalesAccount'][_0x0a9e('0x53')](_0x19383e)[_0x0a9e('0x19')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x19')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x54')]=function(_0x1bf38a,_0x508b47){return db['FreshsalesAccount'][_0x0a9e('0x54')](_0x1bf38a[_0x0a9e('0x34')],{})['then'](respondWithResult(_0x508b47,0xc9))[_0x0a9e('0x21')](handleError(_0x508b47,null));};exports['update']=function(_0x211ef9,_0x523cd2){if(_0x211ef9[_0x0a9e('0x34')]['id']){delete _0x211ef9['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x211ef9[_0x0a9e('0x55')]['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x19')](saveUpdates(_0x211ef9[_0x0a9e('0x34')],null))[_0x0a9e('0x19')](respondWithResult(_0x523cd2,null))[_0x0a9e('0x21')](handleError(_0x523cd2,null));};exports[_0x0a9e('0x2e')]=function(_0x272738,_0xd10662){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x272738[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0xd10662,null))[_0x0a9e('0x19')](removeEntity(_0xd10662,null))[_0x0a9e('0x21')](handleError(_0xd10662,null));};exports[_0x0a9e('0x56')]=function(_0x156662,_0x5d86e9,_0x956fbe){var _0x26bc80={};var _0x5239ef={};var _0x3649cc;var _0x5cc8fb;return db[_0x0a9e('0x4c')]['findOne']({'where':{'id':_0x156662['params']['id']}})['then'](handleEntityNotFound(_0x5d86e9,null))[_0x0a9e('0x19')](function(_0x49d231){if(_0x49d231){_0x3649cc=_0x49d231;_0x5239ef[_0x0a9e('0x3b')]=_[_0x0a9e('0x3d')](db[_0x0a9e('0x57')][_0x0a9e('0x39')]);_0x5239ef[_0x0a9e('0x3c')]=_[_0x0a9e('0x3d')](_0x156662['query']);_0x5239ef[_0x0a9e('0x3e')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],_0x5239ef[_0x0a9e('0x3c')]);_0x26bc80[_0x0a9e('0x3f')]=_['intersection'](_0x5239ef[_0x0a9e('0x3b')],qs[_0x0a9e('0x40')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x40')]));_0x26bc80['attributes']=_0x26bc80[_0x0a9e('0x3f')][_0x0a9e('0x41')]?_0x26bc80['attributes']:_0x5239ef[_0x0a9e('0x3b')];_0x26bc80[_0x0a9e('0x58')]=qs[_0x0a9e('0x45')](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x45')]);_0x26bc80['where']=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x47')](_0x156662[_0x0a9e('0x3c')],_0x5239ef['filters']));if(_0x156662[_0x0a9e('0x3c')]['filter']){_0x26bc80['where']=_[_0x0a9e('0x33')](_0x26bc80[_0x0a9e('0x46')],{'$or':_[_0x0a9e('0x38')](_0x26bc80[_0x0a9e('0x3f')],function(_0x186f39){var _0xc8c264={};_0xc8c264[_0x186f39]={'$like':'%'+_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x48')]+'%'};return _0xc8c264;})});}_0x26bc80=_[_0x0a9e('0x33')]({},_0x26bc80,_0x156662[_0x0a9e('0x4b')]);return _0x3649cc[_0x0a9e('0x56')](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x5cc8fb=_0x2bbb86[_0x0a9e('0x41')];if(!_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x42')](_0x0a9e('0x43'))){_0x26bc80[_0x0a9e('0x44')]=qs['limit'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x44')]);_0x26bc80[_0x0a9e('0x28')]=qs['offset'](_0x156662[_0x0a9e('0x3c')][_0x0a9e('0x28')]);}return _0x3649cc['getConfigurations'](_0x26bc80);}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){return _0x56e31e?{'count':_0x5cc8fb,'rows':_0x56e31e}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x5d86e9,null))[_0x0a9e('0x21')](handleError(_0x5d86e9,null));};exports[_0x0a9e('0x59')]=function(_0x4a43a8,_0x50cdce,_0x4a2438){if(_0x4a43a8[_0x0a9e('0x34')]['id']){delete _0x4a43a8[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x4a43a8[_0x0a9e('0x55')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x50cdce,null))[_0x0a9e('0x19')](function(_0x1a0677){if(_0x1a0677){_0x4a43a8['body'][_0x0a9e('0x5b')]=_0x1a0677['id'];_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5c')]=integrations['getSubjects'](_0x4a43a8[_0x0a9e('0x34')]['channel'],_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x49')]);_0x4a43a8['body'][_0x0a9e('0x5d')]=integrations[_0x0a9e('0x5e')](_0x4a43a8[_0x0a9e('0x34')][_0x0a9e('0x5f')],_0x4a43a8['body'][_0x0a9e('0x49')]);return db[_0x0a9e('0x57')][_0x0a9e('0x54')](_0x4a43a8[_0x0a9e('0x34')],{'include':[{'model':db['FreshsalesField'],'as':_0x0a9e('0x5c')},{'model':db[_0x0a9e('0x60')],'as':_0x0a9e('0x5d')}]});}return null;})[_0x0a9e('0x19')](respondWithResult(_0x50cdce,null))['catch'](handleError(_0x50cdce,null));};exports[_0x0a9e('0x61')]=function(_0x3511c9,_0x30a4c7,_0xf410e5){var _0x332367='';var _0xdb98ca='';return db[_0x0a9e('0x4c')][_0x0a9e('0x5a')]({'where':{'id':_0x3511c9[_0x0a9e('0x55')]['id']},'attributes':['id',_0x0a9e('0x62'),_0x0a9e('0x63'),_0x0a9e('0x64')]})[_0x0a9e('0x19')](handleEntityNotFound(_0x30a4c7,null))[_0x0a9e('0x19')](function(_0x5b35db){if(_0x5b35db){_0xdb98ca=_0x5b35db[_0x0a9e('0x62')];_0x332367=_0x5b35db[_0x0a9e('0x63')];var _0xc599b3=_0x5b35db['remoteUri'][_0x0a9e('0x65')](-0x1);if(_0xc599b3==='/'){_0x332367=_0x332367[_0x0a9e('0x66')](0x0,_0x332367[_0x0a9e('0x67')](_0xc599b3));}return rp({'method':_0x0a9e('0x68'),'uri':util['format']('%s%s',_0x332367,_0x0a9e('0x69')),'headers':{'Authorization':_0x0a9e('0x6a')+_0x5b35db['apiKey']},'json':!![]});}})[_0x0a9e('0x19')](function(_0x53a6a1){if(_0x53a6a1){var _0x260f4b=_0x53a6a1[_0x0a9e('0x6b')];var _0x5637a1=![];var _0x28a942=null;for(_0x28a942=0x0;_0x28a942<_0x260f4b[_0x0a9e('0x41')];_0x28a942++){if(_0x260f4b[_0x28a942][_0x0a9e('0x6c')]===_0xdb98ca){_0x5637a1=!![];}}if(_0x5637a1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0a9e('0x6d')});}}})[_0x0a9e('0x19')](respondWithResult(_0x30a4c7,null))[_0x0a9e('0x21')](function(_0x444f1f){var _0x482ca2=_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?0x1f4:_0x444f1f[_0x0a9e('0x6f')]||0x1f4;logger[_0x0a9e('0x1d')]('getFields,\x20%s,\x20%s,\x20%s',_0x0a9e('0x61'),_0x482ca2,JSON[_0x0a9e('0x70')](_0x444f1f));delete _0x444f1f['name'];if(_0x482ca2===0x191){_0x482ca2=0x190;}_0x30a4c7[_0x0a9e('0x23')](_0x482ca2)['send'](_0x3511c9[_0x0a9e('0x3c')][_0x0a9e('0x6e')]?{'message':_0x0a9e('0x71'),'statusCode':_0x444f1f[_0x0a9e('0x6f')]}:_0x444f1f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 5a80d80..6dffdb8 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe60=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xbe60,0x1d4));var _0x0be6=function(_0x16e9a0,_0x467200){_0x16e9a0=_0x16e9a0-0x0;var _0x220ddb=_0xbe60[_0x16e9a0];return _0x220ddb;};'use strict';var _=require(_0x0be6('0x0'));var util=require(_0x0be6('0x1'));var logger=require(_0x0be6('0x2'))(_0x0be6('0x3'));var moment=require(_0x0be6('0x4'));var BPromise=require('bluebird');var rp=require(_0x0be6('0x5'));var fs=require('fs');var path=require(_0x0be6('0x6'));var rimraf=require(_0x0be6('0x7'));var config=require(_0x0be6('0x8'));var attributes=require(_0x0be6('0x9'));var integrations=require(_0x0be6('0xa'));module[_0x0be6('0xb')]=function(_0x68ad28,_0x14f46e){return _0x68ad28[_0x0be6('0xc')](_0x0be6('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96eb=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x19d132,_0x3b7017){var _0x521740=function(_0x48cba7){while(--_0x48cba7){_0x19d132['push'](_0x19d132['shift']());}};_0x521740(++_0x3b7017);}(_0x96eb,0x1df));var _0xb96e=function(_0x240691,_0x11936a){_0x240691=_0x240691-0x0;var _0x503ca5=_0x96eb[_0x240691];return _0x503ca5;};'use strict';var _=require(_0xb96e('0x0'));var util=require('util');var logger=require(_0xb96e('0x1'))(_0xb96e('0x2'));var moment=require('moment');var BPromise=require(_0xb96e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb96e('0x4'));var rimraf=require(_0xb96e('0x5'));var config=require(_0xb96e('0x6'));var attributes=require(_0xb96e('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xb96e('0x8')]=function(_0x4da5be,_0x421b32){return _0x4da5be[_0xb96e('0x9')](_0xb96e('0xa'),attributes,{'tableName':_0xb96e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index c7689f7..6441cf3 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2aa3=['jayson/promise','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','options','raw','where','attributes','limit','include','map','model','GetFreshsalesAccount','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x281d47,_0x44992b){var _0x3113ed=function(_0x5591fd){while(--_0x5591fd){_0x281d47['push'](_0x281d47['shift']());}};_0x3113ed(++_0x44992b);}(_0x2aa3,0x83));var _0x32aa=function(_0x550bd6,_0x1475ea){_0x550bd6=_0x550bd6-0x0;var _0x20790c=_0x2aa3[_0x550bd6];return _0x20790c;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32aa('0x4'))['db'];var utils=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));var config=require(_0x32aa('0x8'));var jayson=require(_0x32aa('0x9'));var client=jayson['client'][_0x32aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x112396,_0x3ee18a,_0x20efbe){return new BPromise(function(_0x18ded0,_0x40c96a){return client[_0x32aa('0xb')](_0x112396,_0x20efbe)[_0x32aa('0xc')](function(_0x5d280e){logger[_0x32aa('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ee18a,_0x32aa('0xe'));logger[_0x32aa('0xf')](_0x32aa('0x10'),_0x3ee18a,_0x32aa('0xe'),JSON['stringify'](_0x5d280e));if(_0x5d280e[_0x32aa('0x11')]){if(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x12')]===0x1f4){logger['error'](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);return _0x40c96a(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x5d280e[_0x32aa('0x11')]['message']);return _0x18ded0(_0x5d280e[_0x32aa('0x11')][_0x32aa('0x14')]);}else{logger[_0x32aa('0xd')](_0x32aa('0x13'),_0x3ee18a,_0x32aa('0xe'));_0x18ded0(_0x5d280e['result'][_0x32aa('0x14')]);}})[_0x32aa('0x15')](function(_0x463b91){logger[_0x32aa('0x11')](_0x32aa('0x13'),_0x3ee18a,_0x463b91);_0x40c96a(_0x463b91);});});}exports['GetFreshsalesAccount']=function(_0x5196c0){var _0x3e0a23=this;return new Promise(function(_0x34dcaf,_0x257be0){return db['FreshsalesAccount']['findAll']({'raw':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x17')]===undefined?!![]:![]:!![],'where':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x18')]||null:null,'attributes':_0x5196c0['options']?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x19')]||null:null,'limit':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1a')]||null:null,'include':_0x5196c0[_0x32aa('0x16')]?_0x5196c0[_0x32aa('0x16')][_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x5196c0['options'][_0x32aa('0x1b')],function(_0x5c82d2){return{'model':db[_0x5c82d2[_0x32aa('0x1d')]],'as':_0x5c82d2['as'],'attributes':_0x5c82d2[_0x32aa('0x19')],'include':_0x5c82d2['include']?_['map'](_0x5c82d2[_0x32aa('0x1b')],function(_0x313930){return{'model':db[_0x313930[_0x32aa('0x1d')]],'as':_0x313930['as'],'attributes':_0x313930[_0x32aa('0x19')],'include':_0x313930[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x313930[_0x32aa('0x1b')],function(_0x405b03){return{'model':db[_0x405b03[_0x32aa('0x1d')]],'as':_0x405b03['as'],'attributes':_0x405b03['attributes']};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x2e3a5d){logger['info'](_0x32aa('0x1e'),_0x5196c0);logger['debug']('GetFreshsalesAccount',_0x5196c0,JSON[_0x32aa('0x1f')](_0x2e3a5d));_0x34dcaf(_0x2e3a5d);})[_0x32aa('0x15')](function(_0x1d1c80){logger[_0x32aa('0x11')]('GetFreshsalesAccount',_0x1d1c80[_0x32aa('0x14')],_0x5196c0);_0x257be0(_0x3e0a23[_0x32aa('0x11')](0x1f4,_0x1d1c80[_0x32aa('0x14')]));});});};exports[_0x32aa('0x20')]=function(_0x19efc6){var _0x44887c=this;return new Promise(function(_0x4b0d5a,_0x5b410f){return db[_0x32aa('0x21')][_0x32aa('0x22')]({'raw':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19efc6['options']?_0x19efc6[_0x32aa('0x16')]['where']||null:null,'attributes':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['attributes']||null:null,'include':_0x19efc6[_0x32aa('0x16')]?_0x19efc6[_0x32aa('0x16')]['include']?_[_0x32aa('0x1c')](_0x19efc6[_0x32aa('0x16')][_0x32aa('0x1b')],function(_0xd23473){return{'model':db[_0xd23473[_0x32aa('0x1d')]],'as':_0xd23473['as'],'attributes':_0xd23473[_0x32aa('0x19')],'include':_0xd23473[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0xd23473[_0x32aa('0x1b')],function(_0x2a2f9d){return{'model':db[_0x2a2f9d[_0x32aa('0x1d')]],'as':_0x2a2f9d['as'],'attributes':_0x2a2f9d[_0x32aa('0x19')],'include':_0x2a2f9d[_0x32aa('0x1b')]?_[_0x32aa('0x1c')](_0x2a2f9d['include'],function(_0x5b0fe2){return{'model':db[_0x5b0fe2[_0x32aa('0x1d')]],'as':_0x5b0fe2['as'],'attributes':_0x5b0fe2[_0x32aa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x32aa('0xc')](function(_0x193d10){logger['info'](_0x32aa('0x20'),_0x19efc6);logger[_0x32aa('0xf')](_0x32aa('0x20'),_0x19efc6,JSON[_0x32aa('0x1f')](_0x193d10));_0x4b0d5a(_0x193d10);})[_0x32aa('0x15')](function(_0xa48198){logger[_0x32aa('0x11')](_0x32aa('0x20'),_0xa48198[_0x32aa('0x14')],_0x19efc6);_0x5b410f(_0x44887c[_0x32aa('0x11')](0x1f4,_0xa48198[_0x32aa('0x14')]));});});}; \ No newline at end of file +var _0xcd6f=['include','catch','ShowFreshsalesAccount','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','map','model'];(function(_0xa79996,_0x9ec38){var _0x16e207=function(_0x41d066){while(--_0x41d066){_0xa79996['push'](_0xa79996['shift']());}};_0x16e207(++_0x9ec38);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x5711af,_0x230e23){_0x5711af=_0x5711af-0x0;var _0x4522c0=_0xcd6f[_0x5711af];return _0x4522c0;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var moment=require(_0xfcd6('0x2'));var BPromise=require(_0xfcd6('0x3'));var rs=require(_0xfcd6('0x4'));var fs=require('fs');var Redis=require(_0xfcd6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcd6('0x6'));var logger=require(_0xfcd6('0x7'))(_0xfcd6('0x8'));var config=require(_0xfcd6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfcd6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16a180,_0x51329c,_0x135b7e){return new BPromise(function(_0xfc5139,_0x544104){return client[_0xfcd6('0xb')](_0x16a180,_0x135b7e)['then'](function(_0x12dc78){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x51329c,'request\x20sent');logger[_0xfcd6('0xc')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x51329c,'request\x20sent',JSON[_0xfcd6('0xd')](_0x12dc78));if(_0x12dc78[_0xfcd6('0xe')]){if(_0x12dc78['error'][_0xfcd6('0xf')]===0x1f4){logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);return _0x544104(_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);}logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);return _0xfc5139(_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);}else{logger[_0xfcd6('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x51329c,'request\x20sent');_0xfc5139(_0x12dc78[_0xfcd6('0x13')][_0xfcd6('0x11')]);}})['catch'](function(_0x29d25d){logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x29d25d);_0x544104(_0x29d25d);});});}exports[_0xfcd6('0x14')]=function(_0x4e9290){var _0x4caa42=this;return new Promise(function(_0x429c23,_0x12ca83){return db[_0xfcd6('0x15')][_0xfcd6('0x16')]({'raw':_0x4e9290['options']?_0x4e9290[_0xfcd6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4e9290[_0xfcd6('0x17')]?_0x4e9290[_0xfcd6('0x17')][_0xfcd6('0x18')]||null:null,'attributes':_0x4e9290[_0xfcd6('0x17')]?_0x4e9290[_0xfcd6('0x17')][_0xfcd6('0x19')]||null:null,'limit':_0x4e9290[_0xfcd6('0x17')]?_0x4e9290[_0xfcd6('0x17')][_0xfcd6('0x1a')]||null:null,'include':_0x4e9290['options']?_0x4e9290[_0xfcd6('0x17')]['include']?_[_0xfcd6('0x1b')](_0x4e9290[_0xfcd6('0x17')]['include'],function(_0xdb56c7){return{'model':db[_0xdb56c7[_0xfcd6('0x1c')]],'as':_0xdb56c7['as'],'attributes':_0xdb56c7[_0xfcd6('0x19')],'include':_0xdb56c7[_0xfcd6('0x1d')]?_[_0xfcd6('0x1b')](_0xdb56c7[_0xfcd6('0x1d')],function(_0x549987){return{'model':db[_0x549987[_0xfcd6('0x1c')]],'as':_0x549987['as'],'attributes':_0x549987['attributes'],'include':_0x549987[_0xfcd6('0x1d')]?_[_0xfcd6('0x1b')](_0x549987[_0xfcd6('0x1d')],function(_0x1e3402){return{'model':db[_0x1e3402['model']],'as':_0x1e3402['as'],'attributes':_0x1e3402['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x570030){logger['info'](_0xfcd6('0x14'),_0x4e9290);logger[_0xfcd6('0xc')]('GetFreshsalesAccount',_0x4e9290,JSON['stringify'](_0x570030));_0x429c23(_0x570030);})[_0xfcd6('0x1e')](function(_0x150c63){logger[_0xfcd6('0xe')](_0xfcd6('0x14'),_0x150c63[_0xfcd6('0x11')],_0x4e9290);_0x12ca83(_0x4caa42[_0xfcd6('0xe')](0x1f4,_0x150c63['message']));});});};exports[_0xfcd6('0x1f')]=function(_0x2d8f18){var _0x31fcd3=this;return new Promise(function(_0x110b51,_0x40b10b){return db['FreshsalesAccount']['find']({'raw':_0x2d8f18[_0xfcd6('0x17')]?_0x2d8f18[_0xfcd6('0x17')][_0xfcd6('0x20')]===undefined?!![]:![]:!![],'where':_0x2d8f18[_0xfcd6('0x17')]?_0x2d8f18[_0xfcd6('0x17')]['where']||null:null,'attributes':_0x2d8f18['options']?_0x2d8f18[_0xfcd6('0x17')][_0xfcd6('0x19')]||null:null,'include':_0x2d8f18['options']?_0x2d8f18[_0xfcd6('0x17')][_0xfcd6('0x1d')]?_[_0xfcd6('0x1b')](_0x2d8f18[_0xfcd6('0x17')][_0xfcd6('0x1d')],function(_0x174d4a){return{'model':db[_0x174d4a[_0xfcd6('0x1c')]],'as':_0x174d4a['as'],'attributes':_0x174d4a['attributes'],'include':_0x174d4a['include']?_[_0xfcd6('0x1b')](_0x174d4a[_0xfcd6('0x1d')],function(_0x5c4883){return{'model':db[_0x5c4883['model']],'as':_0x5c4883['as'],'attributes':_0x5c4883['attributes'],'include':_0x5c4883[_0xfcd6('0x1d')]?_[_0xfcd6('0x1b')](_0x5c4883['include'],function(_0x5c007f){return{'model':db[_0x5c007f[_0xfcd6('0x1c')]],'as':_0x5c007f['as'],'attributes':_0x5c007f[_0xfcd6('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfcd6('0x21')](function(_0x1a5ea4){logger['info'](_0xfcd6('0x1f'),_0x2d8f18);logger[_0xfcd6('0xc')](_0xfcd6('0x1f'),_0x2d8f18,JSON[_0xfcd6('0xd')](_0x1a5ea4));_0x110b51(_0x1a5ea4);})['catch'](function(_0x2f1342){logger[_0xfcd6('0xe')](_0xfcd6('0x1f'),_0x2f1342[_0xfcd6('0x11')],_0x2d8f18);_0x40b10b(_0x31fcd3[_0xfcd6('0xe')](0x1f4,_0x2f1342[_0xfcd6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2f53797..58f6ef1 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78b2=['getSubjects','getDescriptions','/:id/fields','getFields','post','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/subjects'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x78b2,0x143));var _0x278b=function(_0x5baa9d,_0x58a3e3){_0x5baa9d=_0x5baa9d-0x0;var _0x215a1d=_0x78b2[_0x5baa9d];return _0x215a1d;};'use strict';var multer=require(_0x278b('0x0'));var util=require(_0x278b('0x1'));var path=require('path');var timeout=require(_0x278b('0x2'));var express=require(_0x278b('0x3'));var router=express[_0x278b('0x4')]();var fs_extra=require(_0x278b('0x5'));var auth=require(_0x278b('0x6'));var interaction=require(_0x278b('0x7'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x278b('0x8')]('/',auth[_0x278b('0x9')](),controller[_0x278b('0xa')]);router[_0x278b('0x8')](_0x278b('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x278b('0xc'),auth[_0x278b('0x9')](),controller[_0x278b('0xd')]);router[_0x278b('0x8')]('/:id/descriptions',auth[_0x278b('0x9')](),controller[_0x278b('0xe')]);router['get'](_0x278b('0xf'),auth['isAuthenticated'](),controller[_0x278b('0x10')]);router[_0x278b('0x11')]('/',auth[_0x278b('0x9')](),controller['create']);router[_0x278b('0x12')](_0x278b('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x278b('0xb'),auth[_0x278b('0x9')](),controller[_0x278b('0x13')]);module[_0x278b('0x14')]=router; \ No newline at end of file +var _0xc528=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','update','delete','destroy'];(function(_0x6c4c43,_0x3bd4f4){var _0x15a789=function(_0xa17cbb){while(--_0xa17cbb){_0x6c4c43['push'](_0x6c4c43['shift']());}};_0x15a789(++_0x3bd4f4);}(_0xc528,0xfd));var _0x8c52=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc528[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8c52('0x0'));var util=require(_0x8c52('0x1'));var path=require(_0x8c52('0x2'));var timeout=require(_0x8c52('0x3'));var express=require(_0x8c52('0x4'));var router=express[_0x8c52('0x5')]();var fs_extra=require(_0x8c52('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8c52('0x7'));var config=require('../../config/environment');var controller=require(_0x8c52('0x8'));router[_0x8c52('0x9')]('/',auth[_0x8c52('0xa')](),controller[_0x8c52('0xb')]);router[_0x8c52('0x9')](_0x8c52('0xc'),auth[_0x8c52('0xa')](),controller[_0x8c52('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x8c52('0xe')]);router[_0x8c52('0x9')](_0x8c52('0xf'),auth[_0x8c52('0xa')](),controller[_0x8c52('0x10')]);router['get'](_0x8c52('0x11'),auth[_0x8c52('0xa')](),controller['getFields']);router[_0x8c52('0x12')]('/',auth[_0x8c52('0xa')](),controller[_0x8c52('0x13')]);router['put'](_0x8c52('0xc'),auth['isAuthenticated'](),controller[_0x8c52('0x14')]);router[_0x8c52('0x15')]('/:id',auth[_0x8c52('0xa')](),controller[_0x8c52('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 98f763e..09579a2 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe595=['sequelize','exports','STRING'];(function(_0xc0cfa7,_0xf2ef30){var _0xb5bbfc=function(_0xb3f2bc){while(--_0xb3f2bc){_0xc0cfa7['push'](_0xc0cfa7['shift']());}};_0xb5bbfc(++_0xf2ef30);}(_0xe595,0x153));var _0x5e59=function(_0x1552aa,_0x4fbfef){_0x1552aa=_0x1552aa-0x0;var _0x5e1e4d=_0xe595[_0x1552aa];return _0x5e1e4d;};'use strict';var Sequelize=require(_0x5e59('0x0'));module[_0x5e59('0x1')]={'name':{'type':Sequelize[_0x5e59('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4ce=['exports','sequelize'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xd4ce,0x1c1));var _0xed4c=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xd4ce[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xed4c('0x0'));module[_0xed4c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5e32456..184d15c 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ce7=['sendStatus','name','render','merge','body','contact','interaction','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','params','find','create','destroy','getSubjects','pick','getDescriptions','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','end','offset','undefined','limit','count','set','apply','save','update'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x4ce7,0x1ea));var _0x74ce=function(_0x44a066,_0x4b3a82){_0x44a066=_0x44a066-0x0;var _0x263cfd=_0x4ce7[_0x44a066];return _0x263cfd;};'use strict';var emlformat=require(_0x74ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74ce('0x1'));var jsonpatch=require(_0x74ce('0x2'));var rp=require(_0x74ce('0x3'));var moment=require(_0x74ce('0x4'));var BPromise=require(_0x74ce('0x5'));var Mustache=require(_0x74ce('0x6'));var util=require('util');var path=require(_0x74ce('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74ce('0x8'));var _=require(_0x74ce('0x9'));var squel=require(_0x74ce('0xa'));var crypto=require('crypto');var jsforce=require(_0x74ce('0xb'));var deskjs=require(_0x74ce('0xc'));var toCsv=require('to-csv');var querystring=require(_0x74ce('0xd'));var Papa=require(_0x74ce('0xe'));var Redis=require(_0x74ce('0xf'));var authService=require(_0x74ce('0x10'));var qs=require(_0x74ce('0x11'));var as=require(_0x74ce('0x12'));var hardwareService=require(_0x74ce('0x13'));var logger=require(_0x74ce('0x14'))('api');var utils=require(_0x74ce('0x15'));var config=require(_0x74ce('0x16'));var licenseUtil=require(_0x74ce('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x74ce('0x18'));var client=jayson[_0x74ce('0x19')][_0x74ce('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x244645,_0x4a9830,_0x10a2cf,_0x5b7146){return new BPromise(function(_0x5bc528,_0x2fa0c5){var _0x29b351=_0x5b7146||client;return _0x29b351[_0x74ce('0x1b')](_0x244645,_0x10a2cf)[_0x74ce('0x1c')](function(_0x3c098e){logger['info'](_0x74ce('0x1d'),_0x4a9830,'request\x20sent');logger[_0x74ce('0x1e')](_0x74ce('0x1f'),_0x4a9830,_0x74ce('0x20'),JSON[_0x74ce('0x21')](_0x3c098e));if(_0x3c098e[_0x74ce('0x22')]){if(_0x3c098e[_0x74ce('0x22')][_0x74ce('0x23')]===0x1f4){logger[_0x74ce('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4a9830,_0x3c098e[_0x74ce('0x22')][_0x74ce('0x24')]);return _0x2fa0c5(_0x3c098e['error'][_0x74ce('0x24')]);}logger['error'](_0x74ce('0x1d'),_0x4a9830,_0x3c098e[_0x74ce('0x22')][_0x74ce('0x24')]);return _0x5bc528(_0x3c098e[_0x74ce('0x22')][_0x74ce('0x24')]);}else{logger[_0x74ce('0x25')](_0x74ce('0x1d'),_0x4a9830,_0x74ce('0x20'));_0x5bc528(_0x3c098e[_0x74ce('0x26')][_0x74ce('0x24')]);}})[_0x74ce('0x27')](function(_0x14e9b6){logger['error'](_0x74ce('0x1d'),_0x4a9830,_0x14e9b6);_0x2fa0c5(_0x14e9b6);});});}function respondWithStatusCode(_0x22714f,_0x23a585){_0x23a585=_0x23a585||0xcc;return function(_0xc27991){if(_0xc27991){return _0x22714f['sendStatus'](_0x23a585);}return _0x22714f[_0x74ce('0x28')](_0x23a585)[_0x74ce('0x29')]();};}function respondWithResult(_0xdea565,_0x3799e3){_0x3799e3=_0x3799e3||0xc8;return function(_0xca7d56){if(_0xca7d56){return _0xdea565[_0x74ce('0x28')](_0x3799e3)['json'](_0xca7d56);}};}function respondWithFilteredResult(_0x53f56b,_0x5605ec){return function(_0x592850){if(_0x592850){var _0xc069a9=typeof _0x5605ec[_0x74ce('0x2a')]===_0x74ce('0x2b')&&typeof _0x5605ec[_0x74ce('0x2c')]===_0x74ce('0x2b');var _0x447cd5=_0x592850[_0x74ce('0x2d')];var _0xdf6839=_0xc069a9?0x0:_0x5605ec['offset'];var _0x2c7822=_0xc069a9?_0x592850[_0x74ce('0x2d')]:_0x5605ec[_0x74ce('0x2a')]+_0x5605ec[_0x74ce('0x2c')];var _0x332403;if(_0x2c7822>=_0x447cd5){_0x2c7822=_0x447cd5;_0x332403=0xc8;}else{_0x332403=0xce;}_0x53f56b[_0x74ce('0x28')](_0x332403);return _0x53f56b[_0x74ce('0x2e')]('Content-Range',_0xdf6839+'-'+_0x2c7822+'/'+_0x447cd5)['json'](_0x592850);}return null;};}function patchUpdates(_0x5d7952){return function(_0x25f0cf){try{jsonpatch[_0x74ce('0x2f')](_0x25f0cf,_0x5d7952,!![]);}catch(_0x29453f){return BPromise['reject'](_0x29453f);}return _0x25f0cf[_0x74ce('0x30')]();};}function saveUpdates(_0x49eeef,_0x5621df){return function(_0x2d9bd8){if(_0x2d9bd8){return _0x2d9bd8[_0x74ce('0x31')](_0x49eeef)[_0x74ce('0x1c')](function(_0x53c7a9){return _0x53c7a9;});}return null;};}function removeEntity(_0x11006c,_0x121b22){return function(_0x111e51){if(_0x111e51){return _0x111e51['destroy']()[_0x74ce('0x1c')](function(){_0x11006c[_0x74ce('0x28')](0xcc)[_0x74ce('0x29')]();});}};}function handleEntityNotFound(_0x2e459b,_0x19c2c8){return function(_0xc7ae58){if(!_0xc7ae58){_0x2e459b[_0x74ce('0x32')](0x194);}return _0xc7ae58;};}function handleError(_0x7da78d,_0x3fd201){_0x3fd201=_0x3fd201||0x1f4;return function(_0x278067){logger[_0x74ce('0x22')](_0x278067['stack']);if(_0x278067[_0x74ce('0x33')]){delete _0x278067[_0x74ce('0x33')];}_0x7da78d['status'](_0x3fd201)['send'](_0x278067);};}function getMustacheRender(_0x5966e5,_0x3d99f1){return Mustache[_0x74ce('0x34')](_0x5966e5,_[_0x74ce('0x35')](_0x3d99f1[_0x74ce('0x36')],{'contact':_0x3d99f1[_0x74ce('0x37')],'message':_0x3d99f1['message'],'agent':_0x3d99f1['agent'],'interaction':_0x3d99f1[_0x74ce('0x38')],'account':_0x3d99f1['account']}))||'';}exports['index']=function(_0x3e8d2a,_0x4734c1){var _0x10d960={},_0x3c811a={},_0x41fc54={'count':0x0,'rows':[]};var _0x289c78=_['map'](db[_0x74ce('0x39')][_0x74ce('0x3a')],function(_0x2076fb){return{'name':_0x2076fb[_0x74ce('0x3b')],'type':_0x2076fb[_0x74ce('0x3c')][_0x74ce('0x3d')]};});_0x3c811a[_0x74ce('0x3e')]=_[_0x74ce('0x3f')](_0x289c78,_0x74ce('0x33'));_0x3c811a[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0x3e8d2a[_0x74ce('0x40')]);_0x3c811a[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x3c811a[_0x74ce('0x3e')],_0x3c811a[_0x74ce('0x40')]);_0x10d960[_0x74ce('0x44')]=_['intersection'](_0x3c811a[_0x74ce('0x3e')],qs['fields'](_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x45')]));_0x10d960[_0x74ce('0x44')]=_0x10d960[_0x74ce('0x44')][_0x74ce('0x46')]?_0x10d960[_0x74ce('0x44')]:_0x3c811a[_0x74ce('0x3e')];if(!_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x47')](_0x74ce('0x48'))){_0x10d960[_0x74ce('0x2c')]=qs[_0x74ce('0x2c')](_0x3e8d2a['query']['limit']);_0x10d960[_0x74ce('0x2a')]=qs['offset'](_0x3e8d2a['query']['offset']);}_0x10d960[_0x74ce('0x49')]=qs[_0x74ce('0x4a')](_0x3e8d2a['query'][_0x74ce('0x4a')]);_0x10d960[_0x74ce('0x4b')]=qs[_0x74ce('0x42')](_['pick'](_0x3e8d2a[_0x74ce('0x40')],_0x3c811a['filters']),_0x289c78);if(_0x3e8d2a['query'][_0x74ce('0x4c')]){_0x10d960['where']=_[_0x74ce('0x35')](_0x10d960['where'],{'$or':_['map'](_0x289c78,function(_0x306d74){if(_0x306d74['type']!==_0x74ce('0x4d')){var _0xa1d2af={};_0xa1d2af[_0x306d74[_0x74ce('0x33')]]={'$like':'%'+_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x4c')]+'%'};return _0xa1d2af;}})});}_0x10d960=_[_0x74ce('0x35')]({},_0x10d960,_0x3e8d2a[_0x74ce('0x4e')]);var _0x333c83={'where':_0x10d960['where']};return db[_0x74ce('0x39')][_0x74ce('0x2d')](_0x333c83)[_0x74ce('0x1c')](function(_0x529335){_0x41fc54[_0x74ce('0x2d')]=_0x529335;if(_0x3e8d2a[_0x74ce('0x40')][_0x74ce('0x4f')]){_0x10d960[_0x74ce('0x50')]=[{'all':!![]}];}return db[_0x74ce('0x39')]['findAll'](_0x10d960);})[_0x74ce('0x1c')](function(_0x2d8502){_0x41fc54['rows']=_0x2d8502;return _0x41fc54;})['then'](respondWithFilteredResult(_0x4734c1,_0x10d960))[_0x74ce('0x27')](handleError(_0x4734c1,null));};exports['show']=function(_0x364e8a,_0x5a270e){var _0x1630c6={'raw':![],'where':{'id':_0x364e8a[_0x74ce('0x51')]['id']}},_0x515b1e={};_0x515b1e['model']=_[_0x74ce('0x41')](db['FreshsalesConfiguration'][_0x74ce('0x3a')]);_0x515b1e[_0x74ce('0x40')]=_['keys'](_0x364e8a[_0x74ce('0x40')]);_0x515b1e[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x515b1e[_0x74ce('0x3e')],_0x515b1e['query']);_0x1630c6[_0x74ce('0x44')]=_['intersection'](_0x515b1e['model'],qs['fields'](_0x364e8a['query'][_0x74ce('0x45')]));_0x1630c6[_0x74ce('0x44')]=_0x1630c6[_0x74ce('0x44')][_0x74ce('0x46')]?_0x1630c6[_0x74ce('0x44')]:_0x515b1e[_0x74ce('0x3e')];if(_0x364e8a[_0x74ce('0x40')][_0x74ce('0x4f')]){_0x1630c6[_0x74ce('0x50')]=[{'all':!![]}];}_0x1630c6=_[_0x74ce('0x35')]({},_0x1630c6,_0x364e8a[_0x74ce('0x4e')]);return db[_0x74ce('0x39')][_0x74ce('0x52')](_0x1630c6)[_0x74ce('0x1c')](handleEntityNotFound(_0x5a270e,null))['then'](respondWithResult(_0x5a270e,null))[_0x74ce('0x27')](handleError(_0x5a270e,null));};exports['create']=function(_0x790001,_0x1e077f){return db[_0x74ce('0x39')][_0x74ce('0x53')](_0x790001[_0x74ce('0x36')],{})[_0x74ce('0x1c')](respondWithResult(_0x1e077f,0xc9))[_0x74ce('0x27')](handleError(_0x1e077f,null));};exports[_0x74ce('0x31')]=function(_0x552cf0,_0x220fc6){if(_0x552cf0[_0x74ce('0x36')]['id']){delete _0x552cf0[_0x74ce('0x36')]['id'];}return db[_0x74ce('0x39')][_0x74ce('0x52')]({'where':{'id':_0x552cf0[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x220fc6,null))[_0x74ce('0x1c')](saveUpdates(_0x552cf0[_0x74ce('0x36')],null))['then'](respondWithResult(_0x220fc6,null))[_0x74ce('0x27')](handleError(_0x220fc6,null));};exports[_0x74ce('0x54')]=function(_0x360cff,_0x4d1b99){return db['FreshsalesConfiguration'][_0x74ce('0x52')]({'where':{'id':_0x360cff['params']['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x4d1b99,null))[_0x74ce('0x1c')](removeEntity(_0x4d1b99,null))[_0x74ce('0x27')](handleError(_0x4d1b99,null));};exports[_0x74ce('0x55')]=function(_0x5c02a9,_0x873101,_0x46550a){var _0x454179={};var _0xabc48a={};var _0x47e249;var _0x19c994;return db[_0x74ce('0x39')]['findOne']({'where':{'id':_0x5c02a9[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x873101,null))[_0x74ce('0x1c')](function(_0x3222f9){if(_0x3222f9){_0x47e249=_0x3222f9;_0xabc48a[_0x74ce('0x3e')]=_[_0x74ce('0x41')](db['FreshsalesField']['rawAttributes']);_0xabc48a[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0x5c02a9['query']);_0xabc48a[_0x74ce('0x42')]=_['intersection'](_0xabc48a[_0x74ce('0x3e')],_0xabc48a[_0x74ce('0x40')]);_0x454179['attributes']=_[_0x74ce('0x43')](_0xabc48a[_0x74ce('0x3e')],qs[_0x74ce('0x45')](_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x45')]));_0x454179['attributes']=_0x454179[_0x74ce('0x44')][_0x74ce('0x46')]?_0x454179['attributes']:_0xabc48a[_0x74ce('0x3e')];_0x454179[_0x74ce('0x49')]=qs['sort'](_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x4a')]);_0x454179['where']=qs[_0x74ce('0x42')](_[_0x74ce('0x56')](_0x5c02a9['query'],_0xabc48a[_0x74ce('0x42')]));if(_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x4c')]){_0x454179[_0x74ce('0x4b')]=_[_0x74ce('0x35')](_0x454179['where'],{'$or':_[_0x74ce('0x3f')](_0x454179[_0x74ce('0x44')],function(_0x42952c){var _0x4ffec9={};_0x4ffec9[_0x42952c]={'$like':'%'+_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x4c')]+'%'};return _0x4ffec9;})});}_0x454179=_[_0x74ce('0x35')]({},_0x454179,_0x5c02a9[_0x74ce('0x4e')]);return _0x47e249[_0x74ce('0x55')](_0x454179);}})['then'](function(_0x1e4fd2){if(_0x1e4fd2){_0x19c994=_0x1e4fd2[_0x74ce('0x46')];if(!_0x5c02a9['query']['hasOwnProperty']('nolimit')){_0x454179[_0x74ce('0x2c')]=qs[_0x74ce('0x2c')](_0x5c02a9[_0x74ce('0x40')]['limit']);_0x454179[_0x74ce('0x2a')]=qs[_0x74ce('0x2a')](_0x5c02a9[_0x74ce('0x40')][_0x74ce('0x2a')]);}return _0x47e249['getSubjects'](_0x454179);}})[_0x74ce('0x1c')](function(_0x592cfd){if(_0x592cfd){return _0x592cfd?{'count':_0x19c994,'rows':_0x592cfd}:null;}})[_0x74ce('0x1c')](respondWithResult(_0x873101,null))['catch'](handleError(_0x873101,null));};exports[_0x74ce('0x57')]=function(_0x5e914c,_0x41bb22,_0x2f9d62){var _0x33ff95={};var _0x37f9b7={};var _0x5679ee;var _0x401719;return db[_0x74ce('0x39')]['findOne']({'where':{'id':_0x5e914c[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x41bb22,null))[_0x74ce('0x1c')](function(_0x2cd365){if(_0x2cd365){_0x5679ee=_0x2cd365;_0x37f9b7[_0x74ce('0x3e')]=_[_0x74ce('0x41')](db[_0x74ce('0x58')]['rawAttributes']);_0x37f9b7[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0x5e914c[_0x74ce('0x40')]);_0x37f9b7[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x37f9b7[_0x74ce('0x3e')],_0x37f9b7[_0x74ce('0x40')]);_0x33ff95[_0x74ce('0x44')]=_['intersection'](_0x37f9b7[_0x74ce('0x3e')],qs[_0x74ce('0x45')](_0x5e914c[_0x74ce('0x40')]['fields']));_0x33ff95[_0x74ce('0x44')]=_0x33ff95[_0x74ce('0x44')][_0x74ce('0x46')]?_0x33ff95[_0x74ce('0x44')]:_0x37f9b7[_0x74ce('0x3e')];_0x33ff95[_0x74ce('0x49')]=qs['sort'](_0x5e914c['query'][_0x74ce('0x4a')]);_0x33ff95[_0x74ce('0x4b')]=qs['filters'](_[_0x74ce('0x56')](_0x5e914c[_0x74ce('0x40')],_0x37f9b7[_0x74ce('0x42')]));if(_0x5e914c['query']['filter']){_0x33ff95[_0x74ce('0x4b')]=_['merge'](_0x33ff95[_0x74ce('0x4b')],{'$or':_[_0x74ce('0x3f')](_0x33ff95['attributes'],function(_0xa6420f){var _0x2b8593={};_0x2b8593[_0xa6420f]={'$like':'%'+_0x5e914c[_0x74ce('0x40')][_0x74ce('0x4c')]+'%'};return _0x2b8593;})});}_0x33ff95=_['merge']({},_0x33ff95,_0x5e914c[_0x74ce('0x4e')]);return _0x5679ee[_0x74ce('0x57')](_0x33ff95);}})[_0x74ce('0x1c')](function(_0x2622a6){if(_0x2622a6){_0x401719=_0x2622a6[_0x74ce('0x46')];if(!_0x5e914c['query']['hasOwnProperty'](_0x74ce('0x48'))){_0x33ff95[_0x74ce('0x2c')]=qs[_0x74ce('0x2c')](_0x5e914c[_0x74ce('0x40')][_0x74ce('0x2c')]);_0x33ff95[_0x74ce('0x2a')]=qs['offset'](_0x5e914c[_0x74ce('0x40')][_0x74ce('0x2a')]);}return _0x5679ee[_0x74ce('0x57')](_0x33ff95);}})['then'](function(_0x6921af){if(_0x6921af){return _0x6921af?{'count':_0x401719,'rows':_0x6921af}:null;}})[_0x74ce('0x1c')](respondWithResult(_0x41bb22,null))['catch'](handleError(_0x41bb22,null));};exports[_0x74ce('0x59')]=function(_0xdd3752,_0x2f5960,_0x643201){var _0x7c177d={};var _0x16be19={};var _0x22b7f2;var _0x2bd3c4;return db[_0x74ce('0x39')]['findOne']({'where':{'id':_0xdd3752[_0x74ce('0x51')]['id']}})[_0x74ce('0x1c')](handleEntityNotFound(_0x2f5960,null))[_0x74ce('0x1c')](function(_0x185664){if(_0x185664){_0x22b7f2=_0x185664;_0x16be19[_0x74ce('0x3e')]=_['keys'](db[_0x74ce('0x58')][_0x74ce('0x3a')]);_0x16be19[_0x74ce('0x40')]=_[_0x74ce('0x41')](_0xdd3752[_0x74ce('0x40')]);_0x16be19[_0x74ce('0x42')]=_[_0x74ce('0x43')](_0x16be19['model'],_0x16be19[_0x74ce('0x40')]);_0x7c177d[_0x74ce('0x44')]=_[_0x74ce('0x43')](_0x16be19['model'],qs['fields'](_0xdd3752['query'][_0x74ce('0x45')]));_0x7c177d['attributes']=_0x7c177d['attributes'][_0x74ce('0x46')]?_0x7c177d[_0x74ce('0x44')]:_0x16be19['model'];_0x7c177d[_0x74ce('0x49')]=qs[_0x74ce('0x4a')](_0xdd3752[_0x74ce('0x40')][_0x74ce('0x4a')]);_0x7c177d[_0x74ce('0x4b')]=qs[_0x74ce('0x42')](_[_0x74ce('0x56')](_0xdd3752['query'],_0x16be19[_0x74ce('0x42')]));if(_0xdd3752[_0x74ce('0x40')][_0x74ce('0x4c')]){_0x7c177d[_0x74ce('0x4b')]=_[_0x74ce('0x35')](_0x7c177d[_0x74ce('0x4b')],{'$or':_[_0x74ce('0x3f')](_0x7c177d[_0x74ce('0x44')],function(_0x3006dd){var _0x36ac27={};_0x36ac27[_0x3006dd]={'$like':'%'+_0xdd3752[_0x74ce('0x40')]['filter']+'%'};return _0x36ac27;})});}_0x7c177d=_[_0x74ce('0x35')]({},_0x7c177d,_0xdd3752[_0x74ce('0x4e')]);return _0x22b7f2['getFields'](_0x7c177d);}})[_0x74ce('0x1c')](function(_0x414fec){if(_0x414fec){_0x2bd3c4=_0x414fec[_0x74ce('0x46')];if(!_0xdd3752[_0x74ce('0x40')][_0x74ce('0x47')](_0x74ce('0x48'))){_0x7c177d['limit']=qs[_0x74ce('0x2c')](_0xdd3752[_0x74ce('0x40')][_0x74ce('0x2c')]);_0x7c177d[_0x74ce('0x2a')]=qs['offset'](_0xdd3752[_0x74ce('0x40')][_0x74ce('0x2a')]);}return _0x22b7f2[_0x74ce('0x59')](_0x7c177d);}})[_0x74ce('0x1c')](function(_0x1b86d5){if(_0x1b86d5){return _0x1b86d5?{'count':_0x2bd3c4,'rows':_0x1b86d5}:null;}})[_0x74ce('0x1c')](respondWithResult(_0x2f5960,null))[_0x74ce('0x27')](handleError(_0x2f5960,null));}; \ No newline at end of file +var _0xc083=['index','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','params','keys','find','create','update','getSubjects','findOne','FreshsalesField','pick','options','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','stack','name','send','render','merge','body','contact','agent','interaction'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0xc083,0x1aa));var _0x3c08=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc083[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x3c08('0x0'));var rimraf=require(_0x3c08('0x1'));var zipdir=require(_0x3c08('0x2'));var jsonpatch=require(_0x3c08('0x3'));var rp=require(_0x3c08('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3c08('0x5'));var util=require(_0x3c08('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3c08('0x7'));var fs=require('fs');var fs_extra=require(_0x3c08('0x8'));var _=require(_0x3c08('0x9'));var squel=require(_0x3c08('0xa'));var crypto=require(_0x3c08('0xb'));var jsforce=require(_0x3c08('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c08('0xd'));var querystring=require(_0x3c08('0xe'));var Papa=require(_0x3c08('0xf'));var Redis=require(_0x3c08('0x10'));var authService=require(_0x3c08('0x11'));var qs=require(_0x3c08('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c08('0x13'));var logger=require('../../config/logger')(_0x3c08('0x14'));var utils=require(_0x3c08('0x15'));var config=require(_0x3c08('0x16'));var licenseUtil=require(_0x3c08('0x17'));var db=require(_0x3c08('0x18'))['db'];var jayson=require(_0x3c08('0x19'));var client=jayson[_0x3c08('0x1a')][_0x3c08('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4260ae,_0xd2c9bb,_0x5bcaae,_0x4773e5){return new BPromise(function(_0x106622,_0xde513f){var _0x3b04c5=_0x4773e5||client;return _0x3b04c5[_0x3c08('0x1c')](_0x4260ae,_0x5bcaae)[_0x3c08('0x1d')](function(_0x387798){logger[_0x3c08('0x1e')](_0x3c08('0x1f'),_0xd2c9bb,'request\x20sent');logger[_0x3c08('0x20')](_0x3c08('0x21'),_0xd2c9bb,_0x3c08('0x22'),JSON[_0x3c08('0x23')](_0x387798));if(_0x387798['error']){if(_0x387798[_0x3c08('0x24')]['code']===0x1f4){logger['error'](_0x3c08('0x1f'),_0xd2c9bb,_0x387798[_0x3c08('0x24')]['message']);return _0xde513f(_0x387798[_0x3c08('0x24')][_0x3c08('0x25')]);}logger[_0x3c08('0x24')](_0x3c08('0x1f'),_0xd2c9bb,_0x387798['error'][_0x3c08('0x25')]);return _0x106622(_0x387798[_0x3c08('0x24')][_0x3c08('0x25')]);}else{logger[_0x3c08('0x1e')](_0x3c08('0x1f'),_0xd2c9bb,_0x3c08('0x22'));_0x106622(_0x387798['result']['message']);}})['catch'](function(_0x4562da){logger[_0x3c08('0x24')](_0x3c08('0x1f'),_0xd2c9bb,_0x4562da);_0xde513f(_0x4562da);});});}function respondWithStatusCode(_0x56c7e0,_0x4375dc){_0x4375dc=_0x4375dc||0xcc;return function(_0x29c6a2){if(_0x29c6a2){return _0x56c7e0[_0x3c08('0x26')](_0x4375dc);}return _0x56c7e0['status'](_0x4375dc)[_0x3c08('0x27')]();};}function respondWithResult(_0x4f7fc5,_0x54c765){_0x54c765=_0x54c765||0xc8;return function(_0x274e73){if(_0x274e73){return _0x4f7fc5[_0x3c08('0x28')](_0x54c765)[_0x3c08('0x29')](_0x274e73);}};}function respondWithFilteredResult(_0x27e4d5,_0x42d21e){return function(_0x2704b0){if(_0x2704b0){var _0x5202c6=typeof _0x42d21e['offset']===_0x3c08('0x2a')&&typeof _0x42d21e[_0x3c08('0x2b')]===_0x3c08('0x2a');var _0x2bf9e4=_0x2704b0[_0x3c08('0x2c')];var _0x38fcc2=_0x5202c6?0x0:_0x42d21e[_0x3c08('0x2d')];var _0x26ba61=_0x5202c6?_0x2704b0['count']:_0x42d21e['offset']+_0x42d21e['limit'];var _0x13ecb2;if(_0x26ba61>=_0x2bf9e4){_0x26ba61=_0x2bf9e4;_0x13ecb2=0xc8;}else{_0x13ecb2=0xce;}_0x27e4d5['status'](_0x13ecb2);return _0x27e4d5[_0x3c08('0x2e')](_0x3c08('0x2f'),_0x38fcc2+'-'+_0x26ba61+'/'+_0x2bf9e4)[_0x3c08('0x29')](_0x2704b0);}return null;};}function patchUpdates(_0x262548){return function(_0x24b12b){try{jsonpatch['apply'](_0x24b12b,_0x262548,!![]);}catch(_0x19c2d3){return BPromise[_0x3c08('0x30')](_0x19c2d3);}return _0x24b12b[_0x3c08('0x31')]();};}function saveUpdates(_0x580f1f,_0xd5cfa3){return function(_0x2488b5){if(_0x2488b5){return _0x2488b5['update'](_0x580f1f)[_0x3c08('0x1d')](function(_0x1827a7){return _0x1827a7;});}return null;};}function removeEntity(_0x268689,_0x4e40ec){return function(_0x41de1c){if(_0x41de1c){return _0x41de1c['destroy']()[_0x3c08('0x1d')](function(){_0x268689['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x284ce1,_0x559650){return function(_0x56e77f){if(!_0x56e77f){_0x284ce1[_0x3c08('0x26')](0x194);}return _0x56e77f;};}function handleError(_0x44a3d2,_0x5c67a0){_0x5c67a0=_0x5c67a0||0x1f4;return function(_0x33552f){logger[_0x3c08('0x24')](_0x33552f[_0x3c08('0x32')]);if(_0x33552f[_0x3c08('0x33')]){delete _0x33552f[_0x3c08('0x33')];}_0x44a3d2[_0x3c08('0x28')](_0x5c67a0)[_0x3c08('0x34')](_0x33552f);};}function getMustacheRender(_0x31fbbf,_0x457772){return Mustache[_0x3c08('0x35')](_0x31fbbf,_[_0x3c08('0x36')](_0x457772[_0x3c08('0x37')],{'contact':_0x457772[_0x3c08('0x38')],'message':_0x457772['message'],'agent':_0x457772[_0x3c08('0x39')],'interaction':_0x457772[_0x3c08('0x3a')],'account':_0x457772['account']}))||'';}exports[_0x3c08('0x3b')]=function(_0x50b67f,_0x4df9d4){var _0x55891b={},_0x4e30b4={},_0x55a8a8={'count':0x0,'rows':[]};var _0x3b15c3=_['map'](db['FreshsalesConfiguration'][_0x3c08('0x3c')],function(_0x1d8a13){return{'name':_0x1d8a13[_0x3c08('0x3d')],'type':_0x1d8a13[_0x3c08('0x3e')][_0x3c08('0x3f')]};});_0x4e30b4['model']=_['map'](_0x3b15c3,_0x3c08('0x33'));_0x4e30b4[_0x3c08('0x40')]=_['keys'](_0x50b67f[_0x3c08('0x40')]);_0x4e30b4[_0x3c08('0x41')]=_['intersection'](_0x4e30b4[_0x3c08('0x42')],_0x4e30b4['query']);_0x55891b[_0x3c08('0x43')]=_[_0x3c08('0x44')](_0x4e30b4[_0x3c08('0x42')],qs[_0x3c08('0x45')](_0x50b67f[_0x3c08('0x40')]['fields']));_0x55891b[_0x3c08('0x43')]=_0x55891b[_0x3c08('0x43')][_0x3c08('0x46')]?_0x55891b[_0x3c08('0x43')]:_0x4e30b4[_0x3c08('0x42')];if(!_0x50b67f[_0x3c08('0x40')][_0x3c08('0x47')](_0x3c08('0x48'))){_0x55891b[_0x3c08('0x2b')]=qs[_0x3c08('0x2b')](_0x50b67f[_0x3c08('0x40')][_0x3c08('0x2b')]);_0x55891b[_0x3c08('0x2d')]=qs[_0x3c08('0x2d')](_0x50b67f[_0x3c08('0x40')][_0x3c08('0x2d')]);}_0x55891b[_0x3c08('0x49')]=qs[_0x3c08('0x4a')](_0x50b67f['query'][_0x3c08('0x4a')]);_0x55891b[_0x3c08('0x4b')]=qs['filters'](_['pick'](_0x50b67f['query'],_0x4e30b4[_0x3c08('0x41')]),_0x3b15c3);if(_0x50b67f[_0x3c08('0x40')][_0x3c08('0x4c')]){_0x55891b['where']=_[_0x3c08('0x36')](_0x55891b[_0x3c08('0x4b')],{'$or':_[_0x3c08('0x4d')](_0x3b15c3,function(_0x4139af){if(_0x4139af[_0x3c08('0x3e')]!==_0x3c08('0x4e')){var _0x2a5f4d={};_0x2a5f4d[_0x4139af[_0x3c08('0x33')]]={'$like':'%'+_0x50b67f[_0x3c08('0x40')][_0x3c08('0x4c')]+'%'};return _0x2a5f4d;}})});}_0x55891b=_['merge']({},_0x55891b,_0x50b67f['options']);var _0x69e075={'where':_0x55891b[_0x3c08('0x4b')]};return db[_0x3c08('0x4f')]['count'](_0x69e075)[_0x3c08('0x1d')](function(_0x261af0){_0x55a8a8[_0x3c08('0x2c')]=_0x261af0;if(_0x50b67f[_0x3c08('0x40')][_0x3c08('0x50')]){_0x55891b[_0x3c08('0x51')]=[{'all':!![]}];}return db[_0x3c08('0x4f')][_0x3c08('0x52')](_0x55891b);})[_0x3c08('0x1d')](function(_0xa46f32){_0x55a8a8[_0x3c08('0x53')]=_0xa46f32;return _0x55a8a8;})['then'](respondWithFilteredResult(_0x4df9d4,_0x55891b))[_0x3c08('0x54')](handleError(_0x4df9d4,null));};exports['show']=function(_0x2c4fce,_0x2796b4){var _0x3aedca={'raw':![],'where':{'id':_0x2c4fce[_0x3c08('0x55')]['id']}},_0x359770={};_0x359770[_0x3c08('0x42')]=_['keys'](db['FreshsalesConfiguration'][_0x3c08('0x3c')]);_0x359770[_0x3c08('0x40')]=_[_0x3c08('0x56')](_0x2c4fce[_0x3c08('0x40')]);_0x359770[_0x3c08('0x41')]=_[_0x3c08('0x44')](_0x359770['model'],_0x359770[_0x3c08('0x40')]);_0x3aedca[_0x3c08('0x43')]=_[_0x3c08('0x44')](_0x359770[_0x3c08('0x42')],qs['fields'](_0x2c4fce[_0x3c08('0x40')][_0x3c08('0x45')]));_0x3aedca['attributes']=_0x3aedca[_0x3c08('0x43')][_0x3c08('0x46')]?_0x3aedca[_0x3c08('0x43')]:_0x359770[_0x3c08('0x42')];if(_0x2c4fce['query'][_0x3c08('0x50')]){_0x3aedca['include']=[{'all':!![]}];}_0x3aedca=_[_0x3c08('0x36')]({},_0x3aedca,_0x2c4fce['options']);return db['FreshsalesConfiguration'][_0x3c08('0x57')](_0x3aedca)[_0x3c08('0x1d')](handleEntityNotFound(_0x2796b4,null))['then'](respondWithResult(_0x2796b4,null))[_0x3c08('0x54')](handleError(_0x2796b4,null));};exports[_0x3c08('0x58')]=function(_0x4e4136,_0x59d60c){return db[_0x3c08('0x4f')][_0x3c08('0x58')](_0x4e4136[_0x3c08('0x37')],{})[_0x3c08('0x1d')](respondWithResult(_0x59d60c,0xc9))['catch'](handleError(_0x59d60c,null));};exports[_0x3c08('0x59')]=function(_0x11ab9b,_0x35fc1d){if(_0x11ab9b[_0x3c08('0x37')]['id']){delete _0x11ab9b['body']['id'];}return db[_0x3c08('0x4f')]['find']({'where':{'id':_0x11ab9b[_0x3c08('0x55')]['id']}})['then'](handleEntityNotFound(_0x35fc1d,null))[_0x3c08('0x1d')](saveUpdates(_0x11ab9b[_0x3c08('0x37')],null))[_0x3c08('0x1d')](respondWithResult(_0x35fc1d,null))[_0x3c08('0x54')](handleError(_0x35fc1d,null));};exports['destroy']=function(_0x4dfea7,_0x5a89d8){return db[_0x3c08('0x4f')]['find']({'where':{'id':_0x4dfea7[_0x3c08('0x55')]['id']}})[_0x3c08('0x1d')](handleEntityNotFound(_0x5a89d8,null))['then'](removeEntity(_0x5a89d8,null))[_0x3c08('0x54')](handleError(_0x5a89d8,null));};exports[_0x3c08('0x5a')]=function(_0x245499,_0x247cc9,_0x363a80){var _0x45522e={};var _0x5ab850={};var _0x32c5b8;var _0x3be569;return db[_0x3c08('0x4f')][_0x3c08('0x5b')]({'where':{'id':_0x245499['params']['id']}})[_0x3c08('0x1d')](handleEntityNotFound(_0x247cc9,null))[_0x3c08('0x1d')](function(_0x1b9356){if(_0x1b9356){_0x32c5b8=_0x1b9356;_0x5ab850[_0x3c08('0x42')]=_[_0x3c08('0x56')](db[_0x3c08('0x5c')][_0x3c08('0x3c')]);_0x5ab850['query']=_[_0x3c08('0x56')](_0x245499[_0x3c08('0x40')]);_0x5ab850['filters']=_[_0x3c08('0x44')](_0x5ab850[_0x3c08('0x42')],_0x5ab850[_0x3c08('0x40')]);_0x45522e[_0x3c08('0x43')]=_['intersection'](_0x5ab850[_0x3c08('0x42')],qs[_0x3c08('0x45')](_0x245499[_0x3c08('0x40')][_0x3c08('0x45')]));_0x45522e[_0x3c08('0x43')]=_0x45522e[_0x3c08('0x43')][_0x3c08('0x46')]?_0x45522e['attributes']:_0x5ab850[_0x3c08('0x42')];_0x45522e[_0x3c08('0x49')]=qs['sort'](_0x245499[_0x3c08('0x40')][_0x3c08('0x4a')]);_0x45522e[_0x3c08('0x4b')]=qs[_0x3c08('0x41')](_[_0x3c08('0x5d')](_0x245499[_0x3c08('0x40')],_0x5ab850[_0x3c08('0x41')]));if(_0x245499['query'][_0x3c08('0x4c')]){_0x45522e[_0x3c08('0x4b')]=_[_0x3c08('0x36')](_0x45522e['where'],{'$or':_[_0x3c08('0x4d')](_0x45522e[_0x3c08('0x43')],function(_0x538a5a){var _0x326897={};_0x326897[_0x538a5a]={'$like':'%'+_0x245499[_0x3c08('0x40')][_0x3c08('0x4c')]+'%'};return _0x326897;})});}_0x45522e=_['merge']({},_0x45522e,_0x245499[_0x3c08('0x5e')]);return _0x32c5b8[_0x3c08('0x5a')](_0x45522e);}})[_0x3c08('0x1d')](function(_0x5a4b75){if(_0x5a4b75){_0x3be569=_0x5a4b75['length'];if(!_0x245499['query']['hasOwnProperty'](_0x3c08('0x48'))){_0x45522e[_0x3c08('0x2b')]=qs[_0x3c08('0x2b')](_0x245499['query'][_0x3c08('0x2b')]);_0x45522e[_0x3c08('0x2d')]=qs[_0x3c08('0x2d')](_0x245499[_0x3c08('0x40')][_0x3c08('0x2d')]);}return _0x32c5b8['getSubjects'](_0x45522e);}})['then'](function(_0x57680d){if(_0x57680d){return _0x57680d?{'count':_0x3be569,'rows':_0x57680d}:null;}})[_0x3c08('0x1d')](respondWithResult(_0x247cc9,null))['catch'](handleError(_0x247cc9,null));};exports[_0x3c08('0x5f')]=function(_0x526cbc,_0x5089f3,_0x19424f){var _0x3ef38d={};var _0x2b7b15={};var _0x2e676b;var _0x2f39de;return db[_0x3c08('0x4f')][_0x3c08('0x5b')]({'where':{'id':_0x526cbc['params']['id']}})['then'](handleEntityNotFound(_0x5089f3,null))['then'](function(_0x39f3df){if(_0x39f3df){_0x2e676b=_0x39f3df;_0x2b7b15['model']=_[_0x3c08('0x56')](db[_0x3c08('0x5c')][_0x3c08('0x3c')]);_0x2b7b15[_0x3c08('0x40')]=_[_0x3c08('0x56')](_0x526cbc[_0x3c08('0x40')]);_0x2b7b15[_0x3c08('0x41')]=_[_0x3c08('0x44')](_0x2b7b15[_0x3c08('0x42')],_0x2b7b15['query']);_0x3ef38d[_0x3c08('0x43')]=_['intersection'](_0x2b7b15[_0x3c08('0x42')],qs[_0x3c08('0x45')](_0x526cbc[_0x3c08('0x40')][_0x3c08('0x45')]));_0x3ef38d['attributes']=_0x3ef38d['attributes'][_0x3c08('0x46')]?_0x3ef38d['attributes']:_0x2b7b15['model'];_0x3ef38d[_0x3c08('0x49')]=qs['sort'](_0x526cbc[_0x3c08('0x40')]['sort']);_0x3ef38d['where']=qs[_0x3c08('0x41')](_[_0x3c08('0x5d')](_0x526cbc['query'],_0x2b7b15['filters']));if(_0x526cbc[_0x3c08('0x40')][_0x3c08('0x4c')]){_0x3ef38d[_0x3c08('0x4b')]=_[_0x3c08('0x36')](_0x3ef38d['where'],{'$or':_[_0x3c08('0x4d')](_0x3ef38d[_0x3c08('0x43')],function(_0x97e832){var _0x4b0ed1={};_0x4b0ed1[_0x97e832]={'$like':'%'+_0x526cbc[_0x3c08('0x40')]['filter']+'%'};return _0x4b0ed1;})});}_0x3ef38d=_[_0x3c08('0x36')]({},_0x3ef38d,_0x526cbc[_0x3c08('0x5e')]);return _0x2e676b['getDescriptions'](_0x3ef38d);}})[_0x3c08('0x1d')](function(_0xdd0890){if(_0xdd0890){_0x2f39de=_0xdd0890['length'];if(!_0x526cbc['query']['hasOwnProperty'](_0x3c08('0x48'))){_0x3ef38d['limit']=qs['limit'](_0x526cbc[_0x3c08('0x40')][_0x3c08('0x2b')]);_0x3ef38d['offset']=qs[_0x3c08('0x2d')](_0x526cbc[_0x3c08('0x40')][_0x3c08('0x2d')]);}return _0x2e676b[_0x3c08('0x5f')](_0x3ef38d);}})[_0x3c08('0x1d')](function(_0xb7ec0d){if(_0xb7ec0d){return _0xb7ec0d?{'count':_0x2f39de,'rows':_0xb7ec0d}:null;}})['then'](respondWithResult(_0x5089f3,null))[_0x3c08('0x54')](handleError(_0x5089f3,null));};exports[_0x3c08('0x60')]=function(_0x6fe886,_0x5b478c,_0xee508c){var _0x5799a5={};var _0x35912c={};var _0x3876af;var _0x1acb4f;return db[_0x3c08('0x4f')][_0x3c08('0x5b')]({'where':{'id':_0x6fe886['params']['id']}})['then'](handleEntityNotFound(_0x5b478c,null))[_0x3c08('0x1d')](function(_0x192917){if(_0x192917){_0x3876af=_0x192917;_0x35912c['model']=_[_0x3c08('0x56')](db[_0x3c08('0x5c')][_0x3c08('0x3c')]);_0x35912c['query']=_['keys'](_0x6fe886[_0x3c08('0x40')]);_0x35912c['filters']=_[_0x3c08('0x44')](_0x35912c[_0x3c08('0x42')],_0x35912c[_0x3c08('0x40')]);_0x5799a5[_0x3c08('0x43')]=_['intersection'](_0x35912c[_0x3c08('0x42')],qs[_0x3c08('0x45')](_0x6fe886[_0x3c08('0x40')][_0x3c08('0x45')]));_0x5799a5[_0x3c08('0x43')]=_0x5799a5[_0x3c08('0x43')][_0x3c08('0x46')]?_0x5799a5[_0x3c08('0x43')]:_0x35912c[_0x3c08('0x42')];_0x5799a5[_0x3c08('0x49')]=qs[_0x3c08('0x4a')](_0x6fe886[_0x3c08('0x40')]['sort']);_0x5799a5[_0x3c08('0x4b')]=qs[_0x3c08('0x41')](_['pick'](_0x6fe886[_0x3c08('0x40')],_0x35912c[_0x3c08('0x41')]));if(_0x6fe886['query']['filter']){_0x5799a5['where']=_['merge'](_0x5799a5[_0x3c08('0x4b')],{'$or':_['map'](_0x5799a5[_0x3c08('0x43')],function(_0x34d9cf){var _0x468321={};_0x468321[_0x34d9cf]={'$like':'%'+_0x6fe886[_0x3c08('0x40')][_0x3c08('0x4c')]+'%'};return _0x468321;})});}_0x5799a5=_['merge']({},_0x5799a5,_0x6fe886[_0x3c08('0x5e')]);return _0x3876af[_0x3c08('0x60')](_0x5799a5);}})['then'](function(_0x40016a){if(_0x40016a){_0x1acb4f=_0x40016a[_0x3c08('0x46')];if(!_0x6fe886[_0x3c08('0x40')][_0x3c08('0x47')]('nolimit')){_0x5799a5['limit']=qs[_0x3c08('0x2b')](_0x6fe886['query'][_0x3c08('0x2b')]);_0x5799a5['offset']=qs['offset'](_0x6fe886[_0x3c08('0x40')][_0x3c08('0x2d')]);}return _0x3876af[_0x3c08('0x60')](_0x5799a5);}})[_0x3c08('0x1d')](function(_0x3e33bf){if(_0x3e33bf){return _0x3e33bf?{'count':_0x1acb4f,'rows':_0x3e33bf}:null;}})[_0x3c08('0x1d')](respondWithResult(_0x5b478c,null))[_0x3c08('0x54')](handleError(_0x5b478c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9c3e434..6b1ddb3 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8278=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x41cf29,_0x216a99){var _0x566462=function(_0x31311a){while(--_0x31311a){_0x41cf29['push'](_0x41cf29['shift']());}};_0x566462(++_0x216a99);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var logger=require(_0x8827('0x2'))(_0x8827('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8827('0x4'));var fs=require('fs');var path=require(_0x8827('0x5'));var rimraf=require(_0x8827('0x6'));var config=require(_0x8827('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x8827('0x8')]=function(_0x4342d7,_0x11797a){return _0x4342d7[_0x8827('0x9')](_0x8827('0xa'),attributes,{'tableName':_0x8827('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x1b553a,_0x162d30){var _0x1f19ea=function(_0x231887){while(--_0x231887){_0x1b553a['push'](_0x1b553a['shift']());}};_0x1f19ea(++_0x162d30);}(_0xda55,0x6d));var _0x5da5=function(_0xff0760,_0x3bb095){_0xff0760=_0xff0760-0x0;var _0x1c625b=_0xda55[_0xff0760];return _0x1c625b;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 35475ce..5494847 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0490=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3b1acd,_0x194aa4){var _0x11bc50=function(_0x2c5eae){while(--_0x2c5eae){_0x3b1acd['push'](_0x3b1acd['shift']());}};_0x11bc50(++_0x194aa4);}(_0x0490,0x147));var _0x0049=function(_0x3b8e50,_0x1c6c1f){_0x3b8e50=_0x3b8e50-0x0;var _0x425f35=_0x0490[_0x3b8e50];return _0x425f35;};'use strict';var _=require('lodash');var util=require(_0x0049('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0049('0x1'))['db'];var utils=require(_0x0049('0x2'));var logger=require(_0x0049('0x3'))(_0x0049('0x4'));var config=require(_0x0049('0x5'));var jayson=require(_0x0049('0x6'));var client=jayson[_0x0049('0x7')][_0x0049('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28c8d2,_0x57fca5,_0x18bff7){return new BPromise(function(_0xe091c4,_0x154219){return client['request'](_0x28c8d2,_0x18bff7)[_0x0049('0x9')](function(_0x3f2ca1){logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));logger[_0x0049('0xd')](_0x0049('0xe'),_0x57fca5,_0x0049('0xc'),JSON[_0x0049('0xf')](_0x3f2ca1));if(_0x3f2ca1['error']){if(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x11')]===0x1f4){logger[_0x0049('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0x154219(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x12')]);}logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0xe091c4(_0x3f2ca1[_0x0049('0x10')]['message']);}else{logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));_0xe091c4(_0x3f2ca1[_0x0049('0x13')]['message']);}})['catch'](function(_0x4315b5){logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x4315b5);_0x154219(_0x4315b5);});});} \ No newline at end of file +var _0xdbfc=['client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5731fc,_0x46974b){var _0x3dda0a=function(_0x456b90){while(--_0x456b90){_0x5731fc['push'](_0x5731fc['shift']());}};_0x3dda0a(++_0x46974b);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x1d962e,_0x3fe7a5){_0x1d962e=_0x1d962e-0x0;var _0x243a4a=_0xdbfc[_0x1d962e];return _0x243a4a;};'use strict';var _=require(_0xcdbf('0x0'));var util=require(_0xcdbf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcdbf('0x2'));var fs=require('fs');var Redis=require(_0xcdbf('0x3'));var db=require(_0xcdbf('0x4'))['db'];var utils=require(_0xcdbf('0x5'));var logger=require(_0xcdbf('0x6'))(_0xcdbf('0x7'));var config=require(_0xcdbf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcdbf('0x9')][_0xcdbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54aeaf,_0x369d61,_0x3c077d){return new BPromise(function(_0x409a4e,_0xf4dfb5){return client['request'](_0x54aeaf,_0x3c077d)[_0xcdbf('0xb')](function(_0x30e0a4){logger[_0xcdbf('0xc')](_0xcdbf('0xd'),_0x369d61,_0xcdbf('0xe'));logger['debug'](_0xcdbf('0xf'),_0x369d61,'request\x20sent',JSON[_0xcdbf('0x10')](_0x30e0a4));if(_0x30e0a4['error']){if(_0x30e0a4[_0xcdbf('0x11')]['code']===0x1f4){logger[_0xcdbf('0x11')](_0xcdbf('0xd'),_0x369d61,_0x30e0a4[_0xcdbf('0x11')]['message']);return _0xf4dfb5(_0x30e0a4[_0xcdbf('0x11')]['message']);}logger[_0xcdbf('0x11')](_0xcdbf('0xd'),_0x369d61,_0x30e0a4[_0xcdbf('0x11')][_0xcdbf('0x12')]);return _0x409a4e(_0x30e0a4[_0xcdbf('0x11')]['message']);}else{logger[_0xcdbf('0xc')](_0xcdbf('0xd'),_0x369d61,_0xcdbf('0xe'));_0x409a4e(_0x30e0a4[_0xcdbf('0x13')][_0xcdbf('0x12')]);}})[_0xcdbf('0x14')](function(_0x19b5bd){logger[_0xcdbf('0x11')](_0xcdbf('0xd'),_0x369d61,_0x19b5bd);_0xf4dfb5(_0x19b5bd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f476a63..e5c6510 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x46a5e9,_0x1a5966){var _0x2466bb=function(_0x2dbc98){while(--_0x2dbc98){_0x46a5e9['push'](_0x46a5e9['shift']());}};_0x2466bb(++_0x1a5966);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file +var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','path','express'];(function(_0x5a9b6c,_0x30ccd0){var _0x72bed=function(_0x1468ea){while(--_0x1468ea){_0x5a9b6c['push'](_0x5a9b6c['shift']());}};_0x72bed(++_0x30ccd0);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['post']('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xd')]);router[_0xe36e('0xe')]('/:id',auth[_0xe36e('0x9')](),controller['update']);router[_0xe36e('0xf')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x10')]);module[_0xe36e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0ab3cef..9bb8312 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x4819,0xcd));var _0x9481=function(_0x26447e,_0x2e9c94){_0x26447e=_0x26447e-0x0;var _0x38cc1a=_0x4819[_0x26447e];return _0x38cc1a;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'type':{'type':Sequelize[_0x9481('0x1')](_0x9481('0x2'),_0x9481('0x3'),_0x9481('0x4'),_0x9481('0x5'),_0x9481('0x6')),'defaultValue':_0x9481('0x2')},'content':{'type':Sequelize[_0x9481('0x7')]},'key':{'type':Sequelize[_0x9481('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9481('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9481('0x7')]},'idField':{'type':Sequelize[_0x9481('0x7')]},'nameField':{'type':Sequelize[_0x9481('0x7')]},'customField':{'type':Sequelize[_0x9481('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9481('0x7')]}}; \ No newline at end of file +var _0xd67b=['STRING','ENUM','BOOLEAN','exports','string','variable','customVariable','picklist'];(function(_0xd636e6,_0x3460c2){var _0xf6474d=function(_0x5943e2){while(--_0x5943e2){_0xd636e6['push'](_0xd636e6['shift']());}};_0xf6474d(++_0x3460c2);}(_0xd67b,0x133));var _0xbd67=function(_0x451088,_0x1ac428){_0x451088=_0x451088-0x0;var _0x5b0f45=_0xd67b[_0x451088];return _0x5b0f45;};'use strict';var Sequelize=require('sequelize');module[_0xbd67('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbd67('0x1'),_0xbd67('0x2'),_0xbd67('0x3'),'keyValue',_0xbd67('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbd67('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbd67('0x6')](_0xbd67('0x1'),_0xbd67('0x2'),_0xbd67('0x3'))},'keyContent':{'type':Sequelize[_0xbd67('0x5')]},'idField':{'type':Sequelize[_0xbd67('0x5')]},'nameField':{'type':Sequelize[_0xbd67('0x5')]},'customField':{'type':Sequelize[_0xbd67('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd67('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b08bb3f..a9036d7 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37b6=['limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','name','render','merge','message','agent','interaction','account','index','FreshsalesField','fieldName','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','mustache','util','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x37b6,0x1bb));var _0x637b=function(_0x461e2b,_0xca19dd){_0x461e2b=_0x461e2b-0x0;var _0xbfe26=_0x37b6[_0x461e2b];return _0xbfe26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x637b('0x0'));var zipdir=require(_0x637b('0x1'));var jsonpatch=require(_0x637b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x637b('0x3'));var util=require(_0x637b('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x637b('0x5'));var fs=require('fs');var fs_extra=require(_0x637b('0x6'));var _=require(_0x637b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x637b('0x8'));var deskjs=require(_0x637b('0x9'));var toCsv=require(_0x637b('0xa'));var querystring=require(_0x637b('0xb'));var Papa=require(_0x637b('0xc'));var Redis=require('ioredis');var authService=require(_0x637b('0xd'));var qs=require(_0x637b('0xe'));var as=require(_0x637b('0xf'));var hardwareService=require(_0x637b('0x10'));var logger=require(_0x637b('0x11'))('api');var utils=require(_0x637b('0x12'));var config=require(_0x637b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x637b('0x14'))['db'];function respondWithStatusCode(_0x464b1c,_0x31a533){_0x31a533=_0x31a533||0xcc;return function(_0x20fe5e){if(_0x20fe5e){return _0x464b1c['sendStatus'](_0x31a533);}return _0x464b1c[_0x637b('0x15')](_0x31a533)[_0x637b('0x16')]();};}function respondWithResult(_0x45ff3d,_0x55a793){_0x55a793=_0x55a793||0xc8;return function(_0x2af07e){if(_0x2af07e){return _0x45ff3d[_0x637b('0x15')](_0x55a793)[_0x637b('0x17')](_0x2af07e);}};}function respondWithFilteredResult(_0x11bc6c,_0x514a07){return function(_0x51b328){if(_0x51b328){var _0x52615c=typeof _0x514a07['offset']===_0x637b('0x18')&&typeof _0x514a07[_0x637b('0x19')]===_0x637b('0x18');var _0x4f7b2d=_0x51b328[_0x637b('0x1a')];var _0x13aac7=_0x52615c?0x0:_0x514a07['offset'];var _0x1eec5b=_0x52615c?_0x51b328[_0x637b('0x1a')]:_0x514a07[_0x637b('0x1b')]+_0x514a07['limit'];var _0x238c62;if(_0x1eec5b>=_0x4f7b2d){_0x1eec5b=_0x4f7b2d;_0x238c62=0xc8;}else{_0x238c62=0xce;}_0x11bc6c[_0x637b('0x15')](_0x238c62);return _0x11bc6c[_0x637b('0x1c')]('Content-Range',_0x13aac7+'-'+_0x1eec5b+'/'+_0x4f7b2d)[_0x637b('0x17')](_0x51b328);}return null;};}function patchUpdates(_0x13287d){return function(_0xee48d0){try{jsonpatch[_0x637b('0x1d')](_0xee48d0,_0x13287d,!![]);}catch(_0xdafa73){return BPromise[_0x637b('0x1e')](_0xdafa73);}return _0xee48d0[_0x637b('0x1f')]();};}function saveUpdates(_0x52f120,_0x11ce7a){return function(_0x545870){if(_0x545870){return _0x545870[_0x637b('0x20')](_0x52f120)[_0x637b('0x21')](function(_0x479a7c){return _0x479a7c;});}return null;};}function removeEntity(_0x1e8b7f,_0x68fcc4){return function(_0xfcad8f){if(_0xfcad8f){return _0xfcad8f[_0x637b('0x22')]()[_0x637b('0x21')](function(){_0x1e8b7f[_0x637b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f281,_0x55dd31){return function(_0x5e2699){if(!_0x5e2699){_0x26f281[_0x637b('0x23')](0x194);}return _0x5e2699;};}function handleError(_0x2562b3,_0x12673a){_0x12673a=_0x12673a||0x1f4;return function(_0x1ed667){logger[_0x637b('0x24')](_0x1ed667['stack']);if(_0x1ed667[_0x637b('0x25')]){delete _0x1ed667[_0x637b('0x25')];}_0x2562b3['status'](_0x12673a)['send'](_0x1ed667);};}function getMustacheRender(_0x1e7f2d,_0xa62161){return Mustache[_0x637b('0x26')](_0x1e7f2d,_[_0x637b('0x27')](_0xa62161['body'],{'contact':_0xa62161['contact'],'message':_0xa62161[_0x637b('0x28')],'agent':_0xa62161[_0x637b('0x29')],'interaction':_0xa62161[_0x637b('0x2a')],'account':_0xa62161[_0x637b('0x2b')]}))||'';}exports[_0x637b('0x2c')]=function(_0x507fe2,_0x1d1b55){var _0x32f2c4={},_0x41a9cf={},_0x1b624f={'count':0x0,'rows':[]};var _0x53026f=_['map'](db[_0x637b('0x2d')]['rawAttributes'],function(_0x592abc){return{'name':_0x592abc[_0x637b('0x2e')],'type':_0x592abc['type'][_0x637b('0x2f')]};});_0x41a9cf[_0x637b('0x30')]=_[_0x637b('0x31')](_0x53026f,_0x637b('0x25'));_0x41a9cf['query']=_[_0x637b('0x32')](_0x507fe2[_0x637b('0x33')]);_0x41a9cf[_0x637b('0x34')]=_['intersection'](_0x41a9cf[_0x637b('0x30')],_0x41a9cf[_0x637b('0x33')]);_0x32f2c4[_0x637b('0x35')]=_['intersection'](_0x41a9cf['model'],qs[_0x637b('0x36')](_0x507fe2['query'][_0x637b('0x36')]));_0x32f2c4[_0x637b('0x35')]=_0x32f2c4[_0x637b('0x35')][_0x637b('0x37')]?_0x32f2c4[_0x637b('0x35')]:_0x41a9cf['model'];if(!_0x507fe2['query'][_0x637b('0x38')](_0x637b('0x39'))){_0x32f2c4[_0x637b('0x19')]=qs[_0x637b('0x19')](_0x507fe2[_0x637b('0x33')]['limit']);_0x32f2c4[_0x637b('0x1b')]=qs['offset'](_0x507fe2[_0x637b('0x33')][_0x637b('0x1b')]);}_0x32f2c4[_0x637b('0x3a')]=qs[_0x637b('0x3b')](_0x507fe2[_0x637b('0x33')][_0x637b('0x3b')]);_0x32f2c4[_0x637b('0x3c')]=qs['filters'](_[_0x637b('0x3d')](_0x507fe2['query'],_0x41a9cf['filters']),_0x53026f);if(_0x507fe2[_0x637b('0x33')][_0x637b('0x3e')]){_0x32f2c4[_0x637b('0x3c')]=_[_0x637b('0x27')](_0x32f2c4[_0x637b('0x3c')],{'$or':_[_0x637b('0x31')](_0x53026f,function(_0x3de4c8){if(_0x3de4c8[_0x637b('0x3f')]!==_0x637b('0x40')){var _0x4a6aac={};_0x4a6aac[_0x3de4c8['name']]={'$like':'%'+_0x507fe2[_0x637b('0x33')][_0x637b('0x3e')]+'%'};return _0x4a6aac;}})});}_0x32f2c4=_[_0x637b('0x27')]({},_0x32f2c4,_0x507fe2[_0x637b('0x41')]);var _0x5d39be={'where':_0x32f2c4[_0x637b('0x3c')]};return db[_0x637b('0x2d')][_0x637b('0x1a')](_0x5d39be)[_0x637b('0x21')](function(_0x1bb650){_0x1b624f[_0x637b('0x1a')]=_0x1bb650;if(_0x507fe2[_0x637b('0x33')][_0x637b('0x42')]){_0x32f2c4[_0x637b('0x43')]=[{'all':!![]}];}return db[_0x637b('0x2d')][_0x637b('0x44')](_0x32f2c4);})[_0x637b('0x21')](function(_0x4aae1d){_0x1b624f[_0x637b('0x45')]=_0x4aae1d;return _0x1b624f;})[_0x637b('0x21')](respondWithFilteredResult(_0x1d1b55,_0x32f2c4))[_0x637b('0x46')](handleError(_0x1d1b55,null));};exports[_0x637b('0x47')]=function(_0xba115c,_0x20af2f){var _0x5b5713={'raw':!![],'where':{'id':_0xba115c[_0x637b('0x48')]['id']}},_0x4c29bd={};_0x4c29bd['model']=_['keys'](db[_0x637b('0x2d')][_0x637b('0x49')]);_0x4c29bd[_0x637b('0x33')]=_[_0x637b('0x32')](_0xba115c[_0x637b('0x33')]);_0x4c29bd[_0x637b('0x34')]=_['intersection'](_0x4c29bd[_0x637b('0x30')],_0x4c29bd['query']);_0x5b5713[_0x637b('0x35')]=_[_0x637b('0x4a')](_0x4c29bd['model'],qs['fields'](_0xba115c[_0x637b('0x33')]['fields']));_0x5b5713[_0x637b('0x35')]=_0x5b5713[_0x637b('0x35')][_0x637b('0x37')]?_0x5b5713[_0x637b('0x35')]:_0x4c29bd[_0x637b('0x30')];if(_0xba115c[_0x637b('0x33')]['includeAll']){_0x5b5713[_0x637b('0x43')]=[{'all':!![]}];}_0x5b5713=_[_0x637b('0x27')]({},_0x5b5713,_0xba115c['options']);return db[_0x637b('0x2d')][_0x637b('0x4b')](_0x5b5713)[_0x637b('0x21')](handleEntityNotFound(_0x20af2f,null))[_0x637b('0x21')](respondWithResult(_0x20af2f,null))[_0x637b('0x46')](handleError(_0x20af2f,null));};exports[_0x637b('0x4c')]=function(_0xe5e11,_0x51711f){return db['FreshsalesField'][_0x637b('0x4c')](_0xe5e11[_0x637b('0x4d')],{})['then'](respondWithResult(_0x51711f,0xc9))['catch'](handleError(_0x51711f,null));};exports[_0x637b('0x20')]=function(_0x577ae5,_0x433450){if(_0x577ae5['body']['id']){delete _0x577ae5['body']['id'];}return db[_0x637b('0x2d')][_0x637b('0x4b')]({'where':{'id':_0x577ae5[_0x637b('0x48')]['id']}})[_0x637b('0x21')](handleEntityNotFound(_0x433450,null))[_0x637b('0x21')](saveUpdates(_0x577ae5[_0x637b('0x4d')],null))[_0x637b('0x21')](respondWithResult(_0x433450,null))['catch'](handleError(_0x433450,null));};exports[_0x637b('0x22')]=function(_0x5742be,_0x345248){return db[_0x637b('0x2d')][_0x637b('0x4b')]({'where':{'id':_0x5742be[_0x637b('0x48')]['id']}})[_0x637b('0x21')](handleEntityNotFound(_0x345248,null))[_0x637b('0x21')](removeEntity(_0x345248,null))[_0x637b('0x46')](handleError(_0x345248,null));}; \ No newline at end of file +var _0xf797=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','name','merge','body','contact','agent','interaction','account','map','FreshsalesField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch','show','find','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xf797,0x173));var _0x7f79=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf797[_0x176329];return _0x31997c;};'use strict';var emlformat=require(_0x7f79('0x0'));var rimraf=require(_0x7f79('0x1'));var zipdir=require(_0x7f79('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f79('0x3'));var moment=require(_0x7f79('0x4'));var BPromise=require(_0x7f79('0x5'));var Mustache=require('mustache');var util=require(_0x7f79('0x6'));var path=require(_0x7f79('0x7'));var sox=require(_0x7f79('0x8'));var csv=require(_0x7f79('0x9'));var ejs=require(_0x7f79('0xa'));var fs=require('fs');var fs_extra=require(_0x7f79('0xb'));var _=require(_0x7f79('0xc'));var squel=require(_0x7f79('0xd'));var crypto=require('crypto');var jsforce=require(_0x7f79('0xe'));var deskjs=require(_0x7f79('0xf'));var toCsv=require(_0x7f79('0x9'));var querystring=require(_0x7f79('0x10'));var Papa=require(_0x7f79('0x11'));var Redis=require('ioredis');var authService=require(_0x7f79('0x12'));var qs=require(_0x7f79('0x13'));var as=require(_0x7f79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f79('0x15'))('api');var utils=require(_0x7f79('0x16'));var config=require(_0x7f79('0x17'));var licenseUtil=require(_0x7f79('0x18'));var db=require(_0x7f79('0x19'))['db'];function respondWithStatusCode(_0x42016e,_0xec3f3c){_0xec3f3c=_0xec3f3c||0xcc;return function(_0x582729){if(_0x582729){return _0x42016e[_0x7f79('0x1a')](_0xec3f3c);}return _0x42016e[_0x7f79('0x1b')](_0xec3f3c)['end']();};}function respondWithResult(_0x9fc2fa,_0x367c41){_0x367c41=_0x367c41||0xc8;return function(_0x4ee999){if(_0x4ee999){return _0x9fc2fa['status'](_0x367c41)[_0x7f79('0x1c')](_0x4ee999);}};}function respondWithFilteredResult(_0x5361fa,_0x32c06d){return function(_0x5390d1){if(_0x5390d1){var _0x2fb38c=typeof _0x32c06d[_0x7f79('0x1d')]===_0x7f79('0x1e')&&typeof _0x32c06d['limit']===_0x7f79('0x1e');var _0x4aa698=_0x5390d1[_0x7f79('0x1f')];var _0x575ec8=_0x2fb38c?0x0:_0x32c06d[_0x7f79('0x1d')];var _0x1f695d=_0x2fb38c?_0x5390d1['count']:_0x32c06d['offset']+_0x32c06d[_0x7f79('0x20')];var _0xc97ca0;if(_0x1f695d>=_0x4aa698){_0x1f695d=_0x4aa698;_0xc97ca0=0xc8;}else{_0xc97ca0=0xce;}_0x5361fa[_0x7f79('0x1b')](_0xc97ca0);return _0x5361fa['set'](_0x7f79('0x21'),_0x575ec8+'-'+_0x1f695d+'/'+_0x4aa698)[_0x7f79('0x1c')](_0x5390d1);}return null;};}function patchUpdates(_0x139256){return function(_0x40128b){try{jsonpatch[_0x7f79('0x22')](_0x40128b,_0x139256,!![]);}catch(_0x1d9df6){return BPromise[_0x7f79('0x23')](_0x1d9df6);}return _0x40128b[_0x7f79('0x24')]();};}function saveUpdates(_0x452efa,_0x5dd212){return function(_0x1c9b6f){if(_0x1c9b6f){return _0x1c9b6f[_0x7f79('0x25')](_0x452efa)['then'](function(_0x1067d3){return _0x1067d3;});}return null;};}function removeEntity(_0x5bf521,_0x5da406){return function(_0x1db2f2){if(_0x1db2f2){return _0x1db2f2['destroy']()[_0x7f79('0x26')](function(){_0x5bf521[_0x7f79('0x1b')](0xcc)[_0x7f79('0x27')]();});}};}function handleEntityNotFound(_0x1f58d9,_0x1083d2){return function(_0x4dd2dd){if(!_0x4dd2dd){_0x1f58d9['sendStatus'](0x194);}return _0x4dd2dd;};}function handleError(_0x101ee7,_0x38ba10){_0x38ba10=_0x38ba10||0x1f4;return function(_0x3a25a7){logger[_0x7f79('0x28')](_0x3a25a7['stack']);if(_0x3a25a7[_0x7f79('0x29')]){delete _0x3a25a7[_0x7f79('0x29')];}_0x101ee7[_0x7f79('0x1b')](_0x38ba10)['send'](_0x3a25a7);};}function getMustacheRender(_0x21063b,_0x55190b){return Mustache['render'](_0x21063b,_[_0x7f79('0x2a')](_0x55190b[_0x7f79('0x2b')],{'contact':_0x55190b[_0x7f79('0x2c')],'message':_0x55190b['message'],'agent':_0x55190b[_0x7f79('0x2d')],'interaction':_0x55190b[_0x7f79('0x2e')],'account':_0x55190b[_0x7f79('0x2f')]}))||'';}exports['index']=function(_0x21cb56,_0x28c70c){var _0xc8d1fb={},_0x243176={},_0x7797b8={'count':0x0,'rows':[]};var _0x5940ef=_[_0x7f79('0x30')](db[_0x7f79('0x31')][_0x7f79('0x32')],function(_0x2bf035){return{'name':_0x2bf035['fieldName'],'type':_0x2bf035[_0x7f79('0x33')][_0x7f79('0x34')]};});_0x243176[_0x7f79('0x35')]=_[_0x7f79('0x30')](_0x5940ef,_0x7f79('0x29'));_0x243176[_0x7f79('0x36')]=_[_0x7f79('0x37')](_0x21cb56['query']);_0x243176['filters']=_[_0x7f79('0x38')](_0x243176[_0x7f79('0x35')],_0x243176[_0x7f79('0x36')]);_0xc8d1fb[_0x7f79('0x39')]=_[_0x7f79('0x38')](_0x243176[_0x7f79('0x35')],qs[_0x7f79('0x3a')](_0x21cb56[_0x7f79('0x36')][_0x7f79('0x3a')]));_0xc8d1fb[_0x7f79('0x39')]=_0xc8d1fb[_0x7f79('0x39')][_0x7f79('0x3b')]?_0xc8d1fb[_0x7f79('0x39')]:_0x243176[_0x7f79('0x35')];if(!_0x21cb56[_0x7f79('0x36')][_0x7f79('0x3c')]('nolimit')){_0xc8d1fb[_0x7f79('0x20')]=qs[_0x7f79('0x20')](_0x21cb56[_0x7f79('0x36')][_0x7f79('0x20')]);_0xc8d1fb[_0x7f79('0x1d')]=qs[_0x7f79('0x1d')](_0x21cb56[_0x7f79('0x36')]['offset']);}_0xc8d1fb[_0x7f79('0x3d')]=qs[_0x7f79('0x3e')](_0x21cb56['query'][_0x7f79('0x3e')]);_0xc8d1fb[_0x7f79('0x3f')]=qs['filters'](_[_0x7f79('0x40')](_0x21cb56['query'],_0x243176[_0x7f79('0x41')]),_0x5940ef);if(_0x21cb56[_0x7f79('0x36')][_0x7f79('0x42')]){_0xc8d1fb['where']=_[_0x7f79('0x2a')](_0xc8d1fb[_0x7f79('0x3f')],{'$or':_['map'](_0x5940ef,function(_0x1b7ef0){if(_0x1b7ef0[_0x7f79('0x33')]!=='VIRTUAL'){var _0x782388={};_0x782388[_0x1b7ef0[_0x7f79('0x29')]]={'$like':'%'+_0x21cb56['query'][_0x7f79('0x42')]+'%'};return _0x782388;}})});}_0xc8d1fb=_[_0x7f79('0x2a')]({},_0xc8d1fb,_0x21cb56[_0x7f79('0x43')]);var _0x599c6f={'where':_0xc8d1fb[_0x7f79('0x3f')]};return db['FreshsalesField'][_0x7f79('0x1f')](_0x599c6f)[_0x7f79('0x26')](function(_0x546b1c){_0x7797b8[_0x7f79('0x1f')]=_0x546b1c;if(_0x21cb56[_0x7f79('0x36')][_0x7f79('0x44')]){_0xc8d1fb[_0x7f79('0x45')]=[{'all':!![]}];}return db[_0x7f79('0x31')][_0x7f79('0x46')](_0xc8d1fb);})['then'](function(_0x19999f){_0x7797b8[_0x7f79('0x47')]=_0x19999f;return _0x7797b8;})[_0x7f79('0x26')](respondWithFilteredResult(_0x28c70c,_0xc8d1fb))[_0x7f79('0x48')](handleError(_0x28c70c,null));};exports[_0x7f79('0x49')]=function(_0x371aa5,_0x58c039){var _0x361422={'raw':!![],'where':{'id':_0x371aa5['params']['id']}},_0x454ab6={};_0x454ab6[_0x7f79('0x35')]=_['keys'](db[_0x7f79('0x31')][_0x7f79('0x32')]);_0x454ab6[_0x7f79('0x36')]=_[_0x7f79('0x37')](_0x371aa5[_0x7f79('0x36')]);_0x454ab6[_0x7f79('0x41')]=_[_0x7f79('0x38')](_0x454ab6[_0x7f79('0x35')],_0x454ab6['query']);_0x361422[_0x7f79('0x39')]=_['intersection'](_0x454ab6[_0x7f79('0x35')],qs['fields'](_0x371aa5[_0x7f79('0x36')][_0x7f79('0x3a')]));_0x361422[_0x7f79('0x39')]=_0x361422['attributes']['length']?_0x361422[_0x7f79('0x39')]:_0x454ab6[_0x7f79('0x35')];if(_0x371aa5['query'][_0x7f79('0x44')]){_0x361422[_0x7f79('0x45')]=[{'all':!![]}];}_0x361422=_['merge']({},_0x361422,_0x371aa5['options']);return db[_0x7f79('0x31')][_0x7f79('0x4a')](_0x361422)[_0x7f79('0x26')](handleEntityNotFound(_0x58c039,null))[_0x7f79('0x26')](respondWithResult(_0x58c039,null))[_0x7f79('0x48')](handleError(_0x58c039,null));};exports['create']=function(_0x454fb4,_0x3fc2ac){return db['FreshsalesField']['create'](_0x454fb4['body'],{})[_0x7f79('0x26')](respondWithResult(_0x3fc2ac,0xc9))[_0x7f79('0x48')](handleError(_0x3fc2ac,null));};exports[_0x7f79('0x25')]=function(_0x2f4e34,_0x5e4299){if(_0x2f4e34[_0x7f79('0x2b')]['id']){delete _0x2f4e34[_0x7f79('0x2b')]['id'];}return db[_0x7f79('0x31')]['find']({'where':{'id':_0x2f4e34[_0x7f79('0x4b')]['id']}})[_0x7f79('0x26')](handleEntityNotFound(_0x5e4299,null))['then'](saveUpdates(_0x2f4e34[_0x7f79('0x2b')],null))[_0x7f79('0x26')](respondWithResult(_0x5e4299,null))['catch'](handleError(_0x5e4299,null));};exports[_0x7f79('0x4c')]=function(_0x210bdb,_0x29a59e){return db[_0x7f79('0x31')][_0x7f79('0x4a')]({'where':{'id':_0x210bdb[_0x7f79('0x4b')]['id']}})[_0x7f79('0x26')](handleEntityNotFound(_0x29a59e,null))[_0x7f79('0x26')](removeEntity(_0x29a59e,null))[_0x7f79('0x48')](handleError(_0x29a59e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 71702b4..3dde1aa 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f94=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f94,0x1ad));var _0x40f9=function(_0x34c939,_0x3f8b1b){_0x34c939=_0x34c939-0x0;var _0x3c0f65=_0x0f94[_0x34c939];return _0x3c0f65;};'use strict';var _=require(_0x40f9('0x0'));var util=require(_0x40f9('0x1'));var logger=require(_0x40f9('0x2'))(_0x40f9('0x3'));var moment=require(_0x40f9('0x4'));var BPromise=require(_0x40f9('0x5'));var rp=require(_0x40f9('0x6'));var fs=require('fs');var path=require(_0x40f9('0x7'));var rimraf=require(_0x40f9('0x8'));var config=require(_0x40f9('0x9'));var attributes=require(_0x40f9('0xa'));module['exports']=function(_0x1f5c24,_0x4cfc57){return _0x1f5c24[_0x40f9('0xb')](_0x40f9('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x40f9('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a52=['FieldId','lodash','api','moment','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','idField'];(function(_0x101132,_0x26b4db){var _0x413d47=function(_0x225530){while(--_0x225530){_0x101132['push'](_0x101132['shift']());}};_0x413d47(++_0x26b4db);}(_0x4a52,0x15d));var _0x24a5=function(_0x392de8,_0x1bb2fd){_0x392de8=_0x392de8-0x0;var _0x405477=_0x4a52[_0x392de8];return _0x405477;};'use strict';var _=require(_0x24a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x24a5('0x1'));var moment=require(_0x24a5('0x2'));var BPromise=require('bluebird');var rp=require(_0x24a5('0x3'));var fs=require('fs');var path=require(_0x24a5('0x4'));var rimraf=require(_0x24a5('0x5'));var config=require('../../config/environment');var attributes=require(_0x24a5('0x6'));module[_0x24a5('0x7')]=function(_0x2e2082,_0x3c1558){return _0x2e2082[_0x24a5('0x8')](_0x24a5('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x24a5('0xa'),_0x24a5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index c78d2fa..00aaddd 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaf3=['stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x595ab7,_0x3a7304){var _0x1b564c=function(_0x312bff){while(--_0x312bff){_0x595ab7['push'](_0x595ab7['shift']());}};_0x1b564c(++_0x3a7304);}(_0xfaf3,0x137));var _0x3faf=function(_0x2fd774,_0x31c8a1){_0x2fd774=_0x2fd774-0x0;var _0x51926d=_0xfaf3[_0x2fd774];return _0x51926d;};'use strict';var _=require('lodash');var util=require(_0x3faf('0x0'));var moment=require('moment');var BPromise=require(_0x3faf('0x1'));var rs=require(_0x3faf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3faf('0x3'))['db'];var utils=require(_0x3faf('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3faf('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45ca4f,_0xbb654c,_0x7bae98){return new BPromise(function(_0x2711b1,_0x588a30){return client[_0x3faf('0x6')](_0x45ca4f,_0x7bae98)[_0x3faf('0x7')](function(_0x4482ae){logger[_0x3faf('0x8')](_0x3faf('0x9'),_0xbb654c,_0x3faf('0xa'));logger[_0x3faf('0xb')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xbb654c,_0x3faf('0xa'),JSON[_0x3faf('0xc')](_0x4482ae));if(_0x4482ae['error']){if(_0x4482ae[_0x3faf('0xd')]['code']===0x1f4){logger[_0x3faf('0xd')](_0x3faf('0x9'),_0xbb654c,_0x4482ae[_0x3faf('0xd')][_0x3faf('0xe')]);return _0x588a30(_0x4482ae[_0x3faf('0xd')][_0x3faf('0xe')]);}logger[_0x3faf('0xd')](_0x3faf('0x9'),_0xbb654c,_0x4482ae[_0x3faf('0xd')]['message']);return _0x2711b1(_0x4482ae[_0x3faf('0xd')][_0x3faf('0xe')]);}else{logger['info'](_0x3faf('0x9'),_0xbb654c,_0x3faf('0xa'));_0x2711b1(_0x4482ae[_0x3faf('0xf')][_0x3faf('0xe')]);}})[_0x3faf('0x10')](function(_0x240596){logger[_0x3faf('0xd')]('FreshsalesField,\x20%s,\x20%s',_0xbb654c,_0x240596);_0x588a30(_0x240596);});});} \ No newline at end of file +var _0xcc87=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x1f07e1,_0x1a5b41){var _0x37e28f=function(_0x414878){while(--_0x414878){_0x1f07e1['push'](_0x1f07e1['shift']());}};_0x37e28f(++_0x1a5b41);}(_0xcc87,0x158));var _0x7cc8=function(_0x4f01cb,_0x36a1ae){_0x4f01cb=_0x4f01cb-0x0;var _0x4b3be5=_0xcc87[_0x4f01cb];return _0x4b3be5;};'use strict';var _=require(_0x7cc8('0x0'));var util=require('util');var moment=require(_0x7cc8('0x1'));var BPromise=require(_0x7cc8('0x2'));var rs=require(_0x7cc8('0x3'));var fs=require('fs');var Redis=require(_0x7cc8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cc8('0x5'));var logger=require(_0x7cc8('0x6'))(_0x7cc8('0x7'));var config=require(_0x7cc8('0x8'));var jayson=require(_0x7cc8('0x9'));var client=jayson[_0x7cc8('0xa')][_0x7cc8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c2822,_0x48ef54,_0x1a751c){return new BPromise(function(_0x2672ee,_0x116dfd){return client[_0x7cc8('0xc')](_0x1c2822,_0x1a751c)['then'](function(_0x4e5271){logger[_0x7cc8('0xd')](_0x7cc8('0xe'),_0x48ef54,'request\x20sent');logger[_0x7cc8('0xf')](_0x7cc8('0x10'),_0x48ef54,_0x7cc8('0x11'),JSON[_0x7cc8('0x12')](_0x4e5271));if(_0x4e5271[_0x7cc8('0x13')]){if(_0x4e5271['error'][_0x7cc8('0x14')]===0x1f4){logger[_0x7cc8('0x13')](_0x7cc8('0xe'),_0x48ef54,_0x4e5271[_0x7cc8('0x13')][_0x7cc8('0x15')]);return _0x116dfd(_0x4e5271[_0x7cc8('0x13')]['message']);}logger[_0x7cc8('0x13')](_0x7cc8('0xe'),_0x48ef54,_0x4e5271[_0x7cc8('0x13')][_0x7cc8('0x15')]);return _0x2672ee(_0x4e5271[_0x7cc8('0x13')][_0x7cc8('0x15')]);}else{logger[_0x7cc8('0xd')](_0x7cc8('0xe'),_0x48ef54,'request\x20sent');_0x2672ee(_0x4e5271[_0x7cc8('0x16')][_0x7cc8('0x15')]);}})['catch'](function(_0x3e725a){logger[_0x7cc8('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x48ef54,_0x3e725a);_0x116dfd(_0x3e725a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7c53d42..77ed093 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c7f=['isAuthenticated','index','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3c7f,0x65));var _0xf3c7=function(_0x3dc1e9,_0x20484c){_0x3dc1e9=_0x3dc1e9-0x0;var _0x1a8e32=_0x3c7f[_0x3dc1e9];return _0x1a8e32;};'use strict';var multer=require(_0xf3c7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf3c7('0x1'));var express=require(_0xf3c7('0x2'));var router=express[_0xf3c7('0x3')]();var fs_extra=require(_0xf3c7('0x4'));var auth=require(_0xf3c7('0x5'));var interaction=require(_0xf3c7('0x6'));var config=require(_0xf3c7('0x7'));var controller=require('./intSalesforceAccount.controller');router[_0xf3c7('0x8')]('/',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xa')]);router[_0xf3c7('0x8')]('/:id',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xb')]);router[_0xf3c7('0x8')]('/:id/configurations',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xc')]);router[_0xf3c7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf3c7('0xd')]);router[_0xf3c7('0xe')]('/',auth[_0xf3c7('0x9')](),controller[_0xf3c7('0xf')]);router['post'](_0xf3c7('0x10'),auth[_0xf3c7('0x9')](),controller[_0xf3c7('0x11')]);router['put'](_0xf3c7('0x12'),auth[_0xf3c7('0x9')](),controller[_0xf3c7('0x13')]);router[_0xf3c7('0x14')](_0xf3c7('0x12'),auth['isAuthenticated'](),controller[_0xf3c7('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8a22=['index','get','show','/:id/configurations','/:id/fields','getFields','post','create','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated'];(function(_0x2d9cd8,_0x5f2712){var _0xe5c727=function(_0x433694){while(--_0x433694){_0x2d9cd8['push'](_0x2d9cd8['shift']());}};_0xe5c727(++_0x5f2712);}(_0x8a22,0x1c5));var _0x28a2=function(_0x2293a9,_0x12ce62){_0x2293a9=_0x2293a9-0x0;var _0x50597e=_0x8a22[_0x2293a9];return _0x50597e;};'use strict';var multer=require('multer');var util=require(_0x28a2('0x0'));var path=require(_0x28a2('0x1'));var timeout=require(_0x28a2('0x2'));var express=require('express');var router=express[_0x28a2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x28a2('0x4'));var interaction=require(_0x28a2('0x5'));var config=require(_0x28a2('0x6'));var controller=require(_0x28a2('0x7'));router['get']('/',auth[_0x28a2('0x8')](),controller[_0x28a2('0x9')]);router[_0x28a2('0xa')]('/:id',auth[_0x28a2('0x8')](),controller[_0x28a2('0xb')]);router[_0x28a2('0xa')](_0x28a2('0xc'),auth[_0x28a2('0x8')](),controller['getConfigurations']);router[_0x28a2('0xa')](_0x28a2('0xd'),auth[_0x28a2('0x8')](),controller[_0x28a2('0xe')]);router[_0x28a2('0xf')]('/',auth['isAuthenticated'](),controller[_0x28a2('0x10')]);router[_0x28a2('0xf')]('/:id/configurations',auth[_0x28a2('0x8')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x28a2('0x11')]);router[_0x28a2('0x12')](_0x28a2('0x13'),auth['isAuthenticated'](),controller[_0x28a2('0x14')]);module[_0x28a2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 4cad748..2d0380d 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9045=['username','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x5da0e9,_0x43c898){var _0x4b022d=function(_0x2aefc2){while(--_0x2aefc2){_0x5da0e9['push'](_0x5da0e9['shift']());}};_0x4b022d(++_0x43c898);}(_0x9045,0x138));var _0x5904=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x9045[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x5904('0x0'));module[_0x5904('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5904('0x2')]},'username':{'type':Sequelize[_0x5904('0x2')],'unique':_0x5904('0x3')},'remoteUri':{'type':Sequelize[_0x5904('0x2')]},'password':{'type':Sequelize[_0x5904('0x2')]},'clientId':{'type':Sequelize[_0x5904('0x2')]},'clientSecret':{'type':Sequelize[_0x5904('0x2')]},'securityToken':{'type':Sequelize[_0x5904('0x2')]},'serverUrl':{'type':Sequelize[_0x5904('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5904('0x4')](_0x5904('0x5'),_0x5904('0x6')),'defaultValue':_0x5904('0x5')}}; \ No newline at end of file +var _0xa515=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xa515,0xdc));var _0x5a51=function(_0x1dcc10,_0x1f4f39){_0x1dcc10=_0x1dcc10-0x0;var _0x18a456=_0xa515[_0x1dcc10];return _0x18a456;};'use strict';var Sequelize=require(_0x5a51('0x0'));module[_0x5a51('0x1')]={'name':{'type':Sequelize[_0x5a51('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5a51('0x2')],'unique':_0x5a51('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x5a51('0x2')]},'clientSecret':{'type':Sequelize[_0x5a51('0x2')]},'securityToken':{'type':Sequelize[_0x5a51('0x2')]},'serverUrl':{'type':Sequelize[_0x5a51('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5a51('0x4')](_0x5a51('0x5'),_0x5a51('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 596882f..d44ab4a 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7edf=['status','stack','name','send','render','body','contact','agent','interaction','account','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','phone','includes','label','picklistValues','value','true','False','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x1bf424,_0x33ce7d){var _0x53f515=function(_0x1d796f){while(--_0x1d796f){_0x1bf424['push'](_0x1bf424['shift']());}};_0x53f515(++_0x33ce7d);}(_0x7edf,0x17a));var _0xf7ed=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x7edf[_0x1034bb];return _0x453fdb;};'use strict';var emlformat=require(_0xf7ed('0x0'));var rimraf=require(_0xf7ed('0x1'));var zipdir=require(_0xf7ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7ed('0x3'));var moment=require(_0xf7ed('0x4'));var BPromise=require(_0xf7ed('0x5'));var Mustache=require(_0xf7ed('0x6'));var util=require('util');var path=require(_0xf7ed('0x7'));var sox=require(_0xf7ed('0x8'));var csv=require(_0xf7ed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf7ed('0xa'));var _=require(_0xf7ed('0xb'));var squel=require(_0xf7ed('0xc'));var crypto=require(_0xf7ed('0xd'));var jsforce=require(_0xf7ed('0xe'));var deskjs=require(_0xf7ed('0xf'));var toCsv=require(_0xf7ed('0x9'));var querystring=require('querystring');var Papa=require(_0xf7ed('0x10'));var Redis=require(_0xf7ed('0x11'));var authService=require(_0xf7ed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf7ed('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7ed('0x14'))('api');var utils=require(_0xf7ed('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf7ed('0x16'))['db'];var integrations=require(_0xf7ed('0x17'));var jayson=require(_0xf7ed('0x18'));var client=jayson[_0xf7ed('0x19')][_0xf7ed('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4ec488,_0x429328,_0x27ce42,_0xdfe060){return new BPromise(function(_0x29a561,_0x5d3fed){var _0x5502b2=_0xdfe060||client;return _0x5502b2[_0xf7ed('0x1b')](_0x4ec488,_0x27ce42)['then'](function(_0x58ae94){logger[_0xf7ed('0x1c')](_0xf7ed('0x1d'),_0x429328,_0xf7ed('0x1e'));logger[_0xf7ed('0x1f')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x429328,'request\x20sent',JSON[_0xf7ed('0x20')](_0x58ae94));if(_0x58ae94[_0xf7ed('0x21')]){if(_0x58ae94[_0xf7ed('0x21')][_0xf7ed('0x22')]===0x1f4){logger[_0xf7ed('0x21')](_0xf7ed('0x1d'),_0x429328,_0x58ae94['error'][_0xf7ed('0x23')]);return _0x5d3fed(_0x58ae94['error']['message']);}logger['error'](_0xf7ed('0x1d'),_0x429328,_0x58ae94[_0xf7ed('0x21')][_0xf7ed('0x23')]);return _0x29a561(_0x58ae94[_0xf7ed('0x21')][_0xf7ed('0x23')]);}else{logger[_0xf7ed('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x429328,'request\x20sent');_0x29a561(_0x58ae94['result'][_0xf7ed('0x23')]);}})[_0xf7ed('0x24')](function(_0x4966b3){logger[_0xf7ed('0x21')](_0xf7ed('0x1d'),_0x429328,_0x4966b3);_0x5d3fed(_0x4966b3);});});}function respondWithStatusCode(_0x50fec6,_0x1c407a){_0x1c407a=_0x1c407a||0xcc;return function(_0x32a88e){if(_0x32a88e){return _0x50fec6[_0xf7ed('0x25')](_0x1c407a);}return _0x50fec6['status'](_0x1c407a)[_0xf7ed('0x26')]();};}function respondWithResult(_0x37e5ca,_0x3070d5){_0x3070d5=_0x3070d5||0xc8;return function(_0x1b56cf){if(_0x1b56cf){return _0x37e5ca['status'](_0x3070d5)[_0xf7ed('0x27')](_0x1b56cf);}};}function respondWithFilteredResult(_0x2717d5,_0x183c4c){return function(_0x5a0699){if(_0x5a0699){var _0x99a237=typeof _0x183c4c[_0xf7ed('0x28')]===_0xf7ed('0x29')&&typeof _0x183c4c[_0xf7ed('0x2a')]==='undefined';var _0x312c7c=_0x5a0699[_0xf7ed('0x2b')];var _0x289c65=_0x99a237?0x0:_0x183c4c[_0xf7ed('0x28')];var _0x4e432c=_0x99a237?_0x5a0699['count']:_0x183c4c['offset']+_0x183c4c[_0xf7ed('0x2a')];var _0x55a510;if(_0x4e432c>=_0x312c7c){_0x4e432c=_0x312c7c;_0x55a510=0xc8;}else{_0x55a510=0xce;}_0x2717d5['status'](_0x55a510);return _0x2717d5[_0xf7ed('0x2c')]('Content-Range',_0x289c65+'-'+_0x4e432c+'/'+_0x312c7c)[_0xf7ed('0x27')](_0x5a0699);}return null;};}function patchUpdates(_0x3f023f){return function(_0x46984e){try{jsonpatch[_0xf7ed('0x2d')](_0x46984e,_0x3f023f,!![]);}catch(_0x284156){return BPromise[_0xf7ed('0x2e')](_0x284156);}return _0x46984e[_0xf7ed('0x2f')]();};}function saveUpdates(_0x10992d,_0x4cd92b){return function(_0x32c199){if(_0x32c199){return _0x32c199[_0xf7ed('0x30')](_0x10992d)[_0xf7ed('0x31')](function(_0x28fc88){return _0x28fc88;});}return null;};}function removeEntity(_0x39e771,_0x1a0b2c){return function(_0xa98d13){if(_0xa98d13){return _0xa98d13[_0xf7ed('0x32')]()[_0xf7ed('0x31')](function(){_0x39e771[_0xf7ed('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d1d2f,_0x320339){return function(_0x72c10c){if(!_0x72c10c){_0x5d1d2f[_0xf7ed('0x25')](0x194);}return _0x72c10c;};}function handleError(_0x52ef23,_0x4e2edd){_0x4e2edd=_0x4e2edd||0x1f4;return function(_0x5e4d94){logger[_0xf7ed('0x21')](_0x5e4d94[_0xf7ed('0x34')]);if(_0x5e4d94[_0xf7ed('0x35')]){delete _0x5e4d94['name'];}_0x52ef23['status'](_0x4e2edd)[_0xf7ed('0x36')](_0x5e4d94);};}function getMustacheRender(_0x3319e5,_0x1ae947){return Mustache[_0xf7ed('0x37')](_0x3319e5,_['merge'](_0x1ae947[_0xf7ed('0x38')],{'contact':_0x1ae947[_0xf7ed('0x39')],'message':_0x1ae947[_0xf7ed('0x23')],'agent':_0x1ae947[_0xf7ed('0x3a')],'interaction':_0x1ae947[_0xf7ed('0x3b')],'account':_0x1ae947[_0xf7ed('0x3c')]}))||'';}exports[_0xf7ed('0x3d')]=function(_0x5e0de1,_0x5537c8){var _0x1fdb1e={},_0x9bdb69={},_0x2b3100={'count':0x0,'rows':[]};var _0x146ea2=_['map'](db[_0xf7ed('0x3e')][_0xf7ed('0x3f')],function(_0x511021){return{'name':_0x511021[_0xf7ed('0x40')],'type':_0x511021['type'][_0xf7ed('0x41')]};});_0x9bdb69[_0xf7ed('0x42')]=_[_0xf7ed('0x43')](_0x146ea2,_0xf7ed('0x35'));_0x9bdb69[_0xf7ed('0x44')]=_['keys'](_0x5e0de1[_0xf7ed('0x44')]);_0x9bdb69[_0xf7ed('0x45')]=_[_0xf7ed('0x46')](_0x9bdb69[_0xf7ed('0x42')],_0x9bdb69[_0xf7ed('0x44')]);_0x1fdb1e[_0xf7ed('0x47')]=_[_0xf7ed('0x46')](_0x9bdb69[_0xf7ed('0x42')],qs[_0xf7ed('0x48')](_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x48')]));_0x1fdb1e['attributes']=_0x1fdb1e[_0xf7ed('0x47')][_0xf7ed('0x49')]?_0x1fdb1e[_0xf7ed('0x47')]:_0x9bdb69[_0xf7ed('0x42')];if(!_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x4a')](_0xf7ed('0x4b'))){_0x1fdb1e[_0xf7ed('0x2a')]=qs[_0xf7ed('0x2a')](_0x5e0de1[_0xf7ed('0x44')]['limit']);_0x1fdb1e[_0xf7ed('0x28')]=qs[_0xf7ed('0x28')](_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x28')]);}_0x1fdb1e[_0xf7ed('0x4c')]=qs['sort'](_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x4d')]);_0x1fdb1e[_0xf7ed('0x4e')]=qs[_0xf7ed('0x45')](_[_0xf7ed('0x4f')](_0x5e0de1['query'],_0x9bdb69[_0xf7ed('0x45')]),_0x146ea2);if(_0x5e0de1['query'][_0xf7ed('0x50')]){_0x1fdb1e[_0xf7ed('0x4e')]=_['merge'](_0x1fdb1e[_0xf7ed('0x4e')],{'$or':_['map'](_0x146ea2,function(_0xb5c11a){if(_0xb5c11a[_0xf7ed('0x51')]!==_0xf7ed('0x52')){var _0x3c1eab={};_0x3c1eab[_0xb5c11a[_0xf7ed('0x35')]]={'$like':'%'+_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x50')]+'%'};return _0x3c1eab;}})});}_0x1fdb1e=_[_0xf7ed('0x53')]({},_0x1fdb1e,_0x5e0de1[_0xf7ed('0x54')]);var _0x52568b={'where':_0x1fdb1e[_0xf7ed('0x4e')]};return db[_0xf7ed('0x3e')][_0xf7ed('0x2b')](_0x52568b)[_0xf7ed('0x31')](function(_0x164e92){_0x2b3100[_0xf7ed('0x2b')]=_0x164e92;if(_0x5e0de1[_0xf7ed('0x44')][_0xf7ed('0x55')]){_0x1fdb1e[_0xf7ed('0x56')]=[{'all':!![]}];}return db[_0xf7ed('0x3e')][_0xf7ed('0x57')](_0x1fdb1e);})[_0xf7ed('0x31')](function(_0x978495){_0x2b3100['rows']=_0x978495;return _0x2b3100;})['then'](respondWithFilteredResult(_0x5537c8,_0x1fdb1e))['catch'](handleError(_0x5537c8,null));};exports[_0xf7ed('0x58')]=function(_0x5e64f1,_0xff0382){var _0x233db0={'raw':![],'where':{'id':_0x5e64f1[_0xf7ed('0x59')]['id']}},_0x535cb7={};_0x535cb7[_0xf7ed('0x42')]=_[_0xf7ed('0x5a')](db['SalesforceAccount'][_0xf7ed('0x3f')]);_0x535cb7['query']=_[_0xf7ed('0x5a')](_0x5e64f1['query']);_0x535cb7['filters']=_[_0xf7ed('0x46')](_0x535cb7[_0xf7ed('0x42')],_0x535cb7[_0xf7ed('0x44')]);_0x233db0[_0xf7ed('0x47')]=_[_0xf7ed('0x46')](_0x535cb7['model'],qs[_0xf7ed('0x48')](_0x5e64f1['query'][_0xf7ed('0x48')]));_0x233db0[_0xf7ed('0x47')]=_0x233db0[_0xf7ed('0x47')]['length']?_0x233db0[_0xf7ed('0x47')]:_0x535cb7[_0xf7ed('0x42')];if(_0x5e64f1['query'][_0xf7ed('0x55')]){_0x233db0['include']=[{'all':!![]}];}_0x233db0=_[_0xf7ed('0x53')]({},_0x233db0,_0x5e64f1['options']);return db[_0xf7ed('0x3e')][_0xf7ed('0x5b')](_0x233db0)[_0xf7ed('0x31')](handleEntityNotFound(_0xff0382,null))[_0xf7ed('0x31')](respondWithResult(_0xff0382,null))[_0xf7ed('0x24')](handleError(_0xff0382,null));};exports[_0xf7ed('0x5c')]=function(_0x30a116,_0x573c0){return db[_0xf7ed('0x3e')][_0xf7ed('0x5c')](_0x30a116['body'],{})['then'](respondWithResult(_0x573c0,0xc9))['catch'](handleError(_0x573c0,null));};exports[_0xf7ed('0x30')]=function(_0x2399c4,_0x8c30c2){if(_0x2399c4[_0xf7ed('0x38')]['id']){delete _0x2399c4[_0xf7ed('0x38')]['id'];}return db[_0xf7ed('0x3e')][_0xf7ed('0x5b')]({'where':{'id':_0x2399c4['params']['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x8c30c2,null))[_0xf7ed('0x31')](saveUpdates(_0x2399c4[_0xf7ed('0x38')],null))[_0xf7ed('0x31')](respondWithResult(_0x8c30c2,null))[_0xf7ed('0x24')](handleError(_0x8c30c2,null));};exports['destroy']=function(_0x23d508,_0x3c0147){return db[_0xf7ed('0x3e')][_0xf7ed('0x5b')]({'where':{'id':_0x23d508[_0xf7ed('0x59')]['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x3c0147,null))[_0xf7ed('0x31')](removeEntity(_0x3c0147,null))['catch'](handleError(_0x3c0147,null));};exports[_0xf7ed('0x5d')]=function(_0x2eeff6,_0x108587,_0x2f8ed8){var _0x26a733={};var _0x4a98eb={};var _0x3e4954;var _0x20faf6;return db[_0xf7ed('0x3e')][_0xf7ed('0x5e')]({'where':{'id':_0x2eeff6[_0xf7ed('0x59')]['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x108587,null))[_0xf7ed('0x31')](function(_0x5fad6c){if(_0x5fad6c){_0x3e4954=_0x5fad6c;_0x4a98eb[_0xf7ed('0x42')]=_[_0xf7ed('0x5a')](db[_0xf7ed('0x5f')]['rawAttributes']);_0x4a98eb[_0xf7ed('0x44')]=_[_0xf7ed('0x5a')](_0x2eeff6[_0xf7ed('0x44')]);_0x4a98eb[_0xf7ed('0x45')]=_['intersection'](_0x4a98eb['model'],_0x4a98eb[_0xf7ed('0x44')]);_0x26a733[_0xf7ed('0x47')]=_['intersection'](_0x4a98eb['model'],qs[_0xf7ed('0x48')](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x48')]));_0x26a733['attributes']=_0x26a733[_0xf7ed('0x47')][_0xf7ed('0x49')]?_0x26a733[_0xf7ed('0x47')]:_0x4a98eb[_0xf7ed('0x42')];_0x26a733['order']=qs[_0xf7ed('0x4d')](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x4d')]);_0x26a733[_0xf7ed('0x4e')]=qs[_0xf7ed('0x45')](_['pick'](_0x2eeff6[_0xf7ed('0x44')],_0x4a98eb[_0xf7ed('0x45')]));if(_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x50')]){_0x26a733[_0xf7ed('0x4e')]=_['merge'](_0x26a733[_0xf7ed('0x4e')],{'$or':_['map'](_0x26a733[_0xf7ed('0x47')],function(_0x4220e6){var _0x1fbc39={};_0x1fbc39[_0x4220e6]={'$like':'%'+_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x50')]+'%'};return _0x1fbc39;})});}_0x26a733=_['merge']({},_0x26a733,_0x2eeff6[_0xf7ed('0x54')]);return _0x3e4954['getConfigurations'](_0x26a733);}})[_0xf7ed('0x31')](function(_0x51b322){if(_0x51b322){_0x20faf6=_0x51b322['length'];if(!_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x4a')](_0xf7ed('0x4b'))){_0x26a733[_0xf7ed('0x2a')]=qs['limit'](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x2a')]);_0x26a733['offset']=qs[_0xf7ed('0x28')](_0x2eeff6[_0xf7ed('0x44')][_0xf7ed('0x28')]);}return _0x3e4954[_0xf7ed('0x5d')](_0x26a733);}})[_0xf7ed('0x31')](function(_0x1bb6b0){if(_0x1bb6b0){return _0x1bb6b0?{'count':_0x20faf6,'rows':_0x1bb6b0}:null;}})[_0xf7ed('0x31')](respondWithResult(_0x108587,null))[_0xf7ed('0x24')](handleError(_0x108587,null));};exports[_0xf7ed('0x60')]=function(_0x568f0c,_0x26fe08,_0x2c95ce){if(_0x568f0c[_0xf7ed('0x38')]['id']){delete _0x568f0c[_0xf7ed('0x38')]['id'];}return db['SalesforceAccount'][_0xf7ed('0x5e')]({'where':{'id':_0x568f0c[_0xf7ed('0x59')]['id']}})[_0xf7ed('0x31')](handleEntityNotFound(_0x26fe08,null))['then'](function(_0x43a5b0){if(_0x43a5b0){_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x61')]=_0x43a5b0['id'];_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x62')]=integrations[_0xf7ed('0x63')](_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x64')],_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x51')]);_0x568f0c[_0xf7ed('0x38')]['Descriptions']=integrations[_0xf7ed('0x65')](_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x64')],_0x568f0c[_0xf7ed('0x38')][_0xf7ed('0x51')]);return db['SalesforceConfiguration'][_0xf7ed('0x5c')](_0x568f0c[_0xf7ed('0x38')],{'include':[{'model':db['SalesforceField'],'as':_0xf7ed('0x62')},{'model':db[_0xf7ed('0x66')],'as':_0xf7ed('0x67')}]});}return null;})[_0xf7ed('0x31')](respondWithResult(_0x26fe08,null))[_0xf7ed('0x24')](handleError(_0x26fe08,null));};exports[_0xf7ed('0x68')]=function(_0x34a23a,_0x48684b,_0x25a863){var _0x53db3c;var _0x345f95='';var _0x4cf46a=_0xf7ed('0x69');return db[_0xf7ed('0x3e')]['findOne']({'where':{'id':_0x34a23a[_0xf7ed('0x59')]['id']},'attributes':['id',_0xf7ed('0x6a'),_0xf7ed('0x6b'),_0xf7ed('0x6c'),_0xf7ed('0x6d'),_0xf7ed('0x6e'),_0xf7ed('0x6f')]})['then'](handleEntityNotFound(_0x48684b,null))[_0xf7ed('0x31')](function(_0x51b9cf){if(_0x51b9cf){_0x345f95=_0x51b9cf[_0xf7ed('0x6a')];var _0x4f7f5d=_0x345f95[_0xf7ed('0x70')](-0x1);if(_0x4f7f5d==='/'){_0x345f95=_0x345f95[_0xf7ed('0x71')](0x0,_0x345f95[_0xf7ed('0x72')](_0x4f7f5d));}_0x53db3c=new jsforce[(_0xf7ed('0x73'))]({'oauth2':{'loginUrl':_0x345f95,'clientId':_0x51b9cf[_0xf7ed('0x6b')],'clientSecret':_0x51b9cf['clientSecret']}});return _0x53db3c[_0xf7ed('0x74')](_0x51b9cf[_0xf7ed('0x6d')],_0x51b9cf['password'][_0xf7ed('0x75')](_0x51b9cf[_0xf7ed('0x6f')]));}})[_0xf7ed('0x31')](function(_0x12c70a){if(_0x12c70a){if(!_[_0xf7ed('0x76')](_0x34a23a[_0xf7ed('0x44')]['ticketType'])){_0x4cf46a=_0x34a23a[_0xf7ed('0x44')][_0xf7ed('0x77')];}return _0x53db3c[_0xf7ed('0x78')](_0x4cf46a)[_0xf7ed('0x79')]();}})['then'](function(_0x30f63d){var _0x421b5b=[_0xf7ed('0x7a'),_0xf7ed('0x7b'),_0xf7ed('0x7c'),_0xf7ed('0x7d'),_0xf7ed('0x7e'),_0xf7ed('0x7f')];var _0x30cbc9=[_0xf7ed('0x80'),_0xf7ed('0x81'),_0xf7ed('0x82'),_0xf7ed('0x83'),_0xf7ed('0x84'),'textarea',_0xf7ed('0x85')];if(_0x30f63d){_['remove'](_0x30f63d['fields'],function(_0x15d42c){return _0x421b5b[_0xf7ed('0x86')](_0x15d42c['name'])||!_0x30cbc9[_0xf7ed('0x86')](_0x15d42c[_0xf7ed('0x51')]);});return{'count':_0x30f63d[_0xf7ed('0x48')][_0xf7ed('0x49')],'rows':_[_0xf7ed('0x43')](_0x30f63d['fields'],function(_0x40db83){return{'id':_0x40db83[_0xf7ed('0x35')],'name':_0x40db83[_0xf7ed('0x87')],'custom':_0x40db83['custom'],'options':_0x40db83[_0xf7ed('0x88')]['length']>0x0?_[_0xf7ed('0x43')](_0x40db83['picklistValues'],function(_0x381a30){return{'name':_0x381a30[_0xf7ed('0x87')],'value':_0x381a30[_0xf7ed('0x89')]};}):_0x40db83[_0xf7ed('0x51')]==_0xf7ed('0x83')?[{'name':'True','value':_0xf7ed('0x8a')},{'name':_0xf7ed('0x8b'),'value':'false'}]:[]};})};}})[_0xf7ed('0x31')](respondWithResult(_0x48684b,null))[_0xf7ed('0x24')](function(_0x3efd26){var _0x573551=_0x34a23a[_0xf7ed('0x44')]['test']?0x1f4:_0x3efd26['statusCode']||0x1f4;logger[_0xf7ed('0x21')](_0xf7ed('0x8c'),_0xf7ed('0x68'),_0x573551,JSON[_0xf7ed('0x20')](_0x3efd26));delete _0x3efd26['name'];if(_0x573551===0x191){_0x573551=0x190;}_0x48684b[_0xf7ed('0x33')](_0x573551)[_0xf7ed('0x36')](_0x34a23a[_0xf7ed('0x44')]['test']?{'message':_0xf7ed('0x8d'),'statusCode':_0x3efd26[_0xf7ed('0x8e')]}:_0x3efd26);});}; \ No newline at end of file +var _0x0329=['Description','string','boolean','email','phone','remove','includes','custom','picklistValues','label','value','True','False','false','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','merge','body','contact','agent','interaction','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','length','find','create','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','login','username','isNil','ticketType','describe','ActivityDate','IsRecurrence','Subject'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0329,0x11b));var _0x9032=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0x0329[_0x2b2b33];return _0x229157;};'use strict';var emlformat=require(_0x9032('0x0'));var rimraf=require(_0x9032('0x1'));var zipdir=require(_0x9032('0x2'));var jsonpatch=require(_0x9032('0x3'));var rp=require(_0x9032('0x4'));var moment=require(_0x9032('0x5'));var BPromise=require(_0x9032('0x6'));var Mustache=require(_0x9032('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9032('0x8'));var csv=require(_0x9032('0x9'));var ejs=require(_0x9032('0xa'));var fs=require('fs');var fs_extra=require(_0x9032('0xb'));var _=require('lodash');var squel=require(_0x9032('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9032('0xd'));var Papa=require(_0x9032('0xe'));var Redis=require(_0x9032('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9032('0x10'));var as=require(_0x9032('0x11'));var hardwareService=require(_0x9032('0x12'));var logger=require(_0x9032('0x13'))(_0x9032('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9032('0x15'))['db'];var integrations=require(_0x9032('0x16'));var jayson=require(_0x9032('0x17'));var client=jayson[_0x9032('0x18')][_0x9032('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5f1e08,_0x359ebe,_0x189752,_0x592532){return new BPromise(function(_0x47a241,_0x2d36f1){var _0x1fdc69=_0x592532||client;return _0x1fdc69['request'](_0x5f1e08,_0x189752)[_0x9032('0x1a')](function(_0x8c881d){logger[_0x9032('0x1b')](_0x9032('0x1c'),_0x359ebe,_0x9032('0x1d'));logger[_0x9032('0x1e')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x359ebe,_0x9032('0x1d'),JSON[_0x9032('0x1f')](_0x8c881d));if(_0x8c881d[_0x9032('0x20')]){if(_0x8c881d[_0x9032('0x20')]['code']===0x1f4){logger[_0x9032('0x20')](_0x9032('0x1c'),_0x359ebe,_0x8c881d[_0x9032('0x20')][_0x9032('0x21')]);return _0x2d36f1(_0x8c881d[_0x9032('0x20')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x359ebe,_0x8c881d[_0x9032('0x20')][_0x9032('0x21')]);return _0x47a241(_0x8c881d['error'][_0x9032('0x21')]);}else{logger[_0x9032('0x1b')]('SalesforceAccount,\x20%s,\x20%s',_0x359ebe,_0x9032('0x1d'));_0x47a241(_0x8c881d[_0x9032('0x22')][_0x9032('0x21')]);}})['catch'](function(_0x5f27b3){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x359ebe,_0x5f27b3);_0x2d36f1(_0x5f27b3);});});}function respondWithStatusCode(_0x543417,_0x315897){_0x315897=_0x315897||0xcc;return function(_0xfa69e5){if(_0xfa69e5){return _0x543417[_0x9032('0x23')](_0x315897);}return _0x543417[_0x9032('0x24')](_0x315897)[_0x9032('0x25')]();};}function respondWithResult(_0x15d9b7,_0x19748c){_0x19748c=_0x19748c||0xc8;return function(_0x3e0d14){if(_0x3e0d14){return _0x15d9b7[_0x9032('0x24')](_0x19748c)[_0x9032('0x26')](_0x3e0d14);}};}function respondWithFilteredResult(_0x2a1f55,_0x2f2765){return function(_0x28be5d){if(_0x28be5d){var _0x4a219e=typeof _0x2f2765[_0x9032('0x27')]===_0x9032('0x28')&&typeof _0x2f2765[_0x9032('0x29')]===_0x9032('0x28');var _0x1b50d6=_0x28be5d['count'];var _0x4d07d1=_0x4a219e?0x0:_0x2f2765[_0x9032('0x27')];var _0x10298a=_0x4a219e?_0x28be5d['count']:_0x2f2765[_0x9032('0x27')]+_0x2f2765[_0x9032('0x29')];var _0x33b076;if(_0x10298a>=_0x1b50d6){_0x10298a=_0x1b50d6;_0x33b076=0xc8;}else{_0x33b076=0xce;}_0x2a1f55[_0x9032('0x24')](_0x33b076);return _0x2a1f55[_0x9032('0x2a')](_0x9032('0x2b'),_0x4d07d1+'-'+_0x10298a+'/'+_0x1b50d6)[_0x9032('0x26')](_0x28be5d);}return null;};}function patchUpdates(_0x120838){return function(_0x1ab43c){try{jsonpatch[_0x9032('0x2c')](_0x1ab43c,_0x120838,!![]);}catch(_0x2fa5cc){return BPromise['reject'](_0x2fa5cc);}return _0x1ab43c[_0x9032('0x2d')]();};}function saveUpdates(_0x45845e,_0x35333d){return function(_0x1427bb){if(_0x1427bb){return _0x1427bb[_0x9032('0x2e')](_0x45845e)['then'](function(_0x1f27b3){return _0x1f27b3;});}return null;};}function removeEntity(_0x378b94,_0x48c75e){return function(_0x25ad43){if(_0x25ad43){return _0x25ad43[_0x9032('0x2f')]()[_0x9032('0x1a')](function(){_0x378b94[_0x9032('0x24')](0xcc)[_0x9032('0x25')]();});}};}function handleEntityNotFound(_0x39ce11,_0x587530){return function(_0x3728c7){if(!_0x3728c7){_0x39ce11[_0x9032('0x23')](0x194);}return _0x3728c7;};}function handleError(_0x1fcea9,_0x4a08b1){_0x4a08b1=_0x4a08b1||0x1f4;return function(_0x22a577){logger['error'](_0x22a577[_0x9032('0x30')]);if(_0x22a577[_0x9032('0x31')]){delete _0x22a577[_0x9032('0x31')];}_0x1fcea9[_0x9032('0x24')](_0x4a08b1)[_0x9032('0x32')](_0x22a577);};}function getMustacheRender(_0x297c25,_0x477507){return Mustache['render'](_0x297c25,_[_0x9032('0x33')](_0x477507[_0x9032('0x34')],{'contact':_0x477507[_0x9032('0x35')],'message':_0x477507[_0x9032('0x21')],'agent':_0x477507[_0x9032('0x36')],'interaction':_0x477507[_0x9032('0x37')],'account':_0x477507['account']}))||'';}exports['index']=function(_0x37756c,_0xc6989a){var _0x3cd776={},_0x53a1fe={},_0x2ff106={'count':0x0,'rows':[]};var _0x48dde0=_[_0x9032('0x38')](db['SalesforceAccount'][_0x9032('0x39')],function(_0x119e68){return{'name':_0x119e68[_0x9032('0x3a')],'type':_0x119e68[_0x9032('0x3b')][_0x9032('0x3c')]};});_0x53a1fe[_0x9032('0x3d')]=_[_0x9032('0x38')](_0x48dde0,_0x9032('0x31'));_0x53a1fe['query']=_[_0x9032('0x3e')](_0x37756c[_0x9032('0x3f')]);_0x53a1fe[_0x9032('0x40')]=_[_0x9032('0x41')](_0x53a1fe[_0x9032('0x3d')],_0x53a1fe[_0x9032('0x3f')]);_0x3cd776[_0x9032('0x42')]=_[_0x9032('0x41')](_0x53a1fe[_0x9032('0x3d')],qs[_0x9032('0x43')](_0x37756c[_0x9032('0x3f')][_0x9032('0x43')]));_0x3cd776[_0x9032('0x42')]=_0x3cd776[_0x9032('0x42')]['length']?_0x3cd776[_0x9032('0x42')]:_0x53a1fe['model'];if(!_0x37756c[_0x9032('0x3f')][_0x9032('0x44')](_0x9032('0x45'))){_0x3cd776['limit']=qs[_0x9032('0x29')](_0x37756c['query']['limit']);_0x3cd776['offset']=qs[_0x9032('0x27')](_0x37756c[_0x9032('0x3f')][_0x9032('0x27')]);}_0x3cd776[_0x9032('0x46')]=qs[_0x9032('0x47')](_0x37756c[_0x9032('0x3f')]['sort']);_0x3cd776['where']=qs[_0x9032('0x40')](_[_0x9032('0x48')](_0x37756c[_0x9032('0x3f')],_0x53a1fe[_0x9032('0x40')]),_0x48dde0);if(_0x37756c['query'][_0x9032('0x49')]){_0x3cd776[_0x9032('0x4a')]=_['merge'](_0x3cd776[_0x9032('0x4a')],{'$or':_['map'](_0x48dde0,function(_0x51033b){if(_0x51033b[_0x9032('0x3b')]!==_0x9032('0x4b')){var _0x372055={};_0x372055[_0x51033b['name']]={'$like':'%'+_0x37756c[_0x9032('0x3f')][_0x9032('0x49')]+'%'};return _0x372055;}})});}_0x3cd776=_['merge']({},_0x3cd776,_0x37756c[_0x9032('0x4c')]);var _0x51e236={'where':_0x3cd776[_0x9032('0x4a')]};return db[_0x9032('0x4d')]['count'](_0x51e236)['then'](function(_0x54982d){_0x2ff106['count']=_0x54982d;if(_0x37756c[_0x9032('0x3f')][_0x9032('0x4e')]){_0x3cd776[_0x9032('0x4f')]=[{'all':!![]}];}return db[_0x9032('0x4d')][_0x9032('0x50')](_0x3cd776);})[_0x9032('0x1a')](function(_0x377741){_0x2ff106[_0x9032('0x51')]=_0x377741;return _0x2ff106;})[_0x9032('0x1a')](respondWithFilteredResult(_0xc6989a,_0x3cd776))[_0x9032('0x52')](handleError(_0xc6989a,null));};exports[_0x9032('0x53')]=function(_0x4a7254,_0x1e2108){var _0x80daa7={'raw':![],'where':{'id':_0x4a7254[_0x9032('0x54')]['id']}},_0x1b810c={};_0x1b810c[_0x9032('0x3d')]=_[_0x9032('0x3e')](db['SalesforceAccount'][_0x9032('0x39')]);_0x1b810c[_0x9032('0x3f')]=_['keys'](_0x4a7254['query']);_0x1b810c[_0x9032('0x40')]=_[_0x9032('0x41')](_0x1b810c[_0x9032('0x3d')],_0x1b810c['query']);_0x80daa7[_0x9032('0x42')]=_['intersection'](_0x1b810c['model'],qs[_0x9032('0x43')](_0x4a7254[_0x9032('0x3f')][_0x9032('0x43')]));_0x80daa7[_0x9032('0x42')]=_0x80daa7[_0x9032('0x42')][_0x9032('0x55')]?_0x80daa7[_0x9032('0x42')]:_0x1b810c[_0x9032('0x3d')];if(_0x4a7254[_0x9032('0x3f')][_0x9032('0x4e')]){_0x80daa7[_0x9032('0x4f')]=[{'all':!![]}];}_0x80daa7=_['merge']({},_0x80daa7,_0x4a7254[_0x9032('0x4c')]);return db[_0x9032('0x4d')][_0x9032('0x56')](_0x80daa7)[_0x9032('0x1a')](handleEntityNotFound(_0x1e2108,null))['then'](respondWithResult(_0x1e2108,null))[_0x9032('0x52')](handleError(_0x1e2108,null));};exports[_0x9032('0x57')]=function(_0x41b6bf,_0x41f9f9){return db['SalesforceAccount'][_0x9032('0x57')](_0x41b6bf['body'],{})[_0x9032('0x1a')](respondWithResult(_0x41f9f9,0xc9))[_0x9032('0x52')](handleError(_0x41f9f9,null));};exports[_0x9032('0x2e')]=function(_0x435444,_0x217e21){if(_0x435444[_0x9032('0x34')]['id']){delete _0x435444[_0x9032('0x34')]['id'];}return db[_0x9032('0x4d')][_0x9032('0x56')]({'where':{'id':_0x435444['params']['id']}})[_0x9032('0x1a')](handleEntityNotFound(_0x217e21,null))[_0x9032('0x1a')](saveUpdates(_0x435444[_0x9032('0x34')],null))['then'](respondWithResult(_0x217e21,null))['catch'](handleError(_0x217e21,null));};exports[_0x9032('0x2f')]=function(_0x4d14db,_0x267145){return db['SalesforceAccount'][_0x9032('0x56')]({'where':{'id':_0x4d14db[_0x9032('0x54')]['id']}})[_0x9032('0x1a')](handleEntityNotFound(_0x267145,null))[_0x9032('0x1a')](removeEntity(_0x267145,null))[_0x9032('0x52')](handleError(_0x267145,null));};exports[_0x9032('0x58')]=function(_0x343d74,_0x152fec,_0x4800c4){var _0x252da3={};var _0x299821={};var _0x3e3de7;var _0x437466;return db[_0x9032('0x4d')][_0x9032('0x59')]({'where':{'id':_0x343d74[_0x9032('0x54')]['id']}})['then'](handleEntityNotFound(_0x152fec,null))[_0x9032('0x1a')](function(_0x22a642){if(_0x22a642){_0x3e3de7=_0x22a642;_0x299821[_0x9032('0x3d')]=_[_0x9032('0x3e')](db[_0x9032('0x5a')][_0x9032('0x39')]);_0x299821[_0x9032('0x3f')]=_['keys'](_0x343d74[_0x9032('0x3f')]);_0x299821[_0x9032('0x40')]=_['intersection'](_0x299821['model'],_0x299821[_0x9032('0x3f')]);_0x252da3[_0x9032('0x42')]=_[_0x9032('0x41')](_0x299821['model'],qs['fields'](_0x343d74['query'][_0x9032('0x43')]));_0x252da3[_0x9032('0x42')]=_0x252da3[_0x9032('0x42')][_0x9032('0x55')]?_0x252da3[_0x9032('0x42')]:_0x299821[_0x9032('0x3d')];_0x252da3[_0x9032('0x46')]=qs[_0x9032('0x47')](_0x343d74['query'][_0x9032('0x47')]);_0x252da3[_0x9032('0x4a')]=qs[_0x9032('0x40')](_['pick'](_0x343d74[_0x9032('0x3f')],_0x299821['filters']));if(_0x343d74['query'][_0x9032('0x49')]){_0x252da3['where']=_[_0x9032('0x33')](_0x252da3[_0x9032('0x4a')],{'$or':_[_0x9032('0x38')](_0x252da3['attributes'],function(_0x543308){var _0x1732e3={};_0x1732e3[_0x543308]={'$like':'%'+_0x343d74[_0x9032('0x3f')][_0x9032('0x49')]+'%'};return _0x1732e3;})});}_0x252da3=_[_0x9032('0x33')]({},_0x252da3,_0x343d74['options']);return _0x3e3de7[_0x9032('0x58')](_0x252da3);}})[_0x9032('0x1a')](function(_0x407752){if(_0x407752){_0x437466=_0x407752[_0x9032('0x55')];if(!_0x343d74[_0x9032('0x3f')][_0x9032('0x44')]('nolimit')){_0x252da3[_0x9032('0x29')]=qs[_0x9032('0x29')](_0x343d74[_0x9032('0x3f')][_0x9032('0x29')]);_0x252da3['offset']=qs[_0x9032('0x27')](_0x343d74[_0x9032('0x3f')]['offset']);}return _0x3e3de7['getConfigurations'](_0x252da3);}})['then'](function(_0x5366b2){if(_0x5366b2){return _0x5366b2?{'count':_0x437466,'rows':_0x5366b2}:null;}})['then'](respondWithResult(_0x152fec,null))[_0x9032('0x52')](handleError(_0x152fec,null));};exports[_0x9032('0x5b')]=function(_0x3e64c5,_0x5d2aba,_0x315201){if(_0x3e64c5[_0x9032('0x34')]['id']){delete _0x3e64c5[_0x9032('0x34')]['id'];}return db[_0x9032('0x4d')][_0x9032('0x59')]({'where':{'id':_0x3e64c5[_0x9032('0x54')]['id']}})['then'](handleEntityNotFound(_0x5d2aba,null))[_0x9032('0x1a')](function(_0x4a5d8a){if(_0x4a5d8a){_0x3e64c5[_0x9032('0x34')][_0x9032('0x5c')]=_0x4a5d8a['id'];_0x3e64c5[_0x9032('0x34')][_0x9032('0x5d')]=integrations[_0x9032('0x5e')](_0x3e64c5[_0x9032('0x34')][_0x9032('0x5f')],_0x3e64c5[_0x9032('0x34')]['type']);_0x3e64c5['body']['Descriptions']=integrations['getDescriptions'](_0x3e64c5['body']['channel'],_0x3e64c5[_0x9032('0x34')]['type']);return db[_0x9032('0x5a')][_0x9032('0x57')](_0x3e64c5[_0x9032('0x34')],{'include':[{'model':db['SalesforceField'],'as':_0x9032('0x5d')},{'model':db[_0x9032('0x60')],'as':_0x9032('0x61')}]});}return null;})[_0x9032('0x1a')](respondWithResult(_0x5d2aba,null))[_0x9032('0x52')](handleError(_0x5d2aba,null));};exports[_0x9032('0x62')]=function(_0x4dde4a,_0x449753,_0x109e3a){var _0x14dcc3;var _0x5badf9='';var _0x4f406a='Task';return db[_0x9032('0x4d')][_0x9032('0x59')]({'where':{'id':_0x4dde4a['params']['id']},'attributes':['id',_0x9032('0x63'),_0x9032('0x64'),_0x9032('0x65'),'username',_0x9032('0x66'),_0x9032('0x67')]})[_0x9032('0x1a')](handleEntityNotFound(_0x449753,null))['then'](function(_0x2b5032){if(_0x2b5032){_0x5badf9=_0x2b5032[_0x9032('0x63')];var _0x413ff3=_0x5badf9[_0x9032('0x68')](-0x1);if(_0x413ff3==='/'){_0x5badf9=_0x5badf9[_0x9032('0x69')](0x0,_0x5badf9[_0x9032('0x6a')](_0x413ff3));}_0x14dcc3=new jsforce[(_0x9032('0x6b'))]({'oauth2':{'loginUrl':_0x5badf9,'clientId':_0x2b5032[_0x9032('0x64')],'clientSecret':_0x2b5032[_0x9032('0x65')]}});return _0x14dcc3[_0x9032('0x6c')](_0x2b5032[_0x9032('0x6d')],_0x2b5032['password']['concat'](_0x2b5032[_0x9032('0x67')]));}})[_0x9032('0x1a')](function(_0x2952b7){if(_0x2952b7){if(!_[_0x9032('0x6e')](_0x4dde4a[_0x9032('0x3f')][_0x9032('0x6f')])){_0x4f406a=_0x4dde4a['query'][_0x9032('0x6f')];}return _0x14dcc3['sobject'](_0x4f406a)[_0x9032('0x70')]();}})['then'](function(_0x4ab147){var _0x11ec01=['OwnerId',_0x9032('0x71'),'IsReminderSet',_0x9032('0x72'),_0x9032('0x73'),_0x9032('0x74')];var _0x588da8=[_0x9032('0x75'),'int','picklist',_0x9032('0x76'),_0x9032('0x77'),'textarea',_0x9032('0x78')];if(_0x4ab147){_[_0x9032('0x79')](_0x4ab147[_0x9032('0x43')],function(_0x34ac9c){return _0x11ec01[_0x9032('0x7a')](_0x34ac9c[_0x9032('0x31')])||!_0x588da8['includes'](_0x34ac9c['type']);});return{'count':_0x4ab147[_0x9032('0x43')][_0x9032('0x55')],'rows':_[_0x9032('0x38')](_0x4ab147['fields'],function(_0x1611d4){return{'id':_0x1611d4[_0x9032('0x31')],'name':_0x1611d4['label'],'custom':_0x1611d4[_0x9032('0x7b')],'options':_0x1611d4['picklistValues'][_0x9032('0x55')]>0x0?_['map'](_0x1611d4[_0x9032('0x7c')],function(_0x276a14){return{'name':_0x276a14[_0x9032('0x7d')],'value':_0x276a14[_0x9032('0x7e')]};}):_0x1611d4[_0x9032('0x3b')]==_0x9032('0x76')?[{'name':_0x9032('0x7f'),'value':'true'},{'name':_0x9032('0x80'),'value':_0x9032('0x81')}]:[]};})};}})['then'](respondWithResult(_0x449753,null))[_0x9032('0x52')](function(_0x4677e8){var _0x131135=_0x4dde4a[_0x9032('0x3f')][_0x9032('0x82')]?0x1f4:_0x4677e8['statusCode']||0x1f4;logger[_0x9032('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x131135,JSON[_0x9032('0x1f')](_0x4677e8));delete _0x4677e8['name'];if(_0x131135===0x191){_0x131135=0x190;}_0x449753[_0x9032('0x24')](_0x131135)['send'](_0x4dde4a[_0x9032('0x3f')][_0x9032('0x82')]?{'message':_0x9032('0x83'),'statusCode':_0x4677e8[_0x9032('0x84')]}:_0x4677e8);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c6886ce..55c0d65 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.model.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3990=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x17fbe9,_0x1f37b8){var _0x1afe3d=function(_0x5c667c){while(--_0x5c667c){_0x17fbe9['push'](_0x17fbe9['shift']());}};_0x1afe3d(++_0x1f37b8);}(_0x3990,0x19a));var _0x0399=function(_0x311460,_0x3485f5){_0x311460=_0x311460-0x0;var _0x3037b2=_0x3990[_0x311460];return _0x3037b2;};'use strict';var _=require(_0x0399('0x0'));var util=require(_0x0399('0x1'));var logger=require(_0x0399('0x2'))(_0x0399('0x3'));var moment=require(_0x0399('0x4'));var BPromise=require(_0x0399('0x5'));var rp=require(_0x0399('0x6'));var fs=require('fs');var path=require(_0x0399('0x7'));var rimraf=require('rimraf');var config=require(_0x0399('0x8'));var attributes=require(_0x0399('0x9'));var integrations=require(_0x0399('0xa'));module[_0x0399('0xb')]=function(_0xc8a39c,_0x680136){return _0xc8a39c[_0x0399('0xc')](_0x0399('0xd'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5be=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x5a8f34,_0x11c27b){var _0x497614=function(_0x2089e3){while(--_0x2089e3){_0x5a8f34['push'](_0x5a8f34['shift']());}};_0x497614(++_0x11c27b);}(_0xb5be,0x116));var _0xeb5b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb5be[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xeb5b('0x0'));var util=require(_0xeb5b('0x1'));var logger=require(_0xeb5b('0x2'))(_0xeb5b('0x3'));var moment=require(_0xeb5b('0x4'));var BPromise=require(_0xeb5b('0x5'));var rp=require(_0xeb5b('0x6'));var fs=require('fs');var path=require(_0xeb5b('0x7'));var rimraf=require(_0xeb5b('0x8'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xeb5b('0x9'));module[_0xeb5b('0xa')]=function(_0x1c43fd,_0x3a9467){return _0x1c43fd[_0xeb5b('0xb')](_0xeb5b('0xc'),attributes,{'tableName':_0xeb5b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 86248b5..8588f02 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dae=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SalesforceAccount','options','where','attributes','include','map','model','info','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2dae,0xc3));var _0xe2da=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x2dae[_0x547456];return _0xc1fd7b;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c70b,_0x34cc98,_0x2efbd8){return new BPromise(function(_0x238da3,_0x1c71ea){return client[_0xe2da('0xb')](_0x89c70b,_0x2efbd8)[_0xe2da('0xc')](function(_0x68aa40){logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));logger[_0xe2da('0xf')](_0xe2da('0x10'),_0x34cc98,_0xe2da('0xe'),JSON[_0xe2da('0x11')](_0x68aa40));if(_0x68aa40[_0xe2da('0x12')]){if(_0x68aa40[_0xe2da('0x12')]['code']===0x1f4){logger[_0xe2da('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x34cc98,_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);return _0x1c71ea(_0x68aa40[_0xe2da('0x12')][_0xe2da('0x13')]);}logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x68aa40[_0xe2da('0x12')]['message']);return _0x238da3(_0x68aa40[_0xe2da('0x12')]['message']);}else{logger['info'](_0xe2da('0xd'),_0x34cc98,_0xe2da('0xe'));_0x238da3(_0x68aa40[_0xe2da('0x14')]['message']);}})[_0xe2da('0x15')](function(_0x2c0353){logger[_0xe2da('0x12')](_0xe2da('0xd'),_0x34cc98,_0x2c0353);_0x1c71ea(_0x2c0353);});});}exports['GetSalesforceAccount']=function(_0x45bb92){var _0x1f7d33=this;return new Promise(function(_0x417363,_0x2e5730){return db[_0xe2da('0x16')]['findAll']({'raw':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'limit':_0x45bb92['options']?_0x45bb92[_0xe2da('0x17')]['limit']||null:null,'include':_0x45bb92[_0xe2da('0x17')]?_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x45bb92[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x38f2c4){return{'model':db[_0x38f2c4[_0xe2da('0x1c')]],'as':_0x38f2c4['as'],'attributes':_0x38f2c4['attributes'],'include':_0x38f2c4[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x38f2c4[_0xe2da('0x1a')],function(_0x14704d){return{'model':db[_0x14704d[_0xe2da('0x1c')]],'as':_0x14704d['as'],'attributes':_0x14704d[_0xe2da('0x19')],'include':_0x14704d[_0xe2da('0x1a')]?_['map'](_0x14704d[_0xe2da('0x1a')],function(_0x3e23d7){return{'model':db[_0x3e23d7[_0xe2da('0x1c')]],'as':_0x3e23d7['as'],'attributes':_0x3e23d7[_0xe2da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe2da('0xc')](function(_0x2b6c9e){logger[_0xe2da('0x1d')](_0xe2da('0x1e'),_0x45bb92);logger['debug']('GetSalesforceAccount',_0x45bb92,JSON['stringify'](_0x2b6c9e));_0x417363(_0x2b6c9e);})[_0xe2da('0x15')](function(_0x8c91db){logger[_0xe2da('0x12')](_0xe2da('0x1e'),_0x8c91db['message'],_0x45bb92);_0x2e5730(_0x1f7d33['error'](0x1f4,_0x8c91db[_0xe2da('0x13')]));});});};exports[_0xe2da('0x1f')]=function(_0x262d40){var _0x39f983=this;return new Promise(function(_0x7ab5ee,_0x15df33){return db[_0xe2da('0x16')][_0xe2da('0x20')]({'raw':_0x262d40[_0xe2da('0x17')]?_0x262d40['options']['raw']===undefined?!![]:![]:!![],'where':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x18')]||null:null,'attributes':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x19')]||null:null,'include':_0x262d40[_0xe2da('0x17')]?_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x262d40[_0xe2da('0x17')][_0xe2da('0x1a')],function(_0x4ef546){return{'model':db[_0x4ef546[_0xe2da('0x1c')]],'as':_0x4ef546['as'],'attributes':_0x4ef546[_0xe2da('0x19')],'include':_0x4ef546[_0xe2da('0x1a')]?_[_0xe2da('0x1b')](_0x4ef546[_0xe2da('0x1a')],function(_0x5a078e){return{'model':db[_0x5a078e[_0xe2da('0x1c')]],'as':_0x5a078e['as'],'attributes':_0x5a078e[_0xe2da('0x19')],'include':_0x5a078e[_0xe2da('0x1a')]?_['map'](_0x5a078e[_0xe2da('0x1a')],function(_0x10b8f5){return{'model':db[_0x10b8f5[_0xe2da('0x1c')]],'as':_0x10b8f5['as'],'attributes':_0x10b8f5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x156deb){logger[_0xe2da('0x1d')]('ShowSalesforceAccount',_0x262d40);logger[_0xe2da('0xf')](_0xe2da('0x1f'),_0x262d40,JSON[_0xe2da('0x11')](_0x156deb));_0x7ab5ee(_0x156deb);})[_0xe2da('0x15')](function(_0x3a6ca3){logger['error'](_0xe2da('0x1f'),_0x3a6ca3['message'],_0x262d40);_0x15df33(_0x39f983['error'](0x1f4,_0x3a6ca3[_0xe2da('0x13')]));});});}; \ No newline at end of file +var _0xc6d8=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','model','attributes','map','include','then','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x4bcbc2,_0x46cbff){_0x4bcbc2=_0x4bcbc2-0x0;var _0xe5b888=_0xc6d8[_0x4bcbc2];return _0xe5b888;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});}exports['GetSalesforceAccount']=function(_0x3e5495){var _0x5a22de=this;return new Promise(function(_0x4c2f8d,_0x21b8ee){return db['SalesforceAccount'][_0x8c6d('0x13')]({'raw':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['where']||null:null,'attributes':_0x3e5495['options']?_0x3e5495[_0x8c6d('0x14')]['attributes']||null:null,'limit':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['limit']||null:null,'include':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')]['include']?_['map'](_0x3e5495['options']['include'],function(_0x2a85b5){return{'model':db[_0x2a85b5[_0x8c6d('0x16')]],'as':_0x2a85b5['as'],'attributes':_0x2a85b5[_0x8c6d('0x17')],'include':_0x2a85b5['include']?_[_0x8c6d('0x18')](_0x2a85b5['include'],function(_0x15a9c4){return{'model':db[_0x15a9c4['model']],'as':_0x15a9c4['as'],'attributes':_0x15a9c4[_0x8c6d('0x17')],'include':_0x15a9c4[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a9c4[_0x8c6d('0x19')],function(_0x1e6755){return{'model':db[_0x1e6755[_0x8c6d('0x16')]],'as':_0x1e6755['as'],'attributes':_0x1e6755[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x3eab38){logger['info']('GetSalesforceAccount',_0x3e5495);logger[_0x8c6d('0xd')](_0x8c6d('0x1b'),_0x3e5495,JSON[_0x8c6d('0xf')](_0x3eab38));_0x4c2f8d(_0x3eab38);})[_0x8c6d('0x12')](function(_0x370626){logger[_0x8c6d('0x10')](_0x8c6d('0x1b'),_0x370626[_0x8c6d('0x11')],_0x3e5495);_0x21b8ee(_0x5a22de[_0x8c6d('0x10')](0x1f4,_0x370626[_0x8c6d('0x11')]));});});};exports[_0x8c6d('0x1c')]=function(_0x15a508){var _0x4e5203=this;return new Promise(function(_0x3af625,_0x332f6a){return db[_0x8c6d('0x1d')][_0x8c6d('0x1e')]({'raw':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')]['where']||null:null,'attributes':_0x15a508[_0x8c6d('0x14')]?_0x15a508['options'][_0x8c6d('0x17')]||null:null,'include':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a508[_0x8c6d('0x14')]['include'],function(_0x5ae56b){return{'model':db[_0x5ae56b[_0x8c6d('0x16')]],'as':_0x5ae56b['as'],'attributes':_0x5ae56b[_0x8c6d('0x17')],'include':_0x5ae56b[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x5ae56b['include'],function(_0x2818fa){return{'model':db[_0x2818fa[_0x8c6d('0x16')]],'as':_0x2818fa['as'],'attributes':_0x2818fa[_0x8c6d('0x17')],'include':_0x2818fa[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x2818fa[_0x8c6d('0x19')],function(_0x4a0fb3){return{'model':db[_0x4a0fb3[_0x8c6d('0x16')]],'as':_0x4a0fb3['as'],'attributes':_0x4a0fb3[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x2ef932){logger[_0x8c6d('0xa')](_0x8c6d('0x1c'),_0x15a508);logger[_0x8c6d('0xd')](_0x8c6d('0x1c'),_0x15a508,JSON[_0x8c6d('0xf')](_0x2ef932));_0x3af625(_0x2ef932);})[_0x8c6d('0x12')](function(_0x16b2cd){logger[_0x8c6d('0x10')]('ShowSalesforceAccount',_0x16b2cd[_0x8c6d('0x11')],_0x15a508);_0x332f6a(_0x4e5203[_0x8c6d('0x10')](0x1f4,_0x16b2cd[_0x8c6d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 664b232..abd06de 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1053=['getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x428b47,_0x5b313e){var _0x5c47af=function(_0x500e57){while(--_0x500e57){_0x428b47['push'](_0x428b47['shift']());}};_0x5c47af(++_0x5b313e);}(_0x1053,0x18f));var _0x3105=function(_0x13bcbb,_0x2eb915){_0x13bcbb=_0x13bcbb-0x0;var _0x457c81=_0x1053[_0x13bcbb];return _0x457c81;};'use strict';var multer=require(_0x3105('0x0'));var util=require(_0x3105('0x1'));var path=require(_0x3105('0x2'));var timeout=require(_0x3105('0x3'));var express=require('express');var router=express[_0x3105('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3105('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3105('0x6'));router[_0x3105('0x7')]('/',auth[_0x3105('0x8')](),controller[_0x3105('0x9')]);router[_0x3105('0x7')](_0x3105('0xa'),auth[_0x3105('0x8')](),controller[_0x3105('0xb')]);router['get'](_0x3105('0xc'),auth[_0x3105('0x8')](),controller[_0x3105('0xd')]);router[_0x3105('0x7')](_0x3105('0xe'),auth[_0x3105('0x8')](),controller[_0x3105('0xf')]);router[_0x3105('0x7')](_0x3105('0x10'),auth[_0x3105('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x3105('0x8')](),controller[_0x3105('0x11')]);router[_0x3105('0x12')](_0x3105('0xa'),auth[_0x3105('0x8')](),controller[_0x3105('0x13')]);router[_0x3105('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3105('0x15')]);module[_0x3105('0x16')]=router; \ No newline at end of file +var _0xddce=['/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x26773e,_0x4d778f){var _0x5627ac=function(_0x38da18){while(--_0x38da18){_0x26773e['push'](_0x26773e['shift']());}};_0x5627ac(++_0x4d778f);}(_0xddce,0x197));var _0xeddc=function(_0x15124b,_0x4f0e3f){_0x15124b=_0x15124b-0x0;var _0x42a5b4=_0xddce[_0x15124b];return _0x42a5b4;};'use strict';var multer=require(_0xeddc('0x0'));var util=require(_0xeddc('0x1'));var path=require(_0xeddc('0x2'));var timeout=require(_0xeddc('0x3'));var express=require(_0xeddc('0x4'));var router=express[_0xeddc('0x5')]();var fs_extra=require(_0xeddc('0x6'));var auth=require(_0xeddc('0x7'));var interaction=require(_0xeddc('0x8'));var config=require('../../config/environment');var controller=require(_0xeddc('0x9'));router['get']('/',auth[_0xeddc('0xa')](),controller[_0xeddc('0xb')]);router['get'](_0xeddc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xeddc('0xd')](_0xeddc('0xe'),auth[_0xeddc('0xa')](),controller[_0xeddc('0xf')]);router[_0xeddc('0xd')](_0xeddc('0x10'),auth[_0xeddc('0xa')](),controller[_0xeddc('0x11')]);router[_0xeddc('0xd')](_0xeddc('0x12'),auth['isAuthenticated'](),controller[_0xeddc('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeddc('0x14')]);router['put']('/:id',auth[_0xeddc('0xa')](),controller[_0xeddc('0x15')]);router[_0xeddc('0x16')]('/:id',auth[_0xeddc('0xa')](),controller[_0xeddc('0x17')]);module[_0xeddc('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 73d279d..2a3be82 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c22=['STRING','ENUM','Case','Task','contact_lead','account_contact_lead','account','nothing','contact','lead','sequelize','exports'];(function(_0x435b2f,_0x4c44da){var _0x181648=function(_0x3d753e){while(--_0x3d753e){_0x435b2f['push'](_0x435b2f['shift']());}};_0x181648(++_0x4c44da);}(_0x5c22,0x196));var _0x25c2=function(_0x48f9cf,_0x441b6d){_0x48f9cf=_0x48f9cf-0x0;var _0x37eaff=_0x5c22[_0x48f9cf];return _0x37eaff;};'use strict';var Sequelize=require(_0x25c2('0x0'));module[_0x25c2('0x1')]={'name':{'type':Sequelize[_0x25c2('0x2')]},'description':{'type':Sequelize[_0x25c2('0x2')]},'ticketType':{'type':Sequelize[_0x25c2('0x3')]('Task',_0x25c2('0x4')),'defaultValue':_0x25c2('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x25c2('0x6'),'contact','lead',_0x25c2('0x7'),_0x25c2('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x25c2('0x3')](_0x25c2('0x9'),_0x25c2('0xa'),_0x25c2('0xb'),_0x25c2('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x25c2('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x25c2('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x25c2('0x2')]}}; \ No newline at end of file +var _0x486e=['STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports'];(function(_0x33acb0,_0x122cc8){var _0x88703=function(_0x31b76d){while(--_0x31b76d){_0x33acb0['push'](_0x33acb0['shift']());}};_0x88703(++_0x122cc8);}(_0x486e,0xb2));var _0xe486=function(_0x1d4be2,_0x12c7ec){_0x1d4be2=_0x1d4be2-0x0;var _0x3df399=_0x486e[_0x1d4be2];return _0x3df399;};'use strict';var Sequelize=require(_0xe486('0x0'));module[_0xe486('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe486('0x2')]},'ticketType':{'type':Sequelize[_0xe486('0x3')](_0xe486('0x4'),_0xe486('0x5')),'defaultValue':_0xe486('0x4')},'moduleSearch':{'type':Sequelize[_0xe486('0x3')](_0xe486('0x6'),_0xe486('0x7'),_0xe486('0x8'),_0xe486('0x9'),_0xe486('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xe486('0x3')](_0xe486('0xb'),_0xe486('0x7'),_0xe486('0x8'),_0xe486('0xa')),'defaultValue':_0xe486('0x8')},'leadId':{'type':Sequelize[_0xe486('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xe486('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index d3b3aca..38248a6 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1810=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','map','type','filter','includeAll','rows','show','params','keys','rawAttributes','include','options','create','find','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','sendStatus','name','render','merge','body','agent','index','SalesforceConfiguration','fieldName','model','query'];(function(_0x2a38f5,_0x5bbbc3){var _0xdeb357=function(_0x41a514){while(--_0x41a514){_0x2a38f5['push'](_0x2a38f5['shift']());}};_0xdeb357(++_0x5bbbc3);}(_0x1810,0x137));var _0x0181=function(_0x4b0830,_0x2e3b0a){_0x4b0830=_0x4b0830-0x0;var _0x1f53a7=_0x1810[_0x4b0830];return _0x1f53a7;};'use strict';var emlformat=require(_0x0181('0x0'));var rimraf=require(_0x0181('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0181('0x2'));var rp=require(_0x0181('0x3'));var moment=require(_0x0181('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0181('0x5'));var util=require(_0x0181('0x6'));var path=require(_0x0181('0x7'));var sox=require(_0x0181('0x8'));var csv=require(_0x0181('0x9'));var ejs=require(_0x0181('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0181('0xb'));var squel=require('squel');var crypto=require(_0x0181('0xc'));var jsforce=require(_0x0181('0xd'));var deskjs=require(_0x0181('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0181('0xf'));var Papa=require(_0x0181('0x10'));var Redis=require(_0x0181('0x11'));var authService=require(_0x0181('0x12'));var qs=require(_0x0181('0x13'));var as=require(_0x0181('0x14'));var hardwareService=require(_0x0181('0x15'));var logger=require('../../config/logger')(_0x0181('0x16'));var utils=require(_0x0181('0x17'));var config=require(_0x0181('0x18'));var licenseUtil=require(_0x0181('0x19'));var db=require(_0x0181('0x1a'))['db'];var jayson=require(_0x0181('0x1b'));var client=jayson[_0x0181('0x1c')][_0x0181('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d8819,_0x4fb93c,_0xcbab6b,_0x4b2555){return new BPromise(function(_0x6b1599,_0x1cf008){var _0x22cd35=_0x4b2555||client;return _0x22cd35[_0x0181('0x1e')](_0x4d8819,_0xcbab6b)['then'](function(_0xe080de){logger[_0x0181('0x1f')](_0x0181('0x20'),_0x4fb93c,_0x0181('0x21'));logger['debug'](_0x0181('0x22'),_0x4fb93c,'request\x20sent',JSON[_0x0181('0x23')](_0xe080de));if(_0xe080de[_0x0181('0x24')]){if(_0xe080de['error'][_0x0181('0x25')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4fb93c,_0xe080de['error'][_0x0181('0x26')]);return _0x1cf008(_0xe080de[_0x0181('0x24')][_0x0181('0x26')]);}logger[_0x0181('0x24')](_0x0181('0x20'),_0x4fb93c,_0xe080de[_0x0181('0x24')][_0x0181('0x26')]);return _0x6b1599(_0xe080de[_0x0181('0x24')][_0x0181('0x26')]);}else{logger[_0x0181('0x1f')](_0x0181('0x20'),_0x4fb93c,_0x0181('0x21'));_0x6b1599(_0xe080de[_0x0181('0x27')]['message']);}})[_0x0181('0x28')](function(_0x806697){logger[_0x0181('0x24')](_0x0181('0x20'),_0x4fb93c,_0x806697);_0x1cf008(_0x806697);});});}function respondWithStatusCode(_0x50ca5a,_0x3ab967){_0x3ab967=_0x3ab967||0xcc;return function(_0x101970){if(_0x101970){return _0x50ca5a['sendStatus'](_0x3ab967);}return _0x50ca5a[_0x0181('0x29')](_0x3ab967)[_0x0181('0x2a')]();};}function respondWithResult(_0x3b538a,_0x31a7ba){_0x31a7ba=_0x31a7ba||0xc8;return function(_0x41194d){if(_0x41194d){return _0x3b538a[_0x0181('0x29')](_0x31a7ba)[_0x0181('0x2b')](_0x41194d);}};}function respondWithFilteredResult(_0x32c790,_0x2f068f){return function(_0x5241d6){if(_0x5241d6){var _0x19549d=typeof _0x2f068f[_0x0181('0x2c')]===_0x0181('0x2d')&&typeof _0x2f068f[_0x0181('0x2e')]==='undefined';var _0x2d63e5=_0x5241d6[_0x0181('0x2f')];var _0xd83250=_0x19549d?0x0:_0x2f068f[_0x0181('0x2c')];var _0x56eb6a=_0x19549d?_0x5241d6['count']:_0x2f068f[_0x0181('0x2c')]+_0x2f068f[_0x0181('0x2e')];var _0x116005;if(_0x56eb6a>=_0x2d63e5){_0x56eb6a=_0x2d63e5;_0x116005=0xc8;}else{_0x116005=0xce;}_0x32c790[_0x0181('0x29')](_0x116005);return _0x32c790['set']('Content-Range',_0xd83250+'-'+_0x56eb6a+'/'+_0x2d63e5)[_0x0181('0x2b')](_0x5241d6);}return null;};}function patchUpdates(_0x5af2eb){return function(_0x5b6fd5){try{jsonpatch[_0x0181('0x30')](_0x5b6fd5,_0x5af2eb,!![]);}catch(_0x4d1655){return BPromise[_0x0181('0x31')](_0x4d1655);}return _0x5b6fd5[_0x0181('0x32')]();};}function saveUpdates(_0x9fbd50,_0x450f13){return function(_0x2129b0){if(_0x2129b0){return _0x2129b0[_0x0181('0x33')](_0x9fbd50)['then'](function(_0x427419){return _0x427419;});}return null;};}function removeEntity(_0x49bcdd,_0x26af5f){return function(_0xb10c0e){if(_0xb10c0e){return _0xb10c0e[_0x0181('0x34')]()[_0x0181('0x35')](function(){_0x49bcdd[_0x0181('0x29')](0xcc)[_0x0181('0x2a')]();});}};}function handleEntityNotFound(_0x1c0a35,_0x52b8d9){return function(_0x499ef4){if(!_0x499ef4){_0x1c0a35[_0x0181('0x36')](0x194);}return _0x499ef4;};}function handleError(_0xfa40ba,_0x3d5b50){_0x3d5b50=_0x3d5b50||0x1f4;return function(_0x3433da){logger['error'](_0x3433da['stack']);if(_0x3433da[_0x0181('0x37')]){delete _0x3433da['name'];}_0xfa40ba[_0x0181('0x29')](_0x3d5b50)['send'](_0x3433da);};}function getMustacheRender(_0x1ca59c,_0x5b336d){return Mustache[_0x0181('0x38')](_0x1ca59c,_[_0x0181('0x39')](_0x5b336d[_0x0181('0x3a')],{'contact':_0x5b336d['contact'],'message':_0x5b336d[_0x0181('0x26')],'agent':_0x5b336d[_0x0181('0x3b')],'interaction':_0x5b336d['interaction'],'account':_0x5b336d['account']}))||'';}exports[_0x0181('0x3c')]=function(_0x456db2,_0x4c8ce4){var _0x339b03={},_0x6916ab={},_0x4b207e={'count':0x0,'rows':[]};var _0xc4e52f=_['map'](db[_0x0181('0x3d')]['rawAttributes'],function(_0x502456){return{'name':_0x502456[_0x0181('0x3e')],'type':_0x502456['type']['key']};});_0x6916ab[_0x0181('0x3f')]=_['map'](_0xc4e52f,'name');_0x6916ab[_0x0181('0x40')]=_['keys'](_0x456db2[_0x0181('0x40')]);_0x6916ab['filters']=_[_0x0181('0x41')](_0x6916ab[_0x0181('0x3f')],_0x6916ab[_0x0181('0x40')]);_0x339b03['attributes']=_[_0x0181('0x41')](_0x6916ab['model'],qs['fields'](_0x456db2['query'][_0x0181('0x42')]));_0x339b03['attributes']=_0x339b03[_0x0181('0x43')][_0x0181('0x44')]?_0x339b03[_0x0181('0x43')]:_0x6916ab[_0x0181('0x3f')];if(!_0x456db2[_0x0181('0x40')][_0x0181('0x45')]('nolimit')){_0x339b03['limit']=qs['limit'](_0x456db2[_0x0181('0x40')][_0x0181('0x2e')]);_0x339b03['offset']=qs['offset'](_0x456db2[_0x0181('0x40')]['offset']);}_0x339b03[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x456db2['query'][_0x0181('0x47')]);_0x339b03[_0x0181('0x48')]=qs[_0x0181('0x49')](_[_0x0181('0x4a')](_0x456db2['query'],_0x6916ab[_0x0181('0x49')]),_0xc4e52f);if(_0x456db2[_0x0181('0x40')]['filter']){_0x339b03[_0x0181('0x48')]=_[_0x0181('0x39')](_0x339b03[_0x0181('0x48')],{'$or':_[_0x0181('0x4b')](_0xc4e52f,function(_0x3ef7df){if(_0x3ef7df[_0x0181('0x4c')]!=='VIRTUAL'){var _0x5480cd={};_0x5480cd[_0x3ef7df['name']]={'$like':'%'+_0x456db2[_0x0181('0x40')][_0x0181('0x4d')]+'%'};return _0x5480cd;}})});}_0x339b03=_[_0x0181('0x39')]({},_0x339b03,_0x456db2['options']);var _0x51e8a7={'where':_0x339b03[_0x0181('0x48')]};return db[_0x0181('0x3d')]['count'](_0x51e8a7)[_0x0181('0x35')](function(_0x3aff16){_0x4b207e[_0x0181('0x2f')]=_0x3aff16;if(_0x456db2[_0x0181('0x40')][_0x0181('0x4e')]){_0x339b03['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x339b03);})[_0x0181('0x35')](function(_0x52e79e){_0x4b207e[_0x0181('0x4f')]=_0x52e79e;return _0x4b207e;})[_0x0181('0x35')](respondWithFilteredResult(_0x4c8ce4,_0x339b03))[_0x0181('0x28')](handleError(_0x4c8ce4,null));};exports[_0x0181('0x50')]=function(_0x25539a,_0x4d5105){var _0x2f7456={'raw':![],'where':{'id':_0x25539a[_0x0181('0x51')]['id']}},_0x59cfcf={};_0x59cfcf[_0x0181('0x3f')]=_[_0x0181('0x52')](db[_0x0181('0x3d')][_0x0181('0x53')]);_0x59cfcf[_0x0181('0x40')]=_[_0x0181('0x52')](_0x25539a[_0x0181('0x40')]);_0x59cfcf[_0x0181('0x49')]=_[_0x0181('0x41')](_0x59cfcf['model'],_0x59cfcf[_0x0181('0x40')]);_0x2f7456[_0x0181('0x43')]=_[_0x0181('0x41')](_0x59cfcf['model'],qs[_0x0181('0x42')](_0x25539a['query']['fields']));_0x2f7456[_0x0181('0x43')]=_0x2f7456[_0x0181('0x43')][_0x0181('0x44')]?_0x2f7456['attributes']:_0x59cfcf[_0x0181('0x3f')];if(_0x25539a['query']['includeAll']){_0x2f7456[_0x0181('0x54')]=[{'all':!![]}];}_0x2f7456=_[_0x0181('0x39')]({},_0x2f7456,_0x25539a[_0x0181('0x55')]);return db[_0x0181('0x3d')]['find'](_0x2f7456)[_0x0181('0x35')](handleEntityNotFound(_0x4d5105,null))['then'](respondWithResult(_0x4d5105,null))['catch'](handleError(_0x4d5105,null));};exports[_0x0181('0x56')]=function(_0x2ab4ee,_0x1f6369){return db[_0x0181('0x3d')][_0x0181('0x56')](_0x2ab4ee[_0x0181('0x3a')],{})[_0x0181('0x35')](respondWithResult(_0x1f6369,0xc9))[_0x0181('0x28')](handleError(_0x1f6369,null));};exports['update']=function(_0x397cfd,_0x27406){if(_0x397cfd[_0x0181('0x3a')]['id']){delete _0x397cfd[_0x0181('0x3a')]['id'];}return db[_0x0181('0x3d')][_0x0181('0x57')]({'where':{'id':_0x397cfd[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x27406,null))[_0x0181('0x35')](saveUpdates(_0x397cfd[_0x0181('0x3a')],null))[_0x0181('0x35')](respondWithResult(_0x27406,null))[_0x0181('0x28')](handleError(_0x27406,null));};exports[_0x0181('0x34')]=function(_0x2fdfd0,_0x3202a8){return db[_0x0181('0x3d')][_0x0181('0x57')]({'where':{'id':_0x2fdfd0[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x3202a8,null))[_0x0181('0x35')](removeEntity(_0x3202a8,null))[_0x0181('0x28')](handleError(_0x3202a8,null));};exports[_0x0181('0x58')]=function(_0x5685fe,_0x2a28fb,_0x258227){var _0x50de7b={};var _0x4e121c={};var _0x59b1b9;var _0x2d3373;return db[_0x0181('0x3d')][_0x0181('0x59')]({'where':{'id':_0x5685fe[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x2a28fb,null))['then'](function(_0x1b4b54){if(_0x1b4b54){_0x59b1b9=_0x1b4b54;_0x4e121c[_0x0181('0x3f')]=_['keys'](db[_0x0181('0x5a')][_0x0181('0x53')]);_0x4e121c['query']=_[_0x0181('0x52')](_0x5685fe[_0x0181('0x40')]);_0x4e121c[_0x0181('0x49')]=_[_0x0181('0x41')](_0x4e121c[_0x0181('0x3f')],_0x4e121c['query']);_0x50de7b[_0x0181('0x43')]=_[_0x0181('0x41')](_0x4e121c[_0x0181('0x3f')],qs[_0x0181('0x42')](_0x5685fe['query']['fields']));_0x50de7b[_0x0181('0x43')]=_0x50de7b[_0x0181('0x43')][_0x0181('0x44')]?_0x50de7b['attributes']:_0x4e121c['model'];_0x50de7b[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x5685fe[_0x0181('0x40')][_0x0181('0x47')]);_0x50de7b[_0x0181('0x48')]=qs['filters'](_[_0x0181('0x4a')](_0x5685fe[_0x0181('0x40')],_0x4e121c['filters']));if(_0x5685fe[_0x0181('0x40')][_0x0181('0x4d')]){_0x50de7b[_0x0181('0x48')]=_['merge'](_0x50de7b['where'],{'$or':_[_0x0181('0x4b')](_0x50de7b[_0x0181('0x43')],function(_0x13341b){var _0x5b3bdc={};_0x5b3bdc[_0x13341b]={'$like':'%'+_0x5685fe[_0x0181('0x40')]['filter']+'%'};return _0x5b3bdc;})});}_0x50de7b=_[_0x0181('0x39')]({},_0x50de7b,_0x5685fe[_0x0181('0x55')]);return _0x59b1b9[_0x0181('0x58')](_0x50de7b);}})['then'](function(_0x39f045){if(_0x39f045){_0x2d3373=_0x39f045[_0x0181('0x44')];if(!_0x5685fe[_0x0181('0x40')]['hasOwnProperty'](_0x0181('0x5b'))){_0x50de7b[_0x0181('0x2e')]=qs['limit'](_0x5685fe[_0x0181('0x40')][_0x0181('0x2e')]);_0x50de7b[_0x0181('0x2c')]=qs[_0x0181('0x2c')](_0x5685fe[_0x0181('0x40')][_0x0181('0x2c')]);}return _0x59b1b9[_0x0181('0x58')](_0x50de7b);}})[_0x0181('0x35')](function(_0xd161ca){if(_0xd161ca){return _0xd161ca?{'count':_0x2d3373,'rows':_0xd161ca}:null;}})[_0x0181('0x35')](respondWithResult(_0x2a28fb,null))['catch'](handleError(_0x2a28fb,null));};exports[_0x0181('0x5c')]=function(_0x2562ed,_0x15af5a,_0x34e5aa){var _0x333897={};var _0x3f7cb3={};var _0x7e2134;var _0x51552f;return db[_0x0181('0x3d')][_0x0181('0x59')]({'where':{'id':_0x2562ed[_0x0181('0x51')]['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x15af5a,null))[_0x0181('0x35')](function(_0xb73738){if(_0xb73738){_0x7e2134=_0xb73738;_0x3f7cb3[_0x0181('0x3f')]=_[_0x0181('0x52')](db['SalesforceField']['rawAttributes']);_0x3f7cb3[_0x0181('0x40')]=_[_0x0181('0x52')](_0x2562ed['query']);_0x3f7cb3[_0x0181('0x49')]=_[_0x0181('0x41')](_0x3f7cb3[_0x0181('0x3f')],_0x3f7cb3['query']);_0x333897['attributes']=_['intersection'](_0x3f7cb3[_0x0181('0x3f')],qs[_0x0181('0x42')](_0x2562ed[_0x0181('0x40')]['fields']));_0x333897[_0x0181('0x43')]=_0x333897[_0x0181('0x43')][_0x0181('0x44')]?_0x333897[_0x0181('0x43')]:_0x3f7cb3['model'];_0x333897[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x2562ed[_0x0181('0x40')][_0x0181('0x47')]);_0x333897['where']=qs[_0x0181('0x49')](_[_0x0181('0x4a')](_0x2562ed['query'],_0x3f7cb3['filters']));if(_0x2562ed[_0x0181('0x40')][_0x0181('0x4d')]){_0x333897['where']=_[_0x0181('0x39')](_0x333897[_0x0181('0x48')],{'$or':_[_0x0181('0x4b')](_0x333897[_0x0181('0x43')],function(_0x54f549){var _0x5ac580={};_0x5ac580[_0x54f549]={'$like':'%'+_0x2562ed[_0x0181('0x40')][_0x0181('0x4d')]+'%'};return _0x5ac580;})});}_0x333897=_[_0x0181('0x39')]({},_0x333897,_0x2562ed[_0x0181('0x55')]);return _0x7e2134[_0x0181('0x5c')](_0x333897);}})['then'](function(_0x3f6259){if(_0x3f6259){_0x51552f=_0x3f6259[_0x0181('0x44')];if(!_0x2562ed[_0x0181('0x40')][_0x0181('0x45')](_0x0181('0x5b'))){_0x333897[_0x0181('0x2e')]=qs[_0x0181('0x2e')](_0x2562ed['query'][_0x0181('0x2e')]);_0x333897[_0x0181('0x2c')]=qs[_0x0181('0x2c')](_0x2562ed[_0x0181('0x40')][_0x0181('0x2c')]);}return _0x7e2134[_0x0181('0x5c')](_0x333897);}})['then'](function(_0x3e9fd9){if(_0x3e9fd9){return _0x3e9fd9?{'count':_0x51552f,'rows':_0x3e9fd9}:null;}})[_0x0181('0x35')](respondWithResult(_0x15af5a,null))[_0x0181('0x28')](handleError(_0x15af5a,null));};exports[_0x0181('0x5d')]=function(_0x1e2028,_0x1e8f84,_0x528078){var _0x249fa0={};var _0x31a176={};var _0xa7d0b7;var _0x26e8ad;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1e2028['params']['id']}})[_0x0181('0x35')](handleEntityNotFound(_0x1e8f84,null))[_0x0181('0x35')](function(_0x288599){if(_0x288599){_0xa7d0b7=_0x288599;_0x31a176[_0x0181('0x3f')]=_['keys'](db['SalesforceField'][_0x0181('0x53')]);_0x31a176[_0x0181('0x40')]=_[_0x0181('0x52')](_0x1e2028[_0x0181('0x40')]);_0x31a176['filters']=_[_0x0181('0x41')](_0x31a176[_0x0181('0x3f')],_0x31a176[_0x0181('0x40')]);_0x249fa0[_0x0181('0x43')]=_[_0x0181('0x41')](_0x31a176[_0x0181('0x3f')],qs['fields'](_0x1e2028['query'][_0x0181('0x42')]));_0x249fa0[_0x0181('0x43')]=_0x249fa0[_0x0181('0x43')][_0x0181('0x44')]?_0x249fa0[_0x0181('0x43')]:_0x31a176['model'];_0x249fa0[_0x0181('0x46')]=qs[_0x0181('0x47')](_0x1e2028[_0x0181('0x40')][_0x0181('0x47')]);_0x249fa0[_0x0181('0x48')]=qs[_0x0181('0x49')](_[_0x0181('0x4a')](_0x1e2028[_0x0181('0x40')],_0x31a176[_0x0181('0x49')]));if(_0x1e2028[_0x0181('0x40')][_0x0181('0x4d')]){_0x249fa0['where']=_[_0x0181('0x39')](_0x249fa0[_0x0181('0x48')],{'$or':_['map'](_0x249fa0['attributes'],function(_0x410851){var _0x471bec={};_0x471bec[_0x410851]={'$like':'%'+_0x1e2028[_0x0181('0x40')]['filter']+'%'};return _0x471bec;})});}_0x249fa0=_[_0x0181('0x39')]({},_0x249fa0,_0x1e2028['options']);return _0xa7d0b7['getDescriptions'](_0x249fa0);}})[_0x0181('0x35')](function(_0x278233){if(_0x278233){_0x26e8ad=_0x278233['length'];if(!_0x1e2028[_0x0181('0x40')]['hasOwnProperty'](_0x0181('0x5b'))){_0x249fa0['limit']=qs['limit'](_0x1e2028[_0x0181('0x40')][_0x0181('0x2e')]);_0x249fa0[_0x0181('0x2c')]=qs['offset'](_0x1e2028['query'][_0x0181('0x2c')]);}return _0xa7d0b7['getDescriptions'](_0x249fa0);}})['then'](function(_0x5e49ac){if(_0x5e49ac){return _0x5e49ac?{'count':_0x26e8ad,'rows':_0x5e49ac}:null;}})[_0x0181('0x35')](respondWithResult(_0x1e8f84,null))['catch'](handleError(_0x1e8f84,null));}; \ No newline at end of file +var _0x73da=['catch','show','find','body','findOne','params','SalesforceField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','end','stack','name','render','contact','agent','interaction','account','index','SalesforceConfiguration','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll'];(function(_0x37070b,_0x30a8c0){var _0x15e789=function(_0x35e9ae){while(--_0x35e9ae){_0x37070b['push'](_0x37070b['shift']());}};_0x15e789(++_0x30a8c0);}(_0x73da,0x122));var _0xa73d=function(_0x591e11,_0x363e09){_0x591e11=_0x591e11-0x0;var _0x23a0a=_0x73da[_0x591e11];return _0x23a0a;};'use strict';var emlformat=require(_0xa73d('0x0'));var rimraf=require(_0xa73d('0x1'));var zipdir=require(_0xa73d('0x2'));var jsonpatch=require(_0xa73d('0x3'));var rp=require(_0xa73d('0x4'));var moment=require(_0xa73d('0x5'));var BPromise=require(_0xa73d('0x6'));var Mustache=require('mustache');var util=require(_0xa73d('0x7'));var path=require(_0xa73d('0x8'));var sox=require(_0xa73d('0x9'));var csv=require(_0xa73d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa73d('0xb'));var _=require(_0xa73d('0xc'));var squel=require('squel');var crypto=require(_0xa73d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa73d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa73d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa73d('0x10'));var as=require(_0xa73d('0x11'));var hardwareService=require(_0xa73d('0x12'));var logger=require(_0xa73d('0x13'))(_0xa73d('0x14'));var utils=require('../../config/utils');var config=require(_0xa73d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa73d('0x16'))['db'];var jayson=require(_0xa73d('0x17'));var client=jayson['client'][_0xa73d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x14b60c,_0x3e11ef,_0xace50,_0x5cac0d){return new BPromise(function(_0xbc8121,_0x40029e){var _0x3d102c=_0x5cac0d||client;return _0x3d102c[_0xa73d('0x19')](_0x14b60c,_0xace50)[_0xa73d('0x1a')](function(_0xc24962){logger[_0xa73d('0x1b')](_0xa73d('0x1c'),_0x3e11ef,'request\x20sent');logger[_0xa73d('0x1d')](_0xa73d('0x1e'),_0x3e11ef,_0xa73d('0x1f'),JSON[_0xa73d('0x20')](_0xc24962));if(_0xc24962[_0xa73d('0x21')]){if(_0xc24962[_0xa73d('0x21')][_0xa73d('0x22')]===0x1f4){logger[_0xa73d('0x21')](_0xa73d('0x1c'),_0x3e11ef,_0xc24962[_0xa73d('0x21')][_0xa73d('0x23')]);return _0x40029e(_0xc24962['error'][_0xa73d('0x23')]);}logger[_0xa73d('0x21')](_0xa73d('0x1c'),_0x3e11ef,_0xc24962[_0xa73d('0x21')]['message']);return _0xbc8121(_0xc24962['error']['message']);}else{logger[_0xa73d('0x1b')](_0xa73d('0x1c'),_0x3e11ef,_0xa73d('0x1f'));_0xbc8121(_0xc24962[_0xa73d('0x24')][_0xa73d('0x23')]);}})['catch'](function(_0x29026f){logger[_0xa73d('0x21')](_0xa73d('0x1c'),_0x3e11ef,_0x29026f);_0x40029e(_0x29026f);});});}function respondWithStatusCode(_0x1a9686,_0x41ef1d){_0x41ef1d=_0x41ef1d||0xcc;return function(_0x37e4cf){if(_0x37e4cf){return _0x1a9686[_0xa73d('0x25')](_0x41ef1d);}return _0x1a9686['status'](_0x41ef1d)['end']();};}function respondWithResult(_0x3eda4c,_0x19e154){_0x19e154=_0x19e154||0xc8;return function(_0x2c735f){if(_0x2c735f){return _0x3eda4c[_0xa73d('0x26')](_0x19e154)['json'](_0x2c735f);}};}function respondWithFilteredResult(_0x3cb39c,_0x4edeec){return function(_0x13f10f){if(_0x13f10f){var _0xac1878=typeof _0x4edeec[_0xa73d('0x27')]===_0xa73d('0x28')&&typeof _0x4edeec[_0xa73d('0x29')]===_0xa73d('0x28');var _0x397bdf=_0x13f10f[_0xa73d('0x2a')];var _0x534888=_0xac1878?0x0:_0x4edeec[_0xa73d('0x27')];var _0x444c34=_0xac1878?_0x13f10f[_0xa73d('0x2a')]:_0x4edeec['offset']+_0x4edeec[_0xa73d('0x29')];var _0x587bd5;if(_0x444c34>=_0x397bdf){_0x444c34=_0x397bdf;_0x587bd5=0xc8;}else{_0x587bd5=0xce;}_0x3cb39c[_0xa73d('0x26')](_0x587bd5);return _0x3cb39c[_0xa73d('0x2b')](_0xa73d('0x2c'),_0x534888+'-'+_0x444c34+'/'+_0x397bdf)['json'](_0x13f10f);}return null;};}function patchUpdates(_0x4aa1ed){return function(_0xd710ec){try{jsonpatch['apply'](_0xd710ec,_0x4aa1ed,!![]);}catch(_0x19a13e){return BPromise[_0xa73d('0x2d')](_0x19a13e);}return _0xd710ec[_0xa73d('0x2e')]();};}function saveUpdates(_0x1ae97e,_0x1ea07f){return function(_0xfcff77){if(_0xfcff77){return _0xfcff77[_0xa73d('0x2f')](_0x1ae97e)['then'](function(_0x234f5f){return _0x234f5f;});}return null;};}function removeEntity(_0x517448,_0xec88f9){return function(_0xc200a4){if(_0xc200a4){return _0xc200a4[_0xa73d('0x30')]()[_0xa73d('0x1a')](function(){_0x517448['status'](0xcc)[_0xa73d('0x31')]();});}};}function handleEntityNotFound(_0x559e5d,_0xf4b1d5){return function(_0x1739f6){if(!_0x1739f6){_0x559e5d['sendStatus'](0x194);}return _0x1739f6;};}function handleError(_0x3901b1,_0xfe3f1b){_0xfe3f1b=_0xfe3f1b||0x1f4;return function(_0x3cb1ef){logger[_0xa73d('0x21')](_0x3cb1ef[_0xa73d('0x32')]);if(_0x3cb1ef['name']){delete _0x3cb1ef[_0xa73d('0x33')];}_0x3901b1[_0xa73d('0x26')](_0xfe3f1b)['send'](_0x3cb1ef);};}function getMustacheRender(_0x24a822,_0x33cdb8){return Mustache[_0xa73d('0x34')](_0x24a822,_['merge'](_0x33cdb8['body'],{'contact':_0x33cdb8[_0xa73d('0x35')],'message':_0x33cdb8[_0xa73d('0x23')],'agent':_0x33cdb8[_0xa73d('0x36')],'interaction':_0x33cdb8[_0xa73d('0x37')],'account':_0x33cdb8[_0xa73d('0x38')]}))||'';}exports[_0xa73d('0x39')]=function(_0x4b1a15,_0x283b63){var _0x31c9f0={},_0x37bec5={},_0x3f49bf={'count':0x0,'rows':[]};var _0xc24e5b=_['map'](db[_0xa73d('0x3a')][_0xa73d('0x3b')],function(_0x26a051){return{'name':_0x26a051['fieldName'],'type':_0x26a051[_0xa73d('0x3c')]['key']};});_0x37bec5[_0xa73d('0x3d')]=_['map'](_0xc24e5b,'name');_0x37bec5['query']=_[_0xa73d('0x3e')](_0x4b1a15[_0xa73d('0x3f')]);_0x37bec5[_0xa73d('0x40')]=_[_0xa73d('0x41')](_0x37bec5[_0xa73d('0x3d')],_0x37bec5['query']);_0x31c9f0[_0xa73d('0x42')]=_[_0xa73d('0x41')](_0x37bec5[_0xa73d('0x3d')],qs[_0xa73d('0x43')](_0x4b1a15[_0xa73d('0x3f')][_0xa73d('0x43')]));_0x31c9f0[_0xa73d('0x42')]=_0x31c9f0[_0xa73d('0x42')][_0xa73d('0x44')]?_0x31c9f0['attributes']:_0x37bec5['model'];if(!_0x4b1a15[_0xa73d('0x3f')][_0xa73d('0x45')](_0xa73d('0x46'))){_0x31c9f0[_0xa73d('0x29')]=qs[_0xa73d('0x29')](_0x4b1a15[_0xa73d('0x3f')][_0xa73d('0x29')]);_0x31c9f0['offset']=qs[_0xa73d('0x27')](_0x4b1a15['query'][_0xa73d('0x27')]);}_0x31c9f0['order']=qs['sort'](_0x4b1a15[_0xa73d('0x3f')][_0xa73d('0x47')]);_0x31c9f0[_0xa73d('0x48')]=qs[_0xa73d('0x40')](_[_0xa73d('0x49')](_0x4b1a15[_0xa73d('0x3f')],_0x37bec5[_0xa73d('0x40')]),_0xc24e5b);if(_0x4b1a15[_0xa73d('0x3f')][_0xa73d('0x4a')]){_0x31c9f0[_0xa73d('0x48')]=_[_0xa73d('0x4b')](_0x31c9f0[_0xa73d('0x48')],{'$or':_[_0xa73d('0x4c')](_0xc24e5b,function(_0x25c2d2){if(_0x25c2d2[_0xa73d('0x3c')]!==_0xa73d('0x4d')){var _0x522845={};_0x522845[_0x25c2d2[_0xa73d('0x33')]]={'$like':'%'+_0x4b1a15[_0xa73d('0x3f')][_0xa73d('0x4a')]+'%'};return _0x522845;}})});}_0x31c9f0=_['merge']({},_0x31c9f0,_0x4b1a15[_0xa73d('0x4e')]);var _0x389482={'where':_0x31c9f0[_0xa73d('0x48')]};return db['SalesforceConfiguration'][_0xa73d('0x2a')](_0x389482)[_0xa73d('0x1a')](function(_0x58ba44){_0x3f49bf[_0xa73d('0x2a')]=_0x58ba44;if(_0x4b1a15['query'][_0xa73d('0x4f')]){_0x31c9f0[_0xa73d('0x50')]=[{'all':!![]}];}return db[_0xa73d('0x3a')][_0xa73d('0x51')](_0x31c9f0);})['then'](function(_0x178661){_0x3f49bf['rows']=_0x178661;return _0x3f49bf;})[_0xa73d('0x1a')](respondWithFilteredResult(_0x283b63,_0x31c9f0))[_0xa73d('0x52')](handleError(_0x283b63,null));};exports[_0xa73d('0x53')]=function(_0x268edc,_0x248563){var _0x1668f3={'raw':![],'where':{'id':_0x268edc['params']['id']}},_0x1c8de5={};_0x1c8de5[_0xa73d('0x3d')]=_[_0xa73d('0x3e')](db['SalesforceConfiguration'][_0xa73d('0x3b')]);_0x1c8de5[_0xa73d('0x3f')]=_['keys'](_0x268edc['query']);_0x1c8de5[_0xa73d('0x40')]=_[_0xa73d('0x41')](_0x1c8de5[_0xa73d('0x3d')],_0x1c8de5[_0xa73d('0x3f')]);_0x1668f3[_0xa73d('0x42')]=_[_0xa73d('0x41')](_0x1c8de5[_0xa73d('0x3d')],qs[_0xa73d('0x43')](_0x268edc['query'][_0xa73d('0x43')]));_0x1668f3[_0xa73d('0x42')]=_0x1668f3[_0xa73d('0x42')][_0xa73d('0x44')]?_0x1668f3[_0xa73d('0x42')]:_0x1c8de5['model'];if(_0x268edc[_0xa73d('0x3f')][_0xa73d('0x4f')]){_0x1668f3[_0xa73d('0x50')]=[{'all':!![]}];}_0x1668f3=_[_0xa73d('0x4b')]({},_0x1668f3,_0x268edc[_0xa73d('0x4e')]);return db[_0xa73d('0x3a')][_0xa73d('0x54')](_0x1668f3)['then'](handleEntityNotFound(_0x248563,null))[_0xa73d('0x1a')](respondWithResult(_0x248563,null))[_0xa73d('0x52')](handleError(_0x248563,null));};exports['create']=function(_0x213e28,_0x4af0af){return db[_0xa73d('0x3a')]['create'](_0x213e28[_0xa73d('0x55')],{})['then'](respondWithResult(_0x4af0af,0xc9))[_0xa73d('0x52')](handleError(_0x4af0af,null));};exports[_0xa73d('0x2f')]=function(_0x12f869,_0x2feab2){if(_0x12f869[_0xa73d('0x55')]['id']){delete _0x12f869['body']['id'];}return db[_0xa73d('0x3a')][_0xa73d('0x54')]({'where':{'id':_0x12f869['params']['id']}})['then'](handleEntityNotFound(_0x2feab2,null))[_0xa73d('0x1a')](saveUpdates(_0x12f869[_0xa73d('0x55')],null))[_0xa73d('0x1a')](respondWithResult(_0x2feab2,null))[_0xa73d('0x52')](handleError(_0x2feab2,null));};exports[_0xa73d('0x30')]=function(_0x65e2be,_0x48c135){return db[_0xa73d('0x3a')][_0xa73d('0x54')]({'where':{'id':_0x65e2be['params']['id']}})['then'](handleEntityNotFound(_0x48c135,null))['then'](removeEntity(_0x48c135,null))[_0xa73d('0x52')](handleError(_0x48c135,null));};exports['getFields']=function(_0x3707b2,_0x77f5a4,_0x4e25db){var _0x428278={};var _0x7ceb46={};var _0xb1628c;var _0x11251c;return db['SalesforceConfiguration'][_0xa73d('0x56')]({'where':{'id':_0x3707b2[_0xa73d('0x57')]['id']}})[_0xa73d('0x1a')](handleEntityNotFound(_0x77f5a4,null))[_0xa73d('0x1a')](function(_0x3a0f72){if(_0x3a0f72){_0xb1628c=_0x3a0f72;_0x7ceb46[_0xa73d('0x3d')]=_[_0xa73d('0x3e')](db[_0xa73d('0x58')][_0xa73d('0x3b')]);_0x7ceb46[_0xa73d('0x3f')]=_[_0xa73d('0x3e')](_0x3707b2[_0xa73d('0x3f')]);_0x7ceb46['filters']=_[_0xa73d('0x41')](_0x7ceb46[_0xa73d('0x3d')],_0x7ceb46[_0xa73d('0x3f')]);_0x428278[_0xa73d('0x42')]=_['intersection'](_0x7ceb46[_0xa73d('0x3d')],qs[_0xa73d('0x43')](_0x3707b2[_0xa73d('0x3f')][_0xa73d('0x43')]));_0x428278[_0xa73d('0x42')]=_0x428278[_0xa73d('0x42')][_0xa73d('0x44')]?_0x428278['attributes']:_0x7ceb46['model'];_0x428278[_0xa73d('0x59')]=qs['sort'](_0x3707b2['query']['sort']);_0x428278[_0xa73d('0x48')]=qs[_0xa73d('0x40')](_[_0xa73d('0x49')](_0x3707b2[_0xa73d('0x3f')],_0x7ceb46[_0xa73d('0x40')]));if(_0x3707b2[_0xa73d('0x3f')][_0xa73d('0x4a')]){_0x428278[_0xa73d('0x48')]=_[_0xa73d('0x4b')](_0x428278[_0xa73d('0x48')],{'$or':_['map'](_0x428278[_0xa73d('0x42')],function(_0xb31235){var _0x60f48d={};_0x60f48d[_0xb31235]={'$like':'%'+_0x3707b2['query'][_0xa73d('0x4a')]+'%'};return _0x60f48d;})});}_0x428278=_[_0xa73d('0x4b')]({},_0x428278,_0x3707b2[_0xa73d('0x4e')]);return _0xb1628c[_0xa73d('0x5a')](_0x428278);}})[_0xa73d('0x1a')](function(_0x4ea2ab){if(_0x4ea2ab){_0x11251c=_0x4ea2ab[_0xa73d('0x44')];if(!_0x3707b2['query'][_0xa73d('0x45')](_0xa73d('0x46'))){_0x428278[_0xa73d('0x29')]=qs[_0xa73d('0x29')](_0x3707b2[_0xa73d('0x3f')][_0xa73d('0x29')]);_0x428278[_0xa73d('0x27')]=qs[_0xa73d('0x27')](_0x3707b2[_0xa73d('0x3f')]['offset']);}return _0xb1628c[_0xa73d('0x5a')](_0x428278);}})[_0xa73d('0x1a')](function(_0x561de1){if(_0x561de1){return _0x561de1?{'count':_0x11251c,'rows':_0x561de1}:null;}})[_0xa73d('0x1a')](respondWithResult(_0x77f5a4,null))['catch'](handleError(_0x77f5a4,null));};exports['getSubjects']=function(_0x1bf885,_0x3cc861,_0xf4f7b){var _0x4dd971={};var _0x35a4e0={};var _0x46b4eb;var _0x1b1ac6;return db[_0xa73d('0x3a')]['findOne']({'where':{'id':_0x1bf885[_0xa73d('0x57')]['id']}})[_0xa73d('0x1a')](handleEntityNotFound(_0x3cc861,null))[_0xa73d('0x1a')](function(_0x2fc844){if(_0x2fc844){_0x46b4eb=_0x2fc844;_0x35a4e0[_0xa73d('0x3d')]=_[_0xa73d('0x3e')](db[_0xa73d('0x58')][_0xa73d('0x3b')]);_0x35a4e0[_0xa73d('0x3f')]=_[_0xa73d('0x3e')](_0x1bf885['query']);_0x35a4e0[_0xa73d('0x40')]=_[_0xa73d('0x41')](_0x35a4e0['model'],_0x35a4e0[_0xa73d('0x3f')]);_0x4dd971['attributes']=_[_0xa73d('0x41')](_0x35a4e0['model'],qs[_0xa73d('0x43')](_0x1bf885[_0xa73d('0x3f')][_0xa73d('0x43')]));_0x4dd971[_0xa73d('0x42')]=_0x4dd971[_0xa73d('0x42')][_0xa73d('0x44')]?_0x4dd971[_0xa73d('0x42')]:_0x35a4e0[_0xa73d('0x3d')];_0x4dd971[_0xa73d('0x59')]=qs[_0xa73d('0x47')](_0x1bf885['query'][_0xa73d('0x47')]);_0x4dd971[_0xa73d('0x48')]=qs['filters'](_[_0xa73d('0x49')](_0x1bf885[_0xa73d('0x3f')],_0x35a4e0[_0xa73d('0x40')]));if(_0x1bf885['query'][_0xa73d('0x4a')]){_0x4dd971['where']=_[_0xa73d('0x4b')](_0x4dd971[_0xa73d('0x48')],{'$or':_[_0xa73d('0x4c')](_0x4dd971[_0xa73d('0x42')],function(_0x567441){var _0x216b4d={};_0x216b4d[_0x567441]={'$like':'%'+_0x1bf885['query']['filter']+'%'};return _0x216b4d;})});}_0x4dd971=_['merge']({},_0x4dd971,_0x1bf885[_0xa73d('0x4e')]);return _0x46b4eb['getSubjects'](_0x4dd971);}})[_0xa73d('0x1a')](function(_0x422424){if(_0x422424){_0x1b1ac6=_0x422424['length'];if(!_0x1bf885[_0xa73d('0x3f')]['hasOwnProperty'](_0xa73d('0x46'))){_0x4dd971['limit']=qs[_0xa73d('0x29')](_0x1bf885[_0xa73d('0x3f')][_0xa73d('0x29')]);_0x4dd971[_0xa73d('0x27')]=qs[_0xa73d('0x27')](_0x1bf885['query']['offset']);}return _0x46b4eb[_0xa73d('0x5b')](_0x4dd971);}})['then'](function(_0x5e3a9e){if(_0x5e3a9e){return _0x5e3a9e?{'count':_0x1b1ac6,'rows':_0x5e3a9e}:null;}})[_0xa73d('0x1a')](respondWithResult(_0x3cc861,null))[_0xa73d('0x52')](handleError(_0x3cc861,null));};exports[_0xa73d('0x5c')]=function(_0x454e3e,_0x5e528b,_0x13c82d){var _0xf86820={};var _0x128e7c={};var _0x220df6;var _0x2f8ba3;return db[_0xa73d('0x3a')][_0xa73d('0x56')]({'where':{'id':_0x454e3e[_0xa73d('0x57')]['id']}})[_0xa73d('0x1a')](handleEntityNotFound(_0x5e528b,null))[_0xa73d('0x1a')](function(_0x274509){if(_0x274509){_0x220df6=_0x274509;_0x128e7c[_0xa73d('0x3d')]=_[_0xa73d('0x3e')](db[_0xa73d('0x58')][_0xa73d('0x3b')]);_0x128e7c[_0xa73d('0x3f')]=_[_0xa73d('0x3e')](_0x454e3e[_0xa73d('0x3f')]);_0x128e7c[_0xa73d('0x40')]=_[_0xa73d('0x41')](_0x128e7c[_0xa73d('0x3d')],_0x128e7c[_0xa73d('0x3f')]);_0xf86820[_0xa73d('0x42')]=_[_0xa73d('0x41')](_0x128e7c['model'],qs[_0xa73d('0x43')](_0x454e3e['query'][_0xa73d('0x43')]));_0xf86820[_0xa73d('0x42')]=_0xf86820['attributes'][_0xa73d('0x44')]?_0xf86820[_0xa73d('0x42')]:_0x128e7c[_0xa73d('0x3d')];_0xf86820[_0xa73d('0x59')]=qs[_0xa73d('0x47')](_0x454e3e['query'][_0xa73d('0x47')]);_0xf86820['where']=qs['filters'](_[_0xa73d('0x49')](_0x454e3e[_0xa73d('0x3f')],_0x128e7c['filters']));if(_0x454e3e['query'][_0xa73d('0x4a')]){_0xf86820['where']=_[_0xa73d('0x4b')](_0xf86820[_0xa73d('0x48')],{'$or':_['map'](_0xf86820[_0xa73d('0x42')],function(_0xcf02e6){var _0x25880f={};_0x25880f[_0xcf02e6]={'$like':'%'+_0x454e3e[_0xa73d('0x3f')][_0xa73d('0x4a')]+'%'};return _0x25880f;})});}_0xf86820=_[_0xa73d('0x4b')]({},_0xf86820,_0x454e3e[_0xa73d('0x4e')]);return _0x220df6[_0xa73d('0x5c')](_0xf86820);}})['then'](function(_0x4f02ce){if(_0x4f02ce){_0x2f8ba3=_0x4f02ce['length'];if(!_0x454e3e[_0xa73d('0x3f')][_0xa73d('0x45')](_0xa73d('0x46'))){_0xf86820[_0xa73d('0x29')]=qs[_0xa73d('0x29')](_0x454e3e[_0xa73d('0x3f')][_0xa73d('0x29')]);_0xf86820[_0xa73d('0x27')]=qs[_0xa73d('0x27')](_0x454e3e[_0xa73d('0x3f')]['offset']);}return _0x220df6[_0xa73d('0x5c')](_0xf86820);}})['then'](function(_0x4a7b71){if(_0x4a7b71){return _0x4a7b71?{'count':_0x2f8ba3,'rows':_0x4a7b71}:null;}})[_0xa73d('0x1a')](respondWithResult(_0x5e528b,null))[_0xa73d('0x52')](handleError(_0x5e528b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7ed2314..c726f0e 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x977c=['exports','define','int_salesforce_configurations','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x1f6582,_0x53a13d){var _0x56f4f0=function(_0x505b24){while(--_0x505b24){_0x1f6582['push'](_0x1f6582['shift']());}};_0x56f4f0(++_0x53a13d);}(_0x977c,0x85));var _0xc977=function(_0x1e921d,_0x40b492){_0x1e921d=_0x1e921d-0x0;var _0x216006=_0x977c[_0x1e921d];return _0x216006;};'use strict';var _=require(_0xc977('0x0'));var util=require('util');var logger=require(_0xc977('0x1'))(_0xc977('0x2'));var moment=require('moment');var BPromise=require(_0xc977('0x3'));var rp=require(_0xc977('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc977('0x5'));var attributes=require(_0xc977('0x6'));module[_0xc977('0x7')]=function(_0x1f4378,_0x4da457){return _0x1f4378[_0xc977('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0xc977('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7827=['request-promise','path','rimraf','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x467352,_0x5b84bd){var _0x2947c6=function(_0x24ea20){while(--_0x24ea20){_0x467352['push'](_0x467352['shift']());}};_0x2947c6(++_0x5b84bd);}(_0x7827,0xe1));var _0x7782=function(_0x4d1be0,_0x135738){_0x4d1be0=_0x4d1be0-0x0;var _0x47d662=_0x7827[_0x4d1be0];return _0x47d662;};'use strict';var _=require(_0x7782('0x0'));var util=require(_0x7782('0x1'));var logger=require(_0x7782('0x2'))(_0x7782('0x3'));var moment=require(_0x7782('0x4'));var BPromise=require(_0x7782('0x5'));var rp=require(_0x7782('0x6'));var fs=require('fs');var path=require(_0x7782('0x7'));var rimraf=require(_0x7782('0x8'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x86648d,_0x3aac5a){return _0x86648d[_0x7782('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x7782('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 48b5237..68e300b 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe7b2=['info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x369180,_0x21bfd6){var _0x3f9897=function(_0xc7435d){while(--_0xc7435d){_0x369180['push'](_0x369180['shift']());}};_0x3f9897(++_0x21bfd6);}(_0xe7b2,0x1ed));var _0x2e7b=function(_0x354c14,_0x2dc124){_0x354c14=_0x354c14-0x0;var _0x31476d=_0xe7b2[_0x354c14];return _0x31476d;};'use strict';var _=require('lodash');var util=require(_0x2e7b('0x0'));var moment=require(_0x2e7b('0x1'));var BPromise=require(_0x2e7b('0x2'));var rs=require(_0x2e7b('0x3'));var fs=require('fs');var Redis=require(_0x2e7b('0x4'));var db=require(_0x2e7b('0x5'))['db'];var utils=require(_0x2e7b('0x6'));var logger=require(_0x2e7b('0x7'))(_0x2e7b('0x8'));var config=require(_0x2e7b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2e7b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190f78,_0x2c0cd1,_0x28b225){return new BPromise(function(_0x3f852b,_0xc16165){return client[_0x2e7b('0xb')](_0x190f78,_0x28b225)[_0x2e7b('0xc')](function(_0x32087f){logger[_0x2e7b('0xd')](_0x2e7b('0xe'),_0x2c0cd1,_0x2e7b('0xf'));logger[_0x2e7b('0x10')](_0x2e7b('0x11'),_0x2c0cd1,_0x2e7b('0xf'),JSON[_0x2e7b('0x12')](_0x32087f));if(_0x32087f[_0x2e7b('0x13')]){if(_0x32087f[_0x2e7b('0x13')]['code']===0x1f4){logger[_0x2e7b('0x13')](_0x2e7b('0xe'),_0x2c0cd1,_0x32087f[_0x2e7b('0x13')][_0x2e7b('0x14')]);return _0xc16165(_0x32087f['error'][_0x2e7b('0x14')]);}logger[_0x2e7b('0x13')](_0x2e7b('0xe'),_0x2c0cd1,_0x32087f[_0x2e7b('0x13')]['message']);return _0x3f852b(_0x32087f[_0x2e7b('0x13')]['message']);}else{logger[_0x2e7b('0xd')](_0x2e7b('0xe'),_0x2c0cd1,_0x2e7b('0xf'));_0x3f852b(_0x32087f[_0x2e7b('0x15')][_0x2e7b('0x14')]);}})['catch'](function(_0x434cb8){logger[_0x2e7b('0x13')](_0x2e7b('0xe'),_0x2c0cd1,_0x434cb8);_0xc16165(_0x434cb8);});});} \ No newline at end of file +var _0xecae=['request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xecae,0x138));var _0xeeca=function(_0xab8d49,_0x46ed0a){_0xab8d49=_0xab8d49-0x0;var _0x2fbaa8=_0xecae[_0xab8d49];return _0x2fbaa8;};'use strict';var _=require('lodash');var util=require(_0xeeca('0x0'));var moment=require(_0xeeca('0x1'));var BPromise=require(_0xeeca('0x2'));var rs=require(_0xeeca('0x3'));var fs=require('fs');var Redis=require(_0xeeca('0x4'));var db=require(_0xeeca('0x5'))['db'];var utils=require(_0xeeca('0x6'));var logger=require(_0xeeca('0x7'))(_0xeeca('0x8'));var config=require(_0xeeca('0x9'));var jayson=require(_0xeeca('0xa'));var client=jayson[_0xeeca('0xb')][_0xeeca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1784a1,_0x1265e1,_0x534c3f){return new BPromise(function(_0x325b9a,_0x403be6){return client[_0xeeca('0xd')](_0x1784a1,_0x534c3f)[_0xeeca('0xe')](function(_0x4ad0ea){logger['info'](_0xeeca('0xf'),_0x1265e1,_0xeeca('0x10'));logger[_0xeeca('0x11')](_0xeeca('0x12'),_0x1265e1,_0xeeca('0x10'),JSON['stringify'](_0x4ad0ea));if(_0x4ad0ea[_0xeeca('0x13')]){if(_0x4ad0ea[_0xeeca('0x13')][_0xeeca('0x14')]===0x1f4){logger[_0xeeca('0x13')](_0xeeca('0xf'),_0x1265e1,_0x4ad0ea[_0xeeca('0x13')]['message']);return _0x403be6(_0x4ad0ea[_0xeeca('0x13')]['message']);}logger[_0xeeca('0x13')](_0xeeca('0xf'),_0x1265e1,_0x4ad0ea[_0xeeca('0x13')][_0xeeca('0x15')]);return _0x325b9a(_0x4ad0ea[_0xeeca('0x13')]['message']);}else{logger[_0xeeca('0x16')](_0xeeca('0xf'),_0x1265e1,'request\x20sent');_0x325b9a(_0x4ad0ea[_0xeeca('0x17')][_0xeeca('0x15')]);}})[_0xeeca('0x18')](function(_0x5b0a5b){logger[_0xeeca('0x13')](_0xeeca('0xf'),_0x1265e1,_0x5b0a5b);_0x403be6(_0x5b0a5b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3ce0b2f..fede24c 100644 --- a/server/api/intSalesforceField/index.js +++ b/server/api/intSalesforceField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17a7=['express','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','post','create','update','destroy','exports','connect-timeout'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x17a7,0xc2));var _0x717a=function(_0xad5656,_0x57638d){_0xad5656=_0xad5656-0x0;var _0x37a359=_0x17a7[_0xad5656];return _0x37a359;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x717a('0x0'));var express=require(_0x717a('0x1'));var router=express[_0x717a('0x2')]();var fs_extra=require(_0x717a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x717a('0x4'));var config=require('../../config/environment');var controller=require(_0x717a('0x5'));router[_0x717a('0x6')]('/',auth['isAuthenticated'](),controller[_0x717a('0x7')]);router[_0x717a('0x6')](_0x717a('0x8'),auth[_0x717a('0x9')](),controller['show']);router[_0x717a('0xa')]('/',auth['isAuthenticated'](),controller[_0x717a('0xb')]);router['put'](_0x717a('0x8'),auth[_0x717a('0x9')](),controller[_0x717a('0xc')]);router['delete']('/:id',auth[_0x717a('0x9')](),controller[_0x717a('0xd')]);module[_0x717a('0xe')]=router; \ No newline at end of file +var _0x8383=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x40dd64,_0x2e2b7b){var _0x3ddb8=function(_0x58c1bb){while(--_0x58c1bb){_0x40dd64['push'](_0x40dd64['shift']());}};_0x3ddb8(++_0x2e2b7b);}(_0x8383,0x98));var _0x3838=function(_0x46bdd9,_0x16eebf){_0x46bdd9=_0x46bdd9-0x0;var _0x471cc2=_0x8383[_0x46bdd9];return _0x471cc2;};'use strict';var multer=require(_0x3838('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3838('0x1'));var express=require(_0x3838('0x2'));var router=express[_0x3838('0x3')]();var fs_extra=require(_0x3838('0x4'));var auth=require(_0x3838('0x5'));var interaction=require(_0x3838('0x6'));var config=require(_0x3838('0x7'));var controller=require(_0x3838('0x8'));router[_0x3838('0x9')]('/',auth[_0x3838('0xa')](),controller['index']);router[_0x3838('0x9')](_0x3838('0xb'),auth['isAuthenticated'](),controller[_0x3838('0xc')]);router['post']('/',auth[_0x3838('0xa')](),controller[_0x3838('0xd')]);router[_0x3838('0xe')]('/:id',auth[_0x3838('0xa')](),controller[_0x3838('0xf')]);router[_0x3838('0x10')]('/:id',auth[_0x3838('0xa')](),controller[_0x3838('0x11')]);module[_0x3838('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b4e303b..56da03f 100644 --- a/server/api/intSalesforceField/intSalesforceField.attributes.js +++ b/server/api/intSalesforceField/intSalesforceField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['variable','customVariable','keyValue','picklist','STRING','ENUM','string'];(function(_0x2d92bd,_0x416726){var _0x51a00f=function(_0x12f323){while(--_0x12f323){_0x2d92bd['push'](_0x2d92bd['shift']());}};_0x51a00f(++_0x416726);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x49c4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'))},'keyContent':{'type':Sequelize[_0x49c4('0x6')]},'idField':{'type':Sequelize[_0x49c4('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb91=['string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x2a082f,_0x584f75){var _0x15d2f6=function(_0x38fe85){while(--_0x38fe85){_0x2a082f['push'](_0x2a082f['shift']());}};_0x15d2f6(++_0x584f75);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0xcb91[_0x3ec122];return _0x4ecf41;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue',_0x1cb9('0x4')),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1cb9('0x5')]},'keyType':{'type':Sequelize[_0x1cb9('0x0')]('string',_0x1cb9('0x2'),_0x1cb9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb9('0x5')]},'variableName':{'type':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f991a98..0e123dd 100644 --- a/server/api/intSalesforceField/intSalesforceField.controller.js +++ b/server/api/intSalesforceField/intSalesforceField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17bf=['merge','body','contact','message','agent','interaction','account','index','map','SalesforceField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0xee1d95,_0x1eb0a9){var _0x141d5d=function(_0x47b07c){while(--_0x47b07c){_0xee1d95['push'](_0xee1d95['shift']());}};_0x141d5d(++_0x1eb0a9);}(_0x17bf,0x71));var _0xf17b=function(_0x447a65,_0x130db1){_0x447a65=_0x447a65-0x0;var _0x2336f1=_0x17bf[_0x447a65];return _0x2336f1;};'use strict';var emlformat=require(_0xf17b('0x0'));var rimraf=require(_0xf17b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf17b('0x2'));var rp=require(_0xf17b('0x3'));var moment=require(_0xf17b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf17b('0x5'));var util=require('util');var path=require(_0xf17b('0x6'));var sox=require(_0xf17b('0x7'));var csv=require(_0xf17b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf17b('0x9'));var _=require(_0xf17b('0xa'));var squel=require(_0xf17b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf17b('0xc'));var Papa=require(_0xf17b('0xd'));var Redis=require(_0xf17b('0xe'));var authService=require(_0xf17b('0xf'));var qs=require(_0xf17b('0x10'));var as=require(_0xf17b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf17b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf17b('0x13'));var licenseUtil=require(_0xf17b('0x14'));var db=require(_0xf17b('0x15'))['db'];function respondWithStatusCode(_0x442cf1,_0x2e23c6){_0x2e23c6=_0x2e23c6||0xcc;return function(_0x57415a){if(_0x57415a){return _0x442cf1[_0xf17b('0x16')](_0x2e23c6);}return _0x442cf1[_0xf17b('0x17')](_0x2e23c6)['end']();};}function respondWithResult(_0x3ba628,_0x2282b3){_0x2282b3=_0x2282b3||0xc8;return function(_0x1efe61){if(_0x1efe61){return _0x3ba628[_0xf17b('0x17')](_0x2282b3)[_0xf17b('0x18')](_0x1efe61);}};}function respondWithFilteredResult(_0x2973d5,_0x27c8ae){return function(_0x3461bd){if(_0x3461bd){var _0x57f8b7=typeof _0x27c8ae[_0xf17b('0x19')]==='undefined'&&typeof _0x27c8ae[_0xf17b('0x1a')]==='undefined';var _0x4e1629=_0x3461bd[_0xf17b('0x1b')];var _0x5627a1=_0x57f8b7?0x0:_0x27c8ae[_0xf17b('0x19')];var _0x1f6d9d=_0x57f8b7?_0x3461bd[_0xf17b('0x1b')]:_0x27c8ae[_0xf17b('0x19')]+_0x27c8ae[_0xf17b('0x1a')];var _0x7450fe;if(_0x1f6d9d>=_0x4e1629){_0x1f6d9d=_0x4e1629;_0x7450fe=0xc8;}else{_0x7450fe=0xce;}_0x2973d5['status'](_0x7450fe);return _0x2973d5[_0xf17b('0x1c')](_0xf17b('0x1d'),_0x5627a1+'-'+_0x1f6d9d+'/'+_0x4e1629)['json'](_0x3461bd);}return null;};}function patchUpdates(_0x60dad7){return function(_0x3c6c7a){try{jsonpatch[_0xf17b('0x1e')](_0x3c6c7a,_0x60dad7,!![]);}catch(_0x4b14e9){return BPromise[_0xf17b('0x1f')](_0x4b14e9);}return _0x3c6c7a[_0xf17b('0x20')]();};}function saveUpdates(_0x5e613d,_0x34d065){return function(_0x349fa7){if(_0x349fa7){return _0x349fa7[_0xf17b('0x21')](_0x5e613d)[_0xf17b('0x22')](function(_0x5259c1){return _0x5259c1;});}return null;};}function removeEntity(_0x4caa00,_0x2e90f7){return function(_0x4949b1){if(_0x4949b1){return _0x4949b1[_0xf17b('0x23')]()[_0xf17b('0x22')](function(){_0x4caa00[_0xf17b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fc057,_0x4a0fed){return function(_0x51d879){if(!_0x51d879){_0x4fc057[_0xf17b('0x16')](0x194);}return _0x51d879;};}function handleError(_0x21cfe0,_0x5052dd){_0x5052dd=_0x5052dd||0x1f4;return function(_0x854f85){logger[_0xf17b('0x24')](_0x854f85['stack']);if(_0x854f85[_0xf17b('0x25')]){delete _0x854f85['name'];}_0x21cfe0[_0xf17b('0x17')](_0x5052dd)[_0xf17b('0x26')](_0x854f85);};}function getMustacheRender(_0x151ca4,_0x2913cc){return Mustache['render'](_0x151ca4,_[_0xf17b('0x27')](_0x2913cc[_0xf17b('0x28')],{'contact':_0x2913cc[_0xf17b('0x29')],'message':_0x2913cc[_0xf17b('0x2a')],'agent':_0x2913cc[_0xf17b('0x2b')],'interaction':_0x2913cc[_0xf17b('0x2c')],'account':_0x2913cc[_0xf17b('0x2d')]}))||'';}exports[_0xf17b('0x2e')]=function(_0x100617,_0x570512){var _0x2a3062={},_0x14737a={},_0x437cae={'count':0x0,'rows':[]};var _0x26b91a=_[_0xf17b('0x2f')](db[_0xf17b('0x30')][_0xf17b('0x31')],function(_0x4afcde){return{'name':_0x4afcde[_0xf17b('0x32')],'type':_0x4afcde['type']['key']};});_0x14737a[_0xf17b('0x33')]=_[_0xf17b('0x2f')](_0x26b91a,_0xf17b('0x25'));_0x14737a[_0xf17b('0x34')]=_[_0xf17b('0x35')](_0x100617['query']);_0x14737a[_0xf17b('0x36')]=_[_0xf17b('0x37')](_0x14737a['model'],_0x14737a[_0xf17b('0x34')]);_0x2a3062['attributes']=_[_0xf17b('0x37')](_0x14737a[_0xf17b('0x33')],qs[_0xf17b('0x38')](_0x100617[_0xf17b('0x34')][_0xf17b('0x38')]));_0x2a3062[_0xf17b('0x39')]=_0x2a3062[_0xf17b('0x39')][_0xf17b('0x3a')]?_0x2a3062['attributes']:_0x14737a[_0xf17b('0x33')];if(!_0x100617['query'][_0xf17b('0x3b')]('nolimit')){_0x2a3062['limit']=qs['limit'](_0x100617[_0xf17b('0x34')][_0xf17b('0x1a')]);_0x2a3062[_0xf17b('0x19')]=qs['offset'](_0x100617[_0xf17b('0x34')][_0xf17b('0x19')]);}_0x2a3062[_0xf17b('0x3c')]=qs['sort'](_0x100617[_0xf17b('0x34')][_0xf17b('0x3d')]);_0x2a3062[_0xf17b('0x3e')]=qs['filters'](_[_0xf17b('0x3f')](_0x100617[_0xf17b('0x34')],_0x14737a['filters']),_0x26b91a);if(_0x100617['query'][_0xf17b('0x40')]){_0x2a3062[_0xf17b('0x3e')]=_['merge'](_0x2a3062[_0xf17b('0x3e')],{'$or':_[_0xf17b('0x2f')](_0x26b91a,function(_0x3081df){if(_0x3081df['type']!==_0xf17b('0x41')){var _0x38f99c={};_0x38f99c[_0x3081df[_0xf17b('0x25')]]={'$like':'%'+_0x100617[_0xf17b('0x34')][_0xf17b('0x40')]+'%'};return _0x38f99c;}})});}_0x2a3062=_[_0xf17b('0x27')]({},_0x2a3062,_0x100617[_0xf17b('0x42')]);var _0x1d26ca={'where':_0x2a3062[_0xf17b('0x3e')]};return db['SalesforceField'][_0xf17b('0x1b')](_0x1d26ca)[_0xf17b('0x22')](function(_0x99d602){_0x437cae['count']=_0x99d602;if(_0x100617[_0xf17b('0x34')]['includeAll']){_0x2a3062[_0xf17b('0x43')]=[{'all':!![]}];}return db[_0xf17b('0x30')][_0xf17b('0x44')](_0x2a3062);})[_0xf17b('0x22')](function(_0x39c1fe){_0x437cae[_0xf17b('0x45')]=_0x39c1fe;return _0x437cae;})[_0xf17b('0x22')](respondWithFilteredResult(_0x570512,_0x2a3062))[_0xf17b('0x46')](handleError(_0x570512,null));};exports[_0xf17b('0x47')]=function(_0xafb341,_0xbf1775){var _0x48f145={'raw':!![],'where':{'id':_0xafb341[_0xf17b('0x48')]['id']}},_0x479646={};_0x479646[_0xf17b('0x33')]=_[_0xf17b('0x35')](db[_0xf17b('0x30')]['rawAttributes']);_0x479646[_0xf17b('0x34')]=_[_0xf17b('0x35')](_0xafb341['query']);_0x479646['filters']=_[_0xf17b('0x37')](_0x479646[_0xf17b('0x33')],_0x479646[_0xf17b('0x34')]);_0x48f145[_0xf17b('0x39')]=_[_0xf17b('0x37')](_0x479646[_0xf17b('0x33')],qs['fields'](_0xafb341[_0xf17b('0x34')][_0xf17b('0x38')]));_0x48f145[_0xf17b('0x39')]=_0x48f145[_0xf17b('0x39')]['length']?_0x48f145[_0xf17b('0x39')]:_0x479646[_0xf17b('0x33')];if(_0xafb341['query'][_0xf17b('0x49')]){_0x48f145[_0xf17b('0x43')]=[{'all':!![]}];}_0x48f145=_['merge']({},_0x48f145,_0xafb341[_0xf17b('0x42')]);return db[_0xf17b('0x30')][_0xf17b('0x4a')](_0x48f145)[_0xf17b('0x22')](handleEntityNotFound(_0xbf1775,null))['then'](respondWithResult(_0xbf1775,null))[_0xf17b('0x46')](handleError(_0xbf1775,null));};exports[_0xf17b('0x4b')]=function(_0x1a428a,_0x40b653){return db[_0xf17b('0x30')][_0xf17b('0x4b')](_0x1a428a['body'],{})[_0xf17b('0x22')](respondWithResult(_0x40b653,0xc9))[_0xf17b('0x46')](handleError(_0x40b653,null));};exports[_0xf17b('0x21')]=function(_0x1b1204,_0x5e83c3){if(_0x1b1204[_0xf17b('0x28')]['id']){delete _0x1b1204[_0xf17b('0x28')]['id'];}return db[_0xf17b('0x30')][_0xf17b('0x4a')]({'where':{'id':_0x1b1204['params']['id']}})['then'](handleEntityNotFound(_0x5e83c3,null))[_0xf17b('0x22')](saveUpdates(_0x1b1204[_0xf17b('0x28')],null))[_0xf17b('0x22')](respondWithResult(_0x5e83c3,null))['catch'](handleError(_0x5e83c3,null));};exports[_0xf17b('0x23')]=function(_0x1c92ba,_0x33041c){return db[_0xf17b('0x30')]['find']({'where':{'id':_0x1c92ba[_0xf17b('0x48')]['id']}})['then'](handleEntityNotFound(_0x33041c,null))[_0xf17b('0x22')](removeEntity(_0x33041c,null))[_0xf17b('0x46')](handleError(_0x33041c,null));}; \ No newline at end of file +var _0xfdee=['include','find','create','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','update','destroy','then','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','SalesforceField','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','rows','catch','show','params','keys','rawAttributes'];(function(_0x58319a,_0x145060){var _0x4cf654=function(_0x314238){while(--_0x314238){_0x58319a['push'](_0x58319a['shift']());}};_0x4cf654(++_0x145060);}(_0xfdee,0x193));var _0xefde=function(_0x5721c4,_0x2ffbd4){_0x5721c4=_0x5721c4-0x0;var _0x597a5f=_0xfdee[_0x5721c4];return _0x597a5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefde('0x0'));var zipdir=require(_0xefde('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefde('0x2'));var moment=require(_0xefde('0x3'));var BPromise=require(_0xefde('0x4'));var Mustache=require(_0xefde('0x5'));var util=require(_0xefde('0x6'));var path=require('path');var sox=require(_0xefde('0x7'));var csv=require('to-csv');var ejs=require(_0xefde('0x8'));var fs=require('fs');var fs_extra=require(_0xefde('0x9'));var _=require(_0xefde('0xa'));var squel=require(_0xefde('0xb'));var crypto=require(_0xefde('0xc'));var jsforce=require(_0xefde('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xefde('0xe'));var Papa=require('papaparse');var Redis=require(_0xefde('0xf'));var authService=require(_0xefde('0x10'));var qs=require(_0xefde('0x11'));var as=require(_0xefde('0x12'));var hardwareService=require(_0xefde('0x13'));var logger=require(_0xefde('0x14'))('api');var utils=require(_0xefde('0x15'));var config=require(_0xefde('0x16'));var licenseUtil=require(_0xefde('0x17'));var db=require(_0xefde('0x18'))['db'];function respondWithStatusCode(_0x5644b1,_0x4ccda5){_0x4ccda5=_0x4ccda5||0xcc;return function(_0x5d56ad){if(_0x5d56ad){return _0x5644b1[_0xefde('0x19')](_0x4ccda5);}return _0x5644b1[_0xefde('0x1a')](_0x4ccda5)[_0xefde('0x1b')]();};}function respondWithResult(_0x2895a7,_0x3ffe4f){_0x3ffe4f=_0x3ffe4f||0xc8;return function(_0x3bed16){if(_0x3bed16){return _0x2895a7[_0xefde('0x1a')](_0x3ffe4f)[_0xefde('0x1c')](_0x3bed16);}};}function respondWithFilteredResult(_0x2f0d5c,_0x55a1db){return function(_0x400609){if(_0x400609){var _0x258281=typeof _0x55a1db[_0xefde('0x1d')]===_0xefde('0x1e')&&typeof _0x55a1db['limit']===_0xefde('0x1e');var _0x402eca=_0x400609[_0xefde('0x1f')];var _0xe77be8=_0x258281?0x0:_0x55a1db[_0xefde('0x1d')];var _0x5e8b2d=_0x258281?_0x400609['count']:_0x55a1db[_0xefde('0x1d')]+_0x55a1db[_0xefde('0x20')];var _0x502c16;if(_0x5e8b2d>=_0x402eca){_0x5e8b2d=_0x402eca;_0x502c16=0xc8;}else{_0x502c16=0xce;}_0x2f0d5c[_0xefde('0x1a')](_0x502c16);return _0x2f0d5c['set'](_0xefde('0x21'),_0xe77be8+'-'+_0x5e8b2d+'/'+_0x402eca)[_0xefde('0x1c')](_0x400609);}return null;};}function patchUpdates(_0x4868b4){return function(_0x32afb1){try{jsonpatch['apply'](_0x32afb1,_0x4868b4,!![]);}catch(_0x5cc3f8){return BPromise['reject'](_0x5cc3f8);}return _0x32afb1[_0xefde('0x22')]();};}function saveUpdates(_0x3fd86e,_0x2d49a8){return function(_0x1a28ba){if(_0x1a28ba){return _0x1a28ba[_0xefde('0x23')](_0x3fd86e)['then'](function(_0x33fb1b){return _0x33fb1b;});}return null;};}function removeEntity(_0x37fc0e,_0x7a6db6){return function(_0x390bd5){if(_0x390bd5){return _0x390bd5[_0xefde('0x24')]()[_0xefde('0x25')](function(){_0x37fc0e[_0xefde('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6dff,_0x5bac9d){return function(_0xd69771){if(!_0xd69771){_0x5b6dff[_0xefde('0x19')](0x194);}return _0xd69771;};}function handleError(_0xe1a4d2,_0x1a118e){_0x1a118e=_0x1a118e||0x1f4;return function(_0x479e68){logger[_0xefde('0x26')](_0x479e68[_0xefde('0x27')]);if(_0x479e68[_0xefde('0x28')]){delete _0x479e68[_0xefde('0x28')];}_0xe1a4d2[_0xefde('0x1a')](_0x1a118e)[_0xefde('0x29')](_0x479e68);};}function getMustacheRender(_0x3075c2,_0x41c189){return Mustache[_0xefde('0x2a')](_0x3075c2,_[_0xefde('0x2b')](_0x41c189[_0xefde('0x2c')],{'contact':_0x41c189[_0xefde('0x2d')],'message':_0x41c189[_0xefde('0x2e')],'agent':_0x41c189[_0xefde('0x2f')],'interaction':_0x41c189[_0xefde('0x30')],'account':_0x41c189[_0xefde('0x31')]}))||'';}exports[_0xefde('0x32')]=function(_0x4674eb,_0x47ba7d){var _0x594c0c={},_0x2487f0={},_0xec1f7b={'count':0x0,'rows':[]};var _0x215eed=_[_0xefde('0x33')](db[_0xefde('0x34')]['rawAttributes'],function(_0x4bafb5){return{'name':_0x4bafb5[_0xefde('0x35')],'type':_0x4bafb5[_0xefde('0x36')]['key']};});_0x2487f0[_0xefde('0x37')]=_[_0xefde('0x33')](_0x215eed,'name');_0x2487f0[_0xefde('0x38')]=_['keys'](_0x4674eb[_0xefde('0x38')]);_0x2487f0[_0xefde('0x39')]=_['intersection'](_0x2487f0[_0xefde('0x37')],_0x2487f0[_0xefde('0x38')]);_0x594c0c[_0xefde('0x3a')]=_[_0xefde('0x3b')](_0x2487f0[_0xefde('0x37')],qs['fields'](_0x4674eb[_0xefde('0x38')][_0xefde('0x3c')]));_0x594c0c[_0xefde('0x3a')]=_0x594c0c[_0xefde('0x3a')][_0xefde('0x3d')]?_0x594c0c[_0xefde('0x3a')]:_0x2487f0[_0xefde('0x37')];if(!_0x4674eb[_0xefde('0x38')]['hasOwnProperty'](_0xefde('0x3e'))){_0x594c0c[_0xefde('0x20')]=qs[_0xefde('0x20')](_0x4674eb[_0xefde('0x38')]['limit']);_0x594c0c[_0xefde('0x1d')]=qs['offset'](_0x4674eb[_0xefde('0x38')][_0xefde('0x1d')]);}_0x594c0c[_0xefde('0x3f')]=qs['sort'](_0x4674eb[_0xefde('0x38')][_0xefde('0x40')]);_0x594c0c['where']=qs[_0xefde('0x39')](_[_0xefde('0x41')](_0x4674eb[_0xefde('0x38')],_0x2487f0[_0xefde('0x39')]),_0x215eed);if(_0x4674eb[_0xefde('0x38')][_0xefde('0x42')]){_0x594c0c['where']=_[_0xefde('0x2b')](_0x594c0c[_0xefde('0x43')],{'$or':_[_0xefde('0x33')](_0x215eed,function(_0x2d9be7){if(_0x2d9be7['type']!==_0xefde('0x44')){var _0x43226f={};_0x43226f[_0x2d9be7[_0xefde('0x28')]]={'$like':'%'+_0x4674eb['query'][_0xefde('0x42')]+'%'};return _0x43226f;}})});}_0x594c0c=_[_0xefde('0x2b')]({},_0x594c0c,_0x4674eb[_0xefde('0x45')]);var _0x42dd84={'where':_0x594c0c[_0xefde('0x43')]};return db[_0xefde('0x34')]['count'](_0x42dd84)[_0xefde('0x25')](function(_0x52356c){_0xec1f7b[_0xefde('0x1f')]=_0x52356c;if(_0x4674eb[_0xefde('0x38')][_0xefde('0x46')]){_0x594c0c['include']=[{'all':!![]}];}return db[_0xefde('0x34')]['findAll'](_0x594c0c);})[_0xefde('0x25')](function(_0x265b8c){_0xec1f7b[_0xefde('0x47')]=_0x265b8c;return _0xec1f7b;})[_0xefde('0x25')](respondWithFilteredResult(_0x47ba7d,_0x594c0c))[_0xefde('0x48')](handleError(_0x47ba7d,null));};exports[_0xefde('0x49')]=function(_0x999011,_0x2a0c48){var _0x121f6d={'raw':!![],'where':{'id':_0x999011[_0xefde('0x4a')]['id']}},_0x19edfb={};_0x19edfb['model']=_[_0xefde('0x4b')](db[_0xefde('0x34')][_0xefde('0x4c')]);_0x19edfb[_0xefde('0x38')]=_[_0xefde('0x4b')](_0x999011[_0xefde('0x38')]);_0x19edfb[_0xefde('0x39')]=_[_0xefde('0x3b')](_0x19edfb['model'],_0x19edfb[_0xefde('0x38')]);_0x121f6d[_0xefde('0x3a')]=_[_0xefde('0x3b')](_0x19edfb['model'],qs[_0xefde('0x3c')](_0x999011['query'][_0xefde('0x3c')]));_0x121f6d['attributes']=_0x121f6d[_0xefde('0x3a')][_0xefde('0x3d')]?_0x121f6d[_0xefde('0x3a')]:_0x19edfb[_0xefde('0x37')];if(_0x999011[_0xefde('0x38')][_0xefde('0x46')]){_0x121f6d[_0xefde('0x4d')]=[{'all':!![]}];}_0x121f6d=_[_0xefde('0x2b')]({},_0x121f6d,_0x999011['options']);return db[_0xefde('0x34')][_0xefde('0x4e')](_0x121f6d)[_0xefde('0x25')](handleEntityNotFound(_0x2a0c48,null))[_0xefde('0x25')](respondWithResult(_0x2a0c48,null))['catch'](handleError(_0x2a0c48,null));};exports[_0xefde('0x4f')]=function(_0xc931f1,_0x2745d6){return db[_0xefde('0x34')]['create'](_0xc931f1[_0xefde('0x2c')],{})[_0xefde('0x25')](respondWithResult(_0x2745d6,0xc9))['catch'](handleError(_0x2745d6,null));};exports['update']=function(_0x11c114,_0x595906){if(_0x11c114['body']['id']){delete _0x11c114[_0xefde('0x2c')]['id'];}return db['SalesforceField'][_0xefde('0x4e')]({'where':{'id':_0x11c114['params']['id']}})[_0xefde('0x25')](handleEntityNotFound(_0x595906,null))[_0xefde('0x25')](saveUpdates(_0x11c114[_0xefde('0x2c')],null))[_0xefde('0x25')](respondWithResult(_0x595906,null))[_0xefde('0x48')](handleError(_0x595906,null));};exports['destroy']=function(_0x7dbd87,_0x327f32){return db[_0xefde('0x34')][_0xefde('0x4e')]({'where':{'id':_0x7dbd87['params']['id']}})[_0xefde('0x25')](handleEntityNotFound(_0x327f32,null))[_0xefde('0x25')](removeEntity(_0x327f32,null))['catch'](handleError(_0x327f32,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b745de0..1c18598 100644 --- a/server/api/intSalesforceField/intSalesforceField.model.js +++ b/server/api/intSalesforceField/intSalesforceField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e84=['./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3e84,0xd4));var _0x43e8=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0x3e84[_0x4b3d13];return _0xf64dd8;};'use strict';var _=require('lodash');var util=require(_0x43e8('0x0'));var logger=require(_0x43e8('0x1'))(_0x43e8('0x2'));var moment=require(_0x43e8('0x3'));var BPromise=require(_0x43e8('0x4'));var rp=require(_0x43e8('0x5'));var fs=require('fs');var path=require(_0x43e8('0x6'));var rimraf=require(_0x43e8('0x7'));var config=require(_0x43e8('0x8'));var attributes=require(_0x43e8('0x9'));module['exports']=function(_0x53fc95,_0x20463e){return _0x53fc95['define'](_0x43e8('0xa'),attributes,{'tableName':_0x43e8('0xb'),'paranoid':![],'indexes':[{'name':_0x43e8('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a72=['rimraf','./intSalesforceField.attributes','int_salesforce_fields','idField','FieldId','util','../../config/logger','moment','request-promise'];(function(_0x900a8d,_0x1f009a){var _0x5b80fc=function(_0x19e19e){while(--_0x19e19e){_0x900a8d['push'](_0x900a8d['shift']());}};_0x5b80fc(++_0x1f009a);}(_0x7a72,0x1be));var _0x27a7=function(_0x3e24c7,_0x407bd2){_0x3e24c7=_0x3e24c7-0x0;var _0x18eb39=_0x7a72[_0x3e24c7];return _0x18eb39;};'use strict';var _=require('lodash');var util=require(_0x27a7('0x0'));var logger=require(_0x27a7('0x1'))('api');var moment=require(_0x27a7('0x2'));var BPromise=require('bluebird');var rp=require(_0x27a7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27a7('0x4'));var config=require('../../config/environment');var attributes=require(_0x27a7('0x5'));module['exports']=function(_0x320fad,_0x372bb8){return _0x320fad['define']('SalesforceField',attributes,{'tableName':_0x27a7('0x6'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x27a7('0x7'),_0x27a7('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b734a6c..d10380d 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x38fa3d,_0x3ff44a){var _0x284fdb=function(_0x4dae43){while(--_0x4dae43){_0x38fa3d['push'](_0x38fa3d['shift']());}};_0x284fdb(++_0x3ff44a);}(_0xe706,0xa3));var _0x6e70=function(_0x5f2fea,_0x9fde07){_0x5f2fea=_0x5f2fea-0x0;var _0x198a0c=_0xe706[_0x5f2fea];return _0x198a0c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('SalesforceField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xa571=['request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xa571,0x107));var _0x1a57=function(_0x41afbf,_0x31a015){_0x41afbf=_0x41afbf-0x0;var _0x3d5476=_0xa571[_0x41afbf];return _0x3d5476;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 10caa7d..b643f7c 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0598=['delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','put','update'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x0598,0x92));var _0x8059=function(_0x47af81,_0x21a81e){_0x47af81=_0x47af81-0x0;var _0xd796c7=_0x0598[_0x47af81];return _0xd796c7;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8059('0x9')]);router[_0x8059('0x5')](_0x8059('0xa'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8059('0xc')]);router[_0x8059('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x8059('0xe')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xf')]);router[_0x8059('0x10')]('/:id',auth[_0x8059('0x6')](),controller['destroy']);module[_0x8059('0x11')]=router; \ No newline at end of file +var _0x36ee=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x1b5e83,_0x58b230){var _0x58ef80=function(_0x5894df){while(--_0x5894df){_0x1b5e83['push'](_0x1b5e83['shift']());}};_0x58ef80(++_0x58b230);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x11')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x11')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x13')]);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router[_0xe36e('0x15')]('/:id',auth[_0xe36e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 5df502b..47af13b 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ac8=['STRING','username','exports'];(function(_0x4904af,_0x4418bc){var _0x2a2f45=function(_0x282c43){while(--_0x282c43){_0x4904af['push'](_0x4904af['shift']());}};_0x2a2f45(++_0x4418bc);}(_0x0ac8,0x1c1));var _0x80ac=function(_0x32b5b1,_0x1da9ad){_0x32b5b1=_0x32b5b1-0x0;var _0x1fcc4c=_0x0ac8[_0x32b5b1];return _0x1fcc4c;};'use strict';var Sequelize=require('sequelize');module[_0x80ac('0x0')]={'name':{'type':Sequelize[_0x80ac('0x1')]},'description':{'type':Sequelize[_0x80ac('0x1')]},'username':{'type':Sequelize[_0x80ac('0x1')],'unique':_0x80ac('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x80ac('0x1')]},'remoteUri':{'type':Sequelize[_0x80ac('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x80ac('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x891b=['STRING','username','remoteUri','sequelize','exports'];(function(_0x41db83,_0x1153c7){var _0x465005=function(_0x16a50c){while(--_0x16a50c){_0x41db83['push'](_0x41db83['shift']());}};_0x465005(++_0x1153c7);}(_0x891b,0xf3));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb891('0x0'));module[_0xb891('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb891('0x2')],'unique':_0xb891('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb891('0x2')]},'remoteUri':{'type':Sequelize[_0xb891('0x2')],'unique':_0xb891('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a817475..faf2e7e 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fac=['addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','resolved_by','opened_by','sys_created_on','sys_domain','state','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','log','includes','forEach','internalType','label','all','assign','TCL:\x20_object','remove','push','statusCode','test','Wrong\x20credentials','true','False','false','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','render','merge','contact','agent','interaction','account','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','getConfigurations','ServicenowConfiguration'];(function(_0x2c603c,_0x5e12ae){var _0x2bdff3=function(_0x2766e3){while(--_0x2766e3){_0x2c603c['push'](_0x2c603c['shift']());}};_0x2bdff3(++_0x5e12ae);}(_0x0fac,0x132));var _0xc0fa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0fac[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0fa('0x0'));var zipdir=require(_0xc0fa('0x1'));var jsonpatch=require(_0xc0fa('0x2'));var rp=require(_0xc0fa('0x3'));var moment=require(_0xc0fa('0x4'));var BPromise=require(_0xc0fa('0x5'));var Mustache=require(_0xc0fa('0x6'));var util=require(_0xc0fa('0x7'));var path=require(_0xc0fa('0x8'));var sox=require(_0xc0fa('0x9'));var csv=require(_0xc0fa('0xa'));var ejs=require(_0xc0fa('0xb'));var fs=require('fs');var fs_extra=require(_0xc0fa('0xc'));var _=require(_0xc0fa('0xd'));var squel=require(_0xc0fa('0xe'));var crypto=require(_0xc0fa('0xf'));var jsforce=require(_0xc0fa('0x10'));var deskjs=require(_0xc0fa('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc0fa('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc0fa('0x13'));var qs=require(_0xc0fa('0x14'));var as=require(_0xc0fa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0fa('0x16'))(_0xc0fa('0x17'));var utils=require(_0xc0fa('0x18'));var config=require(_0xc0fa('0x19'));var licenseUtil=require(_0xc0fa('0x1a'));var db=require(_0xc0fa('0x1b'))['db'];var integrations=require(_0xc0fa('0x1c'));var jayson=require(_0xc0fa('0x1d'));var client=jayson[_0xc0fa('0x1e')][_0xc0fa('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x24a154,_0x2f6dd5,_0x38f660,_0x151477){return new BPromise(function(_0x180dfe,_0x373e74){var _0x60a2d0=_0x151477||client;return _0x60a2d0[_0xc0fa('0x20')](_0x24a154,_0x38f660)[_0xc0fa('0x21')](function(_0x35bea1){logger[_0xc0fa('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x2f6dd5,'request\x20sent');logger[_0xc0fa('0x23')](_0xc0fa('0x24'),_0x2f6dd5,_0xc0fa('0x25'),JSON[_0xc0fa('0x26')](_0x35bea1));if(_0x35bea1['error']){if(_0x35bea1[_0xc0fa('0x27')]['code']===0x1f4){logger[_0xc0fa('0x27')](_0xc0fa('0x28'),_0x2f6dd5,_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);return _0x373e74(_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);}logger['error'](_0xc0fa('0x28'),_0x2f6dd5,_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);return _0x180dfe(_0x35bea1[_0xc0fa('0x27')][_0xc0fa('0x29')]);}else{logger[_0xc0fa('0x22')](_0xc0fa('0x28'),_0x2f6dd5,_0xc0fa('0x25'));_0x180dfe(_0x35bea1[_0xc0fa('0x2a')][_0xc0fa('0x29')]);}})[_0xc0fa('0x2b')](function(_0x159b08){logger[_0xc0fa('0x27')]('ServicenowAccount,\x20%s,\x20%s',_0x2f6dd5,_0x159b08);_0x373e74(_0x159b08);});});}function respondWithStatusCode(_0x3aa286,_0x2ce7f1){_0x2ce7f1=_0x2ce7f1||0xcc;return function(_0x20701e){if(_0x20701e){return _0x3aa286[_0xc0fa('0x2c')](_0x2ce7f1);}return _0x3aa286[_0xc0fa('0x2d')](_0x2ce7f1)[_0xc0fa('0x2e')]();};}function respondWithResult(_0x3a5b8a,_0x3656a4){_0x3656a4=_0x3656a4||0xc8;return function(_0x269a70){if(_0x269a70){return _0x3a5b8a[_0xc0fa('0x2d')](_0x3656a4)[_0xc0fa('0x2f')](_0x269a70);}};}function respondWithFilteredResult(_0x5740ae,_0x36cc83){return function(_0x135dd7){if(_0x135dd7){var _0x1227b5=typeof _0x36cc83['offset']==='undefined'&&typeof _0x36cc83[_0xc0fa('0x30')]===_0xc0fa('0x31');var _0x2622b9=_0x135dd7['count'];var _0x29fc53=_0x1227b5?0x0:_0x36cc83[_0xc0fa('0x32')];var _0x2508b4=_0x1227b5?_0x135dd7['count']:_0x36cc83[_0xc0fa('0x32')]+_0x36cc83[_0xc0fa('0x30')];var _0xbaba1;if(_0x2508b4>=_0x2622b9){_0x2508b4=_0x2622b9;_0xbaba1=0xc8;}else{_0xbaba1=0xce;}_0x5740ae['status'](_0xbaba1);return _0x5740ae[_0xc0fa('0x33')](_0xc0fa('0x34'),_0x29fc53+'-'+_0x2508b4+'/'+_0x2622b9)[_0xc0fa('0x2f')](_0x135dd7);}return null;};}function patchUpdates(_0x14f837){return function(_0x2de425){try{jsonpatch[_0xc0fa('0x35')](_0x2de425,_0x14f837,!![]);}catch(_0x5ecc4d){return BPromise[_0xc0fa('0x36')](_0x5ecc4d);}return _0x2de425[_0xc0fa('0x37')]();};}function saveUpdates(_0x58c482,_0xf53b30){return function(_0x220af5){if(_0x220af5){return _0x220af5['update'](_0x58c482)[_0xc0fa('0x21')](function(_0x3c4f6c){return _0x3c4f6c;});}return null;};}function removeEntity(_0x410fb5,_0x2ac920){return function(_0x1ca946){if(_0x1ca946){return _0x1ca946[_0xc0fa('0x38')]()[_0xc0fa('0x21')](function(){_0x410fb5['status'](0xcc)[_0xc0fa('0x2e')]();});}};}function handleEntityNotFound(_0x2a66a2,_0x1c3748){return function(_0x43fc73){if(!_0x43fc73){_0x2a66a2[_0xc0fa('0x2c')](0x194);}return _0x43fc73;};}function handleError(_0x5e0178,_0x52b1bf){_0x52b1bf=_0x52b1bf||0x1f4;return function(_0x2f6bd8){logger[_0xc0fa('0x27')](_0x2f6bd8[_0xc0fa('0x39')]);if(_0x2f6bd8[_0xc0fa('0x3a')]){delete _0x2f6bd8['name'];}_0x5e0178[_0xc0fa('0x2d')](_0x52b1bf)[_0xc0fa('0x3b')](_0x2f6bd8);};}function getMustacheRender(_0xb728dc,_0x3ff265){return Mustache[_0xc0fa('0x3c')](_0xb728dc,_[_0xc0fa('0x3d')](_0x3ff265['body'],{'contact':_0x3ff265[_0xc0fa('0x3e')],'message':_0x3ff265['message'],'agent':_0x3ff265[_0xc0fa('0x3f')],'interaction':_0x3ff265[_0xc0fa('0x40')],'account':_0x3ff265[_0xc0fa('0x41')]}))||'';}exports[_0xc0fa('0x42')]=function(_0x2da256,_0x29b3e8){var _0x18a46c={},_0x162cb5={},_0x425149={'count':0x0,'rows':[]};var _0x26dfe9=_[_0xc0fa('0x43')](db[_0xc0fa('0x44')][_0xc0fa('0x45')],function(_0x57598c){return{'name':_0x57598c[_0xc0fa('0x46')],'type':_0x57598c[_0xc0fa('0x47')]['key']};});_0x162cb5[_0xc0fa('0x48')]=_[_0xc0fa('0x43')](_0x26dfe9,_0xc0fa('0x3a'));_0x162cb5[_0xc0fa('0x49')]=_[_0xc0fa('0x4a')](_0x2da256[_0xc0fa('0x49')]);_0x162cb5[_0xc0fa('0x4b')]=_[_0xc0fa('0x4c')](_0x162cb5[_0xc0fa('0x48')],_0x162cb5['query']);_0x18a46c[_0xc0fa('0x4d')]=_[_0xc0fa('0x4c')](_0x162cb5['model'],qs['fields'](_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x4e')]));_0x18a46c[_0xc0fa('0x4d')]=_0x18a46c[_0xc0fa('0x4d')][_0xc0fa('0x4f')]?_0x18a46c['attributes']:_0x162cb5[_0xc0fa('0x48')];if(!_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x50')](_0xc0fa('0x51'))){_0x18a46c[_0xc0fa('0x30')]=qs[_0xc0fa('0x30')](_0x2da256['query'][_0xc0fa('0x30')]);_0x18a46c[_0xc0fa('0x32')]=qs[_0xc0fa('0x32')](_0x2da256[_0xc0fa('0x49')]['offset']);}_0x18a46c[_0xc0fa('0x52')]=qs[_0xc0fa('0x53')](_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x53')]);_0x18a46c[_0xc0fa('0x54')]=qs['filters'](_[_0xc0fa('0x55')](_0x2da256['query'],_0x162cb5[_0xc0fa('0x4b')]),_0x26dfe9);if(_0x2da256['query'][_0xc0fa('0x56')]){_0x18a46c[_0xc0fa('0x54')]=_[_0xc0fa('0x3d')](_0x18a46c[_0xc0fa('0x54')],{'$or':_[_0xc0fa('0x43')](_0x26dfe9,function(_0x294565){if(_0x294565[_0xc0fa('0x47')]!==_0xc0fa('0x57')){var _0x1b96e4={};_0x1b96e4[_0x294565[_0xc0fa('0x3a')]]={'$like':'%'+_0x2da256[_0xc0fa('0x49')][_0xc0fa('0x56')]+'%'};return _0x1b96e4;}})});}_0x18a46c=_[_0xc0fa('0x3d')]({},_0x18a46c,_0x2da256[_0xc0fa('0x58')]);var _0x4741b2={'where':_0x18a46c[_0xc0fa('0x54')]};return db[_0xc0fa('0x44')][_0xc0fa('0x59')](_0x4741b2)[_0xc0fa('0x21')](function(_0x38d2b1){_0x425149[_0xc0fa('0x59')]=_0x38d2b1;if(_0x2da256['query'][_0xc0fa('0x5a')]){_0x18a46c[_0xc0fa('0x5b')]=[{'all':!![]}];}return db[_0xc0fa('0x44')][_0xc0fa('0x5c')](_0x18a46c);})[_0xc0fa('0x21')](function(_0x1fe8ea){_0x425149['rows']=_0x1fe8ea;return _0x425149;})[_0xc0fa('0x21')](respondWithFilteredResult(_0x29b3e8,_0x18a46c))[_0xc0fa('0x2b')](handleError(_0x29b3e8,null));};exports[_0xc0fa('0x5d')]=function(_0x55a91f,_0x336d90){var _0x5c1208={'raw':![],'where':{'id':_0x55a91f[_0xc0fa('0x5e')]['id']}},_0x591dcc={};_0x591dcc[_0xc0fa('0x48')]=_['keys'](db[_0xc0fa('0x44')][_0xc0fa('0x45')]);_0x591dcc[_0xc0fa('0x49')]=_[_0xc0fa('0x4a')](_0x55a91f[_0xc0fa('0x49')]);_0x591dcc['filters']=_[_0xc0fa('0x4c')](_0x591dcc[_0xc0fa('0x48')],_0x591dcc[_0xc0fa('0x49')]);_0x5c1208[_0xc0fa('0x4d')]=_[_0xc0fa('0x4c')](_0x591dcc[_0xc0fa('0x48')],qs['fields'](_0x55a91f[_0xc0fa('0x49')][_0xc0fa('0x4e')]));_0x5c1208[_0xc0fa('0x4d')]=_0x5c1208['attributes']['length']?_0x5c1208['attributes']:_0x591dcc[_0xc0fa('0x48')];if(_0x55a91f[_0xc0fa('0x49')][_0xc0fa('0x5a')]){_0x5c1208[_0xc0fa('0x5b')]=[{'all':!![]}];}_0x5c1208=_['merge']({},_0x5c1208,_0x55a91f[_0xc0fa('0x58')]);return db['ServicenowAccount'][_0xc0fa('0x5f')](_0x5c1208)[_0xc0fa('0x21')](handleEntityNotFound(_0x336d90,null))[_0xc0fa('0x21')](respondWithResult(_0x336d90,null))['catch'](handleError(_0x336d90,null));};exports['create']=function(_0x186344,_0x5ad360){return db['ServicenowAccount'][_0xc0fa('0x60')](_0x186344[_0xc0fa('0x61')],{})[_0xc0fa('0x21')](respondWithResult(_0x5ad360,0xc9))[_0xc0fa('0x2b')](handleError(_0x5ad360,null));};exports['update']=function(_0x1c6556,_0x3b8301){if(_0x1c6556[_0xc0fa('0x61')]['id']){delete _0x1c6556[_0xc0fa('0x61')]['id'];}return db[_0xc0fa('0x44')][_0xc0fa('0x5f')]({'where':{'id':_0x1c6556[_0xc0fa('0x5e')]['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x3b8301,null))['then'](saveUpdates(_0x1c6556['body'],null))[_0xc0fa('0x21')](respondWithResult(_0x3b8301,null))['catch'](handleError(_0x3b8301,null));};exports['destroy']=function(_0x3eb8fc,_0x5da0b7){return db[_0xc0fa('0x44')]['find']({'where':{'id':_0x3eb8fc['params']['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x5da0b7,null))[_0xc0fa('0x21')](removeEntity(_0x5da0b7,null))[_0xc0fa('0x2b')](handleError(_0x5da0b7,null));};exports[_0xc0fa('0x62')]=function(_0x18bdea,_0x1d4939,_0x4206b2){var _0x404b28={};var _0x470b67={};var _0x27a408;var _0xdbb9b;return db['ServicenowAccount']['findOne']({'where':{'id':_0x18bdea[_0xc0fa('0x5e')]['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x1d4939,null))['then'](function(_0x12b6dc){if(_0x12b6dc){_0x27a408=_0x12b6dc;_0x470b67[_0xc0fa('0x48')]=_[_0xc0fa('0x4a')](db[_0xc0fa('0x63')][_0xc0fa('0x45')]);_0x470b67[_0xc0fa('0x49')]=_[_0xc0fa('0x4a')](_0x18bdea['query']);_0x470b67[_0xc0fa('0x4b')]=_[_0xc0fa('0x4c')](_0x470b67[_0xc0fa('0x48')],_0x470b67[_0xc0fa('0x49')]);_0x404b28[_0xc0fa('0x4d')]=_[_0xc0fa('0x4c')](_0x470b67[_0xc0fa('0x48')],qs[_0xc0fa('0x4e')](_0x18bdea[_0xc0fa('0x49')]['fields']));_0x404b28[_0xc0fa('0x4d')]=_0x404b28[_0xc0fa('0x4d')][_0xc0fa('0x4f')]?_0x404b28[_0xc0fa('0x4d')]:_0x470b67['model'];_0x404b28['order']=qs['sort'](_0x18bdea[_0xc0fa('0x49')]['sort']);_0x404b28['where']=qs['filters'](_[_0xc0fa('0x55')](_0x18bdea[_0xc0fa('0x49')],_0x470b67[_0xc0fa('0x4b')]));if(_0x18bdea[_0xc0fa('0x49')]['filter']){_0x404b28[_0xc0fa('0x54')]=_[_0xc0fa('0x3d')](_0x404b28['where'],{'$or':_[_0xc0fa('0x43')](_0x404b28[_0xc0fa('0x4d')],function(_0x22403e){var _0x2281d0={};_0x2281d0[_0x22403e]={'$like':'%'+_0x18bdea[_0xc0fa('0x49')][_0xc0fa('0x56')]+'%'};return _0x2281d0;})});}_0x404b28=_[_0xc0fa('0x3d')]({},_0x404b28,_0x18bdea[_0xc0fa('0x58')]);return _0x27a408['getConfigurations'](_0x404b28);}})[_0xc0fa('0x21')](function(_0xcc18f9){if(_0xcc18f9){_0xdbb9b=_0xcc18f9[_0xc0fa('0x4f')];if(!_0x18bdea[_0xc0fa('0x49')][_0xc0fa('0x50')]('nolimit')){_0x404b28[_0xc0fa('0x30')]=qs[_0xc0fa('0x30')](_0x18bdea[_0xc0fa('0x49')][_0xc0fa('0x30')]);_0x404b28['offset']=qs[_0xc0fa('0x32')](_0x18bdea['query']['offset']);}return _0x27a408[_0xc0fa('0x62')](_0x404b28);}})[_0xc0fa('0x21')](function(_0x39d9a2){if(_0x39d9a2){return _0x39d9a2?{'count':_0xdbb9b,'rows':_0x39d9a2}:null;}})[_0xc0fa('0x21')](respondWithResult(_0x1d4939,null))[_0xc0fa('0x2b')](handleError(_0x1d4939,null));};exports[_0xc0fa('0x64')]=function(_0x27b1f5,_0x3a07e9,_0x411d28){if(_0x27b1f5[_0xc0fa('0x61')]['id']){delete _0x27b1f5[_0xc0fa('0x61')]['id'];}return db[_0xc0fa('0x44')]['findOne']({'where':{'id':_0x27b1f5[_0xc0fa('0x5e')]['id']}})[_0xc0fa('0x21')](handleEntityNotFound(_0x3a07e9,null))[_0xc0fa('0x21')](function(_0x47f3b6){if(_0x47f3b6){_0x27b1f5[_0xc0fa('0x61')]['AccountId']=_0x47f3b6['id'];_0x27b1f5[_0xc0fa('0x61')][_0xc0fa('0x65')]=integrations[_0xc0fa('0x66')](_0x27b1f5[_0xc0fa('0x61')][_0xc0fa('0x67')],_0x27b1f5['body'][_0xc0fa('0x47')]);_0x27b1f5['body'][_0xc0fa('0x68')]=integrations[_0xc0fa('0x69')](_0x27b1f5[_0xc0fa('0x61')]['channel'],_0x27b1f5[_0xc0fa('0x61')][_0xc0fa('0x47')]);return db[_0xc0fa('0x63')][_0xc0fa('0x60')](_0x27b1f5[_0xc0fa('0x61')],{'include':[{'model':db['ServicenowField'],'as':_0xc0fa('0x65')},{'model':db[_0xc0fa('0x6a')],'as':_0xc0fa('0x68')}]});}return null;})[_0xc0fa('0x21')](respondWithResult(_0x3a07e9,null))[_0xc0fa('0x2b')](handleError(_0x3a07e9,null));};exports[_0xc0fa('0x6b')]=function(_0x12499d,_0x628c02,_0xa980ca){var _0xc7cbbd=[_0xc0fa('0x6c'),_0xc0fa('0x6d'),_0xc0fa('0x6e'),_0xc0fa('0x6f'),_0xc0fa('0x70'),_0xc0fa('0x71'),'incident_state',_0xc0fa('0x72'),_0xc0fa('0x73')];var _0x202035=[_0xc0fa('0x74'),_0xc0fa('0x6c'),_0xc0fa('0x75'),'watch_list',_0xc0fa('0x76'),_0xc0fa('0x77'),_0xc0fa('0x78'),'hold_reason','approval_history','number',_0xc0fa('0x79'),'sys_updated_by',_0xc0fa('0x7a'),'user_input',_0xc0fa('0x7b'),_0xc0fa('0x7c'),_0xc0fa('0x7d'),'sys_created_by',_0xc0fa('0x6e'),_0xc0fa('0x52'),_0xc0fa('0x7e'),_0xc0fa('0x7f'),'cmdb_ci',_0xc0fa('0x80'),_0xc0fa('0x81'),'active',_0xc0fa('0x82'),_0xc0fa('0x83'),_0xc0fa('0x84'),_0xc0fa('0x85'),'rfc','time_worked',_0xc0fa('0x86'),_0xc0fa('0x87'),_0xc0fa('0x88'),_0xc0fa('0x89'),_0xc0fa('0x8a'),_0xc0fa('0x8b'),_0xc0fa('0x8c'),_0xc0fa('0x8d'),_0xc0fa('0x8e'),_0xc0fa('0x6f'),_0xc0fa('0x8f'),'short_description','close_code',_0xc0fa('0x90'),_0xc0fa('0x91'),_0xc0fa('0x92'),_0xc0fa('0x93'),'business_stc',_0xc0fa('0x94'),_0xc0fa('0x95'),_0xc0fa('0x96'),_0xc0fa('0x71'),'sys_class_name',_0xc0fa('0x97'),_0xc0fa('0x98'),_0xc0fa('0x99'),_0xc0fa('0x9a'),_0xc0fa('0x9b'),_0xc0fa('0x9c'),_0xc0fa('0x9d'),_0xc0fa('0x9e'),_0xc0fa('0x9f'),_0xc0fa('0xa0'),_0xc0fa('0xa1'),'reassignment_count',_0xc0fa('0xa2'),_0xc0fa('0xa3'),_0xc0fa('0x72'),'comments',_0xc0fa('0xa4'),_0xc0fa('0xa5'),_0xc0fa('0xa6'),'due_date','sys_mod_count',_0xc0fa('0xa7'),_0xc0fa('0xa8'),_0xc0fa('0xa9'),_0xc0fa('0xaa'),_0xc0fa('0xab'),_0xc0fa('0xac'),_0xc0fa('0x73')];var _0x3420b7='';var _0x5824c5='';var _0xbab047=[];var _0x279a2d='';var _0x5db16d='';var _0x5a12f5=[];var _0x32020b='';var _0x5982d8='';var _0x13c6e5={};var _0x348761='';return db[_0xc0fa('0x44')]['findOne']({'where':{'id':_0x12499d['params']['id']},'attributes':['id',_0xc0fa('0xad'),'password',_0xc0fa('0xae'),_0xc0fa('0xaf'),_0xc0fa('0xb0')]})[_0xc0fa('0x21')](handleEntityNotFound(_0x628c02,null))[_0xc0fa('0x21')](function(_0x35c42f){if(_0x35c42f){_0x348761=_0x35c42f[_0xc0fa('0xaf')];var _0x1ff1b2=_0x348761[_0xc0fa('0xb1')](-0x1);if(_0x1ff1b2==='/'){_0x348761=_0x348761[_0xc0fa('0xb2')](0x0,_0x348761[_0xc0fa('0xb3')](_0x1ff1b2));}_0x5982d8=util['format'](_0xc0fa('0xb4'),_0x348761);_0x32020b=util['format'](_0xc0fa('0xb5'),_0x348761);_0x13c6e5={'user':_0x35c42f[_0xc0fa('0xad')],'pass':_0x35c42f[_0xc0fa('0xb6')]};var _0x3db0ea={'method':_0xc0fa('0xb7'),'uri':_0x5982d8+_0xc0fa('0xb8'),'auth':_0x13c6e5,'json':!![]};return rp(_0x3db0ea);}})['then'](function(_0x1a2e88){if(_0x1a2e88[_0xc0fa('0x2a')]['length']>0x0){_0x3420b7=_0x1a2e88[_0xc0fa('0x2a')];}console[_0xc0fa('0xb9')]('incident\x20table\x20objects',_0x3420b7);_0x5a12f5=[];_0x5824c5=Object['assign']([],_0x3420b7);_['remove'](_0x5824c5,function(_0x4be94f){return!_0xc7cbbd[_0xc0fa('0xba')](_0x4be94f[_0xc0fa('0x3a')]);});_0x5824c5[_0xc0fa('0xbb')](function(_0x9755e4){var _0xdda441=createFieldObject(_0x32020b,_0x13c6e5,_0x9755e4[_0xc0fa('0xbc')],_0x9755e4[_0xc0fa('0x3a')],_0x9755e4[_0xc0fa('0xbd')],![]);_0x5a12f5['push'](_0xdda441);});return Promise[_0xc0fa('0xbe')](_0x5a12f5);})[_0xc0fa('0x21')](function(_0x9ad628){_0xbab047=_0x9ad628;_0x279a2d=Object[_0xc0fa('0xbf')]([],_0x3420b7);console[_0xc0fa('0xb9')](_0xc0fa('0xc0'),_0x3420b7);_[_0xc0fa('0xc1')](_0x279a2d,function(_0x5cbb95){return _0x202035[_0xc0fa('0xba')](_0x5cbb95[_0xc0fa('0x3a')]);});console[_0xc0fa('0xb9')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x279a2d);_0x5a12f5=[];_0x279a2d[_0xc0fa('0xbb')](function(_0x253502){var _0x3604a1=createFieldObject(_0x32020b,_0x13c6e5,_0x253502[_0xc0fa('0xbc')],_0x253502['name'],_0x253502[_0xc0fa('0xbd')],!![]);_0x5a12f5[_0xc0fa('0xc2')](_0x3604a1);});return Promise[_0xc0fa('0xbe')](_0x5a12f5);})['then'](function(_0x340cfb){_0x5db16d=_0x340cfb;var _0x1576b4=_0xbab047['concat'](_0x5db16d);return{'count':_0x1576b4[_0xc0fa('0x4f')],'rows':_0x1576b4};})['then'](respondWithResult(_0x628c02,null))[_0xc0fa('0x2b')](function(_0x27bbe7){console['log']('ServiceNow\x20error:\x20'+_0x27bbe7);var _0x34cb91=_0x12499d[_0xc0fa('0x49')]['test']?0x1f4:_0x27bbe7[_0xc0fa('0xc3')]||0x1f4;logger[_0xc0fa('0x27')](_0x27bbe7[_0xc0fa('0x39')]);delete _0x27bbe7[_0xc0fa('0x3a')];if(_0x34cb91===0x191){_0x34cb91=0x190;}_0x628c02[_0xc0fa('0x2d')](_0x34cb91)[_0xc0fa('0x3b')](_0x12499d[_0xc0fa('0x49')][_0xc0fa('0xc4')]?{'message':_0xc0fa('0xc5'),'statusCode':_0x27bbe7['statusCode']}:_0x27bbe7);});};function createFieldObject(_0x4a01b0,_0x160b99,_0x18bca1,_0x32d38a,_0x1cbf67,_0x264351){return new Promise(function(_0x598910,_0x1f1d8c){var _0x5d2144={'id':_0x32d38a,'name':_0x1cbf67,'custom':_0x264351};if(_0x18bca1==='boolean'){_0x5d2144[_0xc0fa('0x58')]=[{'name':'True','value':_0xc0fa('0xc6')},{'name':_0xc0fa('0xc7'),'value':_0xc0fa('0xc8')}];_0x598910(_0x5d2144);}else{var _0x2649c0={'method':'GET','uri':_0x4a01b0+'sys_choice?sysparm_query=name=incident^element='+_0x32d38a,'auth':_0x160b99,'json':!![]};return rp(_0x2649c0)[_0xc0fa('0x21')](function(_0x2f5f78){var _0x1c1023=[];if(_0x2f5f78[_0xc0fa('0x2a')][_0xc0fa('0x4f')]>0x0){_0x2f5f78[_0xc0fa('0x2a')][_0xc0fa('0xbb')](function(_0x2edfae){if(_0x2edfae[_0xc0fa('0xc9')]==='false'){var _0x184b7c={'name':_0x2edfae[_0xc0fa('0xbd')],'value':_0x2edfae[_0xc0fa('0xca')]};_0x1c1023[_0xc0fa('0xc2')](_0x184b7c);}});}_0x5d2144[_0xc0fa('0x58')]=_0x1c1023;if(_0x5d2144[_0xc0fa('0x58')][_0xc0fa('0x4f')]>0x0){_0x598910(_0x5d2144);}else{if(_0x264351==![]){_0x598910();}else{_0x598910(_0x5d2144);}}});}});} \ No newline at end of file +var _0x37c1=['getSubjects','Descriptions','getDescriptions','channel','getFields','made_sla','hold_reason','close_code','notify','incident_state','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','subcategory','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','reassignment_count','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','GET','log','incident\x20table\x20objects','assign','includes','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','true','False','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','render','contact','agent','account','index','map','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','ServicenowAccount','include','rows','show','params','rawAttributes','includeAll','options','find','create','body','getConfigurations','findOne','ServicenowConfiguration','pick','filter','addConfiguration','AccountId','Subjects'];(function(_0x4aa9b4,_0x56be72){var _0x124e50=function(_0x40349f){while(--_0x40349f){_0x4aa9b4['push'](_0x4aa9b4['shift']());}};_0x124e50(++_0x56be72);}(_0x37c1,0x133));var _0x137c=function(_0x26eddd,_0x5afd4a){_0x26eddd=_0x26eddd-0x0;var _0x562f8a=_0x37c1[_0x26eddd];return _0x562f8a;};'use strict';var emlformat=require(_0x137c('0x0'));var rimraf=require(_0x137c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x137c('0x2'));var rp=require(_0x137c('0x3'));var moment=require('moment');var BPromise=require(_0x137c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x137c('0x5'));var csv=require(_0x137c('0x6'));var ejs=require(_0x137c('0x7'));var fs=require('fs');var fs_extra=require(_0x137c('0x8'));var _=require('lodash');var squel=require(_0x137c('0x9'));var crypto=require(_0x137c('0xa'));var jsforce=require(_0x137c('0xb'));var deskjs=require(_0x137c('0xc'));var toCsv=require(_0x137c('0x6'));var querystring=require(_0x137c('0xd'));var Papa=require(_0x137c('0xe'));var Redis=require(_0x137c('0xf'));var authService=require(_0x137c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x137c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x137c('0x12'))(_0x137c('0x13'));var utils=require(_0x137c('0x14'));var config=require(_0x137c('0x15'));var licenseUtil=require(_0x137c('0x16'));var db=require(_0x137c('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x137c('0x18'));var client=jayson[_0x137c('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x168bc1,_0x111562,_0xe1ba4d,_0x154128){return new BPromise(function(_0x32dace,_0x22aa8f){var _0x5a0b84=_0x154128||client;return _0x5a0b84[_0x137c('0x1a')](_0x168bc1,_0xe1ba4d)['then'](function(_0x4b0fff){logger[_0x137c('0x1b')](_0x137c('0x1c'),_0x111562,_0x137c('0x1d'));logger['debug'](_0x137c('0x1e'),_0x111562,_0x137c('0x1d'),JSON[_0x137c('0x1f')](_0x4b0fff));if(_0x4b0fff[_0x137c('0x20')]){if(_0x4b0fff[_0x137c('0x20')][_0x137c('0x21')]===0x1f4){logger[_0x137c('0x20')](_0x137c('0x1c'),_0x111562,_0x4b0fff['error'][_0x137c('0x22')]);return _0x22aa8f(_0x4b0fff[_0x137c('0x20')][_0x137c('0x22')]);}logger[_0x137c('0x20')](_0x137c('0x1c'),_0x111562,_0x4b0fff[_0x137c('0x20')][_0x137c('0x22')]);return _0x32dace(_0x4b0fff['error'][_0x137c('0x22')]);}else{logger[_0x137c('0x1b')](_0x137c('0x1c'),_0x111562,_0x137c('0x1d'));_0x32dace(_0x4b0fff[_0x137c('0x23')]['message']);}})[_0x137c('0x24')](function(_0x28e0d8){logger['error'](_0x137c('0x1c'),_0x111562,_0x28e0d8);_0x22aa8f(_0x28e0d8);});});}function respondWithStatusCode(_0x276b6d,_0x2487f7){_0x2487f7=_0x2487f7||0xcc;return function(_0x5c7ff2){if(_0x5c7ff2){return _0x276b6d[_0x137c('0x25')](_0x2487f7);}return _0x276b6d[_0x137c('0x26')](_0x2487f7)['end']();};}function respondWithResult(_0x54a062,_0x1eb823){_0x1eb823=_0x1eb823||0xc8;return function(_0x4699cb){if(_0x4699cb){return _0x54a062['status'](_0x1eb823)['json'](_0x4699cb);}};}function respondWithFilteredResult(_0x38cc4e,_0x597cfd){return function(_0x398a20){if(_0x398a20){var _0xb027f5=typeof _0x597cfd['offset']===_0x137c('0x27')&&typeof _0x597cfd[_0x137c('0x28')]==='undefined';var _0xdd813f=_0x398a20[_0x137c('0x29')];var _0x190140=_0xb027f5?0x0:_0x597cfd[_0x137c('0x2a')];var _0x776311=_0xb027f5?_0x398a20[_0x137c('0x29')]:_0x597cfd[_0x137c('0x2a')]+_0x597cfd[_0x137c('0x28')];var _0x5d220c;if(_0x776311>=_0xdd813f){_0x776311=_0xdd813f;_0x5d220c=0xc8;}else{_0x5d220c=0xce;}_0x38cc4e[_0x137c('0x26')](_0x5d220c);return _0x38cc4e[_0x137c('0x2b')](_0x137c('0x2c'),_0x190140+'-'+_0x776311+'/'+_0xdd813f)[_0x137c('0x2d')](_0x398a20);}return null;};}function patchUpdates(_0x53eb59){return function(_0x2a4a39){try{jsonpatch[_0x137c('0x2e')](_0x2a4a39,_0x53eb59,!![]);}catch(_0x1363d2){return BPromise[_0x137c('0x2f')](_0x1363d2);}return _0x2a4a39[_0x137c('0x30')]();};}function saveUpdates(_0x227ffc,_0x127ac9){return function(_0x13611b){if(_0x13611b){return _0x13611b[_0x137c('0x31')](_0x227ffc)[_0x137c('0x32')](function(_0x4dc8b3){return _0x4dc8b3;});}return null;};}function removeEntity(_0x30e973,_0x2e92d1){return function(_0x442da3){if(_0x442da3){return _0x442da3[_0x137c('0x33')]()[_0x137c('0x32')](function(){_0x30e973[_0x137c('0x26')](0xcc)[_0x137c('0x34')]();});}};}function handleEntityNotFound(_0x462997,_0x553341){return function(_0x24293a){if(!_0x24293a){_0x462997[_0x137c('0x25')](0x194);}return _0x24293a;};}function handleError(_0x19622c,_0x31f5e4){_0x31f5e4=_0x31f5e4||0x1f4;return function(_0x4a1879){logger[_0x137c('0x20')](_0x4a1879[_0x137c('0x35')]);if(_0x4a1879[_0x137c('0x36')]){delete _0x4a1879[_0x137c('0x36')];}_0x19622c[_0x137c('0x26')](_0x31f5e4)[_0x137c('0x37')](_0x4a1879);};}function getMustacheRender(_0x17d18b,_0x439604){return Mustache[_0x137c('0x38')](_0x17d18b,_['merge'](_0x439604['body'],{'contact':_0x439604[_0x137c('0x39')],'message':_0x439604['message'],'agent':_0x439604[_0x137c('0x3a')],'interaction':_0x439604['interaction'],'account':_0x439604[_0x137c('0x3b')]}))||'';}exports[_0x137c('0x3c')]=function(_0x5cacd2,_0x218a44){var _0x6dbd35={},_0x359666={},_0x6514e6={'count':0x0,'rows':[]};var _0x3d435f=_[_0x137c('0x3d')](db['ServicenowAccount']['rawAttributes'],function(_0x35025c){return{'name':_0x35025c[_0x137c('0x3e')],'type':_0x35025c[_0x137c('0x3f')][_0x137c('0x40')]};});_0x359666[_0x137c('0x41')]=_['map'](_0x3d435f,_0x137c('0x36'));_0x359666['query']=_[_0x137c('0x42')](_0x5cacd2['query']);_0x359666[_0x137c('0x43')]=_['intersection'](_0x359666[_0x137c('0x41')],_0x359666[_0x137c('0x44')]);_0x6dbd35[_0x137c('0x45')]=_[_0x137c('0x46')](_0x359666['model'],qs[_0x137c('0x47')](_0x5cacd2['query'][_0x137c('0x47')]));_0x6dbd35[_0x137c('0x45')]=_0x6dbd35[_0x137c('0x45')][_0x137c('0x48')]?_0x6dbd35[_0x137c('0x45')]:_0x359666[_0x137c('0x41')];if(!_0x5cacd2[_0x137c('0x44')][_0x137c('0x49')](_0x137c('0x4a'))){_0x6dbd35[_0x137c('0x28')]=qs[_0x137c('0x28')](_0x5cacd2[_0x137c('0x44')][_0x137c('0x28')]);_0x6dbd35[_0x137c('0x2a')]=qs[_0x137c('0x2a')](_0x5cacd2[_0x137c('0x44')]['offset']);}_0x6dbd35[_0x137c('0x4b')]=qs['sort'](_0x5cacd2[_0x137c('0x44')][_0x137c('0x4c')]);_0x6dbd35['where']=qs['filters'](_['pick'](_0x5cacd2[_0x137c('0x44')],_0x359666[_0x137c('0x43')]),_0x3d435f);if(_0x5cacd2[_0x137c('0x44')]['filter']){_0x6dbd35[_0x137c('0x4d')]=_[_0x137c('0x4e')](_0x6dbd35[_0x137c('0x4d')],{'$or':_['map'](_0x3d435f,function(_0xae7025){if(_0xae7025[_0x137c('0x3f')]!==_0x137c('0x4f')){var _0x421eb9={};_0x421eb9[_0xae7025[_0x137c('0x36')]]={'$like':'%'+_0x5cacd2['query']['filter']+'%'};return _0x421eb9;}})});}_0x6dbd35=_[_0x137c('0x4e')]({},_0x6dbd35,_0x5cacd2['options']);var _0x50802a={'where':_0x6dbd35[_0x137c('0x4d')]};return db[_0x137c('0x50')]['count'](_0x50802a)[_0x137c('0x32')](function(_0xc460c2){_0x6514e6['count']=_0xc460c2;if(_0x5cacd2[_0x137c('0x44')]['includeAll']){_0x6dbd35[_0x137c('0x51')]=[{'all':!![]}];}return db[_0x137c('0x50')]['findAll'](_0x6dbd35);})[_0x137c('0x32')](function(_0x391df7){_0x6514e6[_0x137c('0x52')]=_0x391df7;return _0x6514e6;})[_0x137c('0x32')](respondWithFilteredResult(_0x218a44,_0x6dbd35))['catch'](handleError(_0x218a44,null));};exports[_0x137c('0x53')]=function(_0x50c639,_0x454580){var _0x116184={'raw':![],'where':{'id':_0x50c639[_0x137c('0x54')]['id']}},_0x4a1ae1={};_0x4a1ae1[_0x137c('0x41')]=_[_0x137c('0x42')](db['ServicenowAccount'][_0x137c('0x55')]);_0x4a1ae1['query']=_[_0x137c('0x42')](_0x50c639['query']);_0x4a1ae1['filters']=_[_0x137c('0x46')](_0x4a1ae1['model'],_0x4a1ae1['query']);_0x116184[_0x137c('0x45')]=_['intersection'](_0x4a1ae1[_0x137c('0x41')],qs['fields'](_0x50c639['query'][_0x137c('0x47')]));_0x116184[_0x137c('0x45')]=_0x116184[_0x137c('0x45')][_0x137c('0x48')]?_0x116184[_0x137c('0x45')]:_0x4a1ae1[_0x137c('0x41')];if(_0x50c639[_0x137c('0x44')][_0x137c('0x56')]){_0x116184['include']=[{'all':!![]}];}_0x116184=_['merge']({},_0x116184,_0x50c639[_0x137c('0x57')]);return db[_0x137c('0x50')][_0x137c('0x58')](_0x116184)[_0x137c('0x32')](handleEntityNotFound(_0x454580,null))[_0x137c('0x32')](respondWithResult(_0x454580,null))['catch'](handleError(_0x454580,null));};exports[_0x137c('0x59')]=function(_0x1a4b57,_0x18a411){return db['ServicenowAccount']['create'](_0x1a4b57[_0x137c('0x5a')],{})['then'](respondWithResult(_0x18a411,0xc9))[_0x137c('0x24')](handleError(_0x18a411,null));};exports[_0x137c('0x31')]=function(_0x5abb72,_0x2537b7){if(_0x5abb72['body']['id']){delete _0x5abb72[_0x137c('0x5a')]['id'];}return db[_0x137c('0x50')]['find']({'where':{'id':_0x5abb72[_0x137c('0x54')]['id']}})['then'](handleEntityNotFound(_0x2537b7,null))[_0x137c('0x32')](saveUpdates(_0x5abb72['body'],null))[_0x137c('0x32')](respondWithResult(_0x2537b7,null))[_0x137c('0x24')](handleError(_0x2537b7,null));};exports[_0x137c('0x33')]=function(_0x3e0e08,_0x2d7727){return db[_0x137c('0x50')]['find']({'where':{'id':_0x3e0e08[_0x137c('0x54')]['id']}})[_0x137c('0x32')](handleEntityNotFound(_0x2d7727,null))[_0x137c('0x32')](removeEntity(_0x2d7727,null))[_0x137c('0x24')](handleError(_0x2d7727,null));};exports[_0x137c('0x5b')]=function(_0x1970f1,_0x385561,_0xcf636d){var _0x534f45={};var _0x399fd7={};var _0x14a5ac;var _0x45e884;return db[_0x137c('0x50')][_0x137c('0x5c')]({'where':{'id':_0x1970f1[_0x137c('0x54')]['id']}})[_0x137c('0x32')](handleEntityNotFound(_0x385561,null))[_0x137c('0x32')](function(_0x3d9aff){if(_0x3d9aff){_0x14a5ac=_0x3d9aff;_0x399fd7[_0x137c('0x41')]=_[_0x137c('0x42')](db[_0x137c('0x5d')]['rawAttributes']);_0x399fd7[_0x137c('0x44')]=_[_0x137c('0x42')](_0x1970f1[_0x137c('0x44')]);_0x399fd7[_0x137c('0x43')]=_[_0x137c('0x46')](_0x399fd7[_0x137c('0x41')],_0x399fd7[_0x137c('0x44')]);_0x534f45[_0x137c('0x45')]=_[_0x137c('0x46')](_0x399fd7['model'],qs[_0x137c('0x47')](_0x1970f1['query'][_0x137c('0x47')]));_0x534f45[_0x137c('0x45')]=_0x534f45[_0x137c('0x45')][_0x137c('0x48')]?_0x534f45[_0x137c('0x45')]:_0x399fd7[_0x137c('0x41')];_0x534f45[_0x137c('0x4b')]=qs['sort'](_0x1970f1[_0x137c('0x44')]['sort']);_0x534f45[_0x137c('0x4d')]=qs[_0x137c('0x43')](_[_0x137c('0x5e')](_0x1970f1[_0x137c('0x44')],_0x399fd7['filters']));if(_0x1970f1[_0x137c('0x44')][_0x137c('0x5f')]){_0x534f45['where']=_[_0x137c('0x4e')](_0x534f45[_0x137c('0x4d')],{'$or':_[_0x137c('0x3d')](_0x534f45[_0x137c('0x45')],function(_0x1ee16c){var _0x531ef0={};_0x531ef0[_0x1ee16c]={'$like':'%'+_0x1970f1[_0x137c('0x44')]['filter']+'%'};return _0x531ef0;})});}_0x534f45=_[_0x137c('0x4e')]({},_0x534f45,_0x1970f1[_0x137c('0x57')]);return _0x14a5ac['getConfigurations'](_0x534f45);}})[_0x137c('0x32')](function(_0xa623ed){if(_0xa623ed){_0x45e884=_0xa623ed[_0x137c('0x48')];if(!_0x1970f1[_0x137c('0x44')][_0x137c('0x49')](_0x137c('0x4a'))){_0x534f45[_0x137c('0x28')]=qs['limit'](_0x1970f1[_0x137c('0x44')]['limit']);_0x534f45[_0x137c('0x2a')]=qs['offset'](_0x1970f1['query'][_0x137c('0x2a')]);}return _0x14a5ac[_0x137c('0x5b')](_0x534f45);}})[_0x137c('0x32')](function(_0xfeb3e8){if(_0xfeb3e8){return _0xfeb3e8?{'count':_0x45e884,'rows':_0xfeb3e8}:null;}})['then'](respondWithResult(_0x385561,null))['catch'](handleError(_0x385561,null));};exports[_0x137c('0x60')]=function(_0x245551,_0x58c543,_0x2ec5da){if(_0x245551[_0x137c('0x5a')]['id']){delete _0x245551[_0x137c('0x5a')]['id'];}return db[_0x137c('0x50')][_0x137c('0x5c')]({'where':{'id':_0x245551[_0x137c('0x54')]['id']}})[_0x137c('0x32')](handleEntityNotFound(_0x58c543,null))[_0x137c('0x32')](function(_0x485bf0){if(_0x485bf0){_0x245551[_0x137c('0x5a')][_0x137c('0x61')]=_0x485bf0['id'];_0x245551[_0x137c('0x5a')][_0x137c('0x62')]=integrations[_0x137c('0x63')](_0x245551[_0x137c('0x5a')]['channel'],_0x245551[_0x137c('0x5a')][_0x137c('0x3f')]);_0x245551[_0x137c('0x5a')][_0x137c('0x64')]=integrations[_0x137c('0x65')](_0x245551[_0x137c('0x5a')][_0x137c('0x66')],_0x245551[_0x137c('0x5a')][_0x137c('0x3f')]);return db[_0x137c('0x5d')][_0x137c('0x59')](_0x245551[_0x137c('0x5a')],{'include':[{'model':db['ServicenowField'],'as':_0x137c('0x62')},{'model':db['ServicenowField'],'as':_0x137c('0x64')}]});}return null;})['then'](respondWithResult(_0x58c543,null))['catch'](handleError(_0x58c543,null));};exports[_0x137c('0x67')]=function(_0x4e7f47,_0xb4dc2e,_0x2142de){var _0x444ccf=[_0x137c('0x68'),_0x137c('0x69'),'knowledge','subcategory',_0x137c('0x6a'),_0x137c('0x6b'),_0x137c('0x6c'),'severity','category'];var _0x15de55=[_0x137c('0x6d'),'made_sla',_0x137c('0x6e'),_0x137c('0x6f'),'upon_reject',_0x137c('0x70'),_0x137c('0x71'),_0x137c('0x69'),_0x137c('0x72'),_0x137c('0x73'),_0x137c('0x74'),_0x137c('0x75'),_0x137c('0x76'),_0x137c('0x77'),'sys_created_on',_0x137c('0x78'),_0x137c('0x79'),_0x137c('0x7a'),_0x137c('0x7b'),_0x137c('0x4b'),_0x137c('0x7c'),_0x137c('0x7d'),_0x137c('0x7e'),_0x137c('0x7f'),_0x137c('0x80'),'active',_0x137c('0x81'),_0x137c('0x82'),'priority',_0x137c('0x83'),_0x137c('0x84'),_0x137c('0x85'),_0x137c('0x86'),_0x137c('0x87'),_0x137c('0x88'),_0x137c('0x89'),_0x137c('0x8a'),_0x137c('0x8b'),'resolved_at','caller_id',_0x137c('0x8c'),_0x137c('0x8d'),'work_notes',_0x137c('0x8e'),_0x137c('0x6a'),'correlation_display',_0x137c('0x8f'),_0x137c('0x90'),_0x137c('0x91'),_0x137c('0x92'),_0x137c('0x93'),_0x137c('0x94'),'calendar_duration',_0x137c('0x6b'),_0x137c('0x95'),_0x137c('0x96'),'closed_by',_0x137c('0x97'),_0x137c('0x98'),_0x137c('0x99'),_0x137c('0x9a'),_0x137c('0x9b'),_0x137c('0x6c'),'urgency',_0x137c('0x9c'),'company',_0x137c('0x9d'),'activity_due',_0x137c('0x9e'),_0x137c('0x9f'),_0x137c('0xa0'),_0x137c('0xa1'),_0x137c('0xa2'),_0x137c('0xa3'),_0x137c('0xa4'),_0x137c('0xa5'),_0x137c('0xa6'),_0x137c('0xa7'),_0x137c('0xa8'),_0x137c('0xa9'),_0x137c('0xaa'),_0x137c('0xab'),_0x137c('0xac')];var _0x3a6bc3='';var _0x199bee='';var _0x322c61=[];var _0x1afdaf='';var _0x1614b4='';var _0x1f1217=[];var _0x52ec5b='';var _0x836603='';var _0x17ded8={};var _0x56b869='';return db['ServicenowAccount'][_0x137c('0x5c')]({'where':{'id':_0x4e7f47[_0x137c('0x54')]['id']},'attributes':['id',_0x137c('0xad'),_0x137c('0xae'),_0x137c('0xaf'),'remoteUri',_0x137c('0xb0')]})['then'](handleEntityNotFound(_0xb4dc2e,null))['then'](function(_0x4f2db0){if(_0x4f2db0){_0x56b869=_0x4f2db0[_0x137c('0xb1')];var _0x17dd1f=_0x56b869[_0x137c('0xb2')](-0x1);if(_0x17dd1f==='/'){_0x56b869=_0x56b869['substring'](0x0,_0x56b869[_0x137c('0xb3')](_0x17dd1f));}_0x836603=util['format'](_0x137c('0xb4'),_0x56b869);_0x52ec5b=util[_0x137c('0xb5')]('%s/api/now/table/',_0x56b869);_0x17ded8={'user':_0x4f2db0[_0x137c('0xad')],'pass':_0x4f2db0[_0x137c('0xae')]};var _0x4b567b={'method':_0x137c('0xb6'),'uri':_0x836603+'incident?sysparm_display_value=all','auth':_0x17ded8,'json':!![]};return rp(_0x4b567b);}})[_0x137c('0x32')](function(_0x242609){if(_0x242609[_0x137c('0x23')][_0x137c('0x48')]>0x0){_0x3a6bc3=_0x242609['result'];}console[_0x137c('0xb7')](_0x137c('0xb8'),_0x3a6bc3);_0x1f1217=[];_0x199bee=Object[_0x137c('0xb9')]([],_0x3a6bc3);_['remove'](_0x199bee,function(_0x5f26e4){return!_0x444ccf[_0x137c('0xba')](_0x5f26e4[_0x137c('0x36')]);});_0x199bee['forEach'](function(_0x32e9fa){var _0x4d5967=createFieldObject(_0x52ec5b,_0x17ded8,_0x32e9fa['internalType'],_0x32e9fa['name'],_0x32e9fa[_0x137c('0xbb')],![]);_0x1f1217['push'](_0x4d5967);});return Promise[_0x137c('0xbc')](_0x1f1217);})['then'](function(_0x25294d){_0x322c61=_0x25294d;_0x1afdaf=Object[_0x137c('0xb9')]([],_0x3a6bc3);console[_0x137c('0xb7')](_0x137c('0xbd'),_0x3a6bc3);_[_0x137c('0xbe')](_0x1afdaf,function(_0x2e2491){return _0x15de55['includes'](_0x2e2491[_0x137c('0x36')]);});console[_0x137c('0xb7')](_0x137c('0xbf'),_0x1afdaf);_0x1f1217=[];_0x1afdaf[_0x137c('0xc0')](function(_0x2c3c6c){var _0x471ce7=createFieldObject(_0x52ec5b,_0x17ded8,_0x2c3c6c['internalType'],_0x2c3c6c[_0x137c('0x36')],_0x2c3c6c[_0x137c('0xbb')],!![]);_0x1f1217[_0x137c('0xc1')](_0x471ce7);});return Promise[_0x137c('0xbc')](_0x1f1217);})[_0x137c('0x32')](function(_0x1a88f2){_0x1614b4=_0x1a88f2;var _0x179f3f=_0x322c61[_0x137c('0xc2')](_0x1614b4);return{'count':_0x179f3f[_0x137c('0x48')],'rows':_0x179f3f};})[_0x137c('0x32')](respondWithResult(_0xb4dc2e,null))['catch'](function(_0x2406b7){console['log'](_0x137c('0xc3')+_0x2406b7);var _0x49d05a=_0x4e7f47[_0x137c('0x44')][_0x137c('0xc4')]?0x1f4:_0x2406b7[_0x137c('0xc5')]||0x1f4;logger['error'](_0x2406b7[_0x137c('0x35')]);delete _0x2406b7[_0x137c('0x36')];if(_0x49d05a===0x191){_0x49d05a=0x190;}_0xb4dc2e[_0x137c('0x26')](_0x49d05a)['send'](_0x4e7f47[_0x137c('0x44')]['test']?{'message':_0x137c('0xc6'),'statusCode':_0x2406b7[_0x137c('0xc5')]}:_0x2406b7);});};function createFieldObject(_0x6d3f3a,_0x516c68,_0x10af49,_0x2450ee,_0x4179a8,_0x3936bb){return new Promise(function(_0x3f4db7,_0x29f84e){var _0x1ad566={'id':_0x2450ee,'name':_0x4179a8,'custom':_0x3936bb};if(_0x10af49==='boolean'){_0x1ad566[_0x137c('0x57')]=[{'name':'True','value':_0x137c('0xc7')},{'name':_0x137c('0xc8'),'value':'false'}];_0x3f4db7(_0x1ad566);}else{var _0x4daafc={'method':_0x137c('0xb6'),'uri':_0x6d3f3a+_0x137c('0xc9')+_0x2450ee,'auth':_0x516c68,'json':!![]};return rp(_0x4daafc)[_0x137c('0x32')](function(_0xece597){var _0xa40af=[];if(_0xece597['result'][_0x137c('0x48')]>0x0){_0xece597[_0x137c('0x23')][_0x137c('0xc0')](function(_0x42ff11){if(_0x42ff11['inactive']==='false'){var _0x46cc7e={'name':_0x42ff11[_0x137c('0xbb')],'value':_0x42ff11[_0x137c('0xca')]};_0xa40af[_0x137c('0xc1')](_0x46cc7e);}});}_0x1ad566[_0x137c('0x57')]=_0xa40af;if(_0x1ad566['options']['length']>0x0){_0x3f4db7(_0x1ad566);}else{if(_0x3936bb==![]){_0x3f4db7();}else{_0x3f4db7(_0x1ad566);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c87ea1c..db60a74 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration'];(function(_0x27d647,_0x4a10a0){var _0x50df92=function(_0xd8d02){while(--_0xd8d02){_0x27d647['push'](_0x27d647['shift']());}};_0x50df92(++_0x4a10a0);}(_0x2d17,0x17e));var _0x72d1=function(_0x50bdab,_0x3646d9){_0x50bdab=_0x50bdab-0x0;var _0x10b44f=_0x2d17[_0x50bdab];return _0x10b44f;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x72d1('0x7'));module['exports']=function(_0x139ba0,_0x239d1f){return _0x139ba0['define'](_0x72d1('0x8'),attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x63a2c8,_0x435e00){var _0x4155fa=function(_0x480f6f){while(--_0x480f6f){_0x63a2c8['push'](_0x63a2c8['shift']());}};_0x4155fa(++_0x435e00);}(_0xdc97,0x13b));var _0x7dc9=function(_0x333b4e,_0x11526c){_0x333b4e=_0x333b4e-0x0;var _0x259432=_0xdc97[_0x333b4e];return _0x259432;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index cadb4b4..cb06b9a 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b4e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','GetServicenowAccount','stringify','ShowServicenowAccount','find','map','util','moment','bluebird','../../config/utils'];(function(_0x47b39a,_0x7ff6bf){var _0x4c902b=function(_0x22c31b){while(--_0x22c31b){_0x47b39a['push'](_0x47b39a['shift']());}};_0x4c902b(++_0x7ff6bf);}(_0x1b4e,0xa6));var _0xe1b4=function(_0x8c55ff,_0x3d9260){_0x8c55ff=_0x8c55ff-0x0;var _0x24f4a1=_0x1b4e[_0x8c55ff];return _0x24f4a1;};'use strict';var _=require('lodash');var util=require(_0xe1b4('0x0'));var moment=require(_0xe1b4('0x1'));var BPromise=require(_0xe1b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe1b4('0x3'));var logger=require('../../config/logger')(_0xe1b4('0x4'));var config=require(_0xe1b4('0x5'));var jayson=require(_0xe1b4('0x6'));var client=jayson[_0xe1b4('0x7')][_0xe1b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10cfa0,_0x11b800,_0x5a8749){return new BPromise(function(_0x4aacdc,_0x526933){return client[_0xe1b4('0x9')](_0x10cfa0,_0x5a8749)[_0xe1b4('0xa')](function(_0x5b7077){logger[_0xe1b4('0xb')](_0xe1b4('0xc'),_0x11b800,_0xe1b4('0xd'));logger[_0xe1b4('0xe')](_0xe1b4('0xf'),_0x11b800,_0xe1b4('0xd'),JSON['stringify'](_0x5b7077));if(_0x5b7077[_0xe1b4('0x10')]){if(_0x5b7077[_0xe1b4('0x10')][_0xe1b4('0x11')]===0x1f4){logger['error'](_0xe1b4('0xc'),_0x11b800,_0x5b7077['error'][_0xe1b4('0x12')]);return _0x526933(_0x5b7077[_0xe1b4('0x10')][_0xe1b4('0x12')]);}logger[_0xe1b4('0x10')](_0xe1b4('0xc'),_0x11b800,_0x5b7077['error'][_0xe1b4('0x12')]);return _0x4aacdc(_0x5b7077['error']['message']);}else{logger[_0xe1b4('0xb')](_0xe1b4('0xc'),_0x11b800,_0xe1b4('0xd'));_0x4aacdc(_0x5b7077[_0xe1b4('0x13')][_0xe1b4('0x12')]);}})[_0xe1b4('0x14')](function(_0x2588c9){logger[_0xe1b4('0x10')](_0xe1b4('0xc'),_0x11b800,_0x2588c9);_0x526933(_0x2588c9);});});}exports['GetServicenowAccount']=function(_0x370c4d){var _0x3261b2=this;return new Promise(function(_0x2f49a4,_0x16450a){return db['ServicenowAccount'][_0xe1b4('0x15')]({'raw':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x17')]===undefined?!![]:![]:!![],'where':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x18')]||null:null,'attributes':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x19')]||null:null,'limit':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x1a')]||null:null,'include':_0x370c4d[_0xe1b4('0x16')]?_0x370c4d[_0xe1b4('0x16')][_0xe1b4('0x1b')]?_['map'](_0x370c4d['options'][_0xe1b4('0x1b')],function(_0x47c8c5){return{'model':db[_0x47c8c5[_0xe1b4('0x1c')]],'as':_0x47c8c5['as'],'attributes':_0x47c8c5[_0xe1b4('0x19')],'include':_0x47c8c5[_0xe1b4('0x1b')]?_['map'](_0x47c8c5[_0xe1b4('0x1b')],function(_0x141400){return{'model':db[_0x141400['model']],'as':_0x141400['as'],'attributes':_0x141400[_0xe1b4('0x19')],'include':_0x141400[_0xe1b4('0x1b')]?_['map'](_0x141400['include'],function(_0x642945){return{'model':db[_0x642945[_0xe1b4('0x1c')]],'as':_0x642945['as'],'attributes':_0x642945[_0xe1b4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe1b4('0xa')](function(_0x45fabf){logger[_0xe1b4('0xb')]('GetServicenowAccount',_0x370c4d);logger['debug'](_0xe1b4('0x1d'),_0x370c4d,JSON[_0xe1b4('0x1e')](_0x45fabf));_0x2f49a4(_0x45fabf);})[_0xe1b4('0x14')](function(_0x14b93d){logger['error'](_0xe1b4('0x1d'),_0x14b93d[_0xe1b4('0x12')],_0x370c4d);_0x16450a(_0x3261b2[_0xe1b4('0x10')](0x1f4,_0x14b93d[_0xe1b4('0x12')]));});});};exports[_0xe1b4('0x1f')]=function(_0x32d88f){var _0x3b38ba=this;return new Promise(function(_0x2feb97,_0x39fe2c){return db['ServicenowAccount'][_0xe1b4('0x20')]({'raw':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f['options'][_0xe1b4('0x17')]===undefined?!![]:![]:!![],'where':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f['options'][_0xe1b4('0x18')]||null:null,'attributes':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f['options']['attributes']||null:null,'include':_0x32d88f[_0xe1b4('0x16')]?_0x32d88f[_0xe1b4('0x16')][_0xe1b4('0x1b')]?_[_0xe1b4('0x21')](_0x32d88f[_0xe1b4('0x16')][_0xe1b4('0x1b')],function(_0x299393){return{'model':db[_0x299393[_0xe1b4('0x1c')]],'as':_0x299393['as'],'attributes':_0x299393[_0xe1b4('0x19')],'include':_0x299393[_0xe1b4('0x1b')]?_[_0xe1b4('0x21')](_0x299393['include'],function(_0x3c5440){return{'model':db[_0x3c5440['model']],'as':_0x3c5440['as'],'attributes':_0x3c5440['attributes'],'include':_0x3c5440[_0xe1b4('0x1b')]?_['map'](_0x3c5440[_0xe1b4('0x1b')],function(_0x538468){return{'model':db[_0x538468['model']],'as':_0x538468['as'],'attributes':_0x538468[_0xe1b4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5eee52){logger[_0xe1b4('0xb')]('ShowServicenowAccount',_0x32d88f);logger[_0xe1b4('0xe')](_0xe1b4('0x1f'),_0x32d88f,JSON['stringify'](_0x5eee52));_0x2feb97(_0x5eee52);})[_0xe1b4('0x14')](function(_0x450053){logger['error'](_0xe1b4('0x1f'),_0x450053[_0xe1b4('0x12')],_0x32d88f);_0x39fe2c(_0x3b38ba[_0xe1b4('0x10')](0x1f4,_0x450053['message']));});});}; \ No newline at end of file +var _0x276e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','model','map','then','stringify','find','ShowServicenowAccount','util','moment'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x276e,0x1a2));var _0xe276=function(_0x1460f6,_0x59051a){_0x1460f6=_0x1460f6-0x0;var _0x46ce94=_0x276e[_0x1460f6];return _0x46ce94;};'use strict';var _=require('lodash');var util=require(_0xe276('0x0'));var moment=require(_0xe276('0x1'));var BPromise=require(_0xe276('0x2'));var rs=require(_0xe276('0x3'));var fs=require('fs');var Redis=require(_0xe276('0x4'));var db=require(_0xe276('0x5'))['db'];var utils=require(_0xe276('0x6'));var logger=require(_0xe276('0x7'))(_0xe276('0x8'));var config=require('../../config/environment');var jayson=require(_0xe276('0x9'));var client=jayson[_0xe276('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x762003,_0x242caa,_0xc61733){return new BPromise(function(_0x8a2f71,_0x1f79ea){return client[_0xe276('0xb')](_0x762003,_0xc61733)['then'](function(_0x3babaf){logger[_0xe276('0xc')](_0xe276('0xd'),_0x242caa,_0xe276('0xe'));logger[_0xe276('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x242caa,_0xe276('0xe'),JSON['stringify'](_0x3babaf));if(_0x3babaf[_0xe276('0x10')]){if(_0x3babaf[_0xe276('0x10')][_0xe276('0x11')]===0x1f4){logger['error'](_0xe276('0xd'),_0x242caa,_0x3babaf['error'][_0xe276('0x12')]);return _0x1f79ea(_0x3babaf['error'][_0xe276('0x12')]);}logger[_0xe276('0x10')](_0xe276('0xd'),_0x242caa,_0x3babaf[_0xe276('0x10')][_0xe276('0x12')]);return _0x8a2f71(_0x3babaf['error']['message']);}else{logger[_0xe276('0xc')](_0xe276('0xd'),_0x242caa,'request\x20sent');_0x8a2f71(_0x3babaf[_0xe276('0x13')][_0xe276('0x12')]);}})[_0xe276('0x14')](function(_0x596032){logger[_0xe276('0x10')](_0xe276('0xd'),_0x242caa,_0x596032);_0x1f79ea(_0x596032);});});}exports[_0xe276('0x15')]=function(_0x931d29){var _0x3eeab5=this;return new Promise(function(_0x51c6fd,_0x29814f){return db[_0xe276('0x16')][_0xe276('0x17')]({'raw':_0x931d29['options']?_0x931d29[_0xe276('0x18')][_0xe276('0x19')]===undefined?!![]:![]:!![],'where':_0x931d29[_0xe276('0x18')]?_0x931d29[_0xe276('0x18')][_0xe276('0x1a')]||null:null,'attributes':_0x931d29[_0xe276('0x18')]?_0x931d29[_0xe276('0x18')][_0xe276('0x1b')]||null:null,'limit':_0x931d29[_0xe276('0x18')]?_0x931d29['options']['limit']||null:null,'include':_0x931d29[_0xe276('0x18')]?_0x931d29['options'][_0xe276('0x1c')]?_['map'](_0x931d29[_0xe276('0x18')]['include'],function(_0x59b8fa){return{'model':db[_0x59b8fa[_0xe276('0x1d')]],'as':_0x59b8fa['as'],'attributes':_0x59b8fa[_0xe276('0x1b')],'include':_0x59b8fa[_0xe276('0x1c')]?_[_0xe276('0x1e')](_0x59b8fa[_0xe276('0x1c')],function(_0x2c1cce){return{'model':db[_0x2c1cce[_0xe276('0x1d')]],'as':_0x2c1cce['as'],'attributes':_0x2c1cce[_0xe276('0x1b')],'include':_0x2c1cce[_0xe276('0x1c')]?_[_0xe276('0x1e')](_0x2c1cce[_0xe276('0x1c')],function(_0xb5ca33){return{'model':db[_0xb5ca33[_0xe276('0x1d')]],'as':_0xb5ca33['as'],'attributes':_0xb5ca33['attributes']};}):[]};}):[]};}):[]:[]})[_0xe276('0x1f')](function(_0x5b8beb){logger['info'](_0xe276('0x15'),_0x931d29);logger[_0xe276('0xf')]('GetServicenowAccount',_0x931d29,JSON[_0xe276('0x20')](_0x5b8beb));_0x51c6fd(_0x5b8beb);})[_0xe276('0x14')](function(_0xd20c5e){logger[_0xe276('0x10')](_0xe276('0x15'),_0xd20c5e[_0xe276('0x12')],_0x931d29);_0x29814f(_0x3eeab5[_0xe276('0x10')](0x1f4,_0xd20c5e[_0xe276('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x5da7a3){var _0x4beabd=this;return new Promise(function(_0xcf6ecc,_0x2a581c){return db[_0xe276('0x16')][_0xe276('0x21')]({'raw':_0x5da7a3[_0xe276('0x18')]?_0x5da7a3['options'][_0xe276('0x19')]===undefined?!![]:![]:!![],'where':_0x5da7a3[_0xe276('0x18')]?_0x5da7a3[_0xe276('0x18')][_0xe276('0x1a')]||null:null,'attributes':_0x5da7a3[_0xe276('0x18')]?_0x5da7a3[_0xe276('0x18')][_0xe276('0x1b')]||null:null,'include':_0x5da7a3[_0xe276('0x18')]?_0x5da7a3[_0xe276('0x18')]['include']?_[_0xe276('0x1e')](_0x5da7a3[_0xe276('0x18')][_0xe276('0x1c')],function(_0x4a0400){return{'model':db[_0x4a0400['model']],'as':_0x4a0400['as'],'attributes':_0x4a0400[_0xe276('0x1b')],'include':_0x4a0400[_0xe276('0x1c')]?_['map'](_0x4a0400[_0xe276('0x1c')],function(_0x32e31b){return{'model':db[_0x32e31b[_0xe276('0x1d')]],'as':_0x32e31b['as'],'attributes':_0x32e31b[_0xe276('0x1b')],'include':_0x32e31b[_0xe276('0x1c')]?_[_0xe276('0x1e')](_0x32e31b['include'],function(_0x38e0d4){return{'model':db[_0x38e0d4[_0xe276('0x1d')]],'as':_0x38e0d4['as'],'attributes':_0x38e0d4[_0xe276('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe276('0x1f')](function(_0x2a0b21){logger[_0xe276('0xc')]('ShowServicenowAccount',_0x5da7a3);logger[_0xe276('0xf')]('ShowServicenowAccount',_0x5da7a3,JSON['stringify'](_0x2a0b21));_0xcf6ecc(_0x2a0b21);})[_0xe276('0x14')](function(_0x2003d0){logger['error'](_0xe276('0x22'),_0x2003d0[_0xe276('0x12')],_0x5da7a3);_0x2a581c(_0x4beabd[_0xe276('0x10')](0x1f4,_0x2003d0['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2a6ebd5..f5432ce 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a8e=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update'];(function(_0x2f80e3,_0x597c16){var _0x818c13=function(_0x45def){while(--_0x45def){_0x2f80e3['push'](_0x2f80e3['shift']());}};_0x818c13(++_0x597c16);}(_0x0a8e,0xb1));var _0xe0a8=function(_0x3c2b73,_0x56ad42){_0x3c2b73=_0x3c2b73-0x0;var _0x530b46=_0x0a8e[_0x3c2b73];return _0x530b46;};'use strict';var multer=require(_0xe0a8('0x0'));var util=require(_0xe0a8('0x1'));var path=require(_0xe0a8('0x2'));var timeout=require(_0xe0a8('0x3'));var express=require('express');var router=express[_0xe0a8('0x4')]();var fs_extra=require(_0xe0a8('0x5'));var auth=require(_0xe0a8('0x6'));var interaction=require(_0xe0a8('0x7'));var config=require(_0xe0a8('0x8'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe0a8('0x9')](_0xe0a8('0xa'),auth[_0xe0a8('0xb')](),controller[_0xe0a8('0xc')]);router[_0xe0a8('0x9')](_0xe0a8('0xd'),auth['isAuthenticated'](),controller[_0xe0a8('0xe')]);router[_0xe0a8('0x9')](_0xe0a8('0xf'),auth[_0xe0a8('0xb')](),controller[_0xe0a8('0x10')]);router[_0xe0a8('0x9')](_0xe0a8('0x11'),auth[_0xe0a8('0xb')](),controller['getDescriptions']);router[_0xe0a8('0x12')]('/',auth[_0xe0a8('0xb')](),controller['create']);router[_0xe0a8('0x13')](_0xe0a8('0xa'),auth[_0xe0a8('0xb')](),controller[_0xe0a8('0x14')]);router['delete'](_0xe0a8('0xa'),auth['isAuthenticated'](),controller[_0xe0a8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x8528=['put','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','create'];(function(_0xb8f388,_0x255bb0){var _0x556c7b=function(_0x1a1fa9){while(--_0x1a1fa9){_0xb8f388['push'](_0xb8f388['shift']());}};_0x556c7b(++_0x255bb0);}(_0x8528,0x8b));var _0x8852=function(_0x30dac4,_0x2f6cf4){_0x30dac4=_0x30dac4-0x0;var _0x91846f=_0x8528[_0x30dac4];return _0x91846f;};'use strict';var multer=require(_0x8852('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8852('0x1'));var express=require(_0x8852('0x2'));var router=express['Router']();var fs_extra=require(_0x8852('0x3'));var auth=require(_0x8852('0x4'));var interaction=require(_0x8852('0x5'));var config=require('../../config/environment');var controller=require(_0x8852('0x6'));router[_0x8852('0x7')]('/',auth[_0x8852('0x8')](),controller[_0x8852('0x9')]);router['get'](_0x8852('0xa'),auth[_0x8852('0x8')](),controller['show']);router[_0x8852('0x7')]('/:id/fields',auth[_0x8852('0x8')](),controller['getFields']);router[_0x8852('0x7')](_0x8852('0xb'),auth[_0x8852('0x8')](),controller[_0x8852('0xc')]);router[_0x8852('0x7')]('/:id/descriptions',auth[_0x8852('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x8852('0x8')](),controller[_0x8852('0xd')]);router[_0x8852('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8852('0xf')](_0x8852('0xa'),auth['isAuthenticated'](),controller[_0x8852('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index cd0b2f3..d164387 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb336=['sequelize','exports','STRING'];(function(_0x34c187,_0x249c9d){var _0x42e793=function(_0x5b436d){while(--_0x5b436d){_0x34c187['push'](_0x34c187['shift']());}};_0x42e793(++_0x249c9d);}(_0xb336,0x1f2));var _0x6b33=function(_0x40939b,_0x2f37a5){_0x40939b=_0x40939b-0x0;var _0x21e73b=_0xb336[_0x40939b];return _0x21e73b;};'use strict';var Sequelize=require(_0x6b33('0x0'));module[_0x6b33('0x1')]={'name':{'type':Sequelize[_0x6b33('0x2')]},'description':{'type':Sequelize[_0x6b33('0x2')]}}; \ No newline at end of file +var _0x1269=['exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1269,0x174));var _0x9126=function(_0x7671bc,_0x171145){_0x7671bc=_0x7671bc-0x0;var _0x55229f=_0x1269[_0x7671bc];return _0x55229f;};'use strict';var Sequelize=require('sequelize');module[_0x9126('0x0')]={'name':{'type':Sequelize[_0x9126('0x1')]},'description':{'type':Sequelize[_0x9126('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d4e8038..ca4f1d4 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14e8=['util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','stack','name','merge','body','contact','interaction','account','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','update','destroy','findOne','order','filter','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14e8,0x11b));var _0x814e=function(_0x2d6f38,_0x9c35ad){_0x2d6f38=_0x2d6f38-0x0;var _0x36c329=_0x14e8[_0x2d6f38];return _0x36c329;};'use strict';var emlformat=require(_0x814e('0x0'));var rimraf=require(_0x814e('0x1'));var zipdir=require(_0x814e('0x2'));var jsonpatch=require(_0x814e('0x3'));var rp=require(_0x814e('0x4'));var moment=require(_0x814e('0x5'));var BPromise=require(_0x814e('0x6'));var Mustache=require(_0x814e('0x7'));var util=require(_0x814e('0x8'));var path=require(_0x814e('0x9'));var sox=require(_0x814e('0xa'));var csv=require('to-csv');var ejs=require(_0x814e('0xb'));var fs=require('fs');var fs_extra=require(_0x814e('0xc'));var _=require(_0x814e('0xd'));var squel=require('squel');var crypto=require(_0x814e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x814e('0xf'));var toCsv=require(_0x814e('0x10'));var querystring=require('querystring');var Papa=require(_0x814e('0x11'));var Redis=require(_0x814e('0x12'));var authService=require(_0x814e('0x13'));var qs=require(_0x814e('0x14'));var as=require(_0x814e('0x15'));var hardwareService=require(_0x814e('0x16'));var logger=require(_0x814e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x814e('0x18'));var licenseUtil=require(_0x814e('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x814e('0x1a')][_0x814e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x954f8f,_0x144095,_0x17f205,_0x50fbad){return new BPromise(function(_0x2e7d87,_0x1d074d){var _0x111e46=_0x50fbad||client;return _0x111e46[_0x814e('0x1c')](_0x954f8f,_0x17f205)[_0x814e('0x1d')](function(_0x3e6e35){logger['info'](_0x814e('0x1e'),_0x144095,'request\x20sent');logger['debug'](_0x814e('0x1f'),_0x144095,_0x814e('0x20'),JSON[_0x814e('0x21')](_0x3e6e35));if(_0x3e6e35['error']){if(_0x3e6e35['error'][_0x814e('0x22')]===0x1f4){logger[_0x814e('0x23')](_0x814e('0x1e'),_0x144095,_0x3e6e35['error'][_0x814e('0x24')]);return _0x1d074d(_0x3e6e35[_0x814e('0x23')][_0x814e('0x24')]);}logger[_0x814e('0x23')](_0x814e('0x1e'),_0x144095,_0x3e6e35[_0x814e('0x23')][_0x814e('0x24')]);return _0x2e7d87(_0x3e6e35[_0x814e('0x23')][_0x814e('0x24')]);}else{logger[_0x814e('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x144095,_0x814e('0x20'));_0x2e7d87(_0x3e6e35[_0x814e('0x26')][_0x814e('0x24')]);}})['catch'](function(_0x426ae5){logger['error'](_0x814e('0x1e'),_0x144095,_0x426ae5);_0x1d074d(_0x426ae5);});});}function respondWithStatusCode(_0x4ed7b1,_0x52da99){_0x52da99=_0x52da99||0xcc;return function(_0x2c4009){if(_0x2c4009){return _0x4ed7b1[_0x814e('0x27')](_0x52da99);}return _0x4ed7b1['status'](_0x52da99)[_0x814e('0x28')]();};}function respondWithResult(_0x6486b8,_0x2a45ed){_0x2a45ed=_0x2a45ed||0xc8;return function(_0xe8d3db){if(_0xe8d3db){return _0x6486b8['status'](_0x2a45ed)[_0x814e('0x29')](_0xe8d3db);}};}function respondWithFilteredResult(_0x4745d2,_0x32e595){return function(_0x50d244){if(_0x50d244){var _0x384a7e=typeof _0x32e595[_0x814e('0x2a')]===_0x814e('0x2b')&&typeof _0x32e595[_0x814e('0x2c')]===_0x814e('0x2b');var _0xb0c822=_0x50d244['count'];var _0x54d907=_0x384a7e?0x0:_0x32e595['offset'];var _0x42b307=_0x384a7e?_0x50d244[_0x814e('0x2d')]:_0x32e595['offset']+_0x32e595['limit'];var _0x2a1763;if(_0x42b307>=_0xb0c822){_0x42b307=_0xb0c822;_0x2a1763=0xc8;}else{_0x2a1763=0xce;}_0x4745d2[_0x814e('0x2e')](_0x2a1763);return _0x4745d2[_0x814e('0x2f')](_0x814e('0x30'),_0x54d907+'-'+_0x42b307+'/'+_0xb0c822)[_0x814e('0x29')](_0x50d244);}return null;};}function patchUpdates(_0x2f1fcd){return function(_0x1810dd){try{jsonpatch['apply'](_0x1810dd,_0x2f1fcd,!![]);}catch(_0x42adcb){return BPromise[_0x814e('0x31')](_0x42adcb);}return _0x1810dd[_0x814e('0x32')]();};}function saveUpdates(_0x16e0a9,_0x5524d9){return function(_0x32fe96){if(_0x32fe96){return _0x32fe96['update'](_0x16e0a9)[_0x814e('0x1d')](function(_0x3569bf){return _0x3569bf;});}return null;};}function removeEntity(_0x12b2c7,_0x23bb1f){return function(_0x5ad90c){if(_0x5ad90c){return _0x5ad90c['destroy']()[_0x814e('0x1d')](function(){_0x12b2c7[_0x814e('0x2e')](0xcc)[_0x814e('0x28')]();});}};}function handleEntityNotFound(_0x44be47,_0x2ec68c){return function(_0x565257){if(!_0x565257){_0x44be47[_0x814e('0x27')](0x194);}return _0x565257;};}function handleError(_0x5749f4,_0x47c54f){_0x47c54f=_0x47c54f||0x1f4;return function(_0x3f43e6){logger[_0x814e('0x23')](_0x3f43e6[_0x814e('0x33')]);if(_0x3f43e6[_0x814e('0x34')]){delete _0x3f43e6['name'];}_0x5749f4['status'](_0x47c54f)['send'](_0x3f43e6);};}function getMustacheRender(_0x96a082,_0xdb4746){return Mustache['render'](_0x96a082,_[_0x814e('0x35')](_0xdb4746[_0x814e('0x36')],{'contact':_0xdb4746[_0x814e('0x37')],'message':_0xdb4746[_0x814e('0x24')],'agent':_0xdb4746['agent'],'interaction':_0xdb4746[_0x814e('0x38')],'account':_0xdb4746[_0x814e('0x39')]}))||'';}exports[_0x814e('0x3a')]=function(_0x45215c,_0x1a6f07){var _0x53a16b={},_0x3b0e57={},_0x1dfff4={'count':0x0,'rows':[]};var _0xf80ac6=_['map'](db[_0x814e('0x3b')][_0x814e('0x3c')],function(_0x5813fe){return{'name':_0x5813fe[_0x814e('0x3d')],'type':_0x5813fe[_0x814e('0x3e')]['key']};});_0x3b0e57[_0x814e('0x3f')]=_['map'](_0xf80ac6,_0x814e('0x34'));_0x3b0e57['query']=_[_0x814e('0x40')](_0x45215c[_0x814e('0x41')]);_0x3b0e57[_0x814e('0x42')]=_['intersection'](_0x3b0e57[_0x814e('0x3f')],_0x3b0e57[_0x814e('0x41')]);_0x53a16b[_0x814e('0x43')]=_[_0x814e('0x44')](_0x3b0e57[_0x814e('0x3f')],qs[_0x814e('0x45')](_0x45215c['query'][_0x814e('0x45')]));_0x53a16b[_0x814e('0x43')]=_0x53a16b[_0x814e('0x43')]['length']?_0x53a16b[_0x814e('0x43')]:_0x3b0e57[_0x814e('0x3f')];if(!_0x45215c[_0x814e('0x41')][_0x814e('0x46')](_0x814e('0x47'))){_0x53a16b[_0x814e('0x2c')]=qs[_0x814e('0x2c')](_0x45215c['query'][_0x814e('0x2c')]);_0x53a16b[_0x814e('0x2a')]=qs['offset'](_0x45215c[_0x814e('0x41')][_0x814e('0x2a')]);}_0x53a16b['order']=qs['sort'](_0x45215c['query'][_0x814e('0x48')]);_0x53a16b[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0x45215c[_0x814e('0x41')],_0x3b0e57[_0x814e('0x42')]),_0xf80ac6);if(_0x45215c['query']['filter']){_0x53a16b[_0x814e('0x49')]=_['merge'](_0x53a16b[_0x814e('0x49')],{'$or':_[_0x814e('0x4b')](_0xf80ac6,function(_0x3c0151){if(_0x3c0151['type']!==_0x814e('0x4c')){var _0x414d27={};_0x414d27[_0x3c0151[_0x814e('0x34')]]={'$like':'%'+_0x45215c[_0x814e('0x41')]['filter']+'%'};return _0x414d27;}})});}_0x53a16b=_['merge']({},_0x53a16b,_0x45215c['options']);var _0x18476f={'where':_0x53a16b[_0x814e('0x49')]};return db[_0x814e('0x3b')][_0x814e('0x2d')](_0x18476f)[_0x814e('0x1d')](function(_0x1a8a0a){_0x1dfff4[_0x814e('0x2d')]=_0x1a8a0a;if(_0x45215c[_0x814e('0x41')][_0x814e('0x4d')]){_0x53a16b[_0x814e('0x4e')]=[{'all':!![]}];}return db[_0x814e('0x3b')][_0x814e('0x4f')](_0x53a16b);})['then'](function(_0xa4257f){_0x1dfff4[_0x814e('0x50')]=_0xa4257f;return _0x1dfff4;})[_0x814e('0x1d')](respondWithFilteredResult(_0x1a6f07,_0x53a16b))[_0x814e('0x51')](handleError(_0x1a6f07,null));};exports[_0x814e('0x52')]=function(_0x448980,_0x37e782){var _0x3b0db6={'raw':![],'where':{'id':_0x448980[_0x814e('0x53')]['id']}},_0x29542a={};_0x29542a[_0x814e('0x3f')]=_[_0x814e('0x40')](db[_0x814e('0x3b')]['rawAttributes']);_0x29542a['query']=_['keys'](_0x448980[_0x814e('0x41')]);_0x29542a[_0x814e('0x42')]=_['intersection'](_0x29542a[_0x814e('0x3f')],_0x29542a['query']);_0x3b0db6[_0x814e('0x43')]=_[_0x814e('0x44')](_0x29542a[_0x814e('0x3f')],qs[_0x814e('0x45')](_0x448980[_0x814e('0x41')][_0x814e('0x45')]));_0x3b0db6[_0x814e('0x43')]=_0x3b0db6[_0x814e('0x43')][_0x814e('0x54')]?_0x3b0db6['attributes']:_0x29542a[_0x814e('0x3f')];if(_0x448980['query'][_0x814e('0x4d')]){_0x3b0db6['include']=[{'all':!![]}];}_0x3b0db6=_[_0x814e('0x35')]({},_0x3b0db6,_0x448980[_0x814e('0x55')]);return db[_0x814e('0x3b')][_0x814e('0x56')](_0x3b0db6)['then'](handleEntityNotFound(_0x37e782,null))[_0x814e('0x1d')](respondWithResult(_0x37e782,null))[_0x814e('0x51')](handleError(_0x37e782,null));};exports['create']=function(_0x2af8e1,_0x32e23e){return db[_0x814e('0x3b')][_0x814e('0x57')](_0x2af8e1[_0x814e('0x36')],{})[_0x814e('0x1d')](respondWithResult(_0x32e23e,0xc9))[_0x814e('0x51')](handleError(_0x32e23e,null));};exports[_0x814e('0x58')]=function(_0x143912,_0x17c92c){if(_0x143912[_0x814e('0x36')]['id']){delete _0x143912[_0x814e('0x36')]['id'];}return db[_0x814e('0x3b')]['find']({'where':{'id':_0x143912['params']['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x17c92c,null))[_0x814e('0x1d')](saveUpdates(_0x143912[_0x814e('0x36')],null))[_0x814e('0x1d')](respondWithResult(_0x17c92c,null))['catch'](handleError(_0x17c92c,null));};exports[_0x814e('0x59')]=function(_0x20f191,_0x1cab7c){return db[_0x814e('0x3b')][_0x814e('0x56')]({'where':{'id':_0x20f191[_0x814e('0x53')]['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x1cab7c,null))[_0x814e('0x1d')](removeEntity(_0x1cab7c,null))[_0x814e('0x51')](handleError(_0x1cab7c,null));};exports['getFields']=function(_0xf350eb,_0x55e293,_0x13c561){var _0x309358={};var _0xa8c972={};var _0x180332;var _0x50b751;return db[_0x814e('0x3b')][_0x814e('0x5a')]({'where':{'id':_0xf350eb['params']['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x55e293,null))[_0x814e('0x1d')](function(_0x3b5390){if(_0x3b5390){_0x180332=_0x3b5390;_0xa8c972[_0x814e('0x3f')]=_[_0x814e('0x40')](db['ServicenowField'][_0x814e('0x3c')]);_0xa8c972[_0x814e('0x41')]=_[_0x814e('0x40')](_0xf350eb[_0x814e('0x41')]);_0xa8c972[_0x814e('0x42')]=_['intersection'](_0xa8c972[_0x814e('0x3f')],_0xa8c972['query']);_0x309358[_0x814e('0x43')]=_['intersection'](_0xa8c972[_0x814e('0x3f')],qs[_0x814e('0x45')](_0xf350eb[_0x814e('0x41')][_0x814e('0x45')]));_0x309358[_0x814e('0x43')]=_0x309358[_0x814e('0x43')][_0x814e('0x54')]?_0x309358[_0x814e('0x43')]:_0xa8c972[_0x814e('0x3f')];_0x309358[_0x814e('0x5b')]=qs[_0x814e('0x48')](_0xf350eb[_0x814e('0x41')]['sort']);_0x309358[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0xf350eb[_0x814e('0x41')],_0xa8c972[_0x814e('0x42')]));if(_0xf350eb[_0x814e('0x41')][_0x814e('0x5c')]){_0x309358['where']=_['merge'](_0x309358['where'],{'$or':_[_0x814e('0x4b')](_0x309358[_0x814e('0x43')],function(_0x1da58d){var _0x4d4c4a={};_0x4d4c4a[_0x1da58d]={'$like':'%'+_0xf350eb[_0x814e('0x41')]['filter']+'%'};return _0x4d4c4a;})});}_0x309358=_[_0x814e('0x35')]({},_0x309358,_0xf350eb[_0x814e('0x55')]);return _0x180332[_0x814e('0x5d')](_0x309358);}})[_0x814e('0x1d')](function(_0x426aea){if(_0x426aea){_0x50b751=_0x426aea[_0x814e('0x54')];if(!_0xf350eb['query']['hasOwnProperty'](_0x814e('0x47'))){_0x309358[_0x814e('0x2c')]=qs['limit'](_0xf350eb[_0x814e('0x41')][_0x814e('0x2c')]);_0x309358[_0x814e('0x2a')]=qs[_0x814e('0x2a')](_0xf350eb[_0x814e('0x41')][_0x814e('0x2a')]);}return _0x180332[_0x814e('0x5d')](_0x309358);}})[_0x814e('0x1d')](function(_0x38f61e){if(_0x38f61e){return _0x38f61e?{'count':_0x50b751,'rows':_0x38f61e}:null;}})[_0x814e('0x1d')](respondWithResult(_0x55e293,null))[_0x814e('0x51')](handleError(_0x55e293,null));};exports[_0x814e('0x5e')]=function(_0xd954c6,_0x1be7be,_0x3b5255){var _0x2fd954={};var _0x44a7a4={};var _0x317e25;var _0x52b0e0;return db[_0x814e('0x3b')]['findOne']({'where':{'id':_0xd954c6[_0x814e('0x53')]['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x1be7be,null))[_0x814e('0x1d')](function(_0x587523){if(_0x587523){_0x317e25=_0x587523;_0x44a7a4[_0x814e('0x3f')]=_['keys'](db[_0x814e('0x5f')][_0x814e('0x3c')]);_0x44a7a4[_0x814e('0x41')]=_[_0x814e('0x40')](_0xd954c6[_0x814e('0x41')]);_0x44a7a4[_0x814e('0x42')]=_['intersection'](_0x44a7a4[_0x814e('0x3f')],_0x44a7a4['query']);_0x2fd954['attributes']=_[_0x814e('0x44')](_0x44a7a4[_0x814e('0x3f')],qs[_0x814e('0x45')](_0xd954c6['query'][_0x814e('0x45')]));_0x2fd954[_0x814e('0x43')]=_0x2fd954[_0x814e('0x43')]['length']?_0x2fd954[_0x814e('0x43')]:_0x44a7a4[_0x814e('0x3f')];_0x2fd954['order']=qs['sort'](_0xd954c6[_0x814e('0x41')][_0x814e('0x48')]);_0x2fd954[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0xd954c6['query'],_0x44a7a4['filters']));if(_0xd954c6[_0x814e('0x41')]['filter']){_0x2fd954[_0x814e('0x49')]=_[_0x814e('0x35')](_0x2fd954['where'],{'$or':_[_0x814e('0x4b')](_0x2fd954['attributes'],function(_0x50cb2c){var _0x28d20a={};_0x28d20a[_0x50cb2c]={'$like':'%'+_0xd954c6['query'][_0x814e('0x5c')]+'%'};return _0x28d20a;})});}_0x2fd954=_[_0x814e('0x35')]({},_0x2fd954,_0xd954c6[_0x814e('0x55')]);return _0x317e25[_0x814e('0x5e')](_0x2fd954);}})[_0x814e('0x1d')](function(_0x3ea007){if(_0x3ea007){_0x52b0e0=_0x3ea007[_0x814e('0x54')];if(!_0xd954c6[_0x814e('0x41')]['hasOwnProperty']('nolimit')){_0x2fd954[_0x814e('0x2c')]=qs[_0x814e('0x2c')](_0xd954c6[_0x814e('0x41')][_0x814e('0x2c')]);_0x2fd954['offset']=qs[_0x814e('0x2a')](_0xd954c6['query'][_0x814e('0x2a')]);}return _0x317e25['getSubjects'](_0x2fd954);}})['then'](function(_0x25d27c){if(_0x25d27c){return _0x25d27c?{'count':_0x52b0e0,'rows':_0x25d27c}:null;}})[_0x814e('0x1d')](respondWithResult(_0x1be7be,null))['catch'](handleError(_0x1be7be,null));};exports[_0x814e('0x60')]=function(_0x26fdca,_0x4ba39d,_0x1520d6){var _0x13a032={};var _0x33fe08={};var _0x2c5540;var _0x172e6a;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x26fdca['params']['id']}})[_0x814e('0x1d')](handleEntityNotFound(_0x4ba39d,null))['then'](function(_0x12b9d5){if(_0x12b9d5){_0x2c5540=_0x12b9d5;_0x33fe08[_0x814e('0x3f')]=_[_0x814e('0x40')](db[_0x814e('0x5f')]['rawAttributes']);_0x33fe08[_0x814e('0x41')]=_[_0x814e('0x40')](_0x26fdca['query']);_0x33fe08['filters']=_[_0x814e('0x44')](_0x33fe08[_0x814e('0x3f')],_0x33fe08['query']);_0x13a032[_0x814e('0x43')]=_[_0x814e('0x44')](_0x33fe08[_0x814e('0x3f')],qs[_0x814e('0x45')](_0x26fdca[_0x814e('0x41')][_0x814e('0x45')]));_0x13a032[_0x814e('0x43')]=_0x13a032[_0x814e('0x43')][_0x814e('0x54')]?_0x13a032[_0x814e('0x43')]:_0x33fe08[_0x814e('0x3f')];_0x13a032[_0x814e('0x5b')]=qs[_0x814e('0x48')](_0x26fdca[_0x814e('0x41')]['sort']);_0x13a032[_0x814e('0x49')]=qs[_0x814e('0x42')](_[_0x814e('0x4a')](_0x26fdca[_0x814e('0x41')],_0x33fe08[_0x814e('0x42')]));if(_0x26fdca[_0x814e('0x41')][_0x814e('0x5c')]){_0x13a032[_0x814e('0x49')]=_[_0x814e('0x35')](_0x13a032['where'],{'$or':_['map'](_0x13a032[_0x814e('0x43')],function(_0x18a519){var _0x39fb86={};_0x39fb86[_0x18a519]={'$like':'%'+_0x26fdca[_0x814e('0x41')][_0x814e('0x5c')]+'%'};return _0x39fb86;})});}_0x13a032=_[_0x814e('0x35')]({},_0x13a032,_0x26fdca[_0x814e('0x55')]);return _0x2c5540['getDescriptions'](_0x13a032);}})[_0x814e('0x1d')](function(_0x2492cd){if(_0x2492cd){_0x172e6a=_0x2492cd['length'];if(!_0x26fdca[_0x814e('0x41')]['hasOwnProperty'](_0x814e('0x47'))){_0x13a032[_0x814e('0x2c')]=qs[_0x814e('0x2c')](_0x26fdca[_0x814e('0x41')][_0x814e('0x2c')]);_0x13a032[_0x814e('0x2a')]=qs['offset'](_0x26fdca[_0x814e('0x41')]['offset']);}return _0x2c5540[_0x814e('0x60')](_0x13a032);}})['then'](function(_0x4c2dae){if(_0x4c2dae){return _0x4c2dae?{'count':_0x172e6a,'rows':_0x4c2dae}:null;}})[_0x814e('0x1d')](respondWithResult(_0x4ba39d,null))[_0x814e('0x51')](handleError(_0x4ba39d,null));}; \ No newline at end of file +var _0x9703=['rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','options','includeAll','include','findAll','params','keys','find','create','update','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','end','name','send','render','merge','contact','agent','account','index','map','ServicenowConfiguration'];(function(_0x482c95,_0x504190){var _0x38c2e8=function(_0x5685df){while(--_0x5685df){_0x482c95['push'](_0x482c95['shift']());}};_0x38c2e8(++_0x504190);}(_0x9703,0x7d));var _0x3970=function(_0x17fd65,_0x556d01){_0x17fd65=_0x17fd65-0x0;var _0x27d033=_0x9703[_0x17fd65];return _0x27d033;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3970('0x0'));var zipdir=require(_0x3970('0x1'));var jsonpatch=require(_0x3970('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3970('0x3'));var Mustache=require(_0x3970('0x4'));var util=require(_0x3970('0x5'));var path=require(_0x3970('0x6'));var sox=require('sox');var csv=require(_0x3970('0x7'));var ejs=require(_0x3970('0x8'));var fs=require('fs');var fs_extra=require(_0x3970('0x9'));var _=require(_0x3970('0xa'));var squel=require(_0x3970('0xb'));var crypto=require('crypto');var jsforce=require(_0x3970('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3970('0x7'));var querystring=require('querystring');var Papa=require(_0x3970('0xd'));var Redis=require(_0x3970('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3970('0xf'));var as=require(_0x3970('0x10'));var hardwareService=require(_0x3970('0x11'));var logger=require(_0x3970('0x12'))(_0x3970('0x13'));var utils=require('../../config/utils');var config=require(_0x3970('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3970('0x15'))['db'];var jayson=require(_0x3970('0x16'));var client=jayson['client'][_0x3970('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4537ba,_0x2e267e,_0x307244,_0x1c85b4){return new BPromise(function(_0x338103,_0x1c6819){var _0x3cbb21=_0x1c85b4||client;return _0x3cbb21[_0x3970('0x18')](_0x4537ba,_0x307244)['then'](function(_0x3736b6){logger[_0x3970('0x19')](_0x3970('0x1a'),_0x2e267e,'request\x20sent');logger['debug'](_0x3970('0x1b'),_0x2e267e,_0x3970('0x1c'),JSON[_0x3970('0x1d')](_0x3736b6));if(_0x3736b6[_0x3970('0x1e')]){if(_0x3736b6['error'][_0x3970('0x1f')]===0x1f4){logger[_0x3970('0x1e')](_0x3970('0x1a'),_0x2e267e,_0x3736b6[_0x3970('0x1e')][_0x3970('0x20')]);return _0x1c6819(_0x3736b6[_0x3970('0x1e')][_0x3970('0x20')]);}logger[_0x3970('0x1e')](_0x3970('0x1a'),_0x2e267e,_0x3736b6[_0x3970('0x1e')][_0x3970('0x20')]);return _0x338103(_0x3736b6[_0x3970('0x1e')][_0x3970('0x20')]);}else{logger['info'](_0x3970('0x1a'),_0x2e267e,_0x3970('0x1c'));_0x338103(_0x3736b6[_0x3970('0x21')]['message']);}})[_0x3970('0x22')](function(_0x3dd3f6){logger[_0x3970('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2e267e,_0x3dd3f6);_0x1c6819(_0x3dd3f6);});});}function respondWithStatusCode(_0x181d24,_0x441dad){_0x441dad=_0x441dad||0xcc;return function(_0x3e56d3){if(_0x3e56d3){return _0x181d24[_0x3970('0x23')](_0x441dad);}return _0x181d24[_0x3970('0x24')](_0x441dad)['end']();};}function respondWithResult(_0x399084,_0xfad2a0){_0xfad2a0=_0xfad2a0||0xc8;return function(_0x2b9c14){if(_0x2b9c14){return _0x399084[_0x3970('0x24')](_0xfad2a0)['json'](_0x2b9c14);}};}function respondWithFilteredResult(_0x2c838a,_0x381a51){return function(_0x1bb6c7){if(_0x1bb6c7){var _0x5b427d=typeof _0x381a51['offset']===_0x3970('0x25')&&typeof _0x381a51['limit']==='undefined';var _0x31445a=_0x1bb6c7[_0x3970('0x26')];var _0x11b3e5=_0x5b427d?0x0:_0x381a51[_0x3970('0x27')];var _0x303262=_0x5b427d?_0x1bb6c7[_0x3970('0x26')]:_0x381a51[_0x3970('0x27')]+_0x381a51[_0x3970('0x28')];var _0x571576;if(_0x303262>=_0x31445a){_0x303262=_0x31445a;_0x571576=0xc8;}else{_0x571576=0xce;}_0x2c838a['status'](_0x571576);return _0x2c838a[_0x3970('0x29')](_0x3970('0x2a'),_0x11b3e5+'-'+_0x303262+'/'+_0x31445a)[_0x3970('0x2b')](_0x1bb6c7);}return null;};}function patchUpdates(_0x2dbce7){return function(_0x57627f){try{jsonpatch[_0x3970('0x2c')](_0x57627f,_0x2dbce7,!![]);}catch(_0x48cbc7){return BPromise[_0x3970('0x2d')](_0x48cbc7);}return _0x57627f['save']();};}function saveUpdates(_0xef8176,_0x10efa7){return function(_0x4cd4e4){if(_0x4cd4e4){return _0x4cd4e4['update'](_0xef8176)['then'](function(_0x42f74b){return _0x42f74b;});}return null;};}function removeEntity(_0x30a545,_0x4d7ceb){return function(_0x55a16f){if(_0x55a16f){return _0x55a16f[_0x3970('0x2e')]()[_0x3970('0x2f')](function(){_0x30a545[_0x3970('0x24')](0xcc)[_0x3970('0x30')]();});}};}function handleEntityNotFound(_0x106068,_0x3c1685){return function(_0x584126){if(!_0x584126){_0x106068[_0x3970('0x23')](0x194);}return _0x584126;};}function handleError(_0x346532,_0x2e6790){_0x2e6790=_0x2e6790||0x1f4;return function(_0x520671){logger[_0x3970('0x1e')](_0x520671['stack']);if(_0x520671[_0x3970('0x31')]){delete _0x520671[_0x3970('0x31')];}_0x346532[_0x3970('0x24')](_0x2e6790)[_0x3970('0x32')](_0x520671);};}function getMustacheRender(_0x5288ac,_0x541722){return Mustache[_0x3970('0x33')](_0x5288ac,_[_0x3970('0x34')](_0x541722['body'],{'contact':_0x541722[_0x3970('0x35')],'message':_0x541722[_0x3970('0x20')],'agent':_0x541722[_0x3970('0x36')],'interaction':_0x541722['interaction'],'account':_0x541722[_0x3970('0x37')]}))||'';}exports[_0x3970('0x38')]=function(_0x5e66a9,_0x194863){var _0x33c394={},_0x3e66f1={},_0x2c6d80={'count':0x0,'rows':[]};var _0xf5aed6=_[_0x3970('0x39')](db[_0x3970('0x3a')][_0x3970('0x3b')],function(_0x28fd80){return{'name':_0x28fd80[_0x3970('0x3c')],'type':_0x28fd80['type'][_0x3970('0x3d')]};});_0x3e66f1[_0x3970('0x3e')]=_[_0x3970('0x39')](_0xf5aed6,'name');_0x3e66f1[_0x3970('0x3f')]=_['keys'](_0x5e66a9[_0x3970('0x3f')]);_0x3e66f1[_0x3970('0x40')]=_[_0x3970('0x41')](_0x3e66f1['model'],_0x3e66f1[_0x3970('0x3f')]);_0x33c394[_0x3970('0x42')]=_[_0x3970('0x41')](_0x3e66f1[_0x3970('0x3e')],qs[_0x3970('0x43')](_0x5e66a9[_0x3970('0x3f')][_0x3970('0x43')]));_0x33c394['attributes']=_0x33c394['attributes'][_0x3970('0x44')]?_0x33c394[_0x3970('0x42')]:_0x3e66f1[_0x3970('0x3e')];if(!_0x5e66a9['query'][_0x3970('0x45')]('nolimit')){_0x33c394['limit']=qs[_0x3970('0x28')](_0x5e66a9[_0x3970('0x3f')][_0x3970('0x28')]);_0x33c394['offset']=qs[_0x3970('0x27')](_0x5e66a9[_0x3970('0x3f')][_0x3970('0x27')]);}_0x33c394[_0x3970('0x46')]=qs['sort'](_0x5e66a9[_0x3970('0x3f')][_0x3970('0x47')]);_0x33c394['where']=qs['filters'](_[_0x3970('0x48')](_0x5e66a9[_0x3970('0x3f')],_0x3e66f1[_0x3970('0x40')]),_0xf5aed6);if(_0x5e66a9[_0x3970('0x3f')][_0x3970('0x49')]){_0x33c394[_0x3970('0x4a')]=_[_0x3970('0x34')](_0x33c394['where'],{'$or':_[_0x3970('0x39')](_0xf5aed6,function(_0x36ddaf){if(_0x36ddaf[_0x3970('0x4b')]!=='VIRTUAL'){var _0x143509={};_0x143509[_0x36ddaf['name']]={'$like':'%'+_0x5e66a9[_0x3970('0x3f')][_0x3970('0x49')]+'%'};return _0x143509;}})});}_0x33c394=_[_0x3970('0x34')]({},_0x33c394,_0x5e66a9[_0x3970('0x4c')]);var _0x3e65ed={'where':_0x33c394[_0x3970('0x4a')]};return db[_0x3970('0x3a')][_0x3970('0x26')](_0x3e65ed)[_0x3970('0x2f')](function(_0x3de5c7){_0x2c6d80['count']=_0x3de5c7;if(_0x5e66a9[_0x3970('0x3f')][_0x3970('0x4d')]){_0x33c394[_0x3970('0x4e')]=[{'all':!![]}];}return db[_0x3970('0x3a')][_0x3970('0x4f')](_0x33c394);})['then'](function(_0x34e05f){_0x2c6d80['rows']=_0x34e05f;return _0x2c6d80;})[_0x3970('0x2f')](respondWithFilteredResult(_0x194863,_0x33c394))[_0x3970('0x22')](handleError(_0x194863,null));};exports['show']=function(_0x91de43,_0x4759b6){var _0x288b9f={'raw':![],'where':{'id':_0x91de43[_0x3970('0x50')]['id']}},_0x570395={};_0x570395[_0x3970('0x3e')]=_[_0x3970('0x51')](db[_0x3970('0x3a')][_0x3970('0x3b')]);_0x570395[_0x3970('0x3f')]=_['keys'](_0x91de43[_0x3970('0x3f')]);_0x570395[_0x3970('0x40')]=_[_0x3970('0x41')](_0x570395[_0x3970('0x3e')],_0x570395[_0x3970('0x3f')]);_0x288b9f['attributes']=_['intersection'](_0x570395[_0x3970('0x3e')],qs[_0x3970('0x43')](_0x91de43['query'][_0x3970('0x43')]));_0x288b9f['attributes']=_0x288b9f['attributes'][_0x3970('0x44')]?_0x288b9f[_0x3970('0x42')]:_0x570395[_0x3970('0x3e')];if(_0x91de43[_0x3970('0x3f')][_0x3970('0x4d')]){_0x288b9f['include']=[{'all':!![]}];}_0x288b9f=_['merge']({},_0x288b9f,_0x91de43[_0x3970('0x4c')]);return db[_0x3970('0x3a')][_0x3970('0x52')](_0x288b9f)[_0x3970('0x2f')](handleEntityNotFound(_0x4759b6,null))[_0x3970('0x2f')](respondWithResult(_0x4759b6,null))[_0x3970('0x22')](handleError(_0x4759b6,null));};exports['create']=function(_0x40cef4,_0x2d7cb3){return db['ServicenowConfiguration'][_0x3970('0x53')](_0x40cef4['body'],{})[_0x3970('0x2f')](respondWithResult(_0x2d7cb3,0xc9))[_0x3970('0x22')](handleError(_0x2d7cb3,null));};exports[_0x3970('0x54')]=function(_0x8f9e6d,_0x30966c){if(_0x8f9e6d[_0x3970('0x55')]['id']){delete _0x8f9e6d[_0x3970('0x55')]['id'];}return db[_0x3970('0x3a')]['find']({'where':{'id':_0x8f9e6d[_0x3970('0x50')]['id']}})[_0x3970('0x2f')](handleEntityNotFound(_0x30966c,null))[_0x3970('0x2f')](saveUpdates(_0x8f9e6d[_0x3970('0x55')],null))[_0x3970('0x2f')](respondWithResult(_0x30966c,null))[_0x3970('0x22')](handleError(_0x30966c,null));};exports[_0x3970('0x2e')]=function(_0x3933bd,_0x347aaf){return db[_0x3970('0x3a')][_0x3970('0x52')]({'where':{'id':_0x3933bd[_0x3970('0x50')]['id']}})[_0x3970('0x2f')](handleEntityNotFound(_0x347aaf,null))['then'](removeEntity(_0x347aaf,null))[_0x3970('0x22')](handleError(_0x347aaf,null));};exports[_0x3970('0x56')]=function(_0x510402,_0x588c97,_0x5eb405){var _0x3f8631={};var _0x4502f0={};var _0x4cad1d;var _0x3b1a4f;return db[_0x3970('0x3a')][_0x3970('0x57')]({'where':{'id':_0x510402['params']['id']}})[_0x3970('0x2f')](handleEntityNotFound(_0x588c97,null))[_0x3970('0x2f')](function(_0x3af8cf){if(_0x3af8cf){_0x4cad1d=_0x3af8cf;_0x4502f0[_0x3970('0x3e')]=_['keys'](db[_0x3970('0x58')][_0x3970('0x3b')]);_0x4502f0[_0x3970('0x3f')]=_[_0x3970('0x51')](_0x510402[_0x3970('0x3f')]);_0x4502f0[_0x3970('0x40')]=_[_0x3970('0x41')](_0x4502f0[_0x3970('0x3e')],_0x4502f0['query']);_0x3f8631[_0x3970('0x42')]=_[_0x3970('0x41')](_0x4502f0[_0x3970('0x3e')],qs[_0x3970('0x43')](_0x510402['query'][_0x3970('0x43')]));_0x3f8631['attributes']=_0x3f8631[_0x3970('0x42')][_0x3970('0x44')]?_0x3f8631[_0x3970('0x42')]:_0x4502f0[_0x3970('0x3e')];_0x3f8631[_0x3970('0x46')]=qs[_0x3970('0x47')](_0x510402[_0x3970('0x3f')][_0x3970('0x47')]);_0x3f8631[_0x3970('0x4a')]=qs['filters'](_[_0x3970('0x48')](_0x510402[_0x3970('0x3f')],_0x4502f0['filters']));if(_0x510402[_0x3970('0x3f')][_0x3970('0x49')]){_0x3f8631[_0x3970('0x4a')]=_[_0x3970('0x34')](_0x3f8631['where'],{'$or':_[_0x3970('0x39')](_0x3f8631['attributes'],function(_0x4ba43f){var _0x22c318={};_0x22c318[_0x4ba43f]={'$like':'%'+_0x510402[_0x3970('0x3f')][_0x3970('0x49')]+'%'};return _0x22c318;})});}_0x3f8631=_[_0x3970('0x34')]({},_0x3f8631,_0x510402['options']);return _0x4cad1d['getFields'](_0x3f8631);}})[_0x3970('0x2f')](function(_0x2993f8){if(_0x2993f8){_0x3b1a4f=_0x2993f8[_0x3970('0x44')];if(!_0x510402[_0x3970('0x3f')][_0x3970('0x45')](_0x3970('0x59'))){_0x3f8631[_0x3970('0x28')]=qs[_0x3970('0x28')](_0x510402[_0x3970('0x3f')][_0x3970('0x28')]);_0x3f8631['offset']=qs[_0x3970('0x27')](_0x510402[_0x3970('0x3f')][_0x3970('0x27')]);}return _0x4cad1d[_0x3970('0x56')](_0x3f8631);}})['then'](function(_0x1444eb){if(_0x1444eb){return _0x1444eb?{'count':_0x3b1a4f,'rows':_0x1444eb}:null;}})[_0x3970('0x2f')](respondWithResult(_0x588c97,null))[_0x3970('0x22')](handleError(_0x588c97,null));};exports[_0x3970('0x5a')]=function(_0x32ad2f,_0x375c32,_0x951a01){var _0x478975={};var _0x508144={};var _0x2c8dca;var _0x2e3240;return db[_0x3970('0x3a')][_0x3970('0x57')]({'where':{'id':_0x32ad2f[_0x3970('0x50')]['id']}})['then'](handleEntityNotFound(_0x375c32,null))[_0x3970('0x2f')](function(_0x46ee7b){if(_0x46ee7b){_0x2c8dca=_0x46ee7b;_0x508144[_0x3970('0x3e')]=_[_0x3970('0x51')](db[_0x3970('0x58')][_0x3970('0x3b')]);_0x508144[_0x3970('0x3f')]=_[_0x3970('0x51')](_0x32ad2f['query']);_0x508144[_0x3970('0x40')]=_[_0x3970('0x41')](_0x508144[_0x3970('0x3e')],_0x508144[_0x3970('0x3f')]);_0x478975[_0x3970('0x42')]=_[_0x3970('0x41')](_0x508144[_0x3970('0x3e')],qs[_0x3970('0x43')](_0x32ad2f[_0x3970('0x3f')][_0x3970('0x43')]));_0x478975[_0x3970('0x42')]=_0x478975[_0x3970('0x42')][_0x3970('0x44')]?_0x478975['attributes']:_0x508144[_0x3970('0x3e')];_0x478975['order']=qs['sort'](_0x32ad2f[_0x3970('0x3f')]['sort']);_0x478975[_0x3970('0x4a')]=qs['filters'](_[_0x3970('0x48')](_0x32ad2f[_0x3970('0x3f')],_0x508144[_0x3970('0x40')]));if(_0x32ad2f[_0x3970('0x3f')][_0x3970('0x49')]){_0x478975['where']=_[_0x3970('0x34')](_0x478975[_0x3970('0x4a')],{'$or':_[_0x3970('0x39')](_0x478975[_0x3970('0x42')],function(_0x223ed1){var _0x5c2a3f={};_0x5c2a3f[_0x223ed1]={'$like':'%'+_0x32ad2f[_0x3970('0x3f')][_0x3970('0x49')]+'%'};return _0x5c2a3f;})});}_0x478975=_[_0x3970('0x34')]({},_0x478975,_0x32ad2f[_0x3970('0x4c')]);return _0x2c8dca[_0x3970('0x5a')](_0x478975);}})[_0x3970('0x2f')](function(_0x2af9e2){if(_0x2af9e2){_0x2e3240=_0x2af9e2[_0x3970('0x44')];if(!_0x32ad2f[_0x3970('0x3f')][_0x3970('0x45')](_0x3970('0x59'))){_0x478975[_0x3970('0x28')]=qs[_0x3970('0x28')](_0x32ad2f[_0x3970('0x3f')][_0x3970('0x28')]);_0x478975[_0x3970('0x27')]=qs[_0x3970('0x27')](_0x32ad2f[_0x3970('0x3f')][_0x3970('0x27')]);}return _0x2c8dca[_0x3970('0x5a')](_0x478975);}})[_0x3970('0x2f')](function(_0x148ee9){if(_0x148ee9){return _0x148ee9?{'count':_0x2e3240,'rows':_0x148ee9}:null;}})['then'](respondWithResult(_0x375c32,null))['catch'](handleError(_0x375c32,null));};exports[_0x3970('0x5b')]=function(_0x1c4670,_0x4f48f1,_0x546e1d){var _0x2374c1={};var _0x4e5343={};var _0x4252f0;var _0x3df168;return db['ServicenowConfiguration'][_0x3970('0x57')]({'where':{'id':_0x1c4670[_0x3970('0x50')]['id']}})[_0x3970('0x2f')](handleEntityNotFound(_0x4f48f1,null))[_0x3970('0x2f')](function(_0x4b6ee5){if(_0x4b6ee5){_0x4252f0=_0x4b6ee5;_0x4e5343['model']=_[_0x3970('0x51')](db[_0x3970('0x58')][_0x3970('0x3b')]);_0x4e5343[_0x3970('0x3f')]=_['keys'](_0x1c4670['query']);_0x4e5343[_0x3970('0x40')]=_[_0x3970('0x41')](_0x4e5343[_0x3970('0x3e')],_0x4e5343['query']);_0x2374c1['attributes']=_[_0x3970('0x41')](_0x4e5343[_0x3970('0x3e')],qs['fields'](_0x1c4670[_0x3970('0x3f')][_0x3970('0x43')]));_0x2374c1[_0x3970('0x42')]=_0x2374c1['attributes'][_0x3970('0x44')]?_0x2374c1['attributes']:_0x4e5343[_0x3970('0x3e')];_0x2374c1[_0x3970('0x46')]=qs[_0x3970('0x47')](_0x1c4670[_0x3970('0x3f')][_0x3970('0x47')]);_0x2374c1[_0x3970('0x4a')]=qs[_0x3970('0x40')](_[_0x3970('0x48')](_0x1c4670[_0x3970('0x3f')],_0x4e5343[_0x3970('0x40')]));if(_0x1c4670[_0x3970('0x3f')]['filter']){_0x2374c1[_0x3970('0x4a')]=_[_0x3970('0x34')](_0x2374c1[_0x3970('0x4a')],{'$or':_[_0x3970('0x39')](_0x2374c1[_0x3970('0x42')],function(_0xbc09b4){var _0x5d2120={};_0x5d2120[_0xbc09b4]={'$like':'%'+_0x1c4670[_0x3970('0x3f')]['filter']+'%'};return _0x5d2120;})});}_0x2374c1=_[_0x3970('0x34')]({},_0x2374c1,_0x1c4670[_0x3970('0x4c')]);return _0x4252f0['getDescriptions'](_0x2374c1);}})[_0x3970('0x2f')](function(_0x11e5ac){if(_0x11e5ac){_0x3df168=_0x11e5ac[_0x3970('0x44')];if(!_0x1c4670[_0x3970('0x3f')][_0x3970('0x45')](_0x3970('0x59'))){_0x2374c1['limit']=qs[_0x3970('0x28')](_0x1c4670[_0x3970('0x3f')][_0x3970('0x28')]);_0x2374c1[_0x3970('0x27')]=qs[_0x3970('0x27')](_0x1c4670[_0x3970('0x3f')][_0x3970('0x27')]);}return _0x4252f0[_0x3970('0x5b')](_0x2374c1);}})['then'](function(_0x51d72c){if(_0x51d72c){return _0x51d72c?{'count':_0x3df168,'rows':_0x51d72c}:null;}})[_0x3970('0x2f')](respondWithResult(_0x4f48f1,null))[_0x3970('0x22')](handleError(_0x4f48f1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index c2ebf79..69f9515 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7eba=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intServicenowConfiguration.attributes','exports'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7eba,0x162));var _0xa7eb=function(_0x582991,_0x49cfd7){_0x582991=_0x582991-0x0;var _0x10b480=_0x7eba[_0x582991];return _0x10b480;};'use strict';var _=require(_0xa7eb('0x0'));var util=require(_0xa7eb('0x1'));var logger=require(_0xa7eb('0x2'))(_0xa7eb('0x3'));var moment=require(_0xa7eb('0x4'));var BPromise=require('bluebird');var rp=require(_0xa7eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7eb('0x6'));var config=require('../../config/environment');var attributes=require(_0xa7eb('0x7'));module[_0xa7eb('0x8')]=function(_0x56a991,_0x30999c){return _0x56a991['define'](_0xa7eb('0x9'),attributes,{'tableName':_0xa7eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1095=['request-promise','path','rimraf','../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4da8ce,_0x36feb7){var _0x30295f=function(_0x1c375d){while(--_0x1c375d){_0x4da8ce['push'](_0x4da8ce['shift']());}};_0x30295f(++_0x36feb7);}(_0x1095,0xa3));var _0x5109=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1095[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x5109('0x0'));var util=require(_0x5109('0x1'));var logger=require(_0x5109('0x2'))('api');var moment=require(_0x5109('0x3'));var BPromise=require(_0x5109('0x4'));var rp=require(_0x5109('0x5'));var fs=require('fs');var path=require(_0x5109('0x6'));var rimraf=require(_0x5109('0x7'));var config=require(_0x5109('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x3a9c5b,_0x5c3043){return _0x3a9c5b[_0x5109('0x9')](_0x5109('0xa'),attributes,{'tableName':_0x5109('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 59ec6b7..cfcf0a3 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc22=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x2c20b2,_0x359863){var _0x5c0161=function(_0x2b7ec6){while(--_0x2b7ec6){_0x2c20b2['push'](_0x2c20b2['shift']());}};_0x5c0161(++_0x359863);}(_0xdc22,0xd7));var _0x2dc2=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xdc22[_0x100682];return _0xcb6e87;};'use strict';var _=require(_0x2dc2('0x0'));var util=require(_0x2dc2('0x1'));var moment=require(_0x2dc2('0x2'));var BPromise=require(_0x2dc2('0x3'));var rs=require(_0x2dc2('0x4'));var fs=require('fs');var Redis=require(_0x2dc2('0x5'));var db=require(_0x2dc2('0x6'))['db'];var utils=require(_0x2dc2('0x7'));var logger=require(_0x2dc2('0x8'))(_0x2dc2('0x9'));var config=require(_0x2dc2('0xa'));var jayson=require(_0x2dc2('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x413d2f,_0x33bed7,_0xd446e9){return new BPromise(function(_0x341a8d,_0x13073c){return client['request'](_0x413d2f,_0xd446e9)[_0x2dc2('0xc')](function(_0x5a0a90){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x33bed7,_0x2dc2('0xd'));logger[_0x2dc2('0xe')](_0x2dc2('0xf'),_0x33bed7,_0x2dc2('0xd'),JSON[_0x2dc2('0x10')](_0x5a0a90));if(_0x5a0a90[_0x2dc2('0x11')]){if(_0x5a0a90['error'][_0x2dc2('0x12')]===0x1f4){logger[_0x2dc2('0x11')](_0x2dc2('0x13'),_0x33bed7,_0x5a0a90[_0x2dc2('0x11')]['message']);return _0x13073c(_0x5a0a90['error'][_0x2dc2('0x14')]);}logger['error'](_0x2dc2('0x13'),_0x33bed7,_0x5a0a90[_0x2dc2('0x11')]['message']);return _0x341a8d(_0x5a0a90[_0x2dc2('0x11')][_0x2dc2('0x14')]);}else{logger[_0x2dc2('0x15')](_0x2dc2('0x13'),_0x33bed7,_0x2dc2('0xd'));_0x341a8d(_0x5a0a90[_0x2dc2('0x16')]['message']);}})[_0x2dc2('0x17')](function(_0x2aef7c){logger[_0x2dc2('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x33bed7,_0x2aef7c);_0x13073c(_0x2aef7c);});});} \ No newline at end of file +var _0xf870=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x12ed72,_0x28c557){var _0x1db398=function(_0x1e9ea0){while(--_0x1e9ea0){_0x12ed72['push'](_0x12ed72['shift']());}};_0x1db398(++_0x28c557);}(_0xf870,0x145));var _0x0f87=function(_0x10c2b0,_0x4fe443){_0x10c2b0=_0x10c2b0-0x0;var _0x4de90f=_0xf870[_0x10c2b0];return _0x4de90f;};'use strict';var _=require(_0x0f87('0x0'));var util=require(_0x0f87('0x1'));var moment=require(_0x0f87('0x2'));var BPromise=require(_0x0f87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f87('0x4'));var db=require(_0x0f87('0x5'))['db'];var utils=require(_0x0f87('0x6'));var logger=require(_0x0f87('0x7'))('rpc');var config=require(_0x0f87('0x8'));var jayson=require(_0x0f87('0x9'));var client=jayson['client'][_0x0f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18153c,_0x394678,_0x348a52){return new BPromise(function(_0xde357b,_0x502226){return client[_0x0f87('0xb')](_0x18153c,_0x348a52)['then'](function(_0x3fe7d0){logger[_0x0f87('0xc')](_0x0f87('0xd'),_0x394678,_0x0f87('0xe'));logger[_0x0f87('0xf')](_0x0f87('0x10'),_0x394678,_0x0f87('0xe'),JSON[_0x0f87('0x11')](_0x3fe7d0));if(_0x3fe7d0['error']){if(_0x3fe7d0[_0x0f87('0x12')][_0x0f87('0x13')]===0x1f4){logger[_0x0f87('0x12')](_0x0f87('0xd'),_0x394678,_0x3fe7d0[_0x0f87('0x12')][_0x0f87('0x14')]);return _0x502226(_0x3fe7d0[_0x0f87('0x12')]['message']);}logger[_0x0f87('0x12')](_0x0f87('0xd'),_0x394678,_0x3fe7d0[_0x0f87('0x12')][_0x0f87('0x14')]);return _0xde357b(_0x3fe7d0[_0x0f87('0x12')][_0x0f87('0x14')]);}else{logger[_0x0f87('0xc')](_0x0f87('0xd'),_0x394678,'request\x20sent');_0xde357b(_0x3fe7d0[_0x0f87('0x15')][_0x0f87('0x14')]);}})[_0x0f87('0x16')](function(_0x34fa69){logger[_0x0f87('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x394678,_0x34fa69);_0x502226(_0x34fa69);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3494727..9c110f3 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb247=['../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xb247,0x176));var _0x7b24=function(_0x356307,_0xe0a012){_0x356307=_0x356307-0x0;var _0x59e722=_0xb247[_0x356307];return _0x59e722;};'use strict';var multer=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var path=require('path');var timeout=require(_0x7b24('0x2'));var express=require(_0x7b24('0x3'));var router=express[_0x7b24('0x4')]();var fs_extra=require(_0x7b24('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7b24('0x6'));var config=require('../../config/environment');var controller=require(_0x7b24('0x7'));router['get']('/',auth[_0x7b24('0x8')](),controller[_0x7b24('0x9')]);router[_0x7b24('0xa')](_0x7b24('0xb'),auth[_0x7b24('0x8')](),controller[_0x7b24('0xc')]);router[_0x7b24('0xd')]('/',auth[_0x7b24('0x8')](),controller[_0x7b24('0xe')]);router[_0x7b24('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7b24('0x10')]);router[_0x7b24('0x11')](_0x7b24('0xb'),auth[_0x7b24('0x8')](),controller[_0x7b24('0x12')]);module[_0x7b24('0x13')]=router; \ No newline at end of file +var _0x4ffd=['connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x13d915,_0x306818){var _0x3e1907=function(_0x3a1f5d){while(--_0x3a1f5d){_0x13d915['push'](_0x13d915['shift']());}};_0x3e1907(++_0x306818);}(_0x4ffd,0x8e));var _0xd4ff=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x4ffd[_0x163040];return _0x364667;};'use strict';var multer=require(_0xd4ff('0x0'));var util=require(_0xd4ff('0x1'));var path=require('path');var timeout=require(_0xd4ff('0x2'));var express=require('express');var router=express[_0xd4ff('0x3')]();var fs_extra=require(_0xd4ff('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd4ff('0x5'));var controller=require('./intServicenowField.controller');router[_0xd4ff('0x6')]('/',auth[_0xd4ff('0x7')](),controller[_0xd4ff('0x8')]);router[_0xd4ff('0x6')]('/:id',auth[_0xd4ff('0x7')](),controller[_0xd4ff('0x9')]);router['post']('/',auth[_0xd4ff('0x7')](),controller[_0xd4ff('0xa')]);router[_0xd4ff('0xb')](_0xd4ff('0xc'),auth[_0xd4ff('0x7')](),controller[_0xd4ff('0xd')]);router['delete'](_0xd4ff('0xc'),auth[_0xd4ff('0x7')](),controller[_0xd4ff('0xe')]);module[_0xd4ff('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index ad15371..8d9fc54 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56a4=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','picklist'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x56a4,0x11b));var _0x456a=function(_0xef34c5,_0xd17a9d){_0xef34c5=_0xef34c5-0x0;var _0x1de207=_0x56a4[_0xef34c5];return _0x1de207;};'use strict';var Sequelize=require(_0x456a('0x0'));module[_0x456a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x456a('0x2'),_0x456a('0x3'),'customVariable','keyValue',_0x456a('0x4')),'defaultValue':_0x456a('0x2')},'content':{'type':Sequelize[_0x456a('0x5')]},'key':{'type':Sequelize[_0x456a('0x5')]},'keyType':{'type':Sequelize[_0x456a('0x6')]('string',_0x456a('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x456a('0x5')]},'nameField':{'type':Sequelize[_0x456a('0x5')]},'customField':{'type':Sequelize[_0x456a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4fb4=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x3cf94e,_0x42c5bc){var _0xe73ad2=function(_0x367b90){while(--_0x367b90){_0x3cf94e['push'](_0x3cf94e['shift']());}};_0xe73ad2(++_0x42c5bc);}(_0x4fb4,0x190));var _0x44fb=function(_0x3966c9,_0x392ebd){_0x3966c9=_0x3966c9-0x0;var _0x3ca1e9=_0x4fb4[_0x3966c9];return _0x3ca1e9;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'type':{'type':Sequelize[_0x44fb('0x1')](_0x44fb('0x2'),_0x44fb('0x3'),_0x44fb('0x4'),_0x44fb('0x5'),'picklist'),'defaultValue':_0x44fb('0x2')},'content':{'type':Sequelize[_0x44fb('0x6')]},'key':{'type':Sequelize[_0x44fb('0x6')]},'keyType':{'type':Sequelize[_0x44fb('0x1')](_0x44fb('0x2'),_0x44fb('0x3'),_0x44fb('0x4'))},'keyContent':{'type':Sequelize[_0x44fb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x44fb('0x6')]},'customField':{'type':Sequelize[_0x44fb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 87c5a2b..152f799 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64bd=['util','path','sox','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','destroy','then','error','stack','name','send','render','merge','body','message','agent','interaction','account','index','ServicenowField','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','rawAttributes','fields','includeAll','catch','create','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x64bd,0xe6));var _0xd64b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x64bd[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xd64b('0x0'));var rimraf=require(_0xd64b('0x1'));var zipdir=require(_0xd64b('0x2'));var jsonpatch=require(_0xd64b('0x3'));var rp=require(_0xd64b('0x4'));var moment=require(_0xd64b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd64b('0x6'));var util=require(_0xd64b('0x7'));var path=require(_0xd64b('0x8'));var sox=require(_0xd64b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd64b('0xa'));var _=require(_0xd64b('0xb'));var squel=require(_0xd64b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd64b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd64b('0xe'));var Redis=require(_0xd64b('0xf'));var authService=require(_0xd64b('0x10'));var qs=require(_0xd64b('0x11'));var as=require(_0xd64b('0x12'));var hardwareService=require(_0xd64b('0x13'));var logger=require(_0xd64b('0x14'))('api');var utils=require(_0xd64b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd64b('0x16'));var db=require(_0xd64b('0x17'))['db'];function respondWithStatusCode(_0x406a11,_0x4727cf){_0x4727cf=_0x4727cf||0xcc;return function(_0x4be60f){if(_0x4be60f){return _0x406a11[_0xd64b('0x18')](_0x4727cf);}return _0x406a11['status'](_0x4727cf)[_0xd64b('0x19')]();};}function respondWithResult(_0x141e66,_0x19628a){_0x19628a=_0x19628a||0xc8;return function(_0x30313f){if(_0x30313f){return _0x141e66[_0xd64b('0x1a')](_0x19628a)[_0xd64b('0x1b')](_0x30313f);}};}function respondWithFilteredResult(_0x1613e8,_0x3884da){return function(_0x1b2d51){if(_0x1b2d51){var _0x1db9e4=typeof _0x3884da['offset']==='undefined'&&typeof _0x3884da[_0xd64b('0x1c')]===_0xd64b('0x1d');var _0x3fcbc0=_0x1b2d51[_0xd64b('0x1e')];var _0x4fe02d=_0x1db9e4?0x0:_0x3884da[_0xd64b('0x1f')];var _0x10ea8a=_0x1db9e4?_0x1b2d51[_0xd64b('0x1e')]:_0x3884da[_0xd64b('0x1f')]+_0x3884da[_0xd64b('0x1c')];var _0x248d70;if(_0x10ea8a>=_0x3fcbc0){_0x10ea8a=_0x3fcbc0;_0x248d70=0xc8;}else{_0x248d70=0xce;}_0x1613e8[_0xd64b('0x1a')](_0x248d70);return _0x1613e8[_0xd64b('0x20')](_0xd64b('0x21'),_0x4fe02d+'-'+_0x10ea8a+'/'+_0x3fcbc0)[_0xd64b('0x1b')](_0x1b2d51);}return null;};}function patchUpdates(_0x465588){return function(_0x3ccef5){try{jsonpatch[_0xd64b('0x22')](_0x3ccef5,_0x465588,!![]);}catch(_0x6c1649){return BPromise['reject'](_0x6c1649);}return _0x3ccef5['save']();};}function saveUpdates(_0x443715,_0x124832){return function(_0x23223e){if(_0x23223e){return _0x23223e[_0xd64b('0x23')](_0x443715)['then'](function(_0x5a9aef){return _0x5a9aef;});}return null;};}function removeEntity(_0x1140f2,_0x4cf943){return function(_0x553bb7){if(_0x553bb7){return _0x553bb7[_0xd64b('0x24')]()[_0xd64b('0x25')](function(){_0x1140f2[_0xd64b('0x1a')](0xcc)[_0xd64b('0x19')]();});}};}function handleEntityNotFound(_0x3baf2e,_0x36a199){return function(_0x298a1c){if(!_0x298a1c){_0x3baf2e[_0xd64b('0x18')](0x194);}return _0x298a1c;};}function handleError(_0x493b35,_0x4309ad){_0x4309ad=_0x4309ad||0x1f4;return function(_0x1a2204){logger[_0xd64b('0x26')](_0x1a2204[_0xd64b('0x27')]);if(_0x1a2204[_0xd64b('0x28')]){delete _0x1a2204['name'];}_0x493b35[_0xd64b('0x1a')](_0x4309ad)[_0xd64b('0x29')](_0x1a2204);};}function getMustacheRender(_0x4a8bcc,_0x4c6caf){return Mustache[_0xd64b('0x2a')](_0x4a8bcc,_[_0xd64b('0x2b')](_0x4c6caf[_0xd64b('0x2c')],{'contact':_0x4c6caf['contact'],'message':_0x4c6caf[_0xd64b('0x2d')],'agent':_0x4c6caf[_0xd64b('0x2e')],'interaction':_0x4c6caf[_0xd64b('0x2f')],'account':_0x4c6caf[_0xd64b('0x30')]}))||'';}exports[_0xd64b('0x31')]=function(_0xc06050,_0x300ef0){var _0x49d9d8={},_0x40a810={},_0x56739c={'count':0x0,'rows':[]};var _0xa5fda3=_['map'](db[_0xd64b('0x32')]['rawAttributes'],function(_0x219832){return{'name':_0x219832[_0xd64b('0x33')],'type':_0x219832['type'][_0xd64b('0x34')]};});_0x40a810[_0xd64b('0x35')]=_[_0xd64b('0x36')](_0xa5fda3,_0xd64b('0x28'));_0x40a810[_0xd64b('0x37')]=_[_0xd64b('0x38')](_0xc06050['query']);_0x40a810[_0xd64b('0x39')]=_[_0xd64b('0x3a')](_0x40a810[_0xd64b('0x35')],_0x40a810[_0xd64b('0x37')]);_0x49d9d8[_0xd64b('0x3b')]=_[_0xd64b('0x3a')](_0x40a810[_0xd64b('0x35')],qs['fields'](_0xc06050[_0xd64b('0x37')]['fields']));_0x49d9d8[_0xd64b('0x3b')]=_0x49d9d8[_0xd64b('0x3b')][_0xd64b('0x3c')]?_0x49d9d8[_0xd64b('0x3b')]:_0x40a810['model'];if(!_0xc06050[_0xd64b('0x37')][_0xd64b('0x3d')]('nolimit')){_0x49d9d8[_0xd64b('0x1c')]=qs['limit'](_0xc06050[_0xd64b('0x37')][_0xd64b('0x1c')]);_0x49d9d8[_0xd64b('0x1f')]=qs[_0xd64b('0x1f')](_0xc06050[_0xd64b('0x37')][_0xd64b('0x1f')]);}_0x49d9d8[_0xd64b('0x3e')]=qs[_0xd64b('0x3f')](_0xc06050[_0xd64b('0x37')][_0xd64b('0x3f')]);_0x49d9d8[_0xd64b('0x40')]=qs[_0xd64b('0x39')](_[_0xd64b('0x41')](_0xc06050[_0xd64b('0x37')],_0x40a810[_0xd64b('0x39')]),_0xa5fda3);if(_0xc06050[_0xd64b('0x37')][_0xd64b('0x42')]){_0x49d9d8['where']=_['merge'](_0x49d9d8[_0xd64b('0x40')],{'$or':_['map'](_0xa5fda3,function(_0x2ae594){if(_0x2ae594['type']!==_0xd64b('0x43')){var _0x3a5330={};_0x3a5330[_0x2ae594['name']]={'$like':'%'+_0xc06050[_0xd64b('0x37')][_0xd64b('0x42')]+'%'};return _0x3a5330;}})});}_0x49d9d8=_[_0xd64b('0x2b')]({},_0x49d9d8,_0xc06050[_0xd64b('0x44')]);var _0x30ebaf={'where':_0x49d9d8[_0xd64b('0x40')]};return db[_0xd64b('0x32')][_0xd64b('0x1e')](_0x30ebaf)[_0xd64b('0x25')](function(_0x423d7d){_0x56739c[_0xd64b('0x1e')]=_0x423d7d;if(_0xc06050[_0xd64b('0x37')]['includeAll']){_0x49d9d8[_0xd64b('0x45')]=[{'all':!![]}];}return db[_0xd64b('0x32')][_0xd64b('0x46')](_0x49d9d8);})[_0xd64b('0x25')](function(_0x49dd00){_0x56739c[_0xd64b('0x47')]=_0x49dd00;return _0x56739c;})['then'](respondWithFilteredResult(_0x300ef0,_0x49d9d8))['catch'](handleError(_0x300ef0,null));};exports['show']=function(_0x5431f1,_0x19592e){var _0xa969d1={'raw':!![],'where':{'id':_0x5431f1[_0xd64b('0x48')]['id']}},_0x4fa91f={};_0x4fa91f[_0xd64b('0x35')]=_[_0xd64b('0x38')](db['ServicenowField'][_0xd64b('0x49')]);_0x4fa91f[_0xd64b('0x37')]=_[_0xd64b('0x38')](_0x5431f1['query']);_0x4fa91f[_0xd64b('0x39')]=_[_0xd64b('0x3a')](_0x4fa91f[_0xd64b('0x35')],_0x4fa91f[_0xd64b('0x37')]);_0xa969d1[_0xd64b('0x3b')]=_['intersection'](_0x4fa91f[_0xd64b('0x35')],qs[_0xd64b('0x4a')](_0x5431f1[_0xd64b('0x37')]['fields']));_0xa969d1[_0xd64b('0x3b')]=_0xa969d1['attributes'][_0xd64b('0x3c')]?_0xa969d1[_0xd64b('0x3b')]:_0x4fa91f[_0xd64b('0x35')];if(_0x5431f1[_0xd64b('0x37')][_0xd64b('0x4b')]){_0xa969d1['include']=[{'all':!![]}];}_0xa969d1=_['merge']({},_0xa969d1,_0x5431f1[_0xd64b('0x44')]);return db['ServicenowField']['find'](_0xa969d1)['then'](handleEntityNotFound(_0x19592e,null))['then'](respondWithResult(_0x19592e,null))[_0xd64b('0x4c')](handleError(_0x19592e,null));};exports['create']=function(_0x548690,_0x25f5d8){return db[_0xd64b('0x32')][_0xd64b('0x4d')](_0x548690[_0xd64b('0x2c')],{})[_0xd64b('0x25')](respondWithResult(_0x25f5d8,0xc9))[_0xd64b('0x4c')](handleError(_0x25f5d8,null));};exports[_0xd64b('0x23')]=function(_0x34037e,_0xa129b6){if(_0x34037e[_0xd64b('0x2c')]['id']){delete _0x34037e['body']['id'];}return db['ServicenowField'][_0xd64b('0x4e')]({'where':{'id':_0x34037e[_0xd64b('0x48')]['id']}})[_0xd64b('0x25')](handleEntityNotFound(_0xa129b6,null))['then'](saveUpdates(_0x34037e[_0xd64b('0x2c')],null))[_0xd64b('0x25')](respondWithResult(_0xa129b6,null))[_0xd64b('0x4c')](handleError(_0xa129b6,null));};exports[_0xd64b('0x24')]=function(_0x5beb84,_0x4876b1){return db[_0xd64b('0x32')][_0xd64b('0x4e')]({'where':{'id':_0x5beb84[_0xd64b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4876b1,null))[_0xd64b('0x25')](removeEntity(_0x4876b1,null))[_0xd64b('0x4c')](handleError(_0x4876b1,null));}; \ No newline at end of file +var _0x97ae=['order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','create','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','end','error','name','send','render','body','message','agent','interaction','account','index','map','ServicenowField','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x97ae,0x1de));var _0xe97a=function(_0x5404a3,_0x5d6139){_0x5404a3=_0x5404a3-0x0;var _0x5cf850=_0x97ae[_0x5404a3];return _0x5cf850;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe97a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe97a('0x1'));var rp=require(_0xe97a('0x2'));var moment=require(_0xe97a('0x3'));var BPromise=require(_0xe97a('0x4'));var Mustache=require(_0xe97a('0x5'));var util=require('util');var path=require(_0xe97a('0x6'));var sox=require(_0xe97a('0x7'));var csv=require(_0xe97a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe97a('0x9'));var _=require(_0xe97a('0xa'));var squel=require('squel');var crypto=require(_0xe97a('0xb'));var jsforce=require(_0xe97a('0xc'));var deskjs=require(_0xe97a('0xd'));var toCsv=require(_0xe97a('0x8'));var querystring=require(_0xe97a('0xe'));var Papa=require(_0xe97a('0xf'));var Redis=require('ioredis');var authService=require(_0xe97a('0x10'));var qs=require(_0xe97a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe97a('0x12'));var logger=require(_0xe97a('0x13'))(_0xe97a('0x14'));var utils=require(_0xe97a('0x15'));var config=require(_0xe97a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe97a('0x17'))['db'];function respondWithStatusCode(_0x4c31fd,_0x586877){_0x586877=_0x586877||0xcc;return function(_0x3bc691){if(_0x3bc691){return _0x4c31fd[_0xe97a('0x18')](_0x586877);}return _0x4c31fd['status'](_0x586877)['end']();};}function respondWithResult(_0x1c452f,_0x545154){_0x545154=_0x545154||0xc8;return function(_0x2126a8){if(_0x2126a8){return _0x1c452f[_0xe97a('0x19')](_0x545154)[_0xe97a('0x1a')](_0x2126a8);}};}function respondWithFilteredResult(_0x9e95ac,_0x4230c4){return function(_0x48a307){if(_0x48a307){var _0x17a067=typeof _0x4230c4['offset']===_0xe97a('0x1b')&&typeof _0x4230c4[_0xe97a('0x1c')]==='undefined';var _0x38d7f7=_0x48a307['count'];var _0xc2b442=_0x17a067?0x0:_0x4230c4[_0xe97a('0x1d')];var _0x50be60=_0x17a067?_0x48a307[_0xe97a('0x1e')]:_0x4230c4[_0xe97a('0x1d')]+_0x4230c4[_0xe97a('0x1c')];var _0x4dde3e;if(_0x50be60>=_0x38d7f7){_0x50be60=_0x38d7f7;_0x4dde3e=0xc8;}else{_0x4dde3e=0xce;}_0x9e95ac[_0xe97a('0x19')](_0x4dde3e);return _0x9e95ac[_0xe97a('0x1f')](_0xe97a('0x20'),_0xc2b442+'-'+_0x50be60+'/'+_0x38d7f7)[_0xe97a('0x1a')](_0x48a307);}return null;};}function patchUpdates(_0x1fea2f){return function(_0x346035){try{jsonpatch['apply'](_0x346035,_0x1fea2f,!![]);}catch(_0x4777a7){return BPromise['reject'](_0x4777a7);}return _0x346035[_0xe97a('0x21')]();};}function saveUpdates(_0x3ccf1d,_0x19c90b){return function(_0x37fbba){if(_0x37fbba){return _0x37fbba[_0xe97a('0x22')](_0x3ccf1d)[_0xe97a('0x23')](function(_0x17e0c8){return _0x17e0c8;});}return null;};}function removeEntity(_0x403e01,_0x16e48b){return function(_0x2836bb){if(_0x2836bb){return _0x2836bb[_0xe97a('0x24')]()[_0xe97a('0x23')](function(){_0x403e01[_0xe97a('0x19')](0xcc)[_0xe97a('0x25')]();});}};}function handleEntityNotFound(_0x4e44f1,_0x5922d1){return function(_0x47a8cf){if(!_0x47a8cf){_0x4e44f1['sendStatus'](0x194);}return _0x47a8cf;};}function handleError(_0x5d9ddf,_0x13e102){_0x13e102=_0x13e102||0x1f4;return function(_0x2e6edf){logger[_0xe97a('0x26')](_0x2e6edf['stack']);if(_0x2e6edf['name']){delete _0x2e6edf[_0xe97a('0x27')];}_0x5d9ddf[_0xe97a('0x19')](_0x13e102)[_0xe97a('0x28')](_0x2e6edf);};}function getMustacheRender(_0x20aa82,_0x2a6fa3){return Mustache[_0xe97a('0x29')](_0x20aa82,_['merge'](_0x2a6fa3[_0xe97a('0x2a')],{'contact':_0x2a6fa3['contact'],'message':_0x2a6fa3[_0xe97a('0x2b')],'agent':_0x2a6fa3[_0xe97a('0x2c')],'interaction':_0x2a6fa3[_0xe97a('0x2d')],'account':_0x2a6fa3[_0xe97a('0x2e')]}))||'';}exports[_0xe97a('0x2f')]=function(_0x3e5976,_0x433db8){var _0x326ae2={},_0xeed380={},_0x42d972={'count':0x0,'rows':[]};var _0x232eff=_[_0xe97a('0x30')](db[_0xe97a('0x31')][_0xe97a('0x32')],function(_0x4d7464){return{'name':_0x4d7464['fieldName'],'type':_0x4d7464[_0xe97a('0x33')]['key']};});_0xeed380['model']=_[_0xe97a('0x30')](_0x232eff,_0xe97a('0x27'));_0xeed380[_0xe97a('0x34')]=_[_0xe97a('0x35')](_0x3e5976['query']);_0xeed380[_0xe97a('0x36')]=_[_0xe97a('0x37')](_0xeed380[_0xe97a('0x38')],_0xeed380[_0xe97a('0x34')]);_0x326ae2['attributes']=_[_0xe97a('0x37')](_0xeed380[_0xe97a('0x38')],qs[_0xe97a('0x39')](_0x3e5976[_0xe97a('0x34')][_0xe97a('0x39')]));_0x326ae2[_0xe97a('0x3a')]=_0x326ae2[_0xe97a('0x3a')]['length']?_0x326ae2[_0xe97a('0x3a')]:_0xeed380[_0xe97a('0x38')];if(!_0x3e5976[_0xe97a('0x34')][_0xe97a('0x3b')](_0xe97a('0x3c'))){_0x326ae2['limit']=qs[_0xe97a('0x1c')](_0x3e5976['query'][_0xe97a('0x1c')]);_0x326ae2[_0xe97a('0x1d')]=qs['offset'](_0x3e5976[_0xe97a('0x34')][_0xe97a('0x1d')]);}_0x326ae2[_0xe97a('0x3d')]=qs[_0xe97a('0x3e')](_0x3e5976[_0xe97a('0x34')][_0xe97a('0x3e')]);_0x326ae2[_0xe97a('0x3f')]=qs[_0xe97a('0x36')](_[_0xe97a('0x40')](_0x3e5976['query'],_0xeed380['filters']),_0x232eff);if(_0x3e5976[_0xe97a('0x34')][_0xe97a('0x41')]){_0x326ae2[_0xe97a('0x3f')]=_[_0xe97a('0x42')](_0x326ae2['where'],{'$or':_[_0xe97a('0x30')](_0x232eff,function(_0x13b8fc){if(_0x13b8fc[_0xe97a('0x33')]!=='VIRTUAL'){var _0x234731={};_0x234731[_0x13b8fc[_0xe97a('0x27')]]={'$like':'%'+_0x3e5976['query'][_0xe97a('0x41')]+'%'};return _0x234731;}})});}_0x326ae2=_[_0xe97a('0x42')]({},_0x326ae2,_0x3e5976[_0xe97a('0x43')]);var _0x3c01d3={'where':_0x326ae2[_0xe97a('0x3f')]};return db['ServicenowField']['count'](_0x3c01d3)[_0xe97a('0x23')](function(_0x526122){_0x42d972[_0xe97a('0x1e')]=_0x526122;if(_0x3e5976[_0xe97a('0x34')][_0xe97a('0x44')]){_0x326ae2[_0xe97a('0x45')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x326ae2);})['then'](function(_0x352859){_0x42d972[_0xe97a('0x46')]=_0x352859;return _0x42d972;})[_0xe97a('0x23')](respondWithFilteredResult(_0x433db8,_0x326ae2))[_0xe97a('0x47')](handleError(_0x433db8,null));};exports[_0xe97a('0x48')]=function(_0x5f5d21,_0x392f4f){var _0xb00501={'raw':!![],'where':{'id':_0x5f5d21[_0xe97a('0x49')]['id']}},_0x532cb5={};_0x532cb5[_0xe97a('0x38')]=_[_0xe97a('0x35')](db[_0xe97a('0x31')][_0xe97a('0x32')]);_0x532cb5[_0xe97a('0x34')]=_[_0xe97a('0x35')](_0x5f5d21['query']);_0x532cb5[_0xe97a('0x36')]=_[_0xe97a('0x37')](_0x532cb5[_0xe97a('0x38')],_0x532cb5[_0xe97a('0x34')]);_0xb00501['attributes']=_[_0xe97a('0x37')](_0x532cb5['model'],qs[_0xe97a('0x39')](_0x5f5d21[_0xe97a('0x34')]['fields']));_0xb00501[_0xe97a('0x3a')]=_0xb00501[_0xe97a('0x3a')][_0xe97a('0x4a')]?_0xb00501[_0xe97a('0x3a')]:_0x532cb5['model'];if(_0x5f5d21[_0xe97a('0x34')][_0xe97a('0x44')]){_0xb00501['include']=[{'all':!![]}];}_0xb00501=_[_0xe97a('0x42')]({},_0xb00501,_0x5f5d21[_0xe97a('0x43')]);return db[_0xe97a('0x31')]['find'](_0xb00501)[_0xe97a('0x23')](handleEntityNotFound(_0x392f4f,null))[_0xe97a('0x23')](respondWithResult(_0x392f4f,null))[_0xe97a('0x47')](handleError(_0x392f4f,null));};exports['create']=function(_0x217688,_0xf70293){return db[_0xe97a('0x31')][_0xe97a('0x4b')](_0x217688[_0xe97a('0x2a')],{})[_0xe97a('0x23')](respondWithResult(_0xf70293,0xc9))[_0xe97a('0x47')](handleError(_0xf70293,null));};exports[_0xe97a('0x22')]=function(_0x163c95,_0x1bfa9b){if(_0x163c95[_0xe97a('0x2a')]['id']){delete _0x163c95[_0xe97a('0x2a')]['id'];}return db[_0xe97a('0x31')][_0xe97a('0x4c')]({'where':{'id':_0x163c95[_0xe97a('0x49')]['id']}})[_0xe97a('0x23')](handleEntityNotFound(_0x1bfa9b,null))['then'](saveUpdates(_0x163c95[_0xe97a('0x2a')],null))[_0xe97a('0x23')](respondWithResult(_0x1bfa9b,null))[_0xe97a('0x47')](handleError(_0x1bfa9b,null));};exports[_0xe97a('0x24')]=function(_0xa0cbb9,_0x38f26d){return db[_0xe97a('0x31')][_0xe97a('0x4c')]({'where':{'id':_0xa0cbb9['params']['id']}})[_0xe97a('0x23')](handleEntityNotFound(_0x38f26d,null))[_0xe97a('0x23')](removeEntity(_0x38f26d,null))[_0xe97a('0x47')](handleError(_0x38f26d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 7487ac4..64b5838 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x747f=['rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x143022,_0x58cf55){var _0x34a969=function(_0x1fdbe2){while(--_0x1fdbe2){_0x143022['push'](_0x143022['shift']());}};_0x34a969(++_0x58cf55);}(_0x747f,0x88));var _0xf747=function(_0x193977,_0x36bc62){_0x193977=_0x193977-0x0;var _0x439bd7=_0x747f[_0x193977];return _0x439bd7;};'use strict';var _=require(_0xf747('0x0'));var util=require(_0xf747('0x1'));var logger=require(_0xf747('0x2'))(_0xf747('0x3'));var moment=require(_0xf747('0x4'));var BPromise=require(_0xf747('0x5'));var rp=require(_0xf747('0x6'));var fs=require('fs');var path=require(_0xf747('0x7'));var rimraf=require(_0xf747('0x8'));var config=require(_0xf747('0x9'));var attributes=require(_0xf747('0xa'));module[_0xf747('0xb')]=function(_0x39fb59,_0x4de683){return _0x39fb59[_0xf747('0xc')](_0xf747('0xd'),attributes,{'tableName':_0xf747('0xe'),'paranoid':![],'indexes':[{'name':_0xf747('0xf'),'fields':[_0xf747('0x10'),_0xf747('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdae5=['./intServicenowField.attributes','exports','define','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xdae5,0x109));var _0x5dae=function(_0x15461b,_0x3eb731){_0x15461b=_0x15461b-0x0;var _0x3f7ae8=_0xdae5[_0x15461b];return _0x3f7ae8;};'use strict';var _=require(_0x5dae('0x0'));var util=require(_0x5dae('0x1'));var logger=require(_0x5dae('0x2'))(_0x5dae('0x3'));var moment=require(_0x5dae('0x4'));var BPromise=require(_0x5dae('0x5'));var rp=require(_0x5dae('0x6'));var fs=require('fs');var path=require(_0x5dae('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5dae('0x8'));module[_0x5dae('0x9')]=function(_0x5f0363,_0x452171){return _0x5f0363[_0x5dae('0xa')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x5dae('0xb'),'fields':['idField',_0x5dae('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index cbb10bf..e8f2756 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54e0=['message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17b375,_0xa7238c){var _0x1c64cb=function(_0x3e14e){while(--_0x3e14e){_0x17b375['push'](_0x17b375['shift']());}};_0x1c64cb(++_0xa7238c);}(_0x54e0,0x80));var _0x054e=function(_0x4e730b,_0x511ba2){_0x4e730b=_0x4e730b-0x0;var _0xc43d32=_0x54e0[_0x4e730b];return _0xc43d32;};'use strict';var _=require('lodash');var util=require(_0x054e('0x0'));var moment=require(_0x054e('0x1'));var BPromise=require(_0x054e('0x2'));var rs=require(_0x054e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x054e('0x4'))['db'];var utils=require(_0x054e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x054e('0x6'));var jayson=require(_0x054e('0x7'));var client=jayson[_0x054e('0x8')][_0x054e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f23a7,_0x163fba,_0x1f033c){return new BPromise(function(_0x4bf1a2,_0x3a813b){return client[_0x054e('0xa')](_0x3f23a7,_0x1f033c)[_0x054e('0xb')](function(_0x949ece){logger[_0x054e('0xc')](_0x054e('0xd'),_0x163fba,_0x054e('0xe'));logger[_0x054e('0xf')](_0x054e('0x10'),_0x163fba,'request\x20sent',JSON[_0x054e('0x11')](_0x949ece));if(_0x949ece[_0x054e('0x12')]){if(_0x949ece[_0x054e('0x12')]['code']===0x1f4){logger['error'](_0x054e('0xd'),_0x163fba,_0x949ece[_0x054e('0x12')][_0x054e('0x13')]);return _0x3a813b(_0x949ece['error'][_0x054e('0x13')]);}logger[_0x054e('0x12')](_0x054e('0xd'),_0x163fba,_0x949ece[_0x054e('0x12')][_0x054e('0x13')]);return _0x4bf1a2(_0x949ece[_0x054e('0x12')][_0x054e('0x13')]);}else{logger['info'](_0x054e('0xd'),_0x163fba,'request\x20sent');_0x4bf1a2(_0x949ece['result']['message']);}})[_0x054e('0x14')](function(_0x2f2e66){logger[_0x054e('0x12')](_0x054e('0xd'),_0x163fba,_0x2f2e66);_0x3a813b(_0x2f2e66);});});} \ No newline at end of file +var _0x7784=['request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ServicenowField,\x20%s,\x20%s'];(function(_0x36da00,_0x5b533b){var _0x4b72c5=function(_0x46e26b){while(--_0x46e26b){_0x36da00['push'](_0x36da00['shift']());}};_0x4b72c5(++_0x5b533b);}(_0x7784,0xa6));var _0x4778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7784[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4778('0x0'));var BPromise=require(_0x4778('0x1'));var rs=require(_0x4778('0x2'));var fs=require('fs');var Redis=require(_0x4778('0x3'));var db=require(_0x4778('0x4'))['db'];var utils=require(_0x4778('0x5'));var logger=require(_0x4778('0x6'))(_0x4778('0x7'));var config=require(_0x4778('0x8'));var jayson=require(_0x4778('0x9'));var client=jayson[_0x4778('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x384cd9,_0x542e68,_0x56b04c){return new BPromise(function(_0x4f5c61,_0x549905){return client[_0x4778('0xb')](_0x384cd9,_0x56b04c)['then'](function(_0x2a8b3b){logger[_0x4778('0xc')](_0x4778('0xd'),_0x542e68,_0x4778('0xe'));logger['debug'](_0x4778('0xf'),_0x542e68,_0x4778('0xe'),JSON[_0x4778('0x10')](_0x2a8b3b));if(_0x2a8b3b[_0x4778('0x11')]){if(_0x2a8b3b[_0x4778('0x11')]['code']===0x1f4){logger[_0x4778('0x11')]('ServicenowField,\x20%s,\x20%s',_0x542e68,_0x2a8b3b['error'][_0x4778('0x12')]);return _0x549905(_0x2a8b3b[_0x4778('0x11')][_0x4778('0x12')]);}logger[_0x4778('0x11')](_0x4778('0xd'),_0x542e68,_0x2a8b3b[_0x4778('0x11')][_0x4778('0x12')]);return _0x4f5c61(_0x2a8b3b[_0x4778('0x11')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x542e68,_0x4778('0xe'));_0x4f5c61(_0x2a8b3b['result']['message']);}})[_0x4778('0x13')](function(_0x46ea73){logger[_0x4778('0x11')]('ServicenowField,\x20%s,\x20%s',_0x542e68,_0x46ea73);_0x549905(_0x46ea73);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bf3536c..b7f9349 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e07=['/:id','isAuthenticated','show','/:id/configurations','/:id/fields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','index'];(function(_0x43c7b1,_0x3cda06){var _0x585cfe=function(_0x442bae){while(--_0x442bae){_0x43c7b1['push'](_0x43c7b1['shift']());}};_0x585cfe(++_0x3cda06);}(_0x4e07,0x84));var _0x74e0=function(_0x2ed1aa,_0x3b18e2){_0x2ed1aa=_0x2ed1aa-0x0;var _0x108e12=_0x4e07[_0x2ed1aa];return _0x108e12;};'use strict';var multer=require(_0x74e0('0x0'));var util=require(_0x74e0('0x1'));var path=require(_0x74e0('0x2'));var timeout=require(_0x74e0('0x3'));var express=require(_0x74e0('0x4'));var router=express[_0x74e0('0x5')]();var fs_extra=require(_0x74e0('0x6'));var auth=require(_0x74e0('0x7'));var interaction=require(_0x74e0('0x8'));var config=require('../../config/environment');var controller=require(_0x74e0('0x9'));router[_0x74e0('0xa')]('/',auth['isAuthenticated'](),controller[_0x74e0('0xb')]);router[_0x74e0('0xa')](_0x74e0('0xc'),auth[_0x74e0('0xd')](),controller[_0x74e0('0xe')]);router[_0x74e0('0xa')](_0x74e0('0xf'),auth[_0x74e0('0xd')](),controller['getConfigurations']);router[_0x74e0('0xa')](_0x74e0('0x10'),auth[_0x74e0('0xd')](),controller['getFields']);router['post']('/',auth[_0x74e0('0xd')](),controller[_0x74e0('0x11')]);router[_0x74e0('0x12')](_0x74e0('0xf'),auth[_0x74e0('0xd')](),controller['addConfiguration']);router[_0x74e0('0x13')](_0x74e0('0xc'),auth[_0x74e0('0xd')](),controller[_0x74e0('0x14')]);router[_0x74e0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x74e0('0x16')]);module[_0x74e0('0x17')]=router; \ No newline at end of file +var _0x16e5=['/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x4f83ab,_0x5cf858){var _0x543a0a=function(_0x209c8f){while(--_0x209c8f){_0x4f83ab['push'](_0x4f83ab['shift']());}};_0x543a0a(++_0x5cf858);}(_0x16e5,0x1a2));var _0x516e=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0x16e5[_0x2405bc];return _0x5272d4;};'use strict';var multer=require(_0x516e('0x0'));var util=require(_0x516e('0x1'));var path=require(_0x516e('0x2'));var timeout=require(_0x516e('0x3'));var express=require(_0x516e('0x4'));var router=express[_0x516e('0x5')]();var fs_extra=require(_0x516e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x516e('0x7'));var config=require(_0x516e('0x8'));var controller=require(_0x516e('0x9'));router[_0x516e('0xa')]('/',auth[_0x516e('0xb')](),controller[_0x516e('0xc')]);router[_0x516e('0xa')](_0x516e('0xd'),auth[_0x516e('0xb')](),controller['show']);router[_0x516e('0xa')](_0x516e('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x516e('0xa')](_0x516e('0xf'),auth[_0x516e('0xb')](),controller['getFields']);router[_0x516e('0x10')]('/',auth['isAuthenticated'](),controller[_0x516e('0x11')]);router[_0x516e('0x10')](_0x516e('0xe'),auth[_0x516e('0xb')](),controller[_0x516e('0x12')]);router[_0x516e('0x13')]('/:id',auth[_0x516e('0xb')](),controller[_0x516e('0x14')]);router[_0x516e('0x15')](_0x516e('0xd'),auth[_0x516e('0xb')](),controller[_0x516e('0x16')]);module[_0x516e('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index ffc0be3..2e5212b 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1153=['exports','STRING'];(function(_0x1b07e8,_0x3616c9){var _0x1dece9=function(_0x16ecd8){while(--_0x16ecd8){_0x1b07e8['push'](_0x1b07e8['shift']());}};_0x1dece9(++_0x3616c9);}(_0x1153,0x150));var _0x3115=function(_0x261137,_0x5c213e){_0x261137=_0x261137-0x0;var _0x378466=_0x1153[_0x261137];return _0x378466;};'use strict';var Sequelize=require('sequelize');module[_0x3115('0x0')]={'name':{'type':Sequelize[_0x3115('0x1')]},'description':{'type':Sequelize[_0x3115('0x1')]},'username':{'type':Sequelize[_0x3115('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x3115('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd850=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd850,0x69));var _0x0d85=function(_0x2a1d25,_0x3e9ae0){_0x2a1d25=_0x2a1d25-0x0;var _0x587fbd=_0xd850[_0x2a1d25];return _0x587fbd;};'use strict';var Sequelize=require(_0x0d85('0x0'));module[_0x0d85('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0d85('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x0d85('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0d85('0x2')],'unique':_0x0d85('0x4')},'serverUrl':{'type':Sequelize[_0x0d85('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 8c86472..0f1c424 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59a8=['values','module_fields','includes','label','endsWith','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','end','stack','name','send','merge','body','contact','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','include','findAll','rows','params','keys','includeAll','options','create','find','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','stringify'];(function(_0x4c5b40,_0x415615){var _0x2317a5=function(_0x13b039){while(--_0x13b039){_0x4c5b40['push'](_0x4c5b40['shift']());}};_0x2317a5(++_0x415615);}(_0x59a8,0x111));var _0x859a=function(_0x5a1f5e,_0x75f621){_0x5a1f5e=_0x5a1f5e-0x0;var _0x36b860=_0x59a8[_0x5a1f5e];return _0x36b860;};'use strict';var emlformat=require(_0x859a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x859a('0x1'));var jsonpatch=require(_0x859a('0x2'));var rp=require(_0x859a('0x3'));var moment=require('moment');var BPromise=require(_0x859a('0x4'));var Mustache=require(_0x859a('0x5'));var util=require(_0x859a('0x6'));var path=require(_0x859a('0x7'));var sox=require('sox');var csv=require(_0x859a('0x8'));var ejs=require(_0x859a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x859a('0xa'));var squel=require(_0x859a('0xb'));var crypto=require(_0x859a('0xc'));var jsforce=require(_0x859a('0xd'));var deskjs=require(_0x859a('0xe'));var toCsv=require(_0x859a('0x8'));var querystring=require('querystring');var Papa=require(_0x859a('0xf'));var Redis=require('ioredis');var authService=require(_0x859a('0x10'));var qs=require(_0x859a('0x11'));var as=require(_0x859a('0x12'));var hardwareService=require(_0x859a('0x13'));var logger=require(_0x859a('0x14'))(_0x859a('0x15'));var utils=require(_0x859a('0x16'));var config=require(_0x859a('0x17'));var licenseUtil=require(_0x859a('0x18'));var db=require(_0x859a('0x19'))['db'];var integrations=require(_0x859a('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0x859a('0x1b')][_0x859a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x38ffe9,_0x2a282d,_0x4fca6b,_0x28784a){return new BPromise(function(_0x25a44f,_0x3881a1){var _0x3ba3f3=_0x28784a||client;return _0x3ba3f3[_0x859a('0x1d')](_0x38ffe9,_0x4fca6b)[_0x859a('0x1e')](function(_0x5445b8){logger['info'](_0x859a('0x1f'),_0x2a282d,_0x859a('0x20'));logger['debug'](_0x859a('0x21'),_0x2a282d,_0x859a('0x20'),JSON['stringify'](_0x5445b8));if(_0x5445b8['error']){if(_0x5445b8[_0x859a('0x22')]['code']===0x1f4){logger['error'](_0x859a('0x1f'),_0x2a282d,_0x5445b8[_0x859a('0x22')][_0x859a('0x23')]);return _0x3881a1(_0x5445b8['error'][_0x859a('0x23')]);}logger[_0x859a('0x22')](_0x859a('0x1f'),_0x2a282d,_0x5445b8['error'][_0x859a('0x23')]);return _0x25a44f(_0x5445b8[_0x859a('0x22')]['message']);}else{logger[_0x859a('0x24')](_0x859a('0x1f'),_0x2a282d,_0x859a('0x20'));_0x25a44f(_0x5445b8[_0x859a('0x25')][_0x859a('0x23')]);}})[_0x859a('0x26')](function(_0x5a5e00){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2a282d,_0x5a5e00);_0x3881a1(_0x5a5e00);});});}function respondWithStatusCode(_0x5b6d27,_0x1880b5){_0x1880b5=_0x1880b5||0xcc;return function(_0x25c8f1){if(_0x25c8f1){return _0x5b6d27[_0x859a('0x27')](_0x1880b5);}return _0x5b6d27[_0x859a('0x28')](_0x1880b5)['end']();};}function respondWithResult(_0x11b3c3,_0x10072d){_0x10072d=_0x10072d||0xc8;return function(_0x1ff67e){if(_0x1ff67e){return _0x11b3c3[_0x859a('0x28')](_0x10072d)['json'](_0x1ff67e);}};}function respondWithFilteredResult(_0x5c1d96,_0x75a536){return function(_0x4846e1){if(_0x4846e1){var _0x2e4a3b=typeof _0x75a536[_0x859a('0x29')]===_0x859a('0x2a')&&typeof _0x75a536[_0x859a('0x2b')]===_0x859a('0x2a');var _0x5300f9=_0x4846e1[_0x859a('0x2c')];var _0x4853f8=_0x2e4a3b?0x0:_0x75a536['offset'];var _0x133427=_0x2e4a3b?_0x4846e1['count']:_0x75a536[_0x859a('0x29')]+_0x75a536[_0x859a('0x2b')];var _0x450e0f;if(_0x133427>=_0x5300f9){_0x133427=_0x5300f9;_0x450e0f=0xc8;}else{_0x450e0f=0xce;}_0x5c1d96[_0x859a('0x28')](_0x450e0f);return _0x5c1d96['set'](_0x859a('0x2d'),_0x4853f8+'-'+_0x133427+'/'+_0x5300f9)[_0x859a('0x2e')](_0x4846e1);}return null;};}function patchUpdates(_0x1fd3cd){return function(_0x28294b){try{jsonpatch[_0x859a('0x2f')](_0x28294b,_0x1fd3cd,!![]);}catch(_0x91e20b){return BPromise['reject'](_0x91e20b);}return _0x28294b[_0x859a('0x30')]();};}function saveUpdates(_0x4545d2,_0x1be2e0){return function(_0x3004a3){if(_0x3004a3){return _0x3004a3[_0x859a('0x31')](_0x4545d2)[_0x859a('0x1e')](function(_0x363bd7){return _0x363bd7;});}return null;};}function removeEntity(_0x208ce0,_0x4aa13b){return function(_0xa917a6){if(_0xa917a6){return _0xa917a6[_0x859a('0x32')]()['then'](function(){_0x208ce0[_0x859a('0x28')](0xcc)[_0x859a('0x33')]();});}};}function handleEntityNotFound(_0x340742,_0x2cb3d1){return function(_0x206991){if(!_0x206991){_0x340742[_0x859a('0x27')](0x194);}return _0x206991;};}function handleError(_0x36bfb9,_0x13c525){_0x13c525=_0x13c525||0x1f4;return function(_0x9b10b1){logger[_0x859a('0x22')](_0x9b10b1[_0x859a('0x34')]);if(_0x9b10b1[_0x859a('0x35')]){delete _0x9b10b1[_0x859a('0x35')];}_0x36bfb9[_0x859a('0x28')](_0x13c525)[_0x859a('0x36')](_0x9b10b1);};}function getMustacheRender(_0x3e224a,_0x53fdc2){return Mustache['render'](_0x3e224a,_[_0x859a('0x37')](_0x53fdc2[_0x859a('0x38')],{'contact':_0x53fdc2[_0x859a('0x39')],'message':_0x53fdc2[_0x859a('0x23')],'agent':_0x53fdc2['agent'],'interaction':_0x53fdc2['interaction'],'account':_0x53fdc2['account']}))||'';}exports[_0x859a('0x3a')]=function(_0x36a2a5,_0x108e85){var _0x5b59d4={},_0x526834={},_0x282907={'count':0x0,'rows':[]};var _0x5e7a74=_[_0x859a('0x3b')](db[_0x859a('0x3c')][_0x859a('0x3d')],function(_0x55138e){return{'name':_0x55138e[_0x859a('0x3e')],'type':_0x55138e[_0x859a('0x3f')][_0x859a('0x40')]};});_0x526834[_0x859a('0x41')]=_[_0x859a('0x3b')](_0x5e7a74,'name');_0x526834[_0x859a('0x42')]=_['keys'](_0x36a2a5[_0x859a('0x42')]);_0x526834['filters']=_[_0x859a('0x43')](_0x526834[_0x859a('0x41')],_0x526834['query']);_0x5b59d4[_0x859a('0x44')]=_[_0x859a('0x43')](_0x526834[_0x859a('0x41')],qs[_0x859a('0x45')](_0x36a2a5[_0x859a('0x42')][_0x859a('0x45')]));_0x5b59d4[_0x859a('0x44')]=_0x5b59d4[_0x859a('0x44')][_0x859a('0x46')]?_0x5b59d4[_0x859a('0x44')]:_0x526834['model'];if(!_0x36a2a5[_0x859a('0x42')][_0x859a('0x47')](_0x859a('0x48'))){_0x5b59d4[_0x859a('0x2b')]=qs['limit'](_0x36a2a5[_0x859a('0x42')][_0x859a('0x2b')]);_0x5b59d4[_0x859a('0x29')]=qs[_0x859a('0x29')](_0x36a2a5[_0x859a('0x42')][_0x859a('0x29')]);}_0x5b59d4[_0x859a('0x49')]=qs[_0x859a('0x4a')](_0x36a2a5[_0x859a('0x42')][_0x859a('0x4a')]);_0x5b59d4[_0x859a('0x4b')]=qs[_0x859a('0x4c')](_[_0x859a('0x4d')](_0x36a2a5[_0x859a('0x42')],_0x526834[_0x859a('0x4c')]),_0x5e7a74);if(_0x36a2a5['query'][_0x859a('0x4e')]){_0x5b59d4[_0x859a('0x4b')]=_[_0x859a('0x37')](_0x5b59d4[_0x859a('0x4b')],{'$or':_['map'](_0x5e7a74,function(_0x1b62ad){if(_0x1b62ad[_0x859a('0x3f')]!==_0x859a('0x4f')){var _0x9ad66d={};_0x9ad66d[_0x1b62ad[_0x859a('0x35')]]={'$like':'%'+_0x36a2a5[_0x859a('0x42')][_0x859a('0x4e')]+'%'};return _0x9ad66d;}})});}_0x5b59d4=_[_0x859a('0x37')]({},_0x5b59d4,_0x36a2a5['options']);var _0x4d9619={'where':_0x5b59d4[_0x859a('0x4b')]};return db[_0x859a('0x3c')][_0x859a('0x2c')](_0x4d9619)[_0x859a('0x1e')](function(_0x4fe248){_0x282907[_0x859a('0x2c')]=_0x4fe248;if(_0x36a2a5['query']['includeAll']){_0x5b59d4[_0x859a('0x50')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x859a('0x51')](_0x5b59d4);})['then'](function(_0x82195a){_0x282907[_0x859a('0x52')]=_0x82195a;return _0x282907;})[_0x859a('0x1e')](respondWithFilteredResult(_0x108e85,_0x5b59d4))[_0x859a('0x26')](handleError(_0x108e85,null));};exports['show']=function(_0x479599,_0x3b2585){var _0x555c59={'raw':![],'where':{'id':_0x479599[_0x859a('0x53')]['id']}},_0x5e82c2={};_0x5e82c2[_0x859a('0x41')]=_['keys'](db[_0x859a('0x3c')][_0x859a('0x3d')]);_0x5e82c2[_0x859a('0x42')]=_[_0x859a('0x54')](_0x479599[_0x859a('0x42')]);_0x5e82c2[_0x859a('0x4c')]=_[_0x859a('0x43')](_0x5e82c2[_0x859a('0x41')],_0x5e82c2[_0x859a('0x42')]);_0x555c59[_0x859a('0x44')]=_[_0x859a('0x43')](_0x5e82c2['model'],qs['fields'](_0x479599['query'][_0x859a('0x45')]));_0x555c59[_0x859a('0x44')]=_0x555c59[_0x859a('0x44')][_0x859a('0x46')]?_0x555c59[_0x859a('0x44')]:_0x5e82c2['model'];if(_0x479599[_0x859a('0x42')][_0x859a('0x55')]){_0x555c59[_0x859a('0x50')]=[{'all':!![]}];}_0x555c59=_['merge']({},_0x555c59,_0x479599[_0x859a('0x56')]);return db['SugarcrmAccount']['find'](_0x555c59)['then'](handleEntityNotFound(_0x3b2585,null))[_0x859a('0x1e')](respondWithResult(_0x3b2585,null))['catch'](handleError(_0x3b2585,null));};exports[_0x859a('0x57')]=function(_0xa20a81,_0x306523){return db[_0x859a('0x3c')]['create'](_0xa20a81[_0x859a('0x38')],{})[_0x859a('0x1e')](respondWithResult(_0x306523,0xc9))[_0x859a('0x26')](handleError(_0x306523,null));};exports[_0x859a('0x31')]=function(_0x9cb83c,_0x3076eb){if(_0x9cb83c[_0x859a('0x38')]['id']){delete _0x9cb83c[_0x859a('0x38')]['id'];}return db[_0x859a('0x3c')][_0x859a('0x58')]({'where':{'id':_0x9cb83c[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x3076eb,null))[_0x859a('0x1e')](saveUpdates(_0x9cb83c[_0x859a('0x38')],null))[_0x859a('0x1e')](respondWithResult(_0x3076eb,null))[_0x859a('0x26')](handleError(_0x3076eb,null));};exports[_0x859a('0x32')]=function(_0x5ce3d1,_0x556f83){return db[_0x859a('0x3c')][_0x859a('0x58')]({'where':{'id':_0x5ce3d1[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x556f83,null))[_0x859a('0x1e')](removeEntity(_0x556f83,null))[_0x859a('0x26')](handleError(_0x556f83,null));};exports['getConfigurations']=function(_0x45dd53,_0x5d4cbc,_0x428b20){var _0x1e9d06={};var _0x3e39e1={};var _0x122c8d;var _0xf47803;return db[_0x859a('0x3c')][_0x859a('0x59')]({'where':{'id':_0x45dd53[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x5d4cbc,null))[_0x859a('0x1e')](function(_0x227b2c){if(_0x227b2c){_0x122c8d=_0x227b2c;_0x3e39e1[_0x859a('0x41')]=_[_0x859a('0x54')](db[_0x859a('0x5a')][_0x859a('0x3d')]);_0x3e39e1[_0x859a('0x42')]=_[_0x859a('0x54')](_0x45dd53[_0x859a('0x42')]);_0x3e39e1[_0x859a('0x4c')]=_[_0x859a('0x43')](_0x3e39e1['model'],_0x3e39e1[_0x859a('0x42')]);_0x1e9d06[_0x859a('0x44')]=_[_0x859a('0x43')](_0x3e39e1[_0x859a('0x41')],qs[_0x859a('0x45')](_0x45dd53['query']['fields']));_0x1e9d06['attributes']=_0x1e9d06[_0x859a('0x44')][_0x859a('0x46')]?_0x1e9d06[_0x859a('0x44')]:_0x3e39e1['model'];_0x1e9d06[_0x859a('0x49')]=qs['sort'](_0x45dd53[_0x859a('0x42')][_0x859a('0x4a')]);_0x1e9d06[_0x859a('0x4b')]=qs[_0x859a('0x4c')](_[_0x859a('0x4d')](_0x45dd53[_0x859a('0x42')],_0x3e39e1[_0x859a('0x4c')]));if(_0x45dd53[_0x859a('0x42')][_0x859a('0x4e')]){_0x1e9d06['where']=_[_0x859a('0x37')](_0x1e9d06['where'],{'$or':_[_0x859a('0x3b')](_0x1e9d06[_0x859a('0x44')],function(_0x5b282d){var _0x1a3bc8={};_0x1a3bc8[_0x5b282d]={'$like':'%'+_0x45dd53['query'][_0x859a('0x4e')]+'%'};return _0x1a3bc8;})});}_0x1e9d06=_[_0x859a('0x37')]({},_0x1e9d06,_0x45dd53[_0x859a('0x56')]);return _0x122c8d['getConfigurations'](_0x1e9d06);}})['then'](function(_0x3e31b8){if(_0x3e31b8){_0xf47803=_0x3e31b8[_0x859a('0x46')];if(!_0x45dd53[_0x859a('0x42')][_0x859a('0x47')]('nolimit')){_0x1e9d06['limit']=qs['limit'](_0x45dd53['query']['limit']);_0x1e9d06[_0x859a('0x29')]=qs[_0x859a('0x29')](_0x45dd53['query']['offset']);}return _0x122c8d['getConfigurations'](_0x1e9d06);}})[_0x859a('0x1e')](function(_0x523e44){if(_0x523e44){return _0x523e44?{'count':_0xf47803,'rows':_0x523e44}:null;}})[_0x859a('0x1e')](respondWithResult(_0x5d4cbc,null))[_0x859a('0x26')](handleError(_0x5d4cbc,null));};exports[_0x859a('0x5b')]=function(_0x366b6e,_0x5298ef,_0x3eea26){if(_0x366b6e[_0x859a('0x38')]['id']){delete _0x366b6e[_0x859a('0x38')]['id'];}return db['SugarcrmAccount'][_0x859a('0x59')]({'where':{'id':_0x366b6e[_0x859a('0x53')]['id']}})[_0x859a('0x1e')](handleEntityNotFound(_0x5298ef,null))[_0x859a('0x1e')](function(_0x312730){if(_0x312730){_0x366b6e[_0x859a('0x38')][_0x859a('0x5c')]=_0x312730['id'];_0x366b6e[_0x859a('0x38')][_0x859a('0x5d')]=integrations[_0x859a('0x5e')](_0x366b6e[_0x859a('0x38')][_0x859a('0x5f')],_0x366b6e[_0x859a('0x38')]['type']);_0x366b6e[_0x859a('0x38')][_0x859a('0x60')]=integrations[_0x859a('0x61')](_0x366b6e['body']['channel'],_0x366b6e[_0x859a('0x38')][_0x859a('0x3f')]);return db[_0x859a('0x5a')][_0x859a('0x57')](_0x366b6e[_0x859a('0x38')],{'include':[{'model':db[_0x859a('0x62')],'as':_0x859a('0x5d')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x859a('0x1e')](respondWithResult(_0x5298ef,null))[_0x859a('0x26')](handleError(_0x5298ef,null));};exports[_0x859a('0x63')]=function(_0x41a055,_0x1a3dd1,_0x3046d9){var _0x286806='';var _0x456113=['id','name',_0x859a('0x64'),_0x859a('0x65'),_0x859a('0x66'),_0x859a('0x67'),_0x859a('0x68'),'duration_minutes',_0x859a('0x69'),_0x859a('0x6a'),_0x859a('0x6b'),_0x859a('0x6c')];return db[_0x859a('0x3c')][_0x859a('0x59')]({'where':{'id':_0x41a055['params']['id']},'attributes':['id',_0x859a('0x6d'),'password',_0x859a('0x6e')]})[_0x859a('0x1e')](handleEntityNotFound(_0x1a3dd1,null))[_0x859a('0x1e')](function(_0x3754cd){if(_0x3754cd){_0x286806=_0x3754cd[_0x859a('0x6e')];var _0xe94a77=_0x286806[_0x859a('0x6f')](-0x1);if(_0xe94a77==='/'){_0x286806=_0x286806[_0x859a('0x70')](0x0,_0x286806[_0x859a('0x71')](_0xe94a77));}return rp({'method':'POST','uri':util[_0x859a('0x72')]('%s%s',_0x286806,_0x859a('0x73')),'json':!![],'form':{'method':_0x859a('0x74'),'input_type':_0x859a('0x75'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3754cd[_0x859a('0x6d')],'password':_0x3754cd[_0x859a('0x76')],'encryption':_0x859a('0x77')},'application':_0x859a('0x78')})}});}})[_0x859a('0x1e')](function(_0x39307c){if(_0x39307c&&_0x39307c['name']!==_0x859a('0x79')&&_0x39307c[_0x859a('0x35')]!==_0x859a('0x7a')){return rp({'method':'POST','uri':util['format'](_0x859a('0x7b'),_0x286806,_0x859a('0x73')),'json':!![],'form':{'method':_0x859a('0x7c'),'input_type':_0x859a('0x75'),'response_type':_0x859a('0x75'),'rest_data':JSON[_0x859a('0x7d')]({'session':_0x39307c['id'],'module_name':'Calls'})}})[_0x859a('0x1e')](function(_0x4946b5){if(_0x4946b5){var _0x10132e=_[_0x859a('0x7e')](_0x4946b5[_0x859a('0x7f')]);_['remove'](_0x10132e,function(_0x4449d3){return _0x456113[_0x859a('0x80')](_0x4449d3[_0x859a('0x35')]);});return{'count':_0x10132e[_0x859a('0x46')],'rows':_['map'](_0x10132e,function(_0x2f0ace){return{'id':_0x2f0ace[_0x859a('0x35')],'name':_0x2f0ace[_0x859a('0x81')],'custom':_[_0x859a('0x82')](_0x2f0ace[_0x859a('0x35')],'_c')?!![]:![],'options':_0x2f0ace[_0x859a('0x56')]?_['map'](_[_0x859a('0x7e')](_0x2f0ace[_0x859a('0x56')]),function(_0x5e4e1b){return{'name':_0x5e4e1b['value'],'value':_0x5e4e1b[_0x859a('0x35')]};}):[]};})};}})[_0x859a('0x1e')](respondWithResult(_0x1a3dd1,null))[_0x859a('0x26')](function(_0x5595a4){var _0x545e75=_0x41a055[_0x859a('0x42')]['test']?0x1f4:_0x5595a4['statusCode']||0x1f4;logger[_0x859a('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x859a('0x63'),_0x545e75,JSON[_0x859a('0x7d')](_0x5595a4));delete _0x5595a4[_0x859a('0x35')];if(_0x545e75===0x191){_0x545e75=0x190;}_0x1a3dd1['status'](_0x545e75)[_0x859a('0x36')](_0x41a055['query'][_0x859a('0x83')]?{'message':_0x859a('0x84'),'statusCode':_0x5595a4['statusCode']}:_0x5595a4);});}else{var _0x72e46c=0x1f4;_0x1a3dd1[_0x859a('0x28')](_0x72e46c)['send']({'message':_0x859a('0x84'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xff12=['addConfiguration','findOne','getSubjects','getDescriptions','channel','SugarcrmField','Subjects','Descriptions','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','module_fields','remove','label','endsWith','values','value','test','statusCode','getFields','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','render','merge','body','contact','interaction','account','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','rows','show','params','find','create','getConfigurations','SugarcrmConfiguration','hasOwnProperty'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xff12,0x1bb));var _0x2ff1=function(_0x992c01,_0x154578){_0x992c01=_0x992c01-0x0;var _0x1f6b5e=_0xff12[_0x992c01];return _0x1f6b5e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2ff1('0x0'));var jsonpatch=require(_0x2ff1('0x1'));var rp=require(_0x2ff1('0x2'));var moment=require(_0x2ff1('0x3'));var BPromise=require(_0x2ff1('0x4'));var Mustache=require('mustache');var util=require(_0x2ff1('0x5'));var path=require('path');var sox=require(_0x2ff1('0x6'));var csv=require(_0x2ff1('0x7'));var ejs=require(_0x2ff1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ff1('0x9'));var squel=require(_0x2ff1('0xa'));var crypto=require(_0x2ff1('0xb'));var jsforce=require(_0x2ff1('0xc'));var deskjs=require(_0x2ff1('0xd'));var toCsv=require(_0x2ff1('0x7'));var querystring=require(_0x2ff1('0xe'));var Papa=require(_0x2ff1('0xf'));var Redis=require('ioredis');var authService=require(_0x2ff1('0x10'));var qs=require(_0x2ff1('0x11'));var as=require(_0x2ff1('0x12'));var hardwareService=require(_0x2ff1('0x13'));var logger=require(_0x2ff1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2ff1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ff1('0x16'))['db'];var integrations=require(_0x2ff1('0x17'));var jayson=require(_0x2ff1('0x18'));var client=jayson[_0x2ff1('0x19')][_0x2ff1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5208e5,_0x175cb8,_0x4de27b,_0x3780a8){return new BPromise(function(_0x5687ec,_0x5567f4){var _0x5a12f5=_0x3780a8||client;return _0x5a12f5[_0x2ff1('0x1b')](_0x5208e5,_0x4de27b)['then'](function(_0x2a6746){logger[_0x2ff1('0x1c')](_0x2ff1('0x1d'),_0x175cb8,_0x2ff1('0x1e'));logger[_0x2ff1('0x1f')](_0x2ff1('0x20'),_0x175cb8,'request\x20sent',JSON[_0x2ff1('0x21')](_0x2a6746));if(_0x2a6746[_0x2ff1('0x22')]){if(_0x2a6746[_0x2ff1('0x22')]['code']===0x1f4){logger[_0x2ff1('0x22')](_0x2ff1('0x1d'),_0x175cb8,_0x2a6746[_0x2ff1('0x22')][_0x2ff1('0x23')]);return _0x5567f4(_0x2a6746[_0x2ff1('0x22')]['message']);}logger[_0x2ff1('0x22')](_0x2ff1('0x1d'),_0x175cb8,_0x2a6746['error'][_0x2ff1('0x23')]);return _0x5687ec(_0x2a6746[_0x2ff1('0x22')][_0x2ff1('0x23')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x175cb8,_0x2ff1('0x1e'));_0x5687ec(_0x2a6746[_0x2ff1('0x24')][_0x2ff1('0x23')]);}})[_0x2ff1('0x25')](function(_0x217b01){logger['error'](_0x2ff1('0x1d'),_0x175cb8,_0x217b01);_0x5567f4(_0x217b01);});});}function respondWithStatusCode(_0x250fcd,_0xbb5bc4){_0xbb5bc4=_0xbb5bc4||0xcc;return function(_0x20624b){if(_0x20624b){return _0x250fcd['sendStatus'](_0xbb5bc4);}return _0x250fcd[_0x2ff1('0x26')](_0xbb5bc4)[_0x2ff1('0x27')]();};}function respondWithResult(_0xcd8438,_0xe182e2){_0xe182e2=_0xe182e2||0xc8;return function(_0x4ce0f5){if(_0x4ce0f5){return _0xcd8438[_0x2ff1('0x26')](_0xe182e2)[_0x2ff1('0x28')](_0x4ce0f5);}};}function respondWithFilteredResult(_0x38b1a7,_0x531f0e){return function(_0x226db9){if(_0x226db9){var _0x1ca8a7=typeof _0x531f0e[_0x2ff1('0x29')]==='undefined'&&typeof _0x531f0e['limit']==='undefined';var _0x5a90c3=_0x226db9['count'];var _0x22027e=_0x1ca8a7?0x0:_0x531f0e[_0x2ff1('0x29')];var _0x301adf=_0x1ca8a7?_0x226db9['count']:_0x531f0e[_0x2ff1('0x29')]+_0x531f0e[_0x2ff1('0x2a')];var _0x46a770;if(_0x301adf>=_0x5a90c3){_0x301adf=_0x5a90c3;_0x46a770=0xc8;}else{_0x46a770=0xce;}_0x38b1a7[_0x2ff1('0x26')](_0x46a770);return _0x38b1a7[_0x2ff1('0x2b')](_0x2ff1('0x2c'),_0x22027e+'-'+_0x301adf+'/'+_0x5a90c3)['json'](_0x226db9);}return null;};}function patchUpdates(_0x45bc09){return function(_0x5932ab){try{jsonpatch[_0x2ff1('0x2d')](_0x5932ab,_0x45bc09,!![]);}catch(_0x21cfe6){return BPromise['reject'](_0x21cfe6);}return _0x5932ab[_0x2ff1('0x2e')]();};}function saveUpdates(_0x5a2f8b,_0x49269b){return function(_0x2c7bf4){if(_0x2c7bf4){return _0x2c7bf4[_0x2ff1('0x2f')](_0x5a2f8b)[_0x2ff1('0x30')](function(_0x9e5d76){return _0x9e5d76;});}return null;};}function removeEntity(_0x443e02,_0x2e2d74){return function(_0x529141){if(_0x529141){return _0x529141[_0x2ff1('0x31')]()[_0x2ff1('0x30')](function(){_0x443e02[_0x2ff1('0x26')](0xcc)[_0x2ff1('0x27')]();});}};}function handleEntityNotFound(_0x542c40,_0x49e1bd){return function(_0x432d72){if(!_0x432d72){_0x542c40[_0x2ff1('0x32')](0x194);}return _0x432d72;};}function handleError(_0x42c545,_0x498caf){_0x498caf=_0x498caf||0x1f4;return function(_0x45f3d4){logger[_0x2ff1('0x22')](_0x45f3d4[_0x2ff1('0x33')]);if(_0x45f3d4[_0x2ff1('0x34')]){delete _0x45f3d4['name'];}_0x42c545[_0x2ff1('0x26')](_0x498caf)[_0x2ff1('0x35')](_0x45f3d4);};}function getMustacheRender(_0x2463fc,_0x46a46f){return Mustache[_0x2ff1('0x36')](_0x2463fc,_[_0x2ff1('0x37')](_0x46a46f[_0x2ff1('0x38')],{'contact':_0x46a46f[_0x2ff1('0x39')],'message':_0x46a46f[_0x2ff1('0x23')],'agent':_0x46a46f['agent'],'interaction':_0x46a46f[_0x2ff1('0x3a')],'account':_0x46a46f[_0x2ff1('0x3b')]}))||'';}exports['index']=function(_0x520a00,_0x177d19){var _0x3830f4={},_0x5714f9={},_0x3b7ace={'count':0x0,'rows':[]};var _0xce031=_[_0x2ff1('0x3c')](db[_0x2ff1('0x3d')][_0x2ff1('0x3e')],function(_0x2dd999){return{'name':_0x2dd999[_0x2ff1('0x3f')],'type':_0x2dd999[_0x2ff1('0x40')][_0x2ff1('0x41')]};});_0x5714f9[_0x2ff1('0x42')]=_['map'](_0xce031,_0x2ff1('0x34'));_0x5714f9[_0x2ff1('0x43')]=_[_0x2ff1('0x44')](_0x520a00[_0x2ff1('0x43')]);_0x5714f9[_0x2ff1('0x45')]=_[_0x2ff1('0x46')](_0x5714f9['model'],_0x5714f9[_0x2ff1('0x43')]);_0x3830f4[_0x2ff1('0x47')]=_['intersection'](_0x5714f9[_0x2ff1('0x42')],qs['fields'](_0x520a00['query'][_0x2ff1('0x48')]));_0x3830f4[_0x2ff1('0x47')]=_0x3830f4[_0x2ff1('0x47')][_0x2ff1('0x49')]?_0x3830f4[_0x2ff1('0x47')]:_0x5714f9[_0x2ff1('0x42')];if(!_0x520a00[_0x2ff1('0x43')]['hasOwnProperty'](_0x2ff1('0x4a'))){_0x3830f4['limit']=qs['limit'](_0x520a00[_0x2ff1('0x43')][_0x2ff1('0x2a')]);_0x3830f4[_0x2ff1('0x29')]=qs[_0x2ff1('0x29')](_0x520a00[_0x2ff1('0x43')][_0x2ff1('0x29')]);}_0x3830f4[_0x2ff1('0x4b')]=qs[_0x2ff1('0x4c')](_0x520a00[_0x2ff1('0x43')][_0x2ff1('0x4c')]);_0x3830f4[_0x2ff1('0x4d')]=qs['filters'](_[_0x2ff1('0x4e')](_0x520a00[_0x2ff1('0x43')],_0x5714f9[_0x2ff1('0x45')]),_0xce031);if(_0x520a00['query'][_0x2ff1('0x4f')]){_0x3830f4[_0x2ff1('0x4d')]=_[_0x2ff1('0x37')](_0x3830f4['where'],{'$or':_['map'](_0xce031,function(_0x2006ca){if(_0x2006ca[_0x2ff1('0x40')]!==_0x2ff1('0x50')){var _0x5edd7e={};_0x5edd7e[_0x2006ca['name']]={'$like':'%'+_0x520a00[_0x2ff1('0x43')]['filter']+'%'};return _0x5edd7e;}})});}_0x3830f4=_[_0x2ff1('0x37')]({},_0x3830f4,_0x520a00[_0x2ff1('0x51')]);var _0x90f14={'where':_0x3830f4[_0x2ff1('0x4d')]};return db[_0x2ff1('0x3d')][_0x2ff1('0x52')](_0x90f14)[_0x2ff1('0x30')](function(_0x2fe0f3){_0x3b7ace[_0x2ff1('0x52')]=_0x2fe0f3;if(_0x520a00[_0x2ff1('0x43')][_0x2ff1('0x53')]){_0x3830f4[_0x2ff1('0x54')]=[{'all':!![]}];}return db[_0x2ff1('0x3d')]['findAll'](_0x3830f4);})[_0x2ff1('0x30')](function(_0x4e8b78){_0x3b7ace[_0x2ff1('0x55')]=_0x4e8b78;return _0x3b7ace;})[_0x2ff1('0x30')](respondWithFilteredResult(_0x177d19,_0x3830f4))[_0x2ff1('0x25')](handleError(_0x177d19,null));};exports[_0x2ff1('0x56')]=function(_0x4d39e4,_0x1422e6){var _0x579507={'raw':![],'where':{'id':_0x4d39e4[_0x2ff1('0x57')]['id']}},_0x38b3ac={};_0x38b3ac['model']=_[_0x2ff1('0x44')](db[_0x2ff1('0x3d')][_0x2ff1('0x3e')]);_0x38b3ac['query']=_[_0x2ff1('0x44')](_0x4d39e4[_0x2ff1('0x43')]);_0x38b3ac[_0x2ff1('0x45')]=_[_0x2ff1('0x46')](_0x38b3ac[_0x2ff1('0x42')],_0x38b3ac[_0x2ff1('0x43')]);_0x579507['attributes']=_[_0x2ff1('0x46')](_0x38b3ac[_0x2ff1('0x42')],qs[_0x2ff1('0x48')](_0x4d39e4[_0x2ff1('0x43')][_0x2ff1('0x48')]));_0x579507[_0x2ff1('0x47')]=_0x579507['attributes'][_0x2ff1('0x49')]?_0x579507[_0x2ff1('0x47')]:_0x38b3ac['model'];if(_0x4d39e4['query'][_0x2ff1('0x53')]){_0x579507[_0x2ff1('0x54')]=[{'all':!![]}];}_0x579507=_['merge']({},_0x579507,_0x4d39e4[_0x2ff1('0x51')]);return db['SugarcrmAccount'][_0x2ff1('0x58')](_0x579507)['then'](handleEntityNotFound(_0x1422e6,null))[_0x2ff1('0x30')](respondWithResult(_0x1422e6,null))[_0x2ff1('0x25')](handleError(_0x1422e6,null));};exports[_0x2ff1('0x59')]=function(_0x2d032e,_0x1267d4){return db['SugarcrmAccount'][_0x2ff1('0x59')](_0x2d032e[_0x2ff1('0x38')],{})[_0x2ff1('0x30')](respondWithResult(_0x1267d4,0xc9))['catch'](handleError(_0x1267d4,null));};exports[_0x2ff1('0x2f')]=function(_0x5054a6,_0x3e7175){if(_0x5054a6[_0x2ff1('0x38')]['id']){delete _0x5054a6['body']['id'];}return db[_0x2ff1('0x3d')][_0x2ff1('0x58')]({'where':{'id':_0x5054a6[_0x2ff1('0x57')]['id']}})[_0x2ff1('0x30')](handleEntityNotFound(_0x3e7175,null))[_0x2ff1('0x30')](saveUpdates(_0x5054a6['body'],null))['then'](respondWithResult(_0x3e7175,null))['catch'](handleError(_0x3e7175,null));};exports[_0x2ff1('0x31')]=function(_0xd8e50a,_0x56d182){return db['SugarcrmAccount'][_0x2ff1('0x58')]({'where':{'id':_0xd8e50a[_0x2ff1('0x57')]['id']}})[_0x2ff1('0x30')](handleEntityNotFound(_0x56d182,null))[_0x2ff1('0x30')](removeEntity(_0x56d182,null))[_0x2ff1('0x25')](handleError(_0x56d182,null));};exports[_0x2ff1('0x5a')]=function(_0x551a1e,_0x15e3d1,_0xc9aa34){var _0x5158ba={};var _0x3c11a2={};var _0x1b42b3;var _0x3221b8;return db[_0x2ff1('0x3d')]['findOne']({'where':{'id':_0x551a1e[_0x2ff1('0x57')]['id']}})['then'](handleEntityNotFound(_0x15e3d1,null))[_0x2ff1('0x30')](function(_0x3d9a4f){if(_0x3d9a4f){_0x1b42b3=_0x3d9a4f;_0x3c11a2[_0x2ff1('0x42')]=_[_0x2ff1('0x44')](db[_0x2ff1('0x5b')][_0x2ff1('0x3e')]);_0x3c11a2[_0x2ff1('0x43')]=_[_0x2ff1('0x44')](_0x551a1e['query']);_0x3c11a2[_0x2ff1('0x45')]=_[_0x2ff1('0x46')](_0x3c11a2['model'],_0x3c11a2['query']);_0x5158ba[_0x2ff1('0x47')]=_[_0x2ff1('0x46')](_0x3c11a2[_0x2ff1('0x42')],qs['fields'](_0x551a1e['query'][_0x2ff1('0x48')]));_0x5158ba[_0x2ff1('0x47')]=_0x5158ba[_0x2ff1('0x47')][_0x2ff1('0x49')]?_0x5158ba['attributes']:_0x3c11a2[_0x2ff1('0x42')];_0x5158ba[_0x2ff1('0x4b')]=qs[_0x2ff1('0x4c')](_0x551a1e[_0x2ff1('0x43')][_0x2ff1('0x4c')]);_0x5158ba[_0x2ff1('0x4d')]=qs[_0x2ff1('0x45')](_[_0x2ff1('0x4e')](_0x551a1e['query'],_0x3c11a2[_0x2ff1('0x45')]));if(_0x551a1e['query'][_0x2ff1('0x4f')]){_0x5158ba['where']=_[_0x2ff1('0x37')](_0x5158ba['where'],{'$or':_[_0x2ff1('0x3c')](_0x5158ba['attributes'],function(_0x3c5407){var _0x1654e5={};_0x1654e5[_0x3c5407]={'$like':'%'+_0x551a1e[_0x2ff1('0x43')][_0x2ff1('0x4f')]+'%'};return _0x1654e5;})});}_0x5158ba=_[_0x2ff1('0x37')]({},_0x5158ba,_0x551a1e[_0x2ff1('0x51')]);return _0x1b42b3['getConfigurations'](_0x5158ba);}})['then'](function(_0x5bb719){if(_0x5bb719){_0x3221b8=_0x5bb719[_0x2ff1('0x49')];if(!_0x551a1e[_0x2ff1('0x43')][_0x2ff1('0x5c')]('nolimit')){_0x5158ba[_0x2ff1('0x2a')]=qs[_0x2ff1('0x2a')](_0x551a1e[_0x2ff1('0x43')][_0x2ff1('0x2a')]);_0x5158ba['offset']=qs[_0x2ff1('0x29')](_0x551a1e['query']['offset']);}return _0x1b42b3[_0x2ff1('0x5a')](_0x5158ba);}})[_0x2ff1('0x30')](function(_0x3249b2){if(_0x3249b2){return _0x3249b2?{'count':_0x3221b8,'rows':_0x3249b2}:null;}})['then'](respondWithResult(_0x15e3d1,null))[_0x2ff1('0x25')](handleError(_0x15e3d1,null));};exports[_0x2ff1('0x5d')]=function(_0xb61ed4,_0x518497,_0x522ee1){if(_0xb61ed4['body']['id']){delete _0xb61ed4['body']['id'];}return db[_0x2ff1('0x3d')][_0x2ff1('0x5e')]({'where':{'id':_0xb61ed4[_0x2ff1('0x57')]['id']}})[_0x2ff1('0x30')](handleEntityNotFound(_0x518497,null))[_0x2ff1('0x30')](function(_0x56f548){if(_0x56f548){_0xb61ed4['body']['AccountId']=_0x56f548['id'];_0xb61ed4[_0x2ff1('0x38')]['Subjects']=integrations[_0x2ff1('0x5f')](_0xb61ed4[_0x2ff1('0x38')]['channel'],_0xb61ed4[_0x2ff1('0x38')][_0x2ff1('0x40')]);_0xb61ed4[_0x2ff1('0x38')]['Descriptions']=integrations[_0x2ff1('0x60')](_0xb61ed4[_0x2ff1('0x38')][_0x2ff1('0x61')],_0xb61ed4[_0x2ff1('0x38')][_0x2ff1('0x40')]);return db[_0x2ff1('0x5b')][_0x2ff1('0x59')](_0xb61ed4['body'],{'include':[{'model':db[_0x2ff1('0x62')],'as':_0x2ff1('0x63')},{'model':db[_0x2ff1('0x62')],'as':_0x2ff1('0x64')}]});}return null;})['then'](respondWithResult(_0x518497,null))[_0x2ff1('0x25')](handleError(_0x518497,null));};exports['getFields']=function(_0x149b81,_0x224ab9,_0x4d66d5){var _0x1cd476='';var _0x11f49d=['id',_0x2ff1('0x34'),_0x2ff1('0x65'),_0x2ff1('0x66'),'description',_0x2ff1('0x67'),_0x2ff1('0x68'),_0x2ff1('0x69'),_0x2ff1('0x6a'),_0x2ff1('0x6b'),_0x2ff1('0x6c'),'direction'];return db[_0x2ff1('0x3d')]['findOne']({'where':{'id':_0x149b81[_0x2ff1('0x57')]['id']},'attributes':['id',_0x2ff1('0x6d'),'password',_0x2ff1('0x6e')]})[_0x2ff1('0x30')](handleEntityNotFound(_0x224ab9,null))[_0x2ff1('0x30')](function(_0x7e338f){if(_0x7e338f){_0x1cd476=_0x7e338f[_0x2ff1('0x6e')];var _0x3a50e8=_0x1cd476[_0x2ff1('0x6f')](-0x1);if(_0x3a50e8==='/'){_0x1cd476=_0x1cd476[_0x2ff1('0x70')](0x0,_0x1cd476[_0x2ff1('0x71')](_0x3a50e8));}return rp({'method':_0x2ff1('0x72'),'uri':util[_0x2ff1('0x73')](_0x2ff1('0x74'),_0x1cd476,_0x2ff1('0x75')),'json':!![],'form':{'method':_0x2ff1('0x76'),'input_type':_0x2ff1('0x77'),'response_type':_0x2ff1('0x77'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x7e338f[_0x2ff1('0x6d')],'password':_0x7e338f[_0x2ff1('0x78')],'encryption':'PLAIN'},'application':_0x2ff1('0x79')})}});}})[_0x2ff1('0x30')](function(_0xd01a70){if(_0xd01a70&&_0xd01a70[_0x2ff1('0x34')]!==_0x2ff1('0x7a')&&_0xd01a70[_0x2ff1('0x34')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x2ff1('0x73')](_0x2ff1('0x74'),_0x1cd476,_0x2ff1('0x75')),'json':!![],'form':{'method':_0x2ff1('0x7b'),'input_type':_0x2ff1('0x77'),'response_type':'JSON','rest_data':JSON[_0x2ff1('0x21')]({'session':_0xd01a70['id'],'module_name':'Calls'})}})[_0x2ff1('0x30')](function(_0x1930a8){if(_0x1930a8){var _0x41d86b=_['values'](_0x1930a8[_0x2ff1('0x7c')]);_[_0x2ff1('0x7d')](_0x41d86b,function(_0x55eb0f){return _0x11f49d['includes'](_0x55eb0f[_0x2ff1('0x34')]);});return{'count':_0x41d86b[_0x2ff1('0x49')],'rows':_[_0x2ff1('0x3c')](_0x41d86b,function(_0x4443b6){return{'id':_0x4443b6['name'],'name':_0x4443b6[_0x2ff1('0x7e')],'custom':_[_0x2ff1('0x7f')](_0x4443b6['name'],'_c')?!![]:![],'options':_0x4443b6[_0x2ff1('0x51')]?_[_0x2ff1('0x3c')](_[_0x2ff1('0x80')](_0x4443b6[_0x2ff1('0x51')]),function(_0x285bc9){return{'name':_0x285bc9[_0x2ff1('0x81')],'value':_0x285bc9[_0x2ff1('0x34')]};}):[]};})};}})[_0x2ff1('0x30')](respondWithResult(_0x224ab9,null))['catch'](function(_0x57bfde){var _0xc82eda=_0x149b81[_0x2ff1('0x43')][_0x2ff1('0x82')]?0x1f4:_0x57bfde[_0x2ff1('0x83')]||0x1f4;logger[_0x2ff1('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x2ff1('0x84'),_0xc82eda,JSON[_0x2ff1('0x21')](_0x57bfde));delete _0x57bfde['name'];if(_0xc82eda===0x191){_0xc82eda=0x190;}_0x224ab9[_0x2ff1('0x26')](_0xc82eda)[_0x2ff1('0x35')](_0x149b81[_0x2ff1('0x43')][_0x2ff1('0x82')]?{'message':_0x2ff1('0x85'),'statusCode':_0x57bfde[_0x2ff1('0x83')]}:_0x57bfde);});}else{var _0x491306=0x1f4;_0x224ab9[_0x2ff1('0x26')](_0x491306)[_0x2ff1('0x35')]({'message':_0x2ff1('0x85'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 6252f53..a17f56a 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa531=['exports','define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x3b5a64,_0x341488){var _0x2852e3=function(_0xb6928c){while(--_0xb6928c){_0x3b5a64['push'](_0x3b5a64['shift']());}};_0x2852e3(++_0x341488);}(_0xa531,0x12e));var _0x1a53=function(_0x334e95,_0x305878){_0x334e95=_0x334e95-0x0;var _0x5eb054=_0xa531[_0x334e95];return _0x5eb054;};'use strict';var _=require(_0x1a53('0x0'));var util=require(_0x1a53('0x1'));var logger=require(_0x1a53('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a53('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a53('0x4'));var rimraf=require(_0x1a53('0x5'));var config=require(_0x1a53('0x6'));var attributes=require(_0x1a53('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1a53('0x8')]=function(_0x1bbc60,_0x2d1d3f){return _0x1bbc60[_0x1a53('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a4f=['int_sugarcrm_accounts','lodash','../../config/logger','api','bluebird','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2d0f6b,_0x4df7cc){var _0x1aa0d4=function(_0x2dee36){while(--_0x2dee36){_0x2d0f6b['push'](_0x2d0f6b['shift']());}};_0x1aa0d4(++_0x4df7cc);}(_0x2a4f,0xfd));var _0xf2a4=function(_0x5b0741,_0x438df7){_0x5b0741=_0x5b0741-0x0;var _0x3ee9c9=_0x2a4f[_0x5b0741];return _0x3ee9c9;};'use strict';var _=require(_0xf2a4('0x0'));var util=require('util');var logger=require(_0xf2a4('0x1'))(_0xf2a4('0x2'));var moment=require('moment');var BPromise=require(_0xf2a4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2a4('0x4'));var rimraf=require('rimraf');var config=require(_0xf2a4('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xf2a4('0x6'));module[_0xf2a4('0x7')]=function(_0x42fb7f,_0x3d7cfc){return _0x42fb7f['define']('SugarcrmAccount',attributes,{'tableName':_0xf2a4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index f7928d2..04b3a78 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf10d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','SugarcrmAccount','find','raw','ShowSugarcrmAccount','lodash','util'];(function(_0x360c2c,_0x4b8e5a){var _0x441f4a=function(_0x201f10){while(--_0x201f10){_0x360c2c['push'](_0x360c2c['shift']());}};_0x441f4a(++_0x4b8e5a);}(_0xf10d,0x116));var _0xdf10=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf10d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xdf10('0x0'));var util=require(_0xdf10('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdf10('0x2'));var fs=require('fs');var Redis=require(_0xdf10('0x3'));var db=require(_0xdf10('0x4'))['db'];var utils=require(_0xdf10('0x5'));var logger=require(_0xdf10('0x6'))('rpc');var config=require(_0xdf10('0x7'));var jayson=require(_0xdf10('0x8'));var client=jayson[_0xdf10('0x9')][_0xdf10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ed6b9,_0xa94673,_0x312379){return new BPromise(function(_0x1a114a,_0xd1a5b5){return client[_0xdf10('0xb')](_0x4ed6b9,_0x312379)[_0xdf10('0xc')](function(_0x4a3dc4){logger[_0xdf10('0xd')](_0xdf10('0xe'),_0xa94673,_0xdf10('0xf'));logger[_0xdf10('0x10')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xa94673,_0xdf10('0xf'),JSON[_0xdf10('0x11')](_0x4a3dc4));if(_0x4a3dc4[_0xdf10('0x12')]){if(_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x13')]===0x1f4){logger['error'](_0xdf10('0xe'),_0xa94673,_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x14')]);return _0xd1a5b5(_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x14')]);}logger[_0xdf10('0x12')](_0xdf10('0xe'),_0xa94673,_0x4a3dc4[_0xdf10('0x12')]['message']);return _0x1a114a(_0x4a3dc4[_0xdf10('0x12')][_0xdf10('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0xa94673,_0xdf10('0xf'));_0x1a114a(_0x4a3dc4['result'][_0xdf10('0x14')]);}})[_0xdf10('0x15')](function(_0xe235e2){logger['error'](_0xdf10('0xe'),_0xa94673,_0xe235e2);_0xd1a5b5(_0xe235e2);});});}exports[_0xdf10('0x16')]=function(_0xd0f221){var _0x51c10e=this;return new Promise(function(_0x38788d,_0x50cfb6){return db['SugarcrmAccount'][_0xdf10('0x17')]({'raw':_0xd0f221[_0xdf10('0x18')]?_0xd0f221[_0xdf10('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd0f221['options']?_0xd0f221['options'][_0xdf10('0x19')]||null:null,'attributes':_0xd0f221[_0xdf10('0x18')]?_0xd0f221[_0xdf10('0x18')][_0xdf10('0x1a')]||null:null,'limit':_0xd0f221[_0xdf10('0x18')]?_0xd0f221[_0xdf10('0x18')][_0xdf10('0x1b')]||null:null,'include':_0xd0f221[_0xdf10('0x18')]?_0xd0f221['options'][_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0xd0f221[_0xdf10('0x18')][_0xdf10('0x1c')],function(_0x2fb446){return{'model':db[_0x2fb446[_0xdf10('0x1e')]],'as':_0x2fb446['as'],'attributes':_0x2fb446[_0xdf10('0x1a')],'include':_0x2fb446[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x2fb446[_0xdf10('0x1c')],function(_0x311db3){return{'model':db[_0x311db3[_0xdf10('0x1e')]],'as':_0x311db3['as'],'attributes':_0x311db3['attributes'],'include':_0x311db3[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x311db3[_0xdf10('0x1c')],function(_0x2bd277){return{'model':db[_0x2bd277[_0xdf10('0x1e')]],'as':_0x2bd277['as'],'attributes':_0x2bd277['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf10('0xc')](function(_0x4354c8){logger[_0xdf10('0xd')](_0xdf10('0x16'),_0xd0f221);logger['debug'](_0xdf10('0x16'),_0xd0f221,JSON[_0xdf10('0x11')](_0x4354c8));_0x38788d(_0x4354c8);})[_0xdf10('0x15')](function(_0x214512){logger['error'](_0xdf10('0x16'),_0x214512['message'],_0xd0f221);_0x50cfb6(_0x51c10e[_0xdf10('0x12')](0x1f4,_0x214512[_0xdf10('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x2584a0){var _0x372998=this;return new Promise(function(_0xacd06b,_0x4638d7){return db[_0xdf10('0x1f')][_0xdf10('0x20')]({'raw':_0x2584a0['options']?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x21')]===undefined?!![]:![]:!![],'where':_0x2584a0[_0xdf10('0x18')]?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x19')]||null:null,'attributes':_0x2584a0['options']?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x1a')]||null:null,'include':_0x2584a0[_0xdf10('0x18')]?_0x2584a0[_0xdf10('0x18')][_0xdf10('0x1c')]?_['map'](_0x2584a0[_0xdf10('0x18')][_0xdf10('0x1c')],function(_0x28379c){return{'model':db[_0x28379c[_0xdf10('0x1e')]],'as':_0x28379c['as'],'attributes':_0x28379c['attributes'],'include':_0x28379c[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x28379c['include'],function(_0x3384c7){return{'model':db[_0x3384c7[_0xdf10('0x1e')]],'as':_0x3384c7['as'],'attributes':_0x3384c7['attributes'],'include':_0x3384c7[_0xdf10('0x1c')]?_[_0xdf10('0x1d')](_0x3384c7['include'],function(_0x508f5e){return{'model':db[_0x508f5e['model']],'as':_0x508f5e['as'],'attributes':_0x508f5e['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf10('0xc')](function(_0x506912){logger[_0xdf10('0xd')]('ShowSugarcrmAccount',_0x2584a0);logger[_0xdf10('0x10')](_0xdf10('0x22'),_0x2584a0,JSON[_0xdf10('0x11')](_0x506912));_0xacd06b(_0x506912);})[_0xdf10('0x15')](function(_0x2660b3){logger['error']('ShowSugarcrmAccount',_0x2660b3[_0xdf10('0x14')],_0x2584a0);_0x4638d7(_0x372998['error'](0x1f4,_0x2660b3[_0xdf10('0x14')]));});});}; \ No newline at end of file +var _0xac4a=['findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xac4a,0xb4));var _0xaac4=function(_0x3ec0c4,_0x28b6f8){_0x3ec0c4=_0x3ec0c4-0x0;var _0x59395b=_0xac4a[_0x3ec0c4];return _0x59395b;};'use strict';var _=require('lodash');var util=require(_0xaac4('0x0'));var moment=require(_0xaac4('0x1'));var BPromise=require(_0xaac4('0x2'));var rs=require(_0xaac4('0x3'));var fs=require('fs');var Redis=require(_0xaac4('0x4'));var db=require(_0xaac4('0x5'))['db'];var utils=require(_0xaac4('0x6'));var logger=require(_0xaac4('0x7'))(_0xaac4('0x8'));var config=require(_0xaac4('0x9'));var jayson=require(_0xaac4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2483f6,_0x46fc95,_0x35ae66){return new BPromise(function(_0x226c39,_0x41709d){return client['request'](_0x2483f6,_0x35ae66)['then'](function(_0x251950){logger[_0xaac4('0xb')](_0xaac4('0xc'),_0x46fc95,_0xaac4('0xd'));logger[_0xaac4('0xe')](_0xaac4('0xf'),_0x46fc95,_0xaac4('0xd'),JSON[_0xaac4('0x10')](_0x251950));if(_0x251950[_0xaac4('0x11')]){if(_0x251950[_0xaac4('0x11')][_0xaac4('0x12')]===0x1f4){logger[_0xaac4('0x11')](_0xaac4('0xc'),_0x46fc95,_0x251950['error'][_0xaac4('0x13')]);return _0x41709d(_0x251950['error'][_0xaac4('0x13')]);}logger['error'](_0xaac4('0xc'),_0x46fc95,_0x251950['error'][_0xaac4('0x13')]);return _0x226c39(_0x251950[_0xaac4('0x11')][_0xaac4('0x13')]);}else{logger[_0xaac4('0xb')](_0xaac4('0xc'),_0x46fc95,_0xaac4('0xd'));_0x226c39(_0x251950[_0xaac4('0x14')][_0xaac4('0x13')]);}})[_0xaac4('0x15')](function(_0x12777b){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x46fc95,_0x12777b);_0x41709d(_0x12777b);});});}exports[_0xaac4('0x16')]=function(_0x111f2c){var _0x5df02e=this;return new Promise(function(_0x3709ba,_0x5300a8){return db[_0xaac4('0x17')][_0xaac4('0x18')]({'raw':_0x111f2c[_0xaac4('0x19')]?_0x111f2c['options'][_0xaac4('0x1a')]===undefined?!![]:![]:!![],'where':_0x111f2c[_0xaac4('0x19')]?_0x111f2c[_0xaac4('0x19')][_0xaac4('0x1b')]||null:null,'attributes':_0x111f2c[_0xaac4('0x19')]?_0x111f2c[_0xaac4('0x19')][_0xaac4('0x1c')]||null:null,'limit':_0x111f2c[_0xaac4('0x19')]?_0x111f2c[_0xaac4('0x19')][_0xaac4('0x1d')]||null:null,'include':_0x111f2c['options']?_0x111f2c[_0xaac4('0x19')][_0xaac4('0x1e')]?_[_0xaac4('0x1f')](_0x111f2c[_0xaac4('0x19')]['include'],function(_0x43bcc1){return{'model':db[_0x43bcc1[_0xaac4('0x20')]],'as':_0x43bcc1['as'],'attributes':_0x43bcc1[_0xaac4('0x1c')],'include':_0x43bcc1['include']?_[_0xaac4('0x1f')](_0x43bcc1[_0xaac4('0x1e')],function(_0x5e38f4){return{'model':db[_0x5e38f4[_0xaac4('0x20')]],'as':_0x5e38f4['as'],'attributes':_0x5e38f4['attributes'],'include':_0x5e38f4[_0xaac4('0x1e')]?_[_0xaac4('0x1f')](_0x5e38f4['include'],function(_0x1ceed9){return{'model':db[_0x1ceed9[_0xaac4('0x20')]],'as':_0x1ceed9['as'],'attributes':_0x1ceed9[_0xaac4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5229ba){logger['info'](_0xaac4('0x16'),_0x111f2c);logger[_0xaac4('0xe')]('GetSugarcrmAccount',_0x111f2c,JSON[_0xaac4('0x10')](_0x5229ba));_0x3709ba(_0x5229ba);})[_0xaac4('0x15')](function(_0x38e2dd){logger[_0xaac4('0x11')](_0xaac4('0x16'),_0x38e2dd[_0xaac4('0x13')],_0x111f2c);_0x5300a8(_0x5df02e['error'](0x1f4,_0x38e2dd[_0xaac4('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x1d9888){var _0x293170=this;return new Promise(function(_0x5c6cff,_0x385c6d){return db[_0xaac4('0x17')]['find']({'raw':_0x1d9888[_0xaac4('0x19')]?_0x1d9888['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d9888[_0xaac4('0x19')]?_0x1d9888['options'][_0xaac4('0x1b')]||null:null,'attributes':_0x1d9888[_0xaac4('0x19')]?_0x1d9888[_0xaac4('0x19')][_0xaac4('0x1c')]||null:null,'include':_0x1d9888[_0xaac4('0x19')]?_0x1d9888[_0xaac4('0x19')]['include']?_[_0xaac4('0x1f')](_0x1d9888[_0xaac4('0x19')][_0xaac4('0x1e')],function(_0x16efb7){return{'model':db[_0x16efb7['model']],'as':_0x16efb7['as'],'attributes':_0x16efb7[_0xaac4('0x1c')],'include':_0x16efb7[_0xaac4('0x1e')]?_['map'](_0x16efb7[_0xaac4('0x1e')],function(_0x32cee6){return{'model':db[_0x32cee6['model']],'as':_0x32cee6['as'],'attributes':_0x32cee6[_0xaac4('0x1c')],'include':_0x32cee6['include']?_[_0xaac4('0x1f')](_0x32cee6[_0xaac4('0x1e')],function(_0x241b25){return{'model':db[_0x241b25['model']],'as':_0x241b25['as'],'attributes':_0x241b25['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x320a1a){logger['info'](_0xaac4('0x21'),_0x1d9888);logger[_0xaac4('0xe')](_0xaac4('0x21'),_0x1d9888,JSON[_0xaac4('0x10')](_0x320a1a));_0x5c6cff(_0x320a1a);})['catch'](function(_0x3ee641){logger['error'](_0xaac4('0x21'),_0x3ee641[_0xaac4('0x13')],_0x1d9888);_0x385c6d(_0x293170[_0xaac4('0x11')](0x1f4,_0x3ee641[_0xaac4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f12ed5e..385ace6 100644 --- a/server/api/intSugarcrmConfiguration/index.js +++ b/server/api/intSugarcrmConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb408=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x3f498c,_0x571a61){var _0x12fd70=function(_0x41ad31){while(--_0x41ad31){_0x3f498c['push'](_0x3f498c['shift']());}};_0x12fd70(++_0x571a61);}(_0xb408,0x15f));var _0x8b40=function(_0x120d71,_0x57a0e2){_0x120d71=_0x120d71-0x0;var _0xa896c6=_0xb408[_0x120d71];return _0xa896c6;};'use strict';var multer=require(_0x8b40('0x0'));var util=require(_0x8b40('0x1'));var path=require('path');var timeout=require(_0x8b40('0x2'));var express=require(_0x8b40('0x3'));var router=express['Router']();var fs_extra=require(_0x8b40('0x4'));var auth=require(_0x8b40('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x8b40('0x6')]('/',auth[_0x8b40('0x7')](),controller[_0x8b40('0x8')]);router[_0x8b40('0x6')](_0x8b40('0x9'),auth[_0x8b40('0x7')](),controller[_0x8b40('0xa')]);router[_0x8b40('0x6')](_0x8b40('0xb'),auth['isAuthenticated'](),controller[_0x8b40('0xc')]);router[_0x8b40('0x6')](_0x8b40('0xd'),auth[_0x8b40('0x7')](),controller[_0x8b40('0xe')]);router[_0x8b40('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x8b40('0xf')]);router[_0x8b40('0x10')]('/',auth[_0x8b40('0x7')](),controller['create']);router[_0x8b40('0x11')](_0x8b40('0x9'),auth[_0x8b40('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8b40('0x12')]);module[_0x8b40('0x13')]=router; \ No newline at end of file +var _0xdb67=['getDescriptions','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','index','/:id','isAuthenticated','show','get','/:id/fields','getFields','getSubjects'];(function(_0x31f2dc,_0x4b13bd){var _0x2359b2=function(_0x18ed5a){while(--_0x18ed5a){_0x31f2dc['push'](_0x31f2dc['shift']());}};_0x2359b2(++_0x4b13bd);}(_0xdb67,0x1be));var _0x7db6=function(_0x3ffbf0,_0x28e211){_0x3ffbf0=_0x3ffbf0-0x0;var _0x1805bb=_0xdb67[_0x3ffbf0];return _0x1805bb;};'use strict';var multer=require(_0x7db6('0x0'));var util=require(_0x7db6('0x1'));var path=require(_0x7db6('0x2'));var timeout=require('connect-timeout');var express=require(_0x7db6('0x3'));var router=express[_0x7db6('0x4')]();var fs_extra=require(_0x7db6('0x5'));var auth=require(_0x7db6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7db6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7db6('0x8')]);router['get'](_0x7db6('0x9'),auth[_0x7db6('0xa')](),controller[_0x7db6('0xb')]);router[_0x7db6('0xc')](_0x7db6('0xd'),auth[_0x7db6('0xa')](),controller[_0x7db6('0xe')]);router[_0x7db6('0xc')]('/:id/subjects',auth[_0x7db6('0xa')](),controller[_0x7db6('0xf')]);router[_0x7db6('0xc')]('/:id/descriptions',auth[_0x7db6('0xa')](),controller[_0x7db6('0x10')]);router['post']('/',auth[_0x7db6('0xa')](),controller['create']);router[_0x7db6('0x11')](_0x7db6('0x9'),auth[_0x7db6('0xa')](),controller[_0x7db6('0x12')]);router['delete'](_0x7db6('0x9'),auth[_0x7db6('0xa')](),controller[_0x7db6('0x13')]);module[_0x7db6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c90c82d..acb924f 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x318e=['STRING','sequelize','exports'];(function(_0x2284f8,_0x353aab){var _0x116145=function(_0x1a1513){while(--_0x1a1513){_0x2284f8['push'](_0x2284f8['shift']());}};_0x116145(++_0x353aab);}(_0x318e,0x1c6));var _0xe318=function(_0x7c610a,_0x2ffd26){_0x7c610a=_0x7c610a-0x0;var _0x835b35=_0x318e[_0x7c610a];return _0x835b35;};'use strict';var Sequelize=require(_0xe318('0x0'));module[_0xe318('0x1')]={'name':{'type':Sequelize[_0xe318('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x742f=['STRING','sequelize'];(function(_0x25602f,_0x1abb53){var _0x21f68d=function(_0x5af561){while(--_0x5af561){_0x25602f['push'](_0x25602f['shift']());}};_0x21f68d(++_0x1abb53);}(_0x742f,0x1d5));var _0xf742=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x742f[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0xf742('0x0'));module['exports']={'name':{'type':Sequelize[_0xf742('0x1')]},'description':{'type':Sequelize[_0xf742('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4cbb83a..45a9710 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','find','getFields','findOne','SugarcrmField','rawAttributes','order','options','getSubjects','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','merge','body','contact','account','map','SugarcrmConfiguration','fieldName','type','keys','query','filters','intersection','attributes'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=typeof _0x40c424[_0x0a9e('0x27')]==='undefined'&&typeof _0x40c424[_0x0a9e('0x28')]==='undefined';var _0x1dc186=_0x33161b[_0x0a9e('0x29')];var _0x25fba9=_0x526cf3?0x0:_0x40c424[_0x0a9e('0x27')];var _0x140511=_0x526cf3?_0x33161b[_0x0a9e('0x29')]:_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')];var _0x5a101a;if(_0x140511>=_0x1dc186){_0x140511=_0x1dc186;_0x5a101a=0xc8;}else{_0x5a101a=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x5a101a);return _0x3a8e58[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x25fba9+'-'+_0x140511+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x5c877d){return function(_0x15b200){try{jsonpatch[_0x0a9e('0x2c')](_0x15b200,_0x5c877d,!![]);}catch(_0x1843b2){return BPromise[_0x0a9e('0x2d')](_0x1843b2);}return _0x15b200[_0x0a9e('0x2e')]();};}function saveUpdates(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x2f')](_0x563b45)['then'](function(_0x426950){return _0x426950;});}return null;};}function removeEntity(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x30')]()[_0x0a9e('0x31')](function(){_0x5d1e0e[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x66c1d2,_0x46f0a5){return function(_0x40cb85){if(!_0x40cb85){_0x66c1d2[_0x0a9e('0x23')](0x194);}return _0x40cb85;};}function handleError(_0x2b45ea,_0x409319){_0x409319=_0x409319||0x1f4;return function(_0x332d35){logger[_0x0a9e('0x1d')](_0x332d35['stack']);if(_0x332d35[_0x0a9e('0x32')]){delete _0x332d35['name'];}_0x2b45ea[_0x0a9e('0x24')](_0x409319)[_0x0a9e('0x33')](_0x332d35);};}function getMustacheRender(_0x2b7e7f,_0x3f3d41){return Mustache['render'](_0x2b7e7f,_[_0x0a9e('0x34')](_0x3f3d41[_0x0a9e('0x35')],{'contact':_0x3f3d41[_0x0a9e('0x36')],'message':_0x3f3d41[_0x0a9e('0x1f')],'agent':_0x3f3d41['agent'],'interaction':_0x3f3d41['interaction'],'account':_0x3f3d41[_0x0a9e('0x37')]}))||'';}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x38')](db[_0x0a9e('0x39')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3a')],'type':_0x1dbf74[_0x0a9e('0x3b')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x38')](_0x31916f,_0x0a9e('0x32'));_0x1ef87a['query']=_[_0x0a9e('0x3c')](_0x24936a[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],qs[_0x0a9e('0x41')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x381c37[_0x0a9e('0x40')]:_0x1ef87a[_0x0a9e('0x43')];if(!_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x381c37[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x381c37[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x381c37[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x24936a[_0x0a9e('0x3d')],_0x1ef87a[_0x0a9e('0x3e')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x381c37[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x381c37[_0x0a9e('0x47')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3b')]!==_0x0a9e('0x4a')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x32')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x34')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x39')][_0x0a9e('0x29')](_0x2e9d90)[_0x0a9e('0x31')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x29')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x4d')](_0x381c37);})[_0x0a9e('0x31')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x4e')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x31')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x22')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x4f')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':![],'where':{'id':_0x409789[_0x0a9e('0x50')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x39')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],_0x19383e[_0x0a9e('0x3d')]);_0x6054ee[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x40')]=_0x6054ee[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x43')];if(_0x409789[_0x0a9e('0x3d')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x34')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x39')]['find'](_0x6054ee)[_0x0a9e('0x31')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x31')](respondWithResult(_0x992c77,null))[_0x0a9e('0x22')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['SugarcrmConfiguration']['create'](_0x2f82da[_0x0a9e('0x35')],{})[_0x0a9e('0x31')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x2f')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x35')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x35')],null))[_0x0a9e('0x31')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x22')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x30')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x39')][_0x0a9e('0x51')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x31')](removeEntity(_0x272738,null))[_0x0a9e('0x22')](handleError(_0x272738,null));};exports[_0x0a9e('0x52')]=function(_0xb83dfd,_0x156662,_0x5d86e9){var _0x956fbe={};var _0x26bc80={};var _0x5239ef;var _0x3649cc;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0xb83dfd['params']['id']}})['then'](handleEntityNotFound(_0x156662,null))['then'](function(_0x273cb5){if(_0x273cb5){_0x5239ef=_0x273cb5;_0x26bc80['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')][_0x0a9e('0x55')]);_0x26bc80[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0xb83dfd[_0x0a9e('0x3d')]);_0x26bc80['filters']=_[_0x0a9e('0x3f')](_0x26bc80['model'],_0x26bc80[_0x0a9e('0x3d')]);_0x956fbe[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x26bc80['model'],qs[_0x0a9e('0x41')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x956fbe[_0x0a9e('0x40')]=_0x956fbe['attributes'][_0x0a9e('0x42')]?_0x956fbe[_0x0a9e('0x40')]:_0x26bc80['model'];_0x956fbe[_0x0a9e('0x56')]=qs[_0x0a9e('0x46')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x956fbe[_0x0a9e('0x47')]=qs['filters'](_[_0x0a9e('0x48')](_0xb83dfd[_0x0a9e('0x3d')],_0x26bc80[_0x0a9e('0x3e')]));if(_0xb83dfd['query'][_0x0a9e('0x49')]){_0x956fbe['where']=_['merge'](_0x956fbe[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x956fbe[_0x0a9e('0x40')],function(_0x19c995){var _0x186f39={};_0x186f39[_0x19c995]={'$like':'%'+_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x186f39;})});}_0x956fbe=_[_0x0a9e('0x34')]({},_0x956fbe,_0xb83dfd[_0x0a9e('0x57')]);return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})[_0x0a9e('0x31')](function(_0x19012b){if(_0x19012b){_0x3649cc=_0x19012b[_0x0a9e('0x42')];if(!_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x956fbe[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0xb83dfd['query'][_0x0a9e('0x28')]);_0x956fbe[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0xb83dfd['query'][_0x0a9e('0x27')]);}return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})['then'](function(_0x83f0b2){if(_0x83f0b2){return _0x83f0b2?{'count':_0x3649cc,'rows':_0x83f0b2}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x156662,null))[_0x0a9e('0x22')](handleError(_0x156662,null));};exports[_0x0a9e('0x58')]=function(_0x13b5c0,_0x4a43a8,_0x50cdce){var _0x4a2438={};var _0x40fb85={};var _0x18bf5d;var _0x1104ad;return db[_0x0a9e('0x39')][_0x0a9e('0x53')]({'where':{'id':_0x13b5c0[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x4a43a8,null))[_0x0a9e('0x31')](function(_0x5512d1){if(_0x5512d1){_0x18bf5d=_0x5512d1;_0x40fb85[_0x0a9e('0x43')]=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x40fb85[_0x0a9e('0x3d')]=_['keys'](_0x13b5c0[_0x0a9e('0x3d')]);_0x40fb85[_0x0a9e('0x3e')]=_['intersection'](_0x40fb85[_0x0a9e('0x43')],_0x40fb85[_0x0a9e('0x3d')]);_0x4a2438[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x40fb85['model'],qs[_0x0a9e('0x41')](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x4a2438[_0x0a9e('0x40')]=_0x4a2438['attributes'][_0x0a9e('0x42')]?_0x4a2438[_0x0a9e('0x40')]:_0x40fb85[_0x0a9e('0x43')];_0x4a2438[_0x0a9e('0x56')]=qs['sort'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4a2438[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x13b5c0[_0x0a9e('0x3d')],_0x40fb85[_0x0a9e('0x3e')]));if(_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x4a2438[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x4a2438[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x4a2438[_0x0a9e('0x40')],function(_0x5b35db){var _0xf4120f={};_0xf4120f[_0x5b35db]={'$like':'%'+_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xf4120f;})});}_0x4a2438=_['merge']({},_0x4a2438,_0x13b5c0[_0x0a9e('0x57')]);return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x2b9463){if(_0x2b9463){_0x1104ad=_0x2b9463['length'];if(!_0x13b5c0['query'][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x4a2438['limit']=qs[_0x0a9e('0x28')](_0x13b5c0['query'][_0x0a9e('0x28')]);_0x4a2438[_0x0a9e('0x27')]=qs['offset'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x3755fe){if(_0x3755fe){return _0x3755fe?{'count':_0x1104ad,'rows':_0x3755fe}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x4a43a8,null))[_0x0a9e('0x22')](handleError(_0x4a43a8,null));};exports['getDescriptions']=function(_0x2973d3,_0x3ca9b9,_0x45c109){var _0x16e5b9={};var _0x492543={};var _0xf51744;var _0xf0db1;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0x2973d3['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x3ca9b9,null))[_0x0a9e('0x31')](function(_0x3003eb){if(_0x3003eb){_0xf51744=_0x3003eb;_0x492543[_0x0a9e('0x43')]=_['keys'](db['SugarcrmField'][_0x0a9e('0x55')]);_0x492543[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0x2973d3['query']);_0x492543[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x492543['model'],_0x492543['query']);_0x16e5b9[_0x0a9e('0x40')]=_['intersection'](_0x492543['model'],qs['fields'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x16e5b9[_0x0a9e('0x40')]=_0x16e5b9[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x16e5b9[_0x0a9e('0x40')]:_0x492543['model'];_0x16e5b9[_0x0a9e('0x56')]=qs['sort'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x16e5b9[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_['pick'](_0x2973d3[_0x0a9e('0x3d')],_0x492543[_0x0a9e('0x3e')]));if(_0x2973d3[_0x0a9e('0x3d')]['filter']){_0x16e5b9[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x16e5b9[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x16e5b9[_0x0a9e('0x40')],function(_0x1910bf){var _0x32b9bd={};_0x32b9bd[_0x1910bf]={'$like':'%'+_0x2973d3[_0x0a9e('0x3d')]['filter']+'%'};return _0x32b9bd;})});}_0x16e5b9=_[_0x0a9e('0x34')]({},_0x16e5b9,_0x2973d3[_0x0a9e('0x57')]);return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x982340){if(_0x982340){_0xf0db1=_0x982340[_0x0a9e('0x42')];if(!_0x2973d3['query'][_0x0a9e('0x44')]('nolimit')){_0x16e5b9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x16e5b9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0xf0db1,'rows':_0x31d25a}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x3ca9b9,null))[_0x0a9e('0x22')](handleError(_0x3ca9b9,null));}; \ No newline at end of file +var _0xa9e0=['fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','find','getFields','findOne','SugarcrmField','rawAttributes','order','options','getSubjects','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','merge','body','contact','account','map','SugarcrmConfiguration','fieldName','type','keys','query','filters','intersection','attributes'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=typeof _0x40c424[_0x0a9e('0x27')]==='undefined'&&typeof _0x40c424[_0x0a9e('0x28')]==='undefined';var _0x1dc186=_0x33161b[_0x0a9e('0x29')];var _0x25fba9=_0x526cf3?0x0:_0x40c424[_0x0a9e('0x27')];var _0x140511=_0x526cf3?_0x33161b[_0x0a9e('0x29')]:_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')];var _0x5a101a;if(_0x140511>=_0x1dc186){_0x140511=_0x1dc186;_0x5a101a=0xc8;}else{_0x5a101a=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x5a101a);return _0x3a8e58[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x25fba9+'-'+_0x140511+'/'+_0x1dc186)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x5c877d){return function(_0x15b200){try{jsonpatch[_0x0a9e('0x2c')](_0x15b200,_0x5c877d,!![]);}catch(_0x1843b2){return BPromise[_0x0a9e('0x2d')](_0x1843b2);}return _0x15b200[_0x0a9e('0x2e')]();};}function saveUpdates(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x2f')](_0x563b45)['then'](function(_0x426950){return _0x426950;});}return null;};}function removeEntity(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x30')]()[_0x0a9e('0x31')](function(){_0x5d1e0e[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x66c1d2,_0x46f0a5){return function(_0x40cb85){if(!_0x40cb85){_0x66c1d2[_0x0a9e('0x23')](0x194);}return _0x40cb85;};}function handleError(_0x2b45ea,_0x409319){_0x409319=_0x409319||0x1f4;return function(_0x332d35){logger[_0x0a9e('0x1d')](_0x332d35['stack']);if(_0x332d35[_0x0a9e('0x32')]){delete _0x332d35['name'];}_0x2b45ea[_0x0a9e('0x24')](_0x409319)[_0x0a9e('0x33')](_0x332d35);};}function getMustacheRender(_0x2b7e7f,_0x3f3d41){return Mustache['render'](_0x2b7e7f,_[_0x0a9e('0x34')](_0x3f3d41[_0x0a9e('0x35')],{'contact':_0x3f3d41[_0x0a9e('0x36')],'message':_0x3f3d41[_0x0a9e('0x1f')],'agent':_0x3f3d41['agent'],'interaction':_0x3f3d41['interaction'],'account':_0x3f3d41[_0x0a9e('0x37')]}))||'';}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x38')](db[_0x0a9e('0x39')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3a')],'type':_0x1dbf74[_0x0a9e('0x3b')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x38')](_0x31916f,_0x0a9e('0x32'));_0x1ef87a['query']=_[_0x0a9e('0x3c')](_0x24936a[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x1ef87a['model'],qs[_0x0a9e('0x41')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x381c37[_0x0a9e('0x40')]:_0x1ef87a[_0x0a9e('0x43')];if(!_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x381c37[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x381c37[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x381c37[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x24936a[_0x0a9e('0x3d')],_0x1ef87a[_0x0a9e('0x3e')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x381c37[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x381c37[_0x0a9e('0x47')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3b')]!==_0x0a9e('0x4a')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x32')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x34')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x39')][_0x0a9e('0x29')](_0x2e9d90)[_0x0a9e('0x31')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x29')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3d')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x4c')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x4d')](_0x381c37);})[_0x0a9e('0x31')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x4e')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x31')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x22')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x4f')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':![],'where':{'id':_0x409789[_0x0a9e('0x50')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x39')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],_0x19383e[_0x0a9e('0x3d')]);_0x6054ee[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x19383e[_0x0a9e('0x43')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x40')]=_0x6054ee[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x43')];if(_0x409789[_0x0a9e('0x3d')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x34')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x39')]['find'](_0x6054ee)[_0x0a9e('0x31')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x31')](respondWithResult(_0x992c77,null))[_0x0a9e('0x22')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['SugarcrmConfiguration']['create'](_0x2f82da[_0x0a9e('0x35')],{})[_0x0a9e('0x31')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x2f')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x35')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x35')],null))[_0x0a9e('0x31')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x22')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x30')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x39')][_0x0a9e('0x51')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x31')](removeEntity(_0x272738,null))[_0x0a9e('0x22')](handleError(_0x272738,null));};exports[_0x0a9e('0x52')]=function(_0xb83dfd,_0x156662,_0x5d86e9){var _0x956fbe={};var _0x26bc80={};var _0x5239ef;var _0x3649cc;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0xb83dfd['params']['id']}})['then'](handleEntityNotFound(_0x156662,null))['then'](function(_0x273cb5){if(_0x273cb5){_0x5239ef=_0x273cb5;_0x26bc80['model']=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')][_0x0a9e('0x55')]);_0x26bc80[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0xb83dfd[_0x0a9e('0x3d')]);_0x26bc80['filters']=_[_0x0a9e('0x3f')](_0x26bc80['model'],_0x26bc80[_0x0a9e('0x3d')]);_0x956fbe[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x26bc80['model'],qs[_0x0a9e('0x41')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x956fbe[_0x0a9e('0x40')]=_0x956fbe['attributes'][_0x0a9e('0x42')]?_0x956fbe[_0x0a9e('0x40')]:_0x26bc80['model'];_0x956fbe[_0x0a9e('0x56')]=qs[_0x0a9e('0x46')](_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x956fbe[_0x0a9e('0x47')]=qs['filters'](_[_0x0a9e('0x48')](_0xb83dfd[_0x0a9e('0x3d')],_0x26bc80[_0x0a9e('0x3e')]));if(_0xb83dfd['query'][_0x0a9e('0x49')]){_0x956fbe['where']=_['merge'](_0x956fbe[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x956fbe[_0x0a9e('0x40')],function(_0x19c995){var _0x186f39={};_0x186f39[_0x19c995]={'$like':'%'+_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0x186f39;})});}_0x956fbe=_[_0x0a9e('0x34')]({},_0x956fbe,_0xb83dfd[_0x0a9e('0x57')]);return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})[_0x0a9e('0x31')](function(_0x19012b){if(_0x19012b){_0x3649cc=_0x19012b[_0x0a9e('0x42')];if(!_0xb83dfd[_0x0a9e('0x3d')][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x956fbe[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0xb83dfd['query'][_0x0a9e('0x28')]);_0x956fbe[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0xb83dfd['query'][_0x0a9e('0x27')]);}return _0x5239ef[_0x0a9e('0x52')](_0x956fbe);}})['then'](function(_0x83f0b2){if(_0x83f0b2){return _0x83f0b2?{'count':_0x3649cc,'rows':_0x83f0b2}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x156662,null))[_0x0a9e('0x22')](handleError(_0x156662,null));};exports[_0x0a9e('0x58')]=function(_0x13b5c0,_0x4a43a8,_0x50cdce){var _0x4a2438={};var _0x40fb85={};var _0x18bf5d;var _0x1104ad;return db[_0x0a9e('0x39')][_0x0a9e('0x53')]({'where':{'id':_0x13b5c0[_0x0a9e('0x50')]['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x4a43a8,null))[_0x0a9e('0x31')](function(_0x5512d1){if(_0x5512d1){_0x18bf5d=_0x5512d1;_0x40fb85[_0x0a9e('0x43')]=_[_0x0a9e('0x3c')](db[_0x0a9e('0x54')]['rawAttributes']);_0x40fb85[_0x0a9e('0x3d')]=_['keys'](_0x13b5c0[_0x0a9e('0x3d')]);_0x40fb85[_0x0a9e('0x3e')]=_['intersection'](_0x40fb85[_0x0a9e('0x43')],_0x40fb85[_0x0a9e('0x3d')]);_0x4a2438[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x40fb85['model'],qs[_0x0a9e('0x41')](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x4a2438[_0x0a9e('0x40')]=_0x4a2438['attributes'][_0x0a9e('0x42')]?_0x4a2438[_0x0a9e('0x40')]:_0x40fb85[_0x0a9e('0x43')];_0x4a2438[_0x0a9e('0x56')]=qs['sort'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x4a2438[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_[_0x0a9e('0x48')](_0x13b5c0[_0x0a9e('0x3d')],_0x40fb85[_0x0a9e('0x3e')]));if(_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]){_0x4a2438[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x4a2438[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x4a2438[_0x0a9e('0x40')],function(_0x5b35db){var _0xf4120f={};_0xf4120f[_0x5b35db]={'$like':'%'+_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x49')]+'%'};return _0xf4120f;})});}_0x4a2438=_['merge']({},_0x4a2438,_0x13b5c0[_0x0a9e('0x57')]);return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x2b9463){if(_0x2b9463){_0x1104ad=_0x2b9463['length'];if(!_0x13b5c0['query'][_0x0a9e('0x44')](_0x0a9e('0x45'))){_0x4a2438['limit']=qs[_0x0a9e('0x28')](_0x13b5c0['query'][_0x0a9e('0x28')]);_0x4a2438[_0x0a9e('0x27')]=qs['offset'](_0x13b5c0[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0x18bf5d[_0x0a9e('0x58')](_0x4a2438);}})[_0x0a9e('0x31')](function(_0x3755fe){if(_0x3755fe){return _0x3755fe?{'count':_0x1104ad,'rows':_0x3755fe}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x4a43a8,null))[_0x0a9e('0x22')](handleError(_0x4a43a8,null));};exports['getDescriptions']=function(_0x2973d3,_0x3ca9b9,_0x45c109){var _0x16e5b9={};var _0x492543={};var _0xf51744;var _0xf0db1;return db['SugarcrmConfiguration'][_0x0a9e('0x53')]({'where':{'id':_0x2973d3['params']['id']}})[_0x0a9e('0x31')](handleEntityNotFound(_0x3ca9b9,null))[_0x0a9e('0x31')](function(_0x3003eb){if(_0x3003eb){_0xf51744=_0x3003eb;_0x492543[_0x0a9e('0x43')]=_['keys'](db['SugarcrmField'][_0x0a9e('0x55')]);_0x492543[_0x0a9e('0x3d')]=_[_0x0a9e('0x3c')](_0x2973d3['query']);_0x492543[_0x0a9e('0x3e')]=_[_0x0a9e('0x3f')](_0x492543['model'],_0x492543['query']);_0x16e5b9[_0x0a9e('0x40')]=_['intersection'](_0x492543['model'],qs['fields'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x41')]));_0x16e5b9[_0x0a9e('0x40')]=_0x16e5b9[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x16e5b9[_0x0a9e('0x40')]:_0x492543['model'];_0x16e5b9[_0x0a9e('0x56')]=qs['sort'](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x46')]);_0x16e5b9[_0x0a9e('0x47')]=qs[_0x0a9e('0x3e')](_['pick'](_0x2973d3[_0x0a9e('0x3d')],_0x492543[_0x0a9e('0x3e')]));if(_0x2973d3[_0x0a9e('0x3d')]['filter']){_0x16e5b9[_0x0a9e('0x47')]=_[_0x0a9e('0x34')](_0x16e5b9[_0x0a9e('0x47')],{'$or':_[_0x0a9e('0x38')](_0x16e5b9[_0x0a9e('0x40')],function(_0x1910bf){var _0x32b9bd={};_0x32b9bd[_0x1910bf]={'$like':'%'+_0x2973d3[_0x0a9e('0x3d')]['filter']+'%'};return _0x32b9bd;})});}_0x16e5b9=_[_0x0a9e('0x34')]({},_0x16e5b9,_0x2973d3[_0x0a9e('0x57')]);return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x982340){if(_0x982340){_0xf0db1=_0x982340[_0x0a9e('0x42')];if(!_0x2973d3['query'][_0x0a9e('0x44')]('nolimit')){_0x16e5b9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x28')]);_0x16e5b9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x2973d3[_0x0a9e('0x3d')][_0x0a9e('0x27')]);}return _0xf51744['getDescriptions'](_0x16e5b9);}})[_0x0a9e('0x31')](function(_0x31d25a){if(_0x31d25a){return _0x31d25a?{'count':_0xf0db1,'rows':_0x31d25a}:null;}})[_0x0a9e('0x31')](respondWithResult(_0x3ca9b9,null))[_0x0a9e('0x22')](handleError(_0x3ca9b9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a3dde17..e7169c5 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaff9=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment'];(function(_0x450976,_0x20a184){var _0x4be3b9=function(_0x5948ec){while(--_0x5948ec){_0x450976['push'](_0x450976['shift']());}};_0x4be3b9(++_0x20a184);}(_0xaff9,0x8b));var _0x9aff=function(_0x31c99e,_0x1eeb82){_0x31c99e=_0x31c99e-0x0;var _0x10646d=_0xaff9[_0x31c99e];return _0x10646d;};'use strict';var _=require(_0x9aff('0x0'));var util=require(_0x9aff('0x1'));var logger=require('../../config/logger')(_0x9aff('0x2'));var moment=require(_0x9aff('0x3'));var BPromise=require(_0x9aff('0x4'));var rp=require(_0x9aff('0x5'));var fs=require('fs');var path=require(_0x9aff('0x6'));var rimraf=require(_0x9aff('0x7'));var config=require(_0x9aff('0x8'));var attributes=require(_0x9aff('0x9'));module['exports']=function(_0x608578,_0x284bb2){return _0x608578[_0x9aff('0xa')](_0x9aff('0xb'),attributes,{'tableName':_0x9aff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc712=['define','lodash','util','bluebird','path','../../config/environment'];(function(_0x32f91b,_0x460016){var _0x3ee8f3=function(_0x39b27d){while(--_0x39b27d){_0x32f91b['push'](_0x32f91b['shift']());}};_0x3ee8f3(++_0x460016);}(_0xc712,0x121));var _0x2c71=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0xc712[_0x5b077b];return _0x16faf7;};'use strict';var _=require(_0x2c71('0x0'));var util=require(_0x2c71('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2c71('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c71('0x3'));var rimraf=require('rimraf');var config=require(_0x2c71('0x4'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x4c4cec,_0xa422e8){return _0x4c4cec[_0x2c71('0x5')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index b2f32a7..4aee269 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1366=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','util','bluebird'];(function(_0x52f8ae,_0xd40e9){var _0x1ab251=function(_0x5ec019){while(--_0x5ec019){_0x52f8ae['push'](_0x52f8ae['shift']());}};_0x1ab251(++_0xd40e9);}(_0x1366,0x1c6));var _0x6136=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1366[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x6136('0x0'));var moment=require('moment');var BPromise=require(_0x6136('0x1'));var rs=require(_0x6136('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6136('0x3'))['db'];var utils=require(_0x6136('0x4'));var logger=require(_0x6136('0x5'))(_0x6136('0x6'));var config=require(_0x6136('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6136('0x8')][_0x6136('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f173d,_0x324e6d,_0x4042be){return new BPromise(function(_0x45c9d2,_0x53e4fe){return client[_0x6136('0xa')](_0x3f173d,_0x4042be)['then'](function(_0x5c6055){logger[_0x6136('0xb')](_0x6136('0xc'),_0x324e6d,_0x6136('0xd'));logger[_0x6136('0xe')](_0x6136('0xf'),_0x324e6d,_0x6136('0xd'),JSON['stringify'](_0x5c6055));if(_0x5c6055[_0x6136('0x10')]){if(_0x5c6055[_0x6136('0x10')][_0x6136('0x11')]===0x1f4){logger[_0x6136('0x10')](_0x6136('0xc'),_0x324e6d,_0x5c6055[_0x6136('0x10')][_0x6136('0x12')]);return _0x53e4fe(_0x5c6055[_0x6136('0x10')][_0x6136('0x12')]);}logger[_0x6136('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324e6d,_0x5c6055['error'][_0x6136('0x12')]);return _0x45c9d2(_0x5c6055['error']['message']);}else{logger['info'](_0x6136('0xc'),_0x324e6d,_0x6136('0xd'));_0x45c9d2(_0x5c6055['result'][_0x6136('0x12')]);}})['catch'](function(_0x40a710){logger[_0x6136('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324e6d,_0x40a710);_0x53e4fe(_0x40a710);});});} \ No newline at end of file +var _0xdb2a=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0xbf1f9e,_0xf436a6){var _0x326866=function(_0x46afdd){while(--_0x46afdd){_0xbf1f9e['push'](_0xbf1f9e['shift']());}};_0x326866(++_0xf436a6);}(_0xdb2a,0x9e));var _0xadb2=function(_0x51718b,_0x14ecd8){_0x51718b=_0x51718b-0x0;var _0x34ac6e=_0xdb2a[_0x51718b];return _0x34ac6e;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var moment=require(_0xadb2('0x2'));var BPromise=require(_0xadb2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb2('0x4'));var db=require(_0xadb2('0x5'))['db'];var utils=require(_0xadb2('0x6'));var logger=require(_0xadb2('0x7'))(_0xadb2('0x8'));var config=require(_0xadb2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xadb2('0xa')][_0xadb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f74be,_0x37ecb6,_0x4ab71b){return new BPromise(function(_0x465b92,_0x4c270d){return client[_0xadb2('0xc')](_0x4f74be,_0x4ab71b)[_0xadb2('0xd')](function(_0x2f86a7){logger[_0xadb2('0xe')](_0xadb2('0xf'),_0x37ecb6,'request\x20sent');logger['debug'](_0xadb2('0x10'),_0x37ecb6,_0xadb2('0x11'),JSON['stringify'](_0x2f86a7));if(_0x2f86a7['error']){if(_0x2f86a7[_0xadb2('0x12')][_0xadb2('0x13')]===0x1f4){logger[_0xadb2('0x12')](_0xadb2('0xf'),_0x37ecb6,_0x2f86a7[_0xadb2('0x12')][_0xadb2('0x14')]);return _0x4c270d(_0x2f86a7[_0xadb2('0x12')][_0xadb2('0x14')]);}logger[_0xadb2('0x12')](_0xadb2('0xf'),_0x37ecb6,_0x2f86a7[_0xadb2('0x12')][_0xadb2('0x14')]);return _0x465b92(_0x2f86a7['error'][_0xadb2('0x14')]);}else{logger[_0xadb2('0xe')](_0xadb2('0xf'),_0x37ecb6,_0xadb2('0x11'));_0x465b92(_0x2f86a7[_0xadb2('0x15')][_0xadb2('0x14')]);}})[_0xadb2('0x16')](function(_0x2ed7ff){logger[_0xadb2('0x12')](_0xadb2('0xf'),_0x37ecb6,_0x2ed7ff);_0x4c270d(_0x2ed7ff);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 64da61f..22288fe 100644 --- a/server/api/intSugarcrmField/index.js +++ b/server/api/intSugarcrmField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0726=['util','path','express','Router','../../components/auth/service','./intSugarcrmField.controller','index','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer'];(function(_0x355b83,_0x23e3b1){var _0x5ebfaa=function(_0x2005f2){while(--_0x2005f2){_0x355b83['push'](_0x355b83['shift']());}};_0x5ebfaa(++_0x23e3b1);}(_0x0726,0x131));var _0x6072=function(_0x4e659c,_0x26e3bf){_0x4e659c=_0x4e659c-0x0;var _0x34d772=_0x0726[_0x4e659c];return _0x34d772;};'use strict';var multer=require(_0x6072('0x0'));var util=require(_0x6072('0x1'));var path=require(_0x6072('0x2'));var timeout=require('connect-timeout');var express=require(_0x6072('0x3'));var router=express[_0x6072('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6072('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6072('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6072('0x7')]);router[_0x6072('0x8')](_0x6072('0x9'),auth['isAuthenticated'](),controller[_0x6072('0xa')]);router['post']('/',auth[_0x6072('0xb')](),controller[_0x6072('0xc')]);router[_0x6072('0xd')]('/:id',auth[_0x6072('0xb')](),controller[_0x6072('0xe')]);router[_0x6072('0xf')](_0x6072('0x9'),auth[_0x6072('0xb')](),controller[_0x6072('0x10')]);module[_0x6072('0x11')]=router; \ No newline at end of file +var _0xa2d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0xa2d7,0x11a));var _0x7a2d=function(_0x562d6e,_0x441c0e){_0x562d6e=_0x562d6e-0x0;var _0x1b609e=_0xa2d7[_0x562d6e];return _0x1b609e;};'use strict';var multer=require(_0x7a2d('0x0'));var util=require(_0x7a2d('0x1'));var path=require(_0x7a2d('0x2'));var timeout=require(_0x7a2d('0x3'));var express=require(_0x7a2d('0x4'));var router=express['Router']();var fs_extra=require(_0x7a2d('0x5'));var auth=require(_0x7a2d('0x6'));var interaction=require(_0x7a2d('0x7'));var config=require(_0x7a2d('0x8'));var controller=require(_0x7a2d('0x9'));router[_0x7a2d('0xa')]('/',auth[_0x7a2d('0xb')](),controller[_0x7a2d('0xc')]);router[_0x7a2d('0xa')](_0x7a2d('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x7a2d('0xb')](),controller['create']);router[_0x7a2d('0xe')](_0x7a2d('0xd'),auth[_0x7a2d('0xb')](),controller[_0x7a2d('0xf')]);router[_0x7a2d('0x10')](_0x7a2d('0xd'),auth[_0x7a2d('0xb')](),controller['destroy']);module[_0x7a2d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index e6a1542..fe5f984 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.attributes.js +++ b/server/api/intSugarcrmField/intSugarcrmField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72b1=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0x72b1,0x16e));var _0x172b=function(_0x4ca273,_0x1b217d){_0x4ca273=_0x4ca273-0x0;var _0x4a3561=_0x72b1[_0x4ca273];return _0x4a3561;};'use strict';var Sequelize=require(_0x172b('0x0'));module['exports']={'type':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),_0x172b('0x4'),_0x172b('0x5'),_0x172b('0x6')),'defaultValue':_0x172b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x172b('0x7')]},'keyType':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x172b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x172b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x172b('0x7')]}}; \ No newline at end of file +var _0x54ef=['keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x5e8adb,_0x55b5c2){var _0x6c40e5=function(_0x1947db){while(--_0x1947db){_0x5e8adb['push'](_0x5e8adb['shift']());}};_0x6c40e5(++_0x55b5c2);}(_0x54ef,0x112));var _0xf54e=function(_0x156dbd,_0x2e78e7){_0x156dbd=_0x156dbd-0x0;var _0x2b662e=_0x54ef[_0x156dbd];return _0x2b662e;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'type':{'type':Sequelize[_0xf54e('0x2')]('string',_0xf54e('0x3'),_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'defaultValue':_0xf54e('0x7')},'content':{'type':Sequelize[_0xf54e('0x8')]},'key':{'type':Sequelize[_0xf54e('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf54e('0x3'),_0xf54e('0x4'))},'keyContent':{'type':Sequelize[_0xf54e('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf54e('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5299b8a..b5cb292 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.controller.js +++ b/server/api/intSugarcrmField/intSugarcrmField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80c3=['key','map','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','rimraf','moment','mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','render','merge','message','interaction','account','SugarcrmField','rawAttributes','fieldName'];(function(_0x1f531c,_0x2b72ac){var _0x492387=function(_0x1e12a8){while(--_0x1e12a8){_0x1f531c['push'](_0x1f531c['shift']());}};_0x492387(++_0x2b72ac);}(_0x80c3,0xf9));var _0x380c=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x80c3[_0xaf29da];return _0x295c51;};'use strict';var emlformat=require(_0x380c('0x0'));var rimraf=require(_0x380c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x380c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x380c('0x3'));var util=require(_0x380c('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x380c('0x5'));var fs=require('fs');var fs_extra=require(_0x380c('0x6'));var _=require(_0x380c('0x7'));var squel=require(_0x380c('0x8'));var crypto=require('crypto');var jsforce=require(_0x380c('0x9'));var deskjs=require(_0x380c('0xa'));var toCsv=require(_0x380c('0xb'));var querystring=require('querystring');var Papa=require(_0x380c('0xc'));var Redis=require('ioredis');var authService=require(_0x380c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x380c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x380c('0xf'))(_0x380c('0x10'));var utils=require(_0x380c('0x11'));var config=require(_0x380c('0x12'));var licenseUtil=require(_0x380c('0x13'));var db=require(_0x380c('0x14'))['db'];function respondWithStatusCode(_0x17677d,_0x5024ea){_0x5024ea=_0x5024ea||0xcc;return function(_0x2177f7){if(_0x2177f7){return _0x17677d[_0x380c('0x15')](_0x5024ea);}return _0x17677d['status'](_0x5024ea)[_0x380c('0x16')]();};}function respondWithResult(_0x44e892,_0x4fff9f){_0x4fff9f=_0x4fff9f||0xc8;return function(_0x244aa5){if(_0x244aa5){return _0x44e892[_0x380c('0x17')](_0x4fff9f)[_0x380c('0x18')](_0x244aa5);}};}function respondWithFilteredResult(_0x15dfd3,_0x2f6d4f){return function(_0x2a9451){if(_0x2a9451){var _0x5a2077=typeof _0x2f6d4f['offset']===_0x380c('0x19')&&typeof _0x2f6d4f[_0x380c('0x1a')]==='undefined';var _0x37023d=_0x2a9451[_0x380c('0x1b')];var _0x3e9ca6=_0x5a2077?0x0:_0x2f6d4f[_0x380c('0x1c')];var _0x48454e=_0x5a2077?_0x2a9451['count']:_0x2f6d4f['offset']+_0x2f6d4f[_0x380c('0x1a')];var _0x10bd72;if(_0x48454e>=_0x37023d){_0x48454e=_0x37023d;_0x10bd72=0xc8;}else{_0x10bd72=0xce;}_0x15dfd3[_0x380c('0x17')](_0x10bd72);return _0x15dfd3[_0x380c('0x1d')]('Content-Range',_0x3e9ca6+'-'+_0x48454e+'/'+_0x37023d)[_0x380c('0x18')](_0x2a9451);}return null;};}function patchUpdates(_0x414572){return function(_0x5d57fe){try{jsonpatch[_0x380c('0x1e')](_0x5d57fe,_0x414572,!![]);}catch(_0x2119bb){return BPromise[_0x380c('0x1f')](_0x2119bb);}return _0x5d57fe[_0x380c('0x20')]();};}function saveUpdates(_0x1bb372,_0x14ddc5){return function(_0x5dad99){if(_0x5dad99){return _0x5dad99[_0x380c('0x21')](_0x1bb372)[_0x380c('0x22')](function(_0x115eb1){return _0x115eb1;});}return null;};}function removeEntity(_0x24eebc,_0x353e0b){return function(_0x525b36){if(_0x525b36){return _0x525b36[_0x380c('0x23')]()['then'](function(){_0x24eebc[_0x380c('0x17')](0xcc)[_0x380c('0x16')]();});}};}function handleEntityNotFound(_0x1e8fe4,_0x5ddc62){return function(_0x243458){if(!_0x243458){_0x1e8fe4[_0x380c('0x15')](0x194);}return _0x243458;};}function handleError(_0x38453a,_0x397e8b){_0x397e8b=_0x397e8b||0x1f4;return function(_0x59e211){logger[_0x380c('0x24')](_0x59e211[_0x380c('0x25')]);if(_0x59e211[_0x380c('0x26')]){delete _0x59e211[_0x380c('0x26')];}_0x38453a[_0x380c('0x17')](_0x397e8b)['send'](_0x59e211);};}function getMustacheRender(_0x160ae1,_0x47bd67){return Mustache[_0x380c('0x27')](_0x160ae1,_[_0x380c('0x28')](_0x47bd67['body'],{'contact':_0x47bd67['contact'],'message':_0x47bd67[_0x380c('0x29')],'agent':_0x47bd67['agent'],'interaction':_0x47bd67[_0x380c('0x2a')],'account':_0x47bd67[_0x380c('0x2b')]}))||'';}exports['index']=function(_0x292521,_0x3c4402){var _0x1e9ca2={},_0x10b680={},_0x3b88eb={'count':0x0,'rows':[]};var _0x2434e7=_['map'](db[_0x380c('0x2c')][_0x380c('0x2d')],function(_0xa16438){return{'name':_0xa16438[_0x380c('0x2e')],'type':_0xa16438['type'][_0x380c('0x2f')]};});_0x10b680['model']=_[_0x380c('0x30')](_0x2434e7,_0x380c('0x26'));_0x10b680['query']=_[_0x380c('0x31')](_0x292521[_0x380c('0x32')]);_0x10b680[_0x380c('0x33')]=_['intersection'](_0x10b680[_0x380c('0x34')],_0x10b680[_0x380c('0x32')]);_0x1e9ca2[_0x380c('0x35')]=_['intersection'](_0x10b680[_0x380c('0x34')],qs[_0x380c('0x36')](_0x292521[_0x380c('0x32')]['fields']));_0x1e9ca2['attributes']=_0x1e9ca2[_0x380c('0x35')][_0x380c('0x37')]?_0x1e9ca2['attributes']:_0x10b680[_0x380c('0x34')];if(!_0x292521[_0x380c('0x32')][_0x380c('0x38')](_0x380c('0x39'))){_0x1e9ca2['limit']=qs[_0x380c('0x1a')](_0x292521['query'][_0x380c('0x1a')]);_0x1e9ca2['offset']=qs[_0x380c('0x1c')](_0x292521[_0x380c('0x32')][_0x380c('0x1c')]);}_0x1e9ca2[_0x380c('0x3a')]=qs[_0x380c('0x3b')](_0x292521['query']['sort']);_0x1e9ca2[_0x380c('0x3c')]=qs['filters'](_['pick'](_0x292521[_0x380c('0x32')],_0x10b680[_0x380c('0x33')]),_0x2434e7);if(_0x292521[_0x380c('0x32')]['filter']){_0x1e9ca2[_0x380c('0x3c')]=_[_0x380c('0x28')](_0x1e9ca2[_0x380c('0x3c')],{'$or':_[_0x380c('0x30')](_0x2434e7,function(_0x17a009){if(_0x17a009['type']!==_0x380c('0x3d')){var _0x39ab61={};_0x39ab61[_0x17a009[_0x380c('0x26')]]={'$like':'%'+_0x292521[_0x380c('0x32')][_0x380c('0x3e')]+'%'};return _0x39ab61;}})});}_0x1e9ca2=_[_0x380c('0x28')]({},_0x1e9ca2,_0x292521['options']);var _0x4ae30c={'where':_0x1e9ca2[_0x380c('0x3c')]};return db[_0x380c('0x2c')]['count'](_0x4ae30c)[_0x380c('0x22')](function(_0x43d571){_0x3b88eb[_0x380c('0x1b')]=_0x43d571;if(_0x292521[_0x380c('0x32')][_0x380c('0x3f')]){_0x1e9ca2[_0x380c('0x40')]=[{'all':!![]}];}return db[_0x380c('0x2c')][_0x380c('0x41')](_0x1e9ca2);})[_0x380c('0x22')](function(_0x32c420){_0x3b88eb[_0x380c('0x42')]=_0x32c420;return _0x3b88eb;})[_0x380c('0x22')](respondWithFilteredResult(_0x3c4402,_0x1e9ca2))[_0x380c('0x43')](handleError(_0x3c4402,null));};exports[_0x380c('0x44')]=function(_0x545dba,_0x25ea7e){var _0x22bb16={'raw':!![],'where':{'id':_0x545dba[_0x380c('0x45')]['id']}},_0x5abd65={};_0x5abd65[_0x380c('0x34')]=_[_0x380c('0x31')](db['SugarcrmField'][_0x380c('0x2d')]);_0x5abd65[_0x380c('0x32')]=_['keys'](_0x545dba[_0x380c('0x32')]);_0x5abd65[_0x380c('0x33')]=_['intersection'](_0x5abd65['model'],_0x5abd65[_0x380c('0x32')]);_0x22bb16[_0x380c('0x35')]=_[_0x380c('0x46')](_0x5abd65['model'],qs[_0x380c('0x36')](_0x545dba[_0x380c('0x32')][_0x380c('0x36')]));_0x22bb16[_0x380c('0x35')]=_0x22bb16['attributes'][_0x380c('0x37')]?_0x22bb16[_0x380c('0x35')]:_0x5abd65[_0x380c('0x34')];if(_0x545dba[_0x380c('0x32')]['includeAll']){_0x22bb16[_0x380c('0x40')]=[{'all':!![]}];}_0x22bb16=_[_0x380c('0x28')]({},_0x22bb16,_0x545dba['options']);return db[_0x380c('0x2c')][_0x380c('0x47')](_0x22bb16)[_0x380c('0x22')](handleEntityNotFound(_0x25ea7e,null))[_0x380c('0x22')](respondWithResult(_0x25ea7e,null))[_0x380c('0x43')](handleError(_0x25ea7e,null));};exports[_0x380c('0x48')]=function(_0x4a235f,_0x2aeca6){return db['SugarcrmField'][_0x380c('0x48')](_0x4a235f[_0x380c('0x49')],{})['then'](respondWithResult(_0x2aeca6,0xc9))['catch'](handleError(_0x2aeca6,null));};exports['update']=function(_0x2980ed,_0x352d80){if(_0x2980ed['body']['id']){delete _0x2980ed[_0x380c('0x49')]['id'];}return db[_0x380c('0x2c')][_0x380c('0x47')]({'where':{'id':_0x2980ed['params']['id']}})[_0x380c('0x22')](handleEntityNotFound(_0x352d80,null))[_0x380c('0x22')](saveUpdates(_0x2980ed['body'],null))['then'](respondWithResult(_0x352d80,null))[_0x380c('0x43')](handleError(_0x352d80,null));};exports['destroy']=function(_0x430ec7,_0x101acd){return db[_0x380c('0x2c')][_0x380c('0x47')]({'where':{'id':_0x430ec7[_0x380c('0x45')]['id']}})[_0x380c('0x22')](handleEntityNotFound(_0x101acd,null))[_0x380c('0x22')](removeEntity(_0x101acd,null))[_0x380c('0x43')](handleError(_0x101acd,null));}; \ No newline at end of file +var _0x79fe=['query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','params','find','catch','create','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','render','body','contact','interaction','SugarcrmField','rawAttributes','fieldName','type','model','keys'];(function(_0x21b57f,_0x9ba5fb){var _0x3dac6f=function(_0x449042){while(--_0x449042){_0x21b57f['push'](_0x21b57f['shift']());}};_0x3dac6f(++_0x9ba5fb);}(_0x79fe,0x18d));var _0xe79f=function(_0x51e02b,_0x5dc4ef){_0x51e02b=_0x51e02b-0x0;var _0x2c41c2=_0x79fe[_0x51e02b];return _0x2c41c2;};'use strict';var emlformat=require(_0xe79f('0x0'));var rimraf=require(_0xe79f('0x1'));var zipdir=require(_0xe79f('0x2'));var jsonpatch=require(_0xe79f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe79f('0x4'));var Mustache=require(_0xe79f('0x5'));var util=require(_0xe79f('0x6'));var path=require('path');var sox=require(_0xe79f('0x7'));var csv=require(_0xe79f('0x8'));var ejs=require(_0xe79f('0x9'));var fs=require('fs');var fs_extra=require(_0xe79f('0xa'));var _=require(_0xe79f('0xb'));var squel=require(_0xe79f('0xc'));var crypto=require(_0xe79f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe79f('0x8'));var querystring=require(_0xe79f('0xe'));var Papa=require(_0xe79f('0xf'));var Redis=require('ioredis');var authService=require(_0xe79f('0x10'));var qs=require(_0xe79f('0x11'));var as=require(_0xe79f('0x12'));var hardwareService=require(_0xe79f('0x13'));var logger=require(_0xe79f('0x14'))(_0xe79f('0x15'));var utils=require(_0xe79f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe79f('0x17'));var db=require(_0xe79f('0x18'))['db'];function respondWithStatusCode(_0x1d550e,_0x3d4c0a){_0x3d4c0a=_0x3d4c0a||0xcc;return function(_0x196ae0){if(_0x196ae0){return _0x1d550e[_0xe79f('0x19')](_0x3d4c0a);}return _0x1d550e['status'](_0x3d4c0a)[_0xe79f('0x1a')]();};}function respondWithResult(_0x2cb88c,_0xce72ba){_0xce72ba=_0xce72ba||0xc8;return function(_0x515c0c){if(_0x515c0c){return _0x2cb88c[_0xe79f('0x1b')](_0xce72ba)[_0xe79f('0x1c')](_0x515c0c);}};}function respondWithFilteredResult(_0x1d15a9,_0x113437){return function(_0x37c557){if(_0x37c557){var _0x5f314d=typeof _0x113437[_0xe79f('0x1d')]===_0xe79f('0x1e')&&typeof _0x113437[_0xe79f('0x1f')]===_0xe79f('0x1e');var _0x393502=_0x37c557[_0xe79f('0x20')];var _0x319bf6=_0x5f314d?0x0:_0x113437[_0xe79f('0x1d')];var _0x549ab0=_0x5f314d?_0x37c557['count']:_0x113437[_0xe79f('0x1d')]+_0x113437[_0xe79f('0x1f')];var _0x4b153c;if(_0x549ab0>=_0x393502){_0x549ab0=_0x393502;_0x4b153c=0xc8;}else{_0x4b153c=0xce;}_0x1d15a9['status'](_0x4b153c);return _0x1d15a9[_0xe79f('0x21')](_0xe79f('0x22'),_0x319bf6+'-'+_0x549ab0+'/'+_0x393502)[_0xe79f('0x1c')](_0x37c557);}return null;};}function patchUpdates(_0x5197ae){return function(_0x175028){try{jsonpatch[_0xe79f('0x23')](_0x175028,_0x5197ae,!![]);}catch(_0x44951a){return BPromise[_0xe79f('0x24')](_0x44951a);}return _0x175028[_0xe79f('0x25')]();};}function saveUpdates(_0x50147f,_0x2cee26){return function(_0x46295b){if(_0x46295b){return _0x46295b[_0xe79f('0x26')](_0x50147f)['then'](function(_0x5d19d2){return _0x5d19d2;});}return null;};}function removeEntity(_0x48405a,_0xafb7e){return function(_0x2691c0){if(_0x2691c0){return _0x2691c0[_0xe79f('0x27')]()[_0xe79f('0x28')](function(){_0x48405a['status'](0xcc)[_0xe79f('0x1a')]();});}};}function handleEntityNotFound(_0x2b5e0d,_0x2852d0){return function(_0x3ccf14){if(!_0x3ccf14){_0x2b5e0d[_0xe79f('0x19')](0x194);}return _0x3ccf14;};}function handleError(_0x54afcf,_0x3fd481){_0x3fd481=_0x3fd481||0x1f4;return function(_0x5a9d35){logger['error'](_0x5a9d35['stack']);if(_0x5a9d35[_0xe79f('0x29')]){delete _0x5a9d35[_0xe79f('0x29')];}_0x54afcf[_0xe79f('0x1b')](_0x3fd481)[_0xe79f('0x2a')](_0x5a9d35);};}function getMustacheRender(_0x34fb05,_0x1a7451){return Mustache[_0xe79f('0x2b')](_0x34fb05,_['merge'](_0x1a7451[_0xe79f('0x2c')],{'contact':_0x1a7451[_0xe79f('0x2d')],'message':_0x1a7451['message'],'agent':_0x1a7451['agent'],'interaction':_0x1a7451[_0xe79f('0x2e')],'account':_0x1a7451['account']}))||'';}exports['index']=function(_0x215f78,_0x25e991){var _0x15d27c={},_0x1fa619={},_0x3e379c={'count':0x0,'rows':[]};var _0x42d5fc=_['map'](db[_0xe79f('0x2f')][_0xe79f('0x30')],function(_0x2e6880){return{'name':_0x2e6880[_0xe79f('0x31')],'type':_0x2e6880[_0xe79f('0x32')]['key']};});_0x1fa619[_0xe79f('0x33')]=_['map'](_0x42d5fc,_0xe79f('0x29'));_0x1fa619['query']=_[_0xe79f('0x34')](_0x215f78[_0xe79f('0x35')]);_0x1fa619[_0xe79f('0x36')]=_['intersection'](_0x1fa619['model'],_0x1fa619[_0xe79f('0x35')]);_0x15d27c[_0xe79f('0x37')]=_[_0xe79f('0x38')](_0x1fa619[_0xe79f('0x33')],qs['fields'](_0x215f78[_0xe79f('0x35')][_0xe79f('0x39')]));_0x15d27c[_0xe79f('0x37')]=_0x15d27c['attributes'][_0xe79f('0x3a')]?_0x15d27c[_0xe79f('0x37')]:_0x1fa619['model'];if(!_0x215f78[_0xe79f('0x35')][_0xe79f('0x3b')]('nolimit')){_0x15d27c[_0xe79f('0x1f')]=qs[_0xe79f('0x1f')](_0x215f78[_0xe79f('0x35')][_0xe79f('0x1f')]);_0x15d27c[_0xe79f('0x1d')]=qs[_0xe79f('0x1d')](_0x215f78[_0xe79f('0x35')][_0xe79f('0x1d')]);}_0x15d27c['order']=qs[_0xe79f('0x3c')](_0x215f78[_0xe79f('0x35')][_0xe79f('0x3c')]);_0x15d27c[_0xe79f('0x3d')]=qs['filters'](_[_0xe79f('0x3e')](_0x215f78['query'],_0x1fa619['filters']),_0x42d5fc);if(_0x215f78[_0xe79f('0x35')]['filter']){_0x15d27c[_0xe79f('0x3d')]=_[_0xe79f('0x3f')](_0x15d27c[_0xe79f('0x3d')],{'$or':_[_0xe79f('0x40')](_0x42d5fc,function(_0x16d062){if(_0x16d062[_0xe79f('0x32')]!==_0xe79f('0x41')){var _0x379f87={};_0x379f87[_0x16d062['name']]={'$like':'%'+_0x215f78[_0xe79f('0x35')][_0xe79f('0x42')]+'%'};return _0x379f87;}})});}_0x15d27c=_[_0xe79f('0x3f')]({},_0x15d27c,_0x215f78[_0xe79f('0x43')]);var _0x348d01={'where':_0x15d27c[_0xe79f('0x3d')]};return db[_0xe79f('0x2f')][_0xe79f('0x20')](_0x348d01)['then'](function(_0x4fe192){_0x3e379c[_0xe79f('0x20')]=_0x4fe192;if(_0x215f78[_0xe79f('0x35')][_0xe79f('0x44')]){_0x15d27c[_0xe79f('0x45')]=[{'all':!![]}];}return db[_0xe79f('0x2f')][_0xe79f('0x46')](_0x15d27c);})['then'](function(_0x312505){_0x3e379c['rows']=_0x312505;return _0x3e379c;})[_0xe79f('0x28')](respondWithFilteredResult(_0x25e991,_0x15d27c))['catch'](handleError(_0x25e991,null));};exports['show']=function(_0x939477,_0x48970c){var _0x435764={'raw':!![],'where':{'id':_0x939477[_0xe79f('0x47')]['id']}},_0x1f4622={};_0x1f4622['model']=_[_0xe79f('0x34')](db['SugarcrmField'][_0xe79f('0x30')]);_0x1f4622[_0xe79f('0x35')]=_[_0xe79f('0x34')](_0x939477['query']);_0x1f4622[_0xe79f('0x36')]=_['intersection'](_0x1f4622[_0xe79f('0x33')],_0x1f4622[_0xe79f('0x35')]);_0x435764[_0xe79f('0x37')]=_[_0xe79f('0x38')](_0x1f4622[_0xe79f('0x33')],qs[_0xe79f('0x39')](_0x939477['query']['fields']));_0x435764[_0xe79f('0x37')]=_0x435764[_0xe79f('0x37')]['length']?_0x435764['attributes']:_0x1f4622[_0xe79f('0x33')];if(_0x939477[_0xe79f('0x35')][_0xe79f('0x44')]){_0x435764[_0xe79f('0x45')]=[{'all':!![]}];}_0x435764=_[_0xe79f('0x3f')]({},_0x435764,_0x939477['options']);return db[_0xe79f('0x2f')][_0xe79f('0x48')](_0x435764)[_0xe79f('0x28')](handleEntityNotFound(_0x48970c,null))[_0xe79f('0x28')](respondWithResult(_0x48970c,null))[_0xe79f('0x49')](handleError(_0x48970c,null));};exports[_0xe79f('0x4a')]=function(_0x3e5331,_0x3f0103){return db[_0xe79f('0x2f')][_0xe79f('0x4a')](_0x3e5331[_0xe79f('0x2c')],{})['then'](respondWithResult(_0x3f0103,0xc9))[_0xe79f('0x49')](handleError(_0x3f0103,null));};exports[_0xe79f('0x26')]=function(_0x34ba6b,_0x1def6c){if(_0x34ba6b['body']['id']){delete _0x34ba6b[_0xe79f('0x2c')]['id'];}return db[_0xe79f('0x2f')][_0xe79f('0x48')]({'where':{'id':_0x34ba6b[_0xe79f('0x47')]['id']}})[_0xe79f('0x28')](handleEntityNotFound(_0x1def6c,null))[_0xe79f('0x28')](saveUpdates(_0x34ba6b[_0xe79f('0x2c')],null))['then'](respondWithResult(_0x1def6c,null))[_0xe79f('0x49')](handleError(_0x1def6c,null));};exports[_0xe79f('0x27')]=function(_0x575922,_0x49d8b1){return db[_0xe79f('0x2f')]['find']({'where':{'id':_0x575922[_0xe79f('0x47')]['id']}})['then'](handleEntityNotFound(_0x49d8b1,null))['then'](removeEntity(_0x49d8b1,null))[_0xe79f('0x49')](handleError(_0x49d8b1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d2bc0be..ba7e2a9 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.model.js +++ b/server/api/intSugarcrmField/intSugarcrmField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42b4=['bluebird','path','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','idField','lodash','../../config/logger','api','moment'];(function(_0x19726c,_0x140544){var _0x4a5d0b=function(_0x2ba174){while(--_0x2ba174){_0x19726c['push'](_0x19726c['shift']());}};_0x4a5d0b(++_0x140544);}(_0x42b4,0x167));var _0x442b=function(_0x53aced,_0x46dace){_0x53aced=_0x53aced-0x0;var _0x5d7978=_0x42b4[_0x53aced];return _0x5d7978;};'use strict';var _=require(_0x442b('0x0'));var util=require('util');var logger=require(_0x442b('0x1'))(_0x442b('0x2'));var moment=require(_0x442b('0x3'));var BPromise=require(_0x442b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x442b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442b('0x6'));module[_0x442b('0x7')]=function(_0x206d92,_0x5cd6d8){return _0x206d92[_0x442b('0x8')]('SugarcrmField',attributes,{'tableName':_0x442b('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x442b('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b52=['util','../../config/logger','moment','request-promise','rimraf','exports','define','SugarcrmField','int_sugarcrm_fields','idField'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x8b52,0x104));var _0x28b5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b52[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x28b5('0x0'));var logger=require(_0x28b5('0x1'))('api');var moment=require(_0x28b5('0x2'));var BPromise=require('bluebird');var rp=require(_0x28b5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28b5('0x4'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x28b5('0x5')]=function(_0x9219d9,_0x28dc81){return _0x9219d9[_0x28b5('0x6')](_0x28b5('0x7'),attributes,{'tableName':_0x28b5('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x28b5('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 227e49a..cd30cf2 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1d1533,_0x399bcf){var _0x13f4ce=function(_0x2ac875){while(--_0x2ac875){_0x1d1533['push'](_0x1d1533['shift']());}};_0x13f4ce(++_0x399bcf);}(_0x757a,0xde));var _0xa757=function(_0x4e4623,_0x1927e0){_0x4e4623=_0x4e4623-0x0;var _0x15fcec=_0x757a[_0x4e4623];return _0x15fcec;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8603,0x190));var _0x3860=function(_0x153e6b,_0xb2b429){_0x153e6b=_0x153e6b-0x0;var _0x4e254d=_0x8603[_0x153e6b];return _0x4e254d;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index fcf3aee..cf42266 100644 --- a/server/api/intVtigerAccount/index.js +++ b/server/api/intVtigerAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x039c=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x3e36ce,_0x432a1c){var _0x361cd3=function(_0x3080d9){while(--_0x3080d9){_0x3e36ce['push'](_0x3e36ce['shift']());}};_0x361cd3(++_0x432a1c);}(_0x039c,0x15b));var _0xc039=function(_0x233877,_0x26ff0e){_0x233877=_0x233877-0x0;var _0x12b075=_0x039c[_0x233877];return _0x12b075;};'use strict';var multer=require('multer');var util=require(_0xc039('0x0'));var path=require(_0xc039('0x1'));var timeout=require(_0xc039('0x2'));var express=require('express');var router=express[_0xc039('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc039('0x4'));var interaction=require(_0xc039('0x5'));var config=require(_0xc039('0x6'));var controller=require(_0xc039('0x7'));router[_0xc039('0x8')]('/',auth[_0xc039('0x9')](),controller['index']);router[_0xc039('0x8')](_0xc039('0xa'),auth[_0xc039('0x9')](),controller[_0xc039('0xb')]);router['get'](_0xc039('0xc'),auth[_0xc039('0x9')](),controller[_0xc039('0xd')]);router[_0xc039('0x8')](_0xc039('0xe'),auth[_0xc039('0x9')](),controller[_0xc039('0xf')]);router[_0xc039('0x10')]('/',auth[_0xc039('0x9')](),controller['create']);router[_0xc039('0x10')](_0xc039('0xc'),auth[_0xc039('0x9')](),controller[_0xc039('0x11')]);router[_0xc039('0x12')]('/:id',auth[_0xc039('0x9')](),controller[_0xc039('0x13')]);router[_0xc039('0x14')]('/:id',auth[_0xc039('0x9')](),controller[_0xc039('0x15')]);module[_0xc039('0x16')]=router; \ No newline at end of file +var _0x6598=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x6598,0xe2));var _0x8659=function(_0x3e1353,_0x138834){_0x3e1353=_0x3e1353-0x0;var _0x2e6cae=_0x6598[_0x3e1353];return _0x2e6cae;};'use strict';var multer=require('multer');var util=require(_0x8659('0x0'));var path=require(_0x8659('0x1'));var timeout=require('connect-timeout');var express=require(_0x8659('0x2'));var router=express[_0x8659('0x3')]();var fs_extra=require(_0x8659('0x4'));var auth=require(_0x8659('0x5'));var interaction=require(_0x8659('0x6'));var config=require(_0x8659('0x7'));var controller=require(_0x8659('0x8'));router[_0x8659('0x9')]('/',auth[_0x8659('0xa')](),controller[_0x8659('0xb')]);router[_0x8659('0x9')](_0x8659('0xc'),auth[_0x8659('0xa')](),controller[_0x8659('0xd')]);router[_0x8659('0x9')](_0x8659('0xe'),auth['isAuthenticated'](),controller[_0x8659('0xf')]);router[_0x8659('0x9')](_0x8659('0x10'),auth[_0x8659('0xa')](),controller['getFields']);router[_0x8659('0x11')]('/',auth[_0x8659('0xa')](),controller[_0x8659('0x12')]);router[_0x8659('0x11')](_0x8659('0xe'),auth[_0x8659('0xa')](),controller[_0x8659('0x13')]);router[_0x8659('0x14')](_0x8659('0xc'),auth[_0x8659('0xa')](),controller[_0x8659('0x15')]);router[_0x8659('0x16')]('/:id',auth[_0x8659('0xa')](),controller[_0x8659('0x17')]);module[_0x8659('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 046d897..f700487 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.attributes.js +++ b/server/api/intVtigerAccount/intVtigerAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6358=['sequelize','exports','STRING'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x6358,0xba));var _0x8635=function(_0x286291,_0x334235){_0x286291=_0x286291-0x0;var _0x6f4e9f=_0x6358[_0x286291];return _0x6f4e9f;};'use strict';var Sequelize=require(_0x8635('0x0'));module[_0x8635('0x1')]={'name':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8635('0x2')]},'username':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8635('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8635('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd04e=['HelpDesk','sequelize','exports','STRING'];(function(_0x673ea4,_0x449076){var _0x3e5938=function(_0x4152e0){while(--_0x4152e0){_0x673ea4['push'](_0x673ea4['shift']());}};_0x3e5938(++_0x449076);}(_0xd04e,0x10d));var _0xed04=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xd04e[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0xed04('0x0'));module[_0xed04('0x1')]={'name':{'type':Sequelize[_0xed04('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xed04('0x2')]},'username':{'type':Sequelize[_0xed04('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xed04('0x2')],'allowNull':![],'defaultValue':_0xed04('0x3')},'remoteUri':{'type':Sequelize[_0xed04('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xed04('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5abcf80..f730734 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.controller.js +++ b/server/api/intVtigerAccount/intVtigerAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee5b=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','name','render','merge','body','contact','agent','interaction','account','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','where','map','VIRTUAL','filter','options','includeAll','findAll','show','params','rawAttributes','include','find','create','getConfigurations','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','findOne','description','moduleName','accessKey','slice','substring','lastIndexOf','format','GET','username','success','POST','login','token','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xee5b,0x1f4));var _0xbee5=function(_0x46e88b,_0x3fe459){_0x46e88b=_0x46e88b-0x0;var _0x89cc73=_0xee5b[_0x46e88b];return _0x89cc73;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];var integrations=require(_0xbee5('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xbee5('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183877,_0x180edd,_0x8a268f,_0x593ecb){return new BPromise(function(_0x5092f2,_0x3c6e56){var _0x4cf5a8=_0x593ecb||client;return _0x4cf5a8[_0xbee5('0x19')](_0x183877,_0x8a268f)['then'](function(_0x1a24bd){logger[_0xbee5('0x1a')](_0xbee5('0x1b'),_0x180edd,'request\x20sent');logger[_0xbee5('0x1c')](_0xbee5('0x1d'),_0x180edd,'request\x20sent',JSON[_0xbee5('0x1e')](_0x1a24bd));if(_0x1a24bd[_0xbee5('0x1f')]){if(_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x20')]===0x1f4){logger[_0xbee5('0x1f')](_0xbee5('0x1b'),_0x180edd,_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x21')]);return _0x3c6e56(_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x21')]);}logger[_0xbee5('0x1f')](_0xbee5('0x1b'),_0x180edd,_0x1a24bd[_0xbee5('0x1f')][_0xbee5('0x21')]);return _0x5092f2(_0x1a24bd[_0xbee5('0x1f')]['message']);}else{logger['info'](_0xbee5('0x1b'),_0x180edd,'request\x20sent');_0x5092f2(_0x1a24bd[_0xbee5('0x22')][_0xbee5('0x21')]);}})[_0xbee5('0x23')](function(_0x2bfb0f){logger[_0xbee5('0x1f')](_0xbee5('0x1b'),_0x180edd,_0x2bfb0f);_0x3c6e56(_0x2bfb0f);});});}function respondWithStatusCode(_0x359ccf,_0x3cfa8d){_0x3cfa8d=_0x3cfa8d||0xcc;return function(_0xc79035){if(_0xc79035){return _0x359ccf['sendStatus'](_0x3cfa8d);}return _0x359ccf['status'](_0x3cfa8d)['end']();};}function respondWithResult(_0x519473,_0x50d774){_0x50d774=_0x50d774||0xc8;return function(_0x1af3de){if(_0x1af3de){return _0x519473[_0xbee5('0x24')](_0x50d774)[_0xbee5('0x25')](_0x1af3de);}};}function respondWithFilteredResult(_0x28c74d,_0x169042){return function(_0x20e7e8){if(_0x20e7e8){var _0x3c8643=typeof _0x169042['offset']===_0xbee5('0x26')&&typeof _0x169042[_0xbee5('0x27')]===_0xbee5('0x26');var _0x39da95=_0x20e7e8[_0xbee5('0x28')];var _0x5f0419=_0x3c8643?0x0:_0x169042[_0xbee5('0x29')];var _0x15ffb1=_0x3c8643?_0x20e7e8[_0xbee5('0x28')]:_0x169042[_0xbee5('0x29')]+_0x169042[_0xbee5('0x27')];var _0x26abe3;if(_0x15ffb1>=_0x39da95){_0x15ffb1=_0x39da95;_0x26abe3=0xc8;}else{_0x26abe3=0xce;}_0x28c74d[_0xbee5('0x24')](_0x26abe3);return _0x28c74d[_0xbee5('0x2a')](_0xbee5('0x2b'),_0x5f0419+'-'+_0x15ffb1+'/'+_0x39da95)['json'](_0x20e7e8);}return null;};}function patchUpdates(_0x22df5f){return function(_0x5b10a6){try{jsonpatch[_0xbee5('0x2c')](_0x5b10a6,_0x22df5f,!![]);}catch(_0x493976){return BPromise[_0xbee5('0x2d')](_0x493976);}return _0x5b10a6['save']();};}function saveUpdates(_0x35609d,_0x5c1109){return function(_0x3220bf){if(_0x3220bf){return _0x3220bf[_0xbee5('0x2e')](_0x35609d)[_0xbee5('0x2f')](function(_0x751489){return _0x751489;});}return null;};}function removeEntity(_0x502e55,_0xefbf7c){return function(_0x17aa8d){if(_0x17aa8d){return _0x17aa8d[_0xbee5('0x30')]()[_0xbee5('0x2f')](function(){_0x502e55['status'](0xcc)[_0xbee5('0x31')]();});}};}function handleEntityNotFound(_0x28f8e3,_0x23ce3f){return function(_0x30a2fc){if(!_0x30a2fc){_0x28f8e3['sendStatus'](0x194);}return _0x30a2fc;};}function handleError(_0x1b092d,_0xe61341){_0xe61341=_0xe61341||0x1f4;return function(_0x3e854){logger[_0xbee5('0x1f')](_0x3e854['stack']);if(_0x3e854[_0xbee5('0x32')]){delete _0x3e854['name'];}_0x1b092d[_0xbee5('0x24')](_0xe61341)['send'](_0x3e854);};}function getMustacheRender(_0x5edf19,_0x59bf49){return Mustache[_0xbee5('0x33')](_0x5edf19,_[_0xbee5('0x34')](_0x59bf49[_0xbee5('0x35')],{'contact':_0x59bf49[_0xbee5('0x36')],'message':_0x59bf49[_0xbee5('0x21')],'agent':_0x59bf49[_0xbee5('0x37')],'interaction':_0x59bf49[_0xbee5('0x38')],'account':_0x59bf49[_0xbee5('0x39')]}))||'';}exports['index']=function(_0x3e99c9,_0x55f98a){var _0x30307c={},_0x16ea3e={},_0x4618e4={'count':0x0,'rows':[]};var _0x49d700=_['map'](db[_0xbee5('0x3a')]['rawAttributes'],function(_0x565e9f){return{'name':_0x565e9f[_0xbee5('0x3b')],'type':_0x565e9f[_0xbee5('0x3c')][_0xbee5('0x3d')]};});_0x16ea3e[_0xbee5('0x3e')]=_['map'](_0x49d700,_0xbee5('0x32'));_0x16ea3e[_0xbee5('0x3f')]=_[_0xbee5('0x40')](_0x3e99c9[_0xbee5('0x3f')]);_0x16ea3e[_0xbee5('0x41')]=_[_0xbee5('0x42')](_0x16ea3e[_0xbee5('0x3e')],_0x16ea3e[_0xbee5('0x3f')]);_0x30307c[_0xbee5('0x43')]=_[_0xbee5('0x42')](_0x16ea3e['model'],qs[_0xbee5('0x44')](_0x3e99c9[_0xbee5('0x3f')]['fields']));_0x30307c[_0xbee5('0x43')]=_0x30307c[_0xbee5('0x43')][_0xbee5('0x45')]?_0x30307c[_0xbee5('0x43')]:_0x16ea3e['model'];if(!_0x3e99c9['query']['hasOwnProperty'](_0xbee5('0x46'))){_0x30307c[_0xbee5('0x27')]=qs[_0xbee5('0x27')](_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x27')]);_0x30307c[_0xbee5('0x29')]=qs[_0xbee5('0x29')](_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x29')]);}_0x30307c['order']=qs['sort'](_0x3e99c9[_0xbee5('0x3f')]['sort']);_0x30307c[_0xbee5('0x47')]=qs[_0xbee5('0x41')](_['pick'](_0x3e99c9[_0xbee5('0x3f')],_0x16ea3e[_0xbee5('0x41')]),_0x49d700);if(_0x3e99c9['query']['filter']){_0x30307c[_0xbee5('0x47')]=_[_0xbee5('0x34')](_0x30307c['where'],{'$or':_[_0xbee5('0x48')](_0x49d700,function(_0x2974f6){if(_0x2974f6['type']!==_0xbee5('0x49')){var _0x382b80={};_0x382b80[_0x2974f6[_0xbee5('0x32')]]={'$like':'%'+_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x4a')]+'%'};return _0x382b80;}})});}_0x30307c=_[_0xbee5('0x34')]({},_0x30307c,_0x3e99c9[_0xbee5('0x4b')]);var _0x5c1451={'where':_0x30307c[_0xbee5('0x47')]};return db[_0xbee5('0x3a')][_0xbee5('0x28')](_0x5c1451)[_0xbee5('0x2f')](function(_0x5ba5f1){_0x4618e4[_0xbee5('0x28')]=_0x5ba5f1;if(_0x3e99c9[_0xbee5('0x3f')][_0xbee5('0x4c')]){_0x30307c['include']=[{'all':!![]}];}return db[_0xbee5('0x3a')][_0xbee5('0x4d')](_0x30307c);})['then'](function(_0x5a6cc2){_0x4618e4['rows']=_0x5a6cc2;return _0x4618e4;})[_0xbee5('0x2f')](respondWithFilteredResult(_0x55f98a,_0x30307c))['catch'](handleError(_0x55f98a,null));};exports[_0xbee5('0x4e')]=function(_0x3ae748,_0x702ce8){var _0x42542c={'raw':![],'where':{'id':_0x3ae748[_0xbee5('0x4f')]['id']}},_0x6db065={};_0x6db065['model']=_[_0xbee5('0x40')](db[_0xbee5('0x3a')][_0xbee5('0x50')]);_0x6db065[_0xbee5('0x3f')]=_['keys'](_0x3ae748[_0xbee5('0x3f')]);_0x6db065['filters']=_[_0xbee5('0x42')](_0x6db065[_0xbee5('0x3e')],_0x6db065[_0xbee5('0x3f')]);_0x42542c[_0xbee5('0x43')]=_[_0xbee5('0x42')](_0x6db065[_0xbee5('0x3e')],qs[_0xbee5('0x44')](_0x3ae748[_0xbee5('0x3f')][_0xbee5('0x44')]));_0x42542c[_0xbee5('0x43')]=_0x42542c[_0xbee5('0x43')][_0xbee5('0x45')]?_0x42542c[_0xbee5('0x43')]:_0x6db065[_0xbee5('0x3e')];if(_0x3ae748[_0xbee5('0x3f')]['includeAll']){_0x42542c[_0xbee5('0x51')]=[{'all':!![]}];}_0x42542c=_[_0xbee5('0x34')]({},_0x42542c,_0x3ae748[_0xbee5('0x4b')]);return db['VtigerAccount'][_0xbee5('0x52')](_0x42542c)[_0xbee5('0x2f')](handleEntityNotFound(_0x702ce8,null))[_0xbee5('0x2f')](respondWithResult(_0x702ce8,null))['catch'](handleError(_0x702ce8,null));};exports[_0xbee5('0x53')]=function(_0x57e5b9,_0x131c45){return db['VtigerAccount'][_0xbee5('0x53')](_0x57e5b9[_0xbee5('0x35')],{})[_0xbee5('0x2f')](respondWithResult(_0x131c45,0xc9))['catch'](handleError(_0x131c45,null));};exports['update']=function(_0x5528e8,_0x90a25a){if(_0x5528e8[_0xbee5('0x35')]['id']){delete _0x5528e8[_0xbee5('0x35')]['id'];}return db['VtigerAccount'][_0xbee5('0x52')]({'where':{'id':_0x5528e8['params']['id']}})[_0xbee5('0x2f')](handleEntityNotFound(_0x90a25a,null))[_0xbee5('0x2f')](saveUpdates(_0x5528e8[_0xbee5('0x35')],null))['then'](respondWithResult(_0x90a25a,null))[_0xbee5('0x23')](handleError(_0x90a25a,null));};exports[_0xbee5('0x30')]=function(_0x1c6f52,_0x3fa83b){return db[_0xbee5('0x3a')][_0xbee5('0x52')]({'where':{'id':_0x1c6f52[_0xbee5('0x4f')]['id']}})[_0xbee5('0x2f')](handleEntityNotFound(_0x3fa83b,null))[_0xbee5('0x2f')](removeEntity(_0x3fa83b,null))[_0xbee5('0x23')](handleError(_0x3fa83b,null));};exports[_0xbee5('0x54')]=function(_0x245521,_0x318016,_0x317b5c){var _0x2c4a4f={};var _0x143fd9={};var _0x32a8d2;var _0x524b12;return db[_0xbee5('0x3a')]['findOne']({'where':{'id':_0x245521['params']['id']}})[_0xbee5('0x2f')](handleEntityNotFound(_0x318016,null))[_0xbee5('0x2f')](function(_0x54faee){if(_0x54faee){_0x32a8d2=_0x54faee;_0x143fd9['model']=_[_0xbee5('0x40')](db['VtigerConfiguration'][_0xbee5('0x50')]);_0x143fd9[_0xbee5('0x3f')]=_['keys'](_0x245521[_0xbee5('0x3f')]);_0x143fd9[_0xbee5('0x41')]=_[_0xbee5('0x42')](_0x143fd9[_0xbee5('0x3e')],_0x143fd9['query']);_0x2c4a4f[_0xbee5('0x43')]=_['intersection'](_0x143fd9[_0xbee5('0x3e')],qs[_0xbee5('0x44')](_0x245521['query'][_0xbee5('0x44')]));_0x2c4a4f[_0xbee5('0x43')]=_0x2c4a4f['attributes'][_0xbee5('0x45')]?_0x2c4a4f[_0xbee5('0x43')]:_0x143fd9['model'];_0x2c4a4f[_0xbee5('0x55')]=qs['sort'](_0x245521[_0xbee5('0x3f')]['sort']);_0x2c4a4f[_0xbee5('0x47')]=qs['filters'](_['pick'](_0x245521[_0xbee5('0x3f')],_0x143fd9[_0xbee5('0x41')]));if(_0x245521[_0xbee5('0x3f')][_0xbee5('0x4a')]){_0x2c4a4f[_0xbee5('0x47')]=_[_0xbee5('0x34')](_0x2c4a4f['where'],{'$or':_[_0xbee5('0x48')](_0x2c4a4f[_0xbee5('0x43')],function(_0x36586a){var _0x70f14d={};_0x70f14d[_0x36586a]={'$like':'%'+_0x245521[_0xbee5('0x3f')][_0xbee5('0x4a')]+'%'};return _0x70f14d;})});}_0x2c4a4f=_[_0xbee5('0x34')]({},_0x2c4a4f,_0x245521[_0xbee5('0x4b')]);return _0x32a8d2[_0xbee5('0x54')](_0x2c4a4f);}})['then'](function(_0x35da4d){if(_0x35da4d){_0x524b12=_0x35da4d[_0xbee5('0x45')];if(!_0x245521[_0xbee5('0x3f')][_0xbee5('0x56')]('nolimit')){_0x2c4a4f[_0xbee5('0x27')]=qs[_0xbee5('0x27')](_0x245521[_0xbee5('0x3f')][_0xbee5('0x27')]);_0x2c4a4f[_0xbee5('0x29')]=qs[_0xbee5('0x29')](_0x245521[_0xbee5('0x3f')][_0xbee5('0x29')]);}return _0x32a8d2[_0xbee5('0x54')](_0x2c4a4f);}})[_0xbee5('0x2f')](function(_0x185974){if(_0x185974){return _0x185974?{'count':_0x524b12,'rows':_0x185974}:null;}})[_0xbee5('0x2f')](respondWithResult(_0x318016,null))['catch'](handleError(_0x318016,null));};exports[_0xbee5('0x57')]=function(_0x184f67,_0x522463,_0x3612ee){if(_0x184f67['body']['id']){delete _0x184f67[_0xbee5('0x35')]['id'];}return db[_0xbee5('0x3a')]['findOne']({'where':{'id':_0x184f67[_0xbee5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x522463,null))['then'](function(_0x58ca95){if(_0x58ca95){_0x184f67['body']['AccountId']=_0x58ca95['id'];_0x184f67['body'][_0xbee5('0x58')]=integrations[_0xbee5('0x59')](_0x184f67[_0xbee5('0x35')][_0xbee5('0x5a')],_0x184f67[_0xbee5('0x35')][_0xbee5('0x3c')]);_0x184f67[_0xbee5('0x35')][_0xbee5('0x5b')]=integrations[_0xbee5('0x5c')](_0x184f67[_0xbee5('0x35')][_0xbee5('0x5a')],_0x184f67[_0xbee5('0x35')]['type']);return db[_0xbee5('0x5d')][_0xbee5('0x53')](_0x184f67['body'],{'include':[{'model':db['VtigerField'],'as':_0xbee5('0x58')},{'model':db[_0xbee5('0x5e')],'as':_0xbee5('0x5b')}]});}return null;})['then'](respondWithResult(_0x522463,null))[_0xbee5('0x23')](handleError(_0x522463,null));};var md5=require(_0xbee5('0x5f'));exports[_0xbee5('0x60')]=function(_0x54e70c,_0x4d8e58,_0x529f67){var _0x3b0d82=null;var _0x185219=null;var _0x4707e6=null;var _0x13cb41=null;var _0x1d39a7='';return db[_0xbee5('0x3a')][_0xbee5('0x61')]({'where':{'id':_0x54e70c[_0xbee5('0x4f')]['id']},'attributes':['id','name','username',_0xbee5('0x62'),_0xbee5('0x63'),'remoteUri','serverUrl',_0xbee5('0x64')]})['then'](handleEntityNotFound(_0x4d8e58,null))['then'](function(_0x382cd4){if(_0x382cd4){_0x3b0d82=_0x382cd4['username'];_0x185219=_0x382cd4[_0xbee5('0x64')];_0x4707e6=_0x382cd4[_0xbee5('0x63')];_0x1d39a7=_0x382cd4['remoteUri'];var _0x16a9c7=_0x1d39a7[_0xbee5('0x65')](-0x1);if(_0x16a9c7==='/'){_0x1d39a7=_0x1d39a7[_0xbee5('0x66')](0x0,_0x1d39a7[_0xbee5('0x67')](_0x16a9c7));}_0x13cb41=util[_0xbee5('0x68')]('%s/webservice.php',_0x1d39a7);var _0x5b5603={'method':_0xbee5('0x69'),'uri':_0x13cb41,'qs':{'operation':'getchallenge','username':_0x382cd4[_0xbee5('0x6a')]},'json':!![]};return rp(_0x5b5603);}})['then'](function(_0x11142b){if(_0x11142b[_0xbee5('0x6b')]){var _0x42d198={'method':_0xbee5('0x6c'),'uri':_0x13cb41,'form':{'operation':_0xbee5('0x6d'),'username':_0x3b0d82,'accessKey':md5(_0x11142b[_0xbee5('0x22')][_0xbee5('0x6e')]+_0x185219)},'json':!![]};return rp(_0x42d198);}})[_0xbee5('0x2f')](function(_0x36b248){if(_0x36b248[_0xbee5('0x6b')]){var _0x1a07ac={'method':_0xbee5('0x69'),'uri':_0x13cb41,'qs':{'operation':'describe','username':_0x3b0d82,'sessionName':_0x36b248[_0xbee5('0x22')][_0xbee5('0x6f')],'elementType':_0x4707e6},'json':!![]};return rp(_0x1a07ac);}})[_0xbee5('0x2f')](function(_0x1585bc){if(_0x1585bc['success']){var _0x1e58f0=[_0xbee5('0x70'),_0xbee5('0x71'),_0xbee5('0x72')];_[_0xbee5('0x73')](_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')],function(_0x1486f5){return _0x1e58f0['includes'](_0x1486f5[_0xbee5('0x3c')][_0xbee5('0x32')]);});_[_0xbee5('0x73')](_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')],function(_0x20516b){return _0x20516b[_0xbee5('0x74')]===_0xbee5('0x75');});return{'count':_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')][_0xbee5('0x45')],'rows':_['map'](_0x1585bc[_0xbee5('0x22')][_0xbee5('0x44')],function(_0x5030f9){return{'id':_0x5030f9[_0xbee5('0x32')],'name':_0x5030f9[_0xbee5('0x76')],'custom':_[_0xbee5('0x77')](_0x5030f9['name'],_0xbee5('0x78'))?!![]:![],'options':_0x5030f9[_0xbee5('0x3c')][_0xbee5('0x32')]===_0xbee5('0x79')&&_0x5030f9[_0xbee5('0x3c')][_0xbee5('0x7a')][_0xbee5('0x45')]>0x0?_[_0xbee5('0x48')](_0x5030f9[_0xbee5('0x3c')][_0xbee5('0x7a')],function(_0x1f9e1d){return{'name':_0x1f9e1d[_0xbee5('0x76')],'value':_0x1f9e1d['value']};}):[]};})};}})[_0xbee5('0x2f')](respondWithResult(_0x4d8e58,null))['catch'](function(_0x5f05ad){console[_0xbee5('0x7b')](_0xbee5('0x7c')+_0x5f05ad);var _0x5aa8f7=_0x54e70c['query'][_0xbee5('0x7d')]?0x1f4:_0x5f05ad[_0xbee5('0x7e')]||0x1f4;logger[_0xbee5('0x1f')](_0xbee5('0x7f'),_0xbee5('0x60'),_0x5aa8f7,JSON[_0xbee5('0x1e')](_0x5f05ad));delete _0x5f05ad[_0xbee5('0x32')];if(_0x5aa8f7===0x191){_0x5aa8f7=0x190;}_0x4d8e58['status'](_0x5aa8f7)[_0xbee5('0x80')](_0x54e70c[_0xbee5('0x3f')][_0xbee5('0x7d')]?{'message':_0xbee5('0x81'),'statusCode':_0x5f05ad[_0xbee5('0x7e')]}:_0x5f05ad);});}; \ No newline at end of file +var _0x96cc=['request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','stack','name','send','render','contact','account','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','options','create','body','update','find','findOne','VtigerConfiguration','getConfigurations','Subjects','Descriptions','getDescriptions','channel','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','POST','token','success','sessionName','autogenerated','reference','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x6f4772,_0x158ba7){var _0x5d1a3c=function(_0x51d8e9){while(--_0x51d8e9){_0x6f4772['push'](_0x6f4772['shift']());}};_0x5d1a3c(++_0x158ba7);}(_0x96cc,0x16c));var _0xc96c=function(_0x451563,_0x1d02c6){_0x451563=_0x451563-0x0;var _0x1bff88=_0x96cc[_0x451563];return _0x1bff88;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];var integrations=require(_0xc96c('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xc96c('0x1a')][_0xc96c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1e7742,_0x3f65fd,_0x48de8d,_0x35da94){return new BPromise(function(_0xbed0c9,_0x399267){var _0x32e640=_0x35da94||client;return _0x32e640[_0xc96c('0x1c')](_0x1e7742,_0x48de8d)[_0xc96c('0x1d')](function(_0x1765d9){logger[_0xc96c('0x1e')](_0xc96c('0x1f'),_0x3f65fd,_0xc96c('0x20'));logger[_0xc96c('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3f65fd,'request\x20sent',JSON[_0xc96c('0x22')](_0x1765d9));if(_0x1765d9[_0xc96c('0x23')]){if(_0x1765d9[_0xc96c('0x23')][_0xc96c('0x24')]===0x1f4){logger['error'](_0xc96c('0x1f'),_0x3f65fd,_0x1765d9[_0xc96c('0x23')][_0xc96c('0x25')]);return _0x399267(_0x1765d9[_0xc96c('0x23')][_0xc96c('0x25')]);}logger[_0xc96c('0x23')](_0xc96c('0x1f'),_0x3f65fd,_0x1765d9[_0xc96c('0x23')][_0xc96c('0x25')]);return _0xbed0c9(_0x1765d9[_0xc96c('0x23')][_0xc96c('0x25')]);}else{logger[_0xc96c('0x1e')](_0xc96c('0x1f'),_0x3f65fd,_0xc96c('0x20'));_0xbed0c9(_0x1765d9[_0xc96c('0x26')][_0xc96c('0x25')]);}})[_0xc96c('0x27')](function(_0x51dabe){logger[_0xc96c('0x23')](_0xc96c('0x1f'),_0x3f65fd,_0x51dabe);_0x399267(_0x51dabe);});});}function respondWithStatusCode(_0x4456bf,_0x10ae21){_0x10ae21=_0x10ae21||0xcc;return function(_0x2b1df9){if(_0x2b1df9){return _0x4456bf[_0xc96c('0x28')](_0x10ae21);}return _0x4456bf[_0xc96c('0x29')](_0x10ae21)[_0xc96c('0x2a')]();};}function respondWithResult(_0x1a77df,_0x14f171){_0x14f171=_0x14f171||0xc8;return function(_0x50fc07){if(_0x50fc07){return _0x1a77df[_0xc96c('0x29')](_0x14f171)[_0xc96c('0x2b')](_0x50fc07);}};}function respondWithFilteredResult(_0x3f87cc,_0x294fee){return function(_0x58fab3){if(_0x58fab3){var _0x5c00b6=typeof _0x294fee[_0xc96c('0x2c')]===_0xc96c('0x2d')&&typeof _0x294fee[_0xc96c('0x2e')]===_0xc96c('0x2d');var _0x3c0eb1=_0x58fab3[_0xc96c('0x2f')];var _0x427cb2=_0x5c00b6?0x0:_0x294fee[_0xc96c('0x2c')];var _0xa0efbc=_0x5c00b6?_0x58fab3[_0xc96c('0x2f')]:_0x294fee[_0xc96c('0x2c')]+_0x294fee[_0xc96c('0x2e')];var _0x20f258;if(_0xa0efbc>=_0x3c0eb1){_0xa0efbc=_0x3c0eb1;_0x20f258=0xc8;}else{_0x20f258=0xce;}_0x3f87cc[_0xc96c('0x29')](_0x20f258);return _0x3f87cc['set'](_0xc96c('0x30'),_0x427cb2+'-'+_0xa0efbc+'/'+_0x3c0eb1)['json'](_0x58fab3);}return null;};}function patchUpdates(_0x3f4b0e){return function(_0x442c7f){try{jsonpatch[_0xc96c('0x31')](_0x442c7f,_0x3f4b0e,!![]);}catch(_0x51f90c){return BPromise[_0xc96c('0x32')](_0x51f90c);}return _0x442c7f[_0xc96c('0x33')]();};}function saveUpdates(_0x446e5c,_0x26c5b7){return function(_0x4da9b5){if(_0x4da9b5){return _0x4da9b5['update'](_0x446e5c)[_0xc96c('0x1d')](function(_0x15eda8){return _0x15eda8;});}return null;};}function removeEntity(_0x173bf1,_0x5de66b){return function(_0x1f3911){if(_0x1f3911){return _0x1f3911[_0xc96c('0x34')]()[_0xc96c('0x1d')](function(){_0x173bf1[_0xc96c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4132a9,_0x35cbb9){return function(_0x58b83b){if(!_0x58b83b){_0x4132a9[_0xc96c('0x28')](0x194);}return _0x58b83b;};}function handleError(_0x3f422f,_0x8ff185){_0x8ff185=_0x8ff185||0x1f4;return function(_0x2d2595){logger[_0xc96c('0x23')](_0x2d2595[_0xc96c('0x35')]);if(_0x2d2595['name']){delete _0x2d2595[_0xc96c('0x36')];}_0x3f422f[_0xc96c('0x29')](_0x8ff185)[_0xc96c('0x37')](_0x2d2595);};}function getMustacheRender(_0x215d30,_0x107fa2){return Mustache[_0xc96c('0x38')](_0x215d30,_['merge'](_0x107fa2['body'],{'contact':_0x107fa2[_0xc96c('0x39')],'message':_0x107fa2[_0xc96c('0x25')],'agent':_0x107fa2['agent'],'interaction':_0x107fa2['interaction'],'account':_0x107fa2[_0xc96c('0x3a')]}))||'';}exports[_0xc96c('0x3b')]=function(_0x2eedc4,_0x1d6054){var _0x1e02eb={},_0x298331={},_0x938476={'count':0x0,'rows':[]};var _0x257750=_[_0xc96c('0x3c')](db[_0xc96c('0x3d')][_0xc96c('0x3e')],function(_0x5ed343){return{'name':_0x5ed343[_0xc96c('0x3f')],'type':_0x5ed343[_0xc96c('0x40')][_0xc96c('0x41')]};});_0x298331[_0xc96c('0x42')]=_['map'](_0x257750,_0xc96c('0x36'));_0x298331[_0xc96c('0x43')]=_[_0xc96c('0x44')](_0x2eedc4['query']);_0x298331['filters']=_[_0xc96c('0x45')](_0x298331[_0xc96c('0x42')],_0x298331[_0xc96c('0x43')]);_0x1e02eb['attributes']=_[_0xc96c('0x45')](_0x298331[_0xc96c('0x42')],qs[_0xc96c('0x46')](_0x2eedc4[_0xc96c('0x43')][_0xc96c('0x46')]));_0x1e02eb[_0xc96c('0x47')]=_0x1e02eb[_0xc96c('0x47')][_0xc96c('0x48')]?_0x1e02eb[_0xc96c('0x47')]:_0x298331['model'];if(!_0x2eedc4['query'][_0xc96c('0x49')](_0xc96c('0x4a'))){_0x1e02eb[_0xc96c('0x2e')]=qs[_0xc96c('0x2e')](_0x2eedc4['query']['limit']);_0x1e02eb[_0xc96c('0x2c')]=qs[_0xc96c('0x2c')](_0x2eedc4[_0xc96c('0x43')][_0xc96c('0x2c')]);}_0x1e02eb[_0xc96c('0x4b')]=qs[_0xc96c('0x4c')](_0x2eedc4[_0xc96c('0x43')]['sort']);_0x1e02eb[_0xc96c('0x4d')]=qs[_0xc96c('0x4e')](_[_0xc96c('0x4f')](_0x2eedc4[_0xc96c('0x43')],_0x298331['filters']),_0x257750);if(_0x2eedc4['query'][_0xc96c('0x50')]){_0x1e02eb[_0xc96c('0x4d')]=_[_0xc96c('0x51')](_0x1e02eb[_0xc96c('0x4d')],{'$or':_[_0xc96c('0x3c')](_0x257750,function(_0x2c78ea){if(_0x2c78ea[_0xc96c('0x40')]!==_0xc96c('0x52')){var _0xc9f94d={};_0xc9f94d[_0x2c78ea[_0xc96c('0x36')]]={'$like':'%'+_0x2eedc4[_0xc96c('0x43')][_0xc96c('0x50')]+'%'};return _0xc9f94d;}})});}_0x1e02eb=_[_0xc96c('0x51')]({},_0x1e02eb,_0x2eedc4['options']);var _0x13445d={'where':_0x1e02eb[_0xc96c('0x4d')]};return db[_0xc96c('0x3d')][_0xc96c('0x2f')](_0x13445d)['then'](function(_0x26f629){_0x938476['count']=_0x26f629;if(_0x2eedc4[_0xc96c('0x43')][_0xc96c('0x53')]){_0x1e02eb['include']=[{'all':!![]}];}return db[_0xc96c('0x3d')][_0xc96c('0x54')](_0x1e02eb);})[_0xc96c('0x1d')](function(_0x6524d){_0x938476[_0xc96c('0x55')]=_0x6524d;return _0x938476;})[_0xc96c('0x1d')](respondWithFilteredResult(_0x1d6054,_0x1e02eb))['catch'](handleError(_0x1d6054,null));};exports['show']=function(_0x557511,_0x1357f0){var _0x5ed7a7={'raw':![],'where':{'id':_0x557511[_0xc96c('0x56')]['id']}},_0x124385={};_0x124385[_0xc96c('0x42')]=_[_0xc96c('0x44')](db[_0xc96c('0x3d')][_0xc96c('0x3e')]);_0x124385[_0xc96c('0x43')]=_[_0xc96c('0x44')](_0x557511[_0xc96c('0x43')]);_0x124385[_0xc96c('0x4e')]=_['intersection'](_0x124385[_0xc96c('0x42')],_0x124385[_0xc96c('0x43')]);_0x5ed7a7[_0xc96c('0x47')]=_[_0xc96c('0x45')](_0x124385[_0xc96c('0x42')],qs[_0xc96c('0x46')](_0x557511[_0xc96c('0x43')][_0xc96c('0x46')]));_0x5ed7a7['attributes']=_0x5ed7a7['attributes']['length']?_0x5ed7a7['attributes']:_0x124385[_0xc96c('0x42')];if(_0x557511[_0xc96c('0x43')][_0xc96c('0x53')]){_0x5ed7a7[_0xc96c('0x57')]=[{'all':!![]}];}_0x5ed7a7=_[_0xc96c('0x51')]({},_0x5ed7a7,_0x557511[_0xc96c('0x58')]);return db[_0xc96c('0x3d')]['find'](_0x5ed7a7)[_0xc96c('0x1d')](handleEntityNotFound(_0x1357f0,null))[_0xc96c('0x1d')](respondWithResult(_0x1357f0,null))[_0xc96c('0x27')](handleError(_0x1357f0,null));};exports[_0xc96c('0x59')]=function(_0x216f1b,_0x1dbea5){return db[_0xc96c('0x3d')]['create'](_0x216f1b[_0xc96c('0x5a')],{})[_0xc96c('0x1d')](respondWithResult(_0x1dbea5,0xc9))[_0xc96c('0x27')](handleError(_0x1dbea5,null));};exports[_0xc96c('0x5b')]=function(_0x3df6ff,_0x3c9de9){if(_0x3df6ff[_0xc96c('0x5a')]['id']){delete _0x3df6ff[_0xc96c('0x5a')]['id'];}return db[_0xc96c('0x3d')][_0xc96c('0x5c')]({'where':{'id':_0x3df6ff[_0xc96c('0x56')]['id']}})[_0xc96c('0x1d')](handleEntityNotFound(_0x3c9de9,null))[_0xc96c('0x1d')](saveUpdates(_0x3df6ff[_0xc96c('0x5a')],null))['then'](respondWithResult(_0x3c9de9,null))[_0xc96c('0x27')](handleError(_0x3c9de9,null));};exports[_0xc96c('0x34')]=function(_0x3d879a,_0x2fe209){return db[_0xc96c('0x3d')]['find']({'where':{'id':_0x3d879a[_0xc96c('0x56')]['id']}})[_0xc96c('0x1d')](handleEntityNotFound(_0x2fe209,null))[_0xc96c('0x1d')](removeEntity(_0x2fe209,null))[_0xc96c('0x27')](handleError(_0x2fe209,null));};exports['getConfigurations']=function(_0x302ff2,_0x4629ce,_0x4d9acc){var _0x5e0076={};var _0x548028={};var _0x46de63;var _0x190d99;return db[_0xc96c('0x3d')][_0xc96c('0x5d')]({'where':{'id':_0x302ff2[_0xc96c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4629ce,null))['then'](function(_0x283966){if(_0x283966){_0x46de63=_0x283966;_0x548028[_0xc96c('0x42')]=_[_0xc96c('0x44')](db[_0xc96c('0x5e')][_0xc96c('0x3e')]);_0x548028['query']=_[_0xc96c('0x44')](_0x302ff2[_0xc96c('0x43')]);_0x548028[_0xc96c('0x4e')]=_[_0xc96c('0x45')](_0x548028['model'],_0x548028['query']);_0x5e0076[_0xc96c('0x47')]=_[_0xc96c('0x45')](_0x548028['model'],qs[_0xc96c('0x46')](_0x302ff2['query'][_0xc96c('0x46')]));_0x5e0076[_0xc96c('0x47')]=_0x5e0076[_0xc96c('0x47')][_0xc96c('0x48')]?_0x5e0076[_0xc96c('0x47')]:_0x548028[_0xc96c('0x42')];_0x5e0076[_0xc96c('0x4b')]=qs[_0xc96c('0x4c')](_0x302ff2[_0xc96c('0x43')][_0xc96c('0x4c')]);_0x5e0076['where']=qs[_0xc96c('0x4e')](_['pick'](_0x302ff2[_0xc96c('0x43')],_0x548028[_0xc96c('0x4e')]));if(_0x302ff2['query'][_0xc96c('0x50')]){_0x5e0076['where']=_[_0xc96c('0x51')](_0x5e0076[_0xc96c('0x4d')],{'$or':_[_0xc96c('0x3c')](_0x5e0076[_0xc96c('0x47')],function(_0x117639){var _0x1a12ed={};_0x1a12ed[_0x117639]={'$like':'%'+_0x302ff2[_0xc96c('0x43')][_0xc96c('0x50')]+'%'};return _0x1a12ed;})});}_0x5e0076=_[_0xc96c('0x51')]({},_0x5e0076,_0x302ff2['options']);return _0x46de63[_0xc96c('0x5f')](_0x5e0076);}})[_0xc96c('0x1d')](function(_0x1b8b5e){if(_0x1b8b5e){_0x190d99=_0x1b8b5e[_0xc96c('0x48')];if(!_0x302ff2['query'][_0xc96c('0x49')](_0xc96c('0x4a'))){_0x5e0076['limit']=qs['limit'](_0x302ff2[_0xc96c('0x43')]['limit']);_0x5e0076[_0xc96c('0x2c')]=qs[_0xc96c('0x2c')](_0x302ff2[_0xc96c('0x43')][_0xc96c('0x2c')]);}return _0x46de63[_0xc96c('0x5f')](_0x5e0076);}})[_0xc96c('0x1d')](function(_0xa00705){if(_0xa00705){return _0xa00705?{'count':_0x190d99,'rows':_0xa00705}:null;}})[_0xc96c('0x1d')](respondWithResult(_0x4629ce,null))[_0xc96c('0x27')](handleError(_0x4629ce,null));};exports['addConfiguration']=function(_0x28ee7c,_0x18cf04,_0x288d46){if(_0x28ee7c['body']['id']){delete _0x28ee7c['body']['id'];}return db[_0xc96c('0x3d')][_0xc96c('0x5d')]({'where':{'id':_0x28ee7c[_0xc96c('0x56')]['id']}})[_0xc96c('0x1d')](handleEntityNotFound(_0x18cf04,null))[_0xc96c('0x1d')](function(_0x43c26c){if(_0x43c26c){_0x28ee7c[_0xc96c('0x5a')]['AccountId']=_0x43c26c['id'];_0x28ee7c[_0xc96c('0x5a')][_0xc96c('0x60')]=integrations['getSubjects'](_0x28ee7c[_0xc96c('0x5a')]['channel'],_0x28ee7c[_0xc96c('0x5a')][_0xc96c('0x40')]);_0x28ee7c[_0xc96c('0x5a')][_0xc96c('0x61')]=integrations[_0xc96c('0x62')](_0x28ee7c[_0xc96c('0x5a')][_0xc96c('0x63')],_0x28ee7c[_0xc96c('0x5a')][_0xc96c('0x40')]);return db['VtigerConfiguration'][_0xc96c('0x59')](_0x28ee7c[_0xc96c('0x5a')],{'include':[{'model':db['VtigerField'],'as':_0xc96c('0x60')},{'model':db['VtigerField'],'as':_0xc96c('0x61')}]});}return null;})[_0xc96c('0x1d')](respondWithResult(_0x18cf04,null))[_0xc96c('0x27')](handleError(_0x18cf04,null));};var md5=require('md5');exports[_0xc96c('0x64')]=function(_0x150d3d,_0x4f1960,_0xa2d357){var _0x46bf83=null;var _0x414608=null;var _0x5f3aea=null;var _0xefdd1c=null;var _0x1ed8da='';return db[_0xc96c('0x3d')][_0xc96c('0x5d')]({'where':{'id':_0x150d3d[_0xc96c('0x56')]['id']},'attributes':['id',_0xc96c('0x36'),_0xc96c('0x65'),_0xc96c('0x66'),_0xc96c('0x67'),_0xc96c('0x68'),_0xc96c('0x69'),_0xc96c('0x6a')]})[_0xc96c('0x1d')](handleEntityNotFound(_0x4f1960,null))[_0xc96c('0x1d')](function(_0x2823f0){if(_0x2823f0){_0x46bf83=_0x2823f0['username'];_0x414608=_0x2823f0[_0xc96c('0x6a')];_0x5f3aea=_0x2823f0[_0xc96c('0x67')];_0x1ed8da=_0x2823f0[_0xc96c('0x68')];var _0x35a55b=_0x1ed8da[_0xc96c('0x6b')](-0x1);if(_0x35a55b==='/'){_0x1ed8da=_0x1ed8da['substring'](0x0,_0x1ed8da[_0xc96c('0x6c')](_0x35a55b));}_0xefdd1c=util[_0xc96c('0x6d')](_0xc96c('0x6e'),_0x1ed8da);var _0x239846={'method':_0xc96c('0x6f'),'uri':_0xefdd1c,'qs':{'operation':'getchallenge','username':_0x2823f0['username']},'json':!![]};return rp(_0x239846);}})[_0xc96c('0x1d')](function(_0x3c2a57){if(_0x3c2a57['success']){var _0x55b2eb={'method':_0xc96c('0x70'),'uri':_0xefdd1c,'form':{'operation':'login','username':_0x46bf83,'accessKey':md5(_0x3c2a57[_0xc96c('0x26')][_0xc96c('0x71')]+_0x414608)},'json':!![]};return rp(_0x55b2eb);}})['then'](function(_0x1c6e4e){if(_0x1c6e4e[_0xc96c('0x72')]){var _0x20497e={'method':_0xc96c('0x6f'),'uri':_0xefdd1c,'qs':{'operation':'describe','username':_0x46bf83,'sessionName':_0x1c6e4e[_0xc96c('0x26')][_0xc96c('0x73')],'elementType':_0x5f3aea},'json':!![]};return rp(_0x20497e);}})['then'](function(_0x47f1fa){if(_0x47f1fa[_0xc96c('0x72')]){var _0x490a9a=[_0xc96c('0x74'),_0xc96c('0x75'),'owner'];_['remove'](_0x47f1fa[_0xc96c('0x26')][_0xc96c('0x46')],function(_0x5cf014){return _0x490a9a[_0xc96c('0x76')](_0x5cf014[_0xc96c('0x40')][_0xc96c('0x36')]);});_[_0xc96c('0x77')](_0x47f1fa[_0xc96c('0x26')][_0xc96c('0x46')],function(_0x2a7109){return _0x2a7109[_0xc96c('0x78')]===_0xc96c('0x79');});return{'count':_0x47f1fa[_0xc96c('0x26')][_0xc96c('0x46')][_0xc96c('0x48')],'rows':_[_0xc96c('0x3c')](_0x47f1fa[_0xc96c('0x26')][_0xc96c('0x46')],function(_0x135676){return{'id':_0x135676['name'],'name':_0x135676[_0xc96c('0x7a')],'custom':_[_0xc96c('0x7b')](_0x135676[_0xc96c('0x36')],_0xc96c('0x7c'))?!![]:![],'options':_0x135676['type'][_0xc96c('0x36')]===_0xc96c('0x7d')&&_0x135676[_0xc96c('0x40')][_0xc96c('0x7e')][_0xc96c('0x48')]>0x0?_[_0xc96c('0x3c')](_0x135676['type'][_0xc96c('0x7e')],function(_0x55f9d0){return{'name':_0x55f9d0['label'],'value':_0x55f9d0['value']};}):[]};})};}})['then'](respondWithResult(_0x4f1960,null))['catch'](function(_0x22b92a){console[_0xc96c('0x7f')]('vTiger\x20error:\x20'+_0x22b92a);var _0x578cb0=_0x150d3d[_0xc96c('0x43')][_0xc96c('0x80')]?0x1f4:_0x22b92a[_0xc96c('0x81')]||0x1f4;logger[_0xc96c('0x23')](_0xc96c('0x82'),_0xc96c('0x64'),_0x578cb0,JSON[_0xc96c('0x22')](_0x22b92a));delete _0x22b92a[_0xc96c('0x36')];if(_0x578cb0===0x191){_0x578cb0=0x190;}_0x4f1960[_0xc96c('0x29')](_0x578cb0)[_0xc96c('0x37')](_0x150d3d[_0xc96c('0x43')][_0xc96c('0x80')]?{'message':_0xc96c('0x83'),'statusCode':_0x22b92a[_0xc96c('0x81')]}:_0x22b92a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 46bae37..ea7d340 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.model.js +++ b/server/api/intVtigerAccount/intVtigerAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x978a=['exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x24c06b,_0x3da583){var _0x46398a=function(_0x12d220){while(--_0x12d220){_0x24c06b['push'](_0x24c06b['shift']());}};_0x46398a(++_0x3da583);}(_0x978a,0x1bb));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa978('0x0'));var util=require(_0xa978('0x1'));var logger=require(_0xa978('0x2'))('api');var moment=require(_0xa978('0x3'));var BPromise=require(_0xa978('0x4'));var rp=require(_0xa978('0x5'));var fs=require('fs');var path=require(_0xa978('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xa978('0x7')]=function(_0x53b63e,_0x5b29f4){return _0x53b63e[_0xa978('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa682=['int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xa682,0xde));var _0x2a68=function(_0x41e5af,_0x1ea510){_0x41e5af=_0x41e5af-0x0;var _0x2b26a3=_0xa682[_0x41e5af];return _0x2b26a3;};'use strict';var _=require(_0x2a68('0x0'));var util=require(_0x2a68('0x1'));var logger=require(_0x2a68('0x2'))('api');var moment=require(_0x2a68('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a68('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a68('0x5'));var config=require(_0x2a68('0x6'));var attributes=require(_0x2a68('0x7'));var integrations=require(_0x2a68('0x8'));module[_0x2a68('0x9')]=function(_0x236988,_0x15c9da){return _0x236988[_0x2a68('0xa')](_0x2a68('0xb'),attributes,{'tableName':_0x2a68('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 2e08bdd..0d9c389 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf49f=['code','message','catch','options','raw','limit','map','include','attributes','model','GetVtigerAccount','VtigerAccount','find','where','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4473be,_0x529ba7){var _0x4a2ede=function(_0x422651){while(--_0x422651){_0x4473be['push'](_0x4473be['shift']());}};_0x4a2ede(++_0x529ba7);}(_0xf49f,0x1e3));var _0xff49=function(_0x3e0b3f,_0x28d5ba){_0x3e0b3f=_0x3e0b3f-0x0;var _0x244a93=_0xf49f[_0x3e0b3f];return _0x244a93;};'use strict';var _=require(_0xff49('0x0'));var util=require(_0xff49('0x1'));var moment=require(_0xff49('0x2'));var BPromise=require(_0xff49('0x3'));var rs=require(_0xff49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff49('0x5'));var logger=require(_0xff49('0x6'))(_0xff49('0x7'));var config=require(_0xff49('0x8'));var jayson=require(_0xff49('0x9'));var client=jayson[_0xff49('0xa')][_0xff49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36f9c7,_0x37b623,_0x34e049){return new BPromise(function(_0x1439f8,_0x471ace){return client[_0xff49('0xc')](_0x36f9c7,_0x34e049)[_0xff49('0xd')](function(_0x35df6a){logger[_0xff49('0xe')](_0xff49('0xf'),_0x37b623,_0xff49('0x10'));logger[_0xff49('0x11')](_0xff49('0x12'),_0x37b623,_0xff49('0x10'),JSON[_0xff49('0x13')](_0x35df6a));if(_0x35df6a[_0xff49('0x14')]){if(_0x35df6a[_0xff49('0x14')][_0xff49('0x15')]===0x1f4){logger['error'](_0xff49('0xf'),_0x37b623,_0x35df6a[_0xff49('0x14')][_0xff49('0x16')]);return _0x471ace(_0x35df6a[_0xff49('0x14')]['message']);}logger[_0xff49('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x37b623,_0x35df6a['error'][_0xff49('0x16')]);return _0x1439f8(_0x35df6a[_0xff49('0x14')]['message']);}else{logger[_0xff49('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37b623,_0xff49('0x10'));_0x1439f8(_0x35df6a['result'][_0xff49('0x16')]);}})[_0xff49('0x17')](function(_0x54a73f){logger[_0xff49('0x14')](_0xff49('0xf'),_0x37b623,_0x54a73f);_0x471ace(_0x54a73f);});});}exports['GetVtigerAccount']=function(_0x4359f9){var _0x37d2c5=this;return new Promise(function(_0x5307bb,_0x23135b){return db['VtigerAccount']['findAll']({'raw':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')][_0xff49('0x19')]===undefined?!![]:![]:!![],'where':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')]['where']||null:null,'attributes':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')]['attributes']||null:null,'limit':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')][_0xff49('0x1a')]||null:null,'include':_0x4359f9[_0xff49('0x18')]?_0x4359f9[_0xff49('0x18')]['include']?_[_0xff49('0x1b')](_0x4359f9[_0xff49('0x18')][_0xff49('0x1c')],function(_0x4e5735){return{'model':db[_0x4e5735['model']],'as':_0x4e5735['as'],'attributes':_0x4e5735[_0xff49('0x1d')],'include':_0x4e5735[_0xff49('0x1c')]?_['map'](_0x4e5735[_0xff49('0x1c')],function(_0x54c956){return{'model':db[_0x54c956['model']],'as':_0x54c956['as'],'attributes':_0x54c956[_0xff49('0x1d')],'include':_0x54c956[_0xff49('0x1c')]?_[_0xff49('0x1b')](_0x54c956[_0xff49('0x1c')],function(_0x2a0445){return{'model':db[_0x2a0445[_0xff49('0x1e')]],'as':_0x2a0445['as'],'attributes':_0x2a0445[_0xff49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff49('0xd')](function(_0x4d6d21){logger[_0xff49('0xe')](_0xff49('0x1f'),_0x4359f9);logger['debug'](_0xff49('0x1f'),_0x4359f9,JSON[_0xff49('0x13')](_0x4d6d21));_0x5307bb(_0x4d6d21);})[_0xff49('0x17')](function(_0x5dc1fd){logger[_0xff49('0x14')](_0xff49('0x1f'),_0x5dc1fd[_0xff49('0x16')],_0x4359f9);_0x23135b(_0x37d2c5[_0xff49('0x14')](0x1f4,_0x5dc1fd['message']));});});};exports['ShowVtigerAccount']=function(_0x945931){var _0x310db4=this;return new Promise(function(_0x6f4d42,_0x2cf45e){return db[_0xff49('0x20')][_0xff49('0x21')]({'raw':_0x945931[_0xff49('0x18')]?_0x945931[_0xff49('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x945931[_0xff49('0x18')]?_0x945931[_0xff49('0x18')][_0xff49('0x22')]||null:null,'attributes':_0x945931['options']?_0x945931['options'][_0xff49('0x1d')]||null:null,'include':_0x945931[_0xff49('0x18')]?_0x945931['options'][_0xff49('0x1c')]?_[_0xff49('0x1b')](_0x945931[_0xff49('0x18')]['include'],function(_0x3281d8){return{'model':db[_0x3281d8[_0xff49('0x1e')]],'as':_0x3281d8['as'],'attributes':_0x3281d8[_0xff49('0x1d')],'include':_0x3281d8[_0xff49('0x1c')]?_['map'](_0x3281d8['include'],function(_0x55c034){return{'model':db[_0x55c034['model']],'as':_0x55c034['as'],'attributes':_0x55c034[_0xff49('0x1d')],'include':_0x55c034['include']?_[_0xff49('0x1b')](_0x55c034[_0xff49('0x1c')],function(_0x5968e2){return{'model':db[_0x5968e2['model']],'as':_0x5968e2['as'],'attributes':_0x5968e2[_0xff49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff49('0xd')](function(_0x2d37fb){logger['info'](_0xff49('0x23'),_0x945931);logger[_0xff49('0x11')]('ShowVtigerAccount',_0x945931,JSON[_0xff49('0x13')](_0x2d37fb));_0x6f4d42(_0x2d37fb);})[_0xff49('0x17')](function(_0x7f1702){logger[_0xff49('0x14')](_0xff49('0x23'),_0x7f1702['message'],_0x945931);_0x2cf45e(_0x310db4['error'](0x1f4,_0x7f1702[_0xff49('0x16')]));});});}; \ No newline at end of file +var _0x8ca3=['result','catch','VtigerAccount','findAll','options','limit','include','map','attributes','model','then','GetVtigerAccount','ShowVtigerAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x65fe77,_0x508da9){var _0x58b716=function(_0x1c401d){while(--_0x1c401d){_0x65fe77['push'](_0x65fe77['shift']());}};_0x58b716(++_0x508da9);}(_0x8ca3,0xc3));var _0x38ca=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x8ca3[_0x2652ef];return _0x2db578;};'use strict';var _=require(_0x38ca('0x0'));var util=require(_0x38ca('0x1'));var moment=require(_0x38ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x38ca('0x3'));var fs=require('fs');var Redis=require(_0x38ca('0x4'));var db=require(_0x38ca('0x5'))['db'];var utils=require(_0x38ca('0x6'));var logger=require(_0x38ca('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x38ca('0x8'));var client=jayson[_0x38ca('0x9')][_0x38ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35e0d4,_0x14e5c6,_0x519eaa){return new BPromise(function(_0x5cc04a,_0x33f212){return client[_0x38ca('0xb')](_0x35e0d4,_0x519eaa)['then'](function(_0x16796f){logger[_0x38ca('0xc')](_0x38ca('0xd'),_0x14e5c6,_0x38ca('0xe'));logger[_0x38ca('0xf')](_0x38ca('0x10'),_0x14e5c6,'request\x20sent',JSON[_0x38ca('0x11')](_0x16796f));if(_0x16796f[_0x38ca('0x12')]){if(_0x16796f['error'][_0x38ca('0x13')]===0x1f4){logger['error'](_0x38ca('0xd'),_0x14e5c6,_0x16796f['error'][_0x38ca('0x14')]);return _0x33f212(_0x16796f[_0x38ca('0x12')]['message']);}logger[_0x38ca('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x14e5c6,_0x16796f[_0x38ca('0x12')][_0x38ca('0x14')]);return _0x5cc04a(_0x16796f[_0x38ca('0x12')][_0x38ca('0x14')]);}else{logger[_0x38ca('0xc')](_0x38ca('0xd'),_0x14e5c6,_0x38ca('0xe'));_0x5cc04a(_0x16796f[_0x38ca('0x15')][_0x38ca('0x14')]);}})[_0x38ca('0x16')](function(_0x3378e7){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x14e5c6,_0x3378e7);_0x33f212(_0x3378e7);});});}exports['GetVtigerAccount']=function(_0x2e92d5){var _0xe1d7fe=this;return new Promise(function(_0x744817,_0x499eb7){return db[_0x38ca('0x17')][_0x38ca('0x18')]({'raw':_0x2e92d5[_0x38ca('0x19')]?_0x2e92d5[_0x38ca('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2e92d5[_0x38ca('0x19')]?_0x2e92d5[_0x38ca('0x19')]['where']||null:null,'attributes':_0x2e92d5[_0x38ca('0x19')]?_0x2e92d5[_0x38ca('0x19')]['attributes']||null:null,'limit':_0x2e92d5[_0x38ca('0x19')]?_0x2e92d5[_0x38ca('0x19')][_0x38ca('0x1a')]||null:null,'include':_0x2e92d5['options']?_0x2e92d5['options'][_0x38ca('0x1b')]?_[_0x38ca('0x1c')](_0x2e92d5[_0x38ca('0x19')][_0x38ca('0x1b')],function(_0x4dae0b){return{'model':db[_0x4dae0b['model']],'as':_0x4dae0b['as'],'attributes':_0x4dae0b[_0x38ca('0x1d')],'include':_0x4dae0b['include']?_[_0x38ca('0x1c')](_0x4dae0b[_0x38ca('0x1b')],function(_0x21cb2f){return{'model':db[_0x21cb2f[_0x38ca('0x1e')]],'as':_0x21cb2f['as'],'attributes':_0x21cb2f[_0x38ca('0x1d')],'include':_0x21cb2f[_0x38ca('0x1b')]?_[_0x38ca('0x1c')](_0x21cb2f[_0x38ca('0x1b')],function(_0x2f5c61){return{'model':db[_0x2f5c61[_0x38ca('0x1e')]],'as':_0x2f5c61['as'],'attributes':_0x2f5c61[_0x38ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x38ca('0x1f')](function(_0x2e9b6b){logger[_0x38ca('0xc')](_0x38ca('0x20'),_0x2e92d5);logger['debug'](_0x38ca('0x20'),_0x2e92d5,JSON[_0x38ca('0x11')](_0x2e9b6b));_0x744817(_0x2e9b6b);})[_0x38ca('0x16')](function(_0xdc9225){logger[_0x38ca('0x12')](_0x38ca('0x20'),_0xdc9225['message'],_0x2e92d5);_0x499eb7(_0xe1d7fe[_0x38ca('0x12')](0x1f4,_0xdc9225[_0x38ca('0x14')]));});});};exports[_0x38ca('0x21')]=function(_0x31c6fb){var _0x4c069d=this;return new Promise(function(_0x3b68a9,_0x2c1d8d){return db[_0x38ca('0x17')][_0x38ca('0x22')]({'raw':_0x31c6fb[_0x38ca('0x19')]?_0x31c6fb[_0x38ca('0x19')][_0x38ca('0x23')]===undefined?!![]:![]:!![],'where':_0x31c6fb['options']?_0x31c6fb[_0x38ca('0x19')]['where']||null:null,'attributes':_0x31c6fb[_0x38ca('0x19')]?_0x31c6fb[_0x38ca('0x19')]['attributes']||null:null,'include':_0x31c6fb[_0x38ca('0x19')]?_0x31c6fb[_0x38ca('0x19')][_0x38ca('0x1b')]?_[_0x38ca('0x1c')](_0x31c6fb[_0x38ca('0x19')]['include'],function(_0x5eb829){return{'model':db[_0x5eb829[_0x38ca('0x1e')]],'as':_0x5eb829['as'],'attributes':_0x5eb829[_0x38ca('0x1d')],'include':_0x5eb829['include']?_[_0x38ca('0x1c')](_0x5eb829['include'],function(_0x1243ed){return{'model':db[_0x1243ed[_0x38ca('0x1e')]],'as':_0x1243ed['as'],'attributes':_0x1243ed[_0x38ca('0x1d')],'include':_0x1243ed[_0x38ca('0x1b')]?_[_0x38ca('0x1c')](_0x1243ed[_0x38ca('0x1b')],function(_0xdcc058){return{'model':db[_0xdcc058['model']],'as':_0xdcc058['as'],'attributes':_0xdcc058['attributes']};}):[]};}):[]};}):[]:[]})[_0x38ca('0x1f')](function(_0x32ee68){logger[_0x38ca('0xc')](_0x38ca('0x21'),_0x31c6fb);logger['debug']('ShowVtigerAccount',_0x31c6fb,JSON[_0x38ca('0x11')](_0x32ee68));_0x3b68a9(_0x32ee68);})[_0x38ca('0x16')](function(_0x582d82){logger[_0x38ca('0x12')](_0x38ca('0x21'),_0x582d82['message'],_0x31c6fb);_0x2c1d8d(_0x4c069d['error'](0x1f4,_0x582d82[_0x38ca('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 463374b..865dca9 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x18a523,_0x8d7ec0){var _0x55488c=function(_0x3ed421){while(--_0x3ed421){_0x18a523['push'](_0x18a523['shift']());}};_0x55488c(++_0x8d7ec0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c3523,_0x6cc7c){_0x3c3523=_0x3c3523-0x0;var _0xe1192d=_0x5f2f[_0x3c3523];return _0xe1192d;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x3956b8,_0x20c70b){var _0x2e9d96=function(_0x47e709){while(--_0x47e709){_0x3956b8['push'](_0x3956b8['shift']());}};_0x2e9d96(++_0x20c70b);}(_0x7a54,0x106));var _0x47a5=function(_0x33a320,_0x252b5b){_0x33a320=_0x33a320-0x0;var _0x4a97ed=_0x7a54[_0x33a320];return _0x4a97ed;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ceae185..eadb3db 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd3d=['STRING','sequelize','exports'];(function(_0x3054b8,_0xada5fe){var _0x556ec0=function(_0x9b191c){while(--_0x9b191c){_0x3054b8['push'](_0x3054b8['shift']());}};_0x556ec0(++_0xada5fe);}(_0xbd3d,0x1ab));var _0xdbd3=function(_0x24b31a,_0x11de82){_0x24b31a=_0x24b31a-0x0;var _0x50edd8=_0xbd3d[_0x24b31a];return _0x50edd8;};'use strict';var Sequelize=require(_0xdbd3('0x0'));module[_0xdbd3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdbd3('0x2')]}}; \ No newline at end of file +var _0xa92d=['STRING','exports'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xa92d,0x10d));var _0xda92=function(_0x10ff5e,_0x34be81){_0x10ff5e=_0x10ff5e-0x0;var _0x5f0325=_0xa92d[_0x10ff5e];return _0x5f0325;};'use strict';var Sequelize=require('sequelize');module[_0xda92('0x0')]={'name':{'type':Sequelize[_0xda92('0x1')]},'description':{'type':Sequelize[_0xda92('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 029e8bd..2ea5e46 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ace=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','undefined','count','limit','Content-Range','save','update','sendStatus','stack','name','send','merge','body','agent','interaction','account','map','VtigerConfiguration','rawAttributes','fieldName','type','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','params','keys','length','options','find','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x53995f,_0x1b135c){_0x53995f=_0x53995f-0x0;var _0x1649a9=_0x8ace[_0x53995f];return _0x1649a9;};'use strict';var emlformat=require(_0xe8ac('0x0'));var rimraf=require(_0xe8ac('0x1'));var zipdir=require(_0xe8ac('0x2'));var jsonpatch=require(_0xe8ac('0x3'));var rp=require(_0xe8ac('0x4'));var moment=require(_0xe8ac('0x5'));var BPromise=require(_0xe8ac('0x6'));var Mustache=require(_0xe8ac('0x7'));var util=require(_0xe8ac('0x8'));var path=require(_0xe8ac('0x9'));var sox=require(_0xe8ac('0xa'));var csv=require(_0xe8ac('0xb'));var ejs=require(_0xe8ac('0xc'));var fs=require('fs');var fs_extra=require(_0xe8ac('0xd'));var _=require('lodash');var squel=require(_0xe8ac('0xe'));var crypto=require(_0xe8ac('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8ac('0xb'));var querystring=require('querystring');var Papa=require(_0xe8ac('0x10'));var Redis=require(_0xe8ac('0x11'));var authService=require(_0xe8ac('0x12'));var qs=require(_0xe8ac('0x13'));var as=require(_0xe8ac('0x14'));var hardwareService=require(_0xe8ac('0x15'));var logger=require('../../config/logger')(_0xe8ac('0x16'));var utils=require(_0xe8ac('0x17'));var config=require(_0xe8ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8ac('0x19'))['db'];var jayson=require(_0xe8ac('0x1a'));var client=jayson['client'][_0xe8ac('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2d2935,_0x383fe0,_0x101b33,_0x268f61){return new BPromise(function(_0x317078,_0x1be138){var _0x10609d=_0x268f61||client;return _0x10609d[_0xe8ac('0x1c')](_0x2d2935,_0x101b33)[_0xe8ac('0x1d')](function(_0x5e4495){logger[_0xe8ac('0x1e')](_0xe8ac('0x1f'),_0x383fe0,'request\x20sent');logger[_0xe8ac('0x20')](_0xe8ac('0x21'),_0x383fe0,_0xe8ac('0x22'),JSON[_0xe8ac('0x23')](_0x5e4495));if(_0x5e4495[_0xe8ac('0x24')]){if(_0x5e4495[_0xe8ac('0x24')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x383fe0,_0x5e4495[_0xe8ac('0x24')][_0xe8ac('0x25')]);return _0x1be138(_0x5e4495['error'][_0xe8ac('0x25')]);}logger['error'](_0xe8ac('0x1f'),_0x383fe0,_0x5e4495[_0xe8ac('0x24')]['message']);return _0x317078(_0x5e4495[_0xe8ac('0x24')][_0xe8ac('0x25')]);}else{logger[_0xe8ac('0x1e')](_0xe8ac('0x1f'),_0x383fe0,'request\x20sent');_0x317078(_0x5e4495[_0xe8ac('0x26')]['message']);}})[_0xe8ac('0x27')](function(_0x3933d2){logger[_0xe8ac('0x24')](_0xe8ac('0x1f'),_0x383fe0,_0x3933d2);_0x1be138(_0x3933d2);});});}function respondWithStatusCode(_0x36108c,_0x31956a){_0x31956a=_0x31956a||0xcc;return function(_0x38565d){if(_0x38565d){return _0x36108c['sendStatus'](_0x31956a);}return _0x36108c[_0xe8ac('0x28')](_0x31956a)[_0xe8ac('0x29')]();};}function respondWithResult(_0x183dbf,_0x7c3450){_0x7c3450=_0x7c3450||0xc8;return function(_0x340ae0){if(_0x340ae0){return _0x183dbf[_0xe8ac('0x28')](_0x7c3450)[_0xe8ac('0x2a')](_0x340ae0);}};}function respondWithFilteredResult(_0x3e3fc2,_0x44b07c){return function(_0x562e44){if(_0x562e44){var _0x5a1b69=typeof _0x44b07c[_0xe8ac('0x2b')]===_0xe8ac('0x2c')&&typeof _0x44b07c['limit']===_0xe8ac('0x2c');var _0x5948aa=_0x562e44['count'];var _0x4c1d08=_0x5a1b69?0x0:_0x44b07c[_0xe8ac('0x2b')];var _0x41294e=_0x5a1b69?_0x562e44[_0xe8ac('0x2d')]:_0x44b07c[_0xe8ac('0x2b')]+_0x44b07c[_0xe8ac('0x2e')];var _0x41ffe8;if(_0x41294e>=_0x5948aa){_0x41294e=_0x5948aa;_0x41ffe8=0xc8;}else{_0x41ffe8=0xce;}_0x3e3fc2[_0xe8ac('0x28')](_0x41ffe8);return _0x3e3fc2['set'](_0xe8ac('0x2f'),_0x4c1d08+'-'+_0x41294e+'/'+_0x5948aa)['json'](_0x562e44);}return null;};}function patchUpdates(_0x2aef04){return function(_0x5c4089){try{jsonpatch['apply'](_0x5c4089,_0x2aef04,!![]);}catch(_0x5d7337){return BPromise['reject'](_0x5d7337);}return _0x5c4089[_0xe8ac('0x30')]();};}function saveUpdates(_0x2ca924,_0x301548){return function(_0x29b92f){if(_0x29b92f){return _0x29b92f[_0xe8ac('0x31')](_0x2ca924)[_0xe8ac('0x1d')](function(_0x312743){return _0x312743;});}return null;};}function removeEntity(_0x553753,_0x1cacb0){return function(_0x539fad){if(_0x539fad){return _0x539fad['destroy']()['then'](function(){_0x553753[_0xe8ac('0x28')](0xcc)[_0xe8ac('0x29')]();});}};}function handleEntityNotFound(_0xc68a5f,_0x56feff){return function(_0x4a323a){if(!_0x4a323a){_0xc68a5f[_0xe8ac('0x32')](0x194);}return _0x4a323a;};}function handleError(_0x2e95c4,_0x307f67){_0x307f67=_0x307f67||0x1f4;return function(_0x2850a7){logger['error'](_0x2850a7[_0xe8ac('0x33')]);if(_0x2850a7[_0xe8ac('0x34')]){delete _0x2850a7[_0xe8ac('0x34')];}_0x2e95c4[_0xe8ac('0x28')](_0x307f67)[_0xe8ac('0x35')](_0x2850a7);};}function getMustacheRender(_0x9e5777,_0x46e88c){return Mustache['render'](_0x9e5777,_[_0xe8ac('0x36')](_0x46e88c[_0xe8ac('0x37')],{'contact':_0x46e88c['contact'],'message':_0x46e88c[_0xe8ac('0x25')],'agent':_0x46e88c[_0xe8ac('0x38')],'interaction':_0x46e88c[_0xe8ac('0x39')],'account':_0x46e88c[_0xe8ac('0x3a')]}))||'';}exports['index']=function(_0x97e206,_0x5e63b3){var _0x5cfcb6={},_0x28f061={},_0x21d397={'count':0x0,'rows':[]};var _0x2d1150=_[_0xe8ac('0x3b')](db[_0xe8ac('0x3c')][_0xe8ac('0x3d')],function(_0x78f1ea){return{'name':_0x78f1ea[_0xe8ac('0x3e')],'type':_0x78f1ea[_0xe8ac('0x3f')]['key']};});_0x28f061['model']=_[_0xe8ac('0x3b')](_0x2d1150,_0xe8ac('0x34'));_0x28f061['query']=_['keys'](_0x97e206['query']);_0x28f061[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x28f061[_0xe8ac('0x42')],_0x28f061[_0xe8ac('0x43')]);_0x5cfcb6['attributes']=_[_0xe8ac('0x41')](_0x28f061[_0xe8ac('0x42')],qs['fields'](_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x44')]));_0x5cfcb6[_0xe8ac('0x45')]=_0x5cfcb6[_0xe8ac('0x45')]['length']?_0x5cfcb6['attributes']:_0x28f061['model'];if(!_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x5cfcb6[_0xe8ac('0x2e')]=qs['limit'](_0x97e206['query'][_0xe8ac('0x2e')]);_0x5cfcb6[_0xe8ac('0x2b')]=qs[_0xe8ac('0x2b')](_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x2b')]);}_0x5cfcb6[_0xe8ac('0x48')]=qs[_0xe8ac('0x49')](_0x97e206[_0xe8ac('0x43')][_0xe8ac('0x49')]);_0x5cfcb6[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_[_0xe8ac('0x4b')](_0x97e206[_0xe8ac('0x43')],_0x28f061[_0xe8ac('0x40')]),_0x2d1150);if(_0x97e206['query'][_0xe8ac('0x4c')]){_0x5cfcb6['where']=_['merge'](_0x5cfcb6['where'],{'$or':_['map'](_0x2d1150,function(_0x368e31){if(_0x368e31['type']!==_0xe8ac('0x4d')){var _0x49c0af={};_0x49c0af[_0x368e31[_0xe8ac('0x34')]]={'$like':'%'+_0x97e206[_0xe8ac('0x43')]['filter']+'%'};return _0x49c0af;}})});}_0x5cfcb6=_[_0xe8ac('0x36')]({},_0x5cfcb6,_0x97e206['options']);var _0x160dfb={'where':_0x5cfcb6[_0xe8ac('0x4a')]};return db[_0xe8ac('0x3c')]['count'](_0x160dfb)[_0xe8ac('0x1d')](function(_0x46b06d){_0x21d397[_0xe8ac('0x2d')]=_0x46b06d;if(_0x97e206['query'][_0xe8ac('0x4e')]){_0x5cfcb6[_0xe8ac('0x4f')]=[{'all':!![]}];}return db[_0xe8ac('0x3c')]['findAll'](_0x5cfcb6);})[_0xe8ac('0x1d')](function(_0x4b84d6){_0x21d397[_0xe8ac('0x50')]=_0x4b84d6;return _0x21d397;})[_0xe8ac('0x1d')](respondWithFilteredResult(_0x5e63b3,_0x5cfcb6))[_0xe8ac('0x27')](handleError(_0x5e63b3,null));};exports['show']=function(_0x477448,_0x26c467){var _0x1d1101={'raw':![],'where':{'id':_0x477448[_0xe8ac('0x51')]['id']}},_0x39e173={};_0x39e173[_0xe8ac('0x42')]=_[_0xe8ac('0x52')](db[_0xe8ac('0x3c')][_0xe8ac('0x3d')]);_0x39e173[_0xe8ac('0x43')]=_['keys'](_0x477448[_0xe8ac('0x43')]);_0x39e173[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x39e173['model'],_0x39e173[_0xe8ac('0x43')]);_0x1d1101[_0xe8ac('0x45')]=_[_0xe8ac('0x41')](_0x39e173[_0xe8ac('0x42')],qs[_0xe8ac('0x44')](_0x477448[_0xe8ac('0x43')][_0xe8ac('0x44')]));_0x1d1101[_0xe8ac('0x45')]=_0x1d1101[_0xe8ac('0x45')][_0xe8ac('0x53')]?_0x1d1101[_0xe8ac('0x45')]:_0x39e173['model'];if(_0x477448[_0xe8ac('0x43')][_0xe8ac('0x4e')]){_0x1d1101[_0xe8ac('0x4f')]=[{'all':!![]}];}_0x1d1101=_[_0xe8ac('0x36')]({},_0x1d1101,_0x477448[_0xe8ac('0x54')]);return db[_0xe8ac('0x3c')][_0xe8ac('0x55')](_0x1d1101)[_0xe8ac('0x1d')](handleEntityNotFound(_0x26c467,null))[_0xe8ac('0x1d')](respondWithResult(_0x26c467,null))[_0xe8ac('0x27')](handleError(_0x26c467,null));};exports['create']=function(_0x13f08b,_0xade23d){return db[_0xe8ac('0x3c')]['create'](_0x13f08b[_0xe8ac('0x37')],{})[_0xe8ac('0x1d')](respondWithResult(_0xade23d,0xc9))[_0xe8ac('0x27')](handleError(_0xade23d,null));};exports[_0xe8ac('0x31')]=function(_0x37dd9d,_0x347cc7){if(_0x37dd9d[_0xe8ac('0x37')]['id']){delete _0x37dd9d[_0xe8ac('0x37')]['id'];}return db[_0xe8ac('0x3c')][_0xe8ac('0x55')]({'where':{'id':_0x37dd9d[_0xe8ac('0x51')]['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x347cc7,null))[_0xe8ac('0x1d')](saveUpdates(_0x37dd9d['body'],null))[_0xe8ac('0x1d')](respondWithResult(_0x347cc7,null))[_0xe8ac('0x27')](handleError(_0x347cc7,null));};exports[_0xe8ac('0x56')]=function(_0x5ae2a5,_0x133ac1){return db['VtigerConfiguration'][_0xe8ac('0x55')]({'where':{'id':_0x5ae2a5[_0xe8ac('0x51')]['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x133ac1,null))[_0xe8ac('0x1d')](removeEntity(_0x133ac1,null))[_0xe8ac('0x27')](handleError(_0x133ac1,null));};exports['getFields']=function(_0x5d4e08,_0x3f6d6a,_0x238f39){var _0x2d09b0={};var _0x5a387f={};var _0x1c9e9b;var _0x22c557;return db[_0xe8ac('0x3c')][_0xe8ac('0x57')]({'where':{'id':_0x5d4e08[_0xe8ac('0x51')]['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x3f6d6a,null))[_0xe8ac('0x1d')](function(_0x5c1835){if(_0x5c1835){_0x1c9e9b=_0x5c1835;_0x5a387f[_0xe8ac('0x42')]=_[_0xe8ac('0x52')](db[_0xe8ac('0x58')][_0xe8ac('0x3d')]);_0x5a387f[_0xe8ac('0x43')]=_[_0xe8ac('0x52')](_0x5d4e08[_0xe8ac('0x43')]);_0x5a387f[_0xe8ac('0x40')]=_['intersection'](_0x5a387f['model'],_0x5a387f[_0xe8ac('0x43')]);_0x2d09b0['attributes']=_['intersection'](_0x5a387f[_0xe8ac('0x42')],qs[_0xe8ac('0x44')](_0x5d4e08[_0xe8ac('0x43')]['fields']));_0x2d09b0['attributes']=_0x2d09b0['attributes'][_0xe8ac('0x53')]?_0x2d09b0['attributes']:_0x5a387f[_0xe8ac('0x42')];_0x2d09b0['order']=qs[_0xe8ac('0x49')](_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x49')]);_0x2d09b0[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_[_0xe8ac('0x4b')](_0x5d4e08[_0xe8ac('0x43')],_0x5a387f[_0xe8ac('0x40')]));if(_0x5d4e08[_0xe8ac('0x43')]['filter']){_0x2d09b0[_0xe8ac('0x4a')]=_[_0xe8ac('0x36')](_0x2d09b0[_0xe8ac('0x4a')],{'$or':_[_0xe8ac('0x3b')](_0x2d09b0[_0xe8ac('0x45')],function(_0x40dac2){var _0x50741c={};_0x50741c[_0x40dac2]={'$like':'%'+_0x5d4e08['query'][_0xe8ac('0x4c')]+'%'};return _0x50741c;})});}_0x2d09b0=_['merge']({},_0x2d09b0,_0x5d4e08['options']);return _0x1c9e9b[_0xe8ac('0x59')](_0x2d09b0);}})[_0xe8ac('0x1d')](function(_0x48e360){if(_0x48e360){_0x22c557=_0x48e360[_0xe8ac('0x53')];if(!_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x2d09b0['limit']=qs[_0xe8ac('0x2e')](_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x2e')]);_0x2d09b0[_0xe8ac('0x2b')]=qs[_0xe8ac('0x2b')](_0x5d4e08[_0xe8ac('0x43')][_0xe8ac('0x2b')]);}return _0x1c9e9b[_0xe8ac('0x59')](_0x2d09b0);}})[_0xe8ac('0x1d')](function(_0x50de53){if(_0x50de53){return _0x50de53?{'count':_0x22c557,'rows':_0x50de53}:null;}})[_0xe8ac('0x1d')](respondWithResult(_0x3f6d6a,null))[_0xe8ac('0x27')](handleError(_0x3f6d6a,null));};exports[_0xe8ac('0x5a')]=function(_0x454f86,_0x2a8ea4,_0x494603){var _0x1a218f={};var _0x3dfe17={};var _0x4b535a;var _0x1a3aba;return db[_0xe8ac('0x3c')]['findOne']({'where':{'id':_0x454f86['params']['id']}})[_0xe8ac('0x1d')](handleEntityNotFound(_0x2a8ea4,null))[_0xe8ac('0x1d')](function(_0x47304b){if(_0x47304b){_0x4b535a=_0x47304b;_0x3dfe17[_0xe8ac('0x42')]=_[_0xe8ac('0x52')](db['VtigerField']['rawAttributes']);_0x3dfe17['query']=_[_0xe8ac('0x52')](_0x454f86[_0xe8ac('0x43')]);_0x3dfe17[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x3dfe17[_0xe8ac('0x42')],_0x3dfe17['query']);_0x1a218f[_0xe8ac('0x45')]=_[_0xe8ac('0x41')](_0x3dfe17[_0xe8ac('0x42')],qs[_0xe8ac('0x44')](_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x44')]));_0x1a218f[_0xe8ac('0x45')]=_0x1a218f[_0xe8ac('0x45')][_0xe8ac('0x53')]?_0x1a218f[_0xe8ac('0x45')]:_0x3dfe17[_0xe8ac('0x42')];_0x1a218f[_0xe8ac('0x48')]=qs[_0xe8ac('0x49')](_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x49')]);_0x1a218f[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_['pick'](_0x454f86[_0xe8ac('0x43')],_0x3dfe17[_0xe8ac('0x40')]));if(_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x4c')]){_0x1a218f[_0xe8ac('0x4a')]=_[_0xe8ac('0x36')](_0x1a218f[_0xe8ac('0x4a')],{'$or':_[_0xe8ac('0x3b')](_0x1a218f['attributes'],function(_0x5bcd39){var _0x5ce973={};_0x5ce973[_0x5bcd39]={'$like':'%'+_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x4c')]+'%'};return _0x5ce973;})});}_0x1a218f=_[_0xe8ac('0x36')]({},_0x1a218f,_0x454f86[_0xe8ac('0x54')]);return _0x4b535a[_0xe8ac('0x5a')](_0x1a218f);}})['then'](function(_0x33cedc){if(_0x33cedc){_0x1a3aba=_0x33cedc[_0xe8ac('0x53')];if(!_0x454f86[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x1a218f[_0xe8ac('0x2e')]=qs['limit'](_0x454f86[_0xe8ac('0x43')]['limit']);_0x1a218f['offset']=qs['offset'](_0x454f86['query'][_0xe8ac('0x2b')]);}return _0x4b535a[_0xe8ac('0x5a')](_0x1a218f);}})[_0xe8ac('0x1d')](function(_0x56b6f8){if(_0x56b6f8){return _0x56b6f8?{'count':_0x1a3aba,'rows':_0x56b6f8}:null;}})['then'](respondWithResult(_0x2a8ea4,null))[_0xe8ac('0x27')](handleError(_0x2a8ea4,null));};exports[_0xe8ac('0x5b')]=function(_0x591c95,_0x59dfeb,_0x2de3dc){var _0x3e77a8={};var _0x10a170={};var _0x207a13;var _0x5275de;return db[_0xe8ac('0x3c')][_0xe8ac('0x57')]({'where':{'id':_0x591c95['params']['id']}})['then'](handleEntityNotFound(_0x59dfeb,null))['then'](function(_0x27b090){if(_0x27b090){_0x207a13=_0x27b090;_0x10a170[_0xe8ac('0x42')]=_['keys'](db[_0xe8ac('0x58')]['rawAttributes']);_0x10a170[_0xe8ac('0x43')]=_['keys'](_0x591c95[_0xe8ac('0x43')]);_0x10a170[_0xe8ac('0x40')]=_[_0xe8ac('0x41')](_0x10a170[_0xe8ac('0x42')],_0x10a170[_0xe8ac('0x43')]);_0x3e77a8[_0xe8ac('0x45')]=_[_0xe8ac('0x41')](_0x10a170[_0xe8ac('0x42')],qs['fields'](_0x591c95[_0xe8ac('0x43')]['fields']));_0x3e77a8[_0xe8ac('0x45')]=_0x3e77a8[_0xe8ac('0x45')][_0xe8ac('0x53')]?_0x3e77a8[_0xe8ac('0x45')]:_0x10a170['model'];_0x3e77a8[_0xe8ac('0x48')]=qs[_0xe8ac('0x49')](_0x591c95[_0xe8ac('0x43')]['sort']);_0x3e77a8[_0xe8ac('0x4a')]=qs[_0xe8ac('0x40')](_[_0xe8ac('0x4b')](_0x591c95['query'],_0x10a170['filters']));if(_0x591c95[_0xe8ac('0x43')][_0xe8ac('0x4c')]){_0x3e77a8[_0xe8ac('0x4a')]=_['merge'](_0x3e77a8[_0xe8ac('0x4a')],{'$or':_[_0xe8ac('0x3b')](_0x3e77a8[_0xe8ac('0x45')],function(_0x57be43){var _0x4b2bba={};_0x4b2bba[_0x57be43]={'$like':'%'+_0x591c95[_0xe8ac('0x43')][_0xe8ac('0x4c')]+'%'};return _0x4b2bba;})});}_0x3e77a8=_['merge']({},_0x3e77a8,_0x591c95[_0xe8ac('0x54')]);return _0x207a13[_0xe8ac('0x5b')](_0x3e77a8);}})[_0xe8ac('0x1d')](function(_0x461d99){if(_0x461d99){_0x5275de=_0x461d99[_0xe8ac('0x53')];if(!_0x591c95[_0xe8ac('0x43')][_0xe8ac('0x46')](_0xe8ac('0x47'))){_0x3e77a8[_0xe8ac('0x2e')]=qs[_0xe8ac('0x2e')](_0x591c95[_0xe8ac('0x43')]['limit']);_0x3e77a8[_0xe8ac('0x2b')]=qs[_0xe8ac('0x2b')](_0x591c95[_0xe8ac('0x43')]['offset']);}return _0x207a13[_0xe8ac('0x5b')](_0x3e77a8);}})[_0xe8ac('0x1d')](function(_0x15d0b0){if(_0x15d0b0){return _0x15d0b0?{'count':_0x5275de,'rows':_0x15d0b0}:null;}})[_0xe8ac('0x1d')](respondWithResult(_0x59dfeb,null))[_0xe8ac('0x27')](handleError(_0x59dfeb,null));}; \ No newline at end of file +var _0xfcf0=['map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','create','find','getFields','findOne','order','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','name','render','contact','agent','account','index'];(function(_0x4198e9,_0x2ae28a){var _0xddd71c=function(_0x42d98f){while(--_0x42d98f){_0x4198e9['push'](_0x4198e9['shift']());}};_0xddd71c(++_0x2ae28a);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xfcf0[_0x1ed116];return _0x574066;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];var jayson=require(_0x0fcf('0x18'));var client=jayson['client'][_0x0fcf('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4031ad,_0x160d2c,_0x26b169,_0x25fadc){return new BPromise(function(_0x48bba6,_0xa32692){var _0x3701c9=_0x25fadc||client;return _0x3701c9[_0x0fcf('0x1a')](_0x4031ad,_0x26b169)['then'](function(_0x3c09c4){logger[_0x0fcf('0x1b')](_0x0fcf('0x1c'),_0x160d2c,_0x0fcf('0x1d'));logger['debug'](_0x0fcf('0x1e'),_0x160d2c,_0x0fcf('0x1d'),JSON[_0x0fcf('0x1f')](_0x3c09c4));if(_0x3c09c4[_0x0fcf('0x20')]){if(_0x3c09c4[_0x0fcf('0x20')]['code']===0x1f4){logger[_0x0fcf('0x20')](_0x0fcf('0x1c'),_0x160d2c,_0x3c09c4['error'][_0x0fcf('0x21')]);return _0xa32692(_0x3c09c4[_0x0fcf('0x20')]['message']);}logger[_0x0fcf('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x160d2c,_0x3c09c4[_0x0fcf('0x20')][_0x0fcf('0x21')]);return _0x48bba6(_0x3c09c4['error'][_0x0fcf('0x21')]);}else{logger[_0x0fcf('0x1b')](_0x0fcf('0x1c'),_0x160d2c,'request\x20sent');_0x48bba6(_0x3c09c4[_0x0fcf('0x22')][_0x0fcf('0x21')]);}})[_0x0fcf('0x23')](function(_0x41b20b){logger[_0x0fcf('0x20')](_0x0fcf('0x1c'),_0x160d2c,_0x41b20b);_0xa32692(_0x41b20b);});});}function respondWithStatusCode(_0x5841a9,_0x2eef74){_0x2eef74=_0x2eef74||0xcc;return function(_0x253641){if(_0x253641){return _0x5841a9[_0x0fcf('0x24')](_0x2eef74);}return _0x5841a9[_0x0fcf('0x25')](_0x2eef74)[_0x0fcf('0x26')]();};}function respondWithResult(_0x3cf074,_0x2ce990){_0x2ce990=_0x2ce990||0xc8;return function(_0x18f269){if(_0x18f269){return _0x3cf074[_0x0fcf('0x25')](_0x2ce990)['json'](_0x18f269);}};}function respondWithFilteredResult(_0x18965e,_0xc107a){return function(_0x41b7a2){if(_0x41b7a2){var _0x2f198b=typeof _0xc107a[_0x0fcf('0x27')]===_0x0fcf('0x28')&&typeof _0xc107a[_0x0fcf('0x29')]==='undefined';var _0x137e10=_0x41b7a2[_0x0fcf('0x2a')];var _0x200517=_0x2f198b?0x0:_0xc107a[_0x0fcf('0x27')];var _0x49fd0e=_0x2f198b?_0x41b7a2['count']:_0xc107a['offset']+_0xc107a[_0x0fcf('0x29')];var _0x50b7df;if(_0x49fd0e>=_0x137e10){_0x49fd0e=_0x137e10;_0x50b7df=0xc8;}else{_0x50b7df=0xce;}_0x18965e[_0x0fcf('0x25')](_0x50b7df);return _0x18965e[_0x0fcf('0x2b')]('Content-Range',_0x200517+'-'+_0x49fd0e+'/'+_0x137e10)[_0x0fcf('0x2c')](_0x41b7a2);}return null;};}function patchUpdates(_0x117041){return function(_0xa52f52){try{jsonpatch[_0x0fcf('0x2d')](_0xa52f52,_0x117041,!![]);}catch(_0xc58b86){return BPromise[_0x0fcf('0x2e')](_0xc58b86);}return _0xa52f52['save']();};}function saveUpdates(_0x2ab805,_0x256e2b){return function(_0x40e5ff){if(_0x40e5ff){return _0x40e5ff[_0x0fcf('0x2f')](_0x2ab805)[_0x0fcf('0x30')](function(_0x436e82){return _0x436e82;});}return null;};}function removeEntity(_0x4d3e37,_0x208433){return function(_0xe07780){if(_0xe07780){return _0xe07780[_0x0fcf('0x31')]()[_0x0fcf('0x30')](function(){_0x4d3e37[_0x0fcf('0x25')](0xcc)[_0x0fcf('0x26')]();});}};}function handleEntityNotFound(_0x260d6a,_0x344957){return function(_0x20198c){if(!_0x20198c){_0x260d6a[_0x0fcf('0x24')](0x194);}return _0x20198c;};}function handleError(_0x219caf,_0x38826c){_0x38826c=_0x38826c||0x1f4;return function(_0x2aeef8){logger[_0x0fcf('0x20')](_0x2aeef8['stack']);if(_0x2aeef8['name']){delete _0x2aeef8[_0x0fcf('0x32')];}_0x219caf['status'](_0x38826c)['send'](_0x2aeef8);};}function getMustacheRender(_0x1a1e07,_0x254d6a){return Mustache[_0x0fcf('0x33')](_0x1a1e07,_['merge'](_0x254d6a['body'],{'contact':_0x254d6a[_0x0fcf('0x34')],'message':_0x254d6a[_0x0fcf('0x21')],'agent':_0x254d6a[_0x0fcf('0x35')],'interaction':_0x254d6a['interaction'],'account':_0x254d6a[_0x0fcf('0x36')]}))||'';}exports[_0x0fcf('0x37')]=function(_0x29067e,_0x4e139d){var _0x4c75e6={},_0x536d21={},_0x3c24cb={'count':0x0,'rows':[]};var _0x332f98=_[_0x0fcf('0x38')](db[_0x0fcf('0x39')][_0x0fcf('0x3a')],function(_0x4be8eb){return{'name':_0x4be8eb[_0x0fcf('0x3b')],'type':_0x4be8eb[_0x0fcf('0x3c')][_0x0fcf('0x3d')]};});_0x536d21['model']=_['map'](_0x332f98,_0x0fcf('0x32'));_0x536d21[_0x0fcf('0x3e')]=_[_0x0fcf('0x3f')](_0x29067e[_0x0fcf('0x3e')]);_0x536d21[_0x0fcf('0x40')]=_['intersection'](_0x536d21[_0x0fcf('0x41')],_0x536d21[_0x0fcf('0x3e')]);_0x4c75e6[_0x0fcf('0x42')]=_[_0x0fcf('0x43')](_0x536d21['model'],qs['fields'](_0x29067e[_0x0fcf('0x3e')][_0x0fcf('0x44')]));_0x4c75e6['attributes']=_0x4c75e6[_0x0fcf('0x42')][_0x0fcf('0x45')]?_0x4c75e6['attributes']:_0x536d21[_0x0fcf('0x41')];if(!_0x29067e[_0x0fcf('0x3e')][_0x0fcf('0x46')](_0x0fcf('0x47'))){_0x4c75e6[_0x0fcf('0x29')]=qs['limit'](_0x29067e[_0x0fcf('0x3e')][_0x0fcf('0x29')]);_0x4c75e6['offset']=qs['offset'](_0x29067e[_0x0fcf('0x3e')]['offset']);}_0x4c75e6['order']=qs[_0x0fcf('0x48')](_0x29067e[_0x0fcf('0x3e')][_0x0fcf('0x48')]);_0x4c75e6[_0x0fcf('0x49')]=qs[_0x0fcf('0x40')](_[_0x0fcf('0x4a')](_0x29067e[_0x0fcf('0x3e')],_0x536d21[_0x0fcf('0x40')]),_0x332f98);if(_0x29067e[_0x0fcf('0x3e')][_0x0fcf('0x4b')]){_0x4c75e6['where']=_[_0x0fcf('0x4c')](_0x4c75e6[_0x0fcf('0x49')],{'$or':_[_0x0fcf('0x38')](_0x332f98,function(_0x4b2308){if(_0x4b2308['type']!==_0x0fcf('0x4d')){var _0x7f7d70={};_0x7f7d70[_0x4b2308[_0x0fcf('0x32')]]={'$like':'%'+_0x29067e[_0x0fcf('0x3e')]['filter']+'%'};return _0x7f7d70;}})});}_0x4c75e6=_['merge']({},_0x4c75e6,_0x29067e[_0x0fcf('0x4e')]);var _0x3c06c3={'where':_0x4c75e6[_0x0fcf('0x49')]};return db[_0x0fcf('0x39')][_0x0fcf('0x2a')](_0x3c06c3)[_0x0fcf('0x30')](function(_0x2f6b5a){_0x3c24cb[_0x0fcf('0x2a')]=_0x2f6b5a;if(_0x29067e['query']['includeAll']){_0x4c75e6[_0x0fcf('0x4f')]=[{'all':!![]}];}return db[_0x0fcf('0x39')][_0x0fcf('0x50')](_0x4c75e6);})[_0x0fcf('0x30')](function(_0x5f1791){_0x3c24cb[_0x0fcf('0x51')]=_0x5f1791;return _0x3c24cb;})['then'](respondWithFilteredResult(_0x4e139d,_0x4c75e6))[_0x0fcf('0x23')](handleError(_0x4e139d,null));};exports[_0x0fcf('0x52')]=function(_0x491453,_0x10bf74){var _0x22d67d={'raw':![],'where':{'id':_0x491453[_0x0fcf('0x53')]['id']}},_0x43b3aa={};_0x43b3aa['model']=_[_0x0fcf('0x3f')](db[_0x0fcf('0x39')][_0x0fcf('0x3a')]);_0x43b3aa[_0x0fcf('0x3e')]=_[_0x0fcf('0x3f')](_0x491453[_0x0fcf('0x3e')]);_0x43b3aa[_0x0fcf('0x40')]=_[_0x0fcf('0x43')](_0x43b3aa[_0x0fcf('0x41')],_0x43b3aa[_0x0fcf('0x3e')]);_0x22d67d[_0x0fcf('0x42')]=_[_0x0fcf('0x43')](_0x43b3aa[_0x0fcf('0x41')],qs[_0x0fcf('0x44')](_0x491453['query'][_0x0fcf('0x44')]));_0x22d67d['attributes']=_0x22d67d[_0x0fcf('0x42')][_0x0fcf('0x45')]?_0x22d67d[_0x0fcf('0x42')]:_0x43b3aa[_0x0fcf('0x41')];if(_0x491453[_0x0fcf('0x3e')]['includeAll']){_0x22d67d[_0x0fcf('0x4f')]=[{'all':!![]}];}_0x22d67d=_['merge']({},_0x22d67d,_0x491453[_0x0fcf('0x4e')]);return db[_0x0fcf('0x39')]['find'](_0x22d67d)[_0x0fcf('0x30')](handleEntityNotFound(_0x10bf74,null))[_0x0fcf('0x30')](respondWithResult(_0x10bf74,null))['catch'](handleError(_0x10bf74,null));};exports[_0x0fcf('0x54')]=function(_0x2e9226,_0x2e57b8){return db[_0x0fcf('0x39')][_0x0fcf('0x54')](_0x2e9226['body'],{})['then'](respondWithResult(_0x2e57b8,0xc9))[_0x0fcf('0x23')](handleError(_0x2e57b8,null));};exports['update']=function(_0x385059,_0x64befd){if(_0x385059['body']['id']){delete _0x385059['body']['id'];}return db[_0x0fcf('0x39')][_0x0fcf('0x55')]({'where':{'id':_0x385059[_0x0fcf('0x53')]['id']}})['then'](handleEntityNotFound(_0x64befd,null))[_0x0fcf('0x30')](saveUpdates(_0x385059['body'],null))[_0x0fcf('0x30')](respondWithResult(_0x64befd,null))[_0x0fcf('0x23')](handleError(_0x64befd,null));};exports[_0x0fcf('0x31')]=function(_0x4911dd,_0x1362d7){return db[_0x0fcf('0x39')][_0x0fcf('0x55')]({'where':{'id':_0x4911dd[_0x0fcf('0x53')]['id']}})[_0x0fcf('0x30')](handleEntityNotFound(_0x1362d7,null))[_0x0fcf('0x30')](removeEntity(_0x1362d7,null))[_0x0fcf('0x23')](handleError(_0x1362d7,null));};exports[_0x0fcf('0x56')]=function(_0x206e2a,_0xb31736,_0x23909a){var _0x4c3625={};var _0x62d12e={};var _0x1dda2e;var _0x6af0f5;return db[_0x0fcf('0x39')][_0x0fcf('0x57')]({'where':{'id':_0x206e2a[_0x0fcf('0x53')]['id']}})[_0x0fcf('0x30')](handleEntityNotFound(_0xb31736,null))['then'](function(_0x4b01dc){if(_0x4b01dc){_0x1dda2e=_0x4b01dc;_0x62d12e[_0x0fcf('0x41')]=_[_0x0fcf('0x3f')](db['VtigerField'][_0x0fcf('0x3a')]);_0x62d12e[_0x0fcf('0x3e')]=_[_0x0fcf('0x3f')](_0x206e2a[_0x0fcf('0x3e')]);_0x62d12e['filters']=_[_0x0fcf('0x43')](_0x62d12e[_0x0fcf('0x41')],_0x62d12e[_0x0fcf('0x3e')]);_0x4c3625[_0x0fcf('0x42')]=_[_0x0fcf('0x43')](_0x62d12e[_0x0fcf('0x41')],qs['fields'](_0x206e2a[_0x0fcf('0x3e')][_0x0fcf('0x44')]));_0x4c3625[_0x0fcf('0x42')]=_0x4c3625[_0x0fcf('0x42')][_0x0fcf('0x45')]?_0x4c3625['attributes']:_0x62d12e['model'];_0x4c3625[_0x0fcf('0x58')]=qs[_0x0fcf('0x48')](_0x206e2a[_0x0fcf('0x3e')][_0x0fcf('0x48')]);_0x4c3625[_0x0fcf('0x49')]=qs[_0x0fcf('0x40')](_[_0x0fcf('0x4a')](_0x206e2a[_0x0fcf('0x3e')],_0x62d12e[_0x0fcf('0x40')]));if(_0x206e2a[_0x0fcf('0x3e')]['filter']){_0x4c3625[_0x0fcf('0x49')]=_[_0x0fcf('0x4c')](_0x4c3625[_0x0fcf('0x49')],{'$or':_[_0x0fcf('0x38')](_0x4c3625[_0x0fcf('0x42')],function(_0x20ca7f){var _0x21d767={};_0x21d767[_0x20ca7f]={'$like':'%'+_0x206e2a[_0x0fcf('0x3e')][_0x0fcf('0x4b')]+'%'};return _0x21d767;})});}_0x4c3625=_['merge']({},_0x4c3625,_0x206e2a['options']);return _0x1dda2e['getFields'](_0x4c3625);}})['then'](function(_0x7c1c74){if(_0x7c1c74){_0x6af0f5=_0x7c1c74['length'];if(!_0x206e2a[_0x0fcf('0x3e')][_0x0fcf('0x46')](_0x0fcf('0x47'))){_0x4c3625['limit']=qs['limit'](_0x206e2a[_0x0fcf('0x3e')][_0x0fcf('0x29')]);_0x4c3625['offset']=qs[_0x0fcf('0x27')](_0x206e2a[_0x0fcf('0x3e')]['offset']);}return _0x1dda2e[_0x0fcf('0x56')](_0x4c3625);}})[_0x0fcf('0x30')](function(_0x47438d){if(_0x47438d){return _0x47438d?{'count':_0x6af0f5,'rows':_0x47438d}:null;}})[_0x0fcf('0x30')](respondWithResult(_0xb31736,null))[_0x0fcf('0x23')](handleError(_0xb31736,null));};exports[_0x0fcf('0x59')]=function(_0x4704c9,_0x4b1f10,_0x3edb41){var _0x276e17={};var _0xb8a206={};var _0x41fcac;var _0x294504;return db[_0x0fcf('0x39')]['findOne']({'where':{'id':_0x4704c9['params']['id']}})[_0x0fcf('0x30')](handleEntityNotFound(_0x4b1f10,null))[_0x0fcf('0x30')](function(_0x28585d){if(_0x28585d){_0x41fcac=_0x28585d;_0xb8a206[_0x0fcf('0x41')]=_['keys'](db[_0x0fcf('0x5a')][_0x0fcf('0x3a')]);_0xb8a206[_0x0fcf('0x3e')]=_[_0x0fcf('0x3f')](_0x4704c9[_0x0fcf('0x3e')]);_0xb8a206['filters']=_['intersection'](_0xb8a206[_0x0fcf('0x41')],_0xb8a206['query']);_0x276e17[_0x0fcf('0x42')]=_['intersection'](_0xb8a206[_0x0fcf('0x41')],qs[_0x0fcf('0x44')](_0x4704c9[_0x0fcf('0x3e')][_0x0fcf('0x44')]));_0x276e17[_0x0fcf('0x42')]=_0x276e17['attributes'][_0x0fcf('0x45')]?_0x276e17[_0x0fcf('0x42')]:_0xb8a206[_0x0fcf('0x41')];_0x276e17[_0x0fcf('0x58')]=qs['sort'](_0x4704c9[_0x0fcf('0x3e')]['sort']);_0x276e17[_0x0fcf('0x49')]=qs['filters'](_[_0x0fcf('0x4a')](_0x4704c9[_0x0fcf('0x3e')],_0xb8a206['filters']));if(_0x4704c9[_0x0fcf('0x3e')][_0x0fcf('0x4b')]){_0x276e17[_0x0fcf('0x49')]=_['merge'](_0x276e17['where'],{'$or':_['map'](_0x276e17[_0x0fcf('0x42')],function(_0x5b3f34){var _0x3525e0={};_0x3525e0[_0x5b3f34]={'$like':'%'+_0x4704c9[_0x0fcf('0x3e')][_0x0fcf('0x4b')]+'%'};return _0x3525e0;})});}_0x276e17=_[_0x0fcf('0x4c')]({},_0x276e17,_0x4704c9[_0x0fcf('0x4e')]);return _0x41fcac[_0x0fcf('0x59')](_0x276e17);}})[_0x0fcf('0x30')](function(_0x344720){if(_0x344720){_0x294504=_0x344720[_0x0fcf('0x45')];if(!_0x4704c9['query'][_0x0fcf('0x46')](_0x0fcf('0x47'))){_0x276e17[_0x0fcf('0x29')]=qs[_0x0fcf('0x29')](_0x4704c9[_0x0fcf('0x3e')][_0x0fcf('0x29')]);_0x276e17[_0x0fcf('0x27')]=qs[_0x0fcf('0x27')](_0x4704c9['query'][_0x0fcf('0x27')]);}return _0x41fcac[_0x0fcf('0x59')](_0x276e17);}})[_0x0fcf('0x30')](function(_0xdaacde){if(_0xdaacde){return _0xdaacde?{'count':_0x294504,'rows':_0xdaacde}:null;}})[_0x0fcf('0x30')](respondWithResult(_0x4b1f10,null))[_0x0fcf('0x23')](handleError(_0x4b1f10,null));};exports[_0x0fcf('0x5b')]=function(_0x5d63f5,_0x2d9214,_0x489c6d){var _0x18645d={};var _0x9e933e={};var _0xc1bef9;var _0x4fe0a8;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5d63f5['params']['id']}})[_0x0fcf('0x30')](handleEntityNotFound(_0x2d9214,null))[_0x0fcf('0x30')](function(_0x1baeae){if(_0x1baeae){_0xc1bef9=_0x1baeae;_0x9e933e[_0x0fcf('0x41')]=_[_0x0fcf('0x3f')](db[_0x0fcf('0x5a')][_0x0fcf('0x3a')]);_0x9e933e[_0x0fcf('0x3e')]=_[_0x0fcf('0x3f')](_0x5d63f5[_0x0fcf('0x3e')]);_0x9e933e[_0x0fcf('0x40')]=_['intersection'](_0x9e933e[_0x0fcf('0x41')],_0x9e933e[_0x0fcf('0x3e')]);_0x18645d['attributes']=_[_0x0fcf('0x43')](_0x9e933e['model'],qs[_0x0fcf('0x44')](_0x5d63f5[_0x0fcf('0x3e')]['fields']));_0x18645d['attributes']=_0x18645d[_0x0fcf('0x42')][_0x0fcf('0x45')]?_0x18645d['attributes']:_0x9e933e[_0x0fcf('0x41')];_0x18645d[_0x0fcf('0x58')]=qs[_0x0fcf('0x48')](_0x5d63f5[_0x0fcf('0x3e')][_0x0fcf('0x48')]);_0x18645d[_0x0fcf('0x49')]=qs[_0x0fcf('0x40')](_[_0x0fcf('0x4a')](_0x5d63f5['query'],_0x9e933e[_0x0fcf('0x40')]));if(_0x5d63f5[_0x0fcf('0x3e')][_0x0fcf('0x4b')]){_0x18645d[_0x0fcf('0x49')]=_['merge'](_0x18645d[_0x0fcf('0x49')],{'$or':_['map'](_0x18645d['attributes'],function(_0x5cb3e8){var _0x31cabd={};_0x31cabd[_0x5cb3e8]={'$like':'%'+_0x5d63f5[_0x0fcf('0x3e')][_0x0fcf('0x4b')]+'%'};return _0x31cabd;})});}_0x18645d=_[_0x0fcf('0x4c')]({},_0x18645d,_0x5d63f5[_0x0fcf('0x4e')]);return _0xc1bef9[_0x0fcf('0x5b')](_0x18645d);}})[_0x0fcf('0x30')](function(_0x31b008){if(_0x31b008){_0x4fe0a8=_0x31b008[_0x0fcf('0x45')];if(!_0x5d63f5['query'][_0x0fcf('0x46')](_0x0fcf('0x47'))){_0x18645d[_0x0fcf('0x29')]=qs[_0x0fcf('0x29')](_0x5d63f5[_0x0fcf('0x3e')][_0x0fcf('0x29')]);_0x18645d[_0x0fcf('0x27')]=qs[_0x0fcf('0x27')](_0x5d63f5[_0x0fcf('0x3e')]['offset']);}return _0xc1bef9['getDescriptions'](_0x18645d);}})['then'](function(_0x34dbea){if(_0x34dbea){return _0x34dbea?{'count':_0x4fe0a8,'rows':_0x34dbea}:null;}})[_0x0fcf('0x30')](respondWithResult(_0x2d9214,null))[_0x0fcf('0x23')](handleError(_0x2d9214,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e0adee5..23bffa2 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5f1=['define','VtigerConfiguration','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x341a65,_0x4bef74){var _0x1c855f=function(_0x55ffdb){while(--_0x55ffdb){_0x341a65['push'](_0x341a65['shift']());}};_0x1c855f(++_0x4bef74);}(_0xe5f1,0x102));var _0x1e5f=function(_0x46eda8,_0x3e1a21){_0x46eda8=_0x46eda8-0x0;var _0x346fc7=_0xe5f1[_0x46eda8];return _0x346fc7;};'use strict';var _=require(_0x1e5f('0x0'));var util=require(_0x1e5f('0x1'));var logger=require('../../config/logger')(_0x1e5f('0x2'));var moment=require('moment');var BPromise=require(_0x1e5f('0x3'));var rp=require(_0x1e5f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e5f('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x328d03,_0x5d8056){return _0x328d03[_0x1e5f('0x6')](_0x1e5f('0x7'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4e1=['int_vtiger_configurations','lodash','util','api','moment','bluebird','path','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc4e1,0x1a3));var _0x1c4e=function(_0x4e9349,_0x4cff1d){_0x4e9349=_0x4e9349-0x0;var _0x23b38f=_0xc4e1[_0x4e9349];return _0x23b38f;};'use strict';var _=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var logger=require('../../config/logger')(_0x1c4e('0x2'));var moment=require(_0x1c4e('0x3'));var BPromise=require(_0x1c4e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c4e('0x5'));var rimraf=require('rimraf');var config=require(_0x1c4e('0x6'));var attributes=require(_0x1c4e('0x7'));module['exports']=function(_0x18a268,_0x500cc3){return _0x18a268[_0x1c4e('0x8')](_0x1c4e('0x9'),attributes,{'tableName':_0x1c4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 835f4e2..1ae3e84 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba3b=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash'];(function(_0x255b3d,_0xfd2ba9){var _0x911b51=function(_0x450fcb){while(--_0x450fcb){_0x255b3d['push'](_0x255b3d['shift']());}};_0x911b51(++_0xfd2ba9);}(_0xba3b,0x137));var _0xbba3=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xba3b[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xbba3('0x0'));var util=require(_0xbba3('0x1'));var moment=require(_0xbba3('0x2'));var BPromise=require(_0xbba3('0x3'));var rs=require(_0xbba3('0x4'));var fs=require('fs');var Redis=require(_0xbba3('0x5'));var db=require(_0xbba3('0x6'))['db'];var utils=require(_0xbba3('0x7'));var logger=require(_0xbba3('0x8'))('rpc');var config=require(_0xbba3('0x9'));var jayson=require(_0xbba3('0xa'));var client=jayson[_0xbba3('0xb')][_0xbba3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c7f01,_0x321dfa,_0x5a27eb){return new BPromise(function(_0x38f18e,_0x28bc47){return client[_0xbba3('0xd')](_0x2c7f01,_0x5a27eb)[_0xbba3('0xe')](function(_0x2e440e){logger[_0xbba3('0xf')](_0xbba3('0x10'),_0x321dfa,'request\x20sent');logger[_0xbba3('0x11')](_0xbba3('0x12'),_0x321dfa,_0xbba3('0x13'),JSON[_0xbba3('0x14')](_0x2e440e));if(_0x2e440e['error']){if(_0x2e440e['error'][_0xbba3('0x15')]===0x1f4){logger[_0xbba3('0x16')](_0xbba3('0x10'),_0x321dfa,_0x2e440e['error']['message']);return _0x28bc47(_0x2e440e['error'][_0xbba3('0x17')]);}logger['error'](_0xbba3('0x10'),_0x321dfa,_0x2e440e['error'][_0xbba3('0x17')]);return _0x38f18e(_0x2e440e[_0xbba3('0x16')][_0xbba3('0x17')]);}else{logger[_0xbba3('0xf')](_0xbba3('0x10'),_0x321dfa,_0xbba3('0x13'));_0x38f18e(_0x2e440e[_0xbba3('0x18')][_0xbba3('0x17')]);}})[_0xbba3('0x19')](function(_0x3aa250){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x321dfa,_0x3aa250);_0x28bc47(_0x3aa250);});});} \ No newline at end of file +var _0xb6b9=['../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','bluebird','randomstring','../../mysqldb'];(function(_0x4a4f5c,_0x31ed13){var _0x4b190a=function(_0x3e2545){while(--_0x3e2545){_0x4a4f5c['push'](_0x4a4f5c['shift']());}};_0x4b190a(++_0x31ed13);}(_0xb6b9,0x114));var _0x9b6b=function(_0x1c8125,_0x5146d3){_0x1c8125=_0x1c8125-0x0;var _0x369717=_0xb6b9[_0x1c8125];return _0x369717;};'use strict';var _=require('lodash');var util=require(_0x9b6b('0x0'));var moment=require('moment');var BPromise=require(_0x9b6b('0x1'));var rs=require(_0x9b6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b6b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b6b('0x4'))(_0x9b6b('0x5'));var config=require('../../config/environment');var jayson=require(_0x9b6b('0x6'));var client=jayson[_0x9b6b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b1075,_0x9c58ce,_0xcb2c47){return new BPromise(function(_0x2d38b5,_0xb7b6a0){return client[_0x9b6b('0x8')](_0x9b1075,_0xcb2c47)[_0x9b6b('0x9')](function(_0x2e0e15){logger[_0x9b6b('0xa')](_0x9b6b('0xb'),_0x9c58ce,'request\x20sent');logger[_0x9b6b('0xc')](_0x9b6b('0xd'),_0x9c58ce,_0x9b6b('0xe'),JSON[_0x9b6b('0xf')](_0x2e0e15));if(_0x2e0e15[_0x9b6b('0x10')]){if(_0x2e0e15[_0x9b6b('0x10')][_0x9b6b('0x11')]===0x1f4){logger[_0x9b6b('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x9c58ce,_0x2e0e15[_0x9b6b('0x10')][_0x9b6b('0x12')]);return _0xb7b6a0(_0x2e0e15[_0x9b6b('0x10')]['message']);}logger[_0x9b6b('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x9c58ce,_0x2e0e15[_0x9b6b('0x10')][_0x9b6b('0x12')]);return _0x2d38b5(_0x2e0e15[_0x9b6b('0x10')][_0x9b6b('0x12')]);}else{logger[_0x9b6b('0xa')](_0x9b6b('0xb'),_0x9c58ce,_0x9b6b('0xe'));_0x2d38b5(_0x2e0e15['result'][_0x9b6b('0x12')]);}})[_0x9b6b('0x13')](function(_0x1f7239){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x9c58ce,_0x1f7239);_0xb7b6a0(_0x1f7239);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 25cd29b..c3088d9 100644 --- a/server/api/intVtigerField/index.js +++ b/server/api/intVtigerField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x267ae4,_0x58c7cf){var _0x519990=function(_0x42b0f3){while(--_0x42b0f3){_0x267ae4['push'](_0x267ae4['shift']());}};_0x519990(++_0x58c7cf);}(_0xadb5,0xad));var _0x5adb=function(_0x7525b1,_0x27c5f3){_0x7525b1=_0x7525b1-0x0;var _0x4dd162=_0xadb5[_0x7525b1];return _0x4dd162;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intVtigerField.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0xc')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['delete']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);module[_0x5adb('0x11')]=router; \ No newline at end of file +var _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x1261,0x144));var _0x1126=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x1261[_0x2e3107];return _0x833d69;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0xf')]);router['put'](_0x1126('0x10'),auth[_0x1126('0xc')](),controller[_0x1126('0x11')]);router['delete'](_0x1126('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1126('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d53231c..73abae2 100644 --- a/server/api/intVtigerField/intVtigerField.attributes.js +++ b/server/api/intVtigerField/intVtigerField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19ea=['variable','BOOLEAN','sequelize','string','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x388ac2,_0x3ede4f){var _0x20aa72=function(_0x163ea0){while(--_0x163ea0){_0x388ac2['push'](_0x388ac2['shift']());}};_0x20aa72(++_0x3ede4f);}(_0x19ea,0xfe));var _0xa19e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x19ea[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0xa19e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa19e('0x1'),'variable',_0xa19e('0x2'),_0xa19e('0x3'),_0xa19e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa19e('0x5')]},'keyType':{'type':Sequelize[_0xa19e('0x6')](_0xa19e('0x1'),_0xa19e('0x7'),_0xa19e('0x2'))},'keyContent':{'type':Sequelize[_0xa19e('0x5')]},'idField':{'type':Sequelize[_0xa19e('0x5')]},'nameField':{'type':Sequelize[_0xa19e('0x5')]},'customField':{'type':Sequelize[_0xa19e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa19e('0x5')]}}; \ No newline at end of file +var _0xe600=['ENUM','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x8d85bf,_0x4238c2){var _0x3d1203=function(_0x39e7d0){while(--_0x39e7d0){_0x8d85bf['push'](_0x8d85bf['shift']());}};_0x3d1203(++_0x4238c2);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x0e60('0x0')]={'type':{'type':Sequelize['ENUM'](_0x0e60('0x1'),_0x0e60('0x2'),_0x0e60('0x3'),_0x0e60('0x4'),_0x0e60('0x5')),'defaultValue':_0x0e60('0x1')},'content':{'type':Sequelize[_0x0e60('0x6')]},'key':{'type':Sequelize[_0x0e60('0x6')]},'keyType':{'type':Sequelize[_0x0e60('0x7')](_0x0e60('0x1'),'variable',_0x0e60('0x3'))},'keyContent':{'type':Sequelize[_0x0e60('0x6')]},'idField':{'type':Sequelize[_0x0e60('0x6')]},'nameField':{'type':Sequelize[_0x0e60('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e60('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index de5cca5..7b2091c 100644 --- a/server/api/intVtigerField/intVtigerField.controller.js +++ b/server/api/intVtigerField/intVtigerField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3241=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','VtigerField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x22b6d3,_0xf5a930){var _0x316caa=function(_0x3d5f19){while(--_0x3d5f19){_0x22b6d3['push'](_0x22b6d3['shift']());}};_0x316caa(++_0xf5a930);}(_0x3241,0x1d8));var _0x1324=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3241[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1324('0x0'));var rimraf=require(_0x1324('0x1'));var zipdir=require(_0x1324('0x2'));var jsonpatch=require(_0x1324('0x3'));var rp=require(_0x1324('0x4'));var moment=require(_0x1324('0x5'));var BPromise=require(_0x1324('0x6'));var Mustache=require(_0x1324('0x7'));var util=require(_0x1324('0x8'));var path=require(_0x1324('0x9'));var sox=require(_0x1324('0xa'));var csv=require(_0x1324('0xb'));var ejs=require(_0x1324('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1324('0xd'));var squel=require(_0x1324('0xe'));var crypto=require(_0x1324('0xf'));var jsforce=require(_0x1324('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1324('0xb'));var querystring=require(_0x1324('0x11'));var Papa=require(_0x1324('0x12'));var Redis=require(_0x1324('0x13'));var authService=require(_0x1324('0x14'));var qs=require(_0x1324('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1324('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1324('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1324('0x18'));var db=require(_0x1324('0x19'))['db'];function respondWithStatusCode(_0x1beccf,_0x1eeca4){_0x1eeca4=_0x1eeca4||0xcc;return function(_0x82fccc){if(_0x82fccc){return _0x1beccf[_0x1324('0x1a')](_0x1eeca4);}return _0x1beccf['status'](_0x1eeca4)['end']();};}function respondWithResult(_0x5c2ff2,_0x1fbde9){_0x1fbde9=_0x1fbde9||0xc8;return function(_0x1b352a){if(_0x1b352a){return _0x5c2ff2[_0x1324('0x1b')](_0x1fbde9)[_0x1324('0x1c')](_0x1b352a);}};}function respondWithFilteredResult(_0x488742,_0x345742){return function(_0x43e767){if(_0x43e767){var _0xcf7dd8=typeof _0x345742[_0x1324('0x1d')]===_0x1324('0x1e')&&typeof _0x345742[_0x1324('0x1f')]===_0x1324('0x1e');var _0x540ac1=_0x43e767['count'];var _0x163b96=_0xcf7dd8?0x0:_0x345742[_0x1324('0x1d')];var _0xc9d037=_0xcf7dd8?_0x43e767[_0x1324('0x20')]:_0x345742[_0x1324('0x1d')]+_0x345742['limit'];var _0x38d30e;if(_0xc9d037>=_0x540ac1){_0xc9d037=_0x540ac1;_0x38d30e=0xc8;}else{_0x38d30e=0xce;}_0x488742[_0x1324('0x1b')](_0x38d30e);return _0x488742[_0x1324('0x21')](_0x1324('0x22'),_0x163b96+'-'+_0xc9d037+'/'+_0x540ac1)[_0x1324('0x1c')](_0x43e767);}return null;};}function patchUpdates(_0x58368d){return function(_0x2da8af){try{jsonpatch[_0x1324('0x23')](_0x2da8af,_0x58368d,!![]);}catch(_0x250d2f){return BPromise[_0x1324('0x24')](_0x250d2f);}return _0x2da8af['save']();};}function saveUpdates(_0x50367d,_0xaeffd0){return function(_0xa8f10){if(_0xa8f10){return _0xa8f10[_0x1324('0x25')](_0x50367d)['then'](function(_0xc8266){return _0xc8266;});}return null;};}function removeEntity(_0x540cd2,_0x5cc758){return function(_0x12209a){if(_0x12209a){return _0x12209a[_0x1324('0x26')]()[_0x1324('0x27')](function(){_0x540cd2['status'](0xcc)[_0x1324('0x28')]();});}};}function handleEntityNotFound(_0x360b19,_0x2de10f){return function(_0xe57b61){if(!_0xe57b61){_0x360b19[_0x1324('0x1a')](0x194);}return _0xe57b61;};}function handleError(_0x456d87,_0x5d6269){_0x5d6269=_0x5d6269||0x1f4;return function(_0x4ba4ff){logger[_0x1324('0x29')](_0x4ba4ff[_0x1324('0x2a')]);if(_0x4ba4ff[_0x1324('0x2b')]){delete _0x4ba4ff[_0x1324('0x2b')];}_0x456d87['status'](_0x5d6269)[_0x1324('0x2c')](_0x4ba4ff);};}function getMustacheRender(_0x36a133,_0x53de74){return Mustache[_0x1324('0x2d')](_0x36a133,_[_0x1324('0x2e')](_0x53de74[_0x1324('0x2f')],{'contact':_0x53de74[_0x1324('0x30')],'message':_0x53de74[_0x1324('0x31')],'agent':_0x53de74['agent'],'interaction':_0x53de74[_0x1324('0x32')],'account':_0x53de74[_0x1324('0x33')]}))||'';}exports[_0x1324('0x34')]=function(_0xd4bc37,_0x1f1b8c){var _0x383b18={},_0xf4421a={},_0x3791d6={'count':0x0,'rows':[]};var _0x3e5ae4=_[_0x1324('0x35')](db[_0x1324('0x36')][_0x1324('0x37')],function(_0x5173f3){return{'name':_0x5173f3[_0x1324('0x38')],'type':_0x5173f3[_0x1324('0x39')]['key']};});_0xf4421a['model']=_[_0x1324('0x35')](_0x3e5ae4,_0x1324('0x2b'));_0xf4421a[_0x1324('0x3a')]=_[_0x1324('0x3b')](_0xd4bc37[_0x1324('0x3a')]);_0xf4421a[_0x1324('0x3c')]=_[_0x1324('0x3d')](_0xf4421a[_0x1324('0x3e')],_0xf4421a['query']);_0x383b18[_0x1324('0x3f')]=_[_0x1324('0x3d')](_0xf4421a['model'],qs[_0x1324('0x40')](_0xd4bc37[_0x1324('0x3a')][_0x1324('0x40')]));_0x383b18[_0x1324('0x3f')]=_0x383b18['attributes'][_0x1324('0x41')]?_0x383b18[_0x1324('0x3f')]:_0xf4421a[_0x1324('0x3e')];if(!_0xd4bc37[_0x1324('0x3a')][_0x1324('0x42')](_0x1324('0x43'))){_0x383b18[_0x1324('0x1f')]=qs['limit'](_0xd4bc37[_0x1324('0x3a')][_0x1324('0x1f')]);_0x383b18[_0x1324('0x1d')]=qs[_0x1324('0x1d')](_0xd4bc37[_0x1324('0x3a')]['offset']);}_0x383b18[_0x1324('0x44')]=qs[_0x1324('0x45')](_0xd4bc37[_0x1324('0x3a')][_0x1324('0x45')]);_0x383b18[_0x1324('0x46')]=qs[_0x1324('0x3c')](_[_0x1324('0x47')](_0xd4bc37[_0x1324('0x3a')],_0xf4421a['filters']),_0x3e5ae4);if(_0xd4bc37[_0x1324('0x3a')][_0x1324('0x48')]){_0x383b18[_0x1324('0x46')]=_[_0x1324('0x2e')](_0x383b18[_0x1324('0x46')],{'$or':_['map'](_0x3e5ae4,function(_0xf83e3e){if(_0xf83e3e[_0x1324('0x39')]!==_0x1324('0x49')){var _0x299dcf={};_0x299dcf[_0xf83e3e[_0x1324('0x2b')]]={'$like':'%'+_0xd4bc37[_0x1324('0x3a')][_0x1324('0x48')]+'%'};return _0x299dcf;}})});}_0x383b18=_[_0x1324('0x2e')]({},_0x383b18,_0xd4bc37[_0x1324('0x4a')]);var _0x2ed1f8={'where':_0x383b18[_0x1324('0x46')]};return db[_0x1324('0x36')][_0x1324('0x20')](_0x2ed1f8)[_0x1324('0x27')](function(_0xc26545){_0x3791d6[_0x1324('0x20')]=_0xc26545;if(_0xd4bc37[_0x1324('0x3a')]['includeAll']){_0x383b18[_0x1324('0x4b')]=[{'all':!![]}];}return db[_0x1324('0x36')]['findAll'](_0x383b18);})['then'](function(_0x675a59){_0x3791d6[_0x1324('0x4c')]=_0x675a59;return _0x3791d6;})[_0x1324('0x27')](respondWithFilteredResult(_0x1f1b8c,_0x383b18))[_0x1324('0x4d')](handleError(_0x1f1b8c,null));};exports[_0x1324('0x4e')]=function(_0x2181ea,_0x138f71){var _0x261429={'raw':!![],'where':{'id':_0x2181ea[_0x1324('0x4f')]['id']}},_0x64f0b6={};_0x64f0b6[_0x1324('0x3e')]=_['keys'](db[_0x1324('0x36')][_0x1324('0x37')]);_0x64f0b6[_0x1324('0x3a')]=_[_0x1324('0x3b')](_0x2181ea[_0x1324('0x3a')]);_0x64f0b6['filters']=_['intersection'](_0x64f0b6[_0x1324('0x3e')],_0x64f0b6['query']);_0x261429[_0x1324('0x3f')]=_[_0x1324('0x3d')](_0x64f0b6[_0x1324('0x3e')],qs[_0x1324('0x40')](_0x2181ea['query'][_0x1324('0x40')]));_0x261429[_0x1324('0x3f')]=_0x261429[_0x1324('0x3f')][_0x1324('0x41')]?_0x261429[_0x1324('0x3f')]:_0x64f0b6[_0x1324('0x3e')];if(_0x2181ea[_0x1324('0x3a')][_0x1324('0x50')]){_0x261429[_0x1324('0x4b')]=[{'all':!![]}];}_0x261429=_[_0x1324('0x2e')]({},_0x261429,_0x2181ea[_0x1324('0x4a')]);return db[_0x1324('0x36')][_0x1324('0x51')](_0x261429)[_0x1324('0x27')](handleEntityNotFound(_0x138f71,null))[_0x1324('0x27')](respondWithResult(_0x138f71,null))[_0x1324('0x4d')](handleError(_0x138f71,null));};exports[_0x1324('0x52')]=function(_0x17b060,_0x3cf8f5){return db[_0x1324('0x36')][_0x1324('0x52')](_0x17b060[_0x1324('0x2f')],{})[_0x1324('0x27')](respondWithResult(_0x3cf8f5,0xc9))[_0x1324('0x4d')](handleError(_0x3cf8f5,null));};exports[_0x1324('0x25')]=function(_0x3b9065,_0x22dc56){if(_0x3b9065[_0x1324('0x2f')]['id']){delete _0x3b9065[_0x1324('0x2f')]['id'];}return db[_0x1324('0x36')][_0x1324('0x51')]({'where':{'id':_0x3b9065[_0x1324('0x4f')]['id']}})[_0x1324('0x27')](handleEntityNotFound(_0x22dc56,null))[_0x1324('0x27')](saveUpdates(_0x3b9065['body'],null))[_0x1324('0x27')](respondWithResult(_0x22dc56,null))[_0x1324('0x4d')](handleError(_0x22dc56,null));};exports['destroy']=function(_0x3f80f9,_0x485f88){return db[_0x1324('0x36')][_0x1324('0x51')]({'where':{'id':_0x3f80f9[_0x1324('0x4f')]['id']}})[_0x1324('0x27')](handleEntityNotFound(_0x485f88,null))[_0x1324('0x27')](removeEntity(_0x485f88,null))[_0x1324('0x4d')](handleError(_0x485f88,null));}; \ No newline at end of file +var _0x4de9=['request-promise','moment','mustache','to-csv','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','name','send','render','merge','body','contact','message','agent','interaction','account','map','VtigerField','rawAttributes','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','includeAll','findAll','rows','catch','show','keys','include','options','create','find','params','destroy','rimraf','fast-json-patch'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0x4de9,0x12a));var _0x94de=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x4de9[_0x7ad123];return _0x37d073;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94de('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94de('0x1'));var rp=require(_0x94de('0x2'));var moment=require(_0x94de('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x94de('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x94de('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94de('0x6'));var _=require(_0x94de('0x7'));var squel=require('squel');var crypto=require(_0x94de('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x94de('0x9'));var Papa=require('papaparse');var Redis=require(_0x94de('0xa'));var authService=require(_0x94de('0xb'));var qs=require(_0x94de('0xc'));var as=require(_0x94de('0xd'));var hardwareService=require(_0x94de('0xe'));var logger=require(_0x94de('0xf'))(_0x94de('0x10'));var utils=require(_0x94de('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x94de('0x12'));var db=require(_0x94de('0x13'))['db'];function respondWithStatusCode(_0x5c1016,_0x131d7c){_0x131d7c=_0x131d7c||0xcc;return function(_0x560d6a){if(_0x560d6a){return _0x5c1016[_0x94de('0x14')](_0x131d7c);}return _0x5c1016['status'](_0x131d7c)[_0x94de('0x15')]();};}function respondWithResult(_0x2069c6,_0x54d554){_0x54d554=_0x54d554||0xc8;return function(_0x106a8a){if(_0x106a8a){return _0x2069c6[_0x94de('0x16')](_0x54d554)[_0x94de('0x17')](_0x106a8a);}};}function respondWithFilteredResult(_0x46ef82,_0x515bfd){return function(_0x3e1d7c){if(_0x3e1d7c){var _0x3c1d9d=typeof _0x515bfd[_0x94de('0x18')]==='undefined'&&typeof _0x515bfd[_0x94de('0x19')]===_0x94de('0x1a');var _0x545baf=_0x3e1d7c[_0x94de('0x1b')];var _0x16fb2c=_0x3c1d9d?0x0:_0x515bfd[_0x94de('0x18')];var _0x5860af=_0x3c1d9d?_0x3e1d7c[_0x94de('0x1b')]:_0x515bfd[_0x94de('0x18')]+_0x515bfd[_0x94de('0x19')];var _0x5d3f83;if(_0x5860af>=_0x545baf){_0x5860af=_0x545baf;_0x5d3f83=0xc8;}else{_0x5d3f83=0xce;}_0x46ef82[_0x94de('0x16')](_0x5d3f83);return _0x46ef82[_0x94de('0x1c')](_0x94de('0x1d'),_0x16fb2c+'-'+_0x5860af+'/'+_0x545baf)[_0x94de('0x17')](_0x3e1d7c);}return null;};}function patchUpdates(_0x3f2e60){return function(_0x588ca4){try{jsonpatch[_0x94de('0x1e')](_0x588ca4,_0x3f2e60,!![]);}catch(_0x5a1d59){return BPromise[_0x94de('0x1f')](_0x5a1d59);}return _0x588ca4['save']();};}function saveUpdates(_0x4b790a,_0x17524f){return function(_0x46db52){if(_0x46db52){return _0x46db52[_0x94de('0x20')](_0x4b790a)[_0x94de('0x21')](function(_0xe25595){return _0xe25595;});}return null;};}function removeEntity(_0x396941,_0x4d82a1){return function(_0x1958a2){if(_0x1958a2){return _0x1958a2['destroy']()['then'](function(){_0x396941[_0x94de('0x16')](0xcc)[_0x94de('0x15')]();});}};}function handleEntityNotFound(_0x6ae596,_0x1ea1e8){return function(_0x367094){if(!_0x367094){_0x6ae596['sendStatus'](0x194);}return _0x367094;};}function handleError(_0x201301,_0x29f83f){_0x29f83f=_0x29f83f||0x1f4;return function(_0x3240a2){logger[_0x94de('0x22')](_0x3240a2['stack']);if(_0x3240a2[_0x94de('0x23')]){delete _0x3240a2[_0x94de('0x23')];}_0x201301[_0x94de('0x16')](_0x29f83f)[_0x94de('0x24')](_0x3240a2);};}function getMustacheRender(_0x373748,_0x3efacd){return Mustache[_0x94de('0x25')](_0x373748,_[_0x94de('0x26')](_0x3efacd[_0x94de('0x27')],{'contact':_0x3efacd[_0x94de('0x28')],'message':_0x3efacd[_0x94de('0x29')],'agent':_0x3efacd[_0x94de('0x2a')],'interaction':_0x3efacd[_0x94de('0x2b')],'account':_0x3efacd[_0x94de('0x2c')]}))||'';}exports['index']=function(_0x2549ec,_0x5648f9){var _0x18a486={},_0x304534={},_0x1577d6={'count':0x0,'rows':[]};var _0x1ddd42=_[_0x94de('0x2d')](db[_0x94de('0x2e')][_0x94de('0x2f')],function(_0x21013a){return{'name':_0x21013a['fieldName'],'type':_0x21013a[_0x94de('0x30')][_0x94de('0x31')]};});_0x304534[_0x94de('0x32')]=_[_0x94de('0x2d')](_0x1ddd42,_0x94de('0x23'));_0x304534['query']=_['keys'](_0x2549ec['query']);_0x304534[_0x94de('0x33')]=_[_0x94de('0x34')](_0x304534[_0x94de('0x32')],_0x304534[_0x94de('0x35')]);_0x18a486['attributes']=_[_0x94de('0x34')](_0x304534[_0x94de('0x32')],qs[_0x94de('0x36')](_0x2549ec[_0x94de('0x35')][_0x94de('0x36')]));_0x18a486[_0x94de('0x37')]=_0x18a486[_0x94de('0x37')][_0x94de('0x38')]?_0x18a486[_0x94de('0x37')]:_0x304534['model'];if(!_0x2549ec[_0x94de('0x35')][_0x94de('0x39')](_0x94de('0x3a'))){_0x18a486[_0x94de('0x19')]=qs[_0x94de('0x19')](_0x2549ec['query']['limit']);_0x18a486[_0x94de('0x18')]=qs[_0x94de('0x18')](_0x2549ec[_0x94de('0x35')]['offset']);}_0x18a486[_0x94de('0x3b')]=qs[_0x94de('0x3c')](_0x2549ec[_0x94de('0x35')][_0x94de('0x3c')]);_0x18a486[_0x94de('0x3d')]=qs['filters'](_['pick'](_0x2549ec[_0x94de('0x35')],_0x304534[_0x94de('0x33')]),_0x1ddd42);if(_0x2549ec['query'][_0x94de('0x3e')]){_0x18a486[_0x94de('0x3d')]=_[_0x94de('0x26')](_0x18a486[_0x94de('0x3d')],{'$or':_['map'](_0x1ddd42,function(_0x695159){if(_0x695159[_0x94de('0x30')]!=='VIRTUAL'){var _0x4b420e={};_0x4b420e[_0x695159[_0x94de('0x23')]]={'$like':'%'+_0x2549ec[_0x94de('0x35')][_0x94de('0x3e')]+'%'};return _0x4b420e;}})});}_0x18a486=_[_0x94de('0x26')]({},_0x18a486,_0x2549ec['options']);var _0x54f3e6={'where':_0x18a486['where']};return db[_0x94de('0x2e')]['count'](_0x54f3e6)[_0x94de('0x21')](function(_0x274189){_0x1577d6[_0x94de('0x1b')]=_0x274189;if(_0x2549ec[_0x94de('0x35')][_0x94de('0x3f')]){_0x18a486['include']=[{'all':!![]}];}return db[_0x94de('0x2e')][_0x94de('0x40')](_0x18a486);})[_0x94de('0x21')](function(_0x53c428){_0x1577d6[_0x94de('0x41')]=_0x53c428;return _0x1577d6;})[_0x94de('0x21')](respondWithFilteredResult(_0x5648f9,_0x18a486))[_0x94de('0x42')](handleError(_0x5648f9,null));};exports[_0x94de('0x43')]=function(_0x50ff7a,_0x5ee243){var _0x159cc6={'raw':!![],'where':{'id':_0x50ff7a['params']['id']}},_0x20760a={};_0x20760a[_0x94de('0x32')]=_[_0x94de('0x44')](db[_0x94de('0x2e')][_0x94de('0x2f')]);_0x20760a[_0x94de('0x35')]=_[_0x94de('0x44')](_0x50ff7a['query']);_0x20760a[_0x94de('0x33')]=_[_0x94de('0x34')](_0x20760a['model'],_0x20760a[_0x94de('0x35')]);_0x159cc6['attributes']=_['intersection'](_0x20760a[_0x94de('0x32')],qs['fields'](_0x50ff7a['query'][_0x94de('0x36')]));_0x159cc6['attributes']=_0x159cc6[_0x94de('0x37')][_0x94de('0x38')]?_0x159cc6['attributes']:_0x20760a[_0x94de('0x32')];if(_0x50ff7a[_0x94de('0x35')][_0x94de('0x3f')]){_0x159cc6[_0x94de('0x45')]=[{'all':!![]}];}_0x159cc6=_[_0x94de('0x26')]({},_0x159cc6,_0x50ff7a[_0x94de('0x46')]);return db[_0x94de('0x2e')]['find'](_0x159cc6)[_0x94de('0x21')](handleEntityNotFound(_0x5ee243,null))[_0x94de('0x21')](respondWithResult(_0x5ee243,null))[_0x94de('0x42')](handleError(_0x5ee243,null));};exports[_0x94de('0x47')]=function(_0x2c378a,_0x5640c6){return db[_0x94de('0x2e')][_0x94de('0x47')](_0x2c378a['body'],{})[_0x94de('0x21')](respondWithResult(_0x5640c6,0xc9))[_0x94de('0x42')](handleError(_0x5640c6,null));};exports[_0x94de('0x20')]=function(_0x1ef790,_0x5b3b19){if(_0x1ef790[_0x94de('0x27')]['id']){delete _0x1ef790[_0x94de('0x27')]['id'];}return db['VtigerField'][_0x94de('0x48')]({'where':{'id':_0x1ef790[_0x94de('0x49')]['id']}})['then'](handleEntityNotFound(_0x5b3b19,null))[_0x94de('0x21')](saveUpdates(_0x1ef790[_0x94de('0x27')],null))['then'](respondWithResult(_0x5b3b19,null))[_0x94de('0x42')](handleError(_0x5b3b19,null));};exports[_0x94de('0x4a')]=function(_0x29b4f3,_0x43857d){return db[_0x94de('0x2e')][_0x94de('0x48')]({'where':{'id':_0x29b4f3[_0x94de('0x49')]['id']}})[_0x94de('0x21')](handleEntityNotFound(_0x43857d,null))[_0x94de('0x21')](removeEntity(_0x43857d,null))[_0x94de('0x42')](handleError(_0x43857d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 82f45df..86c8c50 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x58d025,_0xc33b35){var _0x5478e8=function(_0x2c0423){while(--_0x2c0423){_0x58d025['push'](_0x58d025['shift']());}};_0x5478e8(++_0xc33b35);}(_0x7a54,0x106));var _0x47a5=function(_0x3f7dfd,_0x3d3634){_0x3f7dfd=_0x3f7dfd-0x0;var _0x48f43f=_0x7a54[_0x3f7dfd];return _0x48f43f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x54c8c3,_0x248d11){var _0x44a319=function(_0x346fdd){while(--_0x346fdd){_0x54c8c3['push'](_0x54c8c3['shift']());}};_0x44a319(++_0x248d11);}(_0x7a54,0x106));var _0x47a5=function(_0x1eaea6,_0x52c937){_0x1eaea6=_0x1eaea6-0x0;var _0x3bbc44=_0x7a54[_0x1eaea6];return _0x3bbc44;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index e5a4a1e..31d54d9 100644 --- a/server/api/intVtigerField/intVtigerField.rpc.js +++ b/server/api/intVtigerField/intVtigerField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1aa=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xe1aa,0xfc));var _0xae1a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe1aa[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xae1a('0x2'));var fs=require('fs');var Redis=require(_0xae1a('0x3'));var db=require(_0xae1a('0x4'))['db'];var utils=require(_0xae1a('0x5'));var logger=require(_0xae1a('0x6'))('rpc');var config=require(_0xae1a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xae1a('0x8')][_0xae1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5efd03,_0x5c11d7,_0x288c00){return new BPromise(function(_0x156a91,_0x5df7ee){return client[_0xae1a('0xa')](_0x5efd03,_0x288c00)[_0xae1a('0xb')](function(_0x47d3f6){logger[_0xae1a('0xc')](_0xae1a('0xd'),_0x5c11d7,_0xae1a('0xe'));logger[_0xae1a('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5c11d7,_0xae1a('0xe'),JSON[_0xae1a('0x10')](_0x47d3f6));if(_0x47d3f6['error']){if(_0x47d3f6[_0xae1a('0x11')][_0xae1a('0x12')]===0x1f4){logger[_0xae1a('0x11')](_0xae1a('0xd'),_0x5c11d7,_0x47d3f6[_0xae1a('0x11')][_0xae1a('0x13')]);return _0x5df7ee(_0x47d3f6[_0xae1a('0x11')][_0xae1a('0x13')]);}logger[_0xae1a('0x11')](_0xae1a('0xd'),_0x5c11d7,_0x47d3f6['error']['message']);return _0x156a91(_0x47d3f6['error']['message']);}else{logger[_0xae1a('0xc')](_0xae1a('0xd'),_0x5c11d7,_0xae1a('0xe'));_0x156a91(_0x47d3f6[_0xae1a('0x14')][_0xae1a('0x13')]);}})['catch'](function(_0x1cf96d){logger[_0xae1a('0x11')]('VtigerField,\x20%s,\x20%s',_0x5c11d7,_0x1cf96d);_0x5df7ee(_0x1cf96d);});});} \ No newline at end of file +var _0x3176=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3176,0x1d8));var _0x6317=function(_0x30e8c0,_0x927fc9){_0x30e8c0=_0x30e8c0-0x0;var _0x4407db=_0x3176[_0x30e8c0];return _0x4407db;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var moment=require(_0x6317('0x2'));var BPromise=require(_0x6317('0x3'));var rs=require(_0x6317('0x4'));var fs=require('fs');var Redis=require(_0x6317('0x5'));var db=require(_0x6317('0x6'))['db'];var utils=require(_0x6317('0x7'));var logger=require(_0x6317('0x8'))(_0x6317('0x9'));var config=require(_0x6317('0xa'));var jayson=require(_0x6317('0xb'));var client=jayson[_0x6317('0xc')][_0x6317('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1c95dc,_0x2275a4,_0x4afa7d){return new BPromise(function(_0x25c09c,_0x2fa3c3){return client[_0x6317('0xe')](_0x1c95dc,_0x4afa7d)['then'](function(_0x25abc7){logger['info']('VtigerField,\x20%s,\x20%s',_0x2275a4,_0x6317('0xf'));logger[_0x6317('0x10')](_0x6317('0x11'),_0x2275a4,_0x6317('0xf'),JSON[_0x6317('0x12')](_0x25abc7));if(_0x25abc7['error']){if(_0x25abc7[_0x6317('0x13')][_0x6317('0x14')]===0x1f4){logger['error'](_0x6317('0x15'),_0x2275a4,_0x25abc7[_0x6317('0x13')]['message']);return _0x2fa3c3(_0x25abc7[_0x6317('0x13')][_0x6317('0x16')]);}logger['error'](_0x6317('0x15'),_0x2275a4,_0x25abc7[_0x6317('0x13')][_0x6317('0x16')]);return _0x25c09c(_0x25abc7[_0x6317('0x13')][_0x6317('0x16')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x2275a4,'request\x20sent');_0x25c09c(_0x25abc7[_0x6317('0x17')]['message']);}})['catch'](function(_0x24f67e){logger['error']('VtigerField,\x20%s,\x20%s',_0x2275a4,_0x24f67e);_0x2fa3c3(_0x24f67e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e9b3c95..ffc9f16 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafdd=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x6f39eb,_0x380120){var _0x4d1a03=function(_0x587cd5){while(--_0x587cd5){_0x6f39eb['push'](_0x6f39eb['shift']());}};_0x4d1a03(++_0x380120);}(_0xafdd,0x19a));var _0xdafd=function(_0x37923c,_0x4cf826){_0x37923c=_0x37923c-0x0;var _0x303420=_0xafdd[_0x37923c];return _0x303420;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var fs_extra=require(_0xdafd('0x6'));var auth=require(_0xdafd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdafd('0x8'));var controller=require(_0xdafd('0x9'));router[_0xdafd('0xa')]('/',auth[_0xdafd('0xb')](),controller[_0xdafd('0xc')]);router[_0xdafd('0xa')](_0xdafd('0xd'),auth['isAuthenticated'](),controller[_0xdafd('0xe')]);router[_0xdafd('0xa')](_0xdafd('0xf'),auth['isAuthenticated'](),controller[_0xdafd('0x10')]);router[_0xdafd('0xa')](_0xdafd('0x11'),auth[_0xdafd('0xb')](),controller['getFields']);router[_0xdafd('0x12')]('/',auth[_0xdafd('0xb')](),controller[_0xdafd('0x13')]);router[_0xdafd('0x12')](_0xdafd('0xf'),auth[_0xdafd('0xb')](),controller['addConfiguration']);router[_0xdafd('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xdafd('0x15')]);router[_0xdafd('0x16')]('/:id',auth[_0xdafd('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdb2a=['/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations'];(function(_0x466186,_0x2276fb){var _0x1ee9af=function(_0x5dd5f0){while(--_0x5dd5f0){_0x466186['push'](_0x466186['shift']());}};_0x1ee9af(++_0x2276fb);}(_0xdb2a,0x16f));var _0xadb2=function(_0x1059c8,_0x513ed5){_0x1059c8=_0x1059c8-0x0;var _0x380cc7=_0xdb2a[_0x1059c8];return _0x380cc7;};'use strict';var multer=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var path=require(_0xadb2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xadb2('0x3')]();var fs_extra=require(_0xadb2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadb2('0x5'));var config=require('../../config/environment');var controller=require(_0xadb2('0x6'));router[_0xadb2('0x7')]('/',auth[_0xadb2('0x8')](),controller[_0xadb2('0x9')]);router[_0xadb2('0x7')]('/:id',auth[_0xadb2('0x8')](),controller['show']);router[_0xadb2('0x7')](_0xadb2('0xa'),auth[_0xadb2('0x8')](),controller['getConfigurations']);router[_0xadb2('0x7')](_0xadb2('0xb'),auth[_0xadb2('0x8')](),controller['getFields']);router[_0xadb2('0xc')]('/',auth['isAuthenticated'](),controller[_0xadb2('0xd')]);router['post']('/:id/configurations',auth[_0xadb2('0x8')](),controller[_0xadb2('0xe')]);router[_0xadb2('0xf')](_0xadb2('0x10'),auth['isAuthenticated'](),controller[_0xadb2('0x11')]);router[_0xadb2('0x12')](_0xadb2('0x10'),auth[_0xadb2('0x8')](),controller[_0xadb2('0x13')]);module[_0xadb2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5dddcf8..b44449e 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.attributes.js +++ b/server/api/intZendeskAccount/intZendeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31ef=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x31ef,0x17c));var _0xf31e=function(_0x57467e,_0x47b9e4){_0x57467e=_0x57467e-0x0;var _0x324dfd=_0x31ef[_0x57467e];return _0x324dfd;};'use strict';var Sequelize=require(_0xf31e('0x0'));module[_0xf31e('0x1')]={'name':{'type':Sequelize[_0xf31e('0x2')]},'description':{'type':Sequelize[_0xf31e('0x2')]},'username':{'type':Sequelize[_0xf31e('0x2')],'unique':_0xf31e('0x3')},'password':{'type':Sequelize[_0xf31e('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf31e('0x2')],'unique':_0xf31e('0x4')},'authType':{'type':Sequelize[_0xf31e('0x5')](_0xf31e('0x6'),_0xf31e('0x7')),'defaultValue':_0xf31e('0x6')},'serverUrl':{'type':Sequelize[_0xf31e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf31e('0x8'),_0xf31e('0x9')),'defaultValue':_0xf31e('0x8')}}; \ No newline at end of file +var _0xf87a=['password','token','integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xf87a,0x109));var _0xaf87=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf87a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xaf87('0x0'));module[_0xaf87('0x1')]={'name':{'type':Sequelize[_0xaf87('0x2')]},'description':{'type':Sequelize[_0xaf87('0x2')]},'username':{'type':Sequelize[_0xaf87('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xaf87('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaf87('0x2')],'unique':_0xaf87('0x3')},'authType':{'type':Sequelize[_0xaf87('0x4')](_0xaf87('0x5'),_0xaf87('0x6')),'defaultValue':_0xaf87('0x5')},'serverUrl':{'type':Sequelize[_0xaf87('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaf87('0x4')](_0xaf87('0x7'),_0xaf87('0x8')),'defaultValue':_0xaf87('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 315c032..92ec284 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9016=['api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','rawAttributes','create','update','find','params','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','test','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2386f3,_0x4bb6ef){var _0xa263ea=function(_0x1c7e5b){while(--_0x1c7e5b){_0x2386f3['push'](_0x2386f3['shift']());}};_0xa263ea(++_0x4bb6ef);}(_0x9016,0xf9));var _0x6901=function(_0x339217,_0x41b09d){_0x339217=_0x339217-0x0;var _0x582141=_0x9016[_0x339217];return _0x582141;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6901('0x0'));var zipdir=require(_0x6901('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6901('0x2'));var moment=require(_0x6901('0x3'));var BPromise=require(_0x6901('0x4'));var Mustache=require(_0x6901('0x5'));var util=require(_0x6901('0x6'));var path=require('path');var sox=require(_0x6901('0x7'));var csv=require(_0x6901('0x8'));var ejs=require(_0x6901('0x9'));var fs=require('fs');var fs_extra=require(_0x6901('0xa'));var _=require(_0x6901('0xb'));var squel=require(_0x6901('0xc'));var crypto=require('crypto');var jsforce=require(_0x6901('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6901('0xe'));var Redis=require(_0x6901('0xf'));var authService=require(_0x6901('0x10'));var qs=require(_0x6901('0x11'));var as=require(_0x6901('0x12'));var hardwareService=require(_0x6901('0x13'));var logger=require(_0x6901('0x14'))(_0x6901('0x15'));var utils=require('../../config/utils');var config=require(_0x6901('0x16'));var licenseUtil=require(_0x6901('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6901('0x18'));var jayson=require(_0x6901('0x19'));var client=jayson[_0x6901('0x1a')][_0x6901('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4e9f4d,_0xbf1b57,_0x42cb93,_0x1c9015){return new BPromise(function(_0x53a79f,_0x1ab783){var _0x5bd23b=_0x1c9015||client;return _0x5bd23b[_0x6901('0x1c')](_0x4e9f4d,_0x42cb93)['then'](function(_0x382c22){logger[_0x6901('0x1d')](_0x6901('0x1e'),_0xbf1b57,_0x6901('0x1f'));logger[_0x6901('0x20')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0xbf1b57,_0x6901('0x1f'),JSON[_0x6901('0x21')](_0x382c22));if(_0x382c22[_0x6901('0x22')]){if(_0x382c22[_0x6901('0x22')][_0x6901('0x23')]===0x1f4){logger['error'](_0x6901('0x1e'),_0xbf1b57,_0x382c22[_0x6901('0x22')]['message']);return _0x1ab783(_0x382c22[_0x6901('0x22')][_0x6901('0x24')]);}logger[_0x6901('0x22')](_0x6901('0x1e'),_0xbf1b57,_0x382c22[_0x6901('0x22')]['message']);return _0x53a79f(_0x382c22[_0x6901('0x22')][_0x6901('0x24')]);}else{logger[_0x6901('0x1d')](_0x6901('0x1e'),_0xbf1b57,_0x6901('0x1f'));_0x53a79f(_0x382c22[_0x6901('0x25')]['message']);}})['catch'](function(_0x4118bf){logger[_0x6901('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0xbf1b57,_0x4118bf);_0x1ab783(_0x4118bf);});});}function respondWithStatusCode(_0x1a5efc,_0x3e4411){_0x3e4411=_0x3e4411||0xcc;return function(_0x3c67e5){if(_0x3c67e5){return _0x1a5efc['sendStatus'](_0x3e4411);}return _0x1a5efc[_0x6901('0x26')](_0x3e4411)[_0x6901('0x27')]();};}function respondWithResult(_0x5f1f36,_0x2ceea8){_0x2ceea8=_0x2ceea8||0xc8;return function(_0x40f627){if(_0x40f627){return _0x5f1f36[_0x6901('0x26')](_0x2ceea8)[_0x6901('0x28')](_0x40f627);}};}function respondWithFilteredResult(_0xb5edef,_0x36a9ae){return function(_0x46c736){if(_0x46c736){var _0x55c811=typeof _0x36a9ae[_0x6901('0x29')]===_0x6901('0x2a')&&typeof _0x36a9ae[_0x6901('0x2b')]===_0x6901('0x2a');var _0x12338c=_0x46c736[_0x6901('0x2c')];var _0x158c44=_0x55c811?0x0:_0x36a9ae[_0x6901('0x29')];var _0x30da03=_0x55c811?_0x46c736[_0x6901('0x2c')]:_0x36a9ae[_0x6901('0x29')]+_0x36a9ae[_0x6901('0x2b')];var _0x9c010b;if(_0x30da03>=_0x12338c){_0x30da03=_0x12338c;_0x9c010b=0xc8;}else{_0x9c010b=0xce;}_0xb5edef[_0x6901('0x26')](_0x9c010b);return _0xb5edef[_0x6901('0x2d')](_0x6901('0x2e'),_0x158c44+'-'+_0x30da03+'/'+_0x12338c)[_0x6901('0x28')](_0x46c736);}return null;};}function patchUpdates(_0x3277b6){return function(_0x5df333){try{jsonpatch[_0x6901('0x2f')](_0x5df333,_0x3277b6,!![]);}catch(_0x2a0872){return BPromise[_0x6901('0x30')](_0x2a0872);}return _0x5df333[_0x6901('0x31')]();};}function saveUpdates(_0x436bdb,_0xc41488){return function(_0x495b9f){if(_0x495b9f){return _0x495b9f['update'](_0x436bdb)[_0x6901('0x32')](function(_0x2d458e){return _0x2d458e;});}return null;};}function removeEntity(_0x3ddb9f,_0x3d2244){return function(_0xa7924f){if(_0xa7924f){return _0xa7924f[_0x6901('0x33')]()[_0x6901('0x32')](function(){_0x3ddb9f['status'](0xcc)[_0x6901('0x27')]();});}};}function handleEntityNotFound(_0x24b5b3,_0x19e464){return function(_0x95454e){if(!_0x95454e){_0x24b5b3['sendStatus'](0x194);}return _0x95454e;};}function handleError(_0xc618c3,_0x4f2389){_0x4f2389=_0x4f2389||0x1f4;return function(_0x98d2d3){logger[_0x6901('0x22')](_0x98d2d3[_0x6901('0x34')]);if(_0x98d2d3[_0x6901('0x35')]){delete _0x98d2d3[_0x6901('0x35')];}_0xc618c3[_0x6901('0x26')](_0x4f2389)[_0x6901('0x36')](_0x98d2d3);};}function getMustacheRender(_0x155aa7,_0x15d9d3){return Mustache[_0x6901('0x37')](_0x155aa7,_[_0x6901('0x38')](_0x15d9d3[_0x6901('0x39')],{'contact':_0x15d9d3[_0x6901('0x3a')],'message':_0x15d9d3[_0x6901('0x24')],'agent':_0x15d9d3[_0x6901('0x3b')],'interaction':_0x15d9d3[_0x6901('0x3c')],'account':_0x15d9d3[_0x6901('0x3d')]}))||'';}exports[_0x6901('0x3e')]=function(_0x162198,_0x2cfc3c){var _0x46f423={},_0x1b7923={},_0x4706ab={'count':0x0,'rows':[]};var _0x5820b=_[_0x6901('0x3f')](db['ZendeskAccount']['rawAttributes'],function(_0x2417ff){return{'name':_0x2417ff['fieldName'],'type':_0x2417ff[_0x6901('0x40')][_0x6901('0x41')]};});_0x1b7923['model']=_['map'](_0x5820b,_0x6901('0x35'));_0x1b7923[_0x6901('0x42')]=_[_0x6901('0x43')](_0x162198[_0x6901('0x42')]);_0x1b7923['filters']=_[_0x6901('0x44')](_0x1b7923[_0x6901('0x45')],_0x1b7923[_0x6901('0x42')]);_0x46f423['attributes']=_['intersection'](_0x1b7923[_0x6901('0x45')],qs[_0x6901('0x46')](_0x162198[_0x6901('0x42')]['fields']));_0x46f423[_0x6901('0x47')]=_0x46f423['attributes'][_0x6901('0x48')]?_0x46f423[_0x6901('0x47')]:_0x1b7923[_0x6901('0x45')];if(!_0x162198[_0x6901('0x42')][_0x6901('0x49')](_0x6901('0x4a'))){_0x46f423[_0x6901('0x2b')]=qs[_0x6901('0x2b')](_0x162198[_0x6901('0x42')]['limit']);_0x46f423[_0x6901('0x29')]=qs[_0x6901('0x29')](_0x162198[_0x6901('0x42')][_0x6901('0x29')]);}_0x46f423[_0x6901('0x4b')]=qs[_0x6901('0x4c')](_0x162198[_0x6901('0x42')][_0x6901('0x4c')]);_0x46f423[_0x6901('0x4d')]=qs[_0x6901('0x4e')](_[_0x6901('0x4f')](_0x162198['query'],_0x1b7923[_0x6901('0x4e')]),_0x5820b);if(_0x162198[_0x6901('0x42')]['filter']){_0x46f423[_0x6901('0x4d')]=_[_0x6901('0x38')](_0x46f423[_0x6901('0x4d')],{'$or':_[_0x6901('0x3f')](_0x5820b,function(_0x53a317){if(_0x53a317['type']!==_0x6901('0x50')){var _0x178007={};_0x178007[_0x53a317[_0x6901('0x35')]]={'$like':'%'+_0x162198['query'][_0x6901('0x51')]+'%'};return _0x178007;}})});}_0x46f423=_[_0x6901('0x38')]({},_0x46f423,_0x162198[_0x6901('0x52')]);var _0x2c4cc3={'where':_0x46f423[_0x6901('0x4d')]};return db[_0x6901('0x53')][_0x6901('0x2c')](_0x2c4cc3)[_0x6901('0x32')](function(_0x8d098e){_0x4706ab[_0x6901('0x2c')]=_0x8d098e;if(_0x162198['query'][_0x6901('0x54')]){_0x46f423[_0x6901('0x55')]=[{'all':!![]}];}return db[_0x6901('0x53')][_0x6901('0x56')](_0x46f423);})[_0x6901('0x32')](function(_0x406a76){_0x4706ab[_0x6901('0x57')]=_0x406a76;return _0x4706ab;})[_0x6901('0x32')](respondWithFilteredResult(_0x2cfc3c,_0x46f423))[_0x6901('0x58')](handleError(_0x2cfc3c,null));};exports[_0x6901('0x59')]=function(_0x44b04b,_0x3d5464){var _0x365c98={'raw':![],'where':{'id':_0x44b04b['params']['id']}},_0x5b1de8={};_0x5b1de8[_0x6901('0x45')]=_['keys'](db[_0x6901('0x53')][_0x6901('0x5a')]);_0x5b1de8['query']=_[_0x6901('0x43')](_0x44b04b[_0x6901('0x42')]);_0x5b1de8[_0x6901('0x4e')]=_[_0x6901('0x44')](_0x5b1de8[_0x6901('0x45')],_0x5b1de8[_0x6901('0x42')]);_0x365c98[_0x6901('0x47')]=_[_0x6901('0x44')](_0x5b1de8[_0x6901('0x45')],qs['fields'](_0x44b04b[_0x6901('0x42')]['fields']));_0x365c98['attributes']=_0x365c98['attributes'][_0x6901('0x48')]?_0x365c98[_0x6901('0x47')]:_0x5b1de8['model'];if(_0x44b04b[_0x6901('0x42')][_0x6901('0x54')]){_0x365c98['include']=[{'all':!![]}];}_0x365c98=_[_0x6901('0x38')]({},_0x365c98,_0x44b04b['options']);return db['ZendeskAccount']['find'](_0x365c98)['then'](handleEntityNotFound(_0x3d5464,null))[_0x6901('0x32')](respondWithResult(_0x3d5464,null))[_0x6901('0x58')](handleError(_0x3d5464,null));};exports[_0x6901('0x5b')]=function(_0x2b31c5,_0x59a11f){return db[_0x6901('0x53')][_0x6901('0x5b')](_0x2b31c5[_0x6901('0x39')],{})[_0x6901('0x32')](respondWithResult(_0x59a11f,0xc9))[_0x6901('0x58')](handleError(_0x59a11f,null));};exports[_0x6901('0x5c')]=function(_0xb91c0f,_0x1c6c28){if(_0xb91c0f[_0x6901('0x39')]['id']){delete _0xb91c0f[_0x6901('0x39')]['id'];}return db[_0x6901('0x53')]['find']({'where':{'id':_0xb91c0f['params']['id']}})[_0x6901('0x32')](handleEntityNotFound(_0x1c6c28,null))[_0x6901('0x32')](saveUpdates(_0xb91c0f['body'],null))['then'](respondWithResult(_0x1c6c28,null))[_0x6901('0x58')](handleError(_0x1c6c28,null));};exports[_0x6901('0x33')]=function(_0x2e4945,_0x5a1451){return db[_0x6901('0x53')][_0x6901('0x5d')]({'where':{'id':_0x2e4945[_0x6901('0x5e')]['id']}})[_0x6901('0x32')](handleEntityNotFound(_0x5a1451,null))[_0x6901('0x32')](removeEntity(_0x5a1451,null))[_0x6901('0x58')](handleError(_0x5a1451,null));};exports[_0x6901('0x5f')]=function(_0x4c998c,_0x22e732,_0x4ecc50){var _0x5a32bd={};var _0x50467a={};var _0x2bd915;var _0x4b4c86;return db['ZendeskAccount'][_0x6901('0x60')]({'where':{'id':_0x4c998c[_0x6901('0x5e')]['id']}})['then'](handleEntityNotFound(_0x22e732,null))[_0x6901('0x32')](function(_0x2e5be6){if(_0x2e5be6){_0x2bd915=_0x2e5be6;_0x50467a['model']=_[_0x6901('0x43')](db[_0x6901('0x61')][_0x6901('0x5a')]);_0x50467a[_0x6901('0x42')]=_[_0x6901('0x43')](_0x4c998c[_0x6901('0x42')]);_0x50467a[_0x6901('0x4e')]=_[_0x6901('0x44')](_0x50467a['model'],_0x50467a[_0x6901('0x42')]);_0x5a32bd['attributes']=_['intersection'](_0x50467a[_0x6901('0x45')],qs[_0x6901('0x46')](_0x4c998c[_0x6901('0x42')][_0x6901('0x46')]));_0x5a32bd[_0x6901('0x47')]=_0x5a32bd[_0x6901('0x47')][_0x6901('0x48')]?_0x5a32bd[_0x6901('0x47')]:_0x50467a[_0x6901('0x45')];_0x5a32bd[_0x6901('0x4b')]=qs[_0x6901('0x4c')](_0x4c998c[_0x6901('0x42')][_0x6901('0x4c')]);_0x5a32bd[_0x6901('0x4d')]=qs[_0x6901('0x4e')](_[_0x6901('0x4f')](_0x4c998c['query'],_0x50467a[_0x6901('0x4e')]));if(_0x4c998c[_0x6901('0x42')]['filter']){_0x5a32bd[_0x6901('0x4d')]=_[_0x6901('0x38')](_0x5a32bd[_0x6901('0x4d')],{'$or':_[_0x6901('0x3f')](_0x5a32bd[_0x6901('0x47')],function(_0x4a59c2){var _0x16f9e4={};_0x16f9e4[_0x4a59c2]={'$like':'%'+_0x4c998c['query'][_0x6901('0x51')]+'%'};return _0x16f9e4;})});}_0x5a32bd=_['merge']({},_0x5a32bd,_0x4c998c['options']);return _0x2bd915[_0x6901('0x5f')](_0x5a32bd);}})[_0x6901('0x32')](function(_0x52035b){if(_0x52035b){_0x4b4c86=_0x52035b[_0x6901('0x48')];if(!_0x4c998c['query']['hasOwnProperty'](_0x6901('0x4a'))){_0x5a32bd['limit']=qs[_0x6901('0x2b')](_0x4c998c[_0x6901('0x42')][_0x6901('0x2b')]);_0x5a32bd[_0x6901('0x29')]=qs[_0x6901('0x29')](_0x4c998c[_0x6901('0x42')]['offset']);}return _0x2bd915[_0x6901('0x5f')](_0x5a32bd);}})[_0x6901('0x32')](function(_0x3d0433){if(_0x3d0433){return _0x3d0433?{'count':_0x4b4c86,'rows':_0x3d0433}:null;}})['then'](respondWithResult(_0x22e732,null))['catch'](handleError(_0x22e732,null));};exports[_0x6901('0x62')]=function(_0x3f1744,_0x3873c2,_0x559d3d){if(_0x3f1744[_0x6901('0x39')]['id']){delete _0x3f1744[_0x6901('0x39')]['id'];}return db[_0x6901('0x53')][_0x6901('0x60')]({'where':{'id':_0x3f1744[_0x6901('0x5e')]['id']}})[_0x6901('0x32')](handleEntityNotFound(_0x3873c2,null))['then'](function(_0x16fc1b){if(_0x16fc1b){_0x3f1744[_0x6901('0x39')][_0x6901('0x63')]=_0x16fc1b['id'];_0x3f1744[_0x6901('0x39')][_0x6901('0x64')]=integrations[_0x6901('0x65')](_0x3f1744[_0x6901('0x39')][_0x6901('0x66')],_0x3f1744['body'][_0x6901('0x40')]);_0x3f1744[_0x6901('0x39')][_0x6901('0x67')]=integrations[_0x6901('0x68')](_0x3f1744[_0x6901('0x39')]['channel'],_0x3f1744[_0x6901('0x39')]['type']);return db[_0x6901('0x61')][_0x6901('0x5b')](_0x3f1744['body'],{'include':[{'model':db[_0x6901('0x69')],'as':_0x6901('0x64')},{'model':db[_0x6901('0x69')],'as':_0x6901('0x67')}]});}return null;})[_0x6901('0x32')](respondWithResult(_0x3873c2,null))[_0x6901('0x58')](handleError(_0x3873c2,null));};exports[_0x6901('0x6a')]=function(_0x34196,_0xe7f497,_0x2b3aae){var _0x265de2='';return db['ZendeskAccount'][_0x6901('0x60')]({'where':{'id':_0x34196[_0x6901('0x5e')]['id']},'attributes':['id',_0x6901('0x6b'),_0x6901('0x6c'),_0x6901('0x6d'),_0x6901('0x6e'),_0x6901('0x6f')]})[_0x6901('0x32')](handleEntityNotFound(_0xe7f497,null))['then'](function(_0x161925){if(_0x161925){_0x265de2=_0x161925[_0x6901('0x6f')];var _0x5d2e8a=_0x265de2[_0x6901('0x70')](-0x1);if(_0x5d2e8a==='/'){_0x265de2=_0x265de2[_0x6901('0x71')](0x0,_0x265de2[_0x6901('0x72')](_0x5d2e8a));}var _0x2b6cc9={'method':'GET','uri':util[_0x6901('0x73')](_0x6901('0x74'),_0x265de2,_0x6901('0x75')),'json':!![]};switch(_0x161925['authType']){case'password':_0x2b6cc9[_0x6901('0x76')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x6901('0x73')]('%s:%s',_0x161925[_0x6901('0x6b')],_0x161925['password']))['toString'](_0x6901('0x77')))};break;case _0x6901('0x6d'):_0x2b6cc9[_0x6901('0x76')]={'Authorization':util['format'](_0x6901('0x78'),new Buffer(util['format']('%s/token:%s',_0x161925[_0x6901('0x6b')],_0x161925[_0x6901('0x6d')]))['toString'](_0x6901('0x77')))};break;default:throw new db[(_0x6901('0x79'))][(_0x6901('0x7a'))](_0x6901('0x7b'));}return rp(_0x2b6cc9);}})[_0x6901('0x32')](function(_0x42fb10){if(_0x42fb10){var _0x2e5953=[_0x6901('0x7c'),_0x6901('0x7d'),_0x6901('0x7e'),_0x6901('0x7f')];_[_0x6901('0x80')](_0x42fb10[_0x6901('0x75')],function(_0x4dcd7a){return _0x2e5953[_0x6901('0x81')](_0x4dcd7a[_0x6901('0x40')]);});return{'count':_0x42fb10['ticket_fields'][_0x6901('0x48')],'rows':_[_0x6901('0x3f')](_0x42fb10[_0x6901('0x75')],function(_0x5a0f22){return{'id':_0x5a0f22['id'],'name':_0x5a0f22[_0x6901('0x82')]>0x7?_0x5a0f22[_0x6901('0x83')]:_0x5a0f22[_0x6901('0x40')],'custom':_0x5a0f22[_0x6901('0x82')]>0x7?!![]:![],'options':_0x5a0f22[_0x6901('0x84')]?_0x5a0f22[_0x6901('0x84')]:_0x5a0f22['custom_field_options']?_0x5a0f22['custom_field_options']:[]};})};}})[_0x6901('0x32')](respondWithResult(_0xe7f497,null))[_0x6901('0x58')](function(_0x3d525e){var _0x389937=_0x34196[_0x6901('0x42')][_0x6901('0x85')]?0x1f4:_0x3d525e['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x6901('0x6a'),_0x389937,JSON[_0x6901('0x21')](_0x3d525e));delete _0x3d525e[_0x6901('0x35')];if(_0x389937===0x191){_0x389937=0x190;}_0xe7f497[_0x6901('0x26')](_0x389937)[_0x6901('0x36')](_0x34196['query'][_0x6901('0x85')]?{'message':'Wrong\x20credentials','statusCode':_0x3d525e[_0x6901('0x86')]}:_0x3d525e);});}; \ No newline at end of file +var _0xfa15=['subject','assignee','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','stack','name','send','body','contact','agent','interaction','account','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','params','getConfigurations','order','sort','nolimit','findOne','AccountId','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Unknown\x20authentication\x20type'];(function(_0x3fb7eb,_0x4b168f){var _0x525334=function(_0x494320){while(--_0x494320){_0x3fb7eb['push'](_0x3fb7eb['shift']());}};_0x525334(++_0x4b168f);}(_0xfa15,0x189));var _0x5fa1=function(_0x9e095a,_0x4d1451){_0x9e095a=_0x9e095a-0x0;var _0x1ce7a9=_0xfa15[_0x9e095a];return _0x1ce7a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fa1('0x0'));var zipdir=require(_0x5fa1('0x1'));var jsonpatch=require(_0x5fa1('0x2'));var rp=require(_0x5fa1('0x3'));var moment=require(_0x5fa1('0x4'));var BPromise=require(_0x5fa1('0x5'));var Mustache=require(_0x5fa1('0x6'));var util=require('util');var path=require(_0x5fa1('0x7'));var sox=require('sox');var csv=require(_0x5fa1('0x8'));var ejs=require(_0x5fa1('0x9'));var fs=require('fs');var fs_extra=require(_0x5fa1('0xa'));var _=require('lodash');var squel=require(_0x5fa1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5fa1('0xc'));var toCsv=require(_0x5fa1('0x8'));var querystring=require(_0x5fa1('0xd'));var Papa=require(_0x5fa1('0xe'));var Redis=require(_0x5fa1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fa1('0x10'));var as=require(_0x5fa1('0x11'));var hardwareService=require(_0x5fa1('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5fa1('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5fa1('0x14'));var db=require(_0x5fa1('0x15'))['db'];var integrations=require(_0x5fa1('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x5fa1('0x17')][_0x5fa1('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x467a25,_0x474679,_0x2e2a3d,_0x29e3a1){return new BPromise(function(_0x22127b,_0x1d323e){var _0x1581c0=_0x29e3a1||client;return _0x1581c0[_0x5fa1('0x19')](_0x467a25,_0x2e2a3d)[_0x5fa1('0x1a')](function(_0xab0d6f){logger['info'](_0x5fa1('0x1b'),_0x474679,_0x5fa1('0x1c'));logger[_0x5fa1('0x1d')](_0x5fa1('0x1e'),_0x474679,_0x5fa1('0x1c'),JSON[_0x5fa1('0x1f')](_0xab0d6f));if(_0xab0d6f[_0x5fa1('0x20')]){if(_0xab0d6f[_0x5fa1('0x20')][_0x5fa1('0x21')]===0x1f4){logger[_0x5fa1('0x20')](_0x5fa1('0x1b'),_0x474679,_0xab0d6f[_0x5fa1('0x20')][_0x5fa1('0x22')]);return _0x1d323e(_0xab0d6f[_0x5fa1('0x20')][_0x5fa1('0x22')]);}logger[_0x5fa1('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x474679,_0xab0d6f[_0x5fa1('0x20')]['message']);return _0x22127b(_0xab0d6f[_0x5fa1('0x20')][_0x5fa1('0x22')]);}else{logger[_0x5fa1('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x474679,_0x5fa1('0x1c'));_0x22127b(_0xab0d6f[_0x5fa1('0x24')]['message']);}})[_0x5fa1('0x25')](function(_0x56e3fb){logger[_0x5fa1('0x20')](_0x5fa1('0x1b'),_0x474679,_0x56e3fb);_0x1d323e(_0x56e3fb);});});}function respondWithStatusCode(_0x69c79,_0x56b8b2){_0x56b8b2=_0x56b8b2||0xcc;return function(_0x15126d){if(_0x15126d){return _0x69c79[_0x5fa1('0x26')](_0x56b8b2);}return _0x69c79[_0x5fa1('0x27')](_0x56b8b2)[_0x5fa1('0x28')]();};}function respondWithResult(_0x5d1b51,_0x433ccb){_0x433ccb=_0x433ccb||0xc8;return function(_0x2a9c4f){if(_0x2a9c4f){return _0x5d1b51[_0x5fa1('0x27')](_0x433ccb)[_0x5fa1('0x29')](_0x2a9c4f);}};}function respondWithFilteredResult(_0xa110cf,_0x13c0bb){return function(_0x44d86c){if(_0x44d86c){var _0xec7d93=typeof _0x13c0bb[_0x5fa1('0x2a')]===_0x5fa1('0x2b')&&typeof _0x13c0bb[_0x5fa1('0x2c')]===_0x5fa1('0x2b');var _0xa04be=_0x44d86c['count'];var _0x56981b=_0xec7d93?0x0:_0x13c0bb[_0x5fa1('0x2a')];var _0x1adf6a=_0xec7d93?_0x44d86c[_0x5fa1('0x2d')]:_0x13c0bb['offset']+_0x13c0bb[_0x5fa1('0x2c')];var _0x141aaa;if(_0x1adf6a>=_0xa04be){_0x1adf6a=_0xa04be;_0x141aaa=0xc8;}else{_0x141aaa=0xce;}_0xa110cf[_0x5fa1('0x27')](_0x141aaa);return _0xa110cf['set']('Content-Range',_0x56981b+'-'+_0x1adf6a+'/'+_0xa04be)[_0x5fa1('0x29')](_0x44d86c);}return null;};}function patchUpdates(_0x5bd13d){return function(_0x588175){try{jsonpatch[_0x5fa1('0x2e')](_0x588175,_0x5bd13d,!![]);}catch(_0x3e4d1d){return BPromise[_0x5fa1('0x2f')](_0x3e4d1d);}return _0x588175[_0x5fa1('0x30')]();};}function saveUpdates(_0x3b4693,_0x1a278d){return function(_0x37e9f9){if(_0x37e9f9){return _0x37e9f9[_0x5fa1('0x31')](_0x3b4693)[_0x5fa1('0x1a')](function(_0x41dab1){return _0x41dab1;});}return null;};}function removeEntity(_0x292b3e,_0x319fbc){return function(_0x2f6246){if(_0x2f6246){return _0x2f6246[_0x5fa1('0x32')]()[_0x5fa1('0x1a')](function(){_0x292b3e[_0x5fa1('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9efc00,_0x25a69c){return function(_0x49711c){if(!_0x49711c){_0x9efc00[_0x5fa1('0x26')](0x194);}return _0x49711c;};}function handleError(_0x470a3e,_0x14c063){_0x14c063=_0x14c063||0x1f4;return function(_0x51706c){logger[_0x5fa1('0x20')](_0x51706c[_0x5fa1('0x33')]);if(_0x51706c[_0x5fa1('0x34')]){delete _0x51706c[_0x5fa1('0x34')];}_0x470a3e['status'](_0x14c063)[_0x5fa1('0x35')](_0x51706c);};}function getMustacheRender(_0x1a276e,_0x1f0661){return Mustache['render'](_0x1a276e,_['merge'](_0x1f0661[_0x5fa1('0x36')],{'contact':_0x1f0661[_0x5fa1('0x37')],'message':_0x1f0661[_0x5fa1('0x22')],'agent':_0x1f0661[_0x5fa1('0x38')],'interaction':_0x1f0661[_0x5fa1('0x39')],'account':_0x1f0661[_0x5fa1('0x3a')]}))||'';}exports[_0x5fa1('0x3b')]=function(_0x137592,_0x46eff0){var _0x27f20b={},_0x23297a={},_0x20fb0a={'count':0x0,'rows':[]};var _0x3a69b0=_['map'](db[_0x5fa1('0x3c')][_0x5fa1('0x3d')],function(_0x121bc7){return{'name':_0x121bc7[_0x5fa1('0x3e')],'type':_0x121bc7[_0x5fa1('0x3f')][_0x5fa1('0x40')]};});_0x23297a[_0x5fa1('0x41')]=_[_0x5fa1('0x42')](_0x3a69b0,_0x5fa1('0x34'));_0x23297a[_0x5fa1('0x43')]=_[_0x5fa1('0x44')](_0x137592[_0x5fa1('0x43')]);_0x23297a[_0x5fa1('0x45')]=_[_0x5fa1('0x46')](_0x23297a[_0x5fa1('0x41')],_0x23297a[_0x5fa1('0x43')]);_0x27f20b[_0x5fa1('0x47')]=_[_0x5fa1('0x46')](_0x23297a['model'],qs[_0x5fa1('0x48')](_0x137592[_0x5fa1('0x43')][_0x5fa1('0x48')]));_0x27f20b['attributes']=_0x27f20b[_0x5fa1('0x47')][_0x5fa1('0x49')]?_0x27f20b[_0x5fa1('0x47')]:_0x23297a['model'];if(!_0x137592[_0x5fa1('0x43')][_0x5fa1('0x4a')]('nolimit')){_0x27f20b[_0x5fa1('0x2c')]=qs[_0x5fa1('0x2c')](_0x137592[_0x5fa1('0x43')][_0x5fa1('0x2c')]);_0x27f20b[_0x5fa1('0x2a')]=qs[_0x5fa1('0x2a')](_0x137592['query'][_0x5fa1('0x2a')]);}_0x27f20b['order']=qs['sort'](_0x137592[_0x5fa1('0x43')]['sort']);_0x27f20b[_0x5fa1('0x4b')]=qs['filters'](_[_0x5fa1('0x4c')](_0x137592[_0x5fa1('0x43')],_0x23297a['filters']),_0x3a69b0);if(_0x137592[_0x5fa1('0x43')][_0x5fa1('0x4d')]){_0x27f20b['where']=_[_0x5fa1('0x4e')](_0x27f20b['where'],{'$or':_['map'](_0x3a69b0,function(_0x4cbf68){if(_0x4cbf68[_0x5fa1('0x3f')]!==_0x5fa1('0x4f')){var _0x4c8eb8={};_0x4c8eb8[_0x4cbf68[_0x5fa1('0x34')]]={'$like':'%'+_0x137592[_0x5fa1('0x43')]['filter']+'%'};return _0x4c8eb8;}})});}_0x27f20b=_[_0x5fa1('0x4e')]({},_0x27f20b,_0x137592[_0x5fa1('0x50')]);var _0x5075a4={'where':_0x27f20b[_0x5fa1('0x4b')]};return db['ZendeskAccount'][_0x5fa1('0x2d')](_0x5075a4)[_0x5fa1('0x1a')](function(_0x1cf8f7){_0x20fb0a[_0x5fa1('0x2d')]=_0x1cf8f7;if(_0x137592[_0x5fa1('0x43')][_0x5fa1('0x51')]){_0x27f20b[_0x5fa1('0x52')]=[{'all':!![]}];}return db[_0x5fa1('0x3c')]['findAll'](_0x27f20b);})[_0x5fa1('0x1a')](function(_0x102a8f){_0x20fb0a[_0x5fa1('0x53')]=_0x102a8f;return _0x20fb0a;})[_0x5fa1('0x1a')](respondWithFilteredResult(_0x46eff0,_0x27f20b))[_0x5fa1('0x25')](handleError(_0x46eff0,null));};exports[_0x5fa1('0x54')]=function(_0x31f351,_0x416549){var _0x4e5a51={'raw':![],'where':{'id':_0x31f351['params']['id']}},_0xb7e8a={};_0xb7e8a[_0x5fa1('0x41')]=_[_0x5fa1('0x44')](db['ZendeskAccount'][_0x5fa1('0x3d')]);_0xb7e8a[_0x5fa1('0x43')]=_[_0x5fa1('0x44')](_0x31f351[_0x5fa1('0x43')]);_0xb7e8a[_0x5fa1('0x45')]=_[_0x5fa1('0x46')](_0xb7e8a[_0x5fa1('0x41')],_0xb7e8a[_0x5fa1('0x43')]);_0x4e5a51[_0x5fa1('0x47')]=_[_0x5fa1('0x46')](_0xb7e8a[_0x5fa1('0x41')],qs[_0x5fa1('0x48')](_0x31f351[_0x5fa1('0x43')]['fields']));_0x4e5a51[_0x5fa1('0x47')]=_0x4e5a51['attributes'][_0x5fa1('0x49')]?_0x4e5a51['attributes']:_0xb7e8a[_0x5fa1('0x41')];if(_0x31f351[_0x5fa1('0x43')][_0x5fa1('0x51')]){_0x4e5a51[_0x5fa1('0x52')]=[{'all':!![]}];}_0x4e5a51=_['merge']({},_0x4e5a51,_0x31f351['options']);return db['ZendeskAccount'][_0x5fa1('0x55')](_0x4e5a51)[_0x5fa1('0x1a')](handleEntityNotFound(_0x416549,null))['then'](respondWithResult(_0x416549,null))[_0x5fa1('0x25')](handleError(_0x416549,null));};exports[_0x5fa1('0x56')]=function(_0x1f7ae3,_0xfc5812){return db['ZendeskAccount'][_0x5fa1('0x56')](_0x1f7ae3[_0x5fa1('0x36')],{})[_0x5fa1('0x1a')](respondWithResult(_0xfc5812,0xc9))[_0x5fa1('0x25')](handleError(_0xfc5812,null));};exports[_0x5fa1('0x31')]=function(_0x305dd8,_0x2c458e){if(_0x305dd8[_0x5fa1('0x36')]['id']){delete _0x305dd8[_0x5fa1('0x36')]['id'];}return db[_0x5fa1('0x3c')][_0x5fa1('0x55')]({'where':{'id':_0x305dd8[_0x5fa1('0x57')]['id']}})[_0x5fa1('0x1a')](handleEntityNotFound(_0x2c458e,null))[_0x5fa1('0x1a')](saveUpdates(_0x305dd8['body'],null))[_0x5fa1('0x1a')](respondWithResult(_0x2c458e,null))[_0x5fa1('0x25')](handleError(_0x2c458e,null));};exports['destroy']=function(_0x2b68ca,_0xce4b0b){return db[_0x5fa1('0x3c')][_0x5fa1('0x55')]({'where':{'id':_0x2b68ca[_0x5fa1('0x57')]['id']}})[_0x5fa1('0x1a')](handleEntityNotFound(_0xce4b0b,null))['then'](removeEntity(_0xce4b0b,null))['catch'](handleError(_0xce4b0b,null));};exports[_0x5fa1('0x58')]=function(_0x4eaa74,_0x518891,_0x5a2c46){var _0x51b4b1={};var _0x54a68a={};var _0x4ef1e7;var _0x3a3cec;return db[_0x5fa1('0x3c')]['findOne']({'where':{'id':_0x4eaa74[_0x5fa1('0x57')]['id']}})[_0x5fa1('0x1a')](handleEntityNotFound(_0x518891,null))[_0x5fa1('0x1a')](function(_0x25b94e){if(_0x25b94e){_0x4ef1e7=_0x25b94e;_0x54a68a['model']=_[_0x5fa1('0x44')](db['ZendeskConfiguration'][_0x5fa1('0x3d')]);_0x54a68a[_0x5fa1('0x43')]=_[_0x5fa1('0x44')](_0x4eaa74[_0x5fa1('0x43')]);_0x54a68a[_0x5fa1('0x45')]=_[_0x5fa1('0x46')](_0x54a68a[_0x5fa1('0x41')],_0x54a68a[_0x5fa1('0x43')]);_0x51b4b1[_0x5fa1('0x47')]=_['intersection'](_0x54a68a['model'],qs['fields'](_0x4eaa74[_0x5fa1('0x43')][_0x5fa1('0x48')]));_0x51b4b1[_0x5fa1('0x47')]=_0x51b4b1[_0x5fa1('0x47')][_0x5fa1('0x49')]?_0x51b4b1['attributes']:_0x54a68a[_0x5fa1('0x41')];_0x51b4b1[_0x5fa1('0x59')]=qs[_0x5fa1('0x5a')](_0x4eaa74[_0x5fa1('0x43')][_0x5fa1('0x5a')]);_0x51b4b1[_0x5fa1('0x4b')]=qs[_0x5fa1('0x45')](_[_0x5fa1('0x4c')](_0x4eaa74[_0x5fa1('0x43')],_0x54a68a['filters']));if(_0x4eaa74[_0x5fa1('0x43')][_0x5fa1('0x4d')]){_0x51b4b1[_0x5fa1('0x4b')]=_[_0x5fa1('0x4e')](_0x51b4b1[_0x5fa1('0x4b')],{'$or':_[_0x5fa1('0x42')](_0x51b4b1[_0x5fa1('0x47')],function(_0x1e4ff1){var _0x4cd58c={};_0x4cd58c[_0x1e4ff1]={'$like':'%'+_0x4eaa74[_0x5fa1('0x43')]['filter']+'%'};return _0x4cd58c;})});}_0x51b4b1=_[_0x5fa1('0x4e')]({},_0x51b4b1,_0x4eaa74[_0x5fa1('0x50')]);return _0x4ef1e7[_0x5fa1('0x58')](_0x51b4b1);}})['then'](function(_0x3c0d43){if(_0x3c0d43){_0x3a3cec=_0x3c0d43[_0x5fa1('0x49')];if(!_0x4eaa74[_0x5fa1('0x43')]['hasOwnProperty'](_0x5fa1('0x5b'))){_0x51b4b1[_0x5fa1('0x2c')]=qs[_0x5fa1('0x2c')](_0x4eaa74[_0x5fa1('0x43')][_0x5fa1('0x2c')]);_0x51b4b1['offset']=qs[_0x5fa1('0x2a')](_0x4eaa74[_0x5fa1('0x43')][_0x5fa1('0x2a')]);}return _0x4ef1e7['getConfigurations'](_0x51b4b1);}})['then'](function(_0x5ab974){if(_0x5ab974){return _0x5ab974?{'count':_0x3a3cec,'rows':_0x5ab974}:null;}})[_0x5fa1('0x1a')](respondWithResult(_0x518891,null))[_0x5fa1('0x25')](handleError(_0x518891,null));};exports['addConfiguration']=function(_0x35dc0a,_0x67817,_0x1bbb33){if(_0x35dc0a[_0x5fa1('0x36')]['id']){delete _0x35dc0a[_0x5fa1('0x36')]['id'];}return db['ZendeskAccount'][_0x5fa1('0x5c')]({'where':{'id':_0x35dc0a[_0x5fa1('0x57')]['id']}})['then'](handleEntityNotFound(_0x67817,null))[_0x5fa1('0x1a')](function(_0x3ceb0d){if(_0x3ceb0d){_0x35dc0a['body'][_0x5fa1('0x5d')]=_0x3ceb0d['id'];_0x35dc0a[_0x5fa1('0x36')]['Subjects']=integrations[_0x5fa1('0x5e')](_0x35dc0a[_0x5fa1('0x36')][_0x5fa1('0x5f')],_0x35dc0a['body'][_0x5fa1('0x3f')]);_0x35dc0a[_0x5fa1('0x36')]['Descriptions']=integrations[_0x5fa1('0x60')](_0x35dc0a[_0x5fa1('0x36')]['channel'],_0x35dc0a[_0x5fa1('0x36')][_0x5fa1('0x3f')]);return db[_0x5fa1('0x61')][_0x5fa1('0x56')](_0x35dc0a['body'],{'include':[{'model':db[_0x5fa1('0x62')],'as':'Subjects'},{'model':db[_0x5fa1('0x62')],'as':_0x5fa1('0x63')}]});}return null;})[_0x5fa1('0x1a')](respondWithResult(_0x67817,null))['catch'](handleError(_0x67817,null));};exports[_0x5fa1('0x64')]=function(_0x4b5bea,_0x5053a7,_0x44e0a8){var _0x539df2='';return db[_0x5fa1('0x3c')][_0x5fa1('0x5c')]({'where':{'id':_0x4b5bea['params']['id']},'attributes':['id',_0x5fa1('0x65'),_0x5fa1('0x66'),_0x5fa1('0x67'),'authType','remoteUri']})[_0x5fa1('0x1a')](handleEntityNotFound(_0x5053a7,null))[_0x5fa1('0x1a')](function(_0x3ad2af){if(_0x3ad2af){_0x539df2=_0x3ad2af[_0x5fa1('0x68')];var _0xcba1e3=_0x539df2[_0x5fa1('0x69')](-0x1);if(_0xcba1e3==='/'){_0x539df2=_0x539df2['substring'](0x0,_0x539df2[_0x5fa1('0x6a')](_0xcba1e3));}var _0x289f18={'method':_0x5fa1('0x6b'),'uri':util[_0x5fa1('0x6c')](_0x5fa1('0x6d'),_0x539df2,_0x5fa1('0x6e')),'json':!![]};switch(_0x3ad2af[_0x5fa1('0x6f')]){case'password':_0x289f18[_0x5fa1('0x70')]={'Authorization':util[_0x5fa1('0x6c')](_0x5fa1('0x71'),new Buffer(util[_0x5fa1('0x6c')](_0x5fa1('0x72'),_0x3ad2af[_0x5fa1('0x65')],_0x3ad2af[_0x5fa1('0x66')]))['toString'](_0x5fa1('0x73')))};break;case _0x5fa1('0x67'):_0x289f18['headers']={'Authorization':util[_0x5fa1('0x6c')](_0x5fa1('0x71'),new Buffer(util[_0x5fa1('0x6c')](_0x5fa1('0x74'),_0x3ad2af[_0x5fa1('0x65')],_0x3ad2af[_0x5fa1('0x67')]))[_0x5fa1('0x75')]('base64'))};break;default:throw new db['Sequelize']['ValidationError'](_0x5fa1('0x76'));}return rp(_0x289f18);}})[_0x5fa1('0x1a')](function(_0xd993a0){if(_0xd993a0){var _0x1bfab1=[_0x5fa1('0x77'),'description','group',_0x5fa1('0x78')];_['remove'](_0xd993a0[_0x5fa1('0x6e')],function(_0x5a16c0){return _0x1bfab1['includes'](_0x5a16c0['type']);});return{'count':_0xd993a0[_0x5fa1('0x6e')][_0x5fa1('0x49')],'rows':_[_0x5fa1('0x42')](_0xd993a0['ticket_fields'],function(_0x162176){return{'id':_0x162176['id'],'name':_0x162176[_0x5fa1('0x79')]>0x7?_0x162176['title']:_0x162176[_0x5fa1('0x3f')],'custom':_0x162176[_0x5fa1('0x79')]>0x7?!![]:![],'options':_0x162176[_0x5fa1('0x7a')]?_0x162176[_0x5fa1('0x7a')]:_0x162176[_0x5fa1('0x7b')]?_0x162176['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x5053a7,null))[_0x5fa1('0x25')](function(_0x1b56db){var _0xfb9ac2=_0x4b5bea[_0x5fa1('0x43')][_0x5fa1('0x7c')]?0x1f4:_0x1b56db[_0x5fa1('0x7d')]||0x1f4;logger[_0x5fa1('0x20')](_0x5fa1('0x7e'),'getFields',_0xfb9ac2,JSON['stringify'](_0x1b56db));delete _0x1b56db[_0x5fa1('0x34')];if(_0xfb9ac2===0x191){_0xfb9ac2=0x190;}_0x5053a7[_0x5fa1('0x27')](_0xfb9ac2)[_0x5fa1('0x35')](_0x4b5bea[_0x5fa1('0x43')][_0x5fa1('0x7c')]?{'message':_0x5fa1('0x7f'),'statusCode':_0x1b56db['statusCode']}:_0x1b56db);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 660e5b1..b255c7f 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.model.js +++ b/server/api/intZendeskAccount/intZendeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x686a=['../../config/environment','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','request-promise','path'];(function(_0x5515fa,_0x41f7fb){var _0x2e0253=function(_0x2ddb07){while(--_0x2ddb07){_0x5515fa['push'](_0x5515fa['shift']());}};_0x2e0253(++_0x41f7fb);}(_0x686a,0x195));var _0xa686=function(_0x511907,_0x4ae413){_0x511907=_0x511907-0x0;var _0x5e58e6=_0x686a[_0x511907];return _0x5e58e6;};'use strict';var _=require('lodash');var util=require(_0xa686('0x0'));var logger=require(_0xa686('0x1'))(_0xa686('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa686('0x3'));var fs=require('fs');var path=require(_0xa686('0x4'));var rimraf=require('rimraf');var config=require(_0xa686('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa686('0x6'));module[_0xa686('0x7')]=function(_0x2147f2,_0x42f4b5){return _0x2147f2['define'](_0xa686('0x8'),attributes,{'tableName':_0xa686('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe058=['moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','lodash','util','../../config/logger','api'];(function(_0x148396,_0x1b4fa5){var _0x5d9005=function(_0x590e08){while(--_0x590e08){_0x148396['push'](_0x148396['shift']());}};_0x5d9005(++_0x1b4fa5);}(_0xe058,0x98));var _0x8e05=function(_0x4234d6,_0xffbe15){_0x4234d6=_0x4234d6-0x0;var _0x143722=_0xe058[_0x4234d6];return _0x143722;};'use strict';var _=require(_0x8e05('0x0'));var util=require(_0x8e05('0x1'));var logger=require(_0x8e05('0x2'))(_0x8e05('0x3'));var moment=require(_0x8e05('0x4'));var BPromise=require(_0x8e05('0x5'));var rp=require(_0x8e05('0x6'));var fs=require('fs');var path=require(_0x8e05('0x7'));var rimraf=require(_0x8e05('0x8'));var config=require('../../config/environment');var attributes=require(_0x8e05('0x9'));var integrations=require(_0x8e05('0xa'));module['exports']=function(_0x40f066,_0x3d4c99){return _0x40f066[_0x8e05('0xb')](_0x8e05('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 4cd6197..49d0072 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xcb91[_0x56825b];return _0x69ce77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x4b7b61,_0x578b3a){var _0x4f3c2d=function(_0x23d095){while(--_0x23d095){_0x4b7b61['push'](_0x4b7b61['shift']());}};_0x4f3c2d(++_0x578b3a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b61c5ce..0375869 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb0=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xadb0,0x197));var _0x0adb=function(_0x530638,_0x51ee58){_0x530638=_0x530638-0x0;var _0x18f7b8=_0xadb0[_0x530638];return _0x18f7b8;};'use strict';var multer=require('multer');var util=require(_0x0adb('0x0'));var path=require('path');var timeout=require(_0x0adb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0adb('0x2'));var auth=require(_0x0adb('0x3'));var interaction=require(_0x0adb('0x4'));var config=require(_0x0adb('0x5'));var controller=require(_0x0adb('0x6'));router[_0x0adb('0x7')]('/',auth[_0x0adb('0x8')](),controller[_0x0adb('0x9')]);router[_0x0adb('0x7')](_0x0adb('0xa'),auth[_0x0adb('0x8')](),controller[_0x0adb('0xb')]);router[_0x0adb('0x7')](_0x0adb('0xc'),auth[_0x0adb('0x8')](),controller[_0x0adb('0xd')]);router['get'](_0x0adb('0xe'),auth[_0x0adb('0x8')](),controller[_0x0adb('0xf')]);router['get']('/:id/descriptions',auth[_0x0adb('0x8')](),controller[_0x0adb('0x10')]);router['get'](_0x0adb('0x11'),auth[_0x0adb('0x8')](),controller['getTags']);router[_0x0adb('0x12')]('/',auth[_0x0adb('0x8')](),controller[_0x0adb('0x13')]);router[_0x0adb('0x12')]('/:id/tags',auth[_0x0adb('0x8')](),controller[_0x0adb('0x14')]);router[_0x0adb('0x15')]('/:id',auth[_0x0adb('0x8')](),controller[_0x0adb('0x16')]);router[_0x0adb('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x0adb('0x18')]);module[_0x0adb('0x19')]=router; \ No newline at end of file +var _0x5f2f=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0x5f2f,0x92));var _0xf5f2=function(_0x2a5b19,_0x59ebeb){_0x2a5b19=_0x2a5b19-0x0;var _0x436f15=_0x5f2f[_0x2a5b19];return _0x436f15;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require('connect-timeout');var express=require(_0xf5f2('0x3'));var router=express[_0xf5f2('0x4')]();var fs_extra=require(_0xf5f2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf5f2('0x6'));var config=require('../../config/environment');var controller=require(_0xf5f2('0x7'));router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router['get'](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x8')](_0xf5f2('0xe'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x8')](_0xf5f2('0x10'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x8')](_0xf5f2('0x12'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x14')]('/:id/tags',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x16')]);router[_0xf5f2('0x17')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x18')]);router[_0xf5f2('0x19')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['destroy']);module[_0xf5f2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 9386620..425cd0c 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48b1=['exports','STRING','sequelize'];(function(_0x37c61d,_0x20f2a9){var _0x50c3a7=function(_0x5f2bd2){while(--_0x5f2bd2){_0x37c61d['push'](_0x37c61d['shift']());}};_0x50c3a7(++_0x20f2a9);}(_0x48b1,0x19d));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x148b('0x0'));module[_0x148b('0x1')]={'name':{'type':Sequelize[_0x148b('0x2')]},'description':{'type':Sequelize[_0x148b('0x2')]}}; \ No newline at end of file +var _0xdbf3=['STRING','sequelize'];(function(_0x55667b,_0x3b7c1b){var _0x5eadb1=function(_0x1655e1){while(--_0x1655e1){_0x55667b['push'](_0x55667b['shift']());}};_0x5eadb1(++_0x3b7c1b);}(_0xdbf3,0xab));var _0x3dbf=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xdbf3[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0x3dbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x3dbf('0x1')]},'description':{'type':Sequelize[_0x3dbf('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 23723d9..ead0eb1 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5698=['reject','update','then','stack','name','send','render','merge','contact','agent','interaction','account','ZendeskConfiguration','rawAttributes','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','VIRTUAL','options','include','catch','show','params','create','body','find','getFields','ZendeskField','findOne','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x573307,_0x5a7b41){var _0x15f84b=function(_0x5efbc0){while(--_0x5efbc0){_0x573307['push'](_0x573307['shift']());}};_0x15f84b(++_0x5a7b41);}(_0x5698,0xf4));var _0x8569=function(_0x5e9850,_0x291edf){_0x5e9850=_0x5e9850-0x0;var _0x2d3d96=_0x5698[_0x5e9850];return _0x2d3d96;};'use strict';var emlformat=require(_0x8569('0x0'));var rimraf=require(_0x8569('0x1'));var zipdir=require(_0x8569('0x2'));var jsonpatch=require(_0x8569('0x3'));var rp=require(_0x8569('0x4'));var moment=require(_0x8569('0x5'));var BPromise=require(_0x8569('0x6'));var Mustache=require(_0x8569('0x7'));var util=require(_0x8569('0x8'));var path=require(_0x8569('0x9'));var sox=require(_0x8569('0xa'));var csv=require(_0x8569('0xb'));var ejs=require(_0x8569('0xc'));var fs=require('fs');var fs_extra=require(_0x8569('0xd'));var _=require(_0x8569('0xe'));var squel=require('squel');var crypto=require(_0x8569('0xf'));var jsforce=require(_0x8569('0x10'));var deskjs=require(_0x8569('0x11'));var toCsv=require(_0x8569('0xb'));var querystring=require(_0x8569('0x12'));var Papa=require('papaparse');var Redis=require(_0x8569('0x13'));var authService=require(_0x8569('0x14'));var qs=require(_0x8569('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8569('0x16'));var logger=require(_0x8569('0x17'))(_0x8569('0x18'));var utils=require(_0x8569('0x19'));var config=require(_0x8569('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8569('0x1b'))['db'];var jayson=require(_0x8569('0x1c'));var client=jayson[_0x8569('0x1d')][_0x8569('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2c5c57,_0x62a4da,_0x41547e,_0x38339f){return new BPromise(function(_0x28d97f,_0x30e092){var _0x346511=_0x38339f||client;return _0x346511['request'](_0x2c5c57,_0x41547e)['then'](function(_0x13c968){logger['info'](_0x8569('0x1f'),_0x62a4da,'request\x20sent');logger[_0x8569('0x20')](_0x8569('0x21'),_0x62a4da,_0x8569('0x22'),JSON[_0x8569('0x23')](_0x13c968));if(_0x13c968[_0x8569('0x24')]){if(_0x13c968[_0x8569('0x24')][_0x8569('0x25')]===0x1f4){logger[_0x8569('0x24')](_0x8569('0x1f'),_0x62a4da,_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);return _0x30e092(_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);}logger[_0x8569('0x24')]('ZendeskConfiguration,\x20%s,\x20%s',_0x62a4da,_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);return _0x28d97f(_0x13c968[_0x8569('0x24')][_0x8569('0x26')]);}else{logger[_0x8569('0x27')](_0x8569('0x1f'),_0x62a4da,'request\x20sent');_0x28d97f(_0x13c968['result'][_0x8569('0x26')]);}})['catch'](function(_0x36bbc8){logger[_0x8569('0x24')](_0x8569('0x1f'),_0x62a4da,_0x36bbc8);_0x30e092(_0x36bbc8);});});}function respondWithStatusCode(_0x341092,_0x316835){_0x316835=_0x316835||0xcc;return function(_0x2973e7){if(_0x2973e7){return _0x341092[_0x8569('0x28')](_0x316835);}return _0x341092[_0x8569('0x29')](_0x316835)[_0x8569('0x2a')]();};}function respondWithResult(_0x29b62e,_0x5b9f7c){_0x5b9f7c=_0x5b9f7c||0xc8;return function(_0x4e8b90){if(_0x4e8b90){return _0x29b62e['status'](_0x5b9f7c)['json'](_0x4e8b90);}};}function respondWithFilteredResult(_0x4f90d1,_0x1377c0){return function(_0x34e0ce){if(_0x34e0ce){var _0x32969d=typeof _0x1377c0[_0x8569('0x2b')]===_0x8569('0x2c')&&typeof _0x1377c0[_0x8569('0x2d')]===_0x8569('0x2c');var _0x3cf83b=_0x34e0ce[_0x8569('0x2e')];var _0x350964=_0x32969d?0x0:_0x1377c0['offset'];var _0x5921e9=_0x32969d?_0x34e0ce[_0x8569('0x2e')]:_0x1377c0['offset']+_0x1377c0[_0x8569('0x2d')];var _0x15e7ae;if(_0x5921e9>=_0x3cf83b){_0x5921e9=_0x3cf83b;_0x15e7ae=0xc8;}else{_0x15e7ae=0xce;}_0x4f90d1['status'](_0x15e7ae);return _0x4f90d1['set'](_0x8569('0x2f'),_0x350964+'-'+_0x5921e9+'/'+_0x3cf83b)[_0x8569('0x30')](_0x34e0ce);}return null;};}function patchUpdates(_0x1d1cad){return function(_0x13af64){try{jsonpatch[_0x8569('0x31')](_0x13af64,_0x1d1cad,!![]);}catch(_0x592d71){return BPromise[_0x8569('0x32')](_0x592d71);}return _0x13af64['save']();};}function saveUpdates(_0x1b29de,_0x29e801){return function(_0x37c6ce){if(_0x37c6ce){return _0x37c6ce[_0x8569('0x33')](_0x1b29de)[_0x8569('0x34')](function(_0x50f1de){return _0x50f1de;});}return null;};}function removeEntity(_0x5eefa9,_0x18ae5e){return function(_0x2deccc){if(_0x2deccc){return _0x2deccc['destroy']()['then'](function(){_0x5eefa9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfa8e,_0x131744){return function(_0x34bc58){if(!_0x34bc58){_0x2cfa8e['sendStatus'](0x194);}return _0x34bc58;};}function handleError(_0x30249d,_0x504b08){_0x504b08=_0x504b08||0x1f4;return function(_0x2c6a12){logger[_0x8569('0x24')](_0x2c6a12[_0x8569('0x35')]);if(_0x2c6a12[_0x8569('0x36')]){delete _0x2c6a12['name'];}_0x30249d['status'](_0x504b08)[_0x8569('0x37')](_0x2c6a12);};}function getMustacheRender(_0x13e90f,_0x5234c5){return Mustache[_0x8569('0x38')](_0x13e90f,_[_0x8569('0x39')](_0x5234c5['body'],{'contact':_0x5234c5[_0x8569('0x3a')],'message':_0x5234c5[_0x8569('0x26')],'agent':_0x5234c5[_0x8569('0x3b')],'interaction':_0x5234c5[_0x8569('0x3c')],'account':_0x5234c5[_0x8569('0x3d')]}))||'';}exports['index']=function(_0x27ae57,_0x35221c){var _0x1ee91d={},_0x3b9262={},_0x202ee9={'count':0x0,'rows':[]};var _0x4a2f3c=_['map'](db[_0x8569('0x3e')][_0x8569('0x3f')],function(_0x45d726){return{'name':_0x45d726['fieldName'],'type':_0x45d726[_0x8569('0x40')][_0x8569('0x41')]};});_0x3b9262['model']=_['map'](_0x4a2f3c,'name');_0x3b9262['query']=_[_0x8569('0x42')](_0x27ae57[_0x8569('0x43')]);_0x3b9262['filters']=_['intersection'](_0x3b9262['model'],_0x3b9262[_0x8569('0x43')]);_0x1ee91d[_0x8569('0x44')]=_[_0x8569('0x45')](_0x3b9262[_0x8569('0x46')],qs[_0x8569('0x47')](_0x27ae57[_0x8569('0x43')][_0x8569('0x47')]));_0x1ee91d['attributes']=_0x1ee91d[_0x8569('0x44')][_0x8569('0x48')]?_0x1ee91d['attributes']:_0x3b9262[_0x8569('0x46')];if(!_0x27ae57[_0x8569('0x43')][_0x8569('0x49')](_0x8569('0x4a'))){_0x1ee91d[_0x8569('0x2d')]=qs['limit'](_0x27ae57['query'][_0x8569('0x2d')]);_0x1ee91d['offset']=qs[_0x8569('0x2b')](_0x27ae57['query'][_0x8569('0x2b')]);}_0x1ee91d[_0x8569('0x4b')]=qs[_0x8569('0x4c')](_0x27ae57[_0x8569('0x43')][_0x8569('0x4c')]);_0x1ee91d['where']=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0x27ae57[_0x8569('0x43')],_0x3b9262[_0x8569('0x4d')]),_0x4a2f3c);if(_0x27ae57[_0x8569('0x43')][_0x8569('0x4f')]){_0x1ee91d[_0x8569('0x50')]=_[_0x8569('0x39')](_0x1ee91d[_0x8569('0x50')],{'$or':_[_0x8569('0x51')](_0x4a2f3c,function(_0x5b412c){if(_0x5b412c[_0x8569('0x40')]!==_0x8569('0x52')){var _0x5cf4df={};_0x5cf4df[_0x5b412c[_0x8569('0x36')]]={'$like':'%'+_0x27ae57[_0x8569('0x43')][_0x8569('0x4f')]+'%'};return _0x5cf4df;}})});}_0x1ee91d=_['merge']({},_0x1ee91d,_0x27ae57[_0x8569('0x53')]);var _0x52af5d={'where':_0x1ee91d[_0x8569('0x50')]};return db[_0x8569('0x3e')][_0x8569('0x2e')](_0x52af5d)[_0x8569('0x34')](function(_0x28dcbf){_0x202ee9[_0x8569('0x2e')]=_0x28dcbf;if(_0x27ae57['query']['includeAll']){_0x1ee91d[_0x8569('0x54')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x1ee91d);})['then'](function(_0x5cbb35){_0x202ee9['rows']=_0x5cbb35;return _0x202ee9;})[_0x8569('0x34')](respondWithFilteredResult(_0x35221c,_0x1ee91d))[_0x8569('0x55')](handleError(_0x35221c,null));};exports[_0x8569('0x56')]=function(_0x2d4458,_0x5b053e){var _0x37433d={'raw':![],'where':{'id':_0x2d4458[_0x8569('0x57')]['id']}},_0x2b6fd1={};_0x2b6fd1[_0x8569('0x46')]=_[_0x8569('0x42')](db[_0x8569('0x3e')][_0x8569('0x3f')]);_0x2b6fd1['query']=_['keys'](_0x2d4458[_0x8569('0x43')]);_0x2b6fd1[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x2b6fd1[_0x8569('0x46')],_0x2b6fd1[_0x8569('0x43')]);_0x37433d['attributes']=_[_0x8569('0x45')](_0x2b6fd1[_0x8569('0x46')],qs[_0x8569('0x47')](_0x2d4458['query'][_0x8569('0x47')]));_0x37433d[_0x8569('0x44')]=_0x37433d[_0x8569('0x44')][_0x8569('0x48')]?_0x37433d[_0x8569('0x44')]:_0x2b6fd1[_0x8569('0x46')];if(_0x2d4458[_0x8569('0x43')]['includeAll']){_0x37433d[_0x8569('0x54')]=[{'all':!![]}];}_0x37433d=_[_0x8569('0x39')]({},_0x37433d,_0x2d4458[_0x8569('0x53')]);return db[_0x8569('0x3e')]['find'](_0x37433d)[_0x8569('0x34')](handleEntityNotFound(_0x5b053e,null))[_0x8569('0x34')](respondWithResult(_0x5b053e,null))[_0x8569('0x55')](handleError(_0x5b053e,null));};exports['create']=function(_0xc30a81,_0x219cba){return db[_0x8569('0x3e')][_0x8569('0x58')](_0xc30a81[_0x8569('0x59')],{})['then'](respondWithResult(_0x219cba,0xc9))[_0x8569('0x55')](handleError(_0x219cba,null));};exports[_0x8569('0x33')]=function(_0x271448,_0x2db8fa){if(_0x271448[_0x8569('0x59')]['id']){delete _0x271448[_0x8569('0x59')]['id'];}return db[_0x8569('0x3e')][_0x8569('0x5a')]({'where':{'id':_0x271448[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x2db8fa,null))[_0x8569('0x34')](saveUpdates(_0x271448[_0x8569('0x59')],null))[_0x8569('0x34')](respondWithResult(_0x2db8fa,null))[_0x8569('0x55')](handleError(_0x2db8fa,null));};exports['destroy']=function(_0x5ea6f6,_0x2f9c2d){return db[_0x8569('0x3e')]['find']({'where':{'id':_0x5ea6f6[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x2f9c2d,null))[_0x8569('0x34')](removeEntity(_0x2f9c2d,null))[_0x8569('0x55')](handleError(_0x2f9c2d,null));};exports[_0x8569('0x5b')]=function(_0x3f3b37,_0x59b3be,_0x5f3d0a){var _0x1642e5={};var _0xff40ec={};var _0x2d5c3;var _0x3deb40;return db[_0x8569('0x3e')]['findOne']({'where':{'id':_0x3f3b37[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x59b3be,null))[_0x8569('0x34')](function(_0x1b1ed2){if(_0x1b1ed2){_0x2d5c3=_0x1b1ed2;_0xff40ec[_0x8569('0x46')]=_[_0x8569('0x42')](db[_0x8569('0x5c')][_0x8569('0x3f')]);_0xff40ec[_0x8569('0x43')]=_[_0x8569('0x42')](_0x3f3b37[_0x8569('0x43')]);_0xff40ec[_0x8569('0x4d')]=_[_0x8569('0x45')](_0xff40ec[_0x8569('0x46')],_0xff40ec[_0x8569('0x43')]);_0x1642e5[_0x8569('0x44')]=_['intersection'](_0xff40ec[_0x8569('0x46')],qs['fields'](_0x3f3b37[_0x8569('0x43')]['fields']));_0x1642e5[_0x8569('0x44')]=_0x1642e5[_0x8569('0x44')]['length']?_0x1642e5['attributes']:_0xff40ec[_0x8569('0x46')];_0x1642e5[_0x8569('0x4b')]=qs[_0x8569('0x4c')](_0x3f3b37['query']['sort']);_0x1642e5[_0x8569('0x50')]=qs[_0x8569('0x4d')](_['pick'](_0x3f3b37[_0x8569('0x43')],_0xff40ec['filters']));if(_0x3f3b37[_0x8569('0x43')][_0x8569('0x4f')]){_0x1642e5['where']=_[_0x8569('0x39')](_0x1642e5['where'],{'$or':_[_0x8569('0x51')](_0x1642e5[_0x8569('0x44')],function(_0x41c3e0){var _0x174296={};_0x174296[_0x41c3e0]={'$like':'%'+_0x3f3b37['query'][_0x8569('0x4f')]+'%'};return _0x174296;})});}_0x1642e5=_[_0x8569('0x39')]({},_0x1642e5,_0x3f3b37[_0x8569('0x53')]);return _0x2d5c3['getFields'](_0x1642e5);}})[_0x8569('0x34')](function(_0x5c18f6){if(_0x5c18f6){_0x3deb40=_0x5c18f6[_0x8569('0x48')];if(!_0x3f3b37[_0x8569('0x43')][_0x8569('0x49')]('nolimit')){_0x1642e5[_0x8569('0x2d')]=qs[_0x8569('0x2d')](_0x3f3b37['query']['limit']);_0x1642e5['offset']=qs[_0x8569('0x2b')](_0x3f3b37[_0x8569('0x43')]['offset']);}return _0x2d5c3['getFields'](_0x1642e5);}})[_0x8569('0x34')](function(_0x4607d1){if(_0x4607d1){return _0x4607d1?{'count':_0x3deb40,'rows':_0x4607d1}:null;}})[_0x8569('0x34')](respondWithResult(_0x59b3be,null))['catch'](handleError(_0x59b3be,null));};exports['getSubjects']=function(_0x11adc7,_0x4e9a0e,_0x5988d2){var _0x4d9c2a={};var _0x29f02f={};var _0x252154;var _0x386445;return db['ZendeskConfiguration'][_0x8569('0x5d')]({'where':{'id':_0x11adc7[_0x8569('0x57')]['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x4e9a0e,null))[_0x8569('0x34')](function(_0x251ce6){if(_0x251ce6){_0x252154=_0x251ce6;_0x29f02f[_0x8569('0x46')]=_[_0x8569('0x42')](db[_0x8569('0x5c')][_0x8569('0x3f')]);_0x29f02f['query']=_['keys'](_0x11adc7[_0x8569('0x43')]);_0x29f02f[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x29f02f['model'],_0x29f02f[_0x8569('0x43')]);_0x4d9c2a[_0x8569('0x44')]=_[_0x8569('0x45')](_0x29f02f[_0x8569('0x46')],qs['fields'](_0x11adc7[_0x8569('0x43')][_0x8569('0x47')]));_0x4d9c2a[_0x8569('0x44')]=_0x4d9c2a[_0x8569('0x44')]['length']?_0x4d9c2a['attributes']:_0x29f02f['model'];_0x4d9c2a[_0x8569('0x4b')]=qs['sort'](_0x11adc7['query'][_0x8569('0x4c')]);_0x4d9c2a['where']=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0x11adc7['query'],_0x29f02f[_0x8569('0x4d')]));if(_0x11adc7[_0x8569('0x43')][_0x8569('0x4f')]){_0x4d9c2a['where']=_['merge'](_0x4d9c2a[_0x8569('0x50')],{'$or':_['map'](_0x4d9c2a['attributes'],function(_0x4b3aa0){var _0x10a6b3={};_0x10a6b3[_0x4b3aa0]={'$like':'%'+_0x11adc7[_0x8569('0x43')][_0x8569('0x4f')]+'%'};return _0x10a6b3;})});}_0x4d9c2a=_[_0x8569('0x39')]({},_0x4d9c2a,_0x11adc7[_0x8569('0x53')]);return _0x252154[_0x8569('0x5e')](_0x4d9c2a);}})[_0x8569('0x34')](function(_0xdfa19c){if(_0xdfa19c){_0x386445=_0xdfa19c[_0x8569('0x48')];if(!_0x11adc7[_0x8569('0x43')][_0x8569('0x49')](_0x8569('0x4a'))){_0x4d9c2a['limit']=qs[_0x8569('0x2d')](_0x11adc7[_0x8569('0x43')]['limit']);_0x4d9c2a[_0x8569('0x2b')]=qs[_0x8569('0x2b')](_0x11adc7[_0x8569('0x43')][_0x8569('0x2b')]);}return _0x252154[_0x8569('0x5e')](_0x4d9c2a);}})['then'](function(_0x2f80e0){if(_0x2f80e0){return _0x2f80e0?{'count':_0x386445,'rows':_0x2f80e0}:null;}})[_0x8569('0x34')](respondWithResult(_0x4e9a0e,null))[_0x8569('0x55')](handleError(_0x4e9a0e,null));};exports['getDescriptions']=function(_0x5a11a0,_0x3e570d,_0x1199fc){var _0x4575a8={};var _0x39bd60={};var _0x2c05e8;var _0x5449c1;return db[_0x8569('0x3e')][_0x8569('0x5d')]({'where':{'id':_0x5a11a0['params']['id']}})['then'](handleEntityNotFound(_0x3e570d,null))[_0x8569('0x34')](function(_0x127b9d){if(_0x127b9d){_0x2c05e8=_0x127b9d;_0x39bd60['model']=_['keys'](db[_0x8569('0x5c')][_0x8569('0x3f')]);_0x39bd60[_0x8569('0x43')]=_[_0x8569('0x42')](_0x5a11a0[_0x8569('0x43')]);_0x39bd60[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x39bd60[_0x8569('0x46')],_0x39bd60[_0x8569('0x43')]);_0x4575a8['attributes']=_[_0x8569('0x45')](_0x39bd60['model'],qs[_0x8569('0x47')](_0x5a11a0['query'][_0x8569('0x47')]));_0x4575a8[_0x8569('0x44')]=_0x4575a8[_0x8569('0x44')][_0x8569('0x48')]?_0x4575a8[_0x8569('0x44')]:_0x39bd60[_0x8569('0x46')];_0x4575a8['order']=qs[_0x8569('0x4c')](_0x5a11a0[_0x8569('0x43')][_0x8569('0x4c')]);_0x4575a8['where']=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0x5a11a0['query'],_0x39bd60[_0x8569('0x4d')]));if(_0x5a11a0[_0x8569('0x43')][_0x8569('0x4f')]){_0x4575a8[_0x8569('0x50')]=_[_0x8569('0x39')](_0x4575a8[_0x8569('0x50')],{'$or':_[_0x8569('0x51')](_0x4575a8['attributes'],function(_0x422fe6){var _0x3cb94a={};_0x3cb94a[_0x422fe6]={'$like':'%'+_0x5a11a0[_0x8569('0x43')][_0x8569('0x4f')]+'%'};return _0x3cb94a;})});}_0x4575a8=_[_0x8569('0x39')]({},_0x4575a8,_0x5a11a0['options']);return _0x2c05e8['getDescriptions'](_0x4575a8);}})[_0x8569('0x34')](function(_0x4df029){if(_0x4df029){_0x5449c1=_0x4df029[_0x8569('0x48')];if(!_0x5a11a0[_0x8569('0x43')][_0x8569('0x49')]('nolimit')){_0x4575a8[_0x8569('0x2d')]=qs[_0x8569('0x2d')](_0x5a11a0[_0x8569('0x43')][_0x8569('0x2d')]);_0x4575a8[_0x8569('0x2b')]=qs[_0x8569('0x2b')](_0x5a11a0[_0x8569('0x43')][_0x8569('0x2b')]);}return _0x2c05e8[_0x8569('0x5f')](_0x4575a8);}})[_0x8569('0x34')](function(_0x4ea51f){if(_0x4ea51f){return _0x4ea51f?{'count':_0x5449c1,'rows':_0x4ea51f}:null;}})[_0x8569('0x34')](respondWithResult(_0x3e570d,null))['catch'](handleError(_0x3e570d,null));};exports[_0x8569('0x60')]=function(_0xec7d63,_0x3f82db,_0x3918be){var _0x4fdb42={};var _0x5b1154={};var _0x1932b5;var _0x4c03aa;return db[_0x8569('0x3e')][_0x8569('0x5d')]({'where':{'id':_0xec7d63['params']['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x3f82db,null))[_0x8569('0x34')](function(_0x1328f4){if(_0x1328f4){_0x1932b5=_0x1328f4;_0x5b1154[_0x8569('0x46')]=_[_0x8569('0x42')](db['Tag'][_0x8569('0x3f')]);_0x5b1154[_0x8569('0x43')]=_[_0x8569('0x42')](_0xec7d63[_0x8569('0x43')]);_0x5b1154[_0x8569('0x4d')]=_[_0x8569('0x45')](_0x5b1154[_0x8569('0x46')],_0x5b1154[_0x8569('0x43')]);_0x4fdb42[_0x8569('0x44')]=_[_0x8569('0x45')](_0x5b1154[_0x8569('0x46')],qs['fields'](_0xec7d63[_0x8569('0x43')][_0x8569('0x47')]));_0x4fdb42[_0x8569('0x44')]=_0x4fdb42[_0x8569('0x44')]['length']?_0x4fdb42[_0x8569('0x44')]:_0x5b1154[_0x8569('0x46')];_0x4fdb42[_0x8569('0x4b')]=qs[_0x8569('0x4c')](_0xec7d63[_0x8569('0x43')][_0x8569('0x4c')]);_0x4fdb42[_0x8569('0x50')]=qs[_0x8569('0x4d')](_[_0x8569('0x4e')](_0xec7d63['query'],_0x5b1154[_0x8569('0x4d')]));if(_0xec7d63[_0x8569('0x43')][_0x8569('0x4f')]){_0x4fdb42[_0x8569('0x50')]=_[_0x8569('0x39')](_0x4fdb42[_0x8569('0x50')],{'$or':_['map'](_0x4fdb42[_0x8569('0x44')],function(_0x257446){var _0x2e98b2={};_0x2e98b2[_0x257446]={'$like':'%'+_0xec7d63['query']['filter']+'%'};return _0x2e98b2;})});}_0x4fdb42=_[_0x8569('0x39')]({},_0x4fdb42,_0xec7d63[_0x8569('0x53')]);return _0x1932b5[_0x8569('0x60')](_0x4fdb42);}})[_0x8569('0x34')](function(_0x8d1dee){if(_0x8d1dee){_0x4c03aa=_0x8d1dee[_0x8569('0x48')];if(!_0xec7d63['query'][_0x8569('0x49')](_0x8569('0x4a'))){_0x4fdb42[_0x8569('0x2d')]=qs[_0x8569('0x2d')](_0xec7d63[_0x8569('0x43')]['limit']);_0x4fdb42[_0x8569('0x2b')]=qs['offset'](_0xec7d63[_0x8569('0x43')][_0x8569('0x2b')]);}return _0x1932b5[_0x8569('0x60')](_0x4fdb42);}})[_0x8569('0x34')](function(_0x217d8b){if(_0x217d8b){return _0x217d8b?{'count':_0x4c03aa,'rows':_0x217d8b}:null;}})[_0x8569('0x34')](respondWithResult(_0x3f82db,null))['catch'](handleError(_0x3f82db,null));};exports[_0x8569('0x61')]=function(_0x43025b,_0x346343,_0x42a6c){if(_0x43025b[_0x8569('0x59')]['id']){delete _0x43025b[_0x8569('0x59')]['id'];}return db['ZendeskConfiguration'][_0x8569('0x5d')]({'where':{'id':_0x43025b['params']['id']}})[_0x8569('0x34')](handleEntityNotFound(_0x346343,null))[_0x8569('0x34')](function(_0x456559){if(_0x456559){return _0x456559[_0x8569('0x61')](_0x43025b['body']['ids']||[]);}return null;})[_0x8569('0x34')](respondWithResult(_0x346343,null))[_0x8569('0x55')](handleError(_0x346343,null));}; \ No newline at end of file +var _0x3704=['keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filter','where','options','count','findAll','catch','params','include','find','create','getFields','sort','pick','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','undefined','limit','reject','save','update','destroy','stack','name','send','merge','body','contact','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model'];(function(_0x402496,_0x337e33){var _0x4cbc2d=function(_0x279623){while(--_0x279623){_0x402496['push'](_0x402496['shift']());}};_0x4cbc2d(++_0x337e33);}(_0x3704,0x1dc));var _0x4370=function(_0x3eda23,_0x45ee83){_0x3eda23=_0x3eda23-0x0;var _0x222714=_0x3704[_0x3eda23];return _0x222714;};'use strict';var emlformat=require(_0x4370('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4370('0x1'));var jsonpatch=require(_0x4370('0x2'));var rp=require(_0x4370('0x3'));var moment=require('moment');var BPromise=require(_0x4370('0x4'));var Mustache=require('mustache');var util=require(_0x4370('0x5'));var path=require(_0x4370('0x6'));var sox=require(_0x4370('0x7'));var csv=require(_0x4370('0x8'));var ejs=require(_0x4370('0x9'));var fs=require('fs');var fs_extra=require(_0x4370('0xa'));var _=require(_0x4370('0xb'));var squel=require('squel');var crypto=require(_0x4370('0xc'));var jsforce=require(_0x4370('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4370('0xe'));var Papa=require(_0x4370('0xf'));var Redis=require('ioredis');var authService=require(_0x4370('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4370('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4370('0x12'))(_0x4370('0x13'));var utils=require(_0x4370('0x14'));var config=require(_0x4370('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4370('0x16'))['db'];var jayson=require(_0x4370('0x17'));var client=jayson[_0x4370('0x18')][_0x4370('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3f3691,_0x4580fd,_0x4f1dec,_0x4b1981){return new BPromise(function(_0x12c37e,_0x48292d){var _0x25678b=_0x4b1981||client;return _0x25678b[_0x4370('0x1a')](_0x3f3691,_0x4f1dec)[_0x4370('0x1b')](function(_0x5308f0){logger[_0x4370('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4580fd,_0x4370('0x1d'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4580fd,_0x4370('0x1d'),JSON[_0x4370('0x1e')](_0x5308f0));if(_0x5308f0['error']){if(_0x5308f0[_0x4370('0x1f')]['code']===0x1f4){logger['error'](_0x4370('0x20'),_0x4580fd,_0x5308f0[_0x4370('0x1f')][_0x4370('0x21')]);return _0x48292d(_0x5308f0[_0x4370('0x1f')][_0x4370('0x21')]);}logger[_0x4370('0x1f')](_0x4370('0x20'),_0x4580fd,_0x5308f0[_0x4370('0x1f')][_0x4370('0x21')]);return _0x12c37e(_0x5308f0[_0x4370('0x1f')][_0x4370('0x21')]);}else{logger[_0x4370('0x1c')](_0x4370('0x20'),_0x4580fd,_0x4370('0x1d'));_0x12c37e(_0x5308f0['result'][_0x4370('0x21')]);}})['catch'](function(_0x38009e){logger[_0x4370('0x1f')](_0x4370('0x20'),_0x4580fd,_0x38009e);_0x48292d(_0x38009e);});});}function respondWithStatusCode(_0x4e85fa,_0x5e1666){_0x5e1666=_0x5e1666||0xcc;return function(_0x38e7fe){if(_0x38e7fe){return _0x4e85fa[_0x4370('0x22')](_0x5e1666);}return _0x4e85fa[_0x4370('0x23')](_0x5e1666)[_0x4370('0x24')]();};}function respondWithResult(_0x390128,_0x26316e){_0x26316e=_0x26316e||0xc8;return function(_0x302e71){if(_0x302e71){return _0x390128['status'](_0x26316e)[_0x4370('0x25')](_0x302e71);}};}function respondWithFilteredResult(_0x299d35,_0x371e71){return function(_0xbe2cdb){if(_0xbe2cdb){var _0x584918=typeof _0x371e71[_0x4370('0x26')]===_0x4370('0x27')&&typeof _0x371e71['limit']===_0x4370('0x27');var _0x137922=_0xbe2cdb['count'];var _0x33f2ef=_0x584918?0x0:_0x371e71[_0x4370('0x26')];var _0x17e0f2=_0x584918?_0xbe2cdb['count']:_0x371e71['offset']+_0x371e71[_0x4370('0x28')];var _0x2f52ed;if(_0x17e0f2>=_0x137922){_0x17e0f2=_0x137922;_0x2f52ed=0xc8;}else{_0x2f52ed=0xce;}_0x299d35['status'](_0x2f52ed);return _0x299d35['set']('Content-Range',_0x33f2ef+'-'+_0x17e0f2+'/'+_0x137922)['json'](_0xbe2cdb);}return null;};}function patchUpdates(_0x148f83){return function(_0x395c52){try{jsonpatch['apply'](_0x395c52,_0x148f83,!![]);}catch(_0x30a93f){return BPromise[_0x4370('0x29')](_0x30a93f);}return _0x395c52[_0x4370('0x2a')]();};}function saveUpdates(_0x255457,_0x26a963){return function(_0x25adcc){if(_0x25adcc){return _0x25adcc[_0x4370('0x2b')](_0x255457)[_0x4370('0x1b')](function(_0x32840c){return _0x32840c;});}return null;};}function removeEntity(_0xb02d00,_0x28e7f5){return function(_0x3ded2b){if(_0x3ded2b){return _0x3ded2b[_0x4370('0x2c')]()[_0x4370('0x1b')](function(){_0xb02d00[_0x4370('0x23')](0xcc)[_0x4370('0x24')]();});}};}function handleEntityNotFound(_0x3e8d4e,_0x25e202){return function(_0xdc18a9){if(!_0xdc18a9){_0x3e8d4e[_0x4370('0x22')](0x194);}return _0xdc18a9;};}function handleError(_0x361b79,_0x12b2eb){_0x12b2eb=_0x12b2eb||0x1f4;return function(_0x32fcd1){logger[_0x4370('0x1f')](_0x32fcd1[_0x4370('0x2d')]);if(_0x32fcd1[_0x4370('0x2e')]){delete _0x32fcd1[_0x4370('0x2e')];}_0x361b79[_0x4370('0x23')](_0x12b2eb)[_0x4370('0x2f')](_0x32fcd1);};}function getMustacheRender(_0x127052,_0x2866b8){return Mustache['render'](_0x127052,_[_0x4370('0x30')](_0x2866b8[_0x4370('0x31')],{'contact':_0x2866b8[_0x4370('0x32')],'message':_0x2866b8[_0x4370('0x21')],'agent':_0x2866b8['agent'],'interaction':_0x2866b8['interaction'],'account':_0x2866b8['account']}))||'';}exports[_0x4370('0x33')]=function(_0x300562,_0x3e5d3e){var _0x5a5a65={},_0x4a418c={},_0x48d8f4={'count':0x0,'rows':[]};var _0x3e4164=_[_0x4370('0x34')](db[_0x4370('0x35')][_0x4370('0x36')],function(_0x2b9148){return{'name':_0x2b9148[_0x4370('0x37')],'type':_0x2b9148[_0x4370('0x38')]['key']};});_0x4a418c[_0x4370('0x39')]=_['map'](_0x3e4164,_0x4370('0x2e'));_0x4a418c['query']=_[_0x4370('0x3a')](_0x300562[_0x4370('0x3b')]);_0x4a418c[_0x4370('0x3c')]=_['intersection'](_0x4a418c['model'],_0x4a418c['query']);_0x5a5a65[_0x4370('0x3d')]=_[_0x4370('0x3e')](_0x4a418c['model'],qs[_0x4370('0x3f')](_0x300562['query'][_0x4370('0x3f')]));_0x5a5a65[_0x4370('0x3d')]=_0x5a5a65['attributes'][_0x4370('0x40')]?_0x5a5a65[_0x4370('0x3d')]:_0x4a418c[_0x4370('0x39')];if(!_0x300562['query'][_0x4370('0x41')](_0x4370('0x42'))){_0x5a5a65['limit']=qs[_0x4370('0x28')](_0x300562['query'][_0x4370('0x28')]);_0x5a5a65[_0x4370('0x26')]=qs[_0x4370('0x26')](_0x300562[_0x4370('0x3b')][_0x4370('0x26')]);}_0x5a5a65[_0x4370('0x43')]=qs['sort'](_0x300562[_0x4370('0x3b')]['sort']);_0x5a5a65['where']=qs[_0x4370('0x3c')](_['pick'](_0x300562[_0x4370('0x3b')],_0x4a418c[_0x4370('0x3c')]),_0x3e4164);if(_0x300562[_0x4370('0x3b')][_0x4370('0x44')]){_0x5a5a65[_0x4370('0x45')]=_[_0x4370('0x30')](_0x5a5a65[_0x4370('0x45')],{'$or':_[_0x4370('0x34')](_0x3e4164,function(_0x3b1463){if(_0x3b1463[_0x4370('0x38')]!=='VIRTUAL'){var _0x5a276b={};_0x5a276b[_0x3b1463[_0x4370('0x2e')]]={'$like':'%'+_0x300562[_0x4370('0x3b')][_0x4370('0x44')]+'%'};return _0x5a276b;}})});}_0x5a5a65=_['merge']({},_0x5a5a65,_0x300562[_0x4370('0x46')]);var _0x5567fd={'where':_0x5a5a65['where']};return db['ZendeskConfiguration'][_0x4370('0x47')](_0x5567fd)['then'](function(_0x5358b2){_0x48d8f4[_0x4370('0x47')]=_0x5358b2;if(_0x300562[_0x4370('0x3b')]['includeAll']){_0x5a5a65['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4370('0x48')](_0x5a5a65);})['then'](function(_0x365105){_0x48d8f4['rows']=_0x365105;return _0x48d8f4;})['then'](respondWithFilteredResult(_0x3e5d3e,_0x5a5a65))[_0x4370('0x49')](handleError(_0x3e5d3e,null));};exports['show']=function(_0x3d4df2,_0x1d25c8){var _0x418a10={'raw':![],'where':{'id':_0x3d4df2[_0x4370('0x4a')]['id']}},_0x2d886e={};_0x2d886e[_0x4370('0x39')]=_['keys'](db[_0x4370('0x35')][_0x4370('0x36')]);_0x2d886e[_0x4370('0x3b')]=_[_0x4370('0x3a')](_0x3d4df2[_0x4370('0x3b')]);_0x2d886e['filters']=_[_0x4370('0x3e')](_0x2d886e['model'],_0x2d886e[_0x4370('0x3b')]);_0x418a10[_0x4370('0x3d')]=_[_0x4370('0x3e')](_0x2d886e[_0x4370('0x39')],qs[_0x4370('0x3f')](_0x3d4df2[_0x4370('0x3b')]['fields']));_0x418a10[_0x4370('0x3d')]=_0x418a10[_0x4370('0x3d')][_0x4370('0x40')]?_0x418a10['attributes']:_0x2d886e[_0x4370('0x39')];if(_0x3d4df2[_0x4370('0x3b')]['includeAll']){_0x418a10[_0x4370('0x4b')]=[{'all':!![]}];}_0x418a10=_[_0x4370('0x30')]({},_0x418a10,_0x3d4df2[_0x4370('0x46')]);return db[_0x4370('0x35')][_0x4370('0x4c')](_0x418a10)['then'](handleEntityNotFound(_0x1d25c8,null))[_0x4370('0x1b')](respondWithResult(_0x1d25c8,null))['catch'](handleError(_0x1d25c8,null));};exports[_0x4370('0x4d')]=function(_0x395488,_0x2e2eb4){return db[_0x4370('0x35')][_0x4370('0x4d')](_0x395488[_0x4370('0x31')],{})[_0x4370('0x1b')](respondWithResult(_0x2e2eb4,0xc9))[_0x4370('0x49')](handleError(_0x2e2eb4,null));};exports['update']=function(_0x596370,_0x304859){if(_0x596370[_0x4370('0x31')]['id']){delete _0x596370[_0x4370('0x31')]['id'];}return db[_0x4370('0x35')][_0x4370('0x4c')]({'where':{'id':_0x596370[_0x4370('0x4a')]['id']}})['then'](handleEntityNotFound(_0x304859,null))[_0x4370('0x1b')](saveUpdates(_0x596370[_0x4370('0x31')],null))[_0x4370('0x1b')](respondWithResult(_0x304859,null))['catch'](handleError(_0x304859,null));};exports[_0x4370('0x2c')]=function(_0x3305b0,_0x3a2b2f){return db[_0x4370('0x35')][_0x4370('0x4c')]({'where':{'id':_0x3305b0[_0x4370('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a2b2f,null))[_0x4370('0x1b')](removeEntity(_0x3a2b2f,null))[_0x4370('0x49')](handleError(_0x3a2b2f,null));};exports[_0x4370('0x4e')]=function(_0x5f006c,_0xbd5f66,_0x167869){var _0x48771f={};var _0x539a8a={};var _0x4b3ed8;var _0x4f21e8;return db[_0x4370('0x35')]['findOne']({'where':{'id':_0x5f006c[_0x4370('0x4a')]['id']}})[_0x4370('0x1b')](handleEntityNotFound(_0xbd5f66,null))[_0x4370('0x1b')](function(_0x4dad95){if(_0x4dad95){_0x4b3ed8=_0x4dad95;_0x539a8a[_0x4370('0x39')]=_[_0x4370('0x3a')](db['ZendeskField']['rawAttributes']);_0x539a8a[_0x4370('0x3b')]=_[_0x4370('0x3a')](_0x5f006c[_0x4370('0x3b')]);_0x539a8a[_0x4370('0x3c')]=_[_0x4370('0x3e')](_0x539a8a[_0x4370('0x39')],_0x539a8a['query']);_0x48771f[_0x4370('0x3d')]=_[_0x4370('0x3e')](_0x539a8a['model'],qs['fields'](_0x5f006c[_0x4370('0x3b')][_0x4370('0x3f')]));_0x48771f[_0x4370('0x3d')]=_0x48771f[_0x4370('0x3d')][_0x4370('0x40')]?_0x48771f[_0x4370('0x3d')]:_0x539a8a[_0x4370('0x39')];_0x48771f['order']=qs[_0x4370('0x4f')](_0x5f006c[_0x4370('0x3b')]['sort']);_0x48771f[_0x4370('0x45')]=qs[_0x4370('0x3c')](_[_0x4370('0x50')](_0x5f006c[_0x4370('0x3b')],_0x539a8a['filters']));if(_0x5f006c[_0x4370('0x3b')][_0x4370('0x44')]){_0x48771f['where']=_[_0x4370('0x30')](_0x48771f[_0x4370('0x45')],{'$or':_['map'](_0x48771f[_0x4370('0x3d')],function(_0x319c78){var _0x1ddfc8={};_0x1ddfc8[_0x319c78]={'$like':'%'+_0x5f006c['query']['filter']+'%'};return _0x1ddfc8;})});}_0x48771f=_['merge']({},_0x48771f,_0x5f006c[_0x4370('0x46')]);return _0x4b3ed8[_0x4370('0x4e')](_0x48771f);}})['then'](function(_0x22445c){if(_0x22445c){_0x4f21e8=_0x22445c['length'];if(!_0x5f006c[_0x4370('0x3b')][_0x4370('0x41')]('nolimit')){_0x48771f[_0x4370('0x28')]=qs[_0x4370('0x28')](_0x5f006c[_0x4370('0x3b')][_0x4370('0x28')]);_0x48771f['offset']=qs['offset'](_0x5f006c['query'][_0x4370('0x26')]);}return _0x4b3ed8[_0x4370('0x4e')](_0x48771f);}})[_0x4370('0x1b')](function(_0x335da1){if(_0x335da1){return _0x335da1?{'count':_0x4f21e8,'rows':_0x335da1}:null;}})[_0x4370('0x1b')](respondWithResult(_0xbd5f66,null))[_0x4370('0x49')](handleError(_0xbd5f66,null));};exports['getSubjects']=function(_0x3c0033,_0x36be57,_0x113ee9){var _0x4255e4={};var _0x429386={};var _0x3e4635;var _0x28d391;return db[_0x4370('0x35')][_0x4370('0x51')]({'where':{'id':_0x3c0033[_0x4370('0x4a')]['id']}})[_0x4370('0x1b')](handleEntityNotFound(_0x36be57,null))[_0x4370('0x1b')](function(_0x55bc93){if(_0x55bc93){_0x3e4635=_0x55bc93;_0x429386[_0x4370('0x39')]=_[_0x4370('0x3a')](db[_0x4370('0x52')][_0x4370('0x36')]);_0x429386[_0x4370('0x3b')]=_[_0x4370('0x3a')](_0x3c0033[_0x4370('0x3b')]);_0x429386[_0x4370('0x3c')]=_[_0x4370('0x3e')](_0x429386[_0x4370('0x39')],_0x429386[_0x4370('0x3b')]);_0x4255e4[_0x4370('0x3d')]=_[_0x4370('0x3e')](_0x429386[_0x4370('0x39')],qs[_0x4370('0x3f')](_0x3c0033[_0x4370('0x3b')][_0x4370('0x3f')]));_0x4255e4['attributes']=_0x4255e4[_0x4370('0x3d')]['length']?_0x4255e4[_0x4370('0x3d')]:_0x429386[_0x4370('0x39')];_0x4255e4[_0x4370('0x43')]=qs[_0x4370('0x4f')](_0x3c0033[_0x4370('0x3b')][_0x4370('0x4f')]);_0x4255e4[_0x4370('0x45')]=qs['filters'](_[_0x4370('0x50')](_0x3c0033[_0x4370('0x3b')],_0x429386['filters']));if(_0x3c0033['query'][_0x4370('0x44')]){_0x4255e4[_0x4370('0x45')]=_[_0x4370('0x30')](_0x4255e4[_0x4370('0x45')],{'$or':_[_0x4370('0x34')](_0x4255e4[_0x4370('0x3d')],function(_0x5d1250){var _0x15c833={};_0x15c833[_0x5d1250]={'$like':'%'+_0x3c0033[_0x4370('0x3b')][_0x4370('0x44')]+'%'};return _0x15c833;})});}_0x4255e4=_[_0x4370('0x30')]({},_0x4255e4,_0x3c0033['options']);return _0x3e4635['getSubjects'](_0x4255e4);}})[_0x4370('0x1b')](function(_0x8f0889){if(_0x8f0889){_0x28d391=_0x8f0889[_0x4370('0x40')];if(!_0x3c0033[_0x4370('0x3b')]['hasOwnProperty']('nolimit')){_0x4255e4[_0x4370('0x28')]=qs[_0x4370('0x28')](_0x3c0033[_0x4370('0x3b')]['limit']);_0x4255e4[_0x4370('0x26')]=qs[_0x4370('0x26')](_0x3c0033[_0x4370('0x3b')][_0x4370('0x26')]);}return _0x3e4635[_0x4370('0x53')](_0x4255e4);}})[_0x4370('0x1b')](function(_0x23322d){if(_0x23322d){return _0x23322d?{'count':_0x28d391,'rows':_0x23322d}:null;}})[_0x4370('0x1b')](respondWithResult(_0x36be57,null))['catch'](handleError(_0x36be57,null));};exports[_0x4370('0x54')]=function(_0x584bbb,_0x3283fb,_0x5215a3){var _0x5abfce={};var _0x2e0d84={};var _0x558811;var _0x5aa0ef;return db[_0x4370('0x35')][_0x4370('0x51')]({'where':{'id':_0x584bbb['params']['id']}})[_0x4370('0x1b')](handleEntityNotFound(_0x3283fb,null))['then'](function(_0x397f31){if(_0x397f31){_0x558811=_0x397f31;_0x2e0d84[_0x4370('0x39')]=_['keys'](db[_0x4370('0x52')][_0x4370('0x36')]);_0x2e0d84[_0x4370('0x3b')]=_[_0x4370('0x3a')](_0x584bbb[_0x4370('0x3b')]);_0x2e0d84[_0x4370('0x3c')]=_[_0x4370('0x3e')](_0x2e0d84[_0x4370('0x39')],_0x2e0d84[_0x4370('0x3b')]);_0x5abfce['attributes']=_[_0x4370('0x3e')](_0x2e0d84[_0x4370('0x39')],qs['fields'](_0x584bbb['query'][_0x4370('0x3f')]));_0x5abfce['attributes']=_0x5abfce['attributes']['length']?_0x5abfce[_0x4370('0x3d')]:_0x2e0d84[_0x4370('0x39')];_0x5abfce[_0x4370('0x43')]=qs['sort'](_0x584bbb[_0x4370('0x3b')][_0x4370('0x4f')]);_0x5abfce['where']=qs[_0x4370('0x3c')](_[_0x4370('0x50')](_0x584bbb[_0x4370('0x3b')],_0x2e0d84[_0x4370('0x3c')]));if(_0x584bbb[_0x4370('0x3b')]['filter']){_0x5abfce[_0x4370('0x45')]=_[_0x4370('0x30')](_0x5abfce[_0x4370('0x45')],{'$or':_['map'](_0x5abfce[_0x4370('0x3d')],function(_0x39edd5){var _0x551832={};_0x551832[_0x39edd5]={'$like':'%'+_0x584bbb['query']['filter']+'%'};return _0x551832;})});}_0x5abfce=_[_0x4370('0x30')]({},_0x5abfce,_0x584bbb[_0x4370('0x46')]);return _0x558811[_0x4370('0x54')](_0x5abfce);}})[_0x4370('0x1b')](function(_0x4a8e9a){if(_0x4a8e9a){_0x5aa0ef=_0x4a8e9a[_0x4370('0x40')];if(!_0x584bbb[_0x4370('0x3b')][_0x4370('0x41')](_0x4370('0x42'))){_0x5abfce[_0x4370('0x28')]=qs[_0x4370('0x28')](_0x584bbb['query'][_0x4370('0x28')]);_0x5abfce[_0x4370('0x26')]=qs['offset'](_0x584bbb['query'][_0x4370('0x26')]);}return _0x558811['getDescriptions'](_0x5abfce);}})[_0x4370('0x1b')](function(_0x3d710c){if(_0x3d710c){return _0x3d710c?{'count':_0x5aa0ef,'rows':_0x3d710c}:null;}})[_0x4370('0x1b')](respondWithResult(_0x3283fb,null))[_0x4370('0x49')](handleError(_0x3283fb,null));};exports[_0x4370('0x55')]=function(_0x4fe630,_0x58a73b,_0x14d4e0){var _0x20bf41={};var _0x50e772={};var _0x7d16bc;var _0x1fee51;return db[_0x4370('0x35')]['findOne']({'where':{'id':_0x4fe630[_0x4370('0x4a')]['id']}})[_0x4370('0x1b')](handleEntityNotFound(_0x58a73b,null))[_0x4370('0x1b')](function(_0x100af1){if(_0x100af1){_0x7d16bc=_0x100af1;_0x50e772[_0x4370('0x39')]=_['keys'](db[_0x4370('0x56')]['rawAttributes']);_0x50e772[_0x4370('0x3b')]=_[_0x4370('0x3a')](_0x4fe630[_0x4370('0x3b')]);_0x50e772[_0x4370('0x3c')]=_['intersection'](_0x50e772[_0x4370('0x39')],_0x50e772[_0x4370('0x3b')]);_0x20bf41['attributes']=_[_0x4370('0x3e')](_0x50e772[_0x4370('0x39')],qs[_0x4370('0x3f')](_0x4fe630[_0x4370('0x3b')][_0x4370('0x3f')]));_0x20bf41[_0x4370('0x3d')]=_0x20bf41[_0x4370('0x3d')][_0x4370('0x40')]?_0x20bf41[_0x4370('0x3d')]:_0x50e772['model'];_0x20bf41[_0x4370('0x43')]=qs[_0x4370('0x4f')](_0x4fe630[_0x4370('0x3b')][_0x4370('0x4f')]);_0x20bf41[_0x4370('0x45')]=qs[_0x4370('0x3c')](_[_0x4370('0x50')](_0x4fe630[_0x4370('0x3b')],_0x50e772[_0x4370('0x3c')]));if(_0x4fe630[_0x4370('0x3b')]['filter']){_0x20bf41[_0x4370('0x45')]=_[_0x4370('0x30')](_0x20bf41[_0x4370('0x45')],{'$or':_[_0x4370('0x34')](_0x20bf41[_0x4370('0x3d')],function(_0x4df1c8){var _0x48bb50={};_0x48bb50[_0x4df1c8]={'$like':'%'+_0x4fe630[_0x4370('0x3b')][_0x4370('0x44')]+'%'};return _0x48bb50;})});}_0x20bf41=_[_0x4370('0x30')]({},_0x20bf41,_0x4fe630[_0x4370('0x46')]);return _0x7d16bc[_0x4370('0x55')](_0x20bf41);}})[_0x4370('0x1b')](function(_0x530550){if(_0x530550){_0x1fee51=_0x530550['length'];if(!_0x4fe630[_0x4370('0x3b')][_0x4370('0x41')](_0x4370('0x42'))){_0x20bf41[_0x4370('0x28')]=qs[_0x4370('0x28')](_0x4fe630[_0x4370('0x3b')][_0x4370('0x28')]);_0x20bf41[_0x4370('0x26')]=qs[_0x4370('0x26')](_0x4fe630['query']['offset']);}return _0x7d16bc['getTags'](_0x20bf41);}})[_0x4370('0x1b')](function(_0x5bc806){if(_0x5bc806){return _0x5bc806?{'count':_0x1fee51,'rows':_0x5bc806}:null;}})['then'](respondWithResult(_0x58a73b,null))['catch'](handleError(_0x58a73b,null));};exports['setTags']=function(_0x372975,_0x181333,_0x1373a6){if(_0x372975[_0x4370('0x31')]['id']){delete _0x372975[_0x4370('0x31')]['id'];}return db[_0x4370('0x35')][_0x4370('0x51')]({'where':{'id':_0x372975[_0x4370('0x4a')]['id']}})[_0x4370('0x1b')](handleEntityNotFound(_0x181333,null))[_0x4370('0x1b')](function(_0x4dec26){if(_0x4dec26){return _0x4dec26[_0x4370('0x57')](_0x372975[_0x4370('0x31')][_0x4370('0x58')]||[]);}return null;})[_0x4370('0x1b')](respondWithResult(_0x181333,null))[_0x4370('0x49')](handleError(_0x181333,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0ed38d0..119f75e 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe19a=['int_zendesk_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe19a,0x194));var _0xae19=function(_0xb14c00,_0x281183){_0xb14c00=_0xb14c00-0x0;var _0x236a87=_0xe19a[_0xb14c00];return _0x236a87;};'use strict';var _=require(_0xae19('0x0'));var util=require(_0xae19('0x1'));var logger=require(_0xae19('0x2'))(_0xae19('0x3'));var moment=require(_0xae19('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae19('0x5'));var rimraf=require(_0xae19('0x6'));var config=require(_0xae19('0x7'));var attributes=require(_0xae19('0x8'));module[_0xae19('0x9')]=function(_0x5790bc,_0x53ede2){return _0x5790bc[_0xae19('0xa')](_0xae19('0xb'),attributes,{'tableName':_0xae19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a45=['exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x27cc1e,_0x338325){var _0x53feeb=function(_0x273188){while(--_0x273188){_0x27cc1e['push'](_0x27cc1e['shift']());}};_0x53feeb(++_0x338325);}(_0x7a45,0xf4));var _0x57a4=function(_0x3dccf2,_0x2cb73f){_0x3dccf2=_0x3dccf2-0x0;var _0x3e9720=_0x7a45[_0x3dccf2];return _0x3e9720;};'use strict';var _=require(_0x57a4('0x0'));var util=require(_0x57a4('0x1'));var logger=require(_0x57a4('0x2'))(_0x57a4('0x3'));var moment=require(_0x57a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x57a4('0x5'));var fs=require('fs');var path=require(_0x57a4('0x6'));var rimraf=require('rimraf');var config=require(_0x57a4('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x57a4('0x8')]=function(_0x3d6d06,_0xf844d3){return _0x3d6d06[_0x57a4('0x9')](_0x57a4('0xa'),attributes,{'tableName':_0x57a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index f403113..ff83c97 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3c57c7,_0x18e494){var _0x9c2cbb=function(_0x4195d0){while(--_0x4195d0){_0x3c57c7['push'](_0x3c57c7['shift']());}};_0x9c2cbb(++_0x18e494);}(_0x5fc3,0xd3));var _0x35fc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5fc3[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var rs=require(_0x35fc('0x2'));var fs=require('fs');var Redis=require(_0x35fc('0x3'));var db=require(_0x35fc('0x4'))['db'];var utils=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('rpc');var config=require(_0x35fc('0x7'));var jayson=require(_0x35fc('0x8'));var client=jayson[_0x35fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2826db,_0x11ac31,_0x3ea841){return new BPromise(function(_0x47718a,_0x2edddf){return client[_0x35fc('0xa')](_0x2826db,_0x3ea841)[_0x35fc('0xb')](function(_0x591885){logger[_0x35fc('0xc')](_0x35fc('0xd'),_0x11ac31,_0x35fc('0xe'));logger[_0x35fc('0xf')](_0x35fc('0x10'),_0x11ac31,_0x35fc('0xe'),JSON['stringify'](_0x591885));if(_0x591885[_0x35fc('0x11')]){if(_0x591885[_0x35fc('0x11')][_0x35fc('0x12')]===0x1f4){logger[_0x35fc('0x11')](_0x35fc('0xd'),_0x11ac31,_0x591885[_0x35fc('0x11')]['message']);return _0x2edddf(_0x591885[_0x35fc('0x11')][_0x35fc('0x13')]);}logger[_0x35fc('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x11ac31,_0x591885[_0x35fc('0x11')]['message']);return _0x47718a(_0x591885[_0x35fc('0x11')]['message']);}else{logger['info'](_0x35fc('0xd'),_0x11ac31,_0x35fc('0xe'));_0x47718a(_0x591885[_0x35fc('0x14')][_0x35fc('0x13')]);}})['catch'](function(_0x4d61a0){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x11ac31,_0x4d61a0);_0x2edddf(_0x4d61a0);});});} \ No newline at end of file +var _0x6ded=['code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2f59c3,_0xb6c471){var _0x22cb72=function(_0x4925bf){while(--_0x4925bf){_0x2f59c3['push'](_0x2f59c3['shift']());}};_0x22cb72(++_0xb6c471);}(_0x6ded,0xb7));var _0xd6de=function(_0xb0c186,_0x2da1f9){_0xb0c186=_0xb0c186-0x0;var _0xc08519=_0x6ded[_0xb0c186];return _0xc08519;};'use strict';var _=require(_0xd6de('0x0'));var util=require(_0xd6de('0x1'));var moment=require('moment');var BPromise=require(_0xd6de('0x2'));var rs=require(_0xd6de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6de('0x5'))('rpc');var config=require(_0xd6de('0x6'));var jayson=require(_0xd6de('0x7'));var client=jayson['client'][_0xd6de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x73750a,_0x3a6f63,_0x1871d3){return new BPromise(function(_0x4c49f9,_0x1d12f8){return client[_0xd6de('0x9')](_0x73750a,_0x1871d3)[_0xd6de('0xa')](function(_0x48e550){logger[_0xd6de('0xb')](_0xd6de('0xc'),_0x3a6f63,_0xd6de('0xd'));logger[_0xd6de('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3a6f63,'request\x20sent',JSON[_0xd6de('0xf')](_0x48e550));if(_0x48e550[_0xd6de('0x10')]){if(_0x48e550[_0xd6de('0x10')][_0xd6de('0x11')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3a6f63,_0x48e550['error'][_0xd6de('0x12')]);return _0x1d12f8(_0x48e550['error']['message']);}logger[_0xd6de('0x10')](_0xd6de('0xc'),_0x3a6f63,_0x48e550[_0xd6de('0x10')][_0xd6de('0x12')]);return _0x4c49f9(_0x48e550[_0xd6de('0x10')]['message']);}else{logger[_0xd6de('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a6f63,_0xd6de('0xd'));_0x4c49f9(_0x48e550[_0xd6de('0x13')][_0xd6de('0x12')]);}})['catch'](function(_0x5e3e11){logger[_0xd6de('0x10')](_0xd6de('0xc'),_0x3a6f63,_0x5e3e11);_0x1d12f8(_0x5e3e11);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index dd6abe4..5d96d61 100644 --- a/server/api/intZendeskField/index.js +++ b/server/api/intZendeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5ca=['path','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','multer','util'];(function(_0xe574fc,_0x59cc04){var _0x5f3deb=function(_0xcfd59a){while(--_0xcfd59a){_0xe574fc['push'](_0xe574fc['shift']());}};_0x5f3deb(++_0x59cc04);}(_0xf5ca,0x1cf));var _0xaf5c=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0xf5ca[_0x2a1465];return _0x128933;};'use strict';var multer=require(_0xaf5c('0x0'));var util=require(_0xaf5c('0x1'));var path=require(_0xaf5c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf5c('0x3'));var router=express[_0xaf5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaf5c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaf5c('0x6'));var controller=require(_0xaf5c('0x7'));router[_0xaf5c('0x8')]('/',auth[_0xaf5c('0x9')](),controller[_0xaf5c('0xa')]);router[_0xaf5c('0x8')](_0xaf5c('0xb'),auth[_0xaf5c('0x9')](),controller['show']);router[_0xaf5c('0xc')]('/',auth[_0xaf5c('0x9')](),controller[_0xaf5c('0xd')]);router[_0xaf5c('0xe')](_0xaf5c('0xb'),auth[_0xaf5c('0x9')](),controller['update']);router['delete'](_0xaf5c('0xb'),auth[_0xaf5c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdd75=['show','post','put','/:id','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x317dcf,_0x574a15){var _0x520dc9=function(_0x1f93dc){while(--_0x1f93dc){_0x317dcf['push'](_0x317dcf['shift']());}};_0x520dc9(++_0x574a15);}(_0xdd75,0xa6));var _0x5dd7=function(_0x266e57,_0x41125b){_0x266e57=_0x266e57-0x0;var _0x4cdc1d=_0xdd75[_0x266e57];return _0x4cdc1d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5dd7('0x0'));var timeout=require(_0x5dd7('0x1'));var express=require('express');var router=express[_0x5dd7('0x2')]();var fs_extra=require(_0x5dd7('0x3'));var auth=require(_0x5dd7('0x4'));var interaction=require(_0x5dd7('0x5'));var config=require(_0x5dd7('0x6'));var controller=require(_0x5dd7('0x7'));router[_0x5dd7('0x8')]('/',auth[_0x5dd7('0x9')](),controller['index']);router[_0x5dd7('0x8')]('/:id',auth[_0x5dd7('0x9')](),controller[_0x5dd7('0xa')]);router[_0x5dd7('0xb')]('/',auth[_0x5dd7('0x9')](),controller['create']);router[_0x5dd7('0xc')](_0x5dd7('0xd'),auth[_0x5dd7('0x9')](),controller['update']);router[_0x5dd7('0xe')]('/:id',auth[_0x5dd7('0x9')](),controller['destroy']);module[_0x5dd7('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index bdaba25..949d6e1 100644 --- a/server/api/intZendeskField/intZendeskField.attributes.js +++ b/server/api/intZendeskField/intZendeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fed=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports'];(function(_0x1b1711,_0x48ce12){var _0x2d7532=function(_0x141a81){while(--_0x141a81){_0x1b1711['push'](_0x1b1711['shift']());}};_0x2d7532(++_0x48ce12);}(_0x2fed,0x7c));var _0xd2fe=function(_0x546566,_0x4d1d8a){_0x546566=_0x546566-0x0;var _0x4cb0ae=_0x2fed[_0x546566];return _0x4cb0ae;};'use strict';var Sequelize=require(_0xd2fe('0x0'));module[_0xd2fe('0x1')]={'type':{'type':Sequelize[_0xd2fe('0x2')](_0xd2fe('0x3'),_0xd2fe('0x4'),'customVariable',_0xd2fe('0x5'),_0xd2fe('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd2fe('0x7')]},'keyType':{'type':Sequelize[_0xd2fe('0x2')](_0xd2fe('0x3'),'variable',_0xd2fe('0x8'))},'keyContent':{'type':Sequelize[_0xd2fe('0x7')]},'idField':{'type':Sequelize[_0xd2fe('0x7')]},'nameField':{'type':Sequelize[_0xd2fe('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd2fe('0x7')]}}; \ No newline at end of file +var _0x79a8=['STRING','customVariable','sequelize','ENUM','string','variable','keyValue'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x79a8,0x1d0));var _0x879a=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x79a8[_0x495e9f];return _0xb249d2;};'use strict';var Sequelize=require(_0x879a('0x0'));module['exports']={'type':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2'),_0x879a('0x3'),'customVariable',_0x879a('0x4'),'picklist'),'defaultValue':_0x879a('0x2')},'content':{'type':Sequelize[_0x879a('0x5')]},'key':{'type':Sequelize[_0x879a('0x5')]},'keyType':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2'),_0x879a('0x3'),_0x879a('0x6'))},'keyContent':{'type':Sequelize[_0x879a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x879a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x879a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ca639e0..f66d268 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec37=['then','destroy','end','error','stack','name','render','merge','body','agent','account','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','VIRTUAL','includeAll','include','ZendeskField','findAll','rows','catch','show','params','options','find','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update'];(function(_0x1c8a44,_0x566974){var _0x182bd6=function(_0x380158){while(--_0x380158){_0x1c8a44['push'](_0x1c8a44['shift']());}};_0x182bd6(++_0x566974);}(_0xec37,0x114));var _0x7ec3=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xec37[_0x585d81];return _0x1aca0d;};'use strict';var emlformat=require(_0x7ec3('0x0'));var rimraf=require(_0x7ec3('0x1'));var zipdir=require(_0x7ec3('0x2'));var jsonpatch=require(_0x7ec3('0x3'));var rp=require('request-promise');var moment=require(_0x7ec3('0x4'));var BPromise=require(_0x7ec3('0x5'));var Mustache=require(_0x7ec3('0x6'));var util=require(_0x7ec3('0x7'));var path=require(_0x7ec3('0x8'));var sox=require(_0x7ec3('0x9'));var csv=require(_0x7ec3('0xa'));var ejs=require(_0x7ec3('0xb'));var fs=require('fs');var fs_extra=require(_0x7ec3('0xc'));var _=require(_0x7ec3('0xd'));var squel=require('squel');var crypto=require(_0x7ec3('0xe'));var jsforce=require(_0x7ec3('0xf'));var deskjs=require(_0x7ec3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7ec3('0x11'));var Papa=require(_0x7ec3('0x12'));var Redis=require('ioredis');var authService=require(_0x7ec3('0x13'));var qs=require(_0x7ec3('0x14'));var as=require(_0x7ec3('0x15'));var hardwareService=require(_0x7ec3('0x16'));var logger=require(_0x7ec3('0x17'))('api');var utils=require(_0x7ec3('0x18'));var config=require(_0x7ec3('0x19'));var licenseUtil=require(_0x7ec3('0x1a'));var db=require(_0x7ec3('0x1b'))['db'];function respondWithStatusCode(_0x31ca53,_0x2ac3ef){_0x2ac3ef=_0x2ac3ef||0xcc;return function(_0x3cec05){if(_0x3cec05){return _0x31ca53[_0x7ec3('0x1c')](_0x2ac3ef);}return _0x31ca53[_0x7ec3('0x1d')](_0x2ac3ef)['end']();};}function respondWithResult(_0x292b95,_0x23ff3d){_0x23ff3d=_0x23ff3d||0xc8;return function(_0x5db7e0){if(_0x5db7e0){return _0x292b95[_0x7ec3('0x1d')](_0x23ff3d)['json'](_0x5db7e0);}};}function respondWithFilteredResult(_0x4a9796,_0x28dbec){return function(_0x1819dc){if(_0x1819dc){var _0x58e170=typeof _0x28dbec[_0x7ec3('0x1e')]===_0x7ec3('0x1f')&&typeof _0x28dbec[_0x7ec3('0x20')]===_0x7ec3('0x1f');var _0x481298=_0x1819dc[_0x7ec3('0x21')];var _0x2a3694=_0x58e170?0x0:_0x28dbec['offset'];var _0x226af9=_0x58e170?_0x1819dc['count']:_0x28dbec[_0x7ec3('0x1e')]+_0x28dbec[_0x7ec3('0x20')];var _0x2cbcf2;if(_0x226af9>=_0x481298){_0x226af9=_0x481298;_0x2cbcf2=0xc8;}else{_0x2cbcf2=0xce;}_0x4a9796[_0x7ec3('0x1d')](_0x2cbcf2);return _0x4a9796[_0x7ec3('0x22')]('Content-Range',_0x2a3694+'-'+_0x226af9+'/'+_0x481298)[_0x7ec3('0x23')](_0x1819dc);}return null;};}function patchUpdates(_0x1ce374){return function(_0x8a3989){try{jsonpatch[_0x7ec3('0x24')](_0x8a3989,_0x1ce374,!![]);}catch(_0x21b9b9){return BPromise[_0x7ec3('0x25')](_0x21b9b9);}return _0x8a3989[_0x7ec3('0x26')]();};}function saveUpdates(_0xc0b263,_0x86a1e1){return function(_0x1b32fc){if(_0x1b32fc){return _0x1b32fc[_0x7ec3('0x27')](_0xc0b263)[_0x7ec3('0x28')](function(_0x52d384){return _0x52d384;});}return null;};}function removeEntity(_0x588ba2,_0x452c60){return function(_0x2c2341){if(_0x2c2341){return _0x2c2341[_0x7ec3('0x29')]()[_0x7ec3('0x28')](function(){_0x588ba2[_0x7ec3('0x1d')](0xcc)[_0x7ec3('0x2a')]();});}};}function handleEntityNotFound(_0x85c10d,_0x180493){return function(_0x16d0a1){if(!_0x16d0a1){_0x85c10d[_0x7ec3('0x1c')](0x194);}return _0x16d0a1;};}function handleError(_0x251c9d,_0x22e662){_0x22e662=_0x22e662||0x1f4;return function(_0x5c4468){logger[_0x7ec3('0x2b')](_0x5c4468[_0x7ec3('0x2c')]);if(_0x5c4468['name']){delete _0x5c4468[_0x7ec3('0x2d')];}_0x251c9d[_0x7ec3('0x1d')](_0x22e662)['send'](_0x5c4468);};}function getMustacheRender(_0x1f8e0a,_0x524197){return Mustache[_0x7ec3('0x2e')](_0x1f8e0a,_[_0x7ec3('0x2f')](_0x524197[_0x7ec3('0x30')],{'contact':_0x524197['contact'],'message':_0x524197['message'],'agent':_0x524197[_0x7ec3('0x31')],'interaction':_0x524197['interaction'],'account':_0x524197[_0x7ec3('0x32')]}))||'';}exports[_0x7ec3('0x33')]=function(_0x22c601,_0x4b4ca6){var _0x55052b={},_0x456be4={},_0x284990={'count':0x0,'rows':[]};var _0x1b832d=_[_0x7ec3('0x34')](db['ZendeskField'][_0x7ec3('0x35')],function(_0x14530a){return{'name':_0x14530a['fieldName'],'type':_0x14530a[_0x7ec3('0x36')]['key']};});_0x456be4[_0x7ec3('0x37')]=_[_0x7ec3('0x34')](_0x1b832d,'name');_0x456be4[_0x7ec3('0x38')]=_[_0x7ec3('0x39')](_0x22c601[_0x7ec3('0x38')]);_0x456be4[_0x7ec3('0x3a')]=_[_0x7ec3('0x3b')](_0x456be4[_0x7ec3('0x37')],_0x456be4['query']);_0x55052b[_0x7ec3('0x3c')]=_['intersection'](_0x456be4[_0x7ec3('0x37')],qs[_0x7ec3('0x3d')](_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x3d')]));_0x55052b[_0x7ec3('0x3c')]=_0x55052b[_0x7ec3('0x3c')][_0x7ec3('0x3e')]?_0x55052b[_0x7ec3('0x3c')]:_0x456be4[_0x7ec3('0x37')];if(!_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x3f')]('nolimit')){_0x55052b['limit']=qs[_0x7ec3('0x20')](_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x20')]);_0x55052b['offset']=qs[_0x7ec3('0x1e')](_0x22c601['query'][_0x7ec3('0x1e')]);}_0x55052b['order']=qs['sort'](_0x22c601[_0x7ec3('0x38')]['sort']);_0x55052b[_0x7ec3('0x40')]=qs[_0x7ec3('0x3a')](_[_0x7ec3('0x41')](_0x22c601[_0x7ec3('0x38')],_0x456be4[_0x7ec3('0x3a')]),_0x1b832d);if(_0x22c601['query'][_0x7ec3('0x42')]){_0x55052b[_0x7ec3('0x40')]=_['merge'](_0x55052b['where'],{'$or':_[_0x7ec3('0x34')](_0x1b832d,function(_0x514edc){if(_0x514edc['type']!==_0x7ec3('0x43')){var _0x4dfb2b={};_0x4dfb2b[_0x514edc[_0x7ec3('0x2d')]]={'$like':'%'+_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x42')]+'%'};return _0x4dfb2b;}})});}_0x55052b=_[_0x7ec3('0x2f')]({},_0x55052b,_0x22c601['options']);var _0x3f1b0c={'where':_0x55052b[_0x7ec3('0x40')]};return db['ZendeskField'][_0x7ec3('0x21')](_0x3f1b0c)[_0x7ec3('0x28')](function(_0x489ebc){_0x284990['count']=_0x489ebc;if(_0x22c601[_0x7ec3('0x38')][_0x7ec3('0x44')]){_0x55052b[_0x7ec3('0x45')]=[{'all':!![]}];}return db[_0x7ec3('0x46')][_0x7ec3('0x47')](_0x55052b);})[_0x7ec3('0x28')](function(_0x285ad2){_0x284990[_0x7ec3('0x48')]=_0x285ad2;return _0x284990;})[_0x7ec3('0x28')](respondWithFilteredResult(_0x4b4ca6,_0x55052b))[_0x7ec3('0x49')](handleError(_0x4b4ca6,null));};exports[_0x7ec3('0x4a')]=function(_0x538dd0,_0x5be855){var _0x216597={'raw':!![],'where':{'id':_0x538dd0[_0x7ec3('0x4b')]['id']}},_0x25025c={};_0x25025c[_0x7ec3('0x37')]=_[_0x7ec3('0x39')](db[_0x7ec3('0x46')][_0x7ec3('0x35')]);_0x25025c[_0x7ec3('0x38')]=_['keys'](_0x538dd0[_0x7ec3('0x38')]);_0x25025c[_0x7ec3('0x3a')]=_[_0x7ec3('0x3b')](_0x25025c['model'],_0x25025c['query']);_0x216597[_0x7ec3('0x3c')]=_['intersection'](_0x25025c[_0x7ec3('0x37')],qs[_0x7ec3('0x3d')](_0x538dd0['query']['fields']));_0x216597[_0x7ec3('0x3c')]=_0x216597['attributes']['length']?_0x216597[_0x7ec3('0x3c')]:_0x25025c[_0x7ec3('0x37')];if(_0x538dd0[_0x7ec3('0x38')][_0x7ec3('0x44')]){_0x216597['include']=[{'all':!![]}];}_0x216597=_[_0x7ec3('0x2f')]({},_0x216597,_0x538dd0[_0x7ec3('0x4c')]);return db[_0x7ec3('0x46')][_0x7ec3('0x4d')](_0x216597)['then'](handleEntityNotFound(_0x5be855,null))[_0x7ec3('0x28')](respondWithResult(_0x5be855,null))['catch'](handleError(_0x5be855,null));};exports[_0x7ec3('0x4e')]=function(_0x17e16,_0x3ac06f){return db['ZendeskField']['create'](_0x17e16['body'],{})[_0x7ec3('0x28')](respondWithResult(_0x3ac06f,0xc9))[_0x7ec3('0x49')](handleError(_0x3ac06f,null));};exports[_0x7ec3('0x27')]=function(_0x311e31,_0x2dd196){if(_0x311e31[_0x7ec3('0x30')]['id']){delete _0x311e31[_0x7ec3('0x30')]['id'];}return db['ZendeskField'][_0x7ec3('0x4d')]({'where':{'id':_0x311e31['params']['id']}})[_0x7ec3('0x28')](handleEntityNotFound(_0x2dd196,null))[_0x7ec3('0x28')](saveUpdates(_0x311e31['body'],null))[_0x7ec3('0x28')](respondWithResult(_0x2dd196,null))[_0x7ec3('0x49')](handleError(_0x2dd196,null));};exports[_0x7ec3('0x29')]=function(_0x57d1e9,_0x226537){return db['ZendeskField'][_0x7ec3('0x4d')]({'where':{'id':_0x57d1e9['params']['id']}})['then'](handleEntityNotFound(_0x226537,null))[_0x7ec3('0x28')](removeEntity(_0x226537,null))[_0x7ec3('0x49')](handleError(_0x226537,null));}; \ No newline at end of file +var _0x5de4=['create','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','merge','body','contact','message','agent','interaction','account','index','map','ZendeskField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','find'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x5de4,0x145));var _0x45de=function(_0x5bf10d,_0x54e057){_0x5bf10d=_0x5bf10d-0x0;var _0x103927=_0x5de4[_0x5bf10d];return _0x103927;};'use strict';var emlformat=require(_0x45de('0x0'));var rimraf=require(_0x45de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x45de('0x2'));var rp=require(_0x45de('0x3'));var moment=require(_0x45de('0x4'));var BPromise=require(_0x45de('0x5'));var Mustache=require(_0x45de('0x6'));var util=require(_0x45de('0x7'));var path=require(_0x45de('0x8'));var sox=require('sox');var csv=require(_0x45de('0x9'));var ejs=require(_0x45de('0xa'));var fs=require('fs');var fs_extra=require(_0x45de('0xb'));var _=require(_0x45de('0xc'));var squel=require('squel');var crypto=require(_0x45de('0xd'));var jsforce=require(_0x45de('0xe'));var deskjs=require(_0x45de('0xf'));var toCsv=require('to-csv');var querystring=require(_0x45de('0x10'));var Papa=require('papaparse');var Redis=require(_0x45de('0x11'));var authService=require(_0x45de('0x12'));var qs=require(_0x45de('0x13'));var as=require(_0x45de('0x14'));var hardwareService=require(_0x45de('0x15'));var logger=require(_0x45de('0x16'))(_0x45de('0x17'));var utils=require(_0x45de('0x18'));var config=require(_0x45de('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x45de('0x1a'))['db'];function respondWithStatusCode(_0x1e595b,_0x8bfba0){_0x8bfba0=_0x8bfba0||0xcc;return function(_0x32bebe){if(_0x32bebe){return _0x1e595b[_0x45de('0x1b')](_0x8bfba0);}return _0x1e595b[_0x45de('0x1c')](_0x8bfba0)[_0x45de('0x1d')]();};}function respondWithResult(_0x8203f7,_0x68f91e){_0x68f91e=_0x68f91e||0xc8;return function(_0x128b1d){if(_0x128b1d){return _0x8203f7[_0x45de('0x1c')](_0x68f91e)[_0x45de('0x1e')](_0x128b1d);}};}function respondWithFilteredResult(_0xd9b16f,_0x2fc507){return function(_0x18294a){if(_0x18294a){var _0x3d7a55=typeof _0x2fc507[_0x45de('0x1f')]===_0x45de('0x20')&&typeof _0x2fc507[_0x45de('0x21')]===_0x45de('0x20');var _0x56b870=_0x18294a[_0x45de('0x22')];var _0x1e1049=_0x3d7a55?0x0:_0x2fc507[_0x45de('0x1f')];var _0x3b72a7=_0x3d7a55?_0x18294a['count']:_0x2fc507['offset']+_0x2fc507[_0x45de('0x21')];var _0x497c76;if(_0x3b72a7>=_0x56b870){_0x3b72a7=_0x56b870;_0x497c76=0xc8;}else{_0x497c76=0xce;}_0xd9b16f[_0x45de('0x1c')](_0x497c76);return _0xd9b16f['set']('Content-Range',_0x1e1049+'-'+_0x3b72a7+'/'+_0x56b870)['json'](_0x18294a);}return null;};}function patchUpdates(_0x31e830){return function(_0x4eedce){try{jsonpatch[_0x45de('0x23')](_0x4eedce,_0x31e830,!![]);}catch(_0x5be51f){return BPromise['reject'](_0x5be51f);}return _0x4eedce[_0x45de('0x24')]();};}function saveUpdates(_0x2ab17d,_0x57aaf1){return function(_0x233a2f){if(_0x233a2f){return _0x233a2f[_0x45de('0x25')](_0x2ab17d)[_0x45de('0x26')](function(_0x1b354d){return _0x1b354d;});}return null;};}function removeEntity(_0x11f072,_0x4d35a){return function(_0x265a00){if(_0x265a00){return _0x265a00[_0x45de('0x27')]()['then'](function(){_0x11f072[_0x45de('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c907,_0x17ddec){return function(_0x5745ec){if(!_0x5745ec){_0x59c907['sendStatus'](0x194);}return _0x5745ec;};}function handleError(_0x39b242,_0x150963){_0x150963=_0x150963||0x1f4;return function(_0x12fee0){logger[_0x45de('0x28')](_0x12fee0[_0x45de('0x29')]);if(_0x12fee0[_0x45de('0x2a')]){delete _0x12fee0[_0x45de('0x2a')];}_0x39b242[_0x45de('0x1c')](_0x150963)[_0x45de('0x2b')](_0x12fee0);};}function getMustacheRender(_0xbfd612,_0x527548){return Mustache['render'](_0xbfd612,_[_0x45de('0x2c')](_0x527548[_0x45de('0x2d')],{'contact':_0x527548[_0x45de('0x2e')],'message':_0x527548[_0x45de('0x2f')],'agent':_0x527548[_0x45de('0x30')],'interaction':_0x527548[_0x45de('0x31')],'account':_0x527548[_0x45de('0x32')]}))||'';}exports[_0x45de('0x33')]=function(_0x1b3ef0,_0x147e75){var _0x1fa8ad={},_0x16fb19={},_0x27907c={'count':0x0,'rows':[]};var _0x5516aa=_[_0x45de('0x34')](db[_0x45de('0x35')][_0x45de('0x36')],function(_0x3e6674){return{'name':_0x3e6674[_0x45de('0x37')],'type':_0x3e6674[_0x45de('0x38')]['key']};});_0x16fb19[_0x45de('0x39')]=_[_0x45de('0x34')](_0x5516aa,_0x45de('0x2a'));_0x16fb19['query']=_[_0x45de('0x3a')](_0x1b3ef0[_0x45de('0x3b')]);_0x16fb19[_0x45de('0x3c')]=_[_0x45de('0x3d')](_0x16fb19[_0x45de('0x39')],_0x16fb19[_0x45de('0x3b')]);_0x1fa8ad[_0x45de('0x3e')]=_['intersection'](_0x16fb19[_0x45de('0x39')],qs['fields'](_0x1b3ef0[_0x45de('0x3b')]['fields']));_0x1fa8ad['attributes']=_0x1fa8ad[_0x45de('0x3e')][_0x45de('0x3f')]?_0x1fa8ad[_0x45de('0x3e')]:_0x16fb19[_0x45de('0x39')];if(!_0x1b3ef0[_0x45de('0x3b')]['hasOwnProperty'](_0x45de('0x40'))){_0x1fa8ad[_0x45de('0x21')]=qs[_0x45de('0x21')](_0x1b3ef0['query'][_0x45de('0x21')]);_0x1fa8ad[_0x45de('0x1f')]=qs[_0x45de('0x1f')](_0x1b3ef0[_0x45de('0x3b')][_0x45de('0x1f')]);}_0x1fa8ad[_0x45de('0x41')]=qs[_0x45de('0x42')](_0x1b3ef0['query']['sort']);_0x1fa8ad[_0x45de('0x43')]=qs[_0x45de('0x3c')](_[_0x45de('0x44')](_0x1b3ef0['query'],_0x16fb19[_0x45de('0x3c')]),_0x5516aa);if(_0x1b3ef0[_0x45de('0x3b')]['filter']){_0x1fa8ad[_0x45de('0x43')]=_['merge'](_0x1fa8ad[_0x45de('0x43')],{'$or':_[_0x45de('0x34')](_0x5516aa,function(_0x4851b1){if(_0x4851b1[_0x45de('0x38')]!==_0x45de('0x45')){var _0x2eddbf={};_0x2eddbf[_0x4851b1['name']]={'$like':'%'+_0x1b3ef0[_0x45de('0x3b')][_0x45de('0x46')]+'%'};return _0x2eddbf;}})});}_0x1fa8ad=_[_0x45de('0x2c')]({},_0x1fa8ad,_0x1b3ef0[_0x45de('0x47')]);var _0x2c6dfb={'where':_0x1fa8ad[_0x45de('0x43')]};return db[_0x45de('0x35')][_0x45de('0x22')](_0x2c6dfb)[_0x45de('0x26')](function(_0x4b8fd9){_0x27907c['count']=_0x4b8fd9;if(_0x1b3ef0[_0x45de('0x3b')][_0x45de('0x48')]){_0x1fa8ad[_0x45de('0x49')]=[{'all':!![]}];}return db['ZendeskField'][_0x45de('0x4a')](_0x1fa8ad);})[_0x45de('0x26')](function(_0x1317b1){_0x27907c[_0x45de('0x4b')]=_0x1317b1;return _0x27907c;})[_0x45de('0x26')](respondWithFilteredResult(_0x147e75,_0x1fa8ad))[_0x45de('0x4c')](handleError(_0x147e75,null));};exports['show']=function(_0x42cfe5,_0x5b0a86){var _0x5acddf={'raw':!![],'where':{'id':_0x42cfe5[_0x45de('0x4d')]['id']}},_0x130338={};_0x130338[_0x45de('0x39')]=_[_0x45de('0x3a')](db['ZendeskField'][_0x45de('0x36')]);_0x130338[_0x45de('0x3b')]=_[_0x45de('0x3a')](_0x42cfe5['query']);_0x130338['filters']=_[_0x45de('0x3d')](_0x130338['model'],_0x130338[_0x45de('0x3b')]);_0x5acddf['attributes']=_[_0x45de('0x3d')](_0x130338[_0x45de('0x39')],qs[_0x45de('0x4e')](_0x42cfe5[_0x45de('0x3b')][_0x45de('0x4e')]));_0x5acddf[_0x45de('0x3e')]=_0x5acddf['attributes'][_0x45de('0x3f')]?_0x5acddf[_0x45de('0x3e')]:_0x130338[_0x45de('0x39')];if(_0x42cfe5[_0x45de('0x3b')][_0x45de('0x48')]){_0x5acddf[_0x45de('0x49')]=[{'all':!![]}];}_0x5acddf=_[_0x45de('0x2c')]({},_0x5acddf,_0x42cfe5[_0x45de('0x47')]);return db[_0x45de('0x35')][_0x45de('0x4f')](_0x5acddf)['then'](handleEntityNotFound(_0x5b0a86,null))[_0x45de('0x26')](respondWithResult(_0x5b0a86,null))['catch'](handleError(_0x5b0a86,null));};exports[_0x45de('0x50')]=function(_0x5333c9,_0x9aa38b){return db[_0x45de('0x35')][_0x45de('0x50')](_0x5333c9[_0x45de('0x2d')],{})[_0x45de('0x26')](respondWithResult(_0x9aa38b,0xc9))[_0x45de('0x4c')](handleError(_0x9aa38b,null));};exports[_0x45de('0x25')]=function(_0x2662b4,_0x354df5){if(_0x2662b4[_0x45de('0x2d')]['id']){delete _0x2662b4[_0x45de('0x2d')]['id'];}return db[_0x45de('0x35')]['find']({'where':{'id':_0x2662b4[_0x45de('0x4d')]['id']}})[_0x45de('0x26')](handleEntityNotFound(_0x354df5,null))[_0x45de('0x26')](saveUpdates(_0x2662b4[_0x45de('0x2d')],null))[_0x45de('0x26')](respondWithResult(_0x354df5,null))[_0x45de('0x4c')](handleError(_0x354df5,null));};exports[_0x45de('0x27')]=function(_0x42559d,_0x56511e){return db[_0x45de('0x35')]['find']({'where':{'id':_0x42559d[_0x45de('0x4d')]['id']}})[_0x45de('0x26')](handleEntityNotFound(_0x56511e,null))[_0x45de('0x26')](removeEntity(_0x56511e,null))[_0x45de('0x4c')](handleError(_0x56511e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f267fbb..35e3598 100644 --- a/server/api/intZendeskField/intZendeskField.model.js +++ b/server/api/intZendeskField/intZendeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ba2=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField'];(function(_0x175916,_0x5aa198){var _0x86c00e=function(_0x6be656){while(--_0x6be656){_0x175916['push'](_0x175916['shift']());}};_0x86c00e(++_0x5aa198);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var logger=require(_0x21ba('0x1'))('api');var moment=require(_0x21ba('0x2'));var BPromise=require(_0x21ba('0x3'));var rp=require(_0x21ba('0x4'));var fs=require('fs');var path=require(_0x21ba('0x5'));var rimraf=require(_0x21ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x21ba('0x7'));module[_0x21ba('0x8')]=function(_0x4a07e8,_0x10dae1){return _0x4a07e8['define'](_0x21ba('0x9'),attributes,{'tableName':_0x21ba('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x21ba('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3eec=['rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x25bf21,_0x3a6198){var _0x5f1246=function(_0xae3dfd){while(--_0xae3dfd){_0x25bf21['push'](_0x25bf21['shift']());}};_0x5f1246(++_0x3a6198);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x1bd694,_0x33ba31){_0x1bd694=_0x1bd694-0x0;var _0x4c0fd7=_0x3eec[_0x1bd694];return _0x4c0fd7;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var logger=require(_0xc3ee('0x2'))(_0xc3ee('0x3'));var moment=require('moment');var BPromise=require(_0xc3ee('0x4'));var rp=require(_0xc3ee('0x5'));var fs=require('fs');var path=require(_0xc3ee('0x6'));var rimraf=require(_0xc3ee('0x7'));var config=require(_0xc3ee('0x8'));var attributes=require(_0xc3ee('0x9'));module['exports']=function(_0x471de7,_0xbd5b6){return _0x471de7[_0xc3ee('0xa')](_0xc3ee('0xb'),attributes,{'tableName':_0xc3ee('0xc'),'paranoid':![],'indexes':[{'name':_0xc3ee('0xd'),'fields':[_0xc3ee('0xe'),_0xc3ee('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index e80bc6a..c09c2ba 100644 --- a/server/api/intZendeskField/intZendeskField.rpc.js +++ b/server/api/intZendeskField/intZendeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b0d=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x4b0d,0xe8));var _0xd4b0=function(_0x1d56fd,_0x36c2d4){_0x1d56fd=_0x1d56fd-0x0;var _0x1f9f71=_0x4b0d[_0x1d56fd];return _0x1f9f71;};'use strict';var _=require(_0xd4b0('0x0'));var util=require(_0xd4b0('0x1'));var moment=require(_0xd4b0('0x2'));var BPromise=require(_0xd4b0('0x3'));var rs=require(_0xd4b0('0x4'));var fs=require('fs');var Redis=require(_0xd4b0('0x5'));var db=require(_0xd4b0('0x6'))['db'];var utils=require(_0xd4b0('0x7'));var logger=require(_0xd4b0('0x8'))(_0xd4b0('0x9'));var config=require(_0xd4b0('0xa'));var jayson=require(_0xd4b0('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e3e00,_0x36cd66,_0xe2921c){return new BPromise(function(_0x2282a6,_0x42e4d3){return client[_0xd4b0('0xc')](_0x4e3e00,_0xe2921c)[_0xd4b0('0xd')](function(_0x2c5231){logger['info'](_0xd4b0('0xe'),_0x36cd66,'request\x20sent');logger[_0xd4b0('0xf')](_0xd4b0('0x10'),_0x36cd66,_0xd4b0('0x11'),JSON[_0xd4b0('0x12')](_0x2c5231));if(_0x2c5231[_0xd4b0('0x13')]){if(_0x2c5231[_0xd4b0('0x13')][_0xd4b0('0x14')]===0x1f4){logger[_0xd4b0('0x13')](_0xd4b0('0xe'),_0x36cd66,_0x2c5231['error']['message']);return _0x42e4d3(_0x2c5231[_0xd4b0('0x13')][_0xd4b0('0x15')]);}logger[_0xd4b0('0x13')](_0xd4b0('0xe'),_0x36cd66,_0x2c5231[_0xd4b0('0x13')][_0xd4b0('0x15')]);return _0x2282a6(_0x2c5231['error'][_0xd4b0('0x15')]);}else{logger['info'](_0xd4b0('0xe'),_0x36cd66,_0xd4b0('0x11'));_0x2282a6(_0x2c5231['result']['message']);}})[_0xd4b0('0x16')](function(_0x2f8723){logger[_0xd4b0('0x13')](_0xd4b0('0xe'),_0x36cd66,_0x2f8723);_0x42e4d3(_0x2f8723);});});} \ No newline at end of file +var _0xcd7d=['error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a1d3e,_0x5a854c){var _0x10c154=function(_0x24319b){while(--_0x24319b){_0x5a1d3e['push'](_0x5a1d3e['shift']());}};_0x10c154(++_0x5a854c);}(_0xcd7d,0x1aa));var _0xdcd7=function(_0x361078,_0x283dcb){_0x361078=_0x361078-0x0;var _0x22d9e8=_0xcd7d[_0x361078];return _0x22d9e8;};'use strict';var _=require(_0xdcd7('0x0'));var util=require('util');var moment=require(_0xdcd7('0x1'));var BPromise=require(_0xdcd7('0x2'));var rs=require(_0xdcd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdcd7('0x4'));var logger=require(_0xdcd7('0x5'))(_0xdcd7('0x6'));var config=require('../../config/environment');var jayson=require(_0xdcd7('0x7'));var client=jayson[_0xdcd7('0x8')][_0xdcd7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a27a0,_0x54c7f9,_0x5d41ae){return new BPromise(function(_0x5ae62f,_0x3e1fac){return client['request'](_0x5a27a0,_0x5d41ae)['then'](function(_0x33bd52){logger[_0xdcd7('0xa')]('ZendeskField,\x20%s,\x20%s',_0x54c7f9,_0xdcd7('0xb'));logger[_0xdcd7('0xc')](_0xdcd7('0xd'),_0x54c7f9,'request\x20sent',JSON[_0xdcd7('0xe')](_0x33bd52));if(_0x33bd52[_0xdcd7('0xf')]){if(_0x33bd52[_0xdcd7('0xf')][_0xdcd7('0x10')]===0x1f4){logger['error'](_0xdcd7('0x11'),_0x54c7f9,_0x33bd52[_0xdcd7('0xf')][_0xdcd7('0x12')]);return _0x3e1fac(_0x33bd52['error'][_0xdcd7('0x12')]);}logger[_0xdcd7('0xf')](_0xdcd7('0x11'),_0x54c7f9,_0x33bd52[_0xdcd7('0xf')][_0xdcd7('0x12')]);return _0x5ae62f(_0x33bd52[_0xdcd7('0xf')][_0xdcd7('0x12')]);}else{logger[_0xdcd7('0xa')](_0xdcd7('0x11'),_0x54c7f9,_0xdcd7('0xb'));_0x5ae62f(_0x33bd52[_0xdcd7('0x13')][_0xdcd7('0x12')]);}})[_0xdcd7('0x14')](function(_0x39b9ca){logger['error'](_0xdcd7('0x11'),_0x54c7f9,_0x39b9ca);_0x3e1fac(_0x39b9ca);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index af84375..00f5895 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a1d=['destroy','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x572d97,_0x385624){var _0x28e899=function(_0x5778ba){while(--_0x5778ba){_0x572d97['push'](_0x572d97['shift']());}};_0x28e899(++_0x385624);}(_0x8a1d,0xb5));var _0xd8a1=function(_0x204140,_0x3f3b77){_0x204140=_0x204140-0x0;var _0x41f139=_0x8a1d[_0x204140];return _0x41f139;};'use strict';var multer=require(_0xd8a1('0x0'));var util=require(_0xd8a1('0x1'));var path=require('path');var timeout=require(_0xd8a1('0x2'));var express=require(_0xd8a1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd8a1('0x4'));var config=require(_0xd8a1('0x5'));var controller=require(_0xd8a1('0x6'));router['get']('/',auth[_0xd8a1('0x7')](),controller['index']);router['get'](_0xd8a1('0x8'),auth[_0xd8a1('0x7')](),controller[_0xd8a1('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd8a1('0xa')]);router['get'](_0xd8a1('0xb'),auth[_0xd8a1('0x7')](),controller[_0xd8a1('0xc')]);router[_0xd8a1('0xd')]('/',auth['isAuthenticated'](),controller[_0xd8a1('0xe')]);router[_0xd8a1('0xd')]('/:id/configurations',auth[_0xd8a1('0x7')](),controller[_0xd8a1('0xf')]);router[_0xd8a1('0x10')](_0xd8a1('0x8'),auth[_0xd8a1('0x7')](),controller['update']);router['delete'](_0xd8a1('0x8'),auth[_0xd8a1('0x7')](),controller[_0xd8a1('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd526=['put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x158d31,_0x5cd8eb){var _0x22cb74=function(_0x8b7009){while(--_0x8b7009){_0x158d31['push'](_0x158d31['shift']());}};_0x22cb74(++_0x5cd8eb);}(_0xd526,0x12f));var _0x6d52=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd526[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x6d52('0x0'));var path=require(_0x6d52('0x1'));var timeout=require(_0x6d52('0x2'));var express=require(_0x6d52('0x3'));var router=express['Router']();var fs_extra=require(_0x6d52('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6d52('0x5'));var config=require(_0x6d52('0x6'));var controller=require('./intZohoAccount.controller');router[_0x6d52('0x7')]('/',auth[_0x6d52('0x8')](),controller[_0x6d52('0x9')]);router[_0x6d52('0x7')](_0x6d52('0xa'),auth[_0x6d52('0x8')](),controller[_0x6d52('0xb')]);router['get'](_0x6d52('0xc'),auth['isAuthenticated'](),controller[_0x6d52('0xd')]);router[_0x6d52('0x7')](_0x6d52('0xe'),auth['isAuthenticated'](),controller[_0x6d52('0xf')]);router[_0x6d52('0x10')]('/',auth[_0x6d52('0x8')](),controller[_0x6d52('0x11')]);router[_0x6d52('0x10')](_0x6d52('0xc'),auth[_0x6d52('0x8')](),controller[_0x6d52('0x12')]);router[_0x6d52('0x13')](_0x6d52('0xa'),auth[_0x6d52('0x8')](),controller[_0x6d52('0x14')]);router[_0x6d52('0x15')](_0x6d52('0xa'),auth[_0x6d52('0x8')](),controller['destroy']);module[_0x6d52('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 6fa1459..f644b96 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a39=['exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3a39,0x9a));var _0x93a3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3a39[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0x93a3('0x0')]={'name':{'type':Sequelize[_0x93a3('0x1')]},'description':{'type':Sequelize[_0x93a3('0x1')]},'host':{'type':Sequelize[_0x93a3('0x1')]},'zone':{'type':Sequelize[_0x93a3('0x1')]},'clientId':{'type':Sequelize[_0x93a3('0x1')]},'clientSecret':{'type':Sequelize[_0x93a3('0x1')]},'serverUrl':{'type':Sequelize[_0x93a3('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x93a3('0x1')]},'refreshToken':{'type':Sequelize[_0x93a3('0x1')]}}; \ No newline at end of file +var _0x2832=['exports','STRING','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2832,0x11f));var _0x2283=function(_0x21a34c,_0x530ec4){_0x21a34c=_0x21a34c-0x0;var _0x20c614=_0x2832[_0x21a34c];return _0x20c614;};'use strict';var Sequelize=require(_0x2283('0x0'));module[_0x2283('0x1')]={'name':{'type':Sequelize[_0x2283('0x2')]},'description':{'type':Sequelize[_0x2283('0x2')]},'host':{'type':Sequelize[_0x2283('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2283('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x2283('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 49d1b61..b17f433 100644 --- a/server/api/intZohoAccount/intZohoAccount.controller.js +++ b/server/api/intZohoAccount/intZohoAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe384=['key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','length','find','create','params','destroy','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','refreshToken','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','stack','name','send','render','merge','body','agent','interaction','account','index','map','ZohoAccount','fieldName','type'];(function(_0x2ed612,_0x5090f5){var _0xff695b=function(_0x1bf6df){while(--_0x1bf6df){_0x2ed612['push'](_0x2ed612['shift']());}};_0xff695b(++_0x5090f5);}(_0xe384,0x160));var _0x4e38=function(_0x2e6c58,_0x1cebc0){_0x2e6c58=_0x2e6c58-0x0;var _0x4a280b=_0xe384[_0x2e6c58];return _0x4a280b;};'use strict';var emlformat=require(_0x4e38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e38('0x1'));var jsonpatch=require(_0x4e38('0x2'));var rp=require(_0x4e38('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e38('0x4'));var util=require(_0x4e38('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4e38('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e38('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e38('0x8'));var deskjs=require(_0x4e38('0x9'));var toCsv=require(_0x4e38('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e38('0xa'));var authService=require('../../components/auth/service');var qs=require(_0x4e38('0xb'));var as=require(_0x4e38('0xc'));var hardwareService=require(_0x4e38('0xd'));var logger=require(_0x4e38('0xe'))(_0x4e38('0xf'));var utils=require(_0x4e38('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4e38('0x11'));var db=require(_0x4e38('0x12'))['db'];var integrations=require(_0x4e38('0x13'));var jayson=require('jayson/promise');var client=jayson[_0x4e38('0x14')][_0x4e38('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x57388d,_0x1abed0,_0x59f68a,_0x4d242e){return new BPromise(function(_0x4433cc,_0x44699a){var _0x4b09eb=_0x4d242e||client;return _0x4b09eb[_0x4e38('0x16')](_0x57388d,_0x59f68a)[_0x4e38('0x17')](function(_0x24d8c8){logger['info'](_0x4e38('0x18'),_0x1abed0,_0x4e38('0x19'));logger[_0x4e38('0x1a')](_0x4e38('0x1b'),_0x1abed0,_0x4e38('0x19'),JSON['stringify'](_0x24d8c8));if(_0x24d8c8[_0x4e38('0x1c')]){if(_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1d')]===0x1f4){logger[_0x4e38('0x1c')](_0x4e38('0x18'),_0x1abed0,_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1e')]);return _0x44699a(_0x24d8c8['error'][_0x4e38('0x1e')]);}logger[_0x4e38('0x1c')](_0x4e38('0x18'),_0x1abed0,_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1e')]);return _0x4433cc(_0x24d8c8[_0x4e38('0x1c')][_0x4e38('0x1e')]);}else{logger[_0x4e38('0x1f')](_0x4e38('0x18'),_0x1abed0,'request\x20sent');_0x4433cc(_0x24d8c8[_0x4e38('0x20')][_0x4e38('0x1e')]);}})[_0x4e38('0x21')](function(_0x26dbc5){logger[_0x4e38('0x1c')](_0x4e38('0x18'),_0x1abed0,_0x26dbc5);_0x44699a(_0x26dbc5);});});}function respondWithStatusCode(_0x33bc64,_0x1daccd){_0x1daccd=_0x1daccd||0xcc;return function(_0x470a8b){if(_0x470a8b){return _0x33bc64[_0x4e38('0x22')](_0x1daccd);}return _0x33bc64['status'](_0x1daccd)[_0x4e38('0x23')]();};}function respondWithResult(_0x47b09b,_0x2c1006){_0x2c1006=_0x2c1006||0xc8;return function(_0x33d49e){if(_0x33d49e){return _0x47b09b[_0x4e38('0x24')](_0x2c1006)[_0x4e38('0x25')](_0x33d49e);}};}function respondWithFilteredResult(_0x3a3a97,_0x3eed38){return function(_0x1f2d03){if(_0x1f2d03){var _0x4f749c=typeof _0x3eed38['offset']===_0x4e38('0x26')&&typeof _0x3eed38[_0x4e38('0x27')]===_0x4e38('0x26');var _0x2adcb7=_0x1f2d03[_0x4e38('0x28')];var _0x5afd46=_0x4f749c?0x0:_0x3eed38[_0x4e38('0x29')];var _0xf55f4f=_0x4f749c?_0x1f2d03['count']:_0x3eed38[_0x4e38('0x29')]+_0x3eed38[_0x4e38('0x27')];var _0x42cfad;if(_0xf55f4f>=_0x2adcb7){_0xf55f4f=_0x2adcb7;_0x42cfad=0xc8;}else{_0x42cfad=0xce;}_0x3a3a97['status'](_0x42cfad);return _0x3a3a97['set'](_0x4e38('0x2a'),_0x5afd46+'-'+_0xf55f4f+'/'+_0x2adcb7)['json'](_0x1f2d03);}return null;};}function patchUpdates(_0xaf002){return function(_0x17f755){try{jsonpatch[_0x4e38('0x2b')](_0x17f755,_0xaf002,!![]);}catch(_0x43c72c){return BPromise['reject'](_0x43c72c);}return _0x17f755[_0x4e38('0x2c')]();};}function saveUpdates(_0x1a5d9b,_0x8b55ed){return function(_0x12d858){if(_0x12d858){return _0x12d858['update'](_0x1a5d9b)[_0x4e38('0x17')](function(_0x4f2e7f){return _0x4f2e7f;});}return null;};}function removeEntity(_0x909bdf,_0x5d62ff){return function(_0x52d28c){if(_0x52d28c){return _0x52d28c['destroy']()[_0x4e38('0x17')](function(){_0x909bdf[_0x4e38('0x24')](0xcc)[_0x4e38('0x23')]();});}};}function handleEntityNotFound(_0x1bdd2d,_0x4fc7e8){return function(_0x4e3fdb){if(!_0x4e3fdb){_0x1bdd2d[_0x4e38('0x22')](0x194);}return _0x4e3fdb;};}function handleError(_0x7f49e6,_0x488ab4){_0x488ab4=_0x488ab4||0x1f4;return function(_0x2cc8f8){logger['error'](_0x2cc8f8[_0x4e38('0x2d')]);if(_0x2cc8f8[_0x4e38('0x2e')]){delete _0x2cc8f8[_0x4e38('0x2e')];}_0x7f49e6[_0x4e38('0x24')](_0x488ab4)[_0x4e38('0x2f')](_0x2cc8f8);};}function getMustacheRender(_0x54caef,_0x3aa16c){return Mustache[_0x4e38('0x30')](_0x54caef,_[_0x4e38('0x31')](_0x3aa16c[_0x4e38('0x32')],{'contact':_0x3aa16c['contact'],'message':_0x3aa16c[_0x4e38('0x1e')],'agent':_0x3aa16c[_0x4e38('0x33')],'interaction':_0x3aa16c[_0x4e38('0x34')],'account':_0x3aa16c[_0x4e38('0x35')]}))||'';}exports[_0x4e38('0x36')]=function(_0x7ab539,_0x4a0541){var _0x34abd7={},_0x23f242={},_0x5944c7={'count':0x0,'rows':[]};var _0x7af284=_[_0x4e38('0x37')](db[_0x4e38('0x38')]['rawAttributes'],function(_0x2bfedf){return{'name':_0x2bfedf[_0x4e38('0x39')],'type':_0x2bfedf[_0x4e38('0x3a')][_0x4e38('0x3b')]};});_0x23f242[_0x4e38('0x3c')]=_['map'](_0x7af284,_0x4e38('0x2e'));_0x23f242['query']=_[_0x4e38('0x3d')](_0x7ab539[_0x4e38('0x3e')]);_0x23f242['filters']=_[_0x4e38('0x3f')](_0x23f242[_0x4e38('0x3c')],_0x23f242[_0x4e38('0x3e')]);_0x34abd7['attributes']=_[_0x4e38('0x3f')](_0x23f242[_0x4e38('0x3c')],qs['fields'](_0x7ab539['query'][_0x4e38('0x40')]));_0x34abd7['attributes']=_0x34abd7[_0x4e38('0x41')]['length']?_0x34abd7[_0x4e38('0x41')]:_0x23f242[_0x4e38('0x3c')];if(!_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x42')]('nolimit')){_0x34abd7[_0x4e38('0x27')]=qs['limit'](_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x27')]);_0x34abd7[_0x4e38('0x29')]=qs[_0x4e38('0x29')](_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x29')]);}_0x34abd7[_0x4e38('0x43')]=qs[_0x4e38('0x44')](_0x7ab539[_0x4e38('0x3e')]['sort']);_0x34abd7[_0x4e38('0x45')]=qs[_0x4e38('0x46')](_[_0x4e38('0x47')](_0x7ab539[_0x4e38('0x3e')],_0x23f242[_0x4e38('0x46')]),_0x7af284);if(_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x48')]){_0x34abd7['where']=_['merge'](_0x34abd7[_0x4e38('0x45')],{'$or':_['map'](_0x7af284,function(_0x3c3710){if(_0x3c3710[_0x4e38('0x3a')]!==_0x4e38('0x49')){var _0x8c1bf={};_0x8c1bf[_0x3c3710['name']]={'$like':'%'+_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x48')]+'%'};return _0x8c1bf;}})});}_0x34abd7=_['merge']({},_0x34abd7,_0x7ab539[_0x4e38('0x4a')]);var _0x50842a={'where':_0x34abd7[_0x4e38('0x45')]};return db[_0x4e38('0x38')][_0x4e38('0x28')](_0x50842a)[_0x4e38('0x17')](function(_0xe63ddb){_0x5944c7['count']=_0xe63ddb;if(_0x7ab539[_0x4e38('0x3e')][_0x4e38('0x4b')]){_0x34abd7[_0x4e38('0x4c')]=[{'all':!![]}];}return db[_0x4e38('0x38')][_0x4e38('0x4d')](_0x34abd7);})[_0x4e38('0x17')](function(_0x5381d5){_0x5944c7[_0x4e38('0x4e')]=_0x5381d5;return _0x5944c7;})[_0x4e38('0x17')](respondWithFilteredResult(_0x4a0541,_0x34abd7))[_0x4e38('0x21')](handleError(_0x4a0541,null));};exports['show']=function(_0x2796e8,_0x1ad09b){var _0x4141cc={'raw':![],'where':{'id':_0x2796e8['params']['id']}},_0x4a8185={};_0x4a8185[_0x4e38('0x3c')]=_['keys'](db[_0x4e38('0x38')][_0x4e38('0x4f')]);_0x4a8185['query']=_[_0x4e38('0x3d')](_0x2796e8[_0x4e38('0x3e')]);_0x4a8185[_0x4e38('0x46')]=_[_0x4e38('0x3f')](_0x4a8185['model'],_0x4a8185[_0x4e38('0x3e')]);_0x4141cc[_0x4e38('0x41')]=_[_0x4e38('0x3f')](_0x4a8185[_0x4e38('0x3c')],qs[_0x4e38('0x40')](_0x2796e8['query'][_0x4e38('0x40')]));_0x4141cc[_0x4e38('0x41')]=_0x4141cc[_0x4e38('0x41')][_0x4e38('0x50')]?_0x4141cc[_0x4e38('0x41')]:_0x4a8185['model'];if(_0x2796e8[_0x4e38('0x3e')][_0x4e38('0x4b')]){_0x4141cc['include']=[{'all':!![]}];}_0x4141cc=_[_0x4e38('0x31')]({},_0x4141cc,_0x2796e8[_0x4e38('0x4a')]);return db[_0x4e38('0x38')][_0x4e38('0x51')](_0x4141cc)[_0x4e38('0x17')](handleEntityNotFound(_0x1ad09b,null))['then'](respondWithResult(_0x1ad09b,null))[_0x4e38('0x21')](handleError(_0x1ad09b,null));};exports[_0x4e38('0x52')]=function(_0x467817,_0x370e6d){return db[_0x4e38('0x38')][_0x4e38('0x52')](_0x467817[_0x4e38('0x32')],{})[_0x4e38('0x17')](respondWithResult(_0x370e6d,0xc9))['catch'](handleError(_0x370e6d,null));};exports['update']=function(_0x9e8422,_0x9c4a8){if(_0x9e8422[_0x4e38('0x32')]['id']){delete _0x9e8422['body']['id'];}return db[_0x4e38('0x38')][_0x4e38('0x51')]({'where':{'id':_0x9e8422[_0x4e38('0x53')]['id']}})[_0x4e38('0x17')](handleEntityNotFound(_0x9c4a8,null))[_0x4e38('0x17')](saveUpdates(_0x9e8422[_0x4e38('0x32')],null))[_0x4e38('0x17')](respondWithResult(_0x9c4a8,null))[_0x4e38('0x21')](handleError(_0x9c4a8,null));};exports[_0x4e38('0x54')]=function(_0x32f92f,_0x434b08){return db[_0x4e38('0x38')][_0x4e38('0x51')]({'where':{'id':_0x32f92f['params']['id']}})['then'](handleEntityNotFound(_0x434b08,null))['then'](removeEntity(_0x434b08,null))[_0x4e38('0x21')](handleError(_0x434b08,null));};exports[_0x4e38('0x55')]=function(_0x56adf3,_0x394659,_0x4d47fa){var _0xdf903c={};var _0x4523fe={};var _0x4bfbe1;var _0x2f7c71;return db['ZohoAccount'][_0x4e38('0x56')]({'where':{'id':_0x56adf3[_0x4e38('0x53')]['id']}})[_0x4e38('0x17')](handleEntityNotFound(_0x394659,null))[_0x4e38('0x17')](function(_0x117745){if(_0x117745){_0x4bfbe1=_0x117745;_0x4523fe[_0x4e38('0x3c')]=_[_0x4e38('0x3d')](db[_0x4e38('0x57')][_0x4e38('0x4f')]);_0x4523fe[_0x4e38('0x3e')]=_[_0x4e38('0x3d')](_0x56adf3[_0x4e38('0x3e')]);_0x4523fe[_0x4e38('0x46')]=_['intersection'](_0x4523fe[_0x4e38('0x3c')],_0x4523fe['query']);_0xdf903c[_0x4e38('0x41')]=_[_0x4e38('0x3f')](_0x4523fe[_0x4e38('0x3c')],qs[_0x4e38('0x40')](_0x56adf3[_0x4e38('0x3e')]['fields']));_0xdf903c[_0x4e38('0x41')]=_0xdf903c[_0x4e38('0x41')][_0x4e38('0x50')]?_0xdf903c[_0x4e38('0x41')]:_0x4523fe[_0x4e38('0x3c')];_0xdf903c['order']=qs['sort'](_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x44')]);_0xdf903c['where']=qs[_0x4e38('0x46')](_['pick'](_0x56adf3['query'],_0x4523fe[_0x4e38('0x46')]));if(_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x48')]){_0xdf903c[_0x4e38('0x45')]=_[_0x4e38('0x31')](_0xdf903c[_0x4e38('0x45')],{'$or':_['map'](_0xdf903c[_0x4e38('0x41')],function(_0x487056){var _0x3a52f4={};_0x3a52f4[_0x487056]={'$like':'%'+_0x56adf3[_0x4e38('0x3e')]['filter']+'%'};return _0x3a52f4;})});}_0xdf903c=_[_0x4e38('0x31')]({},_0xdf903c,_0x56adf3['options']);return _0x4bfbe1[_0x4e38('0x55')](_0xdf903c);}})[_0x4e38('0x17')](function(_0x449177){if(_0x449177){_0x2f7c71=_0x449177[_0x4e38('0x50')];if(!_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x42')](_0x4e38('0x58'))){_0xdf903c[_0x4e38('0x27')]=qs['limit'](_0x56adf3['query'][_0x4e38('0x27')]);_0xdf903c[_0x4e38('0x29')]=qs['offset'](_0x56adf3[_0x4e38('0x3e')][_0x4e38('0x29')]);}return _0x4bfbe1[_0x4e38('0x55')](_0xdf903c);}})['then'](function(_0x2fd29e){if(_0x2fd29e){return _0x2fd29e?{'count':_0x2f7c71,'rows':_0x2fd29e}:null;}})['then'](respondWithResult(_0x394659,null))[_0x4e38('0x21')](handleError(_0x394659,null));};exports[_0x4e38('0x59')]=function(_0x53e701,_0x2b0f05,_0x5bcec2){if(_0x53e701['body']['id']){delete _0x53e701['body']['id'];}return db[_0x4e38('0x38')][_0x4e38('0x56')]({'where':{'id':_0x53e701[_0x4e38('0x53')]['id']}})[_0x4e38('0x17')](handleEntityNotFound(_0x2b0f05,null))[_0x4e38('0x17')](function(_0x3aade5){if(_0x3aade5){_0x53e701[_0x4e38('0x32')]['AccountId']=_0x3aade5['id'];_0x53e701[_0x4e38('0x32')][_0x4e38('0x5a')]=integrations[_0x4e38('0x5b')](_0x53e701[_0x4e38('0x32')]['channel'],_0x53e701['body'][_0x4e38('0x3a')]);_0x53e701[_0x4e38('0x32')]['Descriptions']=integrations[_0x4e38('0x5c')](_0x53e701[_0x4e38('0x32')][_0x4e38('0x5d')],_0x53e701[_0x4e38('0x32')][_0x4e38('0x3a')]);return db[_0x4e38('0x57')]['create'](_0x53e701['body'],{'include':[{'model':db[_0x4e38('0x5e')],'as':_0x4e38('0x5a')},{'model':db[_0x4e38('0x5e')],'as':_0x4e38('0x5f')}]});}return null;})[_0x4e38('0x17')](respondWithResult(_0x2b0f05,null))[_0x4e38('0x21')](handleError(_0x2b0f05,null));};function getAccessToken(_0x3d037a){return new Promise(function(_0x598f54,_0x438493){var _0x53e699;switch(_0x3d037a[_0x4e38('0x60')]){case'US':_0x53e699=_0x4e38('0x61');break;case'AU':_0x53e699='https://accounts.zoho.com.au';break;case'EU':_0x53e699=_0x4e38('0x62');break;case'IN':_0x53e699=_0x4e38('0x63');break;case'CN':_0x53e699=_0x4e38('0x64');break;default:_0x53e699=_0x4e38('0x62');break;}var _0x481787={'method':_0x4e38('0x65'),'uri':_0x53e699+'/oauth/v2/token','qs':{'refresh_token':_0x3d037a['refreshToken'],'client_id':_0x3d037a[_0x4e38('0x66')],'client_secret':_0x3d037a[_0x4e38('0x67')],'grant_type':_0x4e38('0x68')},'json':!![]};return rp(_0x481787)[_0x4e38('0x17')](function(_0x4c6eb1){if(_0x4c6eb1['access_token']){_0x598f54(_0x4c6eb1[_0x4e38('0x69')]);}else{_0x438493(_0x4e38('0x6a'));}})[_0x4e38('0x21')](function(_0x54bcc6){_0x438493(_0x54bcc6);});});}exports[_0x4e38('0x6b')]=function(_0x1d731c,_0x102617,_0x5e5ee2){var _0x2d2697,_0x22233f,_0xea53a5,_0x132f7f,_0x35e19a;return db[_0x4e38('0x38')]['findOne']({'where':{'id':_0x1d731c[_0x4e38('0x53')]['id']},'attributes':['id',_0x4e38('0x6c'),_0x4e38('0x60'),_0x4e38('0x66'),'clientSecret','serverUrl',_0x4e38('0x1d'),_0x4e38('0x6d')]})[_0x4e38('0x17')](handleEntityNotFound(_0x102617,null))[_0x4e38('0x17')](function(_0x326900){_0x35e19a=_0x326900;_0x2d2697=_0x35e19a[_0x4e38('0x6c')];_0x22233f=_0x2d2697==='zoho.eu'?'eu':'com';_0xea53a5=_0x35e19a['serverUrl'];var _0x406a4c=_0xea53a5[_0x4e38('0x6e')](-0x1);if(_0x406a4c==='/'||_0x406a4c==='\x5c'||_0x406a4c===':'){_0xea53a5=_0xea53a5[_0x4e38('0x6f')](0x0,_0xea53a5['lastIndexOf'](_0x406a4c));}if(!_0x35e19a[_0x4e38('0x6d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x35e19a);})[_0x4e38('0x17')](function(_0x817ce0){if(_0x817ce0){return rp({'method':_0x4e38('0x70'),'uri':util[_0x4e38('0x71')](_0x4e38('0x72'),_0x22233f),'qs':{'module':_0x4e38('0x73')},'headers':{'Authorization':_0x4e38('0x74')+_0x817ce0},'json':!![]});}})[_0x4e38('0x17')](function(_0x695b02){if(_0x695b02){if(_0x695b02[_0x4e38('0x75')]&&_0x695b02[_0x4e38('0x75')][_0x4e38('0x1c')]){throw new Error(_0x695b02[_0x4e38('0x75')][_0x4e38('0x1c')][_0x4e38('0x1e')]);}var _0x1ef91f=[];var _0x54e2ab=[];var _0x3e6f14=[_0x4e38('0x76'),_0x4e38('0x77'),_0x4e38('0x78'),_0x4e38('0x79'),'Call_Duration',_0x4e38('0x7a'),'Call_Start_Time',_0x4e38('0x7b')];_0x54e2ab=_[_0x4e38('0x7c')](_0x695b02[_0x4e38('0x40')],function(_0x3af60a){return _0x3e6f14[_0x4e38('0x7d')](_0x3af60a[_0x4e38('0x7e')]);});for(var _0x198330=0x0;_0x198330<_0x54e2ab[_0x4e38('0x50')];_0x198330++){if(_0x54e2ab[_0x198330][_0x4e38('0x7f')]===![]){_0x1ef91f[_0x4e38('0x80')]({'id':_0x54e2ab[_0x198330]['id'],'name':_0x54e2ab[_0x198330][_0x4e38('0x81')],'custom':_0x54e2ab[_0x198330]['custom_field'],'options':_0x54e2ab[_0x198330]['data_type']===_0x4e38('0x82')&&_0x54e2ab[_0x198330][_0x4e38('0x83')][_0x4e38('0x50')]>-0x1?_[_0x4e38('0x37')](_0x54e2ab[_0x198330]['pick_list_values'],function(_0xc1957e){return{'name':_0xc1957e,'value':_0xc1957e};}):[]});}}return{'count':_0x1ef91f[_0x4e38('0x50')],'rows':_0x1ef91f};}else{return{'count':0x0,'rows':[]};}})[_0x4e38('0x17')](respondWithResult(_0x102617,null))[_0x4e38('0x21')](function(_0x12313d){var _0x2f3d82=_0x1d731c[_0x4e38('0x3e')][_0x4e38('0x84')]?0x1f4:_0x12313d['statusCode']||0x1f4;logger[_0x4e38('0x1c')](_0x4e38('0x85'),_0x4e38('0x6b'),_0x2f3d82,JSON[_0x4e38('0x86')](_0x12313d));delete _0x12313d['name'];if(_0x2f3d82===0x191){_0x2f3d82=0x190;}_0x102617['status'](_0x2f3d82)[_0x4e38('0x2f')](_0x1d731c[_0x4e38('0x3e')][_0x4e38('0x84')]?{'message':_0x4e38('0x87'),'statusCode':_0x12313d[_0x4e38('0x88')]}:_0x12313d);});}; \ No newline at end of file +var _0x0faf=['POST','/oauth/v2/token','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','refreshToken','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','offset','set','apply','reject','end','stack','name','send','merge','body','contact','agent','map','ZohoAccount','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','count','includeAll','findAll','rows','params','include','create','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','channel','getDescriptions','Subjects','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x3d1fa2,_0x2b15d7){var _0x4af0a2=function(_0x1e35a8){while(--_0x1e35a8){_0x3d1fa2['push'](_0x3d1fa2['shift']());}};_0x4af0a2(++_0x2b15d7);}(_0x0faf,0x132));var _0xf0fa=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x0faf[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0xf0fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0fa('0x1'));var jsonpatch=require(_0xf0fa('0x2'));var rp=require(_0xf0fa('0x3'));var moment=require(_0xf0fa('0x4'));var BPromise=require(_0xf0fa('0x5'));var Mustache=require(_0xf0fa('0x6'));var util=require(_0xf0fa('0x7'));var path=require(_0xf0fa('0x8'));var sox=require(_0xf0fa('0x9'));var csv=require('to-csv');var ejs=require(_0xf0fa('0xa'));var fs=require('fs');var fs_extra=require(_0xf0fa('0xb'));var _=require(_0xf0fa('0xc'));var squel=require(_0xf0fa('0xd'));var crypto=require(_0xf0fa('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf0fa('0xf'));var toCsv=require(_0xf0fa('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf0fa('0x11'));var authService=require(_0xf0fa('0x12'));var qs=require(_0xf0fa('0x13'));var as=require(_0xf0fa('0x14'));var hardwareService=require(_0xf0fa('0x15'));var logger=require(_0xf0fa('0x16'))(_0xf0fa('0x17'));var utils=require(_0xf0fa('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf0fa('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf0fa('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xf0fa('0x1b')][_0xf0fa('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x39a086,_0x547952,_0x5821ae,_0x42591b){return new BPromise(function(_0x540a04,_0x1f7159){var _0x81fc49=_0x42591b||client;return _0x81fc49[_0xf0fa('0x1d')](_0x39a086,_0x5821ae)[_0xf0fa('0x1e')](function(_0x467d5f){logger[_0xf0fa('0x1f')](_0xf0fa('0x20'),_0x547952,_0xf0fa('0x21'));logger['debug'](_0xf0fa('0x22'),_0x547952,_0xf0fa('0x21'),JSON[_0xf0fa('0x23')](_0x467d5f));if(_0x467d5f[_0xf0fa('0x24')]){if(_0x467d5f[_0xf0fa('0x24')][_0xf0fa('0x25')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x547952,_0x467d5f[_0xf0fa('0x24')][_0xf0fa('0x26')]);return _0x1f7159(_0x467d5f[_0xf0fa('0x24')][_0xf0fa('0x26')]);}logger[_0xf0fa('0x24')](_0xf0fa('0x20'),_0x547952,_0x467d5f[_0xf0fa('0x24')][_0xf0fa('0x26')]);return _0x540a04(_0x467d5f[_0xf0fa('0x24')][_0xf0fa('0x26')]);}else{logger[_0xf0fa('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x547952,_0xf0fa('0x21'));_0x540a04(_0x467d5f[_0xf0fa('0x27')][_0xf0fa('0x26')]);}})[_0xf0fa('0x28')](function(_0x3273b9){logger[_0xf0fa('0x24')](_0xf0fa('0x20'),_0x547952,_0x3273b9);_0x1f7159(_0x3273b9);});});}function respondWithStatusCode(_0x1f0eaf,_0x3feb0c){_0x3feb0c=_0x3feb0c||0xcc;return function(_0x4a897f){if(_0x4a897f){return _0x1f0eaf[_0xf0fa('0x29')](_0x3feb0c);}return _0x1f0eaf[_0xf0fa('0x2a')](_0x3feb0c)['end']();};}function respondWithResult(_0x3b5d7d,_0x3703b5){_0x3703b5=_0x3703b5||0xc8;return function(_0x2efe88){if(_0x2efe88){return _0x3b5d7d['status'](_0x3703b5)[_0xf0fa('0x2b')](_0x2efe88);}};}function respondWithFilteredResult(_0x284499,_0x3d10fb){return function(_0xf631f6){if(_0xf631f6){var _0x4e6eef=typeof _0x3d10fb['offset']===_0xf0fa('0x2c')&&typeof _0x3d10fb[_0xf0fa('0x2d')]===_0xf0fa('0x2c');var _0x11085f=_0xf631f6['count'];var _0x4058d6=_0x4e6eef?0x0:_0x3d10fb[_0xf0fa('0x2e')];var _0x1279cf=_0x4e6eef?_0xf631f6['count']:_0x3d10fb[_0xf0fa('0x2e')]+_0x3d10fb['limit'];var _0x42c656;if(_0x1279cf>=_0x11085f){_0x1279cf=_0x11085f;_0x42c656=0xc8;}else{_0x42c656=0xce;}_0x284499[_0xf0fa('0x2a')](_0x42c656);return _0x284499[_0xf0fa('0x2f')]('Content-Range',_0x4058d6+'-'+_0x1279cf+'/'+_0x11085f)[_0xf0fa('0x2b')](_0xf631f6);}return null;};}function patchUpdates(_0x33cc64){return function(_0x574ba7){try{jsonpatch[_0xf0fa('0x30')](_0x574ba7,_0x33cc64,!![]);}catch(_0x2cb17d){return BPromise[_0xf0fa('0x31')](_0x2cb17d);}return _0x574ba7['save']();};}function saveUpdates(_0x534c10,_0x36173a){return function(_0x255f9d){if(_0x255f9d){return _0x255f9d['update'](_0x534c10)[_0xf0fa('0x1e')](function(_0x50e0bd){return _0x50e0bd;});}return null;};}function removeEntity(_0x5ca1b2,_0x47dcbb){return function(_0x39bce0){if(_0x39bce0){return _0x39bce0['destroy']()[_0xf0fa('0x1e')](function(){_0x5ca1b2[_0xf0fa('0x2a')](0xcc)[_0xf0fa('0x32')]();});}};}function handleEntityNotFound(_0x3993ce,_0x19c97e){return function(_0x36f853){if(!_0x36f853){_0x3993ce[_0xf0fa('0x29')](0x194);}return _0x36f853;};}function handleError(_0xe61cb7,_0x52cece){_0x52cece=_0x52cece||0x1f4;return function(_0x3abd96){logger[_0xf0fa('0x24')](_0x3abd96[_0xf0fa('0x33')]);if(_0x3abd96['name']){delete _0x3abd96[_0xf0fa('0x34')];}_0xe61cb7[_0xf0fa('0x2a')](_0x52cece)[_0xf0fa('0x35')](_0x3abd96);};}function getMustacheRender(_0xb29ae5,_0x4879ef){return Mustache['render'](_0xb29ae5,_[_0xf0fa('0x36')](_0x4879ef[_0xf0fa('0x37')],{'contact':_0x4879ef[_0xf0fa('0x38')],'message':_0x4879ef[_0xf0fa('0x26')],'agent':_0x4879ef[_0xf0fa('0x39')],'interaction':_0x4879ef['interaction'],'account':_0x4879ef['account']}))||'';}exports['index']=function(_0x596c2a,_0x3cdc0e){var _0x778121={},_0x5ef93e={},_0x4ff1a5={'count':0x0,'rows':[]};var _0xdada45=_[_0xf0fa('0x3a')](db[_0xf0fa('0x3b')][_0xf0fa('0x3c')],function(_0x2202de){return{'name':_0x2202de[_0xf0fa('0x3d')],'type':_0x2202de[_0xf0fa('0x3e')]['key']};});_0x5ef93e['model']=_[_0xf0fa('0x3a')](_0xdada45,_0xf0fa('0x34'));_0x5ef93e[_0xf0fa('0x3f')]=_[_0xf0fa('0x40')](_0x596c2a[_0xf0fa('0x3f')]);_0x5ef93e[_0xf0fa('0x41')]=_['intersection'](_0x5ef93e[_0xf0fa('0x42')],_0x5ef93e['query']);_0x778121[_0xf0fa('0x43')]=_[_0xf0fa('0x44')](_0x5ef93e[_0xf0fa('0x42')],qs[_0xf0fa('0x45')](_0x596c2a[_0xf0fa('0x3f')][_0xf0fa('0x45')]));_0x778121[_0xf0fa('0x43')]=_0x778121[_0xf0fa('0x43')][_0xf0fa('0x46')]?_0x778121['attributes']:_0x5ef93e['model'];if(!_0x596c2a['query'][_0xf0fa('0x47')](_0xf0fa('0x48'))){_0x778121['limit']=qs[_0xf0fa('0x2d')](_0x596c2a[_0xf0fa('0x3f')][_0xf0fa('0x2d')]);_0x778121[_0xf0fa('0x2e')]=qs['offset'](_0x596c2a[_0xf0fa('0x3f')][_0xf0fa('0x2e')]);}_0x778121[_0xf0fa('0x49')]=qs[_0xf0fa('0x4a')](_0x596c2a[_0xf0fa('0x3f')][_0xf0fa('0x4a')]);_0x778121[_0xf0fa('0x4b')]=qs[_0xf0fa('0x41')](_[_0xf0fa('0x4c')](_0x596c2a['query'],_0x5ef93e[_0xf0fa('0x41')]),_0xdada45);if(_0x596c2a[_0xf0fa('0x3f')][_0xf0fa('0x4d')]){_0x778121[_0xf0fa('0x4b')]=_[_0xf0fa('0x36')](_0x778121[_0xf0fa('0x4b')],{'$or':_['map'](_0xdada45,function(_0xd86643){if(_0xd86643[_0xf0fa('0x3e')]!=='VIRTUAL'){var _0x1e13f6={};_0x1e13f6[_0xd86643[_0xf0fa('0x34')]]={'$like':'%'+_0x596c2a[_0xf0fa('0x3f')][_0xf0fa('0x4d')]+'%'};return _0x1e13f6;}})});}_0x778121=_[_0xf0fa('0x36')]({},_0x778121,_0x596c2a[_0xf0fa('0x4e')]);var _0x41d83d={'where':_0x778121[_0xf0fa('0x4b')]};return db[_0xf0fa('0x3b')]['count'](_0x41d83d)[_0xf0fa('0x1e')](function(_0x4b1f41){_0x4ff1a5[_0xf0fa('0x4f')]=_0x4b1f41;if(_0x596c2a[_0xf0fa('0x3f')][_0xf0fa('0x50')]){_0x778121['include']=[{'all':!![]}];}return db[_0xf0fa('0x3b')][_0xf0fa('0x51')](_0x778121);})[_0xf0fa('0x1e')](function(_0x3c956d){_0x4ff1a5[_0xf0fa('0x52')]=_0x3c956d;return _0x4ff1a5;})['then'](respondWithFilteredResult(_0x3cdc0e,_0x778121))[_0xf0fa('0x28')](handleError(_0x3cdc0e,null));};exports['show']=function(_0x19c22f,_0x821e40){var _0x18dd7b={'raw':![],'where':{'id':_0x19c22f[_0xf0fa('0x53')]['id']}},_0x141087={};_0x141087['model']=_[_0xf0fa('0x40')](db[_0xf0fa('0x3b')][_0xf0fa('0x3c')]);_0x141087[_0xf0fa('0x3f')]=_[_0xf0fa('0x40')](_0x19c22f[_0xf0fa('0x3f')]);_0x141087['filters']=_[_0xf0fa('0x44')](_0x141087['model'],_0x141087['query']);_0x18dd7b['attributes']=_[_0xf0fa('0x44')](_0x141087[_0xf0fa('0x42')],qs[_0xf0fa('0x45')](_0x19c22f[_0xf0fa('0x3f')][_0xf0fa('0x45')]));_0x18dd7b[_0xf0fa('0x43')]=_0x18dd7b[_0xf0fa('0x43')][_0xf0fa('0x46')]?_0x18dd7b[_0xf0fa('0x43')]:_0x141087['model'];if(_0x19c22f[_0xf0fa('0x3f')]['includeAll']){_0x18dd7b[_0xf0fa('0x54')]=[{'all':!![]}];}_0x18dd7b=_[_0xf0fa('0x36')]({},_0x18dd7b,_0x19c22f[_0xf0fa('0x4e')]);return db[_0xf0fa('0x3b')]['find'](_0x18dd7b)[_0xf0fa('0x1e')](handleEntityNotFound(_0x821e40,null))['then'](respondWithResult(_0x821e40,null))[_0xf0fa('0x28')](handleError(_0x821e40,null));};exports[_0xf0fa('0x55')]=function(_0x10b45c,_0x1d6a27){return db[_0xf0fa('0x3b')][_0xf0fa('0x55')](_0x10b45c['body'],{})[_0xf0fa('0x1e')](respondWithResult(_0x1d6a27,0xc9))[_0xf0fa('0x28')](handleError(_0x1d6a27,null));};exports['update']=function(_0x4498b3,_0x3ed186){if(_0x4498b3['body']['id']){delete _0x4498b3[_0xf0fa('0x37')]['id'];}return db[_0xf0fa('0x3b')]['find']({'where':{'id':_0x4498b3[_0xf0fa('0x53')]['id']}})[_0xf0fa('0x1e')](handleEntityNotFound(_0x3ed186,null))[_0xf0fa('0x1e')](saveUpdates(_0x4498b3['body'],null))[_0xf0fa('0x1e')](respondWithResult(_0x3ed186,null))[_0xf0fa('0x28')](handleError(_0x3ed186,null));};exports['destroy']=function(_0x22ed85,_0x34147c){return db[_0xf0fa('0x3b')]['find']({'where':{'id':_0x22ed85[_0xf0fa('0x53')]['id']}})[_0xf0fa('0x1e')](handleEntityNotFound(_0x34147c,null))['then'](removeEntity(_0x34147c,null))[_0xf0fa('0x28')](handleError(_0x34147c,null));};exports[_0xf0fa('0x56')]=function(_0x11749e,_0x2b04a8,_0x32367e){var _0x19c816={};var _0x1e4e4d={};var _0x337640;var _0x32c846;return db[_0xf0fa('0x3b')]['findOne']({'where':{'id':_0x11749e[_0xf0fa('0x53')]['id']}})[_0xf0fa('0x1e')](handleEntityNotFound(_0x2b04a8,null))[_0xf0fa('0x1e')](function(_0x664a0d){if(_0x664a0d){_0x337640=_0x664a0d;_0x1e4e4d[_0xf0fa('0x42')]=_[_0xf0fa('0x40')](db[_0xf0fa('0x57')]['rawAttributes']);_0x1e4e4d[_0xf0fa('0x3f')]=_[_0xf0fa('0x40')](_0x11749e[_0xf0fa('0x3f')]);_0x1e4e4d[_0xf0fa('0x41')]=_[_0xf0fa('0x44')](_0x1e4e4d[_0xf0fa('0x42')],_0x1e4e4d[_0xf0fa('0x3f')]);_0x19c816['attributes']=_[_0xf0fa('0x44')](_0x1e4e4d[_0xf0fa('0x42')],qs[_0xf0fa('0x45')](_0x11749e[_0xf0fa('0x3f')][_0xf0fa('0x45')]));_0x19c816['attributes']=_0x19c816['attributes']['length']?_0x19c816[_0xf0fa('0x43')]:_0x1e4e4d[_0xf0fa('0x42')];_0x19c816[_0xf0fa('0x49')]=qs[_0xf0fa('0x4a')](_0x11749e['query']['sort']);_0x19c816[_0xf0fa('0x4b')]=qs['filters'](_[_0xf0fa('0x4c')](_0x11749e[_0xf0fa('0x3f')],_0x1e4e4d[_0xf0fa('0x41')]));if(_0x11749e[_0xf0fa('0x3f')][_0xf0fa('0x4d')]){_0x19c816['where']=_[_0xf0fa('0x36')](_0x19c816[_0xf0fa('0x4b')],{'$or':_[_0xf0fa('0x3a')](_0x19c816[_0xf0fa('0x43')],function(_0x3e3f6b){var _0x43bad2={};_0x43bad2[_0x3e3f6b]={'$like':'%'+_0x11749e[_0xf0fa('0x3f')][_0xf0fa('0x4d')]+'%'};return _0x43bad2;})});}_0x19c816=_[_0xf0fa('0x36')]({},_0x19c816,_0x11749e['options']);return _0x337640['getConfigurations'](_0x19c816);}})[_0xf0fa('0x1e')](function(_0x4d8d2f){if(_0x4d8d2f){_0x32c846=_0x4d8d2f[_0xf0fa('0x46')];if(!_0x11749e['query']['hasOwnProperty']('nolimit')){_0x19c816[_0xf0fa('0x2d')]=qs[_0xf0fa('0x2d')](_0x11749e[_0xf0fa('0x3f')][_0xf0fa('0x2d')]);_0x19c816[_0xf0fa('0x2e')]=qs[_0xf0fa('0x2e')](_0x11749e[_0xf0fa('0x3f')][_0xf0fa('0x2e')]);}return _0x337640[_0xf0fa('0x56')](_0x19c816);}})[_0xf0fa('0x1e')](function(_0x5b4a09){if(_0x5b4a09){return _0x5b4a09?{'count':_0x32c846,'rows':_0x5b4a09}:null;}})[_0xf0fa('0x1e')](respondWithResult(_0x2b04a8,null))['catch'](handleError(_0x2b04a8,null));};exports[_0xf0fa('0x58')]=function(_0x56c701,_0x3d2f00,_0x499e82){if(_0x56c701[_0xf0fa('0x37')]['id']){delete _0x56c701['body']['id'];}return db[_0xf0fa('0x3b')][_0xf0fa('0x59')]({'where':{'id':_0x56c701[_0xf0fa('0x53')]['id']}})[_0xf0fa('0x1e')](handleEntityNotFound(_0x3d2f00,null))[_0xf0fa('0x1e')](function(_0x519431){if(_0x519431){_0x56c701['body'][_0xf0fa('0x5a')]=_0x519431['id'];_0x56c701[_0xf0fa('0x37')]['Subjects']=integrations['getSubjects'](_0x56c701[_0xf0fa('0x37')][_0xf0fa('0x5b')],_0x56c701[_0xf0fa('0x37')][_0xf0fa('0x3e')]);_0x56c701[_0xf0fa('0x37')]['Descriptions']=integrations[_0xf0fa('0x5c')](_0x56c701[_0xf0fa('0x37')][_0xf0fa('0x5b')],_0x56c701['body']['type']);return db[_0xf0fa('0x57')][_0xf0fa('0x55')](_0x56c701['body'],{'include':[{'model':db['ZohoField'],'as':_0xf0fa('0x5d')},{'model':db[_0xf0fa('0x5e')],'as':_0xf0fa('0x5f')}]});}return null;})['then'](respondWithResult(_0x3d2f00,null))['catch'](handleError(_0x3d2f00,null));};function getAccessToken(_0x516eec){return new Promise(function(_0x39711c,_0x4df165){var _0x5a27e8;switch(_0x516eec[_0xf0fa('0x60')]){case'US':_0x5a27e8=_0xf0fa('0x61');break;case'AU':_0x5a27e8=_0xf0fa('0x62');break;case'EU':_0x5a27e8=_0xf0fa('0x63');break;case'IN':_0x5a27e8=_0xf0fa('0x64');break;case'CN':_0x5a27e8=_0xf0fa('0x65');break;default:_0x5a27e8='https://accounts.zoho.eu';break;}var _0x1b538a={'method':_0xf0fa('0x66'),'uri':_0x5a27e8+_0xf0fa('0x67'),'qs':{'refresh_token':_0x516eec['refreshToken'],'client_id':_0x516eec[_0xf0fa('0x68')],'client_secret':_0x516eec['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1b538a)[_0xf0fa('0x1e')](function(_0x5141d4){if(_0x5141d4['access_token']){_0x39711c(_0x5141d4[_0xf0fa('0x69')]);}else{_0x4df165(_0xf0fa('0x6a'));}})[_0xf0fa('0x28')](function(_0x581f37){_0x4df165(_0x581f37);});});}exports[_0xf0fa('0x6b')]=function(_0x168099,_0x552b9e,_0x6fc2af){var _0xb8aff2,_0x22c518,_0xe232f8,_0x1461e1,_0x1d74f2;return db['ZohoAccount'][_0xf0fa('0x59')]({'where':{'id':_0x168099['params']['id']},'attributes':['id',_0xf0fa('0x6c'),_0xf0fa('0x60'),_0xf0fa('0x68'),_0xf0fa('0x6d'),_0xf0fa('0x6e'),_0xf0fa('0x25'),_0xf0fa('0x6f')]})['then'](handleEntityNotFound(_0x552b9e,null))['then'](function(_0x9700df){_0x1d74f2=_0x9700df;_0xb8aff2=_0x1d74f2[_0xf0fa('0x6c')];_0x22c518=_0xb8aff2==='zoho.eu'?'eu':_0xf0fa('0x70');_0xe232f8=_0x1d74f2['serverUrl'];var _0x48a828=_0xe232f8[_0xf0fa('0x71')](-0x1);if(_0x48a828==='/'||_0x48a828==='\x5c'||_0x48a828===':'){_0xe232f8=_0xe232f8[_0xf0fa('0x72')](0x0,_0xe232f8['lastIndexOf'](_0x48a828));}if(!_0x1d74f2['refreshToken']){throw new Error(_0xf0fa('0x73'));}return getAccessToken(_0x1d74f2);})[_0xf0fa('0x1e')](function(_0xc7cac3){if(_0xc7cac3){return rp({'method':_0xf0fa('0x74'),'uri':util[_0xf0fa('0x75')](_0xf0fa('0x76'),_0x22c518),'qs':{'module':'Calls'},'headers':{'Authorization':_0xf0fa('0x77')+_0xc7cac3},'json':!![]});}})[_0xf0fa('0x1e')](function(_0x4c5de4){if(_0x4c5de4){if(_0x4c5de4[_0xf0fa('0x78')]&&_0x4c5de4['response'][_0xf0fa('0x24')]){throw new Error(_0x4c5de4['response']['error'][_0xf0fa('0x26')]);}var _0x5cb189=[];var _0x51db99=[];var _0x4d74af=['Owner',_0xf0fa('0x79'),'Description',_0xf0fa('0x7a'),_0xf0fa('0x7b'),'Call_Result',_0xf0fa('0x7c'),_0xf0fa('0x7d')];_0x51db99=_[_0xf0fa('0x7e')](_0x4c5de4[_0xf0fa('0x45')],function(_0x4e5a0e){return _0x4d74af[_0xf0fa('0x7f')](_0x4e5a0e['api_name']);});for(var _0x12ee3b=0x0;_0x12ee3b<_0x51db99['length'];_0x12ee3b++){if(_0x51db99[_0x12ee3b][_0xf0fa('0x80')]===![]){_0x5cb189[_0xf0fa('0x81')]({'id':_0x51db99[_0x12ee3b]['id'],'name':_0x51db99[_0x12ee3b][_0xf0fa('0x82')],'custom':_0x51db99[_0x12ee3b][_0xf0fa('0x83')],'options':_0x51db99[_0x12ee3b]['data_type']==='picklist'&&_0x51db99[_0x12ee3b][_0xf0fa('0x84')]['length']>-0x1?_[_0xf0fa('0x3a')](_0x51db99[_0x12ee3b][_0xf0fa('0x84')],function(_0x15ad3d){return{'name':_0x15ad3d,'value':_0x15ad3d};}):[]});}}return{'count':_0x5cb189['length'],'rows':_0x5cb189};}else{return{'count':0x0,'rows':[]};}})[_0xf0fa('0x1e')](respondWithResult(_0x552b9e,null))['catch'](function(_0x1c8a56){var _0x2d4e61=_0x168099[_0xf0fa('0x3f')]['test']?0x1f4:_0x1c8a56[_0xf0fa('0x85')]||0x1f4;logger['error'](_0xf0fa('0x86'),_0xf0fa('0x6b'),_0x2d4e61,JSON['stringify'](_0x1c8a56));delete _0x1c8a56[_0xf0fa('0x34')];if(_0x2d4e61===0x191){_0x2d4e61=0x190;}_0x552b9e[_0xf0fa('0x2a')](_0x2d4e61)[_0xf0fa('0x35')](_0x168099[_0xf0fa('0x3f')]['test']?{'message':_0xf0fa('0x87'),'statusCode':_0x1c8a56['statusCode']}:_0x1c8a56);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 53ff3dd..cb12dd1 100644 --- a/server/api/intZohoAccount/intZohoAccount.model.js +++ b/server/api/intZohoAccount/intZohoAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c98=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','substring','https://accounts.zoho.com.cn','https://accounts.zoho.eu','application/x-www-form-urlencoded','then','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice'];(function(_0x13351f,_0x19f972){var _0x1bb620=function(_0x2a9fb1){while(--_0x2a9fb1){_0x13351f['push'](_0x13351f['shift']());}};_0x1bb620(++_0x19f972);}(_0x8c98,0x1e5));var _0x88c9=function(_0x11fff7,_0x46baaf){_0x11fff7=_0x11fff7-0x0;var _0x5214a5=_0x8c98[_0x11fff7];return _0x5214a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x88c9('0x0'))(_0x88c9('0x1'));var moment=require(_0x88c9('0x2'));var BPromise=require(_0x88c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88c9('0x4'));var rimraf=require(_0x88c9('0x5'));var config=require(_0x88c9('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x88c9('0x7'));module[_0x88c9('0x8')]=function(_0x10c496,_0x4353ee){return _0x10c496[_0x88c9('0x9')]('ZohoAccount',attributes,{'tableName':_0x88c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1374d4,_0x1c8786,_0x2b2ac1){if(_0x1374d4[_0x88c9('0xb')](_0x88c9('0xc'))||_0x1374d4['changed']('serverUrl')||_0x1374d4['changed'](_0x88c9('0xd'))||_0x1374d4[_0x88c9('0xb')](_0x88c9('0xe'))||_0x1374d4[_0x88c9('0xb')](_0x88c9('0xf'))||_0x1374d4['changed'](_0x88c9('0x10'))){var _0x4d7bc3,_0x3fb49d;_0x4d7bc3=_0x1374d4[_0x88c9('0x11')];var _0x307d27=_0x4d7bc3[_0x88c9('0x12')](-0x1);if(_0x307d27==='/'||_0x307d27==='\x5c'||_0x307d27===':'){_0x4d7bc3=_0x4d7bc3['substring'](0x0,_0x4d7bc3[_0x88c9('0x13')](_0x307d27));}switch(_0x1374d4[_0x88c9('0xc')]){case'US':_0x3fb49d=_0x88c9('0x14');break;case'AU':_0x3fb49d=_0x88c9('0x15');break;case'IN':_0x3fb49d=_0x88c9('0x16');break;case'CN':_0x3fb49d='https://accounts.zoho.com.cn';break;default:_0x3fb49d='https://accounts.zoho.eu';break;}var _0x300098={'method':_0x88c9('0x17'),'uri':_0x3fb49d+_0x88c9('0x18'),'form':{'grant_type':_0x88c9('0x19'),'client_id':_0x1374d4[_0x88c9('0xd')],'client_secret':_0x1374d4['clientSecret'],'redirect_uri':_0x1374d4[_0x88c9('0x11')],'code':_0x1374d4['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x300098)['then'](function(_0x2524ce){var _0x12d135=JSON[_0x88c9('0x1a')](_0x2524ce);if(_0x12d135[_0x88c9('0x1b')]){_0x1374d4[_0x88c9('0x1c')]=_0x12d135['refresh_token'];logger[_0x88c9('0x1d')](util[_0x88c9('0x1e')](_0x88c9('0x1f'),_0x1374d4[_0x88c9('0x20')],_0x1374d4['id']));}else{logger[_0x88c9('0x21')](util[_0x88c9('0x1e')](_0x88c9('0x22'),_0x1374d4['name'],_0x1374d4['id']),util[_0x88c9('0x23')](_0x12d135,{'showHidden':![],'depth':null}));}return _0x2b2ac1(null,_0x1c8786);})[_0x88c9('0x24')](function(_0x3812c8){logger[_0x88c9('0x21')](util[_0x88c9('0x1e')](_0x88c9('0x22'),_0x1374d4['name'],_0x1374d4['id']),util[_0x88c9('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x2b2ac1(_0x3812c8);});}else{return _0x2b2ac1(null,_0x1c8786);}},'beforeUpdate':function(_0x583d74,_0xb5ddad,_0x315871){if(_0x583d74[_0x88c9('0xb')](_0x88c9('0xc'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0x11'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0xd'))||_0x583d74['changed'](_0x88c9('0xe'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0xf'))||_0x583d74[_0x88c9('0xb')](_0x88c9('0x10'))){var _0x48a959,_0x1b3def;_0x48a959=_0x583d74[_0x88c9('0x11')];var _0x204d1a=_0x48a959[_0x88c9('0x12')](-0x1);if(_0x204d1a==='/'||_0x204d1a==='\x5c'||_0x204d1a===':'){_0x48a959=_0x48a959[_0x88c9('0x25')](0x0,_0x48a959[_0x88c9('0x13')](_0x204d1a));}switch(_0x583d74[_0x88c9('0xc')]){case'US':_0x1b3def=_0x88c9('0x14');break;case'AU':_0x1b3def=_0x88c9('0x15');break;case'IN':_0x1b3def=_0x88c9('0x16');break;case'CN':_0x1b3def=_0x88c9('0x26');break;default:_0x1b3def=_0x88c9('0x27');break;}var _0x4d9190={'method':_0x88c9('0x17'),'uri':_0x1b3def+'/oauth/v2/token','form':{'grant_type':_0x88c9('0x19'),'client_id':_0x583d74[_0x88c9('0xd')],'client_secret':_0x583d74[_0x88c9('0xe')],'redirect_uri':_0x583d74['serverUrl'],'code':_0x583d74['code']},'headers':{'Content-Type':_0x88c9('0x28')}};return rp(_0x4d9190)[_0x88c9('0x29')](function(_0x427add){var _0x3e53bb=JSON['parse'](_0x427add);if(_0x3e53bb[_0x88c9('0x1b')]){_0x583d74[_0x88c9('0x1c')]=_0x3e53bb[_0x88c9('0x1b')];logger[_0x88c9('0x1d')](util[_0x88c9('0x1e')](_0x88c9('0x1f'),_0x583d74[_0x88c9('0x20')],_0x583d74['id']));}else{logger[_0x88c9('0x21')](util[_0x88c9('0x1e')](_0x88c9('0x22'),_0x583d74['name'],_0x583d74['id']),util[_0x88c9('0x23')](_0x3e53bb,{'showHidden':![],'depth':null}));}return _0x315871(null,_0xb5ddad);})[_0x88c9('0x24')](function(_0x246259){logger[_0x88c9('0x21')](util[_0x88c9('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x583d74[_0x88c9('0x20')],_0x583d74['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x315871(_0x246259);});}else{return _0x315871(null,_0xb5ddad);}}}});}; \ No newline at end of file +var _0xdb4a=['slice','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','info','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','host'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdb4a,0xd5));var _0xadb4=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xdb4a[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xadb4('0x0'));var util=require(_0xadb4('0x1'));var logger=require('../../config/logger')(_0xadb4('0x2'));var moment=require(_0xadb4('0x3'));var BPromise=require(_0xadb4('0x4'));var rp=require(_0xadb4('0x5'));var fs=require('fs');var path=require(_0xadb4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xadb4('0x7'));var integrations=require(_0xadb4('0x8'));module[_0xadb4('0x9')]=function(_0x5cae20,_0xf963ac){return _0x5cae20['define']('ZohoAccount',attributes,{'tableName':_0xadb4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x170c51,_0x60c814,_0x2d6b1b){if(_0x170c51[_0xadb4('0xb')](_0xadb4('0xc'))||_0x170c51['changed'](_0xadb4('0xd'))||_0x170c51[_0xadb4('0xb')](_0xadb4('0xe'))||_0x170c51[_0xadb4('0xb')](_0xadb4('0xf'))||_0x170c51['changed'](_0xadb4('0x10'))||_0x170c51[_0xadb4('0xb')]('host')){var _0x15def1,_0x188afe;_0x15def1=_0x170c51[_0xadb4('0xd')];var _0x3f627c=_0x15def1['slice'](-0x1);if(_0x3f627c==='/'||_0x3f627c==='\x5c'||_0x3f627c===':'){_0x15def1=_0x15def1[_0xadb4('0x11')](0x0,_0x15def1[_0xadb4('0x12')](_0x3f627c));}switch(_0x170c51['zone']){case'US':_0x188afe=_0xadb4('0x13');break;case'AU':_0x188afe=_0xadb4('0x14');break;case'IN':_0x188afe=_0xadb4('0x15');break;case'CN':_0x188afe=_0xadb4('0x16');break;default:_0x188afe=_0xadb4('0x17');break;}var _0x257a1e={'method':_0xadb4('0x18'),'uri':_0x188afe+_0xadb4('0x19'),'form':{'grant_type':_0xadb4('0x1a'),'client_id':_0x170c51[_0xadb4('0xe')],'client_secret':_0x170c51[_0xadb4('0xf')],'redirect_uri':_0x170c51['serverUrl'],'code':_0x170c51[_0xadb4('0x10')]},'headers':{'Content-Type':_0xadb4('0x1b')}};return rp(_0x257a1e)[_0xadb4('0x1c')](function(_0x58fbb7){var _0x1ccb84=JSON[_0xadb4('0x1d')](_0x58fbb7);if(_0x1ccb84[_0xadb4('0x1e')]){_0x170c51['refreshToken']=_0x1ccb84[_0xadb4('0x1e')];logger[_0xadb4('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x170c51[_0xadb4('0x20')],_0x170c51['id']));}else{logger[_0xadb4('0x21')](util[_0xadb4('0x22')](_0xadb4('0x23'),_0x170c51[_0xadb4('0x20')],_0x170c51['id']),util['inspect'](_0x1ccb84,{'showHidden':![],'depth':null}));}return _0x2d6b1b(null,_0x60c814);})[_0xadb4('0x24')](function(_0x2240fb){logger[_0xadb4('0x21')](util[_0xadb4('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x170c51['name'],_0x170c51['id']),util[_0xadb4('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d6b1b(_0x2240fb);});}else{return _0x2d6b1b(null,_0x60c814);}},'beforeUpdate':function(_0x2ad0a9,_0x5484cf,_0x677c99){if(_0x2ad0a9[_0xadb4('0xb')](_0xadb4('0xc'))||_0x2ad0a9['changed'](_0xadb4('0xd'))||_0x2ad0a9['changed']('clientId')||_0x2ad0a9['changed'](_0xadb4('0xf'))||_0x2ad0a9[_0xadb4('0xb')](_0xadb4('0x10'))||_0x2ad0a9[_0xadb4('0xb')](_0xadb4('0x26'))){var _0xb14d33,_0xec1e94;_0xb14d33=_0x2ad0a9[_0xadb4('0xd')];var _0x409d02=_0xb14d33[_0xadb4('0x27')](-0x1);if(_0x409d02==='/'||_0x409d02==='\x5c'||_0x409d02===':'){_0xb14d33=_0xb14d33['substring'](0x0,_0xb14d33[_0xadb4('0x12')](_0x409d02));}switch(_0x2ad0a9[_0xadb4('0xc')]){case'US':_0xec1e94=_0xadb4('0x13');break;case'AU':_0xec1e94=_0xadb4('0x14');break;case'IN':_0xec1e94='https://accounts.zoho.in';break;case'CN':_0xec1e94=_0xadb4('0x16');break;default:_0xec1e94=_0xadb4('0x17');break;}var _0x4b96a8={'method':_0xadb4('0x18'),'uri':_0xec1e94+'/oauth/v2/token','form':{'grant_type':_0xadb4('0x1a'),'client_id':_0x2ad0a9[_0xadb4('0xe')],'client_secret':_0x2ad0a9[_0xadb4('0xf')],'redirect_uri':_0x2ad0a9[_0xadb4('0xd')],'code':_0x2ad0a9[_0xadb4('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4b96a8)['then'](function(_0x5ba1a4){var _0x357da7=JSON[_0xadb4('0x1d')](_0x5ba1a4);if(_0x357da7[_0xadb4('0x1e')]){_0x2ad0a9[_0xadb4('0x28')]=_0x357da7[_0xadb4('0x1e')];logger['info'](util[_0xadb4('0x22')](_0xadb4('0x29'),_0x2ad0a9[_0xadb4('0x20')],_0x2ad0a9['id']));}else{logger['error'](util[_0xadb4('0x22')](_0xadb4('0x23'),_0x2ad0a9[_0xadb4('0x20')],_0x2ad0a9['id']),util[_0xadb4('0x25')](_0x357da7,{'showHidden':![],'depth':null}));}return _0x677c99(null,_0x5484cf);})['catch'](function(_0x3d4b54){logger[_0xadb4('0x21')](util[_0xadb4('0x22')](_0xadb4('0x23'),_0x2ad0a9[_0xadb4('0x20')],_0x2ad0a9['id']),util[_0xadb4('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x677c99(_0x3d4b54);});}else{return _0x677c99(null,_0x5484cf);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 63cdb9e..ae1f7e5 100644 --- a/server/api/intZohoAccount/intZohoAccount.rpc.js +++ b/server/api/intZohoAccount/intZohoAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd296=['include','map','model','debug','stringify','ShowZohoAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes'];(function(_0xcd7e33,_0x3a9279){var _0x5c2e7a=function(_0x2b9879){while(--_0x2b9879){_0xcd7e33['push'](_0xcd7e33['shift']());}};_0x5c2e7a(++_0x3a9279);}(_0xd296,0xa2));var _0x6d29=function(_0x23576d,_0x2432c7){_0x23576d=_0x23576d-0x0;var _0x144aff=_0xd296[_0x23576d];return _0x144aff;};'use strict';var _=require('lodash');var util=require(_0x6d29('0x0'));var moment=require('moment');var BPromise=require(_0x6d29('0x1'));var rs=require(_0x6d29('0x2'));var fs=require('fs');var Redis=require(_0x6d29('0x3'));var db=require(_0x6d29('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d29('0x5'));var jayson=require(_0x6d29('0x6'));var client=jayson[_0x6d29('0x7')][_0x6d29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eff79,_0x1acc83,_0x229ea4){return new BPromise(function(_0x205f9d,_0x2e225b){return client[_0x6d29('0x9')](_0x3eff79,_0x229ea4)[_0x6d29('0xa')](function(_0x4c5c55){logger['info'](_0x6d29('0xb'),_0x1acc83,_0x6d29('0xc'));logger['debug'](_0x6d29('0xd'),_0x1acc83,_0x6d29('0xc'),JSON['stringify'](_0x4c5c55));if(_0x4c5c55[_0x6d29('0xe')]){if(_0x4c5c55[_0x6d29('0xe')]['code']===0x1f4){logger[_0x6d29('0xe')](_0x6d29('0xb'),_0x1acc83,_0x4c5c55[_0x6d29('0xe')][_0x6d29('0xf')]);return _0x2e225b(_0x4c5c55[_0x6d29('0xe')][_0x6d29('0xf')]);}logger[_0x6d29('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1acc83,_0x4c5c55[_0x6d29('0xe')]['message']);return _0x205f9d(_0x4c5c55[_0x6d29('0xe')][_0x6d29('0xf')]);}else{logger[_0x6d29('0x10')](_0x6d29('0xb'),_0x1acc83,_0x6d29('0xc'));_0x205f9d(_0x4c5c55['result']['message']);}})[_0x6d29('0x11')](function(_0x189e4d){logger[_0x6d29('0xe')](_0x6d29('0xb'),_0x1acc83,_0x189e4d);_0x2e225b(_0x189e4d);});});}exports[_0x6d29('0x12')]=function(_0x4745e1){var _0xf8bcee=this;return new Promise(function(_0x1885fd,_0xc5a641){return db[_0x6d29('0x13')]['findAll']({'raw':_0x4745e1[_0x6d29('0x14')]?_0x4745e1['options'][_0x6d29('0x15')]===undefined?!![]:![]:!![],'where':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')][_0x6d29('0x16')]||null:null,'attributes':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')][_0x6d29('0x17')]||null:null,'limit':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')]['limit']||null:null,'include':_0x4745e1[_0x6d29('0x14')]?_0x4745e1[_0x6d29('0x14')][_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x4745e1[_0x6d29('0x14')][_0x6d29('0x18')],function(_0x258f70){return{'model':db[_0x258f70[_0x6d29('0x1a')]],'as':_0x258f70['as'],'attributes':_0x258f70[_0x6d29('0x17')],'include':_0x258f70[_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x258f70[_0x6d29('0x18')],function(_0x3161f4){return{'model':db[_0x3161f4[_0x6d29('0x1a')]],'as':_0x3161f4['as'],'attributes':_0x3161f4[_0x6d29('0x17')],'include':_0x3161f4[_0x6d29('0x18')]?_['map'](_0x3161f4[_0x6d29('0x18')],function(_0x342a4f){return{'model':db[_0x342a4f[_0x6d29('0x1a')]],'as':_0x342a4f['as'],'attributes':_0x342a4f[_0x6d29('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6d29('0xa')](function(_0x4ee0e4){logger[_0x6d29('0x10')]('GetZohoAccount',_0x4745e1);logger[_0x6d29('0x1b')](_0x6d29('0x12'),_0x4745e1,JSON[_0x6d29('0x1c')](_0x4ee0e4));_0x1885fd(_0x4ee0e4);})[_0x6d29('0x11')](function(_0x1dbdd5){logger[_0x6d29('0xe')](_0x6d29('0x12'),_0x1dbdd5['message'],_0x4745e1);_0xc5a641(_0xf8bcee[_0x6d29('0xe')](0x1f4,_0x1dbdd5['message']));});});};exports[_0x6d29('0x1d')]=function(_0xba7218){var _0x589a2f=this;return new Promise(function(_0x29dcd7,_0x3fdd1f){return db[_0x6d29('0x13')][_0x6d29('0x1e')]({'raw':_0xba7218[_0x6d29('0x14')]?_0xba7218[_0x6d29('0x14')][_0x6d29('0x15')]===undefined?!![]:![]:!![],'where':_0xba7218[_0x6d29('0x14')]?_0xba7218[_0x6d29('0x14')][_0x6d29('0x16')]||null:null,'attributes':_0xba7218['options']?_0xba7218[_0x6d29('0x14')][_0x6d29('0x17')]||null:null,'include':_0xba7218[_0x6d29('0x14')]?_0xba7218[_0x6d29('0x14')][_0x6d29('0x18')]?_['map'](_0xba7218[_0x6d29('0x14')][_0x6d29('0x18')],function(_0x464032){return{'model':db[_0x464032[_0x6d29('0x1a')]],'as':_0x464032['as'],'attributes':_0x464032['attributes'],'include':_0x464032[_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x464032[_0x6d29('0x18')],function(_0x44ff2d){return{'model':db[_0x44ff2d['model']],'as':_0x44ff2d['as'],'attributes':_0x44ff2d[_0x6d29('0x17')],'include':_0x44ff2d[_0x6d29('0x18')]?_[_0x6d29('0x19')](_0x44ff2d[_0x6d29('0x18')],function(_0x169022){return{'model':db[_0x169022[_0x6d29('0x1a')]],'as':_0x169022['as'],'attributes':_0x169022[_0x6d29('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6d29('0xa')](function(_0x69febd){logger['info'](_0x6d29('0x1d'),_0xba7218);logger['debug'](_0x6d29('0x1d'),_0xba7218,JSON[_0x6d29('0x1c')](_0x69febd));_0x29dcd7(_0x69febd);})[_0x6d29('0x11')](function(_0xc12897){logger[_0x6d29('0xe')](_0x6d29('0x1d'),_0xc12897[_0x6d29('0xf')],_0xba7218);_0x3fdd1f(_0x589a2f[_0x6d29('0xe')](0x1f4,_0xc12897[_0x6d29('0xf')]));});});}; \ No newline at end of file +var _0xe04a=['client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','ZohoAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x11fbec,_0x376a1f){var _0x1c319b=function(_0x59d03f){while(--_0x59d03f){_0x11fbec['push'](_0x11fbec['shift']());}};_0x1c319b(++_0x376a1f);}(_0xe04a,0x10f));var _0xae04=function(_0x3c8538,_0x36aaa1){_0x3c8538=_0x3c8538-0x0;var _0x2aeeec=_0xe04a[_0x3c8538];return _0x2aeeec;};'use strict';var _=require(_0xae04('0x0'));var util=require('util');var moment=require(_0xae04('0x1'));var BPromise=require(_0xae04('0x2'));var rs=require(_0xae04('0x3'));var fs=require('fs');var Redis=require(_0xae04('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae04('0x5'));var logger=require(_0xae04('0x6'))(_0xae04('0x7'));var config=require('../../config/environment');var jayson=require(_0xae04('0x8'));var client=jayson[_0xae04('0x9')][_0xae04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c59b8,_0x3253df,_0x187916){return new BPromise(function(_0x16b310,_0x4444ba){return client[_0xae04('0xb')](_0x1c59b8,_0x187916)[_0xae04('0xc')](function(_0x51eb7b){logger[_0xae04('0xd')](_0xae04('0xe'),_0x3253df,_0xae04('0xf'));logger[_0xae04('0x10')](_0xae04('0x11'),_0x3253df,'request\x20sent',JSON[_0xae04('0x12')](_0x51eb7b));if(_0x51eb7b[_0xae04('0x13')]){if(_0x51eb7b['error'][_0xae04('0x14')]===0x1f4){logger[_0xae04('0x13')](_0xae04('0xe'),_0x3253df,_0x51eb7b[_0xae04('0x13')][_0xae04('0x15')]);return _0x4444ba(_0x51eb7b[_0xae04('0x13')][_0xae04('0x15')]);}logger[_0xae04('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x3253df,_0x51eb7b[_0xae04('0x13')][_0xae04('0x15')]);return _0x16b310(_0x51eb7b[_0xae04('0x13')]['message']);}else{logger[_0xae04('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x3253df,'request\x20sent');_0x16b310(_0x51eb7b[_0xae04('0x16')][_0xae04('0x15')]);}})[_0xae04('0x17')](function(_0x5cdebc){logger[_0xae04('0x13')](_0xae04('0xe'),_0x3253df,_0x5cdebc);_0x4444ba(_0x5cdebc);});});}exports['GetZohoAccount']=function(_0x7c401c){var _0x1cbd6e=this;return new Promise(function(_0x3b861f,_0x271a68){return db['ZohoAccount'][_0xae04('0x18')]({'raw':_0x7c401c[_0xae04('0x19')]?_0x7c401c[_0xae04('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x7c401c[_0xae04('0x19')]?_0x7c401c['options'][_0xae04('0x1a')]||null:null,'attributes':_0x7c401c[_0xae04('0x19')]?_0x7c401c[_0xae04('0x19')][_0xae04('0x1b')]||null:null,'limit':_0x7c401c[_0xae04('0x19')]?_0x7c401c[_0xae04('0x19')][_0xae04('0x1c')]||null:null,'include':_0x7c401c[_0xae04('0x19')]?_0x7c401c[_0xae04('0x19')][_0xae04('0x1d')]?_[_0xae04('0x1e')](_0x7c401c[_0xae04('0x19')]['include'],function(_0x3da1fb){return{'model':db[_0x3da1fb['model']],'as':_0x3da1fb['as'],'attributes':_0x3da1fb[_0xae04('0x1b')],'include':_0x3da1fb[_0xae04('0x1d')]?_[_0xae04('0x1e')](_0x3da1fb[_0xae04('0x1d')],function(_0x3f6451){return{'model':db[_0x3f6451[_0xae04('0x1f')]],'as':_0x3f6451['as'],'attributes':_0x3f6451[_0xae04('0x1b')],'include':_0x3f6451[_0xae04('0x1d')]?_[_0xae04('0x1e')](_0x3f6451['include'],function(_0x744c95){return{'model':db[_0x744c95['model']],'as':_0x744c95['as'],'attributes':_0x744c95[_0xae04('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae04('0xc')](function(_0x228ff7){logger[_0xae04('0xd')](_0xae04('0x20'),_0x7c401c);logger[_0xae04('0x10')](_0xae04('0x20'),_0x7c401c,JSON[_0xae04('0x12')](_0x228ff7));_0x3b861f(_0x228ff7);})[_0xae04('0x17')](function(_0x16c0e7){logger[_0xae04('0x13')](_0xae04('0x20'),_0x16c0e7[_0xae04('0x15')],_0x7c401c);_0x271a68(_0x1cbd6e['error'](0x1f4,_0x16c0e7[_0xae04('0x15')]));});});};exports[_0xae04('0x21')]=function(_0x55fd15){var _0xf71d2=this;return new Promise(function(_0x1819ad,_0x3340ab){return db[_0xae04('0x22')]['find']({'raw':_0x55fd15[_0xae04('0x19')]?_0x55fd15[_0xae04('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x55fd15[_0xae04('0x19')]?_0x55fd15[_0xae04('0x19')]['where']||null:null,'attributes':_0x55fd15[_0xae04('0x19')]?_0x55fd15[_0xae04('0x19')][_0xae04('0x1b')]||null:null,'include':_0x55fd15[_0xae04('0x19')]?_0x55fd15[_0xae04('0x19')][_0xae04('0x1d')]?_[_0xae04('0x1e')](_0x55fd15['options'][_0xae04('0x1d')],function(_0x514d77){return{'model':db[_0x514d77['model']],'as':_0x514d77['as'],'attributes':_0x514d77[_0xae04('0x1b')],'include':_0x514d77[_0xae04('0x1d')]?_[_0xae04('0x1e')](_0x514d77['include'],function(_0x26fd2f){return{'model':db[_0x26fd2f[_0xae04('0x1f')]],'as':_0x26fd2f['as'],'attributes':_0x26fd2f[_0xae04('0x1b')],'include':_0x26fd2f[_0xae04('0x1d')]?_[_0xae04('0x1e')](_0x26fd2f['include'],function(_0x1761e7){return{'model':db[_0x1761e7[_0xae04('0x1f')]],'as':_0x1761e7['as'],'attributes':_0x1761e7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x324b4a){logger[_0xae04('0xd')](_0xae04('0x21'),_0x55fd15);logger[_0xae04('0x10')](_0xae04('0x21'),_0x55fd15,JSON[_0xae04('0x12')](_0x324b4a));_0x1819ad(_0x324b4a);})[_0xae04('0x17')](function(_0x14e87){logger[_0xae04('0x13')](_0xae04('0x21'),_0x14e87[_0xae04('0x15')],_0x55fd15);_0x3340ab(_0xf71d2['error'](0x1f4,_0x14e87[_0xae04('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 5b21262..cea7578 100644 --- a/server/api/intZohoConfiguration/index.js +++ b/server/api/intZohoConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76f6=['get','index','/:id','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x29c4ac,_0x14fd35){var _0x479366=function(_0x64747a){while(--_0x64747a){_0x29c4ac['push'](_0x29c4ac['shift']());}};_0x479366(++_0x14fd35);}(_0x76f6,0x10a));var _0x676f=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x76f6[_0x2e4e19];return _0x9ba20b;};'use strict';var multer=require(_0x676f('0x0'));var util=require(_0x676f('0x1'));var path=require(_0x676f('0x2'));var timeout=require('connect-timeout');var express=require(_0x676f('0x3'));var router=express[_0x676f('0x4')]();var fs_extra=require(_0x676f('0x5'));var auth=require(_0x676f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x676f('0x7'));var controller=require(_0x676f('0x8'));router[_0x676f('0x9')]('/',auth['isAuthenticated'](),controller[_0x676f('0xa')]);router['get'](_0x676f('0xb'),auth['isAuthenticated'](),controller[_0x676f('0xc')]);router['get'](_0x676f('0xd'),auth['isAuthenticated'](),controller[_0x676f('0xe')]);router[_0x676f('0x9')](_0x676f('0xf'),auth[_0x676f('0x10')](),controller[_0x676f('0x11')]);router[_0x676f('0x9')](_0x676f('0x12'),auth[_0x676f('0x10')](),controller[_0x676f('0x13')]);router['post']('/',auth[_0x676f('0x10')](),controller[_0x676f('0x14')]);router[_0x676f('0x15')](_0x676f('0xb'),auth[_0x676f('0x10')](),controller[_0x676f('0x16')]);router['delete'](_0x676f('0xb'),auth[_0x676f('0x10')](),controller[_0x676f('0x17')]);module[_0x676f('0x18')]=router; \ No newline at end of file +var _0x7852=['index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated'];(function(_0x40e018,_0x4b3eb1){var _0x729851=function(_0x1e9b42){while(--_0x1e9b42){_0x40e018['push'](_0x40e018['shift']());}};_0x729851(++_0x4b3eb1);}(_0x7852,0xcd));var _0x2785=function(_0x21eb8b,_0x174af5){_0x21eb8b=_0x21eb8b-0x0;var _0x2f8583=_0x7852[_0x21eb8b];return _0x2f8583;};'use strict';var multer=require(_0x2785('0x0'));var util=require('util');var path=require(_0x2785('0x1'));var timeout=require(_0x2785('0x2'));var express=require(_0x2785('0x3'));var router=express[_0x2785('0x4')]();var fs_extra=require(_0x2785('0x5'));var auth=require(_0x2785('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2785('0x7'));var controller=require(_0x2785('0x8'));router[_0x2785('0x9')]('/',auth[_0x2785('0xa')](),controller[_0x2785('0xb')]);router['get'](_0x2785('0xc'),auth[_0x2785('0xa')](),controller['show']);router[_0x2785('0x9')](_0x2785('0xd'),auth['isAuthenticated'](),controller[_0x2785('0xe')]);router[_0x2785('0x9')](_0x2785('0xf'),auth[_0x2785('0xa')](),controller['getSubjects']);router[_0x2785('0x9')](_0x2785('0x10'),auth['isAuthenticated'](),controller[_0x2785('0x11')]);router[_0x2785('0x12')]('/',auth['isAuthenticated'](),controller[_0x2785('0x13')]);router[_0x2785('0x14')]('/:id',auth[_0x2785('0xa')](),controller['update']);router[_0x2785('0x15')]('/:id',auth[_0x2785('0xa')](),controller[_0x2785('0x16')]);module[_0x2785('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8b4701e..359fc3c 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7668=['contact','nothing','ENUM','contact_lead','sequelize','exports','STRING','lead'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7668,0x19c));var _0x8766=function(_0x499e36,_0xc35951){_0x499e36=_0x499e36-0x0;var _0x95bf7b=_0x7668[_0x499e36];return _0x95bf7b;};'use strict';var Sequelize=require(_0x8766('0x0'));module[_0x8766('0x1')]={'name':{'type':Sequelize[_0x8766('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x8766('0x3'),_0x8766('0x4'),_0x8766('0x5')),'defaultValue':_0x8766('0x3')},'moduleSearch':{'type':Sequelize[_0x8766('0x6')](_0x8766('0x7'),'contact',_0x8766('0x3')),'defaultValue':_0x8766('0x7')},'description':{'type':Sequelize[_0x8766('0x2')]}}; \ No newline at end of file +var _0xecc9=['nothing','contact_lead','contact','STRING','sequelize','ENUM','lead'];(function(_0x1f319e,_0x515971){var _0x416791=function(_0x152c1c){while(--_0x152c1c){_0x1f319e['push'](_0x1f319e['shift']());}};_0x416791(++_0x515971);}(_0xecc9,0x115));var _0x9ecc=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0xecc9[_0x1030ce];return _0x3367fd;};'use strict';var Sequelize=require(_0x9ecc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x9ecc('0x1')](_0x9ecc('0x2'),'contact',_0x9ecc('0x3')),'defaultValue':_0x9ecc('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x9ecc('0x4'),_0x9ecc('0x5'),_0x9ecc('0x2')),'defaultValue':_0x9ecc('0x4')},'description':{'type':Sequelize[_0x9ecc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bca6da8..0d96a1c 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x537f=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','stack','name','send','render','body','contact','agent','interaction','account','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','ZohoConfiguration','include','rows','show','params','includeAll','find','destroy','getFields','findOne','ZohoField','pick','filter','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','crypto','desk.js'];(function(_0xef225b,_0x3f5a0d){var _0x251195=function(_0x96456d){while(--_0x96456d){_0xef225b['push'](_0xef225b['shift']());}};_0x251195(++_0x3f5a0d);}(_0x537f,0x1c5));var _0xf537=function(_0x660c48,_0x150b0a){_0x660c48=_0x660c48-0x0;var _0xdc5e90=_0x537f[_0x660c48];return _0xdc5e90;};'use strict';var emlformat=require(_0xf537('0x0'));var rimraf=require(_0xf537('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf537('0x2'));var rp=require(_0xf537('0x3'));var moment=require(_0xf537('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf537('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf537('0x6'));var csv=require(_0xf537('0x7'));var ejs=require(_0xf537('0x8'));var fs=require('fs');var fs_extra=require(_0xf537('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf537('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf537('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf537('0xc'));var Papa=require('papaparse');var Redis=require(_0xf537('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf537('0xe'));var as=require(_0xf537('0xf'));var hardwareService=require(_0xf537('0x10'));var logger=require(_0xf537('0x11'))('api');var utils=require(_0xf537('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf537('0x13'))['db'];var jayson=require(_0xf537('0x14'));var client=jayson[_0xf537('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb8bcc4,_0x466308,_0x21da0e,_0x18c63d){return new BPromise(function(_0x49be48,_0x242f2b){var _0x297811=_0x18c63d||client;return _0x297811[_0xf537('0x16')](_0xb8bcc4,_0x21da0e)[_0xf537('0x17')](function(_0x2db86a){logger[_0xf537('0x18')](_0xf537('0x19'),_0x466308,_0xf537('0x1a'));logger[_0xf537('0x1b')](_0xf537('0x1c'),_0x466308,_0xf537('0x1a'),JSON[_0xf537('0x1d')](_0x2db86a));if(_0x2db86a['error']){if(_0x2db86a[_0xf537('0x1e')][_0xf537('0x1f')]===0x1f4){logger[_0xf537('0x1e')](_0xf537('0x19'),_0x466308,_0x2db86a[_0xf537('0x1e')][_0xf537('0x20')]);return _0x242f2b(_0x2db86a[_0xf537('0x1e')][_0xf537('0x20')]);}logger[_0xf537('0x1e')](_0xf537('0x19'),_0x466308,_0x2db86a[_0xf537('0x1e')][_0xf537('0x20')]);return _0x49be48(_0x2db86a['error'][_0xf537('0x20')]);}else{logger[_0xf537('0x18')](_0xf537('0x19'),_0x466308,_0xf537('0x1a'));_0x49be48(_0x2db86a['result'][_0xf537('0x20')]);}})[_0xf537('0x21')](function(_0x1bd9f6){logger[_0xf537('0x1e')](_0xf537('0x19'),_0x466308,_0x1bd9f6);_0x242f2b(_0x1bd9f6);});});}function respondWithStatusCode(_0x458588,_0x4801cd){_0x4801cd=_0x4801cd||0xcc;return function(_0x453287){if(_0x453287){return _0x458588[_0xf537('0x22')](_0x4801cd);}return _0x458588['status'](_0x4801cd)[_0xf537('0x23')]();};}function respondWithResult(_0x30f7c9,_0x7b7a0){_0x7b7a0=_0x7b7a0||0xc8;return function(_0x557116){if(_0x557116){return _0x30f7c9[_0xf537('0x24')](_0x7b7a0)[_0xf537('0x25')](_0x557116);}};}function respondWithFilteredResult(_0x429b3b,_0x6697e2){return function(_0x5bedde){if(_0x5bedde){var _0x10638d=typeof _0x6697e2['offset']==='undefined'&&typeof _0x6697e2[_0xf537('0x26')]==='undefined';var _0x332d29=_0x5bedde['count'];var _0x24740b=_0x10638d?0x0:_0x6697e2[_0xf537('0x27')];var _0x349a3a=_0x10638d?_0x5bedde[_0xf537('0x28')]:_0x6697e2[_0xf537('0x27')]+_0x6697e2['limit'];var _0x2ce240;if(_0x349a3a>=_0x332d29){_0x349a3a=_0x332d29;_0x2ce240=0xc8;}else{_0x2ce240=0xce;}_0x429b3b[_0xf537('0x24')](_0x2ce240);return _0x429b3b[_0xf537('0x29')](_0xf537('0x2a'),_0x24740b+'-'+_0x349a3a+'/'+_0x332d29)[_0xf537('0x25')](_0x5bedde);}return null;};}function patchUpdates(_0x2d6a57){return function(_0x2ccadd){try{jsonpatch[_0xf537('0x2b')](_0x2ccadd,_0x2d6a57,!![]);}catch(_0x4f8203){return BPromise[_0xf537('0x2c')](_0x4f8203);}return _0x2ccadd[_0xf537('0x2d')]();};}function saveUpdates(_0x3a30fe,_0x1b12db){return function(_0x1555d4){if(_0x1555d4){return _0x1555d4[_0xf537('0x2e')](_0x3a30fe)[_0xf537('0x17')](function(_0x444cbe){return _0x444cbe;});}return null;};}function removeEntity(_0x51981c,_0xeea127){return function(_0xcb28e1){if(_0xcb28e1){return _0xcb28e1['destroy']()[_0xf537('0x17')](function(){_0x51981c[_0xf537('0x24')](0xcc)[_0xf537('0x23')]();});}};}function handleEntityNotFound(_0x5281d8,_0x8595d){return function(_0x93e308){if(!_0x93e308){_0x5281d8[_0xf537('0x22')](0x194);}return _0x93e308;};}function handleError(_0x1d949e,_0x3d025d){_0x3d025d=_0x3d025d||0x1f4;return function(_0x3024c9){logger['error'](_0x3024c9[_0xf537('0x2f')]);if(_0x3024c9[_0xf537('0x30')]){delete _0x3024c9['name'];}_0x1d949e['status'](_0x3d025d)[_0xf537('0x31')](_0x3024c9);};}function getMustacheRender(_0x259dfc,_0x5e8e88){return Mustache[_0xf537('0x32')](_0x259dfc,_['merge'](_0x5e8e88[_0xf537('0x33')],{'contact':_0x5e8e88[_0xf537('0x34')],'message':_0x5e8e88[_0xf537('0x20')],'agent':_0x5e8e88[_0xf537('0x35')],'interaction':_0x5e8e88[_0xf537('0x36')],'account':_0x5e8e88[_0xf537('0x37')]}))||'';}exports[_0xf537('0x38')]=function(_0x40b8fe,_0x3f0193){var _0x5a5fd5={},_0x297250={},_0x433853={'count':0x0,'rows':[]};var _0x5c95e1=_['map'](db['ZohoConfiguration'][_0xf537('0x39')],function(_0x10adb0){return{'name':_0x10adb0[_0xf537('0x3a')],'type':_0x10adb0[_0xf537('0x3b')][_0xf537('0x3c')]};});_0x297250[_0xf537('0x3d')]=_[_0xf537('0x3e')](_0x5c95e1,_0xf537('0x30'));_0x297250[_0xf537('0x3f')]=_[_0xf537('0x40')](_0x40b8fe[_0xf537('0x3f')]);_0x297250[_0xf537('0x41')]=_[_0xf537('0x42')](_0x297250[_0xf537('0x3d')],_0x297250[_0xf537('0x3f')]);_0x5a5fd5['attributes']=_[_0xf537('0x42')](_0x297250[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x40b8fe['query'][_0xf537('0x43')]));_0x5a5fd5['attributes']=_0x5a5fd5[_0xf537('0x44')][_0xf537('0x45')]?_0x5a5fd5[_0xf537('0x44')]:_0x297250[_0xf537('0x3d')];if(!_0x40b8fe[_0xf537('0x3f')][_0xf537('0x46')]('nolimit')){_0x5a5fd5[_0xf537('0x26')]=qs[_0xf537('0x26')](_0x40b8fe[_0xf537('0x3f')][_0xf537('0x26')]);_0x5a5fd5['offset']=qs[_0xf537('0x27')](_0x40b8fe[_0xf537('0x3f')][_0xf537('0x27')]);}_0x5a5fd5[_0xf537('0x47')]=qs[_0xf537('0x48')](_0x40b8fe['query'][_0xf537('0x48')]);_0x5a5fd5[_0xf537('0x49')]=qs[_0xf537('0x41')](_['pick'](_0x40b8fe['query'],_0x297250[_0xf537('0x41')]),_0x5c95e1);if(_0x40b8fe['query']['filter']){_0x5a5fd5[_0xf537('0x49')]=_[_0xf537('0x4a')](_0x5a5fd5[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0x5c95e1,function(_0x541d4b){if(_0x541d4b['type']!==_0xf537('0x4b')){var _0x2847d5={};_0x2847d5[_0x541d4b[_0xf537('0x30')]]={'$like':'%'+_0x40b8fe[_0xf537('0x3f')]['filter']+'%'};return _0x2847d5;}})});}_0x5a5fd5=_[_0xf537('0x4a')]({},_0x5a5fd5,_0x40b8fe[_0xf537('0x4c')]);var _0x71197b={'where':_0x5a5fd5['where']};return db[_0xf537('0x4d')]['count'](_0x71197b)[_0xf537('0x17')](function(_0x546b87){_0x433853[_0xf537('0x28')]=_0x546b87;if(_0x40b8fe[_0xf537('0x3f')]['includeAll']){_0x5a5fd5[_0xf537('0x4e')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x5a5fd5);})[_0xf537('0x17')](function(_0x715852){_0x433853[_0xf537('0x4f')]=_0x715852;return _0x433853;})[_0xf537('0x17')](respondWithFilteredResult(_0x3f0193,_0x5a5fd5))['catch'](handleError(_0x3f0193,null));};exports[_0xf537('0x50')]=function(_0x47d7e0,_0x441f89){var _0x3e959a={'raw':![],'where':{'id':_0x47d7e0[_0xf537('0x51')]['id']}},_0x73372a={};_0x73372a[_0xf537('0x3d')]=_[_0xf537('0x40')](db[_0xf537('0x4d')]['rawAttributes']);_0x73372a[_0xf537('0x3f')]=_[_0xf537('0x40')](_0x47d7e0[_0xf537('0x3f')]);_0x73372a[_0xf537('0x41')]=_['intersection'](_0x73372a[_0xf537('0x3d')],_0x73372a[_0xf537('0x3f')]);_0x3e959a[_0xf537('0x44')]=_['intersection'](_0x73372a[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x47d7e0[_0xf537('0x3f')][_0xf537('0x43')]));_0x3e959a[_0xf537('0x44')]=_0x3e959a[_0xf537('0x44')][_0xf537('0x45')]?_0x3e959a[_0xf537('0x44')]:_0x73372a['model'];if(_0x47d7e0[_0xf537('0x3f')][_0xf537('0x52')]){_0x3e959a[_0xf537('0x4e')]=[{'all':!![]}];}_0x3e959a=_[_0xf537('0x4a')]({},_0x3e959a,_0x47d7e0[_0xf537('0x4c')]);return db[_0xf537('0x4d')]['find'](_0x3e959a)['then'](handleEntityNotFound(_0x441f89,null))[_0xf537('0x17')](respondWithResult(_0x441f89,null))[_0xf537('0x21')](handleError(_0x441f89,null));};exports['create']=function(_0x13cd4a,_0x237a58){return db['ZohoConfiguration']['create'](_0x13cd4a[_0xf537('0x33')],{})[_0xf537('0x17')](respondWithResult(_0x237a58,0xc9))['catch'](handleError(_0x237a58,null));};exports['update']=function(_0x554943,_0x45ff9c){if(_0x554943[_0xf537('0x33')]['id']){delete _0x554943[_0xf537('0x33')]['id'];}return db[_0xf537('0x4d')][_0xf537('0x53')]({'where':{'id':_0x554943[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x45ff9c,null))[_0xf537('0x17')](saveUpdates(_0x554943[_0xf537('0x33')],null))[_0xf537('0x17')](respondWithResult(_0x45ff9c,null))[_0xf537('0x21')](handleError(_0x45ff9c,null));};exports[_0xf537('0x54')]=function(_0x5b4952,_0x309fcb){return db[_0xf537('0x4d')][_0xf537('0x53')]({'where':{'id':_0x5b4952[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x309fcb,null))['then'](removeEntity(_0x309fcb,null))[_0xf537('0x21')](handleError(_0x309fcb,null));};exports[_0xf537('0x55')]=function(_0x2c0f01,_0x6b7cf2,_0x3061bb){var _0xa35dd1={};var _0x5dc6c9={};var _0x268e11;var _0x3f88ce;return db[_0xf537('0x4d')][_0xf537('0x56')]({'where':{'id':_0x2c0f01[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x6b7cf2,null))[_0xf537('0x17')](function(_0x4c34c7){if(_0x4c34c7){_0x268e11=_0x4c34c7;_0x5dc6c9[_0xf537('0x3d')]=_['keys'](db[_0xf537('0x57')][_0xf537('0x39')]);_0x5dc6c9['query']=_[_0xf537('0x40')](_0x2c0f01[_0xf537('0x3f')]);_0x5dc6c9['filters']=_[_0xf537('0x42')](_0x5dc6c9[_0xf537('0x3d')],_0x5dc6c9[_0xf537('0x3f')]);_0xa35dd1[_0xf537('0x44')]=_[_0xf537('0x42')](_0x5dc6c9[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x2c0f01[_0xf537('0x3f')][_0xf537('0x43')]));_0xa35dd1[_0xf537('0x44')]=_0xa35dd1[_0xf537('0x44')][_0xf537('0x45')]?_0xa35dd1[_0xf537('0x44')]:_0x5dc6c9['model'];_0xa35dd1[_0xf537('0x47')]=qs['sort'](_0x2c0f01[_0xf537('0x3f')][_0xf537('0x48')]);_0xa35dd1[_0xf537('0x49')]=qs[_0xf537('0x41')](_[_0xf537('0x58')](_0x2c0f01[_0xf537('0x3f')],_0x5dc6c9[_0xf537('0x41')]));if(_0x2c0f01['query'][_0xf537('0x59')]){_0xa35dd1['where']=_[_0xf537('0x4a')](_0xa35dd1[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0xa35dd1['attributes'],function(_0x427ee6){var _0x2dd8bc={};_0x2dd8bc[_0x427ee6]={'$like':'%'+_0x2c0f01[_0xf537('0x3f')][_0xf537('0x59')]+'%'};return _0x2dd8bc;})});}_0xa35dd1=_[_0xf537('0x4a')]({},_0xa35dd1,_0x2c0f01['options']);return _0x268e11[_0xf537('0x55')](_0xa35dd1);}})[_0xf537('0x17')](function(_0x538715){if(_0x538715){_0x3f88ce=_0x538715[_0xf537('0x45')];if(!_0x2c0f01[_0xf537('0x3f')][_0xf537('0x46')](_0xf537('0x5a'))){_0xa35dd1['limit']=qs['limit'](_0x2c0f01['query'][_0xf537('0x26')]);_0xa35dd1[_0xf537('0x27')]=qs[_0xf537('0x27')](_0x2c0f01['query'][_0xf537('0x27')]);}return _0x268e11[_0xf537('0x55')](_0xa35dd1);}})[_0xf537('0x17')](function(_0x33126e){if(_0x33126e){return _0x33126e?{'count':_0x3f88ce,'rows':_0x33126e}:null;}})[_0xf537('0x17')](respondWithResult(_0x6b7cf2,null))[_0xf537('0x21')](handleError(_0x6b7cf2,null));};exports[_0xf537('0x5b')]=function(_0x1739ea,_0x324106,_0x2d2e24){var _0x28bd30={};var _0x335112={};var _0x2d0b85;var _0x156cb5;return db['ZohoConfiguration'][_0xf537('0x56')]({'where':{'id':_0x1739ea[_0xf537('0x51')]['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x324106,null))[_0xf537('0x17')](function(_0x407657){if(_0x407657){_0x2d0b85=_0x407657;_0x335112[_0xf537('0x3d')]=_[_0xf537('0x40')](db[_0xf537('0x57')]['rawAttributes']);_0x335112[_0xf537('0x3f')]=_['keys'](_0x1739ea[_0xf537('0x3f')]);_0x335112[_0xf537('0x41')]=_['intersection'](_0x335112[_0xf537('0x3d')],_0x335112[_0xf537('0x3f')]);_0x28bd30[_0xf537('0x44')]=_['intersection'](_0x335112[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x1739ea['query'][_0xf537('0x43')]));_0x28bd30['attributes']=_0x28bd30[_0xf537('0x44')]['length']?_0x28bd30[_0xf537('0x44')]:_0x335112[_0xf537('0x3d')];_0x28bd30[_0xf537('0x47')]=qs[_0xf537('0x48')](_0x1739ea['query'][_0xf537('0x48')]);_0x28bd30[_0xf537('0x49')]=qs[_0xf537('0x41')](_['pick'](_0x1739ea['query'],_0x335112['filters']));if(_0x1739ea[_0xf537('0x3f')][_0xf537('0x59')]){_0x28bd30[_0xf537('0x49')]=_['merge'](_0x28bd30[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0x28bd30['attributes'],function(_0x234e6f){var _0x508d0d={};_0x508d0d[_0x234e6f]={'$like':'%'+_0x1739ea[_0xf537('0x3f')][_0xf537('0x59')]+'%'};return _0x508d0d;})});}_0x28bd30=_[_0xf537('0x4a')]({},_0x28bd30,_0x1739ea['options']);return _0x2d0b85[_0xf537('0x5b')](_0x28bd30);}})[_0xf537('0x17')](function(_0x39d208){if(_0x39d208){_0x156cb5=_0x39d208[_0xf537('0x45')];if(!_0x1739ea['query']['hasOwnProperty'](_0xf537('0x5a'))){_0x28bd30[_0xf537('0x26')]=qs[_0xf537('0x26')](_0x1739ea['query']['limit']);_0x28bd30[_0xf537('0x27')]=qs[_0xf537('0x27')](_0x1739ea[_0xf537('0x3f')][_0xf537('0x27')]);}return _0x2d0b85[_0xf537('0x5b')](_0x28bd30);}})['then'](function(_0x14360f){if(_0x14360f){return _0x14360f?{'count':_0x156cb5,'rows':_0x14360f}:null;}})[_0xf537('0x17')](respondWithResult(_0x324106,null))[_0xf537('0x21')](handleError(_0x324106,null));};exports['getDescriptions']=function(_0x3cb048,_0x933d9c,_0x29f54e){var _0x43982b={};var _0x35cc7b={};var _0x6cdbbc;var _0x48045a;return db[_0xf537('0x4d')][_0xf537('0x56')]({'where':{'id':_0x3cb048['params']['id']}})[_0xf537('0x17')](handleEntityNotFound(_0x933d9c,null))['then'](function(_0x3f2a73){if(_0x3f2a73){_0x6cdbbc=_0x3f2a73;_0x35cc7b[_0xf537('0x3d')]=_[_0xf537('0x40')](db['ZohoField'][_0xf537('0x39')]);_0x35cc7b[_0xf537('0x3f')]=_[_0xf537('0x40')](_0x3cb048['query']);_0x35cc7b[_0xf537('0x41')]=_[_0xf537('0x42')](_0x35cc7b[_0xf537('0x3d')],_0x35cc7b[_0xf537('0x3f')]);_0x43982b[_0xf537('0x44')]=_[_0xf537('0x42')](_0x35cc7b[_0xf537('0x3d')],qs[_0xf537('0x43')](_0x3cb048[_0xf537('0x3f')][_0xf537('0x43')]));_0x43982b['attributes']=_0x43982b[_0xf537('0x44')][_0xf537('0x45')]?_0x43982b[_0xf537('0x44')]:_0x35cc7b[_0xf537('0x3d')];_0x43982b[_0xf537('0x47')]=qs[_0xf537('0x48')](_0x3cb048[_0xf537('0x3f')]['sort']);_0x43982b[_0xf537('0x49')]=qs['filters'](_['pick'](_0x3cb048[_0xf537('0x3f')],_0x35cc7b['filters']));if(_0x3cb048['query'][_0xf537('0x59')]){_0x43982b[_0xf537('0x49')]=_[_0xf537('0x4a')](_0x43982b[_0xf537('0x49')],{'$or':_[_0xf537('0x3e')](_0x43982b[_0xf537('0x44')],function(_0xa1fab3){var _0xd764ce={};_0xd764ce[_0xa1fab3]={'$like':'%'+_0x3cb048[_0xf537('0x3f')][_0xf537('0x59')]+'%'};return _0xd764ce;})});}_0x43982b=_['merge']({},_0x43982b,_0x3cb048[_0xf537('0x4c')]);return _0x6cdbbc[_0xf537('0x5c')](_0x43982b);}})[_0xf537('0x17')](function(_0x40ea2f){if(_0x40ea2f){_0x48045a=_0x40ea2f[_0xf537('0x45')];if(!_0x3cb048['query']['hasOwnProperty'](_0xf537('0x5a'))){_0x43982b['limit']=qs[_0xf537('0x26')](_0x3cb048[_0xf537('0x3f')][_0xf537('0x26')]);_0x43982b[_0xf537('0x27')]=qs[_0xf537('0x27')](_0x3cb048[_0xf537('0x3f')]['offset']);}return _0x6cdbbc[_0xf537('0x5c')](_0x43982b);}})[_0xf537('0x17')](function(_0x4fd108){if(_0x4fd108){return _0x4fd108?{'count':_0x48045a,'rows':_0x4fd108}:null;}})[_0xf537('0x17')](respondWithResult(_0x933d9c,null))[_0xf537('0x21')](handleError(_0x933d9c,null));}; \ No newline at end of file +var _0x8b59=['keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','render','merge','agent','account','index','ZohoConfiguration','rawAttributes','type','key','map'];(function(_0x571c22,_0x22ff9b){var _0x59286d=function(_0x543b86){while(--_0x543b86){_0x571c22['push'](_0x571c22['shift']());}};_0x59286d(++_0x22ff9b);}(_0x8b59,0x7f));var _0x98b5=function(_0x74ddc1,_0x500c84){_0x74ddc1=_0x74ddc1-0x0;var _0x51bc45=_0x8b59[_0x74ddc1];return _0x51bc45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98b5('0x0'));var zipdir=require(_0x98b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98b5('0x2'));var moment=require(_0x98b5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x98b5('0x4'));var util=require(_0x98b5('0x5'));var path=require('path');var sox=require(_0x98b5('0x6'));var csv=require(_0x98b5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98b5('0x8'));var _=require(_0x98b5('0x9'));var squel=require(_0x98b5('0xa'));var crypto=require(_0x98b5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x98b5('0xc'));var toCsv=require(_0x98b5('0x7'));var querystring=require(_0x98b5('0xd'));var Papa=require(_0x98b5('0xe'));var Redis=require(_0x98b5('0xf'));var authService=require(_0x98b5('0x10'));var qs=require(_0x98b5('0x11'));var as=require(_0x98b5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98b5('0x13'))(_0x98b5('0x14'));var utils=require(_0x98b5('0x15'));var config=require(_0x98b5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98b5('0x17'))['db'];var jayson=require(_0x98b5('0x18'));var client=jayson['client'][_0x98b5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x378b19,_0x492669,_0x3a67c6,_0x14928a){return new BPromise(function(_0x2a55a8,_0x366c23){var _0x2d1abb=_0x14928a||client;return _0x2d1abb[_0x98b5('0x1a')](_0x378b19,_0x3a67c6)['then'](function(_0x419571){logger['info'](_0x98b5('0x1b'),_0x492669,_0x98b5('0x1c'));logger[_0x98b5('0x1d')](_0x98b5('0x1e'),_0x492669,_0x98b5('0x1c'),JSON[_0x98b5('0x1f')](_0x419571));if(_0x419571['error']){if(_0x419571[_0x98b5('0x20')][_0x98b5('0x21')]===0x1f4){logger[_0x98b5('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x492669,_0x419571['error'][_0x98b5('0x22')]);return _0x366c23(_0x419571['error']['message']);}logger[_0x98b5('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x492669,_0x419571[_0x98b5('0x20')][_0x98b5('0x22')]);return _0x2a55a8(_0x419571['error'][_0x98b5('0x22')]);}else{logger['info'](_0x98b5('0x1b'),_0x492669,_0x98b5('0x1c'));_0x2a55a8(_0x419571[_0x98b5('0x23')][_0x98b5('0x22')]);}})[_0x98b5('0x24')](function(_0x5603ac){logger[_0x98b5('0x20')](_0x98b5('0x1b'),_0x492669,_0x5603ac);_0x366c23(_0x5603ac);});});}function respondWithStatusCode(_0x1fe7e6,_0x5504af){_0x5504af=_0x5504af||0xcc;return function(_0x16c2b8){if(_0x16c2b8){return _0x1fe7e6[_0x98b5('0x25')](_0x5504af);}return _0x1fe7e6[_0x98b5('0x26')](_0x5504af)[_0x98b5('0x27')]();};}function respondWithResult(_0x35d8ce,_0x59df60){_0x59df60=_0x59df60||0xc8;return function(_0x3ebbc1){if(_0x3ebbc1){return _0x35d8ce['status'](_0x59df60)[_0x98b5('0x28')](_0x3ebbc1);}};}function respondWithFilteredResult(_0x2ef4c6,_0x6c005){return function(_0x55c571){if(_0x55c571){var _0x35e631=typeof _0x6c005[_0x98b5('0x29')]===_0x98b5('0x2a')&&typeof _0x6c005[_0x98b5('0x2b')]===_0x98b5('0x2a');var _0x56c649=_0x55c571[_0x98b5('0x2c')];var _0x496dfd=_0x35e631?0x0:_0x6c005[_0x98b5('0x29')];var _0x1f20ce=_0x35e631?_0x55c571[_0x98b5('0x2c')]:_0x6c005[_0x98b5('0x29')]+_0x6c005['limit'];var _0x51ce0b;if(_0x1f20ce>=_0x56c649){_0x1f20ce=_0x56c649;_0x51ce0b=0xc8;}else{_0x51ce0b=0xce;}_0x2ef4c6[_0x98b5('0x26')](_0x51ce0b);return _0x2ef4c6[_0x98b5('0x2d')](_0x98b5('0x2e'),_0x496dfd+'-'+_0x1f20ce+'/'+_0x56c649)['json'](_0x55c571);}return null;};}function patchUpdates(_0x26a1d2){return function(_0x2f9676){try{jsonpatch[_0x98b5('0x2f')](_0x2f9676,_0x26a1d2,!![]);}catch(_0x112b72){return BPromise[_0x98b5('0x30')](_0x112b72);}return _0x2f9676[_0x98b5('0x31')]();};}function saveUpdates(_0x2d3e84,_0x2d85d9){return function(_0xb3968a){if(_0xb3968a){return _0xb3968a['update'](_0x2d3e84)[_0x98b5('0x32')](function(_0x29863b){return _0x29863b;});}return null;};}function removeEntity(_0x17bfaf,_0x3ffa73){return function(_0x32da82){if(_0x32da82){return _0x32da82[_0x98b5('0x33')]()['then'](function(){_0x17bfaf[_0x98b5('0x26')](0xcc)[_0x98b5('0x27')]();});}};}function handleEntityNotFound(_0x11bea6,_0x99adda){return function(_0x4a29b8){if(!_0x4a29b8){_0x11bea6['sendStatus'](0x194);}return _0x4a29b8;};}function handleError(_0x4b4c6b,_0x39a3e8){_0x39a3e8=_0x39a3e8||0x1f4;return function(_0x385fe6){logger[_0x98b5('0x20')](_0x385fe6[_0x98b5('0x34')]);if(_0x385fe6[_0x98b5('0x35')]){delete _0x385fe6['name'];}_0x4b4c6b[_0x98b5('0x26')](_0x39a3e8)[_0x98b5('0x36')](_0x385fe6);};}function getMustacheRender(_0x22a963,_0x41292a){return Mustache[_0x98b5('0x37')](_0x22a963,_[_0x98b5('0x38')](_0x41292a['body'],{'contact':_0x41292a['contact'],'message':_0x41292a[_0x98b5('0x22')],'agent':_0x41292a[_0x98b5('0x39')],'interaction':_0x41292a['interaction'],'account':_0x41292a[_0x98b5('0x3a')]}))||'';}exports[_0x98b5('0x3b')]=function(_0x5165fc,_0x20bed0){var _0x5e699b={},_0x162c75={},_0x42ca09={'count':0x0,'rows':[]};var _0x491eb6=_['map'](db[_0x98b5('0x3c')][_0x98b5('0x3d')],function(_0xa73727){return{'name':_0xa73727['fieldName'],'type':_0xa73727[_0x98b5('0x3e')][_0x98b5('0x3f')]};});_0x162c75['model']=_[_0x98b5('0x40')](_0x491eb6,_0x98b5('0x35'));_0x162c75['query']=_[_0x98b5('0x41')](_0x5165fc[_0x98b5('0x42')]);_0x162c75[_0x98b5('0x43')]=_[_0x98b5('0x44')](_0x162c75['model'],_0x162c75[_0x98b5('0x42')]);_0x5e699b['attributes']=_[_0x98b5('0x44')](_0x162c75['model'],qs['fields'](_0x5165fc['query'][_0x98b5('0x45')]));_0x5e699b[_0x98b5('0x46')]=_0x5e699b[_0x98b5('0x46')][_0x98b5('0x47')]?_0x5e699b['attributes']:_0x162c75[_0x98b5('0x48')];if(!_0x5165fc[_0x98b5('0x42')][_0x98b5('0x49')]('nolimit')){_0x5e699b['limit']=qs[_0x98b5('0x2b')](_0x5165fc['query']['limit']);_0x5e699b[_0x98b5('0x29')]=qs['offset'](_0x5165fc['query'][_0x98b5('0x29')]);}_0x5e699b[_0x98b5('0x4a')]=qs[_0x98b5('0x4b')](_0x5165fc['query'][_0x98b5('0x4b')]);_0x5e699b[_0x98b5('0x4c')]=qs['filters'](_[_0x98b5('0x4d')](_0x5165fc[_0x98b5('0x42')],_0x162c75[_0x98b5('0x43')]),_0x491eb6);if(_0x5165fc[_0x98b5('0x42')][_0x98b5('0x4e')]){_0x5e699b[_0x98b5('0x4c')]=_['merge'](_0x5e699b[_0x98b5('0x4c')],{'$or':_[_0x98b5('0x40')](_0x491eb6,function(_0x289e2d){if(_0x289e2d['type']!==_0x98b5('0x4f')){var _0x4b4730={};_0x4b4730[_0x289e2d['name']]={'$like':'%'+_0x5165fc[_0x98b5('0x42')]['filter']+'%'};return _0x4b4730;}})});}_0x5e699b=_[_0x98b5('0x38')]({},_0x5e699b,_0x5165fc[_0x98b5('0x50')]);var _0x2dba93={'where':_0x5e699b[_0x98b5('0x4c')]};return db[_0x98b5('0x3c')][_0x98b5('0x2c')](_0x2dba93)[_0x98b5('0x32')](function(_0x412aad){_0x42ca09[_0x98b5('0x2c')]=_0x412aad;if(_0x5165fc['query'][_0x98b5('0x51')]){_0x5e699b[_0x98b5('0x52')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x98b5('0x53')](_0x5e699b);})[_0x98b5('0x32')](function(_0x1e5e87){_0x42ca09[_0x98b5('0x54')]=_0x1e5e87;return _0x42ca09;})[_0x98b5('0x32')](respondWithFilteredResult(_0x20bed0,_0x5e699b))['catch'](handleError(_0x20bed0,null));};exports[_0x98b5('0x55')]=function(_0x22cbec,_0x4757de){var _0x4b88d4={'raw':![],'where':{'id':_0x22cbec[_0x98b5('0x56')]['id']}},_0x4e3127={};_0x4e3127[_0x98b5('0x48')]=_[_0x98b5('0x41')](db['ZohoConfiguration'][_0x98b5('0x3d')]);_0x4e3127[_0x98b5('0x42')]=_['keys'](_0x22cbec[_0x98b5('0x42')]);_0x4e3127[_0x98b5('0x43')]=_[_0x98b5('0x44')](_0x4e3127[_0x98b5('0x48')],_0x4e3127['query']);_0x4b88d4[_0x98b5('0x46')]=_[_0x98b5('0x44')](_0x4e3127['model'],qs['fields'](_0x22cbec['query'][_0x98b5('0x45')]));_0x4b88d4[_0x98b5('0x46')]=_0x4b88d4[_0x98b5('0x46')][_0x98b5('0x47')]?_0x4b88d4[_0x98b5('0x46')]:_0x4e3127[_0x98b5('0x48')];if(_0x22cbec[_0x98b5('0x42')]['includeAll']){_0x4b88d4[_0x98b5('0x52')]=[{'all':!![]}];}_0x4b88d4=_[_0x98b5('0x38')]({},_0x4b88d4,_0x22cbec[_0x98b5('0x50')]);return db[_0x98b5('0x3c')][_0x98b5('0x57')](_0x4b88d4)[_0x98b5('0x32')](handleEntityNotFound(_0x4757de,null))[_0x98b5('0x32')](respondWithResult(_0x4757de,null))['catch'](handleError(_0x4757de,null));};exports[_0x98b5('0x58')]=function(_0xab7394,_0x5e09ba){return db[_0x98b5('0x3c')][_0x98b5('0x58')](_0xab7394['body'],{})[_0x98b5('0x32')](respondWithResult(_0x5e09ba,0xc9))['catch'](handleError(_0x5e09ba,null));};exports['update']=function(_0x49c2ed,_0x4b6094){if(_0x49c2ed[_0x98b5('0x59')]['id']){delete _0x49c2ed[_0x98b5('0x59')]['id'];}return db[_0x98b5('0x3c')][_0x98b5('0x57')]({'where':{'id':_0x49c2ed['params']['id']}})[_0x98b5('0x32')](handleEntityNotFound(_0x4b6094,null))[_0x98b5('0x32')](saveUpdates(_0x49c2ed['body'],null))[_0x98b5('0x32')](respondWithResult(_0x4b6094,null))[_0x98b5('0x24')](handleError(_0x4b6094,null));};exports[_0x98b5('0x33')]=function(_0x2f81f7,_0x4b807f){return db[_0x98b5('0x3c')]['find']({'where':{'id':_0x2f81f7[_0x98b5('0x56')]['id']}})[_0x98b5('0x32')](handleEntityNotFound(_0x4b807f,null))['then'](removeEntity(_0x4b807f,null))[_0x98b5('0x24')](handleError(_0x4b807f,null));};exports[_0x98b5('0x5a')]=function(_0x4d96ca,_0x4a2718,_0x36e7ad){var _0x168ae0={};var _0x56cc25={};var _0x293b66;var _0x228d93;return db[_0x98b5('0x3c')][_0x98b5('0x5b')]({'where':{'id':_0x4d96ca[_0x98b5('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a2718,null))[_0x98b5('0x32')](function(_0x1947b8){if(_0x1947b8){_0x293b66=_0x1947b8;_0x56cc25[_0x98b5('0x48')]=_[_0x98b5('0x41')](db[_0x98b5('0x5c')][_0x98b5('0x3d')]);_0x56cc25['query']=_[_0x98b5('0x41')](_0x4d96ca[_0x98b5('0x42')]);_0x56cc25[_0x98b5('0x43')]=_[_0x98b5('0x44')](_0x56cc25[_0x98b5('0x48')],_0x56cc25[_0x98b5('0x42')]);_0x168ae0[_0x98b5('0x46')]=_[_0x98b5('0x44')](_0x56cc25['model'],qs[_0x98b5('0x45')](_0x4d96ca[_0x98b5('0x42')][_0x98b5('0x45')]));_0x168ae0[_0x98b5('0x46')]=_0x168ae0[_0x98b5('0x46')][_0x98b5('0x47')]?_0x168ae0['attributes']:_0x56cc25['model'];_0x168ae0[_0x98b5('0x4a')]=qs[_0x98b5('0x4b')](_0x4d96ca[_0x98b5('0x42')][_0x98b5('0x4b')]);_0x168ae0[_0x98b5('0x4c')]=qs[_0x98b5('0x43')](_['pick'](_0x4d96ca[_0x98b5('0x42')],_0x56cc25['filters']));if(_0x4d96ca['query'][_0x98b5('0x4e')]){_0x168ae0[_0x98b5('0x4c')]=_[_0x98b5('0x38')](_0x168ae0['where'],{'$or':_[_0x98b5('0x40')](_0x168ae0[_0x98b5('0x46')],function(_0x56bcd4){var _0x44327b={};_0x44327b[_0x56bcd4]={'$like':'%'+_0x4d96ca[_0x98b5('0x42')][_0x98b5('0x4e')]+'%'};return _0x44327b;})});}_0x168ae0=_[_0x98b5('0x38')]({},_0x168ae0,_0x4d96ca[_0x98b5('0x50')]);return _0x293b66[_0x98b5('0x5a')](_0x168ae0);}})[_0x98b5('0x32')](function(_0x282bb7){if(_0x282bb7){_0x228d93=_0x282bb7[_0x98b5('0x47')];if(!_0x4d96ca[_0x98b5('0x42')][_0x98b5('0x49')](_0x98b5('0x5d'))){_0x168ae0[_0x98b5('0x2b')]=qs['limit'](_0x4d96ca['query'][_0x98b5('0x2b')]);_0x168ae0[_0x98b5('0x29')]=qs[_0x98b5('0x29')](_0x4d96ca[_0x98b5('0x42')][_0x98b5('0x29')]);}return _0x293b66[_0x98b5('0x5a')](_0x168ae0);}})['then'](function(_0x43956b){if(_0x43956b){return _0x43956b?{'count':_0x228d93,'rows':_0x43956b}:null;}})[_0x98b5('0x32')](respondWithResult(_0x4a2718,null))[_0x98b5('0x24')](handleError(_0x4a2718,null));};exports['getSubjects']=function(_0x4a79d4,_0xf8fad3,_0x2846f5){var _0x546d9e={};var _0x3d488d={};var _0x33682e;var _0x3733f3;return db[_0x98b5('0x3c')][_0x98b5('0x5b')]({'where':{'id':_0x4a79d4[_0x98b5('0x56')]['id']}})[_0x98b5('0x32')](handleEntityNotFound(_0xf8fad3,null))[_0x98b5('0x32')](function(_0x2041c6){if(_0x2041c6){_0x33682e=_0x2041c6;_0x3d488d[_0x98b5('0x48')]=_['keys'](db['ZohoField'][_0x98b5('0x3d')]);_0x3d488d['query']=_[_0x98b5('0x41')](_0x4a79d4[_0x98b5('0x42')]);_0x3d488d['filters']=_[_0x98b5('0x44')](_0x3d488d[_0x98b5('0x48')],_0x3d488d[_0x98b5('0x42')]);_0x546d9e[_0x98b5('0x46')]=_['intersection'](_0x3d488d['model'],qs[_0x98b5('0x45')](_0x4a79d4[_0x98b5('0x42')][_0x98b5('0x45')]));_0x546d9e[_0x98b5('0x46')]=_0x546d9e[_0x98b5('0x46')][_0x98b5('0x47')]?_0x546d9e[_0x98b5('0x46')]:_0x3d488d[_0x98b5('0x48')];_0x546d9e[_0x98b5('0x4a')]=qs[_0x98b5('0x4b')](_0x4a79d4[_0x98b5('0x42')][_0x98b5('0x4b')]);_0x546d9e[_0x98b5('0x4c')]=qs['filters'](_['pick'](_0x4a79d4['query'],_0x3d488d['filters']));if(_0x4a79d4[_0x98b5('0x42')]['filter']){_0x546d9e['where']=_[_0x98b5('0x38')](_0x546d9e[_0x98b5('0x4c')],{'$or':_['map'](_0x546d9e[_0x98b5('0x46')],function(_0x21d12f){var _0x1a2cf1={};_0x1a2cf1[_0x21d12f]={'$like':'%'+_0x4a79d4[_0x98b5('0x42')][_0x98b5('0x4e')]+'%'};return _0x1a2cf1;})});}_0x546d9e=_[_0x98b5('0x38')]({},_0x546d9e,_0x4a79d4['options']);return _0x33682e[_0x98b5('0x5e')](_0x546d9e);}})[_0x98b5('0x32')](function(_0x3c50a6){if(_0x3c50a6){_0x3733f3=_0x3c50a6[_0x98b5('0x47')];if(!_0x4a79d4[_0x98b5('0x42')][_0x98b5('0x49')](_0x98b5('0x5d'))){_0x546d9e[_0x98b5('0x2b')]=qs[_0x98b5('0x2b')](_0x4a79d4[_0x98b5('0x42')][_0x98b5('0x2b')]);_0x546d9e['offset']=qs['offset'](_0x4a79d4[_0x98b5('0x42')][_0x98b5('0x29')]);}return _0x33682e[_0x98b5('0x5e')](_0x546d9e);}})['then'](function(_0x3aa94b){if(_0x3aa94b){return _0x3aa94b?{'count':_0x3733f3,'rows':_0x3aa94b}:null;}})['then'](respondWithResult(_0xf8fad3,null))[_0x98b5('0x24')](handleError(_0xf8fad3,null));};exports[_0x98b5('0x5f')]=function(_0x30409f,_0x98726d,_0xad94b2){var _0x3db2ca={};var _0x183c8f={};var _0x551ab4;var _0x1f91b8;return db[_0x98b5('0x3c')]['findOne']({'where':{'id':_0x30409f[_0x98b5('0x56')]['id']}})[_0x98b5('0x32')](handleEntityNotFound(_0x98726d,null))['then'](function(_0x5d14c4){if(_0x5d14c4){_0x551ab4=_0x5d14c4;_0x183c8f[_0x98b5('0x48')]=_[_0x98b5('0x41')](db[_0x98b5('0x5c')]['rawAttributes']);_0x183c8f[_0x98b5('0x42')]=_['keys'](_0x30409f[_0x98b5('0x42')]);_0x183c8f[_0x98b5('0x43')]=_[_0x98b5('0x44')](_0x183c8f[_0x98b5('0x48')],_0x183c8f[_0x98b5('0x42')]);_0x3db2ca[_0x98b5('0x46')]=_[_0x98b5('0x44')](_0x183c8f[_0x98b5('0x48')],qs['fields'](_0x30409f[_0x98b5('0x42')][_0x98b5('0x45')]));_0x3db2ca['attributes']=_0x3db2ca[_0x98b5('0x46')][_0x98b5('0x47')]?_0x3db2ca[_0x98b5('0x46')]:_0x183c8f[_0x98b5('0x48')];_0x3db2ca[_0x98b5('0x4a')]=qs[_0x98b5('0x4b')](_0x30409f[_0x98b5('0x42')][_0x98b5('0x4b')]);_0x3db2ca[_0x98b5('0x4c')]=qs[_0x98b5('0x43')](_[_0x98b5('0x4d')](_0x30409f[_0x98b5('0x42')],_0x183c8f['filters']));if(_0x30409f[_0x98b5('0x42')][_0x98b5('0x4e')]){_0x3db2ca[_0x98b5('0x4c')]=_['merge'](_0x3db2ca[_0x98b5('0x4c')],{'$or':_[_0x98b5('0x40')](_0x3db2ca[_0x98b5('0x46')],function(_0x431390){var _0x447463={};_0x447463[_0x431390]={'$like':'%'+_0x30409f[_0x98b5('0x42')][_0x98b5('0x4e')]+'%'};return _0x447463;})});}_0x3db2ca=_[_0x98b5('0x38')]({},_0x3db2ca,_0x30409f[_0x98b5('0x50')]);return _0x551ab4[_0x98b5('0x5f')](_0x3db2ca);}})[_0x98b5('0x32')](function(_0x2dcff2){if(_0x2dcff2){_0x1f91b8=_0x2dcff2[_0x98b5('0x47')];if(!_0x30409f[_0x98b5('0x42')][_0x98b5('0x49')]('nolimit')){_0x3db2ca['limit']=qs[_0x98b5('0x2b')](_0x30409f[_0x98b5('0x42')][_0x98b5('0x2b')]);_0x3db2ca[_0x98b5('0x29')]=qs[_0x98b5('0x29')](_0x30409f[_0x98b5('0x42')][_0x98b5('0x29')]);}return _0x551ab4['getDescriptions'](_0x3db2ca);}})[_0x98b5('0x32')](function(_0x24efe4){if(_0x24efe4){return _0x24efe4?{'count':_0x1f91b8,'rows':_0x24efe4}:null;}})[_0x98b5('0x32')](respondWithResult(_0x98726d,null))[_0x98b5('0x24')](handleError(_0x98726d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fb7e1b7..6ac1ef1 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.model.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4241=['define','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5ddda9,_0x43e558){var _0x53a004=function(_0x2794a1){while(--_0x2794a1){_0x5ddda9['push'](_0x5ddda9['shift']());}};_0x53a004(++_0x43e558);}(_0x4241,0x1f1));var _0x1424=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4241[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0x1424('0x0'));var logger=require('../../config/logger')(_0x1424('0x1'));var moment=require(_0x1424('0x2'));var BPromise=require(_0x1424('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1424('0x4'));var rimraf=require(_0x1424('0x5'));var config=require(_0x1424('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x13bc85,_0x4d3d9e){return _0x13bc85[_0x1424('0x7')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc880=['rimraf','./intZohoConfiguration.attributes','define','int_zoho_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x334bd5,_0x53a368){var _0x481cf7=function(_0x3cf042){while(--_0x3cf042){_0x334bd5['push'](_0x334bd5['shift']());}};_0x481cf7(++_0x53a368);}(_0xc880,0x1c6));var _0x0c88=function(_0xa1f5dd,_0x4d961b){_0xa1f5dd=_0xa1f5dd-0x0;var _0x20b4c0=_0xc880[_0xa1f5dd];return _0x20b4c0;};'use strict';var _=require(_0x0c88('0x0'));var util=require(_0x0c88('0x1'));var logger=require(_0x0c88('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0c88('0x3'));var rp=require(_0x0c88('0x4'));var fs=require('fs');var path=require(_0x0c88('0x5'));var rimraf=require(_0x0c88('0x6'));var config=require('../../config/environment');var attributes=require(_0x0c88('0x7'));module['exports']=function(_0x2c17a5,_0x2ed1a6){return _0x2c17a5[_0x0c88('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x0c88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 4896c0a..1d02f66 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x137f=['rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x137f,0x178));var _0xf137=function(_0x2401ca,_0x171f6e){_0x2401ca=_0x2401ca-0x0;var _0x5bb607=_0x137f[_0x2401ca];return _0x5bb607;};'use strict';var _=require(_0xf137('0x0'));var util=require(_0xf137('0x1'));var moment=require(_0xf137('0x2'));var BPromise=require(_0xf137('0x3'));var rs=require(_0xf137('0x4'));var fs=require('fs');var Redis=require(_0xf137('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf137('0x6'));var logger=require(_0xf137('0x7'))(_0xf137('0x8'));var config=require(_0xf137('0x9'));var jayson=require(_0xf137('0xa'));var client=jayson[_0xf137('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4896e4,_0x4241e9,_0x107715){return new BPromise(function(_0x5db66d,_0xa7e5a4){return client[_0xf137('0xc')](_0x4896e4,_0x107715)[_0xf137('0xd')](function(_0x557bef){logger[_0xf137('0xe')](_0xf137('0xf'),_0x4241e9,_0xf137('0x10'));logger[_0xf137('0x11')](_0xf137('0x12'),_0x4241e9,_0xf137('0x10'),JSON[_0xf137('0x13')](_0x557bef));if(_0x557bef[_0xf137('0x14')]){if(_0x557bef[_0xf137('0x14')]['code']===0x1f4){logger[_0xf137('0x14')](_0xf137('0xf'),_0x4241e9,_0x557bef[_0xf137('0x14')][_0xf137('0x15')]);return _0xa7e5a4(_0x557bef[_0xf137('0x14')][_0xf137('0x15')]);}logger[_0xf137('0x14')](_0xf137('0xf'),_0x4241e9,_0x557bef[_0xf137('0x14')][_0xf137('0x15')]);return _0x5db66d(_0x557bef[_0xf137('0x14')]['message']);}else{logger[_0xf137('0xe')](_0xf137('0xf'),_0x4241e9,_0xf137('0x10'));_0x5db66d(_0x557bef[_0xf137('0x16')][_0xf137('0x15')]);}})[_0xf137('0x17')](function(_0x53dc1e){logger[_0xf137('0x14')](_0xf137('0xf'),_0x4241e9,_0x53dc1e);_0xa7e5a4(_0x53dc1e);});});} \ No newline at end of file +var _0x82b9=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug'];(function(_0x3403b5,_0x17f16c){var _0x49c99f=function(_0x214f24){while(--_0x214f24){_0x3403b5['push'](_0x3403b5['shift']());}};_0x49c99f(++_0x17f16c);}(_0x82b9,0x1bd));var _0x982b=function(_0x44210e,_0x1c76d6){_0x44210e=_0x44210e-0x0;var _0x2c6399=_0x82b9[_0x44210e];return _0x2c6399;};'use strict';var _=require(_0x982b('0x0'));var util=require(_0x982b('0x1'));var moment=require(_0x982b('0x2'));var BPromise=require(_0x982b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x982b('0x4'));var db=require(_0x982b('0x5'))['db'];var utils=require(_0x982b('0x6'));var logger=require('../../config/logger')(_0x982b('0x7'));var config=require(_0x982b('0x8'));var jayson=require(_0x982b('0x9'));var client=jayson[_0x982b('0xa')][_0x982b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41570e,_0x1a387b,_0x1d0884){return new BPromise(function(_0x443817,_0x1d5054){return client[_0x982b('0xc')](_0x41570e,_0x1d0884)['then'](function(_0x3fd6de){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1a387b,_0x982b('0xd'));logger[_0x982b('0xe')](_0x982b('0xf'),_0x1a387b,_0x982b('0xd'),JSON['stringify'](_0x3fd6de));if(_0x3fd6de[_0x982b('0x10')]){if(_0x3fd6de[_0x982b('0x10')][_0x982b('0x11')]===0x1f4){logger['error'](_0x982b('0x12'),_0x1a387b,_0x3fd6de[_0x982b('0x10')]['message']);return _0x1d5054(_0x3fd6de[_0x982b('0x10')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1a387b,_0x3fd6de[_0x982b('0x10')][_0x982b('0x13')]);return _0x443817(_0x3fd6de['error']['message']);}else{logger[_0x982b('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a387b,'request\x20sent');_0x443817(_0x3fd6de[_0x982b('0x15')][_0x982b('0x13')]);}})[_0x982b('0x16')](function(_0x1dda09){logger[_0x982b('0x10')](_0x982b('0x12'),_0x1a387b,_0x1dda09);_0x1d5054(_0x1dda09);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 287e73f..96a2ecf 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7fa=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','isAuthenticated','post','create','put','update','/:id','destroy','exports'];(function(_0x2047bf,_0x429ed5){var _0xce1d9f=function(_0x323bae){while(--_0x323bae){_0x2047bf['push'](_0x2047bf['shift']());}};_0xce1d9f(++_0x429ed5);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xaa7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa7f('0x1'));var express=require(_0xaa7f('0x2'));var router=express[_0xaa7f('0x3')]();var fs_extra=require(_0xaa7f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var controller=require(_0xaa7f('0x7'));router[_0xaa7f('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa7f('0x9')]);router['get']('/:id',auth[_0xaa7f('0xa')](),controller['show']);router[_0xaa7f('0xb')]('/',auth[_0xaa7f('0xa')](),controller[_0xaa7f('0xc')]);router[_0xaa7f('0xd')]('/:id',auth[_0xaa7f('0xa')](),controller[_0xaa7f('0xe')]);router['delete'](_0xaa7f('0xf'),auth[_0xaa7f('0xa')](),controller[_0xaa7f('0x10')]);module[_0xaa7f('0x11')]=router; \ No newline at end of file +var _0xd138=['put','delete','exports','multer','util','path','fs-extra','../../config/environment','/:id','isAuthenticated','show'];(function(_0x5d9e0e,_0x5e937e){var _0x126abb=function(_0x2ff40f){while(--_0x2ff40f){_0x5d9e0e['push'](_0x5d9e0e['shift']());}};_0x126abb(++_0x5e937e);}(_0xd138,0x1dc));var _0x8d13=function(_0x259991,_0x56b6dc){_0x259991=_0x259991-0x0;var _0x18c8e7=_0xd138[_0x259991];return _0x18c8e7;};'use strict';var multer=require(_0x8d13('0x0'));var util=require(_0x8d13('0x1'));var path=require(_0x8d13('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d13('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d13('0x4'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8d13('0x5'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x7')]);router['post']('/',auth[_0x8d13('0x6')](),controller['create']);router[_0x8d13('0x8')](_0x8d13('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x8d13('0x9')](_0x8d13('0x5'),auth[_0x8d13('0x6')](),controller['destroy']);module[_0x8d13('0xa')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c952e66..25508e4 100644 --- a/server/api/intZohoField/intZohoField.attributes.js +++ b/server/api/intZohoField/intZohoField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb07f=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4b0df0,_0x40f572){var _0x1b3672=function(_0x3980f9){while(--_0x3980f9){_0x4b0df0['push'](_0x4b0df0['shift']());}};_0x1b3672(++_0x40f572);}(_0xb07f,0x109));var _0xfb07=function(_0x2e9c98,_0x33e31e){_0x2e9c98=_0x2e9c98-0x0;var _0xda3039=_0xb07f[_0x2e9c98];return _0xda3039;};'use strict';var Sequelize=require(_0xfb07('0x0'));module[_0xfb07('0x1')]={'type':{'type':Sequelize[_0xfb07('0x2')](_0xfb07('0x3'),_0xfb07('0x4'),_0xfb07('0x5'),_0xfb07('0x6'),_0xfb07('0x7')),'defaultValue':_0xfb07('0x3')},'content':{'type':Sequelize[_0xfb07('0x8')]},'key':{'type':Sequelize[_0xfb07('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xfb07('0x3'),_0xfb07('0x4'),_0xfb07('0x5'))},'keyContent':{'type':Sequelize[_0xfb07('0x8')]},'idField':{'type':Sequelize[_0xfb07('0x8')]},'nameField':{'type':Sequelize[_0xfb07('0x8')]},'customField':{'type':Sequelize[_0xfb07('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb07('0x8')]}}; \ No newline at end of file +var _0xf9f7=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x2effa6,_0x1440d7){_0x2effa6=_0x2effa6-0x0;var _0x226598=_0xf9f7[_0x2effa6];return _0x226598;};'use strict';var Sequelize=require(_0x7f9f('0x0'));module[_0x7f9f('0x1')]={'type':{'type':Sequelize[_0x7f9f('0x2')](_0x7f9f('0x3'),_0x7f9f('0x4'),_0x7f9f('0x5'),'keyValue','picklist'),'defaultValue':_0x7f9f('0x3')},'content':{'type':Sequelize[_0x7f9f('0x6')]},'key':{'type':Sequelize[_0x7f9f('0x6')]},'keyType':{'type':Sequelize[_0x7f9f('0x2')](_0x7f9f('0x3'),_0x7f9f('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x7f9f('0x6')]},'idField':{'type':Sequelize[_0x7f9f('0x6')]},'nameField':{'type':Sequelize[_0x7f9f('0x6')]},'customField':{'type':Sequelize[_0x7f9f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f9f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 477a25a..80fc300 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79ce=['send','render','merge','contact','agent','account','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','where','filter','VIRTUAL','options','includeAll','include','ZohoField','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','save','then','destroy','end','error','name'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x79ce,0xb7));var _0xe79c=function(_0x9f863e,_0xa4d9a6){_0x9f863e=_0x9f863e-0x0;var _0x24a8cd=_0x79ce[_0x9f863e];return _0x24a8cd;};'use strict';var emlformat=require(_0xe79c('0x0'));var rimraf=require(_0xe79c('0x1'));var zipdir=require(_0xe79c('0x2'));var jsonpatch=require(_0xe79c('0x3'));var rp=require(_0xe79c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe79c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe79c('0x6'));var csv=require(_0xe79c('0x7'));var ejs=require(_0xe79c('0x8'));var fs=require('fs');var fs_extra=require(_0xe79c('0x9'));var _=require('lodash');var squel=require(_0xe79c('0xa'));var crypto=require(_0xe79c('0xb'));var jsforce=require(_0xe79c('0xc'));var deskjs=require(_0xe79c('0xd'));var toCsv=require(_0xe79c('0x7'));var querystring=require(_0xe79c('0xe'));var Papa=require(_0xe79c('0xf'));var Redis=require(_0xe79c('0x10'));var authService=require(_0xe79c('0x11'));var qs=require(_0xe79c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe79c('0x13'));var logger=require(_0xe79c('0x14'))(_0xe79c('0x15'));var utils=require(_0xe79c('0x16'));var config=require(_0xe79c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55ff15,_0xd3647b){_0xd3647b=_0xd3647b||0xcc;return function(_0x4f099c){if(_0x4f099c){return _0x55ff15[_0xe79c('0x18')](_0xd3647b);}return _0x55ff15['status'](_0xd3647b)['end']();};}function respondWithResult(_0x51c8b2,_0x4bcbb1){_0x4bcbb1=_0x4bcbb1||0xc8;return function(_0x463334){if(_0x463334){return _0x51c8b2[_0xe79c('0x19')](_0x4bcbb1)['json'](_0x463334);}};}function respondWithFilteredResult(_0x2dc1c9,_0x5a9bb9){return function(_0x54a784){if(_0x54a784){var _0x133a3a=typeof _0x5a9bb9[_0xe79c('0x1a')]===_0xe79c('0x1b')&&typeof _0x5a9bb9['limit']==='undefined';var _0x5e2222=_0x54a784[_0xe79c('0x1c')];var _0x3edf29=_0x133a3a?0x0:_0x5a9bb9['offset'];var _0x586b65=_0x133a3a?_0x54a784[_0xe79c('0x1c')]:_0x5a9bb9[_0xe79c('0x1a')]+_0x5a9bb9['limit'];var _0x3ee9d6;if(_0x586b65>=_0x5e2222){_0x586b65=_0x5e2222;_0x3ee9d6=0xc8;}else{_0x3ee9d6=0xce;}_0x2dc1c9[_0xe79c('0x19')](_0x3ee9d6);return _0x2dc1c9[_0xe79c('0x1d')](_0xe79c('0x1e'),_0x3edf29+'-'+_0x586b65+'/'+_0x5e2222)[_0xe79c('0x1f')](_0x54a784);}return null;};}function patchUpdates(_0x237924){return function(_0x32f4c2){try{jsonpatch[_0xe79c('0x20')](_0x32f4c2,_0x237924,!![]);}catch(_0x4b1d06){return BPromise['reject'](_0x4b1d06);}return _0x32f4c2[_0xe79c('0x21')]();};}function saveUpdates(_0x3c7509,_0x1d30f3){return function(_0x48d2ea){if(_0x48d2ea){return _0x48d2ea['update'](_0x3c7509)[_0xe79c('0x22')](function(_0xde1de0){return _0xde1de0;});}return null;};}function removeEntity(_0x448299,_0x5b8521){return function(_0x5510b3){if(_0x5510b3){return _0x5510b3[_0xe79c('0x23')]()[_0xe79c('0x22')](function(){_0x448299[_0xe79c('0x19')](0xcc)[_0xe79c('0x24')]();});}};}function handleEntityNotFound(_0x43d952,_0x5055dd){return function(_0x208a9f){if(!_0x208a9f){_0x43d952[_0xe79c('0x18')](0x194);}return _0x208a9f;};}function handleError(_0x33ed00,_0xced4a6){_0xced4a6=_0xced4a6||0x1f4;return function(_0x5498a0){logger[_0xe79c('0x25')](_0x5498a0['stack']);if(_0x5498a0[_0xe79c('0x26')]){delete _0x5498a0[_0xe79c('0x26')];}_0x33ed00[_0xe79c('0x19')](_0xced4a6)[_0xe79c('0x27')](_0x5498a0);};}function getMustacheRender(_0x18bb24,_0x2b8556){return Mustache[_0xe79c('0x28')](_0x18bb24,_[_0xe79c('0x29')](_0x2b8556['body'],{'contact':_0x2b8556[_0xe79c('0x2a')],'message':_0x2b8556['message'],'agent':_0x2b8556[_0xe79c('0x2b')],'interaction':_0x2b8556['interaction'],'account':_0x2b8556[_0xe79c('0x2c')]}))||'';}exports['index']=function(_0x263620,_0x442581){var _0x4ec434={},_0x52396b={},_0x43c77f={'count':0x0,'rows':[]};var _0x10b8bc=_[_0xe79c('0x2d')](db['ZohoField'][_0xe79c('0x2e')],function(_0x22550c){return{'name':_0x22550c[_0xe79c('0x2f')],'type':_0x22550c[_0xe79c('0x30')]['key']};});_0x52396b['model']=_[_0xe79c('0x2d')](_0x10b8bc,_0xe79c('0x26'));_0x52396b['query']=_[_0xe79c('0x31')](_0x263620[_0xe79c('0x32')]);_0x52396b[_0xe79c('0x33')]=_[_0xe79c('0x34')](_0x52396b[_0xe79c('0x35')],_0x52396b[_0xe79c('0x32')]);_0x4ec434[_0xe79c('0x36')]=_[_0xe79c('0x34')](_0x52396b[_0xe79c('0x35')],qs[_0xe79c('0x37')](_0x263620['query'][_0xe79c('0x37')]));_0x4ec434[_0xe79c('0x36')]=_0x4ec434[_0xe79c('0x36')][_0xe79c('0x38')]?_0x4ec434['attributes']:_0x52396b['model'];if(!_0x263620[_0xe79c('0x32')][_0xe79c('0x39')]('nolimit')){_0x4ec434[_0xe79c('0x3a')]=qs[_0xe79c('0x3a')](_0x263620[_0xe79c('0x32')][_0xe79c('0x3a')]);_0x4ec434[_0xe79c('0x1a')]=qs[_0xe79c('0x1a')](_0x263620[_0xe79c('0x32')][_0xe79c('0x1a')]);}_0x4ec434[_0xe79c('0x3b')]=qs['sort'](_0x263620[_0xe79c('0x32')]['sort']);_0x4ec434[_0xe79c('0x3c')]=qs[_0xe79c('0x33')](_['pick'](_0x263620[_0xe79c('0x32')],_0x52396b[_0xe79c('0x33')]),_0x10b8bc);if(_0x263620['query'][_0xe79c('0x3d')]){_0x4ec434[_0xe79c('0x3c')]=_[_0xe79c('0x29')](_0x4ec434[_0xe79c('0x3c')],{'$or':_[_0xe79c('0x2d')](_0x10b8bc,function(_0x4c5883){if(_0x4c5883[_0xe79c('0x30')]!==_0xe79c('0x3e')){var _0x79db2={};_0x79db2[_0x4c5883[_0xe79c('0x26')]]={'$like':'%'+_0x263620[_0xe79c('0x32')][_0xe79c('0x3d')]+'%'};return _0x79db2;}})});}_0x4ec434=_['merge']({},_0x4ec434,_0x263620[_0xe79c('0x3f')]);var _0x364494={'where':_0x4ec434[_0xe79c('0x3c')]};return db['ZohoField']['count'](_0x364494)[_0xe79c('0x22')](function(_0x511edb){_0x43c77f[_0xe79c('0x1c')]=_0x511edb;if(_0x263620[_0xe79c('0x32')][_0xe79c('0x40')]){_0x4ec434[_0xe79c('0x41')]=[{'all':!![]}];}return db[_0xe79c('0x42')]['findAll'](_0x4ec434);})['then'](function(_0x368d30){_0x43c77f['rows']=_0x368d30;return _0x43c77f;})[_0xe79c('0x22')](respondWithFilteredResult(_0x442581,_0x4ec434))[_0xe79c('0x43')](handleError(_0x442581,null));};exports[_0xe79c('0x44')]=function(_0x3ebfb3,_0x268e71){var _0x246b26={'raw':!![],'where':{'id':_0x3ebfb3[_0xe79c('0x45')]['id']}},_0x3b2570={};_0x3b2570[_0xe79c('0x35')]=_[_0xe79c('0x31')](db[_0xe79c('0x42')]['rawAttributes']);_0x3b2570['query']=_['keys'](_0x3ebfb3['query']);_0x3b2570[_0xe79c('0x33')]=_[_0xe79c('0x34')](_0x3b2570[_0xe79c('0x35')],_0x3b2570['query']);_0x246b26[_0xe79c('0x36')]=_[_0xe79c('0x34')](_0x3b2570[_0xe79c('0x35')],qs[_0xe79c('0x37')](_0x3ebfb3[_0xe79c('0x32')][_0xe79c('0x37')]));_0x246b26['attributes']=_0x246b26[_0xe79c('0x36')][_0xe79c('0x38')]?_0x246b26[_0xe79c('0x36')]:_0x3b2570[_0xe79c('0x35')];if(_0x3ebfb3[_0xe79c('0x32')][_0xe79c('0x40')]){_0x246b26[_0xe79c('0x41')]=[{'all':!![]}];}_0x246b26=_['merge']({},_0x246b26,_0x3ebfb3[_0xe79c('0x3f')]);return db['ZohoField'][_0xe79c('0x46')](_0x246b26)['then'](handleEntityNotFound(_0x268e71,null))[_0xe79c('0x22')](respondWithResult(_0x268e71,null))['catch'](handleError(_0x268e71,null));};exports[_0xe79c('0x47')]=function(_0x56878a,_0x54cfb8){return db[_0xe79c('0x42')][_0xe79c('0x47')](_0x56878a[_0xe79c('0x48')],{})[_0xe79c('0x22')](respondWithResult(_0x54cfb8,0xc9))[_0xe79c('0x43')](handleError(_0x54cfb8,null));};exports[_0xe79c('0x49')]=function(_0x5a81b6,_0x44cfee){if(_0x5a81b6[_0xe79c('0x48')]['id']){delete _0x5a81b6[_0xe79c('0x48')]['id'];}return db[_0xe79c('0x42')][_0xe79c('0x46')]({'where':{'id':_0x5a81b6[_0xe79c('0x45')]['id']}})['then'](handleEntityNotFound(_0x44cfee,null))[_0xe79c('0x22')](saveUpdates(_0x5a81b6[_0xe79c('0x48')],null))['then'](respondWithResult(_0x44cfee,null))['catch'](handleError(_0x44cfee,null));};exports['destroy']=function(_0x39814b,_0x3657a3){return db[_0xe79c('0x42')][_0xe79c('0x46')]({'where':{'id':_0x39814b['params']['id']}})['then'](handleEntityNotFound(_0x3657a3,null))[_0xe79c('0x22')](removeEntity(_0x3657a3,null))[_0xe79c('0x43')](handleError(_0x3657a3,null));}; \ No newline at end of file +var _0x5c23=['fieldName','key','query','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','filters','where','map','type','VIRTUAL','filter','includeAll','findAll','rows','show','fields','length','include','create','body','catch','find','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','message','agent','interaction','account','index','ZohoField','rawAttributes'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x5c23,0x1a2));var _0x35c2=function(_0x5d8086,_0x4f3f72){_0x5d8086=_0x5d8086-0x0;var _0x55857f=_0x5c23[_0x5d8086];return _0x55857f;};'use strict';var emlformat=require(_0x35c2('0x0'));var rimraf=require(_0x35c2('0x1'));var zipdir=require(_0x35c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35c2('0x3'));var moment=require(_0x35c2('0x4'));var BPromise=require(_0x35c2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x35c2('0x6'));var sox=require(_0x35c2('0x7'));var csv=require('to-csv');var ejs=require(_0x35c2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x35c2('0x9'));var jsforce=require(_0x35c2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x35c2('0xb'));var querystring=require('querystring');var Papa=require(_0x35c2('0xc'));var Redis=require(_0x35c2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x35c2('0xe'));var as=require(_0x35c2('0xf'));var hardwareService=require(_0x35c2('0x10'));var logger=require(_0x35c2('0x11'))('api');var utils=require(_0x35c2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x35c2('0x13'));var db=require(_0x35c2('0x14'))['db'];function respondWithStatusCode(_0x43b71d,_0x4a3b50){_0x4a3b50=_0x4a3b50||0xcc;return function(_0x304d68){if(_0x304d68){return _0x43b71d[_0x35c2('0x15')](_0x4a3b50);}return _0x43b71d[_0x35c2('0x16')](_0x4a3b50)[_0x35c2('0x17')]();};}function respondWithResult(_0x4d2734,_0x4c99dd){_0x4c99dd=_0x4c99dd||0xc8;return function(_0x535e3e){if(_0x535e3e){return _0x4d2734[_0x35c2('0x16')](_0x4c99dd)[_0x35c2('0x18')](_0x535e3e);}};}function respondWithFilteredResult(_0x42ab6a,_0x43ee9a){return function(_0x5cc820){if(_0x5cc820){var _0x343bcf=typeof _0x43ee9a[_0x35c2('0x19')]===_0x35c2('0x1a')&&typeof _0x43ee9a[_0x35c2('0x1b')]==='undefined';var _0x47d433=_0x5cc820[_0x35c2('0x1c')];var _0x32ce10=_0x343bcf?0x0:_0x43ee9a['offset'];var _0x5eb184=_0x343bcf?_0x5cc820['count']:_0x43ee9a[_0x35c2('0x19')]+_0x43ee9a[_0x35c2('0x1b')];var _0x43a26e;if(_0x5eb184>=_0x47d433){_0x5eb184=_0x47d433;_0x43a26e=0xc8;}else{_0x43a26e=0xce;}_0x42ab6a[_0x35c2('0x16')](_0x43a26e);return _0x42ab6a[_0x35c2('0x1d')](_0x35c2('0x1e'),_0x32ce10+'-'+_0x5eb184+'/'+_0x47d433)[_0x35c2('0x18')](_0x5cc820);}return null;};}function patchUpdates(_0x52b735){return function(_0x92e23a){try{jsonpatch[_0x35c2('0x1f')](_0x92e23a,_0x52b735,!![]);}catch(_0x3d298){return BPromise[_0x35c2('0x20')](_0x3d298);}return _0x92e23a[_0x35c2('0x21')]();};}function saveUpdates(_0x57fec5,_0x115cd3){return function(_0xec855c){if(_0xec855c){return _0xec855c[_0x35c2('0x22')](_0x57fec5)[_0x35c2('0x23')](function(_0x42ee80){return _0x42ee80;});}return null;};}function removeEntity(_0x357bb7,_0x25c010){return function(_0x4cfb23){if(_0x4cfb23){return _0x4cfb23[_0x35c2('0x24')]()[_0x35c2('0x23')](function(){_0x357bb7[_0x35c2('0x16')](0xcc)[_0x35c2('0x17')]();});}};}function handleEntityNotFound(_0x23d080,_0x59cd22){return function(_0x422006){if(!_0x422006){_0x23d080[_0x35c2('0x15')](0x194);}return _0x422006;};}function handleError(_0x5a0b49,_0x268bc0){_0x268bc0=_0x268bc0||0x1f4;return function(_0x1aee8e){logger[_0x35c2('0x25')](_0x1aee8e[_0x35c2('0x26')]);if(_0x1aee8e[_0x35c2('0x27')]){delete _0x1aee8e[_0x35c2('0x27')];}_0x5a0b49['status'](_0x268bc0)[_0x35c2('0x28')](_0x1aee8e);};}function getMustacheRender(_0x579070,_0x36baed){return Mustache[_0x35c2('0x29')](_0x579070,_[_0x35c2('0x2a')](_0x36baed['body'],{'contact':_0x36baed['contact'],'message':_0x36baed[_0x35c2('0x2b')],'agent':_0x36baed[_0x35c2('0x2c')],'interaction':_0x36baed[_0x35c2('0x2d')],'account':_0x36baed[_0x35c2('0x2e')]}))||'';}exports[_0x35c2('0x2f')]=function(_0x3f57e6,_0x5ab2a1){var _0x476679={},_0x38f3df={},_0x5a7954={'count':0x0,'rows':[]};var _0x1788f3=_['map'](db[_0x35c2('0x30')][_0x35c2('0x31')],function(_0x21b93d){return{'name':_0x21b93d[_0x35c2('0x32')],'type':_0x21b93d['type'][_0x35c2('0x33')]};});_0x38f3df['model']=_['map'](_0x1788f3,'name');_0x38f3df['query']=_['keys'](_0x3f57e6[_0x35c2('0x34')]);_0x38f3df['filters']=_['intersection'](_0x38f3df[_0x35c2('0x35')],_0x38f3df['query']);_0x476679[_0x35c2('0x36')]=_[_0x35c2('0x37')](_0x38f3df[_0x35c2('0x35')],qs['fields'](_0x3f57e6[_0x35c2('0x34')]['fields']));_0x476679[_0x35c2('0x36')]=_0x476679[_0x35c2('0x36')]['length']?_0x476679[_0x35c2('0x36')]:_0x38f3df[_0x35c2('0x35')];if(!_0x3f57e6[_0x35c2('0x34')][_0x35c2('0x38')](_0x35c2('0x39'))){_0x476679[_0x35c2('0x1b')]=qs[_0x35c2('0x1b')](_0x3f57e6[_0x35c2('0x34')][_0x35c2('0x1b')]);_0x476679[_0x35c2('0x19')]=qs[_0x35c2('0x19')](_0x3f57e6[_0x35c2('0x34')][_0x35c2('0x19')]);}_0x476679[_0x35c2('0x3a')]=qs[_0x35c2('0x3b')](_0x3f57e6['query'][_0x35c2('0x3b')]);_0x476679['where']=qs[_0x35c2('0x3c')](_['pick'](_0x3f57e6['query'],_0x38f3df[_0x35c2('0x3c')]),_0x1788f3);if(_0x3f57e6['query']['filter']){_0x476679[_0x35c2('0x3d')]=_['merge'](_0x476679[_0x35c2('0x3d')],{'$or':_[_0x35c2('0x3e')](_0x1788f3,function(_0x3bb9d5){if(_0x3bb9d5[_0x35c2('0x3f')]!==_0x35c2('0x40')){var _0x54bab1={};_0x54bab1[_0x3bb9d5[_0x35c2('0x27')]]={'$like':'%'+_0x3f57e6['query'][_0x35c2('0x41')]+'%'};return _0x54bab1;}})});}_0x476679=_[_0x35c2('0x2a')]({},_0x476679,_0x3f57e6['options']);var _0x119951={'where':_0x476679[_0x35c2('0x3d')]};return db['ZohoField'][_0x35c2('0x1c')](_0x119951)[_0x35c2('0x23')](function(_0x447bc1){_0x5a7954[_0x35c2('0x1c')]=_0x447bc1;if(_0x3f57e6[_0x35c2('0x34')][_0x35c2('0x42')]){_0x476679['include']=[{'all':!![]}];}return db[_0x35c2('0x30')][_0x35c2('0x43')](_0x476679);})['then'](function(_0x5640a1){_0x5a7954[_0x35c2('0x44')]=_0x5640a1;return _0x5a7954;})[_0x35c2('0x23')](respondWithFilteredResult(_0x5ab2a1,_0x476679))['catch'](handleError(_0x5ab2a1,null));};exports[_0x35c2('0x45')]=function(_0x588073,_0x9679d8){var _0x588e29={'raw':!![],'where':{'id':_0x588073['params']['id']}},_0x2bc099={};_0x2bc099[_0x35c2('0x35')]=_['keys'](db[_0x35c2('0x30')][_0x35c2('0x31')]);_0x2bc099[_0x35c2('0x34')]=_['keys'](_0x588073[_0x35c2('0x34')]);_0x2bc099[_0x35c2('0x3c')]=_[_0x35c2('0x37')](_0x2bc099[_0x35c2('0x35')],_0x2bc099['query']);_0x588e29[_0x35c2('0x36')]=_[_0x35c2('0x37')](_0x2bc099[_0x35c2('0x35')],qs['fields'](_0x588073[_0x35c2('0x34')][_0x35c2('0x46')]));_0x588e29['attributes']=_0x588e29['attributes'][_0x35c2('0x47')]?_0x588e29[_0x35c2('0x36')]:_0x2bc099['model'];if(_0x588073[_0x35c2('0x34')][_0x35c2('0x42')]){_0x588e29[_0x35c2('0x48')]=[{'all':!![]}];}_0x588e29=_[_0x35c2('0x2a')]({},_0x588e29,_0x588073['options']);return db[_0x35c2('0x30')]['find'](_0x588e29)[_0x35c2('0x23')](handleEntityNotFound(_0x9679d8,null))['then'](respondWithResult(_0x9679d8,null))['catch'](handleError(_0x9679d8,null));};exports[_0x35c2('0x49')]=function(_0x4633f7,_0x264139){return db[_0x35c2('0x30')][_0x35c2('0x49')](_0x4633f7[_0x35c2('0x4a')],{})[_0x35c2('0x23')](respondWithResult(_0x264139,0xc9))[_0x35c2('0x4b')](handleError(_0x264139,null));};exports[_0x35c2('0x22')]=function(_0x170edf,_0x498873){if(_0x170edf[_0x35c2('0x4a')]['id']){delete _0x170edf['body']['id'];}return db[_0x35c2('0x30')][_0x35c2('0x4c')]({'where':{'id':_0x170edf['params']['id']}})[_0x35c2('0x23')](handleEntityNotFound(_0x498873,null))[_0x35c2('0x23')](saveUpdates(_0x170edf[_0x35c2('0x4a')],null))[_0x35c2('0x23')](respondWithResult(_0x498873,null))[_0x35c2('0x4b')](handleError(_0x498873,null));};exports['destroy']=function(_0x52efa4,_0x581e2d){return db[_0x35c2('0x30')]['find']({'where':{'id':_0x52efa4[_0x35c2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x581e2d,null))[_0x35c2('0x23')](removeEntity(_0x581e2d,null))['catch'](handleError(_0x581e2d,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 93e1a63..4e159b0 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82c2=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x13c1ca,_0x324061){var _0x31a494=function(_0x2eec89){while(--_0x2eec89){_0x13c1ca['push'](_0x13c1ca['shift']());}};_0x31a494(++_0x324061);}(_0x82c2,0x12b));var _0x282c=function(_0xd5a842,_0x3bef1f){_0xd5a842=_0xd5a842-0x0;var _0xcedd84=_0x82c2[_0xd5a842];return _0xcedd84;};'use strict';var _=require(_0x282c('0x0'));var util=require(_0x282c('0x1'));var logger=require('../../config/logger')(_0x282c('0x2'));var moment=require(_0x282c('0x3'));var BPromise=require(_0x282c('0x4'));var rp=require(_0x282c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x282c('0x6'));var config=require(_0x282c('0x7'));var attributes=require(_0x282c('0x8'));module[_0x282c('0x9')]=function(_0x244b0c,_0x4446e7){return _0x244b0c[_0x282c('0xa')](_0x282c('0xb'),attributes,{'tableName':_0x282c('0xc'),'paranoid':![],'indexes':[{'name':_0x282c('0xd'),'fields':['idField',_0x282c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8bb=['idField','FieldId','util','../../config/logger','api','moment','bluebird','exports','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xc8bb,0x146));var _0xbc8b=function(_0x65fba6,_0x3c26ca){_0x65fba6=_0x65fba6-0x0;var _0xba1d71=_0xc8bb[_0x65fba6];return _0xba1d71;};'use strict';var _=require('lodash');var util=require(_0xbc8b('0x0'));var logger=require(_0xbc8b('0x1'))(_0xbc8b('0x2'));var moment=require(_0xbc8b('0x3'));var BPromise=require(_0xbc8b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xbc8b('0x5')]=function(_0x55c230,_0x3ee2ff){return _0x55c230[_0xbc8b('0x6')](_0xbc8b('0x7'),attributes,{'tableName':_0xbc8b('0x8'),'paranoid':![],'indexes':[{'name':_0xbc8b('0x9'),'fields':[_0xbc8b('0xa'),_0xbc8b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index b1c27e8..9baa8d7 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xc3f169,_0x5c2120){var _0x5edc66=function(_0x11121a){while(--_0x11121a){_0xc3f169['push'](_0xc3f169['shift']());}};_0x5edc66(++_0x5c2120);}(_0x34e8,0x12c));var _0x834e=function(_0x1faa06,_0x3d90f3){_0x1faa06=_0x1faa06-0x0;var _0x14490f=_0x34e8[_0x1faa06];return _0x14490f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x33c5=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x33c5,0xe6));var _0x533c=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0x33c5[_0x2bb3f6];return _0x62b339;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('ZohoField,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b33c754..71a7c78 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cc8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f6ac5,_0x166ce0){var _0x418591=function(_0x1eb763){while(--_0x1eb763){_0x4f6ac5['push'](_0x4f6ac5['shift']());}};_0x418591(++_0x166ce0);}(_0x8cc8,0x177));var _0x88cc=function(_0x552204,_0x222864){_0x552204=_0x552204-0x0;var _0x24988d=_0x8cc8[_0x552204];return _0x24988d;};'use strict';var multer=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var path=require(_0x88cc('0x2'));var timeout=require(_0x88cc('0x3'));var express=require(_0x88cc('0x4'));var router=express[_0x88cc('0x5')]();var fs_extra=require(_0x88cc('0x6'));var auth=require(_0x88cc('0x7'));var interaction=require(_0x88cc('0x8'));var config=require(_0x88cc('0x9'));module[_0x88cc('0xa')]=router; \ No newline at end of file +var _0x065e=['fs-extra','../../config/environment','exports','multer','express','Router'];(function(_0x141688,_0x29aec2){var _0x4e4bbf=function(_0x88beb3){while(--_0x88beb3){_0x141688['push'](_0x141688['shift']());}};_0x4e4bbf(++_0x29aec2);}(_0x065e,0x1a7));var _0xe065=function(_0x55a5ca,_0x2def75){_0x55a5ca=_0x55a5ca-0x0;var _0xd4281e=_0x065e[_0x55a5ca];return _0xd4281e;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var fs_extra=require(_0xe065('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe065('0x4'));module[_0xe065('0x5')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f2bc8b6..ae1bcda 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9802=['STRING','unique_name_and_version','INTEGER','BOOLEAN','state'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0x9802,0xd7));var _0x2980=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9802[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2980('0x0')],'allowNull':![],'unique':_0x2980('0x1')},'version':{'type':Sequelize[_0x2980('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x2980('0x0')]},'path':{'type':Sequelize[_0x2980('0x0')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x2980('0x2')]},'active':{'type':Sequelize[_0x2980('0x3')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x2980('0x0')]},'state':{'type':Sequelize[_0x2980('0x0')],'unique':_0x2980('0x4')},'description':{'type':Sequelize[_0x2980('0x0')]},'title':{'type':Sequelize[_0x2980('0x0')]},'remoteUri':{'type':Sequelize[_0x2980('0x0')]},'link':{'type':Sequelize[_0x2980('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0x2fcb=['unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x89c4df,_0x40d6e0){var _0x2d3c8e=function(_0x202ae9){while(--_0x202ae9){_0x89c4df['push'](_0x89c4df['shift']());}};_0x2d3c8e(++_0x40d6e0);}(_0x2fcb,0x185));var _0xb2fc=function(_0x365933,_0x4b25cf){_0x365933=_0x365933-0x0;var _0x56e6cb=_0x2fcb[_0x365933];return _0x56e6cb;};'use strict';var Sequelize=require(_0xb2fc('0x0'));module[_0xb2fc('0x1')]={'name':{'type':Sequelize[_0xb2fc('0x2')],'allowNull':![],'unique':_0xb2fc('0x3')},'version':{'type':Sequelize[_0xb2fc('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb2fc('0x4')},'filename':{'type':Sequelize[_0xb2fc('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb2fc('0x2')]},'size':{'type':Sequelize[_0xb2fc('0x5')]},'active':{'type':Sequelize[_0xb2fc('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xb2fc('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xb2fc('0x2')]},'remoteUri':{'type':Sequelize[_0xb2fc('0x2')]},'link':{'type':Sequelize[_0xb2fc('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a68ce5b..f274cf2 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x559e=['show','keys','create','update','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','name','send','body','message','agent','interaction','account','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Integration','includeAll','include','findAll','catch'];(function(_0x5b5f4c,_0xf1e942){var _0x29ccbf=function(_0x3d6e16){while(--_0x3d6e16){_0x5b5f4c['push'](_0x5b5f4c['shift']());}};_0x29ccbf(++_0xf1e942);}(_0x559e,0xf6));var _0xe559=function(_0x194bc1,_0x14199d){_0x194bc1=_0x194bc1-0x0;var _0x3892fb=_0x559e[_0x194bc1];return _0x3892fb;};'use strict';var emlformat=require(_0xe559('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe559('0x1'));var jsonpatch=require(_0xe559('0x2'));var rp=require(_0xe559('0x3'));var moment=require('moment');var BPromise=require(_0xe559('0x4'));var Mustache=require('mustache');var util=require(_0xe559('0x5'));var path=require(_0xe559('0x6'));var sox=require(_0xe559('0x7'));var csv=require(_0xe559('0x8'));var ejs=require(_0xe559('0x9'));var fs=require('fs');var fs_extra=require(_0xe559('0xa'));var _=require(_0xe559('0xb'));var squel=require(_0xe559('0xc'));var crypto=require(_0xe559('0xd'));var jsforce=require(_0xe559('0xe'));var deskjs=require(_0xe559('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe559('0x10'));var Papa=require(_0xe559('0x11'));var Redis=require(_0xe559('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe559('0x13'));var as=require(_0xe559('0x14'));var hardwareService=require(_0xe559('0x15'));var logger=require('../../config/logger')(_0xe559('0x16'));var utils=require(_0xe559('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe559('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ddfb5,_0xbe5e0){_0xbe5e0=_0xbe5e0||0xcc;return function(_0x233cba){if(_0x233cba){return _0x4ddfb5[_0xe559('0x19')](_0xbe5e0);}return _0x4ddfb5['status'](_0xbe5e0)[_0xe559('0x1a')]();};}function respondWithResult(_0x2bbb8d,_0x4f5bb5){_0x4f5bb5=_0x4f5bb5||0xc8;return function(_0x4208ec){if(_0x4208ec){return _0x2bbb8d[_0xe559('0x1b')](_0x4f5bb5)[_0xe559('0x1c')](_0x4208ec);}};}function respondWithFilteredResult(_0x296667,_0x3cfef7){return function(_0x279f29){if(_0x279f29){var _0x1f537e=typeof _0x3cfef7[_0xe559('0x1d')]===_0xe559('0x1e')&&typeof _0x3cfef7[_0xe559('0x1f')]===_0xe559('0x1e');var _0x114d1d=_0x279f29['count'];var _0x52fbd7=_0x1f537e?0x0:_0x3cfef7[_0xe559('0x1d')];var _0x1e3ba1=_0x1f537e?_0x279f29[_0xe559('0x20')]:_0x3cfef7[_0xe559('0x1d')]+_0x3cfef7['limit'];var _0x9d7374;if(_0x1e3ba1>=_0x114d1d){_0x1e3ba1=_0x114d1d;_0x9d7374=0xc8;}else{_0x9d7374=0xce;}_0x296667[_0xe559('0x1b')](_0x9d7374);return _0x296667[_0xe559('0x21')](_0xe559('0x22'),_0x52fbd7+'-'+_0x1e3ba1+'/'+_0x114d1d)[_0xe559('0x1c')](_0x279f29);}return null;};}function patchUpdates(_0x7fdf4e){return function(_0x5427c5){try{jsonpatch[_0xe559('0x23')](_0x5427c5,_0x7fdf4e,!![]);}catch(_0x28f0a0){return BPromise[_0xe559('0x24')](_0x28f0a0);}return _0x5427c5['save']();};}function saveUpdates(_0x415070,_0x51f8a0){return function(_0x208488){if(_0x208488){return _0x208488['update'](_0x415070)['then'](function(_0x1c62c3){return _0x1c62c3;});}return null;};}function removeEntity(_0x3ef344,_0x3fc9ce){return function(_0x46eb89){if(_0x46eb89){return _0x46eb89['destroy']()[_0xe559('0x25')](function(){_0x3ef344['status'](0xcc)[_0xe559('0x1a')]();});}};}function handleEntityNotFound(_0x2cb1d7,_0x3bc407){return function(_0xcfe3a2){if(!_0xcfe3a2){_0x2cb1d7[_0xe559('0x19')](0x194);}return _0xcfe3a2;};}function handleError(_0x5d8000,_0x307c0c){_0x307c0c=_0x307c0c||0x1f4;return function(_0x311fec){logger[_0xe559('0x26')](_0x311fec['stack']);if(_0x311fec[_0xe559('0x27')]){delete _0x311fec[_0xe559('0x27')];}_0x5d8000['status'](_0x307c0c)[_0xe559('0x28')](_0x311fec);};}function getMustacheRender(_0x172e15,_0x531c29){return Mustache['render'](_0x172e15,_['merge'](_0x531c29[_0xe559('0x29')],{'contact':_0x531c29['contact'],'message':_0x531c29[_0xe559('0x2a')],'agent':_0x531c29[_0xe559('0x2b')],'interaction':_0x531c29[_0xe559('0x2c')],'account':_0x531c29[_0xe559('0x2d')]}))||'';}exports[_0xe559('0x2e')]=function(_0xb2802e,_0x32e7f0){var _0x4d8184={},_0x2d34ac={},_0xbd4e34={'count':0x0,'rows':[]};var _0x1016b2=_['map'](db['Integration'][_0xe559('0x2f')],function(_0x1c405){return{'name':_0x1c405[_0xe559('0x30')],'type':_0x1c405[_0xe559('0x31')][_0xe559('0x32')]};});_0x2d34ac[_0xe559('0x33')]=_[_0xe559('0x34')](_0x1016b2,_0xe559('0x27'));_0x2d34ac['query']=_['keys'](_0xb2802e[_0xe559('0x35')]);_0x2d34ac[_0xe559('0x36')]=_['intersection'](_0x2d34ac[_0xe559('0x33')],_0x2d34ac[_0xe559('0x35')]);_0x4d8184[_0xe559('0x37')]=_[_0xe559('0x38')](_0x2d34ac[_0xe559('0x33')],qs[_0xe559('0x39')](_0xb2802e[_0xe559('0x35')][_0xe559('0x39')]));_0x4d8184[_0xe559('0x37')]=_0x4d8184[_0xe559('0x37')][_0xe559('0x3a')]?_0x4d8184[_0xe559('0x37')]:_0x2d34ac[_0xe559('0x33')];if(!_0xb2802e[_0xe559('0x35')][_0xe559('0x3b')](_0xe559('0x3c'))){_0x4d8184[_0xe559('0x1f')]=qs[_0xe559('0x1f')](_0xb2802e[_0xe559('0x35')][_0xe559('0x1f')]);_0x4d8184[_0xe559('0x1d')]=qs[_0xe559('0x1d')](_0xb2802e[_0xe559('0x35')]['offset']);}_0x4d8184[_0xe559('0x3d')]=qs[_0xe559('0x3e')](_0xb2802e[_0xe559('0x35')][_0xe559('0x3e')]);_0x4d8184['where']=qs[_0xe559('0x36')](_[_0xe559('0x3f')](_0xb2802e[_0xe559('0x35')],_0x2d34ac[_0xe559('0x36')]),_0x1016b2);if(_0xb2802e[_0xe559('0x35')][_0xe559('0x40')]){_0x4d8184[_0xe559('0x41')]=_[_0xe559('0x42')](_0x4d8184[_0xe559('0x41')],{'$or':_['map'](_0x1016b2,function(_0x374df7){if(_0x374df7['type']!==_0xe559('0x43')){var _0x1d9862={};_0x1d9862[_0x374df7[_0xe559('0x27')]]={'$like':'%'+_0xb2802e[_0xe559('0x35')]['filter']+'%'};return _0x1d9862;}})});}_0x4d8184=_[_0xe559('0x42')]({},_0x4d8184,_0xb2802e[_0xe559('0x44')]);var _0x2a5d67={'where':_0x4d8184[_0xe559('0x41')]};return db[_0xe559('0x45')][_0xe559('0x20')](_0x2a5d67)[_0xe559('0x25')](function(_0x25410b){_0xbd4e34[_0xe559('0x20')]=_0x25410b;if(_0xb2802e[_0xe559('0x35')][_0xe559('0x46')]){_0x4d8184[_0xe559('0x47')]=[{'all':!![]}];}return db['Integration'][_0xe559('0x48')](_0x4d8184);})['then'](function(_0x5a8c40){_0xbd4e34['rows']=_0x5a8c40;return _0xbd4e34;})[_0xe559('0x25')](respondWithFilteredResult(_0x32e7f0,_0x4d8184))[_0xe559('0x49')](handleError(_0x32e7f0,null));};exports[_0xe559('0x4a')]=function(_0x4785f4,_0x2f6fdd){var _0x1f88cc={'raw':![],'where':{'id':_0x4785f4['params']['id']}},_0x5309c1={};_0x5309c1[_0xe559('0x33')]=_['keys'](db[_0xe559('0x45')][_0xe559('0x2f')]);_0x5309c1[_0xe559('0x35')]=_[_0xe559('0x4b')](_0x4785f4[_0xe559('0x35')]);_0x5309c1[_0xe559('0x36')]=_[_0xe559('0x38')](_0x5309c1[_0xe559('0x33')],_0x5309c1[_0xe559('0x35')]);_0x1f88cc[_0xe559('0x37')]=_['intersection'](_0x5309c1[_0xe559('0x33')],qs[_0xe559('0x39')](_0x4785f4[_0xe559('0x35')][_0xe559('0x39')]));_0x1f88cc['attributes']=_0x1f88cc[_0xe559('0x37')][_0xe559('0x3a')]?_0x1f88cc[_0xe559('0x37')]:_0x5309c1['model'];if(_0x4785f4['query'][_0xe559('0x46')]){_0x1f88cc[_0xe559('0x47')]=[{'all':!![]}];}_0x1f88cc=_[_0xe559('0x42')]({},_0x1f88cc,_0x4785f4[_0xe559('0x44')]);return db[_0xe559('0x45')]['find'](_0x1f88cc)[_0xe559('0x25')](handleEntityNotFound(_0x2f6fdd,null))['then'](respondWithResult(_0x2f6fdd,null))[_0xe559('0x49')](handleError(_0x2f6fdd,null));};exports['create']=function(_0x464835,_0xf6aace){return db[_0xe559('0x45')][_0xe559('0x4c')](_0x464835['body'],{})[_0xe559('0x25')](respondWithResult(_0xf6aace,0xc9))[_0xe559('0x49')](handleError(_0xf6aace,null));};exports[_0xe559('0x4d')]=function(_0x4b3d4b,_0x4073fd){if(_0x4b3d4b[_0xe559('0x29')]['id']){delete _0x4b3d4b['body']['id'];}return db[_0xe559('0x45')]['find']({'where':{'id':_0x4b3d4b[_0xe559('0x4e')]['id']}})[_0xe559('0x25')](handleEntityNotFound(_0x4073fd,null))[_0xe559('0x25')](saveUpdates(_0x4b3d4b['body'],null))[_0xe559('0x25')](respondWithResult(_0x4073fd,null))[_0xe559('0x49')](handleError(_0x4073fd,null));};exports[_0xe559('0x4f')]=function(_0x550141,_0x27d659){return db[_0xe559('0x45')]['find']({'where':{'id':_0x550141[_0xe559('0x4e')]['id']}})[_0xe559('0x25')](handleEntityNotFound(_0x27d659,null))['then'](removeEntity(_0x27d659,null))[_0xe559('0x49')](handleError(_0x27d659,null));}; \ No newline at end of file +var _0x4ee1=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','render','merge','contact','message','agent','account','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','Integration','findAll','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x3f5ade,_0x45811c){var _0xc7367a=function(_0x3f8369){while(--_0x3f8369){_0x3f5ade['push'](_0x3f5ade['shift']());}};_0xc7367a(++_0x45811c);}(_0x4ee1,0x123));var _0x14ee=function(_0x5a194b,_0x16a725){_0x5a194b=_0x5a194b-0x0;var _0x288d92=_0x4ee1[_0x5a194b];return _0x288d92;};'use strict';var emlformat=require(_0x14ee('0x0'));var rimraf=require(_0x14ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ee('0x2'));var rp=require(_0x14ee('0x3'));var moment=require(_0x14ee('0x4'));var BPromise=require(_0x14ee('0x5'));var Mustache=require(_0x14ee('0x6'));var util=require(_0x14ee('0x7'));var path=require(_0x14ee('0x8'));var sox=require('sox');var csv=require(_0x14ee('0x9'));var ejs=require(_0x14ee('0xa'));var fs=require('fs');var fs_extra=require(_0x14ee('0xb'));var _=require('lodash');var squel=require(_0x14ee('0xc'));var crypto=require('crypto');var jsforce=require(_0x14ee('0xd'));var deskjs=require(_0x14ee('0xe'));var toCsv=require(_0x14ee('0x9'));var querystring=require(_0x14ee('0xf'));var Papa=require('papaparse');var Redis=require(_0x14ee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14ee('0x12'));var logger=require(_0x14ee('0x13'))(_0x14ee('0x14'));var utils=require(_0x14ee('0x15'));var config=require(_0x14ee('0x16'));var licenseUtil=require(_0x14ee('0x17'));var db=require(_0x14ee('0x18'))['db'];function respondWithStatusCode(_0x65315b,_0x5ce2c6){_0x5ce2c6=_0x5ce2c6||0xcc;return function(_0x4125d7){if(_0x4125d7){return _0x65315b['sendStatus'](_0x5ce2c6);}return _0x65315b['status'](_0x5ce2c6)[_0x14ee('0x19')]();};}function respondWithResult(_0x25f767,_0x3ff314){_0x3ff314=_0x3ff314||0xc8;return function(_0xe9465a){if(_0xe9465a){return _0x25f767[_0x14ee('0x1a')](_0x3ff314)[_0x14ee('0x1b')](_0xe9465a);}};}function respondWithFilteredResult(_0x3bf3a5,_0x29f39d){return function(_0xb8e69a){if(_0xb8e69a){var _0x5419fc=typeof _0x29f39d[_0x14ee('0x1c')]===_0x14ee('0x1d')&&typeof _0x29f39d[_0x14ee('0x1e')]===_0x14ee('0x1d');var _0x45b80=_0xb8e69a['count'];var _0x381f03=_0x5419fc?0x0:_0x29f39d[_0x14ee('0x1c')];var _0x112cfb=_0x5419fc?_0xb8e69a[_0x14ee('0x1f')]:_0x29f39d[_0x14ee('0x1c')]+_0x29f39d['limit'];var _0x3e9ebe;if(_0x112cfb>=_0x45b80){_0x112cfb=_0x45b80;_0x3e9ebe=0xc8;}else{_0x3e9ebe=0xce;}_0x3bf3a5[_0x14ee('0x1a')](_0x3e9ebe);return _0x3bf3a5[_0x14ee('0x20')](_0x14ee('0x21'),_0x381f03+'-'+_0x112cfb+'/'+_0x45b80)[_0x14ee('0x1b')](_0xb8e69a);}return null;};}function patchUpdates(_0x3819d2){return function(_0x299bda){try{jsonpatch[_0x14ee('0x22')](_0x299bda,_0x3819d2,!![]);}catch(_0x1bedfc){return BPromise['reject'](_0x1bedfc);}return _0x299bda[_0x14ee('0x23')]();};}function saveUpdates(_0x317740,_0x4f4868){return function(_0x3de61c){if(_0x3de61c){return _0x3de61c[_0x14ee('0x24')](_0x317740)[_0x14ee('0x25')](function(_0x4d999a){return _0x4d999a;});}return null;};}function removeEntity(_0x356ea8,_0x594613){return function(_0x1506f8){if(_0x1506f8){return _0x1506f8[_0x14ee('0x26')]()[_0x14ee('0x25')](function(){_0x356ea8[_0x14ee('0x1a')](0xcc)[_0x14ee('0x19')]();});}};}function handleEntityNotFound(_0x16e398,_0x5c8398){return function(_0x4be746){if(!_0x4be746){_0x16e398['sendStatus'](0x194);}return _0x4be746;};}function handleError(_0x1ec2eb,_0x13ec50){_0x13ec50=_0x13ec50||0x1f4;return function(_0x1bcd42){logger[_0x14ee('0x27')](_0x1bcd42[_0x14ee('0x28')]);if(_0x1bcd42[_0x14ee('0x29')]){delete _0x1bcd42[_0x14ee('0x29')];}_0x1ec2eb[_0x14ee('0x1a')](_0x13ec50)[_0x14ee('0x2a')](_0x1bcd42);};}function getMustacheRender(_0x529221,_0x451a60){return Mustache[_0x14ee('0x2b')](_0x529221,_[_0x14ee('0x2c')](_0x451a60['body'],{'contact':_0x451a60[_0x14ee('0x2d')],'message':_0x451a60[_0x14ee('0x2e')],'agent':_0x451a60[_0x14ee('0x2f')],'interaction':_0x451a60['interaction'],'account':_0x451a60[_0x14ee('0x30')]}))||'';}exports['index']=function(_0x1e940e,_0x1dde24){var _0x267b1f={},_0x56e081={},_0x35283d={'count':0x0,'rows':[]};var _0x4e253a=_[_0x14ee('0x31')](db['Integration'][_0x14ee('0x32')],function(_0xe73160){return{'name':_0xe73160['fieldName'],'type':_0xe73160[_0x14ee('0x33')][_0x14ee('0x34')]};});_0x56e081[_0x14ee('0x35')]=_[_0x14ee('0x31')](_0x4e253a,'name');_0x56e081[_0x14ee('0x36')]=_[_0x14ee('0x37')](_0x1e940e[_0x14ee('0x36')]);_0x56e081[_0x14ee('0x38')]=_['intersection'](_0x56e081[_0x14ee('0x35')],_0x56e081[_0x14ee('0x36')]);_0x267b1f[_0x14ee('0x39')]=_[_0x14ee('0x3a')](_0x56e081['model'],qs[_0x14ee('0x3b')](_0x1e940e['query'][_0x14ee('0x3b')]));_0x267b1f[_0x14ee('0x39')]=_0x267b1f['attributes'][_0x14ee('0x3c')]?_0x267b1f['attributes']:_0x56e081['model'];if(!_0x1e940e[_0x14ee('0x36')][_0x14ee('0x3d')](_0x14ee('0x3e'))){_0x267b1f[_0x14ee('0x1e')]=qs[_0x14ee('0x1e')](_0x1e940e['query'][_0x14ee('0x1e')]);_0x267b1f[_0x14ee('0x1c')]=qs['offset'](_0x1e940e[_0x14ee('0x36')][_0x14ee('0x1c')]);}_0x267b1f[_0x14ee('0x3f')]=qs[_0x14ee('0x40')](_0x1e940e['query'][_0x14ee('0x40')]);_0x267b1f[_0x14ee('0x41')]=qs[_0x14ee('0x38')](_['pick'](_0x1e940e['query'],_0x56e081[_0x14ee('0x38')]),_0x4e253a);if(_0x1e940e[_0x14ee('0x36')][_0x14ee('0x42')]){_0x267b1f['where']=_[_0x14ee('0x2c')](_0x267b1f[_0x14ee('0x41')],{'$or':_[_0x14ee('0x31')](_0x4e253a,function(_0x37291e){if(_0x37291e[_0x14ee('0x33')]!=='VIRTUAL'){var _0x319e90={};_0x319e90[_0x37291e[_0x14ee('0x29')]]={'$like':'%'+_0x1e940e[_0x14ee('0x36')][_0x14ee('0x42')]+'%'};return _0x319e90;}})});}_0x267b1f=_[_0x14ee('0x2c')]({},_0x267b1f,_0x1e940e[_0x14ee('0x43')]);var _0xcc884e={'where':_0x267b1f[_0x14ee('0x41')]};return db['Integration'][_0x14ee('0x1f')](_0xcc884e)['then'](function(_0x54cafb){_0x35283d[_0x14ee('0x1f')]=_0x54cafb;if(_0x1e940e[_0x14ee('0x36')][_0x14ee('0x44')]){_0x267b1f[_0x14ee('0x45')]=[{'all':!![]}];}return db[_0x14ee('0x46')][_0x14ee('0x47')](_0x267b1f);})['then'](function(_0xbc4b9e){_0x35283d['rows']=_0xbc4b9e;return _0x35283d;})['then'](respondWithFilteredResult(_0x1dde24,_0x267b1f))[_0x14ee('0x48')](handleError(_0x1dde24,null));};exports['show']=function(_0x153d64,_0x465e10){var _0x59b66c={'raw':![],'where':{'id':_0x153d64[_0x14ee('0x49')]['id']}},_0x550db0={};_0x550db0[_0x14ee('0x35')]=_[_0x14ee('0x37')](db[_0x14ee('0x46')]['rawAttributes']);_0x550db0['query']=_[_0x14ee('0x37')](_0x153d64['query']);_0x550db0[_0x14ee('0x38')]=_[_0x14ee('0x3a')](_0x550db0[_0x14ee('0x35')],_0x550db0['query']);_0x59b66c[_0x14ee('0x39')]=_['intersection'](_0x550db0[_0x14ee('0x35')],qs[_0x14ee('0x3b')](_0x153d64[_0x14ee('0x36')][_0x14ee('0x3b')]));_0x59b66c[_0x14ee('0x39')]=_0x59b66c['attributes'][_0x14ee('0x3c')]?_0x59b66c['attributes']:_0x550db0['model'];if(_0x153d64[_0x14ee('0x36')][_0x14ee('0x44')]){_0x59b66c['include']=[{'all':!![]}];}_0x59b66c=_[_0x14ee('0x2c')]({},_0x59b66c,_0x153d64[_0x14ee('0x43')]);return db[_0x14ee('0x46')][_0x14ee('0x4a')](_0x59b66c)['then'](handleEntityNotFound(_0x465e10,null))[_0x14ee('0x25')](respondWithResult(_0x465e10,null))[_0x14ee('0x48')](handleError(_0x465e10,null));};exports[_0x14ee('0x4b')]=function(_0x451030,_0xd3df43){return db[_0x14ee('0x46')][_0x14ee('0x4b')](_0x451030['body'],{})['then'](respondWithResult(_0xd3df43,0xc9))['catch'](handleError(_0xd3df43,null));};exports[_0x14ee('0x24')]=function(_0xc60cc8,_0x41f368){if(_0xc60cc8[_0x14ee('0x4c')]['id']){delete _0xc60cc8['body']['id'];}return db['Integration'][_0x14ee('0x4a')]({'where':{'id':_0xc60cc8[_0x14ee('0x49')]['id']}})[_0x14ee('0x25')](handleEntityNotFound(_0x41f368,null))['then'](saveUpdates(_0xc60cc8[_0x14ee('0x4c')],null))['then'](respondWithResult(_0x41f368,null))[_0x14ee('0x48')](handleError(_0x41f368,null));};exports['destroy']=function(_0x147aba,_0x3e54f7){return db[_0x14ee('0x46')][_0x14ee('0x4a')]({'where':{'id':_0x147aba[_0x14ee('0x49')]['id']}})[_0x14ee('0x25')](handleEntityNotFound(_0x3e54f7,null))[_0x14ee('0x25')](removeEntity(_0x3e54f7,null))[_0x14ee('0x48')](handleError(_0x3e54f7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index fc97295..fc9788b 100644 --- a/server/api/integration/integration.model.js +++ b/server/api/integration/integration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8752=['../../config/environment','exports','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x58ab17,_0x437620){var _0x1f01bc=function(_0xccc4e5){while(--_0xccc4e5){_0x58ab17['push'](_0x58ab17['shift']());}};_0x1f01bc(++_0x437620);}(_0x8752,0x173));var _0x2875=function(_0x2a1208,_0x50b11e){_0x2a1208=_0x2a1208-0x0;var _0x8f2fd4=_0x8752[_0x2a1208];return _0x8f2fd4;};'use strict';var _=require(_0x2875('0x0'));var util=require(_0x2875('0x1'));var logger=require('../../config/logger')(_0x2875('0x2'));var moment=require('moment');var BPromise=require(_0x2875('0x3'));var rp=require(_0x2875('0x4'));var fs=require('fs');var path=require(_0x2875('0x5'));var rimraf=require(_0x2875('0x6'));var config=require(_0x2875('0x7'));var attributes=require('./integration.attributes');module[_0x2875('0x8')]=function(_0x17beaa,_0x21bd50){return _0x17beaa['define']('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdce2=['exports','define','Integration','integrations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdce2,0xba));var _0x2dce=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xdce2[_0xfa634c];return _0x73e478;};'use strict';var _=require('lodash');var util=require(_0x2dce('0x0'));var logger=require(_0x2dce('0x1'))(_0x2dce('0x2'));var moment=require(_0x2dce('0x3'));var BPromise=require(_0x2dce('0x4'));var rp=require(_0x2dce('0x5'));var fs=require('fs');var path=require(_0x2dce('0x6'));var rimraf=require(_0x2dce('0x7'));var config=require(_0x2dce('0x8'));var attributes=require(_0x2dce('0x9'));module[_0x2dce('0xa')]=function(_0x597eeb,_0x1ecf4f){return _0x597eeb[_0x2dce('0xb')](_0x2dce('0xc'),attributes,{'tableName':_0x2dce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a49f681..252a30d 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cce=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','Integration,\x20%s,\x20%s','result','message','lodash','util','randomstring','ioredis'];(function(_0x28a97e,_0x200fa9){var _0x1433dc=function(_0x26a5e0){while(--_0x26a5e0){_0x28a97e['push'](_0x28a97e['shift']());}};_0x1433dc(++_0x200fa9);}(_0x8cce,0xee));var _0xe8cc=function(_0x586864,_0x101f90){_0x586864=_0x586864-0x0;var _0x31e121=_0x8cce[_0x586864];return _0x31e121;};'use strict';var _=require(_0xe8cc('0x0'));var util=require(_0xe8cc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe8cc('0x2'));var fs=require('fs');var Redis=require(_0xe8cc('0x3'));var db=require(_0xe8cc('0x4'))['db'];var utils=require(_0xe8cc('0x5'));var logger=require(_0xe8cc('0x6'))(_0xe8cc('0x7'));var config=require(_0xe8cc('0x8'));var jayson=require(_0xe8cc('0x9'));var client=jayson[_0xe8cc('0xa')][_0xe8cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33a9d5,_0x422191,_0x77ba0a){return new BPromise(function(_0x4226b7,_0x5a35e0){return client['request'](_0x33a9d5,_0x77ba0a)[_0xe8cc('0xc')](function(_0x1763d2){logger[_0xe8cc('0xd')]('Integration,\x20%s,\x20%s',_0x422191,_0xe8cc('0xe'));logger[_0xe8cc('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x422191,_0xe8cc('0xe'),JSON[_0xe8cc('0x10')](_0x1763d2));if(_0x1763d2[_0xe8cc('0x11')]){if(_0x1763d2[_0xe8cc('0x11')][_0xe8cc('0x12')]===0x1f4){logger['error'](_0xe8cc('0x13'),_0x422191,_0x1763d2[_0xe8cc('0x11')]['message']);return _0x5a35e0(_0x1763d2[_0xe8cc('0x11')]['message']);}logger[_0xe8cc('0x11')](_0xe8cc('0x13'),_0x422191,_0x1763d2[_0xe8cc('0x11')]['message']);return _0x4226b7(_0x1763d2[_0xe8cc('0x11')]['message']);}else{logger[_0xe8cc('0xd')]('Integration,\x20%s,\x20%s',_0x422191,_0xe8cc('0xe'));_0x4226b7(_0x1763d2[_0xe8cc('0x14')][_0xe8cc('0x15')]);}})['catch'](function(_0x52714c){logger[_0xe8cc('0x11')]('Integration,\x20%s,\x20%s',_0x422191,_0x52714c);_0x5a35e0(_0x52714c);});});} \ No newline at end of file +var _0xdb94=['request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Integration,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xdb94,0xe5));var _0x4db9=function(_0x55f12a,_0x553b9b){_0x55f12a=_0x55f12a-0x0;var _0x4524cc=_0xdb94[_0x55f12a];return _0x4524cc;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var moment=require(_0x4db9('0x1'));var BPromise=require('bluebird');var rs=require(_0x4db9('0x2'));var fs=require('fs');var Redis=require(_0x4db9('0x3'));var db=require(_0x4db9('0x4'))['db'];var utils=require(_0x4db9('0x5'));var logger=require(_0x4db9('0x6'))('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4db9('0x8')][_0x4db9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dddb9,_0x3404f6,_0x42a857){return new BPromise(function(_0x57c701,_0x45d5a3){return client[_0x4db9('0xa')](_0x1dddb9,_0x42a857)[_0x4db9('0xb')](function(_0x3501f9){logger[_0x4db9('0xc')]('Integration,\x20%s,\x20%s',_0x3404f6,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x3404f6,_0x4db9('0xd'),JSON[_0x4db9('0x10')](_0x3501f9));if(_0x3501f9[_0x4db9('0x11')]){if(_0x3501f9['error'][_0x4db9('0x12')]===0x1f4){logger[_0x4db9('0x11')]('Integration,\x20%s,\x20%s',_0x3404f6,_0x3501f9['error'][_0x4db9('0x13')]);return _0x45d5a3(_0x3501f9[_0x4db9('0x11')][_0x4db9('0x13')]);}logger['error'](_0x4db9('0x14'),_0x3404f6,_0x3501f9[_0x4db9('0x11')][_0x4db9('0x13')]);return _0x57c701(_0x3501f9[_0x4db9('0x11')][_0x4db9('0x13')]);}else{logger['info'](_0x4db9('0x14'),_0x3404f6,_0x4db9('0xd'));_0x57c701(_0x3501f9['result'][_0x4db9('0x13')]);}})[_0x4db9('0x15')](function(_0x42fbb8){logger['error'](_0x4db9('0x14'),_0x3404f6,_0x42fbb8);_0x45d5a3(_0x42fbb8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index ac96dab..2c1c30d 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa90f=['fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','util','connect-timeout','Router'];(function(_0x3a7398,_0x4d56a1){var _0x20e884=function(_0x526372){while(--_0x526372){_0x3a7398['push'](_0x3a7398['shift']());}};_0x20e884(++_0x4d56a1);}(_0xa90f,0x7b));var _0xfa90=function(_0x3ab53f,_0x508ae7){_0x3ab53f=_0x3ab53f-0x0;var _0x42c654=_0xa90f[_0x3ab53f];return _0x42c654;};'use strict';var multer=require('multer');var util=require(_0xfa90('0x0'));var path=require('path');var timeout=require(_0xfa90('0x1'));var express=require('express');var router=express[_0xfa90('0x2')]();var fs_extra=require(_0xfa90('0x3'));var auth=require(_0xfa90('0x4'));var interaction=require(_0xfa90('0x5'));var config=require('../../config/environment');var controller=require(_0xfa90('0x6'));router[_0xfa90('0x7')]('/',auth[_0xfa90('0x8')](),controller[_0xfa90('0x9')]);router[_0xfa90('0x7')](_0xfa90('0xa'),auth[_0xfa90('0x8')](),controller[_0xfa90('0xb')]);router[_0xfa90('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xfa90('0xc')]);router[_0xfa90('0xd')]('/',auth[_0xfa90('0x8')](),controller[_0xfa90('0xe')]);router[_0xfa90('0xf')](_0xfa90('0x10'),auth[_0xfa90('0x8')](),controller[_0xfa90('0x11')]);router['delete']('/:id',auth[_0xfa90('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x960a=['index','describe','/:id','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x960a,0x17e));var _0xa960=function(_0xeb05ea,_0x3b4ded){_0xeb05ea=_0xeb05ea-0x0;var _0x1d5dad=_0x960a[_0xeb05ea];return _0x1d5dad;};'use strict';var multer=require('multer');var util=require(_0xa960('0x0'));var path=require('path');var timeout=require(_0xa960('0x1'));var express=require('express');var router=express[_0xa960('0x2')]();var fs_extra=require(_0xa960('0x3'));var auth=require(_0xa960('0x4'));var interaction=require(_0xa960('0x5'));var config=require(_0xa960('0x6'));var controller=require('./integrationReport.controller');router[_0xa960('0x7')]('/',auth[_0xa960('0x8')](),controller[_0xa960('0x9')]);router[_0xa960('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xa960('0xa')]);router[_0xa960('0x7')](_0xa960('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa960('0x8')](),controller['create']);router[_0xa960('0xc')](_0xa960('0xb'),auth[_0xa960('0x8')](),controller[_0xa960('0xd')]);router[_0xa960('0xe')](_0xa960('0xb'),auth['isAuthenticated'](),controller[_0xa960('0xf')]);module[_0xa960('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4e704cd..af54e39 100644 --- a/server/api/integrationReport/integrationReport.attributes.js +++ b/server/api/integrationReport/integrationReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f41=['BOOLEAN','INTEGER','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING','DATE'];(function(_0x48082f,_0x531427){var _0x3b9355=function(_0x3fbb07){while(--_0x3fbb07){_0x48082f['push'](_0x48082f['shift']());}};_0x3b9355(++_0x531427);}(_0x8f41,0x8b));var _0x18f4=function(_0x1b5589,_0x460567){_0x1b5589=_0x1b5589-0x0;var _0xc935cd=_0x8f41[_0x1b5589];return _0xc935cd;};'use strict';var Sequelize=require(_0x18f4('0x0'));module[_0x18f4('0x1')]={'integration':{'type':Sequelize[_0x18f4('0x2')]},'eventChannel':{'type':Sequelize[_0x18f4('0x2')]},'exitStatus':{'type':Sequelize[_0x18f4('0x2')]},'ticketId':{'type':Sequelize[_0x18f4('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x18f4('0x2')]},'uniqueid':{'type':Sequelize[_0x18f4('0x2')]},'calleridnum':{'type':Sequelize[_0x18f4('0x2')]},'calleridname':{'type':Sequelize[_0x18f4('0x2')]},'queue':{'type':Sequelize[_0x18f4('0x2')]},'interface':{'type':Sequelize[_0x18f4('0x2')]},'membername':{'type':Sequelize[_0x18f4('0x2')]},'agentcalledAt':{'type':Sequelize[_0x18f4('0x3')]},'agentconnectAt':{'type':Sequelize[_0x18f4('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x18f4('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x18f4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x18f4('0x3')]},'agentdump':{'type':Sequelize[_0x18f4('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x18f4('0x3')]},'lastevent':{'type':Sequelize[_0x18f4('0x2')]},'channel':{'type':Sequelize[_0x18f4('0x2')]},'channelstate':{'type':Sequelize[_0x18f4('0x5')]},'channelstatedesc':{'type':Sequelize[_0x18f4('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x18f4('0x2')]},'language':{'type':Sequelize[_0x18f4('0x2')]},'accountcode':{'type':Sequelize[_0x18f4('0x2')]},'context':{'type':Sequelize[_0x18f4('0x2')]},'exten':{'type':Sequelize[_0x18f4('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x18f4('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x18f4('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x18f4('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x18f4('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x18f4('0x2')]},'destuniqueid':{'type':Sequelize[_0x18f4('0x2')]},'messageId':{'type':Sequelize[_0x18f4('0x2')]},'inReplyTo':{'type':Sequelize[_0x18f4('0x2')]},'subject':{'type':Sequelize[_0x18f4('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x18f4('0x2')]},'cc':{'type':Sequelize[_0x18f4('0x2')]},'attachment':{'type':Sequelize[_0x18f4('0x6')]},'html':{'type':Sequelize[_0x18f4('0x6')]},'text':{'type':Sequelize[_0x18f4('0x6')]},'status':{'type':Sequelize[_0x18f4('0x7')](_0x18f4('0x8'),_0x18f4('0x9'),_0x18f4('0xa'),'FAILED')},'url':{'type':Sequelize[_0x18f4('0x2')]},'app':{'type':Sequelize[_0x18f4('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x40a2=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','STRING'];(function(_0x1a430b,_0x1bbb3c){var _0x25fbe8=function(_0x785598){while(--_0x785598){_0x1a430b['push'](_0x1a430b['shift']());}};_0x25fbe8(++_0x1bbb3c);}(_0x40a2,0x94));var _0x240a=function(_0x3d65b2,_0x5b5d28){_0x3d65b2=_0x3d65b2-0x0;var _0x1628d1=_0x40a2[_0x3d65b2];return _0x1628d1;};'use strict';var Sequelize=require(_0x240a('0x0'));module['exports']={'integration':{'type':Sequelize[_0x240a('0x1')]},'eventChannel':{'type':Sequelize[_0x240a('0x1')]},'exitStatus':{'type':Sequelize[_0x240a('0x1')]},'ticketId':{'type':Sequelize[_0x240a('0x1')]},'integrationId':{'type':Sequelize[_0x240a('0x2')]},'contacts':{'type':Sequelize[_0x240a('0x1')]},'uniqueid':{'type':Sequelize[_0x240a('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x240a('0x1')]},'interface':{'type':Sequelize[_0x240a('0x1')]},'membername':{'type':Sequelize[_0x240a('0x1')]},'agentcalledAt':{'type':Sequelize[_0x240a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x240a('0x3')]},'holdtime':{'type':Sequelize[_0x240a('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x240a('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x240a('0x2')]},'reason':{'type':Sequelize[_0x240a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x240a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x240a('0x3')]},'agentdump':{'type':Sequelize[_0x240a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x240a('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x240a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x240a('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x240a('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x240a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x240a('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x240a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x240a('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x240a('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x240a('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x240a('0x1')]},'destcontext':{'type':Sequelize[_0x240a('0x1')]},'destexten':{'type':Sequelize[_0x240a('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x240a('0x1')]},'messageId':{'type':Sequelize[_0x240a('0x1')]},'inReplyTo':{'type':Sequelize[_0x240a('0x1')]},'subject':{'type':Sequelize[_0x240a('0x1')]},'from':{'type':Sequelize[_0x240a('0x1')]},'to':{'type':Sequelize[_0x240a('0x1')]},'cc':{'type':Sequelize[_0x240a('0x1')]},'attachment':{'type':Sequelize[_0x240a('0x5')]},'html':{'type':Sequelize[_0x240a('0x5')]},'text':{'type':Sequelize[_0x240a('0x5')]},'status':{'type':Sequelize[_0x240a('0x6')](_0x240a('0x7'),_0x240a('0x8'),_0x240a('0x9'),'FAILED')},'url':{'type':Sequelize[_0x240a('0x1')]},'app':{'type':Sequelize[_0x240a('0x1')]},'appdata':{'type':Sequelize[_0x240a('0x1')]},'projectId':{'type':Sequelize[_0x240a('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index dc437f7..d731a62 100644 --- a/server/api/integrationReport/integrationReport.controller.js +++ b/server/api/integrationReport/integrationReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x803c=['order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','render','merge','contact','message','agent','interaction','account','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2ab1ea,_0x1cf9bf){var _0x5dbbc5=function(_0x5bb1e4){while(--_0x5bb1e4){_0x2ab1ea['push'](_0x2ab1ea['shift']());}};_0x5dbbc5(++_0x1cf9bf);}(_0x803c,0x67));var _0xc803=function(_0x55f209,_0x500316){_0x55f209=_0x55f209-0x0;var _0x31acd1=_0x803c[_0x55f209];return _0x31acd1;};'use strict';var emlformat=require(_0xc803('0x0'));var rimraf=require(_0xc803('0x1'));var zipdir=require(_0xc803('0x2'));var jsonpatch=require(_0xc803('0x3'));var rp=require(_0xc803('0x4'));var moment=require('moment');var BPromise=require(_0xc803('0x5'));var Mustache=require(_0xc803('0x6'));var util=require('util');var path=require(_0xc803('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc803('0x8'));var fs=require('fs');var fs_extra=require(_0xc803('0x9'));var _=require(_0xc803('0xa'));var squel=require(_0xc803('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc803('0xc'));var toCsv=require(_0xc803('0xd'));var querystring=require(_0xc803('0xe'));var Papa=require(_0xc803('0xf'));var Redis=require(_0xc803('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc803('0x11'));var as=require(_0xc803('0x12'));var hardwareService=require(_0xc803('0x13'));var logger=require(_0xc803('0x14'))(_0xc803('0x15'));var utils=require('../../config/utils');var config=require(_0xc803('0x16'));var licenseUtil=require(_0xc803('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc025,_0x4975c4){_0x4975c4=_0x4975c4||0xcc;return function(_0x2288ac){if(_0x2288ac){return _0x1cc025[_0xc803('0x18')](_0x4975c4);}return _0x1cc025['status'](_0x4975c4)[_0xc803('0x19')]();};}function respondWithResult(_0x2bb6bf,_0x2f9227){_0x2f9227=_0x2f9227||0xc8;return function(_0x21ccf6){if(_0x21ccf6){return _0x2bb6bf[_0xc803('0x1a')](_0x2f9227)[_0xc803('0x1b')](_0x21ccf6);}};}function respondWithFilteredResult(_0x4c85b0,_0x4f0f26){return function(_0x35207a){if(_0x35207a){var _0x3e64b4=typeof _0x4f0f26[_0xc803('0x1c')]===_0xc803('0x1d')&&typeof _0x4f0f26[_0xc803('0x1e')]===_0xc803('0x1d');var _0x43ff72=_0x35207a[_0xc803('0x1f')];var _0x51faad=_0x3e64b4?0x0:_0x4f0f26[_0xc803('0x1c')];var _0x27f198=_0x3e64b4?_0x35207a[_0xc803('0x1f')]:_0x4f0f26[_0xc803('0x1c')]+_0x4f0f26[_0xc803('0x1e')];var _0x47284c;if(_0x27f198>=_0x43ff72){_0x27f198=_0x43ff72;_0x47284c=0xc8;}else{_0x47284c=0xce;}_0x4c85b0[_0xc803('0x1a')](_0x47284c);return _0x4c85b0[_0xc803('0x20')](_0xc803('0x21'),_0x51faad+'-'+_0x27f198+'/'+_0x43ff72)[_0xc803('0x1b')](_0x35207a);}return null;};}function patchUpdates(_0x4c5e82){return function(_0x135232){try{jsonpatch['apply'](_0x135232,_0x4c5e82,!![]);}catch(_0x1eb9fb){return BPromise[_0xc803('0x22')](_0x1eb9fb);}return _0x135232[_0xc803('0x23')]();};}function saveUpdates(_0x3b7c20,_0x2eed2c){return function(_0x3b372d){if(_0x3b372d){return _0x3b372d['update'](_0x3b7c20)[_0xc803('0x24')](function(_0x3a0420){return _0x3a0420;});}return null;};}function removeEntity(_0x6898e7,_0x507dde){return function(_0x57b42a){if(_0x57b42a){return _0x57b42a['destroy']()[_0xc803('0x24')](function(){_0x6898e7[_0xc803('0x1a')](0xcc)[_0xc803('0x19')]();});}};}function handleEntityNotFound(_0x370b6d,_0x4d0aa4){return function(_0x8f3bc9){if(!_0x8f3bc9){_0x370b6d[_0xc803('0x18')](0x194);}return _0x8f3bc9;};}function handleError(_0x3f6ee4,_0x3c8f13){_0x3c8f13=_0x3c8f13||0x1f4;return function(_0x401e20){logger[_0xc803('0x25')](_0x401e20[_0xc803('0x26')]);if(_0x401e20[_0xc803('0x27')]){delete _0x401e20[_0xc803('0x27')];}_0x3f6ee4[_0xc803('0x1a')](_0x3c8f13)[_0xc803('0x28')](_0x401e20);};}function getMustacheRender(_0x5a55a5,_0x1129a0){return Mustache[_0xc803('0x29')](_0x5a55a5,_[_0xc803('0x2a')](_0x1129a0['body'],{'contact':_0x1129a0[_0xc803('0x2b')],'message':_0x1129a0[_0xc803('0x2c')],'agent':_0x1129a0[_0xc803('0x2d')],'interaction':_0x1129a0[_0xc803('0x2e')],'account':_0x1129a0[_0xc803('0x2f')]}))||'';}exports[_0xc803('0x30')]=function(_0x44b062,_0x110693){var _0x24bc73={},_0x25f8b9={},_0x5186e2={'count':0x0,'rows':[]};var _0x2ed5e2=_[_0xc803('0x31')](db[_0xc803('0x32')][_0xc803('0x33')],function(_0x28dfd5){return{'name':_0x28dfd5[_0xc803('0x34')],'type':_0x28dfd5[_0xc803('0x35')][_0xc803('0x36')]};});_0x25f8b9[_0xc803('0x37')]=_[_0xc803('0x31')](_0x2ed5e2,_0xc803('0x27'));_0x25f8b9[_0xc803('0x38')]=_[_0xc803('0x39')](_0x44b062[_0xc803('0x38')]);_0x25f8b9[_0xc803('0x3a')]=_[_0xc803('0x3b')](_0x25f8b9[_0xc803('0x37')],_0x25f8b9[_0xc803('0x38')]);_0x24bc73[_0xc803('0x3c')]=_['intersection'](_0x25f8b9[_0xc803('0x37')],qs[_0xc803('0x3d')](_0x44b062[_0xc803('0x38')][_0xc803('0x3d')]));_0x24bc73[_0xc803('0x3c')]=_0x24bc73['attributes'][_0xc803('0x3e')]?_0x24bc73[_0xc803('0x3c')]:_0x25f8b9['model'];if(!_0x44b062[_0xc803('0x38')][_0xc803('0x3f')](_0xc803('0x40'))){_0x24bc73[_0xc803('0x1e')]=qs['limit'](_0x44b062[_0xc803('0x38')]['limit']);_0x24bc73['offset']=qs[_0xc803('0x1c')](_0x44b062[_0xc803('0x38')][_0xc803('0x1c')]);}_0x24bc73[_0xc803('0x41')]=qs['sort'](_0x44b062['query'][_0xc803('0x42')]);_0x24bc73[_0xc803('0x43')]=qs[_0xc803('0x3a')](_[_0xc803('0x44')](_0x44b062['query'],_0x25f8b9[_0xc803('0x3a')]),_0x2ed5e2);if(_0x44b062[_0xc803('0x38')][_0xc803('0x45')]){_0x24bc73['where']=_[_0xc803('0x2a')](_0x24bc73[_0xc803('0x43')],{'$or':_['map'](_0x2ed5e2,function(_0x5297d1){if(_0x5297d1[_0xc803('0x35')]!=='VIRTUAL'){var _0x51529c={};_0x51529c[_0x5297d1[_0xc803('0x27')]]={'$like':'%'+_0x44b062[_0xc803('0x38')]['filter']+'%'};return _0x51529c;}})});}_0x24bc73=_[_0xc803('0x2a')]({},_0x24bc73,_0x44b062[_0xc803('0x46')]);var _0x5c6a3d={'where':_0x24bc73['where']};return db['IntegrationReport']['count'](_0x5c6a3d)['then'](function(_0x105dc2){_0x5186e2[_0xc803('0x1f')]=_0x105dc2;if(_0x44b062[_0xc803('0x38')][_0xc803('0x47')]){_0x24bc73[_0xc803('0x48')]=[{'all':!![]}];}return db[_0xc803('0x32')][_0xc803('0x49')](_0x24bc73);})[_0xc803('0x24')](function(_0x3af255){_0x5186e2[_0xc803('0x4a')]=_0x3af255;return _0x5186e2;})[_0xc803('0x24')](respondWithFilteredResult(_0x110693,_0x24bc73))[_0xc803('0x4b')](handleError(_0x110693,null));};exports[_0xc803('0x4c')]=function(_0x42aca3,_0x3dca9e){var _0x304b4c={'raw':![],'where':{'id':_0x42aca3['params']['id']}},_0x69379={};_0x69379[_0xc803('0x37')]=_[_0xc803('0x39')](db[_0xc803('0x32')][_0xc803('0x33')]);_0x69379[_0xc803('0x38')]=_[_0xc803('0x39')](_0x42aca3['query']);_0x69379[_0xc803('0x3a')]=_[_0xc803('0x3b')](_0x69379['model'],_0x69379[_0xc803('0x38')]);_0x304b4c[_0xc803('0x3c')]=_[_0xc803('0x3b')](_0x69379[_0xc803('0x37')],qs[_0xc803('0x3d')](_0x42aca3[_0xc803('0x38')][_0xc803('0x3d')]));_0x304b4c[_0xc803('0x3c')]=_0x304b4c[_0xc803('0x3c')][_0xc803('0x3e')]?_0x304b4c[_0xc803('0x3c')]:_0x69379[_0xc803('0x37')];if(_0x42aca3[_0xc803('0x38')][_0xc803('0x47')]){_0x304b4c[_0xc803('0x48')]=[{'all':!![]}];}_0x304b4c=_['merge']({},_0x304b4c,_0x42aca3[_0xc803('0x46')]);return db[_0xc803('0x32')][_0xc803('0x4d')](_0x304b4c)['then'](handleEntityNotFound(_0x3dca9e,null))[_0xc803('0x24')](respondWithResult(_0x3dca9e,null))[_0xc803('0x4b')](handleError(_0x3dca9e,null));};exports[_0xc803('0x4e')]=function(_0x5b005b,_0x4f53b8){return db[_0xc803('0x32')][_0xc803('0x4e')](_0x5b005b[_0xc803('0x4f')],{})[_0xc803('0x24')](respondWithResult(_0x4f53b8,0xc9))[_0xc803('0x4b')](handleError(_0x4f53b8,null));};exports[_0xc803('0x50')]=function(_0x1c13fb,_0x2e2803){if(_0x1c13fb[_0xc803('0x4f')]['id']){delete _0x1c13fb[_0xc803('0x4f')]['id'];}return db[_0xc803('0x32')]['find']({'where':{'id':_0x1c13fb[_0xc803('0x51')]['id']}})[_0xc803('0x24')](handleEntityNotFound(_0x2e2803,null))[_0xc803('0x24')](saveUpdates(_0x1c13fb[_0xc803('0x4f')],null))[_0xc803('0x24')](respondWithResult(_0x2e2803,null))[_0xc803('0x4b')](handleError(_0x2e2803,null));};exports[_0xc803('0x52')]=function(_0x11698f,_0x52bfbc){return db[_0xc803('0x32')][_0xc803('0x4d')]({'where':{'id':_0x11698f[_0xc803('0x51')]['id']}})['then'](handleEntityNotFound(_0x52bfbc,null))[_0xc803('0x24')](removeEntity(_0x52bfbc,null))[_0xc803('0x4b')](handleError(_0x52bfbc,null));};exports['describe']=function(_0x1c7e54,_0x52836b){return db[_0xc803('0x32')][_0xc803('0x53')]()[_0xc803('0x24')](respondWithResult(_0x52836b,null))[_0xc803('0x4b')](handleError(_0x52836b,null));}; \ No newline at end of file +var _0xdb9c=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','sendStatus','error','stack','name','send','render','merge','body','message','agent','interaction','account','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv'];(function(_0x1abfb7,_0x4150ac){var _0x1fc956=function(_0xbe063e){while(--_0xbe063e){_0x1abfb7['push'](_0x1abfb7['shift']());}};_0x1fc956(++_0x4150ac);}(_0xdb9c,0x1d7));var _0xcdb9=function(_0x32a10b,_0x5acfd0){_0x32a10b=_0x32a10b-0x0;var _0x2280b5=_0xdb9c[_0x32a10b];return _0x2280b5;};'use strict';var emlformat=require(_0xcdb9('0x0'));var rimraf=require(_0xcdb9('0x1'));var zipdir=require(_0xcdb9('0x2'));var jsonpatch=require(_0xcdb9('0x3'));var rp=require('request-promise');var moment=require(_0xcdb9('0x4'));var BPromise=require(_0xcdb9('0x5'));var Mustache=require(_0xcdb9('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcdb9('0x7'));var csv=require(_0xcdb9('0x8'));var ejs=require(_0xcdb9('0x9'));var fs=require('fs');var fs_extra=require(_0xcdb9('0xa'));var _=require(_0xcdb9('0xb'));var squel=require(_0xcdb9('0xc'));var crypto=require(_0xcdb9('0xd'));var jsforce=require(_0xcdb9('0xe'));var deskjs=require(_0xcdb9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcdb9('0x10'));var Papa=require('papaparse');var Redis=require(_0xcdb9('0x11'));var authService=require(_0xcdb9('0x12'));var qs=require(_0xcdb9('0x13'));var as=require(_0xcdb9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdb9('0x15'))('api');var utils=require(_0xcdb9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcdb9('0x17'))['db'];function respondWithStatusCode(_0x3c2277,_0x5d59d3){_0x5d59d3=_0x5d59d3||0xcc;return function(_0x26ffe5){if(_0x26ffe5){return _0x3c2277['sendStatus'](_0x5d59d3);}return _0x3c2277[_0xcdb9('0x18')](_0x5d59d3)[_0xcdb9('0x19')]();};}function respondWithResult(_0xac2121,_0x35f872){_0x35f872=_0x35f872||0xc8;return function(_0x5a7a6b){if(_0x5a7a6b){return _0xac2121[_0xcdb9('0x18')](_0x35f872)[_0xcdb9('0x1a')](_0x5a7a6b);}};}function respondWithFilteredResult(_0xc85555,_0x84ea45){return function(_0x51468d){if(_0x51468d){var _0x24f683=typeof _0x84ea45['offset']===_0xcdb9('0x1b')&&typeof _0x84ea45[_0xcdb9('0x1c')]===_0xcdb9('0x1b');var _0x166c61=_0x51468d[_0xcdb9('0x1d')];var _0x1a4c0c=_0x24f683?0x0:_0x84ea45['offset'];var _0x52ef5a=_0x24f683?_0x51468d[_0xcdb9('0x1d')]:_0x84ea45[_0xcdb9('0x1e')]+_0x84ea45[_0xcdb9('0x1c')];var _0x32d65c;if(_0x52ef5a>=_0x166c61){_0x52ef5a=_0x166c61;_0x32d65c=0xc8;}else{_0x32d65c=0xce;}_0xc85555['status'](_0x32d65c);return _0xc85555['set'](_0xcdb9('0x1f'),_0x1a4c0c+'-'+_0x52ef5a+'/'+_0x166c61)['json'](_0x51468d);}return null;};}function patchUpdates(_0x1af681){return function(_0x138219){try{jsonpatch['apply'](_0x138219,_0x1af681,!![]);}catch(_0x3ea73c){return BPromise[_0xcdb9('0x20')](_0x3ea73c);}return _0x138219['save']();};}function saveUpdates(_0x3828c3,_0x4f9f84){return function(_0x492f59){if(_0x492f59){return _0x492f59[_0xcdb9('0x21')](_0x3828c3)[_0xcdb9('0x22')](function(_0x44c0d1){return _0x44c0d1;});}return null;};}function removeEntity(_0x21435b,_0x2728e9){return function(_0x5e48d4){if(_0x5e48d4){return _0x5e48d4['destroy']()[_0xcdb9('0x22')](function(){_0x21435b[_0xcdb9('0x18')](0xcc)[_0xcdb9('0x19')]();});}};}function handleEntityNotFound(_0xf329f5,_0x439d52){return function(_0x3db30f){if(!_0x3db30f){_0xf329f5[_0xcdb9('0x23')](0x194);}return _0x3db30f;};}function handleError(_0x4fb88f,_0x1ca085){_0x1ca085=_0x1ca085||0x1f4;return function(_0x500240){logger[_0xcdb9('0x24')](_0x500240[_0xcdb9('0x25')]);if(_0x500240[_0xcdb9('0x26')]){delete _0x500240[_0xcdb9('0x26')];}_0x4fb88f[_0xcdb9('0x18')](_0x1ca085)[_0xcdb9('0x27')](_0x500240);};}function getMustacheRender(_0x40920b,_0x41aa7b){return Mustache[_0xcdb9('0x28')](_0x40920b,_[_0xcdb9('0x29')](_0x41aa7b[_0xcdb9('0x2a')],{'contact':_0x41aa7b['contact'],'message':_0x41aa7b[_0xcdb9('0x2b')],'agent':_0x41aa7b[_0xcdb9('0x2c')],'interaction':_0x41aa7b[_0xcdb9('0x2d')],'account':_0x41aa7b[_0xcdb9('0x2e')]}))||'';}exports[_0xcdb9('0x2f')]=function(_0x502715,_0x49e2a7){var _0x12fc46={},_0x547902={},_0x3b6719={'count':0x0,'rows':[]};var _0x41fa13=_[_0xcdb9('0x30')](db['IntegrationReport']['rawAttributes'],function(_0x136a60){return{'name':_0x136a60[_0xcdb9('0x31')],'type':_0x136a60['type'][_0xcdb9('0x32')]};});_0x547902['model']=_[_0xcdb9('0x30')](_0x41fa13,'name');_0x547902[_0xcdb9('0x33')]=_[_0xcdb9('0x34')](_0x502715[_0xcdb9('0x33')]);_0x547902[_0xcdb9('0x35')]=_[_0xcdb9('0x36')](_0x547902[_0xcdb9('0x37')],_0x547902[_0xcdb9('0x33')]);_0x12fc46[_0xcdb9('0x38')]=_[_0xcdb9('0x36')](_0x547902['model'],qs[_0xcdb9('0x39')](_0x502715[_0xcdb9('0x33')][_0xcdb9('0x39')]));_0x12fc46[_0xcdb9('0x38')]=_0x12fc46[_0xcdb9('0x38')]['length']?_0x12fc46[_0xcdb9('0x38')]:_0x547902[_0xcdb9('0x37')];if(!_0x502715[_0xcdb9('0x33')][_0xcdb9('0x3a')](_0xcdb9('0x3b'))){_0x12fc46[_0xcdb9('0x1c')]=qs[_0xcdb9('0x1c')](_0x502715[_0xcdb9('0x33')]['limit']);_0x12fc46[_0xcdb9('0x1e')]=qs[_0xcdb9('0x1e')](_0x502715['query'][_0xcdb9('0x1e')]);}_0x12fc46[_0xcdb9('0x3c')]=qs[_0xcdb9('0x3d')](_0x502715[_0xcdb9('0x33')]['sort']);_0x12fc46[_0xcdb9('0x3e')]=qs['filters'](_['pick'](_0x502715[_0xcdb9('0x33')],_0x547902[_0xcdb9('0x35')]),_0x41fa13);if(_0x502715['query'][_0xcdb9('0x3f')]){_0x12fc46[_0xcdb9('0x3e')]=_[_0xcdb9('0x29')](_0x12fc46[_0xcdb9('0x3e')],{'$or':_[_0xcdb9('0x30')](_0x41fa13,function(_0x287d93){if(_0x287d93[_0xcdb9('0x40')]!==_0xcdb9('0x41')){var _0x5dc31={};_0x5dc31[_0x287d93[_0xcdb9('0x26')]]={'$like':'%'+_0x502715[_0xcdb9('0x33')][_0xcdb9('0x3f')]+'%'};return _0x5dc31;}})});}_0x12fc46=_[_0xcdb9('0x29')]({},_0x12fc46,_0x502715[_0xcdb9('0x42')]);var _0x4d721c={'where':_0x12fc46[_0xcdb9('0x3e')]};return db[_0xcdb9('0x43')][_0xcdb9('0x1d')](_0x4d721c)[_0xcdb9('0x22')](function(_0x36caec){_0x3b6719[_0xcdb9('0x1d')]=_0x36caec;if(_0x502715['query'][_0xcdb9('0x44')]){_0x12fc46[_0xcdb9('0x45')]=[{'all':!![]}];}return db['IntegrationReport'][_0xcdb9('0x46')](_0x12fc46);})['then'](function(_0x43ed13){_0x3b6719['rows']=_0x43ed13;return _0x3b6719;})['then'](respondWithFilteredResult(_0x49e2a7,_0x12fc46))[_0xcdb9('0x47')](handleError(_0x49e2a7,null));};exports[_0xcdb9('0x48')]=function(_0x2ffac6,_0x1f9ea3){var _0x528943={'raw':![],'where':{'id':_0x2ffac6[_0xcdb9('0x49')]['id']}},_0x2f349c={};_0x2f349c['model']=_[_0xcdb9('0x34')](db[_0xcdb9('0x43')][_0xcdb9('0x4a')]);_0x2f349c[_0xcdb9('0x33')]=_[_0xcdb9('0x34')](_0x2ffac6[_0xcdb9('0x33')]);_0x2f349c['filters']=_[_0xcdb9('0x36')](_0x2f349c[_0xcdb9('0x37')],_0x2f349c[_0xcdb9('0x33')]);_0x528943['attributes']=_[_0xcdb9('0x36')](_0x2f349c[_0xcdb9('0x37')],qs[_0xcdb9('0x39')](_0x2ffac6[_0xcdb9('0x33')]['fields']));_0x528943['attributes']=_0x528943['attributes'][_0xcdb9('0x4b')]?_0x528943['attributes']:_0x2f349c['model'];if(_0x2ffac6[_0xcdb9('0x33')]['includeAll']){_0x528943[_0xcdb9('0x45')]=[{'all':!![]}];}_0x528943=_['merge']({},_0x528943,_0x2ffac6[_0xcdb9('0x42')]);return db[_0xcdb9('0x43')]['find'](_0x528943)[_0xcdb9('0x22')](handleEntityNotFound(_0x1f9ea3,null))[_0xcdb9('0x22')](respondWithResult(_0x1f9ea3,null))[_0xcdb9('0x47')](handleError(_0x1f9ea3,null));};exports[_0xcdb9('0x4c')]=function(_0x1de2aa,_0x197087){return db[_0xcdb9('0x43')][_0xcdb9('0x4c')](_0x1de2aa[_0xcdb9('0x2a')],{})[_0xcdb9('0x22')](respondWithResult(_0x197087,0xc9))[_0xcdb9('0x47')](handleError(_0x197087,null));};exports[_0xcdb9('0x21')]=function(_0x33b44a,_0x3f06cf){if(_0x33b44a[_0xcdb9('0x2a')]['id']){delete _0x33b44a['body']['id'];}return db[_0xcdb9('0x43')][_0xcdb9('0x4d')]({'where':{'id':_0x33b44a[_0xcdb9('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f06cf,null))[_0xcdb9('0x22')](saveUpdates(_0x33b44a['body'],null))[_0xcdb9('0x22')](respondWithResult(_0x3f06cf,null))[_0xcdb9('0x47')](handleError(_0x3f06cf,null));};exports[_0xcdb9('0x4e')]=function(_0x52d789,_0x40c387){return db['IntegrationReport'][_0xcdb9('0x4d')]({'where':{'id':_0x52d789[_0xcdb9('0x49')]['id']}})['then'](handleEntityNotFound(_0x40c387,null))[_0xcdb9('0x22')](removeEntity(_0x40c387,null))[_0xcdb9('0x47')](handleError(_0x40c387,null));};exports[_0xcdb9('0x4f')]=function(_0xa6ef4f,_0x30e6ef){return db['IntegrationReport'][_0xcdb9('0x4f')]()[_0xcdb9('0x22')](respondWithResult(_0x30e6ef,null))[_0xcdb9('0x47')](handleError(_0x30e6ef,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 55f4d4b..cbb7b2e 100644 --- a/server/api/integrationReport/integrationReport.model.js +++ b/server/api/integrationReport/integrationReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39e6=['define','IntegrationReport','report_integration','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x39e6,0x7b));var _0x639e=function(_0x32a202,_0x51052a){_0x32a202=_0x32a202-0x0;var _0x141ab6=_0x39e6[_0x32a202];return _0x141ab6;};'use strict';var _=require('lodash');var util=require(_0x639e('0x0'));var logger=require('../../config/logger')(_0x639e('0x1'));var moment=require(_0x639e('0x2'));var BPromise=require(_0x639e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x639e('0x4'));var rimraf=require('rimraf');var config=require(_0x639e('0x5'));var attributes=require('./integrationReport.attributes');module[_0x639e('0x6')]=function(_0x25f2fe,_0x2fb0a4){return _0x25f2fe[_0x639e('0x7')](_0x639e('0x8'),attributes,{'tableName':_0x639e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f85=['lodash','util','../../config/logger','api','moment','request-promise','path','./integrationReport.attributes','report_integration'];(function(_0x44f5fb,_0x57da55){var _0x5df4ce=function(_0xb1f0f8){while(--_0xb1f0f8){_0x44f5fb['push'](_0x44f5fb['shift']());}};_0x5df4ce(++_0x57da55);}(_0x0f85,0xfc));var _0x50f8=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0f85[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x50f8('0x0'));var util=require(_0x50f8('0x1'));var logger=require(_0x50f8('0x2'))(_0x50f8('0x3'));var moment=require(_0x50f8('0x4'));var BPromise=require('bluebird');var rp=require(_0x50f8('0x5'));var fs=require('fs');var path=require(_0x50f8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x50f8('0x7'));module['exports']=function(_0x4b65f4,_0x25b914){return _0x4b65f4['define']('IntegrationReport',attributes,{'tableName':_0x50f8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 334f794..da77334 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0xfe9583,_0x96603b){var _0x2c212d=function(_0x17b02c){while(--_0x17b02c){_0xfe9583['push'](_0xfe9583['shift']());}};_0x2c212d(++_0x96603b);}(_0x2032,0xd9));var _0x2203=function(_0xd00e5b,_0x178ae6){_0xd00e5b=_0xd00e5b-0x0;var _0x495b19=_0x2032[_0xd00e5b];return _0x495b19;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index bdd1378..d465963 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6a5=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xe6a5,0x13b));var _0x5e6a=function(_0x2171eb,_0x56d6b7){_0x2171eb=_0x2171eb-0x0;var _0x35c9fc=_0xe6a5[_0x2171eb];return _0x35c9fc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5e6a('0x0'));var express=require(_0x5e6a('0x1'));var router=express[_0x5e6a('0x2')]();var fs_extra=require(_0x5e6a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5e6a('0x4'));var config=require('../../config/environment');var controller=require(_0x5e6a('0x5'));router[_0x5e6a('0x6')]('/',auth[_0x5e6a('0x7')](),controller[_0x5e6a('0x8')]);router[_0x5e6a('0x6')](_0x5e6a('0x9'),auth[_0x5e6a('0x7')](),controller[_0x5e6a('0xa')]);router[_0x5e6a('0x6')](_0x5e6a('0xb'),auth[_0x5e6a('0x7')](),controller['getIntervals']);router[_0x5e6a('0xc')]('/',auth['isAuthenticated'](),controller[_0x5e6a('0xd')]);router[_0x5e6a('0xc')]('/:id/sub_intervals',auth[_0x5e6a('0x7')](),controller[_0x5e6a('0xe')]);router[_0x5e6a('0xc')](_0x5e6a('0xf'),auth[_0x5e6a('0x7')](),controller[_0x5e6a('0x10')]);router[_0x5e6a('0x11')](_0x5e6a('0x9'),auth['isAuthenticated'](),controller[_0x5e6a('0x12')]);router[_0x5e6a('0x13')](_0x5e6a('0x9'),auth[_0x5e6a('0x7')](),controller['destroy']);module[_0x5e6a('0x14')]=router; \ No newline at end of file +var _0x5272=['addIntervals','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x5272,0xde));var _0x2527=function(_0x3ccac4,_0x316445){_0x3ccac4=_0x3ccac4-0x0;var _0x564ec0=_0x5272[_0x3ccac4];return _0x564ec0;};'use strict';var multer=require('multer');var util=require(_0x2527('0x0'));var path=require(_0x2527('0x1'));var timeout=require(_0x2527('0x2'));var express=require(_0x2527('0x3'));var router=express[_0x2527('0x4')]();var fs_extra=require(_0x2527('0x5'));var auth=require(_0x2527('0x6'));var interaction=require(_0x2527('0x7'));var config=require(_0x2527('0x8'));var controller=require(_0x2527('0x9'));router[_0x2527('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x2527('0xb')](),controller[_0x2527('0xc')]);router[_0x2527('0xa')](_0x2527('0xd'),auth['isAuthenticated'](),controller[_0x2527('0xe')]);router[_0x2527('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2527('0xf')](_0x2527('0xd'),auth['isAuthenticated'](),controller[_0x2527('0x10')]);router[_0x2527('0xf')](_0x2527('0x11'),auth['isAuthenticated'](),controller[_0x2527('0x12')]);router['put']('/:id',auth[_0x2527('0xb')](),controller[_0x2527('0x13')]);router[_0x2527('0x14')](_0x2527('0x15'),auth[_0x2527('0xb')](),controller[_0x2527('0x16')]);module[_0x2527('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 588f91e..2a43ab9 100644 --- a/server/api/interval/interval.attributes.js +++ b/server/api/interval/interval.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0efb=['exports','STRING','sequelize'];(function(_0x3776b4,_0x19a1e3){var _0x1636d9=function(_0x320ae3){while(--_0x320ae3){_0x3776b4['push'](_0x3776b4['shift']());}};_0x1636d9(++_0x19a1e3);}(_0x0efb,0x1c7));var _0xb0ef=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x0efb[_0x8c8176];return _0x4dc47b;};'use strict';var Sequelize=require(_0xb0ef('0x0'));module[_0xb0ef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0ef('0x2')]},'interval':{'type':Sequelize[_0xb0ef('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf20b=['exports','STRING','sequelize'];(function(_0xf48a5,_0x2f029e){var _0x3d959e=function(_0x33a88d){while(--_0x33a88d){_0xf48a5['push'](_0xf48a5['shift']());}};_0x3d959e(++_0x2f029e);}(_0xf20b,0x8c));var _0xbf20=function(_0x5005d3,_0x31bd16){_0x5005d3=_0x5005d3-0x0;var _0x3ab2ce=_0xf20b[_0x5005d3];return _0x3ab2ce;};'use strict';var Sequelize=require(_0xbf20('0x0'));module[_0xbf20('0x1')]={'name':{'type':Sequelize[_0xbf20('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 85cb307..0e5a311 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd1f=['save','destroy','then','get','Intervals','UserProfileResource','end','error','stack','name','render','merge','body','contact','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','Interval','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','addInterval','IntervalId','nolimit','addIntervals','findOne','sequelize','transaction','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd1f,0x1be));var _0xffd1=function(_0x4d3983,_0x435738){_0x4d3983=_0x4d3983-0x0;var _0xc7a65e=_0xfd1f[_0x4d3983];return _0xc7a65e;};'use strict';var emlformat=require(_0xffd1('0x0'));var rimraf=require(_0xffd1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffd1('0x2'));var rp=require(_0xffd1('0x3'));var moment=require('moment');var BPromise=require(_0xffd1('0x4'));var Mustache=require(_0xffd1('0x5'));var util=require(_0xffd1('0x6'));var path=require(_0xffd1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xffd1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffd1('0x9'));var squel=require(_0xffd1('0xa'));var crypto=require('crypto');var jsforce=require(_0xffd1('0xb'));var deskjs=require(_0xffd1('0xc'));var toCsv=require(_0xffd1('0xd'));var querystring=require('querystring');var Papa=require(_0xffd1('0xe'));var Redis=require('ioredis');var authService=require(_0xffd1('0xf'));var qs=require(_0xffd1('0x10'));var as=require(_0xffd1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffd1('0x12'))(_0xffd1('0x13'));var utils=require(_0xffd1('0x14'));var config=require(_0xffd1('0x15'));var licenseUtil=require(_0xffd1('0x16'));var db=require(_0xffd1('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3cb4b4,_0x4b1802){_0x4b1802=_0x4b1802||0xcc;return function(_0x693de8){if(_0x693de8){return _0x3cb4b4[_0xffd1('0x18')](_0x4b1802);}return _0x3cb4b4['status'](_0x4b1802)['end']();};}function respondWithResult(_0x545501,_0x119bd1){_0x119bd1=_0x119bd1||0xc8;return function(_0x5f5c9f){if(_0x5f5c9f){return _0x545501[_0xffd1('0x19')](_0x119bd1)[_0xffd1('0x1a')](_0x5f5c9f);}};}function respondWithFilteredResult(_0x57e56b,_0x5e803e){return function(_0x47df47){if(_0x47df47){var _0x416152=typeof _0x5e803e[_0xffd1('0x1b')]===_0xffd1('0x1c')&&typeof _0x5e803e[_0xffd1('0x1d')]===_0xffd1('0x1c');var _0x229bb5=_0x47df47['count'];var _0x463db0=_0x416152?0x0:_0x5e803e['offset'];var _0x2e4742=_0x416152?_0x47df47[_0xffd1('0x1e')]:_0x5e803e[_0xffd1('0x1b')]+_0x5e803e[_0xffd1('0x1d')];var _0x29c8ec;if(_0x2e4742>=_0x229bb5){_0x2e4742=_0x229bb5;_0x29c8ec=0xc8;}else{_0x29c8ec=0xce;}_0x57e56b[_0xffd1('0x19')](_0x29c8ec);return _0x57e56b['set'](_0xffd1('0x1f'),_0x463db0+'-'+_0x2e4742+'/'+_0x229bb5)[_0xffd1('0x1a')](_0x47df47);}return null;};}function patchUpdates(_0x7e19fa){return function(_0xac5657){try{jsonpatch[_0xffd1('0x20')](_0xac5657,_0x7e19fa,!![]);}catch(_0x17f9ea){return BPromise[_0xffd1('0x21')](_0x17f9ea);}return _0xac5657[_0xffd1('0x22')]();};}function saveUpdates(_0x51993b,_0x172769){return function(_0x4405bd){if(_0x4405bd){return _0x4405bd['update'](_0x51993b)['then'](function(_0x58d884){return _0x58d884;});}return null;};}function removeEntity(_0x324acd,_0x88eef5){return function(_0xa49331){if(_0xa49331){return _0xa49331[_0xffd1('0x23')]()[_0xffd1('0x24')](function(){var _0x3a7eaf=_0xa49331[_0xffd1('0x25')]({'plain':!![]});var _0x5bfefa=_0xffd1('0x26');return db[_0xffd1('0x27')][_0xffd1('0x23')]({'where':{'type':_0x5bfefa,'resourceId':_0x3a7eaf['id']}})[_0xffd1('0x24')](function(){return _0xa49331;});})[_0xffd1('0x24')](function(){_0x324acd['status'](0xcc)[_0xffd1('0x28')]();});}};}function handleEntityNotFound(_0x1a216a,_0x2a2501){return function(_0x1deeef){if(!_0x1deeef){_0x1a216a[_0xffd1('0x18')](0x194);}return _0x1deeef;};}function handleError(_0x3d98a8,_0x47a898){_0x47a898=_0x47a898||0x1f4;return function(_0x23d3e3){logger[_0xffd1('0x29')](_0x23d3e3[_0xffd1('0x2a')]);if(_0x23d3e3[_0xffd1('0x2b')]){delete _0x23d3e3[_0xffd1('0x2b')];}_0x3d98a8[_0xffd1('0x19')](_0x47a898)['send'](_0x23d3e3);};}function getMustacheRender(_0x5b42a9,_0xcf462b){return Mustache[_0xffd1('0x2c')](_0x5b42a9,_[_0xffd1('0x2d')](_0xcf462b[_0xffd1('0x2e')],{'contact':_0xcf462b[_0xffd1('0x2f')],'message':_0xcf462b[_0xffd1('0x30')],'agent':_0xcf462b[_0xffd1('0x31')],'interaction':_0xcf462b[_0xffd1('0x32')],'account':_0xcf462b[_0xffd1('0x33')]}))||'';}exports[_0xffd1('0x34')]=function(_0x4fc851,_0x3f0233){var _0x4f05c8={},_0x2c469b={},_0x2e616d={'count':0x0,'rows':[]};var _0xda9362=_[_0xffd1('0x35')](db['Interval'][_0xffd1('0x36')],function(_0x644cbd){return{'name':_0x644cbd[_0xffd1('0x37')],'type':_0x644cbd[_0xffd1('0x38')]['key']};});_0x2c469b[_0xffd1('0x39')]=_[_0xffd1('0x35')](_0xda9362,_0xffd1('0x2b'));_0x2c469b[_0xffd1('0x3a')]=_[_0xffd1('0x3b')](_0x4fc851[_0xffd1('0x3a')]);_0x2c469b[_0xffd1('0x3c')]=_['intersection'](_0x2c469b[_0xffd1('0x39')],_0x2c469b[_0xffd1('0x3a')]);_0x4f05c8[_0xffd1('0x3d')]=_['intersection'](_0x2c469b['model'],qs[_0xffd1('0x3e')](_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x3e')]));_0x4f05c8['attributes']=_0x4f05c8['attributes'][_0xffd1('0x3f')]?_0x4f05c8[_0xffd1('0x3d')]:_0x2c469b[_0xffd1('0x39')];if(!_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x40')]('nolimit')){_0x4f05c8[_0xffd1('0x1d')]=qs[_0xffd1('0x1d')](_0x4fc851[_0xffd1('0x3a')]['limit']);_0x4f05c8[_0xffd1('0x1b')]=qs[_0xffd1('0x1b')](_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x1b')]);}_0x4f05c8[_0xffd1('0x41')]=qs[_0xffd1('0x42')](_0x4fc851['query']['sort']);_0x4f05c8[_0xffd1('0x43')]=qs[_0xffd1('0x3c')](_[_0xffd1('0x44')](_0x4fc851[_0xffd1('0x3a')],_0x2c469b[_0xffd1('0x3c')]),_0xda9362);if(_0x4fc851[_0xffd1('0x3a')]['filter']){_0x4f05c8['where']=_[_0xffd1('0x2d')](_0x4f05c8['where'],{'$or':_[_0xffd1('0x35')](_0xda9362,function(_0x535c4c){if(_0x535c4c[_0xffd1('0x38')]!=='VIRTUAL'){var _0x2fdeee={};_0x2fdeee[_0x535c4c[_0xffd1('0x2b')]]={'$like':'%'+_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x45')]+'%'};return _0x2fdeee;}})});}_0x4f05c8=_[_0xffd1('0x2d')]({},_0x4f05c8,_0x4fc851[_0xffd1('0x46')]);var _0x585e7b={'where':_0x4f05c8['where']};return db['Interval'][_0xffd1('0x1e')](_0x585e7b)[_0xffd1('0x24')](function(_0x550dfb){_0x2e616d[_0xffd1('0x1e')]=_0x550dfb;if(_0x4fc851[_0xffd1('0x3a')][_0xffd1('0x47')]){_0x4f05c8[_0xffd1('0x48')]=[{'all':!![]}];}return db['Interval'][_0xffd1('0x49')](_0x4f05c8);})[_0xffd1('0x24')](function(_0x4b494f){_0x2e616d[_0xffd1('0x4a')]=_0x4b494f;return _0x2e616d;})[_0xffd1('0x24')](respondWithFilteredResult(_0x3f0233,_0x4f05c8))[_0xffd1('0x4b')](handleError(_0x3f0233,null));};exports[_0xffd1('0x4c')]=function(_0x43b5d1,_0x3ca637){var _0x3cc862={'raw':!![],'where':{'id':_0x43b5d1[_0xffd1('0x4d')]['id']}},_0x3fee86={};_0x3fee86[_0xffd1('0x39')]=_[_0xffd1('0x3b')](db['Interval']['rawAttributes']);_0x3fee86[_0xffd1('0x3a')]=_['keys'](_0x43b5d1[_0xffd1('0x3a')]);_0x3fee86[_0xffd1('0x3c')]=_[_0xffd1('0x4e')](_0x3fee86[_0xffd1('0x39')],_0x3fee86[_0xffd1('0x3a')]);_0x3cc862['attributes']=_[_0xffd1('0x4e')](_0x3fee86[_0xffd1('0x39')],qs[_0xffd1('0x3e')](_0x43b5d1[_0xffd1('0x3a')]['fields']));_0x3cc862[_0xffd1('0x3d')]=_0x3cc862[_0xffd1('0x3d')][_0xffd1('0x3f')]?_0x3cc862[_0xffd1('0x3d')]:_0x3fee86['model'];if(_0x43b5d1['query'][_0xffd1('0x47')]){_0x3cc862[_0xffd1('0x48')]=[{'all':!![]}];}_0x3cc862=_[_0xffd1('0x2d')]({},_0x3cc862,_0x43b5d1[_0xffd1('0x46')]);return db['Interval'][_0xffd1('0x4f')](_0x3cc862)[_0xffd1('0x24')](handleEntityNotFound(_0x3ca637,null))[_0xffd1('0x24')](respondWithResult(_0x3ca637,null))[_0xffd1('0x4b')](handleError(_0x3ca637,null));};exports[_0xffd1('0x50')]=function(_0x44dcb8,_0x4dfd4e){return db[_0xffd1('0x51')]['create'](_0x44dcb8[_0xffd1('0x2e')],{})[_0xffd1('0x24')](function(_0x381b6f){var _0x4f1430=_0x44dcb8[_0xffd1('0x52')]['get']({'plain':!![]});if(!_0x4f1430)throw new Error(_0xffd1('0x53'));if(_0x4f1430[_0xffd1('0x54')]===_0xffd1('0x52')){var _0x388d32=_0x381b6f[_0xffd1('0x25')]({'plain':!![]});var _0x4245d9='Intervals';return db[_0xffd1('0x55')][_0xffd1('0x4f')]({'where':{'name':_0x4245d9,'userProfileId':_0x4f1430[_0xffd1('0x56')]},'raw':!![]})[_0xffd1('0x24')](function(_0x20bdaa){if(_0x20bdaa&&_0x20bdaa[_0xffd1('0x57')]===0x0){return db['UserProfileResource'][_0xffd1('0x50')]({'name':_0x388d32[_0xffd1('0x2b')],'resourceId':_0x388d32['id'],'type':_0x20bdaa[_0xffd1('0x2b')],'sectionId':_0x20bdaa['id']},{})['then'](function(){return _0x381b6f;});}else{return _0x381b6f;}})[_0xffd1('0x4b')](function(_0x36151a){logger[_0xffd1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36151a);throw _0x36151a;});}return _0x381b6f;})[_0xffd1('0x24')](respondWithResult(_0x4dfd4e,0xc9))[_0xffd1('0x4b')](handleError(_0x4dfd4e,null));};exports[_0xffd1('0x58')]=function(_0x30568e,_0x2f9a16){if(_0x30568e[_0xffd1('0x2e')]['id']){delete _0x30568e['body']['id'];}return db[_0xffd1('0x51')][_0xffd1('0x4f')]({'where':{'id':_0x30568e[_0xffd1('0x4d')]['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x2f9a16,null))['then'](saveUpdates(_0x30568e[_0xffd1('0x2e')],null))[_0xffd1('0x24')](respondWithResult(_0x2f9a16,null))[_0xffd1('0x4b')](handleError(_0x2f9a16,null));};exports[_0xffd1('0x23')]=function(_0x1bf40c,_0x3c73d5){return db['Interval'][_0xffd1('0x4f')]({'where':{'id':_0x1bf40c['params']['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x3c73d5,null))[_0xffd1('0x24')](removeEntity(_0x3c73d5,null))[_0xffd1('0x4b')](handleError(_0x3c73d5,null));};exports[_0xffd1('0x59')]=function(_0x1b2d48,_0x6cd33b,_0x3d33c9){if(_0x1b2d48['body']['id']){delete _0x1b2d48[_0xffd1('0x2e')]['id'];}return db[_0xffd1('0x51')][_0xffd1('0x4f')]({'where':{'id':_0x1b2d48['params']['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x6cd33b,null))['then'](function(_0x14840c){if(_0x14840c){_0x1b2d48[_0xffd1('0x2e')][_0xffd1('0x5a')]=_0x14840c['id'];return db['Interval'][_0xffd1('0x50')](_0x1b2d48[_0xffd1('0x2e')]);}})[_0xffd1('0x24')](respondWithResult(_0x6cd33b,null))[_0xffd1('0x4b')](handleError(_0x6cd33b,null));};exports['getIntervals']=function(_0x549a7a,_0x967c24,_0x43cd00){var _0x4267e0={};var _0xba759e={};var _0x465f6b;var _0x5cfee9;return db[_0xffd1('0x51')]['findOne']({'where':{'id':_0x549a7a[_0xffd1('0x4d')]['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x967c24,null))[_0xffd1('0x24')](function(_0x4aef07){if(_0x4aef07){_0x465f6b=_0x4aef07;_0xba759e[_0xffd1('0x39')]=_[_0xffd1('0x3b')](db[_0xffd1('0x51')][_0xffd1('0x36')]);_0xba759e[_0xffd1('0x3a')]=_[_0xffd1('0x3b')](_0x549a7a['query']);_0xba759e[_0xffd1('0x3c')]=_[_0xffd1('0x4e')](_0xba759e[_0xffd1('0x39')],_0xba759e['query']);_0x4267e0[_0xffd1('0x3d')]=_['intersection'](_0xba759e['model'],qs[_0xffd1('0x3e')](_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x3e')]));_0x4267e0[_0xffd1('0x3d')]=_0x4267e0[_0xffd1('0x3d')][_0xffd1('0x3f')]?_0x4267e0[_0xffd1('0x3d')]:_0xba759e[_0xffd1('0x39')];_0x4267e0[_0xffd1('0x41')]=qs[_0xffd1('0x42')](_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x42')]);_0x4267e0[_0xffd1('0x43')]=qs[_0xffd1('0x3c')](_[_0xffd1('0x44')](_0x549a7a['query'],_0xba759e[_0xffd1('0x3c')]));if(_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x45')]){_0x4267e0['where']=_[_0xffd1('0x2d')](_0x4267e0[_0xffd1('0x43')],{'$or':_[_0xffd1('0x35')](_0x4267e0['attributes'],function(_0x5981e0){var _0x3a9ee5={};_0x3a9ee5[_0x5981e0]={'$like':'%'+_0x549a7a['query'][_0xffd1('0x45')]+'%'};return _0x3a9ee5;})});}_0x4267e0=_['merge']({},_0x4267e0,_0x549a7a[_0xffd1('0x46')]);return _0x465f6b['getIntervals'](_0x4267e0);}})['then'](function(_0x16829b){if(_0x16829b){_0x5cfee9=_0x16829b[_0xffd1('0x3f')];if(!_0x549a7a['query'][_0xffd1('0x40')](_0xffd1('0x5b'))){_0x4267e0[_0xffd1('0x1d')]=qs['limit'](_0x549a7a[_0xffd1('0x3a')]['limit']);_0x4267e0[_0xffd1('0x1b')]=qs[_0xffd1('0x1b')](_0x549a7a[_0xffd1('0x3a')][_0xffd1('0x1b')]);}return _0x465f6b['getIntervals'](_0x4267e0);}})[_0xffd1('0x24')](function(_0x2788c4){if(_0x2788c4){return _0x2788c4?{'count':_0x5cfee9,'rows':_0x2788c4}:null;}})[_0xffd1('0x24')](respondWithResult(_0x967c24,null))[_0xffd1('0x4b')](handleError(_0x967c24,null));};exports[_0xffd1('0x5c')]=function(_0x24ed73,_0x2dd04a,_0x18d8a6){return db['Interval'][_0xffd1('0x5d')]({'where':{'id':_0x24ed73[_0xffd1('0x4d')]['id']}})[_0xffd1('0x24')](handleEntityNotFound(_0x2dd04a,null))['then'](function(_0x1fd1ba){if(_0x1fd1ba){return db[_0xffd1('0x5e')][_0xffd1('0x5f')](function(_0x5cfabb){return db['Interval'][_0xffd1('0x23')]({'where':{'IntervalId':_0x24ed73[_0xffd1('0x4d')]['id']},'transaction':_0x5cfabb})[_0xffd1('0x24')](function(_0x230903){var _0x4d8367=_[_0xffd1('0x35')](_0x24ed73['body'],function(_0x48bde3){delete _0x48bde3['id'];_0x48bde3[_0xffd1('0x5a')]=_0x24ed73[_0xffd1('0x4d')]['id'];return _0x48bde3;});return db['Interval']['bulkCreate'](_0x4d8367,{'transaction':_0x5cfabb});});})[_0xffd1('0x24')](function(){return db[_0xffd1('0x51')][_0xffd1('0x49')]({'where':{'IntervalId':_0x24ed73[_0xffd1('0x4d')]['id']}});});}})['then'](respondWithResult(_0x2dd04a,null))[_0xffd1('0x4b')](handleError(_0x2dd04a,null));}; \ No newline at end of file +var _0xc185=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','name','render','merge','contact','agent','index','map','Interval','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','filters','fields','options','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','create','findOne','sort','getIntervals','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4cc520,_0x9841f0){var _0x3bd61d=function(_0xf2411f){while(--_0xf2411f){_0x4cc520['push'](_0x4cc520['shift']());}};_0x3bd61d(++_0x9841f0);}(_0xc185,0x176));var _0x5c18=function(_0x33a1c0,_0x12e8e1){_0x33a1c0=_0x33a1c0-0x0;var _0xb0b3a3=_0xc185[_0x33a1c0];return _0xb0b3a3;};'use strict';var emlformat=require(_0x5c18('0x0'));var rimraf=require(_0x5c18('0x1'));var zipdir=require(_0x5c18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c18('0x3'));var moment=require(_0x5c18('0x4'));var BPromise=require(_0x5c18('0x5'));var Mustache=require(_0x5c18('0x6'));var util=require(_0x5c18('0x7'));var path=require(_0x5c18('0x8'));var sox=require(_0x5c18('0x9'));var csv=require(_0x5c18('0xa'));var ejs=require(_0x5c18('0xb'));var fs=require('fs');var fs_extra=require(_0x5c18('0xc'));var _=require(_0x5c18('0xd'));var squel=require('squel');var crypto=require(_0x5c18('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5c18('0xf'));var toCsv=require(_0x5c18('0xa'));var querystring=require('querystring');var Papa=require(_0x5c18('0x10'));var Redis=require(_0x5c18('0x11'));var authService=require(_0x5c18('0x12'));var qs=require(_0x5c18('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c18('0x14'));var logger=require(_0x5c18('0x15'))('api');var utils=require(_0x5c18('0x16'));var config=require(_0x5c18('0x17'));var licenseUtil=require(_0x5c18('0x18'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4eccb1,_0x225030){_0x225030=_0x225030||0xcc;return function(_0x35a441){if(_0x35a441){return _0x4eccb1['sendStatus'](_0x225030);}return _0x4eccb1[_0x5c18('0x19')](_0x225030)[_0x5c18('0x1a')]();};}function respondWithResult(_0x5e37c6,_0x442393){_0x442393=_0x442393||0xc8;return function(_0x3f8fa0){if(_0x3f8fa0){return _0x5e37c6[_0x5c18('0x19')](_0x442393)[_0x5c18('0x1b')](_0x3f8fa0);}};}function respondWithFilteredResult(_0xb12f53,_0x1ed5e6){return function(_0x1a8f00){if(_0x1a8f00){var _0x36aa36=typeof _0x1ed5e6[_0x5c18('0x1c')]==='undefined'&&typeof _0x1ed5e6[_0x5c18('0x1d')]===_0x5c18('0x1e');var _0x71e653=_0x1a8f00[_0x5c18('0x1f')];var _0x2ba778=_0x36aa36?0x0:_0x1ed5e6[_0x5c18('0x1c')];var _0xe2bdd9=_0x36aa36?_0x1a8f00[_0x5c18('0x1f')]:_0x1ed5e6[_0x5c18('0x1c')]+_0x1ed5e6[_0x5c18('0x1d')];var _0x3507f6;if(_0xe2bdd9>=_0x71e653){_0xe2bdd9=_0x71e653;_0x3507f6=0xc8;}else{_0x3507f6=0xce;}_0xb12f53[_0x5c18('0x19')](_0x3507f6);return _0xb12f53[_0x5c18('0x20')](_0x5c18('0x21'),_0x2ba778+'-'+_0xe2bdd9+'/'+_0x71e653)[_0x5c18('0x1b')](_0x1a8f00);}return null;};}function patchUpdates(_0x2c5ab3){return function(_0x3d000e){try{jsonpatch['apply'](_0x3d000e,_0x2c5ab3,!![]);}catch(_0x2b324b){return BPromise[_0x5c18('0x22')](_0x2b324b);}return _0x3d000e[_0x5c18('0x23')]();};}function saveUpdates(_0x2be0d4,_0x22e4e7){return function(_0x33d1a5){if(_0x33d1a5){return _0x33d1a5[_0x5c18('0x24')](_0x2be0d4)[_0x5c18('0x25')](function(_0x337a29){return _0x337a29;});}return null;};}function removeEntity(_0x4bb470,_0x1b1221){return function(_0x3d0894){if(_0x3d0894){return _0x3d0894[_0x5c18('0x26')]()[_0x5c18('0x25')](function(){var _0x2a8bb0=_0x3d0894[_0x5c18('0x27')]({'plain':!![]});var _0x34c836=_0x5c18('0x28');return db[_0x5c18('0x29')][_0x5c18('0x26')]({'where':{'type':_0x34c836,'resourceId':_0x2a8bb0['id']}})[_0x5c18('0x25')](function(){return _0x3d0894;});})[_0x5c18('0x25')](function(){_0x4bb470[_0x5c18('0x19')](0xcc)[_0x5c18('0x1a')]();});}};}function handleEntityNotFound(_0x1e7566,_0x5d235f){return function(_0x4cb08c){if(!_0x4cb08c){_0x1e7566[_0x5c18('0x2a')](0x194);}return _0x4cb08c;};}function handleError(_0x56bb15,_0x1f36c0){_0x1f36c0=_0x1f36c0||0x1f4;return function(_0x5a0fa6){logger[_0x5c18('0x2b')](_0x5a0fa6['stack']);if(_0x5a0fa6[_0x5c18('0x2c')]){delete _0x5a0fa6[_0x5c18('0x2c')];}_0x56bb15['status'](_0x1f36c0)['send'](_0x5a0fa6);};}function getMustacheRender(_0x1be985,_0x5aec62){return Mustache[_0x5c18('0x2d')](_0x1be985,_[_0x5c18('0x2e')](_0x5aec62['body'],{'contact':_0x5aec62[_0x5c18('0x2f')],'message':_0x5aec62['message'],'agent':_0x5aec62[_0x5c18('0x30')],'interaction':_0x5aec62['interaction'],'account':_0x5aec62['account']}))||'';}exports[_0x5c18('0x31')]=function(_0x3f4f47,_0x4ed020){var _0x1cc971={},_0x369db5={},_0x2ce05b={'count':0x0,'rows':[]};var _0x289ca5=_[_0x5c18('0x32')](db[_0x5c18('0x33')][_0x5c18('0x34')],function(_0xe7afe1){return{'name':_0xe7afe1[_0x5c18('0x35')],'type':_0xe7afe1[_0x5c18('0x36')][_0x5c18('0x37')]};});_0x369db5[_0x5c18('0x38')]=_[_0x5c18('0x32')](_0x289ca5,_0x5c18('0x2c'));_0x369db5[_0x5c18('0x39')]=_['keys'](_0x3f4f47[_0x5c18('0x39')]);_0x369db5['filters']=_[_0x5c18('0x3a')](_0x369db5[_0x5c18('0x38')],_0x369db5[_0x5c18('0x39')]);_0x1cc971[_0x5c18('0x3b')]=_[_0x5c18('0x3a')](_0x369db5[_0x5c18('0x38')],qs['fields'](_0x3f4f47[_0x5c18('0x39')]['fields']));_0x1cc971[_0x5c18('0x3b')]=_0x1cc971['attributes'][_0x5c18('0x3c')]?_0x1cc971[_0x5c18('0x3b')]:_0x369db5[_0x5c18('0x38')];if(!_0x3f4f47[_0x5c18('0x39')][_0x5c18('0x3d')](_0x5c18('0x3e'))){_0x1cc971['limit']=qs[_0x5c18('0x1d')](_0x3f4f47['query'][_0x5c18('0x1d')]);_0x1cc971[_0x5c18('0x1c')]=qs[_0x5c18('0x1c')](_0x3f4f47[_0x5c18('0x39')][_0x5c18('0x1c')]);}_0x1cc971[_0x5c18('0x3f')]=qs['sort'](_0x3f4f47[_0x5c18('0x39')]['sort']);_0x1cc971['where']=qs['filters'](_[_0x5c18('0x40')](_0x3f4f47[_0x5c18('0x39')],_0x369db5['filters']),_0x289ca5);if(_0x3f4f47['query'][_0x5c18('0x41')]){_0x1cc971[_0x5c18('0x42')]=_[_0x5c18('0x2e')](_0x1cc971[_0x5c18('0x42')],{'$or':_[_0x5c18('0x32')](_0x289ca5,function(_0x47b104){if(_0x47b104[_0x5c18('0x36')]!==_0x5c18('0x43')){var _0x279278={};_0x279278[_0x47b104[_0x5c18('0x2c')]]={'$like':'%'+_0x3f4f47['query'][_0x5c18('0x41')]+'%'};return _0x279278;}})});}_0x1cc971=_[_0x5c18('0x2e')]({},_0x1cc971,_0x3f4f47['options']);var _0x15b17c={'where':_0x1cc971['where']};return db[_0x5c18('0x33')][_0x5c18('0x1f')](_0x15b17c)[_0x5c18('0x25')](function(_0x2fc639){_0x2ce05b['count']=_0x2fc639;if(_0x3f4f47[_0x5c18('0x39')][_0x5c18('0x44')]){_0x1cc971[_0x5c18('0x45')]=[{'all':!![]}];}return db[_0x5c18('0x33')][_0x5c18('0x46')](_0x1cc971);})[_0x5c18('0x25')](function(_0x1d9002){_0x2ce05b[_0x5c18('0x47')]=_0x1d9002;return _0x2ce05b;})[_0x5c18('0x25')](respondWithFilteredResult(_0x4ed020,_0x1cc971))[_0x5c18('0x48')](handleError(_0x4ed020,null));};exports[_0x5c18('0x49')]=function(_0x8642db,_0x17ca3f){var _0x5f042b={'raw':!![],'where':{'id':_0x8642db[_0x5c18('0x4a')]['id']}},_0x28d626={};_0x28d626['model']=_[_0x5c18('0x4b')](db['Interval'][_0x5c18('0x34')]);_0x28d626[_0x5c18('0x39')]=_[_0x5c18('0x4b')](_0x8642db[_0x5c18('0x39')]);_0x28d626[_0x5c18('0x4c')]=_['intersection'](_0x28d626['model'],_0x28d626['query']);_0x5f042b['attributes']=_[_0x5c18('0x3a')](_0x28d626[_0x5c18('0x38')],qs[_0x5c18('0x4d')](_0x8642db[_0x5c18('0x39')][_0x5c18('0x4d')]));_0x5f042b[_0x5c18('0x3b')]=_0x5f042b[_0x5c18('0x3b')]['length']?_0x5f042b[_0x5c18('0x3b')]:_0x28d626[_0x5c18('0x38')];if(_0x8642db[_0x5c18('0x39')]['includeAll']){_0x5f042b[_0x5c18('0x45')]=[{'all':!![]}];}_0x5f042b=_[_0x5c18('0x2e')]({},_0x5f042b,_0x8642db[_0x5c18('0x4e')]);return db[_0x5c18('0x33')]['find'](_0x5f042b)[_0x5c18('0x25')](handleEntityNotFound(_0x17ca3f,null))[_0x5c18('0x25')](respondWithResult(_0x17ca3f,null))['catch'](handleError(_0x17ca3f,null));};exports['create']=function(_0x46d0a4,_0x252f62){return db['Interval']['create'](_0x46d0a4['body'],{})[_0x5c18('0x25')](function(_0x4c82dd){var _0x23b1b3=_0x46d0a4[_0x5c18('0x4f')][_0x5c18('0x27')]({'plain':!![]});if(!_0x23b1b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23b1b3[_0x5c18('0x50')]===_0x5c18('0x4f')){var _0x1b39df=_0x4c82dd['get']({'plain':!![]});var _0x1e9641=_0x5c18('0x28');return db[_0x5c18('0x51')][_0x5c18('0x52')]({'where':{'name':_0x1e9641,'userProfileId':_0x23b1b3[_0x5c18('0x53')]},'raw':!![]})[_0x5c18('0x25')](function(_0x15955c){if(_0x15955c&&_0x15955c[_0x5c18('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1b39df[_0x5c18('0x2c')],'resourceId':_0x1b39df['id'],'type':_0x15955c[_0x5c18('0x2c')],'sectionId':_0x15955c['id']},{})[_0x5c18('0x25')](function(){return _0x4c82dd;});}else{return _0x4c82dd;}})[_0x5c18('0x48')](function(_0x227b27){logger[_0x5c18('0x2b')](_0x5c18('0x55'),_0x227b27);throw _0x227b27;});}return _0x4c82dd;})[_0x5c18('0x25')](respondWithResult(_0x252f62,0xc9))['catch'](handleError(_0x252f62,null));};exports['update']=function(_0x5b6a4c,_0x23d5a9){if(_0x5b6a4c[_0x5c18('0x56')]['id']){delete _0x5b6a4c[_0x5c18('0x56')]['id'];}return db['Interval']['find']({'where':{'id':_0x5b6a4c['params']['id']}})['then'](handleEntityNotFound(_0x23d5a9,null))[_0x5c18('0x25')](saveUpdates(_0x5b6a4c['body'],null))['then'](respondWithResult(_0x23d5a9,null))[_0x5c18('0x48')](handleError(_0x23d5a9,null));};exports[_0x5c18('0x26')]=function(_0x440b90,_0x220592){return db[_0x5c18('0x33')][_0x5c18('0x52')]({'where':{'id':_0x440b90[_0x5c18('0x4a')]['id']}})['then'](handleEntityNotFound(_0x220592,null))[_0x5c18('0x25')](removeEntity(_0x220592,null))[_0x5c18('0x48')](handleError(_0x220592,null));};exports[_0x5c18('0x57')]=function(_0x2db4b4,_0x3aeaf9,_0x45da59){if(_0x2db4b4[_0x5c18('0x56')]['id']){delete _0x2db4b4[_0x5c18('0x56')]['id'];}return db[_0x5c18('0x33')][_0x5c18('0x52')]({'where':{'id':_0x2db4b4[_0x5c18('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3aeaf9,null))[_0x5c18('0x25')](function(_0x5b8ce3){if(_0x5b8ce3){_0x2db4b4[_0x5c18('0x56')][_0x5c18('0x58')]=_0x5b8ce3['id'];return db['Interval'][_0x5c18('0x59')](_0x2db4b4[_0x5c18('0x56')]);}})['then'](respondWithResult(_0x3aeaf9,null))[_0x5c18('0x48')](handleError(_0x3aeaf9,null));};exports['getIntervals']=function(_0x147a9d,_0x56de38,_0x314520){var _0x566c50={};var _0x4c1e7f={};var _0x5cbb2d;var _0x39100f;return db['Interval'][_0x5c18('0x5a')]({'where':{'id':_0x147a9d[_0x5c18('0x4a')]['id']}})[_0x5c18('0x25')](handleEntityNotFound(_0x56de38,null))[_0x5c18('0x25')](function(_0x165d35){if(_0x165d35){_0x5cbb2d=_0x165d35;_0x4c1e7f[_0x5c18('0x38')]=_[_0x5c18('0x4b')](db[_0x5c18('0x33')]['rawAttributes']);_0x4c1e7f[_0x5c18('0x39')]=_['keys'](_0x147a9d[_0x5c18('0x39')]);_0x4c1e7f[_0x5c18('0x4c')]=_[_0x5c18('0x3a')](_0x4c1e7f[_0x5c18('0x38')],_0x4c1e7f[_0x5c18('0x39')]);_0x566c50[_0x5c18('0x3b')]=_['intersection'](_0x4c1e7f['model'],qs['fields'](_0x147a9d[_0x5c18('0x39')][_0x5c18('0x4d')]));_0x566c50[_0x5c18('0x3b')]=_0x566c50['attributes']['length']?_0x566c50[_0x5c18('0x3b')]:_0x4c1e7f[_0x5c18('0x38')];_0x566c50['order']=qs[_0x5c18('0x5b')](_0x147a9d[_0x5c18('0x39')][_0x5c18('0x5b')]);_0x566c50[_0x5c18('0x42')]=qs['filters'](_[_0x5c18('0x40')](_0x147a9d[_0x5c18('0x39')],_0x4c1e7f[_0x5c18('0x4c')]));if(_0x147a9d[_0x5c18('0x39')]['filter']){_0x566c50[_0x5c18('0x42')]=_[_0x5c18('0x2e')](_0x566c50['where'],{'$or':_[_0x5c18('0x32')](_0x566c50[_0x5c18('0x3b')],function(_0x5670f8){var _0x203433={};_0x203433[_0x5670f8]={'$like':'%'+_0x147a9d['query']['filter']+'%'};return _0x203433;})});}_0x566c50=_[_0x5c18('0x2e')]({},_0x566c50,_0x147a9d[_0x5c18('0x4e')]);return _0x5cbb2d[_0x5c18('0x5c')](_0x566c50);}})['then'](function(_0x2914b7){if(_0x2914b7){_0x39100f=_0x2914b7[_0x5c18('0x3c')];if(!_0x147a9d[_0x5c18('0x39')][_0x5c18('0x3d')](_0x5c18('0x3e'))){_0x566c50[_0x5c18('0x1d')]=qs[_0x5c18('0x1d')](_0x147a9d[_0x5c18('0x39')][_0x5c18('0x1d')]);_0x566c50['offset']=qs[_0x5c18('0x1c')](_0x147a9d[_0x5c18('0x39')][_0x5c18('0x1c')]);}return _0x5cbb2d['getIntervals'](_0x566c50);}})['then'](function(_0x3dabe2){if(_0x3dabe2){return _0x3dabe2?{'count':_0x39100f,'rows':_0x3dabe2}:null;}})[_0x5c18('0x25')](respondWithResult(_0x56de38,null))['catch'](handleError(_0x56de38,null));};exports[_0x5c18('0x5d')]=function(_0x1bdd7f,_0x50b7d6,_0x53ea9c){return db[_0x5c18('0x33')]['findOne']({'where':{'id':_0x1bdd7f[_0x5c18('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50b7d6,null))[_0x5c18('0x25')](function(_0x300f71){if(_0x300f71){return db[_0x5c18('0x5e')]['transaction'](function(_0x1bb9b4){return db[_0x5c18('0x33')]['destroy']({'where':{'IntervalId':_0x1bdd7f[_0x5c18('0x4a')]['id']},'transaction':_0x1bb9b4})[_0x5c18('0x25')](function(_0x40b927){var _0x1f22a2=_[_0x5c18('0x32')](_0x1bdd7f[_0x5c18('0x56')],function(_0x35aa7a){delete _0x35aa7a['id'];_0x35aa7a[_0x5c18('0x58')]=_0x1bdd7f[_0x5c18('0x4a')]['id'];return _0x35aa7a;});return db[_0x5c18('0x33')][_0x5c18('0x5f')](_0x1f22a2,{'transaction':_0x1bb9b4});});})[_0x5c18('0x25')](function(){return db[_0x5c18('0x33')][_0x5c18('0x46')]({'where':{'IntervalId':_0x1bdd7f[_0x5c18('0x4a')]['id']}});});}})[_0x5c18('0x25')](respondWithResult(_0x50b7d6,null))['catch'](handleError(_0x50b7d6,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a7f46bb..2ae63f3 100644 --- a/server/api/interval/interval.model.js +++ b/server/api/interval/interval.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d31=['define','tools_intervals','rewrite','lodash','util','../../config/logger','moment','bluebird','path','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x5f210d,_0x1b804b){var _0x52293f=function(_0x5b193b){while(--_0x5b193b){_0x5f210d['push'](_0x5f210d['shift']());}};_0x52293f(++_0x1b804b);}(_0x5d31,0xb7));var _0x15d3=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0x5d31[_0x2b18c9];return _0x8b913c;};'use strict';var _=require(_0x15d3('0x0'));var util=require(_0x15d3('0x1'));var logger=require(_0x15d3('0x2'))('api');var moment=require(_0x15d3('0x3'));var BPromise=require(_0x15d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15d3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x15d3('0x6'));var extensions=require(_0x15d3('0x7'));module[_0x15d3('0x8')]=function(_0x378cb7,_0x1f7128){return _0x378cb7[_0x15d3('0x9')]('Interval',attributes,{'tableName':_0x15d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f690b,_0x719223){extensions['rewrite'](_0x378cb7,_0x1f690b);},'afterBulkCreate':function(_0x37d3ae,_0x51da1f,_0x52a1c1){_0x52a1c1();extensions[_0x15d3('0xb')](_0x378cb7,_0x37d3ae[0x0]);},'afterUpdate':function(_0x43c62e,_0x40273d){extensions[_0x15d3('0xb')](_0x378cb7,_0x43c62e);},'afterDestroy':function(_0x38cd69,_0x1d4a66){extensions[_0x15d3('0xb')](_0x378cb7,_0x38cd69);}}});}; \ No newline at end of file +var _0x4584=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','../../config/logger','api','moment','path'];(function(_0x4d7df6,_0x3f6139){var _0x4c0d29=function(_0x12ae02){while(--_0x12ae02){_0x4d7df6['push'](_0x4d7df6['shift']());}};_0x4c0d29(++_0x3f6139);}(_0x4584,0x1cf));var _0x4458=function(_0x5db8a7,_0x215802){_0x5db8a7=_0x5db8a7-0x0;var _0x2f243f=_0x4584[_0x5db8a7];return _0x2f243f;};'use strict';var _=require(_0x4458('0x0'));var util=require('util');var logger=require(_0x4458('0x1'))(_0x4458('0x2'));var moment=require(_0x4458('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4458('0x4'));var rimraf=require(_0x4458('0x5'));var config=require(_0x4458('0x6'));var attributes=require(_0x4458('0x7'));var extensions=require(_0x4458('0x8'));module[_0x4458('0x9')]=function(_0x175c2d,_0x215b2d){return _0x175c2d[_0x4458('0xa')]('Interval',attributes,{'tableName':_0x4458('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x83fb96,_0x107f1c){extensions[_0x4458('0xc')](_0x175c2d,_0x83fb96);},'afterBulkCreate':function(_0x1ab8c3,_0xfccdb6,_0xf9d3ff){_0xf9d3ff();extensions[_0x4458('0xc')](_0x175c2d,_0x1ab8c3[0x0]);},'afterUpdate':function(_0x43eb54,_0x4e3c1c){extensions[_0x4458('0xc')](_0x175c2d,_0x43eb54);},'afterDestroy':function(_0x347edc,_0x143b18){extensions[_0x4458('0xc')](_0x175c2d,_0x347edc);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7190b17..b132371 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81ad=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetInterval','stringify','ShowInterval','Interval','find'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x81ad,0x1d1));var _0xd81a=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x81ad[_0x234ae1];return _0x227ba0;};'use strict';var _=require(_0xd81a('0x0'));var util=require(_0xd81a('0x1'));var moment=require(_0xd81a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd81a('0x3'));var db=require(_0xd81a('0x4'))['db'];var utils=require(_0xd81a('0x5'));var logger=require(_0xd81a('0x6'))('rpc');var config=require(_0xd81a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9ef758,_0xb3822a,_0x20885a){return new BPromise(function(_0x5a5472,_0x3f8fcf){return client['request'](_0x9ef758,_0x20885a)[_0xd81a('0x8')](function(_0x2107bd){logger[_0xd81a('0x9')](_0xd81a('0xa'),_0xb3822a,'request\x20sent');logger[_0xd81a('0xb')](_0xd81a('0xc'),_0xb3822a,'request\x20sent',JSON['stringify'](_0x2107bd));if(_0x2107bd[_0xd81a('0xd')]){if(_0x2107bd[_0xd81a('0xd')][_0xd81a('0xe')]===0x1f4){logger[_0xd81a('0xd')](_0xd81a('0xa'),_0xb3822a,_0x2107bd[_0xd81a('0xd')][_0xd81a('0xf')]);return _0x3f8fcf(_0x2107bd[_0xd81a('0xd')][_0xd81a('0xf')]);}logger[_0xd81a('0xd')]('Interval,\x20%s,\x20%s',_0xb3822a,_0x2107bd[_0xd81a('0xd')][_0xd81a('0xf')]);return _0x5a5472(_0x2107bd[_0xd81a('0xd')]['message']);}else{logger[_0xd81a('0x9')]('Interval,\x20%s,\x20%s',_0xb3822a,'request\x20sent');_0x5a5472(_0x2107bd['result']['message']);}})[_0xd81a('0x10')](function(_0x1b6c62){logger[_0xd81a('0xd')](_0xd81a('0xa'),_0xb3822a,_0x1b6c62);_0x3f8fcf(_0x1b6c62);});});}exports['GetInterval']=function(_0x33759b){var _0x13985e=this;return new Promise(function(_0x5c1223,_0xfa5713){return db['Interval'][_0xd81a('0x11')]({'raw':_0x33759b[_0xd81a('0x12')]?_0x33759b[_0xd81a('0x12')][_0xd81a('0x13')]===undefined?!![]:![]:!![],'where':_0x33759b[_0xd81a('0x12')]?_0x33759b['options'][_0xd81a('0x14')]||null:null,'attributes':_0x33759b[_0xd81a('0x12')]?_0x33759b['options'][_0xd81a('0x15')]||null:null,'limit':_0x33759b[_0xd81a('0x12')]?_0x33759b[_0xd81a('0x12')][_0xd81a('0x16')]||null:null,'include':_0x33759b[_0xd81a('0x12')]?_0x33759b['options'][_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x33759b[_0xd81a('0x12')][_0xd81a('0x17')],function(_0x5d2537){return{'model':db[_0x5d2537[_0xd81a('0x19')]],'as':_0x5d2537['as'],'attributes':_0x5d2537[_0xd81a('0x15')],'include':_0x5d2537[_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x5d2537[_0xd81a('0x17')],function(_0x34f317){return{'model':db[_0x34f317['model']],'as':_0x34f317['as'],'attributes':_0x34f317[_0xd81a('0x15')],'include':_0x34f317[_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x34f317[_0xd81a('0x17')],function(_0x181b6f){return{'model':db[_0x181b6f[_0xd81a('0x19')]],'as':_0x181b6f['as'],'attributes':_0x181b6f[_0xd81a('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd81a('0x8')](function(_0xe3d6a4){logger[_0xd81a('0x9')]('GetInterval',_0x33759b);logger['debug'](_0xd81a('0x1a'),_0x33759b,JSON[_0xd81a('0x1b')](_0xe3d6a4));_0x5c1223(_0xe3d6a4);})[_0xd81a('0x10')](function(_0x312b53){logger[_0xd81a('0xd')]('GetInterval',_0x312b53[_0xd81a('0xf')],_0x33759b);_0xfa5713(_0x13985e[_0xd81a('0xd')](0x1f4,_0x312b53[_0xd81a('0xf')]));});});};exports[_0xd81a('0x1c')]=function(_0x31fcc3){var _0x551946=this;return new Promise(function(_0x2820e7,_0x1dcb17){return db[_0xd81a('0x1d')][_0xd81a('0x1e')]({'raw':_0x31fcc3[_0xd81a('0x12')]?_0x31fcc3[_0xd81a('0x12')][_0xd81a('0x13')]===undefined?!![]:![]:!![],'where':_0x31fcc3[_0xd81a('0x12')]?_0x31fcc3[_0xd81a('0x12')][_0xd81a('0x14')]||null:null,'attributes':_0x31fcc3[_0xd81a('0x12')]?_0x31fcc3[_0xd81a('0x12')]['attributes']||null:null,'include':_0x31fcc3['options']?_0x31fcc3[_0xd81a('0x12')][_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x31fcc3[_0xd81a('0x12')]['include'],function(_0x39fab2){return{'model':db[_0x39fab2[_0xd81a('0x19')]],'as':_0x39fab2['as'],'attributes':_0x39fab2[_0xd81a('0x15')],'include':_0x39fab2[_0xd81a('0x17')]?_[_0xd81a('0x18')](_0x39fab2[_0xd81a('0x17')],function(_0x5af224){return{'model':db[_0x5af224[_0xd81a('0x19')]],'as':_0x5af224['as'],'attributes':_0x5af224[_0xd81a('0x15')],'include':_0x5af224['include']?_[_0xd81a('0x18')](_0x5af224['include'],function(_0x574efc){return{'model':db[_0x574efc[_0xd81a('0x19')]],'as':_0x574efc['as'],'attributes':_0x574efc[_0xd81a('0x15')]};}):[]};}):[]};}):[]:[]})[_0xd81a('0x8')](function(_0x28f94d){logger[_0xd81a('0x9')](_0xd81a('0x1c'),_0x31fcc3);logger['debug'](_0xd81a('0x1c'),_0x31fcc3,JSON[_0xd81a('0x1b')](_0x28f94d));_0x2820e7(_0x28f94d);})['catch'](function(_0x5f1dfe){logger[_0xd81a('0xd')](_0xd81a('0x1c'),_0x5f1dfe[_0xd81a('0xf')],_0x31fcc3);_0x1dcb17(_0x551946[_0xd81a('0xd')](0x1f4,_0x5f1dfe[_0xd81a('0xf')]));});});}; \ No newline at end of file +var _0x055c=['findAll','options','where','attributes','limit','include','map','model','find','ShowInterval','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetInterval','Interval'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x055c,0x196));var _0xc055=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x055c[_0x4defd6];return _0x4c9276;};'use strict';var _=require(_0xc055('0x0'));var util=require(_0xc055('0x1'));var moment=require(_0xc055('0x2'));var BPromise=require(_0xc055('0x3'));var rs=require(_0xc055('0x4'));var fs=require('fs');var Redis=require(_0xc055('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc055('0x6'));var logger=require(_0xc055('0x7'))('rpc');var config=require(_0xc055('0x8'));var jayson=require(_0xc055('0x9'));var client=jayson[_0xc055('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26d0a1,_0x230c64,_0x3e91ef){return new BPromise(function(_0x19e5c6,_0x11a074){return client[_0xc055('0xb')](_0x26d0a1,_0x3e91ef)[_0xc055('0xc')](function(_0x1d36b6){logger[_0xc055('0xd')](_0xc055('0xe'),_0x230c64,'request\x20sent');logger[_0xc055('0xf')](_0xc055('0x10'),_0x230c64,_0xc055('0x11'),JSON[_0xc055('0x12')](_0x1d36b6));if(_0x1d36b6[_0xc055('0x13')]){if(_0x1d36b6[_0xc055('0x13')][_0xc055('0x14')]===0x1f4){logger[_0xc055('0x13')](_0xc055('0xe'),_0x230c64,_0x1d36b6[_0xc055('0x13')][_0xc055('0x15')]);return _0x11a074(_0x1d36b6[_0xc055('0x13')][_0xc055('0x15')]);}logger[_0xc055('0x13')](_0xc055('0xe'),_0x230c64,_0x1d36b6[_0xc055('0x13')][_0xc055('0x15')]);return _0x19e5c6(_0x1d36b6['error']['message']);}else{logger[_0xc055('0xd')](_0xc055('0xe'),_0x230c64,'request\x20sent');_0x19e5c6(_0x1d36b6[_0xc055('0x16')][_0xc055('0x15')]);}})[_0xc055('0x17')](function(_0x50f2ef){logger['error'](_0xc055('0xe'),_0x230c64,_0x50f2ef);_0x11a074(_0x50f2ef);});});}exports[_0xc055('0x18')]=function(_0xf053f0){var _0x1e559a=this;return new Promise(function(_0xd25214,_0x12b43e){return db[_0xc055('0x19')][_0xc055('0x1a')]({'raw':_0xf053f0[_0xc055('0x1b')]?_0xf053f0[_0xc055('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xf053f0[_0xc055('0x1b')]?_0xf053f0[_0xc055('0x1b')][_0xc055('0x1c')]||null:null,'attributes':_0xf053f0[_0xc055('0x1b')]?_0xf053f0[_0xc055('0x1b')][_0xc055('0x1d')]||null:null,'limit':_0xf053f0[_0xc055('0x1b')]?_0xf053f0[_0xc055('0x1b')][_0xc055('0x1e')]||null:null,'include':_0xf053f0[_0xc055('0x1b')]?_0xf053f0['options'][_0xc055('0x1f')]?_[_0xc055('0x20')](_0xf053f0[_0xc055('0x1b')][_0xc055('0x1f')],function(_0x147b7a){return{'model':db[_0x147b7a['model']],'as':_0x147b7a['as'],'attributes':_0x147b7a[_0xc055('0x1d')],'include':_0x147b7a[_0xc055('0x1f')]?_[_0xc055('0x20')](_0x147b7a['include'],function(_0x252ae8){return{'model':db[_0x252ae8[_0xc055('0x21')]],'as':_0x252ae8['as'],'attributes':_0x252ae8[_0xc055('0x1d')],'include':_0x252ae8[_0xc055('0x1f')]?_['map'](_0x252ae8[_0xc055('0x1f')],function(_0x46b682){return{'model':db[_0x46b682['model']],'as':_0x46b682['as'],'attributes':_0x46b682[_0xc055('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x531417){logger[_0xc055('0xd')](_0xc055('0x18'),_0xf053f0);logger[_0xc055('0xf')](_0xc055('0x18'),_0xf053f0,JSON[_0xc055('0x12')](_0x531417));_0xd25214(_0x531417);})[_0xc055('0x17')](function(_0x4eef3d){logger[_0xc055('0x13')](_0xc055('0x18'),_0x4eef3d['message'],_0xf053f0);_0x12b43e(_0x1e559a[_0xc055('0x13')](0x1f4,_0x4eef3d[_0xc055('0x15')]));});});};exports['ShowInterval']=function(_0x4d04e6){var _0x2c7f92=this;return new Promise(function(_0x2efefe,_0x2b65e6){return db[_0xc055('0x19')][_0xc055('0x22')]({'raw':_0x4d04e6[_0xc055('0x1b')]?_0x4d04e6[_0xc055('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4d04e6[_0xc055('0x1b')]?_0x4d04e6[_0xc055('0x1b')][_0xc055('0x1c')]||null:null,'attributes':_0x4d04e6[_0xc055('0x1b')]?_0x4d04e6[_0xc055('0x1b')][_0xc055('0x1d')]||null:null,'include':_0x4d04e6[_0xc055('0x1b')]?_0x4d04e6[_0xc055('0x1b')][_0xc055('0x1f')]?_[_0xc055('0x20')](_0x4d04e6['options']['include'],function(_0x2bc5d4){return{'model':db[_0x2bc5d4[_0xc055('0x21')]],'as':_0x2bc5d4['as'],'attributes':_0x2bc5d4[_0xc055('0x1d')],'include':_0x2bc5d4[_0xc055('0x1f')]?_[_0xc055('0x20')](_0x2bc5d4[_0xc055('0x1f')],function(_0xc3c3c7){return{'model':db[_0xc3c3c7[_0xc055('0x21')]],'as':_0xc3c3c7['as'],'attributes':_0xc3c3c7[_0xc055('0x1d')],'include':_0xc3c3c7['include']?_[_0xc055('0x20')](_0xc3c3c7[_0xc055('0x1f')],function(_0x8fd97d){return{'model':db[_0x8fd97d[_0xc055('0x21')]],'as':_0x8fd97d['as'],'attributes':_0x8fd97d['attributes']};}):[]};}):[]};}):[]:[]})[_0xc055('0xc')](function(_0x1f7eec){logger[_0xc055('0xd')](_0xc055('0x23'),_0x4d04e6);logger[_0xc055('0xf')](_0xc055('0x23'),_0x4d04e6,JSON[_0xc055('0x12')](_0x1f7eec));_0x2efefe(_0x1f7eec);})['catch'](function(_0x4202f5){logger[_0xc055('0x13')](_0xc055('0x23'),_0x4202f5['message'],_0x4d04e6);_0x2b65e6(_0x2c7f92[_0xc055('0x13')](0x1f4,_0x4202f5[_0xc055('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4f55d94..0c2a91b 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74df=['./jira.controller','post','isAuthenticated','send','exports','Router','../../components/auth/service'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x74df,0xc2));var _0xf74d=function(_0x107315,_0xd8be5f){_0x107315=_0x107315-0x0;var _0x3def72=_0x74df[_0x107315];return _0x3def72;};'use strict';var express=require('express');var router=express[_0xf74d('0x0')]();var auth=require(_0xf74d('0x1'));var controller=require(_0xf74d('0x2'));router[_0xf74d('0x3')]('/',auth[_0xf74d('0x4')](),controller[_0xf74d('0x5')]);module[_0xf74d('0x6')]=router; \ No newline at end of file +var _0x03a3=['exports','express','Router','./jira.controller','post','isAuthenticated','send'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x03a3,0x1dd));var _0x303a=function(_0x3667c4,_0x4b64bd){_0x3667c4=_0x3667c4-0x0;var _0x12a5a2=_0x03a3[_0x3667c4];return _0x12a5a2;};'use strict';var express=require(_0x303a('0x0'));var router=express[_0x303a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x303a('0x2'));router[_0x303a('0x3')]('/',auth[_0x303a('0x4')](),controller[_0x303a('0x5')]);module[_0x303a('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b4b9b00..ab72093 100644 --- a/server/api/jira/jira.controller.js +++ b/server/api/jira/jira.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2347=['json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','fields','email','customfield_11501','customfield_11503','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','request','setEncoding','data','end','status','statusCode'];(function(_0x4dc957,_0xf5890a){var _0x26bb75=function(_0x20144a){while(--_0x20144a){_0x4dc957['push'](_0x4dc957['shift']());}};_0x26bb75(++_0xf5890a);}(_0x2347,0x1b1));var _0x7234=function(_0x2d1548,_0x441423){_0x2d1548=_0x2d1548-0x0;var _0x10e52c=_0x2347[_0x2d1548];return _0x10e52c;};'use strict';var BPromise=require(_0x7234('0x0'));var https=require(_0x7234('0x1'));var logger=require('../../config/logger')(_0x7234('0x2'));var USERNAME=_0x7234('0x3');var PASSWORD=_0x7234('0x4');function openIssue(_0x11a416,_0x4d598d){var _0x5d3334={'fields':{'project':{'key':_0x11a416[_0x7234('0x5')]||_0x7234('0x6')},'summary':(_0x11a416[_0x7234('0x7')]||_0x7234('0x8'))+'\x20from\x20'+_0x11a416['ip'],'description':_0x11a416[_0x7234('0x9')]||JSON[_0x7234('0xa')](_0x11a416),'issuetype':{'name':_0x11a416[_0x7234('0xb')]||'Bug'}}};_0x5d3334[_0x7234('0xc')]['customfield_11500']=_0x11a416[_0x7234('0xd')];_0x5d3334['fields'][_0x7234('0xe')]=_0x11a416['oldToken'];_0x5d3334[_0x7234('0xc')]['customfield_11502']=_0x11a416['newToken'];_0x5d3334[_0x7234('0xc')][_0x7234('0xf')]=_0x11a416['name'];_0x5d3334[_0x7234('0xc')][_0x7234('0x10')]=_0x11a416[_0x7234('0x11')];_0x5d3334[_0x7234('0xc')]['customfield_10102']=_0x11a416['ip'];var _0x44c723={'host':_0x7234('0x12'),'port':0x1bb,'path':_0x7234('0x13'),'method':_0x7234('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x7234('0x15'),'Authorization':_0x7234('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0xdc228a=JSON[_0x7234('0xa')](_0x5d3334);var _0x1612b0=https[_0x7234('0x17')](_0x44c723,function(_0x4014ae){_0x4014ae[_0x7234('0x18')]('utf8');var _0x444d48='';_0x4014ae['on'](_0x7234('0x19'),function(_0x10e171){_0x444d48+=_0x10e171;});_0x4014ae['on'](_0x7234('0x1a'),function(){if(_0x4d598d){return _0x4d598d[_0x7234('0x1b')](_0x4014ae[_0x7234('0x1c')])[_0x7234('0x1d')](JSON[_0x7234('0x1e')](_0x444d48));}});});_0x1612b0['on'](_0x7234('0x1f'),function(_0x3c8768){if(_0x4d598d){return _0x4d598d[_0x7234('0x1b')](0x1f4)[_0x7234('0x1d')]({'errors':[{'message':_0x7234('0x20'),'type':'api.jira'}]});}});_0x1612b0[_0x7234('0x21')](_0xdc228a);_0x1612b0[_0x7234('0x1a')]();}exports[_0x7234('0x22')]=openIssue;exports[_0x7234('0x23')]=function(_0x315432,_0x343b31){_0x315432[_0x7234('0x24')]['ip']=_0x315432[_0x7234('0x25')][_0x7234('0x26')]||_0x315432[_0x7234('0x27')][_0x7234('0x28')]||_0x315432[_0x7234('0x29')]['remoteAddress']||_0x315432[_0x7234('0x27')]['socket']['remoteAddress'];return openIssue(_0x315432[_0x7234('0x24')],_0x343b31);}; \ No newline at end of file +var _0x728a=['remoteAddress','bluebird','https','../../config/logger','api','3eAmWpBVP0','summary','Report','description','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','stringify','setEncoding','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','headers','x-forwarded-for','connection'];(function(_0x159b54,_0x2d7b2f){var _0x48fe69=function(_0x32a1cc){while(--_0x32a1cc){_0x159b54['push'](_0x159b54['shift']());}};_0x48fe69(++_0x2d7b2f);}(_0x728a,0x119));var _0xa728=function(_0x2876f9,_0x84f2c1){_0x2876f9=_0x2876f9-0x0;var _0x3a30f3=_0x728a[_0x2876f9];return _0x3a30f3;};'use strict';var BPromise=require(_0xa728('0x0'));var https=require(_0xa728('0x1'));var logger=require(_0xa728('0x2'))(_0xa728('0x3'));var USERNAME='support';var PASSWORD=_0xa728('0x4');function openIssue(_0x1d3459,_0xe6d089){var _0x363f8d={'fields':{'project':{'key':_0x1d3459['key']||'MOTGUI'},'summary':(_0x1d3459[_0xa728('0x5')]||_0xa728('0x6'))+'\x20from\x20'+_0x1d3459['ip'],'description':_0x1d3459[_0xa728('0x7')]||JSON['stringify'](_0x1d3459),'issuetype':{'name':_0x1d3459[_0xa728('0x8')]||_0xa728('0x9')}}};_0x363f8d['fields']['customfield_11500']=_0x1d3459['email'];_0x363f8d[_0xa728('0xa')][_0xa728('0xb')]=_0x1d3459[_0xa728('0xc')];_0x363f8d[_0xa728('0xa')][_0xa728('0xd')]=_0x1d3459[_0xa728('0xe')];_0x363f8d[_0xa728('0xa')]['customfield_11503']=_0x1d3459[_0xa728('0xf')];_0x363f8d[_0xa728('0xa')][_0xa728('0x10')]=_0x1d3459['reason'];_0x363f8d[_0xa728('0xa')][_0xa728('0x11')]=_0x1d3459['ip'];var _0x5ecbd7={'host':_0xa728('0x12'),'port':0x1bb,'path':_0xa728('0x13'),'method':_0xa728('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xa728('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa728('0x16')]('base64')}};var _0x4995eb=JSON[_0xa728('0x17')](_0x363f8d);var _0xd2de46=https['request'](_0x5ecbd7,function(_0x528202){_0x528202[_0xa728('0x18')]('utf8');var _0x5d1872='';_0x528202['on']('data',function(_0x3bf64b){_0x5d1872+=_0x3bf64b;});_0x528202['on']('end',function(){if(_0xe6d089){return _0xe6d089[_0xa728('0x19')](_0x528202[_0xa728('0x1a')])[_0xa728('0x1b')](JSON[_0xa728('0x1c')](_0x5d1872));}});});_0xd2de46['on'](_0xa728('0x1d'),function(_0x252343){if(_0xe6d089){return _0xe6d089[_0xa728('0x19')](0x1f4)[_0xa728('0x1b')]({'errors':[{'message':_0xa728('0x1e'),'type':_0xa728('0x1f')}]});}});_0xd2de46[_0xa728('0x20')](_0x4995eb);_0xd2de46[_0xa728('0x21')]();}exports[_0xa728('0x22')]=openIssue;exports['send']=function(_0x4b96a5,_0x1ea4d9){_0x4b96a5[_0xa728('0x23')]['ip']=_0x4b96a5[_0xa728('0x24')][_0xa728('0x25')]||_0x4b96a5[_0xa728('0x26')]['remoteAddress']||_0x4b96a5['socket'][_0xa728('0x27')]||_0x4b96a5['connection']['socket'][_0xa728('0x27')];return openIssue(_0x4b96a5[_0xa728('0x23')],_0x1ea4d9);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 9ef0808..0c0fd95 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8c9=['fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','create','put','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x131f2f,_0x1da6c3){var _0x6e9954=function(_0x2653a4){while(--_0x2653a4){_0x131f2f['push'](_0x131f2f['shift']());}};_0x6e9954(++_0x1da6c3);}(_0xe8c9,0x1d8));var _0x9e8c=function(_0x1a27d2,_0x40290a){_0x1a27d2=_0x1a27d2-0x0;var _0xb25974=_0xe8c9[_0x1a27d2];return _0xb25974;};'use strict';var multer=require('multer');var util=require(_0x9e8c('0x0'));var path=require(_0x9e8c('0x1'));var timeout=require(_0x9e8c('0x2'));var express=require('express');var router=express[_0x9e8c('0x3')]();var fs_extra=require(_0x9e8c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9e8c('0x5'));var config=require('../../config/environment');var controller=require(_0x9e8c('0x6'));router[_0x9e8c('0x7')]('/',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0x9')]);router[_0x9e8c('0x7')]('/describe',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0xa')]);router[_0x9e8c('0x7')](_0x9e8c('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0xc')]);router[_0x9e8c('0xd')](_0x9e8c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9e8c('0xe')]('/:id',auth[_0x9e8c('0x8')](),controller[_0x9e8c('0xf')]);module[_0x9e8c('0x10')]=router; \ No newline at end of file +var _0x123e=['fs-extra','../../config/environment','get','isAuthenticated','index','describe','/:id','create','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x1b871d,_0x595ef4){var _0x380b98=function(_0x559507){while(--_0x559507){_0x1b871d['push'](_0x1b871d['shift']());}};_0x380b98(++_0x595ef4);}(_0x123e,0x1bb));var _0xe123=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x123e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe123('0x0'));var util=require(_0xe123('0x1'));var path=require('path');var timeout=require(_0xe123('0x2'));var express=require(_0xe123('0x3'));var router=express[_0xe123('0x4')]();var fs_extra=require(_0xe123('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe123('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xe123('0x7')]('/',auth[_0xe123('0x8')](),controller[_0xe123('0x9')]);router['get']('/describe',auth[_0xe123('0x8')](),controller[_0xe123('0xa')]);router[_0xe123('0x7')](_0xe123('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe123('0xc')]);router[_0xe123('0xd')](_0xe123('0xb'),auth[_0xe123('0x8')](),controller[_0xe123('0xe')]);router['delete'](_0xe123('0xb'),auth[_0xe123('0x8')](),controller['destroy']);module[_0xe123('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6ca0d17..f274114 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b20=['STRING','sequelize','exports','TEXT'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x6b20,0xd1));var _0x06b2=function(_0x233ab7,_0x5629c5){_0x233ab7=_0x233ab7-0x0;var _0x420be7=_0x6b20[_0x233ab7];return _0x420be7;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0x06b2('0x2')]('long')},'membername':{'type':Sequelize[_0x06b2('0x3')]},'projectname':{'type':Sequelize[_0x06b2('0x3')]},'queue':{'type':Sequelize[_0x06b2('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x06b2('0x3')]},'calleridnum':{'type':Sequelize[_0x06b2('0x3')]},'questionId':{'type':Sequelize[_0x06b2('0x3')]}}; \ No newline at end of file +var _0xa5fa=['exports','TEXT','long','STRING'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5534ce,_0x26ef5e){_0x5534ce=_0x5534ce-0x0;var _0x33042b=_0xa5fa[_0x5534ce];return _0x33042b;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'question':{'type':Sequelize[_0xaa5f('0x1')]},'answer':{'type':Sequelize[_0xaa5f('0x1')](_0xaa5f('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xaa5f('0x3')]},'queue':{'type':Sequelize[_0xaa5f('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaa5f('0x3')]},'calleridnum':{'type':Sequelize[_0xaa5f('0x3')]},'questionId':{'type':Sequelize[_0xaa5f('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 237a60c..5a7c86e 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c6d=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','render','merge','body','contact','message','agent','interaction','account','index','map','JscriptyAnswerReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset'];(function(_0x2cdf43,_0xca4d44){var _0x5b39e1=function(_0x5ebcc1){while(--_0x5ebcc1){_0x2cdf43['push'](_0x2cdf43['shift']());}};_0x5b39e1(++_0xca4d44);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x500786,_0x5462b9){_0x500786=_0x500786-0x0;var _0x24468d=_0x4c6d[_0x500786];return _0x24468d;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require('moment');var BPromise=require(_0xd4c6('0x5'));var Mustache=require(_0xd4c6('0x6'));var util=require(_0xd4c6('0x7'));var path=require('path');var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4c6('0xa'));var _=require(_0xd4c6('0xb'));var squel=require(_0xd4c6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xd'));var deskjs=require(_0xd4c6('0xe'));var toCsv=require(_0xd4c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd4c6('0xf'));var Redis=require(_0xd4c6('0x10'));var authService=require(_0xd4c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require(_0xd4c6('0x16'));var config=require(_0xd4c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b902,_0x489171){_0x489171=_0x489171||0xcc;return function(_0x162681){if(_0x162681){return _0x35b902[_0xd4c6('0x18')](_0x489171);}return _0x35b902[_0xd4c6('0x19')](_0x489171)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x3a2143,_0x384a98){_0x384a98=_0x384a98||0xc8;return function(_0x94f42e){if(_0x94f42e){return _0x3a2143['status'](_0x384a98)['json'](_0x94f42e);}};}function respondWithFilteredResult(_0x11e6c2,_0x3deb85){return function(_0x25e1fb){if(_0x25e1fb){var _0x25204d=typeof _0x3deb85[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x3deb85[_0xd4c6('0x1d')]==='undefined';var _0x761a3e=_0x25e1fb[_0xd4c6('0x1e')];var _0x23a16f=_0x25204d?0x0:_0x3deb85[_0xd4c6('0x1b')];var _0x31f328=_0x25204d?_0x25e1fb['count']:_0x3deb85[_0xd4c6('0x1b')]+_0x3deb85[_0xd4c6('0x1d')];var _0x359577;if(_0x31f328>=_0x761a3e){_0x31f328=_0x761a3e;_0x359577=0xc8;}else{_0x359577=0xce;}_0x11e6c2['status'](_0x359577);return _0x11e6c2[_0xd4c6('0x1f')](_0xd4c6('0x20'),_0x23a16f+'-'+_0x31f328+'/'+_0x761a3e)[_0xd4c6('0x21')](_0x25e1fb);}return null;};}function patchUpdates(_0x3b1658){return function(_0x48dbf8){try{jsonpatch[_0xd4c6('0x22')](_0x48dbf8,_0x3b1658,!![]);}catch(_0x4a10d8){return BPromise[_0xd4c6('0x23')](_0x4a10d8);}return _0x48dbf8[_0xd4c6('0x24')]();};}function saveUpdates(_0x2750c9,_0x222813){return function(_0xf536e0){if(_0xf536e0){return _0xf536e0[_0xd4c6('0x25')](_0x2750c9)[_0xd4c6('0x26')](function(_0x3f99e8){return _0x3f99e8;});}return null;};}function removeEntity(_0x155cb3,_0x466330){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0xd4c6('0x27')]()['then'](function(){_0x155cb3['status'](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x2febbf,_0x4a5390){return function(_0x1dee19){if(!_0x1dee19){_0x2febbf[_0xd4c6('0x18')](0x194);}return _0x1dee19;};}function handleError(_0x100411,_0x565b25){_0x565b25=_0x565b25||0x1f4;return function(_0x35b50c){logger[_0xd4c6('0x28')](_0x35b50c['stack']);if(_0x35b50c[_0xd4c6('0x29')]){delete _0x35b50c[_0xd4c6('0x29')];}_0x100411[_0xd4c6('0x19')](_0x565b25)['send'](_0x35b50c);};}function getMustacheRender(_0x3ce942,_0x3b656d){return Mustache[_0xd4c6('0x2a')](_0x3ce942,_[_0xd4c6('0x2b')](_0x3b656d[_0xd4c6('0x2c')],{'contact':_0x3b656d[_0xd4c6('0x2d')],'message':_0x3b656d[_0xd4c6('0x2e')],'agent':_0x3b656d[_0xd4c6('0x2f')],'interaction':_0x3b656d[_0xd4c6('0x30')],'account':_0x3b656d[_0xd4c6('0x31')]}))||'';}exports[_0xd4c6('0x32')]=function(_0x31e3d0,_0x15d312){var _0x112969={},_0x5d7997={},_0x25229b={'count':0x0,'rows':[]};var _0x334f2a=_[_0xd4c6('0x33')](db[_0xd4c6('0x34')]['rawAttributes'],function(_0x4f8a76){return{'name':_0x4f8a76['fieldName'],'type':_0x4f8a76[_0xd4c6('0x35')][_0xd4c6('0x36')]};});_0x5d7997[_0xd4c6('0x37')]=_[_0xd4c6('0x33')](_0x334f2a,_0xd4c6('0x29'));_0x5d7997[_0xd4c6('0x38')]=_[_0xd4c6('0x39')](_0x31e3d0['query']);_0x5d7997[_0xd4c6('0x3a')]=_[_0xd4c6('0x3b')](_0x5d7997[_0xd4c6('0x37')],_0x5d7997['query']);_0x112969[_0xd4c6('0x3c')]=_[_0xd4c6('0x3b')](_0x5d7997[_0xd4c6('0x37')],qs['fields'](_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x3d')]));_0x112969[_0xd4c6('0x3c')]=_0x112969[_0xd4c6('0x3c')]['length']?_0x112969[_0xd4c6('0x3c')]:_0x5d7997[_0xd4c6('0x37')];if(!_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x3e')](_0xd4c6('0x3f'))){_0x112969['limit']=qs[_0xd4c6('0x1d')](_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x1d')]);_0x112969[_0xd4c6('0x1b')]=qs[_0xd4c6('0x1b')](_0x31e3d0[_0xd4c6('0x38')]['offset']);}_0x112969[_0xd4c6('0x40')]=qs[_0xd4c6('0x41')](_0x31e3d0[_0xd4c6('0x38')]['sort']);_0x112969[_0xd4c6('0x42')]=qs[_0xd4c6('0x3a')](_[_0xd4c6('0x43')](_0x31e3d0[_0xd4c6('0x38')],_0x5d7997[_0xd4c6('0x3a')]),_0x334f2a);if(_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x44')]){_0x112969[_0xd4c6('0x42')]=_[_0xd4c6('0x2b')](_0x112969['where'],{'$or':_[_0xd4c6('0x33')](_0x334f2a,function(_0x47e104){if(_0x47e104['type']!==_0xd4c6('0x45')){var _0x409c11={};_0x409c11[_0x47e104[_0xd4c6('0x29')]]={'$like':'%'+_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x44')]+'%'};return _0x409c11;}})});}_0x112969=_['merge']({},_0x112969,_0x31e3d0['options']);var _0x38e3c2={'where':_0x112969[_0xd4c6('0x42')]};return db[_0xd4c6('0x34')][_0xd4c6('0x1e')](_0x38e3c2)['then'](function(_0x211d47){_0x25229b['count']=_0x211d47;if(_0x31e3d0[_0xd4c6('0x38')][_0xd4c6('0x46')]){_0x112969[_0xd4c6('0x47')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xd4c6('0x48')](_0x112969);})[_0xd4c6('0x26')](function(_0x313073){_0x25229b[_0xd4c6('0x49')]=_0x313073;return _0x25229b;})[_0xd4c6('0x26')](respondWithFilteredResult(_0x15d312,_0x112969))[_0xd4c6('0x4a')](handleError(_0x15d312,null));};exports[_0xd4c6('0x4b')]=function(_0x3beb89,_0x343d94){var _0x563c61={'raw':!![],'where':{'id':_0x3beb89[_0xd4c6('0x4c')]['id']}},_0x1333f4={};_0x1333f4[_0xd4c6('0x37')]=_['keys'](db[_0xd4c6('0x34')][_0xd4c6('0x4d')]);_0x1333f4[_0xd4c6('0x38')]=_['keys'](_0x3beb89['query']);_0x1333f4[_0xd4c6('0x3a')]=_[_0xd4c6('0x3b')](_0x1333f4[_0xd4c6('0x37')],_0x1333f4['query']);_0x563c61[_0xd4c6('0x3c')]=_[_0xd4c6('0x3b')](_0x1333f4[_0xd4c6('0x37')],qs[_0xd4c6('0x3d')](_0x3beb89[_0xd4c6('0x38')][_0xd4c6('0x3d')]));_0x563c61['attributes']=_0x563c61[_0xd4c6('0x3c')][_0xd4c6('0x4e')]?_0x563c61[_0xd4c6('0x3c')]:_0x1333f4[_0xd4c6('0x37')];if(_0x3beb89[_0xd4c6('0x38')][_0xd4c6('0x46')]){_0x563c61[_0xd4c6('0x47')]=[{'all':!![]}];}_0x563c61=_[_0xd4c6('0x2b')]({},_0x563c61,_0x3beb89['options']);return db['JscriptyAnswerReport'][_0xd4c6('0x4f')](_0x563c61)[_0xd4c6('0x26')](handleEntityNotFound(_0x343d94,null))[_0xd4c6('0x26')](respondWithResult(_0x343d94,null))['catch'](handleError(_0x343d94,null));};exports[_0xd4c6('0x50')]=function(_0x400d66,_0x380bef){return db['JscriptyAnswerReport'][_0xd4c6('0x50')](_0x400d66[_0xd4c6('0x2c')],{})[_0xd4c6('0x26')](respondWithResult(_0x380bef,0xc9))[_0xd4c6('0x4a')](handleError(_0x380bef,null));};exports['update']=function(_0xf82f71,_0x175a59){if(_0xf82f71[_0xd4c6('0x2c')]['id']){delete _0xf82f71[_0xd4c6('0x2c')]['id'];}return db[_0xd4c6('0x34')][_0xd4c6('0x4f')]({'where':{'id':_0xf82f71[_0xd4c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x175a59,null))[_0xd4c6('0x26')](saveUpdates(_0xf82f71[_0xd4c6('0x2c')],null))[_0xd4c6('0x26')](respondWithResult(_0x175a59,null))['catch'](handleError(_0x175a59,null));};exports[_0xd4c6('0x27')]=function(_0x1ca24a,_0x46bf10){return db[_0xd4c6('0x34')][_0xd4c6('0x4f')]({'where':{'id':_0x1ca24a[_0xd4c6('0x4c')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x46bf10,null))['then'](removeEntity(_0x46bf10,null))[_0xd4c6('0x4a')](handleError(_0x46bf10,null));};exports['describe']=function(_0x4b56b2,_0x435189){return db['JscriptyAnswerReport'][_0xd4c6('0x51')]()['then'](respondWithResult(_0x435189,null))[_0xd4c6('0x4a')](handleError(_0x435189,null));}; \ No newline at end of file +var _0xcea2=['fields','attributes','length','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','update','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','render','body','contact','message','agent','account','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','filters','intersection'];(function(_0x520ea8,_0x53f5f6){var _0x4c1cfb=function(_0x28a2ad){while(--_0x28a2ad){_0x520ea8['push'](_0x520ea8['shift']());}};_0x4c1cfb(++_0x53f5f6);}(_0xcea2,0x15a));var _0x2cea=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xcea2[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require(_0x2cea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cea('0x2'));var moment=require(_0x2cea('0x3'));var BPromise=require(_0x2cea('0x4'));var Mustache=require('mustache');var util=require(_0x2cea('0x5'));var path=require(_0x2cea('0x6'));var sox=require(_0x2cea('0x7'));var csv=require('to-csv');var ejs=require(_0x2cea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0xe'));var querystring=require('querystring');var Papa=require(_0x2cea('0xf'));var Redis=require(_0x2cea('0x10'));var authService=require(_0x2cea('0x11'));var qs=require(_0x2cea('0x12'));var as=require(_0x2cea('0x13'));var hardwareService=require(_0x2cea('0x14'));var logger=require(_0x2cea('0x15'))(_0x2cea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cea('0x17'));var db=require(_0x2cea('0x18'))['db'];function respondWithStatusCode(_0x528c1d,_0x4bd265){_0x4bd265=_0x4bd265||0xcc;return function(_0x160eaf){if(_0x160eaf){return _0x528c1d['sendStatus'](_0x4bd265);}return _0x528c1d[_0x2cea('0x19')](_0x4bd265)[_0x2cea('0x1a')]();};}function respondWithResult(_0x4377b1,_0x5cf805){_0x5cf805=_0x5cf805||0xc8;return function(_0x4d7f8b){if(_0x4d7f8b){return _0x4377b1['status'](_0x5cf805)[_0x2cea('0x1b')](_0x4d7f8b);}};}function respondWithFilteredResult(_0x586ad5,_0x3c7130){return function(_0x338669){if(_0x338669){var _0x981e3f=typeof _0x3c7130[_0x2cea('0x1c')]===_0x2cea('0x1d')&&typeof _0x3c7130[_0x2cea('0x1e')]===_0x2cea('0x1d');var _0x1ead4c=_0x338669['count'];var _0x19927a=_0x981e3f?0x0:_0x3c7130[_0x2cea('0x1c')];var _0x20c46c=_0x981e3f?_0x338669[_0x2cea('0x1f')]:_0x3c7130[_0x2cea('0x1c')]+_0x3c7130[_0x2cea('0x1e')];var _0x5d75c4;if(_0x20c46c>=_0x1ead4c){_0x20c46c=_0x1ead4c;_0x5d75c4=0xc8;}else{_0x5d75c4=0xce;}_0x586ad5[_0x2cea('0x19')](_0x5d75c4);return _0x586ad5['set'](_0x2cea('0x20'),_0x19927a+'-'+_0x20c46c+'/'+_0x1ead4c)[_0x2cea('0x1b')](_0x338669);}return null;};}function patchUpdates(_0xa73bea){return function(_0x4fd3d5){try{jsonpatch[_0x2cea('0x21')](_0x4fd3d5,_0xa73bea,!![]);}catch(_0x22249e){return BPromise[_0x2cea('0x22')](_0x22249e);}return _0x4fd3d5[_0x2cea('0x23')]();};}function saveUpdates(_0x3246bc,_0x3f6f0e){return function(_0x10f13a){if(_0x10f13a){return _0x10f13a['update'](_0x3246bc)[_0x2cea('0x24')](function(_0x5e5b46){return _0x5e5b46;});}return null;};}function removeEntity(_0x7d88b9,_0x4926ff){return function(_0x3966d5){if(_0x3966d5){return _0x3966d5[_0x2cea('0x25')]()['then'](function(){_0x7d88b9[_0x2cea('0x19')](0xcc)[_0x2cea('0x1a')]();});}};}function handleEntityNotFound(_0x101314,_0xf0bfbe){return function(_0x3f3ee0){if(!_0x3f3ee0){_0x101314[_0x2cea('0x26')](0x194);}return _0x3f3ee0;};}function handleError(_0x5d032f,_0x4ec9b3){_0x4ec9b3=_0x4ec9b3||0x1f4;return function(_0x32b6a3){logger[_0x2cea('0x27')](_0x32b6a3[_0x2cea('0x28')]);if(_0x32b6a3[_0x2cea('0x29')]){delete _0x32b6a3[_0x2cea('0x29')];}_0x5d032f[_0x2cea('0x19')](_0x4ec9b3)[_0x2cea('0x2a')](_0x32b6a3);};}function getMustacheRender(_0x4e9cab,_0xff69ad){return Mustache[_0x2cea('0x2b')](_0x4e9cab,_['merge'](_0xff69ad[_0x2cea('0x2c')],{'contact':_0xff69ad[_0x2cea('0x2d')],'message':_0xff69ad[_0x2cea('0x2e')],'agent':_0xff69ad[_0x2cea('0x2f')],'interaction':_0xff69ad['interaction'],'account':_0xff69ad[_0x2cea('0x30')]}))||'';}exports[_0x2cea('0x31')]=function(_0x4a51e5,_0x2bf4e9){var _0x2e3d44={},_0xa8f660={},_0x393d30={'count':0x0,'rows':[]};var _0x2ce788=_[_0x2cea('0x32')](db[_0x2cea('0x33')][_0x2cea('0x34')],function(_0x2e1cd6){return{'name':_0x2e1cd6[_0x2cea('0x35')],'type':_0x2e1cd6[_0x2cea('0x36')]['key']};});_0xa8f660[_0x2cea('0x37')]=_[_0x2cea('0x32')](_0x2ce788,_0x2cea('0x29'));_0xa8f660[_0x2cea('0x38')]=_['keys'](_0x4a51e5['query']);_0xa8f660[_0x2cea('0x39')]=_[_0x2cea('0x3a')](_0xa8f660['model'],_0xa8f660[_0x2cea('0x38')]);_0x2e3d44['attributes']=_[_0x2cea('0x3a')](_0xa8f660['model'],qs[_0x2cea('0x3b')](_0x4a51e5['query'][_0x2cea('0x3b')]));_0x2e3d44[_0x2cea('0x3c')]=_0x2e3d44['attributes'][_0x2cea('0x3d')]?_0x2e3d44[_0x2cea('0x3c')]:_0xa8f660['model'];if(!_0x4a51e5[_0x2cea('0x38')][_0x2cea('0x3e')](_0x2cea('0x3f'))){_0x2e3d44[_0x2cea('0x1e')]=qs[_0x2cea('0x1e')](_0x4a51e5['query'][_0x2cea('0x1e')]);_0x2e3d44[_0x2cea('0x1c')]=qs['offset'](_0x4a51e5['query'][_0x2cea('0x1c')]);}_0x2e3d44['order']=qs['sort'](_0x4a51e5['query']['sort']);_0x2e3d44[_0x2cea('0x40')]=qs[_0x2cea('0x39')](_['pick'](_0x4a51e5[_0x2cea('0x38')],_0xa8f660[_0x2cea('0x39')]),_0x2ce788);if(_0x4a51e5[_0x2cea('0x38')]['filter']){_0x2e3d44[_0x2cea('0x40')]=_[_0x2cea('0x41')](_0x2e3d44[_0x2cea('0x40')],{'$or':_[_0x2cea('0x32')](_0x2ce788,function(_0x167e40){if(_0x167e40[_0x2cea('0x36')]!==_0x2cea('0x42')){var _0xdcec25={};_0xdcec25[_0x167e40[_0x2cea('0x29')]]={'$like':'%'+_0x4a51e5[_0x2cea('0x38')][_0x2cea('0x43')]+'%'};return _0xdcec25;}})});}_0x2e3d44=_[_0x2cea('0x41')]({},_0x2e3d44,_0x4a51e5[_0x2cea('0x44')]);var _0x22a002={'where':_0x2e3d44[_0x2cea('0x40')]};return db[_0x2cea('0x33')][_0x2cea('0x1f')](_0x22a002)[_0x2cea('0x24')](function(_0x49fcfa){_0x393d30[_0x2cea('0x1f')]=_0x49fcfa;if(_0x4a51e5['query'][_0x2cea('0x45')]){_0x2e3d44[_0x2cea('0x46')]=[{'all':!![]}];}return db[_0x2cea('0x33')][_0x2cea('0x47')](_0x2e3d44);})[_0x2cea('0x24')](function(_0x2edcfa){_0x393d30[_0x2cea('0x48')]=_0x2edcfa;return _0x393d30;})[_0x2cea('0x24')](respondWithFilteredResult(_0x2bf4e9,_0x2e3d44))[_0x2cea('0x49')](handleError(_0x2bf4e9,null));};exports[_0x2cea('0x4a')]=function(_0x4ac055,_0x515494){var _0x1be683={'raw':!![],'where':{'id':_0x4ac055['params']['id']}},_0x370438={};_0x370438[_0x2cea('0x37')]=_['keys'](db[_0x2cea('0x33')]['rawAttributes']);_0x370438[_0x2cea('0x38')]=_[_0x2cea('0x4b')](_0x4ac055[_0x2cea('0x38')]);_0x370438[_0x2cea('0x39')]=_[_0x2cea('0x3a')](_0x370438[_0x2cea('0x37')],_0x370438[_0x2cea('0x38')]);_0x1be683[_0x2cea('0x3c')]=_[_0x2cea('0x3a')](_0x370438[_0x2cea('0x37')],qs['fields'](_0x4ac055[_0x2cea('0x38')][_0x2cea('0x3b')]));_0x1be683[_0x2cea('0x3c')]=_0x1be683[_0x2cea('0x3c')]['length']?_0x1be683['attributes']:_0x370438[_0x2cea('0x37')];if(_0x4ac055[_0x2cea('0x38')][_0x2cea('0x45')]){_0x1be683['include']=[{'all':!![]}];}_0x1be683=_[_0x2cea('0x41')]({},_0x1be683,_0x4ac055[_0x2cea('0x44')]);return db[_0x2cea('0x33')][_0x2cea('0x4c')](_0x1be683)['then'](handleEntityNotFound(_0x515494,null))[_0x2cea('0x24')](respondWithResult(_0x515494,null))['catch'](handleError(_0x515494,null));};exports['create']=function(_0x42379a,_0x8a8cae){return db[_0x2cea('0x33')][_0x2cea('0x4d')](_0x42379a['body'],{})['then'](respondWithResult(_0x8a8cae,0xc9))[_0x2cea('0x49')](handleError(_0x8a8cae,null));};exports[_0x2cea('0x4e')]=function(_0x464b89,_0x1cbc0e){if(_0x464b89['body']['id']){delete _0x464b89['body']['id'];}return db['JscriptyAnswerReport'][_0x2cea('0x4c')]({'where':{'id':_0x464b89[_0x2cea('0x4f')]['id']}})[_0x2cea('0x24')](handleEntityNotFound(_0x1cbc0e,null))[_0x2cea('0x24')](saveUpdates(_0x464b89[_0x2cea('0x2c')],null))[_0x2cea('0x24')](respondWithResult(_0x1cbc0e,null))[_0x2cea('0x49')](handleError(_0x1cbc0e,null));};exports['destroy']=function(_0x3f0fd0,_0x39937e){return db[_0x2cea('0x33')]['find']({'where':{'id':_0x3f0fd0[_0x2cea('0x4f')]['id']}})['then'](handleEntityNotFound(_0x39937e,null))[_0x2cea('0x24')](removeEntity(_0x39937e,null))[_0x2cea('0x49')](handleError(_0x39937e,null));};exports[_0x2cea('0x50')]=function(_0xc8a4b5,_0x280483){return db[_0x2cea('0x33')][_0x2cea('0x50')]()[_0x2cea('0x24')](respondWithResult(_0x280483,null))['catch'](handleError(_0x280483,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3c9262a..d1aafb8 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc775=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','path','./jscriptyAnswerReport.attributes','define'];(function(_0x3a8b76,_0x3f124b){var _0x48c78a=function(_0x251730){while(--_0x251730){_0x3a8b76['push'](_0x3a8b76['shift']());}};_0x48c78a(++_0x3f124b);}(_0xc775,0x183));var _0x5c77=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc775[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5c77('0x0'));var util=require(_0x5c77('0x1'));var logger=require(_0x5c77('0x2'))(_0x5c77('0x3'));var moment=require(_0x5c77('0x4'));var BPromise=require(_0x5c77('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c77('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5c77('0x7'));module['exports']=function(_0x13971d,_0x224603){return _0x13971d[_0x5c77('0x8')](_0x5c77('0x9'),attributes,{'tableName':_0x5c77('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab99=['request-promise','path','rimraf','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1971a2,_0x327374){var _0x4ea5ed=function(_0x733f12){while(--_0x733f12){_0x1971a2['push'](_0x1971a2['shift']());}};_0x4ea5ed(++_0x327374);}(_0xab99,0x94));var _0x9ab9=function(_0x4b87c6,_0x11c1d7){_0x4b87c6=_0x4b87c6-0x0;var _0xf9af87=_0xab99[_0x4b87c6];return _0xf9af87;};'use strict';var _=require(_0x9ab9('0x0'));var util=require(_0x9ab9('0x1'));var logger=require(_0x9ab9('0x2'))(_0x9ab9('0x3'));var moment=require(_0x9ab9('0x4'));var BPromise=require(_0x9ab9('0x5'));var rp=require(_0x9ab9('0x6'));var fs=require('fs');var path=require(_0x9ab9('0x7'));var rimraf=require(_0x9ab9('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x9ab9('0x9')]=function(_0x22a4e9,_0x50f127){return _0x22a4e9[_0x9ab9('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index bbefb6d..e846bd4 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb874=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2c072a,_0x426a24){var _0x1c1615=function(_0x189069){while(--_0x189069){_0x2c072a['push'](_0x2c072a['shift']());}};_0x1c1615(++_0x426a24);}(_0xb874,0x171));var _0x4b87=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb874[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4b87('0x0'));var util=require(_0x4b87('0x1'));var moment=require(_0x4b87('0x2'));var BPromise=require(_0x4b87('0x3'));var rs=require(_0x4b87('0x4'));var fs=require('fs');var Redis=require(_0x4b87('0x5'));var db=require(_0x4b87('0x6'))['db'];var utils=require(_0x4b87('0x7'));var logger=require('../../config/logger')(_0x4b87('0x8'));var config=require(_0x4b87('0x9'));var jayson=require(_0x4b87('0xa'));var client=jayson[_0x4b87('0xb')][_0x4b87('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d00e4,_0x13791a,_0x45f652){return new BPromise(function(_0x28e730,_0xbbb056){return client[_0x4b87('0xd')](_0x2d00e4,_0x45f652)[_0x4b87('0xe')](function(_0x3b4b07){logger['info'](_0x4b87('0xf'),_0x13791a,_0x4b87('0x10'));logger['debug'](_0x4b87('0x11'),_0x13791a,_0x4b87('0x10'),JSON[_0x4b87('0x12')](_0x3b4b07));if(_0x3b4b07[_0x4b87('0x13')]){if(_0x3b4b07['error'][_0x4b87('0x14')]===0x1f4){logger[_0x4b87('0x13')](_0x4b87('0xf'),_0x13791a,_0x3b4b07[_0x4b87('0x13')]['message']);return _0xbbb056(_0x3b4b07['error'][_0x4b87('0x15')]);}logger['error'](_0x4b87('0xf'),_0x13791a,_0x3b4b07['error'][_0x4b87('0x15')]);return _0x28e730(_0x3b4b07[_0x4b87('0x13')][_0x4b87('0x15')]);}else{logger[_0x4b87('0x16')](_0x4b87('0xf'),_0x13791a,'request\x20sent');_0x28e730(_0x3b4b07[_0x4b87('0x17')][_0x4b87('0x15')]);}})['catch'](function(_0xbd2307){logger[_0x4b87('0x13')](_0x4b87('0xf'),_0x13791a,_0xbd2307);_0xbbb056(_0xbd2307);});});} \ No newline at end of file +var _0xbe9a=['message','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x27842c,_0x324fcb){var _0x493de8=function(_0x1f6c85){while(--_0x1f6c85){_0x27842c['push'](_0x27842c['shift']());}};_0x493de8(++_0x324fcb);}(_0xbe9a,0x105));var _0xabe9=function(_0x433ebd,_0x1333bc){_0x433ebd=_0x433ebd-0x0;var _0x2e2ea7=_0xbe9a[_0x433ebd];return _0x2e2ea7;};'use strict';var _=require('lodash');var util=require(_0xabe9('0x0'));var moment=require(_0xabe9('0x1'));var BPromise=require(_0xabe9('0x2'));var rs=require(_0xabe9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabe9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xabe9('0x5'))(_0xabe9('0x6'));var config=require(_0xabe9('0x7'));var jayson=require(_0xabe9('0x8'));var client=jayson[_0xabe9('0x9')][_0xabe9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe0fa9,_0x394302,_0x13b82e){return new BPromise(function(_0x18fd87,_0x49f3eb){return client['request'](_0xe0fa9,_0x13b82e)[_0xabe9('0xb')](function(_0x3e932b){logger[_0xabe9('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x394302,_0xabe9('0xd'));logger['debug'](_0xabe9('0xe'),_0x394302,'request\x20sent',JSON[_0xabe9('0xf')](_0x3e932b));if(_0x3e932b[_0xabe9('0x10')]){if(_0x3e932b['error'][_0xabe9('0x11')]===0x1f4){logger[_0xabe9('0x10')](_0xabe9('0x12'),_0x394302,_0x3e932b[_0xabe9('0x10')][_0xabe9('0x13')]);return _0x49f3eb(_0x3e932b['error'][_0xabe9('0x13')]);}logger[_0xabe9('0x10')](_0xabe9('0x12'),_0x394302,_0x3e932b[_0xabe9('0x10')][_0xabe9('0x13')]);return _0x18fd87(_0x3e932b[_0xabe9('0x10')][_0xabe9('0x13')]);}else{logger[_0xabe9('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x394302,_0xabe9('0xd'));_0x18fd87(_0x3e932b['result']['message']);}})['catch'](function(_0x4abf98){logger[_0xabe9('0x10')](_0xabe9('0x12'),_0x394302,_0x4abf98);_0x49f3eb(_0x4abf98);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index af0ea75..a9a4ddd 100644 --- a/server/api/jscriptyProject/index.js +++ b/server/api/jscriptyProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeb3=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','post','create','put','/:id','delete','destroy','exports','util'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0x3deb('0x0'));var path=require(_0x3deb('0x1'));var timeout=require(_0x3deb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3deb('0x3'));var auth=require(_0x3deb('0x4'));var interaction=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var controller=require(_0x3deb('0x7'));router['get']('/',auth[_0x3deb('0x8')](),controller['index']);router[_0x3deb('0x9')]('/:id',auth[_0x3deb('0x8')](),controller[_0x3deb('0xa')]);router[_0x3deb('0x9')](_0x3deb('0xb'),auth[_0x3deb('0x8')](),controller[_0x3deb('0xc')]);router[_0x3deb('0x9')](_0x3deb('0xd'),auth[_0x3deb('0x8')](),controller['getAnswers']);router['get'](_0x3deb('0xe'),auth[_0x3deb('0x8')](),timeout(_0x3deb('0xf')),controller['getSummary']);router[_0x3deb('0x10')]('/',auth[_0x3deb('0x8')](),controller[_0x3deb('0x11')]);router[_0x3deb('0x10')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x3deb('0x12')](_0x3deb('0x13'),auth[_0x3deb('0x8')](),controller['update']);router[_0x3deb('0x14')](_0x3deb('0x13'),auth['isAuthenticated'](),controller[_0x3deb('0x15')]);module[_0x3deb('0x16')]=router; \ No newline at end of file +var _0xbbbc=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getAnswers','/:id/summary','30s','getSummary','post','clone','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x5100f5,_0x97767b){var _0x25b890=function(_0xabfbd7){while(--_0xabfbd7){_0x5100f5['push'](_0x5100f5['shift']());}};_0x25b890(++_0x97767b);}(_0xbbbc,0xf6));var _0xcbbb=function(_0xd655a4,_0x307c48){_0xd655a4=_0xd655a4-0x0;var _0x4a0e92=_0xbbbc[_0xd655a4];return _0x4a0e92;};'use strict';var multer=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var path=require(_0xcbbb('0x2'));var timeout=require(_0xcbbb('0x3'));var express=require(_0xcbbb('0x4'));var router=express[_0xcbbb('0x5')]();var fs_extra=require(_0xcbbb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var controller=require(_0xcbbb('0x9'));router[_0xcbbb('0xa')]('/',auth[_0xcbbb('0xb')](),controller['index']);router[_0xcbbb('0xa')](_0xcbbb('0xc'),auth[_0xcbbb('0xb')](),controller[_0xcbbb('0xd')]);router[_0xcbbb('0xa')](_0xcbbb('0xe'),auth[_0xcbbb('0xb')](),controller['getSessions']);router[_0xcbbb('0xa')]('/:id/answers',auth['isAuthenticated'](),controller[_0xcbbb('0xf')]);router['get'](_0xcbbb('0x10'),auth['isAuthenticated'](),timeout(_0xcbbb('0x11')),controller[_0xcbbb('0x12')]);router['post']('/',auth[_0xcbbb('0xb')](),controller['create']);router[_0xcbbb('0x13')]('/:id/clone',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x14')]);router[_0xcbbb('0x15')]('/:id',auth[_0xcbbb('0xb')](),controller[_0xcbbb('0x16')]);router[_0xcbbb('0x17')](_0xcbbb('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcbbb('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c5af67b..ede63c8 100644 --- a/server/api/jscriptyProject/jscriptyProject.attributes.js +++ b/server/api/jscriptyProject/jscriptyProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeef6=['util','exports','name','TEXT','long','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x349530,_0x45d85e){var _0x373ed4=function(_0x2a1f1e){while(--_0x2a1f1e){_0x349530['push'](_0x349530['shift']());}};_0x373ed4(++_0x45d85e);}(_0xeef6,0x137));var _0x6eef=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xeef6[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x6eef('0x0'));var _=require('lodash');var util=require(_0x6eef('0x1'));module[_0x6eef('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x6eef('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6eef('0x4')](_0x6eef('0x5')),'set':function(_0x2cd763){if(_['isObjectLike'](_0x2cd763)){this[_0x6eef('0x6')](_0x6eef('0x7'),JSON['stringify'](_0x2cd763));}else if(_['isString'](_0x2cd763)){this[_0x6eef('0x6')](_0x6eef('0x7'),_0x2cd763);}else{this['setDataValue']('formData',util[_0x6eef('0x8')](_0x6eef('0x9'),this[_0x6eef('0xa')](_0x6eef('0x3'))||'',this[_0x6eef('0xa')](_0x6eef('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6eef('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0xcbf9=['formData','stringify','isString','format','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcbf9,0x117));var _0x9cbf=function(_0x26236c,_0x56ca64){_0x26236c=_0x26236c-0x0;var _0x5311e9=_0xcbf9[_0x26236c];return _0x5311e9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9cbf('0x0'));var util=require(_0x9cbf('0x1'));module[_0x9cbf('0x2')]={'name':{'type':Sequelize[_0x9cbf('0x3')],'unique':_0x9cbf('0x4')},'description':{'type':Sequelize[_0x9cbf('0x3')]},'formData':{'type':Sequelize[_0x9cbf('0x5')](_0x9cbf('0x6')),'set':function(_0x583b03){if(_[_0x9cbf('0x7')](_0x583b03)){this[_0x9cbf('0x8')](_0x9cbf('0x9'),JSON[_0x9cbf('0xa')](_0x583b03));}else if(_[_0x9cbf('0xb')](_0x583b03)){this['setDataValue'](_0x9cbf('0x9'),_0x583b03);}else{this[_0x9cbf('0x8')](_0x9cbf('0x9'),util[_0x9cbf('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x9cbf('0xd')]('name')||'',this[_0x9cbf('0xd')](_0x9cbf('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9cbf('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9cbf('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e204464..2830577 100644 --- a/server/api/jscriptyProject/jscriptyProject.controller.js +++ b/server/api/jscriptyProject/jscriptyProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0047=['text/csv','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','rows','show','params','length','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','sort','pick','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv'];(function(_0x4b8257,_0x547b98){var _0x3cb919=function(_0x194390){while(--_0x194390){_0x4b8257['push'](_0x4b8257['shift']());}};_0x3cb919(++_0x547b98);}(_0x0047,0x187));var _0x7004=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x0047[_0x1314d4];return _0x584ba5;};'use strict';var emlformat=require(_0x7004('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7004('0x1'));var jsonpatch=require(_0x7004('0x2'));var rp=require(_0x7004('0x3'));var moment=require(_0x7004('0x4'));var BPromise=require(_0x7004('0x5'));var Mustache=require(_0x7004('0x6'));var util=require(_0x7004('0x7'));var path=require(_0x7004('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7004('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7004('0xa'));var squel=require(_0x7004('0xb'));var crypto=require('crypto');var jsforce=require(_0x7004('0xc'));var deskjs=require(_0x7004('0xd'));var toCsv=require(_0x7004('0xe'));var querystring=require(_0x7004('0xf'));var Papa=require(_0x7004('0x10'));var Redis=require(_0x7004('0x11'));var authService=require(_0x7004('0x12'));var qs=require(_0x7004('0x13'));var as=require(_0x7004('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7004('0x15'))(_0x7004('0x16'));var utils=require('../../config/utils');var config=require(_0x7004('0x17'));var licenseUtil=require(_0x7004('0x18'));var db=require(_0x7004('0x19'))['db'];function respondWithStatusCode(_0x4e8d0e,_0x59ae01){_0x59ae01=_0x59ae01||0xcc;return function(_0x583a67){if(_0x583a67){return _0x4e8d0e[_0x7004('0x1a')](_0x59ae01);}return _0x4e8d0e['status'](_0x59ae01)[_0x7004('0x1b')]();};}function respondWithResult(_0x4a4e82,_0x5bff7a){_0x5bff7a=_0x5bff7a||0xc8;return function(_0x1a4fa8){if(_0x1a4fa8){return _0x4a4e82[_0x7004('0x1c')](_0x5bff7a)[_0x7004('0x1d')](_0x1a4fa8);}};}function respondWithFilteredResult(_0x229538,_0x5f1a4f){return function(_0x17707b){if(_0x17707b){var _0x2389cd=typeof _0x5f1a4f[_0x7004('0x1e')]===_0x7004('0x1f')&&typeof _0x5f1a4f[_0x7004('0x20')]===_0x7004('0x1f');var _0x45559f=_0x17707b[_0x7004('0x21')];var _0x2c623f=_0x2389cd?0x0:_0x5f1a4f['offset'];var _0x5e3f6a=_0x2389cd?_0x17707b['count']:_0x5f1a4f[_0x7004('0x1e')]+_0x5f1a4f[_0x7004('0x20')];var _0x58bbcd;if(_0x5e3f6a>=_0x45559f){_0x5e3f6a=_0x45559f;_0x58bbcd=0xc8;}else{_0x58bbcd=0xce;}_0x229538[_0x7004('0x1c')](_0x58bbcd);return _0x229538[_0x7004('0x22')](_0x7004('0x23'),_0x2c623f+'-'+_0x5e3f6a+'/'+_0x45559f)[_0x7004('0x1d')](_0x17707b);}return null;};}function patchUpdates(_0x5cc1c4){return function(_0x185de9){try{jsonpatch[_0x7004('0x24')](_0x185de9,_0x5cc1c4,!![]);}catch(_0x4dbd0b){return BPromise[_0x7004('0x25')](_0x4dbd0b);}return _0x185de9[_0x7004('0x26')]();};}function saveUpdates(_0x3feef5,_0x4e3045){return function(_0xc01587){if(_0xc01587){return _0xc01587[_0x7004('0x27')](_0x3feef5)[_0x7004('0x28')](function(_0x17303b){return _0x17303b;});}return null;};}function removeEntity(_0x15d679,_0x3c9311){return function(_0x1217de){if(_0x1217de){return _0x1217de[_0x7004('0x29')]()['then'](function(){var _0x42a4a2=_0x1217de[_0x7004('0x2a')]({'plain':!![]});var _0x124ad4='Projects';return db['UserProfileResource'][_0x7004('0x29')]({'where':{'type':_0x124ad4,'resourceId':_0x42a4a2['id']}})['then'](function(){return _0x1217de;});})['then'](function(){_0x15d679[_0x7004('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x558db0,_0x4aec39){return function(_0x1d5248){if(!_0x1d5248){_0x558db0[_0x7004('0x1a')](0x194);}return _0x1d5248;};}function handleError(_0x5a28f5,_0x49bcd2){_0x49bcd2=_0x49bcd2||0x1f4;return function(_0x265fda){logger[_0x7004('0x2b')](_0x265fda[_0x7004('0x2c')]);if(_0x265fda['name']){delete _0x265fda[_0x7004('0x2d')];}_0x5a28f5['status'](_0x49bcd2)[_0x7004('0x2e')](_0x265fda);};}function getMustacheRender(_0x5ba1f0,_0x4e7659){return Mustache[_0x7004('0x2f')](_0x5ba1f0,_[_0x7004('0x30')](_0x4e7659[_0x7004('0x31')],{'contact':_0x4e7659[_0x7004('0x32')],'message':_0x4e7659[_0x7004('0x33')],'agent':_0x4e7659[_0x7004('0x34')],'interaction':_0x4e7659[_0x7004('0x35')],'account':_0x4e7659[_0x7004('0x36')]}))||'';}exports['index']=function(_0x56faac,_0x2074b2){var _0x452292={},_0x447803={},_0x2ce5a4={'count':0x0,'rows':[]};var _0x22d2a7=_[_0x7004('0x37')](db['JscriptyProject'][_0x7004('0x38')],function(_0x2deda3){return{'name':_0x2deda3[_0x7004('0x39')],'type':_0x2deda3[_0x7004('0x3a')][_0x7004('0x3b')]};});_0x447803['model']=_['map'](_0x22d2a7,'name');_0x447803[_0x7004('0x3c')]=_[_0x7004('0x3d')](_0x56faac[_0x7004('0x3c')]);_0x447803[_0x7004('0x3e')]=_[_0x7004('0x3f')](_0x447803['model'],_0x447803['query']);_0x452292['attributes']=_[_0x7004('0x3f')](_0x447803[_0x7004('0x40')],qs[_0x7004('0x41')](_0x56faac[_0x7004('0x3c')][_0x7004('0x41')]));_0x452292[_0x7004('0x42')]=_0x452292['attributes']['length']?_0x452292[_0x7004('0x42')]:_0x447803[_0x7004('0x40')];if(!_0x56faac[_0x7004('0x3c')][_0x7004('0x43')](_0x7004('0x44'))){_0x452292['limit']=qs[_0x7004('0x20')](_0x56faac[_0x7004('0x3c')]['limit']);_0x452292['offset']=qs[_0x7004('0x1e')](_0x56faac[_0x7004('0x3c')][_0x7004('0x1e')]);}_0x452292[_0x7004('0x45')]=qs['sort'](_0x56faac[_0x7004('0x3c')]['sort']);_0x452292[_0x7004('0x46')]=qs[_0x7004('0x3e')](_['pick'](_0x56faac['query'],_0x447803[_0x7004('0x3e')]),_0x22d2a7);if(_0x56faac[_0x7004('0x3c')][_0x7004('0x47')]){_0x452292[_0x7004('0x46')]=_[_0x7004('0x30')](_0x452292[_0x7004('0x46')],{'$or':_[_0x7004('0x37')](_0x22d2a7,function(_0x2107e3){if(_0x2107e3[_0x7004('0x3a')]!==_0x7004('0x48')){var _0x49f289={};_0x49f289[_0x2107e3['name']]={'$like':'%'+_0x56faac[_0x7004('0x3c')]['filter']+'%'};return _0x49f289;}})});}_0x452292=_['merge']({},_0x452292,_0x56faac[_0x7004('0x49')]);var _0x34c6b9={'where':_0x452292[_0x7004('0x46')]};return db[_0x7004('0x4a')][_0x7004('0x21')](_0x34c6b9)[_0x7004('0x28')](function(_0x55d535){_0x2ce5a4[_0x7004('0x21')]=_0x55d535;if(_0x56faac[_0x7004('0x3c')][_0x7004('0x4b')]){_0x452292[_0x7004('0x4c')]=[{'all':!![]}];}return db[_0x7004('0x4a')][_0x7004('0x4d')](_0x452292);})[_0x7004('0x28')](function(_0x3f4419){_0x2ce5a4[_0x7004('0x4e')]=_0x3f4419;return _0x2ce5a4;})['then'](respondWithFilteredResult(_0x2074b2,_0x452292))['catch'](handleError(_0x2074b2,null));};exports[_0x7004('0x4f')]=function(_0xa97f6c,_0x2cbb92){var _0xa203f={'raw':![],'where':{'id':_0xa97f6c[_0x7004('0x50')]['id']}},_0x1813af={};_0x1813af['model']=_['keys'](db[_0x7004('0x4a')][_0x7004('0x38')]);_0x1813af[_0x7004('0x3c')]=_[_0x7004('0x3d')](_0xa97f6c['query']);_0x1813af['filters']=_['intersection'](_0x1813af['model'],_0x1813af['query']);_0xa203f[_0x7004('0x42')]=_[_0x7004('0x3f')](_0x1813af[_0x7004('0x40')],qs['fields'](_0xa97f6c[_0x7004('0x3c')][_0x7004('0x41')]));_0xa203f[_0x7004('0x42')]=_0xa203f[_0x7004('0x42')][_0x7004('0x51')]?_0xa203f[_0x7004('0x42')]:_0x1813af[_0x7004('0x40')];if(_0xa97f6c['query'][_0x7004('0x4b')]){_0xa203f['include']=[{'all':!![]}];}_0xa203f=_[_0x7004('0x30')]({},_0xa203f,_0xa97f6c['options']);return db[_0x7004('0x4a')]['find'](_0xa203f)['then'](handleEntityNotFound(_0x2cbb92,null))[_0x7004('0x28')](respondWithResult(_0x2cbb92,null))[_0x7004('0x52')](handleError(_0x2cbb92,null));};exports[_0x7004('0x53')]=function(_0x2c35e8,_0x20d386){return db['JscriptyProject'][_0x7004('0x53')](_0x2c35e8[_0x7004('0x31')],{})[_0x7004('0x28')](function(_0x596464){var _0x36e005=_0x2c35e8[_0x7004('0x54')]['get']({'plain':!![]});if(!_0x36e005)throw new Error(_0x7004('0x55'));if(_0x36e005['role']===_0x7004('0x54')){var _0x4e9154=_0x596464[_0x7004('0x2a')]({'plain':!![]});var _0x50d072=_0x7004('0x56');return db[_0x7004('0x57')][_0x7004('0x58')]({'where':{'name':_0x50d072,'userProfileId':_0x36e005[_0x7004('0x59')]},'raw':!![]})[_0x7004('0x28')](function(_0x35aa7f){if(_0x35aa7f&&_0x35aa7f[_0x7004('0x5a')]===0x0){return db[_0x7004('0x5b')]['create']({'name':_0x4e9154['name'],'resourceId':_0x4e9154['id'],'type':_0x35aa7f[_0x7004('0x2d')],'sectionId':_0x35aa7f['id']},{})['then'](function(){return _0x596464;});}else{return _0x596464;}})[_0x7004('0x52')](function(_0x5c9774){logger[_0x7004('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c9774);throw _0x5c9774;});}return _0x596464;})[_0x7004('0x28')](respondWithResult(_0x20d386,0xc9))[_0x7004('0x52')](handleError(_0x20d386,null));};exports[_0x7004('0x5c')]=function(_0x258069,_0x46c84d){var _0x20c535={'where':{'id':_0x258069[_0x7004('0x50')]['id']}},_0x333ae4={};_0x333ae4[_0x7004('0x40')]=_['keys'](db[_0x7004('0x4a')][_0x7004('0x38')]);_0x20c535[_0x7004('0x42')]=_[_0x7004('0x3f')](_0x333ae4[_0x7004('0x40')],qs['fields'](_0x258069[_0x7004('0x3c')][_0x7004('0x41')]));_0x20c535[_0x7004('0x42')]=_0x20c535[_0x7004('0x42')][_0x7004('0x51')]?_0x20c535[_0x7004('0x42')]:_0x333ae4[_0x7004('0x40')];if(_0x258069[_0x7004('0x3c')][_0x7004('0x4b')]){_0x20c535[_0x7004('0x4c')]=[{'all':!![]}];}_0x20c535=_['merge']({},_0x20c535,_0x258069[_0x7004('0x49')]);return db[_0x7004('0x4a')][_0x7004('0x58')](_0x20c535)[_0x7004('0x28')](handleEntityNotFound(_0x46c84d,null))[_0x7004('0x28')](function(_0x564587){if(_0x564587){var _0x4b29a8=_0x564587[_0x7004('0x2a')]({'plain':!![]});_0x4b29a8=qs[_0x7004('0x5d')](_0x4b29a8,['id',_0x7004('0x5e'),_0x7004('0x5f')]);_0x258069[_0x7004('0x31')]=_['omit'](_0x258069[_0x7004('0x31')],['id','createdAt',_0x7004('0x5f')]);return db[_0x7004('0x4a')]['create'](_[_0x7004('0x30')](_0x4b29a8,_0x258069[_0x7004('0x31')]),{'include':_0x258069[_0x7004('0x3c')][_0x7004('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x5e6673){var _0x4f7d5e=_0x258069[_0x7004('0x54')][_0x7004('0x2a')]({'plain':!![]});if(!_0x4f7d5e)throw new Error(_0x7004('0x55'));if(_0x4f7d5e[_0x7004('0x60')]===_0x7004('0x54')){var _0x5345dd=_0x5e6673[_0x7004('0x2a')]({'plain':!![]});var _0x345129=_0x7004('0x56');return db['UserProfileSection'][_0x7004('0x58')]({'where':{'name':_0x345129,'userProfileId':_0x4f7d5e[_0x7004('0x59')]},'raw':!![]})[_0x7004('0x28')](function(_0x377dae){if(_0x377dae&&_0x377dae['autoAssociation']===0x0){return db[_0x7004('0x5b')][_0x7004('0x53')]({'name':_0x5345dd[_0x7004('0x2d')],'resourceId':_0x5345dd['id'],'type':_0x377dae['name'],'sectionId':_0x377dae['id']},{})[_0x7004('0x28')](function(){return _0x5e6673;});}else{return _0x5e6673;}})[_0x7004('0x52')](function(_0x11e984){logger['error'](_0x7004('0x61'),_0x11e984);throw _0x11e984;});}return _0x5e6673;});}})[_0x7004('0x28')](respondWithResult(_0x46c84d,0xc9))[_0x7004('0x52')](handleError(_0x46c84d,null));};exports[_0x7004('0x27')]=function(_0x498ddf,_0x470222){if(_0x498ddf[_0x7004('0x31')]['id']){delete _0x498ddf['body']['id'];}return db[_0x7004('0x4a')][_0x7004('0x58')]({'where':{'id':_0x498ddf[_0x7004('0x50')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x470222,null))[_0x7004('0x28')](saveUpdates(_0x498ddf[_0x7004('0x31')],null))[_0x7004('0x28')](respondWithResult(_0x470222,null))[_0x7004('0x52')](handleError(_0x470222,null));};exports['destroy']=function(_0x323082,_0x2a9bd4){return db[_0x7004('0x4a')][_0x7004('0x58')]({'where':{'id':_0x323082[_0x7004('0x50')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x2a9bd4,null))[_0x7004('0x28')](removeEntity(_0x2a9bd4,null))['catch'](handleError(_0x2a9bd4,null));};exports[_0x7004('0x62')]=function(_0x1698cb,_0x1923dd,_0x587351){var _0x4e3a9a={'raw':!![],'where':{}};var _0x2d5faf={};var _0x27e422={'count':0x0,'rows':[]};return db[_0x7004('0x4a')][_0x7004('0x63')]({'where':{'id':_0x1698cb[_0x7004('0x50')]['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x1923dd,null))[_0x7004('0x28')](function(_0x10b4cb){if(_0x10b4cb){_0x2d5faf[_0x7004('0x40')]=_[_0x7004('0x3d')](db[_0x7004('0x64')][_0x7004('0x38')]);_0x2d5faf['query']=_['keys'](_0x1698cb[_0x7004('0x3c')]);_0x2d5faf[_0x7004('0x3e')]=_[_0x7004('0x3f')](_0x2d5faf[_0x7004('0x40')],_0x2d5faf[_0x7004('0x3c')]);_0x4e3a9a[_0x7004('0x42')]=_[_0x7004('0x3f')](_0x2d5faf['model'],qs[_0x7004('0x41')](_0x1698cb['query'][_0x7004('0x41')]));_0x4e3a9a[_0x7004('0x42')]=_0x4e3a9a[_0x7004('0x42')][_0x7004('0x51')]?_0x4e3a9a[_0x7004('0x42')]:_0x2d5faf[_0x7004('0x40')];if(!_0x1698cb[_0x7004('0x3c')][_0x7004('0x43')](_0x7004('0x44'))){_0x4e3a9a[_0x7004('0x20')]=qs[_0x7004('0x20')](_0x1698cb[_0x7004('0x3c')]['limit']);_0x4e3a9a[_0x7004('0x1e')]=qs[_0x7004('0x1e')](_0x1698cb[_0x7004('0x3c')][_0x7004('0x1e')]);}_0x4e3a9a[_0x7004('0x45')]=qs[_0x7004('0x65')](_0x1698cb[_0x7004('0x3c')]['sort']);_0x4e3a9a[_0x7004('0x46')]=qs['filters'](_[_0x7004('0x66')](_0x1698cb[_0x7004('0x3c')],_0x2d5faf[_0x7004('0x3e')]));_0x4e3a9a[_0x7004('0x46')]['ProjectId']=_0x10b4cb['id'];if(_0x1698cb['query'][_0x7004('0x47')]){_0x4e3a9a[_0x7004('0x46')]=_[_0x7004('0x30')](_0x4e3a9a[_0x7004('0x46')],{'$or':_['map'](_0x4e3a9a[_0x7004('0x42')],function(_0x70fec1){var _0x318fe8={};_0x318fe8[_0x70fec1]={'$like':'%'+_0x1698cb[_0x7004('0x3c')][_0x7004('0x47')]+'%'};return _0x318fe8;})});}_0x4e3a9a=_['merge']({},_0x4e3a9a,_0x1698cb[_0x7004('0x49')]);return db['JscriptySessionReport'][_0x7004('0x21')]({'where':_0x4e3a9a[_0x7004('0x46')]})[_0x7004('0x28')](function(_0x4f68da){_0x27e422['count']=_0x4f68da;if(_0x1698cb[_0x7004('0x3c')]['includeAll']){_0x4e3a9a['include']=[{'all':!![]}];}return db[_0x7004('0x64')]['findAll'](_0x4e3a9a);})[_0x7004('0x28')](function(_0x2c5977){_0x27e422['rows']=_0x2c5977;return _0x27e422;});}})['then'](respondWithFilteredResult(_0x1923dd,_0x4e3a9a))[_0x7004('0x52')](handleError(_0x1923dd,null));};exports[_0x7004('0x67')]=function(_0x748638,_0x462ffe,_0x4fef5e){var _0x2692a0={'raw':!![],'where':{}};var _0x374c87={};var _0x2543f5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x7004('0x63')]({'where':{'id':_0x748638['params']['id']}})[_0x7004('0x28')](handleEntityNotFound(_0x462ffe,null))[_0x7004('0x28')](function(_0x5896af){if(_0x5896af){_0x374c87['model']=_['keys'](db[_0x7004('0x68')][_0x7004('0x38')]);_0x374c87[_0x7004('0x3c')]=_[_0x7004('0x3d')](_0x748638['query']);_0x374c87[_0x7004('0x3e')]=_[_0x7004('0x3f')](_0x374c87[_0x7004('0x40')],_0x374c87[_0x7004('0x3c')]);_0x2692a0[_0x7004('0x42')]=_['intersection'](_0x374c87['model'],qs[_0x7004('0x41')](_0x748638[_0x7004('0x3c')]['fields']));_0x2692a0[_0x7004('0x42')]=_0x2692a0[_0x7004('0x42')]['length']?_0x2692a0[_0x7004('0x42')]:_0x374c87['model'];if(!_0x748638[_0x7004('0x3c')][_0x7004('0x43')](_0x7004('0x44'))){_0x2692a0['limit']=qs[_0x7004('0x20')](_0x748638[_0x7004('0x3c')][_0x7004('0x20')]);_0x2692a0[_0x7004('0x1e')]=qs[_0x7004('0x1e')](_0x748638[_0x7004('0x3c')][_0x7004('0x1e')]);}_0x2692a0[_0x7004('0x45')]=qs[_0x7004('0x65')](_0x748638['query']['sort']);_0x2692a0[_0x7004('0x46')]=qs[_0x7004('0x3e')](_[_0x7004('0x66')](_0x748638[_0x7004('0x3c')],_0x374c87['filters']));_0x2692a0[_0x7004('0x46')][_0x7004('0x69')]=_0x5896af['id'];if(_0x748638[_0x7004('0x3c')][_0x7004('0x47')]){_0x2692a0[_0x7004('0x46')]=_['merge'](_0x2692a0[_0x7004('0x46')],{'$or':_[_0x7004('0x37')](_0x2692a0[_0x7004('0x42')],function(_0x59a651){var _0x41547f={};_0x41547f[_0x59a651]={'$like':'%'+_0x748638[_0x7004('0x3c')]['filter']+'%'};return _0x41547f;})});}_0x2692a0=_['merge']({},_0x2692a0,_0x748638[_0x7004('0x49')]);return db[_0x7004('0x68')][_0x7004('0x21')]({'where':_0x2692a0[_0x7004('0x46')]})[_0x7004('0x28')](function(_0x2d931c){_0x2543f5['count']=_0x2d931c;if(_0x748638['query']['includeAll']){_0x2692a0[_0x7004('0x4c')]=[{'all':!![]}];}return db[_0x7004('0x68')][_0x7004('0x4d')](_0x2692a0);})[_0x7004('0x28')](function(_0x53f1ec){_0x2543f5[_0x7004('0x4e')]=_0x53f1ec;return _0x2543f5;});}})[_0x7004('0x28')](respondWithFilteredResult(_0x462ffe,_0x2692a0))[_0x7004('0x52')](handleError(_0x462ffe,null));};function char(_0x4f6b09){return _0x7004('0x6a')===typeof _0x4f6b09?String[_0x7004('0x6b')]['apply'](null,arguments):_0x4f6b09;}function needsEncapsulation(_0x4744a1){return!!_0x4744a1&&(_0x4744a1[_0x7004('0x6c')]()[_0x7004('0x6d')](char(0xd))>=0x0||_0x4744a1['toString']()[_0x7004('0x6d')](char(0xa))>=0x0||_0x4744a1[_0x7004('0x6c')]()[_0x7004('0x6d')](char(0x2c))>=0x0||_0x4744a1[_0x7004('0x6c')]()[_0x7004('0x6d')](char(0x22))>=0x0);}function encapsulate(_0x5cdb3a){var _0x5e61cc=char(0x22),_0x1388e0='\x5c'+char(0x22),_0x7e0adc=_0x5cdb3a[_0x7004('0x6c')]()[_0x7004('0x6e')](new RegExp(_0x5e61cc,'g'),_0x1388e0);return _0x5e61cc+_0x7e0adc+_0x5e61cc;}exports[_0x7004('0x6f')]=function(_0x3657a6,_0x275fae,_0x286ce0){var _0x3680e0,_0x221d4d;var _0x69a8eb={'where':{'ProjectId':_0x3657a6['params']['id']}};if(_0x3657a6[_0x7004('0x3c')][_0x7004('0x70')]){_0x69a8eb[_0x7004('0x46')][_0x7004('0x71')]=JSON[_0x7004('0x72')](_0x3657a6[_0x7004('0x3c')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x69a8eb)[_0x7004('0x28')](handleEntityNotFound(_0x275fae,null))['then'](function(_0x5ba8a1){if(_0x5ba8a1){_0x3680e0=_0x5ba8a1;return db[_0x7004('0x73')][_0x7004('0x4d')]({'where':{'SessionId':{'$in':_[_0x7004('0x37')](_0x3680e0,'id')},'ProjectId':_0x3657a6['params']['id']},'order':'-createdAt'});}})[_0x7004('0x28')](handleEntityNotFound(_0x275fae,null))[_0x7004('0x28')](function(_0x4df74c){if(_0x4df74c){_0x221d4d=_0x4df74c;var _0x189f58={};for(var _0x20cef0=0x0,_0x2742d6=_0x221d4d[_0x7004('0x51')];_0x20cef0<_0x2742d6;_0x20cef0++){if(!_0x189f58[_0x7004('0x43')](_0x221d4d[_0x20cef0]['questionId'])){_0x189f58[_0x221d4d[_0x20cef0][_0x7004('0x74')]]=needsEncapsulation(_0x221d4d[_0x20cef0]['question'])?encapsulate(_0x221d4d[_0x20cef0][_0x7004('0x75')]):_0x221d4d[_0x20cef0]['question'];}}var _0x338091=[],_0x57c0c7={};for(var _0x4bbdff=0x0,_0xaa908c=_0x3680e0['length'];_0x4bbdff<_0xaa908c;_0x4bbdff++){_0x57c0c7={'ProjectId':_0x3657a6[_0x7004('0x50')]['id'],'SessionId':_0x3680e0[_0x4bbdff]['id'],'StartTime':moment(_0x3680e0[_0x4bbdff][_0x7004('0x71')])[_0x7004('0x76')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x48d2bb=0x0,_0x2da24b=_0x221d4d['length'];_0x48d2bb<_0x2da24b;_0x48d2bb++){if(_0x221d4d[_0x48d2bb][_0x7004('0x77')]==_0x3680e0[_0x4bbdff]['id']&&_0x189f58['hasOwnProperty'](_0x221d4d[_0x48d2bb][_0x7004('0x74')])){_0x57c0c7[_0x189f58[_0x221d4d[_0x48d2bb][_0x7004('0x74')]]]=_0x221d4d[_0x48d2bb][_0x7004('0x78')];}}for(var _0x294bc4 in _0x189f58){if(!_0x57c0c7['hasOwnProperty'](_0x189f58[_0x294bc4])){_0x57c0c7[_0x189f58[_0x294bc4]]=null;}}_0x338091[_0x7004('0x79')](_0x57c0c7);}return _0x338091;}})[_0x7004('0x28')](function(_0x12deae){if(!_[_0x7004('0x7a')](_0x12deae)){var _0x39f9e2=toCsv(_0x12deae);var _0x1c30e8=Date[_0x7004('0x7b')]();fs[_0x7004('0x7c')](util[_0x7004('0x76')](_0x7004('0x7d'),_0x3657a6[_0x7004('0x50')]['id'],_0x1c30e8),_0x39f9e2);_0x275fae[_0x7004('0x7e')](_0x7004('0x7f'),'attachment;\x20filename='+util[_0x7004('0x76')](_0x7004('0x80'),_0x3657a6['params']['id'],_0x1c30e8));_0x275fae['setHeader']('Content-type',_0x7004('0x81'));return _0x275fae['download'](util[_0x7004('0x76')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3657a6['params']['id'],_0x1c30e8));}else{return _0x275fae[_0x7004('0x1a')](0xcc);}})[_0x7004('0x52')](handleError(_0x275fae,null));}; \ No newline at end of file +var _0x21a9=['agent','interaction','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','clone','omit','updatedAt','createdAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','name','send','render','body','contact','message'];(function(_0xceff43,_0x4ec083){var _0xaacba9=function(_0x571c94){while(--_0x571c94){_0xceff43['push'](_0xceff43['shift']());}};_0xaacba9(++_0x4ec083);}(_0x21a9,0x1c6));var _0x921a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x21a9[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x921a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x921a('0x1'));var rp=require(_0x921a('0x2'));var moment=require(_0x921a('0x3'));var BPromise=require(_0x921a('0x4'));var Mustache=require(_0x921a('0x5'));var util=require(_0x921a('0x6'));var path=require(_0x921a('0x7'));var sox=require('sox');var csv=require(_0x921a('0x8'));var ejs=require(_0x921a('0x9'));var fs=require('fs');var fs_extra=require(_0x921a('0xa'));var _=require(_0x921a('0xb'));var squel=require(_0x921a('0xc'));var crypto=require(_0x921a('0xd'));var jsforce=require(_0x921a('0xe'));var deskjs=require(_0x921a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x921a('0x10'));var Papa=require(_0x921a('0x11'));var Redis=require('ioredis');var authService=require(_0x921a('0x12'));var qs=require(_0x921a('0x13'));var as=require(_0x921a('0x14'));var hardwareService=require(_0x921a('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x921a('0x16'));var licenseUtil=require(_0x921a('0x17'));var db=require(_0x921a('0x18'))['db'];function respondWithStatusCode(_0x56998e,_0x4f5965){_0x4f5965=_0x4f5965||0xcc;return function(_0x55da71){if(_0x55da71){return _0x56998e[_0x921a('0x19')](_0x4f5965);}return _0x56998e[_0x921a('0x1a')](_0x4f5965)[_0x921a('0x1b')]();};}function respondWithResult(_0x112203,_0x158620){_0x158620=_0x158620||0xc8;return function(_0x5ef83d){if(_0x5ef83d){return _0x112203['status'](_0x158620)['json'](_0x5ef83d);}};}function respondWithFilteredResult(_0x4043da,_0x4326ff){return function(_0xb50f14){if(_0xb50f14){var _0x4a217e=typeof _0x4326ff['offset']==='undefined'&&typeof _0x4326ff[_0x921a('0x1c')]===_0x921a('0x1d');var _0x4189c7=_0xb50f14[_0x921a('0x1e')];var _0x4e1165=_0x4a217e?0x0:_0x4326ff[_0x921a('0x1f')];var _0x1398de=_0x4a217e?_0xb50f14[_0x921a('0x1e')]:_0x4326ff['offset']+_0x4326ff['limit'];var _0xcb6600;if(_0x1398de>=_0x4189c7){_0x1398de=_0x4189c7;_0xcb6600=0xc8;}else{_0xcb6600=0xce;}_0x4043da[_0x921a('0x1a')](_0xcb6600);return _0x4043da[_0x921a('0x20')](_0x921a('0x21'),_0x4e1165+'-'+_0x1398de+'/'+_0x4189c7)[_0x921a('0x22')](_0xb50f14);}return null;};}function patchUpdates(_0x5db990){return function(_0x49aa41){try{jsonpatch['apply'](_0x49aa41,_0x5db990,!![]);}catch(_0x3e2b1c){return BPromise[_0x921a('0x23')](_0x3e2b1c);}return _0x49aa41[_0x921a('0x24')]();};}function saveUpdates(_0x26cea6,_0xb826ae){return function(_0x2699d5){if(_0x2699d5){return _0x2699d5[_0x921a('0x25')](_0x26cea6)[_0x921a('0x26')](function(_0x254047){return _0x254047;});}return null;};}function removeEntity(_0x463dd0,_0x3507af){return function(_0x54d7b1){if(_0x54d7b1){return _0x54d7b1[_0x921a('0x27')]()[_0x921a('0x26')](function(){var _0x4e0ba=_0x54d7b1[_0x921a('0x28')]({'plain':!![]});var _0x5de744=_0x921a('0x29');return db[_0x921a('0x2a')]['destroy']({'where':{'type':_0x5de744,'resourceId':_0x4e0ba['id']}})[_0x921a('0x26')](function(){return _0x54d7b1;});})['then'](function(){_0x463dd0['status'](0xcc)[_0x921a('0x1b')]();});}};}function handleEntityNotFound(_0x2cef3c,_0x15992c){return function(_0x375e72){if(!_0x375e72){_0x2cef3c[_0x921a('0x19')](0x194);}return _0x375e72;};}function handleError(_0x967b04,_0x5a129b){_0x5a129b=_0x5a129b||0x1f4;return function(_0x5adaaa){logger[_0x921a('0x2b')](_0x5adaaa['stack']);if(_0x5adaaa[_0x921a('0x2c')]){delete _0x5adaaa[_0x921a('0x2c')];}_0x967b04['status'](_0x5a129b)[_0x921a('0x2d')](_0x5adaaa);};}function getMustacheRender(_0x5de7d5,_0x4592d7){return Mustache[_0x921a('0x2e')](_0x5de7d5,_['merge'](_0x4592d7[_0x921a('0x2f')],{'contact':_0x4592d7[_0x921a('0x30')],'message':_0x4592d7[_0x921a('0x31')],'agent':_0x4592d7[_0x921a('0x32')],'interaction':_0x4592d7[_0x921a('0x33')],'account':_0x4592d7['account']}))||'';}exports[_0x921a('0x34')]=function(_0x104781,_0x3df65a){var _0xdd5eba={},_0x501193={},_0x21ee0e={'count':0x0,'rows':[]};var _0x3af3be=_['map'](db[_0x921a('0x35')][_0x921a('0x36')],function(_0x58b0f7){return{'name':_0x58b0f7[_0x921a('0x37')],'type':_0x58b0f7[_0x921a('0x38')][_0x921a('0x39')]};});_0x501193[_0x921a('0x3a')]=_[_0x921a('0x3b')](_0x3af3be,'name');_0x501193['query']=_[_0x921a('0x3c')](_0x104781[_0x921a('0x3d')]);_0x501193[_0x921a('0x3e')]=_[_0x921a('0x3f')](_0x501193[_0x921a('0x3a')],_0x501193['query']);_0xdd5eba[_0x921a('0x40')]=_['intersection'](_0x501193[_0x921a('0x3a')],qs[_0x921a('0x41')](_0x104781[_0x921a('0x3d')][_0x921a('0x41')]));_0xdd5eba[_0x921a('0x40')]=_0xdd5eba[_0x921a('0x40')][_0x921a('0x42')]?_0xdd5eba[_0x921a('0x40')]:_0x501193['model'];if(!_0x104781[_0x921a('0x3d')][_0x921a('0x43')](_0x921a('0x44'))){_0xdd5eba[_0x921a('0x1c')]=qs[_0x921a('0x1c')](_0x104781[_0x921a('0x3d')]['limit']);_0xdd5eba[_0x921a('0x1f')]=qs[_0x921a('0x1f')](_0x104781['query'][_0x921a('0x1f')]);}_0xdd5eba[_0x921a('0x45')]=qs[_0x921a('0x46')](_0x104781[_0x921a('0x3d')]['sort']);_0xdd5eba['where']=qs['filters'](_[_0x921a('0x47')](_0x104781[_0x921a('0x3d')],_0x501193[_0x921a('0x3e')]),_0x3af3be);if(_0x104781[_0x921a('0x3d')]['filter']){_0xdd5eba[_0x921a('0x48')]=_[_0x921a('0x49')](_0xdd5eba['where'],{'$or':_[_0x921a('0x3b')](_0x3af3be,function(_0x4536fe){if(_0x4536fe[_0x921a('0x38')]!==_0x921a('0x4a')){var _0x947ac3={};_0x947ac3[_0x4536fe[_0x921a('0x2c')]]={'$like':'%'+_0x104781['query'][_0x921a('0x4b')]+'%'};return _0x947ac3;}})});}_0xdd5eba=_[_0x921a('0x49')]({},_0xdd5eba,_0x104781[_0x921a('0x4c')]);var _0x54ad93={'where':_0xdd5eba['where']};return db[_0x921a('0x35')][_0x921a('0x1e')](_0x54ad93)[_0x921a('0x26')](function(_0x6beb30){_0x21ee0e[_0x921a('0x1e')]=_0x6beb30;if(_0x104781['query'][_0x921a('0x4d')]){_0xdd5eba[_0x921a('0x4e')]=[{'all':!![]}];}return db['JscriptyProject'][_0x921a('0x4f')](_0xdd5eba);})[_0x921a('0x26')](function(_0x5f12d5){_0x21ee0e[_0x921a('0x50')]=_0x5f12d5;return _0x21ee0e;})[_0x921a('0x26')](respondWithFilteredResult(_0x3df65a,_0xdd5eba))[_0x921a('0x51')](handleError(_0x3df65a,null));};exports[_0x921a('0x52')]=function(_0x75e531,_0x296482){var _0x9bfdbe={'raw':![],'where':{'id':_0x75e531['params']['id']}},_0x207f9b={};_0x207f9b['model']=_[_0x921a('0x3c')](db[_0x921a('0x35')][_0x921a('0x36')]);_0x207f9b[_0x921a('0x3d')]=_['keys'](_0x75e531[_0x921a('0x3d')]);_0x207f9b[_0x921a('0x3e')]=_['intersection'](_0x207f9b[_0x921a('0x3a')],_0x207f9b[_0x921a('0x3d')]);_0x9bfdbe[_0x921a('0x40')]=_[_0x921a('0x3f')](_0x207f9b[_0x921a('0x3a')],qs[_0x921a('0x41')](_0x75e531['query']['fields']));_0x9bfdbe[_0x921a('0x40')]=_0x9bfdbe[_0x921a('0x40')][_0x921a('0x42')]?_0x9bfdbe[_0x921a('0x40')]:_0x207f9b['model'];if(_0x75e531['query'][_0x921a('0x4d')]){_0x9bfdbe['include']=[{'all':!![]}];}_0x9bfdbe=_['merge']({},_0x9bfdbe,_0x75e531[_0x921a('0x4c')]);return db['JscriptyProject'][_0x921a('0x53')](_0x9bfdbe)[_0x921a('0x26')](handleEntityNotFound(_0x296482,null))[_0x921a('0x26')](respondWithResult(_0x296482,null))[_0x921a('0x51')](handleError(_0x296482,null));};exports['create']=function(_0xa43f28,_0x3fefb4){return db[_0x921a('0x35')][_0x921a('0x54')](_0xa43f28[_0x921a('0x2f')],{})[_0x921a('0x26')](function(_0xfdbd58){var _0x19bcd3=_0xa43f28[_0x921a('0x55')][_0x921a('0x28')]({'plain':!![]});if(!_0x19bcd3)throw new Error(_0x921a('0x56'));if(_0x19bcd3['role']===_0x921a('0x55')){var _0x3975dd=_0xfdbd58[_0x921a('0x28')]({'plain':!![]});var _0x3397f6=_0x921a('0x29');return db[_0x921a('0x57')][_0x921a('0x53')]({'where':{'name':_0x3397f6,'userProfileId':_0x19bcd3[_0x921a('0x58')]},'raw':!![]})['then'](function(_0x3afc1d){if(_0x3afc1d&&_0x3afc1d['autoAssociation']===0x0){return db['UserProfileResource'][_0x921a('0x54')]({'name':_0x3975dd[_0x921a('0x2c')],'resourceId':_0x3975dd['id'],'type':_0x3afc1d[_0x921a('0x2c')],'sectionId':_0x3afc1d['id']},{})[_0x921a('0x26')](function(){return _0xfdbd58;});}else{return _0xfdbd58;}})['catch'](function(_0x3852fa){logger[_0x921a('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3852fa);throw _0x3852fa;});}return _0xfdbd58;})['then'](respondWithResult(_0x3fefb4,0xc9))[_0x921a('0x51')](handleError(_0x3fefb4,null));};exports[_0x921a('0x59')]=function(_0x11cb5b,_0x27f5ad){var _0x2456fe={'where':{'id':_0x11cb5b['params']['id']}},_0x2cf7f7={};_0x2cf7f7[_0x921a('0x3a')]=_['keys'](db[_0x921a('0x35')]['rawAttributes']);_0x2456fe[_0x921a('0x40')]=_[_0x921a('0x3f')](_0x2cf7f7[_0x921a('0x3a')],qs['fields'](_0x11cb5b[_0x921a('0x3d')][_0x921a('0x41')]));_0x2456fe[_0x921a('0x40')]=_0x2456fe['attributes']['length']?_0x2456fe[_0x921a('0x40')]:_0x2cf7f7[_0x921a('0x3a')];if(_0x11cb5b[_0x921a('0x3d')][_0x921a('0x4d')]){_0x2456fe['include']=[{'all':!![]}];}_0x2456fe=_[_0x921a('0x49')]({},_0x2456fe,_0x11cb5b['options']);return db['JscriptyProject'][_0x921a('0x53')](_0x2456fe)['then'](handleEntityNotFound(_0x27f5ad,null))[_0x921a('0x26')](function(_0x40aff2){if(_0x40aff2){var _0x816887=_0x40aff2[_0x921a('0x28')]({'plain':!![]});_0x816887=qs[_0x921a('0x5a')](_0x816887,['id','createdAt',_0x921a('0x5b')]);_0x11cb5b[_0x921a('0x2f')]=_[_0x921a('0x5a')](_0x11cb5b[_0x921a('0x2f')],['id',_0x921a('0x5c'),_0x921a('0x5b')]);return db[_0x921a('0x35')][_0x921a('0x54')](_[_0x921a('0x49')](_0x816887,_0x11cb5b[_0x921a('0x2f')]),{'include':_0x11cb5b['query'][_0x921a('0x4d')]?[{'all':!![]}]:undefined})[_0x921a('0x26')](function(_0x203365){var _0x41f674=_0x11cb5b[_0x921a('0x55')][_0x921a('0x28')]({'plain':!![]});if(!_0x41f674)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41f674['role']==='user'){var _0x379b8c=_0x203365[_0x921a('0x28')]({'plain':!![]});var _0x166c5d=_0x921a('0x29');return db[_0x921a('0x57')]['find']({'where':{'name':_0x166c5d,'userProfileId':_0x41f674[_0x921a('0x58')]},'raw':!![]})[_0x921a('0x26')](function(_0x134a6e){if(_0x134a6e&&_0x134a6e[_0x921a('0x5d')]===0x0){return db['UserProfileResource']['create']({'name':_0x379b8c['name'],'resourceId':_0x379b8c['id'],'type':_0x134a6e[_0x921a('0x2c')],'sectionId':_0x134a6e['id']},{})[_0x921a('0x26')](function(){return _0x203365;});}else{return _0x203365;}})[_0x921a('0x51')](function(_0x556011){logger[_0x921a('0x2b')](_0x921a('0x5e'),_0x556011);throw _0x556011;});}return _0x203365;});}})[_0x921a('0x26')](respondWithResult(_0x27f5ad,0xc9))[_0x921a('0x51')](handleError(_0x27f5ad,null));};exports[_0x921a('0x25')]=function(_0x3fbe13,_0x4fa088){if(_0x3fbe13['body']['id']){delete _0x3fbe13[_0x921a('0x2f')]['id'];}return db[_0x921a('0x35')][_0x921a('0x53')]({'where':{'id':_0x3fbe13['params']['id']}})[_0x921a('0x26')](handleEntityNotFound(_0x4fa088,null))[_0x921a('0x26')](saveUpdates(_0x3fbe13[_0x921a('0x2f')],null))['then'](respondWithResult(_0x4fa088,null))['catch'](handleError(_0x4fa088,null));};exports[_0x921a('0x27')]=function(_0x51f6f9,_0x3d7795){return db[_0x921a('0x35')][_0x921a('0x53')]({'where':{'id':_0x51f6f9[_0x921a('0x5f')]['id']}})[_0x921a('0x26')](handleEntityNotFound(_0x3d7795,null))[_0x921a('0x26')](removeEntity(_0x3d7795,null))[_0x921a('0x51')](handleError(_0x3d7795,null));};exports[_0x921a('0x60')]=function(_0x54354c,_0x41dcde,_0x14f2e4){var _0x1882e7={'raw':!![],'where':{}};var _0x16fa6c={};var _0x41e8bf={'count':0x0,'rows':[]};return db[_0x921a('0x35')][_0x921a('0x61')]({'where':{'id':_0x54354c[_0x921a('0x5f')]['id']}})[_0x921a('0x26')](handleEntityNotFound(_0x41dcde,null))['then'](function(_0x2ef109){if(_0x2ef109){_0x16fa6c[_0x921a('0x3a')]=_[_0x921a('0x3c')](db[_0x921a('0x62')][_0x921a('0x36')]);_0x16fa6c[_0x921a('0x3d')]=_[_0x921a('0x3c')](_0x54354c['query']);_0x16fa6c['filters']=_[_0x921a('0x3f')](_0x16fa6c[_0x921a('0x3a')],_0x16fa6c['query']);_0x1882e7['attributes']=_[_0x921a('0x3f')](_0x16fa6c[_0x921a('0x3a')],qs[_0x921a('0x41')](_0x54354c[_0x921a('0x3d')]['fields']));_0x1882e7[_0x921a('0x40')]=_0x1882e7[_0x921a('0x40')][_0x921a('0x42')]?_0x1882e7[_0x921a('0x40')]:_0x16fa6c[_0x921a('0x3a')];if(!_0x54354c[_0x921a('0x3d')][_0x921a('0x43')]('nolimit')){_0x1882e7[_0x921a('0x1c')]=qs[_0x921a('0x1c')](_0x54354c[_0x921a('0x3d')][_0x921a('0x1c')]);_0x1882e7['offset']=qs[_0x921a('0x1f')](_0x54354c['query'][_0x921a('0x1f')]);}_0x1882e7[_0x921a('0x45')]=qs['sort'](_0x54354c['query'][_0x921a('0x46')]);_0x1882e7[_0x921a('0x48')]=qs[_0x921a('0x3e')](_[_0x921a('0x47')](_0x54354c['query'],_0x16fa6c['filters']));_0x1882e7['where'][_0x921a('0x63')]=_0x2ef109['id'];if(_0x54354c[_0x921a('0x3d')]['filter']){_0x1882e7[_0x921a('0x48')]=_[_0x921a('0x49')](_0x1882e7['where'],{'$or':_[_0x921a('0x3b')](_0x1882e7[_0x921a('0x40')],function(_0x24219e){var _0x11a8d8={};_0x11a8d8[_0x24219e]={'$like':'%'+_0x54354c['query'][_0x921a('0x4b')]+'%'};return _0x11a8d8;})});}_0x1882e7=_[_0x921a('0x49')]({},_0x1882e7,_0x54354c[_0x921a('0x4c')]);return db[_0x921a('0x62')][_0x921a('0x1e')]({'where':_0x1882e7[_0x921a('0x48')]})[_0x921a('0x26')](function(_0x526691){_0x41e8bf['count']=_0x526691;if(_0x54354c[_0x921a('0x3d')][_0x921a('0x4d')]){_0x1882e7['include']=[{'all':!![]}];}return db[_0x921a('0x62')][_0x921a('0x4f')](_0x1882e7);})[_0x921a('0x26')](function(_0x476551){_0x41e8bf[_0x921a('0x50')]=_0x476551;return _0x41e8bf;});}})[_0x921a('0x26')](respondWithFilteredResult(_0x41dcde,_0x1882e7))[_0x921a('0x51')](handleError(_0x41dcde,null));};exports[_0x921a('0x64')]=function(_0x16947c,_0xbe4374,_0x3e8786){var _0x3e0c65={'raw':!![],'where':{}};var _0x54ed5b={};var _0x1988f7={'count':0x0,'rows':[]};return db[_0x921a('0x35')][_0x921a('0x61')]({'where':{'id':_0x16947c[_0x921a('0x5f')]['id']}})[_0x921a('0x26')](handleEntityNotFound(_0xbe4374,null))[_0x921a('0x26')](function(_0x350069){if(_0x350069){_0x54ed5b[_0x921a('0x3a')]=_[_0x921a('0x3c')](db[_0x921a('0x65')][_0x921a('0x36')]);_0x54ed5b[_0x921a('0x3d')]=_[_0x921a('0x3c')](_0x16947c[_0x921a('0x3d')]);_0x54ed5b['filters']=_[_0x921a('0x3f')](_0x54ed5b[_0x921a('0x3a')],_0x54ed5b[_0x921a('0x3d')]);_0x3e0c65[_0x921a('0x40')]=_[_0x921a('0x3f')](_0x54ed5b[_0x921a('0x3a')],qs['fields'](_0x16947c[_0x921a('0x3d')][_0x921a('0x41')]));_0x3e0c65[_0x921a('0x40')]=_0x3e0c65[_0x921a('0x40')]['length']?_0x3e0c65[_0x921a('0x40')]:_0x54ed5b[_0x921a('0x3a')];if(!_0x16947c[_0x921a('0x3d')]['hasOwnProperty'](_0x921a('0x44'))){_0x3e0c65[_0x921a('0x1c')]=qs[_0x921a('0x1c')](_0x16947c[_0x921a('0x3d')][_0x921a('0x1c')]);_0x3e0c65[_0x921a('0x1f')]=qs[_0x921a('0x1f')](_0x16947c[_0x921a('0x3d')]['offset']);}_0x3e0c65['order']=qs['sort'](_0x16947c[_0x921a('0x3d')][_0x921a('0x46')]);_0x3e0c65[_0x921a('0x48')]=qs[_0x921a('0x3e')](_[_0x921a('0x47')](_0x16947c[_0x921a('0x3d')],_0x54ed5b[_0x921a('0x3e')]));_0x3e0c65[_0x921a('0x48')]['ProjectId']=_0x350069['id'];if(_0x16947c[_0x921a('0x3d')]['filter']){_0x3e0c65[_0x921a('0x48')]=_[_0x921a('0x49')](_0x3e0c65['where'],{'$or':_[_0x921a('0x3b')](_0x3e0c65[_0x921a('0x40')],function(_0x3bc819){var _0xc01fb={};_0xc01fb[_0x3bc819]={'$like':'%'+_0x16947c[_0x921a('0x3d')][_0x921a('0x4b')]+'%'};return _0xc01fb;})});}_0x3e0c65=_[_0x921a('0x49')]({},_0x3e0c65,_0x16947c[_0x921a('0x4c')]);return db[_0x921a('0x65')][_0x921a('0x1e')]({'where':_0x3e0c65[_0x921a('0x48')]})[_0x921a('0x26')](function(_0xd8220b){_0x1988f7[_0x921a('0x1e')]=_0xd8220b;if(_0x16947c[_0x921a('0x3d')]['includeAll']){_0x3e0c65[_0x921a('0x4e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x921a('0x4f')](_0x3e0c65);})['then'](function(_0x2103c1){_0x1988f7[_0x921a('0x50')]=_0x2103c1;return _0x1988f7;});}})[_0x921a('0x26')](respondWithFilteredResult(_0xbe4374,_0x3e0c65))[_0x921a('0x51')](handleError(_0xbe4374,null));};function char(_0x575801){return _0x921a('0x66')===typeof _0x575801?String[_0x921a('0x67')][_0x921a('0x68')](null,arguments):_0x575801;}function needsEncapsulation(_0x236e56){return!!_0x236e56&&(_0x236e56[_0x921a('0x69')]()[_0x921a('0x6a')](char(0xd))>=0x0||_0x236e56[_0x921a('0x69')]()['indexOf'](char(0xa))>=0x0||_0x236e56['toString']()['indexOf'](char(0x2c))>=0x0||_0x236e56[_0x921a('0x69')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x2775c7){var _0x110ccd=char(0x22),_0x4aad55='\x5c'+char(0x22),_0x40f02f=_0x2775c7[_0x921a('0x69')]()[_0x921a('0x6b')](new RegExp(_0x110ccd,'g'),_0x4aad55);return _0x110ccd+_0x40f02f+_0x110ccd;}exports['getSummary']=function(_0x3f02f3,_0x685d5,_0x590c27){var _0x30e290,_0x4e701a;var _0x11153f={'where':{'ProjectId':_0x3f02f3[_0x921a('0x5f')]['id']}};if(_0x3f02f3[_0x921a('0x3d')][_0x921a('0x6c')]){_0x11153f[_0x921a('0x48')][_0x921a('0x6d')]=JSON['parse'](_0x3f02f3[_0x921a('0x3d')][_0x921a('0x6c')]);}return db['JscriptySessionReport'][_0x921a('0x4f')](_0x11153f)['then'](handleEntityNotFound(_0x685d5,null))[_0x921a('0x26')](function(_0x3cd31d){if(_0x3cd31d){_0x30e290=_0x3cd31d;return db[_0x921a('0x6e')][_0x921a('0x4f')]({'where':{'SessionId':{'$in':_[_0x921a('0x3b')](_0x30e290,'id')},'ProjectId':_0x3f02f3[_0x921a('0x5f')]['id']},'order':_0x921a('0x6f')});}})[_0x921a('0x26')](handleEntityNotFound(_0x685d5,null))[_0x921a('0x26')](function(_0x56d3d2){if(_0x56d3d2){_0x4e701a=_0x56d3d2;var _0x7c9f3b={};for(var _0x1455f0=0x0,_0xba6969=_0x4e701a[_0x921a('0x42')];_0x1455f0<_0xba6969;_0x1455f0++){if(!_0x7c9f3b['hasOwnProperty'](_0x4e701a[_0x1455f0][_0x921a('0x70')])){_0x7c9f3b[_0x4e701a[_0x1455f0]['questionId']]=needsEncapsulation(_0x4e701a[_0x1455f0][_0x921a('0x71')])?encapsulate(_0x4e701a[_0x1455f0][_0x921a('0x71')]):_0x4e701a[_0x1455f0][_0x921a('0x71')];}}var _0x482d6e=[],_0x203ef0={};for(var _0x59ba13=0x0,_0x503a79=_0x30e290[_0x921a('0x42')];_0x59ba13<_0x503a79;_0x59ba13++){_0x203ef0={'ProjectId':_0x3f02f3[_0x921a('0x5f')]['id'],'SessionId':_0x30e290[_0x59ba13]['id'],'StartTime':moment(_0x30e290[_0x59ba13][_0x921a('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x274b82=0x0,_0x2dfa99=_0x4e701a[_0x921a('0x42')];_0x274b82<_0x2dfa99;_0x274b82++){if(_0x4e701a[_0x274b82][_0x921a('0x72')]==_0x30e290[_0x59ba13]['id']&&_0x7c9f3b[_0x921a('0x43')](_0x4e701a[_0x274b82][_0x921a('0x70')])){_0x203ef0[_0x7c9f3b[_0x4e701a[_0x274b82][_0x921a('0x70')]]]=_0x4e701a[_0x274b82][_0x921a('0x73')];}}for(var _0x27c1a4 in _0x7c9f3b){if(!_0x203ef0[_0x921a('0x43')](_0x7c9f3b[_0x27c1a4])){_0x203ef0[_0x7c9f3b[_0x27c1a4]]=null;}}_0x482d6e[_0x921a('0x74')](_0x203ef0);}return _0x482d6e;}})[_0x921a('0x26')](function(_0x1e7690){if(!_[_0x921a('0x75')](_0x1e7690)){var _0x3d8c91=toCsv(_0x1e7690);var _0x413d10=Date['now']();fs[_0x921a('0x76')](util[_0x921a('0x77')](_0x921a('0x78'),_0x3f02f3[_0x921a('0x5f')]['id'],_0x413d10),_0x3d8c91);_0x685d5[_0x921a('0x79')](_0x921a('0x7a'),'attachment;\x20filename='+util[_0x921a('0x77')](_0x921a('0x7b'),_0x3f02f3[_0x921a('0x5f')]['id'],_0x413d10));_0x685d5['setHeader']('Content-type',_0x921a('0x7c'));return _0x685d5[_0x921a('0x7d')](util[_0x921a('0x77')](_0x921a('0x78'),_0x3f02f3['params']['id'],_0x413d10));}else{return _0x685d5[_0x921a('0x19')](0xcc);}})[_0x921a('0x51')](handleError(_0x685d5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 197635a..d4de48c 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa48b=['./jscriptyProject.attributes','exports','jscripty_projects','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa48b,0x157));var _0xba48=function(_0x16ef9c,_0x55568f){_0x16ef9c=_0x16ef9c-0x0;var _0x38ad91=_0xa48b[_0x16ef9c];return _0x38ad91;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xba48('0x0'));var moment=require(_0xba48('0x1'));var BPromise=require(_0xba48('0x2'));var rp=require(_0xba48('0x3'));var fs=require('fs');var path=require(_0xba48('0x4'));var rimraf=require(_0xba48('0x5'));var config=require(_0xba48('0x6'));var attributes=require(_0xba48('0x7'));module[_0xba48('0x8')]=function(_0x29d44a,_0x1ffe4c){return _0x29d44a['define']('JscriptyProject',attributes,{'tableName':_0xba48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3626=['./jscriptyProject.attributes','exports','define','JscriptyProject','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x7af7ef,_0x3f283b){var _0x5d5a38=function(_0x215640){while(--_0x215640){_0x7af7ef['push'](_0x7af7ef['shift']());}};_0x5d5a38(++_0x3f283b);}(_0x3626,0x1da));var _0x6362=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3626[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6362('0x0'));var moment=require(_0x6362('0x1'));var BPromise=require(_0x6362('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6362('0x3'));var rimraf=require(_0x6362('0x4'));var config=require(_0x6362('0x5'));var attributes=require(_0x6362('0x6'));module[_0x6362('0x7')]=function(_0xf5c0fa,_0x1a15f5){return _0xf5c0fa[_0x6362('0x8')](_0x6362('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 516ca88..17cc685 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa798=['info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xecd664,_0x50afdb){var _0x24cb22=function(_0x12aad0){while(--_0x12aad0){_0xecd664['push'](_0xecd664['shift']());}};_0x24cb22(++_0x50afdb);}(_0xa798,0xd1));var _0x8a79=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa798[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x8a79('0x0'));var util=require(_0x8a79('0x1'));var moment=require(_0x8a79('0x2'));var BPromise=require(_0x8a79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a79('0x4'));var logger=require(_0x8a79('0x5'))(_0x8a79('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a79('0x7'));var client=jayson[_0x8a79('0x8')][_0x8a79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f5124,_0x383fc8,_0x3d9154){return new BPromise(function(_0x82f1fc,_0x58c1bc){return client[_0x8a79('0xa')](_0x1f5124,_0x3d9154)['then'](function(_0xb854a5){logger[_0x8a79('0xb')](_0x8a79('0xc'),_0x383fc8,_0x8a79('0xd'));logger[_0x8a79('0xe')](_0x8a79('0xf'),_0x383fc8,'request\x20sent',JSON[_0x8a79('0x10')](_0xb854a5));if(_0xb854a5['error']){if(_0xb854a5[_0x8a79('0x11')][_0x8a79('0x12')]===0x1f4){logger['error'](_0x8a79('0xc'),_0x383fc8,_0xb854a5['error'][_0x8a79('0x13')]);return _0x58c1bc(_0xb854a5[_0x8a79('0x11')]['message']);}logger['error'](_0x8a79('0xc'),_0x383fc8,_0xb854a5[_0x8a79('0x11')][_0x8a79('0x13')]);return _0x82f1fc(_0xb854a5[_0x8a79('0x11')][_0x8a79('0x13')]);}else{logger[_0x8a79('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x383fc8,_0x8a79('0xd'));_0x82f1fc(_0xb854a5[_0x8a79('0x14')]['message']);}})[_0x8a79('0x15')](function(_0x407e77){logger[_0x8a79('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x383fc8,_0x407e77);_0x58c1bc(_0x407e77);});});} \ No newline at end of file +var _0x5446=['debug','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent'];(function(_0x1fed1b,_0x334fba){var _0x1f1d53=function(_0x383f35){while(--_0x383f35){_0x1fed1b['push'](_0x1fed1b['shift']());}};_0x1f1d53(++_0x334fba);}(_0x5446,0xfd));var _0x6544=function(_0x6b5ad8,_0x589b1d){_0x6b5ad8=_0x6b5ad8-0x0;var _0x11c6e8=_0x5446[_0x6b5ad8];return _0x11c6e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6544('0x0'));var rs=require(_0x6544('0x1'));var fs=require('fs');var Redis=require(_0x6544('0x2'));var db=require(_0x6544('0x3'))['db'];var utils=require(_0x6544('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6544('0x5'));var jayson=require(_0x6544('0x6'));var client=jayson[_0x6544('0x7')][_0x6544('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38b803,_0x446312,_0x18672b){return new BPromise(function(_0x3c884f,_0x28966a){return client['request'](_0x38b803,_0x18672b)[_0x6544('0x9')](function(_0x12082b){logger[_0x6544('0xa')](_0x6544('0xb'),_0x446312,_0x6544('0xc'));logger[_0x6544('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x446312,'request\x20sent',JSON[_0x6544('0xe')](_0x12082b));if(_0x12082b[_0x6544('0xf')]){if(_0x12082b['error'][_0x6544('0x10')]===0x1f4){logger[_0x6544('0xf')](_0x6544('0xb'),_0x446312,_0x12082b[_0x6544('0xf')][_0x6544('0x11')]);return _0x28966a(_0x12082b[_0x6544('0xf')][_0x6544('0x11')]);}logger[_0x6544('0xf')](_0x6544('0xb'),_0x446312,_0x12082b[_0x6544('0xf')][_0x6544('0x11')]);return _0x3c884f(_0x12082b[_0x6544('0xf')]['message']);}else{logger[_0x6544('0xa')]('JscriptyProject,\x20%s,\x20%s',_0x446312,'request\x20sent');_0x3c884f(_0x12082b[_0x6544('0x12')][_0x6544('0x11')]);}})['catch'](function(_0x153be5){logger[_0x6544('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x446312,_0x153be5);_0x28966a(_0x153be5);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 012614b..fa4641f 100644 --- a/server/api/jscriptyQuestionReport/index.js +++ b/server/api/jscriptyQuestionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6078=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3afb2b,_0x3cf264){var _0x33cb0f=function(_0x11db22){while(--_0x11db22){_0x3afb2b['push'](_0x3afb2b['shift']());}};_0x33cb0f(++_0x3cf264);}(_0x6078,0x13e));var _0x8607=function(_0x57d383,_0x391a80){_0x57d383=_0x57d383-0x0;var _0x2625f4=_0x6078[_0x57d383];return _0x2625f4;};'use strict';var multer=require(_0x8607('0x0'));var util=require(_0x8607('0x1'));var path=require(_0x8607('0x2'));var timeout=require(_0x8607('0x3'));var express=require('express');var router=express[_0x8607('0x4')]();var fs_extra=require(_0x8607('0x5'));var auth=require(_0x8607('0x6'));var interaction=require(_0x8607('0x7'));var config=require('../../config/environment');var controller=require(_0x8607('0x8'));router[_0x8607('0x9')]('/',auth[_0x8607('0xa')](),controller[_0x8607('0xb')]);router[_0x8607('0x9')](_0x8607('0xc'),auth['isAuthenticated'](),controller[_0x8607('0xd')]);router[_0x8607('0x9')](_0x8607('0xe'),auth[_0x8607('0xa')](),controller[_0x8607('0xf')]);router[_0x8607('0x10')]('/',auth[_0x8607('0xa')](),controller[_0x8607('0x11')]);router[_0x8607('0x12')]('/:id',auth[_0x8607('0xa')](),controller[_0x8607('0x13')]);router[_0x8607('0x14')]('/:id',auth[_0x8607('0xa')](),controller[_0x8607('0x15')]);module[_0x8607('0x16')]=router; \ No newline at end of file +var _0x122a=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0x122a,0xba));var _0xa122=function(_0xd66e1f,_0x576ed5){_0xd66e1f=_0xd66e1f-0x0;var _0x1d9ec7=_0x122a[_0xd66e1f];return _0x1d9ec7;};'use strict';var multer=require(_0xa122('0x0'));var util=require(_0xa122('0x1'));var path=require(_0xa122('0x2'));var timeout=require(_0xa122('0x3'));var express=require(_0xa122('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa122('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa122('0x6'));var controller=require(_0xa122('0x7'));router[_0xa122('0x8')]('/',auth[_0xa122('0x9')](),controller['index']);router['get']('/describe',auth[_0xa122('0x9')](),controller[_0xa122('0xa')]);router['get'](_0xa122('0xb'),auth[_0xa122('0x9')](),controller[_0xa122('0xc')]);router[_0xa122('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa122('0xb'),auth['isAuthenticated'](),controller[_0xa122('0xe')]);router[_0xa122('0xf')]('/:id',auth[_0xa122('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 6cd6e25..0bd5edc 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f4=['exports','TEXT','long','STRING','sequelize'];(function(_0x35ee85,_0x1a870c){var _0x173aed=function(_0x3b7720){while(--_0x3b7720){_0x35ee85['push'](_0x35ee85['shift']());}};_0x173aed(++_0x1a870c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3ef1a3,_0x2123f5){_0x3ef1a3=_0x3ef1a3-0x0;var _0x425579=_0xd4f4[_0x3ef1a3];return _0x425579;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'question':{'type':Sequelize[_0x4d4f('0x2')]},'answer':{'type':Sequelize[_0x4d4f('0x2')](_0x4d4f('0x3'))},'membername':{'type':Sequelize[_0x4d4f('0x4')]},'projectname':{'type':Sequelize[_0x4d4f('0x4')]},'queue':{'type':Sequelize[_0x4d4f('0x4')]},'uniqueid':{'type':Sequelize[_0x4d4f('0x4')]},'calleridname':{'type':Sequelize[_0x4d4f('0x4')]},'calleridnum':{'type':Sequelize[_0x4d4f('0x4')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['STRING','exports','TEXT'];(function(_0x5df60a,_0x4fd7a4){var _0x271f37=function(_0x53b682){while(--_0x53b682){_0x5df60a['push'](_0x5df60a['shift']());}};_0x271f37(++_0x4fd7a4);}(_0x2032,0xd9));var _0x2203=function(_0x1a57f0,_0x16b04f){_0x1a57f0=_0x1a57f0-0x0;var _0x55b10d=_0x2032[_0x1a57f0];return _0x55b10d;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'question':{'type':Sequelize[_0x2203('0x1')]},'answer':{'type':Sequelize[_0x2203('0x1')]('long')},'membername':{'type':Sequelize[_0x2203('0x2')]},'projectname':{'type':Sequelize[_0x2203('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2203('0x2')]},'calleridname':{'type':Sequelize[_0x2203('0x2')]},'calleridnum':{'type':Sequelize[_0x2203('0x2')]},'questionId':{'type':Sequelize[_0x2203('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index e013ed5..8f7a9b3 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x852c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','count','includeAll','include','findAll','rows','catch','show','keys','length','find','create','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x852c,0x179));var _0xc852=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x852c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc852('0x0'));var rimraf=require(_0xc852('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc852('0x2'));var rp=require(_0xc852('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc852('0x4'));var util=require(_0xc852('0x5'));var path=require(_0xc852('0x6'));var sox=require(_0xc852('0x7'));var csv=require(_0xc852('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc852('0x9'));var squel=require(_0xc852('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc852('0xb'));var toCsv=require(_0xc852('0x8'));var querystring=require(_0xc852('0xc'));var Papa=require(_0xc852('0xd'));var Redis=require(_0xc852('0xe'));var authService=require(_0xc852('0xf'));var qs=require(_0xc852('0x10'));var as=require(_0xc852('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc852('0x12'))('api');var utils=require(_0xc852('0x13'));var config=require(_0xc852('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc852('0x15'))['db'];function respondWithStatusCode(_0x5dcae3,_0x1b0e2a){_0x1b0e2a=_0x1b0e2a||0xcc;return function(_0x2de381){if(_0x2de381){return _0x5dcae3['sendStatus'](_0x1b0e2a);}return _0x5dcae3[_0xc852('0x16')](_0x1b0e2a)['end']();};}function respondWithResult(_0x2efe73,_0x23eb5a){_0x23eb5a=_0x23eb5a||0xc8;return function(_0x400e0c){if(_0x400e0c){return _0x2efe73[_0xc852('0x16')](_0x23eb5a)[_0xc852('0x17')](_0x400e0c);}};}function respondWithFilteredResult(_0x374345,_0x2e3a3f){return function(_0x4c6429){if(_0x4c6429){var _0x4f3095=typeof _0x2e3a3f[_0xc852('0x18')]===_0xc852('0x19')&&typeof _0x2e3a3f['limit']==='undefined';var _0x23968d=_0x4c6429['count'];var _0xb9f57b=_0x4f3095?0x0:_0x2e3a3f[_0xc852('0x18')];var _0x1df328=_0x4f3095?_0x4c6429['count']:_0x2e3a3f[_0xc852('0x18')]+_0x2e3a3f[_0xc852('0x1a')];var _0x44de00;if(_0x1df328>=_0x23968d){_0x1df328=_0x23968d;_0x44de00=0xc8;}else{_0x44de00=0xce;}_0x374345[_0xc852('0x16')](_0x44de00);return _0x374345[_0xc852('0x1b')](_0xc852('0x1c'),_0xb9f57b+'-'+_0x1df328+'/'+_0x23968d)[_0xc852('0x17')](_0x4c6429);}return null;};}function patchUpdates(_0x3442e2){return function(_0x4b68cf){try{jsonpatch[_0xc852('0x1d')](_0x4b68cf,_0x3442e2,!![]);}catch(_0x393981){return BPromise['reject'](_0x393981);}return _0x4b68cf[_0xc852('0x1e')]();};}function saveUpdates(_0x1b04b5,_0x80bb62){return function(_0x312a2a){if(_0x312a2a){return _0x312a2a[_0xc852('0x1f')](_0x1b04b5)['then'](function(_0x43c34a){return _0x43c34a;});}return null;};}function removeEntity(_0x4ca57c,_0x64510e){return function(_0x267c07){if(_0x267c07){return _0x267c07[_0xc852('0x20')]()[_0xc852('0x21')](function(){_0x4ca57c[_0xc852('0x16')](0xcc)[_0xc852('0x22')]();});}};}function handleEntityNotFound(_0xcc516a,_0x5f03c2){return function(_0x1c6c58){if(!_0x1c6c58){_0xcc516a[_0xc852('0x23')](0x194);}return _0x1c6c58;};}function handleError(_0x354d67,_0x1a1327){_0x1a1327=_0x1a1327||0x1f4;return function(_0x1a7b45){logger[_0xc852('0x24')](_0x1a7b45[_0xc852('0x25')]);if(_0x1a7b45['name']){delete _0x1a7b45[_0xc852('0x26')];}_0x354d67[_0xc852('0x16')](_0x1a1327)[_0xc852('0x27')](_0x1a7b45);};}function getMustacheRender(_0x560c91,_0x1266e0){return Mustache[_0xc852('0x28')](_0x560c91,_[_0xc852('0x29')](_0x1266e0[_0xc852('0x2a')],{'contact':_0x1266e0[_0xc852('0x2b')],'message':_0x1266e0[_0xc852('0x2c')],'agent':_0x1266e0['agent'],'interaction':_0x1266e0[_0xc852('0x2d')],'account':_0x1266e0[_0xc852('0x2e')]}))||'';}exports[_0xc852('0x2f')]=function(_0x53d5a1,_0x159d85){var _0x1895e0={},_0x4bed90={},_0x3eb665={'count':0x0,'rows':[]};var _0x27c4e9=_[_0xc852('0x30')](db[_0xc852('0x31')][_0xc852('0x32')],function(_0x5f2055){return{'name':_0x5f2055[_0xc852('0x33')],'type':_0x5f2055[_0xc852('0x34')]['key']};});_0x4bed90[_0xc852('0x35')]=_[_0xc852('0x30')](_0x27c4e9,_0xc852('0x26'));_0x4bed90[_0xc852('0x36')]=_['keys'](_0x53d5a1['query']);_0x4bed90[_0xc852('0x37')]=_[_0xc852('0x38')](_0x4bed90['model'],_0x4bed90[_0xc852('0x36')]);_0x1895e0['attributes']=_[_0xc852('0x38')](_0x4bed90[_0xc852('0x35')],qs[_0xc852('0x39')](_0x53d5a1[_0xc852('0x36')]['fields']));_0x1895e0[_0xc852('0x3a')]=_0x1895e0['attributes']['length']?_0x1895e0[_0xc852('0x3a')]:_0x4bed90[_0xc852('0x35')];if(!_0x53d5a1[_0xc852('0x36')]['hasOwnProperty'](_0xc852('0x3b'))){_0x1895e0[_0xc852('0x1a')]=qs['limit'](_0x53d5a1[_0xc852('0x36')][_0xc852('0x1a')]);_0x1895e0[_0xc852('0x18')]=qs['offset'](_0x53d5a1[_0xc852('0x36')][_0xc852('0x18')]);}_0x1895e0[_0xc852('0x3c')]=qs[_0xc852('0x3d')](_0x53d5a1[_0xc852('0x36')][_0xc852('0x3d')]);_0x1895e0[_0xc852('0x3e')]=qs[_0xc852('0x37')](_[_0xc852('0x3f')](_0x53d5a1[_0xc852('0x36')],_0x4bed90[_0xc852('0x37')]),_0x27c4e9);if(_0x53d5a1[_0xc852('0x36')][_0xc852('0x40')]){_0x1895e0[_0xc852('0x3e')]=_[_0xc852('0x29')](_0x1895e0[_0xc852('0x3e')],{'$or':_[_0xc852('0x30')](_0x27c4e9,function(_0x56fa88){if(_0x56fa88[_0xc852('0x34')]!=='VIRTUAL'){var _0x696b10={};_0x696b10[_0x56fa88[_0xc852('0x26')]]={'$like':'%'+_0x53d5a1[_0xc852('0x36')][_0xc852('0x40')]+'%'};return _0x696b10;}})});}_0x1895e0=_[_0xc852('0x29')]({},_0x1895e0,_0x53d5a1['options']);var _0x39a7ec={'where':_0x1895e0[_0xc852('0x3e')]};return db['JscriptyQuestionReport'][_0xc852('0x41')](_0x39a7ec)[_0xc852('0x21')](function(_0x4c4272){_0x3eb665[_0xc852('0x41')]=_0x4c4272;if(_0x53d5a1['query'][_0xc852('0x42')]){_0x1895e0[_0xc852('0x43')]=[{'all':!![]}];}return db[_0xc852('0x31')][_0xc852('0x44')](_0x1895e0);})['then'](function(_0x335396){_0x3eb665[_0xc852('0x45')]=_0x335396;return _0x3eb665;})[_0xc852('0x21')](respondWithFilteredResult(_0x159d85,_0x1895e0))[_0xc852('0x46')](handleError(_0x159d85,null));};exports[_0xc852('0x47')]=function(_0x208ec0,_0xed13eb){var _0x5aa7ba={'raw':!![],'where':{'id':_0x208ec0['params']['id']}},_0x5a13ce={};_0x5a13ce[_0xc852('0x35')]=_[_0xc852('0x48')](db[_0xc852('0x31')][_0xc852('0x32')]);_0x5a13ce[_0xc852('0x36')]=_[_0xc852('0x48')](_0x208ec0[_0xc852('0x36')]);_0x5a13ce[_0xc852('0x37')]=_[_0xc852('0x38')](_0x5a13ce[_0xc852('0x35')],_0x5a13ce[_0xc852('0x36')]);_0x5aa7ba['attributes']=_[_0xc852('0x38')](_0x5a13ce[_0xc852('0x35')],qs[_0xc852('0x39')](_0x208ec0[_0xc852('0x36')][_0xc852('0x39')]));_0x5aa7ba[_0xc852('0x3a')]=_0x5aa7ba[_0xc852('0x3a')][_0xc852('0x49')]?_0x5aa7ba[_0xc852('0x3a')]:_0x5a13ce[_0xc852('0x35')];if(_0x208ec0[_0xc852('0x36')][_0xc852('0x42')]){_0x5aa7ba[_0xc852('0x43')]=[{'all':!![]}];}_0x5aa7ba=_[_0xc852('0x29')]({},_0x5aa7ba,_0x208ec0['options']);return db[_0xc852('0x31')][_0xc852('0x4a')](_0x5aa7ba)[_0xc852('0x21')](handleEntityNotFound(_0xed13eb,null))[_0xc852('0x21')](respondWithResult(_0xed13eb,null))[_0xc852('0x46')](handleError(_0xed13eb,null));};exports['create']=function(_0x16e93f,_0x96abea){return db[_0xc852('0x31')][_0xc852('0x4b')](_0x16e93f[_0xc852('0x2a')],{})[_0xc852('0x21')](respondWithResult(_0x96abea,0xc9))[_0xc852('0x46')](handleError(_0x96abea,null));};exports[_0xc852('0x1f')]=function(_0x4331e7,_0xcbb110){if(_0x4331e7[_0xc852('0x2a')]['id']){delete _0x4331e7['body']['id'];}return db[_0xc852('0x31')][_0xc852('0x4a')]({'where':{'id':_0x4331e7['params']['id']}})[_0xc852('0x21')](handleEntityNotFound(_0xcbb110,null))[_0xc852('0x21')](saveUpdates(_0x4331e7['body'],null))[_0xc852('0x21')](respondWithResult(_0xcbb110,null))[_0xc852('0x46')](handleError(_0xcbb110,null));};exports['destroy']=function(_0x1237c7,_0x2e04de){return db['JscriptyQuestionReport'][_0xc852('0x4a')]({'where':{'id':_0x1237c7[_0xc852('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e04de,null))[_0xc852('0x21')](removeEntity(_0x2e04de,null))[_0xc852('0x46')](handleError(_0x2e04de,null));};exports[_0xc852('0x4d')]=function(_0xc26c15,_0x1f7ee3){return db[_0xc852('0x31')][_0xc852('0x4d')]()['then'](respondWithResult(_0x1f7ee3,null))[_0xc852('0x46')](handleError(_0x1f7ee3,null));}; \ No newline at end of file +var _0xb692=['end','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','stack','name','render','merge','body','contact','message','agent','interaction','account','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','show','params','length','catch','create','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus'];(function(_0x2654e4,_0x37582e){var _0x45ace6=function(_0x2f1ab3){while(--_0x2f1ab3){_0x2654e4['push'](_0x2654e4['shift']());}};_0x45ace6(++_0x37582e);}(_0xb692,0xcb));var _0x2b69=function(_0x2c7516,_0x2ca7f1){_0x2c7516=_0x2c7516-0x0;var _0x1d76a2=_0xb692[_0x2c7516];return _0x1d76a2;};'use strict';var emlformat=require(_0x2b69('0x0'));var rimraf=require(_0x2b69('0x1'));var zipdir=require(_0x2b69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b69('0x3'));var moment=require(_0x2b69('0x4'));var BPromise=require(_0x2b69('0x5'));var Mustache=require(_0x2b69('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2b69('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b69('0x8'));var _=require(_0x2b69('0x9'));var squel=require(_0x2b69('0xa'));var crypto=require(_0x2b69('0xb'));var jsforce=require(_0x2b69('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2b69('0x7'));var querystring=require(_0x2b69('0xd'));var Papa=require(_0x2b69('0xe'));var Redis=require(_0x2b69('0xf'));var authService=require(_0x2b69('0x10'));var qs=require(_0x2b69('0x11'));var as=require(_0x2b69('0x12'));var hardwareService=require(_0x2b69('0x13'));var logger=require(_0x2b69('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c30fa,_0x54a860){_0x54a860=_0x54a860||0xcc;return function(_0x18adca){if(_0x18adca){return _0x5c30fa[_0x2b69('0x15')](_0x54a860);}return _0x5c30fa['status'](_0x54a860)[_0x2b69('0x16')]();};}function respondWithResult(_0x2f57aa,_0x28a584){_0x28a584=_0x28a584||0xc8;return function(_0x557d19){if(_0x557d19){return _0x2f57aa[_0x2b69('0x17')](_0x28a584)[_0x2b69('0x18')](_0x557d19);}};}function respondWithFilteredResult(_0x369e44,_0x246839){return function(_0xd41c7d){if(_0xd41c7d){var _0x526567=typeof _0x246839[_0x2b69('0x19')]===_0x2b69('0x1a')&&typeof _0x246839[_0x2b69('0x1b')]===_0x2b69('0x1a');var _0xb375c0=_0xd41c7d[_0x2b69('0x1c')];var _0x8967d6=_0x526567?0x0:_0x246839['offset'];var _0x14861c=_0x526567?_0xd41c7d[_0x2b69('0x1c')]:_0x246839[_0x2b69('0x19')]+_0x246839['limit'];var _0x207431;if(_0x14861c>=_0xb375c0){_0x14861c=_0xb375c0;_0x207431=0xc8;}else{_0x207431=0xce;}_0x369e44[_0x2b69('0x17')](_0x207431);return _0x369e44['set'](_0x2b69('0x1d'),_0x8967d6+'-'+_0x14861c+'/'+_0xb375c0)[_0x2b69('0x18')](_0xd41c7d);}return null;};}function patchUpdates(_0x7e5b46){return function(_0x5b3888){try{jsonpatch['apply'](_0x5b3888,_0x7e5b46,!![]);}catch(_0x2647ac){return BPromise[_0x2b69('0x1e')](_0x2647ac);}return _0x5b3888[_0x2b69('0x1f')]();};}function saveUpdates(_0x302af3,_0x1c0a14){return function(_0xa4c846){if(_0xa4c846){return _0xa4c846['update'](_0x302af3)[_0x2b69('0x20')](function(_0x430a69){return _0x430a69;});}return null;};}function removeEntity(_0x4f2a5d,_0x42bea5){return function(_0x18375b){if(_0x18375b){return _0x18375b['destroy']()['then'](function(){_0x4f2a5d[_0x2b69('0x17')](0xcc)[_0x2b69('0x16')]();});}};}function handleEntityNotFound(_0x57636b,_0xfc99c8){return function(_0x5a2ae0){if(!_0x5a2ae0){_0x57636b[_0x2b69('0x15')](0x194);}return _0x5a2ae0;};}function handleError(_0x4ec151,_0x44be34){_0x44be34=_0x44be34||0x1f4;return function(_0x3f5077){logger['error'](_0x3f5077[_0x2b69('0x21')]);if(_0x3f5077['name']){delete _0x3f5077[_0x2b69('0x22')];}_0x4ec151[_0x2b69('0x17')](_0x44be34)['send'](_0x3f5077);};}function getMustacheRender(_0xb3f57e,_0x1f7613){return Mustache[_0x2b69('0x23')](_0xb3f57e,_[_0x2b69('0x24')](_0x1f7613[_0x2b69('0x25')],{'contact':_0x1f7613[_0x2b69('0x26')],'message':_0x1f7613[_0x2b69('0x27')],'agent':_0x1f7613[_0x2b69('0x28')],'interaction':_0x1f7613[_0x2b69('0x29')],'account':_0x1f7613[_0x2b69('0x2a')]}))||'';}exports[_0x2b69('0x2b')]=function(_0x369447,_0x26a414){var _0x2e1458={},_0x38d8c0={},_0x37af2a={'count':0x0,'rows':[]};var _0x1145bf=_['map'](db[_0x2b69('0x2c')][_0x2b69('0x2d')],function(_0x269031){return{'name':_0x269031[_0x2b69('0x2e')],'type':_0x269031[_0x2b69('0x2f')][_0x2b69('0x30')]};});_0x38d8c0[_0x2b69('0x31')]=_[_0x2b69('0x32')](_0x1145bf,_0x2b69('0x22'));_0x38d8c0[_0x2b69('0x33')]=_[_0x2b69('0x34')](_0x369447['query']);_0x38d8c0[_0x2b69('0x35')]=_[_0x2b69('0x36')](_0x38d8c0['model'],_0x38d8c0['query']);_0x2e1458[_0x2b69('0x37')]=_[_0x2b69('0x36')](_0x38d8c0[_0x2b69('0x31')],qs[_0x2b69('0x38')](_0x369447[_0x2b69('0x33')][_0x2b69('0x38')]));_0x2e1458[_0x2b69('0x37')]=_0x2e1458['attributes']['length']?_0x2e1458[_0x2b69('0x37')]:_0x38d8c0['model'];if(!_0x369447[_0x2b69('0x33')][_0x2b69('0x39')](_0x2b69('0x3a'))){_0x2e1458[_0x2b69('0x1b')]=qs['limit'](_0x369447[_0x2b69('0x33')][_0x2b69('0x1b')]);_0x2e1458[_0x2b69('0x19')]=qs['offset'](_0x369447[_0x2b69('0x33')][_0x2b69('0x19')]);}_0x2e1458[_0x2b69('0x3b')]=qs[_0x2b69('0x3c')](_0x369447[_0x2b69('0x33')]['sort']);_0x2e1458[_0x2b69('0x3d')]=qs[_0x2b69('0x35')](_[_0x2b69('0x3e')](_0x369447[_0x2b69('0x33')],_0x38d8c0['filters']),_0x1145bf);if(_0x369447[_0x2b69('0x33')]['filter']){_0x2e1458[_0x2b69('0x3d')]=_[_0x2b69('0x24')](_0x2e1458[_0x2b69('0x3d')],{'$or':_[_0x2b69('0x32')](_0x1145bf,function(_0x4b16f7){if(_0x4b16f7[_0x2b69('0x2f')]!=='VIRTUAL'){var _0x19bb41={};_0x19bb41[_0x4b16f7[_0x2b69('0x22')]]={'$like':'%'+_0x369447[_0x2b69('0x33')][_0x2b69('0x3f')]+'%'};return _0x19bb41;}})});}_0x2e1458=_[_0x2b69('0x24')]({},_0x2e1458,_0x369447[_0x2b69('0x40')]);var _0x9b324e={'where':_0x2e1458['where']};return db['JscriptyQuestionReport'][_0x2b69('0x1c')](_0x9b324e)[_0x2b69('0x20')](function(_0x2e0d8b){_0x37af2a['count']=_0x2e0d8b;if(_0x369447[_0x2b69('0x33')][_0x2b69('0x41')]){_0x2e1458[_0x2b69('0x42')]=[{'all':!![]}];}return db[_0x2b69('0x2c')]['findAll'](_0x2e1458);})[_0x2b69('0x20')](function(_0x206032){_0x37af2a['rows']=_0x206032;return _0x37af2a;})[_0x2b69('0x20')](respondWithFilteredResult(_0x26a414,_0x2e1458))['catch'](handleError(_0x26a414,null));};exports[_0x2b69('0x43')]=function(_0x3056fc,_0x5eb260){var _0x416bea={'raw':!![],'where':{'id':_0x3056fc[_0x2b69('0x44')]['id']}},_0x16920e={};_0x16920e[_0x2b69('0x31')]=_[_0x2b69('0x34')](db['JscriptyQuestionReport'][_0x2b69('0x2d')]);_0x16920e[_0x2b69('0x33')]=_[_0x2b69('0x34')](_0x3056fc['query']);_0x16920e['filters']=_[_0x2b69('0x36')](_0x16920e['model'],_0x16920e[_0x2b69('0x33')]);_0x416bea[_0x2b69('0x37')]=_['intersection'](_0x16920e[_0x2b69('0x31')],qs[_0x2b69('0x38')](_0x3056fc[_0x2b69('0x33')]['fields']));_0x416bea['attributes']=_0x416bea[_0x2b69('0x37')][_0x2b69('0x45')]?_0x416bea[_0x2b69('0x37')]:_0x16920e['model'];if(_0x3056fc[_0x2b69('0x33')][_0x2b69('0x41')]){_0x416bea[_0x2b69('0x42')]=[{'all':!![]}];}_0x416bea=_['merge']({},_0x416bea,_0x3056fc[_0x2b69('0x40')]);return db[_0x2b69('0x2c')]['find'](_0x416bea)[_0x2b69('0x20')](handleEntityNotFound(_0x5eb260,null))[_0x2b69('0x20')](respondWithResult(_0x5eb260,null))[_0x2b69('0x46')](handleError(_0x5eb260,null));};exports[_0x2b69('0x47')]=function(_0x1b359d,_0x3bedf4){return db[_0x2b69('0x2c')][_0x2b69('0x47')](_0x1b359d[_0x2b69('0x25')],{})[_0x2b69('0x20')](respondWithResult(_0x3bedf4,0xc9))['catch'](handleError(_0x3bedf4,null));};exports['update']=function(_0x38da42,_0x5553cc){if(_0x38da42[_0x2b69('0x25')]['id']){delete _0x38da42['body']['id'];}return db[_0x2b69('0x2c')][_0x2b69('0x48')]({'where':{'id':_0x38da42[_0x2b69('0x44')]['id']}})[_0x2b69('0x20')](handleEntityNotFound(_0x5553cc,null))['then'](saveUpdates(_0x38da42['body'],null))[_0x2b69('0x20')](respondWithResult(_0x5553cc,null))[_0x2b69('0x46')](handleError(_0x5553cc,null));};exports[_0x2b69('0x49')]=function(_0x522a6c,_0x21dcb5){return db[_0x2b69('0x2c')][_0x2b69('0x48')]({'where':{'id':_0x522a6c['params']['id']}})[_0x2b69('0x20')](handleEntityNotFound(_0x21dcb5,null))['then'](removeEntity(_0x21dcb5,null))[_0x2b69('0x46')](handleError(_0x21dcb5,null));};exports[_0x2b69('0x4a')]=function(_0x1e5bde,_0x4c4d78){return db['JscriptyQuestionReport'][_0x2b69('0x4a')]()['then'](respondWithResult(_0x4c4d78,null))[_0x2b69('0x46')](handleError(_0x4c4d78,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 2ee5043..4d15200 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x881b=['rimraf','exports','define','JscriptyQuestionReport','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1ff229,_0x399aa4){var _0x1cb059=function(_0x2e82fb){while(--_0x2e82fb){_0x1ff229['push'](_0x1ff229['shift']());}};_0x1cb059(++_0x399aa4);}(_0x881b,0xae));var _0xb881=function(_0x4ebe24,_0x495919){_0x4ebe24=_0x4ebe24-0x0;var _0x2a4300=_0x881b[_0x4ebe24];return _0x2a4300;};'use strict';var _=require(_0xb881('0x0'));var util=require('util');var logger=require(_0xb881('0x1'))('api');var moment=require(_0xb881('0x2'));var BPromise=require(_0xb881('0x3'));var rp=require(_0xb881('0x4'));var fs=require('fs');var path=require(_0xb881('0x5'));var rimraf=require(_0xb881('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0xb881('0x7')]=function(_0x57b53f,_0x448ed3){return _0x57b53f[_0xb881('0x8')](_0xb881('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dd0=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','report_jscripty_questions','lodash'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x7dd0,0xaf));var _0x07dd=function(_0x5ca726,_0x5ee330){_0x5ca726=_0x5ca726-0x0;var _0x2c5c8a=_0x7dd0[_0x5ca726];return _0x2c5c8a;};'use strict';var _=require(_0x07dd('0x0'));var util=require(_0x07dd('0x1'));var logger=require(_0x07dd('0x2'))('api');var moment=require(_0x07dd('0x3'));var BPromise=require(_0x07dd('0x4'));var rp=require(_0x07dd('0x5'));var fs=require('fs');var path=require(_0x07dd('0x6'));var rimraf=require(_0x07dd('0x7'));var config=require(_0x07dd('0x8'));var attributes=require(_0x07dd('0x9'));module['exports']=function(_0xad73b1,_0x48b896){return _0xad73b1['define']('JscriptyQuestionReport',attributes,{'tableName':_0x07dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index ea7857f..a66b93b 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f0c=['jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7f0c,0x161));var _0xc7f0=function(_0x11e213,_0x4f2b14){_0x11e213=_0x11e213-0x0;var _0x504df2=_0x7f0c[_0x11e213];return _0x504df2;};'use strict';var _=require(_0xc7f0('0x0'));var util=require(_0xc7f0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7f0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7f0('0x3'))['db'];var utils=require(_0xc7f0('0x4'));var logger=require(_0xc7f0('0x5'))(_0xc7f0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7f0('0x7'));var client=jayson[_0xc7f0('0x8')][_0xc7f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31bedf,_0x584125,_0x3ae446){return new BPromise(function(_0x2852b2,_0x43b862){return client[_0xc7f0('0xa')](_0x31bedf,_0x3ae446)['then'](function(_0x27971a){logger[_0xc7f0('0xb')](_0xc7f0('0xc'),_0x584125,_0xc7f0('0xd'));logger[_0xc7f0('0xe')](_0xc7f0('0xf'),_0x584125,_0xc7f0('0xd'),JSON['stringify'](_0x27971a));if(_0x27971a[_0xc7f0('0x10')]){if(_0x27971a['error'][_0xc7f0('0x11')]===0x1f4){logger[_0xc7f0('0x10')](_0xc7f0('0xc'),_0x584125,_0x27971a[_0xc7f0('0x10')][_0xc7f0('0x12')]);return _0x43b862(_0x27971a[_0xc7f0('0x10')]['message']);}logger[_0xc7f0('0x10')](_0xc7f0('0xc'),_0x584125,_0x27971a[_0xc7f0('0x10')]['message']);return _0x2852b2(_0x27971a[_0xc7f0('0x10')][_0xc7f0('0x12')]);}else{logger['info'](_0xc7f0('0xc'),_0x584125,_0xc7f0('0xd'));_0x2852b2(_0x27971a['result'][_0xc7f0('0x12')]);}})[_0xc7f0('0x13')](function(_0x59c642){logger[_0xc7f0('0x10')](_0xc7f0('0xc'),_0x584125,_0x59c642);_0x43b862(_0x59c642);});});} \ No newline at end of file +var _0x30e4=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x506b95,_0x474f53){var _0x1c7492=function(_0x321445){while(--_0x321445){_0x506b95['push'](_0x506b95['shift']());}};_0x1c7492(++_0x474f53);}(_0x30e4,0xb1));var _0x430e=function(_0x3fe231,_0x367b04){_0x3fe231=_0x3fe231-0x0;var _0xadf559=_0x30e4[_0x3fe231];return _0xadf559;};'use strict';var _=require('lodash');var util=require(_0x430e('0x0'));var moment=require(_0x430e('0x1'));var BPromise=require(_0x430e('0x2'));var rs=require(_0x430e('0x3'));var fs=require('fs');var Redis=require(_0x430e('0x4'));var db=require(_0x430e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x430e('0x6'));var jayson=require(_0x430e('0x7'));var client=jayson[_0x430e('0x8')][_0x430e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49db92,_0x287693,_0x2ae778){return new BPromise(function(_0x4890f1,_0x234dad){return client[_0x430e('0xa')](_0x49db92,_0x2ae778)[_0x430e('0xb')](function(_0x4b0d79){logger[_0x430e('0xc')](_0x430e('0xd'),_0x287693,_0x430e('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x287693,_0x430e('0xe'),JSON[_0x430e('0xf')](_0x4b0d79));if(_0x4b0d79[_0x430e('0x10')]){if(_0x4b0d79[_0x430e('0x10')]['code']===0x1f4){logger[_0x430e('0x10')](_0x430e('0xd'),_0x287693,_0x4b0d79[_0x430e('0x10')][_0x430e('0x11')]);return _0x234dad(_0x4b0d79[_0x430e('0x10')][_0x430e('0x11')]);}logger[_0x430e('0x10')](_0x430e('0xd'),_0x287693,_0x4b0d79[_0x430e('0x10')][_0x430e('0x11')]);return _0x4890f1(_0x4b0d79[_0x430e('0x10')][_0x430e('0x11')]);}else{logger['info'](_0x430e('0xd'),_0x287693,_0x430e('0xe'));_0x4890f1(_0x4b0d79[_0x430e('0x12')][_0x430e('0x11')]);}})[_0x430e('0x13')](function(_0x2b29da){logger[_0x430e('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x287693,_0x2b29da);_0x234dad(_0x2b29da);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d7c7b06..0511145 100644 --- a/server/api/jscriptySessionReport/index.js +++ b/server/api/jscriptySessionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','show','/:id/questions','getQuestions','put','delete','/:id','destroy','exports','multer'];(function(_0xe57cc,_0x2e16cb){var _0x1e21a2=function(_0x21b5b3){while(--_0x21b5b3){_0xe57cc['push'](_0xe57cc['shift']());}};_0x1e21a2(++_0x2e16cb);}(_0x326f,0xd1));var _0xf326=function(_0x53a35c,_0x3acfd8){_0x53a35c=_0x53a35c-0x0;var _0x46982f=_0x326f[_0x53a35c];return _0x46982f;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['post']('/',auth[_0xf326('0xa')](),controller['create']);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);module[_0xf326('0x14')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','exports','multer','path','connect-timeout','express'];(function(_0x21720f,_0x41a5d5){var _0x436da1=function(_0x46173a){while(--_0x46173a){_0x21720f['push'](_0x21720f['shift']());}};_0x436da1(++_0x41a5d5);}(_0x7217,0x19e));var _0x7721=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x7217[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x11')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x14')]);router['delete'](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);module[_0x7721('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d7bfefb..e869cf1 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5797=['moment','sequelize','exports','DATE','setDataValue','endtime','format','STRING','BOOLEAN'];(function(_0x4b0c3e,_0x50754a){var _0xa99d4e=function(_0x1034a2){while(--_0x1034a2){_0x4b0c3e['push'](_0x4b0c3e['shift']());}};_0xa99d4e(++_0x50754a);}(_0x5797,0x1e6));var _0x7579=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x5797[_0x1762b4];return _0x29beda;};'use strict';var moment=require(_0x7579('0x0'));var Sequelize=require(_0x7579('0x1'));module[_0x7579('0x2')]={'starttime':{'type':Sequelize[_0x7579('0x3')],'set':function(_0x44954f){this[_0x7579('0x4')]('starttime',_0x44954f);this[_0x7579('0x4')](_0x7579('0x5'),moment()[_0x7579('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7579('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7579('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x7579('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xd79f=['starttime','endtime','format','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue'];(function(_0x498789,_0x465536){var _0x3f8b64=function(_0x47b635){while(--_0x47b635){_0x498789['push'](_0x498789['shift']());}};_0x3f8b64(++_0x465536);}(_0xd79f,0x1e2));var _0xfd79=function(_0x414e94,_0x422c0d){_0x414e94=_0x414e94-0x0;var _0x260815=_0xd79f[_0x414e94];return _0x260815;};'use strict';var moment=require('moment');var Sequelize=require(_0xfd79('0x0'));module[_0xfd79('0x1')]={'starttime':{'type':Sequelize[_0xfd79('0x2')],'set':function(_0x499617){this[_0xfd79('0x3')](_0xfd79('0x4'),_0x499617);this[_0xfd79('0x3')](_0xfd79('0x5'),moment()[_0xfd79('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xfd79('0x2')]},'membername':{'type':Sequelize[_0xfd79('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfd79('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xfd79('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index fdc04a5..7d61cb6 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ff9=['rows','catch','params','find','create','describe','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','render','merge','body','contact','agent','account','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll'];(function(_0x66baf9,_0x3f9e75){var _0x2b2b52=function(_0x457039){while(--_0x457039){_0x66baf9['push'](_0x66baf9['shift']());}};_0x2b2b52(++_0x3f9e75);}(_0x5ff9,0x1ef));var _0x95ff=function(_0x408286,_0x3e8a49){_0x408286=_0x408286-0x0;var _0x28d1ac=_0x5ff9[_0x408286];return _0x28d1ac;};'use strict';var emlformat=require(_0x95ff('0x0'));var rimraf=require(_0x95ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ff('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x95ff('0x3'));var Mustache=require(_0x95ff('0x4'));var util=require(_0x95ff('0x5'));var path=require(_0x95ff('0x6'));var sox=require(_0x95ff('0x7'));var csv=require(_0x95ff('0x8'));var ejs=require(_0x95ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95ff('0xa'));var squel=require(_0x95ff('0xb'));var crypto=require(_0x95ff('0xc'));var jsforce=require(_0x95ff('0xd'));var deskjs=require(_0x95ff('0xe'));var toCsv=require(_0x95ff('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x95ff('0xf'));var authService=require(_0x95ff('0x10'));var qs=require(_0x95ff('0x11'));var as=require(_0x95ff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95ff('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x95ff('0x14'));var licenseUtil=require(_0x95ff('0x15'));var db=require(_0x95ff('0x16'))['db'];function respondWithStatusCode(_0x245388,_0x5bf54a){_0x5bf54a=_0x5bf54a||0xcc;return function(_0xf3ce4c){if(_0xf3ce4c){return _0x245388[_0x95ff('0x17')](_0x5bf54a);}return _0x245388[_0x95ff('0x18')](_0x5bf54a)['end']();};}function respondWithResult(_0x27845e,_0x50076a){_0x50076a=_0x50076a||0xc8;return function(_0x46fd5d){if(_0x46fd5d){return _0x27845e[_0x95ff('0x18')](_0x50076a)[_0x95ff('0x19')](_0x46fd5d);}};}function respondWithFilteredResult(_0x4f8a94,_0x51e4e6){return function(_0x2eca86){if(_0x2eca86){var _0x545271=typeof _0x51e4e6[_0x95ff('0x1a')]==='undefined'&&typeof _0x51e4e6[_0x95ff('0x1b')]===_0x95ff('0x1c');var _0x53feb4=_0x2eca86[_0x95ff('0x1d')];var _0x125351=_0x545271?0x0:_0x51e4e6[_0x95ff('0x1a')];var _0x10517b=_0x545271?_0x2eca86[_0x95ff('0x1d')]:_0x51e4e6['offset']+_0x51e4e6[_0x95ff('0x1b')];var _0x46e91e;if(_0x10517b>=_0x53feb4){_0x10517b=_0x53feb4;_0x46e91e=0xc8;}else{_0x46e91e=0xce;}_0x4f8a94[_0x95ff('0x18')](_0x46e91e);return _0x4f8a94[_0x95ff('0x1e')](_0x95ff('0x1f'),_0x125351+'-'+_0x10517b+'/'+_0x53feb4)['json'](_0x2eca86);}return null;};}function patchUpdates(_0xa6854a){return function(_0x56f7ab){try{jsonpatch['apply'](_0x56f7ab,_0xa6854a,!![]);}catch(_0x5cc988){return BPromise[_0x95ff('0x20')](_0x5cc988);}return _0x56f7ab[_0x95ff('0x21')]();};}function saveUpdates(_0x1d3065,_0x3025ab){return function(_0x2b21f7){if(_0x2b21f7){return _0x2b21f7[_0x95ff('0x22')](_0x1d3065)[_0x95ff('0x23')](function(_0xa314b0){return _0xa314b0;});}return null;};}function removeEntity(_0x4143d0,_0x5dfd76){return function(_0x22ca54){if(_0x22ca54){return _0x22ca54[_0x95ff('0x24')]()[_0x95ff('0x23')](function(){_0x4143d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x599ba1,_0x5c9d29){return function(_0x2324c7){if(!_0x2324c7){_0x599ba1[_0x95ff('0x17')](0x194);}return _0x2324c7;};}function handleError(_0x1dfc6b,_0x2e7d0b){_0x2e7d0b=_0x2e7d0b||0x1f4;return function(_0xeeb27){logger[_0x95ff('0x25')](_0xeeb27['stack']);if(_0xeeb27[_0x95ff('0x26')]){delete _0xeeb27[_0x95ff('0x26')];}_0x1dfc6b['status'](_0x2e7d0b)[_0x95ff('0x27')](_0xeeb27);};}function getMustacheRender(_0x102e8d,_0x2dc41b){return Mustache[_0x95ff('0x28')](_0x102e8d,_[_0x95ff('0x29')](_0x2dc41b[_0x95ff('0x2a')],{'contact':_0x2dc41b[_0x95ff('0x2b')],'message':_0x2dc41b['message'],'agent':_0x2dc41b[_0x95ff('0x2c')],'interaction':_0x2dc41b['interaction'],'account':_0x2dc41b[_0x95ff('0x2d')]}))||'';}exports[_0x95ff('0x2e')]=function(_0x10688b,_0x4204c3){var _0x4fb84b={},_0x3e23bf={},_0x3ef0f5={'count':0x0,'rows':[]};var _0x180751=_[_0x95ff('0x2f')](db[_0x95ff('0x30')][_0x95ff('0x31')],function(_0x4aa4be){return{'name':_0x4aa4be[_0x95ff('0x32')],'type':_0x4aa4be[_0x95ff('0x33')]['key']};});_0x3e23bf[_0x95ff('0x34')]=_[_0x95ff('0x2f')](_0x180751,_0x95ff('0x26'));_0x3e23bf[_0x95ff('0x35')]=_[_0x95ff('0x36')](_0x10688b['query']);_0x3e23bf[_0x95ff('0x37')]=_[_0x95ff('0x38')](_0x3e23bf[_0x95ff('0x34')],_0x3e23bf[_0x95ff('0x35')]);_0x4fb84b[_0x95ff('0x39')]=_[_0x95ff('0x38')](_0x3e23bf['model'],qs['fields'](_0x10688b[_0x95ff('0x35')][_0x95ff('0x3a')]));_0x4fb84b[_0x95ff('0x39')]=_0x4fb84b[_0x95ff('0x39')][_0x95ff('0x3b')]?_0x4fb84b['attributes']:_0x3e23bf[_0x95ff('0x34')];if(!_0x10688b[_0x95ff('0x35')][_0x95ff('0x3c')](_0x95ff('0x3d'))){_0x4fb84b['limit']=qs[_0x95ff('0x1b')](_0x10688b['query']['limit']);_0x4fb84b[_0x95ff('0x1a')]=qs['offset'](_0x10688b[_0x95ff('0x35')][_0x95ff('0x1a')]);}_0x4fb84b[_0x95ff('0x3e')]=qs[_0x95ff('0x3f')](_0x10688b[_0x95ff('0x35')][_0x95ff('0x3f')]);_0x4fb84b[_0x95ff('0x40')]=qs[_0x95ff('0x37')](_[_0x95ff('0x41')](_0x10688b['query'],_0x3e23bf[_0x95ff('0x37')]),_0x180751);if(_0x10688b[_0x95ff('0x35')][_0x95ff('0x42')]){_0x4fb84b[_0x95ff('0x40')]=_[_0x95ff('0x29')](_0x4fb84b[_0x95ff('0x40')],{'$or':_['map'](_0x180751,function(_0x89bc9b){if(_0x89bc9b['type']!==_0x95ff('0x43')){var _0x5e6778={};_0x5e6778[_0x89bc9b[_0x95ff('0x26')]]={'$like':'%'+_0x10688b[_0x95ff('0x35')][_0x95ff('0x42')]+'%'};return _0x5e6778;}})});}_0x4fb84b=_[_0x95ff('0x29')]({},_0x4fb84b,_0x10688b[_0x95ff('0x44')]);var _0x84e35a={'where':_0x4fb84b[_0x95ff('0x40')]};return db[_0x95ff('0x30')][_0x95ff('0x1d')](_0x84e35a)[_0x95ff('0x23')](function(_0x56e24e){_0x3ef0f5[_0x95ff('0x1d')]=_0x56e24e;if(_0x10688b[_0x95ff('0x35')][_0x95ff('0x45')]){_0x4fb84b[_0x95ff('0x46')]=[{'all':!![]}];}return db[_0x95ff('0x30')][_0x95ff('0x47')](_0x4fb84b);})[_0x95ff('0x23')](function(_0x4245fc){_0x3ef0f5[_0x95ff('0x48')]=_0x4245fc;return _0x3ef0f5;})['then'](respondWithFilteredResult(_0x4204c3,_0x4fb84b))[_0x95ff('0x49')](handleError(_0x4204c3,null));};exports['show']=function(_0x3af177,_0x233cd1){var _0x3e2628={'raw':!![],'where':{'id':_0x3af177[_0x95ff('0x4a')]['id']}},_0x16fdff={};_0x16fdff['model']=_['keys'](db[_0x95ff('0x30')][_0x95ff('0x31')]);_0x16fdff[_0x95ff('0x35')]=_['keys'](_0x3af177[_0x95ff('0x35')]);_0x16fdff[_0x95ff('0x37')]=_[_0x95ff('0x38')](_0x16fdff['model'],_0x16fdff['query']);_0x3e2628[_0x95ff('0x39')]=_[_0x95ff('0x38')](_0x16fdff[_0x95ff('0x34')],qs[_0x95ff('0x3a')](_0x3af177[_0x95ff('0x35')][_0x95ff('0x3a')]));_0x3e2628[_0x95ff('0x39')]=_0x3e2628['attributes'][_0x95ff('0x3b')]?_0x3e2628[_0x95ff('0x39')]:_0x16fdff['model'];if(_0x3af177['query'][_0x95ff('0x45')]){_0x3e2628[_0x95ff('0x46')]=[{'all':!![]}];}_0x3e2628=_[_0x95ff('0x29')]({},_0x3e2628,_0x3af177['options']);return db[_0x95ff('0x30')][_0x95ff('0x4b')](_0x3e2628)[_0x95ff('0x23')](handleEntityNotFound(_0x233cd1,null))[_0x95ff('0x23')](respondWithResult(_0x233cd1,null))[_0x95ff('0x49')](handleError(_0x233cd1,null));};exports[_0x95ff('0x4c')]=function(_0x17f08e,_0x3d255b){return db[_0x95ff('0x30')]['create'](_0x17f08e['body'],{})[_0x95ff('0x23')](respondWithResult(_0x3d255b,0xc9))[_0x95ff('0x49')](handleError(_0x3d255b,null));};exports[_0x95ff('0x22')]=function(_0x2d7bb2,_0x40a0b2){if(_0x2d7bb2[_0x95ff('0x2a')]['id']){delete _0x2d7bb2[_0x95ff('0x2a')]['id'];}return db[_0x95ff('0x30')][_0x95ff('0x4b')]({'where':{'id':_0x2d7bb2[_0x95ff('0x4a')]['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x40a0b2,null))[_0x95ff('0x23')](saveUpdates(_0x2d7bb2[_0x95ff('0x2a')],null))[_0x95ff('0x23')](respondWithResult(_0x40a0b2,null))['catch'](handleError(_0x40a0b2,null));};exports[_0x95ff('0x24')]=function(_0x334ada,_0x41a52c){return db[_0x95ff('0x30')][_0x95ff('0x4b')]({'where':{'id':_0x334ada[_0x95ff('0x4a')]['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x41a52c,null))[_0x95ff('0x23')](removeEntity(_0x41a52c,null))[_0x95ff('0x49')](handleError(_0x41a52c,null));};exports[_0x95ff('0x4d')]=function(_0x5d4da1,_0x4b4700){return db['JscriptySessionReport'][_0x95ff('0x4d')]()[_0x95ff('0x23')](respondWithResult(_0x4b4700,null))['catch'](handleError(_0x4b4700,null));};exports['getQuestions']=function(_0x20730c,_0x4b05d7,_0x17a70d){var _0x41298f={'raw':!![],'where':{}};var _0x79b691={};var _0x4a2779={'count':0x0,'rows':[]};return db[_0x95ff('0x30')][_0x95ff('0x4e')]({'where':{'id':_0x20730c['params']['id']}})['then'](handleEntityNotFound(_0x4b05d7,null))['then'](function(_0x5da81d){if(_0x5da81d){_0x79b691['model']=_[_0x95ff('0x36')](db[_0x95ff('0x4f')][_0x95ff('0x31')]);_0x79b691[_0x95ff('0x35')]=_[_0x95ff('0x36')](_0x20730c['query']);_0x79b691[_0x95ff('0x37')]=_[_0x95ff('0x38')](_0x79b691[_0x95ff('0x34')],_0x79b691[_0x95ff('0x35')]);_0x41298f[_0x95ff('0x39')]=_[_0x95ff('0x38')](_0x79b691[_0x95ff('0x34')],qs[_0x95ff('0x3a')](_0x20730c[_0x95ff('0x35')]['fields']));_0x41298f[_0x95ff('0x39')]=_0x41298f['attributes'][_0x95ff('0x3b')]?_0x41298f[_0x95ff('0x39')]:_0x79b691[_0x95ff('0x34')];if(!_0x20730c[_0x95ff('0x35')][_0x95ff('0x3c')](_0x95ff('0x3d'))){_0x41298f[_0x95ff('0x1b')]=qs['limit'](_0x20730c[_0x95ff('0x35')][_0x95ff('0x1b')]);_0x41298f[_0x95ff('0x1a')]=qs[_0x95ff('0x1a')](_0x20730c['query']['offset']);}_0x41298f[_0x95ff('0x3e')]=qs[_0x95ff('0x3f')](_0x20730c[_0x95ff('0x35')][_0x95ff('0x3f')]);_0x41298f[_0x95ff('0x40')]=qs[_0x95ff('0x37')](_[_0x95ff('0x41')](_0x20730c[_0x95ff('0x35')],_0x79b691[_0x95ff('0x37')]));_0x41298f[_0x95ff('0x40')][_0x95ff('0x50')]=_0x5da81d['id'];if(_0x20730c[_0x95ff('0x35')]['filter']){_0x41298f[_0x95ff('0x40')]=_[_0x95ff('0x29')](_0x41298f[_0x95ff('0x40')],{'$or':_[_0x95ff('0x2f')](_0x41298f[_0x95ff('0x39')],function(_0x1362e3){var _0x1ab897={};_0x1ab897[_0x1362e3]={'$like':'%'+_0x20730c['query'][_0x95ff('0x42')]+'%'};return _0x1ab897;})});}_0x41298f=_['merge']({},_0x41298f,_0x20730c['options']);return db[_0x95ff('0x4f')][_0x95ff('0x1d')]({'where':_0x41298f['where']})[_0x95ff('0x23')](function(_0xbfa624){_0x4a2779[_0x95ff('0x1d')]=_0xbfa624;if(_0x20730c[_0x95ff('0x35')][_0x95ff('0x45')]){_0x41298f[_0x95ff('0x46')]=[{'all':!![]}];}return db[_0x95ff('0x4f')][_0x95ff('0x47')](_0x41298f);})[_0x95ff('0x23')](function(_0x488f91){_0x4a2779['rows']=_0x488f91;return _0x4a2779;});}})[_0x95ff('0x23')](respondWithFilteredResult(_0x4b05d7,_0x41298f))[_0x95ff('0x49')](handleError(_0x4b05d7,null));}; \ No newline at end of file +var _0xa559=['stack','name','send','render','merge','body','contact','message','agent','account','map','JscriptySessionReport','fieldName','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','catch','params','model','keys','options','find','create','getQuestions','findOne','rawAttributes','order','SessionId','JscriptyQuestionReport','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error'];(function(_0x99d3bf,_0x4049ae){var _0x2831c0=function(_0x1a7c74){while(--_0x1a7c74){_0x99d3bf['push'](_0x99d3bf['shift']());}};_0x2831c0(++_0x4049ae);}(_0xa559,0x17b));var _0x9a55=function(_0x448e59,_0x234788){_0x448e59=_0x448e59-0x0;var _0x9df6de=_0xa559[_0x448e59];return _0x9df6de;};'use strict';var emlformat=require(_0x9a55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a55('0x1'));var jsonpatch=require(_0x9a55('0x2'));var rp=require(_0x9a55('0x3'));var moment=require(_0x9a55('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9a55('0x5'));var util=require(_0x9a55('0x6'));var path=require(_0x9a55('0x7'));var sox=require('sox');var csv=require(_0x9a55('0x8'));var ejs=require(_0x9a55('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a55('0xa'));var squel=require(_0x9a55('0xb'));var crypto=require('crypto');var jsforce=require(_0x9a55('0xc'));var deskjs=require(_0x9a55('0xd'));var toCsv=require(_0x9a55('0x8'));var querystring=require(_0x9a55('0xe'));var Papa=require(_0x9a55('0xf'));var Redis=require(_0x9a55('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9a55('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a55('0x12'));var logger=require(_0x9a55('0x13'))(_0x9a55('0x14'));var utils=require('../../config/utils');var config=require(_0x9a55('0x15'));var licenseUtil=require(_0x9a55('0x16'));var db=require(_0x9a55('0x17'))['db'];function respondWithStatusCode(_0x292bdd,_0x42e2b1){_0x42e2b1=_0x42e2b1||0xcc;return function(_0x430039){if(_0x430039){return _0x292bdd[_0x9a55('0x18')](_0x42e2b1);}return _0x292bdd[_0x9a55('0x19')](_0x42e2b1)['end']();};}function respondWithResult(_0x40b5d5,_0xc5c979){_0xc5c979=_0xc5c979||0xc8;return function(_0x41ff95){if(_0x41ff95){return _0x40b5d5[_0x9a55('0x19')](_0xc5c979)[_0x9a55('0x1a')](_0x41ff95);}};}function respondWithFilteredResult(_0x46772a,_0x464106){return function(_0x576165){if(_0x576165){var _0x481358=typeof _0x464106['offset']==='undefined'&&typeof _0x464106[_0x9a55('0x1b')]===_0x9a55('0x1c');var _0x1f492f=_0x576165[_0x9a55('0x1d')];var _0x3b51bf=_0x481358?0x0:_0x464106[_0x9a55('0x1e')];var _0x101d49=_0x481358?_0x576165[_0x9a55('0x1d')]:_0x464106[_0x9a55('0x1e')]+_0x464106[_0x9a55('0x1b')];var _0x432421;if(_0x101d49>=_0x1f492f){_0x101d49=_0x1f492f;_0x432421=0xc8;}else{_0x432421=0xce;}_0x46772a[_0x9a55('0x19')](_0x432421);return _0x46772a[_0x9a55('0x1f')](_0x9a55('0x20'),_0x3b51bf+'-'+_0x101d49+'/'+_0x1f492f)['json'](_0x576165);}return null;};}function patchUpdates(_0x2beb34){return function(_0x3b9398){try{jsonpatch[_0x9a55('0x21')](_0x3b9398,_0x2beb34,!![]);}catch(_0x56631b){return BPromise[_0x9a55('0x22')](_0x56631b);}return _0x3b9398[_0x9a55('0x23')]();};}function saveUpdates(_0x33957a,_0x418b46){return function(_0x21c5c7){if(_0x21c5c7){return _0x21c5c7[_0x9a55('0x24')](_0x33957a)[_0x9a55('0x25')](function(_0x583a29){return _0x583a29;});}return null;};}function removeEntity(_0x5ef49,_0x14c225){return function(_0x5a1ded){if(_0x5a1ded){return _0x5a1ded[_0x9a55('0x26')]()[_0x9a55('0x25')](function(){_0x5ef49[_0x9a55('0x19')](0xcc)[_0x9a55('0x27')]();});}};}function handleEntityNotFound(_0x57ddc5,_0x471280){return function(_0x508029){if(!_0x508029){_0x57ddc5[_0x9a55('0x18')](0x194);}return _0x508029;};}function handleError(_0x4e365d,_0x48f666){_0x48f666=_0x48f666||0x1f4;return function(_0x3b6642){logger[_0x9a55('0x28')](_0x3b6642[_0x9a55('0x29')]);if(_0x3b6642['name']){delete _0x3b6642[_0x9a55('0x2a')];}_0x4e365d[_0x9a55('0x19')](_0x48f666)[_0x9a55('0x2b')](_0x3b6642);};}function getMustacheRender(_0x1c954d,_0xe323cb){return Mustache[_0x9a55('0x2c')](_0x1c954d,_[_0x9a55('0x2d')](_0xe323cb[_0x9a55('0x2e')],{'contact':_0xe323cb[_0x9a55('0x2f')],'message':_0xe323cb[_0x9a55('0x30')],'agent':_0xe323cb[_0x9a55('0x31')],'interaction':_0xe323cb['interaction'],'account':_0xe323cb[_0x9a55('0x32')]}))||'';}exports['index']=function(_0x1b2673,_0x5989ad){var _0x1e3787={},_0x5d69a9={},_0x3cb1ad={'count':0x0,'rows':[]};var _0x3cd072=_[_0x9a55('0x33')](db[_0x9a55('0x34')]['rawAttributes'],function(_0x5eb30e){return{'name':_0x5eb30e[_0x9a55('0x35')],'type':_0x5eb30e['type']['key']};});_0x5d69a9['model']=_[_0x9a55('0x33')](_0x3cd072,'name');_0x5d69a9['query']=_['keys'](_0x1b2673['query']);_0x5d69a9[_0x9a55('0x36')]=_[_0x9a55('0x37')](_0x5d69a9['model'],_0x5d69a9[_0x9a55('0x38')]);_0x1e3787[_0x9a55('0x39')]=_[_0x9a55('0x37')](_0x5d69a9['model'],qs[_0x9a55('0x3a')](_0x1b2673['query']['fields']));_0x1e3787[_0x9a55('0x39')]=_0x1e3787[_0x9a55('0x39')][_0x9a55('0x3b')]?_0x1e3787[_0x9a55('0x39')]:_0x5d69a9['model'];if(!_0x1b2673[_0x9a55('0x38')][_0x9a55('0x3c')](_0x9a55('0x3d'))){_0x1e3787[_0x9a55('0x1b')]=qs[_0x9a55('0x1b')](_0x1b2673['query']['limit']);_0x1e3787[_0x9a55('0x1e')]=qs[_0x9a55('0x1e')](_0x1b2673[_0x9a55('0x38')][_0x9a55('0x1e')]);}_0x1e3787['order']=qs['sort'](_0x1b2673[_0x9a55('0x38')][_0x9a55('0x3e')]);_0x1e3787[_0x9a55('0x3f')]=qs['filters'](_[_0x9a55('0x40')](_0x1b2673[_0x9a55('0x38')],_0x5d69a9[_0x9a55('0x36')]),_0x3cd072);if(_0x1b2673[_0x9a55('0x38')][_0x9a55('0x41')]){_0x1e3787[_0x9a55('0x3f')]=_[_0x9a55('0x2d')](_0x1e3787[_0x9a55('0x3f')],{'$or':_[_0x9a55('0x33')](_0x3cd072,function(_0x3eb7d6){if(_0x3eb7d6['type']!==_0x9a55('0x42')){var _0x3e2004={};_0x3e2004[_0x3eb7d6[_0x9a55('0x2a')]]={'$like':'%'+_0x1b2673[_0x9a55('0x38')][_0x9a55('0x41')]+'%'};return _0x3e2004;}})});}_0x1e3787=_[_0x9a55('0x2d')]({},_0x1e3787,_0x1b2673['options']);var _0x4c1ccf={'where':_0x1e3787['where']};return db[_0x9a55('0x34')][_0x9a55('0x1d')](_0x4c1ccf)[_0x9a55('0x25')](function(_0x1edf8d){_0x3cb1ad[_0x9a55('0x1d')]=_0x1edf8d;if(_0x1b2673[_0x9a55('0x38')][_0x9a55('0x43')]){_0x1e3787[_0x9a55('0x44')]=[{'all':!![]}];}return db[_0x9a55('0x34')][_0x9a55('0x45')](_0x1e3787);})[_0x9a55('0x25')](function(_0x48d9cb){_0x3cb1ad['rows']=_0x48d9cb;return _0x3cb1ad;})[_0x9a55('0x25')](respondWithFilteredResult(_0x5989ad,_0x1e3787))[_0x9a55('0x46')](handleError(_0x5989ad,null));};exports['show']=function(_0x147d4f,_0x396259){var _0x17d0d8={'raw':!![],'where':{'id':_0x147d4f[_0x9a55('0x47')]['id']}},_0x79d424={};_0x79d424[_0x9a55('0x48')]=_['keys'](db[_0x9a55('0x34')]['rawAttributes']);_0x79d424['query']=_[_0x9a55('0x49')](_0x147d4f[_0x9a55('0x38')]);_0x79d424[_0x9a55('0x36')]=_[_0x9a55('0x37')](_0x79d424[_0x9a55('0x48')],_0x79d424[_0x9a55('0x38')]);_0x17d0d8['attributes']=_[_0x9a55('0x37')](_0x79d424[_0x9a55('0x48')],qs[_0x9a55('0x3a')](_0x147d4f[_0x9a55('0x38')][_0x9a55('0x3a')]));_0x17d0d8[_0x9a55('0x39')]=_0x17d0d8[_0x9a55('0x39')]['length']?_0x17d0d8[_0x9a55('0x39')]:_0x79d424[_0x9a55('0x48')];if(_0x147d4f['query']['includeAll']){_0x17d0d8['include']=[{'all':!![]}];}_0x17d0d8=_[_0x9a55('0x2d')]({},_0x17d0d8,_0x147d4f[_0x9a55('0x4a')]);return db[_0x9a55('0x34')][_0x9a55('0x4b')](_0x17d0d8)[_0x9a55('0x25')](handleEntityNotFound(_0x396259,null))[_0x9a55('0x25')](respondWithResult(_0x396259,null))[_0x9a55('0x46')](handleError(_0x396259,null));};exports[_0x9a55('0x4c')]=function(_0x23e838,_0x42098c){return db['JscriptySessionReport']['create'](_0x23e838[_0x9a55('0x2e')],{})[_0x9a55('0x25')](respondWithResult(_0x42098c,0xc9))['catch'](handleError(_0x42098c,null));};exports[_0x9a55('0x24')]=function(_0x50a642,_0x1729d5){if(_0x50a642['body']['id']){delete _0x50a642[_0x9a55('0x2e')]['id'];}return db[_0x9a55('0x34')][_0x9a55('0x4b')]({'where':{'id':_0x50a642['params']['id']}})[_0x9a55('0x25')](handleEntityNotFound(_0x1729d5,null))[_0x9a55('0x25')](saveUpdates(_0x50a642[_0x9a55('0x2e')],null))[_0x9a55('0x25')](respondWithResult(_0x1729d5,null))[_0x9a55('0x46')](handleError(_0x1729d5,null));};exports[_0x9a55('0x26')]=function(_0x42ae93,_0xd0f9f7){return db[_0x9a55('0x34')]['find']({'where':{'id':_0x42ae93['params']['id']}})[_0x9a55('0x25')](handleEntityNotFound(_0xd0f9f7,null))[_0x9a55('0x25')](removeEntity(_0xd0f9f7,null))['catch'](handleError(_0xd0f9f7,null));};exports['describe']=function(_0x1ecad2,_0xffc952){return db[_0x9a55('0x34')]['describe']()['then'](respondWithResult(_0xffc952,null))[_0x9a55('0x46')](handleError(_0xffc952,null));};exports[_0x9a55('0x4d')]=function(_0x9f3193,_0x3392a6,_0x413480){var _0x2f990d={'raw':!![],'where':{}};var _0x5db89d={};var _0x2d9708={'count':0x0,'rows':[]};return db[_0x9a55('0x34')][_0x9a55('0x4e')]({'where':{'id':_0x9f3193['params']['id']}})['then'](handleEntityNotFound(_0x3392a6,null))['then'](function(_0x3e75c5){if(_0x3e75c5){_0x5db89d[_0x9a55('0x48')]=_[_0x9a55('0x49')](db['JscriptyQuestionReport'][_0x9a55('0x4f')]);_0x5db89d[_0x9a55('0x38')]=_[_0x9a55('0x49')](_0x9f3193[_0x9a55('0x38')]);_0x5db89d['filters']=_[_0x9a55('0x37')](_0x5db89d[_0x9a55('0x48')],_0x5db89d[_0x9a55('0x38')]);_0x2f990d[_0x9a55('0x39')]=_[_0x9a55('0x37')](_0x5db89d[_0x9a55('0x48')],qs[_0x9a55('0x3a')](_0x9f3193[_0x9a55('0x38')]['fields']));_0x2f990d[_0x9a55('0x39')]=_0x2f990d[_0x9a55('0x39')]['length']?_0x2f990d[_0x9a55('0x39')]:_0x5db89d[_0x9a55('0x48')];if(!_0x9f3193[_0x9a55('0x38')][_0x9a55('0x3c')](_0x9a55('0x3d'))){_0x2f990d['limit']=qs['limit'](_0x9f3193[_0x9a55('0x38')]['limit']);_0x2f990d['offset']=qs['offset'](_0x9f3193[_0x9a55('0x38')][_0x9a55('0x1e')]);}_0x2f990d[_0x9a55('0x50')]=qs[_0x9a55('0x3e')](_0x9f3193[_0x9a55('0x38')][_0x9a55('0x3e')]);_0x2f990d['where']=qs['filters'](_['pick'](_0x9f3193[_0x9a55('0x38')],_0x5db89d[_0x9a55('0x36')]));_0x2f990d[_0x9a55('0x3f')][_0x9a55('0x51')]=_0x3e75c5['id'];if(_0x9f3193[_0x9a55('0x38')][_0x9a55('0x41')]){_0x2f990d[_0x9a55('0x3f')]=_[_0x9a55('0x2d')](_0x2f990d[_0x9a55('0x3f')],{'$or':_[_0x9a55('0x33')](_0x2f990d[_0x9a55('0x39')],function(_0x251189){var _0x2e9c85={};_0x2e9c85[_0x251189]={'$like':'%'+_0x9f3193[_0x9a55('0x38')][_0x9a55('0x41')]+'%'};return _0x2e9c85;})});}_0x2f990d=_[_0x9a55('0x2d')]({},_0x2f990d,_0x9f3193[_0x9a55('0x4a')]);return db[_0x9a55('0x52')][_0x9a55('0x1d')]({'where':_0x2f990d[_0x9a55('0x3f')]})[_0x9a55('0x25')](function(_0x19e617){_0x2d9708[_0x9a55('0x1d')]=_0x19e617;if(_0x9f3193[_0x9a55('0x38')][_0x9a55('0x43')]){_0x2f990d[_0x9a55('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x2f990d);})[_0x9a55('0x25')](function(_0x547296){_0x2d9708[_0x9a55('0x53')]=_0x547296;return _0x2d9708;});}})[_0x9a55('0x25')](respondWithFilteredResult(_0x3392a6,_0x2f990d))[_0x9a55('0x46')](handleError(_0x3392a6,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d3b0462..17cb84a 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc562=['path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api','bluebird','request-promise'];(function(_0x492b1c,_0x58840e){var _0xfd2d4c=function(_0x468aa){while(--_0x468aa){_0x492b1c['push'](_0x492b1c['shift']());}};_0xfd2d4c(++_0x58840e);}(_0xc562,0x1e7));var _0x2c56=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xc562[_0x4b73a2];return _0x383c66;};'use strict';var _=require('lodash');var util=require(_0x2c56('0x0'));var logger=require(_0x2c56('0x1'))(_0x2c56('0x2'));var moment=require('moment');var BPromise=require(_0x2c56('0x3'));var rp=require(_0x2c56('0x4'));var fs=require('fs');var path=require(_0x2c56('0x5'));var rimraf=require(_0x2c56('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c56('0x7'));module[_0x2c56('0x8')]=function(_0x5c3d2c,_0xcbc6ed){return _0x5c3d2c[_0x2c56('0x9')](_0x2c56('0xa'),attributes,{'tableName':_0x2c56('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7166=['exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x174ac2,_0xa91d82){var _0x28ca76=function(_0xba7291){while(--_0xba7291){_0x174ac2['push'](_0x174ac2['shift']());}};_0x28ca76(++_0xa91d82);}(_0x7166,0x14d));var _0x6716=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x7166[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0x6716('0x0'));var util=require(_0x6716('0x1'));var logger=require(_0x6716('0x2'))(_0x6716('0x3'));var moment=require(_0x6716('0x4'));var BPromise=require(_0x6716('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6716('0x6'));var attributes=require(_0x6716('0x7'));module[_0x6716('0x8')]=function(_0x2e9ee3,_0x4bbb95){return _0x2e9ee3['define'](_0x6716('0x9'),attributes,{'tableName':_0x6716('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d556a4e..3f4c797 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d2a=['JscriptySessionReport,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x33f3eb,_0x3e37ee){var _0x7d9105=function(_0xe27ea){while(--_0xe27ea){_0x33f3eb['push'](_0x33f3eb['shift']());}};_0x7d9105(++_0x3e37ee);}(_0x0d2a,0x1e6));var _0xa0d2=function(_0x4f1b45,_0x557296){_0x4f1b45=_0x4f1b45-0x0;var _0x459c65=_0x0d2a[_0x4f1b45];return _0x459c65;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa0d2('0x0'));var BPromise=require(_0xa0d2('0x1'));var rs=require(_0xa0d2('0x2'));var fs=require('fs');var Redis=require(_0xa0d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0d2('0x4'));var logger=require(_0xa0d2('0x5'))(_0xa0d2('0x6'));var config=require(_0xa0d2('0x7'));var jayson=require(_0xa0d2('0x8'));var client=jayson[_0xa0d2('0x9')][_0xa0d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8bc5,_0x586a64,_0x1fd15b){return new BPromise(function(_0x222209,_0x1b30a7){return client['request'](_0x1b8bc5,_0x1fd15b)[_0xa0d2('0xb')](function(_0x39e731){logger[_0xa0d2('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x586a64,'request\x20sent');logger[_0xa0d2('0xd')](_0xa0d2('0xe'),_0x586a64,_0xa0d2('0xf'),JSON['stringify'](_0x39e731));if(_0x39e731[_0xa0d2('0x10')]){if(_0x39e731[_0xa0d2('0x10')]['code']===0x1f4){logger[_0xa0d2('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x586a64,_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);return _0x1b30a7(_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);}logger[_0xa0d2('0x10')](_0xa0d2('0x12'),_0x586a64,_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);return _0x222209(_0x39e731['error'][_0xa0d2('0x11')]);}else{logger[_0xa0d2('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x586a64,_0xa0d2('0xf'));_0x222209(_0x39e731[_0xa0d2('0x13')][_0xa0d2('0x11')]);}})[_0xa0d2('0x14')](function(_0x23c2f9){logger[_0xa0d2('0x10')](_0xa0d2('0x12'),_0x586a64,_0x23c2f9);_0x1b30a7(_0x23c2f9);});});} \ No newline at end of file +var _0xd720=['rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','moment','randomstring','ioredis','../../config/logger'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xd720,0xba));var _0x0d72=function(_0xfe8758,_0x1a5773){_0xfe8758=_0xfe8758-0x0;var _0x36a162=_0xd720[_0xfe8758];return _0x36a162;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d72('0x0'));var BPromise=require('bluebird');var rs=require(_0x0d72('0x1'));var fs=require('fs');var Redis=require(_0x0d72('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0d72('0x3'))(_0x0d72('0x4'));var config=require(_0x0d72('0x5'));var jayson=require(_0x0d72('0x6'));var client=jayson[_0x0d72('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x579070,_0x521700,_0x5202e0){return new BPromise(function(_0x3b34a4,_0x2fa1c9){return client[_0x0d72('0x8')](_0x579070,_0x5202e0)[_0x0d72('0x9')](function(_0x1d7c16){logger[_0x0d72('0xa')](_0x0d72('0xb'),_0x521700,_0x0d72('0xc'));logger[_0x0d72('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x521700,_0x0d72('0xc'),JSON['stringify'](_0x1d7c16));if(_0x1d7c16['error']){if(_0x1d7c16[_0x0d72('0xe')][_0x0d72('0xf')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x521700,_0x1d7c16['error'][_0x0d72('0x10')]);return _0x2fa1c9(_0x1d7c16[_0x0d72('0xe')][_0x0d72('0x10')]);}logger[_0x0d72('0xe')](_0x0d72('0xb'),_0x521700,_0x1d7c16[_0x0d72('0xe')][_0x0d72('0x10')]);return _0x3b34a4(_0x1d7c16[_0x0d72('0xe')][_0x0d72('0x10')]);}else{logger[_0x0d72('0xa')](_0x0d72('0xb'),_0x521700,_0x0d72('0xc'));_0x3b34a4(_0x1d7c16[_0x0d72('0x11')][_0x0d72('0x10')]);}})[_0x0d72('0x12')](function(_0x2e248e){logger[_0x0d72('0xe')](_0x0d72('0xb'),_0x521700,_0x2e248e);_0x2fa1c9(_0x2e248e);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 51c714b..608149f 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a4c=['./license.controller','get','index','/:id','isAuthenticated','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x15b02e,_0x251144){var _0x7e35a1=function(_0x2420a5){while(--_0x2420a5){_0x15b02e['push'](_0x15b02e['shift']());}};_0x7e35a1(++_0x251144);}(_0x9a4c,0x110));var _0xc9a4=function(_0x357025,_0x53285f){_0x357025=_0x357025-0x0;var _0x56d378=_0x9a4c[_0x357025];return _0x56d378;};'use strict';var multer=require(_0xc9a4('0x0'));var util=require(_0xc9a4('0x1'));var path=require(_0xc9a4('0x2'));var timeout=require(_0xc9a4('0x3'));var express=require(_0xc9a4('0x4'));var router=express['Router']();var fs_extra=require(_0xc9a4('0x5'));var auth=require(_0xc9a4('0x6'));var interaction=require(_0xc9a4('0x7'));var config=require('../../config/environment');var controller=require(_0xc9a4('0x8'));router[_0xc9a4('0x9')]('/',controller[_0xc9a4('0xa')]);router['put'](_0xc9a4('0xb'),auth[_0xc9a4('0xc')](),controller[_0xc9a4('0xd')]);module['exports']=router; \ No newline at end of file +var _0xbd5c=['get','index','put','/:id','isAuthenticated','update','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1338d4,_0x2b8342){var _0x5521a1=function(_0x5109fb){while(--_0x5109fb){_0x1338d4['push'](_0x1338d4['shift']());}};_0x5521a1(++_0x2b8342);}(_0xbd5c,0x18e));var _0xcbd5=function(_0x5c9689,_0xdcb07f){_0x5c9689=_0x5c9689-0x0;var _0x3a9afe=_0xbd5c[_0x5c9689];return _0x3a9afe;};'use strict';var multer=require(_0xcbd5('0x0'));var util=require(_0xcbd5('0x1'));var path=require('path');var timeout=require(_0xcbd5('0x2'));var express=require(_0xcbd5('0x3'));var router=express['Router']();var fs_extra=require(_0xcbd5('0x4'));var auth=require(_0xcbd5('0x5'));var interaction=require(_0xcbd5('0x6'));var config=require(_0xcbd5('0x7'));var controller=require('./license.controller');router[_0xcbd5('0x8')]('/',controller[_0xcbd5('0x9')]);router[_0xcbd5('0xa')](_0xcbd5('0xb'),auth[_0xcbd5('0xc')](),controller[_0xcbd5('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index acf5197..3b6c5fa 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['STRING','INTEGER','sequelize','TEXT'];(function(_0x3f75ab,_0x3b8a71){var _0x1d8fdb=function(_0x170f4d){while(--_0x170f4d){_0x3f75ab['push'](_0x3f75ab['shift']());}};_0x1d8fdb(++_0x3b8a71);}(_0x1cb9,0x14e));var _0x91cb=function(_0x43eeed,_0x4dfb8b){_0x43eeed=_0x43eeed-0x0;var _0x21e6c4=_0x1cb9[_0x43eeed];return _0x21e6c4;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'license':{'type':Sequelize[_0x91cb('0x1')]},'data1':{'type':Sequelize[_0x91cb('0x2')]},'data2':{'type':Sequelize[_0x91cb('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x91cb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xda19=['exports','TEXT','STRING'];(function(_0x459be3,_0x5ac81e){var _0x5ebf5e=function(_0x2d4f29){while(--_0x2d4f29){_0x459be3['push'](_0x459be3['shift']());}};_0x5ebf5e(++_0x5ac81e);}(_0xda19,0xd5));var _0x9da1=function(_0x40ae34,_0x56713d){_0x40ae34=_0x40ae34-0x0;var _0x17e9c8=_0xda19[_0x40ae34];return _0x17e9c8;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'license':{'type':Sequelize[_0x9da1('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9da1('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 746b129..920f3f2 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c7b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','render','merge','agent','interaction','account','index','model','License','rawAttributes','query','keys','intersection','attributes','length','options','catch','body','find','params','get','checkLicense','key','demo','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x320cb3,_0x49c0cf){var _0x899c86=function(_0x9fc8f){while(--_0x9fc8f){_0x320cb3['push'](_0x320cb3['shift']());}};_0x899c86(++_0x49c0cf);}(_0x6c7b,0x129));var _0xb6c7=function(_0x150e5c,_0xfe2869){_0x150e5c=_0x150e5c-0x0;var _0x96300a=_0x6c7b[_0x150e5c];return _0x96300a;};'use strict';var emlformat=require(_0xb6c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb6c7('0x1'));var BPromise=require(_0xb6c7('0x2'));var Mustache=require(_0xb6c7('0x3'));var util=require('util');var path=require(_0xb6c7('0x4'));var sox=require(_0xb6c7('0x5'));var csv=require(_0xb6c7('0x6'));var ejs=require(_0xb6c7('0x7'));var fs=require('fs');var fs_extra=require(_0xb6c7('0x8'));var _=require(_0xb6c7('0x9'));var squel=require(_0xb6c7('0xa'));var crypto=require('crypto');var jsforce=require(_0xb6c7('0xb'));var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0x6'));var querystring=require(_0xb6c7('0xd'));var Papa=require(_0xb6c7('0xe'));var Redis=require(_0xb6c7('0xf'));var authService=require(_0xb6c7('0x10'));var qs=require(_0xb6c7('0x11'));var as=require(_0xb6c7('0x12'));var hardwareService=require(_0xb6c7('0x13'));var logger=require(_0xb6c7('0x14'))(_0xb6c7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb6c7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc045,_0x425e89){_0x425e89=_0x425e89||0xcc;return function(_0x1ec6c2){if(_0x1ec6c2){return _0x1cc045[_0xb6c7('0x17')](_0x425e89);}return _0x1cc045[_0xb6c7('0x18')](_0x425e89)['end']();};}function respondWithResult(_0x14f004,_0x536e95){_0x536e95=_0x536e95||0xc8;return function(_0x5ae219){if(_0x5ae219){return _0x14f004['status'](_0x536e95)[_0xb6c7('0x19')](_0x5ae219);}};}function respondWithFilteredResult(_0x2d07c4,_0x4e44e9){return function(_0x2ac46c){if(_0x2ac46c){var _0x3c304d=typeof _0x4e44e9[_0xb6c7('0x1a')]===_0xb6c7('0x1b')&&typeof _0x4e44e9['limit']===_0xb6c7('0x1b');var _0x2e2075=_0x2ac46c[_0xb6c7('0x1c')];var _0x13eb22=_0x3c304d?0x0:_0x4e44e9['offset'];var _0x193aa9=_0x3c304d?_0x2ac46c[_0xb6c7('0x1c')]:_0x4e44e9[_0xb6c7('0x1a')]+_0x4e44e9['limit'];var _0x3f3217;if(_0x193aa9>=_0x2e2075){_0x193aa9=_0x2e2075;_0x3f3217=0xc8;}else{_0x3f3217=0xce;}_0x2d07c4[_0xb6c7('0x18')](_0x3f3217);return _0x2d07c4[_0xb6c7('0x1d')](_0xb6c7('0x1e'),_0x13eb22+'-'+_0x193aa9+'/'+_0x2e2075)[_0xb6c7('0x19')](_0x2ac46c);}return null;};}function patchUpdates(_0x5da0d0){return function(_0x152afe){try{jsonpatch['apply'](_0x152afe,_0x5da0d0,!![]);}catch(_0x3a54ce){return BPromise[_0xb6c7('0x1f')](_0x3a54ce);}return _0x152afe[_0xb6c7('0x20')]();};}function saveUpdates(_0x4929e9,_0x5f004c){return function(_0x28ed22){if(_0x28ed22){return _0x28ed22[_0xb6c7('0x21')](_0x4929e9)[_0xb6c7('0x22')](function(_0x3d5728){return _0x3d5728;});}return null;};}function removeEntity(_0x3efe97,_0xd24b4f){return function(_0x576726){if(_0x576726){return _0x576726['destroy']()['then'](function(){_0x3efe97[_0xb6c7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1843db,_0x17b222){return function(_0x3d2b32){if(!_0x3d2b32){_0x1843db[_0xb6c7('0x17')](0x194);}return _0x3d2b32;};}function handleError(_0x195ee8,_0x498f1d){_0x498f1d=_0x498f1d||0x1f4;return function(_0x3980ee){logger[_0xb6c7('0x23')](_0x3980ee[_0xb6c7('0x24')]);if(_0x3980ee[_0xb6c7('0x25')]){delete _0x3980ee[_0xb6c7('0x25')];}_0x195ee8['status'](_0x498f1d)[_0xb6c7('0x26')](_0x3980ee);};}function getMustacheRender(_0xc8f1,_0x4fb882){return Mustache[_0xb6c7('0x27')](_0xc8f1,_[_0xb6c7('0x28')](_0x4fb882['body'],{'contact':_0x4fb882['contact'],'message':_0x4fb882['message'],'agent':_0x4fb882[_0xb6c7('0x29')],'interaction':_0x4fb882[_0xb6c7('0x2a')],'account':_0x4fb882[_0xb6c7('0x2b')]}))||'';}var utilLicense=require(_0xb6c7('0x16'));exports[_0xb6c7('0x2c')]=function(_0x163ce1,_0x20da14){var _0x15dc3d={'raw':!![],'where':{'id':0x1}},_0x117535={};_0x117535[_0xb6c7('0x2d')]=_['keys'](db[_0xb6c7('0x2e')][_0xb6c7('0x2f')]);_0x117535[_0xb6c7('0x30')]=_[_0xb6c7('0x31')](_0x163ce1[_0xb6c7('0x30')]);_0x117535['filters']=_[_0xb6c7('0x32')](_0x117535[_0xb6c7('0x2d')],_0x117535[_0xb6c7('0x30')]);_0x15dc3d[_0xb6c7('0x33')]=_[_0xb6c7('0x32')](_0x117535[_0xb6c7('0x2d')],qs['fields'](_0x163ce1[_0xb6c7('0x30')]['fields']));_0x15dc3d[_0xb6c7('0x33')]=_0x15dc3d[_0xb6c7('0x33')][_0xb6c7('0x34')]?_0x15dc3d[_0xb6c7('0x33')]:_0x117535[_0xb6c7('0x2d')];_0x15dc3d=_['merge']({},_0x15dc3d,_0x163ce1[_0xb6c7('0x35')]);return utilLicense['getLicense'](_0x15dc3d)[_0xb6c7('0x22')](respondWithResult(_0x20da14,null))[_0xb6c7('0x36')](handleError(_0x20da14,null));};exports[_0xb6c7('0x21')]=function(_0x4e7ee3,_0x4002d9){if(_0x4e7ee3['body']['id']){delete _0x4e7ee3[_0xb6c7('0x37')]['id'];}return db['License'][_0xb6c7('0x38')]({'where':{'id':_0x4e7ee3[_0xb6c7('0x39')]['id']}})['then'](handleEntityNotFound(_0x4002d9,null))[_0xb6c7('0x22')](function(_0x4d325f){var _0x1a6a2d=_0x4d325f[_0xb6c7('0x3a')]({'plain':!![]});return utilLicense[_0xb6c7('0x3b')](_0x1a6a2d,_0x4e7ee3['body'][_0xb6c7('0x3c')]);})[_0xb6c7('0x22')](function(_0x2e43a9){if(!_0x2e43a9[_0xb6c7('0x3d')]){return saveUpdates(_0x4e7ee3[_0xb6c7('0x37')],null);}return _0x2e43a9;})['then'](respondWithResult(_0x4002d9,null))[_0xb6c7('0x36')](handleError(_0x4002d9,null));}; \ No newline at end of file +var _0xf4bc=['model','keys','rawAttributes','query','filters','intersection','attributes','fields','options','getLicense','catch','body','License','find','params','get','checkLicense','key','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','send','render','merge','contact','message','agent','interaction','account','index'];(function(_0x186638,_0xf50cc){var _0x4bd39c=function(_0x22ec79){while(--_0x22ec79){_0x186638['push'](_0x186638['shift']());}};_0x4bd39c(++_0xf50cc);}(_0xf4bc,0x9e));var _0xcf4b=function(_0x3abeac,_0x1403a9){_0x3abeac=_0x3abeac-0x0;var _0x26a08=_0xf4bc[_0x3abeac];return _0x26a08;};'use strict';var emlformat=require(_0xcf4b('0x0'));var rimraf=require(_0xcf4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf4b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcf4b('0x3'));var util=require(_0xcf4b('0x4'));var path=require(_0xcf4b('0x5'));var sox=require('sox');var csv=require(_0xcf4b('0x6'));var ejs=require(_0xcf4b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf4b('0x8'));var squel=require(_0xcf4b('0x9'));var crypto=require(_0xcf4b('0xa'));var jsforce=require(_0xcf4b('0xb'));var deskjs=require(_0xcf4b('0xc'));var toCsv=require(_0xcf4b('0x6'));var querystring=require(_0xcf4b('0xd'));var Papa=require(_0xcf4b('0xe'));var Redis=require(_0xcf4b('0xf'));var authService=require(_0xcf4b('0x10'));var qs=require(_0xcf4b('0x11'));var as=require(_0xcf4b('0x12'));var hardwareService=require(_0xcf4b('0x13'));var logger=require(_0xcf4b('0x14'))(_0xcf4b('0x15'));var utils=require(_0xcf4b('0x16'));var config=require(_0xcf4b('0x17'));var licenseUtil=require(_0xcf4b('0x18'));var db=require(_0xcf4b('0x19'))['db'];function respondWithStatusCode(_0x11ef4e,_0x49e202){_0x49e202=_0x49e202||0xcc;return function(_0x1d3b38){if(_0x1d3b38){return _0x11ef4e['sendStatus'](_0x49e202);}return _0x11ef4e['status'](_0x49e202)[_0xcf4b('0x1a')]();};}function respondWithResult(_0x2925b5,_0x2c54a6){_0x2c54a6=_0x2c54a6||0xc8;return function(_0x44b9a1){if(_0x44b9a1){return _0x2925b5[_0xcf4b('0x1b')](_0x2c54a6)[_0xcf4b('0x1c')](_0x44b9a1);}};}function respondWithFilteredResult(_0x5279d8,_0x4d5dc5){return function(_0x4d1fc9){if(_0x4d1fc9){var _0x50d5ab=typeof _0x4d5dc5['offset']===_0xcf4b('0x1d')&&typeof _0x4d5dc5[_0xcf4b('0x1e')]===_0xcf4b('0x1d');var _0x59ac43=_0x4d1fc9[_0xcf4b('0x1f')];var _0x1171be=_0x50d5ab?0x0:_0x4d5dc5[_0xcf4b('0x20')];var _0x6d473d=_0x50d5ab?_0x4d1fc9['count']:_0x4d5dc5['offset']+_0x4d5dc5[_0xcf4b('0x1e')];var _0x27c157;if(_0x6d473d>=_0x59ac43){_0x6d473d=_0x59ac43;_0x27c157=0xc8;}else{_0x27c157=0xce;}_0x5279d8[_0xcf4b('0x1b')](_0x27c157);return _0x5279d8[_0xcf4b('0x21')](_0xcf4b('0x22'),_0x1171be+'-'+_0x6d473d+'/'+_0x59ac43)[_0xcf4b('0x1c')](_0x4d1fc9);}return null;};}function patchUpdates(_0x2ca44a){return function(_0x334e38){try{jsonpatch[_0xcf4b('0x23')](_0x334e38,_0x2ca44a,!![]);}catch(_0x402b67){return BPromise[_0xcf4b('0x24')](_0x402b67);}return _0x334e38[_0xcf4b('0x25')]();};}function saveUpdates(_0x580eab,_0xac77a7){return function(_0x16b8cc){if(_0x16b8cc){return _0x16b8cc[_0xcf4b('0x26')](_0x580eab)[_0xcf4b('0x27')](function(_0x254bef){return _0x254bef;});}return null;};}function removeEntity(_0x1f436f,_0x426fd7){return function(_0x1cae94){if(_0x1cae94){return _0x1cae94['destroy']()[_0xcf4b('0x27')](function(){_0x1f436f[_0xcf4b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25d286,_0x42f47d){return function(_0xebd25d){if(!_0xebd25d){_0x25d286[_0xcf4b('0x28')](0x194);}return _0xebd25d;};}function handleError(_0x68f18e,_0x40bc8a){_0x40bc8a=_0x40bc8a||0x1f4;return function(_0x5ad5c6){logger[_0xcf4b('0x29')](_0x5ad5c6[_0xcf4b('0x2a')]);if(_0x5ad5c6['name']){delete _0x5ad5c6['name'];}_0x68f18e[_0xcf4b('0x1b')](_0x40bc8a)[_0xcf4b('0x2b')](_0x5ad5c6);};}function getMustacheRender(_0x28b9ff,_0xb87578){return Mustache[_0xcf4b('0x2c')](_0x28b9ff,_[_0xcf4b('0x2d')](_0xb87578['body'],{'contact':_0xb87578[_0xcf4b('0x2e')],'message':_0xb87578[_0xcf4b('0x2f')],'agent':_0xb87578[_0xcf4b('0x30')],'interaction':_0xb87578[_0xcf4b('0x31')],'account':_0xb87578[_0xcf4b('0x32')]}))||'';}var utilLicense=require('../../config/license/util');exports[_0xcf4b('0x33')]=function(_0x10f774,_0x59ae16){var _0x4c1493={'raw':!![],'where':{'id':0x1}},_0x2361ca={};_0x2361ca[_0xcf4b('0x34')]=_[_0xcf4b('0x35')](db['License'][_0xcf4b('0x36')]);_0x2361ca[_0xcf4b('0x37')]=_[_0xcf4b('0x35')](_0x10f774['query']);_0x2361ca[_0xcf4b('0x38')]=_[_0xcf4b('0x39')](_0x2361ca['model'],_0x2361ca[_0xcf4b('0x37')]);_0x4c1493[_0xcf4b('0x3a')]=_[_0xcf4b('0x39')](_0x2361ca[_0xcf4b('0x34')],qs['fields'](_0x10f774[_0xcf4b('0x37')][_0xcf4b('0x3b')]));_0x4c1493[_0xcf4b('0x3a')]=_0x4c1493[_0xcf4b('0x3a')]['length']?_0x4c1493['attributes']:_0x2361ca['model'];_0x4c1493=_[_0xcf4b('0x2d')]({},_0x4c1493,_0x10f774[_0xcf4b('0x3c')]);return utilLicense[_0xcf4b('0x3d')](_0x4c1493)[_0xcf4b('0x27')](respondWithResult(_0x59ae16,null))[_0xcf4b('0x3e')](handleError(_0x59ae16,null));};exports[_0xcf4b('0x26')]=function(_0xef71a9,_0x343746){if(_0xef71a9['body']['id']){delete _0xef71a9[_0xcf4b('0x3f')]['id'];}return db[_0xcf4b('0x40')][_0xcf4b('0x41')]({'where':{'id':_0xef71a9[_0xcf4b('0x42')]['id']}})['then'](handleEntityNotFound(_0x343746,null))['then'](function(_0xb5db66){var _0x4c857d=_0xb5db66[_0xcf4b('0x43')]({'plain':!![]});return utilLicense[_0xcf4b('0x44')](_0x4c857d,_0xef71a9[_0xcf4b('0x3f')][_0xcf4b('0x45')]);})['then'](function(_0x1779d5){if(!_0x1779d5['demo']){return saveUpdates(_0xef71a9[_0xcf4b('0x3f')],null);}return _0x1779d5;})[_0xcf4b('0x27')](respondWithResult(_0x343746,null))['catch'](handleError(_0x343746,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 21718c9..31bb61b 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcea5=['api','moment','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xcea5,0xed));var _0x5cea=function(_0x3fea74,_0x4f224d){_0x3fea74=_0x3fea74-0x0;var _0x64b8f0=_0xcea5[_0x3fea74];return _0x64b8f0;};'use strict';var _=require(_0x5cea('0x0'));var util=require(_0x5cea('0x1'));var logger=require(_0x5cea('0x2'))(_0x5cea('0x3'));var moment=require(_0x5cea('0x4'));var BPromise=require('bluebird');var rp=require(_0x5cea('0x5'));var fs=require('fs');var path=require(_0x5cea('0x6'));var rimraf=require(_0x5cea('0x7'));var config=require(_0x5cea('0x8'));var attributes=require('./license.attributes');module[_0x5cea('0x9')]=function(_0x31e6f3,_0x599bc5){return _0x31e6f3['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb54=['lodash','../../config/logger','api','moment','bluebird','../../config/environment','./license.attributes','exports','License','license'];(function(_0x553d2a,_0x125875){var _0x12aaf1=function(_0x47f379){while(--_0x47f379){_0x553d2a['push'](_0x553d2a['shift']());}};_0x12aaf1(++_0x125875);}(_0xeb54,0xfa));var _0x4eb5=function(_0x5d48b5,_0xcd8a7d){_0x5d48b5=_0x5d48b5-0x0;var _0x1aab70=_0xeb54[_0x5d48b5];return _0x1aab70;};'use strict';var _=require(_0x4eb5('0x0'));var util=require('util');var logger=require(_0x4eb5('0x1'))(_0x4eb5('0x2'));var moment=require(_0x4eb5('0x3'));var BPromise=require(_0x4eb5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4eb5('0x5'));var attributes=require(_0x4eb5('0x6'));module[_0x4eb5('0x7')]=function(_0x362287,_0x38c0cd){return _0x362287['define'](_0x4eb5('0x8'),attributes,{'tableName':_0x4eb5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 98e9b13..3450a49 100644 --- a/server/api/license/license.rpc.js +++ b/server/api/license/license.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21f8=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x21f8,0x71));var _0x821f=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x21f8[_0x1ff575];return _0x48fc9e;};'use strict';var _=require(_0x821f('0x0'));var util=require(_0x821f('0x1'));var moment=require(_0x821f('0x2'));var BPromise=require(_0x821f('0x3'));var rs=require(_0x821f('0x4'));var fs=require('fs');var Redis=require(_0x821f('0x5'));var db=require(_0x821f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x821f('0x7'));var jayson=require(_0x821f('0x8'));var client=jayson[_0x821f('0x9')][_0x821f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cd13a,_0x3a42fe,_0x1b9945){return new BPromise(function(_0xfcb0a,_0x4e260d){return client['request'](_0x3cd13a,_0x1b9945)[_0x821f('0xb')](function(_0x15b547){logger[_0x821f('0xc')]('License,\x20%s,\x20%s',_0x3a42fe,_0x821f('0xd'));logger[_0x821f('0xe')](_0x821f('0xf'),_0x3a42fe,_0x821f('0xd'),JSON[_0x821f('0x10')](_0x15b547));if(_0x15b547[_0x821f('0x11')]){if(_0x15b547[_0x821f('0x11')][_0x821f('0x12')]===0x1f4){logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x15b547['error']['message']);return _0x4e260d(_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);}logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);return _0xfcb0a(_0x15b547[_0x821f('0x11')][_0x821f('0x14')]);}else{logger[_0x821f('0xc')](_0x821f('0x13'),_0x3a42fe,'request\x20sent');_0xfcb0a(_0x15b547[_0x821f('0x15')]['message']);}})[_0x821f('0x16')](function(_0x497c37){logger[_0x821f('0x11')](_0x821f('0x13'),_0x3a42fe,_0x497c37);_0x4e260d(_0x497c37);});});} \ No newline at end of file +var _0x928c=['message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','error'];(function(_0x452bed,_0x128e55){var _0x4bb2cf=function(_0x41f9b1){while(--_0x41f9b1){_0x452bed['push'](_0x452bed['shift']());}};_0x4bb2cf(++_0x128e55);}(_0x928c,0x17f));var _0xc928=function(_0x2aa0b2,_0x3aaf77){_0x2aa0b2=_0x2aa0b2-0x0;var _0x13f403=_0x928c[_0x2aa0b2];return _0x13f403;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc928('0x0'));var BPromise=require(_0xc928('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc928('0x2'));var db=require(_0xc928('0x3'))['db'];var utils=require(_0xc928('0x4'));var logger=require(_0xc928('0x5'))(_0xc928('0x6'));var config=require('../../config/environment');var jayson=require(_0xc928('0x7'));var client=jayson[_0xc928('0x8')][_0xc928('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ff9e6,_0x4fd2a0,_0x5e433b){return new BPromise(function(_0x445248,_0x4270ab){return client[_0xc928('0xa')](_0x4ff9e6,_0x5e433b)[_0xc928('0xb')](function(_0x421f1b){logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,_0xc928('0xe'));logger['debug'](_0xc928('0xf'),_0x4fd2a0,_0xc928('0xe'),JSON['stringify'](_0x421f1b));if(_0x421f1b['error']){if(_0x421f1b[_0xc928('0x10')]['code']===0x1f4){logger[_0xc928('0x10')]('License,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x4270ab(_0x421f1b['error'][_0xc928('0x11')]);}logger[_0xc928('0x10')]('License,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x445248(_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);}else{logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,'request\x20sent');_0x445248(_0x421f1b[_0xc928('0x12')][_0xc928('0x11')]);}})[_0xc928('0x13')](function(_0x6cc463){logger[_0xc928('0x10')](_0xc928('0xd'),_0x4fd2a0,_0x6cc463);_0x4270ab(_0x6cc463);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e293a52..a4eb1bf 100644 --- a/server/api/mailAccount/index.js +++ b/server/api/mailAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6ad=['/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getApplications','/:id/messages','/:id/verify','getAgents','post','addDisposition','create','addImap','addSmtp','addApplications','/:id/send','send','/:id/users','addAgents','put','/:id','update','delete','/:id/dispositions','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x33cf0d,_0x39c4ef){var _0x5d174b=function(_0x2a1d5f){while(--_0x2a1d5f){_0x33cf0d['push'](_0x33cf0d['shift']());}};_0x5d174b(++_0x39c4ef);}(_0xd6ad,0x102));var _0xdd6a=function(_0x40b66c,_0x578758){_0x40b66c=_0x40b66c-0x0;var _0x2fd22b=_0xd6ad[_0x40b66c];return _0x2fd22b;};'use strict';var multer=require(_0xdd6a('0x0'));var util=require(_0xdd6a('0x1'));var path=require(_0xdd6a('0x2'));var timeout=require(_0xdd6a('0x3'));var express=require('express');var router=express[_0xdd6a('0x4')]();var fs_extra=require(_0xdd6a('0x5'));var auth=require(_0xdd6a('0x6'));var interaction=require(_0xdd6a('0x7'));var config=require('../../config/environment');var controller=require(_0xdd6a('0x8'));router[_0xdd6a('0x9')]('/',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0xb')]);router[_0xdd6a('0x9')](_0xdd6a('0xc'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0xd')]);router[_0xdd6a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdd6a('0xe')]);router[_0xdd6a('0x9')]('/:id/dispositions',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0xf')]);router[_0xdd6a('0x9')](_0xdd6a('0x10'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x11')]);router['get'](_0xdd6a('0x12'),auth[_0xdd6a('0xa')](),controller['getImap']);router[_0xdd6a('0x9')](_0xdd6a('0x13'),auth[_0xdd6a('0xa')](),controller['getSmtp']);router[_0xdd6a('0x9')](_0xdd6a('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xdd6a('0x9')]('/:id/applications',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x15')]);router['get'](_0xdd6a('0x16'),auth[_0xdd6a('0xa')](),controller['getMessages']);router[_0xdd6a('0x9')](_0xdd6a('0x17'),auth[_0xdd6a('0xa')](),controller['verifySmtp']);router[_0xdd6a('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xdd6a('0x18')]);router[_0xdd6a('0x19')]('/:id/dispositions',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1a')]);router[_0xdd6a('0x19')](_0xdd6a('0x10'),auth[_0xdd6a('0xa')](),controller['addAnswer']);router[_0xdd6a('0x19')]('/',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1b')]);router[_0xdd6a('0x19')](_0xdd6a('0x12'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1c')]);router[_0xdd6a('0x19')](_0xdd6a('0x13'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1d')]);router[_0xdd6a('0x19')](_0xdd6a('0x14'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xdd6a('0x19')]('/:id/applications',auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x1e')]);router[_0xdd6a('0x19')](_0xdd6a('0x1f'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x20')]);router[_0xdd6a('0x19')](_0xdd6a('0x21'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x22')]);router[_0xdd6a('0x23')](_0xdd6a('0x24'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x25')]);router[_0xdd6a('0x26')](_0xdd6a('0x27'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x28')]);router[_0xdd6a('0x26')](_0xdd6a('0x10'),auth[_0xdd6a('0xa')](),controller['removeAnswers']);router['delete'](_0xdd6a('0x12'),auth['isAuthenticated'](),controller[_0xdd6a('0x29')]);router['delete'](_0xdd6a('0x13'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x2a')]);router[_0xdd6a('0x26')](_0xdd6a('0x24'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x2b')]);router[_0xdd6a('0x26')](_0xdd6a('0x21'),auth[_0xdd6a('0xa')](),controller[_0xdd6a('0x2c')]);module['exports']=router; \ No newline at end of file +var _0xa013=['addDisposition','addAnswer','create','/:id/in_servers','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','addAgents','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post'];(function(_0x457e3b,_0x4f320c){var _0x4a939d=function(_0x42510d){while(--_0x42510d){_0x457e3b['push'](_0x457e3b['shift']());}};_0x4a939d(++_0x4f320c);}(_0xa013,0x1ea));var _0x3a01=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xa013[_0x2c2980];return _0x2a20a9;};'use strict';var multer=require('multer');var util=require(_0x3a01('0x0'));var path=require('path');var timeout=require(_0x3a01('0x1'));var express=require(_0x3a01('0x2'));var router=express[_0x3a01('0x3')]();var fs_extra=require(_0x3a01('0x4'));var auth=require(_0x3a01('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3a01('0x6'));router[_0x3a01('0x7')]('/',auth[_0x3a01('0x8')](),controller[_0x3a01('0x9')]);router['get'](_0x3a01('0xa'),auth[_0x3a01('0x8')](),controller['describe']);router[_0x3a01('0x7')](_0x3a01('0xb'),auth[_0x3a01('0x8')](),controller[_0x3a01('0xc')]);router[_0x3a01('0x7')](_0x3a01('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x3a01('0x7')](_0x3a01('0xe'),auth[_0x3a01('0x8')](),controller[_0x3a01('0xf')]);router['get']('/:id/in_servers',auth[_0x3a01('0x8')](),controller[_0x3a01('0x10')]);router[_0x3a01('0x7')]('/:id/out_servers',auth[_0x3a01('0x8')](),controller[_0x3a01('0x11')]);router['get'](_0x3a01('0x12'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x13')]);router[_0x3a01('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x3a01('0x14')]);router[_0x3a01('0x7')](_0x3a01('0x15'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x16')]);router[_0x3a01('0x7')]('/:id/verify',auth[_0x3a01('0x8')](),controller[_0x3a01('0x17')]);router[_0x3a01('0x7')](_0x3a01('0x18'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x19')]);router[_0x3a01('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3a01('0x1b')]);router['post'](_0x3a01('0xe'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x1c')]);router['post']('/',auth[_0x3a01('0x8')](),controller[_0x3a01('0x1d')]);router[_0x3a01('0x1a')](_0x3a01('0x1e'),auth['isAuthenticated'](),controller[_0x3a01('0x1f')]);router['post'](_0x3a01('0x20'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x21')]);router[_0x3a01('0x1a')](_0x3a01('0x12'),auth['isAuthenticated'](),controller[_0x3a01('0x22')]);router[_0x3a01('0x1a')](_0x3a01('0x23'),auth['isAuthenticated'](),controller[_0x3a01('0x24')]);router['post'](_0x3a01('0x25'),auth[_0x3a01('0x8')](),controller['send']);router[_0x3a01('0x1a')](_0x3a01('0x18'),auth['isAuthenticated'](),controller[_0x3a01('0x26')]);router['put'](_0x3a01('0xb'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x27')]);router[_0x3a01('0x28')](_0x3a01('0xd'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x29')]);router[_0x3a01('0x28')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3a01('0x2a')]);router['delete']('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router[_0x3a01('0x28')](_0x3a01('0x20'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x2b')]);router[_0x3a01('0x28')](_0x3a01('0xb'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x2c')]);router['delete'](_0x3a01('0x18'),auth[_0x3a01('0x8')](),controller[_0x3a01('0x2d')]);module[_0x3a01('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2e12c77..3358613 100644 --- a/server/api/mailAccount/mailAccount.attributes.js +++ b/server/api/mailAccount/mailAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc461=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x6eb98e,_0x43ba66){var _0x36557a=function(_0x1a736d){while(--_0x1a736d){_0x6eb98e['push'](_0x6eb98e['shift']());}};_0x36557a(++_0x43ba66);}(_0xc461,0xd8));var _0x1c46=function(_0x443fc9,_0x24fc48){_0x443fc9=_0x443fc9-0x0;var _0x13fdb4=_0xc461[_0x443fc9];return _0x13fdb4;};'use strict';var Sequelize=require(_0x1c46('0x0'));module[_0x1c46('0x1')]={'description':{'type':Sequelize[_0x1c46('0x2')]},'name':{'type':Sequelize[_0x1c46('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1c46('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x1c46('0x4')]},'markAsUnread':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x1c46('0x2')],'allowNull':![],'defaultValue':_0x1c46('0x5')},'fontSize':{'type':Sequelize[_0x1c46('0x6')](0x2)[_0x1c46('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1c46('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1c46('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1c46('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1c46('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1c46('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1c46('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1c46('0x9'),'set':function(_0x2cbf66){if(!_0x2cbf66)this[_0x1c46('0xa')]('mandatoryDispositionPauseId',null);this[_0x1c46('0xa')](_0x1c46('0xb'),_0x2cbf66);}}}; \ No newline at end of file +var _0x6c80=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x6c80,0x18e));var _0x06c8=function(_0x48245e,_0x178e51){_0x48245e=_0x48245e-0x0;var _0x4e5e30=_0x6c80[_0x48245e];return _0x4e5e30;};'use strict';var Sequelize=require(_0x06c8('0x0'));module[_0x06c8('0x1')]={'description':{'type':Sequelize[_0x06c8('0x2')]},'name':{'type':Sequelize[_0x06c8('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x06c8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x06c8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x06c8('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x06c8('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x06c8('0x2')],'allowNull':![],'defaultValue':_0x06c8('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x06c8('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x06c8('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x06c8('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x06c8('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x06c8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x06c8('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x06c8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x06c8('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x06c8('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x06c8('0x3')],'defaultValue':![],'comment':_0x06c8('0x9'),'set':function(_0x249bc0){if(!_0x249bc0)this[_0x06c8('0xa')]('mandatoryDispositionPauseId',null);this[_0x06c8('0xa')](_0x06c8('0xb'),_0x249bc0);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 3409b52..d0cca2f 100644 --- a/server/api/mailAccount/mailAccount.controller.js +++ b/server/api/mailAccount/mailAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedee=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','html-to-text','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','get','destroy','end','stack','name','send','render','merge','contact','agent','interaction','account','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','where','VIRTUAL','filter','options','include','show','params','MailServerIn','MailAccount','rawAttributes','includeAll','find','body','update','describe','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','nolimit','sort','pick','rows','removeDispositions','addAnswer','CannedAnswer','findAll','removeAnswers','ids','ListId','isNil','active','cservice','cauthentication','user','pass','cpassword','authentication','port','host','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','internal','Tags','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','List','Contacts','DESC','from','attachments','server/files/attachments','basename','service','auth','secure','sendMail','List\x20not\x20found','subject','attach','out','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','eml-format'];(function(_0x68cf9b,_0x250d5b){var _0x4cf44d=function(_0x4b5f11){while(--_0x4b5f11){_0x68cf9b['push'](_0x68cf9b['shift']());}};_0x4cf44d(++_0x250d5b);}(_0xedee,0xbf));var _0xeede=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xedee[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xeede('0x0'));var rimraf=require(_0xeede('0x1'));var zipdir=require(_0xeede('0x2'));var jsonpatch=require(_0xeede('0x3'));var rp=require(_0xeede('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeede('0x5'));var util=require(_0xeede('0x6'));var path=require(_0xeede('0x7'));var sox=require(_0xeede('0x8'));var csv=require(_0xeede('0x9'));var ejs=require(_0xeede('0xa'));var fs=require('fs');var fs_extra=require(_0xeede('0xb'));var _=require(_0xeede('0xc'));var squel=require(_0xeede('0xd'));var crypto=require('crypto');var jsforce=require(_0xeede('0xe'));var deskjs=require(_0xeede('0xf'));var toCsv=require(_0xeede('0x9'));var querystring=require(_0xeede('0x10'));var Papa=require(_0xeede('0x11'));var htmlToText=require(_0xeede('0x12'));var juice=require(_0xeede('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeede('0x14'));var as=require(_0xeede('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeede('0x16'));var utils=require('../../config/utils');var config=require(_0xeede('0x17'));var licenseUtil=require(_0xeede('0x18'));var db=require(_0xeede('0x19'))['db'];config[_0xeede('0x1a')]=_[_0xeede('0x1b')](config[_0xeede('0x1a')],{'host':_0xeede('0x1c'),'port':0x18eb});var socket=require(_0xeede('0x1d'))(new Redis(config[_0xeede('0x1a')]));require('./mailAccount.socket')[_0xeede('0x1e')](socket);var jayson=require(_0xeede('0x1f'));var client=jayson[_0xeede('0x20')]['http']({'port':0x232b});function respondWithRpcPromise(_0xadeb4e,_0x29658f,_0x302c29,_0xcd2aa9){return new BPromise(function(_0x3fd759,_0x12c19e){var _0x30e8b9=_0xcd2aa9||client;return _0x30e8b9[_0xeede('0x21')](_0xadeb4e,_0x302c29)[_0xeede('0x22')](function(_0x1abd5a){logger[_0xeede('0x23')](_0xeede('0x24'),_0x29658f,'request\x20sent');logger[_0xeede('0x25')](_0xeede('0x26'),_0x29658f,_0xeede('0x27'),JSON[_0xeede('0x28')](_0x1abd5a));if(_0x1abd5a[_0xeede('0x29')]){if(_0x1abd5a[_0xeede('0x29')][_0xeede('0x2a')]===0x1f4){logger[_0xeede('0x29')](_0xeede('0x24'),_0x29658f,_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);return _0x12c19e(_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);}logger[_0xeede('0x29')](_0xeede('0x24'),_0x29658f,_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);return _0x3fd759(_0x1abd5a[_0xeede('0x29')][_0xeede('0x2b')]);}else{logger[_0xeede('0x23')](_0xeede('0x24'),_0x29658f,_0xeede('0x27'));_0x3fd759(_0x1abd5a[_0xeede('0x2c')]['message']);}})[_0xeede('0x2d')](function(_0x1b0729){logger[_0xeede('0x29')](_0xeede('0x24'),_0x29658f,_0x1b0729);_0x12c19e(_0x1b0729);});});}function respondWithStatusCode(_0x171220,_0x370eb9){_0x370eb9=_0x370eb9||0xcc;return function(_0x4f2107){if(_0x4f2107){return _0x171220[_0xeede('0x2e')](_0x370eb9);}return _0x171220[_0xeede('0x2f')](_0x370eb9)['end']();};}function respondWithResult(_0x5aa153,_0x57898b){_0x57898b=_0x57898b||0xc8;return function(_0x264041){if(_0x264041){return _0x5aa153[_0xeede('0x2f')](_0x57898b)[_0xeede('0x30')](_0x264041);}};}function respondWithFilteredResult(_0x20f621,_0x5e50f3){return function(_0x20026e){if(_0x20026e){var _0x30fe7d=typeof _0x5e50f3[_0xeede('0x31')]===_0xeede('0x32')&&typeof _0x5e50f3[_0xeede('0x33')]===_0xeede('0x32');var _0x5ce538=_0x20026e[_0xeede('0x34')];var _0x2ff7d2=_0x30fe7d?0x0:_0x5e50f3[_0xeede('0x31')];var _0x19b377=_0x30fe7d?_0x20026e[_0xeede('0x34')]:_0x5e50f3['offset']+_0x5e50f3[_0xeede('0x33')];var _0x1f57ad;if(_0x19b377>=_0x5ce538){_0x19b377=_0x5ce538;_0x1f57ad=0xc8;}else{_0x1f57ad=0xce;}_0x20f621[_0xeede('0x2f')](_0x1f57ad);return _0x20f621[_0xeede('0x35')](_0xeede('0x36'),_0x2ff7d2+'-'+_0x19b377+'/'+_0x5ce538)['json'](_0x20026e);}return null;};}function patchUpdates(_0x3d3a1e){return function(_0x2818d0){try{jsonpatch[_0xeede('0x37')](_0x2818d0,_0x3d3a1e,!![]);}catch(_0x1d3d90){return BPromise[_0xeede('0x38')](_0x1d3d90);}return _0x2818d0['save']();};}function saveUpdates(_0x48b3c7,_0x2e04bd){return function(_0x30a2b4){if(_0x30a2b4){return _0x30a2b4['update'](_0x48b3c7)[_0xeede('0x22')](function(_0x3b643e){return _0x3b643e;});}return null;};}function removeEntity(_0x55c660,_0x202419){return function(_0x102ef4){if(_0x102ef4){return _0x102ef4['destroy']()[_0xeede('0x22')](function(){var _0x3765a1=_0x102ef4[_0xeede('0x39')]({'plain':!![]});var _0x79059c='MailAccounts';return db['UserProfileResource'][_0xeede('0x3a')]({'where':{'type':_0x79059c,'resourceId':_0x3765a1['id']}})[_0xeede('0x22')](function(){return _0x102ef4;});})[_0xeede('0x22')](function(){_0x55c660[_0xeede('0x2f')](0xcc)[_0xeede('0x3b')]();});}};}function handleEntityNotFound(_0x1f1f85,_0x4ea89f){return function(_0x2046d4){if(!_0x2046d4){_0x1f1f85[_0xeede('0x2e')](0x194);}return _0x2046d4;};}function handleError(_0x9d9b7,_0x2246fa){_0x2246fa=_0x2246fa||0x1f4;return function(_0x3d34ed){logger[_0xeede('0x29')](_0x3d34ed[_0xeede('0x3c')]);if(_0x3d34ed[_0xeede('0x3d')]){delete _0x3d34ed[_0xeede('0x3d')];}_0x9d9b7[_0xeede('0x2f')](_0x2246fa)[_0xeede('0x3e')](_0x3d34ed);};}function getMustacheRender(_0x2286e3,_0x3f3b1f){return Mustache[_0xeede('0x3f')](_0x2286e3,_[_0xeede('0x40')](_0x3f3b1f['body'],{'contact':_0x3f3b1f[_0xeede('0x41')],'message':_0x3f3b1f[_0xeede('0x2b')],'agent':_0x3f3b1f[_0xeede('0x42')],'interaction':_0x3f3b1f[_0xeede('0x43')],'account':_0x3f3b1f[_0xeede('0x44')]}))||'';}exports[_0xeede('0x45')]=function(_0x4d918f,_0x55720f){var _0x45e735={'include':[{'model':db['MailServerIn'],'as':_0xeede('0x46')},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db[_0xeede('0x49')],'as':_0xeede('0x4a')}]},_0x297a75={},_0x402333={'count':0x0,'rows':[]};var _0x5a397f=_[_0xeede('0x4b')](db['MailAccount']['rawAttributes'],function(_0x1b9d09){return{'name':_0x1b9d09['fieldName'],'type':_0x1b9d09[_0xeede('0x4c')][_0xeede('0x4d')]};});_0x297a75[_0xeede('0x4e')]=_[_0xeede('0x4b')](_0x5a397f,'name');_0x297a75['query']=_[_0xeede('0x4f')](_0x4d918f[_0xeede('0x50')]);_0x297a75[_0xeede('0x51')]=_[_0xeede('0x52')](_0x297a75[_0xeede('0x4e')],_0x297a75[_0xeede('0x50')]);_0x45e735[_0xeede('0x53')]=_[_0xeede('0x52')](_0x297a75['model'],qs[_0xeede('0x54')](_0x4d918f[_0xeede('0x50')][_0xeede('0x54')]));_0x45e735['attributes']=_0x45e735[_0xeede('0x53')][_0xeede('0x55')]?_0x45e735[_0xeede('0x53')]:_0x297a75[_0xeede('0x4e')];if(!_0x4d918f[_0xeede('0x50')]['hasOwnProperty']('nolimit')){_0x45e735[_0xeede('0x33')]=qs['limit'](_0x4d918f[_0xeede('0x50')][_0xeede('0x33')]);_0x45e735['offset']=qs[_0xeede('0x31')](_0x4d918f['query'][_0xeede('0x31')]);}_0x45e735[_0xeede('0x56')]=qs['sort'](_0x4d918f[_0xeede('0x50')]['sort']);_0x45e735[_0xeede('0x57')]=qs['filters'](_['pick'](_0x4d918f['query'],_0x297a75[_0xeede('0x51')]),_0x5a397f);if(_0x4d918f[_0xeede('0x50')]['filter']){_0x45e735[_0xeede('0x57')]=_[_0xeede('0x40')](_0x45e735[_0xeede('0x57')],{'$or':_['map'](_0x5a397f,function(_0x207a83){if(_0x207a83[_0xeede('0x4c')]!==_0xeede('0x58')){var _0x323e8a={};_0x323e8a[_0x207a83['name']]={'$like':'%'+_0x4d918f[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x323e8a;}})});}_0x45e735=_[_0xeede('0x40')]({},_0x45e735,_0x4d918f[_0xeede('0x5a')]);var _0x3c6244={'where':_0x45e735[_0xeede('0x57')]};return db['MailAccount'][_0xeede('0x34')](_0x3c6244)[_0xeede('0x22')](function(_0x3dbb85){_0x402333[_0xeede('0x34')]=_0x3dbb85;if(_0x4d918f[_0xeede('0x50')]['includeAll']){_0x45e735[_0xeede('0x5b')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x45e735);})['then'](function(_0x1f3f0d){_0x402333['rows']=_0x1f3f0d;return _0x402333;})[_0xeede('0x22')](respondWithFilteredResult(_0x55720f,_0x45e735))['catch'](handleError(_0x55720f,null));};exports[_0xeede('0x5c')]=function(_0x3cc517,_0x4a8815){var _0x218e61={'raw':![],'where':{'id':_0x3cc517[_0xeede('0x5d')]['id']},'include':[{'model':db[_0xeede('0x5e')],'as':_0xeede('0x46')},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db[_0xeede('0x49')],'as':_0xeede('0x4a')}]},_0xb9f24a={};_0xb9f24a[_0xeede('0x4e')]=_[_0xeede('0x4f')](db[_0xeede('0x5f')][_0xeede('0x60')]);_0xb9f24a['query']=_[_0xeede('0x4f')](_0x3cc517['query']);_0xb9f24a[_0xeede('0x51')]=_[_0xeede('0x52')](_0xb9f24a[_0xeede('0x4e')],_0xb9f24a[_0xeede('0x50')]);_0x218e61[_0xeede('0x53')]=_[_0xeede('0x52')](_0xb9f24a[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x3cc517[_0xeede('0x50')][_0xeede('0x54')]));_0x218e61[_0xeede('0x53')]=_0x218e61['attributes'][_0xeede('0x55')]?_0x218e61['attributes']:_0xb9f24a[_0xeede('0x4e')];if(_0x3cc517[_0xeede('0x50')][_0xeede('0x61')]){_0x218e61[_0xeede('0x5b')]=[{'all':!![]}];}_0x218e61=_[_0xeede('0x40')]({},_0x218e61,_0x3cc517[_0xeede('0x5a')]);return db['MailAccount'][_0xeede('0x62')](_0x218e61)[_0xeede('0x22')](handleEntityNotFound(_0x4a8815,null))[_0xeede('0x22')](respondWithResult(_0x4a8815,null))['catch'](handleError(_0x4a8815,null));};exports['update']=function(_0x482ba0,_0x1f64c4){if(_0x482ba0[_0xeede('0x63')]['id']){delete _0x482ba0[_0xeede('0x63')]['id'];}return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x482ba0['params']['id']},'include':[{'model':db[_0xeede('0x5e')],'as':'Imap'},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db['Pause'],'as':_0xeede('0x4a')}]})[_0xeede('0x22')](handleEntityNotFound(_0x1f64c4,null))[_0xeede('0x22')](saveUpdates(_0x482ba0[_0xeede('0x63')],null))[_0xeede('0x22')](function(_0x2b9e58){if(_0x2b9e58&&_0x482ba0[_0xeede('0x63')]['Imap']){return db[_0xeede('0x5e')][_0xeede('0x64')](_0x482ba0[_0xeede('0x63')][_0xeede('0x46')],{'where':{'MailAccountId':_0x2b9e58['id']}})[_0xeede('0x22')](function(){return _0x2b9e58;});}return _0x2b9e58;})[_0xeede('0x22')](function(_0xd66719){if(_0xd66719&&_0x482ba0[_0xeede('0x63')]['Smtp']){return db[_0xeede('0x47')][_0xeede('0x64')](_0x482ba0['body'][_0xeede('0x48')],{'where':{'MailAccountId':_0xd66719['id']}})[_0xeede('0x22')](function(){return _0xd66719;});}return _0xd66719;})[_0xeede('0x22')](respondWithResult(_0x1f64c4,null))[_0xeede('0x2d')](handleError(_0x1f64c4,null));};exports['describe']=function(_0xe520c5,_0x11e436){return db['MailAccount'][_0xeede('0x65')]()[_0xeede('0x22')](respondWithResult(_0x11e436,null))['catch'](handleError(_0x11e436,null));};exports['addDisposition']=function(_0x326f6b,_0x1d66d4,_0x5ea9bd){if(_0x326f6b[_0xeede('0x63')]['id']){delete _0x326f6b['body']['id'];}return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x326f6b[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x1d66d4,null))['then'](function(_0x114c38){if(_0x114c38){_0x326f6b['body'][_0xeede('0x66')]=_0x114c38['id'];return db[_0xeede('0x67')][_0xeede('0x68')](_0x326f6b['body']);}})[_0xeede('0x22')](respondWithResult(_0x1d66d4,null))['catch'](handleError(_0x1d66d4,null));};exports[_0xeede('0x69')]=function(_0x19c003,_0x20f216,_0x5b0705){var _0x4e4a9={'raw':![],'where':{}};var _0xc1c895={};var _0x1e229e={'count':0x0,'rows':[]};return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x19c003[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x20f216,null))[_0xeede('0x22')](function(_0x5ac2d0){if(_0x5ac2d0){_0xc1c895['model']=_[_0xeede('0x4f')](db[_0xeede('0x67')][_0xeede('0x60')]);_0xc1c895[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x19c003[_0xeede('0x50')]);_0xc1c895[_0xeede('0x51')]=_[_0xeede('0x52')](_0xc1c895[_0xeede('0x4e')],_0xc1c895[_0xeede('0x50')]);_0x4e4a9[_0xeede('0x53')]=_[_0xeede('0x52')](_0xc1c895[_0xeede('0x4e')],qs['fields'](_0x19c003['query'][_0xeede('0x54')]));_0x4e4a9[_0xeede('0x53')]=_0x4e4a9[_0xeede('0x53')]['length']?_0x4e4a9[_0xeede('0x53')]:_0xc1c895[_0xeede('0x4e')];if(!_0x19c003['query'][_0xeede('0x6b')](_0xeede('0x6c'))){_0x4e4a9[_0xeede('0x33')]=qs[_0xeede('0x33')](_0x19c003[_0xeede('0x50')][_0xeede('0x33')]);_0x4e4a9['offset']=qs[_0xeede('0x31')](_0x19c003['query'][_0xeede('0x31')]);}_0x4e4a9[_0xeede('0x56')]=qs[_0xeede('0x6d')](_0x19c003[_0xeede('0x50')][_0xeede('0x6d')]);_0x4e4a9['where']=qs['filters'](_[_0xeede('0x6e')](_0x19c003[_0xeede('0x50')],_0xc1c895[_0xeede('0x51')]));_0x4e4a9[_0xeede('0x57')][_0xeede('0x66')]=_0x5ac2d0['id'];if(_0x19c003[_0xeede('0x50')][_0xeede('0x59')]){_0x4e4a9['where']=_[_0xeede('0x40')](_0x4e4a9[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x4e4a9[_0xeede('0x53')],function(_0x120293){var _0x221b99={};_0x221b99[_0x120293]={'$like':'%'+_0x19c003[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x221b99;})});}_0x4e4a9=_[_0xeede('0x40')]({},_0x4e4a9,_0x19c003[_0xeede('0x5a')]);return db[_0xeede('0x67')]['count']({'where':_0x4e4a9[_0xeede('0x57')]})['then'](function(_0x35ccfa){_0x1e229e['count']=_0x35ccfa;if(_0x19c003[_0xeede('0x50')][_0xeede('0x61')]){_0x4e4a9[_0xeede('0x5b')]=[{'all':!![]}];}return db[_0xeede('0x67')]['findAll'](_0x4e4a9);})[_0xeede('0x22')](function(_0x2927d2){_0x1e229e[_0xeede('0x6f')]=_0x2927d2;return _0x1e229e;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x20f216,_0x4e4a9))[_0xeede('0x2d')](handleError(_0x20f216,null));};exports['removeDispositions']=function(_0x25eb4e,_0x42e2bc,_0x44e9b3){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x25eb4e[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x42e2bc,null))[_0xeede('0x22')](function(_0x292484){if(_0x292484){return _0x292484[_0xeede('0x70')](_0x25eb4e[_0xeede('0x50')]['ids']);}})[_0xeede('0x22')](respondWithStatusCode(_0x42e2bc,null))['catch'](handleError(_0x42e2bc,null));};exports[_0xeede('0x71')]=function(_0x516e95,_0x4fa231,_0x3e6ffa){if(_0x516e95['body']['id']){delete _0x516e95[_0xeede('0x63')]['id'];}return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x516e95[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x4fa231,null))[_0xeede('0x22')](function(_0x27b20e){if(_0x27b20e){_0x516e95['body']['MailAccountId']=_0x27b20e['id'];return db[_0xeede('0x72')][_0xeede('0x68')](_0x516e95[_0xeede('0x63')]);}})['then'](respondWithResult(_0x4fa231,null))['catch'](handleError(_0x4fa231,null));};exports['getAnswers']=function(_0x3d11ce,_0x252b4f,_0x3dd56a){var _0x58d0cf={'raw':![],'where':{}};var _0x885bab={};var _0x208dc1={'count':0x0,'rows':[]};return db[_0xeede('0x5f')]['findOne']({'where':{'id':_0x3d11ce['params']['id']}})['then'](handleEntityNotFound(_0x252b4f,null))['then'](function(_0x385caf){if(_0x385caf){_0x885bab[_0xeede('0x4e')]=_['keys'](db['CannedAnswer'][_0xeede('0x60')]);_0x885bab[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x3d11ce['query']);_0x885bab[_0xeede('0x51')]=_[_0xeede('0x52')](_0x885bab[_0xeede('0x4e')],_0x885bab[_0xeede('0x50')]);_0x58d0cf['attributes']=_[_0xeede('0x52')](_0x885bab[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x3d11ce['query'][_0xeede('0x54')]));_0x58d0cf['attributes']=_0x58d0cf[_0xeede('0x53')][_0xeede('0x55')]?_0x58d0cf[_0xeede('0x53')]:_0x885bab[_0xeede('0x4e')];if(!_0x3d11ce[_0xeede('0x50')]['hasOwnProperty'](_0xeede('0x6c'))){_0x58d0cf[_0xeede('0x33')]=qs['limit'](_0x3d11ce[_0xeede('0x50')][_0xeede('0x33')]);_0x58d0cf[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x3d11ce[_0xeede('0x50')][_0xeede('0x31')]);}_0x58d0cf[_0xeede('0x56')]=qs[_0xeede('0x6d')](_0x3d11ce[_0xeede('0x50')][_0xeede('0x6d')]);_0x58d0cf['where']=qs['filters'](_['pick'](_0x3d11ce[_0xeede('0x50')],_0x885bab[_0xeede('0x51')]));_0x58d0cf[_0xeede('0x57')][_0xeede('0x66')]=_0x385caf['id'];if(_0x3d11ce['query']['filter']){_0x58d0cf['where']=_[_0xeede('0x40')](_0x58d0cf[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x58d0cf['attributes'],function(_0x4e1f90){var _0x3df5d0={};_0x3df5d0[_0x4e1f90]={'$like':'%'+_0x3d11ce[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x3df5d0;})});}_0x58d0cf=_[_0xeede('0x40')]({},_0x58d0cf,_0x3d11ce['options']);return db[_0xeede('0x72')]['count']({'where':_0x58d0cf['where']})[_0xeede('0x22')](function(_0x9b7ea3){_0x208dc1[_0xeede('0x34')]=_0x9b7ea3;if(_0x3d11ce[_0xeede('0x50')][_0xeede('0x61')]){_0x58d0cf['include']=[{'all':!![]}];}return db[_0xeede('0x72')][_0xeede('0x73')](_0x58d0cf);})[_0xeede('0x22')](function(_0x2264c8){_0x208dc1[_0xeede('0x6f')]=_0x2264c8;return _0x208dc1;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x252b4f,_0x58d0cf))[_0xeede('0x2d')](handleError(_0x252b4f,null));};exports[_0xeede('0x74')]=function(_0x38c129,_0x268189,_0x2d4292){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x38c129[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x268189,null))['then'](function(_0x5b60a9){if(_0x5b60a9){return _0x5b60a9['removeAnswers'](_0x38c129[_0xeede('0x50')][_0xeede('0x75')]);}})[_0xeede('0x22')](respondWithStatusCode(_0x268189,null))['catch'](handleError(_0x268189,null));};exports[_0xeede('0x68')]=function(_0x4188a0,_0xf478d2){var _0x46a086={'name':_0x4188a0['body'][_0xeede('0x3d')],'key':_0x4188a0['body'][_0xeede('0x4d')],'email':_0x4188a0[_0xeede('0x63')]['email'],'ListId':_0x4188a0[_0xeede('0x63')][_0xeede('0x76')],'active':!_[_0xeede('0x77')](_0x4188a0[_0xeede('0x63')][_0xeede('0x78')])?_0x4188a0[_0xeede('0x63')][_0xeede('0x78')]:!![],'description':_0x4188a0[_0xeede('0x63')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xeede('0x77')](_0x4188a0[_0xeede('0x63')][_0xeede('0x79')])){if(_0x4188a0[_0xeede('0x63')][_0xeede('0x7a')]){_0x46a086[_0xeede('0x46')][_0xeede('0x7b')]=_0x46a086[_0xeede('0x48')][_0xeede('0x7b')]=_0x4188a0[_0xeede('0x63')]['cuser'];_0x46a086['Imap']['password']=_0x46a086['Smtp'][_0xeede('0x7c')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x7d')];}else{_0x46a086[_0xeede('0x46')][_0xeede('0x7e')]=_0x46a086['Smtp'][_0xeede('0x7e')]=![];}_0x46a086[_0xeede('0x46')]['host']=_0x4188a0['body'][_0xeede('0x46')]['host'];_0x46a086[_0xeede('0x46')][_0xeede('0x7f')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x46')][_0xeede('0x7f')];_0x46a086[_0xeede('0x48')][_0xeede('0x80')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x48')][_0xeede('0x80')];_0x46a086[_0xeede('0x48')]['port']=_0x4188a0[_0xeede('0x63')][_0xeede('0x48')][_0xeede('0x7f')];}else{_0x46a086['Imap']['service']=_0x46a086['Smtp']['service']=_0x4188a0[_0xeede('0x63')]['cservice'];_0x46a086['Imap'][_0xeede('0x7b')]=_0x46a086[_0xeede('0x48')][_0xeede('0x7b')]=_0x4188a0[_0xeede('0x63')]['cuser'];_0x46a086[_0xeede('0x46')][_0xeede('0x81')]=_0x46a086[_0xeede('0x48')][_0xeede('0x7c')]=_0x4188a0[_0xeede('0x63')][_0xeede('0x7d')];}return db['MailAccount'][_0xeede('0x68')](_0x46a086,{'include':[{'model':db[_0xeede('0x47')],'as':_0xeede('0x48')},{'model':db[_0xeede('0x5e')],'as':'Imap'}]})['then'](function(_0x217398){var _0x53de8f=_0x4188a0['user'][_0xeede('0x39')]({'plain':!![]});if(!_0x53de8f)throw new Error(_0xeede('0x82'));if(_0x53de8f['role']===_0xeede('0x7b')){var _0x108f0c=_0x217398['get']({'plain':!![]});return db[_0xeede('0x83')][_0xeede('0x62')]({'where':{'name':_0xeede('0x84'),'userProfileId':_0x53de8f['userProfileId']},'raw':!![]})[_0xeede('0x22')](function(_0x52d3ff){if(_0x52d3ff&&_0x52d3ff['autoAssociation']===0x0){return db['UserProfileResource'][_0xeede('0x68')]({'name':_0x108f0c[_0xeede('0x3d')],'resourceId':_0x108f0c['id'],'type':_0x52d3ff[_0xeede('0x3d')],'sectionId':_0x52d3ff['id']},{})[_0xeede('0x22')](function(){return _0x217398;});}else{return _0x217398;}})[_0xeede('0x2d')](function(_0x632db0){logger['error'](_0xeede('0x85'),_0x632db0);throw _0x632db0;});}return _0x217398;})[_0xeede('0x22')](respondWithResult(_0xf478d2,0xc9))['catch'](handleError(_0xf478d2,null));};exports[_0xeede('0x86')]=function(_0x28c4d9,_0x3b633b,_0x3de351){return db['MailAccount'][_0xeede('0x6a')]({'where':{'id':_0x28c4d9[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x3b633b,null))[_0xeede('0x22')](function(_0x2527c7){if(_0x2527c7){return _0x2527c7['getImap']();}return null;})[_0xeede('0x22')](respondWithResult(_0x3b633b,null))[_0xeede('0x2d')](handleError(_0x3b633b,null));};exports[_0xeede('0x87')]=function(_0x50bc03,_0x68edf3,_0x37f52b){if(_0x50bc03[_0xeede('0x63')]['id']){delete _0x50bc03[_0xeede('0x63')]['id'];}return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x50bc03[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x68edf3,null))['then'](function(_0x5806d3){if(_0x5806d3){_0x50bc03['body'][_0xeede('0x66')]=_0x5806d3['id'];return db[_0xeede('0x5e')][_0xeede('0x68')](_0x50bc03['body']);}})[_0xeede('0x22')](respondWithResult(_0x68edf3,null))[_0xeede('0x2d')](handleError(_0x68edf3,null));};exports['removeImap']=function(_0x400bd7,_0x4d8ef1,_0x1a8a2a){return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x400bd7[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x4d8ef1,null))['then'](function(_0x21de5e){if(_0x21de5e){return _0x21de5e['setImap'](null);}return null;})[_0xeede('0x22')](respondWithStatusCode(_0x4d8ef1,null))[_0xeede('0x2d')](handleError(_0x4d8ef1,null));};exports[_0xeede('0x88')]=function(_0x412cff,_0x5f0a94,_0x579fd0){return db['MailAccount'][_0xeede('0x6a')]({'where':{'id':_0x412cff[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x5f0a94,null))[_0xeede('0x22')](function(_0x4d6bba){if(_0x4d6bba){return _0x4d6bba[_0xeede('0x88')]();}return null;})[_0xeede('0x22')](respondWithResult(_0x5f0a94,null))[_0xeede('0x2d')](handleError(_0x5f0a94,null));};exports[_0xeede('0x89')]=function(_0x2daec0,_0x340b44,_0x3283f0){if(_0x2daec0[_0xeede('0x63')]['id']){delete _0x2daec0[_0xeede('0x63')]['id'];}return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x2daec0['params']['id']}})['then'](handleEntityNotFound(_0x340b44,null))[_0xeede('0x22')](function(_0x11590e){if(_0x11590e){_0x2daec0[_0xeede('0x63')]['MailAccountId']=_0x11590e['id'];return db[_0xeede('0x47')][_0xeede('0x68')](_0x2daec0[_0xeede('0x63')]);}})['then'](respondWithResult(_0x340b44,null))[_0xeede('0x2d')](handleError(_0x340b44,null));};exports['removeSmtp']=function(_0x3dfd7e,_0x39d2a2,_0x48976d){return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x3dfd7e[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x39d2a2,null))[_0xeede('0x22')](function(_0x55e4fc){if(_0x55e4fc){return _0x55e4fc[_0xeede('0x8a')](null);}return null;})[_0xeede('0x22')](respondWithStatusCode(_0x39d2a2,null))[_0xeede('0x2d')](handleError(_0x39d2a2,null));};exports[_0xeede('0x8b')]=function(_0x574042,_0x61430b,_0x50c501){return db[_0xeede('0x8c')][_0xeede('0x62')]({'where':{'id':_0x574042[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x61430b,null))['then'](function(_0x291492){if(_0x291492){return _0x291492[_0xeede('0x8b')](_0x574042[_0xeede('0x63')]['ids'],_[_0xeede('0x8d')](_0x574042[_0xeede('0x63')],[_0xeede('0x75'),'id'])||{});}})[_0xeede('0x22')](respondWithResult(_0x61430b,null))[_0xeede('0x2d')](handleError(_0x61430b,null));};exports[_0xeede('0x8e')]=function(_0x5d7d6f,_0x11a918,_0x48bef1){var _0x3a53d3={'raw':![],'where':{}};var _0xbef590={};var _0xe42168={'count':0x0,'rows':[]};return db[_0xeede('0x5f')]['findOne']({'where':{'id':_0x5d7d6f[_0xeede('0x5d')]['id']}})['then'](handleEntityNotFound(_0x11a918,null))[_0xeede('0x22')](function(_0x2469f7){if(_0x2469f7){_0xbef590[_0xeede('0x4e')]=_['keys'](db[_0xeede('0x8c')]['rawAttributes']);_0xbef590[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x5d7d6f[_0xeede('0x50')]);_0xbef590[_0xeede('0x51')]=_[_0xeede('0x52')](_0xbef590['model'],_0xbef590[_0xeede('0x50')]);_0x3a53d3['attributes']=_[_0xeede('0x52')](_0xbef590[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x5d7d6f[_0xeede('0x50')][_0xeede('0x54')]));_0x3a53d3['attributes']=_0x3a53d3[_0xeede('0x53')][_0xeede('0x55')]?_0x3a53d3['attributes']:_0xbef590[_0xeede('0x4e')];if(!_0x5d7d6f[_0xeede('0x50')]['hasOwnProperty'](_0xeede('0x6c'))){_0x3a53d3['limit']=qs[_0xeede('0x33')](_0x5d7d6f[_0xeede('0x50')]['limit']);_0x3a53d3[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x5d7d6f[_0xeede('0x50')][_0xeede('0x31')]);}_0x3a53d3[_0xeede('0x56')]=qs[_0xeede('0x6d')](_0x5d7d6f[_0xeede('0x50')][_0xeede('0x6d')]);_0x3a53d3[_0xeede('0x57')]=qs['filters'](_[_0xeede('0x6e')](_0x5d7d6f[_0xeede('0x50')],_0xbef590[_0xeede('0x51')]));_0x3a53d3[_0xeede('0x57')]['MailAccountId']=_0x2469f7['id'];if(_0x5d7d6f['query']['filter']){_0x3a53d3[_0xeede('0x57')]=_['merge'](_0x3a53d3['where'],{'$or':_[_0xeede('0x4b')](_0x3a53d3[_0xeede('0x53')],function(_0x57938f){var _0x26f44d={};_0x26f44d[_0x57938f]={'$like':'%'+_0x5d7d6f['query']['filter']+'%'};return _0x26f44d;})});}_0x3a53d3=_['merge']({},_0x3a53d3,_0x5d7d6f['options']);return db[_0xeede('0x8c')][_0xeede('0x34')]({'where':_0x3a53d3[_0xeede('0x57')]})['then'](function(_0x1aafbe){_0xe42168[_0xeede('0x34')]=_0x1aafbe;if(_0x5d7d6f['query'][_0xeede('0x61')]){_0x3a53d3[_0xeede('0x5b')]=[{'model':db[_0xeede('0x8f')],'as':'Contact','required':![]},{'model':db[_0xeede('0x90')],'as':_0xeede('0x91'),'attributes':['name','fullname',_0xeede('0x92')],'required':![]},{'model':db['Tag'],'as':_0xeede('0x93'),'attributes':['id',_0xeede('0x3d'),'color'],'where':_0x5d7d6f['query'][_0xeede('0x94')]?{'id':_0x5d7d6f['query'][_0xeede('0x94')]}:undefined,'required':_0x5d7d6f[_0xeede('0x50')][_0xeede('0x94')]?!![]:![]}];}return db[_0xeede('0x8c')]['findAll'](_0x3a53d3);})['then'](function(_0x5596cd){_0xe42168[_0xeede('0x6f')]=_0x5596cd;return _0xe42168;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x11a918,_0x3a53d3))[_0xeede('0x2d')](handleError(_0x11a918,null));};exports[_0xeede('0x95')]=function(_0x14fedd,_0x5e12f4,_0x115b60){return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x14fedd[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x5e12f4,null))['then'](function(_0x3b193d){if(_0x3b193d){return db['sequelize'][_0xeede('0x96')](function(_0x2a0269){return db['MailApplication'][_0xeede('0x3a')]({'where':{'MailAccountId':_0x14fedd['params']['id']},'transaction':_0x2a0269})[_0xeede('0x22')](function(_0x501a42){var _0x32b1a9=_[_0xeede('0x4b')](_0x14fedd[_0xeede('0x63')],function(_0x12b0f6){_0x12b0f6[_0xeede('0x66')]=_0x14fedd[_0xeede('0x5d')]['id'];return _0x12b0f6;});return db[_0xeede('0x97')][_0xeede('0x98')](_0x32b1a9,{'transaction':_0x2a0269});});})[_0xeede('0x22')](function(){return db[_0xeede('0x97')][_0xeede('0x99')]({'where':{'MailAccountId':_0x14fedd[_0xeede('0x5d')]['id']},'order':_0xeede('0x9a')});});}})[_0xeede('0x22')](respondWithResult(_0x5e12f4,null))[_0xeede('0x2d')](handleError(_0x5e12f4,null));};exports[_0xeede('0x9b')]=function(_0x57e38b,_0x312c67,_0x404b41){var _0x5be2d9={};var _0x48581c={};var _0x286796;var _0x188493;return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x57e38b[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x312c67,null))['then'](function(_0xf9f303){if(_0xf9f303){_0x286796=_0xf9f303;_0x48581c[_0xeede('0x4e')]=_[_0xeede('0x4f')](db[_0xeede('0x97')][_0xeede('0x60')]);_0x48581c[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x57e38b[_0xeede('0x50')]);_0x48581c['filters']=_[_0xeede('0x52')](_0x48581c[_0xeede('0x4e')],_0x48581c[_0xeede('0x50')]);_0x5be2d9[_0xeede('0x53')]=_[_0xeede('0x52')](_0x48581c['model'],qs[_0xeede('0x54')](_0x57e38b['query'][_0xeede('0x54')]));_0x5be2d9[_0xeede('0x53')]=_0x5be2d9[_0xeede('0x53')][_0xeede('0x55')]?_0x5be2d9[_0xeede('0x53')]:_0x48581c[_0xeede('0x4e')];_0x5be2d9[_0xeede('0x56')]=qs['sort'](_0x57e38b[_0xeede('0x50')]['sort']);_0x5be2d9[_0xeede('0x57')]=qs[_0xeede('0x51')](_['pick'](_0x57e38b['query'],_0x48581c[_0xeede('0x51')]));if(_0x57e38b[_0xeede('0x50')][_0xeede('0x59')]){_0x5be2d9[_0xeede('0x57')]=_[_0xeede('0x40')](_0x5be2d9[_0xeede('0x57')],{'$or':_['map'](_0x5be2d9[_0xeede('0x53')],function(_0x4a9a1b){var _0x2cb589={};_0x2cb589[_0x4a9a1b]={'$like':'%'+_0x57e38b[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x2cb589;})});}_0x5be2d9=_[_0xeede('0x40')]({},_0x5be2d9,_0x57e38b[_0xeede('0x5a')]);return _0x286796['getApplications'](_0x5be2d9);}})[_0xeede('0x22')](function(_0x4db5b4){if(_0x4db5b4){_0x188493=_0x4db5b4[_0xeede('0x55')];if(!_0x57e38b[_0xeede('0x50')][_0xeede('0x6b')](_0xeede('0x6c'))){_0x5be2d9[_0xeede('0x33')]=qs[_0xeede('0x33')](_0x57e38b['query']['limit']);_0x5be2d9[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x57e38b[_0xeede('0x50')][_0xeede('0x31')]);}return _0x286796[_0xeede('0x9b')](_0x5be2d9);}})[_0xeede('0x22')](function(_0x44d0db){if(_0x44d0db){return _0x44d0db?{'count':_0x188493,'rows':_0x44d0db}:null;}})['then'](respondWithResult(_0x312c67,null))[_0xeede('0x2d')](handleError(_0x312c67,null));};exports[_0xeede('0x9c')]=function(_0x10629d,_0x537cad,_0x1f530c){var _0x5499fa={'raw':!![],'where':{}};var _0x37f581={};var _0x57dd8b={'count':0x0,'rows':[]};return db[_0xeede('0x5f')][_0xeede('0x6a')]({'where':{'id':_0x10629d['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x537cad,null))['then'](function(_0x5da27b){if(_0x5da27b){_0x37f581[_0xeede('0x4e')]=_[_0xeede('0x4f')](db[_0xeede('0x9d')][_0xeede('0x60')]);_0x37f581[_0xeede('0x50')]=_[_0xeede('0x4f')](_0x10629d[_0xeede('0x50')]);_0x37f581['filters']=_['intersection'](_0x37f581[_0xeede('0x4e')],_0x37f581[_0xeede('0x50')]);_0x5499fa[_0xeede('0x53')]=_[_0xeede('0x52')](_0x37f581[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x10629d[_0xeede('0x50')]['fields']));_0x5499fa['attributes']=_0x5499fa[_0xeede('0x53')][_0xeede('0x55')]?_0x5499fa['attributes']:_0x37f581[_0xeede('0x4e')];if(!_0x10629d[_0xeede('0x50')][_0xeede('0x6b')](_0xeede('0x6c'))){_0x5499fa['limit']=qs[_0xeede('0x33')](_0x10629d[_0xeede('0x50')][_0xeede('0x33')]);_0x5499fa[_0xeede('0x31')]=qs[_0xeede('0x31')](_0x10629d[_0xeede('0x50')][_0xeede('0x31')]);}_0x5499fa['order']=qs[_0xeede('0x6d')](_0x10629d[_0xeede('0x50')]['sort']);_0x5499fa[_0xeede('0x57')]=qs['filters'](_[_0xeede('0x6e')](_0x10629d['query'],_0x37f581[_0xeede('0x51')]));_0x5499fa[_0xeede('0x57')][_0xeede('0x66')]=_0x5da27b['id'];if(_0x10629d[_0xeede('0x50')][_0xeede('0x59')]){_0x5499fa[_0xeede('0x57')]=_['merge'](_0x5499fa[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x5499fa[_0xeede('0x53')],function(_0x2b7874){var _0x1eccff={};_0x1eccff[_0x2b7874]={'$like':'%'+_0x10629d[_0xeede('0x50')][_0xeede('0x59')]+'%'};return _0x1eccff;})});}if(_0x10629d['query'][_0xeede('0x9e')]){var _0x315313=_0x10629d[_0xeede('0x50')]['$gte'][_0xeede('0x9f')](',');var _0x3f48ac={};_0x3f48ac[_0x315313[0x0]]={'$gte':moment(_0x315313[0x1])[_0xeede('0xa0')](_0xeede('0xa1'))};_0x5499fa[_0xeede('0x57')]=_[_0xeede('0x40')](_0x5499fa['where'],_0x3f48ac);}_0x5499fa=_['merge']({},_0x5499fa,_0x10629d[_0xeede('0x5a')]);return db[_0xeede('0x9d')][_0xeede('0x34')]({'where':_0x5499fa[_0xeede('0x57')]})[_0xeede('0x22')](function(_0x57e188){_0x57dd8b[_0xeede('0x34')]=_0x57e188;if(_0x10629d['query'][_0xeede('0x61')]){_0x5499fa[_0xeede('0x5b')]=[{'all':!![]}];}return db[_0xeede('0x9d')]['findAll'](_0x5499fa);})['then'](function(_0x45cccb){if(_0x10629d['query']['inlineCss']===_0xeede('0xa2')){for(var _0x4bcc4d=0x0;_0x4bcc4d<_0x45cccb[_0xeede('0x55')];_0x4bcc4d++){_0x45cccb[_0x4bcc4d][_0xeede('0x63')]=juice(_0x45cccb[_0x4bcc4d][_0xeede('0x63')]);}}_0x57dd8b['rows']=_0x45cccb;return _0x57dd8b;});}})[_0xeede('0x22')](respondWithFilteredResult(_0x537cad,_0x5499fa))[_0xeede('0x2d')](handleError(_0x537cad,null));};exports['send']=function(_0x2ab7f1,_0x508bc2,_0x3b7ec5){var _0x485696,_0x56b673={},_0x199cf7;if(_0x2ab7f1[_0xeede('0x63')]['to']){_0x199cf7=_0x2ab7f1[_0xeede('0x63')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x2ab7f1[_0xeede('0x5d')]['id']},'include':[{'model':db[_0xeede('0xa3')],'as':_0xeede('0xa4'),'include':[{'model':db[_0xeede('0x8f')],'as':_0xeede('0xa5'),'where':{'email':_0x199cf7},'limit':0x1,'order':[['updatedAt',_0xeede('0xa6')]]}]},{'model':db[_0xeede('0x47')],'as':_0xeede('0x48'),'raw':!![]}]})['then'](handleEntityNotFound(_0x508bc2,null))[_0xeede('0x22')](function(_0x5cf9ad){if(_0x5cf9ad){_0x485696=_0x5cf9ad;if(_0x5cf9ad[_0xeede('0x48')]){if(_['isNil'](_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa7')])){_0x2ab7f1['body'][_0xeede('0xa7')]=util[_0xeede('0xa0')]('%s\x20<%s>',_0x5cf9ad[_0xeede('0x3d')],_0x5cf9ad['email']||_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7b')]);}if(_0x2ab7f1[_0xeede('0x63')]['attachments']&&_0x2ab7f1['body']['attachments'][_0xeede('0x55')]){for(var _0x3c5a72=0x0;_0x3c5a72<_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa8')]['length'];_0x3c5a72+=0x1){_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa8')][_0x3c5a72]={'filename':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa8')][_0x3c5a72][_0xeede('0x3d')],'path':path['join'](config['root'],_0xeede('0xa9'),_0x2ab7f1['body'][_0xeede('0xa8')][_0x3c5a72][_0xeede('0xaa')])};}}var _0x49953a={'tls':{'rejectUnauthorized':![]}};if(_[_0xeede('0x77')](_0x5cf9ad['Smtp'][_0xeede('0xab')])){if(_0x5cf9ad[_0xeede('0x48')]['authentication']){_0x49953a[_0xeede('0xac')]={'user':_0x5cf9ad['Smtp'][_0xeede('0x7b')],'pass':_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7c')]};}_0x49953a['host']=_0x5cf9ad[_0xeede('0x48')][_0xeede('0x80')];_0x49953a[_0xeede('0x7f')]=_0x5cf9ad[_0xeede('0x48')]['port'];_0x49953a[_0xeede('0xad')]=_0x5cf9ad['Smtp']['secure'];}else{_0x49953a[_0xeede('0xab')]=_0x5cf9ad[_0xeede('0x48')][_0xeede('0xab')];_0x49953a['auth']={'user':_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7b')],'pass':_0x5cf9ad[_0xeede('0x48')][_0xeede('0x7c')]};}return respondWithRpcPromise('SendMail',_0xeede('0xae'),{'account':_0x49953a,'message':_0x2ab7f1[_0xeede('0x63')]});}else{throw new Error('List\x20not\x20found');}}})[_0xeede('0x22')](function(_0x13cf4a){if(_0x13cf4a){_0x56b673=_0x13cf4a;if(_0x485696['List']){if(_0x485696[_0xeede('0xa4')]['Contacts'][_0xeede('0x55')]){return _0x485696[_0xeede('0xa4')][_0xeede('0xa5')][0x0];}else{return db[_0xeede('0x8f')][_0xeede('0x68')](_['defaults'](_0x2ab7f1[_0xeede('0x63')],{'firstName':_0x2ab7f1[_0xeede('0x63')]['to'],'email':_0x2ab7f1[_0xeede('0x63')]['to'],'phone':_0x2ab7f1[_0xeede('0x63')]['to'],'ListId':_0x485696[_0xeede('0x76')]}));}}else{throw new Error(_0xeede('0xaf'));}}})[_0xeede('0x22')](function(_0x56f4c7){if(_0x56f4c7){var _0x511bea={'UserId':_0x2ab7f1[_0xeede('0x7b')]['id'],'ContactId':_0x56f4c7['id'],'MailAccountId':_0x485696['id'],'inReplyTo':_0x56b673['messageId'],'to':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xa7')],'cc':_0x2ab7f1[_0xeede('0x63')]['cc'],'subject':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xb0')],'attach':_0x2ab7f1[_0xeede('0x63')][_0xeede('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xeede('0xa1')),'lastMsgDirection':_0xeede('0xb2'),'Messages':[_[_0xeede('0x40')](_0x2ab7f1['body'],{'messageId':_0x56b673[_0xeede('0xb3')],'sentAt':moment()['format'](_0xeede('0xa1')),'read':!![],'MailAccountId':_0x485696['id'],'UserId':_0x2ab7f1['user']['id'],'ContactId':_0x56f4c7['id']})]};if(_0x2ab7f1['body']['Interaction']){_0x511bea=_[_0xeede('0x40')](_0x511bea,_0x2ab7f1['body'][_0xeede('0xb4')]);}return db[_0xeede('0x8c')][_0xeede('0x68')](_0x511bea,{'include':[{'model':db[_0xeede('0x9d')],'as':'Messages'}]});}})[_0xeede('0x22')](respondWithResult(_0x508bc2,null))['catch'](handleError(_0x508bc2,null));};exports[_0xeede('0xb5')]=function(_0x319cd6,_0x270e86,_0x42573b){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x319cd6[_0xeede('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xeede('0x48'),'raw':!![]}]})[_0xeede('0x22')](handleEntityNotFound(_0x270e86,null))[_0xeede('0x22')](function(_0x4fc92f){if(_0x4fc92f&&_0x4fc92f[_0xeede('0x48')]){var _0x5accd0={'id':_0x4fc92f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4fc92f[_0xeede('0x48')][_0xeede('0xab')]){_0x5accd0[_0xeede('0xab')]=_0x4fc92f['Smtp'][_0xeede('0xab')];}else{_0x5accd0[_0xeede('0x80')]=_0x4fc92f[_0xeede('0x48')][_0xeede('0x80')];_0x5accd0['port']=_0x4fc92f[_0xeede('0x48')][_0xeede('0x7f')];_0x5accd0['secure']=_0x4fc92f['Smtp'][_0xeede('0xad')];}if(_0x4fc92f['Smtp']['authentication']){_0x5accd0[_0xeede('0xac')]={'user':_0x4fc92f[_0xeede('0x48')][_0xeede('0x7b')],'pass':_0x4fc92f[_0xeede('0x48')][_0xeede('0x7c')]};}return respondWithRpcPromise(_0xeede('0xb6'),_0xeede('0xb5'),{'account':_0x5accd0});}})[_0xeede('0x22')](respondWithResult(_0x270e86,null))[_0xeede('0x2d')](handleError(_0x270e86,null));};exports['destroy']=function(_0x4a80c7,_0x56c7b2){return db[_0xeede('0x5f')][_0xeede('0x62')]({'where':{'id':_0x4a80c7['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x56c7b2,null))[_0xeede('0x22')](function(_0x3b9385){if(_0x3b9385&&_0x3b9385[_0xeede('0xab')]){throw new db[(_0xeede('0xb7'))][(_0xeede('0xb8'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3b9385;})[_0xeede('0x22')](removeEntity(_0x56c7b2,null))[_0xeede('0x2d')](handleError(_0x56c7b2,null));};exports[_0xeede('0xb9')]=function(_0xbcad57,_0x5296fd,_0x225ba4){return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0xbcad57['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x5296fd,null))[_0xeede('0x22')](function(_0x28047e){if(_0x28047e){return _0x28047e[_0xeede('0xb9')](_0xbcad57['body'][_0xeede('0x75')],_['omit'](_0xbcad57[_0xeede('0x63')],[_0xeede('0x75'),'id'])||{})[_0xeede('0xba')](function(_0x1e9ad0){for(var _0x32b628=0x0;_0x32b628<_0xbcad57['body'][_0xeede('0x75')][_0xeede('0x55')];_0x32b628+=0x1){socket[_0xeede('0xbb')](_0xeede('0xbc'),{'UserId':_0xbcad57[_0xeede('0x63')]['ids'][_0x32b628],'MailAccountId':_0xbcad57[_0xeede('0x5d')]['id']});}return _0x1e9ad0;});}})['then'](respondWithResult(_0x5296fd,null))[_0xeede('0x2d')](handleError(_0x5296fd,null));};exports[_0xeede('0xbd')]=function(_0x524e14,_0x2951c6,_0x53eecd){return db['MailAccount'][_0xeede('0x62')]({'where':{'id':_0x524e14[_0xeede('0x5d')]['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x2951c6,null))[_0xeede('0x22')](function(_0x150820){if(_0x150820){return _0x150820['removeAgents'](_0x524e14['query'][_0xeede('0x75')])[_0xeede('0x22')](function(){if(_['isArray'](_0x524e14[_0xeede('0x50')][_0xeede('0x75')])){for(var _0x489f1f=0x0;_0x489f1f<_0x524e14['query'][_0xeede('0x75')][_0xeede('0x55')];_0x489f1f+=0x1){socket[_0xeede('0xbb')](_0xeede('0xbe'),{'UserId':Number(_0x524e14[_0xeede('0x50')][_0xeede('0x75')][_0x489f1f]),'MailAccountId':Number(_0x524e14[_0xeede('0x5d')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x524e14[_0xeede('0x50')][_0xeede('0x75')]),'MailAccountId':Number(_0x524e14[_0xeede('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x2951c6,null))[_0xeede('0x2d')](handleError(_0x2951c6,null));};exports['getAgents']=function(_0x41e9cc,_0x368ea1,_0x3da8e9){var _0x38af4d={};var _0x36607f={};var _0x5b7b76;var _0x3600cf;return db[_0xeede('0x5f')]['findOne']({'where':{'id':_0x41e9cc['params']['id']}})[_0xeede('0x22')](handleEntityNotFound(_0x368ea1,null))[_0xeede('0x22')](function(_0x10376a){if(_0x10376a){_0x5b7b76=_0x10376a;_0x36607f[_0xeede('0x4e')]=_['keys'](db[_0xeede('0x90')][_0xeede('0x60')]);_0x36607f[_0xeede('0x50')]=_['keys'](_0x41e9cc[_0xeede('0x50')]);_0x36607f[_0xeede('0x51')]=_['intersection'](_0x36607f[_0xeede('0x4e')],_0x36607f[_0xeede('0x50')]);_0x38af4d[_0xeede('0x53')]=_[_0xeede('0x52')](_0x36607f[_0xeede('0x4e')],qs[_0xeede('0x54')](_0x41e9cc['query'][_0xeede('0x54')]));_0x38af4d[_0xeede('0x53')]=_0x38af4d[_0xeede('0x53')][_0xeede('0x55')]?_0x38af4d['attributes']:_0x36607f[_0xeede('0x4e')];_0x38af4d[_0xeede('0x56')]=qs['sort'](_0x41e9cc[_0xeede('0x50')][_0xeede('0x6d')]);_0x38af4d[_0xeede('0x57')]=qs[_0xeede('0x51')](_[_0xeede('0x6e')](_0x41e9cc[_0xeede('0x50')],_0x36607f[_0xeede('0x51')]));if(_0x41e9cc[_0xeede('0x50')][_0xeede('0x59')]){_0x38af4d[_0xeede('0x57')]=_[_0xeede('0x40')](_0x38af4d[_0xeede('0x57')],{'$or':_[_0xeede('0x4b')](_0x38af4d['attributes'],function(_0x54f4cb){var _0x59b9a7={};_0x59b9a7[_0x54f4cb]={'$like':'%'+_0x41e9cc[_0xeede('0x50')]['filter']+'%'};return _0x59b9a7;})});}_0x38af4d=_[_0xeede('0x40')]({},_0x38af4d,_0x41e9cc['options']);return _0x5b7b76['getAgents'](_0x38af4d);}})[_0xeede('0x22')](function(_0x41fc99){if(_0x41fc99){_0x3600cf=_0x41fc99[_0xeede('0x55')];if(!_0x41e9cc[_0xeede('0x50')][_0xeede('0x6b')](_0xeede('0x6c'))){_0x38af4d[_0xeede('0x33')]=qs[_0xeede('0x33')](_0x41e9cc[_0xeede('0x50')][_0xeede('0x33')]);_0x38af4d[_0xeede('0x31')]=qs['offset'](_0x41e9cc[_0xeede('0x50')][_0xeede('0x31')]);}return _0x5b7b76[_0xeede('0xbf')](_0x38af4d);}})[_0xeede('0x22')](function(_0x48f67d){if(_0x48f67d){return _0x48f67d?{'count':_0x3600cf,'rows':_0x48f67d}:null;}})[_0xeede('0x22')](respondWithResult(_0x368ea1,null))[_0xeede('0x2d')](handleError(_0x368ea1,null));}; \ No newline at end of file +var _0x11d5=['sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','destroy','then','MailAccounts','UserProfileResource','name','send','render','interaction','account','index','MailServerIn','Imap','MailServerOut','Pause','MailAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','mandatoryDispositionPause','length','options','find','catch','update','body','params','Smtp','describe','MailAccountId','create','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','isNil','active','description','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','DESC','from','%s\x20<%s>','attachments','join','basename','secure','List\x20not\x20found','Contacts','defaults','ListId','messageId','subject','attach','out','Interaction','Messages','auth','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x32f6ba,_0x118125){var _0x589cd0=function(_0x19ea17){while(--_0x19ea17){_0x32f6ba['push'](_0x32f6ba['shift']());}};_0x589cd0(++_0x118125);}(_0x11d5,0x162));var _0x511d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x11d5[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x511d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x511d('0x1'));var jsonpatch=require(_0x511d('0x2'));var rp=require(_0x511d('0x3'));var moment=require(_0x511d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x511d('0x5'));var util=require(_0x511d('0x6'));var path=require('path');var sox=require(_0x511d('0x7'));var csv=require(_0x511d('0x8'));var ejs=require(_0x511d('0x9'));var fs=require('fs');var fs_extra=require(_0x511d('0xa'));var _=require(_0x511d('0xb'));var squel=require(_0x511d('0xc'));var crypto=require(_0x511d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x511d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x511d('0xf'));var Papa=require(_0x511d('0x10'));var htmlToText=require('html-to-text');var juice=require('juice');var Redis=require(_0x511d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x511d('0x12'));var as=require(_0x511d('0x13'));var hardwareService=require(_0x511d('0x14'));var logger=require('../../config/logger')(_0x511d('0x15'));var utils=require('../../config/utils');var config=require(_0x511d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x511d('0x17'))['db'];config['redis']=_['defaults'](config[_0x511d('0x18')],{'host':_0x511d('0x19'),'port':0x18eb});var socket=require(_0x511d('0x1a'))(new Redis(config[_0x511d('0x18')]));require(_0x511d('0x1b'))['register'](socket);var jayson=require(_0x511d('0x1c'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x2abfcc,_0x45fe62,_0x1263c3,_0x5cae1c){return new BPromise(function(_0x1af599,_0x393c97){var _0x10e526=_0x5cae1c||client;return _0x10e526[_0x511d('0x1d')](_0x2abfcc,_0x1263c3)['then'](function(_0x442061){logger[_0x511d('0x1e')](_0x511d('0x1f'),_0x45fe62,_0x511d('0x20'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x45fe62,'request\x20sent',JSON[_0x511d('0x21')](_0x442061));if(_0x442061[_0x511d('0x22')]){if(_0x442061[_0x511d('0x22')]['code']===0x1f4){logger['error'](_0x511d('0x1f'),_0x45fe62,_0x442061[_0x511d('0x22')][_0x511d('0x23')]);return _0x393c97(_0x442061['error'][_0x511d('0x23')]);}logger[_0x511d('0x22')]('MailAccount,\x20%s,\x20%s',_0x45fe62,_0x442061[_0x511d('0x22')][_0x511d('0x23')]);return _0x1af599(_0x442061[_0x511d('0x22')][_0x511d('0x23')]);}else{logger[_0x511d('0x1e')](_0x511d('0x1f'),_0x45fe62,_0x511d('0x20'));_0x1af599(_0x442061['result'][_0x511d('0x23')]);}})['catch'](function(_0x383fff){logger[_0x511d('0x22')](_0x511d('0x1f'),_0x45fe62,_0x383fff);_0x393c97(_0x383fff);});});}function respondWithStatusCode(_0x17d451,_0x30b977){_0x30b977=_0x30b977||0xcc;return function(_0xae7d12){if(_0xae7d12){return _0x17d451[_0x511d('0x24')](_0x30b977);}return _0x17d451[_0x511d('0x25')](_0x30b977)[_0x511d('0x26')]();};}function respondWithResult(_0x3a2943,_0x376d18){_0x376d18=_0x376d18||0xc8;return function(_0x1c37d3){if(_0x1c37d3){return _0x3a2943[_0x511d('0x25')](_0x376d18)[_0x511d('0x27')](_0x1c37d3);}};}function respondWithFilteredResult(_0x5cd917,_0x4902f2){return function(_0x3b0735){if(_0x3b0735){var _0x8c3e30=typeof _0x4902f2[_0x511d('0x28')]==='undefined'&&typeof _0x4902f2[_0x511d('0x29')]===_0x511d('0x2a');var _0x861520=_0x3b0735[_0x511d('0x2b')];var _0x4fa9c5=_0x8c3e30?0x0:_0x4902f2[_0x511d('0x28')];var _0xfa0d60=_0x8c3e30?_0x3b0735[_0x511d('0x2b')]:_0x4902f2[_0x511d('0x28')]+_0x4902f2[_0x511d('0x29')];var _0x5ebfc1;if(_0xfa0d60>=_0x861520){_0xfa0d60=_0x861520;_0x5ebfc1=0xc8;}else{_0x5ebfc1=0xce;}_0x5cd917['status'](_0x5ebfc1);return _0x5cd917[_0x511d('0x2c')]('Content-Range',_0x4fa9c5+'-'+_0xfa0d60+'/'+_0x861520)[_0x511d('0x27')](_0x3b0735);}return null;};}function patchUpdates(_0xf7ffb6){return function(_0x551e90){try{jsonpatch[_0x511d('0x2d')](_0x551e90,_0xf7ffb6,!![]);}catch(_0x34e2d9){return BPromise[_0x511d('0x2e')](_0x34e2d9);}return _0x551e90['save']();};}function saveUpdates(_0x4e89ee,_0x259357){return function(_0x104a74){if(_0x104a74){return _0x104a74['update'](_0x4e89ee)['then'](function(_0x374713){return _0x374713;});}return null;};}function removeEntity(_0x4ef69c,_0x28b466){return function(_0x2733f2){if(_0x2733f2){return _0x2733f2[_0x511d('0x2f')]()[_0x511d('0x30')](function(){var _0x46a799=_0x2733f2['get']({'plain':!![]});var _0x1b6054=_0x511d('0x31');return db[_0x511d('0x32')][_0x511d('0x2f')]({'where':{'type':_0x1b6054,'resourceId':_0x46a799['id']}})[_0x511d('0x30')](function(){return _0x2733f2;});})['then'](function(){_0x4ef69c[_0x511d('0x25')](0xcc)[_0x511d('0x26')]();});}};}function handleEntityNotFound(_0x3d5ca5,_0x26f4f8){return function(_0x1278d2){if(!_0x1278d2){_0x3d5ca5['sendStatus'](0x194);}return _0x1278d2;};}function handleError(_0x4f66fe,_0x5c3f82){_0x5c3f82=_0x5c3f82||0x1f4;return function(_0x59de68){logger[_0x511d('0x22')](_0x59de68['stack']);if(_0x59de68['name']){delete _0x59de68[_0x511d('0x33')];}_0x4f66fe[_0x511d('0x25')](_0x5c3f82)[_0x511d('0x34')](_0x59de68);};}function getMustacheRender(_0x247dd0,_0x561a94){return Mustache[_0x511d('0x35')](_0x247dd0,_['merge'](_0x561a94['body'],{'contact':_0x561a94['contact'],'message':_0x561a94[_0x511d('0x23')],'agent':_0x561a94['agent'],'interaction':_0x561a94[_0x511d('0x36')],'account':_0x561a94[_0x511d('0x37')]}))||'';}exports[_0x511d('0x38')]=function(_0x35129e,_0x4824f4){var _0x16b9fe={'include':[{'model':db[_0x511d('0x39')],'as':_0x511d('0x3a')},{'model':db[_0x511d('0x3b')],'as':'Smtp'},{'model':db[_0x511d('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4eb932={},_0x415d62={'count':0x0,'rows':[]};var _0x1035c6=_['map'](db[_0x511d('0x3d')][_0x511d('0x3e')],function(_0x4bedfa){return{'name':_0x4bedfa[_0x511d('0x3f')],'type':_0x4bedfa[_0x511d('0x40')][_0x511d('0x41')]};});_0x4eb932[_0x511d('0x42')]=_[_0x511d('0x43')](_0x1035c6,_0x511d('0x33'));_0x4eb932[_0x511d('0x44')]=_[_0x511d('0x45')](_0x35129e[_0x511d('0x44')]);_0x4eb932[_0x511d('0x46')]=_[_0x511d('0x47')](_0x4eb932[_0x511d('0x42')],_0x4eb932[_0x511d('0x44')]);_0x16b9fe[_0x511d('0x48')]=_[_0x511d('0x47')](_0x4eb932[_0x511d('0x42')],qs[_0x511d('0x49')](_0x35129e[_0x511d('0x44')][_0x511d('0x49')]));_0x16b9fe[_0x511d('0x48')]=_0x16b9fe[_0x511d('0x48')]['length']?_0x16b9fe[_0x511d('0x48')]:_0x4eb932[_0x511d('0x42')];if(!_0x35129e[_0x511d('0x44')][_0x511d('0x4a')](_0x511d('0x4b'))){_0x16b9fe[_0x511d('0x29')]=qs[_0x511d('0x29')](_0x35129e[_0x511d('0x44')][_0x511d('0x29')]);_0x16b9fe[_0x511d('0x28')]=qs['offset'](_0x35129e[_0x511d('0x44')][_0x511d('0x28')]);}_0x16b9fe[_0x511d('0x4c')]=qs['sort'](_0x35129e['query'][_0x511d('0x4d')]);_0x16b9fe['where']=qs[_0x511d('0x46')](_[_0x511d('0x4e')](_0x35129e[_0x511d('0x44')],_0x4eb932[_0x511d('0x46')]),_0x1035c6);if(_0x35129e[_0x511d('0x44')][_0x511d('0x4f')]){_0x16b9fe[_0x511d('0x50')]=_[_0x511d('0x51')](_0x16b9fe['where'],{'$or':_[_0x511d('0x43')](_0x1035c6,function(_0x3a1515){if(_0x3a1515[_0x511d('0x40')]!==_0x511d('0x52')){var _0x4d426f={};_0x4d426f[_0x3a1515[_0x511d('0x33')]]={'$like':'%'+_0x35129e[_0x511d('0x44')][_0x511d('0x4f')]+'%'};return _0x4d426f;}})});}_0x16b9fe=_[_0x511d('0x51')]({},_0x16b9fe,_0x35129e['options']);var _0x10be46={'where':_0x16b9fe['where']};return db[_0x511d('0x3d')][_0x511d('0x2b')](_0x10be46)[_0x511d('0x30')](function(_0x1bb6a5){_0x415d62[_0x511d('0x2b')]=_0x1bb6a5;if(_0x35129e[_0x511d('0x44')][_0x511d('0x53')]){_0x16b9fe[_0x511d('0x54')]=[{'all':!![]}];}return db[_0x511d('0x3d')]['findAll'](_0x16b9fe);})[_0x511d('0x30')](function(_0xcb6e16){_0x415d62[_0x511d('0x55')]=_0xcb6e16;return _0x415d62;})[_0x511d('0x30')](respondWithFilteredResult(_0x4824f4,_0x16b9fe))['catch'](handleError(_0x4824f4,null));};exports[_0x511d('0x56')]=function(_0x105d8f,_0x1c5468){var _0x479491={'raw':![],'where':{'id':_0x105d8f['params']['id']},'include':[{'model':db[_0x511d('0x39')],'as':_0x511d('0x3a')},{'model':db[_0x511d('0x3b')],'as':'Smtp'},{'model':db[_0x511d('0x3c')],'as':_0x511d('0x57')}]},_0x46191b={};_0x46191b[_0x511d('0x42')]=_[_0x511d('0x45')](db[_0x511d('0x3d')][_0x511d('0x3e')]);_0x46191b['query']=_[_0x511d('0x45')](_0x105d8f[_0x511d('0x44')]);_0x46191b[_0x511d('0x46')]=_[_0x511d('0x47')](_0x46191b[_0x511d('0x42')],_0x46191b[_0x511d('0x44')]);_0x479491['attributes']=_[_0x511d('0x47')](_0x46191b[_0x511d('0x42')],qs[_0x511d('0x49')](_0x105d8f['query'][_0x511d('0x49')]));_0x479491[_0x511d('0x48')]=_0x479491['attributes'][_0x511d('0x58')]?_0x479491[_0x511d('0x48')]:_0x46191b[_0x511d('0x42')];if(_0x105d8f[_0x511d('0x44')][_0x511d('0x53')]){_0x479491[_0x511d('0x54')]=[{'all':!![]}];}_0x479491=_['merge']({},_0x479491,_0x105d8f[_0x511d('0x59')]);return db[_0x511d('0x3d')][_0x511d('0x5a')](_0x479491)[_0x511d('0x30')](handleEntityNotFound(_0x1c5468,null))['then'](respondWithResult(_0x1c5468,null))[_0x511d('0x5b')](handleError(_0x1c5468,null));};exports[_0x511d('0x5c')]=function(_0x4a7986,_0x526cb6){if(_0x4a7986[_0x511d('0x5d')]['id']){delete _0x4a7986['body']['id'];}return db['MailAccount'][_0x511d('0x5a')]({'where':{'id':_0x4a7986[_0x511d('0x5e')]['id']},'include':[{'model':db[_0x511d('0x39')],'as':'Imap'},{'model':db[_0x511d('0x3b')],'as':_0x511d('0x5f')},{'model':db[_0x511d('0x3c')],'as':_0x511d('0x57')}]})[_0x511d('0x30')](handleEntityNotFound(_0x526cb6,null))[_0x511d('0x30')](saveUpdates(_0x4a7986[_0x511d('0x5d')],null))['then'](function(_0x14f761){if(_0x14f761&&_0x4a7986[_0x511d('0x5d')][_0x511d('0x3a')]){return db[_0x511d('0x39')][_0x511d('0x5c')](_0x4a7986[_0x511d('0x5d')][_0x511d('0x3a')],{'where':{'MailAccountId':_0x14f761['id']}})[_0x511d('0x30')](function(){return _0x14f761;});}return _0x14f761;})[_0x511d('0x30')](function(_0x15caa8){if(_0x15caa8&&_0x4a7986[_0x511d('0x5d')][_0x511d('0x5f')]){return db[_0x511d('0x3b')][_0x511d('0x5c')](_0x4a7986['body'][_0x511d('0x5f')],{'where':{'MailAccountId':_0x15caa8['id']}})[_0x511d('0x30')](function(){return _0x15caa8;});}return _0x15caa8;})['then'](respondWithResult(_0x526cb6,null))[_0x511d('0x5b')](handleError(_0x526cb6,null));};exports['describe']=function(_0x5d3dba,_0xfa85f1){return db['MailAccount'][_0x511d('0x60')]()[_0x511d('0x30')](respondWithResult(_0xfa85f1,null))[_0x511d('0x5b')](handleError(_0xfa85f1,null));};exports['addDisposition']=function(_0x138fa0,_0x4bb4f7,_0x38455a){if(_0x138fa0[_0x511d('0x5d')]['id']){delete _0x138fa0['body']['id'];}return db['MailAccount'][_0x511d('0x5a')]({'where':{'id':_0x138fa0[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x4bb4f7,null))[_0x511d('0x30')](function(_0x5ceb23){if(_0x5ceb23){_0x138fa0[_0x511d('0x5d')][_0x511d('0x61')]=_0x5ceb23['id'];return db['Disposition'][_0x511d('0x62')](_0x138fa0['body']);}})[_0x511d('0x30')](respondWithResult(_0x4bb4f7,null))[_0x511d('0x5b')](handleError(_0x4bb4f7,null));};exports[_0x511d('0x63')]=function(_0x30a084,_0x2cdff9,_0xacb206){var _0x3e29e2={'raw':![],'where':{}};var _0x44d818={};var _0x4b2394={'count':0x0,'rows':[]};return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x30a084[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x2cdff9,null))[_0x511d('0x30')](function(_0x54fe7b){if(_0x54fe7b){_0x44d818[_0x511d('0x42')]=_[_0x511d('0x45')](db[_0x511d('0x65')][_0x511d('0x3e')]);_0x44d818[_0x511d('0x44')]=_[_0x511d('0x45')](_0x30a084[_0x511d('0x44')]);_0x44d818[_0x511d('0x46')]=_['intersection'](_0x44d818[_0x511d('0x42')],_0x44d818[_0x511d('0x44')]);_0x3e29e2[_0x511d('0x48')]=_['intersection'](_0x44d818[_0x511d('0x42')],qs[_0x511d('0x49')](_0x30a084[_0x511d('0x44')][_0x511d('0x49')]));_0x3e29e2['attributes']=_0x3e29e2[_0x511d('0x48')]['length']?_0x3e29e2[_0x511d('0x48')]:_0x44d818['model'];if(!_0x30a084[_0x511d('0x44')]['hasOwnProperty'](_0x511d('0x4b'))){_0x3e29e2[_0x511d('0x29')]=qs['limit'](_0x30a084['query'][_0x511d('0x29')]);_0x3e29e2['offset']=qs[_0x511d('0x28')](_0x30a084['query'][_0x511d('0x28')]);}_0x3e29e2['order']=qs[_0x511d('0x4d')](_0x30a084[_0x511d('0x44')]['sort']);_0x3e29e2[_0x511d('0x50')]=qs['filters'](_[_0x511d('0x4e')](_0x30a084['query'],_0x44d818[_0x511d('0x46')]));_0x3e29e2[_0x511d('0x50')][_0x511d('0x61')]=_0x54fe7b['id'];if(_0x30a084[_0x511d('0x44')]['filter']){_0x3e29e2[_0x511d('0x50')]=_[_0x511d('0x51')](_0x3e29e2[_0x511d('0x50')],{'$or':_[_0x511d('0x43')](_0x3e29e2[_0x511d('0x48')],function(_0x56f66a){var _0x1981dc={};_0x1981dc[_0x56f66a]={'$like':'%'+_0x30a084[_0x511d('0x44')]['filter']+'%'};return _0x1981dc;})});}_0x3e29e2=_[_0x511d('0x51')]({},_0x3e29e2,_0x30a084[_0x511d('0x59')]);return db['Disposition']['count']({'where':_0x3e29e2[_0x511d('0x50')]})[_0x511d('0x30')](function(_0x2dff58){_0x4b2394[_0x511d('0x2b')]=_0x2dff58;if(_0x30a084[_0x511d('0x44')][_0x511d('0x53')]){_0x3e29e2[_0x511d('0x54')]=[{'all':!![]}];}return db[_0x511d('0x65')][_0x511d('0x66')](_0x3e29e2);})[_0x511d('0x30')](function(_0x4dce23){_0x4b2394[_0x511d('0x55')]=_0x4dce23;return _0x4b2394;});}})[_0x511d('0x30')](respondWithFilteredResult(_0x2cdff9,_0x3e29e2))[_0x511d('0x5b')](handleError(_0x2cdff9,null));};exports[_0x511d('0x67')]=function(_0x3f1fbf,_0x432a35,_0xe974cd){return db[_0x511d('0x3d')]['find']({'where':{'id':_0x3f1fbf[_0x511d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x432a35,null))[_0x511d('0x30')](function(_0x2b0a22){if(_0x2b0a22){return _0x2b0a22[_0x511d('0x67')](_0x3f1fbf[_0x511d('0x44')][_0x511d('0x68')]);}})['then'](respondWithStatusCode(_0x432a35,null))[_0x511d('0x5b')](handleError(_0x432a35,null));};exports[_0x511d('0x69')]=function(_0x355a47,_0x4195ce,_0x555ea3){if(_0x355a47[_0x511d('0x5d')]['id']){delete _0x355a47[_0x511d('0x5d')]['id'];}return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x355a47[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x4195ce,null))[_0x511d('0x30')](function(_0x240d27){if(_0x240d27){_0x355a47[_0x511d('0x5d')][_0x511d('0x61')]=_0x240d27['id'];return db[_0x511d('0x6a')][_0x511d('0x62')](_0x355a47[_0x511d('0x5d')]);}})[_0x511d('0x30')](respondWithResult(_0x4195ce,null))['catch'](handleError(_0x4195ce,null));};exports['getAnswers']=function(_0x1a8d18,_0x344872,_0x4e5014){var _0x47430a={'raw':![],'where':{}};var _0xa18abc={};var _0x527c79={'count':0x0,'rows':[]};return db['MailAccount'][_0x511d('0x64')]({'where':{'id':_0x1a8d18['params']['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x344872,null))[_0x511d('0x30')](function(_0x18ac7d){if(_0x18ac7d){_0xa18abc[_0x511d('0x42')]=_[_0x511d('0x45')](db['CannedAnswer'][_0x511d('0x3e')]);_0xa18abc['query']=_[_0x511d('0x45')](_0x1a8d18[_0x511d('0x44')]);_0xa18abc[_0x511d('0x46')]=_['intersection'](_0xa18abc[_0x511d('0x42')],_0xa18abc[_0x511d('0x44')]);_0x47430a[_0x511d('0x48')]=_[_0x511d('0x47')](_0xa18abc[_0x511d('0x42')],qs[_0x511d('0x49')](_0x1a8d18[_0x511d('0x44')]['fields']));_0x47430a[_0x511d('0x48')]=_0x47430a[_0x511d('0x48')][_0x511d('0x58')]?_0x47430a[_0x511d('0x48')]:_0xa18abc[_0x511d('0x42')];if(!_0x1a8d18['query'][_0x511d('0x4a')](_0x511d('0x4b'))){_0x47430a[_0x511d('0x29')]=qs[_0x511d('0x29')](_0x1a8d18['query']['limit']);_0x47430a['offset']=qs['offset'](_0x1a8d18[_0x511d('0x44')][_0x511d('0x28')]);}_0x47430a[_0x511d('0x4c')]=qs[_0x511d('0x4d')](_0x1a8d18[_0x511d('0x44')][_0x511d('0x4d')]);_0x47430a[_0x511d('0x50')]=qs[_0x511d('0x46')](_[_0x511d('0x4e')](_0x1a8d18['query'],_0xa18abc[_0x511d('0x46')]));_0x47430a[_0x511d('0x50')]['MailAccountId']=_0x18ac7d['id'];if(_0x1a8d18[_0x511d('0x44')][_0x511d('0x4f')]){_0x47430a[_0x511d('0x50')]=_[_0x511d('0x51')](_0x47430a[_0x511d('0x50')],{'$or':_[_0x511d('0x43')](_0x47430a[_0x511d('0x48')],function(_0xde16dc){var _0xb9e3b={};_0xb9e3b[_0xde16dc]={'$like':'%'+_0x1a8d18[_0x511d('0x44')][_0x511d('0x4f')]+'%'};return _0xb9e3b;})});}_0x47430a=_[_0x511d('0x51')]({},_0x47430a,_0x1a8d18[_0x511d('0x59')]);return db[_0x511d('0x6a')][_0x511d('0x2b')]({'where':_0x47430a[_0x511d('0x50')]})[_0x511d('0x30')](function(_0x1c76f6){_0x527c79[_0x511d('0x2b')]=_0x1c76f6;if(_0x1a8d18[_0x511d('0x44')][_0x511d('0x53')]){_0x47430a[_0x511d('0x54')]=[{'all':!![]}];}return db[_0x511d('0x6a')][_0x511d('0x66')](_0x47430a);})[_0x511d('0x30')](function(_0x41cbee){_0x527c79['rows']=_0x41cbee;return _0x527c79;});}})[_0x511d('0x30')](respondWithFilteredResult(_0x344872,_0x47430a))[_0x511d('0x5b')](handleError(_0x344872,null));};exports[_0x511d('0x6b')]=function(_0x4cc405,_0x580e04,_0x460a0c){return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x4cc405['params']['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x580e04,null))[_0x511d('0x30')](function(_0x126257){if(_0x126257){return _0x126257[_0x511d('0x6b')](_0x4cc405[_0x511d('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x580e04,null))[_0x511d('0x5b')](handleError(_0x580e04,null));};exports[_0x511d('0x62')]=function(_0x1f4f52,_0x1517f7){var _0x24c0ba={'name':_0x1f4f52['body']['name'],'key':_0x1f4f52['body'][_0x511d('0x41')],'email':_0x1f4f52[_0x511d('0x5d')][_0x511d('0x6c')],'ListId':_0x1f4f52[_0x511d('0x5d')]['ListId'],'active':!_[_0x511d('0x6d')](_0x1f4f52[_0x511d('0x5d')][_0x511d('0x6e')])?_0x1f4f52['body'][_0x511d('0x6e')]:!![],'description':_0x1f4f52[_0x511d('0x5d')][_0x511d('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0x511d('0x6d')](_0x1f4f52[_0x511d('0x5d')][_0x511d('0x70')])){if(_0x1f4f52[_0x511d('0x5d')][_0x511d('0x71')]){_0x24c0ba[_0x511d('0x3a')][_0x511d('0x72')]=_0x24c0ba[_0x511d('0x5f')][_0x511d('0x72')]=_0x1f4f52[_0x511d('0x5d')][_0x511d('0x73')];_0x24c0ba[_0x511d('0x3a')]['password']=_0x24c0ba[_0x511d('0x5f')]['pass']=_0x1f4f52['body'][_0x511d('0x74')];}else{_0x24c0ba['Imap']['authentication']=_0x24c0ba[_0x511d('0x5f')][_0x511d('0x75')]=![];}_0x24c0ba[_0x511d('0x3a')][_0x511d('0x76')]=_0x1f4f52[_0x511d('0x5d')][_0x511d('0x3a')][_0x511d('0x76')];_0x24c0ba[_0x511d('0x3a')][_0x511d('0x77')]=_0x1f4f52[_0x511d('0x5d')][_0x511d('0x3a')][_0x511d('0x77')];_0x24c0ba['Smtp'][_0x511d('0x76')]=_0x1f4f52[_0x511d('0x5d')][_0x511d('0x5f')][_0x511d('0x76')];_0x24c0ba['Smtp'][_0x511d('0x77')]=_0x1f4f52['body']['Smtp']['port'];}else{_0x24c0ba[_0x511d('0x3a')][_0x511d('0x78')]=_0x24c0ba[_0x511d('0x5f')]['service']=_0x1f4f52[_0x511d('0x5d')][_0x511d('0x70')];_0x24c0ba[_0x511d('0x3a')][_0x511d('0x72')]=_0x24c0ba[_0x511d('0x5f')][_0x511d('0x72')]=_0x1f4f52[_0x511d('0x5d')][_0x511d('0x73')];_0x24c0ba[_0x511d('0x3a')][_0x511d('0x79')]=_0x24c0ba['Smtp'][_0x511d('0x7a')]=_0x1f4f52['body'][_0x511d('0x74')];}return db[_0x511d('0x3d')][_0x511d('0x62')](_0x24c0ba,{'include':[{'model':db[_0x511d('0x3b')],'as':_0x511d('0x5f')},{'model':db[_0x511d('0x39')],'as':_0x511d('0x3a')}]})[_0x511d('0x30')](function(_0x158fc7){var _0x32575b=_0x1f4f52['user'][_0x511d('0x7b')]({'plain':!![]});if(!_0x32575b)throw new Error(_0x511d('0x7c'));if(_0x32575b[_0x511d('0x7d')]===_0x511d('0x72')){var _0x4e66a7=_0x158fc7[_0x511d('0x7b')]({'plain':!![]});return db['UserProfileSection'][_0x511d('0x5a')]({'where':{'name':'MailAccounts','userProfileId':_0x32575b[_0x511d('0x7e')]},'raw':!![]})[_0x511d('0x30')](function(_0x4ce844){if(_0x4ce844&&_0x4ce844[_0x511d('0x7f')]===0x0){return db[_0x511d('0x32')][_0x511d('0x62')]({'name':_0x4e66a7[_0x511d('0x33')],'resourceId':_0x4e66a7['id'],'type':_0x4ce844[_0x511d('0x33')],'sectionId':_0x4ce844['id']},{})[_0x511d('0x30')](function(){return _0x158fc7;});}else{return _0x158fc7;}})[_0x511d('0x5b')](function(_0x2e01c2){logger[_0x511d('0x22')](_0x511d('0x80'),_0x2e01c2);throw _0x2e01c2;});}return _0x158fc7;})[_0x511d('0x30')](respondWithResult(_0x1517f7,0xc9))[_0x511d('0x5b')](handleError(_0x1517f7,null));};exports['getImap']=function(_0x4c5f16,_0x490a88,_0x1991d0){return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x4c5f16[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x490a88,null))[_0x511d('0x30')](function(_0xbf9fde){if(_0xbf9fde){return _0xbf9fde[_0x511d('0x81')]();}return null;})[_0x511d('0x30')](respondWithResult(_0x490a88,null))[_0x511d('0x5b')](handleError(_0x490a88,null));};exports[_0x511d('0x82')]=function(_0x1ab8a6,_0xc690c2,_0x468142){if(_0x1ab8a6[_0x511d('0x5d')]['id']){delete _0x1ab8a6['body']['id'];}return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x1ab8a6[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0xc690c2,null))['then'](function(_0x3f07c5){if(_0x3f07c5){_0x1ab8a6[_0x511d('0x5d')][_0x511d('0x61')]=_0x3f07c5['id'];return db[_0x511d('0x39')]['create'](_0x1ab8a6[_0x511d('0x5d')]);}})[_0x511d('0x30')](respondWithResult(_0xc690c2,null))['catch'](handleError(_0xc690c2,null));};exports[_0x511d('0x83')]=function(_0x5372c0,_0x5a2113,_0x4cbabf){return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x5372c0[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x5a2113,null))[_0x511d('0x30')](function(_0x16f427){if(_0x16f427){return _0x16f427['setImap'](null);}return null;})[_0x511d('0x30')](respondWithStatusCode(_0x5a2113,null))[_0x511d('0x5b')](handleError(_0x5a2113,null));};exports[_0x511d('0x84')]=function(_0x3a0a82,_0x1c4ba1,_0x1c3e31){return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x3a0a82[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x1c4ba1,null))[_0x511d('0x30')](function(_0x78200){if(_0x78200){return _0x78200[_0x511d('0x84')]();}return null;})['then'](respondWithResult(_0x1c4ba1,null))[_0x511d('0x5b')](handleError(_0x1c4ba1,null));};exports['addSmtp']=function(_0x1885b9,_0x12788c,_0x38edc7){if(_0x1885b9['body']['id']){delete _0x1885b9[_0x511d('0x5d')]['id'];}return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x1885b9[_0x511d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x12788c,null))[_0x511d('0x30')](function(_0x117194){if(_0x117194){_0x1885b9[_0x511d('0x5d')][_0x511d('0x61')]=_0x117194['id'];return db['MailServerOut']['create'](_0x1885b9[_0x511d('0x5d')]);}})[_0x511d('0x30')](respondWithResult(_0x12788c,null))[_0x511d('0x5b')](handleError(_0x12788c,null));};exports['removeSmtp']=function(_0x32dbcf,_0x62dea1,_0x1225b0){return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x32dbcf[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x62dea1,null))['then'](function(_0x191916){if(_0x191916){return _0x191916[_0x511d('0x85')](null);}return null;})[_0x511d('0x30')](respondWithStatusCode(_0x62dea1,null))[_0x511d('0x5b')](handleError(_0x62dea1,null));};exports[_0x511d('0x86')]=function(_0x4287a8,_0x30a1c9,_0x4004d8){return db[_0x511d('0x87')][_0x511d('0x5a')]({'where':{'id':_0x4287a8[_0x511d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x30a1c9,null))['then'](function(_0x12957e){if(_0x12957e){return _0x12957e[_0x511d('0x86')](_0x4287a8['body']['ids'],_['omit'](_0x4287a8[_0x511d('0x5d')],['ids','id'])||{});}})[_0x511d('0x30')](respondWithResult(_0x30a1c9,null))[_0x511d('0x5b')](handleError(_0x30a1c9,null));};exports[_0x511d('0x88')]=function(_0x1d5785,_0x50cfa3,_0x3e586d){var _0x50ab73={'raw':![],'where':{}};var _0x38aff1={};var _0x3267ce={'count':0x0,'rows':[]};return db['MailAccount'][_0x511d('0x64')]({'where':{'id':_0x1d5785[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x50cfa3,null))['then'](function(_0x5e74b7){if(_0x5e74b7){_0x38aff1[_0x511d('0x42')]=_[_0x511d('0x45')](db[_0x511d('0x87')]['rawAttributes']);_0x38aff1[_0x511d('0x44')]=_[_0x511d('0x45')](_0x1d5785[_0x511d('0x44')]);_0x38aff1['filters']=_['intersection'](_0x38aff1[_0x511d('0x42')],_0x38aff1[_0x511d('0x44')]);_0x50ab73[_0x511d('0x48')]=_['intersection'](_0x38aff1[_0x511d('0x42')],qs[_0x511d('0x49')](_0x1d5785['query'][_0x511d('0x49')]));_0x50ab73[_0x511d('0x48')]=_0x50ab73[_0x511d('0x48')][_0x511d('0x58')]?_0x50ab73[_0x511d('0x48')]:_0x38aff1[_0x511d('0x42')];if(!_0x1d5785[_0x511d('0x44')][_0x511d('0x4a')](_0x511d('0x4b'))){_0x50ab73[_0x511d('0x29')]=qs['limit'](_0x1d5785[_0x511d('0x44')][_0x511d('0x29')]);_0x50ab73[_0x511d('0x28')]=qs[_0x511d('0x28')](_0x1d5785[_0x511d('0x44')][_0x511d('0x28')]);}_0x50ab73[_0x511d('0x4c')]=qs[_0x511d('0x4d')](_0x1d5785['query'][_0x511d('0x4d')]);_0x50ab73[_0x511d('0x50')]=qs[_0x511d('0x46')](_[_0x511d('0x4e')](_0x1d5785[_0x511d('0x44')],_0x38aff1[_0x511d('0x46')]));_0x50ab73[_0x511d('0x50')][_0x511d('0x61')]=_0x5e74b7['id'];if(_0x1d5785[_0x511d('0x44')]['filter']){_0x50ab73[_0x511d('0x50')]=_[_0x511d('0x51')](_0x50ab73[_0x511d('0x50')],{'$or':_[_0x511d('0x43')](_0x50ab73['attributes'],function(_0x5b64cc){var _0x105558={};_0x105558[_0x5b64cc]={'$like':'%'+_0x1d5785[_0x511d('0x44')]['filter']+'%'};return _0x105558;})});}_0x50ab73=_[_0x511d('0x51')]({},_0x50ab73,_0x1d5785[_0x511d('0x59')]);return db[_0x511d('0x87')]['count']({'where':_0x50ab73[_0x511d('0x50')]})[_0x511d('0x30')](function(_0x28378a){_0x3267ce['count']=_0x28378a;if(_0x1d5785['query'][_0x511d('0x53')]){_0x50ab73[_0x511d('0x54')]=[{'model':db[_0x511d('0x89')],'as':_0x511d('0x8a'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x511d('0x33'),_0x511d('0x8b'),_0x511d('0x8c')],'required':![]},{'model':db[_0x511d('0x8d')],'as':_0x511d('0x8e'),'attributes':['id',_0x511d('0x33'),_0x511d('0x8f')],'where':_0x1d5785[_0x511d('0x44')]['tag']?{'id':_0x1d5785[_0x511d('0x44')][_0x511d('0x90')]}:undefined,'required':_0x1d5785[_0x511d('0x44')]['tag']?!![]:![]}];}return db[_0x511d('0x87')][_0x511d('0x66')](_0x50ab73);})[_0x511d('0x30')](function(_0x164424){_0x3267ce['rows']=_0x164424;return _0x3267ce;});}})[_0x511d('0x30')](respondWithFilteredResult(_0x50cfa3,_0x50ab73))[_0x511d('0x5b')](handleError(_0x50cfa3,null));};exports[_0x511d('0x91')]=function(_0x475eb9,_0x9b719,_0x4dadda){return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x475eb9[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x9b719,null))['then'](function(_0x526654){if(_0x526654){return db[_0x511d('0x92')][_0x511d('0x93')](function(_0x4b5859){return db['MailApplication'][_0x511d('0x2f')]({'where':{'MailAccountId':_0x475eb9['params']['id']},'transaction':_0x4b5859})[_0x511d('0x30')](function(_0x3f1c89){var _0x3e08e8=_['map'](_0x475eb9[_0x511d('0x5d')],function(_0x18eed7){_0x18eed7['MailAccountId']=_0x475eb9[_0x511d('0x5e')]['id'];return _0x18eed7;});return db['MailApplication']['bulkCreate'](_0x3e08e8,{'transaction':_0x4b5859});});})[_0x511d('0x30')](function(){return db[_0x511d('0x94')][_0x511d('0x95')]({'where':{'MailAccountId':_0x475eb9[_0x511d('0x5e')]['id']},'order':_0x511d('0x96')});});}})[_0x511d('0x30')](respondWithResult(_0x9b719,null))[_0x511d('0x5b')](handleError(_0x9b719,null));};exports[_0x511d('0x97')]=function(_0x1de15b,_0xed790e,_0x269553){var _0x4ee395={};var _0x4ffb75={};var _0x3c3a44;var _0x544a4b;return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x1de15b[_0x511d('0x5e')]['id']}})['then'](handleEntityNotFound(_0xed790e,null))[_0x511d('0x30')](function(_0x44b89d){if(_0x44b89d){_0x3c3a44=_0x44b89d;_0x4ffb75[_0x511d('0x42')]=_[_0x511d('0x45')](db[_0x511d('0x94')][_0x511d('0x3e')]);_0x4ffb75[_0x511d('0x44')]=_[_0x511d('0x45')](_0x1de15b['query']);_0x4ffb75[_0x511d('0x46')]=_[_0x511d('0x47')](_0x4ffb75[_0x511d('0x42')],_0x4ffb75['query']);_0x4ee395['attributes']=_[_0x511d('0x47')](_0x4ffb75[_0x511d('0x42')],qs['fields'](_0x1de15b[_0x511d('0x44')][_0x511d('0x49')]));_0x4ee395[_0x511d('0x48')]=_0x4ee395['attributes'][_0x511d('0x58')]?_0x4ee395['attributes']:_0x4ffb75['model'];_0x4ee395[_0x511d('0x4c')]=qs[_0x511d('0x4d')](_0x1de15b[_0x511d('0x44')][_0x511d('0x4d')]);_0x4ee395[_0x511d('0x50')]=qs[_0x511d('0x46')](_[_0x511d('0x4e')](_0x1de15b[_0x511d('0x44')],_0x4ffb75[_0x511d('0x46')]));if(_0x1de15b[_0x511d('0x44')][_0x511d('0x4f')]){_0x4ee395[_0x511d('0x50')]=_[_0x511d('0x51')](_0x4ee395[_0x511d('0x50')],{'$or':_[_0x511d('0x43')](_0x4ee395[_0x511d('0x48')],function(_0x30f5d1){var _0x42b1ae={};_0x42b1ae[_0x30f5d1]={'$like':'%'+_0x1de15b[_0x511d('0x44')][_0x511d('0x4f')]+'%'};return _0x42b1ae;})});}_0x4ee395=_[_0x511d('0x51')]({},_0x4ee395,_0x1de15b[_0x511d('0x59')]);return _0x3c3a44[_0x511d('0x97')](_0x4ee395);}})[_0x511d('0x30')](function(_0x966813){if(_0x966813){_0x544a4b=_0x966813[_0x511d('0x58')];if(!_0x1de15b[_0x511d('0x44')][_0x511d('0x4a')]('nolimit')){_0x4ee395[_0x511d('0x29')]=qs[_0x511d('0x29')](_0x1de15b[_0x511d('0x44')]['limit']);_0x4ee395[_0x511d('0x28')]=qs['offset'](_0x1de15b[_0x511d('0x44')][_0x511d('0x28')]);}return _0x3c3a44[_0x511d('0x97')](_0x4ee395);}})[_0x511d('0x30')](function(_0x4b5022){if(_0x4b5022){return _0x4b5022?{'count':_0x544a4b,'rows':_0x4b5022}:null;}})[_0x511d('0x30')](respondWithResult(_0xed790e,null))[_0x511d('0x5b')](handleError(_0xed790e,null));};exports[_0x511d('0x98')]=function(_0x5a1a97,_0x4e274a,_0x1188d7){var _0x7a423f={'raw':!![],'where':{}};var _0x128ba2={};var _0x26e259={'count':0x0,'rows':[]};return db[_0x511d('0x3d')][_0x511d('0x64')]({'where':{'id':_0x5a1a97['params']['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x4e274a,null))['then'](function(_0x556f5d){if(_0x556f5d){_0x128ba2['model']=_['keys'](db[_0x511d('0x99')][_0x511d('0x3e')]);_0x128ba2['query']=_[_0x511d('0x45')](_0x5a1a97[_0x511d('0x44')]);_0x128ba2[_0x511d('0x46')]=_[_0x511d('0x47')](_0x128ba2['model'],_0x128ba2[_0x511d('0x44')]);_0x7a423f['attributes']=_['intersection'](_0x128ba2[_0x511d('0x42')],qs[_0x511d('0x49')](_0x5a1a97['query'][_0x511d('0x49')]));_0x7a423f['attributes']=_0x7a423f['attributes'][_0x511d('0x58')]?_0x7a423f['attributes']:_0x128ba2[_0x511d('0x42')];if(!_0x5a1a97['query'][_0x511d('0x4a')]('nolimit')){_0x7a423f['limit']=qs[_0x511d('0x29')](_0x5a1a97['query'][_0x511d('0x29')]);_0x7a423f[_0x511d('0x28')]=qs[_0x511d('0x28')](_0x5a1a97[_0x511d('0x44')][_0x511d('0x28')]);}_0x7a423f[_0x511d('0x4c')]=qs[_0x511d('0x4d')](_0x5a1a97[_0x511d('0x44')][_0x511d('0x4d')]);_0x7a423f[_0x511d('0x50')]=qs[_0x511d('0x46')](_['pick'](_0x5a1a97[_0x511d('0x44')],_0x128ba2[_0x511d('0x46')]));_0x7a423f[_0x511d('0x50')][_0x511d('0x61')]=_0x556f5d['id'];if(_0x5a1a97[_0x511d('0x44')][_0x511d('0x4f')]){_0x7a423f[_0x511d('0x50')]=_[_0x511d('0x51')](_0x7a423f[_0x511d('0x50')],{'$or':_['map'](_0x7a423f[_0x511d('0x48')],function(_0x4d0582){var _0x1e5db0={};_0x1e5db0[_0x4d0582]={'$like':'%'+_0x5a1a97[_0x511d('0x44')]['filter']+'%'};return _0x1e5db0;})});}if(_0x5a1a97[_0x511d('0x44')][_0x511d('0x9a')]){var _0x454705=_0x5a1a97[_0x511d('0x44')][_0x511d('0x9a')][_0x511d('0x9b')](',');var _0x2b77a7={};_0x2b77a7[_0x454705[0x0]]={'$gte':moment(_0x454705[0x1])[_0x511d('0x9c')](_0x511d('0x9d'))};_0x7a423f[_0x511d('0x50')]=_[_0x511d('0x51')](_0x7a423f[_0x511d('0x50')],_0x2b77a7);}_0x7a423f=_['merge']({},_0x7a423f,_0x5a1a97['options']);return db[_0x511d('0x99')]['count']({'where':_0x7a423f[_0x511d('0x50')]})['then'](function(_0xc3fc81){_0x26e259[_0x511d('0x2b')]=_0xc3fc81;if(_0x5a1a97['query'][_0x511d('0x53')]){_0x7a423f[_0x511d('0x54')]=[{'all':!![]}];}return db[_0x511d('0x99')]['findAll'](_0x7a423f);})[_0x511d('0x30')](function(_0x29d5da){if(_0x5a1a97['query'][_0x511d('0x9e')]===_0x511d('0x9f')){for(var _0x51319a=0x0;_0x51319a<_0x29d5da[_0x511d('0x58')];_0x51319a++){_0x29d5da[_0x51319a][_0x511d('0x5d')]=juice(_0x29d5da[_0x51319a][_0x511d('0x5d')]);}}_0x26e259['rows']=_0x29d5da;return _0x26e259;});}})['then'](respondWithFilteredResult(_0x4e274a,_0x7a423f))['catch'](handleError(_0x4e274a,null));};exports['send']=function(_0x3fa4a7,_0x5ff1d1,_0x2e5cec){var _0x100cf0,_0x6c559d={},_0x3157f1;if(_0x3fa4a7[_0x511d('0x5d')]['to']){_0x3157f1=_0x3fa4a7[_0x511d('0x5d')]['to']['split'](',')[0x0];}return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x3fa4a7[_0x511d('0x5e')]['id']},'include':[{'model':db[_0x511d('0xa0')],'as':_0x511d('0xa1'),'include':[{'model':db[_0x511d('0x89')],'as':'Contacts','where':{'email':_0x3157f1},'limit':0x1,'order':[[_0x511d('0xa2'),_0x511d('0xa3')]]}]},{'model':db[_0x511d('0x3b')],'as':_0x511d('0x5f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x5ff1d1,null))[_0x511d('0x30')](function(_0x59190a){if(_0x59190a){_0x100cf0=_0x59190a;if(_0x59190a[_0x511d('0x5f')]){if(_[_0x511d('0x6d')](_0x3fa4a7['body'][_0x511d('0xa4')])){_0x3fa4a7['body']['from']=util[_0x511d('0x9c')](_0x511d('0xa5'),_0x59190a[_0x511d('0x33')],_0x59190a['email']||_0x59190a[_0x511d('0x5f')][_0x511d('0x72')]);}if(_0x3fa4a7['body'][_0x511d('0xa6')]&&_0x3fa4a7['body'][_0x511d('0xa6')]['length']){for(var _0x450cf5=0x0;_0x450cf5<_0x3fa4a7[_0x511d('0x5d')]['attachments'][_0x511d('0x58')];_0x450cf5+=0x1){_0x3fa4a7[_0x511d('0x5d')][_0x511d('0xa6')][_0x450cf5]={'filename':_0x3fa4a7[_0x511d('0x5d')][_0x511d('0xa6')][_0x450cf5][_0x511d('0x33')],'path':path[_0x511d('0xa7')](config['root'],'server/files/attachments',_0x3fa4a7[_0x511d('0x5d')][_0x511d('0xa6')][_0x450cf5][_0x511d('0xa8')])};}}var _0x179e70={'tls':{'rejectUnauthorized':![]}};if(_[_0x511d('0x6d')](_0x59190a[_0x511d('0x5f')]['service'])){if(_0x59190a[_0x511d('0x5f')][_0x511d('0x75')]){_0x179e70['auth']={'user':_0x59190a[_0x511d('0x5f')][_0x511d('0x72')],'pass':_0x59190a[_0x511d('0x5f')][_0x511d('0x7a')]};}_0x179e70[_0x511d('0x76')]=_0x59190a[_0x511d('0x5f')][_0x511d('0x76')];_0x179e70[_0x511d('0x77')]=_0x59190a['Smtp'][_0x511d('0x77')];_0x179e70[_0x511d('0xa9')]=_0x59190a[_0x511d('0x5f')][_0x511d('0xa9')];}else{_0x179e70['service']=_0x59190a['Smtp'][_0x511d('0x78')];_0x179e70['auth']={'user':_0x59190a[_0x511d('0x5f')][_0x511d('0x72')],'pass':_0x59190a[_0x511d('0x5f')][_0x511d('0x7a')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x179e70,'message':_0x3fa4a7[_0x511d('0x5d')]});}else{throw new Error(_0x511d('0xaa'));}}})[_0x511d('0x30')](function(_0xa10398){if(_0xa10398){_0x6c559d=_0xa10398;if(_0x100cf0[_0x511d('0xa1')]){if(_0x100cf0[_0x511d('0xa1')][_0x511d('0xab')][_0x511d('0x58')]){return _0x100cf0['List'][_0x511d('0xab')][0x0];}else{return db[_0x511d('0x89')][_0x511d('0x62')](_[_0x511d('0xac')](_0x3fa4a7['body'],{'firstName':_0x3fa4a7[_0x511d('0x5d')]['to'],'email':_0x3fa4a7[_0x511d('0x5d')]['to'],'phone':_0x3fa4a7[_0x511d('0x5d')]['to'],'ListId':_0x100cf0[_0x511d('0xad')]}));}}else{throw new Error(_0x511d('0xaa'));}}})[_0x511d('0x30')](function(_0xfb6ae){if(_0xfb6ae){var _0x2b700f={'UserId':_0x3fa4a7[_0x511d('0x72')]['id'],'ContactId':_0xfb6ae['id'],'MailAccountId':_0x100cf0['id'],'inReplyTo':_0x6c559d[_0x511d('0xae')],'to':_0x3fa4a7[_0x511d('0x5d')]['from'],'cc':_0x3fa4a7[_0x511d('0x5d')]['cc'],'subject':_0x3fa4a7['body'][_0x511d('0xaf')],'attach':_0x3fa4a7[_0x511d('0x5d')][_0x511d('0xb0')],'firstMsgDirection':_0x511d('0xb1'),'lastMsgAt':moment()[_0x511d('0x9c')](_0x511d('0x9d')),'lastMsgDirection':_0x511d('0xb1'),'Messages':[_[_0x511d('0x51')](_0x3fa4a7['body'],{'messageId':_0x6c559d['messageId'],'sentAt':moment()['format'](_0x511d('0x9d')),'read':!![],'MailAccountId':_0x100cf0['id'],'UserId':_0x3fa4a7['user']['id'],'ContactId':_0xfb6ae['id']})]};if(_0x3fa4a7[_0x511d('0x5d')][_0x511d('0xb2')]){_0x2b700f=_[_0x511d('0x51')](_0x2b700f,_0x3fa4a7['body'][_0x511d('0xb2')]);}return db[_0x511d('0x87')][_0x511d('0x62')](_0x2b700f,{'include':[{'model':db['MailMessage'],'as':_0x511d('0xb3')}]});}})[_0x511d('0x30')](respondWithResult(_0x5ff1d1,null))['catch'](handleError(_0x5ff1d1,null));};exports['verifySmtp']=function(_0x524322,_0x5cdea3,_0xa797d4){return db[_0x511d('0x3d')]['find']({'where':{'id':_0x524322['params']['id']},'include':[{'model':db[_0x511d('0x3b')],'as':_0x511d('0x5f'),'raw':!![]}]})[_0x511d('0x30')](handleEntityNotFound(_0x5cdea3,null))['then'](function(_0xaabf1e){if(_0xaabf1e&&_0xaabf1e['Smtp']){var _0x3bd3f5={'id':_0xaabf1e['id'],'tls':{'rejectUnauthorized':![]}};if(_0xaabf1e[_0x511d('0x5f')][_0x511d('0x78')]){_0x3bd3f5['service']=_0xaabf1e[_0x511d('0x5f')][_0x511d('0x78')];}else{_0x3bd3f5['host']=_0xaabf1e[_0x511d('0x5f')][_0x511d('0x76')];_0x3bd3f5[_0x511d('0x77')]=_0xaabf1e[_0x511d('0x5f')][_0x511d('0x77')];_0x3bd3f5['secure']=_0xaabf1e[_0x511d('0x5f')][_0x511d('0xa9')];}if(_0xaabf1e[_0x511d('0x5f')]['authentication']){_0x3bd3f5[_0x511d('0xb4')]={'user':_0xaabf1e[_0x511d('0x5f')][_0x511d('0x72')],'pass':_0xaabf1e[_0x511d('0x5f')][_0x511d('0x7a')]};}return respondWithRpcPromise(_0x511d('0xb5'),_0x511d('0xb6'),{'account':_0x3bd3f5});}})[_0x511d('0x30')](respondWithResult(_0x5cdea3,null))[_0x511d('0x5b')](handleError(_0x5cdea3,null));};exports['destroy']=function(_0x2b0468,_0x4d1b75){return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x2b0468['params']['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x4d1b75,null))['then'](function(_0x170621){if(_0x170621&&_0x170621[_0x511d('0x78')]){throw new db[(_0x511d('0xb7'))][(_0x511d('0xb8'))](_0x511d('0xb9'));}return _0x170621;})[_0x511d('0x30')](removeEntity(_0x4d1b75,null))[_0x511d('0x5b')](handleError(_0x4d1b75,null));};exports[_0x511d('0xba')]=function(_0x38a317,_0x61cdd8,_0x476240){return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x38a317[_0x511d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x61cdd8,null))[_0x511d('0x30')](function(_0x2f817f){if(_0x2f817f){return _0x2f817f['addAgents'](_0x38a317[_0x511d('0x5d')][_0x511d('0x68')],_[_0x511d('0xbb')](_0x38a317[_0x511d('0x5d')],[_0x511d('0x68'),'id'])||{})[_0x511d('0xbc')](function(_0x370ab6){for(var _0x5af6e2=0x0;_0x5af6e2<_0x38a317[_0x511d('0x5d')][_0x511d('0x68')][_0x511d('0x58')];_0x5af6e2+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x38a317[_0x511d('0x5d')][_0x511d('0x68')][_0x5af6e2],'MailAccountId':_0x38a317[_0x511d('0x5e')]['id']});}return _0x370ab6;});}})[_0x511d('0x30')](respondWithResult(_0x61cdd8,null))[_0x511d('0x5b')](handleError(_0x61cdd8,null));};exports['removeAgents']=function(_0x4e7ff3,_0x16ea0d,_0x48c43e){return db[_0x511d('0x3d')][_0x511d('0x5a')]({'where':{'id':_0x4e7ff3[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x16ea0d,null))[_0x511d('0x30')](function(_0x32f97c){if(_0x32f97c){return _0x32f97c[_0x511d('0xbd')](_0x4e7ff3['query']['ids'])[_0x511d('0x30')](function(){if(_[_0x511d('0xbe')](_0x4e7ff3['query'][_0x511d('0x68')])){for(var _0x393287=0x0;_0x393287<_0x4e7ff3['query'][_0x511d('0x68')][_0x511d('0x58')];_0x393287+=0x1){socket[_0x511d('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x4e7ff3['query'][_0x511d('0x68')][_0x393287]),'MailAccountId':Number(_0x4e7ff3['params']['id'])});}}else{socket['emit'](_0x511d('0xc0'),{'UserId':Number(_0x4e7ff3[_0x511d('0x44')][_0x511d('0x68')]),'MailAccountId':Number(_0x4e7ff3['params']['id'])});}});}})[_0x511d('0x30')](respondWithStatusCode(_0x16ea0d,null))[_0x511d('0x5b')](handleError(_0x16ea0d,null));};exports[_0x511d('0xc1')]=function(_0x21ebd4,_0x50c313,_0x208ade){var _0xce3133={};var _0x5c279f={};var _0x18bcf5;var _0x1bd0b;return db['MailAccount'][_0x511d('0x64')]({'where':{'id':_0x21ebd4[_0x511d('0x5e')]['id']}})[_0x511d('0x30')](handleEntityNotFound(_0x50c313,null))[_0x511d('0x30')](function(_0x1a3dc0){if(_0x1a3dc0){_0x18bcf5=_0x1a3dc0;_0x5c279f['model']=_[_0x511d('0x45')](db[_0x511d('0xc2')][_0x511d('0x3e')]);_0x5c279f[_0x511d('0x44')]=_[_0x511d('0x45')](_0x21ebd4['query']);_0x5c279f[_0x511d('0x46')]=_[_0x511d('0x47')](_0x5c279f[_0x511d('0x42')],_0x5c279f[_0x511d('0x44')]);_0xce3133[_0x511d('0x48')]=_[_0x511d('0x47')](_0x5c279f['model'],qs[_0x511d('0x49')](_0x21ebd4[_0x511d('0x44')]['fields']));_0xce3133[_0x511d('0x48')]=_0xce3133['attributes'][_0x511d('0x58')]?_0xce3133[_0x511d('0x48')]:_0x5c279f[_0x511d('0x42')];_0xce3133[_0x511d('0x4c')]=qs[_0x511d('0x4d')](_0x21ebd4['query']['sort']);_0xce3133[_0x511d('0x50')]=qs[_0x511d('0x46')](_[_0x511d('0x4e')](_0x21ebd4[_0x511d('0x44')],_0x5c279f['filters']));if(_0x21ebd4[_0x511d('0x44')][_0x511d('0x4f')]){_0xce3133[_0x511d('0x50')]=_[_0x511d('0x51')](_0xce3133['where'],{'$or':_[_0x511d('0x43')](_0xce3133[_0x511d('0x48')],function(_0x47f074){var _0x51ea79={};_0x51ea79[_0x47f074]={'$like':'%'+_0x21ebd4[_0x511d('0x44')]['filter']+'%'};return _0x51ea79;})});}_0xce3133=_[_0x511d('0x51')]({},_0xce3133,_0x21ebd4[_0x511d('0x59')]);return _0x18bcf5[_0x511d('0xc1')](_0xce3133);}})[_0x511d('0x30')](function(_0x135abd){if(_0x135abd){_0x1bd0b=_0x135abd[_0x511d('0x58')];if(!_0x21ebd4['query'][_0x511d('0x4a')](_0x511d('0x4b'))){_0xce3133[_0x511d('0x29')]=qs[_0x511d('0x29')](_0x21ebd4[_0x511d('0x44')]['limit']);_0xce3133[_0x511d('0x28')]=qs[_0x511d('0x28')](_0x21ebd4['query'][_0x511d('0x28')]);}return _0x18bcf5['getAgents'](_0xce3133);}})[_0x511d('0x30')](function(_0x3c425d){if(_0x3c425d){return _0x3c425d?{'count':_0x1bd0b,'rows':_0x3c425d}:null;}})[_0x511d('0x30')](respondWithResult(_0x50c313,null))[_0x511d('0x5b')](handleError(_0x50c313,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1498881..7ea5b4a 100644 --- a/server/api/mailAccount/mailAccount.events.js +++ b/server/api/mailAccount/mailAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cba=['events','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1cba,0x1c2));var _0xa1cb=function(_0x58c531,_0x126bc6){_0x58c531=_0x58c531-0x0;var _0xddcc4a=_0x1cba[_0x58c531];return _0xddcc4a;};'use strict';var EventEmitter=require(_0xa1cb('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xa1cb('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa1cb('0x2')](0x0);var events={'afterCreate':_0xa1cb('0x3'),'afterUpdate':'update','afterDestroy':_0xa1cb('0x4')};function emitEvent(_0x1fba56){return function(_0x2fe469,_0x225345,_0x32dde1){MailAccountEvents['emit'](_0x1fba56+':'+_0x2fe469['id'],_0x2fe469);MailAccountEvents[_0xa1cb('0x5')](_0x1fba56,_0x2fe469);_0x32dde1(null);};}for(var e in events){if(events[_0xa1cb('0x6')](e)){var event=events[e];MailAccount[_0xa1cb('0x7')](e,emitEvent(event));}}module[_0xa1cb('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xc5d3=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc5d3,0xf7));var _0x3c5d=function(_0x595b9b,_0xa58ff){_0x595b9b=_0x595b9b-0x0;var _0x3be4c6=_0xc5d3[_0x595b9b];return _0x3be4c6;};'use strict';var EventEmitter=require(_0x3c5d('0x0'));var MailAccount=require(_0x3c5d('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3c5d('0x2')](0x0);var events={'afterCreate':_0x3c5d('0x3'),'afterUpdate':_0x3c5d('0x4'),'afterDestroy':_0x3c5d('0x5')};function emitEvent(_0x335f6a){return function(_0x285f21,_0x5351ed,_0x346733){MailAccountEvents[_0x3c5d('0x6')](_0x335f6a+':'+_0x285f21['id'],_0x285f21);MailAccountEvents[_0x3c5d('0x6')](_0x335f6a,_0x285f21);_0x346733(null);};}for(var e in events){if(events[_0x3c5d('0x7')](e)){var event=events[e];MailAccount[_0x3c5d('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4b0ceed..0752a5f 100644 --- a/server/api/mailAccount/mailAccount.model.js +++ b/server/api/mailAccount/mailAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fc4=['lodash','util','../../config/logger','bluebird','path','rimraf','exports','MailAccount','mail_accounts'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0x3fc4,0x1c2));var _0x43fc=function(_0xb9d024,_0x1b1d58){_0xb9d024=_0xb9d024-0x0;var _0x133c31=_0x3fc4[_0xb9d024];return _0x133c31;};'use strict';var _=require(_0x43fc('0x0'));var util=require(_0x43fc('0x1'));var logger=require(_0x43fc('0x2'))('api');var moment=require('moment');var BPromise=require(_0x43fc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43fc('0x4'));var rimraf=require(_0x43fc('0x5'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0x43fc('0x6')]=function(_0x479e04,_0x97d9d6){return _0x479e04['define'](_0x43fc('0x7'),attributes,{'tableName':_0x43fc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb422=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','mail_accounts'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xb422,0x144));var _0x2b42=function(_0x1922d2,_0x224ada){_0x1922d2=_0x1922d2-0x0;var _0x268072=_0xb422[_0x1922d2];return _0x268072;};'use strict';var _=require(_0x2b42('0x0'));var util=require(_0x2b42('0x1'));var logger=require('../../config/logger')(_0x2b42('0x2'));var moment=require(_0x2b42('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b42('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b42('0x5'));var config=require(_0x2b42('0x6'));var attributes=require('./mailAccount.attributes');module[_0x2b42('0x7')]=function(_0x54dbbc,_0x53f2ca){return _0x54dbbc['define']('MailAccount',attributes,{'tableName':_0x2b42('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0aab44f..5352883 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b8a=['DESC','Applications','List','get','omit','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','contact','subject','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','UserId','User','name','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailAccount','options','include','map','model','attributes','GetMailAccount','ShowMailAccount','find','raw','where','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','CmList','CmContact'];(function(_0x23fbf0,_0x505f60){var _0x443648=function(_0x310c10){while(--_0x310c10){_0x23fbf0['push'](_0x23fbf0['shift']());}};_0x443648(++_0x505f60);}(_0x2b8a,0xf9));var _0xa2b8=function(_0x14b735,_0x40d235){_0x14b735=_0x14b735-0x0;var _0x1f95d2=_0x2b8a[_0x14b735];return _0x1f95d2;};'use strict';var _=require(_0xa2b8('0x0'));var util=require(_0xa2b8('0x1'));var moment=require('moment');var BPromise=require(_0xa2b8('0x2'));var rs=require(_0xa2b8('0x3'));var fs=require('fs');var Redis=require(_0xa2b8('0x4'));var db=require(_0xa2b8('0x5'))['db'];var utils=require(_0xa2b8('0x6'));var logger=require(_0xa2b8('0x7'))(_0xa2b8('0x8'));var config=require('../../config/environment');var jayson=require(_0xa2b8('0x9'));var client=jayson['client'][_0xa2b8('0xa')]({'port':0x232c});config[_0xa2b8('0xb')]=_[_0xa2b8('0xc')](config[_0xa2b8('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2b8('0xb')]));require(_0xa2b8('0xd'))[_0xa2b8('0xe')](socket);function respondWithRpcPromise(_0x13743e,_0x18b00b,_0x10be04){return new BPromise(function(_0x3f6ea9,_0x287114){return client[_0xa2b8('0xf')](_0x13743e,_0x10be04)[_0xa2b8('0x10')](function(_0x5a38b4){logger[_0xa2b8('0x11')](_0xa2b8('0x12'),_0x18b00b,_0xa2b8('0x13'));logger[_0xa2b8('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x18b00b,_0xa2b8('0x13'),JSON[_0xa2b8('0x15')](_0x5a38b4));if(_0x5a38b4['error']){if(_0x5a38b4[_0xa2b8('0x16')][_0xa2b8('0x17')]===0x1f4){logger[_0xa2b8('0x16')](_0xa2b8('0x12'),_0x18b00b,_0x5a38b4['error'][_0xa2b8('0x18')]);return _0x287114(_0x5a38b4[_0xa2b8('0x16')]['message']);}logger[_0xa2b8('0x16')]('MailAccount,\x20%s,\x20%s',_0x18b00b,_0x5a38b4['error'][_0xa2b8('0x18')]);return _0x3f6ea9(_0x5a38b4[_0xa2b8('0x16')][_0xa2b8('0x18')]);}else{logger[_0xa2b8('0x11')]('MailAccount,\x20%s,\x20%s',_0x18b00b,_0xa2b8('0x13'));_0x3f6ea9(_0x5a38b4[_0xa2b8('0x19')][_0xa2b8('0x18')]);}})[_0xa2b8('0x1a')](function(_0x4a6f6b){logger['error'](_0xa2b8('0x12'),_0x18b00b,_0x4a6f6b);_0x287114(_0x4a6f6b);});});}exports['GetMailAccount']=function(_0x2b74fb){var _0x3844c1=this;return new Promise(function(_0x11d1b9,_0x70ba2e){return db[_0xa2b8('0x1b')]['findAll']({'raw':_0x2b74fb['options']?_0x2b74fb[_0xa2b8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2b74fb['options']?_0x2b74fb[_0xa2b8('0x1c')]['where']||null:null,'attributes':_0x2b74fb[_0xa2b8('0x1c')]?_0x2b74fb[_0xa2b8('0x1c')]['attributes']||null:null,'limit':_0x2b74fb[_0xa2b8('0x1c')]?_0x2b74fb[_0xa2b8('0x1c')]['limit']||null:null,'include':_0x2b74fb[_0xa2b8('0x1c')]?_0x2b74fb['options'][_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x2b74fb[_0xa2b8('0x1c')][_0xa2b8('0x1d')],function(_0x5e9645){return{'model':db[_0x5e9645[_0xa2b8('0x1f')]],'as':_0x5e9645['as'],'attributes':_0x5e9645['attributes'],'include':_0x5e9645[_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x5e9645[_0xa2b8('0x1d')],function(_0x534b37){return{'model':db[_0x534b37[_0xa2b8('0x1f')]],'as':_0x534b37['as'],'attributes':_0x534b37[_0xa2b8('0x20')],'include':_0x534b37[_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x534b37[_0xa2b8('0x1d')],function(_0x679d5c){return{'model':db[_0x679d5c['model']],'as':_0x679d5c['as'],'attributes':_0x679d5c[_0xa2b8('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa2b8('0x10')](function(_0x23db3f){logger[_0xa2b8('0x11')](_0xa2b8('0x21'),_0x2b74fb);logger[_0xa2b8('0x14')](_0xa2b8('0x21'),_0x2b74fb,JSON[_0xa2b8('0x15')](_0x23db3f));_0x11d1b9(_0x23db3f);})[_0xa2b8('0x1a')](function(_0x568fc5){logger[_0xa2b8('0x16')]('GetMailAccount',_0x568fc5[_0xa2b8('0x18')],_0x2b74fb);_0x70ba2e(_0x3844c1['error'](0x1f4,_0x568fc5[_0xa2b8('0x18')]));});});};exports[_0xa2b8('0x22')]=function(_0x3ae2bb){var _0x17a583=this;return new Promise(function(_0x35394d,_0x400515){return db[_0xa2b8('0x1b')][_0xa2b8('0x23')]({'raw':_0x3ae2bb[_0xa2b8('0x1c')]?_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x24')]===undefined?!![]:![]:!![],'where':_0x3ae2bb[_0xa2b8('0x1c')]?_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x25')]||null:null,'attributes':_0x3ae2bb['options']?_0x3ae2bb[_0xa2b8('0x1c')]['attributes']||null:null,'include':_0x3ae2bb[_0xa2b8('0x1c')]?_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x1d')]?_['map'](_0x3ae2bb[_0xa2b8('0x1c')][_0xa2b8('0x1d')],function(_0x324926){return{'model':db[_0x324926['model']],'as':_0x324926['as'],'attributes':_0x324926[_0xa2b8('0x20')],'include':_0x324926['include']?_[_0xa2b8('0x1e')](_0x324926['include'],function(_0x1e5272){return{'model':db[_0x1e5272['model']],'as':_0x1e5272['as'],'attributes':_0x1e5272[_0xa2b8('0x20')],'include':_0x1e5272[_0xa2b8('0x1d')]?_[_0xa2b8('0x1e')](_0x1e5272[_0xa2b8('0x1d')],function(_0x4ac437){return{'model':db[_0x4ac437[_0xa2b8('0x1f')]],'as':_0x4ac437['as'],'attributes':_0x4ac437[_0xa2b8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b3d27){logger[_0xa2b8('0x11')](_0xa2b8('0x22'),_0x3ae2bb);logger[_0xa2b8('0x14')]('ShowMailAccount',_0x3ae2bb,JSON['stringify'](_0x2b3d27));_0x35394d(_0x2b3d27);})[_0xa2b8('0x1a')](function(_0x5f1eb3){logger['error'](_0xa2b8('0x22'),_0x5f1eb3['message'],_0x3ae2bb);_0x400515(_0x17a583[_0xa2b8('0x16')](0x1f4,_0x5f1eb3[_0xa2b8('0x18')]));});});};exports[_0xa2b8('0x26')]=function(_0xa67e37){var _0x30a68f=this;return new Promise(function(_0x7d154d,_0x1b6b73){var _0x3d19a0={'body':_0xa67e37[_0xa2b8('0x27')],'channel':_0xa2b8('0x28')};var _0x381913=_[_0xa2b8('0x29')](_[_0xa2b8('0x2a')](db['CmContact'][_0xa2b8('0x2b')]),[_0xa2b8('0x2c'),_0xa2b8('0x2d'),_0xa2b8('0x2e'),_0xa2b8('0x2f')]);var _0x5350a7=![];if(_0xa67e37[_0xa2b8('0x27')]['id']){delete _0xa67e37[_0xa2b8('0x27')]['id'];}if(_[_0xa2b8('0x30')](_0xa67e37['body'][_0xa2b8('0x31')])){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa2b8('0x30')](_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x27')])||_0xa67e37['body'][_0xa2b8('0x27')]===''){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,_0xa2b8('0x32')));}if(_['isNil'](_0xa67e37[_0xa2b8('0x27')]['mapKey'])){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,_0xa2b8('0x33')+_0x381913));}if(!_[_0xa2b8('0x34')](_0x381913,_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x35')])){return _0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x381913));}var _0x2ce9f1={};_0x2ce9f1[_0xa67e37[_0xa2b8('0x27')]['mapKey']]=_0xa67e37[_0xa2b8('0x27')]['from'];return db['MailAccount']['find']({'where':{'id':_0xa67e37[_0xa2b8('0x36')]['id']},'include':[{'model':db[_0xa2b8('0x37')],'as':'List','include':[{'model':db[_0xa2b8('0x38')],'as':'Contacts','where':_0x2ce9f1,'limit':0x1,'order':[[_0xa2b8('0x2d'),_0xa2b8('0x39')]]}]},{'model':db['MailApplication'],'as':_0xa2b8('0x3a')},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xa2b8('0x10')](function(_0x47244c){if(_0x47244c&&_0x47244c[_0xa2b8('0x3b')]){var _0x3f96cb=_0x47244c[_0xa2b8('0x3c')]({'plain':!![]});_0x3d19a0[_0xa2b8('0x36')]=_[_0xa2b8('0x3d')](_0x3f96cb,[_0xa2b8('0x3a'),_0xa2b8('0x3b')]);_0x3d19a0['applications']=_0x3f96cb[_0xa2b8('0x3a')];_0x3d19a0['list']=_0x3f96cb['List'];_0x3d19a0[_0xa2b8('0x3e')]=_[_0xa2b8('0x3f')](_0x3d19a0[_0xa2b8('0x3e')],[_0xa2b8('0x40')],[_0xa2b8('0x41')]);if(_0x3d19a0['account']&&_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x42')]){_0x3d19a0[_0xa2b8('0x3e')][_0xa2b8('0x43')]({'id':0x0,'priority':_0x3d19a0[_0xa2b8('0x3e')][_0xa2b8('0x44')]+0x1,'app':_0xa2b8('0x45'),'appdata':_0xa2b8('0x42'),'interval':_0xa2b8('0x46')});}if(_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3a')]){delete _0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3a')];}if(_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3b')]){delete _0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x3b')];}if(_0x3f96cb['List']['Contacts'][_0xa2b8('0x44')]){return _0x3f96cb['List'][_0xa2b8('0x47')][0x0];}var _0x586d3f=_[_0xa2b8('0xc')](_0xa67e37[_0xa2b8('0x27')],{'firstName':_0xa67e37[_0xa2b8('0x27')]['from'],'ListId':_0x3f96cb[_0xa2b8('0x2f')]});_0x586d3f[_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x35')]]=_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x31')];return db[_0xa2b8('0x38')][_0xa2b8('0x48')](_0x586d3f);}else{throw new Error('List\x20not\x20found');}})[_0xa2b8('0x10')](function(_0x763631){_0x3d19a0['contact']=_0x763631;if(_0x763631){if(!_0xa67e37[_0xa2b8('0x27')]['message'][_0xa2b8('0x49')]){_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x49')]=rs[_0xa2b8('0x4a')]()+'\x20'+_0xa67e37['body'][_0xa2b8('0x18')][_0xa2b8('0x31')];}var _0x500342={'ContactId':_0x763631['id'],'MailAccountId':_0xa67e37[_0xa2b8('0x36')]['id'],'inReplyTo':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x49')],'to':_0xa67e37[_0xa2b8('0x27')]['message'][_0xa2b8('0x31')],'cc':_0xa67e37['body'][_0xa2b8('0x18')]['cc'],'subject':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['subject'],'attach':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x4b')],'lastMsgAt':moment()['format'](_0xa2b8('0x4c')),'lastMsgDirection':'in'};return db[_0xa2b8('0x4d')][_0xa2b8('0x23')]({'where':{'closed':![],'MailAccountId':_0xa67e37[_0xa2b8('0x36')]['id']},'include':[{'model':db[_0xa2b8('0x4e')],'as':_0xa2b8('0x4f'),'attributes':['messageId'],'where':{'messageId':_0xa67e37['body']['message'][_0xa2b8('0x50')]}}]})['then'](function(_0x505de3){if(_0x505de3){return[_0x505de3,![]];}return db[_0xa2b8('0x4d')][_0xa2b8('0x48')](_0x500342)[_0xa2b8('0x10')](function(_0x3919db){return[_0x3919db,!![]];});});}else{throw new Error(_0xa2b8('0x51'));}})[_0xa2b8('0x52')](function(_0x34ae77,_0x2660c1){if(_0x34ae77){_0x5350a7=_0x2660c1;if(!_0x2660c1){return _0x34ae77[_0xa2b8('0x53')]({'inReplyTo':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['messageId'],'to':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x31')],'cc':_0xa67e37[_0xa2b8('0x27')]['message']['cc'],'subject':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['subject'],'attach':_0x34ae77[_0xa2b8('0x4b')]?_0x34ae77[_0xa2b8('0x4b')]:_0xa67e37['body'][_0xa2b8('0x18')][_0xa2b8('0x4b')],'substatus':null,'substatusAt':moment()[_0xa2b8('0x54')](_0xa2b8('0x4c')),'lastMsgAt':moment()[_0xa2b8('0x54')](_0xa2b8('0x4c')),'lastMsgDirection':'in'});}else{return _0x34ae77;}}})['then'](function(_0x40c0e5){_0x3d19a0['interaction']=_0x40c0e5[_0xa2b8('0x3c')]({'plain':!![]});_0x3d19a0[_0xa2b8('0x55')][_0xa2b8('0x56')]=_0x5350a7;return db[_0xa2b8('0x4e')]['create']({'body':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x27')],'MailAccountId':_0xa67e37[_0xa2b8('0x36')]['id'],'MailInteractionId':_0x40c0e5['id'],'direction':'in','ContactId':_0x3d19a0[_0xa2b8('0x57')]['id'],'messageId':_0xa67e37['body'][_0xa2b8('0x18')][_0xa2b8('0x49')],'from':_0xa67e37[_0xa2b8('0x27')]['message']['from'],'to':_0xa67e37['body'][_0xa2b8('0x18')]['to'],'cc':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['cc'],'subject':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x58')],'attach':_0xa67e37[_0xa2b8('0x27')]['message']['attach'],'Attachments':_0xa67e37[_0xa2b8('0x27')]['message']['attachments'],'originTo':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x59')],'originCc':_0xa67e37[_0xa2b8('0x27')]['message'][_0xa2b8('0x5a')],'bcc':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')]['bcc'],'ChatWebsiteId':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x5b')]||null,'originChannel':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x5c')]||_0xa2b8('0x5d'),'ChatOfflineMessageId':_0xa67e37[_0xa2b8('0x27')][_0xa2b8('0x18')][_0xa2b8('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xa2b8('0x10')](function(_0x316250){_0x3d19a0[_0xa2b8('0x18')]=_0x316250;if(_0x3d19a0[_0xa2b8('0x55')][_0xa2b8('0x5f')]){return db[_0xa2b8('0x60')][_0xa2b8('0x23')]({'attributes':['id',_0xa2b8('0x61')],'where':{'id':_0x3d19a0[_0xa2b8('0x55')][_0xa2b8('0x5f')]}})[_0xa2b8('0x10')](function(_0x4b66cb){if(_0x4b66cb){_0x3d19a0[_0xa2b8('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa2b8('0x62'),'appdata':_0x4b66cb[_0xa2b8('0x61')]+','+(_0x3d19a0[_0xa2b8('0x36')][_0xa2b8('0x63')]||0xa),'interval':_0xa2b8('0x46')});}return respondWithRpcPromise('Start',_0xa2b8('0x64'),_0x3d19a0);});}return respondWithRpcPromise(_0xa2b8('0x65'),_0xa2b8('0x64'),_0x3d19a0);})[_0xa2b8('0x10')](function(_0x31e8dc){_0x7d154d(_0x31e8dc);})[_0xa2b8('0x1a')](function(_0xc76ab5){_0x1b6b73(_0x30a68f[_0xa2b8('0x16')](0x1f4,_0xc76ab5[_0xa2b8('0x18')]));});});}; \ No newline at end of file +var _0x173e=['jayson/promise','client','redis','defaults','localhost','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailAccount','findAll','options','raw','where','attributes','include','map','model','GetMailAccount','debug','find','ShowMailAccount','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','body','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','List','Contacts','DESC','MailServerOut','Smtp','omit','Applications','list','orderBy','applications','push','length','close','autoclose','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','get','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','name','agent','waitForTheAssignedAgent','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1e1bb5,_0x23b4e9){var _0x413b4c=function(_0x1483c1){while(--_0x1483c1){_0x1e1bb5['push'](_0x1e1bb5['shift']());}};_0x413b4c(++_0x23b4e9);}(_0x173e,0xc2));var _0xe173=function(_0x2a304c,_0x458602){_0x2a304c=_0x2a304c-0x0;var _0x180b80=_0x173e[_0x2a304c];return _0x180b80;};'use strict';var _=require(_0xe173('0x0'));var util=require(_0xe173('0x1'));var moment=require(_0xe173('0x2'));var BPromise=require(_0xe173('0x3'));var rs=require(_0xe173('0x4'));var fs=require('fs');var Redis=require(_0xe173('0x5'));var db=require(_0xe173('0x6'))['db'];var utils=require(_0xe173('0x7'));var logger=require(_0xe173('0x8'))('rpc');var config=require(_0xe173('0x9'));var jayson=require(_0xe173('0xa'));var client=jayson[_0xe173('0xb')]['http']({'port':0x232c});config[_0xe173('0xc')]=_[_0xe173('0xd')](config[_0xe173('0xc')],{'host':_0xe173('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe173('0xc')]));require('./mailAccount.socket')[_0xe173('0xf')](socket);function respondWithRpcPromise(_0xfee81d,_0x58bd9a,_0x4ffb17){return new BPromise(function(_0x1bfae7,_0x11f18a){return client[_0xe173('0x10')](_0xfee81d,_0x4ffb17)[_0xe173('0x11')](function(_0x41cbbd){logger[_0xe173('0x12')](_0xe173('0x13'),_0x58bd9a,_0xe173('0x14'));logger['debug'](_0xe173('0x15'),_0x58bd9a,_0xe173('0x14'),JSON[_0xe173('0x16')](_0x41cbbd));if(_0x41cbbd[_0xe173('0x17')]){if(_0x41cbbd['error'][_0xe173('0x18')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x58bd9a,_0x41cbbd[_0xe173('0x17')][_0xe173('0x19')]);return _0x11f18a(_0x41cbbd[_0xe173('0x17')]['message']);}logger['error'](_0xe173('0x13'),_0x58bd9a,_0x41cbbd[_0xe173('0x17')][_0xe173('0x19')]);return _0x1bfae7(_0x41cbbd[_0xe173('0x17')][_0xe173('0x19')]);}else{logger[_0xe173('0x12')](_0xe173('0x13'),_0x58bd9a,'request\x20sent');_0x1bfae7(_0x41cbbd['result'][_0xe173('0x19')]);}})[_0xe173('0x1a')](function(_0x252cf7){logger[_0xe173('0x17')](_0xe173('0x13'),_0x58bd9a,_0x252cf7);_0x11f18a(_0x252cf7);});});}exports['GetMailAccount']=function(_0x38a005){var _0x277db4=this;return new Promise(function(_0x31d8da,_0x350681){return db[_0xe173('0x1b')][_0xe173('0x1c')]({'raw':_0x38a005[_0xe173('0x1d')]?_0x38a005[_0xe173('0x1d')][_0xe173('0x1e')]===undefined?!![]:![]:!![],'where':_0x38a005[_0xe173('0x1d')]?_0x38a005[_0xe173('0x1d')][_0xe173('0x1f')]||null:null,'attributes':_0x38a005[_0xe173('0x1d')]?_0x38a005['options'][_0xe173('0x20')]||null:null,'limit':_0x38a005[_0xe173('0x1d')]?_0x38a005[_0xe173('0x1d')]['limit']||null:null,'include':_0x38a005[_0xe173('0x1d')]?_0x38a005[_0xe173('0x1d')][_0xe173('0x21')]?_[_0xe173('0x22')](_0x38a005[_0xe173('0x1d')]['include'],function(_0x14e4cb){return{'model':db[_0x14e4cb['model']],'as':_0x14e4cb['as'],'attributes':_0x14e4cb[_0xe173('0x20')],'include':_0x14e4cb['include']?_[_0xe173('0x22')](_0x14e4cb[_0xe173('0x21')],function(_0x3645bb){return{'model':db[_0x3645bb[_0xe173('0x23')]],'as':_0x3645bb['as'],'attributes':_0x3645bb['attributes'],'include':_0x3645bb[_0xe173('0x21')]?_['map'](_0x3645bb[_0xe173('0x21')],function(_0x28919e){return{'model':db[_0x28919e['model']],'as':_0x28919e['as'],'attributes':_0x28919e[_0xe173('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ccdaf){logger[_0xe173('0x12')](_0xe173('0x24'),_0x38a005);logger[_0xe173('0x25')](_0xe173('0x24'),_0x38a005,JSON['stringify'](_0x5ccdaf));_0x31d8da(_0x5ccdaf);})['catch'](function(_0x209016){logger[_0xe173('0x17')](_0xe173('0x24'),_0x209016['message'],_0x38a005);_0x350681(_0x277db4[_0xe173('0x17')](0x1f4,_0x209016[_0xe173('0x19')]));});});};exports['ShowMailAccount']=function(_0x14a559){var _0x17f4b1=this;return new Promise(function(_0xa29f99,_0x211c29){return db['MailAccount'][_0xe173('0x26')]({'raw':_0x14a559[_0xe173('0x1d')]?_0x14a559[_0xe173('0x1d')][_0xe173('0x1e')]===undefined?!![]:![]:!![],'where':_0x14a559[_0xe173('0x1d')]?_0x14a559[_0xe173('0x1d')]['where']||null:null,'attributes':_0x14a559['options']?_0x14a559[_0xe173('0x1d')][_0xe173('0x20')]||null:null,'include':_0x14a559[_0xe173('0x1d')]?_0x14a559[_0xe173('0x1d')][_0xe173('0x21')]?_[_0xe173('0x22')](_0x14a559[_0xe173('0x1d')][_0xe173('0x21')],function(_0x251109){return{'model':db[_0x251109[_0xe173('0x23')]],'as':_0x251109['as'],'attributes':_0x251109[_0xe173('0x20')],'include':_0x251109[_0xe173('0x21')]?_[_0xe173('0x22')](_0x251109[_0xe173('0x21')],function(_0x24e649){return{'model':db[_0x24e649[_0xe173('0x23')]],'as':_0x24e649['as'],'attributes':_0x24e649[_0xe173('0x20')],'include':_0x24e649[_0xe173('0x21')]?_['map'](_0x24e649[_0xe173('0x21')],function(_0x5933b5){return{'model':db[_0x5933b5['model']],'as':_0x5933b5['as'],'attributes':_0x5933b5[_0xe173('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27a29a){logger[_0xe173('0x12')]('ShowMailAccount',_0x14a559);logger[_0xe173('0x25')](_0xe173('0x27'),_0x14a559,JSON[_0xe173('0x16')](_0x27a29a));_0xa29f99(_0x27a29a);})[_0xe173('0x1a')](function(_0x1d90c3){logger[_0xe173('0x17')](_0xe173('0x27'),_0x1d90c3[_0xe173('0x19')],_0x14a559);_0x211c29(_0x17f4b1[_0xe173('0x17')](0x1f4,_0x1d90c3[_0xe173('0x19')]));});});};exports[_0xe173('0x28')]=function(_0x1cc84e){var _0xee441a=this;return new Promise(function(_0x1600f9,_0x269739){var _0x8a2780={'body':_0x1cc84e['body'],'channel':_0xe173('0x29')};var _0x1b5285=_[_0xe173('0x2a')](_[_0xe173('0x2b')](db[_0xe173('0x2c')][_0xe173('0x2d')]),['createdAt',_0xe173('0x2e'),_0xe173('0x2f'),_0xe173('0x30')]);var _0x3c2e0b=![];if(_0x1cc84e['body']['id']){delete _0x1cc84e[_0xe173('0x31')]['id'];}if(_['isNil'](_0x1cc84e[_0xe173('0x31')]['from'])){return _0x269739(_0xee441a[_0xe173('0x17')](0x1f4,_0xe173('0x32')));}if(_[_0xe173('0x33')](_0x1cc84e[_0xe173('0x31')]['body'])||_0x1cc84e[_0xe173('0x31')][_0xe173('0x31')]===''){return _0x269739(_0xee441a[_0xe173('0x17')](0x1f4,_0xe173('0x34')));}if(_[_0xe173('0x33')](_0x1cc84e[_0xe173('0x31')][_0xe173('0x35')])){return _0x269739(_0xee441a[_0xe173('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b5285));}if(!_[_0xe173('0x36')](_0x1b5285,_0x1cc84e['body'][_0xe173('0x35')])){return _0x269739(_0xee441a[_0xe173('0x17')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b5285));}var _0x593054={};_0x593054[_0x1cc84e[_0xe173('0x31')][_0xe173('0x35')]]=_0x1cc84e[_0xe173('0x31')][_0xe173('0x37')];return db[_0xe173('0x1b')][_0xe173('0x26')]({'where':{'id':_0x1cc84e[_0xe173('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0xe173('0x39'),'include':[{'model':db[_0xe173('0x2c')],'as':_0xe173('0x3a'),'where':_0x593054,'limit':0x1,'order':[[_0xe173('0x2e'),_0xe173('0x3b')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0xe173('0x3c')],'as':_0xe173('0x3d')}]})[_0xe173('0x11')](function(_0x3c6f65){if(_0x3c6f65&&_0x3c6f65['List']){var _0x400025=_0x3c6f65['get']({'plain':!![]});_0x8a2780[_0xe173('0x38')]=_[_0xe173('0x3e')](_0x400025,[_0xe173('0x3f'),_0xe173('0x39')]);_0x8a2780['applications']=_0x400025[_0xe173('0x3f')];_0x8a2780[_0xe173('0x40')]=_0x400025['List'];_0x8a2780['applications']=_[_0xe173('0x41')](_0x8a2780['applications'],['priority'],['asc']);if(_0x8a2780['account']&&_0x8a2780[_0xe173('0x38')]['autoclose']){_0x8a2780[_0xe173('0x42')][_0xe173('0x43')]({'id':0x0,'priority':_0x8a2780[_0xe173('0x42')][_0xe173('0x44')]+0x1,'app':_0xe173('0x45'),'appdata':_0xe173('0x46'),'interval':_0xe173('0x47')});}if(_0x8a2780['account'][_0xe173('0x3f')]){delete _0x8a2780[_0xe173('0x38')][_0xe173('0x3f')];}if(_0x8a2780[_0xe173('0x38')]['List']){delete _0x8a2780[_0xe173('0x38')]['List'];}if(_0x400025[_0xe173('0x39')][_0xe173('0x3a')][_0xe173('0x44')]){return _0x400025['List'][_0xe173('0x3a')][0x0];}var _0x171fcd=_[_0xe173('0xd')](_0x1cc84e[_0xe173('0x31')],{'firstName':_0x1cc84e[_0xe173('0x31')][_0xe173('0x37')],'ListId':_0x400025[_0xe173('0x30')]});_0x171fcd[_0x1cc84e[_0xe173('0x31')][_0xe173('0x35')]]=_0x1cc84e['body'][_0xe173('0x37')];return db[_0xe173('0x2c')][_0xe173('0x48')](_0x171fcd);}else{throw new Error(_0xe173('0x49'));}})['then'](function(_0x39a162){_0x8a2780['contact']=_0x39a162;if(_0x39a162){if(!_0x1cc84e['body'][_0xe173('0x19')][_0xe173('0x4a')]){_0x1cc84e[_0xe173('0x31')]['message'][_0xe173('0x4a')]=rs[_0xe173('0x4b')]()+'\x20'+_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')][_0xe173('0x37')];}var _0xe3b73a={'ContactId':_0x39a162['id'],'MailAccountId':_0x1cc84e[_0xe173('0x38')]['id'],'inReplyTo':_0x1cc84e['body'][_0xe173('0x19')][_0xe173('0x4a')],'to':_0x1cc84e[_0xe173('0x31')]['message'][_0xe173('0x37')],'cc':_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')]['cc'],'subject':_0x1cc84e[_0xe173('0x31')]['message'][_0xe173('0x4c')],'attach':_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')][_0xe173('0x4d')],'lastMsgAt':moment()[_0xe173('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xe173('0x4f')]['find']({'where':{'closed':![],'MailAccountId':_0x1cc84e[_0xe173('0x38')]['id']},'include':[{'model':db[_0xe173('0x50')],'as':_0xe173('0x51'),'attributes':['messageId'],'where':{'messageId':_0x1cc84e['body']['message'][_0xe173('0x52')]}}]})['then'](function(_0x73b8b4){if(_0x73b8b4){return[_0x73b8b4,![]];}return db[_0xe173('0x4f')][_0xe173('0x48')](_0xe3b73a)[_0xe173('0x11')](function(_0xdb3de4){return[_0xdb3de4,!![]];});});}else{throw new Error(_0xe173('0x53'));}})[_0xe173('0x54')](function(_0x2d0723,_0x59b07d){if(_0x2d0723){_0x3c2e0b=_0x59b07d;if(!_0x59b07d){return _0x2d0723[_0xe173('0x55')]({'inReplyTo':_0x1cc84e['body'][_0xe173('0x19')]['messageId'],'to':_0x1cc84e['body'][_0xe173('0x19')][_0xe173('0x37')],'cc':_0x1cc84e[_0xe173('0x31')]['message']['cc'],'subject':_0x1cc84e[_0xe173('0x31')]['message'][_0xe173('0x4c')],'attach':_0x2d0723[_0xe173('0x4d')]?_0x2d0723[_0xe173('0x4d')]:_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')][_0xe173('0x4d')],'substatus':null,'substatusAt':moment()['format'](_0xe173('0x56')),'lastMsgAt':moment()[_0xe173('0x4e')](_0xe173('0x56')),'lastMsgDirection':'in'});}else{return _0x2d0723;}}})[_0xe173('0x11')](function(_0x1b4052){_0x8a2780['interaction']=_0x1b4052[_0xe173('0x57')]({'plain':!![]});_0x8a2780[_0xe173('0x58')][_0xe173('0x59')]=_0x3c2e0b;return db[_0xe173('0x50')][_0xe173('0x48')]({'body':_0x1cc84e['body'][_0xe173('0x31')],'MailAccountId':_0x1cc84e[_0xe173('0x38')]['id'],'MailInteractionId':_0x1b4052['id'],'direction':'in','ContactId':_0x8a2780['contact']['id'],'messageId':_0x1cc84e['body'][_0xe173('0x19')][_0xe173('0x4a')],'from':_0x1cc84e['body'][_0xe173('0x19')][_0xe173('0x37')],'to':_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')]['to'],'cc':_0x1cc84e[_0xe173('0x31')]['message']['cc'],'subject':_0x1cc84e['body'][_0xe173('0x19')]['subject'],'attach':_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')][_0xe173('0x4d')],'Attachments':_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')][_0xe173('0x5a')],'originTo':_0x1cc84e[_0xe173('0x31')][_0xe173('0x19')][_0xe173('0x5b')],'originCc':_0x1cc84e['body'][_0xe173('0x19')][_0xe173('0x5c')],'bcc':_0x1cc84e[_0xe173('0x31')]['message']['bcc'],'ChatWebsiteId':_0x1cc84e['body']['message'][_0xe173('0x5d')]||null,'originChannel':_0x1cc84e['body'][_0xe173('0x19')][_0xe173('0x5e')]||'Email','ChatOfflineMessageId':_0x1cc84e[_0xe173('0x31')]['message'][_0xe173('0x5f')]||null},{'include':[{'model':db[_0xe173('0x60')],'as':_0xe173('0x61')}]});})[_0xe173('0x11')](function(_0x35b1fd){_0x8a2780[_0xe173('0x19')]=_0x35b1fd;if(_0x8a2780[_0xe173('0x58')]['UserId']){return db['User'][_0xe173('0x26')]({'attributes':['id',_0xe173('0x62')],'where':{'id':_0x8a2780[_0xe173('0x58')]['UserId']}})[_0xe173('0x11')](function(_0x156c90){if(_0x156c90){_0x8a2780[_0xe173('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe173('0x63'),'appdata':_0x156c90[_0xe173('0x62')]+','+(_0x8a2780[_0xe173('0x38')][_0xe173('0x64')]||0xa),'interval':_0xe173('0x47')});}return respondWithRpcPromise('Start',_0xe173('0x65'),_0x8a2780);});}return respondWithRpcPromise('Start',_0xe173('0x65'),_0x8a2780);})[_0xe173('0x11')](function(_0x2d85a8){_0x1600f9(_0x2d85a8);})[_0xe173('0x1a')](function(_0x17a0a3){_0x269739(_0xee441a[_0xe173('0x17')](0x1f4,_0x17a0a3[_0xe173('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 16a3504..008b0c1 100644 --- a/server/api/mailAccount/mailAccount.socket.js +++ b/server/api/mailAccount/mailAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e11=['register','length','mailAccount:','./mailAccount.events','remove','update','emit'];(function(_0x4797bb,_0xfe9665){var _0x2025c0=function(_0x51ed4e){while(--_0x51ed4e){_0x4797bb['push'](_0x4797bb['shift']());}};_0x2025c0(++_0xfe9665);}(_0x5e11,0x1c3));var _0x15e1=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x5e11[_0x1b6563];return _0xdea7b8;};'use strict';var MailAccountEvents=require(_0x15e1('0x0'));var events=['save',_0x15e1('0x1'),_0x15e1('0x2')];function createListener(_0x197058,_0xd2c9d9){return function(_0x82943a){_0xd2c9d9[_0x15e1('0x3')](_0x197058,_0x82943a);};}function removeListener(_0x598eda,_0x2409d8){return function(){MailAccountEvents['removeListener'](_0x598eda,_0x2409d8);};}exports[_0x15e1('0x4')]=function(_0x41b56c){for(var _0xa0d783=0x0,_0xfabd74=events[_0x15e1('0x5')];_0xa0d783<_0xfabd74;_0xa0d783++){var _0x50b131=events[_0xa0d783];var _0xe0b339=createListener(_0x15e1('0x6')+_0x50b131,_0x41b56c);MailAccountEvents['on'](_0x50b131,_0xe0b339);}}; \ No newline at end of file +var _0x84e7=['save','remove','emit','removeListener','register'];(function(_0x4bccc9,_0x1ffb5e){var _0x5c4a4b=function(_0x2343b2){while(--_0x2343b2){_0x4bccc9['push'](_0x4bccc9['shift']());}};_0x5c4a4b(++_0x1ffb5e);}(_0x84e7,0x122));var _0x784e=function(_0x5cb174,_0x36fe74){_0x5cb174=_0x5cb174-0x0;var _0x42db91=_0x84e7[_0x5cb174];return _0x42db91;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x784e('0x0'),_0x784e('0x1'),'update'];function createListener(_0x3548d2,_0x2c1d96){return function(_0x50f44d){_0x2c1d96[_0x784e('0x2')](_0x3548d2,_0x50f44d);};}function removeListener(_0x14cee2,_0x205619){return function(){MailAccountEvents[_0x784e('0x3')](_0x14cee2,_0x205619);};}exports[_0x784e('0x4')]=function(_0x133296){for(var _0x48ed22=0x0,_0x3cbdd1=events['length'];_0x48ed22<_0x3cbdd1;_0x48ed22++){var _0xfaa170=events[_0x48ed22];var _0x24654d=createListener('mailAccount:'+_0xfaa170,_0x133296);MailAccountEvents['on'](_0xfaa170,_0x24654d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cf93e11..3eb3643 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['show','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xb')]);router[_0xac4a('0xc')](_0xac4a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xac4a('0xd')](_0xac4a('0x9'),auth[_0xac4a('0xa')](),controller['destroy']);module[_0xac4a('0xe')]=router; \ No newline at end of file +var _0x1261=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','isAuthenticated','show','/:id','update','delete','destroy'];(function(_0x34a9ea,_0x6a8cc4){var _0xde7703=function(_0x50e5c8){while(--_0x50e5c8){_0x34a9ea['push'](_0x34a9ea['shift']());}};_0xde7703(++_0x6a8cc4);}(_0x1261,0x144));var _0x1126=function(_0x316efa,_0x20a1e1){_0x316efa=_0x316efa-0x0;var _0x4d96cc=_0x1261[_0x316efa];return _0x4d96cc;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/:id',auth[_0x1126('0xa')](),controller[_0x1126('0xb')]);router['put'](_0x1126('0xc'),auth[_0x1126('0xa')](),controller[_0x1126('0xd')]);router[_0x1126('0xe')](_0x1126('0xc'),auth['isAuthenticated'](),controller[_0x1126('0xf')]);module[_0x1126('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index daa2416..945228f 100644 --- a/server/api/mailApplication/mailApplication.attributes.js +++ b/server/api/mailApplication/mailApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbcc=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbcc,0xea));var _0xcdbc=function(_0x571230,_0x111867){_0x571230=_0x571230-0x0;var _0x1867ac=_0xdbcc[_0x571230];return _0x1867ac;};'use strict';var Sequelize=require(_0xcdbc('0x0'));module[_0xcdbc('0x1')]={'priority':{'type':Sequelize[_0xcdbc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcdbc('0x3')],'allowNull':![],'defaultValue':_0xcdbc('0x4')},'appdata':{'type':Sequelize[_0xcdbc('0x5')]()},'description':{'type':Sequelize[_0xcdbc('0x3')]},'interval':{'type':Sequelize[_0xcdbc('0x3')],'defaultValue':_0xcdbc('0x6')}}; \ No newline at end of file +var _0x8540=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1a3f9,_0x146b85){var _0x13e3b3=function(_0x5add16){while(--_0x5add16){_0x1a3f9['push'](_0x1a3f9['shift']());}};_0x13e3b3(++_0x146b85);}(_0x8540,0x1b7));var _0x0854=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x8540[_0x256b72];return _0x2183e3;};'use strict';var Sequelize=require('sequelize');module[_0x0854('0x0')]={'priority':{'type':Sequelize[_0x0854('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0854('0x2')],'allowNull':![],'defaultValue':_0x0854('0x3')},'appdata':{'type':Sequelize[_0x0854('0x4')]()},'description':{'type':Sequelize[_0x0854('0x2')]},'interval':{'type':Sequelize[_0x0854('0x2')],'defaultValue':_0x0854('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6a4b2bc..b924821 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dfc=['apply','save','update','then','destroy','sendStatus','error','stack','send','render','merge','body','contact','message','agent','interaction','show','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','includeAll','options','find','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json'];(function(_0x4ebd76,_0x2ff5e8){var _0x42c3ab=function(_0x2a619b){while(--_0x2a619b){_0x4ebd76['push'](_0x4ebd76['shift']());}};_0x42c3ab(++_0x2ff5e8);}(_0x2dfc,0x9f));var _0xc2df=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dfc[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc2df('0x0'));var zipdir=require(_0xc2df('0x1'));var jsonpatch=require(_0xc2df('0x2'));var rp=require(_0xc2df('0x3'));var moment=require(_0xc2df('0x4'));var BPromise=require(_0xc2df('0x5'));var Mustache=require(_0xc2df('0x6'));var util=require(_0xc2df('0x7'));var path=require(_0xc2df('0x8'));var sox=require(_0xc2df('0x9'));var csv=require(_0xc2df('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2df('0xb'));var _=require('lodash');var squel=require(_0xc2df('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc2df('0xa'));var querystring=require(_0xc2df('0xd'));var Papa=require(_0xc2df('0xe'));var Redis=require(_0xc2df('0xf'));var authService=require(_0xc2df('0x10'));var qs=require(_0xc2df('0x11'));var as=require(_0xc2df('0x12'));var hardwareService=require(_0xc2df('0x13'));var logger=require('../../config/logger')(_0xc2df('0x14'));var utils=require(_0xc2df('0x15'));var config=require(_0xc2df('0x16'));var licenseUtil=require(_0xc2df('0x17'));var db=require(_0xc2df('0x18'))['db'];function respondWithStatusCode(_0x10822b,_0x1aab3d){_0x1aab3d=_0x1aab3d||0xcc;return function(_0x1f981c){if(_0x1f981c){return _0x10822b['sendStatus'](_0x1aab3d);}return _0x10822b[_0xc2df('0x19')](_0x1aab3d)[_0xc2df('0x1a')]();};}function respondWithResult(_0xa24c40,_0x2eca47){_0x2eca47=_0x2eca47||0xc8;return function(_0x3660de){if(_0x3660de){return _0xa24c40['status'](_0x2eca47)['json'](_0x3660de);}};}function respondWithFilteredResult(_0x6f9b8c,_0x1efa7e){return function(_0x297112){if(_0x297112){var _0xc8d1bf=typeof _0x1efa7e[_0xc2df('0x1b')]===_0xc2df('0x1c')&&typeof _0x1efa7e['limit']==='undefined';var _0x1ba441=_0x297112[_0xc2df('0x1d')];var _0x32ac7a=_0xc8d1bf?0x0:_0x1efa7e['offset'];var _0x179aeb=_0xc8d1bf?_0x297112[_0xc2df('0x1d')]:_0x1efa7e[_0xc2df('0x1b')]+_0x1efa7e[_0xc2df('0x1e')];var _0x537841;if(_0x179aeb>=_0x1ba441){_0x179aeb=_0x1ba441;_0x537841=0xc8;}else{_0x537841=0xce;}_0x6f9b8c['status'](_0x537841);return _0x6f9b8c['set'](_0xc2df('0x1f'),_0x32ac7a+'-'+_0x179aeb+'/'+_0x1ba441)[_0xc2df('0x20')](_0x297112);}return null;};}function patchUpdates(_0x1c7cab){return function(_0x41958d){try{jsonpatch[_0xc2df('0x21')](_0x41958d,_0x1c7cab,!![]);}catch(_0x2f64dc){return BPromise['reject'](_0x2f64dc);}return _0x41958d[_0xc2df('0x22')]();};}function saveUpdates(_0x51f2e5,_0x5e1eac){return function(_0x5f37de){if(_0x5f37de){return _0x5f37de[_0xc2df('0x23')](_0x51f2e5)[_0xc2df('0x24')](function(_0x39ee0f){return _0x39ee0f;});}return null;};}function removeEntity(_0x58a028,_0x1f4457){return function(_0x62c939){if(_0x62c939){return _0x62c939[_0xc2df('0x25')]()[_0xc2df('0x24')](function(){_0x58a028[_0xc2df('0x19')](0xcc)[_0xc2df('0x1a')]();});}};}function handleEntityNotFound(_0x22985f,_0x17bb59){return function(_0x53d649){if(!_0x53d649){_0x22985f[_0xc2df('0x26')](0x194);}return _0x53d649;};}function handleError(_0x1b30cb,_0x43355b){_0x43355b=_0x43355b||0x1f4;return function(_0x3465f6){logger[_0xc2df('0x27')](_0x3465f6[_0xc2df('0x28')]);if(_0x3465f6['name']){delete _0x3465f6['name'];}_0x1b30cb[_0xc2df('0x19')](_0x43355b)[_0xc2df('0x29')](_0x3465f6);};}function getMustacheRender(_0xe87b4b,_0x1b9e52){return Mustache[_0xc2df('0x2a')](_0xe87b4b,_[_0xc2df('0x2b')](_0x1b9e52[_0xc2df('0x2c')],{'contact':_0x1b9e52[_0xc2df('0x2d')],'message':_0x1b9e52[_0xc2df('0x2e')],'agent':_0x1b9e52[_0xc2df('0x2f')],'interaction':_0x1b9e52[_0xc2df('0x30')],'account':_0x1b9e52['account']}))||'';}exports[_0xc2df('0x31')]=function(_0x3a4e4a,_0x4c7175){var _0x389a10={'raw':!![],'where':{'id':_0x3a4e4a[_0xc2df('0x32')]['id']}},_0x2bb7c6={};_0x2bb7c6['model']=_[_0xc2df('0x33')](db[_0xc2df('0x34')][_0xc2df('0x35')]);_0x2bb7c6[_0xc2df('0x36')]=_['keys'](_0x3a4e4a[_0xc2df('0x36')]);_0x2bb7c6[_0xc2df('0x37')]=_[_0xc2df('0x38')](_0x2bb7c6[_0xc2df('0x39')],_0x2bb7c6[_0xc2df('0x36')]);_0x389a10[_0xc2df('0x3a')]=_[_0xc2df('0x38')](_0x2bb7c6['model'],qs['fields'](_0x3a4e4a[_0xc2df('0x36')][_0xc2df('0x3b')]));_0x389a10[_0xc2df('0x3a')]=_0x389a10[_0xc2df('0x3a')]['length']?_0x389a10[_0xc2df('0x3a')]:_0x2bb7c6[_0xc2df('0x39')];if(_0x3a4e4a[_0xc2df('0x36')][_0xc2df('0x3c')]){_0x389a10['include']=[{'all':!![]}];}_0x389a10=_[_0xc2df('0x2b')]({},_0x389a10,_0x3a4e4a[_0xc2df('0x3d')]);return db['MailApplication'][_0xc2df('0x3e')](_0x389a10)[_0xc2df('0x24')](handleEntityNotFound(_0x4c7175,null))[_0xc2df('0x24')](respondWithResult(_0x4c7175,null))[_0xc2df('0x3f')](handleError(_0x4c7175,null));};exports[_0xc2df('0x23')]=function(_0x5af478,_0x3af286){if(_0x5af478[_0xc2df('0x2c')]['id']){delete _0x5af478[_0xc2df('0x2c')]['id'];}return db[_0xc2df('0x34')][_0xc2df('0x3e')]({'where':{'id':_0x5af478['params']['id']}})[_0xc2df('0x24')](handleEntityNotFound(_0x3af286,null))[_0xc2df('0x24')](saveUpdates(_0x5af478[_0xc2df('0x2c')],null))[_0xc2df('0x24')](respondWithResult(_0x3af286,null))[_0xc2df('0x3f')](handleError(_0x3af286,null));};exports[_0xc2df('0x25')]=function(_0x18ea7d,_0x447154){return db[_0xc2df('0x34')][_0xc2df('0x3e')]({'where':{'id':_0x18ea7d[_0xc2df('0x32')]['id']}})[_0xc2df('0x24')](handleEntityNotFound(_0x447154,null))[_0xc2df('0x24')](removeEntity(_0x447154,null))[_0xc2df('0x3f')](handleError(_0x447154,null));}; \ No newline at end of file +var _0x8fd1=['then','end','stack','name','send','merge','contact','message','agent','interaction','params','model','keys','rawAttributes','filters','query','attributes','intersection','fields','length','includeAll','include','MailApplication','catch','body','find','eml-format','zip-dir','request-promise','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','json','apply','reject','save','update'];(function(_0x41177b,_0x245413){var _0x10e1ed=function(_0x47bcd5){while(--_0x47bcd5){_0x41177b['push'](_0x41177b['shift']());}};_0x10e1ed(++_0x245413);}(_0x8fd1,0x17c));var _0x18fd=function(_0x57a402,_0x40596b){_0x57a402=_0x57a402-0x0;var _0x753a36=_0x8fd1[_0x57a402];return _0x753a36;};'use strict';var emlformat=require(_0x18fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x18fd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18fd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x18fd('0x3'));var sox=require(_0x18fd('0x4'));var csv=require(_0x18fd('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18fd('0x6'));var _=require(_0x18fd('0x7'));var squel=require(_0x18fd('0x8'));var crypto=require('crypto');var jsforce=require(_0x18fd('0x9'));var deskjs=require(_0x18fd('0xa'));var toCsv=require(_0x18fd('0x5'));var querystring=require(_0x18fd('0xb'));var Papa=require(_0x18fd('0xc'));var Redis=require(_0x18fd('0xd'));var authService=require(_0x18fd('0xe'));var qs=require(_0x18fd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18fd('0x10'));var logger=require(_0x18fd('0x11'))('api');var utils=require(_0x18fd('0x12'));var config=require(_0x18fd('0x13'));var licenseUtil=require(_0x18fd('0x14'));var db=require(_0x18fd('0x15'))['db'];function respondWithStatusCode(_0x57e2dc,_0x325ed3){_0x325ed3=_0x325ed3||0xcc;return function(_0x3bfc93){if(_0x3bfc93){return _0x57e2dc[_0x18fd('0x16')](_0x325ed3);}return _0x57e2dc[_0x18fd('0x17')](_0x325ed3)['end']();};}function respondWithResult(_0x16092b,_0xee7548){_0xee7548=_0xee7548||0xc8;return function(_0x3d998b){if(_0x3d998b){return _0x16092b[_0x18fd('0x17')](_0xee7548)['json'](_0x3d998b);}};}function respondWithFilteredResult(_0x280188,_0x1f2689){return function(_0x37ff6b){if(_0x37ff6b){var _0xa24f40=typeof _0x1f2689[_0x18fd('0x18')]==='undefined'&&typeof _0x1f2689['limit']==='undefined';var _0x1bd9c8=_0x37ff6b['count'];var _0x3d6d8f=_0xa24f40?0x0:_0x1f2689[_0x18fd('0x18')];var _0x1adbe1=_0xa24f40?_0x37ff6b[_0x18fd('0x19')]:_0x1f2689['offset']+_0x1f2689[_0x18fd('0x1a')];var _0x4827c7;if(_0x1adbe1>=_0x1bd9c8){_0x1adbe1=_0x1bd9c8;_0x4827c7=0xc8;}else{_0x4827c7=0xce;}_0x280188[_0x18fd('0x17')](_0x4827c7);return _0x280188[_0x18fd('0x1b')]('Content-Range',_0x3d6d8f+'-'+_0x1adbe1+'/'+_0x1bd9c8)[_0x18fd('0x1c')](_0x37ff6b);}return null;};}function patchUpdates(_0x4a068c){return function(_0x522c9c){try{jsonpatch[_0x18fd('0x1d')](_0x522c9c,_0x4a068c,!![]);}catch(_0x3fa8f8){return BPromise[_0x18fd('0x1e')](_0x3fa8f8);}return _0x522c9c[_0x18fd('0x1f')]();};}function saveUpdates(_0x1538b6,_0x4eb907){return function(_0x3b1054){if(_0x3b1054){return _0x3b1054[_0x18fd('0x20')](_0x1538b6)[_0x18fd('0x21')](function(_0x273644){return _0x273644;});}return null;};}function removeEntity(_0x325a04,_0x4c4caf){return function(_0x15ab21){if(_0x15ab21){return _0x15ab21['destroy']()[_0x18fd('0x21')](function(){_0x325a04[_0x18fd('0x17')](0xcc)[_0x18fd('0x22')]();});}};}function handleEntityNotFound(_0x449ec3,_0x5f3f54){return function(_0x1c63f5){if(!_0x1c63f5){_0x449ec3[_0x18fd('0x16')](0x194);}return _0x1c63f5;};}function handleError(_0x18b3ce,_0xc00aa3){_0xc00aa3=_0xc00aa3||0x1f4;return function(_0x311fcb){logger['error'](_0x311fcb[_0x18fd('0x23')]);if(_0x311fcb[_0x18fd('0x24')]){delete _0x311fcb[_0x18fd('0x24')];}_0x18b3ce[_0x18fd('0x17')](_0xc00aa3)[_0x18fd('0x25')](_0x311fcb);};}function getMustacheRender(_0x42fa04,_0x25ad74){return Mustache['render'](_0x42fa04,_[_0x18fd('0x26')](_0x25ad74['body'],{'contact':_0x25ad74[_0x18fd('0x27')],'message':_0x25ad74[_0x18fd('0x28')],'agent':_0x25ad74[_0x18fd('0x29')],'interaction':_0x25ad74[_0x18fd('0x2a')],'account':_0x25ad74['account']}))||'';}exports['show']=function(_0x17f988,_0x38baa4){var _0x5a6c89={'raw':!![],'where':{'id':_0x17f988[_0x18fd('0x2b')]['id']}},_0x45812a={};_0x45812a[_0x18fd('0x2c')]=_[_0x18fd('0x2d')](db['MailApplication'][_0x18fd('0x2e')]);_0x45812a['query']=_[_0x18fd('0x2d')](_0x17f988['query']);_0x45812a[_0x18fd('0x2f')]=_['intersection'](_0x45812a[_0x18fd('0x2c')],_0x45812a[_0x18fd('0x30')]);_0x5a6c89[_0x18fd('0x31')]=_[_0x18fd('0x32')](_0x45812a[_0x18fd('0x2c')],qs[_0x18fd('0x33')](_0x17f988[_0x18fd('0x30')][_0x18fd('0x33')]));_0x5a6c89[_0x18fd('0x31')]=_0x5a6c89[_0x18fd('0x31')][_0x18fd('0x34')]?_0x5a6c89[_0x18fd('0x31')]:_0x45812a['model'];if(_0x17f988['query'][_0x18fd('0x35')]){_0x5a6c89[_0x18fd('0x36')]=[{'all':!![]}];}_0x5a6c89=_['merge']({},_0x5a6c89,_0x17f988['options']);return db[_0x18fd('0x37')]['find'](_0x5a6c89)['then'](handleEntityNotFound(_0x38baa4,null))[_0x18fd('0x21')](respondWithResult(_0x38baa4,null))[_0x18fd('0x38')](handleError(_0x38baa4,null));};exports['update']=function(_0x5b360d,_0x47e31b){if(_0x5b360d[_0x18fd('0x39')]['id']){delete _0x5b360d[_0x18fd('0x39')]['id'];}return db[_0x18fd('0x37')][_0x18fd('0x3a')]({'where':{'id':_0x5b360d[_0x18fd('0x2b')]['id']}})[_0x18fd('0x21')](handleEntityNotFound(_0x47e31b,null))[_0x18fd('0x21')](saveUpdates(_0x5b360d[_0x18fd('0x39')],null))[_0x18fd('0x21')](respondWithResult(_0x47e31b,null))[_0x18fd('0x38')](handleError(_0x47e31b,null));};exports['destroy']=function(_0x58b7fb,_0x1df000){return db[_0x18fd('0x37')][_0x18fd('0x3a')]({'where':{'id':_0x58b7fb[_0x18fd('0x2b')]['id']}})[_0x18fd('0x21')](handleEntityNotFound(_0x1df000,null))[_0x18fd('0x21')](removeEntity(_0x1df000,null))[_0x18fd('0x38')](handleError(_0x1df000,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5351e11..f8ecd95 100644 --- a/server/api/mailApplication/mailApplication.model.js +++ b/server/api/mailApplication/mailApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa958=['exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./mailApplication.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa958,0x94));var _0x8a95=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa958[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var logger=require(_0x8a95('0x1'))(_0x8a95('0x2'));var moment=require(_0x8a95('0x3'));var BPromise=require(_0x8a95('0x4'));var rp=require(_0x8a95('0x5'));var fs=require('fs');var path=require(_0x8a95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a95('0x7'));module[_0x8a95('0x8')]=function(_0x403364,_0x141f82){return _0x403364[_0x8a95('0x9')](_0x8a95('0xa'),attributes,{'tableName':_0x8a95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8a95('0xc')});}; \ No newline at end of file +var _0x471a=['utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','MailApplication','mail_applications'];(function(_0x56da5a,_0x37e3b2){var _0x2229b0=function(_0xe56dee){while(--_0xe56dee){_0x56da5a['push'](_0x56da5a['shift']());}};_0x2229b0(++_0x37e3b2);}(_0x471a,0x18d));var _0xa471=function(_0x21b293,_0x352a44){_0x21b293=_0x21b293-0x0;var _0xd73e84=_0x471a[_0x21b293];return _0xd73e84;};'use strict';var _=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var logger=require(_0xa471('0x2'))('api');var moment=require(_0xa471('0x3'));var BPromise=require(_0xa471('0x4'));var rp=require(_0xa471('0x5'));var fs=require('fs');var path=require(_0xa471('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0xa471('0x7')]=function(_0x4de28a,_0x4942a0){return _0x4de28a['define'](_0xa471('0x8'),attributes,{'tableName':_0xa471('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa471('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index f29b7ab..d0207d8 100644 --- a/server/api/mailApplication/mailApplication.rpc.js +++ b/server/api/mailApplication/mailApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c31=['stringify','error','code','message','result','UpdateMailApplication','update','body','options','raw','where','attributes','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x1c31,0x1cd));var _0x11c3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1c31[_0x432682];return _0x463d05;};'use strict';var _=require(_0x11c3('0x0'));var util=require('util');var moment=require(_0x11c3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11c3('0x2'));var db=require(_0x11c3('0x3'))['db'];var utils=require(_0x11c3('0x4'));var logger=require(_0x11c3('0x5'))('rpc');var config=require(_0x11c3('0x6'));var jayson=require(_0x11c3('0x7'));var client=jayson[_0x11c3('0x8')][_0x11c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11a39b,_0x4244cf,_0x266e6d){return new BPromise(function(_0x1daa30,_0x5b0337){return client['request'](_0x11a39b,_0x266e6d)[_0x11c3('0xa')](function(_0x3a7c77){logger[_0x11c3('0xb')](_0x11c3('0xc'),_0x4244cf,_0x11c3('0xd'));logger['debug'](_0x11c3('0xe'),_0x4244cf,_0x11c3('0xd'),JSON[_0x11c3('0xf')](_0x3a7c77));if(_0x3a7c77[_0x11c3('0x10')]){if(_0x3a7c77[_0x11c3('0x10')][_0x11c3('0x11')]===0x1f4){logger['error'](_0x11c3('0xc'),_0x4244cf,_0x3a7c77[_0x11c3('0x10')][_0x11c3('0x12')]);return _0x5b0337(_0x3a7c77[_0x11c3('0x10')][_0x11c3('0x12')]);}logger[_0x11c3('0x10')](_0x11c3('0xc'),_0x4244cf,_0x3a7c77[_0x11c3('0x10')]['message']);return _0x1daa30(_0x3a7c77[_0x11c3('0x10')]['message']);}else{logger[_0x11c3('0xb')](_0x11c3('0xc'),_0x4244cf,_0x11c3('0xd'));_0x1daa30(_0x3a7c77[_0x11c3('0x13')][_0x11c3('0x12')]);}})['catch'](function(_0x1897eb){logger['error'](_0x11c3('0xc'),_0x4244cf,_0x1897eb);_0x5b0337(_0x1897eb);});});}exports[_0x11c3('0x14')]=function(_0x13fee6){var _0x31669c=this;return new Promise(function(_0x20edee,_0x237e97){return db['MailApplication'][_0x11c3('0x15')](_0x13fee6[_0x11c3('0x16')],{'raw':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')][_0x11c3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')][_0x11c3('0x19')]||null:null,'attributes':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')][_0x11c3('0x1a')]||null:null,'limit':_0x13fee6[_0x11c3('0x17')]?_0x13fee6[_0x11c3('0x17')]['limit']||null:null})['then'](function(_0x2b1fc3){logger[_0x11c3('0xb')]('UpdateMailApplication',_0x13fee6);logger['debug'](_0x11c3('0x14'),_0x13fee6,JSON[_0x11c3('0xf')](_0x2b1fc3));_0x20edee(_0x2b1fc3);})[_0x11c3('0x1b')](function(_0x2eb682){logger[_0x11c3('0x10')](_0x11c3('0x14'),_0x2eb682[_0x11c3('0x12')],_0x13fee6);_0x237e97(_0x31669c[_0x11c3('0x10')](0x1f4,_0x2eb682[_0x11c3('0x12')]));});});}; \ No newline at end of file +var _0x25b3=['MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailApplication','body','options','raw','where','attributes','limit','UpdateMailApplication','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','debug'];(function(_0x4e668b,_0x35b443){var _0xba75aa=function(_0x2d1e29){while(--_0x2d1e29){_0x4e668b['push'](_0x4e668b['shift']());}};_0xba75aa(++_0x35b443);}(_0x25b3,0xe9));var _0x325b=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0x25b3[_0x59b2a1];return _0x4908d1;};'use strict';var _=require(_0x325b('0x0'));var util=require(_0x325b('0x1'));var moment=require(_0x325b('0x2'));var BPromise=require(_0x325b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x325b('0x4'))['db'];var utils=require(_0x325b('0x5'));var logger=require('../../config/logger')(_0x325b('0x6'));var config=require(_0x325b('0x7'));var jayson=require(_0x325b('0x8'));var client=jayson[_0x325b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4208b8,_0x231abd,_0x3e4d16){return new BPromise(function(_0x9262c4,_0x251ee8){return client[_0x325b('0xa')](_0x4208b8,_0x3e4d16)[_0x325b('0xb')](function(_0x1af0e8){logger[_0x325b('0xc')](_0x325b('0xd'),_0x231abd,'request\x20sent');logger[_0x325b('0xe')](_0x325b('0xf'),_0x231abd,_0x325b('0x10'),JSON[_0x325b('0x11')](_0x1af0e8));if(_0x1af0e8[_0x325b('0x12')]){if(_0x1af0e8[_0x325b('0x12')][_0x325b('0x13')]===0x1f4){logger[_0x325b('0x12')](_0x325b('0xd'),_0x231abd,_0x1af0e8[_0x325b('0x12')][_0x325b('0x14')]);return _0x251ee8(_0x1af0e8[_0x325b('0x12')][_0x325b('0x14')]);}logger[_0x325b('0x12')](_0x325b('0xd'),_0x231abd,_0x1af0e8[_0x325b('0x12')]['message']);return _0x9262c4(_0x1af0e8[_0x325b('0x12')]['message']);}else{logger['info'](_0x325b('0xd'),_0x231abd,'request\x20sent');_0x9262c4(_0x1af0e8[_0x325b('0x15')][_0x325b('0x14')]);}})[_0x325b('0x16')](function(_0x34cb33){logger[_0x325b('0x12')](_0x325b('0xd'),_0x231abd,_0x34cb33);_0x251ee8(_0x34cb33);});});}exports['UpdateMailApplication']=function(_0x2fc8e8){var _0x2e9722=this;return new Promise(function(_0x147252,_0x55f755){return db[_0x325b('0x17')]['update'](_0x2fc8e8[_0x325b('0x18')],{'raw':_0x2fc8e8[_0x325b('0x19')]?_0x2fc8e8['options'][_0x325b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fc8e8[_0x325b('0x19')]?_0x2fc8e8[_0x325b('0x19')][_0x325b('0x1b')]||null:null,'attributes':_0x2fc8e8['options']?_0x2fc8e8[_0x325b('0x19')][_0x325b('0x1c')]||null:null,'limit':_0x2fc8e8[_0x325b('0x19')]?_0x2fc8e8[_0x325b('0x19')][_0x325b('0x1d')]||null:null})[_0x325b('0xb')](function(_0x382ddb){logger['info'](_0x325b('0x1e'),_0x2fc8e8);logger['debug']('UpdateMailApplication',_0x2fc8e8,JSON[_0x325b('0x11')](_0x382ddb));_0x147252(_0x382ddb);})['catch'](function(_0x11927c){logger['error'](_0x325b('0x1e'),_0x11927c['message'],_0x2fc8e8);_0x55f755(_0x2e9722[_0x325b('0x12')](0x1f4,_0x11927c[_0x325b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a6f9360..467526d 100644 --- a/server/api/mailInteraction/index.js +++ b/server/api/mailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62cf=['getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x4c7bcc,_0x46780d){var _0x196738=function(_0x59f896){while(--_0x59f896){_0x4c7bcc['push'](_0x4c7bcc['shift']());}};_0x196738(++_0x46780d);}(_0x62cf,0x143));var _0xf62c=function(_0x2b8a54,_0x569c4d){_0x2b8a54=_0x2b8a54-0x0;var _0x2596a4=_0x62cf[_0x2b8a54];return _0x2596a4;};'use strict';var multer=require('multer');var util=require(_0xf62c('0x0'));var path=require(_0xf62c('0x1'));var timeout=require(_0xf62c('0x2'));var express=require(_0xf62c('0x3'));var router=express[_0xf62c('0x4')]();var fs_extra=require(_0xf62c('0x5'));var auth=require(_0xf62c('0x6'));var interaction=require(_0xf62c('0x7'));var config=require('../../config/environment');var controller=require(_0xf62c('0x8'));router[_0xf62c('0x9')]('/',auth[_0xf62c('0xa')](),controller[_0xf62c('0xb')]);router[_0xf62c('0x9')](_0xf62c('0xc'),auth[_0xf62c('0xa')](),controller[_0xf62c('0xd')]);router['get'](_0xf62c('0xe'),auth[_0xf62c('0xa')](),controller[_0xf62c('0xf')]);router['get'](_0xf62c('0x10'),auth['isAuthenticated'](),controller[_0xf62c('0x11')]);router[_0xf62c('0x9')](_0xf62c('0x12'),auth['isAuthenticated'](),controller[_0xf62c('0x13')]);router[_0xf62c('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf62c('0x14')](_0xf62c('0x10'),auth[_0xf62c('0xa')](),controller[_0xf62c('0x15')]);router[_0xf62c('0x14')](_0xf62c('0x16'),auth[_0xf62c('0xa')](),interaction[_0xf62c('0x17')](_0xf62c('0x18'),_0xf62c('0x19')),controller[_0xf62c('0x1a')]);router[_0xf62c('0x1b')](_0xf62c('0xe'),auth[_0xf62c('0xa')](),interaction[_0xf62c('0x17')](_0xf62c('0x18'),'mailinteraction:update'),controller[_0xf62c('0x1c')]);router[_0xf62c('0x1d')](_0xf62c('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xf62c('0x18'),_0xf62c('0x1e')),controller[_0xf62c('0x1f')]);router[_0xf62c('0x1d')]('/:id/tags',auth[_0xf62c('0xa')](),controller[_0xf62c('0x20')]);module[_0xf62c('0x21')]=router; \ No newline at end of file +var _0x8354=['mailinteraction:destroy','/:id/tags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','get','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mail'];(function(_0x906b55,_0xd89a67){var _0x141439=function(_0x73816b){while(--_0x73816b){_0x906b55['push'](_0x906b55['shift']());}};_0x141439(++_0xd89a67);}(_0x8354,0x196));var _0x4835=function(_0x218548,_0x2425bf){_0x218548=_0x218548-0x0;var _0x483340=_0x8354[_0x218548];return _0x483340;};'use strict';var multer=require(_0x4835('0x0'));var util=require('util');var path=require(_0x4835('0x1'));var timeout=require(_0x4835('0x2'));var express=require(_0x4835('0x3'));var router=express[_0x4835('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4835('0x5'));var interaction=require(_0x4835('0x6'));var config=require(_0x4835('0x7'));var controller=require(_0x4835('0x8'));router['get']('/',auth[_0x4835('0x9')](),controller[_0x4835('0xa')]);router[_0x4835('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x4835('0xc')]);router[_0x4835('0xb')]('/:id',auth[_0x4835('0x9')](),controller[_0x4835('0xd')]);router['get'](_0x4835('0xe'),auth[_0x4835('0x9')](),controller[_0x4835('0xf')]);router['get'](_0x4835('0x10'),auth[_0x4835('0x9')](),controller['download']);router[_0x4835('0x11')]('/',auth[_0x4835('0x9')](),controller[_0x4835('0x12')]);router['post'](_0x4835('0xe'),auth[_0x4835('0x9')](),controller[_0x4835('0x13')]);router[_0x4835('0x11')]('/:id/tags',auth[_0x4835('0x9')](),interaction[_0x4835('0x14')]('mail',_0x4835('0x15')),controller[_0x4835('0x16')]);router[_0x4835('0x17')]('/:id',auth[_0x4835('0x9')](),interaction[_0x4835('0x14')]('mail',_0x4835('0x18')),controller[_0x4835('0x19')]);router[_0x4835('0x1a')]('/:id',auth[_0x4835('0x9')](),interaction['tracked'](_0x4835('0x1b'),_0x4835('0x1c')),controller['destroy']);router['delete'](_0x4835('0x1d'),auth[_0x4835('0x9')](),controller['removeTags']);module[_0x4835('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3287639..9969415 100644 --- a/server/api/mailInteraction/mailInteraction.attributes.js +++ b/server/api/mailInteraction/mailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e0a=['ENUM','out','sequelize','iconv','exports','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x5e0a,0x16a));var _0xa5e0=function(_0x4744f8,_0x482233){_0x4744f8=_0x4744f8-0x0;var _0x1894b=_0x5e0a[_0x4744f8];return _0x1894b;};'use strict';var Sequelize=require(_0xa5e0('0x0'));var iconv=require(_0xa5e0('0x1'));module[_0xa5e0('0x2')]={'closed':{'type':Sequelize[_0xa5e0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa5e0('0x4')]},'secondDisposition':{'type':Sequelize[_0xa5e0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa5e0('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xa5e0('0x4')]},'cc':{'type':Sequelize[_0xa5e0('0x5')](_0xa5e0('0x6'))},'subject':{'type':Sequelize[_0xa5e0('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xa5e0('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xa5e0('0x7')]},'firstMsgDirection':{'type':Sequelize[_0xa5e0('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa5e0('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xa5e0('0x8')]('in',_0xa5e0('0x9')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb9e7=['exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','iconv'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x20aae1,_0x51efd4){_0x20aae1=_0x20aae1-0x0;var _0x510601=_0xb9e7[_0x20aae1];return _0x510601;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x7b9e('0x0'));module[_0x7b9e('0x1')]={'closed':{'type':Sequelize[_0x7b9e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b9e('0x3')]},'disposition':{'type':Sequelize[_0x7b9e('0x4')]},'secondDisposition':{'type':Sequelize[_0x7b9e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7b9e('0x4')]},'inReplyTo':{'type':Sequelize[_0x7b9e('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7b9e('0x5')]('long')},'subject':{'type':Sequelize[_0x7b9e('0x5')]()},'attach':{'type':Sequelize[_0x7b9e('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7b9e('0x3')]},'substatus':{'type':Sequelize[_0x7b9e('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x7b9e('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b9e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7b9e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7b9e('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 5dcae50..fcb5d88 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0360=['parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','MailAccountId','createdAt','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','includeAll','include','options','catch','create','params','describe','addMessage','ids','omit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','spread','emit','mailInteractionTags:save','unix','join','files','root','server','attachments','transcript-%d-%s.zip','push','Messages','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','juice','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','Users','map','fullname','TagIds','Tags','forEach','MailMessage','findOne','out','plainBody','-id','trimStart','MailInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','field','color','from','select','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search'];(function(_0x3193dd,_0x590238){var _0x1baffa=function(_0x2523f1){while(--_0x2523f1){_0x3193dd['push'](_0x3193dd['shift']());}};_0x1baffa(++_0x590238);}(_0x0360,0x181));var _0x0036=function(_0xf017ad,_0x12f42f){_0xf017ad=_0xf017ad-0x0;var _0x29e990=_0x0360[_0xf017ad];return _0x29e990;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0036('0x0'));var zipdir=require(_0x0036('0x1'));var jsonpatch=require(_0x0036('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0036('0x3'));var Mustache=require('mustache');var util=require(_0x0036('0x4'));var path=require('path');var sox=require(_0x0036('0x5'));var csv=require(_0x0036('0x6'));var ejs=require(_0x0036('0x7'));var fs=require('fs');var fs_extra=require(_0x0036('0x8'));var _=require('lodash');var squel=require(_0x0036('0x9'));var crypto=require('crypto');var jsforce=require(_0x0036('0xa'));var deskjs=require(_0x0036('0xb'));var toCsv=require(_0x0036('0x6'));var querystring=require('querystring');var Papa=require(_0x0036('0xc'));var htmlToText=require('html-to-text');var juice=require(_0x0036('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0036('0xe'));var hardwareService=require(_0x0036('0xf'));var logger=require(_0x0036('0x10'))(_0x0036('0x11'));var utils=require('../../config/utils');var config=require(_0x0036('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0036('0x13'))['db'];config[_0x0036('0x14')]=_[_0x0036('0x15')](config[_0x0036('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x0036('0x16'))(new Redis(config[_0x0036('0x14')]));require(_0x0036('0x17'))[_0x0036('0x18')](socket);function respondWithStatusCode(_0x4ec321,_0x186ce1){_0x186ce1=_0x186ce1||0xcc;return function(_0x421e62){if(_0x421e62){return _0x4ec321[_0x0036('0x19')](_0x186ce1);}return _0x4ec321[_0x0036('0x1a')](_0x186ce1)['end']();};}function respondWithResult(_0x578b9d,_0x3cff4b){_0x3cff4b=_0x3cff4b||0xc8;return function(_0x3905b4){if(_0x3905b4){return _0x578b9d[_0x0036('0x1a')](_0x3cff4b)[_0x0036('0x1b')](_0x3905b4);}};}function respondWithFilteredResult(_0x4b9421,_0xde2c32){return function(_0x47d490){if(_0x47d490){var _0x5be1de=typeof _0xde2c32[_0x0036('0x1c')]===_0x0036('0x1d')&&typeof _0xde2c32[_0x0036('0x1e')]===_0x0036('0x1d');var _0x2dab73=_0x47d490[_0x0036('0x1f')];var _0x592007=_0x5be1de?0x0:_0xde2c32[_0x0036('0x1c')];var _0x33b6f9=_0x5be1de?_0x47d490['count']:_0xde2c32[_0x0036('0x1c')]+_0xde2c32['limit'];var _0x369e1a;if(_0x33b6f9>=_0x2dab73){_0x33b6f9=_0x2dab73;_0x369e1a=0xc8;}else{_0x369e1a=0xce;}_0x4b9421['status'](_0x369e1a);return _0x4b9421[_0x0036('0x20')](_0x0036('0x21'),_0x592007+'-'+_0x33b6f9+'/'+_0x2dab73)[_0x0036('0x1b')](_0x47d490);}return null;};}function patchUpdates(_0x172d6d){return function(_0x58a88b){try{jsonpatch[_0x0036('0x22')](_0x58a88b,_0x172d6d,!![]);}catch(_0x39b614){return BPromise[_0x0036('0x23')](_0x39b614);}return _0x58a88b['save']();};}function saveUpdates(_0x5a06b3,_0x4a59cd){return function(_0x181034){if(_0x181034){return _0x181034[_0x0036('0x24')](_0x5a06b3)[_0x0036('0x25')](function(_0x54603b){return _0x54603b;});}return null;};}function removeEntity(_0x30100a,_0x4fc74e){return function(_0x4cf1af){if(_0x4cf1af){return _0x4cf1af[_0x0036('0x26')]()['then'](function(){_0x30100a[_0x0036('0x1a')](0xcc)[_0x0036('0x27')]();});}};}function handleEntityNotFound(_0x3a3b9e,_0x479d07){return function(_0x33da67){if(!_0x33da67){_0x3a3b9e[_0x0036('0x19')](0x194);}return _0x33da67;};}function handleError(_0x385ba6,_0x242a5d){_0x242a5d=_0x242a5d||0x1f4;return function(_0x3a767b){logger[_0x0036('0x28')](_0x3a767b[_0x0036('0x29')]);if(_0x3a767b[_0x0036('0x2a')]){delete _0x3a767b[_0x0036('0x2a')];}_0x385ba6[_0x0036('0x1a')](_0x242a5d)[_0x0036('0x2b')](_0x3a767b);};}function getMustacheRender(_0x4e8faf,_0x57df2a){return Mustache[_0x0036('0x2c')](_0x4e8faf,_[_0x0036('0x2d')](_0x57df2a[_0x0036('0x2e')],{'contact':_0x57df2a[_0x0036('0x2f')],'message':_0x57df2a[_0x0036('0x30')],'agent':_0x57df2a[_0x0036('0x31')],'interaction':_0x57df2a[_0x0036('0x32')],'account':_0x57df2a[_0x0036('0x33')]}))||'';}function getInteractionUsers(_0x16c65f,_0x4078c4){return new BPromise(function(_0x1d7120,_0x4a9877){try{if(_0x4078c4[_0x16c65f['id']]){_0x16c65f[_0x0036('0x34')]=_[_0x0036('0x35')](_0x4078c4[_0x16c65f['id']],function(_0x5122c2){return{'id':_0x5122c2['id'],'fullname':_0x5122c2[_0x0036('0x36')]};});}}catch(_0x319874){_0x4a9877(_0x319874);}_0x1d7120(_0x16c65f);});}function getInteractionTags(_0x3ee814,_0x53423a){return new BPromise(function(_0x412773,_0x571143){try{if(_0x3ee814[_0x0036('0x37')]){_0x3ee814[_0x0036('0x38')]=[];_0x3ee814['TagIds']['split'](',')[_0x0036('0x39')](function(_0x310039){_0x3ee814['Tags']['push'](_0x53423a[_0x310039]);});}delete _0x3ee814[_0x0036('0x37')];}catch(_0xec0db3){_0x571143(_0xec0db3);}_0x412773(_0x3ee814);});}function getLastMessageText(_0x30b82c){return new BPromise(function(_0xf33aa7,_0xc3e366){return db[_0x0036('0x3a')][_0x0036('0x3b')]({'where':{'$and':[{'MailInteractionId':_0x30b82c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0036('0x3c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0036('0x3d')],'order':_0x0036('0x3e'),'raw':!![]})[_0x0036('0x25')](function(_0x51c03e){if(_0x51c03e&&_0x51c03e[_0x0036('0x3d')]){_0x30b82c['lastMsgText']=_[_0x0036('0x3f')](_0x51c03e['plainBody']);}_0xf33aa7(_0x30b82c);})['catch'](function(_0x7b4b78){_0xc3e366(_0x7b4b78);});});}function updateMailInteraction(_0x555e3e,_0x26dc8f,_0x4d9c8f,_0x2ba52a){return new BPromise(function(_0x5c1e79,_0x3e96f9){return getInteractionUsers(_0x555e3e,_0x4d9c8f)[_0x0036('0x25')](function(_0x23fb99){return getInteractionTags(_0x23fb99,_0x26dc8f);})[_0x0036('0x25')](function(_0x59d99b){if(_0x2ba52a){_0x5c1e79(getLastMessageText(_0x59d99b));}else{_0x5c1e79(_0x59d99b);}})['catch'](function(_0x970cc4){_0x3e96f9(_0x970cc4);});});}exports['index']=function(_0x1da95c,_0x9cdeb2){var _0x550d11={},_0x406afd={},_0x519ff3={'count':0x0,'rows':[]};var _0x2082a3=_[_0x0036('0x35')](db[_0x0036('0x40')][_0x0036('0x41')],function(_0x3ab8d8){return{'name':_0x3ab8d8[_0x0036('0x42')],'type':_0x3ab8d8[_0x0036('0x43')][_0x0036('0x44')]};});_0x406afd[_0x0036('0x45')]=_[_0x0036('0x35')](_0x2082a3,_0x0036('0x2a'));_0x406afd['query']=_[_0x0036('0x46')](_0x1da95c[_0x0036('0x47')]);_0x406afd[_0x0036('0x48')]=_[_0x0036('0x49')](_0x406afd['model'],_0x406afd[_0x0036('0x47')]);_0x550d11[_0x0036('0x4a')]=_[_0x0036('0x49')](_0x406afd[_0x0036('0x45')],qs[_0x0036('0x4b')](_0x1da95c['query'][_0x0036('0x4b')]));_0x550d11['attributes']=_0x550d11['attributes'][_0x0036('0x4c')]?_0x550d11[_0x0036('0x4a')]:_0x406afd[_0x0036('0x45')];if(!_0x1da95c[_0x0036('0x47')][_0x0036('0x4d')](_0x0036('0x4e'))){_0x550d11[_0x0036('0x1e')]=qs[_0x0036('0x1e')](_0x1da95c[_0x0036('0x47')][_0x0036('0x1e')]);_0x550d11[_0x0036('0x1c')]=qs[_0x0036('0x1c')](_0x1da95c[_0x0036('0x47')][_0x0036('0x1c')]);}_0x550d11[_0x0036('0x4f')]=qs[_0x0036('0x50')](_0x1da95c['query'][_0x0036('0x50')]);_0x550d11['where']=qs['filters'](_['pick'](_0x1da95c['query'],_0x406afd[_0x0036('0x48')]),_0x2082a3);var _0x3605b3=[];var _0xbf8c17=squel['select']()[_0x0036('0x51')]('id')[_0x0036('0x51')](_0x0036('0x2a'))[_0x0036('0x51')](_0x0036('0x52'))[_0x0036('0x53')]('tools_tags');var _0xc3009b=squel[_0x0036('0x54')]()[_0x0036('0x51')](_0x0036('0x55'))[_0x0036('0x51')](_0x0036('0x56'))['field'](_0x0036('0x57'))[_0x0036('0x53')]('user_has_mail_interactions','ui')[_0x0036('0x58')](_0x0036('0x59'),'u',_0x0036('0x5a'));var _0x30d9ad=squel[_0x0036('0x54')]()[_0x0036('0x53')](_0x0036('0x5b'),'i')[_0x0036('0x58')]('cm_contacts','c',_0x0036('0x5c'))[_0x0036('0x58')](_0x0036('0x59'),'o',_0x0036('0x5d'))['left_join'](_0x0036('0x5e'),'a',_0x0036('0x5f'))[_0x0036('0x58')]('mail_messages','me',_0x0036('0x60'))[_0x0036('0x58')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0x0036('0x58')](_0x0036('0x61'),'t',_0x0036('0x62'));var _0x145f03=squel['expr']();var _0x5e344f=[];var _0x23744f=squel[_0x0036('0x63')]();var _0x52a209;if(_0x1da95c[_0x0036('0x47')][_0x0036('0x64')]){_0x52a209=as[_0x0036('0x65')](_0x1da95c[_0x0036('0x47')][_0x0036('0x64')]);var _0x7d2576=_0x52a209['sqlOperator'];for(var _0x5ef39a=0x0;_0x5ef39a<_0x52a209[_0x0036('0x66')][_0x0036('0x4c')];_0x5ef39a++){var _0xbd2d34=_0x52a209['conditions'][_0x5ef39a];var _0x2cfc89='i';var _0x381b1a=_['find'](_0x2082a3,[_0x0036('0x2a'),_0xbd2d34['field']]);if(!_0x381b1a){switch(_0xbd2d34['field']){case _0x0036('0x67'):if(_0xbd2d34[_0x0036('0x68')]==0x1){_0x30d9ad[_0x0036('0x69')]('`'+_0xbd2d34['field']+_0x0036('0x6a'));}else{_0x30d9ad['having']('`'+_0xbd2d34[_0x0036('0x51')]+'`\x20>\x200');}break;case _0x0036('0x6b'):if(_0xbd2d34[_0x0036('0x6c')]==='$substring'){if(_0xbd2d34['value'][_0x0036('0x6d')]('\x20')[_0x0036('0x4c')]>0x1){_0x145f03[_0x7d2576](_0x0036('0x6e'),qs[_0x0036('0x6f')](_0xbd2d34[_0x0036('0x68')]),null);}else{var _0x32d2f0='%'+_0xbd2d34['value']+'%';_0x145f03[_0x7d2576]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x32d2f0,_0x32d2f0,_0x32d2f0);}}else{_0x381b1a=_[_0x0036('0x70')](_0x2082a3,[_0x0036('0x2a'),_0x0036('0x71')]);_0xbd2d34[_0x0036('0x51')]=_0x0036('0x71');_0x176ae2=as[_0x0036('0x72')](_0x2cfc89,_0x381b1a['type'],_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2['text'],_0x176ae2[_0x0036('0x68')][_0x0036('0x73')],_0x176ae2[_0x0036('0x68')][_0x0036('0x27')]);}break;case _0x0036('0x74'):var _0xa29e41=_0xbd2d34[_0x0036('0x68')][_0x0036('0x6d')](',')[_0x0036('0x35')](function(_0x42132a){return Number(_0x42132a);});_0xa29e41[_0x0036('0x39')](function(_0x61d588){_0x23744f['or'](_0x0036('0x75'),'%,'+_0x61d588+',%');});_0x5e344f=_[_0x0036('0x76')](_0x5e344f,_0xa29e41);break;case _0x0036('0x77'):if(_0xbd2d34[_0x0036('0x6c')]===_0x0036('0x78')){_0x145f03[_0x7d2576](_0x0036('0x79'),'%'+_0xbd2d34[_0x0036('0x68')]+'%',null);}else{_0x381b1a=_[_0x0036('0x70')](_0x2082a3,[_0x0036('0x2a'),'UserId']);_0xbd2d34[_0x0036('0x51')]='UserId';_0x176ae2=as[_0x0036('0x72')](_0x2cfc89,_0x381b1a[_0x0036('0x43')],_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2[_0x0036('0x7a')],_0x176ae2[_0x0036('0x68')][_0x0036('0x73')],_0x176ae2[_0x0036('0x68')][_0x0036('0x27')]);}break;case _0x0036('0x3d'):_0x176ae2=as[_0x0036('0x72')]('me',null,_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2[_0x0036('0x7a')],_0x176ae2[_0x0036('0x68')]['start'],_0x176ae2[_0x0036('0x68')][_0x0036('0x27')]);break;}}else{var _0x176ae2=as[_0x0036('0x72')](_0x2cfc89,_0x381b1a['type'],_0xbd2d34);_0x145f03[_0x7d2576](_0x176ae2[_0x0036('0x7a')],_0x176ae2[_0x0036('0x68')]['start'],_0x176ae2[_0x0036('0x68')]['end']);}}}else{var _0x32c7d2=_(_0x1da95c[_0x0036('0x47')])[_0x0036('0x46')]()[_0x0036('0x35')](function(_0x217509){return _[_0x0036('0x7b')](_0x2082a3,['name',_0x217509])?_0x217509:undefined;})[_0x0036('0x7c')]()[_0x0036('0x68')]();if(!_[_0x0036('0x7d')](_0x32c7d2)){_0x32c7d2['forEach'](function(_0x4aa92f){if(_0x4aa92f===_0x0036('0x7e')){_0x30d9ad['where']('i.MailAccountId\x20IN\x20?',[]['concat'](_0x1da95c[_0x0036('0x47')][_0x4aa92f]));}else if(_0x4aa92f===_0x0036('0x7f')){var _0x52082a=JSON[_0x0036('0x80')](_0x1da95c[_0x0036('0x47')][_0x4aa92f])['$gte'];var _0x29cc1e=JSON[_0x0036('0x80')](_0x1da95c[_0x0036('0x47')][_0x4aa92f])[_0x0036('0x81')];_0x30d9ad[_0x0036('0x82')](_0x0036('0x83'),_0x52082a,_0x29cc1e);}else{if(_0x1da95c[_0x0036('0x47')][_0x4aa92f]===_0x0036('0x84')){_0x30d9ad[_0x0036('0x82')]('i.'+_0x4aa92f+'\x20IS\x20NULL');}else{_0x30d9ad['where']('i.'+_0x4aa92f+_0x0036('0x85'),_0x1da95c[_0x0036('0x47')][_0x4aa92f]);}}});}if(_0x1da95c[_0x0036('0x47')][_0x0036('0x86')]){if(_0x1da95c[_0x0036('0x47')]['read']==0x1){_0x30d9ad[_0x0036('0x69')]('`unreadMessages`\x20=\x200');}else{_0x30d9ad[_0x0036('0x69')](_0x0036('0x87'));}}if(_0x1da95c['query'][_0x0036('0x88')]){_0x5e344f=_[_0x0036('0x89')](_0x1da95c[_0x0036('0x47')][_0x0036('0x88')])?_0x1da95c[_0x0036('0x47')][_0x0036('0x88')]:new Array(_0x1da95c['query'][_0x0036('0x88')]);_0x5e344f[_0x0036('0x39')](function(_0x1295b8){_0x23744f['or'](_0x0036('0x75'),'%,'+_0x1295b8+',%');});}if(_0x1da95c[_0x0036('0x47')][_0x0036('0x8a')]){var _0x5dd363=_0x1da95c[_0x0036('0x47')][_0x0036('0x8a')][_0x0036('0x8b')]('\x5c','\x5c\x5c')[_0x0036('0x8b')](/'/g,'\x27\x27');if(qs[_0x0036('0x8c')](_0x5dd363)){_0x145f03['or']('i.id\x20LIKE\x20?',_0x5dd363+'%');}else if(qs[_0x0036('0x8d')](_0x5dd363)){_0x145f03['or'](_0x0036('0x8e'),_0x5dd363+'%');}else{_0x145f03['or'](_0x0036('0x8f'),qs[_0x0036('0x6f')](_0x5dd363))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0036('0x6f')](_0x5dd363));}}}_0x30d9ad[_0x0036('0x82')](_0x145f03);_0x30d9ad[_0x0036('0x90')](_0x0036('0x91'));var _0x3efc56={'type':db[_0x0036('0x92')][_0x0036('0x93')][_0x0036('0x94')],'raw':!![]};var _0x3ec91c=_0x30d9ad[_0x0036('0x95')]();_0x3ec91c[_0x0036('0x51')]('i.id');_0x3ec91c[_0x0036('0x51')](_0x0036('0x96'),_0x0036('0x67'));if(_0x550d11[_0x0036('0x4f')]){_0x550d11[_0x0036('0x4f')]['forEach'](function(_0x58b2f6){var _0x432396=_0x58b2f6[0x0]==='contactName'?_0x58b2f6[0x0]:'i.'+_0x58b2f6[0x0];_0x30d9ad[_0x0036('0x4f')](_0x432396,_0x58b2f6[0x1]===_0x0036('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x5e344f)){_0x30d9ad[_0x0036('0x69')](_0x23744f);_0x3ec91c[_0x0036('0x82')](_0x0036('0x98'),_0x5e344f);}BPromise[_0x0036('0x99')]()['then'](function(){if(!_0x52a209){if(_0x1da95c[_0x0036('0x47')][_0x0036('0x7e')])return;_0x3ec91c[_0x0036('0x82')](_0x0036('0x9a'));_0x30d9ad[_0x0036('0x82')](_0x0036('0x9a'));return;}if(_0x1da95c[_0x0036('0x9b')]['role']!=='agent')return;return _0x1da95c['user'][_0x0036('0x9c')]({'attributes':['id'],'raw':!![]})[_0x0036('0x25')](function(_0x1f832e){if(_[_0x0036('0x7d')](_0x1f832e)){_0x3ec91c['where'](_0x0036('0x9d'));_0x30d9ad['where'](_0x0036('0x9d'));}else{_0x3ec91c[_0x0036('0x82')](_0x0036('0x9e'),_[_0x0036('0x35')](_0x1f832e,'id'));_0x30d9ad[_0x0036('0x82')](_0x0036('0x9e'),_['map'](_0x1f832e,'id'));}});})[_0x0036('0x25')](function(){if(_0x1da95c[_0x0036('0x9b')]['role']===_0x0036('0x31')&&!_0x52a209&&!_0x1da95c['query'][_0x0036('0x7e')])return[];return db[_0x0036('0x9f')][_0x0036('0x47')](_0x3ec91c[_0x0036('0xa0')](),_0x3efc56);})[_0x0036('0x25')](function(_0xe773b8){_0x519ff3[_0x0036('0x1f')]=_0xe773b8[_0x0036('0x4c')];if(_0x519ff3[_0x0036('0x1f')]===0x0)return[];return db['sequelize']['query'](_0xbf8c17[_0x0036('0xa0')](),_0x3efc56)[_0x0036('0x25')](function(_0x44dac3){_0x3605b3=_[_0x0036('0xa1')](_0x44dac3,'id');_0x3efc56=_[_0x0036('0x2d')](_0x3efc56,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1da95c[_0x0036('0x47')][_0x0036('0x4b')]){_0x550d11['attributes'][_0x0036('0x39')](function(_0x1de7e3){_0x30d9ad['field']('i.'+_0x1de7e3);});}else{_0x30d9ad[_0x0036('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0036('0x67'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa2'),_0x0036('0xa3'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa4'),_0x0036('0xa5'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa6'),_0x0036('0xa7'));_0x30d9ad[_0x0036('0x51')](_0x0036('0x91'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xa8'));_0x30d9ad[_0x0036('0x51')]('i.updatedAt');_0x30d9ad[_0x0036('0x51')](_0x0036('0xa9'));_0x30d9ad[_0x0036('0x51')]('i.closedAt');_0x30d9ad[_0x0036('0x51')]('i.attach');_0x30d9ad[_0x0036('0x51')](_0x0036('0xaa'));_0x30d9ad['field'](_0x0036('0xab'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xac'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xad'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xae'));_0x30d9ad[_0x0036('0x51')]('i.thirdDisposition');_0x30d9ad[_0x0036('0x51')](_0x0036('0xaf'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb0'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb1'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb2'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb3'));_0x30d9ad['field'](_0x0036('0xb4'),_0x0036('0xb5'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb6'),'Contact.lastName');_0x30d9ad[_0x0036('0x51')]('c.email',_0x0036('0xb7'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xb8'),_0x0036('0xb9'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xba'),'Contact.mobile');_0x30d9ad[_0x0036('0x51')]('c.fax','Contact.fax');_0x30d9ad['field'](_0x0036('0xbb'),'Owner.fullname');_0x30d9ad[_0x0036('0x51')]('o.internal',_0x0036('0xbc'));_0x30d9ad[_0x0036('0x51')](_0x0036('0xbd'),_0x0036('0x37'));}if(_0x550d11['limit'])_0x30d9ad[_0x0036('0x1e')](_0x550d11[_0x0036('0x1e')]);if(_0x550d11[_0x0036('0x1c')])_0x30d9ad[_0x0036('0x1c')](_0x550d11[_0x0036('0x1c')]);return db[_0x0036('0x9f')]['query'](_0x30d9ad['toString'](),_0x3efc56);})[_0x0036('0x25')](function(_0x3524d8){if(_0x3524d8[_0x0036('0x4c')]>0x0)_0xc3009b[_0x0036('0x82')](_0x0036('0xbe'),_['map'](_0x3524d8,'id'));return db['sequelize'][_0x0036('0x47')](_0xc3009b[_0x0036('0xa0')](),_0x3efc56)[_0x0036('0x25')](function(_0x4b31d2){var _0x2e9776=_[_0x0036('0xbf')](_0x4b31d2,_0x0036('0xc0'));var _0x3f116d=[];return db[_0x0036('0xc1')]['findOne']({'attributes':[_0x0036('0xc2')],'raw':!![]})[_0x0036('0x25')](function(_0xe56710){var _0xc414fd=_0xe56710[_0x0036('0xc2')];_0x3524d8[_0x0036('0x39')](function(_0x14ed82){_0x3f116d['push'](updateMailInteraction(_0x14ed82,_0x3605b3,_0x2e9776,_0xc414fd));});return BPromise[_0x0036('0xc3')](_0x3f116d);});});});})['then'](function(_0x1b2015){_0x519ff3[_0x0036('0xc4')]=_0x1b2015;return _0x519ff3;})['then'](respondWithFilteredResult(_0x9cdeb2,_0x550d11))['catch'](handleError(_0x9cdeb2,null));};exports[_0x0036('0xc5')]=function(_0x1c90f2,_0x580fe7){var _0x5451bc={'raw':![],'where':{'id':_0x1c90f2['params']['id']}},_0x344e7e={};_0x344e7e[_0x0036('0x45')]=_['keys'](db[_0x0036('0x40')]['rawAttributes']);_0x344e7e['query']=_[_0x0036('0x46')](_0x1c90f2[_0x0036('0x47')]);_0x344e7e[_0x0036('0x48')]=_[_0x0036('0x49')](_0x344e7e[_0x0036('0x45')],_0x344e7e['query']);_0x5451bc[_0x0036('0x4a')]=_['intersection'](_0x344e7e[_0x0036('0x45')],qs[_0x0036('0x4b')](_0x1c90f2[_0x0036('0x47')][_0x0036('0x4b')]));_0x5451bc['attributes']=_0x5451bc['attributes'][_0x0036('0x4c')]?_0x5451bc[_0x0036('0x4a')]:_0x344e7e[_0x0036('0x45')];if(_0x1c90f2[_0x0036('0x47')][_0x0036('0xc6')]){_0x5451bc[_0x0036('0xc7')]=[{'all':!![]}];}_0x5451bc=_['merge']({},_0x5451bc,_0x1c90f2[_0x0036('0xc8')]);return db[_0x0036('0x40')][_0x0036('0x70')](_0x5451bc)[_0x0036('0x25')](handleEntityNotFound(_0x580fe7,null))[_0x0036('0x25')](respondWithResult(_0x580fe7,null))[_0x0036('0xc9')](handleError(_0x580fe7,null));};exports[_0x0036('0xca')]=function(_0x1b4b24,_0x1430df){return db['MailInteraction'][_0x0036('0xca')](_0x1b4b24[_0x0036('0x2e')],{})[_0x0036('0x25')](respondWithResult(_0x1430df,0xc9))['catch'](handleError(_0x1430df,null));};exports[_0x0036('0x24')]=function(_0x397c3f,_0x5a58fd){if(_0x397c3f[_0x0036('0x2e')]['id']){delete _0x397c3f[_0x0036('0x2e')]['id'];}return db[_0x0036('0x40')]['find']({'where':{'id':_0x397c3f[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x5a58fd,null))[_0x0036('0x25')](saveUpdates(_0x397c3f['body'],null))[_0x0036('0x25')](respondWithResult(_0x5a58fd,null))[_0x0036('0xc9')](handleError(_0x5a58fd,null));};exports[_0x0036('0x26')]=function(_0x5f07bb,_0x441ccc){return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x5f07bb[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x441ccc,null))[_0x0036('0x25')](removeEntity(_0x441ccc,null))[_0x0036('0xc9')](handleError(_0x441ccc,null));};exports[_0x0036('0xcc')]=function(_0x13c628,_0x1cf9fc){return db[_0x0036('0x40')][_0x0036('0xcc')]()[_0x0036('0x25')](respondWithResult(_0x1cf9fc,null))[_0x0036('0xc9')](handleError(_0x1cf9fc,null));};exports[_0x0036('0xcd')]=function(_0x3ce8a3,_0x1ecf54,_0x47adda){return db[_0x0036('0x3a')]['find']({'where':{'id':_0x3ce8a3[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x1ecf54,null))[_0x0036('0x25')](function(_0x3344f5){if(_0x3344f5){return _0x3344f5['addMessage'](_0x3ce8a3[_0x0036('0x2e')][_0x0036('0xce')],_[_0x0036('0xcf')](_0x3ce8a3[_0x0036('0x2e')],[_0x0036('0xce'),'id'])||{});}})['then'](respondWithResult(_0x1ecf54,null))['catch'](handleError(_0x1ecf54,null));};exports['getMessages']=function(_0x5f1e2d,_0xc9cb48,_0x40ad95){var _0x5b2527={'raw':![],'where':{}};var _0x338f46={};var _0x47179f={'count':0x0,'rows':[]};return db[_0x0036('0x40')]['findOne']({'where':{'id':_0x5f1e2d[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0xc9cb48,null))[_0x0036('0x25')](function(_0x2ab355){if(_0x2ab355){_0x338f46[_0x0036('0x45')]=_[_0x0036('0x46')](db[_0x0036('0x3a')][_0x0036('0x41')]);_0x338f46[_0x0036('0x47')]=_['keys'](_0x5f1e2d[_0x0036('0x47')]);_0x338f46[_0x0036('0x48')]=_[_0x0036('0x49')](_0x338f46[_0x0036('0x45')],_0x338f46[_0x0036('0x47')]);_0x5b2527['attributes']=_['intersection'](_0x338f46['model'],qs[_0x0036('0x4b')](_0x5f1e2d[_0x0036('0x47')][_0x0036('0x4b')]));_0x5b2527[_0x0036('0x4a')]=_0x5b2527['attributes'][_0x0036('0x4c')]?_0x5b2527[_0x0036('0x4a')]:_0x338f46['model'];if(!_0x5f1e2d[_0x0036('0x47')][_0x0036('0x4d')]('nolimit')){_0x5b2527[_0x0036('0x1e')]=qs[_0x0036('0x1e')](_0x5f1e2d['query'][_0x0036('0x1e')]);_0x5b2527[_0x0036('0x1c')]=qs['offset'](_0x5f1e2d[_0x0036('0x47')][_0x0036('0x1c')]);}_0x5b2527[_0x0036('0x4f')]=qs[_0x0036('0x50')](_0x5f1e2d[_0x0036('0x47')][_0x0036('0x50')]);_0x5b2527[_0x0036('0x82')]=qs[_0x0036('0x48')](_[_0x0036('0xd0')](_0x5f1e2d[_0x0036('0x47')],_0x338f46[_0x0036('0x48')]));_0x5b2527[_0x0036('0x82')][_0x0036('0xc0')]=_0x2ab355['id'];if(_0x5f1e2d[_0x0036('0x47')]['filter']){_0x5b2527[_0x0036('0x82')]=_[_0x0036('0x2d')](_0x5b2527[_0x0036('0x82')],{'$or':_['map'](_0x5b2527[_0x0036('0x4a')],function(_0x108153){var _0x5f2dec={};_0x5f2dec[_0x108153]={'$like':'%'+_0x5f1e2d[_0x0036('0x47')]['filter']+'%'};return _0x5f2dec;})});}if(_0x5f1e2d['query'][_0x0036('0xd1')]){var _0x59a49e=_0x5f1e2d[_0x0036('0x47')][_0x0036('0xd1')][_0x0036('0x6d')](',');var _0x450159={};_0x450159[_0x59a49e[0x0]]={'$gte':moment(_0x59a49e[0x1])[_0x0036('0xd2')](_0x0036('0xd3'))};_0x5b2527[_0x0036('0x82')]=_['merge'](_0x5b2527['where'],_0x450159);}_0x5b2527=_[_0x0036('0x2d')]({},_0x5b2527,_0x5f1e2d[_0x0036('0xc8')]);return db[_0x0036('0x3a')][_0x0036('0x1f')]({'where':_0x5b2527[_0x0036('0x82')]})['then'](function(_0x434d1b){_0x47179f[_0x0036('0x1f')]=_0x434d1b;if(_0x5f1e2d[_0x0036('0x47')][_0x0036('0xc6')]){_0x5b2527['include']=[{'all':!![]}];}return db[_0x0036('0x3a')][_0x0036('0xd4')](_0x5b2527);})['then'](function(_0x46e1d5){if(_0x5f1e2d[_0x0036('0x47')][_0x0036('0xd5')]===_0x0036('0xd6')){for(var _0x2e2c11=0x0;_0x2e2c11<_0x46e1d5[_0x0036('0x4c')];_0x2e2c11++){_0x46e1d5[_0x2e2c11]['body']=juice(_0x46e1d5[_0x2e2c11]['body']);}}_0x47179f[_0x0036('0xc4')]=_0x46e1d5;return _0x47179f;});}})[_0x0036('0x25')](respondWithFilteredResult(_0xc9cb48,_0x5b2527))[_0x0036('0xc9')](handleError(_0xc9cb48,null));};exports[_0x0036('0xd7')]=function(_0x59e51c,_0x42e91c,_0x24a41d){return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x59e51c[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x42e91c,null))[_0x0036('0x25')](function(_0x679bb){if(_0x679bb){return _0x679bb['setTags'](_0x59e51c['body'][_0x0036('0xce')],_[_0x0036('0xcf')](_0x59e51c['body'],[_0x0036('0xce'),'id'])||{})[_0x0036('0xd8')](function(){return db[_0x0036('0x74')]['findAll']({'attributes':['id',_0x0036('0x2a'),'color'],'where':{'id':_0x59e51c[_0x0036('0x2e')][_0x0036('0xce')]}});})[_0x0036('0x25')](function(_0x1f933d){socket[_0x0036('0xd9')](_0x0036('0xda'),{'id':Number(_0x59e51c[_0x0036('0xcb')]['id']),'tags':_0x1f933d||[]});return{'id':Number(_0x59e51c[_0x0036('0xcb')]['id']),'tags':_0x1f933d||[]};});}})[_0x0036('0x25')](respondWithResult(_0x42e91c,null))['catch'](handleError(_0x42e91c,null));};exports['removeTags']=function(_0x47fd14,_0x4c31a0,_0xc885ee){return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x47fd14[_0x0036('0xcb')]['id']}})[_0x0036('0x25')](handleEntityNotFound(_0x4c31a0,null))['then'](function(_0x4d9f73){if(_0x4d9f73){return _0x4d9f73['removeTags'](_0x47fd14[_0x0036('0x47')][_0x0036('0xce')]);}})[_0x0036('0x25')](respondWithStatusCode(_0x4c31a0,null))[_0x0036('0xc9')](handleError(_0x4c31a0,null));};exports['download']=function(_0x269613,_0x300446){var _0xa88dc9=moment()[_0x0036('0xdb')]()[_0x0036('0xa0')]();var _0x2c1104=path[_0x0036('0xdc')](config['root'],'server',_0x0036('0xdd'),'tmp');var _0x372ea9=path[_0x0036('0xdc')](config[_0x0036('0xde')],_0x0036('0xdf'),_0x0036('0xdd'),_0x0036('0xe0'));var _0x2b9764=path[_0x0036('0xdc')](_0x2c1104,_0xa88dc9);var _0x7257d5=util[_0x0036('0xd2')](_0x0036('0xe1'),_0x269613[_0x0036('0xcb')]['id'],_0xa88dc9);var _0xbf296d=path[_0x0036('0xdc')](_0x2c1104,_0x7257d5);var _0x40161e=[];if(_0x269613['query']['attachments']){_0x40161e[_0x0036('0xe2')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x1ffbd2=[{'model':db[_0x0036('0x3a')],'as':_0x0036('0xe3'),'attributes':['id','body',_0x0036('0x53'),'to','cc','bcc',_0x0036('0xe4'),'createdAt'],'where':{'secret':![]},'order':qs[_0x0036('0x50')]('id'),'include':_0x40161e}];return db[_0x0036('0x40')][_0x0036('0x70')]({'where':{'id':_0x269613[_0x0036('0xcb')]['id']},'include':_0x1ffbd2})['then'](handleEntityNotFound(_0x300446,null))[_0x0036('0x25')](function(_0xa4b36c){if(_0xa4b36c&&_0xa4b36c[_0x0036('0xe3')]){var _0x55777b=_0xa4b36c[_0x0036('0xe5')]({'plain':!![]});fs[_0x0036('0xe6')](_0x2b9764);return BPromise[_0x0036('0xe7')](_0x55777b[_0x0036('0xe3')],function(_0xffaf8d,_0x15b0ea){var _0x1a0d28={'from':_0xffaf8d['from'],'to':_0xffaf8d['to'],'subject':_0xffaf8d[_0x0036('0xe4')],'html':_0xffaf8d[_0x0036('0x2e')],'headers':{'Date':moment(_0xffaf8d['createdAt'])[_0x0036('0xd2')](_0x0036('0xe8'))},'attachments':[]};if(_0xffaf8d['cc']){_0x1a0d28['headers']['Cc']=_0xffaf8d['cc'];}if(_0xffaf8d['bcc']){_0x1a0d28[_0x0036('0xe9')]['Bcc']=_0xffaf8d[_0x0036('0xea')];}return new BPromise(function(_0x57643a,_0x1f0ea6){if(_0xffaf8d[_0x0036('0xeb')]){for(var _0x1ac0bb=0x0;_0x1ac0bb<_0xffaf8d[_0x0036('0xeb')][_0x0036('0x4c')];_0x1ac0bb++){var _0x3ff740=_0xffaf8d['Attachments'][_0x1ac0bb];var _0x437f02=path[_0x0036('0xdc')](_0x372ea9,_0x3ff740[_0x0036('0xec')]);if(fs[_0x0036('0xed')](_0x437f02)){_0x1a0d28[_0x0036('0xe0')]['push']({'name':_0x3ff740[_0x0036('0x2a')],'contentType':_0x3ff740[_0x0036('0x43')],'data':fs[_0x0036('0xee')](_0x437f02)});}}}emlformat[_0x0036('0xef')](_0x1a0d28,function(_0x479527,_0x391f47){if(_0x479527)return _0x1f0ea6(_0x479527);fs[_0x0036('0xf0')](path[_0x0036('0xdc')](_0x2b9764,util[_0x0036('0xd2')]('message%d.eml',_0x15b0ea)),_0x391f47);return _0x57643a(_0x391f47);});});})['then'](function(){return new BPromise(function(_0x5bcb43,_0x337db6){zipdir(_0x2b9764,{'saveTo':_0xbf296d},function(_0x2bdf31,_0x3b3a44){if(_0x2bdf31)return _0x337db6(_0x2bdf31);return _0x5bcb43(_0x3b3a44);});})[_0x0036('0x25')](function(){return new BPromise(function(_0x253267,_0x44b119){rimraf(_0x2b9764,function(_0x5b01ad){if(_0x5b01ad)_0x44b119(_0x5b01ad);return _0x253267();});});})[_0x0036('0x25')](function(){return _0x300446['download'](_0xbf296d,_0x7257d5,function(_0xa84a18){if(_0xa84a18){console['log'](_0x0036('0xf1'),_0xa84a18);}else{fs[_0x0036('0xf2')](_0xbf296d);}});});});}else{return _0x300446['sendStatus'](0xc8);}})[_0x0036('0xc9')](handleError(_0x300446,null));}; \ No newline at end of file +var _0x8d42=['search','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','MailAccountId','concat','createdAt','$gte','parse','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','MailInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','include','create','describe','addMessage','ids','getMessages','hasOwnProperty','nolimit','sort','pick','format','options','findAll','true','omit','spread','color','emit','mailInteractionTags:save','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','bcc','subject','get','mkdirSync','each','Messages','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','order','where','select','field','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch'];(function(_0x2e0ffa,_0x451f12){var _0x24d627=function(_0x4d0f09){while(--_0x4d0f09){_0x2e0ffa['push'](_0x2e0ffa['shift']());}};_0x24d627(++_0x451f12);}(_0x8d42,0x18d));var _0x28d4=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x8d42[_0xf0bcac];return _0x4e4c65;};'use strict';var emlformat=require(_0x28d4('0x0'));var rimraf=require(_0x28d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28d4('0x2'));var rp=require(_0x28d4('0x3'));var moment=require(_0x28d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x28d4('0x5'));var path=require(_0x28d4('0x6'));var sox=require(_0x28d4('0x7'));var csv=require(_0x28d4('0x8'));var ejs=require(_0x28d4('0x9'));var fs=require('fs');var fs_extra=require(_0x28d4('0xa'));var _=require('lodash');var squel=require(_0x28d4('0xb'));var crypto=require(_0x28d4('0xc'));var jsforce=require(_0x28d4('0xd'));var deskjs=require(_0x28d4('0xe'));var toCsv=require(_0x28d4('0x8'));var querystring=require(_0x28d4('0xf'));var Papa=require(_0x28d4('0x10'));var htmlToText=require(_0x28d4('0x11'));var juice=require(_0x28d4('0x12'));var Redis=require(_0x28d4('0x13'));var authService=require(_0x28d4('0x14'));var qs=require(_0x28d4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28d4('0x16'));var logger=require('../../config/logger')(_0x28d4('0x17'));var utils=require(_0x28d4('0x18'));var config=require(_0x28d4('0x19'));var licenseUtil=require(_0x28d4('0x1a'));var db=require(_0x28d4('0x1b'))['db'];config[_0x28d4('0x1c')]=_[_0x28d4('0x1d')](config[_0x28d4('0x1c')],{'host':_0x28d4('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28d4('0x1c')]));require(_0x28d4('0x1f'))[_0x28d4('0x20')](socket);function respondWithStatusCode(_0x257f00,_0x2cab07){_0x2cab07=_0x2cab07||0xcc;return function(_0x4079b3){if(_0x4079b3){return _0x257f00[_0x28d4('0x21')](_0x2cab07);}return _0x257f00[_0x28d4('0x22')](_0x2cab07)[_0x28d4('0x23')]();};}function respondWithResult(_0x2aa68d,_0x40330b){_0x40330b=_0x40330b||0xc8;return function(_0x1a7918){if(_0x1a7918){return _0x2aa68d[_0x28d4('0x22')](_0x40330b)[_0x28d4('0x24')](_0x1a7918);}};}function respondWithFilteredResult(_0x4fef35,_0x42b86d){return function(_0x1436c8){if(_0x1436c8){var _0x546002=typeof _0x42b86d[_0x28d4('0x25')]==='undefined'&&typeof _0x42b86d['limit']==='undefined';var _0x5cca64=_0x1436c8[_0x28d4('0x26')];var _0x23a439=_0x546002?0x0:_0x42b86d[_0x28d4('0x25')];var _0x48ddda=_0x546002?_0x1436c8[_0x28d4('0x26')]:_0x42b86d[_0x28d4('0x25')]+_0x42b86d[_0x28d4('0x27')];var _0x165f59;if(_0x48ddda>=_0x5cca64){_0x48ddda=_0x5cca64;_0x165f59=0xc8;}else{_0x165f59=0xce;}_0x4fef35['status'](_0x165f59);return _0x4fef35['set'](_0x28d4('0x28'),_0x23a439+'-'+_0x48ddda+'/'+_0x5cca64)[_0x28d4('0x24')](_0x1436c8);}return null;};}function patchUpdates(_0x1263ff){return function(_0x24fcd1){try{jsonpatch[_0x28d4('0x29')](_0x24fcd1,_0x1263ff,!![]);}catch(_0x34db2a){return BPromise['reject'](_0x34db2a);}return _0x24fcd1['save']();};}function saveUpdates(_0x12476e,_0x4a83ba){return function(_0x25f0fc){if(_0x25f0fc){return _0x25f0fc[_0x28d4('0x2a')](_0x12476e)[_0x28d4('0x2b')](function(_0x410e7e){return _0x410e7e;});}return null;};}function removeEntity(_0x31508d,_0x18dd3d){return function(_0x45f898){if(_0x45f898){return _0x45f898[_0x28d4('0x2c')]()[_0x28d4('0x2b')](function(){_0x31508d[_0x28d4('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14cc76,_0x3aaf20){return function(_0x3d6236){if(!_0x3d6236){_0x14cc76[_0x28d4('0x21')](0x194);}return _0x3d6236;};}function handleError(_0x2002f5,_0x1ed1cb){_0x1ed1cb=_0x1ed1cb||0x1f4;return function(_0x142755){logger[_0x28d4('0x2d')](_0x142755[_0x28d4('0x2e')]);if(_0x142755['name']){delete _0x142755[_0x28d4('0x2f')];}_0x2002f5[_0x28d4('0x22')](_0x1ed1cb)[_0x28d4('0x30')](_0x142755);};}function getMustacheRender(_0x221761,_0x1804e2){return Mustache[_0x28d4('0x31')](_0x221761,_[_0x28d4('0x32')](_0x1804e2[_0x28d4('0x33')],{'contact':_0x1804e2[_0x28d4('0x34')],'message':_0x1804e2[_0x28d4('0x35')],'agent':_0x1804e2['agent'],'interaction':_0x1804e2[_0x28d4('0x36')],'account':_0x1804e2[_0x28d4('0x37')]}))||'';}function getInteractionUsers(_0x5e483d,_0x57b48d){return new BPromise(function(_0x158d45,_0x1e205a){try{if(_0x57b48d[_0x5e483d['id']]){_0x5e483d[_0x28d4('0x38')]=_[_0x28d4('0x39')](_0x57b48d[_0x5e483d['id']],function(_0x5b4e55){return{'id':_0x5b4e55['id'],'fullname':_0x5b4e55[_0x28d4('0x3a')]};});}}catch(_0x4971b4){_0x1e205a(_0x4971b4);}_0x158d45(_0x5e483d);});}function getInteractionTags(_0x27e810,_0x1f0d76){return new BPromise(function(_0x27f439,_0x10f2eb){try{if(_0x27e810[_0x28d4('0x3b')]){_0x27e810[_0x28d4('0x3c')]=[];_0x27e810[_0x28d4('0x3b')][_0x28d4('0x3d')](',')[_0x28d4('0x3e')](function(_0x4ac170){_0x27e810['Tags'][_0x28d4('0x3f')](_0x1f0d76[_0x4ac170]);});}delete _0x27e810[_0x28d4('0x3b')];}catch(_0x303309){_0x10f2eb(_0x303309);}_0x27f439(_0x27e810);});}function getLastMessageText(_0xc97a9d){return new BPromise(function(_0x1de0bb,_0x11eb12){return db[_0x28d4('0x40')][_0x28d4('0x41')]({'where':{'$and':[{'MailInteractionId':_0xc97a9d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x28d4('0x42')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x28d4('0x43')],'order':_0x28d4('0x44'),'raw':!![]})['then'](function(_0x41c4f7){if(_0x41c4f7&&_0x41c4f7['plainBody']){_0xc97a9d[_0x28d4('0x45')]=_[_0x28d4('0x46')](_0x41c4f7['plainBody']);}_0x1de0bb(_0xc97a9d);})[_0x28d4('0x47')](function(_0x586f66){_0x11eb12(_0x586f66);});});}function updateMailInteraction(_0x4c6182,_0x391bf1,_0x1465a0,_0x31096a){return new BPromise(function(_0x1bc63a,_0x1b5376){return getInteractionUsers(_0x4c6182,_0x1465a0)[_0x28d4('0x2b')](function(_0x55b15b){return getInteractionTags(_0x55b15b,_0x391bf1);})[_0x28d4('0x2b')](function(_0x361adf){if(_0x31096a){_0x1bc63a(getLastMessageText(_0x361adf));}else{_0x1bc63a(_0x361adf);}})['catch'](function(_0x554e1d){_0x1b5376(_0x554e1d);});});}exports[_0x28d4('0x48')]=function(_0x3f8167,_0x1d2a32){var _0x438cb7={},_0x50e499={},_0x3451a7={'count':0x0,'rows':[]};var _0x211383=_[_0x28d4('0x39')](db['MailInteraction'][_0x28d4('0x49')],function(_0x121177){return{'name':_0x121177[_0x28d4('0x4a')],'type':_0x121177[_0x28d4('0x4b')]['key']};});_0x50e499[_0x28d4('0x4c')]=_['map'](_0x211383,_0x28d4('0x2f'));_0x50e499[_0x28d4('0x4d')]=_[_0x28d4('0x4e')](_0x3f8167[_0x28d4('0x4d')]);_0x50e499[_0x28d4('0x4f')]=_[_0x28d4('0x50')](_0x50e499[_0x28d4('0x4c')],_0x50e499[_0x28d4('0x4d')]);_0x438cb7['attributes']=_[_0x28d4('0x50')](_0x50e499[_0x28d4('0x4c')],qs[_0x28d4('0x51')](_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x51')]));_0x438cb7[_0x28d4('0x52')]=_0x438cb7[_0x28d4('0x52')]['length']?_0x438cb7[_0x28d4('0x52')]:_0x50e499[_0x28d4('0x4c')];if(!_0x3f8167[_0x28d4('0x4d')]['hasOwnProperty']('nolimit')){_0x438cb7[_0x28d4('0x27')]=qs[_0x28d4('0x27')](_0x3f8167[_0x28d4('0x4d')]['limit']);_0x438cb7[_0x28d4('0x25')]=qs[_0x28d4('0x25')](_0x3f8167[_0x28d4('0x4d')]['offset']);}_0x438cb7[_0x28d4('0x53')]=qs['sort'](_0x3f8167[_0x28d4('0x4d')]['sort']);_0x438cb7[_0x28d4('0x54')]=qs[_0x28d4('0x4f')](_['pick'](_0x3f8167['query'],_0x50e499[_0x28d4('0x4f')]),_0x211383);var _0x2e604e=[];var _0x59493f=squel[_0x28d4('0x55')]()[_0x28d4('0x56')]('id')['field']('name')[_0x28d4('0x56')]('color')[_0x28d4('0x57')](_0x28d4('0x58'));var _0x591712=squel['select']()[_0x28d4('0x56')](_0x28d4('0x59'))[_0x28d4('0x56')](_0x28d4('0x5a'))[_0x28d4('0x56')]('ui.MailInteractionId')[_0x28d4('0x57')](_0x28d4('0x5b'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x4d2c56=squel['select']()[_0x28d4('0x57')](_0x28d4('0x5c'),'i')[_0x28d4('0x5d')](_0x28d4('0x5e'),'c',_0x28d4('0x5f'))['left_join'](_0x28d4('0x60'),'o','o.id\x20=\x20i.UserId')['left_join']('mail_accounts','a',_0x28d4('0x61'))[_0x28d4('0x5d')](_0x28d4('0x62'),'me',_0x28d4('0x63'))[_0x28d4('0x5d')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0x28d4('0x5d')]('tools_tags','t',_0x28d4('0x64'));var _0x3bdca1=squel[_0x28d4('0x65')]();var _0x4b3d54=[];var _0x1c8b60=squel['expr']();var _0x5a21a9;if(_0x3f8167['query']['search']){_0x5a21a9=as[_0x28d4('0x66')](_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x67')]);var _0x410de1=_0x5a21a9[_0x28d4('0x68')];for(var _0x2d5a95=0x0;_0x2d5a95<_0x5a21a9['conditions']['length'];_0x2d5a95++){var _0x8780c9=_0x5a21a9['conditions'][_0x2d5a95];var _0xceedd5='i';var _0x8005a5=_[_0x28d4('0x69')](_0x211383,[_0x28d4('0x2f'),_0x8780c9['field']]);if(!_0x8005a5){switch(_0x8780c9['field']){case _0x28d4('0x6a'):if(_0x8780c9[_0x28d4('0x6b')]==0x1){_0x4d2c56[_0x28d4('0x6c')]('`'+_0x8780c9[_0x28d4('0x56')]+_0x28d4('0x6d'));}else{_0x4d2c56[_0x28d4('0x6c')]('`'+_0x8780c9[_0x28d4('0x56')]+_0x28d4('0x6e'));}break;case'Contact':if(_0x8780c9[_0x28d4('0x6f')]===_0x28d4('0x70')){if(_0x8780c9[_0x28d4('0x6b')][_0x28d4('0x3d')]('\x20')[_0x28d4('0x71')]>0x1){_0x3bdca1[_0x410de1](_0x28d4('0x72'),qs[_0x28d4('0x73')](_0x8780c9[_0x28d4('0x6b')]),null);}else{var _0x3c7ad0='%'+_0x8780c9[_0x28d4('0x6b')]+'%';_0x3bdca1[_0x410de1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c7ad0,_0x3c7ad0,_0x3c7ad0);}}else{_0x8005a5=_[_0x28d4('0x69')](_0x211383,[_0x28d4('0x2f'),_0x28d4('0x74')]);_0x8780c9[_0x28d4('0x56')]='ContactId';_0x20b2b0=as['buildExpression'](_0xceedd5,_0x8005a5[_0x28d4('0x4b')],_0x8780c9);_0x3bdca1[_0x410de1](_0x20b2b0[_0x28d4('0x75')],_0x20b2b0[_0x28d4('0x6b')][_0x28d4('0x76')],_0x20b2b0[_0x28d4('0x6b')]['end']);}break;case _0x28d4('0x77'):var _0x460e80=_0x8780c9[_0x28d4('0x6b')][_0x28d4('0x3d')](',')[_0x28d4('0x39')](function(_0xb29ae1){return Number(_0xb29ae1);});_0x460e80[_0x28d4('0x3e')](function(_0x407f3e){_0x1c8b60['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x407f3e+',%');});_0x4b3d54=_['union'](_0x4b3d54,_0x460e80);break;case _0x28d4('0x78'):if(_0x8780c9['operator']===_0x28d4('0x70')){_0x3bdca1[_0x410de1](_0x28d4('0x79'),'%'+_0x8780c9[_0x28d4('0x6b')]+'%',null);}else{_0x8005a5=_['find'](_0x211383,[_0x28d4('0x2f'),_0x28d4('0x7a')]);_0x8780c9[_0x28d4('0x56')]=_0x28d4('0x7a');_0x20b2b0=as[_0x28d4('0x7b')](_0xceedd5,_0x8005a5[_0x28d4('0x4b')],_0x8780c9);_0x3bdca1[_0x410de1](_0x20b2b0['text'],_0x20b2b0['value'][_0x28d4('0x76')],_0x20b2b0['value'][_0x28d4('0x23')]);}break;case _0x28d4('0x43'):_0x20b2b0=as['buildExpression']('me',null,_0x8780c9);_0x3bdca1[_0x410de1](_0x20b2b0[_0x28d4('0x75')],_0x20b2b0[_0x28d4('0x6b')][_0x28d4('0x76')],_0x20b2b0[_0x28d4('0x6b')][_0x28d4('0x23')]);break;}}else{var _0x20b2b0=as[_0x28d4('0x7b')](_0xceedd5,_0x8005a5[_0x28d4('0x4b')],_0x8780c9);_0x3bdca1[_0x410de1](_0x20b2b0['text'],_0x20b2b0['value']['start'],_0x20b2b0[_0x28d4('0x6b')]['end']);}}}else{var _0x15f192=_(_0x3f8167[_0x28d4('0x4d')])[_0x28d4('0x4e')]()[_0x28d4('0x39')](function(_0x49278a){return _[_0x28d4('0x7c')](_0x211383,[_0x28d4('0x2f'),_0x49278a])?_0x49278a:undefined;})[_0x28d4('0x7d')]()['value']();if(!_[_0x28d4('0x7e')](_0x15f192)){_0x15f192[_0x28d4('0x3e')](function(_0x5f5350){if(_0x5f5350===_0x28d4('0x7f')){_0x4d2c56['where']('i.MailAccountId\x20IN\x20?',[][_0x28d4('0x80')](_0x3f8167[_0x28d4('0x4d')][_0x5f5350]));}else if(_0x5f5350===_0x28d4('0x81')){var _0x1d6f3c=JSON['parse'](_0x3f8167[_0x28d4('0x4d')][_0x5f5350])[_0x28d4('0x82')];var _0x453923=JSON[_0x28d4('0x83')](_0x3f8167[_0x28d4('0x4d')][_0x5f5350])[_0x28d4('0x84')];_0x4d2c56[_0x28d4('0x54')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1d6f3c,_0x453923);}else{if(_0x3f8167[_0x28d4('0x4d')][_0x5f5350]===_0x28d4('0x85')){_0x4d2c56['where']('i.'+_0x5f5350+'\x20IS\x20NULL');}else{_0x4d2c56['where']('i.'+_0x5f5350+'\x20=\x20?',_0x3f8167[_0x28d4('0x4d')][_0x5f5350]);}}});}if(_0x3f8167['query'][_0x28d4('0x86')]){if(_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x86')]==0x1){_0x4d2c56[_0x28d4('0x6c')](_0x28d4('0x87'));}else{_0x4d2c56[_0x28d4('0x6c')](_0x28d4('0x88'));}}if(_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x89')]){_0x4b3d54=_[_0x28d4('0x8a')](_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x89')])?_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x89')]:new Array(_0x3f8167[_0x28d4('0x4d')]['tag']);_0x4b3d54[_0x28d4('0x3e')](function(_0x1cc5ab){_0x1c8b60['or'](_0x28d4('0x8b'),'%,'+_0x1cc5ab+',%');});}if(_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x8c')]){var _0xb07c82=_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x8c')][_0x28d4('0x8d')]('\x5c','\x5c\x5c')[_0x28d4('0x8d')](/'/g,'\x27\x27');if(qs[_0x28d4('0x8e')](_0xb07c82)){_0x3bdca1['or'](_0x28d4('0x8f'),_0xb07c82+'%');}else if(qs['isEmail'](_0xb07c82)){_0x3bdca1['or'](_0x28d4('0x90'),_0xb07c82+'%');}else{_0x3bdca1['or'](_0x28d4('0x91'),qs[_0x28d4('0x73')](_0xb07c82))['or'](_0x28d4('0x92'),qs['getFullTextValue'](_0xb07c82));}}}_0x4d2c56['where'](_0x3bdca1);_0x4d2c56['group'](_0x28d4('0x93'));var _0x3ceb7c={'type':db[_0x28d4('0x94')][_0x28d4('0x95')][_0x28d4('0x96')],'raw':!![]};var _0x37a926=_0x4d2c56[_0x28d4('0x97')]();_0x37a926[_0x28d4('0x56')](_0x28d4('0x93'));_0x37a926[_0x28d4('0x56')](_0x28d4('0x98'),_0x28d4('0x6a'));if(_0x438cb7[_0x28d4('0x53')]){_0x438cb7[_0x28d4('0x53')][_0x28d4('0x3e')](function(_0x9bc024){var _0x4ad242=_0x9bc024[0x0]===_0x28d4('0x99')?_0x9bc024[0x0]:'i.'+_0x9bc024[0x0];_0x4d2c56[_0x28d4('0x53')](_0x4ad242,_0x9bc024[0x1]==='DESC'?![]:!![]);});}if(!_[_0x28d4('0x7e')](_0x4b3d54)){_0x4d2c56[_0x28d4('0x6c')](_0x1c8b60);_0x37a926[_0x28d4('0x54')](_0x28d4('0x9a'),_0x4b3d54);}BPromise[_0x28d4('0x9b')]()['then'](function(){if(!_0x5a21a9){if(_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x7f')])return;_0x37a926['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x4d2c56['where'](_0x28d4('0x9c'));return;}if(_0x3f8167[_0x28d4('0x9d')][_0x28d4('0x9e')]!=='agent')return;return _0x3f8167[_0x28d4('0x9d')][_0x28d4('0x9f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x15bb1e){if(_[_0x28d4('0x7e')](_0x15bb1e)){_0x37a926[_0x28d4('0x54')](_0x28d4('0xa0'));_0x4d2c56[_0x28d4('0x54')]('i.MailAccountId\x20IS\x20NULL');}else{_0x37a926['where'](_0x28d4('0xa1'),_['map'](_0x15bb1e,'id'));_0x4d2c56[_0x28d4('0x54')](_0x28d4('0xa1'),_[_0x28d4('0x39')](_0x15bb1e,'id'));}});})[_0x28d4('0x2b')](function(){if(_0x3f8167[_0x28d4('0x9d')][_0x28d4('0x9e')]===_0x28d4('0xa2')&&!_0x5a21a9&&!_0x3f8167[_0x28d4('0x4d')]['MailAccountId'])return[];return db[_0x28d4('0xa3')][_0x28d4('0x4d')](_0x37a926[_0x28d4('0xa4')](),_0x3ceb7c);})[_0x28d4('0x2b')](function(_0x51a9ac){_0x3451a7['count']=_0x51a9ac[_0x28d4('0x71')];if(_0x3451a7[_0x28d4('0x26')]===0x0)return[];return db[_0x28d4('0xa3')][_0x28d4('0x4d')](_0x59493f[_0x28d4('0xa4')](),_0x3ceb7c)[_0x28d4('0x2b')](function(_0x4b304b){_0x2e604e=_[_0x28d4('0xa5')](_0x4b304b,'id');_0x3ceb7c=_[_0x28d4('0x32')](_0x3ceb7c,{'model':db[_0x28d4('0xa6')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f8167[_0x28d4('0x4d')][_0x28d4('0x51')]){_0x438cb7[_0x28d4('0x52')][_0x28d4('0x3e')](function(_0x4c0fcb){_0x4d2c56['field']('i.'+_0x4c0fcb);});}else{_0x4d2c56['field'](_0x28d4('0x98'),_0x28d4('0x6a'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xa7'),_0x28d4('0xa8'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xa9'),_0x28d4('0xaa'));_0x4d2c56['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x28d4('0x99'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0x93'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xab'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xac'));_0x4d2c56['field'](_0x28d4('0xad'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xae'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xaf'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xb0'));_0x4d2c56[_0x28d4('0x56')]('i.lastMsgDirection');_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xb1'));_0x4d2c56['field'](_0x28d4('0xb2'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xb3'));_0x4d2c56[_0x28d4('0x56')]('i.thirdDisposition');_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xb4'));_0x4d2c56['field'](_0x28d4('0xb5'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xb6'));_0x4d2c56[_0x28d4('0x56')]('i.MailAccountId');_0x4d2c56[_0x28d4('0x56')]('i.UserId');_0x4d2c56[_0x28d4('0x56')]('c.firstName',_0x28d4('0xb7'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xb8'),_0x28d4('0xb9'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xba'),'Contact.email');_0x4d2c56['field'](_0x28d4('0xbb'),_0x28d4('0xbc'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xbd'),'Contact.mobile');_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xbe'),'Contact.fax');_0x4d2c56[_0x28d4('0x56')]('o.fullname',_0x28d4('0xbf'));_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xc0'),'Owner.internal');_0x4d2c56[_0x28d4('0x56')](_0x28d4('0xc1'),'TagIds');}if(_0x438cb7[_0x28d4('0x27')])_0x4d2c56[_0x28d4('0x27')](_0x438cb7['limit']);if(_0x438cb7[_0x28d4('0x25')])_0x4d2c56[_0x28d4('0x25')](_0x438cb7[_0x28d4('0x25')]);return db['sequelize'][_0x28d4('0x4d')](_0x4d2c56['toString'](),_0x3ceb7c);})[_0x28d4('0x2b')](function(_0x4caa60){if(_0x4caa60[_0x28d4('0x71')]>0x0)_0x591712['where'](_0x28d4('0xc2'),_[_0x28d4('0x39')](_0x4caa60,'id'));return db[_0x28d4('0xa3')][_0x28d4('0x4d')](_0x591712[_0x28d4('0xa4')](),_0x3ceb7c)[_0x28d4('0x2b')](function(_0x279bf7){var _0x41b863=_[_0x28d4('0xc3')](_0x279bf7,_0x28d4('0xc4'));var _0x34363e=[];return db[_0x28d4('0xc5')][_0x28d4('0x41')]({'attributes':[_0x28d4('0xc6')],'raw':!![]})[_0x28d4('0x2b')](function(_0x3fa357){var _0x379d65=_0x3fa357[_0x28d4('0xc6')];_0x4caa60[_0x28d4('0x3e')](function(_0x49d0c8){_0x34363e['push'](updateMailInteraction(_0x49d0c8,_0x2e604e,_0x41b863,_0x379d65));});return BPromise[_0x28d4('0xc7')](_0x34363e);});});});})[_0x28d4('0x2b')](function(_0x53e9fd){_0x3451a7[_0x28d4('0xc8')]=_0x53e9fd;return _0x3451a7;})[_0x28d4('0x2b')](respondWithFilteredResult(_0x1d2a32,_0x438cb7))[_0x28d4('0x47')](handleError(_0x1d2a32,null));};exports[_0x28d4('0xc9')]=function(_0x416d90,_0x39a782){var _0x531967={'raw':![],'where':{'id':_0x416d90[_0x28d4('0xca')]['id']}},_0xb70f57={};_0xb70f57[_0x28d4('0x4c')]=_[_0x28d4('0x4e')](db[_0x28d4('0xa6')][_0x28d4('0x49')]);_0xb70f57[_0x28d4('0x4d')]=_[_0x28d4('0x4e')](_0x416d90[_0x28d4('0x4d')]);_0xb70f57[_0x28d4('0x4f')]=_[_0x28d4('0x50')](_0xb70f57[_0x28d4('0x4c')],_0xb70f57[_0x28d4('0x4d')]);_0x531967[_0x28d4('0x52')]=_[_0x28d4('0x50')](_0xb70f57['model'],qs[_0x28d4('0x51')](_0x416d90[_0x28d4('0x4d')][_0x28d4('0x51')]));_0x531967[_0x28d4('0x52')]=_0x531967[_0x28d4('0x52')]['length']?_0x531967[_0x28d4('0x52')]:_0xb70f57[_0x28d4('0x4c')];if(_0x416d90[_0x28d4('0x4d')]['includeAll']){_0x531967[_0x28d4('0xcb')]=[{'all':!![]}];}_0x531967=_[_0x28d4('0x32')]({},_0x531967,_0x416d90['options']);return db[_0x28d4('0xa6')][_0x28d4('0x69')](_0x531967)[_0x28d4('0x2b')](handleEntityNotFound(_0x39a782,null))['then'](respondWithResult(_0x39a782,null))[_0x28d4('0x47')](handleError(_0x39a782,null));};exports[_0x28d4('0xcc')]=function(_0x3ef219,_0x17cf9f){return db[_0x28d4('0xa6')][_0x28d4('0xcc')](_0x3ef219[_0x28d4('0x33')],{})['then'](respondWithResult(_0x17cf9f,0xc9))['catch'](handleError(_0x17cf9f,null));};exports[_0x28d4('0x2a')]=function(_0x57b871,_0x1830c8){if(_0x57b871[_0x28d4('0x33')]['id']){delete _0x57b871[_0x28d4('0x33')]['id'];}return db[_0x28d4('0xa6')][_0x28d4('0x69')]({'where':{'id':_0x57b871[_0x28d4('0xca')]['id']}})[_0x28d4('0x2b')](handleEntityNotFound(_0x1830c8,null))[_0x28d4('0x2b')](saveUpdates(_0x57b871[_0x28d4('0x33')],null))[_0x28d4('0x2b')](respondWithResult(_0x1830c8,null))[_0x28d4('0x47')](handleError(_0x1830c8,null));};exports[_0x28d4('0x2c')]=function(_0x228be5,_0x4c8e4c){return db['MailInteraction'][_0x28d4('0x69')]({'where':{'id':_0x228be5[_0x28d4('0xca')]['id']}})[_0x28d4('0x2b')](handleEntityNotFound(_0x4c8e4c,null))[_0x28d4('0x2b')](removeEntity(_0x4c8e4c,null))[_0x28d4('0x47')](handleError(_0x4c8e4c,null));};exports[_0x28d4('0xcd')]=function(_0x4f4f88,_0x15bc82){return db[_0x28d4('0xa6')]['describe']()[_0x28d4('0x2b')](respondWithResult(_0x15bc82,null))['catch'](handleError(_0x15bc82,null));};exports[_0x28d4('0xce')]=function(_0x34ef16,_0x13ee6f,_0xeca2dd){return db[_0x28d4('0x40')]['find']({'where':{'id':_0x34ef16[_0x28d4('0xca')]['id']}})[_0x28d4('0x2b')](handleEntityNotFound(_0x13ee6f,null))[_0x28d4('0x2b')](function(_0x356fdf){if(_0x356fdf){return _0x356fdf[_0x28d4('0xce')](_0x34ef16[_0x28d4('0x33')][_0x28d4('0xcf')],_['omit'](_0x34ef16[_0x28d4('0x33')],[_0x28d4('0xcf'),'id'])||{});}})[_0x28d4('0x2b')](respondWithResult(_0x13ee6f,null))[_0x28d4('0x47')](handleError(_0x13ee6f,null));};exports[_0x28d4('0xd0')]=function(_0x8a0887,_0x88ec7e,_0x1fdd96){var _0x2d1631={'raw':![],'where':{}};var _0x316480={};var _0x427050={'count':0x0,'rows':[]};return db[_0x28d4('0xa6')]['findOne']({'where':{'id':_0x8a0887[_0x28d4('0xca')]['id']}})[_0x28d4('0x2b')](handleEntityNotFound(_0x88ec7e,null))[_0x28d4('0x2b')](function(_0x4188db){if(_0x4188db){_0x316480[_0x28d4('0x4c')]=_[_0x28d4('0x4e')](db[_0x28d4('0x40')][_0x28d4('0x49')]);_0x316480[_0x28d4('0x4d')]=_[_0x28d4('0x4e')](_0x8a0887[_0x28d4('0x4d')]);_0x316480['filters']=_['intersection'](_0x316480['model'],_0x316480[_0x28d4('0x4d')]);_0x2d1631[_0x28d4('0x52')]=_[_0x28d4('0x50')](_0x316480[_0x28d4('0x4c')],qs[_0x28d4('0x51')](_0x8a0887[_0x28d4('0x4d')]['fields']));_0x2d1631[_0x28d4('0x52')]=_0x2d1631[_0x28d4('0x52')][_0x28d4('0x71')]?_0x2d1631[_0x28d4('0x52')]:_0x316480[_0x28d4('0x4c')];if(!_0x8a0887[_0x28d4('0x4d')][_0x28d4('0xd1')](_0x28d4('0xd2'))){_0x2d1631[_0x28d4('0x27')]=qs[_0x28d4('0x27')](_0x8a0887[_0x28d4('0x4d')][_0x28d4('0x27')]);_0x2d1631[_0x28d4('0x25')]=qs[_0x28d4('0x25')](_0x8a0887[_0x28d4('0x4d')][_0x28d4('0x25')]);}_0x2d1631[_0x28d4('0x53')]=qs[_0x28d4('0xd3')](_0x8a0887[_0x28d4('0x4d')][_0x28d4('0xd3')]);_0x2d1631[_0x28d4('0x54')]=qs['filters'](_[_0x28d4('0xd4')](_0x8a0887[_0x28d4('0x4d')],_0x316480[_0x28d4('0x4f')]));_0x2d1631[_0x28d4('0x54')]['MailInteractionId']=_0x4188db['id'];if(_0x8a0887[_0x28d4('0x4d')][_0x28d4('0x8c')]){_0x2d1631[_0x28d4('0x54')]=_[_0x28d4('0x32')](_0x2d1631[_0x28d4('0x54')],{'$or':_[_0x28d4('0x39')](_0x2d1631[_0x28d4('0x52')],function(_0xa50b2b){var _0x1afd61={};_0x1afd61[_0xa50b2b]={'$like':'%'+_0x8a0887[_0x28d4('0x4d')][_0x28d4('0x8c')]+'%'};return _0x1afd61;})});}if(_0x8a0887[_0x28d4('0x4d')][_0x28d4('0x82')]){var _0x3a504e=_0x8a0887[_0x28d4('0x4d')][_0x28d4('0x82')]['split'](',');var _0x1a39c6={};_0x1a39c6[_0x3a504e[0x0]]={'$gte':moment(_0x3a504e[0x1])[_0x28d4('0xd5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2d1631[_0x28d4('0x54')]=_[_0x28d4('0x32')](_0x2d1631[_0x28d4('0x54')],_0x1a39c6);}_0x2d1631=_[_0x28d4('0x32')]({},_0x2d1631,_0x8a0887[_0x28d4('0xd6')]);return db[_0x28d4('0x40')]['count']({'where':_0x2d1631[_0x28d4('0x54')]})[_0x28d4('0x2b')](function(_0x50b6be){_0x427050[_0x28d4('0x26')]=_0x50b6be;if(_0x8a0887['query']['includeAll']){_0x2d1631['include']=[{'all':!![]}];}return db[_0x28d4('0x40')][_0x28d4('0xd7')](_0x2d1631);})['then'](function(_0x16891a){if(_0x8a0887[_0x28d4('0x4d')]['inlineCss']===_0x28d4('0xd8')){for(var _0x4b3deb=0x0;_0x4b3deb<_0x16891a[_0x28d4('0x71')];_0x4b3deb++){_0x16891a[_0x4b3deb]['body']=juice(_0x16891a[_0x4b3deb]['body']);}}_0x427050[_0x28d4('0xc8')]=_0x16891a;return _0x427050;});}})[_0x28d4('0x2b')](respondWithFilteredResult(_0x88ec7e,_0x2d1631))[_0x28d4('0x47')](handleError(_0x88ec7e,null));};exports['addTags']=function(_0x22d4bf,_0x329d02,_0x4094f7){return db['MailInteraction']['find']({'where':{'id':_0x22d4bf[_0x28d4('0xca')]['id']}})[_0x28d4('0x2b')](handleEntityNotFound(_0x329d02,null))['then'](function(_0x2eab03){if(_0x2eab03){return _0x2eab03['setTags'](_0x22d4bf[_0x28d4('0x33')]['ids'],_[_0x28d4('0xd9')](_0x22d4bf[_0x28d4('0x33')],[_0x28d4('0xcf'),'id'])||{})[_0x28d4('0xda')](function(){return db['Tag'][_0x28d4('0xd7')]({'attributes':['id',_0x28d4('0x2f'),_0x28d4('0xdb')],'where':{'id':_0x22d4bf[_0x28d4('0x33')][_0x28d4('0xcf')]}});})[_0x28d4('0x2b')](function(_0xab7564){socket[_0x28d4('0xdc')](_0x28d4('0xdd'),{'id':Number(_0x22d4bf[_0x28d4('0xca')]['id']),'tags':_0xab7564||[]});return{'id':Number(_0x22d4bf[_0x28d4('0xca')]['id']),'tags':_0xab7564||[]};});}})[_0x28d4('0x2b')](respondWithResult(_0x329d02,null))['catch'](handleError(_0x329d02,null));};exports['removeTags']=function(_0xd2d3c0,_0x1d9b6d,_0x27c0cf){return db[_0x28d4('0xa6')][_0x28d4('0x69')]({'where':{'id':_0xd2d3c0[_0x28d4('0xca')]['id']}})[_0x28d4('0x2b')](handleEntityNotFound(_0x1d9b6d,null))[_0x28d4('0x2b')](function(_0xcebee9){if(_0xcebee9){return _0xcebee9['removeTags'](_0xd2d3c0[_0x28d4('0x4d')][_0x28d4('0xcf')]);}})[_0x28d4('0x2b')](respondWithStatusCode(_0x1d9b6d,null))[_0x28d4('0x47')](handleError(_0x1d9b6d,null));};exports[_0x28d4('0xde')]=function(_0x12cd15,_0x1a9299){var _0x2f0a8b=moment()[_0x28d4('0xdf')]()[_0x28d4('0xa4')]();var _0x4e59bf=path[_0x28d4('0xe0')](config[_0x28d4('0xe1')],_0x28d4('0xe2'),_0x28d4('0xe3'),_0x28d4('0xe4'));var _0x1662e5=path['join'](config[_0x28d4('0xe1')],_0x28d4('0xe2'),_0x28d4('0xe3'),_0x28d4('0xe5'));var _0x455c27=path[_0x28d4('0xe0')](_0x4e59bf,_0x2f0a8b);var _0x1661ca=util['format'](_0x28d4('0xe6'),_0x12cd15[_0x28d4('0xca')]['id'],_0x2f0a8b);var _0x1c698c=path[_0x28d4('0xe0')](_0x4e59bf,_0x1661ca);var _0x2f7ae3=[];if(_0x12cd15[_0x28d4('0x4d')][_0x28d4('0xe5')]){_0x2f7ae3['push']({'model':db[_0x28d4('0xe7')],'as':_0x28d4('0xe8'),'raw':!![]});}var _0x27fcca=[{'model':db['MailMessage'],'as':'Messages','attributes':['id','body','from','to','cc',_0x28d4('0xe9'),_0x28d4('0xea'),_0x28d4('0x81')],'where':{'secret':![]},'order':qs[_0x28d4('0xd3')]('id'),'include':_0x2f7ae3}];return db[_0x28d4('0xa6')][_0x28d4('0x69')]({'where':{'id':_0x12cd15['params']['id']},'include':_0x27fcca})[_0x28d4('0x2b')](handleEntityNotFound(_0x1a9299,null))[_0x28d4('0x2b')](function(_0x3e1323){if(_0x3e1323&&_0x3e1323['Messages']){var _0x44f97e=_0x3e1323[_0x28d4('0xeb')]({'plain':!![]});fs[_0x28d4('0xec')](_0x455c27);return BPromise[_0x28d4('0xed')](_0x44f97e[_0x28d4('0xee')],function(_0x53d85a,_0x28bb85){var _0x30e51c={'from':_0x53d85a['from'],'to':_0x53d85a['to'],'subject':_0x53d85a[_0x28d4('0xea')],'html':_0x53d85a[_0x28d4('0x33')],'headers':{'Date':moment(_0x53d85a[_0x28d4('0x81')])[_0x28d4('0xd5')](_0x28d4('0xef'))},'attachments':[]};if(_0x53d85a['cc']){_0x30e51c[_0x28d4('0xf0')]['Cc']=_0x53d85a['cc'];}if(_0x53d85a[_0x28d4('0xe9')]){_0x30e51c['headers'][_0x28d4('0xf1')]=_0x53d85a[_0x28d4('0xe9')];}return new BPromise(function(_0x18860a,_0x4086fa){if(_0x53d85a[_0x28d4('0xe8')]){for(var _0x263c77=0x0;_0x263c77<_0x53d85a[_0x28d4('0xe8')][_0x28d4('0x71')];_0x263c77++){var _0x17fc86=_0x53d85a[_0x28d4('0xe8')][_0x263c77];var _0x1b525a=path[_0x28d4('0xe0')](_0x1662e5,_0x17fc86[_0x28d4('0xf2')]);if(fs[_0x28d4('0xf3')](_0x1b525a)){_0x30e51c[_0x28d4('0xe5')][_0x28d4('0x3f')]({'name':_0x17fc86[_0x28d4('0x2f')],'contentType':_0x17fc86[_0x28d4('0x4b')],'data':fs[_0x28d4('0xf4')](_0x1b525a)});}}}emlformat[_0x28d4('0xf5')](_0x30e51c,function(_0x1ef163,_0x41ced5){if(_0x1ef163)return _0x4086fa(_0x1ef163);fs[_0x28d4('0xf6')](path[_0x28d4('0xe0')](_0x455c27,util[_0x28d4('0xd5')](_0x28d4('0xf7'),_0x28bb85)),_0x41ced5);return _0x18860a(_0x41ced5);});});})['then'](function(){return new BPromise(function(_0x2f6066,_0x37f09d){zipdir(_0x455c27,{'saveTo':_0x1c698c},function(_0x4c2df3,_0xdbaf06){if(_0x4c2df3)return _0x37f09d(_0x4c2df3);return _0x2f6066(_0xdbaf06);});})['then'](function(){return new BPromise(function(_0x2ab830,_0x3fe286){rimraf(_0x455c27,function(_0x12bcf2){if(_0x12bcf2)_0x3fe286(_0x12bcf2);return _0x2ab830();});});})['then'](function(){return _0x1a9299[_0x28d4('0xde')](_0x1c698c,_0x1661ca,function(_0x4556f3){if(_0x4556f3){console[_0x28d4('0xf8')]('err',_0x4556f3);}else{fs[_0x28d4('0xf9')](_0x1c698c);}});});});}else{return _0x1a9299[_0x28d4('0x21')](0xc8);}})[_0x28d4('0x47')](handleError(_0x1a9299,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b7e9d79..e6fe851 100644 --- a/server/api/mailInteraction/mailInteraction.events.js +++ b/server/api/mailInteraction/mailInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c42=['emit','hasOwnProperty','events','MailInteraction','../../mysqldb','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length'];(function(_0x93b83c,_0xee637e){var _0x5d4831=function(_0x2a7f53){while(--_0x2a7f53){_0x93b83c['push'](_0x93b83c['shift']());}};_0x5d4831(++_0xee637e);}(_0x9c42,0xb2));var _0x29c4=function(_0x3e690a,_0x31aa0f){_0x3e690a=_0x3e690a-0x0;var _0x435ca0=_0x9c42[_0x3e690a];return _0x435ca0;};'use strict';var EventEmitter=require(_0x29c4('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x29c4('0x1')];var MailMessage=require(_0x29c4('0x2'))['db'][_0x29c4('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29c4('0x4'),'afterUpdate':_0x29c4('0x5'),'afterDestroy':_0x29c4('0x6')};function emitEvent(_0x448320){return function(_0x300e6b,_0x6a57fd,_0x5bfedb){_0x300e6b[_0x29c4('0x7')]({'attributes':['id'],'raw':!![]})[_0x29c4('0x8')](function(_0x12f44e){_0x300e6b[_0x29c4('0x9')](_0x29c4('0xa'),_0x12f44e[_0x29c4('0xb')](function(_0xa2aaf){return{'id':_0xa2aaf['id']};}));return MailMessage[_0x29c4('0xc')]({'where':{'MailInteractionId':_0x300e6b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x29c4('0x8')](function(_0x459606){_0x300e6b[_0x29c4('0x9')]('unreadMessages',_0x459606[_0x29c4('0xd')]);MailInteractionEvents[_0x29c4('0xe')](_0x448320+':'+_0x300e6b['id'],_0x300e6b);MailInteractionEvents[_0x29c4('0xe')](_0x448320,_0x300e6b);_0x5bfedb(null);})['catch'](_0x5bfedb(null));};}for(var e in events){if(events[_0x29c4('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xc7eb=['map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xc7eb,0x1ab));var _0xbc7e=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xc7eb[_0xe0b81f];return _0x290e5e;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xbc7e('0x0'))['db'][_0xbc7e('0x1')];var MailMessage=require(_0xbc7e('0x0'))['db'][_0xbc7e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbc7e('0x3')](0x0);var events={'afterCreate':_0xbc7e('0x4'),'afterUpdate':_0xbc7e('0x5'),'afterDestroy':_0xbc7e('0x6')};function emitEvent(_0x4c1bf9){return function(_0x5a91ae,_0x3637bb,_0x254049){_0x5a91ae[_0xbc7e('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4c850d){_0x5a91ae[_0xbc7e('0x8')](_0xbc7e('0x9'),_0x4c850d[_0xbc7e('0xa')](function(_0x181527){return{'id':_0x181527['id']};}));return MailMessage[_0xbc7e('0xb')]({'where':{'MailInteractionId':_0x5a91ae['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbc7e('0xc')](function(_0x134f41){_0x5a91ae[_0xbc7e('0x8')]('unreadMessages',_0x134f41[_0xbc7e('0xd')]);MailInteractionEvents[_0xbc7e('0xe')](_0x4c1bf9+':'+_0x5a91ae['id'],_0x5a91ae);MailInteractionEvents[_0xbc7e('0xe')](_0x4c1bf9,_0x5a91ae);_0x254049(null);})[_0xbc7e('0xf')](_0x254049(null));};}for(var e in events){if(events[_0xbc7e('0x10')](e)){var event=events[e];MailInteraction[_0xbc7e('0x11')](e,emitEvent(event));}}module[_0xbc7e('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c88054b..a0da3a9 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94ca=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x94ca,0xde));var _0xa94c=function(_0x25cf2a,_0x196f17){_0x25cf2a=_0x25cf2a-0x0;var _0x37fdf5=_0x94ca[_0x25cf2a];return _0x37fdf5;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var logger=require(_0xa94c('0x2'))(_0xa94c('0x3'));var moment=require(_0xa94c('0x4'));var BPromise=require(_0xa94c('0x5'));var rp=require(_0xa94c('0x6'));var fs=require('fs');var path=require(_0xa94c('0x7'));var rimraf=require(_0xa94c('0x8'));var config=require(_0xa94c('0x9'));var attributes=require(_0xa94c('0xa'));module[_0xa94c('0xb')]=function(_0x60c649,_0x4fb3d0){return _0x60c649[_0xa94c('0xc')](_0xa94c('0xd'),attributes,{'tableName':_0xa94c('0xe'),'paranoid':![],'indexes':[{'name':_0xa94c('0xf'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x536701,_0x5dcf28,_0x85b984){if(_0x536701[_0xa94c('0x10')]){_0x536701['substatusAt']=moment()[_0xa94c('0x11')](_0xa94c('0x12'));}if(_0x536701[_0xa94c('0x13')]){_0x536701[_0xa94c('0x14')]=moment()[_0xa94c('0x11')](_0xa94c('0x12'));}_0x85b984(null,_0x5dcf28);},'beforeUpdate':function(_0x553ae5,_0x4bb43f,_0x492c96){if(_0x553ae5[_0xa94c('0x15')](_0xa94c('0x10'))){_0x553ae5[_0xa94c('0x16')]=_0x553ae5[_0xa94c('0x10')]?moment()[_0xa94c('0x11')](_0xa94c('0x12')):null;}if(_0x553ae5[_0xa94c('0x15')](_0xa94c('0x13'))){_0x553ae5[_0xa94c('0x14')]=moment()['format'](_0xa94c('0x12'));_0x553ae5[_0xa94c('0x10')]=null;_0x553ae5[_0xa94c('0x16')]=null;}_0x492c96(null,_0x553ae5);},'afterUpdate':function(_0x20d81d,_0x5bbf1a,_0x1ba732){var _0x2ff7aa=_0x60c649[_0xa94c('0x17')];var _0x1284e8=_0x20d81d['get']({'plain':!![]});if(_0x1284e8['closed']){return _0x2ff7aa[_0xa94c('0x18')][_0xa94c('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x1284e8['id']}})['then'](function(){_0x1ba732();})[_0xa94c('0x1a')](function(_0x84e72a){_0x1ba732(_0x84e72a);});}else{_0x1ba732();}}},'charset':_0xa94c('0x1b'),'collate':_0xa94c('0x1c')});}; \ No newline at end of file +var _0x50a8=['subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','substatusAt','models','get','MailMessage','then','lodash','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','fti_mail_interactions'];(function(_0x1d2a14,_0x4cfcc5){var _0x352553=function(_0x1bed17){while(--_0x1bed17){_0x1d2a14['push'](_0x1d2a14['shift']());}};_0x352553(++_0x4cfcc5);}(_0x50a8,0x198));var _0x850a=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0x50a8[_0x5e2b34];return _0x4859f9;};'use strict';var _=require(_0x850a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x850a('0x1'));var BPromise=require('bluebird');var rp=require(_0x850a('0x2'));var fs=require('fs');var path=require(_0x850a('0x3'));var rimraf=require(_0x850a('0x4'));var config=require(_0x850a('0x5'));var attributes=require(_0x850a('0x6'));module[_0x850a('0x7')]=function(_0xb85c1a,_0x442316){return _0xb85c1a[_0x850a('0x8')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x850a('0x9'),'fields':[_0x850a('0xa'),'to'],'type':_0x850a('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x25a304,_0x5c197f,_0x3c6738){if(_0x25a304['substatus']){_0x25a304['substatusAt']=moment()[_0x850a('0xc')](_0x850a('0xd'));}if(_0x25a304[_0x850a('0xe')]){_0x25a304[_0x850a('0xf')]=moment()[_0x850a('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c6738(null,_0x5c197f);},'beforeUpdate':function(_0x4b5576,_0x5d1b71,_0x3b12a1){if(_0x4b5576['changed'](_0x850a('0x10'))){_0x4b5576[_0x850a('0x11')]=_0x4b5576[_0x850a('0x10')]?moment()[_0x850a('0xc')](_0x850a('0xd')):null;}if(_0x4b5576['changed'](_0x850a('0xe'))){_0x4b5576['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4b5576['substatus']=null;_0x4b5576[_0x850a('0x11')]=null;}_0x3b12a1(null,_0x4b5576);},'afterUpdate':function(_0x5e0fbe,_0x657067,_0x5a66d1){var _0x3c90e6=_0xb85c1a[_0x850a('0x12')];var _0x22d759=_0x5e0fbe[_0x850a('0x13')]({'plain':!![]});if(_0x22d759[_0x850a('0xe')]){return _0x3c90e6[_0x850a('0x14')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x22d759['id']}})[_0x850a('0x15')](function(){_0x5a66d1();})['catch'](function(_0x4c70ab){_0x5a66d1(_0x4c70ab);});}else{_0x5a66d1();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 7306fd9..fb14c76 100644 --- a/server/api/mailInteraction/mailInteraction.rpc.js +++ b/server/api/mailInteraction/mailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82b0=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','debug','stringify','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2499b4,_0x50738d){var _0x159617=function(_0x196de3){while(--_0x196de3){_0x2499b4['push'](_0x2499b4['shift']());}};_0x159617(++_0x50738d);}(_0x82b0,0x81));var _0x082b=function(_0x1e03e4,_0x362f76){_0x1e03e4=_0x1e03e4-0x0;var _0x4a887e=_0x82b0[_0x1e03e4];return _0x4a887e;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var moment=require(_0x082b('0x2'));var BPromise=require('bluebird');var rs=require(_0x082b('0x3'));var fs=require('fs');var Redis=require(_0x082b('0x4'));var db=require(_0x082b('0x5'))['db'];var utils=require(_0x082b('0x6'));var logger=require('../../config/logger')(_0x082b('0x7'));var config=require(_0x082b('0x8'));var jayson=require(_0x082b('0x9'));var client=jayson[_0x082b('0xa')][_0x082b('0xb')]({'port':0x232a});config['redis']=_[_0x082b('0xc')](config[_0x082b('0xd')],{'host':_0x082b('0xe'),'port':0x18eb});var socket=require(_0x082b('0xf'))(new Redis(config[_0x082b('0xd')]));require(_0x082b('0x10'))[_0x082b('0x11')](socket);function respondWithRpcPromise(_0x303c1e,_0x1483c3,_0x1066e8){return new BPromise(function(_0x18a27f,_0x181a6e){return client[_0x082b('0x12')](_0x303c1e,_0x1066e8)[_0x082b('0x13')](function(_0x4e9133){logger['info'](_0x082b('0x14'),_0x1483c3,'request\x20sent');logger['debug'](_0x082b('0x15'),_0x1483c3,_0x082b('0x16'),JSON['stringify'](_0x4e9133));if(_0x4e9133[_0x082b('0x17')]){if(_0x4e9133[_0x082b('0x17')][_0x082b('0x18')]===0x1f4){logger[_0x082b('0x17')](_0x082b('0x14'),_0x1483c3,_0x4e9133['error'][_0x082b('0x19')]);return _0x181a6e(_0x4e9133[_0x082b('0x17')]['message']);}logger[_0x082b('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1483c3,_0x4e9133[_0x082b('0x17')][_0x082b('0x19')]);return _0x18a27f(_0x4e9133['error'][_0x082b('0x19')]);}else{logger[_0x082b('0x1a')](_0x082b('0x14'),_0x1483c3,_0x082b('0x16'));_0x18a27f(_0x4e9133['result'][_0x082b('0x19')]);}})[_0x082b('0x1b')](function(_0x7d188d){logger[_0x082b('0x17')](_0x082b('0x14'),_0x1483c3,_0x7d188d);_0x181a6e(_0x7d188d);});});}exports[_0x082b('0x1c')]=function(_0x101654){var _0x18074e=this;return new Promise(function(_0x5dee52,_0x9faf2){return db[_0x082b('0x1d')][_0x082b('0x1e')](_0x101654['body'],{'raw':_0x101654[_0x082b('0x1f')]?_0x101654[_0x082b('0x1f')][_0x082b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101654['options']?_0x101654['options'][_0x082b('0x21')]||null:null,'attributes':_0x101654['options']?_0x101654['options'][_0x082b('0x22')]||null:null,'limit':_0x101654[_0x082b('0x1f')]?_0x101654[_0x082b('0x1f')][_0x082b('0x23')]||null:null})[_0x082b('0x13')](function(_0x4ed723){logger[_0x082b('0x1a')](_0x082b('0x1c'),_0x101654);logger[_0x082b('0x24')](_0x082b('0x1c'),_0x101654,JSON[_0x082b('0x25')](_0x4ed723));_0x5dee52(_0x4ed723);})[_0x082b('0x1b')](function(_0x1b6dfc){logger['error'](_0x082b('0x1c'),_0x1b6dfc['message'],_0x101654);_0x9faf2(_0x18074e[_0x082b('0x17')](0x1f4,_0x1b6dfc['message']));});});};exports[_0x082b('0x26')]=function(_0x15c093){return new Promise(function(_0x545fd6,_0x2279d7){return db['MailInteraction'][_0x082b('0x27')]({'where':_0x15c093['options']?_0x15c093[_0x082b('0x1f')][_0x082b('0x21')]||null:null})[_0x082b('0x13')](function(_0x23b651){if(_0x23b651){return _0x23b651[_0x082b('0x28')](_0x15c093[_0x082b('0x29')][_0x082b('0x2a')],_[_0x082b('0x2b')](_0x15c093[_0x082b('0x29')],[_0x082b('0x2a'),'id'])||{});}})[_0x082b('0x2c')](function(_0x11be3b){logger['info'](_0x082b('0x2d'),_0x15c093);logger[_0x082b('0x24')](_0x082b('0x2d'),_0x15c093,JSON[_0x082b('0x25')](_0x11be3b));_0x545fd6(_0x11be3b);})[_0x082b('0x1b')](function(_0x50d5fd){logger['error'](_0x082b('0x2d'),_0x50d5fd[_0x082b('0x19')],_0x15c093);_0x2279d7(_this['error'](0x1f4,_0x50d5fd[_0x082b('0x19')]));});});}; \ No newline at end of file +var _0x765b=['MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','update','options','where','attributes','limit','AddTagsToMailInteraction','addTags','body','ids','AddTags','bluebird','ioredis','../../config/utils','../../config/logger','rpc','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x765b,0x18c));var _0xb765=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x765b[_0x2c9b79];return _0x265032;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb765('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb765('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xb765('0x2'));var logger=require(_0xb765('0x3'))(_0xb765('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb765('0x5')]=_['defaults'](config[_0xb765('0x5')],{'host':_0xb765('0x6'),'port':0x18eb});var socket=require(_0xb765('0x7'))(new Redis(config['redis']));require(_0xb765('0x8'))[_0xb765('0x9')](socket);function respondWithRpcPromise(_0x26ad83,_0x47bb0f,_0x5034c6){return new BPromise(function(_0x54c179,_0x37f7c5){return client[_0xb765('0xa')](_0x26ad83,_0x5034c6)[_0xb765('0xb')](function(_0x3e7e04){logger['info'](_0xb765('0xc'),_0x47bb0f,_0xb765('0xd'));logger[_0xb765('0xe')](_0xb765('0xf'),_0x47bb0f,_0xb765('0xd'),JSON[_0xb765('0x10')](_0x3e7e04));if(_0x3e7e04[_0xb765('0x11')]){if(_0x3e7e04[_0xb765('0x11')][_0xb765('0x12')]===0x1f4){logger['error'](_0xb765('0xc'),_0x47bb0f,_0x3e7e04['error'][_0xb765('0x13')]);return _0x37f7c5(_0x3e7e04[_0xb765('0x11')]['message']);}logger['error'](_0xb765('0xc'),_0x47bb0f,_0x3e7e04[_0xb765('0x11')][_0xb765('0x13')]);return _0x54c179(_0x3e7e04[_0xb765('0x11')][_0xb765('0x13')]);}else{logger[_0xb765('0x14')](_0xb765('0xc'),_0x47bb0f,_0xb765('0xd'));_0x54c179(_0x3e7e04['result'][_0xb765('0x13')]);}})[_0xb765('0x15')](function(_0x47300e){logger[_0xb765('0x11')](_0xb765('0xc'),_0x47bb0f,_0x47300e);_0x37f7c5(_0x47300e);});});}exports[_0xb765('0x16')]=function(_0x2fd6c1){var _0x3b0a40=this;return new Promise(function(_0xaa51c6,_0x3a1197){return db[_0xb765('0x17')][_0xb765('0x18')](_0x2fd6c1['body'],{'raw':_0x2fd6c1['options']?_0x2fd6c1[_0xb765('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fd6c1[_0xb765('0x19')]?_0x2fd6c1[_0xb765('0x19')][_0xb765('0x1a')]||null:null,'attributes':_0x2fd6c1['options']?_0x2fd6c1[_0xb765('0x19')][_0xb765('0x1b')]||null:null,'limit':_0x2fd6c1['options']?_0x2fd6c1[_0xb765('0x19')][_0xb765('0x1c')]||null:null})[_0xb765('0xb')](function(_0x410c6f){logger['info'](_0xb765('0x16'),_0x2fd6c1);logger[_0xb765('0xe')]('UpdateMailInteraction',_0x2fd6c1,JSON['stringify'](_0x410c6f));_0xaa51c6(_0x410c6f);})[_0xb765('0x15')](function(_0x4715d7){logger[_0xb765('0x11')]('UpdateMailInteraction',_0x4715d7['message'],_0x2fd6c1);_0x3a1197(_0x3b0a40['error'](0x1f4,_0x4715d7[_0xb765('0x13')]));});});};exports[_0xb765('0x1d')]=function(_0x29767f){return new Promise(function(_0x4db746,_0xb41497){return db[_0xb765('0x17')]['find']({'where':_0x29767f[_0xb765('0x19')]?_0x29767f[_0xb765('0x19')][_0xb765('0x1a')]||null:null})['then'](function(_0x5b155b){if(_0x5b155b){return _0x5b155b[_0xb765('0x1e')](_0x29767f[_0xb765('0x1f')][_0xb765('0x20')],_['omit'](_0x29767f[_0xb765('0x1f')],[_0xb765('0x20'),'id'])||{});}})['spread'](function(_0x48242f){logger[_0xb765('0x14')](_0xb765('0x21'),_0x29767f);logger[_0xb765('0xe')](_0xb765('0x21'),_0x29767f,JSON[_0xb765('0x10')](_0x48242f));_0x4db746(_0x48242f);})[_0xb765('0x15')](function(_0x20e601){logger['error'](_0xb765('0x21'),_0x20e601[_0xb765('0x13')],_0x29767f);_0xb41497(_this[_0xb765('0x11')](0x1f4,_0x20e601[_0xb765('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 76a59eb..e85ca7b 100644 --- a/server/api/mailInteraction/mailInteraction.socket.js +++ b/server/api/mailInteraction/mailInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9644=['emit','length','./mailInteraction.events','save','remove'];(function(_0x25b9c7,_0x370ece){var _0x4ec3ad=function(_0x16d4c6){while(--_0x16d4c6){_0x25b9c7['push'](_0x25b9c7['shift']());}};_0x4ec3ad(++_0x370ece);}(_0x9644,0x1dd));var _0x4964=function(_0x55253a,_0x39b0a0){_0x55253a=_0x55253a-0x0;var _0x1b7e6b=_0x9644[_0x55253a];return _0x1b7e6b;};'use strict';var MailInteractionEvents=require(_0x4964('0x0'));var events=[_0x4964('0x1'),_0x4964('0x2'),'update'];function createListener(_0x51d818,_0x53acea){return function(_0x15833b){_0x53acea[_0x4964('0x3')](_0x51d818,_0x15833b);};}function removeListener(_0x403c61,_0x1c6fa2){return function(){MailInteractionEvents['removeListener'](_0x403c61,_0x1c6fa2);};}exports['register']=function(_0x50b65b){for(var _0x10a59d=0x0,_0x155648=events[_0x4964('0x4')];_0x10a59d<_0x155648;_0x10a59d++){var _0x425091=events[_0x10a59d];var _0xef2268=createListener('mailInteraction:'+_0x425091,_0x50b65b);MailInteractionEvents['on'](_0x425091,_0xef2268);}}; \ No newline at end of file +var _0x08dd=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x11e6d2,_0x23553a){var _0x160e83=function(_0x427f58){while(--_0x427f58){_0x11e6d2['push'](_0x11e6d2['shift']());}};_0x160e83(++_0x23553a);}(_0x08dd,0x10b));var _0xd08d=function(_0x1d26ba,_0x34569c){_0x1d26ba=_0x1d26ba-0x0;var _0x40df23=_0x08dd[_0x1d26ba];return _0x40df23;};'use strict';var MailInteractionEvents=require(_0xd08d('0x0'));var events=[_0xd08d('0x1'),_0xd08d('0x2'),_0xd08d('0x3')];function createListener(_0x10e928,_0x59bece){return function(_0x5bccd8){_0x59bece[_0xd08d('0x4')](_0x10e928,_0x5bccd8);};}function removeListener(_0x2fdfd8,_0x43c591){return function(){MailInteractionEvents[_0xd08d('0x5')](_0x2fdfd8,_0x43c591);};}exports[_0xd08d('0x6')]=function(_0x40ddfb){for(var _0x4ea1f5=0x0,_0x524b09=events[_0xd08d('0x7')];_0x4ea1f5<_0x524b09;_0x4ea1f5++){var _0x248866=events[_0x4ea1f5];var _0x1816d1=createListener(_0xd08d('0x8')+_0x248866,_0x40ddfb);MailInteractionEvents['on'](_0x248866,_0x1816d1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 8466641..8b4c992 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1b8=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','update','put','/:id/accept','/:id/reject','reject','delete'];(function(_0x1029c4,_0x4b5da3){var _0x52c091=function(_0x3d9704){while(--_0x3d9704){_0x1029c4['push'](_0x1029c4['shift']());}};_0x52c091(++_0x4b5da3);}(_0xb1b8,0x12e));var _0x8b1b=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0xb1b8[_0x31880d];return _0x423823;};'use strict';var multer=require(_0x8b1b('0x0'));var util=require(_0x8b1b('0x1'));var path=require(_0x8b1b('0x2'));var timeout=require(_0x8b1b('0x3'));var express=require(_0x8b1b('0x4'));var router=express[_0x8b1b('0x5')]();var fs_extra=require(_0x8b1b('0x6'));var auth=require(_0x8b1b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8b1b('0x8'));var controller=require(_0x8b1b('0x9'));router[_0x8b1b('0xa')]('/',auth[_0x8b1b('0xb')](),controller[_0x8b1b('0xc')]);router[_0x8b1b('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x8b1b('0xd')]);router['get'](_0x8b1b('0xe'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0xf')]);router['get'](_0x8b1b('0x10'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0x11')]);router[_0x8b1b('0x12')]('/',auth[_0x8b1b('0xb')](),interaction[_0x8b1b('0x13')](_0x8b1b('0x14'),_0x8b1b('0x15')),controller['create']);router['put'](_0x8b1b('0xe'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0x16')]);router[_0x8b1b('0x17')](_0x8b1b('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x8b1b('0x19'),auth['isAuthenticated'](),controller[_0x8b1b('0x1a')]);router[_0x8b1b('0x1b')](_0x8b1b('0xe'),auth[_0x8b1b('0xb')](),controller[_0x8b1b('0x1c')]);module[_0x8b1b('0x1d')]=router; \ No newline at end of file +var _0xef4d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','tracked','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x27ce98,_0x8d5888){var _0x5a7422=function(_0x57abd0){while(--_0x57abd0){_0x27ce98['push'](_0x27ce98['shift']());}};_0x5a7422(++_0x8d5888);}(_0xef4d,0x166));var _0xdef4=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xef4d[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0xdef4('0x0'));var util=require(_0xdef4('0x1'));var path=require(_0xdef4('0x2'));var timeout=require(_0xdef4('0x3'));var express=require(_0xdef4('0x4'));var router=express['Router']();var fs_extra=require(_0xdef4('0x5'));var auth=require(_0xdef4('0x6'));var interaction=require(_0xdef4('0x7'));var config=require(_0xdef4('0x8'));var controller=require('./mailMessage.controller');router[_0xdef4('0x9')]('/',auth[_0xdef4('0xa')](),controller[_0xdef4('0xb')]);router[_0xdef4('0x9')](_0xdef4('0xc'),auth['isAuthenticated'](),controller[_0xdef4('0xd')]);router['get'](_0xdef4('0xe'),auth['isAuthenticated'](),controller[_0xdef4('0xf')]);router[_0xdef4('0x9')](_0xdef4('0x10'),auth[_0xdef4('0xa')](),controller['download']);router['post']('/',auth[_0xdef4('0xa')](),interaction[_0xdef4('0x11')](_0xdef4('0x12'),'mailmessage:create'),controller[_0xdef4('0x13')]);router[_0xdef4('0x14')](_0xdef4('0xe'),auth[_0xdef4('0xa')](),controller[_0xdef4('0x15')]);router[_0xdef4('0x14')](_0xdef4('0x16'),auth[_0xdef4('0xa')](),controller[_0xdef4('0x17')]);router['put'](_0xdef4('0x18'),auth[_0xdef4('0xa')](),controller[_0xdef4('0x19')]);router[_0xdef4('0x1a')](_0xdef4('0xe'),auth[_0xdef4('0xa')](),controller[_0xdef4('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 40bce59..3b3614d 100644 --- a/server/api/mailMessage/mailMessage.attributes.js +++ b/server/api/mailMessage/mailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x111e=['ENUM','out','STRING','TEXT','long','DATE','INTEGER','Email','sequelize','lodash','exports','medium','BOOLEAN'];(function(_0x933b98,_0xa0fc6a){var _0x5cd1f9=function(_0x20e030){while(--_0x20e030){_0x933b98['push'](_0x933b98['shift']());}};_0x5cd1f9(++_0xa0fc6a);}(_0x111e,0xcb));var _0xe111=function(_0x1a16b0,_0x5d1b36){_0x1a16b0=_0x1a16b0-0x0;var _0xb655f4=_0x111e[_0x1a16b0];return _0xb655f4;};'use strict';var Sequelize=require(_0xe111('0x0'));var _=require(_0xe111('0x1'));module[_0xe111('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xe111('0x3'))},'read':{'type':Sequelize[_0xe111('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe111('0x5')]('in','out'),'defaultValue':_0xe111('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xe111('0x7')]},'to':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'cc':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'bcc':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'subject':{'type':Sequelize[_0xe111('0x8')]},'sentAt':{'type':Sequelize[_0xe111('0xa')]},'attach':{'type':Sequelize[_0xe111('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe111('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe111('0xa')]},'originTo':{'type':Sequelize[_0xe111('0x8')]('long')},'originCc':{'type':Sequelize[_0xe111('0x8')](_0xe111('0x9'))},'originChannel':{'type':Sequelize[_0xe111('0x5')](_0xe111('0xc'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xdfd4=['BOOLEAN','Email','lodash','exports','TEXT','long','ENUM','out','STRING','DATE'];(function(_0xf3bf60,_0x3c28e5){var _0x55dfb0=function(_0x9e1cd4){while(--_0x9e1cd4){_0xf3bf60['push'](_0xf3bf60['shift']());}};_0x55dfb0(++_0x3c28e5);}(_0xdfd4,0xca));var _0x4dfd=function(_0x4b17c1,_0x16f8b4){_0x4b17c1=_0x4b17c1-0x0;var _0x5787b6=_0xdfd4[_0x4b17c1];return _0x5787b6;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4dfd('0x0'));module[_0x4dfd('0x1')]={'body':{'type':Sequelize[_0x4dfd('0x2')](_0x4dfd('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4dfd('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4dfd('0x4')]('in',_0x4dfd('0x5')),'defaultValue':_0x4dfd('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4dfd('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x4dfd('0x2')]('long')},'bcc':{'type':Sequelize[_0x4dfd('0x2')](_0x4dfd('0x3'))},'subject':{'type':Sequelize[_0x4dfd('0x2')]},'sentAt':{'type':Sequelize[_0x4dfd('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4dfd('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4dfd('0x7')]},'originTo':{'type':Sequelize[_0x4dfd('0x2')](_0x4dfd('0x3'))},'originCc':{'type':Sequelize[_0x4dfd('0x2')](_0x4dfd('0x3'))},'originChannel':{'type':Sequelize[_0x4dfd('0x4')](_0x4dfd('0x9'),'Chat'),'defaultValue':_0x4dfd('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index db62406..976e21e 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc494=['rejectMessage','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','build','writeFileSync','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','render','merge','body','interaction','account','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','params','length','find','describe','create','direction','out','secret','split','MailAccount','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','authentication','auth','user','pass','secure','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','read','readAt','UserId','agent','Contact','MailInteraction','MailInteractionId','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','mail','RejectMessage'];(function(_0x102363,_0x158232){var _0x59c3ed=function(_0x145da9){while(--_0x145da9){_0x102363['push'](_0x102363['shift']());}};_0x59c3ed(++_0x158232);}(_0xc494,0x170));var _0x4c49=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xc494[_0xf55e73];return _0x116b99;};'use strict';var emlformat=require(_0x4c49('0x0'));var rimraf=require(_0x4c49('0x1'));var zipdir=require(_0x4c49('0x2'));var jsonpatch=require(_0x4c49('0x3'));var rp=require(_0x4c49('0x4'));var moment=require(_0x4c49('0x5'));var BPromise=require(_0x4c49('0x6'));var Mustache=require(_0x4c49('0x7'));var util=require(_0x4c49('0x8'));var path=require(_0x4c49('0x9'));var sox=require(_0x4c49('0xa'));var csv=require('to-csv');var ejs=require(_0x4c49('0xb'));var fs=require('fs');var fs_extra=require(_0x4c49('0xc'));var _=require(_0x4c49('0xd'));var squel=require(_0x4c49('0xe'));var crypto=require('crypto');var jsforce=require(_0x4c49('0xf'));var deskjs=require(_0x4c49('0x10'));var toCsv=require(_0x4c49('0x11'));var querystring=require(_0x4c49('0x12'));var Papa=require(_0x4c49('0x13'));var Redis=require('ioredis');var authService=require(_0x4c49('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4c49('0x15'));var hardwareService=require(_0x4c49('0x16'));var logger=require('../../config/logger')(_0x4c49('0x17'));var utils=require(_0x4c49('0x18'));var config=require(_0x4c49('0x19'));var licenseUtil=require(_0x4c49('0x1a'));var db=require(_0x4c49('0x1b'))['db'];config[_0x4c49('0x1c')]=_[_0x4c49('0x1d')](config['redis'],{'host':_0x4c49('0x1e'),'port':0x18eb});var socket=require(_0x4c49('0x1f'))(new Redis(config[_0x4c49('0x1c')]));require(_0x4c49('0x20'))['register'](socket);var jayson=require(_0x4c49('0x21'));var client=jayson[_0x4c49('0x22')][_0x4c49('0x23')]({'port':0x232c});var client9003=jayson['client'][_0x4c49('0x23')]({'port':0x232b});var client9002=jayson[_0x4c49('0x22')][_0x4c49('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1ec1cf,_0x2a19dd,_0x348f92,_0x4124b1){return new BPromise(function(_0x4b7190,_0x37fb78){var _0x343263=_0x4124b1||client;return _0x343263['request'](_0x1ec1cf,_0x348f92)[_0x4c49('0x24')](function(_0xf239d0){logger[_0x4c49('0x25')](_0x4c49('0x26'),_0x2a19dd,'request\x20sent');logger[_0x4c49('0x27')](_0x4c49('0x28'),_0x2a19dd,'request\x20sent',JSON[_0x4c49('0x29')](_0xf239d0));if(_0xf239d0['error']){if(_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2b')]===0x1f4){logger[_0x4c49('0x2a')]('MailMessage,\x20%s,\x20%s',_0x2a19dd,_0xf239d0[_0x4c49('0x2a')]['message']);return _0x37fb78(_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2c')]);}logger[_0x4c49('0x2a')](_0x4c49('0x26'),_0x2a19dd,_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2c')]);return _0x4b7190(_0xf239d0[_0x4c49('0x2a')][_0x4c49('0x2c')]);}else{logger['info'](_0x4c49('0x26'),_0x2a19dd,_0x4c49('0x2d'));_0x4b7190(_0xf239d0[_0x4c49('0x2e')][_0x4c49('0x2c')]);}})[_0x4c49('0x2f')](function(_0x36f14b){logger['error'](_0x4c49('0x26'),_0x2a19dd,_0x36f14b);_0x37fb78(_0x36f14b);});});}function respondWithStatusCode(_0x4bfba2,_0x19860e){_0x19860e=_0x19860e||0xcc;return function(_0x951f61){if(_0x951f61){return _0x4bfba2['sendStatus'](_0x19860e);}return _0x4bfba2[_0x4c49('0x30')](_0x19860e)['end']();};}function respondWithResult(_0x1c1343,_0x229417){_0x229417=_0x229417||0xc8;return function(_0x14f664){if(_0x14f664){return _0x1c1343[_0x4c49('0x30')](_0x229417)[_0x4c49('0x31')](_0x14f664);}};}function respondWithFilteredResult(_0x2eac13,_0x2f2219){return function(_0x4fb9fd){if(_0x4fb9fd){var _0x39aa9c=typeof _0x2f2219[_0x4c49('0x32')]===_0x4c49('0x33')&&typeof _0x2f2219[_0x4c49('0x34')]==='undefined';var _0x5b58d5=_0x4fb9fd[_0x4c49('0x35')];var _0x389dcd=_0x39aa9c?0x0:_0x2f2219[_0x4c49('0x32')];var _0x23cf72=_0x39aa9c?_0x4fb9fd[_0x4c49('0x35')]:_0x2f2219['offset']+_0x2f2219['limit'];var _0xccc7dd;if(_0x23cf72>=_0x5b58d5){_0x23cf72=_0x5b58d5;_0xccc7dd=0xc8;}else{_0xccc7dd=0xce;}_0x2eac13[_0x4c49('0x30')](_0xccc7dd);return _0x2eac13[_0x4c49('0x36')](_0x4c49('0x37'),_0x389dcd+'-'+_0x23cf72+'/'+_0x5b58d5)['json'](_0x4fb9fd);}return null;};}function patchUpdates(_0x2127c8){return function(_0x39f9f4){try{jsonpatch[_0x4c49('0x38')](_0x39f9f4,_0x2127c8,!![]);}catch(_0x25f92d){return BPromise[_0x4c49('0x39')](_0x25f92d);}return _0x39f9f4[_0x4c49('0x3a')]();};}function saveUpdates(_0x6662f7,_0x3d14f6){return function(_0x20c9d3){if(_0x20c9d3){return _0x20c9d3[_0x4c49('0x3b')](_0x6662f7)[_0x4c49('0x24')](function(_0x27e91b){return _0x27e91b;});}return null;};}function removeEntity(_0x1a3fe3,_0x25900d){return function(_0x568988){if(_0x568988){return _0x568988[_0x4c49('0x3c')]()[_0x4c49('0x24')](function(){_0x1a3fe3['status'](0xcc)[_0x4c49('0x3d')]();});}};}function handleEntityNotFound(_0x455241,_0x5cefe6){return function(_0xd54a0b){if(!_0xd54a0b){_0x455241['sendStatus'](0x194);}return _0xd54a0b;};}function handleError(_0x356d18,_0x1f1f8e){_0x1f1f8e=_0x1f1f8e||0x1f4;return function(_0x26e944){logger[_0x4c49('0x2a')](_0x26e944[_0x4c49('0x3e')]);if(_0x26e944['name']){delete _0x26e944['name'];}_0x356d18['status'](_0x1f1f8e)['send'](_0x26e944);};}function getMustacheRender(_0x227ee6,_0xafb0dc){return Mustache[_0x4c49('0x3f')](_0x227ee6,_[_0x4c49('0x40')](_0xafb0dc[_0x4c49('0x41')],{'contact':_0xafb0dc['contact'],'message':_0xafb0dc[_0x4c49('0x2c')],'agent':_0xafb0dc['agent'],'interaction':_0xafb0dc[_0x4c49('0x42')],'account':_0xafb0dc[_0x4c49('0x43')]}))||'';}exports[_0x4c49('0x44')]=function(_0x20e16e,_0x503a66){var _0x54eaa1={},_0x3a6aa7={},_0x44ef06={'count':0x0,'rows':[]};var _0x4d8ece=_[_0x4c49('0x45')](db['MailMessage'][_0x4c49('0x46')],function(_0x205ff6){return{'name':_0x205ff6['fieldName'],'type':_0x205ff6[_0x4c49('0x47')]['key']};});_0x3a6aa7[_0x4c49('0x48')]=_[_0x4c49('0x45')](_0x4d8ece,'name');_0x3a6aa7[_0x4c49('0x49')]=_[_0x4c49('0x4a')](_0x20e16e[_0x4c49('0x49')]);_0x3a6aa7['filters']=_[_0x4c49('0x4b')](_0x3a6aa7[_0x4c49('0x48')],_0x3a6aa7['query']);_0x54eaa1[_0x4c49('0x4c')]=_[_0x4c49('0x4b')](_0x3a6aa7[_0x4c49('0x48')],qs[_0x4c49('0x4d')](_0x20e16e[_0x4c49('0x49')][_0x4c49('0x4d')]));_0x54eaa1[_0x4c49('0x4c')]=_0x54eaa1[_0x4c49('0x4c')]['length']?_0x54eaa1[_0x4c49('0x4c')]:_0x3a6aa7[_0x4c49('0x48')];if(!_0x20e16e[_0x4c49('0x49')][_0x4c49('0x4e')](_0x4c49('0x4f'))){_0x54eaa1[_0x4c49('0x34')]=qs[_0x4c49('0x34')](_0x20e16e[_0x4c49('0x49')]['limit']);_0x54eaa1[_0x4c49('0x32')]=qs[_0x4c49('0x32')](_0x20e16e['query'][_0x4c49('0x32')]);}_0x54eaa1[_0x4c49('0x50')]=qs[_0x4c49('0x51')](_0x20e16e[_0x4c49('0x49')][_0x4c49('0x51')]);_0x54eaa1[_0x4c49('0x52')]=qs[_0x4c49('0x53')](_['pick'](_0x20e16e[_0x4c49('0x49')],_0x3a6aa7[_0x4c49('0x53')]),_0x4d8ece);if(_0x20e16e['query'][_0x4c49('0x54')]){_0x54eaa1[_0x4c49('0x52')]=_[_0x4c49('0x40')](_0x54eaa1['where'],{'$or':_[_0x4c49('0x45')](_0x4d8ece,function(_0x4ac065){if(_0x4ac065[_0x4c49('0x47')]!==_0x4c49('0x55')){var _0x5aac56={};_0x5aac56[_0x4ac065['name']]={'$like':'%'+_0x20e16e[_0x4c49('0x49')][_0x4c49('0x54')]+'%'};return _0x5aac56;}})});}_0x54eaa1=_[_0x4c49('0x40')]({},_0x54eaa1,_0x20e16e[_0x4c49('0x56')]);var _0x381276={'where':_0x54eaa1[_0x4c49('0x52')]};return db[_0x4c49('0x57')][_0x4c49('0x35')](_0x381276)['then'](function(_0x289c2c){_0x44ef06[_0x4c49('0x35')]=_0x289c2c;if(_0x20e16e[_0x4c49('0x49')][_0x4c49('0x58')]){_0x54eaa1[_0x4c49('0x59')]=[{'all':!![]}];}return db[_0x4c49('0x57')][_0x4c49('0x5a')](_0x54eaa1);})['then'](function(_0x4e9f9a){_0x44ef06[_0x4c49('0x5b')]=_0x4e9f9a;return _0x44ef06;})[_0x4c49('0x24')](respondWithFilteredResult(_0x503a66,_0x54eaa1))[_0x4c49('0x2f')](handleError(_0x503a66,null));};exports['show']=function(_0x369f5e,_0x1fc4cf){var _0x38b328={'raw':!![],'where':{'id':_0x369f5e[_0x4c49('0x5c')]['id']}},_0x18b095={};_0x18b095[_0x4c49('0x48')]=_[_0x4c49('0x4a')](db['MailMessage'][_0x4c49('0x46')]);_0x18b095[_0x4c49('0x49')]=_[_0x4c49('0x4a')](_0x369f5e['query']);_0x18b095[_0x4c49('0x53')]=_[_0x4c49('0x4b')](_0x18b095[_0x4c49('0x48')],_0x18b095['query']);_0x38b328[_0x4c49('0x4c')]=_[_0x4c49('0x4b')](_0x18b095[_0x4c49('0x48')],qs[_0x4c49('0x4d')](_0x369f5e[_0x4c49('0x49')][_0x4c49('0x4d')]));_0x38b328['attributes']=_0x38b328[_0x4c49('0x4c')][_0x4c49('0x5d')]?_0x38b328['attributes']:_0x18b095[_0x4c49('0x48')];if(_0x369f5e[_0x4c49('0x49')][_0x4c49('0x58')]){_0x38b328[_0x4c49('0x59')]=[{'all':!![]}];}_0x38b328=_[_0x4c49('0x40')]({},_0x38b328,_0x369f5e[_0x4c49('0x56')]);return db[_0x4c49('0x57')][_0x4c49('0x5e')](_0x38b328)['then'](handleEntityNotFound(_0x1fc4cf,null))[_0x4c49('0x24')](respondWithResult(_0x1fc4cf,null))[_0x4c49('0x2f')](handleError(_0x1fc4cf,null));};exports[_0x4c49('0x3b')]=function(_0x4fec69,_0x17dfdb){if(_0x4fec69[_0x4c49('0x41')]['id']){delete _0x4fec69[_0x4c49('0x41')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x4fec69['params']['id']}})['then'](handleEntityNotFound(_0x17dfdb,null))[_0x4c49('0x24')](saveUpdates(_0x4fec69[_0x4c49('0x41')],null))[_0x4c49('0x24')](respondWithResult(_0x17dfdb,null))[_0x4c49('0x2f')](handleError(_0x17dfdb,null));};exports[_0x4c49('0x3c')]=function(_0x25aea2,_0x36e938){return db['MailMessage']['find']({'where':{'id':_0x25aea2[_0x4c49('0x5c')]['id']}})[_0x4c49('0x24')](handleEntityNotFound(_0x36e938,null))[_0x4c49('0x24')](removeEntity(_0x36e938,null))[_0x4c49('0x2f')](handleError(_0x36e938,null));};exports[_0x4c49('0x5f')]=function(_0x141760,_0x462d64){return db[_0x4c49('0x57')][_0x4c49('0x5f')]()['then'](respondWithResult(_0x462d64,null))[_0x4c49('0x2f')](handleError(_0x462d64,null));};exports[_0x4c49('0x60')]=function(_0xa7c841,_0x3fd706){return db[_0x4c49('0x57')][_0x4c49('0x60')](_0xa7c841[_0x4c49('0x41')])[_0x4c49('0x24')](function(_0x3b9f2f){if(_0x3b9f2f){if(_0x3b9f2f[_0x4c49('0x61')]===_0x4c49('0x62')&&!_0x3b9f2f[_0x4c49('0x63')]){var _0x5c07b8,_0xd435c1,_0x2b4553;if(_0xa7c841['body']['to']){_0xd435c1=_0xa7c841[_0x4c49('0x41')]['to'][_0x4c49('0x64')](',')[0x0];}return db[_0x4c49('0x65')]['findOne']({'where':{'id':_0x3b9f2f[_0x4c49('0x66')]},'include':[{'model':db['CmList'],'as':_0x4c49('0x67'),'include':[{'model':db[_0x4c49('0x68')],'as':_0x4c49('0x69'),'where':{'email':_0xd435c1},'limit':0x1,'order':[['updatedAt',_0x4c49('0x6a')]]}]},{'model':db[_0x4c49('0x6b')],'as':_0x4c49('0x6c'),'raw':!![]}]})['then'](function(_0x11823f){_0x5c07b8=_0x11823f;if(_0x5c07b8&&_0x5c07b8[_0x4c49('0x6c')]){var _0x5c9f78={'tls':{'rejectUnauthorized':![]}};if(_[_0x4c49('0x6d')](_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x6e')])){_0x5c9f78[_0x4c49('0x6f')]=_0x5c07b8[_0x4c49('0x6c')]['host'];_0x5c9f78[_0x4c49('0x70')]=_0x5c07b8[_0x4c49('0x6c')]['port'];_0x5c9f78['secure']=_0x5c07b8[_0x4c49('0x6c')]['secure'];if(_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x71')]){_0x5c9f78[_0x4c49('0x72')]={'user':_0x5c07b8['Smtp'][_0x4c49('0x73')],'pass':_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x74')]};}}else{_0x5c9f78['service']=_0x5c07b8['Smtp'][_0x4c49('0x6e')];_0x5c9f78[_0x4c49('0x72')]={'user':_0x5c07b8[_0x4c49('0x6c')][_0x4c49('0x73')],'pass':_0x5c07b8['Smtp'][_0x4c49('0x74')]};_0x5c9f78['secure']=_0x5c07b8['Smtp'][_0x4c49('0x75')];}if(_0xa7c841[_0x4c49('0x41')]['attachments']&&_0xa7c841[_0x4c49('0x41')][_0x4c49('0x76')][_0x4c49('0x5d')]){for(var _0x142f48=0x0;_0x142f48<_0xa7c841[_0x4c49('0x41')][_0x4c49('0x76')]['length'];_0x142f48+=0x1){_0xa7c841[_0x4c49('0x41')]['attachments'][_0x142f48]={'filename':_0xa7c841['body'][_0x4c49('0x76')][_0x142f48]['name'],'path':path[_0x4c49('0x77')](config['root'],_0x4c49('0x78'),_0xa7c841[_0x4c49('0x41')][_0x4c49('0x76')][_0x142f48][_0x4c49('0x79')])};}}_0x2b4553={'account':_0x5c9f78,'message':_0xa7c841[_0x4c49('0x41')]};return;}})[_0x4c49('0x24')](function(){if(_0x5c07b8[_0x4c49('0x67')]){if(_0x5c07b8[_0x4c49('0x67')]['Contacts'][_0x4c49('0x5d')]){return _0x5c07b8[_0x4c49('0x67')][_0x4c49('0x69')][0x0];}else{return db['CmContact'][_0x4c49('0x60')](_[_0x4c49('0x1d')](_0xa7c841[_0x4c49('0x41')],{'firstName':_0xa7c841[_0x4c49('0x41')]['to'],'email':_0xa7c841['body']['to'],'phone':_0xa7c841[_0x4c49('0x41')]['to'],'ListId':_0x5c07b8[_0x4c49('0x7a')]}));}}else{throw new Error(_0x4c49('0x7b'));}})[_0x4c49('0x24')](function(){if(_0x2b4553){return respondWithRpcPromise('SendMail','sendMail',_0x2b4553,client9003)[_0x4c49('0x24')](function(_0x1e08f4){return _0x3b9f2f[_0x4c49('0x3b')]({'read':!![],'messageId':_0x1e08f4['messageId'],'sentAt':moment()[_0x4c49('0x7c')](_0x4c49('0x7d'))});})[_0x4c49('0x2f')](function(_0x38b97d){logger['error']('%s',JSON[_0x4c49('0x29')](_0x38b97d));return _0x3b9f2f;});}return _0x3b9f2f;});}return _0x3b9f2f;}})[_0x4c49('0x24')](respondWithResult(_0x3fd706,0xc9))['catch'](handleError(_0x3fd706,null));};var interaction_log=require(_0x4c49('0x7e'))('mail-interactions');exports[_0x4c49('0x7f')]=function(_0x432502,_0x7dbb90,_0x5a2de8){var _0x56c601={'agent':{},'channel':'mail'};if(_0x432502[_0x4c49('0x41')]['id']){delete _0x432502[_0x4c49('0x41')]['id'];}_0x432502[_0x4c49('0x41')][_0x4c49('0x80')]=!![];_0x432502[_0x4c49('0x41')][_0x4c49('0x81')]=moment()[_0x4c49('0x7c')](_0x4c49('0x7d'));_0x432502['body'][_0x4c49('0x82')]=_0x432502[_0x4c49('0x41')][_0x4c49('0x82')]||_0x432502[_0x4c49('0x73')]['id'];_0x56c601[_0x4c49('0x83')]['id']=_0x432502[_0x4c49('0x41')][_0x4c49('0x82')];return db[_0x4c49('0x57')]['find']({'where':{'id':_0x432502[_0x4c49('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0x4c49('0x68')],'as':_0x4c49('0x84')}]})[_0x4c49('0x24')](handleEntityNotFound(_0x7dbb90,null))[_0x4c49('0x24')](saveUpdates(_0x432502[_0x4c49('0x41')],null))[_0x4c49('0x24')](function(_0x249d3a){if(_0x249d3a){_0x56c601[_0x4c49('0x2c')]=_0x249d3a['get']({'plain':!![]});return db[_0x4c49('0x85')][_0x4c49('0x5e')]({'where':{'id':_0x249d3a[_0x4c49('0x86')]}});}return null;})[_0x4c49('0x24')](handleEntityNotFound(_0x7dbb90,null))['then'](function(_0x18a25a){if(_0x18a25a){return _0x18a25a[_0x4c49('0x3b')]({'UserId':_0x432502[_0x4c49('0x41')]['UserId'],'read1stAt':_['isNil'](_0x18a25a[_0x4c49('0x87')])?moment()[_0x4c49('0x7c')](_0x4c49('0x7d')):undefined});}return null;})['then'](function(_0x5b9e2e){if(_0x5b9e2e){_0x56c601[_0x4c49('0x42')]=_0x5b9e2e[_0x4c49('0x88')]({'plain':!![]});interaction_log[_0x4c49('0x25')](_0x4c49('0x89'),_0x432502[_0x4c49('0x73')]['id'],_0x432502['user'][_0x4c49('0x8a')],_0x432502[_0x4c49('0x73')][_0x4c49('0x8b')],_0x56c601[_0x4c49('0x42')]['id'],_0x432502[_0x4c49('0x41')]?JSON['stringify'](_0x432502[_0x4c49('0x41')]):_0x4c49('0x8c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x56c601);}return null;})[_0x4c49('0x24')](function(_0x55ad14){if(_0x55ad14){if(_0x432502['body'][_0x4c49('0x8d')]){_0x56c601[_0x4c49('0x2c')][_0x4c49('0x8e')]=util['format'](_0x4c49('0x8f'),_0x432502[_0x4c49('0x73')][_0x4c49('0x8a')]);_0x56c601['message'][_0x4c49('0x90')]=_0x56c601['channel'];_0x56c601[_0x4c49('0x2c')][_0x4c49('0x91')]=_0x4c49('0x7f');return respondWithRpcPromise('EventManager',_0x4c49('0x92'),{'event':_0x4c49('0x93'),'message':_0x56c601[_0x4c49('0x2c')]},client9002)['then'](function(){return _0x56c601;});}return _0x56c601;}return null;})['then'](respondWithResult(_0x7dbb90,null))[_0x4c49('0x2f')](handleError(_0x7dbb90,null));};var interaction_log=require(_0x4c49('0x7e'))(_0x4c49('0x94'));exports[_0x4c49('0x39')]=function(_0x261b76,_0x5624e4,_0x4681d7){var _0x3987ce={'agent':{},'channel':_0x4c49('0x95')};if(_0x261b76[_0x4c49('0x41')]['id']){delete _0x261b76[_0x4c49('0x41')]['id'];}_0x261b76[_0x4c49('0x41')][_0x4c49('0x82')]=_0x261b76['body'][_0x4c49('0x82')]||_0x261b76[_0x4c49('0x73')]['id'];_0x3987ce[_0x4c49('0x83')]['id']=_0x261b76[_0x4c49('0x41')][_0x4c49('0x82')];return db['MailMessage']['find']({'where':{'id':_0x261b76[_0x4c49('0x5c')]['id'],'UserId':null}})[_0x4c49('0x24')](handleEntityNotFound(_0x5624e4,null))[_0x4c49('0x24')](function(_0x48c48a){if(_0x48c48a){_0x3987ce['message']=_0x48c48a[_0x4c49('0x88')]({'plain':!![]});return db[_0x4c49('0x85')][_0x4c49('0x5e')]({'where':{'id':_0x48c48a[_0x4c49('0x86')]}});}return null;})[_0x4c49('0x24')](handleEntityNotFound(_0x5624e4,null))[_0x4c49('0x24')](function(_0x5c662a){if(_0x5c662a){_0x3987ce['interaction']=_0x5c662a[_0x4c49('0x88')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x261b76[_0x4c49('0x73')]['id'],_0x261b76[_0x4c49('0x73')][_0x4c49('0x8a')],_0x261b76['user'][_0x4c49('0x8b')],_0x3987ce['interaction']['id'],_0x261b76[_0x4c49('0x41')]?JSON[_0x4c49('0x29')](_0x261b76[_0x4c49('0x41')]):_0x4c49('0x8c'));return respondWithRpcPromise(_0x4c49('0x96'),_0x4c49('0x97'),_0x3987ce);}return null;})[_0x4c49('0x24')](function(_0x1eebee){if(_0x1eebee){_0x1eebee[_0x4c49('0x2c')][_0x4c49('0x8e')]=util[_0x4c49('0x7c')](_0x4c49('0x8f'),_0x261b76[_0x4c49('0x73')]['name']);_0x1eebee[_0x4c49('0x2c')][_0x4c49('0x90')]=_0x3987ce[_0x4c49('0x90')];_0x1eebee[_0x4c49('0x2c')][_0x4c49('0x91')]=_0x4c49('0x39');respondWithRpcPromise(_0x4c49('0x92'),'EventManager',{'event':_0x4c49('0x98'),'message':_0x1eebee[_0x4c49('0x2c')]},client9002);return _0x3987ce;}return null;})[_0x4c49('0x24')](respondWithResult(_0x5624e4,null))[_0x4c49('0x2f')](handleError(_0x5624e4,null));};exports[_0x4c49('0x99')]=function(_0x2f2a2b,_0x480f40){var _0x4ac715=moment()[_0x4c49('0x9a')]()[_0x4c49('0x9b')]();var _0x4810a1=path[_0x4c49('0x77')](config[_0x4c49('0x9c')],_0x4c49('0x9d'),_0x4c49('0x9e'),_0x4c49('0x9f'));var _0x57b52d=path[_0x4c49('0x77')](config[_0x4c49('0x9c')],_0x4c49('0x9d'),_0x4c49('0x9e'),_0x4c49('0x76'));var _0x2823d1=util[_0x4c49('0x7c')](_0x4c49('0xa0'),_0x4ac715);return db[_0x4c49('0x57')][_0x4c49('0x5e')]({'where':{'id':_0x2f2a2b['params']['id']},'attributes':['id','body','from','to','cc',_0x4c49('0xa1'),_0x4c49('0xa2'),_0x4c49('0xa3')],'include':_0x2f2a2b[_0x4c49('0x49')][_0x4c49('0x76')]?[{'model':db['Attachment'],'as':_0x4c49('0xa4')}]:undefined})[_0x4c49('0x24')](handleEntityNotFound(_0x480f40,null))[_0x4c49('0x24')](function(_0xd98d35){if(_0xd98d35){var _0x2ba796=_0xd98d35;var _0x26270f={'from':_0x2ba796[_0x4c49('0xa5')],'to':_0x2ba796['to'],'subject':_0x2ba796[_0x4c49('0xa2')],'html':_0x2ba796['body'],'headers':{'Date':moment(_0x2ba796[_0x4c49('0xa3')])[_0x4c49('0x7c')](_0x4c49('0xa6'))},'attachments':[]};if(_0xd98d35['cc']){_0x26270f[_0x4c49('0xa7')]['Cc']=_0xd98d35['cc'];}if(_0xd98d35[_0x4c49('0xa1')]){_0x26270f[_0x4c49('0xa7')]['Bcc']=_0xd98d35[_0x4c49('0xa1')];}return new BPromise(function(_0x5959f6,_0x469fb7){if(_0xd98d35[_0x4c49('0xa4')]){for(var _0x23c8f3=0x0;_0x23c8f3<_0xd98d35[_0x4c49('0xa4')]['length'];_0x23c8f3++){var _0x36df0b=_0xd98d35[_0x4c49('0xa4')][_0x23c8f3];var _0x108c5d=path[_0x4c49('0x77')](_0x57b52d,_0x36df0b[_0x4c49('0x79')]);if(fs[_0x4c49('0xa8')](_0x108c5d)){_0x26270f[_0x4c49('0x76')][_0x4c49('0xa9')]({'name':_0x36df0b[_0x4c49('0x8a')],'contentType':_0x36df0b[_0x4c49('0x47')],'data':fs['readFileSync'](_0x108c5d)});}}}emlformat[_0x4c49('0xaa')](_0x26270f,function(_0x234ce4,_0x147363){if(_0x234ce4)return _0x469fb7(_0x234ce4);fs[_0x4c49('0xab')](path[_0x4c49('0x77')](_0x4810a1,_0x2823d1),_0x147363);return _0x5959f6(_0x147363);});});}})[_0x4c49('0x24')](function(_0x51c6a8){if(_0x51c6a8){return _0x480f40[_0x4c49('0x99')](path[_0x4c49('0x77')](_0x4810a1,_0x2823d1),_0x2823d1,function(_0x2c2fca){if(_0x2c2fca){console[_0x4c49('0xac')]('err',_0x2c2fca);}else{fs['unlinkSync'](path[_0x4c49('0x77')](_0x4810a1,_0x2823d1));}});}})[_0x4c49('0x2f')](handleError(_0x480f40,null));}; \ No newline at end of file +var _0x825a=['zip-dir','fast-json-patch','request-promise','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','stack','name','send','render','merge','body','agent','interaction','account','index','MailMessage','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','options','include','findAll','includeAll','find','update','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','pass','auth','user','attachments','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','mail-interactions','mail','readAt','UserId','Contact','MailInteraction','MailInteractionId','read1stAt','get','role','AcceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','null','rejectMessage','download','join','server','tmp','root','files','bcc','subject','createdAt','Attachment','from','headers','Bcc','Attachments','existsSync','push','build','writeFileSync','log','err','rimraf'];(function(_0x5b48ad,_0x3feb15){var _0xc116db=function(_0x553d71){while(--_0x553d71){_0x5b48ad['push'](_0x5b48ad['shift']());}};_0xc116db(++_0x3feb15);}(_0x825a,0xa0));var _0xa825=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x825a[_0x9fb081];return _0x43f8b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa825('0x0'));var zipdir=require(_0xa825('0x1'));var jsonpatch=require(_0xa825('0x2'));var rp=require(_0xa825('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa825('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa825('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa825('0x6'));var _=require(_0xa825('0x7'));var squel=require(_0xa825('0x8'));var crypto=require('crypto');var jsforce=require(_0xa825('0x9'));var deskjs=require(_0xa825('0xa'));var toCsv=require(_0xa825('0x5'));var querystring=require(_0xa825('0xb'));var Papa=require(_0xa825('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa825('0xd'));var logger=require(_0xa825('0xe'))(_0xa825('0xf'));var utils=require(_0xa825('0x10'));var config=require(_0xa825('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xa825('0x12'))['db'];config['redis']=_[_0xa825('0x13')](config[_0xa825('0x14')],{'host':_0xa825('0x15'),'port':0x18eb});var socket=require(_0xa825('0x16'))(new Redis(config[_0xa825('0x14')]));require(_0xa825('0x17'))[_0xa825('0x18')](socket);var jayson=require(_0xa825('0x19'));var client=jayson[_0xa825('0x1a')][_0xa825('0x1b')]({'port':0x232c});var client9003=jayson['client'][_0xa825('0x1b')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b377a,_0x42db51,_0x5dfef0,_0x43ecae){return new BPromise(function(_0x589188,_0x20ee99){var _0xef2d7b=_0x43ecae||client;return _0xef2d7b[_0xa825('0x1c')](_0x5b377a,_0x5dfef0)[_0xa825('0x1d')](function(_0x224d52){logger[_0xa825('0x1e')](_0xa825('0x1f'),_0x42db51,_0xa825('0x20'));logger[_0xa825('0x21')](_0xa825('0x22'),_0x42db51,'request\x20sent',JSON[_0xa825('0x23')](_0x224d52));if(_0x224d52[_0xa825('0x24')]){if(_0x224d52['error']['code']===0x1f4){logger['error'](_0xa825('0x1f'),_0x42db51,_0x224d52['error'][_0xa825('0x25')]);return _0x20ee99(_0x224d52[_0xa825('0x24')][_0xa825('0x25')]);}logger[_0xa825('0x24')](_0xa825('0x1f'),_0x42db51,_0x224d52['error'][_0xa825('0x25')]);return _0x589188(_0x224d52[_0xa825('0x24')][_0xa825('0x25')]);}else{logger[_0xa825('0x1e')](_0xa825('0x1f'),_0x42db51,_0xa825('0x20'));_0x589188(_0x224d52[_0xa825('0x26')][_0xa825('0x25')]);}})[_0xa825('0x27')](function(_0x23dcaf){logger[_0xa825('0x24')](_0xa825('0x1f'),_0x42db51,_0x23dcaf);_0x20ee99(_0x23dcaf);});});}function respondWithStatusCode(_0x201500,_0x30e9f3){_0x30e9f3=_0x30e9f3||0xcc;return function(_0x183e7e){if(_0x183e7e){return _0x201500[_0xa825('0x28')](_0x30e9f3);}return _0x201500[_0xa825('0x29')](_0x30e9f3)[_0xa825('0x2a')]();};}function respondWithResult(_0x27fbeb,_0x110d92){_0x110d92=_0x110d92||0xc8;return function(_0x506686){if(_0x506686){return _0x27fbeb[_0xa825('0x29')](_0x110d92)['json'](_0x506686);}};}function respondWithFilteredResult(_0x53dca4,_0x199c80){return function(_0x55bacd){if(_0x55bacd){var _0x27c7a1=typeof _0x199c80[_0xa825('0x2b')]===_0xa825('0x2c')&&typeof _0x199c80[_0xa825('0x2d')]===_0xa825('0x2c');var _0x46d1a3=_0x55bacd[_0xa825('0x2e')];var _0x26dae7=_0x27c7a1?0x0:_0x199c80[_0xa825('0x2b')];var _0x26ad2c=_0x27c7a1?_0x55bacd[_0xa825('0x2e')]:_0x199c80['offset']+_0x199c80[_0xa825('0x2d')];var _0xad5af5;if(_0x26ad2c>=_0x46d1a3){_0x26ad2c=_0x46d1a3;_0xad5af5=0xc8;}else{_0xad5af5=0xce;}_0x53dca4[_0xa825('0x29')](_0xad5af5);return _0x53dca4[_0xa825('0x2f')](_0xa825('0x30'),_0x26dae7+'-'+_0x26ad2c+'/'+_0x46d1a3)[_0xa825('0x31')](_0x55bacd);}return null;};}function patchUpdates(_0x47673b){return function(_0xfbca05){try{jsonpatch[_0xa825('0x32')](_0xfbca05,_0x47673b,!![]);}catch(_0x540667){return BPromise[_0xa825('0x33')](_0x540667);}return _0xfbca05['save']();};}function saveUpdates(_0x523255,_0x1d574b){return function(_0x4bd83f){if(_0x4bd83f){return _0x4bd83f['update'](_0x523255)[_0xa825('0x1d')](function(_0x31fddd){return _0x31fddd;});}return null;};}function removeEntity(_0x3d1c79,_0x4b5847){return function(_0x2743f2){if(_0x2743f2){return _0x2743f2[_0xa825('0x34')]()[_0xa825('0x1d')](function(){_0x3d1c79[_0xa825('0x29')](0xcc)[_0xa825('0x2a')]();});}};}function handleEntityNotFound(_0x5a495d,_0x15575c){return function(_0x5c81a6){if(!_0x5c81a6){_0x5a495d[_0xa825('0x28')](0x194);}return _0x5c81a6;};}function handleError(_0x36cb06,_0x11f922){_0x11f922=_0x11f922||0x1f4;return function(_0x5ee57c){logger[_0xa825('0x24')](_0x5ee57c[_0xa825('0x35')]);if(_0x5ee57c[_0xa825('0x36')]){delete _0x5ee57c[_0xa825('0x36')];}_0x36cb06['status'](_0x11f922)[_0xa825('0x37')](_0x5ee57c);};}function getMustacheRender(_0xe04fb8,_0x1e427f){return Mustache[_0xa825('0x38')](_0xe04fb8,_[_0xa825('0x39')](_0x1e427f[_0xa825('0x3a')],{'contact':_0x1e427f['contact'],'message':_0x1e427f[_0xa825('0x25')],'agent':_0x1e427f[_0xa825('0x3b')],'interaction':_0x1e427f[_0xa825('0x3c')],'account':_0x1e427f[_0xa825('0x3d')]}))||'';}exports[_0xa825('0x3e')]=function(_0x51cfdd,_0x38e37e){var _0x5869cd={},_0x33d62d={},_0x80c9e0={'count':0x0,'rows':[]};var _0x1a9dba=_['map'](db[_0xa825('0x3f')][_0xa825('0x40')],function(_0x1b412f){return{'name':_0x1b412f['fieldName'],'type':_0x1b412f[_0xa825('0x41')]['key']};});_0x33d62d[_0xa825('0x42')]=_[_0xa825('0x43')](_0x1a9dba,'name');_0x33d62d[_0xa825('0x44')]=_[_0xa825('0x45')](_0x51cfdd[_0xa825('0x44')]);_0x33d62d[_0xa825('0x46')]=_[_0xa825('0x47')](_0x33d62d[_0xa825('0x42')],_0x33d62d[_0xa825('0x44')]);_0x5869cd[_0xa825('0x48')]=_[_0xa825('0x47')](_0x33d62d['model'],qs['fields'](_0x51cfdd[_0xa825('0x44')][_0xa825('0x49')]));_0x5869cd['attributes']=_0x5869cd[_0xa825('0x48')][_0xa825('0x4a')]?_0x5869cd['attributes']:_0x33d62d[_0xa825('0x42')];if(!_0x51cfdd['query'][_0xa825('0x4b')]('nolimit')){_0x5869cd[_0xa825('0x2d')]=qs[_0xa825('0x2d')](_0x51cfdd[_0xa825('0x44')]['limit']);_0x5869cd['offset']=qs[_0xa825('0x2b')](_0x51cfdd['query'][_0xa825('0x2b')]);}_0x5869cd['order']=qs['sort'](_0x51cfdd[_0xa825('0x44')]['sort']);_0x5869cd[_0xa825('0x4c')]=qs[_0xa825('0x46')](_[_0xa825('0x4d')](_0x51cfdd[_0xa825('0x44')],_0x33d62d['filters']),_0x1a9dba);if(_0x51cfdd[_0xa825('0x44')][_0xa825('0x4e')]){_0x5869cd[_0xa825('0x4c')]=_[_0xa825('0x39')](_0x5869cd['where'],{'$or':_[_0xa825('0x43')](_0x1a9dba,function(_0x404d64){if(_0x404d64[_0xa825('0x41')]!=='VIRTUAL'){var _0x468c01={};_0x468c01[_0x404d64[_0xa825('0x36')]]={'$like':'%'+_0x51cfdd[_0xa825('0x44')][_0xa825('0x4e')]+'%'};return _0x468c01;}})});}_0x5869cd=_[_0xa825('0x39')]({},_0x5869cd,_0x51cfdd[_0xa825('0x4f')]);var _0x55ad09={'where':_0x5869cd[_0xa825('0x4c')]};return db[_0xa825('0x3f')][_0xa825('0x2e')](_0x55ad09)[_0xa825('0x1d')](function(_0x4c9480){_0x80c9e0[_0xa825('0x2e')]=_0x4c9480;if(_0x51cfdd[_0xa825('0x44')]['includeAll']){_0x5869cd[_0xa825('0x50')]=[{'all':!![]}];}return db[_0xa825('0x3f')][_0xa825('0x51')](_0x5869cd);})[_0xa825('0x1d')](function(_0x20f9d3){_0x80c9e0['rows']=_0x20f9d3;return _0x80c9e0;})[_0xa825('0x1d')](respondWithFilteredResult(_0x38e37e,_0x5869cd))[_0xa825('0x27')](handleError(_0x38e37e,null));};exports['show']=function(_0x1aff72,_0x42f9bf){var _0x4ecdcf={'raw':!![],'where':{'id':_0x1aff72['params']['id']}},_0x2c6203={};_0x2c6203[_0xa825('0x42')]=_[_0xa825('0x45')](db['MailMessage']['rawAttributes']);_0x2c6203[_0xa825('0x44')]=_[_0xa825('0x45')](_0x1aff72[_0xa825('0x44')]);_0x2c6203['filters']=_[_0xa825('0x47')](_0x2c6203[_0xa825('0x42')],_0x2c6203[_0xa825('0x44')]);_0x4ecdcf[_0xa825('0x48')]=_[_0xa825('0x47')](_0x2c6203['model'],qs[_0xa825('0x49')](_0x1aff72['query'][_0xa825('0x49')]));_0x4ecdcf[_0xa825('0x48')]=_0x4ecdcf['attributes'][_0xa825('0x4a')]?_0x4ecdcf[_0xa825('0x48')]:_0x2c6203[_0xa825('0x42')];if(_0x1aff72[_0xa825('0x44')][_0xa825('0x52')]){_0x4ecdcf[_0xa825('0x50')]=[{'all':!![]}];}_0x4ecdcf=_[_0xa825('0x39')]({},_0x4ecdcf,_0x1aff72[_0xa825('0x4f')]);return db['MailMessage'][_0xa825('0x53')](_0x4ecdcf)[_0xa825('0x1d')](handleEntityNotFound(_0x42f9bf,null))[_0xa825('0x1d')](respondWithResult(_0x42f9bf,null))[_0xa825('0x27')](handleError(_0x42f9bf,null));};exports[_0xa825('0x54')]=function(_0x42954d,_0x2ae000){if(_0x42954d[_0xa825('0x3a')]['id']){delete _0x42954d[_0xa825('0x3a')]['id'];}return db[_0xa825('0x3f')]['find']({'where':{'id':_0x42954d[_0xa825('0x55')]['id']}})[_0xa825('0x1d')](handleEntityNotFound(_0x2ae000,null))[_0xa825('0x1d')](saveUpdates(_0x42954d['body'],null))['then'](respondWithResult(_0x2ae000,null))[_0xa825('0x27')](handleError(_0x2ae000,null));};exports['destroy']=function(_0x4e8492,_0x37bce5){return db[_0xa825('0x3f')][_0xa825('0x53')]({'where':{'id':_0x4e8492[_0xa825('0x55')]['id']}})[_0xa825('0x1d')](handleEntityNotFound(_0x37bce5,null))[_0xa825('0x1d')](removeEntity(_0x37bce5,null))[_0xa825('0x27')](handleError(_0x37bce5,null));};exports[_0xa825('0x56')]=function(_0x1418a7,_0x7573d3){return db['MailMessage'][_0xa825('0x56')]()[_0xa825('0x1d')](respondWithResult(_0x7573d3,null))['catch'](handleError(_0x7573d3,null));};exports['create']=function(_0x1c724f,_0x3663f9){return db[_0xa825('0x3f')][_0xa825('0x57')](_0x1c724f[_0xa825('0x3a')])[_0xa825('0x1d')](function(_0x20bacd){if(_0x20bacd){if(_0x20bacd[_0xa825('0x58')]===_0xa825('0x59')&&!_0x20bacd[_0xa825('0x5a')]){var _0x5413a5,_0xf5a879,_0x4ddcf1;if(_0x1c724f['body']['to']){_0xf5a879=_0x1c724f[_0xa825('0x3a')]['to'][_0xa825('0x5b')](',')[0x0];}return db[_0xa825('0x5c')][_0xa825('0x5d')]({'where':{'id':_0x20bacd[_0xa825('0x5e')]},'include':[{'model':db[_0xa825('0x5f')],'as':'List','include':[{'model':db[_0xa825('0x60')],'as':_0xa825('0x61'),'where':{'email':_0xf5a879},'limit':0x1,'order':[[_0xa825('0x62'),_0xa825('0x63')]]}]},{'model':db['MailServerOut'],'as':_0xa825('0x64'),'raw':!![]}]})[_0xa825('0x1d')](function(_0x37dfac){_0x5413a5=_0x37dfac;if(_0x5413a5&&_0x5413a5['Smtp']){var _0x2f723d={'tls':{'rejectUnauthorized':![]}};if(_[_0xa825('0x65')](_0x5413a5['Smtp'][_0xa825('0x66')])){_0x2f723d[_0xa825('0x67')]=_0x5413a5[_0xa825('0x64')][_0xa825('0x67')];_0x2f723d[_0xa825('0x68')]=_0x5413a5[_0xa825('0x64')][_0xa825('0x68')];_0x2f723d[_0xa825('0x69')]=_0x5413a5[_0xa825('0x64')][_0xa825('0x69')];if(_0x5413a5[_0xa825('0x64')][_0xa825('0x6a')]){_0x2f723d['auth']={'user':_0x5413a5[_0xa825('0x64')]['user'],'pass':_0x5413a5[_0xa825('0x64')][_0xa825('0x6b')]};}}else{_0x2f723d[_0xa825('0x66')]=_0x5413a5[_0xa825('0x64')][_0xa825('0x66')];_0x2f723d[_0xa825('0x6c')]={'user':_0x5413a5[_0xa825('0x64')][_0xa825('0x6d')],'pass':_0x5413a5[_0xa825('0x64')][_0xa825('0x6b')]};_0x2f723d[_0xa825('0x69')]=_0x5413a5[_0xa825('0x64')][_0xa825('0x69')];}if(_0x1c724f['body'][_0xa825('0x6e')]&&_0x1c724f[_0xa825('0x3a')]['attachments'][_0xa825('0x4a')]){for(var _0x1d7590=0x0;_0x1d7590<_0x1c724f['body'][_0xa825('0x6e')][_0xa825('0x4a')];_0x1d7590+=0x1){_0x1c724f[_0xa825('0x3a')]['attachments'][_0x1d7590]={'filename':_0x1c724f['body'][_0xa825('0x6e')][_0x1d7590][_0xa825('0x36')],'path':path['join'](config['root'],_0xa825('0x6f'),_0x1c724f[_0xa825('0x3a')]['attachments'][_0x1d7590][_0xa825('0x70')])};}}_0x4ddcf1={'account':_0x2f723d,'message':_0x1c724f[_0xa825('0x3a')]};return;}})[_0xa825('0x1d')](function(){if(_0x5413a5[_0xa825('0x71')]){if(_0x5413a5['List'][_0xa825('0x61')]['length']){return _0x5413a5[_0xa825('0x71')][_0xa825('0x61')][0x0];}else{return db[_0xa825('0x60')][_0xa825('0x57')](_[_0xa825('0x13')](_0x1c724f['body'],{'firstName':_0x1c724f[_0xa825('0x3a')]['to'],'email':_0x1c724f[_0xa825('0x3a')]['to'],'phone':_0x1c724f[_0xa825('0x3a')]['to'],'ListId':_0x5413a5[_0xa825('0x72')]}));}}else{throw new Error(_0xa825('0x73'));}})['then'](function(){if(_0x4ddcf1){return respondWithRpcPromise(_0xa825('0x74'),_0xa825('0x75'),_0x4ddcf1,client9003)[_0xa825('0x1d')](function(_0x4c64b1){return _0x20bacd['update']({'read':!![],'messageId':_0x4c64b1[_0xa825('0x76')],'sentAt':moment()[_0xa825('0x77')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xa825('0x27')](function(_0x36d8b1){logger[_0xa825('0x24')]('%s',JSON[_0xa825('0x23')](_0x36d8b1));return _0x20bacd;});}return _0x20bacd;});}return _0x20bacd;}})['then'](respondWithResult(_0x3663f9,0xc9))[_0xa825('0x27')](handleError(_0x3663f9,null));};var interaction_log=require(_0xa825('0xe'))(_0xa825('0x78'));exports['accept']=function(_0x2e5d9c,_0x5be5e7,_0xc5309d){var _0x53398c={'agent':{},'channel':_0xa825('0x79')};if(_0x2e5d9c[_0xa825('0x3a')]['id']){delete _0x2e5d9c['body']['id'];}_0x2e5d9c[_0xa825('0x3a')]['read']=!![];_0x2e5d9c[_0xa825('0x3a')][_0xa825('0x7a')]=moment()[_0xa825('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e5d9c[_0xa825('0x3a')][_0xa825('0x7b')]=_0x2e5d9c[_0xa825('0x3a')]['UserId']||_0x2e5d9c[_0xa825('0x6d')]['id'];_0x53398c[_0xa825('0x3b')]['id']=_0x2e5d9c[_0xa825('0x3a')][_0xa825('0x7b')];return db[_0xa825('0x3f')][_0xa825('0x53')]({'where':{'id':_0x2e5d9c['params']['id'],'UserId':null},'include':[{'model':db[_0xa825('0x60')],'as':_0xa825('0x7c')}]})[_0xa825('0x1d')](handleEntityNotFound(_0x5be5e7,null))[_0xa825('0x1d')](saveUpdates(_0x2e5d9c['body'],null))[_0xa825('0x1d')](function(_0x3ade62){if(_0x3ade62){_0x53398c['message']=_0x3ade62['get']({'plain':!![]});return db[_0xa825('0x7d')][_0xa825('0x53')]({'where':{'id':_0x3ade62[_0xa825('0x7e')]}});}return null;})[_0xa825('0x1d')](handleEntityNotFound(_0x5be5e7,null))['then'](function(_0x3970b3){if(_0x3970b3){return _0x3970b3[_0xa825('0x54')]({'UserId':_0x2e5d9c[_0xa825('0x3a')]['UserId'],'read1stAt':_[_0xa825('0x65')](_0x3970b3[_0xa825('0x7f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa825('0x1d')](function(_0x5ccdeb){if(_0x5ccdeb){_0x53398c['interaction']=_0x5ccdeb[_0xa825('0x80')]({'plain':!![]});interaction_log[_0xa825('0x1e')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2e5d9c[_0xa825('0x6d')]['id'],_0x2e5d9c[_0xa825('0x6d')]['name'],_0x2e5d9c[_0xa825('0x6d')][_0xa825('0x81')],_0x53398c[_0xa825('0x3c')]['id'],_0x2e5d9c[_0xa825('0x3a')]?JSON[_0xa825('0x23')](_0x2e5d9c[_0xa825('0x3a')]):'null');return respondWithRpcPromise(_0xa825('0x82'),'acceptMessage',_0x53398c);}return null;})[_0xa825('0x1d')](function(_0x48b5a8){if(_0x48b5a8){if(_0x2e5d9c['body'][_0xa825('0x83')]){_0x53398c['message'][_0xa825('0x84')]=util[_0xa825('0x77')](_0xa825('0x85'),_0x2e5d9c[_0xa825('0x6d')]['name']);_0x53398c[_0xa825('0x25')][_0xa825('0x86')]=_0x53398c[_0xa825('0x86')];_0x53398c[_0xa825('0x25')][_0xa825('0x87')]=_0xa825('0x88');return respondWithRpcPromise(_0xa825('0x89'),_0xa825('0x89'),{'event':_0xa825('0x8a'),'message':_0x53398c[_0xa825('0x25')]},client9002)[_0xa825('0x1d')](function(){return _0x53398c;});}return _0x53398c;}return null;})['then'](respondWithResult(_0x5be5e7,null))[_0xa825('0x27')](handleError(_0x5be5e7,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['reject']=function(_0x3e0532,_0x294a55,_0x5a1642){var _0x191100={'agent':{},'channel':_0xa825('0x79')};if(_0x3e0532['body']['id']){delete _0x3e0532[_0xa825('0x3a')]['id'];}_0x3e0532['body'][_0xa825('0x7b')]=_0x3e0532[_0xa825('0x3a')][_0xa825('0x7b')]||_0x3e0532[_0xa825('0x6d')]['id'];_0x191100[_0xa825('0x3b')]['id']=_0x3e0532[_0xa825('0x3a')][_0xa825('0x7b')];return db[_0xa825('0x3f')][_0xa825('0x53')]({'where':{'id':_0x3e0532['params']['id'],'UserId':null}})[_0xa825('0x1d')](handleEntityNotFound(_0x294a55,null))[_0xa825('0x1d')](function(_0x10031e){if(_0x10031e){_0x191100[_0xa825('0x25')]=_0x10031e[_0xa825('0x80')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x10031e[_0xa825('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x294a55,null))['then'](function(_0x169aee){if(_0x169aee){_0x191100[_0xa825('0x3c')]=_0x169aee[_0xa825('0x80')]({'plain':!![]});interaction_log[_0xa825('0x1e')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e0532[_0xa825('0x6d')]['id'],_0x3e0532[_0xa825('0x6d')]['name'],_0x3e0532['user'][_0xa825('0x81')],_0x191100[_0xa825('0x3c')]['id'],_0x3e0532['body']?JSON['stringify'](_0x3e0532[_0xa825('0x3a')]):_0xa825('0x8b'));return respondWithRpcPromise('RejectMessage',_0xa825('0x8c'),_0x191100);}return null;})[_0xa825('0x1d')](function(_0x372ca7){if(_0x372ca7){_0x372ca7[_0xa825('0x25')][_0xa825('0x84')]=util['format'](_0xa825('0x85'),_0x3e0532[_0xa825('0x6d')]['name']);_0x372ca7[_0xa825('0x25')][_0xa825('0x86')]=_0x191100[_0xa825('0x86')];_0x372ca7['message']['event']=_0xa825('0x33');respondWithRpcPromise('EventManager',_0xa825('0x89'),{'event':'rejectmessage','message':_0x372ca7['message']},client9002);return _0x191100;}return null;})[_0xa825('0x1d')](respondWithResult(_0x294a55,null))[_0xa825('0x27')](handleError(_0x294a55,null));};exports[_0xa825('0x8d')]=function(_0x233e36,_0xadb1d6){var _0x4bf297=moment()['unix']()['toString']();var _0x590617=path[_0xa825('0x8e')](config['root'],_0xa825('0x8f'),'files',_0xa825('0x90'));var _0x82e57c=path[_0xa825('0x8e')](config[_0xa825('0x91')],_0xa825('0x8f'),_0xa825('0x92'),_0xa825('0x6e'));var _0x39ff30=util[_0xa825('0x77')]('message-%s.eml',_0x4bf297);return db['MailMessage'][_0xa825('0x53')]({'where':{'id':_0x233e36[_0xa825('0x55')]['id']},'attributes':['id',_0xa825('0x3a'),'from','to','cc',_0xa825('0x93'),_0xa825('0x94'),_0xa825('0x95')],'include':_0x233e36[_0xa825('0x44')][_0xa825('0x6e')]?[{'model':db[_0xa825('0x96')],'as':'Attachments'}]:undefined})[_0xa825('0x1d')](handleEntityNotFound(_0xadb1d6,null))[_0xa825('0x1d')](function(_0x24c03d){if(_0x24c03d){var _0x51274a=_0x24c03d;var _0x1007dd={'from':_0x51274a[_0xa825('0x97')],'to':_0x51274a['to'],'subject':_0x51274a['subject'],'html':_0x51274a[_0xa825('0x3a')],'headers':{'Date':moment(_0x51274a[_0xa825('0x95')])[_0xa825('0x77')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x24c03d['cc']){_0x1007dd[_0xa825('0x98')]['Cc']=_0x24c03d['cc'];}if(_0x24c03d[_0xa825('0x93')]){_0x1007dd[_0xa825('0x98')][_0xa825('0x99')]=_0x24c03d[_0xa825('0x93')];}return new BPromise(function(_0x6563d8,_0x4563d7){if(_0x24c03d[_0xa825('0x9a')]){for(var _0x29dd6a=0x0;_0x29dd6a<_0x24c03d[_0xa825('0x9a')][_0xa825('0x4a')];_0x29dd6a++){var _0x94c2ad=_0x24c03d[_0xa825('0x9a')][_0x29dd6a];var _0x2f57fb=path[_0xa825('0x8e')](_0x82e57c,_0x94c2ad[_0xa825('0x70')]);if(fs[_0xa825('0x9b')](_0x2f57fb)){_0x1007dd[_0xa825('0x6e')][_0xa825('0x9c')]({'name':_0x94c2ad[_0xa825('0x36')],'contentType':_0x94c2ad[_0xa825('0x41')],'data':fs['readFileSync'](_0x2f57fb)});}}}emlformat[_0xa825('0x9d')](_0x1007dd,function(_0x1ab9dd,_0x4cc464){if(_0x1ab9dd)return _0x4563d7(_0x1ab9dd);fs[_0xa825('0x9e')](path[_0xa825('0x8e')](_0x590617,_0x39ff30),_0x4cc464);return _0x6563d8(_0x4cc464);});});}})['then'](function(_0x45cea0){if(_0x45cea0){return _0xadb1d6[_0xa825('0x8d')](path[_0xa825('0x8e')](_0x590617,_0x39ff30),_0x39ff30,function(_0x16db89){if(_0x16db89){console[_0xa825('0x9f')](_0xa825('0xa0'),_0x16db89);}else{fs['unlinkSync'](path['join'](_0x590617,_0x39ff30));}});}})[_0xa825('0x27')](handleError(_0xadb1d6,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a447e94..bd2f779 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8913=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x1d509c,_0x95dd8d){var _0x2c5933=function(_0x3525b6){while(--_0x3525b6){_0x1d509c['push'](_0x1d509c['shift']());}};_0x2c5933(++_0x95dd8d);}(_0x8913,0x9c));var _0x3891=function(_0x18e0fd,_0x4e1cb4){_0x18e0fd=_0x18e0fd-0x0;var _0x6ba47a=_0x8913[_0x18e0fd];return _0x6ba47a;};'use strict';var EventEmitter=require(_0x3891('0x0'));var MailMessage=require(_0x3891('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3891('0x2'),'afterUpdate':_0x3891('0x3'),'afterDestroy':_0x3891('0x4')};function emitEvent(_0x3234c9){return function(_0x2fa248,_0x172e10,_0x2ad7a4){MailMessageEvents[_0x3891('0x5')](_0x3234c9+':'+_0x2fa248['id'],_0x2fa248);MailMessageEvents[_0x3891('0x5')](_0x3234c9,_0x2fa248);_0x2ad7a4(null);};}for(var e in events){if(events[_0x3891('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x3891('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x17b4=['hasOwnProperty','hook','../../mysqldb','save','update','remove','emit'];(function(_0x2cfbca,_0x53768a){var _0x8c45b9=function(_0x18b7aa){while(--_0x18b7aa){_0x2cfbca['push'](_0x2cfbca['shift']());}};_0x8c45b9(++_0x53768a);}(_0x17b4,0x64));var _0x417b=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x17b4[_0x18ab2a];return _0x16dcee;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x417b('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x417b('0x1'),'afterUpdate':_0x417b('0x2'),'afterDestroy':_0x417b('0x3')};function emitEvent(_0x49a12c){return function(_0x10a797,_0x278a55,_0x164fea){MailMessageEvents[_0x417b('0x4')](_0x49a12c+':'+_0x10a797['id'],_0x10a797);MailMessageEvents[_0x417b('0x4')](_0x49a12c,_0x10a797);_0x164fea(null);};}for(var e in events){if(events[_0x417b('0x5')](e)){var event=events[e];MailMessage[_0x417b('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 910b54a..ebc3927 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07b8=['define','MailMessage','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x07b8,0x1d4));var _0x807b=function(_0x1c21cc,_0x322a71){_0x1c21cc=_0x1c21cc-0x0;var _0x7af1cb=_0x07b8[_0x1c21cc];return _0x7af1cb;};'use strict';var _=require(_0x807b('0x0'));var util=require(_0x807b('0x1'));var logger=require(_0x807b('0x2'))(_0x807b('0x3'));var moment=require(_0x807b('0x4'));var BPromise=require(_0x807b('0x5'));var rp=require(_0x807b('0x6'));var htmlToText=require(_0x807b('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x807b('0x8'));var config=require(_0x807b('0x9'));var attributes=require(_0x807b('0xa'));module[_0x807b('0xb')]=function(_0x143485,_0x49dbe5){return _0x143485[_0x807b('0xc')](_0x807b('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x807b('0xe'),'fields':[_0x807b('0xe')]},{'name':_0x807b('0xf'),'fields':[_0x807b('0x10'),'subject'],'type':_0x807b('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x258248,_0x2160c7,_0x5aa1de){if(_0x258248[_0x807b('0x12')]){_0x258248[_0x807b('0x10')]=htmlToText[_0x807b('0x13')](_0x258248['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5aa1de(null,_0x2160c7);},'afterCreate':function(_0x5b969c,_0x1c439c,_0x595a17){var _0x40297f=_0x143485[_0x807b('0x14')];var _0x52a272=_0x5b969c[_0x807b('0x15')]({'plain':!![]});if(_0x52a272[_0x807b('0x16')][_0x807b('0x17')]()==='in'||_0x52a272['direction'][_0x807b('0x17')]()==='out'&&!_0x52a272[_0x807b('0x18')]&&!_['isNil'](_0x52a272[_0x807b('0x19')])){_0x40297f['MailInteraction']['findOne']({'where':{'id':_0x52a272[_0x807b('0x1a')]}})[_0x807b('0x1b')](function(_0x3aa8d5){if(_0x3aa8d5){_0x3aa8d5['update']({'lastMsgAt':_0x52a272[_0x807b('0x1c')],'lastMsgDirection':_0x52a272[_0x807b('0x16')][_0x807b('0x17')]()});}})['catch'](function(_0x12fd34){console[_0x807b('0x1d')](_0x12fd34);});}_0x595a17();}},'charset':_0x807b('0x1e'),'collate':_0x807b('0x1f')});}; \ No newline at end of file +var _0x5f60=['moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','MailInteraction','findOne','then','update','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x520ca3,_0x37acd7){var _0x36360d=function(_0x2852c0){while(--_0x2852c0){_0x520ca3['push'](_0x520ca3['shift']());}};_0x36360d(++_0x37acd7);}(_0x5f60,0xed));var _0x05f6=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5f60[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x05f6('0x0'));var util=require('util');var logger=require(_0x05f6('0x1'))(_0x05f6('0x2'));var moment=require(_0x05f6('0x3'));var BPromise=require(_0x05f6('0x4'));var rp=require(_0x05f6('0x5'));var htmlToText=require(_0x05f6('0x6'));var fs=require('fs');var path=require(_0x05f6('0x7'));var rimraf=require(_0x05f6('0x8'));var config=require(_0x05f6('0x9'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x41a88b,_0x37925f){return _0x41a88b[_0x05f6('0xa')](_0x05f6('0xb'),attributes,{'tableName':_0x05f6('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x05f6('0xd')]},{'name':_0x05f6('0xe'),'fields':[_0x05f6('0xf'),'subject'],'type':_0x05f6('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x38b2f7,_0x5f4f08,_0x4bbf22){if(_0x38b2f7[_0x05f6('0x11')]){_0x38b2f7[_0x05f6('0xf')]=htmlToText[_0x05f6('0x12')](_0x38b2f7[_0x05f6('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4bbf22(null,_0x5f4f08);},'afterCreate':function(_0x3c5b11,_0xe41d34,_0x42ffc1){var _0x5185e6=_0x41a88b[_0x05f6('0x13')];var _0x4b4866=_0x3c5b11[_0x05f6('0x14')]({'plain':!![]});if(_0x4b4866[_0x05f6('0x15')]['toLowerCase']()==='in'||_0x4b4866[_0x05f6('0x15')][_0x05f6('0x16')]()===_0x05f6('0x17')&&!_0x4b4866['secret']&&!_['isNil'](_0x4b4866['UserId'])){_0x5185e6[_0x05f6('0x18')][_0x05f6('0x19')]({'where':{'id':_0x4b4866['MailInteractionId']}})[_0x05f6('0x1a')](function(_0x4cc1b1){if(_0x4cc1b1){_0x4cc1b1[_0x05f6('0x1b')]({'lastMsgAt':_0x4b4866['createdAt'],'lastMsgDirection':_0x4b4866[_0x05f6('0x15')]['toLowerCase']()});}})[_0x05f6('0x1c')](function(_0x36ddc3){console['error'](_0x36ddc3);});}_0x42ffc1();}},'charset':'utf8mb4','collate':_0x05f6('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 1b78dc9..45c4cce 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdea1=['error','code','message','result','catch','MailMessage','create','body','raw','CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd8a5c5,_0x34222f){var _0x1ee77b=function(_0xa03e74){while(--_0xa03e74){_0xd8a5c5['push'](_0xd8a5c5['shift']());}};_0x1ee77b(++_0x34222f);}(_0xdea1,0x1f4));var _0x1dea=function(_0x19eea1,_0x30edd4){_0x19eea1=_0x19eea1-0x0;var _0x5679a2=_0xdea1[_0x19eea1];return _0x5679a2;};'use strict';var _=require(_0x1dea('0x0'));var util=require(_0x1dea('0x1'));var moment=require(_0x1dea('0x2'));var BPromise=require(_0x1dea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dea('0x4'));var db=require(_0x1dea('0x5'))['db'];var utils=require(_0x1dea('0x6'));var logger=require(_0x1dea('0x7'))(_0x1dea('0x8'));var config=require('../../config/environment');var jayson=require(_0x1dea('0x9'));var client=jayson[_0x1dea('0xa')][_0x1dea('0xb')]({'port':0x232a});config[_0x1dea('0xc')]=_[_0x1dea('0xd')](config[_0x1dea('0xc')],{'host':_0x1dea('0xe'),'port':0x18eb});var socket=require(_0x1dea('0xf'))(new Redis(config[_0x1dea('0xc')]));require(_0x1dea('0x10'))[_0x1dea('0x11')](socket);function respondWithRpcPromise(_0xd9ee10,_0x1efefb,_0x5c2b88){return new BPromise(function(_0x3d49f0,_0x22a726){return client[_0x1dea('0x12')](_0xd9ee10,_0x5c2b88)[_0x1dea('0x13')](function(_0x47abf2){logger[_0x1dea('0x14')](_0x1dea('0x15'),_0x1efefb,_0x1dea('0x16'));logger['debug'](_0x1dea('0x17'),_0x1efefb,_0x1dea('0x16'),JSON[_0x1dea('0x18')](_0x47abf2));if(_0x47abf2[_0x1dea('0x19')]){if(_0x47abf2['error'][_0x1dea('0x1a')]===0x1f4){logger['error'](_0x1dea('0x15'),_0x1efefb,_0x47abf2[_0x1dea('0x19')][_0x1dea('0x1b')]);return _0x22a726(_0x47abf2[_0x1dea('0x19')][_0x1dea('0x1b')]);}logger[_0x1dea('0x19')](_0x1dea('0x15'),_0x1efefb,_0x47abf2[_0x1dea('0x19')][_0x1dea('0x1b')]);return _0x3d49f0(_0x47abf2['error'][_0x1dea('0x1b')]);}else{logger[_0x1dea('0x14')](_0x1dea('0x15'),_0x1efefb,_0x1dea('0x16'));_0x3d49f0(_0x47abf2[_0x1dea('0x1c')][_0x1dea('0x1b')]);}})[_0x1dea('0x1d')](function(_0x2d210f){logger[_0x1dea('0x19')](_0x1dea('0x15'),_0x1efefb,_0x2d210f);_0x22a726(_0x2d210f);});});}exports['CreateMailMessage']=function(_0x2c5865){var _0x3c5280=this;return new Promise(function(_0x1f6eb2,_0x1e3198){return db[_0x1dea('0x1e')][_0x1dea('0x1f')](_0x2c5865[_0x1dea('0x20')],{'raw':_0x2c5865['options']?_0x2c5865['options'][_0x1dea('0x21')]===undefined?!![]:![]:!![]})[_0x1dea('0x13')](function(_0x5ba09a){logger[_0x1dea('0x14')]('CreateMailMessage',_0x2c5865);logger['debug'](_0x1dea('0x22'),_0x2c5865,JSON['stringify'](_0x5ba09a));_0x1f6eb2(_0x5ba09a);})['catch'](function(_0x31292d){logger['error']('CreateMailMessage',_0x31292d[_0x1dea('0x1b')],_0x2c5865);_0x1e3198(_0x3c5280[_0x1dea('0x19')](0x1f4,_0x31292d[_0x1dea('0x1b')]));});});}; \ No newline at end of file +var _0x6f2a=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','create','body','options','raw','debug','stringify','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailMessage.socket','register'];(function(_0x28bfdc,_0x50fd27){var _0x25bf45=function(_0x17f94a){while(--_0x17f94a){_0x28bfdc['push'](_0x28bfdc['shift']());}};_0x25bf45(++_0x50fd27);}(_0x6f2a,0x1e0));var _0xa6f2=function(_0x3a76b6,_0x38ce60){_0x3a76b6=_0x3a76b6-0x0;var _0x1c84b8=_0x6f2a[_0x3a76b6];return _0x1c84b8;};'use strict';var _=require(_0xa6f2('0x0'));var util=require('util');var moment=require(_0xa6f2('0x1'));var BPromise=require(_0xa6f2('0x2'));var rs=require(_0xa6f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa6f2('0x4'));var logger=require(_0xa6f2('0x5'))(_0xa6f2('0x6'));var config=require(_0xa6f2('0x7'));var jayson=require(_0xa6f2('0x8'));var client=jayson[_0xa6f2('0x9')][_0xa6f2('0xa')]({'port':0x232a});config[_0xa6f2('0xb')]=_[_0xa6f2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6f2('0xb')]));require(_0xa6f2('0xd'))[_0xa6f2('0xe')](socket);function respondWithRpcPromise(_0x1fcff0,_0x327050,_0x867227){return new BPromise(function(_0x39680c,_0x5c5599){return client[_0xa6f2('0xf')](_0x1fcff0,_0x867227)[_0xa6f2('0x10')](function(_0xd0b0de){logger[_0xa6f2('0x11')](_0xa6f2('0x12'),_0x327050,_0xa6f2('0x13'));logger['debug'](_0xa6f2('0x14'),_0x327050,'request\x20sent',JSON['stringify'](_0xd0b0de));if(_0xd0b0de['error']){if(_0xd0b0de[_0xa6f2('0x15')][_0xa6f2('0x16')]===0x1f4){logger[_0xa6f2('0x15')]('MailMessage,\x20%s,\x20%s',_0x327050,_0xd0b0de[_0xa6f2('0x15')][_0xa6f2('0x17')]);return _0x5c5599(_0xd0b0de[_0xa6f2('0x15')]['message']);}logger[_0xa6f2('0x15')]('MailMessage,\x20%s,\x20%s',_0x327050,_0xd0b0de[_0xa6f2('0x15')][_0xa6f2('0x17')]);return _0x39680c(_0xd0b0de['error'][_0xa6f2('0x17')]);}else{logger['info'](_0xa6f2('0x12'),_0x327050,_0xa6f2('0x13'));_0x39680c(_0xd0b0de[_0xa6f2('0x18')][_0xa6f2('0x17')]);}})[_0xa6f2('0x19')](function(_0x219693){logger[_0xa6f2('0x15')](_0xa6f2('0x12'),_0x327050,_0x219693);_0x5c5599(_0x219693);});});}exports[_0xa6f2('0x1a')]=function(_0x5ed392){var _0x3ea9c7=this;return new Promise(function(_0x1e184c,_0x592154){return db['MailMessage'][_0xa6f2('0x1b')](_0x5ed392[_0xa6f2('0x1c')],{'raw':_0x5ed392['options']?_0x5ed392[_0xa6f2('0x1d')][_0xa6f2('0x1e')]===undefined?!![]:![]:!![]})[_0xa6f2('0x10')](function(_0x17f2b7){logger[_0xa6f2('0x11')](_0xa6f2('0x1a'),_0x5ed392);logger[_0xa6f2('0x1f')]('CreateMailMessage',_0x5ed392,JSON[_0xa6f2('0x20')](_0x17f2b7));_0x1e184c(_0x17f2b7);})[_0xa6f2('0x19')](function(_0xe1eff9){logger[_0xa6f2('0x15')](_0xa6f2('0x1a'),_0xe1eff9[_0xa6f2('0x17')],_0x5ed392);_0x592154(_0x3ea9c7['error'](0x1f4,_0xe1eff9[_0xa6f2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index decfe9a..7002e6a 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d2=['save','update','removeListener','length','mailMessage:','./mailMessage.events'];(function(_0x475eed,_0x1e1ffb){var _0x1e3e69=function(_0x46b201){while(--_0x46b201){_0x475eed['push'](_0x475eed['shift']());}};_0x1e3e69(++_0x1e1ffb);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x3dc443,_0x473b37){_0x3dc443=_0x3dc443-0x0;var _0x30ce0c=_0xd6d2[_0x3dc443];return _0x30ce0c;};'use strict';var MailMessageEvents=require(_0x2d6d('0x0'));var events=[_0x2d6d('0x1'),'remove',_0x2d6d('0x2')];function createListener(_0x224caa,_0x5b4a5b){return function(_0x2c2dd9){_0x5b4a5b['emit'](_0x224caa,_0x2c2dd9);};}function removeListener(_0x1c5e54,_0x3ee519){return function(){MailMessageEvents[_0x2d6d('0x3')](_0x1c5e54,_0x3ee519);};}exports['register']=function(_0xfcdb1d){for(var _0x132361=0x0,_0xf59b20=events[_0x2d6d('0x4')];_0x132361<_0xf59b20;_0x132361++){var _0x4002b7=events[_0x132361];var _0x42d802=createListener(_0x2d6d('0x5')+_0x4002b7,_0xfcdb1d);MailMessageEvents['on'](_0x4002b7,_0x42d802);}}; \ No newline at end of file +var _0x29d4=['removeListener','register','length','./mailMessage.events','remove','update'];(function(_0x255e0a,_0x397d7b){var _0x5deb90=function(_0x48d137){while(--_0x48d137){_0x255e0a['push'](_0x255e0a['shift']());}};_0x5deb90(++_0x397d7b);}(_0x29d4,0x1a1));var _0x429d=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x29d4[_0x3b5250];return _0xc844a1;};'use strict';var MailMessageEvents=require(_0x429d('0x0'));var events=['save',_0x429d('0x1'),_0x429d('0x2')];function createListener(_0x16ce75,_0x472fc9){return function(_0x45df1c){_0x472fc9['emit'](_0x16ce75,_0x45df1c);};}function removeListener(_0xc3989d,_0x3f43f5){return function(){MailMessageEvents[_0x429d('0x3')](_0xc3989d,_0x3f43f5);};}exports[_0x429d('0x4')]=function(_0x1c55aa){for(var _0xa71445=0x0,_0x56aa2f=events[_0x429d('0x5')];_0xa71445<_0x56aa2f;_0xa71445++){var _0x4befb9=events[_0xa71445];var _0x9fc337=createListener('mailMessage:'+_0x4befb9,_0x1c55aa);MailMessageEvents['on'](_0x4befb9,_0x9fc337);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 82a6716..137e8b1 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x556e=['path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','removeTeams','multer'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x556e,0x1af));var _0xe556=function(_0x5f150e,_0x5e3a1e){_0x5f150e=_0x5f150e-0x0;var _0x2f6957=_0x556e[_0x5f150e];return _0x2f6957;};'use strict';var multer=require(_0xe556('0x0'));var util=require('util');var path=require(_0xe556('0x1'));var timeout=require('connect-timeout');var express=require(_0xe556('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe556('0x3'));var config=require(_0xe556('0x4'));var controller=require('./mailQueue.controller');router[_0xe556('0x5')]('/',auth[_0xe556('0x6')](),controller[_0xe556('0x7')]);router[_0xe556('0x5')](_0xe556('0x8'),auth[_0xe556('0x6')](),controller[_0xe556('0x9')]);router['get'](_0xe556('0xa'),auth[_0xe556('0x6')](),controller[_0xe556('0xb')]);router[_0xe556('0x5')](_0xe556('0xc'),auth[_0xe556('0x6')](),controller[_0xe556('0xd')]);router['get'](_0xe556('0xe'),auth[_0xe556('0x6')](),controller[_0xe556('0xf')]);router['get'](_0xe556('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe556('0x11')]('/',auth[_0xe556('0x6')](),controller[_0xe556('0x12')]);router[_0xe556('0x11')](_0xe556('0xe'),auth[_0xe556('0x6')](),controller[_0xe556('0x13')]);router[_0xe556('0x11')](_0xe556('0x10'),auth[_0xe556('0x6')](),controller[_0xe556('0x14')]);router['put'](_0xe556('0xa'),auth[_0xe556('0x6')](),controller[_0xe556('0x15')]);router[_0xe556('0x16')](_0xe556('0xa'),auth[_0xe556('0x6')](),controller['destroy']);router[_0xe556('0x16')](_0xe556('0xe'),auth[_0xe556('0x6')](),controller[_0xe556('0x17')]);router[_0xe556('0x16')]('/:id/users',auth[_0xe556('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xc62e=['delete','removeTeams','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','/:id','/:id/members','getMembers','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xc62e,0x116));var _0xec62=function(_0x236c92,_0x1f9915){_0x236c92=_0x236c92-0x0;var _0x2f0e76=_0xc62e[_0x236c92];return _0x2f0e76;};'use strict';var multer=require(_0xec62('0x0'));var util=require('util');var path=require(_0xec62('0x1'));var timeout=require(_0xec62('0x2'));var express=require('express');var router=express[_0xec62('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xec62('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xec62('0x5'));var controller=require(_0xec62('0x6'));router['get']('/',auth[_0xec62('0x7')](),controller[_0xec62('0x8')]);router[_0xec62('0x9')](_0xec62('0xa'),auth[_0xec62('0x7')](),controller['describe']);router['get'](_0xec62('0xb'),auth[_0xec62('0x7')](),controller['show']);router[_0xec62('0x9')](_0xec62('0xc'),auth[_0xec62('0x7')](),controller[_0xec62('0xd')]);router[_0xec62('0x9')]('/:id/teams',auth[_0xec62('0x7')](),controller['getTeams']);router[_0xec62('0x9')](_0xec62('0xe'),auth[_0xec62('0x7')](),controller[_0xec62('0xf')]);router[_0xec62('0x10')]('/',auth['isAuthenticated'](),controller[_0xec62('0x11')]);router[_0xec62('0x10')]('/:id/teams',auth[_0xec62('0x7')](),controller[_0xec62('0x12')]);router[_0xec62('0x10')](_0xec62('0xe'),auth['isAuthenticated'](),controller[_0xec62('0x13')]);router[_0xec62('0x14')](_0xec62('0xb'),auth[_0xec62('0x7')](),controller[_0xec62('0x15')]);router[_0xec62('0x16')](_0xec62('0xb'),auth[_0xec62('0x7')](),controller['destroy']);router[_0xec62('0x16')]('/:id/teams',auth[_0xec62('0x7')](),controller[_0xec62('0x17')]);router['delete'](_0xec62('0xe'),auth[_0xec62('0x7')](),controller['removeAgents']);module[_0xec62('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index cbcfc8d..aa7572f 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ee6=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x21be1a,_0x598997){var _0x2f2ab5=function(_0x3be34b){while(--_0x3be34b){_0x21be1a['push'](_0x21be1a['shift']());}};_0x2f2ab5(++_0x598997);}(_0x9ee6,0x84));var _0x69ee=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x9ee6[_0x5550b3];return _0x4b8fc4;};'use strict';var Sequelize=require(_0x69ee('0x0'));module[_0x69ee('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x69ee('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x69ee('0x3')]},'timeout':{'type':Sequelize[_0x69ee('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x69ee('0x5')]('rrmemory',_0x69ee('0x6'),_0x69ee('0x7'))}}; \ No newline at end of file +var _0x43ce=['STRING','name','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x7cb24f,_0x23976c){var _0x4ce26e=function(_0x3281f8){while(--_0x3281f8){_0x7cb24f['push'](_0x7cb24f['shift']());}};_0x4ce26e(++_0x23976c);}(_0x43ce,0x16a));var _0xe43c=function(_0x3689f9,_0x3a2b53){_0x3689f9=_0x3689f9-0x0;var _0x3b08af=_0x43ce[_0x3689f9];return _0x3b08af;};'use strict';var Sequelize=require(_0xe43c('0x0'));module[_0xe43c('0x1')]={'name':{'type':Sequelize[_0xe43c('0x2')],'unique':_0xe43c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe43c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe43c('0x4'),_0xe43c('0x5'),_0xe43c('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1c60d88..92820a5 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x837e=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','userMailQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','MailQueues','error','name','merge','body','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','MailQueue','includeAll','findAll','rows','catch','show','params','include','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','length','hasOwnProperty','MailQueueId','User','findAndCountAll','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','Agents','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','tq.TeamId','team_has_mail_queues'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x837e,0x12b));var _0xe837=function(_0x4798d2,_0x18b5a8){_0x4798d2=_0x4798d2-0x0;var _0x35f965=_0x837e[_0x4798d2];return _0x35f965;};'use strict';var emlformat=require(_0xe837('0x0'));var rimraf=require(_0xe837('0x1'));var zipdir=require(_0xe837('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe837('0x3'));var moment=require(_0xe837('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe837('0x5'));var path=require(_0xe837('0x6'));var sox=require(_0xe837('0x7'));var csv=require(_0xe837('0x8'));var ejs=require(_0xe837('0x9'));var fs=require('fs');var fs_extra=require(_0xe837('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe837('0xb'));var jsforce=require(_0xe837('0xc'));var deskjs=require(_0xe837('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe837('0xe'));var Papa=require(_0xe837('0xf'));var Redis=require(_0xe837('0x10'));var authService=require(_0xe837('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe837('0x12'));var logger=require(_0xe837('0x13'))(_0xe837('0x14'));var utils=require('../../config/utils');var config=require(_0xe837('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe837('0x16')]=_[_0xe837('0x17')](config['redis'],{'host':_0xe837('0x18'),'port':0x18eb});var socket=require(_0xe837('0x19'))(new Redis(config[_0xe837('0x16')]));require('./mailQueue.socket')[_0xe837('0x1a')](socket);function respondWithStatusCode(_0x58d89e,_0x6c43a9){_0x6c43a9=_0x6c43a9||0xcc;return function(_0x260fe0){if(_0x260fe0){return _0x58d89e['sendStatus'](_0x6c43a9);}return _0x58d89e[_0xe837('0x1b')](_0x6c43a9)[_0xe837('0x1c')]();};}function respondWithResult(_0x2d4bed,_0x284153){_0x284153=_0x284153||0xc8;return function(_0x4c7bb3){if(_0x4c7bb3){return _0x2d4bed[_0xe837('0x1b')](_0x284153)[_0xe837('0x1d')](_0x4c7bb3);}};}function respondWithFilteredResult(_0x20979e,_0x15367a){return function(_0x6b4e5f){if(_0x6b4e5f){var _0x363940=typeof _0x15367a['offset']===_0xe837('0x1e')&&typeof _0x15367a[_0xe837('0x1f')]==='undefined';var _0x13db0c=_0x6b4e5f[_0xe837('0x20')];var _0x73dbef=_0x363940?0x0:_0x15367a[_0xe837('0x21')];var _0x140e73=_0x363940?_0x6b4e5f[_0xe837('0x20')]:_0x15367a[_0xe837('0x21')]+_0x15367a['limit'];var _0x2bde72;if(_0x140e73>=_0x13db0c){_0x140e73=_0x13db0c;_0x2bde72=0xc8;}else{_0x2bde72=0xce;}_0x20979e[_0xe837('0x1b')](_0x2bde72);return _0x20979e[_0xe837('0x22')]('Content-Range',_0x73dbef+'-'+_0x140e73+'/'+_0x13db0c)[_0xe837('0x1d')](_0x6b4e5f);}return null;};}function patchUpdates(_0x46eb02){return function(_0x5515bb){try{jsonpatch[_0xe837('0x23')](_0x5515bb,_0x46eb02,!![]);}catch(_0x494bfa){return BPromise[_0xe837('0x24')](_0x494bfa);}return _0x5515bb[_0xe837('0x25')]();};}function saveUpdates(_0x32e5f6,_0x8b542b){return function(_0x4be098){if(_0x4be098){return _0x4be098[_0xe837('0x26')](_0x32e5f6)[_0xe837('0x27')](function(_0x290b91){return _0x290b91;});}return null;};}function removeEntity(_0xfc5598,_0x42a603){return function(_0x3feb71){if(_0x3feb71){return _0x3feb71[_0xe837('0x28')]()[_0xe837('0x27')](function(){var _0x267a22=_0x3feb71['get']({'plain':!![]});var _0x4e1d74=_0xe837('0x29');return db['UserProfileResource'][_0xe837('0x28')]({'where':{'type':_0x4e1d74,'resourceId':_0x267a22['id']}})[_0xe837('0x27')](function(){return _0x3feb71;});})[_0xe837('0x27')](function(){_0xfc5598[_0xe837('0x1b')](0xcc)[_0xe837('0x1c')]();});}};}function handleEntityNotFound(_0x132e8f,_0x475b63){return function(_0x7aa8a6){if(!_0x7aa8a6){_0x132e8f['sendStatus'](0x194);}return _0x7aa8a6;};}function handleError(_0x194999,_0x132eef){_0x132eef=_0x132eef||0x1f4;return function(_0x5cc006){logger[_0xe837('0x2a')](_0x5cc006['stack']);if(_0x5cc006[_0xe837('0x2b')]){delete _0x5cc006[_0xe837('0x2b')];}_0x194999[_0xe837('0x1b')](_0x132eef)['send'](_0x5cc006);};}function getMustacheRender(_0x3aad08,_0x2a2056){return Mustache['render'](_0x3aad08,_[_0xe837('0x2c')](_0x2a2056[_0xe837('0x2d')],{'contact':_0x2a2056['contact'],'message':_0x2a2056[_0xe837('0x2e')],'agent':_0x2a2056[_0xe837('0x2f')],'interaction':_0x2a2056[_0xe837('0x30')],'account':_0x2a2056[_0xe837('0x31')]}))||'';}exports[_0xe837('0x32')]=function(_0x506524,_0x5510a7){var _0x245385={},_0x2368d2={},_0x121a65={'count':0x0,'rows':[]};var _0x1641c7=_[_0xe837('0x33')](db['MailQueue'][_0xe837('0x34')],function(_0x2db96d){return{'name':_0x2db96d[_0xe837('0x35')],'type':_0x2db96d[_0xe837('0x36')][_0xe837('0x37')]};});_0x2368d2['model']=_[_0xe837('0x33')](_0x1641c7,_0xe837('0x2b'));_0x2368d2[_0xe837('0x38')]=_[_0xe837('0x39')](_0x506524['query']);_0x2368d2[_0xe837('0x3a')]=_[_0xe837('0x3b')](_0x2368d2[_0xe837('0x3c')],_0x2368d2['query']);_0x245385[_0xe837('0x3d')]=_['intersection'](_0x2368d2[_0xe837('0x3c')],qs['fields'](_0x506524[_0xe837('0x38')][_0xe837('0x3e')]));_0x245385[_0xe837('0x3d')]=_0x245385[_0xe837('0x3d')]['length']?_0x245385[_0xe837('0x3d')]:_0x2368d2[_0xe837('0x3c')];if(!_0x506524['query']['hasOwnProperty'](_0xe837('0x3f'))){_0x245385[_0xe837('0x1f')]=qs['limit'](_0x506524[_0xe837('0x38')]['limit']);_0x245385[_0xe837('0x21')]=qs[_0xe837('0x21')](_0x506524['query'][_0xe837('0x21')]);}_0x245385[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x506524[_0xe837('0x38')][_0xe837('0x41')]);_0x245385[_0xe837('0x42')]=qs['filters'](_[_0xe837('0x43')](_0x506524[_0xe837('0x38')],_0x2368d2[_0xe837('0x3a')]),_0x1641c7);if(_0x506524['query'][_0xe837('0x44')]){_0x245385[_0xe837('0x42')]=_[_0xe837('0x2c')](_0x245385[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0x1641c7,function(_0x19b181){if(_0x19b181[_0xe837('0x36')]!==_0xe837('0x45')){var _0x250aa9={};_0x250aa9[_0x19b181[_0xe837('0x2b')]]={'$like':'%'+_0x506524[_0xe837('0x38')][_0xe837('0x44')]+'%'};return _0x250aa9;}})});}_0x245385=_[_0xe837('0x2c')]({},_0x245385,_0x506524[_0xe837('0x46')]);var _0x5ac3db={'where':_0x245385['where']};return db[_0xe837('0x47')][_0xe837('0x20')](_0x5ac3db)['then'](function(_0x5034fe){_0x121a65['count']=_0x5034fe;if(_0x506524['query'][_0xe837('0x48')]){_0x245385['include']=[{'all':!![]}];}return db[_0xe837('0x47')][_0xe837('0x49')](_0x245385);})[_0xe837('0x27')](function(_0x403053){_0x121a65[_0xe837('0x4a')]=_0x403053;return _0x121a65;})[_0xe837('0x27')](respondWithFilteredResult(_0x5510a7,_0x245385))[_0xe837('0x4b')](handleError(_0x5510a7,null));};exports[_0xe837('0x4c')]=function(_0x16cf4d,_0x29be38){var _0x33fa5c={'raw':!![],'where':{'id':_0x16cf4d[_0xe837('0x4d')]['id']}},_0x5aaae9={};_0x5aaae9[_0xe837('0x3c')]=_[_0xe837('0x39')](db['MailQueue'][_0xe837('0x34')]);_0x5aaae9['query']=_[_0xe837('0x39')](_0x16cf4d[_0xe837('0x38')]);_0x5aaae9['filters']=_[_0xe837('0x3b')](_0x5aaae9[_0xe837('0x3c')],_0x5aaae9[_0xe837('0x38')]);_0x33fa5c['attributes']=_[_0xe837('0x3b')](_0x5aaae9[_0xe837('0x3c')],qs[_0xe837('0x3e')](_0x16cf4d['query'][_0xe837('0x3e')]));_0x33fa5c[_0xe837('0x3d')]=_0x33fa5c[_0xe837('0x3d')]['length']?_0x33fa5c['attributes']:_0x5aaae9[_0xe837('0x3c')];if(_0x16cf4d['query'][_0xe837('0x48')]){_0x33fa5c[_0xe837('0x4e')]=[{'all':!![]}];}_0x33fa5c=_[_0xe837('0x2c')]({},_0x33fa5c,_0x16cf4d[_0xe837('0x46')]);return db[_0xe837('0x47')]['find'](_0x33fa5c)[_0xe837('0x27')](handleEntityNotFound(_0x29be38,null))[_0xe837('0x27')](respondWithResult(_0x29be38,null))[_0xe837('0x4b')](handleError(_0x29be38,null));};exports['create']=function(_0x374959,_0x39e103){return db[_0xe837('0x47')]['create'](_0x374959[_0xe837('0x2d')],{})[_0xe837('0x27')](function(_0x432db9){var _0x4e295b=_0x374959['user'][_0xe837('0x4f')]({'plain':!![]});if(!_0x4e295b)throw new Error(_0xe837('0x50'));if(_0x4e295b['role']===_0xe837('0x51')){var _0x5016d2=_0x432db9[_0xe837('0x4f')]({'plain':!![]});var _0x295c61=_0xe837('0x29');return db[_0xe837('0x52')][_0xe837('0x53')]({'where':{'name':_0x295c61,'userProfileId':_0x4e295b[_0xe837('0x54')]},'raw':!![]})['then'](function(_0x568514){if(_0x568514&&_0x568514['autoAssociation']===0x0){return db[_0xe837('0x55')][_0xe837('0x56')]({'name':_0x5016d2[_0xe837('0x2b')],'resourceId':_0x5016d2['id'],'type':_0x568514[_0xe837('0x2b')],'sectionId':_0x568514['id']},{})[_0xe837('0x27')](function(){return _0x432db9;});}else{return _0x432db9;}})[_0xe837('0x4b')](function(_0x3406a6){logger['error'](_0xe837('0x57'),_0x3406a6);throw _0x3406a6;});}return _0x432db9;})[_0xe837('0x27')](respondWithResult(_0x39e103,0xc9))['catch'](handleError(_0x39e103,null));};exports[_0xe837('0x26')]=function(_0x406720,_0xdb5f27){if(_0x406720[_0xe837('0x2d')]['id']){delete _0x406720[_0xe837('0x2d')]['id'];}return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x406720[_0xe837('0x4d')]['id']}})['then'](handleEntityNotFound(_0xdb5f27,null))[_0xe837('0x27')](saveUpdates(_0x406720[_0xe837('0x2d')],null))[_0xe837('0x27')](respondWithResult(_0xdb5f27,null))[_0xe837('0x4b')](handleError(_0xdb5f27,null));};exports[_0xe837('0x28')]=function(_0x2e1712,_0x29a3fe){return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x2e1712['params']['id']}})['then'](handleEntityNotFound(_0x29a3fe,null))[_0xe837('0x27')](removeEntity(_0x29a3fe,null))[_0xe837('0x4b')](handleError(_0x29a3fe,null));};exports[_0xe837('0x58')]=function(_0x40631b,_0x503b17){return db[_0xe837('0x47')][_0xe837('0x58')]()[_0xe837('0x27')](respondWithResult(_0x503b17,null))[_0xe837('0x4b')](handleError(_0x503b17,null));};exports[_0xe837('0x59')]=function(_0x383c9b,_0x313fc0,_0x1ab15e){var _0x57f8a8={'raw':!![],'where':{}},_0x41c630={},_0x2bed05;return db[_0xe837('0x47')]['findOne']({'where':{'id':_0x383c9b[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](handleEntityNotFound(_0x313fc0,null))[_0xe837('0x27')](function(_0x302181){if(_0x302181){_0x2bed05=_0x302181[_0xe837('0x4f')]({'plain':!![]});_0x41c630['model']=_['keys'](db[_0xe837('0x5a')]['rawAttributes']);_0x41c630[_0xe837('0x38')]=_['keys'](_0x383c9b[_0xe837('0x38')]);_0x41c630['filters']=_[_0xe837('0x3b')](_0x41c630[_0xe837('0x3c')],_0x41c630[_0xe837('0x38')]);_0x57f8a8[_0xe837('0x3d')]=_['intersection'](_0x41c630[_0xe837('0x3c')],qs['fields'](_0x383c9b[_0xe837('0x38')][_0xe837('0x3e')]));_0x57f8a8[_0xe837('0x3d')]=_0x57f8a8[_0xe837('0x3d')][_0xe837('0x5b')]?_0x57f8a8[_0xe837('0x3d')]:_0x41c630[_0xe837('0x3c')];if(!_0x383c9b[_0xe837('0x38')][_0xe837('0x5c')]('nolimit')){_0x57f8a8[_0xe837('0x1f')]=qs[_0xe837('0x1f')](_0x383c9b[_0xe837('0x38')]['limit']);_0x57f8a8['offset']=qs['offset'](_0x383c9b['query'][_0xe837('0x21')]);}_0x57f8a8[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x383c9b[_0xe837('0x38')]['sort']);_0x57f8a8[_0xe837('0x42')]=qs[_0xe837('0x3a')](_[_0xe837('0x43')](_0x383c9b[_0xe837('0x38')],_0x41c630[_0xe837('0x3a')]));_0x57f8a8['where'][_0xe837('0x5d')]=_0x302181['id'];if(_0x383c9b['query'][_0xe837('0x44')]){_0x57f8a8[_0xe837('0x42')]=_[_0xe837('0x2c')](_0x57f8a8[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0x57f8a8[_0xe837('0x3d')],function(_0x529c44){var _0x3245e3={};_0x3245e3[_0x529c44]={'$like':'%'+_0x383c9b['query']['filter']+'%'};return _0x3245e3;})});}_0x57f8a8=_[_0xe837('0x2c')]({},_0x57f8a8,_0x383c9b[_0xe837('0x46')]);return db[_0xe837('0x5a')][_0xe837('0x49')](_0x57f8a8);}})[_0xe837('0x27')](function(_0x35e54e){if(_0x35e54e){return db[_0xe837('0x5e')][_0xe837('0x5f')]({'where':{'id':_[_0xe837('0x33')](_0x35e54e,'UserId'),'role':_0xe837('0x2f')},'attributes':['id',_0xe837('0x2b'),_0xe837('0x60'),_0xe837('0x61'),_0xe837('0x62')]});}})[_0xe837('0x27')](function(_0x49cb7d){if(_0x49cb7d){return{'count':_0x49cb7d[_0xe837('0x20')],'rows':_['map'](_0x49cb7d[_0xe837('0x4a')],function(_0x48a473){return{'membername':_0x48a473[_0xe837('0x2b')],'UserId':_0x48a473['id'],'queue_name':_0x2bed05[_0xe837('0x2b')],'MailQueueId':_0x2bed05['id'],'interface':util['format'](_0xe837('0x63'),_0xe837('0x64'),_0x48a473['name']),'penalty':0x0,'paused':_0x48a473[_0xe837('0x60')],'createdAt':_0x48a473['createdAt'],'updatedAt':_0x48a473[_0xe837('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe837('0x27')](respondWithFilteredResult(_0x313fc0,_0x57f8a8))[_0xe837('0x4b')](handleError(_0x313fc0,null));};exports[_0xe837('0x65')]=function(_0x45412e,_0x2d6c14,_0x407442){var _0xe23a5b={};var _0x6221e6={};var _0x4a7be4;var _0x18dad0;return db[_0xe837('0x47')][_0xe837('0x66')]({'where':{'id':_0x45412e['params']['id']}})['then'](handleEntityNotFound(_0x2d6c14,null))['then'](function(_0xef21a3){if(_0xef21a3){_0x4a7be4=_0xef21a3;_0x6221e6[_0xe837('0x3c')]=_[_0xe837('0x39')](db[_0xe837('0x67')]['rawAttributes']);_0x6221e6[_0xe837('0x38')]=_[_0xe837('0x39')](_0x45412e[_0xe837('0x38')]);_0x6221e6[_0xe837('0x3a')]=_[_0xe837('0x3b')](_0x6221e6[_0xe837('0x3c')],_0x6221e6['query']);_0xe23a5b['attributes']=_[_0xe837('0x3b')](_0x6221e6[_0xe837('0x3c')],qs[_0xe837('0x3e')](_0x45412e[_0xe837('0x38')][_0xe837('0x3e')]));_0xe23a5b[_0xe837('0x3d')]=_0xe23a5b[_0xe837('0x3d')]['length']?_0xe23a5b[_0xe837('0x3d')]:_0x6221e6[_0xe837('0x3c')];_0xe23a5b[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x45412e['query']['sort']);_0xe23a5b[_0xe837('0x42')]=qs['filters'](_[_0xe837('0x43')](_0x45412e['query'],_0x6221e6['filters']));if(_0x45412e[_0xe837('0x38')][_0xe837('0x44')]){_0xe23a5b['where']=_['merge'](_0xe23a5b[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0xe23a5b[_0xe837('0x3d')],function(_0x30db63){var _0x2d055e={};_0x2d055e[_0x30db63]={'$like':'%'+_0x45412e[_0xe837('0x38')][_0xe837('0x44')]+'%'};return _0x2d055e;})});}_0xe23a5b=_[_0xe837('0x2c')]({},_0xe23a5b,_0x45412e[_0xe837('0x46')]);return _0x4a7be4[_0xe837('0x65')](_0xe23a5b);}})['then'](function(_0x2c0266){if(_0x2c0266){_0x18dad0=_0x2c0266[_0xe837('0x5b')];if(!_0x45412e[_0xe837('0x38')][_0xe837('0x5c')](_0xe837('0x3f'))){_0xe23a5b['limit']=qs['limit'](_0x45412e[_0xe837('0x38')]['limit']);_0xe23a5b[_0xe837('0x21')]=qs['offset'](_0x45412e[_0xe837('0x38')]['offset']);}return _0x4a7be4[_0xe837('0x65')](_0xe23a5b);}})[_0xe837('0x27')](function(_0xb0a296){if(_0xb0a296){return _0xb0a296?{'count':_0x18dad0,'rows':_0xb0a296}:null;}})[_0xe837('0x27')](respondWithResult(_0x2d6c14,null))[_0xe837('0x4b')](handleError(_0x2d6c14,null));};exports[_0xe837('0x68')]=function(_0x30f78d,_0x90c2d0,_0x106c03){var _0x21081a=_0x30f78d[_0xe837('0x2d')]['ids'];return db[_0xe837('0x67')][_0xe837('0x49')]({'where':{'id':_0x21081a},'attributes':['id'],'include':[{'model':db[_0xe837('0x5e')],'as':_0xe837('0x69'),'attributes':['id',_0xe837('0x2b'),'online','voicePause',_0xe837('0x6a')],'raw':!![]}]})[_0xe837('0x27')](function(_0x395c57){if(_0x395c57){var _0x3f2581=_['flatMap'](_0x395c57,function(_0x2bd586){var _0x24750c=_0x2bd586[_0xe837('0x4f')]({'plain':!![]});return _0x24750c['Agents'];});return db['MailQueue'][_0xe837('0x53')]({'where':{'id':_0x30f78d[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](function(_0x32b568){return db[_0xe837('0x6b')][_0xe837('0x6c')](function(_0x5df2df){return _0x32b568[_0xe837('0x68')](_0x21081a,{'transaction':_0x5df2df})['then'](function(){return BPromise[_0xe837('0x6d')](_0x3f2581,function(_0x34330e){return db[_0xe837('0x5a')][_0xe837('0x6e')]({'where':{'UserId':_0x34330e['id'],'MailQueueId':_0x30f78d[_0xe837('0x4d')]['id']},'transaction':_0x5df2df});});})[_0xe837('0x27')](function(){_0x3f2581[_0xe837('0x6f')](function(_0x519000){socket[_0xe837('0x70')]('userMailQueue:save',{'UserId':_0x519000['id'],'MailQueueId':_0x32b568['id']});});});});});}})[_0xe837('0x27')](respondWithStatusCode(_0x90c2d0,null))['catch'](handleError(_0x90c2d0,null));};exports[_0xe837('0x71')]=function(_0x3083b8,_0x52e72b,_0x428d20){return db[_0xe837('0x67')][_0xe837('0x49')]({'where':{'id':_0x3083b8['query'][_0xe837('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe837('0x69'),'attributes':['id'],'raw':!![]}]})[_0xe837('0x27')](handleEntityNotFound(_0x52e72b,null))['then'](function(_0x17a9c8){var _0x199e3e=_[_0xe837('0x33')](_0x17a9c8,'id');var _0x446c5d=[];var _0x36621e=[];var _0x54e5a6=squel[_0xe837('0x73')]();_0x54e5a6['field'](_0xe837('0x74'))['from'](_0xe837('0x75'),'tq')[_0xe837('0x76')](_0xe837('0x77'),'ut',_0xe837('0x78'))[_0xe837('0x42')](_0xe837('0x79'),_0x3083b8[_0xe837('0x4d')]['id']);for(var _0x358eb3=0x0;_0x358eb3<_0x17a9c8['length'];_0x358eb3+=0x1){let _0x186ccd=_0x17a9c8[_0x358eb3];for(var _0x229ebe=0x0;_0x229ebe<_0x186ccd['Agents']['length'];_0x229ebe+=0x1){let _0x22fd8b=_0x186ccd[_0xe837('0x69')][_0x229ebe];var _0x487bea=_0x54e5a6[_0xe837('0x7a')]();_0x487bea['where'](_0xe837('0x7b'),_0x22fd8b['id']);_0x36621e[_0xe837('0x7c')](db[_0xe837('0x6b')][_0xe837('0x38')](_0x487bea['toString'](),{'type':db[_0xe837('0x6b')][_0xe837('0x7d')]['SELECT']})['then'](function(_0x25ebf3){if(_0x25ebf3[_0xe837('0x5b')]===0x1){return _0x22fd8b['id'];}else{var _0x45e934=_['every'](_[_0xe837('0x33')](_0x25ebf3,_0xe837('0x7e')),function(_0x475dba){return _[_0xe837('0x7f')](_0x199e3e,_0x475dba);});if(_0x45e934){return _0x22fd8b['id'];}}}));}}return BPromise[_0xe837('0x80')](_0x36621e)['then'](function(_0x144398){_0x446c5d=_(_0x446c5d)[_0xe837('0x81')](_0x144398)['compact']()[_0xe837('0x82')]();return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x3083b8[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](function(_0x274d38){return db['sequelize']['transaction'](function(_0x5cfa88){return _0x274d38[_0xe837('0x71')](_0x3083b8[_0xe837('0x38')]['ids'],{'transaction':_0x5cfa88})['then'](function(){if(!_[_0xe837('0x83')](_0x446c5d)){return _0x274d38[_0xe837('0x84')](_0x446c5d,{'transaction':_0x5cfa88});}})[_0xe837('0x27')](function(){_0x446c5d['forEach'](function(_0x4a23bd){socket[_0xe837('0x70')](_0xe837('0x85'),{'UserId':_0x4a23bd,'MailQueueId':_0x274d38['id']});});});});});});})[_0xe837('0x27')](respondWithStatusCode(_0x52e72b,null))['catch'](handleError(_0x52e72b,null));};exports[_0xe837('0x86')]=function(_0x1aff8c,_0x6dc731,_0x5273ee){return db[_0xe837('0x47')][_0xe837('0x53')]({'where':{'id':_0x1aff8c[_0xe837('0x4d')]['id']}})[_0xe837('0x27')](handleEntityNotFound(_0x6dc731,null))['then'](function(_0x57386a){if(_0x57386a){return _0x57386a[_0xe837('0x86')](_0x1aff8c[_0xe837('0x2d')][_0xe837('0x72')],_['omit'](_0x1aff8c['body'],[_0xe837('0x72'),'id'])||{})[_0xe837('0x87')](function(_0x51c72a){for(var _0x472100=0x0;_0x472100<_0x1aff8c[_0xe837('0x2d')][_0xe837('0x72')][_0xe837('0x5b')];_0x472100+=0x1){socket['emit'](_0xe837('0x88'),{'UserId':_0x1aff8c[_0xe837('0x2d')][_0xe837('0x72')][_0x472100],'MailQueueId':_0x1aff8c[_0xe837('0x4d')]['id']});}return _0x51c72a;});}})[_0xe837('0x27')](respondWithResult(_0x6dc731,null))[_0xe837('0x4b')](handleError(_0x6dc731,null));};exports[_0xe837('0x84')]=function(_0x354574,_0x2d4443,_0x5c0654){return db[_0xe837('0x47')]['find']({'where':{'id':_0x354574['params']['id']}})[_0xe837('0x27')](handleEntityNotFound(_0x2d4443,null))[_0xe837('0x27')](function(_0x8763d7){if(_0x8763d7){return _0x8763d7[_0xe837('0x84')](_0x354574[_0xe837('0x38')][_0xe837('0x72')])[_0xe837('0x27')](function(){if(_[_0xe837('0x89')](_0x354574[_0xe837('0x38')][_0xe837('0x72')])){for(var _0x3f232a=0x0;_0x3f232a<_0x354574[_0xe837('0x38')][_0xe837('0x72')]['length'];_0x3f232a+=0x1){socket[_0xe837('0x70')](_0xe837('0x85'),{'UserId':Number(_0x354574[_0xe837('0x38')][_0xe837('0x72')][_0x3f232a]),'MailQueueId':Number(_0x354574[_0xe837('0x4d')]['id'])});}}else{socket[_0xe837('0x70')](_0xe837('0x85'),{'UserId':Number(_0x354574[_0xe837('0x38')]['ids']),'MailQueueId':Number(_0x354574[_0xe837('0x4d')]['id'])});}});}})[_0xe837('0x27')](respondWithStatusCode(_0x2d4443,null))[_0xe837('0x4b')](handleError(_0x2d4443,null));};exports[_0xe837('0x8a')]=function(_0x5c520b,_0x288e70,_0x4b90b4){var _0x3eca53={};var _0x293ed1={};var _0x1c37b8;var _0x49b8c5;return db['MailQueue']['findOne']({'where':{'id':_0x5c520b['params']['id']}})['then'](handleEntityNotFound(_0x288e70,null))['then'](function(_0x51ba52){if(_0x51ba52){_0x1c37b8=_0x51ba52;_0x293ed1['model']=_[_0xe837('0x39')](db['User'][_0xe837('0x34')]);_0x293ed1[_0xe837('0x38')]=_[_0xe837('0x39')](_0x5c520b[_0xe837('0x38')]);_0x293ed1[_0xe837('0x3a')]=_[_0xe837('0x3b')](_0x293ed1[_0xe837('0x3c')],_0x293ed1[_0xe837('0x38')]);_0x3eca53['attributes']=_[_0xe837('0x3b')](_0x293ed1[_0xe837('0x3c')],qs[_0xe837('0x3e')](_0x5c520b[_0xe837('0x38')][_0xe837('0x3e')]));_0x3eca53[_0xe837('0x3d')]=_0x3eca53[_0xe837('0x3d')][_0xe837('0x5b')]?_0x3eca53[_0xe837('0x3d')]:_0x293ed1['model'];_0x3eca53[_0xe837('0x40')]=qs[_0xe837('0x41')](_0x5c520b[_0xe837('0x38')][_0xe837('0x41')]);_0x3eca53[_0xe837('0x42')]=qs[_0xe837('0x3a')](_[_0xe837('0x43')](_0x5c520b[_0xe837('0x38')],_0x293ed1[_0xe837('0x3a')]));if(_0x5c520b['query'][_0xe837('0x44')]){_0x3eca53['where']=_[_0xe837('0x2c')](_0x3eca53[_0xe837('0x42')],{'$or':_[_0xe837('0x33')](_0x3eca53['attributes'],function(_0xe3c2ea){var _0x10a571={};_0x10a571[_0xe3c2ea]={'$like':'%'+_0x5c520b[_0xe837('0x38')][_0xe837('0x44')]+'%'};return _0x10a571;})});}_0x3eca53=_['merge']({},_0x3eca53,_0x5c520b['options']);return _0x1c37b8[_0xe837('0x8a')](_0x3eca53);}})[_0xe837('0x27')](function(_0x184614){if(_0x184614){_0x49b8c5=_0x184614[_0xe837('0x5b')];if(!_0x5c520b[_0xe837('0x38')][_0xe837('0x5c')](_0xe837('0x3f'))){_0x3eca53['limit']=qs['limit'](_0x5c520b[_0xe837('0x38')][_0xe837('0x1f')]);_0x3eca53[_0xe837('0x21')]=qs[_0xe837('0x21')](_0x5c520b[_0xe837('0x38')]['offset']);}return _0x1c37b8[_0xe837('0x8a')](_0x3eca53);}})[_0xe837('0x27')](function(_0x50852c){if(_0x50852c){return _0x50852c?{'count':_0x49b8c5,'rows':_0x50852c}:null;}})[_0xe837('0x27')](respondWithResult(_0x288e70,null))['catch'](handleError(_0x288e70,null));}; \ No newline at end of file +var _0x7e14=['addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','sendStatus','name','send','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','MailQueues','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','MailQueueId','UserId','mailPause','updatedAt','createdAt','format','SIP','Team','order','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','value','isEmpty','removeAgents'];(function(_0xdda0cc,_0x3de424){var _0x5361d7=function(_0x145a52){while(--_0x145a52){_0xdda0cc['push'](_0xdda0cc['shift']());}};_0x5361d7(++_0x3de424);}(_0x7e14,0x99));var _0x47e1=function(_0x4c4632,_0x105440){_0x4c4632=_0x4c4632-0x0;var _0x4b950c=_0x7e14[_0x4c4632];return _0x4b950c;};'use strict';var emlformat=require(_0x47e1('0x0'));var rimraf=require(_0x47e1('0x1'));var zipdir=require(_0x47e1('0x2'));var jsonpatch=require(_0x47e1('0x3'));var rp=require(_0x47e1('0x4'));var moment=require(_0x47e1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x47e1('0x6'));var util=require(_0x47e1('0x7'));var path=require(_0x47e1('0x8'));var sox=require(_0x47e1('0x9'));var csv=require(_0x47e1('0xa'));var ejs=require(_0x47e1('0xb'));var fs=require('fs');var fs_extra=require(_0x47e1('0xc'));var _=require('lodash');var squel=require(_0x47e1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x47e1('0xe'));var toCsv=require(_0x47e1('0xa'));var querystring=require(_0x47e1('0xf'));var Papa=require('papaparse');var Redis=require(_0x47e1('0x10'));var authService=require(_0x47e1('0x11'));var qs=require(_0x47e1('0x12'));var as=require(_0x47e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47e1('0x14'))(_0x47e1('0x15'));var utils=require(_0x47e1('0x16'));var config=require(_0x47e1('0x17'));var licenseUtil=require(_0x47e1('0x18'));var db=require(_0x47e1('0x19'))['db'];config['redis']=_[_0x47e1('0x1a')](config[_0x47e1('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x47e1('0x1c'))(new Redis(config[_0x47e1('0x1b')]));require('./mailQueue.socket')[_0x47e1('0x1d')](socket);function respondWithStatusCode(_0x5f224b,_0x196c1f){_0x196c1f=_0x196c1f||0xcc;return function(_0x4fbeb5){if(_0x4fbeb5){return _0x5f224b['sendStatus'](_0x196c1f);}return _0x5f224b[_0x47e1('0x1e')](_0x196c1f)['end']();};}function respondWithResult(_0x3dd043,_0x5aaf27){_0x5aaf27=_0x5aaf27||0xc8;return function(_0x5caa88){if(_0x5caa88){return _0x3dd043[_0x47e1('0x1e')](_0x5aaf27)[_0x47e1('0x1f')](_0x5caa88);}};}function respondWithFilteredResult(_0x4e2601,_0x244929){return function(_0x3bae66){if(_0x3bae66){var _0x164d53=typeof _0x244929['offset']===_0x47e1('0x20')&&typeof _0x244929[_0x47e1('0x21')]===_0x47e1('0x20');var _0x2ec982=_0x3bae66[_0x47e1('0x22')];var _0x41d450=_0x164d53?0x0:_0x244929[_0x47e1('0x23')];var _0x3f4e24=_0x164d53?_0x3bae66[_0x47e1('0x22')]:_0x244929[_0x47e1('0x23')]+_0x244929[_0x47e1('0x21')];var _0x4ac0a7;if(_0x3f4e24>=_0x2ec982){_0x3f4e24=_0x2ec982;_0x4ac0a7=0xc8;}else{_0x4ac0a7=0xce;}_0x4e2601[_0x47e1('0x1e')](_0x4ac0a7);return _0x4e2601[_0x47e1('0x24')](_0x47e1('0x25'),_0x41d450+'-'+_0x3f4e24+'/'+_0x2ec982)[_0x47e1('0x1f')](_0x3bae66);}return null;};}function patchUpdates(_0x373068){return function(_0x5cb6ee){try{jsonpatch['apply'](_0x5cb6ee,_0x373068,!![]);}catch(_0x333dcb){return BPromise[_0x47e1('0x26')](_0x333dcb);}return _0x5cb6ee[_0x47e1('0x27')]();};}function saveUpdates(_0x4bfcb6,_0x489ae2){return function(_0x3c8951){if(_0x3c8951){return _0x3c8951['update'](_0x4bfcb6)[_0x47e1('0x28')](function(_0x418c34){return _0x418c34;});}return null;};}function removeEntity(_0x267bbb,_0xca34be){return function(_0x138cb2){if(_0x138cb2){return _0x138cb2[_0x47e1('0x29')]()[_0x47e1('0x28')](function(){var _0x238d7e=_0x138cb2['get']({'plain':!![]});var _0x5037d0='MailQueues';return db['UserProfileResource'][_0x47e1('0x29')]({'where':{'type':_0x5037d0,'resourceId':_0x238d7e['id']}})[_0x47e1('0x28')](function(){return _0x138cb2;});})[_0x47e1('0x28')](function(){_0x267bbb[_0x47e1('0x1e')](0xcc)[_0x47e1('0x2a')]();});}};}function handleEntityNotFound(_0x1871a4,_0x21698d){return function(_0x92b95){if(!_0x92b95){_0x1871a4[_0x47e1('0x2b')](0x194);}return _0x92b95;};}function handleError(_0x3a79eb,_0x56ca17){_0x56ca17=_0x56ca17||0x1f4;return function(_0x499b12){logger['error'](_0x499b12['stack']);if(_0x499b12[_0x47e1('0x2c')]){delete _0x499b12[_0x47e1('0x2c')];}_0x3a79eb['status'](_0x56ca17)[_0x47e1('0x2d')](_0x499b12);};}function getMustacheRender(_0x1b1418,_0x4ef132){return Mustache[_0x47e1('0x2e')](_0x1b1418,_[_0x47e1('0x2f')](_0x4ef132[_0x47e1('0x30')],{'contact':_0x4ef132[_0x47e1('0x31')],'message':_0x4ef132['message'],'agent':_0x4ef132[_0x47e1('0x32')],'interaction':_0x4ef132[_0x47e1('0x33')],'account':_0x4ef132[_0x47e1('0x34')]}))||'';}exports[_0x47e1('0x35')]=function(_0x4b438a,_0x18fc31){var _0x776ed5={},_0x263715={},_0x4c999f={'count':0x0,'rows':[]};var _0x112e9f=_[_0x47e1('0x36')](db['MailQueue'][_0x47e1('0x37')],function(_0x4659d2){return{'name':_0x4659d2['fieldName'],'type':_0x4659d2[_0x47e1('0x38')]['key']};});_0x263715[_0x47e1('0x39')]=_[_0x47e1('0x36')](_0x112e9f,_0x47e1('0x2c'));_0x263715[_0x47e1('0x3a')]=_[_0x47e1('0x3b')](_0x4b438a['query']);_0x263715[_0x47e1('0x3c')]=_[_0x47e1('0x3d')](_0x263715[_0x47e1('0x39')],_0x263715[_0x47e1('0x3a')]);_0x776ed5[_0x47e1('0x3e')]=_[_0x47e1('0x3d')](_0x263715[_0x47e1('0x39')],qs[_0x47e1('0x3f')](_0x4b438a[_0x47e1('0x3a')]['fields']));_0x776ed5[_0x47e1('0x3e')]=_0x776ed5[_0x47e1('0x3e')][_0x47e1('0x40')]?_0x776ed5[_0x47e1('0x3e')]:_0x263715[_0x47e1('0x39')];if(!_0x4b438a[_0x47e1('0x3a')][_0x47e1('0x41')](_0x47e1('0x42'))){_0x776ed5[_0x47e1('0x21')]=qs[_0x47e1('0x21')](_0x4b438a[_0x47e1('0x3a')][_0x47e1('0x21')]);_0x776ed5[_0x47e1('0x23')]=qs[_0x47e1('0x23')](_0x4b438a[_0x47e1('0x3a')]['offset']);}_0x776ed5['order']=qs[_0x47e1('0x43')](_0x4b438a[_0x47e1('0x3a')]['sort']);_0x776ed5[_0x47e1('0x44')]=qs[_0x47e1('0x3c')](_[_0x47e1('0x45')](_0x4b438a['query'],_0x263715[_0x47e1('0x3c')]),_0x112e9f);if(_0x4b438a[_0x47e1('0x3a')][_0x47e1('0x46')]){_0x776ed5[_0x47e1('0x44')]=_[_0x47e1('0x2f')](_0x776ed5['where'],{'$or':_['map'](_0x112e9f,function(_0x4bf073){if(_0x4bf073['type']!==_0x47e1('0x47')){var _0x183328={};_0x183328[_0x4bf073[_0x47e1('0x2c')]]={'$like':'%'+_0x4b438a[_0x47e1('0x3a')]['filter']+'%'};return _0x183328;}})});}_0x776ed5=_[_0x47e1('0x2f')]({},_0x776ed5,_0x4b438a[_0x47e1('0x48')]);var _0x33f796={'where':_0x776ed5[_0x47e1('0x44')]};return db[_0x47e1('0x49')]['count'](_0x33f796)[_0x47e1('0x28')](function(_0x1e942e){_0x4c999f[_0x47e1('0x22')]=_0x1e942e;if(_0x4b438a[_0x47e1('0x3a')][_0x47e1('0x4a')]){_0x776ed5[_0x47e1('0x4b')]=[{'all':!![]}];}return db['MailQueue'][_0x47e1('0x4c')](_0x776ed5);})[_0x47e1('0x28')](function(_0x24ea0a){_0x4c999f[_0x47e1('0x4d')]=_0x24ea0a;return _0x4c999f;})['then'](respondWithFilteredResult(_0x18fc31,_0x776ed5))[_0x47e1('0x4e')](handleError(_0x18fc31,null));};exports[_0x47e1('0x4f')]=function(_0x1bb9e3,_0x4c9575){var _0x5c4dfd={'raw':!![],'where':{'id':_0x1bb9e3[_0x47e1('0x50')]['id']}},_0x5c8f94={};_0x5c8f94['model']=_[_0x47e1('0x3b')](db[_0x47e1('0x49')][_0x47e1('0x37')]);_0x5c8f94[_0x47e1('0x3a')]=_[_0x47e1('0x3b')](_0x1bb9e3[_0x47e1('0x3a')]);_0x5c8f94[_0x47e1('0x3c')]=_[_0x47e1('0x3d')](_0x5c8f94[_0x47e1('0x39')],_0x5c8f94[_0x47e1('0x3a')]);_0x5c4dfd[_0x47e1('0x3e')]=_[_0x47e1('0x3d')](_0x5c8f94[_0x47e1('0x39')],qs['fields'](_0x1bb9e3[_0x47e1('0x3a')]['fields']));_0x5c4dfd[_0x47e1('0x3e')]=_0x5c4dfd[_0x47e1('0x3e')][_0x47e1('0x40')]?_0x5c4dfd[_0x47e1('0x3e')]:_0x5c8f94[_0x47e1('0x39')];if(_0x1bb9e3[_0x47e1('0x3a')][_0x47e1('0x4a')]){_0x5c4dfd['include']=[{'all':!![]}];}_0x5c4dfd=_[_0x47e1('0x2f')]({},_0x5c4dfd,_0x1bb9e3[_0x47e1('0x48')]);return db['MailQueue'][_0x47e1('0x51')](_0x5c4dfd)[_0x47e1('0x28')](handleEntityNotFound(_0x4c9575,null))[_0x47e1('0x28')](respondWithResult(_0x4c9575,null))[_0x47e1('0x4e')](handleError(_0x4c9575,null));};exports['create']=function(_0x53cd96,_0x50a300){return db['MailQueue'][_0x47e1('0x52')](_0x53cd96['body'],{})[_0x47e1('0x28')](function(_0x5be60c){var _0x34c13d=_0x53cd96[_0x47e1('0x53')]['get']({'plain':!![]});if(!_0x34c13d)throw new Error(_0x47e1('0x54'));if(_0x34c13d['role']==='user'){var _0x48832d=_0x5be60c[_0x47e1('0x55')]({'plain':!![]});var _0x4fbffe=_0x47e1('0x56');return db[_0x47e1('0x57')][_0x47e1('0x51')]({'where':{'name':_0x4fbffe,'userProfileId':_0x34c13d['userProfileId']},'raw':!![]})[_0x47e1('0x28')](function(_0x4851e5){if(_0x4851e5&&_0x4851e5['autoAssociation']===0x0){return db[_0x47e1('0x58')][_0x47e1('0x52')]({'name':_0x48832d[_0x47e1('0x2c')],'resourceId':_0x48832d['id'],'type':_0x4851e5[_0x47e1('0x2c')],'sectionId':_0x4851e5['id']},{})[_0x47e1('0x28')](function(){return _0x5be60c;});}else{return _0x5be60c;}})[_0x47e1('0x4e')](function(_0x33079e){logger[_0x47e1('0x59')](_0x47e1('0x5a'),_0x33079e);throw _0x33079e;});}return _0x5be60c;})['then'](respondWithResult(_0x50a300,0xc9))['catch'](handleError(_0x50a300,null));};exports[_0x47e1('0x5b')]=function(_0x36ecd1,_0x5c8cac){if(_0x36ecd1[_0x47e1('0x30')]['id']){delete _0x36ecd1[_0x47e1('0x30')]['id'];}return db[_0x47e1('0x49')][_0x47e1('0x51')]({'where':{'id':_0x36ecd1['params']['id']}})['then'](handleEntityNotFound(_0x5c8cac,null))[_0x47e1('0x28')](saveUpdates(_0x36ecd1[_0x47e1('0x30')],null))[_0x47e1('0x28')](respondWithResult(_0x5c8cac,null))['catch'](handleError(_0x5c8cac,null));};exports[_0x47e1('0x29')]=function(_0x4ecca3,_0x228e38){return db[_0x47e1('0x49')][_0x47e1('0x51')]({'where':{'id':_0x4ecca3[_0x47e1('0x50')]['id']}})['then'](handleEntityNotFound(_0x228e38,null))[_0x47e1('0x28')](removeEntity(_0x228e38,null))[_0x47e1('0x4e')](handleError(_0x228e38,null));};exports['describe']=function(_0x21b2ee,_0x371af4){return db[_0x47e1('0x49')][_0x47e1('0x5c')]()[_0x47e1('0x28')](respondWithResult(_0x371af4,null))[_0x47e1('0x4e')](handleError(_0x371af4,null));};exports[_0x47e1('0x5d')]=function(_0x368bd9,_0x3ecaef,_0xf8427d){var _0x3e99a6={'raw':!![],'where':{}},_0xafcd80={},_0x200bff;return db['MailQueue'][_0x47e1('0x5e')]({'where':{'id':_0x368bd9[_0x47e1('0x50')]['id']}})[_0x47e1('0x28')](handleEntityNotFound(_0x3ecaef,null))['then'](function(_0x20d7c3){if(_0x20d7c3){_0x200bff=_0x20d7c3['get']({'plain':!![]});_0xafcd80[_0x47e1('0x39')]=_[_0x47e1('0x3b')](db[_0x47e1('0x5f')][_0x47e1('0x37')]);_0xafcd80[_0x47e1('0x3a')]=_['keys'](_0x368bd9['query']);_0xafcd80[_0x47e1('0x3c')]=_['intersection'](_0xafcd80[_0x47e1('0x39')],_0xafcd80[_0x47e1('0x3a')]);_0x3e99a6['attributes']=_[_0x47e1('0x3d')](_0xafcd80[_0x47e1('0x39')],qs['fields'](_0x368bd9[_0x47e1('0x3a')][_0x47e1('0x3f')]));_0x3e99a6[_0x47e1('0x3e')]=_0x3e99a6[_0x47e1('0x3e')]['length']?_0x3e99a6[_0x47e1('0x3e')]:_0xafcd80[_0x47e1('0x39')];if(!_0x368bd9['query'][_0x47e1('0x41')](_0x47e1('0x42'))){_0x3e99a6[_0x47e1('0x21')]=qs[_0x47e1('0x21')](_0x368bd9[_0x47e1('0x3a')]['limit']);_0x3e99a6['offset']=qs['offset'](_0x368bd9[_0x47e1('0x3a')][_0x47e1('0x23')]);}_0x3e99a6['order']=qs['sort'](_0x368bd9['query'][_0x47e1('0x43')]);_0x3e99a6[_0x47e1('0x44')]=qs[_0x47e1('0x3c')](_[_0x47e1('0x45')](_0x368bd9[_0x47e1('0x3a')],_0xafcd80['filters']));_0x3e99a6[_0x47e1('0x44')][_0x47e1('0x60')]=_0x20d7c3['id'];if(_0x368bd9[_0x47e1('0x3a')][_0x47e1('0x46')]){_0x3e99a6[_0x47e1('0x44')]=_[_0x47e1('0x2f')](_0x3e99a6[_0x47e1('0x44')],{'$or':_[_0x47e1('0x36')](_0x3e99a6[_0x47e1('0x3e')],function(_0x5149ab){var _0x11db59={};_0x11db59[_0x5149ab]={'$like':'%'+_0x368bd9[_0x47e1('0x3a')][_0x47e1('0x46')]+'%'};return _0x11db59;})});}_0x3e99a6=_[_0x47e1('0x2f')]({},_0x3e99a6,_0x368bd9[_0x47e1('0x48')]);return db[_0x47e1('0x5f')][_0x47e1('0x4c')](_0x3e99a6);}})[_0x47e1('0x28')](function(_0x4862c1){if(_0x4862c1){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x4862c1,_0x47e1('0x61')),'role':_0x47e1('0x32')},'attributes':['id',_0x47e1('0x2c'),_0x47e1('0x62'),_0x47e1('0x63'),_0x47e1('0x64')]});}})[_0x47e1('0x28')](function(_0x5bd36a){if(_0x5bd36a){return{'count':_0x5bd36a[_0x47e1('0x22')],'rows':_[_0x47e1('0x36')](_0x5bd36a[_0x47e1('0x4d')],function(_0x4c6bf0){return{'membername':_0x4c6bf0[_0x47e1('0x2c')],'UserId':_0x4c6bf0['id'],'queue_name':_0x200bff[_0x47e1('0x2c')],'MailQueueId':_0x200bff['id'],'interface':util[_0x47e1('0x65')]('%s/%s',_0x47e1('0x66'),_0x4c6bf0['name']),'penalty':0x0,'paused':_0x4c6bf0[_0x47e1('0x62')],'createdAt':_0x4c6bf0[_0x47e1('0x64')],'updatedAt':_0x4c6bf0[_0x47e1('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x47e1('0x28')](respondWithFilteredResult(_0x3ecaef,_0x3e99a6))[_0x47e1('0x4e')](handleError(_0x3ecaef,null));};exports['getTeams']=function(_0x35b3a2,_0x425c96,_0x346a03){var _0x347f35={};var _0x470632={};var _0x3c4c01;var _0x55e2d4;return db[_0x47e1('0x49')]['findOne']({'where':{'id':_0x35b3a2['params']['id']}})[_0x47e1('0x28')](handleEntityNotFound(_0x425c96,null))[_0x47e1('0x28')](function(_0x3ea6a6){if(_0x3ea6a6){_0x3c4c01=_0x3ea6a6;_0x470632['model']=_[_0x47e1('0x3b')](db[_0x47e1('0x67')][_0x47e1('0x37')]);_0x470632['query']=_[_0x47e1('0x3b')](_0x35b3a2[_0x47e1('0x3a')]);_0x470632[_0x47e1('0x3c')]=_[_0x47e1('0x3d')](_0x470632[_0x47e1('0x39')],_0x470632[_0x47e1('0x3a')]);_0x347f35[_0x47e1('0x3e')]=_[_0x47e1('0x3d')](_0x470632[_0x47e1('0x39')],qs[_0x47e1('0x3f')](_0x35b3a2['query'][_0x47e1('0x3f')]));_0x347f35[_0x47e1('0x3e')]=_0x347f35[_0x47e1('0x3e')][_0x47e1('0x40')]?_0x347f35[_0x47e1('0x3e')]:_0x470632[_0x47e1('0x39')];_0x347f35[_0x47e1('0x68')]=qs[_0x47e1('0x43')](_0x35b3a2['query'][_0x47e1('0x43')]);_0x347f35['where']=qs[_0x47e1('0x3c')](_[_0x47e1('0x45')](_0x35b3a2[_0x47e1('0x3a')],_0x470632[_0x47e1('0x3c')]));if(_0x35b3a2[_0x47e1('0x3a')]['filter']){_0x347f35['where']=_[_0x47e1('0x2f')](_0x347f35[_0x47e1('0x44')],{'$or':_['map'](_0x347f35[_0x47e1('0x3e')],function(_0x33848b){var _0x441871={};_0x441871[_0x33848b]={'$like':'%'+_0x35b3a2[_0x47e1('0x3a')][_0x47e1('0x46')]+'%'};return _0x441871;})});}_0x347f35=_[_0x47e1('0x2f')]({},_0x347f35,_0x35b3a2[_0x47e1('0x48')]);return _0x3c4c01[_0x47e1('0x69')](_0x347f35);}})[_0x47e1('0x28')](function(_0x573c75){if(_0x573c75){_0x55e2d4=_0x573c75[_0x47e1('0x40')];if(!_0x35b3a2[_0x47e1('0x3a')][_0x47e1('0x41')](_0x47e1('0x42'))){_0x347f35[_0x47e1('0x21')]=qs[_0x47e1('0x21')](_0x35b3a2['query'][_0x47e1('0x21')]);_0x347f35[_0x47e1('0x23')]=qs[_0x47e1('0x23')](_0x35b3a2['query'][_0x47e1('0x23')]);}return _0x3c4c01['getTeams'](_0x347f35);}})[_0x47e1('0x28')](function(_0x5310fe){if(_0x5310fe){return _0x5310fe?{'count':_0x55e2d4,'rows':_0x5310fe}:null;}})[_0x47e1('0x28')](respondWithResult(_0x425c96,null))[_0x47e1('0x4e')](handleError(_0x425c96,null));};exports[_0x47e1('0x6a')]=function(_0x403b8e,_0x7e7df7,_0x2b7bf9){var _0x361cab=_0x403b8e[_0x47e1('0x30')][_0x47e1('0x6b')];return db['Team'][_0x47e1('0x4c')]({'where':{'id':_0x361cab},'attributes':['id'],'include':[{'model':db['User'],'as':_0x47e1('0x6c'),'attributes':['id',_0x47e1('0x2c'),'online',_0x47e1('0x6d'),_0x47e1('0x6e')],'raw':!![]}]})['then'](function(_0x38c8c4){if(_0x38c8c4){var _0x4b4442=_[_0x47e1('0x6f')](_0x38c8c4,function(_0x1be956){var _0x295b58=_0x1be956[_0x47e1('0x55')]({'plain':!![]});return _0x295b58['Agents'];});return db['MailQueue'][_0x47e1('0x51')]({'where':{'id':_0x403b8e[_0x47e1('0x50')]['id']}})[_0x47e1('0x28')](function(_0x477dab){return db[_0x47e1('0x70')][_0x47e1('0x71')](function(_0xff3183){return _0x477dab[_0x47e1('0x6a')](_0x361cab,{'transaction':_0xff3183})['then'](function(){return BPromise[_0x47e1('0x72')](_0x4b4442,function(_0x456b8b){return db[_0x47e1('0x5f')][_0x47e1('0x73')]({'where':{'UserId':_0x456b8b['id'],'MailQueueId':_0x403b8e['params']['id']},'transaction':_0xff3183});});})[_0x47e1('0x28')](function(){_0x4b4442[_0x47e1('0x74')](function(_0x45bce4){socket[_0x47e1('0x75')](_0x47e1('0x76'),{'UserId':_0x45bce4['id'],'MailQueueId':_0x477dab['id']});});});});});}})[_0x47e1('0x28')](respondWithStatusCode(_0x7e7df7,null))[_0x47e1('0x4e')](handleError(_0x7e7df7,null));};exports[_0x47e1('0x77')]=function(_0x34b203,_0x5c74d6,_0x3f97b1){return db['Team'][_0x47e1('0x4c')]({'where':{'id':_0x34b203['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x47e1('0x78')],'as':_0x47e1('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x47e1('0x28')](handleEntityNotFound(_0x5c74d6,null))[_0x47e1('0x28')](function(_0x44ead5){var _0x182c7a=_[_0x47e1('0x36')](_0x44ead5,'id');var _0x28a6be=[];var _0x3aca34=[];var _0x24ebad=squel[_0x47e1('0x79')]();_0x24ebad[_0x47e1('0x7a')]('tq.TeamId')[_0x47e1('0x7b')](_0x47e1('0x7c'),'tq')[_0x47e1('0x7d')](_0x47e1('0x7e'),'ut',_0x47e1('0x7f'))[_0x47e1('0x44')](_0x47e1('0x80'),_0x34b203[_0x47e1('0x50')]['id']);for(var _0x5ad1b3=0x0;_0x5ad1b3<_0x44ead5[_0x47e1('0x40')];_0x5ad1b3+=0x1){let _0x11e011=_0x44ead5[_0x5ad1b3];for(var _0x12c1d9=0x0;_0x12c1d9<_0x11e011[_0x47e1('0x6c')][_0x47e1('0x40')];_0x12c1d9+=0x1){let _0x1b3941=_0x11e011[_0x47e1('0x6c')][_0x12c1d9];var _0x4e5325=_0x24ebad[_0x47e1('0x81')]();_0x4e5325['where'](_0x47e1('0x82'),_0x1b3941['id']);_0x3aca34[_0x47e1('0x83')](db[_0x47e1('0x70')][_0x47e1('0x3a')](_0x4e5325[_0x47e1('0x84')](),{'type':db[_0x47e1('0x70')][_0x47e1('0x85')][_0x47e1('0x86')]})[_0x47e1('0x28')](function(_0x11bf6d){if(_0x11bf6d['length']===0x1){return _0x1b3941['id'];}else{var _0x2e6bb0=_['every'](_[_0x47e1('0x36')](_0x11bf6d,_0x47e1('0x87')),function(_0x23e798){return _[_0x47e1('0x88')](_0x182c7a,_0x23e798);});if(_0x2e6bb0){return _0x1b3941['id'];}}}));}}return BPromise[_0x47e1('0x89')](_0x3aca34)[_0x47e1('0x28')](function(_0x5458f9){_0x28a6be=_(_0x28a6be)['union'](_0x5458f9)['compact']()[_0x47e1('0x8a')]();return db[_0x47e1('0x49')][_0x47e1('0x51')]({'where':{'id':_0x34b203[_0x47e1('0x50')]['id']}})[_0x47e1('0x28')](function(_0x167f8e){return db['sequelize'][_0x47e1('0x71')](function(_0x17035f){return _0x167f8e[_0x47e1('0x77')](_0x34b203[_0x47e1('0x3a')][_0x47e1('0x6b')],{'transaction':_0x17035f})[_0x47e1('0x28')](function(){if(!_[_0x47e1('0x8b')](_0x28a6be)){return _0x167f8e[_0x47e1('0x8c')](_0x28a6be,{'transaction':_0x17035f});}})[_0x47e1('0x28')](function(){_0x28a6be[_0x47e1('0x74')](function(_0x2590d0){socket[_0x47e1('0x75')]('userMailQueue:remove',{'UserId':_0x2590d0,'MailQueueId':_0x167f8e['id']});});});});});});})[_0x47e1('0x28')](respondWithStatusCode(_0x5c74d6,null))['catch'](handleError(_0x5c74d6,null));};exports['addAgents']=function(_0x5c4ff8,_0x425b44,_0x400e20){return db['MailQueue']['find']({'where':{'id':_0x5c4ff8[_0x47e1('0x50')]['id']}})[_0x47e1('0x28')](handleEntityNotFound(_0x425b44,null))[_0x47e1('0x28')](function(_0x33cb21){if(_0x33cb21){return _0x33cb21[_0x47e1('0x8d')](_0x5c4ff8['body']['ids'],_[_0x47e1('0x8e')](_0x5c4ff8[_0x47e1('0x30')],['ids','id'])||{})[_0x47e1('0x8f')](function(_0x2fabd9){for(var _0x349278=0x0;_0x349278<_0x5c4ff8[_0x47e1('0x30')][_0x47e1('0x6b')][_0x47e1('0x40')];_0x349278+=0x1){socket[_0x47e1('0x75')]('userMailQueue:save',{'UserId':_0x5c4ff8[_0x47e1('0x30')]['ids'][_0x349278],'MailQueueId':_0x5c4ff8[_0x47e1('0x50')]['id']});}return _0x2fabd9;});}})[_0x47e1('0x28')](respondWithResult(_0x425b44,null))[_0x47e1('0x4e')](handleError(_0x425b44,null));};exports[_0x47e1('0x8c')]=function(_0x3e767e,_0x37210d,_0x32a698){return db[_0x47e1('0x49')][_0x47e1('0x51')]({'where':{'id':_0x3e767e[_0x47e1('0x50')]['id']}})[_0x47e1('0x28')](handleEntityNotFound(_0x37210d,null))[_0x47e1('0x28')](function(_0xca4518){if(_0xca4518){return _0xca4518['removeAgents'](_0x3e767e[_0x47e1('0x3a')][_0x47e1('0x6b')])[_0x47e1('0x28')](function(){if(_[_0x47e1('0x90')](_0x3e767e[_0x47e1('0x3a')]['ids'])){for(var _0xed676b=0x0;_0xed676b<_0x3e767e['query'][_0x47e1('0x6b')][_0x47e1('0x40')];_0xed676b+=0x1){socket['emit'](_0x47e1('0x91'),{'UserId':Number(_0x3e767e[_0x47e1('0x3a')][_0x47e1('0x6b')][_0xed676b]),'MailQueueId':Number(_0x3e767e[_0x47e1('0x50')]['id'])});}}else{socket[_0x47e1('0x75')](_0x47e1('0x91'),{'UserId':Number(_0x3e767e[_0x47e1('0x3a')][_0x47e1('0x6b')]),'MailQueueId':Number(_0x3e767e[_0x47e1('0x50')]['id'])});}});}})[_0x47e1('0x28')](respondWithStatusCode(_0x37210d,null))[_0x47e1('0x4e')](handleError(_0x37210d,null));};exports[_0x47e1('0x92')]=function(_0x3124d4,_0x1e2087,_0x19518a){var _0x41956c={};var _0x57ea85={};var _0x57d0a9;var _0x1d8d86;return db[_0x47e1('0x49')]['findOne']({'where':{'id':_0x3124d4['params']['id']}})[_0x47e1('0x28')](handleEntityNotFound(_0x1e2087,null))[_0x47e1('0x28')](function(_0x4ddc7d){if(_0x4ddc7d){_0x57d0a9=_0x4ddc7d;_0x57ea85['model']=_[_0x47e1('0x3b')](db[_0x47e1('0x78')]['rawAttributes']);_0x57ea85[_0x47e1('0x3a')]=_[_0x47e1('0x3b')](_0x3124d4['query']);_0x57ea85[_0x47e1('0x3c')]=_['intersection'](_0x57ea85[_0x47e1('0x39')],_0x57ea85[_0x47e1('0x3a')]);_0x41956c[_0x47e1('0x3e')]=_[_0x47e1('0x3d')](_0x57ea85[_0x47e1('0x39')],qs[_0x47e1('0x3f')](_0x3124d4[_0x47e1('0x3a')][_0x47e1('0x3f')]));_0x41956c[_0x47e1('0x3e')]=_0x41956c[_0x47e1('0x3e')][_0x47e1('0x40')]?_0x41956c[_0x47e1('0x3e')]:_0x57ea85['model'];_0x41956c[_0x47e1('0x68')]=qs[_0x47e1('0x43')](_0x3124d4['query'][_0x47e1('0x43')]);_0x41956c[_0x47e1('0x44')]=qs[_0x47e1('0x3c')](_[_0x47e1('0x45')](_0x3124d4[_0x47e1('0x3a')],_0x57ea85[_0x47e1('0x3c')]));if(_0x3124d4['query'][_0x47e1('0x46')]){_0x41956c[_0x47e1('0x44')]=_[_0x47e1('0x2f')](_0x41956c[_0x47e1('0x44')],{'$or':_[_0x47e1('0x36')](_0x41956c[_0x47e1('0x3e')],function(_0x82635c){var _0x53650e={};_0x53650e[_0x82635c]={'$like':'%'+_0x3124d4[_0x47e1('0x3a')][_0x47e1('0x46')]+'%'};return _0x53650e;})});}_0x41956c=_[_0x47e1('0x2f')]({},_0x41956c,_0x3124d4[_0x47e1('0x48')]);return _0x57d0a9['getAgents'](_0x41956c);}})[_0x47e1('0x28')](function(_0xfe24ed){if(_0xfe24ed){_0x1d8d86=_0xfe24ed['length'];if(!_0x3124d4[_0x47e1('0x3a')][_0x47e1('0x41')](_0x47e1('0x42'))){_0x41956c[_0x47e1('0x21')]=qs[_0x47e1('0x21')](_0x3124d4[_0x47e1('0x3a')]['limit']);_0x41956c[_0x47e1('0x23')]=qs[_0x47e1('0x23')](_0x3124d4['query'][_0x47e1('0x23')]);}return _0x57d0a9[_0x47e1('0x92')](_0x41956c);}})[_0x47e1('0x28')](function(_0x455d46){if(_0x455d46){return _0x455d46?{'count':_0x1d8d86,'rows':_0x455d46}:null;}})[_0x47e1('0x28')](respondWithResult(_0x1e2087,null))[_0x47e1('0x4e')](handleError(_0x1e2087,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index f06bbb4..356de8c 100644 --- a/server/api/mailQueue/mailQueue.events.js +++ b/server/api/mailQueue/mailQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a2e=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x445801,_0x33e51a){var _0xcb14c9=function(_0x5af3b7){while(--_0x5af3b7){_0x445801['push'](_0x445801['shift']());}};_0xcb14c9(++_0x33e51a);}(_0x2a2e,0x1ad));var _0xe2a2=function(_0x4a5325,_0x5754bb){_0x4a5325=_0x4a5325-0x0;var _0x2d1a2f=_0x2a2e[_0x4a5325];return _0x2d1a2f;};'use strict';var EventEmitter=require(_0xe2a2('0x0'));var MailQueue=require(_0xe2a2('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe2a2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2a2('0x3'),'afterDestroy':_0xe2a2('0x4')};function emitEvent(_0x503431){return function(_0x43118f,_0x1db76b,_0x3b70ae){MailQueueEvents[_0xe2a2('0x5')](_0x503431+':'+_0x43118f['id'],_0x43118f);MailQueueEvents[_0xe2a2('0x5')](_0x503431,_0x43118f);_0x3b70ae(null);};}for(var e in events){if(events[_0xe2a2('0x6')](e)){var event=events[e];MailQueue[_0xe2a2('0x7')](e,emitEvent(event));}}module[_0xe2a2('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x9797=['remove','hasOwnProperty','hook','exports','events','MailQueue','save','update'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x9797,0x10c));var _0x7979=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x9797[_0x2d8434];return _0x26b9e4;};'use strict';var EventEmitter=require(_0x7979('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x7979('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7979('0x2'),'afterUpdate':_0x7979('0x3'),'afterDestroy':_0x7979('0x4')};function emitEvent(_0x7899fa){return function(_0x25f9c2,_0x4c7822,_0x4fb779){MailQueueEvents['emit'](_0x7899fa+':'+_0x25f9c2['id'],_0x25f9c2);MailQueueEvents['emit'](_0x7899fa,_0x25f9c2);_0x4fb779(null);};}for(var e in events){if(events[_0x7979('0x5')](e)){var event=events[e];MailQueue[_0x7979('0x6')](e,emitEvent(event));}}module[_0x7979('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 054214a..bdbbd5f 100644 --- a/server/api/mailQueue/mailQueue.model.js +++ b/server/api/mailQueue/mailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a72=['request-promise','path','rimraf','../../config/environment','exports','define','mail_queues','util','../../config/logger','api','moment'];(function(_0x5a8e83,_0x3447fd){var _0x2834f9=function(_0x11026c){while(--_0x11026c){_0x5a8e83['push'](_0x5a8e83['shift']());}};_0x2834f9(++_0x3447fd);}(_0x3a72,0x1a9));var _0x23a7=function(_0x2c9d0b,_0x391f6b){_0x2c9d0b=_0x2c9d0b-0x0;var _0x1f7284=_0x3a72[_0x2c9d0b];return _0x1f7284;};'use strict';var _=require('lodash');var util=require(_0x23a7('0x0'));var logger=require(_0x23a7('0x1'))(_0x23a7('0x2'));var moment=require(_0x23a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x23a7('0x4'));var fs=require('fs');var path=require(_0x23a7('0x5'));var rimraf=require(_0x23a7('0x6'));var config=require(_0x23a7('0x7'));var attributes=require('./mailQueue.attributes');module[_0x23a7('0x8')]=function(_0x38fb13,_0x254490){return _0x38fb13[_0x23a7('0x9')]('MailQueue',attributes,{'tableName':_0x23a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a0=['MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','path','./mailQueue.attributes','exports','define'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xc2a0,0x1a6));var _0x0c2a=function(_0x31db1b,_0x2b4199){_0x31db1b=_0x31db1b-0x0;var _0x5e8cf6=_0xc2a0[_0x31db1b];return _0x5e8cf6;};'use strict';var _=require(_0x0c2a('0x0'));var util=require(_0x0c2a('0x1'));var logger=require('../../config/logger')(_0x0c2a('0x2'));var moment=require(_0x0c2a('0x3'));var BPromise=require(_0x0c2a('0x4'));var rp=require(_0x0c2a('0x5'));var fs=require('fs');var path=require(_0x0c2a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c2a('0x7'));module[_0x0c2a('0x8')]=function(_0x3c327d,_0x336069){return _0x3c327d[_0x0c2a('0x9')](_0x0c2a('0xa'),attributes,{'tableName':_0x0c2a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index cf9fce0..1731e1c 100644 --- a/server/api/mailQueue/mailQueue.rpc.js +++ b/server/api/mailQueue/mailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x677e=['map','model','GetMailQueue','debug','ShowMailQueue','find','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailQueue','options','raw','where','attributes','include'];(function(_0x347ee1,_0x4f30ab){var _0x40e7f6=function(_0x228e65){while(--_0x228e65){_0x347ee1['push'](_0x347ee1['shift']());}};_0x40e7f6(++_0x4f30ab);}(_0x677e,0xd2));var _0xe677=function(_0x200045,_0x4e5da1){_0x200045=_0x200045-0x0;var _0x566a8d=_0x677e[_0x200045];return _0x566a8d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe677('0x0'));var BPromise=require(_0xe677('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe677('0x2'))['db'];var utils=require(_0xe677('0x3'));var logger=require(_0xe677('0x4'))('rpc');var config=require(_0xe677('0x5'));var jayson=require(_0xe677('0x6'));var client=jayson['client'][_0xe677('0x7')]({'port':0x232a});config[_0xe677('0x8')]=_['defaults'](config[_0xe677('0x8')],{'host':_0xe677('0x9'),'port':0x18eb});var socket=require(_0xe677('0xa'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x26a8ca,_0x2ee439,_0x3131df){return new BPromise(function(_0x4fd839,_0x289a8e){return client[_0xe677('0xb')](_0x26a8ca,_0x3131df)[_0xe677('0xc')](function(_0x390058){logger['info'](_0xe677('0xd'),_0x2ee439,_0xe677('0xe'));logger['debug'](_0xe677('0xf'),_0x2ee439,'request\x20sent',JSON[_0xe677('0x10')](_0x390058));if(_0x390058['error']){if(_0x390058[_0xe677('0x11')][_0xe677('0x12')]===0x1f4){logger[_0xe677('0x11')]('MailQueue,\x20%s,\x20%s',_0x2ee439,_0x390058['error'][_0xe677('0x13')]);return _0x289a8e(_0x390058[_0xe677('0x11')][_0xe677('0x13')]);}logger[_0xe677('0x11')](_0xe677('0xd'),_0x2ee439,_0x390058[_0xe677('0x11')][_0xe677('0x13')]);return _0x4fd839(_0x390058[_0xe677('0x11')][_0xe677('0x13')]);}else{logger[_0xe677('0x14')](_0xe677('0xd'),_0x2ee439,_0xe677('0xe'));_0x4fd839(_0x390058['result'][_0xe677('0x13')]);}})[_0xe677('0x15')](function(_0x1d294d){logger[_0xe677('0x11')](_0xe677('0xd'),_0x2ee439,_0x1d294d);_0x289a8e(_0x1d294d);});});}exports['GetMailQueue']=function(_0x37c4e2){var _0x50c433=this;return new Promise(function(_0x2ffa66,_0x571503){return db[_0xe677('0x16')]['findAll']({'raw':_0x37c4e2['options']?_0x37c4e2[_0xe677('0x17')][_0xe677('0x18')]===undefined?!![]:![]:!![],'where':_0x37c4e2['options']?_0x37c4e2[_0xe677('0x17')][_0xe677('0x19')]||null:null,'attributes':_0x37c4e2[_0xe677('0x17')]?_0x37c4e2[_0xe677('0x17')][_0xe677('0x1a')]||null:null,'limit':_0x37c4e2[_0xe677('0x17')]?_0x37c4e2[_0xe677('0x17')]['limit']||null:null,'include':_0x37c4e2['options']?_0x37c4e2[_0xe677('0x17')][_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x37c4e2['options'][_0xe677('0x1b')],function(_0x128043){return{'model':db[_0x128043[_0xe677('0x1d')]],'as':_0x128043['as'],'attributes':_0x128043[_0xe677('0x1a')],'include':_0x128043[_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x128043[_0xe677('0x1b')],function(_0x1f0706){return{'model':db[_0x1f0706['model']],'as':_0x1f0706['as'],'attributes':_0x1f0706[_0xe677('0x1a')],'include':_0x1f0706[_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x1f0706[_0xe677('0x1b')],function(_0x29a041){return{'model':db[_0x29a041[_0xe677('0x1d')]],'as':_0x29a041['as'],'attributes':_0x29a041[_0xe677('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe677('0xc')](function(_0x597854){logger[_0xe677('0x14')](_0xe677('0x1e'),_0x37c4e2);logger[_0xe677('0x1f')]('GetMailQueue',_0x37c4e2,JSON[_0xe677('0x10')](_0x597854));_0x2ffa66(_0x597854);})[_0xe677('0x15')](function(_0x1c90c2){logger[_0xe677('0x11')](_0xe677('0x1e'),_0x1c90c2[_0xe677('0x13')],_0x37c4e2);_0x571503(_0x50c433[_0xe677('0x11')](0x1f4,_0x1c90c2[_0xe677('0x13')]));});});};exports[_0xe677('0x20')]=function(_0x42aad8){var _0x992d26=this;return new Promise(function(_0x36fcb5,_0x473038){return db[_0xe677('0x16')][_0xe677('0x21')]({'raw':_0x42aad8[_0xe677('0x17')]?_0x42aad8[_0xe677('0x17')][_0xe677('0x18')]===undefined?!![]:![]:!![],'where':_0x42aad8['options']?_0x42aad8[_0xe677('0x17')][_0xe677('0x19')]||null:null,'attributes':_0x42aad8[_0xe677('0x17')]?_0x42aad8['options'][_0xe677('0x1a')]||null:null,'include':_0x42aad8[_0xe677('0x17')]?_0x42aad8[_0xe677('0x17')][_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x42aad8[_0xe677('0x17')][_0xe677('0x1b')],function(_0x42f719){return{'model':db[_0x42f719[_0xe677('0x1d')]],'as':_0x42f719['as'],'attributes':_0x42f719['attributes'],'include':_0x42f719[_0xe677('0x1b')]?_[_0xe677('0x1c')](_0x42f719['include'],function(_0x25e834){return{'model':db[_0x25e834['model']],'as':_0x25e834['as'],'attributes':_0x25e834[_0xe677('0x1a')],'include':_0x25e834[_0xe677('0x1b')]?_['map'](_0x25e834[_0xe677('0x1b')],function(_0x40900a){return{'model':db[_0x40900a['model']],'as':_0x40900a['as'],'attributes':_0x40900a[_0xe677('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe677('0xc')](function(_0x5d0f06){logger['info']('ShowMailQueue',_0x42aad8);logger[_0xe677('0x1f')]('ShowMailQueue',_0x42aad8,JSON[_0xe677('0x10')](_0x5d0f06));_0x36fcb5(_0x5d0f06);})['catch'](function(_0x2e67f4){logger[_0xe677('0x11')](_0xe677('0x20'),_0x2e67f4[_0xe677('0x13')],_0x42aad8);_0x473038(_0x992d26[_0xe677('0x11')](0x1f4,_0x2e67f4['message']));});});}; \ No newline at end of file +var _0x8e72=['register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','map','model','ShowMailQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','./mailQueue.socket'];(function(_0x10d784,_0x30c38d){var _0x45b8af=function(_0x44c717){while(--_0x44c717){_0x10d784['push'](_0x10d784['shift']());}};_0x45b8af(++_0x30c38d);}(_0x8e72,0x18b));var _0x28e7=function(_0xc1197d,_0x1854d7){_0xc1197d=_0xc1197d-0x0;var _0x381c98=_0x8e72[_0xc1197d];return _0x381c98;};'use strict';var _=require(_0x28e7('0x0'));var util=require('util');var moment=require(_0x28e7('0x1'));var BPromise=require('bluebird');var rs=require(_0x28e7('0x2'));var fs=require('fs');var Redis=require(_0x28e7('0x3'));var db=require(_0x28e7('0x4'))['db'];var utils=require(_0x28e7('0x5'));var logger=require(_0x28e7('0x6'))('rpc');var config=require(_0x28e7('0x7'));var jayson=require(_0x28e7('0x8'));var client=jayson[_0x28e7('0x9')]['http']({'port':0x232a});config[_0x28e7('0xa')]=_['defaults'](config[_0x28e7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28e7('0xa')]));require(_0x28e7('0xb'))[_0x28e7('0xc')](socket);function respondWithRpcPromise(_0x6f571,_0x4e9566,_0x25ce34){return new BPromise(function(_0x134ea3,_0x11d37f){return client[_0x28e7('0xd')](_0x6f571,_0x25ce34)[_0x28e7('0xe')](function(_0x1b8900){logger[_0x28e7('0xf')](_0x28e7('0x10'),_0x4e9566,_0x28e7('0x11'));logger[_0x28e7('0x12')](_0x28e7('0x13'),_0x4e9566,_0x28e7('0x11'),JSON[_0x28e7('0x14')](_0x1b8900));if(_0x1b8900[_0x28e7('0x15')]){if(_0x1b8900['error'][_0x28e7('0x16')]===0x1f4){logger[_0x28e7('0x15')](_0x28e7('0x10'),_0x4e9566,_0x1b8900[_0x28e7('0x15')][_0x28e7('0x17')]);return _0x11d37f(_0x1b8900['error'][_0x28e7('0x17')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4e9566,_0x1b8900[_0x28e7('0x15')][_0x28e7('0x17')]);return _0x134ea3(_0x1b8900[_0x28e7('0x15')][_0x28e7('0x17')]);}else{logger[_0x28e7('0xf')](_0x28e7('0x10'),_0x4e9566,_0x28e7('0x11'));_0x134ea3(_0x1b8900['result']['message']);}})[_0x28e7('0x18')](function(_0x58d985){logger['error']('MailQueue,\x20%s,\x20%s',_0x4e9566,_0x58d985);_0x11d37f(_0x58d985);});});}exports[_0x28e7('0x19')]=function(_0x112e5c){var _0x53bc84=this;return new Promise(function(_0x11f363,_0x249c3a){return db[_0x28e7('0x1a')][_0x28e7('0x1b')]({'raw':_0x112e5c[_0x28e7('0x1c')]?_0x112e5c['options'][_0x28e7('0x1d')]===undefined?!![]:![]:!![],'where':_0x112e5c[_0x28e7('0x1c')]?_0x112e5c[_0x28e7('0x1c')][_0x28e7('0x1e')]||null:null,'attributes':_0x112e5c[_0x28e7('0x1c')]?_0x112e5c[_0x28e7('0x1c')][_0x28e7('0x1f')]||null:null,'limit':_0x112e5c[_0x28e7('0x1c')]?_0x112e5c[_0x28e7('0x1c')]['limit']||null:null,'include':_0x112e5c['options']?_0x112e5c[_0x28e7('0x1c')][_0x28e7('0x20')]?_[_0x28e7('0x21')](_0x112e5c[_0x28e7('0x1c')][_0x28e7('0x20')],function(_0x35ee1a){return{'model':db[_0x35ee1a['model']],'as':_0x35ee1a['as'],'attributes':_0x35ee1a[_0x28e7('0x1f')],'include':_0x35ee1a[_0x28e7('0x20')]?_['map'](_0x35ee1a[_0x28e7('0x20')],function(_0x595062){return{'model':db[_0x595062[_0x28e7('0x22')]],'as':_0x595062['as'],'attributes':_0x595062['attributes'],'include':_0x595062[_0x28e7('0x20')]?_[_0x28e7('0x21')](_0x595062[_0x28e7('0x20')],function(_0x34045c){return{'model':db[_0x34045c[_0x28e7('0x22')]],'as':_0x34045c['as'],'attributes':_0x34045c['attributes']};}):[]};}):[]};}):[]:[]})[_0x28e7('0xe')](function(_0x2dc865){logger[_0x28e7('0xf')]('GetMailQueue',_0x112e5c);logger['debug']('GetMailQueue',_0x112e5c,JSON['stringify'](_0x2dc865));_0x11f363(_0x2dc865);})[_0x28e7('0x18')](function(_0x49f6b2){logger[_0x28e7('0x15')]('GetMailQueue',_0x49f6b2[_0x28e7('0x17')],_0x112e5c);_0x249c3a(_0x53bc84['error'](0x1f4,_0x49f6b2[_0x28e7('0x17')]));});});};exports[_0x28e7('0x23')]=function(_0x3a7e8c){var _0x167dcc=this;return new Promise(function(_0x28304c,_0x24b197){return db[_0x28e7('0x1a')][_0x28e7('0x24')]({'raw':_0x3a7e8c['options']?_0x3a7e8c[_0x28e7('0x1c')][_0x28e7('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a7e8c['options']?_0x3a7e8c[_0x28e7('0x1c')][_0x28e7('0x1e')]||null:null,'attributes':_0x3a7e8c['options']?_0x3a7e8c[_0x28e7('0x1c')][_0x28e7('0x1f')]||null:null,'include':_0x3a7e8c[_0x28e7('0x1c')]?_0x3a7e8c['options'][_0x28e7('0x20')]?_[_0x28e7('0x21')](_0x3a7e8c[_0x28e7('0x1c')][_0x28e7('0x20')],function(_0x502886){return{'model':db[_0x502886[_0x28e7('0x22')]],'as':_0x502886['as'],'attributes':_0x502886[_0x28e7('0x1f')],'include':_0x502886[_0x28e7('0x20')]?_[_0x28e7('0x21')](_0x502886['include'],function(_0x308a3c){return{'model':db[_0x308a3c[_0x28e7('0x22')]],'as':_0x308a3c['as'],'attributes':_0x308a3c[_0x28e7('0x1f')],'include':_0x308a3c['include']?_['map'](_0x308a3c['include'],function(_0x4778de){return{'model':db[_0x4778de[_0x28e7('0x22')]],'as':_0x4778de['as'],'attributes':_0x4778de['attributes']};}):[]};}):[]};}):[]:[]})[_0x28e7('0xe')](function(_0x1d343f){logger[_0x28e7('0xf')](_0x28e7('0x23'),_0x3a7e8c);logger['debug'](_0x28e7('0x23'),_0x3a7e8c,JSON[_0x28e7('0x14')](_0x1d343f));_0x28304c(_0x1d343f);})['catch'](function(_0xf511bf){logger[_0x28e7('0x15')](_0x28e7('0x23'),_0xf511bf[_0x28e7('0x17')],_0x3a7e8c);_0x24b197(_0x167dcc['error'](0x1f4,_0xf511bf[_0x28e7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index cda14bc..22c5921 100644 --- a/server/api/mailQueue/mailQueue.socket.js +++ b/server/api/mailQueue/mailQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13e1=['length','./mailQueue.events','save','remove','emit'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x13e1,0xb5));var _0x113e=function(_0x15aa66,_0x2e038b){_0x15aa66=_0x15aa66-0x0;var _0x1e2fed=_0x13e1[_0x15aa66];return _0x1e2fed;};'use strict';var MailQueueEvents=require(_0x113e('0x0'));var events=[_0x113e('0x1'),_0x113e('0x2'),'update'];function createListener(_0x23a533,_0xf5dde9){return function(_0x4ba4e6){_0xf5dde9[_0x113e('0x3')](_0x23a533,_0x4ba4e6);};}function removeListener(_0x2e2f71,_0x44fb08){return function(){MailQueueEvents['removeListener'](_0x2e2f71,_0x44fb08);};}exports['register']=function(_0xd68759){for(var _0x350048=0x0,_0x50f54b=events[_0x113e('0x4')];_0x350048<_0x50f54b;_0x350048++){var _0x29bd0c=events[_0x350048];var _0x5bd87e=createListener('mailQueue:'+_0x29bd0c,_0xd68759);MailQueueEvents['on'](_0x29bd0c,_0x5bd87e);}}; \ No newline at end of file +var _0x7ec1=['./mailQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x7ec1,0x13b));var _0x17ec=function(_0x4f1387,_0x1797f9){_0x4f1387=_0x4f1387-0x0;var _0x438033=_0x7ec1[_0x4f1387];return _0x438033;};'use strict';var MailQueueEvents=require(_0x17ec('0x0'));var events=[_0x17ec('0x1'),_0x17ec('0x2'),_0x17ec('0x3')];function createListener(_0x28a044,_0x17518a){return function(_0x53389b){_0x17518a[_0x17ec('0x4')](_0x28a044,_0x53389b);};}function removeListener(_0x3575ac,_0x25ea65){return function(){MailQueueEvents[_0x17ec('0x5')](_0x3575ac,_0x25ea65);};}exports['register']=function(_0x2046c7){for(var _0x402689=0x0,_0x2c673e=events[_0x17ec('0x6')];_0x402689<_0x2c673e;_0x402689++){var _0x5c9081=events[_0x402689];var _0x429d9e=createListener('mailQueue:'+_0x5c9081,_0x2046c7);MailQueueEvents['on'](_0x5c9081,_0x429d9e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 331047f..80e6dad 100644 --- a/server/api/mailQueueReport/index.js +++ b/server/api/mailQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07c0=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0xacc5a7,_0x19cf31){var _0x5b2049=function(_0x292569){while(--_0x292569){_0xacc5a7['push'](_0xacc5a7['shift']());}};_0x5b2049(++_0x19cf31);}(_0x07c0,0x18a));var _0x007c=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x07c0[_0x57cbfb];return _0x4cb933;};'use strict';var multer=require(_0x007c('0x0'));var util=require(_0x007c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x007c('0x2'));var router=express[_0x007c('0x3')]();var fs_extra=require(_0x007c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x007c('0x5'));var config=require(_0x007c('0x6'));var controller=require(_0x007c('0x7'));router[_0x007c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x007c('0x8')](_0x007c('0x9'),auth[_0x007c('0xa')](),controller[_0x007c('0xb')]);router['get'](_0x007c('0xc'),auth['isAuthenticated'](),controller[_0x007c('0xd')]);router[_0x007c('0xe')]('/',auth['isAuthenticated'](),controller[_0x007c('0xf')]);router[_0x007c('0x10')](_0x007c('0xc'),auth[_0x007c('0xa')](),controller[_0x007c('0x11')]);router[_0x007c('0x12')](_0x007c('0xc'),auth['isAuthenticated'](),controller[_0x007c('0x13')]);module[_0x007c('0x14')]=router; \ No newline at end of file +var _0x450a=['util','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','multer'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x450a,0x11c));var _0xa450=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x450a[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xa450('0x0'));var util=require(_0xa450('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa450('0x2'));var router=express[_0xa450('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa450('0x4'));var interaction=require(_0xa450('0x5'));var config=require('../../config/environment');var controller=require(_0xa450('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa450('0x7')]);router[_0xa450('0x8')](_0xa450('0x9'),auth[_0xa450('0xa')](),controller[_0xa450('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa450('0xc')]);router[_0xa450('0xd')]('/',auth[_0xa450('0xa')](),controller[_0xa450('0xe')]);router['put'](_0xa450('0xf'),auth['isAuthenticated'](),controller[_0xa450('0x10')]);router[_0xa450('0x11')](_0xa450('0xf'),auth[_0xa450('0xa')](),controller[_0xa450('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 29228be..10b3149 100644 --- a/server/api/mailQueueReport/mailQueueReport.attributes.js +++ b/server/api/mailQueueReport/mailQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8608=['moment','exports','STRING','DATE'];(function(_0x5da4f2,_0x117676){var _0xe521=function(_0x43f6e8){while(--_0x43f6e8){_0x5da4f2['push'](_0x5da4f2['shift']());}};_0xe521(++_0x117676);}(_0x8608,0x15c));var _0x8860=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8608[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8860('0x0'));var Sequelize=require('sequelize');module[_0x8860('0x1')]={'uniqueid':{'type':Sequelize[_0x8860('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x8860('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8860('0x3')]},'acceptAt':{'type':Sequelize[_0x8860('0x3')]},'exitAt':{'type':Sequelize[_0x8860('0x3')]},'reason':{'type':Sequelize[_0x8860('0x2')]}}; \ No newline at end of file +var _0x94db=['STRING','DATE','sequelize'];(function(_0x17f31b,_0x4b899f){var _0x105009=function(_0x32d467){while(--_0x32d467){_0x17f31b['push'](_0x17f31b['shift']());}};_0x105009(++_0x4b899f);}(_0x94db,0xce));var _0xb94d=function(_0x255652,_0x53d962){_0x255652=_0x255652-0x0;var _0x13f93b=_0x94db[_0x255652];return _0x13f93b;};'use strict';var moment=require('moment');var Sequelize=require(_0xb94d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb94d('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb94d('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb94d('0x2')]},'acceptAt':{'type':Sequelize[_0xb94d('0x2')]},'exitAt':{'type':Sequelize[_0xb94d('0x2')]},'reason':{'type':Sequelize[_0xb94d('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 10ce601..32235a7 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5e5=['interaction','account','map','MailQueueReport','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','agent'];(function(_0x22a1bd,_0x3e440f){var _0x321421=function(_0x1c8a58){while(--_0x1c8a58){_0x22a1bd['push'](_0x22a1bd['shift']());}};_0x321421(++_0x3e440f);}(_0xc5e5,0x111));var _0x5c5e=function(_0x31a293,_0x14670c){_0x31a293=_0x31a293-0x0;var _0x235cca=_0xc5e5[_0x31a293];return _0x235cca;};'use strict';var emlformat=require(_0x5c5e('0x0'));var rimraf=require(_0x5c5e('0x1'));var zipdir=require(_0x5c5e('0x2'));var jsonpatch=require(_0x5c5e('0x3'));var rp=require(_0x5c5e('0x4'));var moment=require('moment');var BPromise=require(_0x5c5e('0x5'));var Mustache=require('mustache');var util=require(_0x5c5e('0x6'));var path=require(_0x5c5e('0x7'));var sox=require('sox');var csv=require(_0x5c5e('0x8'));var ejs=require(_0x5c5e('0x9'));var fs=require('fs');var fs_extra=require(_0x5c5e('0xa'));var _=require(_0x5c5e('0xb'));var squel=require(_0x5c5e('0xc'));var crypto=require(_0x5c5e('0xd'));var jsforce=require(_0x5c5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c5e('0x8'));var querystring=require(_0x5c5e('0xf'));var Papa=require('papaparse');var Redis=require(_0x5c5e('0x10'));var authService=require(_0x5c5e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c5e('0x12'));var utils=require(_0x5c5e('0x13'));var config=require(_0x5c5e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c5e('0x15'))['db'];function respondWithStatusCode(_0x2899e1,_0x30a82b){_0x30a82b=_0x30a82b||0xcc;return function(_0x3be3f8){if(_0x3be3f8){return _0x2899e1[_0x5c5e('0x16')](_0x30a82b);}return _0x2899e1[_0x5c5e('0x17')](_0x30a82b)[_0x5c5e('0x18')]();};}function respondWithResult(_0x14a7b3,_0x2349d0){_0x2349d0=_0x2349d0||0xc8;return function(_0x2ecf66){if(_0x2ecf66){return _0x14a7b3['status'](_0x2349d0)[_0x5c5e('0x19')](_0x2ecf66);}};}function respondWithFilteredResult(_0x1f181a,_0x1bb9dc){return function(_0x1ff228){if(_0x1ff228){var _0x2a68c7=typeof _0x1bb9dc[_0x5c5e('0x1a')]===_0x5c5e('0x1b')&&typeof _0x1bb9dc[_0x5c5e('0x1c')]==='undefined';var _0x74d2a8=_0x1ff228[_0x5c5e('0x1d')];var _0x3a8e2f=_0x2a68c7?0x0:_0x1bb9dc['offset'];var _0x369b82=_0x2a68c7?_0x1ff228[_0x5c5e('0x1d')]:_0x1bb9dc['offset']+_0x1bb9dc[_0x5c5e('0x1c')];var _0x492885;if(_0x369b82>=_0x74d2a8){_0x369b82=_0x74d2a8;_0x492885=0xc8;}else{_0x492885=0xce;}_0x1f181a[_0x5c5e('0x17')](_0x492885);return _0x1f181a[_0x5c5e('0x1e')]('Content-Range',_0x3a8e2f+'-'+_0x369b82+'/'+_0x74d2a8)[_0x5c5e('0x19')](_0x1ff228);}return null;};}function patchUpdates(_0x16d3d7){return function(_0x34c0d8){try{jsonpatch[_0x5c5e('0x1f')](_0x34c0d8,_0x16d3d7,!![]);}catch(_0x506c88){return BPromise[_0x5c5e('0x20')](_0x506c88);}return _0x34c0d8[_0x5c5e('0x21')]();};}function saveUpdates(_0x2d7b27,_0x498b29){return function(_0x477b9d){if(_0x477b9d){return _0x477b9d[_0x5c5e('0x22')](_0x2d7b27)[_0x5c5e('0x23')](function(_0x55467e){return _0x55467e;});}return null;};}function removeEntity(_0x4f8251,_0x29fa48){return function(_0x1cba51){if(_0x1cba51){return _0x1cba51[_0x5c5e('0x24')]()[_0x5c5e('0x23')](function(){_0x4f8251[_0x5c5e('0x17')](0xcc)[_0x5c5e('0x18')]();});}};}function handleEntityNotFound(_0x60af27,_0x62f0dd){return function(_0x529587){if(!_0x529587){_0x60af27[_0x5c5e('0x16')](0x194);}return _0x529587;};}function handleError(_0x4d6f6e,_0x3dde42){_0x3dde42=_0x3dde42||0x1f4;return function(_0x5f5782){logger[_0x5c5e('0x25')](_0x5f5782[_0x5c5e('0x26')]);if(_0x5f5782[_0x5c5e('0x27')]){delete _0x5f5782[_0x5c5e('0x27')];}_0x4d6f6e[_0x5c5e('0x17')](_0x3dde42)[_0x5c5e('0x28')](_0x5f5782);};}function getMustacheRender(_0xc6660a,_0x2d0a3c){return Mustache[_0x5c5e('0x29')](_0xc6660a,_[_0x5c5e('0x2a')](_0x2d0a3c[_0x5c5e('0x2b')],{'contact':_0x2d0a3c[_0x5c5e('0x2c')],'message':_0x2d0a3c[_0x5c5e('0x2d')],'agent':_0x2d0a3c[_0x5c5e('0x2e')],'interaction':_0x2d0a3c[_0x5c5e('0x2f')],'account':_0x2d0a3c[_0x5c5e('0x30')]}))||'';}exports['index']=function(_0x47e246,_0x360582){var _0x161ac8={},_0x3609a0={},_0x22a5cf={'count':0x0,'rows':[]};var _0x66af7=_[_0x5c5e('0x31')](db[_0x5c5e('0x32')]['rawAttributes'],function(_0xcf9e9){return{'name':_0xcf9e9['fieldName'],'type':_0xcf9e9[_0x5c5e('0x33')][_0x5c5e('0x34')]};});_0x3609a0[_0x5c5e('0x35')]=_['map'](_0x66af7,_0x5c5e('0x27'));_0x3609a0['query']=_[_0x5c5e('0x36')](_0x47e246[_0x5c5e('0x37')]);_0x3609a0['filters']=_[_0x5c5e('0x38')](_0x3609a0['model'],_0x3609a0[_0x5c5e('0x37')]);_0x161ac8['attributes']=_[_0x5c5e('0x38')](_0x3609a0['model'],qs[_0x5c5e('0x39')](_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x39')]));_0x161ac8[_0x5c5e('0x3a')]=_0x161ac8[_0x5c5e('0x3a')]['length']?_0x161ac8['attributes']:_0x3609a0[_0x5c5e('0x35')];if(!_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x3b')](_0x5c5e('0x3c'))){_0x161ac8['limit']=qs['limit'](_0x47e246[_0x5c5e('0x37')]['limit']);_0x161ac8['offset']=qs['offset'](_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x1a')]);}_0x161ac8[_0x5c5e('0x3d')]=qs[_0x5c5e('0x3e')](_0x47e246['query']['sort']);_0x161ac8['where']=qs['filters'](_[_0x5c5e('0x3f')](_0x47e246['query'],_0x3609a0[_0x5c5e('0x40')]),_0x66af7);if(_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x41')]){_0x161ac8[_0x5c5e('0x42')]=_[_0x5c5e('0x2a')](_0x161ac8[_0x5c5e('0x42')],{'$or':_[_0x5c5e('0x31')](_0x66af7,function(_0x45eaf0){if(_0x45eaf0[_0x5c5e('0x33')]!==_0x5c5e('0x43')){var _0x24c7a4={};_0x24c7a4[_0x45eaf0['name']]={'$like':'%'+_0x47e246['query'][_0x5c5e('0x41')]+'%'};return _0x24c7a4;}})});}_0x161ac8=_[_0x5c5e('0x2a')]({},_0x161ac8,_0x47e246[_0x5c5e('0x44')]);var _0x24a7d3={'where':_0x161ac8[_0x5c5e('0x42')]};return db[_0x5c5e('0x32')][_0x5c5e('0x1d')](_0x24a7d3)[_0x5c5e('0x23')](function(_0x3d9e1b){_0x22a5cf[_0x5c5e('0x1d')]=_0x3d9e1b;if(_0x47e246[_0x5c5e('0x37')][_0x5c5e('0x45')]){_0x161ac8[_0x5c5e('0x46')]=[{'all':!![]}];}return db[_0x5c5e('0x32')][_0x5c5e('0x47')](_0x161ac8);})['then'](function(_0x11e67f){_0x22a5cf['rows']=_0x11e67f;return _0x22a5cf;})['then'](respondWithFilteredResult(_0x360582,_0x161ac8))[_0x5c5e('0x48')](handleError(_0x360582,null));};exports[_0x5c5e('0x49')]=function(_0x1980a1,_0x480175){var _0x1a6f03={'raw':!![],'where':{'id':_0x1980a1[_0x5c5e('0x4a')]['id']}},_0x2487c5={};_0x2487c5[_0x5c5e('0x35')]=_[_0x5c5e('0x36')](db['MailQueueReport'][_0x5c5e('0x4b')]);_0x2487c5[_0x5c5e('0x37')]=_['keys'](_0x1980a1['query']);_0x2487c5[_0x5c5e('0x40')]=_['intersection'](_0x2487c5['model'],_0x2487c5['query']);_0x1a6f03[_0x5c5e('0x3a')]=_[_0x5c5e('0x38')](_0x2487c5[_0x5c5e('0x35')],qs[_0x5c5e('0x39')](_0x1980a1[_0x5c5e('0x37')]['fields']));_0x1a6f03[_0x5c5e('0x3a')]=_0x1a6f03['attributes'][_0x5c5e('0x4c')]?_0x1a6f03[_0x5c5e('0x3a')]:_0x2487c5['model'];if(_0x1980a1['query'][_0x5c5e('0x45')]){_0x1a6f03[_0x5c5e('0x46')]=[{'all':!![]}];}_0x1a6f03=_[_0x5c5e('0x2a')]({},_0x1a6f03,_0x1980a1[_0x5c5e('0x44')]);return db[_0x5c5e('0x32')][_0x5c5e('0x4d')](_0x1a6f03)[_0x5c5e('0x23')](handleEntityNotFound(_0x480175,null))['then'](respondWithResult(_0x480175,null))[_0x5c5e('0x48')](handleError(_0x480175,null));};exports[_0x5c5e('0x4e')]=function(_0x4e2a9e,_0x108a40){return db[_0x5c5e('0x32')][_0x5c5e('0x4e')](_0x4e2a9e[_0x5c5e('0x2b')],{})[_0x5c5e('0x23')](respondWithResult(_0x108a40,0xc9))['catch'](handleError(_0x108a40,null));};exports[_0x5c5e('0x22')]=function(_0x150a04,_0x2e9047){if(_0x150a04[_0x5c5e('0x2b')]['id']){delete _0x150a04['body']['id'];}return db[_0x5c5e('0x32')]['find']({'where':{'id':_0x150a04[_0x5c5e('0x4a')]['id']}})[_0x5c5e('0x23')](handleEntityNotFound(_0x2e9047,null))[_0x5c5e('0x23')](saveUpdates(_0x150a04[_0x5c5e('0x2b')],null))[_0x5c5e('0x23')](respondWithResult(_0x2e9047,null))[_0x5c5e('0x48')](handleError(_0x2e9047,null));};exports[_0x5c5e('0x24')]=function(_0x338000,_0x3452ea){return db[_0x5c5e('0x32')]['find']({'where':{'id':_0x338000['params']['id']}})[_0x5c5e('0x23')](handleEntityNotFound(_0x3452ea,null))[_0x5c5e('0x23')](removeEntity(_0x3452ea,null))[_0x5c5e('0x48')](handleError(_0x3452ea,null));};exports[_0x5c5e('0x4f')]=function(_0x5bebb3,_0x40654a){return db[_0x5c5e('0x32')][_0x5c5e('0x4f')]()[_0x5c5e('0x23')](respondWithResult(_0x40654a,null))[_0x5c5e('0x48')](handleError(_0x40654a,null));}; \ No newline at end of file +var _0x9f43=['then','destroy','error','stack','name','render','merge','body','message','interaction','account','index','map','MailQueueReport','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','options','include','findAll','rows','catch','params','rawAttributes','includeAll','create','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0x9f43,0x16d));var _0x39f4=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x9f43[_0x1d1d09];return _0x8827e;};'use strict';var emlformat=require(_0x39f4('0x0'));var rimraf=require(_0x39f4('0x1'));var zipdir=require(_0x39f4('0x2'));var jsonpatch=require(_0x39f4('0x3'));var rp=require(_0x39f4('0x4'));var moment=require(_0x39f4('0x5'));var BPromise=require(_0x39f4('0x6'));var Mustache=require(_0x39f4('0x7'));var util=require(_0x39f4('0x8'));var path=require('path');var sox=require(_0x39f4('0x9'));var csv=require(_0x39f4('0xa'));var ejs=require(_0x39f4('0xb'));var fs=require('fs');var fs_extra=require(_0x39f4('0xc'));var _=require(_0x39f4('0xd'));var squel=require(_0x39f4('0xe'));var crypto=require(_0x39f4('0xf'));var jsforce=require(_0x39f4('0x10'));var deskjs=require(_0x39f4('0x11'));var toCsv=require(_0x39f4('0xa'));var querystring=require(_0x39f4('0x12'));var Papa=require('papaparse');var Redis=require(_0x39f4('0x13'));var authService=require(_0x39f4('0x14'));var qs=require(_0x39f4('0x15'));var as=require(_0x39f4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39f4('0x17'))('api');var utils=require(_0x39f4('0x18'));var config=require(_0x39f4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x354a74,_0xbd15f5){_0xbd15f5=_0xbd15f5||0xcc;return function(_0x4e2d6c){if(_0x4e2d6c){return _0x354a74[_0x39f4('0x1a')](_0xbd15f5);}return _0x354a74[_0x39f4('0x1b')](_0xbd15f5)[_0x39f4('0x1c')]();};}function respondWithResult(_0x5474b5,_0x375d57){_0x375d57=_0x375d57||0xc8;return function(_0x29c7bd){if(_0x29c7bd){return _0x5474b5[_0x39f4('0x1b')](_0x375d57)['json'](_0x29c7bd);}};}function respondWithFilteredResult(_0x246ce6,_0x3eaf1c){return function(_0x3e91ae){if(_0x3e91ae){var _0x317d91=typeof _0x3eaf1c[_0x39f4('0x1d')]===_0x39f4('0x1e')&&typeof _0x3eaf1c[_0x39f4('0x1f')]===_0x39f4('0x1e');var _0x13e2dd=_0x3e91ae[_0x39f4('0x20')];var _0x3a4c1e=_0x317d91?0x0:_0x3eaf1c[_0x39f4('0x1d')];var _0x1d51bf=_0x317d91?_0x3e91ae[_0x39f4('0x20')]:_0x3eaf1c[_0x39f4('0x1d')]+_0x3eaf1c[_0x39f4('0x1f')];var _0x39bb1b;if(_0x1d51bf>=_0x13e2dd){_0x1d51bf=_0x13e2dd;_0x39bb1b=0xc8;}else{_0x39bb1b=0xce;}_0x246ce6['status'](_0x39bb1b);return _0x246ce6[_0x39f4('0x21')](_0x39f4('0x22'),_0x3a4c1e+'-'+_0x1d51bf+'/'+_0x13e2dd)[_0x39f4('0x23')](_0x3e91ae);}return null;};}function patchUpdates(_0x19850a){return function(_0x5e3e6e){try{jsonpatch[_0x39f4('0x24')](_0x5e3e6e,_0x19850a,!![]);}catch(_0x1bc60d){return BPromise[_0x39f4('0x25')](_0x1bc60d);}return _0x5e3e6e[_0x39f4('0x26')]();};}function saveUpdates(_0x399b24,_0x593a38){return function(_0x4a6315){if(_0x4a6315){return _0x4a6315[_0x39f4('0x27')](_0x399b24)[_0x39f4('0x28')](function(_0x5aa875){return _0x5aa875;});}return null;};}function removeEntity(_0x585309,_0x436768){return function(_0x25d2ae){if(_0x25d2ae){return _0x25d2ae[_0x39f4('0x29')]()['then'](function(){_0x585309[_0x39f4('0x1b')](0xcc)[_0x39f4('0x1c')]();});}};}function handleEntityNotFound(_0x100aff,_0x250630){return function(_0x31f4d6){if(!_0x31f4d6){_0x100aff[_0x39f4('0x1a')](0x194);}return _0x31f4d6;};}function handleError(_0x4e9434,_0x2c6fa3){_0x2c6fa3=_0x2c6fa3||0x1f4;return function(_0x534450){logger[_0x39f4('0x2a')](_0x534450[_0x39f4('0x2b')]);if(_0x534450[_0x39f4('0x2c')]){delete _0x534450[_0x39f4('0x2c')];}_0x4e9434['status'](_0x2c6fa3)['send'](_0x534450);};}function getMustacheRender(_0x34051a,_0x10f484){return Mustache[_0x39f4('0x2d')](_0x34051a,_[_0x39f4('0x2e')](_0x10f484[_0x39f4('0x2f')],{'contact':_0x10f484['contact'],'message':_0x10f484[_0x39f4('0x30')],'agent':_0x10f484['agent'],'interaction':_0x10f484[_0x39f4('0x31')],'account':_0x10f484[_0x39f4('0x32')]}))||'';}exports[_0x39f4('0x33')]=function(_0x9fcd4f,_0x4d83b8){var _0x21c299={},_0x3c647e={},_0x5c0521={'count':0x0,'rows':[]};var _0x5c398d=_[_0x39f4('0x34')](db[_0x39f4('0x35')]['rawAttributes'],function(_0x4ed9c0){return{'name':_0x4ed9c0[_0x39f4('0x36')],'type':_0x4ed9c0[_0x39f4('0x37')]['key']};});_0x3c647e['model']=_['map'](_0x5c398d,_0x39f4('0x2c'));_0x3c647e[_0x39f4('0x38')]=_[_0x39f4('0x39')](_0x9fcd4f[_0x39f4('0x38')]);_0x3c647e[_0x39f4('0x3a')]=_['intersection'](_0x3c647e[_0x39f4('0x3b')],_0x3c647e[_0x39f4('0x38')]);_0x21c299[_0x39f4('0x3c')]=_[_0x39f4('0x3d')](_0x3c647e[_0x39f4('0x3b')],qs[_0x39f4('0x3e')](_0x9fcd4f['query'][_0x39f4('0x3e')]));_0x21c299[_0x39f4('0x3c')]=_0x21c299[_0x39f4('0x3c')][_0x39f4('0x3f')]?_0x21c299[_0x39f4('0x3c')]:_0x3c647e[_0x39f4('0x3b')];if(!_0x9fcd4f[_0x39f4('0x38')][_0x39f4('0x40')](_0x39f4('0x41'))){_0x21c299[_0x39f4('0x1f')]=qs[_0x39f4('0x1f')](_0x9fcd4f[_0x39f4('0x38')]['limit']);_0x21c299[_0x39f4('0x1d')]=qs[_0x39f4('0x1d')](_0x9fcd4f[_0x39f4('0x38')]['offset']);}_0x21c299['order']=qs[_0x39f4('0x42')](_0x9fcd4f[_0x39f4('0x38')][_0x39f4('0x42')]);_0x21c299['where']=qs[_0x39f4('0x3a')](_[_0x39f4('0x43')](_0x9fcd4f[_0x39f4('0x38')],_0x3c647e['filters']),_0x5c398d);if(_0x9fcd4f[_0x39f4('0x38')][_0x39f4('0x44')]){_0x21c299[_0x39f4('0x45')]=_[_0x39f4('0x2e')](_0x21c299[_0x39f4('0x45')],{'$or':_[_0x39f4('0x34')](_0x5c398d,function(_0x16e0ef){if(_0x16e0ef[_0x39f4('0x37')]!=='VIRTUAL'){var _0x436d90={};_0x436d90[_0x16e0ef[_0x39f4('0x2c')]]={'$like':'%'+_0x9fcd4f[_0x39f4('0x38')]['filter']+'%'};return _0x436d90;}})});}_0x21c299=_[_0x39f4('0x2e')]({},_0x21c299,_0x9fcd4f[_0x39f4('0x46')]);var _0x515c1={'where':_0x21c299['where']};return db[_0x39f4('0x35')][_0x39f4('0x20')](_0x515c1)[_0x39f4('0x28')](function(_0x1d8a24){_0x5c0521[_0x39f4('0x20')]=_0x1d8a24;if(_0x9fcd4f[_0x39f4('0x38')]['includeAll']){_0x21c299[_0x39f4('0x47')]=[{'all':!![]}];}return db[_0x39f4('0x35')][_0x39f4('0x48')](_0x21c299);})[_0x39f4('0x28')](function(_0x4f612a){_0x5c0521[_0x39f4('0x49')]=_0x4f612a;return _0x5c0521;})['then'](respondWithFilteredResult(_0x4d83b8,_0x21c299))[_0x39f4('0x4a')](handleError(_0x4d83b8,null));};exports['show']=function(_0x4841d9,_0x4cd1c){var _0x2b1333={'raw':!![],'where':{'id':_0x4841d9[_0x39f4('0x4b')]['id']}},_0x2be26e={};_0x2be26e[_0x39f4('0x3b')]=_['keys'](db[_0x39f4('0x35')][_0x39f4('0x4c')]);_0x2be26e[_0x39f4('0x38')]=_[_0x39f4('0x39')](_0x4841d9['query']);_0x2be26e[_0x39f4('0x3a')]=_[_0x39f4('0x3d')](_0x2be26e[_0x39f4('0x3b')],_0x2be26e[_0x39f4('0x38')]);_0x2b1333[_0x39f4('0x3c')]=_[_0x39f4('0x3d')](_0x2be26e['model'],qs['fields'](_0x4841d9[_0x39f4('0x38')][_0x39f4('0x3e')]));_0x2b1333['attributes']=_0x2b1333[_0x39f4('0x3c')][_0x39f4('0x3f')]?_0x2b1333[_0x39f4('0x3c')]:_0x2be26e[_0x39f4('0x3b')];if(_0x4841d9['query'][_0x39f4('0x4d')]){_0x2b1333['include']=[{'all':!![]}];}_0x2b1333=_['merge']({},_0x2b1333,_0x4841d9[_0x39f4('0x46')]);return db[_0x39f4('0x35')]['find'](_0x2b1333)[_0x39f4('0x28')](handleEntityNotFound(_0x4cd1c,null))[_0x39f4('0x28')](respondWithResult(_0x4cd1c,null))[_0x39f4('0x4a')](handleError(_0x4cd1c,null));};exports['create']=function(_0x254acf,_0x172e7b){return db[_0x39f4('0x35')][_0x39f4('0x4e')](_0x254acf[_0x39f4('0x2f')],{})['then'](respondWithResult(_0x172e7b,0xc9))[_0x39f4('0x4a')](handleError(_0x172e7b,null));};exports['update']=function(_0x53e179,_0x252ffa){if(_0x53e179[_0x39f4('0x2f')]['id']){delete _0x53e179[_0x39f4('0x2f')]['id'];}return db[_0x39f4('0x35')][_0x39f4('0x4f')]({'where':{'id':_0x53e179[_0x39f4('0x4b')]['id']}})[_0x39f4('0x28')](handleEntityNotFound(_0x252ffa,null))['then'](saveUpdates(_0x53e179['body'],null))[_0x39f4('0x28')](respondWithResult(_0x252ffa,null))[_0x39f4('0x4a')](handleError(_0x252ffa,null));};exports[_0x39f4('0x29')]=function(_0x35cce0,_0x5588f7){return db['MailQueueReport'][_0x39f4('0x4f')]({'where':{'id':_0x35cce0['params']['id']}})['then'](handleEntityNotFound(_0x5588f7,null))[_0x39f4('0x28')](removeEntity(_0x5588f7,null))[_0x39f4('0x4a')](handleError(_0x5588f7,null));};exports[_0x39f4('0x50')]=function(_0x43238,_0x194b3a){return db[_0x39f4('0x35')][_0x39f4('0x50')]()[_0x39f4('0x28')](respondWithResult(_0x194b3a,null))['catch'](handleError(_0x194b3a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0fb903b..7daa3ea 100644 --- a/server/api/mailQueueReport/mailQueueReport.model.js +++ b/server/api/mailQueueReport/mailQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63f6=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid'];(function(_0x3576f4,_0x26ebb1){var _0x2251dd=function(_0x556a76){while(--_0x556a76){_0x3576f4['push'](_0x3576f4['shift']());}};_0x2251dd(++_0x26ebb1);}(_0x63f6,0xf7));var _0x663f=function(_0x15ad02,_0x56ace9){_0x15ad02=_0x15ad02-0x0;var _0x3c87da=_0x63f6[_0x15ad02];return _0x3c87da;};'use strict';var _=require('lodash');var util=require(_0x663f('0x0'));var logger=require(_0x663f('0x1'))(_0x663f('0x2'));var moment=require(_0x663f('0x3'));var BPromise=require(_0x663f('0x4'));var rp=require(_0x663f('0x5'));var fs=require('fs');var path=require(_0x663f('0x6'));var rimraf=require('rimraf');var config=require(_0x663f('0x7'));var attributes=require(_0x663f('0x8'));module[_0x663f('0x9')]=function(_0x107530,_0x215be6){return _0x107530[_0x663f('0xa')](_0x663f('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x663f('0xc'),'fields':[_0x663f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd93c=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','define'];(function(_0x2330a1,_0x4bb8d3){var _0x32c0a6=function(_0xba8ada){while(--_0xba8ada){_0x2330a1['push'](_0x2330a1['shift']());}};_0x32c0a6(++_0x4bb8d3);}(_0xd93c,0x1bd));var _0xcd93=function(_0x4e4b4f,_0x5e8221){_0x4e4b4f=_0x4e4b4f-0x0;var _0x369ba1=_0xd93c[_0x4e4b4f];return _0x369ba1;};'use strict';var _=require(_0xcd93('0x0'));var util=require(_0xcd93('0x1'));var logger=require(_0xcd93('0x2'))(_0xcd93('0x3'));var moment=require('moment');var BPromise=require(_0xcd93('0x4'));var rp=require(_0xcd93('0x5'));var fs=require('fs');var path=require(_0xcd93('0x6'));var rimraf=require(_0xcd93('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd93('0x8'));module['exports']=function(_0x5c5738,_0x28c60d){return _0x5c5738[_0xcd93('0x9')](_0xcd93('0xa'),attributes,{'tableName':_0xcd93('0xb'),'paranoid':![],'indexes':[{'name':_0xcd93('0xc'),'fields':[_0xcd93('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7c6a246..a15c9b7 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa81=['result','CreateMailQueueReport','MailQueueReport','create','body','options','UpdateMailQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x29fd93,_0x6a1557){var _0x27ff96=function(_0x551d7a){while(--_0x551d7a){_0x29fd93['push'](_0x29fd93['shift']());}};_0x27ff96(++_0x6a1557);}(_0xaa81,0x1d3));var _0x1aa8=function(_0x42a59f,_0x57944d){_0x42a59f=_0x42a59f-0x0;var _0x2cc836=_0xaa81[_0x42a59f];return _0x2cc836;};'use strict';var _=require(_0x1aa8('0x0'));var util=require(_0x1aa8('0x1'));var moment=require(_0x1aa8('0x2'));var BPromise=require(_0x1aa8('0x3'));var rs=require(_0x1aa8('0x4'));var fs=require('fs');var Redis=require(_0x1aa8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1aa8('0x6'));var logger=require(_0x1aa8('0x7'))(_0x1aa8('0x8'));var config=require(_0x1aa8('0x9'));var jayson=require(_0x1aa8('0xa'));var client=jayson[_0x1aa8('0xb')][_0x1aa8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33f83c,_0x3e2230,_0x2ff39a){return new BPromise(function(_0x36d5d6,_0x425355){return client[_0x1aa8('0xd')](_0x33f83c,_0x2ff39a)[_0x1aa8('0xe')](function(_0x16597e){logger[_0x1aa8('0xf')](_0x1aa8('0x10'),_0x3e2230,'request\x20sent');logger[_0x1aa8('0x11')](_0x1aa8('0x12'),_0x3e2230,_0x1aa8('0x13'),JSON[_0x1aa8('0x14')](_0x16597e));if(_0x16597e[_0x1aa8('0x15')]){if(_0x16597e[_0x1aa8('0x15')]['code']===0x1f4){logger[_0x1aa8('0x15')]('MailQueueReport,\x20%s,\x20%s',_0x3e2230,_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);return _0x425355(_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);}logger['error'](_0x1aa8('0x10'),_0x3e2230,_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);return _0x36d5d6(_0x16597e[_0x1aa8('0x15')][_0x1aa8('0x16')]);}else{logger[_0x1aa8('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3e2230,_0x1aa8('0x13'));_0x36d5d6(_0x16597e[_0x1aa8('0x17')][_0x1aa8('0x16')]);}})['catch'](function(_0x47f9ad){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x3e2230,_0x47f9ad);_0x425355(_0x47f9ad);});});}exports[_0x1aa8('0x18')]=function(_0x2984db){var _0x2b8777=this;return new Promise(function(_0x1fac82,_0x77a30d){return db[_0x1aa8('0x19')][_0x1aa8('0x1a')](_0x2984db[_0x1aa8('0x1b')],{'raw':_0x2984db[_0x1aa8('0x1c')]?_0x2984db[_0x1aa8('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x1aa8('0xe')](function(_0x506ae1){logger[_0x1aa8('0xf')]('CreateMailQueueReport',_0x2984db);logger[_0x1aa8('0x11')]('CreateMailQueueReport',_0x2984db,JSON[_0x1aa8('0x14')](_0x506ae1));_0x1fac82(_0x506ae1);})['catch'](function(_0x3178f3){logger[_0x1aa8('0x15')](_0x1aa8('0x18'),_0x3178f3['message'],_0x2984db);_0x77a30d(_0x2b8777[_0x1aa8('0x15')](0x1f4,_0x3178f3[_0x1aa8('0x16')]));});});};exports[_0x1aa8('0x1d')]=function(_0x28fa58){var _0x37383c=this;return new Promise(function(_0x573195,_0x57edf3){return db[_0x1aa8('0x19')][_0x1aa8('0x1e')](_0x28fa58[_0x1aa8('0x1b')],{'raw':_0x28fa58['options']?_0x28fa58['options'][_0x1aa8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fa58['options']?_0x28fa58[_0x1aa8('0x1c')][_0x1aa8('0x20')]||null:null,'attributes':_0x28fa58[_0x1aa8('0x1c')]?_0x28fa58[_0x1aa8('0x1c')][_0x1aa8('0x21')]||null:null,'limit':_0x28fa58['options']?_0x28fa58[_0x1aa8('0x1c')][_0x1aa8('0x22')]||null:null})[_0x1aa8('0xe')](function(_0x3ae92f){logger[_0x1aa8('0xf')](_0x1aa8('0x1d'),_0x28fa58);logger[_0x1aa8('0x11')]('UpdateMailQueueReport',_0x28fa58,JSON['stringify'](_0x3ae92f));_0x573195(_0x3ae92f);})['catch'](function(_0x933f4){logger[_0x1aa8('0x15')](_0x1aa8('0x1d'),_0x933f4[_0x1aa8('0x16')],_0x28fa58);_0x57edf3(_0x37383c['error'](0x1f4,_0x933f4[_0x1aa8('0x16')]));});});}; \ No newline at end of file +var _0x1469=['request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','create','body','options','raw','debug','catch','UpdateMailQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2ae8ad,_0x866fbf){var _0x4bfdd7=function(_0x2a026f){while(--_0x2a026f){_0x2ae8ad['push'](_0x2ae8ad['shift']());}};_0x4bfdd7(++_0x866fbf);}(_0x1469,0xef));var _0x9146=function(_0x40839c,_0x144e87){_0x40839c=_0x40839c-0x0;var _0x35db13=_0x1469[_0x40839c];return _0x35db13;};'use strict';var _=require(_0x9146('0x0'));var util=require(_0x9146('0x1'));var moment=require(_0x9146('0x2'));var BPromise=require(_0x9146('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9146('0x4'));var db=require(_0x9146('0x5'))['db'];var utils=require(_0x9146('0x6'));var logger=require(_0x9146('0x7'))(_0x9146('0x8'));var config=require(_0x9146('0x9'));var jayson=require(_0x9146('0xa'));var client=jayson[_0x9146('0xb')][_0x9146('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x306264,_0x469547,_0x11e604){return new BPromise(function(_0x58336d,_0x20b7a6){return client[_0x9146('0xd')](_0x306264,_0x11e604)[_0x9146('0xe')](function(_0x1083e5){logger[_0x9146('0xf')](_0x9146('0x10'),_0x469547,'request\x20sent');logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x469547,_0x9146('0x11'),JSON[_0x9146('0x12')](_0x1083e5));if(_0x1083e5['error']){if(_0x1083e5[_0x9146('0x13')][_0x9146('0x14')]===0x1f4){logger['error'](_0x9146('0x10'),_0x469547,_0x1083e5[_0x9146('0x13')][_0x9146('0x15')]);return _0x20b7a6(_0x1083e5[_0x9146('0x13')]['message']);}logger['error'](_0x9146('0x10'),_0x469547,_0x1083e5[_0x9146('0x13')][_0x9146('0x15')]);return _0x58336d(_0x1083e5[_0x9146('0x13')][_0x9146('0x15')]);}else{logger[_0x9146('0xf')](_0x9146('0x10'),_0x469547,_0x9146('0x11'));_0x58336d(_0x1083e5[_0x9146('0x16')]['message']);}})['catch'](function(_0xb1b3dc){logger[_0x9146('0x13')](_0x9146('0x10'),_0x469547,_0xb1b3dc);_0x20b7a6(_0xb1b3dc);});});}exports[_0x9146('0x17')]=function(_0x15b26a){var _0x5960a4=this;return new Promise(function(_0x488c36,_0x18e93d){return db[_0x9146('0x18')][_0x9146('0x19')](_0x15b26a[_0x9146('0x1a')],{'raw':_0x15b26a[_0x9146('0x1b')]?_0x15b26a[_0x9146('0x1b')][_0x9146('0x1c')]===undefined?!![]:![]:!![]})[_0x9146('0xe')](function(_0x29eaf8){logger['info']('CreateMailQueueReport',_0x15b26a);logger[_0x9146('0x1d')]('CreateMailQueueReport',_0x15b26a,JSON[_0x9146('0x12')](_0x29eaf8));_0x488c36(_0x29eaf8);})[_0x9146('0x1e')](function(_0xf75ee){logger['error']('CreateMailQueueReport',_0xf75ee[_0x9146('0x15')],_0x15b26a);_0x18e93d(_0x5960a4['error'](0x1f4,_0xf75ee[_0x9146('0x15')]));});});};exports[_0x9146('0x1f')]=function(_0x37a697){var _0x23ceea=this;return new Promise(function(_0x3b5ede,_0x421f39){return db[_0x9146('0x18')][_0x9146('0x20')](_0x37a697[_0x9146('0x1a')],{'raw':_0x37a697[_0x9146('0x1b')]?_0x37a697[_0x9146('0x1b')][_0x9146('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37a697['options']?_0x37a697[_0x9146('0x1b')][_0x9146('0x21')]||null:null,'attributes':_0x37a697[_0x9146('0x1b')]?_0x37a697[_0x9146('0x1b')][_0x9146('0x22')]||null:null,'limit':_0x37a697[_0x9146('0x1b')]?_0x37a697['options'][_0x9146('0x23')]||null:null})['then'](function(_0x40cd85){logger[_0x9146('0xf')](_0x9146('0x1f'),_0x37a697);logger[_0x9146('0x1d')]('UpdateMailQueueReport',_0x37a697,JSON[_0x9146('0x12')](_0x40cd85));_0x3b5ede(_0x40cd85);})[_0x9146('0x1e')](function(_0x29513c){logger[_0x9146('0x13')](_0x9146('0x1f'),_0x29513c['message'],_0x37a697);_0x421f39(_0x23ceea[_0x9146('0x13')](0x1f4,_0x29513c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9ade637..46a4724 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x138d=['fs-extra','../../components/auth/service','../../components/interaction/service','exports','multer','util','connect-timeout','express','Router'];(function(_0x2f8d2c,_0x223b81){var _0x3fa002=function(_0x114987){while(--_0x114987){_0x2f8d2c['push'](_0x2f8d2c['shift']());}};_0x3fa002(++_0x223b81);}(_0x138d,0x1ab));var _0xd138=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x138d[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var path=require('path');var timeout=require(_0xd138('0x2'));var express=require(_0xd138('0x3'));var router=express[_0xd138('0x4')]();var fs_extra=require(_0xd138('0x5'));var auth=require(_0xd138('0x6'));var interaction=require(_0xd138('0x7'));var config=require('../../config/environment');module[_0xd138('0x8')]=router; \ No newline at end of file +var _0xfb5d=['connect-timeout','Router','multer','util','path'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xdfb5('0x0'));var util=require(_0xdfb5('0x1'));var path=require(_0xdfb5('0x2'));var timeout=require(_0xdfb5('0x3'));var express=require('express');var router=express[_0xdfb5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b7c41e7..f6f0183 100644 --- a/server/api/mailServerIn/mailServerIn.attributes.js +++ b/server/api/mailServerIn/mailServerIn.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafb8=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x204ce5,_0x46fb75){var _0x4f5a44=function(_0x55e0ac){while(--_0x55e0ac){_0x204ce5['push'](_0x204ce5['shift']());}};_0x4f5a44(++_0x46fb75);}(_0xafb8,0xa1));var _0x8afb=function(_0x5abce5,_0x453440){_0x5abce5=_0x5abce5-0x0;var _0x239c65=_0xafb8[_0x5abce5];return _0x239c65;};'use strict';var Sequelize=require(_0x8afb('0x0'));module[_0x8afb('0x1')]={'description':{'type':Sequelize[_0x8afb('0x2')]},'host':{'type':Sequelize[_0x8afb('0x2')]},'authentication':{'type':Sequelize[_0x8afb('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8afb('0x2')]},'password':{'type':Sequelize[_0x8afb('0x2')]},'port':{'type':Sequelize[_0x8afb('0x4')]},'tls':{'type':Sequelize[_0x8afb('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8afb('0x2')],'defaultValue':_0x8afb('0x5')},'connTimeout':{'type':Sequelize[_0x8afb('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x8afb('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x8afb('0x2')]}}; \ No newline at end of file +var _0x58d1=['STRING','BOOLEAN','INBOX','INTEGER','sequelize'];(function(_0x233ee8,_0x42b304){var _0x3266fa=function(_0x184a7f){while(--_0x184a7f){_0x233ee8['push'](_0x233ee8['shift']());}};_0x3266fa(++_0x42b304);}(_0x58d1,0x121));var _0x158d=function(_0x71c2ac,_0x32eb1f){_0x71c2ac=_0x71c2ac-0x0;var _0x47582e=_0x58d1[_0x71c2ac];return _0x47582e;};'use strict';var Sequelize=require(_0x158d('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x158d('0x1')]},'authentication':{'type':Sequelize[_0x158d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x158d('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x158d('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x158d('0x1')],'defaultValue':_0x158d('0x3')},'connTimeout':{'type':Sequelize[_0x158d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x158d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x158d('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index ca85a7e..739f9fb 100644 --- a/server/api/mailServerIn/mailServerIn.model.js +++ b/server/api/mailServerIn/mailServerIn.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x28e27c,_0x2216ff){var _0x45ae93=function(_0x15f539){while(--_0x15f539){_0x28e27c['push'](_0x28e27c['shift']());}};_0x45ae93(++_0x2216ff);}(_0x96cc,0x16c));var _0xc96c=function(_0x2c9332,_0x745b0c){_0x2c9332=_0x2c9332-0x0;var _0x4a14a9=_0x96cc[_0x2c9332];return _0x4a14a9;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var logger=require(_0xc96c('0x1'))('api');var moment=require(_0xc96c('0x2'));var BPromise=require(_0xc96c('0x3'));var rp=require(_0xc96c('0x4'));var fs=require('fs');var path=require(_0xc96c('0x5'));var rimraf=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var attributes=require(_0xc96c('0x8'));module[_0xc96c('0x9')]=function(_0x3b7f45,_0x5142cd){return _0x3b7f45[_0xc96c('0xa')](_0xc96c('0xb'),attributes,{'tableName':_0xc96c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x955f=['mail_servers_in','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','MailServerIn'];(function(_0x305685,_0x5e0a00){var _0x507e7a=function(_0x275ccd){while(--_0x275ccd){_0x305685['push'](_0x305685['shift']());}};_0x507e7a(++_0x5e0a00);}(_0x955f,0x1eb));var _0xf955=function(_0x1d92cd,_0x340aa1){_0x1d92cd=_0x1d92cd-0x0;var _0x363564=_0x955f[_0x1d92cd];return _0x363564;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./mailServerIn.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 430a1b8..f4de4ea 100644 --- a/server/api/mailServerIn/mailServerIn.rpc.js +++ b/server/api/mailServerIn/mailServerIn.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9dee=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetMailServerIn','MailServerIn','findAll','options','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x7a2c83,_0x18b9ac){var _0x2f1532=function(_0x50749b){while(--_0x50749b){_0x7a2c83['push'](_0x7a2c83['shift']());}};_0x2f1532(++_0x18b9ac);}(_0x9dee,0x17b));var _0xe9de=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x9dee[_0x34eb31];return _0x254994;};'use strict';var _=require(_0xe9de('0x0'));var util=require(_0xe9de('0x1'));var moment=require(_0xe9de('0x2'));var BPromise=require(_0xe9de('0x3'));var rs=require(_0xe9de('0x4'));var fs=require('fs');var Redis=require(_0xe9de('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9de('0x6'));var logger=require(_0xe9de('0x7'))(_0xe9de('0x8'));var config=require(_0xe9de('0x9'));var jayson=require(_0xe9de('0xa'));var client=jayson[_0xe9de('0xb')][_0xe9de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c370b,_0x70d60d,_0x5e8d38){return new BPromise(function(_0xc2cfc6,_0x1de592){return client['request'](_0x5c370b,_0x5e8d38)[_0xe9de('0xd')](function(_0x47a1da){logger[_0xe9de('0xe')](_0xe9de('0xf'),_0x70d60d,_0xe9de('0x10'));logger[_0xe9de('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x70d60d,_0xe9de('0x10'),JSON[_0xe9de('0x12')](_0x47a1da));if(_0x47a1da[_0xe9de('0x13')]){if(_0x47a1da[_0xe9de('0x13')][_0xe9de('0x14')]===0x1f4){logger[_0xe9de('0x13')](_0xe9de('0xf'),_0x70d60d,_0x47a1da['error'][_0xe9de('0x15')]);return _0x1de592(_0x47a1da[_0xe9de('0x13')][_0xe9de('0x15')]);}logger[_0xe9de('0x13')](_0xe9de('0xf'),_0x70d60d,_0x47a1da[_0xe9de('0x13')][_0xe9de('0x15')]);return _0xc2cfc6(_0x47a1da[_0xe9de('0x13')][_0xe9de('0x15')]);}else{logger[_0xe9de('0xe')](_0xe9de('0xf'),_0x70d60d,_0xe9de('0x10'));_0xc2cfc6(_0x47a1da['result'][_0xe9de('0x15')]);}})['catch'](function(_0x3ba89a){logger[_0xe9de('0x13')](_0xe9de('0xf'),_0x70d60d,_0x3ba89a);_0x1de592(_0x3ba89a);});});}exports[_0xe9de('0x16')]=function(_0x20f21f){var _0x173a3f=this;return new Promise(function(_0x583b9,_0x3f4376){return db[_0xe9de('0x17')][_0xe9de('0x18')]({'raw':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')][_0xe9de('0x1a')]||null:null,'attributes':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')]['attributes']||null:null,'limit':_0x20f21f[_0xe9de('0x19')]?_0x20f21f[_0xe9de('0x19')]['limit']||null:null,'include':_0x20f21f[_0xe9de('0x19')]?_0x20f21f['options'][_0xe9de('0x1b')]?_[_0xe9de('0x1c')](_0x20f21f['options'][_0xe9de('0x1b')],function(_0x69c680){return{'model':db[_0x69c680[_0xe9de('0x1d')]],'as':_0x69c680['as'],'attributes':_0x69c680[_0xe9de('0x1e')],'include':_0x69c680[_0xe9de('0x1b')]?_['map'](_0x69c680[_0xe9de('0x1b')],function(_0x587ad4){return{'model':db[_0x587ad4[_0xe9de('0x1d')]],'as':_0x587ad4['as'],'attributes':_0x587ad4[_0xe9de('0x1e')],'include':_0x587ad4[_0xe9de('0x1b')]?_[_0xe9de('0x1c')](_0x587ad4[_0xe9de('0x1b')],function(_0x13aa53){return{'model':db[_0x13aa53[_0xe9de('0x1d')]],'as':_0x13aa53['as'],'attributes':_0x13aa53[_0xe9de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe9de('0xd')](function(_0x2d3298){logger[_0xe9de('0xe')](_0xe9de('0x16'),_0x20f21f);logger[_0xe9de('0x11')](_0xe9de('0x16'),_0x20f21f,JSON[_0xe9de('0x12')](_0x2d3298));_0x583b9(_0x2d3298);})[_0xe9de('0x1f')](function(_0x33cb79){logger[_0xe9de('0x13')]('GetMailServerIn',_0x33cb79['message'],_0x20f21f);_0x3f4376(_0x173a3f[_0xe9de('0x13')](0x1f4,_0x33cb79[_0xe9de('0x15')]));});});}; \ No newline at end of file +var _0x5610=['attributes','then','catch','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model'];(function(_0x419391,_0x3b3577){var _0x476f56=function(_0x558f02){while(--_0x558f02){_0x419391['push'](_0x419391['shift']());}};_0x476f56(++_0x3b3577);}(_0x5610,0x139));var _0x0561=function(_0x1e89a2,_0x3e0802){_0x1e89a2=_0x1e89a2-0x0;var _0x138787=_0x5610[_0x1e89a2];return _0x138787;};'use strict';var _=require('lodash');var util=require(_0x0561('0x0'));var moment=require(_0x0561('0x1'));var BPromise=require('bluebird');var rs=require(_0x0561('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0561('0x3'));var logger=require('../../config/logger')(_0x0561('0x4'));var config=require(_0x0561('0x5'));var jayson=require(_0x0561('0x6'));var client=jayson[_0x0561('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b4d4e,_0x480528,_0xdb4991){return new BPromise(function(_0x305244,_0x3d603f){return client[_0x0561('0x8')](_0x1b4d4e,_0xdb4991)['then'](function(_0x4fc0c5){logger[_0x0561('0x9')]('MailServerIn,\x20%s,\x20%s',_0x480528,_0x0561('0xa'));logger[_0x0561('0xb')](_0x0561('0xc'),_0x480528,_0x0561('0xa'),JSON[_0x0561('0xd')](_0x4fc0c5));if(_0x4fc0c5[_0x0561('0xe')]){if(_0x4fc0c5['error']['code']===0x1f4){logger[_0x0561('0xe')](_0x0561('0xf'),_0x480528,_0x4fc0c5[_0x0561('0xe')][_0x0561('0x10')]);return _0x3d603f(_0x4fc0c5[_0x0561('0xe')]['message']);}logger['error'](_0x0561('0xf'),_0x480528,_0x4fc0c5[_0x0561('0xe')][_0x0561('0x10')]);return _0x305244(_0x4fc0c5[_0x0561('0xe')][_0x0561('0x10')]);}else{logger[_0x0561('0x9')](_0x0561('0xf'),_0x480528,_0x0561('0xa'));_0x305244(_0x4fc0c5[_0x0561('0x11')]['message']);}})['catch'](function(_0x408504){logger[_0x0561('0xe')](_0x0561('0xf'),_0x480528,_0x408504);_0x3d603f(_0x408504);});});}exports[_0x0561('0x12')]=function(_0x3c42da){var _0x56002d=this;return new Promise(function(_0x44d009,_0x1660a7){return db[_0x0561('0x13')][_0x0561('0x14')]({'raw':_0x3c42da[_0x0561('0x15')]?_0x3c42da[_0x0561('0x15')][_0x0561('0x16')]===undefined?!![]:![]:!![],'where':_0x3c42da['options']?_0x3c42da[_0x0561('0x15')][_0x0561('0x17')]||null:null,'attributes':_0x3c42da[_0x0561('0x15')]?_0x3c42da['options']['attributes']||null:null,'limit':_0x3c42da['options']?_0x3c42da[_0x0561('0x15')][_0x0561('0x18')]||null:null,'include':_0x3c42da[_0x0561('0x15')]?_0x3c42da[_0x0561('0x15')][_0x0561('0x19')]?_[_0x0561('0x1a')](_0x3c42da['options']['include'],function(_0x261e48){return{'model':db[_0x261e48[_0x0561('0x1b')]],'as':_0x261e48['as'],'attributes':_0x261e48[_0x0561('0x1c')],'include':_0x261e48[_0x0561('0x19')]?_[_0x0561('0x1a')](_0x261e48[_0x0561('0x19')],function(_0x14969f){return{'model':db[_0x14969f[_0x0561('0x1b')]],'as':_0x14969f['as'],'attributes':_0x14969f[_0x0561('0x1c')],'include':_0x14969f['include']?_['map'](_0x14969f[_0x0561('0x19')],function(_0x33070e){return{'model':db[_0x33070e[_0x0561('0x1b')]],'as':_0x33070e['as'],'attributes':_0x33070e[_0x0561('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0561('0x1d')](function(_0xf301b4){logger[_0x0561('0x9')](_0x0561('0x12'),_0x3c42da);logger['debug'](_0x0561('0x12'),_0x3c42da,JSON[_0x0561('0xd')](_0xf301b4));_0x44d009(_0xf301b4);})[_0x0561('0x1e')](function(_0x8eb066){logger[_0x0561('0xe')](_0x0561('0x12'),_0x8eb066[_0x0561('0x10')],_0x3c42da);_0x1660a7(_0x56002d[_0x0561('0xe')](0x1f4,_0x8eb066['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index cbf6913..d4481c0 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','index','get','/:id','show','isAuthenticated','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4c844d,_0x3ac798){var _0x38488a=function(_0x3699ad){while(--_0x3699ad){_0x4c844d['push'](_0x4c844d['shift']());}};_0x38488a(++_0x3ac798);}(_0x54ef,0x112));var _0xf54e=function(_0x38e682,_0x221532){_0x38e682=_0x38e682-0x0;var _0x23b013=_0x54ef[_0x38e682];return _0x23b013;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['post']('/',auth[_0xf54e('0xe')](),controller[_0xf54e('0xf')]);router['put'](_0xf54e('0xc'),auth[_0xf54e('0xe')](),controller[_0xf54e('0x10')]);router[_0xf54e('0x11')]('/:id',auth[_0xf54e('0xe')](),controller[_0xf54e('0x12')]);module[_0xf54e('0x13')]=router; \ No newline at end of file +var _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','update','destroy','util','connect-timeout','express'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0a9a,0x183));var _0xa0a9=function(_0x41f8b9,_0x466eb4){_0x41f8b9=_0x41f8b9-0x0;var _0x17902c=_0x0a9a[_0x41f8b9];return _0x17902c;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./mailServerOut.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/:id',auth[_0xa0a9('0x8')](),controller['show']);router[_0xa0a9('0xa')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router[_0xa0a9('0xc')]('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 11306fd..b6c60f2 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c23=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x2f1f9a,_0x34af3f){var _0x447e08=function(_0x3e4a39){while(--_0x3e4a39){_0x2f1f9a['push'](_0x2f1f9a['shift']());}};_0x447e08(++_0x34af3f);}(_0x0c23,0x13e));var _0x30c2=function(_0x3bd823,_0x1918c0){_0x3bd823=_0x3bd823-0x0;var _0x363660=_0x0c23[_0x3bd823];return _0x363660;};'use strict';var Sequelize=require(_0x30c2('0x0'));module[_0x30c2('0x1')]={'description':{'type':Sequelize[_0x30c2('0x2')]},'host':{'type':Sequelize[_0x30c2('0x2')]},'user':{'type':Sequelize[_0x30c2('0x2')]},'pass':{'type':Sequelize[_0x30c2('0x2')]},'port':{'type':Sequelize[_0x30c2('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x30c2('0x2')]},'authentication':{'type':Sequelize[_0x30c2('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9576=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9576,0x182));var _0x6957=function(_0x4b2b25,_0x393521){_0x4b2b25=_0x4b2b25-0x0;var _0x211f19=_0x9576[_0x4b2b25];return _0x211f19;};'use strict';var Sequelize=require(_0x6957('0x0'));module[_0x6957('0x1')]={'description':{'type':Sequelize[_0x6957('0x2')]},'host':{'type':Sequelize[_0x6957('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6957('0x3')]},'secure':{'type':Sequelize[_0x6957('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x6957('0x2')]},'authentication':{'type':Sequelize[_0x6957('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index a20ff45..3ab5f27 100644 --- a/server/api/mailServerOut/mailServerOut.controller.js +++ b/server/api/mailServerOut/mailServerOut.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb'];(function(_0x287a45,_0x428a6e){var _0x347ad4=function(_0x3d93d4){while(--_0x3d93d4){_0x287a45['push'](_0x287a45['shift']());}};_0x347ad4(++_0x428a6e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}function getMustacheRender(_0x34dc65,_0x25fba9){return Mustache[_0x0a9e('0x27')](_0x34dc65,_[_0x0a9e('0x28')](_0x25fba9[_0x0a9e('0x29')],{'contact':_0x25fba9[_0x0a9e('0x2a')],'message':_0x25fba9[_0x0a9e('0x2b')],'agent':_0x25fba9['agent'],'interaction':_0x25fba9[_0x0a9e('0x2c')],'account':_0x25fba9[_0x0a9e('0x2d')]}))||'';}exports[_0x0a9e('0x2e')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x32')],'type':_0x2e8759['type'][_0x0a9e('0x33')]};});_0x40e7a3['model']=_[_0x0a9e('0x2f')](_0x824a4f,_0x0a9e('0x25'));_0x40e7a3[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x34')]);_0x40e7a3['filters']=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],_0x40e7a3[_0x0a9e('0x34')]);_0x15b200[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x34')]['fields']));_0x15b200[_0x0a9e('0x38')]=_0x15b200['attributes'][_0x0a9e('0x3a')]?_0x15b200[_0x0a9e('0x38')]:_0x40e7a3[_0x0a9e('0x37')];if(!_0x2ec755[_0x0a9e('0x34')]['hasOwnProperty'](_0x0a9e('0x3b'))){_0x15b200[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x2ec755[_0x0a9e('0x34')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1b')](_0x2ec755['query'][_0x0a9e('0x1b')]);}_0x15b200[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec755[_0x0a9e('0x34')]['sort']);_0x15b200[_0x0a9e('0x3e')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3f')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x41')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2f')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x42')]!==_0x0a9e('0x43')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x25')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x28')]({},_0x15b200,_0x2ec755[_0x0a9e('0x44')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3e')]};return db[_0x0a9e('0x30')][_0x0a9e('0x1c')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1c')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x45')]){_0x15b200[_0x0a9e('0x46')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x47')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x48')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x49')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x4a')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':!![],'where':{'id':_0x11ca30[_0x0a9e('0x4b')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x52628e[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x34')]);_0x52628e[_0x0a9e('0x3f')]=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],_0x52628e[_0x0a9e('0x34')]);_0x4d04c8['attributes']=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x11ca30[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x4d04c8[_0x0a9e('0x38')]=_0x4d04c8[_0x0a9e('0x38')][_0x0a9e('0x3a')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x37')];if(_0x11ca30['query'][_0x0a9e('0x45')]){_0x4d04c8[_0x0a9e('0x46')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x28')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x49')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4d')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x30')][_0x0a9e('0x4d')](_0x45bf7f[_0x0a9e('0x29')],{})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x49')](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x6054ee,_0x19383e){if(_0x6054ee[_0x0a9e('0x29')]['id']){delete _0x6054ee['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x6054ee['params']['id']}})['then'](handleEntityNotFound(_0x19383e,null))['then'](saveUpdates(_0x6054ee[_0x0a9e('0x29')],null))[_0x0a9e('0x22')](respondWithResult(_0x19383e,null))[_0x0a9e('0x49')](handleError(_0x19383e,null));};exports[_0x0a9e('0x23')]=function(_0x61bb17,_0x30decb){return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x61bb17['params']['id']}})['then'](handleEntityNotFound(_0x30decb,null))['then'](removeEntity(_0x30decb,null))[_0x0a9e('0x49')](handleError(_0x30decb,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','MailServerOut','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb'];(function(_0x10f387,_0x18c0a5){var _0xa8440=function(_0xd2215b){while(--_0xd2215b){_0x10f387['push'](_0x10f387['shift']());}};_0xa8440(++_0x18c0a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}function getMustacheRender(_0x34dc65,_0x25fba9){return Mustache[_0x0a9e('0x27')](_0x34dc65,_[_0x0a9e('0x28')](_0x25fba9[_0x0a9e('0x29')],{'contact':_0x25fba9[_0x0a9e('0x2a')],'message':_0x25fba9[_0x0a9e('0x2b')],'agent':_0x25fba9['agent'],'interaction':_0x25fba9[_0x0a9e('0x2c')],'account':_0x25fba9[_0x0a9e('0x2d')]}))||'';}exports[_0x0a9e('0x2e')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x32')],'type':_0x2e8759['type'][_0x0a9e('0x33')]};});_0x40e7a3['model']=_[_0x0a9e('0x2f')](_0x824a4f,_0x0a9e('0x25'));_0x40e7a3[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x34')]);_0x40e7a3['filters']=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],_0x40e7a3[_0x0a9e('0x34')]);_0x15b200[_0x0a9e('0x38')]=_[_0x0a9e('0x36')](_0x40e7a3[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x34')]['fields']));_0x15b200[_0x0a9e('0x38')]=_0x15b200['attributes'][_0x0a9e('0x3a')]?_0x15b200[_0x0a9e('0x38')]:_0x40e7a3[_0x0a9e('0x37')];if(!_0x2ec755[_0x0a9e('0x34')]['hasOwnProperty'](_0x0a9e('0x3b'))){_0x15b200[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x2ec755[_0x0a9e('0x34')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1b')](_0x2ec755['query'][_0x0a9e('0x1b')]);}_0x15b200[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec755[_0x0a9e('0x34')]['sort']);_0x15b200[_0x0a9e('0x3e')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3f')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x41')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3e')],{'$or':_[_0x0a9e('0x2f')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x42')]!==_0x0a9e('0x43')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x25')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x28')]({},_0x15b200,_0x2ec755[_0x0a9e('0x44')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3e')]};return db[_0x0a9e('0x30')][_0x0a9e('0x1c')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1c')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x34')][_0x0a9e('0x45')]){_0x15b200[_0x0a9e('0x46')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x47')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x48')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x49')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x4a')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':!![],'where':{'id':_0x11ca30[_0x0a9e('0x4b')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x37')]=_[_0x0a9e('0x35')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x52628e[_0x0a9e('0x34')]=_[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x34')]);_0x52628e[_0x0a9e('0x3f')]=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],_0x52628e[_0x0a9e('0x34')]);_0x4d04c8['attributes']=_[_0x0a9e('0x36')](_0x52628e[_0x0a9e('0x37')],qs[_0x0a9e('0x39')](_0x11ca30[_0x0a9e('0x34')][_0x0a9e('0x39')]));_0x4d04c8[_0x0a9e('0x38')]=_0x4d04c8[_0x0a9e('0x38')][_0x0a9e('0x3a')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x37')];if(_0x11ca30['query'][_0x0a9e('0x45')]){_0x4d04c8[_0x0a9e('0x46')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x28')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x49')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4d')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x30')][_0x0a9e('0x4d')](_0x45bf7f[_0x0a9e('0x29')],{})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x49')](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x6054ee,_0x19383e){if(_0x6054ee[_0x0a9e('0x29')]['id']){delete _0x6054ee['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x6054ee['params']['id']}})['then'](handleEntityNotFound(_0x19383e,null))['then'](saveUpdates(_0x6054ee[_0x0a9e('0x29')],null))[_0x0a9e('0x22')](respondWithResult(_0x19383e,null))[_0x0a9e('0x49')](handleError(_0x19383e,null));};exports[_0x0a9e('0x23')]=function(_0x61bb17,_0x30decb){return db[_0x0a9e('0x30')][_0x0a9e('0x4c')]({'where':{'id':_0x61bb17['params']['id']}})['then'](handleEntityNotFound(_0x30decb,null))['then'](removeEntity(_0x30decb,null))[_0x0a9e('0x49')](handleError(_0x30decb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 93e188f..e1a697a 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda19=['exports','define','MailServerOut','mail_servers_out','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0xf6844d,_0x4a117d){var _0x221bdb=function(_0x5d20bb){while(--_0x5d20bb){_0xf6844d['push'](_0xf6844d['shift']());}};_0x221bdb(++_0x4a117d);}(_0xda19,0xd5));var _0x9da1=function(_0x18a9bf,_0x698287){_0x18a9bf=_0x18a9bf-0x0;var _0x2596cd=_0xda19[_0x18a9bf];return _0x2596cd;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','MailServerOut','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailServerOut.attributes'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 290eaf6..d42163d 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4b5=['info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xb4b5,0x182));var _0x5b4b=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0xb4b5[_0x2e5f9c];return _0x538b44;};'use strict';var _=require(_0x5b4b('0x0'));var util=require(_0x5b4b('0x1'));var moment=require(_0x5b4b('0x2'));var BPromise=require(_0x5b4b('0x3'));var rs=require(_0x5b4b('0x4'));var fs=require('fs');var Redis=require(_0x5b4b('0x5'));var db=require(_0x5b4b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b4b('0x7'))('rpc');var config=require(_0x5b4b('0x8'));var jayson=require(_0x5b4b('0x9'));var client=jayson[_0x5b4b('0xa')][_0x5b4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39d0c5,_0x435a5f,_0x23b155){return new BPromise(function(_0x103a6b,_0x4fab7e){return client[_0x5b4b('0xc')](_0x39d0c5,_0x23b155)[_0x5b4b('0xd')](function(_0x28f548){logger[_0x5b4b('0xe')](_0x5b4b('0xf'),_0x435a5f,_0x5b4b('0x10'));logger[_0x5b4b('0x11')](_0x5b4b('0x12'),_0x435a5f,_0x5b4b('0x10'),JSON[_0x5b4b('0x13')](_0x28f548));if(_0x28f548[_0x5b4b('0x14')]){if(_0x28f548['error'][_0x5b4b('0x15')]===0x1f4){logger[_0x5b4b('0x14')](_0x5b4b('0xf'),_0x435a5f,_0x28f548[_0x5b4b('0x14')][_0x5b4b('0x16')]);return _0x4fab7e(_0x28f548['error'][_0x5b4b('0x16')]);}logger['error'](_0x5b4b('0xf'),_0x435a5f,_0x28f548[_0x5b4b('0x14')][_0x5b4b('0x16')]);return _0x103a6b(_0x28f548[_0x5b4b('0x14')][_0x5b4b('0x16')]);}else{logger[_0x5b4b('0xe')](_0x5b4b('0xf'),_0x435a5f,_0x5b4b('0x10'));_0x103a6b(_0x28f548[_0x5b4b('0x17')][_0x5b4b('0x16')]);}})[_0x5b4b('0x18')](function(_0x326e24){logger['error'](_0x5b4b('0xf'),_0x435a5f,_0x326e24);_0x4fab7e(_0x326e24);});});} \ No newline at end of file +var _0xa998=['error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x53c2b9,_0x1dbc82){var _0x2c677b=function(_0x3a7310){while(--_0x3a7310){_0x53c2b9['push'](_0x53c2b9['shift']());}};_0x2c677b(++_0x1dbc82);}(_0xa998,0x13f));var _0x8a99=function(_0x4f0b18,_0x1493e7){_0x4f0b18=_0x4f0b18-0x0;var _0x462ce7=_0xa998[_0x4f0b18];return _0x462ce7;};'use strict';var _=require(_0x8a99('0x0'));var util=require('util');var moment=require(_0x8a99('0x1'));var BPromise=require(_0x8a99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a99('0x3'))['db'];var utils=require(_0x8a99('0x4'));var logger=require('../../config/logger')(_0x8a99('0x5'));var config=require('../../config/environment');var jayson=require(_0x8a99('0x6'));var client=jayson[_0x8a99('0x7')][_0x8a99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x144ae0,_0x25198e,_0x4f6deb){return new BPromise(function(_0x4197a5,_0x15a54d){return client[_0x8a99('0x9')](_0x144ae0,_0x4f6deb)[_0x8a99('0xa')](function(_0x2127e1){logger[_0x8a99('0xb')](_0x8a99('0xc'),_0x25198e,_0x8a99('0xd'));logger[_0x8a99('0xe')](_0x8a99('0xf'),_0x25198e,'request\x20sent',JSON[_0x8a99('0x10')](_0x2127e1));if(_0x2127e1[_0x8a99('0x11')]){if(_0x2127e1[_0x8a99('0x11')][_0x8a99('0x12')]===0x1f4){logger[_0x8a99('0x11')](_0x8a99('0xc'),_0x25198e,_0x2127e1[_0x8a99('0x11')][_0x8a99('0x13')]);return _0x15a54d(_0x2127e1[_0x8a99('0x11')][_0x8a99('0x13')]);}logger[_0x8a99('0x11')]('MailServerOut,\x20%s,\x20%s',_0x25198e,_0x2127e1[_0x8a99('0x11')]['message']);return _0x4197a5(_0x2127e1[_0x8a99('0x11')][_0x8a99('0x13')]);}else{logger[_0x8a99('0xb')](_0x8a99('0xc'),_0x25198e,_0x8a99('0xd'));_0x4197a5(_0x2127e1['result']['message']);}})[_0x8a99('0x14')](function(_0x51793a){logger['error']('MailServerOut,\x20%s,\x20%s',_0x25198e,_0x51793a);_0x15a54d(_0x51793a);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7f12a12..b8f3ff7 100644 --- a/server/api/mailSubstatus/index.js +++ b/server/api/mailSubstatus/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f9b=['exports','path','express','Router','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','show','/:id','update','delete'];(function(_0x2eece3,_0x238fe6){var _0x3cc1f4=function(_0x46af6d){while(--_0x46af6d){_0x2eece3['push'](_0x2eece3['shift']());}};_0x3cc1f4(++_0x238fe6);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x4d706d,_0x325eb7){_0x4d706d=_0x4d706d-0x0;var _0x195701=_0x3f9b[_0x4d706d];return _0x195701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3f9('0x0'));var timeout=require('connect-timeout');var express=require(_0xb3f9('0x1'));var router=express[_0xb3f9('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb3f9('0x3'));var controller=require(_0xb3f9('0x4'));router[_0xb3f9('0x5')]('/',auth['isAuthenticated'](),controller[_0xb3f9('0x6')]);router[_0xb3f9('0x5')](_0xb3f9('0x7'),auth[_0xb3f9('0x8')](),controller[_0xb3f9('0x9')]);router['get']('/:id',auth[_0xb3f9('0x8')](),controller[_0xb3f9('0xa')]);router['post']('/',auth[_0xb3f9('0x8')](),controller['create']);router['put'](_0xb3f9('0xb'),auth[_0xb3f9('0x8')](),controller[_0xb3f9('0xc')]);router[_0xb3f9('0xd')](_0xb3f9('0xb'),auth[_0xb3f9('0x8')](),controller['destroy']);module[_0xb3f9('0xe')]=router; \ No newline at end of file +var _0x83cd=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1ba00c,_0x130167){var _0x2b7679=function(_0x176f57){while(--_0x176f57){_0x1ba00c['push'](_0x1ba00c['shift']());}};_0x2b7679(++_0x130167);}(_0x83cd,0x17b));var _0xd83c=function(_0x246e2a,_0x1037e0){_0x246e2a=_0x246e2a-0x0;var _0x327603=_0x83cd[_0x246e2a];return _0x327603;};'use strict';var multer=require(_0xd83c('0x0'));var util=require(_0xd83c('0x1'));var path=require(_0xd83c('0x2'));var timeout=require(_0xd83c('0x3'));var express=require(_0xd83c('0x4'));var router=express['Router']();var fs_extra=require(_0xd83c('0x5'));var auth=require(_0xd83c('0x6'));var interaction=require(_0xd83c('0x7'));var config=require(_0xd83c('0x8'));var controller=require('./mailSubstatus.controller');router[_0xd83c('0x9')]('/',auth[_0xd83c('0xa')](),controller[_0xd83c('0xb')]);router['get'](_0xd83c('0xc'),auth['isAuthenticated'](),controller[_0xd83c('0xd')]);router['get'](_0xd83c('0xe'),auth['isAuthenticated'](),controller[_0xd83c('0xf')]);router[_0xd83c('0x10')]('/',auth[_0xd83c('0xa')](),controller[_0xd83c('0x11')]);router[_0xd83c('0x12')](_0xd83c('0xe'),auth[_0xd83c('0xa')](),controller['update']);router[_0xd83c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd83c('0x14')]);module[_0xd83c('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 42e214c..84e0b93 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe91=['sequelize','name'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0xfe91,0xd4));var _0x1fe9=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0xfe91[_0x2cd1fb];return _0x48fd2b;};'use strict';var Sequelize=require(_0x1fe9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1fe9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1dc=['sequelize','exports','STRING'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0xc1dc,0x84));var _0xcc1d=function(_0x2695f2,_0x4a5976){_0x2695f2=_0x2695f2-0x0;var _0x23757a=_0xc1dc[_0x2695f2];return _0x23757a;};'use strict';var Sequelize=require(_0xcc1d('0x0'));module[_0xcc1d('0x1')]={'name':{'type':Sequelize[_0xcc1d('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcc1d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d9ffc63..e89d42f 100644 --- a/server/api/mailSubstatus/mailSubstatus.controller.js +++ b/server/api/mailSubstatus/mailSubstatus.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1b8=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','render','merge','body','contact','message','agent','interaction','index','MailSubstatus','rawAttributes','fieldName','key','model','map','query','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','catch','show','params','keys','includeAll','include','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x4adfa4,_0x121c5a){var _0x14cec1=function(_0x4fd975){while(--_0x4fd975){_0x4adfa4['push'](_0x4adfa4['shift']());}};_0x14cec1(++_0x121c5a);}(_0xb1b8,0x133));var _0x8b1b=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0xb1b8[_0x923ab6];return _0x484752;};'use strict';var emlformat=require(_0x8b1b('0x0'));var rimraf=require(_0x8b1b('0x1'));var zipdir=require(_0x8b1b('0x2'));var jsonpatch=require(_0x8b1b('0x3'));var rp=require('request-promise');var moment=require(_0x8b1b('0x4'));var BPromise=require(_0x8b1b('0x5'));var Mustache=require(_0x8b1b('0x6'));var util=require(_0x8b1b('0x7'));var path=require(_0x8b1b('0x8'));var sox=require(_0x8b1b('0x9'));var csv=require('to-csv');var ejs=require(_0x8b1b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b1b('0xb'));var squel=require(_0x8b1b('0xc'));var crypto=require(_0x8b1b('0xd'));var jsforce=require(_0x8b1b('0xe'));var deskjs=require(_0x8b1b('0xf'));var toCsv=require(_0x8b1b('0x10'));var querystring=require(_0x8b1b('0x11'));var Papa=require(_0x8b1b('0x12'));var Redis=require(_0x8b1b('0x13'));var authService=require(_0x8b1b('0x14'));var qs=require(_0x8b1b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b1b('0x16'));var logger=require(_0x8b1b('0x17'))('api');var utils=require(_0x8b1b('0x18'));var config=require(_0x8b1b('0x19'));var licenseUtil=require(_0x8b1b('0x1a'));var db=require(_0x8b1b('0x1b'))['db'];function respondWithStatusCode(_0x56d25c,_0x43309c){_0x43309c=_0x43309c||0xcc;return function(_0x29cdad){if(_0x29cdad){return _0x56d25c['sendStatus'](_0x43309c);}return _0x56d25c[_0x8b1b('0x1c')](_0x43309c)['end']();};}function respondWithResult(_0x104580,_0x1b2c63){_0x1b2c63=_0x1b2c63||0xc8;return function(_0x3121c2){if(_0x3121c2){return _0x104580[_0x8b1b('0x1c')](_0x1b2c63)[_0x8b1b('0x1d')](_0x3121c2);}};}function respondWithFilteredResult(_0x47db77,_0x3f4aae){return function(_0x5ce2ac){if(_0x5ce2ac){var _0x276f6e=typeof _0x3f4aae[_0x8b1b('0x1e')]==='undefined'&&typeof _0x3f4aae['limit']==='undefined';var _0x4c8f72=_0x5ce2ac[_0x8b1b('0x1f')];var _0x554174=_0x276f6e?0x0:_0x3f4aae[_0x8b1b('0x1e')];var _0x3ec4ae=_0x276f6e?_0x5ce2ac['count']:_0x3f4aae[_0x8b1b('0x1e')]+_0x3f4aae[_0x8b1b('0x20')];var _0x37bd31;if(_0x3ec4ae>=_0x4c8f72){_0x3ec4ae=_0x4c8f72;_0x37bd31=0xc8;}else{_0x37bd31=0xce;}_0x47db77[_0x8b1b('0x1c')](_0x37bd31);return _0x47db77[_0x8b1b('0x21')](_0x8b1b('0x22'),_0x554174+'-'+_0x3ec4ae+'/'+_0x4c8f72)[_0x8b1b('0x1d')](_0x5ce2ac);}return null;};}function patchUpdates(_0x377ded){return function(_0x42dd3d){try{jsonpatch[_0x8b1b('0x23')](_0x42dd3d,_0x377ded,!![]);}catch(_0x49ebba){return BPromise[_0x8b1b('0x24')](_0x49ebba);}return _0x42dd3d['save']();};}function saveUpdates(_0x22489c,_0xdbfc8){return function(_0x4eb0b2){if(_0x4eb0b2){return _0x4eb0b2[_0x8b1b('0x25')](_0x22489c)[_0x8b1b('0x26')](function(_0x5c295d){return _0x5c295d;});}return null;};}function removeEntity(_0x144933,_0x51bfa4){return function(_0x12e2e8){if(_0x12e2e8){return _0x12e2e8[_0x8b1b('0x27')]()['then'](function(){_0x144933['status'](0xcc)[_0x8b1b('0x28')]();});}};}function handleEntityNotFound(_0xcd8ca7,_0x45e534){return function(_0x2c9fb5){if(!_0x2c9fb5){_0xcd8ca7[_0x8b1b('0x29')](0x194);}return _0x2c9fb5;};}function handleError(_0x570dc5,_0x6893ee){_0x6893ee=_0x6893ee||0x1f4;return function(_0xa25da4){logger[_0x8b1b('0x2a')](_0xa25da4['stack']);if(_0xa25da4[_0x8b1b('0x2b')]){delete _0xa25da4[_0x8b1b('0x2b')];}_0x570dc5[_0x8b1b('0x1c')](_0x6893ee)['send'](_0xa25da4);};}function getMustacheRender(_0x38feb6,_0x239cb7){return Mustache[_0x8b1b('0x2c')](_0x38feb6,_[_0x8b1b('0x2d')](_0x239cb7[_0x8b1b('0x2e')],{'contact':_0x239cb7[_0x8b1b('0x2f')],'message':_0x239cb7[_0x8b1b('0x30')],'agent':_0x239cb7[_0x8b1b('0x31')],'interaction':_0x239cb7[_0x8b1b('0x32')],'account':_0x239cb7['account']}))||'';}exports[_0x8b1b('0x33')]=function(_0x3893d5,_0x204b36){var _0x1c685c={},_0x50a110={},_0x2cf375={'count':0x0,'rows':[]};var _0x1f3e96=_['map'](db[_0x8b1b('0x34')][_0x8b1b('0x35')],function(_0x2c500c){return{'name':_0x2c500c[_0x8b1b('0x36')],'type':_0x2c500c['type'][_0x8b1b('0x37')]};});_0x50a110[_0x8b1b('0x38')]=_[_0x8b1b('0x39')](_0x1f3e96,_0x8b1b('0x2b'));_0x50a110[_0x8b1b('0x3a')]=_['keys'](_0x3893d5[_0x8b1b('0x3a')]);_0x50a110['filters']=_['intersection'](_0x50a110[_0x8b1b('0x38')],_0x50a110[_0x8b1b('0x3a')]);_0x1c685c[_0x8b1b('0x3b')]=_[_0x8b1b('0x3c')](_0x50a110[_0x8b1b('0x38')],qs['fields'](_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x3d')]));_0x1c685c['attributes']=_0x1c685c[_0x8b1b('0x3b')]['length']?_0x1c685c[_0x8b1b('0x3b')]:_0x50a110[_0x8b1b('0x38')];if(!_0x3893d5[_0x8b1b('0x3a')]['hasOwnProperty'](_0x8b1b('0x3e'))){_0x1c685c[_0x8b1b('0x20')]=qs[_0x8b1b('0x20')](_0x3893d5['query'][_0x8b1b('0x20')]);_0x1c685c[_0x8b1b('0x1e')]=qs[_0x8b1b('0x1e')](_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x1e')]);}_0x1c685c[_0x8b1b('0x3f')]=qs[_0x8b1b('0x40')](_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x40')]);_0x1c685c['where']=qs[_0x8b1b('0x41')](_[_0x8b1b('0x42')](_0x3893d5[_0x8b1b('0x3a')],_0x50a110[_0x8b1b('0x41')]),_0x1f3e96);if(_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x43')]){_0x1c685c[_0x8b1b('0x44')]=_['merge'](_0x1c685c[_0x8b1b('0x44')],{'$or':_['map'](_0x1f3e96,function(_0x27d010){if(_0x27d010[_0x8b1b('0x45')]!==_0x8b1b('0x46')){var _0x383a24={};_0x383a24[_0x27d010[_0x8b1b('0x2b')]]={'$like':'%'+_0x3893d5[_0x8b1b('0x3a')][_0x8b1b('0x43')]+'%'};return _0x383a24;}})});}_0x1c685c=_['merge']({},_0x1c685c,_0x3893d5[_0x8b1b('0x47')]);var _0x351d8d={'where':_0x1c685c[_0x8b1b('0x44')]};return db[_0x8b1b('0x34')][_0x8b1b('0x1f')](_0x351d8d)[_0x8b1b('0x26')](function(_0x6b5a88){_0x2cf375[_0x8b1b('0x1f')]=_0x6b5a88;if(_0x3893d5[_0x8b1b('0x3a')]['includeAll']){_0x1c685c['include']=[{'all':!![]}];}return db[_0x8b1b('0x34')]['findAll'](_0x1c685c);})[_0x8b1b('0x26')](function(_0x3d693a){_0x2cf375['rows']=_0x3d693a;return _0x2cf375;})[_0x8b1b('0x26')](respondWithFilteredResult(_0x204b36,_0x1c685c))[_0x8b1b('0x48')](handleError(_0x204b36,null));};exports[_0x8b1b('0x49')]=function(_0x5a4ecd,_0x111bce){var _0x3cf39e={'raw':!![],'where':{'id':_0x5a4ecd[_0x8b1b('0x4a')]['id']}},_0x6893c0={};_0x6893c0[_0x8b1b('0x38')]=_[_0x8b1b('0x4b')](db[_0x8b1b('0x34')][_0x8b1b('0x35')]);_0x6893c0['query']=_[_0x8b1b('0x4b')](_0x5a4ecd['query']);_0x6893c0[_0x8b1b('0x41')]=_[_0x8b1b('0x3c')](_0x6893c0['model'],_0x6893c0[_0x8b1b('0x3a')]);_0x3cf39e[_0x8b1b('0x3b')]=_['intersection'](_0x6893c0['model'],qs[_0x8b1b('0x3d')](_0x5a4ecd[_0x8b1b('0x3a')][_0x8b1b('0x3d')]));_0x3cf39e[_0x8b1b('0x3b')]=_0x3cf39e[_0x8b1b('0x3b')]['length']?_0x3cf39e[_0x8b1b('0x3b')]:_0x6893c0[_0x8b1b('0x38')];if(_0x5a4ecd[_0x8b1b('0x3a')][_0x8b1b('0x4c')]){_0x3cf39e[_0x8b1b('0x4d')]=[{'all':!![]}];}_0x3cf39e=_[_0x8b1b('0x2d')]({},_0x3cf39e,_0x5a4ecd['options']);return db[_0x8b1b('0x34')][_0x8b1b('0x4e')](_0x3cf39e)[_0x8b1b('0x26')](handleEntityNotFound(_0x111bce,null))[_0x8b1b('0x26')](respondWithResult(_0x111bce,null))['catch'](handleError(_0x111bce,null));};exports[_0x8b1b('0x4f')]=function(_0x3e3144,_0x1c3fb0){return db[_0x8b1b('0x34')]['create'](_0x3e3144[_0x8b1b('0x2e')],{})[_0x8b1b('0x26')](respondWithResult(_0x1c3fb0,0xc9))[_0x8b1b('0x48')](handleError(_0x1c3fb0,null));};exports[_0x8b1b('0x25')]=function(_0x4c87ec,_0x39ecb7){if(_0x4c87ec['body']['id']){delete _0x4c87ec['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x4c87ec['params']['id']}})['then'](handleEntityNotFound(_0x39ecb7,null))[_0x8b1b('0x26')](saveUpdates(_0x4c87ec['body'],null))['then'](respondWithResult(_0x39ecb7,null))[_0x8b1b('0x48')](handleError(_0x39ecb7,null));};exports['destroy']=function(_0x5dca67,_0x5a6e5a){return db[_0x8b1b('0x34')][_0x8b1b('0x4e')]({'where':{'id':_0x5dca67[_0x8b1b('0x4a')]['id']}})[_0x8b1b('0x26')](handleEntityNotFound(_0x5a6e5a,null))['then'](removeEntity(_0x5a6e5a,null))[_0x8b1b('0x48')](handleError(_0x5a6e5a,null));};exports[_0x8b1b('0x50')]=function(_0x280cb1,_0x511fa8){return db[_0x8b1b('0x34')][_0x8b1b('0x50')]()[_0x8b1b('0x26')](respondWithResult(_0x511fa8,null))['catch'](handleError(_0x511fa8,null));}; \ No newline at end of file +var _0x4383=['fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','render','merge','body','contact','message','agent','interaction','account','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','catch','params','find','create','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1156f3,_0x5ae279){var _0x4acf07=function(_0x4bf3ef){while(--_0x4bf3ef){_0x1156f3['push'](_0x1156f3['shift']());}};_0x4acf07(++_0x5ae279);}(_0x4383,0x94));var _0x3438=function(_0x404395,_0x3b63b9){_0x404395=_0x404395-0x0;var _0x43cda9=_0x4383[_0x404395];return _0x43cda9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3438('0x0'));var jsonpatch=require(_0x3438('0x1'));var rp=require(_0x3438('0x2'));var moment=require(_0x3438('0x3'));var BPromise=require(_0x3438('0x4'));var Mustache=require(_0x3438('0x5'));var util=require(_0x3438('0x6'));var path=require(_0x3438('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3438('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3438('0x9'));var toCsv=require(_0x3438('0xa'));var querystring=require(_0x3438('0xb'));var Papa=require(_0x3438('0xc'));var Redis=require(_0x3438('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3438('0xe'));var as=require(_0x3438('0xf'));var hardwareService=require(_0x3438('0x10'));var logger=require(_0x3438('0x11'))(_0x3438('0x12'));var utils=require('../../config/utils');var config=require(_0x3438('0x13'));var licenseUtil=require(_0x3438('0x14'));var db=require(_0x3438('0x15'))['db'];function respondWithStatusCode(_0x1a3f53,_0x2e92f7){_0x2e92f7=_0x2e92f7||0xcc;return function(_0x2688b0){if(_0x2688b0){return _0x1a3f53[_0x3438('0x16')](_0x2e92f7);}return _0x1a3f53[_0x3438('0x17')](_0x2e92f7)[_0x3438('0x18')]();};}function respondWithResult(_0x1934c0,_0x344b2b){_0x344b2b=_0x344b2b||0xc8;return function(_0x6c4b9a){if(_0x6c4b9a){return _0x1934c0[_0x3438('0x17')](_0x344b2b)['json'](_0x6c4b9a);}};}function respondWithFilteredResult(_0x564038,_0x496556){return function(_0x1379b9){if(_0x1379b9){var _0x11a349=typeof _0x496556[_0x3438('0x19')]===_0x3438('0x1a')&&typeof _0x496556[_0x3438('0x1b')]===_0x3438('0x1a');var _0x496b6c=_0x1379b9[_0x3438('0x1c')];var _0xa7b64e=_0x11a349?0x0:_0x496556[_0x3438('0x19')];var _0x77465d=_0x11a349?_0x1379b9['count']:_0x496556[_0x3438('0x19')]+_0x496556['limit'];var _0x5dafd1;if(_0x77465d>=_0x496b6c){_0x77465d=_0x496b6c;_0x5dafd1=0xc8;}else{_0x5dafd1=0xce;}_0x564038[_0x3438('0x17')](_0x5dafd1);return _0x564038[_0x3438('0x1d')](_0x3438('0x1e'),_0xa7b64e+'-'+_0x77465d+'/'+_0x496b6c)[_0x3438('0x1f')](_0x1379b9);}return null;};}function patchUpdates(_0x41697e){return function(_0x57d4d3){try{jsonpatch[_0x3438('0x20')](_0x57d4d3,_0x41697e,!![]);}catch(_0xe1f11c){return BPromise['reject'](_0xe1f11c);}return _0x57d4d3['save']();};}function saveUpdates(_0x4a2a73,_0x3682e0){return function(_0x160a2e){if(_0x160a2e){return _0x160a2e[_0x3438('0x21')](_0x4a2a73)[_0x3438('0x22')](function(_0x433d6e){return _0x433d6e;});}return null;};}function removeEntity(_0x41700b,_0x73b2bf){return function(_0x1cf046){if(_0x1cf046){return _0x1cf046[_0x3438('0x23')]()[_0x3438('0x22')](function(){_0x41700b[_0x3438('0x17')](0xcc)[_0x3438('0x18')]();});}};}function handleEntityNotFound(_0x2b5d0,_0x35a3b9){return function(_0x17414d){if(!_0x17414d){_0x2b5d0[_0x3438('0x16')](0x194);}return _0x17414d;};}function handleError(_0x496d04,_0x5a8e05){_0x5a8e05=_0x5a8e05||0x1f4;return function(_0x396128){logger[_0x3438('0x24')](_0x396128[_0x3438('0x25')]);if(_0x396128['name']){delete _0x396128[_0x3438('0x26')];}_0x496d04[_0x3438('0x17')](_0x5a8e05)['send'](_0x396128);};}function getMustacheRender(_0x226fe5,_0x1b9b7f){return Mustache[_0x3438('0x27')](_0x226fe5,_[_0x3438('0x28')](_0x1b9b7f[_0x3438('0x29')],{'contact':_0x1b9b7f[_0x3438('0x2a')],'message':_0x1b9b7f[_0x3438('0x2b')],'agent':_0x1b9b7f[_0x3438('0x2c')],'interaction':_0x1b9b7f[_0x3438('0x2d')],'account':_0x1b9b7f[_0x3438('0x2e')]}))||'';}exports[_0x3438('0x2f')]=function(_0x1ad110,_0x5b6895){var _0x3c7ece={},_0x1e935c={},_0x48b06d={'count':0x0,'rows':[]};var _0x5e58ef=_['map'](db['MailSubstatus'][_0x3438('0x30')],function(_0x296375){return{'name':_0x296375[_0x3438('0x31')],'type':_0x296375[_0x3438('0x32')]['key']};});_0x1e935c[_0x3438('0x33')]=_[_0x3438('0x34')](_0x5e58ef,'name');_0x1e935c[_0x3438('0x35')]=_[_0x3438('0x36')](_0x1ad110[_0x3438('0x35')]);_0x1e935c['filters']=_[_0x3438('0x37')](_0x1e935c['model'],_0x1e935c['query']);_0x3c7ece['attributes']=_[_0x3438('0x37')](_0x1e935c[_0x3438('0x33')],qs[_0x3438('0x38')](_0x1ad110[_0x3438('0x35')]['fields']));_0x3c7ece[_0x3438('0x39')]=_0x3c7ece[_0x3438('0x39')][_0x3438('0x3a')]?_0x3c7ece['attributes']:_0x1e935c[_0x3438('0x33')];if(!_0x1ad110[_0x3438('0x35')][_0x3438('0x3b')]('nolimit')){_0x3c7ece[_0x3438('0x1b')]=qs[_0x3438('0x1b')](_0x1ad110[_0x3438('0x35')][_0x3438('0x1b')]);_0x3c7ece[_0x3438('0x19')]=qs[_0x3438('0x19')](_0x1ad110['query'][_0x3438('0x19')]);}_0x3c7ece[_0x3438('0x3c')]=qs[_0x3438('0x3d')](_0x1ad110['query'][_0x3438('0x3d')]);_0x3c7ece[_0x3438('0x3e')]=qs[_0x3438('0x3f')](_[_0x3438('0x40')](_0x1ad110[_0x3438('0x35')],_0x1e935c['filters']),_0x5e58ef);if(_0x1ad110[_0x3438('0x35')][_0x3438('0x41')]){_0x3c7ece[_0x3438('0x3e')]=_['merge'](_0x3c7ece[_0x3438('0x3e')],{'$or':_[_0x3438('0x34')](_0x5e58ef,function(_0x3accd8){if(_0x3accd8['type']!==_0x3438('0x42')){var _0x33ca44={};_0x33ca44[_0x3accd8[_0x3438('0x26')]]={'$like':'%'+_0x1ad110[_0x3438('0x35')][_0x3438('0x41')]+'%'};return _0x33ca44;}})});}_0x3c7ece=_[_0x3438('0x28')]({},_0x3c7ece,_0x1ad110[_0x3438('0x43')]);var _0x597915={'where':_0x3c7ece[_0x3438('0x3e')]};return db[_0x3438('0x44')][_0x3438('0x1c')](_0x597915)['then'](function(_0x5cd972){_0x48b06d[_0x3438('0x1c')]=_0x5cd972;if(_0x1ad110[_0x3438('0x35')][_0x3438('0x45')]){_0x3c7ece[_0x3438('0x46')]=[{'all':!![]}];}return db[_0x3438('0x44')][_0x3438('0x47')](_0x3c7ece);})[_0x3438('0x22')](function(_0x5c83c2){_0x48b06d[_0x3438('0x48')]=_0x5c83c2;return _0x48b06d;})[_0x3438('0x22')](respondWithFilteredResult(_0x5b6895,_0x3c7ece))[_0x3438('0x49')](handleError(_0x5b6895,null));};exports['show']=function(_0x39dd28,_0x96e8e3){var _0xfeed09={'raw':!![],'where':{'id':_0x39dd28[_0x3438('0x4a')]['id']}},_0x588fd4={};_0x588fd4['model']=_['keys'](db[_0x3438('0x44')][_0x3438('0x30')]);_0x588fd4[_0x3438('0x35')]=_[_0x3438('0x36')](_0x39dd28[_0x3438('0x35')]);_0x588fd4['filters']=_['intersection'](_0x588fd4['model'],_0x588fd4['query']);_0xfeed09[_0x3438('0x39')]=_[_0x3438('0x37')](_0x588fd4[_0x3438('0x33')],qs['fields'](_0x39dd28['query']['fields']));_0xfeed09[_0x3438('0x39')]=_0xfeed09[_0x3438('0x39')][_0x3438('0x3a')]?_0xfeed09[_0x3438('0x39')]:_0x588fd4['model'];if(_0x39dd28[_0x3438('0x35')]['includeAll']){_0xfeed09[_0x3438('0x46')]=[{'all':!![]}];}_0xfeed09=_[_0x3438('0x28')]({},_0xfeed09,_0x39dd28[_0x3438('0x43')]);return db[_0x3438('0x44')][_0x3438('0x4b')](_0xfeed09)[_0x3438('0x22')](handleEntityNotFound(_0x96e8e3,null))[_0x3438('0x22')](respondWithResult(_0x96e8e3,null))[_0x3438('0x49')](handleError(_0x96e8e3,null));};exports[_0x3438('0x4c')]=function(_0x44aaf4,_0x18327b){return db[_0x3438('0x44')]['create'](_0x44aaf4[_0x3438('0x29')],{})['then'](respondWithResult(_0x18327b,0xc9))[_0x3438('0x49')](handleError(_0x18327b,null));};exports[_0x3438('0x21')]=function(_0x13081e,_0x236992){if(_0x13081e[_0x3438('0x29')]['id']){delete _0x13081e[_0x3438('0x29')]['id'];}return db[_0x3438('0x44')][_0x3438('0x4b')]({'where':{'id':_0x13081e[_0x3438('0x4a')]['id']}})['then'](handleEntityNotFound(_0x236992,null))['then'](saveUpdates(_0x13081e[_0x3438('0x29')],null))['then'](respondWithResult(_0x236992,null))['catch'](handleError(_0x236992,null));};exports[_0x3438('0x23')]=function(_0x1da155,_0x3924fd){return db[_0x3438('0x44')][_0x3438('0x4b')]({'where':{'id':_0x1da155['params']['id']}})['then'](handleEntityNotFound(_0x3924fd,null))[_0x3438('0x22')](removeEntity(_0x3924fd,null))['catch'](handleError(_0x3924fd,null));};exports['describe']=function(_0x490e21,_0x1f11df){return db['MailSubstatus'][_0x3438('0x4d')]()[_0x3438('0x22')](respondWithResult(_0x1f11df,null))[_0x3438('0x49')](handleError(_0x1f11df,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index dfad282..a69030b 100644 --- a/server/api/mailSubstatus/mailSubstatus.model.js +++ b/server/api/mailSubstatus/mailSubstatus.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69d4=['util','api','moment','bluebird','path','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash'];(function(_0x1e44bc,_0x4f79ba){var _0x235942=function(_0x148b67){while(--_0x148b67){_0x1e44bc['push'](_0x1e44bc['shift']());}};_0x235942(++_0x4f79ba);}(_0x69d4,0x83));var _0x469d=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x69d4[_0x3457b4];return _0xaa8fa9;};'use strict';var _=require(_0x469d('0x0'));var util=require(_0x469d('0x1'));var logger=require('../../config/logger')(_0x469d('0x2'));var moment=require(_0x469d('0x3'));var BPromise=require(_0x469d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x469d('0x5'));var rimraf=require('rimraf');var config=require(_0x469d('0x6'));var attributes=require(_0x469d('0x7'));module[_0x469d('0x8')]=function(_0x336101,_0x3d0ec8){return _0x336101[_0x469d('0x9')]('MailSubstatus',attributes,{'tableName':_0x469d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa30a=['path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var logger=require(_0xaa30('0x2'))('api');var moment=require(_0xaa30('0x3'));var BPromise=require(_0xaa30('0x4'));var rp=require(_0xaa30('0x5'));var fs=require('fs');var path=require(_0xaa30('0x6'));var rimraf=require(_0xaa30('0x7'));var config=require(_0xaa30('0x8'));var attributes=require(_0xaa30('0x9'));module['exports']=function(_0x347cd5,_0x4efe89){return _0x347cd5[_0xaa30('0xa')](_0xaa30('0xb'),attributes,{'tableName':_0xaa30('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a70301e..15211b2 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xdace,0xc5));var _0xedac=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xdace[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x165cc2,_0x557d0c){var _0x359a7e=function(_0x328f00){while(--_0x328f00){_0x165cc2['push'](_0x165cc2['shift']());}};_0x359a7e(++_0x557d0c);}(_0xaa88,0x137));var _0x8aa8=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0xaa88[_0x12833b];return _0x3acad3;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8ee4246..9a6d1ce 100644 --- a/server/api/mailTransferReport/index.js +++ b/server/api/mailTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bdb=['exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0xcb3de4,_0x406723){var _0x4c3c22=function(_0x130f90){while(--_0x130f90){_0xcb3de4['push'](_0xcb3de4['shift']());}};_0x4c3c22(++_0x406723);}(_0x2bdb,0x105));var _0xb2bd=function(_0x5f2c16,_0x3c9ddd){_0x5f2c16=_0x5f2c16-0x0;var _0x28c9f1=_0x2bdb[_0x5f2c16];return _0x28c9f1;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require('util');var path=require(_0xb2bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x2'));var router=express[_0xb2bd('0x3')]();var fs_extra=require(_0xb2bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var controller=require(_0xb2bd('0x7'));router[_0xb2bd('0x8')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xa')]);router[_0xb2bd('0x8')]('/describe',auth[_0xb2bd('0x9')](),controller['describe']);router[_0xb2bd('0x8')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0xd')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xe')]);router[_0xb2bd('0xf')](_0xb2bd('0xb'),auth['isAuthenticated'](),controller[_0xb2bd('0x10')]);router[_0xb2bd('0x11')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x12')]);module[_0xb2bd('0x13')]=router; \ No newline at end of file +var _0xe3db=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c038a,_0x78d471){var _0x3cc685=function(_0x3de2c3){while(--_0x3de2c3){_0x3c038a['push'](_0x3c038a['shift']());}};_0x3cc685(++_0x78d471);}(_0xe3db,0xc8));var _0xbe3d=function(_0xa573e5,_0x1c165d){_0xa573e5=_0xa573e5-0x0;var _0x33c8ff=_0xe3db[_0xa573e5];return _0x33c8ff;};'use strict';var multer=require(_0xbe3d('0x0'));var util=require(_0xbe3d('0x1'));var path=require('path');var timeout=require(_0xbe3d('0x2'));var express=require(_0xbe3d('0x3'));var router=express[_0xbe3d('0x4')]();var fs_extra=require(_0xbe3d('0x5'));var auth=require(_0xbe3d('0x6'));var interaction=require(_0xbe3d('0x7'));var config=require(_0xbe3d('0x8'));var controller=require(_0xbe3d('0x9'));router[_0xbe3d('0xa')]('/',auth[_0xbe3d('0xb')](),controller[_0xbe3d('0xc')]);router['get'](_0xbe3d('0xd'),auth[_0xbe3d('0xb')](),controller[_0xbe3d('0xe')]);router[_0xbe3d('0xa')]('/:id',auth[_0xbe3d('0xb')](),controller[_0xbe3d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbe3d('0x10')]);router[_0xbe3d('0x11')](_0xbe3d('0x12'),auth[_0xbe3d('0xb')](),controller[_0xbe3d('0x13')]);router[_0xbe3d('0x14')](_0xbe3d('0x12'),auth[_0xbe3d('0xb')](),controller[_0xbe3d('0x15')]);module[_0xbe3d('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 91e33c9..babba3e 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdce6=['account','agent','queue','sequelize','STRING','ENUM'];(function(_0x2b01fe,_0x4a70e8){var _0x58e619=function(_0xe80865){while(--_0xe80865){_0x2b01fe['push'](_0x2b01fe['shift']());}};_0x58e619(++_0x4a70e8);}(_0xdce6,0x1d1));var _0x6dce=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xdce6[_0x6c993a];return _0x27f547;};'use strict';var moment=require('moment');var Sequelize=require(_0x6dce('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6dce('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6dce('0x2')](_0x6dce('0x3'),_0x6dce('0x4'),'queue'),'allowNull':![],'defaultValue':_0x6dce('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xc042=['moment','sequelize','exports','STRING','ENUM','account','queue','NOW'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc042,0x118));var _0x2c04=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xc042[_0x1589dd];return _0x1bddd1;};'use strict';var moment=require(_0x2c04('0x0'));var Sequelize=require(_0x2c04('0x1'));module[_0x2c04('0x2')]={'uniqueid':{'type':Sequelize[_0x2c04('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2c04('0x4')](_0x2c04('0x5'),'agent',_0x2c04('0x6')),'allowNull':![],'defaultValue':_0x2c04('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2c04('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 97fa4a0..8af5b4b 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d83=['bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','merge','body','contact','message','agent','interaction','account','MailTransferReport','fieldName','type','key','map','query','keys','filters','intersection','attributes','length','model','nolimit','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x7d83,0x18f));var _0x37d8=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x7d83[_0x166742];return _0xb7814a;};'use strict';var emlformat=require(_0x37d8('0x0'));var rimraf=require(_0x37d8('0x1'));var zipdir=require(_0x37d8('0x2'));var jsonpatch=require(_0x37d8('0x3'));var rp=require(_0x37d8('0x4'));var moment=require(_0x37d8('0x5'));var BPromise=require(_0x37d8('0x6'));var Mustache=require(_0x37d8('0x7'));var util=require(_0x37d8('0x8'));var path=require('path');var sox=require(_0x37d8('0x9'));var csv=require('to-csv');var ejs=require(_0x37d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x37d8('0xb'));var crypto=require(_0x37d8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x37d8('0xd'));var toCsv=require(_0x37d8('0xe'));var querystring=require(_0x37d8('0xf'));var Papa=require(_0x37d8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37d8('0x12'));var logger=require(_0x37d8('0x13'))(_0x37d8('0x14'));var utils=require(_0x37d8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x37d8('0x16'));var db=require(_0x37d8('0x17'))['db'];function respondWithStatusCode(_0x4d5142,_0x492b7f){_0x492b7f=_0x492b7f||0xcc;return function(_0x333bca){if(_0x333bca){return _0x4d5142[_0x37d8('0x18')](_0x492b7f);}return _0x4d5142[_0x37d8('0x19')](_0x492b7f)[_0x37d8('0x1a')]();};}function respondWithResult(_0x16e9d7,_0xa15eb9){_0xa15eb9=_0xa15eb9||0xc8;return function(_0xd61b2f){if(_0xd61b2f){return _0x16e9d7[_0x37d8('0x19')](_0xa15eb9)[_0x37d8('0x1b')](_0xd61b2f);}};}function respondWithFilteredResult(_0x5eac40,_0x375d88){return function(_0x2d0abb){if(_0x2d0abb){var _0x504ee4=typeof _0x375d88[_0x37d8('0x1c')]===_0x37d8('0x1d')&&typeof _0x375d88[_0x37d8('0x1e')]===_0x37d8('0x1d');var _0x1863f7=_0x2d0abb[_0x37d8('0x1f')];var _0xae2b9c=_0x504ee4?0x0:_0x375d88[_0x37d8('0x1c')];var _0x3c4267=_0x504ee4?_0x2d0abb[_0x37d8('0x1f')]:_0x375d88[_0x37d8('0x1c')]+_0x375d88[_0x37d8('0x1e')];var _0xc07daf;if(_0x3c4267>=_0x1863f7){_0x3c4267=_0x1863f7;_0xc07daf=0xc8;}else{_0xc07daf=0xce;}_0x5eac40[_0x37d8('0x19')](_0xc07daf);return _0x5eac40[_0x37d8('0x20')](_0x37d8('0x21'),_0xae2b9c+'-'+_0x3c4267+'/'+_0x1863f7)[_0x37d8('0x1b')](_0x2d0abb);}return null;};}function patchUpdates(_0xc7ba01){return function(_0x5dca14){try{jsonpatch[_0x37d8('0x22')](_0x5dca14,_0xc7ba01,!![]);}catch(_0x1b9dd8){return BPromise[_0x37d8('0x23')](_0x1b9dd8);}return _0x5dca14[_0x37d8('0x24')]();};}function saveUpdates(_0x142136,_0x350b5a){return function(_0x481ed6){if(_0x481ed6){return _0x481ed6[_0x37d8('0x25')](_0x142136)[_0x37d8('0x26')](function(_0x530367){return _0x530367;});}return null;};}function removeEntity(_0x354bd0,_0x1bded1){return function(_0x398b28){if(_0x398b28){return _0x398b28[_0x37d8('0x27')]()['then'](function(){_0x354bd0[_0x37d8('0x19')](0xcc)[_0x37d8('0x1a')]();});}};}function handleEntityNotFound(_0x2bd7e1,_0x3b4117){return function(_0x2b1a46){if(!_0x2b1a46){_0x2bd7e1[_0x37d8('0x18')](0x194);}return _0x2b1a46;};}function handleError(_0x5083b3,_0x23b91b){_0x23b91b=_0x23b91b||0x1f4;return function(_0x16e430){logger[_0x37d8('0x28')](_0x16e430['stack']);if(_0x16e430[_0x37d8('0x29')]){delete _0x16e430['name'];}_0x5083b3[_0x37d8('0x19')](_0x23b91b)[_0x37d8('0x2a')](_0x16e430);};}function getMustacheRender(_0x32d8e5,_0x479f8f){return Mustache['render'](_0x32d8e5,_[_0x37d8('0x2b')](_0x479f8f[_0x37d8('0x2c')],{'contact':_0x479f8f[_0x37d8('0x2d')],'message':_0x479f8f[_0x37d8('0x2e')],'agent':_0x479f8f[_0x37d8('0x2f')],'interaction':_0x479f8f[_0x37d8('0x30')],'account':_0x479f8f[_0x37d8('0x31')]}))||'';}exports['index']=function(_0x50aae4,_0x74553f){var _0x524628={},_0x2ef540={},_0x237fae={'count':0x0,'rows':[]};var _0x5a558e=_['map'](db[_0x37d8('0x32')]['rawAttributes'],function(_0x270750){return{'name':_0x270750[_0x37d8('0x33')],'type':_0x270750[_0x37d8('0x34')][_0x37d8('0x35')]};});_0x2ef540['model']=_[_0x37d8('0x36')](_0x5a558e,_0x37d8('0x29'));_0x2ef540[_0x37d8('0x37')]=_[_0x37d8('0x38')](_0x50aae4['query']);_0x2ef540[_0x37d8('0x39')]=_[_0x37d8('0x3a')](_0x2ef540['model'],_0x2ef540[_0x37d8('0x37')]);_0x524628['attributes']=_[_0x37d8('0x3a')](_0x2ef540['model'],qs['fields'](_0x50aae4[_0x37d8('0x37')]['fields']));_0x524628[_0x37d8('0x3b')]=_0x524628[_0x37d8('0x3b')][_0x37d8('0x3c')]?_0x524628['attributes']:_0x2ef540[_0x37d8('0x3d')];if(!_0x50aae4[_0x37d8('0x37')]['hasOwnProperty'](_0x37d8('0x3e'))){_0x524628[_0x37d8('0x1e')]=qs[_0x37d8('0x1e')](_0x50aae4[_0x37d8('0x37')][_0x37d8('0x1e')]);_0x524628['offset']=qs[_0x37d8('0x1c')](_0x50aae4[_0x37d8('0x37')][_0x37d8('0x1c')]);}_0x524628[_0x37d8('0x3f')]=qs[_0x37d8('0x40')](_0x50aae4[_0x37d8('0x37')][_0x37d8('0x40')]);_0x524628['where']=qs[_0x37d8('0x39')](_[_0x37d8('0x41')](_0x50aae4[_0x37d8('0x37')],_0x2ef540['filters']),_0x5a558e);if(_0x50aae4[_0x37d8('0x37')][_0x37d8('0x42')]){_0x524628[_0x37d8('0x43')]=_[_0x37d8('0x2b')](_0x524628[_0x37d8('0x43')],{'$or':_[_0x37d8('0x36')](_0x5a558e,function(_0x4fd6c0){if(_0x4fd6c0[_0x37d8('0x34')]!==_0x37d8('0x44')){var _0x407885={};_0x407885[_0x4fd6c0[_0x37d8('0x29')]]={'$like':'%'+_0x50aae4[_0x37d8('0x37')][_0x37d8('0x42')]+'%'};return _0x407885;}})});}_0x524628=_['merge']({},_0x524628,_0x50aae4[_0x37d8('0x45')]);var _0x437a0e={'where':_0x524628[_0x37d8('0x43')]};return db[_0x37d8('0x32')][_0x37d8('0x1f')](_0x437a0e)['then'](function(_0x484ac4){_0x237fae[_0x37d8('0x1f')]=_0x484ac4;if(_0x50aae4[_0x37d8('0x37')]['includeAll']){_0x524628['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x37d8('0x46')](_0x524628);})[_0x37d8('0x26')](function(_0x4b6dd8){_0x237fae[_0x37d8('0x47')]=_0x4b6dd8;return _0x237fae;})['then'](respondWithFilteredResult(_0x74553f,_0x524628))[_0x37d8('0x48')](handleError(_0x74553f,null));};exports[_0x37d8('0x49')]=function(_0x4e115c,_0x3335f4){var _0x2191b3={'raw':!![],'where':{'id':_0x4e115c[_0x37d8('0x4a')]['id']}},_0x43af5c={};_0x43af5c[_0x37d8('0x3d')]=_[_0x37d8('0x38')](db[_0x37d8('0x32')][_0x37d8('0x4b')]);_0x43af5c[_0x37d8('0x37')]=_[_0x37d8('0x38')](_0x4e115c[_0x37d8('0x37')]);_0x43af5c[_0x37d8('0x39')]=_[_0x37d8('0x3a')](_0x43af5c['model'],_0x43af5c[_0x37d8('0x37')]);_0x2191b3['attributes']=_[_0x37d8('0x3a')](_0x43af5c[_0x37d8('0x3d')],qs[_0x37d8('0x4c')](_0x4e115c[_0x37d8('0x37')]['fields']));_0x2191b3[_0x37d8('0x3b')]=_0x2191b3[_0x37d8('0x3b')][_0x37d8('0x3c')]?_0x2191b3[_0x37d8('0x3b')]:_0x43af5c[_0x37d8('0x3d')];if(_0x4e115c['query']['includeAll']){_0x2191b3[_0x37d8('0x4d')]=[{'all':!![]}];}_0x2191b3=_[_0x37d8('0x2b')]({},_0x2191b3,_0x4e115c[_0x37d8('0x45')]);return db['MailTransferReport'][_0x37d8('0x4e')](_0x2191b3)[_0x37d8('0x26')](handleEntityNotFound(_0x3335f4,null))['then'](respondWithResult(_0x3335f4,null))[_0x37d8('0x48')](handleError(_0x3335f4,null));};exports[_0x37d8('0x4f')]=function(_0x2070e8,_0x3c6aaa){return db[_0x37d8('0x32')][_0x37d8('0x4f')](_0x2070e8['body'],{})[_0x37d8('0x26')](respondWithResult(_0x3c6aaa,0xc9))[_0x37d8('0x48')](handleError(_0x3c6aaa,null));};exports[_0x37d8('0x25')]=function(_0x404aaa,_0x3973ef){if(_0x404aaa[_0x37d8('0x2c')]['id']){delete _0x404aaa[_0x37d8('0x2c')]['id'];}return db[_0x37d8('0x32')][_0x37d8('0x4e')]({'where':{'id':_0x404aaa[_0x37d8('0x4a')]['id']}})[_0x37d8('0x26')](handleEntityNotFound(_0x3973ef,null))['then'](saveUpdates(_0x404aaa[_0x37d8('0x2c')],null))[_0x37d8('0x26')](respondWithResult(_0x3973ef,null))[_0x37d8('0x48')](handleError(_0x3973ef,null));};exports[_0x37d8('0x27')]=function(_0x3f97f2,_0x321957){return db[_0x37d8('0x32')][_0x37d8('0x4e')]({'where':{'id':_0x3f97f2[_0x37d8('0x4a')]['id']}})[_0x37d8('0x26')](handleEntityNotFound(_0x321957,null))[_0x37d8('0x26')](removeEntity(_0x321957,null))[_0x37d8('0x48')](handleError(_0x321957,null));};exports['describe']=function(_0xda54c1,_0x5247b0){return db['MailTransferReport'][_0x37d8('0x50')]()['then'](respondWithResult(_0x5247b0,null))[_0x37d8('0x48')](handleError(_0x5247b0,null));}; \ No newline at end of file +var _0x0831=['end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','MailTransferReport','catch','show','params','keys','length','include','options','create','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x0831,0x166));var _0x1083=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x0831[_0x3cb3ca];return _0x214366;};'use strict';var emlformat=require(_0x1083('0x0'));var rimraf=require(_0x1083('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1083('0x2'));var moment=require(_0x1083('0x3'));var BPromise=require(_0x1083('0x4'));var Mustache=require(_0x1083('0x5'));var util=require(_0x1083('0x6'));var path=require('path');var sox=require(_0x1083('0x7'));var csv=require(_0x1083('0x8'));var ejs=require(_0x1083('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1083('0xa'));var squel=require('squel');var crypto=require(_0x1083('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1083('0xc'));var Papa=require('papaparse');var Redis=require(_0x1083('0xd'));var authService=require(_0x1083('0xe'));var qs=require(_0x1083('0xf'));var as=require(_0x1083('0x10'));var hardwareService=require(_0x1083('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1083('0x12'));var config=require(_0x1083('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1083('0x14'))['db'];function respondWithStatusCode(_0x3b6b37,_0x5f1b07){_0x5f1b07=_0x5f1b07||0xcc;return function(_0x51cb44){if(_0x51cb44){return _0x3b6b37[_0x1083('0x15')](_0x5f1b07);}return _0x3b6b37['status'](_0x5f1b07)[_0x1083('0x16')]();};}function respondWithResult(_0x59b4ef,_0x30840b){_0x30840b=_0x30840b||0xc8;return function(_0x5b17d3){if(_0x5b17d3){return _0x59b4ef[_0x1083('0x17')](_0x30840b)[_0x1083('0x18')](_0x5b17d3);}};}function respondWithFilteredResult(_0x8f9439,_0x3fd4d2){return function(_0x3318ce){if(_0x3318ce){var _0x1bb53b=typeof _0x3fd4d2['offset']===_0x1083('0x19')&&typeof _0x3fd4d2[_0x1083('0x1a')]==='undefined';var _0x4a2cb0=_0x3318ce['count'];var _0x4b7179=_0x1bb53b?0x0:_0x3fd4d2[_0x1083('0x1b')];var _0x43ece7=_0x1bb53b?_0x3318ce[_0x1083('0x1c')]:_0x3fd4d2[_0x1083('0x1b')]+_0x3fd4d2[_0x1083('0x1a')];var _0x27258e;if(_0x43ece7>=_0x4a2cb0){_0x43ece7=_0x4a2cb0;_0x27258e=0xc8;}else{_0x27258e=0xce;}_0x8f9439[_0x1083('0x17')](_0x27258e);return _0x8f9439[_0x1083('0x1d')](_0x1083('0x1e'),_0x4b7179+'-'+_0x43ece7+'/'+_0x4a2cb0)[_0x1083('0x18')](_0x3318ce);}return null;};}function patchUpdates(_0x4aff90){return function(_0x37b329){try{jsonpatch[_0x1083('0x1f')](_0x37b329,_0x4aff90,!![]);}catch(_0x142e16){return BPromise[_0x1083('0x20')](_0x142e16);}return _0x37b329['save']();};}function saveUpdates(_0x2f04d2,_0x4e3a90){return function(_0x18460b){if(_0x18460b){return _0x18460b[_0x1083('0x21')](_0x2f04d2)[_0x1083('0x22')](function(_0x188411){return _0x188411;});}return null;};}function removeEntity(_0x287e8a,_0x457e47){return function(_0x28b0bc){if(_0x28b0bc){return _0x28b0bc[_0x1083('0x23')]()['then'](function(){_0x287e8a['status'](0xcc)[_0x1083('0x16')]();});}};}function handleEntityNotFound(_0x5f50ac,_0x66d06){return function(_0x12ecae){if(!_0x12ecae){_0x5f50ac[_0x1083('0x15')](0x194);}return _0x12ecae;};}function handleError(_0x7a369a,_0x5a82c0){_0x5a82c0=_0x5a82c0||0x1f4;return function(_0xff4a7a){logger[_0x1083('0x24')](_0xff4a7a[_0x1083('0x25')]);if(_0xff4a7a[_0x1083('0x26')]){delete _0xff4a7a[_0x1083('0x26')];}_0x7a369a[_0x1083('0x17')](_0x5a82c0)[_0x1083('0x27')](_0xff4a7a);};}function getMustacheRender(_0x327344,_0x5dedaf){return Mustache[_0x1083('0x28')](_0x327344,_[_0x1083('0x29')](_0x5dedaf[_0x1083('0x2a')],{'contact':_0x5dedaf[_0x1083('0x2b')],'message':_0x5dedaf['message'],'agent':_0x5dedaf[_0x1083('0x2c')],'interaction':_0x5dedaf[_0x1083('0x2d')],'account':_0x5dedaf[_0x1083('0x2e')]}))||'';}exports[_0x1083('0x2f')]=function(_0xc1cc6e,_0x11c3c3){var _0x4ab7d8={},_0x5d9bc5={},_0x35d454={'count':0x0,'rows':[]};var _0x525e72=_[_0x1083('0x30')](db['MailTransferReport'][_0x1083('0x31')],function(_0x3f9e77){return{'name':_0x3f9e77[_0x1083('0x32')],'type':_0x3f9e77[_0x1083('0x33')]['key']};});_0x5d9bc5[_0x1083('0x34')]=_['map'](_0x525e72,'name');_0x5d9bc5[_0x1083('0x35')]=_['keys'](_0xc1cc6e['query']);_0x5d9bc5['filters']=_[_0x1083('0x36')](_0x5d9bc5[_0x1083('0x34')],_0x5d9bc5[_0x1083('0x35')]);_0x4ab7d8[_0x1083('0x37')]=_['intersection'](_0x5d9bc5[_0x1083('0x34')],qs[_0x1083('0x38')](_0xc1cc6e['query']['fields']));_0x4ab7d8[_0x1083('0x37')]=_0x4ab7d8['attributes']['length']?_0x4ab7d8[_0x1083('0x37')]:_0x5d9bc5[_0x1083('0x34')];if(!_0xc1cc6e[_0x1083('0x35')][_0x1083('0x39')](_0x1083('0x3a'))){_0x4ab7d8[_0x1083('0x1a')]=qs['limit'](_0xc1cc6e['query']['limit']);_0x4ab7d8[_0x1083('0x1b')]=qs['offset'](_0xc1cc6e[_0x1083('0x35')][_0x1083('0x1b')]);}_0x4ab7d8[_0x1083('0x3b')]=qs[_0x1083('0x3c')](_0xc1cc6e['query'][_0x1083('0x3c')]);_0x4ab7d8['where']=qs[_0x1083('0x3d')](_['pick'](_0xc1cc6e[_0x1083('0x35')],_0x5d9bc5[_0x1083('0x3d')]),_0x525e72);if(_0xc1cc6e[_0x1083('0x35')][_0x1083('0x3e')]){_0x4ab7d8[_0x1083('0x3f')]=_[_0x1083('0x29')](_0x4ab7d8['where'],{'$or':_[_0x1083('0x30')](_0x525e72,function(_0x46d5eb){if(_0x46d5eb[_0x1083('0x33')]!==_0x1083('0x40')){var _0x41bd2e={};_0x41bd2e[_0x46d5eb[_0x1083('0x26')]]={'$like':'%'+_0xc1cc6e[_0x1083('0x35')][_0x1083('0x3e')]+'%'};return _0x41bd2e;}})});}_0x4ab7d8=_[_0x1083('0x29')]({},_0x4ab7d8,_0xc1cc6e['options']);var _0x25a725={'where':_0x4ab7d8[_0x1083('0x3f')]};return db['MailTransferReport'][_0x1083('0x1c')](_0x25a725)[_0x1083('0x22')](function(_0x380b24){_0x35d454['count']=_0x380b24;if(_0xc1cc6e['query']['includeAll']){_0x4ab7d8['include']=[{'all':!![]}];}return db[_0x1083('0x41')]['findAll'](_0x4ab7d8);})['then'](function(_0x41f968){_0x35d454['rows']=_0x41f968;return _0x35d454;})[_0x1083('0x22')](respondWithFilteredResult(_0x11c3c3,_0x4ab7d8))[_0x1083('0x42')](handleError(_0x11c3c3,null));};exports[_0x1083('0x43')]=function(_0x527659,_0x598c6d){var _0x21896c={'raw':!![],'where':{'id':_0x527659[_0x1083('0x44')]['id']}},_0x5067c5={};_0x5067c5[_0x1083('0x34')]=_['keys'](db['MailTransferReport'][_0x1083('0x31')]);_0x5067c5['query']=_[_0x1083('0x45')](_0x527659[_0x1083('0x35')]);_0x5067c5[_0x1083('0x3d')]=_[_0x1083('0x36')](_0x5067c5['model'],_0x5067c5[_0x1083('0x35')]);_0x21896c[_0x1083('0x37')]=_[_0x1083('0x36')](_0x5067c5[_0x1083('0x34')],qs[_0x1083('0x38')](_0x527659['query'][_0x1083('0x38')]));_0x21896c[_0x1083('0x37')]=_0x21896c[_0x1083('0x37')][_0x1083('0x46')]?_0x21896c[_0x1083('0x37')]:_0x5067c5[_0x1083('0x34')];if(_0x527659[_0x1083('0x35')]['includeAll']){_0x21896c[_0x1083('0x47')]=[{'all':!![]}];}_0x21896c=_[_0x1083('0x29')]({},_0x21896c,_0x527659[_0x1083('0x48')]);return db[_0x1083('0x41')]['find'](_0x21896c)['then'](handleEntityNotFound(_0x598c6d,null))[_0x1083('0x22')](respondWithResult(_0x598c6d,null))['catch'](handleError(_0x598c6d,null));};exports['create']=function(_0x4d53a2,_0x1d1b87){return db[_0x1083('0x41')][_0x1083('0x49')](_0x4d53a2[_0x1083('0x2a')],{})[_0x1083('0x22')](respondWithResult(_0x1d1b87,0xc9))['catch'](handleError(_0x1d1b87,null));};exports[_0x1083('0x21')]=function(_0x3ca282,_0x4b0ea4){if(_0x3ca282[_0x1083('0x2a')]['id']){delete _0x3ca282['body']['id'];}return db[_0x1083('0x41')][_0x1083('0x4a')]({'where':{'id':_0x3ca282[_0x1083('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b0ea4,null))['then'](saveUpdates(_0x3ca282['body'],null))['then'](respondWithResult(_0x4b0ea4,null))['catch'](handleError(_0x4b0ea4,null));};exports[_0x1083('0x23')]=function(_0x141fbc,_0x2be0a7){return db['MailTransferReport']['find']({'where':{'id':_0x141fbc[_0x1083('0x44')]['id']}})[_0x1083('0x22')](handleEntityNotFound(_0x2be0a7,null))[_0x1083('0x22')](removeEntity(_0x2be0a7,null))[_0x1083('0x42')](handleError(_0x2be0a7,null));};exports[_0x1083('0x4b')]=function(_0x104692,_0xe0126d){return db[_0x1083('0x41')][_0x1083('0x4b')]()['then'](respondWithResult(_0xe0126d,null))[_0x1083('0x42')](handleError(_0xe0126d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9ddf83a..1f02816 100644 --- a/server/api/mailTransferReport/mailTransferReport.model.js +++ b/server/api/mailTransferReport/mailTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbae5=['request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xbae5,0xf7));var _0x5bae=function(_0x3f7761,_0x1094b0){_0x3f7761=_0x3f7761-0x0;var _0x10d894=_0xbae5[_0x3f7761];return _0x10d894;};'use strict';var _=require(_0x5bae('0x0'));var util=require(_0x5bae('0x1'));var logger=require(_0x5bae('0x2'))('api');var moment=require(_0x5bae('0x3'));var BPromise=require(_0x5bae('0x4'));var rp=require(_0x5bae('0x5'));var fs=require('fs');var path=require(_0x5bae('0x6'));var rimraf=require(_0x5bae('0x7'));var config=require(_0x5bae('0x8'));var attributes=require('./mailTransferReport.attributes');module[_0x5bae('0x9')]=function(_0x289bd2,_0x3ee26c){return _0x289bd2[_0x5bae('0xa')](_0x5bae('0xb'),attributes,{'tableName':_0x5bae('0xc'),'paranoid':![],'indexes':[{'name':_0x5bae('0xd'),'fields':[_0x5bae('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55a4=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','define','MailTransferReport','report_mail_transfer','uniqueid','lodash'];(function(_0x250f93,_0x4d6d01){var _0x55d6f3=function(_0x273605){while(--_0x273605){_0x250f93['push'](_0x250f93['shift']());}};_0x55d6f3(++_0x4d6d01);}(_0x55a4,0x112));var _0x455a=function(_0x57bafd,_0x4d6d48){_0x57bafd=_0x57bafd-0x0;var _0x407bf9=_0x55a4[_0x57bafd];return _0x407bf9;};'use strict';var _=require(_0x455a('0x0'));var util=require(_0x455a('0x1'));var logger=require(_0x455a('0x2'))(_0x455a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x455a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x455a('0x5'));var config=require(_0x455a('0x6'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x3800c6,_0x294ea4){return _0x3800c6[_0x455a('0x7')](_0x455a('0x8'),attributes,{'tableName':_0x455a('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x455a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 1cb0c16..50a9b04 100644 --- a/server/api/mailTransferReport/mailTransferReport.rpc.js +++ b/server/api/mailTransferReport/mailTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x379d=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x379d,0xa4));var _0xd379=function(_0x52b334,_0x3e36f4){_0x52b334=_0x52b334-0x0;var _0x52c593=_0x379d[_0x52b334];return _0x52c593;};'use strict';var _=require(_0xd379('0x0'));var util=require('util');var moment=require(_0xd379('0x1'));var BPromise=require(_0xd379('0x2'));var rs=require(_0xd379('0x3'));var fs=require('fs');var Redis=require(_0xd379('0x4'));var db=require(_0xd379('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd379('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd379('0x7'));var client=jayson[_0xd379('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x145ac0,_0x1785b2,_0x250fbd){return new BPromise(function(_0x4789e5,_0x586960){return client[_0xd379('0x9')](_0x145ac0,_0x250fbd)[_0xd379('0xa')](function(_0x3f98f9){logger[_0xd379('0xb')](_0xd379('0xc'),_0x1785b2,_0xd379('0xd'));logger['debug'](_0xd379('0xe'),_0x1785b2,_0xd379('0xd'),JSON[_0xd379('0xf')](_0x3f98f9));if(_0x3f98f9[_0xd379('0x10')]){if(_0x3f98f9[_0xd379('0x10')][_0xd379('0x11')]===0x1f4){logger[_0xd379('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x1785b2,_0x3f98f9['error'][_0xd379('0x12')]);return _0x586960(_0x3f98f9['error'][_0xd379('0x12')]);}logger['error'](_0xd379('0xc'),_0x1785b2,_0x3f98f9[_0xd379('0x10')][_0xd379('0x12')]);return _0x4789e5(_0x3f98f9[_0xd379('0x10')][_0xd379('0x12')]);}else{logger['info'](_0xd379('0xc'),_0x1785b2,_0xd379('0xd'));_0x4789e5(_0x3f98f9[_0xd379('0x13')][_0xd379('0x12')]);}})['catch'](function(_0x2802bd){logger[_0xd379('0x10')](_0xd379('0xc'),_0x1785b2,_0x2802bd);_0x586960(_0x2802bd);});});} \ No newline at end of file +var _0xf88e=['lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf88e,0x1c8));var _0xef88=function(_0x845041,_0x1c2043){_0x845041=_0x845041-0x0;var _0x2f8542=_0xf88e[_0x845041];return _0x2f8542;};'use strict';var _=require(_0xef88('0x0'));var util=require(_0xef88('0x1'));var moment=require(_0xef88('0x2'));var BPromise=require(_0xef88('0x3'));var rs=require(_0xef88('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef88('0x5'))(_0xef88('0x6'));var config=require(_0xef88('0x7'));var jayson=require(_0xef88('0x8'));var client=jayson[_0xef88('0x9')][_0xef88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e08d3,_0x33ad7f,_0x3eb579){return new BPromise(function(_0x564d25,_0xf0039f){return client[_0xef88('0xb')](_0x2e08d3,_0x3eb579)[_0xef88('0xc')](function(_0x58031a){logger['info'](_0xef88('0xd'),_0x33ad7f,_0xef88('0xe'));logger[_0xef88('0xf')](_0xef88('0x10'),_0x33ad7f,_0xef88('0xe'),JSON[_0xef88('0x11')](_0x58031a));if(_0x58031a[_0xef88('0x12')]){if(_0x58031a[_0xef88('0x12')][_0xef88('0x13')]===0x1f4){logger[_0xef88('0x12')](_0xef88('0xd'),_0x33ad7f,_0x58031a[_0xef88('0x12')][_0xef88('0x14')]);return _0xf0039f(_0x58031a[_0xef88('0x12')][_0xef88('0x14')]);}logger[_0xef88('0x12')](_0xef88('0xd'),_0x33ad7f,_0x58031a[_0xef88('0x12')][_0xef88('0x14')]);return _0x564d25(_0x58031a['error'][_0xef88('0x14')]);}else{logger[_0xef88('0x15')](_0xef88('0xd'),_0x33ad7f,_0xef88('0xe'));_0x564d25(_0x58031a[_0xef88('0x16')][_0xef88('0x14')]);}})[_0xef88('0x17')](function(_0x707f85){logger[_0xef88('0x12')](_0xef88('0xd'),_0x33ad7f,_0x707f85);_0xf0039f(_0x707f85);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0e03c02..8c59fca 100644 --- a/server/api/memberReport/index.js +++ b/server/api/memberReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2237=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','/:id'];(function(_0xdbbd74,_0x386abd){var _0x6bbe4b=function(_0x345017){while(--_0x345017){_0xdbbd74['push'](_0xdbbd74['shift']());}};_0x6bbe4b(++_0x386abd);}(_0x2237,0x124));var _0x7223=function(_0x44034d,_0x1e3a17){_0x44034d=_0x44034d-0x0;var _0x2d1310=_0x2237[_0x44034d];return _0x2d1310;};'use strict';var multer=require(_0x7223('0x0'));var util=require(_0x7223('0x1'));var path=require(_0x7223('0x2'));var timeout=require(_0x7223('0x3'));var express=require(_0x7223('0x4'));var router=express[_0x7223('0x5')]();var fs_extra=require(_0x7223('0x6'));var auth=require(_0x7223('0x7'));var interaction=require(_0x7223('0x8'));var config=require(_0x7223('0x9'));var controller=require('./memberReport.controller');router[_0x7223('0xa')]('/',auth[_0x7223('0xb')](),controller['index']);router[_0x7223('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x7223('0xb')](),controller['show']);router['post']('/',auth[_0x7223('0xb')](),controller['create']);router[_0x7223('0xc')](_0x7223('0xd'),auth['isAuthenticated'](),controller[_0x7223('0xe')]);router[_0x7223('0xf')]('/:id',auth[_0x7223('0xb')](),controller[_0x7223('0x10')]);module[_0x7223('0x11')]=router; \ No newline at end of file +var _0x39f3=['show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x3843c7,_0x8a5f8d){var _0x592c41=function(_0x1b632a){while(--_0x1b632a){_0x3843c7['push'](_0x3843c7['shift']());}};_0x592c41(++_0x8a5f8d);}(_0x39f3,0x181));var _0x339f=function(_0x4f55ea,_0x37185d){_0x4f55ea=_0x4f55ea-0x0;var _0x5ad76a=_0x39f3[_0x4f55ea];return _0x5ad76a;};'use strict';var multer=require(_0x339f('0x0'));var util=require(_0x339f('0x1'));var path=require(_0x339f('0x2'));var timeout=require('connect-timeout');var express=require(_0x339f('0x3'));var router=express[_0x339f('0x4')]();var fs_extra=require(_0x339f('0x5'));var auth=require(_0x339f('0x6'));var interaction=require(_0x339f('0x7'));var config=require('../../config/environment');var controller=require(_0x339f('0x8'));router[_0x339f('0x9')]('/',auth[_0x339f('0xa')](),controller[_0x339f('0xb')]);router[_0x339f('0x9')](_0x339f('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x339f('0x9')](_0x339f('0xd'),auth[_0x339f('0xa')](),controller[_0x339f('0xe')]);router['post']('/',auth[_0x339f('0xa')](),controller[_0x339f('0xf')]);router[_0x339f('0x10')](_0x339f('0xd'),auth[_0x339f('0xa')](),controller[_0x339f('0x11')]);router[_0x339f('0x12')](_0x339f('0xd'),auth[_0x339f('0xa')](),controller[_0x339f('0x13')]);module[_0x339f('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7bbedec..caf61fd 100644 --- a/server/api/memberReport/memberReport.attributes.js +++ b/server/api/memberReport/memberReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2239=['exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','enterAt','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment'];(function(_0x83fd10,_0x308737){var _0x477235=function(_0xf20ee5){while(--_0xf20ee5){_0x83fd10['push'](_0x83fd10['shift']());}};_0x477235(++_0x308737);}(_0x2239,0xee));var _0x9223=function(_0x558d31,_0x12a080){_0x558d31=_0x558d31-0x0;var _0x26f639=_0x2239[_0x558d31];return _0x26f639;};'use strict';var Sequelize=require(_0x9223('0x0'));var moment=require(_0x9223('0x1'));module[_0x9223('0x2')]={'channel':{'type':Sequelize[_0x9223('0x3')]},'membername':{'type':Sequelize[_0x9223('0x3')]},'interface':{'type':Sequelize[_0x9223('0x3')]},'type':{'type':Sequelize[_0x9223('0x3')],'defaultValue':_0x9223('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x9223('0x5')]},'enterAt':{'type':Sequelize[_0x9223('0x6')]},'exitAt':{'type':Sequelize[_0x9223('0x6')],'set':function(_0x3cc5e8){var _0x3daf59=moment(_0x3cc5e8);var _0x2bc122=moment(this['getDataValue'](_0x9223('0x7')));var _0x3ab509=_0x3daf59[_0x9223('0x8')](_0x2bc122,_0x9223('0x9'));this[_0x9223('0xa')]('exitAt',_0x3cc5e8);this[_0x9223('0xa')]('duration',_0x3ab509||null);}},'data1':{'type':Sequelize[_0x9223('0x3')],'comment':_0x9223('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x9223('0xc')},'data3':{'type':Sequelize[_0x9223('0x3')],'comment':_0x9223('0xd')},'data4':{'type':Sequelize[_0x9223('0x3')],'comment':_0x9223('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x9223('0xf')},'role':{'type':Sequelize[_0x9223('0x3')]},'internal':{'type':Sequelize[_0x9223('0x5')]},'uniqueid':{'type':Sequelize[_0x9223('0x3')]}}; \ No newline at end of file +var _0x1917=['enterAt','diff','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1917,0x1e5));var _0x7191=function(_0x34ae20,_0x36124a){_0x34ae20=_0x34ae20-0x0;var _0x22e16c=_0x1917[_0x34ae20];return _0x22e16c;};'use strict';var Sequelize=require(_0x7191('0x0'));var moment=require(_0x7191('0x1'));module[_0x7191('0x2')]={'channel':{'type':Sequelize[_0x7191('0x3')]},'membername':{'type':Sequelize[_0x7191('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7191('0x3')],'defaultValue':_0x7191('0x4'),'comment':_0x7191('0x5')},'duration':{'type':Sequelize[_0x7191('0x6')]},'enterAt':{'type':Sequelize[_0x7191('0x7')]},'exitAt':{'type':Sequelize[_0x7191('0x7')],'set':function(_0x33e33e){var _0x48e750=moment(_0x33e33e);var _0x41402c=moment(this[_0x7191('0x8')](_0x7191('0x9')));var _0x25d13=_0x48e750[_0x7191('0xa')](_0x41402c,'seconds');this['setDataValue'](_0x7191('0xb'),_0x33e33e);this[_0x7191('0xc')](_0x7191('0xd'),_0x25d13||null);}},'data1':{'type':Sequelize[_0x7191('0x3')],'comment':_0x7191('0xe')},'data2':{'type':Sequelize[_0x7191('0x3')],'comment':_0x7191('0xf')},'data3':{'type':Sequelize[_0x7191('0x3')],'comment':_0x7191('0x10')},'data4':{'type':Sequelize['STRING'],'comment':_0x7191('0x11')},'data5':{'type':Sequelize[_0x7191('0x3')],'comment':_0x7191('0x12')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x7191('0x6')]},'uniqueid':{'type':Sequelize[_0x7191('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0be25d9..696cdcd 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8336=['intersection','attributes','model','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','then','rows','catch','show','params','fields','MemberReport','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','render','body','interaction','index','map','rawAttributes','fieldName','key','keys','query','filters'];(function(_0x2289cc,_0x25f69f){var _0x1e2edc=function(_0x138327){while(--_0x138327){_0x2289cc['push'](_0x2289cc['shift']());}};_0x1e2edc(++_0x25f69f);}(_0x8336,0x1a5));var _0x6833=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x8336[_0x3a7634];return _0x23bbe9;};'use strict';var emlformat=require(_0x6833('0x0'));var rimraf=require(_0x6833('0x1'));var zipdir=require(_0x6833('0x2'));var jsonpatch=require(_0x6833('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6833('0x4'));var Mustache=require('mustache');var util=require(_0x6833('0x5'));var path=require('path');var sox=require(_0x6833('0x6'));var csv=require(_0x6833('0x7'));var ejs=require(_0x6833('0x8'));var fs=require('fs');var fs_extra=require(_0x6833('0x9'));var _=require(_0x6833('0xa'));var squel=require(_0x6833('0xb'));var crypto=require(_0x6833('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6833('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6833('0xe'));var Papa=require(_0x6833('0xf'));var Redis=require(_0x6833('0x10'));var authService=require(_0x6833('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6833('0x12'));var hardwareService=require(_0x6833('0x13'));var logger=require('../../config/logger')(_0x6833('0x14'));var utils=require(_0x6833('0x15'));var config=require(_0x6833('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6833('0x17'))['db'];function respondWithStatusCode(_0x24074d,_0x28b442){_0x28b442=_0x28b442||0xcc;return function(_0x57f9ed){if(_0x57f9ed){return _0x24074d[_0x6833('0x18')](_0x28b442);}return _0x24074d[_0x6833('0x19')](_0x28b442)[_0x6833('0x1a')]();};}function respondWithResult(_0xb01cc0,_0x239a1b){_0x239a1b=_0x239a1b||0xc8;return function(_0xe69a9){if(_0xe69a9){return _0xb01cc0[_0x6833('0x19')](_0x239a1b)[_0x6833('0x1b')](_0xe69a9);}};}function respondWithFilteredResult(_0xff982,_0x1e5d90){return function(_0x50cb00){if(_0x50cb00){var _0x18a161=typeof _0x1e5d90['offset']===_0x6833('0x1c')&&typeof _0x1e5d90[_0x6833('0x1d')]===_0x6833('0x1c');var _0x1ca707=_0x50cb00[_0x6833('0x1e')];var _0x397580=_0x18a161?0x0:_0x1e5d90[_0x6833('0x1f')];var _0x50b588=_0x18a161?_0x50cb00[_0x6833('0x1e')]:_0x1e5d90[_0x6833('0x1f')]+_0x1e5d90['limit'];var _0x2591e3;if(_0x50b588>=_0x1ca707){_0x50b588=_0x1ca707;_0x2591e3=0xc8;}else{_0x2591e3=0xce;}_0xff982[_0x6833('0x19')](_0x2591e3);return _0xff982[_0x6833('0x20')](_0x6833('0x21'),_0x397580+'-'+_0x50b588+'/'+_0x1ca707)[_0x6833('0x1b')](_0x50cb00);}return null;};}function patchUpdates(_0x32eb79){return function(_0x5702b3){try{jsonpatch[_0x6833('0x22')](_0x5702b3,_0x32eb79,!![]);}catch(_0xd7d80b){return BPromise[_0x6833('0x23')](_0xd7d80b);}return _0x5702b3[_0x6833('0x24')]();};}function saveUpdates(_0x1c1f4e,_0x5f5015){return function(_0x4919c5){if(_0x4919c5){return _0x4919c5[_0x6833('0x25')](_0x1c1f4e)['then'](function(_0x3c5588){return _0x3c5588;});}return null;};}function removeEntity(_0x2156ec,_0x345762){return function(_0x58dc0d){if(_0x58dc0d){return _0x58dc0d[_0x6833('0x26')]()['then'](function(){_0x2156ec[_0x6833('0x19')](0xcc)[_0x6833('0x1a')]();});}};}function handleEntityNotFound(_0x6d3e84,_0x3f36b6){return function(_0x6bfc0){if(!_0x6bfc0){_0x6d3e84[_0x6833('0x18')](0x194);}return _0x6bfc0;};}function handleError(_0x41fe3f,_0x466fc3){_0x466fc3=_0x466fc3||0x1f4;return function(_0x52ef94){logger[_0x6833('0x27')](_0x52ef94[_0x6833('0x28')]);if(_0x52ef94[_0x6833('0x29')]){delete _0x52ef94[_0x6833('0x29')];}_0x41fe3f[_0x6833('0x19')](_0x466fc3)['send'](_0x52ef94);};}function getMustacheRender(_0x124391,_0x5dc3d2){return Mustache[_0x6833('0x2a')](_0x124391,_['merge'](_0x5dc3d2[_0x6833('0x2b')],{'contact':_0x5dc3d2['contact'],'message':_0x5dc3d2['message'],'agent':_0x5dc3d2['agent'],'interaction':_0x5dc3d2[_0x6833('0x2c')],'account':_0x5dc3d2['account']}))||'';}exports[_0x6833('0x2d')]=function(_0x161d38,_0x28e767){var _0xd4fb5={},_0x47668f={},_0x57682f={'count':0x0,'rows':[]};var _0x4d58f9=_[_0x6833('0x2e')](db['MemberReport'][_0x6833('0x2f')],function(_0x38f414){return{'name':_0x38f414[_0x6833('0x30')],'type':_0x38f414['type'][_0x6833('0x31')]};});_0x47668f['model']=_[_0x6833('0x2e')](_0x4d58f9,_0x6833('0x29'));_0x47668f['query']=_[_0x6833('0x32')](_0x161d38[_0x6833('0x33')]);_0x47668f[_0x6833('0x34')]=_[_0x6833('0x35')](_0x47668f['model'],_0x47668f[_0x6833('0x33')]);_0xd4fb5[_0x6833('0x36')]=_['intersection'](_0x47668f[_0x6833('0x37')],qs['fields'](_0x161d38['query']['fields']));_0xd4fb5[_0x6833('0x36')]=_0xd4fb5[_0x6833('0x36')][_0x6833('0x38')]?_0xd4fb5[_0x6833('0x36')]:_0x47668f[_0x6833('0x37')];if(!_0x161d38[_0x6833('0x33')]['hasOwnProperty'](_0x6833('0x39'))){_0xd4fb5[_0x6833('0x1d')]=qs[_0x6833('0x1d')](_0x161d38[_0x6833('0x33')][_0x6833('0x1d')]);_0xd4fb5['offset']=qs[_0x6833('0x1f')](_0x161d38[_0x6833('0x33')][_0x6833('0x1f')]);}_0xd4fb5[_0x6833('0x3a')]=qs[_0x6833('0x3b')](_0x161d38[_0x6833('0x33')][_0x6833('0x3b')]);_0xd4fb5[_0x6833('0x3c')]=qs[_0x6833('0x34')](_[_0x6833('0x3d')](_0x161d38[_0x6833('0x33')],_0x47668f['filters']),_0x4d58f9);if(_0x161d38['query'][_0x6833('0x3e')]){_0xd4fb5[_0x6833('0x3c')]=_[_0x6833('0x3f')](_0xd4fb5[_0x6833('0x3c')],{'$or':_[_0x6833('0x2e')](_0x4d58f9,function(_0x16adda){if(_0x16adda[_0x6833('0x40')]!=='VIRTUAL'){var _0x26decb={};_0x26decb[_0x16adda['name']]={'$like':'%'+_0x161d38[_0x6833('0x33')][_0x6833('0x3e')]+'%'};return _0x26decb;}})});}_0xd4fb5=_[_0x6833('0x3f')]({},_0xd4fb5,_0x161d38[_0x6833('0x41')]);var _0x30f304={'where':_0xd4fb5['where']};return db['MemberReport'][_0x6833('0x1e')](_0x30f304)['then'](function(_0x5f48b5){_0x57682f[_0x6833('0x1e')]=_0x5f48b5;if(_0x161d38[_0x6833('0x33')][_0x6833('0x42')]){_0xd4fb5[_0x6833('0x43')]=[{'all':!![]}];}return db['MemberReport'][_0x6833('0x44')](_0xd4fb5);})[_0x6833('0x45')](function(_0x4c1ace){_0x57682f[_0x6833('0x46')]=_0x4c1ace;return _0x57682f;})['then'](respondWithFilteredResult(_0x28e767,_0xd4fb5))[_0x6833('0x47')](handleError(_0x28e767,null));};exports[_0x6833('0x48')]=function(_0x21acb7,_0x1a1f03){var _0x19f04a={'raw':!![],'where':{'id':_0x21acb7[_0x6833('0x49')]['id']}},_0x15d9c1={};_0x15d9c1[_0x6833('0x37')]=_[_0x6833('0x32')](db['MemberReport'][_0x6833('0x2f')]);_0x15d9c1[_0x6833('0x33')]=_[_0x6833('0x32')](_0x21acb7['query']);_0x15d9c1[_0x6833('0x34')]=_[_0x6833('0x35')](_0x15d9c1[_0x6833('0x37')],_0x15d9c1[_0x6833('0x33')]);_0x19f04a[_0x6833('0x36')]=_[_0x6833('0x35')](_0x15d9c1[_0x6833('0x37')],qs[_0x6833('0x4a')](_0x21acb7[_0x6833('0x33')]['fields']));_0x19f04a[_0x6833('0x36')]=_0x19f04a[_0x6833('0x36')]['length']?_0x19f04a['attributes']:_0x15d9c1['model'];if(_0x21acb7[_0x6833('0x33')][_0x6833('0x42')]){_0x19f04a[_0x6833('0x43')]=[{'all':!![]}];}_0x19f04a=_[_0x6833('0x3f')]({},_0x19f04a,_0x21acb7[_0x6833('0x41')]);return db[_0x6833('0x4b')][_0x6833('0x4c')](_0x19f04a)['then'](handleEntityNotFound(_0x1a1f03,null))[_0x6833('0x45')](respondWithResult(_0x1a1f03,null))[_0x6833('0x47')](handleError(_0x1a1f03,null));};exports['create']=function(_0x474199,_0x131756){return db[_0x6833('0x4b')][_0x6833('0x4d')](_0x474199[_0x6833('0x2b')],{})[_0x6833('0x45')](respondWithResult(_0x131756,0xc9))['catch'](handleError(_0x131756,null));};exports['update']=function(_0x17d5fd,_0x32fa18){if(_0x17d5fd[_0x6833('0x2b')]['id']){delete _0x17d5fd[_0x6833('0x2b')]['id'];}return db['MemberReport'][_0x6833('0x4c')]({'where':{'id':_0x17d5fd[_0x6833('0x49')]['id']}})['then'](handleEntityNotFound(_0x32fa18,null))[_0x6833('0x45')](saveUpdates(_0x17d5fd[_0x6833('0x2b')],null))[_0x6833('0x45')](respondWithResult(_0x32fa18,null))[_0x6833('0x47')](handleError(_0x32fa18,null));};exports[_0x6833('0x26')]=function(_0x14d4e7,_0x28c418){return db[_0x6833('0x4b')][_0x6833('0x4c')]({'where':{'id':_0x14d4e7[_0x6833('0x49')]['id']}})['then'](handleEntityNotFound(_0x28c418,null))[_0x6833('0x45')](removeEntity(_0x28c418,null))[_0x6833('0x47')](handleError(_0x28c418,null));};exports[_0x6833('0x4e')]=function(_0x326e7a,_0x420622){return db[_0x6833('0x4b')]['describe']()[_0x6833('0x45')](respondWithResult(_0x420622,null))['catch'](handleError(_0x420622,null));}; \ No newline at end of file +var _0x8f3b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','apply','reject','update','then','destroy','end','error','name','send','render','merge','body','contact','message','interaction','account','index','rawAttributes','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','options','includeAll','include','MemberReport','findAll','rows','show','params','intersection','find','catch','create','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x416f8c,_0x1049c1){var _0x4d1841=function(_0x3d25e5){while(--_0x3d25e5){_0x416f8c['push'](_0x416f8c['shift']());}};_0x4d1841(++_0x1049c1);}(_0x8f3b,0x131));var _0xb8f3=function(_0x12ea4c,_0x2e90dd){_0x12ea4c=_0x12ea4c-0x0;var _0x2f0f51=_0x8f3b[_0x12ea4c];return _0x2f0f51;};'use strict';var emlformat=require(_0xb8f3('0x0'));var rimraf=require(_0xb8f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb8f3('0x2'));var moment=require(_0xb8f3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb8f3('0x4'));var util=require(_0xb8f3('0x5'));var path=require(_0xb8f3('0x6'));var sox=require(_0xb8f3('0x7'));var csv=require(_0xb8f3('0x8'));var ejs=require(_0xb8f3('0x9'));var fs=require('fs');var fs_extra=require(_0xb8f3('0xa'));var _=require(_0xb8f3('0xb'));var squel=require(_0xb8f3('0xc'));var crypto=require(_0xb8f3('0xd'));var jsforce=require(_0xb8f3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8f3('0xf'));var Papa=require(_0xb8f3('0x10'));var Redis=require(_0xb8f3('0x11'));var authService=require(_0xb8f3('0x12'));var qs=require(_0xb8f3('0x13'));var as=require(_0xb8f3('0x14'));var hardwareService=require(_0xb8f3('0x15'));var logger=require('../../config/logger')(_0xb8f3('0x16'));var utils=require(_0xb8f3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb8f3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e4614,_0x4ef33c){_0x4ef33c=_0x4ef33c||0xcc;return function(_0x52fd3c){if(_0x52fd3c){return _0x5e4614[_0xb8f3('0x19')](_0x4ef33c);}return _0x5e4614[_0xb8f3('0x1a')](_0x4ef33c)['end']();};}function respondWithResult(_0x251613,_0x3bf1cc){_0x3bf1cc=_0x3bf1cc||0xc8;return function(_0x16acee){if(_0x16acee){return _0x251613['status'](_0x3bf1cc)[_0xb8f3('0x1b')](_0x16acee);}};}function respondWithFilteredResult(_0x55bd18,_0x284302){return function(_0x2c951c){if(_0x2c951c){var _0x1f7b12=typeof _0x284302['offset']==='undefined'&&typeof _0x284302[_0xb8f3('0x1c')]===_0xb8f3('0x1d');var _0x1badea=_0x2c951c[_0xb8f3('0x1e')];var _0x5992d0=_0x1f7b12?0x0:_0x284302[_0xb8f3('0x1f')];var _0x5317ab=_0x1f7b12?_0x2c951c['count']:_0x284302['offset']+_0x284302[_0xb8f3('0x1c')];var _0x2916e3;if(_0x5317ab>=_0x1badea){_0x5317ab=_0x1badea;_0x2916e3=0xc8;}else{_0x2916e3=0xce;}_0x55bd18[_0xb8f3('0x1a')](_0x2916e3);return _0x55bd18['set']('Content-Range',_0x5992d0+'-'+_0x5317ab+'/'+_0x1badea)[_0xb8f3('0x1b')](_0x2c951c);}return null;};}function patchUpdates(_0x51c2ad){return function(_0xa726bd){try{jsonpatch[_0xb8f3('0x20')](_0xa726bd,_0x51c2ad,!![]);}catch(_0x4cb5b7){return BPromise[_0xb8f3('0x21')](_0x4cb5b7);}return _0xa726bd['save']();};}function saveUpdates(_0x49a2bf,_0x134a1d){return function(_0x493e03){if(_0x493e03){return _0x493e03[_0xb8f3('0x22')](_0x49a2bf)[_0xb8f3('0x23')](function(_0x285b34){return _0x285b34;});}return null;};}function removeEntity(_0x13d886,_0x294645){return function(_0x531c83){if(_0x531c83){return _0x531c83[_0xb8f3('0x24')]()[_0xb8f3('0x23')](function(){_0x13d886['status'](0xcc)[_0xb8f3('0x25')]();});}};}function handleEntityNotFound(_0x57bd6a,_0x3bded0){return function(_0x2f73ef){if(!_0x2f73ef){_0x57bd6a['sendStatus'](0x194);}return _0x2f73ef;};}function handleError(_0x42f892,_0xc36d2b){_0xc36d2b=_0xc36d2b||0x1f4;return function(_0xc43ad8){logger[_0xb8f3('0x26')](_0xc43ad8['stack']);if(_0xc43ad8['name']){delete _0xc43ad8[_0xb8f3('0x27')];}_0x42f892[_0xb8f3('0x1a')](_0xc36d2b)[_0xb8f3('0x28')](_0xc43ad8);};}function getMustacheRender(_0x33280c,_0x1c8958){return Mustache[_0xb8f3('0x29')](_0x33280c,_[_0xb8f3('0x2a')](_0x1c8958[_0xb8f3('0x2b')],{'contact':_0x1c8958[_0xb8f3('0x2c')],'message':_0x1c8958[_0xb8f3('0x2d')],'agent':_0x1c8958['agent'],'interaction':_0x1c8958[_0xb8f3('0x2e')],'account':_0x1c8958[_0xb8f3('0x2f')]}))||'';}exports[_0xb8f3('0x30')]=function(_0x15ed08,_0x35bae1){var _0x339b44={},_0x3c9d75={},_0x27f98b={'count':0x0,'rows':[]};var _0x94e8b7=_['map'](db['MemberReport'][_0xb8f3('0x31')],function(_0x2b312d){return{'name':_0x2b312d['fieldName'],'type':_0x2b312d['type'][_0xb8f3('0x32')]};});_0x3c9d75[_0xb8f3('0x33')]=_[_0xb8f3('0x34')](_0x94e8b7,_0xb8f3('0x27'));_0x3c9d75[_0xb8f3('0x35')]=_[_0xb8f3('0x36')](_0x15ed08[_0xb8f3('0x35')]);_0x3c9d75['filters']=_['intersection'](_0x3c9d75[_0xb8f3('0x33')],_0x3c9d75[_0xb8f3('0x35')]);_0x339b44[_0xb8f3('0x37')]=_['intersection'](_0x3c9d75[_0xb8f3('0x33')],qs[_0xb8f3('0x38')](_0x15ed08[_0xb8f3('0x35')]['fields']));_0x339b44[_0xb8f3('0x37')]=_0x339b44['attributes'][_0xb8f3('0x39')]?_0x339b44[_0xb8f3('0x37')]:_0x3c9d75[_0xb8f3('0x33')];if(!_0x15ed08[_0xb8f3('0x35')][_0xb8f3('0x3a')](_0xb8f3('0x3b'))){_0x339b44['limit']=qs[_0xb8f3('0x1c')](_0x15ed08[_0xb8f3('0x35')][_0xb8f3('0x1c')]);_0x339b44[_0xb8f3('0x1f')]=qs[_0xb8f3('0x1f')](_0x15ed08['query'][_0xb8f3('0x1f')]);}_0x339b44[_0xb8f3('0x3c')]=qs[_0xb8f3('0x3d')](_0x15ed08[_0xb8f3('0x35')][_0xb8f3('0x3d')]);_0x339b44['where']=qs[_0xb8f3('0x3e')](_[_0xb8f3('0x3f')](_0x15ed08[_0xb8f3('0x35')],_0x3c9d75['filters']),_0x94e8b7);if(_0x15ed08[_0xb8f3('0x35')][_0xb8f3('0x40')]){_0x339b44[_0xb8f3('0x41')]=_[_0xb8f3('0x2a')](_0x339b44['where'],{'$or':_[_0xb8f3('0x34')](_0x94e8b7,function(_0x39d669){if(_0x39d669[_0xb8f3('0x42')]!==_0xb8f3('0x43')){var _0x2bf853={};_0x2bf853[_0x39d669[_0xb8f3('0x27')]]={'$like':'%'+_0x15ed08['query']['filter']+'%'};return _0x2bf853;}})});}_0x339b44=_[_0xb8f3('0x2a')]({},_0x339b44,_0x15ed08[_0xb8f3('0x44')]);var _0x33ae24={'where':_0x339b44['where']};return db['MemberReport'][_0xb8f3('0x1e')](_0x33ae24)[_0xb8f3('0x23')](function(_0x1eadfa){_0x27f98b[_0xb8f3('0x1e')]=_0x1eadfa;if(_0x15ed08[_0xb8f3('0x35')][_0xb8f3('0x45')]){_0x339b44[_0xb8f3('0x46')]=[{'all':!![]}];}return db[_0xb8f3('0x47')][_0xb8f3('0x48')](_0x339b44);})['then'](function(_0x1f9a59){_0x27f98b[_0xb8f3('0x49')]=_0x1f9a59;return _0x27f98b;})[_0xb8f3('0x23')](respondWithFilteredResult(_0x35bae1,_0x339b44))['catch'](handleError(_0x35bae1,null));};exports[_0xb8f3('0x4a')]=function(_0x38f51b,_0x4d89c4){var _0x22edfa={'raw':!![],'where':{'id':_0x38f51b[_0xb8f3('0x4b')]['id']}},_0x140c54={};_0x140c54[_0xb8f3('0x33')]=_[_0xb8f3('0x36')](db[_0xb8f3('0x47')]['rawAttributes']);_0x140c54['query']=_[_0xb8f3('0x36')](_0x38f51b[_0xb8f3('0x35')]);_0x140c54[_0xb8f3('0x3e')]=_[_0xb8f3('0x4c')](_0x140c54[_0xb8f3('0x33')],_0x140c54['query']);_0x22edfa[_0xb8f3('0x37')]=_[_0xb8f3('0x4c')](_0x140c54[_0xb8f3('0x33')],qs['fields'](_0x38f51b[_0xb8f3('0x35')][_0xb8f3('0x38')]));_0x22edfa[_0xb8f3('0x37')]=_0x22edfa[_0xb8f3('0x37')][_0xb8f3('0x39')]?_0x22edfa['attributes']:_0x140c54['model'];if(_0x38f51b[_0xb8f3('0x35')][_0xb8f3('0x45')]){_0x22edfa['include']=[{'all':!![]}];}_0x22edfa=_['merge']({},_0x22edfa,_0x38f51b[_0xb8f3('0x44')]);return db[_0xb8f3('0x47')][_0xb8f3('0x4d')](_0x22edfa)[_0xb8f3('0x23')](handleEntityNotFound(_0x4d89c4,null))[_0xb8f3('0x23')](respondWithResult(_0x4d89c4,null))[_0xb8f3('0x4e')](handleError(_0x4d89c4,null));};exports['create']=function(_0x36cc6f,_0x2c67d0){return db[_0xb8f3('0x47')][_0xb8f3('0x4f')](_0x36cc6f[_0xb8f3('0x2b')],{})[_0xb8f3('0x23')](respondWithResult(_0x2c67d0,0xc9))[_0xb8f3('0x4e')](handleError(_0x2c67d0,null));};exports[_0xb8f3('0x22')]=function(_0x24393e,_0x28e253){if(_0x24393e[_0xb8f3('0x2b')]['id']){delete _0x24393e[_0xb8f3('0x2b')]['id'];}return db[_0xb8f3('0x47')][_0xb8f3('0x4d')]({'where':{'id':_0x24393e[_0xb8f3('0x4b')]['id']}})[_0xb8f3('0x23')](handleEntityNotFound(_0x28e253,null))[_0xb8f3('0x23')](saveUpdates(_0x24393e[_0xb8f3('0x2b')],null))['then'](respondWithResult(_0x28e253,null))[_0xb8f3('0x4e')](handleError(_0x28e253,null));};exports[_0xb8f3('0x24')]=function(_0x36b1bb,_0x3e0ea9){return db['MemberReport'][_0xb8f3('0x4d')]({'where':{'id':_0x36b1bb['params']['id']}})[_0xb8f3('0x23')](handleEntityNotFound(_0x3e0ea9,null))[_0xb8f3('0x23')](removeEntity(_0x3e0ea9,null))[_0xb8f3('0x4e')](handleError(_0x3e0ea9,null));};exports[_0xb8f3('0x50')]=function(_0x30061e,_0x428809){return db[_0xb8f3('0x47')][_0xb8f3('0x50')]()[_0xb8f3('0x23')](respondWithResult(_0x428809,null))[_0xb8f3('0x4e')](handleError(_0x428809,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d4ee3e1..967e44a 100644 --- a/server/api/memberReport/memberReport.model.js +++ b/server/api/memberReport/memberReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fad=['membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport'];(function(_0x3097fa,_0x331eb8){var _0xdc4e33=function(_0x2a048){while(--_0x2a048){_0x3097fa['push'](_0x3097fa['shift']());}};_0xdc4e33(++_0x331eb8);}(_0x3fad,0xc6));var _0xd3fa=function(_0x3b5ea4,_0x530045){_0x3b5ea4=_0x3b5ea4-0x0;var _0x28ac47=_0x3fad[_0x3b5ea4];return _0x28ac47;};'use strict';var _=require(_0xd3fa('0x0'));var util=require('util');var logger=require(_0xd3fa('0x1'))(_0xd3fa('0x2'));var moment=require(_0xd3fa('0x3'));var BPromise=require(_0xd3fa('0x4'));var rp=require(_0xd3fa('0x5'));var fs=require('fs');var path=require(_0xd3fa('0x6'));var rimraf=require(_0xd3fa('0x7'));var config=require('../../config/environment');var attributes=require(_0xd3fa('0x8'));module[_0xd3fa('0x9')]=function(_0x22389f,_0x2f74f1){return _0x22389f[_0xd3fa('0xa')](_0xd3fa('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xd3fa('0xc'),'fields':[_0xd3fa('0xd'),_0xd3fa('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf5f=['../../config/environment','exports','membername_interface','membername','interface','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xcf5f,0xe1));var _0xfcf5=function(_0x532cda,_0x1d0eaf){_0x532cda=_0x532cda-0x0;var _0x1fd91b=_0xcf5f[_0x532cda];return _0x1fd91b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfcf5('0x0'))(_0xfcf5('0x1'));var moment=require(_0xfcf5('0x2'));var BPromise=require(_0xfcf5('0x3'));var rp=require(_0xfcf5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcf5('0x5'));var config=require(_0xfcf5('0x6'));var attributes=require('./memberReport.attributes');module[_0xfcf5('0x7')]=function(_0x420f3b,_0x15316d){return _0x420f3b['define']('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xfcf5('0x8'),'fields':[_0xfcf5('0x9'),_0xfcf5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 19696e1..a217441 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec6d=['debug','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','model','map','CreateMemberReport','create','body','raw','stringify','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xec6d,0x101));var _0xdec6=function(_0x235ff2,_0x39d506){_0x235ff2=_0x235ff2-0x0;var _0x201bcf=_0xec6d[_0x235ff2];return _0x201bcf;};'use strict';var _=require(_0xdec6('0x0'));var util=require(_0xdec6('0x1'));var moment=require(_0xdec6('0x2'));var BPromise=require(_0xdec6('0x3'));var rs=require(_0xdec6('0x4'));var fs=require('fs');var Redis=require(_0xdec6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdec6('0x6'));var logger=require('../../config/logger')(_0xdec6('0x7'));var config=require('../../config/environment');var jayson=require(_0xdec6('0x8'));var client=jayson[_0xdec6('0x9')][_0xdec6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428b73,_0x4c917b,_0x15d1cb){return new BPromise(function(_0x5e7761,_0x3b223f){return client[_0xdec6('0xb')](_0x428b73,_0x15d1cb)[_0xdec6('0xc')](function(_0x28239a){logger[_0xdec6('0xd')](_0xdec6('0xe'),_0x4c917b,_0xdec6('0xf'));logger[_0xdec6('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x4c917b,_0xdec6('0xf'),JSON['stringify'](_0x28239a));if(_0x28239a[_0xdec6('0x11')]){if(_0x28239a[_0xdec6('0x11')][_0xdec6('0x12')]===0x1f4){logger[_0xdec6('0x11')](_0xdec6('0xe'),_0x4c917b,_0x28239a[_0xdec6('0x11')]['message']);return _0x3b223f(_0x28239a[_0xdec6('0x11')]['message']);}logger['error'](_0xdec6('0xe'),_0x4c917b,_0x28239a[_0xdec6('0x11')][_0xdec6('0x13')]);return _0x5e7761(_0x28239a['error'][_0xdec6('0x13')]);}else{logger['info'](_0xdec6('0xe'),_0x4c917b,'request\x20sent');_0x5e7761(_0x28239a[_0xdec6('0x14')][_0xdec6('0x13')]);}})[_0xdec6('0x15')](function(_0x55f83f){logger[_0xdec6('0x11')](_0xdec6('0xe'),_0x4c917b,_0x55f83f);_0x3b223f(_0x55f83f);});});}exports[_0xdec6('0x16')]=function(_0x494126){var _0x3b3d27=this;return new Promise(function(_0x1331ca,_0x31ac8a){return db[_0xdec6('0x17')][_0xdec6('0x18')]({'raw':_0x494126['options']?_0x494126['options']['raw']===undefined?!![]:![]:!![],'where':_0x494126[_0xdec6('0x19')]?_0x494126[_0xdec6('0x19')][_0xdec6('0x1a')]||null:null,'attributes':_0x494126[_0xdec6('0x19')]?_0x494126[_0xdec6('0x19')][_0xdec6('0x1b')]||null:null,'limit':_0x494126[_0xdec6('0x19')]?_0x494126[_0xdec6('0x19')][_0xdec6('0x1c')]||null:null,'include':_0x494126['options']?_0x494126[_0xdec6('0x19')][_0xdec6('0x1d')]?_['map'](_0x494126[_0xdec6('0x19')][_0xdec6('0x1d')],function(_0x17afca){return{'model':db[_0x17afca[_0xdec6('0x1e')]],'as':_0x17afca['as'],'attributes':_0x17afca[_0xdec6('0x1b')],'include':_0x17afca[_0xdec6('0x1d')]?_['map'](_0x17afca[_0xdec6('0x1d')],function(_0x4bd9fe){return{'model':db[_0x4bd9fe['model']],'as':_0x4bd9fe['as'],'attributes':_0x4bd9fe['attributes'],'include':_0x4bd9fe[_0xdec6('0x1d')]?_[_0xdec6('0x1f')](_0x4bd9fe[_0xdec6('0x1d')],function(_0x442695){return{'model':db[_0x442695[_0xdec6('0x1e')]],'as':_0x442695['as'],'attributes':_0x442695[_0xdec6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdec6('0xc')](function(_0x350ce9){logger[_0xdec6('0xd')](_0xdec6('0x16'),_0x494126);logger[_0xdec6('0x10')](_0xdec6('0x16'),_0x494126,JSON['stringify'](_0x350ce9));_0x1331ca(_0x350ce9);})['catch'](function(_0xb86a9){logger['error'](_0xdec6('0x16'),_0xb86a9[_0xdec6('0x13')],_0x494126);_0x31ac8a(_0x3b3d27[_0xdec6('0x11')](0x1f4,_0xb86a9[_0xdec6('0x13')]));});});};exports[_0xdec6('0x20')]=function(_0x2b2100){var _0x52a058=this;return new Promise(function(_0x215ccc,_0x317e25){return db[_0xdec6('0x17')][_0xdec6('0x21')](_0x2b2100[_0xdec6('0x22')],{'raw':_0x2b2100[_0xdec6('0x19')]?_0x2b2100[_0xdec6('0x19')][_0xdec6('0x23')]===undefined?!![]:![]:!![]})[_0xdec6('0xc')](function(_0x4a483f){logger['info'](_0xdec6('0x20'),_0x2b2100);logger[_0xdec6('0x10')](_0xdec6('0x20'),_0x2b2100,JSON[_0xdec6('0x24')](_0x4a483f));_0x215ccc(_0x4a483f);})[_0xdec6('0x15')](function(_0x4cf61f){logger[_0xdec6('0x11')](_0xdec6('0x20'),_0x4cf61f[_0xdec6('0x13')],_0x2b2100);_0x317e25(_0x52a058['error'](0x1f4,_0x4cf61f[_0xdec6('0x13')]));});});};exports[_0xdec6('0x25')]=function(_0xd019b4){var _0x24f2bd=this;return new Promise(function(_0x4c46bf,_0x1e9ed6){return db[_0xdec6('0x17')][_0xdec6('0x26')](_0xd019b4['body'],{'raw':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')][_0xdec6('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')][_0xdec6('0x1a')]||null:null,'attributes':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')][_0xdec6('0x1b')]||null:null,'limit':_0xd019b4[_0xdec6('0x19')]?_0xd019b4[_0xdec6('0x19')]['limit']||null:null})['then'](function(_0x2aea4d){logger[_0xdec6('0xd')](_0xdec6('0x25'),_0xd019b4);logger[_0xdec6('0x10')](_0xdec6('0x25'),_0xd019b4,JSON[_0xdec6('0x24')](_0x2aea4d));_0x4c46bf(_0x2aea4d);})[_0xdec6('0x15')](function(_0x2fd658){logger[_0xdec6('0x11')](_0xdec6('0x25'),_0x2fd658[_0xdec6('0x13')],_0xd019b4);_0x1e9ed6(_0x24f2bd[_0xdec6('0x11')](0x1f4,_0x2fd658[_0xdec6('0x13')]));});});}; \ No newline at end of file +var _0xc2aa=['CreateMemberReport','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetMemberReport','options','raw','where','attributes','limit','map','model','include','stringify','MemberReport','create','body'];(function(_0x4f57f1,_0x4f2ba3){var _0x1d1101=function(_0x484f25){while(--_0x484f25){_0x4f57f1['push'](_0x4f57f1['shift']());}};_0x1d1101(++_0x4f2ba3);}(_0xc2aa,0x189));var _0xac2a=function(_0xf64026,_0x43afd3){_0xf64026=_0xf64026-0x0;var _0x1050be=_0xc2aa[_0xf64026];return _0x1050be;};'use strict';var _=require(_0xac2a('0x0'));var util=require(_0xac2a('0x1'));var moment=require(_0xac2a('0x2'));var BPromise=require(_0xac2a('0x3'));var rs=require(_0xac2a('0x4'));var fs=require('fs');var Redis=require(_0xac2a('0x5'));var db=require(_0xac2a('0x6'))['db'];var utils=require(_0xac2a('0x7'));var logger=require(_0xac2a('0x8'))(_0xac2a('0x9'));var config=require(_0xac2a('0xa'));var jayson=require(_0xac2a('0xb'));var client=jayson[_0xac2a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21b9d8,_0x11e085,_0x1b3246){return new BPromise(function(_0xf0cc48,_0x56ddde){return client['request'](_0x21b9d8,_0x1b3246)[_0xac2a('0xd')](function(_0x3cf617){logger['info'](_0xac2a('0xe'),_0x11e085,'request\x20sent');logger[_0xac2a('0xf')](_0xac2a('0x10'),_0x11e085,_0xac2a('0x11'),JSON['stringify'](_0x3cf617));if(_0x3cf617[_0xac2a('0x12')]){if(_0x3cf617[_0xac2a('0x12')]['code']===0x1f4){logger['error'](_0xac2a('0xe'),_0x11e085,_0x3cf617[_0xac2a('0x12')]['message']);return _0x56ddde(_0x3cf617[_0xac2a('0x12')][_0xac2a('0x13')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x11e085,_0x3cf617['error'][_0xac2a('0x13')]);return _0xf0cc48(_0x3cf617['error'][_0xac2a('0x13')]);}else{logger[_0xac2a('0x14')](_0xac2a('0xe'),_0x11e085,_0xac2a('0x11'));_0xf0cc48(_0x3cf617[_0xac2a('0x15')][_0xac2a('0x13')]);}})[_0xac2a('0x16')](function(_0x2b4f94){logger[_0xac2a('0x12')](_0xac2a('0xe'),_0x11e085,_0x2b4f94);_0x56ddde(_0x2b4f94);});});}exports[_0xac2a('0x17')]=function(_0x286285){var _0x379e4e=this;return new Promise(function(_0x2a11a3,_0x4ae03a){return db['MemberReport']['findAll']({'raw':_0x286285[_0xac2a('0x18')]?_0x286285[_0xac2a('0x18')][_0xac2a('0x19')]===undefined?!![]:![]:!![],'where':_0x286285[_0xac2a('0x18')]?_0x286285[_0xac2a('0x18')][_0xac2a('0x1a')]||null:null,'attributes':_0x286285[_0xac2a('0x18')]?_0x286285[_0xac2a('0x18')][_0xac2a('0x1b')]||null:null,'limit':_0x286285[_0xac2a('0x18')]?_0x286285['options'][_0xac2a('0x1c')]||null:null,'include':_0x286285['options']?_0x286285[_0xac2a('0x18')]['include']?_[_0xac2a('0x1d')](_0x286285['options']['include'],function(_0x5c514f){return{'model':db[_0x5c514f[_0xac2a('0x1e')]],'as':_0x5c514f['as'],'attributes':_0x5c514f[_0xac2a('0x1b')],'include':_0x5c514f['include']?_[_0xac2a('0x1d')](_0x5c514f[_0xac2a('0x1f')],function(_0xda1a27){return{'model':db[_0xda1a27[_0xac2a('0x1e')]],'as':_0xda1a27['as'],'attributes':_0xda1a27[_0xac2a('0x1b')],'include':_0xda1a27['include']?_[_0xac2a('0x1d')](_0xda1a27['include'],function(_0x4322c0){return{'model':db[_0x4322c0[_0xac2a('0x1e')]],'as':_0x4322c0['as'],'attributes':_0x4322c0[_0xac2a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac2a('0xd')](function(_0x862725){logger['info'](_0xac2a('0x17'),_0x286285);logger['debug']('GetMemberReport',_0x286285,JSON[_0xac2a('0x20')](_0x862725));_0x2a11a3(_0x862725);})[_0xac2a('0x16')](function(_0x190d94){logger[_0xac2a('0x12')](_0xac2a('0x17'),_0x190d94[_0xac2a('0x13')],_0x286285);_0x4ae03a(_0x379e4e['error'](0x1f4,_0x190d94['message']));});});};exports['CreateMemberReport']=function(_0x75c3c){var _0x3acd50=this;return new Promise(function(_0xfd7053,_0x354c83){return db[_0xac2a('0x21')][_0xac2a('0x22')](_0x75c3c[_0xac2a('0x23')],{'raw':_0x75c3c[_0xac2a('0x18')]?_0x75c3c[_0xac2a('0x18')][_0xac2a('0x19')]===undefined?!![]:![]:!![]})[_0xac2a('0xd')](function(_0x38c707){logger[_0xac2a('0x14')](_0xac2a('0x24'),_0x75c3c);logger[_0xac2a('0xf')](_0xac2a('0x24'),_0x75c3c,JSON[_0xac2a('0x20')](_0x38c707));_0xfd7053(_0x38c707);})[_0xac2a('0x16')](function(_0x5a7930){logger[_0xac2a('0x12')](_0xac2a('0x24'),_0x5a7930[_0xac2a('0x13')],_0x75c3c);_0x354c83(_0x3acd50['error'](0x1f4,_0x5a7930['message']));});});};exports['UpdateMemberReport']=function(_0x47d352){var _0x5041e1=this;return new Promise(function(_0x134726,_0x5849e3){return db[_0xac2a('0x21')][_0xac2a('0x25')](_0x47d352['body'],{'raw':_0x47d352[_0xac2a('0x18')]?_0x47d352[_0xac2a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d352['options']?_0x47d352[_0xac2a('0x18')]['where']||null:null,'attributes':_0x47d352[_0xac2a('0x18')]?_0x47d352[_0xac2a('0x18')][_0xac2a('0x1b')]||null:null,'limit':_0x47d352[_0xac2a('0x18')]?_0x47d352[_0xac2a('0x18')]['limit']||null:null})['then'](function(_0x3c8a79){logger['info'](_0xac2a('0x26'),_0x47d352);logger[_0xac2a('0xf')](_0xac2a('0x26'),_0x47d352,JSON[_0xac2a('0x20')](_0x3c8a79));_0x134726(_0x3c8a79);})[_0xac2a('0x16')](function(_0x1d4f8d){logger[_0xac2a('0x12')](_0xac2a('0x26'),_0x1d4f8d[_0xac2a('0x13')],_0x47d352);_0x5849e3(_0x5041e1[_0xac2a('0x12')](0x1f4,_0x1d4f8d[_0xac2a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 3bf5e2b..8fe283a 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5636=['Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x5636,0x102));var _0x6563=function(_0x693c9c,_0x3f5091){_0x693c9c=_0x693c9c-0x0;var _0x9fc90=_0x5636[_0x693c9c];return _0x9fc90;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',controller[_0x6563('0x8')]);module[_0x6563('0x9')]=router; \ No newline at end of file +var _0x17ba=['index','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x5c8a7c,_0x3c4046){var _0x39ea96=function(_0x7008f4){while(--_0x7008f4){_0x5c8a7c['push'](_0x5c8a7c['shift']());}};_0x39ea96(++_0x3c4046);}(_0x17ba,0xab));var _0xa17b=function(_0x5612bf,_0x2ad139){_0x5612bf=_0x5612bf-0x0;var _0x234f4b=_0x17ba[_0x5612bf];return _0x234f4b;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',controller[_0xa17b('0xb')]);module[_0xa17b('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e38811a..113b20c 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7fc=['exports','STRING','version','sequelize'];(function(_0x3983af,_0x145ad9){var _0x1046ba=function(_0x2b7995){while(--_0x2b7995){_0x3983af['push'](_0x3983af['shift']());}};_0x1046ba(++_0x145ad9);}(_0xb7fc,0x147));var _0xcb7f=function(_0xc3aae7,_0x3bfa91){_0xc3aae7=_0xc3aae7-0x0;var _0x1f365a=_0xb7fc[_0xc3aae7];return _0x1f365a;};'use strict';var Sequelize=require(_0xcb7f('0x0'));module[_0xcb7f('0x1')]={'version':{'type':Sequelize[_0xcb7f('0x2')],'unique':_0xcb7f('0x3')}}; \ No newline at end of file +var _0xea34=['exports'];(function(_0x344627,_0x28e9ba){var _0x2fcee4=function(_0xbdd6ed){while(--_0xbdd6ed){_0x344627['push'](_0x344627['shift']());}};_0x2fcee4(++_0x28e9ba);}(_0xea34,0x8a));var _0x4ea3=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xea34[_0x2bc3f4];return _0x14ac53;};'use strict';var Sequelize=require('sequelize');module[_0x4ea3('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 569320e..fe66f64 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5467=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','include','rows','catch','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','Migration','rawAttributes','type','key','model','map','query','keys','intersection'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x5467,0x1ab));var _0x7546=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x5467[_0x36dfbd];return _0x4ecad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7546('0x0'));var zipdir=require(_0x7546('0x1'));var jsonpatch=require(_0x7546('0x2'));var rp=require('request-promise');var moment=require(_0x7546('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7546('0x4'));var util=require(_0x7546('0x5'));var path=require(_0x7546('0x6'));var sox=require(_0x7546('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7546('0x8'));var _=require(_0x7546('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7546('0xa'));var querystring=require('querystring');var Papa=require(_0x7546('0xb'));var Redis=require(_0x7546('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7546('0xd'));var hardwareService=require(_0x7546('0xe'));var logger=require(_0x7546('0xf'))(_0x7546('0x10'));var utils=require(_0x7546('0x11'));var config=require(_0x7546('0x12'));var licenseUtil=require(_0x7546('0x13'));var db=require(_0x7546('0x14'))['db'];function respondWithStatusCode(_0x1bd979,_0x9158c7){_0x9158c7=_0x9158c7||0xcc;return function(_0x177e8d){if(_0x177e8d){return _0x1bd979[_0x7546('0x15')](_0x9158c7);}return _0x1bd979[_0x7546('0x16')](_0x9158c7)[_0x7546('0x17')]();};}function respondWithResult(_0x4a72df,_0x2702ec){_0x2702ec=_0x2702ec||0xc8;return function(_0x3c41ef){if(_0x3c41ef){return _0x4a72df[_0x7546('0x16')](_0x2702ec)['json'](_0x3c41ef);}};}function respondWithFilteredResult(_0x484b78,_0x2af3aa){return function(_0xe4d8d2){if(_0xe4d8d2){var _0x5c6e54=typeof _0x2af3aa[_0x7546('0x18')]==='undefined'&&typeof _0x2af3aa[_0x7546('0x19')]==='undefined';var _0x25da22=_0xe4d8d2['count'];var _0x23e2fa=_0x5c6e54?0x0:_0x2af3aa[_0x7546('0x18')];var _0x2e9545=_0x5c6e54?_0xe4d8d2[_0x7546('0x1a')]:_0x2af3aa[_0x7546('0x18')]+_0x2af3aa[_0x7546('0x19')];var _0x2d52d8;if(_0x2e9545>=_0x25da22){_0x2e9545=_0x25da22;_0x2d52d8=0xc8;}else{_0x2d52d8=0xce;}_0x484b78['status'](_0x2d52d8);return _0x484b78[_0x7546('0x1b')](_0x7546('0x1c'),_0x23e2fa+'-'+_0x2e9545+'/'+_0x25da22)[_0x7546('0x1d')](_0xe4d8d2);}return null;};}function patchUpdates(_0x31cfdb){return function(_0x4f4ce1){try{jsonpatch[_0x7546('0x1e')](_0x4f4ce1,_0x31cfdb,!![]);}catch(_0x21de8b){return BPromise['reject'](_0x21de8b);}return _0x4f4ce1[_0x7546('0x1f')]();};}function saveUpdates(_0x59def6,_0x140809){return function(_0x2c5c96){if(_0x2c5c96){return _0x2c5c96[_0x7546('0x20')](_0x59def6)[_0x7546('0x21')](function(_0xa20fca){return _0xa20fca;});}return null;};}function removeEntity(_0xd08b6d,_0xdfe2c7){return function(_0xe485c4){if(_0xe485c4){return _0xe485c4[_0x7546('0x22')]()[_0x7546('0x21')](function(){_0xd08b6d[_0x7546('0x16')](0xcc)[_0x7546('0x17')]();});}};}function handleEntityNotFound(_0x59b3f9,_0x51fa30){return function(_0x3a74b5){if(!_0x3a74b5){_0x59b3f9[_0x7546('0x15')](0x194);}return _0x3a74b5;};}function handleError(_0x48f067,_0x157089){_0x157089=_0x157089||0x1f4;return function(_0x4316b1){logger[_0x7546('0x23')](_0x4316b1[_0x7546('0x24')]);if(_0x4316b1[_0x7546('0x25')]){delete _0x4316b1[_0x7546('0x25')];}_0x48f067[_0x7546('0x16')](_0x157089)[_0x7546('0x26')](_0x4316b1);};}function getMustacheRender(_0x22588f,_0x1c8735){return Mustache[_0x7546('0x27')](_0x22588f,_[_0x7546('0x28')](_0x1c8735[_0x7546('0x29')],{'contact':_0x1c8735[_0x7546('0x2a')],'message':_0x1c8735[_0x7546('0x2b')],'agent':_0x1c8735['agent'],'interaction':_0x1c8735[_0x7546('0x2c')],'account':_0x1c8735[_0x7546('0x2d')]}))||'';}exports[_0x7546('0x2e')]=function(_0x51caea,_0x1ab151){var _0x3f952a={},_0x32f66a={},_0x51932f={'count':0x0,'rows':[]};var _0x4055e0=_['map'](db[_0x7546('0x2f')][_0x7546('0x30')],function(_0x36ebf6){return{'name':_0x36ebf6['fieldName'],'type':_0x36ebf6[_0x7546('0x31')][_0x7546('0x32')]};});_0x32f66a[_0x7546('0x33')]=_[_0x7546('0x34')](_0x4055e0,_0x7546('0x25'));_0x32f66a[_0x7546('0x35')]=_[_0x7546('0x36')](_0x51caea[_0x7546('0x35')]);_0x32f66a['filters']=_[_0x7546('0x37')](_0x32f66a[_0x7546('0x33')],_0x32f66a[_0x7546('0x35')]);_0x3f952a[_0x7546('0x38')]=_[_0x7546('0x37')](_0x32f66a[_0x7546('0x33')],qs[_0x7546('0x39')](_0x51caea[_0x7546('0x35')]['fields']));_0x3f952a[_0x7546('0x38')]=_0x3f952a[_0x7546('0x38')][_0x7546('0x3a')]?_0x3f952a[_0x7546('0x38')]:_0x32f66a['model'];if(!_0x51caea[_0x7546('0x35')][_0x7546('0x3b')](_0x7546('0x3c'))){_0x3f952a[_0x7546('0x19')]=qs[_0x7546('0x19')](_0x51caea[_0x7546('0x35')]['limit']);_0x3f952a[_0x7546('0x18')]=qs[_0x7546('0x18')](_0x51caea[_0x7546('0x35')]['offset']);}_0x3f952a[_0x7546('0x3d')]=qs[_0x7546('0x3e')](_0x51caea[_0x7546('0x35')][_0x7546('0x3e')]);_0x3f952a[_0x7546('0x3f')]=qs[_0x7546('0x40')](_['pick'](_0x51caea['query'],_0x32f66a['filters']),_0x4055e0);if(_0x51caea[_0x7546('0x35')][_0x7546('0x41')]){_0x3f952a[_0x7546('0x3f')]=_['merge'](_0x3f952a['where'],{'$or':_[_0x7546('0x34')](_0x4055e0,function(_0x355591){if(_0x355591[_0x7546('0x31')]!=='VIRTUAL'){var _0xf3e420={};_0xf3e420[_0x355591['name']]={'$like':'%'+_0x51caea[_0x7546('0x35')][_0x7546('0x41')]+'%'};return _0xf3e420;}})});}_0x3f952a=_[_0x7546('0x28')]({},_0x3f952a,_0x51caea['options']);var _0x1e01e5={'where':_0x3f952a['where']};return db[_0x7546('0x2f')][_0x7546('0x1a')](_0x1e01e5)[_0x7546('0x21')](function(_0x4fc2f4){_0x51932f[_0x7546('0x1a')]=_0x4fc2f4;if(_0x51caea[_0x7546('0x35')]['includeAll']){_0x3f952a[_0x7546('0x42')]=[{'all':!![]}];}return db[_0x7546('0x2f')]['findAll'](_0x3f952a);})[_0x7546('0x21')](function(_0x4d7c9c){_0x51932f[_0x7546('0x43')]=_0x4d7c9c;return _0x51932f;})[_0x7546('0x21')](respondWithFilteredResult(_0x1ab151,_0x3f952a))[_0x7546('0x44')](handleError(_0x1ab151,null));}; \ No newline at end of file +var _0x417b=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','sendStatus','error','stack','name','send','render','contact','message','agent','interaction','index','map','Migration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x417b,0x7e));var _0xb417=function(_0x477d22,_0x42f218){_0x477d22=_0x477d22-0x0;var _0x41e8b9=_0x417b[_0x477d22];return _0x41e8b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb417('0x0'));var zipdir=require(_0xb417('0x1'));var jsonpatch=require(_0xb417('0x2'));var rp=require(_0xb417('0x3'));var moment=require('moment');var BPromise=require(_0xb417('0x4'));var Mustache=require(_0xb417('0x5'));var util=require('util');var path=require(_0xb417('0x6'));var sox=require(_0xb417('0x7'));var csv=require(_0xb417('0x8'));var ejs=require(_0xb417('0x9'));var fs=require('fs');var fs_extra=require(_0xb417('0xa'));var _=require(_0xb417('0xb'));var squel=require(_0xb417('0xc'));var crypto=require(_0xb417('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb417('0xe'));var Papa=require(_0xb417('0xf'));var Redis=require(_0xb417('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb417('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb417('0x12'))('api');var utils=require(_0xb417('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb417('0x14'));var db=require(_0xb417('0x15'))['db'];function respondWithStatusCode(_0x28ff8,_0x10f129){_0x10f129=_0x10f129||0xcc;return function(_0xe8be39){if(_0xe8be39){return _0x28ff8['sendStatus'](_0x10f129);}return _0x28ff8[_0xb417('0x16')](_0x10f129)['end']();};}function respondWithResult(_0x4232bd,_0xb7fa98){_0xb7fa98=_0xb7fa98||0xc8;return function(_0x3f1c4b){if(_0x3f1c4b){return _0x4232bd[_0xb417('0x16')](_0xb7fa98)[_0xb417('0x17')](_0x3f1c4b);}};}function respondWithFilteredResult(_0x19750f,_0x1ba717){return function(_0x112295){if(_0x112295){var _0x121ddb=typeof _0x1ba717[_0xb417('0x18')]===_0xb417('0x19')&&typeof _0x1ba717[_0xb417('0x1a')]===_0xb417('0x19');var _0x41e84d=_0x112295[_0xb417('0x1b')];var _0x3c4a62=_0x121ddb?0x0:_0x1ba717[_0xb417('0x18')];var _0x5b8f95=_0x121ddb?_0x112295[_0xb417('0x1b')]:_0x1ba717[_0xb417('0x18')]+_0x1ba717['limit'];var _0x25d28d;if(_0x5b8f95>=_0x41e84d){_0x5b8f95=_0x41e84d;_0x25d28d=0xc8;}else{_0x25d28d=0xce;}_0x19750f['status'](_0x25d28d);return _0x19750f['set'](_0xb417('0x1c'),_0x3c4a62+'-'+_0x5b8f95+'/'+_0x41e84d)[_0xb417('0x17')](_0x112295);}return null;};}function patchUpdates(_0x503432){return function(_0x11e493){try{jsonpatch[_0xb417('0x1d')](_0x11e493,_0x503432,!![]);}catch(_0x341b30){return BPromise['reject'](_0x341b30);}return _0x11e493['save']();};}function saveUpdates(_0x4f4a00,_0x543b23){return function(_0x5bcfec){if(_0x5bcfec){return _0x5bcfec[_0xb417('0x1e')](_0x4f4a00)[_0xb417('0x1f')](function(_0x1ad44e){return _0x1ad44e;});}return null;};}function removeEntity(_0x48b777,_0x3d9686){return function(_0x300117){if(_0x300117){return _0x300117[_0xb417('0x20')]()['then'](function(){_0x48b777['status'](0xcc)[_0xb417('0x21')]();});}};}function handleEntityNotFound(_0xf06cb3,_0x5e198c){return function(_0x36ea4b){if(!_0x36ea4b){_0xf06cb3[_0xb417('0x22')](0x194);}return _0x36ea4b;};}function handleError(_0x5087b1,_0x511a7d){_0x511a7d=_0x511a7d||0x1f4;return function(_0xceae9a){logger[_0xb417('0x23')](_0xceae9a[_0xb417('0x24')]);if(_0xceae9a[_0xb417('0x25')]){delete _0xceae9a[_0xb417('0x25')];}_0x5087b1[_0xb417('0x16')](_0x511a7d)[_0xb417('0x26')](_0xceae9a);};}function getMustacheRender(_0x18b7a9,_0x3c0bcb){return Mustache[_0xb417('0x27')](_0x18b7a9,_['merge'](_0x3c0bcb['body'],{'contact':_0x3c0bcb[_0xb417('0x28')],'message':_0x3c0bcb[_0xb417('0x29')],'agent':_0x3c0bcb[_0xb417('0x2a')],'interaction':_0x3c0bcb[_0xb417('0x2b')],'account':_0x3c0bcb['account']}))||'';}exports[_0xb417('0x2c')]=function(_0x526176,_0x54cbde){var _0x34cc2e={},_0x2da931={},_0x4f0e72={'count':0x0,'rows':[]};var _0x20a2b4=_[_0xb417('0x2d')](db[_0xb417('0x2e')]['rawAttributes'],function(_0xfb23a6){return{'name':_0xfb23a6[_0xb417('0x2f')],'type':_0xfb23a6[_0xb417('0x30')][_0xb417('0x31')]};});_0x2da931[_0xb417('0x32')]=_[_0xb417('0x2d')](_0x20a2b4,_0xb417('0x25'));_0x2da931[_0xb417('0x33')]=_[_0xb417('0x34')](_0x526176['query']);_0x2da931[_0xb417('0x35')]=_[_0xb417('0x36')](_0x2da931[_0xb417('0x32')],_0x2da931[_0xb417('0x33')]);_0x34cc2e['attributes']=_['intersection'](_0x2da931[_0xb417('0x32')],qs[_0xb417('0x37')](_0x526176['query'][_0xb417('0x37')]));_0x34cc2e[_0xb417('0x38')]=_0x34cc2e[_0xb417('0x38')][_0xb417('0x39')]?_0x34cc2e[_0xb417('0x38')]:_0x2da931[_0xb417('0x32')];if(!_0x526176['query'][_0xb417('0x3a')](_0xb417('0x3b'))){_0x34cc2e[_0xb417('0x1a')]=qs[_0xb417('0x1a')](_0x526176[_0xb417('0x33')]['limit']);_0x34cc2e[_0xb417('0x18')]=qs[_0xb417('0x18')](_0x526176[_0xb417('0x33')][_0xb417('0x18')]);}_0x34cc2e[_0xb417('0x3c')]=qs['sort'](_0x526176[_0xb417('0x33')]['sort']);_0x34cc2e[_0xb417('0x3d')]=qs[_0xb417('0x35')](_[_0xb417('0x3e')](_0x526176['query'],_0x2da931['filters']),_0x20a2b4);if(_0x526176[_0xb417('0x33')]['filter']){_0x34cc2e['where']=_[_0xb417('0x3f')](_0x34cc2e[_0xb417('0x3d')],{'$or':_[_0xb417('0x2d')](_0x20a2b4,function(_0x1bebfa){if(_0x1bebfa[_0xb417('0x30')]!==_0xb417('0x40')){var _0x5166c9={};_0x5166c9[_0x1bebfa[_0xb417('0x25')]]={'$like':'%'+_0x526176[_0xb417('0x33')]['filter']+'%'};return _0x5166c9;}})});}_0x34cc2e=_[_0xb417('0x3f')]({},_0x34cc2e,_0x526176[_0xb417('0x41')]);var _0x55c887={'where':_0x34cc2e[_0xb417('0x3d')]};return db[_0xb417('0x2e')]['count'](_0x55c887)[_0xb417('0x1f')](function(_0xd3e4be){_0x4f0e72[_0xb417('0x1b')]=_0xd3e4be;if(_0x526176[_0xb417('0x33')][_0xb417('0x42')]){_0x34cc2e['include']=[{'all':!![]}];}return db[_0xb417('0x2e')][_0xb417('0x43')](_0x34cc2e);})[_0xb417('0x1f')](function(_0x1c7f4b){_0x4f0e72[_0xb417('0x44')]=_0x1c7f4b;return _0x4f0e72;})[_0xb417('0x1f')](respondWithFilteredResult(_0x54cbde,_0x34cc2e))[_0xb417('0x45')](handleError(_0x54cbde,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 32f0881..a839f57 100644 --- a/server/api/migration/migration.model.js +++ b/server/api/migration/migration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68d3=['../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x581a60,_0x5edd11){var _0x178caa=function(_0x523c8c){while(--_0x523c8c){_0x581a60['push'](_0x581a60['shift']());}};_0x178caa(++_0x5edd11);}(_0x68d3,0x6e));var _0x368d=function(_0x4f7bdf,_0xb4a8f7){_0x4f7bdf=_0x4f7bdf-0x0;var _0x2e72b2=_0x68d3[_0x4f7bdf];return _0x2e72b2;};'use strict';var _=require(_0x368d('0x0'));var util=require('util');var logger=require(_0x368d('0x1'))(_0x368d('0x2'));var moment=require(_0x368d('0x3'));var BPromise=require(_0x368d('0x4'));var rp=require(_0x368d('0x5'));var fs=require('fs');var path=require(_0x368d('0x6'));var rimraf=require('rimraf');var config=require(_0x368d('0x7'));var attributes=require(_0x368d('0x8'));module[_0x368d('0x9')]=function(_0x3d375b,_0x33cae8){return _0x3d375b[_0x368d('0xa')](_0x368d('0xb'),attributes,{'tableName':_0x368d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b98=['../../config/environment','exports','Migration','migrations','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x182cba,_0x243c29){var _0x45a6cb=function(_0xae50f2){while(--_0xae50f2){_0x182cba['push'](_0x182cba['shift']());}};_0x45a6cb(++_0x243c29);}(_0x2b98,0x1f3));var _0x82b9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2b98[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x82b9('0x0'));var logger=require(_0x82b9('0x1'))(_0x82b9('0x2'));var moment=require(_0x82b9('0x3'));var BPromise=require(_0x82b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82b9('0x5'));var rimraf=require(_0x82b9('0x6'));var config=require(_0x82b9('0x7'));var attributes=require('./migration.attributes');module[_0x82b9('0x8')]=function(_0x481e04,_0x14548d){return _0x481e04['define'](_0x82b9('0x9'),attributes,{'tableName':_0x82b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 7df063f..413a777 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd958=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x4d6006,_0x4cde28){var _0x5f2638=function(_0x5adf5c){while(--_0x5adf5c){_0x4d6006['push'](_0x4d6006['shift']());}};_0x5f2638(++_0x4cde28);}(_0xd958,0xb8));var _0x8d95=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xd958[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x8d95('0x0'));var util=require(_0x8d95('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d95('0x3'))['db'];var utils=require(_0x8d95('0x4'));var logger=require(_0x8d95('0x5'))(_0x8d95('0x6'));var config=require(_0x8d95('0x7'));var jayson=require(_0x8d95('0x8'));var client=jayson[_0x8d95('0x9')][_0x8d95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cc162,_0x429f1e,_0xf80e9a){return new BPromise(function(_0x2e6506,_0x245f1f){return client[_0x8d95('0xb')](_0x4cc162,_0xf80e9a)['then'](function(_0x339ae6){logger[_0x8d95('0xc')](_0x8d95('0xd'),_0x429f1e,'request\x20sent');logger['debug'](_0x8d95('0xe'),_0x429f1e,_0x8d95('0xf'),JSON[_0x8d95('0x10')](_0x339ae6));if(_0x339ae6['error']){if(_0x339ae6[_0x8d95('0x11')]['code']===0x1f4){logger[_0x8d95('0x11')](_0x8d95('0xd'),_0x429f1e,_0x339ae6['error'][_0x8d95('0x12')]);return _0x245f1f(_0x339ae6[_0x8d95('0x11')]['message']);}logger[_0x8d95('0x11')](_0x8d95('0xd'),_0x429f1e,_0x339ae6[_0x8d95('0x11')][_0x8d95('0x12')]);return _0x2e6506(_0x339ae6['error'][_0x8d95('0x12')]);}else{logger[_0x8d95('0xc')]('Migration,\x20%s,\x20%s',_0x429f1e,'request\x20sent');_0x2e6506(_0x339ae6[_0x8d95('0x13')][_0x8d95('0x12')]);}})[_0x8d95('0x14')](function(_0x37eab4){logger[_0x8d95('0x11')](_0x8d95('0xd'),_0x429f1e,_0x37eab4);_0x245f1f(_0x37eab4);});});} \ No newline at end of file +var _0xe354=['http','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','info','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xe354,0x187));var _0x4e35=function(_0x4c9ab2,_0x509cbb){_0x4c9ab2=_0x4c9ab2-0x0;var _0x91559f=_0xe354[_0x4c9ab2];return _0x91559f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e35('0x0'));var BPromise=require(_0x4e35('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e35('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e35('0x3'));var logger=require(_0x4e35('0x4'))(_0x4e35('0x5'));var config=require(_0x4e35('0x6'));var jayson=require(_0x4e35('0x7'));var client=jayson[_0x4e35('0x8')][_0x4e35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7ef7c1,_0x520c18,_0x3d8ef0){return new BPromise(function(_0x25c66c,_0x144c87){return client['request'](_0x7ef7c1,_0x3d8ef0)['then'](function(_0x22368e){logger['info']('Migration,\x20%s,\x20%s',_0x520c18,_0x4e35('0xa'));logger[_0x4e35('0xb')](_0x4e35('0xc'),_0x520c18,_0x4e35('0xa'),JSON[_0x4e35('0xd')](_0x22368e));if(_0x22368e[_0x4e35('0xe')]){if(_0x22368e[_0x4e35('0xe')][_0x4e35('0xf')]===0x1f4){logger[_0x4e35('0xe')](_0x4e35('0x10'),_0x520c18,_0x22368e['error']['message']);return _0x144c87(_0x22368e[_0x4e35('0xe')][_0x4e35('0x11')]);}logger['error']('Migration,\x20%s,\x20%s',_0x520c18,_0x22368e[_0x4e35('0xe')][_0x4e35('0x11')]);return _0x25c66c(_0x22368e[_0x4e35('0xe')][_0x4e35('0x11')]);}else{logger[_0x4e35('0x12')](_0x4e35('0x10'),_0x520c18,_0x4e35('0xa'));_0x25c66c(_0x22368e['result'][_0x4e35('0x11')]);}})[_0x4e35('0x13')](function(_0x4aa4c8){logger[_0x4e35('0xe')](_0x4e35('0x10'),_0x520c18,_0x4aa4c8);_0x144c87(_0x4aa4c8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7c9b2a7..fbed61c 100644 --- a/server/api/network/index.js +++ b/server/api/network/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dfb=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports'];(function(_0x369a05,_0x5137a6){var _0x4d258c=function(_0x5a2128){while(--_0x5a2128){_0x369a05['push'](_0x369a05['shift']());}};_0x4d258c(++_0x5137a6);}(_0x7dfb,0x104));var _0xb7df=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x7dfb[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0xb7df('0x0'));var util=require(_0xb7df('0x1'));var path=require(_0xb7df('0x2'));var timeout=require(_0xb7df('0x3'));var express=require(_0xb7df('0x4'));var router=express[_0xb7df('0x5')]();var fs_extra=require(_0xb7df('0x6'));var auth=require(_0xb7df('0x7'));var interaction=require(_0xb7df('0x8'));var config=require(_0xb7df('0x9'));var controller=require('./network.controller');router[_0xb7df('0xa')]('/',auth[_0xb7df('0xb')](),controller[_0xb7df('0xc')]);router[_0xb7df('0xa')](_0xb7df('0xd'),auth[_0xb7df('0xb')](),controller[_0xb7df('0xe')]);router['post']('/',auth[_0xb7df('0xb')](),controller['create']);router[_0xb7df('0xf')]('/:id',auth[_0xb7df('0xb')](),controller[_0xb7df('0x10')]);router[_0xb7df('0x11')](_0xb7df('0xd'),auth[_0xb7df('0xb')](),controller[_0xb7df('0x12')]);module[_0xb7df('0x13')]=router; \ No newline at end of file +var _0x7e90=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated'];(function(_0x20b2ee,_0x2f5f73){var _0xa9ec2e=function(_0x440897){while(--_0x440897){_0x20b2ee['push'](_0x20b2ee['shift']());}};_0xa9ec2e(++_0x2f5f73);}(_0x7e90,0x18f));var _0x07e9=function(_0xa282f0,_0x225917){_0xa282f0=_0xa282f0-0x0;var _0x1c6fb7=_0x7e90[_0xa282f0];return _0x1c6fb7;};'use strict';var multer=require(_0x07e9('0x0'));var util=require(_0x07e9('0x1'));var path=require('path');var timeout=require(_0x07e9('0x2'));var express=require('express');var router=express[_0x07e9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x07e9('0x4'));var interaction=require(_0x07e9('0x5'));var config=require('../../config/environment');var controller=require(_0x07e9('0x6'));router[_0x07e9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x07e9('0x7')]('/:id',auth[_0x07e9('0x8')](),controller[_0x07e9('0x9')]);router[_0x07e9('0xa')]('/',auth['isAuthenticated'](),controller[_0x07e9('0xb')]);router[_0x07e9('0xc')]('/:id',auth[_0x07e9('0x8')](),controller[_0x07e9('0xd')]);router[_0x07e9('0xe')]('/:id',auth[_0x07e9('0x8')](),controller[_0x07e9('0xf')]);module[_0x07e9('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f828ac2..0ce32d6 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x4cc124,_0x4c2fc2){var _0x4692ad=function(_0x35720b){while(--_0x35720b){_0x4cc124['push'](_0x4cc124['shift']());}};_0x4692ad(++_0x4c2fc2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x578eaa,_0x46b39b){var _0x1bb8b7=function(_0x33e9c8){while(--_0x33e9c8){_0x578eaa['push'](_0x578eaa['shift']());}};_0x1bb8b7(++_0x46b39b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 7abf1bf..ab5192b 100644 --- a/server/api/network/network.controller.js +++ b/server/api/network/network.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc125=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','name','send','render','merge','contact','interaction','account','index','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','Network','includeAll','include','findAll','then','rows','rawAttributes','intersection','find','catch','transaction','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','create','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','params','STUN','/etc/asterisk/stun_xcally.conf','format','toLowerCase','destroy','rimraf','fast-json-patch','request-promise'];(function(_0x1a3625,_0x3c9158){var _0x1adcbc=function(_0x59e803){while(--_0x59e803){_0x1a3625['push'](_0x1a3625['shift']());}};_0x1adcbc(++_0x3c9158);}(_0xc125,0x150));var _0x5c12=function(_0x3d85b2,_0x458cc3){_0x3d85b2=_0x3d85b2-0x0;var _0x547afc=_0xc125[_0x3d85b2];return _0x547afc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c12('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c12('0x1'));var rp=require(_0x5c12('0x2'));var moment=require(_0x5c12('0x3'));var BPromise=require(_0x5c12('0x4'));var Mustache=require(_0x5c12('0x5'));var util=require(_0x5c12('0x6'));var path=require(_0x5c12('0x7'));var sox=require(_0x5c12('0x8'));var csv=require(_0x5c12('0x9'));var ejs=require(_0x5c12('0xa'));var fs=require('fs');var fs_extra=require(_0x5c12('0xb'));var _=require(_0x5c12('0xc'));var squel=require('squel');var crypto=require(_0x5c12('0xd'));var jsforce=require(_0x5c12('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5c12('0x9'));var querystring=require(_0x5c12('0xf'));var Papa=require(_0x5c12('0x10'));var Redis=require(_0x5c12('0x11'));var authService=require(_0x5c12('0x12'));var qs=require(_0x5c12('0x13'));var as=require(_0x5c12('0x14'));var hardwareService=require(_0x5c12('0x15'));var logger=require('../../config/logger')(_0x5c12('0x16'));var utils=require(_0x5c12('0x17'));var config=require(_0x5c12('0x18'));var licenseUtil=require(_0x5c12('0x19'));var db=require(_0x5c12('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5c12('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5619bc,_0xb800f2,_0x39440d,_0x448667){return new BPromise(function(_0x4a9910,_0x5676a9){var _0x1fac81=_0x448667||client;return _0x1fac81[_0x5c12('0x1c')](_0x5619bc,_0x39440d)['then'](function(_0x460ff1){logger[_0x5c12('0x1d')](_0x5c12('0x1e'),_0xb800f2,'request\x20sent');logger['debug'](_0x5c12('0x1f'),_0xb800f2,_0x5c12('0x20'),JSON[_0x5c12('0x21')](_0x460ff1));if(_0x460ff1[_0x5c12('0x22')]){if(_0x460ff1[_0x5c12('0x22')][_0x5c12('0x23')]===0x1f4){logger[_0x5c12('0x22')](_0x5c12('0x1e'),_0xb800f2,_0x460ff1['error']['message']);return _0x5676a9(_0x460ff1[_0x5c12('0x22')][_0x5c12('0x24')]);}logger[_0x5c12('0x22')](_0x5c12('0x1e'),_0xb800f2,_0x460ff1['error'][_0x5c12('0x24')]);return _0x4a9910(_0x460ff1['error'][_0x5c12('0x24')]);}else{logger[_0x5c12('0x1d')]('Network,\x20%s,\x20%s',_0xb800f2,'request\x20sent');_0x4a9910(_0x460ff1[_0x5c12('0x25')][_0x5c12('0x24')]);}})['catch'](function(_0x275d5c){logger['error'](_0x5c12('0x1e'),_0xb800f2,_0x275d5c);_0x5676a9(_0x275d5c);});});}function respondWithStatusCode(_0x7bc2ff,_0x1d9e30){_0x1d9e30=_0x1d9e30||0xcc;return function(_0x40f6ab){if(_0x40f6ab){return _0x7bc2ff[_0x5c12('0x26')](_0x1d9e30);}return _0x7bc2ff[_0x5c12('0x27')](_0x1d9e30)[_0x5c12('0x28')]();};}function respondWithResult(_0x370726,_0xca0f79){_0xca0f79=_0xca0f79||0xc8;return function(_0x1d6d76){if(_0x1d6d76){return _0x370726[_0x5c12('0x27')](_0xca0f79)[_0x5c12('0x29')](_0x1d6d76);}};}function respondWithFilteredResult(_0x146bce,_0x598c2b){return function(_0x37979e){if(_0x37979e){var _0x37b639=typeof _0x598c2b[_0x5c12('0x2a')]===_0x5c12('0x2b')&&typeof _0x598c2b[_0x5c12('0x2c')]===_0x5c12('0x2b');var _0x54f4b6=_0x37979e[_0x5c12('0x2d')];var _0x3e9bf5=_0x37b639?0x0:_0x598c2b[_0x5c12('0x2a')];var _0x5939a8=_0x37b639?_0x37979e['count']:_0x598c2b[_0x5c12('0x2a')]+_0x598c2b[_0x5c12('0x2c')];var _0x5d71b2;if(_0x5939a8>=_0x54f4b6){_0x5939a8=_0x54f4b6;_0x5d71b2=0xc8;}else{_0x5d71b2=0xce;}_0x146bce[_0x5c12('0x27')](_0x5d71b2);return _0x146bce[_0x5c12('0x2e')](_0x5c12('0x2f'),_0x3e9bf5+'-'+_0x5939a8+'/'+_0x54f4b6)['json'](_0x37979e);}return null;};}function patchUpdates(_0x41bc6a){return function(_0x57c6e1){try{jsonpatch[_0x5c12('0x30')](_0x57c6e1,_0x41bc6a,!![]);}catch(_0x2d3466){return BPromise[_0x5c12('0x31')](_0x2d3466);}return _0x57c6e1[_0x5c12('0x32')]();};}function saveUpdates(_0xd8c22d,_0x38f1c3){return function(_0x2a9fb3){if(_0x2a9fb3){return _0x2a9fb3['update'](_0xd8c22d)['then'](function(_0x2f4a84){return _0x2f4a84;});}return null;};}function removeEntity(_0x45f7f9,_0x3f65d6){return function(_0xe6ecd1){if(_0xe6ecd1){return _0xe6ecd1['destroy']()['then'](function(){_0x45f7f9[_0x5c12('0x27')](0xcc)[_0x5c12('0x28')]();});}};}function handleEntityNotFound(_0x4ed1d1,_0x5c9940){return function(_0x4b1097){if(!_0x4b1097){_0x4ed1d1[_0x5c12('0x26')](0x194);}return _0x4b1097;};}function handleError(_0x46752d,_0x27025c){_0x27025c=_0x27025c||0x1f4;return function(_0x1725ab){logger[_0x5c12('0x22')](_0x1725ab['stack']);if(_0x1725ab[_0x5c12('0x33')]){delete _0x1725ab[_0x5c12('0x33')];}_0x46752d['status'](_0x27025c)[_0x5c12('0x34')](_0x1725ab);};}function getMustacheRender(_0x173755,_0x3c62d4){return Mustache[_0x5c12('0x35')](_0x173755,_[_0x5c12('0x36')](_0x3c62d4['body'],{'contact':_0x3c62d4[_0x5c12('0x37')],'message':_0x3c62d4[_0x5c12('0x24')],'agent':_0x3c62d4['agent'],'interaction':_0x3c62d4[_0x5c12('0x38')],'account':_0x3c62d4[_0x5c12('0x39')]}))||'';}exports[_0x5c12('0x3a')]=function(_0x4e665a,_0x3b70ae){var _0x241fa5={},_0x46704a={},_0x57a18f={'count':0x0,'rows':[]};var _0x23a28e=_['map'](db['Network']['rawAttributes'],function(_0x1b377f){return{'name':_0x1b377f[_0x5c12('0x3b')],'type':_0x1b377f[_0x5c12('0x3c')][_0x5c12('0x3d')]};});_0x46704a[_0x5c12('0x3e')]=_[_0x5c12('0x3f')](_0x23a28e,_0x5c12('0x33'));_0x46704a['query']=_[_0x5c12('0x40')](_0x4e665a[_0x5c12('0x41')]);_0x46704a[_0x5c12('0x42')]=_['intersection'](_0x46704a['model'],_0x46704a['query']);_0x241fa5[_0x5c12('0x43')]=_['intersection'](_0x46704a[_0x5c12('0x3e')],qs[_0x5c12('0x44')](_0x4e665a[_0x5c12('0x41')][_0x5c12('0x44')]));_0x241fa5[_0x5c12('0x43')]=_0x241fa5[_0x5c12('0x43')][_0x5c12('0x45')]?_0x241fa5['attributes']:_0x46704a[_0x5c12('0x3e')];if(!_0x4e665a[_0x5c12('0x41')][_0x5c12('0x46')](_0x5c12('0x47'))){_0x241fa5[_0x5c12('0x2c')]=qs[_0x5c12('0x2c')](_0x4e665a[_0x5c12('0x41')][_0x5c12('0x2c')]);_0x241fa5[_0x5c12('0x2a')]=qs[_0x5c12('0x2a')](_0x4e665a['query']['offset']);}_0x241fa5[_0x5c12('0x48')]=qs[_0x5c12('0x49')](_0x4e665a[_0x5c12('0x41')][_0x5c12('0x49')]);_0x241fa5[_0x5c12('0x4a')]=qs[_0x5c12('0x42')](_[_0x5c12('0x4b')](_0x4e665a[_0x5c12('0x41')],_0x46704a[_0x5c12('0x42')]),_0x23a28e);if(_0x4e665a[_0x5c12('0x41')][_0x5c12('0x4c')]){_0x241fa5[_0x5c12('0x4a')]=_['merge'](_0x241fa5['where'],{'$or':_[_0x5c12('0x3f')](_0x23a28e,function(_0x43b891){if(_0x43b891[_0x5c12('0x3c')]!=='VIRTUAL'){var _0x42dc27={};_0x42dc27[_0x43b891[_0x5c12('0x33')]]={'$like':'%'+_0x4e665a[_0x5c12('0x41')][_0x5c12('0x4c')]+'%'};return _0x42dc27;}})});}_0x241fa5=_[_0x5c12('0x36')]({},_0x241fa5,_0x4e665a[_0x5c12('0x4d')]);var _0x56d7cf={'where':_0x241fa5[_0x5c12('0x4a')]};return db[_0x5c12('0x4e')][_0x5c12('0x2d')](_0x56d7cf)['then'](function(_0x4e01bf){_0x57a18f[_0x5c12('0x2d')]=_0x4e01bf;if(_0x4e665a[_0x5c12('0x41')][_0x5c12('0x4f')]){_0x241fa5[_0x5c12('0x50')]=[{'all':!![]}];}return db[_0x5c12('0x4e')][_0x5c12('0x51')](_0x241fa5);})[_0x5c12('0x52')](function(_0x4c7943){_0x57a18f[_0x5c12('0x53')]=_0x4c7943;return _0x57a18f;})[_0x5c12('0x52')](respondWithFilteredResult(_0x3b70ae,_0x241fa5))['catch'](handleError(_0x3b70ae,null));};exports['show']=function(_0x830602,_0x2895ab){var _0x4544f5={'raw':!![],'where':{'id':_0x830602['params']['id']}},_0x12fb42={};_0x12fb42[_0x5c12('0x3e')]=_['keys'](db['Network'][_0x5c12('0x54')]);_0x12fb42['query']=_[_0x5c12('0x40')](_0x830602[_0x5c12('0x41')]);_0x12fb42[_0x5c12('0x42')]=_['intersection'](_0x12fb42[_0x5c12('0x3e')],_0x12fb42['query']);_0x4544f5[_0x5c12('0x43')]=_[_0x5c12('0x55')](_0x12fb42[_0x5c12('0x3e')],qs[_0x5c12('0x44')](_0x830602[_0x5c12('0x41')][_0x5c12('0x44')]));_0x4544f5[_0x5c12('0x43')]=_0x4544f5[_0x5c12('0x43')][_0x5c12('0x45')]?_0x4544f5['attributes']:_0x12fb42['model'];if(_0x830602[_0x5c12('0x41')]['includeAll']){_0x4544f5[_0x5c12('0x50')]=[{'all':!![]}];}_0x4544f5=_[_0x5c12('0x36')]({},_0x4544f5,_0x830602[_0x5c12('0x4d')]);return db['Network'][_0x5c12('0x56')](_0x4544f5)[_0x5c12('0x52')](handleEntityNotFound(_0x2895ab,null))['then'](respondWithResult(_0x2895ab,null))[_0x5c12('0x57')](handleError(_0x2895ab,null));};exports['create']=function(_0x1d2866,_0x345c13,_0xc82dd3){var _0x3fdc4b;return db['sequelize'][_0x5c12('0x58')](function(_0x4684e0){return db[_0x5c12('0x4e')]['create'](_0x1d2866[_0x5c12('0x59')],{'raw':!![]})[_0x5c12('0x52')](function(_0x39530c){_0x3fdc4b=_0x39530c;return db[_0x5c12('0x4e')]['findAll']({'where':{'type':_0x1d2866[_0x5c12('0x59')][_0x5c12('0x3c')]},'raw':!![]});})[_0x5c12('0x52')](function(_0x1cb85e){if(_0x3fdc4b[_0x5c12('0x3c')][_0x5c12('0x5a')]()=='STUN'){var _0x4dcfa5=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x5d')),_0x5c12('0x5e'));var _0x4b82e4=ejs['render'](_0x4dcfa5,{'networks':_0x1cb85e||[]});fs[_0x5c12('0x5f')]('/etc/asterisk/stun_xcally.conf',_0x4b82e4);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x61'),{'module':_0x5c12('0x62')});}else if(_0x3fdc4b[_0x5c12('0x3c')][_0x5c12('0x5a')]()==_0x5c12('0x63')){var _0x2df293=fs[_0x5c12('0x64')](path[_0x5c12('0x5b')](config['root'],_0x5c12('0x65')),_0x5c12('0x5e'));var _0x3c5d95=ejs[_0x5c12('0x35')](_0x2df293,{'networks':_0x1cb85e||[]});fs['writeFileSync'](_0x5c12('0x66'),_0x3c5d95);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x61'),{'module':_0x5c12('0x62')});}else{var _0x1efd5d=fs[_0x5c12('0x64')](path[_0x5c12('0x5b')](config['root'],_0x5c12('0x67')),_0x5c12('0x5e'));var _0x1aba6b=ejs[_0x5c12('0x35')](_0x1efd5d,{'networks':_0x1cb85e||[]});fs['writeFileSync'](util['format'](_0x5c12('0x68'),_0x1d2866[_0x5c12('0x59')][_0x5c12('0x3c')]['toLowerCase']()),_0x1aba6b);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x61'),{'module':_0x5c12('0x69')});}return null;})[_0x5c12('0x52')](function(){return _0x3fdc4b;});})['then'](respondWithResult(_0x345c13,0xc9))[_0x5c12('0x57')](handleError(_0x345c13,null));};exports[_0x5c12('0x6a')]=function(_0x8cb80d,_0x50795e,_0x122fa6){var _0x40c03b;return db['sequelize'][_0x5c12('0x58')](function(_0x5db6d1){return db['Network'][_0x5c12('0x56')]({'where':{'id':_0x8cb80d[_0x5c12('0x6b')]['id']}})[_0x5c12('0x52')](handleEntityNotFound(_0x50795e,null))[_0x5c12('0x52')](saveUpdates(_0x8cb80d[_0x5c12('0x59')],null))['then'](function(_0x19db32){if(_0x19db32){_0x40c03b=_0x19db32;return db[_0x5c12('0x4e')]['findAll']({'where':{'type':_0x40c03b['type']},'raw':!![]});}return null;})[_0x5c12('0x52')](function(_0xba7496){if(_0x40c03b['type']['toUpperCase']()==_0x5c12('0x6c')){var _0x42a07a=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x27ab29=ejs[_0x5c12('0x35')](_0x42a07a,{'networks':_0xba7496||[]});fs[_0x5c12('0x5f')](_0x5c12('0x6d'),_0x27ab29);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x6a'),{'module':_0x5c12('0x62')});}else if(_0x40c03b[_0x5c12('0x3c')][_0x5c12('0x5a')]()==_0x5c12('0x63')){var _0xc75e2c=fs[_0x5c12('0x64')](path['join'](config['root'],_0x5c12('0x65')),'utf8');var _0x1af167=ejs['render'](_0xc75e2c,{'networks':_0xba7496||[]});fs[_0x5c12('0x5f')](_0x5c12('0x66'),_0x1af167);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x6a'),{'module':_0x5c12('0x62')});}else{var _0x159586=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x67')),_0x5c12('0x5e'));var _0x3824e7=ejs[_0x5c12('0x35')](_0x159586,{'networks':_0xba7496||[]});fs[_0x5c12('0x5f')](util[_0x5c12('0x6e')](_0x5c12('0x68'),_0x8cb80d['body'][_0x5c12('0x3c')][_0x5c12('0x6f')]()),_0x3824e7);return respondWithRpcPromise('Reload',_0x5c12('0x6a'),{'module':_0x5c12('0x69')});}return null;})[_0x5c12('0x52')](function(_0xfc36aa){if(_0xfc36aa){return _0x40c03b;}return null;});})[_0x5c12('0x52')](respondWithResult(_0x50795e,null))[_0x5c12('0x57')](handleError(_0x50795e,null));};exports[_0x5c12('0x70')]=function(_0x1f8706,_0x594052,_0x14a3f2){var _0x2580a4;return db[_0x5c12('0x4e')][_0x5c12('0x56')]({'where':{'id':_0x1f8706[_0x5c12('0x6b')]['id']}})['then'](function(_0x1f86ac){_0x2580a4=_0x1f86ac;return _0x1f86ac;})[_0x5c12('0x52')](handleEntityNotFound(_0x594052,null))[_0x5c12('0x52')](removeEntity(_0x594052,null))[_0x5c12('0x52')](function(){if(_0x2580a4){return db['Network'][_0x5c12('0x51')]({'where':{'type':_0x2580a4[_0x5c12('0x3c')]},'raw':!![]});}})[_0x5c12('0x52')](function(_0x527c0c){if(_0x2580a4['type']['toUpperCase']()=='STUN'){var _0xe561a2=fs[_0x5c12('0x64')](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x5d')),'utf8');var _0x9ebfe4=ejs[_0x5c12('0x35')](_0xe561a2,{'networks':_0x527c0c||[]});fs['writeFileSync'](_0x5c12('0x6d'),_0x9ebfe4);return respondWithRpcPromise(_0x5c12('0x60'),_0x5c12('0x70'),{'module':_0x5c12('0x62')});}else if(_0x2580a4[_0x5c12('0x3c')][_0x5c12('0x5a')]()=='TURN'){var _0x51ca11=fs[_0x5c12('0x64')](path['join'](config[_0x5c12('0x5c')],_0x5c12('0x65')),'utf8');var _0x1c3c23=ejs[_0x5c12('0x35')](_0x51ca11,{'networks':_0x527c0c||[]});fs[_0x5c12('0x5f')](_0x5c12('0x66'),_0x1c3c23);return respondWithRpcPromise(_0x5c12('0x60'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x463251=fs['readFileSync'](path[_0x5c12('0x5b')](config[_0x5c12('0x5c')],_0x5c12('0x67')),_0x5c12('0x5e'));var _0x497276=ejs[_0x5c12('0x35')](_0x463251,{'networks':_0x527c0c||[]});fs[_0x5c12('0x5f')](util[_0x5c12('0x6e')](_0x5c12('0x68'),_0x1f8706['body']['type'][_0x5c12('0x6f')]()),_0x497276);return respondWithRpcPromise(_0x5c12('0x60'),'destroy',{'module':_0x5c12('0x69')});}return null;})[_0x5c12('0x57')](handleError(_0x594052,null));}; \ No newline at end of file +var _0x43f5=['fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','Network','includeAll','include','findAll','rows','catch','show','length','find','create','sequelize','transaction','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','format','toLowerCase','chan_sip.so','update','params','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','STUN','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','jayson/promise','client','http','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','then','stack','name','render','merge','body','interaction','account','index','map','rawAttributes'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0x43f5,0x9d));var _0x543f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x43f5[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x543f('0x0'));var rimraf=require(_0x543f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x543f('0x2'));var rp=require(_0x543f('0x3'));var moment=require(_0x543f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x543f('0x5'));var util=require(_0x543f('0x6'));var path=require(_0x543f('0x7'));var sox=require(_0x543f('0x8'));var csv=require(_0x543f('0x9'));var ejs=require(_0x543f('0xa'));var fs=require('fs');var fs_extra=require(_0x543f('0xb'));var _=require(_0x543f('0xc'));var squel=require('squel');var crypto=require(_0x543f('0xd'));var jsforce=require(_0x543f('0xe'));var deskjs=require(_0x543f('0xf'));var toCsv=require(_0x543f('0x9'));var querystring=require(_0x543f('0x10'));var Papa=require('papaparse');var Redis=require(_0x543f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x543f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x543f('0x13'));var utils=require(_0x543f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x543f('0x15'));var client=jayson[_0x543f('0x16')][_0x543f('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x539eaa,_0x343a39,_0x65d2c0,_0x1eb1c){return new BPromise(function(_0x4b7ffb,_0x2fadd7){var _0x3026ad=_0x1eb1c||client;return _0x3026ad['request'](_0x539eaa,_0x65d2c0)['then'](function(_0xe6c6d1){logger['info'](_0x543f('0x18'),_0x343a39,_0x543f('0x19'));logger[_0x543f('0x1a')](_0x543f('0x1b'),_0x343a39,'request\x20sent',JSON[_0x543f('0x1c')](_0xe6c6d1));if(_0xe6c6d1[_0x543f('0x1d')]){if(_0xe6c6d1[_0x543f('0x1d')][_0x543f('0x1e')]===0x1f4){logger[_0x543f('0x1d')](_0x543f('0x18'),_0x343a39,_0xe6c6d1['error']['message']);return _0x2fadd7(_0xe6c6d1[_0x543f('0x1d')][_0x543f('0x1f')]);}logger[_0x543f('0x1d')](_0x543f('0x18'),_0x343a39,_0xe6c6d1[_0x543f('0x1d')]['message']);return _0x4b7ffb(_0xe6c6d1[_0x543f('0x1d')][_0x543f('0x1f')]);}else{logger[_0x543f('0x20')]('Network,\x20%s,\x20%s',_0x343a39,_0x543f('0x19'));_0x4b7ffb(_0xe6c6d1[_0x543f('0x21')][_0x543f('0x1f')]);}})['catch'](function(_0x375e7d){logger['error'](_0x543f('0x18'),_0x343a39,_0x375e7d);_0x2fadd7(_0x375e7d);});});}function respondWithStatusCode(_0x49701c,_0x3914d3){_0x3914d3=_0x3914d3||0xcc;return function(_0x5a9bc1){if(_0x5a9bc1){return _0x49701c[_0x543f('0x22')](_0x3914d3);}return _0x49701c[_0x543f('0x23')](_0x3914d3)[_0x543f('0x24')]();};}function respondWithResult(_0x165ec7,_0x2827a3){_0x2827a3=_0x2827a3||0xc8;return function(_0x1a1b51){if(_0x1a1b51){return _0x165ec7[_0x543f('0x23')](_0x2827a3)[_0x543f('0x25')](_0x1a1b51);}};}function respondWithFilteredResult(_0x1de959,_0x17b22b){return function(_0x2c22c8){if(_0x2c22c8){var _0x14b0c4=typeof _0x17b22b[_0x543f('0x26')]==='undefined'&&typeof _0x17b22b[_0x543f('0x27')]===_0x543f('0x28');var _0x217559=_0x2c22c8[_0x543f('0x29')];var _0x1c0495=_0x14b0c4?0x0:_0x17b22b[_0x543f('0x26')];var _0x1b31e6=_0x14b0c4?_0x2c22c8['count']:_0x17b22b[_0x543f('0x26')]+_0x17b22b[_0x543f('0x27')];var _0x527a57;if(_0x1b31e6>=_0x217559){_0x1b31e6=_0x217559;_0x527a57=0xc8;}else{_0x527a57=0xce;}_0x1de959[_0x543f('0x23')](_0x527a57);return _0x1de959['set']('Content-Range',_0x1c0495+'-'+_0x1b31e6+'/'+_0x217559)[_0x543f('0x25')](_0x2c22c8);}return null;};}function patchUpdates(_0xa35162){return function(_0x2db279){try{jsonpatch['apply'](_0x2db279,_0xa35162,!![]);}catch(_0xec78aa){return BPromise[_0x543f('0x2a')](_0xec78aa);}return _0x2db279[_0x543f('0x2b')]();};}function saveUpdates(_0xb6da30,_0xead81d){return function(_0x5c7e76){if(_0x5c7e76){return _0x5c7e76['update'](_0xb6da30)[_0x543f('0x2c')](function(_0x56d97f){return _0x56d97f;});}return null;};}function removeEntity(_0x2b5085,_0x5286ab){return function(_0xbc0c0b){if(_0xbc0c0b){return _0xbc0c0b['destroy']()[_0x543f('0x2c')](function(){_0x2b5085[_0x543f('0x23')](0xcc)[_0x543f('0x24')]();});}};}function handleEntityNotFound(_0x496d1f,_0x27183d){return function(_0x58c714){if(!_0x58c714){_0x496d1f[_0x543f('0x22')](0x194);}return _0x58c714;};}function handleError(_0x222447,_0x2b25ec){_0x2b25ec=_0x2b25ec||0x1f4;return function(_0x94c901){logger[_0x543f('0x1d')](_0x94c901[_0x543f('0x2d')]);if(_0x94c901[_0x543f('0x2e')]){delete _0x94c901[_0x543f('0x2e')];}_0x222447[_0x543f('0x23')](_0x2b25ec)['send'](_0x94c901);};}function getMustacheRender(_0x1f8dba,_0x51fc70){return Mustache[_0x543f('0x2f')](_0x1f8dba,_[_0x543f('0x30')](_0x51fc70[_0x543f('0x31')],{'contact':_0x51fc70['contact'],'message':_0x51fc70['message'],'agent':_0x51fc70['agent'],'interaction':_0x51fc70[_0x543f('0x32')],'account':_0x51fc70[_0x543f('0x33')]}))||'';}exports[_0x543f('0x34')]=function(_0x283eb0,_0x47942e){var _0x20fc31={},_0x147943={},_0x14936c={'count':0x0,'rows':[]};var _0xcbb3f2=_[_0x543f('0x35')](db['Network'][_0x543f('0x36')],function(_0x3891cd){return{'name':_0x3891cd[_0x543f('0x37')],'type':_0x3891cd[_0x543f('0x38')]['key']};});_0x147943[_0x543f('0x39')]=_[_0x543f('0x35')](_0xcbb3f2,_0x543f('0x2e'));_0x147943['query']=_[_0x543f('0x3a')](_0x283eb0[_0x543f('0x3b')]);_0x147943[_0x543f('0x3c')]=_['intersection'](_0x147943[_0x543f('0x39')],_0x147943[_0x543f('0x3b')]);_0x20fc31[_0x543f('0x3d')]=_[_0x543f('0x3e')](_0x147943[_0x543f('0x39')],qs[_0x543f('0x3f')](_0x283eb0[_0x543f('0x3b')][_0x543f('0x3f')]));_0x20fc31['attributes']=_0x20fc31[_0x543f('0x3d')]['length']?_0x20fc31[_0x543f('0x3d')]:_0x147943[_0x543f('0x39')];if(!_0x283eb0[_0x543f('0x3b')][_0x543f('0x40')](_0x543f('0x41'))){_0x20fc31[_0x543f('0x27')]=qs['limit'](_0x283eb0[_0x543f('0x3b')][_0x543f('0x27')]);_0x20fc31[_0x543f('0x26')]=qs[_0x543f('0x26')](_0x283eb0[_0x543f('0x3b')][_0x543f('0x26')]);}_0x20fc31[_0x543f('0x42')]=qs[_0x543f('0x43')](_0x283eb0[_0x543f('0x3b')][_0x543f('0x43')]);_0x20fc31[_0x543f('0x44')]=qs[_0x543f('0x3c')](_[_0x543f('0x45')](_0x283eb0[_0x543f('0x3b')],_0x147943[_0x543f('0x3c')]),_0xcbb3f2);if(_0x283eb0['query'][_0x543f('0x46')]){_0x20fc31[_0x543f('0x44')]=_[_0x543f('0x30')](_0x20fc31[_0x543f('0x44')],{'$or':_['map'](_0xcbb3f2,function(_0x3173f2){if(_0x3173f2[_0x543f('0x38')]!=='VIRTUAL'){var _0xf83bb1={};_0xf83bb1[_0x3173f2[_0x543f('0x2e')]]={'$like':'%'+_0x283eb0['query'][_0x543f('0x46')]+'%'};return _0xf83bb1;}})});}_0x20fc31=_[_0x543f('0x30')]({},_0x20fc31,_0x283eb0[_0x543f('0x47')]);var _0x5f3640={'where':_0x20fc31['where']};return db[_0x543f('0x48')][_0x543f('0x29')](_0x5f3640)[_0x543f('0x2c')](function(_0x2825ef){_0x14936c[_0x543f('0x29')]=_0x2825ef;if(_0x283eb0[_0x543f('0x3b')][_0x543f('0x49')]){_0x20fc31[_0x543f('0x4a')]=[{'all':!![]}];}return db[_0x543f('0x48')][_0x543f('0x4b')](_0x20fc31);})[_0x543f('0x2c')](function(_0x399887){_0x14936c[_0x543f('0x4c')]=_0x399887;return _0x14936c;})['then'](respondWithFilteredResult(_0x47942e,_0x20fc31))[_0x543f('0x4d')](handleError(_0x47942e,null));};exports[_0x543f('0x4e')]=function(_0xe4d1e3,_0x3fc7be){var _0xbeeeb7={'raw':!![],'where':{'id':_0xe4d1e3['params']['id']}},_0x27c81e={};_0x27c81e['model']=_['keys'](db[_0x543f('0x48')][_0x543f('0x36')]);_0x27c81e[_0x543f('0x3b')]=_['keys'](_0xe4d1e3[_0x543f('0x3b')]);_0x27c81e[_0x543f('0x3c')]=_[_0x543f('0x3e')](_0x27c81e[_0x543f('0x39')],_0x27c81e['query']);_0xbeeeb7[_0x543f('0x3d')]=_['intersection'](_0x27c81e[_0x543f('0x39')],qs[_0x543f('0x3f')](_0xe4d1e3[_0x543f('0x3b')][_0x543f('0x3f')]));_0xbeeeb7[_0x543f('0x3d')]=_0xbeeeb7[_0x543f('0x3d')][_0x543f('0x4f')]?_0xbeeeb7[_0x543f('0x3d')]:_0x27c81e['model'];if(_0xe4d1e3['query'][_0x543f('0x49')]){_0xbeeeb7[_0x543f('0x4a')]=[{'all':!![]}];}_0xbeeeb7=_[_0x543f('0x30')]({},_0xbeeeb7,_0xe4d1e3[_0x543f('0x47')]);return db[_0x543f('0x48')][_0x543f('0x50')](_0xbeeeb7)[_0x543f('0x2c')](handleEntityNotFound(_0x3fc7be,null))[_0x543f('0x2c')](respondWithResult(_0x3fc7be,null))[_0x543f('0x4d')](handleError(_0x3fc7be,null));};exports[_0x543f('0x51')]=function(_0x49c964,_0x199bfa,_0x448be0){var _0xc80b05;return db[_0x543f('0x52')][_0x543f('0x53')](function(_0x264d8f){return db[_0x543f('0x48')][_0x543f('0x51')](_0x49c964[_0x543f('0x31')],{'raw':!![]})[_0x543f('0x2c')](function(_0x1c23ab){_0xc80b05=_0x1c23ab;return db[_0x543f('0x48')][_0x543f('0x4b')]({'where':{'type':_0x49c964[_0x543f('0x31')]['type']},'raw':!![]});})[_0x543f('0x2c')](function(_0x5de775){if(_0xc80b05[_0x543f('0x38')][_0x543f('0x54')]()=='STUN'){var _0x1bb8fb=fs[_0x543f('0x55')](path[_0x543f('0x56')](config[_0x543f('0x57')],_0x543f('0x58')),_0x543f('0x59'));var _0x5051be=ejs[_0x543f('0x2f')](_0x1bb8fb,{'networks':_0x5de775||[]});fs['writeFileSync'](_0x543f('0x5a'),_0x5051be);return respondWithRpcPromise('Reload',_0x543f('0x51'),{'module':'res_stun_monitor.so'});}else if(_0xc80b05[_0x543f('0x38')]['toUpperCase']()==_0x543f('0x5b')){var _0x373d85=fs['readFileSync'](path['join'](config[_0x543f('0x57')],_0x543f('0x5c')),_0x543f('0x59'));var _0xdcd24c=ejs[_0x543f('0x2f')](_0x373d85,{'networks':_0x5de775||[]});fs[_0x543f('0x5d')](_0x543f('0x5e'),_0xdcd24c);return respondWithRpcPromise(_0x543f('0x5f'),_0x543f('0x51'),{'module':_0x543f('0x60')});}else{var _0x1ea780=fs['readFileSync'](path[_0x543f('0x56')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x546326=ejs[_0x543f('0x2f')](_0x1ea780,{'networks':_0x5de775||[]});fs[_0x543f('0x5d')](util[_0x543f('0x61')]('/etc/asterisk/sip_xcally_%s.conf',_0x49c964[_0x543f('0x31')][_0x543f('0x38')][_0x543f('0x62')]()),_0x546326);return respondWithRpcPromise('Reload','create',{'module':_0x543f('0x63')});}return null;})['then'](function(){return _0xc80b05;});})[_0x543f('0x2c')](respondWithResult(_0x199bfa,0xc9))['catch'](handleError(_0x199bfa,null));};exports[_0x543f('0x64')]=function(_0x3473cb,_0x28bad8,_0x841499){var _0x518e6f;return db[_0x543f('0x52')][_0x543f('0x53')](function(_0x3aabb7){return db[_0x543f('0x48')]['find']({'where':{'id':_0x3473cb[_0x543f('0x65')]['id']}})[_0x543f('0x2c')](handleEntityNotFound(_0x28bad8,null))['then'](saveUpdates(_0x3473cb['body'],null))[_0x543f('0x2c')](function(_0x2abbfa){if(_0x2abbfa){_0x518e6f=_0x2abbfa;return db['Network'][_0x543f('0x4b')]({'where':{'type':_0x518e6f[_0x543f('0x38')]},'raw':!![]});}return null;})[_0x543f('0x2c')](function(_0x17d5e2){if(_0x518e6f[_0x543f('0x38')][_0x543f('0x54')]()=='STUN'){var _0x177262=fs[_0x543f('0x55')](path[_0x543f('0x56')](config[_0x543f('0x57')],'server/files/templates/stun_multiple.ejs'),_0x543f('0x59'));var _0x16ed4f=ejs[_0x543f('0x2f')](_0x177262,{'networks':_0x17d5e2||[]});fs[_0x543f('0x5d')](_0x543f('0x5a'),_0x16ed4f);return respondWithRpcPromise('Reload',_0x543f('0x64'),{'module':_0x543f('0x60')});}else if(_0x518e6f[_0x543f('0x38')][_0x543f('0x54')]()==_0x543f('0x5b')){var _0x31c413=fs[_0x543f('0x55')](path['join'](config[_0x543f('0x57')],'server/files/templates/turn_multiple.ejs'),_0x543f('0x59'));var _0x8eaead=ejs[_0x543f('0x2f')](_0x31c413,{'networks':_0x17d5e2||[]});fs[_0x543f('0x5d')](_0x543f('0x5e'),_0x8eaead);return respondWithRpcPromise(_0x543f('0x5f'),_0x543f('0x64'),{'module':_0x543f('0x60')});}else{var _0x28b9b0=fs['readFileSync'](path[_0x543f('0x56')](config[_0x543f('0x57')],_0x543f('0x66')),_0x543f('0x59'));var _0x1a7e2b=ejs[_0x543f('0x2f')](_0x28b9b0,{'networks':_0x17d5e2||[]});fs[_0x543f('0x5d')](util['format'](_0x543f('0x67'),_0x3473cb[_0x543f('0x31')]['type'][_0x543f('0x62')]()),_0x1a7e2b);return respondWithRpcPromise('Reload',_0x543f('0x64'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x26d725){if(_0x26d725){return _0x518e6f;}return null;});})[_0x543f('0x2c')](respondWithResult(_0x28bad8,null))[_0x543f('0x4d')](handleError(_0x28bad8,null));};exports['destroy']=function(_0x20c192,_0x476fc3,_0x5a9484){var _0x2755bb;return db[_0x543f('0x48')]['find']({'where':{'id':_0x20c192[_0x543f('0x65')]['id']}})[_0x543f('0x2c')](function(_0x3e7071){_0x2755bb=_0x3e7071;return _0x3e7071;})[_0x543f('0x2c')](handleEntityNotFound(_0x476fc3,null))[_0x543f('0x2c')](removeEntity(_0x476fc3,null))[_0x543f('0x2c')](function(){if(_0x2755bb){return db[_0x543f('0x48')][_0x543f('0x4b')]({'where':{'type':_0x2755bb[_0x543f('0x38')]},'raw':!![]});}})[_0x543f('0x2c')](function(_0x4cada9){if(_0x2755bb[_0x543f('0x38')][_0x543f('0x54')]()==_0x543f('0x68')){var _0x15f7c7=fs[_0x543f('0x55')](path['join'](config[_0x543f('0x57')],_0x543f('0x58')),'utf8');var _0xcc0f87=ejs[_0x543f('0x2f')](_0x15f7c7,{'networks':_0x4cada9||[]});fs[_0x543f('0x5d')](_0x543f('0x5a'),_0xcc0f87);return respondWithRpcPromise(_0x543f('0x5f'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x2755bb[_0x543f('0x38')][_0x543f('0x54')]()==_0x543f('0x5b')){var _0xb7e55e=fs['readFileSync'](path[_0x543f('0x56')](config[_0x543f('0x57')],_0x543f('0x5c')),_0x543f('0x59'));var _0x34146c=ejs['render'](_0xb7e55e,{'networks':_0x4cada9||[]});fs['writeFileSync'](_0x543f('0x5e'),_0x34146c);return respondWithRpcPromise(_0x543f('0x5f'),_0x543f('0x69'),{'module':_0x543f('0x60')});}else{var _0x2eb5ed=fs[_0x543f('0x55')](path[_0x543f('0x56')](config[_0x543f('0x57')],_0x543f('0x66')),_0x543f('0x59'));var _0x5e45f4=ejs[_0x543f('0x2f')](_0x2eb5ed,{'networks':_0x4cada9||[]});fs[_0x543f('0x5d')](util['format'](_0x543f('0x67'),_0x20c192[_0x543f('0x31')]['type']['toLowerCase']()),_0x5e45f4);return respondWithRpcPromise(_0x543f('0x5f'),_0x543f('0x69'),{'module':_0x543f('0x63')});}return null;})['catch'](handleError(_0x476fc3,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 2d6007f..48ddb48 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53eb=['../../config/environment','define','Network','network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1c55f9,_0x3d4689){var _0x59435c=function(_0x5e7ca2){while(--_0x5e7ca2){_0x1c55f9['push'](_0x1c55f9['shift']());}};_0x59435c(++_0x3d4689);}(_0x53eb,0x16c));var _0xb53e=function(_0x24606c,_0x487147){_0x24606c=_0x24606c-0x0;var _0x2c8a20=_0x53eb[_0x24606c];return _0x2c8a20;};'use strict';var _=require(_0xb53e('0x0'));var util=require(_0xb53e('0x1'));var logger=require(_0xb53e('0x2'))(_0xb53e('0x3'));var moment=require(_0xb53e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb53e('0x5'));var fs=require('fs');var path=require(_0xb53e('0x6'));var rimraf=require(_0xb53e('0x7'));var config=require(_0xb53e('0x8'));var attributes=require('./network.attributes');module['exports']=function(_0x5289b4,_0x261bd5){return _0x5289b4[_0xb53e('0x9')](_0xb53e('0xa'),attributes,{'tableName':_0xb53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f0c=['../../config/environment','exports','define','network','lodash','bluebird','path','rimraf'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x4f0c,0xec));var _0xc4f0=function(_0xebbca6,_0x538fdd){_0xebbca6=_0xebbca6-0x0;var _0x17a637=_0x4f0c[_0xebbca6];return _0x17a637;};'use strict';var _=require(_0xc4f0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc4f0('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4f0('0x2'));var rimraf=require(_0xc4f0('0x3'));var config=require(_0xc4f0('0x4'));var attributes=require('./network.attributes');module[_0xc4f0('0x5')]=function(_0x4ddf8c,_0x37d130){return _0x4ddf8c[_0xc4f0('0x6')]('Network',attributes,{'tableName':_0xc4f0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index be1e3ba..dc735d9 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8634=['code','Network,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x8634,0x139));var _0x4863=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x8634[_0x30bd66];return _0x74c9dd;};'use strict';var _=require(_0x4863('0x0'));var util=require(_0x4863('0x1'));var moment=require(_0x4863('0x2'));var BPromise=require(_0x4863('0x3'));var rs=require(_0x4863('0x4'));var fs=require('fs');var Redis=require(_0x4863('0x5'));var db=require(_0x4863('0x6'))['db'];var utils=require(_0x4863('0x7'));var logger=require(_0x4863('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4863('0x9')][_0x4863('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c514d,_0x102270,_0xd848dd){return new BPromise(function(_0x309fb1,_0x561dee){return client[_0x4863('0xb')](_0x2c514d,_0xd848dd)[_0x4863('0xc')](function(_0x1b4a4f){logger[_0x4863('0xd')]('Network,\x20%s,\x20%s',_0x102270,_0x4863('0xe'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x102270,_0x4863('0xe'),JSON[_0x4863('0xf')](_0x1b4a4f));if(_0x1b4a4f[_0x4863('0x10')]){if(_0x1b4a4f[_0x4863('0x10')][_0x4863('0x11')]===0x1f4){logger[_0x4863('0x10')](_0x4863('0x12'),_0x102270,_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);return _0x561dee(_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);}logger[_0x4863('0x10')](_0x4863('0x12'),_0x102270,_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);return _0x309fb1(_0x1b4a4f[_0x4863('0x10')][_0x4863('0x13')]);}else{logger['info'](_0x4863('0x12'),_0x102270,'request\x20sent');_0x309fb1(_0x1b4a4f[_0x4863('0x14')][_0x4863('0x13')]);}})[_0x4863('0x15')](function(_0x39ca21){logger[_0x4863('0x10')](_0x4863('0x12'),_0x102270,_0x39ca21);_0x561dee(_0x39ca21);});});} \ No newline at end of file +var _0xcf0b=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','Network,\x20%s,\x20%s','message','result','catch'];(function(_0x2d460b,_0x4298ca){var _0x351100=function(_0x5c7065){while(--_0x5c7065){_0x2d460b['push'](_0x2d460b['shift']());}};_0x351100(++_0x4298ca);}(_0xcf0b,0x77));var _0xbcf0=function(_0x4d120d,_0x55a2c9){_0x4d120d=_0x4d120d-0x0;var _0x12b156=_0xcf0b[_0x4d120d];return _0x12b156;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbcf0('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcf0('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcf0('0x2'))(_0xbcf0('0x3'));var config=require('../../config/environment');var jayson=require(_0xbcf0('0x4'));var client=jayson[_0xbcf0('0x5')][_0xbcf0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x47f00a,_0x57300a,_0x47397c){return new BPromise(function(_0x2ec64d,_0x3bc46f){return client['request'](_0x47f00a,_0x47397c)[_0xbcf0('0x7')](function(_0x44a7d5){logger[_0xbcf0('0x8')]('Network,\x20%s,\x20%s',_0x57300a,_0xbcf0('0x9'));logger[_0xbcf0('0xa')]('Network,\x20%s,\x20%s,\x20%s',_0x57300a,_0xbcf0('0x9'),JSON['stringify'](_0x44a7d5));if(_0x44a7d5[_0xbcf0('0xb')]){if(_0x44a7d5[_0xbcf0('0xb')][_0xbcf0('0xc')]===0x1f4){logger[_0xbcf0('0xb')](_0xbcf0('0xd'),_0x57300a,_0x44a7d5['error'][_0xbcf0('0xe')]);return _0x3bc46f(_0x44a7d5[_0xbcf0('0xb')][_0xbcf0('0xe')]);}logger[_0xbcf0('0xb')](_0xbcf0('0xd'),_0x57300a,_0x44a7d5[_0xbcf0('0xb')]['message']);return _0x2ec64d(_0x44a7d5['error'][_0xbcf0('0xe')]);}else{logger[_0xbcf0('0x8')](_0xbcf0('0xd'),_0x57300a,_0xbcf0('0x9'));_0x2ec64d(_0x44a7d5[_0xbcf0('0xf')][_0xbcf0('0xe')]);}})[_0xbcf0('0x10')](function(_0x34e118){logger[_0xbcf0('0xb')](_0xbcf0('0xd'),_0x57300a,_0x34e118);_0x3bc46f(_0x34e118);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 4faffdc..ef759e6 100644 --- a/server/api/openchannelAccount/index.js +++ b/server/api/openchannelAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['getInteractions','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4975,0x86));var _0x5497=function(_0x52bc8e,_0x372b88){_0x52bc8e=_0x52bc8e-0x0;var _0x2af402=_0x4975[_0x52bc8e];return _0x2af402;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router[_0x5497('0xa')](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0xa')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x18')]);router['post']('/',auth[_0x5497('0xd')](),controller['create']);router[_0x5497('0x19')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x1a')]);router[_0x5497('0x19')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['addAnswer']);router['post'](_0x5497('0x1b'),controller[_0x5497('0x1c')]);router[_0x5497('0x19')]('/:id/applications',auth[_0x5497('0xd')](),controller[_0x5497('0x1d')]);router[_0x5497('0x19')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x1e')]);router[_0x5497('0x19')](_0x5497('0x1f'),auth[_0x5497('0xd')](),controller[_0x5497('0x20')]);router[_0x5497('0x21')]('/:id',auth[_0x5497('0xd')](),controller['update']);router[_0x5497('0x22')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x23')]);router[_0x5497('0x22')](_0x5497('0x11'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5497('0x22')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller[_0x5497('0x24')]);router['delete'](_0x5497('0x17'),auth['isAuthenticated'](),controller[_0x5497('0x25')]);module[_0x5497('0x26')]=router; \ No newline at end of file +var _0x326f=['/:id','delete','removeDispositions','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','addAgents'];(function(_0x33ef0b,_0x1e5276){var _0x82db9=function(_0x5d548d){while(--_0x5d548d){_0x33ef0b['push'](_0x33ef0b['shift']());}};_0x82db9(++_0x1e5276);}(_0x326f,0xd1));var _0xf326=function(_0x53056b,_0x161034){_0x53056b=_0x53056b-0x0;var _0x3fb1e5=_0x326f[_0x53056b];return _0x3fb1e5;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),auth['isAuthenticated'](),controller[_0xf326('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf326('0x17')]);router[_0xf326('0x18')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router[_0xf326('0x18')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller['addAnswer']);router[_0xf326('0x18')](_0xf326('0x1a'),controller[_0xf326('0x1b')]);router[_0xf326('0x18')](_0xf326('0x12'),auth[_0xf326('0xa')](),controller['addApplications']);router['post']('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x1c')]);router['post']('/:id/send',auth[_0xf326('0xa')](),controller['send']);router['put'](_0xf326('0x1d'),auth[_0xf326('0xa')](),controller['update']);router['delete'](_0xf326('0x1d'),auth[_0xf326('0xa')](),controller['destroy']);router[_0xf326('0x1e')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x1f')]);router[_0xf326('0x1e')](_0xf326('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xf326('0x15'),auth[_0xf326('0xa')](),controller[_0xf326('0x20')]);module[_0xf326('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 813bce4..d7a7390 100644 --- a/server/api/openchannelAccount/openchannelAccount.attributes.js +++ b/server/api/openchannelAccount/openchannelAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f97=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5ee5a2,_0x3797ac){var _0xfad5d3=function(_0x35e75c){while(--_0x35e75c){_0x5ee5a2['push'](_0x5ee5a2['shift']());}};_0xfad5d3(++_0x3797ac);}(_0x1f97,0xb5));var _0x71f9=function(_0x3a2bfc,_0x27bc6b){_0x3a2bfc=_0x3a2bfc-0x0;var _0x3ba11b=_0x1f97[_0x3a2bfc];return _0x3ba11b;};'use strict';var Sequelize=require(_0x71f9('0x0'));var rs=require(_0x71f9('0x1'));module['exports']={'name':{'type':Sequelize[_0x71f9('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x71f9('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x71f9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x71f9('0x3')],'defaultValue':function(){return _0x71f9('0x4');}},'notificationSound':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x71f9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x71f9('0x2')]},'queueTransfer':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x71f9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x71f9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x71f9('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x71f9('0x5')],'defaultValue':![],'comment':_0x71f9('0x7'),'set':function(_0x3d793d){if(!_0x3d793d)this[_0x71f9('0x8')](_0x71f9('0x9'),null);this[_0x71f9('0x8')](_0x71f9('0xa'),_0x3d793d);}}}; \ No newline at end of file +var _0xb83e=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0xb83e,0x6f));var _0xeb83=function(_0x3acb83,_0x19889d){_0x3acb83=_0x3acb83-0x0;var _0x181439=_0xb83e[_0x3acb83];return _0x181439;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xeb83('0x0'));module[_0xeb83('0x1')]={'name':{'type':Sequelize[_0xeb83('0x2')],'unique':_0xeb83('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xeb83('0x2')],'defaultValue':function(){return rs[_0xeb83('0x4')]();}},'replyUri':{'type':Sequelize[_0xeb83('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xeb83('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xeb83('0x5')],'defaultValue':function(){return _0xeb83('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeb83('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xeb83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xeb83('0x2')]},'queueTransfer':{'type':Sequelize[_0xeb83('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeb83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeb83('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeb83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeb83('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xeb83('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x202210){if(!_0x202210)this[_0xeb83('0xa')](_0xeb83('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x202210);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6bd7d4b..b3a8478 100644 --- a/server/api/openchannelAccount/openchannelAccount.controller.js +++ b/server/api/openchannelAccount/openchannelAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x604c=['removeAnswers','notify','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmContact','Contacts','DESC','Applications','applications','list','orderBy','priority','asc','List','defaults','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','created','autoclose','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','OpenchannelApplication','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','user','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','render','body','contact','interaction','account','index','Pause','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','OpenchannelAccount','includeAll','include','findAll','rows','catch','show','length','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','OpenchannelAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','options'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x604c,0x1bc));var _0xc604=function(_0x531b6a,_0x3922b9){_0x531b6a=_0x531b6a-0x0;var _0x2de747=_0x604c[_0x531b6a];return _0x2de747;};'use strict';var emlformat=require(_0xc604('0x0'));var rimraf=require(_0xc604('0x1'));var zipdir=require(_0xc604('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc604('0x3'));var moment=require(_0xc604('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc604('0x5'));var util=require('util');var path=require(_0xc604('0x6'));var sox=require(_0xc604('0x7'));var csv=require(_0xc604('0x8'));var ejs=require(_0xc604('0x9'));var fs=require('fs');var fs_extra=require(_0xc604('0xa'));var _=require(_0xc604('0xb'));var squel=require('squel');var crypto=require(_0xc604('0xc'));var jsforce=require(_0xc604('0xd'));var deskjs=require(_0xc604('0xe'));var toCsv=require(_0xc604('0x8'));var querystring=require(_0xc604('0xf'));var Papa=require(_0xc604('0x10'));var Redis=require(_0xc604('0x11'));var authService=require(_0xc604('0x12'));var qs=require(_0xc604('0x13'));var as=require(_0xc604('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc604('0x15'))(_0xc604('0x16'));var utils=require(_0xc604('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc604('0x18'));var db=require(_0xc604('0x19'))['db'];config['redis']=_['defaults'](config[_0xc604('0x1a')],{'host':_0xc604('0x1b'),'port':0x18eb});var socket=require(_0xc604('0x1c'))(new Redis(config[_0xc604('0x1a')]));require(_0xc604('0x1d'))[_0xc604('0x1e')](socket);var jayson=require(_0xc604('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc604('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f6f33,_0x400bca,_0x36c478,_0x5dd600){return new BPromise(function(_0x6185a1,_0x66ec56){var _0x16c686=_0x5dd600||client;return _0x16c686[_0xc604('0x21')](_0x2f6f33,_0x36c478)[_0xc604('0x22')](function(_0x585f8d){logger[_0xc604('0x23')](_0xc604('0x24'),_0x400bca,'request\x20sent');logger[_0xc604('0x25')](_0xc604('0x26'),_0x400bca,'request\x20sent',JSON['stringify'](_0x585f8d));if(_0x585f8d[_0xc604('0x27')]){if(_0x585f8d[_0xc604('0x27')][_0xc604('0x28')]===0x1f4){logger['error'](_0xc604('0x24'),_0x400bca,_0x585f8d[_0xc604('0x27')][_0xc604('0x29')]);return _0x66ec56(_0x585f8d['error']['message']);}logger[_0xc604('0x27')](_0xc604('0x24'),_0x400bca,_0x585f8d[_0xc604('0x27')]['message']);return _0x6185a1(_0x585f8d[_0xc604('0x27')][_0xc604('0x29')]);}else{logger['info'](_0xc604('0x24'),_0x400bca,_0xc604('0x2a'));_0x6185a1(_0x585f8d[_0xc604('0x2b')][_0xc604('0x29')]);}})['catch'](function(_0x7edb71){logger['error'](_0xc604('0x24'),_0x400bca,_0x7edb71);_0x66ec56(_0x7edb71);});});}function respondWithStatusCode(_0x54e27c,_0xce6a04){_0xce6a04=_0xce6a04||0xcc;return function(_0x528723){if(_0x528723){return _0x54e27c[_0xc604('0x2c')](_0xce6a04);}return _0x54e27c['status'](_0xce6a04)[_0xc604('0x2d')]();};}function respondWithResult(_0x3d6998,_0x1d32ae){_0x1d32ae=_0x1d32ae||0xc8;return function(_0x5cba13){if(_0x5cba13){return _0x3d6998[_0xc604('0x2e')](_0x1d32ae)[_0xc604('0x2f')](_0x5cba13);}};}function respondWithFilteredResult(_0x23c93e,_0x1bbd7e){return function(_0x1459b5){if(_0x1459b5){var _0x441775=typeof _0x1bbd7e[_0xc604('0x30')]===_0xc604('0x31')&&typeof _0x1bbd7e[_0xc604('0x32')]===_0xc604('0x31');var _0x5e9e81=_0x1459b5[_0xc604('0x33')];var _0x190fba=_0x441775?0x0:_0x1bbd7e[_0xc604('0x30')];var _0x43025a=_0x441775?_0x1459b5[_0xc604('0x33')]:_0x1bbd7e[_0xc604('0x30')]+_0x1bbd7e[_0xc604('0x32')];var _0x55ae60;if(_0x43025a>=_0x5e9e81){_0x43025a=_0x5e9e81;_0x55ae60=0xc8;}else{_0x55ae60=0xce;}_0x23c93e[_0xc604('0x2e')](_0x55ae60);return _0x23c93e[_0xc604('0x34')](_0xc604('0x35'),_0x190fba+'-'+_0x43025a+'/'+_0x5e9e81)[_0xc604('0x2f')](_0x1459b5);}return null;};}function patchUpdates(_0x9a668d){return function(_0x18d69d){try{jsonpatch[_0xc604('0x36')](_0x18d69d,_0x9a668d,!![]);}catch(_0x4bb599){return BPromise[_0xc604('0x37')](_0x4bb599);}return _0x18d69d[_0xc604('0x38')]();};}function saveUpdates(_0x4ba3f1,_0xd260f8){return function(_0x5720c4){if(_0x5720c4){return _0x5720c4['update'](_0x4ba3f1)[_0xc604('0x22')](function(_0x477958){return _0x477958;});}return null;};}function removeEntity(_0x524b3f,_0x38ba20){return function(_0x24c307){if(_0x24c307){return _0x24c307[_0xc604('0x39')]()['then'](function(){var _0xad013b=_0x24c307[_0xc604('0x3a')]({'plain':!![]});var _0x33d1e3=_0xc604('0x3b');return db[_0xc604('0x3c')][_0xc604('0x39')]({'where':{'type':_0x33d1e3,'resourceId':_0xad013b['id']}})['then'](function(){return _0x24c307;});})[_0xc604('0x22')](function(){_0x524b3f[_0xc604('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bcc2,_0xbb499c){return function(_0xf5a8cc){if(!_0xf5a8cc){_0x29bcc2[_0xc604('0x2c')](0x194);}return _0xf5a8cc;};}function handleError(_0x5b40f0,_0xaeb186){_0xaeb186=_0xaeb186||0x1f4;return function(_0x358ff4){logger[_0xc604('0x27')](_0x358ff4['stack']);if(_0x358ff4[_0xc604('0x3d')]){delete _0x358ff4[_0xc604('0x3d')];}_0x5b40f0[_0xc604('0x2e')](_0xaeb186)[_0xc604('0x3e')](_0x358ff4);};}function getMustacheRender(_0x10ca80,_0xfd2d3b){return Mustache[_0xc604('0x3f')](_0x10ca80,_['merge'](_0xfd2d3b[_0xc604('0x40')],{'contact':_0xfd2d3b[_0xc604('0x41')],'message':_0xfd2d3b[_0xc604('0x29')],'agent':_0xfd2d3b['agent'],'interaction':_0xfd2d3b[_0xc604('0x42')],'account':_0xfd2d3b[_0xc604('0x43')]}))||'';}exports[_0xc604('0x44')]=function(_0x1fdda8,_0x46dd9f){var _0x183fd2={'include':[{'model':db[_0xc604('0x45')],'as':'mandatoryDispositionPause'}]},_0x5029ef={},_0x3dce75={'count':0x0,'rows':[]};var _0x348d5d=_['map'](db['OpenchannelAccount'][_0xc604('0x46')],function(_0x28c131){return{'name':_0x28c131['fieldName'],'type':_0x28c131[_0xc604('0x47')][_0xc604('0x48')]};});_0x5029ef[_0xc604('0x49')]=_[_0xc604('0x4a')](_0x348d5d,_0xc604('0x3d'));_0x5029ef[_0xc604('0x4b')]=_[_0xc604('0x4c')](_0x1fdda8[_0xc604('0x4b')]);_0x5029ef[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x5029ef[_0xc604('0x49')],_0x5029ef['query']);_0x183fd2['attributes']=_[_0xc604('0x4e')](_0x5029ef[_0xc604('0x49')],qs[_0xc604('0x4f')](_0x1fdda8['query']['fields']));_0x183fd2[_0xc604('0x50')]=_0x183fd2[_0xc604('0x50')]['length']?_0x183fd2[_0xc604('0x50')]:_0x5029ef[_0xc604('0x49')];if(!_0x1fdda8['query'][_0xc604('0x51')](_0xc604('0x52'))){_0x183fd2[_0xc604('0x32')]=qs[_0xc604('0x32')](_0x1fdda8['query']['limit']);_0x183fd2['offset']=qs[_0xc604('0x30')](_0x1fdda8[_0xc604('0x4b')][_0xc604('0x30')]);}_0x183fd2[_0xc604('0x53')]=qs[_0xc604('0x54')](_0x1fdda8[_0xc604('0x4b')][_0xc604('0x54')]);_0x183fd2[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0x1fdda8[_0xc604('0x4b')],_0x5029ef[_0xc604('0x4d')]),_0x348d5d);if(_0x1fdda8[_0xc604('0x4b')][_0xc604('0x57')]){_0x183fd2[_0xc604('0x55')]=_[_0xc604('0x58')](_0x183fd2['where'],{'$or':_[_0xc604('0x4a')](_0x348d5d,function(_0x5ae153){if(_0x5ae153['type']!=='VIRTUAL'){var _0x24e3b1={};_0x24e3b1[_0x5ae153[_0xc604('0x3d')]]={'$like':'%'+_0x1fdda8['query']['filter']+'%'};return _0x24e3b1;}})});}_0x183fd2=_[_0xc604('0x58')]({},_0x183fd2,_0x1fdda8['options']);var _0x21cd85={'where':_0x183fd2[_0xc604('0x55')]};return db[_0xc604('0x59')][_0xc604('0x33')](_0x21cd85)[_0xc604('0x22')](function(_0x1314a2){_0x3dce75[_0xc604('0x33')]=_0x1314a2;if(_0x1fdda8[_0xc604('0x4b')][_0xc604('0x5a')]){_0x183fd2[_0xc604('0x5b')]=[{'all':!![]}];}return db[_0xc604('0x59')][_0xc604('0x5c')](_0x183fd2);})[_0xc604('0x22')](function(_0x383d9c){_0x3dce75[_0xc604('0x5d')]=_0x383d9c;return _0x3dce75;})['then'](respondWithFilteredResult(_0x46dd9f,_0x183fd2))[_0xc604('0x5e')](handleError(_0x46dd9f,null));};exports[_0xc604('0x5f')]=function(_0x286f0d,_0x506795){var _0x196aa1={'raw':![],'where':{'id':_0x286f0d['params']['id']},'include':[{'model':db[_0xc604('0x45')],'as':'mandatoryDispositionPause'}]},_0x1c1fc0={};_0x1c1fc0[_0xc604('0x49')]=_[_0xc604('0x4c')](db['OpenchannelAccount'][_0xc604('0x46')]);_0x1c1fc0[_0xc604('0x4b')]=_['keys'](_0x286f0d[_0xc604('0x4b')]);_0x1c1fc0[_0xc604('0x4d')]=_['intersection'](_0x1c1fc0[_0xc604('0x49')],_0x1c1fc0[_0xc604('0x4b')]);_0x196aa1[_0xc604('0x50')]=_[_0xc604('0x4e')](_0x1c1fc0['model'],qs['fields'](_0x286f0d[_0xc604('0x4b')]['fields']));_0x196aa1[_0xc604('0x50')]=_0x196aa1['attributes'][_0xc604('0x60')]?_0x196aa1[_0xc604('0x50')]:_0x1c1fc0[_0xc604('0x49')];if(_0x286f0d['query'][_0xc604('0x5a')]){_0x196aa1[_0xc604('0x5b')]=[{'all':!![]}];}_0x196aa1=_[_0xc604('0x58')]({},_0x196aa1,_0x286f0d['options']);return db[_0xc604('0x59')][_0xc604('0x61')](_0x196aa1)['then'](handleEntityNotFound(_0x506795,null))[_0xc604('0x22')](respondWithResult(_0x506795,null))[_0xc604('0x5e')](handleError(_0x506795,null));};exports['create']=function(_0x223260,_0x2c2d1f){return db[_0xc604('0x59')]['create'](_0x223260[_0xc604('0x40')],{})[_0xc604('0x22')](function(_0x3617a7){var _0x44889b=_0x223260['user'][_0xc604('0x3a')]({'plain':!![]});if(!_0x44889b)throw new Error(_0xc604('0x62'));if(_0x44889b[_0xc604('0x63')]==='user'){var _0x3d9270=_0x3617a7[_0xc604('0x3a')]({'plain':!![]});var _0x559ccf=_0xc604('0x3b');return db[_0xc604('0x64')][_0xc604('0x61')]({'where':{'name':_0x559ccf,'userProfileId':_0x44889b[_0xc604('0x65')]},'raw':!![]})['then'](function(_0x38d382){if(_0x38d382&&_0x38d382['autoAssociation']===0x0){return db[_0xc604('0x3c')]['create']({'name':_0x3d9270[_0xc604('0x3d')],'resourceId':_0x3d9270['id'],'type':_0x38d382[_0xc604('0x3d')],'sectionId':_0x38d382['id']},{})[_0xc604('0x22')](function(){return _0x3617a7;});}else{return _0x3617a7;}})['catch'](function(_0x51695b){logger[_0xc604('0x27')](_0xc604('0x66'),_0x51695b);throw _0x51695b;});}return _0x3617a7;})[_0xc604('0x22')](respondWithResult(_0x2c2d1f,0xc9))['catch'](handleError(_0x2c2d1f,null));};exports[_0xc604('0x67')]=function(_0x8e2873,_0x4df6c9){if(_0x8e2873[_0xc604('0x40')]['id']){delete _0x8e2873[_0xc604('0x40')]['id'];}return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x8e2873[_0xc604('0x68')]['id']},'include':[{'model':db[_0xc604('0x45')],'as':'mandatoryDispositionPause'}]})[_0xc604('0x22')](handleEntityNotFound(_0x4df6c9,null))[_0xc604('0x22')](saveUpdates(_0x8e2873[_0xc604('0x40')],null))[_0xc604('0x22')](respondWithResult(_0x4df6c9,null))[_0xc604('0x5e')](handleError(_0x4df6c9,null));};exports['destroy']=function(_0x3d7255,_0x21a4b1){return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x3d7255[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x21a4b1,null))[_0xc604('0x22')](removeEntity(_0x21a4b1,null))[_0xc604('0x5e')](handleError(_0x21a4b1,null));};exports[_0xc604('0x69')]=function(_0x34014c,_0x3390c3){return db[_0xc604('0x59')]['describe']()[_0xc604('0x22')](respondWithResult(_0x3390c3,null))[_0xc604('0x5e')](handleError(_0x3390c3,null));};exports[_0xc604('0x6a')]=function(_0x307974,_0xd114da,_0x49acc5){if(_0x307974['body']['id']){delete _0x307974[_0xc604('0x40')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x307974['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0xd114da,null))[_0xc604('0x22')](function(_0x2f4832){if(_0x2f4832){_0x307974[_0xc604('0x40')][_0xc604('0x6b')]=_0x2f4832['id'];return db[_0xc604('0x6c')][_0xc604('0x6d')](_0x307974['body']);}})[_0xc604('0x22')](respondWithResult(_0xd114da,null))[_0xc604('0x5e')](handleError(_0xd114da,null));};exports[_0xc604('0x6e')]=function(_0xc3c7ca,_0x5e9187,_0xea3ac8){var _0x45e3ae={'raw':![],'where':{}};var _0x4528e1={};var _0x628672={'count':0x0,'rows':[]};return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0xc3c7ca[_0xc604('0x68')]['id']}})['then'](handleEntityNotFound(_0x5e9187,null))[_0xc604('0x22')](function(_0x41878a){if(_0x41878a){_0x4528e1[_0xc604('0x49')]=_[_0xc604('0x4c')](db[_0xc604('0x6c')]['rawAttributes']);_0x4528e1[_0xc604('0x4b')]=_[_0xc604('0x4c')](_0xc3c7ca[_0xc604('0x4b')]);_0x4528e1[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x4528e1[_0xc604('0x49')],_0x4528e1[_0xc604('0x4b')]);_0x45e3ae[_0xc604('0x50')]=_[_0xc604('0x4e')](_0x4528e1[_0xc604('0x49')],qs['fields'](_0xc3c7ca[_0xc604('0x4b')]['fields']));_0x45e3ae[_0xc604('0x50')]=_0x45e3ae[_0xc604('0x50')][_0xc604('0x60')]?_0x45e3ae[_0xc604('0x50')]:_0x4528e1[_0xc604('0x49')];if(!_0xc3c7ca['query']['hasOwnProperty'](_0xc604('0x52'))){_0x45e3ae[_0xc604('0x32')]=qs[_0xc604('0x32')](_0xc3c7ca['query'][_0xc604('0x32')]);_0x45e3ae[_0xc604('0x30')]=qs[_0xc604('0x30')](_0xc3c7ca[_0xc604('0x4b')][_0xc604('0x30')]);}_0x45e3ae[_0xc604('0x53')]=qs[_0xc604('0x54')](_0xc3c7ca[_0xc604('0x4b')]['sort']);_0x45e3ae['where']=qs['filters'](_['pick'](_0xc3c7ca[_0xc604('0x4b')],_0x4528e1[_0xc604('0x4d')]));_0x45e3ae[_0xc604('0x55')][_0xc604('0x6b')]=_0x41878a['id'];if(_0xc3c7ca[_0xc604('0x4b')][_0xc604('0x57')]){_0x45e3ae[_0xc604('0x55')]=_[_0xc604('0x58')](_0x45e3ae[_0xc604('0x55')],{'$or':_['map'](_0x45e3ae[_0xc604('0x50')],function(_0x2b007a){var _0x433542={};_0x433542[_0x2b007a]={'$like':'%'+_0xc3c7ca[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x433542;})});}_0x45e3ae=_[_0xc604('0x58')]({},_0x45e3ae,_0xc3c7ca['options']);return db[_0xc604('0x6c')][_0xc604('0x33')]({'where':_0x45e3ae['where']})['then'](function(_0x1577b7){_0x628672[_0xc604('0x33')]=_0x1577b7;if(_0xc3c7ca[_0xc604('0x4b')]['includeAll']){_0x45e3ae['include']=[{'all':!![]}];}return db['Disposition'][_0xc604('0x5c')](_0x45e3ae);})[_0xc604('0x22')](function(_0x1b9a2a){_0x628672[_0xc604('0x5d')]=_0x1b9a2a;return _0x628672;});}})[_0xc604('0x22')](respondWithFilteredResult(_0x5e9187,_0x45e3ae))[_0xc604('0x5e')](handleError(_0x5e9187,null));};exports[_0xc604('0x70')]=function(_0x3148ac,_0x10f897,_0x47cee3){return db[_0xc604('0x59')][_0xc604('0x61')]({'where':{'id':_0x3148ac[_0xc604('0x68')]['id']}})['then'](handleEntityNotFound(_0x10f897,null))[_0xc604('0x22')](function(_0x322ea3){if(_0x322ea3){return _0x322ea3[_0xc604('0x70')](_0x3148ac['query'][_0xc604('0x71')]);}})[_0xc604('0x22')](respondWithStatusCode(_0x10f897,null))[_0xc604('0x5e')](handleError(_0x10f897,null));};exports[_0xc604('0x72')]=function(_0x4045b5,_0x89e91f,_0x2d9d77){if(_0x4045b5[_0xc604('0x40')]['id']){delete _0x4045b5['body']['id'];}return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x4045b5['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x89e91f,null))[_0xc604('0x22')](function(_0x3dabad){if(_0x3dabad){_0x4045b5[_0xc604('0x40')][_0xc604('0x6b')]=_0x3dabad['id'];return db[_0xc604('0x73')]['create'](_0x4045b5[_0xc604('0x40')]);}})[_0xc604('0x22')](respondWithResult(_0x89e91f,null))[_0xc604('0x5e')](handleError(_0x89e91f,null));};exports['getAnswers']=function(_0x17ecc1,_0x3cdadd,_0x1426a0){var _0x108c7e={'raw':![],'where':{}};var _0x3971bc={};var _0x59bbcc={'count':0x0,'rows':[]};return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0x17ecc1[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x3cdadd,null))['then'](function(_0x396c1d){if(_0x396c1d){_0x3971bc[_0xc604('0x49')]=_[_0xc604('0x4c')](db['CannedAnswer'][_0xc604('0x46')]);_0x3971bc['query']=_[_0xc604('0x4c')](_0x17ecc1[_0xc604('0x4b')]);_0x3971bc[_0xc604('0x4d')]=_['intersection'](_0x3971bc[_0xc604('0x49')],_0x3971bc[_0xc604('0x4b')]);_0x108c7e['attributes']=_[_0xc604('0x4e')](_0x3971bc['model'],qs['fields'](_0x17ecc1[_0xc604('0x4b')][_0xc604('0x4f')]));_0x108c7e[_0xc604('0x50')]=_0x108c7e[_0xc604('0x50')][_0xc604('0x60')]?_0x108c7e[_0xc604('0x50')]:_0x3971bc[_0xc604('0x49')];if(!_0x17ecc1[_0xc604('0x4b')][_0xc604('0x51')](_0xc604('0x52'))){_0x108c7e[_0xc604('0x32')]=qs[_0xc604('0x32')](_0x17ecc1[_0xc604('0x4b')]['limit']);_0x108c7e[_0xc604('0x30')]=qs[_0xc604('0x30')](_0x17ecc1[_0xc604('0x4b')][_0xc604('0x30')]);}_0x108c7e[_0xc604('0x53')]=qs[_0xc604('0x54')](_0x17ecc1[_0xc604('0x4b')][_0xc604('0x54')]);_0x108c7e[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0x17ecc1['query'],_0x3971bc['filters']));_0x108c7e[_0xc604('0x55')]['OpenchannelAccountId']=_0x396c1d['id'];if(_0x17ecc1[_0xc604('0x4b')][_0xc604('0x57')]){_0x108c7e[_0xc604('0x55')]=_[_0xc604('0x58')](_0x108c7e['where'],{'$or':_['map'](_0x108c7e[_0xc604('0x50')],function(_0x742d84){var _0x3679a9={};_0x3679a9[_0x742d84]={'$like':'%'+_0x17ecc1['query']['filter']+'%'};return _0x3679a9;})});}_0x108c7e=_[_0xc604('0x58')]({},_0x108c7e,_0x17ecc1[_0xc604('0x74')]);return db['CannedAnswer']['count']({'where':_0x108c7e[_0xc604('0x55')]})[_0xc604('0x22')](function(_0x3cd387){_0x59bbcc[_0xc604('0x33')]=_0x3cd387;if(_0x17ecc1['query'][_0xc604('0x5a')]){_0x108c7e['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xc604('0x5c')](_0x108c7e);})['then'](function(_0x216884){_0x59bbcc['rows']=_0x216884;return _0x59bbcc;});}})[_0xc604('0x22')](respondWithFilteredResult(_0x3cdadd,_0x108c7e))[_0xc604('0x5e')](handleError(_0x3cdadd,null));};exports[_0xc604('0x75')]=function(_0x51f938,_0x251dd4,_0x5e3ef3){return db[_0xc604('0x59')][_0xc604('0x61')]({'where':{'id':_0x51f938['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x251dd4,null))[_0xc604('0x22')](function(_0x5b98e0){if(_0x5b98e0){return _0x5b98e0[_0xc604('0x75')](_0x51f938['query'][_0xc604('0x71')]);}})[_0xc604('0x22')](respondWithStatusCode(_0x251dd4,null))[_0xc604('0x5e')](handleError(_0x251dd4,null));};exports[_0xc604('0x76')]=function(_0x507765,_0x5fe5c0,_0xa4e2c9){var _0x3f7c17={'body':_0x507765[_0xc604('0x40')],'channel':'openchannel'};var _0x35f811=[];var _0x39b0e3=[];var _0x5b2677={};var _0x6b37ca=![];return db['CmContact'][_0xc604('0x69')]()['then'](function(_0x53738e){if(!_0x53738e){throw new db['Sequelize'][(_0xc604('0x77'))](_0xc604('0x78'));}_0x35f811=_['difference'](_[_0xc604('0x4c')](_0x53738e),[_0xc604('0x79'),_0xc604('0x7a')]);_0x39b0e3=_['difference'](_[_0xc604('0x4c')](_0x53738e),[_0xc604('0x79'),_0xc604('0x7a'),_0xc604('0x7b'),_0xc604('0x7c')]);if(_0x507765[_0xc604('0x40')]['id']){delete _0x507765[_0xc604('0x40')]['id'];}if(_[_0xc604('0x7d')](_0x507765[_0xc604('0x40')][_0xc604('0x7e')])){throw new db['Sequelize'][(_0xc604('0x77'))](_0xc604('0x7f'));}if(_[_0xc604('0x7d')](_0x507765[_0xc604('0x40')]['body'])||_0x507765[_0xc604('0x40')][_0xc604('0x40')]===''){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc604('0x7d')](_0x507765[_0xc604('0x40')]['mapKey'])){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x39b0e3);}if(!_[_0xc604('0x81')](_0x39b0e3,_0x507765[_0xc604('0x40')]['mapKey'])){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))](_0xc604('0x82')+_0x39b0e3);}_0x5b2677[_0x507765[_0xc604('0x40')][_0xc604('0x83')]]=_0x507765[_0xc604('0x40')][_0xc604('0x7e')];})[_0xc604('0x22')](function(){return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x507765[_0xc604('0x68')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xc604('0x84')],'as':_0xc604('0x85'),'where':_0x5b2677,'limit':0x1,'order':[['updatedAt',_0xc604('0x86')]]}]},{'model':db['OpenchannelApplication'],'as':_0xc604('0x87')}]});})[_0xc604('0x22')](handleEntityNotFound(_0x5fe5c0,null))[_0xc604('0x22')](function(_0x3d77a4){if(_0x3d77a4&&_0x3d77a4['List']){_0x3f7c17[_0xc604('0x43')]=_0x3d77a4;_0x3f7c17[_0xc604('0x88')]=_0x3d77a4[_0xc604('0x87')];_0x3f7c17[_0xc604('0x89')]=_0x3d77a4['List'];_0x3f7c17[_0xc604('0x88')]=_[_0xc604('0x8a')](_0x3f7c17[_0xc604('0x88')],[_0xc604('0x8b')],[_0xc604('0x8c')]);if(_0x3f7c17['account'][_0xc604('0x87')]){delete _0x3f7c17['account'][_0xc604('0x87')];}if(_0x3f7c17[_0xc604('0x43')][_0xc604('0x8d')]&&_0x3f7c17[_0xc604('0x43')][_0xc604('0x8d')]['Contacts'][_0xc604('0x60')]){return _0x3f7c17[_0xc604('0x43')][_0xc604('0x8d')][_0xc604('0x85')][0x0];}var _0x418662=_[_0xc604('0x8e')](_0x507765[_0xc604('0x40')],{'firstName':_0x507765[_0xc604('0x40')][_0xc604('0x7e')],'ListId':_0x3d77a4[_0xc604('0x7c')]});_0x418662[_0x507765[_0xc604('0x40')][_0xc604('0x83')]]=_0x507765[_0xc604('0x40')]['from'];return db[_0xc604('0x84')][_0xc604('0x6d')](_0x418662,{'fields':_0x35f811,'raw':!![]});}})[_0xc604('0x22')](handleEntityNotFound(_0x5fe5c0,null))[_0xc604('0x22')](function(_0x19c1f1){_0x3f7c17[_0xc604('0x41')]=_0x19c1f1;if(_0x19c1f1){var _0x3141cd={'ContactId':_0x19c1f1['id'],'OpenchannelAccountId':_0x507765['params']['id'],'from':(_0x19c1f1[_0xc604('0x8f')]||'')+'\x20'+(_0x19c1f1['lastName']||'')};var _0x46566a={'OpenchannelAccountId':_0x507765[_0xc604('0x68')]['id'],'closed':![]};if(_0x507765['body'][_0xc604('0x90')]){_0x46566a['threadId']=_0x507765[_0xc604('0x40')]['threadId'];return db[_0xc604('0x91')][_0xc604('0x61')]({'where':_0x46566a})[_0xc604('0x22')](function(_0x1b1729){if(_0x1b1729){return[_0x1b1729,![]];}_0x3141cd[_0xc604('0x90')]=_0x507765[_0xc604('0x40')][_0xc604('0x90')];_0x3141cd[_0xc604('0x92')]=_0x507765['body'][_0xc604('0x92')];return db[_0xc604('0x91')][_0xc604('0x6d')](_0x3141cd)['then'](function(_0x3dfafd){return[_0x3dfafd,!![]];});});}else{_0x46566a[_0xc604('0x90')]=null;}_0x46566a['ContactId']=_0x19c1f1['id'];return db[_0xc604('0x91')][_0xc604('0x61')]({'where':_0x46566a})['then'](function(_0x5048ac){if(_0x5048ac){return[_0x5048ac,![]];}return db[_0xc604('0x91')][_0xc604('0x6d')](_0x3141cd)['then'](function(_0x4de927){return[_0x4de927,!![]];});});}})[_0xc604('0x93')](function(_0x2c3cf3,_0x11450c){if(_0x2c3cf3){_0x6b37ca=_0x11450c;if(!_0x11450c){var _0x4aa0fc={'from':(_0x3f7c17[_0xc604('0x41')][_0xc604('0x8f')]||'')+'\x20'+(_0x3f7c17[_0xc604('0x41')][_0xc604('0x94')]||'')};if(_0x507765[_0xc604('0x40')][_0xc604('0x90')]&&_0x507765[_0xc604('0x40')][_0xc604('0x95')]&&_0x507765['body'][_0xc604('0x90')]!=_0x507765[_0xc604('0x40')][_0xc604('0x95')]){_0x4aa0fc[_0xc604('0x90')]=_0x507765[_0xc604('0x40')][_0xc604('0x95')];}return _0x2c3cf3[_0xc604('0x67')](_0x4aa0fc);}else{return _0x2c3cf3;}}})['then'](function(_0x462070){_0x3f7c17[_0xc604('0x42')]=_0x462070[_0xc604('0x3a')]({'plain':!![]});_0x3f7c17['interaction'][_0xc604('0x96')]=_0x6b37ca;if(_0x3f7c17[_0xc604('0x42')]['created']){if(_0x3f7c17[_0xc604('0x43')][_0xc604('0x97')]){_0x3f7c17['applications'][_0xc604('0x98')]({'id':0x0,'priority':_0x3f7c17['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xc604('0x99')});}}return db[_0xc604('0x9a')][_0xc604('0x6d')]({'body':_0x507765[_0xc604('0x40')][_0xc604('0x40')],'OpenchannelAccountId':_0x507765[_0xc604('0x68')]['id'],'OpenchannelInteractionId':_0x462070['id'],'direction':'in','ContactId':_0x3f7c17[_0xc604('0x41')]['id'],'AttachmentId':_0x507765[_0xc604('0x40')][_0xc604('0x9b')]});})['then'](function(_0x84092b){_0x3f7c17[_0xc604('0x29')]=_0x84092b;if(_0x3f7c17[_0xc604('0x42')][_0xc604('0x9c')]){return db['User'][_0xc604('0x61')]({'attributes':['id',_0xc604('0x3d')],'where':{'id':_0x3f7c17[_0xc604('0x42')][_0xc604('0x9c')]}})['then'](function(_0x190004){if(_0x190004){_0x3f7c17[_0xc604('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc604('0x9d'),'appdata':_0x190004[_0xc604('0x3d')]+','+(_0x3f7c17[_0xc604('0x43')][_0xc604('0x9e')]||0xa),'interval':_0xc604('0x99')});_0x3f7c17[_0xc604('0x9f')]=![];}return respondWithRpcPromise(_0xc604('0xa0'),'startRouting',_0x3f7c17);});}return respondWithRpcPromise(_0xc604('0xa0'),_0xc604('0xa1'),_0x3f7c17);})[_0xc604('0x22')](function(_0x3b3734){respondWithRpcPromise(_0xc604('0xa2'),'EventManager',{'event':_0xc604('0x76'),'message':_0x3b3734},client9002);return _0x3b3734;})[_0xc604('0x22')](respondWithResult(_0x5fe5c0,null))[_0xc604('0x5e')](handleError(_0x5fe5c0,null));};exports[_0xc604('0xa3')]=function(_0x2e1108,_0x536196,_0x36359c){return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0x2e1108[_0xc604('0x68')]['id']}})['then'](handleEntityNotFound(_0x536196,null))[_0xc604('0x22')](function(_0x1e640f){if(_0x1e640f){return db['sequelize'][_0xc604('0xa4')](function(_0x42604f){return db[_0xc604('0xa5')][_0xc604('0x39')]({'where':{'OpenchannelAccountId':_0x2e1108['params']['id']},'transaction':_0x42604f})[_0xc604('0x22')](function(_0xc05974){var _0x5197a7=_[_0xc604('0x4a')](_0x2e1108[_0xc604('0x40')],function(_0x153e4a){_0x153e4a[_0xc604('0x6b')]=_0x2e1108[_0xc604('0x68')]['id'];return _0x153e4a;});return db['OpenchannelApplication']['bulkCreate'](_0x5197a7,{'transaction':_0x42604f});});})[_0xc604('0x22')](function(){return db[_0xc604('0xa5')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2e1108[_0xc604('0x68')]['id']},'order':_0xc604('0x8b')});});}})[_0xc604('0x22')](respondWithResult(_0x536196,null))[_0xc604('0x5e')](handleError(_0x536196,null));};exports[_0xc604('0xa6')]=function(_0xb17a7,_0x29adca,_0x368784){var _0x18231c={};var _0x27ea54={};var _0x2cf704;var _0x5d153b;return db[_0xc604('0x59')]['findOne']({'where':{'id':_0xb17a7[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x29adca,null))[_0xc604('0x22')](function(_0x3ccac8){if(_0x3ccac8){_0x2cf704=_0x3ccac8;_0x27ea54[_0xc604('0x49')]=_[_0xc604('0x4c')](db[_0xc604('0xa5')]['rawAttributes']);_0x27ea54[_0xc604('0x4b')]=_[_0xc604('0x4c')](_0xb17a7[_0xc604('0x4b')]);_0x27ea54[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x27ea54[_0xc604('0x49')],_0x27ea54[_0xc604('0x4b')]);_0x18231c[_0xc604('0x50')]=_[_0xc604('0x4e')](_0x27ea54[_0xc604('0x49')],qs[_0xc604('0x4f')](_0xb17a7['query'][_0xc604('0x4f')]));_0x18231c[_0xc604('0x50')]=_0x18231c['attributes'][_0xc604('0x60')]?_0x18231c[_0xc604('0x50')]:_0x27ea54[_0xc604('0x49')];_0x18231c[_0xc604('0x53')]=qs['sort'](_0xb17a7[_0xc604('0x4b')]['sort']);_0x18231c[_0xc604('0x55')]=qs['filters'](_[_0xc604('0x56')](_0xb17a7[_0xc604('0x4b')],_0x27ea54[_0xc604('0x4d')]));if(_0xb17a7[_0xc604('0x4b')][_0xc604('0x57')]){_0x18231c[_0xc604('0x55')]=_[_0xc604('0x58')](_0x18231c[_0xc604('0x55')],{'$or':_['map'](_0x18231c[_0xc604('0x50')],function(_0x56bac1){var _0x1fb9da={};_0x1fb9da[_0x56bac1]={'$like':'%'+_0xb17a7[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x1fb9da;})});}_0x18231c=_[_0xc604('0x58')]({},_0x18231c,_0xb17a7[_0xc604('0x74')]);return _0x2cf704['getApplications'](_0x18231c);}})[_0xc604('0x22')](function(_0x1a7261){if(_0x1a7261){_0x5d153b=_0x1a7261[_0xc604('0x60')];if(!_0xb17a7[_0xc604('0x4b')][_0xc604('0x51')](_0xc604('0x52'))){_0x18231c[_0xc604('0x32')]=qs[_0xc604('0x32')](_0xb17a7['query'][_0xc604('0x32')]);_0x18231c[_0xc604('0x30')]=qs[_0xc604('0x30')](_0xb17a7[_0xc604('0x4b')][_0xc604('0x30')]);}return _0x2cf704['getApplications'](_0x18231c);}})[_0xc604('0x22')](function(_0x517fb9){if(_0x517fb9){return _0x517fb9?{'count':_0x5d153b,'rows':_0x517fb9}:null;}})[_0xc604('0x22')](respondWithResult(_0x29adca,null))['catch'](handleError(_0x29adca,null));};exports[_0xc604('0xa7')]=function(_0x329e10,_0x5d1b7e,_0x369934){var _0x4356ec={'raw':![],'where':{}};var _0x374eb9={};var _0x17a03f={'count':0x0,'rows':[]};return db[_0xc604('0x59')][_0xc604('0x6f')]({'where':{'id':_0x329e10[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x5d1b7e,null))['then'](function(_0xd4a9a){if(_0xd4a9a){_0x374eb9[_0xc604('0x49')]=_[_0xc604('0x4c')](db['OpenchannelInteraction']['rawAttributes']);_0x374eb9[_0xc604('0x4b')]=_['keys'](_0x329e10[_0xc604('0x4b')]);_0x374eb9['filters']=_['intersection'](_0x374eb9[_0xc604('0x49')],_0x374eb9['query']);_0x4356ec['attributes']=_[_0xc604('0x4e')](_0x374eb9[_0xc604('0x49')],qs[_0xc604('0x4f')](_0x329e10['query'][_0xc604('0x4f')]));_0x4356ec[_0xc604('0x50')]=_0x4356ec[_0xc604('0x50')][_0xc604('0x60')]?_0x4356ec[_0xc604('0x50')]:_0x374eb9[_0xc604('0x49')];if(!_0x329e10[_0xc604('0x4b')]['hasOwnProperty'](_0xc604('0x52'))){_0x4356ec[_0xc604('0x32')]=qs[_0xc604('0x32')](_0x329e10[_0xc604('0x4b')][_0xc604('0x32')]);_0x4356ec[_0xc604('0x30')]=qs[_0xc604('0x30')](_0x329e10[_0xc604('0x4b')][_0xc604('0x30')]);}_0x4356ec['order']=qs[_0xc604('0x54')](_0x329e10[_0xc604('0x4b')]['sort']);_0x4356ec[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0x329e10['query'],_0x374eb9['filters']));_0x4356ec[_0xc604('0x55')][_0xc604('0x6b')]=_0xd4a9a['id'];if(_0x329e10['query'][_0xc604('0x57')]){_0x4356ec['where']=_[_0xc604('0x58')](_0x4356ec[_0xc604('0x55')],{'$or':_['map'](_0x4356ec[_0xc604('0x50')],function(_0x4bff21){var _0x245d92={};_0x245d92[_0x4bff21]={'$like':'%'+_0x329e10[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x245d92;})});}_0x4356ec=_[_0xc604('0x58')]({},_0x4356ec,_0x329e10[_0xc604('0x74')]);return db[_0xc604('0x91')][_0xc604('0x33')]({'where':_0x4356ec[_0xc604('0x55')]})[_0xc604('0x22')](function(_0xe5d7c6){_0x17a03f[_0xc604('0x33')]=_0xe5d7c6;if(_0x329e10['query'][_0xc604('0x5a')]){_0x4356ec[_0xc604('0x5b')]=[{'model':db['CmContact'],'as':_0xc604('0xa8'),'required':![]},{'model':db[_0xc604('0xa9')],'as':_0xc604('0xaa'),'attributes':[_0xc604('0x3d'),_0xc604('0xab'),'internal'],'required':![]},{'model':db[_0xc604('0xac')],'as':'Tags','attributes':['id','name',_0xc604('0xad')],'where':_0x329e10[_0xc604('0x4b')][_0xc604('0xae')]?{'id':_0x329e10[_0xc604('0x4b')][_0xc604('0xae')]}:undefined,'required':_0x329e10[_0xc604('0x4b')][_0xc604('0xae')]?!![]:![]}];}return db[_0xc604('0x91')]['findAll'](_0x4356ec);})['then'](function(_0x1a7463){_0x17a03f[_0xc604('0x5d')]=_0x1a7463;return _0x17a03f;});}})[_0xc604('0x22')](respondWithFilteredResult(_0x5d1b7e,_0x4356ec))[_0xc604('0x5e')](handleError(_0x5d1b7e,null));};exports[_0xc604('0xaf')]=function(_0x47197d,_0x1dc7f4,_0xd2ccb2){return db['OpenchannelAccount'][_0xc604('0x61')]({'where':{'id':_0x47197d['params']['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x1dc7f4,null))['then'](function(_0xc3f6c1){if(_0xc3f6c1){return _0xc3f6c1['addAgents'](_0x47197d[_0xc604('0x40')][_0xc604('0x71')],_[_0xc604('0xb0')](_0x47197d[_0xc604('0x40')],[_0xc604('0x71'),'id'])||{})[_0xc604('0x93')](function(_0x3bb411){for(var _0x920fbe=0x0;_0x920fbe<_0x47197d[_0xc604('0x40')]['ids']['length'];_0x920fbe+=0x1){socket[_0xc604('0xb1')](_0xc604('0xb2'),{'UserId':_0x47197d[_0xc604('0x40')][_0xc604('0x71')][_0x920fbe],'OpenchannelAccountId':_0x47197d['params']['id']});}return _0x3bb411;});}})[_0xc604('0x22')](respondWithResult(_0x1dc7f4,null))['catch'](handleError(_0x1dc7f4,null));};exports[_0xc604('0xb3')]=function(_0x47c9e9,_0x29f7c9,_0x2edbaa){return db[_0xc604('0x59')]['find']({'where':{'id':_0x47c9e9[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x29f7c9,null))[_0xc604('0x22')](function(_0x30061b){if(_0x30061b){return _0x30061b['removeAgents'](_0x47c9e9[_0xc604('0x4b')][_0xc604('0x71')])['then'](function(){if(_[_0xc604('0xb4')](_0x47c9e9[_0xc604('0x4b')]['ids'])){for(var _0x1434c7=0x0;_0x1434c7<_0x47c9e9['query'][_0xc604('0x71')][_0xc604('0x60')];_0x1434c7+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x47c9e9['query']['ids'][_0x1434c7]),'OpenchannelAccountId':Number(_0x47c9e9[_0xc604('0x68')]['id'])});}}else{socket[_0xc604('0xb1')](_0xc604('0xb5'),{'UserId':Number(_0x47c9e9[_0xc604('0x4b')][_0xc604('0x71')]),'OpenchannelAccountId':Number(_0x47c9e9[_0xc604('0x68')]['id'])});}});}})[_0xc604('0x22')](respondWithStatusCode(_0x29f7c9,null))['catch'](handleError(_0x29f7c9,null));};exports['getAgents']=function(_0xd7a4c6,_0x4d0ba6,_0xfee184){var _0x1010d1={};var _0x15f388={};var _0x50f184;var _0x3bac11;return db[_0xc604('0x59')]['findOne']({'where':{'id':_0xd7a4c6[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x4d0ba6,null))['then'](function(_0x581cc6){if(_0x581cc6){_0x50f184=_0x581cc6;_0x15f388[_0xc604('0x49')]=_['keys'](db[_0xc604('0xa9')]['rawAttributes']);_0x15f388['query']=_[_0xc604('0x4c')](_0xd7a4c6[_0xc604('0x4b')]);_0x15f388[_0xc604('0x4d')]=_[_0xc604('0x4e')](_0x15f388[_0xc604('0x49')],_0x15f388['query']);_0x1010d1[_0xc604('0x50')]=_['intersection'](_0x15f388[_0xc604('0x49')],qs[_0xc604('0x4f')](_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x4f')]));_0x1010d1[_0xc604('0x50')]=_0x1010d1['attributes'][_0xc604('0x60')]?_0x1010d1[_0xc604('0x50')]:_0x15f388['model'];_0x1010d1[_0xc604('0x53')]=qs['sort'](_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x54')]);_0x1010d1[_0xc604('0x55')]=qs[_0xc604('0x4d')](_[_0xc604('0x56')](_0xd7a4c6[_0xc604('0x4b')],_0x15f388[_0xc604('0x4d')]));if(_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x57')]){_0x1010d1[_0xc604('0x55')]=_[_0xc604('0x58')](_0x1010d1[_0xc604('0x55')],{'$or':_[_0xc604('0x4a')](_0x1010d1[_0xc604('0x50')],function(_0x22d9e2){var _0x14438f={};_0x14438f[_0x22d9e2]={'$like':'%'+_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x57')]+'%'};return _0x14438f;})});}_0x1010d1=_[_0xc604('0x58')]({},_0x1010d1,_0xd7a4c6[_0xc604('0x74')]);return _0x50f184[_0xc604('0xb6')](_0x1010d1);}})['then'](function(_0x18ef2d){if(_0x18ef2d){_0x3bac11=_0x18ef2d[_0xc604('0x60')];if(!_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x51')](_0xc604('0x52'))){_0x1010d1[_0xc604('0x32')]=qs['limit'](_0xd7a4c6[_0xc604('0x4b')][_0xc604('0x32')]);_0x1010d1['offset']=qs['offset'](_0xd7a4c6['query'][_0xc604('0x30')]);}return _0x50f184['getAgents'](_0x1010d1);}})[_0xc604('0x22')](function(_0x3adae1){if(_0x3adae1){return _0x3adae1?{'count':_0x3bac11,'rows':_0x3adae1}:null;}})['then'](respondWithResult(_0x4d0ba6,null))[_0xc604('0x5e')](handleError(_0x4d0ba6,null));};exports[_0xc604('0x3e')]=function(_0x45e610,_0x494891,_0x535b9e){var _0x385108,_0x41c139,_0x103027;if(_[_0xc604('0x7d')](_0x45e610[_0xc604('0x40')][_0xc604('0x40')])||_0x45e610[_0xc604('0x40')][_0xc604('0x40')]===''){throw new db[(_0xc604('0x80'))][(_0xc604('0x77'))](_0xc604('0xb7'));}if(_[_0xc604('0x7d')](_0x45e610[_0xc604('0x40')]['to'])){}_0x385108=_0x45e610['body']['to'];return db['OpenchannelAccount'][_0xc604('0x6f')]({'where':{'id':_0x45e610[_0xc604('0x68')]['id']}})[_0xc604('0x22')](handleEntityNotFound(_0x494891,null))[_0xc604('0x22')](function(_0x2b427a){if(_0x2b427a){return db[_0xc604('0x59')][_0xc604('0x61')]({'where':{'id':_0x2b427a['id']},'include':[{'model':db['CmList'],'as':_0xc604('0x8d'),'include':[{'model':db[_0xc604('0x84')],'as':_0xc604('0x85'),'where':{[_0x2b427a[_0xc604('0x83')]]:_0x385108},'limit':0x1,'order':[[_0xc604('0x7a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x494891,null))['then'](function(_0x39df36){if(_0x39df36&&_0x39df36[_0xc604('0x8d')]){_0x41c139=_0x39df36[_0xc604('0x3a')]({'plain':!![]});if(_0x41c139[_0xc604('0x8d')]&&_0x41c139[_0xc604('0x8d')][_0xc604('0x85')][_0xc604('0x60')]){return _0x41c139['List'][_0xc604('0x85')][0x0];}return db[_0xc604('0x84')][_0xc604('0x6d')](_['defaults'](_0x45e610[_0xc604('0x40')],{'firstName':_0x385108,[_0x39df36[_0xc604('0x83')]]:_0x385108,'phone':_0x385108,'ListId':_0x41c139[_0xc604('0x7c')]}));}})[_0xc604('0x22')](handleEntityNotFound(_0x494891,null))['then'](function(_0x20eda3){if(_0x20eda3){_0x103027=_0x20eda3;return db[_0xc604('0x91')]['find']({'where':{'ContactId':_0x103027['id'],'closed':![],'OpenchannelAccountId':_0x41c139['id']}})[_0xc604('0x22')](function(_0x38106f){if(_0x38106f){return[_0x38106f,![]];}return db['OpenchannelInteraction'][_0xc604('0x6d')]({'UserId':_0x45e610[_0xc604('0xb8')]['id'],'ContactId':_0x103027['id'],'OpenchannelAccountId':_0x41c139['id'],'lastMsgDirection':'out','Messages':[_[_0xc604('0x58')](_0x45e610['body'],{'read':![],'body':_0x45e610['body'][_0xc604('0x40')],'OpenchannelAccountId':_0x41c139['id'],'UserId':_0x45e610[_0xc604('0xb8')]['id'],'ContactId':_0x103027['id']})]},{'include':[{'model':db[_0xc604('0x9a')],'as':_0xc604('0xb9')}]})[_0xc604('0x22')](function(_0x47e8fe){return[_0x47e8fe,!![]];});});}})[_0xc604('0x93')](function(_0x5c707b,_0x3a79d1){if(_0x3a79d1){return _0x5c707b;}return db[_0xc604('0x9a')][_0xc604('0x6d')](_['merge'](_0x45e610[_0xc604('0x40')],{'read':![],'body':_0x45e610[_0xc604('0x40')][_0xc604('0x40')],'OpenchannelAccountId':_0x41c139['id'],'OpenchannelInteractionId':_0x5c707b['id'],'UserId':_0x45e610[_0xc604('0xb8')]['id'],'ContactId':_0x103027['id']}))['then'](function(_0x17a372){_0x5c707b['dataValues'][_0xc604('0xb9')]=[];_0x5c707b[_0xc604('0xba')][_0xc604('0xb9')]['push'](_0x17a372['dataValues']);return _0x5c707b;});});}})[_0xc604('0x22')](respondWithResult(_0x494891,null))['catch'](handleError(_0x494891,null));}; \ No newline at end of file +var _0x14d5=['mapKey','CmList','List','Contacts','OpenchannelApplication','Applications','applications','orderBy','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','notify','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','User','getAgents','DESC','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','render','merge','contact','agent','interaction','account','map','OpenchannelAccount','model','filters','intersection','query','attributes','fields','hasOwnProperty','sort','filter','where','type','VIRTUAL','options','includeAll','include','findAll','show','Pause','mandatoryDispositionPause','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','find','params','describe','addDisposition','Disposition','findOne','rawAttributes','nolimit','order','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','pick','rows','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x37a44b,_0x201a7f){var _0x28c425=function(_0x3894c0){while(--_0x3894c0){_0x37a44b['push'](_0x37a44b['shift']());}};_0x28c425(++_0x201a7f);}(_0x14d5,0x1ae));var _0x514d=function(_0x12d44c,_0xf11296){_0x12d44c=_0x12d44c-0x0;var _0x4fde20=_0x14d5[_0x12d44c];return _0x4fde20;};'use strict';var emlformat=require(_0x514d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x514d('0x1'));var jsonpatch=require(_0x514d('0x2'));var rp=require('request-promise');var moment=require(_0x514d('0x3'));var BPromise=require(_0x514d('0x4'));var Mustache=require(_0x514d('0x5'));var util=require(_0x514d('0x6'));var path=require(_0x514d('0x7'));var sox=require('sox');var csv=require(_0x514d('0x8'));var ejs=require(_0x514d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x514d('0xa'));var squel=require(_0x514d('0xb'));var crypto=require(_0x514d('0xc'));var jsforce=require(_0x514d('0xd'));var deskjs=require(_0x514d('0xe'));var toCsv=require(_0x514d('0x8'));var querystring=require(_0x514d('0xf'));var Papa=require(_0x514d('0x10'));var Redis=require('ioredis');var authService=require(_0x514d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x514d('0x12'));var hardwareService=require(_0x514d('0x13'));var logger=require('../../config/logger')(_0x514d('0x14'));var utils=require(_0x514d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x514d('0x16')]=_[_0x514d('0x17')](config['redis'],{'host':_0x514d('0x18'),'port':0x18eb});var socket=require(_0x514d('0x19'))(new Redis(config['redis']));require(_0x514d('0x1a'))[_0x514d('0x1b')](socket);var jayson=require(_0x514d('0x1c'));var client=jayson[_0x514d('0x1d')][_0x514d('0x1e')]({'port':0x232c});var client9002=jayson[_0x514d('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2208,_0x5ef2d1,_0x437d88,_0x10d151){return new BPromise(function(_0x128245,_0xe7816a){var _0x1ba333=_0x10d151||client;return _0x1ba333[_0x514d('0x1f')](_0x3d2208,_0x437d88)[_0x514d('0x20')](function(_0x440c7a){logger[_0x514d('0x21')](_0x514d('0x22'),_0x5ef2d1,'request\x20sent');logger['debug'](_0x514d('0x23'),_0x5ef2d1,_0x514d('0x24'),JSON[_0x514d('0x25')](_0x440c7a));if(_0x440c7a[_0x514d('0x26')]){if(_0x440c7a['error'][_0x514d('0x27')]===0x1f4){logger[_0x514d('0x26')](_0x514d('0x22'),_0x5ef2d1,_0x440c7a['error'][_0x514d('0x28')]);return _0xe7816a(_0x440c7a[_0x514d('0x26')]['message']);}logger[_0x514d('0x26')](_0x514d('0x22'),_0x5ef2d1,_0x440c7a[_0x514d('0x26')][_0x514d('0x28')]);return _0x128245(_0x440c7a['error']['message']);}else{logger[_0x514d('0x21')](_0x514d('0x22'),_0x5ef2d1,_0x514d('0x24'));_0x128245(_0x440c7a[_0x514d('0x29')]['message']);}})[_0x514d('0x2a')](function(_0xc1975b){logger[_0x514d('0x26')](_0x514d('0x22'),_0x5ef2d1,_0xc1975b);_0xe7816a(_0xc1975b);});});}function respondWithStatusCode(_0x6fdad8,_0x16d554){_0x16d554=_0x16d554||0xcc;return function(_0x895161){if(_0x895161){return _0x6fdad8[_0x514d('0x2b')](_0x16d554);}return _0x6fdad8[_0x514d('0x2c')](_0x16d554)[_0x514d('0x2d')]();};}function respondWithResult(_0x21d40d,_0x579b8e){_0x579b8e=_0x579b8e||0xc8;return function(_0x3eda2f){if(_0x3eda2f){return _0x21d40d[_0x514d('0x2c')](_0x579b8e)[_0x514d('0x2e')](_0x3eda2f);}};}function respondWithFilteredResult(_0x5afa9a,_0x2d0f4a){return function(_0x24e573){if(_0x24e573){var _0x13bd1b=typeof _0x2d0f4a['offset']==='undefined'&&typeof _0x2d0f4a[_0x514d('0x2f')]===_0x514d('0x30');var _0x14ce83=_0x24e573[_0x514d('0x31')];var _0x50c14e=_0x13bd1b?0x0:_0x2d0f4a['offset'];var _0x3f1437=_0x13bd1b?_0x24e573[_0x514d('0x31')]:_0x2d0f4a[_0x514d('0x32')]+_0x2d0f4a['limit'];var _0x325260;if(_0x3f1437>=_0x14ce83){_0x3f1437=_0x14ce83;_0x325260=0xc8;}else{_0x325260=0xce;}_0x5afa9a[_0x514d('0x2c')](_0x325260);return _0x5afa9a[_0x514d('0x33')](_0x514d('0x34'),_0x50c14e+'-'+_0x3f1437+'/'+_0x14ce83)[_0x514d('0x2e')](_0x24e573);}return null;};}function patchUpdates(_0x9c7704){return function(_0x1be01d){try{jsonpatch[_0x514d('0x35')](_0x1be01d,_0x9c7704,!![]);}catch(_0x33fe53){return BPromise['reject'](_0x33fe53);}return _0x1be01d[_0x514d('0x36')]();};}function saveUpdates(_0x42221c,_0x4d5eea){return function(_0x49f16a){if(_0x49f16a){return _0x49f16a[_0x514d('0x37')](_0x42221c)['then'](function(_0x502d34){return _0x502d34;});}return null;};}function removeEntity(_0x51b964,_0x41f8ec){return function(_0xa30839){if(_0xa30839){return _0xa30839['destroy']()[_0x514d('0x20')](function(){var _0x3dc35c=_0xa30839[_0x514d('0x38')]({'plain':!![]});var _0x5f0c40=_0x514d('0x39');return db[_0x514d('0x3a')][_0x514d('0x3b')]({'where':{'type':_0x5f0c40,'resourceId':_0x3dc35c['id']}})['then'](function(){return _0xa30839;});})[_0x514d('0x20')](function(){_0x51b964[_0x514d('0x2c')](0xcc)[_0x514d('0x2d')]();});}};}function handleEntityNotFound(_0x4aeaf8,_0x3ebf35){return function(_0x2b56e1){if(!_0x2b56e1){_0x4aeaf8[_0x514d('0x2b')](0x194);}return _0x2b56e1;};}function handleError(_0x387223,_0x46ba63){_0x46ba63=_0x46ba63||0x1f4;return function(_0x1f6b96){logger[_0x514d('0x26')](_0x1f6b96[_0x514d('0x3c')]);if(_0x1f6b96[_0x514d('0x3d')]){delete _0x1f6b96[_0x514d('0x3d')];}_0x387223[_0x514d('0x2c')](_0x46ba63)[_0x514d('0x3e')](_0x1f6b96);};}function getMustacheRender(_0x53c14b,_0x22f90a){return Mustache[_0x514d('0x3f')](_0x53c14b,_[_0x514d('0x40')](_0x22f90a['body'],{'contact':_0x22f90a[_0x514d('0x41')],'message':_0x22f90a[_0x514d('0x28')],'agent':_0x22f90a[_0x514d('0x42')],'interaction':_0x22f90a[_0x514d('0x43')],'account':_0x22f90a[_0x514d('0x44')]}))||'';}exports['index']=function(_0x350602,_0x44a270){var _0x3de061={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x57b6a6={},_0x1039af={'count':0x0,'rows':[]};var _0x469ba7=_[_0x514d('0x45')](db[_0x514d('0x46')]['rawAttributes'],function(_0x55a665){return{'name':_0x55a665['fieldName'],'type':_0x55a665['type']['key']};});_0x57b6a6[_0x514d('0x47')]=_[_0x514d('0x45')](_0x469ba7,'name');_0x57b6a6['query']=_['keys'](_0x350602['query']);_0x57b6a6[_0x514d('0x48')]=_[_0x514d('0x49')](_0x57b6a6['model'],_0x57b6a6[_0x514d('0x4a')]);_0x3de061[_0x514d('0x4b')]=_[_0x514d('0x49')](_0x57b6a6['model'],qs[_0x514d('0x4c')](_0x350602[_0x514d('0x4a')][_0x514d('0x4c')]));_0x3de061[_0x514d('0x4b')]=_0x3de061[_0x514d('0x4b')]['length']?_0x3de061[_0x514d('0x4b')]:_0x57b6a6[_0x514d('0x47')];if(!_0x350602[_0x514d('0x4a')][_0x514d('0x4d')]('nolimit')){_0x3de061[_0x514d('0x2f')]=qs[_0x514d('0x2f')](_0x350602['query']['limit']);_0x3de061['offset']=qs['offset'](_0x350602[_0x514d('0x4a')][_0x514d('0x32')]);}_0x3de061['order']=qs[_0x514d('0x4e')](_0x350602[_0x514d('0x4a')][_0x514d('0x4e')]);_0x3de061['where']=qs[_0x514d('0x48')](_['pick'](_0x350602[_0x514d('0x4a')],_0x57b6a6[_0x514d('0x48')]),_0x469ba7);if(_0x350602[_0x514d('0x4a')][_0x514d('0x4f')]){_0x3de061[_0x514d('0x50')]=_[_0x514d('0x40')](_0x3de061[_0x514d('0x50')],{'$or':_[_0x514d('0x45')](_0x469ba7,function(_0x1947c8){if(_0x1947c8[_0x514d('0x51')]!==_0x514d('0x52')){var _0x2b988c={};_0x2b988c[_0x1947c8['name']]={'$like':'%'+_0x350602[_0x514d('0x4a')][_0x514d('0x4f')]+'%'};return _0x2b988c;}})});}_0x3de061=_[_0x514d('0x40')]({},_0x3de061,_0x350602[_0x514d('0x53')]);var _0x5c9518={'where':_0x3de061[_0x514d('0x50')]};return db['OpenchannelAccount']['count'](_0x5c9518)[_0x514d('0x20')](function(_0x1d07ef){_0x1039af['count']=_0x1d07ef;if(_0x350602['query'][_0x514d('0x54')]){_0x3de061[_0x514d('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x514d('0x56')](_0x3de061);})[_0x514d('0x20')](function(_0x1f23d7){_0x1039af['rows']=_0x1f23d7;return _0x1039af;})[_0x514d('0x20')](respondWithFilteredResult(_0x44a270,_0x3de061))[_0x514d('0x2a')](handleError(_0x44a270,null));};exports[_0x514d('0x57')]=function(_0x1fc710,_0x1a83d1){var _0x5ddc74={'raw':![],'where':{'id':_0x1fc710['params']['id']},'include':[{'model':db[_0x514d('0x58')],'as':_0x514d('0x59')}]},_0x1c29f6={};_0x1c29f6[_0x514d('0x47')]=_['keys'](db[_0x514d('0x46')]['rawAttributes']);_0x1c29f6[_0x514d('0x4a')]=_[_0x514d('0x5a')](_0x1fc710[_0x514d('0x4a')]);_0x1c29f6['filters']=_[_0x514d('0x49')](_0x1c29f6['model'],_0x1c29f6[_0x514d('0x4a')]);_0x5ddc74[_0x514d('0x4b')]=_[_0x514d('0x49')](_0x1c29f6['model'],qs[_0x514d('0x4c')](_0x1fc710[_0x514d('0x4a')]['fields']));_0x5ddc74[_0x514d('0x4b')]=_0x5ddc74[_0x514d('0x4b')][_0x514d('0x5b')]?_0x5ddc74[_0x514d('0x4b')]:_0x1c29f6[_0x514d('0x47')];if(_0x1fc710[_0x514d('0x4a')][_0x514d('0x54')]){_0x5ddc74[_0x514d('0x55')]=[{'all':!![]}];}_0x5ddc74=_['merge']({},_0x5ddc74,_0x1fc710[_0x514d('0x53')]);return db[_0x514d('0x46')]['find'](_0x5ddc74)[_0x514d('0x20')](handleEntityNotFound(_0x1a83d1,null))[_0x514d('0x20')](respondWithResult(_0x1a83d1,null))[_0x514d('0x2a')](handleError(_0x1a83d1,null));};exports['create']=function(_0x51ac7a,_0x78bfd8){return db[_0x514d('0x46')][_0x514d('0x5c')](_0x51ac7a[_0x514d('0x5d')],{})['then'](function(_0x20c376){var _0x1b7551=_0x51ac7a[_0x514d('0x5e')][_0x514d('0x38')]({'plain':!![]});if(!_0x1b7551)throw new Error(_0x514d('0x5f'));if(_0x1b7551[_0x514d('0x60')]===_0x514d('0x5e')){var _0x5d7839=_0x20c376['get']({'plain':!![]});var _0x22e80d=_0x514d('0x39');return db[_0x514d('0x61')]['find']({'where':{'name':_0x22e80d,'userProfileId':_0x1b7551[_0x514d('0x62')]},'raw':!![]})[_0x514d('0x20')](function(_0x1aef27){if(_0x1aef27&&_0x1aef27['autoAssociation']===0x0){return db['UserProfileResource'][_0x514d('0x5c')]({'name':_0x5d7839[_0x514d('0x3d')],'resourceId':_0x5d7839['id'],'type':_0x1aef27[_0x514d('0x3d')],'sectionId':_0x1aef27['id']},{})[_0x514d('0x20')](function(){return _0x20c376;});}else{return _0x20c376;}})[_0x514d('0x2a')](function(_0x3df9b4){logger[_0x514d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3df9b4);throw _0x3df9b4;});}return _0x20c376;})[_0x514d('0x20')](respondWithResult(_0x78bfd8,0xc9))[_0x514d('0x2a')](handleError(_0x78bfd8,null));};exports[_0x514d('0x37')]=function(_0x9d1d50,_0xfcfba4){if(_0x9d1d50[_0x514d('0x5d')]['id']){delete _0x9d1d50['body']['id'];}return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0x9d1d50['params']['id']},'include':[{'model':db['Pause'],'as':_0x514d('0x59')}]})[_0x514d('0x20')](handleEntityNotFound(_0xfcfba4,null))[_0x514d('0x20')](saveUpdates(_0x9d1d50[_0x514d('0x5d')],null))[_0x514d('0x20')](respondWithResult(_0xfcfba4,null))['catch'](handleError(_0xfcfba4,null));};exports[_0x514d('0x3b')]=function(_0x199698,_0x411165){return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0x199698[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x411165,null))[_0x514d('0x20')](removeEntity(_0x411165,null))['catch'](handleError(_0x411165,null));};exports[_0x514d('0x65')]=function(_0x47bc23,_0x39c43f){return db[_0x514d('0x46')][_0x514d('0x65')]()[_0x514d('0x20')](respondWithResult(_0x39c43f,null))[_0x514d('0x2a')](handleError(_0x39c43f,null));};exports[_0x514d('0x66')]=function(_0x53f089,_0x88d706,_0x34ecd4){if(_0x53f089['body']['id']){delete _0x53f089[_0x514d('0x5d')]['id'];}return db[_0x514d('0x46')]['find']({'where':{'id':_0x53f089[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x88d706,null))[_0x514d('0x20')](function(_0x44b5dd){if(_0x44b5dd){_0x53f089[_0x514d('0x5d')]['OpenchannelAccountId']=_0x44b5dd['id'];return db[_0x514d('0x67')]['create'](_0x53f089[_0x514d('0x5d')]);}})[_0x514d('0x20')](respondWithResult(_0x88d706,null))[_0x514d('0x2a')](handleError(_0x88d706,null));};exports['getDispositions']=function(_0x54967c,_0x4c2a43,_0x6b7014){var _0xd0ee98={'raw':![],'where':{}};var _0xbafed3={};var _0x268a1d={'count':0x0,'rows':[]};return db[_0x514d('0x46')][_0x514d('0x68')]({'where':{'id':_0x54967c[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x4c2a43,null))[_0x514d('0x20')](function(_0x151fd2){if(_0x151fd2){_0xbafed3['model']=_[_0x514d('0x5a')](db[_0x514d('0x67')][_0x514d('0x69')]);_0xbafed3[_0x514d('0x4a')]=_[_0x514d('0x5a')](_0x54967c[_0x514d('0x4a')]);_0xbafed3[_0x514d('0x48')]=_[_0x514d('0x49')](_0xbafed3[_0x514d('0x47')],_0xbafed3[_0x514d('0x4a')]);_0xd0ee98['attributes']=_[_0x514d('0x49')](_0xbafed3[_0x514d('0x47')],qs[_0x514d('0x4c')](_0x54967c[_0x514d('0x4a')]['fields']));_0xd0ee98['attributes']=_0xd0ee98[_0x514d('0x4b')][_0x514d('0x5b')]?_0xd0ee98[_0x514d('0x4b')]:_0xbafed3[_0x514d('0x47')];if(!_0x54967c['query'][_0x514d('0x4d')](_0x514d('0x6a'))){_0xd0ee98['limit']=qs['limit'](_0x54967c[_0x514d('0x4a')][_0x514d('0x2f')]);_0xd0ee98[_0x514d('0x32')]=qs[_0x514d('0x32')](_0x54967c[_0x514d('0x4a')][_0x514d('0x32')]);}_0xd0ee98[_0x514d('0x6b')]=qs['sort'](_0x54967c[_0x514d('0x4a')]['sort']);_0xd0ee98[_0x514d('0x50')]=qs[_0x514d('0x48')](_['pick'](_0x54967c[_0x514d('0x4a')],_0xbafed3['filters']));_0xd0ee98[_0x514d('0x50')][_0x514d('0x6c')]=_0x151fd2['id'];if(_0x54967c[_0x514d('0x4a')][_0x514d('0x4f')]){_0xd0ee98['where']=_[_0x514d('0x40')](_0xd0ee98[_0x514d('0x50')],{'$or':_['map'](_0xd0ee98[_0x514d('0x4b')],function(_0x438c8c){var _0x4057d1={};_0x4057d1[_0x438c8c]={'$like':'%'+_0x54967c[_0x514d('0x4a')]['filter']+'%'};return _0x4057d1;})});}_0xd0ee98=_[_0x514d('0x40')]({},_0xd0ee98,_0x54967c[_0x514d('0x53')]);return db[_0x514d('0x67')][_0x514d('0x31')]({'where':_0xd0ee98[_0x514d('0x50')]})[_0x514d('0x20')](function(_0x25699b){_0x268a1d[_0x514d('0x31')]=_0x25699b;if(_0x54967c['query'][_0x514d('0x54')]){_0xd0ee98[_0x514d('0x55')]=[{'all':!![]}];}return db[_0x514d('0x67')][_0x514d('0x56')](_0xd0ee98);})[_0x514d('0x20')](function(_0x5baf51){_0x268a1d['rows']=_0x5baf51;return _0x268a1d;});}})['then'](respondWithFilteredResult(_0x4c2a43,_0xd0ee98))['catch'](handleError(_0x4c2a43,null));};exports['removeDispositions']=function(_0xff0b25,_0x15ed14,_0x569f62){return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0xff0b25[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x15ed14,null))[_0x514d('0x20')](function(_0x467946){if(_0x467946){return _0x467946[_0x514d('0x6d')](_0xff0b25[_0x514d('0x4a')][_0x514d('0x6e')]);}})[_0x514d('0x20')](respondWithStatusCode(_0x15ed14,null))[_0x514d('0x2a')](handleError(_0x15ed14,null));};exports[_0x514d('0x6f')]=function(_0x1a8171,_0x573190,_0x28f185){if(_0x1a8171[_0x514d('0x5d')]['id']){delete _0x1a8171['body']['id'];}return db[_0x514d('0x46')]['find']({'where':{'id':_0x1a8171[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x573190,null))[_0x514d('0x20')](function(_0x1504d0){if(_0x1504d0){_0x1a8171[_0x514d('0x5d')][_0x514d('0x6c')]=_0x1504d0['id'];return db[_0x514d('0x70')][_0x514d('0x5c')](_0x1a8171[_0x514d('0x5d')]);}})[_0x514d('0x20')](respondWithResult(_0x573190,null))[_0x514d('0x2a')](handleError(_0x573190,null));};exports['getAnswers']=function(_0x1b0576,_0x3cdf32,_0x326807){var _0x2eebc6={'raw':![],'where':{}};var _0x3a589c={};var _0x45b764={'count':0x0,'rows':[]};return db[_0x514d('0x46')][_0x514d('0x68')]({'where':{'id':_0x1b0576[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x3cdf32,null))['then'](function(_0x24126e){if(_0x24126e){_0x3a589c[_0x514d('0x47')]=_[_0x514d('0x5a')](db[_0x514d('0x70')]['rawAttributes']);_0x3a589c[_0x514d('0x4a')]=_[_0x514d('0x5a')](_0x1b0576[_0x514d('0x4a')]);_0x3a589c[_0x514d('0x48')]=_[_0x514d('0x49')](_0x3a589c[_0x514d('0x47')],_0x3a589c['query']);_0x2eebc6[_0x514d('0x4b')]=_[_0x514d('0x49')](_0x3a589c[_0x514d('0x47')],qs[_0x514d('0x4c')](_0x1b0576[_0x514d('0x4a')]['fields']));_0x2eebc6[_0x514d('0x4b')]=_0x2eebc6[_0x514d('0x4b')][_0x514d('0x5b')]?_0x2eebc6['attributes']:_0x3a589c[_0x514d('0x47')];if(!_0x1b0576[_0x514d('0x4a')]['hasOwnProperty'](_0x514d('0x6a'))){_0x2eebc6['limit']=qs[_0x514d('0x2f')](_0x1b0576[_0x514d('0x4a')]['limit']);_0x2eebc6[_0x514d('0x32')]=qs[_0x514d('0x32')](_0x1b0576[_0x514d('0x4a')]['offset']);}_0x2eebc6[_0x514d('0x6b')]=qs[_0x514d('0x4e')](_0x1b0576[_0x514d('0x4a')][_0x514d('0x4e')]);_0x2eebc6['where']=qs['filters'](_[_0x514d('0x71')](_0x1b0576['query'],_0x3a589c[_0x514d('0x48')]));_0x2eebc6[_0x514d('0x50')][_0x514d('0x6c')]=_0x24126e['id'];if(_0x1b0576[_0x514d('0x4a')]['filter']){_0x2eebc6[_0x514d('0x50')]=_[_0x514d('0x40')](_0x2eebc6[_0x514d('0x50')],{'$or':_['map'](_0x2eebc6[_0x514d('0x4b')],function(_0x23d10d){var _0x355b74={};_0x355b74[_0x23d10d]={'$like':'%'+_0x1b0576['query'][_0x514d('0x4f')]+'%'};return _0x355b74;})});}_0x2eebc6=_['merge']({},_0x2eebc6,_0x1b0576[_0x514d('0x53')]);return db[_0x514d('0x70')][_0x514d('0x31')]({'where':_0x2eebc6[_0x514d('0x50')]})[_0x514d('0x20')](function(_0xfd79d7){_0x45b764[_0x514d('0x31')]=_0xfd79d7;if(_0x1b0576[_0x514d('0x4a')][_0x514d('0x54')]){_0x2eebc6[_0x514d('0x55')]=[{'all':!![]}];}return db[_0x514d('0x70')][_0x514d('0x56')](_0x2eebc6);})[_0x514d('0x20')](function(_0x2352e1){_0x45b764[_0x514d('0x72')]=_0x2352e1;return _0x45b764;});}})[_0x514d('0x20')](respondWithFilteredResult(_0x3cdf32,_0x2eebc6))['catch'](handleError(_0x3cdf32,null));};exports[_0x514d('0x73')]=function(_0x127d1e,_0x38e47a,_0x3cba10){return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0x127d1e[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x38e47a,null))['then'](function(_0x1fa25f){if(_0x1fa25f){return _0x1fa25f[_0x514d('0x73')](_0x127d1e[_0x514d('0x4a')]['ids']);}})[_0x514d('0x20')](respondWithStatusCode(_0x38e47a,null))[_0x514d('0x2a')](handleError(_0x38e47a,null));};exports['notify']=function(_0x4d96ea,_0x2174f3,_0x59c720){var _0x467a58={'body':_0x4d96ea[_0x514d('0x5d')],'channel':'openchannel'};var _0x2bb7b4=[];var _0x4e1cb0=[];var _0x480c1e={};var _0x4fb9ef=![];return db[_0x514d('0x74')][_0x514d('0x65')]()['then'](function(_0x31845a){if(!_0x31845a){throw new db[(_0x514d('0x75'))][(_0x514d('0x76'))](_0x514d('0x77'));}_0x2bb7b4=_[_0x514d('0x78')](_['keys'](_0x31845a),[_0x514d('0x79'),_0x514d('0x7a')]);_0x4e1cb0=_[_0x514d('0x78')](_[_0x514d('0x5a')](_0x31845a),[_0x514d('0x79'),_0x514d('0x7a'),'CompanyId',_0x514d('0x7b')]);if(_0x4d96ea[_0x514d('0x5d')]['id']){delete _0x4d96ea[_0x514d('0x5d')]['id'];}if(_['isNil'](_0x4d96ea['body'][_0x514d('0x7c')])){throw new db[(_0x514d('0x75'))][(_0x514d('0x76'))](_0x514d('0x7d'));}if(_[_0x514d('0x7e')](_0x4d96ea['body']['body'])||_0x4d96ea[_0x514d('0x5d')][_0x514d('0x5d')]===''){throw new db[(_0x514d('0x75'))][(_0x514d('0x76'))](_0x514d('0x7f'));}if(_[_0x514d('0x7e')](_0x4d96ea[_0x514d('0x5d')][_0x514d('0x80')])){throw new db[(_0x514d('0x75'))][(_0x514d('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1cb0);}if(!_['includes'](_0x4e1cb0,_0x4d96ea['body'][_0x514d('0x80')])){throw new db[(_0x514d('0x75'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1cb0);}_0x480c1e[_0x4d96ea[_0x514d('0x5d')][_0x514d('0x80')]]=_0x4d96ea['body'][_0x514d('0x7c')];})['then'](function(){return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0x4d96ea[_0x514d('0x64')]['id']},'include':[{'model':db[_0x514d('0x81')],'as':_0x514d('0x82'),'include':[{'model':db[_0x514d('0x74')],'as':_0x514d('0x83'),'where':_0x480c1e,'limit':0x1,'order':[[_0x514d('0x7a'),'DESC']]}]},{'model':db[_0x514d('0x84')],'as':_0x514d('0x85')}]});})[_0x514d('0x20')](handleEntityNotFound(_0x2174f3,null))[_0x514d('0x20')](function(_0x253189){if(_0x253189&&_0x253189['List']){_0x467a58[_0x514d('0x44')]=_0x253189;_0x467a58[_0x514d('0x86')]=_0x253189[_0x514d('0x85')];_0x467a58['list']=_0x253189[_0x514d('0x82')];_0x467a58['applications']=_[_0x514d('0x87')](_0x467a58[_0x514d('0x86')],[_0x514d('0x88')],[_0x514d('0x89')]);if(_0x467a58[_0x514d('0x44')][_0x514d('0x85')]){delete _0x467a58[_0x514d('0x44')][_0x514d('0x85')];}if(_0x467a58['account']['List']&&_0x467a58[_0x514d('0x44')]['List']['Contacts']['length']){return _0x467a58[_0x514d('0x44')][_0x514d('0x82')][_0x514d('0x83')][0x0];}var _0x55b543=_['defaults'](_0x4d96ea[_0x514d('0x5d')],{'firstName':_0x4d96ea[_0x514d('0x5d')][_0x514d('0x7c')],'ListId':_0x253189[_0x514d('0x7b')]});_0x55b543[_0x4d96ea[_0x514d('0x5d')][_0x514d('0x80')]]=_0x4d96ea[_0x514d('0x5d')][_0x514d('0x7c')];return db[_0x514d('0x74')][_0x514d('0x5c')](_0x55b543,{'fields':_0x2bb7b4,'raw':!![]});}})[_0x514d('0x20')](handleEntityNotFound(_0x2174f3,null))[_0x514d('0x20')](function(_0x19d934){_0x467a58[_0x514d('0x41')]=_0x19d934;if(_0x19d934){var _0x45dc60={'ContactId':_0x19d934['id'],'OpenchannelAccountId':_0x4d96ea[_0x514d('0x64')]['id'],'from':(_0x19d934[_0x514d('0x8a')]||'')+'\x20'+(_0x19d934[_0x514d('0x8b')]||'')};var _0x17377a={'OpenchannelAccountId':_0x4d96ea[_0x514d('0x64')]['id'],'closed':![]};if(_0x4d96ea[_0x514d('0x5d')][_0x514d('0x8c')]){_0x17377a[_0x514d('0x8c')]=_0x4d96ea['body'][_0x514d('0x8c')];return db[_0x514d('0x8d')][_0x514d('0x63')]({'where':_0x17377a})[_0x514d('0x20')](function(_0x5b8b90){if(_0x5b8b90){return[_0x5b8b90,![]];}_0x45dc60['threadId']=_0x4d96ea[_0x514d('0x5d')]['threadId'];_0x45dc60[_0x514d('0x8e')]=_0x4d96ea[_0x514d('0x5d')][_0x514d('0x8e')];return db['OpenchannelInteraction'][_0x514d('0x5c')](_0x45dc60)[_0x514d('0x20')](function(_0x35676b){return[_0x35676b,!![]];});});}else{_0x17377a[_0x514d('0x8c')]=null;}_0x17377a[_0x514d('0x8f')]=_0x19d934['id'];return db[_0x514d('0x8d')][_0x514d('0x63')]({'where':_0x17377a})[_0x514d('0x20')](function(_0x34647f){if(_0x34647f){return[_0x34647f,![]];}return db['OpenchannelInteraction'][_0x514d('0x5c')](_0x45dc60)[_0x514d('0x20')](function(_0x282d36){return[_0x282d36,!![]];});});}})[_0x514d('0x90')](function(_0x319794,_0x57155d){if(_0x319794){_0x4fb9ef=_0x57155d;if(!_0x57155d){var _0x3b8acd={'from':(_0x467a58[_0x514d('0x41')][_0x514d('0x8a')]||'')+'\x20'+(_0x467a58[_0x514d('0x41')][_0x514d('0x8b')]||'')};if(_0x4d96ea['body']['threadId']&&_0x4d96ea['body'][_0x514d('0x91')]&&_0x4d96ea[_0x514d('0x5d')][_0x514d('0x8c')]!=_0x4d96ea[_0x514d('0x5d')][_0x514d('0x91')]){_0x3b8acd[_0x514d('0x8c')]=_0x4d96ea[_0x514d('0x5d')][_0x514d('0x91')];}return _0x319794[_0x514d('0x37')](_0x3b8acd);}else{return _0x319794;}}})[_0x514d('0x20')](function(_0xcf1344){_0x467a58[_0x514d('0x43')]=_0xcf1344[_0x514d('0x38')]({'plain':!![]});_0x467a58[_0x514d('0x43')][_0x514d('0x92')]=_0x4fb9ef;if(_0x467a58['interaction']['created']){if(_0x467a58[_0x514d('0x44')][_0x514d('0x93')]){_0x467a58[_0x514d('0x86')][_0x514d('0x94')]({'id':0x0,'priority':_0x467a58['applications'][_0x514d('0x5b')]+0x1,'app':_0x514d('0x95'),'appdata':_0x514d('0x96'),'interval':'*,*,*,*'});}}return db[_0x514d('0x97')][_0x514d('0x5c')]({'body':_0x4d96ea['body'][_0x514d('0x5d')],'OpenchannelAccountId':_0x4d96ea['params']['id'],'OpenchannelInteractionId':_0xcf1344['id'],'direction':'in','ContactId':_0x467a58['contact']['id'],'AttachmentId':_0x4d96ea[_0x514d('0x5d')][_0x514d('0x98')]});})[_0x514d('0x20')](function(_0x167e86){_0x467a58[_0x514d('0x28')]=_0x167e86;if(_0x467a58['interaction']['UserId']){return db['User'][_0x514d('0x63')]({'attributes':['id','name'],'where':{'id':_0x467a58[_0x514d('0x43')][_0x514d('0x99')]}})[_0x514d('0x20')](function(_0x27673f){if(_0x27673f){_0x467a58[_0x514d('0x86')][_0x514d('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x27673f[_0x514d('0x3d')]+','+(_0x467a58[_0x514d('0x44')][_0x514d('0x9b')]||0xa),'interval':_0x514d('0x9c')});_0x467a58['forcedOwnership']=![];}return respondWithRpcPromise(_0x514d('0x9d'),_0x514d('0x9e'),_0x467a58);});}return respondWithRpcPromise(_0x514d('0x9d'),_0x514d('0x9e'),_0x467a58);})[_0x514d('0x20')](function(_0xafcbca){respondWithRpcPromise(_0x514d('0x9f'),_0x514d('0x9f'),{'event':_0x514d('0xa0'),'message':_0xafcbca},client9002);return _0xafcbca;})[_0x514d('0x20')](respondWithResult(_0x2174f3,null))['catch'](handleError(_0x2174f3,null));};exports[_0x514d('0xa1')]=function(_0x2eee64,_0x3e55ee,_0x9bb8be){return db[_0x514d('0x46')][_0x514d('0x68')]({'where':{'id':_0x2eee64[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x3e55ee,null))[_0x514d('0x20')](function(_0x5b454f){if(_0x5b454f){return db['sequelize'][_0x514d('0xa2')](function(_0x4be831){return db['OpenchannelApplication'][_0x514d('0x3b')]({'where':{'OpenchannelAccountId':_0x2eee64[_0x514d('0x64')]['id']},'transaction':_0x4be831})[_0x514d('0x20')](function(_0x300573){var _0x54b924=_[_0x514d('0x45')](_0x2eee64[_0x514d('0x5d')],function(_0x32fd25){_0x32fd25[_0x514d('0x6c')]=_0x2eee64[_0x514d('0x64')]['id'];return _0x32fd25;});return db[_0x514d('0x84')][_0x514d('0xa3')](_0x54b924,{'transaction':_0x4be831});});})[_0x514d('0x20')](function(){return db[_0x514d('0x84')][_0x514d('0xa4')]({'where':{'OpenchannelAccountId':_0x2eee64[_0x514d('0x64')]['id']},'order':_0x514d('0x88')});});}})['then'](respondWithResult(_0x3e55ee,null))[_0x514d('0x2a')](handleError(_0x3e55ee,null));};exports[_0x514d('0xa5')]=function(_0x242756,_0x1037aa,_0x29affb){var _0x5f4e79={};var _0x87bfe6={};var _0x950383;var _0x5e6f55;return db[_0x514d('0x46')]['findOne']({'where':{'id':_0x242756[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x1037aa,null))[_0x514d('0x20')](function(_0x5a84f8){if(_0x5a84f8){_0x950383=_0x5a84f8;_0x87bfe6[_0x514d('0x47')]=_[_0x514d('0x5a')](db[_0x514d('0x84')]['rawAttributes']);_0x87bfe6[_0x514d('0x4a')]=_[_0x514d('0x5a')](_0x242756[_0x514d('0x4a')]);_0x87bfe6[_0x514d('0x48')]=_[_0x514d('0x49')](_0x87bfe6['model'],_0x87bfe6['query']);_0x5f4e79['attributes']=_[_0x514d('0x49')](_0x87bfe6[_0x514d('0x47')],qs[_0x514d('0x4c')](_0x242756[_0x514d('0x4a')]['fields']));_0x5f4e79[_0x514d('0x4b')]=_0x5f4e79[_0x514d('0x4b')]['length']?_0x5f4e79[_0x514d('0x4b')]:_0x87bfe6['model'];_0x5f4e79[_0x514d('0x6b')]=qs['sort'](_0x242756['query']['sort']);_0x5f4e79[_0x514d('0x50')]=qs['filters'](_['pick'](_0x242756[_0x514d('0x4a')],_0x87bfe6['filters']));if(_0x242756[_0x514d('0x4a')][_0x514d('0x4f')]){_0x5f4e79[_0x514d('0x50')]=_[_0x514d('0x40')](_0x5f4e79[_0x514d('0x50')],{'$or':_[_0x514d('0x45')](_0x5f4e79[_0x514d('0x4b')],function(_0x2f2fe0){var _0x3b8197={};_0x3b8197[_0x2f2fe0]={'$like':'%'+_0x242756[_0x514d('0x4a')][_0x514d('0x4f')]+'%'};return _0x3b8197;})});}_0x5f4e79=_['merge']({},_0x5f4e79,_0x242756[_0x514d('0x53')]);return _0x950383['getApplications'](_0x5f4e79);}})[_0x514d('0x20')](function(_0x5c880b){if(_0x5c880b){_0x5e6f55=_0x5c880b[_0x514d('0x5b')];if(!_0x242756[_0x514d('0x4a')][_0x514d('0x4d')](_0x514d('0x6a'))){_0x5f4e79[_0x514d('0x2f')]=qs['limit'](_0x242756[_0x514d('0x4a')][_0x514d('0x2f')]);_0x5f4e79[_0x514d('0x32')]=qs['offset'](_0x242756[_0x514d('0x4a')]['offset']);}return _0x950383[_0x514d('0xa5')](_0x5f4e79);}})[_0x514d('0x20')](function(_0x160e98){if(_0x160e98){return _0x160e98?{'count':_0x5e6f55,'rows':_0x160e98}:null;}})[_0x514d('0x20')](respondWithResult(_0x1037aa,null))[_0x514d('0x2a')](handleError(_0x1037aa,null));};exports[_0x514d('0xa6')]=function(_0x314ff6,_0x16196d,_0x5b436c){var _0x55a22b={'raw':![],'where':{}};var _0x51f74e={};var _0x551ab5={'count':0x0,'rows':[]};return db[_0x514d('0x46')]['findOne']({'where':{'id':_0x314ff6[_0x514d('0x64')]['id']}})['then'](handleEntityNotFound(_0x16196d,null))[_0x514d('0x20')](function(_0x4bfbe6){if(_0x4bfbe6){_0x51f74e[_0x514d('0x47')]=_[_0x514d('0x5a')](db[_0x514d('0x8d')]['rawAttributes']);_0x51f74e[_0x514d('0x4a')]=_[_0x514d('0x5a')](_0x314ff6[_0x514d('0x4a')]);_0x51f74e[_0x514d('0x48')]=_[_0x514d('0x49')](_0x51f74e[_0x514d('0x47')],_0x51f74e[_0x514d('0x4a')]);_0x55a22b[_0x514d('0x4b')]=_[_0x514d('0x49')](_0x51f74e['model'],qs[_0x514d('0x4c')](_0x314ff6[_0x514d('0x4a')][_0x514d('0x4c')]));_0x55a22b[_0x514d('0x4b')]=_0x55a22b[_0x514d('0x4b')][_0x514d('0x5b')]?_0x55a22b[_0x514d('0x4b')]:_0x51f74e[_0x514d('0x47')];if(!_0x314ff6[_0x514d('0x4a')][_0x514d('0x4d')](_0x514d('0x6a'))){_0x55a22b[_0x514d('0x2f')]=qs[_0x514d('0x2f')](_0x314ff6['query']['limit']);_0x55a22b['offset']=qs[_0x514d('0x32')](_0x314ff6[_0x514d('0x4a')]['offset']);}_0x55a22b[_0x514d('0x6b')]=qs[_0x514d('0x4e')](_0x314ff6[_0x514d('0x4a')]['sort']);_0x55a22b[_0x514d('0x50')]=qs[_0x514d('0x48')](_[_0x514d('0x71')](_0x314ff6['query'],_0x51f74e[_0x514d('0x48')]));_0x55a22b[_0x514d('0x50')][_0x514d('0x6c')]=_0x4bfbe6['id'];if(_0x314ff6[_0x514d('0x4a')][_0x514d('0x4f')]){_0x55a22b[_0x514d('0x50')]=_['merge'](_0x55a22b[_0x514d('0x50')],{'$or':_[_0x514d('0x45')](_0x55a22b['attributes'],function(_0x3cab6f){var _0x426353={};_0x426353[_0x3cab6f]={'$like':'%'+_0x314ff6[_0x514d('0x4a')]['filter']+'%'};return _0x426353;})});}_0x55a22b=_[_0x514d('0x40')]({},_0x55a22b,_0x314ff6[_0x514d('0x53')]);return db[_0x514d('0x8d')][_0x514d('0x31')]({'where':_0x55a22b['where']})['then'](function(_0x554c51){_0x551ab5[_0x514d('0x31')]=_0x554c51;if(_0x314ff6[_0x514d('0x4a')]['includeAll']){_0x55a22b[_0x514d('0x55')]=[{'model':db[_0x514d('0x74')],'as':_0x514d('0xa7'),'required':![]},{'model':db['User'],'as':_0x514d('0xa8'),'attributes':[_0x514d('0x3d'),_0x514d('0xa9'),_0x514d('0xaa')],'required':![]},{'model':db['Tag'],'as':_0x514d('0xab'),'attributes':['id',_0x514d('0x3d'),'color'],'where':_0x314ff6[_0x514d('0x4a')][_0x514d('0xac')]?{'id':_0x314ff6[_0x514d('0x4a')][_0x514d('0xac')]}:undefined,'required':_0x314ff6['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x514d('0x56')](_0x55a22b);})[_0x514d('0x20')](function(_0x5e6747){_0x551ab5['rows']=_0x5e6747;return _0x551ab5;});}})[_0x514d('0x20')](respondWithFilteredResult(_0x16196d,_0x55a22b))[_0x514d('0x2a')](handleError(_0x16196d,null));};exports['addAgents']=function(_0x4ae98e,_0x4d326b,_0x3e9d6e){return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0x4ae98e[_0x514d('0x64')]['id']}})['then'](handleEntityNotFound(_0x4d326b,null))[_0x514d('0x20')](function(_0x621701){if(_0x621701){return _0x621701[_0x514d('0xad')](_0x4ae98e['body'][_0x514d('0x6e')],_[_0x514d('0xae')](_0x4ae98e[_0x514d('0x5d')],[_0x514d('0x6e'),'id'])||{})[_0x514d('0x90')](function(_0x13ef02){for(var _0x2fec76=0x0;_0x2fec76<_0x4ae98e[_0x514d('0x5d')][_0x514d('0x6e')][_0x514d('0x5b')];_0x2fec76+=0x1){socket[_0x514d('0xaf')](_0x514d('0xb0'),{'UserId':_0x4ae98e['body'][_0x514d('0x6e')][_0x2fec76],'OpenchannelAccountId':_0x4ae98e[_0x514d('0x64')]['id']});}return _0x13ef02;});}})[_0x514d('0x20')](respondWithResult(_0x4d326b,null))[_0x514d('0x2a')](handleError(_0x4d326b,null));};exports['removeAgents']=function(_0x4981c0,_0x493fd8,_0x449b34){return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0x4981c0[_0x514d('0x64')]['id']}})['then'](handleEntityNotFound(_0x493fd8,null))[_0x514d('0x20')](function(_0x2e6cfe){if(_0x2e6cfe){return _0x2e6cfe[_0x514d('0xb1')](_0x4981c0[_0x514d('0x4a')][_0x514d('0x6e')])[_0x514d('0x20')](function(){if(_[_0x514d('0xb2')](_0x4981c0[_0x514d('0x4a')]['ids'])){for(var _0x54af7a=0x0;_0x54af7a<_0x4981c0[_0x514d('0x4a')]['ids'][_0x514d('0x5b')];_0x54af7a+=0x1){socket[_0x514d('0xaf')](_0x514d('0xb3'),{'UserId':Number(_0x4981c0[_0x514d('0x4a')]['ids'][_0x54af7a]),'OpenchannelAccountId':Number(_0x4981c0[_0x514d('0x64')]['id'])});}}else{socket[_0x514d('0xaf')](_0x514d('0xb3'),{'UserId':Number(_0x4981c0['query']['ids']),'OpenchannelAccountId':Number(_0x4981c0['params']['id'])});}});}})['then'](respondWithStatusCode(_0x493fd8,null))['catch'](handleError(_0x493fd8,null));};exports['getAgents']=function(_0x48eafc,_0x35c606,_0x3390c9){var _0x11d167={};var _0x210aeb={};var _0x4474d8;var _0x1fdf3a;return db[_0x514d('0x46')][_0x514d('0x68')]({'where':{'id':_0x48eafc[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x35c606,null))[_0x514d('0x20')](function(_0x420970){if(_0x420970){_0x4474d8=_0x420970;_0x210aeb[_0x514d('0x47')]=_[_0x514d('0x5a')](db[_0x514d('0xb4')]['rawAttributes']);_0x210aeb['query']=_[_0x514d('0x5a')](_0x48eafc['query']);_0x210aeb[_0x514d('0x48')]=_['intersection'](_0x210aeb[_0x514d('0x47')],_0x210aeb[_0x514d('0x4a')]);_0x11d167['attributes']=_[_0x514d('0x49')](_0x210aeb[_0x514d('0x47')],qs['fields'](_0x48eafc[_0x514d('0x4a')][_0x514d('0x4c')]));_0x11d167[_0x514d('0x4b')]=_0x11d167[_0x514d('0x4b')][_0x514d('0x5b')]?_0x11d167['attributes']:_0x210aeb[_0x514d('0x47')];_0x11d167['order']=qs[_0x514d('0x4e')](_0x48eafc[_0x514d('0x4a')][_0x514d('0x4e')]);_0x11d167[_0x514d('0x50')]=qs[_0x514d('0x48')](_[_0x514d('0x71')](_0x48eafc['query'],_0x210aeb['filters']));if(_0x48eafc[_0x514d('0x4a')][_0x514d('0x4f')]){_0x11d167[_0x514d('0x50')]=_[_0x514d('0x40')](_0x11d167[_0x514d('0x50')],{'$or':_[_0x514d('0x45')](_0x11d167[_0x514d('0x4b')],function(_0x100081){var _0x1d6750={};_0x1d6750[_0x100081]={'$like':'%'+_0x48eafc['query'][_0x514d('0x4f')]+'%'};return _0x1d6750;})});}_0x11d167=_['merge']({},_0x11d167,_0x48eafc[_0x514d('0x53')]);return _0x4474d8[_0x514d('0xb5')](_0x11d167);}})[_0x514d('0x20')](function(_0x38a0d9){if(_0x38a0d9){_0x1fdf3a=_0x38a0d9[_0x514d('0x5b')];if(!_0x48eafc[_0x514d('0x4a')][_0x514d('0x4d')](_0x514d('0x6a'))){_0x11d167['limit']=qs[_0x514d('0x2f')](_0x48eafc['query'][_0x514d('0x2f')]);_0x11d167['offset']=qs[_0x514d('0x32')](_0x48eafc['query'][_0x514d('0x32')]);}return _0x4474d8[_0x514d('0xb5')](_0x11d167);}})['then'](function(_0x2eb28a){if(_0x2eb28a){return _0x2eb28a?{'count':_0x1fdf3a,'rows':_0x2eb28a}:null;}})[_0x514d('0x20')](respondWithResult(_0x35c606,null))[_0x514d('0x2a')](handleError(_0x35c606,null));};exports[_0x514d('0x3e')]=function(_0x299697,_0x1b270a,_0x3aa399){var _0x3d8470,_0x15da62,_0x2e477a;if(_[_0x514d('0x7e')](_0x299697['body'][_0x514d('0x5d')])||_0x299697[_0x514d('0x5d')][_0x514d('0x5d')]===''){throw new db['Sequelize'][(_0x514d('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x514d('0x7e')](_0x299697[_0x514d('0x5d')]['to'])){}_0x3d8470=_0x299697[_0x514d('0x5d')]['to'];return db[_0x514d('0x46')][_0x514d('0x68')]({'where':{'id':_0x299697[_0x514d('0x64')]['id']}})[_0x514d('0x20')](handleEntityNotFound(_0x1b270a,null))['then'](function(_0x45b558){if(_0x45b558){return db[_0x514d('0x46')][_0x514d('0x63')]({'where':{'id':_0x45b558['id']},'include':[{'model':db['CmList'],'as':_0x514d('0x82'),'include':[{'model':db[_0x514d('0x74')],'as':_0x514d('0x83'),'where':{[_0x45b558[_0x514d('0x80')]]:_0x3d8470},'limit':0x1,'order':[[_0x514d('0x7a'),_0x514d('0xb6')]]}]}]})[_0x514d('0x20')](handleEntityNotFound(_0x1b270a,null))[_0x514d('0x20')](function(_0x2a3386){if(_0x2a3386&&_0x2a3386[_0x514d('0x82')]){_0x15da62=_0x2a3386[_0x514d('0x38')]({'plain':!![]});if(_0x15da62[_0x514d('0x82')]&&_0x15da62[_0x514d('0x82')][_0x514d('0x83')]['length']){return _0x15da62[_0x514d('0x82')][_0x514d('0x83')][0x0];}return db['CmContact'][_0x514d('0x5c')](_['defaults'](_0x299697[_0x514d('0x5d')],{'firstName':_0x3d8470,[_0x2a3386['mapKey']]:_0x3d8470,'phone':_0x3d8470,'ListId':_0x15da62[_0x514d('0x7b')]}));}})[_0x514d('0x20')](handleEntityNotFound(_0x1b270a,null))['then'](function(_0x218a89){if(_0x218a89){_0x2e477a=_0x218a89;return db['OpenchannelInteraction'][_0x514d('0x63')]({'where':{'ContactId':_0x2e477a['id'],'closed':![],'OpenchannelAccountId':_0x15da62['id']}})['then'](function(_0x6a55f3){if(_0x6a55f3){return[_0x6a55f3,![]];}return db['OpenchannelInteraction'][_0x514d('0x5c')]({'UserId':_0x299697['user']['id'],'ContactId':_0x2e477a['id'],'OpenchannelAccountId':_0x15da62['id'],'lastMsgDirection':_0x514d('0xb7'),'Messages':[_['merge'](_0x299697[_0x514d('0x5d')],{'read':![],'body':_0x299697[_0x514d('0x5d')][_0x514d('0x5d')],'OpenchannelAccountId':_0x15da62['id'],'UserId':_0x299697[_0x514d('0x5e')]['id'],'ContactId':_0x2e477a['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x514d('0xb8')}]})[_0x514d('0x20')](function(_0x21558e){return[_0x21558e,!![]];});});}})[_0x514d('0x90')](function(_0x4b1a94,_0x686263){if(_0x686263){return _0x4b1a94;}return db['OpenchannelMessage'][_0x514d('0x5c')](_[_0x514d('0x40')](_0x299697[_0x514d('0x5d')],{'read':![],'body':_0x299697[_0x514d('0x5d')]['body'],'OpenchannelAccountId':_0x15da62['id'],'OpenchannelInteractionId':_0x4b1a94['id'],'UserId':_0x299697['user']['id'],'ContactId':_0x2e477a['id']}))[_0x514d('0x20')](function(_0x41ba08){_0x4b1a94['dataValues']['Messages']=[];_0x4b1a94[_0x514d('0xb9')]['Messages'][_0x514d('0x94')](_0x41ba08[_0x514d('0xb9')]);return _0x4b1a94;});});}})[_0x514d('0x20')](respondWithResult(_0x1b270a,null))[_0x514d('0x2a')](handleError(_0x1b270a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1e88862..2fc21ae 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x099f=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x1cf46d,_0x1214cf){var _0x2e10a9=function(_0x50ed18){while(--_0x50ed18){_0x1cf46d['push'](_0x1cf46d['shift']());}};_0x2e10a9(++_0x1214cf);}(_0x099f,0xc3));var _0xf099=function(_0x2c4e88,_0x21cfa0){_0x2c4e88=_0x2c4e88-0x0;var _0x493608=_0x099f[_0x2c4e88];return _0x493608;};'use strict';var EventEmitter=require(_0xf099('0x0'));var OpenchannelAccount=require(_0xf099('0x1'))['db'][_0xf099('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf099('0x3')](0x0);var events={'afterCreate':_0xf099('0x4'),'afterUpdate':_0xf099('0x5'),'afterDestroy':_0xf099('0x6')};function emitEvent(_0x129592){return function(_0x427f9d,_0x28a7c3,_0x4225f6){OpenchannelAccountEvents[_0xf099('0x7')](_0x129592+':'+_0x427f9d['id'],_0x427f9d);OpenchannelAccountEvents[_0xf099('0x7')](_0x129592,_0x427f9d);_0x4225f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xf099('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xc4e0=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x467213,_0x2aaf37){var _0x31042d=function(_0x61ec7b){while(--_0x61ec7b){_0x467213['push'](_0x467213['shift']());}};_0x31042d(++_0x2aaf37);}(_0xc4e0,0x18f));var _0x0c4e=function(_0x57135f,_0x354ab0){_0x57135f=_0x57135f-0x0;var _0x9e60b0=_0xc4e0[_0x57135f];return _0x9e60b0;};'use strict';var EventEmitter=require(_0x0c4e('0x0'));var OpenchannelAccount=require(_0x0c4e('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0c4e('0x2')](0x0);var events={'afterCreate':_0x0c4e('0x3'),'afterUpdate':_0x0c4e('0x4'),'afterDestroy':_0x0c4e('0x5')};function emitEvent(_0x288856){return function(_0x584ffb,_0x2e4fab,_0x236922){OpenchannelAccountEvents[_0x0c4e('0x6')](_0x288856+':'+_0x584ffb['id'],_0x584ffb);OpenchannelAccountEvents[_0x0c4e('0x6')](_0x288856,_0x584ffb);_0x236922(null);};}for(var e in events){if(events[_0x0c4e('0x7')](e)){var event=events[e];OpenchannelAccount[_0x0c4e('0x8')](e,emitEvent(event));}}module[_0x0c4e('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 1214e3e..41a9541 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffde=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash'];(function(_0x46a328,_0x57f635){var _0x18d2cb=function(_0x3e5684){while(--_0x3e5684){_0x46a328['push'](_0x46a328['shift']());}};_0x18d2cb(++_0x57f635);}(_0xffde,0x1e3));var _0xeffd=function(_0x195a55,_0x4c4d1c){_0x195a55=_0x195a55-0x0;var _0xd517b4=_0xffde[_0x195a55];return _0xd517b4;};'use strict';var _=require(_0xeffd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeffd('0x1'));var moment=require(_0xeffd('0x2'));var BPromise=require(_0xeffd('0x3'));var rp=require(_0xeffd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeffd('0x5'));var config=require(_0xeffd('0x6'));var attributes=require(_0xeffd('0x7'));module[_0xeffd('0x8')]=function(_0x5a8808,_0x12ded){return _0x5a8808[_0xeffd('0x9')](_0xeffd('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64c0=['define','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x64c0,0x8d));var _0x064c=function(_0x31cdff,_0x545438){_0x31cdff=_0x31cdff-0x0;var _0x14091f=_0x64c0[_0x31cdff];return _0x14091f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x064c('0x0'))('api');var moment=require(_0x064c('0x1'));var BPromise=require(_0x064c('0x2'));var rp=require(_0x064c('0x3'));var fs=require('fs');var path=require(_0x064c('0x4'));var rimraf=require(_0x064c('0x5'));var config=require(_0x064c('0x6'));var attributes=require(_0x064c('0x7'));module[_0x064c('0x8')]=function(_0x65ed3e,_0x1da2bd){return _0x65ed3e[_0x064c('0x9')]('OpenchannelAccount',attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 6701a2d..4b075a3 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eea=['redis','defaults','localhost','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http'];(function(_0x2265b0,_0x279abe){var _0xc4900b=function(_0x549d54){while(--_0x549d54){_0x2265b0['push'](_0x2265b0['shift']());}};_0xc4900b(++_0x279abe);}(_0x3eea,0x151));var _0xa3ee=function(_0x286bb2,_0x41481f){_0x286bb2=_0x286bb2-0x0;var _0x4ebd6e=_0x3eea[_0x286bb2];return _0x4ebd6e;};'use strict';var _=require('lodash');var util=require(_0xa3ee('0x0'));var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa3ee('0x5'));var config=require('../../config/environment');var jayson=require(_0xa3ee('0x6'));var client=jayson['client'][_0xa3ee('0x7')]({'port':0x232a});config[_0xa3ee('0x8')]=_[_0xa3ee('0x9')](config[_0xa3ee('0x8')],{'host':_0xa3ee('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3ee('0x8')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x37ad25,_0x5d084b,_0x4e15c1){return new BPromise(function(_0x168df7,_0x1d577e){return client[_0xa3ee('0xb')](_0x37ad25,_0x4e15c1)[_0xa3ee('0xc')](function(_0x611252){logger[_0xa3ee('0xd')](_0xa3ee('0xe'),_0x5d084b,_0xa3ee('0xf'));logger[_0xa3ee('0x10')](_0xa3ee('0x11'),_0x5d084b,_0xa3ee('0xf'),JSON[_0xa3ee('0x12')](_0x611252));if(_0x611252[_0xa3ee('0x13')]){if(_0x611252[_0xa3ee('0x13')][_0xa3ee('0x14')]===0x1f4){logger[_0xa3ee('0x13')](_0xa3ee('0xe'),_0x5d084b,_0x611252[_0xa3ee('0x13')][_0xa3ee('0x15')]);return _0x1d577e(_0x611252[_0xa3ee('0x13')]['message']);}logger[_0xa3ee('0x13')](_0xa3ee('0xe'),_0x5d084b,_0x611252[_0xa3ee('0x13')][_0xa3ee('0x15')]);return _0x168df7(_0x611252[_0xa3ee('0x13')][_0xa3ee('0x15')]);}else{logger['info'](_0xa3ee('0xe'),_0x5d084b,_0xa3ee('0xf'));_0x168df7(_0x611252['result']['message']);}})[_0xa3ee('0x16')](function(_0x3c6046){logger['error'](_0xa3ee('0xe'),_0x5d084b,_0x3c6046);_0x1d577e(_0x3c6046);});});} \ No newline at end of file +var _0x103e=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x268b24,_0x2ea158){var _0x36fe97=function(_0x4bdfe2){while(--_0x4bdfe2){_0x268b24['push'](_0x268b24['shift']());}};_0x36fe97(++_0x2ea158);}(_0x103e,0x6b));var _0xe103=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x103e[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xe103('0x0'));var util=require(_0xe103('0x1'));var moment=require(_0xe103('0x2'));var BPromise=require(_0xe103('0x3'));var rs=require(_0xe103('0x4'));var fs=require('fs');var Redis=require(_0xe103('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe103('0x6'));var logger=require(_0xe103('0x7'))(_0xe103('0x8'));var config=require(_0xe103('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe103('0xa')]['http']({'port':0x232a});config['redis']=_[_0xe103('0xb')](config[_0xe103('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe103('0xc')]));require(_0xe103('0xd'))[_0xe103('0xe')](socket);function respondWithRpcPromise(_0x4c77ca,_0x66c581,_0x182442){return new BPromise(function(_0x342b69,_0x493342){return client['request'](_0x4c77ca,_0x182442)[_0xe103('0xf')](function(_0x4212bc){logger[_0xe103('0x10')](_0xe103('0x11'),_0x66c581,_0xe103('0x12'));logger[_0xe103('0x13')](_0xe103('0x14'),_0x66c581,'request\x20sent',JSON[_0xe103('0x15')](_0x4212bc));if(_0x4212bc[_0xe103('0x16')]){if(_0x4212bc[_0xe103('0x16')][_0xe103('0x17')]===0x1f4){logger[_0xe103('0x16')](_0xe103('0x11'),_0x66c581,_0x4212bc['error']['message']);return _0x493342(_0x4212bc[_0xe103('0x16')][_0xe103('0x18')]);}logger[_0xe103('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x66c581,_0x4212bc[_0xe103('0x16')][_0xe103('0x18')]);return _0x342b69(_0x4212bc[_0xe103('0x16')]['message']);}else{logger[_0xe103('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x66c581,'request\x20sent');_0x342b69(_0x4212bc['result']['message']);}})['catch'](function(_0x4e6bdb){logger[_0xe103('0x16')](_0xe103('0x11'),_0x66c581,_0x4e6bdb);_0x493342(_0x4e6bdb);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 544fbc2..07ae1d4 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b01=['length','openchannelAccount:','save','remove','emit','removeListener','register'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3b01,0x8e));var _0x13b0=function(_0x174cd6,_0x1086c7){_0x174cd6=_0x174cd6-0x0;var _0x48ecf0=_0x3b01[_0x174cd6];return _0x48ecf0;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x13b0('0x0'),_0x13b0('0x1'),'update'];function createListener(_0x686ae0,_0x185939){return function(_0x1b7eec){_0x185939[_0x13b0('0x2')](_0x686ae0,_0x1b7eec);};}function removeListener(_0x256d1f,_0x555e1b){return function(){OpenchannelAccountEvents[_0x13b0('0x3')](_0x256d1f,_0x555e1b);};}exports[_0x13b0('0x4')]=function(_0x500e60){for(var _0x2f1e18=0x0,_0x3fef7f=events[_0x13b0('0x5')];_0x2f1e18<_0x3fef7f;_0x2f1e18++){var _0x1e875c=events[_0x2f1e18];var _0x32b985=createListener(_0x13b0('0x6')+_0x1e875c,_0x500e60);OpenchannelAccountEvents['on'](_0x1e875c,_0x32b985);}}; \ No newline at end of file +var _0x929a=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x5c62db,_0xbb1588){var _0x1a371b=function(_0x3f0a69){while(--_0x3f0a69){_0x5c62db['push'](_0x5c62db['shift']());}};_0x1a371b(++_0xbb1588);}(_0x929a,0x1f4));var _0xa929=function(_0x57cdf5,_0x463e3f){_0x57cdf5=_0x57cdf5-0x0;var _0x4b90ce=_0x929a[_0x57cdf5];return _0x4b90ce;};'use strict';var OpenchannelAccountEvents=require(_0xa929('0x0'));var events=[_0xa929('0x1'),'remove',_0xa929('0x2')];function createListener(_0x2df0c3,_0x4c635f){return function(_0x129608){_0x4c635f[_0xa929('0x3')](_0x2df0c3,_0x129608);};}function removeListener(_0x28e6e6,_0x404b1e){return function(){OpenchannelAccountEvents[_0xa929('0x4')](_0x28e6e6,_0x404b1e);};}exports[_0xa929('0x5')]=function(_0xa19cca){for(var _0x431a08=0x0,_0xe1993=events[_0xa929('0x6')];_0x431a08<_0xe1993;_0x431a08++){var _0x3db6ad=events[_0x431a08];var _0xa506f4=createListener(_0xa929('0x7')+_0x3db6ad,_0xa19cca);OpenchannelAccountEvents['on'](_0x3db6ad,_0xa506f4);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2b5b677..8b10fbe 100644 --- a/server/api/openchannelApplication/index.js +++ b/server/api/openchannelApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4859=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get','/:id','isAuthenticated','show','put','update'];(function(_0x1856dd,_0x10f82b){var _0x444e1c=function(_0x98c24a){while(--_0x98c24a){_0x1856dd['push'](_0x1856dd['shift']());}};_0x444e1c(++_0x10f82b);}(_0x4859,0x167));var _0x9485=function(_0x25200d,_0xa46165){_0x25200d=_0x25200d-0x0;var _0x1aa675=_0x4859[_0x25200d];return _0x1aa675;};'use strict';var multer=require(_0x9485('0x0'));var util=require(_0x9485('0x1'));var path=require(_0x9485('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9485('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9485('0x4'));var interaction=require(_0x9485('0x5'));var config=require(_0x9485('0x6'));var controller=require(_0x9485('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9485('0x8')]);router[_0x9485('0x9')](_0x9485('0xa'),auth[_0x9485('0xb')](),controller[_0x9485('0xc')]);router['post']('/',auth[_0x9485('0xb')](),controller['create']);router[_0x9485('0xd')]('/:id',auth[_0x9485('0xb')](),controller[_0x9485('0xe')]);router['delete']('/:id',auth[_0x9485('0xb')](),controller[_0x9485('0xf')]);module[_0x9485('0x10')]=router; \ No newline at end of file +var _0x7987=['put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x46807c,_0x18e0a9){var _0x4359cf=function(_0x1fb921){while(--_0x1fb921){_0x46807c['push'](_0x46807c['shift']());}};_0x4359cf(++_0x18e0a9);}(_0x7987,0x145));var _0x7798=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0x7987[_0x49cb71];return _0x3a50fd;};'use strict';var multer=require(_0x7798('0x0'));var util=require(_0x7798('0x1'));var path=require(_0x7798('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7798('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7798('0x4'));var interaction=require(_0x7798('0x5'));var config=require(_0x7798('0x6'));var controller=require(_0x7798('0x7'));router[_0x7798('0x8')]('/',auth['isAuthenticated'](),controller[_0x7798('0x9')]);router[_0x7798('0x8')](_0x7798('0xa'),auth[_0x7798('0xb')](),controller[_0x7798('0xc')]);router[_0x7798('0xd')]('/',auth[_0x7798('0xb')](),controller[_0x7798('0xe')]);router[_0x7798('0xf')]('/:id',auth[_0x7798('0xb')](),controller[_0x7798('0x10')]);router[_0x7798('0x11')](_0x7798('0xa'),auth['isAuthenticated'](),controller[_0x7798('0x12')]);module[_0x7798('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index f4477e9..28a9271 100644 --- a/server/api/openchannelApplication/openchannelApplication.attributes.js +++ b/server/api/openchannelApplication/openchannelApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf032=['sequelize','exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x1d636d,_0xb47efb){var _0x4002bb=function(_0x42e3f0){while(--_0x42e3f0){_0x1d636d['push'](_0x1d636d['shift']());}};_0x4002bb(++_0xb47efb);}(_0xf032,0x1b6));var _0x2f03=function(_0x50a7b4,_0x4d7b2e){_0x50a7b4=_0x50a7b4-0x0;var _0x566c2d=_0xf032[_0x50a7b4];return _0x566c2d;};'use strict';var Sequelize=require(_0x2f03('0x0'));module[_0x2f03('0x1')]={'priority':{'type':Sequelize[_0x2f03('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2f03('0x3')]()},'description':{'type':Sequelize[_0x2f03('0x4')]},'interval':{'type':Sequelize[_0x2f03('0x4')],'defaultValue':_0x2f03('0x5')}}; \ No newline at end of file +var _0x0b79=['INTEGER','noop','STRING','*,*,*,*','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0b79,0xea));var _0x90b7=function(_0x49cf00,_0x300bde){_0x49cf00=_0x49cf00-0x0;var _0x2d4ad4=_0x0b79[_0x49cf00];return _0x2d4ad4;};'use strict';var Sequelize=require('sequelize');module[_0x90b7('0x0')]={'priority':{'type':Sequelize[_0x90b7('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x90b7('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x90b7('0x3')]},'interval':{'type':Sequelize[_0x90b7('0x3')],'defaultValue':_0x90b7('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e402bbb..a26a964 100644 --- a/server/api/openchannelApplication/openchannelApplication.controller.js +++ b/server/api/openchannelApplication/openchannelApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe528=['length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','include','findAll','rows','catch','params','intersection','includeAll','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','send','render','merge','body','message','interaction','index','map','OpenchannelApplication','type','key','model','name','query','keys','filters','fields','attributes'];(function(_0x586cb6,_0x2ac45e){var _0xddd6b0=function(_0x1882e1){while(--_0x1882e1){_0x586cb6['push'](_0x586cb6['shift']());}};_0xddd6b0(++_0x2ac45e);}(_0xe528,0xae));var _0x8e52=function(_0x417182,_0x353daf){_0x417182=_0x417182-0x0;var _0x2045f9=_0xe528[_0x417182];return _0x2045f9;};'use strict';var emlformat=require(_0x8e52('0x0'));var rimraf=require(_0x8e52('0x1'));var zipdir=require(_0x8e52('0x2'));var jsonpatch=require(_0x8e52('0x3'));var rp=require(_0x8e52('0x4'));var moment=require(_0x8e52('0x5'));var BPromise=require(_0x8e52('0x6'));var Mustache=require(_0x8e52('0x7'));var util=require(_0x8e52('0x8'));var path=require(_0x8e52('0x9'));var sox=require(_0x8e52('0xa'));var csv=require(_0x8e52('0xb'));var ejs=require(_0x8e52('0xc'));var fs=require('fs');var fs_extra=require(_0x8e52('0xd'));var _=require(_0x8e52('0xe'));var squel=require(_0x8e52('0xf'));var crypto=require(_0x8e52('0x10'));var jsforce=require(_0x8e52('0x11'));var deskjs=require(_0x8e52('0x12'));var toCsv=require(_0x8e52('0xb'));var querystring=require('querystring');var Papa=require(_0x8e52('0x13'));var Redis=require(_0x8e52('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x8e52('0x15'));var as=require(_0x8e52('0x16'));var hardwareService=require(_0x8e52('0x17'));var logger=require('../../config/logger')(_0x8e52('0x18'));var utils=require(_0x8e52('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8e52('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ccace,_0x33f91c){_0x33f91c=_0x33f91c||0xcc;return function(_0x28b350){if(_0x28b350){return _0x5ccace[_0x8e52('0x1b')](_0x33f91c);}return _0x5ccace[_0x8e52('0x1c')](_0x33f91c)[_0x8e52('0x1d')]();};}function respondWithResult(_0x3cb5ea,_0x3a0134){_0x3a0134=_0x3a0134||0xc8;return function(_0x52ccb3){if(_0x52ccb3){return _0x3cb5ea[_0x8e52('0x1c')](_0x3a0134)[_0x8e52('0x1e')](_0x52ccb3);}};}function respondWithFilteredResult(_0x3201f7,_0x135b55){return function(_0xfdf52a){if(_0xfdf52a){var _0x366dee=typeof _0x135b55['offset']===_0x8e52('0x1f')&&typeof _0x135b55['limit']==='undefined';var _0x44e2d9=_0xfdf52a[_0x8e52('0x20')];var _0x44364e=_0x366dee?0x0:_0x135b55[_0x8e52('0x21')];var _0x3c82ba=_0x366dee?_0xfdf52a[_0x8e52('0x20')]:_0x135b55[_0x8e52('0x21')]+_0x135b55[_0x8e52('0x22')];var _0x18ebc6;if(_0x3c82ba>=_0x44e2d9){_0x3c82ba=_0x44e2d9;_0x18ebc6=0xc8;}else{_0x18ebc6=0xce;}_0x3201f7[_0x8e52('0x1c')](_0x18ebc6);return _0x3201f7['set'](_0x8e52('0x23'),_0x44364e+'-'+_0x3c82ba+'/'+_0x44e2d9)[_0x8e52('0x1e')](_0xfdf52a);}return null;};}function patchUpdates(_0x18e178){return function(_0x4edcf3){try{jsonpatch[_0x8e52('0x24')](_0x4edcf3,_0x18e178,!![]);}catch(_0xfae0ee){return BPromise[_0x8e52('0x25')](_0xfae0ee);}return _0x4edcf3[_0x8e52('0x26')]();};}function saveUpdates(_0x3b3e79,_0x3e7a1c){return function(_0x58fdae){if(_0x58fdae){return _0x58fdae['update'](_0x3b3e79)[_0x8e52('0x27')](function(_0x598bd0){return _0x598bd0;});}return null;};}function removeEntity(_0xab798b,_0x4a0b5a){return function(_0xd8a3c0){if(_0xd8a3c0){return _0xd8a3c0[_0x8e52('0x28')]()['then'](function(){_0xab798b['status'](0xcc)[_0x8e52('0x1d')]();});}};}function handleEntityNotFound(_0x4a1781,_0x1721dc){return function(_0x25256d){if(!_0x25256d){_0x4a1781['sendStatus'](0x194);}return _0x25256d;};}function handleError(_0x2eef04,_0x596dba){_0x596dba=_0x596dba||0x1f4;return function(_0x321f06){logger[_0x8e52('0x29')](_0x321f06['stack']);if(_0x321f06['name']){delete _0x321f06['name'];}_0x2eef04[_0x8e52('0x1c')](_0x596dba)[_0x8e52('0x2a')](_0x321f06);};}function getMustacheRender(_0x4e3488,_0x3ff77c){return Mustache[_0x8e52('0x2b')](_0x4e3488,_[_0x8e52('0x2c')](_0x3ff77c[_0x8e52('0x2d')],{'contact':_0x3ff77c['contact'],'message':_0x3ff77c[_0x8e52('0x2e')],'agent':_0x3ff77c['agent'],'interaction':_0x3ff77c[_0x8e52('0x2f')],'account':_0x3ff77c['account']}))||'';}exports[_0x8e52('0x30')]=function(_0x39b841,_0x1a8f60){var _0x14bdb0={},_0x51c152={},_0x23c9cd={'count':0x0,'rows':[]};var _0xfb7be9=_[_0x8e52('0x31')](db[_0x8e52('0x32')]['rawAttributes'],function(_0x564664){return{'name':_0x564664['fieldName'],'type':_0x564664[_0x8e52('0x33')][_0x8e52('0x34')]};});_0x51c152[_0x8e52('0x35')]=_['map'](_0xfb7be9,_0x8e52('0x36'));_0x51c152[_0x8e52('0x37')]=_[_0x8e52('0x38')](_0x39b841[_0x8e52('0x37')]);_0x51c152[_0x8e52('0x39')]=_['intersection'](_0x51c152[_0x8e52('0x35')],_0x51c152[_0x8e52('0x37')]);_0x14bdb0['attributes']=_['intersection'](_0x51c152[_0x8e52('0x35')],qs[_0x8e52('0x3a')](_0x39b841[_0x8e52('0x37')][_0x8e52('0x3a')]));_0x14bdb0[_0x8e52('0x3b')]=_0x14bdb0[_0x8e52('0x3b')][_0x8e52('0x3c')]?_0x14bdb0['attributes']:_0x51c152[_0x8e52('0x35')];if(!_0x39b841[_0x8e52('0x37')]['hasOwnProperty'](_0x8e52('0x3d'))){_0x14bdb0[_0x8e52('0x22')]=qs[_0x8e52('0x22')](_0x39b841[_0x8e52('0x37')][_0x8e52('0x22')]);_0x14bdb0['offset']=qs[_0x8e52('0x21')](_0x39b841['query'][_0x8e52('0x21')]);}_0x14bdb0[_0x8e52('0x3e')]=qs['sort'](_0x39b841[_0x8e52('0x37')][_0x8e52('0x3f')]);_0x14bdb0[_0x8e52('0x40')]=qs[_0x8e52('0x39')](_[_0x8e52('0x41')](_0x39b841[_0x8e52('0x37')],_0x51c152['filters']),_0xfb7be9);if(_0x39b841['query']['filter']){_0x14bdb0[_0x8e52('0x40')]=_[_0x8e52('0x2c')](_0x14bdb0[_0x8e52('0x40')],{'$or':_[_0x8e52('0x31')](_0xfb7be9,function(_0x55f9e1){if(_0x55f9e1[_0x8e52('0x33')]!==_0x8e52('0x42')){var _0x2cc606={};_0x2cc606[_0x55f9e1[_0x8e52('0x36')]]={'$like':'%'+_0x39b841['query'][_0x8e52('0x43')]+'%'};return _0x2cc606;}})});}_0x14bdb0=_[_0x8e52('0x2c')]({},_0x14bdb0,_0x39b841[_0x8e52('0x44')]);var _0x3576be={'where':_0x14bdb0[_0x8e52('0x40')]};return db[_0x8e52('0x32')][_0x8e52('0x20')](_0x3576be)[_0x8e52('0x27')](function(_0x1e7855){_0x23c9cd[_0x8e52('0x20')]=_0x1e7855;if(_0x39b841[_0x8e52('0x37')]['includeAll']){_0x14bdb0[_0x8e52('0x45')]=[{'all':!![]}];}return db[_0x8e52('0x32')][_0x8e52('0x46')](_0x14bdb0);})[_0x8e52('0x27')](function(_0x3d276f){_0x23c9cd[_0x8e52('0x47')]=_0x3d276f;return _0x23c9cd;})['then'](respondWithFilteredResult(_0x1a8f60,_0x14bdb0))[_0x8e52('0x48')](handleError(_0x1a8f60,null));};exports['show']=function(_0x3dbb63,_0xe892f1){var _0x4f4631={'raw':!![],'where':{'id':_0x3dbb63[_0x8e52('0x49')]['id']}},_0x4d34cf={};_0x4d34cf[_0x8e52('0x35')]=_['keys'](db[_0x8e52('0x32')]['rawAttributes']);_0x4d34cf[_0x8e52('0x37')]=_[_0x8e52('0x38')](_0x3dbb63[_0x8e52('0x37')]);_0x4d34cf[_0x8e52('0x39')]=_['intersection'](_0x4d34cf[_0x8e52('0x35')],_0x4d34cf[_0x8e52('0x37')]);_0x4f4631[_0x8e52('0x3b')]=_[_0x8e52('0x4a')](_0x4d34cf['model'],qs[_0x8e52('0x3a')](_0x3dbb63[_0x8e52('0x37')]['fields']));_0x4f4631[_0x8e52('0x3b')]=_0x4f4631[_0x8e52('0x3b')]['length']?_0x4f4631['attributes']:_0x4d34cf[_0x8e52('0x35')];if(_0x3dbb63[_0x8e52('0x37')][_0x8e52('0x4b')]){_0x4f4631[_0x8e52('0x45')]=[{'all':!![]}];}_0x4f4631=_[_0x8e52('0x2c')]({},_0x4f4631,_0x3dbb63[_0x8e52('0x44')]);return db[_0x8e52('0x32')][_0x8e52('0x4c')](_0x4f4631)[_0x8e52('0x27')](handleEntityNotFound(_0xe892f1,null))[_0x8e52('0x27')](respondWithResult(_0xe892f1,null))[_0x8e52('0x48')](handleError(_0xe892f1,null));};exports[_0x8e52('0x4d')]=function(_0x391602,_0x2f1530){return db[_0x8e52('0x32')]['create'](_0x391602['body'],{})['then'](respondWithResult(_0x2f1530,0xc9))[_0x8e52('0x48')](handleError(_0x2f1530,null));};exports['update']=function(_0x1f8ba5,_0x5c337d){if(_0x1f8ba5[_0x8e52('0x2d')]['id']){delete _0x1f8ba5['body']['id'];}return db[_0x8e52('0x32')][_0x8e52('0x4c')]({'where':{'id':_0x1f8ba5[_0x8e52('0x49')]['id']}})['then'](handleEntityNotFound(_0x5c337d,null))[_0x8e52('0x27')](saveUpdates(_0x1f8ba5[_0x8e52('0x2d')],null))[_0x8e52('0x27')](respondWithResult(_0x5c337d,null))[_0x8e52('0x48')](handleError(_0x5c337d,null));};exports['destroy']=function(_0x192272,_0x4e1dcd){return db['OpenchannelApplication'][_0x8e52('0x4c')]({'where':{'id':_0x192272[_0x8e52('0x49')]['id']}})[_0x8e52('0x27')](handleEntityNotFound(_0x4e1dcd,null))[_0x8e52('0x27')](removeEntity(_0x4e1dcd,null))[_0x8e52('0x48')](handleError(_0x4e1dcd,null));}; \ No newline at end of file +var _0x0866=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','body','contact','message','agent','interaction','account','map','OpenchannelApplication','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','options','includeAll','include','rows','catch','show','merge','create','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x0866,0xc7));var _0x6086=function(_0x3df08b,_0x745276){_0x3df08b=_0x3df08b-0x0;var _0x120bfa=_0x0866[_0x3df08b];return _0x120bfa;};'use strict';var emlformat=require(_0x6086('0x0'));var rimraf=require(_0x6086('0x1'));var zipdir=require(_0x6086('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6086('0x3'));var moment=require(_0x6086('0x4'));var BPromise=require(_0x6086('0x5'));var Mustache=require(_0x6086('0x6'));var util=require(_0x6086('0x7'));var path=require(_0x6086('0x8'));var sox=require(_0x6086('0x9'));var csv=require(_0x6086('0xa'));var ejs=require(_0x6086('0xb'));var fs=require('fs');var fs_extra=require(_0x6086('0xc'));var _=require(_0x6086('0xd'));var squel=require(_0x6086('0xe'));var crypto=require('crypto');var jsforce=require(_0x6086('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6086('0xa'));var querystring=require(_0x6086('0x10'));var Papa=require(_0x6086('0x11'));var Redis=require(_0x6086('0x12'));var authService=require(_0x6086('0x13'));var qs=require(_0x6086('0x14'));var as=require(_0x6086('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6086('0x16'))(_0x6086('0x17'));var utils=require(_0x6086('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6086('0x19'));var db=require(_0x6086('0x1a'))['db'];function respondWithStatusCode(_0x76f6bc,_0x1b7262){_0x1b7262=_0x1b7262||0xcc;return function(_0x359f1c){if(_0x359f1c){return _0x76f6bc[_0x6086('0x1b')](_0x1b7262);}return _0x76f6bc[_0x6086('0x1c')](_0x1b7262)[_0x6086('0x1d')]();};}function respondWithResult(_0x3572ba,_0x297f37){_0x297f37=_0x297f37||0xc8;return function(_0x392d68){if(_0x392d68){return _0x3572ba[_0x6086('0x1c')](_0x297f37)[_0x6086('0x1e')](_0x392d68);}};}function respondWithFilteredResult(_0x143ec8,_0x2bc31d){return function(_0x149658){if(_0x149658){var _0x1b9dbc=typeof _0x2bc31d[_0x6086('0x1f')]==='undefined'&&typeof _0x2bc31d['limit']===_0x6086('0x20');var _0xb4eff8=_0x149658[_0x6086('0x21')];var _0x39c0a2=_0x1b9dbc?0x0:_0x2bc31d[_0x6086('0x1f')];var _0x466cba=_0x1b9dbc?_0x149658[_0x6086('0x21')]:_0x2bc31d[_0x6086('0x1f')]+_0x2bc31d[_0x6086('0x22')];var _0x21c791;if(_0x466cba>=_0xb4eff8){_0x466cba=_0xb4eff8;_0x21c791=0xc8;}else{_0x21c791=0xce;}_0x143ec8[_0x6086('0x1c')](_0x21c791);return _0x143ec8[_0x6086('0x23')](_0x6086('0x24'),_0x39c0a2+'-'+_0x466cba+'/'+_0xb4eff8)['json'](_0x149658);}return null;};}function patchUpdates(_0x625de0){return function(_0x5ad94f){try{jsonpatch[_0x6086('0x25')](_0x5ad94f,_0x625de0,!![]);}catch(_0x52e591){return BPromise[_0x6086('0x26')](_0x52e591);}return _0x5ad94f[_0x6086('0x27')]();};}function saveUpdates(_0xb4d0ed,_0x40a308){return function(_0x1962c6){if(_0x1962c6){return _0x1962c6[_0x6086('0x28')](_0xb4d0ed)[_0x6086('0x29')](function(_0x3c023b){return _0x3c023b;});}return null;};}function removeEntity(_0x43a03b,_0x322927){return function(_0x472fa3){if(_0x472fa3){return _0x472fa3[_0x6086('0x2a')]()[_0x6086('0x29')](function(){_0x43a03b['status'](0xcc)[_0x6086('0x1d')]();});}};}function handleEntityNotFound(_0x22bc13,_0x4734e4){return function(_0xc0ede9){if(!_0xc0ede9){_0x22bc13['sendStatus'](0x194);}return _0xc0ede9;};}function handleError(_0x2c85c3,_0x2b76d7){_0x2b76d7=_0x2b76d7||0x1f4;return function(_0xfad29e){logger[_0x6086('0x2b')](_0xfad29e[_0x6086('0x2c')]);if(_0xfad29e[_0x6086('0x2d')]){delete _0xfad29e[_0x6086('0x2d')];}_0x2c85c3[_0x6086('0x1c')](_0x2b76d7)['send'](_0xfad29e);};}function getMustacheRender(_0x2ac72d,_0x2187d4){return Mustache['render'](_0x2ac72d,_['merge'](_0x2187d4[_0x6086('0x2e')],{'contact':_0x2187d4[_0x6086('0x2f')],'message':_0x2187d4[_0x6086('0x30')],'agent':_0x2187d4[_0x6086('0x31')],'interaction':_0x2187d4[_0x6086('0x32')],'account':_0x2187d4[_0x6086('0x33')]}))||'';}exports['index']=function(_0x54c726,_0x543150){var _0x40af5c={},_0x32f4cd={},_0x10a52f={'count':0x0,'rows':[]};var _0x27b672=_[_0x6086('0x34')](db[_0x6086('0x35')][_0x6086('0x36')],function(_0x2a1e3a){return{'name':_0x2a1e3a['fieldName'],'type':_0x2a1e3a['type']['key']};});_0x32f4cd[_0x6086('0x37')]=_[_0x6086('0x34')](_0x27b672,_0x6086('0x2d'));_0x32f4cd[_0x6086('0x38')]=_[_0x6086('0x39')](_0x54c726[_0x6086('0x38')]);_0x32f4cd[_0x6086('0x3a')]=_[_0x6086('0x3b')](_0x32f4cd[_0x6086('0x37')],_0x32f4cd[_0x6086('0x38')]);_0x40af5c[_0x6086('0x3c')]=_[_0x6086('0x3b')](_0x32f4cd[_0x6086('0x37')],qs['fields'](_0x54c726[_0x6086('0x38')][_0x6086('0x3d')]));_0x40af5c[_0x6086('0x3c')]=_0x40af5c['attributes'][_0x6086('0x3e')]?_0x40af5c[_0x6086('0x3c')]:_0x32f4cd['model'];if(!_0x54c726['query'][_0x6086('0x3f')](_0x6086('0x40'))){_0x40af5c[_0x6086('0x22')]=qs[_0x6086('0x22')](_0x54c726[_0x6086('0x38')][_0x6086('0x22')]);_0x40af5c[_0x6086('0x1f')]=qs[_0x6086('0x1f')](_0x54c726[_0x6086('0x38')]['offset']);}_0x40af5c[_0x6086('0x41')]=qs['sort'](_0x54c726[_0x6086('0x38')][_0x6086('0x42')]);_0x40af5c[_0x6086('0x43')]=qs[_0x6086('0x3a')](_[_0x6086('0x44')](_0x54c726['query'],_0x32f4cd[_0x6086('0x3a')]),_0x27b672);if(_0x54c726[_0x6086('0x38')]['filter']){_0x40af5c[_0x6086('0x43')]=_['merge'](_0x40af5c[_0x6086('0x43')],{'$or':_[_0x6086('0x34')](_0x27b672,function(_0x20fb2a){if(_0x20fb2a['type']!=='VIRTUAL'){var _0x48f90d={};_0x48f90d[_0x20fb2a[_0x6086('0x2d')]]={'$like':'%'+_0x54c726[_0x6086('0x38')]['filter']+'%'};return _0x48f90d;}})});}_0x40af5c=_['merge']({},_0x40af5c,_0x54c726[_0x6086('0x45')]);var _0x2c459d={'where':_0x40af5c[_0x6086('0x43')]};return db[_0x6086('0x35')][_0x6086('0x21')](_0x2c459d)[_0x6086('0x29')](function(_0x2bd395){_0x10a52f[_0x6086('0x21')]=_0x2bd395;if(_0x54c726[_0x6086('0x38')][_0x6086('0x46')]){_0x40af5c[_0x6086('0x47')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x40af5c);})['then'](function(_0x1d6979){_0x10a52f[_0x6086('0x48')]=_0x1d6979;return _0x10a52f;})[_0x6086('0x29')](respondWithFilteredResult(_0x543150,_0x40af5c))[_0x6086('0x49')](handleError(_0x543150,null));};exports[_0x6086('0x4a')]=function(_0x41c248,_0x13b1ef){var _0x48c527={'raw':!![],'where':{'id':_0x41c248['params']['id']}},_0xec8238={};_0xec8238[_0x6086('0x37')]=_[_0x6086('0x39')](db['OpenchannelApplication'][_0x6086('0x36')]);_0xec8238[_0x6086('0x38')]=_[_0x6086('0x39')](_0x41c248[_0x6086('0x38')]);_0xec8238['filters']=_['intersection'](_0xec8238[_0x6086('0x37')],_0xec8238['query']);_0x48c527['attributes']=_[_0x6086('0x3b')](_0xec8238['model'],qs[_0x6086('0x3d')](_0x41c248['query'][_0x6086('0x3d')]));_0x48c527[_0x6086('0x3c')]=_0x48c527[_0x6086('0x3c')][_0x6086('0x3e')]?_0x48c527['attributes']:_0xec8238[_0x6086('0x37')];if(_0x41c248[_0x6086('0x38')]['includeAll']){_0x48c527[_0x6086('0x47')]=[{'all':!![]}];}_0x48c527=_[_0x6086('0x4b')]({},_0x48c527,_0x41c248[_0x6086('0x45')]);return db[_0x6086('0x35')]['find'](_0x48c527)[_0x6086('0x29')](handleEntityNotFound(_0x13b1ef,null))[_0x6086('0x29')](respondWithResult(_0x13b1ef,null))[_0x6086('0x49')](handleError(_0x13b1ef,null));};exports[_0x6086('0x4c')]=function(_0x2b3e79,_0x2c2f40){return db[_0x6086('0x35')]['create'](_0x2b3e79[_0x6086('0x2e')],{})['then'](respondWithResult(_0x2c2f40,0xc9))[_0x6086('0x49')](handleError(_0x2c2f40,null));};exports[_0x6086('0x28')]=function(_0x150cc3,_0x208b09){if(_0x150cc3[_0x6086('0x2e')]['id']){delete _0x150cc3[_0x6086('0x2e')]['id'];}return db[_0x6086('0x35')][_0x6086('0x4d')]({'where':{'id':_0x150cc3['params']['id']}})[_0x6086('0x29')](handleEntityNotFound(_0x208b09,null))[_0x6086('0x29')](saveUpdates(_0x150cc3['body'],null))['then'](respondWithResult(_0x208b09,null))['catch'](handleError(_0x208b09,null));};exports[_0x6086('0x2a')]=function(_0x148b6c,_0x5f155a){return db['OpenchannelApplication'][_0x6086('0x4d')]({'where':{'id':_0x148b6c['params']['id']}})[_0x6086('0x29')](handleEntityNotFound(_0x5f155a,null))[_0x6086('0x29')](removeEntity(_0x5f155a,null))[_0x6086('0x49')](handleError(_0x5f155a,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f38562b..98817f4 100644 --- a/server/api/openchannelApplication/openchannelApplication.model.js +++ b/server/api/openchannelApplication/openchannelApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9963=['./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x33183a,_0x4ce659){var _0x382825=function(_0x3637c1){while(--_0x3637c1){_0x33183a['push'](_0x33183a['shift']());}};_0x382825(++_0x4ce659);}(_0x9963,0x1a9));var _0x3996=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9963[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x3996('0x0'));var logger=require(_0x3996('0x1'))(_0x3996('0x2'));var moment=require(_0x3996('0x3'));var BPromise=require(_0x3996('0x4'));var rp=require(_0x3996('0x5'));var fs=require('fs');var path=require(_0x3996('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3996('0x7'));module['exports']=function(_0x170ccf,_0x474c8f){return _0x170ccf[_0x3996('0x8')](_0x3996('0x9'),attributes,{'tableName':_0x3996('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3996('0xb')});}; \ No newline at end of file +var _0x2b44=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x40ac20,_0xecc65d){var _0x272e04=function(_0x31fa4a){while(--_0x31fa4a){_0x40ac20['push'](_0x40ac20['shift']());}};_0x272e04(++_0xecc65d);}(_0x2b44,0x114));var _0x42b4=function(_0x8e6e84,_0xc542de){_0x8e6e84=_0x8e6e84-0x0;var _0x1dfbbe=_0x2b44[_0x8e6e84];return _0x1dfbbe;};'use strict';var _=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var logger=require(_0x42b4('0x2'))(_0x42b4('0x3'));var moment=require(_0x42b4('0x4'));var BPromise=require(_0x42b4('0x5'));var rp=require(_0x42b4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42b4('0x7'));var config=require(_0x42b4('0x8'));var attributes=require(_0x42b4('0x9'));module[_0x42b4('0xa')]=function(_0x54a9e0,_0x44413d){return _0x54a9e0[_0x42b4('0xb')](_0x42b4('0xc'),attributes,{'tableName':_0x42b4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42b4('0xe'),'collate':_0x42b4('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e16babb..8cd7496 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x450606,_0x4248fb){var _0x433264=function(_0x5e1b04){while(--_0x5e1b04){_0x450606['push'](_0x450606['shift']());}};_0x433264(++_0x4248fb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x144044,_0x5d940e){_0x144044=_0x144044-0x0;var _0x26d142=_0x5f2f[_0x144044];return _0x26d142;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x151fff,_0x59140a){var _0x5d2315=function(_0x7a5e6d){while(--_0x7a5e6d){_0x151fff['push'](_0x151fff['shift']());}};_0x5d2315(++_0x59140a);}(_0xb10b,0x12a));var _0xbb10=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xb10b[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 43ce117..27bea21 100644 --- a/server/api/openchannelInteraction/index.js +++ b/server/api/openchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file +var _0xa9e0=['tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','show','/:id/messages','isAuthenticated','getMessages','create','post','addMessage','/:id/tags'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x10')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['post'](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x15')),controller[_0x0a9e('0x16')]);router['put'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')]('openchannel',_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router['delete'](_0x0a9e('0x17'),auth['isAuthenticated'](),interaction[_0x0a9e('0x13')](_0x0a9e('0x14'),_0x0a9e('0x1a')),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1c')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);module[_0x0a9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 1bfad96..03061fd 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.attributes.js +++ b/server/api/openchannelInteraction/openchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0482=['exports','BOOLEAN','STRING','DATE','out','sequelize'];(function(_0x54e4ec,_0x183144){var _0x44ef91=function(_0x34fe75){while(--_0x34fe75){_0x54e4ec['push'](_0x54e4ec['shift']());}};_0x44ef91(++_0x183144);}(_0x0482,0xc5));var _0x2048=function(_0x161341,_0x1c054d){_0x161341=_0x161341-0x0;var _0x5e06c3=_0x0482[_0x161341];return _0x5e06c3;};'use strict';var Sequelize=require(_0x2048('0x0'));module[_0x2048('0x1')]={'closed':{'type':Sequelize[_0x2048('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2048('0x3')]},'secondDisposition':{'type':Sequelize[_0x2048('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2048('0x3')]},'note':{'type':Sequelize[_0x2048('0x3')]},'read1stAt':{'type':Sequelize[_0x2048('0x4')]},'threadId':{'type':Sequelize[_0x2048('0x3')]},'externalUrl':{'type':Sequelize[_0x2048('0x3')]},'lastMsgAt':{'type':Sequelize[_0x2048('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2048('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2048('0x3')]}}; \ No newline at end of file +var _0x3f9b=['DATE','out','BOOLEAN','STRING'];(function(_0x9caf9b,_0x2329a0){var _0x521804=function(_0x449631){while(--_0x449631){_0x9caf9b['push'](_0x9caf9b['shift']());}};_0x521804(++_0x2329a0);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x1e9990,_0x1ff352){_0x1e9990=_0x1e9990-0x0;var _0x3ea157=_0x3f9b[_0x1e9990];return _0x3ea157;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xb3f9('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb3f9('0x1')]},'secondDisposition':{'type':Sequelize[_0xb3f9('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xb3f9('0x1')]},'externalUrl':{'type':Sequelize[_0xb3f9('0x1')]},'lastMsgAt':{'type':Sequelize[_0xb3f9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb3f9('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xb3f9('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index efaa40d..1164d91 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.controller.js +++ b/server/api/openchannelInteraction/openchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['omit','emit','openchannelInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','User','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','catch','params','includeAll','include','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','merge','format','options','findAll','rows','addTags','setTags'];(function(_0x30eb2a,_0x3c3c60){var _0x318b6e=function(_0x3160de){while(--_0x3160de){_0x30eb2a['push'](_0x30eb2a['shift']());}};_0x318b6e(++_0x3c3c60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var pdf=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=typeof _0x459eb1[_0x0a9e('0x1e')]===_0x0a9e('0x1f')&&typeof _0x459eb1[_0x0a9e('0x20')]===_0x0a9e('0x1f');var _0x20559e=_0x478723[_0x0a9e('0x21')];var _0x112016=_0x106033?0x0:_0x459eb1[_0x0a9e('0x1e')];var _0x105080=_0x106033?_0x478723['count']:_0x459eb1[_0x0a9e('0x1e')]+_0x459eb1[_0x0a9e('0x20')];var _0x53682f;if(_0x105080>=_0x20559e){_0x105080=_0x20559e;_0x53682f=0xc8;}else{_0x53682f=0xce;}_0x5a0a06[_0x0a9e('0x22')](_0x53682f);return _0x5a0a06['set']('Content-Range',_0x112016+'-'+_0x105080+'/'+_0x20559e)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x432e56){return function(_0x38e7c4){try{jsonpatch[_0x0a9e('0x23')](_0x38e7c4,_0x432e56,!![]);}catch(_0x4abc77){return BPromise[_0x0a9e('0x24')](_0x4abc77);}return _0x38e7c4[_0x0a9e('0x25')]();};}function saveUpdates(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')](_0x3b45bc)[_0x0a9e('0x27')](function(_0x5ea472){return _0x5ea472;});}return null;};}function removeEntity(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(_0x3a8e58){return _0x3a8e58[_0x0a9e('0x28')]()[_0x0a9e('0x27')](function(){_0x59181e['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1b')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x29')](_0x14433c[_0x0a9e('0x2a')]);if(_0x14433c[_0x0a9e('0x2b')]){delete _0x14433c[_0x0a9e('0x2b')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2c')](_0x14433c);};}function getMustacheRender(_0x468813,_0x2b1f27){return Mustache[_0x0a9e('0x2d')](_0x468813,_['merge'](_0x2b1f27[_0x0a9e('0x2e')],{'contact':_0x2b1f27[_0x0a9e('0x2f')],'message':_0x2b1f27[_0x0a9e('0x30')],'agent':_0x2b1f27[_0x0a9e('0x31')],'interaction':_0x2b1f27[_0x0a9e('0x32')],'account':_0x2b1f27[_0x0a9e('0x33')]}))||'';}function getInteractionUsers(_0x296f41,_0x2e8759){return new BPromise(function(_0x1dbde2,_0x540530){try{if(_0x2e8759[_0x296f41['id']]){_0x296f41[_0x0a9e('0x34')]=_['map'](_0x2e8759[_0x296f41['id']],function(_0x2407f9){return{'id':_0x2407f9['id'],'fullname':_0x2407f9[_0x0a9e('0x35')]};});}}catch(_0x1122db){_0x540530(_0x1122db);}_0x1dbde2(_0x296f41);});}function getInteractionTags(_0x33bdb7,_0x25ce3a){return new BPromise(function(_0x5180f1,_0x66c1d2){try{if(_0x33bdb7[_0x0a9e('0x36')]){_0x33bdb7[_0x0a9e('0x37')]=[];_0x33bdb7[_0x0a9e('0x36')][_0x0a9e('0x38')](',')[_0x0a9e('0x39')](function(_0x332d35){_0x33bdb7[_0x0a9e('0x37')]['push'](_0x25ce3a[_0x332d35]);});}delete _0x33bdb7[_0x0a9e('0x36')];}catch(_0x5e7238){_0x66c1d2(_0x5e7238);}_0x5180f1(_0x33bdb7);});}function updateOpenchannelInteraction(_0x2cc7a0,_0x14b13f,_0x2b7e7f){return new BPromise(function(_0x3f3d41,_0x567193){return getInteractionUsers(_0x2cc7a0,_0x2b7e7f)[_0x0a9e('0x27')](function(_0xd1836d){return getInteractionTags(_0xd1836d,_0x14b13f);})[_0x0a9e('0x27')](function(_0x15de0e){_0x3f3d41(_0x15de0e);})['catch'](function(_0x54135e){_0x567193(_0x54135e);});});}exports[_0x0a9e('0x3a')]=function(_0x5640eb,_0x24936a){var _0x3d9717={},_0x381c37={},_0x1ef87a={'count':0x0,'rows':[]};var _0x4f41ae=_[_0x0a9e('0x3b')](db[_0x0a9e('0x3c')][_0x0a9e('0x3d')],function(_0x533942){return{'name':_0x533942[_0x0a9e('0x3e')],'type':_0x533942[_0x0a9e('0x3f')][_0x0a9e('0x40')]};});_0x381c37['model']=_['map'](_0x4f41ae,_0x0a9e('0x2b'));_0x381c37[_0x0a9e('0x41')]=_['keys'](_0x5640eb[_0x0a9e('0x41')]);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],_0x381c37['query']);_0x3d9717['attributes']=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],qs['fields'](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x3d9717[_0x0a9e('0x46')]=_0x3d9717['attributes'][_0x0a9e('0x47')]?_0x3d9717[_0x0a9e('0x46')]:_0x381c37[_0x0a9e('0x44')];if(!_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3d9717[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x20')]);_0x3d9717[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x1e')]);}_0x3d9717[_0x0a9e('0x4a')]=qs['sort'](_0x5640eb['query'][_0x0a9e('0x4b')]);_0x3d9717[_0x0a9e('0x4c')]=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5640eb[_0x0a9e('0x41')],_0x381c37[_0x0a9e('0x42')]),_0x4f41ae);var _0x10b040=[];var _0x445e25=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')]('id')[_0x0a9e('0x4f')](_0x0a9e('0x2b'))['field'](_0x0a9e('0x50'))[_0x0a9e('0x51')](_0x0a9e('0x52'));var _0xfbd5ad=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')](_0x0a9e('0x53'))[_0x0a9e('0x4f')]('u.fullname')[_0x0a9e('0x4f')]('ui.OpenchannelInteractionId')[_0x0a9e('0x51')](_0x0a9e('0x54'),'ui')[_0x0a9e('0x55')]('users','u',_0x0a9e('0x56'));var _0x7f6eb1=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x51')](_0x0a9e('0x57'),'i')[_0x0a9e('0x55')](_0x0a9e('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0a9e('0x55')](_0x0a9e('0x59'),'o',_0x0a9e('0x5a'))[_0x0a9e('0x55')](_0x0a9e('0x5b'),'a',_0x0a9e('0x5c'))[_0x0a9e('0x55')](_0x0a9e('0x5d'),'me',_0x0a9e('0x5e'))['left_join'](_0x0a9e('0x5f'),'it',_0x0a9e('0x60'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1adfee=squel[_0x0a9e('0x61')]();var _0x37edaa=[];var _0x11545a=squel[_0x0a9e('0x61')]();var _0x30decb;if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x62')]){_0x30decb=as['parseSearch'](_0x5640eb['query']['search']);var _0x39d77d=_0x30decb[_0x0a9e('0x63')];for(var _0x14d602=0x0;_0x14d602<_0x30decb['conditions'][_0x0a9e('0x47')];_0x14d602++){var _0x161aa7=_0x30decb['conditions'][_0x14d602];var _0x5a88da='i';var _0x2ef381=_['find'](_0x4f41ae,[_0x0a9e('0x2b'),_0x161aa7['field']]);if(!_0x2ef381){switch(_0x161aa7[_0x0a9e('0x4f')]){case _0x0a9e('0x64'):if(_0x161aa7[_0x0a9e('0x65')]==0x1){_0x7f6eb1['having']('`'+_0x161aa7[_0x0a9e('0x4f')]+_0x0a9e('0x66'));}else{_0x7f6eb1['having']('`'+_0x161aa7['field']+_0x0a9e('0x67'));}break;case _0x0a9e('0x68'):if(_0x161aa7['operator']===_0x0a9e('0x69')){if(_0x161aa7['value'][_0x0a9e('0x38')]('\x20')['length']>0x1){_0x1adfee[_0x39d77d](_0x0a9e('0x6a'),qs['getFullTextValue'](_0x161aa7['value']),null);}else{var _0x5df0ad='%'+_0x161aa7[_0x0a9e('0x65')]+'%';_0x1adfee[_0x39d77d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5df0ad,_0x5df0ad,_0x5df0ad);}}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x6c')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x6c');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case _0x0a9e('0x70'):var _0xb83dfd=_0x161aa7[_0x0a9e('0x65')]['split'](',')[_0x0a9e('0x3b')](function(_0x26bc80){return Number(_0x26bc80);});_0xb83dfd['forEach'](function(_0x3649cc){_0x11545a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3649cc+',%');});_0x37edaa=_[_0x0a9e('0x71')](_0x37edaa,_0xb83dfd);break;case'User':if(_0x161aa7['operator']==='$substring'){_0x1adfee[_0x39d77d](_0x0a9e('0x72'),'%'+_0x161aa7['value']+'%',null);}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x73')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x73');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381['type'],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case'body':_0xe05a5a=as[_0x0a9e('0x6d')]('me',null,_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a['value'][_0x0a9e('0x1c')]);break;}}else{var _0xe05a5a=as['buildExpression'](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')]['end']);}}}else{var _0x176840=_(_0x5640eb[_0x0a9e('0x41')])[_0x0a9e('0x74')]()['map'](function(_0x3528b7){return _['some'](_0x4f41ae,['name',_0x3528b7])?_0x3528b7:undefined;})[_0x0a9e('0x75')]()[_0x0a9e('0x65')]();if(!_[_0x0a9e('0x76')](_0x176840)){_0x176840[_0x0a9e('0x39')](function(_0x186f39){if(_0x186f39===_0x0a9e('0x77')){_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),[][_0x0a9e('0x79')](_0x5640eb[_0x0a9e('0x41')][_0x186f39]));}else if(_0x186f39===_0x0a9e('0x7a')){var _0x19012b=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])[_0x0a9e('0x7c')];var _0x412a72=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])['$lte'];_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x7d'),_0x19012b,_0x412a72);}else{if(_0x5640eb[_0x0a9e('0x41')][_0x186f39]==='null'){_0x7f6eb1[_0x0a9e('0x4c')]('i.'+_0x186f39+_0x0a9e('0x7e'));}else{_0x7f6eb1['where']('i.'+_0x186f39+_0x0a9e('0x7f'),_0x5640eb[_0x0a9e('0x41')][_0x186f39]);}}});}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x80')]){if(_0x5640eb[_0x0a9e('0x41')]['read']==0x1){_0x7f6eb1['having']('`unreadMessages`\x20=\x200');}else{_0x7f6eb1[_0x0a9e('0x81')](_0x0a9e('0x82'));}}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]){_0x37edaa=_[_0x0a9e('0x84')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')])?_0x5640eb[_0x0a9e('0x41')]['tag']:new Array(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]);_0x37edaa[_0x0a9e('0x39')](function(_0x4a4fc7){_0x11545a['or'](_0x0a9e('0x85'),'%,'+_0x4a4fc7+',%');});}if(_0x5640eb['query'][_0x0a9e('0x86')]){var _0x44351d=_0x5640eb['query'][_0x0a9e('0x86')][_0x0a9e('0x87')]('\x5c','\x5c\x5c')[_0x0a9e('0x87')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x88')](_0x44351d)){_0x1adfee['or']('i.id\x20LIKE\x20?',_0x44351d+'%');}else{_0x1adfee['or'](_0x0a9e('0x89'),qs[_0x0a9e('0x8a')](_0x44351d))['or'](_0x0a9e('0x8b'),_0x44351d+'%')['or'](_0x0a9e('0x8c'),_0x44351d+'%');}}}_0x7f6eb1['where'](_0x1adfee);_0x7f6eb1[_0x0a9e('0x8d')](_0x0a9e('0x8e'));var _0x2d5506={'type':db[_0x0a9e('0x8f')]['QueryTypes'][_0x0a9e('0x90')],'raw':!![]};var _0x3511c9=_0x7f6eb1[_0x0a9e('0x91')]();_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x8e'));_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x92'),_0x0a9e('0x64'));if(_0x3d9717[_0x0a9e('0x4a')]){_0x3d9717[_0x0a9e('0x4a')][_0x0a9e('0x39')](function(_0x1f10ef){var _0x25744a=_0x1f10ef[0x0]===_0x0a9e('0x93')?_0x1f10ef[0x0]:'i.'+_0x1f10ef[0x0];_0x7f6eb1['order'](_0x25744a,_0x1f10ef[0x1]===_0x0a9e('0x94')?![]:!![]);});}if(!_[_0x0a9e('0x76')](_0x37edaa)){_0x7f6eb1[_0x0a9e('0x81')](_0x11545a);_0x3511c9['where'](_0x0a9e('0x95'),_0x37edaa);}BPromise[_0x0a9e('0x96')]()[_0x0a9e('0x27')](function(){if(!_0x30decb){if(_0x5640eb[_0x0a9e('0x41')]['OpenchannelAccountId'])return;_0x3511c9['where'](_0x0a9e('0x97'));_0x7f6eb1[_0x0a9e('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5640eb[_0x0a9e('0x98')]['role']!==_0x0a9e('0x31'))return;return _0x5640eb[_0x0a9e('0x98')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x27')](function(_0x41cf12){if(_[_0x0a9e('0x76')](_0x41cf12)){_0x3511c9[_0x0a9e('0x4c')](_0x0a9e('0x99'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x99'));}else{_0x3511c9['where'](_0x0a9e('0x78'),_[_0x0a9e('0x3b')](_0x41cf12,'id'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),_['map'](_0x41cf12,'id'));}});})[_0x0a9e('0x27')](function(){if(_0x5640eb[_0x0a9e('0x98')]['role']===_0x0a9e('0x31')&&!_0x30decb&&!_0x5640eb['query'][_0x0a9e('0x77')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x3511c9[_0x0a9e('0x9b')](),_0x2d5506);})['then'](function(_0x51ccd7){_0x1ef87a[_0x0a9e('0x21')]=_0x51ccd7[_0x0a9e('0x47')];if(_0x1ef87a[_0x0a9e('0x21')]===0x0)return[];return db['sequelize'][_0x0a9e('0x41')](_0x445e25[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x4e46b2){_0x10b040=_[_0x0a9e('0x9c')](_0x4e46b2,'id');_0x2d5506=_['merge'](_0x2d5506,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5640eb['query'][_0x0a9e('0x45')]){_0x3d9717[_0x0a9e('0x46')][_0x0a9e('0x39')](function(_0x3bfadf){_0x7f6eb1[_0x0a9e('0x4f')]('i.'+_0x3bfadf);});}else{_0x7f6eb1[_0x0a9e('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x64'));_0x7f6eb1['field'](_0x0a9e('0x9d'),_0x0a9e('0x9e'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0x9f'),'Account.mandatoryDisposition');_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa0'),_0x0a9e('0x93'));_0x7f6eb1['field'](_0x0a9e('0xa1'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x7f6eb1[_0x0a9e('0x4f')]('c.email',_0x0a9e('0xa6'));_0x7f6eb1[_0x0a9e('0x4f')]('c.phone',_0x0a9e('0xa7'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa8'),'Contact.mobile');_0x7f6eb1[_0x0a9e('0x4f')]('c.fax',_0x0a9e('0xa9'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x7f6eb1[_0x0a9e('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0a9e('0x36'));}if(_0x3d9717[_0x0a9e('0x20')])_0x7f6eb1[_0x0a9e('0x20')](_0x3d9717[_0x0a9e('0x20')]);if(_0x3d9717[_0x0a9e('0x1e')])_0x7f6eb1[_0x0a9e('0x1e')](_0x3d9717[_0x0a9e('0x1e')]);return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x9b')](),_0x2d5506);})[_0x0a9e('0x27')](function(_0x3754e2){if(_0x3754e2[_0x0a9e('0x47')]>0x0)_0xfbd5ad['where'](_0x0a9e('0xae'),_[_0x0a9e('0x3b')](_0x3754e2,'id'));return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0xfbd5ad[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x3afc8c){var _0x1756c7=_['groupBy'](_0x3afc8c,_0x0a9e('0xaf'));var _0x5e725e=[];_0x3754e2[_0x0a9e('0x39')](function(_0x27041d){_0x5e725e[_0x0a9e('0xb0')](updateOpenchannelInteraction(_0x27041d,_0x10b040,_0x1756c7));});return BPromise[_0x0a9e('0xb1')](_0x5e725e);});});})['then'](function(_0x3ceba6){_0x1ef87a['rows']=_0x3ceba6;return _0x1ef87a;})[_0x0a9e('0x27')](respondWithFilteredResult(_0x24936a,_0x3d9717))[_0x0a9e('0xb2')](handleError(_0x24936a,null));};exports['show']=function(_0x231c6a,_0x63c9f7){var _0x1dd541={};if(_0x231c6a['query']['type']&&_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0x3f')]===_0x0a9e('0x51')){_0x1dd541[_0x0a9e('0x51')]=_0x231c6a[_0x0a9e('0xb3')]['id'];}else{_0x1dd541['id']=_0x231c6a[_0x0a9e('0xb3')]['id'];}var _0x17793e={'raw':![],'where':_0x1dd541},_0x3c75b9={};_0x3c75b9[_0x0a9e('0x44')]=_['keys'](db[_0x0a9e('0x3c')]['rawAttributes']);_0x3c75b9[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x231c6a[_0x0a9e('0x41')]);_0x3c75b9[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x3c75b9['model'],_0x3c75b9[_0x0a9e('0x41')]);_0x17793e[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x3c75b9[_0x0a9e('0x44')],qs[_0x0a9e('0x45')](_0x231c6a['query']['fields']));_0x17793e[_0x0a9e('0x46')]=_0x17793e['attributes'][_0x0a9e('0x47')]?_0x17793e[_0x0a9e('0x46')]:_0x3c75b9[_0x0a9e('0x44')];if(_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x17793e[_0x0a9e('0xb5')]=[{'all':!![]}];}_0x17793e=_['merge']({},_0x17793e,_0x231c6a['options']);return db[_0x0a9e('0x3c')]['find'](_0x17793e)[_0x0a9e('0x27')](handleEntityNotFound(_0x63c9f7,null))['then'](respondWithResult(_0x63c9f7,null))[_0x0a9e('0xb2')](handleError(_0x63c9f7,null));};exports['create']=function(_0x558d60,_0x1c49dc){return db[_0x0a9e('0x3c')]['create'](_0x558d60[_0x0a9e('0x2e')],{})[_0x0a9e('0x27')](respondWithResult(_0x1c49dc,0xc9))[_0x0a9e('0xb2')](handleError(_0x1c49dc,null));};exports[_0x0a9e('0x26')]=function(_0x2eb028,_0x5ab0bc){if(_0x2eb028['body']['id']){delete _0x2eb028[_0x0a9e('0x2e')]['id'];}return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x2eb028[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x5ab0bc,null))['then'](saveUpdates(_0x2eb028[_0x0a9e('0x2e')],null))[_0x0a9e('0x27')](respondWithResult(_0x5ab0bc,null))['catch'](handleError(_0x5ab0bc,null));};exports[_0x0a9e('0x28')]=function(_0x19fd11,_0xcacabb){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x19fd11[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xcacabb,null))[_0x0a9e('0x27')](removeEntity(_0xcacabb,null))[_0x0a9e('0xb2')](handleError(_0xcacabb,null));};exports[_0x0a9e('0xb6')]=function(_0x4bdebb,_0x1065a7){return db[_0x0a9e('0x3c')][_0x0a9e('0xb6')]()[_0x0a9e('0x27')](respondWithResult(_0x1065a7,null))[_0x0a9e('0xb2')](handleError(_0x1065a7,null));};exports['addMessage']=function(_0x500868,_0x21902c,_0x16ae1a){return db[_0x0a9e('0xb7')][_0x0a9e('0x6b')]({'where':{'id':_0x500868[_0x0a9e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x21902c,null))[_0x0a9e('0x27')](function(_0x3c775a){if(_0x3c775a){return _0x3c775a[_0x0a9e('0xb8')](_0x500868['body'][_0x0a9e('0xb9')],_['omit'](_0x500868[_0x0a9e('0x2e')],['ids','id'])||{});}})[_0x0a9e('0x27')](respondWithResult(_0x21902c,null))[_0x0a9e('0xb2')](handleError(_0x21902c,null));};exports[_0x0a9e('0xba')]=function(_0x5c500c,_0xc9529d,_0x5ed560){var _0x4383da={'raw':![],'where':{}};var _0x2b1824={};var _0x43a00a={'count':0x0,'rows':[]};return db[_0x0a9e('0x3c')][_0x0a9e('0xbb')]({'where':{'id':_0x5c500c[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xc9529d,null))[_0x0a9e('0x27')](function(_0x2aaf07){if(_0x2aaf07){_0x2b1824[_0x0a9e('0x44')]=_[_0x0a9e('0x74')](db[_0x0a9e('0xb7')][_0x0a9e('0x3d')]);_0x2b1824[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x5c500c[_0x0a9e('0x41')]);_0x2b1824['filters']=_['intersection'](_0x2b1824[_0x0a9e('0x44')],_0x2b1824['query']);_0x4383da[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x2b1824['model'],qs[_0x0a9e('0x45')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x4383da[_0x0a9e('0x46')]=_0x4383da['attributes'][_0x0a9e('0x47')]?_0x4383da[_0x0a9e('0x46')]:_0x2b1824[_0x0a9e('0x44')];if(!_0x5c500c[_0x0a9e('0x41')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x4383da[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c500c['query'][_0x0a9e('0x20')]);_0x4383da[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5c500c['query'][_0x0a9e('0x1e')]);}_0x4383da[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x4b')]);_0x4383da['where']=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5c500c['query'],_0x2b1824[_0x0a9e('0x42')]));_0x4383da[_0x0a9e('0x4c')][_0x0a9e('0xaf')]=_0x2aaf07['id'];if(_0x5c500c['query']['filter']){_0x4383da['where']=_[_0x0a9e('0xbc')](_0x4383da[_0x0a9e('0x4c')],{'$or':_['map'](_0x4383da[_0x0a9e('0x46')],function(_0x1f78b4){var _0x2a8d55={};_0x2a8d55[_0x1f78b4]={'$like':'%'+_0x5c500c['query'][_0x0a9e('0x86')]+'%'};return _0x2a8d55;})});}if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')]){var _0x30b3b8=_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')][_0x0a9e('0x38')](',');var _0x328ec5={};_0x328ec5[_0x30b3b8[0x0]]={'$gte':moment(_0x30b3b8[0x1])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4383da[_0x0a9e('0x4c')]=_['merge'](_0x4383da[_0x0a9e('0x4c')],_0x328ec5);}_0x4383da=_[_0x0a9e('0xbc')]({},_0x4383da,_0x5c500c[_0x0a9e('0xbe')]);return db[_0x0a9e('0xb7')][_0x0a9e('0x21')]({'where':_0x4383da[_0x0a9e('0x4c')]})['then'](function(_0x1a0314){_0x43a00a[_0x0a9e('0x21')]=_0x1a0314;if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x4383da['include']=[{'all':!![]}];}return db[_0x0a9e('0xb7')][_0x0a9e('0xbf')](_0x4383da);})[_0x0a9e('0x27')](function(_0x1c9539){_0x43a00a[_0x0a9e('0xc0')]=_0x1c9539;return _0x43a00a;});}})[_0x0a9e('0x27')](respondWithFilteredResult(_0xc9529d,_0x4383da))[_0x0a9e('0xb2')](handleError(_0xc9529d,null));};exports[_0x0a9e('0xc1')]=function(_0x3299b7,_0x3539b7,_0x57f0ad){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x3299b7[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x3539b7,null))[_0x0a9e('0x27')](function(_0x253f74){if(_0x253f74){return _0x253f74[_0x0a9e('0xc2')](_0x3299b7[_0x0a9e('0x2e')]['ids'],_[_0x0a9e('0xc3')](_0x3299b7[_0x0a9e('0x2e')],[_0x0a9e('0xb9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0x70')][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0x50')],'where':{'id':_0x3299b7[_0x0a9e('0x2e')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x27')](function(_0x336a19){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x3299b7['params']['id']),'tags':_0x336a19||[]});return{'id':Number(_0x3299b7[_0x0a9e('0xb3')]['id']),'tags':_0x336a19||[]};});}})[_0x0a9e('0x27')](respondWithResult(_0x3539b7,null))[_0x0a9e('0xb2')](handleError(_0x3539b7,null));};exports[_0x0a9e('0xc6')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x2b624e['params']['id']}})['then'](handleEntityNotFound(_0x3942fd,null))[_0x0a9e('0x27')](function(_0x3fa3f2){if(_0x3fa3f2){return _0x3fa3f2[_0x0a9e('0xc6')](_0x2b624e[_0x0a9e('0x41')]['ids']);}})[_0x0a9e('0x27')](respondWithStatusCode(_0x3942fd,null))[_0x0a9e('0xb2')](handleError(_0x3942fd,null));};exports[_0x0a9e('0xc7')]=function(_0x1fdb10,_0x2c8d1d){var _0x4b6c21=moment()['unix']()[_0x0a9e('0x9b')]();var _0x33bcb2=path[_0x0a9e('0xc8')](config['root'],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcb'));var _0x4cee8c=path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),'files',_0x0a9e('0xcd'));var _0x336b30=path[_0x0a9e('0xc8')](_0x33bcb2,_0x4b6c21);var _0x549e03=util['format']('transcript-%d-%s.zip',_0x1fdb10[_0x0a9e('0xb3')]['id'],_0x4b6c21);var _0x1f50db=path[_0x0a9e('0xc8')](_0x33bcb2,_0x549e03);var _0x26931c=[];_0x26931c['push']({'model':db[_0x0a9e('0xce')],'as':'User','attributes':['id',_0x0a9e('0x35')],'raw':!![]});_0x26931c[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xcf')],'as':'Contact','attributes':['id',_0x0a9e('0xd0'),_0x0a9e('0xd1')],'raw':!![]});if(_0x1fdb10[_0x0a9e('0x41')]['attachments']){_0x26931c[_0x0a9e('0xb0')]({'model':db['Attachment'],'as':_0x0a9e('0xd2'),'raw':!![]});}var _0x5c57e1=[{'model':db[_0x0a9e('0xb7')],'as':'Messages','attributes':['id',_0x0a9e('0x2e'),_0x0a9e('0x7a'),_0x0a9e('0xd3'),_0x0a9e('0xd4'),_0x0a9e('0x80')],'include':_0x26931c}];_0x5c57e1[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xd5')],'as':'Account','attributes':['id',_0x0a9e('0x2b')]});_0x5c57e1[_0x0a9e('0xb0')]({'model':db['User'],'as':_0x0a9e('0xd6'),'attributes':['id',_0x0a9e('0x35')]});return db['OpenchannelInteraction'][_0x0a9e('0x6b')]({'where':{'id':_0x1fdb10[_0x0a9e('0xb3')]['id']},'include':_0x5c57e1})[_0x0a9e('0x27')](handleEntityNotFound(_0x2c8d1d,null))['then'](function(_0x3766d7){if(_0x3766d7){var _0xf49ed4=_0x3766d7[_0x0a9e('0xd7')]({'plain':!![]});fs[_0x0a9e('0xd8')](_0x336b30);var _0x2003bc={'channel':_0x0a9e('0xd9'),'account':_0xf49ed4[_0x0a9e('0xda')][_0x0a9e('0x2b')],'agent':_0xf49ed4[_0x0a9e('0xd6')]?_0xf49ed4[_0x0a9e('0xd6')]['fullname']:_0x0a9e('0xdb'),'createdAt':moment(_0xf49ed4['createdAt'])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'closedAt':_0xf49ed4[_0x0a9e('0xdd')]?moment(_0xf49ed4[_0x0a9e('0xde')])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x9b')]():'','disposition':_0xf49ed4[_0x0a9e('0xdf')],'visibility':_0xf49ed4[_0x0a9e('0xe0')]?'Public':_0x0a9e('0xe1'),'messages':_(_0xf49ed4[_0x0a9e('0xe2')])[_0x0a9e('0x86')]({'secret':![]})[_0x0a9e('0x3b')](function(_0x31e1e0){if(_0x31e1e0[_0x0a9e('0xd2')]){var _0x1e93f5=path['join'](_0x4cee8c,_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]);if(fs[_0x0a9e('0xe4')](_0x1e93f5)){fs[_0x0a9e('0xe5')](_0x1e93f5)[_0x0a9e('0xe6')](fs[_0x0a9e('0xe7')](path[_0x0a9e('0xc8')](_0x336b30,_0x31e1e0['Attachment']['basename'])));}}return{'date':moment(_0x31e1e0[_0x0a9e('0x7a')])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'sender':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?_0x31e1e0[_0x0a9e('0xce')]?_0x31e1e0['User'][_0x0a9e('0x35')]:_0x0a9e('0xe9'):_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd0')]+(_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd1')]?'\x20'+_0x31e1e0[_0x0a9e('0x68')]['lastName']:''),'body':_0x31e1e0[_0x0a9e('0xd2')]?_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]:_0x31e1e0['body'],'direction':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?'A':'C','secret':_0x31e1e0[_0x0a9e('0xd4')],'read':_0x31e1e0[_0x0a9e('0x80')],'attachment':_0x31e1e0['Attachment']};})[_0x0a9e('0x65')]()};return ejs[_0x0a9e('0xea')](path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),_0x0a9e('0xeb'),_0x0a9e('0xec')),{'interaction':_0x2003bc})[_0x0a9e('0x27')](function(_0x4e5dec){var _0x3ede01=path[_0x0a9e('0xc8')](_0x336b30,_0x0a9e('0xed')+_0xf49ed4['id']+'-'+_0x4b6c21+_0x0a9e('0xee'));var _0x5f4c6f={'path':_0x3ede01,'channel':'Openchannel','interactionId':_0xf49ed4['id']};return pdf[_0x0a9e('0xef')](_0x4e5dec,_0x5f4c6f);})[_0x0a9e('0x27')](function(){return new BPromise(function(_0x44cd25,_0x596ba3){zipdir(_0x336b30,{'saveTo':_0x1f50db},function(_0x3ccede,_0x40180d){if(_0x3ccede)return _0x596ba3(_0x3ccede);return _0x44cd25(_0x40180d);});})['then'](function(){return new BPromise(function(_0x1970f1,_0x5d19b1){rimraf(_0x336b30,function(_0x35cc2a){if(_0x35cc2a)_0x5d19b1(_0x35cc2a);return _0x1970f1();});});})['then'](function(){return _0x2c8d1d['download'](_0x1f50db,_0x549e03,function(_0x48eaa3){if(_0x48eaa3){console[_0x0a9e('0xf0')](_0x0a9e('0xf1'),_0x48eaa3);}else{fs[_0x0a9e('0xf2')](_0x1f50db);}});});});}else{return _0x2c8d1d[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0xb2')](handleError(_0x2c8d1d,null));}; \ No newline at end of file +var _0xa9e0=['omit','emit','openchannelInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','User','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','update','then','destroy','error','stack','name','send','render','body','contact','message','agent','interaction','account','Users','fullname','TagIds','Tags','split','forEach','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','buildExpression','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','push','all','catch','params','includeAll','include','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','merge','format','options','findAll','rows','addTags','setTags'];(function(_0x3fdc36,_0x5a451d){var _0x4b2ba=function(_0x6e4572){while(--_0x6e4572){_0x3fdc36['push'](_0x3fdc36['shift']());}};_0x4b2ba(++_0x5a451d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var pdf=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var licenseUtil=require(_0x0a9e('0x14'));var db=require(_0x0a9e('0x15'))['db'];config[_0x0a9e('0x16')]=_[_0x0a9e('0x17')](config[_0x0a9e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0x18'))(new Redis(config[_0x0a9e('0x16')]));require(_0x0a9e('0x19'))[_0x0a9e('0x1a')](socket);function respondWithStatusCode(_0x44dcfd,_0x4d5611){_0x4d5611=_0x4d5611||0xcc;return function(_0x52a03d){if(_0x52a03d){return _0x44dcfd[_0x0a9e('0x1b')](_0x4d5611);}return _0x44dcfd['status'](_0x4d5611)[_0x0a9e('0x1c')]();};}function respondWithResult(_0x519dfd,_0x16033c){_0x16033c=_0x16033c||0xc8;return function(_0x12066b){if(_0x12066b){return _0x519dfd['status'](_0x16033c)[_0x0a9e('0x1d')](_0x12066b);}};}function respondWithFilteredResult(_0x5a0a06,_0x459eb1){return function(_0x478723){if(_0x478723){var _0x106033=typeof _0x459eb1[_0x0a9e('0x1e')]===_0x0a9e('0x1f')&&typeof _0x459eb1[_0x0a9e('0x20')]===_0x0a9e('0x1f');var _0x20559e=_0x478723[_0x0a9e('0x21')];var _0x112016=_0x106033?0x0:_0x459eb1[_0x0a9e('0x1e')];var _0x105080=_0x106033?_0x478723['count']:_0x459eb1[_0x0a9e('0x1e')]+_0x459eb1[_0x0a9e('0x20')];var _0x53682f;if(_0x105080>=_0x20559e){_0x105080=_0x20559e;_0x53682f=0xc8;}else{_0x53682f=0xce;}_0x5a0a06[_0x0a9e('0x22')](_0x53682f);return _0x5a0a06['set']('Content-Range',_0x112016+'-'+_0x105080+'/'+_0x20559e)[_0x0a9e('0x1d')](_0x478723);}return null;};}function patchUpdates(_0x432e56){return function(_0x38e7c4){try{jsonpatch[_0x0a9e('0x23')](_0x38e7c4,_0x432e56,!![]);}catch(_0x4abc77){return BPromise[_0x0a9e('0x24')](_0x4abc77);}return _0x38e7c4[_0x0a9e('0x25')]();};}function saveUpdates(_0x3b45bc,_0x4d00e6){return function(_0x370d86){if(_0x370d86){return _0x370d86[_0x0a9e('0x26')](_0x3b45bc)[_0x0a9e('0x27')](function(_0x5ea472){return _0x5ea472;});}return null;};}function removeEntity(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(_0x3a8e58){return _0x3a8e58[_0x0a9e('0x28')]()[_0x0a9e('0x27')](function(){_0x59181e['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1b')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x29')](_0x14433c[_0x0a9e('0x2a')]);if(_0x14433c[_0x0a9e('0x2b')]){delete _0x14433c[_0x0a9e('0x2b')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2c')](_0x14433c);};}function getMustacheRender(_0x468813,_0x2b1f27){return Mustache[_0x0a9e('0x2d')](_0x468813,_['merge'](_0x2b1f27[_0x0a9e('0x2e')],{'contact':_0x2b1f27[_0x0a9e('0x2f')],'message':_0x2b1f27[_0x0a9e('0x30')],'agent':_0x2b1f27[_0x0a9e('0x31')],'interaction':_0x2b1f27[_0x0a9e('0x32')],'account':_0x2b1f27[_0x0a9e('0x33')]}))||'';}function getInteractionUsers(_0x296f41,_0x2e8759){return new BPromise(function(_0x1dbde2,_0x540530){try{if(_0x2e8759[_0x296f41['id']]){_0x296f41[_0x0a9e('0x34')]=_['map'](_0x2e8759[_0x296f41['id']],function(_0x2407f9){return{'id':_0x2407f9['id'],'fullname':_0x2407f9[_0x0a9e('0x35')]};});}}catch(_0x1122db){_0x540530(_0x1122db);}_0x1dbde2(_0x296f41);});}function getInteractionTags(_0x33bdb7,_0x25ce3a){return new BPromise(function(_0x5180f1,_0x66c1d2){try{if(_0x33bdb7[_0x0a9e('0x36')]){_0x33bdb7[_0x0a9e('0x37')]=[];_0x33bdb7[_0x0a9e('0x36')][_0x0a9e('0x38')](',')[_0x0a9e('0x39')](function(_0x332d35){_0x33bdb7[_0x0a9e('0x37')]['push'](_0x25ce3a[_0x332d35]);});}delete _0x33bdb7[_0x0a9e('0x36')];}catch(_0x5e7238){_0x66c1d2(_0x5e7238);}_0x5180f1(_0x33bdb7);});}function updateOpenchannelInteraction(_0x2cc7a0,_0x14b13f,_0x2b7e7f){return new BPromise(function(_0x3f3d41,_0x567193){return getInteractionUsers(_0x2cc7a0,_0x2b7e7f)[_0x0a9e('0x27')](function(_0xd1836d){return getInteractionTags(_0xd1836d,_0x14b13f);})[_0x0a9e('0x27')](function(_0x15de0e){_0x3f3d41(_0x15de0e);})['catch'](function(_0x54135e){_0x567193(_0x54135e);});});}exports[_0x0a9e('0x3a')]=function(_0x5640eb,_0x24936a){var _0x3d9717={},_0x381c37={},_0x1ef87a={'count':0x0,'rows':[]};var _0x4f41ae=_[_0x0a9e('0x3b')](db[_0x0a9e('0x3c')][_0x0a9e('0x3d')],function(_0x533942){return{'name':_0x533942[_0x0a9e('0x3e')],'type':_0x533942[_0x0a9e('0x3f')][_0x0a9e('0x40')]};});_0x381c37['model']=_['map'](_0x4f41ae,_0x0a9e('0x2b'));_0x381c37[_0x0a9e('0x41')]=_['keys'](_0x5640eb[_0x0a9e('0x41')]);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],_0x381c37['query']);_0x3d9717['attributes']=_[_0x0a9e('0x43')](_0x381c37[_0x0a9e('0x44')],qs['fields'](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x3d9717[_0x0a9e('0x46')]=_0x3d9717['attributes'][_0x0a9e('0x47')]?_0x3d9717[_0x0a9e('0x46')]:_0x381c37[_0x0a9e('0x44')];if(!_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x48')](_0x0a9e('0x49'))){_0x3d9717[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x20')]);_0x3d9717[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x1e')]);}_0x3d9717[_0x0a9e('0x4a')]=qs['sort'](_0x5640eb['query'][_0x0a9e('0x4b')]);_0x3d9717[_0x0a9e('0x4c')]=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5640eb[_0x0a9e('0x41')],_0x381c37[_0x0a9e('0x42')]),_0x4f41ae);var _0x10b040=[];var _0x445e25=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')]('id')[_0x0a9e('0x4f')](_0x0a9e('0x2b'))['field'](_0x0a9e('0x50'))[_0x0a9e('0x51')](_0x0a9e('0x52'));var _0xfbd5ad=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x4f')](_0x0a9e('0x53'))[_0x0a9e('0x4f')]('u.fullname')[_0x0a9e('0x4f')]('ui.OpenchannelInteractionId')[_0x0a9e('0x51')](_0x0a9e('0x54'),'ui')[_0x0a9e('0x55')]('users','u',_0x0a9e('0x56'));var _0x7f6eb1=squel[_0x0a9e('0x4e')]()[_0x0a9e('0x51')](_0x0a9e('0x57'),'i')[_0x0a9e('0x55')](_0x0a9e('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0a9e('0x55')](_0x0a9e('0x59'),'o',_0x0a9e('0x5a'))[_0x0a9e('0x55')](_0x0a9e('0x5b'),'a',_0x0a9e('0x5c'))[_0x0a9e('0x55')](_0x0a9e('0x5d'),'me',_0x0a9e('0x5e'))['left_join'](_0x0a9e('0x5f'),'it',_0x0a9e('0x60'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1adfee=squel[_0x0a9e('0x61')]();var _0x37edaa=[];var _0x11545a=squel[_0x0a9e('0x61')]();var _0x30decb;if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x62')]){_0x30decb=as['parseSearch'](_0x5640eb['query']['search']);var _0x39d77d=_0x30decb[_0x0a9e('0x63')];for(var _0x14d602=0x0;_0x14d602<_0x30decb['conditions'][_0x0a9e('0x47')];_0x14d602++){var _0x161aa7=_0x30decb['conditions'][_0x14d602];var _0x5a88da='i';var _0x2ef381=_['find'](_0x4f41ae,[_0x0a9e('0x2b'),_0x161aa7['field']]);if(!_0x2ef381){switch(_0x161aa7[_0x0a9e('0x4f')]){case _0x0a9e('0x64'):if(_0x161aa7[_0x0a9e('0x65')]==0x1){_0x7f6eb1['having']('`'+_0x161aa7[_0x0a9e('0x4f')]+_0x0a9e('0x66'));}else{_0x7f6eb1['having']('`'+_0x161aa7['field']+_0x0a9e('0x67'));}break;case _0x0a9e('0x68'):if(_0x161aa7['operator']===_0x0a9e('0x69')){if(_0x161aa7['value'][_0x0a9e('0x38')]('\x20')['length']>0x1){_0x1adfee[_0x39d77d](_0x0a9e('0x6a'),qs['getFullTextValue'](_0x161aa7['value']),null);}else{var _0x5df0ad='%'+_0x161aa7[_0x0a9e('0x65')]+'%';_0x1adfee[_0x39d77d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5df0ad,_0x5df0ad,_0x5df0ad);}}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x6c')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x6c');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case _0x0a9e('0x70'):var _0xb83dfd=_0x161aa7[_0x0a9e('0x65')]['split'](',')[_0x0a9e('0x3b')](function(_0x26bc80){return Number(_0x26bc80);});_0xb83dfd['forEach'](function(_0x3649cc){_0x11545a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3649cc+',%');});_0x37edaa=_[_0x0a9e('0x71')](_0x37edaa,_0xb83dfd);break;case'User':if(_0x161aa7['operator']==='$substring'){_0x1adfee[_0x39d77d](_0x0a9e('0x72'),'%'+_0x161aa7['value']+'%',null);}else{_0x2ef381=_[_0x0a9e('0x6b')](_0x4f41ae,[_0x0a9e('0x2b'),_0x0a9e('0x73')]);_0x161aa7[_0x0a9e('0x4f')]=_0x0a9e('0x73');_0xe05a5a=as[_0x0a9e('0x6d')](_0x5a88da,_0x2ef381['type'],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a['value'][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x1c')]);}break;case'body':_0xe05a5a=as[_0x0a9e('0x6d')]('me',null,_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a['value'][_0x0a9e('0x1c')]);break;}}else{var _0xe05a5a=as['buildExpression'](_0x5a88da,_0x2ef381[_0x0a9e('0x3f')],_0x161aa7);_0x1adfee[_0x39d77d](_0xe05a5a[_0x0a9e('0x6e')],_0xe05a5a[_0x0a9e('0x65')][_0x0a9e('0x6f')],_0xe05a5a[_0x0a9e('0x65')]['end']);}}}else{var _0x176840=_(_0x5640eb[_0x0a9e('0x41')])[_0x0a9e('0x74')]()['map'](function(_0x3528b7){return _['some'](_0x4f41ae,['name',_0x3528b7])?_0x3528b7:undefined;})[_0x0a9e('0x75')]()[_0x0a9e('0x65')]();if(!_[_0x0a9e('0x76')](_0x176840)){_0x176840[_0x0a9e('0x39')](function(_0x186f39){if(_0x186f39===_0x0a9e('0x77')){_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),[][_0x0a9e('0x79')](_0x5640eb[_0x0a9e('0x41')][_0x186f39]));}else if(_0x186f39===_0x0a9e('0x7a')){var _0x19012b=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])[_0x0a9e('0x7c')];var _0x412a72=JSON[_0x0a9e('0x7b')](_0x5640eb[_0x0a9e('0x41')][_0x186f39])['$lte'];_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x7d'),_0x19012b,_0x412a72);}else{if(_0x5640eb[_0x0a9e('0x41')][_0x186f39]==='null'){_0x7f6eb1[_0x0a9e('0x4c')]('i.'+_0x186f39+_0x0a9e('0x7e'));}else{_0x7f6eb1['where']('i.'+_0x186f39+_0x0a9e('0x7f'),_0x5640eb[_0x0a9e('0x41')][_0x186f39]);}}});}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x80')]){if(_0x5640eb[_0x0a9e('0x41')]['read']==0x1){_0x7f6eb1['having']('`unreadMessages`\x20=\x200');}else{_0x7f6eb1[_0x0a9e('0x81')](_0x0a9e('0x82'));}}if(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]){_0x37edaa=_[_0x0a9e('0x84')](_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')])?_0x5640eb[_0x0a9e('0x41')]['tag']:new Array(_0x5640eb[_0x0a9e('0x41')][_0x0a9e('0x83')]);_0x37edaa[_0x0a9e('0x39')](function(_0x4a4fc7){_0x11545a['or'](_0x0a9e('0x85'),'%,'+_0x4a4fc7+',%');});}if(_0x5640eb['query'][_0x0a9e('0x86')]){var _0x44351d=_0x5640eb['query'][_0x0a9e('0x86')][_0x0a9e('0x87')]('\x5c','\x5c\x5c')[_0x0a9e('0x87')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x88')](_0x44351d)){_0x1adfee['or']('i.id\x20LIKE\x20?',_0x44351d+'%');}else{_0x1adfee['or'](_0x0a9e('0x89'),qs[_0x0a9e('0x8a')](_0x44351d))['or'](_0x0a9e('0x8b'),_0x44351d+'%')['or'](_0x0a9e('0x8c'),_0x44351d+'%');}}}_0x7f6eb1['where'](_0x1adfee);_0x7f6eb1[_0x0a9e('0x8d')](_0x0a9e('0x8e'));var _0x2d5506={'type':db[_0x0a9e('0x8f')]['QueryTypes'][_0x0a9e('0x90')],'raw':!![]};var _0x3511c9=_0x7f6eb1[_0x0a9e('0x91')]();_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x8e'));_0x3511c9[_0x0a9e('0x4f')](_0x0a9e('0x92'),_0x0a9e('0x64'));if(_0x3d9717[_0x0a9e('0x4a')]){_0x3d9717[_0x0a9e('0x4a')][_0x0a9e('0x39')](function(_0x1f10ef){var _0x25744a=_0x1f10ef[0x0]===_0x0a9e('0x93')?_0x1f10ef[0x0]:'i.'+_0x1f10ef[0x0];_0x7f6eb1['order'](_0x25744a,_0x1f10ef[0x1]===_0x0a9e('0x94')?![]:!![]);});}if(!_[_0x0a9e('0x76')](_0x37edaa)){_0x7f6eb1[_0x0a9e('0x81')](_0x11545a);_0x3511c9['where'](_0x0a9e('0x95'),_0x37edaa);}BPromise[_0x0a9e('0x96')]()[_0x0a9e('0x27')](function(){if(!_0x30decb){if(_0x5640eb[_0x0a9e('0x41')]['OpenchannelAccountId'])return;_0x3511c9['where'](_0x0a9e('0x97'));_0x7f6eb1[_0x0a9e('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5640eb[_0x0a9e('0x98')]['role']!==_0x0a9e('0x31'))return;return _0x5640eb[_0x0a9e('0x98')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x0a9e('0x27')](function(_0x41cf12){if(_[_0x0a9e('0x76')](_0x41cf12)){_0x3511c9[_0x0a9e('0x4c')](_0x0a9e('0x99'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x99'));}else{_0x3511c9['where'](_0x0a9e('0x78'),_[_0x0a9e('0x3b')](_0x41cf12,'id'));_0x7f6eb1[_0x0a9e('0x4c')](_0x0a9e('0x78'),_['map'](_0x41cf12,'id'));}});})[_0x0a9e('0x27')](function(){if(_0x5640eb[_0x0a9e('0x98')]['role']===_0x0a9e('0x31')&&!_0x30decb&&!_0x5640eb['query'][_0x0a9e('0x77')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x3511c9[_0x0a9e('0x9b')](),_0x2d5506);})['then'](function(_0x51ccd7){_0x1ef87a[_0x0a9e('0x21')]=_0x51ccd7[_0x0a9e('0x47')];if(_0x1ef87a[_0x0a9e('0x21')]===0x0)return[];return db['sequelize'][_0x0a9e('0x41')](_0x445e25[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x4e46b2){_0x10b040=_[_0x0a9e('0x9c')](_0x4e46b2,'id');_0x2d5506=_['merge'](_0x2d5506,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5640eb['query'][_0x0a9e('0x45')]){_0x3d9717[_0x0a9e('0x46')][_0x0a9e('0x39')](function(_0x3bfadf){_0x7f6eb1[_0x0a9e('0x4f')]('i.'+_0x3bfadf);});}else{_0x7f6eb1[_0x0a9e('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x64'));_0x7f6eb1['field'](_0x0a9e('0x9d'),_0x0a9e('0x9e'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0x9f'),'Account.mandatoryDisposition');_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa0'),_0x0a9e('0x93'));_0x7f6eb1['field'](_0x0a9e('0xa1'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x7f6eb1[_0x0a9e('0x4f')]('c.email',_0x0a9e('0xa6'));_0x7f6eb1[_0x0a9e('0x4f')]('c.phone',_0x0a9e('0xa7'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xa8'),'Contact.mobile');_0x7f6eb1[_0x0a9e('0x4f')]('c.fax',_0x0a9e('0xa9'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x7f6eb1[_0x0a9e('0x4f')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x7f6eb1[_0x0a9e('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0a9e('0x36'));}if(_0x3d9717[_0x0a9e('0x20')])_0x7f6eb1[_0x0a9e('0x20')](_0x3d9717[_0x0a9e('0x20')]);if(_0x3d9717[_0x0a9e('0x1e')])_0x7f6eb1[_0x0a9e('0x1e')](_0x3d9717[_0x0a9e('0x1e')]);return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0x7f6eb1[_0x0a9e('0x9b')](),_0x2d5506);})[_0x0a9e('0x27')](function(_0x3754e2){if(_0x3754e2[_0x0a9e('0x47')]>0x0)_0xfbd5ad['where'](_0x0a9e('0xae'),_[_0x0a9e('0x3b')](_0x3754e2,'id'));return db[_0x0a9e('0x9a')][_0x0a9e('0x41')](_0xfbd5ad[_0x0a9e('0x9b')](),_0x2d5506)['then'](function(_0x3afc8c){var _0x1756c7=_['groupBy'](_0x3afc8c,_0x0a9e('0xaf'));var _0x5e725e=[];_0x3754e2[_0x0a9e('0x39')](function(_0x27041d){_0x5e725e[_0x0a9e('0xb0')](updateOpenchannelInteraction(_0x27041d,_0x10b040,_0x1756c7));});return BPromise[_0x0a9e('0xb1')](_0x5e725e);});});})['then'](function(_0x3ceba6){_0x1ef87a['rows']=_0x3ceba6;return _0x1ef87a;})[_0x0a9e('0x27')](respondWithFilteredResult(_0x24936a,_0x3d9717))[_0x0a9e('0xb2')](handleError(_0x24936a,null));};exports['show']=function(_0x231c6a,_0x63c9f7){var _0x1dd541={};if(_0x231c6a['query']['type']&&_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0x3f')]===_0x0a9e('0x51')){_0x1dd541[_0x0a9e('0x51')]=_0x231c6a[_0x0a9e('0xb3')]['id'];}else{_0x1dd541['id']=_0x231c6a[_0x0a9e('0xb3')]['id'];}var _0x17793e={'raw':![],'where':_0x1dd541},_0x3c75b9={};_0x3c75b9[_0x0a9e('0x44')]=_['keys'](db[_0x0a9e('0x3c')]['rawAttributes']);_0x3c75b9[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x231c6a[_0x0a9e('0x41')]);_0x3c75b9[_0x0a9e('0x42')]=_[_0x0a9e('0x43')](_0x3c75b9['model'],_0x3c75b9[_0x0a9e('0x41')]);_0x17793e[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x3c75b9[_0x0a9e('0x44')],qs[_0x0a9e('0x45')](_0x231c6a['query']['fields']));_0x17793e[_0x0a9e('0x46')]=_0x17793e['attributes'][_0x0a9e('0x47')]?_0x17793e[_0x0a9e('0x46')]:_0x3c75b9[_0x0a9e('0x44')];if(_0x231c6a[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x17793e[_0x0a9e('0xb5')]=[{'all':!![]}];}_0x17793e=_['merge']({},_0x17793e,_0x231c6a['options']);return db[_0x0a9e('0x3c')]['find'](_0x17793e)[_0x0a9e('0x27')](handleEntityNotFound(_0x63c9f7,null))['then'](respondWithResult(_0x63c9f7,null))[_0x0a9e('0xb2')](handleError(_0x63c9f7,null));};exports['create']=function(_0x558d60,_0x1c49dc){return db[_0x0a9e('0x3c')]['create'](_0x558d60[_0x0a9e('0x2e')],{})[_0x0a9e('0x27')](respondWithResult(_0x1c49dc,0xc9))[_0x0a9e('0xb2')](handleError(_0x1c49dc,null));};exports[_0x0a9e('0x26')]=function(_0x2eb028,_0x5ab0bc){if(_0x2eb028['body']['id']){delete _0x2eb028[_0x0a9e('0x2e')]['id'];}return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x2eb028[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x5ab0bc,null))['then'](saveUpdates(_0x2eb028[_0x0a9e('0x2e')],null))[_0x0a9e('0x27')](respondWithResult(_0x5ab0bc,null))['catch'](handleError(_0x5ab0bc,null));};exports[_0x0a9e('0x28')]=function(_0x19fd11,_0xcacabb){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x19fd11[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xcacabb,null))[_0x0a9e('0x27')](removeEntity(_0xcacabb,null))[_0x0a9e('0xb2')](handleError(_0xcacabb,null));};exports[_0x0a9e('0xb6')]=function(_0x4bdebb,_0x1065a7){return db[_0x0a9e('0x3c')][_0x0a9e('0xb6')]()[_0x0a9e('0x27')](respondWithResult(_0x1065a7,null))[_0x0a9e('0xb2')](handleError(_0x1065a7,null));};exports['addMessage']=function(_0x500868,_0x21902c,_0x16ae1a){return db[_0x0a9e('0xb7')][_0x0a9e('0x6b')]({'where':{'id':_0x500868[_0x0a9e('0xb3')]['id']}})['then'](handleEntityNotFound(_0x21902c,null))[_0x0a9e('0x27')](function(_0x3c775a){if(_0x3c775a){return _0x3c775a[_0x0a9e('0xb8')](_0x500868['body'][_0x0a9e('0xb9')],_['omit'](_0x500868[_0x0a9e('0x2e')],['ids','id'])||{});}})[_0x0a9e('0x27')](respondWithResult(_0x21902c,null))[_0x0a9e('0xb2')](handleError(_0x21902c,null));};exports[_0x0a9e('0xba')]=function(_0x5c500c,_0xc9529d,_0x5ed560){var _0x4383da={'raw':![],'where':{}};var _0x2b1824={};var _0x43a00a={'count':0x0,'rows':[]};return db[_0x0a9e('0x3c')][_0x0a9e('0xbb')]({'where':{'id':_0x5c500c[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0xc9529d,null))[_0x0a9e('0x27')](function(_0x2aaf07){if(_0x2aaf07){_0x2b1824[_0x0a9e('0x44')]=_[_0x0a9e('0x74')](db[_0x0a9e('0xb7')][_0x0a9e('0x3d')]);_0x2b1824[_0x0a9e('0x41')]=_[_0x0a9e('0x74')](_0x5c500c[_0x0a9e('0x41')]);_0x2b1824['filters']=_['intersection'](_0x2b1824[_0x0a9e('0x44')],_0x2b1824['query']);_0x4383da[_0x0a9e('0x46')]=_[_0x0a9e('0x43')](_0x2b1824['model'],qs[_0x0a9e('0x45')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x45')]));_0x4383da[_0x0a9e('0x46')]=_0x4383da['attributes'][_0x0a9e('0x47')]?_0x4383da[_0x0a9e('0x46')]:_0x2b1824[_0x0a9e('0x44')];if(!_0x5c500c[_0x0a9e('0x41')]['hasOwnProperty'](_0x0a9e('0x49'))){_0x4383da[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5c500c['query'][_0x0a9e('0x20')]);_0x4383da[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5c500c['query'][_0x0a9e('0x1e')]);}_0x4383da[_0x0a9e('0x4a')]=qs[_0x0a9e('0x4b')](_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x4b')]);_0x4383da['where']=qs[_0x0a9e('0x42')](_[_0x0a9e('0x4d')](_0x5c500c['query'],_0x2b1824[_0x0a9e('0x42')]));_0x4383da[_0x0a9e('0x4c')][_0x0a9e('0xaf')]=_0x2aaf07['id'];if(_0x5c500c['query']['filter']){_0x4383da['where']=_[_0x0a9e('0xbc')](_0x4383da[_0x0a9e('0x4c')],{'$or':_['map'](_0x4383da[_0x0a9e('0x46')],function(_0x1f78b4){var _0x2a8d55={};_0x2a8d55[_0x1f78b4]={'$like':'%'+_0x5c500c['query'][_0x0a9e('0x86')]+'%'};return _0x2a8d55;})});}if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')]){var _0x30b3b8=_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0x7c')][_0x0a9e('0x38')](',');var _0x328ec5={};_0x328ec5[_0x30b3b8[0x0]]={'$gte':moment(_0x30b3b8[0x1])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4383da[_0x0a9e('0x4c')]=_['merge'](_0x4383da[_0x0a9e('0x4c')],_0x328ec5);}_0x4383da=_[_0x0a9e('0xbc')]({},_0x4383da,_0x5c500c[_0x0a9e('0xbe')]);return db[_0x0a9e('0xb7')][_0x0a9e('0x21')]({'where':_0x4383da[_0x0a9e('0x4c')]})['then'](function(_0x1a0314){_0x43a00a[_0x0a9e('0x21')]=_0x1a0314;if(_0x5c500c[_0x0a9e('0x41')][_0x0a9e('0xb4')]){_0x4383da['include']=[{'all':!![]}];}return db[_0x0a9e('0xb7')][_0x0a9e('0xbf')](_0x4383da);})[_0x0a9e('0x27')](function(_0x1c9539){_0x43a00a[_0x0a9e('0xc0')]=_0x1c9539;return _0x43a00a;});}})[_0x0a9e('0x27')](respondWithFilteredResult(_0xc9529d,_0x4383da))[_0x0a9e('0xb2')](handleError(_0xc9529d,null));};exports[_0x0a9e('0xc1')]=function(_0x3299b7,_0x3539b7,_0x57f0ad){return db[_0x0a9e('0x3c')][_0x0a9e('0x6b')]({'where':{'id':_0x3299b7[_0x0a9e('0xb3')]['id']}})[_0x0a9e('0x27')](handleEntityNotFound(_0x3539b7,null))[_0x0a9e('0x27')](function(_0x253f74){if(_0x253f74){return _0x253f74[_0x0a9e('0xc2')](_0x3299b7[_0x0a9e('0x2e')]['ids'],_[_0x0a9e('0xc3')](_0x3299b7[_0x0a9e('0x2e')],[_0x0a9e('0xb9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0x70')][_0x0a9e('0xbf')]({'attributes':['id',_0x0a9e('0x2b'),_0x0a9e('0x50')],'where':{'id':_0x3299b7[_0x0a9e('0x2e')][_0x0a9e('0xb9')]}});})[_0x0a9e('0x27')](function(_0x336a19){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x3299b7['params']['id']),'tags':_0x336a19||[]});return{'id':Number(_0x3299b7[_0x0a9e('0xb3')]['id']),'tags':_0x336a19||[]};});}})[_0x0a9e('0x27')](respondWithResult(_0x3539b7,null))[_0x0a9e('0xb2')](handleError(_0x3539b7,null));};exports[_0x0a9e('0xc6')]=function(_0x2b624e,_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x3c')]['find']({'where':{'id':_0x2b624e['params']['id']}})['then'](handleEntityNotFound(_0x3942fd,null))[_0x0a9e('0x27')](function(_0x3fa3f2){if(_0x3fa3f2){return _0x3fa3f2[_0x0a9e('0xc6')](_0x2b624e[_0x0a9e('0x41')]['ids']);}})[_0x0a9e('0x27')](respondWithStatusCode(_0x3942fd,null))[_0x0a9e('0xb2')](handleError(_0x3942fd,null));};exports[_0x0a9e('0xc7')]=function(_0x1fdb10,_0x2c8d1d){var _0x4b6c21=moment()['unix']()[_0x0a9e('0x9b')]();var _0x33bcb2=path[_0x0a9e('0xc8')](config['root'],_0x0a9e('0xc9'),_0x0a9e('0xca'),_0x0a9e('0xcb'));var _0x4cee8c=path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),'files',_0x0a9e('0xcd'));var _0x336b30=path[_0x0a9e('0xc8')](_0x33bcb2,_0x4b6c21);var _0x549e03=util['format']('transcript-%d-%s.zip',_0x1fdb10[_0x0a9e('0xb3')]['id'],_0x4b6c21);var _0x1f50db=path[_0x0a9e('0xc8')](_0x33bcb2,_0x549e03);var _0x26931c=[];_0x26931c['push']({'model':db[_0x0a9e('0xce')],'as':'User','attributes':['id',_0x0a9e('0x35')],'raw':!![]});_0x26931c[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xcf')],'as':'Contact','attributes':['id',_0x0a9e('0xd0'),_0x0a9e('0xd1')],'raw':!![]});if(_0x1fdb10[_0x0a9e('0x41')]['attachments']){_0x26931c[_0x0a9e('0xb0')]({'model':db['Attachment'],'as':_0x0a9e('0xd2'),'raw':!![]});}var _0x5c57e1=[{'model':db[_0x0a9e('0xb7')],'as':'Messages','attributes':['id',_0x0a9e('0x2e'),_0x0a9e('0x7a'),_0x0a9e('0xd3'),_0x0a9e('0xd4'),_0x0a9e('0x80')],'include':_0x26931c}];_0x5c57e1[_0x0a9e('0xb0')]({'model':db[_0x0a9e('0xd5')],'as':'Account','attributes':['id',_0x0a9e('0x2b')]});_0x5c57e1[_0x0a9e('0xb0')]({'model':db['User'],'as':_0x0a9e('0xd6'),'attributes':['id',_0x0a9e('0x35')]});return db['OpenchannelInteraction'][_0x0a9e('0x6b')]({'where':{'id':_0x1fdb10[_0x0a9e('0xb3')]['id']},'include':_0x5c57e1})[_0x0a9e('0x27')](handleEntityNotFound(_0x2c8d1d,null))['then'](function(_0x3766d7){if(_0x3766d7){var _0xf49ed4=_0x3766d7[_0x0a9e('0xd7')]({'plain':!![]});fs[_0x0a9e('0xd8')](_0x336b30);var _0x2003bc={'channel':_0x0a9e('0xd9'),'account':_0xf49ed4[_0x0a9e('0xda')][_0x0a9e('0x2b')],'agent':_0xf49ed4[_0x0a9e('0xd6')]?_0xf49ed4[_0x0a9e('0xd6')]['fullname']:_0x0a9e('0xdb'),'createdAt':moment(_0xf49ed4['createdAt'])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'closedAt':_0xf49ed4[_0x0a9e('0xdd')]?moment(_0xf49ed4[_0x0a9e('0xde')])[_0x0a9e('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x9b')]():'','disposition':_0xf49ed4[_0x0a9e('0xdf')],'visibility':_0xf49ed4[_0x0a9e('0xe0')]?'Public':_0x0a9e('0xe1'),'messages':_(_0xf49ed4[_0x0a9e('0xe2')])[_0x0a9e('0x86')]({'secret':![]})[_0x0a9e('0x3b')](function(_0x31e1e0){if(_0x31e1e0[_0x0a9e('0xd2')]){var _0x1e93f5=path['join'](_0x4cee8c,_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]);if(fs[_0x0a9e('0xe4')](_0x1e93f5)){fs[_0x0a9e('0xe5')](_0x1e93f5)[_0x0a9e('0xe6')](fs[_0x0a9e('0xe7')](path[_0x0a9e('0xc8')](_0x336b30,_0x31e1e0['Attachment']['basename'])));}}return{'date':moment(_0x31e1e0[_0x0a9e('0x7a')])[_0x0a9e('0xbd')](_0x0a9e('0xdc'))[_0x0a9e('0x9b')](),'sender':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?_0x31e1e0[_0x0a9e('0xce')]?_0x31e1e0['User'][_0x0a9e('0x35')]:_0x0a9e('0xe9'):_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd0')]+(_0x31e1e0[_0x0a9e('0x68')][_0x0a9e('0xd1')]?'\x20'+_0x31e1e0[_0x0a9e('0x68')]['lastName']:''),'body':_0x31e1e0[_0x0a9e('0xd2')]?_0x31e1e0[_0x0a9e('0xd2')][_0x0a9e('0xe3')]:_0x31e1e0['body'],'direction':_0x31e1e0[_0x0a9e('0xd3')]===_0x0a9e('0xe8')?'A':'C','secret':_0x31e1e0[_0x0a9e('0xd4')],'read':_0x31e1e0[_0x0a9e('0x80')],'attachment':_0x31e1e0['Attachment']};})[_0x0a9e('0x65')]()};return ejs[_0x0a9e('0xea')](path[_0x0a9e('0xc8')](config[_0x0a9e('0xcc')],_0x0a9e('0xc9'),_0x0a9e('0xeb'),_0x0a9e('0xec')),{'interaction':_0x2003bc})[_0x0a9e('0x27')](function(_0x4e5dec){var _0x3ede01=path[_0x0a9e('0xc8')](_0x336b30,_0x0a9e('0xed')+_0xf49ed4['id']+'-'+_0x4b6c21+_0x0a9e('0xee'));var _0x5f4c6f={'path':_0x3ede01,'channel':'Openchannel','interactionId':_0xf49ed4['id']};return pdf[_0x0a9e('0xef')](_0x4e5dec,_0x5f4c6f);})[_0x0a9e('0x27')](function(){return new BPromise(function(_0x44cd25,_0x596ba3){zipdir(_0x336b30,{'saveTo':_0x1f50db},function(_0x3ccede,_0x40180d){if(_0x3ccede)return _0x596ba3(_0x3ccede);return _0x44cd25(_0x40180d);});})['then'](function(){return new BPromise(function(_0x1970f1,_0x5d19b1){rimraf(_0x336b30,function(_0x35cc2a){if(_0x35cc2a)_0x5d19b1(_0x35cc2a);return _0x1970f1();});});})['then'](function(){return _0x2c8d1d['download'](_0x1f50db,_0x549e03,function(_0x48eaa3){if(_0x48eaa3){console[_0x0a9e('0xf0')](_0x0a9e('0xf1'),_0x48eaa3);}else{fs[_0x0a9e('0xf2')](_0x1f50db);}});});});}else{return _0x2c8d1d[_0x0a9e('0x1b')](0xc8);}})[_0x0a9e('0xb2')](handleError(_0x2c8d1d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c445640..4bced9c 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.events.js +++ b/server/api/openchannelInteraction/openchannelInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1258=['setDataValue','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then'];(function(_0x1969f1,_0x5af4be){var _0x1eb502=function(_0x8b5400){while(--_0x8b5400){_0x1969f1['push'](_0x1969f1['shift']());}};_0x1eb502(++_0x5af4be);}(_0x1258,0x1b8));var _0x8125=function(_0x30b6ae,_0xecd6e2){_0x30b6ae=_0x30b6ae-0x0;var _0x29b061=_0x1258[_0x30b6ae];return _0x29b061;};'use strict';var EventEmitter=require(_0x8125('0x0'));var OpenchannelInteraction=require(_0x8125('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8125('0x1'))['db'][_0x8125('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8125('0x3')](0x0);var events={'afterCreate':_0x8125('0x4'),'afterUpdate':_0x8125('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc899d8){return function(_0x592a80,_0x253142,_0x4d8d24){_0x592a80[_0x8125('0x6')]({'attributes':['id'],'raw':!![]})[_0x8125('0x7')](function(_0x5a8e3e){_0x592a80[_0x8125('0x8')]('Users',_0x5a8e3e[_0x8125('0x9')](function(_0x97a0bf){return{'id':_0x97a0bf['id']};}));return OpenchannelMessage[_0x8125('0xa')]({'where':{'OpenchannelInteractionId':_0x592a80['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8125('0x7')](function(_0x4f9df9){_0x592a80[_0x8125('0x8')]('unreadMessages',_0x4f9df9[_0x8125('0xb')]);OpenchannelInteractionEvents[_0x8125('0xc')](_0xc899d8+':'+_0x592a80['id'],_0x592a80);OpenchannelInteractionEvents[_0x8125('0xc')](_0xc899d8,_0x592a80);_0x4d8d24(null);})[_0x8125('0xd')](_0x4d8d24(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x8125('0xe')](e,emitEvent(event));}}module[_0x8125('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5417=['Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','remove','getUsers','then'];(function(_0x1ca37c,_0x4b5170){var _0x4687c7=function(_0x4a543f){while(--_0x4a543f){_0x1ca37c['push'](_0x1ca37c['shift']());}};_0x4687c7(++_0x4b5170);}(_0x5417,0x143));var _0x7541=function(_0x40abc3,_0x486560){_0x40abc3=_0x40abc3-0x0;var _0x369b81=_0x5417[_0x40abc3];return _0x369b81;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x7541('0x0'))['db'][_0x7541('0x1')];var OpenchannelMessage=require(_0x7541('0x0'))['db'][_0x7541('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7541('0x3'),'afterUpdate':'update','afterDestroy':_0x7541('0x4')};function emitEvent(_0x4ed83c){return function(_0x12f84f,_0x766269,_0x63e02f){_0x12f84f[_0x7541('0x5')]({'attributes':['id'],'raw':!![]})[_0x7541('0x6')](function(_0x59c3f1){_0x12f84f['setDataValue'](_0x7541('0x7'),_0x59c3f1[_0x7541('0x8')](function(_0x1cd8ed){return{'id':_0x1cd8ed['id']};}));return OpenchannelMessage[_0x7541('0x9')]({'where':{'OpenchannelInteractionId':_0x12f84f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7541('0x6')](function(_0x566b24){_0x12f84f['setDataValue'](_0x7541('0xa'),_0x566b24['length']);OpenchannelInteractionEvents[_0x7541('0xb')](_0x4ed83c+':'+_0x12f84f['id'],_0x12f84f);OpenchannelInteractionEvents[_0x7541('0xb')](_0x4ed83c,_0x12f84f);_0x63e02f(null);})['catch'](_0x63e02f(null));};}for(var e in events){if(events[_0x7541('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x7541('0xd')](e,emitEvent(event));}}module[_0x7541('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 95e9dd6..b180c23 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.model.js +++ b/server/api/openchannelInteraction/openchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b20=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x137027,_0x3dd705){var _0x23197d=function(_0x7db70f){while(--_0x7db70f){_0x137027['push'](_0x137027['shift']());}};_0x23197d(++_0x3dd705);}(_0x1b20,0x66));var _0x01b2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1b20[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var logger=require(_0x01b2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x01b2('0x2'));var rp=require(_0x01b2('0x3'));var fs=require('fs');var path=require(_0x01b2('0x4'));var rimraf=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var attributes=require(_0x01b2('0x7'));module[_0x01b2('0x8')]=function(_0x28de4a,_0x46e745){return _0x28de4a[_0x01b2('0x9')](_0x01b2('0xa'),attributes,{'tableName':_0x01b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x508add,_0x132a08,_0x591ec0){if(_0x508add[_0x01b2('0xc')](_0x01b2('0xd'))){_0x508add[_0x01b2('0xe')]=moment()[_0x01b2('0xf')](_0x01b2('0x10'));}_0x591ec0(null,_0x508add);}}});}; \ No newline at end of file +var _0xe5d5=['openchannel_interactions','changed','closed','format','../../config/logger','moment','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x3db82c,_0x437a89){var _0xb87561=function(_0xae0878){while(--_0xae0878){_0x3db82c['push'](_0x3db82c['shift']());}};_0xb87561(++_0x437a89);}(_0xe5d5,0x156));var _0x5e5d=function(_0x498816,_0x4dd00c){_0x498816=_0x498816-0x0;var _0x23f6b6=_0xe5d5[_0x498816];return _0x23f6b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5e5d('0x0'))('api');var moment=require(_0x5e5d('0x1'));var BPromise=require('bluebird');var rp=require(_0x5e5d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var attributes=require(_0x5e5d('0x5'));module[_0x5e5d('0x6')]=function(_0x13bcb7,_0x39077f){return _0x13bcb7[_0x5e5d('0x7')](_0x5e5d('0x8'),attributes,{'tableName':_0x5e5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x131a59,_0x11973c,_0x1fdb77){if(_0x131a59[_0x5e5d('0xa')](_0x5e5d('0xb'))){_0x131a59['closedAt']=moment()[_0x5e5d('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fdb77(null,_0x131a59);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index dffa00b..3ab5790 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.rpc.js +++ b/server/api/openchannelInteraction/openchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71d2=['where','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw'];(function(_0x37b937,_0x15d276){var _0x35c013=function(_0x4d98a1){while(--_0x4d98a1){_0x37b937['push'](_0x37b937['shift']());}};_0x35c013(++_0x15d276);}(_0x71d2,0x8f));var _0x271d=function(_0x3bc9bd,_0x15e411){_0x3bc9bd=_0x3bc9bd-0x0;var _0xdfa386=_0x71d2[_0x3bc9bd];return _0xdfa386;};'use strict';var _=require(_0x271d('0x0'));var util=require('util');var moment=require(_0x271d('0x1'));var BPromise=require(_0x271d('0x2'));var rs=require(_0x271d('0x3'));var fs=require('fs');var Redis=require(_0x271d('0x4'));var db=require(_0x271d('0x5'))['db'];var utils=require(_0x271d('0x6'));var logger=require(_0x271d('0x7'))(_0x271d('0x8'));var config=require('../../config/environment');var jayson=require(_0x271d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x271d('0xa')]=_[_0x271d('0xb')](config[_0x271d('0xa')],{'host':_0x271d('0xc'),'port':0x18eb});var socket=require(_0x271d('0xd'))(new Redis(config['redis']));require(_0x271d('0xe'))[_0x271d('0xf')](socket);function respondWithRpcPromise(_0x1495c6,_0x359a95,_0x2249fd){return new BPromise(function(_0x4f19b9,_0xebb0d9){return client[_0x271d('0x10')](_0x1495c6,_0x2249fd)[_0x271d('0x11')](function(_0x4d83da){logger[_0x271d('0x12')](_0x271d('0x13'),_0x359a95,_0x271d('0x14'));logger['debug'](_0x271d('0x15'),_0x359a95,_0x271d('0x14'),JSON[_0x271d('0x16')](_0x4d83da));if(_0x4d83da[_0x271d('0x17')]){if(_0x4d83da[_0x271d('0x17')][_0x271d('0x18')]===0x1f4){logger[_0x271d('0x17')](_0x271d('0x13'),_0x359a95,_0x4d83da[_0x271d('0x17')]['message']);return _0xebb0d9(_0x4d83da[_0x271d('0x17')][_0x271d('0x19')]);}logger[_0x271d('0x17')](_0x271d('0x13'),_0x359a95,_0x4d83da[_0x271d('0x17')][_0x271d('0x19')]);return _0x4f19b9(_0x4d83da[_0x271d('0x17')][_0x271d('0x19')]);}else{logger[_0x271d('0x12')](_0x271d('0x13'),_0x359a95,_0x271d('0x14'));_0x4f19b9(_0x4d83da['result'][_0x271d('0x19')]);}})[_0x271d('0x1a')](function(_0xd71e8b){logger[_0x271d('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x359a95,_0xd71e8b);_0xebb0d9(_0xd71e8b);});});}exports[_0x271d('0x1b')]=function(_0x7c615d){var _0x5bf903=this;return new Promise(function(_0x3adff0,_0x527e91){return db[_0x271d('0x1c')][_0x271d('0x1d')](_0x7c615d[_0x271d('0x1e')],{'raw':_0x7c615d[_0x271d('0x1f')]?_0x7c615d[_0x271d('0x1f')][_0x271d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7c615d[_0x271d('0x1f')]?_0x7c615d['options'][_0x271d('0x21')]||null:null,'attributes':_0x7c615d[_0x271d('0x1f')]?_0x7c615d[_0x271d('0x1f')][_0x271d('0x22')]||null:null,'limit':_0x7c615d[_0x271d('0x1f')]?_0x7c615d[_0x271d('0x1f')][_0x271d('0x23')]||null:null})[_0x271d('0x11')](function(_0x3da359){logger['info'](_0x271d('0x1b'),_0x7c615d);logger[_0x271d('0x24')](_0x271d('0x1b'),_0x7c615d,JSON[_0x271d('0x16')](_0x3da359));_0x3adff0(_0x3da359);})[_0x271d('0x1a')](function(_0x548a9b){logger[_0x271d('0x17')](_0x271d('0x1b'),_0x548a9b[_0x271d('0x19')],_0x7c615d);_0x527e91(_0x5bf903[_0x271d('0x17')](0x1f4,_0x548a9b[_0x271d('0x19')]));});});};exports[_0x271d('0x25')]=function(_0x450a2b){return new Promise(function(_0x31144d,_0x25ab92){return db[_0x271d('0x1c')][_0x271d('0x26')]({'where':_0x450a2b[_0x271d('0x1f')]?_0x450a2b['options']['where']||null:null})['then'](function(_0x31e6e2){if(_0x31e6e2){return _0x31e6e2[_0x271d('0x27')](_0x450a2b[_0x271d('0x1e')][_0x271d('0x28')],_[_0x271d('0x29')](_0x450a2b[_0x271d('0x1e')],[_0x271d('0x28'),'id'])||{});}})[_0x271d('0x2a')](function(_0x58e586){logger[_0x271d('0x12')](_0x271d('0x2b'),_0x450a2b);logger[_0x271d('0x24')](_0x271d('0x2b'),_0x450a2b,JSON[_0x271d('0x16')](_0x58e586));_0x31144d(_0x58e586);})['catch'](function(_0x2a2b2a){logger[_0x271d('0x17')](_0x271d('0x2b'),_0x2a2b2a['message'],_0x450a2b);_0x25ab92(_this[_0x271d('0x17')](0x1f4,_0x2a2b2a[_0x271d('0x19')]));});});}; \ No newline at end of file +var _0x82f4=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0x17cfd9,_0x39eed9){var _0x4ea682=function(_0x89888){while(--_0x89888){_0x17cfd9['push'](_0x17cfd9['shift']());}};_0x4ea682(++_0x39eed9);}(_0x82f4,0x144));var _0x482f=function(_0x27f538,_0x1756e1){_0x27f538=_0x27f538-0x0;var _0xb2dd39=_0x82f4[_0x27f538];return _0xb2dd39;};'use strict';var _=require(_0x482f('0x0'));var util=require(_0x482f('0x1'));var moment=require(_0x482f('0x2'));var BPromise=require(_0x482f('0x3'));var rs=require(_0x482f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x482f('0x5'))['db'];var utils=require(_0x482f('0x6'));var logger=require(_0x482f('0x7'))(_0x482f('0x8'));var config=require(_0x482f('0x9'));var jayson=require(_0x482f('0xa'));var client=jayson['client'][_0x482f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x482f('0xc')],{'host':_0x482f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x482f('0xc')]));require(_0x482f('0xe'))[_0x482f('0xf')](socket);function respondWithRpcPromise(_0x676afa,_0x2537c5,_0x4c14fb){return new BPromise(function(_0x28304e,_0x33e5b4){return client[_0x482f('0x10')](_0x676afa,_0x4c14fb)[_0x482f('0x11')](function(_0x486d68){logger[_0x482f('0x12')](_0x482f('0x13'),_0x2537c5,'request\x20sent');logger[_0x482f('0x14')](_0x482f('0x15'),_0x2537c5,_0x482f('0x16'),JSON[_0x482f('0x17')](_0x486d68));if(_0x486d68['error']){if(_0x486d68[_0x482f('0x18')][_0x482f('0x19')]===0x1f4){logger[_0x482f('0x18')](_0x482f('0x13'),_0x2537c5,_0x486d68[_0x482f('0x18')][_0x482f('0x1a')]);return _0x33e5b4(_0x486d68[_0x482f('0x18')][_0x482f('0x1a')]);}logger[_0x482f('0x18')](_0x482f('0x13'),_0x2537c5,_0x486d68[_0x482f('0x18')][_0x482f('0x1a')]);return _0x28304e(_0x486d68[_0x482f('0x18')][_0x482f('0x1a')]);}else{logger[_0x482f('0x12')](_0x482f('0x13'),_0x2537c5,'request\x20sent');_0x28304e(_0x486d68[_0x482f('0x1b')][_0x482f('0x1a')]);}})[_0x482f('0x1c')](function(_0x5c0d57){logger[_0x482f('0x18')](_0x482f('0x13'),_0x2537c5,_0x5c0d57);_0x33e5b4(_0x5c0d57);});});}exports[_0x482f('0x1d')]=function(_0x6ca332){var _0x169253=this;return new Promise(function(_0x62f7d,_0x56c0b4){return db['OpenchannelInteraction'][_0x482f('0x1e')](_0x6ca332[_0x482f('0x1f')],{'raw':_0x6ca332[_0x482f('0x20')]?_0x6ca332[_0x482f('0x20')][_0x482f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ca332['options']?_0x6ca332['options'][_0x482f('0x22')]||null:null,'attributes':_0x6ca332[_0x482f('0x20')]?_0x6ca332[_0x482f('0x20')][_0x482f('0x23')]||null:null,'limit':_0x6ca332[_0x482f('0x20')]?_0x6ca332[_0x482f('0x20')]['limit']||null:null})['then'](function(_0x23c585){logger[_0x482f('0x12')](_0x482f('0x1d'),_0x6ca332);logger['debug']('UpdateOpenchannelInteraction',_0x6ca332,JSON[_0x482f('0x17')](_0x23c585));_0x62f7d(_0x23c585);})[_0x482f('0x1c')](function(_0x2e603c){logger['error'](_0x482f('0x1d'),_0x2e603c[_0x482f('0x1a')],_0x6ca332);_0x56c0b4(_0x169253['error'](0x1f4,_0x2e603c[_0x482f('0x1a')]));});});};exports[_0x482f('0x24')]=function(_0x55d7d2){return new Promise(function(_0x255d63,_0x555ae5){return db[_0x482f('0x25')][_0x482f('0x26')]({'where':_0x55d7d2[_0x482f('0x20')]?_0x55d7d2[_0x482f('0x20')][_0x482f('0x22')]||null:null})[_0x482f('0x11')](function(_0x3d90db){if(_0x3d90db){return _0x3d90db[_0x482f('0x27')](_0x55d7d2[_0x482f('0x1f')]['ids'],_[_0x482f('0x28')](_0x55d7d2[_0x482f('0x1f')],[_0x482f('0x29'),'id'])||{});}})['spread'](function(_0x18e7da){logger[_0x482f('0x12')](_0x482f('0x2a'),_0x55d7d2);logger[_0x482f('0x14')](_0x482f('0x2a'),_0x55d7d2,JSON['stringify'](_0x18e7da));_0x255d63(_0x18e7da);})[_0x482f('0x1c')](function(_0x3dd79c){logger[_0x482f('0x18')](_0x482f('0x2a'),_0x3dd79c[_0x482f('0x1a')],_0x55d7d2);_0x555ae5(_this[_0x482f('0x18')](0x1f4,_0x3dd79c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 81143b9..5bdaccf 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.socket.js +++ b/server/api/openchannelInteraction/openchannelInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca59=['removeListener','length','openchannelInteraction:','save','remove','emit'];(function(_0x2badfc,_0x21dec9){var _0x29f9cb=function(_0xed0f05){while(--_0xed0f05){_0x2badfc['push'](_0x2badfc['shift']());}};_0x29f9cb(++_0x21dec9);}(_0xca59,0xf3));var _0x9ca5=function(_0x545716,_0x562e92){_0x545716=_0x545716-0x0;var _0x394ab0=_0xca59[_0x545716];return _0x394ab0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x9ca5('0x0'),_0x9ca5('0x1'),'update'];function createListener(_0x2caf88,_0x3f7662){return function(_0x2a2aea){_0x3f7662[_0x9ca5('0x2')](_0x2caf88,_0x2a2aea);};}function removeListener(_0x624913,_0x1786be){return function(){OpenchannelInteractionEvents[_0x9ca5('0x3')](_0x624913,_0x1786be);};}exports['register']=function(_0x3b8167){for(var _0x2fcade=0x0,_0x589c7d=events[_0x9ca5('0x4')];_0x2fcade<_0x589c7d;_0x2fcade++){var _0x474d5a=events[_0x2fcade];var _0x5655f5=createListener(_0x9ca5('0x5')+_0x474d5a,_0x3b8167);OpenchannelInteractionEvents['on'](_0x474d5a,_0x5655f5);}}; \ No newline at end of file +var _0x7b99=['update','emit','removeListener','length','./openchannelInteraction.events','save','remove'];(function(_0x2f4748,_0x24af55){var _0x18eece=function(_0x489dd6){while(--_0x489dd6){_0x2f4748['push'](_0x2f4748['shift']());}};_0x18eece(++_0x24af55);}(_0x7b99,0x185));var _0x97b9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7b99[_0x138adb];return _0x1b27f2;};'use strict';var OpenchannelInteractionEvents=require(_0x97b9('0x0'));var events=[_0x97b9('0x1'),_0x97b9('0x2'),_0x97b9('0x3')];function createListener(_0x269a38,_0x4da9a0){return function(_0x3adb31){_0x4da9a0[_0x97b9('0x4')](_0x269a38,_0x3adb31);};}function removeListener(_0xa5fe81,_0x1dfb31){return function(){OpenchannelInteractionEvents[_0x97b9('0x5')](_0xa5fe81,_0x1dfb31);};}exports['register']=function(_0x3a92ab){for(var _0x291d5a=0x0,_0x499886=events[_0x97b9('0x6')];_0x291d5a<_0x499886;_0x291d5a++){var _0x129cdf=events[_0x291d5a];var _0x1648f9=createListener('openchannelInteraction:'+_0x129cdf,_0x3a92ab);OpenchannelInteractionEvents['on'](_0x129cdf,_0x1648f9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 99cc69b..5bc2b1f 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c2=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','post','openchannel','openchannelmessage:create','create','put','/:id','update','/:id/accept','accept','delete','destroy','exports'];(function(_0x525147,_0xdab712){var _0x2da357=function(_0x486fac){while(--_0x486fac){_0x525147['push'](_0x525147['shift']());}};_0x2da357(++_0xdab712);}(_0xf6c2,0xcf));var _0x2f6c=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xf6c2[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require('multer');var util=require(_0x2f6c('0x0'));var path=require(_0x2f6c('0x1'));var timeout=require(_0x2f6c('0x2'));var express=require(_0x2f6c('0x3'));var router=express[_0x2f6c('0x4')]();var fs_extra=require(_0x2f6c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f6c('0x6'));var controller=require('./openchannelMessage.controller');router[_0x2f6c('0x7')]('/',auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x9')]);router[_0x2f6c('0x7')](_0x2f6c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2f6c('0x7')]('/:id',auth[_0x2f6c('0x8')](),controller['show']);router[_0x2f6c('0xb')]('/',auth[_0x2f6c('0x8')](),interaction['tracked'](_0x2f6c('0xc'),_0x2f6c('0xd')),controller[_0x2f6c('0xe')]);router[_0x2f6c('0xf')](_0x2f6c('0x10'),auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x11')]);router[_0x2f6c('0xf')](_0x2f6c('0x12'),auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x13')]);router[_0x2f6c('0xf')]('/:id/reject',auth[_0x2f6c('0x8')](),controller['reject']);router[_0x2f6c('0x14')](_0x2f6c('0x10'),auth[_0x2f6c('0x8')](),controller[_0x2f6c('0x15')]);module[_0x2f6c('0x16')]=router; \ No newline at end of file +var _0x3e3c=['./openchannelMessage.controller','isAuthenticated','get','describe','/:id','show','post','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x36f336,_0x4b0600){var _0x1567b4=function(_0x5784de){while(--_0x5784de){_0x36f336['push'](_0x36f336['shift']());}};_0x1567b4(++_0x4b0600);}(_0x3e3c,0xc1));var _0xc3e3=function(_0x3c3928,_0x5e59ec){_0x3c3928=_0x3c3928-0x0;var _0x23474f=_0x3e3c[_0x3c3928];return _0x23474f;};'use strict';var multer=require(_0xc3e3('0x0'));var util=require(_0xc3e3('0x1'));var path=require(_0xc3e3('0x2'));var timeout=require(_0xc3e3('0x3'));var express=require('express');var router=express[_0xc3e3('0x4')]();var fs_extra=require(_0xc3e3('0x5'));var auth=require(_0xc3e3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc3e3('0x7'));router['get']('/',auth[_0xc3e3('0x8')](),controller['index']);router[_0xc3e3('0x9')]('/describe',auth[_0xc3e3('0x8')](),controller[_0xc3e3('0xa')]);router[_0xc3e3('0x9')](_0xc3e3('0xb'),auth[_0xc3e3('0x8')](),controller[_0xc3e3('0xc')]);router[_0xc3e3('0xd')]('/',auth[_0xc3e3('0x8')](),interaction['tracked'](_0xc3e3('0xe'),_0xc3e3('0xf')),controller[_0xc3e3('0x10')]);router['put'](_0xc3e3('0xb'),auth['isAuthenticated'](),controller[_0xc3e3('0x11')]);router[_0xc3e3('0x12')](_0xc3e3('0x13'),auth[_0xc3e3('0x8')](),controller[_0xc3e3('0x14')]);router[_0xc3e3('0x12')](_0xc3e3('0x15'),auth[_0xc3e3('0x8')](),controller['reject']);router[_0xc3e3('0x16')]('/:id',auth[_0xc3e3('0x8')](),controller[_0xc3e3('0x17')]);module[_0xc3e3('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 6a371c9..4adfaf0 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc69e=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x115da5,_0x3377ff){var _0x48dc02=function(_0xcae7ab){while(--_0xcae7ab){_0x115da5['push'](_0x115da5['shift']());}};_0x48dc02(++_0x3377ff);}(_0xc69e,0xff));var _0xec69=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc69e[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xec69('0x0'));module[_0xec69('0x1')]={'body':{'type':Sequelize[_0xec69('0x2')](_0xec69('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xec69('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xec69('0x5')]('in',_0xec69('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xec69('0x7')]},'providerName':{'type':Sequelize[_0xec69('0x8')]},'providerResponse':{'type':Sequelize[_0xec69('0x2')]}}; \ No newline at end of file +var _0xb313=['medium','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0xb313,0x12a));var _0x3b31=function(_0xc2b4c8,_0x756a49){_0xc2b4c8=_0xc2b4c8-0x0;var _0x402443=_0xb313[_0xc2b4c8];return _0x402443;};'use strict';var Sequelize=require(_0x3b31('0x0'));module[_0x3b31('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3b31('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x3b31('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b31('0x4')]('in',_0x3b31('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 44bf0f4..6a90867 100644 --- a/server/api/openchannelMessage/openchannelMessage.controller.js +++ b/server/api/openchannelMessage/openchannelMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e29=['sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','stack','name','send','merge','body','contact','agent','interaction','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','OpenchannelMessage','includeAll','include','rows','show','params','rawAttributes','options','find','create','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch'];(function(_0x4da097,_0x1bd4f6){var _0x5818bc=function(_0x11cfd8){while(--_0x11cfd8){_0x4da097['push'](_0x4da097['shift']());}};_0x5818bc(++_0x1bd4f6);}(_0x9e29,0xc2));var _0x99e2=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x9e29[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0x99e2('0x0'));var rimraf=require(_0x99e2('0x1'));var zipdir=require(_0x99e2('0x2'));var jsonpatch=require(_0x99e2('0x3'));var rp=require('request-promise');var moment=require(_0x99e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x99e2('0x5'));var util=require('util');var path=require(_0x99e2('0x6'));var sox=require(_0x99e2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99e2('0x8'));var squel=require(_0x99e2('0x9'));var crypto=require('crypto');var jsforce=require(_0x99e2('0xa'));var deskjs=require(_0x99e2('0xb'));var toCsv=require(_0x99e2('0xc'));var querystring=require(_0x99e2('0xd'));var Papa=require(_0x99e2('0xe'));var Redis=require(_0x99e2('0xf'));var authService=require(_0x99e2('0x10'));var qs=require(_0x99e2('0x11'));var as=require(_0x99e2('0x12'));var hardwareService=require(_0x99e2('0x13'));var logger=require(_0x99e2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x99e2('0x15'));var licenseUtil=require(_0x99e2('0x16'));var db=require('../../mysqldb')['db'];config[_0x99e2('0x17')]=_[_0x99e2('0x18')](config[_0x99e2('0x17')],{'host':_0x99e2('0x19'),'port':0x18eb});var socket=require(_0x99e2('0x1a'))(new Redis(config[_0x99e2('0x17')]));require(_0x99e2('0x1b'))[_0x99e2('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x99e2('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28bf3e,_0x111379,_0x10cf71,_0x2f7c52){return new BPromise(function(_0x31bfc3,_0x439643){var _0x3f4fa8=_0x2f7c52||client;return _0x3f4fa8[_0x99e2('0x1e')](_0x28bf3e,_0x10cf71)[_0x99e2('0x1f')](function(_0x50c51e){logger[_0x99e2('0x20')](_0x99e2('0x21'),_0x111379,'request\x20sent');logger[_0x99e2('0x22')](_0x99e2('0x23'),_0x111379,'request\x20sent',JSON[_0x99e2('0x24')](_0x50c51e));if(_0x50c51e[_0x99e2('0x25')]){if(_0x50c51e[_0x99e2('0x25')]['code']===0x1f4){logger[_0x99e2('0x25')](_0x99e2('0x21'),_0x111379,_0x50c51e[_0x99e2('0x25')][_0x99e2('0x26')]);return _0x439643(_0x50c51e['error'][_0x99e2('0x26')]);}logger[_0x99e2('0x25')](_0x99e2('0x21'),_0x111379,_0x50c51e[_0x99e2('0x25')][_0x99e2('0x26')]);return _0x31bfc3(_0x50c51e[_0x99e2('0x25')][_0x99e2('0x26')]);}else{logger[_0x99e2('0x20')](_0x99e2('0x21'),_0x111379,_0x99e2('0x27'));_0x31bfc3(_0x50c51e[_0x99e2('0x28')][_0x99e2('0x26')]);}})[_0x99e2('0x29')](function(_0x5805a1){logger['error'](_0x99e2('0x21'),_0x111379,_0x5805a1);_0x439643(_0x5805a1);});});}function respondWithStatusCode(_0x429e22,_0x18a07f){_0x18a07f=_0x18a07f||0xcc;return function(_0x44a2bd){if(_0x44a2bd){return _0x429e22[_0x99e2('0x2a')](_0x18a07f);}return _0x429e22[_0x99e2('0x2b')](_0x18a07f)[_0x99e2('0x2c')]();};}function respondWithResult(_0xd0f8dc,_0x2d6df1){_0x2d6df1=_0x2d6df1||0xc8;return function(_0x11f85b){if(_0x11f85b){return _0xd0f8dc[_0x99e2('0x2b')](_0x2d6df1)[_0x99e2('0x2d')](_0x11f85b);}};}function respondWithFilteredResult(_0x27cd82,_0x5044ee){return function(_0x3b157e){if(_0x3b157e){var _0x1138c9=typeof _0x5044ee['offset']==='undefined'&&typeof _0x5044ee['limit']===_0x99e2('0x2e');var _0x24c3d2=_0x3b157e[_0x99e2('0x2f')];var _0x1f9291=_0x1138c9?0x0:_0x5044ee['offset'];var _0x17d35e=_0x1138c9?_0x3b157e[_0x99e2('0x2f')]:_0x5044ee[_0x99e2('0x30')]+_0x5044ee[_0x99e2('0x31')];var _0x25f23f;if(_0x17d35e>=_0x24c3d2){_0x17d35e=_0x24c3d2;_0x25f23f=0xc8;}else{_0x25f23f=0xce;}_0x27cd82[_0x99e2('0x2b')](_0x25f23f);return _0x27cd82[_0x99e2('0x32')](_0x99e2('0x33'),_0x1f9291+'-'+_0x17d35e+'/'+_0x24c3d2)[_0x99e2('0x2d')](_0x3b157e);}return null;};}function patchUpdates(_0x3d2ff1){return function(_0x2bc640){try{jsonpatch['apply'](_0x2bc640,_0x3d2ff1,!![]);}catch(_0x396a92){return BPromise[_0x99e2('0x34')](_0x396a92);}return _0x2bc640[_0x99e2('0x35')]();};}function saveUpdates(_0x4064fb,_0x27d4fc){return function(_0x40375f){if(_0x40375f){return _0x40375f['update'](_0x4064fb)[_0x99e2('0x1f')](function(_0x59e33c){return _0x59e33c;});}return null;};}function removeEntity(_0x50a492,_0x4cc48c){return function(_0x5c436f){if(_0x5c436f){return _0x5c436f['destroy']()[_0x99e2('0x1f')](function(){_0x50a492[_0x99e2('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fc26,_0x14c9e6){return function(_0x44eec4){if(!_0x44eec4){_0x36fc26[_0x99e2('0x2a')](0x194);}return _0x44eec4;};}function handleError(_0xe2eb9d,_0x5def28){_0x5def28=_0x5def28||0x1f4;return function(_0x4dbf7f){logger[_0x99e2('0x25')](_0x4dbf7f[_0x99e2('0x36')]);if(_0x4dbf7f[_0x99e2('0x37')]){delete _0x4dbf7f['name'];}_0xe2eb9d[_0x99e2('0x2b')](_0x5def28)[_0x99e2('0x38')](_0x4dbf7f);};}function getMustacheRender(_0x579a17,_0x5b154b){return Mustache['render'](_0x579a17,_[_0x99e2('0x39')](_0x5b154b[_0x99e2('0x3a')],{'contact':_0x5b154b[_0x99e2('0x3b')],'message':_0x5b154b['message'],'agent':_0x5b154b[_0x99e2('0x3c')],'interaction':_0x5b154b[_0x99e2('0x3d')],'account':_0x5b154b['account']}))||'';}exports['index']=function(_0x2c7f56,_0x59ff63){var _0x1b0fd5={},_0x47dd9c={},_0x19d7c4={'count':0x0,'rows':[]};var _0x4386d9=_[_0x99e2('0x3e')](db['OpenchannelMessage']['rawAttributes'],function(_0x33485e){return{'name':_0x33485e[_0x99e2('0x3f')],'type':_0x33485e[_0x99e2('0x40')][_0x99e2('0x41')]};});_0x47dd9c[_0x99e2('0x42')]=_[_0x99e2('0x3e')](_0x4386d9,_0x99e2('0x37'));_0x47dd9c['query']=_[_0x99e2('0x43')](_0x2c7f56[_0x99e2('0x44')]);_0x47dd9c[_0x99e2('0x45')]=_[_0x99e2('0x46')](_0x47dd9c[_0x99e2('0x42')],_0x47dd9c['query']);_0x1b0fd5[_0x99e2('0x47')]=_[_0x99e2('0x46')](_0x47dd9c[_0x99e2('0x42')],qs[_0x99e2('0x48')](_0x2c7f56[_0x99e2('0x44')]['fields']));_0x1b0fd5['attributes']=_0x1b0fd5[_0x99e2('0x47')][_0x99e2('0x49')]?_0x1b0fd5[_0x99e2('0x47')]:_0x47dd9c[_0x99e2('0x42')];if(!_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x4a')]('nolimit')){_0x1b0fd5[_0x99e2('0x31')]=qs[_0x99e2('0x31')](_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x31')]);_0x1b0fd5[_0x99e2('0x30')]=qs[_0x99e2('0x30')](_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x30')]);}_0x1b0fd5['order']=qs[_0x99e2('0x4b')](_0x2c7f56['query'][_0x99e2('0x4b')]);_0x1b0fd5[_0x99e2('0x4c')]=qs[_0x99e2('0x45')](_[_0x99e2('0x4d')](_0x2c7f56[_0x99e2('0x44')],_0x47dd9c[_0x99e2('0x45')]),_0x4386d9);if(_0x2c7f56[_0x99e2('0x44')][_0x99e2('0x4e')]){_0x1b0fd5['where']=_[_0x99e2('0x39')](_0x1b0fd5[_0x99e2('0x4c')],{'$or':_['map'](_0x4386d9,function(_0x4f3285){if(_0x4f3285[_0x99e2('0x40')]!=='VIRTUAL'){var _0x528daf={};_0x528daf[_0x4f3285[_0x99e2('0x37')]]={'$like':'%'+_0x2c7f56[_0x99e2('0x44')]['filter']+'%'};return _0x528daf;}})});}_0x1b0fd5=_[_0x99e2('0x39')]({},_0x1b0fd5,_0x2c7f56['options']);var _0x22abd7={'where':_0x1b0fd5[_0x99e2('0x4c')]};return db[_0x99e2('0x4f')][_0x99e2('0x2f')](_0x22abd7)[_0x99e2('0x1f')](function(_0x45c6ee){_0x19d7c4['count']=_0x45c6ee;if(_0x2c7f56['query'][_0x99e2('0x50')]){_0x1b0fd5[_0x99e2('0x51')]=[{'all':!![]}];}return db[_0x99e2('0x4f')]['findAll'](_0x1b0fd5);})['then'](function(_0x72af42){_0x19d7c4[_0x99e2('0x52')]=_0x72af42;return _0x19d7c4;})['then'](respondWithFilteredResult(_0x59ff63,_0x1b0fd5))[_0x99e2('0x29')](handleError(_0x59ff63,null));};exports[_0x99e2('0x53')]=function(_0x1e11c2,_0x397951){var _0xcbf2cd={'raw':!![],'where':{'id':_0x1e11c2[_0x99e2('0x54')]['id']}},_0x24445a={};_0x24445a['model']=_[_0x99e2('0x43')](db['OpenchannelMessage'][_0x99e2('0x55')]);_0x24445a[_0x99e2('0x44')]=_['keys'](_0x1e11c2[_0x99e2('0x44')]);_0x24445a[_0x99e2('0x45')]=_['intersection'](_0x24445a['model'],_0x24445a[_0x99e2('0x44')]);_0xcbf2cd[_0x99e2('0x47')]=_[_0x99e2('0x46')](_0x24445a[_0x99e2('0x42')],qs[_0x99e2('0x48')](_0x1e11c2[_0x99e2('0x44')][_0x99e2('0x48')]));_0xcbf2cd[_0x99e2('0x47')]=_0xcbf2cd[_0x99e2('0x47')][_0x99e2('0x49')]?_0xcbf2cd[_0x99e2('0x47')]:_0x24445a[_0x99e2('0x42')];if(_0x1e11c2[_0x99e2('0x44')][_0x99e2('0x50')]){_0xcbf2cd[_0x99e2('0x51')]=[{'all':!![]}];}_0xcbf2cd=_['merge']({},_0xcbf2cd,_0x1e11c2[_0x99e2('0x56')]);return db[_0x99e2('0x4f')][_0x99e2('0x57')](_0xcbf2cd)[_0x99e2('0x1f')](handleEntityNotFound(_0x397951,null))[_0x99e2('0x1f')](respondWithResult(_0x397951,null))[_0x99e2('0x29')](handleError(_0x397951,null));};exports['create']=function(_0x37798a,_0x274495){return db['OpenchannelMessage'][_0x99e2('0x58')](_0x37798a[_0x99e2('0x3a')],{})[_0x99e2('0x1f')](respondWithResult(_0x274495,0xc9))[_0x99e2('0x29')](handleError(_0x274495,null));};exports['update']=function(_0x27eedb,_0x5520b3){if(_0x27eedb[_0x99e2('0x3a')]['id']){delete _0x27eedb[_0x99e2('0x3a')]['id'];}return db[_0x99e2('0x4f')]['find']({'where':{'id':_0x27eedb['params']['id']}})[_0x99e2('0x1f')](handleEntityNotFound(_0x5520b3,null))[_0x99e2('0x1f')](saveUpdates(_0x27eedb[_0x99e2('0x3a')],null))['then'](respondWithResult(_0x5520b3,null))[_0x99e2('0x29')](handleError(_0x5520b3,null));};exports['destroy']=function(_0x40ad07,_0x279076){return db[_0x99e2('0x4f')]['find']({'where':{'id':_0x40ad07[_0x99e2('0x54')]['id']}})[_0x99e2('0x1f')](handleEntityNotFound(_0x279076,null))['then'](removeEntity(_0x279076,null))[_0x99e2('0x29')](handleError(_0x279076,null));};exports[_0x99e2('0x59')]=function(_0x3ae8cc,_0x26a1ef){return db[_0x99e2('0x4f')][_0x99e2('0x59')]()[_0x99e2('0x1f')](respondWithResult(_0x26a1ef,null))['catch'](handleError(_0x26a1ef,null));};var interaction_log=require('../../config/logger')(_0x99e2('0x5a'));exports[_0x99e2('0x5b')]=function(_0x555266,_0x5adf68,_0x5e9add){var _0x153889={'agent':{},'channel':_0x99e2('0x5c')};if(_0x555266['body']['id']){delete _0x555266['body']['id'];}_0x555266[_0x99e2('0x3a')]['read']=!![];_0x555266[_0x99e2('0x3a')][_0x99e2('0x5d')]=moment()[_0x99e2('0x5e')](_0x99e2('0x5f'));_0x555266[_0x99e2('0x3a')][_0x99e2('0x60')]=_0x555266[_0x99e2('0x3a')]['UserId']||_0x555266['user']['id'];_0x153889['agent']['id']=_0x555266['body'][_0x99e2('0x60')];return db[_0x99e2('0x4f')][_0x99e2('0x57')]({'where':{'id':_0x555266[_0x99e2('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x99e2('0x61')],'as':_0x99e2('0x62')}]})['then'](handleEntityNotFound(_0x5adf68,null))[_0x99e2('0x1f')](saveUpdates(_0x555266[_0x99e2('0x3a')],null))[_0x99e2('0x1f')](function(_0x3a15c0){if(_0x3a15c0){_0x153889['message']=_0x3a15c0[_0x99e2('0x63')]({'plain':!![]});return db[_0x99e2('0x64')][_0x99e2('0x57')]({'where':{'id':_0x3a15c0[_0x99e2('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5adf68,null))['then'](function(_0x597328){if(_0x597328){return _0x597328['update']({'UserId':_0x555266['body'][_0x99e2('0x60')],'read1stAt':_[_0x99e2('0x66')](_0x597328['read1stAt'])?moment()[_0x99e2('0x5e')](_0x99e2('0x5f')):undefined});}return null;})[_0x99e2('0x1f')](function(_0x198c97){if(_0x198c97){_0x153889['interaction']=_0x198c97[_0x99e2('0x63')]({'plain':!![]});interaction_log[_0x99e2('0x20')](_0x99e2('0x67'),_0x555266[_0x99e2('0x68')]['id'],_0x555266[_0x99e2('0x68')][_0x99e2('0x37')],_0x555266[_0x99e2('0x68')]['role'],_0x153889['interaction']['id'],_0x555266[_0x99e2('0x3a')]?JSON[_0x99e2('0x24')](_0x555266['body']):'null');return respondWithRpcPromise(_0x99e2('0x69'),_0x99e2('0x6a'),_0x153889);}return null;})[_0x99e2('0x1f')](function(_0x581be8){if(_0x581be8){if(_0x555266[_0x99e2('0x3a')][_0x99e2('0x6b')]){_0x153889[_0x99e2('0x26')]['interface']=util[_0x99e2('0x5e')](_0x99e2('0x6c'),_0x555266[_0x99e2('0x68')][_0x99e2('0x37')]);_0x153889[_0x99e2('0x26')][_0x99e2('0x6d')]=_0x153889['channel'];_0x153889[_0x99e2('0x26')][_0x99e2('0x6e')]=_0x99e2('0x5b');return respondWithRpcPromise('EventManager',_0x99e2('0x6f'),{'event':_0x99e2('0x70'),'message':_0x153889['message']},client9002)['then'](function(){return _0x153889;});}return _0x153889;}return null;})[_0x99e2('0x1f')](respondWithResult(_0x5adf68,null))[_0x99e2('0x29')](handleError(_0x5adf68,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['reject']=function(_0x222d00,_0x15f827,_0x337bb9){var _0x24edbd={'agent':{},'channel':_0x99e2('0x5c')};if(_0x222d00[_0x99e2('0x3a')]['id']){delete _0x222d00[_0x99e2('0x3a')]['id'];}_0x222d00[_0x99e2('0x3a')][_0x99e2('0x60')]=_0x222d00[_0x99e2('0x3a')][_0x99e2('0x60')]||_0x222d00[_0x99e2('0x68')]['id'];_0x24edbd[_0x99e2('0x3c')]['id']=_0x222d00['body'][_0x99e2('0x60')];return db[_0x99e2('0x4f')]['find']({'where':{'id':_0x222d00[_0x99e2('0x54')]['id'],'UserId':null}})[_0x99e2('0x1f')](handleEntityNotFound(_0x15f827,null))[_0x99e2('0x1f')](function(_0x5bed4c){if(_0x5bed4c){_0x24edbd['message']=_0x5bed4c['get']({'plain':!![]});return db[_0x99e2('0x64')]['find']({'where':{'id':_0x5bed4c[_0x99e2('0x65')]}});}return null;})[_0x99e2('0x1f')](handleEntityNotFound(_0x15f827,null))[_0x99e2('0x1f')](function(_0x2d414d){if(_0x2d414d){_0x24edbd[_0x99e2('0x3d')]=_0x2d414d[_0x99e2('0x63')]({'plain':!![]});interaction_log[_0x99e2('0x20')](_0x99e2('0x71'),_0x222d00['user']['id'],_0x222d00[_0x99e2('0x68')]['name'],_0x222d00['user'][_0x99e2('0x72')],_0x24edbd[_0x99e2('0x3d')]['id'],_0x222d00['body']?JSON[_0x99e2('0x24')](_0x222d00[_0x99e2('0x3a')]):'null');return respondWithRpcPromise(_0x99e2('0x73'),_0x99e2('0x74'),_0x24edbd);}return null;})[_0x99e2('0x1f')](function(_0x486db5){if(_0x486db5){_0x486db5[_0x99e2('0x26')]['interface']=util[_0x99e2('0x5e')]('SIP/%s',_0x222d00[_0x99e2('0x68')][_0x99e2('0x37')]);_0x486db5['message'][_0x99e2('0x6d')]=_0x24edbd[_0x99e2('0x6d')];_0x486db5[_0x99e2('0x26')][_0x99e2('0x6e')]=_0x99e2('0x34');respondWithRpcPromise(_0x99e2('0x6f'),_0x99e2('0x6f'),{'event':_0x99e2('0x75'),'message':_0x486db5[_0x99e2('0x26')]},client9002);return _0x24edbd;}return null;})[_0x99e2('0x1f')](respondWithResult(_0x15f827,null))['catch'](handleError(_0x15f827,null));}; \ No newline at end of file +var _0x2a77=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','register','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','name','render','merge','body','contact','agent','index','map','OpenchannelMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','openchannel-interactions','rejectMessage','channel','rejectmessage','eml-format','rimraf','zip-dir'];(function(_0x373b3f,_0x108b39){var _0x50fd65=function(_0x1f27cd){while(--_0x1f27cd){_0x373b3f['push'](_0x373b3f['shift']());}};_0x50fd65(++_0x108b39);}(_0x2a77,0x171));var _0x72a7=function(_0x44d797,_0x276017){_0x44d797=_0x44d797-0x0;var _0x4005c2=_0x2a77[_0x44d797];return _0x4005c2;};'use strict';var emlformat=require(_0x72a7('0x0'));var rimraf=require(_0x72a7('0x1'));var zipdir=require(_0x72a7('0x2'));var jsonpatch=require(_0x72a7('0x3'));var rp=require(_0x72a7('0x4'));var moment=require(_0x72a7('0x5'));var BPromise=require(_0x72a7('0x6'));var Mustache=require(_0x72a7('0x7'));var util=require(_0x72a7('0x8'));var path=require(_0x72a7('0x9'));var sox=require(_0x72a7('0xa'));var csv=require(_0x72a7('0xb'));var ejs=require(_0x72a7('0xc'));var fs=require('fs');var fs_extra=require(_0x72a7('0xd'));var _=require('lodash');var squel=require(_0x72a7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x72a7('0xb'));var querystring=require(_0x72a7('0xf'));var Papa=require(_0x72a7('0x10'));var Redis=require(_0x72a7('0x11'));var authService=require(_0x72a7('0x12'));var qs=require(_0x72a7('0x13'));var as=require(_0x72a7('0x14'));var hardwareService=require(_0x72a7('0x15'));var logger=require(_0x72a7('0x16'))(_0x72a7('0x17'));var utils=require('../../config/utils');var config=require(_0x72a7('0x18'));var licenseUtil=require(_0x72a7('0x19'));var db=require(_0x72a7('0x1a'))['db'];config['redis']=_[_0x72a7('0x1b')](config['redis'],{'host':_0x72a7('0x1c'),'port':0x18eb});var socket=require(_0x72a7('0x1d'))(new Redis(config[_0x72a7('0x1e')]));require(_0x72a7('0x1f'))[_0x72a7('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x72a7('0x21')][_0x72a7('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1dac88,_0x5bceaf,_0xe60baa,_0xad9d08){return new BPromise(function(_0xdc453d,_0x1fd89d){var _0xad691a=_0xad9d08||client;return _0xad691a[_0x72a7('0x23')](_0x1dac88,_0xe60baa)['then'](function(_0x5f8d06){logger[_0x72a7('0x24')](_0x72a7('0x25'),_0x5bceaf,_0x72a7('0x26'));logger[_0x72a7('0x27')](_0x72a7('0x28'),_0x5bceaf,_0x72a7('0x26'),JSON[_0x72a7('0x29')](_0x5f8d06));if(_0x5f8d06[_0x72a7('0x2a')]){if(_0x5f8d06['error'][_0x72a7('0x2b')]===0x1f4){logger['error'](_0x72a7('0x25'),_0x5bceaf,_0x5f8d06[_0x72a7('0x2a')][_0x72a7('0x2c')]);return _0x1fd89d(_0x5f8d06[_0x72a7('0x2a')][_0x72a7('0x2c')]);}logger[_0x72a7('0x2a')]('OpenchannelMessage,\x20%s,\x20%s',_0x5bceaf,_0x5f8d06['error'][_0x72a7('0x2c')]);return _0xdc453d(_0x5f8d06[_0x72a7('0x2a')][_0x72a7('0x2c')]);}else{logger['info'](_0x72a7('0x25'),_0x5bceaf,'request\x20sent');_0xdc453d(_0x5f8d06[_0x72a7('0x2d')][_0x72a7('0x2c')]);}})[_0x72a7('0x2e')](function(_0x454a8f){logger[_0x72a7('0x2a')](_0x72a7('0x25'),_0x5bceaf,_0x454a8f);_0x1fd89d(_0x454a8f);});});}function respondWithStatusCode(_0x560c6f,_0x107e76){_0x107e76=_0x107e76||0xcc;return function(_0x286467){if(_0x286467){return _0x560c6f[_0x72a7('0x2f')](_0x107e76);}return _0x560c6f[_0x72a7('0x30')](_0x107e76)[_0x72a7('0x31')]();};}function respondWithResult(_0x58fc78,_0x8ba33d){_0x8ba33d=_0x8ba33d||0xc8;return function(_0x56185e){if(_0x56185e){return _0x58fc78[_0x72a7('0x30')](_0x8ba33d)[_0x72a7('0x32')](_0x56185e);}};}function respondWithFilteredResult(_0x11ea16,_0x382d3c){return function(_0x360592){if(_0x360592){var _0x309bca=typeof _0x382d3c[_0x72a7('0x33')]===_0x72a7('0x34')&&typeof _0x382d3c[_0x72a7('0x35')]===_0x72a7('0x34');var _0x370137=_0x360592['count'];var _0x46019c=_0x309bca?0x0:_0x382d3c['offset'];var _0x171c50=_0x309bca?_0x360592[_0x72a7('0x36')]:_0x382d3c[_0x72a7('0x33')]+_0x382d3c[_0x72a7('0x35')];var _0x269786;if(_0x171c50>=_0x370137){_0x171c50=_0x370137;_0x269786=0xc8;}else{_0x269786=0xce;}_0x11ea16[_0x72a7('0x30')](_0x269786);return _0x11ea16['set'](_0x72a7('0x37'),_0x46019c+'-'+_0x171c50+'/'+_0x370137)[_0x72a7('0x32')](_0x360592);}return null;};}function patchUpdates(_0x29d169){return function(_0xa362d){try{jsonpatch['apply'](_0xa362d,_0x29d169,!![]);}catch(_0x5272cf){return BPromise[_0x72a7('0x38')](_0x5272cf);}return _0xa362d['save']();};}function saveUpdates(_0x3fd955,_0x3ca78b){return function(_0x367144){if(_0x367144){return _0x367144[_0x72a7('0x39')](_0x3fd955)[_0x72a7('0x3a')](function(_0x159c1f){return _0x159c1f;});}return null;};}function removeEntity(_0x48e180,_0x47d92b){return function(_0x42d240){if(_0x42d240){return _0x42d240[_0x72a7('0x3b')]()['then'](function(){_0x48e180[_0x72a7('0x30')](0xcc)[_0x72a7('0x31')]();});}};}function handleEntityNotFound(_0x2c42f2,_0x40acdd){return function(_0x1e289d){if(!_0x1e289d){_0x2c42f2[_0x72a7('0x2f')](0x194);}return _0x1e289d;};}function handleError(_0x23e08e,_0x217176){_0x217176=_0x217176||0x1f4;return function(_0x43891e){logger[_0x72a7('0x2a')](_0x43891e['stack']);if(_0x43891e[_0x72a7('0x3c')]){delete _0x43891e['name'];}_0x23e08e[_0x72a7('0x30')](_0x217176)['send'](_0x43891e);};}function getMustacheRender(_0x224f39,_0x472171){return Mustache[_0x72a7('0x3d')](_0x224f39,_[_0x72a7('0x3e')](_0x472171[_0x72a7('0x3f')],{'contact':_0x472171[_0x72a7('0x40')],'message':_0x472171[_0x72a7('0x2c')],'agent':_0x472171[_0x72a7('0x41')],'interaction':_0x472171['interaction'],'account':_0x472171['account']}))||'';}exports[_0x72a7('0x42')]=function(_0x4ef021,_0x5de238){var _0x2293f3={},_0x2d8486={},_0x7576fa={'count':0x0,'rows':[]};var _0x22a4af=_[_0x72a7('0x43')](db[_0x72a7('0x44')][_0x72a7('0x45')],function(_0x211db){return{'name':_0x211db[_0x72a7('0x46')],'type':_0x211db['type']['key']};});_0x2d8486['model']=_[_0x72a7('0x43')](_0x22a4af,'name');_0x2d8486[_0x72a7('0x47')]=_[_0x72a7('0x48')](_0x4ef021[_0x72a7('0x47')]);_0x2d8486[_0x72a7('0x49')]=_[_0x72a7('0x4a')](_0x2d8486[_0x72a7('0x4b')],_0x2d8486[_0x72a7('0x47')]);_0x2293f3[_0x72a7('0x4c')]=_[_0x72a7('0x4a')](_0x2d8486[_0x72a7('0x4b')],qs['fields'](_0x4ef021['query']['fields']));_0x2293f3[_0x72a7('0x4c')]=_0x2293f3[_0x72a7('0x4c')][_0x72a7('0x4d')]?_0x2293f3[_0x72a7('0x4c')]:_0x2d8486[_0x72a7('0x4b')];if(!_0x4ef021[_0x72a7('0x47')][_0x72a7('0x4e')]('nolimit')){_0x2293f3[_0x72a7('0x35')]=qs[_0x72a7('0x35')](_0x4ef021[_0x72a7('0x47')][_0x72a7('0x35')]);_0x2293f3[_0x72a7('0x33')]=qs[_0x72a7('0x33')](_0x4ef021[_0x72a7('0x47')]['offset']);}_0x2293f3[_0x72a7('0x4f')]=qs['sort'](_0x4ef021[_0x72a7('0x47')][_0x72a7('0x50')]);_0x2293f3[_0x72a7('0x51')]=qs[_0x72a7('0x49')](_['pick'](_0x4ef021[_0x72a7('0x47')],_0x2d8486[_0x72a7('0x49')]),_0x22a4af);if(_0x4ef021[_0x72a7('0x47')][_0x72a7('0x52')]){_0x2293f3['where']=_[_0x72a7('0x3e')](_0x2293f3['where'],{'$or':_[_0x72a7('0x43')](_0x22a4af,function(_0x39f7c1){if(_0x39f7c1['type']!==_0x72a7('0x53')){var _0x4f3160={};_0x4f3160[_0x39f7c1[_0x72a7('0x3c')]]={'$like':'%'+_0x4ef021[_0x72a7('0x47')]['filter']+'%'};return _0x4f3160;}})});}_0x2293f3=_['merge']({},_0x2293f3,_0x4ef021[_0x72a7('0x54')]);var _0x3d0319={'where':_0x2293f3['where']};return db[_0x72a7('0x44')][_0x72a7('0x36')](_0x3d0319)[_0x72a7('0x3a')](function(_0x4a88f5){_0x7576fa[_0x72a7('0x36')]=_0x4a88f5;if(_0x4ef021[_0x72a7('0x47')][_0x72a7('0x55')]){_0x2293f3[_0x72a7('0x56')]=[{'all':!![]}];}return db[_0x72a7('0x44')][_0x72a7('0x57')](_0x2293f3);})[_0x72a7('0x3a')](function(_0x18b6f0){_0x7576fa[_0x72a7('0x58')]=_0x18b6f0;return _0x7576fa;})[_0x72a7('0x3a')](respondWithFilteredResult(_0x5de238,_0x2293f3))[_0x72a7('0x2e')](handleError(_0x5de238,null));};exports[_0x72a7('0x59')]=function(_0x3e7cdd,_0x169247){var _0x3eee51={'raw':!![],'where':{'id':_0x3e7cdd[_0x72a7('0x5a')]['id']}},_0x1d96da={};_0x1d96da['model']=_['keys'](db[_0x72a7('0x44')][_0x72a7('0x45')]);_0x1d96da[_0x72a7('0x47')]=_[_0x72a7('0x48')](_0x3e7cdd[_0x72a7('0x47')]);_0x1d96da[_0x72a7('0x49')]=_[_0x72a7('0x4a')](_0x1d96da['model'],_0x1d96da[_0x72a7('0x47')]);_0x3eee51[_0x72a7('0x4c')]=_[_0x72a7('0x4a')](_0x1d96da['model'],qs['fields'](_0x3e7cdd[_0x72a7('0x47')][_0x72a7('0x5b')]));_0x3eee51[_0x72a7('0x4c')]=_0x3eee51[_0x72a7('0x4c')][_0x72a7('0x4d')]?_0x3eee51[_0x72a7('0x4c')]:_0x1d96da[_0x72a7('0x4b')];if(_0x3e7cdd[_0x72a7('0x47')][_0x72a7('0x55')]){_0x3eee51[_0x72a7('0x56')]=[{'all':!![]}];}_0x3eee51=_['merge']({},_0x3eee51,_0x3e7cdd[_0x72a7('0x54')]);return db['OpenchannelMessage'][_0x72a7('0x5c')](_0x3eee51)[_0x72a7('0x3a')](handleEntityNotFound(_0x169247,null))[_0x72a7('0x3a')](respondWithResult(_0x169247,null))[_0x72a7('0x2e')](handleError(_0x169247,null));};exports[_0x72a7('0x5d')]=function(_0x53f148,_0x171427){return db['OpenchannelMessage'][_0x72a7('0x5d')](_0x53f148[_0x72a7('0x3f')],{})[_0x72a7('0x3a')](respondWithResult(_0x171427,0xc9))[_0x72a7('0x2e')](handleError(_0x171427,null));};exports['update']=function(_0x10b488,_0x51c496){if(_0x10b488[_0x72a7('0x3f')]['id']){delete _0x10b488[_0x72a7('0x3f')]['id'];}return db[_0x72a7('0x44')][_0x72a7('0x5c')]({'where':{'id':_0x10b488[_0x72a7('0x5a')]['id']}})[_0x72a7('0x3a')](handleEntityNotFound(_0x51c496,null))[_0x72a7('0x3a')](saveUpdates(_0x10b488[_0x72a7('0x3f')],null))['then'](respondWithResult(_0x51c496,null))[_0x72a7('0x2e')](handleError(_0x51c496,null));};exports['destroy']=function(_0x235ecc,_0x4dddcd){return db[_0x72a7('0x44')][_0x72a7('0x5c')]({'where':{'id':_0x235ecc[_0x72a7('0x5a')]['id']}})[_0x72a7('0x3a')](handleEntityNotFound(_0x4dddcd,null))[_0x72a7('0x3a')](removeEntity(_0x4dddcd,null))['catch'](handleError(_0x4dddcd,null));};exports['describe']=function(_0x42166d,_0x5d35c7){return db[_0x72a7('0x44')][_0x72a7('0x5e')]()[_0x72a7('0x3a')](respondWithResult(_0x5d35c7,null))[_0x72a7('0x2e')](handleError(_0x5d35c7,null));};var interaction_log=require(_0x72a7('0x16'))('openchannel-interactions');exports[_0x72a7('0x5f')]=function(_0x2b7887,_0x5a7c75,_0x1b37fe){var _0x5deae1={'agent':{},'channel':_0x72a7('0x60')};if(_0x2b7887['body']['id']){delete _0x2b7887[_0x72a7('0x3f')]['id'];}_0x2b7887[_0x72a7('0x3f')][_0x72a7('0x61')]=!![];_0x2b7887[_0x72a7('0x3f')][_0x72a7('0x62')]=moment()[_0x72a7('0x63')](_0x72a7('0x64'));_0x2b7887['body'][_0x72a7('0x65')]=_0x2b7887[_0x72a7('0x3f')][_0x72a7('0x65')]||_0x2b7887[_0x72a7('0x66')]['id'];_0x5deae1[_0x72a7('0x41')]['id']=_0x2b7887[_0x72a7('0x3f')][_0x72a7('0x65')];return db[_0x72a7('0x44')][_0x72a7('0x5c')]({'where':{'id':_0x2b7887[_0x72a7('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x72a7('0x67')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x5a7c75,null))[_0x72a7('0x3a')](saveUpdates(_0x2b7887[_0x72a7('0x3f')],null))[_0x72a7('0x3a')](function(_0x1e09c4){if(_0x1e09c4){_0x5deae1[_0x72a7('0x2c')]=_0x1e09c4[_0x72a7('0x68')]({'plain':!![]});return db[_0x72a7('0x69')]['find']({'where':{'id':_0x1e09c4[_0x72a7('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x5a7c75,null))['then'](function(_0x2ebfc5){if(_0x2ebfc5){return _0x2ebfc5[_0x72a7('0x39')]({'UserId':_0x2b7887[_0x72a7('0x3f')][_0x72a7('0x65')],'read1stAt':_[_0x72a7('0x6b')](_0x2ebfc5['read1stAt'])?moment()['format'](_0x72a7('0x64')):undefined});}return null;})['then'](function(_0x39587a){if(_0x39587a){_0x5deae1[_0x72a7('0x6c')]=_0x39587a['get']({'plain':!![]});interaction_log[_0x72a7('0x24')](_0x72a7('0x6d'),_0x2b7887['user']['id'],_0x2b7887['user'][_0x72a7('0x3c')],_0x2b7887[_0x72a7('0x66')][_0x72a7('0x6e')],_0x5deae1[_0x72a7('0x6c')]['id'],_0x2b7887['body']?JSON['stringify'](_0x2b7887['body']):_0x72a7('0x6f'));return respondWithRpcPromise(_0x72a7('0x70'),_0x72a7('0x71'),_0x5deae1);}return null;})[_0x72a7('0x3a')](function(_0x156638){if(_0x156638){if(_0x2b7887[_0x72a7('0x3f')][_0x72a7('0x72')]){_0x5deae1['message'][_0x72a7('0x73')]=util[_0x72a7('0x63')](_0x72a7('0x74'),_0x2b7887['user'][_0x72a7('0x3c')]);_0x5deae1[_0x72a7('0x2c')]['channel']=_0x5deae1['channel'];_0x5deae1['message'][_0x72a7('0x75')]=_0x72a7('0x5f');return respondWithRpcPromise(_0x72a7('0x76'),'EventManager',{'event':_0x72a7('0x77'),'message':_0x5deae1[_0x72a7('0x2c')]},client9002)['then'](function(){return _0x5deae1;});}return _0x5deae1;}return null;})[_0x72a7('0x3a')](respondWithResult(_0x5a7c75,null))[_0x72a7('0x2e')](handleError(_0x5a7c75,null));};var interaction_log=require(_0x72a7('0x16'))(_0x72a7('0x78'));exports[_0x72a7('0x38')]=function(_0x180ddc,_0x262b21,_0xea8d9f){var _0x55467e={'agent':{},'channel':_0x72a7('0x60')};if(_0x180ddc[_0x72a7('0x3f')]['id']){delete _0x180ddc['body']['id'];}_0x180ddc[_0x72a7('0x3f')][_0x72a7('0x65')]=_0x180ddc[_0x72a7('0x3f')][_0x72a7('0x65')]||_0x180ddc[_0x72a7('0x66')]['id'];_0x55467e[_0x72a7('0x41')]['id']=_0x180ddc['body'][_0x72a7('0x65')];return db[_0x72a7('0x44')][_0x72a7('0x5c')]({'where':{'id':_0x180ddc[_0x72a7('0x5a')]['id'],'UserId':null}})[_0x72a7('0x3a')](handleEntityNotFound(_0x262b21,null))['then'](function(_0x520aae){if(_0x520aae){_0x55467e['message']=_0x520aae['get']({'plain':!![]});return db[_0x72a7('0x69')][_0x72a7('0x5c')]({'where':{'id':_0x520aae[_0x72a7('0x6a')]}});}return null;})[_0x72a7('0x3a')](handleEntityNotFound(_0x262b21,null))['then'](function(_0x3f9eae){if(_0x3f9eae){_0x55467e[_0x72a7('0x6c')]=_0x3f9eae[_0x72a7('0x68')]({'plain':!![]});interaction_log[_0x72a7('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x180ddc[_0x72a7('0x66')]['id'],_0x180ddc['user'][_0x72a7('0x3c')],_0x180ddc[_0x72a7('0x66')]['role'],_0x55467e['interaction']['id'],_0x180ddc['body']?JSON[_0x72a7('0x29')](_0x180ddc[_0x72a7('0x3f')]):'null');return respondWithRpcPromise('RejectMessage',_0x72a7('0x79'),_0x55467e);}return null;})[_0x72a7('0x3a')](function(_0x108aba){if(_0x108aba){_0x108aba[_0x72a7('0x2c')]['interface']=util[_0x72a7('0x63')](_0x72a7('0x74'),_0x180ddc['user'][_0x72a7('0x3c')]);_0x108aba[_0x72a7('0x2c')][_0x72a7('0x7a')]=_0x55467e[_0x72a7('0x7a')];_0x108aba['message'][_0x72a7('0x75')]=_0x72a7('0x38');respondWithRpcPromise(_0x72a7('0x76'),'EventManager',{'event':_0x72a7('0x7b'),'message':_0x108aba[_0x72a7('0x2c')]},client9002);return _0x55467e;}return null;})[_0x72a7('0x3a')](respondWithResult(_0x262b21,null))['catch'](handleError(_0x262b21,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index cae0cc5..1a0aaf0 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x305c=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x20a712,_0x592e7f){var _0x4f38f8=function(_0x458b16){while(--_0x458b16){_0x20a712['push'](_0x20a712['shift']());}};_0x4f38f8(++_0x592e7f);}(_0x305c,0x8f));var _0xc305=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0x305c[_0x44474f];return _0x427d97;};'use strict';var EventEmitter=require(_0xc305('0x0'));var OpenchannelMessage=require(_0xc305('0x1'))['db'][_0xc305('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc305('0x3')](0x0);var events={'afterCreate':_0xc305('0x4'),'afterUpdate':_0xc305('0x5'),'afterDestroy':'remove'};function emitEvent(_0x16ab9c){return function(_0x4094fa,_0x2b3077,_0x1d1d14){OpenchannelMessageEvents['emit'](_0x16ab9c+':'+_0x4094fa['id'],_0x4094fa);OpenchannelMessageEvents[_0xc305('0x6')](_0x16ab9c,_0x4094fa);_0x1d1d14(null);};}for(var e in events){if(events[_0xc305('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc305('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1f0a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','OpenchannelMessage'];(function(_0x460358,_0x354877){var _0xdfdfa8=function(_0x4cc317){while(--_0x4cc317){_0x460358['push'](_0x460358['shift']());}};_0xdfdfa8(++_0x354877);}(_0x1f0a,0xa0));var _0xa1f0=function(_0x2a1b68,_0x5ded42){_0x2a1b68=_0x2a1b68-0x0;var _0x526c10=_0x1f0a[_0x2a1b68];return _0x526c10;};'use strict';var EventEmitter=require(_0xa1f0('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xa1f0('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa1f0('0x2')](0x0);var events={'afterCreate':_0xa1f0('0x3'),'afterUpdate':_0xa1f0('0x4'),'afterDestroy':_0xa1f0('0x5')};function emitEvent(_0x1d02f7){return function(_0x2838d2,_0x58a4f8,_0x38b214){OpenchannelMessageEvents[_0xa1f0('0x6')](_0x1d02f7+':'+_0x2838d2['id'],_0x2838d2);OpenchannelMessageEvents[_0xa1f0('0x6')](_0x1d02f7,_0x2838d2);_0x38b214(null);};}for(var e in events){if(events[_0xa1f0('0x7')](e)){var event=events[e];OpenchannelMessage[_0xa1f0('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index eba4b28..b3a4b94 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5711=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','findOne','OpenchannelInteractionId','then','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','POST','method','GET','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','finally','utf8mb4','lodash','util'];(function(_0x21c988,_0x56fdf3){var _0xe16599=function(_0x5b4a35){while(--_0x5b4a35){_0x21c988['push'](_0x21c988['shift']());}};_0xe16599(++_0x56fdf3);}(_0x5711,0x186));var _0x1571=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x5711[_0x173452];return _0xee3fd0;};'use strict';var _=require(_0x1571('0x0'));var util=require(_0x1571('0x1'));var logger=require(_0x1571('0x2'))(_0x1571('0x3'));var moment=require('moment');var BPromise=require(_0x1571('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1571('0x5'));var rimraf=require(_0x1571('0x6'));var config=require(_0x1571('0x7'));var attributes=require(_0x1571('0x8'));module['exports']=function(_0x41ab85,_0x5e0a5e){return _0x41ab85['define'](_0x1571('0x9'),attributes,{'tableName':_0x1571('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1571('0xb')],'type':_0x1571('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf025b9,_0x434ac3,_0x4b0910){var _0x569f7c=_0x41ab85[_0x1571('0xd')];var _0x174809=_0xf025b9[_0x1571('0xe')]({'plain':!![]});if(_0x174809['direction'][_0x1571('0xf')]()==='in'||_0x174809[_0x1571('0x10')][_0x1571('0xf')]()===_0x1571('0x11')&&!_0x174809[_0x1571('0x12')]&&!_['isNil'](_0x174809[_0x1571('0x13')])){_0x569f7c['OpenchannelInteraction'][_0x1571('0x14')]({'where':{'id':_0x174809[_0x1571('0x15')]}})[_0x1571('0x16')](function(_0x22f215){if(_0x22f215){_0x22f215['update']({'lastMsgAt':_0x174809[_0x1571('0x17')],'lastMsgDirection':_0x174809[_0x1571('0x10')][_0x1571('0xf')]()});}})['catch'](function(_0x522bdc){console[_0x1571('0x18')](_0x522bdc);});}if(_0x174809['direction']===_0x1571('0x11')&&!_0x174809['secret']){var _0x59b63c;_0x569f7c[_0x1571('0x19')][_0x1571('0x1a')]()[_0x1571('0x16')](function(_0x493e91){return _0x569f7c[_0x1571('0x1b')][_0x1571('0x1c')]({'where':{'id':_0x174809[_0x1571('0x1d')]},'include':[{'model':_0x569f7c[_0x1571('0x1e')],'as':_0x1571('0x1f'),'where':{'id':_0x174809['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x569f7c[_0x1571('0x19')],'as':_0x1571('0x20'),'attributes':_[_0x1571('0x21')](_0x493e91)}]}]});})[_0x1571('0x16')](function(_0x59dea5){_0x59b63c=_0x59dea5[_0x1571('0xe')]({'plain':!![]});if(_0x59b63c&&_0x59b63c[_0x1571('0x22')]){logger['info'](_0x1571('0x23'),_0x1571('0x24'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x174809['id'],_0x59b63c[_0x1571('0x22')]));if(_0x59b63c[_0x1571('0x1f')]&&_0x59b63c[_0x1571('0x1f')][_0x1571('0x25')]){_0x174809[_0x1571('0x26')]=_['omit'](_0x59b63c[_0x1571('0x1f')][0x0],_0x1571('0x20'));_0x174809['Contact']=_0x59b63c[_0x1571('0x1f')][0x0][_0x1571('0x20')];}var _0x434ac3={'method':_0x1571('0x27'),'uri':encodeURI(_0x59b63c[_0x1571('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x434ac3[_0x1571('0x28')]){case _0x1571('0x29'):_0x434ac3['qs']=_0x174809;break;case _0x1571('0x27'):_0x434ac3[_0x1571('0xb')]=_0x174809;break;}return rp(_0x434ac3)['then'](function(_0x12555c){logger[_0x1571('0x2a')](_0x1571('0x23'),'afterCreate',util[_0x1571('0x2b')](_0x1571('0x2c'),_0x174809['id'],_0x59b63c[_0x1571('0x22')]));if(_0x12555c[_0x1571('0xb')]['threadId']&&_0x12555c[_0x1571('0xb')][_0x1571('0x2d')]!=_0x174809[_0x1571('0x26')][_0x1571('0x2d')]){return _0x569f7c['OpenchannelInteraction']['update']({'threadId':_0x12555c['body']['threadId']},{'logging':!![],'where':{'id':_0x174809[_0x1571('0x26')]['id']}});}else{return;}})['then'](function(){return _0xf025b9[_0x1571('0x2e')]({'read':!![]});})['catch'](function(_0x49050f){logger[_0x1571('0x18')](_0x1571('0x23'),'afterCreate',util['inspect'](_0x49050f,{'showHidden':![],'depth':null}));_0x4b0910();});}else{_0x4b0910();}})[_0x1571('0x2f')](function(){_0x4b0910();});}else{_0x4b0910();}}},'charset':_0x1571('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x10c3=['format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','Contact','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','update','catch','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x10c3,0x146));var _0x310c=function(_0xb97169,_0x5db768){_0xb97169=_0xb97169-0x0;var _0xe836ea=_0x10c3[_0xb97169];return _0xe836ea;};'use strict';var _=require(_0x310c('0x0'));var util=require(_0x310c('0x1'));var logger=require(_0x310c('0x2'))(_0x310c('0x3'));var moment=require(_0x310c('0x4'));var BPromise=require(_0x310c('0x5'));var rp=require(_0x310c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x310c('0x7'));var config=require(_0x310c('0x8'));var attributes=require(_0x310c('0x9'));module[_0x310c('0xa')]=function(_0x4401e9,_0x1d629f){return _0x4401e9['define'](_0x310c('0xb'),attributes,{'tableName':_0x310c('0xc'),'paranoid':![],'indexes':[{'name':_0x310c('0xd'),'fields':[_0x310c('0xe')],'type':_0x310c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x276f6b,_0x3c72a1,_0x36a48e){var _0x3fa554=_0x4401e9[_0x310c('0x10')];var _0x3a045b=_0x276f6b['get']({'plain':!![]});if(_0x3a045b['direction'][_0x310c('0x11')]()==='in'||_0x3a045b[_0x310c('0x12')][_0x310c('0x11')]()===_0x310c('0x13')&&!_0x3a045b[_0x310c('0x14')]&&!_[_0x310c('0x15')](_0x3a045b['UserId'])){_0x3fa554[_0x310c('0x16')]['findOne']({'where':{'id':_0x3a045b[_0x310c('0x17')]}})['then'](function(_0x25dda1){if(_0x25dda1){_0x25dda1[_0x310c('0x18')]({'lastMsgAt':_0x3a045b['createdAt'],'lastMsgDirection':_0x3a045b[_0x310c('0x12')][_0x310c('0x11')]()});}})[_0x310c('0x19')](function(_0x56d9aa){console['error'](_0x56d9aa);});}if(_0x3a045b[_0x310c('0x12')]===_0x310c('0x13')&&!_0x3a045b[_0x310c('0x14')]){var _0x5149ad;_0x3fa554[_0x310c('0x1a')][_0x310c('0x1b')]()[_0x310c('0x1c')](function(_0x6c7ef2){return _0x3fa554[_0x310c('0x1d')][_0x310c('0x1e')]({'where':{'id':_0x3a045b[_0x310c('0x1f')]},'include':[{'model':_0x3fa554[_0x310c('0x16')],'as':'Interactions','where':{'id':_0x3a045b[_0x310c('0x17')]},'limit':0x1,'include':[{'model':_0x3fa554[_0x310c('0x1a')],'as':'Contact','attributes':_[_0x310c('0x20')](_0x6c7ef2)}]}]});})[_0x310c('0x1c')](function(_0x9f44f3){_0x5149ad=_0x9f44f3[_0x310c('0x21')]({'plain':!![]});if(_0x5149ad&&_0x5149ad[_0x310c('0x22')]){logger[_0x310c('0x23')](_0x310c('0x24'),_0x310c('0x25'),util[_0x310c('0x26')](_0x310c('0x27'),_0x3a045b['id'],_0x5149ad[_0x310c('0x22')]));if(_0x5149ad['Interactions']&&_0x5149ad[_0x310c('0x28')][_0x310c('0x29')]){_0x3a045b[_0x310c('0x2a')]=_['omit'](_0x5149ad[_0x310c('0x28')][0x0],_0x310c('0x2b'));_0x3a045b['Contact']=_0x5149ad[_0x310c('0x28')][0x0][_0x310c('0x2b')];}var _0x3c72a1={'method':_0x310c('0x2c'),'uri':encodeURI(_0x5149ad[_0x310c('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3c72a1[_0x310c('0x2d')]){case _0x310c('0x2e'):_0x3c72a1['qs']=_0x3a045b;break;case'POST':_0x3c72a1[_0x310c('0xe')]=_0x3a045b;break;}return rp(_0x3c72a1)['then'](function(_0x217791){logger[_0x310c('0x23')](_0x310c('0x24'),'afterCreate',util[_0x310c('0x26')](_0x310c('0x2f'),_0x3a045b['id'],_0x5149ad['replyUri']));if(_0x217791[_0x310c('0xe')][_0x310c('0x30')]&&_0x217791[_0x310c('0xe')][_0x310c('0x30')]!=_0x3a045b[_0x310c('0x2a')][_0x310c('0x30')]){return _0x3fa554['OpenchannelInteraction'][_0x310c('0x18')]({'threadId':_0x217791['body'][_0x310c('0x30')]},{'logging':!![],'where':{'id':_0x3a045b[_0x310c('0x2a')]['id']}});}else{return;}})[_0x310c('0x1c')](function(){return _0x276f6b[_0x310c('0x18')]({'read':!![]});})['catch'](function(_0x1cf98f){logger[_0x310c('0x31')](_0x310c('0x24'),_0x310c('0x25'),util['inspect'](_0x1cf98f,{'showHidden':![],'depth':null}));_0x36a48e();});}else{_0x36a48e();}})[_0x310c('0x32')](function(){_0x36a48e();});}else{_0x36a48e();}}},'charset':_0x310c('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index cac388c..cbe52c6 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x29696a,_0x504c71){var _0x1cb7fd=function(_0x1d0f2c){while(--_0x1d0f2c){_0x29696a['push'](_0x29696a['shift']());}};_0x1cb7fd(++_0x504c71);}(_0xb10b,0x12a));var _0xbb10=function(_0x159f91,_0xe8a30f){_0x159f91=_0x159f91-0x0;var _0x26bd65=_0xb10b[_0x159f91];return _0x26bd65;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x37e675,_0x3ea058){var _0x58631a=function(_0x51c6ed){while(--_0x51c6ed){_0x37e675['push'](_0x37e675['shift']());}};_0x58631a(++_0x3ea058);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index cb7948f..c1ec972 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x278b05,_0x34779d){var _0x162002=function(_0x2dc367){while(--_0x2dc367){_0x278b05['push'](_0x278b05['shift']());}};_0x162002(++_0x34779d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4895eb,_0x21a482){_0x4895eb=_0x4895eb-0x0;var _0x80a6cf=_0xf4eb[_0x4895eb];return _0x80a6cf;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file +var _0x9bde=['openchannelMessage:','save','update','emit','removeListener','register','length'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x9bde,0xe1));var _0xe9bd=function(_0x501d88,_0x2bd489){_0x501d88=_0x501d88-0x0;var _0x291be5=_0x9bde[_0x501d88];return _0x291be5;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelMessageEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelMessageEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 53a70df..08f2a9c 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x2304e5,_0x1697c0){var _0x5ed68d=function(_0x37ac62){while(--_0x37ac62){_0x2304e5['push'](_0x2304e5['shift']());}};_0x5ed68d(++_0x1697c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['post','create','/:id/teams','addTeams','put','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','show','/:id/members','isAuthenticated','getMembers','/:id/users','getAgents'];(function(_0x4f0245,_0xd442cd){var _0xc2a770=function(_0x5322f6){while(--_0x5322f6){_0x4f0245['push'](_0x4f0245['shift']());}};_0xc2a770(++_0xd442cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['post'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x11')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller['addAgents']);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0xd')](),controller['update']);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth['isAuthenticated'](),controller[_0x0a9e('0x18')]);router['delete'](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);module[_0x0a9e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 594a887..3e71c5b 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd641=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x488c7b,_0x2a7949){var _0x6c5f=function(_0x6fce0d){while(--_0x6fce0d){_0x488c7b['push'](_0x488c7b['shift']());}};_0x6c5f(++_0x2a7949);}(_0xd641,0xd9));var _0x1d64=function(_0x3fdacc,_0x5a7391){_0x3fdacc=_0x3fdacc-0x0;var _0x2ca837=_0xd641[_0x3fdacc];return _0x2ca837;};'use strict';var Sequelize=require(_0x1d64('0x0'));module[_0x1d64('0x1')]={'name':{'type':Sequelize[_0x1d64('0x2')],'unique':_0x1d64('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1d64('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d64('0x5')]('rrmemory',_0x1d64('0x6'),_0x1d64('0x7'))}}; \ No newline at end of file +var _0x7804=['sequelize','STRING','name','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7804,0xc3));var _0x4780=function(_0x24d43a,_0x403b0d){_0x24d43a=_0x24d43a-0x0;var _0x4c3fe4=_0x7804[_0x24d43a];return _0x4c3fe4;};'use strict';var Sequelize=require(_0x4780('0x0'));module['exports']={'name':{'type':Sequelize[_0x4780('0x1')],'unique':_0x4780('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4780('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4780('0x3')](_0x4780('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 097ab7d..7eaba47 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbe1=['all','union','value','transaction','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','rimraf','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','name','send','body','message','agent','account','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','rows','catch','show','params','include','options','create','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','nolimit','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','updatedAt','format','%s/%s','SIP','openchannelPause','findOne','Team','getTeams','addTeams','ids','Agents','interface','flatMap','sequelize','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','every','TeamId'];(function(_0xd1f33c,_0x4bc953){var _0x518316=function(_0x538db8){while(--_0x538db8){_0xd1f33c['push'](_0xd1f33c['shift']());}};_0x518316(++_0x4bc953);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xcbe1[_0x138f59];return _0x3d114d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cbe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cbe('0x1'));var Mustache=require(_0x1cbe('0x2'));var util=require('util');var path=require(_0x1cbe('0x3'));var sox=require('sox');var csv=require(_0x1cbe('0x4'));var ejs=require(_0x1cbe('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1cbe('0x6'));var squel=require(_0x1cbe('0x7'));var crypto=require(_0x1cbe('0x8'));var jsforce=require(_0x1cbe('0x9'));var deskjs=require(_0x1cbe('0xa'));var toCsv=require(_0x1cbe('0x4'));var querystring=require(_0x1cbe('0xb'));var Papa=require(_0x1cbe('0xc'));var Redis=require('ioredis');var authService=require(_0x1cbe('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1cbe('0xe'));var hardwareService=require(_0x1cbe('0xf'));var logger=require(_0x1cbe('0x10'))(_0x1cbe('0x11'));var utils=require('../../config/utils');var config=require(_0x1cbe('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cbe('0x13'))['db'];config[_0x1cbe('0x14')]=_['defaults'](config[_0x1cbe('0x14')],{'host':_0x1cbe('0x15'),'port':0x18eb});var socket=require(_0x1cbe('0x16'))(new Redis(config['redis']));require(_0x1cbe('0x17'))[_0x1cbe('0x18')](socket);function respondWithStatusCode(_0x2304c2,_0x21b05c){_0x21b05c=_0x21b05c||0xcc;return function(_0x47303f){if(_0x47303f){return _0x2304c2[_0x1cbe('0x19')](_0x21b05c);}return _0x2304c2[_0x1cbe('0x1a')](_0x21b05c)[_0x1cbe('0x1b')]();};}function respondWithResult(_0x109cd7,_0x41eec7){_0x41eec7=_0x41eec7||0xc8;return function(_0x4fd646){if(_0x4fd646){return _0x109cd7[_0x1cbe('0x1a')](_0x41eec7)[_0x1cbe('0x1c')](_0x4fd646);}};}function respondWithFilteredResult(_0x244a1d,_0x5ef1a2){return function(_0x1836a7){if(_0x1836a7){var _0x406d54=typeof _0x5ef1a2[_0x1cbe('0x1d')]==='undefined'&&typeof _0x5ef1a2['limit']===_0x1cbe('0x1e');var _0x75e87a=_0x1836a7[_0x1cbe('0x1f')];var _0x1c579b=_0x406d54?0x0:_0x5ef1a2['offset'];var _0x4a6bfd=_0x406d54?_0x1836a7[_0x1cbe('0x1f')]:_0x5ef1a2[_0x1cbe('0x1d')]+_0x5ef1a2[_0x1cbe('0x20')];var _0x56f3c6;if(_0x4a6bfd>=_0x75e87a){_0x4a6bfd=_0x75e87a;_0x56f3c6=0xc8;}else{_0x56f3c6=0xce;}_0x244a1d['status'](_0x56f3c6);return _0x244a1d[_0x1cbe('0x21')]('Content-Range',_0x1c579b+'-'+_0x4a6bfd+'/'+_0x75e87a)[_0x1cbe('0x1c')](_0x1836a7);}return null;};}function patchUpdates(_0x192a76){return function(_0x16f466){try{jsonpatch[_0x1cbe('0x22')](_0x16f466,_0x192a76,!![]);}catch(_0x19b93f){return BPromise[_0x1cbe('0x23')](_0x19b93f);}return _0x16f466[_0x1cbe('0x24')]();};}function saveUpdates(_0x23495c,_0xbdbfdb){return function(_0x4c7a82){if(_0x4c7a82){return _0x4c7a82[_0x1cbe('0x25')](_0x23495c)['then'](function(_0x1fb6aa){return _0x1fb6aa;});}return null;};}function removeEntity(_0x2208bd,_0x384845){return function(_0x55e751){if(_0x55e751){return _0x55e751[_0x1cbe('0x26')]()[_0x1cbe('0x27')](function(){var _0x1b391d=_0x55e751[_0x1cbe('0x28')]({'plain':!![]});var _0xd9bb05=_0x1cbe('0x29');return db['UserProfileResource'][_0x1cbe('0x26')]({'where':{'type':_0xd9bb05,'resourceId':_0x1b391d['id']}})[_0x1cbe('0x27')](function(){return _0x55e751;});})[_0x1cbe('0x27')](function(){_0x2208bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa30ec5,_0x52d0d5){return function(_0x252a61){if(!_0x252a61){_0xa30ec5['sendStatus'](0x194);}return _0x252a61;};}function handleError(_0x7d95b9,_0x9b12c4){_0x9b12c4=_0x9b12c4||0x1f4;return function(_0x3a937e){logger[_0x1cbe('0x2a')](_0x3a937e['stack']);if(_0x3a937e[_0x1cbe('0x2b')]){delete _0x3a937e[_0x1cbe('0x2b')];}_0x7d95b9[_0x1cbe('0x1a')](_0x9b12c4)[_0x1cbe('0x2c')](_0x3a937e);};}function getMustacheRender(_0x6ac965,_0x1b3465){return Mustache['render'](_0x6ac965,_['merge'](_0x1b3465[_0x1cbe('0x2d')],{'contact':_0x1b3465['contact'],'message':_0x1b3465[_0x1cbe('0x2e')],'agent':_0x1b3465[_0x1cbe('0x2f')],'interaction':_0x1b3465['interaction'],'account':_0x1b3465[_0x1cbe('0x30')]}))||'';}exports['index']=function(_0x33dfee,_0x1c1fa1){var _0xfd9138={},_0x3217e5={},_0x50691c={'count':0x0,'rows':[]};var _0x54c30e=_[_0x1cbe('0x31')](db[_0x1cbe('0x32')][_0x1cbe('0x33')],function(_0x39ed8c){return{'name':_0x39ed8c[_0x1cbe('0x34')],'type':_0x39ed8c['type'][_0x1cbe('0x35')]};});_0x3217e5[_0x1cbe('0x36')]=_['map'](_0x54c30e,_0x1cbe('0x2b'));_0x3217e5[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0x33dfee['query']);_0x3217e5['filters']=_[_0x1cbe('0x39')](_0x3217e5[_0x1cbe('0x36')],_0x3217e5[_0x1cbe('0x37')]);_0xfd9138[_0x1cbe('0x3a')]=_[_0x1cbe('0x39')](_0x3217e5[_0x1cbe('0x36')],qs[_0x1cbe('0x3b')](_0x33dfee[_0x1cbe('0x37')]['fields']));_0xfd9138[_0x1cbe('0x3a')]=_0xfd9138['attributes'][_0x1cbe('0x3c')]?_0xfd9138['attributes']:_0x3217e5[_0x1cbe('0x36')];if(!_0x33dfee['query'][_0x1cbe('0x3d')]('nolimit')){_0xfd9138[_0x1cbe('0x20')]=qs[_0x1cbe('0x20')](_0x33dfee['query'][_0x1cbe('0x20')]);_0xfd9138[_0x1cbe('0x1d')]=qs[_0x1cbe('0x1d')](_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x1d')]);}_0xfd9138[_0x1cbe('0x3e')]=qs[_0x1cbe('0x3f')](_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x3f')]);_0xfd9138[_0x1cbe('0x40')]=qs['filters'](_[_0x1cbe('0x41')](_0x33dfee[_0x1cbe('0x37')],_0x3217e5[_0x1cbe('0x42')]),_0x54c30e);if(_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x43')]){_0xfd9138[_0x1cbe('0x40')]=_[_0x1cbe('0x44')](_0xfd9138[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x54c30e,function(_0x4e43b6){if(_0x4e43b6[_0x1cbe('0x45')]!==_0x1cbe('0x46')){var _0x990972={};_0x990972[_0x4e43b6[_0x1cbe('0x2b')]]={'$like':'%'+_0x33dfee['query']['filter']+'%'};return _0x990972;}})});}_0xfd9138=_[_0x1cbe('0x44')]({},_0xfd9138,_0x33dfee['options']);var _0x5c5b03={'where':_0xfd9138[_0x1cbe('0x40')]};return db[_0x1cbe('0x32')][_0x1cbe('0x1f')](_0x5c5b03)[_0x1cbe('0x27')](function(_0x44f4a4){_0x50691c[_0x1cbe('0x1f')]=_0x44f4a4;if(_0x33dfee[_0x1cbe('0x37')][_0x1cbe('0x47')]){_0xfd9138['include']=[{'all':!![]}];}return db[_0x1cbe('0x32')]['findAll'](_0xfd9138);})[_0x1cbe('0x27')](function(_0x1a2df0){_0x50691c[_0x1cbe('0x48')]=_0x1a2df0;return _0x50691c;})['then'](respondWithFilteredResult(_0x1c1fa1,_0xfd9138))[_0x1cbe('0x49')](handleError(_0x1c1fa1,null));};exports[_0x1cbe('0x4a')]=function(_0xddc7c0,_0xe4b4bb){var _0x81beb5={'raw':!![],'where':{'id':_0xddc7c0[_0x1cbe('0x4b')]['id']}},_0x150e97={};_0x150e97[_0x1cbe('0x36')]=_[_0x1cbe('0x38')](db[_0x1cbe('0x32')]['rawAttributes']);_0x150e97[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0xddc7c0[_0x1cbe('0x37')]);_0x150e97[_0x1cbe('0x42')]=_[_0x1cbe('0x39')](_0x150e97['model'],_0x150e97[_0x1cbe('0x37')]);_0x81beb5[_0x1cbe('0x3a')]=_['intersection'](_0x150e97['model'],qs['fields'](_0xddc7c0['query'][_0x1cbe('0x3b')]));_0x81beb5[_0x1cbe('0x3a')]=_0x81beb5[_0x1cbe('0x3a')]['length']?_0x81beb5['attributes']:_0x150e97[_0x1cbe('0x36')];if(_0xddc7c0['query']['includeAll']){_0x81beb5[_0x1cbe('0x4c')]=[{'all':!![]}];}_0x81beb5=_['merge']({},_0x81beb5,_0xddc7c0[_0x1cbe('0x4d')]);return db[_0x1cbe('0x32')]['find'](_0x81beb5)['then'](handleEntityNotFound(_0xe4b4bb,null))['then'](respondWithResult(_0xe4b4bb,null))['catch'](handleError(_0xe4b4bb,null));};exports[_0x1cbe('0x4e')]=function(_0x1d8d72,_0x2a45df){return db[_0x1cbe('0x32')][_0x1cbe('0x4e')](_0x1d8d72[_0x1cbe('0x2d')],{})[_0x1cbe('0x27')](function(_0x3cb509){var _0x429bd5=_0x1d8d72['user'][_0x1cbe('0x28')]({'plain':!![]});if(!_0x429bd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x429bd5[_0x1cbe('0x4f')]===_0x1cbe('0x50')){var _0x195378=_0x3cb509[_0x1cbe('0x28')]({'plain':!![]});var _0x280b82=_0x1cbe('0x29');return db[_0x1cbe('0x51')][_0x1cbe('0x52')]({'where':{'name':_0x280b82,'userProfileId':_0x429bd5[_0x1cbe('0x53')]},'raw':!![]})[_0x1cbe('0x27')](function(_0x24ceec){if(_0x24ceec&&_0x24ceec[_0x1cbe('0x54')]===0x0){return db[_0x1cbe('0x55')][_0x1cbe('0x4e')]({'name':_0x195378['name'],'resourceId':_0x195378['id'],'type':_0x24ceec[_0x1cbe('0x2b')],'sectionId':_0x24ceec['id']},{})['then'](function(){return _0x3cb509;});}else{return _0x3cb509;}})[_0x1cbe('0x49')](function(_0x503423){logger[_0x1cbe('0x2a')](_0x1cbe('0x56'),_0x503423);throw _0x503423;});}return _0x3cb509;})[_0x1cbe('0x27')](respondWithResult(_0x2a45df,0xc9))['catch'](handleError(_0x2a45df,null));};exports[_0x1cbe('0x25')]=function(_0x1d8251,_0x4c98b9){if(_0x1d8251[_0x1cbe('0x2d')]['id']){delete _0x1d8251[_0x1cbe('0x2d')]['id'];}return db[_0x1cbe('0x32')]['find']({'where':{'id':_0x1d8251[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x4c98b9,null))[_0x1cbe('0x27')](saveUpdates(_0x1d8251[_0x1cbe('0x2d')],null))[_0x1cbe('0x27')](respondWithResult(_0x4c98b9,null))[_0x1cbe('0x49')](handleError(_0x4c98b9,null));};exports[_0x1cbe('0x26')]=function(_0x5545ff,_0x5d6acb){return db['OpenchannelQueue'][_0x1cbe('0x52')]({'where':{'id':_0x5545ff[_0x1cbe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5d6acb,null))[_0x1cbe('0x27')](removeEntity(_0x5d6acb,null))[_0x1cbe('0x49')](handleError(_0x5d6acb,null));};exports[_0x1cbe('0x57')]=function(_0x52ea2b,_0x2a55a5){return db[_0x1cbe('0x32')][_0x1cbe('0x57')]()['then'](respondWithResult(_0x2a55a5,null))[_0x1cbe('0x49')](handleError(_0x2a55a5,null));};exports[_0x1cbe('0x58')]=function(_0x4350e4,_0x9cf408,_0x350cda){var _0x45769f={'raw':!![],'where':{}},_0x58867a={},_0x2751ed;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4350e4[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x9cf408,null))[_0x1cbe('0x27')](function(_0x579107){if(_0x579107){_0x2751ed=_0x579107['get']({'plain':!![]});_0x58867a['model']=_[_0x1cbe('0x38')](db[_0x1cbe('0x59')][_0x1cbe('0x33')]);_0x58867a['query']=_['keys'](_0x4350e4[_0x1cbe('0x37')]);_0x58867a[_0x1cbe('0x42')]=_[_0x1cbe('0x39')](_0x58867a[_0x1cbe('0x36')],_0x58867a['query']);_0x45769f[_0x1cbe('0x3a')]=_['intersection'](_0x58867a[_0x1cbe('0x36')],qs[_0x1cbe('0x3b')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x3b')]));_0x45769f[_0x1cbe('0x3a')]=_0x45769f[_0x1cbe('0x3a')][_0x1cbe('0x3c')]?_0x45769f['attributes']:_0x58867a[_0x1cbe('0x36')];if(!_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x3d')](_0x1cbe('0x5a'))){_0x45769f['limit']=qs[_0x1cbe('0x20')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x20')]);_0x45769f['offset']=qs[_0x1cbe('0x1d')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x1d')]);}_0x45769f[_0x1cbe('0x3e')]=qs[_0x1cbe('0x3f')](_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x3f')]);_0x45769f['where']=qs[_0x1cbe('0x42')](_['pick'](_0x4350e4[_0x1cbe('0x37')],_0x58867a[_0x1cbe('0x42')]));_0x45769f['where'][_0x1cbe('0x5b')]=_0x579107['id'];if(_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x43')]){_0x45769f[_0x1cbe('0x40')]=_[_0x1cbe('0x44')](_0x45769f[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x45769f[_0x1cbe('0x3a')],function(_0x2b286b){var _0x34ae6e={};_0x34ae6e[_0x2b286b]={'$like':'%'+_0x4350e4[_0x1cbe('0x37')][_0x1cbe('0x43')]+'%'};return _0x34ae6e;})});}_0x45769f=_[_0x1cbe('0x44')]({},_0x45769f,_0x4350e4[_0x1cbe('0x4d')]);return db[_0x1cbe('0x59')][_0x1cbe('0x5c')](_0x45769f);}})[_0x1cbe('0x27')](function(_0x449fd0){if(_0x449fd0){return db[_0x1cbe('0x5d')][_0x1cbe('0x5e')]({'where':{'id':_[_0x1cbe('0x31')](_0x449fd0,_0x1cbe('0x5f')),'role':'agent'},'attributes':['id',_0x1cbe('0x2b'),'openchannelPause',_0x1cbe('0x60'),'createdAt']});}})[_0x1cbe('0x27')](function(_0x4c7633){if(_0x4c7633){return{'count':_0x4c7633['count'],'rows':_[_0x1cbe('0x31')](_0x4c7633[_0x1cbe('0x48')],function(_0x10d10f){return{'membername':_0x10d10f[_0x1cbe('0x2b')],'UserId':_0x10d10f['id'],'queue_name':_0x2751ed[_0x1cbe('0x2b')],'OpenchannelQueueId':_0x2751ed['id'],'interface':util[_0x1cbe('0x61')](_0x1cbe('0x62'),_0x1cbe('0x63'),_0x10d10f[_0x1cbe('0x2b')]),'penalty':0x0,'paused':_0x10d10f[_0x1cbe('0x64')],'createdAt':_0x10d10f['createdAt'],'updatedAt':_0x10d10f[_0x1cbe('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1cbe('0x27')](respondWithFilteredResult(_0x9cf408,_0x45769f))[_0x1cbe('0x49')](handleError(_0x9cf408,null));};exports['getTeams']=function(_0x3e6d63,_0xec6cc1,_0x487d45){var _0x3edc89={};var _0x1c70a6={};var _0x57863a;var _0x4cbb2d;return db['OpenchannelQueue'][_0x1cbe('0x65')]({'where':{'id':_0x3e6d63[_0x1cbe('0x4b')]['id']}})['then'](handleEntityNotFound(_0xec6cc1,null))[_0x1cbe('0x27')](function(_0x155642){if(_0x155642){_0x57863a=_0x155642;_0x1c70a6['model']=_['keys'](db[_0x1cbe('0x66')][_0x1cbe('0x33')]);_0x1c70a6[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0x3e6d63[_0x1cbe('0x37')]);_0x1c70a6[_0x1cbe('0x42')]=_['intersection'](_0x1c70a6[_0x1cbe('0x36')],_0x1c70a6[_0x1cbe('0x37')]);_0x3edc89['attributes']=_[_0x1cbe('0x39')](_0x1c70a6[_0x1cbe('0x36')],qs[_0x1cbe('0x3b')](_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x3b')]));_0x3edc89[_0x1cbe('0x3a')]=_0x3edc89[_0x1cbe('0x3a')][_0x1cbe('0x3c')]?_0x3edc89[_0x1cbe('0x3a')]:_0x1c70a6[_0x1cbe('0x36')];_0x3edc89[_0x1cbe('0x3e')]=qs[_0x1cbe('0x3f')](_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x3f')]);_0x3edc89[_0x1cbe('0x40')]=qs[_0x1cbe('0x42')](_[_0x1cbe('0x41')](_0x3e6d63[_0x1cbe('0x37')],_0x1c70a6['filters']));if(_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x43')]){_0x3edc89['where']=_[_0x1cbe('0x44')](_0x3edc89[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x3edc89[_0x1cbe('0x3a')],function(_0x238a74){var _0x3744a3={};_0x3744a3[_0x238a74]={'$like':'%'+_0x3e6d63[_0x1cbe('0x37')]['filter']+'%'};return _0x3744a3;})});}_0x3edc89=_[_0x1cbe('0x44')]({},_0x3edc89,_0x3e6d63['options']);return _0x57863a[_0x1cbe('0x67')](_0x3edc89);}})[_0x1cbe('0x27')](function(_0x1914cf){if(_0x1914cf){_0x4cbb2d=_0x1914cf[_0x1cbe('0x3c')];if(!_0x3e6d63['query'][_0x1cbe('0x3d')](_0x1cbe('0x5a'))){_0x3edc89[_0x1cbe('0x20')]=qs['limit'](_0x3e6d63['query']['limit']);_0x3edc89[_0x1cbe('0x1d')]=qs[_0x1cbe('0x1d')](_0x3e6d63[_0x1cbe('0x37')][_0x1cbe('0x1d')]);}return _0x57863a['getTeams'](_0x3edc89);}})['then'](function(_0x271654){if(_0x271654){return _0x271654?{'count':_0x4cbb2d,'rows':_0x271654}:null;}})[_0x1cbe('0x27')](respondWithResult(_0xec6cc1,null))[_0x1cbe('0x49')](handleError(_0xec6cc1,null));};exports[_0x1cbe('0x68')]=function(_0x3d7b1a,_0x308748,_0x43ad49){var _0x4efd58=_0x3d7b1a[_0x1cbe('0x2d')][_0x1cbe('0x69')];return db[_0x1cbe('0x66')][_0x1cbe('0x5c')]({'where':{'id':_0x4efd58},'attributes':['id'],'include':[{'model':db[_0x1cbe('0x5d')],'as':_0x1cbe('0x6a'),'attributes':['id',_0x1cbe('0x2b'),'online','voicePause',_0x1cbe('0x6b')],'raw':!![]}]})[_0x1cbe('0x27')](function(_0x13996d){if(_0x13996d){var _0x4f7997=_[_0x1cbe('0x6c')](_0x13996d,function(_0x17fe2d){var _0x264b9b=_0x17fe2d['get']({'plain':!![]});return _0x264b9b[_0x1cbe('0x6a')];});return db[_0x1cbe('0x32')][_0x1cbe('0x52')]({'where':{'id':_0x3d7b1a['params']['id']}})[_0x1cbe('0x27')](function(_0x310d87){return db[_0x1cbe('0x6d')]['transaction'](function(_0x2095be){return _0x310d87[_0x1cbe('0x68')](_0x4efd58,{'transaction':_0x2095be})['then'](function(){return BPromise['each'](_0x4f7997,function(_0x466ca8){return db[_0x1cbe('0x59')][_0x1cbe('0x6e')]({'where':{'UserId':_0x466ca8['id'],'OpenchannelQueueId':_0x3d7b1a[_0x1cbe('0x4b')]['id']},'transaction':_0x2095be});});})[_0x1cbe('0x27')](function(){_0x4f7997[_0x1cbe('0x6f')](function(_0x27c8e6){socket[_0x1cbe('0x70')](_0x1cbe('0x71'),{'UserId':_0x27c8e6['id'],'OpenchannelQueueId':_0x310d87['id']});});});});});}})[_0x1cbe('0x27')](respondWithStatusCode(_0x308748,null))['catch'](handleError(_0x308748,null));};exports[_0x1cbe('0x72')]=function(_0x5308d7,_0x293e0e,_0xca1ed2){return db[_0x1cbe('0x66')][_0x1cbe('0x5c')]({'where':{'id':_0x5308d7[_0x1cbe('0x37')][_0x1cbe('0x69')]},'attributes':['id'],'include':[{'model':db[_0x1cbe('0x5d')],'as':_0x1cbe('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x1cbe('0x27')](handleEntityNotFound(_0x293e0e,null))['then'](function(_0x1bffa8){var _0x43d54a=_['map'](_0x1bffa8,'id');var _0x3f44b6=[];var _0x42558c=[];var _0x51e553=squel[_0x1cbe('0x73')]();_0x51e553['field']('tq.TeamId')[_0x1cbe('0x74')](_0x1cbe('0x75'),'tq')[_0x1cbe('0x76')](_0x1cbe('0x77'),'ut',_0x1cbe('0x78'))[_0x1cbe('0x40')](_0x1cbe('0x79'),_0x5308d7[_0x1cbe('0x4b')]['id']);for(var _0xc6f2bc=0x0;_0xc6f2bc<_0x1bffa8['length'];_0xc6f2bc+=0x1){let _0x50bc6e=_0x1bffa8[_0xc6f2bc];for(var _0x43e018=0x0;_0x43e018<_0x50bc6e[_0x1cbe('0x6a')][_0x1cbe('0x3c')];_0x43e018+=0x1){let _0x1afac1=_0x50bc6e['Agents'][_0x43e018];var _0x2146a3=_0x51e553[_0x1cbe('0x7a')]();_0x2146a3[_0x1cbe('0x40')]('ut.UserId\x20=\x20?',_0x1afac1['id']);_0x42558c[_0x1cbe('0x7b')](db['sequelize'][_0x1cbe('0x37')](_0x2146a3['toString'](),{'type':db[_0x1cbe('0x6d')]['QueryTypes']['SELECT']})[_0x1cbe('0x27')](function(_0x33c091){if(_0x33c091[_0x1cbe('0x3c')]===0x1){return _0x1afac1['id'];}else{var _0x22bd55=_[_0x1cbe('0x7c')](_[_0x1cbe('0x31')](_0x33c091,_0x1cbe('0x7d')),function(_0xb81c6d){return _['includes'](_0x43d54a,_0xb81c6d);});if(_0x22bd55){return _0x1afac1['id'];}}}));}}return BPromise[_0x1cbe('0x7e')](_0x42558c)[_0x1cbe('0x27')](function(_0x247789){_0x3f44b6=_(_0x3f44b6)[_0x1cbe('0x7f')](_0x247789)['compact']()[_0x1cbe('0x80')]();return db[_0x1cbe('0x32')]['find']({'where':{'id':_0x5308d7[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](function(_0x5da52c){return db[_0x1cbe('0x6d')][_0x1cbe('0x81')](function(_0x46ea25){return _0x5da52c[_0x1cbe('0x72')](_0x5308d7['query']['ids'],{'transaction':_0x46ea25})[_0x1cbe('0x27')](function(){if(!_['isEmpty'](_0x3f44b6)){return _0x5da52c['removeAgents'](_0x3f44b6,{'transaction':_0x46ea25});}})['then'](function(){_0x3f44b6[_0x1cbe('0x6f')](function(_0x1cba8e){socket[_0x1cbe('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x1cba8e,'OpenchannelQueueId':_0x5da52c['id']});});});});});});})['then'](respondWithStatusCode(_0x293e0e,null))[_0x1cbe('0x49')](handleError(_0x293e0e,null));};exports[_0x1cbe('0x82')]=function(_0x489c03,_0x4dab73,_0x2e9f2c){return db[_0x1cbe('0x32')][_0x1cbe('0x52')]({'where':{'id':_0x489c03[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x4dab73,null))['then'](function(_0x41912f){if(_0x41912f){return _0x41912f[_0x1cbe('0x82')](_0x489c03[_0x1cbe('0x2d')][_0x1cbe('0x69')],_[_0x1cbe('0x83')](_0x489c03[_0x1cbe('0x2d')],[_0x1cbe('0x69'),'id'])||{})[_0x1cbe('0x84')](function(_0x1776b4){for(var _0xb1a0a6=0x0;_0xb1a0a6<_0x489c03[_0x1cbe('0x2d')][_0x1cbe('0x69')][_0x1cbe('0x3c')];_0xb1a0a6+=0x1){socket[_0x1cbe('0x70')](_0x1cbe('0x71'),{'UserId':_0x489c03[_0x1cbe('0x2d')][_0x1cbe('0x69')][_0xb1a0a6],'OpenchannelQueueId':_0x489c03['params']['id']});}return _0x1776b4;});}})['then'](respondWithResult(_0x4dab73,null))[_0x1cbe('0x49')](handleError(_0x4dab73,null));};exports['removeAgents']=function(_0x3c93b9,_0x371be6,_0x488fed){return db[_0x1cbe('0x32')]['find']({'where':{'id':_0x3c93b9[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x371be6,null))['then'](function(_0x483762){if(_0x483762){return _0x483762['removeAgents'](_0x3c93b9[_0x1cbe('0x37')][_0x1cbe('0x69')])[_0x1cbe('0x27')](function(){if(_[_0x1cbe('0x85')](_0x3c93b9['query'][_0x1cbe('0x69')])){for(var _0x3cc098=0x0;_0x3cc098<_0x3c93b9[_0x1cbe('0x37')]['ids']['length'];_0x3cc098+=0x1){socket[_0x1cbe('0x70')](_0x1cbe('0x86'),{'UserId':Number(_0x3c93b9[_0x1cbe('0x37')][_0x1cbe('0x69')][_0x3cc098]),'OpenchannelQueueId':Number(_0x3c93b9[_0x1cbe('0x4b')]['id'])});}}else{socket[_0x1cbe('0x70')](_0x1cbe('0x86'),{'UserId':Number(_0x3c93b9[_0x1cbe('0x37')]['ids']),'OpenchannelQueueId':Number(_0x3c93b9['params']['id'])});}});}})[_0x1cbe('0x27')](respondWithStatusCode(_0x371be6,null))[_0x1cbe('0x49')](handleError(_0x371be6,null));};exports[_0x1cbe('0x87')]=function(_0x42ded7,_0x12842a,_0x26aa89){var _0x449aac={};var _0x7aaab0={};var _0x14a851;var _0x4acf54;return db[_0x1cbe('0x32')][_0x1cbe('0x65')]({'where':{'id':_0x42ded7[_0x1cbe('0x4b')]['id']}})[_0x1cbe('0x27')](handleEntityNotFound(_0x12842a,null))[_0x1cbe('0x27')](function(_0x3ad2ae){if(_0x3ad2ae){_0x14a851=_0x3ad2ae;_0x7aaab0[_0x1cbe('0x36')]=_[_0x1cbe('0x38')](db[_0x1cbe('0x5d')][_0x1cbe('0x33')]);_0x7aaab0[_0x1cbe('0x37')]=_[_0x1cbe('0x38')](_0x42ded7[_0x1cbe('0x37')]);_0x7aaab0[_0x1cbe('0x42')]=_[_0x1cbe('0x39')](_0x7aaab0['model'],_0x7aaab0['query']);_0x449aac['attributes']=_[_0x1cbe('0x39')](_0x7aaab0['model'],qs[_0x1cbe('0x3b')](_0x42ded7[_0x1cbe('0x37')]['fields']));_0x449aac['attributes']=_0x449aac[_0x1cbe('0x3a')]['length']?_0x449aac[_0x1cbe('0x3a')]:_0x7aaab0[_0x1cbe('0x36')];_0x449aac[_0x1cbe('0x3e')]=qs['sort'](_0x42ded7[_0x1cbe('0x37')]['sort']);_0x449aac[_0x1cbe('0x40')]=qs['filters'](_[_0x1cbe('0x41')](_0x42ded7[_0x1cbe('0x37')],_0x7aaab0[_0x1cbe('0x42')]));if(_0x42ded7['query'][_0x1cbe('0x43')]){_0x449aac[_0x1cbe('0x40')]=_[_0x1cbe('0x44')](_0x449aac[_0x1cbe('0x40')],{'$or':_[_0x1cbe('0x31')](_0x449aac[_0x1cbe('0x3a')],function(_0x4941f2){var _0xfb3d0d={};_0xfb3d0d[_0x4941f2]={'$like':'%'+_0x42ded7['query']['filter']+'%'};return _0xfb3d0d;})});}_0x449aac=_[_0x1cbe('0x44')]({},_0x449aac,_0x42ded7[_0x1cbe('0x4d')]);return _0x14a851[_0x1cbe('0x87')](_0x449aac);}})[_0x1cbe('0x27')](function(_0x3a760d){if(_0x3a760d){_0x4acf54=_0x3a760d[_0x1cbe('0x3c')];if(!_0x42ded7[_0x1cbe('0x37')][_0x1cbe('0x3d')](_0x1cbe('0x5a'))){_0x449aac[_0x1cbe('0x20')]=qs[_0x1cbe('0x20')](_0x42ded7['query']['limit']);_0x449aac['offset']=qs[_0x1cbe('0x1d')](_0x42ded7['query'][_0x1cbe('0x1d')]);}return _0x14a851[_0x1cbe('0x87')](_0x449aac);}})[_0x1cbe('0x27')](function(_0x4025ae){if(_0x4025ae){return _0x4025ae?{'count':_0x4acf54,'rows':_0x4025ae}:null;}})[_0x1cbe('0x27')](respondWithResult(_0x12842a,null))[_0x1cbe('0x49')](handleError(_0x12842a,null));}; \ No newline at end of file +var _0x2746=['end','status','undefined','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','OpenchannelQueue','count','findAll','rows','show','params','include','create','body','user','role','get','OpenchannelQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','options','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','getTeams','order','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','getAgents','User','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','register'];(function(_0x2fc026,_0xdc4f7a){var _0x34d056=function(_0x457d02){while(--_0x457d02){_0x2fc026['push'](_0x2fc026['shift']());}};_0x34d056(++_0xdc4f7a);}(_0x2746,0x19c));var _0x6274=function(_0x3f9a51,_0x21209d){_0x3f9a51=_0x3f9a51-0x0;var _0x3763b8=_0x2746[_0x3f9a51];return _0x3763b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6274('0x0'));var jsonpatch=require(_0x6274('0x1'));var rp=require(_0x6274('0x2'));var moment=require(_0x6274('0x3'));var BPromise=require(_0x6274('0x4'));var Mustache=require(_0x6274('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6274('0x6'));var csv=require(_0x6274('0x7'));var ejs=require(_0x6274('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6274('0x9'));var squel=require(_0x6274('0xa'));var crypto=require(_0x6274('0xb'));var jsforce=require(_0x6274('0xc'));var deskjs=require(_0x6274('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6274('0xe'));var Papa=require('papaparse');var Redis=require(_0x6274('0xf'));var authService=require(_0x6274('0x10'));var qs=require(_0x6274('0x11'));var as=require(_0x6274('0x12'));var hardwareService=require(_0x6274('0x13'));var logger=require(_0x6274('0x14'))(_0x6274('0x15'));var utils=require(_0x6274('0x16'));var config=require(_0x6274('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6274('0x18')](config['redis'],{'host':_0x6274('0x19'),'port':0x18eb});var socket=require(_0x6274('0x1a'))(new Redis(config[_0x6274('0x1b')]));require('./openchannelQueue.socket')[_0x6274('0x1c')](socket);function respondWithStatusCode(_0x488b60,_0xce3d04){_0xce3d04=_0xce3d04||0xcc;return function(_0x12e21c){if(_0x12e21c){return _0x488b60['sendStatus'](_0xce3d04);}return _0x488b60['status'](_0xce3d04)[_0x6274('0x1d')]();};}function respondWithResult(_0x1d0dc4,_0x154013){_0x154013=_0x154013||0xc8;return function(_0x33f0b8){if(_0x33f0b8){return _0x1d0dc4[_0x6274('0x1e')](_0x154013)['json'](_0x33f0b8);}};}function respondWithFilteredResult(_0x3219d1,_0xb06bd6){return function(_0x40cc32){if(_0x40cc32){var _0x55eeed=typeof _0xb06bd6['offset']===_0x6274('0x1f')&&typeof _0xb06bd6['limit']==='undefined';var _0x402b97=_0x40cc32['count'];var _0x189d1f=_0x55eeed?0x0:_0xb06bd6[_0x6274('0x20')];var _0x4ce595=_0x55eeed?_0x40cc32['count']:_0xb06bd6[_0x6274('0x20')]+_0xb06bd6[_0x6274('0x21')];var _0xe2b388;if(_0x4ce595>=_0x402b97){_0x4ce595=_0x402b97;_0xe2b388=0xc8;}else{_0xe2b388=0xce;}_0x3219d1[_0x6274('0x1e')](_0xe2b388);return _0x3219d1[_0x6274('0x22')](_0x6274('0x23'),_0x189d1f+'-'+_0x4ce595+'/'+_0x402b97)[_0x6274('0x24')](_0x40cc32);}return null;};}function patchUpdates(_0x12df93){return function(_0x99c614){try{jsonpatch[_0x6274('0x25')](_0x99c614,_0x12df93,!![]);}catch(_0x1d1a09){return BPromise[_0x6274('0x26')](_0x1d1a09);}return _0x99c614[_0x6274('0x27')]();};}function saveUpdates(_0xa0c8bd,_0x13a9fa){return function(_0x269a3b){if(_0x269a3b){return _0x269a3b[_0x6274('0x28')](_0xa0c8bd)[_0x6274('0x29')](function(_0x5228a1){return _0x5228a1;});}return null;};}function removeEntity(_0x425241,_0x486d1f){return function(_0x2b386f){if(_0x2b386f){return _0x2b386f['destroy']()[_0x6274('0x29')](function(){var _0x1513e8=_0x2b386f['get']({'plain':!![]});var _0x416fac='OpenchannelQueues';return db['UserProfileResource'][_0x6274('0x2a')]({'where':{'type':_0x416fac,'resourceId':_0x1513e8['id']}})[_0x6274('0x29')](function(){return _0x2b386f;});})[_0x6274('0x29')](function(){_0x425241['status'](0xcc)[_0x6274('0x1d')]();});}};}function handleEntityNotFound(_0x49df2e,_0x4818e2){return function(_0x4c1160){if(!_0x4c1160){_0x49df2e[_0x6274('0x2b')](0x194);}return _0x4c1160;};}function handleError(_0x1e3122,_0x5efa75){_0x5efa75=_0x5efa75||0x1f4;return function(_0x123454){logger[_0x6274('0x2c')](_0x123454[_0x6274('0x2d')]);if(_0x123454['name']){delete _0x123454[_0x6274('0x2e')];}_0x1e3122[_0x6274('0x1e')](_0x5efa75)[_0x6274('0x2f')](_0x123454);};}function getMustacheRender(_0x473042,_0x4707a6){return Mustache[_0x6274('0x30')](_0x473042,_[_0x6274('0x31')](_0x4707a6['body'],{'contact':_0x4707a6['contact'],'message':_0x4707a6[_0x6274('0x32')],'agent':_0x4707a6[_0x6274('0x33')],'interaction':_0x4707a6[_0x6274('0x34')],'account':_0x4707a6[_0x6274('0x35')]}))||'';}exports[_0x6274('0x36')]=function(_0x2a5811,_0x3a58d8){var _0x3c2365={},_0x2961f4={},_0xb042c4={'count':0x0,'rows':[]};var _0x1ababe=_[_0x6274('0x37')](db['OpenchannelQueue'][_0x6274('0x38')],function(_0x2a717c){return{'name':_0x2a717c[_0x6274('0x39')],'type':_0x2a717c[_0x6274('0x3a')][_0x6274('0x3b')]};});_0x2961f4[_0x6274('0x3c')]=_['map'](_0x1ababe,'name');_0x2961f4['query']=_[_0x6274('0x3d')](_0x2a5811[_0x6274('0x3e')]);_0x2961f4[_0x6274('0x3f')]=_[_0x6274('0x40')](_0x2961f4[_0x6274('0x3c')],_0x2961f4[_0x6274('0x3e')]);_0x3c2365[_0x6274('0x41')]=_[_0x6274('0x40')](_0x2961f4[_0x6274('0x3c')],qs[_0x6274('0x42')](_0x2a5811[_0x6274('0x3e')][_0x6274('0x42')]));_0x3c2365[_0x6274('0x41')]=_0x3c2365[_0x6274('0x41')][_0x6274('0x43')]?_0x3c2365[_0x6274('0x41')]:_0x2961f4[_0x6274('0x3c')];if(!_0x2a5811[_0x6274('0x3e')]['hasOwnProperty'](_0x6274('0x44'))){_0x3c2365[_0x6274('0x21')]=qs[_0x6274('0x21')](_0x2a5811[_0x6274('0x3e')][_0x6274('0x21')]);_0x3c2365[_0x6274('0x20')]=qs[_0x6274('0x20')](_0x2a5811[_0x6274('0x3e')]['offset']);}_0x3c2365['order']=qs[_0x6274('0x45')](_0x2a5811[_0x6274('0x3e')][_0x6274('0x45')]);_0x3c2365[_0x6274('0x46')]=qs[_0x6274('0x3f')](_[_0x6274('0x47')](_0x2a5811['query'],_0x2961f4['filters']),_0x1ababe);if(_0x2a5811[_0x6274('0x3e')]['filter']){_0x3c2365['where']=_['merge'](_0x3c2365[_0x6274('0x46')],{'$or':_['map'](_0x1ababe,function(_0x10713e){if(_0x10713e[_0x6274('0x3a')]!==_0x6274('0x48')){var _0x24a3d5={};_0x24a3d5[_0x10713e['name']]={'$like':'%'+_0x2a5811[_0x6274('0x3e')][_0x6274('0x49')]+'%'};return _0x24a3d5;}})});}_0x3c2365=_[_0x6274('0x31')]({},_0x3c2365,_0x2a5811['options']);var _0x39b56c={'where':_0x3c2365[_0x6274('0x46')]};return db[_0x6274('0x4a')][_0x6274('0x4b')](_0x39b56c)[_0x6274('0x29')](function(_0x3375fe){_0xb042c4[_0x6274('0x4b')]=_0x3375fe;if(_0x2a5811[_0x6274('0x3e')]['includeAll']){_0x3c2365['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x6274('0x4c')](_0x3c2365);})[_0x6274('0x29')](function(_0x5151e5){_0xb042c4[_0x6274('0x4d')]=_0x5151e5;return _0xb042c4;})[_0x6274('0x29')](respondWithFilteredResult(_0x3a58d8,_0x3c2365))['catch'](handleError(_0x3a58d8,null));};exports[_0x6274('0x4e')]=function(_0xbb458a,_0x8a2c8e){var _0x426723={'raw':!![],'where':{'id':_0xbb458a[_0x6274('0x4f')]['id']}},_0x4fd9f0={};_0x4fd9f0[_0x6274('0x3c')]=_[_0x6274('0x3d')](db[_0x6274('0x4a')]['rawAttributes']);_0x4fd9f0[_0x6274('0x3e')]=_[_0x6274('0x3d')](_0xbb458a['query']);_0x4fd9f0['filters']=_[_0x6274('0x40')](_0x4fd9f0[_0x6274('0x3c')],_0x4fd9f0[_0x6274('0x3e')]);_0x426723[_0x6274('0x41')]=_[_0x6274('0x40')](_0x4fd9f0['model'],qs[_0x6274('0x42')](_0xbb458a[_0x6274('0x3e')]['fields']));_0x426723[_0x6274('0x41')]=_0x426723['attributes'][_0x6274('0x43')]?_0x426723['attributes']:_0x4fd9f0[_0x6274('0x3c')];if(_0xbb458a[_0x6274('0x3e')]['includeAll']){_0x426723[_0x6274('0x50')]=[{'all':!![]}];}_0x426723=_[_0x6274('0x31')]({},_0x426723,_0xbb458a['options']);return db['OpenchannelQueue']['find'](_0x426723)[_0x6274('0x29')](handleEntityNotFound(_0x8a2c8e,null))['then'](respondWithResult(_0x8a2c8e,null))['catch'](handleError(_0x8a2c8e,null));};exports[_0x6274('0x51')]=function(_0x111e64,_0x2f77a8){return db[_0x6274('0x4a')][_0x6274('0x51')](_0x111e64[_0x6274('0x52')],{})[_0x6274('0x29')](function(_0x122245){var _0x1cc5fc=_0x111e64[_0x6274('0x53')]['get']({'plain':!![]});if(!_0x1cc5fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cc5fc[_0x6274('0x54')]===_0x6274('0x53')){var _0x1e61c4=_0x122245[_0x6274('0x55')]({'plain':!![]});var _0x22b294=_0x6274('0x56');return db[_0x6274('0x57')][_0x6274('0x58')]({'where':{'name':_0x22b294,'userProfileId':_0x1cc5fc[_0x6274('0x59')]},'raw':!![]})['then'](function(_0x159e51){if(_0x159e51&&_0x159e51[_0x6274('0x5a')]===0x0){return db[_0x6274('0x5b')][_0x6274('0x51')]({'name':_0x1e61c4[_0x6274('0x2e')],'resourceId':_0x1e61c4['id'],'type':_0x159e51[_0x6274('0x2e')],'sectionId':_0x159e51['id']},{})[_0x6274('0x29')](function(){return _0x122245;});}else{return _0x122245;}})[_0x6274('0x5c')](function(_0x54637d){logger[_0x6274('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54637d);throw _0x54637d;});}return _0x122245;})['then'](respondWithResult(_0x2f77a8,0xc9))[_0x6274('0x5c')](handleError(_0x2f77a8,null));};exports[_0x6274('0x28')]=function(_0x1fe0bb,_0x22a76f){if(_0x1fe0bb['body']['id']){delete _0x1fe0bb['body']['id'];}return db[_0x6274('0x4a')][_0x6274('0x58')]({'where':{'id':_0x1fe0bb['params']['id']}})[_0x6274('0x29')](handleEntityNotFound(_0x22a76f,null))[_0x6274('0x29')](saveUpdates(_0x1fe0bb[_0x6274('0x52')],null))[_0x6274('0x29')](respondWithResult(_0x22a76f,null))[_0x6274('0x5c')](handleError(_0x22a76f,null));};exports['destroy']=function(_0x432eac,_0x13c7c4){return db[_0x6274('0x4a')][_0x6274('0x58')]({'where':{'id':_0x432eac[_0x6274('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13c7c4,null))['then'](removeEntity(_0x13c7c4,null))[_0x6274('0x5c')](handleError(_0x13c7c4,null));};exports[_0x6274('0x5d')]=function(_0x1d2b89,_0x1d7c65){return db['OpenchannelQueue']['describe']()[_0x6274('0x29')](respondWithResult(_0x1d7c65,null))[_0x6274('0x5c')](handleError(_0x1d7c65,null));};exports[_0x6274('0x5e')]=function(_0x2dae61,_0xf2188d,_0x23698e){var _0x364072={'raw':!![],'where':{}},_0x26a24a={},_0x16908c;return db[_0x6274('0x4a')][_0x6274('0x5f')]({'where':{'id':_0x2dae61[_0x6274('0x4f')]['id']}})[_0x6274('0x29')](handleEntityNotFound(_0xf2188d,null))[_0x6274('0x29')](function(_0x35c33f){if(_0x35c33f){_0x16908c=_0x35c33f[_0x6274('0x55')]({'plain':!![]});_0x26a24a[_0x6274('0x3c')]=_[_0x6274('0x3d')](db[_0x6274('0x60')][_0x6274('0x38')]);_0x26a24a[_0x6274('0x3e')]=_[_0x6274('0x3d')](_0x2dae61[_0x6274('0x3e')]);_0x26a24a[_0x6274('0x3f')]=_[_0x6274('0x40')](_0x26a24a[_0x6274('0x3c')],_0x26a24a[_0x6274('0x3e')]);_0x364072[_0x6274('0x41')]=_['intersection'](_0x26a24a[_0x6274('0x3c')],qs[_0x6274('0x42')](_0x2dae61[_0x6274('0x3e')][_0x6274('0x42')]));_0x364072[_0x6274('0x41')]=_0x364072[_0x6274('0x41')][_0x6274('0x43')]?_0x364072[_0x6274('0x41')]:_0x26a24a[_0x6274('0x3c')];if(!_0x2dae61[_0x6274('0x3e')][_0x6274('0x61')](_0x6274('0x44'))){_0x364072['limit']=qs[_0x6274('0x21')](_0x2dae61[_0x6274('0x3e')][_0x6274('0x21')]);_0x364072[_0x6274('0x20')]=qs[_0x6274('0x20')](_0x2dae61['query']['offset']);}_0x364072['order']=qs[_0x6274('0x45')](_0x2dae61[_0x6274('0x3e')]['sort']);_0x364072[_0x6274('0x46')]=qs['filters'](_['pick'](_0x2dae61['query'],_0x26a24a['filters']));_0x364072[_0x6274('0x46')][_0x6274('0x62')]=_0x35c33f['id'];if(_0x2dae61[_0x6274('0x3e')][_0x6274('0x49')]){_0x364072[_0x6274('0x46')]=_[_0x6274('0x31')](_0x364072[_0x6274('0x46')],{'$or':_[_0x6274('0x37')](_0x364072['attributes'],function(_0x101ec3){var _0x11728c={};_0x11728c[_0x101ec3]={'$like':'%'+_0x2dae61[_0x6274('0x3e')][_0x6274('0x49')]+'%'};return _0x11728c;})});}_0x364072=_[_0x6274('0x31')]({},_0x364072,_0x2dae61[_0x6274('0x63')]);return db[_0x6274('0x60')][_0x6274('0x4c')](_0x364072);}})['then'](function(_0x41a035){if(_0x41a035){return db['User'][_0x6274('0x64')]({'where':{'id':_[_0x6274('0x37')](_0x41a035,_0x6274('0x65')),'role':_0x6274('0x33')},'attributes':['id','name',_0x6274('0x66'),_0x6274('0x67'),'createdAt']});}})['then'](function(_0x54024a){if(_0x54024a){return{'count':_0x54024a[_0x6274('0x4b')],'rows':_['map'](_0x54024a[_0x6274('0x4d')],function(_0x103df8){return{'membername':_0x103df8[_0x6274('0x2e')],'UserId':_0x103df8['id'],'queue_name':_0x16908c[_0x6274('0x2e')],'OpenchannelQueueId':_0x16908c['id'],'interface':util['format']('%s/%s','SIP',_0x103df8[_0x6274('0x2e')]),'penalty':0x0,'paused':_0x103df8[_0x6274('0x66')],'createdAt':_0x103df8[_0x6274('0x68')],'updatedAt':_0x103df8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6274('0x29')](respondWithFilteredResult(_0xf2188d,_0x364072))['catch'](handleError(_0xf2188d,null));};exports[_0x6274('0x69')]=function(_0x382e5a,_0x8b3f88,_0x490b46){var _0x3aafcd={};var _0x10722e={};var _0x2e8266;var _0xa2d88a;return db[_0x6274('0x4a')][_0x6274('0x5f')]({'where':{'id':_0x382e5a[_0x6274('0x4f')]['id']}})[_0x6274('0x29')](handleEntityNotFound(_0x8b3f88,null))['then'](function(_0x1d4f90){if(_0x1d4f90){_0x2e8266=_0x1d4f90;_0x10722e['model']=_[_0x6274('0x3d')](db['Team'][_0x6274('0x38')]);_0x10722e[_0x6274('0x3e')]=_[_0x6274('0x3d')](_0x382e5a[_0x6274('0x3e')]);_0x10722e['filters']=_[_0x6274('0x40')](_0x10722e['model'],_0x10722e[_0x6274('0x3e')]);_0x3aafcd[_0x6274('0x41')]=_['intersection'](_0x10722e['model'],qs[_0x6274('0x42')](_0x382e5a[_0x6274('0x3e')][_0x6274('0x42')]));_0x3aafcd[_0x6274('0x41')]=_0x3aafcd[_0x6274('0x41')][_0x6274('0x43')]?_0x3aafcd[_0x6274('0x41')]:_0x10722e['model'];_0x3aafcd[_0x6274('0x6a')]=qs[_0x6274('0x45')](_0x382e5a[_0x6274('0x3e')]['sort']);_0x3aafcd[_0x6274('0x46')]=qs[_0x6274('0x3f')](_[_0x6274('0x47')](_0x382e5a[_0x6274('0x3e')],_0x10722e['filters']));if(_0x382e5a[_0x6274('0x3e')][_0x6274('0x49')]){_0x3aafcd[_0x6274('0x46')]=_[_0x6274('0x31')](_0x3aafcd[_0x6274('0x46')],{'$or':_[_0x6274('0x37')](_0x3aafcd[_0x6274('0x41')],function(_0x4da3e0){var _0x36c5e8={};_0x36c5e8[_0x4da3e0]={'$like':'%'+_0x382e5a[_0x6274('0x3e')][_0x6274('0x49')]+'%'};return _0x36c5e8;})});}_0x3aafcd=_[_0x6274('0x31')]({},_0x3aafcd,_0x382e5a['options']);return _0x2e8266[_0x6274('0x69')](_0x3aafcd);}})[_0x6274('0x29')](function(_0x521476){if(_0x521476){_0xa2d88a=_0x521476[_0x6274('0x43')];if(!_0x382e5a[_0x6274('0x3e')]['hasOwnProperty'](_0x6274('0x44'))){_0x3aafcd[_0x6274('0x21')]=qs[_0x6274('0x21')](_0x382e5a[_0x6274('0x3e')]['limit']);_0x3aafcd[_0x6274('0x20')]=qs[_0x6274('0x20')](_0x382e5a[_0x6274('0x3e')][_0x6274('0x20')]);}return _0x2e8266[_0x6274('0x69')](_0x3aafcd);}})[_0x6274('0x29')](function(_0x558524){if(_0x558524){return _0x558524?{'count':_0xa2d88a,'rows':_0x558524}:null;}})['then'](respondWithResult(_0x8b3f88,null))[_0x6274('0x5c')](handleError(_0x8b3f88,null));};exports[_0x6274('0x6b')]=function(_0x510fc4,_0x4e79bc,_0xcb0c9c){var _0x3f2130=_0x510fc4[_0x6274('0x52')][_0x6274('0x6c')];return db[_0x6274('0x6d')][_0x6274('0x4c')]({'where':{'id':_0x3f2130},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6274('0x6e'),'attributes':['id',_0x6274('0x2e'),_0x6274('0x6f'),_0x6274('0x70'),'interface'],'raw':!![]}]})[_0x6274('0x29')](function(_0x2cf0be){if(_0x2cf0be){var _0x4d9842=_[_0x6274('0x71')](_0x2cf0be,function(_0x4b7734){var _0x2523f1=_0x4b7734[_0x6274('0x55')]({'plain':!![]});return _0x2523f1['Agents'];});return db[_0x6274('0x4a')][_0x6274('0x58')]({'where':{'id':_0x510fc4[_0x6274('0x4f')]['id']}})[_0x6274('0x29')](function(_0x10af1a){return db[_0x6274('0x72')][_0x6274('0x73')](function(_0xffc663){return _0x10af1a[_0x6274('0x6b')](_0x3f2130,{'transaction':_0xffc663})['then'](function(){return BPromise[_0x6274('0x74')](_0x4d9842,function(_0x4cf7b7){return db[_0x6274('0x60')][_0x6274('0x75')]({'where':{'UserId':_0x4cf7b7['id'],'OpenchannelQueueId':_0x510fc4[_0x6274('0x4f')]['id']},'transaction':_0xffc663});});})[_0x6274('0x29')](function(){_0x4d9842[_0x6274('0x76')](function(_0x2f6ec2){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2f6ec2['id'],'OpenchannelQueueId':_0x10af1a['id']});});});});});}})['then'](respondWithStatusCode(_0x4e79bc,null))[_0x6274('0x5c')](handleError(_0x4e79bc,null));};exports['removeTeams']=function(_0x2ed4e0,_0x2b0e1e,_0x2885e3){return db['Team'][_0x6274('0x4c')]({'where':{'id':_0x2ed4e0[_0x6274('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6274('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x6274('0x29')](handleEntityNotFound(_0x2b0e1e,null))['then'](function(_0x85af6f){var _0x1b6f5f=_[_0x6274('0x37')](_0x85af6f,'id');var _0x4de52f=[];var _0x14cc56=[];var _0x1c22ca=squel[_0x6274('0x77')]();_0x1c22ca[_0x6274('0x78')]('tq.TeamId')[_0x6274('0x79')](_0x6274('0x7a'),'tq')[_0x6274('0x7b')](_0x6274('0x7c'),'ut',_0x6274('0x7d'))['where'](_0x6274('0x7e'),_0x2ed4e0[_0x6274('0x4f')]['id']);for(var _0x16b1d1=0x0;_0x16b1d1<_0x85af6f[_0x6274('0x43')];_0x16b1d1+=0x1){let _0x35ce2a=_0x85af6f[_0x16b1d1];for(var _0x4b0d27=0x0;_0x4b0d27<_0x35ce2a[_0x6274('0x6e')]['length'];_0x4b0d27+=0x1){let _0x2cba80=_0x35ce2a[_0x6274('0x6e')][_0x4b0d27];var _0x501bca=_0x1c22ca[_0x6274('0x7f')]();_0x501bca[_0x6274('0x46')](_0x6274('0x80'),_0x2cba80['id']);_0x14cc56['push'](db['sequelize'][_0x6274('0x3e')](_0x501bca[_0x6274('0x81')](),{'type':db[_0x6274('0x72')][_0x6274('0x82')][_0x6274('0x83')]})[_0x6274('0x29')](function(_0x3a97f4){if(_0x3a97f4['length']===0x1){return _0x2cba80['id'];}else{var _0xd30cab=_[_0x6274('0x84')](_['map'](_0x3a97f4,_0x6274('0x85')),function(_0x55fd9d){return _[_0x6274('0x86')](_0x1b6f5f,_0x55fd9d);});if(_0xd30cab){return _0x2cba80['id'];}}}));}}return BPromise['all'](_0x14cc56)[_0x6274('0x29')](function(_0x203271){_0x4de52f=_(_0x4de52f)[_0x6274('0x87')](_0x203271)[_0x6274('0x88')]()[_0x6274('0x89')]();return db[_0x6274('0x4a')][_0x6274('0x58')]({'where':{'id':_0x2ed4e0['params']['id']}})[_0x6274('0x29')](function(_0x18ec72){return db[_0x6274('0x72')][_0x6274('0x73')](function(_0x973168){return _0x18ec72[_0x6274('0x8a')](_0x2ed4e0[_0x6274('0x3e')][_0x6274('0x6c')],{'transaction':_0x973168})[_0x6274('0x29')](function(){if(!_[_0x6274('0x8b')](_0x4de52f)){return _0x18ec72[_0x6274('0x8c')](_0x4de52f,{'transaction':_0x973168});}})[_0x6274('0x29')](function(){_0x4de52f[_0x6274('0x76')](function(_0x2ebe1c){socket[_0x6274('0x8d')](_0x6274('0x8e'),{'UserId':_0x2ebe1c,'OpenchannelQueueId':_0x18ec72['id']});});});});});});})[_0x6274('0x29')](respondWithStatusCode(_0x2b0e1e,null))[_0x6274('0x5c')](handleError(_0x2b0e1e,null));};exports[_0x6274('0x8f')]=function(_0x53a424,_0x3f669b,_0x55f1ad){return db[_0x6274('0x4a')][_0x6274('0x58')]({'where':{'id':_0x53a424[_0x6274('0x4f')]['id']}})[_0x6274('0x29')](handleEntityNotFound(_0x3f669b,null))[_0x6274('0x29')](function(_0x478144){if(_0x478144){return _0x478144[_0x6274('0x8f')](_0x53a424['body'][_0x6274('0x6c')],_[_0x6274('0x90')](_0x53a424[_0x6274('0x52')],[_0x6274('0x6c'),'id'])||{})['spread'](function(_0x4f73b1){for(var _0x16f932=0x0;_0x16f932<_0x53a424[_0x6274('0x52')]['ids']['length'];_0x16f932+=0x1){socket[_0x6274('0x8d')]('userOpenchannelQueue:save',{'UserId':_0x53a424['body']['ids'][_0x16f932],'OpenchannelQueueId':_0x53a424['params']['id']});}return _0x4f73b1;});}})['then'](respondWithResult(_0x3f669b,null))['catch'](handleError(_0x3f669b,null));};exports['removeAgents']=function(_0x1ae0e5,_0x1e3eaf,_0x1297f7){return db[_0x6274('0x4a')][_0x6274('0x58')]({'where':{'id':_0x1ae0e5[_0x6274('0x4f')]['id']}})[_0x6274('0x29')](handleEntityNotFound(_0x1e3eaf,null))[_0x6274('0x29')](function(_0x50ea44){if(_0x50ea44){return _0x50ea44[_0x6274('0x8c')](_0x1ae0e5[_0x6274('0x3e')][_0x6274('0x6c')])[_0x6274('0x29')](function(){if(_['isArray'](_0x1ae0e5[_0x6274('0x3e')][_0x6274('0x6c')])){for(var _0x59a453=0x0;_0x59a453<_0x1ae0e5['query'][_0x6274('0x6c')][_0x6274('0x43')];_0x59a453+=0x1){socket[_0x6274('0x8d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1ae0e5[_0x6274('0x3e')][_0x6274('0x6c')][_0x59a453]),'OpenchannelQueueId':Number(_0x1ae0e5['params']['id'])});}}else{socket[_0x6274('0x8d')](_0x6274('0x8e'),{'UserId':Number(_0x1ae0e5[_0x6274('0x3e')][_0x6274('0x6c')]),'OpenchannelQueueId':Number(_0x1ae0e5[_0x6274('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e3eaf,null))['catch'](handleError(_0x1e3eaf,null));};exports[_0x6274('0x91')]=function(_0x43c0c0,_0x53af6c,_0x1406d6){var _0x40185f={};var _0x58d4b6={};var _0x44d460;var _0x31fdea;return db[_0x6274('0x4a')][_0x6274('0x5f')]({'where':{'id':_0x43c0c0[_0x6274('0x4f')]['id']}})['then'](handleEntityNotFound(_0x53af6c,null))['then'](function(_0x2e340e){if(_0x2e340e){_0x44d460=_0x2e340e;_0x58d4b6[_0x6274('0x3c')]=_['keys'](db[_0x6274('0x92')][_0x6274('0x38')]);_0x58d4b6[_0x6274('0x3e')]=_[_0x6274('0x3d')](_0x43c0c0[_0x6274('0x3e')]);_0x58d4b6[_0x6274('0x3f')]=_['intersection'](_0x58d4b6[_0x6274('0x3c')],_0x58d4b6[_0x6274('0x3e')]);_0x40185f[_0x6274('0x41')]=_[_0x6274('0x40')](_0x58d4b6['model'],qs[_0x6274('0x42')](_0x43c0c0[_0x6274('0x3e')][_0x6274('0x42')]));_0x40185f[_0x6274('0x41')]=_0x40185f[_0x6274('0x41')][_0x6274('0x43')]?_0x40185f[_0x6274('0x41')]:_0x58d4b6[_0x6274('0x3c')];_0x40185f['order']=qs[_0x6274('0x45')](_0x43c0c0[_0x6274('0x3e')][_0x6274('0x45')]);_0x40185f['where']=qs[_0x6274('0x3f')](_['pick'](_0x43c0c0[_0x6274('0x3e')],_0x58d4b6[_0x6274('0x3f')]));if(_0x43c0c0[_0x6274('0x3e')][_0x6274('0x49')]){_0x40185f[_0x6274('0x46')]=_[_0x6274('0x31')](_0x40185f[_0x6274('0x46')],{'$or':_[_0x6274('0x37')](_0x40185f[_0x6274('0x41')],function(_0xa5ffbd){var _0xeca774={};_0xeca774[_0xa5ffbd]={'$like':'%'+_0x43c0c0[_0x6274('0x3e')][_0x6274('0x49')]+'%'};return _0xeca774;})});}_0x40185f=_[_0x6274('0x31')]({},_0x40185f,_0x43c0c0[_0x6274('0x63')]);return _0x44d460[_0x6274('0x91')](_0x40185f);}})[_0x6274('0x29')](function(_0x346c09){if(_0x346c09){_0x31fdea=_0x346c09[_0x6274('0x43')];if(!_0x43c0c0[_0x6274('0x3e')][_0x6274('0x61')](_0x6274('0x44'))){_0x40185f[_0x6274('0x21')]=qs[_0x6274('0x21')](_0x43c0c0['query'][_0x6274('0x21')]);_0x40185f[_0x6274('0x20')]=qs[_0x6274('0x20')](_0x43c0c0[_0x6274('0x3e')][_0x6274('0x20')]);}return _0x44d460[_0x6274('0x91')](_0x40185f);}})[_0x6274('0x29')](function(_0x1296a3){if(_0x1296a3){return _0x1296a3?{'count':_0x31fdea,'rows':_0x1296a3}:null;}})[_0x6274('0x29')](respondWithResult(_0x53af6c,null))[_0x6274('0x5c')](handleError(_0x53af6c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0306866..571f1c8 100644 --- a/server/api/openchannelQueue/openchannelQueue.events.js +++ b/server/api/openchannelQueue/openchannelQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9576=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x31f69b,_0xc2314){var _0x4dbf13=function(_0x4c5580){while(--_0x4c5580){_0x31f69b['push'](_0x31f69b['shift']());}};_0x4dbf13(++_0xc2314);}(_0x9576,0xa4));var _0x6957=function(_0x2d16b0,_0x17f000){_0x2d16b0=_0x2d16b0-0x0;var _0x291b9a=_0x9576[_0x2d16b0];return _0x291b9a;};'use strict';var EventEmitter=require(_0x6957('0x0'));var OpenchannelQueue=require(_0x6957('0x1'))['db'][_0x6957('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6957('0x3')](0x0);var events={'afterCreate':_0x6957('0x4'),'afterUpdate':_0x6957('0x5'),'afterDestroy':_0x6957('0x6')};function emitEvent(_0x24bac1){return function(_0x1a683d,_0x5c5adf,_0x3b199a){OpenchannelQueueEvents[_0x6957('0x7')](_0x24bac1+':'+_0x1a683d['id'],_0x1a683d);OpenchannelQueueEvents[_0x6957('0x7')](_0x24bac1,_0x1a683d);_0x3b199a(null);};}for(var e in events){if(events[_0x6957('0x8')](e)){var event=events[e];OpenchannelQueue[_0x6957('0x9')](e,emitEvent(event));}}module[_0x6957('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xc22e=['hasOwnProperty','events','../../mysqldb','OpenchannelQueue','save','remove','emit'];(function(_0xce3741,_0x23c97e){var _0x23158e=function(_0x361fe5){while(--_0x361fe5){_0xce3741['push'](_0xce3741['shift']());}};_0x23158e(++_0x23c97e);}(_0xc22e,0x119));var _0xec22=function(_0x2f78eb,_0xa479d5){_0x2f78eb=_0x2f78eb-0x0;var _0x252e54=_0xc22e[_0x2f78eb];return _0x252e54;};'use strict';var EventEmitter=require(_0xec22('0x0'));var OpenchannelQueue=require(_0xec22('0x1'))['db'][_0xec22('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec22('0x3'),'afterUpdate':'update','afterDestroy':_0xec22('0x4')};function emitEvent(_0x2195c3){return function(_0x2e763b,_0x19d992,_0x1e11c1){OpenchannelQueueEvents[_0xec22('0x5')](_0x2195c3+':'+_0x2e763b['id'],_0x2e763b);OpenchannelQueueEvents[_0xec22('0x5')](_0x2195c3,_0x2e763b);_0x1e11c1(null);};}for(var e in events){if(events[_0xec22('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0bc1d5d..0c48824 100644 --- a/server/api/openchannelQueue/openchannelQueue.model.js +++ b/server/api/openchannelQueue/openchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc302=['OpenchannelQueue','openchannel_queues','lodash','api','bluebird','request-promise','path','rimraf','./openchannelQueue.attributes','define'];(function(_0x217d4c,_0x31dbd8){var _0x5c2fba=function(_0x77c5aa){while(--_0x77c5aa){_0x217d4c['push'](_0x217d4c['shift']());}};_0x5c2fba(++_0x31dbd8);}(_0xc302,0x17e));var _0x2c30=function(_0x5b50a8,_0x346096){_0x5b50a8=_0x5b50a8-0x0;var _0x694327=_0xc302[_0x5b50a8];return _0x694327;};'use strict';var _=require(_0x2c30('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2c30('0x1'));var moment=require('moment');var BPromise=require(_0x2c30('0x2'));var rp=require(_0x2c30('0x3'));var fs=require('fs');var path=require(_0x2c30('0x4'));var rimraf=require(_0x2c30('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c30('0x6'));module['exports']=function(_0x4e4081,_0x43c6cb){return _0x4e4081[_0x2c30('0x7')](_0x2c30('0x8'),attributes,{'tableName':_0x2c30('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5047=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x46fb11,_0x9d13f){var _0x5c83f1=function(_0x456219){while(--_0x456219){_0x46fb11['push'](_0x46fb11['shift']());}};_0x5c83f1(++_0x9d13f);}(_0x5047,0xe0));var _0x7504=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x5047[_0xf51c06];return _0x1d5420;};'use strict';var _=require(_0x7504('0x0'));var util=require(_0x7504('0x1'));var logger=require(_0x7504('0x2'))(_0x7504('0x3'));var moment=require(_0x7504('0x4'));var BPromise=require(_0x7504('0x5'));var rp=require(_0x7504('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7504('0x7'));var config=require(_0x7504('0x8'));var attributes=require(_0x7504('0x9'));module['exports']=function(_0x1c6df5,_0x2088df){return _0x1c6df5[_0x7504('0xa')](_0x7504('0xb'),attributes,{'tableName':_0x7504('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 21d6ea7..350eae2 100644 --- a/server/api/openchannelQueue/openchannelQueue.rpc.js +++ b/server/api/openchannelQueue/openchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a49=['where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','attributes','map','model','stringify','catch','ShowOpenchannelQueue','find'];(function(_0x5519ba,_0x583039){var _0xa16629=function(_0x31a274){while(--_0x31a274){_0x5519ba['push'](_0x5519ba['shift']());}};_0xa16629(++_0x583039);}(_0x9a49,0xce));var _0x99a4=function(_0x3f4528,_0x57b7f5){_0x3f4528=_0x3f4528-0x0;var _0x4507b3=_0x9a49[_0x3f4528];return _0x4507b3;};'use strict';var _=require(_0x99a4('0x0'));var util=require('util');var moment=require(_0x99a4('0x1'));var BPromise=require(_0x99a4('0x2'));var rs=require(_0x99a4('0x3'));var fs=require('fs');var Redis=require(_0x99a4('0x4'));var db=require(_0x99a4('0x5'))['db'];var utils=require(_0x99a4('0x6'));var logger=require('../../config/logger')(_0x99a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x99a4('0x8'));var client=jayson[_0x99a4('0x9')][_0x99a4('0xa')]({'port':0x232a});config['redis']=_[_0x99a4('0xb')](config['redis'],{'host':_0x99a4('0xc'),'port':0x18eb});var socket=require(_0x99a4('0xd'))(new Redis(config[_0x99a4('0xe')]));require('./openchannelQueue.socket')[_0x99a4('0xf')](socket);function respondWithRpcPromise(_0xb84ee6,_0x4ebef2,_0x370abe){return new BPromise(function(_0x46e1de,_0x4e92c1){return client[_0x99a4('0x10')](_0xb84ee6,_0x370abe)[_0x99a4('0x11')](function(_0x4bce57){logger[_0x99a4('0x12')](_0x99a4('0x13'),_0x4ebef2,_0x99a4('0x14'));logger[_0x99a4('0x15')](_0x99a4('0x16'),_0x4ebef2,_0x99a4('0x14'),JSON['stringify'](_0x4bce57));if(_0x4bce57[_0x99a4('0x17')]){if(_0x4bce57[_0x99a4('0x17')][_0x99a4('0x18')]===0x1f4){logger[_0x99a4('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ebef2,_0x4bce57[_0x99a4('0x17')]['message']);return _0x4e92c1(_0x4bce57['error']['message']);}logger[_0x99a4('0x17')](_0x99a4('0x13'),_0x4ebef2,_0x4bce57['error'][_0x99a4('0x19')]);return _0x46e1de(_0x4bce57['error'][_0x99a4('0x19')]);}else{logger[_0x99a4('0x12')](_0x99a4('0x13'),_0x4ebef2,_0x99a4('0x14'));_0x46e1de(_0x4bce57['result'][_0x99a4('0x19')]);}})['catch'](function(_0x27e81d){logger[_0x99a4('0x17')](_0x99a4('0x13'),_0x4ebef2,_0x27e81d);_0x4e92c1(_0x27e81d);});});}exports[_0x99a4('0x1a')]=function(_0x4abec5){var _0x84e344=this;return new Promise(function(_0x15cc82,_0x2848dd){return db[_0x99a4('0x1b')][_0x99a4('0x1c')]({'raw':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5[_0x99a4('0x1d')][_0x99a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5[_0x99a4('0x1d')]['where']||null:null,'attributes':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5['options']['attributes']||null:null,'limit':_0x4abec5['options']?_0x4abec5[_0x99a4('0x1d')][_0x99a4('0x1f')]||null:null,'include':_0x4abec5[_0x99a4('0x1d')]?_0x4abec5['options'][_0x99a4('0x20')]?_['map'](_0x4abec5[_0x99a4('0x1d')][_0x99a4('0x20')],function(_0x57c78a){return{'model':db[_0x57c78a['model']],'as':_0x57c78a['as'],'attributes':_0x57c78a[_0x99a4('0x21')],'include':_0x57c78a['include']?_[_0x99a4('0x22')](_0x57c78a[_0x99a4('0x20')],function(_0x43ece1){return{'model':db[_0x43ece1[_0x99a4('0x23')]],'as':_0x43ece1['as'],'attributes':_0x43ece1[_0x99a4('0x21')],'include':_0x43ece1[_0x99a4('0x20')]?_['map'](_0x43ece1[_0x99a4('0x20')],function(_0x26a9e9){return{'model':db[_0x26a9e9[_0x99a4('0x23')]],'as':_0x26a9e9['as'],'attributes':_0x26a9e9[_0x99a4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x99a4('0x11')](function(_0xf686a7){logger[_0x99a4('0x12')]('GetOpenchannelQueue',_0x4abec5);logger[_0x99a4('0x15')]('GetOpenchannelQueue',_0x4abec5,JSON[_0x99a4('0x24')](_0xf686a7));_0x15cc82(_0xf686a7);})[_0x99a4('0x25')](function(_0x33a190){logger['error'](_0x99a4('0x1a'),_0x33a190[_0x99a4('0x19')],_0x4abec5);_0x2848dd(_0x84e344[_0x99a4('0x17')](0x1f4,_0x33a190[_0x99a4('0x19')]));});});};exports[_0x99a4('0x26')]=function(_0x2bdb9f){var _0x30b8a7=this;return new Promise(function(_0xf463bf,_0x4bf8dc){return db['OpenchannelQueue'][_0x99a4('0x27')]({'raw':_0x2bdb9f['options']?_0x2bdb9f[_0x99a4('0x1d')][_0x99a4('0x1e')]===undefined?!![]:![]:!![],'where':_0x2bdb9f[_0x99a4('0x1d')]?_0x2bdb9f[_0x99a4('0x1d')][_0x99a4('0x28')]||null:null,'attributes':_0x2bdb9f[_0x99a4('0x1d')]?_0x2bdb9f[_0x99a4('0x1d')]['attributes']||null:null,'include':_0x2bdb9f['options']?_0x2bdb9f['options'][_0x99a4('0x20')]?_['map'](_0x2bdb9f[_0x99a4('0x1d')][_0x99a4('0x20')],function(_0x19190e){return{'model':db[_0x19190e[_0x99a4('0x23')]],'as':_0x19190e['as'],'attributes':_0x19190e[_0x99a4('0x21')],'include':_0x19190e[_0x99a4('0x20')]?_[_0x99a4('0x22')](_0x19190e[_0x99a4('0x20')],function(_0x3babb7){return{'model':db[_0x3babb7['model']],'as':_0x3babb7['as'],'attributes':_0x3babb7[_0x99a4('0x21')],'include':_0x3babb7['include']?_[_0x99a4('0x22')](_0x3babb7[_0x99a4('0x20')],function(_0x1cae1a){return{'model':db[_0x1cae1a['model']],'as':_0x1cae1a['as'],'attributes':_0x1cae1a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4340ca){logger[_0x99a4('0x12')](_0x99a4('0x26'),_0x2bdb9f);logger[_0x99a4('0x15')](_0x99a4('0x26'),_0x2bdb9f,JSON['stringify'](_0x4340ca));_0xf463bf(_0x4340ca);})[_0x99a4('0x25')](function(_0x23c96d){logger['error'](_0x99a4('0x26'),_0x23c96d[_0x99a4('0x19')],_0x2bdb9f);_0x4bf8dc(_0x30b8a7[_0x99a4('0x17')](0x1f4,_0x23c96d[_0x99a4('0x19')]));});});}; \ No newline at end of file +var _0x7f9e=['error','code','message','result','catch','OpenchannelQueue','findAll','options','where','attributes','map','include','model','then','GetOpenchannelQueue','debug','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x26cf72,_0x40e1a8){var _0x325a8b=function(_0x3e7177){while(--_0x3e7177){_0x26cf72['push'](_0x26cf72['shift']());}};_0x325a8b(++_0x40e1a8);}(_0x7f9e,0x18e));var _0xe7f9=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x7f9e[_0x3358ba];return _0x296e73;};'use strict';var _=require(_0xe7f9('0x0'));var util=require(_0xe7f9('0x1'));var moment=require('moment');var BPromise=require(_0xe7f9('0x2'));var rs=require(_0xe7f9('0x3'));var fs=require('fs');var Redis=require(_0xe7f9('0x4'));var db=require(_0xe7f9('0x5'))['db'];var utils=require(_0xe7f9('0x6'));var logger=require('../../config/logger')(_0xe7f9('0x7'));var config=require(_0xe7f9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe7f9('0x9')]({'port':0x232a});config[_0xe7f9('0xa')]=_['defaults'](config[_0xe7f9('0xa')],{'host':_0xe7f9('0xb'),'port':0x18eb});var socket=require(_0xe7f9('0xc'))(new Redis(config['redis']));require(_0xe7f9('0xd'))['register'](socket);function respondWithRpcPromise(_0x9251c5,_0x56a631,_0x3364e8){return new BPromise(function(_0x59ca6e,_0x111e4b){return client[_0xe7f9('0xe')](_0x9251c5,_0x3364e8)['then'](function(_0xbe87b0){logger[_0xe7f9('0xf')](_0xe7f9('0x10'),_0x56a631,_0xe7f9('0x11'));logger['debug'](_0xe7f9('0x12'),_0x56a631,'request\x20sent',JSON[_0xe7f9('0x13')](_0xbe87b0));if(_0xbe87b0[_0xe7f9('0x14')]){if(_0xbe87b0[_0xe7f9('0x14')][_0xe7f9('0x15')]===0x1f4){logger[_0xe7f9('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x56a631,_0xbe87b0['error']['message']);return _0x111e4b(_0xbe87b0[_0xe7f9('0x14')]['message']);}logger[_0xe7f9('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x56a631,_0xbe87b0[_0xe7f9('0x14')][_0xe7f9('0x16')]);return _0x59ca6e(_0xbe87b0[_0xe7f9('0x14')]['message']);}else{logger[_0xe7f9('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x56a631,_0xe7f9('0x11'));_0x59ca6e(_0xbe87b0[_0xe7f9('0x17')][_0xe7f9('0x16')]);}})[_0xe7f9('0x18')](function(_0x2ddeaa){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x56a631,_0x2ddeaa);_0x111e4b(_0x2ddeaa);});});}exports['GetOpenchannelQueue']=function(_0x14dd88){var _0x26cb63=this;return new Promise(function(_0x2a33c9,_0x29ebac){return db[_0xe7f9('0x19')][_0xe7f9('0x1a')]({'raw':_0x14dd88['options']?_0x14dd88[_0xe7f9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x14dd88[_0xe7f9('0x1b')]?_0x14dd88['options'][_0xe7f9('0x1c')]||null:null,'attributes':_0x14dd88[_0xe7f9('0x1b')]?_0x14dd88[_0xe7f9('0x1b')][_0xe7f9('0x1d')]||null:null,'limit':_0x14dd88[_0xe7f9('0x1b')]?_0x14dd88[_0xe7f9('0x1b')]['limit']||null:null,'include':_0x14dd88[_0xe7f9('0x1b')]?_0x14dd88[_0xe7f9('0x1b')]['include']?_[_0xe7f9('0x1e')](_0x14dd88['options'][_0xe7f9('0x1f')],function(_0x3bee03){return{'model':db[_0x3bee03[_0xe7f9('0x20')]],'as':_0x3bee03['as'],'attributes':_0x3bee03[_0xe7f9('0x1d')],'include':_0x3bee03[_0xe7f9('0x1f')]?_['map'](_0x3bee03['include'],function(_0x3e4077){return{'model':db[_0x3e4077[_0xe7f9('0x20')]],'as':_0x3e4077['as'],'attributes':_0x3e4077[_0xe7f9('0x1d')],'include':_0x3e4077[_0xe7f9('0x1f')]?_[_0xe7f9('0x1e')](_0x3e4077[_0xe7f9('0x1f')],function(_0x215832){return{'model':db[_0x215832[_0xe7f9('0x20')]],'as':_0x215832['as'],'attributes':_0x215832['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7f9('0x21')](function(_0x409728){logger[_0xe7f9('0xf')](_0xe7f9('0x22'),_0x14dd88);logger[_0xe7f9('0x23')](_0xe7f9('0x22'),_0x14dd88,JSON[_0xe7f9('0x13')](_0x409728));_0x2a33c9(_0x409728);})[_0xe7f9('0x18')](function(_0x33b4d2){logger['error'](_0xe7f9('0x22'),_0x33b4d2[_0xe7f9('0x16')],_0x14dd88);_0x29ebac(_0x26cb63[_0xe7f9('0x14')](0x1f4,_0x33b4d2['message']));});});};exports[_0xe7f9('0x24')]=function(_0x214be6){var _0x4f229d=this;return new Promise(function(_0x4ed072,_0x5b52c8){return db[_0xe7f9('0x19')][_0xe7f9('0x25')]({'raw':_0x214be6[_0xe7f9('0x1b')]?_0x214be6[_0xe7f9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x214be6[_0xe7f9('0x1b')]?_0x214be6[_0xe7f9('0x1b')][_0xe7f9('0x1c')]||null:null,'attributes':_0x214be6['options']?_0x214be6[_0xe7f9('0x1b')]['attributes']||null:null,'include':_0x214be6[_0xe7f9('0x1b')]?_0x214be6[_0xe7f9('0x1b')]['include']?_[_0xe7f9('0x1e')](_0x214be6['options']['include'],function(_0x51ae78){return{'model':db[_0x51ae78['model']],'as':_0x51ae78['as'],'attributes':_0x51ae78['attributes'],'include':_0x51ae78[_0xe7f9('0x1f')]?_[_0xe7f9('0x1e')](_0x51ae78['include'],function(_0x47fb1d){return{'model':db[_0x47fb1d[_0xe7f9('0x20')]],'as':_0x47fb1d['as'],'attributes':_0x47fb1d[_0xe7f9('0x1d')],'include':_0x47fb1d['include']?_[_0xe7f9('0x1e')](_0x47fb1d['include'],function(_0x2994cd){return{'model':db[_0x2994cd[_0xe7f9('0x20')]],'as':_0x2994cd['as'],'attributes':_0x2994cd['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7f9('0x21')](function(_0x47d918){logger[_0xe7f9('0xf')](_0xe7f9('0x24'),_0x214be6);logger['debug'](_0xe7f9('0x24'),_0x214be6,JSON[_0xe7f9('0x13')](_0x47d918));_0x4ed072(_0x47d918);})[_0xe7f9('0x18')](function(_0x27eb50){logger[_0xe7f9('0x14')](_0xe7f9('0x24'),_0x27eb50['message'],_0x214be6);_0x5b52c8(_0x4f229d[_0xe7f9('0x14')](0x1f4,_0x27eb50['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 68d2db8..16f437e 100644 --- a/server/api/openchannelQueue/openchannelQueue.socket.js +++ b/server/api/openchannelQueue/openchannelQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2167=['update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x5bdc5e,_0x342a67){var _0x1c22ac=function(_0x20b1d5){while(--_0x20b1d5){_0x5bdc5e['push'](_0x5bdc5e['shift']());}};_0x1c22ac(++_0x342a67);}(_0x2167,0xc5));var _0x7216=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2167[_0x2b4411];return _0x8e41ef;};'use strict';var OpenchannelQueueEvents=require(_0x7216('0x0'));var events=[_0x7216('0x1'),_0x7216('0x2'),_0x7216('0x3')];function createListener(_0x2d2713,_0x34718a){return function(_0x114e00){_0x34718a['emit'](_0x2d2713,_0x114e00);};}function removeListener(_0x51d0ab,_0x7e77ed){return function(){OpenchannelQueueEvents[_0x7216('0x4')](_0x51d0ab,_0x7e77ed);};}exports[_0x7216('0x5')]=function(_0x414623){for(var _0xbd3cd1=0x0,_0x36b7e1=events[_0x7216('0x6')];_0xbd3cd1<_0x36b7e1;_0xbd3cd1++){var _0x41a2c2=events[_0xbd3cd1];var _0x4c662c=createListener(_0x7216('0x7')+_0x41a2c2,_0x414623);OpenchannelQueueEvents['on'](_0x41a2c2,_0x4c662c);}}; \ No newline at end of file +var _0x6c45=['openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register'];(function(_0x1f02ee,_0x3f937a){var _0x4758e6=function(_0x2363e6){while(--_0x2363e6){_0x1f02ee['push'](_0x1f02ee['shift']());}};_0x4758e6(++_0x3f937a);}(_0x6c45,0xd3));var _0x56c4=function(_0x484bfe,_0x2304d7){_0x484bfe=_0x484bfe-0x0;var _0x242c63=_0x6c45[_0x484bfe];return _0x242c63;};'use strict';var OpenchannelQueueEvents=require(_0x56c4('0x0'));var events=[_0x56c4('0x1'),'remove',_0x56c4('0x2')];function createListener(_0x22369a,_0x3b578e){return function(_0x5847a1){_0x3b578e[_0x56c4('0x3')](_0x22369a,_0x5847a1);};}function removeListener(_0x1861c6,_0x3e3c86){return function(){OpenchannelQueueEvents[_0x56c4('0x4')](_0x1861c6,_0x3e3c86);};}exports[_0x56c4('0x5')]=function(_0x5d2817){for(var _0x1a4d3c=0x0,_0x44ba50=events['length'];_0x1a4d3c<_0x44ba50;_0x1a4d3c++){var _0x866646=events[_0x1a4d3c];var _0x430e7e=createListener(_0x56c4('0x6')+_0x866646,_0x5d2817);OpenchannelQueueEvents['on'](_0x866646,_0x430e7e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2382c4b..709dc13 100644 --- a/server/api/openchannelQueueReport/index.js +++ b/server/api/openchannelQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60d6=['post','put','update','destroy','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show'];(function(_0x1519b7,_0x228318){var _0x2a17a7=function(_0x512a8c){while(--_0x512a8c){_0x1519b7['push'](_0x1519b7['shift']());}};_0x2a17a7(++_0x228318);}(_0x60d6,0x1b7));var _0x660d=function(_0x49abd4,_0x168516){_0x49abd4=_0x49abd4-0x0;var _0x38f7c3=_0x60d6[_0x49abd4];return _0x38f7c3;};'use strict';var multer=require(_0x660d('0x0'));var util=require(_0x660d('0x1'));var path=require('path');var timeout=require(_0x660d('0x2'));var express=require(_0x660d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x660d('0x4'));var config=require(_0x660d('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x660d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x660d('0x6')](_0x660d('0x7'),auth[_0x660d('0x8')](),controller['describe']);router[_0x660d('0x6')](_0x660d('0x9'),auth['isAuthenticated'](),controller[_0x660d('0xa')]);router[_0x660d('0xb')]('/',auth[_0x660d('0x8')](),controller['create']);router[_0x660d('0xc')](_0x660d('0x9'),auth[_0x660d('0x8')](),controller[_0x660d('0xd')]);router['delete'](_0x660d('0x9'),auth[_0x660d('0x8')](),controller[_0x660d('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9d1c=['isAuthenticated','index','/describe','describe','/:id','show','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get'];(function(_0x2cbca7,_0x2c0542){var _0x282c25=function(_0x1c8f93){while(--_0x1c8f93){_0x2cbca7['push'](_0x2cbca7['shift']());}};_0x282c25(++_0x2c0542);}(_0x9d1c,0x186));var _0xc9d1=function(_0xf16db9,_0x9b93bf){_0xf16db9=_0xf16db9-0x0;var _0x4d27c6=_0x9d1c[_0xf16db9];return _0x4d27c6;};'use strict';var multer=require(_0xc9d1('0x0'));var util=require('util');var path=require(_0xc9d1('0x1'));var timeout=require('connect-timeout');var express=require(_0xc9d1('0x2'));var router=express[_0xc9d1('0x3')]();var fs_extra=require(_0xc9d1('0x4'));var auth=require(_0xc9d1('0x5'));var interaction=require(_0xc9d1('0x6'));var config=require(_0xc9d1('0x7'));var controller=require(_0xc9d1('0x8'));router[_0xc9d1('0x9')]('/',auth[_0xc9d1('0xa')](),controller[_0xc9d1('0xb')]);router[_0xc9d1('0x9')](_0xc9d1('0xc'),auth['isAuthenticated'](),controller[_0xc9d1('0xd')]);router[_0xc9d1('0x9')](_0xc9d1('0xe'),auth[_0xc9d1('0xa')](),controller[_0xc9d1('0xf')]);router['post']('/',auth[_0xc9d1('0xa')](),controller[_0xc9d1('0x10')]);router[_0xc9d1('0x11')](_0xc9d1('0xe'),auth[_0xc9d1('0xa')](),controller[_0xc9d1('0x12')]);router['delete']('/:id',auth[_0xc9d1('0xa')](),controller['destroy']);module[_0xc9d1('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index b5b67fa..7624ab9 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dbc=['STRING','DATE','moment','sequelize','exports'];(function(_0x397f34,_0x3ac328){var _0x272cda=function(_0x2c9756){while(--_0x2c9756){_0x397f34['push'](_0x397f34['shift']());}};_0x272cda(++_0x3ac328);}(_0x7dbc,0xcf));var _0xc7db=function(_0x4e073c,_0x47fdf0){_0x4e073c=_0x4e073c-0x0;var _0x672639=_0x7dbc[_0x4e073c];return _0x672639;};'use strict';var moment=require(_0xc7db('0x0'));var Sequelize=require(_0xc7db('0x1'));module[_0xc7db('0x2')]={'uniqueid':{'type':Sequelize[_0xc7db('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc7db('0x3')]},'joinAt':{'type':Sequelize[_0xc7db('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc7db('0x4')]},'exitAt':{'type':Sequelize[_0xc7db('0x4')]},'reason':{'type':Sequelize[_0xc7db('0x3')]}}; \ No newline at end of file +var _0x81ac=['moment','sequelize','exports','STRING','DATE'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x81ac,0x168));var _0xc81a=function(_0x4bcdf6,_0x38f34a){_0x4bcdf6=_0x4bcdf6-0x0;var _0x8041c=_0x81ac[_0x4bcdf6];return _0x8041c;};'use strict';var moment=require(_0xc81a('0x0'));var Sequelize=require(_0xc81a('0x1'));module[_0xc81a('0x2')]={'uniqueid':{'type':Sequelize[_0xc81a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc81a('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc81a('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc81a('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 42ae8a4..216c07a 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac8d=['findAll','rows','catch','show','params','intersection','options','create','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','then','name','send','render','merge','body','contact','message','agent','interaction','account','map','OpenchannelQueueReport','rawAttributes','fieldName','type','keys','query','model','attributes','fields','hasOwnProperty','nolimit','filters','pick','filter','where','includeAll','include'];(function(_0x3048fa,_0x21f9ee){var _0x59fc63=function(_0x4ae1a2){while(--_0x4ae1a2){_0x3048fa['push'](_0x3048fa['shift']());}};_0x59fc63(++_0x21f9ee);}(_0xac8d,0x1d8));var _0xdac8=function(_0x32a923,_0x524c14){_0x32a923=_0x32a923-0x0;var _0x11677d=_0xac8d[_0x32a923];return _0x11677d;};'use strict';var emlformat=require(_0xdac8('0x0'));var rimraf=require(_0xdac8('0x1'));var zipdir=require(_0xdac8('0x2'));var jsonpatch=require(_0xdac8('0x3'));var rp=require(_0xdac8('0x4'));var moment=require('moment');var BPromise=require(_0xdac8('0x5'));var Mustache=require('mustache');var util=require(_0xdac8('0x6'));var path=require(_0xdac8('0x7'));var sox=require(_0xdac8('0x8'));var csv=require(_0xdac8('0x9'));var ejs=require(_0xdac8('0xa'));var fs=require('fs');var fs_extra=require(_0xdac8('0xb'));var _=require(_0xdac8('0xc'));var squel=require(_0xdac8('0xd'));var crypto=require(_0xdac8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac8('0x10'));var Papa=require(_0xdac8('0x11'));var Redis=require('ioredis');var authService=require(_0xdac8('0x12'));var qs=require(_0xdac8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdac8('0x14'));var logger=require(_0xdac8('0x15'))('api');var utils=require(_0xdac8('0x16'));var config=require(_0xdac8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x140c24,_0x2b187c){_0x2b187c=_0x2b187c||0xcc;return function(_0x272916){if(_0x272916){return _0x140c24[_0xdac8('0x18')](_0x2b187c);}return _0x140c24[_0xdac8('0x19')](_0x2b187c)[_0xdac8('0x1a')]();};}function respondWithResult(_0x563795,_0x5cca12){_0x5cca12=_0x5cca12||0xc8;return function(_0x1cbff3){if(_0x1cbff3){return _0x563795[_0xdac8('0x19')](_0x5cca12)[_0xdac8('0x1b')](_0x1cbff3);}};}function respondWithFilteredResult(_0x1b25d8,_0x49481a){return function(_0x3d4920){if(_0x3d4920){var _0x1de867=typeof _0x49481a['offset']==='undefined'&&typeof _0x49481a[_0xdac8('0x1c')]===_0xdac8('0x1d');var _0x44b5e9=_0x3d4920[_0xdac8('0x1e')];var _0x26a7f0=_0x1de867?0x0:_0x49481a[_0xdac8('0x1f')];var _0x315601=_0x1de867?_0x3d4920['count']:_0x49481a['offset']+_0x49481a[_0xdac8('0x1c')];var _0x50e9ed;if(_0x315601>=_0x44b5e9){_0x315601=_0x44b5e9;_0x50e9ed=0xc8;}else{_0x50e9ed=0xce;}_0x1b25d8[_0xdac8('0x19')](_0x50e9ed);return _0x1b25d8[_0xdac8('0x20')](_0xdac8('0x21'),_0x26a7f0+'-'+_0x315601+'/'+_0x44b5e9)[_0xdac8('0x1b')](_0x3d4920);}return null;};}function patchUpdates(_0x26b30f){return function(_0x3839a8){try{jsonpatch[_0xdac8('0x22')](_0x3839a8,_0x26b30f,!![]);}catch(_0x1e101e){return BPromise[_0xdac8('0x23')](_0x1e101e);}return _0x3839a8['save']();};}function saveUpdates(_0xd37405,_0x24b189){return function(_0xee1a32){if(_0xee1a32){return _0xee1a32[_0xdac8('0x24')](_0xd37405)['then'](function(_0x52da68){return _0x52da68;});}return null;};}function removeEntity(_0x143b79,_0x38525c){return function(_0x111ec3){if(_0x111ec3){return _0x111ec3[_0xdac8('0x25')]()[_0xdac8('0x26')](function(){_0x143b79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x181842,_0x1dbe67){return function(_0x495900){if(!_0x495900){_0x181842['sendStatus'](0x194);}return _0x495900;};}function handleError(_0x3aeedf,_0xd21a47){_0xd21a47=_0xd21a47||0x1f4;return function(_0x470985){logger['error'](_0x470985['stack']);if(_0x470985[_0xdac8('0x27')]){delete _0x470985[_0xdac8('0x27')];}_0x3aeedf[_0xdac8('0x19')](_0xd21a47)[_0xdac8('0x28')](_0x470985);};}function getMustacheRender(_0x304b6c,_0x5d30f3){return Mustache[_0xdac8('0x29')](_0x304b6c,_[_0xdac8('0x2a')](_0x5d30f3[_0xdac8('0x2b')],{'contact':_0x5d30f3[_0xdac8('0x2c')],'message':_0x5d30f3[_0xdac8('0x2d')],'agent':_0x5d30f3[_0xdac8('0x2e')],'interaction':_0x5d30f3[_0xdac8('0x2f')],'account':_0x5d30f3[_0xdac8('0x30')]}))||'';}exports['index']=function(_0x17d023,_0x3bda2a){var _0x19f064={},_0x76625b={},_0x4b19cf={'count':0x0,'rows':[]};var _0x5eddbd=_[_0xdac8('0x31')](db[_0xdac8('0x32')][_0xdac8('0x33')],function(_0x38b2e6){return{'name':_0x38b2e6[_0xdac8('0x34')],'type':_0x38b2e6[_0xdac8('0x35')]['key']};});_0x76625b['model']=_[_0xdac8('0x31')](_0x5eddbd,_0xdac8('0x27'));_0x76625b['query']=_[_0xdac8('0x36')](_0x17d023[_0xdac8('0x37')]);_0x76625b['filters']=_['intersection'](_0x76625b[_0xdac8('0x38')],_0x76625b['query']);_0x19f064[_0xdac8('0x39')]=_['intersection'](_0x76625b[_0xdac8('0x38')],qs[_0xdac8('0x3a')](_0x17d023['query'][_0xdac8('0x3a')]));_0x19f064[_0xdac8('0x39')]=_0x19f064[_0xdac8('0x39')]['length']?_0x19f064['attributes']:_0x76625b[_0xdac8('0x38')];if(!_0x17d023['query'][_0xdac8('0x3b')](_0xdac8('0x3c'))){_0x19f064[_0xdac8('0x1c')]=qs[_0xdac8('0x1c')](_0x17d023['query']['limit']);_0x19f064[_0xdac8('0x1f')]=qs[_0xdac8('0x1f')](_0x17d023[_0xdac8('0x37')]['offset']);}_0x19f064['order']=qs['sort'](_0x17d023[_0xdac8('0x37')]['sort']);_0x19f064['where']=qs[_0xdac8('0x3d')](_[_0xdac8('0x3e')](_0x17d023[_0xdac8('0x37')],_0x76625b[_0xdac8('0x3d')]),_0x5eddbd);if(_0x17d023['query'][_0xdac8('0x3f')]){_0x19f064['where']=_[_0xdac8('0x2a')](_0x19f064['where'],{'$or':_[_0xdac8('0x31')](_0x5eddbd,function(_0xc5c7ac){if(_0xc5c7ac[_0xdac8('0x35')]!=='VIRTUAL'){var _0x19412c={};_0x19412c[_0xc5c7ac[_0xdac8('0x27')]]={'$like':'%'+_0x17d023[_0xdac8('0x37')][_0xdac8('0x3f')]+'%'};return _0x19412c;}})});}_0x19f064=_[_0xdac8('0x2a')]({},_0x19f064,_0x17d023['options']);var _0x31f7bd={'where':_0x19f064[_0xdac8('0x40')]};return db[_0xdac8('0x32')][_0xdac8('0x1e')](_0x31f7bd)[_0xdac8('0x26')](function(_0x349c69){_0x4b19cf[_0xdac8('0x1e')]=_0x349c69;if(_0x17d023[_0xdac8('0x37')][_0xdac8('0x41')]){_0x19f064[_0xdac8('0x42')]=[{'all':!![]}];}return db[_0xdac8('0x32')][_0xdac8('0x43')](_0x19f064);})[_0xdac8('0x26')](function(_0x1535a0){_0x4b19cf[_0xdac8('0x44')]=_0x1535a0;return _0x4b19cf;})['then'](respondWithFilteredResult(_0x3bda2a,_0x19f064))[_0xdac8('0x45')](handleError(_0x3bda2a,null));};exports[_0xdac8('0x46')]=function(_0x23bf1a,_0x495d28){var _0x5283a0={'raw':!![],'where':{'id':_0x23bf1a[_0xdac8('0x47')]['id']}},_0x15c137={};_0x15c137['model']=_[_0xdac8('0x36')](db[_0xdac8('0x32')][_0xdac8('0x33')]);_0x15c137[_0xdac8('0x37')]=_[_0xdac8('0x36')](_0x23bf1a[_0xdac8('0x37')]);_0x15c137['filters']=_[_0xdac8('0x48')](_0x15c137[_0xdac8('0x38')],_0x15c137[_0xdac8('0x37')]);_0x5283a0[_0xdac8('0x39')]=_[_0xdac8('0x48')](_0x15c137[_0xdac8('0x38')],qs[_0xdac8('0x3a')](_0x23bf1a[_0xdac8('0x37')]['fields']));_0x5283a0[_0xdac8('0x39')]=_0x5283a0[_0xdac8('0x39')]['length']?_0x5283a0[_0xdac8('0x39')]:_0x15c137['model'];if(_0x23bf1a['query'][_0xdac8('0x41')]){_0x5283a0[_0xdac8('0x42')]=[{'all':!![]}];}_0x5283a0=_[_0xdac8('0x2a')]({},_0x5283a0,_0x23bf1a[_0xdac8('0x49')]);return db['OpenchannelQueueReport']['find'](_0x5283a0)[_0xdac8('0x26')](handleEntityNotFound(_0x495d28,null))[_0xdac8('0x26')](respondWithResult(_0x495d28,null))[_0xdac8('0x45')](handleError(_0x495d28,null));};exports[_0xdac8('0x4a')]=function(_0x459273,_0x4d2165){return db[_0xdac8('0x32')][_0xdac8('0x4a')](_0x459273['body'],{})[_0xdac8('0x26')](respondWithResult(_0x4d2165,0xc9))[_0xdac8('0x45')](handleError(_0x4d2165,null));};exports['update']=function(_0x40ca73,_0x3de0dc){if(_0x40ca73['body']['id']){delete _0x40ca73['body']['id'];}return db['OpenchannelQueueReport'][_0xdac8('0x4b')]({'where':{'id':_0x40ca73[_0xdac8('0x47')]['id']}})['then'](handleEntityNotFound(_0x3de0dc,null))[_0xdac8('0x26')](saveUpdates(_0x40ca73[_0xdac8('0x2b')],null))['then'](respondWithResult(_0x3de0dc,null))[_0xdac8('0x45')](handleError(_0x3de0dc,null));};exports[_0xdac8('0x25')]=function(_0x3208d4,_0x4784a7){return db['OpenchannelQueueReport'][_0xdac8('0x4b')]({'where':{'id':_0x3208d4[_0xdac8('0x47')]['id']}})[_0xdac8('0x26')](handleEntityNotFound(_0x4784a7,null))['then'](removeEntity(_0x4784a7,null))[_0xdac8('0x45')](handleError(_0x4784a7,null));};exports[_0xdac8('0x4c')]=function(_0x5c3568,_0x31c7c9){return db[_0xdac8('0x32')][_0xdac8('0x4c')]()[_0xdac8('0x26')](respondWithResult(_0x31c7c9,null))[_0xdac8('0x45')](handleError(_0x31c7c9,null));}; \ No newline at end of file +var _0x4e37=['name','send','merge','body','contact','message','agent','account','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack'];(function(_0x18fbf0,_0x3829b7){var _0x17bb4f=function(_0x4447fd){while(--_0x4447fd){_0x18fbf0['push'](_0x18fbf0['shift']());}};_0x17bb4f(++_0x3829b7);}(_0x4e37,0x1a8));var _0x74e3=function(_0x526074,_0x5e5d09){_0x526074=_0x526074-0x0;var _0x83c6c8=_0x4e37[_0x526074];return _0x83c6c8;};'use strict';var emlformat=require(_0x74e3('0x0'));var rimraf=require(_0x74e3('0x1'));var zipdir=require(_0x74e3('0x2'));var jsonpatch=require(_0x74e3('0x3'));var rp=require(_0x74e3('0x4'));var moment=require(_0x74e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74e3('0x6'));var util=require(_0x74e3('0x7'));var path=require(_0x74e3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x74e3('0x9'));var fs=require('fs');var fs_extra=require(_0x74e3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74e3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x74e3('0xc'));var querystring=require(_0x74e3('0xd'));var Papa=require('papaparse');var Redis=require(_0x74e3('0xe'));var authService=require(_0x74e3('0xf'));var qs=require(_0x74e3('0x10'));var as=require(_0x74e3('0x11'));var hardwareService=require(_0x74e3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x74e3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x74e3('0x14'));var db=require(_0x74e3('0x15'))['db'];function respondWithStatusCode(_0x4ff1ce,_0x187ad9){_0x187ad9=_0x187ad9||0xcc;return function(_0x5488dd){if(_0x5488dd){return _0x4ff1ce[_0x74e3('0x16')](_0x187ad9);}return _0x4ff1ce[_0x74e3('0x17')](_0x187ad9)[_0x74e3('0x18')]();};}function respondWithResult(_0x183d78,_0xb70b8c){_0xb70b8c=_0xb70b8c||0xc8;return function(_0x35165f){if(_0x35165f){return _0x183d78[_0x74e3('0x17')](_0xb70b8c)[_0x74e3('0x19')](_0x35165f);}};}function respondWithFilteredResult(_0x34e0a1,_0x5ef618){return function(_0x288502){if(_0x288502){var _0x32cf69=typeof _0x5ef618[_0x74e3('0x1a')]===_0x74e3('0x1b')&&typeof _0x5ef618[_0x74e3('0x1c')]==='undefined';var _0x8280f5=_0x288502[_0x74e3('0x1d')];var _0xbefc25=_0x32cf69?0x0:_0x5ef618[_0x74e3('0x1a')];var _0x13a224=_0x32cf69?_0x288502[_0x74e3('0x1d')]:_0x5ef618[_0x74e3('0x1a')]+_0x5ef618[_0x74e3('0x1c')];var _0x1fa123;if(_0x13a224>=_0x8280f5){_0x13a224=_0x8280f5;_0x1fa123=0xc8;}else{_0x1fa123=0xce;}_0x34e0a1[_0x74e3('0x17')](_0x1fa123);return _0x34e0a1['set'](_0x74e3('0x1e'),_0xbefc25+'-'+_0x13a224+'/'+_0x8280f5)[_0x74e3('0x19')](_0x288502);}return null;};}function patchUpdates(_0x20c92d){return function(_0x1cbc06){try{jsonpatch[_0x74e3('0x1f')](_0x1cbc06,_0x20c92d,!![]);}catch(_0x203a1f){return BPromise[_0x74e3('0x20')](_0x203a1f);}return _0x1cbc06[_0x74e3('0x21')]();};}function saveUpdates(_0x3d2b6e,_0x2dd9ef){return function(_0xa92085){if(_0xa92085){return _0xa92085[_0x74e3('0x22')](_0x3d2b6e)[_0x74e3('0x23')](function(_0x45b977){return _0x45b977;});}return null;};}function removeEntity(_0xcc0719,_0x120f5b){return function(_0x115daf){if(_0x115daf){return _0x115daf[_0x74e3('0x24')]()['then'](function(){_0xcc0719['status'](0xcc)[_0x74e3('0x18')]();});}};}function handleEntityNotFound(_0x18f4ee,_0x248649){return function(_0x194e62){if(!_0x194e62){_0x18f4ee[_0x74e3('0x16')](0x194);}return _0x194e62;};}function handleError(_0x125378,_0x4b8fcb){_0x4b8fcb=_0x4b8fcb||0x1f4;return function(_0x2a5722){logger['error'](_0x2a5722[_0x74e3('0x25')]);if(_0x2a5722[_0x74e3('0x26')]){delete _0x2a5722[_0x74e3('0x26')];}_0x125378['status'](_0x4b8fcb)[_0x74e3('0x27')](_0x2a5722);};}function getMustacheRender(_0x3f7582,_0x457f42){return Mustache['render'](_0x3f7582,_[_0x74e3('0x28')](_0x457f42[_0x74e3('0x29')],{'contact':_0x457f42[_0x74e3('0x2a')],'message':_0x457f42[_0x74e3('0x2b')],'agent':_0x457f42[_0x74e3('0x2c')],'interaction':_0x457f42['interaction'],'account':_0x457f42[_0x74e3('0x2d')]}))||'';}exports[_0x74e3('0x2e')]=function(_0x53034c,_0x4081c4){var _0x19cac9={},_0x2df4c5={},_0x42cdf2={'count':0x0,'rows':[]};var _0x95ed3=_[_0x74e3('0x2f')](db[_0x74e3('0x30')][_0x74e3('0x31')],function(_0x5bfbff){return{'name':_0x5bfbff[_0x74e3('0x32')],'type':_0x5bfbff[_0x74e3('0x33')]['key']};});_0x2df4c5[_0x74e3('0x34')]=_[_0x74e3('0x2f')](_0x95ed3,_0x74e3('0x26'));_0x2df4c5[_0x74e3('0x35')]=_[_0x74e3('0x36')](_0x53034c[_0x74e3('0x35')]);_0x2df4c5[_0x74e3('0x37')]=_[_0x74e3('0x38')](_0x2df4c5[_0x74e3('0x34')],_0x2df4c5[_0x74e3('0x35')]);_0x19cac9[_0x74e3('0x39')]=_[_0x74e3('0x38')](_0x2df4c5[_0x74e3('0x34')],qs[_0x74e3('0x3a')](_0x53034c['query']['fields']));_0x19cac9[_0x74e3('0x39')]=_0x19cac9[_0x74e3('0x39')][_0x74e3('0x3b')]?_0x19cac9['attributes']:_0x2df4c5['model'];if(!_0x53034c[_0x74e3('0x35')][_0x74e3('0x3c')](_0x74e3('0x3d'))){_0x19cac9[_0x74e3('0x1c')]=qs['limit'](_0x53034c[_0x74e3('0x35')][_0x74e3('0x1c')]);_0x19cac9['offset']=qs['offset'](_0x53034c[_0x74e3('0x35')][_0x74e3('0x1a')]);}_0x19cac9[_0x74e3('0x3e')]=qs[_0x74e3('0x3f')](_0x53034c[_0x74e3('0x35')]['sort']);_0x19cac9[_0x74e3('0x40')]=qs[_0x74e3('0x37')](_[_0x74e3('0x41')](_0x53034c['query'],_0x2df4c5[_0x74e3('0x37')]),_0x95ed3);if(_0x53034c['query'][_0x74e3('0x42')]){_0x19cac9[_0x74e3('0x40')]=_[_0x74e3('0x28')](_0x19cac9[_0x74e3('0x40')],{'$or':_['map'](_0x95ed3,function(_0x14a265){if(_0x14a265['type']!==_0x74e3('0x43')){var _0x39dfc2={};_0x39dfc2[_0x14a265[_0x74e3('0x26')]]={'$like':'%'+_0x53034c['query'][_0x74e3('0x42')]+'%'};return _0x39dfc2;}})});}_0x19cac9=_[_0x74e3('0x28')]({},_0x19cac9,_0x53034c['options']);var _0x47c6cf={'where':_0x19cac9[_0x74e3('0x40')]};return db[_0x74e3('0x30')][_0x74e3('0x1d')](_0x47c6cf)[_0x74e3('0x23')](function(_0x271551){_0x42cdf2[_0x74e3('0x1d')]=_0x271551;if(_0x53034c[_0x74e3('0x35')][_0x74e3('0x44')]){_0x19cac9[_0x74e3('0x45')]=[{'all':!![]}];}return db[_0x74e3('0x30')][_0x74e3('0x46')](_0x19cac9);})['then'](function(_0x109783){_0x42cdf2['rows']=_0x109783;return _0x42cdf2;})[_0x74e3('0x23')](respondWithFilteredResult(_0x4081c4,_0x19cac9))[_0x74e3('0x47')](handleError(_0x4081c4,null));};exports[_0x74e3('0x48')]=function(_0x30cd1f,_0xe37402){var _0xda4345={'raw':!![],'where':{'id':_0x30cd1f[_0x74e3('0x49')]['id']}},_0x119f14={};_0x119f14[_0x74e3('0x34')]=_[_0x74e3('0x36')](db[_0x74e3('0x30')][_0x74e3('0x31')]);_0x119f14['query']=_[_0x74e3('0x36')](_0x30cd1f[_0x74e3('0x35')]);_0x119f14[_0x74e3('0x37')]=_[_0x74e3('0x38')](_0x119f14[_0x74e3('0x34')],_0x119f14[_0x74e3('0x35')]);_0xda4345[_0x74e3('0x39')]=_[_0x74e3('0x38')](_0x119f14[_0x74e3('0x34')],qs[_0x74e3('0x3a')](_0x30cd1f[_0x74e3('0x35')][_0x74e3('0x3a')]));_0xda4345[_0x74e3('0x39')]=_0xda4345['attributes'][_0x74e3('0x3b')]?_0xda4345[_0x74e3('0x39')]:_0x119f14['model'];if(_0x30cd1f['query'][_0x74e3('0x44')]){_0xda4345[_0x74e3('0x45')]=[{'all':!![]}];}_0xda4345=_['merge']({},_0xda4345,_0x30cd1f['options']);return db[_0x74e3('0x30')][_0x74e3('0x4a')](_0xda4345)[_0x74e3('0x23')](handleEntityNotFound(_0xe37402,null))[_0x74e3('0x23')](respondWithResult(_0xe37402,null))[_0x74e3('0x47')](handleError(_0xe37402,null));};exports['create']=function(_0x5a960d,_0x2525c3){return db['OpenchannelQueueReport'][_0x74e3('0x4b')](_0x5a960d[_0x74e3('0x29')],{})[_0x74e3('0x23')](respondWithResult(_0x2525c3,0xc9))[_0x74e3('0x47')](handleError(_0x2525c3,null));};exports['update']=function(_0x3c8a3a,_0x86c2eb){if(_0x3c8a3a[_0x74e3('0x29')]['id']){delete _0x3c8a3a[_0x74e3('0x29')]['id'];}return db[_0x74e3('0x30')]['find']({'where':{'id':_0x3c8a3a[_0x74e3('0x49')]['id']}})[_0x74e3('0x23')](handleEntityNotFound(_0x86c2eb,null))[_0x74e3('0x23')](saveUpdates(_0x3c8a3a[_0x74e3('0x29')],null))[_0x74e3('0x23')](respondWithResult(_0x86c2eb,null))[_0x74e3('0x47')](handleError(_0x86c2eb,null));};exports[_0x74e3('0x24')]=function(_0x31c7c5,_0x21c984){return db['OpenchannelQueueReport'][_0x74e3('0x4a')]({'where':{'id':_0x31c7c5[_0x74e3('0x49')]['id']}})[_0x74e3('0x23')](handleEntityNotFound(_0x21c984,null))[_0x74e3('0x23')](removeEntity(_0x21c984,null))[_0x74e3('0x47')](handleError(_0x21c984,null));};exports[_0x74e3('0x4c')]=function(_0x3d40bd,_0x24c9a0){return db[_0x74e3('0x30')][_0x74e3('0x4c')]()[_0x74e3('0x23')](respondWithResult(_0x24c9a0,null))[_0x74e3('0x47')](handleError(_0x24c9a0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 05787f5..42e3371 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd737=['OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xd737,0x85));var _0x7d73=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0xd737[_0x2bf466];return _0x856885;};'use strict';var _=require(_0x7d73('0x0'));var util=require('util');var logger=require(_0x7d73('0x1'))('api');var moment=require(_0x7d73('0x2'));var BPromise=require(_0x7d73('0x3'));var rp=require(_0x7d73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7d73('0x5'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0xaa37cc,_0x20b8a9){return _0xaa37cc[_0x7d73('0x6')](_0x7d73('0x7'),attributes,{'tableName':_0x7d73('0x8'),'paranoid':![],'indexes':[{'name':_0x7d73('0x9'),'fields':[_0x7d73('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2056=['OpenchannelQueueReport','report_openchannel_queue','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define'];(function(_0x76e065,_0xc0f30a){var _0x5823e0=function(_0x44e19e){while(--_0x44e19e){_0x76e065['push'](_0x76e065['shift']());}};_0x5823e0(++_0xc0f30a);}(_0x2056,0x107));var _0x6205=function(_0x5c80c1,_0x4f80ca){_0x5c80c1=_0x5c80c1-0x0;var _0xb74ac=_0x2056[_0x5c80c1];return _0xb74ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6205('0x0'))(_0x6205('0x1'));var moment=require(_0x6205('0x2'));var BPromise=require(_0x6205('0x3'));var rp=require(_0x6205('0x4'));var fs=require('fs');var path=require(_0x6205('0x5'));var rimraf=require(_0x6205('0x6'));var config=require(_0x6205('0x7'));var attributes=require(_0x6205('0x8'));module['exports']=function(_0x45afa8,_0x2c555d){return _0x45afa8[_0x6205('0x9')](_0x6205('0xa'),attributes,{'tableName':_0x6205('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6205('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6a4a52d..b0eb6ff 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x257e=['OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','stringify','catch','attributes','UpdateOpenchannelQueueReport','debug','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','info','request\x20sent','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x257e,0x176));var _0xe257=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0x257e[_0x29e2af];return _0x1ea06a;};'use strict';var _=require('lodash');var util=require(_0xe257('0x0'));var moment=require('moment');var BPromise=require(_0xe257('0x1'));var rs=require(_0xe257('0x2'));var fs=require('fs');var Redis=require(_0xe257('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe257('0x4'));var jayson=require(_0xe257('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b956b,_0x2de335,_0x4b9947){return new BPromise(function(_0x492af5,_0x371d20){return client['request'](_0x2b956b,_0x4b9947)['then'](function(_0xbfb2a){logger[_0xe257('0x6')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2de335,_0xe257('0x7'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x2de335,'request\x20sent',JSON['stringify'](_0xbfb2a));if(_0xbfb2a[_0xe257('0x8')]){if(_0xbfb2a[_0xe257('0x8')][_0xe257('0x9')]===0x1f4){logger[_0xe257('0x8')](_0xe257('0xa'),_0x2de335,_0xbfb2a[_0xe257('0x8')]['message']);return _0x371d20(_0xbfb2a[_0xe257('0x8')][_0xe257('0xb')]);}logger['error'](_0xe257('0xa'),_0x2de335,_0xbfb2a[_0xe257('0x8')][_0xe257('0xb')]);return _0x492af5(_0xbfb2a[_0xe257('0x8')]['message']);}else{logger['info'](_0xe257('0xa'),_0x2de335,_0xe257('0x7'));_0x492af5(_0xbfb2a[_0xe257('0xc')]['message']);}})['catch'](function(_0x34e06d){logger[_0xe257('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2de335,_0x34e06d);_0x371d20(_0x34e06d);});});}exports[_0xe257('0xd')]=function(_0x2bc403){var _0x453bb2=this;return new Promise(function(_0x55d779,_0x3f4dc0){return db[_0xe257('0xe')]['create'](_0x2bc403[_0xe257('0xf')],{'raw':_0x2bc403['options']?_0x2bc403[_0xe257('0x10')][_0xe257('0x11')]===undefined?!![]:![]:!![]})[_0xe257('0x12')](function(_0xf532b9){logger['info']('CreateOpenchannelQueueReport',_0x2bc403);logger['debug']('CreateOpenchannelQueueReport',_0x2bc403,JSON[_0xe257('0x13')](_0xf532b9));_0x55d779(_0xf532b9);})[_0xe257('0x14')](function(_0x4de427){logger['error']('CreateOpenchannelQueueReport',_0x4de427[_0xe257('0xb')],_0x2bc403);_0x3f4dc0(_0x453bb2['error'](0x1f4,_0x4de427[_0xe257('0xb')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5c6d69){var _0x35e060=this;return new Promise(function(_0x2039d2,_0x2f1351){return db[_0xe257('0xe')]['update'](_0x5c6d69[_0xe257('0xf')],{'raw':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69[_0xe257('0x10')][_0xe257('0x11')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69[_0xe257('0x10')]['where']||null:null,'attributes':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69['options'][_0xe257('0x15')]||null:null,'limit':_0x5c6d69[_0xe257('0x10')]?_0x5c6d69[_0xe257('0x10')]['limit']||null:null})[_0xe257('0x12')](function(_0x30dc9f){logger[_0xe257('0x6')](_0xe257('0x16'),_0x5c6d69);logger[_0xe257('0x17')](_0xe257('0x16'),_0x5c6d69,JSON[_0xe257('0x13')](_0x30dc9f));_0x2039d2(_0x30dc9f);})[_0xe257('0x14')](function(_0x5abc41){logger[_0xe257('0x8')](_0xe257('0x16'),_0x5abc41[_0xe257('0xb')],_0x5c6d69);_0x2f1351(_0x35e060['error'](0x1f4,_0x5abc41[_0xe257('0xb')]));});});}; \ No newline at end of file +var _0xc74e=['raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc74e,0xfe));var _0xec74=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc74e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xec74('0x0'));var util=require(_0xec74('0x1'));var moment=require(_0xec74('0x2'));var BPromise=require(_0xec74('0x3'));var rs=require(_0xec74('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xec74('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xec74('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec74('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ed266,_0x8c97d4,_0x2a2273){return new BPromise(function(_0x2b141f,_0x59fcac){return client[_0xec74('0x8')](_0x3ed266,_0x2a2273)[_0xec74('0x9')](function(_0x217ba8){logger['info'](_0xec74('0xa'),_0x8c97d4,_0xec74('0xb'));logger[_0xec74('0xc')](_0xec74('0xd'),_0x8c97d4,_0xec74('0xb'),JSON[_0xec74('0xe')](_0x217ba8));if(_0x217ba8[_0xec74('0xf')]){if(_0x217ba8['error'][_0xec74('0x10')]===0x1f4){logger['error'](_0xec74('0xa'),_0x8c97d4,_0x217ba8[_0xec74('0xf')][_0xec74('0x11')]);return _0x59fcac(_0x217ba8[_0xec74('0xf')]['message']);}logger[_0xec74('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x8c97d4,_0x217ba8[_0xec74('0xf')]['message']);return _0x2b141f(_0x217ba8[_0xec74('0xf')]['message']);}else{logger[_0xec74('0x12')](_0xec74('0xa'),_0x8c97d4,_0xec74('0xb'));_0x2b141f(_0x217ba8['result'][_0xec74('0x11')]);}})[_0xec74('0x13')](function(_0x42c0a2){logger[_0xec74('0xf')](_0xec74('0xa'),_0x8c97d4,_0x42c0a2);_0x59fcac(_0x42c0a2);});});}exports[_0xec74('0x14')]=function(_0x54282d){var _0x4d4968=this;return new Promise(function(_0x58f861,_0x4abdcf){return db[_0xec74('0x15')][_0xec74('0x16')](_0x54282d[_0xec74('0x17')],{'raw':_0x54282d['options']?_0x54282d[_0xec74('0x18')][_0xec74('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3b0413){logger[_0xec74('0x12')](_0xec74('0x14'),_0x54282d);logger[_0xec74('0xc')](_0xec74('0x14'),_0x54282d,JSON[_0xec74('0xe')](_0x3b0413));_0x58f861(_0x3b0413);})['catch'](function(_0x337160){logger[_0xec74('0xf')](_0xec74('0x14'),_0x337160[_0xec74('0x11')],_0x54282d);_0x4abdcf(_0x4d4968['error'](0x1f4,_0x337160[_0xec74('0x11')]));});});};exports[_0xec74('0x1a')]=function(_0x4b7c1b){var _0xf7dfa2=this;return new Promise(function(_0x2e98e6,_0x151c70){return db['OpenchannelQueueReport'][_0xec74('0x1b')](_0x4b7c1b[_0xec74('0x17')],{'raw':_0x4b7c1b[_0xec74('0x18')]?_0x4b7c1b['options'][_0xec74('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b7c1b[_0xec74('0x18')]?_0x4b7c1b[_0xec74('0x18')][_0xec74('0x1c')]||null:null,'attributes':_0x4b7c1b[_0xec74('0x18')]?_0x4b7c1b[_0xec74('0x18')][_0xec74('0x1d')]||null:null,'limit':_0x4b7c1b[_0xec74('0x18')]?_0x4b7c1b[_0xec74('0x18')][_0xec74('0x1e')]||null:null})[_0xec74('0x9')](function(_0x341e29){logger[_0xec74('0x12')](_0xec74('0x1a'),_0x4b7c1b);logger[_0xec74('0xc')](_0xec74('0x1a'),_0x4b7c1b,JSON[_0xec74('0xe')](_0x341e29));_0x2e98e6(_0x341e29);})[_0xec74('0x13')](function(_0x4d8bf9){logger['error'](_0xec74('0x1a'),_0x4d8bf9[_0xec74('0x11')],_0x4b7c1b);_0x151c70(_0xf7dfa2['error'](0x1f4,_0x4d8bf9[_0xec74('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 881735b..29e72a4 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7adf=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller'];(function(_0x45f945,_0x2c5a50){var _0x2866b8=function(_0xdd0398){while(--_0xdd0398){_0x45f945['push'](_0x45f945['shift']());}};_0x2866b8(++_0x2c5a50);}(_0x7adf,0x114));var _0xf7ad=function(_0x378ea7,_0x2a6c7b){_0x378ea7=_0x378ea7-0x0;var _0x4f195d=_0x7adf[_0x378ea7];return _0x4f195d;};'use strict';var multer=require(_0xf7ad('0x0'));var util=require(_0xf7ad('0x1'));var path=require(_0xf7ad('0x2'));var timeout=require(_0xf7ad('0x3'));var express=require(_0xf7ad('0x4'));var router=express[_0xf7ad('0x5')]();var fs_extra=require(_0xf7ad('0x6'));var auth=require(_0xf7ad('0x7'));var interaction=require(_0xf7ad('0x8'));var config=require('../../config/environment');var controller=require(_0xf7ad('0x9'));router[_0xf7ad('0xa')]('/',auth[_0xf7ad('0xb')](),controller[_0xf7ad('0xc')]);router[_0xf7ad('0xa')]('/describe',auth[_0xf7ad('0xb')](),controller['describe']);router[_0xf7ad('0xa')](_0xf7ad('0xd'),auth[_0xf7ad('0xb')](),controller[_0xf7ad('0xe')]);router[_0xf7ad('0xf')]('/',auth['isAuthenticated'](),controller[_0xf7ad('0x10')]);router[_0xf7ad('0x11')](_0xf7ad('0xd'),auth[_0xf7ad('0xb')](),controller[_0xf7ad('0x12')]);router[_0xf7ad('0x13')](_0xf7ad('0xd'),auth[_0xf7ad('0xb')](),controller[_0xf7ad('0x14')]);module[_0xf7ad('0x15')]=router; \ No newline at end of file +var _0x44d7=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x44d7,0x1dc));var _0x744d=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x44d7[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x744d('0x0'));var util=require('util');var path=require(_0x744d('0x1'));var timeout=require(_0x744d('0x2'));var express=require(_0x744d('0x3'));var router=express[_0x744d('0x4')]();var fs_extra=require(_0x744d('0x5'));var auth=require(_0x744d('0x6'));var interaction=require(_0x744d('0x7'));var config=require(_0x744d('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x744d('0x9')]('/',auth['isAuthenticated'](),controller[_0x744d('0xa')]);router[_0x744d('0x9')](_0x744d('0xb'),auth[_0x744d('0xc')](),controller[_0x744d('0xd')]);router['get'](_0x744d('0xe'),auth[_0x744d('0xc')](),controller['show']);router[_0x744d('0xf')]('/',auth[_0x744d('0xc')](),controller[_0x744d('0x10')]);router['put'](_0x744d('0xe'),auth[_0x744d('0xc')](),controller[_0x744d('0x11')]);router[_0x744d('0x12')](_0x744d('0xe'),auth[_0x744d('0xc')](),controller[_0x744d('0x13')]);module[_0x744d('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 74d517e..002f1ea 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe06b=['STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x482471,_0x1934f8){var _0x55625c=function(_0x3251d0){while(--_0x3251d0){_0x482471['push'](_0x482471['shift']());}};_0x55625c(++_0x1934f8);}(_0xe06b,0x1be));var _0xbe06=function(_0x5abe95,_0x4fcfec){_0x5abe95=_0x5abe95-0x0;var _0x4b995e=_0xe06b[_0x5abe95];return _0x4b995e;};'use strict';var moment=require(_0xbe06('0x0'));var Sequelize=require(_0xbe06('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbe06('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbe06('0x3')]('account',_0xbe06('0x4'),_0xbe06('0x5')),'allowNull':![],'defaultValue':_0xbe06('0x5')},'transferredAt':{'type':Sequelize[_0xbe06('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbe06('0x7')]}}; \ No newline at end of file +var _0x1a5e=['agent','queue','DATE','NOW','moment','exports','STRING','ENUM','account'];(function(_0x56ffbc,_0x25be9c){var _0x347d50=function(_0x5257d2){while(--_0x5257d2){_0x56ffbc['push'](_0x56ffbc['shift']());}};_0x347d50(++_0x25be9c);}(_0x1a5e,0xb8));var _0xe1a5=function(_0x51f368,_0x2038f6){_0x51f368=_0x51f368-0x0;var _0x53f573=_0x1a5e[_0x51f368];return _0x53f573;};'use strict';var moment=require(_0xe1a5('0x0'));var Sequelize=require('sequelize');module[_0xe1a5('0x1')]={'uniqueid':{'type':Sequelize[_0xe1a5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe1a5('0x3')](_0xe1a5('0x4'),_0xe1a5('0x5'),'queue'),'allowNull':![],'defaultValue':_0xe1a5('0x6')},'transferredAt':{'type':Sequelize[_0xe1a5('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xe1a5('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 021b52c..a761448 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7174=['fields','attributes','length','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','create','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','render','merge','body','contact','message','interaction','account','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0xe75c9b,_0x3d12de){var _0x599172=function(_0x4e4c47){while(--_0x4e4c47){_0xe75c9b['push'](_0xe75c9b['shift']());}};_0x599172(++_0x3d12de);}(_0x7174,0x101));var _0x4717=function(_0x23b803,_0xfdcff7){_0x23b803=_0x23b803-0x0;var _0x294c40=_0x7174[_0x23b803];return _0x294c40;};'use strict';var emlformat=require(_0x4717('0x0'));var rimraf=require(_0x4717('0x1'));var zipdir=require(_0x4717('0x2'));var jsonpatch=require(_0x4717('0x3'));var rp=require(_0x4717('0x4'));var moment=require(_0x4717('0x5'));var BPromise=require(_0x4717('0x6'));var Mustache=require(_0x4717('0x7'));var util=require('util');var path=require(_0x4717('0x8'));var sox=require(_0x4717('0x9'));var csv=require('to-csv');var ejs=require(_0x4717('0xa'));var fs=require('fs');var fs_extra=require(_0x4717('0xb'));var _=require(_0x4717('0xc'));var squel=require(_0x4717('0xd'));var crypto=require(_0x4717('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4717('0xf'));var querystring=require(_0x4717('0x10'));var Papa=require(_0x4717('0x11'));var Redis=require('ioredis');var authService=require(_0x4717('0x12'));var qs=require(_0x4717('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4717('0x14'));var logger=require(_0x4717('0x15'))(_0x4717('0x16'));var utils=require('../../config/utils');var config=require(_0x4717('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4717('0x18'))['db'];function respondWithStatusCode(_0x11ef0c,_0x4dcf67){_0x4dcf67=_0x4dcf67||0xcc;return function(_0x5f511a){if(_0x5f511a){return _0x11ef0c[_0x4717('0x19')](_0x4dcf67);}return _0x11ef0c[_0x4717('0x1a')](_0x4dcf67)[_0x4717('0x1b')]();};}function respondWithResult(_0x51a595,_0x56ded3){_0x56ded3=_0x56ded3||0xc8;return function(_0x24f03d){if(_0x24f03d){return _0x51a595['status'](_0x56ded3)[_0x4717('0x1c')](_0x24f03d);}};}function respondWithFilteredResult(_0x41aab0,_0x104563){return function(_0x2a2e9b){if(_0x2a2e9b){var _0x349168=typeof _0x104563[_0x4717('0x1d')]===_0x4717('0x1e')&&typeof _0x104563[_0x4717('0x1f')]==='undefined';var _0x1e4b47=_0x2a2e9b[_0x4717('0x20')];var _0x32cad2=_0x349168?0x0:_0x104563[_0x4717('0x1d')];var _0x9737ed=_0x349168?_0x2a2e9b['count']:_0x104563[_0x4717('0x1d')]+_0x104563[_0x4717('0x1f')];var _0x17a5cc;if(_0x9737ed>=_0x1e4b47){_0x9737ed=_0x1e4b47;_0x17a5cc=0xc8;}else{_0x17a5cc=0xce;}_0x41aab0[_0x4717('0x1a')](_0x17a5cc);return _0x41aab0['set'](_0x4717('0x21'),_0x32cad2+'-'+_0x9737ed+'/'+_0x1e4b47)['json'](_0x2a2e9b);}return null;};}function patchUpdates(_0x5f12f8){return function(_0x34a508){try{jsonpatch[_0x4717('0x22')](_0x34a508,_0x5f12f8,!![]);}catch(_0x834284){return BPromise[_0x4717('0x23')](_0x834284);}return _0x34a508['save']();};}function saveUpdates(_0x36b62e,_0x14ea3d){return function(_0x20857b){if(_0x20857b){return _0x20857b[_0x4717('0x24')](_0x36b62e)[_0x4717('0x25')](function(_0x104f7e){return _0x104f7e;});}return null;};}function removeEntity(_0x2f8f35,_0x39fe84){return function(_0x3b302e){if(_0x3b302e){return _0x3b302e['destroy']()[_0x4717('0x25')](function(){_0x2f8f35[_0x4717('0x1a')](0xcc)[_0x4717('0x1b')]();});}};}function handleEntityNotFound(_0x1a6bfa,_0x32142a){return function(_0x32d1c8){if(!_0x32d1c8){_0x1a6bfa['sendStatus'](0x194);}return _0x32d1c8;};}function handleError(_0x178c8f,_0x443534){_0x443534=_0x443534||0x1f4;return function(_0x4d6dd9){logger[_0x4717('0x26')](_0x4d6dd9[_0x4717('0x27')]);if(_0x4d6dd9[_0x4717('0x28')]){delete _0x4d6dd9['name'];}_0x178c8f[_0x4717('0x1a')](_0x443534)['send'](_0x4d6dd9);};}function getMustacheRender(_0x3e6889,_0x31254b){return Mustache[_0x4717('0x29')](_0x3e6889,_[_0x4717('0x2a')](_0x31254b[_0x4717('0x2b')],{'contact':_0x31254b[_0x4717('0x2c')],'message':_0x31254b[_0x4717('0x2d')],'agent':_0x31254b['agent'],'interaction':_0x31254b[_0x4717('0x2e')],'account':_0x31254b[_0x4717('0x2f')]}))||'';}exports[_0x4717('0x30')]=function(_0x75da18,_0xf53ef0){var _0x4cb510={},_0x4ee5d2={},_0x4d9aa8={'count':0x0,'rows':[]};var _0x306b9b=_[_0x4717('0x31')](db[_0x4717('0x32')][_0x4717('0x33')],function(_0x1a82ba){return{'name':_0x1a82ba[_0x4717('0x34')],'type':_0x1a82ba[_0x4717('0x35')]['key']};});_0x4ee5d2[_0x4717('0x36')]=_[_0x4717('0x31')](_0x306b9b,_0x4717('0x28'));_0x4ee5d2[_0x4717('0x37')]=_[_0x4717('0x38')](_0x75da18[_0x4717('0x37')]);_0x4ee5d2[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x4ee5d2['model'],_0x4ee5d2[_0x4717('0x37')]);_0x4cb510['attributes']=_[_0x4717('0x3a')](_0x4ee5d2[_0x4717('0x36')],qs[_0x4717('0x3b')](_0x75da18['query'][_0x4717('0x3b')]));_0x4cb510[_0x4717('0x3c')]=_0x4cb510['attributes'][_0x4717('0x3d')]?_0x4cb510['attributes']:_0x4ee5d2['model'];if(!_0x75da18[_0x4717('0x37')]['hasOwnProperty']('nolimit')){_0x4cb510[_0x4717('0x1f')]=qs['limit'](_0x75da18[_0x4717('0x37')][_0x4717('0x1f')]);_0x4cb510[_0x4717('0x1d')]=qs['offset'](_0x75da18['query']['offset']);}_0x4cb510[_0x4717('0x3e')]=qs[_0x4717('0x3f')](_0x75da18[_0x4717('0x37')]['sort']);_0x4cb510[_0x4717('0x40')]=qs[_0x4717('0x39')](_[_0x4717('0x41')](_0x75da18[_0x4717('0x37')],_0x4ee5d2['filters']),_0x306b9b);if(_0x75da18[_0x4717('0x37')][_0x4717('0x42')]){_0x4cb510[_0x4717('0x40')]=_[_0x4717('0x2a')](_0x4cb510[_0x4717('0x40')],{'$or':_['map'](_0x306b9b,function(_0x3bffb0){if(_0x3bffb0[_0x4717('0x35')]!=='VIRTUAL'){var _0x464f4e={};_0x464f4e[_0x3bffb0['name']]={'$like':'%'+_0x75da18[_0x4717('0x37')][_0x4717('0x42')]+'%'};return _0x464f4e;}})});}_0x4cb510=_[_0x4717('0x2a')]({},_0x4cb510,_0x75da18[_0x4717('0x43')]);var _0x40666e={'where':_0x4cb510['where']};return db['OpenchannelTransferReport'][_0x4717('0x20')](_0x40666e)[_0x4717('0x25')](function(_0x302aff){_0x4d9aa8['count']=_0x302aff;if(_0x75da18[_0x4717('0x37')][_0x4717('0x44')]){_0x4cb510[_0x4717('0x45')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4717('0x46')](_0x4cb510);})['then'](function(_0x13d5d3){_0x4d9aa8[_0x4717('0x47')]=_0x13d5d3;return _0x4d9aa8;})[_0x4717('0x25')](respondWithFilteredResult(_0xf53ef0,_0x4cb510))[_0x4717('0x48')](handleError(_0xf53ef0,null));};exports[_0x4717('0x49')]=function(_0x46097e,_0x4446cc){var _0x4064c5={'raw':!![],'where':{'id':_0x46097e[_0x4717('0x4a')]['id']}},_0x2964a6={};_0x2964a6[_0x4717('0x36')]=_['keys'](db[_0x4717('0x32')][_0x4717('0x33')]);_0x2964a6[_0x4717('0x37')]=_[_0x4717('0x38')](_0x46097e[_0x4717('0x37')]);_0x2964a6[_0x4717('0x39')]=_[_0x4717('0x3a')](_0x2964a6[_0x4717('0x36')],_0x2964a6[_0x4717('0x37')]);_0x4064c5[_0x4717('0x3c')]=_[_0x4717('0x3a')](_0x2964a6[_0x4717('0x36')],qs[_0x4717('0x3b')](_0x46097e[_0x4717('0x37')][_0x4717('0x3b')]));_0x4064c5['attributes']=_0x4064c5[_0x4717('0x3c')]['length']?_0x4064c5['attributes']:_0x2964a6[_0x4717('0x36')];if(_0x46097e[_0x4717('0x37')][_0x4717('0x44')]){_0x4064c5[_0x4717('0x45')]=[{'all':!![]}];}_0x4064c5=_[_0x4717('0x2a')]({},_0x4064c5,_0x46097e[_0x4717('0x43')]);return db['OpenchannelTransferReport']['find'](_0x4064c5)[_0x4717('0x25')](handleEntityNotFound(_0x4446cc,null))[_0x4717('0x25')](respondWithResult(_0x4446cc,null))[_0x4717('0x48')](handleError(_0x4446cc,null));};exports[_0x4717('0x4b')]=function(_0x4ae90c,_0x1bbcc8){return db[_0x4717('0x32')][_0x4717('0x4b')](_0x4ae90c['body'],{})[_0x4717('0x25')](respondWithResult(_0x1bbcc8,0xc9))['catch'](handleError(_0x1bbcc8,null));};exports[_0x4717('0x24')]=function(_0x587382,_0x157621){if(_0x587382[_0x4717('0x2b')]['id']){delete _0x587382[_0x4717('0x2b')]['id'];}return db[_0x4717('0x32')][_0x4717('0x4c')]({'where':{'id':_0x587382['params']['id']}})[_0x4717('0x25')](handleEntityNotFound(_0x157621,null))[_0x4717('0x25')](saveUpdates(_0x587382[_0x4717('0x2b')],null))['then'](respondWithResult(_0x157621,null))[_0x4717('0x48')](handleError(_0x157621,null));};exports[_0x4717('0x4d')]=function(_0x27d2ac,_0x1ca898){return db[_0x4717('0x32')][_0x4717('0x4c')]({'where':{'id':_0x27d2ac['params']['id']}})['then'](handleEntityNotFound(_0x1ca898,null))[_0x4717('0x25')](removeEntity(_0x1ca898,null))[_0x4717('0x48')](handleError(_0x1ca898,null));};exports[_0x4717('0x4e')]=function(_0x4b771f,_0x3f0a6f){return db[_0x4717('0x32')][_0x4717('0x4e')]()['then'](respondWithResult(_0x3f0a6f,null))[_0x4717('0x48')](handleError(_0x3f0a6f,null));}; \ No newline at end of file +var _0x0533=['util','path','sox','to-csv','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','then','destroy','error','stack','render','merge','body','contact','message','agent','interaction','account','index','type','key','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','count','includeAll','include','OpenchannelTransferReport','rows','catch','show','params','rawAttributes','find','create','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x503274,_0x387f8a){var _0x4959dd=function(_0x31fd29){while(--_0x31fd29){_0x503274['push'](_0x503274['shift']());}};_0x4959dd(++_0x387f8a);}(_0x0533,0x12f));var _0x3053=function(_0x277bbd,_0x40e110){_0x277bbd=_0x277bbd-0x0;var _0x17f7dd=_0x0533[_0x277bbd];return _0x17f7dd;};'use strict';var emlformat=require(_0x3053('0x0'));var rimraf=require(_0x3053('0x1'));var zipdir=require(_0x3053('0x2'));var jsonpatch=require(_0x3053('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3053('0x4'));var Mustache=require('mustache');var util=require(_0x3053('0x5'));var path=require(_0x3053('0x6'));var sox=require(_0x3053('0x7'));var csv=require(_0x3053('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3053('0x9'));var crypto=require('crypto');var jsforce=require(_0x3053('0xa'));var deskjs=require(_0x3053('0xb'));var toCsv=require(_0x3053('0x8'));var querystring=require(_0x3053('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3053('0xd'));var as=require(_0x3053('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3053('0xf'))(_0x3053('0x10'));var utils=require(_0x3053('0x11'));var config=require(_0x3053('0x12'));var licenseUtil=require(_0x3053('0x13'));var db=require(_0x3053('0x14'))['db'];function respondWithStatusCode(_0x45ec2e,_0x3c9947){_0x3c9947=_0x3c9947||0xcc;return function(_0x4d3770){if(_0x4d3770){return _0x45ec2e[_0x3053('0x15')](_0x3c9947);}return _0x45ec2e[_0x3053('0x16')](_0x3c9947)[_0x3053('0x17')]();};}function respondWithResult(_0x1c0ba5,_0x2de1f9){_0x2de1f9=_0x2de1f9||0xc8;return function(_0x298a86){if(_0x298a86){return _0x1c0ba5['status'](_0x2de1f9)[_0x3053('0x18')](_0x298a86);}};}function respondWithFilteredResult(_0x314ba5,_0x3df64b){return function(_0x2dbf84){if(_0x2dbf84){var _0x5e8346=typeof _0x3df64b[_0x3053('0x19')]===_0x3053('0x1a')&&typeof _0x3df64b[_0x3053('0x1b')]===_0x3053('0x1a');var _0x5d3103=_0x2dbf84['count'];var _0x1d9b41=_0x5e8346?0x0:_0x3df64b[_0x3053('0x19')];var _0x186d27=_0x5e8346?_0x2dbf84['count']:_0x3df64b[_0x3053('0x19')]+_0x3df64b[_0x3053('0x1b')];var _0x18dddf;if(_0x186d27>=_0x5d3103){_0x186d27=_0x5d3103;_0x18dddf=0xc8;}else{_0x18dddf=0xce;}_0x314ba5[_0x3053('0x16')](_0x18dddf);return _0x314ba5['set'](_0x3053('0x1c'),_0x1d9b41+'-'+_0x186d27+'/'+_0x5d3103)[_0x3053('0x18')](_0x2dbf84);}return null;};}function patchUpdates(_0x45f5c3){return function(_0x355994){try{jsonpatch[_0x3053('0x1d')](_0x355994,_0x45f5c3,!![]);}catch(_0x44c80a){return BPromise['reject'](_0x44c80a);}return _0x355994['save']();};}function saveUpdates(_0x54eadc,_0x2a33a1){return function(_0x2b48ae){if(_0x2b48ae){return _0x2b48ae['update'](_0x54eadc)[_0x3053('0x1e')](function(_0x5bca29){return _0x5bca29;});}return null;};}function removeEntity(_0x174c7c,_0x498987){return function(_0x35d82){if(_0x35d82){return _0x35d82[_0x3053('0x1f')]()[_0x3053('0x1e')](function(){_0x174c7c[_0x3053('0x16')](0xcc)[_0x3053('0x17')]();});}};}function handleEntityNotFound(_0xb4d373,_0x55790a){return function(_0x3c1d22){if(!_0x3c1d22){_0xb4d373[_0x3053('0x15')](0x194);}return _0x3c1d22;};}function handleError(_0x523ead,_0x12055a){_0x12055a=_0x12055a||0x1f4;return function(_0x271492){logger[_0x3053('0x20')](_0x271492[_0x3053('0x21')]);if(_0x271492['name']){delete _0x271492['name'];}_0x523ead[_0x3053('0x16')](_0x12055a)['send'](_0x271492);};}function getMustacheRender(_0x4bf22c,_0x46d378){return Mustache[_0x3053('0x22')](_0x4bf22c,_[_0x3053('0x23')](_0x46d378[_0x3053('0x24')],{'contact':_0x46d378[_0x3053('0x25')],'message':_0x46d378[_0x3053('0x26')],'agent':_0x46d378[_0x3053('0x27')],'interaction':_0x46d378[_0x3053('0x28')],'account':_0x46d378[_0x3053('0x29')]}))||'';}exports[_0x3053('0x2a')]=function(_0x5a3dd3,_0x571af1){var _0x227e80={},_0x5e846a={},_0x4a3d45={'count':0x0,'rows':[]};var _0x2ebc4e=_['map'](db['OpenchannelTransferReport']['rawAttributes'],function(_0x4f6be8){return{'name':_0x4f6be8['fieldName'],'type':_0x4f6be8[_0x3053('0x2b')][_0x3053('0x2c')]};});_0x5e846a[_0x3053('0x2d')]=_[_0x3053('0x2e')](_0x2ebc4e,_0x3053('0x2f'));_0x5e846a['query']=_[_0x3053('0x30')](_0x5a3dd3[_0x3053('0x31')]);_0x5e846a['filters']=_[_0x3053('0x32')](_0x5e846a[_0x3053('0x2d')],_0x5e846a['query']);_0x227e80[_0x3053('0x33')]=_[_0x3053('0x32')](_0x5e846a[_0x3053('0x2d')],qs[_0x3053('0x34')](_0x5a3dd3[_0x3053('0x31')][_0x3053('0x34')]));_0x227e80[_0x3053('0x33')]=_0x227e80[_0x3053('0x33')][_0x3053('0x35')]?_0x227e80[_0x3053('0x33')]:_0x5e846a[_0x3053('0x2d')];if(!_0x5a3dd3[_0x3053('0x31')][_0x3053('0x36')](_0x3053('0x37'))){_0x227e80['limit']=qs[_0x3053('0x1b')](_0x5a3dd3['query'][_0x3053('0x1b')]);_0x227e80[_0x3053('0x19')]=qs[_0x3053('0x19')](_0x5a3dd3[_0x3053('0x31')]['offset']);}_0x227e80[_0x3053('0x38')]=qs['sort'](_0x5a3dd3[_0x3053('0x31')][_0x3053('0x39')]);_0x227e80[_0x3053('0x3a')]=qs['filters'](_[_0x3053('0x3b')](_0x5a3dd3['query'],_0x5e846a[_0x3053('0x3c')]),_0x2ebc4e);if(_0x5a3dd3[_0x3053('0x31')][_0x3053('0x3d')]){_0x227e80[_0x3053('0x3a')]=_[_0x3053('0x23')](_0x227e80[_0x3053('0x3a')],{'$or':_[_0x3053('0x2e')](_0x2ebc4e,function(_0x26642e){if(_0x26642e[_0x3053('0x2b')]!==_0x3053('0x3e')){var _0x56df3c={};_0x56df3c[_0x26642e['name']]={'$like':'%'+_0x5a3dd3[_0x3053('0x31')][_0x3053('0x3d')]+'%'};return _0x56df3c;}})});}_0x227e80=_[_0x3053('0x23')]({},_0x227e80,_0x5a3dd3[_0x3053('0x3f')]);var _0x565b3e={'where':_0x227e80[_0x3053('0x3a')]};return db['OpenchannelTransferReport']['count'](_0x565b3e)[_0x3053('0x1e')](function(_0xbc8278){_0x4a3d45[_0x3053('0x40')]=_0xbc8278;if(_0x5a3dd3[_0x3053('0x31')][_0x3053('0x41')]){_0x227e80[_0x3053('0x42')]=[{'all':!![]}];}return db[_0x3053('0x43')]['findAll'](_0x227e80);})['then'](function(_0x60b1fd){_0x4a3d45[_0x3053('0x44')]=_0x60b1fd;return _0x4a3d45;})[_0x3053('0x1e')](respondWithFilteredResult(_0x571af1,_0x227e80))[_0x3053('0x45')](handleError(_0x571af1,null));};exports[_0x3053('0x46')]=function(_0x5495cf,_0x8a9783){var _0xb8e8ad={'raw':!![],'where':{'id':_0x5495cf[_0x3053('0x47')]['id']}},_0x2cb236={};_0x2cb236[_0x3053('0x2d')]=_[_0x3053('0x30')](db[_0x3053('0x43')][_0x3053('0x48')]);_0x2cb236[_0x3053('0x31')]=_[_0x3053('0x30')](_0x5495cf['query']);_0x2cb236[_0x3053('0x3c')]=_['intersection'](_0x2cb236[_0x3053('0x2d')],_0x2cb236['query']);_0xb8e8ad[_0x3053('0x33')]=_['intersection'](_0x2cb236[_0x3053('0x2d')],qs[_0x3053('0x34')](_0x5495cf[_0x3053('0x31')][_0x3053('0x34')]));_0xb8e8ad[_0x3053('0x33')]=_0xb8e8ad['attributes'][_0x3053('0x35')]?_0xb8e8ad[_0x3053('0x33')]:_0x2cb236[_0x3053('0x2d')];if(_0x5495cf[_0x3053('0x31')][_0x3053('0x41')]){_0xb8e8ad[_0x3053('0x42')]=[{'all':!![]}];}_0xb8e8ad=_[_0x3053('0x23')]({},_0xb8e8ad,_0x5495cf[_0x3053('0x3f')]);return db[_0x3053('0x43')][_0x3053('0x49')](_0xb8e8ad)[_0x3053('0x1e')](handleEntityNotFound(_0x8a9783,null))[_0x3053('0x1e')](respondWithResult(_0x8a9783,null))[_0x3053('0x45')](handleError(_0x8a9783,null));};exports[_0x3053('0x4a')]=function(_0x3b2e29,_0x32467e){return db['OpenchannelTransferReport'][_0x3053('0x4a')](_0x3b2e29[_0x3053('0x24')],{})['then'](respondWithResult(_0x32467e,0xc9))['catch'](handleError(_0x32467e,null));};exports[_0x3053('0x4b')]=function(_0x411df0,_0x611790){if(_0x411df0[_0x3053('0x24')]['id']){delete _0x411df0['body']['id'];}return db['OpenchannelTransferReport'][_0x3053('0x49')]({'where':{'id':_0x411df0['params']['id']}})[_0x3053('0x1e')](handleEntityNotFound(_0x611790,null))['then'](saveUpdates(_0x411df0[_0x3053('0x24')],null))[_0x3053('0x1e')](respondWithResult(_0x611790,null))['catch'](handleError(_0x611790,null));};exports['destroy']=function(_0x401b75,_0xf2bee2){return db[_0x3053('0x43')][_0x3053('0x49')]({'where':{'id':_0x401b75['params']['id']}})[_0x3053('0x1e')](handleEntityNotFound(_0xf2bee2,null))[_0x3053('0x1e')](removeEntity(_0xf2bee2,null))[_0x3053('0x45')](handleError(_0xf2bee2,null));};exports[_0x3053('0x4c')]=function(_0x4aaae8,_0x1d8b80){return db[_0x3053('0x43')][_0x3053('0x4c')]()[_0x3053('0x1e')](respondWithResult(_0x1d8b80,null))[_0x3053('0x45')](handleError(_0x1d8b80,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0150dd7..40e2b4c 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2ce=['moment','bluebird','path','../../config/environment','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xc2ce,0xb2));var _0xec2c=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xc2ce[_0x434783];return _0x13efcf;};'use strict';var _=require(_0xec2c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec2c('0x1'));var moment=require(_0xec2c('0x2'));var BPromise=require(_0xec2c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec2c('0x4'));var rimraf=require('rimraf');var config=require(_0xec2c('0x5'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x4e9bcc,_0x96ca2f){return _0x4e9bcc['define'](_0xec2c('0x6'),attributes,{'tableName':_0xec2c('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xec2c('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9aa7=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x466818,_0x489fc6){var _0x53c7d3=function(_0x3638d4){while(--_0x3638d4){_0x466818['push'](_0x466818['shift']());}};_0x53c7d3(++_0x489fc6);}(_0x9aa7,0x1e3));var _0x79aa=function(_0x50a740,_0x1ee7b2){_0x50a740=_0x50a740-0x0;var _0x15fec4=_0x9aa7[_0x50a740];return _0x15fec4;};'use strict';var _=require(_0x79aa('0x0'));var util=require(_0x79aa('0x1'));var logger=require(_0x79aa('0x2'))(_0x79aa('0x3'));var moment=require(_0x79aa('0x4'));var BPromise=require(_0x79aa('0x5'));var rp=require(_0x79aa('0x6'));var fs=require('fs');var path=require(_0x79aa('0x7'));var rimraf=require(_0x79aa('0x8'));var config=require(_0x79aa('0x9'));var attributes=require('./openchannelTransferReport.attributes');module[_0x79aa('0xa')]=function(_0x48759e,_0x1f6963){return _0x48759e[_0x79aa('0xb')](_0x79aa('0xc'),attributes,{'tableName':_0x79aa('0xd'),'paranoid':![],'indexes':[{'name':_0x79aa('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index b022518..b2746b8 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b31=['OpenchannelTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4b31,0x1c4));var _0x14b3=function(_0x30b710,_0x4477d1){_0x30b710=_0x30b710-0x0;var _0x205edf=_0x4b31[_0x30b710];return _0x205edf;};'use strict';var _=require(_0x14b3('0x0'));var util=require(_0x14b3('0x1'));var moment=require(_0x14b3('0x2'));var BPromise=require(_0x14b3('0x3'));var rs=require(_0x14b3('0x4'));var fs=require('fs');var Redis=require(_0x14b3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x14b3('0x6'));var logger=require(_0x14b3('0x7'))(_0x14b3('0x8'));var config=require(_0x14b3('0x9'));var jayson=require(_0x14b3('0xa'));var client=jayson[_0x14b3('0xb')][_0x14b3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c3733,_0xd6a5e9,_0x4cd4f7){return new BPromise(function(_0x76d275,_0x1c6cec){return client[_0x14b3('0xd')](_0x9c3733,_0x4cd4f7)[_0x14b3('0xe')](function(_0x1dfeee){logger[_0x14b3('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x14b3('0x10'));logger[_0x14b3('0x11')](_0x14b3('0x12'),_0xd6a5e9,_0x14b3('0x10'),JSON[_0x14b3('0x13')](_0x1dfeee));if(_0x1dfeee['error']){if(_0x1dfeee['error'][_0x14b3('0x14')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x1dfeee[_0x14b3('0x15')]['message']);return _0x1c6cec(_0x1dfeee[_0x14b3('0x15')][_0x14b3('0x16')]);}logger[_0x14b3('0x15')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x1dfeee['error'][_0x14b3('0x16')]);return _0x76d275(_0x1dfeee[_0x14b3('0x15')][_0x14b3('0x16')]);}else{logger[_0x14b3('0xf')](_0x14b3('0x17'),_0xd6a5e9,'request\x20sent');_0x76d275(_0x1dfeee['result'][_0x14b3('0x16')]);}})[_0x14b3('0x18')](function(_0x413504){logger[_0x14b3('0x15')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xd6a5e9,_0x413504);_0x1c6cec(_0x413504);});});} \ No newline at end of file +var _0x6152=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x51b2f7,_0x303ad2){var _0x556d95=function(_0x43bbdb){while(--_0x43bbdb){_0x51b2f7['push'](_0x51b2f7['shift']());}};_0x556d95(++_0x303ad2);}(_0x6152,0x95));var _0x2615=function(_0x2b0c13,_0x24a9aa){_0x2b0c13=_0x2b0c13-0x0;var _0x3008ce=_0x6152[_0x2b0c13];return _0x3008ce;};'use strict';var _=require(_0x2615('0x0'));var util=require(_0x2615('0x1'));var moment=require(_0x2615('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2615('0x3'));var db=require(_0x2615('0x4'))['db'];var utils=require(_0x2615('0x5'));var logger=require('../../config/logger')(_0x2615('0x6'));var config=require(_0x2615('0x7'));var jayson=require(_0x2615('0x8'));var client=jayson[_0x2615('0x9')][_0x2615('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13e166,_0x4bb5c9,_0xc3985f){return new BPromise(function(_0x313060,_0x1c6a17){return client['request'](_0x13e166,_0xc3985f)[_0x2615('0xb')](function(_0x2825d0){logger[_0x2615('0xc')](_0x2615('0xd'),_0x4bb5c9,'request\x20sent');logger[_0x2615('0xe')](_0x2615('0xf'),_0x4bb5c9,_0x2615('0x10'),JSON['stringify'](_0x2825d0));if(_0x2825d0[_0x2615('0x11')]){if(_0x2825d0[_0x2615('0x11')]['code']===0x1f4){logger[_0x2615('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4bb5c9,_0x2825d0['error'][_0x2615('0x12')]);return _0x1c6a17(_0x2825d0[_0x2615('0x11')][_0x2615('0x12')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4bb5c9,_0x2825d0[_0x2615('0x11')][_0x2615('0x12')]);return _0x313060(_0x2825d0['error']['message']);}else{logger['info'](_0x2615('0xd'),_0x4bb5c9,_0x2615('0x10'));_0x313060(_0x2825d0[_0x2615('0x13')][_0x2615('0x12')]);}})[_0x2615('0x14')](function(_0x99574c){logger[_0x2615('0x11')](_0x2615('0xd'),_0x4bb5c9,_0x99574c);_0x1c6a17(_0x99574c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 074f273..a10e23f 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e17=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','post'];(function(_0x3a7db0,_0xe93c50){var _0x17cbba=function(_0x577f4c){while(--_0x577f4c){_0x3a7db0['push'](_0x3a7db0['shift']());}};_0x17cbba(++_0xe93c50);}(_0x9e17,0x12c));var _0x79e1=function(_0x5dcfd0,_0x19b914){_0x5dcfd0=_0x5dcfd0-0x0;var _0x5e7661=_0x9e17[_0x5dcfd0];return _0x5e7661;};'use strict';var multer=require(_0x79e1('0x0'));var util=require('util');var path=require(_0x79e1('0x1'));var timeout=require(_0x79e1('0x2'));var express=require(_0x79e1('0x3'));var router=express[_0x79e1('0x4')]();var fs_extra=require(_0x79e1('0x5'));var auth=require(_0x79e1('0x6'));var interaction=require(_0x79e1('0x7'));var config=require(_0x79e1('0x8'));var controller=require(_0x79e1('0x9'));router[_0x79e1('0xa')]('/',auth['isAuthenticated'](),controller[_0x79e1('0xb')]);router[_0x79e1('0xa')](_0x79e1('0xc'),auth[_0x79e1('0xd')](),controller['show']);router[_0x79e1('0xe')]('/',auth['isAuthenticated'](),controller[_0x79e1('0xf')]);router[_0x79e1('0x10')]('/:id',auth[_0x79e1('0xd')](),controller[_0x79e1('0x11')]);router[_0x79e1('0x12')]('/:id',auth[_0x79e1('0xd')](),controller[_0x79e1('0x13')]);module[_0x79e1('0x14')]=router; \ No newline at end of file +var _0x23b4=['show','post','create','update','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x23b4,0x16e));var _0x423b=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0x23b4[_0x3bee55];return _0x5649d2;};'use strict';var multer=require('multer');var util=require(_0x423b('0x0'));var path=require(_0x423b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x423b('0x2')]();var fs_extra=require(_0x423b('0x3'));var auth=require(_0x423b('0x4'));var interaction=require(_0x423b('0x5'));var config=require(_0x423b('0x6'));var controller=require(_0x423b('0x7'));router[_0x423b('0x8')]('/',auth['isAuthenticated'](),controller[_0x423b('0x9')]);router['get'](_0x423b('0xa'),auth[_0x423b('0xb')](),controller[_0x423b('0xc')]);router[_0x423b('0xd')]('/',auth['isAuthenticated'](),controller[_0x423b('0xe')]);router['put'](_0x423b('0xa'),auth[_0x423b('0xb')](),controller[_0x423b('0xf')]);router['delete'](_0x423b('0xa'),auth['isAuthenticated'](),controller[_0x423b('0x10')]);module[_0x423b('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 594b3de..5e3f5f3 100644 --- a/server/api/pause/pause.attributes.js +++ b/server/api/pause/pause.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1bd=['sequelize','name','STRING'];(function(_0x58c7a1,_0x5b7b53){var _0x28ca7d=function(_0xb2b268){while(--_0xb2b268){_0x58c7a1['push'](_0x58c7a1['shift']());}};_0x28ca7d(++_0x5b7b53);}(_0xf1bd,0x183));var _0xdf1b=function(_0x2378ef,_0x2bae69){_0x2378ef=_0x2378ef-0x0;var _0x5f4843=_0xf1bd[_0x2378ef];return _0x5f4843;};'use strict';var Sequelize=require(_0xdf1b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdf1b('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xdf1b('0x2')]}}; \ No newline at end of file +var _0x0368=['name'];(function(_0xbc1991,_0x3c7a47){var _0x1edb65=function(_0x43487f){while(--_0x43487f){_0xbc1991['push'](_0xbc1991['shift']());}};_0x1edb65(++_0x3c7a47);}(_0x0368,0x12a));var _0x8036=function(_0x2e16d8,_0x1110ff){_0x2e16d8=_0x2e16d8-0x0;var _0xbb0a07=_0x0368[_0x2e16d8];return _0xbb0a07;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8036('0x0'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d5fae1c..2122a30 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6eb6=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','render','merge','body','message','interaction','account','index','map','Pause','rawAttributes','fieldName','key','query','keys','attributes','intersection','fields','model','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x6b1c2f,_0x7fcfd5){var _0x558d75=function(_0x4dee6e){while(--_0x4dee6e){_0x6b1c2f['push'](_0x6b1c2f['shift']());}};_0x558d75(++_0x7fcfd5);}(_0x6eb6,0xea));var _0x66eb=function(_0xd15f30,_0x2587e0){_0xd15f30=_0xd15f30-0x0;var _0x4df2a8=_0x6eb6[_0xd15f30];return _0x4df2a8;};'use strict';var emlformat=require(_0x66eb('0x0'));var rimraf=require(_0x66eb('0x1'));var zipdir=require(_0x66eb('0x2'));var jsonpatch=require(_0x66eb('0x3'));var rp=require(_0x66eb('0x4'));var moment=require('moment');var BPromise=require(_0x66eb('0x5'));var Mustache=require(_0x66eb('0x6'));var util=require(_0x66eb('0x7'));var path=require(_0x66eb('0x8'));var sox=require(_0x66eb('0x9'));var csv=require(_0x66eb('0xa'));var ejs=require(_0x66eb('0xb'));var fs=require('fs');var fs_extra=require(_0x66eb('0xc'));var _=require('lodash');var squel=require(_0x66eb('0xd'));var crypto=require(_0x66eb('0xe'));var jsforce=require(_0x66eb('0xf'));var deskjs=require(_0x66eb('0x10'));var toCsv=require(_0x66eb('0xa'));var querystring=require(_0x66eb('0x11'));var Papa=require('papaparse');var Redis=require(_0x66eb('0x12'));var authService=require(_0x66eb('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x66eb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x66eb('0x15'));var utils=require(_0x66eb('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdbd910,_0x4ad4b4){_0x4ad4b4=_0x4ad4b4||0xcc;return function(_0x1cdeb8){if(_0x1cdeb8){return _0xdbd910['sendStatus'](_0x4ad4b4);}return _0xdbd910[_0x66eb('0x17')](_0x4ad4b4)['end']();};}function respondWithResult(_0x278004,_0x4cddd2){_0x4cddd2=_0x4cddd2||0xc8;return function(_0x25f9d0){if(_0x25f9d0){return _0x278004[_0x66eb('0x17')](_0x4cddd2)[_0x66eb('0x18')](_0x25f9d0);}};}function respondWithFilteredResult(_0x4c9f02,_0x41560a){return function(_0x4bbb69){if(_0x4bbb69){var _0x37bf0c=typeof _0x41560a[_0x66eb('0x19')]===_0x66eb('0x1a')&&typeof _0x41560a[_0x66eb('0x1b')]===_0x66eb('0x1a');var _0x45c369=_0x4bbb69[_0x66eb('0x1c')];var _0x53c0c1=_0x37bf0c?0x0:_0x41560a['offset'];var _0x3951f9=_0x37bf0c?_0x4bbb69[_0x66eb('0x1c')]:_0x41560a[_0x66eb('0x19')]+_0x41560a[_0x66eb('0x1b')];var _0xedd8aa;if(_0x3951f9>=_0x45c369){_0x3951f9=_0x45c369;_0xedd8aa=0xc8;}else{_0xedd8aa=0xce;}_0x4c9f02[_0x66eb('0x17')](_0xedd8aa);return _0x4c9f02['set'](_0x66eb('0x1d'),_0x53c0c1+'-'+_0x3951f9+'/'+_0x45c369)[_0x66eb('0x18')](_0x4bbb69);}return null;};}function patchUpdates(_0x3df22b){return function(_0x4ad360){try{jsonpatch[_0x66eb('0x1e')](_0x4ad360,_0x3df22b,!![]);}catch(_0x1afad9){return BPromise[_0x66eb('0x1f')](_0x1afad9);}return _0x4ad360['save']();};}function saveUpdates(_0x34eae5,_0x18c5a7){return function(_0x59c3d9){if(_0x59c3d9){return _0x59c3d9[_0x66eb('0x20')](_0x34eae5)[_0x66eb('0x21')](function(_0x480786){return _0x480786;});}return null;};}function removeEntity(_0x8df388,_0x20232c){return function(_0x3ac871){if(_0x3ac871){return _0x3ac871[_0x66eb('0x22')]()[_0x66eb('0x21')](function(){var _0x5ca4bb=_0x3ac871[_0x66eb('0x23')]({'plain':!![]});var _0x3594bf=_0x66eb('0x24');return db[_0x66eb('0x25')][_0x66eb('0x22')]({'where':{'type':_0x3594bf,'resourceId':_0x5ca4bb['id']}})[_0x66eb('0x21')](function(){return _0x3ac871;});})[_0x66eb('0x21')](function(){_0x8df388[_0x66eb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x419948,_0x2a658c){return function(_0x2ad409){if(!_0x2ad409){_0x419948[_0x66eb('0x26')](0x194);}return _0x2ad409;};}function handleError(_0x2b3832,_0x39d0b8){_0x39d0b8=_0x39d0b8||0x1f4;return function(_0x409d06){logger[_0x66eb('0x27')](_0x409d06[_0x66eb('0x28')]);if(_0x409d06['name']){delete _0x409d06[_0x66eb('0x29')];}_0x2b3832[_0x66eb('0x17')](_0x39d0b8)['send'](_0x409d06);};}function getMustacheRender(_0x22cd82,_0x33d3e6){return Mustache[_0x66eb('0x2a')](_0x22cd82,_[_0x66eb('0x2b')](_0x33d3e6[_0x66eb('0x2c')],{'contact':_0x33d3e6['contact'],'message':_0x33d3e6[_0x66eb('0x2d')],'agent':_0x33d3e6['agent'],'interaction':_0x33d3e6[_0x66eb('0x2e')],'account':_0x33d3e6[_0x66eb('0x2f')]}))||'';}exports[_0x66eb('0x30')]=function(_0x278123,_0x480ad8){var _0x1f52eb={},_0x16c90f={},_0xaf3ddc={'count':0x0,'rows':[]};var _0x1d35e4=_[_0x66eb('0x31')](db[_0x66eb('0x32')][_0x66eb('0x33')],function(_0x229878){return{'name':_0x229878[_0x66eb('0x34')],'type':_0x229878['type'][_0x66eb('0x35')]};});_0x16c90f['model']=_[_0x66eb('0x31')](_0x1d35e4,'name');_0x16c90f[_0x66eb('0x36')]=_[_0x66eb('0x37')](_0x278123[_0x66eb('0x36')]);_0x16c90f['filters']=_['intersection'](_0x16c90f['model'],_0x16c90f[_0x66eb('0x36')]);_0x1f52eb[_0x66eb('0x38')]=_[_0x66eb('0x39')](_0x16c90f['model'],qs[_0x66eb('0x3a')](_0x278123[_0x66eb('0x36')]['fields']));_0x1f52eb[_0x66eb('0x38')]=_0x1f52eb[_0x66eb('0x38')]['length']?_0x1f52eb[_0x66eb('0x38')]:_0x16c90f[_0x66eb('0x3b')];if(!_0x278123[_0x66eb('0x36')][_0x66eb('0x3c')]('nolimit')){_0x1f52eb[_0x66eb('0x1b')]=qs['limit'](_0x278123[_0x66eb('0x36')][_0x66eb('0x1b')]);_0x1f52eb[_0x66eb('0x19')]=qs[_0x66eb('0x19')](_0x278123[_0x66eb('0x36')]['offset']);}_0x1f52eb[_0x66eb('0x3d')]=qs[_0x66eb('0x3e')](_0x278123[_0x66eb('0x36')]['sort']);_0x1f52eb[_0x66eb('0x3f')]=qs[_0x66eb('0x40')](_[_0x66eb('0x41')](_0x278123[_0x66eb('0x36')],_0x16c90f[_0x66eb('0x40')]),_0x1d35e4);if(_0x278123[_0x66eb('0x36')][_0x66eb('0x42')]){_0x1f52eb[_0x66eb('0x3f')]=_['merge'](_0x1f52eb['where'],{'$or':_[_0x66eb('0x31')](_0x1d35e4,function(_0x38745b){if(_0x38745b[_0x66eb('0x43')]!==_0x66eb('0x44')){var _0x592709={};_0x592709[_0x38745b['name']]={'$like':'%'+_0x278123['query'][_0x66eb('0x42')]+'%'};return _0x592709;}})});}_0x1f52eb=_[_0x66eb('0x2b')]({},_0x1f52eb,_0x278123[_0x66eb('0x45')]);var _0x57f4c7={'where':_0x1f52eb['where']};return db[_0x66eb('0x32')][_0x66eb('0x1c')](_0x57f4c7)[_0x66eb('0x21')](function(_0x308575){_0xaf3ddc[_0x66eb('0x1c')]=_0x308575;if(_0x278123[_0x66eb('0x36')][_0x66eb('0x46')]){_0x1f52eb[_0x66eb('0x47')]=[{'all':!![]}];}return db[_0x66eb('0x32')][_0x66eb('0x48')](_0x1f52eb);})[_0x66eb('0x21')](function(_0xf1c045){_0xaf3ddc['rows']=_0xf1c045;return _0xaf3ddc;})[_0x66eb('0x21')](respondWithFilteredResult(_0x480ad8,_0x1f52eb))[_0x66eb('0x49')](handleError(_0x480ad8,null));};exports[_0x66eb('0x4a')]=function(_0x259d9e,_0x5c3184){var _0x33193c={'raw':!![],'where':{'id':_0x259d9e[_0x66eb('0x4b')]['id']}},_0x241ab3={};_0x241ab3[_0x66eb('0x3b')]=_[_0x66eb('0x37')](db[_0x66eb('0x32')][_0x66eb('0x33')]);_0x241ab3['query']=_['keys'](_0x259d9e[_0x66eb('0x36')]);_0x241ab3[_0x66eb('0x40')]=_[_0x66eb('0x39')](_0x241ab3[_0x66eb('0x3b')],_0x241ab3[_0x66eb('0x36')]);_0x33193c[_0x66eb('0x38')]=_['intersection'](_0x241ab3['model'],qs['fields'](_0x259d9e[_0x66eb('0x36')][_0x66eb('0x3a')]));_0x33193c[_0x66eb('0x38')]=_0x33193c[_0x66eb('0x38')][_0x66eb('0x4c')]?_0x33193c[_0x66eb('0x38')]:_0x241ab3[_0x66eb('0x3b')];if(_0x259d9e['query']['includeAll']){_0x33193c['include']=[{'all':!![]}];}_0x33193c=_[_0x66eb('0x2b')]({},_0x33193c,_0x259d9e[_0x66eb('0x45')]);return db['Pause']['find'](_0x33193c)['then'](handleEntityNotFound(_0x5c3184,null))[_0x66eb('0x21')](respondWithResult(_0x5c3184,null))[_0x66eb('0x49')](handleError(_0x5c3184,null));};exports[_0x66eb('0x4d')]=function(_0x4d32d8,_0x3b9135){return db['Pause'][_0x66eb('0x4d')](_0x4d32d8[_0x66eb('0x2c')],{})[_0x66eb('0x21')](function(_0x42979d){var _0x280968=_0x4d32d8[_0x66eb('0x4e')]['get']({'plain':!![]});if(!_0x280968)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x280968['role']===_0x66eb('0x4e')){var _0x18aa21=_0x42979d[_0x66eb('0x23')]({'plain':!![]});var _0x3ee079=_0x66eb('0x24');return db[_0x66eb('0x4f')]['find']({'where':{'name':_0x3ee079,'userProfileId':_0x280968[_0x66eb('0x50')]},'raw':!![]})['then'](function(_0xa20196){if(_0xa20196&&_0xa20196[_0x66eb('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x18aa21[_0x66eb('0x29')],'resourceId':_0x18aa21['id'],'type':_0xa20196[_0x66eb('0x29')],'sectionId':_0xa20196['id']},{})[_0x66eb('0x21')](function(){return _0x42979d;});}else{return _0x42979d;}})['catch'](function(_0x68ea09){logger[_0x66eb('0x27')](_0x66eb('0x52'),_0x68ea09);throw _0x68ea09;});}return _0x42979d;})[_0x66eb('0x21')](respondWithResult(_0x3b9135,0xc9))[_0x66eb('0x49')](handleError(_0x3b9135,null));};exports[_0x66eb('0x20')]=function(_0x3376f8,_0x511930){if(_0x3376f8[_0x66eb('0x2c')]['id']){delete _0x3376f8[_0x66eb('0x2c')]['id'];}return db['Pause'][_0x66eb('0x53')]({'where':{'id':_0x3376f8[_0x66eb('0x4b')]['id']}})[_0x66eb('0x21')](handleEntityNotFound(_0x511930,null))[_0x66eb('0x21')](saveUpdates(_0x3376f8[_0x66eb('0x2c')],null))['then'](respondWithResult(_0x511930,null))[_0x66eb('0x49')](handleError(_0x511930,null));};exports['destroy']=function(_0x192ea6,_0x1553eb){return db[_0x66eb('0x32')][_0x66eb('0x53')]({'where':{'id':_0x192ea6[_0x66eb('0x4b')]['id']}})[_0x66eb('0x21')](handleEntityNotFound(_0x1553eb,null))['then'](removeEntity(_0x1553eb,null))['catch'](handleError(_0x1553eb,null));}; \ No newline at end of file +var _0x3415=['UserProfileResource','end','stack','name','send','body','message','agent','interaction','account','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Pause','findAll','show','keys','rawAttributes','find','catch','create','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','get','Pauses'];(function(_0xa0c623,_0x55d68d){var _0x5a34d3=function(_0x2885ed){while(--_0x2885ed){_0xa0c623['push'](_0xa0c623['shift']());}};_0x5a34d3(++_0x55d68d);}(_0x3415,0x81));var _0x5341=function(_0x5e4d4f,_0x555b7b){_0x5e4d4f=_0x5e4d4f-0x0;var _0x35bd87=_0x3415[_0x5e4d4f];return _0x35bd87;};'use strict';var emlformat=require(_0x5341('0x0'));var rimraf=require(_0x5341('0x1'));var zipdir=require(_0x5341('0x2'));var jsonpatch=require(_0x5341('0x3'));var rp=require(_0x5341('0x4'));var moment=require(_0x5341('0x5'));var BPromise=require(_0x5341('0x6'));var Mustache=require(_0x5341('0x7'));var util=require(_0x5341('0x8'));var path=require('path');var sox=require(_0x5341('0x9'));var csv=require(_0x5341('0xa'));var ejs=require(_0x5341('0xb'));var fs=require('fs');var fs_extra=require(_0x5341('0xc'));var _=require(_0x5341('0xd'));var squel=require(_0x5341('0xe'));var crypto=require(_0x5341('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5341('0xa'));var querystring=require(_0x5341('0x10'));var Papa=require(_0x5341('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5341('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5341('0x13'));var utils=require(_0x5341('0x14'));var config=require(_0x5341('0x15'));var licenseUtil=require(_0x5341('0x16'));var db=require(_0x5341('0x17'))['db'];function respondWithStatusCode(_0x2fbf89,_0x3d8287){_0x3d8287=_0x3d8287||0xcc;return function(_0x4ade7d){if(_0x4ade7d){return _0x2fbf89[_0x5341('0x18')](_0x3d8287);}return _0x2fbf89[_0x5341('0x19')](_0x3d8287)['end']();};}function respondWithResult(_0x5ca897,_0x4f7daa){_0x4f7daa=_0x4f7daa||0xc8;return function(_0x264ab0){if(_0x264ab0){return _0x5ca897[_0x5341('0x19')](_0x4f7daa)[_0x5341('0x1a')](_0x264ab0);}};}function respondWithFilteredResult(_0x2ebd1f,_0x3a7a39){return function(_0x4f3170){if(_0x4f3170){var _0x1d8002=typeof _0x3a7a39['offset']===_0x5341('0x1b')&&typeof _0x3a7a39[_0x5341('0x1c')]===_0x5341('0x1b');var _0x3e2fd8=_0x4f3170[_0x5341('0x1d')];var _0x700dee=_0x1d8002?0x0:_0x3a7a39['offset'];var _0x389d71=_0x1d8002?_0x4f3170[_0x5341('0x1d')]:_0x3a7a39[_0x5341('0x1e')]+_0x3a7a39[_0x5341('0x1c')];var _0x1172c7;if(_0x389d71>=_0x3e2fd8){_0x389d71=_0x3e2fd8;_0x1172c7=0xc8;}else{_0x1172c7=0xce;}_0x2ebd1f['status'](_0x1172c7);return _0x2ebd1f[_0x5341('0x1f')](_0x5341('0x20'),_0x700dee+'-'+_0x389d71+'/'+_0x3e2fd8)[_0x5341('0x1a')](_0x4f3170);}return null;};}function patchUpdates(_0x2de9fe){return function(_0x2e1d68){try{jsonpatch['apply'](_0x2e1d68,_0x2de9fe,!![]);}catch(_0x4e0b3d){return BPromise[_0x5341('0x21')](_0x4e0b3d);}return _0x2e1d68['save']();};}function saveUpdates(_0xda64c7,_0x35e50f){return function(_0x5ca010){if(_0x5ca010){return _0x5ca010[_0x5341('0x22')](_0xda64c7)[_0x5341('0x23')](function(_0x260f3c){return _0x260f3c;});}return null;};}function removeEntity(_0x18962a,_0x15e657){return function(_0x319023){if(_0x319023){return _0x319023[_0x5341('0x24')]()[_0x5341('0x23')](function(){var _0x4c1e6a=_0x319023[_0x5341('0x25')]({'plain':!![]});var _0x2269d5=_0x5341('0x26');return db[_0x5341('0x27')][_0x5341('0x24')]({'where':{'type':_0x2269d5,'resourceId':_0x4c1e6a['id']}})[_0x5341('0x23')](function(){return _0x319023;});})[_0x5341('0x23')](function(){_0x18962a['status'](0xcc)[_0x5341('0x28')]();});}};}function handleEntityNotFound(_0x3350b9,_0x300366){return function(_0x4cb6ab){if(!_0x4cb6ab){_0x3350b9[_0x5341('0x18')](0x194);}return _0x4cb6ab;};}function handleError(_0x32da38,_0x2f53b8){_0x2f53b8=_0x2f53b8||0x1f4;return function(_0x261df1){logger['error'](_0x261df1[_0x5341('0x29')]);if(_0x261df1[_0x5341('0x2a')]){delete _0x261df1[_0x5341('0x2a')];}_0x32da38['status'](_0x2f53b8)[_0x5341('0x2b')](_0x261df1);};}function getMustacheRender(_0xd86b53,_0x342277){return Mustache['render'](_0xd86b53,_['merge'](_0x342277[_0x5341('0x2c')],{'contact':_0x342277['contact'],'message':_0x342277[_0x5341('0x2d')],'agent':_0x342277[_0x5341('0x2e')],'interaction':_0x342277[_0x5341('0x2f')],'account':_0x342277[_0x5341('0x30')]}))||'';}exports[_0x5341('0x31')]=function(_0x5eb731,_0x297058){var _0x4783b5={},_0x258dc0={},_0x2c7689={'count':0x0,'rows':[]};var _0xe8d16e=_[_0x5341('0x32')](db['Pause']['rawAttributes'],function(_0x31c2ae){return{'name':_0x31c2ae[_0x5341('0x33')],'type':_0x31c2ae[_0x5341('0x34')]['key']};});_0x258dc0[_0x5341('0x35')]=_['map'](_0xe8d16e,_0x5341('0x2a'));_0x258dc0[_0x5341('0x36')]=_['keys'](_0x5eb731[_0x5341('0x36')]);_0x258dc0[_0x5341('0x37')]=_[_0x5341('0x38')](_0x258dc0['model'],_0x258dc0[_0x5341('0x36')]);_0x4783b5[_0x5341('0x39')]=_[_0x5341('0x38')](_0x258dc0[_0x5341('0x35')],qs[_0x5341('0x3a')](_0x5eb731[_0x5341('0x36')][_0x5341('0x3a')]));_0x4783b5[_0x5341('0x39')]=_0x4783b5[_0x5341('0x39')][_0x5341('0x3b')]?_0x4783b5[_0x5341('0x39')]:_0x258dc0['model'];if(!_0x5eb731[_0x5341('0x36')]['hasOwnProperty'](_0x5341('0x3c'))){_0x4783b5[_0x5341('0x1c')]=qs[_0x5341('0x1c')](_0x5eb731[_0x5341('0x36')][_0x5341('0x1c')]);_0x4783b5[_0x5341('0x1e')]=qs[_0x5341('0x1e')](_0x5eb731[_0x5341('0x36')][_0x5341('0x1e')]);}_0x4783b5[_0x5341('0x3d')]=qs[_0x5341('0x3e')](_0x5eb731[_0x5341('0x36')][_0x5341('0x3e')]);_0x4783b5[_0x5341('0x3f')]=qs[_0x5341('0x37')](_[_0x5341('0x40')](_0x5eb731[_0x5341('0x36')],_0x258dc0[_0x5341('0x37')]),_0xe8d16e);if(_0x5eb731[_0x5341('0x36')][_0x5341('0x41')]){_0x4783b5[_0x5341('0x3f')]=_[_0x5341('0x42')](_0x4783b5['where'],{'$or':_['map'](_0xe8d16e,function(_0x5f4b25){if(_0x5f4b25[_0x5341('0x34')]!==_0x5341('0x43')){var _0x269bc3={};_0x269bc3[_0x5f4b25[_0x5341('0x2a')]]={'$like':'%'+_0x5eb731[_0x5341('0x36')][_0x5341('0x41')]+'%'};return _0x269bc3;}})});}_0x4783b5=_[_0x5341('0x42')]({},_0x4783b5,_0x5eb731[_0x5341('0x44')]);var _0x23591a={'where':_0x4783b5[_0x5341('0x3f')]};return db['Pause'][_0x5341('0x1d')](_0x23591a)[_0x5341('0x23')](function(_0x6fc0a){_0x2c7689[_0x5341('0x1d')]=_0x6fc0a;if(_0x5eb731['query'][_0x5341('0x45')]){_0x4783b5[_0x5341('0x46')]=[{'all':!![]}];}return db[_0x5341('0x47')][_0x5341('0x48')](_0x4783b5);})[_0x5341('0x23')](function(_0x2cf4bd){_0x2c7689['rows']=_0x2cf4bd;return _0x2c7689;})[_0x5341('0x23')](respondWithFilteredResult(_0x297058,_0x4783b5))['catch'](handleError(_0x297058,null));};exports[_0x5341('0x49')]=function(_0x286582,_0x2ed611){var _0x57265e={'raw':!![],'where':{'id':_0x286582['params']['id']}},_0x194c78={};_0x194c78[_0x5341('0x35')]=_[_0x5341('0x4a')](db[_0x5341('0x47')][_0x5341('0x4b')]);_0x194c78[_0x5341('0x36')]=_['keys'](_0x286582[_0x5341('0x36')]);_0x194c78[_0x5341('0x37')]=_[_0x5341('0x38')](_0x194c78[_0x5341('0x35')],_0x194c78[_0x5341('0x36')]);_0x57265e[_0x5341('0x39')]=_[_0x5341('0x38')](_0x194c78['model'],qs[_0x5341('0x3a')](_0x286582[_0x5341('0x36')]['fields']));_0x57265e[_0x5341('0x39')]=_0x57265e[_0x5341('0x39')][_0x5341('0x3b')]?_0x57265e[_0x5341('0x39')]:_0x194c78['model'];if(_0x286582[_0x5341('0x36')][_0x5341('0x45')]){_0x57265e[_0x5341('0x46')]=[{'all':!![]}];}_0x57265e=_[_0x5341('0x42')]({},_0x57265e,_0x286582[_0x5341('0x44')]);return db['Pause'][_0x5341('0x4c')](_0x57265e)[_0x5341('0x23')](handleEntityNotFound(_0x2ed611,null))['then'](respondWithResult(_0x2ed611,null))[_0x5341('0x4d')](handleError(_0x2ed611,null));};exports[_0x5341('0x4e')]=function(_0x4ac1d6,_0x5eded4){return db[_0x5341('0x47')][_0x5341('0x4e')](_0x4ac1d6['body'],{})[_0x5341('0x23')](function(_0x442711){var _0x3256e3=_0x4ac1d6['user'][_0x5341('0x25')]({'plain':!![]});if(!_0x3256e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3256e3['role']==='user'){var _0x3cbf5d=_0x442711[_0x5341('0x25')]({'plain':!![]});var _0x54f78b='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x54f78b,'userProfileId':_0x3256e3[_0x5341('0x4f')]},'raw':!![]})[_0x5341('0x23')](function(_0x3fbf09){if(_0x3fbf09&&_0x3fbf09[_0x5341('0x50')]===0x0){return db[_0x5341('0x27')][_0x5341('0x4e')]({'name':_0x3cbf5d[_0x5341('0x2a')],'resourceId':_0x3cbf5d['id'],'type':_0x3fbf09[_0x5341('0x2a')],'sectionId':_0x3fbf09['id']},{})[_0x5341('0x23')](function(){return _0x442711;});}else{return _0x442711;}})[_0x5341('0x4d')](function(_0x3ebfc2){logger[_0x5341('0x51')](_0x5341('0x52'),_0x3ebfc2);throw _0x3ebfc2;});}return _0x442711;})['then'](respondWithResult(_0x5eded4,0xc9))['catch'](handleError(_0x5eded4,null));};exports[_0x5341('0x22')]=function(_0x49be33,_0x3c70a6){if(_0x49be33[_0x5341('0x2c')]['id']){delete _0x49be33[_0x5341('0x2c')]['id'];}return db['Pause'][_0x5341('0x4c')]({'where':{'id':_0x49be33['params']['id']}})['then'](handleEntityNotFound(_0x3c70a6,null))[_0x5341('0x23')](saveUpdates(_0x49be33['body'],null))[_0x5341('0x23')](respondWithResult(_0x3c70a6,null))[_0x5341('0x4d')](handleError(_0x3c70a6,null));};exports['destroy']=function(_0xf12a30,_0x49c92a){return db['Pause']['find']({'where':{'id':_0xf12a30[_0x5341('0x53')]['id']}})[_0x5341('0x23')](handleEntityNotFound(_0x49c92a,null))[_0x5341('0x23')](removeEntity(_0x49c92a,null))[_0x5341('0x4d')](handleError(_0x49c92a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ef497da..8242d92 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61d0=['rimraf','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','bluebird','path'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0x61d0,0x187));var _0x061d=function(_0x44b3f6,_0x2f0b79){_0x44b3f6=_0x44b3f6-0x0;var _0x4a6207=_0x61d0[_0x44b3f6];return _0x4a6207;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var logger=require(_0x061d('0x1'))(_0x061d('0x2'));var moment=require('moment');var BPromise=require(_0x061d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x061d('0x4'));var rimraf=require(_0x061d('0x5'));var config=require('../../config/environment');var attributes=require(_0x061d('0x6'));module[_0x061d('0x7')]=function(_0x14e976,_0x255478){return _0x14e976[_0x061d('0x8')](_0x061d('0x9'),attributes,{'tableName':_0x061d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf846=['Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes','exports','define'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xf846,0x85));var _0x6f84=function(_0x14b9fb,_0x4ca486){_0x14b9fb=_0x14b9fb-0x0;var _0x1ea175=_0xf846[_0x14b9fb];return _0x1ea175;};'use strict';var _=require(_0x6f84('0x0'));var util=require(_0x6f84('0x1'));var logger=require(_0x6f84('0x2'))(_0x6f84('0x3'));var moment=require('moment');var BPromise=require(_0x6f84('0x4'));var rp=require(_0x6f84('0x5'));var fs=require('fs');var path=require(_0x6f84('0x6'));var rimraf=require(_0x6f84('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f84('0x8'));module[_0x6f84('0x9')]=function(_0x2963cd,_0x25e3c2){return _0x2963cd[_0x6f84('0xa')](_0x6f84('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index cc6deaa..ef4d75d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ca3=['Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowPause','Pause','options','raw','where','include','map','model','attributes','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','info'];(function(_0x3653c7,_0xadb356){var _0x58a021=function(_0x20b237){while(--_0x20b237){_0x3653c7['push'](_0x3653c7['shift']());}};_0x58a021(++_0xadb356);}(_0x1ca3,0x6e));var _0x31ca=function(_0x2b4fe7,_0x294774){_0x2b4fe7=_0x2b4fe7-0x0;var _0x302bdc=_0x1ca3[_0x2b4fe7];return _0x302bdc;};'use strict';var _=require(_0x31ca('0x0'));var util=require(_0x31ca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x31ca('0x2'));var fs=require('fs');var Redis=require(_0x31ca('0x3'));var db=require(_0x31ca('0x4'))['db'];var utils=require(_0x31ca('0x5'));var logger=require(_0x31ca('0x6'))('rpc');var config=require(_0x31ca('0x7'));var jayson=require(_0x31ca('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x247f4e,_0x1ae5cf,_0x4a1de6){return new BPromise(function(_0x15dff2,_0x280785){return client['request'](_0x247f4e,_0x4a1de6)['then'](function(_0x15fe81){logger[_0x31ca('0x9')](_0x31ca('0xa'),_0x1ae5cf,_0x31ca('0xb'));logger['debug'](_0x31ca('0xc'),_0x1ae5cf,_0x31ca('0xb'),JSON[_0x31ca('0xd')](_0x15fe81));if(_0x15fe81[_0x31ca('0xe')]){if(_0x15fe81[_0x31ca('0xe')][_0x31ca('0xf')]===0x1f4){logger[_0x31ca('0xe')]('Pause,\x20%s,\x20%s',_0x1ae5cf,_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);return _0x280785(_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);}logger['error'](_0x31ca('0xa'),_0x1ae5cf,_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);return _0x15dff2(_0x15fe81[_0x31ca('0xe')][_0x31ca('0x10')]);}else{logger[_0x31ca('0x9')](_0x31ca('0xa'),_0x1ae5cf,_0x31ca('0xb'));_0x15dff2(_0x15fe81[_0x31ca('0x11')][_0x31ca('0x10')]);}})[_0x31ca('0x12')](function(_0x301bc2){logger[_0x31ca('0xe')](_0x31ca('0xa'),_0x1ae5cf,_0x301bc2);_0x280785(_0x301bc2);});});}exports[_0x31ca('0x13')]=function(_0x2f4a62){var _0x4f6800=this;return new Promise(function(_0x485923,_0x532edd){return db[_0x31ca('0x14')]['find']({'raw':_0x2f4a62['options']?_0x2f4a62[_0x31ca('0x15')][_0x31ca('0x16')]===undefined?!![]:![]:!![],'where':_0x2f4a62['options']?_0x2f4a62['options'][_0x31ca('0x17')]||null:null,'attributes':_0x2f4a62[_0x31ca('0x15')]?_0x2f4a62[_0x31ca('0x15')]['attributes']||null:null,'include':_0x2f4a62['options']?_0x2f4a62['options'][_0x31ca('0x18')]?_[_0x31ca('0x19')](_0x2f4a62[_0x31ca('0x15')]['include'],function(_0x2bdf20){return{'model':db[_0x2bdf20[_0x31ca('0x1a')]],'as':_0x2bdf20['as'],'attributes':_0x2bdf20['attributes'],'include':_0x2bdf20[_0x31ca('0x18')]?_[_0x31ca('0x19')](_0x2bdf20[_0x31ca('0x18')],function(_0x21cd23){return{'model':db[_0x21cd23[_0x31ca('0x1a')]],'as':_0x21cd23['as'],'attributes':_0x21cd23[_0x31ca('0x1b')],'include':_0x21cd23['include']?_['map'](_0x21cd23['include'],function(_0x956360){return{'model':db[_0x956360[_0x31ca('0x1a')]],'as':_0x956360['as'],'attributes':_0x956360[_0x31ca('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x31ca('0x1c')](function(_0x5a0348){logger['info'](_0x31ca('0x13'),_0x2f4a62);logger[_0x31ca('0x1d')](_0x31ca('0x13'),_0x2f4a62,JSON[_0x31ca('0xd')](_0x5a0348));_0x485923(_0x5a0348);})[_0x31ca('0x12')](function(_0x508892){logger[_0x31ca('0xe')](_0x31ca('0x13'),_0x508892[_0x31ca('0x10')],_0x2f4a62);_0x532edd(_0x4f6800['error'](0x1f4,_0x508892[_0x31ca('0x10')]));});});}; \ No newline at end of file +var _0xa378=['request\x20sent','Pause,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Pause','find','options','raw','attributes','map','include','model','ShowPause','debug','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','Pause,\x20%s,\x20%s'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xa378,0xb9));var _0x8a37=function(_0x593fda,_0x46b042){_0x593fda=_0x593fda-0x0;var _0x5d20c1=_0xa378[_0x593fda];return _0x5d20c1;};'use strict';var _=require(_0x8a37('0x0'));var util=require(_0x8a37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a37('0x2'));var fs=require('fs');var Redis=require(_0x8a37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a37('0x4'));var logger=require('../../config/logger')(_0x8a37('0x5'));var config=require(_0x8a37('0x6'));var jayson=require(_0x8a37('0x7'));var client=jayson[_0x8a37('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a9fd3,_0x5630f9,_0x4d8122){return new BPromise(function(_0x4da585,_0xdd74d2){return client['request'](_0x1a9fd3,_0x4d8122)[_0x8a37('0x9')](function(_0x302190){logger['info'](_0x8a37('0xa'),_0x5630f9,_0x8a37('0xb'));logger['debug'](_0x8a37('0xc'),_0x5630f9,_0x8a37('0xb'),JSON['stringify'](_0x302190));if(_0x302190[_0x8a37('0xd')]){if(_0x302190['error'][_0x8a37('0xe')]===0x1f4){logger[_0x8a37('0xd')](_0x8a37('0xa'),_0x5630f9,_0x302190['error'][_0x8a37('0xf')]);return _0xdd74d2(_0x302190[_0x8a37('0xd')][_0x8a37('0xf')]);}logger[_0x8a37('0xd')](_0x8a37('0xa'),_0x5630f9,_0x302190['error'][_0x8a37('0xf')]);return _0x4da585(_0x302190[_0x8a37('0xd')][_0x8a37('0xf')]);}else{logger[_0x8a37('0x10')](_0x8a37('0xa'),_0x5630f9,'request\x20sent');_0x4da585(_0x302190['result'][_0x8a37('0xf')]);}})[_0x8a37('0x11')](function(_0x2e9531){logger[_0x8a37('0xd')]('Pause,\x20%s,\x20%s',_0x5630f9,_0x2e9531);_0xdd74d2(_0x2e9531);});});}exports['ShowPause']=function(_0xad2dee){var _0x6b268d=this;return new Promise(function(_0x4acf44,_0x4539c6){return db[_0x8a37('0x12')][_0x8a37('0x13')]({'raw':_0xad2dee[_0x8a37('0x14')]?_0xad2dee[_0x8a37('0x14')][_0x8a37('0x15')]===undefined?!![]:![]:!![],'where':_0xad2dee[_0x8a37('0x14')]?_0xad2dee[_0x8a37('0x14')]['where']||null:null,'attributes':_0xad2dee[_0x8a37('0x14')]?_0xad2dee[_0x8a37('0x14')][_0x8a37('0x16')]||null:null,'include':_0xad2dee[_0x8a37('0x14')]?_0xad2dee[_0x8a37('0x14')]['include']?_[_0x8a37('0x17')](_0xad2dee['options'][_0x8a37('0x18')],function(_0xfb0aa0){return{'model':db[_0xfb0aa0['model']],'as':_0xfb0aa0['as'],'attributes':_0xfb0aa0[_0x8a37('0x16')],'include':_0xfb0aa0[_0x8a37('0x18')]?_[_0x8a37('0x17')](_0xfb0aa0[_0x8a37('0x18')],function(_0xfdd4a0){return{'model':db[_0xfdd4a0[_0x8a37('0x19')]],'as':_0xfdd4a0['as'],'attributes':_0xfdd4a0[_0x8a37('0x16')],'include':_0xfdd4a0[_0x8a37('0x18')]?_[_0x8a37('0x17')](_0xfdd4a0[_0x8a37('0x18')],function(_0xefa619){return{'model':db[_0xefa619[_0x8a37('0x19')]],'as':_0xefa619['as'],'attributes':_0xefa619[_0x8a37('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8a37('0x9')](function(_0x205cfa){logger['info'](_0x8a37('0x1a'),_0xad2dee);logger[_0x8a37('0x1b')]('ShowPause',_0xad2dee,JSON['stringify'](_0x205cfa));_0x4acf44(_0x205cfa);})[_0x8a37('0x11')](function(_0x22e273){logger['error'](_0x8a37('0x1a'),_0x22e273[_0x8a37('0xf')],_0xad2dee);_0x4539c6(_0x6b268d['error'](0x1f4,_0x22e273['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 14710f2..e0980d4 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46b2=['put','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','file','upload','webhookPost'];(function(_0x2e5952,_0x224f1d){var _0x49f58b=function(_0x286018){while(--_0x286018){_0x2e5952['push'](_0x2e5952['shift']());}};_0x49f58b(++_0x224f1d);}(_0x46b2,0xb7));var _0x246b=function(_0x31d36d,_0x152899){_0x31d36d=_0x31d36d-0x0;var _0xcdd73f=_0x46b2[_0x31d36d];return _0xcdd73f;};'use strict';var multer=require(_0x246b('0x0'));var util=require(_0x246b('0x1'));var path=require(_0x246b('0x2'));var timeout=require(_0x246b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x246b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x246b('0x5'));var config=require('../../config/environment');var controller=require(_0x246b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x246b('0x7')]);router[_0x246b('0x8')](_0x246b('0x9'),controller[_0x246b('0xa')]);router['get'](_0x246b('0xb'),auth[_0x246b('0xc')](),controller['show']);router[_0x246b('0x8')](_0x246b('0xd'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x246b('0xe')]({'destination':function(_0x313361,_0x7d6bd0,_0x270543){_0x270543(null,path[_0x246b('0xf')](config[_0x246b('0x10')],_0x246b('0x11')));},'filename':function(_0x5d23c7,_0x23e396,_0x3e73bf){_0x23e396[_0x246b('0x12')]=_0x23e396[_0x246b('0x12')][_0x246b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e73bf(null,util[_0x246b('0x14')](_0x246b('0x15'),path[_0x246b('0x16')](_0x23e396[_0x246b('0x12')],path[_0x246b('0x17')](_0x23e396[_0x246b('0x12')])),Date['now'](),path[_0x246b('0x17')](_0x23e396[_0x246b('0x12')])));}})});router['post']('/',upload['single'](_0x246b('0x18')),controller[_0x246b('0x19')]);router['post'](_0x246b('0x9'),controller[_0x246b('0x1a')]);router[_0x246b('0x1b')](_0x246b('0xb'),auth[_0x246b('0xc')](),controller[_0x246b('0x1c')]);router[_0x246b('0x1d')]('/:id',auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xd9d8=['single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','show','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now'];(function(_0x53dbf7,_0x4953cc){var _0x543510=function(_0x40eecf){while(--_0x40eecf){_0x53dbf7['push'](_0x53dbf7['shift']());}};_0x543510(++_0x4953cc);}(_0xd9d8,0x1c2));var _0x8d9d=function(_0x2bc59e,_0x2306e8){_0x2bc59e=_0x2bc59e-0x0;var _0x9d5ed2=_0xd9d8[_0x2bc59e];return _0x9d5ed2;};'use strict';var multer=require(_0x8d9d('0x0'));var util=require(_0x8d9d('0x1'));var path=require(_0x8d9d('0x2'));var timeout=require(_0x8d9d('0x3'));var express=require('express');var router=express[_0x8d9d('0x4')]();var fs_extra=require(_0x8d9d('0x5'));var auth=require(_0x8d9d('0x6'));var interaction=require(_0x8d9d('0x7'));var config=require(_0x8d9d('0x8'));var controller=require(_0x8d9d('0x9'));router[_0x8d9d('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d9d('0xb')]);router[_0x8d9d('0xa')]('/webhook',controller[_0x8d9d('0xc')]);router[_0x8d9d('0xa')](_0x8d9d('0xd'),auth[_0x8d9d('0xe')](),controller[_0x8d9d('0xf')]);router[_0x8d9d('0xa')]('/:id/download',auth[_0x8d9d('0xe')](),controller[_0x8d9d('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49bea1,_0x230bfc,_0x294409){_0x294409(null,path[_0x8d9d('0x11')](config[_0x8d9d('0x12')],_0x8d9d('0x13')));},'filename':function(_0x300996,_0x3151e7,_0x55a5cd){_0x3151e7['originalname']=_0x3151e7[_0x8d9d('0x14')][_0x8d9d('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x55a5cd(null,util[_0x8d9d('0x16')](_0x8d9d('0x17'),path[_0x8d9d('0x18')](_0x3151e7[_0x8d9d('0x14')],path['extname'](_0x3151e7[_0x8d9d('0x14')])),Date[_0x8d9d('0x19')](),path['extname'](_0x3151e7[_0x8d9d('0x14')])));}})});router['post']('/',upload[_0x8d9d('0x1a')](_0x8d9d('0x1b')),controller[_0x8d9d('0x1c')]);router['post']('/webhook',controller[_0x8d9d('0x1d')]);router[_0x8d9d('0x1e')](_0x8d9d('0xd'),auth[_0x8d9d('0xe')](),controller[_0x8d9d('0x1f')]);router[_0x8d9d('0x20')](_0x8d9d('0xd'),auth['isAuthenticated'](),controller['delete']);module[_0x8d9d('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index cf8e209..8353a35 100644 --- a/server/api/plugin/plugin.attributes.js +++ b/server/api/plugin/plugin.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x883f=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0x234a18,_0x37abfb){var _0x20beb0=function(_0x3f4e45){while(--_0x3f4e45){_0x234a18['push'](_0x234a18['shift']());}};_0x20beb0(++_0x37abfb);}(_0x883f,0xef));var _0xf883=function(_0x3f8e92,_0x5a20b2){_0x3f8e92=_0x3f8e92-0x0;var _0x5b211b=_0x883f[_0x3f8e92];return _0x5b211b;};'use strict';var Sequelize=require(_0xf883('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf883('0x1')](_0xf883('0x2'),_0xf883('0x3'))},'description':{'type':Sequelize[_0xf883('0x4')]},'version':{'type':Sequelize[_0xf883('0x4')]},'path':{'type':Sequelize[_0xf883('0x5')],'comment':_0xf883('0x6')},'active':{'type':Sequelize[_0xf883('0x7')],'defaultValue':0x0,'comment':_0xf883('0x8')},'sidebar':{'type':Sequelize[_0xf883('0x1')](_0xf883('0x9'),_0xf883('0xa'),_0xf883('0xb'),_0xf883('0xc')),'defaultValue':'always','comment':_0xf883('0xd')},'icon':{'type':Sequelize[_0xf883('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf883('0x5')]},'scriptName':{'type':Sequelize[_0xf883('0x5')]},'scriptPath':{'type':Sequelize[_0xf883('0x5')]}}; \ No newline at end of file +var _0x2feb=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x50e12c,_0x4754a5){var _0x3a5529=function(_0x2b9b13){while(--_0x2b9b13){_0x50e12c['push'](_0x50e12c['shift']());}};_0x3a5529(++_0x4754a5);}(_0x2feb,0x10c));var _0xb2fe=function(_0x5a36dd,_0x5b2d2c){_0x5a36dd=_0x5a36dd-0x0;var _0x15503d=_0x2feb[_0x5a36dd];return _0x15503d;};'use strict';var Sequelize=require(_0xb2fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2fe('0x1')]},'type':{'type':Sequelize[_0xb2fe('0x2')](_0xb2fe('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xb2fe('0x4')]},'path':{'type':Sequelize[_0xb2fe('0x1')],'comment':_0xb2fe('0x5')},'active':{'type':Sequelize[_0xb2fe('0x6')],'defaultValue':0x0,'comment':_0xb2fe('0x7')},'sidebar':{'type':Sequelize[_0xb2fe('0x2')]('adminOnly',_0xb2fe('0x8'),_0xb2fe('0x9'),_0xb2fe('0xa')),'defaultValue':_0xb2fe('0x9'),'comment':_0xb2fe('0xb')},'icon':{'type':Sequelize[_0xb2fe('0x1')]},'adminUrl':{'type':Sequelize[_0xb2fe('0x1')]},'agentUrl':{'type':Sequelize[_0xb2fe('0x1')]},'scriptName':{'type':Sequelize[_0xb2fe('0x1')]},'scriptPath':{'type':Sequelize[_0xb2fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2d96739..4baef46 100644 --- a/server/api/plugin/plugin.controller.js +++ b/server/api/plugin/plugin.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','%s.zip','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','script','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','userProfileId','user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','headers','content-length','content-type','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','count','set','apply','save','update','destroy','then','Plugins','UserProfileResource','sendStatus','error','stack','name','send','render','body','contact','message','interaction','account','index','map','Plugin','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','path','join','root','server/files/plugins','format','basename','code','ENOENT','Sequelize','Error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedd9,0xfc));var _0x9edd=function(_0x38f3e9,_0x53ce92){_0x38f3e9=_0x38f3e9-0x0;var _0xe8ee0a=_0xedd9[_0x38f3e9];return _0xe8ee0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var extract=require(_0x9edd('0x10'));var rimraf=require('rimraf');var archiver=require(_0x9edd('0x11'));var Redis=require(_0x9edd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x13'));var as=require(_0x9edd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x15'))(_0x9edd('0x16'));var utils=require(_0x9edd('0x17'));var config=require(_0x9edd('0x18'));var licenseUtil=require(_0x9edd('0x19'));var db=require(_0x9edd('0x1a'))['db'];config[_0x9edd('0x1b')]=_[_0x9edd('0x1c')](config['redis'],{'host':_0x9edd('0x1d'),'port':0x18eb});var socket=require(_0x9edd('0x1e'))(new Redis(config[_0x9edd('0x1b')]));require(_0x9edd('0x1f'))[_0x9edd('0x20')](socket);function respondWithStatusCode(_0x338f3c,_0x1042aa){_0x1042aa=_0x1042aa||0xcc;return function(_0x75a4ab){if(_0x75a4ab){return _0x338f3c['sendStatus'](_0x1042aa);}return _0x338f3c[_0x9edd('0x21')](_0x1042aa)[_0x9edd('0x22')]();};}function respondWithResult(_0x449cee,_0x5acf65){_0x5acf65=_0x5acf65||0xc8;return function(_0x1b54c0){if(_0x1b54c0){return _0x449cee[_0x9edd('0x21')](_0x5acf65)[_0x9edd('0x23')](_0x1b54c0);}};}function respondWithFilteredResult(_0x4d8f33,_0x43dc70){return function(_0x5d879c){if(_0x5d879c){var _0x2cdcef=typeof _0x43dc70[_0x9edd('0x24')]==='undefined'&&typeof _0x43dc70['limit']===_0x9edd('0x25');var _0x50338f=_0x5d879c[_0x9edd('0x26')];var _0x54a03f=_0x2cdcef?0x0:_0x43dc70['offset'];var _0x356751=_0x2cdcef?_0x5d879c[_0x9edd('0x26')]:_0x43dc70['offset']+_0x43dc70['limit'];var _0x341d67;if(_0x356751>=_0x50338f){_0x356751=_0x50338f;_0x341d67=0xc8;}else{_0x341d67=0xce;}_0x4d8f33[_0x9edd('0x21')](_0x341d67);return _0x4d8f33[_0x9edd('0x27')]('Content-Range',_0x54a03f+'-'+_0x356751+'/'+_0x50338f)[_0x9edd('0x23')](_0x5d879c);}return null;};}function patchUpdates(_0x1dca43){return function(_0x44a6c1){try{jsonpatch[_0x9edd('0x28')](_0x44a6c1,_0x1dca43,!![]);}catch(_0x339a0d){return BPromise['reject'](_0x339a0d);}return _0x44a6c1[_0x9edd('0x29')]();};}function saveUpdates(_0xeaf55a,_0x3a1ea5){return function(_0x2f9f86){if(_0x2f9f86){return _0x2f9f86[_0x9edd('0x2a')](_0xeaf55a)['then'](function(_0x4b3d1b){return _0x4b3d1b;});}return null;};}function removeEntity(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){return _0x8d67aa[_0x9edd('0x2b')]()[_0x9edd('0x2c')](function(){var _0x4fe471=_0x8d67aa['get']({'plain':!![]});var _0x214d0a=_0x9edd('0x2d');return db[_0x9edd('0x2e')]['destroy']({'where':{'type':_0x214d0a,'resourceId':_0x4fe471['id']}})[_0x9edd('0x2c')](function(){return _0x8d67aa;});})[_0x9edd('0x2c')](function(){_0x3276ee[_0x9edd('0x21')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x5eccfb,_0x2155a1){return function(_0x3fb556){if(!_0x3fb556){_0x5eccfb[_0x9edd('0x2f')](0x194);}return _0x3fb556;};}function handleError(_0x12c1bc,_0xbbf08f){_0xbbf08f=_0xbbf08f||0x1f4;return function(_0x42e664){logger[_0x9edd('0x30')](_0x42e664[_0x9edd('0x31')]);if(_0x42e664[_0x9edd('0x32')]){delete _0x42e664[_0x9edd('0x32')];}_0x12c1bc[_0x9edd('0x21')](_0xbbf08f)[_0x9edd('0x33')](_0x42e664);};}function getMustacheRender(_0x6907a5,_0xa55906){return Mustache[_0x9edd('0x34')](_0x6907a5,_['merge'](_0xa55906[_0x9edd('0x35')],{'contact':_0xa55906[_0x9edd('0x36')],'message':_0xa55906[_0x9edd('0x37')],'agent':_0xa55906['agent'],'interaction':_0xa55906[_0x9edd('0x38')],'account':_0xa55906[_0x9edd('0x39')]}))||'';}exports[_0x9edd('0x3a')]=function(_0x38a7be,_0x21bc30){var _0x2bc4ed={},_0x473068={},_0x438a5d={'count':0x0,'rows':[]};var _0xd0fd74=_[_0x9edd('0x3b')](db[_0x9edd('0x3c')][_0x9edd('0x3d')],function(_0x27eb7e){return{'name':_0x27eb7e[_0x9edd('0x3e')],'type':_0x27eb7e['type'][_0x9edd('0x3f')]};});_0x473068['model']=_[_0x9edd('0x3b')](_0xd0fd74,_0x9edd('0x32'));_0x473068[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x38a7be[_0x9edd('0x40')]);_0x473068['filters']=_[_0x9edd('0x42')](_0x473068[_0x9edd('0x43')],_0x473068[_0x9edd('0x40')]);_0x2bc4ed[_0x9edd('0x44')]=_[_0x9edd('0x42')](_0x473068[_0x9edd('0x43')],qs[_0x9edd('0x45')](_0x38a7be[_0x9edd('0x40')][_0x9edd('0x45')]));_0x2bc4ed[_0x9edd('0x44')]=_0x2bc4ed['attributes'][_0x9edd('0x46')]?_0x2bc4ed['attributes']:_0x473068[_0x9edd('0x43')];if(!_0x38a7be['query'][_0x9edd('0x47')](_0x9edd('0x48'))){_0x2bc4ed[_0x9edd('0x49')]=qs['limit'](_0x38a7be[_0x9edd('0x40')][_0x9edd('0x49')]);_0x2bc4ed[_0x9edd('0x24')]=qs['offset'](_0x38a7be[_0x9edd('0x40')]['offset']);}_0x2bc4ed[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_0x38a7be['query'][_0x9edd('0x4b')]);_0x2bc4ed[_0x9edd('0x4c')]=qs[_0x9edd('0x4d')](_[_0x9edd('0x4e')](_0x38a7be['query'],_0x473068[_0x9edd('0x4d')]),_0xd0fd74);if(_0x38a7be['query'][_0x9edd('0x4f')]){_0x2bc4ed[_0x9edd('0x4c')]=_['merge'](_0x2bc4ed[_0x9edd('0x4c')],{'$or':_['map'](_0xd0fd74,function(_0x548299){if(_0x548299[_0x9edd('0x50')]!==_0x9edd('0x51')){var _0x1f276b={};_0x1f276b[_0x548299[_0x9edd('0x32')]]={'$like':'%'+_0x38a7be[_0x9edd('0x40')][_0x9edd('0x4f')]+'%'};return _0x1f276b;}})});}_0x2bc4ed=_[_0x9edd('0x52')]({},_0x2bc4ed,_0x38a7be[_0x9edd('0x53')]);var _0x18c149={'where':_0x2bc4ed[_0x9edd('0x4c')]};return db[_0x9edd('0x3c')][_0x9edd('0x26')](_0x18c149)[_0x9edd('0x2c')](function(_0xbbe8fc){_0x438a5d[_0x9edd('0x26')]=_0xbbe8fc;if(_0x38a7be['query'][_0x9edd('0x54')]){_0x2bc4ed[_0x9edd('0x55')]=[{'all':!![]}];}return db[_0x9edd('0x3c')][_0x9edd('0x56')](_0x2bc4ed);})[_0x9edd('0x2c')](function(_0x3ecdfd){_0x438a5d[_0x9edd('0x57')]=_0x3ecdfd;return _0x438a5d;})['then'](respondWithFilteredResult(_0x21bc30,_0x2bc4ed))['catch'](handleError(_0x21bc30,null));};exports['show']=function(_0x4a7dc9,_0x58a1dd){var _0x8b1fdb={'raw':!![],'where':{'id':_0x4a7dc9[_0x9edd('0x58')]['id']}},_0x19b56b={};_0x19b56b[_0x9edd('0x43')]=_[_0x9edd('0x41')](db['Plugin'][_0x9edd('0x3d')]);_0x19b56b[_0x9edd('0x40')]=_[_0x9edd('0x41')](_0x4a7dc9['query']);_0x19b56b[_0x9edd('0x4d')]=_[_0x9edd('0x42')](_0x19b56b[_0x9edd('0x43')],_0x19b56b[_0x9edd('0x40')]);_0x8b1fdb[_0x9edd('0x44')]=_[_0x9edd('0x42')](_0x19b56b['model'],qs[_0x9edd('0x45')](_0x4a7dc9[_0x9edd('0x40')]['fields']));_0x8b1fdb[_0x9edd('0x44')]=_0x8b1fdb[_0x9edd('0x44')]['length']?_0x8b1fdb[_0x9edd('0x44')]:_0x19b56b[_0x9edd('0x43')];if(_0x4a7dc9[_0x9edd('0x40')]['includeAll']){_0x8b1fdb[_0x9edd('0x55')]=[{'all':!![]}];}_0x8b1fdb=_[_0x9edd('0x52')]({},_0x8b1fdb,_0x4a7dc9[_0x9edd('0x53')]);return db[_0x9edd('0x3c')]['find'](_0x8b1fdb)[_0x9edd('0x2c')](handleEntityNotFound(_0x58a1dd,null))[_0x9edd('0x2c')](respondWithResult(_0x58a1dd,null))[_0x9edd('0x59')](handleError(_0x58a1dd,null));};exports['download']=function(_0x16951a,_0x21f6ce,_0x57db43){return db[_0x9edd('0x3c')]['find']({'where':{'id':_0x16951a[_0x9edd('0x58')]['id']},'attributes':[_0x9edd('0x32'),_0x9edd('0x5a')],'raw':!![]})[_0x9edd('0x2c')](handleEntityNotFound(_0x21f6ce,null))[_0x9edd('0x2c')](function(_0x18548e){if(_0x18548e){var _0x2334d4=path[_0x9edd('0x5b')](config[_0x9edd('0x5c')],_0x9edd('0x5d'),util[_0x9edd('0x5e')]('%s.zip',path[_0x9edd('0x5f')](_0x18548e[_0x9edd('0x5a')])));var _0x3acc09=fs['createWriteStream'](_0x2334d4);var _0xe96d6a=archiver('zip',{'zlib':{'level':0x9}});_0xe96d6a['on']('warning',function(_0x54ecfa){if(_0x54ecfa[_0x9edd('0x60')]===_0x9edd('0x61')){logger[_0x9edd('0x30')](_0x54ecfa);}else{throw new db[(_0x9edd('0x62'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xe96d6a['on']('error',function(_0x71820f){throw new db[(_0x9edd('0x62'))][(_0x9edd('0x63'))](_0x9edd('0x64'));});_0xe96d6a[_0x9edd('0x65')](_0x3acc09);_0xe96d6a[_0x9edd('0x66')](_0x9edd('0x67'),{'cwd':path[_0x9edd('0x5b')](config['root'],_0x9edd('0x5d'),path['dirname'](_0x18548e[_0x9edd('0x5a')])),'ignore':[path[_0x9edd('0x5b')](path['basename'](_0x18548e[_0x9edd('0x5a')]),_0x9edd('0x68')),path[_0x9edd('0x5b')](path['basename'](_0x18548e[_0x9edd('0x5a')]),_0x9edd('0x69'))],'nodir':!![]})[_0x9edd('0x6a')]();_0x3acc09['on'](_0x9edd('0x6b'),function(){if(!fs[_0x9edd('0x6c')](_0x2334d4)){throw new db[(_0x9edd('0x62'))]['Error']('Plugin\x20not\x20found');}return _0x21f6ce[_0x9edd('0x6d')](_0x2334d4,util['format'](_0x9edd('0x6e'),path[_0x9edd('0x5f')](_0x18548e[_0x9edd('0x5a')])),function(_0x17d2f2){if(_0x17d2f2){throw new db['Sequelize'][(_0x9edd('0x63'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x9edd('0x6f')](_0x2334d4);logger[_0x9edd('0x70')](_0x9edd('0x71'));logger['info'](_0x9edd('0x72'));});});}return null;})['catch'](handleError(_0x21f6ce,null));};exports[_0x9edd('0x73')]=function(_0x4e1eda,_0x4915a9,_0x236b82){var _0x4a72d0=path[_0x9edd('0x5f')](_0x4e1eda[_0x9edd('0x74')][_0x9edd('0x75')],path['extname'](_0x4e1eda[_0x9edd('0x74')][_0x9edd('0x75')]));var _0x45c17d=path[_0x9edd('0x5b')](config[_0x9edd('0x5c')],'server/files/plugins',_0x4e1eda['file'][_0x9edd('0x75')]);var _0x211526=path['join'](config['root'],'server/files/plugins',_0x4a72d0);logger[_0x9edd('0x70')]('Plugin\x20upload\x20filepath:\x20%s',_0x45c17d);logger['info'](_0x9edd('0x76'),_0x211526);try{fs[_0x9edd('0x77')](_0x45c17d,parseInt('0777',0x8));extract(_0x45c17d,{'dir':_0x211526},function(_0xb9ebeb){if(_0xb9ebeb){logger[_0x9edd('0x30')](_0xb9ebeb);handleError(_0xb9ebeb,!![]);};var _0x34dff5=fs['readdirSync'](_0x211526);if(_0x34dff5[_0x9edd('0x46')]>0x1){removeReferences(_0x45c17d,_0x211526);logger['error'](_0x9edd('0x78'));return _0x236b82(new Error(_0x9edd('0x78')));}var _0x4c8d06=fs[_0x9edd('0x79')](path[_0x9edd('0x5b')](_0x211526,_0x34dff5[0x0]));if(_0x4c8d06['isFile']()){removeReferences(_0x45c17d,_0x211526);logger[_0x9edd('0x30')](_0x9edd('0x78'));return _0x236b82(new Error(_0x9edd('0x78')));}if(_0x4c8d06[_0x9edd('0x7a')]()){var _0x5ce70b=fs[_0x9edd('0x7b')](path['join'](_0x211526,_0x34dff5[0x0]));if(_0x5ce70b[_0x9edd('0x46')]===0x0){removeReferences(_0x45c17d,_0x211526);logger[_0x9edd('0x30')](_0x9edd('0x78'));return _0x236b82(new Error('Invalid\x20plugin\x20structure'));}var _0x106a67=_0x5ce70b[_0x9edd('0x7c')](function(_0x130dba){return _0x130dba===_0x9edd('0x7d');});if(!_0x106a67){return _0x236b82(new Error(_0x9edd('0x7e')));}var _0x14e2e5=fs[_0x9edd('0x7f')](path['join'](_0x211526,_0x34dff5[0x0],'manifest.json'));var _0x322165=JSON[_0x9edd('0x80')](_0x14e2e5);if(_0x9edd('0x25')==typeof _0x322165[_0x9edd('0x32')]){return _0x236b82(new Error(_0x9edd('0x81')));}if('undefined'==typeof _0x322165[_0x9edd('0x50')]){return _0x236b82(new Error(_0x9edd('0x82')));}if(_0x9edd('0x25')==typeof _0x322165['version']){return _0x236b82(new Error(_0x9edd('0x83')));}if(_0x9edd('0x25')==typeof _0x322165['parameters']){return _0x236b82(new Error(_0x9edd('0x84')));}if(_0x322165[_0x9edd('0x50')]==='html'){if(_0x9edd('0x25')==typeof _0x322165[_0x9edd('0x85')]['views']){return _0x236b82(new Error(_0x9edd('0x86')));}if('undefined'==typeof _0x322165['parameters'][_0x9edd('0x87')][_0x9edd('0x88')]&&_0x9edd('0x25')==typeof _0x322165['parameters'][_0x9edd('0x87')][_0x9edd('0x89')]){return _0x236b82(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x322165[_0x9edd('0x50')]===_0x9edd('0x8a')){if(_0x9edd('0x25')==typeof _0x322165[_0x9edd('0x85')]['scriptName']){return _0x236b82(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9edd('0x25')==typeof _0x322165['parameters'][_0x9edd('0x8b')]){return _0x236b82(new Error(_0x9edd('0x8c')));}}else{return _0x236b82(new Error(_0x9edd('0x8d')));}var _0x3cfd35=_0x322165[_0x9edd('0x32')];var _0x4786f8=_0x322165[_0x9edd('0x8e')];var _0x5a4d4b=_0x322165[_0x9edd('0x50')];var _0x554241=_0x322165[_0x9edd('0x8f')]?_0x322165[_0x9edd('0x8f')]:_0x9edd('0x90');var _0x8cc956=_0x322165[_0x9edd('0x91')]?_0x322165[_0x9edd('0x91')]:_0x9edd('0x92');var _0x590356='';var _0x25e3e7='';var _0x454992='';var _0x4f44e2='';var _0x26c11a=_0x322165[_0x9edd('0x93')];if(_0x5a4d4b==='html'){if(_0x9edd('0x25')!=typeof _0x322165[_0x9edd('0x85')][_0x9edd('0x87')]['admin']){var _0x4a7889=_0x322165[_0x9edd('0x85')][_0x9edd('0x87')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4a7889)){_0x590356=path['join']('plugins',_0x4a72d0,_0x34dff5[0x0],_0x4a7889);}else{_0x590356=_0x4a7889;}}else{logger[_0x9edd('0x70')](_0x9edd('0x94'));}if(_0x9edd('0x25')!=typeof _0x322165['parameters']['views']['agent']){var _0x593649=_0x322165[_0x9edd('0x85')][_0x9edd('0x87')][_0x9edd('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x9edd('0x95')](_0x593649)){_0x25e3e7=path[_0x9edd('0x5b')](_0x9edd('0x96'),_0x4a72d0,_0x34dff5[0x0],_0x593649);}else{_0x25e3e7=_0x593649;}}else{logger[_0x9edd('0x70')](_0x9edd('0x97'));}}else if(_0x5a4d4b===_0x9edd('0x8a')){_0x454992=_0x322165[_0x9edd('0x85')][_0x9edd('0x98')];_0x4f44e2=_0x322165['parameters'][_0x9edd('0x8b')];if(_0x9edd('0x25')!=typeof _0x322165[_0x9edd('0x85')][_0x9edd('0x87')]){if(_0x9edd('0x25')!=typeof _0x322165[_0x9edd('0x85')][_0x9edd('0x87')][_0x9edd('0x88')]){var _0x4a7889=_0x322165['parameters'][_0x9edd('0x87')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x9edd('0x95')](_0x4a7889)){_0x590356=path['join'](_0x9edd('0x96'),_0x4a72d0,_0x34dff5[0x0],_0x4a7889);}else{_0x590356=_0x4a7889;}}if(_0x9edd('0x25')!=typeof _0x322165['parameters'][_0x9edd('0x87')][_0x9edd('0x89')]){var _0x593649=_0x322165[_0x9edd('0x85')][_0x9edd('0x87')][_0x9edd('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x9edd('0x95')](_0x593649)){_0x25e3e7=path[_0x9edd('0x5b')]('plugins',_0x4a72d0,_0x34dff5[0x0],_0x593649);}else{_0x25e3e7=_0x593649;}}}}var _0x33a077={'name':_0x3cfd35,'description':_0x4786f8,'path':path[_0x9edd('0x5b')](_0x4a72d0,_0x34dff5[0x0]),'type':_0x5a4d4b,'sidebar':_0x554241,'icon':_0x8cc956,'adminUrl':_0x590356,'agentUrl':_0x25e3e7,'scriptName':_0x454992,'scriptPath':_0x4f44e2,'version':_0x26c11a};removeReferences(_0x45c17d,null);return db[_0x9edd('0x3c')][_0x9edd('0x99')](_0x33a077)[_0x9edd('0x2c')](function(_0x4b5169){var _0x4870aa={'role':_0x4e1eda['body']['role'],'userProfileId':_0x4e1eda['body'][_0x9edd('0x9a')]};if(!_0x4870aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4870aa['role']===_0x9edd('0x9b')){var _0x137494=_0x4b5169[_0x9edd('0x9c')]({'plain':!![]});return db[_0x9edd('0x9d')][_0x9edd('0x9e')]({'where':{'name':_0x9edd('0x2d'),'userProfileId':_0x4870aa[_0x9edd('0x9a')]},'raw':!![]})[_0x9edd('0x2c')](function(_0x35d932){if(_0x35d932&&_0x35d932[_0x9edd('0x9f')]===0x0){return db['UserProfileResource'][_0x9edd('0x99')]({'name':_0x137494[_0x9edd('0x32')],'resourceId':_0x137494['id'],'type':_0x35d932[_0x9edd('0x32')],'sectionId':_0x35d932['id']},{})[_0x9edd('0x2c')](function(){return _0x4b5169;});}else{return _0x4b5169;}})[_0x9edd('0x59')](function(_0x23e925){logger[_0x9edd('0x30')](_0x9edd('0xa0'),_0x23e925);throw _0x23e925;});}return _0x4b5169;})['then'](respondWithResult(_0x4915a9,null))['catch'](handleError(_0x4915a9,null));}});}catch(_0x401ad3){_0x4915a9[_0x9edd('0x21')](0x1f4)[_0x9edd('0x33')](_0x401ad3);}};function removeReferences(_0x120d0f,_0x1dc9e0){try{if(_0x120d0f){fs[_0x9edd('0x6f')](_0x120d0f);logger[_0x9edd('0x70')](_0x9edd('0xa1'));}if(_0x1dc9e0){rimraf(_0x1dc9e0,function(){});logger[_0x9edd('0x70')](_0x9edd('0xa2'));}}catch(_0x11fad5){logger[_0x9edd('0x30')](_0x11fad5);}}exports[_0x9edd('0x2a')]=function(_0xf418d,_0x55bc19,_0x43b19e){return db[_0x9edd('0x3c')]['find']({'where':{'id':_0xf418d[_0x9edd('0x58')]['id']}})[_0x9edd('0x2c')](handleEntityNotFound(_0x55bc19,null))[_0x9edd('0x2c')](saveUpdates(_0xf418d[_0x9edd('0x35')],null))['then'](respondWithResult(_0x55bc19,null))[_0x9edd('0x59')](handleError(_0x55bc19,null));};exports[_0x9edd('0xa3')]=function(_0xbb5202,_0x2c96f1,_0x3e88b5){return db['Plugin'][_0x9edd('0x9e')]({'where':{'id':_0xbb5202[_0x9edd('0x58')]['id']}})[_0x9edd('0x2c')](function(_0x4633eb){if(_0x4633eb){return _0x4633eb[_0x9edd('0x2b')]();}})['then'](function(_0x4d0734){rimraf(path[_0x9edd('0x5b')](config['root'],_0x9edd('0x5d'),path['dirname'](_0x4d0734[_0x9edd('0x5a')])),function(){});return _0x4d0734;})[_0x9edd('0x2c')](handleEntityNotFound(_0x2c96f1,null))[_0x9edd('0x2c')](respondWithStatusCode(_0x2c96f1,null))[_0x9edd('0x59')](handleError(_0x2c96f1,null));};exports[_0x9edd('0xa4')]=function(_0x34d086,_0x5975f9,_0x186e02){return BPromise[_0x9edd('0xa5')]()[_0x9edd('0x2c')](function(){if(!_0x34d086[_0x9edd('0x40')][_0x9edd('0x5a')]){throw new Error(_0x9edd('0xa6'));}if(!_0x34d086[_0x9edd('0x40')][_0x9edd('0xa7')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x195088=_0x34d086[_0x9edd('0x40')][_0x9edd('0xa8')]?_0x34d086[_0x9edd('0x40')][_0x9edd('0xa8')]+':'+_0x34d086[_0x9edd('0x40')][_0x9edd('0xa7')]:_0x9edd('0xa9')+_0x34d086[_0x9edd('0x40')][_0x9edd('0xa7')];var _0x45234c=_0x34d086[_0x9edd('0x40')][_0x9edd('0x23')]?_0x34d086[_0x9edd('0x40')][_0x9edd('0x23')]:!![];var _0x14b9e7=_0x34d086[_0x9edd('0x40')][_0x9edd('0xaa')]?_0x34d086[_0x9edd('0x40')][_0x9edd('0xaa')]:null;var _0x220701={'method':_0x34d086['method'],'uri':util[_0x9edd('0x5e')]('%s%s',_0x195088,_0x34d086['query'][_0x9edd('0x5a')]),'json':_0x45234c,'resolveWithFullResponse':!![],'encoding':_0x14b9e7,'qs':_0x34d086[_0x9edd('0x40')]};if(_0x34d086[_0x9edd('0xab')]){_0x220701[_0x9edd('0xab')]=_0x34d086[_0x9edd('0xab')];if(_0x220701[_0x9edd('0xab')][_0x9edd('0xac')]){delete _0x220701[_0x9edd('0xab')][_0x9edd('0xac')];}}if(_0x220701[_0x9edd('0xab')]['content-type']){delete _0x220701[_0x9edd('0xab')][_0x9edd('0xad')];}return rp(_0x220701);})['then'](function(_0x568067){if(_0x568067){_0x5975f9[_0x9edd('0x27')](_0x568067[_0x9edd('0xab')]);logger[_0x9edd('0x70')](_0x568067[_0x9edd('0x35')]);if(_['endsWith'](_0x34d086['query'][_0x9edd('0x5a')],'download')&&_0x568067[_0x9edd('0xae')]==0x1f4){return _0x5975f9[_0x9edd('0x2f')](_0x568067[_0x9edd('0xae')]);}else{return _0x5975f9['status'](_0x568067['statusCode'])['send'](_0x568067[_0x9edd('0x35')]);}}else{return _0x5975f9[_0x9edd('0x2f')](0xc8);}})[_0x9edd('0x59')](handleError(_0x5975f9,null));};exports['webhookPost']=function(_0xb2e72,_0x402574,_0x4f12b9){return BPromise[_0x9edd('0xa5')]()[_0x9edd('0x2c')](function(){if(!_0xb2e72['query']['path']){throw new Error(_0x9edd('0xa6'));}if(!_0xb2e72[_0x9edd('0x40')]['port']){throw new Error(_0x9edd('0xaf'));}var _0x16c7f=_0xb2e72['query'][_0x9edd('0xa8')]?_0xb2e72['query'][_0x9edd('0xa8')]+':'+_0xb2e72[_0x9edd('0x40')][_0x9edd('0xa7')]:_0x9edd('0xa9')+_0xb2e72[_0x9edd('0x40')][_0x9edd('0xa7')];var _0x58bc3c=_0xb2e72[_0x9edd('0x40')][_0x9edd('0x23')]?_0xb2e72[_0x9edd('0x40')]['json']:!![];var _0x956219=_0xb2e72['query'][_0x9edd('0xaa')]?_0xb2e72[_0x9edd('0x40')][_0x9edd('0xaa')]:null;var _0x41b0ea={'method':_0xb2e72['method'],'uri':util['format']('%s%s',_0x16c7f,_0xb2e72[_0x9edd('0x40')][_0x9edd('0x5a')]),'json':_0x58bc3c,'resolveWithFullResponse':!![],'encoding':_0x956219,'body':_0xb2e72[_0x9edd('0x35')]};if(_0xb2e72['headers']){_0x41b0ea[_0x9edd('0xab')]=_0xb2e72[_0x9edd('0xab')];if(_0x41b0ea[_0x9edd('0xab')][_0x9edd('0xac')]){delete _0x41b0ea[_0x9edd('0xab')][_0x9edd('0xac')];}}if(_0x41b0ea['headers']['content-type']){delete _0x41b0ea[_0x9edd('0xab')][_0x9edd('0xad')];}return rp(_0x41b0ea);})[_0x9edd('0x2c')](function(_0x5c299a){if(_0x5c299a){_0x402574[_0x9edd('0x27')](_0x5c299a[_0x9edd('0xab')]);logger[_0x9edd('0x70')](_0x5c299a[_0x9edd('0x35')]);return _0x402574['status'](_0x5c299a[_0x9edd('0xae')])['send'](_0x5c299a[_0x9edd('0x35')]);}else{return _0x402574[_0x9edd('0x2f')](0xc8);}})[_0x9edd('0x59')](handleError(_0x402574,null));}; \ No newline at end of file +var _0x4b84=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','download','join','server/files/plugins','format','%s.zip','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','plugins','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','statusCode','resolve','method','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','status','offset','limit','undefined','count','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','render','body','message','agent','interaction','account','index','Plugin','rawAttributes','fieldName'];(function(_0x2f55a6,_0xe95f10){var _0x18c9dc=function(_0xd3c491){while(--_0xd3c491){_0x2f55a6['push'](_0x2f55a6['shift']());}};_0x18c9dc(++_0xe95f10);}(_0x4b84,0x1cc));var _0x44b8=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x4b84[_0x445101];return _0x3c3d04;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var extract=require(_0x44b8('0xb'));var rimraf=require('rimraf');var archiver=require(_0x44b8('0xc'));var Redis=require(_0x44b8('0xd'));var authService=require(_0x44b8('0xe'));var qs=require(_0x44b8('0xf'));var as=require(_0x44b8('0x10'));var hardwareService=require(_0x44b8('0x11'));var logger=require(_0x44b8('0x12'))('api');var utils=require(_0x44b8('0x13'));var config=require(_0x44b8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x15'))['db'];config['redis']=_[_0x44b8('0x16')](config[_0x44b8('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x18'))(new Redis(config['redis']));require('./plugin.socket')[_0x44b8('0x19')](socket);function respondWithStatusCode(_0x2af0ad,_0x1722da){_0x1722da=_0x1722da||0xcc;return function(_0x41ab46){if(_0x41ab46){return _0x2af0ad['sendStatus'](_0x1722da);}return _0x2af0ad['status'](_0x1722da)['end']();};}function respondWithResult(_0x3fe9fb,_0x5b7803){_0x5b7803=_0x5b7803||0xc8;return function(_0x28ef36){if(_0x28ef36){return _0x3fe9fb[_0x44b8('0x1a')](_0x5b7803)['json'](_0x28ef36);}};}function respondWithFilteredResult(_0x36743e,_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){var _0x89bc30=typeof _0xe3de8f[_0x44b8('0x1b')]==='undefined'&&typeof _0xe3de8f[_0x44b8('0x1c')]===_0x44b8('0x1d');var _0xebfe79=_0x5103f5[_0x44b8('0x1e')];var _0x102ef9=_0x89bc30?0x0:_0xe3de8f[_0x44b8('0x1b')];var _0x452f2f=_0x89bc30?_0x5103f5[_0x44b8('0x1e')]:_0xe3de8f[_0x44b8('0x1b')]+_0xe3de8f[_0x44b8('0x1c')];var _0x1d642b;if(_0x452f2f>=_0xebfe79){_0x452f2f=_0xebfe79;_0x1d642b=0xc8;}else{_0x1d642b=0xce;}_0x36743e[_0x44b8('0x1a')](_0x1d642b);return _0x36743e['set'](_0x44b8('0x1f'),_0x102ef9+'-'+_0x452f2f+'/'+_0xebfe79)[_0x44b8('0x20')](_0x5103f5);}return null;};}function patchUpdates(_0x416b34){return function(_0x1418db){try{jsonpatch[_0x44b8('0x21')](_0x1418db,_0x416b34,!![]);}catch(_0x51a34a){return BPromise[_0x44b8('0x22')](_0x51a34a);}return _0x1418db['save']();};}function saveUpdates(_0x41a922,_0x228c81){return function(_0x25a0c1){if(_0x25a0c1){return _0x25a0c1[_0x44b8('0x23')](_0x41a922)[_0x44b8('0x24')](function(_0x59acbc){return _0x59acbc;});}return null;};}function removeEntity(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){return _0x41d673[_0x44b8('0x25')]()['then'](function(){var _0x17ac44=_0x41d673[_0x44b8('0x26')]({'plain':!![]});var _0x2656d7='Plugins';return db[_0x44b8('0x27')][_0x44b8('0x25')]({'where':{'type':_0x2656d7,'resourceId':_0x17ac44['id']}})['then'](function(){return _0x41d673;});})[_0x44b8('0x24')](function(){_0x474f01['status'](0xcc)[_0x44b8('0x28')]();});}};}function handleEntityNotFound(_0x5a544c,_0x559f0b){return function(_0x5948dc){if(!_0x5948dc){_0x5a544c[_0x44b8('0x29')](0x194);}return _0x5948dc;};}function handleError(_0x29b18d,_0x44ce5a){_0x44ce5a=_0x44ce5a||0x1f4;return function(_0x1bd1be){logger[_0x44b8('0x2a')](_0x1bd1be[_0x44b8('0x2b')]);if(_0x1bd1be[_0x44b8('0x2c')]){delete _0x1bd1be[_0x44b8('0x2c')];}_0x29b18d[_0x44b8('0x1a')](_0x44ce5a)[_0x44b8('0x2d')](_0x1bd1be);};}function getMustacheRender(_0x5e1129,_0x417d81){return Mustache[_0x44b8('0x2e')](_0x5e1129,_['merge'](_0x417d81[_0x44b8('0x2f')],{'contact':_0x417d81['contact'],'message':_0x417d81[_0x44b8('0x30')],'agent':_0x417d81[_0x44b8('0x31')],'interaction':_0x417d81[_0x44b8('0x32')],'account':_0x417d81[_0x44b8('0x33')]}))||'';}exports[_0x44b8('0x34')]=function(_0x543b19,_0x16b706){var _0x2d0eda={},_0x26265f={},_0x339f0f={'count':0x0,'rows':[]};var _0x46b008=_['map'](db[_0x44b8('0x35')][_0x44b8('0x36')],function(_0x1a30fc){return{'name':_0x1a30fc[_0x44b8('0x37')],'type':_0x1a30fc[_0x44b8('0x38')][_0x44b8('0x39')]};});_0x26265f[_0x44b8('0x3a')]=_[_0x44b8('0x3b')](_0x46b008,_0x44b8('0x2c'));_0x26265f[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x543b19[_0x44b8('0x3c')]);_0x26265f[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x26265f[_0x44b8('0x3a')],_0x26265f[_0x44b8('0x3c')]);_0x2d0eda[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x26265f[_0x44b8('0x3a')],qs[_0x44b8('0x41')](_0x543b19[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x2d0eda['attributes']=_0x2d0eda[_0x44b8('0x40')][_0x44b8('0x42')]?_0x2d0eda['attributes']:_0x26265f[_0x44b8('0x3a')];if(!_0x543b19[_0x44b8('0x3c')][_0x44b8('0x43')](_0x44b8('0x44'))){_0x2d0eda['limit']=qs[_0x44b8('0x1c')](_0x543b19[_0x44b8('0x3c')][_0x44b8('0x1c')]);_0x2d0eda[_0x44b8('0x1b')]=qs[_0x44b8('0x1b')](_0x543b19[_0x44b8('0x3c')][_0x44b8('0x1b')]);}_0x2d0eda[_0x44b8('0x45')]=qs[_0x44b8('0x46')](_0x543b19[_0x44b8('0x3c')][_0x44b8('0x46')]);_0x2d0eda[_0x44b8('0x47')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x48')](_0x543b19[_0x44b8('0x3c')],_0x26265f[_0x44b8('0x3e')]),_0x46b008);if(_0x543b19['query'][_0x44b8('0x49')]){_0x2d0eda[_0x44b8('0x47')]=_[_0x44b8('0x4a')](_0x2d0eda['where'],{'$or':_[_0x44b8('0x3b')](_0x46b008,function(_0x1054c5){if(_0x1054c5[_0x44b8('0x38')]!=='VIRTUAL'){var _0xbad4bb={};_0xbad4bb[_0x1054c5[_0x44b8('0x2c')]]={'$like':'%'+_0x543b19[_0x44b8('0x3c')][_0x44b8('0x49')]+'%'};return _0xbad4bb;}})});}_0x2d0eda=_[_0x44b8('0x4a')]({},_0x2d0eda,_0x543b19['options']);var _0x5ae5f9={'where':_0x2d0eda[_0x44b8('0x47')]};return db[_0x44b8('0x35')][_0x44b8('0x1e')](_0x5ae5f9)[_0x44b8('0x24')](function(_0x43906b){_0x339f0f[_0x44b8('0x1e')]=_0x43906b;if(_0x543b19[_0x44b8('0x3c')][_0x44b8('0x4b')]){_0x2d0eda[_0x44b8('0x4c')]=[{'all':!![]}];}return db[_0x44b8('0x35')][_0x44b8('0x4d')](_0x2d0eda);})[_0x44b8('0x24')](function(_0xc1b9de){_0x339f0f[_0x44b8('0x4e')]=_0xc1b9de;return _0x339f0f;})[_0x44b8('0x24')](respondWithFilteredResult(_0x16b706,_0x2d0eda))[_0x44b8('0x4f')](handleError(_0x16b706,null));};exports[_0x44b8('0x50')]=function(_0x3b3d5d,_0x45a5d2){var _0x49c507={'raw':!![],'where':{'id':_0x3b3d5d[_0x44b8('0x51')]['id']}},_0x547dc1={};_0x547dc1[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](db[_0x44b8('0x35')][_0x44b8('0x36')]);_0x547dc1[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x3b3d5d['query']);_0x547dc1[_0x44b8('0x3e')]=_['intersection'](_0x547dc1[_0x44b8('0x3a')],_0x547dc1[_0x44b8('0x3c')]);_0x49c507[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x547dc1[_0x44b8('0x3a')],qs[_0x44b8('0x41')](_0x3b3d5d['query'][_0x44b8('0x41')]));_0x49c507[_0x44b8('0x40')]=_0x49c507[_0x44b8('0x40')][_0x44b8('0x42')]?_0x49c507['attributes']:_0x547dc1[_0x44b8('0x3a')];if(_0x3b3d5d[_0x44b8('0x3c')][_0x44b8('0x4b')]){_0x49c507[_0x44b8('0x4c')]=[{'all':!![]}];}_0x49c507=_[_0x44b8('0x4a')]({},_0x49c507,_0x3b3d5d[_0x44b8('0x52')]);return db['Plugin'][_0x44b8('0x53')](_0x49c507)[_0x44b8('0x24')](handleEntityNotFound(_0x45a5d2,null))[_0x44b8('0x24')](respondWithResult(_0x45a5d2,null))[_0x44b8('0x4f')](handleError(_0x45a5d2,null));};exports[_0x44b8('0x54')]=function(_0x57d0e2,_0x493840,_0x2516fc){return db['Plugin'][_0x44b8('0x53')]({'where':{'id':_0x57d0e2['params']['id']},'attributes':[_0x44b8('0x2c'),_0x44b8('0x5')],'raw':!![]})[_0x44b8('0x24')](handleEntityNotFound(_0x493840,null))[_0x44b8('0x24')](function(_0x2fa6b4){if(_0x2fa6b4){var _0x32f588=path[_0x44b8('0x55')](config['root'],_0x44b8('0x56'),util[_0x44b8('0x57')](_0x44b8('0x58'),path['basename'](_0x2fa6b4[_0x44b8('0x5')])));var _0x103249=fs[_0x44b8('0x59')](_0x32f588);var _0x2b256b=archiver('zip',{'zlib':{'level':0x9}});_0x2b256b['on'](_0x44b8('0x5a'),function(_0x308f7b){if(_0x308f7b['code']===_0x44b8('0x5b')){logger[_0x44b8('0x2a')](_0x308f7b);}else{throw new db[(_0x44b8('0x5c'))][(_0x44b8('0x5d'))](_0x44b8('0x5e'));}});_0x2b256b['on']('error',function(_0x5b99a3){throw new db[(_0x44b8('0x5c'))][(_0x44b8('0x5d'))](_0x44b8('0x5e'));});_0x2b256b[_0x44b8('0x5f')](_0x103249);_0x2b256b[_0x44b8('0x60')](_0x44b8('0x61'),{'cwd':path[_0x44b8('0x55')](config[_0x44b8('0x62')],_0x44b8('0x56'),path[_0x44b8('0x63')](_0x2fa6b4[_0x44b8('0x5')])),'ignore':[path[_0x44b8('0x55')](path['basename'](_0x2fa6b4[_0x44b8('0x5')]),_0x44b8('0x64')),path[_0x44b8('0x55')](path[_0x44b8('0x65')](_0x2fa6b4[_0x44b8('0x5')]),_0x44b8('0x66'))],'nodir':!![]})[_0x44b8('0x67')]();_0x103249['on'](_0x44b8('0x68'),function(){if(!fs[_0x44b8('0x69')](_0x32f588)){throw new db[(_0x44b8('0x5c'))][(_0x44b8('0x5d'))](_0x44b8('0x6a'));}return _0x493840[_0x44b8('0x54')](_0x32f588,util[_0x44b8('0x57')](_0x44b8('0x58'),path[_0x44b8('0x65')](_0x2fa6b4[_0x44b8('0x5')])),function(_0x20e563){if(_0x20e563){throw new db['Sequelize'][(_0x44b8('0x5d'))](_0x44b8('0x6b'));}fs[_0x44b8('0x6c')](_0x32f588);logger[_0x44b8('0x6d')](_0x44b8('0x6e'));logger[_0x44b8('0x6d')](_0x44b8('0x6f'));});});}return null;})['catch'](handleError(_0x493840,null));};exports[_0x44b8('0x70')]=function(_0xc4d667,_0x5df821,_0x2a95f6){var _0x3354bd=path['basename'](_0xc4d667[_0x44b8('0x71')][_0x44b8('0x72')],path[_0x44b8('0x73')](_0xc4d667['file'][_0x44b8('0x72')]));var _0x5da64b=path[_0x44b8('0x55')](config['root'],_0x44b8('0x56'),_0xc4d667[_0x44b8('0x71')][_0x44b8('0x72')]);var _0xb64e26=path[_0x44b8('0x55')](config[_0x44b8('0x62')],'server/files/plugins',_0x3354bd);logger[_0x44b8('0x6d')]('Plugin\x20upload\x20filepath:\x20%s',_0x5da64b);logger[_0x44b8('0x6d')](_0x44b8('0x74'),_0xb64e26);try{fs['chmodSync'](_0x5da64b,parseInt(_0x44b8('0x75'),0x8));extract(_0x5da64b,{'dir':_0xb64e26},function(_0x1ee26b){if(_0x1ee26b){logger[_0x44b8('0x2a')](_0x1ee26b);handleError(_0x1ee26b,!![]);};var _0x30d60f=fs[_0x44b8('0x76')](_0xb64e26);if(_0x30d60f[_0x44b8('0x42')]>0x1){removeReferences(_0x5da64b,_0xb64e26);logger[_0x44b8('0x2a')](_0x44b8('0x77'));return _0x2a95f6(new Error(_0x44b8('0x77')));}var _0x11ad5b=fs[_0x44b8('0x78')](path[_0x44b8('0x55')](_0xb64e26,_0x30d60f[0x0]));if(_0x11ad5b['isFile']()){removeReferences(_0x5da64b,_0xb64e26);logger[_0x44b8('0x2a')](_0x44b8('0x77'));return _0x2a95f6(new Error(_0x44b8('0x77')));}if(_0x11ad5b['isDirectory']()){var _0x1cd0eb=fs[_0x44b8('0x76')](path['join'](_0xb64e26,_0x30d60f[0x0]));if(_0x1cd0eb[_0x44b8('0x42')]===0x0){removeReferences(_0x5da64b,_0xb64e26);logger[_0x44b8('0x2a')](_0x44b8('0x77'));return _0x2a95f6(new Error(_0x44b8('0x77')));}var _0x44bb6b=_0x1cd0eb['some'](function(_0x445ed9){return _0x445ed9===_0x44b8('0x79');});if(!_0x44bb6b){return _0x2a95f6(new Error(_0x44b8('0x7a')));}var _0x270224=fs[_0x44b8('0x7b')](path[_0x44b8('0x55')](_0xb64e26,_0x30d60f[0x0],_0x44b8('0x79')));var _0x119420=JSON['parse'](_0x270224);if(_0x44b8('0x1d')==typeof _0x119420[_0x44b8('0x2c')]){return _0x2a95f6(new Error(_0x44b8('0x7c')));}if(_0x44b8('0x1d')==typeof _0x119420['type']){return _0x2a95f6(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x119420[_0x44b8('0x7d')]){return _0x2a95f6(new Error(_0x44b8('0x7e')));}if(_0x44b8('0x1d')==typeof _0x119420[_0x44b8('0x7f')]){return _0x2a95f6(new Error(_0x44b8('0x80')));}if(_0x119420['type']===_0x44b8('0x81')){if('undefined'==typeof _0x119420[_0x44b8('0x7f')][_0x44b8('0x82')]){return _0x2a95f6(new Error(_0x44b8('0x83')));}if('undefined'==typeof _0x119420['parameters'][_0x44b8('0x82')][_0x44b8('0x84')]&&_0x44b8('0x1d')==typeof _0x119420['parameters'][_0x44b8('0x82')][_0x44b8('0x31')]){return _0x2a95f6(new Error(_0x44b8('0x85')));}}else if(_0x119420[_0x44b8('0x38')]===_0x44b8('0x86')){if('undefined'==typeof _0x119420[_0x44b8('0x7f')][_0x44b8('0x87')]){return _0x2a95f6(new Error(_0x44b8('0x88')));}if(_0x44b8('0x1d')==typeof _0x119420[_0x44b8('0x7f')]['scriptPath']){return _0x2a95f6(new Error(_0x44b8('0x89')));}}else{return _0x2a95f6(new Error(_0x44b8('0x8a')));}var _0x4e46c2=_0x119420[_0x44b8('0x2c')];var _0x2eb752=_0x119420[_0x44b8('0x8b')];var _0x1c7ef2=_0x119420['type'];var _0x45a674=_0x119420[_0x44b8('0x8c')]?_0x119420['sidebar']:_0x44b8('0x8d');var _0xa19e5f=_0x119420['icon']?_0x119420[_0x44b8('0x8e')]:'icon-apps';var _0x56dccf='';var _0x31d3b6='';var _0x3f0688='';var _0x4728b6='';var _0x531af3=_0x119420['version'];if(_0x1c7ef2==='html'){if(_0x44b8('0x1d')!=typeof _0x119420[_0x44b8('0x7f')][_0x44b8('0x82')][_0x44b8('0x84')]){var _0x444419=_0x119420[_0x44b8('0x7f')][_0x44b8('0x82')][_0x44b8('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x444419)){_0x56dccf=path[_0x44b8('0x55')]('plugins',_0x3354bd,_0x30d60f[0x0],_0x444419);}else{_0x56dccf=_0x444419;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x44b8('0x1d')!=typeof _0x119420['parameters'][_0x44b8('0x82')][_0x44b8('0x31')]){var _0x1d6e75=_0x119420[_0x44b8('0x7f')][_0x44b8('0x82')][_0x44b8('0x31')];if(!/^(f|ht)tps?:\/\//i[_0x44b8('0x8f')](_0x1d6e75)){_0x31d3b6=path[_0x44b8('0x55')]('plugins',_0x3354bd,_0x30d60f[0x0],_0x1d6e75);}else{_0x31d3b6=_0x1d6e75;}}else{logger[_0x44b8('0x6d')](_0x44b8('0x90'));}}else if(_0x1c7ef2===_0x44b8('0x86')){_0x3f0688=_0x119420[_0x44b8('0x7f')][_0x44b8('0x87')];_0x4728b6=_0x119420[_0x44b8('0x7f')][_0x44b8('0x91')];if(_0x44b8('0x1d')!=typeof _0x119420[_0x44b8('0x7f')]['views']){if('undefined'!=typeof _0x119420[_0x44b8('0x7f')]['views'][_0x44b8('0x84')]){var _0x444419=_0x119420[_0x44b8('0x7f')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x444419)){_0x56dccf=path[_0x44b8('0x55')]('plugins',_0x3354bd,_0x30d60f[0x0],_0x444419);}else{_0x56dccf=_0x444419;}}if(_0x44b8('0x1d')!=typeof _0x119420[_0x44b8('0x7f')][_0x44b8('0x82')][_0x44b8('0x31')]){var _0x1d6e75=_0x119420[_0x44b8('0x7f')][_0x44b8('0x82')][_0x44b8('0x31')];if(!/^(f|ht)tps?:\/\//i[_0x44b8('0x8f')](_0x1d6e75)){_0x31d3b6=path[_0x44b8('0x55')](_0x44b8('0x92'),_0x3354bd,_0x30d60f[0x0],_0x1d6e75);}else{_0x31d3b6=_0x1d6e75;}}}}var _0x34baa7={'name':_0x4e46c2,'description':_0x2eb752,'path':path[_0x44b8('0x55')](_0x3354bd,_0x30d60f[0x0]),'type':_0x1c7ef2,'sidebar':_0x45a674,'icon':_0xa19e5f,'adminUrl':_0x56dccf,'agentUrl':_0x31d3b6,'scriptName':_0x3f0688,'scriptPath':_0x4728b6,'version':_0x531af3};removeReferences(_0x5da64b,null);return db[_0x44b8('0x35')]['create'](_0x34baa7)[_0x44b8('0x24')](function(_0x2790b7){var _0x395cd6={'role':_0xc4d667[_0x44b8('0x2f')][_0x44b8('0x93')],'userProfileId':_0xc4d667[_0x44b8('0x2f')][_0x44b8('0x94')]};if(!_0x395cd6)throw new Error(_0x44b8('0x95'));if(_0x395cd6[_0x44b8('0x93')]===_0x44b8('0x96')){var _0x1774db=_0x2790b7[_0x44b8('0x26')]({'plain':!![]});return db[_0x44b8('0x97')]['find']({'where':{'name':_0x44b8('0x98'),'userProfileId':_0x395cd6[_0x44b8('0x94')]},'raw':!![]})[_0x44b8('0x24')](function(_0x48b710){if(_0x48b710&&_0x48b710['autoAssociation']===0x0){return db[_0x44b8('0x27')][_0x44b8('0x99')]({'name':_0x1774db[_0x44b8('0x2c')],'resourceId':_0x1774db['id'],'type':_0x48b710['name'],'sectionId':_0x48b710['id']},{})[_0x44b8('0x24')](function(){return _0x2790b7;});}else{return _0x2790b7;}})[_0x44b8('0x4f')](function(_0xca4a09){logger[_0x44b8('0x2a')](_0x44b8('0x9a'),_0xca4a09);throw _0xca4a09;});}return _0x2790b7;})[_0x44b8('0x24')](respondWithResult(_0x5df821,null))[_0x44b8('0x4f')](handleError(_0x5df821,null));}});}catch(_0x4391ca){_0x5df821['status'](0x1f4)[_0x44b8('0x2d')](_0x4391ca);}};function removeReferences(_0x4548b8,_0x1efc20){try{if(_0x4548b8){fs[_0x44b8('0x6c')](_0x4548b8);logger[_0x44b8('0x6d')](_0x44b8('0x9b'));}if(_0x1efc20){rimraf(_0x1efc20,function(){});logger[_0x44b8('0x6d')]('Extracted\x20folder\x20removed');}}catch(_0x5c8ce9){logger['error'](_0x5c8ce9);}}exports[_0x44b8('0x23')]=function(_0xc5f9ef,_0x2d74ee,_0x312f4c){return db[_0x44b8('0x35')][_0x44b8('0x53')]({'where':{'id':_0xc5f9ef[_0x44b8('0x51')]['id']}})[_0x44b8('0x24')](handleEntityNotFound(_0x2d74ee,null))[_0x44b8('0x24')](saveUpdates(_0xc5f9ef['body'],null))[_0x44b8('0x24')](respondWithResult(_0x2d74ee,null))[_0x44b8('0x4f')](handleError(_0x2d74ee,null));};exports['delete']=function(_0x4e204b,_0x3db3ee,_0x4ee9e3){return db[_0x44b8('0x35')][_0x44b8('0x53')]({'where':{'id':_0x4e204b[_0x44b8('0x51')]['id']}})['then'](function(_0x3f4a2a){if(_0x3f4a2a){return _0x3f4a2a[_0x44b8('0x25')]();}})[_0x44b8('0x24')](function(_0x13f82f){rimraf(path['join'](config[_0x44b8('0x62')],'server/files/plugins',path[_0x44b8('0x63')](_0x13f82f[_0x44b8('0x5')])),function(){});return _0x13f82f;})[_0x44b8('0x24')](handleEntityNotFound(_0x3db3ee,null))[_0x44b8('0x24')](respondWithStatusCode(_0x3db3ee,null))[_0x44b8('0x4f')](handleError(_0x3db3ee,null));};exports[_0x44b8('0x9c')]=function(_0xb17de6,_0x5b3e72,_0x4d3b82){return BPromise['resolve']()[_0x44b8('0x24')](function(){if(!_0xb17de6[_0x44b8('0x3c')][_0x44b8('0x5')]){throw new Error(_0x44b8('0x9d'));}if(!_0xb17de6[_0x44b8('0x3c')][_0x44b8('0x9e')]){throw new Error(_0x44b8('0x9f'));}var _0x1236df=_0xb17de6[_0x44b8('0x3c')][_0x44b8('0xa0')]?_0xb17de6[_0x44b8('0x3c')][_0x44b8('0xa0')]+':'+_0xb17de6[_0x44b8('0x3c')][_0x44b8('0x9e')]:_0x44b8('0xa1')+_0xb17de6[_0x44b8('0x3c')][_0x44b8('0x9e')];var _0x90a36f=_0xb17de6['query'][_0x44b8('0x20')]?_0xb17de6['query'][_0x44b8('0x20')]:!![];var _0x59c3a8=_0xb17de6['query'][_0x44b8('0xa2')]?_0xb17de6['query']['encoding']:null;var _0x4d3921={'method':_0xb17de6['method'],'uri':util['format'](_0x44b8('0xa3'),_0x1236df,_0xb17de6[_0x44b8('0x3c')][_0x44b8('0x5')]),'json':_0x90a36f,'resolveWithFullResponse':!![],'encoding':_0x59c3a8,'qs':_0xb17de6[_0x44b8('0x3c')]};if(_0xb17de6['headers']){_0x4d3921[_0x44b8('0xa4')]=_0xb17de6[_0x44b8('0xa4')];if(_0x4d3921['headers']['content-length']){delete _0x4d3921[_0x44b8('0xa4')][_0x44b8('0xa5')];}}if(_0x4d3921[_0x44b8('0xa4')]['content-type']){delete _0x4d3921[_0x44b8('0xa4')][_0x44b8('0xa6')];}return rp(_0x4d3921);})[_0x44b8('0x24')](function(_0x278cc5){if(_0x278cc5){_0x5b3e72[_0x44b8('0xa7')](_0x278cc5[_0x44b8('0xa4')]);logger[_0x44b8('0x6d')](_0x278cc5[_0x44b8('0x2f')]);if(_[_0x44b8('0xa8')](_0xb17de6['query'][_0x44b8('0x5')],_0x44b8('0x54'))&&_0x278cc5['statusCode']==0x1f4){return _0x5b3e72[_0x44b8('0x29')](_0x278cc5[_0x44b8('0xa9')]);}else{return _0x5b3e72[_0x44b8('0x1a')](_0x278cc5['statusCode'])[_0x44b8('0x2d')](_0x278cc5['body']);}}else{return _0x5b3e72[_0x44b8('0x29')](0xc8);}})[_0x44b8('0x4f')](handleError(_0x5b3e72,null));};exports['webhookPost']=function(_0x9c1c15,_0x24f762,_0x4384d3){return BPromise[_0x44b8('0xaa')]()['then'](function(){if(!_0x9c1c15[_0x44b8('0x3c')][_0x44b8('0x5')]){throw new Error(_0x44b8('0x9d'));}if(!_0x9c1c15[_0x44b8('0x3c')][_0x44b8('0x9e')]){throw new Error(_0x44b8('0x9f'));}var _0x10a66a=_0x9c1c15[_0x44b8('0x3c')][_0x44b8('0xa0')]?_0x9c1c15['query']['hostname']+':'+_0x9c1c15[_0x44b8('0x3c')][_0x44b8('0x9e')]:_0x44b8('0xa1')+_0x9c1c15[_0x44b8('0x3c')][_0x44b8('0x9e')];var _0x5989a6=_0x9c1c15[_0x44b8('0x3c')]['json']?_0x9c1c15[_0x44b8('0x3c')]['json']:!![];var _0x404c07=_0x9c1c15[_0x44b8('0x3c')][_0x44b8('0xa2')]?_0x9c1c15[_0x44b8('0x3c')][_0x44b8('0xa2')]:null;var _0x863a0d={'method':_0x9c1c15[_0x44b8('0xab')],'uri':util[_0x44b8('0x57')](_0x44b8('0xa3'),_0x10a66a,_0x9c1c15['query'][_0x44b8('0x5')]),'json':_0x5989a6,'resolveWithFullResponse':!![],'encoding':_0x404c07,'body':_0x9c1c15[_0x44b8('0x2f')]};if(_0x9c1c15[_0x44b8('0xa4')]){_0x863a0d[_0x44b8('0xa4')]=_0x9c1c15['headers'];if(_0x863a0d['headers']['content-length']){delete _0x863a0d[_0x44b8('0xa4')]['content-length'];}}if(_0x863a0d['headers'][_0x44b8('0xa6')]){delete _0x863a0d[_0x44b8('0xa4')][_0x44b8('0xa6')];}return rp(_0x863a0d);})[_0x44b8('0x24')](function(_0x413dd9){if(_0x413dd9){_0x24f762[_0x44b8('0xa7')](_0x413dd9[_0x44b8('0xa4')]);logger[_0x44b8('0x6d')](_0x413dd9['body']);return _0x24f762[_0x44b8('0x1a')](_0x413dd9[_0x44b8('0xa9')])[_0x44b8('0x2d')](_0x413dd9[_0x44b8('0x2f')]);}else{return _0x24f762['sendStatus'](0xc8);}})[_0x44b8('0x4f')](handleError(_0x24f762,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d1a1c2d..402488d 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['update','remove','emit','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x398791,_0x2c2047){var _0x52e62f=function(_0x5c4b8d){while(--_0x5c4b8d){_0x398791['push'](_0x398791['shift']());}};_0x52e62f(++_0x2c2047);}(_0x32f4,0x154));var _0x432f=function(_0x396408,_0x4bb1c0){_0x396408=_0x396408-0x0;var _0x4d1c88=_0x32f4[_0x396408];return _0x4d1c88;};'use strict';var EventEmitter=require(_0x432f('0x0'));var Plugin=require(_0x432f('0x1'))['db'][_0x432f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x432f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x432f('0x4'),'afterDestroy':_0x432f('0x5')};function emitEvent(_0x51a71a){return function(_0x354293,_0x1eabac,_0x344a29){PluginEvents[_0x432f('0x6')](_0x51a71a+':'+_0x354293['id'],_0x354293);PluginEvents[_0x432f('0x6')](_0x51a71a,_0x354293);_0x344a29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x432f('0x7')]=PluginEvents; \ No newline at end of file +var _0xd824=['save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3103fb,_0x329afd){var _0xc313f2=function(_0x1834de){while(--_0x1834de){_0x3103fb['push'](_0x3103fb['shift']());}};_0xc313f2(++_0x329afd);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x4d82('0x0'));var Plugin=require(_0x4d82('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d82('0x2'),'afterUpdate':_0x4d82('0x3'),'afterDestroy':_0x4d82('0x4')};function emitEvent(_0x2a976e){return function(_0x287fbf,_0x1c8ad9,_0x4bc746){PluginEvents['emit'](_0x2a976e+':'+_0x287fbf['id'],_0x287fbf);PluginEvents[_0x4d82('0x5')](_0x2a976e,_0x287fbf);_0x4bc746(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x4d82('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 289e5f1..e8ad8ca 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash'];(function(_0x46cece,_0x1b31d7){var _0x46bf66=function(_0xff5843){while(--_0xff5843){_0x46cece['push'](_0x46cece['shift']());}};_0x46bf66(++_0x1b31d7);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x207c=['api','moment','bluebird','request-promise','path','../../config/environment','define','Plugin','util','../../config/logger'];(function(_0x544bcc,_0xd18935){var _0x416ce5=function(_0x60c03c){while(--_0x60c03c){_0x544bcc['push'](_0x544bcc['shift']());}};_0x416ce5(++_0xd18935);}(_0x207c,0x1e8));var _0xc207=function(_0x5c0dfb,_0x29fe5e){_0x5c0dfb=_0x5c0dfb-0x0;var _0x49be35=_0x207c[_0x5c0dfb];return _0x49be35;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var BPromise=require(_0xc207('0x4'));var rp=require(_0xc207('0x5'));var fs=require('fs');var path=require(_0xc207('0x6'));var rimraf=require('rimraf');var config=require(_0xc207('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x55023e,_0xc88789){return _0x55023e[_0xc207('0x8')](_0xc207('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index dab0951..0806480 100644 --- a/server/api/plugin/plugin.rpc.js +++ b/server/api/plugin/plugin.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7420=['body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Plugin','create'];(function(_0x2d0e05,_0x4bedab){var _0x9692aa=function(_0x3895f8){while(--_0x3895f8){_0x2d0e05['push'](_0x2d0e05['shift']());}};_0x9692aa(++_0x4bedab);}(_0x7420,0xd0));var _0x0742=function(_0x3f4404,_0x9b679d){_0x3f4404=_0x3f4404-0x0;var _0x252d29=_0x7420[_0x3f4404];return _0x252d29;};'use strict';var _=require(_0x0742('0x0'));var util=require(_0x0742('0x1'));var moment=require(_0x0742('0x2'));var BPromise=require(_0x0742('0x3'));var rs=require(_0x0742('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0742('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0742('0x6'))('rpc');var config=require(_0x0742('0x7'));var jayson=require(_0x0742('0x8'));var client=jayson[_0x0742('0x9')][_0x0742('0xa')]({'port':0x232a});config[_0x0742('0xb')]=_[_0x0742('0xc')](config['redis'],{'host':_0x0742('0xd'),'port':0x18eb});var socket=require(_0x0742('0xe'))(new Redis(config[_0x0742('0xb')]));require(_0x0742('0xf'))[_0x0742('0x10')](socket);function respondWithRpcPromise(_0x5c631f,_0x306cf7,_0xabe35){return new BPromise(function(_0x2f9397,_0x59e8ba){return client[_0x0742('0x11')](_0x5c631f,_0xabe35)[_0x0742('0x12')](function(_0x1f62f8){logger[_0x0742('0x13')](_0x0742('0x14'),_0x306cf7,_0x0742('0x15'));logger[_0x0742('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x306cf7,_0x0742('0x15'),JSON[_0x0742('0x17')](_0x1f62f8));if(_0x1f62f8[_0x0742('0x18')]){if(_0x1f62f8[_0x0742('0x18')][_0x0742('0x19')]===0x1f4){logger[_0x0742('0x18')](_0x0742('0x14'),_0x306cf7,_0x1f62f8[_0x0742('0x18')][_0x0742('0x1a')]);return _0x59e8ba(_0x1f62f8['error'][_0x0742('0x1a')]);}logger[_0x0742('0x18')](_0x0742('0x14'),_0x306cf7,_0x1f62f8[_0x0742('0x18')][_0x0742('0x1a')]);return _0x2f9397(_0x1f62f8['error']['message']);}else{logger['info'](_0x0742('0x14'),_0x306cf7,_0x0742('0x15'));_0x2f9397(_0x1f62f8['result']['message']);}})[_0x0742('0x1b')](function(_0x36957d){logger[_0x0742('0x18')](_0x0742('0x14'),_0x306cf7,_0x36957d);_0x59e8ba(_0x36957d);});});}exports['CreatePlugin']=function(_0x4fd85f){var _0x48ef2b=this;return new Promise(function(_0x5deaa0,_0x4b5f8d){return db[_0x0742('0x1c')][_0x0742('0x1d')](_0x4fd85f[_0x0742('0x1e')],{'raw':_0x4fd85f[_0x0742('0x1f')]?_0x4fd85f[_0x0742('0x1f')][_0x0742('0x20')]===undefined?!![]:![]:!![]})[_0x0742('0x12')](function(_0xb3e2ee){logger[_0x0742('0x13')](_0x0742('0x21'),_0x4fd85f);logger['debug'](_0x0742('0x21'),_0x4fd85f,JSON[_0x0742('0x17')](_0xb3e2ee));_0x5deaa0(_0xb3e2ee);})[_0x0742('0x1b')](function(_0x4e7e8e){logger[_0x0742('0x18')](_0x0742('0x21'),_0x4e7e8e[_0x0742('0x1a')],_0x4fd85f);_0x4b5f8d(_0x48ef2b[_0x0742('0x18')](0x1f4,_0x4e7e8e['message']));});});}; \ No newline at end of file +var _0x9889=['jayson/promise','client','defaults','redis','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x50d94a,_0x4bb055){var _0x4b88ec=function(_0x5e6790){while(--_0x5e6790){_0x50d94a['push'](_0x50d94a['shift']());}};_0x4b88ec(++_0x4bb055);}(_0x9889,0x1a5));var _0x9988=function(_0x9294a3,_0xb56353){_0x9294a3=_0x9294a3-0x0;var _0x15e595=_0x9889[_0x9294a3];return _0x15e595;};'use strict';var _=require(_0x9988('0x0'));var util=require(_0x9988('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9988('0x2'));var fs=require('fs');var Redis=require(_0x9988('0x3'));var db=require(_0x9988('0x4'))['db'];var utils=require(_0x9988('0x5'));var logger=require(_0x9988('0x6'))(_0x9988('0x7'));var config=require('../../config/environment');var jayson=require(_0x9988('0x8'));var client=jayson[_0x9988('0x9')]['http']({'port':0x232a});config['redis']=_[_0x9988('0xa')](config[_0x9988('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9988('0xc'))(new Redis(config[_0x9988('0xb')]));require(_0x9988('0xd'))[_0x9988('0xe')](socket);function respondWithRpcPromise(_0x87b44e,_0x486c0b,_0x1e1f93){return new BPromise(function(_0x9023ce,_0x27d575){return client[_0x9988('0xf')](_0x87b44e,_0x1e1f93)[_0x9988('0x10')](function(_0x26a5e3){logger[_0x9988('0x11')](_0x9988('0x12'),_0x486c0b,_0x9988('0x13'));logger[_0x9988('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x486c0b,'request\x20sent',JSON[_0x9988('0x15')](_0x26a5e3));if(_0x26a5e3[_0x9988('0x16')]){if(_0x26a5e3[_0x9988('0x16')][_0x9988('0x17')]===0x1f4){logger[_0x9988('0x16')](_0x9988('0x12'),_0x486c0b,_0x26a5e3[_0x9988('0x16')][_0x9988('0x18')]);return _0x27d575(_0x26a5e3[_0x9988('0x16')]['message']);}logger[_0x9988('0x16')](_0x9988('0x12'),_0x486c0b,_0x26a5e3[_0x9988('0x16')]['message']);return _0x9023ce(_0x26a5e3[_0x9988('0x16')][_0x9988('0x18')]);}else{logger[_0x9988('0x11')]('Plugin,\x20%s,\x20%s',_0x486c0b,_0x9988('0x13'));_0x9023ce(_0x26a5e3[_0x9988('0x19')][_0x9988('0x18')]);}})[_0x9988('0x1a')](function(_0x4b5b3b){logger[_0x9988('0x16')](_0x9988('0x12'),_0x486c0b,_0x4b5b3b);_0x27d575(_0x4b5b3b);});});}exports[_0x9988('0x1b')]=function(_0x4f9f1d){var _0x3b8d1c=this;return new Promise(function(_0x4786f6,_0x97abcb){return db[_0x9988('0x1c')][_0x9988('0x1d')](_0x4f9f1d[_0x9988('0x1e')],{'raw':_0x4f9f1d['options']?_0x4f9f1d[_0x9988('0x1f')][_0x9988('0x20')]===undefined?!![]:![]:!![]})[_0x9988('0x10')](function(_0x3d941c){logger['info'](_0x9988('0x1b'),_0x4f9f1d);logger[_0x9988('0x14')]('CreatePlugin',_0x4f9f1d,JSON[_0x9988('0x15')](_0x3d941c));_0x4786f6(_0x3d941c);})[_0x9988('0x1a')](function(_0x500fb1){logger[_0x9988('0x16')](_0x9988('0x1b'),_0x500fb1[_0x9988('0x18')],_0x4f9f1d);_0x97abcb(_0x3b8d1c[_0x9988('0x16')](0x1f4,_0x500fb1[_0x9988('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f4e1f0a..618ec04 100644 --- a/server/api/plugin/plugin.socket.js +++ b/server/api/plugin/plugin.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9209=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x1be922,_0x205cb0){var _0xfd1a94=function(_0x380272){while(--_0x380272){_0x1be922['push'](_0x1be922['shift']());}};_0xfd1a94(++_0x205cb0);}(_0x9209,0x1ba));var _0x9920=function(_0x2bd5c9,_0x47a19a){_0x2bd5c9=_0x2bd5c9-0x0;var _0x6ec5be=_0x9209[_0x2bd5c9];return _0x6ec5be;};'use strict';var PluginEvents=require(_0x9920('0x0'));var events=[_0x9920('0x1'),_0x9920('0x2'),_0x9920('0x3')];function createListener(_0x42e266,_0x5e5a65){return function(_0x5af181){_0x5e5a65[_0x9920('0x4')](_0x42e266,_0x5af181);};}function removeListener(_0x21e6d4,_0x168140){return function(){PluginEvents[_0x9920('0x5')](_0x21e6d4,_0x168140);};}exports['register']=function(_0x2d733a){for(var _0x40f7da=0x0,_0x3e683f=events[_0x9920('0x6')];_0x40f7da<_0x3e683f;_0x40f7da++){var _0x3dc927=events[_0x40f7da];var _0x2af92c=createListener(_0x9920('0x7')+_0x3dc927,_0x2d733a);PluginEvents['on'](_0x3dc927,_0x2af92c);}}; \ No newline at end of file +var _0x5081=['./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5081,0x1a0));var _0x1508=function(_0x4cc47e,_0x49b1e5){_0x4cc47e=_0x4cc47e-0x0;var _0x3387fe=_0x5081[_0x4cc47e];return _0x3387fe;};'use strict';var PluginEvents=require(_0x1508('0x0'));var events=[_0x1508('0x1'),_0x1508('0x2'),_0x1508('0x3')];function createListener(_0x458464,_0xc60a9b){return function(_0x33c765){_0xc60a9b[_0x1508('0x4')](_0x458464,_0x33c765);};}function removeListener(_0x1884f4,_0x18973b){return function(){PluginEvents[_0x1508('0x5')](_0x1884f4,_0x18973b);};}exports[_0x1508('0x6')]=function(_0x578172){for(var _0x135216=0x0,_0x3f0fe1=events[_0x1508('0x7')];_0x135216<_0x3f0fe1;_0x135216++){var _0x3226e4=events[_0x135216];var _0x2f3675=createListener('plugin:'+_0x3226e4,_0x578172);PluginEvents['on'](_0x3226e4,_0x2f3675);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0444231..d389f4f 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf5a=['index','/:id','post','create','put','delete','destroy','exports','./pm2.controller','get','isAuthenticated'];(function(_0x2e7439,_0x69de48){var _0x246b18=function(_0x325915){while(--_0x325915){_0x2e7439['push'](_0x2e7439['shift']());}};_0x246b18(++_0x69de48);}(_0xcf5a,0x8c));var _0xacf5=function(_0x133dfa,_0x438843){_0x133dfa=_0x133dfa-0x0;var _0x2f16f6=_0xcf5a[_0x133dfa];return _0x2f16f6;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xacf5('0x0'));router[_0xacf5('0x1')]('/',auth[_0xacf5('0x2')](),controller[_0xacf5('0x3')]);router[_0xacf5('0x1')](_0xacf5('0x4'),auth['isAuthenticated'](),controller['show']);router[_0xacf5('0x5')]('/',auth['isAuthenticated'](),controller[_0xacf5('0x6')]);router[_0xacf5('0x7')](_0xacf5('0x4'),auth[_0xacf5('0x2')](),controller['update']);router[_0xacf5('0x8')](_0xacf5('0x4'),auth[_0xacf5('0x2')](),controller[_0xacf5('0x9')]);module[_0xacf5('0xa')]=router; \ No newline at end of file +var _0x3566=['create','put','update','delete','destroy','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show'];(function(_0x31f690,_0x2e9ce8){var _0x269076=function(_0x4653ec){while(--_0x4653ec){_0x31f690['push'](_0x31f690['shift']());}};_0x269076(++_0x2e9ce8);}(_0x3566,0x13d));var _0x6356=function(_0x1e18cd,_0x2f64e6){_0x1e18cd=_0x1e18cd-0x0;var _0x5ed374=_0x3566[_0x1e18cd];return _0x5ed374;};'use strict';var express=require('express');var router=express[_0x6356('0x0')]();var auth=require(_0x6356('0x1'));var controller=require('./pm2.controller');router[_0x6356('0x2')]('/',auth[_0x6356('0x3')](),controller[_0x6356('0x4')]);router[_0x6356('0x2')](_0x6356('0x5'),auth[_0x6356('0x3')](),controller[_0x6356('0x6')]);router['post']('/',auth[_0x6356('0x3')](),controller[_0x6356('0x7')]);router[_0x6356('0x8')](_0x6356('0x5'),auth['isAuthenticated'](),controller[_0x6356('0x9')]);router[_0x6356('0xa')](_0x6356('0x5'),auth[_0x6356('0x3')](),controller[_0x6356('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index d4dafa4..d796b22 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2603=['cwd','dirname','chdir','start','body','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','list','then','reject','motion2','length','catch','show','describe','script'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x2603,0x118));var _0x3260=function(_0x40634d,_0x2b64da){_0x40634d=_0x40634d-0x0;var _0x51f357=_0x2603[_0x40634d];return _0x51f357;};'use strict';var _=require(_0x3260('0x0'));var pm2=require(_0x3260('0x1'));var logger=require(_0x3260('0x2'))('api');var path=require(_0x3260('0x3'));var exec=require(_0x3260('0x4'))[_0x3260('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x39d001,_0x5e03af){return function(_0x3e4f8f){if(!_0x3e4f8f){_0x39d001[_0x3260('0x6')](0x194);;}return _0x3e4f8f;};}function respondWithResult(_0x54b25f,_0x32761d){_0x32761d=_0x32761d||0xc8;return function(_0x4f2cab){if(_0x4f2cab){return _0x54b25f['status'](_0x32761d)[_0x3260('0x7')](_0x4f2cab);}return null;};}function handleError(_0x13a699,_0x52e3ab){_0x52e3ab=_0x52e3ab||0x1f4;return function(_0x33c65b){logger[_0x3260('0x8')](_0x33c65b[_0x3260('0x9')]);if(_0x33c65b[_0x3260('0xa')]){delete _0x33c65b[_0x3260('0xa')];}_0x13a699[_0x3260('0xb')](_0x52e3ab)[_0x3260('0xc')](_0x33c65b);};}function execChildProcess(){return new BPromise(function(_0x79444f,_0x287e3f){exec(_0x3260('0xd'),function(_0x352113,_0x7f9600,_0x8e7abb){logger[_0x3260('0xe')](_0x7f9600);logger[_0x3260('0xe')](_0x8e7abb);if(_0x352113){logger['error'](_0x352113);return _0x287e3f(_0x352113);}return _0x79444f(_0x7f9600);});});}exports['index']=function(_0x38bcf1,_0x52f7fa){return pm2[_0x3260('0xf')]()[_0x3260('0x10')](function(_0x3561e4){if(_0x3561e4){var _0x3398db=_[_0x3260('0x11')](_0x3561e4,function(_0x3e34e2){return _0x3e34e2['name']==='express'||_0x3e34e2[_0x3260('0xa')]===_0x3260('0x12');});return{'rows':_0x3398db,'count':_0x3398db[_0x3260('0x13')]};}return null;})[_0x3260('0x10')](respondWithResult(_0x52f7fa,null))[_0x3260('0x14')](handleError(_0x52f7fa,null));};exports[_0x3260('0x15')]=function(_0x28ea3a,_0x44a3bc){return pm2[_0x3260('0x16')](_0x28ea3a['params']['id'])[_0x3260('0x10')](respondWithResult(_0x44a3bc,null))[_0x3260('0x10')](handleEntityNotFound(_0x44a3bc,null))[_0x3260('0x14')](handleError(_0x44a3bc,null));};exports['create']=function(_0x38bc85,_0x2e4dba){if(_0x38bc85['body'][_0x3260('0xa')]&&_0x38bc85['body'][_0x3260('0x17')]){var _0xfc032d=path['join'](__dirname,'../../files/plugins',_0x38bc85['body'][_0x3260('0x17')]);var _0x5e654a=process[_0x3260('0x18')]();process['chdir'](path[_0x3260('0x19')](_0xfc032d));return execChildProcess()['then'](function(_0x4d9dd2){process[_0x3260('0x1a')](_0x5e654a);return pm2[_0x3260('0x1b')]({'name':_0x38bc85[_0x3260('0x1c')]['name'],'script':_0xfc032d});})['then'](function(_0x2affcc){pm2['dump']();return _0x2affcc[0x0];})[_0x3260('0x10')](respondWithResult(_0x2e4dba,0xc9))[_0x3260('0x14')](handleError(_0x2e4dba,null));}else{return _0x2e4dba['status'](0x1f4)[_0x3260('0xc')]({'message':_0x3260('0x1d')});}};exports['update']=function(_0x570e8f,_0x12277b){if(_0x570e8f[_0x3260('0x1c')]['id']){delete _0x570e8f['body']['id'];}var _0x3499d2={'online':_0x3260('0x1e'),'stopped':_0x3260('0x1f')};if(_0x3499d2[_0x3260('0x20')](_0x570e8f['body'][_0x3260('0xb')])){return pm2[_0x3499d2[_0x570e8f[_0x3260('0x1c')][_0x3260('0xb')]]](_0x570e8f[_0x3260('0x21')]['id'])['then'](respondWithResult(_0x12277b,0xc8))['catch'](handleError(_0x12277b,null));}else{return _0x12277b['status'](0x1f4)['send']({'message':_0x3260('0x22')});}};exports[_0x3260('0x23')]=function(_0x2ffbe9,_0x231212){if(_0x2ffbe9[_0x3260('0x1c')]['id']){delete _0x2ffbe9['body']['id'];}if(_0x2ffbe9['params']['id']){return pm2['delete'](_0x2ffbe9[_0x3260('0x21')]['id'])[_0x3260('0x10')](function(_0x39c101){pm2[_0x3260('0x24')]();return _0x39c101[0x0];})[_0x3260('0x10')](respondWithResult(_0x231212,null))[_0x3260('0x14')](handleError(_0x231212,null));}else{return _0x231212[_0x3260('0xb')](0x1f4)[_0x3260('0xc')]({'message':_0x3260('0x25')});}}; \ No newline at end of file +var _0x4e8c=['name','send','npm\x20install','info','index','list','then','reject','express','length','catch','describe','create','body','script','join','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','params','dump','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','json','error','stack'];(function(_0x44b827,_0x1bb1aa){var _0x527342=function(_0x481338){while(--_0x481338){_0x44b827['push'](_0x44b827['shift']());}};_0x527342(++_0x1bb1aa);}(_0x4e8c,0x17b));var _0xc4e8=function(_0x1ea5a5,_0x22e0d9){_0x1ea5a5=_0x1ea5a5-0x0;var _0x317464=_0x4e8c[_0x1ea5a5];return _0x317464;};'use strict';var _=require(_0xc4e8('0x0'));var pm2=require(_0xc4e8('0x1'));var logger=require(_0xc4e8('0x2'))(_0xc4e8('0x3'));var path=require(_0xc4e8('0x4'));var exec=require('child_process')[_0xc4e8('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x16d986,_0x5bfdbe){return function(_0x5ae810){if(!_0x5ae810){_0x16d986[_0xc4e8('0x6')](0x194);;}return _0x5ae810;};}function respondWithResult(_0x70cdd7,_0xda300b){_0xda300b=_0xda300b||0xc8;return function(_0x267e5d){if(_0x267e5d){return _0x70cdd7[_0xc4e8('0x7')](_0xda300b)[_0xc4e8('0x8')](_0x267e5d);}return null;};}function handleError(_0x263fb0,_0x8a5d9a){_0x8a5d9a=_0x8a5d9a||0x1f4;return function(_0x563854){logger[_0xc4e8('0x9')](_0x563854[_0xc4e8('0xa')]);if(_0x563854['name']){delete _0x563854[_0xc4e8('0xb')];}_0x263fb0[_0xc4e8('0x7')](_0x8a5d9a)[_0xc4e8('0xc')](_0x563854);};}function execChildProcess(){return new BPromise(function(_0x52626b,_0x2cb2bb){exec(_0xc4e8('0xd'),function(_0x2929c7,_0xc28025,_0x5e169d){logger['info'](_0xc28025);logger[_0xc4e8('0xe')](_0x5e169d);if(_0x2929c7){logger[_0xc4e8('0x9')](_0x2929c7);return _0x2cb2bb(_0x2929c7);}return _0x52626b(_0xc28025);});});}exports[_0xc4e8('0xf')]=function(_0x51d0e8,_0x271d73){return pm2[_0xc4e8('0x10')]()[_0xc4e8('0x11')](function(_0x141c02){if(_0x141c02){var _0x534dc8=_[_0xc4e8('0x12')](_0x141c02,function(_0x2ef9da){return _0x2ef9da[_0xc4e8('0xb')]===_0xc4e8('0x13')||_0x2ef9da[_0xc4e8('0xb')]==='motion2';});return{'rows':_0x534dc8,'count':_0x534dc8[_0xc4e8('0x14')]};}return null;})[_0xc4e8('0x11')](respondWithResult(_0x271d73,null))[_0xc4e8('0x15')](handleError(_0x271d73,null));};exports['show']=function(_0x5f3d4a,_0x3b7f33){return pm2[_0xc4e8('0x16')](_0x5f3d4a['params']['id'])[_0xc4e8('0x11')](respondWithResult(_0x3b7f33,null))['then'](handleEntityNotFound(_0x3b7f33,null))['catch'](handleError(_0x3b7f33,null));};exports[_0xc4e8('0x17')]=function(_0x3fd5f5,_0x4a5527){if(_0x3fd5f5[_0xc4e8('0x18')]['name']&&_0x3fd5f5[_0xc4e8('0x18')][_0xc4e8('0x19')]){var _0x574328=path[_0xc4e8('0x1a')](__dirname,'../../files/plugins',_0x3fd5f5['body']['script']);var _0x4117b2=process['cwd']();process[_0xc4e8('0x1b')](path[_0xc4e8('0x1c')](_0x574328));return execChildProcess()['then'](function(_0x382520){process[_0xc4e8('0x1b')](_0x4117b2);return pm2[_0xc4e8('0x1d')]({'name':_0x3fd5f5[_0xc4e8('0x18')]['name'],'script':_0x574328});})[_0xc4e8('0x11')](function(_0x104a1c){pm2['dump']();return _0x104a1c[0x0];})[_0xc4e8('0x11')](respondWithResult(_0x4a5527,0xc9))[_0xc4e8('0x15')](handleError(_0x4a5527,null));}else{return _0x4a5527[_0xc4e8('0x7')](0x1f4)[_0xc4e8('0xc')]({'message':_0xc4e8('0x1e')});}};exports[_0xc4e8('0x1f')]=function(_0x4aabce,_0x59d16e){if(_0x4aabce['body']['id']){delete _0x4aabce[_0xc4e8('0x18')]['id'];}var _0x5749bc={'online':_0xc4e8('0x20'),'stopped':_0xc4e8('0x21')};if(_0x5749bc[_0xc4e8('0x22')](_0x4aabce[_0xc4e8('0x18')]['status'])){return pm2[_0x5749bc[_0x4aabce['body'][_0xc4e8('0x7')]]](_0x4aabce['params']['id'])[_0xc4e8('0x11')](respondWithResult(_0x59d16e,0xc8))[_0xc4e8('0x15')](handleError(_0x59d16e,null));}else{return _0x59d16e[_0xc4e8('0x7')](0x1f4)[_0xc4e8('0xc')]({'message':'Unknown\x20status'});}};exports[_0xc4e8('0x23')]=function(_0x23aea3,_0x32b7a5){if(_0x23aea3['body']['id']){delete _0x23aea3['body']['id'];}if(_0x23aea3['params']['id']){return pm2[_0xc4e8('0x24')](_0x23aea3[_0xc4e8('0x25')]['id'])['then'](function(_0x21a022){pm2[_0xc4e8('0x26')]();return _0x21a022[0x0];})[_0xc4e8('0x11')](respondWithResult(_0x32b7a5,null))['catch'](handleError(_0x32b7a5,null));}else{return _0x32b7a5[_0xc4e8('0x7')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index db05398..6423b90 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd07=['multer','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x562cd7,_0x5ae8e7){var _0x30f50d=function(_0x43b995){while(--_0x43b995){_0x562cd7['push'](_0x562cd7['shift']());}};_0x30f50d(++_0x5ae8e7);}(_0xfd07,0x104));var _0x7fd0=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0xfd07[_0x371d15];return _0x32afdf;};'use strict';var multer=require(_0x7fd0('0x0'));var util=require(_0x7fd0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7fd0('0x2'));var auth=require(_0x7fd0('0x3'));var interaction=require(_0x7fd0('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x84a0=['path','connect-timeout','Router','fs-extra','../../config/environment','exports','multer','util'];(function(_0x258b93,_0x188ccc){var _0x35484b=function(_0x2563ea){while(--_0x2563ea){_0x258b93['push'](_0x258b93['shift']());}};_0x35484b(++_0x188ccc);}(_0x84a0,0x66));var _0x084a=function(_0x569a45,_0x2da15b){_0x569a45=_0x569a45-0x0;var _0x1a5ef8=_0x84a0[_0x569a45];return _0x1a5ef8;};'use strict';var multer=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var path=require(_0x084a('0x2'));var timeout=require(_0x084a('0x3'));var express=require('express');var router=express[_0x084a('0x4')]();var fs_extra=require(_0x084a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x084a('0x6'));module[_0x084a('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index d04b587..f53c393 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb31=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xdb31,0x166));var _0x1db3=function(_0x5a93f0,_0x172b1b){_0x5a93f0=_0x5a93f0-0x0;var _0x53844d=_0xdb31[_0x5a93f0];return _0x53844d;};'use strict';var Sequelize=require(_0x1db3('0x0'));module[_0x1db3('0x1')]={'state':{'type':Sequelize[_0x1db3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1db3('0x3')]},'scheduledat':{'type':Sequelize[_0x1db3('0x4')]},'uniqueid':{'type':Sequelize[_0x1db3('0x3')]},'starttime':{'type':Sequelize[_0x1db3('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1db3('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1db3('0x3')]}}; \ No newline at end of file +var _0x190b=['STRING','DATE','sequelize','INTEGER'];(function(_0x22ad52,_0x1deb8d){var _0x49da16=function(_0x20717c){while(--_0x20717c){_0x22ad52['push'](_0x22ad52['shift']());}};_0x49da16(++_0x1deb8d);}(_0x190b,0x16e));var _0xb190=function(_0x6f0915,_0x29d6ae){_0x6f0915=_0x6f0915-0x0;var _0x30049c=_0x190b[_0x6f0915];return _0x30049c;};'use strict';var Sequelize=require(_0xb190('0x0'));module['exports']={'state':{'type':Sequelize[_0xb190('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb190('0x2')]},'scheduledat':{'type':Sequelize[_0xb190('0x3')]},'uniqueid':{'type':Sequelize[_0xb190('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb190('0x3')]},'ringtime':{'type':Sequelize[_0xb190('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb190('0x2')]},'campaigntype':{'type':Sequelize[_0xb190('0x2')]},'membername':{'type':Sequelize[_0xb190('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d242179..31af72b 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.model.js +++ b/server/api/reportAgentPreview/reportAgentPreview.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33dd=['./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33dd,0xc6));var _0xd33d=function(_0xd1fe,_0x1325f3){_0xd1fe=_0xd1fe-0x0;var _0x3e94c5=_0x33dd[_0xd1fe];return _0x3e94c5;};'use strict';var _=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var logger=require(_0xd33d('0x2'))(_0xd33d('0x3'));var moment=require(_0xd33d('0x4'));var BPromise=require(_0xd33d('0x5'));var rp=require(_0xd33d('0x6'));var fs=require('fs');var path=require(_0xd33d('0x7'));var rimraf=require(_0xd33d('0x8'));var config=require(_0xd33d('0x9'));var attributes=require(_0xd33d('0xa'));module['exports']=function(_0x173065,_0x4e332c){return _0x173065['define'](_0xd33d('0xb'),attributes,{'tableName':_0xd33d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d90=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x32f9e6,_0x55ed80){var _0x11a5ea=function(_0x1862ab){while(--_0x1862ab){_0x32f9e6['push'](_0x32f9e6['shift']());}};_0x11a5ea(++_0x55ed80);}(_0x9d90,0x1f3));var _0x09d9=function(_0x947c2d,_0x506d89){_0x947c2d=_0x947c2d-0x0;var _0x556023=_0x9d90[_0x947c2d];return _0x556023;};'use strict';var _=require(_0x09d9('0x0'));var util=require(_0x09d9('0x1'));var logger=require(_0x09d9('0x2'))(_0x09d9('0x3'));var moment=require('moment');var BPromise=require(_0x09d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09d9('0x5'));var rimraf=require(_0x09d9('0x6'));var config=require(_0x09d9('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x09d9('0x8')]=function(_0xf96abd,_0x115915){return _0xf96abd[_0x09d9('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 69189d5..8661971 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.rpc.js +++ b/server/api/reportAgentPreview/reportAgentPreview.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb61d=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','create','options','raw','CreateReportAgentPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xb61d,0x194));var _0xdb61=function(_0x21dd11,_0xd75fe){_0x21dd11=_0x21dd11-0x0;var _0x3f6b76=_0xb61d[_0x21dd11];return _0x3f6b76;};'use strict';var _=require(_0xdb61('0x0'));var util=require(_0xdb61('0x1'));var moment=require('moment');var BPromise=require(_0xdb61('0x2'));var rs=require(_0xdb61('0x3'));var fs=require('fs');var Redis=require(_0xdb61('0x4'));var db=require(_0xdb61('0x5'))['db'];var utils=require(_0xdb61('0x6'));var logger=require(_0xdb61('0x7'))(_0xdb61('0x8'));var config=require(_0xdb61('0x9'));var jayson=require(_0xdb61('0xa'));var client=jayson[_0xdb61('0xb')][_0xdb61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15c993,_0x4b047a,_0x57e202){return new BPromise(function(_0x22ee2c,_0x4ced0d){return client['request'](_0x15c993,_0x57e202)[_0xdb61('0xd')](function(_0x5ea832){logger[_0xdb61('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x4b047a,'request\x20sent');logger[_0xdb61('0xf')](_0xdb61('0x10'),_0x4b047a,_0xdb61('0x11'),JSON[_0xdb61('0x12')](_0x5ea832));if(_0x5ea832[_0xdb61('0x13')]){if(_0x5ea832[_0xdb61('0x13')]['code']===0x1f4){logger[_0xdb61('0x13')](_0xdb61('0x14'),_0x4b047a,_0x5ea832[_0xdb61('0x13')][_0xdb61('0x15')]);return _0x4ced0d(_0x5ea832['error'][_0xdb61('0x15')]);}logger[_0xdb61('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x4b047a,_0x5ea832[_0xdb61('0x13')]['message']);return _0x22ee2c(_0x5ea832[_0xdb61('0x13')][_0xdb61('0x15')]);}else{logger['info'](_0xdb61('0x14'),_0x4b047a,_0xdb61('0x11'));_0x22ee2c(_0x5ea832[_0xdb61('0x16')]['message']);}})[_0xdb61('0x17')](function(_0x41a0d2){logger[_0xdb61('0x13')](_0xdb61('0x14'),_0x4b047a,_0x41a0d2);_0x4ced0d(_0x41a0d2);});});}exports['CreateReportAgentPreview']=function(_0x4ab2a7){var _0x5703be=this;return new Promise(function(_0x108bef,_0x2af851){return db['ReportAgentPreview'][_0xdb61('0x18')](_0x4ab2a7['body'],{'raw':_0x4ab2a7[_0xdb61('0x19')]?_0x4ab2a7[_0xdb61('0x19')][_0xdb61('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5a28db){logger['info'](_0xdb61('0x1b'),_0x4ab2a7);logger[_0xdb61('0xf')](_0xdb61('0x1b'),_0x4ab2a7,JSON[_0xdb61('0x12')](_0x5a28db));_0x108bef(_0x5a28db);})['catch'](function(_0x13edb0){logger[_0xdb61('0x13')](_0xdb61('0x1b'),_0x13edb0[_0xdb61('0x15')],_0x4ab2a7);_0x2af851(_0x5703be['error'](0x1f4,_0x13edb0[_0xdb61('0x15')]));});});}; \ No newline at end of file +var _0xb736=['http','request','then','debug','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','create','options','raw','CreateReportAgentPreview','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5b7b22,_0x5bc479){var _0x53dc9d=function(_0x5108c0){while(--_0x5108c0){_0x5b7b22['push'](_0x5b7b22['shift']());}};_0x53dc9d(++_0x5bc479);}(_0xb736,0x1c1));var _0x6b73=function(_0x74a328,_0x1209dd){_0x74a328=_0x74a328-0x0;var _0x146adc=_0xb736[_0x74a328];return _0x146adc;};'use strict';var _=require(_0x6b73('0x0'));var util=require('util');var moment=require(_0x6b73('0x1'));var BPromise=require(_0x6b73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b73('0x3'))['db'];var utils=require(_0x6b73('0x4'));var logger=require('../../config/logger')(_0x6b73('0x5'));var config=require(_0x6b73('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6b73('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9b767e,_0xcb9b3e,_0x45bd38){return new BPromise(function(_0x4f1f8b,_0x177c0a){return client[_0x6b73('0x8')](_0x9b767e,_0x45bd38)[_0x6b73('0x9')](function(_0x1f11a8){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0xcb9b3e,'request\x20sent');logger[_0x6b73('0xa')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xcb9b3e,_0x6b73('0xb'),JSON['stringify'](_0x1f11a8));if(_0x1f11a8[_0x6b73('0xc')]){if(_0x1f11a8['error'][_0x6b73('0xd')]===0x1f4){logger[_0x6b73('0xc')](_0x6b73('0xe'),_0xcb9b3e,_0x1f11a8['error'][_0x6b73('0xf')]);return _0x177c0a(_0x1f11a8[_0x6b73('0xc')][_0x6b73('0xf')]);}logger[_0x6b73('0xc')](_0x6b73('0xe'),_0xcb9b3e,_0x1f11a8[_0x6b73('0xc')]['message']);return _0x4f1f8b(_0x1f11a8[_0x6b73('0xc')][_0x6b73('0xf')]);}else{logger[_0x6b73('0x10')](_0x6b73('0xe'),_0xcb9b3e,_0x6b73('0xb'));_0x4f1f8b(_0x1f11a8[_0x6b73('0x11')][_0x6b73('0xf')]);}})[_0x6b73('0x12')](function(_0x33d1cd){logger[_0x6b73('0xc')](_0x6b73('0xe'),_0xcb9b3e,_0x33d1cd);_0x177c0a(_0x33d1cd);});});}exports['CreateReportAgentPreview']=function(_0x499af4){var _0x9ddfda=this;return new Promise(function(_0x3234dc,_0x4ac05b){return db['ReportAgentPreview'][_0x6b73('0x13')](_0x499af4['body'],{'raw':_0x499af4[_0x6b73('0x14')]?_0x499af4[_0x6b73('0x14')][_0x6b73('0x15')]===undefined?!![]:![]:!![]})[_0x6b73('0x9')](function(_0x423459){logger[_0x6b73('0x10')](_0x6b73('0x16'),_0x499af4);logger[_0x6b73('0xa')]('CreateReportAgentPreview',_0x499af4,JSON[_0x6b73('0x17')](_0x423459));_0x3234dc(_0x423459);})[_0x6b73('0x12')](function(_0x254136){logger['error'](_0x6b73('0x16'),_0x254136[_0x6b73('0xf')],_0x499af4);_0x4ac05b(_0x9ddfda[_0x6b73('0xc')](0x1f4,_0x254136[_0x6b73('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b057848..06ee850 100644 --- a/server/api/rpc/index.js +++ b/server/api/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9993=['openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0xa0e884,_0x5069df){var _0x5cd14c=function(_0x4c8bef){while(--_0x4c8bef){_0xa0e884['push'](_0xa0e884['shift']());}};_0x5cd14c(++_0x5069df);}(_0x9993,0x109));var _0x3999=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9993[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x3999('0x0'));var util=require('util');var path=require('path');var express=require(_0x3999('0x1'));var router=express['Router']();var auth=require(_0x3999('0x2'));var controller=require(_0x3999('0x3'));router['get'](_0x3999('0x4'),auth[_0x3999('0x5')](),controller['voiceChannels']);router[_0x3999('0x6')](_0x3999('0x7'),auth['isAuthenticated'](),controller[_0x3999('0x8')]);router[_0x3999('0x6')](_0x3999('0x9'),auth[_0x3999('0x5')](),controller['voiceChannelStopMixMonitor']);router[_0x3999('0x6')](_0x3999('0xa'),auth[_0x3999('0x5')](),controller['voiceQueues']);router['get'](_0x3999('0xb'),auth[_0x3999('0x5')](),controller[_0x3999('0xc')]);router[_0x3999('0x6')](_0x3999('0xd'),auth[_0x3999('0x5')](),controller['mailQueues']);router[_0x3999('0x6')](_0x3999('0xe'),auth[_0x3999('0x5')](),controller[_0x3999('0xf')]);router['get'](_0x3999('0x10'),auth['isAuthenticated'](),controller[_0x3999('0x11')]);router[_0x3999('0x6')](_0x3999('0x12'),auth[_0x3999('0x5')](),controller[_0x3999('0x13')]);router[_0x3999('0x6')](_0x3999('0x14'),auth[_0x3999('0x5')](),controller[_0x3999('0x15')]);router['get'](_0x3999('0x16'),auth[_0x3999('0x5')](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth[_0x3999('0x5')](),controller['voiceQueuesPreview']);router[_0x3999('0x6')](_0x3999('0x17'),auth[_0x3999('0x5')](),controller[_0x3999('0x18')]);router[_0x3999('0x6')](_0x3999('0x19'),auth[_0x3999('0x5')](),controller[_0x3999('0x1a')]);router[_0x3999('0x6')](_0x3999('0x1b'),auth[_0x3999('0x5')](),controller[_0x3999('0x1c')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get'](_0x3999('0x1d'),auth[_0x3999('0x5')](),controller[_0x3999('0x1e')]);router[_0x3999('0x1f')]('/voice/queues/:id',auth[_0x3999('0x5')](),controller['updateVoiceQueue']);router['get'](_0x3999('0x20'),auth[_0x3999('0x5')](),controller[_0x3999('0x21')]);router[_0x3999('0x6')](_0x3999('0x22'),auth[_0x3999('0x5')](),controller['outboundChannels']);router[_0x3999('0x6')](_0x3999('0x23'),auth[_0x3999('0x5')](),controller[_0x3999('0x24')]);router[_0x3999('0x1f')](_0x3999('0x25'),auth[_0x3999('0x5')](),controller['agentCapacity']);router['get'](_0x3999('0x26'),auth['isAuthenticated'](),controller[_0x3999('0x27')]);router[_0x3999('0x6')](_0x3999('0x28'),auth[_0x3999('0x5')](),controller[_0x3999('0x29')]);router[_0x3999('0x6')](_0x3999('0x2a'),auth[_0x3999('0x5')](),controller['campaigns']);router['get'](_0x3999('0x2b'),auth[_0x3999('0x5')](),controller[_0x3999('0x2c')]);router[_0x3999('0x6')](_0x3999('0x2d'),auth[_0x3999('0x5')](),controller['chatQueuesWaitingInteractions']);router[_0x3999('0x6')]('/mail/queues/waitinginteractions',auth[_0x3999('0x5')](),controller[_0x3999('0x2e')]);router[_0x3999('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x3999('0x5')](),controller[_0x3999('0x2f')]);router[_0x3999('0x6')](_0x3999('0x30'),auth['isAuthenticated'](),controller[_0x3999('0x31')]);router[_0x3999('0x6')](_0x3999('0x32'),auth[_0x3999('0x5')](),controller[_0x3999('0x33')]);router[_0x3999('0x6')](_0x3999('0x34'),auth[_0x3999('0x5')](),controller[_0x3999('0x35')]);router[_0x3999('0x6')](_0x3999('0x36'),auth[_0x3999('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0x3999('0x37')](_0x3999('0x38'),auth['isAuthenticated'](),controller[_0x3999('0x39')]('mail'));router[_0x3999('0x6')](_0x3999('0x3a'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x3999('0x37')](_0x3999('0x3b'),auth[_0x3999('0x5')](),controller['queueNotify'](_0x3999('0x3c')));router[_0x3999('0x6')](_0x3999('0x3d'),auth['isAuthenticated'](),controller[_0x3999('0x3e')]);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3999('0x39')](_0x3999('0x3f')));router[_0x3999('0x6')](_0x3999('0x40'),auth['isAuthenticated'](),controller[_0x3999('0x41')]);router[_0x3999('0x37')](_0x3999('0x42'),auth['isAuthenticated'](),controller[_0x3999('0x39')](_0x3999('0x43')));router[_0x3999('0x6')](_0x3999('0x44'),auth[_0x3999('0x5')](),controller[_0x3999('0x45')]);router['post'](_0x3999('0x46'),auth['isAuthenticated'](),controller[_0x3999('0x39')]('sms'));router[_0x3999('0x37')](_0x3999('0x47'),auth['isAuthenticated'](),controller[_0x3999('0x39')](_0x3999('0x48')));router[_0x3999('0x6')](_0x3999('0x49'),auth['isAuthenticated'](),controller[_0x3999('0x4a')]);router['get'](_0x3999('0x4b'),auth[_0x3999('0x5')](),controller['showWhatsappQueues']);router[_0x3999('0x37')]('/agents/:id/notify',auth[_0x3999('0x5')](),controller[_0x3999('0x4c')]);module[_0x3999('0x4d')]=router; \ No newline at end of file +var _0xb160=['whatsappQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','post','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions'];(function(_0x33d51c,_0x87f441){var _0x35143f=function(_0x73d729){while(--_0x73d729){_0x33d51c['push'](_0x33d51c['shift']());}};_0x35143f(++_0x87f441);}(_0xb160,0x14f));var _0x0b16=function(_0x547d7e,_0x33c5db){_0x547d7e=_0x547d7e-0x0;var _0x14d0be=_0xb160[_0x547d7e];return _0x14d0be;};'use strict';var multer=require(_0x0b16('0x0'));var util=require(_0x0b16('0x1'));var path=require(_0x0b16('0x2'));var express=require(_0x0b16('0x3'));var router=express[_0x0b16('0x4')]();var auth=require(_0x0b16('0x5'));var controller=require(_0x0b16('0x6'));router[_0x0b16('0x7')](_0x0b16('0x8'),auth[_0x0b16('0x9')](),controller[_0x0b16('0xa')]);router[_0x0b16('0x7')](_0x0b16('0xb'),auth[_0x0b16('0x9')](),controller[_0x0b16('0xc')]);router[_0x0b16('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x0b16('0x9')](),controller[_0x0b16('0xd')]);router['get'](_0x0b16('0xe'),auth[_0x0b16('0x9')](),controller[_0x0b16('0xf')]);router[_0x0b16('0x7')](_0x0b16('0x10'),auth[_0x0b16('0x9')](),controller['chatQueues']);router['get'](_0x0b16('0x11'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x12')]);router[_0x0b16('0x7')](_0x0b16('0x13'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x14')]);router[_0x0b16('0x7')]('/openchannel/queues',auth[_0x0b16('0x9')](),controller[_0x0b16('0x15')]);router[_0x0b16('0x7')](_0x0b16('0x16'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x17')]);router[_0x0b16('0x7')](_0x0b16('0x18'),auth[_0x0b16('0x9')](),controller['whatsappQueues']);router[_0x0b16('0x7')](_0x0b16('0x19'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x1a')]);router['get'](_0x0b16('0x1b'),auth['isAuthenticated'](),controller[_0x0b16('0x1c')]);router[_0x0b16('0x7')](_0x0b16('0x1d'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x1e')]);router[_0x0b16('0x7')](_0x0b16('0x1f'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x20')]);router[_0x0b16('0x7')](_0x0b16('0x21'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x22')]);router[_0x0b16('0x7')](_0x0b16('0x23'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x24')]);router[_0x0b16('0x7')](_0x0b16('0x25'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x26')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x0b16('0x27')]);router[_0x0b16('0x7')]('/outbound',auth[_0x0b16('0x9')](),controller[_0x0b16('0x28')]);router[_0x0b16('0x7')](_0x0b16('0x29'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x2a')]);router[_0x0b16('0x7')](_0x0b16('0x2b'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x2c')]);router[_0x0b16('0x2d')](_0x0b16('0x2e'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x2f')]);router[_0x0b16('0x7')](_0x0b16('0x30'),auth['isAuthenticated'](),controller[_0x0b16('0x31')]);router['get']('/trunks',auth[_0x0b16('0x9')](),controller['trunks']);router[_0x0b16('0x7')]('/campaigns',auth[_0x0b16('0x9')](),controller['campaigns']);router[_0x0b16('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x0b16('0x7')](_0x0b16('0x32'),auth['isAuthenticated'](),controller[_0x0b16('0x33')]);router[_0x0b16('0x7')](_0x0b16('0x34'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x35')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x0b16('0x9')](),controller[_0x0b16('0x36')]);router[_0x0b16('0x7')](_0x0b16('0x37'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x38')]);router[_0x0b16('0x7')](_0x0b16('0x39'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x3a')]);router[_0x0b16('0x7')](_0x0b16('0x3b'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x3c')]);router[_0x0b16('0x7')]('/fax/queues/waitinginteractions',auth[_0x0b16('0x9')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x0b16('0x3d'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x3e')](_0x0b16('0x3f')));router[_0x0b16('0x7')]('/mail/queues/:id',auth[_0x0b16('0x9')](),controller['showMailQueues']);router[_0x0b16('0x40')](_0x0b16('0x41'),auth[_0x0b16('0x9')](),controller['queueNotify']('chat'));router[_0x0b16('0x7')](_0x0b16('0x42'),auth[_0x0b16('0x9')](),controller['showChatQueues']);router[_0x0b16('0x40')]('/fax/queues/:id/notify',auth[_0x0b16('0x9')](),controller[_0x0b16('0x3e')]('fax'));router['get'](_0x0b16('0x43'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x0b16('0x40')](_0x0b16('0x44'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router['get'](_0x0b16('0x45'),auth[_0x0b16('0x9')](),controller['showOpenchannelQueues']);router[_0x0b16('0x40')]('/sms/queues/:id/notify',auth[_0x0b16('0x9')](),controller['queueNotify'](_0x0b16('0x46')));router[_0x0b16('0x40')](_0x0b16('0x47'),auth[_0x0b16('0x9')](),controller['queueNotify']('whatsapp'));router[_0x0b16('0x7')](_0x0b16('0x48'),auth[_0x0b16('0x9')](),controller[_0x0b16('0x49')]);router[_0x0b16('0x7')](_0x0b16('0x4a'),auth['isAuthenticated'](),controller[_0x0b16('0x4b')]);router[_0x0b16('0x40')](_0x0b16('0x4c'),auth['isAuthenticated'](),controller[_0x0b16('0x4d')]);module[_0x0b16('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b804faf..fd11d58 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc58=['interface','agent','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','value','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Account','Queue','findOne','Message','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','InteractionId','Start','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','http','client','request','error','code','message','result','catch','json','sendStatus','name','status','send','isNil','rows','voiceChannels','VoiceChannels','then','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','INTERACTION'];(function(_0xc48f9b,_0x29c8e7){var _0x56fa15=function(_0x5d99bd){while(--_0x5d99bd){_0xc48f9b['push'](_0xc48f9b['shift']());}};_0x56fa15(++_0x29c8e7);}(_0xcc58,0x1b5));var _0x8cc5=function(_0x3f0985,_0x560eca){_0x3f0985=_0x3f0985-0x0;var _0x296d06=_0xcc58[_0x3f0985];return _0x296d06;};'use strict';var BPromise=require(_0x8cc5('0x0'));var moment=require(_0x8cc5('0x1'));var _=require(_0x8cc5('0x2'));var util=require(_0x8cc5('0x3'));var db=require(_0x8cc5('0x4'))['db'];var logger=require(_0x8cc5('0x5'))(_0x8cc5('0x6'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x8cc5('0x7')]({'port':0x232a});var mailClient=jayson[_0x8cc5('0x8')][_0x8cc5('0x7')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2835df,_0x496205,_0x1f3497){return new BPromise(function(_0x53819f,_0x4d043e){var _0x18d158=_0x1f3497?_0x1f3497:amiClient;return _0x18d158[_0x8cc5('0x9')](_0x2835df,_0x496205)['then'](function(_0x5ecfb3){if(_0x5ecfb3[_0x8cc5('0xa')]){if(_0x5ecfb3[_0x8cc5('0xa')][_0x8cc5('0xb')]===0x1f4){return _0x4d043e(_0x5ecfb3[_0x8cc5('0xa')][_0x8cc5('0xc')]);}return _0x53819f(_0x5ecfb3[_0x8cc5('0xa')][_0x8cc5('0xc')]);}else{_0x53819f(_0x5ecfb3[_0x8cc5('0xd')]);}})[_0x8cc5('0xe')](function(_0x499573){_0x4d043e(_0x499573);});});}function respondWithResult(_0x59871d,_0x545708){_0x545708=_0x545708||0xc8;return function(_0x20b8be){if(_0x20b8be){return _0x59871d['status'](_0x545708)[_0x8cc5('0xf')](_0x20b8be);}return _0x59871d[_0x8cc5('0x10')](0x194);};}function handleError(_0x49952c,_0x484ba6){_0x484ba6=_0x484ba6||0x1f4;return function(_0x145f12){logger[_0x8cc5('0xa')](_0x145f12['stack']);if(_0x145f12[_0x8cc5('0x11')]){delete _0x145f12[_0x8cc5('0x11')];}_0x49952c[_0x8cc5('0x12')](_0x484ba6)[_0x8cc5('0x13')](_0x145f12);};}function findById(_0x345740){return function(_0x322af7){if(!_[_0x8cc5('0x14')](_0x345740)&&!_[_0x8cc5('0x14')](_0x322af7)&&!_['isNil'](_0x322af7[_0x8cc5('0x15')])){return _['find'](_0x322af7[_0x8cc5('0x15')],function(_0x4d9038){return _0x4d9038['id']==_0x345740;});}return null;};}exports[_0x8cc5('0x16')]=function(_0x541cbb,_0x21e980){return respondWithRpcPromise(_0x8cc5('0x17'),_0x541cbb['query'])[_0x8cc5('0x18')](respondWithResult(_0x21e980,null))[_0x8cc5('0xe')](handleError(_0x21e980,null));};exports['voiceChannelMixMonitor']=function(_0x30c48f,_0x42b12a){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x8cc5('0x19')](_0x30c48f['query'],_0x30c48f['params']))[_0x8cc5('0x18')](respondWithResult(_0x42b12a,null))[_0x8cc5('0xe')](handleError(_0x42b12a,null));};exports[_0x8cc5('0x1a')]=function(_0x522b36,_0x569252){return respondWithRpcPromise(_0x8cc5('0x1b'),_[_0x8cc5('0x19')](_0x522b36[_0x8cc5('0x1c')],_0x522b36[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x569252,null))[_0x8cc5('0xe')](handleError(_0x569252,null));};exports[_0x8cc5('0x1e')]=function(_0x22e4c9,_0x4a9c6b){return respondWithRpcPromise(_0x8cc5('0x1f'),_0x22e4c9[_0x8cc5('0x1c')])['then'](respondWithResult(_0x4a9c6b,null))[_0x8cc5('0xe')](handleError(_0x4a9c6b,null));};exports[_0x8cc5('0x20')]=function(_0x15c1fb,_0x9ba551){return respondWithRpcPromise('VoiceQueues',_0x15c1fb[_0x8cc5('0x1c')])[_0x8cc5('0x18')](findById(_0x15c1fb[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x9ba551,null))[_0x8cc5('0xe')](handleError(_0x9ba551,null));};exports[_0x8cc5('0x21')]=function(_0x4efb78,_0xfdcc07){return respondWithRpcPromise(_0x8cc5('0x22'),_['merge'](_0x4efb78['body'],_0x4efb78['params']))[_0x8cc5('0x18')](respondWithResult(_0xfdcc07,null))[_0x8cc5('0xe')](handleError(_0xfdcc07,null));};exports[_0x8cc5('0x23')]=function(_0x91d48b,_0x42ec87){return respondWithRpcPromise(_0x8cc5('0x24'),_[_0x8cc5('0x19')](_0x91d48b[_0x8cc5('0x1c')],_0x91d48b[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x42ec87,null))[_0x8cc5('0xe')](handleError(_0x42ec87,null));};exports[_0x8cc5('0x25')]=function(_0x30c04d,_0x268aba){return respondWithRpcPromise(_0x8cc5('0x26'),_0x30c04d[_0x8cc5('0x1c')])[_0x8cc5('0x18')](respondWithResult(_0x268aba,null))[_0x8cc5('0xe')](handleError(_0x268aba,null));};exports['voiceQueuesChannel']=function(_0x33f498,_0x4b5610){return respondWithRpcPromise(_0x8cc5('0x27'),_[_0x8cc5('0x19')](_0x33f498[_0x8cc5('0x1c')],_0x33f498[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x4b5610,null))[_0x8cc5('0xe')](handleError(_0x4b5610,null));};exports[_0x8cc5('0x28')]=function(_0x28c84b,_0x44efa1){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x8cc5('0x19')](_0x28c84b[_0x8cc5('0x1c')],_0x28c84b['params']))[_0x8cc5('0x18')](respondWithResult(_0x44efa1,null))[_0x8cc5('0xe')](handleError(_0x44efa1,null));};exports[_0x8cc5('0x29')]=function(_0x481acc,_0x10413e){return respondWithRpcPromise(_0x8cc5('0x2a'),_[_0x8cc5('0x19')](_0x481acc[_0x8cc5('0x1c')],_0x481acc[_0x8cc5('0x1d')]))[_0x8cc5('0x18')](respondWithResult(_0x10413e,null))['catch'](handleError(_0x10413e,null));};exports['outbound']=function(_0x2cfa95,_0x342152){return respondWithRpcPromise(_0x8cc5('0x2b'),_0x2cfa95['query'])[_0x8cc5('0x18')](respondWithResult(_0x342152,null))[_0x8cc5('0xe')](handleError(_0x342152,null));};exports[_0x8cc5('0x2c')]=function(_0x543b8e,_0x309869){return respondWithRpcPromise('OutboundChannels',_0x543b8e[_0x8cc5('0x1c')])[_0x8cc5('0x18')](respondWithResult(_0x309869,null))['catch'](handleError(_0x309869,null));};exports[_0x8cc5('0x2d')]=function(_0x2600e5,_0x4cfdec){var _0x16ecf8;return respondWithRpcPromise(_0x8cc5('0x2e'),_0x2600e5[_0x8cc5('0x1c')])['then'](function(_0x3e2054){_0x16ecf8=_0x3e2054;return respondWithRpcPromise(_0x8cc5('0x2e'),_0x2600e5[_0x8cc5('0x1c')],routingClient);})['then'](function(_0x2a8870){return _[_0x8cc5('0x19')]({},_0x2a8870,_0x16ecf8);})[_0x8cc5('0x18')](respondWithResult(_0x4cfdec,null))[_0x8cc5('0xe')](handleError(_0x4cfdec,null));};exports[_0x8cc5('0x2f')]=function(_0x4e5585,_0xfe712c){if(_0x4e5585[_0x8cc5('0x30')]&&_0x4e5585[_0x8cc5('0x30')]['interaction']&&_0x4e5585['user']&&_0x4e5585[_0x8cc5('0x31')][_0x8cc5('0x11')]){for(var _0x53b347 in _0x4e5585['body'][_0x8cc5('0x32')]){if(_0x4e5585['body'][_0x8cc5('0x32')][_0x8cc5('0x33')](_0x53b347)){db['MemberReport'][_0x8cc5('0x34')]({'where':{'channel':_0x53b347,'membername':_0x4e5585['user']['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4e5585[_0x8cc5('0x30')][_0x8cc5('0x32')][_0x53b347]&&_0x4e5585['body'][_0x8cc5('0x32')][_0x53b347][_0x8cc5('0x35')]?{'$notIn':_0x4e5585[_0x8cc5('0x30')][_0x8cc5('0x32')][_0x53b347]}:{'$ne':null}}})[_0x8cc5('0x18')](function(_0x287251){var _0x217e65=moment()[_0x8cc5('0x36')](_0x8cc5('0x37'));for(var _0x42edf3=0x0,_0x3467d8=_0x287251[_0x8cc5('0x35')];_0x42edf3<_0x3467d8;_0x42edf3+=0x1){_0x287251[_0x42edf3][_0x8cc5('0x38')]({'exitAt':_0x217e65});}});for(var _0x5a4683=0x0;_0x5a4683<_0x4e5585['body'][_0x8cc5('0x32')][_0x53b347]['length'];_0x5a4683+=0x1){db[_0x8cc5('0x39')]['findOrCreate']({'where':{'channel':_0x53b347,'membername':_0x4e5585[_0x8cc5('0x31')]['name'],'type':_0x8cc5('0x3a'),'uniqueid':_0x4e5585[_0x8cc5('0x30')][_0x8cc5('0x32')][_0x53b347][_0x5a4683],'exitAt':null},'defaults':{'channel':_0x53b347,'membername':_0x4e5585['user']['name'],'interface':_['isNil'](_0x4e5585[_0x8cc5('0x31')][_0x8cc5('0x3b')])?util[_0x8cc5('0x36')]('SIP/%s',_0x4e5585['user'][_0x8cc5('0x11')]):_0x4e5585[_0x8cc5('0x31')][_0x8cc5('0x3b')],'type':'INTERACTION','enterAt':moment()[_0x8cc5('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x8cc5('0x3c'),'internal':_0x4e5585[_0x8cc5('0x31')]['internal'],'uniqueid':_0x4e5585['body'][_0x8cc5('0x32')][_0x53b347][_0x5a4683]}});}}}}return respondWithRpcPromise(_0x8cc5('0x3d'),{'id':_0x4e5585[_0x8cc5('0x1d')]['id'],'capacity':_0x4e5585['body'][_0x8cc5('0x3e')]},routingClient)[_0x8cc5('0x18')](respondWithResult(_0xfe712c,null))[_0x8cc5('0xe')](handleError(_0xfe712c,null));};exports[_0x8cc5('0x3f')]=function(_0x3a1f32,_0x2194d7){return respondWithRpcPromise(_0x8cc5('0x40'),_0x3a1f32[_0x8cc5('0x1c')])[_0x8cc5('0x18')](respondWithResult(_0x2194d7,null))[_0x8cc5('0xe')](handleError(_0x2194d7,null));};exports['trunks']=function(_0x276b95,_0x3c4c72){return respondWithRpcPromise('Trunks',_0x276b95['query'])['then'](respondWithResult(_0x3c4c72,null))[_0x8cc5('0xe')](handleError(_0x3c4c72,null));};exports[_0x8cc5('0x41')]=function(_0x373e4e,_0x3948d5){return respondWithRpcPromise(_0x8cc5('0x42'),_0x373e4e['query'])[_0x8cc5('0x18')](respondWithResult(_0x3948d5,null))[_0x8cc5('0xe')](handleError(_0x3948d5,null));};exports[_0x8cc5('0x43')]=function(_0x58f44e,_0x57d972){return respondWithRpcPromise(_0x8cc5('0x44'),_0x58f44e['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x57d972,null))['catch'](handleError(_0x57d972,null));};exports[_0x8cc5('0x45')]=function(_0x58f5ab,_0x56382b){return respondWithRpcPromise(_0x8cc5('0x44'),_0x58f5ab[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x58f5ab[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x56382b,null))[_0x8cc5('0xe')](handleError(_0x56382b,null));};exports['mailQueues']=function(_0x3145ea,_0x314bce){return respondWithRpcPromise(_0x8cc5('0x46'),_0x3145ea[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x314bce,null))[_0x8cc5('0xe')](handleError(_0x314bce,null));};exports['showMailQueues']=function(_0x4a8b7b,_0x280cb3){return respondWithRpcPromise(_0x8cc5('0x46'),_0x4a8b7b['query'],routingClient)['then'](findById(_0x4a8b7b[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x280cb3,null))['catch'](handleError(_0x280cb3,null));};exports['mailAccounts']=function(_0x4fbf42,_0x4f14da){return respondWithRpcPromise('MailAccounts',_0x4fbf42[_0x8cc5('0x1c')],mailClient)['then'](respondWithResult(_0x4f14da,null))['catch'](handleError(_0x4f14da,null));};exports[_0x8cc5('0x47')]=function(_0x27defd,_0x5bea4f){return respondWithRpcPromise(_0x8cc5('0x48'),_0x27defd[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x5bea4f,null))[_0x8cc5('0xe')](handleError(_0x5bea4f,null));};exports['showOpenchannelQueues']=function(_0x684555,_0x4303b0){return respondWithRpcPromise(_0x8cc5('0x48'),_0x684555[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x684555[_0x8cc5('0x1d')]['id']))['then'](respondWithResult(_0x4303b0,null))[_0x8cc5('0xe')](handleError(_0x4303b0,null));};exports[_0x8cc5('0x49')]=function(_0xb1c9a8,_0xd02f70){return respondWithRpcPromise(_0x8cc5('0x4a'),_0xb1c9a8[_0x8cc5('0x1c')],routingClient)['then'](respondWithResult(_0xd02f70,null))[_0x8cc5('0xe')](handleError(_0xd02f70,null));};exports[_0x8cc5('0x4b')]=function(_0x22e0aa,_0x58b189){return respondWithRpcPromise(_0x8cc5('0x4a'),_0x22e0aa[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x22e0aa[_0x8cc5('0x1d')]['id']))[_0x8cc5('0x18')](respondWithResult(_0x58b189,null))[_0x8cc5('0xe')](handleError(_0x58b189,null));};exports[_0x8cc5('0x4c')]=function(_0x5428aa,_0x457d90){return respondWithRpcPromise('WhatsappQueues',_0x5428aa[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x457d90,null))[_0x8cc5('0xe')](handleError(_0x457d90,null));};exports[_0x8cc5('0x4d')]=function(_0x49e08a,_0x3d51cb){return respondWithRpcPromise(_0x8cc5('0x4e'),_0x49e08a[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](findById(_0x49e08a['params']['id']))['then'](respondWithResult(_0x3d51cb,null))[_0x8cc5('0xe')](handleError(_0x3d51cb,null));};exports[_0x8cc5('0x4f')]=function(_0x350f93,_0x3d511a){return respondWithRpcPromise(_0x8cc5('0x50'),_0x350f93['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x3d511a,null))['catch'](handleError(_0x3d511a,null));};exports['showFaxQueues']=function(_0x3fd097,_0x3d5dfa){return respondWithRpcPromise(_0x8cc5('0x50'),_0x3fd097['query'],routingClient)['then'](findById(_0x3fd097['params']['id']))[_0x8cc5('0x18')](respondWithResult(_0x3d5dfa,null))[_0x8cc5('0xe')](handleError(_0x3d5dfa,null));};exports[_0x8cc5('0x51')]=function(_0x3864c7,_0x414a7a){return respondWithRpcPromise('FaxAccounts',_0x3864c7[_0x8cc5('0x1c')])['then'](respondWithResult(_0x414a7a,null))[_0x8cc5('0xe')](handleError(_0x414a7a,null));};exports['chatQueuesWaitingInteractions']=function(_0x3b2707,_0x166c83){return respondWithRpcPromise(_0x8cc5('0x52'),_0x3b2707['query'],routingClient)['then'](respondWithResult(_0x166c83,null))[_0x8cc5('0xe')](handleError(_0x166c83,null));};exports['mailQueuesWaitingInteractions']=function(_0x53865a,_0x5304db){return respondWithRpcPromise(_0x8cc5('0x53'),_0x53865a[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x5304db,null))[_0x8cc5('0xe')](handleError(_0x5304db,null));};exports[_0x8cc5('0x54')]=function(_0x10581d,_0x384c4c){return respondWithRpcPromise(_0x8cc5('0x55'),_0x10581d[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x384c4c,null))['catch'](handleError(_0x384c4c,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0xd570ed,_0x2a1ada){return respondWithRpcPromise(_0x8cc5('0x55'),_0xd570ed[_0x8cc5('0x1c')],routingClient)['then'](function(_0x3844cb){if(_0xd570ed['query'][_0x8cc5('0x56')]!==undefined){var _0x5b10b9=_(_0x3844cb['rows'])['filter']([_0xd570ed[_0x8cc5('0x1c')][_0x8cc5('0x56')],_0xd570ed[_0x8cc5('0x1d')]['id']])[_0x8cc5('0x57')](_0x8cc5('0x58'))[_0x8cc5('0x59')]()[_0x8cc5('0x5a')]();return _0x3844cb[_0x8cc5('0x15')]['filter'](function(_0x499b46){return _0x5b10b9['indexOf'](_0x499b46[_0x8cc5('0x58')])>-0x1;});}else{return _0x3844cb[_0x8cc5('0x15')][_0x8cc5('0x5b')](function(_0x35bd69){return _0x35bd69['queue_id']===parseInt(_0xd570ed[_0x8cc5('0x1d')]['id']);});}})[_0x8cc5('0x18')](respondWithResult(_0x2a1ada,null))['catch'](handleError(_0x2a1ada,null));};exports[_0x8cc5('0x5c')]=function(_0x30e0c4,_0x41f400){return respondWithRpcPromise(_0x8cc5('0x5d'),_0x30e0c4[_0x8cc5('0x1c')],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x41f400,null))[_0x8cc5('0xe')](handleError(_0x41f400,null));};exports[_0x8cc5('0x5e')]=function(_0xa7d180,_0x2af043){return respondWithRpcPromise(_0x8cc5('0x5f'),_0xa7d180['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x2af043,null))['catch'](handleError(_0x2af043,null));};exports[_0x8cc5('0x60')]=function(_0x3baa18,_0x241c5a){return respondWithRpcPromise(_0x8cc5('0x61'),_0x3baa18['query'],routingClient)[_0x8cc5('0x18')](respondWithResult(_0x241c5a,null))[_0x8cc5('0xe')](handleError(_0x241c5a,null));};exports['queueNotify']=function(_0x2fd8e0){return function(_0xc9ffce,_0xaabdb6){var _0x113efb,_0x4777c6;var _0x12ca1e=_[_0x8cc5('0x62')](_0x2fd8e0);var _0xfc006d=_0x2fd8e0==='chat'?_0x8cc5('0x63'):_0x8cc5('0x64');return db[_0x12ca1e+_0x8cc5('0x65')][_0x8cc5('0x66')]({'raw':!![],'where':{'id':_0xc9ffce[_0x8cc5('0x1d')]['id']}})['then'](function(_0x51233a){if(_[_0x8cc5('0x14')](_0x51233a)){throw new Error(_0x12ca1e+'\x20Queue\x20not\x20found');}_0x113efb=_0x51233a;return db[_0x12ca1e+_0x8cc5('0x67')]['findOne']({'where':{'id':_0xc9ffce[_0x8cc5('0x30')]['messageId']},'include':[{'model':db[_0x12ca1e+_0x8cc5('0x68')],'as':_0x8cc5('0x68')},{'model':db[_0x12ca1e+_0xfc006d],'as':_0x8cc5('0x64')}]});})['then'](function(_0x3f65c0){if(_[_0x8cc5('0x14')](_0x3f65c0)){throw new Error(_0x12ca1e+_0x8cc5('0x69'));}_0x4777c6=_0x3f65c0;return _0x3f65c0[_0x8cc5('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x21df55={'uniqueid':_0x2fd8e0+'.'+_0x4777c6['id']+'.'+_0x4777c6[_0x8cc5('0x68')]['id'],'FromUserId':_0xc9ffce['user']['id'],'type':'queue'};_0x21df55[_0x12ca1e+_0x8cc5('0x6b')]=_0x4777c6['id'];_0x21df55[_0x12ca1e+'InteractionId']=_0x4777c6[_0x8cc5('0x68')]['id'];_0x21df55[_0x8cc5('0x6c')+_0x12ca1e+_0xfc006d+'Id']=_0x4777c6['Account']['id'];_0x21df55['To'+_0x12ca1e+_0x8cc5('0x6d')]=_0x113efb['id'];return db[_0x12ca1e+_0x8cc5('0x6e')][_0x8cc5('0x6f')](_0x21df55);})[_0x8cc5('0x18')](function(){return respondWithRpcPromise('Start',{'channel':_0x2fd8e0,'interaction':_0x4777c6[_0x8cc5('0x68')],'message':_0x4777c6,'account':_0x4777c6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x8cc5('0x70'),'appdata':_0x113efb[_0x8cc5('0x11')]+','+(_0x4777c6['Account'][_0x8cc5('0x71')]||0x12c),'interval':_0x8cc5('0x72')}]},routingClient);})[_0x8cc5('0x18')](respondWithResult(_0xaabdb6,null))[_0x8cc5('0xe')](handleError(_0xaabdb6,null));};};exports[_0x8cc5('0x73')]=function(_0x338bd1,_0x4c2c01){var _0x8b9be1,_0xedc40b;if(_['isNil'](_0x338bd1[_0x8cc5('0x30')][_0x8cc5('0x74')])){throw new Error(_0x8cc5('0x75'));}var _0x24d458=_0x338bd1[_0x8cc5('0x30')][_0x8cc5('0x74')];var _0x29e035=_[_0x8cc5('0x62')](_0x24d458);var _0x165c08=_0x24d458==='chat'?'Website':'Account';return db[_0x8cc5('0x76')][_0x8cc5('0x66')]({'raw':!![],'where':{'id':_0x338bd1[_0x8cc5('0x1d')]['id'],'role':_0x8cc5('0x3c')}})[_0x8cc5('0x18')](function(_0x213189){if(_[_0x8cc5('0x14')](_0x213189)){throw new Error(_0x8cc5('0x77'));}_0x8b9be1=_0x213189;return db[_0x29e035+_0x8cc5('0x67')][_0x8cc5('0x66')]({'where':{'id':_0x338bd1[_0x8cc5('0x30')][_0x8cc5('0x78')]},'include':[{'model':db[_0x29e035+_0x8cc5('0x68')],'as':'Interaction'},{'model':db[_0x29e035+_0x165c08],'as':_0x8cc5('0x64')}]});})[_0x8cc5('0x18')](function(_0x2e3c69){if(_[_0x8cc5('0x14')](_0x2e3c69)){throw new Error(_0x29e035+_0x8cc5('0x69'));}_0xedc40b=_0x2e3c69;return _0x2e3c69[_0x8cc5('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8cc5('0x18')](function(){var _0x55dcda={'uniqueid':_0x24d458+'.'+_0xedc40b['id']+'.'+_0xedc40b['Interaction']['id'],'FromUserId':_0x338bd1[_0x8cc5('0x31')]['id'],'type':'queue','ToUserId':_0x8b9be1['id']};_0x55dcda[_0x29e035+_0x8cc5('0x6b')]=_0xedc40b['id'];_0x55dcda[_0x29e035+_0x8cc5('0x79')]=_0xedc40b[_0x8cc5('0x68')]['id'];_0x55dcda[_0x8cc5('0x6c')+_0x29e035+_0x165c08+'Id']=_0xedc40b[_0x8cc5('0x64')]['id'];return db[_0x29e035+_0x8cc5('0x6e')][_0x8cc5('0x6f')](_0x55dcda);})['then'](function(){return respondWithRpcPromise(_0x8cc5('0x7a'),{'channel':_0x24d458,'interaction':_0xedc40b[_0x8cc5('0x68')],'message':_0xedc40b,'account':_0xedc40b[_0x8cc5('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8cc5('0x3c'),'appdata':_0x8b9be1['name']+','+(_0xedc40b[_0x8cc5('0x64')][_0x8cc5('0x7b')]||0x12c),'interval':_0x8cc5('0x72')}]},routingClient);})[_0x8cc5('0x18')](respondWithResult(_0x4c2c01,null))['catch'](handleError(_0x4c2c01,null));}; \ No newline at end of file +var _0x8266=['channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','Message','\x20Message\x20not\x20found','From','agentTransferTimeout','*,*,*,*','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','VoiceChannelMixMonitor','merge','query','params','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','agent','internal','AgentCapacity','capacity','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify'];(function(_0x53c7f4,_0x9a4e68){var _0x4426e1=function(_0x15d404){while(--_0x15d404){_0x53c7f4['push'](_0x53c7f4['shift']());}};_0x4426e1(++_0x9a4e68);}(_0x8266,0x1ed));var _0x6826=function(_0x494c0a,_0x21968c){_0x494c0a=_0x494c0a-0x0;var _0xf8bad5=_0x8266[_0x494c0a];return _0xf8bad5;};'use strict';var BPromise=require('bluebird');var moment=require(_0x6826('0x0'));var _=require(_0x6826('0x1'));var util=require('util');var db=require(_0x6826('0x2'))['db'];var logger=require(_0x6826('0x3'))('api');var jayson=require(_0x6826('0x4'));var amiClient=jayson[_0x6826('0x5')][_0x6826('0x6')]({'port':0x232a});var mailClient=jayson[_0x6826('0x5')][_0x6826('0x6')]({'port':0x232b});var routingClient=jayson[_0x6826('0x5')][_0x6826('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x2b5b6a,_0x332402,_0x54ba28){return new BPromise(function(_0x3d9c0c,_0xd0de5c){var _0x5d7dbc=_0x54ba28?_0x54ba28:amiClient;return _0x5d7dbc[_0x6826('0x7')](_0x2b5b6a,_0x332402)[_0x6826('0x8')](function(_0x178e61){if(_0x178e61[_0x6826('0x9')]){if(_0x178e61['error'][_0x6826('0xa')]===0x1f4){return _0xd0de5c(_0x178e61['error'][_0x6826('0xb')]);}return _0x3d9c0c(_0x178e61[_0x6826('0x9')][_0x6826('0xb')]);}else{_0x3d9c0c(_0x178e61['result']);}})[_0x6826('0xc')](function(_0x4a2874){_0xd0de5c(_0x4a2874);});});}function respondWithResult(_0x3700cf,_0x37e9f3){_0x37e9f3=_0x37e9f3||0xc8;return function(_0x3852e2){if(_0x3852e2){return _0x3700cf[_0x6826('0xd')](_0x37e9f3)[_0x6826('0xe')](_0x3852e2);}return _0x3700cf[_0x6826('0xf')](0x194);};}function handleError(_0x10be3e,_0x3d9dfd){_0x3d9dfd=_0x3d9dfd||0x1f4;return function(_0x43aa81){logger[_0x6826('0x9')](_0x43aa81[_0x6826('0x10')]);if(_0x43aa81[_0x6826('0x11')]){delete _0x43aa81[_0x6826('0x11')];}_0x10be3e[_0x6826('0xd')](_0x3d9dfd)['send'](_0x43aa81);};}function findById(_0xeb5f6d){return function(_0x5208a7){if(!_['isNil'](_0xeb5f6d)&&!_['isNil'](_0x5208a7)&&!_[_0x6826('0x12')](_0x5208a7[_0x6826('0x13')])){return _['find'](_0x5208a7['rows'],function(_0x18f502){return _0x18f502['id']==_0xeb5f6d;});}return null;};}exports[_0x6826('0x14')]=function(_0x52366a,_0x5c852d){return respondWithRpcPromise(_0x6826('0x15'),_0x52366a['query'])[_0x6826('0x8')](respondWithResult(_0x5c852d,null))[_0x6826('0xc')](handleError(_0x5c852d,null));};exports['voiceChannelMixMonitor']=function(_0x2f1844,_0x9bd1f6){return respondWithRpcPromise(_0x6826('0x16'),_[_0x6826('0x17')](_0x2f1844[_0x6826('0x18')],_0x2f1844[_0x6826('0x19')]))['then'](respondWithResult(_0x9bd1f6,null))[_0x6826('0xc')](handleError(_0x9bd1f6,null));};exports['voiceChannelStopMixMonitor']=function(_0x56eef0,_0x552485){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x56eef0['query'],_0x56eef0[_0x6826('0x19')]))[_0x6826('0x8')](respondWithResult(_0x552485,null))[_0x6826('0xc')](handleError(_0x552485,null));};exports['voiceQueues']=function(_0x6e9ec9,_0x4112a8){return respondWithRpcPromise(_0x6826('0x1a'),_0x6e9ec9['query'])[_0x6826('0x8')](respondWithResult(_0x4112a8,null))[_0x6826('0xc')](handleError(_0x4112a8,null));};exports['showVoiceQueues']=function(_0x3275e6,_0x55fbd6){return respondWithRpcPromise(_0x6826('0x1a'),_0x3275e6[_0x6826('0x18')])[_0x6826('0x8')](findById(_0x3275e6['params']['id']))[_0x6826('0x8')](respondWithResult(_0x55fbd6,null))[_0x6826('0xc')](handleError(_0x55fbd6,null));};exports[_0x6826('0x1b')]=function(_0x1fb8cf,_0x5a5229){return respondWithRpcPromise(_0x6826('0x1c'),_[_0x6826('0x17')](_0x1fb8cf[_0x6826('0x1d')],_0x1fb8cf[_0x6826('0x19')]))['then'](respondWithResult(_0x5a5229,null))['catch'](handleError(_0x5a5229,null));};exports[_0x6826('0x1e')]=function(_0x383ace,_0x505673){return respondWithRpcPromise(_0x6826('0x1f'),_['merge'](_0x383ace[_0x6826('0x18')],_0x383ace['params']))[_0x6826('0x8')](respondWithResult(_0x505673,null))[_0x6826('0xc')](handleError(_0x505673,null));};exports[_0x6826('0x20')]=function(_0x5d7d5b,_0x38e6eb){return respondWithRpcPromise(_0x6826('0x21'),_0x5d7d5b[_0x6826('0x18')])[_0x6826('0x8')](respondWithResult(_0x38e6eb,null))[_0x6826('0xc')](handleError(_0x38e6eb,null));};exports[_0x6826('0x22')]=function(_0x489978,_0x3ef4d0){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x6826('0x17')](_0x489978[_0x6826('0x18')],_0x489978['params']))[_0x6826('0x8')](respondWithResult(_0x3ef4d0,null))[_0x6826('0xc')](handleError(_0x3ef4d0,null));};exports['voiceQueuesChannelHangup']=function(_0x3790a9,_0x204420){return respondWithRpcPromise(_0x6826('0x23'),_[_0x6826('0x17')](_0x3790a9[_0x6826('0x18')],_0x3790a9['params']))[_0x6826('0x8')](respondWithResult(_0x204420,null))[_0x6826('0xc')](handleError(_0x204420,null));};exports[_0x6826('0x24')]=function(_0x2bc996,_0xc6e85f){return respondWithRpcPromise(_0x6826('0x25'),_[_0x6826('0x17')](_0x2bc996['query'],_0x2bc996[_0x6826('0x19')]))[_0x6826('0x8')](respondWithResult(_0xc6e85f,null))[_0x6826('0xc')](handleError(_0xc6e85f,null));};exports['outbound']=function(_0x452d04,_0x200b1a){return respondWithRpcPromise(_0x6826('0x26'),_0x452d04[_0x6826('0x18')])['then'](respondWithResult(_0x200b1a,null))[_0x6826('0xc')](handleError(_0x200b1a,null));};exports[_0x6826('0x27')]=function(_0x19a7c5,_0x402f63){return respondWithRpcPromise(_0x6826('0x28'),_0x19a7c5['query'])['then'](respondWithResult(_0x402f63,null))[_0x6826('0xc')](handleError(_0x402f63,null));};exports['agents']=function(_0x8b2ff9,_0x151d90){var _0x2d735d;return respondWithRpcPromise(_0x6826('0x29'),_0x8b2ff9[_0x6826('0x18')])[_0x6826('0x8')](function(_0x125a18){_0x2d735d=_0x125a18;return respondWithRpcPromise(_0x6826('0x29'),_0x8b2ff9[_0x6826('0x18')],routingClient);})[_0x6826('0x8')](function(_0x88be7b){return _[_0x6826('0x17')]({},_0x88be7b,_0x2d735d);})[_0x6826('0x8')](respondWithResult(_0x151d90,null))[_0x6826('0xc')](handleError(_0x151d90,null));};exports['agentCapacity']=function(_0x45f2fc,_0x3672f1){if(_0x45f2fc[_0x6826('0x1d')]&&_0x45f2fc[_0x6826('0x1d')][_0x6826('0x2a')]&&_0x45f2fc[_0x6826('0x2b')]&&_0x45f2fc[_0x6826('0x2b')][_0x6826('0x11')]){for(var _0x7c8ab0 in _0x45f2fc[_0x6826('0x1d')][_0x6826('0x2a')]){if(_0x45f2fc[_0x6826('0x1d')][_0x6826('0x2a')][_0x6826('0x2c')](_0x7c8ab0)){db[_0x6826('0x2d')][_0x6826('0x2e')]({'where':{'channel':_0x7c8ab0,'membername':_0x45f2fc[_0x6826('0x2b')][_0x6826('0x11')],'type':_0x6826('0x2f'),'exitAt':null,'uniqueid':_0x45f2fc[_0x6826('0x1d')]['interaction'][_0x7c8ab0]&&_0x45f2fc[_0x6826('0x1d')]['interaction'][_0x7c8ab0][_0x6826('0x30')]?{'$notIn':_0x45f2fc['body']['interaction'][_0x7c8ab0]}:{'$ne':null}}})[_0x6826('0x8')](function(_0x5e8466){var _0x4cbdf2=moment()[_0x6826('0x31')](_0x6826('0x32'));for(var _0x5041b0=0x0,_0x34b121=_0x5e8466[_0x6826('0x30')];_0x5041b0<_0x34b121;_0x5041b0+=0x1){_0x5e8466[_0x5041b0][_0x6826('0x33')]({'exitAt':_0x4cbdf2});}});for(var _0x59dde6=0x0;_0x59dde6<_0x45f2fc['body'][_0x6826('0x2a')][_0x7c8ab0][_0x6826('0x30')];_0x59dde6+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x7c8ab0,'membername':_0x45f2fc[_0x6826('0x2b')][_0x6826('0x11')],'type':_0x6826('0x2f'),'uniqueid':_0x45f2fc[_0x6826('0x1d')]['interaction'][_0x7c8ab0][_0x59dde6],'exitAt':null},'defaults':{'channel':_0x7c8ab0,'membername':_0x45f2fc['user'][_0x6826('0x11')],'interface':_['isNil'](_0x45f2fc[_0x6826('0x2b')]['interface'])?util[_0x6826('0x31')]('SIP/%s',_0x45f2fc['user'][_0x6826('0x11')]):_0x45f2fc['user']['interface'],'type':'INTERACTION','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x6826('0x34'),'internal':_0x45f2fc[_0x6826('0x2b')][_0x6826('0x35')],'uniqueid':_0x45f2fc[_0x6826('0x1d')][_0x6826('0x2a')][_0x7c8ab0][_0x59dde6]}});}}}}return respondWithRpcPromise(_0x6826('0x36'),{'id':_0x45f2fc[_0x6826('0x19')]['id'],'capacity':_0x45f2fc[_0x6826('0x1d')][_0x6826('0x37')]},routingClient)[_0x6826('0x8')](respondWithResult(_0x3672f1,null))[_0x6826('0xc')](handleError(_0x3672f1,null));};exports['telephones']=function(_0x33e4d1,_0x41418f){return respondWithRpcPromise('Telephones',_0x33e4d1[_0x6826('0x18')])['then'](respondWithResult(_0x41418f,null))[_0x6826('0xc')](handleError(_0x41418f,null));};exports[_0x6826('0x38')]=function(_0x2de2df,_0x4b2787){return respondWithRpcPromise(_0x6826('0x39'),_0x2de2df[_0x6826('0x18')])[_0x6826('0x8')](respondWithResult(_0x4b2787,null))[_0x6826('0xc')](handleError(_0x4b2787,null));};exports[_0x6826('0x3a')]=function(_0x1967f2,_0x24d4ea){return respondWithRpcPromise(_0x6826('0x3b'),_0x1967f2[_0x6826('0x18')])[_0x6826('0x8')](respondWithResult(_0x24d4ea,null))[_0x6826('0xc')](handleError(_0x24d4ea,null));};exports[_0x6826('0x3c')]=function(_0x15777b,_0xda3160){return respondWithRpcPromise(_0x6826('0x3d'),_0x15777b[_0x6826('0x18')],routingClient)[_0x6826('0x8')](respondWithResult(_0xda3160,null))[_0x6826('0xc')](handleError(_0xda3160,null));};exports['showChatQueues']=function(_0x111e5b,_0x3872fe){return respondWithRpcPromise(_0x6826('0x3d'),_0x111e5b[_0x6826('0x18')],routingClient)[_0x6826('0x8')](findById(_0x111e5b[_0x6826('0x19')]['id']))[_0x6826('0x8')](respondWithResult(_0x3872fe,null))[_0x6826('0xc')](handleError(_0x3872fe,null));};exports[_0x6826('0x3e')]=function(_0x2388e6,_0x2bc650){return respondWithRpcPromise('MailQueues',_0x2388e6[_0x6826('0x18')],routingClient)[_0x6826('0x8')](respondWithResult(_0x2bc650,null))[_0x6826('0xc')](handleError(_0x2bc650,null));};exports[_0x6826('0x3f')]=function(_0x3107ca,_0x16aa3d){return respondWithRpcPromise(_0x6826('0x40'),_0x3107ca['query'],routingClient)[_0x6826('0x8')](findById(_0x3107ca[_0x6826('0x19')]['id']))[_0x6826('0x8')](respondWithResult(_0x16aa3d,null))[_0x6826('0xc')](handleError(_0x16aa3d,null));};exports[_0x6826('0x41')]=function(_0x57b4a9,_0x297f40){return respondWithRpcPromise(_0x6826('0x42'),_0x57b4a9[_0x6826('0x18')],mailClient)[_0x6826('0x8')](respondWithResult(_0x297f40,null))[_0x6826('0xc')](handleError(_0x297f40,null));};exports[_0x6826('0x43')]=function(_0x42c7ba,_0x49076e){return respondWithRpcPromise(_0x6826('0x44'),_0x42c7ba[_0x6826('0x18')],routingClient)[_0x6826('0x8')](respondWithResult(_0x49076e,null))['catch'](handleError(_0x49076e,null));};exports[_0x6826('0x45')]=function(_0x1e156a,_0xb458a2){return respondWithRpcPromise('OpenchannelQueues',_0x1e156a[_0x6826('0x18')],routingClient)['then'](findById(_0x1e156a[_0x6826('0x19')]['id']))[_0x6826('0x8')](respondWithResult(_0xb458a2,null))[_0x6826('0xc')](handleError(_0xb458a2,null));};exports['smsQueues']=function(_0x4ecd2c,_0x2c788e){return respondWithRpcPromise(_0x6826('0x46'),_0x4ecd2c[_0x6826('0x18')],routingClient)[_0x6826('0x8')](respondWithResult(_0x2c788e,null))[_0x6826('0xc')](handleError(_0x2c788e,null));};exports[_0x6826('0x47')]=function(_0x33c420,_0x15fe3f){return respondWithRpcPromise('SmsQueues',_0x33c420['query'],routingClient)[_0x6826('0x8')](findById(_0x33c420[_0x6826('0x19')]['id']))[_0x6826('0x8')](respondWithResult(_0x15fe3f,null))['catch'](handleError(_0x15fe3f,null));};exports[_0x6826('0x48')]=function(_0x10c6aa,_0x23978f){return respondWithRpcPromise('WhatsappQueues',_0x10c6aa[_0x6826('0x18')],routingClient)['then'](respondWithResult(_0x23978f,null))[_0x6826('0xc')](handleError(_0x23978f,null));};exports[_0x6826('0x49')]=function(_0x3959f3,_0x2b90da){return respondWithRpcPromise(_0x6826('0x4a'),_0x3959f3[_0x6826('0x18')],routingClient)[_0x6826('0x8')](findById(_0x3959f3[_0x6826('0x19')]['id']))['then'](respondWithResult(_0x2b90da,null))[_0x6826('0xc')](handleError(_0x2b90da,null));};exports[_0x6826('0x4b')]=function(_0x2b60fc,_0x53f914){return respondWithRpcPromise(_0x6826('0x4c'),_0x2b60fc[_0x6826('0x18')],routingClient)[_0x6826('0x8')](respondWithResult(_0x53f914,null))[_0x6826('0xc')](handleError(_0x53f914,null));};exports[_0x6826('0x4d')]=function(_0x12f580,_0x13c7e9){return respondWithRpcPromise('FaxQueues',_0x12f580[_0x6826('0x18')],routingClient)[_0x6826('0x8')](findById(_0x12f580[_0x6826('0x19')]['id']))['then'](respondWithResult(_0x13c7e9,null))[_0x6826('0xc')](handleError(_0x13c7e9,null));};exports['faxAccounts']=function(_0x55f5eb,_0x3cdd39){return respondWithRpcPromise(_0x6826('0x4e'),_0x55f5eb[_0x6826('0x18')])[_0x6826('0x8')](respondWithResult(_0x3cdd39,null))[_0x6826('0xc')](handleError(_0x3cdd39,null));};exports[_0x6826('0x4f')]=function(_0x235776,_0x47b061){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x235776[_0x6826('0x18')],routingClient)['then'](respondWithResult(_0x47b061,null))[_0x6826('0xc')](handleError(_0x47b061,null));};exports[_0x6826('0x50')]=function(_0x5ed803,_0x457d70){return respondWithRpcPromise(_0x6826('0x51'),_0x5ed803[_0x6826('0x18')],routingClient)['then'](respondWithResult(_0x457d70,null))[_0x6826('0xc')](handleError(_0x457d70,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x1236eb,_0x40b3c8){return respondWithRpcPromise(_0x6826('0x52'),_0x1236eb[_0x6826('0x18')],routingClient)[_0x6826('0x8')](respondWithResult(_0x40b3c8,null))[_0x6826('0xc')](handleError(_0x40b3c8,null));};exports[_0x6826('0x53')]=function(_0x5d1962,_0x296ab7){return respondWithRpcPromise(_0x6826('0x52'),_0x5d1962[_0x6826('0x18')],routingClient)[_0x6826('0x8')](function(_0x1416bf){if(_0x5d1962[_0x6826('0x18')][_0x6826('0x54')]!==undefined){var _0x45f3b0=_(_0x1416bf[_0x6826('0x13')])['filter']([_0x5d1962[_0x6826('0x18')][_0x6826('0x54')],_0x5d1962[_0x6826('0x19')]['id']])[_0x6826('0x55')](_0x6826('0x56'))[_0x6826('0x57')]()['value']();return _0x1416bf[_0x6826('0x13')][_0x6826('0x58')](function(_0x858db1){return _0x45f3b0['indexOf'](_0x858db1[_0x6826('0x56')])>-0x1;});}else{return _0x1416bf['rows'][_0x6826('0x58')](function(_0x20001e){return _0x20001e[_0x6826('0x56')]===parseInt(_0x5d1962['params']['id']);});}})[_0x6826('0x8')](respondWithResult(_0x296ab7,null))[_0x6826('0xc')](handleError(_0x296ab7,null));};exports[_0x6826('0x59')]=function(_0x519e02,_0x31cc66){return respondWithRpcPromise(_0x6826('0x5a'),_0x519e02['query'],routingClient)[_0x6826('0x8')](respondWithResult(_0x31cc66,null))[_0x6826('0xc')](handleError(_0x31cc66,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x500644,_0x30715e){return respondWithRpcPromise(_0x6826('0x5b'),_0x500644[_0x6826('0x18')],routingClient)['then'](respondWithResult(_0x30715e,null))[_0x6826('0xc')](handleError(_0x30715e,null));};exports[_0x6826('0x5c')]=function(_0x162722,_0x19915d){return respondWithRpcPromise(_0x6826('0x5d'),_0x162722['query'],routingClient)[_0x6826('0x8')](respondWithResult(_0x19915d,null))[_0x6826('0xc')](handleError(_0x19915d,null));};exports[_0x6826('0x5e')]=function(_0x3c40ac){return function(_0x357e20,_0x28005e){var _0x43d03a,_0x316556;var _0x387bf3=_['capitalize'](_0x3c40ac);var _0x59738a=_0x3c40ac==='chat'?_0x6826('0x5f'):_0x6826('0x60');return db[_0x387bf3+_0x6826('0x61')][_0x6826('0x62')]({'raw':!![],'where':{'id':_0x357e20[_0x6826('0x19')]['id']}})[_0x6826('0x8')](function(_0x20f76f){if(_[_0x6826('0x12')](_0x20f76f)){throw new Error(_0x387bf3+_0x6826('0x63'));}_0x43d03a=_0x20f76f;return db[_0x387bf3+'Message'][_0x6826('0x62')]({'where':{'id':_0x357e20[_0x6826('0x1d')][_0x6826('0x64')]},'include':[{'model':db[_0x387bf3+'Interaction'],'as':_0x6826('0x65')},{'model':db[_0x387bf3+_0x59738a],'as':'Account'}]});})['then'](function(_0x3aef57){if(_[_0x6826('0x12')](_0x3aef57)){throw new Error(_0x387bf3+'\x20Message\x20not\x20found');}_0x316556=_0x3aef57;return _0x3aef57[_0x6826('0x66')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6826('0x8')](function(){var _0xea4283={'uniqueid':_0x3c40ac+'.'+_0x316556['id']+'.'+_0x316556[_0x6826('0x65')]['id'],'FromUserId':_0x357e20[_0x6826('0x2b')]['id'],'type':_0x6826('0x67')};_0xea4283[_0x387bf3+_0x6826('0x68')]=_0x316556['id'];_0xea4283[_0x387bf3+_0x6826('0x69')]=_0x316556['Interaction']['id'];_0xea4283['From'+_0x387bf3+_0x59738a+'Id']=_0x316556[_0x6826('0x60')]['id'];_0xea4283['To'+_0x387bf3+_0x6826('0x6a')]=_0x43d03a['id'];return db[_0x387bf3+_0x6826('0x6b')][_0x6826('0x6c')](_0xea4283);})[_0x6826('0x8')](function(){return respondWithRpcPromise(_0x6826('0x6d'),{'channel':_0x3c40ac,'interaction':_0x316556[_0x6826('0x65')],'message':_0x316556,'account':_0x316556['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x43d03a['name']+','+(_0x316556[_0x6826('0x60')][_0x6826('0x6e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x6826('0x8')](respondWithResult(_0x28005e,null))['catch'](handleError(_0x28005e,null));};};exports[_0x6826('0x6f')]=function(_0x523d34,_0x5c48fa){var _0x4d2ab4,_0x3edd85;if(_[_0x6826('0x12')](_0x523d34[_0x6826('0x1d')][_0x6826('0x70')])){throw new Error(_0x6826('0x71'));}var _0x25b5fa=_0x523d34[_0x6826('0x1d')][_0x6826('0x70')];var _0x5cf82d=_[_0x6826('0x72')](_0x25b5fa);var _0x2c50e2=_0x25b5fa===_0x6826('0x73')?'Website':'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x523d34['params']['id'],'role':'agent'}})[_0x6826('0x8')](function(_0x45117b){if(_[_0x6826('0x12')](_0x45117b)){throw new Error('Agent\x20not\x20found');}_0x4d2ab4=_0x45117b;return db[_0x5cf82d+_0x6826('0x74')][_0x6826('0x62')]({'where':{'id':_0x523d34['body'][_0x6826('0x64')]},'include':[{'model':db[_0x5cf82d+'Interaction'],'as':_0x6826('0x65')},{'model':db[_0x5cf82d+_0x2c50e2],'as':'Account'}]});})[_0x6826('0x8')](function(_0x198d57){if(_['isNil'](_0x198d57)){throw new Error(_0x5cf82d+_0x6826('0x75'));}_0x3edd85=_0x198d57;return _0x198d57[_0x6826('0x66')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x73db6e={'uniqueid':_0x25b5fa+'.'+_0x3edd85['id']+'.'+_0x3edd85['Interaction']['id'],'FromUserId':_0x523d34['user']['id'],'type':_0x6826('0x67'),'ToUserId':_0x4d2ab4['id']};_0x73db6e[_0x5cf82d+'MessageId']=_0x3edd85['id'];_0x73db6e[_0x5cf82d+_0x6826('0x69')]=_0x3edd85[_0x6826('0x65')]['id'];_0x73db6e[_0x6826('0x76')+_0x5cf82d+_0x2c50e2+'Id']=_0x3edd85[_0x6826('0x60')]['id'];return db[_0x5cf82d+'TransferReport'][_0x6826('0x6c')](_0x73db6e);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x25b5fa,'interaction':_0x3edd85[_0x6826('0x65')],'message':_0x3edd85,'account':_0x3edd85[_0x6826('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6826('0x34'),'appdata':_0x4d2ab4[_0x6826('0x11')]+','+(_0x3edd85[_0x6826('0x60')][_0x6826('0x77')]||0x12c),'interval':_0x6826('0x78')}]},routingClient);})['then'](respondWithResult(_0x5c48fa,null))[_0x6826('0xc')](handleError(_0x5c48fa,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0497217..5f14f99 100644 --- a/server/api/schedule/index.js +++ b/server/api/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf690=['get','isAuthenticated','index','show','/:id/run','put','update','delete','/:id','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x1c2fd7,_0x595cf1){var _0x369e9d=function(_0x12d274){while(--_0x12d274){_0x1c2fd7['push'](_0x1c2fd7['shift']());}};_0x369e9d(++_0x595cf1);}(_0xf690,0x129));var _0x0f69=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0xf690[_0x3c2b2e];return _0x27a338;};'use strict';var multer=require(_0x0f69('0x0'));var util=require('util');var path=require(_0x0f69('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f69('0x2'));var router=express[_0x0f69('0x3')]();var fs_extra=require(_0x0f69('0x4'));var auth=require(_0x0f69('0x5'));var interaction=require(_0x0f69('0x6'));var config=require(_0x0f69('0x7'));var controller=require(_0x0f69('0x8'));router[_0x0f69('0x9')]('/',auth[_0x0f69('0xa')](),controller[_0x0f69('0xb')]);router[_0x0f69('0x9')]('/:id',auth[_0x0f69('0xa')](),controller[_0x0f69('0xc')]);router['get'](_0x0f69('0xd'),auth[_0x0f69('0xa')](),controller['run']);router['post']('/',auth[_0x0f69('0xa')](),controller['create']);router[_0x0f69('0xe')]('/:id',auth[_0x0f69('0xa')](),controller[_0x0f69('0xf')]);router[_0x0f69('0x10')](_0x0f69('0x11'),auth[_0x0f69('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x558d=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','index','get','/:id','isAuthenticated','show','/:id/run','post','put','delete','exports','multer','util','path'];(function(_0x35fc22,_0x536be8){var _0x563d1c=function(_0x35a379){while(--_0x35a379){_0x35fc22['push'](_0x35fc22['shift']());}};_0x563d1c(++_0x536be8);}(_0x558d,0x1d8));var _0xd558=function(_0x4d763d,_0x2e9bec){_0x4d763d=_0x4d763d-0x0;var _0x3e74b7=_0x558d[_0x4d763d];return _0x3e74b7;};'use strict';var multer=require(_0xd558('0x0'));var util=require(_0xd558('0x1'));var path=require(_0xd558('0x2'));var timeout=require(_0xd558('0x3'));var express=require('express');var router=express[_0xd558('0x4')]();var fs_extra=require(_0xd558('0x5'));var auth=require(_0xd558('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd558('0x7'));var controller=require(_0xd558('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd558('0x9')]);router[_0xd558('0xa')](_0xd558('0xb'),auth[_0xd558('0xc')](),controller[_0xd558('0xd')]);router[_0xd558('0xa')](_0xd558('0xe'),auth[_0xd558('0xc')](),controller['run']);router[_0xd558('0xf')]('/',auth[_0xd558('0xc')](),controller['create']);router[_0xd558('0x10')](_0xd558('0xb'),auth[_0xd558('0xc')](),controller['update']);router[_0xd558('0x11')](_0xd558('0xb'),auth[_0xd558('0xc')](),controller['destroy']);module[_0xd558('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c46c927..88e867d 100644 --- a/server/api/schedule/schedule.attributes.js +++ b/server/api/schedule/schedule.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2975=['quarters','months','weeks','days','hours','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','ENUM','years'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2975,0x1c5));var _0x5297=function(_0x4f0b73,_0x2253e4){_0x4f0b73=_0x4f0b73-0x0;var _0x3599a2=_0x2975[_0x4f0b73];return _0x3599a2;};'use strict';var Sequelize=require('sequelize');module[_0x5297('0x0')]={'name':{'type':Sequelize[_0x5297('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5297('0x1')]},'active':{'type':Sequelize[_0x5297('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5297('0x1')],'allowNull':![],'defaultValue':_0x5297('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5297('0x4')](_0x5297('0x5'),_0x5297('0x6'),_0x5297('0x7'),_0x5297('0x8'),_0x5297('0x9'),_0x5297('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x5297('0x9')},'output':{'type':Sequelize[_0x5297('0x4')](_0x5297('0xb'),_0x5297('0xc'),_0x5297('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x5297('0x4')](_0x5297('0xe'),_0x5297('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x5297('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x5297('0x1')]},'cc':{'type':Sequelize[_0x5297('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x5297('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x37cc=['weeks','days','hours','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x37cc,0x185));var _0xc37c=function(_0x4b213d,_0x459067){_0x4b213d=_0x4b213d-0x0;var _0x37dd76=_0x37cc[_0x4b213d];return _0x37dd76;};'use strict';var Sequelize=require(_0xc37c('0x0'));module[_0xc37c('0x1')]={'name':{'type':Sequelize[_0xc37c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc37c('0x2')]},'active':{'type':Sequelize[_0xc37c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc37c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xc37c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc37c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc37c('0x6')](_0xc37c('0x7'),_0xc37c('0x8'),_0xc37c('0x9'),_0xc37c('0xa'),_0xc37c('0xb'),_0xc37c('0xc'),'minutes'),'allowNull':![],'defaultValue':_0xc37c('0xb')},'output':{'type':Sequelize[_0xc37c('0x6')](_0xc37c('0xd'),_0xc37c('0xe'),_0xc37c('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xc37c('0x6')](_0xc37c('0x10'),_0xc37c('0x11')),'allowNull':![],'defaultValue':_0xc37c('0x10')},'sendMail':{'type':Sequelize[_0xc37c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc37c('0x2')]},'cc':{'type':Sequelize[_0xc37c('0x12')]},'bcc':{'type':Sequelize[_0xc37c('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xc37c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 49e30f3..0bb041c 100644 --- a/server/api/schedule/schedule.controller.js +++ b/server/api/schedule/schedule.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x335c=['send','merge','body','contact','agent','interaction','map','Schedule','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','get','end','error','name'];(function(_0x18bfc3,_0x2c7923){var _0x2d28c2=function(_0x348788){while(--_0x348788){_0x18bfc3['push'](_0x18bfc3['shift']());}};_0x2d28c2(++_0x2c7923);}(_0x335c,0x1d3));var _0xc335=function(_0x2b26b1,_0x121949){_0x2b26b1=_0x2b26b1-0x0;var _0x19acbd=_0x335c[_0x2b26b1];return _0x19acbd;};'use strict';var emlformat=require(_0xc335('0x0'));var rimraf=require(_0xc335('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc335('0x2'));var rp=require(_0xc335('0x3'));var moment=require(_0xc335('0x4'));var BPromise=require(_0xc335('0x5'));var Mustache=require('mustache');var util=require(_0xc335('0x6'));var path=require(_0xc335('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc335('0x8'));var fs=require('fs');var fs_extra=require(_0xc335('0x9'));var _=require(_0xc335('0xa'));var squel=require(_0xc335('0xb'));var crypto=require('crypto');var jsforce=require(_0xc335('0xc'));var deskjs=require(_0xc335('0xd'));var toCsv=require(_0xc335('0xe'));var querystring=require(_0xc335('0xf'));var Papa=require(_0xc335('0x10'));var Redis=require(_0xc335('0x11'));var authService=require(_0xc335('0x12'));var qs=require(_0xc335('0x13'));var as=require(_0xc335('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc335('0x15'))(_0xc335('0x16'));var utils=require(_0xc335('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc335('0x18'));var db=require(_0xc335('0x19'))['db'];function respondWithStatusCode(_0x2c6037,_0x3c7f9d){_0x3c7f9d=_0x3c7f9d||0xcc;return function(_0x9e6e7a){if(_0x9e6e7a){return _0x2c6037[_0xc335('0x1a')](_0x3c7f9d);}return _0x2c6037[_0xc335('0x1b')](_0x3c7f9d)['end']();};}function respondWithResult(_0xeb107,_0x21989f){_0x21989f=_0x21989f||0xc8;return function(_0x1aaf0c){if(_0x1aaf0c){return _0xeb107[_0xc335('0x1b')](_0x21989f)[_0xc335('0x1c')](_0x1aaf0c);}};}function respondWithFilteredResult(_0x27381b,_0x3e896d){return function(_0x13763f){if(_0x13763f){var _0x225ae4=typeof _0x3e896d['offset']==='undefined'&&typeof _0x3e896d[_0xc335('0x1d')]===_0xc335('0x1e');var _0x3037d8=_0x13763f[_0xc335('0x1f')];var _0x580f04=_0x225ae4?0x0:_0x3e896d[_0xc335('0x20')];var _0x3f8741=_0x225ae4?_0x13763f[_0xc335('0x1f')]:_0x3e896d[_0xc335('0x20')]+_0x3e896d[_0xc335('0x1d')];var _0x36fe17;if(_0x3f8741>=_0x3037d8){_0x3f8741=_0x3037d8;_0x36fe17=0xc8;}else{_0x36fe17=0xce;}_0x27381b[_0xc335('0x1b')](_0x36fe17);return _0x27381b[_0xc335('0x21')](_0xc335('0x22'),_0x580f04+'-'+_0x3f8741+'/'+_0x3037d8)['json'](_0x13763f);}return null;};}function patchUpdates(_0xdf3f94){return function(_0xa43a56){try{jsonpatch['apply'](_0xa43a56,_0xdf3f94,!![]);}catch(_0x2b810e){return BPromise['reject'](_0x2b810e);}return _0xa43a56[_0xc335('0x23')]();};}function saveUpdates(_0xed8577,_0x3f83df){return function(_0x24be9f){if(_0x24be9f){return _0x24be9f[_0xc335('0x24')](_0xed8577)[_0xc335('0x25')](function(_0x581aa4){return _0x581aa4;});}return null;};}function removeEntity(_0x5c11cf,_0x54bee3){return function(_0x56acb5){if(_0x56acb5){return _0x56acb5[_0xc335('0x26')]()[_0xc335('0x25')](function(){var _0xbc1937=_0x56acb5[_0xc335('0x27')]({'plain':!![]});var _0x1f00b3='Scheduler';return db['UserProfileResource'][_0xc335('0x26')]({'where':{'type':_0x1f00b3,'resourceId':_0xbc1937['id']}})[_0xc335('0x25')](function(){return _0x56acb5;});})['then'](function(){_0x5c11cf[_0xc335('0x1b')](0xcc)[_0xc335('0x28')]();});}};}function handleEntityNotFound(_0xa963b0,_0x4494b1){return function(_0x302e21){if(!_0x302e21){_0xa963b0['sendStatus'](0x194);}return _0x302e21;};}function handleError(_0xc149d0,_0x16a699){_0x16a699=_0x16a699||0x1f4;return function(_0x316e91){logger[_0xc335('0x29')](_0x316e91['stack']);if(_0x316e91[_0xc335('0x2a')]){delete _0x316e91[_0xc335('0x2a')];}_0xc149d0['status'](_0x16a699)[_0xc335('0x2b')](_0x316e91);};}function getMustacheRender(_0x853cbb,_0x29f047){return Mustache['render'](_0x853cbb,_[_0xc335('0x2c')](_0x29f047[_0xc335('0x2d')],{'contact':_0x29f047[_0xc335('0x2e')],'message':_0x29f047['message'],'agent':_0x29f047[_0xc335('0x2f')],'interaction':_0x29f047[_0xc335('0x30')],'account':_0x29f047['account']}))||'';}exports['index']=function(_0x3929a4,_0x301b25){var _0x3631c5={},_0x57e20b={},_0x3019f2={'count':0x0,'rows':[]};var _0x16cf0b=_[_0xc335('0x31')](db[_0xc335('0x32')]['rawAttributes'],function(_0x3fb9a9){return{'name':_0x3fb9a9['fieldName'],'type':_0x3fb9a9[_0xc335('0x33')][_0xc335('0x34')]};});_0x57e20b[_0xc335('0x35')]=_[_0xc335('0x31')](_0x16cf0b,_0xc335('0x2a'));_0x57e20b[_0xc335('0x36')]=_['keys'](_0x3929a4['query']);_0x57e20b['filters']=_['intersection'](_0x57e20b[_0xc335('0x35')],_0x57e20b['query']);_0x3631c5['attributes']=_[_0xc335('0x37')](_0x57e20b[_0xc335('0x35')],qs[_0xc335('0x38')](_0x3929a4[_0xc335('0x36')][_0xc335('0x38')]));_0x3631c5[_0xc335('0x39')]=_0x3631c5[_0xc335('0x39')][_0xc335('0x3a')]?_0x3631c5[_0xc335('0x39')]:_0x57e20b[_0xc335('0x35')];if(!_0x3929a4['query']['hasOwnProperty'](_0xc335('0x3b'))){_0x3631c5[_0xc335('0x1d')]=qs[_0xc335('0x1d')](_0x3929a4[_0xc335('0x36')][_0xc335('0x1d')]);_0x3631c5['offset']=qs[_0xc335('0x20')](_0x3929a4['query'][_0xc335('0x20')]);}_0x3631c5[_0xc335('0x3c')]=qs[_0xc335('0x3d')](_0x3929a4['query'][_0xc335('0x3d')]);_0x3631c5[_0xc335('0x3e')]=qs['filters'](_[_0xc335('0x3f')](_0x3929a4[_0xc335('0x36')],_0x57e20b[_0xc335('0x40')]),_0x16cf0b);if(_0x3929a4[_0xc335('0x36')]['filter']){_0x3631c5[_0xc335('0x3e')]=_[_0xc335('0x2c')](_0x3631c5[_0xc335('0x3e')],{'$or':_[_0xc335('0x31')](_0x16cf0b,function(_0x4703d0){if(_0x4703d0['type']!==_0xc335('0x41')){var _0x4d7b92={};_0x4d7b92[_0x4703d0['name']]={'$like':'%'+_0x3929a4['query']['filter']+'%'};return _0x4d7b92;}})});}_0x3631c5=_['merge']({},_0x3631c5,_0x3929a4[_0xc335('0x42')]);var _0x5ccc2c={'where':_0x3631c5[_0xc335('0x3e')]};return db[_0xc335('0x32')][_0xc335('0x1f')](_0x5ccc2c)[_0xc335('0x25')](function(_0x425d8c){_0x3019f2[_0xc335('0x1f')]=_0x425d8c;if(_0x3929a4[_0xc335('0x36')][_0xc335('0x43')]){_0x3631c5[_0xc335('0x44')]=[{'all':!![]}];}return db[_0xc335('0x32')][_0xc335('0x45')](_0x3631c5);})[_0xc335('0x25')](function(_0x44573b){_0x3019f2[_0xc335('0x46')]=_0x44573b;return _0x3019f2;})[_0xc335('0x25')](respondWithFilteredResult(_0x301b25,_0x3631c5))[_0xc335('0x47')](handleError(_0x301b25,null));};exports[_0xc335('0x48')]=function(_0x4c107d,_0x15401a){var _0x15b350={'raw':![],'where':{'id':_0x4c107d['params']['id']}},_0x39872e={};_0x39872e['model']=_[_0xc335('0x49')](db[_0xc335('0x32')][_0xc335('0x4a')]);_0x39872e['query']=_['keys'](_0x4c107d[_0xc335('0x36')]);_0x39872e['filters']=_[_0xc335('0x37')](_0x39872e[_0xc335('0x35')],_0x39872e['query']);_0x15b350[_0xc335('0x39')]=_[_0xc335('0x37')](_0x39872e[_0xc335('0x35')],qs[_0xc335('0x38')](_0x4c107d[_0xc335('0x36')][_0xc335('0x38')]));_0x15b350[_0xc335('0x39')]=_0x15b350[_0xc335('0x39')][_0xc335('0x3a')]?_0x15b350[_0xc335('0x39')]:_0x39872e['model'];if(_0x4c107d[_0xc335('0x36')][_0xc335('0x43')]){_0x15b350[_0xc335('0x44')]=[{'all':!![]}];}_0x15b350=_[_0xc335('0x2c')]({},_0x15b350,_0x4c107d['options']);return db[_0xc335('0x32')][_0xc335('0x4b')](_0x15b350)[_0xc335('0x25')](handleEntityNotFound(_0x15401a,null))[_0xc335('0x25')](respondWithResult(_0x15401a,null))['catch'](handleError(_0x15401a,null));};exports['create']=function(_0x1962ad,_0x59200d){return db['Schedule'][_0xc335('0x4c')](_0x1962ad[_0xc335('0x2d')],{})[_0xc335('0x25')](function(_0x300d2b){var _0x4711ac=_0x1962ad['user'][_0xc335('0x27')]({'plain':!![]});if(!_0x4711ac)throw new Error(_0xc335('0x4d'));if(_0x4711ac[_0xc335('0x4e')]==='user'){var _0x545370=_0x300d2b['get']({'plain':!![]});var _0x29821f=_0xc335('0x4f');return db[_0xc335('0x50')][_0xc335('0x4b')]({'where':{'name':_0x29821f,'userProfileId':_0x4711ac[_0xc335('0x51')]},'raw':!![]})[_0xc335('0x25')](function(_0x2c7117){if(_0x2c7117&&_0x2c7117['autoAssociation']===0x0){return db[_0xc335('0x52')][_0xc335('0x4c')]({'name':_0x545370[_0xc335('0x2a')],'resourceId':_0x545370['id'],'type':_0x2c7117[_0xc335('0x2a')],'sectionId':_0x2c7117['id']},{})['then'](function(){return _0x300d2b;});}else{return _0x300d2b;}})[_0xc335('0x47')](function(_0x4aea1d){logger[_0xc335('0x29')](_0xc335('0x53'),_0x4aea1d);throw _0x4aea1d;});}return _0x300d2b;})[_0xc335('0x25')](respondWithResult(_0x59200d,0xc9))[_0xc335('0x47')](handleError(_0x59200d,null));};exports[_0xc335('0x24')]=function(_0x4137d2,_0x25fd47){if(_0x4137d2[_0xc335('0x2d')]['id']){delete _0x4137d2[_0xc335('0x2d')]['id'];}return db[_0xc335('0x32')]['find']({'where':{'id':_0x4137d2[_0xc335('0x54')]['id']}})['then'](handleEntityNotFound(_0x25fd47,null))[_0xc335('0x25')](saveUpdates(_0x4137d2[_0xc335('0x2d')],null))[_0xc335('0x25')](respondWithResult(_0x25fd47,null))[_0xc335('0x47')](handleError(_0x25fd47,null));};exports[_0xc335('0x26')]=function(_0x50c05d,_0x3a6251){return db[_0xc335('0x32')][_0xc335('0x4b')]({'where':{'id':_0x50c05d[_0xc335('0x54')]['id']}})[_0xc335('0x25')](handleEntityNotFound(_0x3a6251,null))['then'](removeEntity(_0x3a6251,null))[_0xc335('0x47')](handleError(_0x3a6251,null));};exports['run']=function(_0x5b6659,_0x2bed72,_0x417ba1){var _0x3d932e=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x5b6659[_0xc335('0x54')]['id']},'raw':!![]})[_0xc335('0x25')](handleEntityNotFound(_0x2bed72,null))[_0xc335('0x25')](function(){_0x3d932e['run'](_0x5b6659[_0xc335('0x54')]['id']);})['then'](respondWithStatusCode(_0x2bed72,null))[_0xc335('0x47')](handleError(_0x2bed72,null));}; \ No newline at end of file +var _0x1d86=['undefined','count','limit','set','Content-Range','apply','then','get','Scheduler','UserProfileResource','destroy','stack','name','send','render','merge','body','message','account','map','Schedule','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','update','run','eml-format','zip-dir','fast-json-patch','moment','mustache','util','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x597c52,_0x10f7e6){var _0x2cc484=function(_0x53d335){while(--_0x53d335){_0x597c52['push'](_0x597c52['shift']());}};_0x2cc484(++_0x10f7e6);}(_0x1d86,0x181));var _0x61d8=function(_0x18c082,_0x1c7abd){_0x18c082=_0x18c082-0x0;var _0x12f32d=_0x1d86[_0x18c082];return _0x12f32d;};'use strict';var emlformat=require(_0x61d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x61d8('0x1'));var jsonpatch=require(_0x61d8('0x2'));var rp=require('request-promise');var moment=require(_0x61d8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x61d8('0x4'));var util=require(_0x61d8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61d8('0x6'));var _=require('lodash');var squel=require(_0x61d8('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x61d8('0x8'));var toCsv=require(_0x61d8('0x9'));var querystring=require(_0x61d8('0xa'));var Papa=require(_0x61d8('0xb'));var Redis=require(_0x61d8('0xc'));var authService=require(_0x61d8('0xd'));var qs=require(_0x61d8('0xe'));var as=require(_0x61d8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61d8('0x10'))(_0x61d8('0x11'));var utils=require('../../config/utils');var config=require(_0x61d8('0x12'));var licenseUtil=require(_0x61d8('0x13'));var db=require(_0x61d8('0x14'))['db'];function respondWithStatusCode(_0x4da7a8,_0x189985){_0x189985=_0x189985||0xcc;return function(_0x2cb953){if(_0x2cb953){return _0x4da7a8['sendStatus'](_0x189985);}return _0x4da7a8[_0x61d8('0x15')](_0x189985)[_0x61d8('0x16')]();};}function respondWithResult(_0x1e8d07,_0x347a90){_0x347a90=_0x347a90||0xc8;return function(_0x38d34d){if(_0x38d34d){return _0x1e8d07[_0x61d8('0x15')](_0x347a90)[_0x61d8('0x17')](_0x38d34d);}};}function respondWithFilteredResult(_0xd7ab51,_0x2a750a){return function(_0x42a619){if(_0x42a619){var _0x2027db=typeof _0x2a750a[_0x61d8('0x18')]==='undefined'&&typeof _0x2a750a['limit']===_0x61d8('0x19');var _0x5ba782=_0x42a619[_0x61d8('0x1a')];var _0xe1fae5=_0x2027db?0x0:_0x2a750a['offset'];var _0x3379ed=_0x2027db?_0x42a619[_0x61d8('0x1a')]:_0x2a750a[_0x61d8('0x18')]+_0x2a750a[_0x61d8('0x1b')];var _0x4d38aa;if(_0x3379ed>=_0x5ba782){_0x3379ed=_0x5ba782;_0x4d38aa=0xc8;}else{_0x4d38aa=0xce;}_0xd7ab51[_0x61d8('0x15')](_0x4d38aa);return _0xd7ab51[_0x61d8('0x1c')](_0x61d8('0x1d'),_0xe1fae5+'-'+_0x3379ed+'/'+_0x5ba782)['json'](_0x42a619);}return null;};}function patchUpdates(_0x44aae9){return function(_0x3892c2){try{jsonpatch[_0x61d8('0x1e')](_0x3892c2,_0x44aae9,!![]);}catch(_0x3a8c42){return BPromise['reject'](_0x3a8c42);}return _0x3892c2['save']();};}function saveUpdates(_0x4874a2,_0xe63c55){return function(_0x3d5a6a){if(_0x3d5a6a){return _0x3d5a6a['update'](_0x4874a2)[_0x61d8('0x1f')](function(_0x126c7c){return _0x126c7c;});}return null;};}function removeEntity(_0x1eda2e,_0x3037ca){return function(_0xa64d39){if(_0xa64d39){return _0xa64d39['destroy']()[_0x61d8('0x1f')](function(){var _0x39c34f=_0xa64d39[_0x61d8('0x20')]({'plain':!![]});var _0x3848f6=_0x61d8('0x21');return db[_0x61d8('0x22')][_0x61d8('0x23')]({'where':{'type':_0x3848f6,'resourceId':_0x39c34f['id']}})['then'](function(){return _0xa64d39;});})[_0x61d8('0x1f')](function(){_0x1eda2e[_0x61d8('0x15')](0xcc)[_0x61d8('0x16')]();});}};}function handleEntityNotFound(_0x543d70,_0x59ce37){return function(_0x15eea9){if(!_0x15eea9){_0x543d70['sendStatus'](0x194);}return _0x15eea9;};}function handleError(_0x203e60,_0xf2798b){_0xf2798b=_0xf2798b||0x1f4;return function(_0x27c9e3){logger['error'](_0x27c9e3[_0x61d8('0x24')]);if(_0x27c9e3[_0x61d8('0x25')]){delete _0x27c9e3[_0x61d8('0x25')];}_0x203e60['status'](_0xf2798b)[_0x61d8('0x26')](_0x27c9e3);};}function getMustacheRender(_0x5c30aa,_0x519bda){return Mustache[_0x61d8('0x27')](_0x5c30aa,_[_0x61d8('0x28')](_0x519bda[_0x61d8('0x29')],{'contact':_0x519bda['contact'],'message':_0x519bda[_0x61d8('0x2a')],'agent':_0x519bda['agent'],'interaction':_0x519bda['interaction'],'account':_0x519bda[_0x61d8('0x2b')]}))||'';}exports['index']=function(_0x747923,_0x181aea){var _0x4c3e2e={},_0x1a82b1={},_0x5a1a25={'count':0x0,'rows':[]};var _0x5e8701=_[_0x61d8('0x2c')](db[_0x61d8('0x2d')]['rawAttributes'],function(_0x468967){return{'name':_0x468967[_0x61d8('0x2e')],'type':_0x468967['type'][_0x61d8('0x2f')]};});_0x1a82b1[_0x61d8('0x30')]=_['map'](_0x5e8701,'name');_0x1a82b1['query']=_['keys'](_0x747923[_0x61d8('0x31')]);_0x1a82b1[_0x61d8('0x32')]=_[_0x61d8('0x33')](_0x1a82b1['model'],_0x1a82b1[_0x61d8('0x31')]);_0x4c3e2e[_0x61d8('0x34')]=_[_0x61d8('0x33')](_0x1a82b1['model'],qs['fields'](_0x747923[_0x61d8('0x31')][_0x61d8('0x35')]));_0x4c3e2e[_0x61d8('0x34')]=_0x4c3e2e[_0x61d8('0x34')][_0x61d8('0x36')]?_0x4c3e2e['attributes']:_0x1a82b1['model'];if(!_0x747923[_0x61d8('0x31')][_0x61d8('0x37')](_0x61d8('0x38'))){_0x4c3e2e[_0x61d8('0x1b')]=qs[_0x61d8('0x1b')](_0x747923[_0x61d8('0x31')][_0x61d8('0x1b')]);_0x4c3e2e[_0x61d8('0x18')]=qs[_0x61d8('0x18')](_0x747923[_0x61d8('0x31')][_0x61d8('0x18')]);}_0x4c3e2e[_0x61d8('0x39')]=qs['sort'](_0x747923['query'][_0x61d8('0x3a')]);_0x4c3e2e[_0x61d8('0x3b')]=qs[_0x61d8('0x32')](_[_0x61d8('0x3c')](_0x747923[_0x61d8('0x31')],_0x1a82b1[_0x61d8('0x32')]),_0x5e8701);if(_0x747923['query'][_0x61d8('0x3d')]){_0x4c3e2e[_0x61d8('0x3b')]=_[_0x61d8('0x28')](_0x4c3e2e['where'],{'$or':_[_0x61d8('0x2c')](_0x5e8701,function(_0x545be0){if(_0x545be0[_0x61d8('0x3e')]!==_0x61d8('0x3f')){var _0x3f398b={};_0x3f398b[_0x545be0[_0x61d8('0x25')]]={'$like':'%'+_0x747923[_0x61d8('0x31')][_0x61d8('0x3d')]+'%'};return _0x3f398b;}})});}_0x4c3e2e=_[_0x61d8('0x28')]({},_0x4c3e2e,_0x747923[_0x61d8('0x40')]);var _0x1aa116={'where':_0x4c3e2e['where']};return db[_0x61d8('0x2d')][_0x61d8('0x1a')](_0x1aa116)[_0x61d8('0x1f')](function(_0x5650a0){_0x5a1a25[_0x61d8('0x1a')]=_0x5650a0;if(_0x747923[_0x61d8('0x31')]['includeAll']){_0x4c3e2e[_0x61d8('0x41')]=[{'all':!![]}];}return db[_0x61d8('0x2d')]['findAll'](_0x4c3e2e);})[_0x61d8('0x1f')](function(_0x3e73f1){_0x5a1a25[_0x61d8('0x42')]=_0x3e73f1;return _0x5a1a25;})[_0x61d8('0x1f')](respondWithFilteredResult(_0x181aea,_0x4c3e2e))[_0x61d8('0x43')](handleError(_0x181aea,null));};exports[_0x61d8('0x44')]=function(_0x96ebb1,_0x15c6c9){var _0x2cff7b={'raw':![],'where':{'id':_0x96ebb1[_0x61d8('0x45')]['id']}},_0xaeaa30={};_0xaeaa30['model']=_[_0x61d8('0x46')](db[_0x61d8('0x2d')]['rawAttributes']);_0xaeaa30['query']=_['keys'](_0x96ebb1['query']);_0xaeaa30['filters']=_[_0x61d8('0x33')](_0xaeaa30[_0x61d8('0x30')],_0xaeaa30[_0x61d8('0x31')]);_0x2cff7b[_0x61d8('0x34')]=_[_0x61d8('0x33')](_0xaeaa30[_0x61d8('0x30')],qs[_0x61d8('0x35')](_0x96ebb1[_0x61d8('0x31')]['fields']));_0x2cff7b[_0x61d8('0x34')]=_0x2cff7b[_0x61d8('0x34')][_0x61d8('0x36')]?_0x2cff7b['attributes']:_0xaeaa30[_0x61d8('0x30')];if(_0x96ebb1[_0x61d8('0x31')][_0x61d8('0x47')]){_0x2cff7b[_0x61d8('0x41')]=[{'all':!![]}];}_0x2cff7b=_['merge']({},_0x2cff7b,_0x96ebb1[_0x61d8('0x40')]);return db['Schedule'][_0x61d8('0x48')](_0x2cff7b)[_0x61d8('0x1f')](handleEntityNotFound(_0x15c6c9,null))[_0x61d8('0x1f')](respondWithResult(_0x15c6c9,null))[_0x61d8('0x43')](handleError(_0x15c6c9,null));};exports[_0x61d8('0x49')]=function(_0x29ae9c,_0x1dbc75){return db[_0x61d8('0x2d')][_0x61d8('0x49')](_0x29ae9c[_0x61d8('0x29')],{})['then'](function(_0x1b62b6){var _0x1a1ebd=_0x29ae9c[_0x61d8('0x4a')]['get']({'plain':!![]});if(!_0x1a1ebd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a1ebd[_0x61d8('0x4b')]==='user'){var _0x15ae35=_0x1b62b6[_0x61d8('0x20')]({'plain':!![]});var _0x22b551=_0x61d8('0x21');return db[_0x61d8('0x4c')][_0x61d8('0x48')]({'where':{'name':_0x22b551,'userProfileId':_0x1a1ebd[_0x61d8('0x4d')]},'raw':!![]})[_0x61d8('0x1f')](function(_0x2acc21){if(_0x2acc21&&_0x2acc21[_0x61d8('0x4e')]===0x0){return db['UserProfileResource'][_0x61d8('0x49')]({'name':_0x15ae35['name'],'resourceId':_0x15ae35['id'],'type':_0x2acc21['name'],'sectionId':_0x2acc21['id']},{})[_0x61d8('0x1f')](function(){return _0x1b62b6;});}else{return _0x1b62b6;}})['catch'](function(_0xacda25){logger[_0x61d8('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xacda25);throw _0xacda25;});}return _0x1b62b6;})[_0x61d8('0x1f')](respondWithResult(_0x1dbc75,0xc9))['catch'](handleError(_0x1dbc75,null));};exports[_0x61d8('0x50')]=function(_0x2ba716,_0x33f441){if(_0x2ba716[_0x61d8('0x29')]['id']){delete _0x2ba716['body']['id'];}return db[_0x61d8('0x2d')]['find']({'where':{'id':_0x2ba716[_0x61d8('0x45')]['id']}})['then'](handleEntityNotFound(_0x33f441,null))[_0x61d8('0x1f')](saveUpdates(_0x2ba716['body'],null))[_0x61d8('0x1f')](respondWithResult(_0x33f441,null))[_0x61d8('0x43')](handleError(_0x33f441,null));};exports[_0x61d8('0x23')]=function(_0xeef612,_0x3353e4){return db['Schedule']['find']({'where':{'id':_0xeef612[_0x61d8('0x45')]['id']}})[_0x61d8('0x1f')](handleEntityNotFound(_0x3353e4,null))[_0x61d8('0x1f')](removeEntity(_0x3353e4,null))[_0x61d8('0x43')](handleError(_0x3353e4,null));};exports[_0x61d8('0x51')]=function(_0x36816c,_0xc06e95,_0x22b586){var _0xcd2a69=require('../../config/schedule');return db[_0x61d8('0x2d')][_0x61d8('0x48')]({'where':{'id':_0x36816c[_0x61d8('0x45')]['id']},'raw':!![]})[_0x61d8('0x1f')](handleEntityNotFound(_0xc06e95,null))['then'](function(){_0xcd2a69['run'](_0x36816c['params']['id']);})[_0x61d8('0x1f')](respondWithStatusCode(_0xc06e95,null))[_0x61d8('0x43')](handleError(_0xc06e95,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 324a950..c9c2052 100644 --- a/server/api/schedule/schedule.model.js +++ b/server/api/schedule/schedule.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c81=['util','../../config/logger','api','path','../../config/environment','./schedule.attributes','define','tools_schedules','lodash'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x3c81,0x1ca));var _0x13c8=function(_0x7acab0,_0x3a2404){_0x7acab0=_0x7acab0-0x0;var _0x1989f9=_0x3c81[_0x7acab0];return _0x1989f9;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require(_0x13c8('0x2'))(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13c8('0x4'));var rimraf=require('rimraf');var config=require(_0x13c8('0x5'));var attributes=require(_0x13c8('0x6'));module['exports']=function(_0x40b4d1,_0x52b11b){return _0x40b4d1[_0x13c8('0x7')]('Schedule',attributes,{'tableName':_0x13c8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x451e=['path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules','api','bluebird','request-promise'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0x451e,0x18d));var _0xe451=function(_0x534782,_0x345b19){_0x534782=_0x534782-0x0;var _0x2d879a=_0x451e[_0x534782];return _0x2d879a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe451('0x0'));var moment=require('moment');var BPromise=require(_0xe451('0x1'));var rp=require(_0xe451('0x2'));var fs=require('fs');var path=require(_0xe451('0x3'));var rimraf=require(_0xe451('0x4'));var config=require(_0xe451('0x5'));var attributes=require('./schedule.attributes');module[_0xe451('0x6')]=function(_0x42a409,_0x274792){return _0x42a409[_0xe451('0x7')](_0xe451('0x8'),attributes,{'tableName':_0xe451('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ddd133b..3afc6ba 100644 --- a/server/api/schedule/schedule.rpc.js +++ b/server/api/schedule/schedule.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9690=['info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x9690,0x16b));var _0x0969=function(_0xe8c84f,_0x16a059){_0xe8c84f=_0xe8c84f-0x0;var _0x250419=_0x9690[_0xe8c84f];return _0x250419;};'use strict';var _=require(_0x0969('0x0'));var util=require(_0x0969('0x1'));var moment=require(_0x0969('0x2'));var BPromise=require(_0x0969('0x3'));var rs=require(_0x0969('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0969('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0969('0x6'));var config=require('../../config/environment');var jayson=require(_0x0969('0x7'));var client=jayson[_0x0969('0x8')][_0x0969('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1014a0,_0x12d3ae,_0x56cadb){return new BPromise(function(_0x58dd62,_0x26e326){return client[_0x0969('0xa')](_0x1014a0,_0x56cadb)['then'](function(_0x260374){logger['info'](_0x0969('0xb'),_0x12d3ae,_0x0969('0xc'));logger[_0x0969('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x12d3ae,_0x0969('0xc'),JSON[_0x0969('0xe')](_0x260374));if(_0x260374[_0x0969('0xf')]){if(_0x260374['error']['code']===0x1f4){logger['error'](_0x0969('0xb'),_0x12d3ae,_0x260374[_0x0969('0xf')][_0x0969('0x10')]);return _0x26e326(_0x260374[_0x0969('0xf')][_0x0969('0x10')]);}logger[_0x0969('0xf')](_0x0969('0xb'),_0x12d3ae,_0x260374['error'][_0x0969('0x10')]);return _0x58dd62(_0x260374[_0x0969('0xf')][_0x0969('0x10')]);}else{logger[_0x0969('0x11')]('Schedule,\x20%s,\x20%s',_0x12d3ae,'request\x20sent');_0x58dd62(_0x260374[_0x0969('0x12')][_0x0969('0x10')]);}})[_0x0969('0x13')](function(_0x5d7366){logger[_0x0969('0xf')](_0x0969('0xb'),_0x12d3ae,_0x5d7366);_0x26e326(_0x5d7366);});});} \ No newline at end of file +var _0x3730=['../../config/utils','../../config/logger','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x3730,0x1c3));var _0x0373=function(_0x282c9f,_0x3d1b79){_0x282c9f=_0x282c9f-0x0;var _0x161e21=_0x3730[_0x282c9f];return _0x161e21;};'use strict';var _=require(_0x0373('0x0'));var util=require(_0x0373('0x1'));var moment=require(_0x0373('0x2'));var BPromise=require(_0x0373('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0373('0x5'));var logger=require(_0x0373('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0373('0x7'));var client=jayson['client'][_0x0373('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12c92f,_0x447040,_0x1f70bb){return new BPromise(function(_0x88f964,_0x2559b6){return client['request'](_0x12c92f,_0x1f70bb)[_0x0373('0x9')](function(_0x59d8b6){logger[_0x0373('0xa')](_0x0373('0xb'),_0x447040,_0x0373('0xc'));logger[_0x0373('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x447040,_0x0373('0xc'),JSON[_0x0373('0xe')](_0x59d8b6));if(_0x59d8b6['error']){if(_0x59d8b6['error'][_0x0373('0xf')]===0x1f4){logger[_0x0373('0x10')]('Schedule,\x20%s,\x20%s',_0x447040,_0x59d8b6[_0x0373('0x10')][_0x0373('0x11')]);return _0x2559b6(_0x59d8b6[_0x0373('0x10')]['message']);}logger['error'](_0x0373('0xb'),_0x447040,_0x59d8b6[_0x0373('0x10')]['message']);return _0x88f964(_0x59d8b6[_0x0373('0x10')][_0x0373('0x11')]);}else{logger[_0x0373('0xa')](_0x0373('0xb'),_0x447040,'request\x20sent');_0x88f964(_0x59d8b6[_0x0373('0x12')]['message']);}})['catch'](function(_0x89eeff){logger[_0x0373('0x10')]('Schedule,\x20%s,\x20%s',_0x447040,_0x89eeff);_0x2559b6(_0x89eeff);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fc97183..504111a 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f87=['get','index','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x1c0505,_0x534a38){var _0x6fbc71=function(_0x21a13d){while(--_0x21a13d){_0x1c0505['push'](_0x1c0505['shift']());}};_0x6fbc71(++_0x534a38);}(_0x9f87,0x157));var _0x79f8=function(_0x235035,_0x5f06b5){_0x235035=_0x235035-0x0;var _0x318970=_0x9f87[_0x235035];return _0x318970;};'use strict';var multer=require(_0x79f8('0x0'));var util=require(_0x79f8('0x1'));var path=require('path');var timeout=require(_0x79f8('0x2'));var express=require(_0x79f8('0x3'));var router=express['Router']();var fs_extra=require(_0x79f8('0x4'));var auth=require(_0x79f8('0x5'));var interaction=require(_0x79f8('0x6'));var config=require(_0x79f8('0x7'));var controller=require(_0x79f8('0x8'));router[_0x79f8('0x9')]('/',auth['isAuthenticated'](),controller[_0x79f8('0xa')]);router[_0x79f8('0x9')]('/describe',auth[_0x79f8('0xb')](),controller[_0x79f8('0xc')]);router[_0x79f8('0x9')](_0x79f8('0xd'),auth[_0x79f8('0xb')](),controller[_0x79f8('0xe')]);router[_0x79f8('0x9')](_0x79f8('0xf'),auth[_0x79f8('0xb')](),controller[_0x79f8('0x10')]);router[_0x79f8('0x11')]('/',auth[_0x79f8('0xb')](),controller[_0x79f8('0x12')]);router[_0x79f8('0x13')](_0x79f8('0xd'),auth[_0x79f8('0xb')](),controller['update']);router['delete'](_0x79f8('0xd'),auth[_0x79f8('0xb')](),controller[_0x79f8('0x14')]);module[_0x79f8('0x15')]=router; \ No newline at end of file +var _0x8ba4=['/:id','show','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated'];(function(_0x14ba61,_0x2536fd){var _0x3ba92c=function(_0x419180){while(--_0x419180){_0x14ba61['push'](_0x14ba61['shift']());}};_0x3ba92c(++_0x2536fd);}(_0x8ba4,0x1e9));var _0x48ba=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0x8ba4[_0x36cff7];return _0x21c697;};'use strict';var multer=require(_0x48ba('0x0'));var util=require(_0x48ba('0x1'));var path=require(_0x48ba('0x2'));var timeout=require(_0x48ba('0x3'));var express=require(_0x48ba('0x4'));var router=express[_0x48ba('0x5')]();var fs_extra=require(_0x48ba('0x6'));var auth=require(_0x48ba('0x7'));var interaction=require(_0x48ba('0x8'));var config=require(_0x48ba('0x9'));var controller=require(_0x48ba('0xa'));router[_0x48ba('0xb')]('/',auth['isAuthenticated'](),controller[_0x48ba('0xc')]);router[_0x48ba('0xb')](_0x48ba('0xd'),auth[_0x48ba('0xe')](),controller['describe']);router[_0x48ba('0xb')](_0x48ba('0xf'),auth[_0x48ba('0xe')](),controller[_0x48ba('0x10')]);router[_0x48ba('0xb')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x48ba('0xe')](),controller[_0x48ba('0x11')]);router[_0x48ba('0x12')](_0x48ba('0xf'),auth[_0x48ba('0xe')](),controller['update']);router[_0x48ba('0x13')]('/:id',auth[_0x48ba('0xe')](),controller['destroy']);module[_0x48ba('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1b45928..f7fcbf1 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a19=['VIRTUAL','getDataValue','value','extname','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports'];(function(_0x51f84a,_0x445f17){var _0x4ba63d=function(_0x5c8b6c){while(--_0x5c8b6c){_0x51f84a['push'](_0x51f84a['shift']());}};_0x4ba63d(++_0x445f17);}(_0x9a19,0x114));var _0x99a1=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9a19[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x99a1('0x0'));var moment=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var config=require('../../config/environment');module[_0x99a1('0x3')]={'format':{'type':Sequelize[_0x99a1('0x4')],'get':function(){return this[_0x99a1('0x5')](_0x99a1('0x6'))?path[_0x99a1('0x7')](this[_0x99a1('0x5')](_0x99a1('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x99a1('0x8')]},'channel':{'type':Sequelize[_0x99a1('0x8')]},'value':{'type':Sequelize[_0x99a1('0x8')],'set':function(_0x65045d){var _0x523b9e=_0x65045d['replace'](/\\/g,'/');this['setDataValue'](_0x99a1('0x6'),_0x523b9e);}},'rating':{'type':Sequelize[_0x99a1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5874fc){this[_0x99a1('0xa')](_0x99a1('0xb'),moment()[_0x99a1('0xc')](_0x5874fc,'ms'));this[_0x99a1('0xa')](_0x99a1('0xd'),moment());this['setDataValue'](_0x99a1('0xe'),_0x5874fc);}},'startedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xb')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'closedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0xd')))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'createdAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')]('createdAt'))[_0x99a1('0x10')](_0x99a1('0x11'))[_0x99a1('0x12')]();}},'updatedAt':{'type':Sequelize[_0x99a1('0xf')],'get':function(){return moment(this[_0x99a1('0x5')](_0x99a1('0x13')))[_0x99a1('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xae24=['value','STRING','setDataValue','subtract','closedAt','DATE','getDataValue','startedAt','MM-DD-YYYY\x20HH:mm','toString','format','updatedAt','sequelize','path','exports','VIRTUAL','extname'];(function(_0x3c36a6,_0x594d9e){var _0x267290=function(_0x160f79){while(--_0x160f79){_0x3c36a6['push'](_0x3c36a6['shift']());}};_0x267290(++_0x594d9e);}(_0xae24,0x182));var _0x4ae2=function(_0x27dd48,_0x4c7640){_0x27dd48=_0x27dd48-0x0;var _0x2288f4=_0xae24[_0x27dd48];return _0x2288f4;};'use strict';var Sequelize=require(_0x4ae2('0x0'));var moment=require('moment');var path=require(_0x4ae2('0x1'));var config=require('../../config/environment');module[_0x4ae2('0x2')]={'format':{'type':Sequelize[_0x4ae2('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x4ae2('0x4')](this['getDataValue'](_0x4ae2('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4ae2('0x6')]},'channel':{'type':Sequelize[_0x4ae2('0x6')]},'value':{'type':Sequelize[_0x4ae2('0x6')],'set':function(_0x428054){var _0x307247=_0x428054['replace'](/\\/g,'/');this['setDataValue'](_0x4ae2('0x5'),_0x307247);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xb5587a){this[_0x4ae2('0x7')]('startedAt',moment()[_0x4ae2('0x8')](_0xb5587a,'ms'));this[_0x4ae2('0x7')](_0x4ae2('0x9'),moment());this[_0x4ae2('0x7')]('duration',_0xb5587a);}},'startedAt':{'type':Sequelize[_0x4ae2('0xa')],'get':function(){return moment(this[_0x4ae2('0xb')](_0x4ae2('0xc')))['format'](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}},'closedAt':{'type':Sequelize[_0x4ae2('0xa')],'get':function(){return moment(this[_0x4ae2('0xb')](_0x4ae2('0x9')))[_0x4ae2('0xf')](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}},'createdAt':{'type':Sequelize[_0x4ae2('0xa')],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4ae2('0xb')](_0x4ae2('0x10')))[_0x4ae2('0xf')](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a5f78b9..39a913e 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x336f=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','apply','update','then','destroy','sendStatus','stack','name','render','merge','body','contact','agent','interaction','account','index','map','ScreenRecording','rawAttributes','fieldName','model','differenceBy','format','query','keys','filters','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x336f,0x176));var _0xf336=function(_0x4ee80d,_0x28a619){_0x4ee80d=_0x4ee80d-0x0;var _0x183cda=_0x336f[_0x4ee80d];return _0x183cda;};'use strict';var emlformat=require(_0xf336('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf336('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf336('0x2'));var Mustache=require(_0xf336('0x3'));var util=require(_0xf336('0x4'));var path=require('path');var sox=require(_0xf336('0x5'));var csv=require('to-csv');var ejs=require(_0xf336('0x6'));var fs=require('fs');var fs_extra=require(_0xf336('0x7'));var _=require(_0xf336('0x8'));var squel=require(_0xf336('0x9'));var crypto=require('crypto');var jsforce=require(_0xf336('0xa'));var deskjs=require(_0xf336('0xb'));var toCsv=require(_0xf336('0xc'));var querystring=require(_0xf336('0xd'));var Papa=require('papaparse');var Redis=require(_0xf336('0xe'));var authService=require(_0xf336('0xf'));var qs=require(_0xf336('0x10'));var as=require(_0xf336('0x11'));var hardwareService=require(_0xf336('0x12'));var logger=require(_0xf336('0x13'))(_0xf336('0x14'));var utils=require(_0xf336('0x15'));var config=require(_0xf336('0x16'));var licenseUtil=require(_0xf336('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259629,_0xbdee9c){_0xbdee9c=_0xbdee9c||0xcc;return function(_0x5bc89b){if(_0x5bc89b){return _0x259629['sendStatus'](_0xbdee9c);}return _0x259629[_0xf336('0x18')](_0xbdee9c)[_0xf336('0x19')]();};}function respondWithResult(_0xabaa74,_0x4dcac2){_0x4dcac2=_0x4dcac2||0xc8;return function(_0x1790f0){if(_0x1790f0){return _0xabaa74[_0xf336('0x18')](_0x4dcac2)[_0xf336('0x1a')](_0x1790f0);}};}function respondWithFilteredResult(_0x5b9223,_0x56b4a1){return function(_0x12d28e){if(_0x12d28e){var _0x446ff9=typeof _0x56b4a1[_0xf336('0x1b')]===_0xf336('0x1c')&&typeof _0x56b4a1[_0xf336('0x1d')]===_0xf336('0x1c');var _0x22a25e=_0x12d28e[_0xf336('0x1e')];var _0x258a0e=_0x446ff9?0x0:_0x56b4a1['offset'];var _0x5dee3e=_0x446ff9?_0x12d28e['count']:_0x56b4a1[_0xf336('0x1b')]+_0x56b4a1[_0xf336('0x1d')];var _0x120989;if(_0x5dee3e>=_0x22a25e){_0x5dee3e=_0x22a25e;_0x120989=0xc8;}else{_0x120989=0xce;}_0x5b9223['status'](_0x120989);return _0x5b9223['set']('Content-Range',_0x258a0e+'-'+_0x5dee3e+'/'+_0x22a25e)[_0xf336('0x1a')](_0x12d28e);}return null;};}function patchUpdates(_0x4e5ac0){return function(_0x353b8a){try{jsonpatch[_0xf336('0x1f')](_0x353b8a,_0x4e5ac0,!![]);}catch(_0x11e4ad){return BPromise['reject'](_0x11e4ad);}return _0x353b8a['save']();};}function saveUpdates(_0xfde7c5,_0x2c3a94){return function(_0x574fa7){if(_0x574fa7){return _0x574fa7[_0xf336('0x20')](_0xfde7c5)[_0xf336('0x21')](function(_0x719ebb){return _0x719ebb;});}return null;};}function removeEntity(_0x129d03,_0x14652a){return function(_0x308fb6){if(_0x308fb6){return _0x308fb6[_0xf336('0x22')]()['then'](function(){_0x129d03[_0xf336('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49329d,_0x217744){return function(_0x443bc8){if(!_0x443bc8){_0x49329d[_0xf336('0x23')](0x194);}return _0x443bc8;};}function handleError(_0x4b7d11,_0x1d1257){_0x1d1257=_0x1d1257||0x1f4;return function(_0x3a1119){logger['error'](_0x3a1119[_0xf336('0x24')]);if(_0x3a1119[_0xf336('0x25')]){delete _0x3a1119['name'];}_0x4b7d11[_0xf336('0x18')](_0x1d1257)['send'](_0x3a1119);};}function getMustacheRender(_0x22afc0,_0x488929){return Mustache[_0xf336('0x26')](_0x22afc0,_[_0xf336('0x27')](_0x488929[_0xf336('0x28')],{'contact':_0x488929[_0xf336('0x29')],'message':_0x488929['message'],'agent':_0x488929[_0xf336('0x2a')],'interaction':_0x488929[_0xf336('0x2b')],'account':_0x488929[_0xf336('0x2c')]}))||'';}exports[_0xf336('0x2d')]=function(_0x5496e1,_0x49b79f){var _0x1d78cb={},_0x5cda3c={},_0x4f2888={'count':0x0,'rows':[]};var _0x3ac9fb=_[_0xf336('0x2e')](db[_0xf336('0x2f')][_0xf336('0x30')],function(_0x5abd57){return{'name':_0x5abd57[_0xf336('0x31')],'type':_0x5abd57['type']['key']};});_0x5cda3c[_0xf336('0x32')]=_[_0xf336('0x33')](_[_0xf336('0x2e')](_0x3ac9fb,'name'),[_0xf336('0x34')]);_0x5cda3c[_0xf336('0x35')]=_[_0xf336('0x36')](_0x5496e1[_0xf336('0x35')]);_0x5cda3c[_0xf336('0x37')]=_[_0xf336('0x38')](_0x5cda3c[_0xf336('0x32')],_0x5cda3c[_0xf336('0x35')]);_0x1d78cb['attributes']=_['intersection'](_0x5cda3c[_0xf336('0x32')],qs['fields'](_0x5496e1['query'][_0xf336('0x39')]));_0x1d78cb[_0xf336('0x3a')]=_0x1d78cb[_0xf336('0x3a')][_0xf336('0x3b')]?_0x1d78cb['attributes']:_0x5cda3c[_0xf336('0x32')];if(!_0x5496e1['query'][_0xf336('0x3c')](_0xf336('0x3d'))){_0x1d78cb[_0xf336('0x1d')]=qs['limit'](_0x5496e1[_0xf336('0x35')]['limit']);_0x1d78cb[_0xf336('0x1b')]=qs[_0xf336('0x1b')](_0x5496e1[_0xf336('0x35')][_0xf336('0x1b')]);}_0x1d78cb[_0xf336('0x3e')]=qs[_0xf336('0x3f')](_0x5496e1[_0xf336('0x35')][_0xf336('0x3f')]);_0x1d78cb[_0xf336('0x40')]=qs[_0xf336('0x37')](_[_0xf336('0x41')](_0x5496e1[_0xf336('0x35')],_0x5cda3c['filters']),_0x3ac9fb);if(_0x5496e1['query'][_0xf336('0x42')]){_0x1d78cb['where']=_[_0xf336('0x27')](_0x1d78cb[_0xf336('0x40')],{'$or':_[_0xf336('0x2e')](_0x3ac9fb,function(_0x4db491){if(_0x4db491[_0xf336('0x43')]!==_0xf336('0x44')){var _0x3bca39={};_0x3bca39[_0x4db491['name']]={'$like':'%'+_0x5496e1[_0xf336('0x35')]['filter']+'%'};return _0x3bca39;}})});}_0x1d78cb=_[_0xf336('0x27')]({},_0x1d78cb,_0x5496e1['options']);var _0x547771={'where':_0x1d78cb[_0xf336('0x40')]};return db[_0xf336('0x2f')][_0xf336('0x1e')](_0x547771)[_0xf336('0x21')](function(_0x33ef66){_0x4f2888[_0xf336('0x1e')]=_0x33ef66;if(_0x5496e1[_0xf336('0x35')][_0xf336('0x45')]){_0x1d78cb[_0xf336('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0xf336('0x47')](_0x1d78cb);})['then'](function(_0x59213e){_0x4f2888[_0xf336('0x48')]=_0x59213e;return _0x4f2888;})[_0xf336('0x21')](respondWithFilteredResult(_0x49b79f,_0x1d78cb))['catch'](handleError(_0x49b79f,null));};exports[_0xf336('0x49')]=function(_0x4ec45d,_0x5b9c9b){var _0x200877={'raw':![],'where':{'id':_0x4ec45d['params']['id']}},_0x50632c={};_0x50632c[_0xf336('0x32')]=_[_0xf336('0x36')](db[_0xf336('0x2f')][_0xf336('0x30')]);_0x50632c[_0xf336('0x35')]=_[_0xf336('0x36')](_0x4ec45d[_0xf336('0x35')]);_0x50632c[_0xf336('0x37')]=_['intersection'](_0x50632c[_0xf336('0x32')],_0x50632c[_0xf336('0x35')]);_0x200877[_0xf336('0x3a')]=_['intersection'](_0x50632c[_0xf336('0x32')],qs[_0xf336('0x39')](_0x4ec45d[_0xf336('0x35')]['fields']));_0x200877[_0xf336('0x3a')]=_0x200877[_0xf336('0x3a')]['length']?_0x200877[_0xf336('0x3a')]:_0x50632c[_0xf336('0x32')];if(_0x4ec45d[_0xf336('0x35')][_0xf336('0x45')]){_0x200877[_0xf336('0x46')]=[{'all':!![]}];}_0x200877=_[_0xf336('0x27')]({},_0x200877,_0x4ec45d[_0xf336('0x4a')]);return db[_0xf336('0x2f')][_0xf336('0x4b')](_0x200877)[_0xf336('0x21')](handleEntityNotFound(_0x5b9c9b,null))[_0xf336('0x21')](respondWithResult(_0x5b9c9b,null))[_0xf336('0x4c')](handleError(_0x5b9c9b,null));};exports[_0xf336('0x4d')]=function(_0x22fca4,_0x2d69b0){return db[_0xf336('0x2f')]['create'](_0x22fca4['body'],{})['then'](respondWithResult(_0x2d69b0,0xc9))['catch'](handleError(_0x2d69b0,null));};exports[_0xf336('0x20')]=function(_0x20c54e,_0x3f42bb){if(_0x20c54e[_0xf336('0x28')]['id']){delete _0x20c54e[_0xf336('0x28')]['id'];}delete _0x20c54e['body'][_0xf336('0x4e')];delete _0x20c54e[_0xf336('0x28')][_0xf336('0x4f')];delete _0x20c54e['body']['closedAt'];delete _0x20c54e['body'][_0xf336('0x50')];return db['ScreenRecording'][_0xf336('0x4b')]({'where':{'id':_0x20c54e[_0xf336('0x51')]['id']}})[_0xf336('0x21')](handleEntityNotFound(_0x3f42bb,null))[_0xf336('0x21')](saveUpdates(_0x20c54e['body'],null))[_0xf336('0x21')](respondWithResult(_0x3f42bb,null))[_0xf336('0x4c')](handleError(_0x3f42bb,null));};exports[_0xf336('0x52')]=function(_0xf0c435,_0x332a83){return db[_0xf336('0x2f')][_0xf336('0x52')]()[_0xf336('0x21')](respondWithResult(_0x332a83,null))['catch'](handleError(_0x332a83,null));};exports[_0xf336('0x53')]=function(_0x1f0682,_0x12de1a,_0x3c84df){var _0x31476b=require(_0xf336('0x54'));var _0x2dc4d0=![];var _0x8dd133={};if(_0x1f0682[_0xf336('0x35')][_0xf336('0x43')]&&_0x1f0682[_0xf336('0x35')][_0xf336('0x43')]===_0xf336('0x55')){_0x8dd133[_0xf336('0x55')]=_0x1f0682[_0xf336('0x51')]['id'];}else{_0x8dd133['id']=_0x1f0682[_0xf336('0x51')]['id'];}return db[_0xf336('0x2f')][_0xf336('0x4b')]({'where':_0x8dd133,'attributes':['id','value'],'raw':!![]})[_0xf336('0x21')](handleEntityNotFound(_0x12de1a,null))[_0xf336('0x21')](function(_0xb7af66){if(_0xb7af66){var _0x545ea4=path[_0xf336('0x56')](config[_0xf336('0x57')],'server/files/screen_recordings',_0xb7af66['value']);var _0x15c1e3=util[_0xf336('0x34')](_0xf336('0x58'),_0x545ea4);if(fs[_0xf336('0x59')](_0x15c1e3)){_0x2dc4d0=!![];return _0x31476b[_0xf336('0x5a')](_0x15c1e3,_0x545ea4,config[_0xf336('0x5b')][_0xf336('0x5c')])[_0xf336('0x21')](function(){return _0xb7af66;});}return _0xb7af66;}})[_0xf336('0x21')](function(_0x4711f8){if(_0x4711f8){var _0xa16722=path[_0xf336('0x56')](config[_0xf336('0x57')],'server/files/screen_recordings',_0x4711f8[_0xf336('0x50')]);if(!fs[_0xf336('0x59')](_0xa16722)){throw new db[(_0xf336('0x5d'))][(_0xf336('0x5e'))](_0xf336('0x5f'));}if(_0x4711f8[_0xf336('0x60')]){return _0x12de1a['download'](_0xa16722,_0x4711f8[_0xf336('0x60')]+path[_0xf336('0x61')](_0xa16722),function(){if(_0x2dc4d0){fs['unlink'](_0xa16722);}});}else{return _0x12de1a['download'](_0xa16722,function(_0x594041){if(_0x2dc4d0){fs[_0xf336('0x62')](_0xa16722);}});}}})[_0xf336('0x4c')](function(_0x546344){if(_0x546344[_0xf336('0x63')]===_0xf336('0x5f')){_0x12de1a[_0xf336('0x18')](0x194)[_0xf336('0x64')](_0xf336('0x65'));}else{return handleError(_0x12de1a,null);}});};exports[_0xf336('0x22')]=function(_0x20a776,_0x29cb1e){return db[_0xf336('0x2f')][_0xf336('0x4b')]({'where':{'id':_0x20a776['params']['id']}})[_0xf336('0x21')](function(_0x4d8a2b){if(_[_0xf336('0x66')](_0x4d8a2b)){throw new ReferenceError(_0xf336('0x67'));}return _0x4d8a2b;})['then'](function(_0x5369ae){var _0x56dcc5=path[_0xf336('0x56')](config['root'],'server/files/screen_recordings',_0x5369ae[_0xf336('0x50')]);logger[_0xf336('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x56dcc5);if(!_[_0xf336('0x66')](_0x5369ae[_0xf336('0x50')])&&fs[_0xf336('0x59')](_0x56dcc5)){logger[_0xf336('0x68')]('File:\x20\x22'+_0x56dcc5+_0xf336('0x69'));fs[_0xf336('0x6a')](_0x56dcc5);}_0x56dcc5=_0x56dcc5+_0xf336('0x6b');if(!_[_0xf336('0x66')](_0x5369ae[_0xf336('0x50')])&&fs[_0xf336('0x59')](_0x56dcc5)){logger[_0xf336('0x68')]('File:\x20\x22'+_0x56dcc5+_0xf336('0x69'));fs[_0xf336('0x6a')](_0x56dcc5);}return _0x5369ae;})[_0xf336('0x21')](function(_0x400f6d){if(!_0x400f6d)throw new InternalError();return _0x400f6d[_0xf336('0x22')]();})[_0xf336('0x21')](function(){_0x29cb1e['status'](0xcc)[_0xf336('0x19')]();})[_0xf336('0x4c')](handleError(_0x29cb1e,null));}; \ No newline at end of file +var _0xb551=['render','merge','body','contact','agent','interaction','ScreenRecording','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','filter','where','VIRTUAL','options','include','show','params','rawAttributes','length','includeAll','find','catch','create','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','server/files/screen_recordings','%s.cypher','recording','join','root','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x5ee1c1,_0x4cd5e3){var _0x1fdc7d=function(_0x1298eb){while(--_0x1298eb){_0x5ee1c1['push'](_0x5ee1c1['shift']());}};_0x1fdc7d(++_0x4cd5e3);}(_0xb551,0x171));var _0x1b55=function(_0x1f8f9d,_0x3913f4){_0x1f8f9d=_0x1f8f9d-0x0;var _0x5e9e3b=_0xb551[_0x1f8f9d];return _0x5e9e3b;};'use strict';var emlformat=require(_0x1b55('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b55('0x1'));var moment=require(_0x1b55('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1b55('0x3'));var util=require('util');var path=require(_0x1b55('0x4'));var sox=require(_0x1b55('0x5'));var csv=require('to-csv');var ejs=require(_0x1b55('0x6'));var fs=require('fs');var fs_extra=require(_0x1b55('0x7'));var _=require('lodash');var squel=require(_0x1b55('0x8'));var crypto=require(_0x1b55('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1b55('0xa'));var toCsv=require(_0x1b55('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1b55('0xc'));var qs=require(_0x1b55('0xd'));var as=require(_0x1b55('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b55('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x1b55('0x10'));var licenseUtil=require(_0x1b55('0x11'));var db=require(_0x1b55('0x12'))['db'];function respondWithStatusCode(_0x45d03d,_0x1c3408){_0x1c3408=_0x1c3408||0xcc;return function(_0x4932f3){if(_0x4932f3){return _0x45d03d[_0x1b55('0x13')](_0x1c3408);}return _0x45d03d[_0x1b55('0x14')](_0x1c3408)[_0x1b55('0x15')]();};}function respondWithResult(_0x15f723,_0x3ab7be){_0x3ab7be=_0x3ab7be||0xc8;return function(_0x4df274){if(_0x4df274){return _0x15f723[_0x1b55('0x14')](_0x3ab7be)['json'](_0x4df274);}};}function respondWithFilteredResult(_0x4eddc9,_0x569c9c){return function(_0x2df655){if(_0x2df655){var _0x3ba369=typeof _0x569c9c[_0x1b55('0x16')]==='undefined'&&typeof _0x569c9c[_0x1b55('0x17')]===_0x1b55('0x18');var _0x101708=_0x2df655[_0x1b55('0x19')];var _0xed1726=_0x3ba369?0x0:_0x569c9c[_0x1b55('0x16')];var _0x171f4b=_0x3ba369?_0x2df655[_0x1b55('0x19')]:_0x569c9c[_0x1b55('0x16')]+_0x569c9c[_0x1b55('0x17')];var _0x5004ca;if(_0x171f4b>=_0x101708){_0x171f4b=_0x101708;_0x5004ca=0xc8;}else{_0x5004ca=0xce;}_0x4eddc9[_0x1b55('0x14')](_0x5004ca);return _0x4eddc9[_0x1b55('0x1a')](_0x1b55('0x1b'),_0xed1726+'-'+_0x171f4b+'/'+_0x101708)[_0x1b55('0x1c')](_0x2df655);}return null;};}function patchUpdates(_0x9d49c6){return function(_0x4d6852){try{jsonpatch[_0x1b55('0x1d')](_0x4d6852,_0x9d49c6,!![]);}catch(_0x3826a3){return BPromise[_0x1b55('0x1e')](_0x3826a3);}return _0x4d6852[_0x1b55('0x1f')]();};}function saveUpdates(_0x1c2318,_0x309b1d){return function(_0x30856a){if(_0x30856a){return _0x30856a[_0x1b55('0x20')](_0x1c2318)[_0x1b55('0x21')](function(_0x3b4949){return _0x3b4949;});}return null;};}function removeEntity(_0x46126b,_0x447309){return function(_0x14f199){if(_0x14f199){return _0x14f199[_0x1b55('0x22')]()['then'](function(){_0x46126b[_0x1b55('0x14')](0xcc)[_0x1b55('0x15')]();});}};}function handleEntityNotFound(_0x5c5806,_0x2b60c5){return function(_0x1fda18){if(!_0x1fda18){_0x5c5806[_0x1b55('0x13')](0x194);}return _0x1fda18;};}function handleError(_0x58cac8,_0x9db73b){_0x9db73b=_0x9db73b||0x1f4;return function(_0x52793b){logger[_0x1b55('0x23')](_0x52793b[_0x1b55('0x24')]);if(_0x52793b[_0x1b55('0x25')]){delete _0x52793b[_0x1b55('0x25')];}_0x58cac8[_0x1b55('0x14')](_0x9db73b)[_0x1b55('0x26')](_0x52793b);};}function getMustacheRender(_0x29f4a2,_0x57d5e7){return Mustache[_0x1b55('0x27')](_0x29f4a2,_[_0x1b55('0x28')](_0x57d5e7[_0x1b55('0x29')],{'contact':_0x57d5e7[_0x1b55('0x2a')],'message':_0x57d5e7['message'],'agent':_0x57d5e7[_0x1b55('0x2b')],'interaction':_0x57d5e7[_0x1b55('0x2c')],'account':_0x57d5e7['account']}))||'';}exports['index']=function(_0x4ccdaa,_0x485e84){var _0x5a359d={},_0x5306be={},_0x2a647a={'count':0x0,'rows':[]};var _0x15575e=_['map'](db[_0x1b55('0x2d')]['rawAttributes'],function(_0xc780af){return{'name':_0xc780af[_0x1b55('0x2e')],'type':_0xc780af[_0x1b55('0x2f')][_0x1b55('0x30')]};});_0x5306be[_0x1b55('0x31')]=_['differenceBy'](_[_0x1b55('0x32')](_0x15575e,'name'),['format']);_0x5306be[_0x1b55('0x33')]=_[_0x1b55('0x34')](_0x4ccdaa[_0x1b55('0x33')]);_0x5306be[_0x1b55('0x35')]=_[_0x1b55('0x36')](_0x5306be[_0x1b55('0x31')],_0x5306be['query']);_0x5a359d['attributes']=_[_0x1b55('0x36')](_0x5306be[_0x1b55('0x31')],qs[_0x1b55('0x37')](_0x4ccdaa[_0x1b55('0x33')][_0x1b55('0x37')]));_0x5a359d[_0x1b55('0x38')]=_0x5a359d[_0x1b55('0x38')]['length']?_0x5a359d[_0x1b55('0x38')]:_0x5306be[_0x1b55('0x31')];if(!_0x4ccdaa[_0x1b55('0x33')]['hasOwnProperty'](_0x1b55('0x39'))){_0x5a359d['limit']=qs[_0x1b55('0x17')](_0x4ccdaa['query'][_0x1b55('0x17')]);_0x5a359d[_0x1b55('0x16')]=qs[_0x1b55('0x16')](_0x4ccdaa[_0x1b55('0x33')]['offset']);}_0x5a359d[_0x1b55('0x3a')]=qs[_0x1b55('0x3b')](_0x4ccdaa[_0x1b55('0x33')]['sort']);_0x5a359d['where']=qs[_0x1b55('0x35')](_['pick'](_0x4ccdaa[_0x1b55('0x33')],_0x5306be[_0x1b55('0x35')]),_0x15575e);if(_0x4ccdaa[_0x1b55('0x33')][_0x1b55('0x3c')]){_0x5a359d[_0x1b55('0x3d')]=_[_0x1b55('0x28')](_0x5a359d[_0x1b55('0x3d')],{'$or':_[_0x1b55('0x32')](_0x15575e,function(_0x553889){if(_0x553889[_0x1b55('0x2f')]!==_0x1b55('0x3e')){var _0x31e88d={};_0x31e88d[_0x553889[_0x1b55('0x25')]]={'$like':'%'+_0x4ccdaa[_0x1b55('0x33')][_0x1b55('0x3c')]+'%'};return _0x31e88d;}})});}_0x5a359d=_[_0x1b55('0x28')]({},_0x5a359d,_0x4ccdaa[_0x1b55('0x3f')]);var _0x209527={'where':_0x5a359d[_0x1b55('0x3d')]};return db[_0x1b55('0x2d')][_0x1b55('0x19')](_0x209527)[_0x1b55('0x21')](function(_0x105469){_0x2a647a['count']=_0x105469;if(_0x4ccdaa[_0x1b55('0x33')]['includeAll']){_0x5a359d[_0x1b55('0x40')]=[{'all':!![]}];}return db[_0x1b55('0x2d')]['findAll'](_0x5a359d);})[_0x1b55('0x21')](function(_0x51c9ac){_0x2a647a['rows']=_0x51c9ac;return _0x2a647a;})[_0x1b55('0x21')](respondWithFilteredResult(_0x485e84,_0x5a359d))['catch'](handleError(_0x485e84,null));};exports[_0x1b55('0x41')]=function(_0x30e12a,_0x2ac723){var _0x224c5a={'raw':![],'where':{'id':_0x30e12a[_0x1b55('0x42')]['id']}},_0x120d92={};_0x120d92[_0x1b55('0x31')]=_['keys'](db[_0x1b55('0x2d')][_0x1b55('0x43')]);_0x120d92[_0x1b55('0x33')]=_[_0x1b55('0x34')](_0x30e12a[_0x1b55('0x33')]);_0x120d92[_0x1b55('0x35')]=_[_0x1b55('0x36')](_0x120d92[_0x1b55('0x31')],_0x120d92[_0x1b55('0x33')]);_0x224c5a[_0x1b55('0x38')]=_[_0x1b55('0x36')](_0x120d92[_0x1b55('0x31')],qs['fields'](_0x30e12a[_0x1b55('0x33')][_0x1b55('0x37')]));_0x224c5a[_0x1b55('0x38')]=_0x224c5a[_0x1b55('0x38')][_0x1b55('0x44')]?_0x224c5a[_0x1b55('0x38')]:_0x120d92['model'];if(_0x30e12a[_0x1b55('0x33')][_0x1b55('0x45')]){_0x224c5a[_0x1b55('0x40')]=[{'all':!![]}];}_0x224c5a=_[_0x1b55('0x28')]({},_0x224c5a,_0x30e12a[_0x1b55('0x3f')]);return db['ScreenRecording'][_0x1b55('0x46')](_0x224c5a)['then'](handleEntityNotFound(_0x2ac723,null))['then'](respondWithResult(_0x2ac723,null))[_0x1b55('0x47')](handleError(_0x2ac723,null));};exports[_0x1b55('0x48')]=function(_0x230fb6,_0x3f6422){return db['ScreenRecording'][_0x1b55('0x48')](_0x230fb6[_0x1b55('0x29')],{})[_0x1b55('0x21')](respondWithResult(_0x3f6422,0xc9))[_0x1b55('0x47')](handleError(_0x3f6422,null));};exports['update']=function(_0x3b468e,_0x269b6b){if(_0x3b468e[_0x1b55('0x29')]['id']){delete _0x3b468e[_0x1b55('0x29')]['id'];}delete _0x3b468e[_0x1b55('0x29')][_0x1b55('0x49')];delete _0x3b468e[_0x1b55('0x29')][_0x1b55('0x4a')];delete _0x3b468e[_0x1b55('0x29')]['closedAt'];delete _0x3b468e[_0x1b55('0x29')][_0x1b55('0x4b')];return db['ScreenRecording'][_0x1b55('0x46')]({'where':{'id':_0x3b468e['params']['id']}})[_0x1b55('0x21')](handleEntityNotFound(_0x269b6b,null))['then'](saveUpdates(_0x3b468e['body'],null))[_0x1b55('0x21')](respondWithResult(_0x269b6b,null))[_0x1b55('0x47')](handleError(_0x269b6b,null));};exports[_0x1b55('0x4c')]=function(_0x3ee978,_0x30f9a4){return db[_0x1b55('0x2d')][_0x1b55('0x4c')]()['then'](respondWithResult(_0x30f9a4,null))[_0x1b55('0x47')](handleError(_0x30f9a4,null));};exports[_0x1b55('0x4d')]=function(_0x22535a,_0xa50c22,_0x59d489){var _0x21ef31=require(_0x1b55('0x4e'));var _0x505765=![];var _0x693307={};if(_0x22535a[_0x1b55('0x33')][_0x1b55('0x2f')]&&_0x22535a['query'][_0x1b55('0x2f')]==='uniqueid'){_0x693307[_0x1b55('0x4f')]=_0x22535a['params']['id'];}else{_0x693307['id']=_0x22535a[_0x1b55('0x42')]['id'];}return db['ScreenRecording']['find']({'where':_0x693307,'attributes':['id','value'],'raw':!![]})[_0x1b55('0x21')](handleEntityNotFound(_0xa50c22,null))[_0x1b55('0x21')](function(_0xb5c3bb){if(_0xb5c3bb){var _0x2e5ed3=path['join'](config['root'],_0x1b55('0x50'),_0xb5c3bb[_0x1b55('0x4b')]);var _0x21e7a8=util['format'](_0x1b55('0x51'),_0x2e5ed3);if(fs['existsSync'](_0x21e7a8)){_0x505765=!![];return _0x21ef31['decryptFile'](_0x21e7a8,_0x2e5ed3,config['secrets'][_0x1b55('0x52')])[_0x1b55('0x21')](function(){return _0xb5c3bb;});}return _0xb5c3bb;}})['then'](function(_0x5e2674){if(_0x5e2674){var _0x18eb83=path[_0x1b55('0x53')](config[_0x1b55('0x54')],_0x1b55('0x50'),_0x5e2674[_0x1b55('0x4b')]);if(!fs[_0x1b55('0x55')](_0x18eb83)){throw new db[(_0x1b55('0x56'))][(_0x1b55('0x57'))](_0x1b55('0x58'));}if(_0x5e2674[_0x1b55('0x59')]){return _0xa50c22[_0x1b55('0x4d')](_0x18eb83,_0x5e2674[_0x1b55('0x59')]+path[_0x1b55('0x5a')](_0x18eb83),function(){if(_0x505765){fs[_0x1b55('0x5b')](_0x18eb83);}});}else{return _0xa50c22[_0x1b55('0x4d')](_0x18eb83,function(_0x1d0274){if(_0x505765){fs[_0x1b55('0x5b')](_0x18eb83);}});}}})['catch'](function(_0x31ca10){if(_0x31ca10[_0x1b55('0x5c')]===_0x1b55('0x58')){_0xa50c22[_0x1b55('0x14')](0x194)[_0x1b55('0x26')](_0x1b55('0x5d'));}else{return handleError(_0xa50c22,null);}});};exports['destroy']=function(_0x411f8b,_0x2797d0){return db[_0x1b55('0x2d')][_0x1b55('0x46')]({'where':{'id':_0x411f8b[_0x1b55('0x42')]['id']}})['then'](function(_0x346b97){if(_[_0x1b55('0x5e')](_0x346b97)){throw new ReferenceError(_0x1b55('0x5f'));}return _0x346b97;})[_0x1b55('0x21')](function(_0x552ae1){var _0x9dbfee=path['join'](config[_0x1b55('0x54')],_0x1b55('0x50'),_0x552ae1[_0x1b55('0x4b')]);logger[_0x1b55('0x60')](_0x1b55('0x61'),_0x9dbfee);if(!_[_0x1b55('0x5e')](_0x552ae1['value'])&&fs[_0x1b55('0x55')](_0x9dbfee)){logger['info'](_0x1b55('0x62')+_0x9dbfee+_0x1b55('0x63'));fs[_0x1b55('0x64')](_0x9dbfee);}_0x9dbfee=_0x9dbfee+_0x1b55('0x65');if(!_['isNil'](_0x552ae1[_0x1b55('0x4b')])&&fs[_0x1b55('0x55')](_0x9dbfee)){logger[_0x1b55('0x60')]('File:\x20\x22'+_0x9dbfee+_0x1b55('0x63'));fs[_0x1b55('0x64')](_0x9dbfee);}return _0x552ae1;})[_0x1b55('0x21')](function(_0x3c7df0){if(!_0x3c7df0)throw new InternalError();return _0x3c7df0['destroy']();})[_0x1b55('0x21')](function(){_0x2797d0[_0x1b55('0x14')](0xcc)[_0x1b55('0x15')]();})['catch'](handleError(_0x2797d0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 130110b..03b9c68 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6ac=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment'];(function(_0x5710ee,_0x2aaffe){var _0x1912a3=function(_0x591f67){while(--_0x591f67){_0x5710ee['push'](_0x5710ee['shift']());}};_0x1912a3(++_0x2aaffe);}(_0xe6ac,0xec));var _0xce6a=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0xe6ac[_0x2389bc];return _0x170548;};'use strict';var _=require(_0xce6a('0x0'));var util=require(_0xce6a('0x1'));var logger=require('../../config/logger')(_0xce6a('0x2'));var moment=require(_0xce6a('0x3'));var BPromise=require(_0xce6a('0x4'));var rp=require(_0xce6a('0x5'));var fs=require('fs');var path=require(_0xce6a('0x6'));var rimraf=require(_0xce6a('0x7'));var config=require(_0xce6a('0x8'));var attributes=require(_0xce6a('0x9'));module[_0xce6a('0xa')]=function(_0x219be6,_0x2d577e){return _0x219be6[_0xce6a('0xb')](_0xce6a('0xc'),attributes,{'tableName':_0xce6a('0xd'),'paranoid':![],'indexes':[{'name':_0xce6a('0xe'),'fields':[_0xce6a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c1f=['../../config/environment','./screenRecording.attributes','exports','ScreenRecording','interactionid','util','api','bluebird','request-promise','path','rimraf'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x4c1f,0x123));var _0xf4c1=function(_0xd2b920,_0x57ffe5){_0xd2b920=_0xd2b920-0x0;var _0xe670d5=_0x4c1f[_0xd2b920];return _0xe670d5;};'use strict';var _=require('lodash');var util=require(_0xf4c1('0x0'));var logger=require('../../config/logger')(_0xf4c1('0x1'));var moment=require('moment');var BPromise=require(_0xf4c1('0x2'));var rp=require(_0xf4c1('0x3'));var fs=require('fs');var path=require(_0xf4c1('0x4'));var rimraf=require(_0xf4c1('0x5'));var config=require(_0xf4c1('0x6'));var attributes=require(_0xf4c1('0x7'));module[_0xf4c1('0x8')]=function(_0x1430a7,_0x350f4e){return _0x1430a7['define'](_0xf4c1('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xf4c1('0xa'),'fields':[_0xf4c1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c646241..87a682f 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d7e59,_0x6ea7fb){var _0x46f0bb=function(_0x563d89){while(--_0x563d89){_0x5d7e59['push'](_0x5d7e59['shift']());}};_0x46f0bb(++_0x6ea7fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xca4be2,_0x3a1083){var _0x24ec68=function(_0x3682d6){while(--_0x3682d6){_0xca4be2['push'](_0xca4be2['shift']());}};_0x24ec68(++_0x3a1083);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 63e305a..9bc5fc3 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['addFavicon','put','isAuthenticated','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','originalname','post','single','addLogo','logologin','extname','file','addLogoLogin','preferred','addPreferred','%s%s','favicon'];(function(_0x373db7,_0x1777d2){var _0x47a084=function(_0x145a88){while(--_0x145a88){_0x373db7['push'](_0x373db7['shift']());}};_0x47a084(++_0x1777d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),controller['getDate']);router['get'](_0x0a9e('0xb'),controller['show']);router['get'](_0x0a9e('0xc'),controller[_0x0a9e('0xd')]);router[_0x0a9e('0x8')](_0x0a9e('0xe'),controller[_0x0a9e('0xf')]);router[_0x0a9e('0x8')]('/:id/gdpr',controller['gdpr']);router['get']('/:id/preferred',controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),controller[_0x0a9e('0x12')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x69aeb7,_0x5db4b0,_0x4283ce){_0x4283ce(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x44dcfd,_0x4d5611,_0x52a03d){_0x52a03d(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x18'),path['extname'](_0x4d5611[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/logo',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x1c')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x106033,_0x205fd6,_0x31b1ca){_0x31b1ca(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x1314ae,_0x112016,_0x1c696a){_0x1c696a(null,util[_0x0a9e('0x17')]('%s%s',_0x0a9e('0x1d'),path[_0x0a9e('0x1e')](_0x112016['originalname'])));}})});router[_0x0a9e('0x1a')]('/:id/logo_login',upload['single'](_0x0a9e('0x1f')),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer[_0x0a9e('0x13')]({'destination':function(_0x30bae6,_0x4abc77,_0xfb6e48){_0xfb6e48(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x370d86,_0x42ac8f,_0x16b1ca){_0x16b1ca(null,util['format']('%s%s',_0x0a9e('0x21'),path[_0x0a9e('0x1e')](_0x42ac8f[_0x0a9e('0x19')])));}})});router[_0x0a9e('0x1a')]('/:id/preferred',upload[_0x0a9e('0x1b')]('file'),controller[_0x0a9e('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dc186,_0x34dc65,_0x25fba9){_0x25fba9(null,path[_0x0a9e('0x14')](config[_0x0a9e('0x15')],_0x0a9e('0x16')));},'filename':function(_0x11c3b6,_0x14de77,_0x5a101a){_0x5a101a(null,util[_0x0a9e('0x17')](_0x0a9e('0x23'),_0x0a9e('0x24'),path[_0x0a9e('0x1e')](_0x14de77['originalname'])));}})});router[_0x0a9e('0x1a')](_0x0a9e('0x11'),upload[_0x0a9e('0x1b')](_0x0a9e('0x1f')),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x26')](_0x0a9e('0xb'),auth[_0x0a9e('0x27')](),controller[_0x0a9e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 968b52b..bb99fab 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ae3=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x23bf41,_0x37d6e9){var _0xa6fd23=function(_0x55cff6){while(--_0x55cff6){_0x23bf41['push'](_0x23bf41['shift']());}};_0xa6fd23(++_0x37d6e9);}(_0x9ae3,0xd4));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x39ae('0x0'));module[_0x39ae('0x1')]={'min_internal':{'type':Sequelize[_0x39ae('0x2')](0xb),'unique':_0x39ae('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x39ae('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x39ae('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x39ae('0x5')],'defaultValue':_0x39ae('0x6')},'logo':{'type':Sequelize[_0x39ae('0x5')]},'defaultLogo':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x39ae('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x39ae('0x5')]},'turnaddr':{'type':Sequelize[_0x39ae('0x5')]},'turnusername':{'type':Sequelize[_0x39ae('0x5')]},'turnpassword':{'type':Sequelize[_0x39ae('0x5')]},'pageTitle':{'type':Sequelize[_0x39ae('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x39ae('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x39ae('0x5')],'defaultValue':_0x39ae('0x8')},'enableEmailPreview':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x39ae('0x5')],'defaultValue':_0x39ae('0x9')},'chatTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x39ae('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x39ae('0x5')]},'defaultFavicon':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x39ae('0x2')]},'transcribeRegion':{'type':Sequelize[_0x39ae('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x39ae('0x2')]},'sentimentRegion':{'type':Sequelize[_0x39ae('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x39ae('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x39ae('0x2')](0x2)[_0x39ae('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x39ae('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x9f93=['min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER','min_internal'];(function(_0x1a933a,_0x51ea18){var _0x38533f=function(_0x5789df){while(--_0x5789df){_0x1a933a['push'](_0x1a933a['shift']());}};_0x38533f(++_0x51ea18);}(_0x9f93,0x193));var _0x39f9=function(_0x38eef9,_0x105901){_0x38eef9=_0x38eef9-0x0;var _0x14593f=_0x9f93[_0x38eef9];return _0x14593f;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x39f9('0x0')](0xb),'unique':_0x39f9('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x39f9('0x0')](0xb),'unique':_0x39f9('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x39f9('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x39f9('0x3')},'logo':{'type':Sequelize[_0x39f9('0x4')]},'defaultLogo':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x39f9('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x39f9('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x39f9('0x4')]},'turnaddr':{'type':Sequelize[_0x39f9('0x4')]},'turnusername':{'type':Sequelize[_0x39f9('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x39f9('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x39f9('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x39f9('0x4')],'defaultValue':_0x39f9('0x6')},'enableEmailPreview':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x39f9('0x4')],'defaultValue':_0x39f9('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x39f9('0x4')]},'defaultPreferred':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x39f9('0x4')]},'defaultFavicon':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x39f9('0x0')]},'transcribeRegion':{'type':Sequelize[_0x39f9('0x4')]},'sentiment':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x39f9('0x0')]},'sentimentRegion':{'type':Sequelize[_0x39f9('0x4')]},'language':{'type':Sequelize[_0x39f9('0x4')]},'bucket':{'type':Sequelize[_0x39f9('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x39f9('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x39f9('0x0')](0x2)[_0x39f9('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x39f9('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x39f9('0x0')](0x2)[_0x39f9('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x39f9('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x39f9('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index d610483..6d0c989 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x570a=['pick','filter','VIRTUAL','options','findAll','rows','params','rawAttributes','includeAll','find','addLogo','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','custom','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','eml-format','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','name','send','render','merge','body','agent','account','index','map','Setting','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters'];(function(_0x4ef4c4,_0x3c5e0d){var _0x3321bd=function(_0x5abbc0){while(--_0x5abbc0){_0x4ef4c4['push'](_0x4ef4c4['shift']());}};_0x3321bd(++_0x3c5e0d);}(_0x570a,0x11e));var _0xa570=function(_0x10dbcd,_0x4b9171){_0x10dbcd=_0x10dbcd-0x0;var _0x3ee859=_0x570a[_0x10dbcd];return _0x3ee859;};'use strict';var emlformat=require(_0xa570('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa570('0x1'));var moment=require(_0xa570('0x2'));var BPromise=require(_0xa570('0x3'));var Mustache=require('mustache');var util=require(_0xa570('0x4'));var path=require('path');var sox=require(_0xa570('0x5'));var csv=require(_0xa570('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa570('0x7'));var _=require('lodash');var squel=require(_0xa570('0x8'));var crypto=require('crypto');var jsforce=require(_0xa570('0x9'));var deskjs=require(_0xa570('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa570('0xb'));var Papa=require(_0xa570('0xc'));var Redis=require('ioredis');var authService=require(_0xa570('0xd'));var qs=require(_0xa570('0xe'));var as=require(_0xa570('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa570('0x10'));var utils=require('../../config/utils');var config=require(_0xa570('0x11'));var licenseUtil=require(_0xa570('0x12'));var db=require(_0xa570('0x13'))['db'];var jayson=require(_0xa570('0x14'));var client=jayson['client'][_0xa570('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x5f1ca9,_0x1639e4,_0x25bf61,_0x1dad20){return new BPromise(function(_0xaf3d01,_0x1219cd){var _0x522cea=_0x1dad20||client;return _0x522cea['request'](_0x5f1ca9,_0x25bf61)[_0xa570('0x16')](function(_0x307089){logger[_0xa570('0x17')](_0xa570('0x18'),_0x1639e4,_0xa570('0x19'));logger[_0xa570('0x1a')](_0xa570('0x1b'),_0x1639e4,_0xa570('0x19'),JSON[_0xa570('0x1c')](_0x307089));if(_0x307089['error']){if(_0x307089[_0xa570('0x1d')][_0xa570('0x1e')]===0x1f4){logger[_0xa570('0x1d')]('Setting,\x20%s,\x20%s',_0x1639e4,_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);return _0x1219cd(_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);}logger[_0xa570('0x1d')](_0xa570('0x18'),_0x1639e4,_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);return _0xaf3d01(_0x307089[_0xa570('0x1d')][_0xa570('0x1f')]);}else{logger['info'](_0xa570('0x18'),_0x1639e4,_0xa570('0x19'));_0xaf3d01(_0x307089[_0xa570('0x20')][_0xa570('0x1f')]);}})[_0xa570('0x21')](function(_0x1c3871){logger[_0xa570('0x1d')](_0xa570('0x18'),_0x1639e4,_0x1c3871);_0x1219cd(_0x1c3871);});});}function respondWithStatusCode(_0x4c3474,_0x27a5ac){_0x27a5ac=_0x27a5ac||0xcc;return function(_0x2c9e0f){if(_0x2c9e0f){return _0x4c3474[_0xa570('0x22')](_0x27a5ac);}return _0x4c3474[_0xa570('0x23')](_0x27a5ac)[_0xa570('0x24')]();};}function respondWithResult(_0x3f5267,_0x3a0048){_0x3a0048=_0x3a0048||0xc8;return function(_0x490a81){if(_0x490a81){return _0x3f5267[_0xa570('0x23')](_0x3a0048)['json'](_0x490a81);}};}function respondWithFilteredResult(_0x4773ab,_0x45155f){return function(_0x3440d2){if(_0x3440d2){var _0x8f2fe8=typeof _0x45155f[_0xa570('0x25')]===_0xa570('0x26')&&typeof _0x45155f[_0xa570('0x27')]==='undefined';var _0x31ac0c=_0x3440d2[_0xa570('0x28')];var _0x573fee=_0x8f2fe8?0x0:_0x45155f[_0xa570('0x25')];var _0x35372c=_0x8f2fe8?_0x3440d2[_0xa570('0x28')]:_0x45155f[_0xa570('0x25')]+_0x45155f[_0xa570('0x27')];var _0x27551b;if(_0x35372c>=_0x31ac0c){_0x35372c=_0x31ac0c;_0x27551b=0xc8;}else{_0x27551b=0xce;}_0x4773ab[_0xa570('0x23')](_0x27551b);return _0x4773ab['set']('Content-Range',_0x573fee+'-'+_0x35372c+'/'+_0x31ac0c)[_0xa570('0x29')](_0x3440d2);}return null;};}function patchUpdates(_0x27f9f2){return function(_0x19f48b){try{jsonpatch[_0xa570('0x2a')](_0x19f48b,_0x27f9f2,!![]);}catch(_0x34aaee){return BPromise[_0xa570('0x2b')](_0x34aaee);}return _0x19f48b[_0xa570('0x2c')]();};}function saveUpdates(_0x102a6d,_0x1f99dd){return function(_0x541c04){if(_0x541c04){return _0x541c04[_0xa570('0x2d')](_0x102a6d)[_0xa570('0x16')](function(_0x495ee7){return _0x495ee7;});}return null;};}function removeEntity(_0x42d2a8,_0x1f964d){return function(_0x2ec55e){if(_0x2ec55e){return _0x2ec55e[_0xa570('0x2e')]()[_0xa570('0x16')](function(){_0x42d2a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aeec4,_0x129a7f){return function(_0x2e93b9){if(!_0x2e93b9){_0x1aeec4[_0xa570('0x22')](0x194);}return _0x2e93b9;};}function handleError(_0x2a0347,_0x2b2cd5){_0x2b2cd5=_0x2b2cd5||0x1f4;return function(_0x305000){logger[_0xa570('0x1d')](_0x305000['stack']);if(_0x305000[_0xa570('0x2f')]){delete _0x305000['name'];}_0x2a0347[_0xa570('0x23')](_0x2b2cd5)[_0xa570('0x30')](_0x305000);};}function getMustacheRender(_0x14fc4c,_0x4b63fe){return Mustache[_0xa570('0x31')](_0x14fc4c,_[_0xa570('0x32')](_0x4b63fe[_0xa570('0x33')],{'contact':_0x4b63fe['contact'],'message':_0x4b63fe[_0xa570('0x1f')],'agent':_0x4b63fe[_0xa570('0x34')],'interaction':_0x4b63fe['interaction'],'account':_0x4b63fe[_0xa570('0x35')]}))||'';}exports[_0xa570('0x36')]=function(_0x8eed3b,_0x32cca8){var _0x45a192={},_0x1588ae={},_0x39b19c={'count':0x0,'rows':[]};var _0x1be715=_[_0xa570('0x37')](db[_0xa570('0x38')]['rawAttributes'],function(_0x355110){return{'name':_0x355110[_0xa570('0x39')],'type':_0x355110[_0xa570('0x3a')]['key']};});_0x1588ae[_0xa570('0x3b')]=_[_0xa570('0x37')](_0x1be715,_0xa570('0x2f'));_0x1588ae[_0xa570('0x3c')]=_[_0xa570('0x3d')](_0x8eed3b['query']);_0x1588ae['filters']=_[_0xa570('0x3e')](_0x1588ae[_0xa570('0x3b')],_0x1588ae[_0xa570('0x3c')]);_0x45a192[_0xa570('0x3f')]=_['intersection'](_0x1588ae[_0xa570('0x3b')],qs['fields'](_0x8eed3b[_0xa570('0x3c')][_0xa570('0x40')]));_0x45a192[_0xa570('0x3f')]=_0x45a192[_0xa570('0x3f')][_0xa570('0x41')]?_0x45a192[_0xa570('0x3f')]:_0x1588ae[_0xa570('0x3b')];if(!_0x8eed3b['query']['hasOwnProperty'](_0xa570('0x42'))){_0x45a192[_0xa570('0x27')]=qs['limit'](_0x8eed3b[_0xa570('0x3c')]['limit']);_0x45a192[_0xa570('0x25')]=qs[_0xa570('0x25')](_0x8eed3b[_0xa570('0x3c')][_0xa570('0x25')]);}_0x45a192[_0xa570('0x43')]=qs[_0xa570('0x44')](_0x8eed3b[_0xa570('0x3c')][_0xa570('0x44')]);_0x45a192[_0xa570('0x45')]=qs[_0xa570('0x46')](_[_0xa570('0x47')](_0x8eed3b['query'],_0x1588ae['filters']),_0x1be715);if(_0x8eed3b['query'][_0xa570('0x48')]){_0x45a192['where']=_[_0xa570('0x32')](_0x45a192[_0xa570('0x45')],{'$or':_[_0xa570('0x37')](_0x1be715,function(_0x5c5a11){if(_0x5c5a11['type']!==_0xa570('0x49')){var _0x56c71a={};_0x56c71a[_0x5c5a11['name']]={'$like':'%'+_0x8eed3b[_0xa570('0x3c')]['filter']+'%'};return _0x56c71a;}})});}_0x45a192=_[_0xa570('0x32')]({},_0x45a192,_0x8eed3b[_0xa570('0x4a')]);var _0x395ebe={'where':_0x45a192[_0xa570('0x45')]};return db[_0xa570('0x38')]['count'](_0x395ebe)[_0xa570('0x16')](function(_0x493c49){_0x39b19c[_0xa570('0x28')]=_0x493c49;if(_0x8eed3b[_0xa570('0x3c')]['includeAll']){_0x45a192['include']=[{'all':!![]}];}return db[_0xa570('0x38')][_0xa570('0x4b')](_0x45a192);})['then'](function(_0x4730c1){_0x39b19c[_0xa570('0x4c')]=_0x4730c1;return _0x39b19c;})[_0xa570('0x16')](respondWithFilteredResult(_0x32cca8,_0x45a192))['catch'](handleError(_0x32cca8,null));};exports['show']=function(_0x59c3db,_0x3b3f7e){var _0x39cf7b={'raw':![],'where':{'id':_0x59c3db[_0xa570('0x4d')]['id']}},_0x39e1ae={};_0x39e1ae[_0xa570('0x3b')]=_['keys'](db['Setting'][_0xa570('0x4e')]);_0x39e1ae['query']=_['keys'](_0x59c3db[_0xa570('0x3c')]);_0x39e1ae[_0xa570('0x46')]=_[_0xa570('0x3e')](_0x39e1ae[_0xa570('0x3b')],_0x39e1ae[_0xa570('0x3c')]);_0x39cf7b[_0xa570('0x3f')]=_[_0xa570('0x3e')](_0x39e1ae['model'],qs['fields'](_0x59c3db['query'][_0xa570('0x40')]));_0x39cf7b[_0xa570('0x3f')]=_0x39cf7b[_0xa570('0x3f')]['length']?_0x39cf7b[_0xa570('0x3f')]:_0x39e1ae[_0xa570('0x3b')];if(_0x59c3db[_0xa570('0x3c')][_0xa570('0x4f')]){_0x39cf7b['include']=[{'all':!![]}];}_0x39cf7b=_[_0xa570('0x32')]({},_0x39cf7b,_0x59c3db[_0xa570('0x4a')]);return db['Setting'][_0xa570('0x50')](_0x39cf7b)[_0xa570('0x16')](handleEntityNotFound(_0x3b3f7e,null))['then'](respondWithResult(_0x3b3f7e,null))[_0xa570('0x21')](handleError(_0x3b3f7e,null));};exports['update']=function(_0x337748,_0x49a933){if(_0x337748[_0xa570('0x33')]['id']){delete _0x337748[_0xa570('0x33')]['id'];}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x337748[_0xa570('0x4d')]['id']}})[_0xa570('0x16')](handleEntityNotFound(_0x49a933,null))[_0xa570('0x16')](saveUpdates(_0x337748[_0xa570('0x33')],null))['then'](respondWithResult(_0x49a933,null))[_0xa570('0x21')](handleError(_0x49a933,null));};exports[_0xa570('0x51')]=function(_0x2f1c11,_0x59dfb3,_0x47763a){if(_0x2f1c11[_0xa570('0x52')]&&_0x2f1c11[_0xa570('0x52')]['filename']){_0x2f1c11[_0xa570('0x33')][_0xa570('0x53')]=_0x2f1c11[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x2f1c11['params']['id']}})[_0xa570('0x16')](handleEntityNotFound(_0x59dfb3,null))[_0xa570('0x16')](saveUpdates(_0x2f1c11[_0xa570('0x33')],null))[_0xa570('0x16')](respondWithResult(_0x59dfb3,null))[_0xa570('0x21')](handleError(_0x59dfb3,null));};exports[_0xa570('0x55')]=function(_0x2d5b48,_0xc6570f,_0x4a3dc4){if(_0x2d5b48[_0xa570('0x52')]&&_0x2d5b48[_0xa570('0x52')][_0xa570('0x54')]){_0x2d5b48[_0xa570('0x33')]['loginLogo']=_0x2d5b48[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')]['find']({'where':{'id':_0x2d5b48['params']['id']}})[_0xa570('0x16')](handleEntityNotFound(_0xc6570f,null))[_0xa570('0x16')](saveUpdates(_0x2d5b48[_0xa570('0x33')],null))['then'](respondWithResult(_0xc6570f,null))['catch'](handleError(_0xc6570f,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x56')]=function(_0x270b5e,_0x5da677,_0x248d13){var _0x5419d6=_0xa570('0x57');var _0x1b57ba={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x2b5138){if(_0x2b5138){_0x1b57ba=_0x2b5138;}return db['Setting'][_0xa570('0x50')]({'where':{'id':_0x270b5e[_0xa570('0x4d')]['id']},'attributes':[_0xa570('0x53'),_0xa570('0x59'),_0xa570('0x5a'),_0xa570('0x5b'),_0xa570('0x5c'),'defaultLoginLogo',_0xa570('0x5d'),_0xa570('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x5da677,null))['then'](function(_0x2d675c){if(_0x2d675c){var _0x5521e6=_0x2d675c[_0xa570('0x53')]&&fs[_0xa570('0x5f')](path[_0xa570('0x60')](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')](_0x2d675c[_0xa570('0x53')])))?path[_0xa570('0x60')](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')](_0x2d675c[_0xa570('0x53')])):path[_0xa570('0x60')](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')]('default_logo.svg'));var _0xf7b3a8=_0xa570('0x63')+_['upperFirst'](_0xa570('0x53'));if(_0x2d675c[_0xf7b3a8]||!_0x1b57ba[_0xa570('0x64')]){_0x5521e6=path['join'](config[_0xa570('0x61')],_0x5419d6,_[_0xa570('0x62')](_0xa570('0x65')));}if(!fs[_0xa570('0x5f')](_0x5521e6)){throw new db[(_0xa570('0x66'))][(_0xa570('0x67'))](_[_0xa570('0x68')](_0xa570('0x53'))+_0xa570('0x69'));}return _0x5da677[_0xa570('0x6a')](_0x5521e6);}})[_0xa570('0x21')](handleError(_0x5da677,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x6b')]=function(_0x52f615,_0x5f16db,_0x162241){var _0x1e4e51=_0xa570('0x57');var _0x2dbca9={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x3f3f2d){if(_0x3f3f2d){_0x2dbca9=_0x3f3f2d;}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x52f615[_0xa570('0x4d')]['id']},'attributes':[_0xa570('0x53'),_0xa570('0x59'),_0xa570('0x5a'),'favicon',_0xa570('0x5c'),_0xa570('0x6c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa570('0x16')](handleEntityNotFound(_0x5f16db,null))[_0xa570('0x16')](function(_0xd17394){if(_0xd17394){var _0x3f0f6c=_0xd17394['loginLogo']&&fs[_0xa570('0x5f')](path['join'](config[_0xa570('0x61')],_0x1e4e51,_['toLower'](_0xd17394[_0xa570('0x59')])))?path[_0xa570('0x60')](config['root'],_0x1e4e51,_[_0xa570('0x62')](_0xd17394[_0xa570('0x59')])):path[_0xa570('0x60')](config[_0xa570('0x61')],_0x1e4e51,_['toLower'](_0xa570('0x6d')));var _0x79c0bb=_0xa570('0x63')+_[_0xa570('0x68')](_0xa570('0x59'));if(_0xd17394[_0x79c0bb]||!_0x2dbca9[_0xa570('0x64')]){_0x3f0f6c=path[_0xa570('0x60')](config[_0xa570('0x61')],_0x1e4e51,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xa570('0x5f')](_0x3f0f6c)){throw new db[(_0xa570('0x66'))][(_0xa570('0x67'))](_['upperFirst'](_0xa570('0x59'))+_0xa570('0x69'));}return _0x5f16db['download'](_0x3f0f6c);}})[_0xa570('0x21')](handleError(_0x5f16db,null));};exports[_0xa570('0x6e')]=function(_0x42ba5d,_0x11e53e){return db['Setting'][_0xa570('0x50')]({'where':{'id':_0x42ba5d[_0xa570('0x4d')]['id']},'attributes':['securePassword']})[_0xa570('0x16')](respondWithResult(_0x11e53e,null))[_0xa570('0x21')](handleError(_0x11e53e,null));};exports['addPreferred']=function(_0x530b65,_0x4007be,_0x58b17e){if(_0x530b65[_0xa570('0x52')]&&_0x530b65[_0xa570('0x52')][_0xa570('0x54')]){_0x530b65[_0xa570('0x33')][_0xa570('0x5a')]=_0x530b65[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x530b65[_0xa570('0x4d')]['id']}})[_0xa570('0x16')](handleEntityNotFound(_0x4007be,null))[_0xa570('0x16')](saveUpdates(_0x530b65[_0xa570('0x33')],null))[_0xa570('0x16')](respondWithResult(_0x4007be,null))[_0xa570('0x21')](handleError(_0x4007be,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x6f')]=function(_0x268e52,_0x220c61,_0x519611){var _0x2f7890=_0xa570('0x57');var _0x4824b2={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x2b87c6){if(_0x2b87c6){_0x4824b2=_0x2b87c6;}return db[_0xa570('0x38')][_0xa570('0x50')]({'where':{'id':_0x268e52[_0xa570('0x4d')]['id']},'attributes':[_0xa570('0x53'),_0xa570('0x59'),_0xa570('0x5a'),'favicon',_0xa570('0x5c'),_0xa570('0x6c'),_0xa570('0x5d'),'defaultFavicon'],'raw':!![]});})[_0xa570('0x16')](handleEntityNotFound(_0x220c61,null))[_0xa570('0x16')](function(_0x1c8413){if(_0x1c8413){var _0x1143e9=_0x1c8413['preferred']&&fs[_0xa570('0x5f')](path[_0xa570('0x60')](config[_0xa570('0x61')],_0x2f7890,_['toLower'](_0x1c8413[_0xa570('0x5a')])))?path[_0xa570('0x60')](config[_0xa570('0x61')],_0x2f7890,_[_0xa570('0x62')](_0x1c8413[_0xa570('0x5a')])):path[_0xa570('0x60')](config['root'],_0x2f7890,_[_0xa570('0x62')](_0xa570('0x70')));var _0x3aef50='default'+_[_0xa570('0x68')]('preferred');if(_0x1c8413[_0x3aef50]||!_0x4824b2[_0xa570('0x64')]||!_0x4824b2[_0xa570('0x5a')]){_0x1143e9=path[_0xa570('0x60')](config[_0xa570('0x61')],_0x2f7890,_['toLower'](_0xa570('0x70')));}if(!fs[_0xa570('0x5f')](_0x1143e9)){throw new db['Sequelize'][(_0xa570('0x67'))](_[_0xa570('0x68')]('preferred')+'\x20not\x20found');}return _0x220c61['download'](_0x1143e9);}})[_0xa570('0x21')](handleError(_0x220c61,null));};exports[_0xa570('0x71')]=function(_0x5f168b,_0x52782e,_0x3c5cb2){if(_0x5f168b[_0xa570('0x52')]&&_0x5f168b['file'][_0xa570('0x54')]){_0x5f168b['body'][_0xa570('0x5b')]=_0x5f168b[_0xa570('0x52')][_0xa570('0x54')];}return db[_0xa570('0x38')]['find']({'where':{'id':_0x5f168b[_0xa570('0x4d')]['id']}})['then'](handleEntityNotFound(_0x52782e,null))['then'](saveUpdates(_0x5f168b[_0xa570('0x33')],null))[_0xa570('0x16')](respondWithResult(_0x52782e,null))[_0xa570('0x21')](handleError(_0x52782e,null));};var utilLicense=require(_0xa570('0x12'));exports[_0xa570('0x72')]=function(_0x20d062,_0x204ff6,_0x1fcb18){var _0x357b7e='server/files/images/logos';var _0x3b3c61={'custom':![]};return utilLicense[_0xa570('0x58')]()[_0xa570('0x16')](function(_0x1e4024){if(_0x1e4024){_0x3b3c61=_0x1e4024;}return db[_0xa570('0x38')]['find']({'where':{'id':_0x20d062[_0xa570('0x4d')]['id']},'attributes':['logo',_0xa570('0x59'),_0xa570('0x5a'),'favicon','defaultLogo',_0xa570('0x6c'),_0xa570('0x5d'),'defaultFavicon'],'raw':!![]});})[_0xa570('0x16')](handleEntityNotFound(_0x204ff6,null))[_0xa570('0x16')](function(_0x29ebc9){if(_0x29ebc9){var _0x5a2453=_0x29ebc9[_0xa570('0x5b')]&&fs[_0xa570('0x5f')](path[_0xa570('0x60')](config[_0xa570('0x61')],_0x357b7e,_[_0xa570('0x62')](_0x29ebc9[_0xa570('0x5b')])))?path[_0xa570('0x60')](config['root'],_0x357b7e,_[_0xa570('0x62')](_0x29ebc9[_0xa570('0x5b')])):path[_0xa570('0x60')](config[_0xa570('0x61')],_0x357b7e,_['toLower'](_0xa570('0x73')));var _0x3fb7c4='default'+_[_0xa570('0x68')](_0xa570('0x5b'));if(_0x29ebc9[_0x3fb7c4]||!_0x3b3c61[_0xa570('0x64')]){_0x5a2453=path[_0xa570('0x60')](config[_0xa570('0x61')],_0x357b7e,_[_0xa570('0x62')]('default_favicon.ico'));}if(!fs[_0xa570('0x5f')](_0x5a2453)){throw new db['Sequelize'][(_0xa570('0x67'))](_[_0xa570('0x68')]('favicon')+'\x20not\x20found');}return _0x204ff6[_0xa570('0x6a')](_0x5a2453);}})['catch'](handleError(_0x204ff6,null));};exports[_0xa570('0x74')]=function(_0xdeaf2e,_0x55fd94){var _0x1a3d02={'offset':moment()[_0xa570('0x75')]()};_0x1a3d02[_0xa570('0x76')]=moment()['utcOffset'](_0x1a3d02['offset'])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x55fd94[_0xa570('0x23')](0xc8)['send'](_0x1a3d02);}; \ No newline at end of file +var _0x9280=['preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','custom','toLower','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultFavicon','default','default_loginLogo.svg','securePassword','addPreferred','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','then','sendStatus','name','send','render','body','agent','interaction','account','index','map','Setting','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','params','keys','include','options','find','file','logo','filename','addLogoLogin','loginLogo','getLogo','getLicense'];(function(_0xfbd9c2,_0x526f1d){var _0x619f6c=function(_0x403c2b){while(--_0x403c2b){_0xfbd9c2['push'](_0xfbd9c2['shift']());}};_0x619f6c(++_0x526f1d);}(_0x9280,0x113));var _0x0928=function(_0x561348,_0x3c155a){_0x561348=_0x561348-0x0;var _0x55e8e4=_0x9280[_0x561348];return _0x55e8e4;};'use strict';var emlformat=require(_0x0928('0x0'));var rimraf=require(_0x0928('0x1'));var zipdir=require(_0x0928('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0928('0x3'));var BPromise=require(_0x0928('0x4'));var Mustache=require(_0x0928('0x5'));var util=require(_0x0928('0x6'));var path=require(_0x0928('0x7'));var sox=require(_0x0928('0x8'));var csv=require('to-csv');var ejs=require(_0x0928('0x9'));var fs=require('fs');var fs_extra=require(_0x0928('0xa'));var _=require('lodash');var squel=require(_0x0928('0xb'));var crypto=require('crypto');var jsforce=require(_0x0928('0xc'));var deskjs=require(_0x0928('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0928('0xe'));var Papa=require(_0x0928('0xf'));var Redis=require('ioredis');var authService=require(_0x0928('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0928('0x11'));var hardwareService=require(_0x0928('0x12'));var logger=require(_0x0928('0x13'))(_0x0928('0x14'));var utils=require(_0x0928('0x15'));var config=require(_0x0928('0x16'));var licenseUtil=require(_0x0928('0x17'));var db=require(_0x0928('0x18'))['db'];var jayson=require(_0x0928('0x19'));var client=jayson[_0x0928('0x1a')][_0x0928('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1c9fda,_0x2e3bb7,_0x5d848a,_0x1271fb){return new BPromise(function(_0x15ed81,_0x9f0272){var _0x3042b7=_0x1271fb||client;return _0x3042b7[_0x0928('0x1c')](_0x1c9fda,_0x5d848a)['then'](function(_0x3538b2){logger[_0x0928('0x1d')]('Setting,\x20%s,\x20%s',_0x2e3bb7,_0x0928('0x1e'));logger['debug'](_0x0928('0x1f'),_0x2e3bb7,'request\x20sent',JSON['stringify'](_0x3538b2));if(_0x3538b2['error']){if(_0x3538b2[_0x0928('0x20')][_0x0928('0x21')]===0x1f4){logger['error'](_0x0928('0x22'),_0x2e3bb7,_0x3538b2[_0x0928('0x20')][_0x0928('0x23')]);return _0x9f0272(_0x3538b2[_0x0928('0x20')]['message']);}logger[_0x0928('0x20')](_0x0928('0x22'),_0x2e3bb7,_0x3538b2['error'][_0x0928('0x23')]);return _0x15ed81(_0x3538b2[_0x0928('0x20')][_0x0928('0x23')]);}else{logger['info'](_0x0928('0x22'),_0x2e3bb7,_0x0928('0x1e'));_0x15ed81(_0x3538b2[_0x0928('0x24')]['message']);}})[_0x0928('0x25')](function(_0x248ea8){logger[_0x0928('0x20')](_0x0928('0x22'),_0x2e3bb7,_0x248ea8);_0x9f0272(_0x248ea8);});});}function respondWithStatusCode(_0x1cb18b,_0x11ef40){_0x11ef40=_0x11ef40||0xcc;return function(_0x2bf292){if(_0x2bf292){return _0x1cb18b['sendStatus'](_0x11ef40);}return _0x1cb18b[_0x0928('0x26')](_0x11ef40)[_0x0928('0x27')]();};}function respondWithResult(_0x3a4574,_0x19d7fe){_0x19d7fe=_0x19d7fe||0xc8;return function(_0x3ec3bf){if(_0x3ec3bf){return _0x3a4574[_0x0928('0x26')](_0x19d7fe)[_0x0928('0x28')](_0x3ec3bf);}};}function respondWithFilteredResult(_0x1a085c,_0x15e5ad){return function(_0x4c7315){if(_0x4c7315){var _0x1bd347=typeof _0x15e5ad[_0x0928('0x29')]===_0x0928('0x2a')&&typeof _0x15e5ad['limit']===_0x0928('0x2a');var _0x457209=_0x4c7315[_0x0928('0x2b')];var _0x3d0b4f=_0x1bd347?0x0:_0x15e5ad[_0x0928('0x29')];var _0x1f1d46=_0x1bd347?_0x4c7315[_0x0928('0x2b')]:_0x15e5ad['offset']+_0x15e5ad[_0x0928('0x2c')];var _0x461225;if(_0x1f1d46>=_0x457209){_0x1f1d46=_0x457209;_0x461225=0xc8;}else{_0x461225=0xce;}_0x1a085c['status'](_0x461225);return _0x1a085c[_0x0928('0x2d')](_0x0928('0x2e'),_0x3d0b4f+'-'+_0x1f1d46+'/'+_0x457209)[_0x0928('0x28')](_0x4c7315);}return null;};}function patchUpdates(_0x291b0b){return function(_0x6aa1c){try{jsonpatch['apply'](_0x6aa1c,_0x291b0b,!![]);}catch(_0x4e77fc){return BPromise['reject'](_0x4e77fc);}return _0x6aa1c[_0x0928('0x2f')]();};}function saveUpdates(_0x5e96a6,_0x4149e5){return function(_0x502e27){if(_0x502e27){return _0x502e27[_0x0928('0x30')](_0x5e96a6)['then'](function(_0xd138c9){return _0xd138c9;});}return null;};}function removeEntity(_0x9500c,_0x30a382){return function(_0x776f74){if(_0x776f74){return _0x776f74[_0x0928('0x31')]()[_0x0928('0x32')](function(){_0x9500c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x263c67,_0x496884){return function(_0x3ddca8){if(!_0x3ddca8){_0x263c67[_0x0928('0x33')](0x194);}return _0x3ddca8;};}function handleError(_0x1db3b9,_0x6de606){_0x6de606=_0x6de606||0x1f4;return function(_0x17aebe){logger[_0x0928('0x20')](_0x17aebe['stack']);if(_0x17aebe[_0x0928('0x34')]){delete _0x17aebe[_0x0928('0x34')];}_0x1db3b9[_0x0928('0x26')](_0x6de606)[_0x0928('0x35')](_0x17aebe);};}function getMustacheRender(_0x2060e4,_0x1bc9d7){return Mustache[_0x0928('0x36')](_0x2060e4,_['merge'](_0x1bc9d7[_0x0928('0x37')],{'contact':_0x1bc9d7['contact'],'message':_0x1bc9d7[_0x0928('0x23')],'agent':_0x1bc9d7[_0x0928('0x38')],'interaction':_0x1bc9d7[_0x0928('0x39')],'account':_0x1bc9d7[_0x0928('0x3a')]}))||'';}exports[_0x0928('0x3b')]=function(_0x551e1d,_0x5bbcfa){var _0x388e0a={},_0x544c73={},_0xbc676b={'count':0x0,'rows':[]};var _0x1f7821=_[_0x0928('0x3c')](db[_0x0928('0x3d')][_0x0928('0x3e')],function(_0x407e31){return{'name':_0x407e31[_0x0928('0x3f')],'type':_0x407e31[_0x0928('0x40')][_0x0928('0x41')]};});_0x544c73['model']=_[_0x0928('0x3c')](_0x1f7821,_0x0928('0x34'));_0x544c73[_0x0928('0x42')]=_['keys'](_0x551e1d[_0x0928('0x42')]);_0x544c73[_0x0928('0x43')]=_[_0x0928('0x44')](_0x544c73[_0x0928('0x45')],_0x544c73[_0x0928('0x42')]);_0x388e0a[_0x0928('0x46')]=_[_0x0928('0x44')](_0x544c73[_0x0928('0x45')],qs['fields'](_0x551e1d['query'][_0x0928('0x47')]));_0x388e0a[_0x0928('0x46')]=_0x388e0a[_0x0928('0x46')][_0x0928('0x48')]?_0x388e0a[_0x0928('0x46')]:_0x544c73[_0x0928('0x45')];if(!_0x551e1d[_0x0928('0x42')][_0x0928('0x49')](_0x0928('0x4a'))){_0x388e0a[_0x0928('0x2c')]=qs[_0x0928('0x2c')](_0x551e1d['query'][_0x0928('0x2c')]);_0x388e0a[_0x0928('0x29')]=qs['offset'](_0x551e1d['query'][_0x0928('0x29')]);}_0x388e0a['order']=qs[_0x0928('0x4b')](_0x551e1d['query']['sort']);_0x388e0a[_0x0928('0x4c')]=qs['filters'](_['pick'](_0x551e1d[_0x0928('0x42')],_0x544c73[_0x0928('0x43')]),_0x1f7821);if(_0x551e1d[_0x0928('0x42')][_0x0928('0x4d')]){_0x388e0a['where']=_['merge'](_0x388e0a[_0x0928('0x4c')],{'$or':_[_0x0928('0x3c')](_0x1f7821,function(_0x1e015b){if(_0x1e015b[_0x0928('0x40')]!==_0x0928('0x4e')){var _0x11f738={};_0x11f738[_0x1e015b['name']]={'$like':'%'+_0x551e1d[_0x0928('0x42')][_0x0928('0x4d')]+'%'};return _0x11f738;}})});}_0x388e0a=_[_0x0928('0x4f')]({},_0x388e0a,_0x551e1d['options']);var _0x2b4838={'where':_0x388e0a[_0x0928('0x4c')]};return db['Setting'][_0x0928('0x2b')](_0x2b4838)[_0x0928('0x32')](function(_0x2f4bf2){_0xbc676b[_0x0928('0x2b')]=_0x2f4bf2;if(_0x551e1d[_0x0928('0x42')][_0x0928('0x50')]){_0x388e0a['include']=[{'all':!![]}];}return db[_0x0928('0x3d')][_0x0928('0x51')](_0x388e0a);})['then'](function(_0x1fd32d){_0xbc676b['rows']=_0x1fd32d;return _0xbc676b;})[_0x0928('0x32')](respondWithFilteredResult(_0x5bbcfa,_0x388e0a))[_0x0928('0x25')](handleError(_0x5bbcfa,null));};exports['show']=function(_0xc87b22,_0x24f2e0){var _0x4da664={'raw':![],'where':{'id':_0xc87b22[_0x0928('0x52')]['id']}},_0x5610ba={};_0x5610ba[_0x0928('0x45')]=_[_0x0928('0x53')](db[_0x0928('0x3d')][_0x0928('0x3e')]);_0x5610ba[_0x0928('0x42')]=_[_0x0928('0x53')](_0xc87b22[_0x0928('0x42')]);_0x5610ba['filters']=_[_0x0928('0x44')](_0x5610ba[_0x0928('0x45')],_0x5610ba[_0x0928('0x42')]);_0x4da664[_0x0928('0x46')]=_[_0x0928('0x44')](_0x5610ba[_0x0928('0x45')],qs[_0x0928('0x47')](_0xc87b22[_0x0928('0x42')][_0x0928('0x47')]));_0x4da664[_0x0928('0x46')]=_0x4da664[_0x0928('0x46')][_0x0928('0x48')]?_0x4da664[_0x0928('0x46')]:_0x5610ba[_0x0928('0x45')];if(_0xc87b22[_0x0928('0x42')][_0x0928('0x50')]){_0x4da664[_0x0928('0x54')]=[{'all':!![]}];}_0x4da664=_[_0x0928('0x4f')]({},_0x4da664,_0xc87b22[_0x0928('0x55')]);return db['Setting'][_0x0928('0x56')](_0x4da664)['then'](handleEntityNotFound(_0x24f2e0,null))[_0x0928('0x32')](respondWithResult(_0x24f2e0,null))['catch'](handleError(_0x24f2e0,null));};exports[_0x0928('0x30')]=function(_0x4df41c,_0x286722){if(_0x4df41c[_0x0928('0x37')]['id']){delete _0x4df41c[_0x0928('0x37')]['id'];}return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x4df41c[_0x0928('0x52')]['id']}})[_0x0928('0x32')](handleEntityNotFound(_0x286722,null))[_0x0928('0x32')](saveUpdates(_0x4df41c[_0x0928('0x37')],null))[_0x0928('0x32')](respondWithResult(_0x286722,null))[_0x0928('0x25')](handleError(_0x286722,null));};exports['addLogo']=function(_0x1151c0,_0x542f7f,_0x20785a){if(_0x1151c0[_0x0928('0x57')]&&_0x1151c0[_0x0928('0x57')]['filename']){_0x1151c0[_0x0928('0x37')][_0x0928('0x58')]=_0x1151c0[_0x0928('0x57')][_0x0928('0x59')];}return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x1151c0[_0x0928('0x52')]['id']}})[_0x0928('0x32')](handleEntityNotFound(_0x542f7f,null))['then'](saveUpdates(_0x1151c0[_0x0928('0x37')],null))['then'](respondWithResult(_0x542f7f,null))['catch'](handleError(_0x542f7f,null));};exports[_0x0928('0x5a')]=function(_0x1816c6,_0x345ace,_0x32795d){if(_0x1816c6[_0x0928('0x57')]&&_0x1816c6[_0x0928('0x57')]['filename']){_0x1816c6[_0x0928('0x37')][_0x0928('0x5b')]=_0x1816c6[_0x0928('0x57')]['filename'];}return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x1816c6[_0x0928('0x52')]['id']}})[_0x0928('0x32')](handleEntityNotFound(_0x345ace,null))[_0x0928('0x32')](saveUpdates(_0x1816c6['body'],null))['then'](respondWithResult(_0x345ace,null))[_0x0928('0x25')](handleError(_0x345ace,null));};var utilLicense=require('../../config/license/util');exports[_0x0928('0x5c')]=function(_0x46a1d3,_0x385594,_0x26a416){var _0x419b97='server/files/images/logos';var _0x1dd9c6={'custom':![]};return utilLicense[_0x0928('0x5d')]()['then'](function(_0x57f43b){if(_0x57f43b){_0x1dd9c6=_0x57f43b;}return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x46a1d3[_0x0928('0x52')]['id']},'attributes':[_0x0928('0x58'),'loginLogo',_0x0928('0x5e'),_0x0928('0x5f'),_0x0928('0x60'),_0x0928('0x61'),_0x0928('0x62'),'defaultFavicon'],'raw':!![]});})[_0x0928('0x32')](handleEntityNotFound(_0x385594,null))[_0x0928('0x32')](function(_0x3e0fa2){if(_0x3e0fa2){var _0x4a0a43=_0x3e0fa2[_0x0928('0x58')]&&fs[_0x0928('0x63')](path[_0x0928('0x64')](config['root'],_0x419b97,_['toLower'](_0x3e0fa2[_0x0928('0x58')])))?path[_0x0928('0x64')](config[_0x0928('0x65')],_0x419b97,_['toLower'](_0x3e0fa2[_0x0928('0x58')])):path[_0x0928('0x64')](config['root'],_0x419b97,_['toLower']('default_logo.svg'));var _0x3367ce='default'+_['upperFirst']('logo');if(_0x3e0fa2[_0x3367ce]||!_0x1dd9c6[_0x0928('0x66')]){_0x4a0a43=path[_0x0928('0x64')](config[_0x0928('0x65')],_0x419b97,_[_0x0928('0x67')](_0x0928('0x68')));}if(!fs[_0x0928('0x63')](_0x4a0a43)){throw new db[(_0x0928('0x69'))][(_0x0928('0x6a'))](_[_0x0928('0x6b')](_0x0928('0x58'))+_0x0928('0x6c'));}return _0x385594[_0x0928('0x6d')](_0x4a0a43);}})[_0x0928('0x25')](handleError(_0x385594,null));};var utilLicense=require(_0x0928('0x17'));exports[_0x0928('0x6e')]=function(_0x978ffa,_0x4b79ef,_0x52141e){var _0x5d1dd2=_0x0928('0x6f');var _0x140858={'custom':![]};return utilLicense[_0x0928('0x5d')]()[_0x0928('0x32')](function(_0xe21085){if(_0xe21085){_0x140858=_0xe21085;}return db['Setting'][_0x0928('0x56')]({'where':{'id':_0x978ffa[_0x0928('0x52')]['id']},'attributes':[_0x0928('0x58'),'loginLogo',_0x0928('0x5e'),'favicon',_0x0928('0x60'),'defaultLoginLogo','defaultPreferred',_0x0928('0x70')],'raw':!![]});})[_0x0928('0x32')](handleEntityNotFound(_0x4b79ef,null))[_0x0928('0x32')](function(_0x4ab38b){if(_0x4ab38b){var _0x200e66=_0x4ab38b[_0x0928('0x5b')]&&fs[_0x0928('0x63')](path[_0x0928('0x64')](config[_0x0928('0x65')],_0x5d1dd2,_['toLower'](_0x4ab38b[_0x0928('0x5b')])))?path[_0x0928('0x64')](config['root'],_0x5d1dd2,_[_0x0928('0x67')](_0x4ab38b[_0x0928('0x5b')])):path[_0x0928('0x64')](config[_0x0928('0x65')],_0x5d1dd2,_[_0x0928('0x67')]('default_loginLogo.svg'));var _0x4c1f64=_0x0928('0x71')+_[_0x0928('0x6b')](_0x0928('0x5b'));if(_0x4ab38b[_0x4c1f64]||!_0x140858[_0x0928('0x66')]){_0x200e66=path['join'](config['root'],_0x5d1dd2,_['toLower'](_0x0928('0x72')));}if(!fs[_0x0928('0x63')](_0x200e66)){throw new db[(_0x0928('0x69'))][(_0x0928('0x6a'))](_['upperFirst'](_0x0928('0x5b'))+_0x0928('0x6c'));}return _0x4b79ef['download'](_0x200e66);}})['catch'](handleError(_0x4b79ef,null));};exports['gdpr']=function(_0x3ea4d7,_0x4116f4){return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x3ea4d7[_0x0928('0x52')]['id']},'attributes':[_0x0928('0x73')]})[_0x0928('0x32')](respondWithResult(_0x4116f4,null))[_0x0928('0x25')](handleError(_0x4116f4,null));};exports[_0x0928('0x74')]=function(_0x3204e2,_0x4bbe3c,_0x3dd282){if(_0x3204e2['file']&&_0x3204e2['file'][_0x0928('0x59')]){_0x3204e2[_0x0928('0x37')][_0x0928('0x5e')]=_0x3204e2[_0x0928('0x57')][_0x0928('0x59')];}return db['Setting'][_0x0928('0x56')]({'where':{'id':_0x3204e2[_0x0928('0x52')]['id']}})[_0x0928('0x32')](handleEntityNotFound(_0x4bbe3c,null))[_0x0928('0x32')](saveUpdates(_0x3204e2[_0x0928('0x37')],null))[_0x0928('0x32')](respondWithResult(_0x4bbe3c,null))['catch'](handleError(_0x4bbe3c,null));};var utilLicense=require(_0x0928('0x17'));exports['getPreferred']=function(_0x182260,_0x557291,_0x5c8463){var _0x367abc='server/files/images/logos';var _0x3a3166={'custom':![]};return utilLicense[_0x0928('0x5d')]()['then'](function(_0x3da125){if(_0x3da125){_0x3a3166=_0x3da125;}return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x182260[_0x0928('0x52')]['id']},'attributes':[_0x0928('0x58'),'loginLogo','preferred',_0x0928('0x5f'),_0x0928('0x60'),'defaultLoginLogo',_0x0928('0x62'),_0x0928('0x70')],'raw':!![]});})['then'](handleEntityNotFound(_0x557291,null))[_0x0928('0x32')](function(_0x4a537e){if(_0x4a537e){var _0x1f0999=_0x4a537e[_0x0928('0x5e')]&&fs[_0x0928('0x63')](path[_0x0928('0x64')](config[_0x0928('0x65')],_0x367abc,_[_0x0928('0x67')](_0x4a537e['preferred'])))?path[_0x0928('0x64')](config[_0x0928('0x65')],_0x367abc,_[_0x0928('0x67')](_0x4a537e[_0x0928('0x5e')])):path[_0x0928('0x64')](config['root'],_0x367abc,_[_0x0928('0x67')]('default_preferred.png'));var _0x3b66d4=_0x0928('0x71')+_['upperFirst'](_0x0928('0x5e'));if(_0x4a537e[_0x3b66d4]||!_0x3a3166[_0x0928('0x66')]||!_0x3a3166['preferred']){_0x1f0999=path[_0x0928('0x64')](config['root'],_0x367abc,_[_0x0928('0x67')]('default_preferred.png'));}if(!fs['existsSync'](_0x1f0999)){throw new db[(_0x0928('0x69'))][(_0x0928('0x6a'))](_[_0x0928('0x6b')](_0x0928('0x5e'))+'\x20not\x20found');}return _0x557291['download'](_0x1f0999);}})[_0x0928('0x25')](handleError(_0x557291,null));};exports[_0x0928('0x75')]=function(_0x3dd3b4,_0x8c5d63,_0x417f31){if(_0x3dd3b4['file']&&_0x3dd3b4['file']['filename']){_0x3dd3b4[_0x0928('0x37')][_0x0928('0x5f')]=_0x3dd3b4[_0x0928('0x57')][_0x0928('0x59')];}return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x3dd3b4[_0x0928('0x52')]['id']}})[_0x0928('0x32')](handleEntityNotFound(_0x8c5d63,null))[_0x0928('0x32')](saveUpdates(_0x3dd3b4[_0x0928('0x37')],null))[_0x0928('0x32')](respondWithResult(_0x8c5d63,null))[_0x0928('0x25')](handleError(_0x8c5d63,null));};var utilLicense=require(_0x0928('0x17'));exports[_0x0928('0x76')]=function(_0x15a60c,_0x3439a4,_0x2107d1){var _0x135cb4=_0x0928('0x6f');var _0x212f73={'custom':![]};return utilLicense['getLicense']()[_0x0928('0x32')](function(_0x43196d){if(_0x43196d){_0x212f73=_0x43196d;}return db[_0x0928('0x3d')][_0x0928('0x56')]({'where':{'id':_0x15a60c['params']['id']},'attributes':[_0x0928('0x58'),_0x0928('0x5b'),_0x0928('0x5e'),_0x0928('0x5f'),_0x0928('0x60'),_0x0928('0x61'),_0x0928('0x62'),'defaultFavicon'],'raw':!![]});})[_0x0928('0x32')](handleEntityNotFound(_0x3439a4,null))[_0x0928('0x32')](function(_0x3a6bb7){if(_0x3a6bb7){var _0x2d6d6c=_0x3a6bb7[_0x0928('0x5f')]&&fs[_0x0928('0x63')](path[_0x0928('0x64')](config['root'],_0x135cb4,_[_0x0928('0x67')](_0x3a6bb7['favicon'])))?path['join'](config[_0x0928('0x65')],_0x135cb4,_[_0x0928('0x67')](_0x3a6bb7[_0x0928('0x5f')])):path[_0x0928('0x64')](config['root'],_0x135cb4,_[_0x0928('0x67')](_0x0928('0x77')));var _0x1ee538='default'+_[_0x0928('0x6b')]('favicon');if(_0x3a6bb7[_0x1ee538]||!_0x212f73['custom']){_0x2d6d6c=path[_0x0928('0x64')](config[_0x0928('0x65')],_0x135cb4,_[_0x0928('0x67')]('default_favicon.ico'));}if(!fs['existsSync'](_0x2d6d6c)){throw new db[(_0x0928('0x69'))]['ValidationError'](_[_0x0928('0x6b')](_0x0928('0x5f'))+_0x0928('0x6c'));}return _0x3439a4[_0x0928('0x6d')](_0x2d6d6c);}})['catch'](handleError(_0x3439a4,null));};exports['getDate']=function(_0x44b0c7,_0x37a011){var _0xa4cce4={'offset':moment()[_0x0928('0x78')]()};_0xa4cce4[_0x0928('0x79')]=moment()[_0x0928('0x78')](_0xa4cce4[_0x0928('0x29')])['format'](_0x0928('0x7a'));return _0x37a011['status'](0xc8)[_0x0928('0x35')](_0xa4cce4);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9aaea1a..452058d 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x105a=['api','moment','request-promise','path','../../config/environment','exports','define','Setting','settings','lodash','util','../../config/logger'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x105a,0x1a1));var _0xa105=function(_0x1b6c89,_0x389b15){_0x1b6c89=_0x1b6c89-0x0;var _0x17a8d9=_0x105a[_0x1b6c89];return _0x17a8d9;};'use strict';var _=require(_0xa105('0x0'));var util=require(_0xa105('0x1'));var logger=require(_0xa105('0x2'))(_0xa105('0x3'));var moment=require(_0xa105('0x4'));var BPromise=require('bluebird');var rp=require(_0xa105('0x5'));var fs=require('fs');var path=require(_0xa105('0x6'));var rimraf=require('rimraf');var config=require(_0xa105('0x7'));var attributes=require('./setting.attributes');module[_0xa105('0x8')]=function(_0x2816a8,_0x3f5db5){return _0x2816a8[_0xa105('0x9')](_0xa105('0xa'),attributes,{'tableName':_0xa105('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb0=['request-promise','rimraf','../../config/environment','./setting.attributes','exports','Setting','settings','lodash','../../config/logger','moment','bluebird'];(function(_0x573e2b,_0x477138){var _0x26189f=function(_0x1c9471){while(--_0x1c9471){_0x573e2b['push'](_0x573e2b['shift']());}};_0x26189f(++_0x477138);}(_0x2eb0,0x1bf));var _0x02eb=function(_0x2a152b,_0x3e20b3){_0x2a152b=_0x2a152b-0x0;var _0x5ef3c3=_0x2eb0[_0x2a152b];return _0x5ef3c3;};'use strict';var _=require(_0x02eb('0x0'));var util=require('util');var logger=require(_0x02eb('0x1'))('api');var moment=require(_0x02eb('0x2'));var BPromise=require(_0x02eb('0x3'));var rp=require(_0x02eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02eb('0x5'));var config=require(_0x02eb('0x6'));var attributes=require(_0x02eb('0x7'));module[_0x02eb('0x8')]=function(_0x14de73,_0x5806ac){return _0x14de73['define'](_0x02eb('0x9'),attributes,{'tableName':_0x02eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index b8e92c1..a00e475 100644 --- a/server/api/setting/setting.rpc.js +++ b/server/api/setting/setting.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6181=['../../config/environment','jayson/promise','client','request','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','Setting','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x299309,_0x4067f1){var _0x247738=function(_0x108b6f){while(--_0x108b6f){_0x299309['push'](_0x299309['shift']());}};_0x247738(++_0x4067f1);}(_0x6181,0xd1));var _0x1618=function(_0x1aeb39,_0x2e8404){_0x1aeb39=_0x1aeb39-0x0;var _0x439790=_0x6181[_0x1aeb39];return _0x439790;};'use strict';var _=require(_0x1618('0x0'));var util=require(_0x1618('0x1'));var moment=require(_0x1618('0x2'));var BPromise=require(_0x1618('0x3'));var rs=require(_0x1618('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1618('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1618('0x6'))(_0x1618('0x7'));var config=require(_0x1618('0x8'));var jayson=require(_0x1618('0x9'));var client=jayson[_0x1618('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3126d3,_0x4a3725,_0x5ec522){return new BPromise(function(_0xde53cf,_0x2fc26c){return client[_0x1618('0xb')](_0x3126d3,_0x5ec522)['then'](function(_0x5ea66b){logger[_0x1618('0xc')]('Setting,\x20%s,\x20%s',_0x4a3725,'request\x20sent');logger[_0x1618('0xd')](_0x1618('0xe'),_0x4a3725,_0x1618('0xf'),JSON[_0x1618('0x10')](_0x5ea66b));if(_0x5ea66b[_0x1618('0x11')]){if(_0x5ea66b[_0x1618('0x11')][_0x1618('0x12')]===0x1f4){logger[_0x1618('0x11')](_0x1618('0x13'),_0x4a3725,_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);return _0x2fc26c(_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);}logger[_0x1618('0x11')](_0x1618('0x13'),_0x4a3725,_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);return _0xde53cf(_0x5ea66b[_0x1618('0x11')][_0x1618('0x14')]);}else{logger['info'](_0x1618('0x13'),_0x4a3725,'request\x20sent');_0xde53cf(_0x5ea66b[_0x1618('0x15')][_0x1618('0x14')]);}})[_0x1618('0x16')](function(_0x3873bd){logger['error'](_0x1618('0x13'),_0x4a3725,_0x3873bd);_0x2fc26c(_0x3873bd);});});}exports['ShowSetting']=function(_0x161e80){var _0x524034=this;return new Promise(function(_0x5ca053,_0x56eced){return db[_0x1618('0x17')]['find']({'raw':_0x161e80[_0x1618('0x18')]?_0x161e80['options']['raw']===undefined?!![]:![]:!![],'where':_0x161e80[_0x1618('0x18')]?_0x161e80['options'][_0x1618('0x19')]||null:null,'attributes':_0x161e80[_0x1618('0x18')]?_0x161e80['options'][_0x1618('0x1a')]||null:null,'include':_0x161e80['options']?_0x161e80['options'][_0x1618('0x1b')]?_[_0x1618('0x1c')](_0x161e80[_0x1618('0x18')][_0x1618('0x1b')],function(_0x16701c){return{'model':db[_0x16701c[_0x1618('0x1d')]],'as':_0x16701c['as'],'attributes':_0x16701c[_0x1618('0x1a')],'include':_0x16701c['include']?_[_0x1618('0x1c')](_0x16701c[_0x1618('0x1b')],function(_0x45beb7){return{'model':db[_0x45beb7[_0x1618('0x1d')]],'as':_0x45beb7['as'],'attributes':_0x45beb7[_0x1618('0x1a')],'include':_0x45beb7[_0x1618('0x1b')]?_[_0x1618('0x1c')](_0x45beb7['include'],function(_0x1bfbfe){return{'model':db[_0x1bfbfe[_0x1618('0x1d')]],'as':_0x1bfbfe['as'],'attributes':_0x1bfbfe[_0x1618('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x257370){logger[_0x1618('0xc')](_0x1618('0x1e'),_0x161e80);logger[_0x1618('0xd')](_0x1618('0x1e'),_0x161e80,JSON['stringify'](_0x257370));_0x5ca053(_0x257370);})[_0x1618('0x16')](function(_0x725c83){logger[_0x1618('0x11')]('ShowSetting',_0x725c83[_0x1618('0x14')],_0x161e80);_0x56eced(_0x524034[_0x1618('0x11')](0x1f4,_0x725c83[_0x1618('0x14')]));});});}; \ No newline at end of file +var _0x7d35=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSetting','options','where','attributes','include','map','model','then','stringify'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x7d35,0xa2));var _0x57d3=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x7d35[_0x4c5c97];return _0xd5d2cb;};'use strict';var _=require(_0x57d3('0x0'));var util=require(_0x57d3('0x1'));var moment=require('moment');var BPromise=require(_0x57d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57d3('0x3'));var db=require(_0x57d3('0x4'))['db'];var utils=require(_0x57d3('0x5'));var logger=require(_0x57d3('0x6'))('rpc');var config=require(_0x57d3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x57d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58c12b,_0x33b9a4,_0xb2d920){return new BPromise(function(_0x4511c5,_0x538f8a){return client['request'](_0x58c12b,_0xb2d920)['then'](function(_0x274542){logger[_0x57d3('0x9')](_0x57d3('0xa'),_0x33b9a4,_0x57d3('0xb'));logger[_0x57d3('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x33b9a4,'request\x20sent',JSON['stringify'](_0x274542));if(_0x274542[_0x57d3('0xd')]){if(_0x274542[_0x57d3('0xd')][_0x57d3('0xe')]===0x1f4){logger[_0x57d3('0xd')](_0x57d3('0xa'),_0x33b9a4,_0x274542['error'][_0x57d3('0xf')]);return _0x538f8a(_0x274542[_0x57d3('0xd')]['message']);}logger['error'](_0x57d3('0xa'),_0x33b9a4,_0x274542['error']['message']);return _0x4511c5(_0x274542['error'][_0x57d3('0xf')]);}else{logger[_0x57d3('0x9')](_0x57d3('0xa'),_0x33b9a4,_0x57d3('0xb'));_0x4511c5(_0x274542[_0x57d3('0x10')][_0x57d3('0xf')]);}})[_0x57d3('0x11')](function(_0x43348d){logger[_0x57d3('0xd')](_0x57d3('0xa'),_0x33b9a4,_0x43348d);_0x538f8a(_0x43348d);});});}exports[_0x57d3('0x12')]=function(_0x4edadc){var _0xf2f2e6=this;return new Promise(function(_0x82598e,_0x26a2de){return db['Setting']['find']({'raw':_0x4edadc['options']?_0x4edadc['options']['raw']===undefined?!![]:![]:!![],'where':_0x4edadc[_0x57d3('0x13')]?_0x4edadc[_0x57d3('0x13')][_0x57d3('0x14')]||null:null,'attributes':_0x4edadc[_0x57d3('0x13')]?_0x4edadc[_0x57d3('0x13')][_0x57d3('0x15')]||null:null,'include':_0x4edadc[_0x57d3('0x13')]?_0x4edadc['options'][_0x57d3('0x16')]?_[_0x57d3('0x17')](_0x4edadc[_0x57d3('0x13')]['include'],function(_0x1b729d){return{'model':db[_0x1b729d['model']],'as':_0x1b729d['as'],'attributes':_0x1b729d['attributes'],'include':_0x1b729d[_0x57d3('0x16')]?_[_0x57d3('0x17')](_0x1b729d['include'],function(_0x520444){return{'model':db[_0x520444[_0x57d3('0x18')]],'as':_0x520444['as'],'attributes':_0x520444[_0x57d3('0x15')],'include':_0x520444[_0x57d3('0x16')]?_[_0x57d3('0x17')](_0x520444[_0x57d3('0x16')],function(_0x239b65){return{'model':db[_0x239b65['model']],'as':_0x239b65['as'],'attributes':_0x239b65['attributes']};}):[]};}):[]};}):[]:[]})[_0x57d3('0x19')](function(_0x2f63fe){logger[_0x57d3('0x9')](_0x57d3('0x12'),_0x4edadc);logger[_0x57d3('0xc')](_0x57d3('0x12'),_0x4edadc,JSON[_0x57d3('0x1a')](_0x2f63fe));_0x82598e(_0x2f63fe);})[_0x57d3('0x11')](function(_0x312cce){logger[_0x57d3('0xd')]('ShowSetting',_0x312cce[_0x57d3('0xf')],_0x4edadc);_0x26a2de(_0xf2f2e6[_0x57d3('0xd')](0x1f4,_0x312cce[_0x57d3('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4fd3d76..61dd5cb 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97e1=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','addDisposition','addAnswer','addApplications','/:id/send','status','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x97e1,0x1dd));var _0x197e=function(_0x489c95,_0x53159c){_0x489c95=_0x489c95-0x0;var _0x10e7a7=_0x97e1[_0x489c95];return _0x10e7a7;};'use strict';var multer=require(_0x197e('0x0'));var util=require('util');var path=require(_0x197e('0x1'));var timeout=require(_0x197e('0x2'));var express=require(_0x197e('0x3'));var router=express[_0x197e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x197e('0x5'));var interaction=require(_0x197e('0x6'));var config=require(_0x197e('0x7'));var controller=require(_0x197e('0x8'));router[_0x197e('0x9')]('/',auth[_0x197e('0xa')](),controller['index']);router['get'](_0x197e('0xb'),auth[_0x197e('0xa')](),controller['describe']);router[_0x197e('0x9')](_0x197e('0xc'),auth[_0x197e('0xa')](),controller[_0x197e('0xd')]);router[_0x197e('0x9')](_0x197e('0xe'),auth[_0x197e('0xa')](),controller[_0x197e('0xf')]);router[_0x197e('0x9')](_0x197e('0x10'),auth['isAuthenticated'](),controller[_0x197e('0x11')]);router[_0x197e('0x9')](_0x197e('0x12'),auth['isAuthenticated'](),controller[_0x197e('0x13')]);router[_0x197e('0x9')](_0x197e('0x14'),auth[_0x197e('0xa')](),controller[_0x197e('0x15')]);router[_0x197e('0x9')](_0x197e('0x16'),controller[_0x197e('0x17')]);router[_0x197e('0x9')](_0x197e('0x18'),auth[_0x197e('0xa')](),controller['getAgents']);router[_0x197e('0x19')]('/',auth[_0x197e('0xa')](),controller['create']);router[_0x197e('0x19')](_0x197e('0xe'),auth[_0x197e('0xa')](),controller[_0x197e('0x1a')]);router[_0x197e('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x197e('0x1b')]);router[_0x197e('0x19')]('/:id/notify',controller['notify']);router[_0x197e('0x19')](_0x197e('0x12'),auth['isAuthenticated'](),controller[_0x197e('0x1c')]);router[_0x197e('0x19')](_0x197e('0x1d'),auth[_0x197e('0xa')](),controller['send']);router[_0x197e('0x19')](_0x197e('0x16'),controller[_0x197e('0x1e')]);router[_0x197e('0x19')]('/:id/users',auth[_0x197e('0xa')](),controller[_0x197e('0x1f')]);router['put'](_0x197e('0xc'),auth[_0x197e('0xa')](),controller[_0x197e('0x20')]);router[_0x197e('0x21')](_0x197e('0xc'),auth['isAuthenticated'](),controller[_0x197e('0x22')]);router[_0x197e('0x21')](_0x197e('0xe'),auth[_0x197e('0xa')](),controller[_0x197e('0x23')]);router[_0x197e('0x21')](_0x197e('0x10'),auth[_0x197e('0xa')](),controller[_0x197e('0x24')]);router[_0x197e('0x21')](_0x197e('0x18'),auth[_0x197e('0xa')](),controller[_0x197e('0x25')]);module['exports']=router; \ No newline at end of file +var _0x51cd=['isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3465ff,_0x3de250){var _0x4ef355=function(_0x1b2c57){while(--_0x1b2c57){_0x3465ff['push'](_0x3465ff['shift']());}};_0x4ef355(++_0x3de250);}(_0x51cd,0x77));var _0xd51c=function(_0x4b6feb,_0x158c73){_0x4b6feb=_0x4b6feb-0x0;var _0x749123=_0x51cd[_0x4b6feb];return _0x749123;};'use strict';var multer=require(_0xd51c('0x0'));var util=require(_0xd51c('0x1'));var path=require('path');var timeout=require(_0xd51c('0x2'));var express=require(_0xd51c('0x3'));var router=express[_0xd51c('0x4')]();var fs_extra=require(_0xd51c('0x5'));var auth=require(_0xd51c('0x6'));var interaction=require(_0xd51c('0x7'));var config=require(_0xd51c('0x8'));var controller=require('./smsAccount.controller');router[_0xd51c('0x9')]('/',auth[_0xd51c('0xa')](),controller[_0xd51c('0xb')]);router[_0xd51c('0x9')](_0xd51c('0xc'),auth['isAuthenticated'](),controller[_0xd51c('0xd')]);router[_0xd51c('0x9')](_0xd51c('0xe'),auth[_0xd51c('0xa')](),controller['show']);router[_0xd51c('0x9')](_0xd51c('0xf'),auth[_0xd51c('0xa')](),controller['getDispositions']);router[_0xd51c('0x9')](_0xd51c('0x10'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x11')]);router[_0xd51c('0x9')](_0xd51c('0x12'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x13')]);router[_0xd51c('0x9')]('/:id/interactions',auth[_0xd51c('0xa')](),controller[_0xd51c('0x14')]);router[_0xd51c('0x9')](_0xd51c('0x15'),controller[_0xd51c('0x16')]);router[_0xd51c('0x9')](_0xd51c('0x17'),auth[_0xd51c('0xa')](),controller['getAgents']);router['post']('/',auth[_0xd51c('0xa')](),controller[_0xd51c('0x18')]);router[_0xd51c('0x19')](_0xd51c('0xf'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x1a')]);router[_0xd51c('0x19')](_0xd51c('0x10'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x1b')]);router['post'](_0xd51c('0x1c'),controller[_0xd51c('0x1d')]);router['post'](_0xd51c('0x12'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x1e')]);router[_0xd51c('0x19')](_0xd51c('0x1f'),auth['isAuthenticated'](),controller[_0xd51c('0x20')]);router['post'](_0xd51c('0x15'),controller[_0xd51c('0x21')]);router['post'](_0xd51c('0x17'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x22')]);router[_0xd51c('0x23')](_0xd51c('0xe'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x24')]);router[_0xd51c('0x25')](_0xd51c('0xe'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x26')]);router[_0xd51c('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd51c('0x27')]);router[_0xd51c('0x25')](_0xd51c('0x10'),auth[_0xd51c('0xa')](),controller[_0xd51c('0x28')]);router[_0xd51c('0x25')](_0xd51c('0x17'),auth['isAuthenticated'](),controller[_0xd51c('0x29')]);module[_0xd51c('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 31abee6..0563350 100644 --- a/server/api/smsAccount/smsAccount.attributes.js +++ b/server/api/smsAccount/smsAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9af1=['clicksend','plivo','bandwidth','csc','infobip','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','randomstring','exports','name','STRING','twilio','skebby','connectel'];(function(_0x2e36a8,_0x4adb6e){var _0x74aaa2=function(_0x1e4278){while(--_0x1e4278){_0x2e36a8['push'](_0x2e36a8['shift']());}};_0x74aaa2(++_0x4adb6e);}(_0x9af1,0x68));var _0x19af=function(_0x1a3fd3,_0x460440){_0x1a3fd3=_0x1a3fd3-0x0;var _0x28f220=_0x9af1[_0x1a3fd3];return _0x28f220;};'use strict';var Sequelize=require(_0x19af('0x0'));var rs=require(_0x19af('0x1'));module[_0x19af('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x19af('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x19af('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x19af('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x19af('0x4')]},'type':{'type':Sequelize['ENUM'](_0x19af('0x5'),_0x19af('0x6'),_0x19af('0x7'),_0x19af('0x8'),_0x19af('0x9'),'clickatell',_0x19af('0xa'),_0x19af('0xb'),_0x19af('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x19af('0x4')]},'authId':{'type':Sequelize[_0x19af('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x19af('0x4')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x19af('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x19af('0x4')]},'senderString':{'type':Sequelize[_0x19af('0x4')]},'deliveryReport':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x19af('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x19af('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x19af('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x19af('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x19af('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1c2ac2){if(!_0x1c2ac2)this[_0x19af('0xf')]('mandatoryDispositionPauseId',null);this[_0x19af('0xf')]('mandatoryDisposition',_0x1c2ac2);}}}; \ No newline at end of file +var _0x1e9c=['clicksend','plivo','clickatell','bandwidth','csc','intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel'];(function(_0x53fe10,_0x1a741b){var _0x405764=function(_0x33c776){while(--_0x33c776){_0x53fe10['push'](_0x53fe10['shift']());}};_0x405764(++_0x1a741b);}(_0x1e9c,0x1d9));var _0xc1e9=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x1e9c[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0xc1e9('0x0'));var rs=require(_0xc1e9('0x1'));module[_0xc1e9('0x2')]={'name':{'type':Sequelize[_0xc1e9('0x3')],'unique':_0xc1e9('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc1e9('0x3')],'defaultValue':function(){return rs[_0xc1e9('0x5')]();}},'phone':{'type':Sequelize[_0xc1e9('0x3')]},'type':{'type':Sequelize[_0xc1e9('0x6')](_0xc1e9('0x7'),_0xc1e9('0x8'),_0xc1e9('0x9'),_0xc1e9('0xa'),_0xc1e9('0xb'),_0xc1e9('0xc'),_0xc1e9('0xd'),_0xc1e9('0xe'),'infobip',_0xc1e9('0xf'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xc1e9('0x3')]},'authToken':{'type':Sequelize[_0xc1e9('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc1e9('0x3')]},'password':{'type':Sequelize[_0xc1e9('0x3')]},'apiKey':{'type':Sequelize[_0xc1e9('0x3')]},'applicationId':{'type':Sequelize[_0xc1e9('0x3')]},'accountId':{'type':Sequelize[_0xc1e9('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc1e9('0x10');}},'notificationSound':{'type':Sequelize[_0xc1e9('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc1e9('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1e9('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc1e9('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1e9('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc1e9('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc1e9('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc1e9('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xc1e9('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e873b){if(!_0x3e873b)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xc1e9('0x14'),_0x3e873b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 50e79fa..5082320 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6d8=['squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','message','result','SmsAccount,\x20%s,\x20%s','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','render','body','contact','agent','interaction','account','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','filters','intersection','attributes','length','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','keys','fields','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','applications','priority','asc','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','bandwidth','intelepeer','refid','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','Contacts','spread','created','autoclose','push','close','*,*,*,*','SmsMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','SmsInteraction','Owner','fullname','internal','Tag','Tags','color','tag','DESC','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','redif','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','DELIVERED_TO_GATEWAY','ACCEPTD','statusGet','message-id','state','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x21bef5,_0x27b94a){_0x21bef5=_0x21bef5-0x0;var _0x524300=_0xc6d8[_0x21bef5];return _0x524300;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8c6d('0x16')]=_[_0x8c6d('0x17')](config[_0x8c6d('0x16')],{'host':_0x8c6d('0x18'),'port':0x18eb});var socket=require(_0x8c6d('0x19'))(new Redis(config[_0x8c6d('0x16')]));require(_0x8c6d('0x1a'))[_0x8c6d('0x1b')](socket);var jayson=require(_0x8c6d('0x1c'));var client=jayson[_0x8c6d('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x16c6b5,_0x4b2bb1,_0x16af06,_0x4dd4b6){return new BPromise(function(_0x150a16,_0x3d95a6){var _0x52ed7b=_0x4dd4b6||client;return _0x52ed7b[_0x8c6d('0x1e')](_0x16c6b5,_0x16af06)[_0x8c6d('0x1f')](function(_0x51a5fa){logger[_0x8c6d('0x20')]('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,'request\x20sent');logger[_0x8c6d('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b2bb1,_0x8c6d('0x22'),JSON[_0x8c6d('0x23')](_0x51a5fa));if(_0x51a5fa[_0x8c6d('0x24')]){if(_0x51a5fa[_0x8c6d('0x24')][_0x8c6d('0x25')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,_0x51a5fa['error'][_0x8c6d('0x26')]);return _0x3d95a6(_0x51a5fa['error'][_0x8c6d('0x26')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,_0x51a5fa[_0x8c6d('0x24')][_0x8c6d('0x26')]);return _0x150a16(_0x51a5fa['error']['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x4b2bb1,_0x8c6d('0x22'));_0x150a16(_0x51a5fa[_0x8c6d('0x27')][_0x8c6d('0x26')]);}})['catch'](function(_0x41c904){logger['error'](_0x8c6d('0x28'),_0x4b2bb1,_0x41c904);_0x3d95a6(_0x41c904);});});}function respondWithStatusCode(_0x490b46,_0x23c893){_0x23c893=_0x23c893||0xcc;return function(_0xba50cf){if(_0xba50cf){return _0x490b46[_0x8c6d('0x29')](_0x23c893);}return _0x490b46[_0x8c6d('0x2a')](_0x23c893)[_0x8c6d('0x2b')]();};}function respondWithResult(_0x3e3cd3,_0x9c269d){_0x9c269d=_0x9c269d||0xc8;return function(_0x41957d){if(_0x41957d){return _0x3e3cd3[_0x8c6d('0x2a')](_0x9c269d)['json'](_0x41957d);}};}function respondWithFilteredResult(_0x544143,_0x342d8e){return function(_0x93a094){if(_0x93a094){var _0xfc6000=typeof _0x342d8e[_0x8c6d('0x2c')]===_0x8c6d('0x2d')&&typeof _0x342d8e[_0x8c6d('0x2e')]===_0x8c6d('0x2d');var _0x2d028f=_0x93a094[_0x8c6d('0x2f')];var _0x43d70c=_0xfc6000?0x0:_0x342d8e[_0x8c6d('0x2c')];var _0x15a508=_0xfc6000?_0x93a094['count']:_0x342d8e[_0x8c6d('0x2c')]+_0x342d8e[_0x8c6d('0x2e')];var _0x373839;if(_0x15a508>=_0x2d028f){_0x15a508=_0x2d028f;_0x373839=0xc8;}else{_0x373839=0xce;}_0x544143[_0x8c6d('0x2a')](_0x373839);return _0x544143[_0x8c6d('0x30')](_0x8c6d('0x31'),_0x43d70c+'-'+_0x15a508+'/'+_0x2d028f)[_0x8c6d('0x32')](_0x93a094);}return null;};}function patchUpdates(_0x1857f9){return function(_0x247448){try{jsonpatch['apply'](_0x247448,_0x1857f9,!![]);}catch(_0x46d443){return BPromise['reject'](_0x46d443);}return _0x247448[_0x8c6d('0x33')]();};}function saveUpdates(_0x71f0ed,_0xa81460){return function(_0x331573){if(_0x331573){return _0x331573[_0x8c6d('0x34')](_0x71f0ed)[_0x8c6d('0x1f')](function(_0x57d419){return _0x57d419;});}return null;};}function removeEntity(_0x5ae56b,_0x3731ab){return function(_0x2b7ca7){if(_0x2b7ca7){return _0x2b7ca7[_0x8c6d('0x35')]()[_0x8c6d('0x1f')](function(){var _0x5638f4=_0x2b7ca7[_0x8c6d('0x36')]({'plain':!![]});var _0x466f37=_0x8c6d('0x37');return db[_0x8c6d('0x38')][_0x8c6d('0x35')]({'where':{'type':_0x466f37,'resourceId':_0x5638f4['id']}})[_0x8c6d('0x1f')](function(){return _0x2b7ca7;});})['then'](function(){_0x5ae56b[_0x8c6d('0x2a')](0xcc)[_0x8c6d('0x2b')]();});}};}function handleEntityNotFound(_0x1349be,_0x2ef932){return function(_0xff4b5b){if(!_0xff4b5b){_0x1349be[_0x8c6d('0x29')](0x194);}return _0xff4b5b;};}function handleError(_0x40f3a5,_0x301332){_0x301332=_0x301332||0x1f4;return function(_0x24200c){logger[_0x8c6d('0x24')](_0x24200c[_0x8c6d('0x39')]);if(_0x24200c[_0x8c6d('0x3a')]){delete _0x24200c['name'];}_0x40f3a5[_0x8c6d('0x2a')](_0x301332)[_0x8c6d('0x3b')](_0x24200c);};}function getMustacheRender(_0x812b7d,_0x454e96){return Mustache[_0x8c6d('0x3c')](_0x812b7d,_['merge'](_0x454e96[_0x8c6d('0x3d')],{'contact':_0x454e96[_0x8c6d('0x3e')],'message':_0x454e96['message'],'agent':_0x454e96[_0x8c6d('0x3f')],'interaction':_0x454e96[_0x8c6d('0x40')],'account':_0x454e96[_0x8c6d('0x41')]}))||'';}exports['index']=function(_0x954bac,_0xb7293d){var _0x27d6f5={'include':[{'model':db[_0x8c6d('0x42')],'as':_0x8c6d('0x43')}]},_0xdfb751={},_0x2f54a2={'count':0x0,'rows':[]};var _0x2bbf60=_[_0x8c6d('0x44')](db[_0x8c6d('0x45')][_0x8c6d('0x46')],function(_0x4e5c39){return{'name':_0x4e5c39['fieldName'],'type':_0x4e5c39['type'][_0x8c6d('0x47')]};});_0xdfb751[_0x8c6d('0x48')]=_[_0x8c6d('0x44')](_0x2bbf60,_0x8c6d('0x3a'));_0xdfb751[_0x8c6d('0x49')]=_['keys'](_0x954bac[_0x8c6d('0x49')]);_0xdfb751[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0xdfb751['model'],_0xdfb751[_0x8c6d('0x49')]);_0x27d6f5[_0x8c6d('0x4c')]=_['intersection'](_0xdfb751['model'],qs['fields'](_0x954bac['query']['fields']));_0x27d6f5[_0x8c6d('0x4c')]=_0x27d6f5[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x27d6f5[_0x8c6d('0x4c')]:_0xdfb751[_0x8c6d('0x48')];if(!_0x954bac['query']['hasOwnProperty']('nolimit')){_0x27d6f5['limit']=qs[_0x8c6d('0x2e')](_0x954bac['query'][_0x8c6d('0x2e')]);_0x27d6f5[_0x8c6d('0x2c')]=qs[_0x8c6d('0x2c')](_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x27d6f5[_0x8c6d('0x4e')]=qs['sort'](_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x4f')]);_0x27d6f5['where']=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0x954bac['query'],_0xdfb751[_0x8c6d('0x4a')]),_0x2bbf60);if(_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x51')]){_0x27d6f5[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x27d6f5[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x2bbf60,function(_0x17eb0f){if(_0x17eb0f[_0x8c6d('0x54')]!==_0x8c6d('0x55')){var _0x361956={};_0x361956[_0x17eb0f[_0x8c6d('0x3a')]]={'$like':'%'+_0x954bac[_0x8c6d('0x49')][_0x8c6d('0x51')]+'%'};return _0x361956;}})});}_0x27d6f5=_[_0x8c6d('0x53')]({},_0x27d6f5,_0x954bac[_0x8c6d('0x56')]);var _0x48ceb8={'where':_0x27d6f5['where']};return db['SmsAccount'][_0x8c6d('0x2f')](_0x48ceb8)[_0x8c6d('0x1f')](function(_0x4919b8){_0x2f54a2[_0x8c6d('0x2f')]=_0x4919b8;if(_0x954bac['query'][_0x8c6d('0x57')]){_0x27d6f5['include']=[{'all':!![]}];}return db[_0x8c6d('0x45')][_0x8c6d('0x58')](_0x27d6f5);})[_0x8c6d('0x1f')](function(_0x5e2dbb){_0x2f54a2[_0x8c6d('0x59')]=_0x5e2dbb;return _0x2f54a2;})['then'](respondWithFilteredResult(_0xb7293d,_0x27d6f5))[_0x8c6d('0x5a')](handleError(_0xb7293d,null));};exports['show']=function(_0xcbcc60,_0x21597a){var _0x2e22cc={'raw':![],'where':{'id':_0xcbcc60['params']['id']},'include':[{'model':db[_0x8c6d('0x42')],'as':_0x8c6d('0x43')}]},_0x334a29={};_0x334a29[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x45')][_0x8c6d('0x46')]);_0x334a29[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0xcbcc60['query']);_0x334a29[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x334a29[_0x8c6d('0x48')],_0x334a29[_0x8c6d('0x49')]);_0x2e22cc['attributes']=_[_0x8c6d('0x4b')](_0x334a29['model'],qs['fields'](_0xcbcc60[_0x8c6d('0x49')][_0x8c6d('0x5c')]));_0x2e22cc[_0x8c6d('0x4c')]=_0x2e22cc[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x2e22cc[_0x8c6d('0x4c')]:_0x334a29[_0x8c6d('0x48')];if(_0xcbcc60['query'][_0x8c6d('0x57')]){_0x2e22cc[_0x8c6d('0x5d')]=[{'all':!![]}];}_0x2e22cc=_[_0x8c6d('0x53')]({},_0x2e22cc,_0xcbcc60['options']);return db[_0x8c6d('0x45')][_0x8c6d('0x5e')](_0x2e22cc)[_0x8c6d('0x1f')](handleEntityNotFound(_0x21597a,null))[_0x8c6d('0x1f')](respondWithResult(_0x21597a,null))[_0x8c6d('0x5a')](handleError(_0x21597a,null));};exports['create']=function(_0x2da745,_0x3ad843){return db['SmsAccount'][_0x8c6d('0x5f')](_0x2da745['body'],{})[_0x8c6d('0x1f')](function(_0x4c4b61){var _0x5b6e78=_0x2da745[_0x8c6d('0x60')][_0x8c6d('0x36')]({'plain':!![]});if(!_0x5b6e78)throw new Error(_0x8c6d('0x61'));if(_0x5b6e78[_0x8c6d('0x62')]===_0x8c6d('0x60')){var _0x3090a9=_0x4c4b61[_0x8c6d('0x36')]({'plain':!![]});var _0x1c37ac=_0x8c6d('0x37');return db[_0x8c6d('0x63')][_0x8c6d('0x5e')]({'where':{'name':_0x1c37ac,'userProfileId':_0x5b6e78['userProfileId']},'raw':!![]})[_0x8c6d('0x1f')](function(_0x3d5523){if(_0x3d5523&&_0x3d5523[_0x8c6d('0x64')]===0x0){return db['UserProfileResource'][_0x8c6d('0x5f')]({'name':_0x3090a9[_0x8c6d('0x3a')],'resourceId':_0x3090a9['id'],'type':_0x3d5523[_0x8c6d('0x3a')],'sectionId':_0x3d5523['id']},{})['then'](function(){return _0x4c4b61;});}else{return _0x4c4b61;}})[_0x8c6d('0x5a')](function(_0x55d88b){logger[_0x8c6d('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55d88b);throw _0x55d88b;});}return _0x4c4b61;})['then'](respondWithResult(_0x3ad843,0xc9))[_0x8c6d('0x5a')](handleError(_0x3ad843,null));};exports[_0x8c6d('0x34')]=function(_0x56f801,_0x59d43d){if(_0x56f801['body']['id']){delete _0x56f801[_0x8c6d('0x3d')]['id'];}return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x56f801[_0x8c6d('0x65')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x8c6d('0x1f')](handleEntityNotFound(_0x59d43d,null))[_0x8c6d('0x1f')](saveUpdates(_0x56f801[_0x8c6d('0x3d')],null))[_0x8c6d('0x1f')](respondWithResult(_0x59d43d,null))[_0x8c6d('0x5a')](handleError(_0x59d43d,null));};exports[_0x8c6d('0x35')]=function(_0x2d3dd3,_0x3c6a3c){return db['SmsAccount'][_0x8c6d('0x5e')]({'where':{'id':_0x2d3dd3[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3c6a3c,null))[_0x8c6d('0x1f')](removeEntity(_0x3c6a3c,null))['catch'](handleError(_0x3c6a3c,null));};exports[_0x8c6d('0x66')]=function(_0x55f8c4,_0x48b59e){return db[_0x8c6d('0x45')][_0x8c6d('0x66')]()[_0x8c6d('0x1f')](respondWithResult(_0x48b59e,null))['catch'](handleError(_0x48b59e,null));};exports[_0x8c6d('0x67')]=function(_0x51fc61,_0x4861ec,_0x2b3b5c){if(_0x51fc61[_0x8c6d('0x3d')]['id']){delete _0x51fc61[_0x8c6d('0x3d')]['id'];}return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x51fc61['params']['id']}})['then'](handleEntityNotFound(_0x4861ec,null))[_0x8c6d('0x1f')](function(_0x2fedab){if(_0x2fedab){_0x51fc61[_0x8c6d('0x3d')][_0x8c6d('0x68')]=_0x2fedab['id'];return db[_0x8c6d('0x69')][_0x8c6d('0x5f')](_0x51fc61[_0x8c6d('0x3d')]);}})['then'](respondWithResult(_0x4861ec,null))[_0x8c6d('0x5a')](handleError(_0x4861ec,null));};exports[_0x8c6d('0x6a')]=function(_0x1e33f7,_0x19f19d,_0x94b152){var _0x471ca0={'raw':![],'where':{}};var _0x1df6e0={};var _0x535f19={'count':0x0,'rows':[]};return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x1e33f7[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x19f19d,null))['then'](function(_0x92732){if(_0x92732){_0x1df6e0[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x69')]['rawAttributes']);_0x1df6e0[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0x1e33f7['query']);_0x1df6e0[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x1df6e0['model'],_0x1df6e0[_0x8c6d('0x49')]);_0x471ca0[_0x8c6d('0x4c')]=_[_0x8c6d('0x4b')](_0x1df6e0[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x5c')]));_0x471ca0[_0x8c6d('0x4c')]=_0x471ca0[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x471ca0[_0x8c6d('0x4c')]:_0x1df6e0[_0x8c6d('0x48')];if(!_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x471ca0[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x1e33f7['query'][_0x8c6d('0x2e')]);_0x471ca0[_0x8c6d('0x2c')]=qs[_0x8c6d('0x2c')](_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x471ca0[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x4f')]);_0x471ca0[_0x8c6d('0x52')]=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0x1e33f7[_0x8c6d('0x49')],_0x1df6e0['filters']));_0x471ca0[_0x8c6d('0x52')][_0x8c6d('0x68')]=_0x92732['id'];if(_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x51')]){_0x471ca0['where']=_[_0x8c6d('0x53')](_0x471ca0[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x471ca0[_0x8c6d('0x4c')],function(_0x133f41){var _0x4db68b={};_0x4db68b[_0x133f41]={'$like':'%'+_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x51')]+'%'};return _0x4db68b;})});}_0x471ca0=_['merge']({},_0x471ca0,_0x1e33f7['options']);return db[_0x8c6d('0x69')][_0x8c6d('0x2f')]({'where':_0x471ca0[_0x8c6d('0x52')]})[_0x8c6d('0x1f')](function(_0x11ae05){_0x535f19[_0x8c6d('0x2f')]=_0x11ae05;if(_0x1e33f7[_0x8c6d('0x49')][_0x8c6d('0x57')]){_0x471ca0[_0x8c6d('0x5d')]=[{'all':!![]}];}return db[_0x8c6d('0x69')][_0x8c6d('0x58')](_0x471ca0);})['then'](function(_0x5589ff){_0x535f19['rows']=_0x5589ff;return _0x535f19;});}})[_0x8c6d('0x1f')](respondWithFilteredResult(_0x19f19d,_0x471ca0))[_0x8c6d('0x5a')](handleError(_0x19f19d,null));};exports['removeDispositions']=function(_0x284fa0,_0x55e00e,_0x31d9b7){return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x284fa0[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x55e00e,null))[_0x8c6d('0x1f')](function(_0xc233cb){if(_0xc233cb){return _0xc233cb['removeDispositions'](_0x284fa0['query'][_0x8c6d('0x6e')]);}})[_0x8c6d('0x1f')](respondWithStatusCode(_0x55e00e,null))[_0x8c6d('0x5a')](handleError(_0x55e00e,null));};exports[_0x8c6d('0x6f')]=function(_0x299507,_0x2b9d6b,_0x2929b5){if(_0x299507[_0x8c6d('0x3d')]['id']){delete _0x299507[_0x8c6d('0x3d')]['id'];}return db[_0x8c6d('0x45')]['find']({'where':{'id':_0x299507[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x2b9d6b,null))[_0x8c6d('0x1f')](function(_0xed9664){if(_0xed9664){_0x299507[_0x8c6d('0x3d')]['SmsAccountId']=_0xed9664['id'];return db['CannedAnswer'][_0x8c6d('0x5f')](_0x299507['body']);}})['then'](respondWithResult(_0x2b9d6b,null))[_0x8c6d('0x5a')](handleError(_0x2b9d6b,null));};exports[_0x8c6d('0x70')]=function(_0x10ed6b,_0x7712b8,_0x49a4ab){var _0x5a00ce={'raw':![],'where':{}};var _0x46854f={};var _0xa67c13={'count':0x0,'rows':[]};return db[_0x8c6d('0x45')]['findOne']({'where':{'id':_0x10ed6b[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x7712b8,null))['then'](function(_0x8df7a0){if(_0x8df7a0){_0x46854f[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x71')][_0x8c6d('0x46')]);_0x46854f[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0x10ed6b['query']);_0x46854f[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x46854f[_0x8c6d('0x48')],_0x46854f[_0x8c6d('0x49')]);_0x5a00ce[_0x8c6d('0x4c')]=_[_0x8c6d('0x4b')](_0x46854f[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x10ed6b['query'][_0x8c6d('0x5c')]));_0x5a00ce[_0x8c6d('0x4c')]=_0x5a00ce[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x5a00ce[_0x8c6d('0x4c')]:_0x46854f['model'];if(!_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x5a00ce[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x10ed6b[_0x8c6d('0x49')]['limit']);_0x5a00ce['offset']=qs[_0x8c6d('0x2c')](_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x5a00ce[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x10ed6b[_0x8c6d('0x49')]['sort']);_0x5a00ce[_0x8c6d('0x52')]=qs['filters'](_[_0x8c6d('0x50')](_0x10ed6b[_0x8c6d('0x49')],_0x46854f['filters']));_0x5a00ce[_0x8c6d('0x52')][_0x8c6d('0x68')]=_0x8df7a0['id'];if(_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x51')]){_0x5a00ce[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x5a00ce['where'],{'$or':_['map'](_0x5a00ce['attributes'],function(_0x2d8514){var _0x5b5bd6={};_0x5b5bd6[_0x2d8514]={'$like':'%'+_0x10ed6b[_0x8c6d('0x49')][_0x8c6d('0x51')]+'%'};return _0x5b5bd6;})});}_0x5a00ce=_[_0x8c6d('0x53')]({},_0x5a00ce,_0x10ed6b[_0x8c6d('0x56')]);return db[_0x8c6d('0x71')]['count']({'where':_0x5a00ce[_0x8c6d('0x52')]})['then'](function(_0x418b1a){_0xa67c13[_0x8c6d('0x2f')]=_0x418b1a;if(_0x10ed6b['query']['includeAll']){_0x5a00ce[_0x8c6d('0x5d')]=[{'all':!![]}];}return db[_0x8c6d('0x71')][_0x8c6d('0x58')](_0x5a00ce);})[_0x8c6d('0x1f')](function(_0x20de29){_0xa67c13['rows']=_0x20de29;return _0xa67c13;});}})[_0x8c6d('0x1f')](respondWithFilteredResult(_0x7712b8,_0x5a00ce))[_0x8c6d('0x5a')](handleError(_0x7712b8,null));};exports[_0x8c6d('0x72')]=function(_0x45ca53,_0x3cb539,_0x8b9035){return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x45ca53['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3cb539,null))[_0x8c6d('0x1f')](function(_0x530d72){if(_0x530d72){return _0x530d72['removeAnswers'](_0x45ca53[_0x8c6d('0x49')]['ids']);}})[_0x8c6d('0x1f')](respondWithStatusCode(_0x3cb539,null))['catch'](handleError(_0x3cb539,null));};exports[_0x8c6d('0x73')]=function(_0x37d704,_0x412501,_0x81fbfd){var _0x4d8096={'channel':_0x8c6d('0x74')};var _0x2bfee6=[];var _0x511fd7=[];var _0x537463={};return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x37d704[_0x8c6d('0x65')]['id']},'include':[{'model':db[_0x8c6d('0x75')],'as':_0x8c6d('0x76')}]})[_0x8c6d('0x1f')](handleEntityNotFound(_0x412501,null))[_0x8c6d('0x1f')](function(_0xebd9ac){_0x4d8096[_0x8c6d('0x41')]=_0xebd9ac;_0x4d8096[_0x8c6d('0x77')]=_['orderBy'](_0xebd9ac[_0x8c6d('0x76')],[_0x8c6d('0x78')],[_0x8c6d('0x79')]);if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x76')]){delete _0x4d8096['account'][_0x8c6d('0x76')];}return db['CmContact'][_0x8c6d('0x66')]();})[_0x8c6d('0x1f')](function(_0x49b80a){if(!_0x49b80a){throw new db[(_0x8c6d('0x7a'))]['ValidationError'](_0x8c6d('0x7b'));}_0x2bfee6=_['difference'](_[_0x8c6d('0x5b')](_0x49b80a),[_0x8c6d('0x7c'),_0x8c6d('0x7d')]);_0x511fd7=_[_0x8c6d('0x7e')](_['keys'](_0x49b80a),[_0x8c6d('0x7c'),_0x8c6d('0x7d'),_0x8c6d('0x7f'),'ListId']);_0x4d8096[_0x8c6d('0x3d')]={'mapKey':_0x8c6d('0x80')};if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x54')]){switch(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x54')]){case _0x8c6d('0x81'):_0x4d8096['body'][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x83')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x84')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x86')];break;case _0x8c6d('0x87'):_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]='+'+_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x88')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704['body']['text'];break;case _0x8c6d('0x89'):_0x4d8096['body'][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x26')];break;case _0x8c6d('0x8a'):_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')]['body'];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')]['message_id'];break;case'plivo':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x83')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704['body'][_0x8c6d('0x8b')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8c')];break;case'infobip':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]='+'+_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0]['text'];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0][_0x8c6d('0x85')];break;case _0x8c6d('0x8e'):_0x4d8096['body'][_0x8c6d('0x82')]=_0x37d704['body'][_0x8c6d('0x8f')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x90')]['message'];break;case _0x8c6d('0x91'):_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704['body'][_0x8c6d('0x92')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x93')];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x94')];break;case _0x8c6d('0x95'):_0x4d8096[_0x8c6d('0x3d')]['messageId']=_0x37d704['body'][0x0][_0x8c6d('0x26')]['id'];_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')]=_0x37d704[_0x8c6d('0x3d')][0x0]['message'][_0x8c6d('0x82')];_0x4d8096['body'][_0x8c6d('0x3d')]=_0x37d704['body'][0x0][_0x8c6d('0x26')][_0x8c6d('0x93')];break;case _0x8c6d('0x96'):_0x4d8096[_0x8c6d('0x3d')]['from']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x82')];_0x4d8096[_0x8c6d('0x3d')]['body']=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x26')];_0x4d8096['body'][_0x8c6d('0x85')]=_0x37d704[_0x8c6d('0x3d')][_0x8c6d('0x97')];break;}}if(_0x4d8096[_0x8c6d('0x3d')]['id']){delete _0x4d8096['body']['id'];}if(_['isNil'](_0x4d8096['body'][_0x8c6d('0x82')])){throw new db['Sequelize'][(_0x8c6d('0x98'))](_0x8c6d('0x99'));}if(_[_0x8c6d('0x9a')](_0x4d8096[_0x8c6d('0x3d')]['body'])||_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')]===''){throw new db[(_0x8c6d('0x7a'))]['ValidationError'](_0x8c6d('0x9b'));}if(_['isNil'](_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x9c')])){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))](_0x8c6d('0x9d')+_0x511fd7);}if(!_[_0x8c6d('0x9e')](_0x511fd7,_0x4d8096['body']['mapKey'])){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))](_0x8c6d('0x9f')+_0x511fd7);}_0x537463[_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x9c')]]=_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')];return db[_0x8c6d('0xa0')][_0x8c6d('0x5e')]({'where':{'id':_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0xa1')]},'include':[{'model':db[_0x8c6d('0xa2')],'as':_0x8c6d('0xa3'),'where':_0x537463,'limit':0x1,'order':[[_0x8c6d('0x7d'),'DESC']]}]});})['then'](handleEntityNotFound(_0x412501,null))[_0x8c6d('0x1f')](function(_0x311a5a){if(_0x311a5a){_0x4d8096['list']=_['omit'](_0x311a5a,[_0x8c6d('0xa3')]);if(_0x311a5a[_0x8c6d('0xa3')][_0x8c6d('0x4d')]){return _0x311a5a[_0x8c6d('0xa3')][0x0];}var _0x329957=_[_0x8c6d('0x17')](_0x4d8096[_0x8c6d('0x3d')],{'firstName':_0x4d8096[_0x8c6d('0x3d')]['from'],'ListId':_0x311a5a['id']});_0x329957[_0x4d8096[_0x8c6d('0x3d')]['mapKey']]=_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')];return db[_0x8c6d('0xa2')][_0x8c6d('0x5f')](_0x329957,{'fields':_0x2bfee6,'raw':!![]});}})['then'](handleEntityNotFound(_0x412501,null))['then'](function(_0x43fb1a){if(_0x43fb1a){_0x4d8096[_0x8c6d('0x3e')]=_0x43fb1a;var _0x53ed49={'ContactId':_0x43fb1a['id'],'phone':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')],'SmsAccountId':_0x37d704[_0x8c6d('0x65')]['id']};var _0x80e26={'ContactId':_0x43fb1a['id'],'SmsAccountId':_0x37d704[_0x8c6d('0x65')]['id'],'closed':![]};return db['SmsInteraction'][_0x8c6d('0x5e')]({'where':_0x80e26})[_0x8c6d('0x1f')](function(_0x7fe74f){if(_0x7fe74f){return[_0x7fe74f,![]];}return db['SmsInteraction'][_0x8c6d('0x5f')](_0x53ed49)['then'](function(_0x4c1d3c){return[_0x4c1d3c,!![]];});});}})[_0x8c6d('0xa4')](function(_0x52cb7c,_0x496869){_0x4d8096[_0x8c6d('0x40')]=_0x52cb7c[_0x8c6d('0x36')]({'plain':!![]});_0x4d8096[_0x8c6d('0x40')][_0x8c6d('0xa5')]=![];if(_0x496869){if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0xa6')]){_0x4d8096['applications'][_0x8c6d('0xa7')]({'id':0x0,'priority':_0x4d8096[_0x8c6d('0x77')][_0x8c6d('0x4d')]+0x1,'app':_0x8c6d('0xa8'),'appdata':'unmanaged','interval':_0x8c6d('0xa9')});}_0x4d8096[_0x8c6d('0x40')][_0x8c6d('0xa5')]=!![];}return db[_0x8c6d('0xaa')]['create']({'phone':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x82')],'messageId':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x85')],'body':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0x3d')],'SmsAccountId':_0x37d704[_0x8c6d('0x65')]['id'],'SmsInteractionId':_0x52cb7c['id'],'direction':'in','ContactId':_0x52cb7c['ContactId'],'AttachmentId':_0x4d8096[_0x8c6d('0x3d')][_0x8c6d('0xab')]});})[_0x8c6d('0x1f')](function(_0xcec53d){_0x4d8096[_0x8c6d('0x26')]=_0xcec53d;if(_0x4d8096['interaction'][_0x8c6d('0xac')]){return db[_0x8c6d('0xad')][_0x8c6d('0x5e')]({'attributes':['id',_0x8c6d('0x3a')],'where':{'id':_0x4d8096['interaction'][_0x8c6d('0xac')]}})[_0x8c6d('0x1f')](function(_0x40538e){if(_0x40538e){_0x4d8096[_0x8c6d('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8c6d('0x3f'),'appdata':_0x40538e[_0x8c6d('0x3a')]+','+(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0xae')]||0xa),'interval':_0x8c6d('0xa9')});}return respondWithRpcPromise('Start','startRouting',_0x4d8096);});}return respondWithRpcPromise(_0x8c6d('0xaf'),'startRouting',_0x4d8096);})['then'](function(_0x1c9d1d){if(_0x1c9d1d){var _0x1d682e=0xc8;var _0x1f5833='receiveMessage';logger[_0x8c6d('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1f5833,_0x1d682e,_0x8c6d('0xb0'));logger['debug'](_0x8c6d('0xb1'),_0x1f5833,_0x1d682e,_0x8c6d('0xb0'),JSON['stringify'](_0x1c9d1d));if(_0x4d8096[_0x8c6d('0x41')][_0x8c6d('0x54')]==='twilio'){return _0x412501[_0x8c6d('0x2a')](_0x1d682e)[_0x8c6d('0x30')](_0x8c6d('0xb2'),'text/xml')[_0x8c6d('0x3b')](_0x8c6d('0xb3'));}else{return _0x412501[_0x8c6d('0x2a')](_0x1d682e)['json'](_0x1c9d1d);}}})['catch'](handleError(_0x412501,null));};exports[_0x8c6d('0xb4')]=function(_0x5e784b,_0x442810,_0x3a6b34){return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x5e784b['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x442810,null))[_0x8c6d('0x1f')](function(_0x58ffd2){if(_0x58ffd2){return db[_0x8c6d('0xb5')][_0x8c6d('0xb6')](function(_0x17eafa){return db[_0x8c6d('0x75')][_0x8c6d('0x35')]({'where':{'SmsAccountId':_0x5e784b[_0x8c6d('0x65')]['id']},'transaction':_0x17eafa})[_0x8c6d('0x1f')](function(_0xc5ab6e){var _0x109f5c=_['map'](_0x5e784b[_0x8c6d('0x3d')],function(_0x4d644b){_0x4d644b[_0x8c6d('0x68')]=_0x5e784b[_0x8c6d('0x65')]['id'];return _0x4d644b;});return db[_0x8c6d('0x75')][_0x8c6d('0xb7')](_0x109f5c,{'transaction':_0x17eafa});});})[_0x8c6d('0x1f')](function(){return db[_0x8c6d('0x75')][_0x8c6d('0xb8')]({'where':{'SmsAccountId':_0x5e784b['params']['id']},'order':_0x8c6d('0x78')});});}})[_0x8c6d('0x1f')](respondWithResult(_0x442810,null))[_0x8c6d('0x5a')](handleError(_0x442810,null));};exports[_0x8c6d('0xb9')]=function(_0xb753ab,_0x3e2f2d,_0x3fab0a){var _0x393b53={};var _0x5799b9={};var _0x42078b;var _0x1e141a;return db['SmsAccount'][_0x8c6d('0x6b')]({'where':{'id':_0xb753ab[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3e2f2d,null))[_0x8c6d('0x1f')](function(_0x54f967){if(_0x54f967){_0x42078b=_0x54f967;_0x5799b9[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0x75')]['rawAttributes']);_0x5799b9[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0xb753ab[_0x8c6d('0x49')]);_0x5799b9[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x5799b9[_0x8c6d('0x48')],_0x5799b9[_0x8c6d('0x49')]);_0x393b53[_0x8c6d('0x4c')]=_[_0x8c6d('0x4b')](_0x5799b9[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0xb753ab[_0x8c6d('0x49')]['fields']));_0x393b53[_0x8c6d('0x4c')]=_0x393b53['attributes'][_0x8c6d('0x4d')]?_0x393b53['attributes']:_0x5799b9[_0x8c6d('0x48')];_0x393b53[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0xb753ab[_0x8c6d('0x49')]['sort']);_0x393b53[_0x8c6d('0x52')]=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0xb753ab['query'],_0x5799b9[_0x8c6d('0x4a')]));if(_0xb753ab['query']['filter']){_0x393b53[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x393b53[_0x8c6d('0x52')],{'$or':_['map'](_0x393b53[_0x8c6d('0x4c')],function(_0x53db17){var _0x46bb14={};_0x46bb14[_0x53db17]={'$like':'%'+_0xb753ab[_0x8c6d('0x49')]['filter']+'%'};return _0x46bb14;})});}_0x393b53=_[_0x8c6d('0x53')]({},_0x393b53,_0xb753ab[_0x8c6d('0x56')]);return _0x42078b[_0x8c6d('0xb9')](_0x393b53);}})[_0x8c6d('0x1f')](function(_0x4b30a8){if(_0x4b30a8){_0x1e141a=_0x4b30a8[_0x8c6d('0x4d')];if(!_0xb753ab[_0x8c6d('0x49')]['hasOwnProperty'](_0x8c6d('0x6d'))){_0x393b53['limit']=qs['limit'](_0xb753ab[_0x8c6d('0x49')][_0x8c6d('0x2e')]);_0x393b53[_0x8c6d('0x2c')]=qs[_0x8c6d('0x2c')](_0xb753ab[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}return _0x42078b[_0x8c6d('0xb9')](_0x393b53);}})[_0x8c6d('0x1f')](function(_0x44d8f2){if(_0x44d8f2){return _0x44d8f2?{'count':_0x1e141a,'rows':_0x44d8f2}:null;}})[_0x8c6d('0x1f')](respondWithResult(_0x3e2f2d,null))['catch'](handleError(_0x3e2f2d,null));};exports[_0x8c6d('0xba')]=function(_0x407140,_0x495653,_0x4df5b1){var _0x1c2c7f={'raw':![],'where':{}};var _0x3f5388={};var _0x297531={'count':0x0,'rows':[]};return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x407140['params']['id']}})['then'](handleEntityNotFound(_0x495653,null))['then'](function(_0x13c2f2){if(_0x13c2f2){_0x3f5388[_0x8c6d('0x48')]=_[_0x8c6d('0x5b')](db[_0x8c6d('0xbb')]['rawAttributes']);_0x3f5388[_0x8c6d('0x49')]=_['keys'](_0x407140['query']);_0x3f5388['filters']=_[_0x8c6d('0x4b')](_0x3f5388[_0x8c6d('0x48')],_0x3f5388[_0x8c6d('0x49')]);_0x1c2c7f[_0x8c6d('0x4c')]=_['intersection'](_0x3f5388[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x407140['query']['fields']));_0x1c2c7f[_0x8c6d('0x4c')]=_0x1c2c7f['attributes']['length']?_0x1c2c7f[_0x8c6d('0x4c')]:_0x3f5388[_0x8c6d('0x48')];if(!_0x407140[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x1c2c7f[_0x8c6d('0x2e')]=qs[_0x8c6d('0x2e')](_0x407140['query']['limit']);_0x1c2c7f['offset']=qs[_0x8c6d('0x2c')](_0x407140[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}_0x1c2c7f[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x407140[_0x8c6d('0x49')][_0x8c6d('0x4f')]);_0x1c2c7f[_0x8c6d('0x52')]=qs['filters'](_[_0x8c6d('0x50')](_0x407140[_0x8c6d('0x49')],_0x3f5388[_0x8c6d('0x4a')]));_0x1c2c7f[_0x8c6d('0x52')][_0x8c6d('0x68')]=_0x13c2f2['id'];if(_0x407140[_0x8c6d('0x49')]['filter']){_0x1c2c7f['where']=_[_0x8c6d('0x53')](_0x1c2c7f[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x1c2c7f['attributes'],function(_0x339288){var _0x842e26={};_0x842e26[_0x339288]={'$like':'%'+_0x407140['query'][_0x8c6d('0x51')]+'%'};return _0x842e26;})});}_0x1c2c7f=_[_0x8c6d('0x53')]({},_0x1c2c7f,_0x407140[_0x8c6d('0x56')]);return db['SmsInteraction']['count']({'where':_0x1c2c7f[_0x8c6d('0x52')]})[_0x8c6d('0x1f')](function(_0x53d7c1){_0x297531['count']=_0x53d7c1;if(_0x407140[_0x8c6d('0x49')][_0x8c6d('0x57')]){_0x1c2c7f[_0x8c6d('0x5d')]=[{'model':db[_0x8c6d('0xa2')],'as':'Contact','required':![]},{'model':db[_0x8c6d('0xad')],'as':_0x8c6d('0xbc'),'attributes':['name',_0x8c6d('0xbd'),_0x8c6d('0xbe')],'required':![]},{'model':db[_0x8c6d('0xbf')],'as':_0x8c6d('0xc0'),'attributes':['id',_0x8c6d('0x3a'),_0x8c6d('0xc1')],'where':_0x407140['query'][_0x8c6d('0xc2')]?{'id':_0x407140[_0x8c6d('0x49')][_0x8c6d('0xc2')]}:undefined,'required':_0x407140[_0x8c6d('0x49')][_0x8c6d('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x8c6d('0x58')](_0x1c2c7f);})[_0x8c6d('0x1f')](function(_0x2f6692){_0x297531[_0x8c6d('0x59')]=_0x2f6692;return _0x297531;});}})[_0x8c6d('0x1f')](respondWithFilteredResult(_0x495653,_0x1c2c7f))[_0x8c6d('0x5a')](handleError(_0x495653,null));};exports[_0x8c6d('0x3b')]=function(_0x33f8f6,_0xeca072,_0x3f8b12){var _0x3c8cc2,_0x168b66,_0x3ca251;if(_['isNil'](_0x33f8f6[_0x8c6d('0x3d')][_0x8c6d('0x3d')])||_0x33f8f6[_0x8c6d('0x3d')]['body']===''){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))](_0x8c6d('0x9b'));}if(_[_0x8c6d('0x9a')](_0x33f8f6[_0x8c6d('0x3d')]['to'])){throw new db[(_0x8c6d('0x7a'))][(_0x8c6d('0x98'))]('to\x20is\x20mandatory');}_0x3c8cc2=_0x33f8f6[_0x8c6d('0x3d')]['to'];return db[_0x8c6d('0x45')]['find']({'where':{'id':_0x33f8f6[_0x8c6d('0x65')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8c6d('0xa2')],'as':_0x8c6d('0xa3'),'where':{'mobile':_0x3c8cc2},'limit':0x1,'order':[[_0x8c6d('0x7d'),_0x8c6d('0xc3')]]}]}]})['then'](handleEntityNotFound(_0xeca072,null))[_0x8c6d('0x1f')](function(_0x4336f2){if(_0x4336f2&&_0x4336f2[_0x8c6d('0xc4')]){_0x168b66=_0x4336f2['get']({'plain':!![]});if(_0x168b66['List']&&_0x168b66[_0x8c6d('0xc4')][_0x8c6d('0xa3')][_0x8c6d('0x4d')]){return _0x168b66[_0x8c6d('0xc4')]['Contacts'][0x0];}return db['CmContact'][_0x8c6d('0x5f')](_[_0x8c6d('0x17')](_0x33f8f6[_0x8c6d('0x3d')],{'firstName':_0x3c8cc2,'mobile':_0x3c8cc2,'phone':_0x3c8cc2,'ListId':_0x168b66[_0x8c6d('0xa1')]}));}})[_0x8c6d('0x1f')](handleEntityNotFound(_0xeca072,null))[_0x8c6d('0x1f')](function(_0x3c3c92){if(_0x3c3c92){_0x3ca251=_0x3c3c92;return db[_0x8c6d('0xbb')][_0x8c6d('0x5e')]({'where':{'ContactId':_0x3ca251['id'],'closed':![],'SmsAccountId':_0x168b66['id']}})['then'](function(_0x53fccc){if(_0x53fccc){return[_0x53fccc,![]];}return db[_0x8c6d('0xbb')]['create']({'UserId':_0x33f8f6['user']['id'],'ContactId':_0x3ca251['id'],'SmsAccountId':_0x168b66['id'],'phone':_0x3c8cc2,'firstMsgDirection':_0x8c6d('0xc5'),'Messages':[_['merge'](_0x33f8f6['body'],{'read':![],'body':_0x33f8f6[_0x8c6d('0x3d')][_0x8c6d('0x3d')],'phone':_0x3c8cc2,'SmsAccountId':_0x168b66['id'],'UserId':_0x33f8f6[_0x8c6d('0x60')]['id'],'ContactId':_0x3ca251['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x8c6d('0xc6')}]})[_0x8c6d('0x1f')](function(_0xb1580e){return[_0xb1580e,!![]];});});}})['spread'](function(_0x83597b,_0x27bd2d){if(_0x27bd2d){return _0x83597b;}return db[_0x8c6d('0xaa')][_0x8c6d('0x5f')](_[_0x8c6d('0x53')](_0x33f8f6[_0x8c6d('0x3d')],{'read':![],'body':_0x33f8f6[_0x8c6d('0x3d')]['body'],'phone':_0x3c8cc2,'SmsAccountId':_0x168b66['id'],'SmsInteractionId':_0x83597b['id'],'UserId':_0x33f8f6[_0x8c6d('0x60')]['id'],'ContactId':_0x3ca251['id']}))['then'](function(_0x160ef7){_0x83597b['dataValues'][_0x8c6d('0xc6')]=[];_0x83597b[_0x8c6d('0xc7')][_0x8c6d('0xc6')][_0x8c6d('0xa7')](_0x160ef7['dataValues']);return _0x83597b;});})[_0x8c6d('0x1f')](respondWithResult(_0xeca072,null))[_0x8c6d('0x5a')](handleError(_0xeca072,null));};exports['status']=function(_0xdad331,_0x3b2357,_0x48ff5e){if(_0xdad331[_0x8c6d('0x3d')]['id']){delete _0xdad331[_0x8c6d('0x3d')]['id'];}var _0x4a0e28,_0x4924e8,_0x5b19ad;return db['SmsAccount']['find']({'where':{'id':_0xdad331['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3b2357,null))[_0x8c6d('0x1f')](function(_0x8ee2da){if(_0x8ee2da){_0x5b19ad=_0x8ee2da;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),_0x8c6d('0xc8'),_0x8ee2da[_0x8c6d('0x54')],util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));switch(_0x8ee2da['type']){case _0x8c6d('0x87'):if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xca')]&&_0xdad331[_0x8c6d('0x3d')]['status']){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')];return db[_0x8c6d('0xaa')][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xca')]}});}break;case _0x8c6d('0x89'):if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcb')]&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcc')]){_0x4924e8=_0xdad331['body'][_0x8c6d('0xcc')];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcb')]}});}break;case'clicksend':if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcd')]&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xce')]){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xce')];return db[_0x8c6d('0xaa')][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xcd')]}});}break;case _0x8c6d('0xcf'):var _0x2149e0=_0xdad331['body'][_0x8c6d('0x8d')][0x0];if(_0x2149e0[_0x8c6d('0x85')]&&_0x2149e0['status'][_0x8c6d('0xd0')]==='DELIVERED'){_0x4924e8=_0x2149e0[_0x8c6d('0x2a')][_0x8c6d('0xd0')];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0x2149e0[_0x8c6d('0x85')]}});}break;case _0x8c6d('0x91'):if(_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x85')]&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')]){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x85')]}});}break;case _0x8c6d('0x95'):if(_0xdad331[_0x8c6d('0x3d')][0x0][_0x8c6d('0x26')]['id']){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][0x0]['type'];return db['SmsMessage'][_0x8c6d('0x5e')]({'where':{'messageId':_0xdad331['body'][0x0][_0x8c6d('0x26')]['id']}});}break;case'intelepeer':if(_0xdad331[_0x8c6d('0x3d')]['redif']&&_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')]){_0x4924e8=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x2a')];return db[_0x8c6d('0xaa')]['find']({'where':{'messageId':_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xd1')]}});}break;}}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x3b2357,null))['then'](function(_0xf6b567){if(_0xf6b567){_0x4a0e28=_0xf6b567;switch(_0x5b19ad[_0x8c6d('0x54')]){case _0x8c6d('0x87'):if(_0x4924e8===_0x8c6d('0xd2')){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),_0x8c6d('0x87'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x89'):if(_0x4924e8==='1'){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger['error'](_0x8c6d('0xd3'),'status',_0x8c6d('0x87'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0xd4')]&&_0x4924e8>=0xc8&&_0x4924e8<=0xce){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),'status','clicksend',util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0xcf'):var _0x39839b=_0xdad331[_0x8c6d('0x3d')][_0x8c6d('0x8d')][0x0];if(_0x39839b[_0x8c6d('0x2a')]['groupName']===_0x8c6d('0xd2')){return _0x4a0e28['update']({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),_0x8c6d('0x2a'),_0x8c6d('0xcf'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x91'):if(_0x4924e8==_0x8c6d('0xd5')||_0x4924e8=='RECEIVED_BY_RECIPIENT'){return _0x4a0e28['update']({'read':!![]});}else{logger[_0x8c6d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),'clickatell',util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x95'):if(_0x4924e8=='message-delivered'){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),'status',_0x8c6d('0x95'),util[_0x8c6d('0xc9')](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;case _0x8c6d('0x96'):if(_0x4924e8==='DELIVRD'||_0x4924e8===_0x8c6d('0xd6')){return _0x4a0e28[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')](_0x8c6d('0xd3'),'status',_0x8c6d('0x96'),util['inspect'](_0xdad331[_0x8c6d('0x3d')],{'showHidden':![],'depth':null}));}break;}return _0x4a0e28;}})['then'](respondWithResult(_0x3b2357,null))[_0x8c6d('0x5a')](handleError(_0x3b2357,null));};exports[_0x8c6d('0xd7')]=function(_0x3451dc,_0x1932ce,_0x4c4b73){var _0x187b08,_0x3537ea,_0x5bac4c;return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x3451dc['params']['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x1932ce,null))[_0x8c6d('0x1f')](function(_0x2362ce){if(_0x2362ce){_0x5bac4c=_0x2362ce;logger[_0x8c6d('0x21')](_0x8c6d('0xd3'),_0x8c6d('0x2a'),_0x8c6d('0xc8'),_0x2362ce[_0x8c6d('0x54')],util[_0x8c6d('0xc9')](_0x3451dc[_0x8c6d('0x49')],{'showHidden':![],'depth':null}));switch(_0x2362ce[_0x8c6d('0x54')]){case'csc':if(_0x3451dc[_0x8c6d('0x49')][_0x8c6d('0xd8')]&&_0x3451dc[_0x8c6d('0x49')][_0x8c6d('0xd9')]){_0x3537ea=_0x3451dc[_0x8c6d('0x49')]['state'];return db[_0x8c6d('0xaa')]['find']({'where':{'messageId':_0x3451dc['query']['message-id']}});}break;}}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x1932ce,null))[_0x8c6d('0x1f')](function(_0x36968e){if(_0x36968e){_0x187b08=_0x36968e;switch(_0x5bac4c[_0x8c6d('0x54')]){case _0x8c6d('0x8e'):if(_0x3537ea==='2'||_0x3537ea==='6'){return _0x187b08[_0x8c6d('0x34')]({'read':!![]});}else{logger[_0x8c6d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8c6d('0x2a'),_0x8c6d('0x8e'),util['inspect'](_0x3451dc['query'],{'showHidden':![],'depth':null}));};break;}return _0x187b08;}})['then'](respondWithResult(_0x1932ce,null))[_0x8c6d('0x5a')](handleError(_0x1932ce,null));};exports['addAgents']=function(_0x571200,_0x29b31e,_0x565ceb){return db[_0x8c6d('0x45')][_0x8c6d('0x5e')]({'where':{'id':_0x571200[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x29b31e,null))[_0x8c6d('0x1f')](function(_0x2ba3eb){if(_0x2ba3eb){return _0x2ba3eb['addAgents'](_0x571200[_0x8c6d('0x3d')][_0x8c6d('0x6e')],_[_0x8c6d('0xda')](_0x571200[_0x8c6d('0x3d')],['ids','id'])||{})['spread'](function(_0x48e7ff){for(var _0x5634ca=0x0;_0x5634ca<_0x571200['body'][_0x8c6d('0x6e')][_0x8c6d('0x4d')];_0x5634ca+=0x1){socket['emit'](_0x8c6d('0xdb'),{'UserId':_0x571200['body']['ids'][_0x5634ca],'SmsAccountId':_0x571200[_0x8c6d('0x65')]['id']});}return _0x48e7ff;});}})[_0x8c6d('0x1f')](respondWithResult(_0x29b31e,null))['catch'](handleError(_0x29b31e,null));};exports[_0x8c6d('0xdc')]=function(_0x409d0f,_0x44b3e2,_0x5455bd){return db[_0x8c6d('0x45')]['find']({'where':{'id':_0x409d0f[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x44b3e2,null))['then'](function(_0x291732){if(_0x291732){return _0x291732[_0x8c6d('0xdc')](_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')])[_0x8c6d('0x1f')](function(){if(_[_0x8c6d('0xdd')](_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')])){for(var _0x949535=0x0;_0x949535<_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')][_0x8c6d('0x4d')];_0x949535+=0x1){socket[_0x8c6d('0xde')](_0x8c6d('0xdf'),{'UserId':Number(_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')][_0x949535]),'SmsAccountId':Number(_0x409d0f[_0x8c6d('0x65')]['id'])});}}else{socket[_0x8c6d('0xde')](_0x8c6d('0xdf'),{'UserId':Number(_0x409d0f[_0x8c6d('0x49')][_0x8c6d('0x6e')]),'SmsAccountId':Number(_0x409d0f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x44b3e2,null))[_0x8c6d('0x5a')](handleError(_0x44b3e2,null));};exports['getAgents']=function(_0x373333,_0x34e0da,_0x4ad47a){var _0x41e84c={};var _0x5c68fd={};var _0x38a00f;var _0x3d9a68;return db[_0x8c6d('0x45')][_0x8c6d('0x6b')]({'where':{'id':_0x373333[_0x8c6d('0x65')]['id']}})[_0x8c6d('0x1f')](handleEntityNotFound(_0x34e0da,null))[_0x8c6d('0x1f')](function(_0x3ff220){if(_0x3ff220){_0x38a00f=_0x3ff220;_0x5c68fd['model']=_[_0x8c6d('0x5b')](db[_0x8c6d('0xad')][_0x8c6d('0x46')]);_0x5c68fd[_0x8c6d('0x49')]=_[_0x8c6d('0x5b')](_0x373333[_0x8c6d('0x49')]);_0x5c68fd[_0x8c6d('0x4a')]=_[_0x8c6d('0x4b')](_0x5c68fd[_0x8c6d('0x48')],_0x5c68fd[_0x8c6d('0x49')]);_0x41e84c[_0x8c6d('0x4c')]=_['intersection'](_0x5c68fd[_0x8c6d('0x48')],qs[_0x8c6d('0x5c')](_0x373333[_0x8c6d('0x49')][_0x8c6d('0x5c')]));_0x41e84c[_0x8c6d('0x4c')]=_0x41e84c[_0x8c6d('0x4c')][_0x8c6d('0x4d')]?_0x41e84c[_0x8c6d('0x4c')]:_0x5c68fd[_0x8c6d('0x48')];_0x41e84c[_0x8c6d('0x4e')]=qs[_0x8c6d('0x4f')](_0x373333[_0x8c6d('0x49')]['sort']);_0x41e84c[_0x8c6d('0x52')]=qs[_0x8c6d('0x4a')](_[_0x8c6d('0x50')](_0x373333[_0x8c6d('0x49')],_0x5c68fd['filters']));if(_0x373333[_0x8c6d('0x49')]['filter']){_0x41e84c[_0x8c6d('0x52')]=_[_0x8c6d('0x53')](_0x41e84c[_0x8c6d('0x52')],{'$or':_[_0x8c6d('0x44')](_0x41e84c['attributes'],function(_0x228a38){var _0x4e41ee={};_0x4e41ee[_0x228a38]={'$like':'%'+_0x373333['query'][_0x8c6d('0x51')]+'%'};return _0x4e41ee;})});}_0x41e84c=_['merge']({},_0x41e84c,_0x373333[_0x8c6d('0x56')]);return _0x38a00f[_0x8c6d('0xe0')](_0x41e84c);}})[_0x8c6d('0x1f')](function(_0x3a32ad){if(_0x3a32ad){_0x3d9a68=_0x3a32ad[_0x8c6d('0x4d')];if(!_0x373333[_0x8c6d('0x49')][_0x8c6d('0x6c')](_0x8c6d('0x6d'))){_0x41e84c['limit']=qs['limit'](_0x373333[_0x8c6d('0x49')]['limit']);_0x41e84c['offset']=qs[_0x8c6d('0x2c')](_0x373333[_0x8c6d('0x49')][_0x8c6d('0x2c')]);}return _0x38a00f[_0x8c6d('0xe0')](_0x41e84c);}})[_0x8c6d('0x1f')](function(_0x291832){if(_0x291832){return _0x291832?{'count':_0x3d9a68,'rows':_0x291832}:null;}})[_0x8c6d('0x1f')](respondWithResult(_0x34e0da,null))[_0x8c6d('0x5a')](handleError(_0x34e0da,null));}; \ No newline at end of file +var _0x34e8=['csc','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','created','autoclose','push','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','statusInt','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','SmsAccounts','UserProfileResource','name','send','render','contact','agent','interaction','account','index','mandatoryDispositionPause','SmsAccount','fieldName','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','Pause','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rawAttributes','intersection','include','removeDispositions','ids','CannedAnswer','pick','removeAnswers','notify','sms','SmsApplication','Applications','applications','priority','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','skebby','connectel','from','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','text'];(function(_0x6175be,_0x5b108e){var _0x73dc5a=function(_0x5acceb){while(--_0x5acceb){_0x6175be['push'](_0x6175be['shift']());}};_0x73dc5a(++_0x5b108e);}(_0x34e8,0x12c));var _0x834e=function(_0x77bec,_0x341b9e){_0x77bec=_0x77bec-0x0;var _0x4bd4e7=_0x34e8[_0x77bec];return _0x4bd4e7;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];config[_0x834e('0x1c')]=_[_0x834e('0x1d')](config['redis'],{'host':_0x834e('0x1e'),'port':0x18eb});var socket=require(_0x834e('0x1f'))(new Redis(config[_0x834e('0x1c')]));require(_0x834e('0x20'))['register'](socket);var jayson=require(_0x834e('0x21'));var client=jayson[_0x834e('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x316205,_0x4a9cdc,_0x38a8cd,_0x36d443){return new BPromise(function(_0x478afe,_0x43ac41){var _0x22106e=_0x36d443||client;return _0x22106e[_0x834e('0x23')](_0x316205,_0x38a8cd)['then'](function(_0x283e56){logger[_0x834e('0x24')](_0x834e('0x25'),_0x4a9cdc,_0x834e('0x26'));logger[_0x834e('0x27')](_0x834e('0x28'),_0x4a9cdc,_0x834e('0x26'),JSON['stringify'](_0x283e56));if(_0x283e56[_0x834e('0x29')]){if(_0x283e56[_0x834e('0x29')][_0x834e('0x2a')]===0x1f4){logger[_0x834e('0x29')]('SmsAccount,\x20%s,\x20%s',_0x4a9cdc,_0x283e56[_0x834e('0x29')][_0x834e('0x2b')]);return _0x43ac41(_0x283e56['error'][_0x834e('0x2b')]);}logger[_0x834e('0x29')](_0x834e('0x25'),_0x4a9cdc,_0x283e56['error']['message']);return _0x478afe(_0x283e56[_0x834e('0x29')][_0x834e('0x2b')]);}else{logger['info'](_0x834e('0x25'),_0x4a9cdc,_0x834e('0x26'));_0x478afe(_0x283e56['result'][_0x834e('0x2b')]);}})[_0x834e('0x2c')](function(_0x338636){logger['error'](_0x834e('0x25'),_0x4a9cdc,_0x338636);_0x43ac41(_0x338636);});});}function respondWithStatusCode(_0x3e310f,_0x5e1cc5){_0x5e1cc5=_0x5e1cc5||0xcc;return function(_0x5bef62){if(_0x5bef62){return _0x3e310f[_0x834e('0x2d')](_0x5e1cc5);}return _0x3e310f['status'](_0x5e1cc5)[_0x834e('0x2e')]();};}function respondWithResult(_0x3f1b0b,_0x3db026){_0x3db026=_0x3db026||0xc8;return function(_0x2cc2eb){if(_0x2cc2eb){return _0x3f1b0b[_0x834e('0x2f')](_0x3db026)[_0x834e('0x30')](_0x2cc2eb);}};}function respondWithFilteredResult(_0x491919,_0x510780){return function(_0x4dc64a){if(_0x4dc64a){var _0x58c1d7=typeof _0x510780[_0x834e('0x31')]===_0x834e('0x32')&&typeof _0x510780[_0x834e('0x33')]==='undefined';var _0xb5bc06=_0x4dc64a[_0x834e('0x34')];var _0x1f3671=_0x58c1d7?0x0:_0x510780[_0x834e('0x31')];var _0x4551f5=_0x58c1d7?_0x4dc64a[_0x834e('0x34')]:_0x510780[_0x834e('0x31')]+_0x510780[_0x834e('0x33')];var _0x278db3;if(_0x4551f5>=_0xb5bc06){_0x4551f5=_0xb5bc06;_0x278db3=0xc8;}else{_0x278db3=0xce;}_0x491919['status'](_0x278db3);return _0x491919[_0x834e('0x35')]('Content-Range',_0x1f3671+'-'+_0x4551f5+'/'+_0xb5bc06)[_0x834e('0x30')](_0x4dc64a);}return null;};}function patchUpdates(_0x3787b0){return function(_0x9ab921){try{jsonpatch[_0x834e('0x36')](_0x9ab921,_0x3787b0,!![]);}catch(_0x444366){return BPromise[_0x834e('0x37')](_0x444366);}return _0x9ab921[_0x834e('0x38')]();};}function saveUpdates(_0x38cd29,_0x358c31){return function(_0x12b2bc){if(_0x12b2bc){return _0x12b2bc['update'](_0x38cd29)[_0x834e('0x39')](function(_0x2f408a){return _0x2f408a;});}return null;};}function removeEntity(_0x24a9df,_0xaf01f4){return function(_0x595cc0){if(_0x595cc0){return _0x595cc0[_0x834e('0x3a')]()[_0x834e('0x39')](function(){var _0x4b12f5=_0x595cc0['get']({'plain':!![]});var _0x59385a=_0x834e('0x3b');return db[_0x834e('0x3c')][_0x834e('0x3a')]({'where':{'type':_0x59385a,'resourceId':_0x4b12f5['id']}})[_0x834e('0x39')](function(){return _0x595cc0;});})[_0x834e('0x39')](function(){_0x24a9df[_0x834e('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2d94,_0x513f36){return function(_0xe103fe){if(!_0xe103fe){_0x2c2d94[_0x834e('0x2d')](0x194);}return _0xe103fe;};}function handleError(_0x47abed,_0x18ac3b){_0x18ac3b=_0x18ac3b||0x1f4;return function(_0x2f56c7){logger['error'](_0x2f56c7['stack']);if(_0x2f56c7[_0x834e('0x3d')]){delete _0x2f56c7[_0x834e('0x3d')];}_0x47abed[_0x834e('0x2f')](_0x18ac3b)[_0x834e('0x3e')](_0x2f56c7);};}function getMustacheRender(_0x3c49bd,_0x4ca43c){return Mustache[_0x834e('0x3f')](_0x3c49bd,_['merge'](_0x4ca43c['body'],{'contact':_0x4ca43c[_0x834e('0x40')],'message':_0x4ca43c['message'],'agent':_0x4ca43c[_0x834e('0x41')],'interaction':_0x4ca43c[_0x834e('0x42')],'account':_0x4ca43c[_0x834e('0x43')]}))||'';}exports[_0x834e('0x44')]=function(_0x2b7933,_0x574ea8){var _0x207523={'include':[{'model':db['Pause'],'as':_0x834e('0x45')}]},_0x26b847={},_0x38f266={'count':0x0,'rows':[]};var _0x16ac45=_['map'](db[_0x834e('0x46')]['rawAttributes'],function(_0x2ebfb6){return{'name':_0x2ebfb6[_0x834e('0x47')],'type':_0x2ebfb6['type']['key']};});_0x26b847[_0x834e('0x48')]=_[_0x834e('0x49')](_0x16ac45,_0x834e('0x3d'));_0x26b847[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x2b7933[_0x834e('0x4a')]);_0x26b847[_0x834e('0x4c')]=_['intersection'](_0x26b847[_0x834e('0x48')],_0x26b847['query']);_0x207523[_0x834e('0x4d')]=_['intersection'](_0x26b847[_0x834e('0x48')],qs['fields'](_0x2b7933[_0x834e('0x4a')][_0x834e('0x4e')]));_0x207523['attributes']=_0x207523[_0x834e('0x4d')][_0x834e('0x4f')]?_0x207523[_0x834e('0x4d')]:_0x26b847[_0x834e('0x48')];if(!_0x2b7933[_0x834e('0x4a')][_0x834e('0x50')](_0x834e('0x51'))){_0x207523[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x2b7933[_0x834e('0x4a')]['limit']);_0x207523[_0x834e('0x31')]=qs[_0x834e('0x31')](_0x2b7933['query'][_0x834e('0x31')]);}_0x207523[_0x834e('0x52')]=qs[_0x834e('0x53')](_0x2b7933[_0x834e('0x4a')][_0x834e('0x53')]);_0x207523[_0x834e('0x54')]=qs['filters'](_['pick'](_0x2b7933[_0x834e('0x4a')],_0x26b847[_0x834e('0x4c')]),_0x16ac45);if(_0x2b7933[_0x834e('0x4a')][_0x834e('0x55')]){_0x207523[_0x834e('0x54')]=_[_0x834e('0x56')](_0x207523[_0x834e('0x54')],{'$or':_[_0x834e('0x49')](_0x16ac45,function(_0x1419eb){if(_0x1419eb[_0x834e('0x57')]!==_0x834e('0x58')){var _0x385435={};_0x385435[_0x1419eb[_0x834e('0x3d')]]={'$like':'%'+_0x2b7933[_0x834e('0x4a')][_0x834e('0x55')]+'%'};return _0x385435;}})});}_0x207523=_[_0x834e('0x56')]({},_0x207523,_0x2b7933[_0x834e('0x59')]);var _0x32b8f7={'where':_0x207523[_0x834e('0x54')]};return db[_0x834e('0x46')]['count'](_0x32b8f7)[_0x834e('0x39')](function(_0x1f08b9){_0x38f266['count']=_0x1f08b9;if(_0x2b7933[_0x834e('0x4a')][_0x834e('0x5a')]){_0x207523['include']=[{'all':!![]}];}return db[_0x834e('0x46')][_0x834e('0x5b')](_0x207523);})[_0x834e('0x39')](function(_0x35636e){_0x38f266[_0x834e('0x5c')]=_0x35636e;return _0x38f266;})[_0x834e('0x39')](respondWithFilteredResult(_0x574ea8,_0x207523))[_0x834e('0x2c')](handleError(_0x574ea8,null));};exports['show']=function(_0x1ad7fe,_0x8bc6c6){var _0x3e0550={'raw':![],'where':{'id':_0x1ad7fe[_0x834e('0x5d')]['id']},'include':[{'model':db[_0x834e('0x5e')],'as':_0x834e('0x45')}]},_0x363675={};_0x363675[_0x834e('0x48')]=_['keys'](db[_0x834e('0x46')]['rawAttributes']);_0x363675[_0x834e('0x4a')]=_['keys'](_0x1ad7fe[_0x834e('0x4a')]);_0x363675['filters']=_['intersection'](_0x363675[_0x834e('0x48')],_0x363675[_0x834e('0x4a')]);_0x3e0550['attributes']=_['intersection'](_0x363675[_0x834e('0x48')],qs[_0x834e('0x4e')](_0x1ad7fe[_0x834e('0x4a')][_0x834e('0x4e')]));_0x3e0550[_0x834e('0x4d')]=_0x3e0550[_0x834e('0x4d')][_0x834e('0x4f')]?_0x3e0550[_0x834e('0x4d')]:_0x363675['model'];if(_0x1ad7fe[_0x834e('0x4a')][_0x834e('0x5a')]){_0x3e0550['include']=[{'all':!![]}];}_0x3e0550=_[_0x834e('0x56')]({},_0x3e0550,_0x1ad7fe['options']);return db[_0x834e('0x46')][_0x834e('0x5f')](_0x3e0550)['then'](handleEntityNotFound(_0x8bc6c6,null))[_0x834e('0x39')](respondWithResult(_0x8bc6c6,null))[_0x834e('0x2c')](handleError(_0x8bc6c6,null));};exports[_0x834e('0x60')]=function(_0x25f720,_0x5a2924){return db[_0x834e('0x46')][_0x834e('0x60')](_0x25f720[_0x834e('0x61')],{})['then'](function(_0x246b8e){var _0x1fcae9=_0x25f720[_0x834e('0x62')][_0x834e('0x63')]({'plain':!![]});if(!_0x1fcae9)throw new Error(_0x834e('0x64'));if(_0x1fcae9[_0x834e('0x65')]===_0x834e('0x62')){var _0x1def00=_0x246b8e[_0x834e('0x63')]({'plain':!![]});var _0xfcccd8=_0x834e('0x3b');return db[_0x834e('0x66')][_0x834e('0x5f')]({'where':{'name':_0xfcccd8,'userProfileId':_0x1fcae9[_0x834e('0x67')]},'raw':!![]})[_0x834e('0x39')](function(_0x17b8e3){if(_0x17b8e3&&_0x17b8e3[_0x834e('0x68')]===0x0){return db[_0x834e('0x3c')][_0x834e('0x60')]({'name':_0x1def00[_0x834e('0x3d')],'resourceId':_0x1def00['id'],'type':_0x17b8e3[_0x834e('0x3d')],'sectionId':_0x17b8e3['id']},{})[_0x834e('0x39')](function(){return _0x246b8e;});}else{return _0x246b8e;}})['catch'](function(_0x2145cf){logger[_0x834e('0x29')](_0x834e('0x69'),_0x2145cf);throw _0x2145cf;});}return _0x246b8e;})[_0x834e('0x39')](respondWithResult(_0x5a2924,0xc9))['catch'](handleError(_0x5a2924,null));};exports[_0x834e('0x6a')]=function(_0x5a9c70,_0x56a152){if(_0x5a9c70[_0x834e('0x61')]['id']){delete _0x5a9c70[_0x834e('0x61')]['id'];}return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x5a9c70[_0x834e('0x5d')]['id']},'include':[{'model':db[_0x834e('0x5e')],'as':_0x834e('0x45')}]})[_0x834e('0x39')](handleEntityNotFound(_0x56a152,null))['then'](saveUpdates(_0x5a9c70[_0x834e('0x61')],null))['then'](respondWithResult(_0x56a152,null))[_0x834e('0x2c')](handleError(_0x56a152,null));};exports[_0x834e('0x3a')]=function(_0x514fe5,_0x4c5886){return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x514fe5[_0x834e('0x5d')]['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x4c5886,null))[_0x834e('0x39')](removeEntity(_0x4c5886,null))['catch'](handleError(_0x4c5886,null));};exports[_0x834e('0x6b')]=function(_0x15018f,_0x2df64f){return db[_0x834e('0x46')][_0x834e('0x6b')]()[_0x834e('0x39')](respondWithResult(_0x2df64f,null))[_0x834e('0x2c')](handleError(_0x2df64f,null));};exports[_0x834e('0x6c')]=function(_0x376f72,_0x324f67,_0x5b2bf6){if(_0x376f72[_0x834e('0x61')]['id']){delete _0x376f72[_0x834e('0x61')]['id'];}return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x376f72['params']['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x324f67,null))['then'](function(_0x5ce8b0){if(_0x5ce8b0){_0x376f72['body'][_0x834e('0x6d')]=_0x5ce8b0['id'];return db[_0x834e('0x6e')]['create'](_0x376f72[_0x834e('0x61')]);}})[_0x834e('0x39')](respondWithResult(_0x324f67,null))['catch'](handleError(_0x324f67,null));};exports[_0x834e('0x6f')]=function(_0x18ccb2,_0x4b88e7,_0x5df169){var _0x346be5={'raw':![],'where':{}};var _0x2a42a3={};var _0x8bc7d9={'count':0x0,'rows':[]};return db[_0x834e('0x46')][_0x834e('0x70')]({'where':{'id':_0x18ccb2['params']['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x4b88e7,null))['then'](function(_0x30d3e1){if(_0x30d3e1){_0x2a42a3[_0x834e('0x48')]=_[_0x834e('0x4b')](db['Disposition'][_0x834e('0x71')]);_0x2a42a3[_0x834e('0x4a')]=_['keys'](_0x18ccb2[_0x834e('0x4a')]);_0x2a42a3[_0x834e('0x4c')]=_[_0x834e('0x72')](_0x2a42a3['model'],_0x2a42a3[_0x834e('0x4a')]);_0x346be5[_0x834e('0x4d')]=_[_0x834e('0x72')](_0x2a42a3[_0x834e('0x48')],qs[_0x834e('0x4e')](_0x18ccb2[_0x834e('0x4a')][_0x834e('0x4e')]));_0x346be5[_0x834e('0x4d')]=_0x346be5[_0x834e('0x4d')][_0x834e('0x4f')]?_0x346be5['attributes']:_0x2a42a3['model'];if(!_0x18ccb2['query'][_0x834e('0x50')](_0x834e('0x51'))){_0x346be5[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x18ccb2[_0x834e('0x4a')]['limit']);_0x346be5['offset']=qs[_0x834e('0x31')](_0x18ccb2[_0x834e('0x4a')][_0x834e('0x31')]);}_0x346be5[_0x834e('0x52')]=qs[_0x834e('0x53')](_0x18ccb2['query'][_0x834e('0x53')]);_0x346be5[_0x834e('0x54')]=qs[_0x834e('0x4c')](_['pick'](_0x18ccb2[_0x834e('0x4a')],_0x2a42a3[_0x834e('0x4c')]));_0x346be5[_0x834e('0x54')][_0x834e('0x6d')]=_0x30d3e1['id'];if(_0x18ccb2[_0x834e('0x4a')]['filter']){_0x346be5['where']=_[_0x834e('0x56')](_0x346be5[_0x834e('0x54')],{'$or':_['map'](_0x346be5[_0x834e('0x4d')],function(_0x509427){var _0x40c401={};_0x40c401[_0x509427]={'$like':'%'+_0x18ccb2[_0x834e('0x4a')][_0x834e('0x55')]+'%'};return _0x40c401;})});}_0x346be5=_['merge']({},_0x346be5,_0x18ccb2[_0x834e('0x59')]);return db['Disposition']['count']({'where':_0x346be5['where']})[_0x834e('0x39')](function(_0x4627ac){_0x8bc7d9[_0x834e('0x34')]=_0x4627ac;if(_0x18ccb2[_0x834e('0x4a')][_0x834e('0x5a')]){_0x346be5[_0x834e('0x73')]=[{'all':!![]}];}return db[_0x834e('0x6e')][_0x834e('0x5b')](_0x346be5);})[_0x834e('0x39')](function(_0x53f6e3){_0x8bc7d9[_0x834e('0x5c')]=_0x53f6e3;return _0x8bc7d9;});}})['then'](respondWithFilteredResult(_0x4b88e7,_0x346be5))[_0x834e('0x2c')](handleError(_0x4b88e7,null));};exports[_0x834e('0x74')]=function(_0x38bfa4,_0x27df3d,_0x1d1877){return db[_0x834e('0x46')]['find']({'where':{'id':_0x38bfa4['params']['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x27df3d,null))[_0x834e('0x39')](function(_0x4eff8d){if(_0x4eff8d){return _0x4eff8d[_0x834e('0x74')](_0x38bfa4[_0x834e('0x4a')][_0x834e('0x75')]);}})[_0x834e('0x39')](respondWithStatusCode(_0x27df3d,null))[_0x834e('0x2c')](handleError(_0x27df3d,null));};exports['addAnswer']=function(_0x29839d,_0x78917b,_0x4c319d){if(_0x29839d['body']['id']){delete _0x29839d['body']['id'];}return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x29839d['params']['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x78917b,null))[_0x834e('0x39')](function(_0x49b480){if(_0x49b480){_0x29839d[_0x834e('0x61')]['SmsAccountId']=_0x49b480['id'];return db['CannedAnswer'][_0x834e('0x60')](_0x29839d[_0x834e('0x61')]);}})[_0x834e('0x39')](respondWithResult(_0x78917b,null))[_0x834e('0x2c')](handleError(_0x78917b,null));};exports['getAnswers']=function(_0x3951ed,_0x34ecc8,_0x260934){var _0x1b0b41={'raw':![],'where':{}};var _0x46aabf={};var _0x27603d={'count':0x0,'rows':[]};return db[_0x834e('0x46')][_0x834e('0x70')]({'where':{'id':_0x3951ed[_0x834e('0x5d')]['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x34ecc8,null))[_0x834e('0x39')](function(_0x261e3d){if(_0x261e3d){_0x46aabf[_0x834e('0x48')]=_[_0x834e('0x4b')](db[_0x834e('0x76')][_0x834e('0x71')]);_0x46aabf[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x3951ed[_0x834e('0x4a')]);_0x46aabf[_0x834e('0x4c')]=_[_0x834e('0x72')](_0x46aabf[_0x834e('0x48')],_0x46aabf['query']);_0x1b0b41[_0x834e('0x4d')]=_[_0x834e('0x72')](_0x46aabf[_0x834e('0x48')],qs[_0x834e('0x4e')](_0x3951ed[_0x834e('0x4a')][_0x834e('0x4e')]));_0x1b0b41[_0x834e('0x4d')]=_0x1b0b41[_0x834e('0x4d')][_0x834e('0x4f')]?_0x1b0b41['attributes']:_0x46aabf['model'];if(!_0x3951ed['query'][_0x834e('0x50')]('nolimit')){_0x1b0b41[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x3951ed[_0x834e('0x4a')]['limit']);_0x1b0b41[_0x834e('0x31')]=qs[_0x834e('0x31')](_0x3951ed[_0x834e('0x4a')][_0x834e('0x31')]);}_0x1b0b41[_0x834e('0x52')]=qs[_0x834e('0x53')](_0x3951ed['query'][_0x834e('0x53')]);_0x1b0b41[_0x834e('0x54')]=qs[_0x834e('0x4c')](_[_0x834e('0x77')](_0x3951ed[_0x834e('0x4a')],_0x46aabf['filters']));_0x1b0b41['where']['SmsAccountId']=_0x261e3d['id'];if(_0x3951ed['query'][_0x834e('0x55')]){_0x1b0b41[_0x834e('0x54')]=_['merge'](_0x1b0b41[_0x834e('0x54')],{'$or':_[_0x834e('0x49')](_0x1b0b41['attributes'],function(_0x296629){var _0x38d82d={};_0x38d82d[_0x296629]={'$like':'%'+_0x3951ed[_0x834e('0x4a')][_0x834e('0x55')]+'%'};return _0x38d82d;})});}_0x1b0b41=_[_0x834e('0x56')]({},_0x1b0b41,_0x3951ed[_0x834e('0x59')]);return db['CannedAnswer']['count']({'where':_0x1b0b41[_0x834e('0x54')]})[_0x834e('0x39')](function(_0x1d2e12){_0x27603d['count']=_0x1d2e12;if(_0x3951ed[_0x834e('0x4a')][_0x834e('0x5a')]){_0x1b0b41['include']=[{'all':!![]}];}return db[_0x834e('0x76')][_0x834e('0x5b')](_0x1b0b41);})[_0x834e('0x39')](function(_0x30e3aa){_0x27603d['rows']=_0x30e3aa;return _0x27603d;});}})[_0x834e('0x39')](respondWithFilteredResult(_0x34ecc8,_0x1b0b41))['catch'](handleError(_0x34ecc8,null));};exports['removeAnswers']=function(_0xc64958,_0x292ce8,_0x24dcd0){return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0xc64958[_0x834e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x292ce8,null))['then'](function(_0x1b7bfc){if(_0x1b7bfc){return _0x1b7bfc[_0x834e('0x78')](_0xc64958[_0x834e('0x4a')][_0x834e('0x75')]);}})[_0x834e('0x39')](respondWithStatusCode(_0x292ce8,null))[_0x834e('0x2c')](handleError(_0x292ce8,null));};exports[_0x834e('0x79')]=function(_0x596031,_0x435a75,_0xf25875){var _0x56f28b={'channel':_0x834e('0x7a')};var _0x6a507a=[];var _0xa0af07=[];var _0x2a3ca4={};return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x596031[_0x834e('0x5d')]['id']},'include':[{'model':db[_0x834e('0x7b')],'as':_0x834e('0x7c')}]})[_0x834e('0x39')](handleEntityNotFound(_0x435a75,null))[_0x834e('0x39')](function(_0x152372){_0x56f28b[_0x834e('0x43')]=_0x152372;_0x56f28b[_0x834e('0x7d')]=_['orderBy'](_0x152372[_0x834e('0x7c')],[_0x834e('0x7e')],['asc']);if(_0x56f28b[_0x834e('0x43')]['Applications']){delete _0x56f28b[_0x834e('0x43')]['Applications'];}return db[_0x834e('0x7f')]['describe']();})[_0x834e('0x39')](function(_0x14ba55){if(!_0x14ba55){throw new db[(_0x834e('0x80'))][(_0x834e('0x81'))]('no\x20available\x20attributes');}_0x6a507a=_[_0x834e('0x82')](_[_0x834e('0x4b')](_0x14ba55),[_0x834e('0x83'),_0x834e('0x84')]);_0xa0af07=_[_0x834e('0x82')](_[_0x834e('0x4b')](_0x14ba55),[_0x834e('0x83'),_0x834e('0x84'),_0x834e('0x85'),_0x834e('0x86')]);_0x56f28b[_0x834e('0x61')]={'mapKey':_0x834e('0x87')};if(_0x56f28b[_0x834e('0x43')][_0x834e('0x57')]){switch(_0x56f28b[_0x834e('0x43')][_0x834e('0x57')]){case _0x834e('0x88'):_0x56f28b['body']['from']=_0x596031[_0x834e('0x61')][_0x834e('0x89')];_0x56f28b[_0x834e('0x61')][_0x834e('0x61')]=_0x596031[_0x834e('0x61')][_0x834e('0x8a')];_0x56f28b[_0x834e('0x61')][_0x834e('0x8b')]=_0x596031[_0x834e('0x61')][_0x834e('0x8c')];break;case _0x834e('0x8d'):_0x56f28b[_0x834e('0x61')]['from']='+'+_0x596031[_0x834e('0x61')]['sender'];_0x56f28b[_0x834e('0x61')][_0x834e('0x61')]=_0x596031[_0x834e('0x61')]['text'];break;case _0x834e('0x8e'):_0x56f28b[_0x834e('0x61')]['from']=_0x596031['body'][_0x834e('0x8f')];_0x56f28b[_0x834e('0x61')]['body']=_0x596031[_0x834e('0x61')][_0x834e('0x2b')];break;case _0x834e('0x90'):_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')]=_0x596031['body']['from'];_0x56f28b[_0x834e('0x61')]['body']=_0x596031['body']['body'];_0x56f28b[_0x834e('0x61')][_0x834e('0x8b')]=_0x596031['body'][_0x834e('0x91')];break;case _0x834e('0x92'):_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')]=_0x596031['body'][_0x834e('0x89')];_0x56f28b[_0x834e('0x61')][_0x834e('0x61')]=_0x596031['body'][_0x834e('0x93')];_0x56f28b['body'][_0x834e('0x8b')]=_0x596031['body'][_0x834e('0x94')];break;case _0x834e('0x95'):_0x56f28b['body'][_0x834e('0x8f')]='+'+_0x596031[_0x834e('0x61')][_0x834e('0x96')][0x0][_0x834e('0x8f')];_0x56f28b[_0x834e('0x61')][_0x834e('0x61')]=_0x596031['body'][_0x834e('0x96')][0x0][_0x834e('0x97')];_0x56f28b[_0x834e('0x61')][_0x834e('0x8b')]=_0x596031[_0x834e('0x61')][_0x834e('0x96')][0x0]['messageId'];break;case _0x834e('0x98'):_0x56f28b['body']['from']=_0x596031[_0x834e('0x61')]['originatingAddress'];_0x56f28b['body'][_0x834e('0x61')]=_0x596031[_0x834e('0x61')][_0x834e('0x99')][_0x834e('0x2b')];break;case _0x834e('0x9a'):_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')]=_0x596031[_0x834e('0x61')][_0x834e('0x9b')];_0x56f28b[_0x834e('0x61')][_0x834e('0x61')]=_0x596031[_0x834e('0x61')][_0x834e('0x97')];_0x56f28b[_0x834e('0x61')]['messageId']=_0x596031[_0x834e('0x61')]['replyMessageId'];break;case _0x834e('0x9c'):_0x56f28b[_0x834e('0x61')][_0x834e('0x8b')]=_0x596031[_0x834e('0x61')][0x0]['message']['id'];_0x56f28b['body'][_0x834e('0x8f')]=_0x596031[_0x834e('0x61')][0x0]['message'][_0x834e('0x8f')];_0x56f28b[_0x834e('0x61')]['body']=_0x596031[_0x834e('0x61')][0x0][_0x834e('0x2b')][_0x834e('0x97')];break;case _0x834e('0x9d'):_0x56f28b['body']['from']=_0x596031['body']['from'];_0x56f28b[_0x834e('0x61')][_0x834e('0x61')]=_0x596031['body'][_0x834e('0x2b')];_0x56f28b['body'][_0x834e('0x8b')]=_0x596031[_0x834e('0x61')][_0x834e('0x9e')];break;}}if(_0x56f28b[_0x834e('0x61')]['id']){delete _0x56f28b[_0x834e('0x61')]['id'];}if(_[_0x834e('0x9f')](_0x56f28b[_0x834e('0x61')]['from'])){throw new db[(_0x834e('0x80'))][(_0x834e('0x81'))]('from\x20is\x20mandatory');}if(_[_0x834e('0x9f')](_0x56f28b[_0x834e('0x61')]['body'])||_0x56f28b['body']['body']===''){throw new db[(_0x834e('0x80'))][(_0x834e('0x81'))](_0x834e('0xa0'));}if(_['isNil'](_0x56f28b[_0x834e('0x61')][_0x834e('0xa1')])){throw new db[(_0x834e('0x80'))][(_0x834e('0x81'))](_0x834e('0xa2')+_0xa0af07);}if(!_[_0x834e('0xa3')](_0xa0af07,_0x56f28b[_0x834e('0x61')][_0x834e('0xa1')])){throw new db[(_0x834e('0x80'))][(_0x834e('0x81'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa0af07);}_0x2a3ca4[_0x56f28b['body'][_0x834e('0xa1')]]=_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')];return db[_0x834e('0xa4')][_0x834e('0x5f')]({'where':{'id':_0x56f28b[_0x834e('0x43')][_0x834e('0x86')]},'include':[{'model':db[_0x834e('0x7f')],'as':_0x834e('0xa5'),'where':_0x2a3ca4,'limit':0x1,'order':[[_0x834e('0x84'),_0x834e('0xa6')]]}]});})[_0x834e('0x39')](handleEntityNotFound(_0x435a75,null))[_0x834e('0x39')](function(_0x4b12cd){if(_0x4b12cd){_0x56f28b[_0x834e('0xa7')]=_[_0x834e('0xa8')](_0x4b12cd,[_0x834e('0xa5')]);if(_0x4b12cd[_0x834e('0xa5')]['length']){return _0x4b12cd['Contacts'][0x0];}var _0x4e7c43=_[_0x834e('0x1d')](_0x56f28b[_0x834e('0x61')],{'firstName':_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')],'ListId':_0x4b12cd['id']});_0x4e7c43[_0x56f28b[_0x834e('0x61')][_0x834e('0xa1')]]=_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')];return db['CmContact']['create'](_0x4e7c43,{'fields':_0x6a507a,'raw':!![]});}})['then'](handleEntityNotFound(_0x435a75,null))['then'](function(_0x2024dd){if(_0x2024dd){_0x56f28b[_0x834e('0x40')]=_0x2024dd;var _0x37defd={'ContactId':_0x2024dd['id'],'phone':_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')],'SmsAccountId':_0x596031[_0x834e('0x5d')]['id']};var _0x3bee40={'ContactId':_0x2024dd['id'],'SmsAccountId':_0x596031[_0x834e('0x5d')]['id'],'closed':![]};return db[_0x834e('0xa9')]['find']({'where':_0x3bee40})['then'](function(_0x4d1545){if(_0x4d1545){return[_0x4d1545,![]];}return db['SmsInteraction'][_0x834e('0x60')](_0x37defd)[_0x834e('0x39')](function(_0x284183){return[_0x284183,!![]];});});}})[_0x834e('0xaa')](function(_0x862ba0,_0xcb9751){_0x56f28b[_0x834e('0x42')]=_0x862ba0[_0x834e('0x63')]({'plain':!![]});_0x56f28b[_0x834e('0x42')][_0x834e('0xab')]=![];if(_0xcb9751){if(_0x56f28b[_0x834e('0x43')][_0x834e('0xac')]){_0x56f28b[_0x834e('0x7d')][_0x834e('0xad')]({'id':0x0,'priority':_0x56f28b[_0x834e('0x7d')][_0x834e('0x4f')]+0x1,'app':'close','appdata':_0x834e('0xae'),'interval':'*,*,*,*'});}_0x56f28b[_0x834e('0x42')][_0x834e('0xab')]=!![];}return db[_0x834e('0xaf')]['create']({'phone':_0x56f28b[_0x834e('0x61')][_0x834e('0x8f')],'messageId':_0x56f28b['body']['messageId'],'body':_0x56f28b[_0x834e('0x61')][_0x834e('0x61')],'SmsAccountId':_0x596031[_0x834e('0x5d')]['id'],'SmsInteractionId':_0x862ba0['id'],'direction':'in','ContactId':_0x862ba0[_0x834e('0xb0')],'AttachmentId':_0x56f28b[_0x834e('0x61')][_0x834e('0xb1')]});})[_0x834e('0x39')](function(_0x239a4e){_0x56f28b['message']=_0x239a4e;if(_0x56f28b[_0x834e('0x42')][_0x834e('0xb2')]){return db[_0x834e('0xb3')][_0x834e('0x5f')]({'attributes':['id',_0x834e('0x3d')],'where':{'id':_0x56f28b[_0x834e('0x42')][_0x834e('0xb2')]}})['then'](function(_0x40a92a){if(_0x40a92a){_0x56f28b['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x834e('0x41'),'appdata':_0x40a92a[_0x834e('0x3d')]+','+(_0x56f28b['account'][_0x834e('0xb4')]||0xa),'interval':_0x834e('0xb5')});}return respondWithRpcPromise('Start',_0x834e('0xb6'),_0x56f28b);});}return respondWithRpcPromise(_0x834e('0xb7'),'startRouting',_0x56f28b);})['then'](function(_0xbb0217){if(_0xbb0217){var _0x2ec9f1=0xc8;var _0x4e6525='receiveMessage';logger[_0x834e('0x24')](_0x834e('0x28'),_0x4e6525,_0x2ec9f1,'entity\x20found');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4e6525,_0x2ec9f1,'entity\x20found',JSON[_0x834e('0xb8')](_0xbb0217));if(_0x56f28b['account'][_0x834e('0x57')]==='twilio'){return _0x435a75[_0x834e('0x2f')](_0x2ec9f1)[_0x834e('0x35')](_0x834e('0xb9'),_0x834e('0xba'))['send'](_0x834e('0xbb'));}else{return _0x435a75[_0x834e('0x2f')](_0x2ec9f1)[_0x834e('0x30')](_0xbb0217);}}})[_0x834e('0x2c')](handleError(_0x435a75,null));};exports[_0x834e('0xbc')]=function(_0x469352,_0x3d8abb,_0x107ef9){return db[_0x834e('0x46')][_0x834e('0x70')]({'where':{'id':_0x469352['params']['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x3d8abb,null))['then'](function(_0x3980c0){if(_0x3980c0){return db[_0x834e('0xbd')][_0x834e('0xbe')](function(_0x31a7ae){return db[_0x834e('0x7b')]['destroy']({'where':{'SmsAccountId':_0x469352[_0x834e('0x5d')]['id']},'transaction':_0x31a7ae})['then'](function(_0x4e5798){var _0x21bf6a=_[_0x834e('0x49')](_0x469352[_0x834e('0x61')],function(_0x5012d8){_0x5012d8[_0x834e('0x6d')]=_0x469352[_0x834e('0x5d')]['id'];return _0x5012d8;});return db[_0x834e('0x7b')][_0x834e('0xbf')](_0x21bf6a,{'transaction':_0x31a7ae});});})[_0x834e('0x39')](function(){return db[_0x834e('0x7b')][_0x834e('0xc0')]({'where':{'SmsAccountId':_0x469352[_0x834e('0x5d')]['id']},'order':_0x834e('0x7e')});});}})[_0x834e('0x39')](respondWithResult(_0x3d8abb,null))[_0x834e('0x2c')](handleError(_0x3d8abb,null));};exports['getApplications']=function(_0x22d857,_0x121d87,_0x121d4f){var _0x2d11f9={};var _0x2bc4c8={};var _0x30d338;var _0x55e3a5;return db[_0x834e('0x46')][_0x834e('0x70')]({'where':{'id':_0x22d857[_0x834e('0x5d')]['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x121d87,null))[_0x834e('0x39')](function(_0x27e2af){if(_0x27e2af){_0x30d338=_0x27e2af;_0x2bc4c8[_0x834e('0x48')]=_[_0x834e('0x4b')](db[_0x834e('0x7b')][_0x834e('0x71')]);_0x2bc4c8['query']=_['keys'](_0x22d857[_0x834e('0x4a')]);_0x2bc4c8['filters']=_[_0x834e('0x72')](_0x2bc4c8[_0x834e('0x48')],_0x2bc4c8[_0x834e('0x4a')]);_0x2d11f9[_0x834e('0x4d')]=_[_0x834e('0x72')](_0x2bc4c8[_0x834e('0x48')],qs['fields'](_0x22d857[_0x834e('0x4a')]['fields']));_0x2d11f9['attributes']=_0x2d11f9['attributes'][_0x834e('0x4f')]?_0x2d11f9[_0x834e('0x4d')]:_0x2bc4c8['model'];_0x2d11f9['order']=qs['sort'](_0x22d857[_0x834e('0x4a')][_0x834e('0x53')]);_0x2d11f9[_0x834e('0x54')]=qs['filters'](_[_0x834e('0x77')](_0x22d857[_0x834e('0x4a')],_0x2bc4c8[_0x834e('0x4c')]));if(_0x22d857[_0x834e('0x4a')][_0x834e('0x55')]){_0x2d11f9[_0x834e('0x54')]=_['merge'](_0x2d11f9['where'],{'$or':_['map'](_0x2d11f9['attributes'],function(_0x354d58){var _0xf82ca8={};_0xf82ca8[_0x354d58]={'$like':'%'+_0x22d857[_0x834e('0x4a')][_0x834e('0x55')]+'%'};return _0xf82ca8;})});}_0x2d11f9=_[_0x834e('0x56')]({},_0x2d11f9,_0x22d857[_0x834e('0x59')]);return _0x30d338[_0x834e('0xc1')](_0x2d11f9);}})[_0x834e('0x39')](function(_0x1d2f5e){if(_0x1d2f5e){_0x55e3a5=_0x1d2f5e[_0x834e('0x4f')];if(!_0x22d857[_0x834e('0x4a')][_0x834e('0x50')](_0x834e('0x51'))){_0x2d11f9[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x22d857['query']['limit']);_0x2d11f9[_0x834e('0x31')]=qs[_0x834e('0x31')](_0x22d857[_0x834e('0x4a')]['offset']);}return _0x30d338[_0x834e('0xc1')](_0x2d11f9);}})[_0x834e('0x39')](function(_0x83d32b){if(_0x83d32b){return _0x83d32b?{'count':_0x55e3a5,'rows':_0x83d32b}:null;}})[_0x834e('0x39')](respondWithResult(_0x121d87,null))[_0x834e('0x2c')](handleError(_0x121d87,null));};exports[_0x834e('0xc2')]=function(_0x2f728f,_0x1391eb,_0x42b172){var _0x53850c={'raw':![],'where':{}};var _0x1785ca={};var _0x2e0674={'count':0x0,'rows':[]};return db[_0x834e('0x46')][_0x834e('0x70')]({'where':{'id':_0x2f728f['params']['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x1391eb,null))[_0x834e('0x39')](function(_0x2a54b2){if(_0x2a54b2){_0x1785ca[_0x834e('0x48')]=_[_0x834e('0x4b')](db[_0x834e('0xa9')][_0x834e('0x71')]);_0x1785ca[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x2f728f['query']);_0x1785ca[_0x834e('0x4c')]=_['intersection'](_0x1785ca[_0x834e('0x48')],_0x1785ca['query']);_0x53850c[_0x834e('0x4d')]=_[_0x834e('0x72')](_0x1785ca[_0x834e('0x48')],qs[_0x834e('0x4e')](_0x2f728f[_0x834e('0x4a')]['fields']));_0x53850c[_0x834e('0x4d')]=_0x53850c[_0x834e('0x4d')]['length']?_0x53850c['attributes']:_0x1785ca[_0x834e('0x48')];if(!_0x2f728f['query']['hasOwnProperty']('nolimit')){_0x53850c[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x2f728f[_0x834e('0x4a')][_0x834e('0x33')]);_0x53850c[_0x834e('0x31')]=qs[_0x834e('0x31')](_0x2f728f[_0x834e('0x4a')]['offset']);}_0x53850c[_0x834e('0x52')]=qs[_0x834e('0x53')](_0x2f728f['query']['sort']);_0x53850c[_0x834e('0x54')]=qs[_0x834e('0x4c')](_['pick'](_0x2f728f['query'],_0x1785ca[_0x834e('0x4c')]));_0x53850c[_0x834e('0x54')][_0x834e('0x6d')]=_0x2a54b2['id'];if(_0x2f728f['query'][_0x834e('0x55')]){_0x53850c[_0x834e('0x54')]=_[_0x834e('0x56')](_0x53850c['where'],{'$or':_[_0x834e('0x49')](_0x53850c['attributes'],function(_0x1ec12d){var _0x1debf7={};_0x1debf7[_0x1ec12d]={'$like':'%'+_0x2f728f[_0x834e('0x4a')][_0x834e('0x55')]+'%'};return _0x1debf7;})});}_0x53850c=_[_0x834e('0x56')]({},_0x53850c,_0x2f728f['options']);return db[_0x834e('0xa9')][_0x834e('0x34')]({'where':_0x53850c[_0x834e('0x54')]})[_0x834e('0x39')](function(_0x474d24){_0x2e0674['count']=_0x474d24;if(_0x2f728f['query'][_0x834e('0x5a')]){_0x53850c[_0x834e('0x73')]=[{'model':db[_0x834e('0x7f')],'as':'Contact','required':![]},{'model':db[_0x834e('0xb3')],'as':_0x834e('0xc3'),'attributes':[_0x834e('0x3d'),_0x834e('0xc4'),'internal'],'required':![]},{'model':db[_0x834e('0xc5')],'as':_0x834e('0xc6'),'attributes':['id','name',_0x834e('0xc7')],'where':_0x2f728f[_0x834e('0x4a')][_0x834e('0xc8')]?{'id':_0x2f728f[_0x834e('0x4a')]['tag']}:undefined,'required':_0x2f728f[_0x834e('0x4a')]['tag']?!![]:![]}];}return db[_0x834e('0xa9')][_0x834e('0x5b')](_0x53850c);})[_0x834e('0x39')](function(_0x23c72a){_0x2e0674[_0x834e('0x5c')]=_0x23c72a;return _0x2e0674;});}})[_0x834e('0x39')](respondWithFilteredResult(_0x1391eb,_0x53850c))['catch'](handleError(_0x1391eb,null));};exports['send']=function(_0x28051f,_0x3f2c59,_0x5289f6){var _0x260596,_0x4af796,_0x64469c;if(_[_0x834e('0x9f')](_0x28051f[_0x834e('0x61')][_0x834e('0x61')])||_0x28051f[_0x834e('0x61')][_0x834e('0x61')]===''){throw new db[(_0x834e('0x80'))]['ValidationError'](_0x834e('0xa0'));}if(_[_0x834e('0x9f')](_0x28051f[_0x834e('0x61')]['to'])){throw new db[(_0x834e('0x80'))][(_0x834e('0x81'))]('to\x20is\x20mandatory');}_0x260596=_0x28051f[_0x834e('0x61')]['to'];return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x28051f['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x834e('0x7f')],'as':_0x834e('0xa5'),'where':{'mobile':_0x260596},'limit':0x1,'order':[[_0x834e('0x84'),_0x834e('0xa6')]]}]}]})[_0x834e('0x39')](handleEntityNotFound(_0x3f2c59,null))[_0x834e('0x39')](function(_0x386a89){if(_0x386a89&&_0x386a89[_0x834e('0xc9')]){_0x4af796=_0x386a89[_0x834e('0x63')]({'plain':!![]});if(_0x4af796[_0x834e('0xc9')]&&_0x4af796[_0x834e('0xc9')]['Contacts'][_0x834e('0x4f')]){return _0x4af796[_0x834e('0xc9')][_0x834e('0xa5')][0x0];}return db[_0x834e('0x7f')][_0x834e('0x60')](_[_0x834e('0x1d')](_0x28051f[_0x834e('0x61')],{'firstName':_0x260596,'mobile':_0x260596,'phone':_0x260596,'ListId':_0x4af796[_0x834e('0x86')]}));}})['then'](handleEntityNotFound(_0x3f2c59,null))[_0x834e('0x39')](function(_0x12358f){if(_0x12358f){_0x64469c=_0x12358f;return db['SmsInteraction'][_0x834e('0x5f')]({'where':{'ContactId':_0x64469c['id'],'closed':![],'SmsAccountId':_0x4af796['id']}})[_0x834e('0x39')](function(_0x420ed6){if(_0x420ed6){return[_0x420ed6,![]];}return db[_0x834e('0xa9')]['create']({'UserId':_0x28051f['user']['id'],'ContactId':_0x64469c['id'],'SmsAccountId':_0x4af796['id'],'phone':_0x260596,'firstMsgDirection':_0x834e('0xca'),'Messages':[_['merge'](_0x28051f[_0x834e('0x61')],{'read':![],'body':_0x28051f[_0x834e('0x61')][_0x834e('0x61')],'phone':_0x260596,'SmsAccountId':_0x4af796['id'],'UserId':_0x28051f[_0x834e('0x62')]['id'],'ContactId':_0x64469c['id']})]},{'include':[{'model':db[_0x834e('0xaf')],'as':'Messages'}]})[_0x834e('0x39')](function(_0x5a4fbf){return[_0x5a4fbf,!![]];});});}})['spread'](function(_0x3d8b08,_0x1b23f1){if(_0x1b23f1){return _0x3d8b08;}return db[_0x834e('0xaf')][_0x834e('0x60')](_[_0x834e('0x56')](_0x28051f[_0x834e('0x61')],{'read':![],'body':_0x28051f['body'][_0x834e('0x61')],'phone':_0x260596,'SmsAccountId':_0x4af796['id'],'SmsInteractionId':_0x3d8b08['id'],'UserId':_0x28051f[_0x834e('0x62')]['id'],'ContactId':_0x64469c['id']}))['then'](function(_0x423b03){_0x3d8b08[_0x834e('0xcb')]['Messages']=[];_0x3d8b08[_0x834e('0xcb')][_0x834e('0xcc')]['push'](_0x423b03[_0x834e('0xcb')]);return _0x3d8b08;});})[_0x834e('0x39')](respondWithResult(_0x3f2c59,null))[_0x834e('0x2c')](handleError(_0x3f2c59,null));};exports[_0x834e('0x2f')]=function(_0x34a13d,_0x29b8fd,_0x385cf4){if(_0x34a13d[_0x834e('0x61')]['id']){delete _0x34a13d[_0x834e('0x61')]['id'];}var _0xe0b3,_0x5944e1,_0x2d871e;return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x34a13d[_0x834e('0x5d')]['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x29b8fd,null))[_0x834e('0x39')](function(_0x2d61c1){if(_0x2d61c1){_0x2d871e=_0x2d61c1;logger[_0x834e('0x27')](_0x834e('0x28'),_0x834e('0x2f'),_0x834e('0xcd'),_0x2d61c1[_0x834e('0x57')],util['inspect'](_0x34a13d[_0x834e('0x61')],{'showHidden':![],'depth':null}));switch(_0x2d61c1[_0x834e('0x57')]){case'skebby':if(_0x34a13d['body']['skebby_dispatch_id']&&_0x34a13d[_0x834e('0x61')][_0x834e('0x2f')]){_0x5944e1=_0x34a13d[_0x834e('0x61')][_0x834e('0x2f')];return db[_0x834e('0xaf')][_0x834e('0x5f')]({'where':{'messageId':_0x34a13d[_0x834e('0x61')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x34a13d['body']['requestid']&&_0x34a13d[_0x834e('0x61')][_0x834e('0xce')]){_0x5944e1=_0x34a13d[_0x834e('0x61')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x34a13d[_0x834e('0x61')]['requestid']}});}break;case'clicksend':if(_0x34a13d[_0x834e('0x61')][_0x834e('0x91')]&&_0x34a13d[_0x834e('0x61')][_0x834e('0xcf')]){_0x5944e1=_0x34a13d[_0x834e('0x61')][_0x834e('0xcf')];return db[_0x834e('0xaf')]['find']({'where':{'messageId':_0x34a13d[_0x834e('0x61')][_0x834e('0x91')]}});}break;case _0x834e('0x95'):var _0x405e51=_0x34a13d[_0x834e('0x61')]['results'][0x0];if(_0x405e51[_0x834e('0x8b')]&&_0x405e51['status'][_0x834e('0xd0')]===_0x834e('0xd1')){_0x5944e1=_0x405e51[_0x834e('0x2f')]['groupName'];return db['SmsMessage']['find']({'where':{'messageId':_0x405e51['messageId']}});}break;case _0x834e('0x9a'):if(_0x34a13d[_0x834e('0x61')]['messageId']&&_0x34a13d['body'][_0x834e('0x2f')]){_0x5944e1=_0x34a13d[_0x834e('0x61')][_0x834e('0x2f')];return db['SmsMessage'][_0x834e('0x5f')]({'where':{'messageId':_0x34a13d[_0x834e('0x61')][_0x834e('0x8b')]}});}break;case'bandwidth':if(_0x34a13d[_0x834e('0x61')][0x0][_0x834e('0x2b')]['id']){_0x5944e1=_0x34a13d[_0x834e('0x61')][0x0][_0x834e('0x57')];return db[_0x834e('0xaf')][_0x834e('0x5f')]({'where':{'messageId':_0x34a13d[_0x834e('0x61')][0x0]['message']['id']}});}break;case _0x834e('0x9d'):if(_0x34a13d[_0x834e('0x61')][_0x834e('0xd2')]&&_0x34a13d['body'][_0x834e('0x2f')]){_0x5944e1=_0x34a13d[_0x834e('0x61')][_0x834e('0x2f')];return db[_0x834e('0xaf')][_0x834e('0x5f')]({'where':{'messageId':_0x34a13d[_0x834e('0x61')][_0x834e('0xd2')]}});}break;}}})[_0x834e('0x39')](handleEntityNotFound(_0x29b8fd,null))[_0x834e('0x39')](function(_0x277d41){if(_0x277d41){_0xe0b3=_0x277d41;switch(_0x2d871e[_0x834e('0x57')]){case _0x834e('0x8d'):if(_0x5944e1==='DELIVERED'){return _0xe0b3[_0x834e('0x6a')]({'read':!![]});}else{logger['error'](_0x834e('0x28'),'status',_0x834e('0x8d'),util[_0x834e('0xd3')](_0x34a13d[_0x834e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x834e('0x8e'):if(_0x5944e1==='1'){return _0xe0b3[_0x834e('0x6a')]({'read':!![]});}else{logger[_0x834e('0x29')](_0x834e('0x28'),_0x834e('0x2f'),'skebby',util['inspect'](_0x34a13d['body'],{'showHidden':![],'depth':null}));}break;case _0x834e('0x90'):if(!_0x34a13d[_0x834e('0x61')][_0x834e('0xd4')]&&_0x5944e1>=0xc8&&_0x5944e1<=0xce){return _0xe0b3[_0x834e('0x6a')]({'read':!![]});}else{logger[_0x834e('0x29')](_0x834e('0x28'),_0x834e('0x2f'),_0x834e('0x90'),util['inspect'](_0x34a13d['body'],{'showHidden':![],'depth':null}));}break;case _0x834e('0x95'):var _0x42e5ee=_0x34a13d[_0x834e('0x61')]['results'][0x0];if(_0x42e5ee['status'][_0x834e('0xd0')]==='DELIVERED'){return _0xe0b3[_0x834e('0x6a')]({'read':!![]});}else{logger[_0x834e('0x29')](_0x834e('0x28'),'status',_0x834e('0x95'),util[_0x834e('0xd3')](_0x34a13d[_0x834e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x834e('0x9a'):if(_0x5944e1==_0x834e('0xd5')||_0x5944e1==_0x834e('0xd6')){return _0xe0b3[_0x834e('0x6a')]({'read':!![]});}else{logger['error'](_0x834e('0x28'),_0x834e('0x2f'),_0x834e('0x9a'),util[_0x834e('0xd3')](_0x34a13d[_0x834e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x834e('0x9c'):if(_0x5944e1==_0x834e('0xd7')){return _0xe0b3['update']({'read':!![]});}else{logger['error'](_0x834e('0x28'),'status','bandwidth',util[_0x834e('0xd3')](_0x34a13d[_0x834e('0x61')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5944e1===_0x834e('0xd8')||_0x5944e1==='ACCEPTD'){return _0xe0b3['update']({'read':!![]});}else{logger[_0x834e('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x834e('0x2f'),_0x834e('0x9d'),util[_0x834e('0xd3')](_0x34a13d[_0x834e('0x61')],{'showHidden':![],'depth':null}));}break;}return _0xe0b3;}})[_0x834e('0x39')](respondWithResult(_0x29b8fd,null))[_0x834e('0x2c')](handleError(_0x29b8fd,null));};exports[_0x834e('0xd9')]=function(_0x196f86,_0x4248d3,_0x55d7e0){var _0xf5bd9,_0x19a42c,_0x23228a;return db[_0x834e('0x46')]['find']({'where':{'id':_0x196f86['params']['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x4248d3,null))[_0x834e('0x39')](function(_0x5d801a){if(_0x5d801a){_0x23228a=_0x5d801a;logger[_0x834e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x834e('0x2f'),_0x834e('0xcd'),_0x5d801a[_0x834e('0x57')],util[_0x834e('0xd3')](_0x196f86[_0x834e('0x4a')],{'showHidden':![],'depth':null}));switch(_0x5d801a[_0x834e('0x57')]){case'csc':if(_0x196f86['query']['message-id']&&_0x196f86[_0x834e('0x4a')][_0x834e('0xda')]){_0x19a42c=_0x196f86[_0x834e('0x4a')]['state'];return db['SmsMessage'][_0x834e('0x5f')]({'where':{'messageId':_0x196f86[_0x834e('0x4a')][_0x834e('0xdb')]}});}break;}}})[_0x834e('0x39')](handleEntityNotFound(_0x4248d3,null))[_0x834e('0x39')](function(_0x310c30){if(_0x310c30){_0xf5bd9=_0x310c30;switch(_0x23228a[_0x834e('0x57')]){case _0x834e('0x98'):if(_0x19a42c==='2'||_0x19a42c==='6'){return _0xf5bd9[_0x834e('0x6a')]({'read':!![]});}else{logger[_0x834e('0x29')](_0x834e('0x28'),'status',_0x834e('0x98'),util[_0x834e('0xd3')](_0x196f86['query'],{'showHidden':![],'depth':null}));};break;}return _0xf5bd9;}})[_0x834e('0x39')](respondWithResult(_0x4248d3,null))[_0x834e('0x2c')](handleError(_0x4248d3,null));};exports[_0x834e('0xdc')]=function(_0x3265c1,_0x451447,_0x475b7f){return db[_0x834e('0x46')][_0x834e('0x5f')]({'where':{'id':_0x3265c1[_0x834e('0x5d')]['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x451447,null))[_0x834e('0x39')](function(_0x3692d3){if(_0x3692d3){return _0x3692d3[_0x834e('0xdc')](_0x3265c1[_0x834e('0x61')][_0x834e('0x75')],_[_0x834e('0xa8')](_0x3265c1[_0x834e('0x61')],[_0x834e('0x75'),'id'])||{})[_0x834e('0xaa')](function(_0x314b3e){for(var _0x192df7=0x0;_0x192df7<_0x3265c1[_0x834e('0x61')][_0x834e('0x75')]['length'];_0x192df7+=0x1){socket[_0x834e('0xdd')](_0x834e('0xde'),{'UserId':_0x3265c1[_0x834e('0x61')][_0x834e('0x75')][_0x192df7],'SmsAccountId':_0x3265c1[_0x834e('0x5d')]['id']});}return _0x314b3e;});}})[_0x834e('0x39')](respondWithResult(_0x451447,null))[_0x834e('0x2c')](handleError(_0x451447,null));};exports[_0x834e('0xdf')]=function(_0x25cbdd,_0x41d0a7,_0xcafd25){return db[_0x834e('0x46')]['find']({'where':{'id':_0x25cbdd[_0x834e('0x5d')]['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x41d0a7,null))['then'](function(_0x472686){if(_0x472686){return _0x472686[_0x834e('0xdf')](_0x25cbdd['query'][_0x834e('0x75')])[_0x834e('0x39')](function(){if(_['isArray'](_0x25cbdd['query']['ids'])){for(var _0x32d06c=0x0;_0x32d06c<_0x25cbdd[_0x834e('0x4a')][_0x834e('0x75')][_0x834e('0x4f')];_0x32d06c+=0x1){socket['emit'](_0x834e('0xe0'),{'UserId':Number(_0x25cbdd[_0x834e('0x4a')][_0x834e('0x75')][_0x32d06c]),'SmsAccountId':Number(_0x25cbdd['params']['id'])});}}else{socket[_0x834e('0xdd')](_0x834e('0xe0'),{'UserId':Number(_0x25cbdd[_0x834e('0x4a')]['ids']),'SmsAccountId':Number(_0x25cbdd[_0x834e('0x5d')]['id'])});}});}})[_0x834e('0x39')](respondWithStatusCode(_0x41d0a7,null))['catch'](handleError(_0x41d0a7,null));};exports[_0x834e('0xe1')]=function(_0x146be0,_0x5afdf2,_0x2c2ce7){var _0x32cdd2={};var _0x231064={};var _0x4b7a1f;var _0x3bfef5;return db['SmsAccount']['findOne']({'where':{'id':_0x146be0[_0x834e('0x5d')]['id']}})[_0x834e('0x39')](handleEntityNotFound(_0x5afdf2,null))[_0x834e('0x39')](function(_0x4f8181){if(_0x4f8181){_0x4b7a1f=_0x4f8181;_0x231064[_0x834e('0x48')]=_[_0x834e('0x4b')](db[_0x834e('0xb3')][_0x834e('0x71')]);_0x231064[_0x834e('0x4a')]=_[_0x834e('0x4b')](_0x146be0['query']);_0x231064[_0x834e('0x4c')]=_[_0x834e('0x72')](_0x231064[_0x834e('0x48')],_0x231064[_0x834e('0x4a')]);_0x32cdd2[_0x834e('0x4d')]=_['intersection'](_0x231064['model'],qs[_0x834e('0x4e')](_0x146be0['query'][_0x834e('0x4e')]));_0x32cdd2[_0x834e('0x4d')]=_0x32cdd2[_0x834e('0x4d')][_0x834e('0x4f')]?_0x32cdd2[_0x834e('0x4d')]:_0x231064[_0x834e('0x48')];_0x32cdd2[_0x834e('0x52')]=qs['sort'](_0x146be0[_0x834e('0x4a')][_0x834e('0x53')]);_0x32cdd2['where']=qs[_0x834e('0x4c')](_[_0x834e('0x77')](_0x146be0[_0x834e('0x4a')],_0x231064['filters']));if(_0x146be0[_0x834e('0x4a')]['filter']){_0x32cdd2[_0x834e('0x54')]=_['merge'](_0x32cdd2[_0x834e('0x54')],{'$or':_[_0x834e('0x49')](_0x32cdd2['attributes'],function(_0x3757bf){var _0x54dac6={};_0x54dac6[_0x3757bf]={'$like':'%'+_0x146be0[_0x834e('0x4a')][_0x834e('0x55')]+'%'};return _0x54dac6;})});}_0x32cdd2=_[_0x834e('0x56')]({},_0x32cdd2,_0x146be0['options']);return _0x4b7a1f['getAgents'](_0x32cdd2);}})[_0x834e('0x39')](function(_0x4235d9){if(_0x4235d9){_0x3bfef5=_0x4235d9[_0x834e('0x4f')];if(!_0x146be0[_0x834e('0x4a')][_0x834e('0x50')](_0x834e('0x51'))){_0x32cdd2[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x146be0[_0x834e('0x4a')][_0x834e('0x33')]);_0x32cdd2[_0x834e('0x31')]=qs[_0x834e('0x31')](_0x146be0[_0x834e('0x4a')][_0x834e('0x31')]);}return _0x4b7a1f[_0x834e('0xe1')](_0x32cdd2);}})[_0x834e('0x39')](function(_0x37f058){if(_0x37f058){return _0x37f058?{'count':_0x3bfef5,'rows':_0x37f058}:null;}})[_0x834e('0x39')](respondWithResult(_0x5afdf2,null))[_0x834e('0x2c')](handleError(_0x5afdf2,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 79088e7..903fc8b 100644 --- a/server/api/smsAccount/smsAccount.events.js +++ b/server/api/smsAccount/smsAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb962=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb962,0x1ee));var _0x2b96=function(_0x3853d7,_0x33ff22){_0x3853d7=_0x3853d7-0x0;var _0x15451f=_0xb962[_0x3853d7];return _0x15451f;};'use strict';var EventEmitter=require(_0x2b96('0x0'));var SmsAccount=require(_0x2b96('0x1'))['db'][_0x2b96('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2b96('0x3')](0x0);var events={'afterCreate':_0x2b96('0x4'),'afterUpdate':'update','afterDestroy':_0x2b96('0x5')};function emitEvent(_0x48ecc7){return function(_0x604d4c,_0x12d7cd,_0x3b27db){SmsAccountEvents[_0x2b96('0x6')](_0x48ecc7+':'+_0x604d4c['id'],_0x604d4c);SmsAccountEvents['emit'](_0x48ecc7,_0x604d4c);_0x3b27db(null);};}for(var e in events){if(events[_0x2b96('0x7')](e)){var event=events[e];SmsAccount[_0x2b96('0x8')](e,emitEvent(event));}}module[_0x2b96('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x2f66=['remove','emit','hasOwnProperty','events','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x2f66,0x198));var _0x62f6=function(_0x33e200,_0x4d13ab){_0x33e200=_0x33e200-0x0;var _0xc868bb=_0x2f66[_0x33e200];return _0xc868bb;};'use strict';var EventEmitter=require(_0x62f6('0x0'));var SmsAccount=require(_0x62f6('0x1'))['db'][_0x62f6('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x62f6('0x3')](0x0);var events={'afterCreate':_0x62f6('0x4'),'afterUpdate':_0x62f6('0x5'),'afterDestroy':_0x62f6('0x6')};function emitEvent(_0x3188f1){return function(_0x44653c,_0x2bc58a,_0x3a641d){SmsAccountEvents[_0x62f6('0x7')](_0x3188f1+':'+_0x44653c['id'],_0x44653c);SmsAccountEvents['emit'](_0x3188f1,_0x44653c);_0x3a641d(null);};}for(var e in events){if(events[_0x62f6('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index b5fddc2..9a77f1a 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb946=['../../config/logger','api','moment','bluebird','request-promise','./smsAccount.attributes','exports','define','lodash','util'];(function(_0x1e3fad,_0x2c942c){var _0x36bdb3=function(_0x292a58){while(--_0x292a58){_0x1e3fad['push'](_0x1e3fad['shift']());}};_0x36bdb3(++_0x2c942c);}(_0xb946,0x1ca));var _0x6b94=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xb946[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x6b94('0x0'));var util=require(_0x6b94('0x1'));var logger=require(_0x6b94('0x2'))(_0x6b94('0x3'));var moment=require(_0x6b94('0x4'));var BPromise=require(_0x6b94('0x5'));var rp=require(_0x6b94('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b94('0x7'));module[_0x6b94('0x8')]=function(_0x4545f7,_0x236483){return _0x4545f7[_0x6b94('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8d5=['exports','SmsAccount','lodash','../../config/logger','moment','bluebird','path','rimraf','./smsAccount.attributes'];(function(_0x1e868a,_0x4921fc){var _0x38fd07=function(_0x41158b){while(--_0x41158b){_0x1e868a['push'](_0x1e868a['shift']());}};_0x38fd07(++_0x4921fc);}(_0xc8d5,0x1f1));var _0x5c8d=function(_0x4affdf,_0x90cc1a){_0x4affdf=_0x4affdf-0x0;var _0x312bdd=_0xc8d5[_0x4affdf];return _0x312bdd;};'use strict';var _=require(_0x5c8d('0x0'));var util=require('util');var logger=require(_0x5c8d('0x1'))('api');var moment=require(_0x5c8d('0x2'));var BPromise=require(_0x5c8d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c8d('0x4'));var rimraf=require(_0x5c8d('0x5'));var config=require('../../config/environment');var attributes=require(_0x5c8d('0x6'));module[_0x5c8d('0x7')]=function(_0x29e751,_0xcca089){return _0x29e751['define'](_0x5c8d('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 0c0b291..32d9927 100644 --- a/server/api/smsAccount/smsAccount.rpc.js +++ b/server/api/smsAccount/smsAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8d0=['socket.io-emitter','register','request','then','info','request\x20sent','debug','error','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','stringify','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x1ad2f1,_0x1ffb58){var _0x4cb82d=function(_0x2d3214){while(--_0x2d3214){_0x1ad2f1['push'](_0x1ad2f1['shift']());}};_0x4cb82d(++_0x1ffb58);}(_0xa8d0,0x1dd));var _0x0a8d=function(_0x38d5a6,_0x2f8923){_0x38d5a6=_0x38d5a6-0x0;var _0x4aa530=_0xa8d0[_0x38d5a6];return _0x4aa530;};'use strict';var _=require('lodash');var util=require(_0x0a8d('0x0'));var moment=require('moment');var BPromise=require(_0x0a8d('0x1'));var rs=require(_0x0a8d('0x2'));var fs=require('fs');var Redis=require(_0x0a8d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a8d('0x4'));var logger=require(_0x0a8d('0x5'))(_0x0a8d('0x6'));var config=require(_0x0a8d('0x7'));var jayson=require(_0x0a8d('0x8'));var client=jayson[_0x0a8d('0x9')][_0x0a8d('0xa')]({'port':0x232a});config['redis']=_[_0x0a8d('0xb')](config[_0x0a8d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a8d('0xd'))(new Redis(config[_0x0a8d('0xc')]));require('./smsAccount.socket')[_0x0a8d('0xe')](socket);function respondWithRpcPromise(_0x805f09,_0x5eef5f,_0x5d88e7){return new BPromise(function(_0xf6533c,_0x57dcd2){return client[_0x0a8d('0xf')](_0x805f09,_0x5d88e7)[_0x0a8d('0x10')](function(_0x1e62c4){logger[_0x0a8d('0x11')]('SmsAccount,\x20%s,\x20%s',_0x5eef5f,_0x0a8d('0x12'));logger[_0x0a8d('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5eef5f,_0x0a8d('0x12'),JSON['stringify'](_0x1e62c4));if(_0x1e62c4['error']){if(_0x1e62c4[_0x0a8d('0x14')]['code']===0x1f4){logger[_0x0a8d('0x14')](_0x0a8d('0x15'),_0x5eef5f,_0x1e62c4[_0x0a8d('0x14')]['message']);return _0x57dcd2(_0x1e62c4[_0x0a8d('0x14')][_0x0a8d('0x16')]);}logger[_0x0a8d('0x14')](_0x0a8d('0x15'),_0x5eef5f,_0x1e62c4[_0x0a8d('0x14')][_0x0a8d('0x16')]);return _0xf6533c(_0x1e62c4['error'][_0x0a8d('0x16')]);}else{logger[_0x0a8d('0x11')](_0x0a8d('0x15'),_0x5eef5f,_0x0a8d('0x12'));_0xf6533c(_0x1e62c4[_0x0a8d('0x17')]['message']);}})['catch'](function(_0x3e21a8){logger[_0x0a8d('0x14')]('SmsAccount,\x20%s,\x20%s',_0x5eef5f,_0x3e21a8);_0x57dcd2(_0x3e21a8);});});}exports[_0x0a8d('0x18')]=function(_0x55ca1c){var _0x56caed=this;return new Promise(function(_0x11dcf8,_0x144ec0){return db[_0x0a8d('0x19')][_0x0a8d('0x1a')]({'raw':_0x55ca1c[_0x0a8d('0x1b')]?_0x55ca1c[_0x0a8d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x55ca1c['options']?_0x55ca1c[_0x0a8d('0x1b')][_0x0a8d('0x1c')]||null:null,'attributes':_0x55ca1c[_0x0a8d('0x1b')]?_0x55ca1c[_0x0a8d('0x1b')][_0x0a8d('0x1d')]||null:null,'include':_0x55ca1c[_0x0a8d('0x1b')]?_0x55ca1c[_0x0a8d('0x1b')][_0x0a8d('0x1e')]?_[_0x0a8d('0x1f')](_0x55ca1c['options'][_0x0a8d('0x1e')],function(_0xabcbb7){return{'model':db[_0xabcbb7[_0x0a8d('0x20')]],'as':_0xabcbb7['as'],'attributes':_0xabcbb7[_0x0a8d('0x1d')],'include':_0xabcbb7[_0x0a8d('0x1e')]?_[_0x0a8d('0x1f')](_0xabcbb7[_0x0a8d('0x1e')],function(_0x5c99f2){return{'model':db[_0x5c99f2[_0x0a8d('0x20')]],'as':_0x5c99f2['as'],'attributes':_0x5c99f2['attributes'],'include':_0x5c99f2[_0x0a8d('0x1e')]?_[_0x0a8d('0x1f')](_0x5c99f2['include'],function(_0x50ccdf){return{'model':db[_0x50ccdf[_0x0a8d('0x20')]],'as':_0x50ccdf['as'],'attributes':_0x50ccdf[_0x0a8d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0a8d('0x10')](function(_0x55404b){logger[_0x0a8d('0x11')]('ShowSmsAccount',_0x55ca1c);logger[_0x0a8d('0x13')](_0x0a8d('0x18'),_0x55ca1c,JSON[_0x0a8d('0x21')](_0x55404b));_0x11dcf8(_0x55404b);})[_0x0a8d('0x22')](function(_0x1f4bea){logger[_0x0a8d('0x14')](_0x0a8d('0x18'),_0x1f4bea['message'],_0x55ca1c);_0x144ec0(_0x56caed[_0x0a8d('0x14')](0x1f4,_0x1f4bea[_0x0a8d('0x16')]));});});}; \ No newline at end of file +var _0xd834=['attributes','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','client','http','redis','localhost','socket.io-emitter','register','request','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw'];(function(_0x4e4ff2,_0x3c5816){var _0x401d89=function(_0x28a9ed){while(--_0x28a9ed){_0x4e4ff2['push'](_0x4e4ff2['shift']());}};_0x401d89(++_0x3c5816);}(_0xd834,0x1a9));var _0x4d83=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd834[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d83('0x0'));var util=require(_0x4d83('0x1'));var moment=require(_0x4d83('0x2'));var BPromise=require(_0x4d83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d83('0x4'));var db=require(_0x4d83('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d83('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d83('0x7')][_0x4d83('0x8')]({'port':0x232a});config[_0x4d83('0x9')]=_['defaults'](config['redis'],{'host':_0x4d83('0xa'),'port':0x18eb});var socket=require(_0x4d83('0xb'))(new Redis(config[_0x4d83('0x9')]));require('./smsAccount.socket')[_0x4d83('0xc')](socket);function respondWithRpcPromise(_0x40603d,_0x26a057,_0xe451dd){return new BPromise(function(_0x1d5d15,_0x53f63c){return client[_0x4d83('0xd')](_0x40603d,_0xe451dd)['then'](function(_0x234889){logger[_0x4d83('0xe')]('SmsAccount,\x20%s,\x20%s',_0x26a057,'request\x20sent');logger[_0x4d83('0xf')](_0x4d83('0x10'),_0x26a057,_0x4d83('0x11'),JSON[_0x4d83('0x12')](_0x234889));if(_0x234889[_0x4d83('0x13')]){if(_0x234889['error'][_0x4d83('0x14')]===0x1f4){logger[_0x4d83('0x13')](_0x4d83('0x15'),_0x26a057,_0x234889[_0x4d83('0x13')][_0x4d83('0x16')]);return _0x53f63c(_0x234889[_0x4d83('0x13')][_0x4d83('0x16')]);}logger['error'](_0x4d83('0x15'),_0x26a057,_0x234889[_0x4d83('0x13')][_0x4d83('0x16')]);return _0x1d5d15(_0x234889[_0x4d83('0x13')][_0x4d83('0x16')]);}else{logger[_0x4d83('0xe')]('SmsAccount,\x20%s,\x20%s',_0x26a057,_0x4d83('0x11'));_0x1d5d15(_0x234889[_0x4d83('0x17')][_0x4d83('0x16')]);}})[_0x4d83('0x18')](function(_0x2de9f9){logger['error']('SmsAccount,\x20%s,\x20%s',_0x26a057,_0x2de9f9);_0x53f63c(_0x2de9f9);});});}exports[_0x4d83('0x19')]=function(_0x5d682e){var _0x268322=this;return new Promise(function(_0x105fac,_0x191d65){return db[_0x4d83('0x1a')][_0x4d83('0x1b')]({'raw':_0x5d682e[_0x4d83('0x1c')]?_0x5d682e[_0x4d83('0x1c')][_0x4d83('0x1d')]===undefined?!![]:![]:!![],'where':_0x5d682e[_0x4d83('0x1c')]?_0x5d682e[_0x4d83('0x1c')]['where']||null:null,'attributes':_0x5d682e['options']?_0x5d682e[_0x4d83('0x1c')][_0x4d83('0x1e')]||null:null,'include':_0x5d682e[_0x4d83('0x1c')]?_0x5d682e[_0x4d83('0x1c')][_0x4d83('0x1f')]?_[_0x4d83('0x20')](_0x5d682e[_0x4d83('0x1c')]['include'],function(_0x5929ff){return{'model':db[_0x5929ff[_0x4d83('0x21')]],'as':_0x5929ff['as'],'attributes':_0x5929ff['attributes'],'include':_0x5929ff[_0x4d83('0x1f')]?_[_0x4d83('0x20')](_0x5929ff[_0x4d83('0x1f')],function(_0x480b42){return{'model':db[_0x480b42[_0x4d83('0x21')]],'as':_0x480b42['as'],'attributes':_0x480b42['attributes'],'include':_0x480b42[_0x4d83('0x1f')]?_['map'](_0x480b42[_0x4d83('0x1f')],function(_0x3cb8e6){return{'model':db[_0x3cb8e6[_0x4d83('0x21')]],'as':_0x3cb8e6['as'],'attributes':_0x3cb8e6[_0x4d83('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4d83('0x22')](function(_0x14bd9b){logger[_0x4d83('0xe')](_0x4d83('0x19'),_0x5d682e);logger['debug']('ShowSmsAccount',_0x5d682e,JSON[_0x4d83('0x12')](_0x14bd9b));_0x105fac(_0x14bd9b);})[_0x4d83('0x18')](function(_0xfbff2a){logger[_0x4d83('0x13')](_0x4d83('0x19'),_0xfbff2a['message'],_0x5d682e);_0x191d65(_0x268322[_0x4d83('0x13')](0x1f4,_0xfbff2a[_0x4d83('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 9224f2b..10fe856 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a9c=['./smsAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0x0a9c,0x181));var _0xc0a9=function(_0x491e57,_0x226252){_0x491e57=_0x491e57-0x0;var _0x597593=_0x0a9c[_0x491e57];return _0x597593;};'use strict';var SmsAccountEvents=require(_0xc0a9('0x0'));var events=[_0xc0a9('0x1'),_0xc0a9('0x2'),'update'];function createListener(_0x478560,_0x134b51){return function(_0x1d87de){_0x134b51[_0xc0a9('0x3')](_0x478560,_0x1d87de);};}function removeListener(_0x5aaa2c,_0x5bd751){return function(){SmsAccountEvents[_0xc0a9('0x4')](_0x5aaa2c,_0x5bd751);};}exports[_0xc0a9('0x5')]=function(_0x571df1){for(var _0x388618=0x0,_0x30145d=events[_0xc0a9('0x6')];_0x388618<_0x30145d;_0x388618++){var _0x327130=events[_0x388618];var _0x2cf80d=createListener('smsAccount:'+_0x327130,_0x571df1);SmsAccountEvents['on'](_0x327130,_0x2cf80d);}}; \ No newline at end of file +var _0x85ed=['emit','removeListener','length','./smsAccount.events'];(function(_0x3da126,_0x58f224){var _0x47c11d=function(_0x5678bd){while(--_0x5678bd){_0x3da126['push'](_0x3da126['shift']());}};_0x47c11d(++_0x58f224);}(_0x85ed,0x1e7));var _0xd85e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x85ed[_0x5d4607];return _0x5e4a86;};'use strict';var SmsAccountEvents=require(_0xd85e('0x0'));var events=['save','remove','update'];function createListener(_0x2e2ed7,_0x36cda0){return function(_0x37a18f){_0x36cda0[_0xd85e('0x1')](_0x2e2ed7,_0x37a18f);};}function removeListener(_0x2ddd68,_0x5178b6){return function(){SmsAccountEvents[_0xd85e('0x2')](_0x2ddd68,_0x5178b6);};}exports['register']=function(_0x4a7055){for(var _0x4874be=0x0,_0x3c3440=events[_0xd85e('0x3')];_0x4874be<_0x3c3440;_0x4874be++){var _0x17ea15=events[_0x4874be];var _0x4ecc93=createListener('smsAccount:'+_0x17ea15,_0x4a7055);SmsAccountEvents['on'](_0x17ea15,_0x4ecc93);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index ce22e3b..7992768 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d9c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','post','create','update','destroy','exports','multer','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d9c,0xb2));var _0xc9d9=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x9d9c[_0x5834bc];return _0x3e183a;};'use strict';var multer=require(_0xc9d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc9d9('0x1'));var express=require(_0xc9d9('0x2'));var router=express[_0xc9d9('0x3')]();var fs_extra=require(_0xc9d9('0x4'));var auth=require(_0xc9d9('0x5'));var interaction=require(_0xc9d9('0x6'));var config=require(_0xc9d9('0x7'));var controller=require(_0xc9d9('0x8'));router[_0xc9d9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc9d9('0xa')]);router[_0xc9d9('0x9')](_0xc9d9('0xb'),auth[_0xc9d9('0xc')](),controller['show']);router[_0xc9d9('0xd')]('/',auth[_0xc9d9('0xc')](),controller[_0xc9d9('0xe')]);router['put']('/:id',auth[_0xc9d9('0xc')](),controller[_0xc9d9('0xf')]);router['delete'](_0xc9d9('0xb'),auth['isAuthenticated'](),controller[_0xc9d9('0x10')]);module[_0xc9d9('0x11')]=router; \ No newline at end of file +var _0x8a08=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','get','show','post','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xb00dd4,_0x5b6cf9){var _0x20247d=function(_0xe93d31){while(--_0xe93d31){_0xb00dd4['push'](_0xb00dd4['shift']());}};_0x20247d(++_0x5b6cf9);}(_0x8a08,0xae));var _0x88a0=function(_0x4bd000,_0xc42182){_0x4bd000=_0x4bd000-0x0;var _0x9e8311=_0x8a08[_0x4bd000];return _0x9e8311;};'use strict';var multer=require(_0x88a0('0x0'));var util=require(_0x88a0('0x1'));var path=require(_0x88a0('0x2'));var timeout=require(_0x88a0('0x3'));var express=require(_0x88a0('0x4'));var router=express[_0x88a0('0x5')]();var fs_extra=require(_0x88a0('0x6'));var auth=require(_0x88a0('0x7'));var interaction=require(_0x88a0('0x8'));var config=require(_0x88a0('0x9'));var controller=require(_0x88a0('0xa'));router['get']('/',auth[_0x88a0('0xb')](),controller[_0x88a0('0xc')]);router[_0x88a0('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x88a0('0xe')]);router[_0x88a0('0xf')]('/',auth[_0x88a0('0xb')](),controller['create']);router[_0x88a0('0x10')](_0x88a0('0x11'),auth[_0x88a0('0xb')](),controller['update']);router[_0x88a0('0x12')]('/:id',auth[_0x88a0('0xb')](),controller['destroy']);module[_0x88a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8008d58..234ee0b 100644 --- a/server/api/smsApplication/smsApplication.attributes.js +++ b/server/api/smsApplication/smsApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc66=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xdc66,0x111));var _0x6dc6=function(_0x159424,_0x401a52){_0x159424=_0x159424-0x0;var _0x1eabe4=_0xdc66[_0x159424];return _0x1eabe4;};'use strict';var Sequelize=require(_0x6dc6('0x0'));module[_0x6dc6('0x1')]={'priority':{'type':Sequelize[_0x6dc6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6dc6('0x3')],'allowNull':![],'defaultValue':_0x6dc6('0x4')},'appdata':{'type':Sequelize[_0x6dc6('0x5')]()},'description':{'type':Sequelize[_0x6dc6('0x3')]},'interval':{'type':Sequelize[_0x6dc6('0x3')],'defaultValue':_0x6dc6('0x6')}}; \ No newline at end of file +var _0x670a=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x670a,0x1d7));var _0xa670=function(_0x695e0e,_0x3e5790){_0x695e0e=_0x695e0e-0x0;var _0x52c8b9=_0x670a[_0x695e0e];return _0x52c8b9;};'use strict';var Sequelize=require(_0xa670('0x0'));module[_0xa670('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa670('0x2')],'allowNull':![],'defaultValue':_0xa670('0x3')},'appdata':{'type':Sequelize[_0xa670('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa670('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8884401..49a6ccd 100644 --- a/server/api/smsApplication/smsApplication.controller.js +++ b/server/api/smsApplication/smsApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30e4=['fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','merge','body','agent','interaction','account','index','SmsApplication','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30e4,0x1a1));var _0x430e=function(_0x573ab1,_0x8adff){_0x573ab1=_0x573ab1-0x0;var _0x580a1b=_0x30e4[_0x573ab1];return _0x580a1b;};'use strict';var emlformat=require(_0x430e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x430e('0x1'));var jsonpatch=require(_0x430e('0x2'));var rp=require(_0x430e('0x3'));var moment=require(_0x430e('0x4'));var BPromise=require(_0x430e('0x5'));var Mustache=require(_0x430e('0x6'));var util=require('util');var path=require(_0x430e('0x7'));var sox=require(_0x430e('0x8'));var csv=require('to-csv');var ejs=require(_0x430e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x430e('0xa'));var crypto=require(_0x430e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x430e('0xc'));var toCsv=require(_0x430e('0xd'));var querystring=require(_0x430e('0xe'));var Papa=require(_0x430e('0xf'));var Redis=require(_0x430e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x430e('0x11'));var hardwareService=require(_0x430e('0x12'));var logger=require(_0x430e('0x13'))(_0x430e('0x14'));var utils=require(_0x430e('0x15'));var config=require(_0x430e('0x16'));var licenseUtil=require(_0x430e('0x17'));var db=require(_0x430e('0x18'))['db'];function respondWithStatusCode(_0x4705ba,_0x556962){_0x556962=_0x556962||0xcc;return function(_0x1b08b6){if(_0x1b08b6){return _0x4705ba[_0x430e('0x19')](_0x556962);}return _0x4705ba['status'](_0x556962)[_0x430e('0x1a')]();};}function respondWithResult(_0x5a250d,_0x5dce01){_0x5dce01=_0x5dce01||0xc8;return function(_0x9f76ea){if(_0x9f76ea){return _0x5a250d['status'](_0x5dce01)[_0x430e('0x1b')](_0x9f76ea);}};}function respondWithFilteredResult(_0x323888,_0x5e3187){return function(_0x1f7c2d){if(_0x1f7c2d){var _0x158eb3=typeof _0x5e3187[_0x430e('0x1c')]===_0x430e('0x1d')&&typeof _0x5e3187['limit']===_0x430e('0x1d');var _0x4d40d6=_0x1f7c2d[_0x430e('0x1e')];var _0x589d76=_0x158eb3?0x0:_0x5e3187[_0x430e('0x1c')];var _0x53be03=_0x158eb3?_0x1f7c2d[_0x430e('0x1e')]:_0x5e3187['offset']+_0x5e3187[_0x430e('0x1f')];var _0x3da31f;if(_0x53be03>=_0x4d40d6){_0x53be03=_0x4d40d6;_0x3da31f=0xc8;}else{_0x3da31f=0xce;}_0x323888[_0x430e('0x20')](_0x3da31f);return _0x323888[_0x430e('0x21')](_0x430e('0x22'),_0x589d76+'-'+_0x53be03+'/'+_0x4d40d6)[_0x430e('0x1b')](_0x1f7c2d);}return null;};}function patchUpdates(_0x2604a4){return function(_0x26f4de){try{jsonpatch[_0x430e('0x23')](_0x26f4de,_0x2604a4,!![]);}catch(_0x165e3d){return BPromise[_0x430e('0x24')](_0x165e3d);}return _0x26f4de[_0x430e('0x25')]();};}function saveUpdates(_0x1bacf9,_0x4b4a57){return function(_0x2e8653){if(_0x2e8653){return _0x2e8653[_0x430e('0x26')](_0x1bacf9)[_0x430e('0x27')](function(_0x126993){return _0x126993;});}return null;};}function removeEntity(_0x446702,_0x450c3e){return function(_0x3c20ff){if(_0x3c20ff){return _0x3c20ff[_0x430e('0x28')]()['then'](function(){_0x446702[_0x430e('0x20')](0xcc)[_0x430e('0x1a')]();});}};}function handleEntityNotFound(_0x4697ce,_0x4bbadb){return function(_0x4ee466){if(!_0x4ee466){_0x4697ce[_0x430e('0x19')](0x194);}return _0x4ee466;};}function handleError(_0x1af40a,_0x140369){_0x140369=_0x140369||0x1f4;return function(_0x389362){logger['error'](_0x389362[_0x430e('0x29')]);if(_0x389362[_0x430e('0x2a')]){delete _0x389362[_0x430e('0x2a')];}_0x1af40a[_0x430e('0x20')](_0x140369)['send'](_0x389362);};}function getMustacheRender(_0x360f69,_0x4803fd){return Mustache['render'](_0x360f69,_[_0x430e('0x2b')](_0x4803fd[_0x430e('0x2c')],{'contact':_0x4803fd['contact'],'message':_0x4803fd['message'],'agent':_0x4803fd[_0x430e('0x2d')],'interaction':_0x4803fd[_0x430e('0x2e')],'account':_0x4803fd[_0x430e('0x2f')]}))||'';}exports[_0x430e('0x30')]=function(_0x34dc76,_0x3611d9){var _0x281c4e={},_0x5511e3={},_0x330e11={'count':0x0,'rows':[]};var _0xff5175=_['map'](db[_0x430e('0x31')][_0x430e('0x32')],function(_0x53e092){return{'name':_0x53e092[_0x430e('0x33')],'type':_0x53e092[_0x430e('0x34')][_0x430e('0x35')]};});_0x5511e3[_0x430e('0x36')]=_[_0x430e('0x37')](_0xff5175,_0x430e('0x2a'));_0x5511e3['query']=_[_0x430e('0x38')](_0x34dc76[_0x430e('0x39')]);_0x5511e3[_0x430e('0x3a')]=_['intersection'](_0x5511e3[_0x430e('0x36')],_0x5511e3[_0x430e('0x39')]);_0x281c4e[_0x430e('0x3b')]=_[_0x430e('0x3c')](_0x5511e3['model'],qs[_0x430e('0x3d')](_0x34dc76[_0x430e('0x39')][_0x430e('0x3d')]));_0x281c4e[_0x430e('0x3b')]=_0x281c4e[_0x430e('0x3b')]['length']?_0x281c4e[_0x430e('0x3b')]:_0x5511e3[_0x430e('0x36')];if(!_0x34dc76['query'][_0x430e('0x3e')]('nolimit')){_0x281c4e[_0x430e('0x1f')]=qs['limit'](_0x34dc76[_0x430e('0x39')][_0x430e('0x1f')]);_0x281c4e['offset']=qs[_0x430e('0x1c')](_0x34dc76[_0x430e('0x39')]['offset']);}_0x281c4e[_0x430e('0x3f')]=qs['sort'](_0x34dc76['query'][_0x430e('0x40')]);_0x281c4e[_0x430e('0x41')]=qs[_0x430e('0x3a')](_[_0x430e('0x42')](_0x34dc76[_0x430e('0x39')],_0x5511e3[_0x430e('0x3a')]),_0xff5175);if(_0x34dc76['query'][_0x430e('0x43')]){_0x281c4e[_0x430e('0x41')]=_['merge'](_0x281c4e['where'],{'$or':_[_0x430e('0x37')](_0xff5175,function(_0x38e4de){if(_0x38e4de[_0x430e('0x34')]!==_0x430e('0x44')){var _0x2af3a7={};_0x2af3a7[_0x38e4de[_0x430e('0x2a')]]={'$like':'%'+_0x34dc76[_0x430e('0x39')][_0x430e('0x43')]+'%'};return _0x2af3a7;}})});}_0x281c4e=_[_0x430e('0x2b')]({},_0x281c4e,_0x34dc76['options']);var _0x12067c={'where':_0x281c4e['where']};return db[_0x430e('0x31')][_0x430e('0x1e')](_0x12067c)[_0x430e('0x27')](function(_0x58e0c7){_0x330e11[_0x430e('0x1e')]=_0x58e0c7;if(_0x34dc76[_0x430e('0x39')][_0x430e('0x45')]){_0x281c4e[_0x430e('0x46')]=[{'all':!![]}];}return db[_0x430e('0x31')][_0x430e('0x47')](_0x281c4e);})[_0x430e('0x27')](function(_0x4ad7ba){_0x330e11[_0x430e('0x48')]=_0x4ad7ba;return _0x330e11;})[_0x430e('0x27')](respondWithFilteredResult(_0x3611d9,_0x281c4e))[_0x430e('0x49')](handleError(_0x3611d9,null));};exports[_0x430e('0x4a')]=function(_0x3eabfb,_0x24a0f5){var _0x22bbaf={'raw':!![],'where':{'id':_0x3eabfb[_0x430e('0x4b')]['id']}},_0x2a3699={};_0x2a3699['model']=_[_0x430e('0x38')](db[_0x430e('0x31')]['rawAttributes']);_0x2a3699['query']=_['keys'](_0x3eabfb[_0x430e('0x39')]);_0x2a3699['filters']=_[_0x430e('0x3c')](_0x2a3699['model'],_0x2a3699[_0x430e('0x39')]);_0x22bbaf[_0x430e('0x3b')]=_[_0x430e('0x3c')](_0x2a3699[_0x430e('0x36')],qs['fields'](_0x3eabfb['query']['fields']));_0x22bbaf[_0x430e('0x3b')]=_0x22bbaf[_0x430e('0x3b')][_0x430e('0x4c')]?_0x22bbaf['attributes']:_0x2a3699[_0x430e('0x36')];if(_0x3eabfb[_0x430e('0x39')]['includeAll']){_0x22bbaf[_0x430e('0x46')]=[{'all':!![]}];}_0x22bbaf=_[_0x430e('0x2b')]({},_0x22bbaf,_0x3eabfb['options']);return db['SmsApplication'][_0x430e('0x4d')](_0x22bbaf)[_0x430e('0x27')](handleEntityNotFound(_0x24a0f5,null))['then'](respondWithResult(_0x24a0f5,null))[_0x430e('0x49')](handleError(_0x24a0f5,null));};exports['create']=function(_0x3c50a2,_0x51ae6d){return db['SmsApplication']['create'](_0x3c50a2[_0x430e('0x2c')],{})[_0x430e('0x27')](respondWithResult(_0x51ae6d,0xc9))['catch'](handleError(_0x51ae6d,null));};exports[_0x430e('0x26')]=function(_0xa3ee04,_0x332fdc){if(_0xa3ee04['body']['id']){delete _0xa3ee04[_0x430e('0x2c')]['id'];}return db[_0x430e('0x31')][_0x430e('0x4d')]({'where':{'id':_0xa3ee04[_0x430e('0x4b')]['id']}})[_0x430e('0x27')](handleEntityNotFound(_0x332fdc,null))[_0x430e('0x27')](saveUpdates(_0xa3ee04[_0x430e('0x2c')],null))['then'](respondWithResult(_0x332fdc,null))[_0x430e('0x49')](handleError(_0x332fdc,null));};exports['destroy']=function(_0x2cc586,_0xdfcac5){return db[_0x430e('0x31')][_0x430e('0x4d')]({'where':{'id':_0x2cc586[_0x430e('0x4b')]['id']}})[_0x430e('0x27')](handleEntityNotFound(_0xdfcac5,null))[_0x430e('0x27')](removeEntity(_0xdfcac5,null))[_0x430e('0x49')](handleError(_0xdfcac5,null));}; \ No newline at end of file +var _0x2241=['contact','message','interaction','account','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','keys','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge'];(function(_0xd890c2,_0x350ba8){var _0xb4753c=function(_0x380853){while(--_0x380853){_0xd890c2['push'](_0xd890c2['shift']());}};_0xb4753c(++_0x350ba8);}(_0x2241,0x1b4));var _0x1224=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2241[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x1224('0x0'));var rimraf=require(_0x1224('0x1'));var zipdir=require(_0x1224('0x2'));var jsonpatch=require(_0x1224('0x3'));var rp=require(_0x1224('0x4'));var moment=require(_0x1224('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1224('0x6'));var util=require(_0x1224('0x7'));var path=require('path');var sox=require(_0x1224('0x8'));var csv=require(_0x1224('0x9'));var ejs=require(_0x1224('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1224('0xb'));var squel=require('squel');var crypto=require(_0x1224('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1224('0xd'));var toCsv=require(_0x1224('0x9'));var querystring=require(_0x1224('0xe'));var Papa=require('papaparse');var Redis=require(_0x1224('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1224('0x10'));var as=require(_0x1224('0x11'));var hardwareService=require(_0x1224('0x12'));var logger=require(_0x1224('0x13'))('api');var utils=require(_0x1224('0x14'));var config=require(_0x1224('0x15'));var licenseUtil=require(_0x1224('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x479d01,_0x27fbbb){_0x27fbbb=_0x27fbbb||0xcc;return function(_0x272e24){if(_0x272e24){return _0x479d01['sendStatus'](_0x27fbbb);}return _0x479d01[_0x1224('0x17')](_0x27fbbb)[_0x1224('0x18')]();};}function respondWithResult(_0x551d44,_0x41a5d0){_0x41a5d0=_0x41a5d0||0xc8;return function(_0x385306){if(_0x385306){return _0x551d44['status'](_0x41a5d0)['json'](_0x385306);}};}function respondWithFilteredResult(_0x49751c,_0x1f89f8){return function(_0x90af13){if(_0x90af13){var _0xfb2762=typeof _0x1f89f8[_0x1224('0x19')]==='undefined'&&typeof _0x1f89f8[_0x1224('0x1a')]===_0x1224('0x1b');var _0x124a5a=_0x90af13[_0x1224('0x1c')];var _0x110db0=_0xfb2762?0x0:_0x1f89f8['offset'];var _0x184336=_0xfb2762?_0x90af13[_0x1224('0x1c')]:_0x1f89f8[_0x1224('0x19')]+_0x1f89f8[_0x1224('0x1a')];var _0x1c4484;if(_0x184336>=_0x124a5a){_0x184336=_0x124a5a;_0x1c4484=0xc8;}else{_0x1c4484=0xce;}_0x49751c[_0x1224('0x17')](_0x1c4484);return _0x49751c[_0x1224('0x1d')](_0x1224('0x1e'),_0x110db0+'-'+_0x184336+'/'+_0x124a5a)[_0x1224('0x1f')](_0x90af13);}return null;};}function patchUpdates(_0x1589ee){return function(_0x2a4d93){try{jsonpatch[_0x1224('0x20')](_0x2a4d93,_0x1589ee,!![]);}catch(_0x42ee82){return BPromise['reject'](_0x42ee82);}return _0x2a4d93[_0x1224('0x21')]();};}function saveUpdates(_0x32aedf,_0x328892){return function(_0x4aeefe){if(_0x4aeefe){return _0x4aeefe[_0x1224('0x22')](_0x32aedf)[_0x1224('0x23')](function(_0x257d23){return _0x257d23;});}return null;};}function removeEntity(_0x407806,_0x48bae7){return function(_0x5989f3){if(_0x5989f3){return _0x5989f3[_0x1224('0x24')]()[_0x1224('0x23')](function(){_0x407806['status'](0xcc)[_0x1224('0x18')]();});}};}function handleEntityNotFound(_0x1b6781,_0x118268){return function(_0xbed57){if(!_0xbed57){_0x1b6781[_0x1224('0x25')](0x194);}return _0xbed57;};}function handleError(_0x696802,_0x403e69){_0x403e69=_0x403e69||0x1f4;return function(_0x26203a){logger[_0x1224('0x26')](_0x26203a[_0x1224('0x27')]);if(_0x26203a[_0x1224('0x28')]){delete _0x26203a['name'];}_0x696802['status'](_0x403e69)[_0x1224('0x29')](_0x26203a);};}function getMustacheRender(_0x4631b4,_0x29cc30){return Mustache[_0x1224('0x2a')](_0x4631b4,_[_0x1224('0x2b')](_0x29cc30['body'],{'contact':_0x29cc30[_0x1224('0x2c')],'message':_0x29cc30[_0x1224('0x2d')],'agent':_0x29cc30['agent'],'interaction':_0x29cc30[_0x1224('0x2e')],'account':_0x29cc30[_0x1224('0x2f')]}))||'';}exports[_0x1224('0x30')]=function(_0x1616c0,_0x39bc2d){var _0x33d1f6={},_0x275968={},_0x20b621={'count':0x0,'rows':[]};var _0x541229=_['map'](db[_0x1224('0x31')][_0x1224('0x32')],function(_0x50fd52){return{'name':_0x50fd52[_0x1224('0x33')],'type':_0x50fd52[_0x1224('0x34')][_0x1224('0x35')]};});_0x275968[_0x1224('0x36')]=_[_0x1224('0x37')](_0x541229,_0x1224('0x28'));_0x275968['query']=_['keys'](_0x1616c0[_0x1224('0x38')]);_0x275968[_0x1224('0x39')]=_[_0x1224('0x3a')](_0x275968[_0x1224('0x36')],_0x275968[_0x1224('0x38')]);_0x33d1f6[_0x1224('0x3b')]=_[_0x1224('0x3a')](_0x275968['model'],qs[_0x1224('0x3c')](_0x1616c0[_0x1224('0x38')][_0x1224('0x3c')]));_0x33d1f6[_0x1224('0x3b')]=_0x33d1f6[_0x1224('0x3b')][_0x1224('0x3d')]?_0x33d1f6[_0x1224('0x3b')]:_0x275968[_0x1224('0x36')];if(!_0x1616c0[_0x1224('0x38')][_0x1224('0x3e')](_0x1224('0x3f'))){_0x33d1f6[_0x1224('0x1a')]=qs[_0x1224('0x1a')](_0x1616c0['query'][_0x1224('0x1a')]);_0x33d1f6[_0x1224('0x19')]=qs['offset'](_0x1616c0[_0x1224('0x38')]['offset']);}_0x33d1f6[_0x1224('0x40')]=qs['sort'](_0x1616c0['query'][_0x1224('0x41')]);_0x33d1f6[_0x1224('0x42')]=qs[_0x1224('0x39')](_[_0x1224('0x43')](_0x1616c0[_0x1224('0x38')],_0x275968[_0x1224('0x39')]),_0x541229);if(_0x1616c0[_0x1224('0x38')][_0x1224('0x44')]){_0x33d1f6[_0x1224('0x42')]=_['merge'](_0x33d1f6[_0x1224('0x42')],{'$or':_[_0x1224('0x37')](_0x541229,function(_0x1bf317){if(_0x1bf317[_0x1224('0x34')]!==_0x1224('0x45')){var _0x456012={};_0x456012[_0x1bf317[_0x1224('0x28')]]={'$like':'%'+_0x1616c0[_0x1224('0x38')][_0x1224('0x44')]+'%'};return _0x456012;}})});}_0x33d1f6=_[_0x1224('0x2b')]({},_0x33d1f6,_0x1616c0[_0x1224('0x46')]);var _0x10d58c={'where':_0x33d1f6[_0x1224('0x42')]};return db[_0x1224('0x31')][_0x1224('0x1c')](_0x10d58c)[_0x1224('0x23')](function(_0x5c3bd7){_0x20b621['count']=_0x5c3bd7;if(_0x1616c0['query'][_0x1224('0x47')]){_0x33d1f6[_0x1224('0x48')]=[{'all':!![]}];}return db[_0x1224('0x31')]['findAll'](_0x33d1f6);})[_0x1224('0x23')](function(_0x16da68){_0x20b621[_0x1224('0x49')]=_0x16da68;return _0x20b621;})['then'](respondWithFilteredResult(_0x39bc2d,_0x33d1f6))[_0x1224('0x4a')](handleError(_0x39bc2d,null));};exports['show']=function(_0x5cd492,_0x47ce23){var _0x50191e={'raw':!![],'where':{'id':_0x5cd492['params']['id']}},_0x2e54dc={};_0x2e54dc['model']=_[_0x1224('0x4b')](db['SmsApplication'][_0x1224('0x32')]);_0x2e54dc[_0x1224('0x38')]=_['keys'](_0x5cd492[_0x1224('0x38')]);_0x2e54dc[_0x1224('0x39')]=_[_0x1224('0x3a')](_0x2e54dc[_0x1224('0x36')],_0x2e54dc[_0x1224('0x38')]);_0x50191e[_0x1224('0x3b')]=_[_0x1224('0x3a')](_0x2e54dc[_0x1224('0x36')],qs[_0x1224('0x3c')](_0x5cd492[_0x1224('0x38')][_0x1224('0x3c')]));_0x50191e[_0x1224('0x3b')]=_0x50191e[_0x1224('0x3b')][_0x1224('0x3d')]?_0x50191e[_0x1224('0x3b')]:_0x2e54dc[_0x1224('0x36')];if(_0x5cd492['query']['includeAll']){_0x50191e[_0x1224('0x48')]=[{'all':!![]}];}_0x50191e=_[_0x1224('0x2b')]({},_0x50191e,_0x5cd492[_0x1224('0x46')]);return db['SmsApplication']['find'](_0x50191e)['then'](handleEntityNotFound(_0x47ce23,null))['then'](respondWithResult(_0x47ce23,null))[_0x1224('0x4a')](handleError(_0x47ce23,null));};exports[_0x1224('0x4c')]=function(_0x515a48,_0x2cce91){return db[_0x1224('0x31')][_0x1224('0x4c')](_0x515a48[_0x1224('0x4d')],{})['then'](respondWithResult(_0x2cce91,0xc9))[_0x1224('0x4a')](handleError(_0x2cce91,null));};exports[_0x1224('0x22')]=function(_0x24db46,_0x5212ff){if(_0x24db46[_0x1224('0x4d')]['id']){delete _0x24db46[_0x1224('0x4d')]['id'];}return db[_0x1224('0x31')][_0x1224('0x4e')]({'where':{'id':_0x24db46[_0x1224('0x4f')]['id']}})[_0x1224('0x23')](handleEntityNotFound(_0x5212ff,null))[_0x1224('0x23')](saveUpdates(_0x24db46['body'],null))['then'](respondWithResult(_0x5212ff,null))[_0x1224('0x4a')](handleError(_0x5212ff,null));};exports['destroy']=function(_0x3cbaf2,_0x2abb73){return db[_0x1224('0x31')]['find']({'where':{'id':_0x3cbaf2[_0x1224('0x4f')]['id']}})[_0x1224('0x23')](handleEntityNotFound(_0x2abb73,null))[_0x1224('0x23')](removeEntity(_0x2abb73,null))['catch'](handleError(_0x2abb73,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index bb972fd..0baf912 100644 --- a/server/api/smsApplication/smsApplication.model.js +++ b/server/api/smsApplication/smsApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cd9=['path','../../config/environment','SmsApplication','sms_applications','utf8mb4','lodash','util','api'];(function(_0xf469aa,_0x50ae18){var _0x264ef4=function(_0x73521a){while(--_0x73521a){_0xf469aa['push'](_0xf469aa['shift']());}};_0x264ef4(++_0x50ae18);}(_0x7cd9,0xcd));var _0x97cd=function(_0x6dabf3,_0x562fb0){_0x6dabf3=_0x6dabf3-0x0;var _0x314c56=_0x7cd9[_0x6dabf3];return _0x314c56;};'use strict';var _=require(_0x97cd('0x0'));var util=require(_0x97cd('0x1'));var logger=require('../../config/logger')(_0x97cd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x97cd('0x3'));var rimraf=require('rimraf');var config=require(_0x97cd('0x4'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x5e8639,_0x62c38f){return _0x5e8639['define'](_0x97cd('0x5'),attributes,{'tableName':_0x97cd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97cd('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbeb0=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x290111,_0x28f746){var _0x43dc88=function(_0x281318){while(--_0x281318){_0x290111['push'](_0x290111['shift']());}};_0x43dc88(++_0x28f746);}(_0xbeb0,0xd0));var _0x0beb=function(_0x3ff5f1,_0x3f9cd8){_0x3ff5f1=_0x3ff5f1-0x0;var _0x2a372e=_0xbeb0[_0x3ff5f1];return _0x2a372e;};'use strict';var _=require('lodash');var util=require(_0x0beb('0x0'));var logger=require(_0x0beb('0x1'))(_0x0beb('0x2'));var moment=require(_0x0beb('0x3'));var BPromise=require(_0x0beb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0beb('0x5'));var config=require(_0x0beb('0x6'));var attributes=require(_0x0beb('0x7'));module[_0x0beb('0x8')]=function(_0x72ad7d,_0x2c1cec){return _0x72ad7d[_0x0beb('0x9')]('SmsApplication',attributes,{'tableName':_0x0beb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0beb('0xb'),'collate':_0x0beb('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c659f69..fe34d1e 100644 --- a/server/api/smsApplication/smsApplication.rpc.js +++ b/server/api/smsApplication/smsApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x814b,0x1a2));var _0xb814=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0x814b[_0x589eb4];return _0xf50816;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('SmsApplication,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x510e=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x510e,0x1ed));var _0xe510=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x510e[_0x46ae5a];return _0x434986;};'use strict';var _=require(_0xe510('0x0'));var util=require(_0xe510('0x1'));var moment=require(_0xe510('0x2'));var BPromise=require(_0xe510('0x3'));var rs=require(_0xe510('0x4'));var fs=require('fs');var Redis=require(_0xe510('0x5'));var db=require(_0xe510('0x6'))['db'];var utils=require(_0xe510('0x7'));var logger=require(_0xe510('0x8'))('rpc');var config=require(_0xe510('0x9'));var jayson=require(_0xe510('0xa'));var client=jayson[_0xe510('0xb')][_0xe510('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26cffc,_0x18ec55,_0x27ca15){return new BPromise(function(_0x42b48c,_0x2f5db7){return client[_0xe510('0xd')](_0x26cffc,_0x27ca15)[_0xe510('0xe')](function(_0xf2a94b){logger[_0xe510('0xf')](_0xe510('0x10'),_0x18ec55,'request\x20sent');logger[_0xe510('0x11')](_0xe510('0x12'),_0x18ec55,_0xe510('0x13'),JSON[_0xe510('0x14')](_0xf2a94b));if(_0xf2a94b[_0xe510('0x15')]){if(_0xf2a94b[_0xe510('0x15')]['code']===0x1f4){logger[_0xe510('0x15')](_0xe510('0x10'),_0x18ec55,_0xf2a94b[_0xe510('0x15')][_0xe510('0x16')]);return _0x2f5db7(_0xf2a94b[_0xe510('0x15')][_0xe510('0x16')]);}logger[_0xe510('0x15')](_0xe510('0x10'),_0x18ec55,_0xf2a94b[_0xe510('0x15')][_0xe510('0x16')]);return _0x42b48c(_0xf2a94b[_0xe510('0x15')][_0xe510('0x16')]);}else{logger['info'](_0xe510('0x10'),_0x18ec55,'request\x20sent');_0x42b48c(_0xf2a94b['result'][_0xe510('0x16')]);}})[_0xe510('0x17')](function(_0x2684b4){logger[_0xe510('0x15')](_0xe510('0x10'),_0x18ec55,_0x2684b4);_0x2f5db7(_0x2684b4);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 777a575..f3f48c0 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41d0=['isAuthenticated','index','/describe','describe','/:id','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','smsinteraction:destroy','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x41d0,0x1c6));var _0x041d=function(_0x126d27,_0x5d5d0e){_0x126d27=_0x126d27-0x0;var _0x18f24c=_0x41d0[_0x126d27];return _0x18f24c;};'use strict';var multer=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var path=require(_0x041d('0x2'));var timeout=require(_0x041d('0x3'));var express=require('express');var router=express[_0x041d('0x4')]();var fs_extra=require(_0x041d('0x5'));var auth=require(_0x041d('0x6'));var interaction=require(_0x041d('0x7'));var config=require(_0x041d('0x8'));var controller=require(_0x041d('0x9'));router[_0x041d('0xa')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0xc')]);router['get'](_0x041d('0xd'),auth['isAuthenticated'](),controller[_0x041d('0xe')]);router['get'](_0x041d('0xf'),auth[_0x041d('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0x041d('0xb')](),controller['getMessages']);router[_0x041d('0xa')]('/:id/download',auth[_0x041d('0xb')](),controller[_0x041d('0x10')]);router[_0x041d('0x11')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0x12')]);router[_0x041d('0x11')](_0x041d('0x13'),auth[_0x041d('0xb')](),controller[_0x041d('0x14')]);router['post'](_0x041d('0x15'),auth[_0x041d('0xb')](),interaction[_0x041d('0x16')](_0x041d('0x17'),_0x041d('0x18')),controller[_0x041d('0x19')]);router['put'](_0x041d('0xf'),auth[_0x041d('0xb')](),interaction[_0x041d('0x16')](_0x041d('0x17'),_0x041d('0x1a')),controller[_0x041d('0x1b')]);router['delete']('/:id',auth[_0x041d('0xb')](),interaction[_0x041d('0x16')]('sms',_0x041d('0x1c')),controller['destroy']);router[_0x041d('0x1d')](_0x041d('0x15'),auth[_0x041d('0xb')](),controller['removeTags']);module[_0x041d('0x1e')]=router; \ No newline at end of file +var _0xcedf=['show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','index','/describe','/:id','isAuthenticated'];(function(_0x337a03,_0x52de1a){var _0x636ad7=function(_0x247d6b){while(--_0x247d6b){_0x337a03['push'](_0x337a03['shift']());}};_0x636ad7(++_0x52de1a);}(_0xcedf,0x1b6));var _0xfced=function(_0x4d72a0,_0x5edb3e){_0x4d72a0=_0x4d72a0-0x0;var _0x231e01=_0xcedf[_0x4d72a0];return _0x231e01;};'use strict';var multer=require(_0xfced('0x0'));var util=require(_0xfced('0x1'));var path=require(_0xfced('0x2'));var timeout=require(_0xfced('0x3'));var express=require('express');var router=express[_0xfced('0x4')]();var fs_extra=require(_0xfced('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfced('0x6'));var controller=require('./smsInteraction.controller');router[_0xfced('0x7')]('/',auth['isAuthenticated'](),controller[_0xfced('0x8')]);router['get'](_0xfced('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xfced('0x7')](_0xfced('0xa'),auth[_0xfced('0xb')](),controller[_0xfced('0xc')]);router['get'](_0xfced('0xd'),auth[_0xfced('0xb')](),controller[_0xfced('0xe')]);router[_0xfced('0x7')](_0xfced('0xf'),auth[_0xfced('0xb')](),controller[_0xfced('0x10')]);router[_0xfced('0x11')]('/',auth[_0xfced('0xb')](),controller['create']);router[_0xfced('0x11')]('/:id/messages',auth[_0xfced('0xb')](),controller[_0xfced('0x12')]);router[_0xfced('0x11')](_0xfced('0x13'),auth['isAuthenticated'](),interaction[_0xfced('0x14')](_0xfced('0x15'),_0xfced('0x16')),controller[_0xfced('0x17')]);router[_0xfced('0x18')](_0xfced('0xa'),auth[_0xfced('0xb')](),interaction[_0xfced('0x14')]('sms',_0xfced('0x19')),controller['update']);router[_0xfced('0x1a')](_0xfced('0xa'),auth[_0xfced('0xb')](),interaction[_0xfced('0x14')](_0xfced('0x15'),_0xfced('0x1b')),controller[_0xfced('0x1c')]);router[_0xfced('0x1a')](_0xfced('0x13'),auth[_0xfced('0xb')](),controller['removeTags']);module[_0xfced('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f887b75..b24235a 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a96=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x9a96,0x129));var _0x69a9=function(_0x14eb8c,_0x28f957){_0x14eb8c=_0x14eb8c-0x0;var _0x41a8d1=_0x9a96[_0x14eb8c];return _0x41a8d1;};'use strict';var Sequelize=require(_0x69a9('0x0'));var moment=require(_0x69a9('0x1'));module[_0x69a9('0x2')]={'closed':{'type':Sequelize[_0x69a9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x69a9('0x4')]},'disposition':{'type':Sequelize[_0x69a9('0x5')]},'secondDisposition':{'type':Sequelize[_0x69a9('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x69a9('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x69a9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x69a9('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x69a9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x69a9('0x6')]('in',_0x69a9('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3b9f=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x311e8e,_0x1dce77){var _0x2666e7=function(_0x2da6fd){while(--_0x2da6fd){_0x311e8e['push'](_0x311e8e['shift']());}};_0x2666e7(++_0x1dce77);}(_0x3b9f,0x17c));var _0xf3b9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3b9f[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xf3b9('0x0'));var moment=require(_0xf3b9('0x1'));module[_0xf3b9('0x2')]={'closed':{'type':Sequelize[_0xf3b9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf3b9('0x4')]},'disposition':{'type':Sequelize[_0xf3b9('0x5')]},'secondDisposition':{'type':Sequelize[_0xf3b9('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf3b9('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf3b9('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf3b9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf3b9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf3b9('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7a51099..aeb7453 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1ec=['`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','isEmpty','i.SmsAccountId\x20IS\x20NULL','sequelize','keyBy','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','options','create','update','destroy','describe','addMessage','SmsMessage','getMessages','findOne','pick','merge','format','addTags','setTags','ids','omit','spread','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','User','fullname','firstName','Messages','direction','SmsAccount','Owner','mkdirSync','Sms','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','System','lastName','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','createPdfFromHTML','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','body','contact','message','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','push','catch','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read'];(function(_0x2aeb4b,_0x26574a){var _0x37a31b=function(_0x52e49b){while(--_0x52e49b){_0x2aeb4b['push'](_0x2aeb4b['shift']());}};_0x37a31b(++_0x26574a);}(_0xa1ec,0x15f));var _0xca1e=function(_0x4dd063,_0x386d0c){_0x4dd063=_0x4dd063-0x0;var _0x2b8747=_0xa1ec[_0x4dd063];return _0x2b8747;};'use strict';var emlformat=require(_0xca1e('0x0'));var rimraf=require(_0xca1e('0x1'));var zipdir=require(_0xca1e('0x2'));var jsonpatch=require(_0xca1e('0x3'));var rp=require(_0xca1e('0x4'));var moment=require(_0xca1e('0x5'));var BPromise=require(_0xca1e('0x6'));var Mustache=require(_0xca1e('0x7'));var util=require(_0xca1e('0x8'));var path=require('path');var sox=require(_0xca1e('0x9'));var csv=require('to-csv');var ejs=require(_0xca1e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca1e('0xb'));var squel=require(_0xca1e('0xc'));var crypto=require(_0xca1e('0xd'));var jsforce=require(_0xca1e('0xe'));var deskjs=require(_0xca1e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xca1e('0x10'));var Papa=require(_0xca1e('0x11'));var Redis=require('ioredis');var authService=require(_0xca1e('0x12'));var qs=require(_0xca1e('0x13'));var as=require(_0xca1e('0x14'));var pdf=require(_0xca1e('0x15'));var hardwareService=require(_0xca1e('0x16'));var logger=require(_0xca1e('0x17'))(_0xca1e('0x18'));var utils=require(_0xca1e('0x19'));var config=require(_0xca1e('0x1a'));var licenseUtil=require(_0xca1e('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xca1e('0x1c')](config[_0xca1e('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xca1e('0x1e'))(new Redis(config[_0xca1e('0x1d')]));require(_0xca1e('0x1f'))[_0xca1e('0x20')](socket);function respondWithStatusCode(_0x17f3b3,_0x17d07b){_0x17d07b=_0x17d07b||0xcc;return function(_0x50e61d){if(_0x50e61d){return _0x17f3b3['sendStatus'](_0x17d07b);}return _0x17f3b3[_0xca1e('0x21')](_0x17d07b)[_0xca1e('0x22')]();};}function respondWithResult(_0x37f0e9,_0x57c039){_0x57c039=_0x57c039||0xc8;return function(_0x564422){if(_0x564422){return _0x37f0e9[_0xca1e('0x21')](_0x57c039)[_0xca1e('0x23')](_0x564422);}};}function respondWithFilteredResult(_0x508f6c,_0x5c16f0){return function(_0x16ea2f){if(_0x16ea2f){var _0xb0bf78=typeof _0x5c16f0[_0xca1e('0x24')]===_0xca1e('0x25')&&typeof _0x5c16f0[_0xca1e('0x26')]===_0xca1e('0x25');var _0x28ec44=_0x16ea2f[_0xca1e('0x27')];var _0x2c63ef=_0xb0bf78?0x0:_0x5c16f0[_0xca1e('0x24')];var _0x2f97d0=_0xb0bf78?_0x16ea2f[_0xca1e('0x27')]:_0x5c16f0['offset']+_0x5c16f0[_0xca1e('0x26')];var _0x4df04b;if(_0x2f97d0>=_0x28ec44){_0x2f97d0=_0x28ec44;_0x4df04b=0xc8;}else{_0x4df04b=0xce;}_0x508f6c[_0xca1e('0x21')](_0x4df04b);return _0x508f6c[_0xca1e('0x28')](_0xca1e('0x29'),_0x2c63ef+'-'+_0x2f97d0+'/'+_0x28ec44)['json'](_0x16ea2f);}return null;};}function patchUpdates(_0x5aa50a){return function(_0x563977){try{jsonpatch[_0xca1e('0x2a')](_0x563977,_0x5aa50a,!![]);}catch(_0x3189bb){return BPromise[_0xca1e('0x2b')](_0x3189bb);}return _0x563977[_0xca1e('0x2c')]();};}function saveUpdates(_0x23bc2c,_0x1ea040){return function(_0x39a695){if(_0x39a695){return _0x39a695['update'](_0x23bc2c)[_0xca1e('0x2d')](function(_0x2b5c2e){return _0x2b5c2e;});}return null;};}function removeEntity(_0x401a1b,_0xf59b81){return function(_0x22e0aa){if(_0x22e0aa){return _0x22e0aa['destroy']()[_0xca1e('0x2d')](function(){_0x401a1b[_0xca1e('0x21')](0xcc)[_0xca1e('0x22')]();});}};}function handleEntityNotFound(_0x31f68d,_0x445561){return function(_0x3612ac){if(!_0x3612ac){_0x31f68d[_0xca1e('0x2e')](0x194);}return _0x3612ac;};}function handleError(_0x1baa9a,_0x218557){_0x218557=_0x218557||0x1f4;return function(_0x4bc769){logger[_0xca1e('0x2f')](_0x4bc769[_0xca1e('0x30')]);if(_0x4bc769[_0xca1e('0x31')]){delete _0x4bc769['name'];}_0x1baa9a['status'](_0x218557)[_0xca1e('0x32')](_0x4bc769);};}function getMustacheRender(_0xd94e77,_0x484649){return Mustache['render'](_0xd94e77,_['merge'](_0x484649[_0xca1e('0x33')],{'contact':_0x484649[_0xca1e('0x34')],'message':_0x484649[_0xca1e('0x35')],'agent':_0x484649[_0xca1e('0x36')],'interaction':_0x484649[_0xca1e('0x37')],'account':_0x484649[_0xca1e('0x38')]}))||'';}function getInteractionUsers(_0xdf27f,_0x1bbe3f){return new BPromise(function(_0x5159a2,_0x53dc15){try{if(_0x1bbe3f[_0xdf27f['id']]){_0xdf27f[_0xca1e('0x39')]=_[_0xca1e('0x3a')](_0x1bbe3f[_0xdf27f['id']],function(_0x1905f8){return{'id':_0x1905f8['id'],'fullname':_0x1905f8['fullname']};});}}catch(_0xbd2ef6){_0x53dc15(_0xbd2ef6);}_0x5159a2(_0xdf27f);});}function getInteractionTags(_0x193396,_0x64e1fe){return new BPromise(function(_0x249aab,_0x35faf6){try{if(_0x193396[_0xca1e('0x3b')]){_0x193396[_0xca1e('0x3c')]=[];_0x193396[_0xca1e('0x3b')][_0xca1e('0x3d')](',')[_0xca1e('0x3e')](function(_0x5b0441){_0x193396[_0xca1e('0x3c')][_0xca1e('0x3f')](_0x64e1fe[_0x5b0441]);});}delete _0x193396[_0xca1e('0x3b')];}catch(_0x49e43a){_0x35faf6(_0x49e43a);}_0x249aab(_0x193396);});}function updateSmsInteraction(_0x481685,_0x201bdf,_0x8a7b69){return new BPromise(function(_0x2a585e,_0x233fb9){return getInteractionUsers(_0x481685,_0x8a7b69)[_0xca1e('0x2d')](function(_0x308726){return getInteractionTags(_0x308726,_0x201bdf);})[_0xca1e('0x2d')](function(_0x313c22){_0x2a585e(_0x313c22);})[_0xca1e('0x40')](function(_0x25c5b3){_0x233fb9(_0x25c5b3);});});}exports['index']=function(_0x3fcd26,_0x4ba4a3){var _0x34670d={},_0x13145c={},_0x54ac4f={'count':0x0,'rows':[]};var _0xa717a8=_[_0xca1e('0x3a')](db['SmsInteraction'][_0xca1e('0x41')],function(_0x93c160){return{'name':_0x93c160['fieldName'],'type':_0x93c160[_0xca1e('0x42')][_0xca1e('0x43')]};});_0x13145c[_0xca1e('0x44')]=_[_0xca1e('0x3a')](_0xa717a8,_0xca1e('0x31'));_0x13145c[_0xca1e('0x45')]=_[_0xca1e('0x46')](_0x3fcd26[_0xca1e('0x45')]);_0x13145c[_0xca1e('0x47')]=_[_0xca1e('0x48')](_0x13145c[_0xca1e('0x44')],_0x13145c['query']);_0x34670d['attributes']=_['intersection'](_0x13145c[_0xca1e('0x44')],qs[_0xca1e('0x49')](_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x49')]));_0x34670d[_0xca1e('0x4a')]=_0x34670d['attributes'][_0xca1e('0x4b')]?_0x34670d[_0xca1e('0x4a')]:_0x13145c[_0xca1e('0x44')];if(!_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x4c')](_0xca1e('0x4d'))){_0x34670d[_0xca1e('0x26')]=qs['limit'](_0x3fcd26['query'][_0xca1e('0x26')]);_0x34670d[_0xca1e('0x24')]=qs['offset'](_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x24')]);}_0x34670d['order']=qs[_0xca1e('0x4e')](_0x3fcd26['query'][_0xca1e('0x4e')]);_0x34670d[_0xca1e('0x4f')]=qs[_0xca1e('0x47')](_['pick'](_0x3fcd26[_0xca1e('0x45')],_0x13145c['filters']),_0xa717a8);var _0x7856e5=[];var _0x21e2a5=squel[_0xca1e('0x50')]()[_0xca1e('0x51')]('id')[_0xca1e('0x51')](_0xca1e('0x31'))[_0xca1e('0x51')](_0xca1e('0x52'))[_0xca1e('0x53')](_0xca1e('0x54'));var _0x421e29=squel[_0xca1e('0x50')]()['field'](_0xca1e('0x55'))[_0xca1e('0x51')](_0xca1e('0x56'))[_0xca1e('0x51')]('ui.SmsInteractionId')[_0xca1e('0x53')](_0xca1e('0x57'),'ui')['left_join'](_0xca1e('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x73f9e1=squel[_0xca1e('0x50')]()[_0xca1e('0x53')](_0xca1e('0x59'),'i')['left_join'](_0xca1e('0x5a'),'c',_0xca1e('0x5b'))[_0xca1e('0x5c')](_0xca1e('0x58'),'o',_0xca1e('0x5d'))[_0xca1e('0x5c')](_0xca1e('0x5e'),'a',_0xca1e('0x5f'))[_0xca1e('0x5c')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xca1e('0x5c')](_0xca1e('0x60'),'it',_0xca1e('0x61'))[_0xca1e('0x5c')](_0xca1e('0x54'),'t',_0xca1e('0x62'));var _0x240b08=squel[_0xca1e('0x63')]();var _0x418be8=[];var _0x3e4cae=squel[_0xca1e('0x63')]();var _0x15e1e2;if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x64')]){_0x15e1e2=as[_0xca1e('0x65')](_0x3fcd26['query'][_0xca1e('0x64')]);var _0x5eb5d8=_0x15e1e2[_0xca1e('0x66')];for(var _0x4ae1c7=0x0;_0x4ae1c7<_0x15e1e2['conditions'][_0xca1e('0x4b')];_0x4ae1c7++){var _0x4ae723=_0x15e1e2['conditions'][_0x4ae1c7];var _0x2b9692='i';var _0x425d9f=_[_0xca1e('0x67')](_0xa717a8,[_0xca1e('0x31'),_0x4ae723['field']]);if(!_0x425d9f){switch(_0x4ae723[_0xca1e('0x51')]){case _0xca1e('0x68'):if(_0x4ae723[_0xca1e('0x69')]==0x1){_0x73f9e1[_0xca1e('0x6a')]('`'+_0x4ae723[_0xca1e('0x51')]+_0xca1e('0x6b'));}else{_0x73f9e1[_0xca1e('0x6a')]('`'+_0x4ae723[_0xca1e('0x51')]+'`\x20>\x200');}break;case _0xca1e('0x6c'):if(_0x4ae723[_0xca1e('0x6d')]===_0xca1e('0x6e')){if(_0x4ae723[_0xca1e('0x69')][_0xca1e('0x3d')]('\x20')[_0xca1e('0x4b')]>0x1){_0x240b08[_0x5eb5d8](_0xca1e('0x6f'),qs[_0xca1e('0x70')](_0x4ae723[_0xca1e('0x69')]),null);}else{var _0x34706a='%'+_0x4ae723[_0xca1e('0x69')]+'%';_0x240b08[_0x5eb5d8](_0xca1e('0x71'),_0x34706a,_0x34706a,_0x34706a);}}else{_0x425d9f=_[_0xca1e('0x67')](_0xa717a8,[_0xca1e('0x31'),_0xca1e('0x72')]);_0x4ae723[_0xca1e('0x51')]='ContactId';_0x26808e=as[_0xca1e('0x73')](_0x2b9692,_0x425d9f[_0xca1e('0x42')],_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e[_0xca1e('0x74')],_0x26808e['value'][_0xca1e('0x75')],_0x26808e[_0xca1e('0x69')]['end']);}break;case _0xca1e('0x76'):var _0x5b9ed0=_0x4ae723[_0xca1e('0x69')][_0xca1e('0x3d')](',')[_0xca1e('0x3a')](function(_0x43016a){return Number(_0x43016a);});_0x5b9ed0[_0xca1e('0x3e')](function(_0x2ba8da){_0x3e4cae['or'](_0xca1e('0x77'),'%,'+_0x2ba8da+',%');});_0x418be8=_[_0xca1e('0x78')](_0x418be8,_0x5b9ed0);break;case'User':if(_0x4ae723['operator']===_0xca1e('0x6e')){_0x240b08[_0x5eb5d8](_0xca1e('0x79'),'%'+_0x4ae723[_0xca1e('0x69')]+'%',null);}else{_0x425d9f=_[_0xca1e('0x67')](_0xa717a8,[_0xca1e('0x31'),_0xca1e('0x7a')]);_0x4ae723[_0xca1e('0x51')]=_0xca1e('0x7a');_0x26808e=as[_0xca1e('0x73')](_0x2b9692,_0x425d9f[_0xca1e('0x42')],_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e['text'],_0x26808e[_0xca1e('0x69')][_0xca1e('0x75')],_0x26808e[_0xca1e('0x69')][_0xca1e('0x22')]);}break;case _0xca1e('0x33'):_0x26808e=as['buildExpression']('me',null,_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e[_0xca1e('0x74')],_0x26808e[_0xca1e('0x69')][_0xca1e('0x75')],_0x26808e[_0xca1e('0x69')]['end']);break;}}else{var _0x26808e=as[_0xca1e('0x73')](_0x2b9692,_0x425d9f[_0xca1e('0x42')],_0x4ae723);_0x240b08[_0x5eb5d8](_0x26808e[_0xca1e('0x74')],_0x26808e[_0xca1e('0x69')]['start'],_0x26808e[_0xca1e('0x69')][_0xca1e('0x22')]);}}}else{var _0x15ba42=_(_0x3fcd26[_0xca1e('0x45')])[_0xca1e('0x46')]()[_0xca1e('0x3a')](function(_0x5f11ab){return _[_0xca1e('0x7b')](_0xa717a8,[_0xca1e('0x31'),_0x5f11ab])?_0x5f11ab:undefined;})[_0xca1e('0x7c')]()['value']();if(!_['isEmpty'](_0x15ba42)){_0x15ba42[_0xca1e('0x3e')](function(_0x4e15b1){if(_0x4e15b1==='SmsAccountId'){_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0x7d'),[][_0xca1e('0x7e')](_0x3fcd26[_0xca1e('0x45')][_0x4e15b1]));}else if(_0x4e15b1===_0xca1e('0x7f')){var _0x4e87d1=JSON[_0xca1e('0x80')](_0x3fcd26[_0xca1e('0x45')][_0x4e15b1])[_0xca1e('0x81')];var _0x3a8899=JSON[_0xca1e('0x80')](_0x3fcd26[_0xca1e('0x45')][_0x4e15b1])[_0xca1e('0x82')];_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0x83'),_0x4e87d1,_0x3a8899);}else{if(_0x3fcd26[_0xca1e('0x45')][_0x4e15b1]===_0xca1e('0x84')){_0x73f9e1[_0xca1e('0x4f')]('i.'+_0x4e15b1+_0xca1e('0x85'));}else{_0x73f9e1[_0xca1e('0x4f')]('i.'+_0x4e15b1+'\x20=\x20?',_0x3fcd26[_0xca1e('0x45')][_0x4e15b1]);}}});}if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x86')]){if(_0x3fcd26['query'][_0xca1e('0x86')]==0x1){_0x73f9e1[_0xca1e('0x6a')](_0xca1e('0x87'));}else{_0x73f9e1['having'](_0xca1e('0x88'));}}if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x89')]){_0x418be8=_[_0xca1e('0x8a')](_0x3fcd26['query'][_0xca1e('0x89')])?_0x3fcd26['query'][_0xca1e('0x89')]:new Array(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x89')]);_0x418be8['forEach'](function(_0x46b21d){_0x3e4cae['or'](_0xca1e('0x77'),'%,'+_0x46b21d+',%');});}if(_0x3fcd26[_0xca1e('0x45')]['filter']){var _0xf92222=_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x8b')][_0xca1e('0x8c')]('\x5c','\x5c\x5c')[_0xca1e('0x8c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xf92222)){_0x240b08['or'](_0xca1e('0x8d'),_0xf92222+'%')['or'](_0xca1e('0x8e'),_0xf92222+'%');}else{_0x240b08['or'](_0xca1e('0x8f'),qs[_0xca1e('0x70')](_0xf92222))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xf92222+'%');}}}_0x73f9e1[_0xca1e('0x4f')](_0x240b08);_0x73f9e1[_0xca1e('0x90')](_0xca1e('0x91'));var _0x34872f={'type':db[_0xca1e('0x92')][_0xca1e('0x93')][_0xca1e('0x94')],'raw':!![]};var _0x23ba7f=_0x73f9e1[_0xca1e('0x95')]();_0x23ba7f[_0xca1e('0x51')](_0xca1e('0x91'));_0x23ba7f['field'](_0xca1e('0x96'),_0xca1e('0x68'));if(_0x34670d['order']){_0x34670d[_0xca1e('0x97')][_0xca1e('0x3e')](function(_0x2851e5){var _0x3a0a2a=_0x2851e5[0x0]===_0xca1e('0x98')?_0x2851e5[0x0]:'i.'+_0x2851e5[0x0];_0x73f9e1[_0xca1e('0x97')](_0x3a0a2a,_0x2851e5[0x1]===_0xca1e('0x99')?![]:!![]);});}if(!_['isEmpty'](_0x418be8)){_0x73f9e1['having'](_0x3e4cae);_0x23ba7f['where'](_0xca1e('0x9a'),_0x418be8);}BPromise['resolve']()[_0xca1e('0x2d')](function(){if(!_0x15e1e2){if(_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x9b')])return;_0x23ba7f[_0xca1e('0x4f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0x9c'));return;}if(_0x3fcd26[_0xca1e('0x9d')][_0xca1e('0x9e')]!==_0xca1e('0x36'))return;return _0x3fcd26['user'][_0xca1e('0x9f')]({'attributes':['id'],'raw':!![]})[_0xca1e('0x2d')](function(_0x5b0953){if(_[_0xca1e('0xa0')](_0x5b0953)){_0x23ba7f[_0xca1e('0x4f')](_0xca1e('0xa1'));_0x73f9e1[_0xca1e('0x4f')](_0xca1e('0xa1'));}else{_0x23ba7f[_0xca1e('0x4f')](_0xca1e('0x7d'),_[_0xca1e('0x3a')](_0x5b0953,'id'));_0x73f9e1[_0xca1e('0x4f')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x5b0953,'id'));}});})[_0xca1e('0x2d')](function(){if(_0x3fcd26[_0xca1e('0x9d')][_0xca1e('0x9e')]===_0xca1e('0x36')&&!_0x15e1e2&&!_0x3fcd26[_0xca1e('0x45')][_0xca1e('0x9b')])return[];return db['sequelize']['query'](_0x23ba7f['toString'](),_0x34872f);})[_0xca1e('0x2d')](function(_0x411094){_0x54ac4f[_0xca1e('0x27')]=_0x411094['length'];if(_0x54ac4f[_0xca1e('0x27')]===0x0)return[];return db[_0xca1e('0xa2')]['query'](_0x21e2a5['toString'](),_0x34872f)['then'](function(_0x5214c7){_0x7856e5=_[_0xca1e('0xa3')](_0x5214c7,'id');_0x34872f=_['merge'](_0x34872f,{'model':db[_0xca1e('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fcd26[_0xca1e('0x45')]['fields']){_0x34670d[_0xca1e('0x4a')][_0xca1e('0x3e')](function(_0x489415){_0x73f9e1[_0xca1e('0x51')]('i.'+_0x489415);});}else{_0x73f9e1[_0xca1e('0x51')](_0xca1e('0x96'),'unreadMessages');_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xa5'),_0xca1e('0xa6'));_0x73f9e1['field'](_0xca1e('0xa7'),_0xca1e('0xa8'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xa9'),_0xca1e('0x98'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xaa'));_0x73f9e1['field']('c.firstName','Contact.firstName');_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xab'),_0xca1e('0xac'));_0x73f9e1['field']('c.email','Contact.email');_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xad'),_0xca1e('0xae'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xaf'),_0xca1e('0xb0'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xb1'),'Contact.fax');_0x73f9e1['field']('o.fullname',_0xca1e('0xb2'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xb3'),_0xca1e('0xb4'));_0x73f9e1[_0xca1e('0x51')](_0xca1e('0xb5'),'TagIds');}if(_0x34670d['limit'])_0x73f9e1['limit'](_0x34670d[_0xca1e('0x26')]);if(_0x34670d[_0xca1e('0x24')])_0x73f9e1['offset'](_0x34670d[_0xca1e('0x24')]);return db['sequelize'][_0xca1e('0x45')](_0x73f9e1[_0xca1e('0xb6')](),_0x34872f);})['then'](function(_0x33c86d){if(_0x33c86d[_0xca1e('0x4b')]>0x0)_0x421e29[_0xca1e('0x4f')](_0xca1e('0xb7'),_['map'](_0x33c86d,'id'));return db['sequelize'][_0xca1e('0x45')](_0x421e29[_0xca1e('0xb6')](),_0x34872f)[_0xca1e('0x2d')](function(_0x487c2e){var _0x1b334e=_[_0xca1e('0xb8')](_0x487c2e,'SmsInteractionId');var _0xc6313d=[];_0x33c86d['forEach'](function(_0x4674f8){_0xc6313d['push'](updateSmsInteraction(_0x4674f8,_0x7856e5,_0x1b334e));});return BPromise[_0xca1e('0xb9')](_0xc6313d);});});})['then'](function(_0x5f3bdc){_0x54ac4f[_0xca1e('0xba')]=_0x5f3bdc;return _0x54ac4f;})[_0xca1e('0x2d')](respondWithFilteredResult(_0x4ba4a3,_0x34670d))[_0xca1e('0x40')](handleError(_0x4ba4a3,null));};exports['show']=function(_0x36e7cb,_0x310023){var _0x359b16={'raw':![],'where':{'id':_0x36e7cb[_0xca1e('0xbb')]['id']}},_0xa46dd8={};_0xa46dd8[_0xca1e('0x44')]=_[_0xca1e('0x46')](db[_0xca1e('0xa4')]['rawAttributes']);_0xa46dd8[_0xca1e('0x45')]=_['keys'](_0x36e7cb[_0xca1e('0x45')]);_0xa46dd8[_0xca1e('0x47')]=_['intersection'](_0xa46dd8[_0xca1e('0x44')],_0xa46dd8[_0xca1e('0x45')]);_0x359b16['attributes']=_[_0xca1e('0x48')](_0xa46dd8['model'],qs[_0xca1e('0x49')](_0x36e7cb['query'][_0xca1e('0x49')]));_0x359b16[_0xca1e('0x4a')]=_0x359b16[_0xca1e('0x4a')][_0xca1e('0x4b')]?_0x359b16[_0xca1e('0x4a')]:_0xa46dd8[_0xca1e('0x44')];if(_0x36e7cb[_0xca1e('0x45')][_0xca1e('0xbc')]){_0x359b16[_0xca1e('0xbd')]=[{'all':!![]}];}_0x359b16=_['merge']({},_0x359b16,_0x36e7cb[_0xca1e('0xbe')]);return db[_0xca1e('0xa4')]['find'](_0x359b16)[_0xca1e('0x2d')](handleEntityNotFound(_0x310023,null))[_0xca1e('0x2d')](respondWithResult(_0x310023,null))['catch'](handleError(_0x310023,null));};exports[_0xca1e('0xbf')]=function(_0xf7b9c8,_0x2872b3){return db['SmsInteraction']['create'](_0xf7b9c8[_0xca1e('0x33')],{})['then'](respondWithResult(_0x2872b3,0xc9))[_0xca1e('0x40')](handleError(_0x2872b3,null));};exports[_0xca1e('0xc0')]=function(_0x5b297f,_0x3e086f){if(_0x5b297f[_0xca1e('0x33')]['id']){delete _0x5b297f[_0xca1e('0x33')]['id'];}return db[_0xca1e('0xa4')][_0xca1e('0x67')]({'where':{'id':_0x5b297f[_0xca1e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x3e086f,null))[_0xca1e('0x2d')](saveUpdates(_0x5b297f[_0xca1e('0x33')],null))[_0xca1e('0x2d')](respondWithResult(_0x3e086f,null))[_0xca1e('0x40')](handleError(_0x3e086f,null));};exports[_0xca1e('0xc1')]=function(_0x29a47e,_0x437149){return db[_0xca1e('0xa4')][_0xca1e('0x67')]({'where':{'id':_0x29a47e[_0xca1e('0xbb')]['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x437149,null))[_0xca1e('0x2d')](removeEntity(_0x437149,null))[_0xca1e('0x40')](handleError(_0x437149,null));};exports[_0xca1e('0xc2')]=function(_0x459168,_0x32de69){return db[_0xca1e('0xa4')][_0xca1e('0xc2')]()[_0xca1e('0x2d')](respondWithResult(_0x32de69,null))[_0xca1e('0x40')](handleError(_0x32de69,null));};exports[_0xca1e('0xc3')]=function(_0x5468d5,_0x37bc71,_0x15d029){return db[_0xca1e('0xc4')][_0xca1e('0x67')]({'where':{'id':_0x5468d5['params']['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x37bc71,null))['then'](function(_0x5cbb11){if(_0x5cbb11){return _0x5cbb11[_0xca1e('0xc3')](_0x5468d5[_0xca1e('0x33')]['ids'],_['omit'](_0x5468d5[_0xca1e('0x33')],['ids','id'])||{});}})[_0xca1e('0x2d')](respondWithResult(_0x37bc71,null))['catch'](handleError(_0x37bc71,null));};exports[_0xca1e('0xc5')]=function(_0x3e0718,_0x4f1d8e,_0x152425){var _0x23d726={'raw':![],'where':{}};var _0x32d86f={};var _0x801bc7={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xca1e('0xc6')]({'where':{'id':_0x3e0718[_0xca1e('0xbb')]['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x4f1d8e,null))[_0xca1e('0x2d')](function(_0x2fe489){if(_0x2fe489){_0x32d86f['model']=_['keys'](db[_0xca1e('0xc4')][_0xca1e('0x41')]);_0x32d86f['query']=_[_0xca1e('0x46')](_0x3e0718['query']);_0x32d86f[_0xca1e('0x47')]=_[_0xca1e('0x48')](_0x32d86f[_0xca1e('0x44')],_0x32d86f[_0xca1e('0x45')]);_0x23d726[_0xca1e('0x4a')]=_['intersection'](_0x32d86f[_0xca1e('0x44')],qs[_0xca1e('0x49')](_0x3e0718['query'][_0xca1e('0x49')]));_0x23d726[_0xca1e('0x4a')]=_0x23d726[_0xca1e('0x4a')][_0xca1e('0x4b')]?_0x23d726[_0xca1e('0x4a')]:_0x32d86f[_0xca1e('0x44')];if(!_0x3e0718[_0xca1e('0x45')][_0xca1e('0x4c')](_0xca1e('0x4d'))){_0x23d726['limit']=qs['limit'](_0x3e0718[_0xca1e('0x45')][_0xca1e('0x26')]);_0x23d726['offset']=qs[_0xca1e('0x24')](_0x3e0718[_0xca1e('0x45')][_0xca1e('0x24')]);}_0x23d726[_0xca1e('0x97')]=qs[_0xca1e('0x4e')](_0x3e0718['query']['sort']);_0x23d726[_0xca1e('0x4f')]=qs[_0xca1e('0x47')](_[_0xca1e('0xc7')](_0x3e0718[_0xca1e('0x45')],_0x32d86f[_0xca1e('0x47')]));_0x23d726[_0xca1e('0x4f')]['SmsInteractionId']=_0x2fe489['id'];if(_0x3e0718[_0xca1e('0x45')]['filter']){_0x23d726['where']=_[_0xca1e('0xc8')](_0x23d726['where'],{'$or':_[_0xca1e('0x3a')](_0x23d726[_0xca1e('0x4a')],function(_0x3ff2cf){var _0x4deb07={};_0x4deb07[_0x3ff2cf]={'$like':'%'+_0x3e0718[_0xca1e('0x45')][_0xca1e('0x8b')]+'%'};return _0x4deb07;})});}if(_0x3e0718[_0xca1e('0x45')][_0xca1e('0x81')]){var _0x4598ed=_0x3e0718['query']['$gte'][_0xca1e('0x3d')](',');var _0x1435b0={};_0x1435b0[_0x4598ed[0x0]]={'$gte':moment(_0x4598ed[0x1])[_0xca1e('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23d726['where']=_[_0xca1e('0xc8')](_0x23d726[_0xca1e('0x4f')],_0x1435b0);}_0x23d726=_['merge']({},_0x23d726,_0x3e0718[_0xca1e('0xbe')]);return db['SmsMessage']['count']({'where':_0x23d726[_0xca1e('0x4f')]})['then'](function(_0x16df73){_0x801bc7[_0xca1e('0x27')]=_0x16df73;if(_0x3e0718['query'][_0xca1e('0xbc')]){_0x23d726[_0xca1e('0xbd')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x23d726);})[_0xca1e('0x2d')](function(_0x20c87f){_0x801bc7[_0xca1e('0xba')]=_0x20c87f;return _0x801bc7;});}})[_0xca1e('0x2d')](respondWithFilteredResult(_0x4f1d8e,_0x23d726))[_0xca1e('0x40')](handleError(_0x4f1d8e,null));};exports[_0xca1e('0xca')]=function(_0x3f90e4,_0x219958,_0x355833){return db['SmsInteraction'][_0xca1e('0x67')]({'where':{'id':_0x3f90e4[_0xca1e('0xbb')]['id']}})['then'](handleEntityNotFound(_0x219958,null))[_0xca1e('0x2d')](function(_0x36bfa0){if(_0x36bfa0){return _0x36bfa0[_0xca1e('0xcb')](_0x3f90e4[_0xca1e('0x33')][_0xca1e('0xcc')],_[_0xca1e('0xcd')](_0x3f90e4[_0xca1e('0x33')],[_0xca1e('0xcc'),'id'])||{})[_0xca1e('0xce')](function(){return db[_0xca1e('0x76')][_0xca1e('0xcf')]({'attributes':['id',_0xca1e('0x31'),_0xca1e('0x52')],'where':{'id':_0x3f90e4[_0xca1e('0x33')][_0xca1e('0xcc')]}});})[_0xca1e('0x2d')](function(_0x2036df){socket[_0xca1e('0xd0')]('smsInteractionTags:save',{'id':Number(_0x3f90e4[_0xca1e('0xbb')]['id']),'tags':_0x2036df||[]});return{'id':Number(_0x3f90e4[_0xca1e('0xbb')]['id']),'tags':_0x2036df||[]};});}})[_0xca1e('0x2d')](respondWithResult(_0x219958,null))['catch'](handleError(_0x219958,null));};exports[_0xca1e('0xd1')]=function(_0x3941b1,_0x39ea95,_0x47d597){return db[_0xca1e('0xa4')][_0xca1e('0x67')]({'where':{'id':_0x3941b1[_0xca1e('0xbb')]['id']}})[_0xca1e('0x2d')](handleEntityNotFound(_0x39ea95,null))[_0xca1e('0x2d')](function(_0x146075){if(_0x146075){return _0x146075[_0xca1e('0xd1')](_0x3941b1['query'][_0xca1e('0xcc')]);}})[_0xca1e('0x2d')](respondWithStatusCode(_0x39ea95,null))[_0xca1e('0x40')](handleError(_0x39ea95,null));};exports[_0xca1e('0xd2')]=function(_0x362dc5,_0x30fb6a){var _0x3311bc=moment()[_0xca1e('0xd3')]()[_0xca1e('0xb6')]();var _0x71b276=path[_0xca1e('0xd4')](config[_0xca1e('0xd5')],_0xca1e('0xd6'),_0xca1e('0xd7'),_0xca1e('0xd8'));var _0x39f743=path[_0xca1e('0xd4')](config[_0xca1e('0xd5')],_0xca1e('0xd6'),'files',_0xca1e('0xd9'));var _0x211d93=path[_0xca1e('0xd4')](_0x71b276,_0x3311bc);var _0x38c6a9=util['format']('transcript-%d-%s.zip',_0x362dc5[_0xca1e('0xbb')]['id'],_0x3311bc);var _0x42ea21=path[_0xca1e('0xd4')](_0x71b276,_0x38c6a9);var _0x4f7487=[];_0x4f7487['push']({'model':db[_0xca1e('0xda')],'as':'User','attributes':['id',_0xca1e('0xdb')],'raw':!![]});_0x4f7487['push']({'model':db['CmContact'],'as':_0xca1e('0x6c'),'attributes':['id',_0xca1e('0xdc'),'lastName'],'raw':!![]});var _0x13702a=[{'model':db[_0xca1e('0xc4')],'as':_0xca1e('0xdd'),'attributes':['id','body','createdAt',_0xca1e('0xde'),'secret',_0xca1e('0x86')],'include':_0x4f7487}];_0x13702a[_0xca1e('0x3f')]({'model':db[_0xca1e('0xdf')],'as':'Account','attributes':['id',_0xca1e('0x31')]});_0x13702a['push']({'model':db['User'],'as':_0xca1e('0xe0'),'attributes':['id',_0xca1e('0xdb')]});return db['SmsInteraction']['find']({'where':{'id':_0x362dc5['params']['id']},'include':_0x13702a})[_0xca1e('0x2d')](handleEntityNotFound(_0x30fb6a,null))[_0xca1e('0x2d')](function(_0x251d1f){if(_0x251d1f){var _0x3dcd45=_0x251d1f['get']({'plain':!![]});fs[_0xca1e('0xe1')](_0x211d93);var _0x18170b={'channel':_0xca1e('0xe2'),'account':_0x3dcd45[_0xca1e('0xe3')]['name'],'agent':_0x3dcd45[_0xca1e('0xe0')]?_0x3dcd45[_0xca1e('0xe0')][_0xca1e('0xdb')]:_0xca1e('0xe4'),'createdAt':moment(_0x3dcd45[_0xca1e('0x7f')])['format'](_0xca1e('0xe5'))[_0xca1e('0xb6')](),'closedAt':_0x3dcd45[_0xca1e('0xe6')]?moment(_0x3dcd45[_0xca1e('0xe7')])[_0xca1e('0xc9')](_0xca1e('0xe5'))['toString']():'','disposition':_0x3dcd45[_0xca1e('0xe8')],'messages':_(_0x3dcd45[_0xca1e('0xdd')])[_0xca1e('0x8b')]({'secret':![]})[_0xca1e('0x3a')](function(_0x296738){return{'date':moment(_0x296738['createdAt'])['format'](_0xca1e('0xe5'))[_0xca1e('0xb6')](),'sender':_0x296738['direction']==='out'?_0x296738[_0xca1e('0xda')]?_0x296738[_0xca1e('0xda')][_0xca1e('0xdb')]:_0xca1e('0xe9'):_0x296738['Contact'][_0xca1e('0xdc')]+(_0x296738[_0xca1e('0x6c')][_0xca1e('0xea')]?'\x20'+_0x296738['Contact'][_0xca1e('0xea')]:''),'body':_0x296738[_0xca1e('0x33')],'direction':_0x296738['direction']==='out'?'A':'C','secret':_0x296738[_0xca1e('0xeb')],'read':_0x296738[_0xca1e('0x86')]};})['value']()};return ejs[_0xca1e('0xec')](path[_0xca1e('0xd4')](config[_0xca1e('0xd5')],_0xca1e('0xd6'),_0xca1e('0xed'),_0xca1e('0xee')),{'interaction':_0x18170b})['then'](function(_0x2334f3){var _0xb564a7=path[_0xca1e('0xd4')](_0x211d93,_0xca1e('0xef')+_0x3dcd45['id']+'-'+_0x3311bc+_0xca1e('0xf0'));var _0x360351={'path':_0xb564a7,'channel':_0xca1e('0xe2'),'interactionId':_0x3dcd45['id']};return pdf[_0xca1e('0xf1')](_0x2334f3,_0x360351);})[_0xca1e('0x2d')](function(){return new BPromise(function(_0x579307,_0xf0c7b0){zipdir(_0x211d93,{'saveTo':_0x42ea21},function(_0x4d34b9,_0x4b5cf7){if(_0x4d34b9)return _0xf0c7b0(_0x4d34b9);return _0x579307(_0x4b5cf7);});})[_0xca1e('0x2d')](function(){return new BPromise(function(_0x4c6e58,_0x57cf42){rimraf(_0x211d93,function(_0x43aee2){if(_0x43aee2)_0x57cf42(_0x43aee2);return _0x4c6e58();});});})[_0xca1e('0x2d')](function(){return _0x30fb6a[_0xca1e('0xd2')](_0x42ea21,_0x38c6a9,function(_0x4ff266){if(_0x4ff266){console[_0xca1e('0xf2')]('err',_0x4ff266);}else{fs['unlinkSync'](_0x42ea21);}});});});}else{return _0x30fb6a['sendStatus'](0xc8);}})[_0xca1e('0x40')](handleError(_0x30fb6a,null));}; \ No newline at end of file +var _0x8ca8=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','render','merge','body','message','agent','interaction','Users','fullname','TagIds','Tags','push','index','map','SmsInteraction','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','from','u.id','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','type','start','some','isEmpty','SmsAccountId','concat','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','all','params','rawAttributes','include','options','create','catch','describe','addMessage','SmsMessage','ids','getMessages','findOne','pick','SmsInteractionId','filter','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','spread','color','emit','smsInteractionTags:save','download','unix','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','CmContact','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','closedAt','disposition','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','squel','crypto','desk.js','querystring','papaparse'];(function(_0x18c1ac,_0x55c644){var _0x48419d=function(_0x503793){while(--_0x503793){_0x18c1ac['push'](_0x18c1ac['shift']());}};_0x48419d(++_0x55c644);}(_0x8ca8,0xd4));var _0x88ca=function(_0x895e1,_0x3eace2){_0x895e1=_0x895e1-0x0;var _0x230754=_0x8ca8[_0x895e1];return _0x230754;};'use strict';var emlformat=require(_0x88ca('0x0'));var rimraf=require(_0x88ca('0x1'));var zipdir=require(_0x88ca('0x2'));var jsonpatch=require(_0x88ca('0x3'));var rp=require(_0x88ca('0x4'));var moment=require(_0x88ca('0x5'));var BPromise=require(_0x88ca('0x6'));var Mustache=require('mustache');var util=require(_0x88ca('0x7'));var path=require(_0x88ca('0x8'));var sox=require(_0x88ca('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x88ca('0xa'));var crypto=require(_0x88ca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x88ca('0xc'));var toCsv=require('to-csv');var querystring=require(_0x88ca('0xd'));var Papa=require(_0x88ca('0xe'));var Redis=require(_0x88ca('0xf'));var authService=require(_0x88ca('0x10'));var qs=require(_0x88ca('0x11'));var as=require(_0x88ca('0x12'));var pdf=require(_0x88ca('0x13'));var hardwareService=require(_0x88ca('0x14'));var logger=require(_0x88ca('0x15'))('api');var utils=require(_0x88ca('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x88ca('0x17'));var db=require(_0x88ca('0x18'))['db'];config[_0x88ca('0x19')]=_['defaults'](config['redis'],{'host':_0x88ca('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88ca('0x19')]));require(_0x88ca('0x1b'))[_0x88ca('0x1c')](socket);function respondWithStatusCode(_0x393a6e,_0x4ea170){_0x4ea170=_0x4ea170||0xcc;return function(_0x214eb0){if(_0x214eb0){return _0x393a6e[_0x88ca('0x1d')](_0x4ea170);}return _0x393a6e[_0x88ca('0x1e')](_0x4ea170)[_0x88ca('0x1f')]();};}function respondWithResult(_0x1e87e9,_0x1d7358){_0x1d7358=_0x1d7358||0xc8;return function(_0x3cdcbe){if(_0x3cdcbe){return _0x1e87e9['status'](_0x1d7358)[_0x88ca('0x20')](_0x3cdcbe);}};}function respondWithFilteredResult(_0x47628f,_0x5e4895){return function(_0xd02b9){if(_0xd02b9){var _0x5d9ec3=typeof _0x5e4895['offset']===_0x88ca('0x21')&&typeof _0x5e4895['limit']===_0x88ca('0x21');var _0x43667c=_0xd02b9[_0x88ca('0x22')];var _0x15ae3c=_0x5d9ec3?0x0:_0x5e4895[_0x88ca('0x23')];var _0x2fad00=_0x5d9ec3?_0xd02b9[_0x88ca('0x22')]:_0x5e4895[_0x88ca('0x23')]+_0x5e4895[_0x88ca('0x24')];var _0x139c54;if(_0x2fad00>=_0x43667c){_0x2fad00=_0x43667c;_0x139c54=0xc8;}else{_0x139c54=0xce;}_0x47628f[_0x88ca('0x1e')](_0x139c54);return _0x47628f[_0x88ca('0x25')](_0x88ca('0x26'),_0x15ae3c+'-'+_0x2fad00+'/'+_0x43667c)['json'](_0xd02b9);}return null;};}function patchUpdates(_0x2a0710){return function(_0x4f3ccd){try{jsonpatch[_0x88ca('0x27')](_0x4f3ccd,_0x2a0710,!![]);}catch(_0x35c55d){return BPromise[_0x88ca('0x28')](_0x35c55d);}return _0x4f3ccd[_0x88ca('0x29')]();};}function saveUpdates(_0x3dd7a4,_0x664b41){return function(_0x2309b9){if(_0x2309b9){return _0x2309b9[_0x88ca('0x2a')](_0x3dd7a4)[_0x88ca('0x2b')](function(_0xe0113c){return _0xe0113c;});}return null;};}function removeEntity(_0x664efb,_0x4c630e){return function(_0x27ab18){if(_0x27ab18){return _0x27ab18[_0x88ca('0x2c')]()['then'](function(){_0x664efb[_0x88ca('0x1e')](0xcc)[_0x88ca('0x1f')]();});}};}function handleEntityNotFound(_0x2212dc,_0x3c238c){return function(_0x2fb0dd){if(!_0x2fb0dd){_0x2212dc[_0x88ca('0x1d')](0x194);}return _0x2fb0dd;};}function handleError(_0x4894bf,_0x418e18){_0x418e18=_0x418e18||0x1f4;return function(_0x58ae86){logger['error'](_0x58ae86[_0x88ca('0x2d')]);if(_0x58ae86[_0x88ca('0x2e')]){delete _0x58ae86[_0x88ca('0x2e')];}_0x4894bf[_0x88ca('0x1e')](_0x418e18)['send'](_0x58ae86);};}function getMustacheRender(_0x3dab6b,_0x1fe1ee){return Mustache[_0x88ca('0x2f')](_0x3dab6b,_[_0x88ca('0x30')](_0x1fe1ee[_0x88ca('0x31')],{'contact':_0x1fe1ee['contact'],'message':_0x1fe1ee[_0x88ca('0x32')],'agent':_0x1fe1ee[_0x88ca('0x33')],'interaction':_0x1fe1ee[_0x88ca('0x34')],'account':_0x1fe1ee['account']}))||'';}function getInteractionUsers(_0x219564,_0x5b87e3){return new BPromise(function(_0x36742e,_0x3882b8){try{if(_0x5b87e3[_0x219564['id']]){_0x219564[_0x88ca('0x35')]=_['map'](_0x5b87e3[_0x219564['id']],function(_0x569311){return{'id':_0x569311['id'],'fullname':_0x569311[_0x88ca('0x36')]};});}}catch(_0x133df4){_0x3882b8(_0x133df4);}_0x36742e(_0x219564);});}function getInteractionTags(_0xec4b9,_0x58ab46){return new BPromise(function(_0x196850,_0x397ecf){try{if(_0xec4b9[_0x88ca('0x37')]){_0xec4b9['Tags']=[];_0xec4b9[_0x88ca('0x37')]['split'](',')['forEach'](function(_0x4df3bd){_0xec4b9[_0x88ca('0x38')][_0x88ca('0x39')](_0x58ab46[_0x4df3bd]);});}delete _0xec4b9['TagIds'];}catch(_0x5536a0){_0x397ecf(_0x5536a0);}_0x196850(_0xec4b9);});}function updateSmsInteraction(_0x78dce6,_0x4f0b02,_0x37791b){return new BPromise(function(_0x36b8b7,_0x1923f0){return getInteractionUsers(_0x78dce6,_0x37791b)['then'](function(_0x409c1e){return getInteractionTags(_0x409c1e,_0x4f0b02);})[_0x88ca('0x2b')](function(_0x26a395){_0x36b8b7(_0x26a395);})['catch'](function(_0x49a533){_0x1923f0(_0x49a533);});});}exports[_0x88ca('0x3a')]=function(_0x90e95f,_0x3f2e28){var _0x5f549c={},_0xd26fe5={},_0x23ac9c={'count':0x0,'rows':[]};var _0x328ad8=_[_0x88ca('0x3b')](db[_0x88ca('0x3c')]['rawAttributes'],function(_0x314636){return{'name':_0x314636[_0x88ca('0x3d')],'type':_0x314636['type'][_0x88ca('0x3e')]};});_0xd26fe5[_0x88ca('0x3f')]=_[_0x88ca('0x3b')](_0x328ad8,'name');_0xd26fe5[_0x88ca('0x40')]=_[_0x88ca('0x41')](_0x90e95f[_0x88ca('0x40')]);_0xd26fe5['filters']=_[_0x88ca('0x42')](_0xd26fe5['model'],_0xd26fe5[_0x88ca('0x40')]);_0x5f549c[_0x88ca('0x43')]=_[_0x88ca('0x42')](_0xd26fe5['model'],qs[_0x88ca('0x44')](_0x90e95f[_0x88ca('0x40')]['fields']));_0x5f549c[_0x88ca('0x43')]=_0x5f549c[_0x88ca('0x43')][_0x88ca('0x45')]?_0x5f549c[_0x88ca('0x43')]:_0xd26fe5['model'];if(!_0x90e95f[_0x88ca('0x40')][_0x88ca('0x46')](_0x88ca('0x47'))){_0x5f549c[_0x88ca('0x24')]=qs[_0x88ca('0x24')](_0x90e95f['query']['limit']);_0x5f549c[_0x88ca('0x23')]=qs[_0x88ca('0x23')](_0x90e95f['query']['offset']);}_0x5f549c[_0x88ca('0x48')]=qs[_0x88ca('0x49')](_0x90e95f[_0x88ca('0x40')][_0x88ca('0x49')]);_0x5f549c[_0x88ca('0x4a')]=qs['filters'](_['pick'](_0x90e95f[_0x88ca('0x40')],_0xd26fe5[_0x88ca('0x4b')]),_0x328ad8);var _0x5c6d9f=[];var _0x219407=squel[_0x88ca('0x4c')]()['field']('id')[_0x88ca('0x4d')](_0x88ca('0x2e'))[_0x88ca('0x4d')]('color')[_0x88ca('0x4e')]('tools_tags');var _0x1d16e1=squel[_0x88ca('0x4c')]()[_0x88ca('0x4d')](_0x88ca('0x4f'))[_0x88ca('0x4d')]('u.fullname')['field']('ui.SmsInteractionId')[_0x88ca('0x4e')](_0x88ca('0x50'),'ui')[_0x88ca('0x51')]('users','u',_0x88ca('0x52'));var _0x2228f5=squel[_0x88ca('0x4c')]()[_0x88ca('0x4e')](_0x88ca('0x53'),'i')['left_join'](_0x88ca('0x54'),'c',_0x88ca('0x55'))[_0x88ca('0x51')](_0x88ca('0x56'),'o','o.id\x20=\x20i.UserId')[_0x88ca('0x51')](_0x88ca('0x57'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x88ca('0x58'),'me',_0x88ca('0x59'))['left_join'](_0x88ca('0x5a'),'it',_0x88ca('0x5b'))['left_join'](_0x88ca('0x5c'),'t',_0x88ca('0x5d'));var _0x33fb45=squel[_0x88ca('0x5e')]();var _0x193f48=[];var _0x53fcd9=squel[_0x88ca('0x5e')]();var _0x3dafe5;if(_0x90e95f[_0x88ca('0x40')][_0x88ca('0x5f')]){_0x3dafe5=as['parseSearch'](_0x90e95f[_0x88ca('0x40')]['search']);var _0x5068f3=_0x3dafe5[_0x88ca('0x60')];for(var _0x45bd74=0x0;_0x45bd74<_0x3dafe5['conditions'][_0x88ca('0x45')];_0x45bd74++){var _0x1fbf5d=_0x3dafe5['conditions'][_0x45bd74];var _0x3c4b41='i';var _0x2b807a=_['find'](_0x328ad8,[_0x88ca('0x2e'),_0x1fbf5d[_0x88ca('0x4d')]]);if(!_0x2b807a){switch(_0x1fbf5d['field']){case _0x88ca('0x61'):if(_0x1fbf5d['value']==0x1){_0x2228f5[_0x88ca('0x62')]('`'+_0x1fbf5d[_0x88ca('0x4d')]+_0x88ca('0x63'));}else{_0x2228f5[_0x88ca('0x62')]('`'+_0x1fbf5d[_0x88ca('0x4d')]+'`\x20>\x200');}break;case _0x88ca('0x64'):if(_0x1fbf5d[_0x88ca('0x65')]===_0x88ca('0x66')){if(_0x1fbf5d['value']['split']('\x20')[_0x88ca('0x45')]>0x1){_0x33fb45[_0x5068f3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x88ca('0x67')](_0x1fbf5d[_0x88ca('0x68')]),null);}else{var _0x8fe8f6='%'+_0x1fbf5d[_0x88ca('0x68')]+'%';_0x33fb45[_0x5068f3](_0x88ca('0x69'),_0x8fe8f6,_0x8fe8f6,_0x8fe8f6);}}else{_0x2b807a=_[_0x88ca('0x6a')](_0x328ad8,['name',_0x88ca('0x6b')]);_0x1fbf5d[_0x88ca('0x4d')]='ContactId';_0x40a79d=as[_0x88ca('0x6c')](_0x3c4b41,_0x2b807a['type'],_0x1fbf5d);_0x33fb45[_0x5068f3](_0x40a79d[_0x88ca('0x6d')],_0x40a79d[_0x88ca('0x68')]['start'],_0x40a79d[_0x88ca('0x68')][_0x88ca('0x1f')]);}break;case'Tag':var _0x12a7c6=_0x1fbf5d['value']['split'](',')[_0x88ca('0x3b')](function(_0x2666aa){return Number(_0x2666aa);});_0x12a7c6[_0x88ca('0x6e')](function(_0x241400){_0x53fcd9['or'](_0x88ca('0x6f'),'%,'+_0x241400+',%');});_0x193f48=_['union'](_0x193f48,_0x12a7c6);break;case _0x88ca('0x70'):if(_0x1fbf5d[_0x88ca('0x65')]===_0x88ca('0x66')){_0x33fb45[_0x5068f3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1fbf5d[_0x88ca('0x68')]+'%',null);}else{_0x2b807a=_[_0x88ca('0x6a')](_0x328ad8,[_0x88ca('0x2e'),_0x88ca('0x71')]);_0x1fbf5d[_0x88ca('0x4d')]=_0x88ca('0x71');_0x40a79d=as['buildExpression'](_0x3c4b41,_0x2b807a[_0x88ca('0x72')],_0x1fbf5d);_0x33fb45[_0x5068f3](_0x40a79d[_0x88ca('0x6d')],_0x40a79d[_0x88ca('0x68')][_0x88ca('0x73')],_0x40a79d[_0x88ca('0x68')][_0x88ca('0x1f')]);}break;case'body':_0x40a79d=as[_0x88ca('0x6c')]('me',null,_0x1fbf5d);_0x33fb45[_0x5068f3](_0x40a79d[_0x88ca('0x6d')],_0x40a79d['value'][_0x88ca('0x73')],_0x40a79d[_0x88ca('0x68')]['end']);break;}}else{var _0x40a79d=as['buildExpression'](_0x3c4b41,_0x2b807a[_0x88ca('0x72')],_0x1fbf5d);_0x33fb45[_0x5068f3](_0x40a79d[_0x88ca('0x6d')],_0x40a79d[_0x88ca('0x68')][_0x88ca('0x73')],_0x40a79d[_0x88ca('0x68')][_0x88ca('0x1f')]);}}}else{var _0x1bcda1=_(_0x90e95f[_0x88ca('0x40')])[_0x88ca('0x41')]()[_0x88ca('0x3b')](function(_0x3adba8){return _[_0x88ca('0x74')](_0x328ad8,[_0x88ca('0x2e'),_0x3adba8])?_0x3adba8:undefined;})['compact']()[_0x88ca('0x68')]();if(!_[_0x88ca('0x75')](_0x1bcda1)){_0x1bcda1['forEach'](function(_0x104157){if(_0x104157===_0x88ca('0x76')){_0x2228f5[_0x88ca('0x4a')]('i.SmsAccountId\x20IN\x20?',[][_0x88ca('0x77')](_0x90e95f['query'][_0x104157]));}else if(_0x104157==='createdAt'){var _0x1cb808=JSON['parse'](_0x90e95f[_0x88ca('0x40')][_0x104157])[_0x88ca('0x78')];var _0x46d381=JSON['parse'](_0x90e95f[_0x88ca('0x40')][_0x104157])[_0x88ca('0x79')];_0x2228f5[_0x88ca('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1cb808,_0x46d381);}else{if(_0x90e95f['query'][_0x104157]===_0x88ca('0x7a')){_0x2228f5[_0x88ca('0x4a')]('i.'+_0x104157+_0x88ca('0x7b'));}else{_0x2228f5[_0x88ca('0x4a')]('i.'+_0x104157+_0x88ca('0x7c'),_0x90e95f[_0x88ca('0x40')][_0x104157]);}}});}if(_0x90e95f[_0x88ca('0x40')][_0x88ca('0x7d')]){if(_0x90e95f[_0x88ca('0x40')][_0x88ca('0x7d')]==0x1){_0x2228f5[_0x88ca('0x62')]('`unreadMessages`\x20=\x200');}else{_0x2228f5[_0x88ca('0x62')](_0x88ca('0x7e'));}}if(_0x90e95f[_0x88ca('0x40')][_0x88ca('0x7f')]){_0x193f48=_[_0x88ca('0x80')](_0x90e95f[_0x88ca('0x40')]['tag'])?_0x90e95f['query'][_0x88ca('0x7f')]:new Array(_0x90e95f[_0x88ca('0x40')][_0x88ca('0x7f')]);_0x193f48[_0x88ca('0x6e')](function(_0x4e58e8){_0x53fcd9['or'](_0x88ca('0x6f'),'%,'+_0x4e58e8+',%');});}if(_0x90e95f[_0x88ca('0x40')]['filter']){var _0x11a232=_0x90e95f['query']['filter'][_0x88ca('0x81')]('\x5c','\x5c\x5c')[_0x88ca('0x81')](/'/g,'\x27\x27');if(qs[_0x88ca('0x82')](_0x11a232)){_0x33fb45['or'](_0x88ca('0x83'),_0x11a232+'%')['or'](_0x88ca('0x84'),_0x11a232+'%');}else{_0x33fb45['or'](_0x88ca('0x85'),qs[_0x88ca('0x67')](_0x11a232))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x11a232+'%');}}}_0x2228f5[_0x88ca('0x4a')](_0x33fb45);_0x2228f5['group']('i.id');var _0x2e9f3f={'type':db['Sequelize'][_0x88ca('0x86')][_0x88ca('0x87')],'raw':!![]};var _0x65245d=_0x2228f5[_0x88ca('0x88')]();_0x65245d[_0x88ca('0x4d')](_0x88ca('0x89'));_0x65245d[_0x88ca('0x4d')](_0x88ca('0x8a'),_0x88ca('0x61'));if(_0x5f549c[_0x88ca('0x48')]){_0x5f549c[_0x88ca('0x48')][_0x88ca('0x6e')](function(_0x586ca5){var _0x3033cf=_0x586ca5[0x0]===_0x88ca('0x8b')?_0x586ca5[0x0]:'i.'+_0x586ca5[0x0];_0x2228f5[_0x88ca('0x48')](_0x3033cf,_0x586ca5[0x1]==='DESC'?![]:!![]);});}if(!_[_0x88ca('0x75')](_0x193f48)){_0x2228f5[_0x88ca('0x62')](_0x53fcd9);_0x65245d[_0x88ca('0x4a')](_0x88ca('0x8c'),_0x193f48);}BPromise[_0x88ca('0x8d')]()[_0x88ca('0x2b')](function(){if(!_0x3dafe5){if(_0x90e95f['query'][_0x88ca('0x76')])return;_0x65245d['where'](_0x88ca('0x8e'));_0x2228f5['where'](_0x88ca('0x8e'));return;}if(_0x90e95f[_0x88ca('0x8f')][_0x88ca('0x90')]!==_0x88ca('0x33'))return;return _0x90e95f[_0x88ca('0x8f')][_0x88ca('0x91')]({'attributes':['id'],'raw':!![]})[_0x88ca('0x2b')](function(_0x4092f8){if(_[_0x88ca('0x75')](_0x4092f8)){_0x65245d[_0x88ca('0x4a')](_0x88ca('0x92'));_0x2228f5[_0x88ca('0x4a')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x65245d['where']('i.SmsAccountId\x20IN\x20?',_[_0x88ca('0x3b')](_0x4092f8,'id'));_0x2228f5[_0x88ca('0x4a')](_0x88ca('0x93'),_[_0x88ca('0x3b')](_0x4092f8,'id'));}});})[_0x88ca('0x2b')](function(){if(_0x90e95f[_0x88ca('0x8f')][_0x88ca('0x90')]===_0x88ca('0x33')&&!_0x3dafe5&&!_0x90e95f[_0x88ca('0x40')][_0x88ca('0x76')])return[];return db[_0x88ca('0x94')][_0x88ca('0x40')](_0x65245d[_0x88ca('0x95')](),_0x2e9f3f);})[_0x88ca('0x2b')](function(_0x4df04b){_0x23ac9c[_0x88ca('0x22')]=_0x4df04b['length'];if(_0x23ac9c[_0x88ca('0x22')]===0x0)return[];return db[_0x88ca('0x94')][_0x88ca('0x40')](_0x219407[_0x88ca('0x95')](),_0x2e9f3f)[_0x88ca('0x2b')](function(_0x1e3e34){_0x5c6d9f=_[_0x88ca('0x96')](_0x1e3e34,'id');_0x2e9f3f=_['merge'](_0x2e9f3f,{'model':db[_0x88ca('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x90e95f[_0x88ca('0x40')][_0x88ca('0x44')]){_0x5f549c[_0x88ca('0x43')][_0x88ca('0x6e')](function(_0x18f2f5){_0x2228f5[_0x88ca('0x4d')]('i.'+_0x18f2f5);});}else{_0x2228f5[_0x88ca('0x4d')](_0x88ca('0x8a'),'unreadMessages');_0x2228f5[_0x88ca('0x4d')](_0x88ca('0x97'),_0x88ca('0x98'));_0x2228f5[_0x88ca('0x4d')](_0x88ca('0x99'),_0x88ca('0x9a'));_0x2228f5[_0x88ca('0x4d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x88ca('0x8b'));_0x2228f5[_0x88ca('0x4d')]('i.*');_0x2228f5[_0x88ca('0x4d')]('c.firstName','Contact.firstName');_0x2228f5[_0x88ca('0x4d')](_0x88ca('0x9b'),_0x88ca('0x9c'));_0x2228f5[_0x88ca('0x4d')](_0x88ca('0x9d'),'Contact.email');_0x2228f5[_0x88ca('0x4d')](_0x88ca('0x9e'),_0x88ca('0x9f'));_0x2228f5[_0x88ca('0x4d')](_0x88ca('0xa0'),'Contact.mobile');_0x2228f5[_0x88ca('0x4d')](_0x88ca('0xa1'),_0x88ca('0xa2'));_0x2228f5[_0x88ca('0x4d')](_0x88ca('0xa3'),'Owner.fullname');_0x2228f5[_0x88ca('0x4d')](_0x88ca('0xa4'),'Owner.internal');_0x2228f5[_0x88ca('0x4d')](_0x88ca('0xa5'),'TagIds');}if(_0x5f549c[_0x88ca('0x24')])_0x2228f5[_0x88ca('0x24')](_0x5f549c['limit']);if(_0x5f549c['offset'])_0x2228f5[_0x88ca('0x23')](_0x5f549c[_0x88ca('0x23')]);return db['sequelize']['query'](_0x2228f5['toString'](),_0x2e9f3f);})['then'](function(_0x188e35){if(_0x188e35[_0x88ca('0x45')]>0x0)_0x1d16e1[_0x88ca('0x4a')](_0x88ca('0xa6'),_[_0x88ca('0x3b')](_0x188e35,'id'));return db[_0x88ca('0x94')][_0x88ca('0x40')](_0x1d16e1[_0x88ca('0x95')](),_0x2e9f3f)[_0x88ca('0x2b')](function(_0x3ac79c){var _0x42adad=_['groupBy'](_0x3ac79c,'SmsInteractionId');var _0x4f703e=[];_0x188e35[_0x88ca('0x6e')](function(_0x55fe53){_0x4f703e[_0x88ca('0x39')](updateSmsInteraction(_0x55fe53,_0x5c6d9f,_0x42adad));});return BPromise[_0x88ca('0xa7')](_0x4f703e);});});})['then'](function(_0x55b551){_0x23ac9c['rows']=_0x55b551;return _0x23ac9c;})[_0x88ca('0x2b')](respondWithFilteredResult(_0x3f2e28,_0x5f549c))['catch'](handleError(_0x3f2e28,null));};exports['show']=function(_0x2ac1cf,_0x255ce6){var _0x50c8d7={'raw':![],'where':{'id':_0x2ac1cf[_0x88ca('0xa8')]['id']}},_0x221e05={};_0x221e05[_0x88ca('0x3f')]=_['keys'](db[_0x88ca('0x3c')][_0x88ca('0xa9')]);_0x221e05[_0x88ca('0x40')]=_[_0x88ca('0x41')](_0x2ac1cf[_0x88ca('0x40')]);_0x221e05['filters']=_[_0x88ca('0x42')](_0x221e05['model'],_0x221e05[_0x88ca('0x40')]);_0x50c8d7[_0x88ca('0x43')]=_[_0x88ca('0x42')](_0x221e05['model'],qs['fields'](_0x2ac1cf[_0x88ca('0x40')]['fields']));_0x50c8d7['attributes']=_0x50c8d7['attributes']['length']?_0x50c8d7[_0x88ca('0x43')]:_0x221e05[_0x88ca('0x3f')];if(_0x2ac1cf[_0x88ca('0x40')]['includeAll']){_0x50c8d7[_0x88ca('0xaa')]=[{'all':!![]}];}_0x50c8d7=_[_0x88ca('0x30')]({},_0x50c8d7,_0x2ac1cf[_0x88ca('0xab')]);return db[_0x88ca('0x3c')][_0x88ca('0x6a')](_0x50c8d7)[_0x88ca('0x2b')](handleEntityNotFound(_0x255ce6,null))[_0x88ca('0x2b')](respondWithResult(_0x255ce6,null))['catch'](handleError(_0x255ce6,null));};exports[_0x88ca('0xac')]=function(_0x32f53d,_0x3daa1b){return db[_0x88ca('0x3c')][_0x88ca('0xac')](_0x32f53d[_0x88ca('0x31')],{})['then'](respondWithResult(_0x3daa1b,0xc9))['catch'](handleError(_0x3daa1b,null));};exports[_0x88ca('0x2a')]=function(_0x147d97,_0x435310){if(_0x147d97['body']['id']){delete _0x147d97[_0x88ca('0x31')]['id'];}return db['SmsInteraction'][_0x88ca('0x6a')]({'where':{'id':_0x147d97[_0x88ca('0xa8')]['id']}})[_0x88ca('0x2b')](handleEntityNotFound(_0x435310,null))[_0x88ca('0x2b')](saveUpdates(_0x147d97[_0x88ca('0x31')],null))[_0x88ca('0x2b')](respondWithResult(_0x435310,null))[_0x88ca('0xad')](handleError(_0x435310,null));};exports[_0x88ca('0x2c')]=function(_0xdddcf2,_0x312a1c){return db[_0x88ca('0x3c')][_0x88ca('0x6a')]({'where':{'id':_0xdddcf2['params']['id']}})['then'](handleEntityNotFound(_0x312a1c,null))[_0x88ca('0x2b')](removeEntity(_0x312a1c,null))[_0x88ca('0xad')](handleError(_0x312a1c,null));};exports[_0x88ca('0xae')]=function(_0x16763e,_0x257db6){return db[_0x88ca('0x3c')][_0x88ca('0xae')]()['then'](respondWithResult(_0x257db6,null))['catch'](handleError(_0x257db6,null));};exports[_0x88ca('0xaf')]=function(_0x5945ec,_0x5a1a51,_0x17e070){return db[_0x88ca('0xb0')][_0x88ca('0x6a')]({'where':{'id':_0x5945ec[_0x88ca('0xa8')]['id']}})[_0x88ca('0x2b')](handleEntityNotFound(_0x5a1a51,null))['then'](function(_0x237444){if(_0x237444){return _0x237444['addMessage'](_0x5945ec['body'][_0x88ca('0xb1')],_['omit'](_0x5945ec[_0x88ca('0x31')],[_0x88ca('0xb1'),'id'])||{});}})[_0x88ca('0x2b')](respondWithResult(_0x5a1a51,null))[_0x88ca('0xad')](handleError(_0x5a1a51,null));};exports[_0x88ca('0xb2')]=function(_0x184792,_0x575e44,_0x3c0975){var _0x18d80c={'raw':![],'where':{}};var _0x3da3c7={};var _0x328726={'count':0x0,'rows':[]};return db[_0x88ca('0x3c')][_0x88ca('0xb3')]({'where':{'id':_0x184792[_0x88ca('0xa8')]['id']}})[_0x88ca('0x2b')](handleEntityNotFound(_0x575e44,null))['then'](function(_0x1ccf7c){if(_0x1ccf7c){_0x3da3c7[_0x88ca('0x3f')]=_[_0x88ca('0x41')](db[_0x88ca('0xb0')][_0x88ca('0xa9')]);_0x3da3c7[_0x88ca('0x40')]=_['keys'](_0x184792[_0x88ca('0x40')]);_0x3da3c7['filters']=_['intersection'](_0x3da3c7[_0x88ca('0x3f')],_0x3da3c7[_0x88ca('0x40')]);_0x18d80c[_0x88ca('0x43')]=_[_0x88ca('0x42')](_0x3da3c7[_0x88ca('0x3f')],qs[_0x88ca('0x44')](_0x184792[_0x88ca('0x40')][_0x88ca('0x44')]));_0x18d80c[_0x88ca('0x43')]=_0x18d80c[_0x88ca('0x43')][_0x88ca('0x45')]?_0x18d80c['attributes']:_0x3da3c7[_0x88ca('0x3f')];if(!_0x184792[_0x88ca('0x40')][_0x88ca('0x46')](_0x88ca('0x47'))){_0x18d80c[_0x88ca('0x24')]=qs[_0x88ca('0x24')](_0x184792[_0x88ca('0x40')][_0x88ca('0x24')]);_0x18d80c[_0x88ca('0x23')]=qs[_0x88ca('0x23')](_0x184792[_0x88ca('0x40')][_0x88ca('0x23')]);}_0x18d80c[_0x88ca('0x48')]=qs['sort'](_0x184792[_0x88ca('0x40')][_0x88ca('0x49')]);_0x18d80c['where']=qs['filters'](_[_0x88ca('0xb4')](_0x184792[_0x88ca('0x40')],_0x3da3c7[_0x88ca('0x4b')]));_0x18d80c[_0x88ca('0x4a')][_0x88ca('0xb5')]=_0x1ccf7c['id'];if(_0x184792[_0x88ca('0x40')][_0x88ca('0xb6')]){_0x18d80c[_0x88ca('0x4a')]=_[_0x88ca('0x30')](_0x18d80c[_0x88ca('0x4a')],{'$or':_['map'](_0x18d80c[_0x88ca('0x43')],function(_0x280a03){var _0x14faa2={};_0x14faa2[_0x280a03]={'$like':'%'+_0x184792['query'][_0x88ca('0xb6')]+'%'};return _0x14faa2;})});}if(_0x184792['query']['$gte']){var _0x4a3d06=_0x184792['query'][_0x88ca('0x78')][_0x88ca('0xb7')](',');var _0x453b1b={};_0x453b1b[_0x4a3d06[0x0]]={'$gte':moment(_0x4a3d06[0x1])['format'](_0x88ca('0xb8'))};_0x18d80c[_0x88ca('0x4a')]=_[_0x88ca('0x30')](_0x18d80c[_0x88ca('0x4a')],_0x453b1b);}_0x18d80c=_[_0x88ca('0x30')]({},_0x18d80c,_0x184792[_0x88ca('0xab')]);return db[_0x88ca('0xb0')][_0x88ca('0x22')]({'where':_0x18d80c['where']})['then'](function(_0x3b5244){_0x328726[_0x88ca('0x22')]=_0x3b5244;if(_0x184792['query'][_0x88ca('0xb9')]){_0x18d80c[_0x88ca('0xaa')]=[{'all':!![]}];}return db[_0x88ca('0xb0')][_0x88ca('0xba')](_0x18d80c);})[_0x88ca('0x2b')](function(_0x27db49){_0x328726[_0x88ca('0xbb')]=_0x27db49;return _0x328726;});}})[_0x88ca('0x2b')](respondWithFilteredResult(_0x575e44,_0x18d80c))[_0x88ca('0xad')](handleError(_0x575e44,null));};exports[_0x88ca('0xbc')]=function(_0x35c295,_0x3e0e79,_0x58abdd){return db[_0x88ca('0x3c')]['find']({'where':{'id':_0x35c295[_0x88ca('0xa8')]['id']}})[_0x88ca('0x2b')](handleEntityNotFound(_0x3e0e79,null))[_0x88ca('0x2b')](function(_0x569178){if(_0x569178){return _0x569178['setTags'](_0x35c295[_0x88ca('0x31')]['ids'],_['omit'](_0x35c295[_0x88ca('0x31')],[_0x88ca('0xb1'),'id'])||{})[_0x88ca('0xbd')](function(){return db['Tag']['findAll']({'attributes':['id',_0x88ca('0x2e'),_0x88ca('0xbe')],'where':{'id':_0x35c295[_0x88ca('0x31')]['ids']}});})[_0x88ca('0x2b')](function(_0x42d0dc){socket[_0x88ca('0xbf')](_0x88ca('0xc0'),{'id':Number(_0x35c295[_0x88ca('0xa8')]['id']),'tags':_0x42d0dc||[]});return{'id':Number(_0x35c295['params']['id']),'tags':_0x42d0dc||[]};});}})[_0x88ca('0x2b')](respondWithResult(_0x3e0e79,null))[_0x88ca('0xad')](handleError(_0x3e0e79,null));};exports['removeTags']=function(_0x43a908,_0x4947c8,_0x258cd1){return db['SmsInteraction'][_0x88ca('0x6a')]({'where':{'id':_0x43a908[_0x88ca('0xa8')]['id']}})[_0x88ca('0x2b')](handleEntityNotFound(_0x4947c8,null))['then'](function(_0x2b5041){if(_0x2b5041){return _0x2b5041['removeTags'](_0x43a908[_0x88ca('0x40')]['ids']);}})[_0x88ca('0x2b')](respondWithStatusCode(_0x4947c8,null))[_0x88ca('0xad')](handleError(_0x4947c8,null));};exports[_0x88ca('0xc1')]=function(_0x571ca8,_0x2a21e4){var _0x590d52=moment()[_0x88ca('0xc2')]()['toString']();var _0x37995d=path[_0x88ca('0xc3')](config['root'],_0x88ca('0xc4'),_0x88ca('0xc5'),_0x88ca('0xc6'));var _0x57d495=path['join'](config[_0x88ca('0xc7')],_0x88ca('0xc4'),'files',_0x88ca('0xc8'));var _0x30f34b=path['join'](_0x37995d,_0x590d52);var _0x2ced66=util[_0x88ca('0xc9')](_0x88ca('0xca'),_0x571ca8[_0x88ca('0xa8')]['id'],_0x590d52);var _0x46466e=path[_0x88ca('0xc3')](_0x37995d,_0x2ced66);var _0x3820c5=[];_0x3820c5[_0x88ca('0x39')]({'model':db[_0x88ca('0x70')],'as':'User','attributes':['id',_0x88ca('0x36')],'raw':!![]});_0x3820c5[_0x88ca('0x39')]({'model':db[_0x88ca('0xcb')],'as':_0x88ca('0x64'),'attributes':['id','firstName',_0x88ca('0xcc')],'raw':!![]});var _0x85dd41=[{'model':db[_0x88ca('0xb0')],'as':_0x88ca('0xcd'),'attributes':['id',_0x88ca('0x31'),_0x88ca('0xce'),_0x88ca('0xcf'),_0x88ca('0xd0'),_0x88ca('0x7d')],'include':_0x3820c5}];_0x85dd41[_0x88ca('0x39')]({'model':db[_0x88ca('0xd1')],'as':_0x88ca('0xd2'),'attributes':['id',_0x88ca('0x2e')]});_0x85dd41[_0x88ca('0x39')]({'model':db[_0x88ca('0x70')],'as':'Owner','attributes':['id',_0x88ca('0x36')]});return db[_0x88ca('0x3c')]['find']({'where':{'id':_0x571ca8['params']['id']},'include':_0x85dd41})['then'](handleEntityNotFound(_0x2a21e4,null))[_0x88ca('0x2b')](function(_0x5661e9){if(_0x5661e9){var _0x58a97e=_0x5661e9[_0x88ca('0xd3')]({'plain':!![]});fs[_0x88ca('0xd4')](_0x30f34b);var _0x59de05={'channel':_0x88ca('0xd5'),'account':_0x58a97e[_0x88ca('0xd2')][_0x88ca('0x2e')],'agent':_0x58a97e[_0x88ca('0xd6')]?_0x58a97e[_0x88ca('0xd6')][_0x88ca('0x36')]:'N.A.','createdAt':moment(_0x58a97e[_0x88ca('0xce')])[_0x88ca('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x88ca('0x95')](),'closedAt':_0x58a97e['closed']?moment(_0x58a97e[_0x88ca('0xd7')])[_0x88ca('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x88ca('0x95')]():'','disposition':_0x58a97e[_0x88ca('0xd8')],'messages':_(_0x58a97e[_0x88ca('0xcd')])['filter']({'secret':![]})['map'](function(_0x195535){return{'date':moment(_0x195535[_0x88ca('0xce')])['format'](_0x88ca('0xb8'))[_0x88ca('0x95')](),'sender':_0x195535['direction']===_0x88ca('0xd9')?_0x195535['User']?_0x195535['User']['fullname']:_0x88ca('0xda'):_0x195535[_0x88ca('0x64')]['firstName']+(_0x195535[_0x88ca('0x64')][_0x88ca('0xcc')]?'\x20'+_0x195535['Contact'][_0x88ca('0xcc')]:''),'body':_0x195535[_0x88ca('0x31')],'direction':_0x195535[_0x88ca('0xcf')]===_0x88ca('0xd9')?'A':'C','secret':_0x195535[_0x88ca('0xd0')],'read':_0x195535[_0x88ca('0x7d')]};})[_0x88ca('0x68')]()};return ejs[_0x88ca('0xdb')](path[_0x88ca('0xc3')](config['root'],_0x88ca('0xc4'),_0x88ca('0xdc'),'downloadInteraction.html'),{'interaction':_0x59de05})['then'](function(_0x31986a){var _0x429540=path[_0x88ca('0xc3')](_0x30f34b,_0x88ca('0xdd')+_0x58a97e['id']+'-'+_0x590d52+_0x88ca('0xde'));var _0x1ebdb8={'path':_0x429540,'channel':_0x88ca('0xd5'),'interactionId':_0x58a97e['id']};return pdf[_0x88ca('0xdf')](_0x31986a,_0x1ebdb8);})['then'](function(){return new BPromise(function(_0x468560,_0x2ec08c){zipdir(_0x30f34b,{'saveTo':_0x46466e},function(_0x3e05b4,_0x5d275f){if(_0x3e05b4)return _0x2ec08c(_0x3e05b4);return _0x468560(_0x5d275f);});})[_0x88ca('0x2b')](function(){return new BPromise(function(_0x507824,_0x193555){rimraf(_0x30f34b,function(_0xaba9f6){if(_0xaba9f6)_0x193555(_0xaba9f6);return _0x507824();});});})['then'](function(){return _0x2a21e4[_0x88ca('0xc1')](_0x46466e,_0x2ced66,function(_0x2037a4){if(_0x2037a4){console[_0x88ca('0xe0')](_0x88ca('0xe1'),_0x2037a4);}else{fs[_0x88ca('0xe2')](_0x46466e);}});});});}else{return _0x2a21e4[_0x88ca('0x1d')](0xc8);}})[_0x88ca('0xad')](handleError(_0x2a21e4,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f3af469..2ddeccf 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b67=['findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','getUsers','then','setDataValue','map'];(function(_0x1d9fbc,_0x6a62f3){var _0x50e7e0=function(_0x4e0c6c){while(--_0x4e0c6c){_0x1d9fbc['push'](_0x1d9fbc['shift']());}};_0x50e7e0(++_0x6a62f3);}(_0x9b67,0xf6));var _0x79b6=function(_0x4d1cc9,_0x1237b3){_0x4d1cc9=_0x4d1cc9-0x0;var _0x34a20f=_0x9b67[_0x4d1cc9];return _0x34a20f;};'use strict';var EventEmitter=require(_0x79b6('0x0'));var SmsInteraction=require(_0x79b6('0x1'))['db'][_0x79b6('0x2')];var SmsMessage=require(_0x79b6('0x1'))['db'][_0x79b6('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x79b6('0x4'),'afterUpdate':_0x79b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4e8794){return function(_0x38479d,_0x174768,_0x258103){_0x38479d[_0x79b6('0x6')]({'attributes':['id'],'raw':!![]})[_0x79b6('0x7')](function(_0x128543){_0x38479d[_0x79b6('0x8')]('Users',_0x128543[_0x79b6('0x9')](function(_0x107e4b){return{'id':_0x107e4b['id']};}));return SmsMessage[_0x79b6('0xa')]({'where':{'SmsInteractionId':_0x38479d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x79b6('0x7')](function(_0x1222a0){_0x38479d['setDataValue'](_0x79b6('0xb'),_0x1222a0[_0x79b6('0xc')]);SmsInteractionEvents[_0x79b6('0xd')](_0x4e8794+':'+_0x38479d['id'],_0x38479d);SmsInteractionEvents[_0x79b6('0xd')](_0x4e8794,_0x38479d);_0x258103(null);})['catch'](_0x258103(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x79b6('0xe')](e,emitEvent(event));}}module[_0x79b6('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xfa2b=['SmsMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','exports','events','../../mysqldb','SmsInteraction'];(function(_0x20488c,_0x412002){var _0x1b48f2=function(_0x10916e){while(--_0x10916e){_0x20488c['push'](_0x20488c['shift']());}};_0x1b48f2(++_0x412002);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x2e7248,_0x1ddffe){_0x2e7248=_0x2e7248-0x0;var _0x3e185a=_0xfa2b[_0x2e7248];return _0x3e185a;};'use strict';var EventEmitter=require(_0xbfa2('0x0'));var SmsInteraction=require(_0xbfa2('0x1'))['db'][_0xbfa2('0x2')];var SmsMessage=require(_0xbfa2('0x1'))['db'][_0xbfa2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xbfa2('0x4')](0x0);var events={'afterCreate':_0xbfa2('0x5'),'afterUpdate':_0xbfa2('0x6'),'afterDestroy':_0xbfa2('0x7')};function emitEvent(_0x43f8d9){return function(_0x425ac5,_0x2e8f3b,_0x12d71e){_0x425ac5[_0xbfa2('0x8')]({'attributes':['id'],'raw':!![]})[_0xbfa2('0x9')](function(_0x26e9bf){_0x425ac5['setDataValue'](_0xbfa2('0xa'),_0x26e9bf['map'](function(_0x329e40){return{'id':_0x329e40['id']};}));return SmsMessage[_0xbfa2('0xb')]({'where':{'SmsInteractionId':_0x425ac5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbfa2('0x9')](function(_0x1b990a){_0x425ac5[_0xbfa2('0xc')](_0xbfa2('0xd'),_0x1b990a[_0xbfa2('0xe')]);SmsInteractionEvents[_0xbfa2('0xf')](_0x43f8d9+':'+_0x425ac5['id'],_0x425ac5);SmsInteractionEvents[_0xbfa2('0xf')](_0x43f8d9,_0x425ac5);_0x12d71e(null);})['catch'](_0x12d71e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xbfa2('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 3401e6d..25288c6 100644 --- a/server/api/smsInteraction/smsInteraction.model.js +++ b/server/api/smsInteraction/smsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b02=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0x6b02,0x1ba));var _0x26b0=function(_0x3cffd3,_0x653937){_0x3cffd3=_0x3cffd3-0x0;var _0x58d92e=_0x6b02[_0x3cffd3];return _0x58d92e;};'use strict';var _=require(_0x26b0('0x0'));var util=require(_0x26b0('0x1'));var logger=require(_0x26b0('0x2'))(_0x26b0('0x3'));var moment=require(_0x26b0('0x4'));var BPromise=require(_0x26b0('0x5'));var rp=require(_0x26b0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x26b0('0x7'));var config=require(_0x26b0('0x8'));var attributes=require(_0x26b0('0x9'));module[_0x26b0('0xa')]=function(_0x2538ec,_0x3698aa){return _0x2538ec[_0x26b0('0xb')](_0x26b0('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x139e13,_0x3cad97,_0x557c4e){if(_0x139e13[_0x26b0('0xd')](_0x26b0('0xe'))){_0x139e13[_0x26b0('0xf')]=moment()[_0x26b0('0x10')](_0x26b0('0x11'));}_0x557c4e(null,_0x139e13);}}});}; \ No newline at end of file +var _0x6446=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x31e069,_0x21af21){var _0x21b9f6=function(_0x30350d){while(--_0x30350d){_0x31e069['push'](_0x31e069['shift']());}};_0x21b9f6(++_0x21af21);}(_0x6446,0x160));var _0x6644=function(_0x389a61,_0x20216c){_0x389a61=_0x389a61-0x0;var _0x1acde9=_0x6446[_0x389a61];return _0x1acde9;};'use strict';var _=require(_0x6644('0x0'));var util=require(_0x6644('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6644('0x2'));var BPromise=require(_0x6644('0x3'));var rp=require(_0x6644('0x4'));var fs=require('fs');var path=require(_0x6644('0x5'));var rimraf=require(_0x6644('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x6644('0x7')]=function(_0x57cb27,_0x5106f4){return _0x57cb27['define'](_0x6644('0x8'),attributes,{'tableName':_0x6644('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x62c9dc,_0x5c2150,_0x30f3bc){if(_0x62c9dc[_0x6644('0xa')](_0x6644('0xb'))){_0x62c9dc[_0x6644('0xc')]=moment()[_0x6644('0xd')](_0x6644('0xe'));}_0x30f3bc(null,_0x62c9dc);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0ebf52c..d12f3ce 100644 --- a/server/api/smsInteraction/smsInteraction.rpc.js +++ b/server/api/smsInteraction/smsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x395f=['limit','AddTagsToSmsInteraction','SmsInteraction','find','where','addTags','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','UpdateSmsInteraction','update','body','options','raw','attributes'];(function(_0x5880b9,_0x36851f){var _0x1ac51c=function(_0x1b9c05){while(--_0x1b9c05){_0x5880b9['push'](_0x5880b9['shift']());}};_0x1ac51c(++_0x36851f);}(_0x395f,0x84));var _0xf395=function(_0x337233,_0xf33f60){_0x337233=_0x337233-0x0;var _0x47b3a2=_0x395f[_0x337233];return _0x47b3a2;};'use strict';var _=require('lodash');var util=require(_0xf395('0x0'));var moment=require('moment');var BPromise=require(_0xf395('0x1'));var rs=require(_0xf395('0x2'));var fs=require('fs');var Redis=require(_0xf395('0x3'));var db=require(_0xf395('0x4'))['db'];var utils=require(_0xf395('0x5'));var logger=require(_0xf395('0x6'))(_0xf395('0x7'));var config=require('../../config/environment');var jayson=require(_0xf395('0x8'));var client=jayson['client'][_0xf395('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf395('0xa')],{'host':_0xf395('0xb'),'port':0x18eb});var socket=require(_0xf395('0xc'))(new Redis(config[_0xf395('0xa')]));require(_0xf395('0xd'))[_0xf395('0xe')](socket);function respondWithRpcPromise(_0x51aefc,_0x499648,_0x67831c){return new BPromise(function(_0x219f2e,_0x47134c){return client[_0xf395('0xf')](_0x51aefc,_0x67831c)[_0xf395('0x10')](function(_0xf9969d){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x499648,_0xf395('0x11'));logger[_0xf395('0x12')](_0xf395('0x13'),_0x499648,_0xf395('0x11'),JSON[_0xf395('0x14')](_0xf9969d));if(_0xf9969d['error']){if(_0xf9969d[_0xf395('0x15')][_0xf395('0x16')]===0x1f4){logger[_0xf395('0x15')](_0xf395('0x17'),_0x499648,_0xf9969d[_0xf395('0x15')][_0xf395('0x18')]);return _0x47134c(_0xf9969d[_0xf395('0x15')][_0xf395('0x18')]);}logger[_0xf395('0x15')](_0xf395('0x17'),_0x499648,_0xf9969d[_0xf395('0x15')][_0xf395('0x18')]);return _0x219f2e(_0xf9969d[_0xf395('0x15')]['message']);}else{logger[_0xf395('0x19')]('SmsInteraction,\x20%s,\x20%s',_0x499648,_0xf395('0x11'));_0x219f2e(_0xf9969d['result'][_0xf395('0x18')]);}})['catch'](function(_0x5d2689){logger[_0xf395('0x15')](_0xf395('0x17'),_0x499648,_0x5d2689);_0x47134c(_0x5d2689);});});}exports[_0xf395('0x1a')]=function(_0x15f84c){var _0x30f0e4=this;return new Promise(function(_0x3a3f62,_0x5193ab){return db['SmsInteraction'][_0xf395('0x1b')](_0x15f84c[_0xf395('0x1c')],{'raw':_0x15f84c['options']?_0x15f84c[_0xf395('0x1d')][_0xf395('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15f84c[_0xf395('0x1d')]?_0x15f84c[_0xf395('0x1d')]['where']||null:null,'attributes':_0x15f84c[_0xf395('0x1d')]?_0x15f84c[_0xf395('0x1d')][_0xf395('0x1f')]||null:null,'limit':_0x15f84c[_0xf395('0x1d')]?_0x15f84c['options'][_0xf395('0x20')]||null:null})[_0xf395('0x10')](function(_0x3b7f4d){logger['info']('UpdateSmsInteraction',_0x15f84c);logger['debug'](_0xf395('0x1a'),_0x15f84c,JSON[_0xf395('0x14')](_0x3b7f4d));_0x3a3f62(_0x3b7f4d);})['catch'](function(_0x2dd24a){logger[_0xf395('0x15')](_0xf395('0x1a'),_0x2dd24a[_0xf395('0x18')],_0x15f84c);_0x5193ab(_0x30f0e4[_0xf395('0x15')](0x1f4,_0x2dd24a['message']));});});};exports[_0xf395('0x21')]=function(_0x3c9420){return new Promise(function(_0x1586af,_0x5ce316){return db[_0xf395('0x22')][_0xf395('0x23')]({'where':_0x3c9420[_0xf395('0x1d')]?_0x3c9420[_0xf395('0x1d')][_0xf395('0x24')]||null:null})[_0xf395('0x10')](function(_0xd017d8){if(_0xd017d8){return _0xd017d8[_0xf395('0x25')](_0x3c9420['body'][_0xf395('0x26')],_['omit'](_0x3c9420[_0xf395('0x1c')],[_0xf395('0x26'),'id'])||{});}})[_0xf395('0x27')](function(_0x31f758){logger[_0xf395('0x19')](_0xf395('0x28'),_0x3c9420);logger['debug'](_0xf395('0x28'),_0x3c9420,JSON['stringify'](_0x31f758));_0x1586af(_0x31f758);})['catch'](function(_0xf2fa93){logger[_0xf395('0x15')](_0xf395('0x28'),_0xf2fa93[_0xf395('0x18')],_0x3c9420);_0x5ce316(_this[_0xf395('0x15')](0x1f4,_0xf2fa93[_0xf395('0x18')]));});});}; \ No newline at end of file +var _0x1d8d=['http','redis','socket.io-emitter','./smsInteraction.socket','then','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsInteraction,\x20%s,\x20%s','message','info','request\x20sent','result','SmsInteraction','update','body','options','raw','limit','debug','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5548da,_0x3dd33f){var _0x2e07cc=function(_0x21fee8){while(--_0x21fee8){_0x5548da['push'](_0x5548da['shift']());}};_0x2e07cc(++_0x3dd33f);}(_0x1d8d,0x15d));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1d8('0x0'));var util=require(_0xd1d8('0x1'));var moment=require(_0xd1d8('0x2'));var BPromise=require(_0xd1d8('0x3'));var rs=require(_0xd1d8('0x4'));var fs=require('fs');var Redis=require(_0xd1d8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd1d8('0x6'))(_0xd1d8('0x7'));var config=require(_0xd1d8('0x8'));var jayson=require(_0xd1d8('0x9'));var client=jayson[_0xd1d8('0xa')][_0xd1d8('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd1d8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd1d8('0xd'))(new Redis(config['redis']));require(_0xd1d8('0xe'))['register'](socket);function respondWithRpcPromise(_0xaef369,_0x5e4210,_0x24f96c){return new BPromise(function(_0x1fd928,_0x531b19){return client['request'](_0xaef369,_0x24f96c)[_0xd1d8('0xf')](function(_0x21fd88){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x5e4210,'request\x20sent');logger['debug'](_0xd1d8('0x10'),_0x5e4210,'request\x20sent',JSON[_0xd1d8('0x11')](_0x21fd88));if(_0x21fd88['error']){if(_0x21fd88['error'][_0xd1d8('0x12')]===0x1f4){logger[_0xd1d8('0x13')](_0xd1d8('0x14'),_0x5e4210,_0x21fd88[_0xd1d8('0x13')][_0xd1d8('0x15')]);return _0x531b19(_0x21fd88[_0xd1d8('0x13')][_0xd1d8('0x15')]);}logger[_0xd1d8('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x5e4210,_0x21fd88[_0xd1d8('0x13')]['message']);return _0x1fd928(_0x21fd88[_0xd1d8('0x13')]['message']);}else{logger[_0xd1d8('0x16')](_0xd1d8('0x14'),_0x5e4210,_0xd1d8('0x17'));_0x1fd928(_0x21fd88[_0xd1d8('0x18')][_0xd1d8('0x15')]);}})['catch'](function(_0x2fbba2){logger[_0xd1d8('0x13')](_0xd1d8('0x14'),_0x5e4210,_0x2fbba2);_0x531b19(_0x2fbba2);});});}exports['UpdateSmsInteraction']=function(_0x518653){var _0x4640b4=this;return new Promise(function(_0x146fb2,_0x383453){return db[_0xd1d8('0x19')][_0xd1d8('0x1a')](_0x518653[_0xd1d8('0x1b')],{'raw':_0x518653[_0xd1d8('0x1c')]?_0x518653[_0xd1d8('0x1c')][_0xd1d8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x518653[_0xd1d8('0x1c')]?_0x518653[_0xd1d8('0x1c')]['where']||null:null,'attributes':_0x518653[_0xd1d8('0x1c')]?_0x518653['options']['attributes']||null:null,'limit':_0x518653['options']?_0x518653[_0xd1d8('0x1c')][_0xd1d8('0x1e')]||null:null})[_0xd1d8('0xf')](function(_0x77642a){logger[_0xd1d8('0x16')]('UpdateSmsInteraction',_0x518653);logger[_0xd1d8('0x1f')]('UpdateSmsInteraction',_0x518653,JSON['stringify'](_0x77642a));_0x146fb2(_0x77642a);})['catch'](function(_0x463eac){logger['error'](_0xd1d8('0x20'),_0x463eac[_0xd1d8('0x15')],_0x518653);_0x383453(_0x4640b4[_0xd1d8('0x13')](0x1f4,_0x463eac[_0xd1d8('0x15')]));});});};exports[_0xd1d8('0x21')]=function(_0x524ed2){return new Promise(function(_0x132b29,_0x426903){return db[_0xd1d8('0x19')][_0xd1d8('0x22')]({'where':_0x524ed2[_0xd1d8('0x1c')]?_0x524ed2[_0xd1d8('0x1c')]['where']||null:null})[_0xd1d8('0xf')](function(_0x22bf31){if(_0x22bf31){return _0x22bf31[_0xd1d8('0x23')](_0x524ed2[_0xd1d8('0x1b')][_0xd1d8('0x24')],_['omit'](_0x524ed2[_0xd1d8('0x1b')],[_0xd1d8('0x24'),'id'])||{});}})[_0xd1d8('0x25')](function(_0x19af39){logger[_0xd1d8('0x16')](_0xd1d8('0x26'),_0x524ed2);logger[_0xd1d8('0x1f')](_0xd1d8('0x26'),_0x524ed2,JSON['stringify'](_0x19af39));_0x132b29(_0x19af39);})[_0xd1d8('0x27')](function(_0x347b67){logger[_0xd1d8('0x13')]('AddTags',_0x347b67[_0xd1d8('0x15')],_0x524ed2);_0x426903(_this['error'](0x1f4,_0x347b67[_0xd1d8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5a89c8c..61c7358 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x104fd5,_0x4a06f0){var _0x5f071d=function(_0x2f0533){while(--_0x2f0533){_0x104fd5['push'](_0x104fd5['shift']());}};_0x5f071d(++_0x4a06f0);}(_0x0b0e,0x187));var _0xe0b0=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x0b0e[_0xcf581b];return _0x4f454d;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x4c7fee,_0x2bb65f){var _0x379190=function(_0x5da743){while(--_0x5da743){_0x4c7fee['push'](_0x4c7fee['shift']());}};_0x379190(++_0x2bb65f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 23cfb2e..ae3b378 100644 --- a/server/api/smsMessage/index.js +++ b/server/api/smsMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30d5=['smsmessage:create','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','connect-timeout','express','Router','fs-extra','get','isAuthenticated','describe','show','post'];(function(_0x2468a2,_0x1eec24){var _0x1d7dc7=function(_0x50d966){while(--_0x50d966){_0x2468a2['push'](_0x2468a2['shift']());}};_0x1d7dc7(++_0x1eec24);}(_0x30d5,0x8a));var _0x530d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x30d5[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x530d('0x0'));var express=require(_0x530d('0x1'));var router=express[_0x530d('0x2')]();var fs_extra=require(_0x530d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x530d('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x530d('0x4')]('/describe',auth[_0x530d('0x5')](),controller[_0x530d('0x6')]);router['get']('/:id',auth[_0x530d('0x5')](),controller[_0x530d('0x7')]);router[_0x530d('0x8')]('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x530d('0x9')),controller['create']);router['post']('/:id/status',controller[_0x530d('0xa')]);router[_0x530d('0xb')](_0x530d('0xc'),auth[_0x530d('0x5')](),controller[_0x530d('0xd')]);router[_0x530d('0xb')](_0x530d('0xe'),auth['isAuthenticated'](),controller[_0x530d('0xf')]);router[_0x530d('0xb')](_0x530d('0x10'),auth[_0x530d('0x5')](),controller[_0x530d('0x11')]);router[_0x530d('0x12')](_0x530d('0xc'),auth[_0x530d('0x5')](),controller[_0x530d('0x13')]);module[_0x530d('0x14')]=router; \ No newline at end of file +var _0xfa8c=['../../config/environment','./smsMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','sms','smsmessage:create','post','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x402c9b,_0xb75c5){var _0x30a963=function(_0x51c7cd){while(--_0x51c7cd){_0x402c9b['push'](_0x402c9b['shift']());}};_0x30a963(++_0xb75c5);}(_0xfa8c,0x165));var _0xcfa8=function(_0x46d3e0,_0x4f9173){_0x46d3e0=_0x46d3e0-0x0;var _0x30a54d=_0xfa8c[_0x46d3e0];return _0x30a54d;};'use strict';var multer=require(_0xcfa8('0x0'));var util=require(_0xcfa8('0x1'));var path=require(_0xcfa8('0x2'));var timeout=require(_0xcfa8('0x3'));var express=require(_0xcfa8('0x4'));var router=express[_0xcfa8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcfa8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcfa8('0x7'));var controller=require(_0xcfa8('0x8'));router['get']('/',auth[_0xcfa8('0x9')](),controller['index']);router[_0xcfa8('0xa')](_0xcfa8('0xb'),auth['isAuthenticated'](),controller[_0xcfa8('0xc')]);router[_0xcfa8('0xa')](_0xcfa8('0xd'),auth['isAuthenticated'](),controller[_0xcfa8('0xe')]);router['post']('/',auth[_0xcfa8('0x9')](),interaction['tracked'](_0xcfa8('0xf'),_0xcfa8('0x10')),controller['create']);router[_0xcfa8('0x11')](_0xcfa8('0x12'),controller[_0xcfa8('0x13')]);router[_0xcfa8('0x14')](_0xcfa8('0xd'),auth[_0xcfa8('0x9')](),controller[_0xcfa8('0x15')]);router[_0xcfa8('0x14')](_0xcfa8('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xcfa8('0x14')](_0xcfa8('0x17'),auth['isAuthenticated'](),controller[_0xcfa8('0x18')]);router['delete'](_0xcfa8('0xd'),auth[_0xcfa8('0x9')](),controller[_0xcfa8('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 927b0e6..85d8ab6 100644 --- a/server/api/smsMessage/smsMessage.attributes.js +++ b/server/api/smsMessage/smsMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39b7=['out','STRING','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0xc82e7,_0x3f884b){var _0x4912c4=function(_0x2e3276){while(--_0x2e3276){_0xc82e7['push'](_0xc82e7['shift']());}};_0x4912c4(++_0x3f884b);}(_0x39b7,0xc3));var _0x739b=function(_0x578e61,_0x3f010f){_0x578e61=_0x578e61-0x0;var _0x42f374=_0x39b7[_0x578e61];return _0x42f374;};'use strict';var Sequelize=require(_0x739b('0x0'));module[_0x739b('0x1')]={'body':{'type':Sequelize['TEXT'](_0x739b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x739b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x739b('0x4')]('in',_0x739b('0x5')),'defaultValue':_0x739b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x739b('0x6')](0xbe)},'phone':{'type':Sequelize[_0x739b('0x6')]},'readAt':{'type':Sequelize[_0x739b('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x739b('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9c5f=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','TEXT','medium'];(function(_0x3cbaf5,_0x32988e){var _0x4bc50a=function(_0x1b16ae){while(--_0x1b16ae){_0x3cbaf5['push'](_0x3cbaf5['shift']());}};_0x4bc50a(++_0x32988e);}(_0x9c5f,0x8d));var _0xf9c5=function(_0x4d044b,_0x27fff2){_0x4d044b=_0x4d044b-0x0;var _0x285300=_0x9c5f[_0x4d044b];return _0x285300;};'use strict';var Sequelize=require(_0xf9c5('0x0'));module['exports']={'body':{'type':Sequelize[_0xf9c5('0x1')](_0xf9c5('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf9c5('0x3')]('in',_0xf9c5('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf9c5('0x5')]},'readAt':{'type':Sequelize[_0xf9c5('0x6')]},'secret':{'type':Sequelize[_0xf9c5('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf9c5('0x5')]},'providerResponse':{'type':Sequelize[_0xf9c5('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7b14363..753d05c 100644 --- a/server/api/smsMessage/smsMessage.controller.js +++ b/server/api/smsMessage/smsMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4efc=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','client','request','then','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','stack','merge','body','contact','agent','interaction','account','index','map','SmsMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','name','options','include','findAll','show','params','includeAll','find','create','describe','accept','sms','readAt','format','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x299d0b,_0x4903d0){var _0x1cf053=function(_0x2777d6){while(--_0x2777d6){_0x299d0b['push'](_0x299d0b['shift']());}};_0x1cf053(++_0x4903d0);}(_0x4efc,0x10b));var _0xc4ef=function(_0x3a678e,_0x4d297c){_0x3a678e=_0x3a678e-0x0;var _0x2e62e7=_0x4efc[_0x3a678e];return _0x2e62e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4ef('0x0'));var zipdir=require(_0xc4ef('0x1'));var jsonpatch=require(_0xc4ef('0x2'));var rp=require('request-promise');var moment=require(_0xc4ef('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc4ef('0x4'));var sox=require(_0xc4ef('0x5'));var csv=require('to-csv');var ejs=require(_0xc4ef('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4ef('0x7'));var squel=require(_0xc4ef('0x8'));var crypto=require(_0xc4ef('0x9'));var jsforce=require(_0xc4ef('0xa'));var deskjs=require(_0xc4ef('0xb'));var toCsv=require(_0xc4ef('0xc'));var querystring=require('querystring');var Papa=require(_0xc4ef('0xd'));var Redis=require(_0xc4ef('0xe'));var authService=require(_0xc4ef('0xf'));var qs=require(_0xc4ef('0x10'));var as=require(_0xc4ef('0x11'));var hardwareService=require(_0xc4ef('0x12'));var logger=require(_0xc4ef('0x13'))(_0xc4ef('0x14'));var utils=require(_0xc4ef('0x15'));var config=require(_0xc4ef('0x16'));var licenseUtil=require(_0xc4ef('0x17'));var db=require(_0xc4ef('0x18'))['db'];config['redis']=_['defaults'](config[_0xc4ef('0x19')],{'host':_0xc4ef('0x1a'),'port':0x18eb});var socket=require(_0xc4ef('0x1b'))(new Redis(config[_0xc4ef('0x19')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xc4ef('0x1c'));var client=jayson['client'][_0xc4ef('0x1d')]({'port':0x232c});var client9002=jayson[_0xc4ef('0x1e')][_0xc4ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54eae4,_0x302781,_0x161c0f,_0x5b577c){return new BPromise(function(_0x1ca0be,_0x176e0a){var _0x3d7e43=_0x5b577c||client;return _0x3d7e43[_0xc4ef('0x1f')](_0x54eae4,_0x161c0f)[_0xc4ef('0x20')](function(_0x45fc35){logger['info']('SmsMessage,\x20%s,\x20%s',_0x302781,_0xc4ef('0x21'));logger[_0xc4ef('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x302781,_0xc4ef('0x21'),JSON[_0xc4ef('0x23')](_0x45fc35));if(_0x45fc35[_0xc4ef('0x24')]){if(_0x45fc35[_0xc4ef('0x24')][_0xc4ef('0x25')]===0x1f4){logger[_0xc4ef('0x24')](_0xc4ef('0x26'),_0x302781,_0x45fc35[_0xc4ef('0x24')]['message']);return _0x176e0a(_0x45fc35[_0xc4ef('0x24')][_0xc4ef('0x27')]);}logger[_0xc4ef('0x24')](_0xc4ef('0x26'),_0x302781,_0x45fc35[_0xc4ef('0x24')]['message']);return _0x1ca0be(_0x45fc35[_0xc4ef('0x24')][_0xc4ef('0x27')]);}else{logger[_0xc4ef('0x28')]('SmsMessage,\x20%s,\x20%s',_0x302781,_0xc4ef('0x21'));_0x1ca0be(_0x45fc35[_0xc4ef('0x29')]['message']);}})[_0xc4ef('0x2a')](function(_0x5c19c4){logger[_0xc4ef('0x24')](_0xc4ef('0x26'),_0x302781,_0x5c19c4);_0x176e0a(_0x5c19c4);});});}function respondWithStatusCode(_0x23dcd9,_0x165f09){_0x165f09=_0x165f09||0xcc;return function(_0x323e63){if(_0x323e63){return _0x23dcd9[_0xc4ef('0x2b')](_0x165f09);}return _0x23dcd9[_0xc4ef('0x2c')](_0x165f09)[_0xc4ef('0x2d')]();};}function respondWithResult(_0x3bf652,_0x1a42b8){_0x1a42b8=_0x1a42b8||0xc8;return function(_0x251b54){if(_0x251b54){return _0x3bf652[_0xc4ef('0x2c')](_0x1a42b8)[_0xc4ef('0x2e')](_0x251b54);}};}function respondWithFilteredResult(_0x3b899b,_0x4296d9){return function(_0x5c0826){if(_0x5c0826){var _0x1cca65=typeof _0x4296d9[_0xc4ef('0x2f')]==='undefined'&&typeof _0x4296d9[_0xc4ef('0x30')]===_0xc4ef('0x31');var _0xb4274f=_0x5c0826[_0xc4ef('0x32')];var _0x29b6ea=_0x1cca65?0x0:_0x4296d9['offset'];var _0x4803ed=_0x1cca65?_0x5c0826[_0xc4ef('0x32')]:_0x4296d9['offset']+_0x4296d9[_0xc4ef('0x30')];var _0x38d708;if(_0x4803ed>=_0xb4274f){_0x4803ed=_0xb4274f;_0x38d708=0xc8;}else{_0x38d708=0xce;}_0x3b899b[_0xc4ef('0x2c')](_0x38d708);return _0x3b899b['set'](_0xc4ef('0x33'),_0x29b6ea+'-'+_0x4803ed+'/'+_0xb4274f)[_0xc4ef('0x2e')](_0x5c0826);}return null;};}function patchUpdates(_0xf45951){return function(_0x58b8bc){try{jsonpatch[_0xc4ef('0x34')](_0x58b8bc,_0xf45951,!![]);}catch(_0x4267e2){return BPromise['reject'](_0x4267e2);}return _0x58b8bc[_0xc4ef('0x35')]();};}function saveUpdates(_0x114477,_0x264438){return function(_0x10db79){if(_0x10db79){return _0x10db79['update'](_0x114477)[_0xc4ef('0x20')](function(_0x465b45){return _0x465b45;});}return null;};}function removeEntity(_0x94516f,_0x5bce05){return function(_0x4cb883){if(_0x4cb883){return _0x4cb883[_0xc4ef('0x36')]()[_0xc4ef('0x20')](function(){_0x94516f[_0xc4ef('0x2c')](0xcc)[_0xc4ef('0x2d')]();});}};}function handleEntityNotFound(_0x2b3b97,_0x127227){return function(_0x384a8e){if(!_0x384a8e){_0x2b3b97[_0xc4ef('0x2b')](0x194);}return _0x384a8e;};}function handleError(_0x23d61f,_0x3d063a){_0x3d063a=_0x3d063a||0x1f4;return function(_0xf74bfc){logger[_0xc4ef('0x24')](_0xf74bfc[_0xc4ef('0x37')]);if(_0xf74bfc['name']){delete _0xf74bfc['name'];}_0x23d61f[_0xc4ef('0x2c')](_0x3d063a)['send'](_0xf74bfc);};}function getMustacheRender(_0x167886,_0x4e6b90){return Mustache['render'](_0x167886,_[_0xc4ef('0x38')](_0x4e6b90[_0xc4ef('0x39')],{'contact':_0x4e6b90[_0xc4ef('0x3a')],'message':_0x4e6b90[_0xc4ef('0x27')],'agent':_0x4e6b90[_0xc4ef('0x3b')],'interaction':_0x4e6b90[_0xc4ef('0x3c')],'account':_0x4e6b90[_0xc4ef('0x3d')]}))||'';}exports[_0xc4ef('0x3e')]=function(_0x1ff9e3,_0x31874f){var _0x2661bc={},_0xbc8ef6={},_0x504a7e={'count':0x0,'rows':[]};var _0x42cd6=_[_0xc4ef('0x3f')](db[_0xc4ef('0x40')][_0xc4ef('0x41')],function(_0x5e93f3){return{'name':_0x5e93f3[_0xc4ef('0x42')],'type':_0x5e93f3[_0xc4ef('0x43')][_0xc4ef('0x44')]};});_0xbc8ef6['model']=_[_0xc4ef('0x3f')](_0x42cd6,'name');_0xbc8ef6['query']=_[_0xc4ef('0x45')](_0x1ff9e3[_0xc4ef('0x46')]);_0xbc8ef6[_0xc4ef('0x47')]=_[_0xc4ef('0x48')](_0xbc8ef6[_0xc4ef('0x49')],_0xbc8ef6['query']);_0x2661bc['attributes']=_[_0xc4ef('0x48')](_0xbc8ef6[_0xc4ef('0x49')],qs['fields'](_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x4a')]));_0x2661bc['attributes']=_0x2661bc[_0xc4ef('0x4b')][_0xc4ef('0x4c')]?_0x2661bc[_0xc4ef('0x4b')]:_0xbc8ef6[_0xc4ef('0x49')];if(!_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x4d')]('nolimit')){_0x2661bc[_0xc4ef('0x30')]=qs['limit'](_0x1ff9e3[_0xc4ef('0x46')]['limit']);_0x2661bc['offset']=qs['offset'](_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x2f')]);}_0x2661bc[_0xc4ef('0x4e')]=qs[_0xc4ef('0x4f')](_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x4f')]);_0x2661bc['where']=qs[_0xc4ef('0x47')](_[_0xc4ef('0x50')](_0x1ff9e3['query'],_0xbc8ef6['filters']),_0x42cd6);if(_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x51')]){_0x2661bc['where']=_[_0xc4ef('0x38')](_0x2661bc[_0xc4ef('0x52')],{'$or':_['map'](_0x42cd6,function(_0x4522e4){if(_0x4522e4[_0xc4ef('0x43')]!==_0xc4ef('0x53')){var _0x231e16={};_0x231e16[_0x4522e4[_0xc4ef('0x54')]]={'$like':'%'+_0x1ff9e3[_0xc4ef('0x46')][_0xc4ef('0x51')]+'%'};return _0x231e16;}})});}_0x2661bc=_[_0xc4ef('0x38')]({},_0x2661bc,_0x1ff9e3[_0xc4ef('0x55')]);var _0x1e732d={'where':_0x2661bc[_0xc4ef('0x52')]};return db['SmsMessage'][_0xc4ef('0x32')](_0x1e732d)[_0xc4ef('0x20')](function(_0x16e7d1){_0x504a7e[_0xc4ef('0x32')]=_0x16e7d1;if(_0x1ff9e3['query']['includeAll']){_0x2661bc[_0xc4ef('0x56')]=[{'all':!![]}];}return db[_0xc4ef('0x40')][_0xc4ef('0x57')](_0x2661bc);})['then'](function(_0x272e29){_0x504a7e['rows']=_0x272e29;return _0x504a7e;})['then'](respondWithFilteredResult(_0x31874f,_0x2661bc))[_0xc4ef('0x2a')](handleError(_0x31874f,null));};exports[_0xc4ef('0x58')]=function(_0x35493b,_0x31c7b5){var _0x369f35={'raw':!![],'where':{'id':_0x35493b[_0xc4ef('0x59')]['id']}},_0x2ae624={};_0x2ae624[_0xc4ef('0x49')]=_[_0xc4ef('0x45')](db[_0xc4ef('0x40')][_0xc4ef('0x41')]);_0x2ae624[_0xc4ef('0x46')]=_[_0xc4ef('0x45')](_0x35493b[_0xc4ef('0x46')]);_0x2ae624[_0xc4ef('0x47')]=_[_0xc4ef('0x48')](_0x2ae624[_0xc4ef('0x49')],_0x2ae624[_0xc4ef('0x46')]);_0x369f35[_0xc4ef('0x4b')]=_[_0xc4ef('0x48')](_0x2ae624['model'],qs[_0xc4ef('0x4a')](_0x35493b[_0xc4ef('0x46')][_0xc4ef('0x4a')]));_0x369f35[_0xc4ef('0x4b')]=_0x369f35['attributes'][_0xc4ef('0x4c')]?_0x369f35[_0xc4ef('0x4b')]:_0x2ae624['model'];if(_0x35493b['query'][_0xc4ef('0x5a')]){_0x369f35[_0xc4ef('0x56')]=[{'all':!![]}];}_0x369f35=_['merge']({},_0x369f35,_0x35493b[_0xc4ef('0x55')]);return db[_0xc4ef('0x40')][_0xc4ef('0x5b')](_0x369f35)['then'](handleEntityNotFound(_0x31c7b5,null))[_0xc4ef('0x20')](respondWithResult(_0x31c7b5,null))[_0xc4ef('0x2a')](handleError(_0x31c7b5,null));};exports['create']=function(_0x5aaf52,_0x41809c){return db[_0xc4ef('0x40')][_0xc4ef('0x5c')](_0x5aaf52[_0xc4ef('0x39')],{})[_0xc4ef('0x20')](respondWithResult(_0x41809c,0xc9))[_0xc4ef('0x2a')](handleError(_0x41809c,null));};exports['update']=function(_0x368a67,_0x5e84d8){if(_0x368a67['body']['id']){delete _0x368a67['body']['id'];}return db[_0xc4ef('0x40')]['find']({'where':{'id':_0x368a67[_0xc4ef('0x59')]['id']}})['then'](handleEntityNotFound(_0x5e84d8,null))[_0xc4ef('0x20')](saveUpdates(_0x368a67[_0xc4ef('0x39')],null))[_0xc4ef('0x20')](respondWithResult(_0x5e84d8,null))[_0xc4ef('0x2a')](handleError(_0x5e84d8,null));};exports[_0xc4ef('0x36')]=function(_0x48f3e6,_0x524dd8){return db[_0xc4ef('0x40')]['find']({'where':{'id':_0x48f3e6[_0xc4ef('0x59')]['id']}})[_0xc4ef('0x20')](handleEntityNotFound(_0x524dd8,null))[_0xc4ef('0x20')](removeEntity(_0x524dd8,null))[_0xc4ef('0x2a')](handleError(_0x524dd8,null));};exports[_0xc4ef('0x5d')]=function(_0x3d9c37,_0xde1ee6){return db[_0xc4ef('0x40')][_0xc4ef('0x5d')]()[_0xc4ef('0x20')](respondWithResult(_0xde1ee6,null))[_0xc4ef('0x2a')](handleError(_0xde1ee6,null));};var interaction_log=require(_0xc4ef('0x13'))('sms-interactions');exports[_0xc4ef('0x5e')]=function(_0x32a18e,_0x4d02ed,_0x501978){var _0x42c7f4={'agent':{},'channel':_0xc4ef('0x5f')};if(_0x32a18e[_0xc4ef('0x39')]['id']){delete _0x32a18e[_0xc4ef('0x39')]['id'];}_0x32a18e[_0xc4ef('0x39')]['read']=!![];_0x32a18e['body'][_0xc4ef('0x60')]=moment()[_0xc4ef('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x62')]=_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x62')]||_0x32a18e[_0xc4ef('0x63')]['id'];_0x42c7f4['agent']['id']=_0x32a18e['body'][_0xc4ef('0x62')];return db[_0xc4ef('0x40')][_0xc4ef('0x5b')]({'where':{'id':_0x32a18e['params']['id'],'UserId':null},'include':[{'model':db[_0xc4ef('0x64')],'as':_0xc4ef('0x65')}]})[_0xc4ef('0x20')](handleEntityNotFound(_0x4d02ed,null))[_0xc4ef('0x20')](saveUpdates(_0x32a18e[_0xc4ef('0x39')],null))['then'](function(_0x5b694a){if(_0x5b694a){_0x42c7f4[_0xc4ef('0x27')]=_0x5b694a[_0xc4ef('0x66')]({'plain':!![]});return db[_0xc4ef('0x67')][_0xc4ef('0x5b')]({'where':{'id':_0x5b694a[_0xc4ef('0x68')]}});}return null;})[_0xc4ef('0x20')](handleEntityNotFound(_0x4d02ed,null))[_0xc4ef('0x20')](function(_0x385d13){if(_0x385d13){return _0x385d13[_0xc4ef('0x69')]({'UserId':_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x62')],'read1stAt':_[_0xc4ef('0x6a')](_0x385d13[_0xc4ef('0x6b')])?moment()['format'](_0xc4ef('0x6c')):undefined});}return null;})[_0xc4ef('0x20')](function(_0x44a2e6){if(_0x44a2e6){_0x42c7f4[_0xc4ef('0x3c')]=_0x44a2e6['get']({'plain':!![]});interaction_log[_0xc4ef('0x28')](_0xc4ef('0x6d'),_0x32a18e[_0xc4ef('0x63')]['id'],_0x32a18e['user'][_0xc4ef('0x54')],_0x32a18e[_0xc4ef('0x63')][_0xc4ef('0x6e')],_0x42c7f4[_0xc4ef('0x3c')]['id'],_0x32a18e[_0xc4ef('0x39')]?JSON[_0xc4ef('0x23')](_0x32a18e[_0xc4ef('0x39')]):_0xc4ef('0x6f'));return respondWithRpcPromise(_0xc4ef('0x70'),_0xc4ef('0x71'),_0x42c7f4);}return null;})[_0xc4ef('0x20')](function(_0x837d0a){if(_0x837d0a){if(_0x32a18e[_0xc4ef('0x39')][_0xc4ef('0x72')]){_0x42c7f4[_0xc4ef('0x27')]['interface']=util[_0xc4ef('0x61')](_0xc4ef('0x73'),_0x32a18e['user'][_0xc4ef('0x54')]);_0x42c7f4['message']['channel']=_0x42c7f4[_0xc4ef('0x74')];_0x42c7f4[_0xc4ef('0x27')][_0xc4ef('0x75')]=_0xc4ef('0x5e');return respondWithRpcPromise(_0xc4ef('0x76'),'EventManager',{'event':_0xc4ef('0x77'),'message':_0x42c7f4[_0xc4ef('0x27')]},client9002)[_0xc4ef('0x20')](function(){return _0x42c7f4;});}return _0x42c7f4;}return null;})[_0xc4ef('0x20')](respondWithResult(_0x4d02ed,null))['catch'](handleError(_0x4d02ed,null));};var interaction_log=require(_0xc4ef('0x13'))(_0xc4ef('0x78'));exports['reject']=function(_0x57abcd,_0x2f580e,_0x288949){var _0x4b7a09={'agent':{},'channel':_0xc4ef('0x5f')};if(_0x57abcd[_0xc4ef('0x39')]['id']){delete _0x57abcd[_0xc4ef('0x39')]['id'];}_0x57abcd['body'][_0xc4ef('0x62')]=_0x57abcd['body'][_0xc4ef('0x62')]||_0x57abcd['user']['id'];_0x4b7a09[_0xc4ef('0x3b')]['id']=_0x57abcd[_0xc4ef('0x39')]['UserId'];return db[_0xc4ef('0x40')][_0xc4ef('0x5b')]({'where':{'id':_0x57abcd[_0xc4ef('0x59')]['id'],'UserId':null}})[_0xc4ef('0x20')](handleEntityNotFound(_0x2f580e,null))[_0xc4ef('0x20')](function(_0x58a12e){if(_0x58a12e){_0x4b7a09[_0xc4ef('0x27')]=_0x58a12e[_0xc4ef('0x66')]({'plain':!![]});return db['SmsInteraction'][_0xc4ef('0x5b')]({'where':{'id':_0x58a12e['SmsInteractionId']}});}return null;})[_0xc4ef('0x20')](handleEntityNotFound(_0x2f580e,null))[_0xc4ef('0x20')](function(_0x389f50){if(_0x389f50){_0x4b7a09[_0xc4ef('0x3c')]=_0x389f50['get']({'plain':!![]});interaction_log['info'](_0xc4ef('0x79'),_0x57abcd['user']['id'],_0x57abcd[_0xc4ef('0x63')][_0xc4ef('0x54')],_0x57abcd[_0xc4ef('0x63')][_0xc4ef('0x6e')],_0x4b7a09[_0xc4ef('0x3c')]['id'],_0x57abcd['body']?JSON[_0xc4ef('0x23')](_0x57abcd['body']):_0xc4ef('0x6f'));return respondWithRpcPromise(_0xc4ef('0x7a'),_0xc4ef('0x7b'),_0x4b7a09);}return null;})[_0xc4ef('0x20')](function(_0x2c4e73){if(_0x2c4e73){_0x2c4e73[_0xc4ef('0x27')]['interface']=util[_0xc4ef('0x61')](_0xc4ef('0x73'),_0x57abcd[_0xc4ef('0x63')]['name']);_0x2c4e73[_0xc4ef('0x27')][_0xc4ef('0x74')]=_0x4b7a09['channel'];_0x2c4e73[_0xc4ef('0x27')]['event']=_0xc4ef('0x7c');respondWithRpcPromise(_0xc4ef('0x76'),'EventManager',{'event':_0xc4ef('0x7d'),'message':_0x2c4e73[_0xc4ef('0x27')]},client9002);return _0x4b7a09;}return null;})[_0xc4ef('0x20')](respondWithResult(_0x2f580e,null))[_0xc4ef('0x2a')](handleError(_0x2f580e,null));};exports[_0xc4ef('0x2c')]=function(_0x3bfd9f,_0x3b135d,_0x9adfb5){if(_0x3bfd9f[_0xc4ef('0x39')]['id']){delete _0x3bfd9f[_0xc4ef('0x39')]['id'];}var _0x288493;return db['SmsMessage'][_0xc4ef('0x5b')]({'where':{'id':_0x3bfd9f[_0xc4ef('0x59')]['id']}})[_0xc4ef('0x20')](handleEntityNotFound(_0x3b135d,null))[_0xc4ef('0x20')](function(_0x1f5fec){if(_0x1f5fec){_0x288493=_0x1f5fec;return db[_0xc4ef('0x7e')][_0xc4ef('0x5b')]({'where':{'id':_0x1f5fec[_0xc4ef('0x7f')]}});}})[_0xc4ef('0x20')](handleEntityNotFound(_0x3b135d,null))['then'](function(_0x12a92b){if(_0x12a92b){logger[_0xc4ef('0x22')](_0xc4ef('0x80'),'status',_0xc4ef('0x81'),_0x12a92b[_0xc4ef('0x43')],util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));switch(_0x12a92b['type']){case _0xc4ef('0x83'):if(_0x3bfd9f['body']['MessageSid']&&_0x3bfd9f[_0xc4ef('0x39')][_0xc4ef('0x84')]===_0x288493[_0xc4ef('0x85')]){return _0x288493['update']({'read':!![]});}else{logger[_0xc4ef('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc4ef('0x2c'),_0xc4ef('0x83'),util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));}break;case _0xc4ef('0x86'):if(_0x3bfd9f['body'][_0xc4ef('0x87')]&&_0x3bfd9f[_0xc4ef('0x39')][_0xc4ef('0x87')]===_0x288493['messageId']&&_[_0xc4ef('0x88')](['sent','delivered'],_0x3bfd9f[_0xc4ef('0x39')]['Status'])>=0x0){return _0x288493[_0xc4ef('0x69')]({'read':!![]});}else{logger[_0xc4ef('0x24')](_0xc4ef('0x89'),_0xc4ef('0x2c'),_0xc4ef('0x8a'),util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x53b037=_0x3bfd9f[_0xc4ef('0x39')]['results'][0x0];if(_0x53b037[_0xc4ef('0x2c')][_0xc4ef('0x8b')]===_0xc4ef('0x8c')){return _0x288493[_0xc4ef('0x69')]({'read':!![]});}else{logger['error'](_0xc4ef('0x89'),_0xc4ef('0x2c'),'infobip',util[_0xc4ef('0x82')](_0x3bfd9f[_0xc4ef('0x39')],{'showHidden':![],'depth':null}));}break;}return _0x288493;}})[_0xc4ef('0x20')](respondWithResult(_0x3b135d,null))[_0xc4ef('0x2a')](handleError(_0x3b135d,null));}; \ No newline at end of file +var _0xf671=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','index','map','SmsMessage','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','params','rawAttributes','length','find','create','describe','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','format','event','rejectmessage','SmsAccount','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x179e95,_0x57605e){var _0x2336ba=function(_0x4b2304){while(--_0x4b2304){_0x179e95['push'](_0x179e95['shift']());}};_0x2336ba(++_0x57605e);}(_0xf671,0x10c));var _0x1f67=function(_0x1a257f,_0x19071e){_0x1a257f=_0x1a257f-0x0;var _0x47c9fe=_0xf671[_0x1a257f];return _0x47c9fe;};'use strict';var emlformat=require(_0x1f67('0x0'));var rimraf=require(_0x1f67('0x1'));var zipdir=require(_0x1f67('0x2'));var jsonpatch=require(_0x1f67('0x3'));var rp=require('request-promise');var moment=require(_0x1f67('0x4'));var BPromise=require(_0x1f67('0x5'));var Mustache=require(_0x1f67('0x6'));var util=require(_0x1f67('0x7'));var path=require('path');var sox=require(_0x1f67('0x8'));var csv=require('to-csv');var ejs=require(_0x1f67('0x9'));var fs=require('fs');var fs_extra=require(_0x1f67('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f67('0xb'));var jsforce=require(_0x1f67('0xc'));var deskjs=require(_0x1f67('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1f67('0xe'));var Redis=require(_0x1f67('0xf'));var authService=require(_0x1f67('0x10'));var qs=require(_0x1f67('0x11'));var as=require(_0x1f67('0x12'));var hardwareService=require(_0x1f67('0x13'));var logger=require(_0x1f67('0x14'))(_0x1f67('0x15'));var utils=require(_0x1f67('0x16'));var config=require(_0x1f67('0x17'));var licenseUtil=require(_0x1f67('0x18'));var db=require('../../mysqldb')['db'];config[_0x1f67('0x19')]=_[_0x1f67('0x1a')](config[_0x1f67('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f67('0x1b'))(new Redis(config[_0x1f67('0x19')]));require(_0x1f67('0x1c'))[_0x1f67('0x1d')](socket);var jayson=require(_0x1f67('0x1e'));var client=jayson[_0x1f67('0x1f')][_0x1f67('0x20')]({'port':0x232c});var client9002=jayson[_0x1f67('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7bab,_0xbc91a8,_0x515bbc,_0x32befa){return new BPromise(function(_0x4dc3c1,_0x3bdb53){var _0x2d62b0=_0x32befa||client;return _0x2d62b0[_0x1f67('0x21')](_0x1a7bab,_0x515bbc)[_0x1f67('0x22')](function(_0x1b6e56){logger['info'](_0x1f67('0x23'),_0xbc91a8,_0x1f67('0x24'));logger[_0x1f67('0x25')](_0x1f67('0x26'),_0xbc91a8,_0x1f67('0x24'),JSON[_0x1f67('0x27')](_0x1b6e56));if(_0x1b6e56[_0x1f67('0x28')]){if(_0x1b6e56[_0x1f67('0x28')][_0x1f67('0x29')]===0x1f4){logger[_0x1f67('0x28')](_0x1f67('0x23'),_0xbc91a8,_0x1b6e56['error']['message']);return _0x3bdb53(_0x1b6e56['error'][_0x1f67('0x2a')]);}logger[_0x1f67('0x28')](_0x1f67('0x23'),_0xbc91a8,_0x1b6e56['error'][_0x1f67('0x2a')]);return _0x4dc3c1(_0x1b6e56['error']['message']);}else{logger['info'](_0x1f67('0x23'),_0xbc91a8,_0x1f67('0x24'));_0x4dc3c1(_0x1b6e56['result'][_0x1f67('0x2a')]);}})[_0x1f67('0x2b')](function(_0x306aaf){logger['error'](_0x1f67('0x23'),_0xbc91a8,_0x306aaf);_0x3bdb53(_0x306aaf);});});}function respondWithStatusCode(_0x185500,_0x4537c2){_0x4537c2=_0x4537c2||0xcc;return function(_0x366d18){if(_0x366d18){return _0x185500[_0x1f67('0x2c')](_0x4537c2);}return _0x185500['status'](_0x4537c2)[_0x1f67('0x2d')]();};}function respondWithResult(_0x204700,_0x3b3bf0){_0x3b3bf0=_0x3b3bf0||0xc8;return function(_0x133ec5){if(_0x133ec5){return _0x204700[_0x1f67('0x2e')](_0x3b3bf0)[_0x1f67('0x2f')](_0x133ec5);}};}function respondWithFilteredResult(_0x300be8,_0x582a01){return function(_0x674844){if(_0x674844){var _0xf0ce5a=typeof _0x582a01[_0x1f67('0x30')]===_0x1f67('0x31')&&typeof _0x582a01[_0x1f67('0x32')]==='undefined';var _0x5cc91f=_0x674844[_0x1f67('0x33')];var _0x3f6320=_0xf0ce5a?0x0:_0x582a01[_0x1f67('0x30')];var _0xb4d6ae=_0xf0ce5a?_0x674844[_0x1f67('0x33')]:_0x582a01['offset']+_0x582a01[_0x1f67('0x32')];var _0x59c225;if(_0xb4d6ae>=_0x5cc91f){_0xb4d6ae=_0x5cc91f;_0x59c225=0xc8;}else{_0x59c225=0xce;}_0x300be8[_0x1f67('0x2e')](_0x59c225);return _0x300be8['set'](_0x1f67('0x34'),_0x3f6320+'-'+_0xb4d6ae+'/'+_0x5cc91f)['json'](_0x674844);}return null;};}function patchUpdates(_0x1bc722){return function(_0x544ac4){try{jsonpatch[_0x1f67('0x35')](_0x544ac4,_0x1bc722,!![]);}catch(_0x401246){return BPromise[_0x1f67('0x36')](_0x401246);}return _0x544ac4['save']();};}function saveUpdates(_0x547910,_0x483391){return function(_0x2f9b95){if(_0x2f9b95){return _0x2f9b95[_0x1f67('0x37')](_0x547910)[_0x1f67('0x22')](function(_0x19f683){return _0x19f683;});}return null;};}function removeEntity(_0x3b4fb3,_0x4511de){return function(_0x37e6dd){if(_0x37e6dd){return _0x37e6dd[_0x1f67('0x38')]()[_0x1f67('0x22')](function(){_0x3b4fb3[_0x1f67('0x2e')](0xcc)[_0x1f67('0x2d')]();});}};}function handleEntityNotFound(_0x178e55,_0x20dbe0){return function(_0x30f4ca){if(!_0x30f4ca){_0x178e55[_0x1f67('0x2c')](0x194);}return _0x30f4ca;};}function handleError(_0x2d5236,_0x3bf8dd){_0x3bf8dd=_0x3bf8dd||0x1f4;return function(_0x55a306){logger[_0x1f67('0x28')](_0x55a306[_0x1f67('0x39')]);if(_0x55a306[_0x1f67('0x3a')]){delete _0x55a306[_0x1f67('0x3a')];}_0x2d5236['status'](_0x3bf8dd)[_0x1f67('0x3b')](_0x55a306);};}function getMustacheRender(_0x7012cb,_0x466f99){return Mustache[_0x1f67('0x3c')](_0x7012cb,_[_0x1f67('0x3d')](_0x466f99[_0x1f67('0x3e')],{'contact':_0x466f99[_0x1f67('0x3f')],'message':_0x466f99[_0x1f67('0x2a')],'agent':_0x466f99[_0x1f67('0x40')],'interaction':_0x466f99[_0x1f67('0x41')],'account':_0x466f99['account']}))||'';}exports[_0x1f67('0x42')]=function(_0x5067dd,_0xb83f5c){var _0x1b55f7={},_0x5080b2={},_0x4eb90a={'count':0x0,'rows':[]};var _0x187a26=_[_0x1f67('0x43')](db[_0x1f67('0x44')]['rawAttributes'],function(_0x2b9305){return{'name':_0x2b9305['fieldName'],'type':_0x2b9305[_0x1f67('0x45')][_0x1f67('0x46')]};});_0x5080b2[_0x1f67('0x47')]=_[_0x1f67('0x43')](_0x187a26,_0x1f67('0x3a'));_0x5080b2[_0x1f67('0x48')]=_[_0x1f67('0x49')](_0x5067dd['query']);_0x5080b2[_0x1f67('0x4a')]=_[_0x1f67('0x4b')](_0x5080b2[_0x1f67('0x47')],_0x5080b2['query']);_0x1b55f7['attributes']=_[_0x1f67('0x4b')](_0x5080b2[_0x1f67('0x47')],qs[_0x1f67('0x4c')](_0x5067dd['query'][_0x1f67('0x4c')]));_0x1b55f7[_0x1f67('0x4d')]=_0x1b55f7[_0x1f67('0x4d')]['length']?_0x1b55f7[_0x1f67('0x4d')]:_0x5080b2[_0x1f67('0x47')];if(!_0x5067dd['query'][_0x1f67('0x4e')](_0x1f67('0x4f'))){_0x1b55f7[_0x1f67('0x32')]=qs[_0x1f67('0x32')](_0x5067dd[_0x1f67('0x48')][_0x1f67('0x32')]);_0x1b55f7[_0x1f67('0x30')]=qs['offset'](_0x5067dd['query']['offset']);}_0x1b55f7[_0x1f67('0x50')]=qs[_0x1f67('0x51')](_0x5067dd[_0x1f67('0x48')][_0x1f67('0x51')]);_0x1b55f7[_0x1f67('0x52')]=qs['filters'](_[_0x1f67('0x53')](_0x5067dd['query'],_0x5080b2[_0x1f67('0x4a')]),_0x187a26);if(_0x5067dd['query'][_0x1f67('0x54')]){_0x1b55f7[_0x1f67('0x52')]=_['merge'](_0x1b55f7[_0x1f67('0x52')],{'$or':_[_0x1f67('0x43')](_0x187a26,function(_0x204a0a){if(_0x204a0a['type']!=='VIRTUAL'){var _0x2f70e9={};_0x2f70e9[_0x204a0a[_0x1f67('0x3a')]]={'$like':'%'+_0x5067dd[_0x1f67('0x48')][_0x1f67('0x54')]+'%'};return _0x2f70e9;}})});}_0x1b55f7=_[_0x1f67('0x3d')]({},_0x1b55f7,_0x5067dd['options']);var _0x57b8af={'where':_0x1b55f7[_0x1f67('0x52')]};return db['SmsMessage'][_0x1f67('0x33')](_0x57b8af)[_0x1f67('0x22')](function(_0x104f56){_0x4eb90a['count']=_0x104f56;if(_0x5067dd[_0x1f67('0x48')][_0x1f67('0x55')]){_0x1b55f7[_0x1f67('0x56')]=[{'all':!![]}];}return db['SmsMessage'][_0x1f67('0x57')](_0x1b55f7);})[_0x1f67('0x22')](function(_0x4ba43b){_0x4eb90a[_0x1f67('0x58')]=_0x4ba43b;return _0x4eb90a;})[_0x1f67('0x22')](respondWithFilteredResult(_0xb83f5c,_0x1b55f7))[_0x1f67('0x2b')](handleError(_0xb83f5c,null));};exports['show']=function(_0x468973,_0x1bb688){var _0x34bb58={'raw':!![],'where':{'id':_0x468973[_0x1f67('0x59')]['id']}},_0x55612b={};_0x55612b[_0x1f67('0x47')]=_['keys'](db['SmsMessage'][_0x1f67('0x5a')]);_0x55612b[_0x1f67('0x48')]=_[_0x1f67('0x49')](_0x468973[_0x1f67('0x48')]);_0x55612b[_0x1f67('0x4a')]=_[_0x1f67('0x4b')](_0x55612b[_0x1f67('0x47')],_0x55612b[_0x1f67('0x48')]);_0x34bb58[_0x1f67('0x4d')]=_[_0x1f67('0x4b')](_0x55612b[_0x1f67('0x47')],qs[_0x1f67('0x4c')](_0x468973[_0x1f67('0x48')]['fields']));_0x34bb58[_0x1f67('0x4d')]=_0x34bb58[_0x1f67('0x4d')][_0x1f67('0x5b')]?_0x34bb58[_0x1f67('0x4d')]:_0x55612b[_0x1f67('0x47')];if(_0x468973[_0x1f67('0x48')][_0x1f67('0x55')]){_0x34bb58[_0x1f67('0x56')]=[{'all':!![]}];}_0x34bb58=_['merge']({},_0x34bb58,_0x468973['options']);return db[_0x1f67('0x44')][_0x1f67('0x5c')](_0x34bb58)[_0x1f67('0x22')](handleEntityNotFound(_0x1bb688,null))['then'](respondWithResult(_0x1bb688,null))['catch'](handleError(_0x1bb688,null));};exports[_0x1f67('0x5d')]=function(_0x3a5fc4,_0x30fd9b){return db[_0x1f67('0x44')][_0x1f67('0x5d')](_0x3a5fc4[_0x1f67('0x3e')],{})[_0x1f67('0x22')](respondWithResult(_0x30fd9b,0xc9))[_0x1f67('0x2b')](handleError(_0x30fd9b,null));};exports[_0x1f67('0x37')]=function(_0x6601ce,_0xb5b93){if(_0x6601ce[_0x1f67('0x3e')]['id']){delete _0x6601ce['body']['id'];}return db[_0x1f67('0x44')][_0x1f67('0x5c')]({'where':{'id':_0x6601ce[_0x1f67('0x59')]['id']}})['then'](handleEntityNotFound(_0xb5b93,null))[_0x1f67('0x22')](saveUpdates(_0x6601ce[_0x1f67('0x3e')],null))['then'](respondWithResult(_0xb5b93,null))[_0x1f67('0x2b')](handleError(_0xb5b93,null));};exports[_0x1f67('0x38')]=function(_0x19e6dc,_0x3849b2){return db[_0x1f67('0x44')][_0x1f67('0x5c')]({'where':{'id':_0x19e6dc[_0x1f67('0x59')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x3849b2,null))[_0x1f67('0x22')](removeEntity(_0x3849b2,null))[_0x1f67('0x2b')](handleError(_0x3849b2,null));};exports[_0x1f67('0x5e')]=function(_0x4234f3,_0x42e78f){return db[_0x1f67('0x44')][_0x1f67('0x5e')]()[_0x1f67('0x22')](respondWithResult(_0x42e78f,null))[_0x1f67('0x2b')](handleError(_0x42e78f,null));};var interaction_log=require(_0x1f67('0x14'))(_0x1f67('0x5f'));exports[_0x1f67('0x60')]=function(_0x336a97,_0x4dba23,_0x367dcd){var _0xf3666a={'agent':{},'channel':_0x1f67('0x61')};if(_0x336a97[_0x1f67('0x3e')]['id']){delete _0x336a97[_0x1f67('0x3e')]['id'];}_0x336a97['body']['read']=!![];_0x336a97['body'][_0x1f67('0x62')]=moment()['format'](_0x1f67('0x63'));_0x336a97[_0x1f67('0x3e')][_0x1f67('0x64')]=_0x336a97[_0x1f67('0x3e')][_0x1f67('0x64')]||_0x336a97[_0x1f67('0x65')]['id'];_0xf3666a[_0x1f67('0x40')]['id']=_0x336a97[_0x1f67('0x3e')][_0x1f67('0x64')];return db['SmsMessage'][_0x1f67('0x5c')]({'where':{'id':_0x336a97[_0x1f67('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x1f67('0x66')],'as':_0x1f67('0x67')}]})[_0x1f67('0x22')](handleEntityNotFound(_0x4dba23,null))[_0x1f67('0x22')](saveUpdates(_0x336a97[_0x1f67('0x3e')],null))['then'](function(_0x16b0ce){if(_0x16b0ce){_0xf3666a[_0x1f67('0x2a')]=_0x16b0ce[_0x1f67('0x68')]({'plain':!![]});return db[_0x1f67('0x69')][_0x1f67('0x5c')]({'where':{'id':_0x16b0ce[_0x1f67('0x6a')]}});}return null;})[_0x1f67('0x22')](handleEntityNotFound(_0x4dba23,null))['then'](function(_0x510029){if(_0x510029){return _0x510029[_0x1f67('0x37')]({'UserId':_0x336a97[_0x1f67('0x3e')][_0x1f67('0x64')],'read1stAt':_[_0x1f67('0x6b')](_0x510029[_0x1f67('0x6c')])?moment()['format'](_0x1f67('0x63')):undefined});}return null;})[_0x1f67('0x22')](function(_0x159d49){if(_0x159d49){_0xf3666a['interaction']=_0x159d49[_0x1f67('0x68')]({'plain':!![]});interaction_log[_0x1f67('0x6d')](_0x1f67('0x6e'),_0x336a97[_0x1f67('0x65')]['id'],_0x336a97['user'][_0x1f67('0x3a')],_0x336a97[_0x1f67('0x65')]['role'],_0xf3666a['interaction']['id'],_0x336a97[_0x1f67('0x3e')]?JSON[_0x1f67('0x27')](_0x336a97['body']):_0x1f67('0x6f'));return respondWithRpcPromise(_0x1f67('0x70'),_0x1f67('0x71'),_0xf3666a);}return null;})[_0x1f67('0x22')](function(_0x269651){if(_0x269651){if(_0x336a97[_0x1f67('0x3e')][_0x1f67('0x72')]){_0xf3666a[_0x1f67('0x2a')][_0x1f67('0x73')]=util['format'](_0x1f67('0x74'),_0x336a97[_0x1f67('0x65')][_0x1f67('0x3a')]);_0xf3666a[_0x1f67('0x2a')]['channel']=_0xf3666a[_0x1f67('0x75')];_0xf3666a[_0x1f67('0x2a')]['event']=_0x1f67('0x60');return respondWithRpcPromise(_0x1f67('0x76'),_0x1f67('0x76'),{'event':'acceptmessage','message':_0xf3666a[_0x1f67('0x2a')]},client9002)[_0x1f67('0x22')](function(){return _0xf3666a;});}return _0xf3666a;}return null;})[_0x1f67('0x22')](respondWithResult(_0x4dba23,null))[_0x1f67('0x2b')](handleError(_0x4dba23,null));};var interaction_log=require(_0x1f67('0x14'))(_0x1f67('0x5f'));exports[_0x1f67('0x36')]=function(_0x5cd830,_0x3d1c63,_0x56f257){var _0x116989={'agent':{},'channel':_0x1f67('0x61')};if(_0x5cd830['body']['id']){delete _0x5cd830[_0x1f67('0x3e')]['id'];}_0x5cd830[_0x1f67('0x3e')][_0x1f67('0x64')]=_0x5cd830[_0x1f67('0x3e')][_0x1f67('0x64')]||_0x5cd830[_0x1f67('0x65')]['id'];_0x116989['agent']['id']=_0x5cd830['body'][_0x1f67('0x64')];return db['SmsMessage'][_0x1f67('0x5c')]({'where':{'id':_0x5cd830[_0x1f67('0x59')]['id'],'UserId':null}})[_0x1f67('0x22')](handleEntityNotFound(_0x3d1c63,null))[_0x1f67('0x22')](function(_0x124cff){if(_0x124cff){_0x116989[_0x1f67('0x2a')]=_0x124cff[_0x1f67('0x68')]({'plain':!![]});return db[_0x1f67('0x69')][_0x1f67('0x5c')]({'where':{'id':_0x124cff['SmsInteractionId']}});}return null;})[_0x1f67('0x22')](handleEntityNotFound(_0x3d1c63,null))[_0x1f67('0x22')](function(_0x33e22a){if(_0x33e22a){_0x116989[_0x1f67('0x41')]=_0x33e22a[_0x1f67('0x68')]({'plain':!![]});interaction_log[_0x1f67('0x6d')](_0x1f67('0x77'),_0x5cd830[_0x1f67('0x65')]['id'],_0x5cd830[_0x1f67('0x65')]['name'],_0x5cd830[_0x1f67('0x65')][_0x1f67('0x78')],_0x116989[_0x1f67('0x41')]['id'],_0x5cd830[_0x1f67('0x3e')]?JSON[_0x1f67('0x27')](_0x5cd830['body']):_0x1f67('0x6f'));return respondWithRpcPromise(_0x1f67('0x79'),_0x1f67('0x7a'),_0x116989);}return null;})[_0x1f67('0x22')](function(_0x1b6235){if(_0x1b6235){_0x1b6235[_0x1f67('0x2a')][_0x1f67('0x73')]=util[_0x1f67('0x7b')](_0x1f67('0x74'),_0x5cd830['user'][_0x1f67('0x3a')]);_0x1b6235[_0x1f67('0x2a')]['channel']=_0x116989['channel'];_0x1b6235['message'][_0x1f67('0x7c')]=_0x1f67('0x36');respondWithRpcPromise(_0x1f67('0x76'),'EventManager',{'event':_0x1f67('0x7d'),'message':_0x1b6235[_0x1f67('0x2a')]},client9002);return _0x116989;}return null;})['then'](respondWithResult(_0x3d1c63,null))['catch'](handleError(_0x3d1c63,null));};exports[_0x1f67('0x2e')]=function(_0x7a61fe,_0x44c5d2,_0x5d0f6d){if(_0x7a61fe[_0x1f67('0x3e')]['id']){delete _0x7a61fe[_0x1f67('0x3e')]['id'];}var _0x107552;return db['SmsMessage'][_0x1f67('0x5c')]({'where':{'id':_0x7a61fe['params']['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x44c5d2,null))[_0x1f67('0x22')](function(_0x403df4){if(_0x403df4){_0x107552=_0x403df4;return db[_0x1f67('0x7e')]['find']({'where':{'id':_0x403df4['SmsAccountId']}});}})[_0x1f67('0x22')](handleEntityNotFound(_0x44c5d2,null))[_0x1f67('0x22')](function(_0x15a06b){if(_0x15a06b){logger[_0x1f67('0x25')](_0x1f67('0x26'),'status','received\x20delivery\x20report\x20from',_0x15a06b['type'],util[_0x1f67('0x7f')](_0x7a61fe['body'],{'showHidden':![],'depth':null}));switch(_0x15a06b['type']){case _0x1f67('0x80'):if(_0x7a61fe['body'][_0x1f67('0x81')]&&_0x7a61fe[_0x1f67('0x3e')][_0x1f67('0x81')]===_0x107552[_0x1f67('0x82')]){return _0x107552[_0x1f67('0x37')]({'read':!![]});}else{logger[_0x1f67('0x28')](_0x1f67('0x83'),_0x1f67('0x2e'),_0x1f67('0x80'),util[_0x1f67('0x7f')](_0x7a61fe['body'],{'showHidden':![],'depth':null}));}break;case _0x1f67('0x84'):if(_0x7a61fe['body'][_0x1f67('0x85')]&&_0x7a61fe['body'][_0x1f67('0x85')]===_0x107552['messageId']&&_[_0x1f67('0x86')]([_0x1f67('0x87'),_0x1f67('0x88')],_0x7a61fe[_0x1f67('0x3e')][_0x1f67('0x89')])>=0x0){return _0x107552[_0x1f67('0x37')]({'read':!![]});}else{logger[_0x1f67('0x28')](_0x1f67('0x83'),'status',_0x1f67('0x8a'),util[_0x1f67('0x7f')](_0x7a61fe['body'],{'showHidden':![],'depth':null}));}break;case _0x1f67('0x8b'):var _0x1f2614=_0x7a61fe[_0x1f67('0x3e')][_0x1f67('0x8c')][0x0];if(_0x1f2614['status'][_0x1f67('0x8d')]===_0x1f67('0x8e')){return _0x107552[_0x1f67('0x37')]({'read':!![]});}else{logger['error'](_0x1f67('0x83'),_0x1f67('0x2e'),'infobip',util[_0x1f67('0x7f')](_0x7a61fe[_0x1f67('0x3e')],{'showHidden':![],'depth':null}));}break;}return _0x107552;}})['then'](respondWithResult(_0x44c5d2,null))[_0x1f67('0x2b')](handleError(_0x44c5d2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e8e746e..e737b15 100644 --- a/server/api/smsMessage/smsMessage.events.js +++ b/server/api/smsMessage/smsMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4a3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage'];(function(_0x2d5dcf,_0xf71498){var _0x42a3e8=function(_0xaa41d8){while(--_0xaa41d8){_0x2d5dcf['push'](_0x2d5dcf['shift']());}};_0x42a3e8(++_0xf71498);}(_0xf4a3,0xf0));var _0x3f4a=function(_0x4ae345,_0x479da5){_0x4ae345=_0x4ae345-0x0;var _0x3b2917=_0xf4a3[_0x4ae345];return _0x3b2917;};'use strict';var EventEmitter=require(_0x3f4a('0x0'));var SmsMessage=require(_0x3f4a('0x1'))['db'][_0x3f4a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3f4a('0x3')](0x0);var events={'afterCreate':_0x3f4a('0x4'),'afterUpdate':_0x3f4a('0x5'),'afterDestroy':_0x3f4a('0x6')};function emitEvent(_0x1a5c7){return function(_0x417d70,_0x546c49,_0x46f6d6){SmsMessageEvents['emit'](_0x1a5c7+':'+_0x417d70['id'],_0x417d70);SmsMessageEvents[_0x3f4a('0x7')](_0x1a5c7,_0x417d70);_0x46f6d6(null);};}for(var e in events){if(events[_0x3f4a('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xd895=['emit','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove'];(function(_0x37d9b1,_0x358b0d){var _0x580044=function(_0x23530f){while(--_0x23530f){_0x37d9b1['push'](_0x37d9b1['shift']());}};_0x580044(++_0x358b0d);}(_0xd895,0x16a));var _0x5d89=function(_0x29b42f,_0x35e6ab){_0x29b42f=_0x29b42f-0x0;var _0x11b5e3=_0xd895[_0x29b42f];return _0x11b5e3;};'use strict';var EventEmitter=require(_0x5d89('0x0'));var SmsMessage=require(_0x5d89('0x1'))['db'][_0x5d89('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5d89('0x3')](0x0);var events={'afterCreate':_0x5d89('0x4'),'afterUpdate':'update','afterDestroy':_0x5d89('0x5')};function emitEvent(_0x2d5299){return function(_0x518f67,_0x971fa3,_0xf55b04){SmsMessageEvents['emit'](_0x2d5299+':'+_0x518f67['id'],_0x518f67);SmsMessageEvents[_0x5d89('0x6')](_0x2d5299,_0x518f67);_0xf55b04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x5d89('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 804693a..4c30cbd 100644 --- a/server/api/smsMessage/smsMessage.model.js +++ b/server/api/smsMessage/smsMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2671=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','./smsMessage.attributes','exports','define','sms_messages','messageId','body','get','direction','secret','isNil','then','update','createdAt','toLowerCase','catch','error','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','POST','user_key','internal_order_id','deliveryReport','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','/api/sms/messages/','token','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','read','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','sort','createHash','md5','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','finally'];(function(_0xea98ab,_0x297344){var _0x39058e=function(_0x27524a){while(--_0x27524a){_0xea98ab['push'](_0xea98ab['shift']());}};_0x39058e(++_0x297344);}(_0x2671,0x14c));var _0x1267=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x2671[_0x83af7f];return _0x32d85c;};'use strict';var _=require(_0x1267('0x0'));var util=require(_0x1267('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1267('0x2'));var BPromise=require('bluebird');var rp=require(_0x1267('0x3'));var fs=require('fs');var path=require(_0x1267('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1267('0x5'));module[_0x1267('0x6')]=function(_0x37b0f7,_0x58a69a){return _0x37b0f7[_0x1267('0x7')]('SmsMessage',attributes,{'tableName':_0x1267('0x8'),'paranoid':![],'indexes':[{'name':_0x1267('0x9'),'fields':[_0x1267('0x9')]},{'name':'fti_sms_messages','fields':[_0x1267('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e58c0,_0x546f06,_0x4685ee){var _0x5b2b94=_0x37b0f7['models'];var _0x433649=_0x3e58c0[_0x1267('0xb')]({'plain':!![]});if(_0x433649['direction']['toLowerCase']()==='in'||_0x433649[_0x1267('0xc')]['toLowerCase']()==='out'&&!_0x433649[_0x1267('0xd')]&&!_[_0x1267('0xe')](_0x433649['UserId'])){_0x5b2b94['SmsInteraction']['findOne']({'where':{'id':_0x433649['SmsInteractionId']}})[_0x1267('0xf')](function(_0x5ac6f7){if(_0x5ac6f7){_0x5ac6f7[_0x1267('0x10')]({'lastMsgAt':_0x433649[_0x1267('0x11')],'lastMsgDirection':_0x433649['direction'][_0x1267('0x12')]()});}})[_0x1267('0x13')](function(_0x3eaeb1){console[_0x1267('0x14')](_0x3eaeb1);});}if(_0x433649[_0x1267('0xc')]==='out'&&!_0x433649[_0x1267('0xd')]){var _0x37b938;_0x5b2b94['SmsAccount'][_0x1267('0x15')]({'where':{'id':_0x433649[_0x1267('0x16')]},'raw':!![]})['then'](function(_0xd10b82){_0x37b938=_0xd10b82;if(_0x37b938&&_0x37b938[_0x1267('0x17')]){switch(_0x37b938['type']){case _0x1267('0x18'):var _0x109649=require(_0x1267('0x18'));if(_0x37b938[_0x1267('0x19')]&&_0x37b938['authToken']&&_0x37b938[_0x1267('0x1a')]){var _0x5720ad=new _0x109649(_0x37b938['accountSid'],_0x37b938[_0x1267('0x1b')]);_0x5720ad[_0x1267('0x1c')][_0x1267('0x1d')]({'body':_0x433649[_0x1267('0xa')],'to':_0x433649[_0x1267('0x1a')],'from':_0x37b938[_0x1267('0x1a')],'statusCallback':_0x37b938[_0x1267('0x1e')]+'/api/sms/messages/'+_0x433649['id']+_0x1267('0x1f')+_0x37b938['token']})['then'](function(_0x55829f){if(_0x55829f['sid']){return _0x3e58c0[_0x1267('0x10')]({'messageId':_0x55829f[_0x1267('0x20')]});}})['catch'](function(_0x586caf){logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x18'),util['inspect'](_0x586caf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x18'),_0x1267('0x23'));}break;case'skebby':var _0x49fd2d=_0x1267('0x24');if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){var _0x1c2407={'recipient':[_0x433649[_0x1267('0x1a')]],'message':_0x433649[_0x1267('0xa')],'message_type':_0x37b938[_0x1267('0x27')]};if(_0x37b938[_0x1267('0x27')]&&_0x37b938['smsMethod']!=='SI'){_0x1c2407[_0x1267('0x28')]=_0x37b938[_0x1267('0x1a')];}var _0x2ca12c={'url':_0x49fd2d+_0x1267('0x29')+_0x37b938['username']+_0x1267('0x2a')+_0x37b938['password'],'method':'GET'};rp(_0x2ca12c)[_0x1267('0xf')](function(_0x5b9ce9){var _0x1414e3=_0x5b9ce9['split'](';');var _0xf9cbe5={'user_key':_0x1414e3[0x0],'session_key':_0x1414e3[0x1]};_0x2ca12c={'url':_0x49fd2d+'sms','method':_0x1267('0x2b'),'headers':{'user_key':_0xf9cbe5[_0x1267('0x2c')],'Session_key':_0xf9cbe5['session_key']},'json':!![],'body':_0x1c2407};return rp(_0x2ca12c);})[_0x1267('0xf')](function(_0x2873ec){if(_0x2873ec['total_sent']>=0x1){var _0x4335bd={'messageId':_0x2873ec[_0x1267('0x2d')]};if(_0x37b938[_0x1267('0x27')]!=='GP'||!_0x37b938[_0x1267('0x2e')]){_0x4335bd['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0x4335bd);}else{return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x2f'),util[_0x1267('0x30')](_0x2873ec,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1726c2){return logger['error'](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x2f'),util[_0x1267('0x30')](_0x1726c2,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1267('0x2f'),_0x1267('0x31'));}break;case _0x1267('0x32'):if(_0x37b938['authToken']){var _0x37e8c6={'recipient':_0x433649['phone'],'message':_0x433649['body'],'sender':_0x37b938[_0x1267('0x33')]||_0x37b938[_0x1267('0x1a')],'authorization':_0x37b938[_0x1267('0x1b')]};var _0x546f06={'method':_0x1267('0x2b'),'uri':_0x1267('0x34'),'body':_0x37e8c6,'json':!![]};rp(_0x546f06)['then'](function(_0x1a1b6f){var _0xd672df={'messageId':_0x1a1b6f[_0x1267('0x35')]};if(!_0x37b938[_0x1267('0x2e')]){_0xd672df['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0xd672df);})[_0x1267('0x13')](function(_0x35b593){logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x32'),util['inspect'](_0x35b593,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x32'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){var _0x37e8c6={'messages':[{'source':_0x1267('0x36'),'to':_0x433649['phone'],'body':_0x433649[_0x1267('0xa')],'from':_0x37b938['senderString']||_0x37b938[_0x1267('0x1a')]}]};var _0x534219=util[_0x1267('0x37')](_0x1267('0x38'),_0x37b938[_0x1267('0x25')],_0x37b938['password']);var _0x546f06={'method':_0x1267('0x2b'),'uri':_0x1267('0x39'),'body':_0x37e8c6,'headers':{'Authorization':util[_0x1267('0x37')](_0x1267('0x3a'),new Buffer(_0x534219)[_0x1267('0x3b')](_0x1267('0x3c')))},'json':!![]};rp(_0x546f06)[_0x1267('0xf')](function(_0x37d9a4){if(_0x37d9a4[_0x1267('0x3d')]>=0xc8&&_0x37d9a4['http_code']<=0xce){if(_0x37d9a4[_0x1267('0x3e')]&&_0x37d9a4[_0x1267('0x3e')][_0x1267('0x3f')]>0x0){var _0x3714e2=_[_0x1267('0x40')](_0x37d9a4[_0x1267('0x3e')][_0x1267('0x1c')]);var _0x98ffee={'messageId':_0x3714e2['message_id']};if(!_0x37b938['deliveryReport']){_0x98ffee['read']=!![];}return _0x3e58c0['update'](_0x98ffee);}else{logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x41'),util[_0x1267('0x30')](_0x37d9a4,{'showHidden':![],'depth':null}));}}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x41'),util[_0x1267('0x30')](_0x37d9a4,{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0x41a680){logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x41'),util['inspect'](_0x41a680,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),'clickSend',_0x1267('0x31'));}break;case _0x1267('0x42'):if(_0x37b938[_0x1267('0x43')]&&_0x37b938[_0x1267('0x1b')]){var _0x37e8c6={'dst':_0x433649[_0x1267('0x1a')],'text':_0x433649[_0x1267('0xa')],'src':_0x37b938[_0x1267('0x33')]||_0x37b938[_0x1267('0x1a')],'url':_0x37b938[_0x1267('0x1e')]+_0x1267('0x44')+_0x433649['id']+'/status?token='+_0x37b938[_0x1267('0x45')]};var _0x534219=util['format'](_0x1267('0x38'),_0x37b938[_0x1267('0x43')],_0x37b938[_0x1267('0x1b')]);var _0x546f06={'method':_0x1267('0x2b'),'uri':util[_0x1267('0x37')]('https://api.plivo.com/v1/Account/%s/Message/',_0x37b938['authId']),'body':_0x37e8c6,'headers':{'Authorization':util[_0x1267('0x37')](_0x1267('0x3a'),new Buffer(_0x534219)[_0x1267('0x3b')](_0x1267('0x3c')))},'json':!![]};rp(_0x546f06)[_0x1267('0xf')](function(_0x366b82){var _0x160730={'messageId':_0x366b82['message_uuid'][0x0]};return _0x3e58c0[_0x1267('0x10')](_0x160730);})[_0x1267('0x13')](function(_0x55548d){logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x42'),util[_0x1267('0x30')](_0x55548d,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),'plivo',_0x1267('0x46'));}break;case'infobip':if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){if(_0x37b938[_0x1267('0x47')]){var _0x5d6b66={'method':'POST','uri':_0x37b938[_0x1267('0x47')]+'/auth/1/session','body':{'username':_0x37b938['username'],'password':_0x37b938[_0x1267('0x26')]},'json':!![]};return rp(_0x5d6b66)['then'](function(_0x58a102){var _0x53953a={'method':_0x1267('0x2b'),'uri':_0x37b938[_0x1267('0x47')]+_0x1267('0x48'),'body':{'messages':[{'from':_0x37b938['phone'],'destinations':[{'to':_0x433649[_0x1267('0x1a')]}],'text':_0x433649[_0x1267('0xa')],'notifyUrl':_0x37b938[_0x1267('0x1e')]+_0x1267('0x44')+_0x433649['id']+_0x1267('0x1f')+_0x37b938[_0x1267('0x45')],'notifyContentType':_0x1267('0x49'),'callbackData':_0x37b938[_0x1267('0x1a')]+';'+_0x433649[_0x1267('0xa')]}]},'headers':{'Authorization':_0x1267('0x4a')+_0x58a102[_0x1267('0x45')]},'json':!![]};return rp(_0x53953a)[_0x1267('0xf')](function(_0xba14f5){if(_0xba14f5[_0x1267('0x1c')]){var _0x21e7f2={'messageId':_0xba14f5[_0x1267('0x1c')][0x0][_0x1267('0x9')]};if(!_0x37b938[_0x1267('0x2e')]){_0x21e7f2[_0x1267('0x4b')]=!![];}return _0x3e58c0[_0x1267('0x10')](_0x21e7f2);}else{return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4c'),util['inspect'](_0xba14f5,{'showHidden':![],'depth':null}));}});})[_0x1267('0x13')](function(_0x1da7ed){return logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1267('0x4c'),util[_0x1267('0x30')](_0x1da7ed,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate','infobip',_0x1267('0x4d'));}}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4c'),_0x1267('0x31'));}break;case _0x1267('0x4e'):var _0x1fad04=require('crypto');if(_0x37b938[_0x1267('0x4f')]){var _0x41db43={};_0x41db43[_0x1267('0x50')]=_0x37b938[_0x1267('0x25')];_0x41db43[_0x1267('0x1a')]=_0x433649[_0x1267('0x1a')];_0x41db43[_0x1267('0x28')]=_0x37b938[_0x1267('0x1a')];_0x41db43[_0x1267('0x51')]=_0x433649[_0x1267('0xa')];_0x41db43[_0x1267('0x52')]=+new Date();var _0xb5eb00='';var _0xd88b5='';var _0xb113e9=Object['keys'](_0x41db43);_0xb113e9[_0x1267('0x53')]();for(var _0x5d21ad=0x0;_0x5d21ad<_0xb113e9['length'];_0x5d21ad++){if(_0xb5eb00!=''){_0xb5eb00+='&';}_0xb5eb00+=_0xb113e9[_0x5d21ad]+'='+encodeURIComponent(_0x41db43[_0xb113e9[_0x5d21ad]]);_0xd88b5+=_0x41db43[_0xb113e9[_0x5d21ad]];}_0xd88b5+=_0x37b938[_0x1267('0x4f')];_0xd88b5=_0x1fad04[_0x1267('0x54')](_0x1267('0x55'))['update'](_0xd88b5)['digest'](_0x1267('0x56'));if(_0xb5eb00!==''){_0xb5eb00+='&';}_0xb5eb00+=_0x1267('0x57')+_0xd88b5;var _0x2ca12c={'method':_0x1267('0x58'),'uri':_0x37b938['baseUrl']+_0x1267('0x59')+_0xb5eb00,'json':!![]};return rp(_0x2ca12c)[_0x1267('0xf')](function(_0x446cd1){var _0x5b67d9=Object['keys'](_0x446cd1);if(_0x446cd1[_0x5b67d9[0x0]][_0x1267('0x14')]&&parseInt(_0x446cd1[_0x5b67d9[0x0]][_0x1267('0x14')])===0x0){var _0x5040fe={'messageId':_0x446cd1[_0x5b67d9[0x0]][_0x1267('0x5a')]};if(!_0x37b938[_0x1267('0x2e')]){_0x5040fe['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0x5040fe);}else{return logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x4e'),util['inspect'](_0x446cd1[_0x1267('0x14')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x564e6c){return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4e'),util[_0x1267('0x30')](_0x564e6c,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x4e'),_0x1267('0x5b'));}break;case _0x1267('0x5c'):if(_0x37b938[_0x1267('0x4f')]){var _0x282fb2={'method':_0x1267('0x2b'),'uri':_0x1267('0x5d'),'headers':{'Authorization':_0x37b938[_0x1267('0x4f')]},'body':{'content':_0x433649[_0x1267('0xa')],'to':[_0x433649[_0x1267('0x1a')]],'from':_0x37b938['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x1267('0x5e')},'json':!![]};rp(_0x282fb2)[_0x1267('0xf')](function(_0x18296d){if(!_0x18296d[_0x1267('0x14')]){var _0x1999f9={'messageId':_0x18296d[_0x1267('0x1c')][0x0][_0x1267('0x5f')]};if(!_0x37b938[_0x1267('0x2e')]){_0x1999f9['read']=!![];}return _0x3e58c0[_0x1267('0x10')](_0x1999f9);}else{return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x5c'),util[_0x1267('0x30')](_0x18296d['error'],{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0x38ae07){return logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x5c'),util['inspect'](_0x38ae07,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x5c'),_0x1267('0x5b'));}break;case _0x1267('0x60'):if(_0x37b938[_0x1267('0x25')]&&_0x37b938[_0x1267('0x26')]){var _0x534219=util['format']('%s:%s',_0x37b938[_0x1267('0x25')],_0x37b938[_0x1267('0x26')]);var _0x546f06={'method':_0x1267('0x2b'),'uri':_0x1267('0x61')+_0x37b938['accountId']+_0x1267('0x62'),'body':{'to':[_0x433649['phone']],'text':_0x433649[_0x1267('0xa')],'from':_0x37b938[_0x1267('0x1a')],'applicationId':_0x37b938[_0x1267('0x63')]},'headers':{'Authorization':util[_0x1267('0x37')](_0x1267('0x3a'),new Buffer(_0x534219)['toString'](_0x1267('0x3c')))},'json':!![]};rp(_0x546f06)[_0x1267('0xf')](function(_0x9bb7ab){if(_0x9bb7ab['id']){var _0x277627={'messageId':_0x9bb7ab['id']};return _0x3e58c0[_0x1267('0x10')](_0x277627);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x60'),util[_0x1267('0x30')](_0x9bb7ab,{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0x1db6bd){logger['error'](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x60'),util[_0x1267('0x30')](_0x1db6bd,{'showHidden':![],'depth':null}));});}else{logger[_0x1267('0x14')](_0x1267('0x21'),_0x1267('0x22'),_0x1267('0x60'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1267('0x64'):if(_0x37b938[_0x1267('0x4f')]){var _0x334623={};var _0x2ca12c={'method':_0x1267('0x2b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x37b938[_0x1267('0x4f')],'Content-Type':_0x1267('0x49')},'body':{'from':_0x37b938['phone'],'to':_0x433649[_0x1267('0x1a')],'text':_0x433649['body']},'json':!![]};return rp(_0x2ca12c)[_0x1267('0xf')](function(_0x59022e){if(_0x59022e[_0x1267('0x65')]==0xca){_0x334623[_0x1267('0x66')]=_0x59022e;var _0x21f6b6={'method':_0x1267('0x2b'),'uri':_0x1267('0x67'),'headers':{'Authorization':_0x1267('0x68')+_0x37b938[_0x1267('0x4f')],'Content-Type':_0x1267('0x49')},'body':{'refid':_0x334623['message'][_0x1267('0x69')]},'json':!![]};return rp(_0x21f6b6)['then'](function(_0x4c72cf){_0x334623[_0x1267('0x6a')]=_0x4c72cf;var _0x342b70={'messageId':_0x334623[_0x1267('0x66')][_0x1267('0x69')],'read':!![]};return _0x3e58c0[_0x1267('0x10')](_0x342b70);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1267('0x64'),util[_0x1267('0x30')](_0x59022e,{'showHidden':![],'depth':null}));}})[_0x1267('0x13')](function(_0xd156b4){return logger[_0x1267('0x14')](_0x1267('0x21'),'afterCreate',_0x1267('0x64'),util['inspect'](_0xd156b4,{'showHidden':![],'depth':null}));});}else{return logger[_0x1267('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1267('0x22'),_0x1267('0x64'),'Token\x20not\x20received');}break;}}})[_0x1267('0x6b')](function(){_0x4685ee();});}else{_0x4685ee();}}},'charset':_0x1267('0x6c'),'collate':_0x1267('0x6d')});}; \ No newline at end of file +var _0x51b0=['senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','%s:%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','toLowerCase','direction','secret','isNil','UserId','SmsInteraction','then','update','createdAt','catch','error','out','find','SmsAccountId','type','accountSid','authToken','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel'];(function(_0x1edc5d,_0x2d7395){var _0x11dcb6=function(_0x5b61ce){while(--_0x5b61ce){_0x1edc5d['push'](_0x1edc5d['shift']());}};_0x11dcb6(++_0x2d7395);}(_0x51b0,0xaf));var _0x051b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x51b0[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x051b('0x0'));var util=require(_0x051b('0x1'));var logger=require(_0x051b('0x2'))(_0x051b('0x3'));var moment=require(_0x051b('0x4'));var BPromise=require(_0x051b('0x5'));var rp=require(_0x051b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x051b('0x7')]=function(_0x30835f,_0x16e891){return _0x30835f[_0x051b('0x8')](_0x051b('0x9'),attributes,{'tableName':_0x051b('0xa'),'paranoid':![],'indexes':[{'name':_0x051b('0xb'),'fields':[_0x051b('0xb')]},{'name':_0x051b('0xc'),'fields':[_0x051b('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10e4d8,_0x1c5a88,_0x2ac07f){var _0x2fbe26=_0x30835f[_0x051b('0xe')];var _0x595df8=_0x10e4d8[_0x051b('0xf')]({'plain':!![]});if(_0x595df8['direction'][_0x051b('0x10')]()==='in'||_0x595df8[_0x051b('0x11')][_0x051b('0x10')]()==='out'&&!_0x595df8[_0x051b('0x12')]&&!_[_0x051b('0x13')](_0x595df8[_0x051b('0x14')])){_0x2fbe26[_0x051b('0x15')]['findOne']({'where':{'id':_0x595df8['SmsInteractionId']}})[_0x051b('0x16')](function(_0x5d0ccd){if(_0x5d0ccd){_0x5d0ccd[_0x051b('0x17')]({'lastMsgAt':_0x595df8[_0x051b('0x18')],'lastMsgDirection':_0x595df8[_0x051b('0x11')]['toLowerCase']()});}})[_0x051b('0x19')](function(_0x248c3b){console[_0x051b('0x1a')](_0x248c3b);});}if(_0x595df8[_0x051b('0x11')]===_0x051b('0x1b')&&!_0x595df8[_0x051b('0x12')]){var _0x2d16ff;_0x2fbe26['SmsAccount'][_0x051b('0x1c')]({'where':{'id':_0x595df8[_0x051b('0x1d')]},'raw':!![]})[_0x051b('0x16')](function(_0x5622fe){_0x2d16ff=_0x5622fe;if(_0x2d16ff&&_0x2d16ff[_0x051b('0x1e')]){switch(_0x2d16ff['type']){case'twilio':var _0x11da4c=require('twilio');if(_0x2d16ff[_0x051b('0x1f')]&&_0x2d16ff['authToken']&&_0x2d16ff['phone']){var _0x5983fe=new _0x11da4c(_0x2d16ff[_0x051b('0x1f')],_0x2d16ff[_0x051b('0x20')]);_0x5983fe['messages'][_0x051b('0x21')]({'body':_0x595df8[_0x051b('0xd')],'to':_0x595df8[_0x051b('0x22')],'from':_0x2d16ff[_0x051b('0x22')],'statusCallback':_0x2d16ff[_0x051b('0x23')]+_0x051b('0x24')+_0x595df8['id']+_0x051b('0x25')+_0x2d16ff[_0x051b('0x26')]})[_0x051b('0x16')](function(_0x2fbc48){if(_0x2fbc48['sid']){return _0x10e4d8[_0x051b('0x17')]({'messageId':_0x2fbc48[_0x051b('0x27')]});}})['catch'](function(_0xd3cdcc){logger[_0x051b('0x1a')](_0x051b('0x28'),'afterCreate',_0x051b('0x29'),util[_0x051b('0x2a')](_0xd3cdcc,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x29'),_0x051b('0x2c'));}break;case _0x051b('0x2d'):var _0x39baf2=_0x051b('0x2e');if(_0x2d16ff[_0x051b('0x2f')]&&_0x2d16ff[_0x051b('0x30')]){var _0x7ce80={'recipient':[_0x595df8[_0x051b('0x22')]],'message':_0x595df8[_0x051b('0xd')],'message_type':_0x2d16ff['smsMethod']};if(_0x2d16ff['smsMethod']&&_0x2d16ff[_0x051b('0x31')]!=='SI'){_0x7ce80[_0x051b('0x32')]=_0x2d16ff[_0x051b('0x22')];}var _0x4b3b4a={'url':_0x39baf2+'login?username='+_0x2d16ff['username']+_0x051b('0x33')+_0x2d16ff[_0x051b('0x30')],'method':_0x051b('0x34')};rp(_0x4b3b4a)[_0x051b('0x16')](function(_0xfb11ad){var _0x201d88=_0xfb11ad['split'](';');var _0x38a75b={'user_key':_0x201d88[0x0],'session_key':_0x201d88[0x1]};_0x4b3b4a={'url':_0x39baf2+_0x051b('0x35'),'method':_0x051b('0x36'),'headers':{'user_key':_0x38a75b[_0x051b('0x37')],'Session_key':_0x38a75b[_0x051b('0x38')]},'json':!![],'body':_0x7ce80};return rp(_0x4b3b4a);})[_0x051b('0x16')](function(_0xf56869){if(_0xf56869[_0x051b('0x39')]>=0x1){var _0xa09f7c={'messageId':_0xf56869[_0x051b('0x3a')]};if(_0x2d16ff[_0x051b('0x31')]!=='GP'||!_0x2d16ff[_0x051b('0x3b')]){_0xa09f7c[_0x051b('0x3c')]=!![];}return _0x10e4d8[_0x051b('0x17')](_0xa09f7c);}else{return logger[_0x051b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x051b('0x2b'),_0x051b('0x2d'),util['inspect'](_0xf56869,{'showHidden':![],'depth':null}));}})['catch'](function(_0x122d7e){return logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x2d'),util['inspect'](_0x122d7e,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),'afterCreate','skebby',_0x051b('0x3d'));}break;case _0x051b('0x3e'):if(_0x2d16ff[_0x051b('0x20')]){var _0x23558e={'recipient':_0x595df8['phone'],'message':_0x595df8[_0x051b('0xd')],'sender':_0x2d16ff[_0x051b('0x3f')]||_0x2d16ff[_0x051b('0x22')],'authorization':_0x2d16ff['authToken']};var _0x1c5a88={'method':'POST','uri':_0x051b('0x40'),'body':_0x23558e,'json':!![]};rp(_0x1c5a88)[_0x051b('0x16')](function(_0x50f8aa){var _0x2661c2={'messageId':_0x50f8aa[_0x051b('0x41')]};if(!_0x2d16ff[_0x051b('0x3b')]){_0x2661c2['read']=!![];}return _0x10e4d8['update'](_0x2661c2);})[_0x051b('0x19')](function(_0x107a88){logger[_0x051b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x051b('0x2b'),'connectel',util[_0x051b('0x2a')](_0x107a88,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x3e'),_0x051b('0x42'));}break;case _0x051b('0x43'):if(_0x2d16ff[_0x051b('0x2f')]&&_0x2d16ff[_0x051b('0x30')]){var _0x23558e={'messages':[{'source':_0x051b('0x44'),'to':_0x595df8[_0x051b('0x22')],'body':_0x595df8[_0x051b('0xd')],'from':_0x2d16ff[_0x051b('0x3f')]||_0x2d16ff['phone']}]};var _0x5e06ff=util[_0x051b('0x45')]('%s:%s',_0x2d16ff[_0x051b('0x2f')],_0x2d16ff[_0x051b('0x30')]);var _0x1c5a88={'method':'POST','uri':_0x051b('0x46'),'body':_0x23558e,'headers':{'Authorization':util[_0x051b('0x45')](_0x051b('0x47'),new Buffer(_0x5e06ff)[_0x051b('0x48')](_0x051b('0x49')))},'json':!![]};rp(_0x1c5a88)['then'](function(_0x4345f6){if(_0x4345f6[_0x051b('0x4a')]>=0xc8&&_0x4345f6['http_code']<=0xce){if(_0x4345f6[_0x051b('0x4b')]&&_0x4345f6[_0x051b('0x4b')][_0x051b('0x4c')]>0x0){var _0x2e1248=_['head'](_0x4345f6[_0x051b('0x4b')]['messages']);var _0x179e61={'messageId':_0x2e1248[_0x051b('0x4d')]};if(!_0x2d16ff[_0x051b('0x3b')]){_0x179e61[_0x051b('0x3c')]=!![];}return _0x10e4d8[_0x051b('0x17')](_0x179e61);}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x4e'),util[_0x051b('0x2a')](_0x4345f6,{'showHidden':![],'depth':null}));}}else{logger[_0x051b('0x1a')](_0x051b('0x28'),'afterCreate',_0x051b('0x4e'),util[_0x051b('0x2a')](_0x4345f6,{'showHidden':![],'depth':null}));}})[_0x051b('0x19')](function(_0x5bc969){logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x4e'),util[_0x051b('0x2a')](_0x5bc969,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x4e'),_0x051b('0x3d'));}break;case _0x051b('0x4f'):if(_0x2d16ff[_0x051b('0x50')]&&_0x2d16ff[_0x051b('0x20')]){var _0x23558e={'dst':_0x595df8[_0x051b('0x22')],'text':_0x595df8[_0x051b('0xd')],'src':_0x2d16ff[_0x051b('0x3f')]||_0x2d16ff[_0x051b('0x22')],'url':_0x2d16ff[_0x051b('0x23')]+_0x051b('0x24')+_0x595df8['id']+_0x051b('0x25')+_0x2d16ff[_0x051b('0x26')]};var _0x5e06ff=util[_0x051b('0x45')](_0x051b('0x51'),_0x2d16ff[_0x051b('0x50')],_0x2d16ff['authToken']);var _0x1c5a88={'method':'POST','uri':util[_0x051b('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2d16ff[_0x051b('0x50')]),'body':_0x23558e,'headers':{'Authorization':util[_0x051b('0x45')](_0x051b('0x47'),new Buffer(_0x5e06ff)[_0x051b('0x48')](_0x051b('0x49')))},'json':!![]};rp(_0x1c5a88)[_0x051b('0x16')](function(_0x37285c){var _0x4e3936={'messageId':_0x37285c[_0x051b('0x52')][0x0]};return _0x10e4d8[_0x051b('0x17')](_0x4e3936);})[_0x051b('0x19')](function(_0x20dee6){logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x4f'),util[_0x051b('0x2a')](_0x20dee6,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x4f'),_0x051b('0x53'));}break;case _0x051b('0x54'):if(_0x2d16ff[_0x051b('0x2f')]&&_0x2d16ff['password']){if(_0x2d16ff[_0x051b('0x55')]){var _0x323098={'method':'POST','uri':_0x2d16ff['baseUrl']+_0x051b('0x56'),'body':{'username':_0x2d16ff['username'],'password':_0x2d16ff[_0x051b('0x30')]},'json':!![]};return rp(_0x323098)[_0x051b('0x16')](function(_0x2408ac){var _0x5694fd={'method':_0x051b('0x36'),'uri':_0x2d16ff[_0x051b('0x55')]+_0x051b('0x57'),'body':{'messages':[{'from':_0x2d16ff['phone'],'destinations':[{'to':_0x595df8[_0x051b('0x22')]}],'text':_0x595df8[_0x051b('0xd')],'notifyUrl':_0x2d16ff[_0x051b('0x23')]+_0x051b('0x24')+_0x595df8['id']+_0x051b('0x25')+_0x2d16ff['token'],'notifyContentType':_0x051b('0x58'),'callbackData':_0x2d16ff[_0x051b('0x22')]+';'+_0x595df8[_0x051b('0xd')]}]},'headers':{'Authorization':_0x051b('0x59')+_0x2408ac[_0x051b('0x26')]},'json':!![]};return rp(_0x5694fd)[_0x051b('0x16')](function(_0x46ce4e){if(_0x46ce4e[_0x051b('0x5a')]){var _0x59dcb1={'messageId':_0x46ce4e[_0x051b('0x5a')][0x0][_0x051b('0xb')]};if(!_0x2d16ff['deliveryReport']){_0x59dcb1[_0x051b('0x3c')]=!![];}return _0x10e4d8[_0x051b('0x17')](_0x59dcb1);}else{return logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x54'),util[_0x051b('0x2a')](_0x46ce4e,{'showHidden':![],'depth':null}));}});})[_0x051b('0x19')](function(_0x35d5a6){return logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),'infobip',util['inspect'](_0x35d5a6,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),'afterCreate',_0x051b('0x54'),_0x051b('0x5b'));}}else{logger[_0x051b('0x1a')](_0x051b('0x28'),'afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x051b('0x5c'):var _0x1c6a62=require(_0x051b('0x5d'));if(_0x2d16ff[_0x051b('0x5e')]){var _0x29dd86={};_0x29dd86[_0x051b('0x5f')]=_0x2d16ff[_0x051b('0x2f')];_0x29dd86[_0x051b('0x22')]=_0x595df8[_0x051b('0x22')];_0x29dd86[_0x051b('0x32')]=_0x2d16ff[_0x051b('0x22')];_0x29dd86[_0x051b('0x60')]=_0x595df8[_0x051b('0xd')];_0x29dd86['timestamp']=+new Date();var _0x157594='';var _0x36cf1e='';var _0x479721=Object[_0x051b('0x61')](_0x29dd86);_0x479721[_0x051b('0x62')]();for(var _0x4568fb=0x0;_0x4568fb<_0x479721[_0x051b('0x63')];_0x4568fb++){if(_0x157594!=''){_0x157594+='&';}_0x157594+=_0x479721[_0x4568fb]+'='+encodeURIComponent(_0x29dd86[_0x479721[_0x4568fb]]);_0x36cf1e+=_0x29dd86[_0x479721[_0x4568fb]];}_0x36cf1e+=_0x2d16ff[_0x051b('0x5e')];_0x36cf1e=_0x1c6a62[_0x051b('0x64')](_0x051b('0x65'))[_0x051b('0x17')](_0x36cf1e)[_0x051b('0x66')]('hex');if(_0x157594!==''){_0x157594+='&';}_0x157594+=_0x051b('0x67')+_0x36cf1e;var _0x4b3b4a={'method':_0x051b('0x34'),'uri':_0x2d16ff[_0x051b('0x55')]+_0x051b('0x68')+_0x157594,'json':!![]};return rp(_0x4b3b4a)[_0x051b('0x16')](function(_0x23c35e){var _0x531345=Object[_0x051b('0x61')](_0x23c35e);if(_0x23c35e[_0x531345[0x0]][_0x051b('0x1a')]&&parseInt(_0x23c35e[_0x531345[0x0]][_0x051b('0x1a')])===0x0){var _0x2e2d41={'messageId':_0x23c35e[_0x531345[0x0]]['id_sms']};if(!_0x2d16ff[_0x051b('0x3b')]){_0x2e2d41['read']=!![];}return _0x10e4d8['update'](_0x2e2d41);}else{return logger[_0x051b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x051b('0x2b'),'csc',util[_0x051b('0x2a')](_0x23c35e[_0x051b('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x32a55a){return logger[_0x051b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x051b('0x2b'),_0x051b('0x5c'),util[_0x051b('0x2a')](_0x32a55a,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x5c'),'Missing\x20parameters:\x20apiKey');}break;case _0x051b('0x69'):if(_0x2d16ff[_0x051b('0x5e')]){var _0x123ca4={'method':_0x051b('0x36'),'uri':_0x051b('0x6a'),'headers':{'Authorization':_0x2d16ff[_0x051b('0x5e')]},'body':{'content':_0x595df8[_0x051b('0xd')],'to':[_0x595df8[_0x051b('0x22')]],'from':_0x2d16ff[_0x051b('0x22')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x123ca4)[_0x051b('0x16')](function(_0x5aa04e){if(!_0x5aa04e[_0x051b('0x1a')]){var _0x3ec860={'messageId':_0x5aa04e['messages'][0x0]['apiMessageId']};if(!_0x2d16ff[_0x051b('0x3b')]){_0x3ec860[_0x051b('0x3c')]=!![];}return _0x10e4d8['update'](_0x3ec860);}else{return logger['error'](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x69'),util[_0x051b('0x2a')](_0x5aa04e[_0x051b('0x1a')],{'showHidden':![],'depth':null}));}})[_0x051b('0x19')](function(_0x29f131){return logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x69'),util['inspect'](_0x29f131,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x69'),_0x051b('0x6b'));}break;case _0x051b('0x6c'):if(_0x2d16ff[_0x051b('0x2f')]&&_0x2d16ff[_0x051b('0x30')]){var _0x5e06ff=util[_0x051b('0x45')](_0x051b('0x51'),_0x2d16ff['username'],_0x2d16ff['password']);var _0x1c5a88={'method':_0x051b('0x36'),'uri':_0x051b('0x6d')+_0x2d16ff['accountId']+_0x051b('0x6e'),'body':{'to':[_0x595df8[_0x051b('0x22')]],'text':_0x595df8[_0x051b('0xd')],'from':_0x2d16ff[_0x051b('0x22')],'applicationId':_0x2d16ff[_0x051b('0x6f')]},'headers':{'Authorization':util[_0x051b('0x45')](_0x051b('0x47'),new Buffer(_0x5e06ff)[_0x051b('0x48')]('base64'))},'json':!![]};rp(_0x1c5a88)['then'](function(_0x2e6b85){if(_0x2e6b85['id']){var _0x1aa8c7={'messageId':_0x2e6b85['id']};return _0x10e4d8[_0x051b('0x17')](_0x1aa8c7);}else{logger[_0x051b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x051b('0x2b'),'bandwidth',util[_0x051b('0x2a')](_0x2e6b85,{'showHidden':![],'depth':null}));}})[_0x051b('0x19')](function(_0x32db37){logger[_0x051b('0x1a')](_0x051b('0x28'),'afterCreate',_0x051b('0x6c'),util[_0x051b('0x2a')](_0x32db37,{'showHidden':![],'depth':null}));});}else{logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),_0x051b('0x6c'),_0x051b('0x3d'));}break;case _0x051b('0x70'):if(_0x2d16ff[_0x051b('0x5e')]){var _0x369030={};var _0x4b3b4a={'method':_0x051b('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x051b('0x71')+_0x2d16ff[_0x051b('0x5e')],'Content-Type':_0x051b('0x58')},'body':{'from':_0x2d16ff[_0x051b('0x22')],'to':_0x595df8[_0x051b('0x22')],'text':_0x595df8[_0x051b('0xd')]},'json':!![]};return rp(_0x4b3b4a)[_0x051b('0x16')](function(_0x3049b7){if(_0x3049b7[_0x051b('0x72')]==0xca){_0x369030['message']=_0x3049b7;var _0x284d93={'method':'POST','uri':_0x051b('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x2d16ff[_0x051b('0x5e')],'Content-Type':_0x051b('0x58')},'body':{'refid':_0x369030[_0x051b('0x74')][_0x051b('0x75')]},'json':!![]};return rp(_0x284d93)[_0x051b('0x16')](function(_0x1441bb){_0x369030[_0x051b('0x76')]=_0x1441bb;var _0x366918={'messageId':_0x369030[_0x051b('0x74')][_0x051b('0x75')],'read':!![]};return _0x10e4d8['update'](_0x366918);});}else{return logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),'intelepeer',util[_0x051b('0x2a')](_0x3049b7,{'showHidden':![],'depth':null}));}})[_0x051b('0x19')](function(_0x3ec8de){return logger[_0x051b('0x1a')](_0x051b('0x28'),_0x051b('0x2b'),'intelepeer',util[_0x051b('0x2a')](_0x3ec8de,{'showHidden':![],'depth':null}));});}else{return logger[_0x051b('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x051b('0x2b'),_0x051b('0x70'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x2ac07f();});}else{_0x2ac07f();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2cd5763..7c7d965 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64bc=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','util'];(function(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0x64bc,0x128));var _0xc64b=function(_0x3f1478,_0xb54c58){_0x3f1478=_0x3f1478-0x0;var _0x5b84f2=_0x64bc[_0x3f1478];return _0x5b84f2;};'use strict';var _=require('lodash');var util=require(_0xc64b('0x0'));var moment=require(_0xc64b('0x1'));var BPromise=require(_0xc64b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc64b('0x3'));var db=require(_0xc64b('0x4'))['db'];var utils=require(_0xc64b('0x5'));var logger=require(_0xc64b('0x6'))(_0xc64b('0x7'));var config=require(_0xc64b('0x8'));var jayson=require(_0xc64b('0x9'));var client=jayson[_0xc64b('0xa')]['http']({'port':0x232a});config[_0xc64b('0xb')]=_[_0xc64b('0xc')](config[_0xc64b('0xb')],{'host':_0xc64b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc64b('0xe'))[_0xc64b('0xf')](socket);function respondWithRpcPromise(_0xc4f60,_0x4a8e79,_0x2fd8c0){return new BPromise(function(_0x121b75,_0xabb5aa){return client[_0xc64b('0x10')](_0xc4f60,_0x2fd8c0)[_0xc64b('0x11')](function(_0x1aa99a){logger[_0xc64b('0x12')](_0xc64b('0x13'),_0x4a8e79,_0xc64b('0x14'));logger['debug'](_0xc64b('0x15'),_0x4a8e79,_0xc64b('0x14'),JSON['stringify'](_0x1aa99a));if(_0x1aa99a['error']){if(_0x1aa99a[_0xc64b('0x16')][_0xc64b('0x17')]===0x1f4){logger[_0xc64b('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4a8e79,_0x1aa99a[_0xc64b('0x16')][_0xc64b('0x18')]);return _0xabb5aa(_0x1aa99a[_0xc64b('0x16')]['message']);}logger[_0xc64b('0x16')]('SmsMessage,\x20%s,\x20%s',_0x4a8e79,_0x1aa99a['error'][_0xc64b('0x18')]);return _0x121b75(_0x1aa99a[_0xc64b('0x16')][_0xc64b('0x18')]);}else{logger[_0xc64b('0x12')]('SmsMessage,\x20%s,\x20%s',_0x4a8e79,'request\x20sent');_0x121b75(_0x1aa99a[_0xc64b('0x19')]['message']);}})[_0xc64b('0x1a')](function(_0x46e189){logger['error'](_0xc64b('0x13'),_0x4a8e79,_0x46e189);_0xabb5aa(_0x46e189);});});}exports['CreateSmsMessage']=function(_0x5189c1){var _0x2550dd=this;return new Promise(function(_0x1bbd86,_0xb10efd){return db[_0xc64b('0x1b')][_0xc64b('0x1c')](_0x5189c1[_0xc64b('0x1d')],{'raw':_0x5189c1[_0xc64b('0x1e')]?_0x5189c1[_0xc64b('0x1e')][_0xc64b('0x1f')]===undefined?!![]:![]:!![]})[_0xc64b('0x11')](function(_0x2bcb47){logger[_0xc64b('0x12')]('CreateSmsMessage',_0x5189c1);logger['debug']('CreateSmsMessage',_0x5189c1,JSON['stringify'](_0x2bcb47));_0x1bbd86(_0x2bcb47);})[_0xc64b('0x1a')](function(_0x28c17f){logger[_0xc64b('0x16')](_0xc64b('0x20'),_0x28c17f[_0xc64b('0x18')],_0x5189c1);_0xb10efd(_0x2550dd['error'](0x1f4,_0x28c17f[_0xc64b('0x18')]));});});}; \ No newline at end of file +var _0x1eed=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','info','CreateSmsMessage','debug','lodash'];(function(_0x390c9f,_0x61223f){var _0x254966=function(_0x2cd53b){while(--_0x2cd53b){_0x390c9f['push'](_0x390c9f['shift']());}};_0x254966(++_0x61223f);}(_0x1eed,0x1d3));var _0xd1ee=function(_0x358a76,_0x24a24f){_0x358a76=_0x358a76-0x0;var _0x37bb4f=_0x1eed[_0x358a76];return _0x37bb4f;};'use strict';var _=require(_0xd1ee('0x0'));var util=require(_0xd1ee('0x1'));var moment=require(_0xd1ee('0x2'));var BPromise=require(_0xd1ee('0x3'));var rs=require(_0xd1ee('0x4'));var fs=require('fs');var Redis=require(_0xd1ee('0x5'));var db=require(_0xd1ee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1ee('0x7'))(_0xd1ee('0x8'));var config=require(_0xd1ee('0x9'));var jayson=require(_0xd1ee('0xa'));var client=jayson[_0xd1ee('0xb')]['http']({'port':0x232a});config[_0xd1ee('0xc')]=_[_0xd1ee('0xd')](config[_0xd1ee('0xc')],{'host':_0xd1ee('0xe'),'port':0x18eb});var socket=require(_0xd1ee('0xf'))(new Redis(config[_0xd1ee('0xc')]));require(_0xd1ee('0x10'))[_0xd1ee('0x11')](socket);function respondWithRpcPromise(_0xf12e5a,_0x238e56,_0x57ac8e){return new BPromise(function(_0x336822,_0x8a484e){return client[_0xd1ee('0x12')](_0xf12e5a,_0x57ac8e)[_0xd1ee('0x13')](function(_0x3a899c){logger['info']('SmsMessage,\x20%s,\x20%s',_0x238e56,'request\x20sent');logger['debug'](_0xd1ee('0x14'),_0x238e56,_0xd1ee('0x15'),JSON[_0xd1ee('0x16')](_0x3a899c));if(_0x3a899c[_0xd1ee('0x17')]){if(_0x3a899c[_0xd1ee('0x17')][_0xd1ee('0x18')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x238e56,_0x3a899c[_0xd1ee('0x17')][_0xd1ee('0x19')]);return _0x8a484e(_0x3a899c[_0xd1ee('0x17')][_0xd1ee('0x19')]);}logger[_0xd1ee('0x17')](_0xd1ee('0x1a'),_0x238e56,_0x3a899c[_0xd1ee('0x17')][_0xd1ee('0x19')]);return _0x336822(_0x3a899c[_0xd1ee('0x17')]['message']);}else{logger['info'](_0xd1ee('0x1a'),_0x238e56,_0xd1ee('0x15'));_0x336822(_0x3a899c[_0xd1ee('0x1b')][_0xd1ee('0x19')]);}})[_0xd1ee('0x1c')](function(_0x48f8da){logger[_0xd1ee('0x17')](_0xd1ee('0x1a'),_0x238e56,_0x48f8da);_0x8a484e(_0x48f8da);});});}exports['CreateSmsMessage']=function(_0x238abc){var _0x465aad=this;return new Promise(function(_0x5d72f4,_0xbe5734){return db['SmsMessage'][_0xd1ee('0x1d')](_0x238abc[_0xd1ee('0x1e')],{'raw':_0x238abc[_0xd1ee('0x1f')]?_0x238abc['options'][_0xd1ee('0x20')]===undefined?!![]:![]:!![]})[_0xd1ee('0x13')](function(_0x582689){logger[_0xd1ee('0x21')](_0xd1ee('0x22'),_0x238abc);logger[_0xd1ee('0x23')]('CreateSmsMessage',_0x238abc,JSON['stringify'](_0x582689));_0x5d72f4(_0x582689);})[_0xd1ee('0x1c')](function(_0x238cd2){logger[_0xd1ee('0x17')]('CreateSmsMessage',_0x238cd2['message'],_0x238abc);_0xbe5734(_0x465aad[_0xd1ee('0x17')](0x1f4,_0x238cd2[_0xd1ee('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a0a3335..b4e5c5c 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf543=['smsMessage:','save','emit','removeListener','register'];(function(_0x233f9d,_0x12d794){var _0x511bf5=function(_0x1a4ad0){while(--_0x1a4ad0){_0x233f9d['push'](_0x233f9d['shift']());}};_0x511bf5(++_0x12d794);}(_0xf543,0xba));var _0x3f54=function(_0x1da3c5,_0x555675){_0x1da3c5=_0x1da3c5-0x0;var _0x200fc4=_0xf543[_0x1da3c5];return _0x200fc4;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x3f54('0x0'),'remove','update'];function createListener(_0x12a9a9,_0x3d6bf3){return function(_0x4087af){_0x3d6bf3[_0x3f54('0x1')](_0x12a9a9,_0x4087af);};}function removeListener(_0xe5af91,_0x2d83c9){return function(){SmsMessageEvents[_0x3f54('0x2')](_0xe5af91,_0x2d83c9);};}exports[_0x3f54('0x3')]=function(_0x109d0f){for(var _0x1a0800=0x0,_0x57779c=events['length'];_0x1a0800<_0x57779c;_0x1a0800++){var _0x9add35=events[_0x1a0800];var _0x45debb=createListener(_0x3f54('0x4')+_0x9add35,_0x109d0f);SmsMessageEvents['on'](_0x9add35,_0x45debb);}}; \ No newline at end of file +var _0x80b7=['smsMessage:','./smsMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x4d507f,_0x4bb2b2){var _0x5027b9=function(_0x1865cc){while(--_0x1865cc){_0x4d507f['push'](_0x4d507f['shift']());}};_0x5027b9(++_0x4bb2b2);}(_0x80b7,0x151));var _0x780b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x80b7[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x780b('0x0'));var events=['save',_0x780b('0x1'),_0x780b('0x2')];function createListener(_0x3ca8fe,_0x5238e6){return function(_0x39d1e2){_0x5238e6[_0x780b('0x3')](_0x3ca8fe,_0x39d1e2);};}function removeListener(_0x526fe0,_0x3e5d05){return function(){SmsMessageEvents[_0x780b('0x4')](_0x526fe0,_0x3e5d05);};}exports[_0x780b('0x5')]=function(_0xa6e70c){for(var _0x4c29d4=0x0,_0x493e2b=events[_0x780b('0x6')];_0x4c29d4<_0x493e2b;_0x4c29d4++){var _0x54e278=events[_0x4c29d4];var _0x1e894c=createListener(_0x780b('0x7')+_0x54e278,_0xa6e70c);SmsMessageEvents['on'](_0x54e278,_0x1e894c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index aacf304..f8a90fb 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9de=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x1f00a1,_0x36824f){var _0x4cb8ba=function(_0x45770d){while(--_0x45770d){_0x1f00a1['push'](_0x1f00a1['shift']());}};_0x4cb8ba(++_0x36824f);}(_0xd9de,0x108));var _0xed9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd9de[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed9d('0x0'));var util=require('util');var path=require(_0xed9d('0x1'));var timeout=require(_0xed9d('0x2'));var express=require(_0xed9d('0x3'));var router=express[_0xed9d('0x4')]();var fs_extra=require(_0xed9d('0x5'));var auth=require(_0xed9d('0x6'));var interaction=require(_0xed9d('0x7'));var config=require(_0xed9d('0x8'));var controller=require(_0xed9d('0x9'));router[_0xed9d('0xa')]('/',auth['isAuthenticated'](),controller[_0xed9d('0xb')]);router[_0xed9d('0xa')](_0xed9d('0xc'),auth[_0xed9d('0xd')](),controller[_0xed9d('0xe')]);router[_0xed9d('0xa')](_0xed9d('0xf'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x10')]);router[_0xed9d('0xa')](_0xed9d('0x11'),auth['isAuthenticated'](),controller[_0xed9d('0x12')]);router[_0xed9d('0xa')](_0xed9d('0x13'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x14')]);router[_0xed9d('0xa')]('/:id/users',auth[_0xed9d('0xd')](),controller[_0xed9d('0x15')]);router[_0xed9d('0x16')]('/',auth[_0xed9d('0xd')](),controller['create']);router[_0xed9d('0x16')](_0xed9d('0x13'),auth[_0xed9d('0xd')](),controller['addTeams']);router['post'](_0xed9d('0x17'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x18')]);router[_0xed9d('0x19')](_0xed9d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xed9d('0x1a')](_0xed9d('0xf'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x1b')]);router[_0xed9d('0x1a')](_0xed9d('0x13'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x1c')]);router[_0xed9d('0x1a')](_0xed9d('0x17'),auth[_0xed9d('0xd')](),controller[_0xed9d('0x1d')]);module[_0xed9d('0x1e')]=router; \ No newline at end of file +var _0xce99=['isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','index','/describe'];(function(_0x3f18aa,_0x42497f){var _0x12d513=function(_0x124679){while(--_0x124679){_0x3f18aa['push'](_0x3f18aa['shift']());}};_0x12d513(++_0x42497f);}(_0xce99,0x168));var _0x9ce9=function(_0x34e184,_0x3ac0f8){_0x34e184=_0x34e184-0x0;var _0x1f6936=_0xce99[_0x34e184];return _0x1f6936;};'use strict';var multer=require(_0x9ce9('0x0'));var util=require(_0x9ce9('0x1'));var path=require(_0x9ce9('0x2'));var timeout=require(_0x9ce9('0x3'));var express=require('express');var router=express[_0x9ce9('0x4')]();var fs_extra=require(_0x9ce9('0x5'));var auth=require(_0x9ce9('0x6'));var interaction=require(_0x9ce9('0x7'));var config=require('../../config/environment');var controller=require(_0x9ce9('0x8'));router[_0x9ce9('0x9')]('/',auth['isAuthenticated'](),controller[_0x9ce9('0xa')]);router[_0x9ce9('0x9')](_0x9ce9('0xb'),auth[_0x9ce9('0xc')](),controller['describe']);router[_0x9ce9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9ce9('0xd')]);router['get'](_0x9ce9('0xe'),auth[_0x9ce9('0xc')](),controller[_0x9ce9('0xf')]);router[_0x9ce9('0x9')](_0x9ce9('0x10'),auth[_0x9ce9('0xc')](),controller[_0x9ce9('0x11')]);router[_0x9ce9('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x9ce9('0x12')]);router[_0x9ce9('0x13')]('/',auth[_0x9ce9('0xc')](),controller[_0x9ce9('0x14')]);router['post'](_0x9ce9('0x10'),auth['isAuthenticated'](),controller[_0x9ce9('0x15')]);router['post'](_0x9ce9('0x16'),auth[_0x9ce9('0xc')](),controller[_0x9ce9('0x17')]);router[_0x9ce9('0x18')](_0x9ce9('0x19'),auth[_0x9ce9('0xc')](),controller[_0x9ce9('0x1a')]);router[_0x9ce9('0x1b')](_0x9ce9('0x19'),auth[_0x9ce9('0xc')](),controller[_0x9ce9('0x1c')]);router[_0x9ce9('0x1b')](_0x9ce9('0x10'),auth['isAuthenticated'](),controller[_0x9ce9('0x1d')]);router['delete'](_0x9ce9('0x16'),auth[_0x9ce9('0xc')](),controller[_0x9ce9('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index a2ce192..501f05f 100644 --- a/server/api/smsQueue/smsQueue.attributes.js +++ b/server/api/smsQueue/smsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa59d=['STRING','name','beepall','sequelize','exports'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xa59d,0x166));var _0xda59=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa59d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xda59('0x0'));module[_0xda59('0x1')]={'name':{'type':Sequelize[_0xda59('0x2')],'unique':_0xda59('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xda59('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xda59('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x8bc1=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bc1,0x14c));var _0x18bc=function(_0x2c58af,_0x363e5d){_0x2c58af=_0x2c58af-0x0;var _0x4d8f99=_0x8bc1[_0x2c58af];return _0x4d8f99;};'use strict';var Sequelize=require(_0x18bc('0x0'));module[_0x18bc('0x1')]={'name':{'type':Sequelize[_0x18bc('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x18bc('0x2')]},'timeout':{'type':Sequelize[_0x18bc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x18bc('0x4')](_0x18bc('0x5'),_0x18bc('0x6'),_0x18bc('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4954f51..703db12 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ce7=['../../mysqldb','redis','localhost','./smsQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','render','contact','agent','interaction','account','SmsQueue','rawAttributes','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','length','body','user','get','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','online','interface','flatMap','sequelize','addTeams','each','forEach','emit','userSmsQueue:save','ids','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','union','value','transaction','removeTeams','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6ce7,0x18c));var _0x76ce=function(_0x250c06,_0x22cabf){_0x250c06=_0x250c06-0x0;var _0x476a03=_0x6ce7[_0x250c06];return _0x476a03;};'use strict';var emlformat=require(_0x76ce('0x0'));var rimraf=require(_0x76ce('0x1'));var zipdir=require(_0x76ce('0x2'));var jsonpatch=require(_0x76ce('0x3'));var rp=require(_0x76ce('0x4'));var moment=require('moment');var BPromise=require(_0x76ce('0x5'));var Mustache=require(_0x76ce('0x6'));var util=require(_0x76ce('0x7'));var path=require(_0x76ce('0x8'));var sox=require('sox');var csv=require(_0x76ce('0x9'));var ejs=require(_0x76ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76ce('0xb'));var squel=require(_0x76ce('0xc'));var crypto=require(_0x76ce('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x76ce('0xe'));var toCsv=require(_0x76ce('0x9'));var querystring=require(_0x76ce('0xf'));var Papa=require(_0x76ce('0x10'));var Redis=require(_0x76ce('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76ce('0x12'));var logger=require(_0x76ce('0x13'))(_0x76ce('0x14'));var utils=require(_0x76ce('0x15'));var config=require(_0x76ce('0x16'));var licenseUtil=require(_0x76ce('0x17'));var db=require(_0x76ce('0x18'))['db'];config[_0x76ce('0x19')]=_['defaults'](config['redis'],{'host':_0x76ce('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x76ce('0x1b'))['register'](socket);function respondWithStatusCode(_0x44a533,_0x17964d){_0x17964d=_0x17964d||0xcc;return function(_0x59adf4){if(_0x59adf4){return _0x44a533[_0x76ce('0x1c')](_0x17964d);}return _0x44a533[_0x76ce('0x1d')](_0x17964d)['end']();};}function respondWithResult(_0x52622b,_0x44a5a9){_0x44a5a9=_0x44a5a9||0xc8;return function(_0x1566f3){if(_0x1566f3){return _0x52622b[_0x76ce('0x1d')](_0x44a5a9)[_0x76ce('0x1e')](_0x1566f3);}};}function respondWithFilteredResult(_0x3f8b9a,_0x1bc90b){return function(_0x533520){if(_0x533520){var _0x2c3fc2=typeof _0x1bc90b[_0x76ce('0x1f')]===_0x76ce('0x20')&&typeof _0x1bc90b[_0x76ce('0x21')]===_0x76ce('0x20');var _0x58158b=_0x533520[_0x76ce('0x22')];var _0x37a5a9=_0x2c3fc2?0x0:_0x1bc90b[_0x76ce('0x1f')];var _0x521ef0=_0x2c3fc2?_0x533520[_0x76ce('0x22')]:_0x1bc90b['offset']+_0x1bc90b[_0x76ce('0x21')];var _0x40b26f;if(_0x521ef0>=_0x58158b){_0x521ef0=_0x58158b;_0x40b26f=0xc8;}else{_0x40b26f=0xce;}_0x3f8b9a[_0x76ce('0x1d')](_0x40b26f);return _0x3f8b9a[_0x76ce('0x23')](_0x76ce('0x24'),_0x37a5a9+'-'+_0x521ef0+'/'+_0x58158b)[_0x76ce('0x1e')](_0x533520);}return null;};}function patchUpdates(_0x43713a){return function(_0x52fbc9){try{jsonpatch[_0x76ce('0x25')](_0x52fbc9,_0x43713a,!![]);}catch(_0x3df652){return BPromise[_0x76ce('0x26')](_0x3df652);}return _0x52fbc9[_0x76ce('0x27')]();};}function saveUpdates(_0x2fb321,_0x43f3b8){return function(_0x5a1fdd){if(_0x5a1fdd){return _0x5a1fdd[_0x76ce('0x28')](_0x2fb321)[_0x76ce('0x29')](function(_0xd29ffe){return _0xd29ffe;});}return null;};}function removeEntity(_0x20ecbc,_0x1f1164){return function(_0x3a3982){if(_0x3a3982){return _0x3a3982[_0x76ce('0x2a')]()[_0x76ce('0x29')](function(){var _0x59f28c=_0x3a3982['get']({'plain':!![]});var _0xa02e8f=_0x76ce('0x2b');return db[_0x76ce('0x2c')][_0x76ce('0x2a')]({'where':{'type':_0xa02e8f,'resourceId':_0x59f28c['id']}})[_0x76ce('0x29')](function(){return _0x3a3982;});})[_0x76ce('0x29')](function(){_0x20ecbc[_0x76ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7d04,_0x1ac47c){return function(_0x9bfb83){if(!_0x9bfb83){_0x1a7d04['sendStatus'](0x194);}return _0x9bfb83;};}function handleError(_0x2ba916,_0x5b9ac1){_0x5b9ac1=_0x5b9ac1||0x1f4;return function(_0x58fe6f){logger[_0x76ce('0x2d')](_0x58fe6f[_0x76ce('0x2e')]);if(_0x58fe6f[_0x76ce('0x2f')]){delete _0x58fe6f[_0x76ce('0x2f')];}_0x2ba916[_0x76ce('0x1d')](_0x5b9ac1)[_0x76ce('0x30')](_0x58fe6f);};}function getMustacheRender(_0x215710,_0x47c194){return Mustache[_0x76ce('0x31')](_0x215710,_['merge'](_0x47c194['body'],{'contact':_0x47c194[_0x76ce('0x32')],'message':_0x47c194['message'],'agent':_0x47c194[_0x76ce('0x33')],'interaction':_0x47c194[_0x76ce('0x34')],'account':_0x47c194[_0x76ce('0x35')]}))||'';}exports['index']=function(_0x1364e4,_0xfa84a8){var _0x2fe72d={},_0x559c84={},_0x1e3355={'count':0x0,'rows':[]};var _0x21623f=_['map'](db[_0x76ce('0x36')][_0x76ce('0x37')],function(_0x8e6db0){return{'name':_0x8e6db0['fieldName'],'type':_0x8e6db0['type'][_0x76ce('0x38')]};});_0x559c84[_0x76ce('0x39')]=_[_0x76ce('0x3a')](_0x21623f,_0x76ce('0x2f'));_0x559c84[_0x76ce('0x3b')]=_['keys'](_0x1364e4[_0x76ce('0x3b')]);_0x559c84[_0x76ce('0x3c')]=_['intersection'](_0x559c84['model'],_0x559c84[_0x76ce('0x3b')]);_0x2fe72d['attributes']=_[_0x76ce('0x3d')](_0x559c84['model'],qs['fields'](_0x1364e4[_0x76ce('0x3b')]['fields']));_0x2fe72d[_0x76ce('0x3e')]=_0x2fe72d[_0x76ce('0x3e')]['length']?_0x2fe72d[_0x76ce('0x3e')]:_0x559c84['model'];if(!_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x3f')](_0x76ce('0x40'))){_0x2fe72d[_0x76ce('0x21')]=qs[_0x76ce('0x21')](_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x21')]);_0x2fe72d[_0x76ce('0x1f')]=qs[_0x76ce('0x1f')](_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x1f')]);}_0x2fe72d[_0x76ce('0x41')]=qs[_0x76ce('0x42')](_0x1364e4[_0x76ce('0x3b')]['sort']);_0x2fe72d[_0x76ce('0x43')]=qs[_0x76ce('0x3c')](_[_0x76ce('0x44')](_0x1364e4[_0x76ce('0x3b')],_0x559c84[_0x76ce('0x3c')]),_0x21623f);if(_0x1364e4[_0x76ce('0x3b')]['filter']){_0x2fe72d[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x2fe72d['where'],{'$or':_[_0x76ce('0x3a')](_0x21623f,function(_0x1a0539){if(_0x1a0539[_0x76ce('0x46')]!=='VIRTUAL'){var _0x2705df={};_0x2705df[_0x1a0539[_0x76ce('0x2f')]]={'$like':'%'+_0x1364e4[_0x76ce('0x3b')][_0x76ce('0x47')]+'%'};return _0x2705df;}})});}_0x2fe72d=_[_0x76ce('0x45')]({},_0x2fe72d,_0x1364e4[_0x76ce('0x48')]);var _0x3ab641={'where':_0x2fe72d[_0x76ce('0x43')]};return db[_0x76ce('0x36')][_0x76ce('0x22')](_0x3ab641)[_0x76ce('0x29')](function(_0x15b661){_0x1e3355[_0x76ce('0x22')]=_0x15b661;if(_0x1364e4['query'][_0x76ce('0x49')]){_0x2fe72d[_0x76ce('0x4a')]=[{'all':!![]}];}return db[_0x76ce('0x36')][_0x76ce('0x4b')](_0x2fe72d);})[_0x76ce('0x29')](function(_0x5ea062){_0x1e3355[_0x76ce('0x4c')]=_0x5ea062;return _0x1e3355;})['then'](respondWithFilteredResult(_0xfa84a8,_0x2fe72d))[_0x76ce('0x4d')](handleError(_0xfa84a8,null));};exports[_0x76ce('0x4e')]=function(_0x10a40c,_0x219eed){var _0x52a9c7={'raw':!![],'where':{'id':_0x10a40c[_0x76ce('0x4f')]['id']}},_0x4e3a6e={};_0x4e3a6e[_0x76ce('0x39')]=_[_0x76ce('0x50')](db[_0x76ce('0x36')][_0x76ce('0x37')]);_0x4e3a6e[_0x76ce('0x3b')]=_['keys'](_0x10a40c[_0x76ce('0x3b')]);_0x4e3a6e['filters']=_['intersection'](_0x4e3a6e[_0x76ce('0x39')],_0x4e3a6e['query']);_0x52a9c7['attributes']=_[_0x76ce('0x3d')](_0x4e3a6e[_0x76ce('0x39')],qs[_0x76ce('0x51')](_0x10a40c['query'][_0x76ce('0x51')]));_0x52a9c7[_0x76ce('0x3e')]=_0x52a9c7['attributes'][_0x76ce('0x52')]?_0x52a9c7[_0x76ce('0x3e')]:_0x4e3a6e[_0x76ce('0x39')];if(_0x10a40c['query'][_0x76ce('0x49')]){_0x52a9c7[_0x76ce('0x4a')]=[{'all':!![]}];}_0x52a9c7=_[_0x76ce('0x45')]({},_0x52a9c7,_0x10a40c[_0x76ce('0x48')]);return db['SmsQueue']['find'](_0x52a9c7)[_0x76ce('0x29')](handleEntityNotFound(_0x219eed,null))['then'](respondWithResult(_0x219eed,null))[_0x76ce('0x4d')](handleError(_0x219eed,null));};exports['create']=function(_0x25d8df,_0x458974){return db[_0x76ce('0x36')]['create'](_0x25d8df[_0x76ce('0x53')],{})[_0x76ce('0x29')](function(_0x5c9bac){var _0x4f431e=_0x25d8df[_0x76ce('0x54')][_0x76ce('0x55')]({'plain':!![]});if(!_0x4f431e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f431e[_0x76ce('0x56')]==='user'){var _0x21c1fc=_0x5c9bac[_0x76ce('0x55')]({'plain':!![]});var _0x1f32c3='SmsQueues';return db[_0x76ce('0x57')][_0x76ce('0x58')]({'where':{'name':_0x1f32c3,'userProfileId':_0x4f431e[_0x76ce('0x59')]},'raw':!![]})[_0x76ce('0x29')](function(_0x37865f){if(_0x37865f&&_0x37865f['autoAssociation']===0x0){return db[_0x76ce('0x2c')][_0x76ce('0x5a')]({'name':_0x21c1fc[_0x76ce('0x2f')],'resourceId':_0x21c1fc['id'],'type':_0x37865f[_0x76ce('0x2f')],'sectionId':_0x37865f['id']},{})[_0x76ce('0x29')](function(){return _0x5c9bac;});}else{return _0x5c9bac;}})[_0x76ce('0x4d')](function(_0x5eef93){logger['error'](_0x76ce('0x5b'),_0x5eef93);throw _0x5eef93;});}return _0x5c9bac;})[_0x76ce('0x29')](respondWithResult(_0x458974,0xc9))['catch'](handleError(_0x458974,null));};exports[_0x76ce('0x28')]=function(_0x1ca37f,_0x3522ef){if(_0x1ca37f[_0x76ce('0x53')]['id']){delete _0x1ca37f[_0x76ce('0x53')]['id'];}return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x1ca37f[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x3522ef,null))[_0x76ce('0x29')](saveUpdates(_0x1ca37f[_0x76ce('0x53')],null))[_0x76ce('0x29')](respondWithResult(_0x3522ef,null))[_0x76ce('0x4d')](handleError(_0x3522ef,null));};exports[_0x76ce('0x2a')]=function(_0xaead14,_0x371f5f){return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0xaead14[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x371f5f,null))[_0x76ce('0x29')](removeEntity(_0x371f5f,null))['catch'](handleError(_0x371f5f,null));};exports['describe']=function(_0x671ac1,_0x37099a){return db[_0x76ce('0x36')][_0x76ce('0x5c')]()[_0x76ce('0x29')](respondWithResult(_0x37099a,null))['catch'](handleError(_0x37099a,null));};exports['getMembers']=function(_0x2ddbed,_0x4466b3,_0x3fb805){var _0x29ebf1={'raw':!![],'where':{}},_0x36b3b2={},_0x35c9a7;return db[_0x76ce('0x36')][_0x76ce('0x5d')]({'where':{'id':_0x2ddbed[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x4466b3,null))[_0x76ce('0x29')](function(_0xbde5ee){if(_0xbde5ee){_0x35c9a7=_0xbde5ee[_0x76ce('0x55')]({'plain':!![]});_0x36b3b2['model']=_['keys'](db[_0x76ce('0x5e')][_0x76ce('0x37')]);_0x36b3b2[_0x76ce('0x3b')]=_[_0x76ce('0x50')](_0x2ddbed['query']);_0x36b3b2[_0x76ce('0x3c')]=_[_0x76ce('0x3d')](_0x36b3b2[_0x76ce('0x39')],_0x36b3b2[_0x76ce('0x3b')]);_0x29ebf1[_0x76ce('0x3e')]=_[_0x76ce('0x3d')](_0x36b3b2['model'],qs[_0x76ce('0x51')](_0x2ddbed['query'][_0x76ce('0x51')]));_0x29ebf1['attributes']=_0x29ebf1[_0x76ce('0x3e')][_0x76ce('0x52')]?_0x29ebf1[_0x76ce('0x3e')]:_0x36b3b2[_0x76ce('0x39')];if(!_0x2ddbed['query'][_0x76ce('0x3f')](_0x76ce('0x40'))){_0x29ebf1[_0x76ce('0x21')]=qs[_0x76ce('0x21')](_0x2ddbed['query'][_0x76ce('0x21')]);_0x29ebf1['offset']=qs[_0x76ce('0x1f')](_0x2ddbed['query'][_0x76ce('0x1f')]);}_0x29ebf1[_0x76ce('0x41')]=qs[_0x76ce('0x42')](_0x2ddbed[_0x76ce('0x3b')][_0x76ce('0x42')]);_0x29ebf1[_0x76ce('0x43')]=qs[_0x76ce('0x3c')](_[_0x76ce('0x44')](_0x2ddbed[_0x76ce('0x3b')],_0x36b3b2[_0x76ce('0x3c')]));_0x29ebf1[_0x76ce('0x43')]['SmsQueueId']=_0xbde5ee['id'];if(_0x2ddbed['query'][_0x76ce('0x47')]){_0x29ebf1[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x29ebf1[_0x76ce('0x43')],{'$or':_['map'](_0x29ebf1['attributes'],function(_0x22747b){var _0x531c68={};_0x531c68[_0x22747b]={'$like':'%'+_0x2ddbed[_0x76ce('0x3b')][_0x76ce('0x47')]+'%'};return _0x531c68;})});}_0x29ebf1=_['merge']({},_0x29ebf1,_0x2ddbed[_0x76ce('0x48')]);return db['UserSmsQueue'][_0x76ce('0x4b')](_0x29ebf1);}})[_0x76ce('0x29')](function(_0x4b3925){if(_0x4b3925){return db[_0x76ce('0x5f')][_0x76ce('0x60')]({'where':{'id':_[_0x76ce('0x3a')](_0x4b3925,_0x76ce('0x61')),'role':_0x76ce('0x33')},'attributes':['id','name','smsPause',_0x76ce('0x62'),_0x76ce('0x63')]});}})[_0x76ce('0x29')](function(_0x51efdb){if(_0x51efdb){return{'count':_0x51efdb[_0x76ce('0x22')],'rows':_[_0x76ce('0x3a')](_0x51efdb[_0x76ce('0x4c')],function(_0x48a942){return{'membername':_0x48a942[_0x76ce('0x2f')],'UserId':_0x48a942['id'],'queue_name':_0x35c9a7[_0x76ce('0x2f')],'SmsQueueId':_0x35c9a7['id'],'interface':util[_0x76ce('0x64')](_0x76ce('0x65'),_0x76ce('0x66'),_0x48a942[_0x76ce('0x2f')]),'penalty':0x0,'paused':_0x48a942['smsPause'],'createdAt':_0x48a942[_0x76ce('0x63')],'updatedAt':_0x48a942[_0x76ce('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4466b3,_0x29ebf1))[_0x76ce('0x4d')](handleError(_0x4466b3,null));};exports[_0x76ce('0x67')]=function(_0x5b0cab,_0x5e6117,_0x3641df){var _0x1733ce={};var _0x2e9018={};var _0x2aa224;var _0x8fe5be;return db['SmsQueue'][_0x76ce('0x5d')]({'where':{'id':_0x5b0cab['params']['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x5e6117,null))[_0x76ce('0x29')](function(_0x16f080){if(_0x16f080){_0x2aa224=_0x16f080;_0x2e9018[_0x76ce('0x39')]=_[_0x76ce('0x50')](db[_0x76ce('0x68')]['rawAttributes']);_0x2e9018[_0x76ce('0x3b')]=_[_0x76ce('0x50')](_0x5b0cab['query']);_0x2e9018[_0x76ce('0x3c')]=_['intersection'](_0x2e9018[_0x76ce('0x39')],_0x2e9018[_0x76ce('0x3b')]);_0x1733ce[_0x76ce('0x3e')]=_['intersection'](_0x2e9018[_0x76ce('0x39')],qs[_0x76ce('0x51')](_0x5b0cab[_0x76ce('0x3b')][_0x76ce('0x51')]));_0x1733ce[_0x76ce('0x3e')]=_0x1733ce[_0x76ce('0x3e')][_0x76ce('0x52')]?_0x1733ce['attributes']:_0x2e9018['model'];_0x1733ce['order']=qs[_0x76ce('0x42')](_0x5b0cab[_0x76ce('0x3b')]['sort']);_0x1733ce[_0x76ce('0x43')]=qs['filters'](_['pick'](_0x5b0cab[_0x76ce('0x3b')],_0x2e9018[_0x76ce('0x3c')]));if(_0x5b0cab[_0x76ce('0x3b')][_0x76ce('0x47')]){_0x1733ce[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x1733ce['where'],{'$or':_[_0x76ce('0x3a')](_0x1733ce[_0x76ce('0x3e')],function(_0x163405){var _0x3f549a={};_0x3f549a[_0x163405]={'$like':'%'+_0x5b0cab[_0x76ce('0x3b')]['filter']+'%'};return _0x3f549a;})});}_0x1733ce=_[_0x76ce('0x45')]({},_0x1733ce,_0x5b0cab['options']);return _0x2aa224[_0x76ce('0x67')](_0x1733ce);}})[_0x76ce('0x29')](function(_0x4c557f){if(_0x4c557f){_0x8fe5be=_0x4c557f['length'];if(!_0x5b0cab['query'][_0x76ce('0x3f')](_0x76ce('0x40'))){_0x1733ce[_0x76ce('0x21')]=qs[_0x76ce('0x21')](_0x5b0cab[_0x76ce('0x3b')]['limit']);_0x1733ce[_0x76ce('0x1f')]=qs['offset'](_0x5b0cab[_0x76ce('0x3b')][_0x76ce('0x1f')]);}return _0x2aa224['getTeams'](_0x1733ce);}})[_0x76ce('0x29')](function(_0x4faac9){if(_0x4faac9){return _0x4faac9?{'count':_0x8fe5be,'rows':_0x4faac9}:null;}})[_0x76ce('0x29')](respondWithResult(_0x5e6117,null))[_0x76ce('0x4d')](handleError(_0x5e6117,null));};exports['addTeams']=function(_0x578d5b,_0x1d20c6,_0x77f9cf){var _0x3f2ae2=_0x578d5b[_0x76ce('0x53')]['ids'];return db[_0x76ce('0x68')][_0x76ce('0x4b')]({'where':{'id':_0x3f2ae2},'attributes':['id'],'include':[{'model':db[_0x76ce('0x5f')],'as':_0x76ce('0x69'),'attributes':['id',_0x76ce('0x2f'),_0x76ce('0x6a'),'voicePause',_0x76ce('0x6b')],'raw':!![]}]})['then'](function(_0x320549){if(_0x320549){var _0x4b7dc1=_[_0x76ce('0x6c')](_0x320549,function(_0x4c8e74){var _0x1d0c17=_0x4c8e74[_0x76ce('0x55')]({'plain':!![]});return _0x1d0c17[_0x76ce('0x69')];});return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x578d5b['params']['id']}})[_0x76ce('0x29')](function(_0x280faa){return db[_0x76ce('0x6d')]['transaction'](function(_0x53209b){return _0x280faa[_0x76ce('0x6e')](_0x3f2ae2,{'transaction':_0x53209b})[_0x76ce('0x29')](function(){return BPromise[_0x76ce('0x6f')](_0x4b7dc1,function(_0x548540){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x548540['id'],'SmsQueueId':_0x578d5b[_0x76ce('0x4f')]['id']},'transaction':_0x53209b});});})[_0x76ce('0x29')](function(){_0x4b7dc1[_0x76ce('0x70')](function(_0x5983bb){socket[_0x76ce('0x71')](_0x76ce('0x72'),{'UserId':_0x5983bb['id'],'SmsQueueId':_0x280faa['id']});});});});});}})[_0x76ce('0x29')](respondWithStatusCode(_0x1d20c6,null))[_0x76ce('0x4d')](handleError(_0x1d20c6,null));};exports['removeTeams']=function(_0x471f6f,_0x3a8781,_0x2aa781){return db[_0x76ce('0x68')][_0x76ce('0x4b')]({'where':{'id':_0x471f6f['query'][_0x76ce('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76ce('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x76ce('0x29')](handleEntityNotFound(_0x3a8781,null))[_0x76ce('0x29')](function(_0x48fc9d){var _0x3f9fe0=_[_0x76ce('0x3a')](_0x48fc9d,'id');var _0x4cc0a9=[];var _0x36fe15=[];var _0x1563bf=squel['select']();_0x1563bf[_0x76ce('0x74')](_0x76ce('0x75'))[_0x76ce('0x76')](_0x76ce('0x77'),'tq')[_0x76ce('0x78')](_0x76ce('0x79'),'ut',_0x76ce('0x7a'))[_0x76ce('0x43')](_0x76ce('0x7b'),_0x471f6f[_0x76ce('0x4f')]['id']);for(var _0x114707=0x0;_0x114707<_0x48fc9d['length'];_0x114707+=0x1){let _0x3be598=_0x48fc9d[_0x114707];for(var _0x26107b=0x0;_0x26107b<_0x3be598['Agents'][_0x76ce('0x52')];_0x26107b+=0x1){let _0x4431ad=_0x3be598[_0x76ce('0x69')][_0x26107b];var _0x84da84=_0x1563bf[_0x76ce('0x7c')]();_0x84da84[_0x76ce('0x43')]('ut.UserId\x20=\x20?',_0x4431ad['id']);_0x36fe15[_0x76ce('0x7d')](db[_0x76ce('0x6d')]['query'](_0x84da84[_0x76ce('0x7e')](),{'type':db['sequelize'][_0x76ce('0x7f')][_0x76ce('0x80')]})[_0x76ce('0x29')](function(_0xc57f92){if(_0xc57f92['length']===0x1){return _0x4431ad['id'];}else{var _0x18f112=_[_0x76ce('0x81')](_[_0x76ce('0x3a')](_0xc57f92,_0x76ce('0x82')),function(_0x8122f4){return _['includes'](_0x3f9fe0,_0x8122f4);});if(_0x18f112){return _0x4431ad['id'];}}}));}}return BPromise['all'](_0x36fe15)[_0x76ce('0x29')](function(_0x4bebc0){_0x4cc0a9=_(_0x4cc0a9)[_0x76ce('0x83')](_0x4bebc0)['compact']()[_0x76ce('0x84')]();return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x471f6f[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](function(_0x1e28b4){return db['sequelize'][_0x76ce('0x85')](function(_0x173c01){return _0x1e28b4[_0x76ce('0x86')](_0x471f6f['query']['ids'],{'transaction':_0x173c01})[_0x76ce('0x29')](function(){if(!_['isEmpty'](_0x4cc0a9)){return _0x1e28b4[_0x76ce('0x87')](_0x4cc0a9,{'transaction':_0x173c01});}})[_0x76ce('0x29')](function(){_0x4cc0a9[_0x76ce('0x70')](function(_0x20b762){socket[_0x76ce('0x71')](_0x76ce('0x88'),{'UserId':_0x20b762,'SmsQueueId':_0x1e28b4['id']});});});});});});})['then'](respondWithStatusCode(_0x3a8781,null))[_0x76ce('0x4d')](handleError(_0x3a8781,null));};exports[_0x76ce('0x89')]=function(_0x2c74df,_0xeb833d,_0x17fae8){return db[_0x76ce('0x36')]['find']({'where':{'id':_0x2c74df[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0xeb833d,null))[_0x76ce('0x29')](function(_0x2cfd0a){if(_0x2cfd0a){return _0x2cfd0a[_0x76ce('0x89')](_0x2c74df[_0x76ce('0x53')][_0x76ce('0x73')],_['omit'](_0x2c74df[_0x76ce('0x53')],[_0x76ce('0x73'),'id'])||{})[_0x76ce('0x8a')](function(_0x49e88b){for(var _0x3e2ff6=0x0;_0x3e2ff6<_0x2c74df[_0x76ce('0x53')][_0x76ce('0x73')][_0x76ce('0x52')];_0x3e2ff6+=0x1){socket[_0x76ce('0x71')]('userSmsQueue:save',{'UserId':_0x2c74df['body'][_0x76ce('0x73')][_0x3e2ff6],'SmsQueueId':_0x2c74df['params']['id']});}return _0x49e88b;});}})[_0x76ce('0x29')](respondWithResult(_0xeb833d,null))[_0x76ce('0x4d')](handleError(_0xeb833d,null));};exports['removeAgents']=function(_0x517114,_0x38e882,_0x5e5c6c){return db[_0x76ce('0x36')][_0x76ce('0x58')]({'where':{'id':_0x517114['params']['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x38e882,null))[_0x76ce('0x29')](function(_0x12182f){if(_0x12182f){return _0x12182f[_0x76ce('0x87')](_0x517114[_0x76ce('0x3b')]['ids'])[_0x76ce('0x29')](function(){if(_['isArray'](_0x517114['query'][_0x76ce('0x73')])){for(var _0x37a5ca=0x0;_0x37a5ca<_0x517114[_0x76ce('0x3b')]['ids'][_0x76ce('0x52')];_0x37a5ca+=0x1){socket[_0x76ce('0x71')](_0x76ce('0x88'),{'UserId':Number(_0x517114[_0x76ce('0x3b')]['ids'][_0x37a5ca]),'SmsQueueId':Number(_0x517114['params']['id'])});}}else{socket[_0x76ce('0x71')](_0x76ce('0x88'),{'UserId':Number(_0x517114['query'][_0x76ce('0x73')]),'SmsQueueId':Number(_0x517114[_0x76ce('0x4f')]['id'])});}});}})[_0x76ce('0x29')](respondWithStatusCode(_0x38e882,null))['catch'](handleError(_0x38e882,null));};exports['getAgents']=function(_0x333659,_0x16b24f,_0x5d80e4){var _0x5d7dab={};var _0x592421={};var _0x413998;var _0x12ba87;return db['SmsQueue']['findOne']({'where':{'id':_0x333659[_0x76ce('0x4f')]['id']}})[_0x76ce('0x29')](handleEntityNotFound(_0x16b24f,null))['then'](function(_0x4102a5){if(_0x4102a5){_0x413998=_0x4102a5;_0x592421[_0x76ce('0x39')]=_[_0x76ce('0x50')](db[_0x76ce('0x5f')]['rawAttributes']);_0x592421[_0x76ce('0x3b')]=_[_0x76ce('0x50')](_0x333659['query']);_0x592421[_0x76ce('0x3c')]=_[_0x76ce('0x3d')](_0x592421[_0x76ce('0x39')],_0x592421[_0x76ce('0x3b')]);_0x5d7dab[_0x76ce('0x3e')]=_[_0x76ce('0x3d')](_0x592421[_0x76ce('0x39')],qs['fields'](_0x333659[_0x76ce('0x3b')][_0x76ce('0x51')]));_0x5d7dab[_0x76ce('0x3e')]=_0x5d7dab[_0x76ce('0x3e')]['length']?_0x5d7dab[_0x76ce('0x3e')]:_0x592421[_0x76ce('0x39')];_0x5d7dab[_0x76ce('0x41')]=qs[_0x76ce('0x42')](_0x333659[_0x76ce('0x3b')][_0x76ce('0x42')]);_0x5d7dab[_0x76ce('0x43')]=qs[_0x76ce('0x3c')](_[_0x76ce('0x44')](_0x333659[_0x76ce('0x3b')],_0x592421[_0x76ce('0x3c')]));if(_0x333659[_0x76ce('0x3b')][_0x76ce('0x47')]){_0x5d7dab[_0x76ce('0x43')]=_[_0x76ce('0x45')](_0x5d7dab['where'],{'$or':_['map'](_0x5d7dab[_0x76ce('0x3e')],function(_0x9965be){var _0x341e85={};_0x341e85[_0x9965be]={'$like':'%'+_0x333659['query'][_0x76ce('0x47')]+'%'};return _0x341e85;})});}_0x5d7dab=_[_0x76ce('0x45')]({},_0x5d7dab,_0x333659['options']);return _0x413998[_0x76ce('0x8b')](_0x5d7dab);}})['then'](function(_0x3a3892){if(_0x3a3892){_0x12ba87=_0x3a3892[_0x76ce('0x52')];if(!_0x333659[_0x76ce('0x3b')]['hasOwnProperty'](_0x76ce('0x40'))){_0x5d7dab[_0x76ce('0x21')]=qs['limit'](_0x333659[_0x76ce('0x3b')]['limit']);_0x5d7dab[_0x76ce('0x1f')]=qs[_0x76ce('0x1f')](_0x333659[_0x76ce('0x3b')][_0x76ce('0x1f')]);}return _0x413998[_0x76ce('0x8b')](_0x5d7dab);}})[_0x76ce('0x29')](function(_0x1e9dbf){if(_0x1e9dbf){return _0x1e9dbf?{'count':_0x12ba87,'rows':_0x1e9dbf}:null;}})[_0x76ce('0x29')](respondWithResult(_0x16b24f,null))[_0x76ce('0x4d')](handleError(_0x16b24f,null));}; \ No newline at end of file +var _0x47cd=['nolimit','sort','SmsQueueId','filter','User','findAndCountAll','UserId','createdAt','rows','format','%s/%s','SIP','smsPause','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','SmsQueues','UserProfileResource','sendStatus','stack','name','send','merge','message','agent','interaction','account','map','SmsQueue','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','VIRTUAL','options','includeAll','include','findAll','show','keys','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMembers','findOne','UserSmsQueue','length'];(function(_0x590deb,_0x249ee5){var _0x1b0022=function(_0x5e9718){while(--_0x5e9718){_0x590deb['push'](_0x590deb['shift']());}};_0x1b0022(++_0x249ee5);}(_0x47cd,0x1f2));var _0xd47c=function(_0x370953,_0xcc5975){_0x370953=_0x370953-0x0;var _0x850217=_0x47cd[_0x370953];return _0x850217;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd47c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd47c('0x1'));var rp=require(_0xd47c('0x2'));var moment=require(_0xd47c('0x3'));var BPromise=require(_0xd47c('0x4'));var Mustache=require(_0xd47c('0x5'));var util=require(_0xd47c('0x6'));var path=require(_0xd47c('0x7'));var sox=require(_0xd47c('0x8'));var csv=require('to-csv');var ejs=require(_0xd47c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd47c('0xa'));var squel=require(_0xd47c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd47c('0xc'));var toCsv=require(_0xd47c('0xd'));var querystring=require('querystring');var Papa=require(_0xd47c('0xe'));var Redis=require(_0xd47c('0xf'));var authService=require(_0xd47c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd47c('0x11'));var hardwareService=require(_0xd47c('0x12'));var logger=require(_0xd47c('0x13'))(_0xd47c('0x14'));var utils=require(_0xd47c('0x15'));var config=require(_0xd47c('0x16'));var licenseUtil=require(_0xd47c('0x17'));var db=require(_0xd47c('0x18'))['db'];config['redis']=_[_0xd47c('0x19')](config[_0xd47c('0x1a')],{'host':_0xd47c('0x1b'),'port':0x18eb});var socket=require(_0xd47c('0x1c'))(new Redis(config[_0xd47c('0x1a')]));require(_0xd47c('0x1d'))[_0xd47c('0x1e')](socket);function respondWithStatusCode(_0x372331,_0x3625b8){_0x3625b8=_0x3625b8||0xcc;return function(_0x1ea46e){if(_0x1ea46e){return _0x372331['sendStatus'](_0x3625b8);}return _0x372331['status'](_0x3625b8)[_0xd47c('0x1f')]();};}function respondWithResult(_0x23f0f4,_0x1c691c){_0x1c691c=_0x1c691c||0xc8;return function(_0x3b859b){if(_0x3b859b){return _0x23f0f4[_0xd47c('0x20')](_0x1c691c)[_0xd47c('0x21')](_0x3b859b);}};}function respondWithFilteredResult(_0x231ff1,_0x4fb18c){return function(_0x3882a9){if(_0x3882a9){var _0x2c0e30=typeof _0x4fb18c[_0xd47c('0x22')]==='undefined'&&typeof _0x4fb18c['limit']===_0xd47c('0x23');var _0x51ef54=_0x3882a9[_0xd47c('0x24')];var _0x1fc596=_0x2c0e30?0x0:_0x4fb18c[_0xd47c('0x22')];var _0x5116ed=_0x2c0e30?_0x3882a9[_0xd47c('0x24')]:_0x4fb18c['offset']+_0x4fb18c[_0xd47c('0x25')];var _0x5d2ffa;if(_0x5116ed>=_0x51ef54){_0x5116ed=_0x51ef54;_0x5d2ffa=0xc8;}else{_0x5d2ffa=0xce;}_0x231ff1[_0xd47c('0x20')](_0x5d2ffa);return _0x231ff1[_0xd47c('0x26')](_0xd47c('0x27'),_0x1fc596+'-'+_0x5116ed+'/'+_0x51ef54)[_0xd47c('0x21')](_0x3882a9);}return null;};}function patchUpdates(_0x4445de){return function(_0x226445){try{jsonpatch[_0xd47c('0x28')](_0x226445,_0x4445de,!![]);}catch(_0x2ce676){return BPromise[_0xd47c('0x29')](_0x2ce676);}return _0x226445[_0xd47c('0x2a')]();};}function saveUpdates(_0x6fb20e,_0x502768){return function(_0x3ce652){if(_0x3ce652){return _0x3ce652[_0xd47c('0x2b')](_0x6fb20e)['then'](function(_0x4de9ef){return _0x4de9ef;});}return null;};}function removeEntity(_0xec4d5,_0x52eb9b){return function(_0x573613){if(_0x573613){return _0x573613[_0xd47c('0x2c')]()[_0xd47c('0x2d')](function(){var _0x6fc1de=_0x573613['get']({'plain':!![]});var _0x15d723=_0xd47c('0x2e');return db[_0xd47c('0x2f')]['destroy']({'where':{'type':_0x15d723,'resourceId':_0x6fc1de['id']}})[_0xd47c('0x2d')](function(){return _0x573613;});})[_0xd47c('0x2d')](function(){_0xec4d5[_0xd47c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb691f,_0x52a645){return function(_0x3a02d9){if(!_0x3a02d9){_0xdb691f[_0xd47c('0x30')](0x194);}return _0x3a02d9;};}function handleError(_0x1708f0,_0x2b32ce){_0x2b32ce=_0x2b32ce||0x1f4;return function(_0x2a5dea){logger['error'](_0x2a5dea[_0xd47c('0x31')]);if(_0x2a5dea['name']){delete _0x2a5dea[_0xd47c('0x32')];}_0x1708f0[_0xd47c('0x20')](_0x2b32ce)[_0xd47c('0x33')](_0x2a5dea);};}function getMustacheRender(_0x1361bc,_0x32207c){return Mustache['render'](_0x1361bc,_[_0xd47c('0x34')](_0x32207c['body'],{'contact':_0x32207c['contact'],'message':_0x32207c[_0xd47c('0x35')],'agent':_0x32207c[_0xd47c('0x36')],'interaction':_0x32207c[_0xd47c('0x37')],'account':_0x32207c[_0xd47c('0x38')]}))||'';}exports['index']=function(_0x1e4627,_0xaf5f30){var _0x1611ae={},_0x1dcd4b={},_0x11ba98={'count':0x0,'rows':[]};var _0x42afb4=_[_0xd47c('0x39')](db[_0xd47c('0x3a')][_0xd47c('0x3b')],function(_0xc8b32b){return{'name':_0xc8b32b['fieldName'],'type':_0xc8b32b[_0xd47c('0x3c')]['key']};});_0x1dcd4b[_0xd47c('0x3d')]=_[_0xd47c('0x39')](_0x42afb4,_0xd47c('0x32'));_0x1dcd4b[_0xd47c('0x3e')]=_['keys'](_0x1e4627['query']);_0x1dcd4b[_0xd47c('0x3f')]=_[_0xd47c('0x40')](_0x1dcd4b[_0xd47c('0x3d')],_0x1dcd4b[_0xd47c('0x3e')]);_0x1611ae[_0xd47c('0x41')]=_[_0xd47c('0x40')](_0x1dcd4b[_0xd47c('0x3d')],qs[_0xd47c('0x42')](_0x1e4627[_0xd47c('0x3e')][_0xd47c('0x42')]));_0x1611ae[_0xd47c('0x41')]=_0x1611ae[_0xd47c('0x41')]['length']?_0x1611ae[_0xd47c('0x41')]:_0x1dcd4b[_0xd47c('0x3d')];if(!_0x1e4627[_0xd47c('0x3e')][_0xd47c('0x43')]('nolimit')){_0x1611ae[_0xd47c('0x25')]=qs[_0xd47c('0x25')](_0x1e4627['query']['limit']);_0x1611ae[_0xd47c('0x22')]=qs[_0xd47c('0x22')](_0x1e4627[_0xd47c('0x3e')][_0xd47c('0x22')]);}_0x1611ae[_0xd47c('0x44')]=qs['sort'](_0x1e4627[_0xd47c('0x3e')]['sort']);_0x1611ae[_0xd47c('0x45')]=qs[_0xd47c('0x3f')](_[_0xd47c('0x46')](_0x1e4627[_0xd47c('0x3e')],_0x1dcd4b[_0xd47c('0x3f')]),_0x42afb4);if(_0x1e4627['query']['filter']){_0x1611ae[_0xd47c('0x45')]=_[_0xd47c('0x34')](_0x1611ae['where'],{'$or':_[_0xd47c('0x39')](_0x42afb4,function(_0x2a93f6){if(_0x2a93f6['type']!==_0xd47c('0x47')){var _0x39d5c7={};_0x39d5c7[_0x2a93f6[_0xd47c('0x32')]]={'$like':'%'+_0x1e4627[_0xd47c('0x3e')]['filter']+'%'};return _0x39d5c7;}})});}_0x1611ae=_[_0xd47c('0x34')]({},_0x1611ae,_0x1e4627[_0xd47c('0x48')]);var _0x3acd68={'where':_0x1611ae[_0xd47c('0x45')]};return db['SmsQueue']['count'](_0x3acd68)[_0xd47c('0x2d')](function(_0x3547b7){_0x11ba98[_0xd47c('0x24')]=_0x3547b7;if(_0x1e4627[_0xd47c('0x3e')][_0xd47c('0x49')]){_0x1611ae[_0xd47c('0x4a')]=[{'all':!![]}];}return db[_0xd47c('0x3a')][_0xd47c('0x4b')](_0x1611ae);})[_0xd47c('0x2d')](function(_0x410ce1){_0x11ba98['rows']=_0x410ce1;return _0x11ba98;})[_0xd47c('0x2d')](respondWithFilteredResult(_0xaf5f30,_0x1611ae))['catch'](handleError(_0xaf5f30,null));};exports[_0xd47c('0x4c')]=function(_0x318efd,_0x392246){var _0x38c31b={'raw':!![],'where':{'id':_0x318efd['params']['id']}},_0x416a86={};_0x416a86[_0xd47c('0x3d')]=_[_0xd47c('0x4d')](db[_0xd47c('0x3a')]['rawAttributes']);_0x416a86[_0xd47c('0x3e')]=_[_0xd47c('0x4d')](_0x318efd[_0xd47c('0x3e')]);_0x416a86[_0xd47c('0x3f')]=_['intersection'](_0x416a86[_0xd47c('0x3d')],_0x416a86[_0xd47c('0x3e')]);_0x38c31b[_0xd47c('0x41')]=_['intersection'](_0x416a86[_0xd47c('0x3d')],qs[_0xd47c('0x42')](_0x318efd['query']['fields']));_0x38c31b[_0xd47c('0x41')]=_0x38c31b[_0xd47c('0x41')]['length']?_0x38c31b[_0xd47c('0x41')]:_0x416a86['model'];if(_0x318efd['query']['includeAll']){_0x38c31b[_0xd47c('0x4a')]=[{'all':!![]}];}_0x38c31b=_['merge']({},_0x38c31b,_0x318efd[_0xd47c('0x48')]);return db[_0xd47c('0x3a')][_0xd47c('0x4e')](_0x38c31b)[_0xd47c('0x2d')](handleEntityNotFound(_0x392246,null))[_0xd47c('0x2d')](respondWithResult(_0x392246,null))[_0xd47c('0x4f')](handleError(_0x392246,null));};exports['create']=function(_0x106ec8,_0x4d01c6){return db[_0xd47c('0x3a')][_0xd47c('0x50')](_0x106ec8['body'],{})[_0xd47c('0x2d')](function(_0x36c126){var _0x30f5f6=_0x106ec8['user']['get']({'plain':!![]});if(!_0x30f5f6)throw new Error(_0xd47c('0x51'));if(_0x30f5f6['role']===_0xd47c('0x52')){var _0x891ad7=_0x36c126[_0xd47c('0x53')]({'plain':!![]});var _0xadb5b0='SmsQueues';return db[_0xd47c('0x54')][_0xd47c('0x4e')]({'where':{'name':_0xadb5b0,'userProfileId':_0x30f5f6[_0xd47c('0x55')]},'raw':!![]})[_0xd47c('0x2d')](function(_0xf47fc6){if(_0xf47fc6&&_0xf47fc6['autoAssociation']===0x0){return db[_0xd47c('0x2f')][_0xd47c('0x50')]({'name':_0x891ad7[_0xd47c('0x32')],'resourceId':_0x891ad7['id'],'type':_0xf47fc6[_0xd47c('0x32')],'sectionId':_0xf47fc6['id']},{})['then'](function(){return _0x36c126;});}else{return _0x36c126;}})[_0xd47c('0x4f')](function(_0x56b0fa){logger[_0xd47c('0x56')](_0xd47c('0x57'),_0x56b0fa);throw _0x56b0fa;});}return _0x36c126;})[_0xd47c('0x2d')](respondWithResult(_0x4d01c6,0xc9))['catch'](handleError(_0x4d01c6,null));};exports['update']=function(_0x272756,_0x25553f){if(_0x272756[_0xd47c('0x58')]['id']){delete _0x272756[_0xd47c('0x58')]['id'];}return db[_0xd47c('0x3a')][_0xd47c('0x4e')]({'where':{'id':_0x272756[_0xd47c('0x59')]['id']}})[_0xd47c('0x2d')](handleEntityNotFound(_0x25553f,null))[_0xd47c('0x2d')](saveUpdates(_0x272756[_0xd47c('0x58')],null))[_0xd47c('0x2d')](respondWithResult(_0x25553f,null))[_0xd47c('0x4f')](handleError(_0x25553f,null));};exports[_0xd47c('0x2c')]=function(_0x54a518,_0x594259){return db[_0xd47c('0x3a')]['find']({'where':{'id':_0x54a518[_0xd47c('0x59')]['id']}})[_0xd47c('0x2d')](handleEntityNotFound(_0x594259,null))[_0xd47c('0x2d')](removeEntity(_0x594259,null))[_0xd47c('0x4f')](handleError(_0x594259,null));};exports['describe']=function(_0x24f9af,_0x303080){return db['SmsQueue']['describe']()['then'](respondWithResult(_0x303080,null))['catch'](handleError(_0x303080,null));};exports[_0xd47c('0x5a')]=function(_0x1b60ce,_0x5e196d,_0x514809){var _0x36b6cc={'raw':!![],'where':{}},_0x1dd5d8={},_0x3c4d93;return db[_0xd47c('0x3a')][_0xd47c('0x5b')]({'where':{'id':_0x1b60ce['params']['id']}})['then'](handleEntityNotFound(_0x5e196d,null))[_0xd47c('0x2d')](function(_0x4cab97){if(_0x4cab97){_0x3c4d93=_0x4cab97[_0xd47c('0x53')]({'plain':!![]});_0x1dd5d8['model']=_[_0xd47c('0x4d')](db[_0xd47c('0x5c')]['rawAttributes']);_0x1dd5d8['query']=_[_0xd47c('0x4d')](_0x1b60ce[_0xd47c('0x3e')]);_0x1dd5d8[_0xd47c('0x3f')]=_['intersection'](_0x1dd5d8[_0xd47c('0x3d')],_0x1dd5d8[_0xd47c('0x3e')]);_0x36b6cc[_0xd47c('0x41')]=_[_0xd47c('0x40')](_0x1dd5d8[_0xd47c('0x3d')],qs[_0xd47c('0x42')](_0x1b60ce[_0xd47c('0x3e')][_0xd47c('0x42')]));_0x36b6cc[_0xd47c('0x41')]=_0x36b6cc[_0xd47c('0x41')][_0xd47c('0x5d')]?_0x36b6cc['attributes']:_0x1dd5d8[_0xd47c('0x3d')];if(!_0x1b60ce[_0xd47c('0x3e')]['hasOwnProperty'](_0xd47c('0x5e'))){_0x36b6cc['limit']=qs[_0xd47c('0x25')](_0x1b60ce[_0xd47c('0x3e')][_0xd47c('0x25')]);_0x36b6cc[_0xd47c('0x22')]=qs[_0xd47c('0x22')](_0x1b60ce['query'][_0xd47c('0x22')]);}_0x36b6cc[_0xd47c('0x44')]=qs['sort'](_0x1b60ce['query'][_0xd47c('0x5f')]);_0x36b6cc[_0xd47c('0x45')]=qs['filters'](_['pick'](_0x1b60ce[_0xd47c('0x3e')],_0x1dd5d8[_0xd47c('0x3f')]));_0x36b6cc[_0xd47c('0x45')][_0xd47c('0x60')]=_0x4cab97['id'];if(_0x1b60ce[_0xd47c('0x3e')][_0xd47c('0x61')]){_0x36b6cc[_0xd47c('0x45')]=_[_0xd47c('0x34')](_0x36b6cc[_0xd47c('0x45')],{'$or':_[_0xd47c('0x39')](_0x36b6cc[_0xd47c('0x41')],function(_0x473077){var _0x1b8b50={};_0x1b8b50[_0x473077]={'$like':'%'+_0x1b60ce[_0xd47c('0x3e')][_0xd47c('0x61')]+'%'};return _0x1b8b50;})});}_0x36b6cc=_[_0xd47c('0x34')]({},_0x36b6cc,_0x1b60ce['options']);return db['UserSmsQueue']['findAll'](_0x36b6cc);}})[_0xd47c('0x2d')](function(_0x1fef88){if(_0x1fef88){return db[_0xd47c('0x62')][_0xd47c('0x63')]({'where':{'id':_[_0xd47c('0x39')](_0x1fef88,_0xd47c('0x64')),'role':_0xd47c('0x36')},'attributes':['id','name','smsPause','updatedAt',_0xd47c('0x65')]});}})[_0xd47c('0x2d')](function(_0x1c1e92){if(_0x1c1e92){return{'count':_0x1c1e92[_0xd47c('0x24')],'rows':_[_0xd47c('0x39')](_0x1c1e92[_0xd47c('0x66')],function(_0x28263c){return{'membername':_0x28263c[_0xd47c('0x32')],'UserId':_0x28263c['id'],'queue_name':_0x3c4d93[_0xd47c('0x32')],'SmsQueueId':_0x3c4d93['id'],'interface':util[_0xd47c('0x67')](_0xd47c('0x68'),_0xd47c('0x69'),_0x28263c[_0xd47c('0x32')]),'penalty':0x0,'paused':_0x28263c[_0xd47c('0x6a')],'createdAt':_0x28263c[_0xd47c('0x65')],'updatedAt':_0x28263c[_0xd47c('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd47c('0x2d')](respondWithFilteredResult(_0x5e196d,_0x36b6cc))['catch'](handleError(_0x5e196d,null));};exports[_0xd47c('0x6c')]=function(_0x2c5e9e,_0x3dbef7,_0x124ba9){var _0x26f08b={};var _0x3b8ea7={};var _0x42f0bb;var _0x108f8f;return db[_0xd47c('0x3a')][_0xd47c('0x5b')]({'where':{'id':_0x2c5e9e[_0xd47c('0x59')]['id']}})[_0xd47c('0x2d')](handleEntityNotFound(_0x3dbef7,null))['then'](function(_0x1226b2){if(_0x1226b2){_0x42f0bb=_0x1226b2;_0x3b8ea7[_0xd47c('0x3d')]=_[_0xd47c('0x4d')](db[_0xd47c('0x6d')][_0xd47c('0x3b')]);_0x3b8ea7['query']=_[_0xd47c('0x4d')](_0x2c5e9e[_0xd47c('0x3e')]);_0x3b8ea7[_0xd47c('0x3f')]=_['intersection'](_0x3b8ea7[_0xd47c('0x3d')],_0x3b8ea7[_0xd47c('0x3e')]);_0x26f08b['attributes']=_[_0xd47c('0x40')](_0x3b8ea7['model'],qs['fields'](_0x2c5e9e['query'][_0xd47c('0x42')]));_0x26f08b['attributes']=_0x26f08b[_0xd47c('0x41')][_0xd47c('0x5d')]?_0x26f08b[_0xd47c('0x41')]:_0x3b8ea7[_0xd47c('0x3d')];_0x26f08b[_0xd47c('0x44')]=qs[_0xd47c('0x5f')](_0x2c5e9e[_0xd47c('0x3e')]['sort']);_0x26f08b[_0xd47c('0x45')]=qs['filters'](_[_0xd47c('0x46')](_0x2c5e9e[_0xd47c('0x3e')],_0x3b8ea7[_0xd47c('0x3f')]));if(_0x2c5e9e['query'][_0xd47c('0x61')]){_0x26f08b[_0xd47c('0x45')]=_[_0xd47c('0x34')](_0x26f08b[_0xd47c('0x45')],{'$or':_[_0xd47c('0x39')](_0x26f08b['attributes'],function(_0x1af73c){var _0x2f7031={};_0x2f7031[_0x1af73c]={'$like':'%'+_0x2c5e9e['query'][_0xd47c('0x61')]+'%'};return _0x2f7031;})});}_0x26f08b=_[_0xd47c('0x34')]({},_0x26f08b,_0x2c5e9e[_0xd47c('0x48')]);return _0x42f0bb[_0xd47c('0x6c')](_0x26f08b);}})[_0xd47c('0x2d')](function(_0x55e619){if(_0x55e619){_0x108f8f=_0x55e619['length'];if(!_0x2c5e9e[_0xd47c('0x3e')][_0xd47c('0x43')]('nolimit')){_0x26f08b[_0xd47c('0x25')]=qs[_0xd47c('0x25')](_0x2c5e9e[_0xd47c('0x3e')]['limit']);_0x26f08b[_0xd47c('0x22')]=qs['offset'](_0x2c5e9e[_0xd47c('0x3e')]['offset']);}return _0x42f0bb[_0xd47c('0x6c')](_0x26f08b);}})[_0xd47c('0x2d')](function(_0x57a645){if(_0x57a645){return _0x57a645?{'count':_0x108f8f,'rows':_0x57a645}:null;}})[_0xd47c('0x2d')](respondWithResult(_0x3dbef7,null))['catch'](handleError(_0x3dbef7,null));};exports[_0xd47c('0x6e')]=function(_0x7c7813,_0x5eebc7,_0x1e8c12){var _0x1e35fc=_0x7c7813[_0xd47c('0x58')][_0xd47c('0x6f')];return db[_0xd47c('0x6d')][_0xd47c('0x4b')]({'where':{'id':_0x1e35fc},'attributes':['id'],'include':[{'model':db[_0xd47c('0x62')],'as':_0xd47c('0x70'),'attributes':['id',_0xd47c('0x32'),_0xd47c('0x71'),_0xd47c('0x72'),_0xd47c('0x73')],'raw':!![]}]})['then'](function(_0xe60d71){if(_0xe60d71){var _0xacecaa=_[_0xd47c('0x74')](_0xe60d71,function(_0x491fc2){var _0x43d839=_0x491fc2['get']({'plain':!![]});return _0x43d839[_0xd47c('0x70')];});return db[_0xd47c('0x3a')][_0xd47c('0x4e')]({'where':{'id':_0x7c7813[_0xd47c('0x59')]['id']}})[_0xd47c('0x2d')](function(_0xd939ad){return db[_0xd47c('0x75')]['transaction'](function(_0x3e01bd){return _0xd939ad[_0xd47c('0x6e')](_0x1e35fc,{'transaction':_0x3e01bd})[_0xd47c('0x2d')](function(){return BPromise['each'](_0xacecaa,function(_0x4b6ca7){return db['UserSmsQueue'][_0xd47c('0x76')]({'where':{'UserId':_0x4b6ca7['id'],'SmsQueueId':_0x7c7813[_0xd47c('0x59')]['id']},'transaction':_0x3e01bd});});})[_0xd47c('0x2d')](function(){_0xacecaa[_0xd47c('0x77')](function(_0x48cec9){socket[_0xd47c('0x78')](_0xd47c('0x79'),{'UserId':_0x48cec9['id'],'SmsQueueId':_0xd939ad['id']});});});});});}})['then'](respondWithStatusCode(_0x5eebc7,null))['catch'](handleError(_0x5eebc7,null));};exports['removeTeams']=function(_0x5e23ea,_0x22188a,_0x5f4930){return db[_0xd47c('0x6d')]['findAll']({'where':{'id':_0x5e23ea[_0xd47c('0x3e')][_0xd47c('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xd47c('0x62')],'as':_0xd47c('0x70'),'attributes':['id'],'raw':!![]}]})[_0xd47c('0x2d')](handleEntityNotFound(_0x22188a,null))[_0xd47c('0x2d')](function(_0x21fa7d){var _0x934cdd=_[_0xd47c('0x39')](_0x21fa7d,'id');var _0x4669fc=[];var _0x111b3a=[];var _0x413252=squel[_0xd47c('0x7a')]();_0x413252[_0xd47c('0x7b')](_0xd47c('0x7c'))[_0xd47c('0x7d')]('team_has_sms_queues','tq')[_0xd47c('0x7e')](_0xd47c('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd47c('0x45')](_0xd47c('0x80'),_0x5e23ea['params']['id']);for(var _0x1a433a=0x0;_0x1a433a<_0x21fa7d[_0xd47c('0x5d')];_0x1a433a+=0x1){let _0x31970b=_0x21fa7d[_0x1a433a];for(var _0x3f7d93=0x0;_0x3f7d93<_0x31970b['Agents']['length'];_0x3f7d93+=0x1){let _0x4d97d9=_0x31970b[_0xd47c('0x70')][_0x3f7d93];var _0x41bb68=_0x413252['clone']();_0x41bb68[_0xd47c('0x45')](_0xd47c('0x81'),_0x4d97d9['id']);_0x111b3a[_0xd47c('0x82')](db[_0xd47c('0x75')]['query'](_0x41bb68[_0xd47c('0x83')](),{'type':db[_0xd47c('0x75')]['QueryTypes'][_0xd47c('0x84')]})['then'](function(_0x541c78){if(_0x541c78['length']===0x1){return _0x4d97d9['id'];}else{var _0x517728=_[_0xd47c('0x85')](_[_0xd47c('0x39')](_0x541c78,_0xd47c('0x86')),function(_0x3ec1e2){return _[_0xd47c('0x87')](_0x934cdd,_0x3ec1e2);});if(_0x517728){return _0x4d97d9['id'];}}}));}}return BPromise[_0xd47c('0x88')](_0x111b3a)[_0xd47c('0x2d')](function(_0x1c234e){_0x4669fc=_(_0x4669fc)[_0xd47c('0x89')](_0x1c234e)[_0xd47c('0x8a')]()[_0xd47c('0x8b')]();return db['SmsQueue']['find']({'where':{'id':_0x5e23ea[_0xd47c('0x59')]['id']}})[_0xd47c('0x2d')](function(_0xbd2176){return db['sequelize']['transaction'](function(_0x2bc54f){return _0xbd2176[_0xd47c('0x8c')](_0x5e23ea['query'][_0xd47c('0x6f')],{'transaction':_0x2bc54f})[_0xd47c('0x2d')](function(){if(!_[_0xd47c('0x8d')](_0x4669fc)){return _0xbd2176[_0xd47c('0x8e')](_0x4669fc,{'transaction':_0x2bc54f});}})['then'](function(){_0x4669fc[_0xd47c('0x77')](function(_0x18644a){socket[_0xd47c('0x78')](_0xd47c('0x8f'),{'UserId':_0x18644a,'SmsQueueId':_0xbd2176['id']});});});});});});})[_0xd47c('0x2d')](respondWithStatusCode(_0x22188a,null))[_0xd47c('0x4f')](handleError(_0x22188a,null));};exports['addAgents']=function(_0x36e67b,_0x2ac0bd,_0x248746){return db['SmsQueue'][_0xd47c('0x4e')]({'where':{'id':_0x36e67b[_0xd47c('0x59')]['id']}})['then'](handleEntityNotFound(_0x2ac0bd,null))['then'](function(_0x2e4a64){if(_0x2e4a64){return _0x2e4a64[_0xd47c('0x90')](_0x36e67b[_0xd47c('0x58')]['ids'],_[_0xd47c('0x91')](_0x36e67b[_0xd47c('0x58')],[_0xd47c('0x6f'),'id'])||{})[_0xd47c('0x92')](function(_0x1501f6){for(var _0x379285=0x0;_0x379285<_0x36e67b['body']['ids'][_0xd47c('0x5d')];_0x379285+=0x1){socket['emit']('userSmsQueue:save',{'UserId':_0x36e67b['body']['ids'][_0x379285],'SmsQueueId':_0x36e67b['params']['id']});}return _0x1501f6;});}})[_0xd47c('0x2d')](respondWithResult(_0x2ac0bd,null))['catch'](handleError(_0x2ac0bd,null));};exports[_0xd47c('0x8e')]=function(_0x789c8d,_0xe18184,_0x3e07e8){return db[_0xd47c('0x3a')][_0xd47c('0x4e')]({'where':{'id':_0x789c8d[_0xd47c('0x59')]['id']}})[_0xd47c('0x2d')](handleEntityNotFound(_0xe18184,null))[_0xd47c('0x2d')](function(_0x5e8958){if(_0x5e8958){return _0x5e8958[_0xd47c('0x8e')](_0x789c8d[_0xd47c('0x3e')][_0xd47c('0x6f')])[_0xd47c('0x2d')](function(){if(_['isArray'](_0x789c8d['query'][_0xd47c('0x6f')])){for(var _0x528770=0x0;_0x528770<_0x789c8d[_0xd47c('0x3e')][_0xd47c('0x6f')][_0xd47c('0x5d')];_0x528770+=0x1){socket['emit'](_0xd47c('0x8f'),{'UserId':Number(_0x789c8d[_0xd47c('0x3e')][_0xd47c('0x6f')][_0x528770]),'SmsQueueId':Number(_0x789c8d[_0xd47c('0x59')]['id'])});}}else{socket['emit'](_0xd47c('0x8f'),{'UserId':Number(_0x789c8d[_0xd47c('0x3e')]['ids']),'SmsQueueId':Number(_0x789c8d['params']['id'])});}});}})[_0xd47c('0x2d')](respondWithStatusCode(_0xe18184,null))['catch'](handleError(_0xe18184,null));};exports[_0xd47c('0x93')]=function(_0x1c6fb7,_0x57861c,_0x55f0cc){var _0xcdf1a8={};var _0x5dfbf9={};var _0x108bb7;var _0x291f5a;return db['SmsQueue'][_0xd47c('0x5b')]({'where':{'id':_0x1c6fb7[_0xd47c('0x59')]['id']}})['then'](handleEntityNotFound(_0x57861c,null))[_0xd47c('0x2d')](function(_0x492f0f){if(_0x492f0f){_0x108bb7=_0x492f0f;_0x5dfbf9[_0xd47c('0x3d')]=_['keys'](db['User'][_0xd47c('0x3b')]);_0x5dfbf9[_0xd47c('0x3e')]=_[_0xd47c('0x4d')](_0x1c6fb7[_0xd47c('0x3e')]);_0x5dfbf9['filters']=_[_0xd47c('0x40')](_0x5dfbf9['model'],_0x5dfbf9[_0xd47c('0x3e')]);_0xcdf1a8[_0xd47c('0x41')]=_[_0xd47c('0x40')](_0x5dfbf9[_0xd47c('0x3d')],qs[_0xd47c('0x42')](_0x1c6fb7['query']['fields']));_0xcdf1a8[_0xd47c('0x41')]=_0xcdf1a8[_0xd47c('0x41')][_0xd47c('0x5d')]?_0xcdf1a8['attributes']:_0x5dfbf9[_0xd47c('0x3d')];_0xcdf1a8['order']=qs[_0xd47c('0x5f')](_0x1c6fb7[_0xd47c('0x3e')][_0xd47c('0x5f')]);_0xcdf1a8[_0xd47c('0x45')]=qs['filters'](_[_0xd47c('0x46')](_0x1c6fb7[_0xd47c('0x3e')],_0x5dfbf9[_0xd47c('0x3f')]));if(_0x1c6fb7['query'][_0xd47c('0x61')]){_0xcdf1a8[_0xd47c('0x45')]=_[_0xd47c('0x34')](_0xcdf1a8[_0xd47c('0x45')],{'$or':_['map'](_0xcdf1a8[_0xd47c('0x41')],function(_0x4c58aa){var _0x1d3d61={};_0x1d3d61[_0x4c58aa]={'$like':'%'+_0x1c6fb7[_0xd47c('0x3e')][_0xd47c('0x61')]+'%'};return _0x1d3d61;})});}_0xcdf1a8=_['merge']({},_0xcdf1a8,_0x1c6fb7[_0xd47c('0x48')]);return _0x108bb7[_0xd47c('0x93')](_0xcdf1a8);}})[_0xd47c('0x2d')](function(_0x2d3c40){if(_0x2d3c40){_0x291f5a=_0x2d3c40[_0xd47c('0x5d')];if(!_0x1c6fb7[_0xd47c('0x3e')][_0xd47c('0x43')](_0xd47c('0x5e'))){_0xcdf1a8[_0xd47c('0x25')]=qs[_0xd47c('0x25')](_0x1c6fb7[_0xd47c('0x3e')]['limit']);_0xcdf1a8[_0xd47c('0x22')]=qs[_0xd47c('0x22')](_0x1c6fb7[_0xd47c('0x3e')][_0xd47c('0x22')]);}return _0x108bb7[_0xd47c('0x93')](_0xcdf1a8);}})[_0xd47c('0x2d')](function(_0x2dfaf1){if(_0x2dfaf1){return _0x2dfaf1?{'count':_0x291f5a,'rows':_0x2dfaf1}:null;}})['then'](respondWithResult(_0x57861c,null))['catch'](handleError(_0x57861c,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index df3697d..826b36a 100644 --- a/server/api/smsQueue/smsQueue.events.js +++ b/server/api/smsQueue/smsQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb25=['remove','emit','hook','exports','../../mysqldb','SmsQueue','save','update'];(function(_0x163267,_0x516a95){var _0x4e15f8=function(_0x352266){while(--_0x352266){_0x163267['push'](_0x163267['shift']());}};_0x4e15f8(++_0x516a95);}(_0xbb25,0xec));var _0x5bb2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbb25[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x5bb2('0x0'))['db'][_0x5bb2('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5bb2('0x2'),'afterUpdate':_0x5bb2('0x3'),'afterDestroy':_0x5bb2('0x4')};function emitEvent(_0x45a798){return function(_0x3179e9,_0x34cb59,_0x479c00){SmsQueueEvents[_0x5bb2('0x5')](_0x45a798+':'+_0x3179e9['id'],_0x3179e9);SmsQueueEvents[_0x5bb2('0x5')](_0x45a798,_0x3179e9);_0x479c00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x5bb2('0x6')](e,emitEvent(event));}}module[_0x5bb2('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xce92=['events','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce92,0x186));var _0x2ce9=function(_0x37cb61,_0xa49d0){_0x37cb61=_0x37cb61-0x0;var _0x4ca1c7=_0xce92[_0x37cb61];return _0x4ca1c7;};'use strict';var EventEmitter=require(_0x2ce9('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x2ce9('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2ce9('0x2')](0x0);var events={'afterCreate':_0x2ce9('0x3'),'afterUpdate':_0x2ce9('0x4'),'afterDestroy':_0x2ce9('0x5')};function emitEvent(_0xbc8e5c){return function(_0x4845fa,_0x53923a,_0x4fd7f7){SmsQueueEvents[_0x2ce9('0x6')](_0xbc8e5c+':'+_0x4845fa['id'],_0x4845fa);SmsQueueEvents['emit'](_0xbc8e5c,_0x4845fa);_0x4fd7f7(null);};}for(var e in events){if(events[_0x2ce9('0x7')](e)){var event=events[e];SmsQueue[_0x2ce9('0x8')](e,emitEvent(event));}}module[_0x2ce9('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index a30eef5..003c691 100644 --- a/server/api/smsQueue/smsQueue.model.js +++ b/server/api/smsQueue/smsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a13=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x6a13,0x6c));var _0x36a1=function(_0x3e1045,_0x20d7d6){_0x3e1045=_0x3e1045-0x0;var _0x29836f=_0x6a13[_0x3e1045];return _0x29836f;};'use strict';var _=require(_0x36a1('0x0'));var util=require(_0x36a1('0x1'));var logger=require(_0x36a1('0x2'))(_0x36a1('0x3'));var moment=require('moment');var BPromise=require(_0x36a1('0x4'));var rp=require(_0x36a1('0x5'));var fs=require('fs');var path=require(_0x36a1('0x6'));var rimraf=require(_0x36a1('0x7'));var config=require(_0x36a1('0x8'));var attributes=require(_0x36a1('0x9'));module[_0x36a1('0xa')]=function(_0x1eff4e,_0xd476e){return _0x1eff4e[_0x36a1('0xb')](_0x36a1('0xc'),attributes,{'tableName':_0x36a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaa6=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./smsQueue.attributes','exports','define','SmsQueue','lodash'];(function(_0x1a6513,_0x30ce01){var _0xd5100f=function(_0x2f26c4){while(--_0x2f26c4){_0x1a6513['push'](_0x1a6513['shift']());}};_0xd5100f(++_0x30ce01);}(_0xeaa6,0x6d));var _0x6eaa=function(_0x456d19,_0x51c606){_0x456d19=_0x456d19-0x0;var _0x298690=_0xeaa6[_0x456d19];return _0x298690;};'use strict';var _=require(_0x6eaa('0x0'));var util=require(_0x6eaa('0x1'));var logger=require(_0x6eaa('0x2'))('api');var moment=require(_0x6eaa('0x3'));var BPromise=require(_0x6eaa('0x4'));var rp=require(_0x6eaa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6eaa('0x6'));var config=require('../../config/environment');var attributes=require(_0x6eaa('0x7'));module[_0x6eaa('0x8')]=function(_0x165541,_0x5037b8){return _0x165541[_0x6eaa('0x9')](_0x6eaa('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 91072c3..aaf07a1 100644 --- a/server/api/smsQueue/smsQueue.rpc.js +++ b/server/api/smsQueue/smsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b31=['include','map','model','debug','ShowSmsQueue','lodash','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit'];(function(_0x400635,_0x49a764){var _0x5b0c61=function(_0x2cb18a){while(--_0x2cb18a){_0x400635['push'](_0x400635['shift']());}};_0x5b0c61(++_0x49a764);}(_0x4b31,0x1cc));var _0x14b3=function(_0x30f395,_0x3629b5){_0x30f395=_0x30f395-0x0;var _0x2ea0ee=_0x4b31[_0x30f395];return _0x2ea0ee;};'use strict';var _=require(_0x14b3('0x0'));var util=require('util');var moment=require(_0x14b3('0x1'));var BPromise=require('bluebird');var rs=require(_0x14b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x14b3('0x3'))('rpc');var config=require(_0x14b3('0x4'));var jayson=require(_0x14b3('0x5'));var client=jayson[_0x14b3('0x6')]['http']({'port':0x232a});config[_0x14b3('0x7')]=_[_0x14b3('0x8')](config[_0x14b3('0x7')],{'host':_0x14b3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x14b3('0xa'))[_0x14b3('0xb')](socket);function respondWithRpcPromise(_0x2b54da,_0x29524f,_0xe9c9c2){return new BPromise(function(_0x3ec4fe,_0x3f7994){return client[_0x14b3('0xc')](_0x2b54da,_0xe9c9c2)[_0x14b3('0xd')](function(_0xd77592){logger[_0x14b3('0xe')](_0x14b3('0xf'),_0x29524f,_0x14b3('0x10'));logger['debug'](_0x14b3('0x11'),_0x29524f,_0x14b3('0x10'),JSON[_0x14b3('0x12')](_0xd77592));if(_0xd77592[_0x14b3('0x13')]){if(_0xd77592[_0x14b3('0x13')]['code']===0x1f4){logger[_0x14b3('0x13')](_0x14b3('0xf'),_0x29524f,_0xd77592[_0x14b3('0x13')][_0x14b3('0x14')]);return _0x3f7994(_0xd77592[_0x14b3('0x13')]['message']);}logger[_0x14b3('0x13')](_0x14b3('0xf'),_0x29524f,_0xd77592[_0x14b3('0x13')][_0x14b3('0x14')]);return _0x3ec4fe(_0xd77592[_0x14b3('0x13')][_0x14b3('0x14')]);}else{logger[_0x14b3('0xe')](_0x14b3('0xf'),_0x29524f,_0x14b3('0x10'));_0x3ec4fe(_0xd77592[_0x14b3('0x15')][_0x14b3('0x14')]);}})[_0x14b3('0x16')](function(_0x109f84){logger[_0x14b3('0x13')](_0x14b3('0xf'),_0x29524f,_0x109f84);_0x3f7994(_0x109f84);});});}exports[_0x14b3('0x17')]=function(_0x2556a5){var _0x270631=this;return new Promise(function(_0x3d8176,_0x18fbeb){return db[_0x14b3('0x18')]['findAll']({'raw':_0x2556a5[_0x14b3('0x19')]?_0x2556a5['options'][_0x14b3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2556a5['options']?_0x2556a5[_0x14b3('0x19')][_0x14b3('0x1b')]||null:null,'attributes':_0x2556a5['options']?_0x2556a5['options'][_0x14b3('0x1c')]||null:null,'limit':_0x2556a5[_0x14b3('0x19')]?_0x2556a5['options'][_0x14b3('0x1d')]||null:null,'include':_0x2556a5['options']?_0x2556a5['options'][_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x2556a5['options']['include'],function(_0x53539b){return{'model':db[_0x53539b[_0x14b3('0x20')]],'as':_0x53539b['as'],'attributes':_0x53539b[_0x14b3('0x1c')],'include':_0x53539b[_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x53539b[_0x14b3('0x1e')],function(_0x188d93){return{'model':db[_0x188d93[_0x14b3('0x20')]],'as':_0x188d93['as'],'attributes':_0x188d93[_0x14b3('0x1c')],'include':_0x188d93[_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x188d93[_0x14b3('0x1e')],function(_0x3580d5){return{'model':db[_0x3580d5[_0x14b3('0x20')]],'as':_0x3580d5['as'],'attributes':_0x3580d5[_0x14b3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14b3('0xd')](function(_0x411229){logger[_0x14b3('0xe')](_0x14b3('0x17'),_0x2556a5);logger[_0x14b3('0x21')](_0x14b3('0x17'),_0x2556a5,JSON[_0x14b3('0x12')](_0x411229));_0x3d8176(_0x411229);})['catch'](function(_0x2691b8){logger[_0x14b3('0x13')](_0x14b3('0x17'),_0x2691b8[_0x14b3('0x14')],_0x2556a5);_0x18fbeb(_0x270631[_0x14b3('0x13')](0x1f4,_0x2691b8[_0x14b3('0x14')]));});});};exports['ShowSmsQueue']=function(_0xad7496){var _0x37936d=this;return new Promise(function(_0x394a98,_0x4704ef){return db[_0x14b3('0x18')]['find']({'raw':_0xad7496[_0x14b3('0x19')]?_0xad7496[_0x14b3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xad7496[_0x14b3('0x19')]?_0xad7496['options'][_0x14b3('0x1b')]||null:null,'attributes':_0xad7496[_0x14b3('0x19')]?_0xad7496[_0x14b3('0x19')]['attributes']||null:null,'include':_0xad7496[_0x14b3('0x19')]?_0xad7496[_0x14b3('0x19')][_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0xad7496[_0x14b3('0x19')][_0x14b3('0x1e')],function(_0x43cfe3){return{'model':db[_0x43cfe3[_0x14b3('0x20')]],'as':_0x43cfe3['as'],'attributes':_0x43cfe3['attributes'],'include':_0x43cfe3[_0x14b3('0x1e')]?_['map'](_0x43cfe3['include'],function(_0x4c392e){return{'model':db[_0x4c392e[_0x14b3('0x20')]],'as':_0x4c392e['as'],'attributes':_0x4c392e['attributes'],'include':_0x4c392e[_0x14b3('0x1e')]?_[_0x14b3('0x1f')](_0x4c392e[_0x14b3('0x1e')],function(_0x5baf70){return{'model':db[_0x5baf70[_0x14b3('0x20')]],'as':_0x5baf70['as'],'attributes':_0x5baf70['attributes']};}):[]};}):[]};}):[]:[]})[_0x14b3('0xd')](function(_0x44fe1c){logger[_0x14b3('0xe')]('ShowSmsQueue',_0xad7496);logger['debug'](_0x14b3('0x22'),_0xad7496,JSON[_0x14b3('0x12')](_0x44fe1c));_0x394a98(_0x44fe1c);})[_0x14b3('0x16')](function(_0x21e3c1){logger[_0x14b3('0x13')](_0x14b3('0x22'),_0x21e3c1[_0x14b3('0x14')],_0xad7496);_0x4704ef(_0x37936d[_0x14b3('0x13')](0x1f4,_0x21e3c1[_0x14b3('0x14')]));});});}; \ No newline at end of file +var _0x035a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch','GetSmsQueue','findAll','options','raw','attributes','limit','include','map','model','debug','ShowSmsQueue','where','lodash','util','moment'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x035a,0x177));var _0xa035=function(_0x3e9176,_0x5d828b){_0x3e9176=_0x3e9176-0x0;var _0x9ac284=_0x035a[_0x3e9176];return _0x9ac284;};'use strict';var _=require(_0xa035('0x0'));var util=require(_0xa035('0x1'));var moment=require(_0xa035('0x2'));var BPromise=require(_0xa035('0x3'));var rs=require(_0xa035('0x4'));var fs=require('fs');var Redis=require(_0xa035('0x5'));var db=require(_0xa035('0x6'))['db'];var utils=require(_0xa035('0x7'));var logger=require(_0xa035('0x8'))(_0xa035('0x9'));var config=require(_0xa035('0xa'));var jayson=require(_0xa035('0xb'));var client=jayson[_0xa035('0xc')]['http']({'port':0x232a});config['redis']=_[_0xa035('0xd')](config[_0xa035('0xe')],{'host':_0xa035('0xf'),'port':0x18eb});var socket=require(_0xa035('0x10'))(new Redis(config['redis']));require(_0xa035('0x11'))[_0xa035('0x12')](socket);function respondWithRpcPromise(_0x42db7d,_0x21bc7d,_0x3d9e5f){return new BPromise(function(_0x271c20,_0x1fcfc6){return client[_0xa035('0x13')](_0x42db7d,_0x3d9e5f)[_0xa035('0x14')](function(_0x3d2ffe){logger[_0xa035('0x15')]('SmsQueue,\x20%s,\x20%s',_0x21bc7d,'request\x20sent');logger['debug'](_0xa035('0x16'),_0x21bc7d,'request\x20sent',JSON[_0xa035('0x17')](_0x3d2ffe));if(_0x3d2ffe[_0xa035('0x18')]){if(_0x3d2ffe['error'][_0xa035('0x19')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x21bc7d,_0x3d2ffe[_0xa035('0x18')][_0xa035('0x1a')]);return _0x1fcfc6(_0x3d2ffe[_0xa035('0x18')]['message']);}logger[_0xa035('0x18')](_0xa035('0x1b'),_0x21bc7d,_0x3d2ffe[_0xa035('0x18')]['message']);return _0x271c20(_0x3d2ffe[_0xa035('0x18')]['message']);}else{logger[_0xa035('0x15')](_0xa035('0x1b'),_0x21bc7d,'request\x20sent');_0x271c20(_0x3d2ffe[_0xa035('0x1c')][_0xa035('0x1a')]);}})[_0xa035('0x1d')](function(_0x90503f){logger[_0xa035('0x18')]('SmsQueue,\x20%s,\x20%s',_0x21bc7d,_0x90503f);_0x1fcfc6(_0x90503f);});});}exports[_0xa035('0x1e')]=function(_0x276f4e){var _0x1323f2=this;return new Promise(function(_0x303d3d,_0x1051d0){return db['SmsQueue'][_0xa035('0x1f')]({'raw':_0x276f4e[_0xa035('0x20')]?_0x276f4e[_0xa035('0x20')][_0xa035('0x21')]===undefined?!![]:![]:!![],'where':_0x276f4e[_0xa035('0x20')]?_0x276f4e[_0xa035('0x20')]['where']||null:null,'attributes':_0x276f4e['options']?_0x276f4e[_0xa035('0x20')][_0xa035('0x22')]||null:null,'limit':_0x276f4e[_0xa035('0x20')]?_0x276f4e['options'][_0xa035('0x23')]||null:null,'include':_0x276f4e[_0xa035('0x20')]?_0x276f4e[_0xa035('0x20')][_0xa035('0x24')]?_['map'](_0x276f4e[_0xa035('0x20')][_0xa035('0x24')],function(_0x40ff9c){return{'model':db[_0x40ff9c['model']],'as':_0x40ff9c['as'],'attributes':_0x40ff9c[_0xa035('0x22')],'include':_0x40ff9c[_0xa035('0x24')]?_[_0xa035('0x25')](_0x40ff9c['include'],function(_0xff0c18){return{'model':db[_0xff0c18[_0xa035('0x26')]],'as':_0xff0c18['as'],'attributes':_0xff0c18[_0xa035('0x22')],'include':_0xff0c18['include']?_[_0xa035('0x25')](_0xff0c18[_0xa035('0x24')],function(_0x37a87e){return{'model':db[_0x37a87e['model']],'as':_0x37a87e['as'],'attributes':_0x37a87e[_0xa035('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa035('0x14')](function(_0x32f24a){logger[_0xa035('0x15')](_0xa035('0x1e'),_0x276f4e);logger[_0xa035('0x27')](_0xa035('0x1e'),_0x276f4e,JSON[_0xa035('0x17')](_0x32f24a));_0x303d3d(_0x32f24a);})[_0xa035('0x1d')](function(_0x33535d){logger['error'](_0xa035('0x1e'),_0x33535d[_0xa035('0x1a')],_0x276f4e);_0x1051d0(_0x1323f2[_0xa035('0x18')](0x1f4,_0x33535d[_0xa035('0x1a')]));});});};exports[_0xa035('0x28')]=function(_0x55d23c){var _0x116b20=this;return new Promise(function(_0x1cee36,_0x46c42a){return db['SmsQueue']['find']({'raw':_0x55d23c[_0xa035('0x20')]?_0x55d23c['options'][_0xa035('0x21')]===undefined?!![]:![]:!![],'where':_0x55d23c['options']?_0x55d23c['options'][_0xa035('0x29')]||null:null,'attributes':_0x55d23c[_0xa035('0x20')]?_0x55d23c['options'][_0xa035('0x22')]||null:null,'include':_0x55d23c[_0xa035('0x20')]?_0x55d23c[_0xa035('0x20')][_0xa035('0x24')]?_[_0xa035('0x25')](_0x55d23c['options']['include'],function(_0x379f5b){return{'model':db[_0x379f5b[_0xa035('0x26')]],'as':_0x379f5b['as'],'attributes':_0x379f5b[_0xa035('0x22')],'include':_0x379f5b[_0xa035('0x24')]?_[_0xa035('0x25')](_0x379f5b[_0xa035('0x24')],function(_0x57fe47){return{'model':db[_0x57fe47['model']],'as':_0x57fe47['as'],'attributes':_0x57fe47[_0xa035('0x22')],'include':_0x57fe47[_0xa035('0x24')]?_[_0xa035('0x25')](_0x57fe47[_0xa035('0x24')],function(_0x4708ec){return{'model':db[_0x4708ec['model']],'as':_0x4708ec['as'],'attributes':_0x4708ec[_0xa035('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa035('0x14')](function(_0x1cc316){logger[_0xa035('0x15')](_0xa035('0x28'),_0x55d23c);logger[_0xa035('0x27')](_0xa035('0x28'),_0x55d23c,JSON[_0xa035('0x17')](_0x1cc316));_0x1cee36(_0x1cc316);})[_0xa035('0x1d')](function(_0x540926){logger[_0xa035('0x18')](_0xa035('0x28'),_0x540926[_0xa035('0x1a')],_0x55d23c);_0x46c42a(_0x116b20[_0xa035('0x18')](0x1f4,_0x540926[_0xa035('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 53e7c7d..e68915e 100644 --- a/server/api/smsQueue/smsQueue.socket.js +++ b/server/api/smsQueue/smsQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b34=['save','remove','emit','register','smsQueue:'];(function(_0x2f4d7f,_0x62f4b7){var _0x147ba1=function(_0x14ef36){while(--_0x14ef36){_0x2f4d7f['push'](_0x2f4d7f['shift']());}};_0x147ba1(++_0x62f4b7);}(_0x2b34,0x19f));var _0x42b3=function(_0x3046da,_0x599123){_0x3046da=_0x3046da-0x0;var _0x467db2=_0x2b34[_0x3046da];return _0x467db2;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x42b3('0x0'),_0x42b3('0x1'),'update'];function createListener(_0x2514d3,_0x565709){return function(_0x4e65fb){_0x565709[_0x42b3('0x2')](_0x2514d3,_0x4e65fb);};}function removeListener(_0x4c7e3b,_0x6a31b){return function(){SmsQueueEvents['removeListener'](_0x4c7e3b,_0x6a31b);};}exports[_0x42b3('0x3')]=function(_0x34c1d2){for(var _0x3ced43=0x0,_0x461393=events['length'];_0x3ced43<_0x461393;_0x3ced43++){var _0x1fcbee=events[_0x3ced43];var _0x23e46b=createListener(_0x42b3('0x4')+_0x1fcbee,_0x34c1d2);SmsQueueEvents['on'](_0x1fcbee,_0x23e46b);}}; \ No newline at end of file +var _0xbcf6=['remove','update','emit','removeListener','register','length','smsQueue:','save'];(function(_0xc03309,_0x19f3e1){var _0x40a1bd=function(_0x3e90f1){while(--_0x3e90f1){_0xc03309['push'](_0xc03309['shift']());}};_0x40a1bd(++_0x19f3e1);}(_0xbcf6,0xa7));var _0x6bcf=function(_0x351b4c,_0x5d78f5){_0x351b4c=_0x351b4c-0x0;var _0x4de136=_0xbcf6[_0x351b4c];return _0x4de136;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x6bcf('0x0'),_0x6bcf('0x1'),_0x6bcf('0x2')];function createListener(_0x4b99b0,_0xd67367){return function(_0x63811b){_0xd67367[_0x6bcf('0x3')](_0x4b99b0,_0x63811b);};}function removeListener(_0x13604d,_0x43f563){return function(){SmsQueueEvents[_0x6bcf('0x4')](_0x13604d,_0x43f563);};}exports[_0x6bcf('0x5')]=function(_0x22a50a){for(var _0x3a1293=0x0,_0x1f2d93=events[_0x6bcf('0x6')];_0x3a1293<_0x1f2d93;_0x3a1293++){var _0x22b8f8=events[_0x3a1293];var _0x132e53=createListener(_0x6bcf('0x7')+_0x22b8f8,_0x22a50a);SmsQueueEvents['on'](_0x22b8f8,_0x132e53);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6544555..dfbe93f 100644 --- a/server/api/smsQueueReport/index.js +++ b/server/api/smsQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe643=['get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x150469,_0x5ec8a2){var _0x110773=function(_0x3c8448){while(--_0x3c8448){_0x150469['push'](_0x150469['shift']());}};_0x110773(++_0x5ec8a2);}(_0xe643,0x84));var _0x3e64=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe643[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x3e64('0x0'));var util=require(_0x3e64('0x1'));var path=require('path');var timeout=require(_0x3e64('0x2'));var express=require('express');var router=express[_0x3e64('0x3')]();var fs_extra=require(_0x3e64('0x4'));var auth=require(_0x3e64('0x5'));var interaction=require(_0x3e64('0x6'));var config=require(_0x3e64('0x7'));var controller=require('./smsQueueReport.controller');router[_0x3e64('0x8')]('/',auth[_0x3e64('0x9')](),controller[_0x3e64('0xa')]);router[_0x3e64('0x8')](_0x3e64('0xb'),auth[_0x3e64('0x9')](),controller['describe']);router[_0x3e64('0x8')](_0x3e64('0xc'),auth[_0x3e64('0x9')](),controller[_0x3e64('0xd')]);router[_0x3e64('0xe')]('/',auth[_0x3e64('0x9')](),controller[_0x3e64('0xf')]);router[_0x3e64('0x10')](_0x3e64('0xc'),auth[_0x3e64('0x9')](),controller['update']);router[_0x3e64('0x11')](_0x3e64('0xc'),auth[_0x3e64('0x9')](),controller[_0x3e64('0x12')]);module[_0x3e64('0x13')]=router; \ No newline at end of file +var _0x4f08=['update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','show','post','create','put'];(function(_0x1ce878,_0x1b4eeb){var _0x4da4ae=function(_0x251d09){while(--_0x251d09){_0x1ce878['push'](_0x1ce878['shift']());}};_0x4da4ae(++_0x1b4eeb);}(_0x4f08,0x1bc));var _0x84f0=function(_0x2aa57a,_0x19b4c8){_0x2aa57a=_0x2aa57a-0x0;var _0x1d2383=_0x4f08[_0x2aa57a];return _0x1d2383;};'use strict';var multer=require(_0x84f0('0x0'));var util=require(_0x84f0('0x1'));var path=require('path');var timeout=require(_0x84f0('0x2'));var express=require(_0x84f0('0x3'));var router=express[_0x84f0('0x4')]();var fs_extra=require(_0x84f0('0x5'));var auth=require(_0x84f0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x84f0('0x7')]('/',auth['isAuthenticated'](),controller[_0x84f0('0x8')]);router[_0x84f0('0x7')](_0x84f0('0x9'),auth[_0x84f0('0xa')](),controller[_0x84f0('0xb')]);router[_0x84f0('0x7')]('/:id',auth[_0x84f0('0xa')](),controller[_0x84f0('0xc')]);router[_0x84f0('0xd')]('/',auth[_0x84f0('0xa')](),controller[_0x84f0('0xe')]);router[_0x84f0('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x84f0('0x10')]);router[_0x84f0('0x11')](_0x84f0('0x12'),auth[_0x84f0('0xa')](),controller['destroy']);module[_0x84f0('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 14ade00..3a74210 100644 --- a/server/api/smsQueueReport/smsQueueReport.attributes.js +++ b/server/api/smsQueueReport/smsQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e92=['DATE','moment','sequelize','exports','STRING'];(function(_0x2b0020,_0x1f6934){var _0x45894a=function(_0x457a83){while(--_0x457a83){_0x2b0020['push'](_0x2b0020['shift']());}};_0x45894a(++_0x1f6934);}(_0x9e92,0xd3));var _0x29e9=function(_0x42b8d4,_0x419917){_0x42b8d4=_0x42b8d4-0x0;var _0x5593d2=_0x9e92[_0x42b8d4];return _0x5593d2;};'use strict';var moment=require(_0x29e9('0x0'));var Sequelize=require(_0x29e9('0x1'));module[_0x29e9('0x2')]={'uniqueid':{'type':Sequelize[_0x29e9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x29e9('0x3')]},'joinAt':{'type':Sequelize[_0x29e9('0x4')]},'leaveAt':{'type':Sequelize[_0x29e9('0x4')]},'acceptAt':{'type':Sequelize[_0x29e9('0x4')]},'exitAt':{'type':Sequelize[_0x29e9('0x4')]},'reason':{'type':Sequelize[_0x29e9('0x3')]}}; \ No newline at end of file +var _0xe28f=['STRING','DATE','sequelize','exports'];(function(_0x2c6c98,_0x462751){var _0x4e0157=function(_0x4fbc55){while(--_0x4fbc55){_0x2c6c98['push'](_0x2c6c98['shift']());}};_0x4e0157(++_0x462751);}(_0xe28f,0x82));var _0xfe28=function(_0x319963,_0x2cb428){_0x319963=_0x319963-0x0;var _0x198b2a=_0xe28f[_0x319963];return _0x198b2a;};'use strict';var moment=require('moment');var Sequelize=require(_0xfe28('0x0'));module[_0xfe28('0x1')]={'uniqueid':{'type':Sequelize[_0xfe28('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfe28('0x3')]},'leaveAt':{'type':Sequelize[_0xfe28('0x3')]},'acceptAt':{'type':Sequelize[_0xfe28('0x3')]},'exitAt':{'type':Sequelize[_0xfe28('0x3')]},'reason':{'type':Sequelize[_0xfe28('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 72708be..2e448a8 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe432=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','status','error','stack','name','merge','body','contact','message','agent','interaction','account','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','options','SmsQueueReport','includeAll','findAll','rows','show','rawAttributes','find','catch','create','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x4144ef,_0x3ed22b){var _0x3691ba=function(_0x33b2df){while(--_0x33b2df){_0x4144ef['push'](_0x4144ef['shift']());}};_0x3691ba(++_0x3ed22b);}(_0xe432,0x91));var _0x2e43=function(_0x99f838,_0xe376e2){_0x99f838=_0x99f838-0x0;var _0x432cd7=_0xe432[_0x99f838];return _0x432cd7;};'use strict';var emlformat=require(_0x2e43('0x0'));var rimraf=require(_0x2e43('0x1'));var zipdir=require(_0x2e43('0x2'));var jsonpatch=require(_0x2e43('0x3'));var rp=require(_0x2e43('0x4'));var moment=require(_0x2e43('0x5'));var BPromise=require(_0x2e43('0x6'));var Mustache=require(_0x2e43('0x7'));var util=require(_0x2e43('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2e43('0x9'));var ejs=require(_0x2e43('0xa'));var fs=require('fs');var fs_extra=require(_0x2e43('0xb'));var _=require(_0x2e43('0xc'));var squel=require(_0x2e43('0xd'));var crypto=require(_0x2e43('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2e43('0xf'));var toCsv=require(_0x2e43('0x9'));var querystring=require(_0x2e43('0x10'));var Papa=require(_0x2e43('0x11'));var Redis=require(_0x2e43('0x12'));var authService=require(_0x2e43('0x13'));var qs=require(_0x2e43('0x14'));var as=require(_0x2e43('0x15'));var hardwareService=require(_0x2e43('0x16'));var logger=require(_0x2e43('0x17'))(_0x2e43('0x18'));var utils=require(_0x2e43('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2e43('0x1a'))['db'];function respondWithStatusCode(_0x1788e9,_0x1a4f8f){_0x1a4f8f=_0x1a4f8f||0xcc;return function(_0x57077e){if(_0x57077e){return _0x1788e9[_0x2e43('0x1b')](_0x1a4f8f);}return _0x1788e9['status'](_0x1a4f8f)[_0x2e43('0x1c')]();};}function respondWithResult(_0x4c1560,_0x181d83){_0x181d83=_0x181d83||0xc8;return function(_0x91e89f){if(_0x91e89f){return _0x4c1560['status'](_0x181d83)[_0x2e43('0x1d')](_0x91e89f);}};}function respondWithFilteredResult(_0x516362,_0x16b30e){return function(_0x48a6ca){if(_0x48a6ca){var _0x4d0b1d=typeof _0x16b30e['offset']===_0x2e43('0x1e')&&typeof _0x16b30e['limit']==='undefined';var _0x402265=_0x48a6ca[_0x2e43('0x1f')];var _0x4704c9=_0x4d0b1d?0x0:_0x16b30e['offset'];var _0x3e7c2f=_0x4d0b1d?_0x48a6ca[_0x2e43('0x1f')]:_0x16b30e[_0x2e43('0x20')]+_0x16b30e[_0x2e43('0x21')];var _0x3148fe;if(_0x3e7c2f>=_0x402265){_0x3e7c2f=_0x402265;_0x3148fe=0xc8;}else{_0x3148fe=0xce;}_0x516362['status'](_0x3148fe);return _0x516362[_0x2e43('0x22')](_0x2e43('0x23'),_0x4704c9+'-'+_0x3e7c2f+'/'+_0x402265)[_0x2e43('0x1d')](_0x48a6ca);}return null;};}function patchUpdates(_0x5d2d69){return function(_0x105d05){try{jsonpatch[_0x2e43('0x24')](_0x105d05,_0x5d2d69,!![]);}catch(_0x51c8a5){return BPromise['reject'](_0x51c8a5);}return _0x105d05[_0x2e43('0x25')]();};}function saveUpdates(_0x19e41c,_0x4a1ab8){return function(_0x1d91a4){if(_0x1d91a4){return _0x1d91a4['update'](_0x19e41c)[_0x2e43('0x26')](function(_0x1b0c8d){return _0x1b0c8d;});}return null;};}function removeEntity(_0x302989,_0x526df4){return function(_0x34674a){if(_0x34674a){return _0x34674a[_0x2e43('0x27')]()[_0x2e43('0x26')](function(){_0x302989[_0x2e43('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x447d59,_0x8c5ad){return function(_0x3c41cd){if(!_0x3c41cd){_0x447d59[_0x2e43('0x1b')](0x194);}return _0x3c41cd;};}function handleError(_0xaf0ec6,_0x1aa658){_0x1aa658=_0x1aa658||0x1f4;return function(_0x90d9fd){logger[_0x2e43('0x29')](_0x90d9fd[_0x2e43('0x2a')]);if(_0x90d9fd['name']){delete _0x90d9fd[_0x2e43('0x2b')];}_0xaf0ec6[_0x2e43('0x28')](_0x1aa658)['send'](_0x90d9fd);};}function getMustacheRender(_0x2a5eac,_0x53fd79){return Mustache['render'](_0x2a5eac,_[_0x2e43('0x2c')](_0x53fd79[_0x2e43('0x2d')],{'contact':_0x53fd79[_0x2e43('0x2e')],'message':_0x53fd79[_0x2e43('0x2f')],'agent':_0x53fd79[_0x2e43('0x30')],'interaction':_0x53fd79[_0x2e43('0x31')],'account':_0x53fd79[_0x2e43('0x32')]}))||'';}exports['index']=function(_0x253fa5,_0x3867c9){var _0x4d2306={},_0x4d7f4c={},_0x46b6aa={'count':0x0,'rows':[]};var _0x5569a1=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x4f4b0c){return{'name':_0x4f4b0c[_0x2e43('0x33')],'type':_0x4f4b0c['type'][_0x2e43('0x34')]};});_0x4d7f4c[_0x2e43('0x35')]=_['map'](_0x5569a1,_0x2e43('0x2b'));_0x4d7f4c['query']=_[_0x2e43('0x36')](_0x253fa5[_0x2e43('0x37')]);_0x4d7f4c[_0x2e43('0x38')]=_[_0x2e43('0x39')](_0x4d7f4c[_0x2e43('0x35')],_0x4d7f4c['query']);_0x4d2306[_0x2e43('0x3a')]=_[_0x2e43('0x39')](_0x4d7f4c['model'],qs[_0x2e43('0x3b')](_0x253fa5['query'][_0x2e43('0x3b')]));_0x4d2306[_0x2e43('0x3a')]=_0x4d2306[_0x2e43('0x3a')]['length']?_0x4d2306[_0x2e43('0x3a')]:_0x4d7f4c[_0x2e43('0x35')];if(!_0x253fa5[_0x2e43('0x37')][_0x2e43('0x3c')](_0x2e43('0x3d'))){_0x4d2306[_0x2e43('0x21')]=qs[_0x2e43('0x21')](_0x253fa5[_0x2e43('0x37')][_0x2e43('0x21')]);_0x4d2306['offset']=qs['offset'](_0x253fa5[_0x2e43('0x37')][_0x2e43('0x20')]);}_0x4d2306[_0x2e43('0x3e')]=qs[_0x2e43('0x3f')](_0x253fa5['query'][_0x2e43('0x3f')]);_0x4d2306[_0x2e43('0x40')]=qs[_0x2e43('0x38')](_[_0x2e43('0x41')](_0x253fa5['query'],_0x4d7f4c['filters']),_0x5569a1);if(_0x253fa5[_0x2e43('0x37')]['filter']){_0x4d2306[_0x2e43('0x40')]=_[_0x2e43('0x2c')](_0x4d2306[_0x2e43('0x40')],{'$or':_[_0x2e43('0x42')](_0x5569a1,function(_0x748496){if(_0x748496['type']!==_0x2e43('0x43')){var _0x213f0f={};_0x213f0f[_0x748496[_0x2e43('0x2b')]]={'$like':'%'+_0x253fa5[_0x2e43('0x37')][_0x2e43('0x44')]+'%'};return _0x213f0f;}})});}_0x4d2306=_[_0x2e43('0x2c')]({},_0x4d2306,_0x253fa5[_0x2e43('0x45')]);var _0x58a50e={'where':_0x4d2306[_0x2e43('0x40')]};return db[_0x2e43('0x46')][_0x2e43('0x1f')](_0x58a50e)[_0x2e43('0x26')](function(_0x2ae8aa){_0x46b6aa[_0x2e43('0x1f')]=_0x2ae8aa;if(_0x253fa5[_0x2e43('0x37')][_0x2e43('0x47')]){_0x4d2306['include']=[{'all':!![]}];}return db[_0x2e43('0x46')][_0x2e43('0x48')](_0x4d2306);})['then'](function(_0x517bf9){_0x46b6aa[_0x2e43('0x49')]=_0x517bf9;return _0x46b6aa;})['then'](respondWithFilteredResult(_0x3867c9,_0x4d2306))['catch'](handleError(_0x3867c9,null));};exports[_0x2e43('0x4a')]=function(_0xbb0875,_0x3179c8){var _0x29817a={'raw':!![],'where':{'id':_0xbb0875['params']['id']}},_0xba1bf3={};_0xba1bf3[_0x2e43('0x35')]=_['keys'](db['SmsQueueReport'][_0x2e43('0x4b')]);_0xba1bf3[_0x2e43('0x37')]=_[_0x2e43('0x36')](_0xbb0875['query']);_0xba1bf3[_0x2e43('0x38')]=_['intersection'](_0xba1bf3[_0x2e43('0x35')],_0xba1bf3['query']);_0x29817a[_0x2e43('0x3a')]=_[_0x2e43('0x39')](_0xba1bf3[_0x2e43('0x35')],qs[_0x2e43('0x3b')](_0xbb0875[_0x2e43('0x37')]['fields']));_0x29817a[_0x2e43('0x3a')]=_0x29817a['attributes']['length']?_0x29817a[_0x2e43('0x3a')]:_0xba1bf3[_0x2e43('0x35')];if(_0xbb0875['query'][_0x2e43('0x47')]){_0x29817a['include']=[{'all':!![]}];}_0x29817a=_[_0x2e43('0x2c')]({},_0x29817a,_0xbb0875[_0x2e43('0x45')]);return db[_0x2e43('0x46')][_0x2e43('0x4c')](_0x29817a)[_0x2e43('0x26')](handleEntityNotFound(_0x3179c8,null))['then'](respondWithResult(_0x3179c8,null))[_0x2e43('0x4d')](handleError(_0x3179c8,null));};exports[_0x2e43('0x4e')]=function(_0x467cdb,_0x29edd3){return db[_0x2e43('0x46')]['create'](_0x467cdb[_0x2e43('0x2d')],{})[_0x2e43('0x26')](respondWithResult(_0x29edd3,0xc9))[_0x2e43('0x4d')](handleError(_0x29edd3,null));};exports[_0x2e43('0x4f')]=function(_0x10597b,_0x17c3be){if(_0x10597b[_0x2e43('0x2d')]['id']){delete _0x10597b[_0x2e43('0x2d')]['id'];}return db[_0x2e43('0x46')]['find']({'where':{'id':_0x10597b[_0x2e43('0x50')]['id']}})[_0x2e43('0x26')](handleEntityNotFound(_0x17c3be,null))[_0x2e43('0x26')](saveUpdates(_0x10597b[_0x2e43('0x2d')],null))[_0x2e43('0x26')](respondWithResult(_0x17c3be,null))['catch'](handleError(_0x17c3be,null));};exports[_0x2e43('0x27')]=function(_0x199d23,_0x5be201){return db[_0x2e43('0x46')][_0x2e43('0x4c')]({'where':{'id':_0x199d23[_0x2e43('0x50')]['id']}})[_0x2e43('0x26')](handleEntityNotFound(_0x5be201,null))[_0x2e43('0x26')](removeEntity(_0x5be201,null))[_0x2e43('0x4d')](handleError(_0x5be201,null));};exports[_0x2e43('0x51')]=function(_0x5428c6,_0x42c9c7){return db['SmsQueueReport'][_0x2e43('0x51')]()['then'](respondWithResult(_0x42c9c7,null))[_0x2e43('0x4d')](handleError(_0x42c9c7,null));}; \ No newline at end of file +var _0x0d3b=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','render','merge','body','contact','message','agent','interaction','account','index','SmsQueueReport','rawAttributes','fieldName','type','map','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','rows','catch','params','fields','find','create','describe'];(function(_0x25e947,_0x5ef1a5){var _0x25184=function(_0xa32a2a){while(--_0xa32a2a){_0x25e947['push'](_0x25e947['shift']());}};_0x25184(++_0x5ef1a5);}(_0x0d3b,0xf0));var _0xb0d3=function(_0x4e8519,_0x5775f9){_0x4e8519=_0x4e8519-0x0;var _0x5eb153=_0x0d3b[_0x4e8519];return _0x5eb153;};'use strict';var emlformat=require(_0xb0d3('0x0'));var rimraf=require(_0xb0d3('0x1'));var zipdir=require(_0xb0d3('0x2'));var jsonpatch=require(_0xb0d3('0x3'));var rp=require(_0xb0d3('0x4'));var moment=require(_0xb0d3('0x5'));var BPromise=require(_0xb0d3('0x6'));var Mustache=require(_0xb0d3('0x7'));var util=require(_0xb0d3('0x8'));var path=require(_0xb0d3('0x9'));var sox=require(_0xb0d3('0xa'));var csv=require(_0xb0d3('0xb'));var ejs=require(_0xb0d3('0xc'));var fs=require('fs');var fs_extra=require(_0xb0d3('0xd'));var _=require('lodash');var squel=require(_0xb0d3('0xe'));var crypto=require(_0xb0d3('0xf'));var jsforce=require(_0xb0d3('0x10'));var deskjs=require(_0xb0d3('0x11'));var toCsv=require(_0xb0d3('0xb'));var querystring=require('querystring');var Papa=require(_0xb0d3('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb0d3('0x13'));var as=require(_0xb0d3('0x14'));var hardwareService=require(_0xb0d3('0x15'));var logger=require(_0xb0d3('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb0d3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0d3('0x18'))['db'];function respondWithStatusCode(_0x3c19e9,_0x505a14){_0x505a14=_0x505a14||0xcc;return function(_0x2867d1){if(_0x2867d1){return _0x3c19e9[_0xb0d3('0x19')](_0x505a14);}return _0x3c19e9[_0xb0d3('0x1a')](_0x505a14)[_0xb0d3('0x1b')]();};}function respondWithResult(_0x4a8c44,_0x18d899){_0x18d899=_0x18d899||0xc8;return function(_0x293648){if(_0x293648){return _0x4a8c44[_0xb0d3('0x1a')](_0x18d899)[_0xb0d3('0x1c')](_0x293648);}};}function respondWithFilteredResult(_0xc1f5b4,_0x43c532){return function(_0x890db2){if(_0x890db2){var _0x1d6ac1=typeof _0x43c532[_0xb0d3('0x1d')]===_0xb0d3('0x1e')&&typeof _0x43c532[_0xb0d3('0x1f')]===_0xb0d3('0x1e');var _0x41ed81=_0x890db2['count'];var _0x2a9ae5=_0x1d6ac1?0x0:_0x43c532['offset'];var _0xb5355d=_0x1d6ac1?_0x890db2[_0xb0d3('0x20')]:_0x43c532[_0xb0d3('0x1d')]+_0x43c532[_0xb0d3('0x1f')];var _0x5b2cb6;if(_0xb5355d>=_0x41ed81){_0xb5355d=_0x41ed81;_0x5b2cb6=0xc8;}else{_0x5b2cb6=0xce;}_0xc1f5b4[_0xb0d3('0x1a')](_0x5b2cb6);return _0xc1f5b4[_0xb0d3('0x21')]('Content-Range',_0x2a9ae5+'-'+_0xb5355d+'/'+_0x41ed81)[_0xb0d3('0x1c')](_0x890db2);}return null;};}function patchUpdates(_0x4a5962){return function(_0x2d2bd6){try{jsonpatch[_0xb0d3('0x22')](_0x2d2bd6,_0x4a5962,!![]);}catch(_0x1efa16){return BPromise['reject'](_0x1efa16);}return _0x2d2bd6[_0xb0d3('0x23')]();};}function saveUpdates(_0xa34c9d,_0x26f8af){return function(_0x5606b0){if(_0x5606b0){return _0x5606b0[_0xb0d3('0x24')](_0xa34c9d)[_0xb0d3('0x25')](function(_0x1b23f4){return _0x1b23f4;});}return null;};}function removeEntity(_0x55696a,_0x167dc4){return function(_0x40b173){if(_0x40b173){return _0x40b173[_0xb0d3('0x26')]()[_0xb0d3('0x25')](function(){_0x55696a[_0xb0d3('0x1a')](0xcc)[_0xb0d3('0x1b')]();});}};}function handleEntityNotFound(_0x5e3fcd,_0x32bfff){return function(_0x3fe49b){if(!_0x3fe49b){_0x5e3fcd[_0xb0d3('0x19')](0x194);}return _0x3fe49b;};}function handleError(_0x348395,_0x4c4e40){_0x4c4e40=_0x4c4e40||0x1f4;return function(_0x4392a3){logger[_0xb0d3('0x27')](_0x4392a3['stack']);if(_0x4392a3['name']){delete _0x4392a3[_0xb0d3('0x28')];}_0x348395[_0xb0d3('0x1a')](_0x4c4e40)[_0xb0d3('0x29')](_0x4392a3);};}function getMustacheRender(_0x554310,_0x55bc0e){return Mustache[_0xb0d3('0x2a')](_0x554310,_[_0xb0d3('0x2b')](_0x55bc0e[_0xb0d3('0x2c')],{'contact':_0x55bc0e[_0xb0d3('0x2d')],'message':_0x55bc0e[_0xb0d3('0x2e')],'agent':_0x55bc0e[_0xb0d3('0x2f')],'interaction':_0x55bc0e[_0xb0d3('0x30')],'account':_0x55bc0e[_0xb0d3('0x31')]}))||'';}exports[_0xb0d3('0x32')]=function(_0x2946d6,_0x5d6633){var _0x2a71b1={},_0x3e0f3a={},_0x341045={'count':0x0,'rows':[]};var _0x3305b8=_['map'](db[_0xb0d3('0x33')][_0xb0d3('0x34')],function(_0x3bc6c5){return{'name':_0x3bc6c5[_0xb0d3('0x35')],'type':_0x3bc6c5[_0xb0d3('0x36')]['key']};});_0x3e0f3a['model']=_[_0xb0d3('0x37')](_0x3305b8,'name');_0x3e0f3a['query']=_[_0xb0d3('0x38')](_0x2946d6['query']);_0x3e0f3a[_0xb0d3('0x39')]=_[_0xb0d3('0x3a')](_0x3e0f3a[_0xb0d3('0x3b')],_0x3e0f3a[_0xb0d3('0x3c')]);_0x2a71b1[_0xb0d3('0x3d')]=_[_0xb0d3('0x3a')](_0x3e0f3a[_0xb0d3('0x3b')],qs['fields'](_0x2946d6[_0xb0d3('0x3c')]['fields']));_0x2a71b1['attributes']=_0x2a71b1[_0xb0d3('0x3d')][_0xb0d3('0x3e')]?_0x2a71b1[_0xb0d3('0x3d')]:_0x3e0f3a['model'];if(!_0x2946d6[_0xb0d3('0x3c')][_0xb0d3('0x3f')](_0xb0d3('0x40'))){_0x2a71b1['limit']=qs[_0xb0d3('0x1f')](_0x2946d6['query'][_0xb0d3('0x1f')]);_0x2a71b1[_0xb0d3('0x1d')]=qs[_0xb0d3('0x1d')](_0x2946d6['query'][_0xb0d3('0x1d')]);}_0x2a71b1[_0xb0d3('0x41')]=qs[_0xb0d3('0x42')](_0x2946d6[_0xb0d3('0x3c')][_0xb0d3('0x42')]);_0x2a71b1[_0xb0d3('0x43')]=qs[_0xb0d3('0x39')](_['pick'](_0x2946d6[_0xb0d3('0x3c')],_0x3e0f3a['filters']),_0x3305b8);if(_0x2946d6['query'][_0xb0d3('0x44')]){_0x2a71b1[_0xb0d3('0x43')]=_[_0xb0d3('0x2b')](_0x2a71b1[_0xb0d3('0x43')],{'$or':_[_0xb0d3('0x37')](_0x3305b8,function(_0x1d3175){if(_0x1d3175['type']!=='VIRTUAL'){var _0x5ed2d6={};_0x5ed2d6[_0x1d3175[_0xb0d3('0x28')]]={'$like':'%'+_0x2946d6['query'][_0xb0d3('0x44')]+'%'};return _0x5ed2d6;}})});}_0x2a71b1=_['merge']({},_0x2a71b1,_0x2946d6[_0xb0d3('0x45')]);var _0xcfc4c1={'where':_0x2a71b1['where']};return db['SmsQueueReport'][_0xb0d3('0x20')](_0xcfc4c1)['then'](function(_0x4d3bc9){_0x341045[_0xb0d3('0x20')]=_0x4d3bc9;if(_0x2946d6[_0xb0d3('0x3c')][_0xb0d3('0x46')]){_0x2a71b1[_0xb0d3('0x47')]=[{'all':!![]}];}return db[_0xb0d3('0x33')][_0xb0d3('0x48')](_0x2a71b1);})[_0xb0d3('0x25')](function(_0x2fdfc3){_0x341045[_0xb0d3('0x49')]=_0x2fdfc3;return _0x341045;})['then'](respondWithFilteredResult(_0x5d6633,_0x2a71b1))[_0xb0d3('0x4a')](handleError(_0x5d6633,null));};exports['show']=function(_0x1acdc1,_0x3f3251){var _0x173315={'raw':!![],'where':{'id':_0x1acdc1[_0xb0d3('0x4b')]['id']}},_0x2c53a2={};_0x2c53a2[_0xb0d3('0x3b')]=_['keys'](db[_0xb0d3('0x33')]['rawAttributes']);_0x2c53a2['query']=_[_0xb0d3('0x38')](_0x1acdc1['query']);_0x2c53a2['filters']=_[_0xb0d3('0x3a')](_0x2c53a2[_0xb0d3('0x3b')],_0x2c53a2[_0xb0d3('0x3c')]);_0x173315[_0xb0d3('0x3d')]=_[_0xb0d3('0x3a')](_0x2c53a2['model'],qs[_0xb0d3('0x4c')](_0x1acdc1[_0xb0d3('0x3c')]['fields']));_0x173315['attributes']=_0x173315['attributes'][_0xb0d3('0x3e')]?_0x173315[_0xb0d3('0x3d')]:_0x2c53a2['model'];if(_0x1acdc1[_0xb0d3('0x3c')][_0xb0d3('0x46')]){_0x173315['include']=[{'all':!![]}];}_0x173315=_[_0xb0d3('0x2b')]({},_0x173315,_0x1acdc1[_0xb0d3('0x45')]);return db['SmsQueueReport'][_0xb0d3('0x4d')](_0x173315)[_0xb0d3('0x25')](handleEntityNotFound(_0x3f3251,null))[_0xb0d3('0x25')](respondWithResult(_0x3f3251,null))['catch'](handleError(_0x3f3251,null));};exports['create']=function(_0xaff477,_0x4181e4){return db[_0xb0d3('0x33')][_0xb0d3('0x4e')](_0xaff477[_0xb0d3('0x2c')],{})[_0xb0d3('0x25')](respondWithResult(_0x4181e4,0xc9))[_0xb0d3('0x4a')](handleError(_0x4181e4,null));};exports[_0xb0d3('0x24')]=function(_0xada974,_0x22da44){if(_0xada974['body']['id']){delete _0xada974[_0xb0d3('0x2c')]['id'];}return db['SmsQueueReport'][_0xb0d3('0x4d')]({'where':{'id':_0xada974['params']['id']}})[_0xb0d3('0x25')](handleEntityNotFound(_0x22da44,null))[_0xb0d3('0x25')](saveUpdates(_0xada974[_0xb0d3('0x2c')],null))['then'](respondWithResult(_0x22da44,null))['catch'](handleError(_0x22da44,null));};exports['destroy']=function(_0x3d127f,_0x16472a){return db[_0xb0d3('0x33')][_0xb0d3('0x4d')]({'where':{'id':_0x3d127f[_0xb0d3('0x4b')]['id']}})[_0xb0d3('0x25')](handleEntityNotFound(_0x16472a,null))[_0xb0d3('0x25')](removeEntity(_0x16472a,null))['catch'](handleError(_0x16472a,null));};exports[_0xb0d3('0x4f')]=function(_0x1fcac2,_0x25c667){return db[_0xb0d3('0x33')][_0xb0d3('0x4f')]()['then'](respondWithResult(_0x25c667,null))[_0xb0d3('0x4a')](handleError(_0x25c667,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ebbcbc7..5172854 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92ba=['define','SmsQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x25415d,_0x4e9bc9){var _0x1e3eb0=function(_0xb5971f){while(--_0xb5971f){_0x25415d['push'](_0x25415d['shift']());}};_0x1e3eb0(++_0x4e9bc9);}(_0x92ba,0x17c));var _0xa92b=function(_0x4f8688,_0x2cb391){_0x4f8688=_0x4f8688-0x0;var _0x4fb8d1=_0x92ba[_0x4f8688];return _0x4fb8d1;};'use strict';var _=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var logger=require('../../config/logger')(_0xa92b('0x2'));var moment=require(_0xa92b('0x3'));var BPromise=require(_0xa92b('0x4'));var rp=require(_0xa92b('0x5'));var fs=require('fs');var path=require(_0xa92b('0x6'));var rimraf=require('rimraf');var config=require(_0xa92b('0x7'));var attributes=require(_0xa92b('0x8'));module[_0xa92b('0x9')]=function(_0x3cf929,_0x56fb01){return _0x3cf929[_0xa92b('0xa')](_0xa92b('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xa92b('0xc'),'fields':[_0xa92b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c24=['./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x43cdc5,_0x2f19ba){var _0x2da6c5=function(_0x1bf4f7){while(--_0x1bf4f7){_0x43cdc5['push'](_0x43cdc5['shift']());}};_0x2da6c5(++_0x2f19ba);}(_0x0c24,0x13b));var _0x40c2=function(_0x3fe2be,_0x24cfba){_0x3fe2be=_0x3fe2be-0x0;var _0x16b3ca=_0x0c24[_0x3fe2be];return _0x16b3ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40c2('0x0'))(_0x40c2('0x1'));var moment=require('moment');var BPromise=require(_0x40c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40c2('0x3'));var config=require(_0x40c2('0x4'));var attributes=require(_0x40c2('0x5'));module['exports']=function(_0x146749,_0x3f204c){return _0x146749[_0x40c2('0x6')](_0x40c2('0x7'),attributes,{'tableName':_0x40c2('0x8'),'paranoid':![],'indexes':[{'name':_0x40c2('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f132b3d..0773f47 100644 --- a/server/api/smsQueueReport/smsQueueReport.rpc.js +++ b/server/api/smsQueueReport/smsQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2809=['client','http','request','info','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','options','then','UpdateSmsQueueReport','SmsQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xb2815f,_0x253f58){var _0x3ec930=function(_0x56b1ba){while(--_0x56b1ba){_0xb2815f['push'](_0xb2815f['shift']());}};_0x3ec930(++_0x253f58);}(_0x2809,0x1ec));var _0x9280=function(_0x23c2c3,_0x27ecc8){_0x23c2c3=_0x23c2c3-0x0;var _0x41e09f=_0x2809[_0x23c2c3];return _0x41e09f;};'use strict';var _=require(_0x9280('0x0'));var util=require(_0x9280('0x1'));var moment=require(_0x9280('0x2'));var BPromise=require(_0x9280('0x3'));var rs=require(_0x9280('0x4'));var fs=require('fs');var Redis=require(_0x9280('0x5'));var db=require(_0x9280('0x6'))['db'];var utils=require(_0x9280('0x7'));var logger=require(_0x9280('0x8'))(_0x9280('0x9'));var config=require(_0x9280('0xa'));var jayson=require(_0x9280('0xb'));var client=jayson[_0x9280('0xc')][_0x9280('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x141844,_0x23c832,_0x5d393d){return new BPromise(function(_0xd7b986,_0x1b448e){return client[_0x9280('0xe')](_0x141844,_0x5d393d)['then'](function(_0x42946b){logger[_0x9280('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x23c832,_0x9280('0x10'));logger[_0x9280('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x23c832,_0x9280('0x10'),JSON[_0x9280('0x12')](_0x42946b));if(_0x42946b['error']){if(_0x42946b[_0x9280('0x13')][_0x9280('0x14')]===0x1f4){logger['error'](_0x9280('0x15'),_0x23c832,_0x42946b['error']['message']);return _0x1b448e(_0x42946b['error'][_0x9280('0x16')]);}logger['error'](_0x9280('0x15'),_0x23c832,_0x42946b[_0x9280('0x13')][_0x9280('0x16')]);return _0xd7b986(_0x42946b[_0x9280('0x13')]['message']);}else{logger[_0x9280('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x23c832,'request\x20sent');_0xd7b986(_0x42946b[_0x9280('0x17')]['message']);}})[_0x9280('0x18')](function(_0x3b0f71){logger['error'](_0x9280('0x15'),_0x23c832,_0x3b0f71);_0x1b448e(_0x3b0f71);});});}exports[_0x9280('0x19')]=function(_0x614cab){var _0x2742c9=this;return new Promise(function(_0x10d724,_0x463bb5){return db['SmsQueueReport']['create'](_0x614cab['body'],{'raw':_0x614cab[_0x9280('0x1a')]?_0x614cab[_0x9280('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9280('0x1b')](function(_0x34118a){logger[_0x9280('0xf')](_0x9280('0x19'),_0x614cab);logger[_0x9280('0x11')](_0x9280('0x19'),_0x614cab,JSON[_0x9280('0x12')](_0x34118a));_0x10d724(_0x34118a);})[_0x9280('0x18')](function(_0xea6510){logger[_0x9280('0x13')]('CreateSmsQueueReport',_0xea6510['message'],_0x614cab);_0x463bb5(_0x2742c9['error'](0x1f4,_0xea6510[_0x9280('0x16')]));});});};exports[_0x9280('0x1c')]=function(_0x2dd6ac){var _0x5a087d=this;return new Promise(function(_0x1efe71,_0x5d5592){return db[_0x9280('0x1d')][_0x9280('0x1e')](_0x2dd6ac[_0x9280('0x1f')],{'raw':_0x2dd6ac[_0x9280('0x1a')]?_0x2dd6ac['options'][_0x9280('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dd6ac[_0x9280('0x1a')]?_0x2dd6ac[_0x9280('0x1a')][_0x9280('0x21')]||null:null,'attributes':_0x2dd6ac['options']?_0x2dd6ac[_0x9280('0x1a')][_0x9280('0x22')]||null:null,'limit':_0x2dd6ac['options']?_0x2dd6ac['options'][_0x9280('0x23')]||null:null})['then'](function(_0x1d0384){logger[_0x9280('0xf')](_0x9280('0x1c'),_0x2dd6ac);logger[_0x9280('0x11')]('UpdateSmsQueueReport',_0x2dd6ac,JSON[_0x9280('0x12')](_0x1d0384));_0x1efe71(_0x1d0384);})[_0x9280('0x18')](function(_0x460e8d){logger[_0x9280('0x13')](_0x9280('0x1c'),_0x460e8d['message'],_0x2dd6ac);_0x5d5592(_0x5a087d[_0x9280('0x13')](0x1f4,_0x460e8d[_0x9280('0x16')]));});});}; \ No newline at end of file +var _0xca72=['attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','info','debug','UpdateSmsQueueReport','update','where'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0xca72,0x1f2));var _0x2ca7=function(_0x3d61c6,_0x4571e6){_0x3d61c6=_0x3d61c6-0x0;var _0x47e0df=_0xca72[_0x3d61c6];return _0x47e0df;};'use strict';var _=require(_0x2ca7('0x0'));var util=require(_0x2ca7('0x1'));var moment=require(_0x2ca7('0x2'));var BPromise=require(_0x2ca7('0x3'));var rs=require(_0x2ca7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2ca7('0x5'));var logger=require('../../config/logger')(_0x2ca7('0x6'));var config=require(_0x2ca7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2ca7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x117d85,_0x27d49c,_0x47ec06){return new BPromise(function(_0x4b42c9,_0xba7274){return client[_0x2ca7('0x9')](_0x117d85,_0x47ec06)[_0x2ca7('0xa')](function(_0x4b5d9b){logger['info'](_0x2ca7('0xb'),_0x27d49c,_0x2ca7('0xc'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x27d49c,'request\x20sent',JSON[_0x2ca7('0xd')](_0x4b5d9b));if(_0x4b5d9b['error']){if(_0x4b5d9b[_0x2ca7('0xe')][_0x2ca7('0xf')]===0x1f4){logger['error'](_0x2ca7('0xb'),_0x27d49c,_0x4b5d9b[_0x2ca7('0xe')]['message']);return _0xba7274(_0x4b5d9b['error'][_0x2ca7('0x10')]);}logger[_0x2ca7('0xe')](_0x2ca7('0xb'),_0x27d49c,_0x4b5d9b[_0x2ca7('0xe')][_0x2ca7('0x10')]);return _0x4b42c9(_0x4b5d9b[_0x2ca7('0xe')][_0x2ca7('0x10')]);}else{logger['info'](_0x2ca7('0xb'),_0x27d49c,_0x2ca7('0xc'));_0x4b42c9(_0x4b5d9b[_0x2ca7('0x11')]['message']);}})[_0x2ca7('0x12')](function(_0x47f12c){logger[_0x2ca7('0xe')](_0x2ca7('0xb'),_0x27d49c,_0x47f12c);_0xba7274(_0x47f12c);});});}exports[_0x2ca7('0x13')]=function(_0x3f7413){var _0x501a72=this;return new Promise(function(_0x4e30f2,_0x593dec){return db[_0x2ca7('0x14')]['create'](_0x3f7413[_0x2ca7('0x15')],{'raw':_0x3f7413['options']?_0x3f7413[_0x2ca7('0x16')][_0x2ca7('0x17')]===undefined?!![]:![]:!![]})[_0x2ca7('0xa')](function(_0x3ad80a){logger[_0x2ca7('0x18')](_0x2ca7('0x13'),_0x3f7413);logger[_0x2ca7('0x19')](_0x2ca7('0x13'),_0x3f7413,JSON[_0x2ca7('0xd')](_0x3ad80a));_0x4e30f2(_0x3ad80a);})[_0x2ca7('0x12')](function(_0x42f9e4){logger[_0x2ca7('0xe')]('CreateSmsQueueReport',_0x42f9e4['message'],_0x3f7413);_0x593dec(_0x501a72[_0x2ca7('0xe')](0x1f4,_0x42f9e4['message']));});});};exports[_0x2ca7('0x1a')]=function(_0x1a16ea){var _0x50dae7=this;return new Promise(function(_0x5be812,_0x31b1ab){return db[_0x2ca7('0x14')][_0x2ca7('0x1b')](_0x1a16ea[_0x2ca7('0x15')],{'raw':_0x1a16ea[_0x2ca7('0x16')]?_0x1a16ea[_0x2ca7('0x16')][_0x2ca7('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a16ea[_0x2ca7('0x16')]?_0x1a16ea['options'][_0x2ca7('0x1c')]||null:null,'attributes':_0x1a16ea[_0x2ca7('0x16')]?_0x1a16ea[_0x2ca7('0x16')][_0x2ca7('0x1d')]||null:null,'limit':_0x1a16ea['options']?_0x1a16ea[_0x2ca7('0x16')][_0x2ca7('0x1e')]||null:null})[_0x2ca7('0xa')](function(_0xea76ad){logger[_0x2ca7('0x18')](_0x2ca7('0x1a'),_0x1a16ea);logger[_0x2ca7('0x19')]('UpdateSmsQueueReport',_0x1a16ea,JSON[_0x2ca7('0xd')](_0xea76ad));_0x5be812(_0xea76ad);})['catch'](function(_0x5a6d78){logger[_0x2ca7('0xe')](_0x2ca7('0x1a'),_0x5a6d78[_0x2ca7('0x10')],_0x1a16ea);_0x31b1ab(_0x50dae7[_0x2ca7('0xe')](0x1f4,_0x5a6d78[_0x2ca7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d5e47b6..ab478d0 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x175a=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0x175a,0x108));var _0xa175=function(_0x317f3d,_0x4dd81e){_0x317f3d=_0x317f3d-0x0;var _0x2478e8=_0x175a[_0x317f3d];return _0x2478e8;};'use strict';var multer=require(_0xa175('0x0'));var util=require(_0xa175('0x1'));var path=require(_0xa175('0x2'));var timeout=require(_0xa175('0x3'));var express=require('express');var router=express[_0xa175('0x4')]();var fs_extra=require(_0xa175('0x5'));var auth=require(_0xa175('0x6'));var interaction=require(_0xa175('0x7'));var config=require(_0xa175('0x8'));var controller=require(_0xa175('0x9'));router[_0xa175('0xa')]('/',auth[_0xa175('0xb')](),controller[_0xa175('0xc')]);router['get'](_0xa175('0xd'),auth[_0xa175('0xb')](),controller[_0xa175('0xe')]);router[_0xa175('0xa')]('/:id',auth[_0xa175('0xb')](),controller[_0xa175('0xf')]);router['post']('/',auth[_0xa175('0xb')](),controller[_0xa175('0x10')]);router[_0xa175('0x11')](_0xa175('0x12'),auth[_0xa175('0xb')](),controller[_0xa175('0x13')]);router['delete'](_0xa175('0x12'),auth[_0xa175('0xb')](),controller['destroy']);module[_0xa175('0x14')]=router; \ No newline at end of file +var _0x6515=['delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','describe','/:id','put'];(function(_0x550aed,_0x1ba6cb){var _0x1c43a5=function(_0x39e5f7){while(--_0x39e5f7){_0x550aed['push'](_0x550aed['shift']());}};_0x1c43a5(++_0x1ba6cb);}(_0x6515,0x93));var _0x5651=function(_0x4b1d67,_0x2c617d){_0x4b1d67=_0x4b1d67-0x0;var _0x2079fa=_0x6515[_0x4b1d67];return _0x2079fa;};'use strict';var multer=require(_0x5651('0x0'));var util=require(_0x5651('0x1'));var path=require('path');var timeout=require(_0x5651('0x2'));var express=require(_0x5651('0x3'));var router=express['Router']();var fs_extra=require(_0x5651('0x4'));var auth=require(_0x5651('0x5'));var interaction=require(_0x5651('0x6'));var config=require(_0x5651('0x7'));var controller=require(_0x5651('0x8'));router['get']('/',auth[_0x5651('0x9')](),controller[_0x5651('0xa')]);router[_0x5651('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x5651('0xc')]);router[_0x5651('0xb')](_0x5651('0xd'),auth[_0x5651('0x9')](),controller['show']);router['post']('/',auth[_0x5651('0x9')](),controller['create']);router[_0x5651('0xe')](_0x5651('0xd'),auth[_0x5651('0x9')](),controller['update']);router[_0x5651('0xf')](_0x5651('0xd'),auth[_0x5651('0x9')](),controller[_0x5651('0x10')]);module[_0x5651('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 2f5f798..ceae056 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfd1=['moment','sequelize','exports','ENUM','account','agent','queue','DATE','NOW'];(function(_0x5224d9,_0x3431c6){var _0x421ea3=function(_0x18a5d2){while(--_0x18a5d2){_0x5224d9['push'](_0x5224d9['shift']());}};_0x421ea3(++_0x3431c6);}(_0xcfd1,0x87));var _0x1cfd=function(_0x2165a0,_0x32a4e3){_0x2165a0=_0x2165a0-0x0;var _0x5443d6=_0xcfd1[_0x2165a0];return _0x5443d6;};'use strict';var moment=require(_0x1cfd('0x0'));var Sequelize=require(_0x1cfd('0x1'));module[_0x1cfd('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1cfd('0x3')](_0x1cfd('0x4'),_0x1cfd('0x5'),'queue'),'allowNull':![],'defaultValue':_0x1cfd('0x6')},'transferredAt':{'type':Sequelize[_0x1cfd('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1cfd('0x8')]}}; \ No newline at end of file +var _0x2065=['DATE','STRING','account','agent','queue'];(function(_0x141726,_0x333558){var _0x2acb35=function(_0x5850c1){while(--_0x5850c1){_0x141726['push'](_0x141726['shift']());}};_0x2acb35(++_0x333558);}(_0x2065,0x8d));var _0x5206=function(_0x4b2458,_0x214157){_0x4b2458=_0x4b2458-0x0;var _0x221351=_0x2065[_0x4b2458];return _0x221351;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5206('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5206('0x1'),_0x5206('0x2'),_0x5206('0x3')),'allowNull':![],'defaultValue':_0x5206('0x3')},'transferredAt':{'type':Sequelize[_0x5206('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a73b3a2..0f0eccc 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd97d=['show','params','intersection','options','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','SmsTransferReport','rawAttributes','fieldName','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x27fbdc,_0x5895a8){var _0xfce606=function(_0x2a75db){while(--_0x2a75db){_0x27fbdc['push'](_0x27fbdc['shift']());}};_0xfce606(++_0x5895a8);}(_0xd97d,0xab));var _0xdd97=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xd97d[_0x243217];return _0x478029;};'use strict';var emlformat=require(_0xdd97('0x0'));var rimraf=require(_0xdd97('0x1'));var zipdir=require(_0xdd97('0x2'));var jsonpatch=require(_0xdd97('0x3'));var rp=require(_0xdd97('0x4'));var moment=require(_0xdd97('0x5'));var BPromise=require(_0xdd97('0x6'));var Mustache=require(_0xdd97('0x7'));var util=require(_0xdd97('0x8'));var path=require(_0xdd97('0x9'));var sox=require(_0xdd97('0xa'));var csv=require(_0xdd97('0xb'));var ejs=require(_0xdd97('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd97('0xd'));var crypto=require(_0xdd97('0xe'));var jsforce=require(_0xdd97('0xf'));var deskjs=require(_0xdd97('0x10'));var toCsv=require(_0xdd97('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd97('0x11'));var authService=require(_0xdd97('0x12'));var qs=require(_0xdd97('0x13'));var as=require(_0xdd97('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd97('0x15'))('api');var utils=require(_0xdd97('0x16'));var config=require(_0xdd97('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd97('0x18'))['db'];function respondWithStatusCode(_0xb43486,_0x2e3616){_0x2e3616=_0x2e3616||0xcc;return function(_0x5119b2){if(_0x5119b2){return _0xb43486[_0xdd97('0x19')](_0x2e3616);}return _0xb43486['status'](_0x2e3616)[_0xdd97('0x1a')]();};}function respondWithResult(_0x4e93dc,_0x4c3e0e){_0x4c3e0e=_0x4c3e0e||0xc8;return function(_0x250762){if(_0x250762){return _0x4e93dc['status'](_0x4c3e0e)[_0xdd97('0x1b')](_0x250762);}};}function respondWithFilteredResult(_0xc0de7e,_0x519560){return function(_0x31f665){if(_0x31f665){var _0x30d51c=typeof _0x519560[_0xdd97('0x1c')]==='undefined'&&typeof _0x519560['limit']===_0xdd97('0x1d');var _0x3dd35d=_0x31f665[_0xdd97('0x1e')];var _0x35266f=_0x30d51c?0x0:_0x519560[_0xdd97('0x1c')];var _0x266c89=_0x30d51c?_0x31f665[_0xdd97('0x1e')]:_0x519560[_0xdd97('0x1c')]+_0x519560['limit'];var _0x254fd2;if(_0x266c89>=_0x3dd35d){_0x266c89=_0x3dd35d;_0x254fd2=0xc8;}else{_0x254fd2=0xce;}_0xc0de7e[_0xdd97('0x1f')](_0x254fd2);return _0xc0de7e['set'](_0xdd97('0x20'),_0x35266f+'-'+_0x266c89+'/'+_0x3dd35d)[_0xdd97('0x1b')](_0x31f665);}return null;};}function patchUpdates(_0x26266f){return function(_0x50aa87){try{jsonpatch[_0xdd97('0x21')](_0x50aa87,_0x26266f,!![]);}catch(_0x3132c7){return BPromise[_0xdd97('0x22')](_0x3132c7);}return _0x50aa87[_0xdd97('0x23')]();};}function saveUpdates(_0x334d0c,_0x589058){return function(_0x3c8e11){if(_0x3c8e11){return _0x3c8e11[_0xdd97('0x24')](_0x334d0c)[_0xdd97('0x25')](function(_0x45ce1b){return _0x45ce1b;});}return null;};}function removeEntity(_0x224be9,_0x2c1b8f){return function(_0x3d48b9){if(_0x3d48b9){return _0x3d48b9[_0xdd97('0x26')]()[_0xdd97('0x25')](function(){_0x224be9[_0xdd97('0x1f')](0xcc)[_0xdd97('0x1a')]();});}};}function handleEntityNotFound(_0x56bb16,_0x47aaa7){return function(_0x1132c9){if(!_0x1132c9){_0x56bb16['sendStatus'](0x194);}return _0x1132c9;};}function handleError(_0x301633,_0x377e0e){_0x377e0e=_0x377e0e||0x1f4;return function(_0xe291cc){logger['error'](_0xe291cc[_0xdd97('0x27')]);if(_0xe291cc['name']){delete _0xe291cc[_0xdd97('0x28')];}_0x301633[_0xdd97('0x1f')](_0x377e0e)[_0xdd97('0x29')](_0xe291cc);};}function getMustacheRender(_0x15b508,_0x1baa48){return Mustache[_0xdd97('0x2a')](_0x15b508,_[_0xdd97('0x2b')](_0x1baa48[_0xdd97('0x2c')],{'contact':_0x1baa48[_0xdd97('0x2d')],'message':_0x1baa48['message'],'agent':_0x1baa48[_0xdd97('0x2e')],'interaction':_0x1baa48[_0xdd97('0x2f')],'account':_0x1baa48[_0xdd97('0x30')]}))||'';}exports[_0xdd97('0x31')]=function(_0x3e37d1,_0xa1e696){var _0x454787={},_0x104693={},_0x3dde09={'count':0x0,'rows':[]};var _0x434416=_['map'](db[_0xdd97('0x32')][_0xdd97('0x33')],function(_0x429724){return{'name':_0x429724[_0xdd97('0x34')],'type':_0x429724['type'][_0xdd97('0x35')]};});_0x104693[_0xdd97('0x36')]=_[_0xdd97('0x37')](_0x434416,'name');_0x104693[_0xdd97('0x38')]=_[_0xdd97('0x39')](_0x3e37d1[_0xdd97('0x38')]);_0x104693['filters']=_['intersection'](_0x104693['model'],_0x104693[_0xdd97('0x38')]);_0x454787[_0xdd97('0x3a')]=_['intersection'](_0x104693[_0xdd97('0x36')],qs['fields'](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x3b')]));_0x454787[_0xdd97('0x3a')]=_0x454787[_0xdd97('0x3a')][_0xdd97('0x3c')]?_0x454787['attributes']:_0x104693['model'];if(!_0x3e37d1['query'][_0xdd97('0x3d')]('nolimit')){_0x454787[_0xdd97('0x3e')]=qs[_0xdd97('0x3e')](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x3e')]);_0x454787['offset']=qs[_0xdd97('0x1c')](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x1c')]);}_0x454787[_0xdd97('0x3f')]=qs[_0xdd97('0x40')](_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x40')]);_0x454787[_0xdd97('0x41')]=qs[_0xdd97('0x42')](_[_0xdd97('0x43')](_0x3e37d1[_0xdd97('0x38')],_0x104693['filters']),_0x434416);if(_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x44')]){_0x454787['where']=_['merge'](_0x454787[_0xdd97('0x41')],{'$or':_[_0xdd97('0x37')](_0x434416,function(_0x29a95f){if(_0x29a95f['type']!==_0xdd97('0x45')){var _0x2bd91d={};_0x2bd91d[_0x29a95f[_0xdd97('0x28')]]={'$like':'%'+_0x3e37d1[_0xdd97('0x38')][_0xdd97('0x44')]+'%'};return _0x2bd91d;}})});}_0x454787=_['merge']({},_0x454787,_0x3e37d1['options']);var _0x3d8e63={'where':_0x454787[_0xdd97('0x41')]};return db[_0xdd97('0x32')][_0xdd97('0x1e')](_0x3d8e63)[_0xdd97('0x25')](function(_0x1eaa88){_0x3dde09[_0xdd97('0x1e')]=_0x1eaa88;if(_0x3e37d1['query'][_0xdd97('0x46')]){_0x454787[_0xdd97('0x47')]=[{'all':!![]}];}return db[_0xdd97('0x32')][_0xdd97('0x48')](_0x454787);})['then'](function(_0x67d37c){_0x3dde09[_0xdd97('0x49')]=_0x67d37c;return _0x3dde09;})[_0xdd97('0x25')](respondWithFilteredResult(_0xa1e696,_0x454787))[_0xdd97('0x4a')](handleError(_0xa1e696,null));};exports[_0xdd97('0x4b')]=function(_0x58f2d0,_0x5e3a0f){var _0x1bcd34={'raw':!![],'where':{'id':_0x58f2d0[_0xdd97('0x4c')]['id']}},_0x5b83e6={};_0x5b83e6['model']=_['keys'](db['SmsTransferReport'][_0xdd97('0x33')]);_0x5b83e6[_0xdd97('0x38')]=_[_0xdd97('0x39')](_0x58f2d0[_0xdd97('0x38')]);_0x5b83e6[_0xdd97('0x42')]=_[_0xdd97('0x4d')](_0x5b83e6[_0xdd97('0x36')],_0x5b83e6[_0xdd97('0x38')]);_0x1bcd34[_0xdd97('0x3a')]=_[_0xdd97('0x4d')](_0x5b83e6[_0xdd97('0x36')],qs[_0xdd97('0x3b')](_0x58f2d0[_0xdd97('0x38')][_0xdd97('0x3b')]));_0x1bcd34[_0xdd97('0x3a')]=_0x1bcd34[_0xdd97('0x3a')]['length']?_0x1bcd34[_0xdd97('0x3a')]:_0x5b83e6[_0xdd97('0x36')];if(_0x58f2d0['query'][_0xdd97('0x46')]){_0x1bcd34['include']=[{'all':!![]}];}_0x1bcd34=_['merge']({},_0x1bcd34,_0x58f2d0[_0xdd97('0x4e')]);return db[_0xdd97('0x32')][_0xdd97('0x4f')](_0x1bcd34)[_0xdd97('0x25')](handleEntityNotFound(_0x5e3a0f,null))[_0xdd97('0x25')](respondWithResult(_0x5e3a0f,null))[_0xdd97('0x4a')](handleError(_0x5e3a0f,null));};exports[_0xdd97('0x50')]=function(_0x49ee66,_0x5df528){return db['SmsTransferReport']['create'](_0x49ee66[_0xdd97('0x2c')],{})[_0xdd97('0x25')](respondWithResult(_0x5df528,0xc9))[_0xdd97('0x4a')](handleError(_0x5df528,null));};exports['update']=function(_0x36d805,_0x490486){if(_0x36d805[_0xdd97('0x2c')]['id']){delete _0x36d805[_0xdd97('0x2c')]['id'];}return db[_0xdd97('0x32')][_0xdd97('0x4f')]({'where':{'id':_0x36d805[_0xdd97('0x4c')]['id']}})[_0xdd97('0x25')](handleEntityNotFound(_0x490486,null))['then'](saveUpdates(_0x36d805[_0xdd97('0x2c')],null))[_0xdd97('0x25')](respondWithResult(_0x490486,null))[_0xdd97('0x4a')](handleError(_0x490486,null));};exports[_0xdd97('0x26')]=function(_0x537494,_0x47fe38){return db[_0xdd97('0x32')][_0xdd97('0x4f')]({'where':{'id':_0x537494[_0xdd97('0x4c')]['id']}})[_0xdd97('0x25')](handleEntityNotFound(_0x47fe38,null))[_0xdd97('0x25')](removeEntity(_0x47fe38,null))[_0xdd97('0x4a')](handleError(_0x47fe38,null));};exports[_0xdd97('0x51')]=function(_0xe9eba6,_0x4c590f){return db[_0xdd97('0x32')][_0xdd97('0x51')]()['then'](respondWithResult(_0x4c590f,null))['catch'](handleError(_0x4c590f,null));}; \ No newline at end of file +var _0x0e3e=['undefined','limit','count','Content-Range','destroy','then','error','stack','name','render','merge','body','contact','message','agent','interaction','account','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x5714c8,_0x5f77fe){var _0x1c2adc=function(_0x52e573){while(--_0x52e573){_0x5714c8['push'](_0x5714c8['shift']());}};_0x1c2adc(++_0x5f77fe);}(_0x0e3e,0x177));var _0xe0e3=function(_0xd727a6,_0x44bcef){_0xd727a6=_0xd727a6-0x0;var _0x5685f2=_0x0e3e[_0xd727a6];return _0x5685f2;};'use strict';var emlformat=require(_0xe0e3('0x0'));var rimraf=require(_0xe0e3('0x1'));var zipdir=require(_0xe0e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0e3('0x3'));var moment=require(_0xe0e3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe0e3('0x5'));var util=require(_0xe0e3('0x6'));var path=require(_0xe0e3('0x7'));var sox=require(_0xe0e3('0x8'));var csv=require(_0xe0e3('0x9'));var ejs=require(_0xe0e3('0xa'));var fs=require('fs');var fs_extra=require(_0xe0e3('0xb'));var _=require(_0xe0e3('0xc'));var squel=require(_0xe0e3('0xd'));var crypto=require(_0xe0e3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe0e3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe0e3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe0e3('0x11'));var qs=require(_0xe0e3('0x12'));var as=require(_0xe0e3('0x13'));var hardwareService=require(_0xe0e3('0x14'));var logger=require(_0xe0e3('0x15'))(_0xe0e3('0x16'));var utils=require(_0xe0e3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe0e3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ab317,_0x52834c){_0x52834c=_0x52834c||0xcc;return function(_0x28d10a){if(_0x28d10a){return _0x2ab317[_0xe0e3('0x19')](_0x52834c);}return _0x2ab317[_0xe0e3('0x1a')](_0x52834c)[_0xe0e3('0x1b')]();};}function respondWithResult(_0x4e80dc,_0x259b60){_0x259b60=_0x259b60||0xc8;return function(_0x5b356f){if(_0x5b356f){return _0x4e80dc[_0xe0e3('0x1a')](_0x259b60)[_0xe0e3('0x1c')](_0x5b356f);}};}function respondWithFilteredResult(_0x2e8e9b,_0x4c3e03){return function(_0x8a2a41){if(_0x8a2a41){var _0x94d4e5=typeof _0x4c3e03[_0xe0e3('0x1d')]===_0xe0e3('0x1e')&&typeof _0x4c3e03[_0xe0e3('0x1f')]===_0xe0e3('0x1e');var _0x19fc90=_0x8a2a41[_0xe0e3('0x20')];var _0x484dc4=_0x94d4e5?0x0:_0x4c3e03[_0xe0e3('0x1d')];var _0x2fc15f=_0x94d4e5?_0x8a2a41['count']:_0x4c3e03['offset']+_0x4c3e03[_0xe0e3('0x1f')];var _0x5d57f7;if(_0x2fc15f>=_0x19fc90){_0x2fc15f=_0x19fc90;_0x5d57f7=0xc8;}else{_0x5d57f7=0xce;}_0x2e8e9b[_0xe0e3('0x1a')](_0x5d57f7);return _0x2e8e9b['set'](_0xe0e3('0x21'),_0x484dc4+'-'+_0x2fc15f+'/'+_0x19fc90)[_0xe0e3('0x1c')](_0x8a2a41);}return null;};}function patchUpdates(_0x463cd8){return function(_0x4b3778){try{jsonpatch['apply'](_0x4b3778,_0x463cd8,!![]);}catch(_0x4ee994){return BPromise['reject'](_0x4ee994);}return _0x4b3778['save']();};}function saveUpdates(_0x29e92d,_0x1d91d0){return function(_0x1f8b57){if(_0x1f8b57){return _0x1f8b57['update'](_0x29e92d)['then'](function(_0x5b1c1f){return _0x5b1c1f;});}return null;};}function removeEntity(_0xd977ea,_0x111195){return function(_0x27319d){if(_0x27319d){return _0x27319d[_0xe0e3('0x22')]()[_0xe0e3('0x23')](function(){_0xd977ea[_0xe0e3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2b75,_0x53a1e4){return function(_0x19e010){if(!_0x19e010){_0x5e2b75[_0xe0e3('0x19')](0x194);}return _0x19e010;};}function handleError(_0x45e80c,_0x272145){_0x272145=_0x272145||0x1f4;return function(_0x12474a){logger[_0xe0e3('0x24')](_0x12474a[_0xe0e3('0x25')]);if(_0x12474a[_0xe0e3('0x26')]){delete _0x12474a['name'];}_0x45e80c[_0xe0e3('0x1a')](_0x272145)['send'](_0x12474a);};}function getMustacheRender(_0x39fd6c,_0x4a8407){return Mustache[_0xe0e3('0x27')](_0x39fd6c,_[_0xe0e3('0x28')](_0x4a8407[_0xe0e3('0x29')],{'contact':_0x4a8407[_0xe0e3('0x2a')],'message':_0x4a8407[_0xe0e3('0x2b')],'agent':_0x4a8407[_0xe0e3('0x2c')],'interaction':_0x4a8407[_0xe0e3('0x2d')],'account':_0x4a8407[_0xe0e3('0x2e')]}))||'';}exports[_0xe0e3('0x2f')]=function(_0x213e77,_0x4005d8){var _0x3d7483={},_0x5553a2={},_0x53dcc1={'count':0x0,'rows':[]};var _0x2c7dc1=_[_0xe0e3('0x30')](db[_0xe0e3('0x31')][_0xe0e3('0x32')],function(_0x4e4740){return{'name':_0x4e4740[_0xe0e3('0x33')],'type':_0x4e4740['type'][_0xe0e3('0x34')]};});_0x5553a2[_0xe0e3('0x35')]=_[_0xe0e3('0x30')](_0x2c7dc1,_0xe0e3('0x26'));_0x5553a2[_0xe0e3('0x36')]=_['keys'](_0x213e77[_0xe0e3('0x36')]);_0x5553a2[_0xe0e3('0x37')]=_['intersection'](_0x5553a2[_0xe0e3('0x35')],_0x5553a2['query']);_0x3d7483['attributes']=_['intersection'](_0x5553a2[_0xe0e3('0x35')],qs['fields'](_0x213e77[_0xe0e3('0x36')][_0xe0e3('0x38')]));_0x3d7483[_0xe0e3('0x39')]=_0x3d7483['attributes'][_0xe0e3('0x3a')]?_0x3d7483[_0xe0e3('0x39')]:_0x5553a2[_0xe0e3('0x35')];if(!_0x213e77[_0xe0e3('0x36')][_0xe0e3('0x3b')](_0xe0e3('0x3c'))){_0x3d7483[_0xe0e3('0x1f')]=qs[_0xe0e3('0x1f')](_0x213e77[_0xe0e3('0x36')][_0xe0e3('0x1f')]);_0x3d7483[_0xe0e3('0x1d')]=qs['offset'](_0x213e77['query'][_0xe0e3('0x1d')]);}_0x3d7483[_0xe0e3('0x3d')]=qs[_0xe0e3('0x3e')](_0x213e77['query']['sort']);_0x3d7483[_0xe0e3('0x3f')]=qs[_0xe0e3('0x37')](_[_0xe0e3('0x40')](_0x213e77[_0xe0e3('0x36')],_0x5553a2[_0xe0e3('0x37')]),_0x2c7dc1);if(_0x213e77[_0xe0e3('0x36')][_0xe0e3('0x41')]){_0x3d7483[_0xe0e3('0x3f')]=_[_0xe0e3('0x28')](_0x3d7483[_0xe0e3('0x3f')],{'$or':_[_0xe0e3('0x30')](_0x2c7dc1,function(_0x53fee0){if(_0x53fee0[_0xe0e3('0x42')]!==_0xe0e3('0x43')){var _0x56c23a={};_0x56c23a[_0x53fee0[_0xe0e3('0x26')]]={'$like':'%'+_0x213e77[_0xe0e3('0x36')][_0xe0e3('0x41')]+'%'};return _0x56c23a;}})});}_0x3d7483=_[_0xe0e3('0x28')]({},_0x3d7483,_0x213e77[_0xe0e3('0x44')]);var _0x415195={'where':_0x3d7483[_0xe0e3('0x3f')]};return db['SmsTransferReport']['count'](_0x415195)['then'](function(_0x1bb56b){_0x53dcc1[_0xe0e3('0x20')]=_0x1bb56b;if(_0x213e77[_0xe0e3('0x36')]['includeAll']){_0x3d7483['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0xe0e3('0x45')](_0x3d7483);})[_0xe0e3('0x23')](function(_0x72eac3){_0x53dcc1[_0xe0e3('0x46')]=_0x72eac3;return _0x53dcc1;})[_0xe0e3('0x23')](respondWithFilteredResult(_0x4005d8,_0x3d7483))[_0xe0e3('0x47')](handleError(_0x4005d8,null));};exports[_0xe0e3('0x48')]=function(_0x45e48c,_0x3ae49a){var _0x1e24f5={'raw':!![],'where':{'id':_0x45e48c[_0xe0e3('0x49')]['id']}},_0x1dcddb={};_0x1dcddb['model']=_[_0xe0e3('0x4a')](db[_0xe0e3('0x31')][_0xe0e3('0x32')]);_0x1dcddb[_0xe0e3('0x36')]=_[_0xe0e3('0x4a')](_0x45e48c[_0xe0e3('0x36')]);_0x1dcddb[_0xe0e3('0x37')]=_['intersection'](_0x1dcddb[_0xe0e3('0x35')],_0x1dcddb[_0xe0e3('0x36')]);_0x1e24f5[_0xe0e3('0x39')]=_['intersection'](_0x1dcddb[_0xe0e3('0x35')],qs['fields'](_0x45e48c[_0xe0e3('0x36')][_0xe0e3('0x38')]));_0x1e24f5[_0xe0e3('0x39')]=_0x1e24f5['attributes']['length']?_0x1e24f5['attributes']:_0x1dcddb[_0xe0e3('0x35')];if(_0x45e48c[_0xe0e3('0x36')][_0xe0e3('0x4b')]){_0x1e24f5[_0xe0e3('0x4c')]=[{'all':!![]}];}_0x1e24f5=_[_0xe0e3('0x28')]({},_0x1e24f5,_0x45e48c[_0xe0e3('0x44')]);return db['SmsTransferReport'][_0xe0e3('0x4d')](_0x1e24f5)[_0xe0e3('0x23')](handleEntityNotFound(_0x3ae49a,null))['then'](respondWithResult(_0x3ae49a,null))[_0xe0e3('0x47')](handleError(_0x3ae49a,null));};exports[_0xe0e3('0x4e')]=function(_0x219a9a,_0x4ac948){return db[_0xe0e3('0x31')]['create'](_0x219a9a[_0xe0e3('0x29')],{})[_0xe0e3('0x23')](respondWithResult(_0x4ac948,0xc9))[_0xe0e3('0x47')](handleError(_0x4ac948,null));};exports[_0xe0e3('0x4f')]=function(_0x561689,_0x51cf60){if(_0x561689[_0xe0e3('0x29')]['id']){delete _0x561689[_0xe0e3('0x29')]['id'];}return db[_0xe0e3('0x31')][_0xe0e3('0x4d')]({'where':{'id':_0x561689[_0xe0e3('0x49')]['id']}})['then'](handleEntityNotFound(_0x51cf60,null))[_0xe0e3('0x23')](saveUpdates(_0x561689[_0xe0e3('0x29')],null))[_0xe0e3('0x23')](respondWithResult(_0x51cf60,null))[_0xe0e3('0x47')](handleError(_0x51cf60,null));};exports[_0xe0e3('0x22')]=function(_0x4ba507,_0x39b22b){return db['SmsTransferReport'][_0xe0e3('0x4d')]({'where':{'id':_0x4ba507[_0xe0e3('0x49')]['id']}})[_0xe0e3('0x23')](handleEntityNotFound(_0x39b22b,null))[_0xe0e3('0x23')](removeEntity(_0x39b22b,null))[_0xe0e3('0x47')](handleError(_0x39b22b,null));};exports[_0xe0e3('0x50')]=function(_0x398783,_0x80a02b){return db[_0xe0e3('0x31')]['describe']()[_0xe0e3('0x23')](respondWithResult(_0x80a02b,null))[_0xe0e3('0x47')](handleError(_0x80a02b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 342da0d..507faa7 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bd3=['SmsTransferReport','uniqueid','lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define'];(function(_0xa05f32,_0x42b27e){var _0x2d6d36=function(_0x34510d){while(--_0x34510d){_0xa05f32['push'](_0xa05f32['shift']());}};_0x2d6d36(++_0x42b27e);}(_0x4bd3,0x174));var _0x34bd=function(_0x58a4e5,_0xba23ee){_0x58a4e5=_0x58a4e5-0x0;var _0xba509d=_0x4bd3[_0x58a4e5];return _0xba509d;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./smsTransferReport.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x34bd('0x9'),'fields':[_0x34bd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3bbb08,_0x27ebe0){var _0x5e7404=function(_0x4c5a36){while(--_0x4c5a36){_0x3bbb08['push'](_0x3bbb08['shift']());}};_0x5e7404(++_0x27ebe0);}(_0x1967,0x173));var _0x7196=function(_0x10a1c7,_0x23cf62){_0x10a1c7=_0x10a1c7-0x0;var _0x412287=_0x1967[_0x10a1c7];return _0x412287;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3b23f2a..35252ea 100644 --- a/server/api/smsTransferReport/smsTransferReport.rpc.js +++ b/server/api/smsTransferReport/smsTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00f6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result'];(function(_0x4d482e,_0x7b328b){var _0x5a380f=function(_0x458330){while(--_0x458330){_0x4d482e['push'](_0x4d482e['shift']());}};_0x5a380f(++_0x7b328b);}(_0x00f6,0x64));var _0x600f=function(_0x438883,_0x2ae235){_0x438883=_0x438883-0x0;var _0xfcf86e=_0x00f6[_0x438883];return _0xfcf86e;};'use strict';var _=require(_0x600f('0x0'));var util=require(_0x600f('0x1'));var moment=require(_0x600f('0x2'));var BPromise=require(_0x600f('0x3'));var rs=require(_0x600f('0x4'));var fs=require('fs');var Redis=require(_0x600f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x600f('0x6'));var logger=require(_0x600f('0x7'))('rpc');var config=require(_0x600f('0x8'));var jayson=require(_0x600f('0x9'));var client=jayson[_0x600f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c1dc1,_0x2a4335,_0x58d3a7){return new BPromise(function(_0x3257f9,_0x1364fa){return client['request'](_0x4c1dc1,_0x58d3a7)[_0x600f('0xb')](function(_0x2659c8){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x2a4335,'request\x20sent');logger[_0x600f('0xc')](_0x600f('0xd'),_0x2a4335,'request\x20sent',JSON[_0x600f('0xe')](_0x2659c8));if(_0x2659c8[_0x600f('0xf')]){if(_0x2659c8[_0x600f('0xf')][_0x600f('0x10')]===0x1f4){logger[_0x600f('0xf')](_0x600f('0x11'),_0x2a4335,_0x2659c8['error'][_0x600f('0x12')]);return _0x1364fa(_0x2659c8[_0x600f('0xf')]['message']);}logger[_0x600f('0xf')](_0x600f('0x11'),_0x2a4335,_0x2659c8[_0x600f('0xf')][_0x600f('0x12')]);return _0x3257f9(_0x2659c8[_0x600f('0xf')][_0x600f('0x12')]);}else{logger['info'](_0x600f('0x11'),_0x2a4335,'request\x20sent');_0x3257f9(_0x2659c8[_0x600f('0x13')][_0x600f('0x12')]);}})['catch'](function(_0x548b5f){logger[_0x600f('0xf')](_0x600f('0x11'),_0x2a4335,_0x548b5f);_0x1364fa(_0x548b5f);});});} \ No newline at end of file +var _0xd9a8=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment'];(function(_0x2d5934,_0x1acc4f){var _0x5807c8=function(_0x326cc5){while(--_0x326cc5){_0x2d5934['push'](_0x2d5934['shift']());}};_0x5807c8(++_0x1acc4f);}(_0xd9a8,0xba));var _0x8d9a=function(_0x203acd,_0x4f8e0c){_0x203acd=_0x203acd-0x0;var _0x253724=_0xd9a8[_0x203acd];return _0x253724;};'use strict';var _=require(_0x8d9a('0x0'));var util=require(_0x8d9a('0x1'));var moment=require(_0x8d9a('0x2'));var BPromise=require(_0x8d9a('0x3'));var rs=require(_0x8d9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d9a('0x5'))['db'];var utils=require(_0x8d9a('0x6'));var logger=require(_0x8d9a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8d9a('0x8'));var client=jayson[_0x8d9a('0x9')][_0x8d9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209112,_0x427223,_0x8d298c){return new BPromise(function(_0x4aafdc,_0xf40ed1){return client[_0x8d9a('0xb')](_0x209112,_0x8d298c)['then'](function(_0x4c6955){logger['info'](_0x8d9a('0xc'),_0x427223,'request\x20sent');logger[_0x8d9a('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x427223,_0x8d9a('0xe'),JSON[_0x8d9a('0xf')](_0x4c6955));if(_0x4c6955['error']){if(_0x4c6955[_0x8d9a('0x10')][_0x8d9a('0x11')]===0x1f4){logger['error'](_0x8d9a('0xc'),_0x427223,_0x4c6955['error'][_0x8d9a('0x12')]);return _0xf40ed1(_0x4c6955[_0x8d9a('0x10')]['message']);}logger[_0x8d9a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x427223,_0x4c6955['error'][_0x8d9a('0x12')]);return _0x4aafdc(_0x4c6955[_0x8d9a('0x10')][_0x8d9a('0x12')]);}else{logger[_0x8d9a('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x427223,_0x8d9a('0xe'));_0x4aafdc(_0x4c6955[_0x8d9a('0x14')]['message']);}})['catch'](function(_0x29c898){logger[_0x8d9a('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x427223,_0x29c898);_0xf40ed1(_0x29c898);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 53a5cb2..fc23409 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc82e=['diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','delete','/:id','exports','util','path','express','Router','fs-extra','./sound.controller','get','isAuthenticated','index'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0xc82e,0x163));var _0xec82=function(_0x16db4b,_0xbf4524){_0x16db4b=_0x16db4b-0x0;var _0x15ab28=_0xc82e[_0x16db4b];return _0x15ab28;};'use strict';var multer=require('multer');var util=require(_0xec82('0x0'));var path=require(_0xec82('0x1'));var timeout=require('connect-timeout');var express=require(_0xec82('0x2'));var router=express[_0xec82('0x3')]();var fs_extra=require(_0xec82('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec82('0x5'));router[_0xec82('0x6')]('/',auth[_0xec82('0x7')](),controller[_0xec82('0x8')]);router[_0xec82('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xec82('0x6')]('/:id/download',auth[_0xec82('0x7')](),controller['download']);var upload=multer({'storage':multer[_0xec82('0x9')]({'destination':function(_0x145711,_0x26c5a4,_0xcb769){_0xcb769(null,path[_0xec82('0xa')](config[_0xec82('0xb')],_0xec82('0xc')));},'filename':function(_0x1d2ed8,_0x39dd86,_0x38c236){_0x39dd86[_0xec82('0xd')]=_0x39dd86[_0xec82('0xd')][_0xec82('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38c236(null,util[_0xec82('0xf')](_0xec82('0x10'),path[_0xec82('0x11')](_0x39dd86['originalname'],path[_0xec82('0x12')](_0x39dd86[_0xec82('0xd')])),Date[_0xec82('0x13')](),path[_0xec82('0x12')](_0x39dd86[_0xec82('0xd')])));}})});router[_0xec82('0x14')]('/',upload[_0xec82('0x15')](_0xec82('0x16')),controller[_0xec82('0x17')]);router[_0xec82('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xec82('0x19')](_0xec82('0x1a'),auth[_0xec82('0x7')](),controller[_0xec82('0x19')]);module[_0xec82('0x1b')]=router; \ No newline at end of file +var _0x6af1=['show','get','/:id/download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x5b7fd4,_0x10581b){var _0x26d6c1=function(_0xefcd92){while(--_0xefcd92){_0x5b7fd4['push'](_0x5b7fd4['shift']());}};_0x26d6c1(++_0x10581b);}(_0x6af1,0x12c));var _0x16af=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6af1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x16af('0x0'));var util=require(_0x16af('0x1'));var path=require(_0x16af('0x2'));var timeout=require(_0x16af('0x3'));var express=require(_0x16af('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x16af('0x5'));var interaction=require(_0x16af('0x6'));var config=require(_0x16af('0x7'));var controller=require('./sound.controller');router['get']('/',auth[_0x16af('0x8')](),controller[_0x16af('0x9')]);router['get']('/:id',auth[_0x16af('0x8')](),controller[_0x16af('0xa')]);router[_0x16af('0xb')](_0x16af('0xc'),auth[_0x16af('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x16af('0xd')]({'destination':function(_0x1db8ba,_0x34e446,_0x2bfd86){_0x2bfd86(null,path['join'](config[_0x16af('0xe')],'server/files/sounds/original/'));},'filename':function(_0x3a9219,_0x5f32d6,_0x2d6a46){_0x5f32d6[_0x16af('0xf')]=_0x5f32d6[_0x16af('0xf')][_0x16af('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d6a46(null,util[_0x16af('0x11')](_0x16af('0x12'),path[_0x16af('0x13')](_0x5f32d6[_0x16af('0xf')],path[_0x16af('0x14')](_0x5f32d6['originalname'])),Date[_0x16af('0x15')](),path[_0x16af('0x14')](_0x5f32d6['originalname'])));}})});router[_0x16af('0x16')]('/',upload[_0x16af('0x17')](_0x16af('0x18')),controller[_0x16af('0x19')]);router[_0x16af('0x1a')]('/:id',auth[_0x16af('0x8')](),controller[_0x16af('0x1b')]);router[_0x16af('0x1c')](_0x16af('0x1d'),auth[_0x16af('0x8')](),controller['delete']);module[_0x16af('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c069ef0..418ccd3 100644 --- a/server/api/sound/sound.attributes.js +++ b/server/api/sound/sound.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa49f=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x2ed474,_0x685826){var _0x4be574=function(_0x51d21f){while(--_0x51d21f){_0x2ed474['push'](_0x2ed474['shift']());}};_0x4be574(++_0x685826);}(_0xa49f,0x180));var _0xfa49=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xa49f[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0xfa49('0x0'));module[_0xfa49('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xfa49('0x2')]},'display_name':{'type':Sequelize[_0xfa49('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xfa49('0x3')]},'original_sampleCount':{'type':Sequelize[_0xfa49('0x4')]},'original_channelCount':{'type':Sequelize[_0xfa49('0x5')]},'original_bitRate':{'type':Sequelize[_0xfa49('0x4')]},'original_sampleRate':{'type':Sequelize[_0xfa49('0x5')]},'converted_format':{'type':Sequelize[_0xfa49('0x2')]},'converted_duration':{'type':Sequelize[_0xfa49('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xfa49('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xfa49('0x5')]}}; \ No newline at end of file +var _0x62e2=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x50b1b1,_0x206f31){var _0x4a879d=function(_0x48f652){while(--_0x48f652){_0x50b1b1['push'](_0x50b1b1['shift']());}};_0x4a879d(++_0x206f31);}(_0x62e2,0x1a5));var _0x262e=function(_0x54730b,_0x14acc2){_0x54730b=_0x54730b-0x0;var _0x22799e=_0x62e2[_0x54730b];return _0x22799e;};'use strict';var Sequelize=require(_0x262e('0x0'));module[_0x262e('0x1')]={'name':{'type':Sequelize[_0x262e('0x2')],'unique':_0x262e('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x262e('0x2')]},'display_name':{'type':Sequelize[_0x262e('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x262e('0x2')]},'original_format':{'type':Sequelize[_0x262e('0x2')]},'original_duration':{'type':Sequelize[_0x262e('0x4')]},'original_sampleCount':{'type':Sequelize[_0x262e('0x5')]},'original_channelCount':{'type':Sequelize[_0x262e('0x6')]},'original_bitRate':{'type':Sequelize[_0x262e('0x5')]},'original_sampleRate':{'type':Sequelize[_0x262e('0x6')]},'converted_format':{'type':Sequelize[_0x262e('0x2')]},'converted_duration':{'type':Sequelize[_0x262e('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x262e('0x5')]},'converted_channelCount':{'type':Sequelize[_0x262e('0x6')]},'converted_bitRate':{'type':Sequelize[_0x262e('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x262e('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index e1b3919..200fe56 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82e6=['catch','show','fields','find','download','params','save_name','existsSync','join','root','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','converted_format','create','basename','extname','file','originalname','filename','substring','wav','server/files/sounds/original','format','Sound\x20upload\x20destination:\x20%s','chmodSync','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','0777','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','render','merge','contact','message','agent','account','index','Sound','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x5ef5e6,_0xf13cc5){var _0x57e434=function(_0x321c8c){while(--_0x321c8c){_0x5ef5e6['push'](_0x5ef5e6['shift']());}};_0x57e434(++_0xf13cc5);}(_0x82e6,0x1b4));var _0x682e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x82e6[_0x5037ab];return _0x512adb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x682e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x682e('0x1'));var rp=require(_0x682e('0x2'));var moment=require('moment');var BPromise=require(_0x682e('0x3'));var Mustache=require(_0x682e('0x4'));var util=require(_0x682e('0x5'));var path=require(_0x682e('0x6'));var sox=require('sox');var csv=require(_0x682e('0x7'));var ejs=require(_0x682e('0x8'));var fs=require('fs');var fs_extra=require(_0x682e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x682e('0xa'));var jsforce=require(_0x682e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x682e('0x7'));var querystring=require(_0x682e('0xc'));var Papa=require('papaparse');var Redis=require(_0x682e('0xd'));var authService=require(_0x682e('0xe'));var qs=require(_0x682e('0xf'));var as=require(_0x682e('0x10'));var hardwareService=require(_0x682e('0x11'));var logger=require(_0x682e('0x12'))(_0x682e('0x13'));var utils=require('../../config/utils');var config=require(_0x682e('0x14'));var licenseUtil=require(_0x682e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b7bef,_0x12eb3b){_0x12eb3b=_0x12eb3b||0xcc;return function(_0x24ef4f){if(_0x24ef4f){return _0x4b7bef['sendStatus'](_0x12eb3b);}return _0x4b7bef[_0x682e('0x16')](_0x12eb3b)[_0x682e('0x17')]();};}function respondWithResult(_0x42ad8f,_0x39d83f){_0x39d83f=_0x39d83f||0xc8;return function(_0x5f02e7){if(_0x5f02e7){return _0x42ad8f[_0x682e('0x16')](_0x39d83f)[_0x682e('0x18')](_0x5f02e7);}};}function respondWithFilteredResult(_0xdba21b,_0x49356a){return function(_0x201a0e){if(_0x201a0e){var _0x5c8c5e=typeof _0x49356a['offset']===_0x682e('0x19')&&typeof _0x49356a[_0x682e('0x1a')]==='undefined';var _0xdeb030=_0x201a0e['count'];var _0x1c21ab=_0x5c8c5e?0x0:_0x49356a[_0x682e('0x1b')];var _0x144e2b=_0x5c8c5e?_0x201a0e[_0x682e('0x1c')]:_0x49356a[_0x682e('0x1b')]+_0x49356a['limit'];var _0x1f6ed4;if(_0x144e2b>=_0xdeb030){_0x144e2b=_0xdeb030;_0x1f6ed4=0xc8;}else{_0x1f6ed4=0xce;}_0xdba21b[_0x682e('0x16')](_0x1f6ed4);return _0xdba21b[_0x682e('0x1d')](_0x682e('0x1e'),_0x1c21ab+'-'+_0x144e2b+'/'+_0xdeb030)['json'](_0x201a0e);}return null;};}function patchUpdates(_0x2a2c5c){return function(_0x6be410){try{jsonpatch[_0x682e('0x1f')](_0x6be410,_0x2a2c5c,!![]);}catch(_0x277ac4){return BPromise[_0x682e('0x20')](_0x277ac4);}return _0x6be410[_0x682e('0x21')]();};}function saveUpdates(_0x53993e,_0x5f7a0f){return function(_0x30b209){if(_0x30b209){return _0x30b209[_0x682e('0x22')](_0x53993e)['then'](function(_0x2aecc4){return _0x2aecc4;});}return null;};}function removeEntity(_0x1efcf6,_0x5bcc9d){return function(_0x571bd9){if(_0x571bd9){return _0x571bd9[_0x682e('0x23')]()[_0x682e('0x24')](function(){var _0x8c73d1=_0x571bd9[_0x682e('0x25')]({'plain':!![]});var _0x11a882='Sounds';return db[_0x682e('0x26')][_0x682e('0x23')]({'where':{'type':_0x11a882,'resourceId':_0x8c73d1['id']}})['then'](function(){return _0x571bd9;});})['then'](function(){_0x1efcf6[_0x682e('0x16')](0xcc)[_0x682e('0x17')]();});}};}function handleEntityNotFound(_0x13ad01,_0x485b4c){return function(_0x51ebbf){if(!_0x51ebbf){_0x13ad01[_0x682e('0x27')](0x194);}return _0x51ebbf;};}function handleError(_0x1a4b1a,_0x545a91){_0x545a91=_0x545a91||0x1f4;return function(_0x2cedbb){logger[_0x682e('0x28')](_0x2cedbb[_0x682e('0x29')]);if(_0x2cedbb['name']){delete _0x2cedbb[_0x682e('0x2a')];}_0x1a4b1a['status'](_0x545a91)[_0x682e('0x2b')](_0x2cedbb);};}function getMustacheRender(_0xa96940,_0x178ecc){return Mustache[_0x682e('0x2c')](_0xa96940,_[_0x682e('0x2d')](_0x178ecc['body'],{'contact':_0x178ecc[_0x682e('0x2e')],'message':_0x178ecc[_0x682e('0x2f')],'agent':_0x178ecc[_0x682e('0x30')],'interaction':_0x178ecc['interaction'],'account':_0x178ecc[_0x682e('0x31')]}))||'';}exports[_0x682e('0x32')]=function(_0x5f31c9,_0x4c608c){var _0x32f2d6={},_0x5312c4={},_0x28cac9={'count':0x0,'rows':[]};var _0x297fbd=_['map'](db[_0x682e('0x33')][_0x682e('0x34')],function(_0x49357e){return{'name':_0x49357e['fieldName'],'type':_0x49357e[_0x682e('0x35')][_0x682e('0x36')]};});_0x5312c4[_0x682e('0x37')]=_[_0x682e('0x38')](_0x297fbd,_0x682e('0x2a'));_0x5312c4[_0x682e('0x39')]=_[_0x682e('0x3a')](_0x5f31c9[_0x682e('0x39')]);_0x5312c4[_0x682e('0x3b')]=_[_0x682e('0x3c')](_0x5312c4['model'],_0x5312c4[_0x682e('0x39')]);_0x32f2d6[_0x682e('0x3d')]=_[_0x682e('0x3c')](_0x5312c4[_0x682e('0x37')],qs['fields'](_0x5f31c9[_0x682e('0x39')]['fields']));_0x32f2d6['attributes']=_0x32f2d6[_0x682e('0x3d')][_0x682e('0x3e')]?_0x32f2d6[_0x682e('0x3d')]:_0x5312c4[_0x682e('0x37')];if(!_0x5f31c9[_0x682e('0x39')][_0x682e('0x3f')](_0x682e('0x40'))){_0x32f2d6['limit']=qs['limit'](_0x5f31c9['query'][_0x682e('0x1a')]);_0x32f2d6[_0x682e('0x1b')]=qs[_0x682e('0x1b')](_0x5f31c9['query'][_0x682e('0x1b')]);}_0x32f2d6[_0x682e('0x41')]=qs[_0x682e('0x42')](_0x5f31c9[_0x682e('0x39')][_0x682e('0x42')]);_0x32f2d6['where']=qs[_0x682e('0x3b')](_[_0x682e('0x43')](_0x5f31c9[_0x682e('0x39')],_0x5312c4[_0x682e('0x3b')]),_0x297fbd);if(_0x5f31c9['query'][_0x682e('0x44')]){_0x32f2d6[_0x682e('0x45')]=_[_0x682e('0x2d')](_0x32f2d6['where'],{'$or':_['map'](_0x297fbd,function(_0x4dc455){if(_0x4dc455[_0x682e('0x35')]!==_0x682e('0x46')){var _0x59694b={};_0x59694b[_0x4dc455['name']]={'$like':'%'+_0x5f31c9['query'][_0x682e('0x44')]+'%'};return _0x59694b;}})});}_0x32f2d6=_[_0x682e('0x2d')]({},_0x32f2d6,_0x5f31c9[_0x682e('0x47')]);var _0x837eaf={'where':_0x32f2d6[_0x682e('0x45')]};return db[_0x682e('0x33')]['count'](_0x837eaf)[_0x682e('0x24')](function(_0x389c78){_0x28cac9['count']=_0x389c78;if(_0x5f31c9[_0x682e('0x39')][_0x682e('0x48')]){_0x32f2d6[_0x682e('0x49')]=[{'all':!![]}];}return db[_0x682e('0x33')][_0x682e('0x4a')](_0x32f2d6);})[_0x682e('0x24')](function(_0x47cc7a){_0x28cac9[_0x682e('0x4b')]=_0x47cc7a;return _0x28cac9;})[_0x682e('0x24')](respondWithFilteredResult(_0x4c608c,_0x32f2d6))[_0x682e('0x4c')](handleError(_0x4c608c,null));};exports[_0x682e('0x4d')]=function(_0x373e8c,_0x546931){var _0x4bcd33={'raw':!![],'where':{'id':_0x373e8c['params']['id']}},_0x18add2={};_0x18add2[_0x682e('0x37')]=_[_0x682e('0x3a')](db['Sound'][_0x682e('0x34')]);_0x18add2['query']=_[_0x682e('0x3a')](_0x373e8c[_0x682e('0x39')]);_0x18add2[_0x682e('0x3b')]=_[_0x682e('0x3c')](_0x18add2[_0x682e('0x37')],_0x18add2[_0x682e('0x39')]);_0x4bcd33[_0x682e('0x3d')]=_['intersection'](_0x18add2['model'],qs[_0x682e('0x4e')](_0x373e8c[_0x682e('0x39')][_0x682e('0x4e')]));_0x4bcd33[_0x682e('0x3d')]=_0x4bcd33['attributes'][_0x682e('0x3e')]?_0x4bcd33[_0x682e('0x3d')]:_0x18add2[_0x682e('0x37')];if(_0x373e8c[_0x682e('0x39')][_0x682e('0x48')]){_0x4bcd33[_0x682e('0x49')]=[{'all':!![]}];}_0x4bcd33=_['merge']({},_0x4bcd33,_0x373e8c[_0x682e('0x47')]);return db[_0x682e('0x33')][_0x682e('0x4f')](_0x4bcd33)['then'](handleEntityNotFound(_0x546931,null))[_0x682e('0x24')](respondWithResult(_0x546931,null))[_0x682e('0x4c')](handleError(_0x546931,null));};exports[_0x682e('0x50')]=function(_0x22371a,_0x148e90,_0xa1b351){return db['Sound'][_0x682e('0x4f')]({'where':{'id':_0x22371a[_0x682e('0x51')]['id']},'attributes':[_0x682e('0x2a'),_0x682e('0x52'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x148e90,null))[_0x682e('0x24')](function(_0x528b6e){if(_0x528b6e){if(!fs[_0x682e('0x53')](path[_0x682e('0x54')](config[_0x682e('0x55')],'server/files/sounds/converted',_0x528b6e['save_name']+'.'+_0x528b6e['converted_format']))){throw new db['Sequelize'][(_0x682e('0x56'))](_0x682e('0x57'));}return _0x148e90[_0x682e('0x50')](path[_0x682e('0x54')](config['root'],_0x682e('0x58'),util['format'](_0x682e('0x59'),_0x528b6e[_0x682e('0x52')],_0x528b6e[_0x682e('0x5a')])),util['format'](_0x682e('0x59'),_0x528b6e[_0x682e('0x2a')],_0x528b6e[_0x682e('0x5a')]));}return null;})[_0x682e('0x4c')](handleError(_0x148e90,null));};exports[_0x682e('0x5b')]=function(_0x2ba241,_0x134abe,_0x11c0cd){var _0x3287eb={'name':path[_0x682e('0x5c')](_0x2ba241['file']['originalname'],path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x5f')])),'save_name':path[_0x682e('0x5c')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')],path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')])),'original_format':path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x5f')])[_0x682e('0x61')](0x1),'converted_format':_0x682e('0x62')};var _0x535fc5=path[_0x682e('0x54')](config[_0x682e('0x55')],_0x682e('0x63'),_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')]);var _0x399404=path['join'](config[_0x682e('0x55')],_0x682e('0x58'),util[_0x682e('0x64')]('%s.%s',path['basename'](_0x2ba241[_0x682e('0x5e')]['filename'],path[_0x682e('0x5d')](_0x2ba241[_0x682e('0x5e')][_0x682e('0x60')])),_0x3287eb[_0x682e('0x5a')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x535fc5);logger['info'](_0x682e('0x65'),_0x399404);try{fs[_0x682e('0x66')](_0x535fc5,parseInt('0777',0x8));var _0x47a785=sox['transcode'](_0x535fc5,_0x399404,{'sampleRate':0x1f40,'format':_0x682e('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x47a785['on'](_0x682e('0x28'),function(_0x2edbaa){fs[_0x682e('0x67')](_0x535fc5);_0x134abe['status'](0x1f4)[_0x682e('0x2b')](_0x2edbaa);});_0x47a785['on']('src',function(_0x531f61){_0x3287eb[_0x682e('0x68')]=isNaN(_0x531f61[_0x682e('0x69')])?null:_0x531f61['duration']*0x3e8;_0x3287eb[_0x682e('0x6a')]=isNaN(_0x531f61[_0x682e('0x6b')])?null:_0x531f61[_0x682e('0x6b')];_0x3287eb[_0x682e('0x6c')]=isNaN(_0x531f61[_0x682e('0x6d')])?null:_0x531f61[_0x682e('0x6d')];_0x3287eb['original_bitRate']=isNaN(_0x531f61['bitRate'])?null:_0x531f61[_0x682e('0x6e')];_0x3287eb[_0x682e('0x6f')]=isNaN(_0x531f61[_0x682e('0x70')])?null:_0x531f61['sampleRate'];});_0x47a785['on'](_0x682e('0x71'),function(_0x24fdf6){_0x3287eb['converted_duration']=isNaN(_0x24fdf6[_0x682e('0x69')])?null:_0x24fdf6[_0x682e('0x69')]*0x3e8;_0x3287eb[_0x682e('0x72')]=isNaN(_0x24fdf6['sampleCount'])?null:_0x24fdf6[_0x682e('0x6b')];_0x3287eb['converted_channelCount']=isNaN(_0x24fdf6['channelCount'])?null:_0x24fdf6[_0x682e('0x6d')];_0x3287eb[_0x682e('0x73')]=isNaN(_0x24fdf6[_0x682e('0x6e')])?null:_0x24fdf6[_0x682e('0x6e')];_0x3287eb['converted_sampleRate']=isNaN(_0x24fdf6[_0x682e('0x70')])?null:_0x24fdf6[_0x682e('0x70')];});_0x47a785['on'](_0x682e('0x17'),function(){fs[_0x682e('0x66')](_0x399404,parseInt(_0x682e('0x74'),0x8));return db[_0x682e('0x33')]['create'](_0x3287eb)[_0x682e('0x24')](function(_0x3750a5){var _0x146b66={'role':_0x2ba241['body'][_0x682e('0x75')],'userProfileId':_0x2ba241[_0x682e('0x76')]['userProfileId']};if(!_0x146b66)throw new Error(_0x682e('0x77'));if(_0x146b66['role']===_0x682e('0x78')){var _0x4647b4=_0x3750a5['get']({'plain':!![]});return db[_0x682e('0x79')][_0x682e('0x4f')]({'where':{'name':'Sounds','userProfileId':_0x146b66[_0x682e('0x7a')]},'raw':!![]})[_0x682e('0x24')](function(_0x5bff9f){if(_0x5bff9f&&_0x5bff9f['autoAssociation']===0x0){return db[_0x682e('0x26')][_0x682e('0x5b')]({'name':_0x4647b4['name'],'resourceId':_0x4647b4['id'],'type':_0x5bff9f['name'],'sectionId':_0x5bff9f['id']},{})[_0x682e('0x24')](function(){return _0x3750a5;});}else{return _0x3750a5;}})[_0x682e('0x4c')](function(_0x441e8a){logger[_0x682e('0x28')](_0x682e('0x7b'),_0x441e8a);throw _0x441e8a;});}return _0x3750a5;})['then'](respondWithResult(_0x134abe,null))['catch'](handleError(_0x134abe,null));});_0x47a785[_0x682e('0x7c')]();}catch(_0x3ecc02){_0x134abe['status'](0x1f4)['send'](_0x3ecc02);}};exports[_0x682e('0x22')]=function(_0x7244d6,_0x1d3c2b,_0x120ea4){return db[_0x682e('0x33')]['find']({'where':{'id':_0x7244d6[_0x682e('0x51')]['id']}})[_0x682e('0x24')](handleEntityNotFound(_0x1d3c2b,null))[_0x682e('0x24')](saveUpdates(_[_0x682e('0x43')](_0x7244d6[_0x682e('0x76')],['name',_0x682e('0x7d')]),null))[_0x682e('0x24')](respondWithResult(_0x1d3c2b,null))[_0x682e('0x4c')](handleError(_0x1d3c2b,null));};exports[_0x682e('0x7e')]=function(_0x25c49e,_0x45e6de,_0x276f56){return db[_0x682e('0x33')][_0x682e('0x4f')]({'where':{'id':_0x25c49e['params']['id']}})[_0x682e('0x24')](function(_0x31d67f){if(_0x31d67f){return _0x31d67f['destroy']();}})[_0x682e('0x24')](function(_0x323363){var _0x3df458=path[_0x682e('0x54')](config[_0x682e('0x55')],_0x682e('0x63'),util['format'](_0x682e('0x59'),_0x323363[_0x682e('0x52')],_0x323363[_0x682e('0x7f')]));var _0x17228b=path[_0x682e('0x54')](config[_0x682e('0x55')],_0x682e('0x58'),util[_0x682e('0x64')](_0x682e('0x59'),_0x323363[_0x682e('0x52')],_0x323363[_0x682e('0x5a')]));fs[_0x682e('0x67')](_0x3df458);fs[_0x682e('0x67')](_0x17228b);return _0x323363;})[_0x682e('0x24')](function(_0x396490){if(_0x396490){return _0x45e6de[_0x682e('0x16')](0xcc)[_0x682e('0x17')]();}})['then'](handleEntityNotFound(_0x45e6de,null))['catch'](handleError(_0x45e6de,null));}; \ No newline at end of file +var _0xdd42=['filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','converted_format','existsSync','server/files/sounds/converted','save_name','download','join','root','format','%s.%s','create','file','originalname','basename','filename','extname','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate','body','role','userProfileId','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','merge','contact','agent','interaction','account','index','map','Sound','rawAttributes','fieldName','name','query','keys'];(function(_0x3eef0e,_0x3ca1ee){var _0x18038b=function(_0x7037d1){while(--_0x7037d1){_0x3eef0e['push'](_0x3eef0e['shift']());}};_0x18038b(++_0x3ca1ee);}(_0xdd42,0xc7));var _0x2dd4=function(_0x34f042,_0x5ba9be){_0x34f042=_0x34f042-0x0;var _0x2d8b34=_0xdd42[_0x34f042];return _0x2d8b34;};'use strict';var emlformat=require(_0x2dd4('0x0'));var rimraf=require(_0x2dd4('0x1'));var zipdir=require(_0x2dd4('0x2'));var jsonpatch=require(_0x2dd4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2dd4('0x4'));var Mustache=require('mustache');var util=require(_0x2dd4('0x5'));var path=require(_0x2dd4('0x6'));var sox=require(_0x2dd4('0x7'));var csv=require(_0x2dd4('0x8'));var ejs=require(_0x2dd4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dd4('0xa'));var squel=require('squel');var crypto=require(_0x2dd4('0xb'));var jsforce=require(_0x2dd4('0xc'));var deskjs=require(_0x2dd4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2dd4('0xe'));var Papa=require(_0x2dd4('0xf'));var Redis=require(_0x2dd4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2dd4('0x11'));var as=require(_0x2dd4('0x12'));var hardwareService=require(_0x2dd4('0x13'));var logger=require(_0x2dd4('0x14'))(_0x2dd4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2dd4('0x16'));var db=require(_0x2dd4('0x17'))['db'];function respondWithStatusCode(_0x8b9d51,_0xb9dcf8){_0xb9dcf8=_0xb9dcf8||0xcc;return function(_0x533589){if(_0x533589){return _0x8b9d51[_0x2dd4('0x18')](_0xb9dcf8);}return _0x8b9d51[_0x2dd4('0x19')](_0xb9dcf8)[_0x2dd4('0x1a')]();};}function respondWithResult(_0x231baf,_0x2f479d){_0x2f479d=_0x2f479d||0xc8;return function(_0x21f2b4){if(_0x21f2b4){return _0x231baf[_0x2dd4('0x19')](_0x2f479d)[_0x2dd4('0x1b')](_0x21f2b4);}};}function respondWithFilteredResult(_0x2593ec,_0x55e038){return function(_0x416f60){if(_0x416f60){var _0x82801c=typeof _0x55e038[_0x2dd4('0x1c')]===_0x2dd4('0x1d')&&typeof _0x55e038['limit']===_0x2dd4('0x1d');var _0x62772b=_0x416f60['count'];var _0x5dd420=_0x82801c?0x0:_0x55e038['offset'];var _0x4ead54=_0x82801c?_0x416f60['count']:_0x55e038['offset']+_0x55e038['limit'];var _0x1e6ba3;if(_0x4ead54>=_0x62772b){_0x4ead54=_0x62772b;_0x1e6ba3=0xc8;}else{_0x1e6ba3=0xce;}_0x2593ec[_0x2dd4('0x19')](_0x1e6ba3);return _0x2593ec[_0x2dd4('0x1e')](_0x2dd4('0x1f'),_0x5dd420+'-'+_0x4ead54+'/'+_0x62772b)['json'](_0x416f60);}return null;};}function patchUpdates(_0x58a612){return function(_0x250ae7){try{jsonpatch['apply'](_0x250ae7,_0x58a612,!![]);}catch(_0x4c1067){return BPromise[_0x2dd4('0x20')](_0x4c1067);}return _0x250ae7[_0x2dd4('0x21')]();};}function saveUpdates(_0x207535,_0x2bce1f){return function(_0x1f421b){if(_0x1f421b){return _0x1f421b[_0x2dd4('0x22')](_0x207535)[_0x2dd4('0x23')](function(_0x5f45de){return _0x5f45de;});}return null;};}function removeEntity(_0x45a41b,_0x5b6fcc){return function(_0x58d071){if(_0x58d071){return _0x58d071[_0x2dd4('0x24')]()['then'](function(){var _0x3b43b1=_0x58d071[_0x2dd4('0x25')]({'plain':!![]});var _0x40a050='Sounds';return db[_0x2dd4('0x26')][_0x2dd4('0x24')]({'where':{'type':_0x40a050,'resourceId':_0x3b43b1['id']}})['then'](function(){return _0x58d071;});})[_0x2dd4('0x23')](function(){_0x45a41b[_0x2dd4('0x19')](0xcc)[_0x2dd4('0x1a')]();});}};}function handleEntityNotFound(_0x12396e,_0x2599ff){return function(_0x36e929){if(!_0x36e929){_0x12396e[_0x2dd4('0x18')](0x194);}return _0x36e929;};}function handleError(_0x47da21,_0x2a108d){_0x2a108d=_0x2a108d||0x1f4;return function(_0x5913dc){logger[_0x2dd4('0x27')](_0x5913dc[_0x2dd4('0x28')]);if(_0x5913dc['name']){delete _0x5913dc['name'];}_0x47da21['status'](_0x2a108d)[_0x2dd4('0x29')](_0x5913dc);};}function getMustacheRender(_0x5243bb,_0x1b6426){return Mustache['render'](_0x5243bb,_[_0x2dd4('0x2a')](_0x1b6426['body'],{'contact':_0x1b6426[_0x2dd4('0x2b')],'message':_0x1b6426['message'],'agent':_0x1b6426[_0x2dd4('0x2c')],'interaction':_0x1b6426[_0x2dd4('0x2d')],'account':_0x1b6426[_0x2dd4('0x2e')]}))||'';}exports[_0x2dd4('0x2f')]=function(_0x356dbf,_0x43d932){var _0x3e1fd5={},_0x34808b={},_0x3cfb59={'count':0x0,'rows':[]};var _0x12c439=_[_0x2dd4('0x30')](db[_0x2dd4('0x31')][_0x2dd4('0x32')],function(_0x19aac9){return{'name':_0x19aac9[_0x2dd4('0x33')],'type':_0x19aac9['type']['key']};});_0x34808b['model']=_[_0x2dd4('0x30')](_0x12c439,_0x2dd4('0x34'));_0x34808b[_0x2dd4('0x35')]=_[_0x2dd4('0x36')](_0x356dbf['query']);_0x34808b[_0x2dd4('0x37')]=_[_0x2dd4('0x38')](_0x34808b['model'],_0x34808b['query']);_0x3e1fd5[_0x2dd4('0x39')]=_['intersection'](_0x34808b[_0x2dd4('0x3a')],qs[_0x2dd4('0x3b')](_0x356dbf['query'][_0x2dd4('0x3b')]));_0x3e1fd5['attributes']=_0x3e1fd5[_0x2dd4('0x39')][_0x2dd4('0x3c')]?_0x3e1fd5['attributes']:_0x34808b[_0x2dd4('0x3a')];if(!_0x356dbf['query'][_0x2dd4('0x3d')]('nolimit')){_0x3e1fd5['limit']=qs[_0x2dd4('0x3e')](_0x356dbf['query']['limit']);_0x3e1fd5['offset']=qs[_0x2dd4('0x1c')](_0x356dbf[_0x2dd4('0x35')][_0x2dd4('0x1c')]);}_0x3e1fd5[_0x2dd4('0x3f')]=qs[_0x2dd4('0x40')](_0x356dbf[_0x2dd4('0x35')][_0x2dd4('0x40')]);_0x3e1fd5[_0x2dd4('0x41')]=qs[_0x2dd4('0x37')](_[_0x2dd4('0x42')](_0x356dbf[_0x2dd4('0x35')],_0x34808b['filters']),_0x12c439);if(_0x356dbf[_0x2dd4('0x35')][_0x2dd4('0x43')]){_0x3e1fd5[_0x2dd4('0x41')]=_[_0x2dd4('0x2a')](_0x3e1fd5['where'],{'$or':_[_0x2dd4('0x30')](_0x12c439,function(_0x40a83b){if(_0x40a83b[_0x2dd4('0x44')]!==_0x2dd4('0x45')){var _0x16129b={};_0x16129b[_0x40a83b[_0x2dd4('0x34')]]={'$like':'%'+_0x356dbf['query'][_0x2dd4('0x43')]+'%'};return _0x16129b;}})});}_0x3e1fd5=_[_0x2dd4('0x2a')]({},_0x3e1fd5,_0x356dbf[_0x2dd4('0x46')]);var _0x13babd={'where':_0x3e1fd5[_0x2dd4('0x41')]};return db[_0x2dd4('0x31')][_0x2dd4('0x47')](_0x13babd)[_0x2dd4('0x23')](function(_0x32a9d7){_0x3cfb59[_0x2dd4('0x47')]=_0x32a9d7;if(_0x356dbf[_0x2dd4('0x35')][_0x2dd4('0x48')]){_0x3e1fd5[_0x2dd4('0x49')]=[{'all':!![]}];}return db[_0x2dd4('0x31')][_0x2dd4('0x4a')](_0x3e1fd5);})['then'](function(_0x23f07){_0x3cfb59['rows']=_0x23f07;return _0x3cfb59;})['then'](respondWithFilteredResult(_0x43d932,_0x3e1fd5))[_0x2dd4('0x4b')](handleError(_0x43d932,null));};exports[_0x2dd4('0x4c')]=function(_0x50adaa,_0x2aeb35){var _0x27ccb8={'raw':!![],'where':{'id':_0x50adaa[_0x2dd4('0x4d')]['id']}},_0x189de7={};_0x189de7[_0x2dd4('0x3a')]=_[_0x2dd4('0x36')](db['Sound'][_0x2dd4('0x32')]);_0x189de7[_0x2dd4('0x35')]=_[_0x2dd4('0x36')](_0x50adaa[_0x2dd4('0x35')]);_0x189de7['filters']=_[_0x2dd4('0x38')](_0x189de7['model'],_0x189de7['query']);_0x27ccb8[_0x2dd4('0x39')]=_['intersection'](_0x189de7['model'],qs[_0x2dd4('0x3b')](_0x50adaa['query'][_0x2dd4('0x3b')]));_0x27ccb8[_0x2dd4('0x39')]=_0x27ccb8[_0x2dd4('0x39')][_0x2dd4('0x3c')]?_0x27ccb8[_0x2dd4('0x39')]:_0x189de7['model'];if(_0x50adaa[_0x2dd4('0x35')][_0x2dd4('0x48')]){_0x27ccb8[_0x2dd4('0x49')]=[{'all':!![]}];}_0x27ccb8=_[_0x2dd4('0x2a')]({},_0x27ccb8,_0x50adaa[_0x2dd4('0x46')]);return db['Sound']['find'](_0x27ccb8)[_0x2dd4('0x23')](handleEntityNotFound(_0x2aeb35,null))[_0x2dd4('0x23')](respondWithResult(_0x2aeb35,null))['catch'](handleError(_0x2aeb35,null));};exports['download']=function(_0x3a9a41,_0x31b19e,_0x201cd9){return db[_0x2dd4('0x31')][_0x2dd4('0x4e')]({'where':{'id':_0x3a9a41[_0x2dd4('0x4d')]['id']},'attributes':[_0x2dd4('0x34'),'save_name',_0x2dd4('0x4f')],'raw':!![]})[_0x2dd4('0x23')](handleEntityNotFound(_0x31b19e,null))[_0x2dd4('0x23')](function(_0x237639){if(_0x237639){if(!fs[_0x2dd4('0x50')](path['join'](config['root'],_0x2dd4('0x51'),_0x237639[_0x2dd4('0x52')]+'.'+_0x237639['converted_format']))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x31b19e[_0x2dd4('0x53')](path[_0x2dd4('0x54')](config[_0x2dd4('0x55')],'server/files/sounds/converted',util[_0x2dd4('0x56')](_0x2dd4('0x57'),_0x237639[_0x2dd4('0x52')],_0x237639['converted_format'])),util['format']('%s.%s',_0x237639['name'],_0x237639[_0x2dd4('0x4f')]));}return null;})['catch'](handleError(_0x31b19e,null));};exports[_0x2dd4('0x58')]=function(_0x5d2f9a,_0x3cd75e,_0x3e7f18){var _0x15f7f7={'name':path['basename'](_0x5d2f9a[_0x2dd4('0x59')][_0x2dd4('0x5a')],path['extname'](_0x5d2f9a[_0x2dd4('0x59')]['originalname'])),'save_name':path[_0x2dd4('0x5b')](_0x5d2f9a['file'][_0x2dd4('0x5c')],path[_0x2dd4('0x5d')](_0x5d2f9a[_0x2dd4('0x59')][_0x2dd4('0x5c')])),'original_format':path[_0x2dd4('0x5d')](_0x5d2f9a[_0x2dd4('0x59')][_0x2dd4('0x5a')])[_0x2dd4('0x5e')](0x1),'converted_format':'wav'};var _0x46579f=path[_0x2dd4('0x54')](config[_0x2dd4('0x55')],_0x2dd4('0x5f'),_0x5d2f9a[_0x2dd4('0x59')][_0x2dd4('0x5c')]);var _0x2e5651=path[_0x2dd4('0x54')](config[_0x2dd4('0x55')],_0x2dd4('0x51'),util[_0x2dd4('0x56')](_0x2dd4('0x57'),path['basename'](_0x5d2f9a[_0x2dd4('0x59')][_0x2dd4('0x5c')],path['extname'](_0x5d2f9a['file'][_0x2dd4('0x5c')])),_0x15f7f7[_0x2dd4('0x4f')]));logger['info'](_0x2dd4('0x60'),_0x46579f);logger[_0x2dd4('0x61')]('Sound\x20upload\x20destination:\x20%s',_0x2e5651);try{fs[_0x2dd4('0x62')](_0x46579f,parseInt(_0x2dd4('0x63'),0x8));var _0x57493b=sox[_0x2dd4('0x64')](_0x46579f,_0x2e5651,{'sampleRate':0x1f40,'format':_0x2dd4('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x57493b['on'](_0x2dd4('0x27'),function(_0x10a86d){fs[_0x2dd4('0x66')](_0x46579f);_0x3cd75e[_0x2dd4('0x19')](0x1f4)['send'](_0x10a86d);});_0x57493b['on'](_0x2dd4('0x67'),function(_0x1dfa4e){_0x15f7f7[_0x2dd4('0x68')]=isNaN(_0x1dfa4e['duration'])?null:_0x1dfa4e[_0x2dd4('0x69')]*0x3e8;_0x15f7f7[_0x2dd4('0x6a')]=isNaN(_0x1dfa4e[_0x2dd4('0x6b')])?null:_0x1dfa4e['sampleCount'];_0x15f7f7[_0x2dd4('0x6c')]=isNaN(_0x1dfa4e[_0x2dd4('0x6d')])?null:_0x1dfa4e[_0x2dd4('0x6d')];_0x15f7f7[_0x2dd4('0x6e')]=isNaN(_0x1dfa4e[_0x2dd4('0x6f')])?null:_0x1dfa4e[_0x2dd4('0x6f')];_0x15f7f7['original_sampleRate']=isNaN(_0x1dfa4e['sampleRate'])?null:_0x1dfa4e[_0x2dd4('0x70')];});_0x57493b['on'](_0x2dd4('0x71'),function(_0x14d14f){_0x15f7f7[_0x2dd4('0x72')]=isNaN(_0x14d14f['duration'])?null:_0x14d14f[_0x2dd4('0x69')]*0x3e8;_0x15f7f7['converted_sampleCount']=isNaN(_0x14d14f['sampleCount'])?null:_0x14d14f[_0x2dd4('0x6b')];_0x15f7f7[_0x2dd4('0x73')]=isNaN(_0x14d14f[_0x2dd4('0x6d')])?null:_0x14d14f[_0x2dd4('0x6d')];_0x15f7f7['converted_bitRate']=isNaN(_0x14d14f['bitRate'])?null:_0x14d14f[_0x2dd4('0x6f')];_0x15f7f7[_0x2dd4('0x74')]=isNaN(_0x14d14f[_0x2dd4('0x70')])?null:_0x14d14f[_0x2dd4('0x70')];});_0x57493b['on'](_0x2dd4('0x1a'),function(){fs['chmodSync'](_0x2e5651,parseInt(_0x2dd4('0x63'),0x8));return db[_0x2dd4('0x31')]['create'](_0x15f7f7)[_0x2dd4('0x23')](function(_0x1714a5){var _0x12d045={'role':_0x5d2f9a[_0x2dd4('0x75')][_0x2dd4('0x76')],'userProfileId':_0x5d2f9a[_0x2dd4('0x75')][_0x2dd4('0x77')]};if(!_0x12d045)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12d045[_0x2dd4('0x76')]==='user'){var _0x11adf8=_0x1714a5[_0x2dd4('0x25')]({'plain':!![]});return db[_0x2dd4('0x78')][_0x2dd4('0x4e')]({'where':{'name':_0x2dd4('0x79'),'userProfileId':_0x12d045['userProfileId']},'raw':!![]})[_0x2dd4('0x23')](function(_0x47dca9){if(_0x47dca9&&_0x47dca9[_0x2dd4('0x7a')]===0x0){return db[_0x2dd4('0x26')]['create']({'name':_0x11adf8[_0x2dd4('0x34')],'resourceId':_0x11adf8['id'],'type':_0x47dca9[_0x2dd4('0x34')],'sectionId':_0x47dca9['id']},{})[_0x2dd4('0x23')](function(){return _0x1714a5;});}else{return _0x1714a5;}})[_0x2dd4('0x4b')](function(_0x26e045){logger[_0x2dd4('0x27')](_0x2dd4('0x7b'),_0x26e045);throw _0x26e045;});}return _0x1714a5;})[_0x2dd4('0x23')](respondWithResult(_0x3cd75e,null))[_0x2dd4('0x4b')](handleError(_0x3cd75e,null));});_0x57493b[_0x2dd4('0x7c')]();}catch(_0x4f6d02){_0x3cd75e[_0x2dd4('0x19')](0x1f4)['send'](_0x4f6d02);}};exports[_0x2dd4('0x22')]=function(_0x134bbc,_0x12c005,_0x24dc59){return db['Sound'][_0x2dd4('0x4e')]({'where':{'id':_0x134bbc[_0x2dd4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x12c005,null))[_0x2dd4('0x23')](saveUpdates(_[_0x2dd4('0x42')](_0x134bbc[_0x2dd4('0x75')],[_0x2dd4('0x34'),'description']),null))[_0x2dd4('0x23')](respondWithResult(_0x12c005,null))[_0x2dd4('0x4b')](handleError(_0x12c005,null));};exports[_0x2dd4('0x7d')]=function(_0x255611,_0x79ebbb,_0x8b7e24){return db[_0x2dd4('0x31')][_0x2dd4('0x4e')]({'where':{'id':_0x255611[_0x2dd4('0x4d')]['id']}})[_0x2dd4('0x23')](function(_0x7df3d2){if(_0x7df3d2){return _0x7df3d2['destroy']();}})[_0x2dd4('0x23')](function(_0x32de03){var _0x112a1f=path[_0x2dd4('0x54')](config[_0x2dd4('0x55')],_0x2dd4('0x5f'),util['format'](_0x2dd4('0x57'),_0x32de03['save_name'],_0x32de03[_0x2dd4('0x7e')]));var _0x468df9=path[_0x2dd4('0x54')](config['root'],'server/files/sounds/converted',util[_0x2dd4('0x56')](_0x2dd4('0x57'),_0x32de03[_0x2dd4('0x52')],_0x32de03[_0x2dd4('0x4f')]));fs[_0x2dd4('0x66')](_0x112a1f);fs[_0x2dd4('0x66')](_0x468df9);return _0x32de03;})[_0x2dd4('0x23')](function(_0x24fd84){if(_0x24fd84){return _0x79ebbb[_0x2dd4('0x19')](0xcc)[_0x2dd4('0x1a')]();}})[_0x2dd4('0x23')](handleEntityNotFound(_0x79ebbb,null))['catch'](handleError(_0x79ebbb,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a4de203..b0d5266 100644 --- a/server/api/sound/sound.model.js +++ b/server/api/sound/sound.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc38c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api'];(function(_0x13634e,_0x5de6a9){var _0x4b27c0=function(_0xf703a1){while(--_0xf703a1){_0x13634e['push'](_0x13634e['shift']());}};_0x4b27c0(++_0x5de6a9);}(_0xc38c,0x10a));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc38('0x0'));var util=require(_0xcc38('0x1'));var logger=require(_0xcc38('0x2'))(_0xcc38('0x3'));var moment=require(_0xcc38('0x4'));var BPromise=require(_0xcc38('0x5'));var rp=require(_0xcc38('0x6'));var fs=require('fs');var path=require(_0xcc38('0x7'));var rimraf=require(_0xcc38('0x8'));var config=require(_0xcc38('0x9'));var attributes=require(_0xcc38('0xa'));module[_0xcc38('0xb')]=function(_0x52f31c,_0x23e9a9){return _0x52f31c[_0xcc38('0xc')](_0xcc38('0xd'),attributes,{'tableName':_0xcc38('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c62=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c62,0x1e8));var _0x26c6=function(_0x5e462b,_0x187b06){_0x5e462b=_0x5e462b-0x0;var _0xb01a65=_0x6c62[_0x5e462b];return _0xb01a65;};'use strict';var _=require(_0x26c6('0x0'));var util=require('util');var logger=require(_0x26c6('0x1'))('api');var moment=require(_0x26c6('0x2'));var BPromise=require(_0x26c6('0x3'));var rp=require(_0x26c6('0x4'));var fs=require('fs');var path=require(_0x26c6('0x5'));var rimraf=require(_0x26c6('0x6'));var config=require(_0x26c6('0x7'));var attributes=require(_0x26c6('0x8'));module[_0x26c6('0x9')]=function(_0x28a2bd,_0xd9beae){return _0x28a2bd[_0x26c6('0xa')](_0x26c6('0xb'),attributes,{'tableName':_0x26c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index fef1261..952286f 100644 --- a/server/api/sound/sound.rpc.js +++ b/server/api/sound/sound.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b07=['Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code'];(function(_0x2d9e90,_0x5dcc72){var _0x54695f=function(_0xc3b3){while(--_0xc3b3){_0x2d9e90['push'](_0x2d9e90['shift']());}};_0x54695f(++_0x5dcc72);}(_0x1b07,0x142));var _0x71b0=function(_0x15f3c0,_0x165a64){_0x15f3c0=_0x15f3c0-0x0;var _0x1adfe0=_0x1b07[_0x15f3c0];return _0x1adfe0;};'use strict';var _=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var moment=require(_0x71b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x71b0('0x3'));var fs=require('fs');var Redis=require(_0x71b0('0x4'));var db=require(_0x71b0('0x5'))['db'];var utils=require(_0x71b0('0x6'));var logger=require(_0x71b0('0x7'))(_0x71b0('0x8'));var config=require('../../config/environment');var jayson=require(_0x71b0('0x9'));var client=jayson[_0x71b0('0xa')][_0x71b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283be1,_0x424430,_0x993225){return new BPromise(function(_0x1b06e6,_0x1d6419){return client[_0x71b0('0xc')](_0x283be1,_0x993225)['then'](function(_0x1a677c){logger[_0x71b0('0xd')]('Sound,\x20%s,\x20%s',_0x424430,_0x71b0('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x424430,_0x71b0('0xe'),JSON[_0x71b0('0xf')](_0x1a677c));if(_0x1a677c[_0x71b0('0x10')]){if(_0x1a677c[_0x71b0('0x10')][_0x71b0('0x11')]===0x1f4){logger[_0x71b0('0x10')](_0x71b0('0x12'),_0x424430,_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);return _0x1d6419(_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);}logger[_0x71b0('0x10')](_0x71b0('0x12'),_0x424430,_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);return _0x1b06e6(_0x1a677c[_0x71b0('0x10')][_0x71b0('0x13')]);}else{logger[_0x71b0('0xd')](_0x71b0('0x12'),_0x424430,_0x71b0('0xe'));_0x1b06e6(_0x1a677c[_0x71b0('0x14')][_0x71b0('0x13')]);}})[_0x71b0('0x15')](function(_0x48e91b){logger[_0x71b0('0x10')](_0x71b0('0x12'),_0x424430,_0x48e91b);_0x1d6419(_0x48e91b);});});}exports[_0x71b0('0x16')]=function(_0x1c5b11){var _0x2e4c88=this;return new Promise(function(_0x535e9a,_0x1d7436){return db[_0x71b0('0x17')][_0x71b0('0x18')]({'raw':_0x1c5b11[_0x71b0('0x19')]?_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c5b11['options']?_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1b')]||null:null,'attributes':_0x1c5b11[_0x71b0('0x19')]?_0x1c5b11['options'][_0x71b0('0x1c')]||null:null,'include':_0x1c5b11[_0x71b0('0x19')]?_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1d')]?_[_0x71b0('0x1e')](_0x1c5b11[_0x71b0('0x19')][_0x71b0('0x1d')],function(_0x110c0b){return{'model':db[_0x110c0b[_0x71b0('0x1f')]],'as':_0x110c0b['as'],'attributes':_0x110c0b[_0x71b0('0x1c')],'include':_0x110c0b[_0x71b0('0x1d')]?_['map'](_0x110c0b[_0x71b0('0x1d')],function(_0x4076af){return{'model':db[_0x4076af[_0x71b0('0x1f')]],'as':_0x4076af['as'],'attributes':_0x4076af['attributes'],'include':_0x4076af[_0x71b0('0x1d')]?_[_0x71b0('0x1e')](_0x4076af['include'],function(_0x2b4ce7){return{'model':db[_0x2b4ce7[_0x71b0('0x1f')]],'as':_0x2b4ce7['as'],'attributes':_0x2b4ce7[_0x71b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x71b0('0x20')](function(_0xdff3ee){logger[_0x71b0('0xd')](_0x71b0('0x16'),_0x1c5b11);logger[_0x71b0('0x21')](_0x71b0('0x16'),_0x1c5b11,JSON[_0x71b0('0xf')](_0xdff3ee));_0x535e9a(_0xdff3ee);})[_0x71b0('0x15')](function(_0x185bfc){logger[_0x71b0('0x10')](_0x71b0('0x16'),_0x185bfc['message'],_0x1c5b11);_0x1d7436(_0x2e4c88[_0x71b0('0x10')](0x1f4,_0x185bfc[_0x71b0('0x13')]));});});}; \ No newline at end of file +var _0xecdf=['message','result','catch','Sound','find','options','raw','where','attributes','include','map','model','then','ShowSound','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3509b9,_0x38bb75){var _0x11704f=function(_0x37a435){while(--_0x37a435){_0x3509b9['push'](_0x3509b9['shift']());}};_0x11704f(++_0x38bb75);}(_0xecdf,0x103));var _0xfecd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xecdf[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xfecd('0x0'));var util=require(_0xfecd('0x1'));var moment=require(_0xfecd('0x2'));var BPromise=require('bluebird');var rs=require(_0xfecd('0x3'));var fs=require('fs');var Redis=require(_0xfecd('0x4'));var db=require(_0xfecd('0x5'))['db'];var utils=require(_0xfecd('0x6'));var logger=require(_0xfecd('0x7'))(_0xfecd('0x8'));var config=require(_0xfecd('0x9'));var jayson=require(_0xfecd('0xa'));var client=jayson[_0xfecd('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42d8e6,_0x77a58a,_0x333aaa){return new BPromise(function(_0x558cb7,_0x447560){return client[_0xfecd('0xc')](_0x42d8e6,_0x333aaa)['then'](function(_0x44400c){logger[_0xfecd('0xd')](_0xfecd('0xe'),_0x77a58a,_0xfecd('0xf'));logger[_0xfecd('0x10')](_0xfecd('0x11'),_0x77a58a,_0xfecd('0xf'),JSON[_0xfecd('0x12')](_0x44400c));if(_0x44400c[_0xfecd('0x13')]){if(_0x44400c[_0xfecd('0x13')][_0xfecd('0x14')]===0x1f4){logger[_0xfecd('0x13')](_0xfecd('0xe'),_0x77a58a,_0x44400c[_0xfecd('0x13')][_0xfecd('0x15')]);return _0x447560(_0x44400c[_0xfecd('0x13')][_0xfecd('0x15')]);}logger['error'](_0xfecd('0xe'),_0x77a58a,_0x44400c['error'][_0xfecd('0x15')]);return _0x558cb7(_0x44400c[_0xfecd('0x13')]['message']);}else{logger[_0xfecd('0xd')](_0xfecd('0xe'),_0x77a58a,_0xfecd('0xf'));_0x558cb7(_0x44400c[_0xfecd('0x16')][_0xfecd('0x15')]);}})[_0xfecd('0x17')](function(_0x5895b2){logger['error']('Sound,\x20%s,\x20%s',_0x77a58a,_0x5895b2);_0x447560(_0x5895b2);});});}exports['ShowSound']=function(_0x3afd0b){var _0xbe6a5a=this;return new Promise(function(_0x274cdd,_0xe3f79d){return db[_0xfecd('0x18')][_0xfecd('0x19')]({'raw':_0x3afd0b[_0xfecd('0x1a')]?_0x3afd0b[_0xfecd('0x1a')][_0xfecd('0x1b')]===undefined?!![]:![]:!![],'where':_0x3afd0b[_0xfecd('0x1a')]?_0x3afd0b['options'][_0xfecd('0x1c')]||null:null,'attributes':_0x3afd0b['options']?_0x3afd0b[_0xfecd('0x1a')][_0xfecd('0x1d')]||null:null,'include':_0x3afd0b[_0xfecd('0x1a')]?_0x3afd0b[_0xfecd('0x1a')][_0xfecd('0x1e')]?_[_0xfecd('0x1f')](_0x3afd0b[_0xfecd('0x1a')][_0xfecd('0x1e')],function(_0x51b688){return{'model':db[_0x51b688[_0xfecd('0x20')]],'as':_0x51b688['as'],'attributes':_0x51b688['attributes'],'include':_0x51b688['include']?_[_0xfecd('0x1f')](_0x51b688[_0xfecd('0x1e')],function(_0x597760){return{'model':db[_0x597760['model']],'as':_0x597760['as'],'attributes':_0x597760[_0xfecd('0x1d')],'include':_0x597760['include']?_[_0xfecd('0x1f')](_0x597760[_0xfecd('0x1e')],function(_0x5cd6bd){return{'model':db[_0x5cd6bd[_0xfecd('0x20')]],'as':_0x5cd6bd['as'],'attributes':_0x5cd6bd[_0xfecd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfecd('0x21')](function(_0x3116b8){logger[_0xfecd('0xd')](_0xfecd('0x22'),_0x3afd0b);logger[_0xfecd('0x10')](_0xfecd('0x22'),_0x3afd0b,JSON[_0xfecd('0x12')](_0x3116b8));_0x274cdd(_0x3116b8);})[_0xfecd('0x17')](function(_0x5574ee){logger[_0xfecd('0x13')](_0xfecd('0x22'),_0x5574ee[_0xfecd('0x15')],_0x3afd0b);_0xe3f79d(_0xbe6a5a[_0xfecd('0x13')](0x1f4,_0x5574ee[_0xfecd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 51eeb7a..427124c 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc8=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create','put','delete','destroy','multer','path','express','fs-extra'];(function(_0xb2e01d,_0x28c6a0){var _0x595ae0=function(_0x3ec1c4){while(--_0x3ec1c4){_0xb2e01d['push'](_0xb2e01d['shift']());}};_0x595ae0(++_0x28c6a0);}(_0xafc8,0x7a));var _0x8afc=function(_0x5ca53c,_0x2f831d){_0x5ca53c=_0x5ca53c-0x0;var _0xde810b=_0xafc8[_0x5ca53c];return _0xde810b;};'use strict';var multer=require(_0x8afc('0x0'));var util=require('util');var path=require(_0x8afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x8afc('0x2'));var router=express['Router']();var fs_extra=require(_0x8afc('0x3'));var auth=require(_0x8afc('0x4'));var interaction=require(_0x8afc('0x5'));var config=require('../../config/environment');var controller=require('./squareMessage.controller');router[_0x8afc('0x6')]('/',auth[_0x8afc('0x7')](),controller['index']);router[_0x8afc('0x6')](_0x8afc('0x8'),auth[_0x8afc('0x7')](),controller['show']);router[_0x8afc('0x9')]('/',auth[_0x8afc('0x7')](),controller[_0x8afc('0xa')]);router[_0x8afc('0xb')](_0x8afc('0x8'),auth[_0x8afc('0x7')](),controller['update']);router[_0x8afc('0xc')](_0x8afc('0x8'),auth[_0x8afc('0x7')](),controller[_0x8afc('0xd')]);module['exports']=router; \ No newline at end of file +var _0xc0af=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc0af,0x1ab));var _0xfc0a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0af[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xfc0a('0x0'));var util=require('util');var path=require(_0xfc0a('0x1'));var timeout=require(_0xfc0a('0x2'));var express=require('express');var router=express[_0xfc0a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfc0a('0x4'));var interaction=require(_0xfc0a('0x5'));var config=require(_0xfc0a('0x6'));var controller=require(_0xfc0a('0x7'));router[_0xfc0a('0x8')]('/',auth[_0xfc0a('0x9')](),controller[_0xfc0a('0xa')]);router['get'](_0xfc0a('0xb'),auth[_0xfc0a('0x9')](),controller['show']);router['post']('/',auth[_0xfc0a('0x9')](),controller['create']);router[_0xfc0a('0xc')](_0xfc0a('0xb'),auth[_0xfc0a('0x9')](),controller[_0xfc0a('0xd')]);router[_0xfc0a('0xe')](_0xfc0a('0xb'),auth[_0xfc0a('0x9')](),controller[_0xfc0a('0xf')]);module[_0xfc0a('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b5d6c93..0340904 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8f=['exports','TEXT','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0xc997c3,_0x436bc2){_0xc997c3=_0xc997c3-0x0;var _0x178b81=_0x6b8f[_0xc997c3];return _0x178b81;};'use strict';var Sequelize=require('sequelize');module[_0xf6b8('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xf6b8('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf6b8('0x2')),'defaultValue':_0xf6b8('0x2'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf6b8('0x1')]}}; \ No newline at end of file +var _0xf69d=['out','sequelize','exports','STRING','TEXT','medium'];(function(_0x4fb7b1,_0x3eb5d7){var _0xaa0ada=function(_0x324ef2){while(--_0x324ef2){_0x4fb7b1['push'](_0x4fb7b1['shift']());}};_0xaa0ada(++_0x3eb5d7);}(_0xf69d,0xd3));var _0xdf69=function(_0xbd2e04,_0x5c7974){_0xbd2e04=_0xbd2e04-0x0;var _0x1b8393=_0xf69d[_0xbd2e04];return _0x1b8393;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'uniqueid':{'type':Sequelize[_0xdf69('0x2')]},'body':{'type':Sequelize[_0xdf69('0x3')](_0xdf69('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdf69('0x5')),'defaultValue':_0xdf69('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xdf69('0x2')]},'providerResponse':{'type':Sequelize[_0xdf69('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5c387d9..12bfb8b 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x525e=['then','rows','catch','include','create','params','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','merge','body','message','interaction','index','map','SquareMessage','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','name','options','includeAll','findAll'];(function(_0x9af7ad,_0x326b02){var _0x14e368=function(_0x55d28d){while(--_0x55d28d){_0x9af7ad['push'](_0x9af7ad['shift']());}};_0x14e368(++_0x326b02);}(_0x525e,0x1bd));var _0xe525=function(_0x367f90,_0x390d3){_0x367f90=_0x367f90-0x0;var _0xfb9cfe=_0x525e[_0x367f90];return _0xfb9cfe;};'use strict';var emlformat=require(_0xe525('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe525('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe525('0x2'));var moment=require(_0xe525('0x3'));var BPromise=require(_0xe525('0x4'));var Mustache=require(_0xe525('0x5'));var util=require(_0xe525('0x6'));var path=require(_0xe525('0x7'));var sox=require('sox');var csv=require(_0xe525('0x8'));var ejs=require(_0xe525('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe525('0xa'));var squel=require(_0xe525('0xb'));var crypto=require('crypto');var jsforce=require(_0xe525('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe525('0x8'));var querystring=require('querystring');var Papa=require(_0xe525('0xd'));var Redis=require('ioredis');var authService=require(_0xe525('0xe'));var qs=require(_0xe525('0xf'));var as=require(_0xe525('0x10'));var hardwareService=require(_0xe525('0x11'));var logger=require(_0xe525('0x12'))(_0xe525('0x13'));var utils=require(_0xe525('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe525('0x15'));var db=require(_0xe525('0x16'))['db'];function respondWithStatusCode(_0x3eb026,_0x5793ef){_0x5793ef=_0x5793ef||0xcc;return function(_0xdcce26){if(_0xdcce26){return _0x3eb026[_0xe525('0x17')](_0x5793ef);}return _0x3eb026[_0xe525('0x18')](_0x5793ef)[_0xe525('0x19')]();};}function respondWithResult(_0x3b2485,_0x4ed119){_0x4ed119=_0x4ed119||0xc8;return function(_0x5a8676){if(_0x5a8676){return _0x3b2485[_0xe525('0x18')](_0x4ed119)[_0xe525('0x1a')](_0x5a8676);}};}function respondWithFilteredResult(_0x32349c,_0x56532b){return function(_0x3cfc62){if(_0x3cfc62){var _0x1bec94=typeof _0x56532b['offset']===_0xe525('0x1b')&&typeof _0x56532b[_0xe525('0x1c')]===_0xe525('0x1b');var _0x3e064a=_0x3cfc62['count'];var _0x47b0eb=_0x1bec94?0x0:_0x56532b['offset'];var _0x38c605=_0x1bec94?_0x3cfc62[_0xe525('0x1d')]:_0x56532b[_0xe525('0x1e')]+_0x56532b[_0xe525('0x1c')];var _0x377abe;if(_0x38c605>=_0x3e064a){_0x38c605=_0x3e064a;_0x377abe=0xc8;}else{_0x377abe=0xce;}_0x32349c['status'](_0x377abe);return _0x32349c[_0xe525('0x1f')](_0xe525('0x20'),_0x47b0eb+'-'+_0x38c605+'/'+_0x3e064a)['json'](_0x3cfc62);}return null;};}function patchUpdates(_0x310350){return function(_0x42f922){try{jsonpatch[_0xe525('0x21')](_0x42f922,_0x310350,!![]);}catch(_0x5bc8ca){return BPromise[_0xe525('0x22')](_0x5bc8ca);}return _0x42f922[_0xe525('0x23')]();};}function saveUpdates(_0x571926,_0x381f70){return function(_0x5d09a){if(_0x5d09a){return _0x5d09a[_0xe525('0x24')](_0x571926)['then'](function(_0x5682a0){return _0x5682a0;});}return null;};}function removeEntity(_0x4aa66f,_0x296bdf){return function(_0x34f7a5){if(_0x34f7a5){return _0x34f7a5[_0xe525('0x25')]()['then'](function(){_0x4aa66f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x390a8c,_0x151fc3){return function(_0x1363ea){if(!_0x1363ea){_0x390a8c[_0xe525('0x17')](0x194);}return _0x1363ea;};}function handleError(_0x3e4002,_0x2f7f7a){_0x2f7f7a=_0x2f7f7a||0x1f4;return function(_0x4c998b){logger[_0xe525('0x26')](_0x4c998b['stack']);if(_0x4c998b['name']){delete _0x4c998b['name'];}_0x3e4002['status'](_0x2f7f7a)['send'](_0x4c998b);};}function getMustacheRender(_0x469ce4,_0x299504){return Mustache['render'](_0x469ce4,_[_0xe525('0x27')](_0x299504[_0xe525('0x28')],{'contact':_0x299504['contact'],'message':_0x299504[_0xe525('0x29')],'agent':_0x299504['agent'],'interaction':_0x299504[_0xe525('0x2a')],'account':_0x299504['account']}))||'';}exports[_0xe525('0x2b')]=function(_0x14d0a9,_0x22b99f){var _0x396f4b={},_0x47d55f={},_0x2f18aa={'count':0x0,'rows':[]};var _0x45acb8=_[_0xe525('0x2c')](db[_0xe525('0x2d')][_0xe525('0x2e')],function(_0x182080){return{'name':_0x182080['fieldName'],'type':_0x182080[_0xe525('0x2f')][_0xe525('0x30')]};});_0x47d55f['model']=_['map'](_0x45acb8,'name');_0x47d55f[_0xe525('0x31')]=_[_0xe525('0x32')](_0x14d0a9[_0xe525('0x31')]);_0x47d55f[_0xe525('0x33')]=_[_0xe525('0x34')](_0x47d55f['model'],_0x47d55f[_0xe525('0x31')]);_0x396f4b[_0xe525('0x35')]=_[_0xe525('0x34')](_0x47d55f[_0xe525('0x36')],qs['fields'](_0x14d0a9[_0xe525('0x31')][_0xe525('0x37')]));_0x396f4b[_0xe525('0x35')]=_0x396f4b[_0xe525('0x35')][_0xe525('0x38')]?_0x396f4b[_0xe525('0x35')]:_0x47d55f[_0xe525('0x36')];if(!_0x14d0a9['query'][_0xe525('0x39')]('nolimit')){_0x396f4b[_0xe525('0x1c')]=qs[_0xe525('0x1c')](_0x14d0a9[_0xe525('0x31')][_0xe525('0x1c')]);_0x396f4b[_0xe525('0x1e')]=qs['offset'](_0x14d0a9[_0xe525('0x31')][_0xe525('0x1e')]);}_0x396f4b[_0xe525('0x3a')]=qs[_0xe525('0x3b')](_0x14d0a9[_0xe525('0x31')][_0xe525('0x3b')]);_0x396f4b['where']=qs[_0xe525('0x33')](_['pick'](_0x14d0a9[_0xe525('0x31')],_0x47d55f[_0xe525('0x33')]),_0x45acb8);if(_0x14d0a9['query']['filter']){_0x396f4b[_0xe525('0x3c')]=_[_0xe525('0x27')](_0x396f4b[_0xe525('0x3c')],{'$or':_['map'](_0x45acb8,function(_0x1f2c5c){if(_0x1f2c5c[_0xe525('0x2f')]!==_0xe525('0x3d')){var _0x22efb1={};_0x22efb1[_0x1f2c5c[_0xe525('0x3e')]]={'$like':'%'+_0x14d0a9['query']['filter']+'%'};return _0x22efb1;}})});}_0x396f4b=_['merge']({},_0x396f4b,_0x14d0a9[_0xe525('0x3f')]);var _0x14ca75={'where':_0x396f4b[_0xe525('0x3c')]};return db[_0xe525('0x2d')][_0xe525('0x1d')](_0x14ca75)['then'](function(_0x245d26){_0x2f18aa['count']=_0x245d26;if(_0x14d0a9[_0xe525('0x31')][_0xe525('0x40')]){_0x396f4b['include']=[{'all':!![]}];}return db[_0xe525('0x2d')][_0xe525('0x41')](_0x396f4b);})[_0xe525('0x42')](function(_0x5a0e99){_0x2f18aa[_0xe525('0x43')]=_0x5a0e99;return _0x2f18aa;})['then'](respondWithFilteredResult(_0x22b99f,_0x396f4b))[_0xe525('0x44')](handleError(_0x22b99f,null));};exports['show']=function(_0x4cad69,_0x2d9755){var _0x465478={'raw':!![],'where':{'id':_0x4cad69['params']['id']}},_0xf2c043={};_0xf2c043[_0xe525('0x36')]=_[_0xe525('0x32')](db[_0xe525('0x2d')]['rawAttributes']);_0xf2c043[_0xe525('0x31')]=_[_0xe525('0x32')](_0x4cad69[_0xe525('0x31')]);_0xf2c043[_0xe525('0x33')]=_[_0xe525('0x34')](_0xf2c043[_0xe525('0x36')],_0xf2c043[_0xe525('0x31')]);_0x465478[_0xe525('0x35')]=_[_0xe525('0x34')](_0xf2c043[_0xe525('0x36')],qs[_0xe525('0x37')](_0x4cad69[_0xe525('0x31')][_0xe525('0x37')]));_0x465478[_0xe525('0x35')]=_0x465478[_0xe525('0x35')][_0xe525('0x38')]?_0x465478[_0xe525('0x35')]:_0xf2c043[_0xe525('0x36')];if(_0x4cad69['query'][_0xe525('0x40')]){_0x465478[_0xe525('0x45')]=[{'all':!![]}];}_0x465478=_[_0xe525('0x27')]({},_0x465478,_0x4cad69[_0xe525('0x3f')]);return db[_0xe525('0x2d')]['find'](_0x465478)[_0xe525('0x42')](handleEntityNotFound(_0x2d9755,null))[_0xe525('0x42')](respondWithResult(_0x2d9755,null))[_0xe525('0x44')](handleError(_0x2d9755,null));};exports[_0xe525('0x46')]=function(_0x3e6d79,_0x550a8d){return db[_0xe525('0x2d')][_0xe525('0x46')](_0x3e6d79[_0xe525('0x28')],{})['then'](respondWithResult(_0x550a8d,0xc9))['catch'](handleError(_0x550a8d,null));};exports[_0xe525('0x24')]=function(_0x538d42,_0x288849){if(_0x538d42['body']['id']){delete _0x538d42[_0xe525('0x28')]['id'];}return db[_0xe525('0x2d')]['find']({'where':{'id':_0x538d42[_0xe525('0x47')]['id']}})['then'](handleEntityNotFound(_0x288849,null))[_0xe525('0x42')](saveUpdates(_0x538d42[_0xe525('0x28')],null))[_0xe525('0x42')](respondWithResult(_0x288849,null))[_0xe525('0x44')](handleError(_0x288849,null));};exports['destroy']=function(_0x5b8c48,_0x24d43c){return db[_0xe525('0x2d')][_0xe525('0x48')]({'where':{'id':_0x5b8c48[_0xe525('0x47')]['id']}})['then'](handleEntityNotFound(_0x24d43c,null))[_0xe525('0x42')](removeEntity(_0x24d43c,null))[_0xe525('0x44')](handleError(_0x24d43c,null));}; \ No newline at end of file +var _0x9636=['fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','includeAll','include','findAll','rows','params','fields','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','end','stack','name','merge','contact','message','agent','interaction','account','index','SquareMessage','rawAttributes'];(function(_0x25d31d,_0x126a30){var _0x1dc8e9=function(_0x17a922){while(--_0x17a922){_0x25d31d['push'](_0x25d31d['shift']());}};_0x1dc8e9(++_0x126a30);}(_0x9636,0x10a));var _0x6963=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x9636[_0x4d07cc];return _0x42de3b;};'use strict';var emlformat=require(_0x6963('0x0'));var rimraf=require(_0x6963('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6963('0x2'));var rp=require(_0x6963('0x3'));var moment=require(_0x6963('0x4'));var BPromise=require(_0x6963('0x5'));var Mustache=require('mustache');var util=require(_0x6963('0x6'));var path=require('path');var sox=require(_0x6963('0x7'));var csv=require(_0x6963('0x8'));var ejs=require(_0x6963('0x9'));var fs=require('fs');var fs_extra=require(_0x6963('0xa'));var _=require(_0x6963('0xb'));var squel=require(_0x6963('0xc'));var crypto=require(_0x6963('0xd'));var jsforce=require(_0x6963('0xe'));var deskjs=require(_0x6963('0xf'));var toCsv=require(_0x6963('0x8'));var querystring=require(_0x6963('0x10'));var Papa=require(_0x6963('0x11'));var Redis=require(_0x6963('0x12'));var authService=require(_0x6963('0x13'));var qs=require(_0x6963('0x14'));var as=require(_0x6963('0x15'));var hardwareService=require(_0x6963('0x16'));var logger=require(_0x6963('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6963('0x18'));var db=require(_0x6963('0x19'))['db'];function respondWithStatusCode(_0x53b3de,_0x2aefdb){_0x2aefdb=_0x2aefdb||0xcc;return function(_0xcac321){if(_0xcac321){return _0x53b3de['sendStatus'](_0x2aefdb);}return _0x53b3de['status'](_0x2aefdb)['end']();};}function respondWithResult(_0x49a592,_0x3f848b){_0x3f848b=_0x3f848b||0xc8;return function(_0x44411f){if(_0x44411f){return _0x49a592[_0x6963('0x1a')](_0x3f848b)['json'](_0x44411f);}};}function respondWithFilteredResult(_0xd1aec2,_0x51f457){return function(_0x18fb9e){if(_0x18fb9e){var _0x3693db=typeof _0x51f457[_0x6963('0x1b')]===_0x6963('0x1c')&&typeof _0x51f457[_0x6963('0x1d')]==='undefined';var _0x4e5a0a=_0x18fb9e[_0x6963('0x1e')];var _0x1bdc6a=_0x3693db?0x0:_0x51f457[_0x6963('0x1b')];var _0xd7496b=_0x3693db?_0x18fb9e[_0x6963('0x1e')]:_0x51f457['offset']+_0x51f457[_0x6963('0x1d')];var _0x396c38;if(_0xd7496b>=_0x4e5a0a){_0xd7496b=_0x4e5a0a;_0x396c38=0xc8;}else{_0x396c38=0xce;}_0xd1aec2[_0x6963('0x1a')](_0x396c38);return _0xd1aec2[_0x6963('0x1f')](_0x6963('0x20'),_0x1bdc6a+'-'+_0xd7496b+'/'+_0x4e5a0a)[_0x6963('0x21')](_0x18fb9e);}return null;};}function patchUpdates(_0x735c51){return function(_0x507984){try{jsonpatch[_0x6963('0x22')](_0x507984,_0x735c51,!![]);}catch(_0x50cca3){return BPromise['reject'](_0x50cca3);}return _0x507984['save']();};}function saveUpdates(_0x5d7e74,_0x5b64f4){return function(_0x249d84){if(_0x249d84){return _0x249d84[_0x6963('0x23')](_0x5d7e74)[_0x6963('0x24')](function(_0x5d71d7){return _0x5d71d7;});}return null;};}function removeEntity(_0x28c547,_0x285d56){return function(_0x2608c8){if(_0x2608c8){return _0x2608c8[_0x6963('0x25')]()[_0x6963('0x24')](function(){_0x28c547['status'](0xcc)[_0x6963('0x26')]();});}};}function handleEntityNotFound(_0x1d8258,_0x552fa9){return function(_0xf64855){if(!_0xf64855){_0x1d8258['sendStatus'](0x194);}return _0xf64855;};}function handleError(_0xa71d70,_0x3b481b){_0x3b481b=_0x3b481b||0x1f4;return function(_0x23cd6b){logger['error'](_0x23cd6b[_0x6963('0x27')]);if(_0x23cd6b[_0x6963('0x28')]){delete _0x23cd6b['name'];}_0xa71d70[_0x6963('0x1a')](_0x3b481b)['send'](_0x23cd6b);};}function getMustacheRender(_0x4d3cf8,_0x5d7f45){return Mustache['render'](_0x4d3cf8,_[_0x6963('0x29')](_0x5d7f45['body'],{'contact':_0x5d7f45[_0x6963('0x2a')],'message':_0x5d7f45[_0x6963('0x2b')],'agent':_0x5d7f45[_0x6963('0x2c')],'interaction':_0x5d7f45[_0x6963('0x2d')],'account':_0x5d7f45[_0x6963('0x2e')]}))||'';}exports[_0x6963('0x2f')]=function(_0x537916,_0x361631){var _0x4e5ae5={},_0x2030ab={},_0x46408a={'count':0x0,'rows':[]};var _0x23bf5d=_['map'](db[_0x6963('0x30')][_0x6963('0x31')],function(_0x5ce373){return{'name':_0x5ce373[_0x6963('0x32')],'type':_0x5ce373[_0x6963('0x33')][_0x6963('0x34')]};});_0x2030ab['model']=_['map'](_0x23bf5d,_0x6963('0x28'));_0x2030ab[_0x6963('0x35')]=_[_0x6963('0x36')](_0x537916[_0x6963('0x35')]);_0x2030ab['filters']=_[_0x6963('0x37')](_0x2030ab[_0x6963('0x38')],_0x2030ab[_0x6963('0x35')]);_0x4e5ae5[_0x6963('0x39')]=_[_0x6963('0x37')](_0x2030ab['model'],qs['fields'](_0x537916[_0x6963('0x35')]['fields']));_0x4e5ae5['attributes']=_0x4e5ae5['attributes'][_0x6963('0x3a')]?_0x4e5ae5[_0x6963('0x39')]:_0x2030ab[_0x6963('0x38')];if(!_0x537916[_0x6963('0x35')][_0x6963('0x3b')](_0x6963('0x3c'))){_0x4e5ae5[_0x6963('0x1d')]=qs['limit'](_0x537916[_0x6963('0x35')][_0x6963('0x1d')]);_0x4e5ae5['offset']=qs[_0x6963('0x1b')](_0x537916[_0x6963('0x35')][_0x6963('0x1b')]);}_0x4e5ae5[_0x6963('0x3d')]=qs[_0x6963('0x3e')](_0x537916[_0x6963('0x35')][_0x6963('0x3e')]);_0x4e5ae5[_0x6963('0x3f')]=qs[_0x6963('0x40')](_[_0x6963('0x41')](_0x537916[_0x6963('0x35')],_0x2030ab[_0x6963('0x40')]),_0x23bf5d);if(_0x537916[_0x6963('0x35')][_0x6963('0x42')]){_0x4e5ae5[_0x6963('0x3f')]=_[_0x6963('0x29')](_0x4e5ae5[_0x6963('0x3f')],{'$or':_[_0x6963('0x43')](_0x23bf5d,function(_0xbb9a1a){if(_0xbb9a1a[_0x6963('0x33')]!==_0x6963('0x44')){var _0x1d3e5f={};_0x1d3e5f[_0xbb9a1a['name']]={'$like':'%'+_0x537916[_0x6963('0x35')][_0x6963('0x42')]+'%'};return _0x1d3e5f;}})});}_0x4e5ae5=_[_0x6963('0x29')]({},_0x4e5ae5,_0x537916['options']);var _0x244116={'where':_0x4e5ae5[_0x6963('0x3f')]};return db[_0x6963('0x30')][_0x6963('0x1e')](_0x244116)[_0x6963('0x24')](function(_0x2b3401){_0x46408a['count']=_0x2b3401;if(_0x537916[_0x6963('0x35')][_0x6963('0x45')]){_0x4e5ae5[_0x6963('0x46')]=[{'all':!![]}];}return db[_0x6963('0x30')][_0x6963('0x47')](_0x4e5ae5);})[_0x6963('0x24')](function(_0x54fd3e){_0x46408a[_0x6963('0x48')]=_0x54fd3e;return _0x46408a;})['then'](respondWithFilteredResult(_0x361631,_0x4e5ae5))['catch'](handleError(_0x361631,null));};exports['show']=function(_0x2de716,_0x13442c){var _0x32243c={'raw':!![],'where':{'id':_0x2de716[_0x6963('0x49')]['id']}},_0x15b022={};_0x15b022[_0x6963('0x38')]=_['keys'](db[_0x6963('0x30')][_0x6963('0x31')]);_0x15b022[_0x6963('0x35')]=_['keys'](_0x2de716[_0x6963('0x35')]);_0x15b022[_0x6963('0x40')]=_['intersection'](_0x15b022[_0x6963('0x38')],_0x15b022[_0x6963('0x35')]);_0x32243c[_0x6963('0x39')]=_['intersection'](_0x15b022[_0x6963('0x38')],qs[_0x6963('0x4a')](_0x2de716['query'][_0x6963('0x4a')]));_0x32243c[_0x6963('0x39')]=_0x32243c[_0x6963('0x39')][_0x6963('0x3a')]?_0x32243c[_0x6963('0x39')]:_0x15b022['model'];if(_0x2de716[_0x6963('0x35')][_0x6963('0x45')]){_0x32243c['include']=[{'all':!![]}];}_0x32243c=_[_0x6963('0x29')]({},_0x32243c,_0x2de716[_0x6963('0x4b')]);return db[_0x6963('0x30')][_0x6963('0x4c')](_0x32243c)[_0x6963('0x24')](handleEntityNotFound(_0x13442c,null))['then'](respondWithResult(_0x13442c,null))[_0x6963('0x4d')](handleError(_0x13442c,null));};exports['create']=function(_0x232b22,_0x586939){return db[_0x6963('0x30')]['create'](_0x232b22['body'],{})[_0x6963('0x24')](respondWithResult(_0x586939,0xc9))[_0x6963('0x4d')](handleError(_0x586939,null));};exports[_0x6963('0x23')]=function(_0x24d9dd,_0x2ae499){if(_0x24d9dd['body']['id']){delete _0x24d9dd['body']['id'];}return db[_0x6963('0x30')][_0x6963('0x4c')]({'where':{'id':_0x24d9dd[_0x6963('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ae499,null))[_0x6963('0x24')](saveUpdates(_0x24d9dd[_0x6963('0x4e')],null))['then'](respondWithResult(_0x2ae499,null))[_0x6963('0x4d')](handleError(_0x2ae499,null));};exports[_0x6963('0x25')]=function(_0x3b515e,_0x53e9b8){return db[_0x6963('0x30')][_0x6963('0x4c')]({'where':{'id':_0x3b515e['params']['id']}})['then'](handleEntityNotFound(_0x53e9b8,null))[_0x6963('0x24')](removeEntity(_0x53e9b8,null))['catch'](handleError(_0x53e9b8,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f8be848..9cea799 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa381=['moment','request-promise','path','exports','square_messages','lodash','util'];(function(_0x3d9470,_0xa1df9f){var _0x125997=function(_0x24dd5a){while(--_0x24dd5a){_0x3d9470['push'](_0x3d9470['shift']());}};_0x125997(++_0xa1df9f);}(_0xa381,0xde));var _0x1a38=function(_0x7ec229,_0x45291f){_0x7ec229=_0x7ec229-0x0;var _0x332ac1=_0xa381[_0x7ec229];return _0x332ac1;};'use strict';var _=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1a38('0x2'));var BPromise=require('bluebird');var rp=require(_0x1a38('0x3'));var fs=require('fs');var path=require(_0x1a38('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x1a38('0x5')]=function(_0x3da959,_0x13050f){return _0x3da959['define']('SquareMessage',attributes,{'tableName':_0x1a38('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d88=['../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x2fc679,_0xf4b7bc){var _0x1cd1bc=function(_0xdc78fb){while(--_0xdc78fb){_0x2fc679['push'](_0x2fc679['shift']());}};_0x1cd1bc(++_0xf4b7bc);}(_0x4d88,0x19e));var _0x84d8=function(_0x5e46d7,_0xd36bbb){_0x5e46d7=_0x5e46d7-0x0;var _0xce1f6d=_0x4d88[_0x5e46d7];return _0xce1f6d;};'use strict';var _=require(_0x84d8('0x0'));var util=require(_0x84d8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x84d8('0x2'));var rp=require(_0x84d8('0x3'));var fs=require('fs');var path=require(_0x84d8('0x4'));var rimraf=require(_0x84d8('0x5'));var config=require(_0x84d8('0x6'));var attributes=require(_0x84d8('0x7'));module['exports']=function(_0x3cdba2,_0x51cc3d){return _0x3cdba2['define'](_0x84d8('0x8'),attributes,{'tableName':_0x84d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 8acfa09..f25f989 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x169f86,_0x37fabc){var _0x3e5025=function(_0x55fd45){while(--_0x55fd45){_0x169f86['push'](_0x169f86['shift']());}};_0x3e5025(++_0x37fabc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x3270b1,_0x3f8e1c){var _0x271160=function(_0x54131d){while(--_0x54131d){_0x3270b1['push'](_0x3270b1['shift']());}};_0x271160(++_0x3f8e1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a464a87..f7d7d7b 100644 --- a/server/api/squareOdbc/index.js +++ b/server/api/squareOdbc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2b3=['isAuthenticated','index','/:id','show','/:id/test','15s','test','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get'];(function(_0x476559,_0x546831){var _0x37376f=function(_0x129628){while(--_0x129628){_0x476559['push'](_0x476559['shift']());}};_0x37376f(++_0x546831);}(_0xd2b3,0xfb));var _0x3d2b=function(_0x4cb086,_0x4cc048){_0x4cb086=_0x4cb086-0x0;var _0x10d1af=_0xd2b3[_0x4cb086];return _0x10d1af;};'use strict';var multer=require(_0x3d2b('0x0'));var util=require(_0x3d2b('0x1'));var path=require(_0x3d2b('0x2'));var timeout=require(_0x3d2b('0x3'));var express=require(_0x3d2b('0x4'));var router=express[_0x3d2b('0x5')]();var fs_extra=require(_0x3d2b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3d2b('0x7'));var controller=require('./squareOdbc.controller');router[_0x3d2b('0x8')]('/',auth[_0x3d2b('0x9')](),controller[_0x3d2b('0xa')]);router['get'](_0x3d2b('0xb'),auth[_0x3d2b('0x9')](),controller[_0x3d2b('0xc')]);router[_0x3d2b('0x8')](_0x3d2b('0xd'),auth[_0x3d2b('0x9')](),timeout(_0x3d2b('0xe')),controller[_0x3d2b('0xf')]);router[_0x3d2b('0x10')]('/',auth[_0x3d2b('0x9')](),controller['create']);router['put'](_0x3d2b('0xb'),auth['isAuthenticated'](),controller[_0x3d2b('0x11')]);router['delete']('/:id',auth[_0x3d2b('0x9')](),controller[_0x3d2b('0x12')]);module[_0x3d2b('0x13')]=router; \ No newline at end of file +var _0x4e37=['create','put','update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/test','15s','test'];(function(_0x26d2d9,_0x37862a){var _0x2d420a=function(_0x75d390){while(--_0x75d390){_0x26d2d9['push'](_0x26d2d9['shift']());}};_0x2d420a(++_0x37862a);}(_0x4e37,0x148));var _0x74e3=function(_0x518b99,_0x4333e4){_0x518b99=_0x518b99-0x0;var _0x45faed=_0x4e37[_0x518b99];return _0x45faed;};'use strict';var multer=require(_0x74e3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74e3('0x1'));var router=express[_0x74e3('0x2')]();var fs_extra=require(_0x74e3('0x3'));var auth=require(_0x74e3('0x4'));var interaction=require(_0x74e3('0x5'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router['get']('/',auth[_0x74e3('0x6')](),controller[_0x74e3('0x7')]);router[_0x74e3('0x8')](_0x74e3('0x9'),auth[_0x74e3('0x6')](),controller[_0x74e3('0xa')]);router['get'](_0x74e3('0xb'),auth['isAuthenticated'](),timeout(_0x74e3('0xc')),controller[_0x74e3('0xd')]);router['post']('/',auth[_0x74e3('0x6')](),controller[_0x74e3('0xe')]);router[_0x74e3('0xf')](_0x74e3('0x9'),auth['isAuthenticated'](),controller[_0x74e3('0x10')]);router[_0x74e3('0x11')]('/:id',auth[_0x74e3('0x6')](),controller['destroy']);module[_0x74e3('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 4ee14d8..888a573 100644 --- a/server/api/squareOdbc/squareOdbc.attributes.js +++ b/server/api/squareOdbc/squareOdbc.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e78=['sequelize','name','STRING'];(function(_0x4f3614,_0x28bc98){var _0x1219aa=function(_0x185faf){while(--_0x185faf){_0x4f3614['push'](_0x4f3614['shift']());}};_0x1219aa(++_0x28bc98);}(_0x4e78,0x6c));var _0x84e7=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x4e78[_0x4b12ae];return _0x16957b;};'use strict';var Sequelize=require(_0x84e7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x84e7('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x84e7('0x2')]},'description':{'type':Sequelize[_0x84e7('0x2')]}}; \ No newline at end of file +var _0x2da8=['STRING','name','sequelize'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x2da8,0x12e));var _0x82da=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2da8[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x82da('0x0'));module['exports']={'name':{'type':Sequelize[_0x82da('0x1')],'unique':_0x82da('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x82da('0x1')]},'description':{'type':Sequelize[_0x82da('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 16104d4..ba76810 100644 --- a/server/api/squareOdbc/squareOdbc.controller.js +++ b/server/api/squareOdbc/squareOdbc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4aa3=['order','sort','where','filter','type','VIRTUAL','options','includeAll','include','show','params','keys','length','find','catch','create','user','role','UserProfileSection','userProfileId','update','openSync','dsn','closeSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','account','index','SquareOdbc','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','nolimit'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x4aa3,0x174));var _0x34aa=function(_0x51c8f3,_0x1d8eef){_0x51c8f3=_0x51c8f3-0x0;var _0x2b3176=_0x4aa3[_0x51c8f3];return _0x2b3176;};'use strict';var emlformat=require(_0x34aa('0x0'));var rimraf=require(_0x34aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34aa('0x2'));var rp=require(_0x34aa('0x3'));var moment=require('moment');var BPromise=require(_0x34aa('0x4'));var Mustache=require(_0x34aa('0x5'));var util=require('util');var path=require(_0x34aa('0x6'));var sox=require(_0x34aa('0x7'));var csv=require(_0x34aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34aa('0x9'));var _=require(_0x34aa('0xa'));var squel=require('squel');var crypto=require(_0x34aa('0xb'));var jsforce=require(_0x34aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x34aa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x34aa('0xd'));var authService=require(_0x34aa('0xe'));var qs=require(_0x34aa('0xf'));var as=require(_0x34aa('0x10'));var hardwareService=require(_0x34aa('0x11'));var logger=require(_0x34aa('0x12'))('api');var utils=require(_0x34aa('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34aa('0x14'))['db'];function respondWithStatusCode(_0x1803a6,_0x35b673){_0x35b673=_0x35b673||0xcc;return function(_0x4818bd){if(_0x4818bd){return _0x1803a6[_0x34aa('0x15')](_0x35b673);}return _0x1803a6['status'](_0x35b673)[_0x34aa('0x16')]();};}function respondWithResult(_0x109378,_0x228433){_0x228433=_0x228433||0xc8;return function(_0x3a6819){if(_0x3a6819){return _0x109378[_0x34aa('0x17')](_0x228433)['json'](_0x3a6819);}};}function respondWithFilteredResult(_0x3dc282,_0xa25b37){return function(_0x353a02){if(_0x353a02){var _0x1ab220=typeof _0xa25b37[_0x34aa('0x18')]===_0x34aa('0x19')&&typeof _0xa25b37[_0x34aa('0x1a')]===_0x34aa('0x19');var _0x2663ea=_0x353a02[_0x34aa('0x1b')];var _0x317054=_0x1ab220?0x0:_0xa25b37[_0x34aa('0x18')];var _0xd0bf04=_0x1ab220?_0x353a02[_0x34aa('0x1b')]:_0xa25b37[_0x34aa('0x18')]+_0xa25b37[_0x34aa('0x1a')];var _0x4416e1;if(_0xd0bf04>=_0x2663ea){_0xd0bf04=_0x2663ea;_0x4416e1=0xc8;}else{_0x4416e1=0xce;}_0x3dc282[_0x34aa('0x17')](_0x4416e1);return _0x3dc282[_0x34aa('0x1c')](_0x34aa('0x1d'),_0x317054+'-'+_0xd0bf04+'/'+_0x2663ea)[_0x34aa('0x1e')](_0x353a02);}return null;};}function patchUpdates(_0x17a10d){return function(_0x329a6b){try{jsonpatch[_0x34aa('0x1f')](_0x329a6b,_0x17a10d,!![]);}catch(_0x100310){return BPromise[_0x34aa('0x20')](_0x100310);}return _0x329a6b[_0x34aa('0x21')]();};}function saveUpdates(_0x5deb88,_0x37a332){return function(_0x3e78b9){if(_0x3e78b9){return _0x3e78b9['update'](_0x5deb88)[_0x34aa('0x22')](function(_0x812884){return _0x812884;});}return null;};}function removeEntity(_0x1e2b40,_0x32643b){return function(_0x1ff3c3){if(_0x1ff3c3){return _0x1ff3c3[_0x34aa('0x23')]()['then'](function(){var _0x12a468=_0x1ff3c3[_0x34aa('0x24')]({'plain':!![]});var _0x48bb85=_0x34aa('0x25');return db[_0x34aa('0x26')][_0x34aa('0x23')]({'where':{'type':_0x48bb85,'resourceId':_0x12a468['id']}})[_0x34aa('0x22')](function(){return _0x1ff3c3;});})[_0x34aa('0x22')](function(){_0x1e2b40[_0x34aa('0x17')](0xcc)[_0x34aa('0x16')]();});}};}function handleEntityNotFound(_0x15e1f8,_0x58d40c){return function(_0x3e8f8e){if(!_0x3e8f8e){_0x15e1f8[_0x34aa('0x15')](0x194);}return _0x3e8f8e;};}function handleError(_0xc920c7,_0x55351d){_0x55351d=_0x55351d||0x1f4;return function(_0x2c4b82){logger[_0x34aa('0x27')](_0x2c4b82[_0x34aa('0x28')]);if(_0x2c4b82[_0x34aa('0x29')]){delete _0x2c4b82[_0x34aa('0x29')];}_0xc920c7[_0x34aa('0x17')](_0x55351d)[_0x34aa('0x2a')](_0x2c4b82);};}function getMustacheRender(_0x43faaa,_0x2fdd7e){return Mustache[_0x34aa('0x2b')](_0x43faaa,_[_0x34aa('0x2c')](_0x2fdd7e[_0x34aa('0x2d')],{'contact':_0x2fdd7e[_0x34aa('0x2e')],'message':_0x2fdd7e[_0x34aa('0x2f')],'agent':_0x2fdd7e[_0x34aa('0x30')],'interaction':_0x2fdd7e['interaction'],'account':_0x2fdd7e[_0x34aa('0x31')]}))||'';}exports[_0x34aa('0x32')]=function(_0x3ce8ae,_0x3f96a2){var _0x261711={},_0x324e6c={},_0x2b116e={'count':0x0,'rows':[]};var _0x4f1354=_['map'](db[_0x34aa('0x33')][_0x34aa('0x34')],function(_0x3cb4cd){return{'name':_0x3cb4cd[_0x34aa('0x35')],'type':_0x3cb4cd['type'][_0x34aa('0x36')]};});_0x324e6c[_0x34aa('0x37')]=_[_0x34aa('0x38')](_0x4f1354,_0x34aa('0x29'));_0x324e6c[_0x34aa('0x39')]=_['keys'](_0x3ce8ae[_0x34aa('0x39')]);_0x324e6c[_0x34aa('0x3a')]=_[_0x34aa('0x3b')](_0x324e6c[_0x34aa('0x37')],_0x324e6c[_0x34aa('0x39')]);_0x261711[_0x34aa('0x3c')]=_[_0x34aa('0x3b')](_0x324e6c[_0x34aa('0x37')],qs['fields'](_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x3d')]));_0x261711[_0x34aa('0x3c')]=_0x261711['attributes']['length']?_0x261711['attributes']:_0x324e6c[_0x34aa('0x37')];if(!_0x3ce8ae[_0x34aa('0x39')]['hasOwnProperty'](_0x34aa('0x3e'))){_0x261711[_0x34aa('0x1a')]=qs['limit'](_0x3ce8ae[_0x34aa('0x39')]['limit']);_0x261711[_0x34aa('0x18')]=qs[_0x34aa('0x18')](_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x18')]);}_0x261711[_0x34aa('0x3f')]=qs[_0x34aa('0x40')](_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x40')]);_0x261711[_0x34aa('0x41')]=qs[_0x34aa('0x3a')](_['pick'](_0x3ce8ae[_0x34aa('0x39')],_0x324e6c[_0x34aa('0x3a')]),_0x4f1354);if(_0x3ce8ae['query'][_0x34aa('0x42')]){_0x261711['where']=_[_0x34aa('0x2c')](_0x261711['where'],{'$or':_[_0x34aa('0x38')](_0x4f1354,function(_0xef225d){if(_0xef225d[_0x34aa('0x43')]!==_0x34aa('0x44')){var _0x173805={};_0x173805[_0xef225d[_0x34aa('0x29')]]={'$like':'%'+_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x42')]+'%'};return _0x173805;}})});}_0x261711=_[_0x34aa('0x2c')]({},_0x261711,_0x3ce8ae[_0x34aa('0x45')]);var _0x2b431f={'where':_0x261711['where']};return db[_0x34aa('0x33')][_0x34aa('0x1b')](_0x2b431f)['then'](function(_0x13a112){_0x2b116e[_0x34aa('0x1b')]=_0x13a112;if(_0x3ce8ae[_0x34aa('0x39')][_0x34aa('0x46')]){_0x261711[_0x34aa('0x47')]=[{'all':!![]}];}return db[_0x34aa('0x33')]['findAll'](_0x261711);})[_0x34aa('0x22')](function(_0x3d176e){_0x2b116e['rows']=_0x3d176e;return _0x2b116e;})['then'](respondWithFilteredResult(_0x3f96a2,_0x261711))['catch'](handleError(_0x3f96a2,null));};exports[_0x34aa('0x48')]=function(_0x3fcf87,_0x37b21f){var _0x450381={'raw':!![],'where':{'id':_0x3fcf87[_0x34aa('0x49')]['id']}},_0x38273a={};_0x38273a['model']=_[_0x34aa('0x4a')](db[_0x34aa('0x33')][_0x34aa('0x34')]);_0x38273a['query']=_[_0x34aa('0x4a')](_0x3fcf87['query']);_0x38273a['filters']=_[_0x34aa('0x3b')](_0x38273a[_0x34aa('0x37')],_0x38273a[_0x34aa('0x39')]);_0x450381[_0x34aa('0x3c')]=_[_0x34aa('0x3b')](_0x38273a[_0x34aa('0x37')],qs[_0x34aa('0x3d')](_0x3fcf87['query'][_0x34aa('0x3d')]));_0x450381[_0x34aa('0x3c')]=_0x450381[_0x34aa('0x3c')][_0x34aa('0x4b')]?_0x450381[_0x34aa('0x3c')]:_0x38273a[_0x34aa('0x37')];if(_0x3fcf87[_0x34aa('0x39')][_0x34aa('0x46')]){_0x450381[_0x34aa('0x47')]=[{'all':!![]}];}_0x450381=_[_0x34aa('0x2c')]({},_0x450381,_0x3fcf87[_0x34aa('0x45')]);return db['SquareOdbc'][_0x34aa('0x4c')](_0x450381)['then'](handleEntityNotFound(_0x37b21f,null))['then'](respondWithResult(_0x37b21f,null))[_0x34aa('0x4d')](handleError(_0x37b21f,null));};exports['create']=function(_0x150249,_0x16ba7d){return db[_0x34aa('0x33')][_0x34aa('0x4e')](_0x150249['body'],{})['then'](function(_0x3ac9ff){var _0x2dcfb2=_0x150249[_0x34aa('0x4f')][_0x34aa('0x24')]({'plain':!![]});if(!_0x2dcfb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dcfb2[_0x34aa('0x50')]===_0x34aa('0x4f')){var _0x563170=_0x3ac9ff[_0x34aa('0x24')]({'plain':!![]});var _0x57350c=_0x34aa('0x25');return db[_0x34aa('0x51')][_0x34aa('0x4c')]({'where':{'name':_0x57350c,'userProfileId':_0x2dcfb2[_0x34aa('0x52')]},'raw':!![]})['then'](function(_0x27d6db){if(_0x27d6db&&_0x27d6db['autoAssociation']===0x0){return db[_0x34aa('0x26')][_0x34aa('0x4e')]({'name':_0x563170[_0x34aa('0x29')],'resourceId':_0x563170['id'],'type':_0x27d6db['name'],'sectionId':_0x27d6db['id']},{})[_0x34aa('0x22')](function(){return _0x3ac9ff;});}else{return _0x3ac9ff;}})['catch'](function(_0x48db37){logger[_0x34aa('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48db37);throw _0x48db37;});}return _0x3ac9ff;})[_0x34aa('0x22')](respondWithResult(_0x16ba7d,0xc9))[_0x34aa('0x4d')](handleError(_0x16ba7d,null));};exports[_0x34aa('0x53')]=function(_0x24f5f6,_0x3a9097){if(_0x24f5f6[_0x34aa('0x2d')]['id']){delete _0x24f5f6['body']['id'];}return db[_0x34aa('0x33')][_0x34aa('0x4c')]({'where':{'id':_0x24f5f6['params']['id']}})[_0x34aa('0x22')](handleEntityNotFound(_0x3a9097,null))[_0x34aa('0x22')](saveUpdates(_0x24f5f6[_0x34aa('0x2d')],null))[_0x34aa('0x22')](respondWithResult(_0x3a9097,null))[_0x34aa('0x4d')](handleError(_0x3a9097,null));};exports[_0x34aa('0x23')]=function(_0x549216,_0x276de3){return db[_0x34aa('0x33')][_0x34aa('0x4c')]({'where':{'id':_0x549216[_0x34aa('0x49')]['id']}})['then'](handleEntityNotFound(_0x276de3,null))[_0x34aa('0x22')](removeEntity(_0x276de3,null))[_0x34aa('0x4d')](handleError(_0x276de3,null));};exports['test']=function(_0xf6af27,_0x7a9a27,_0x2c180b){var _0x134bef;return db[_0x34aa('0x33')][_0x34aa('0x4c')]({'where':{'id':_0xf6af27[_0x34aa('0x49')]['id']},'attributes':['id','dsn']})[_0x34aa('0x22')](handleEntityNotFound(_0x7a9a27,null))[_0x34aa('0x22')](function(_0xc69dbc){if(_0xc69dbc){var _0x15e1d9=require('odbc')();_0x15e1d9[_0x34aa('0x54')](_0xc69dbc[_0x34aa('0x55')]);_0x15e1d9[_0x34aa('0x56')]();return _0xc69dbc;}})['then'](respondWithResult(_0x7a9a27,null))[_0x34aa('0x4d')](handleError(_0x7a9a27,null));}; \ No newline at end of file +var _0x9ca0=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','name','send','merge','body','agent','interaction','account','index','map','SquareOdbc','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find'];(function(_0x78af8b,_0x2eeb03){var _0x58edc6=function(_0x298bf4){while(--_0x298bf4){_0x78af8b['push'](_0x78af8b['shift']());}};_0x58edc6(++_0x2eeb03);}(_0x9ca0,0x65));var _0x09ca=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x9ca0[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x09ca('0x0'));var rimraf=require(_0x09ca('0x1'));var zipdir=require(_0x09ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09ca('0x3'));var moment=require(_0x09ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09ca('0x5'));var util=require(_0x09ca('0x6'));var path=require('path');var sox=require(_0x09ca('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09ca('0x8'));var _=require(_0x09ca('0x9'));var squel=require(_0x09ca('0xa'));var crypto=require(_0x09ca('0xb'));var jsforce=require(_0x09ca('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x09ca('0xd'));var Papa=require(_0x09ca('0xe'));var Redis=require('ioredis');var authService=require(_0x09ca('0xf'));var qs=require(_0x09ca('0x10'));var as=require(_0x09ca('0x11'));var hardwareService=require(_0x09ca('0x12'));var logger=require(_0x09ca('0x13'))(_0x09ca('0x14'));var utils=require('../../config/utils');var config=require(_0x09ca('0x15'));var licenseUtil=require(_0x09ca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16e164,_0x5e47fa){_0x5e47fa=_0x5e47fa||0xcc;return function(_0x1ad33f){if(_0x1ad33f){return _0x16e164[_0x09ca('0x17')](_0x5e47fa);}return _0x16e164[_0x09ca('0x18')](_0x5e47fa)['end']();};}function respondWithResult(_0x57eda0,_0xc23339){_0xc23339=_0xc23339||0xc8;return function(_0x2fa47e){if(_0x2fa47e){return _0x57eda0['status'](_0xc23339)[_0x09ca('0x19')](_0x2fa47e);}};}function respondWithFilteredResult(_0xdb0c26,_0x32eb55){return function(_0x29621d){if(_0x29621d){var _0xb387a5=typeof _0x32eb55[_0x09ca('0x1a')]===_0x09ca('0x1b')&&typeof _0x32eb55[_0x09ca('0x1c')]===_0x09ca('0x1b');var _0x330b88=_0x29621d[_0x09ca('0x1d')];var _0x3d8f28=_0xb387a5?0x0:_0x32eb55['offset'];var _0x62be0c=_0xb387a5?_0x29621d[_0x09ca('0x1d')]:_0x32eb55[_0x09ca('0x1a')]+_0x32eb55[_0x09ca('0x1c')];var _0x206fdb;if(_0x62be0c>=_0x330b88){_0x62be0c=_0x330b88;_0x206fdb=0xc8;}else{_0x206fdb=0xce;}_0xdb0c26[_0x09ca('0x18')](_0x206fdb);return _0xdb0c26[_0x09ca('0x1e')](_0x09ca('0x1f'),_0x3d8f28+'-'+_0x62be0c+'/'+_0x330b88)['json'](_0x29621d);}return null;};}function patchUpdates(_0x26c2c3){return function(_0xfe4fea){try{jsonpatch[_0x09ca('0x20')](_0xfe4fea,_0x26c2c3,!![]);}catch(_0x53a36b){return BPromise[_0x09ca('0x21')](_0x53a36b);}return _0xfe4fea[_0x09ca('0x22')]();};}function saveUpdates(_0xacdffd,_0x25b2d9){return function(_0x48ec36){if(_0x48ec36){return _0x48ec36[_0x09ca('0x23')](_0xacdffd)[_0x09ca('0x24')](function(_0x3115d0){return _0x3115d0;});}return null;};}function removeEntity(_0x37288a,_0x44f036){return function(_0x234fcd){if(_0x234fcd){return _0x234fcd[_0x09ca('0x25')]()['then'](function(){var _0x2558a3=_0x234fcd[_0x09ca('0x26')]({'plain':!![]});var _0x459822=_0x09ca('0x27');return db[_0x09ca('0x28')][_0x09ca('0x25')]({'where':{'type':_0x459822,'resourceId':_0x2558a3['id']}})[_0x09ca('0x24')](function(){return _0x234fcd;});})[_0x09ca('0x24')](function(){_0x37288a['status'](0xcc)[_0x09ca('0x29')]();});}};}function handleEntityNotFound(_0x2a26c4,_0x864eda){return function(_0x4b3da5){if(!_0x4b3da5){_0x2a26c4['sendStatus'](0x194);}return _0x4b3da5;};}function handleError(_0x274857,_0xeca4b9){_0xeca4b9=_0xeca4b9||0x1f4;return function(_0x163cee){logger[_0x09ca('0x2a')](_0x163cee['stack']);if(_0x163cee[_0x09ca('0x2b')]){delete _0x163cee['name'];}_0x274857[_0x09ca('0x18')](_0xeca4b9)[_0x09ca('0x2c')](_0x163cee);};}function getMustacheRender(_0x437257,_0x4cc78c){return Mustache['render'](_0x437257,_[_0x09ca('0x2d')](_0x4cc78c[_0x09ca('0x2e')],{'contact':_0x4cc78c['contact'],'message':_0x4cc78c['message'],'agent':_0x4cc78c[_0x09ca('0x2f')],'interaction':_0x4cc78c[_0x09ca('0x30')],'account':_0x4cc78c[_0x09ca('0x31')]}))||'';}exports[_0x09ca('0x32')]=function(_0x26dda2,_0x2225d6){var _0x5cc51b={},_0xbeec46={},_0x51049a={'count':0x0,'rows':[]};var _0x20de16=_[_0x09ca('0x33')](db[_0x09ca('0x34')]['rawAttributes'],function(_0xa5a8a2){return{'name':_0xa5a8a2['fieldName'],'type':_0xa5a8a2[_0x09ca('0x35')]['key']};});_0xbeec46[_0x09ca('0x36')]=_[_0x09ca('0x33')](_0x20de16,'name');_0xbeec46[_0x09ca('0x37')]=_[_0x09ca('0x38')](_0x26dda2[_0x09ca('0x37')]);_0xbeec46['filters']=_[_0x09ca('0x39')](_0xbeec46[_0x09ca('0x36')],_0xbeec46[_0x09ca('0x37')]);_0x5cc51b[_0x09ca('0x3a')]=_['intersection'](_0xbeec46[_0x09ca('0x36')],qs[_0x09ca('0x3b')](_0x26dda2[_0x09ca('0x37')][_0x09ca('0x3b')]));_0x5cc51b['attributes']=_0x5cc51b[_0x09ca('0x3a')]['length']?_0x5cc51b['attributes']:_0xbeec46[_0x09ca('0x36')];if(!_0x26dda2['query'][_0x09ca('0x3c')](_0x09ca('0x3d'))){_0x5cc51b[_0x09ca('0x1c')]=qs[_0x09ca('0x1c')](_0x26dda2['query'][_0x09ca('0x1c')]);_0x5cc51b['offset']=qs['offset'](_0x26dda2[_0x09ca('0x37')][_0x09ca('0x1a')]);}_0x5cc51b['order']=qs[_0x09ca('0x3e')](_0x26dda2[_0x09ca('0x37')]['sort']);_0x5cc51b[_0x09ca('0x3f')]=qs[_0x09ca('0x40')](_['pick'](_0x26dda2[_0x09ca('0x37')],_0xbeec46[_0x09ca('0x40')]),_0x20de16);if(_0x26dda2[_0x09ca('0x37')][_0x09ca('0x41')]){_0x5cc51b[_0x09ca('0x3f')]=_[_0x09ca('0x2d')](_0x5cc51b[_0x09ca('0x3f')],{'$or':_[_0x09ca('0x33')](_0x20de16,function(_0x5f40dc){if(_0x5f40dc[_0x09ca('0x35')]!==_0x09ca('0x42')){var _0x42b354={};_0x42b354[_0x5f40dc[_0x09ca('0x2b')]]={'$like':'%'+_0x26dda2[_0x09ca('0x37')][_0x09ca('0x41')]+'%'};return _0x42b354;}})});}_0x5cc51b=_[_0x09ca('0x2d')]({},_0x5cc51b,_0x26dda2['options']);var _0x145ca1={'where':_0x5cc51b['where']};return db[_0x09ca('0x34')]['count'](_0x145ca1)[_0x09ca('0x24')](function(_0x45ecb3){_0x51049a[_0x09ca('0x1d')]=_0x45ecb3;if(_0x26dda2[_0x09ca('0x37')][_0x09ca('0x43')]){_0x5cc51b[_0x09ca('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0x09ca('0x45')](_0x5cc51b);})[_0x09ca('0x24')](function(_0x1574e8){_0x51049a[_0x09ca('0x46')]=_0x1574e8;return _0x51049a;})[_0x09ca('0x24')](respondWithFilteredResult(_0x2225d6,_0x5cc51b))[_0x09ca('0x47')](handleError(_0x2225d6,null));};exports[_0x09ca('0x48')]=function(_0x3c13d3,_0x53d07c){var _0x2da825={'raw':!![],'where':{'id':_0x3c13d3[_0x09ca('0x49')]['id']}},_0x123945={};_0x123945[_0x09ca('0x36')]=_[_0x09ca('0x38')](db[_0x09ca('0x34')]['rawAttributes']);_0x123945[_0x09ca('0x37')]=_['keys'](_0x3c13d3[_0x09ca('0x37')]);_0x123945[_0x09ca('0x40')]=_[_0x09ca('0x39')](_0x123945[_0x09ca('0x36')],_0x123945[_0x09ca('0x37')]);_0x2da825[_0x09ca('0x3a')]=_[_0x09ca('0x39')](_0x123945[_0x09ca('0x36')],qs[_0x09ca('0x3b')](_0x3c13d3['query'][_0x09ca('0x3b')]));_0x2da825[_0x09ca('0x3a')]=_0x2da825[_0x09ca('0x3a')][_0x09ca('0x4a')]?_0x2da825[_0x09ca('0x3a')]:_0x123945[_0x09ca('0x36')];if(_0x3c13d3['query'][_0x09ca('0x43')]){_0x2da825[_0x09ca('0x44')]=[{'all':!![]}];}_0x2da825=_[_0x09ca('0x2d')]({},_0x2da825,_0x3c13d3[_0x09ca('0x4b')]);return db[_0x09ca('0x34')][_0x09ca('0x4c')](_0x2da825)[_0x09ca('0x24')](handleEntityNotFound(_0x53d07c,null))[_0x09ca('0x24')](respondWithResult(_0x53d07c,null))[_0x09ca('0x47')](handleError(_0x53d07c,null));};exports[_0x09ca('0x4d')]=function(_0x311fc1,_0x1bfeae){return db['SquareOdbc'][_0x09ca('0x4d')](_0x311fc1[_0x09ca('0x2e')],{})['then'](function(_0x217775){var _0x5c041f=_0x311fc1[_0x09ca('0x4e')][_0x09ca('0x26')]({'plain':!![]});if(!_0x5c041f)throw new Error(_0x09ca('0x4f'));if(_0x5c041f[_0x09ca('0x50')]===_0x09ca('0x4e')){var _0x555fbf=_0x217775[_0x09ca('0x26')]({'plain':!![]});var _0x37cbf4=_0x09ca('0x27');return db[_0x09ca('0x51')][_0x09ca('0x4c')]({'where':{'name':_0x37cbf4,'userProfileId':_0x5c041f[_0x09ca('0x52')]},'raw':!![]})[_0x09ca('0x24')](function(_0x23c8a4){if(_0x23c8a4&&_0x23c8a4[_0x09ca('0x53')]===0x0){return db[_0x09ca('0x28')]['create']({'name':_0x555fbf[_0x09ca('0x2b')],'resourceId':_0x555fbf['id'],'type':_0x23c8a4[_0x09ca('0x2b')],'sectionId':_0x23c8a4['id']},{})['then'](function(){return _0x217775;});}else{return _0x217775;}})[_0x09ca('0x47')](function(_0x5a0460){logger[_0x09ca('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a0460);throw _0x5a0460;});}return _0x217775;})[_0x09ca('0x24')](respondWithResult(_0x1bfeae,0xc9))['catch'](handleError(_0x1bfeae,null));};exports[_0x09ca('0x23')]=function(_0x1e6bf3,_0x1bc0cd){if(_0x1e6bf3[_0x09ca('0x2e')]['id']){delete _0x1e6bf3[_0x09ca('0x2e')]['id'];}return db[_0x09ca('0x34')][_0x09ca('0x4c')]({'where':{'id':_0x1e6bf3['params']['id']}})[_0x09ca('0x24')](handleEntityNotFound(_0x1bc0cd,null))['then'](saveUpdates(_0x1e6bf3[_0x09ca('0x2e')],null))['then'](respondWithResult(_0x1bc0cd,null))[_0x09ca('0x47')](handleError(_0x1bc0cd,null));};exports[_0x09ca('0x25')]=function(_0x4a4918,_0x34a27f){return db[_0x09ca('0x34')][_0x09ca('0x4c')]({'where':{'id':_0x4a4918[_0x09ca('0x49')]['id']}})[_0x09ca('0x24')](handleEntityNotFound(_0x34a27f,null))[_0x09ca('0x24')](removeEntity(_0x34a27f,null))[_0x09ca('0x47')](handleError(_0x34a27f,null));};exports[_0x09ca('0x54')]=function(_0x2b21bf,_0x309898,_0x9f1418){var _0x1c5965;return db[_0x09ca('0x34')][_0x09ca('0x4c')]({'where':{'id':_0x2b21bf[_0x09ca('0x49')]['id']},'attributes':['id',_0x09ca('0x55')]})[_0x09ca('0x24')](handleEntityNotFound(_0x309898,null))[_0x09ca('0x24')](function(_0x17c69e){if(_0x17c69e){var _0x24a680=require(_0x09ca('0x56'))();_0x24a680[_0x09ca('0x57')](_0x17c69e['dsn']);_0x24a680[_0x09ca('0x58')]();return _0x17c69e;}})['then'](respondWithResult(_0x309898,null))[_0x09ca('0x47')](handleError(_0x309898,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 6a71434..46ecb3d 100644 --- a/server/api/squareOdbc/squareOdbc.model.js +++ b/server/api/squareOdbc/squareOdbc.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x546b=['../../config/environment','./squareOdbc.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x546b,0x17a));var _0xb546=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x546b[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xb546('0x0'));var util=require('util');var logger=require(_0xb546('0x1'))(_0xb546('0x2'));var moment=require(_0xb546('0x3'));var BPromise=require('bluebird');var rp=require(_0xb546('0x4'));var fs=require('fs');var path=require(_0xb546('0x5'));var rimraf=require(_0xb546('0x6'));var config=require(_0xb546('0x7'));var attributes=require(_0xb546('0x8'));module[_0xb546('0x9')]=function(_0x4175eb,_0x1121a7){return _0x4175eb[_0xb546('0xa')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bdc=['lodash','util','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc'];(function(_0x9b5c0,_0x2c8cbd){var _0x2eb5b1=function(_0xda28f4){while(--_0xda28f4){_0x9b5c0['push'](_0x9b5c0['shift']());}};_0x2eb5b1(++_0x2c8cbd);}(_0x4bdc,0x122));var _0xc4bd=function(_0x34d93c,_0x5c754c){_0x34d93c=_0x34d93c-0x0;var _0xdece82=_0x4bdc[_0x34d93c];return _0xdece82;};'use strict';var _=require(_0xc4bd('0x0'));var util=require(_0xc4bd('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc4bd('0x2'));var rp=require(_0xc4bd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4bd('0x4'));var config=require(_0xc4bd('0x5'));var attributes=require(_0xc4bd('0x6'));module[_0xc4bd('0x7')]=function(_0x39aab8,_0x3f3db4){return _0x39aab8[_0xc4bd('0x8')]('SquareOdbc',attributes,{'tableName':_0xc4bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 01434da..fcf0f39 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','options','where','include','map','attributes'];(function(_0x4b6348,_0xf76f68){var _0x1c5aee=function(_0x38c26d){while(--_0x38c26d){_0x4b6348['push'](_0x4b6348['shift']());}};_0x1c5aee(++_0xf76f68);}(_0x814b,0x1a2));var _0xb814=function(_0x1221e8,_0x2e7229){_0x1221e8=_0x1221e8-0x0;var _0x3f3041=_0x814b[_0x1221e8];return _0x3f3041;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['SquareOdbc']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowSquareOdbc',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x1f559d,_0x60b0ee){var _0x29d90f=function(_0x2968f0){while(--_0x2968f0){_0x1f559d['push'](_0x1f559d['shift']());}};_0x29d90f(++_0x60b0ee);}(_0x7217,0x19e));var _0x7721=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x7217[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 65a7f06..f71e6d1 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e40=['isAuthenticated','show','/:id/users','getUsers','create','addUsers','put','update','delete','removeUsers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id'];(function(_0x2c022e,_0x38c898){var _0x14c157=function(_0x26d96a){while(--_0x26d96a){_0x2c022e['push'](_0x2c022e['shift']());}};_0x14c157(++_0x38c898);}(_0x5e40,0x1d3));var _0x05e4=function(_0x5a9b6c,_0x30ccd0){_0x5a9b6c=_0x5a9b6c-0x0;var _0x72bed=_0x5e40[_0x5a9b6c];return _0x72bed;};'use strict';var multer=require(_0x05e4('0x0'));var util=require('util');var path=require(_0x05e4('0x1'));var timeout=require(_0x05e4('0x2'));var express=require(_0x05e4('0x3'));var router=express[_0x05e4('0x4')]();var fs_extra=require(_0x05e4('0x5'));var auth=require(_0x05e4('0x6'));var interaction=require(_0x05e4('0x7'));var config=require(_0x05e4('0x8'));var controller=require(_0x05e4('0x9'));router[_0x05e4('0xa')]('/',auth['isAuthenticated'](),controller[_0x05e4('0xb')]);router[_0x05e4('0xa')](_0x05e4('0xc'),auth[_0x05e4('0xd')](),controller[_0x05e4('0xe')]);router[_0x05e4('0xa')](_0x05e4('0xf'),auth[_0x05e4('0xd')](),controller[_0x05e4('0x10')]);router['post']('/',auth[_0x05e4('0xd')](),controller[_0x05e4('0x11')]);router['post'](_0x05e4('0xf'),auth['isAuthenticated'](),controller[_0x05e4('0x12')]);router[_0x05e4('0x13')]('/:id',auth[_0x05e4('0xd')](),controller[_0x05e4('0x14')]);router[_0x05e4('0x15')]('/:id',auth[_0x05e4('0xd')](),controller['destroy']);router[_0x05e4('0x15')](_0x05e4('0xf'),auth['isAuthenticated'](),controller[_0x05e4('0x16')]);module[_0x05e4('0x17')]=router; \ No newline at end of file +var _0xc18b=['update','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','/:id/users','getUsers','post','create','put'];(function(_0x52040f,_0x2383df){var _0x24df50=function(_0x342b91){while(--_0x342b91){_0x52040f['push'](_0x52040f['shift']());}};_0x24df50(++_0x2383df);}(_0xc18b,0xe2));var _0xbc18=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xc18b[_0x2f3848];return _0x102668;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbc18('0x0'));var timeout=require(_0xbc18('0x1'));var express=require('express');var router=express[_0xbc18('0x2')]();var fs_extra=require(_0xbc18('0x3'));var auth=require(_0xbc18('0x4'));var interaction=require(_0xbc18('0x5'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbc18('0x6')]);router['get'](_0xbc18('0x7'),auth[_0xbc18('0x8')](),controller['show']);router['get'](_0xbc18('0x9'),auth[_0xbc18('0x8')](),controller[_0xbc18('0xa')]);router[_0xbc18('0xb')]('/',auth[_0xbc18('0x8')](),controller[_0xbc18('0xc')]);router[_0xbc18('0xb')](_0xbc18('0x9'),auth[_0xbc18('0x8')](),controller['addUsers']);router[_0xbc18('0xd')](_0xbc18('0x7'),auth[_0xbc18('0x8')](),controller[_0xbc18('0xe')]);router[_0xbc18('0xf')](_0xbc18('0x7'),auth['isAuthenticated'](),controller['destroy']);router[_0xbc18('0xf')](_0xbc18('0x9'),auth[_0xbc18('0x8')](),controller['removeUsers']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 82b918f..af0ccfb 100644 --- a/server/api/squareProject/squareProject.attributes.js +++ b/server/api/squareProject/squareProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x674d=['DATE','sequelize','exports','STRING','name','long','getDataValue','preproduction','utf8','BLOB','production'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x674d,0xfe));var _0xd674=function(_0x2a59af,_0x18d558){_0x2a59af=_0x2a59af-0x0;var _0x3af243=_0x674d[_0x2a59af];return _0x3af243;};'use strict';var Sequelize=require(_0xd674('0x0'));module[_0xd674('0x1')]={'name':{'type':Sequelize[_0xd674('0x2')],'unique':_0xd674('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd674('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0xd674('0x4')),'get':function(){if(this[_0xd674('0x5')](_0xd674('0x6'))){return this[_0xd674('0x5')](_0xd674('0x6'))['toString'](_0xd674('0x7'));}}},'production':{'type':Sequelize[_0xd674('0x8')](_0xd674('0x4')),'get':function(){if(this[_0xd674('0x5')](_0xd674('0x9'))){return this[_0xd674('0x5')](_0xd674('0x9'))['toString'](_0xd674('0x7'));}}},'savedAt':{'type':Sequelize[_0xd674('0xa')]},'publishedAt':{'type':Sequelize[_0xd674('0xa')]}}; \ No newline at end of file +var _0xaa69=['TEXT','BLOB','getDataValue','preproduction','toString','long','production','utf8','DATE','STRING','name'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaa69,0x153));var _0x9aa6=function(_0x2d3e45,_0x16d47a){_0x2d3e45=_0x2d3e45-0x0;var _0x369ff5=_0xaa69[_0x2d3e45];return _0x369ff5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9aa6('0x0')],'unique':_0x9aa6('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x9aa6('0x0')]},'notes':{'type':Sequelize[_0x9aa6('0x2')]},'preproduction':{'type':Sequelize[_0x9aa6('0x3')]('long'),'get':function(){if(this[_0x9aa6('0x4')]('preproduction')){return this[_0x9aa6('0x4')](_0x9aa6('0x5'))[_0x9aa6('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x9aa6('0x3')](_0x9aa6('0x7')),'get':function(){if(this['getDataValue'](_0x9aa6('0x8'))){return this['getDataValue']('production')['toString'](_0x9aa6('0x9'));}}},'savedAt':{'type':Sequelize[_0x9aa6('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2a060f5..9c494f1 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','stack','render','contact','message','interaction','account','index','map','SquareProject','rawAttributes','type','model','name','keys','query','intersection','attributes','length','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','catch','show','params','fields','merge','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addUsers','ids'];(function(_0x373afd,_0x4afa02){var _0x48a7a9=function(_0x5787ce){while(--_0x5787ce){_0x373afd['push'](_0x373afd['shift']());}};_0x48a7a9(++_0x4afa02);}(_0x814b,0x1a2));var _0xb814=function(_0x5a488c,_0x4cc470){_0x5a488c=_0x5a488c-0x0;var _0x53a7d6=_0x814b[_0x5a488c];return _0x53a7d6;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);function respondWithStatusCode(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xcc;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x21')](_0x44fb96);}return _0x3f4881[_0xb814('0x22')](_0x44fb96)[_0xb814('0x23')]();};}function respondWithResult(_0x45e0d0,_0x265a83){_0x265a83=_0x265a83||0xc8;return function(_0x125ce2){if(_0x125ce2){return _0x45e0d0[_0xb814('0x22')](_0x265a83)[_0xb814('0x24')](_0x125ce2);}};}function respondWithFilteredResult(_0x48c9df,_0x168a48){return function(_0x55ba16){if(_0x55ba16){var _0x270598=typeof _0x168a48[_0xb814('0x25')]==='undefined'&&typeof _0x168a48['limit']==='undefined';var _0x399b43=_0x55ba16['count'];var _0x57c128=_0x270598?0x0:_0x168a48[_0xb814('0x25')];var _0x24211d=_0x270598?_0x55ba16[_0xb814('0x26')]:_0x168a48['offset']+_0x168a48[_0xb814('0x27')];var _0x531032;if(_0x24211d>=_0x399b43){_0x24211d=_0x399b43;_0x531032=0xc8;}else{_0x531032=0xce;}_0x48c9df[_0xb814('0x22')](_0x531032);return _0x48c9df[_0xb814('0x28')](_0xb814('0x29'),_0x57c128+'-'+_0x24211d+'/'+_0x399b43)[_0xb814('0x24')](_0x55ba16);}return null;};}function patchUpdates(_0x27352e){return function(_0x2bd039){try{jsonpatch[_0xb814('0x2a')](_0x2bd039,_0x27352e,!![]);}catch(_0x594470){return BPromise[_0xb814('0x2b')](_0x594470);}return _0x2bd039['save']();};}function saveUpdates(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x2c')](_0x3f81d0)[_0xb814('0x2d')](function(_0xb9e57d){return _0xb9e57d;});}return null;};}function removeEntity(_0x3d836c,_0x5755ea){return function(_0x392222){if(_0x392222){return _0x392222[_0xb814('0x2e')]()[_0xb814('0x2d')](function(){var _0x349394=_0x392222[_0xb814('0x2f')]({'plain':!![]});var _0x1d5965=_0xb814('0x30');return db[_0xb814('0x31')]['destroy']({'where':{'type':_0x1d5965,'resourceId':_0x349394['id']}})[_0xb814('0x2d')](function(){return _0x392222;});})[_0xb814('0x2d')](function(){_0x3d836c['status'](0xcc)[_0xb814('0x23')]();});}};}function handleEntityNotFound(_0x37d24d,_0x530744){return function(_0x499f22){if(!_0x499f22){_0x37d24d[_0xb814('0x21')](0x194);}return _0x499f22;};}function handleError(_0x2051d0,_0x58c3ca){_0x58c3ca=_0x58c3ca||0x1f4;return function(_0x338a28){logger['error'](_0x338a28[_0xb814('0x32')]);if(_0x338a28['name']){delete _0x338a28['name'];}_0x2051d0[_0xb814('0x22')](_0x58c3ca)['send'](_0x338a28);};}function getMustacheRender(_0x2431e2,_0x19469b){return Mustache[_0xb814('0x33')](_0x2431e2,_['merge'](_0x19469b['body'],{'contact':_0x19469b[_0xb814('0x34')],'message':_0x19469b[_0xb814('0x35')],'agent':_0x19469b['agent'],'interaction':_0x19469b[_0xb814('0x36')],'account':_0x19469b[_0xb814('0x37')]}))||'';}exports[_0xb814('0x38')]=function(_0x217b7e,_0x1b78de){var _0x60024d={},_0x3672f3={},_0x4df4e6={'count':0x0,'rows':[]};var _0x3207ec=_[_0xb814('0x39')](db[_0xb814('0x3a')][_0xb814('0x3b')],function(_0x14100d){return{'name':_0x14100d['fieldName'],'type':_0x14100d[_0xb814('0x3c')]['key']};});_0x3672f3[_0xb814('0x3d')]=_[_0xb814('0x39')](_0x3207ec,_0xb814('0x3e'));_0x3672f3['query']=_[_0xb814('0x3f')](_0x217b7e[_0xb814('0x40')]);_0x3672f3['filters']=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],_0x3672f3[_0xb814('0x40')]);_0x60024d[_0xb814('0x42')]=_[_0xb814('0x41')](_0x3672f3[_0xb814('0x3d')],qs['fields'](_0x217b7e[_0xb814('0x40')]['fields']));_0x60024d[_0xb814('0x42')]=_0x60024d['attributes'][_0xb814('0x43')]?_0x60024d['attributes']:_0x3672f3[_0xb814('0x3d')];if(!_0x217b7e[_0xb814('0x40')]['hasOwnProperty']('nolimit')){_0x60024d['limit']=qs['limit'](_0x217b7e[_0xb814('0x40')][_0xb814('0x27')]);_0x60024d[_0xb814('0x25')]=qs[_0xb814('0x25')](_0x217b7e['query']['offset']);}_0x60024d[_0xb814('0x44')]=qs['sort'](_0x217b7e[_0xb814('0x40')][_0xb814('0x45')]);_0x60024d[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x217b7e[_0xb814('0x40')],_0x3672f3[_0xb814('0x47')]),_0x3207ec);if(_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]){_0x60024d['where']=_['merge'](_0x60024d['where'],{'$or':_[_0xb814('0x39')](_0x3207ec,function(_0x5ba0bc){if(_0x5ba0bc[_0xb814('0x3c')]!=='VIRTUAL'){var _0x411723={};_0x411723[_0x5ba0bc[_0xb814('0x3e')]]={'$like':'%'+_0x217b7e[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x411723;}})});}_0x60024d=_['merge']({},_0x60024d,_0x217b7e[_0xb814('0x4a')]);var _0x15f01a={'where':_0x60024d[_0xb814('0x46')]};return db[_0xb814('0x3a')][_0xb814('0x26')](_0x15f01a)[_0xb814('0x2d')](function(_0x534eb8){_0x4df4e6[_0xb814('0x26')]=_0x534eb8;if(_0x217b7e[_0xb814('0x40')][_0xb814('0x4b')]){_0x60024d[_0xb814('0x4c')]=[{'all':!![]}];}return db[_0xb814('0x3a')][_0xb814('0x4d')](_0x60024d);})[_0xb814('0x2d')](function(_0x519545){_0x4df4e6['rows']=_0x519545;return _0x4df4e6;})[_0xb814('0x2d')](respondWithFilteredResult(_0x1b78de,_0x60024d))[_0xb814('0x4e')](handleError(_0x1b78de,null));};exports[_0xb814('0x4f')]=function(_0x2bf906,_0x43f1b){var _0x40e627={'raw':![],'where':{'id':_0x2bf906[_0xb814('0x50')]['id']}},_0x24b697={};_0x24b697[_0xb814('0x3d')]=_[_0xb814('0x3f')](db[_0xb814('0x3a')]['rawAttributes']);_0x24b697[_0xb814('0x40')]=_[_0xb814('0x3f')](_0x2bf906['query']);_0x24b697[_0xb814('0x47')]=_['intersection'](_0x24b697[_0xb814('0x3d')],_0x24b697[_0xb814('0x40')]);_0x40e627[_0xb814('0x42')]=_[_0xb814('0x41')](_0x24b697[_0xb814('0x3d')],qs[_0xb814('0x51')](_0x2bf906[_0xb814('0x40')][_0xb814('0x51')]));_0x40e627[_0xb814('0x42')]=_0x40e627[_0xb814('0x42')]['length']?_0x40e627['attributes']:_0x24b697[_0xb814('0x3d')];if(_0x2bf906[_0xb814('0x40')][_0xb814('0x4b')]){_0x40e627[_0xb814('0x4c')]=[{'all':!![]}];}_0x40e627=_[_0xb814('0x52')]({},_0x40e627,_0x2bf906[_0xb814('0x4a')]);return db[_0xb814('0x3a')]['find'](_0x40e627)[_0xb814('0x2d')](handleEntityNotFound(_0x43f1b,null))[_0xb814('0x2d')](respondWithResult(_0x43f1b,null))[_0xb814('0x4e')](handleError(_0x43f1b,null));};exports['create']=function(_0x3a5556,_0x4e6f3c){return db[_0xb814('0x3a')]['create'](_0x3a5556[_0xb814('0x53')],{})[_0xb814('0x2d')](function(_0x590c4b){var _0x793ea1=_0x3a5556[_0xb814('0x54')][_0xb814('0x2f')]({'plain':!![]});if(!_0x793ea1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x793ea1[_0xb814('0x55')]==='user'){var _0x13bdcf=_0x590c4b[_0xb814('0x2f')]({'plain':!![]});var _0x4aed78=_0xb814('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x4aed78,'userProfileId':_0x793ea1[_0xb814('0x56')]},'raw':!![]})[_0xb814('0x2d')](function(_0x34935b){if(_0x34935b&&_0x34935b['autoAssociation']===0x0){return db[_0xb814('0x31')]['create']({'name':_0x13bdcf[_0xb814('0x3e')],'resourceId':_0x13bdcf['id'],'type':_0x34935b[_0xb814('0x3e')],'sectionId':_0x34935b['id']},{})['then'](function(){return _0x590c4b;});}else{return _0x590c4b;}})[_0xb814('0x4e')](function(_0x5c32c2){logger[_0xb814('0x57')](_0xb814('0x58'),_0x5c32c2);throw _0x5c32c2;});}return _0x590c4b;})[_0xb814('0x2d')](respondWithResult(_0x4e6f3c,0xc9))[_0xb814('0x4e')](handleError(_0x4e6f3c,null));};exports[_0xb814('0x2c')]=function(_0x34acca,_0x21d3e9){if(_0x34acca[_0xb814('0x53')]['id']){delete _0x34acca['body']['id'];}return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x34acca['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x21d3e9,null))[_0xb814('0x2d')](saveUpdates(_0x34acca['body'],null))[_0xb814('0x2d')](respondWithResult(_0x21d3e9,null))['catch'](handleError(_0x21d3e9,null));};exports['destroy']=function(_0x2114ca,_0x5257be){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x2114ca[_0xb814('0x50')]['id']}})['then'](handleEntityNotFound(_0x5257be,null))[_0xb814('0x2d')](removeEntity(_0x5257be,null))['catch'](handleError(_0x5257be,null));};exports[_0xb814('0x5a')]=function(_0x1e9196,_0x1236d4,_0x176585){return db[_0xb814('0x3a')][_0xb814('0x59')]({'where':{'id':_0x1e9196[_0xb814('0x50')]['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x1236d4,null))[_0xb814('0x2d')](function(_0x4d611d){if(_0x4d611d){return _0x4d611d[_0xb814('0x5a')](_0x1e9196[_0xb814('0x53')][_0xb814('0x5b')],_[_0xb814('0x5c')](_0x1e9196[_0xb814('0x53')],[_0xb814('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x1236d4,null))[_0xb814('0x4e')](handleError(_0x1236d4,null));};exports['removeUsers']=function(_0x3cd4f7,_0x39b754,_0xac95cf){return db['SquareProject'][_0xb814('0x59')]({'where':{'id':_0x3cd4f7['params']['id']}})[_0xb814('0x2d')](handleEntityNotFound(_0x39b754,null))['then'](function(_0x2f0c94){if(_0x2f0c94){return _0x2f0c94[_0xb814('0x5d')](_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')])[_0xb814('0x2d')](function(){if(_[_0xb814('0x5e')](_0x3cd4f7[_0xb814('0x40')]['ids'])){for(var _0x44088d=0x0;_0x44088d<_0x3cd4f7['query'][_0xb814('0x5b')][_0xb814('0x43')];_0x44088d+=0x1){socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7[_0xb814('0x40')][_0xb814('0x5b')][_0x44088d]),'SquareProjectId':Number(_0x3cd4f7['params']['id'])});}}else{socket[_0xb814('0x5f')](_0xb814('0x60'),{'UserId':Number(_0x3cd4f7['query'][_0xb814('0x5b')]),'SquareProjectId':Number(_0x3cd4f7[_0xb814('0x50')]['id'])});}});}})[_0xb814('0x2d')](respondWithStatusCode(_0x39b754,null))[_0xb814('0x4e')](handleError(_0x39b754,null));};exports[_0xb814('0x61')]=function(_0x51d834,_0x3a4d4b,_0x5e8e8e){var _0x24594a={};var _0x16f8f2={};var _0x2645f6;var _0x45dc85;return db[_0xb814('0x3a')][_0xb814('0x62')]({'where':{'id':_0x51d834['params']['id']}})['then'](handleEntityNotFound(_0x3a4d4b,null))['then'](function(_0x25c776){if(_0x25c776){_0x2645f6=_0x25c776;_0x16f8f2['model']=_[_0xb814('0x3f')](db[_0xb814('0x63')][_0xb814('0x3b')]);_0x16f8f2['query']=_[_0xb814('0x3f')](_0x51d834[_0xb814('0x40')]);_0x16f8f2[_0xb814('0x47')]=_['intersection'](_0x16f8f2[_0xb814('0x3d')],_0x16f8f2[_0xb814('0x40')]);_0x24594a[_0xb814('0x42')]=_[_0xb814('0x41')](_0x16f8f2['model'],qs['fields'](_0x51d834[_0xb814('0x40')][_0xb814('0x51')]));_0x24594a[_0xb814('0x42')]=_0x24594a[_0xb814('0x42')][_0xb814('0x43')]?_0x24594a[_0xb814('0x42')]:_0x16f8f2[_0xb814('0x3d')];_0x24594a[_0xb814('0x44')]=qs[_0xb814('0x45')](_0x51d834[_0xb814('0x40')][_0xb814('0x45')]);_0x24594a[_0xb814('0x46')]=qs[_0xb814('0x47')](_[_0xb814('0x48')](_0x51d834[_0xb814('0x40')],_0x16f8f2['filters']));if(_0x51d834[_0xb814('0x40')][_0xb814('0x49')]){_0x24594a[_0xb814('0x46')]=_[_0xb814('0x52')](_0x24594a[_0xb814('0x46')],{'$or':_[_0xb814('0x39')](_0x24594a['attributes'],function(_0xff4dc2){var _0x52e1fc={};_0x52e1fc[_0xff4dc2]={'$like':'%'+_0x51d834[_0xb814('0x40')][_0xb814('0x49')]+'%'};return _0x52e1fc;})});}_0x24594a=_[_0xb814('0x52')]({},_0x24594a,_0x51d834[_0xb814('0x4a')]);return _0x2645f6[_0xb814('0x61')](_0x24594a);}})['then'](function(_0x4c44ee){if(_0x4c44ee){_0x45dc85=_0x4c44ee[_0xb814('0x43')];if(!_0x51d834[_0xb814('0x40')][_0xb814('0x64')](_0xb814('0x65'))){_0x24594a['limit']=qs[_0xb814('0x27')](_0x51d834['query'][_0xb814('0x27')]);_0x24594a[_0xb814('0x25')]=qs['offset'](_0x51d834['query'][_0xb814('0x25')]);}return _0x2645f6['getUsers'](_0x24594a);}})[_0xb814('0x2d')](function(_0x163c2b){if(_0x163c2b){return _0x163c2b?{'count':_0x45dc85,'rows':_0x163c2b}:null;}})[_0xb814('0x2d')](respondWithResult(_0x3a4d4b,null))[_0xb814('0x4e')](handleError(_0x3a4d4b,null));}; \ No newline at end of file +var _0xe14b=['message','account','map','rawAttributes','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','SquareProject','findAll','catch','show','params','keys','length','includeAll','find','create','user','role','UserProfileSection','userProfileId','UserProfileResource','update','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','then','destroy','get','SquareProjects','error','stack','name','send','render','merge','body'];(function(_0x122a0a,_0x149a53){var _0x557bca=function(_0x565bcb){while(--_0x565bcb){_0x122a0a['push'](_0x122a0a['shift']());}};_0x557bca(++_0x149a53);}(_0xe14b,0x93));var _0xbe14=function(_0xbb139f,_0x5f1d3c){_0xbb139f=_0xbb139f-0x0;var _0x5c0809=_0xe14b[_0xbb139f];return _0x5c0809;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];config[_0xbe14('0x16')]=_[_0xbe14('0x17')](config[_0xbe14('0x16')],{'host':_0xbe14('0x18'),'port':0x18eb});var socket=require(_0xbe14('0x19'))(new Redis(config[_0xbe14('0x16')]));require(_0xbe14('0x1a'))[_0xbe14('0x1b')](socket);function respondWithStatusCode(_0x813399,_0x530538){_0x530538=_0x530538||0xcc;return function(_0x55b3a7){if(_0x55b3a7){return _0x813399[_0xbe14('0x1c')](_0x530538);}return _0x813399[_0xbe14('0x1d')](_0x530538)[_0xbe14('0x1e')]();};}function respondWithResult(_0x37ce4e,_0x4e8f34){_0x4e8f34=_0x4e8f34||0xc8;return function(_0x21c789){if(_0x21c789){return _0x37ce4e[_0xbe14('0x1d')](_0x4e8f34)[_0xbe14('0x1f')](_0x21c789);}};}function respondWithFilteredResult(_0x123ede,_0x38f1ea){return function(_0x29ab73){if(_0x29ab73){var _0x17ae86=typeof _0x38f1ea['offset']===_0xbe14('0x20')&&typeof _0x38f1ea[_0xbe14('0x21')]===_0xbe14('0x20');var _0x433459=_0x29ab73[_0xbe14('0x22')];var _0x37e4c1=_0x17ae86?0x0:_0x38f1ea['offset'];var _0x24f820=_0x17ae86?_0x29ab73[_0xbe14('0x22')]:_0x38f1ea[_0xbe14('0x23')]+_0x38f1ea[_0xbe14('0x21')];var _0x188ec4;if(_0x24f820>=_0x433459){_0x24f820=_0x433459;_0x188ec4=0xc8;}else{_0x188ec4=0xce;}_0x123ede['status'](_0x188ec4);return _0x123ede[_0xbe14('0x24')]('Content-Range',_0x37e4c1+'-'+_0x24f820+'/'+_0x433459)[_0xbe14('0x1f')](_0x29ab73);}return null;};}function patchUpdates(_0x56e80c){return function(_0x32e8eb){try{jsonpatch['apply'](_0x32e8eb,_0x56e80c,!![]);}catch(_0x274018){return BPromise[_0xbe14('0x25')](_0x274018);}return _0x32e8eb['save']();};}function saveUpdates(_0x2da350,_0x4d4190){return function(_0x4587a8){if(_0x4587a8){return _0x4587a8['update'](_0x2da350)[_0xbe14('0x26')](function(_0x5fa043){return _0x5fa043;});}return null;};}function removeEntity(_0x1ee9c1,_0x39cc81){return function(_0x15ef02){if(_0x15ef02){return _0x15ef02[_0xbe14('0x27')]()['then'](function(){var _0x1822e0=_0x15ef02[_0xbe14('0x28')]({'plain':!![]});var _0x391556=_0xbe14('0x29');return db['UserProfileResource'][_0xbe14('0x27')]({'where':{'type':_0x391556,'resourceId':_0x1822e0['id']}})[_0xbe14('0x26')](function(){return _0x15ef02;});})['then'](function(){_0x1ee9c1[_0xbe14('0x1d')](0xcc)[_0xbe14('0x1e')]();});}};}function handleEntityNotFound(_0x1c7cc7,_0x19252f){return function(_0x34d648){if(!_0x34d648){_0x1c7cc7[_0xbe14('0x1c')](0x194);}return _0x34d648;};}function handleError(_0x31a664,_0x2b05cb){_0x2b05cb=_0x2b05cb||0x1f4;return function(_0x4168c8){logger[_0xbe14('0x2a')](_0x4168c8[_0xbe14('0x2b')]);if(_0x4168c8[_0xbe14('0x2c')]){delete _0x4168c8[_0xbe14('0x2c')];}_0x31a664[_0xbe14('0x1d')](_0x2b05cb)[_0xbe14('0x2d')](_0x4168c8);};}function getMustacheRender(_0xe6feb2,_0x6ba36c){return Mustache[_0xbe14('0x2e')](_0xe6feb2,_[_0xbe14('0x2f')](_0x6ba36c[_0xbe14('0x30')],{'contact':_0x6ba36c['contact'],'message':_0x6ba36c[_0xbe14('0x31')],'agent':_0x6ba36c['agent'],'interaction':_0x6ba36c['interaction'],'account':_0x6ba36c[_0xbe14('0x32')]}))||'';}exports['index']=function(_0x243524,_0x345b0){var _0x52a25c={},_0x50cb09={},_0x5798c7={'count':0x0,'rows':[]};var _0x412ad5=_[_0xbe14('0x33')](db['SquareProject'][_0xbe14('0x34')],function(_0x1faf3e){return{'name':_0x1faf3e[_0xbe14('0x35')],'type':_0x1faf3e[_0xbe14('0x36')][_0xbe14('0x37')]};});_0x50cb09['model']=_['map'](_0x412ad5,_0xbe14('0x2c'));_0x50cb09['query']=_['keys'](_0x243524['query']);_0x50cb09[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x50cb09[_0xbe14('0x3a')],_0x50cb09[_0xbe14('0x3b')]);_0x52a25c[_0xbe14('0x3c')]=_[_0xbe14('0x39')](_0x50cb09[_0xbe14('0x3a')],qs[_0xbe14('0x3d')](_0x243524[_0xbe14('0x3b')][_0xbe14('0x3d')]));_0x52a25c[_0xbe14('0x3c')]=_0x52a25c[_0xbe14('0x3c')]['length']?_0x52a25c['attributes']:_0x50cb09[_0xbe14('0x3a')];if(!_0x243524[_0xbe14('0x3b')][_0xbe14('0x3e')]('nolimit')){_0x52a25c[_0xbe14('0x21')]=qs[_0xbe14('0x21')](_0x243524[_0xbe14('0x3b')][_0xbe14('0x21')]);_0x52a25c[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x243524[_0xbe14('0x3b')][_0xbe14('0x23')]);}_0x52a25c[_0xbe14('0x3f')]=qs['sort'](_0x243524[_0xbe14('0x3b')][_0xbe14('0x40')]);_0x52a25c[_0xbe14('0x41')]=qs[_0xbe14('0x38')](_[_0xbe14('0x42')](_0x243524[_0xbe14('0x3b')],_0x50cb09['filters']),_0x412ad5);if(_0x243524[_0xbe14('0x3b')][_0xbe14('0x43')]){_0x52a25c[_0xbe14('0x41')]=_[_0xbe14('0x2f')](_0x52a25c['where'],{'$or':_['map'](_0x412ad5,function(_0x38611d){if(_0x38611d[_0xbe14('0x36')]!==_0xbe14('0x44')){var _0x51c859={};_0x51c859[_0x38611d['name']]={'$like':'%'+_0x243524[_0xbe14('0x3b')]['filter']+'%'};return _0x51c859;}})});}_0x52a25c=_['merge']({},_0x52a25c,_0x243524[_0xbe14('0x45')]);var _0x1f0355={'where':_0x52a25c[_0xbe14('0x41')]};return db['SquareProject']['count'](_0x1f0355)['then'](function(_0x46fee8){_0x5798c7[_0xbe14('0x22')]=_0x46fee8;if(_0x243524[_0xbe14('0x3b')]['includeAll']){_0x52a25c[_0xbe14('0x46')]=[{'all':!![]}];}return db[_0xbe14('0x47')][_0xbe14('0x48')](_0x52a25c);})[_0xbe14('0x26')](function(_0x58351f){_0x5798c7['rows']=_0x58351f;return _0x5798c7;})[_0xbe14('0x26')](respondWithFilteredResult(_0x345b0,_0x52a25c))[_0xbe14('0x49')](handleError(_0x345b0,null));};exports[_0xbe14('0x4a')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'raw':![],'where':{'id':_0xb2b285[_0xbe14('0x4b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x3a')]=_[_0xbe14('0x4c')](db[_0xbe14('0x47')]['rawAttributes']);_0x51023a[_0xbe14('0x3b')]=_[_0xbe14('0x4c')](_0xb2b285['query']);_0x51023a[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x51023a[_0xbe14('0x3a')],_0x51023a[_0xbe14('0x3b')]);_0x4f2d95['attributes']=_['intersection'](_0x51023a[_0xbe14('0x3a')],qs[_0xbe14('0x3d')](_0xb2b285['query']['fields']));_0x4f2d95[_0xbe14('0x3c')]=_0x4f2d95[_0xbe14('0x3c')][_0xbe14('0x4d')]?_0x4f2d95[_0xbe14('0x3c')]:_0x51023a[_0xbe14('0x3a')];if(_0xb2b285[_0xbe14('0x3b')][_0xbe14('0x4e')]){_0x4f2d95['include']=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x2f')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x45')]);return db[_0xbe14('0x47')][_0xbe14('0x4f')](_0x4f2d95)[_0xbe14('0x26')](handleEntityNotFound(_0x2550dc,null))['then'](respondWithResult(_0x2550dc,null))[_0xbe14('0x49')](handleError(_0x2550dc,null));};exports[_0xbe14('0x50')]=function(_0x35126f,_0x20f46d){return db[_0xbe14('0x47')][_0xbe14('0x50')](_0x35126f['body'],{})['then'](function(_0x3a49f7){var _0x2bde72=_0x35126f[_0xbe14('0x51')]['get']({'plain':!![]});if(!_0x2bde72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bde72[_0xbe14('0x52')]===_0xbe14('0x51')){var _0x50d78f=_0x3a49f7[_0xbe14('0x28')]({'plain':!![]});var _0x32496a='SquareProjects';return db[_0xbe14('0x53')]['find']({'where':{'name':_0x32496a,'userProfileId':_0x2bde72[_0xbe14('0x54')]},'raw':!![]})[_0xbe14('0x26')](function(_0x12a9de){if(_0x12a9de&&_0x12a9de['autoAssociation']===0x0){return db[_0xbe14('0x55')][_0xbe14('0x50')]({'name':_0x50d78f['name'],'resourceId':_0x50d78f['id'],'type':_0x12a9de[_0xbe14('0x2c')],'sectionId':_0x12a9de['id']},{})[_0xbe14('0x26')](function(){return _0x3a49f7;});}else{return _0x3a49f7;}})[_0xbe14('0x49')](function(_0x20c48d){logger[_0xbe14('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20c48d);throw _0x20c48d;});}return _0x3a49f7;})[_0xbe14('0x26')](respondWithResult(_0x20f46d,0xc9))[_0xbe14('0x49')](handleError(_0x20f46d,null));};exports[_0xbe14('0x56')]=function(_0x243b9e,_0x32968f){if(_0x243b9e[_0xbe14('0x30')]['id']){delete _0x243b9e[_0xbe14('0x30')]['id'];}return db['SquareProject'][_0xbe14('0x4f')]({'where':{'id':_0x243b9e[_0xbe14('0x4b')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x32968f,null))[_0xbe14('0x26')](saveUpdates(_0x243b9e[_0xbe14('0x30')],null))[_0xbe14('0x26')](respondWithResult(_0x32968f,null))[_0xbe14('0x49')](handleError(_0x32968f,null));};exports[_0xbe14('0x27')]=function(_0x285b6e,_0xc61103){return db[_0xbe14('0x47')]['find']({'where':{'id':_0x285b6e['params']['id']}})['then'](handleEntityNotFound(_0xc61103,null))[_0xbe14('0x26')](removeEntity(_0xc61103,null))[_0xbe14('0x49')](handleError(_0xc61103,null));};exports[_0xbe14('0x57')]=function(_0xf79b21,_0x1cf828,_0x66ddf){return db[_0xbe14('0x47')][_0xbe14('0x4f')]({'where':{'id':_0xf79b21[_0xbe14('0x4b')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x1cf828,null))[_0xbe14('0x26')](function(_0x4346e8){if(_0x4346e8){return _0x4346e8[_0xbe14('0x57')](_0xf79b21[_0xbe14('0x30')][_0xbe14('0x58')],_[_0xbe14('0x59')](_0xf79b21[_0xbe14('0x30')],[_0xbe14('0x58'),'id'])||{});}})[_0xbe14('0x26')](respondWithResult(_0x1cf828,null))[_0xbe14('0x49')](handleError(_0x1cf828,null));};exports['removeUsers']=function(_0x71bb66,_0x9333d,_0x2c426d){return db[_0xbe14('0x47')][_0xbe14('0x4f')]({'where':{'id':_0x71bb66[_0xbe14('0x4b')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x9333d,null))[_0xbe14('0x26')](function(_0x23cb36){if(_0x23cb36){return _0x23cb36[_0xbe14('0x5a')](_0x71bb66['query'][_0xbe14('0x58')])[_0xbe14('0x26')](function(){if(_[_0xbe14('0x5b')](_0x71bb66[_0xbe14('0x3b')][_0xbe14('0x58')])){for(var _0x5a1ea6=0x0;_0x5a1ea6<_0x71bb66[_0xbe14('0x3b')][_0xbe14('0x58')][_0xbe14('0x4d')];_0x5a1ea6+=0x1){socket[_0xbe14('0x5c')](_0xbe14('0x5d'),{'UserId':Number(_0x71bb66['query'][_0xbe14('0x58')][_0x5a1ea6]),'SquareProjectId':Number(_0x71bb66[_0xbe14('0x4b')]['id'])});}}else{socket[_0xbe14('0x5c')](_0xbe14('0x5d'),{'UserId':Number(_0x71bb66[_0xbe14('0x3b')][_0xbe14('0x58')]),'SquareProjectId':Number(_0x71bb66[_0xbe14('0x4b')]['id'])});}});}})[_0xbe14('0x26')](respondWithStatusCode(_0x9333d,null))['catch'](handleError(_0x9333d,null));};exports[_0xbe14('0x5e')]=function(_0x33c309,_0x2fdf5d,_0x20b12e){var _0x5982b7={};var _0xa4b2a3={};var _0x445302;var _0x566096;return db['SquareProject'][_0xbe14('0x5f')]({'where':{'id':_0x33c309[_0xbe14('0x4b')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x2fdf5d,null))[_0xbe14('0x26')](function(_0x312504){if(_0x312504){_0x445302=_0x312504;_0xa4b2a3[_0xbe14('0x3a')]=_[_0xbe14('0x4c')](db[_0xbe14('0x60')]['rawAttributes']);_0xa4b2a3['query']=_[_0xbe14('0x4c')](_0x33c309[_0xbe14('0x3b')]);_0xa4b2a3[_0xbe14('0x38')]=_['intersection'](_0xa4b2a3[_0xbe14('0x3a')],_0xa4b2a3[_0xbe14('0x3b')]);_0x5982b7[_0xbe14('0x3c')]=_[_0xbe14('0x39')](_0xa4b2a3[_0xbe14('0x3a')],qs[_0xbe14('0x3d')](_0x33c309[_0xbe14('0x3b')]['fields']));_0x5982b7[_0xbe14('0x3c')]=_0x5982b7[_0xbe14('0x3c')][_0xbe14('0x4d')]?_0x5982b7[_0xbe14('0x3c')]:_0xa4b2a3[_0xbe14('0x3a')];_0x5982b7[_0xbe14('0x3f')]=qs[_0xbe14('0x40')](_0x33c309['query'][_0xbe14('0x40')]);_0x5982b7[_0xbe14('0x41')]=qs[_0xbe14('0x38')](_[_0xbe14('0x42')](_0x33c309[_0xbe14('0x3b')],_0xa4b2a3[_0xbe14('0x38')]));if(_0x33c309[_0xbe14('0x3b')][_0xbe14('0x43')]){_0x5982b7['where']=_[_0xbe14('0x2f')](_0x5982b7[_0xbe14('0x41')],{'$or':_[_0xbe14('0x33')](_0x5982b7[_0xbe14('0x3c')],function(_0x2e0155){var _0x17576b={};_0x17576b[_0x2e0155]={'$like':'%'+_0x33c309['query'][_0xbe14('0x43')]+'%'};return _0x17576b;})});}_0x5982b7=_[_0xbe14('0x2f')]({},_0x5982b7,_0x33c309[_0xbe14('0x45')]);return _0x445302[_0xbe14('0x5e')](_0x5982b7);}})['then'](function(_0x7e9e5c){if(_0x7e9e5c){_0x566096=_0x7e9e5c[_0xbe14('0x4d')];if(!_0x33c309[_0xbe14('0x3b')][_0xbe14('0x3e')](_0xbe14('0x61'))){_0x5982b7[_0xbe14('0x21')]=qs[_0xbe14('0x21')](_0x33c309['query'][_0xbe14('0x21')]);_0x5982b7['offset']=qs[_0xbe14('0x23')](_0x33c309['query'][_0xbe14('0x23')]);}return _0x445302[_0xbe14('0x5e')](_0x5982b7);}})[_0xbe14('0x26')](function(_0x5b7f07){if(_0x5b7f07){return _0x5b7f07?{'count':_0x566096,'rows':_0x5b7f07}:null;}})[_0xbe14('0x26')](respondWithResult(_0x2fdf5d,null))[_0xbe14('0x49')](handleError(_0x2fdf5d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 924adc3..c78ce07 100644 --- a/server/api/squareProject/squareProject.events.js +++ b/server/api/squareProject/squareProject.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0e8=['update','remove','emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners','save'];(function(_0x1f356c,_0x313364){var _0x2674dc=function(_0x427c11){while(--_0x427c11){_0x1f356c['push'](_0x1f356c['shift']());}};_0x2674dc(++_0x313364);}(_0xe0e8,0x1c8));var _0x8e0e=function(_0xd501,_0x435fbf){_0xd501=_0xd501-0x0;var _0x4b6c4e=_0xe0e8[_0xd501];return _0x4b6c4e;};'use strict';var EventEmitter=require(_0x8e0e('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x8e0e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8e0e('0x2')](0x0);var events={'afterCreate':_0x8e0e('0x3'),'afterUpdate':_0x8e0e('0x4'),'afterDestroy':_0x8e0e('0x5')};function emitEvent(_0x7f2e63){return function(_0x4a04c2,_0x3f09fd,_0x156a69){SquareProjectEvents['emit'](_0x7f2e63+':'+_0x4a04c2['id'],_0x4a04c2);SquareProjectEvents[_0x8e0e('0x6')](_0x7f2e63,_0x4a04c2);_0x156a69(null);};}for(var e in events){if(events[_0x8e0e('0x7')](e)){var event=events[e];SquareProject[_0x8e0e('0x8')](e,emitEvent(event));}}module[_0x8e0e('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x880c=['hook','exports','events','SquareProject','save','update','emit'];(function(_0x25cba2,_0x854652){var _0x4e5c35=function(_0x490c90){while(--_0x490c90){_0x25cba2['push'](_0x25cba2['shift']());}};_0x4e5c35(++_0x854652);}(_0x880c,0x1bb));var _0xc880=function(_0x5a54f2,_0x774ad6){_0x5a54f2=_0x5a54f2-0x0;var _0x1fffe9=_0x880c[_0x5a54f2];return _0x1fffe9;};'use strict';var EventEmitter=require(_0xc880('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xc880('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc880('0x2'),'afterUpdate':_0xc880('0x3'),'afterDestroy':'remove'};function emitEvent(_0x572a16){return function(_0x51fb90,_0x137ee5,_0x387236){SquareProjectEvents[_0xc880('0x4')](_0x572a16+':'+_0x51fb90['id'],_0x51fb90);SquareProjectEvents[_0xc880('0x4')](_0x572a16,_0x51fb90);_0x387236(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xc880('0x5')](e,emitEvent(event));}}module[_0xc880('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 771de69..e34b9f0 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x212b=['exports','SquareProject','square_projects','changed','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x212b,0x148));var _0xb212=function(_0x5670c8,_0x5d5326){_0x5670c8=_0x5670c8-0x0;var _0x40f669=_0x212b[_0x5670c8];return _0x40f669;};'use strict';var _=require(_0xb212('0x0'));var util=require('util');var logger=require(_0xb212('0x1'))(_0xb212('0x2'));var moment=require(_0xb212('0x3'));var BPromise=require(_0xb212('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb212('0x5'));var rimraf=require(_0xb212('0x6'));var config=require(_0xb212('0x7'));var attributes=require('./squareProject.attributes');module[_0xb212('0x8')]=function(_0x49a13c,_0x21825a){return _0x49a13c['define'](_0xb212('0x9'),attributes,{'tableName':_0xb212('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c1000,_0x4cf8f7,_0x1fff1b){if(_0x5c1000[_0xb212('0xb')]('preproduction')){_0x5c1000[_0xb212('0xc')]=moment()[_0xb212('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5c1000['changed']('production')){_0x5c1000[_0xb212('0xe')]=moment()['format'](_0xb212('0xf'));}_0x1fff1b(null,_0x5c1000);}}});}; \ No newline at end of file +var _0x99e9=['./squareProject.attributes','define','SquareProject','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5b77e3,_0x594899){var _0x4ab634=function(_0x1bcd04){while(--_0x1bcd04){_0x5b77e3['push'](_0x5b77e3['shift']());}};_0x4ab634(++_0x594899);}(_0x99e9,0xb4));var _0x999e=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0x99e9[_0x322bef];return _0x229e60;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46aeae,_0x38a692,_0x343a12){if(_0x46aeae[_0x999e('0xa')](_0x999e('0xb'))){_0x46aeae[_0x999e('0xc')]=moment()[_0x999e('0xd')](_0x999e('0xe'));}if(_0x46aeae[_0x999e('0xa')](_0x999e('0xf'))){_0x46aeae[_0x999e('0x10')]=moment()[_0x999e('0xd')](_0x999e('0xe'));}_0x343a12(null,_0x46aeae);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index e882ed6..7fc0534 100644 --- a/server/api/squareProject/squareProject.rpc.js +++ b/server/api/squareProject/squareProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8de4=['request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','debug','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s'];(function(_0xc47d44,_0x23c072){var _0x5b79a6=function(_0x4954e6){while(--_0x4954e6){_0xc47d44['push'](_0xc47d44['shift']());}};_0x5b79a6(++_0x23c072);}(_0x8de4,0xea));var _0x48de=function(_0x261a68,_0x5648c5){_0x261a68=_0x261a68-0x0;var _0x31090d=_0x8de4[_0x261a68];return _0x31090d;};'use strict';var _=require('lodash');var util=require(_0x48de('0x0'));var moment=require(_0x48de('0x1'));var BPromise=require('bluebird');var rs=require(_0x48de('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48de('0x3'))['db'];var utils=require(_0x48de('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x48de('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x48de('0x6')][_0x48de('0x7')]({'port':0x232a});config['redis']=_[_0x48de('0x8')](config[_0x48de('0x9')],{'host':_0x48de('0xa'),'port':0x18eb});var socket=require(_0x48de('0xb'))(new Redis(config[_0x48de('0x9')]));require(_0x48de('0xc'))[_0x48de('0xd')](socket);function respondWithRpcPromise(_0x15d038,_0x4ec7d1,_0x5caa45){return new BPromise(function(_0x814b0c,_0x239d09){return client[_0x48de('0xe')](_0x15d038,_0x5caa45)[_0x48de('0xf')](function(_0x17b946){logger[_0x48de('0x10')](_0x48de('0x11'),_0x4ec7d1,_0x48de('0x12'));logger['debug'](_0x48de('0x13'),_0x4ec7d1,_0x48de('0x12'),JSON[_0x48de('0x14')](_0x17b946));if(_0x17b946[_0x48de('0x15')]){if(_0x17b946[_0x48de('0x15')][_0x48de('0x16')]===0x1f4){logger[_0x48de('0x15')]('SquareProject,\x20%s,\x20%s',_0x4ec7d1,_0x17b946['error'][_0x48de('0x17')]);return _0x239d09(_0x17b946[_0x48de('0x15')][_0x48de('0x17')]);}logger['error'](_0x48de('0x11'),_0x4ec7d1,_0x17b946[_0x48de('0x15')][_0x48de('0x17')]);return _0x814b0c(_0x17b946[_0x48de('0x15')]['message']);}else{logger['info'](_0x48de('0x11'),_0x4ec7d1,_0x48de('0x12'));_0x814b0c(_0x17b946[_0x48de('0x18')][_0x48de('0x17')]);}})[_0x48de('0x19')](function(_0x391713){logger['error']('SquareProject,\x20%s,\x20%s',_0x4ec7d1,_0x391713);_0x239d09(_0x391713);});});}exports[_0x48de('0x1a')]=function(_0x447b37){var _0x386201=this;return new Promise(function(_0x51aedf,_0x470e09){return db[_0x48de('0x1b')][_0x48de('0x1c')]({'raw':_0x447b37['options']?_0x447b37['options']['raw']===undefined?!![]:![]:!![],'where':_0x447b37[_0x48de('0x1d')]?_0x447b37[_0x48de('0x1d')][_0x48de('0x1e')]||null:null,'attributes':_0x447b37['options']?_0x447b37[_0x48de('0x1d')][_0x48de('0x1f')]||null:null,'include':_0x447b37[_0x48de('0x1d')]?_0x447b37[_0x48de('0x1d')][_0x48de('0x20')]?_[_0x48de('0x21')](_0x447b37[_0x48de('0x1d')]['include'],function(_0x15283d){return{'model':db[_0x15283d[_0x48de('0x22')]],'as':_0x15283d['as'],'attributes':_0x15283d['attributes'],'include':_0x15283d[_0x48de('0x20')]?_[_0x48de('0x21')](_0x15283d[_0x48de('0x20')],function(_0x598a07){return{'model':db[_0x598a07[_0x48de('0x22')]],'as':_0x598a07['as'],'attributes':_0x598a07['attributes'],'include':_0x598a07['include']?_['map'](_0x598a07[_0x48de('0x20')],function(_0xcc35b0){return{'model':db[_0xcc35b0['model']],'as':_0xcc35b0['as'],'attributes':_0xcc35b0[_0x48de('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x479eb0){logger[_0x48de('0x10')](_0x48de('0x1a'),_0x447b37);logger[_0x48de('0x23')]('ShowSquareProject',_0x447b37,JSON[_0x48de('0x14')](_0x479eb0));_0x51aedf(_0x479eb0);})['catch'](function(_0x5365db){logger[_0x48de('0x15')](_0x48de('0x1a'),_0x5365db[_0x48de('0x17')],_0x447b37);_0x470e09(_0x386201[_0x48de('0x15')](0x1f4,_0x5365db['message']));});});}; \ No newline at end of file +var _0x10f3=['debug','stringify','error','message','result','ShowSquareProject','SquareProject','find','options','raw','where','include','model','attributes','map','catch','lodash','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent'];(function(_0x2ff12f,_0xdf89a6){var _0x591094=function(_0x2c3165){while(--_0x2c3165){_0x2ff12f['push'](_0x2ff12f['shift']());}};_0x591094(++_0xdf89a6);}(_0x10f3,0x1b4));var _0x310f=function(_0x2f5b74,_0x53c38e){_0x2f5b74=_0x2f5b74-0x0;var _0x46fb4e=_0x10f3[_0x2f5b74];return _0x46fb4e;};'use strict';var _=require(_0x310f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x310f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x310f('0x2'));var logger=require(_0x310f('0x3'))('rpc');var config=require(_0x310f('0x4'));var jayson=require(_0x310f('0x5'));var client=jayson[_0x310f('0x6')][_0x310f('0x7')]({'port':0x232a});config[_0x310f('0x8')]=_[_0x310f('0x9')](config[_0x310f('0x8')],{'host':_0x310f('0xa'),'port':0x18eb});var socket=require(_0x310f('0xb'))(new Redis(config[_0x310f('0x8')]));require(_0x310f('0xc'))[_0x310f('0xd')](socket);function respondWithRpcPromise(_0x2045c8,_0x37bfaa,_0x2e8c01){return new BPromise(function(_0x343832,_0x5d8459){return client[_0x310f('0xe')](_0x2045c8,_0x2e8c01)[_0x310f('0xf')](function(_0x38e904){logger[_0x310f('0x10')](_0x310f('0x11'),_0x37bfaa,_0x310f('0x12'));logger[_0x310f('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x37bfaa,_0x310f('0x12'),JSON[_0x310f('0x14')](_0x38e904));if(_0x38e904[_0x310f('0x15')]){if(_0x38e904[_0x310f('0x15')]['code']===0x1f4){logger['error'](_0x310f('0x11'),_0x37bfaa,_0x38e904[_0x310f('0x15')]['message']);return _0x5d8459(_0x38e904[_0x310f('0x15')][_0x310f('0x16')]);}logger[_0x310f('0x15')]('SquareProject,\x20%s,\x20%s',_0x37bfaa,_0x38e904[_0x310f('0x15')]['message']);return _0x343832(_0x38e904[_0x310f('0x15')][_0x310f('0x16')]);}else{logger[_0x310f('0x10')](_0x310f('0x11'),_0x37bfaa,_0x310f('0x12'));_0x343832(_0x38e904[_0x310f('0x17')][_0x310f('0x16')]);}})['catch'](function(_0x411257){logger[_0x310f('0x15')]('SquareProject,\x20%s,\x20%s',_0x37bfaa,_0x411257);_0x5d8459(_0x411257);});});}exports[_0x310f('0x18')]=function(_0x3717ff){var _0x40896b=this;return new Promise(function(_0x4c545e,_0x3c27fd){return db[_0x310f('0x19')][_0x310f('0x1a')]({'raw':_0x3717ff['options']?_0x3717ff[_0x310f('0x1b')][_0x310f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3717ff[_0x310f('0x1b')]?_0x3717ff['options'][_0x310f('0x1d')]||null:null,'attributes':_0x3717ff['options']?_0x3717ff['options']['attributes']||null:null,'include':_0x3717ff[_0x310f('0x1b')]?_0x3717ff[_0x310f('0x1b')][_0x310f('0x1e')]?_['map'](_0x3717ff[_0x310f('0x1b')][_0x310f('0x1e')],function(_0x526685){return{'model':db[_0x526685[_0x310f('0x1f')]],'as':_0x526685['as'],'attributes':_0x526685[_0x310f('0x20')],'include':_0x526685[_0x310f('0x1e')]?_['map'](_0x526685[_0x310f('0x1e')],function(_0x21a8b3){return{'model':db[_0x21a8b3[_0x310f('0x1f')]],'as':_0x21a8b3['as'],'attributes':_0x21a8b3[_0x310f('0x20')],'include':_0x21a8b3['include']?_[_0x310f('0x21')](_0x21a8b3['include'],function(_0x4f52ee){return{'model':db[_0x4f52ee['model']],'as':_0x4f52ee['as'],'attributes':_0x4f52ee[_0x310f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x310f('0xf')](function(_0x3f24ee){logger[_0x310f('0x10')](_0x310f('0x18'),_0x3717ff);logger[_0x310f('0x13')](_0x310f('0x18'),_0x3717ff,JSON[_0x310f('0x14')](_0x3f24ee));_0x4c545e(_0x3f24ee);})[_0x310f('0x22')](function(_0x562240){logger['error']('ShowSquareProject',_0x562240[_0x310f('0x16')],_0x3717ff);_0x3c27fd(_0x40896b[_0x310f('0x15')](0x1f4,_0x562240[_0x310f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c29ede3..6febb49 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['remove','update','emit','removeListener','length','save'];(function(_0x1a68db,_0x5e50f1){var _0x4fadc6=function(_0x2869a7){while(--_0x2869a7){_0x1a68db['push'](_0x1a68db['shift']());}};_0x4fadc6(++_0x5e50f1);}(_0x1967,0x173));var _0x7196=function(_0x98c809,_0x2280dd){_0x98c809=_0x98c809-0x0;var _0x349dbe=_0x1967[_0x98c809];return _0x349dbe;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2')];function createListener(_0x35803d,_0x3319fa){return function(_0xa80a3f){_0x3319fa[_0x7196('0x3')](_0x35803d,_0xa80a3f);};}function removeListener(_0x1aaddd,_0x458ae8){return function(){SquareProjectEvents[_0x7196('0x4')](_0x1aaddd,_0x458ae8);};}exports['register']=function(_0x36b01e){for(var _0x186175=0x0,_0x194746=events[_0x7196('0x5')];_0x186175<_0x194746;_0x186175++){var _0x266a6e=events[_0x186175];var _0xad78a=createListener('squareProject:'+_0x266a6e,_0x36b01e);SquareProjectEvents['on'](_0x266a6e,_0xad78a);}}; \ No newline at end of file +var _0xc6ac=['removeListener','register','length','./squareProject.events','save','remove','update','emit'];(function(_0x1984ee,_0x4e1b5e){var _0x5c200b=function(_0x34b5c2){while(--_0x34b5c2){_0x1984ee['push'](_0x1984ee['shift']());}};_0x5c200b(++_0x4e1b5e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4a64f7,_0x3a838c){_0x4a64f7=_0x4a64f7-0x0;var _0x3a864d=_0xc6ac[_0x4a64f7];return _0x3a864d;};'use strict';var SquareProjectEvents=require(_0xcc6a('0x0'));var events=[_0xcc6a('0x1'),_0xcc6a('0x2'),_0xcc6a('0x3')];function createListener(_0x276972,_0x279d85){return function(_0x17d786){_0x279d85[_0xcc6a('0x4')](_0x276972,_0x17d786);};}function removeListener(_0x297643,_0x22ee99){return function(){SquareProjectEvents[_0xcc6a('0x5')](_0x297643,_0x22ee99);};}exports[_0xcc6a('0x6')]=function(_0x12330e){for(var _0x197bd7=0x0,_0x5f3887=events[_0xcc6a('0x7')];_0x197bd7<_0x5f3887;_0x197bd7++){var _0x11b919=events[_0x197bd7];var _0xf02261=createListener('squareProject:'+_0x11b919,_0x12330e);SquareProjectEvents['on'](_0x11b919,_0xf02261);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 016c38f..7654f30 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f2=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','post','put','/:id','update'];(function(_0x45ccbd,_0x97b4cb){var _0x31832b=function(_0x1bebe4){while(--_0x1bebe4){_0x45ccbd['push'](_0x45ccbd['shift']());}};_0x31832b(++_0x97b4cb);}(_0x28f2,0x193));var _0x228f=function(_0x3995cc,_0x3ed0d5){_0x3995cc=_0x3995cc-0x0;var _0x3afdb4=_0x28f2[_0x3995cc];return _0x3afdb4;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var fs_extra=require(_0x228f('0x5'));var auth=require(_0x228f('0x6'));var interaction=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var controller=require(_0x228f('0x9'));router[_0x228f('0xa')]('/',auth[_0x228f('0xb')](),controller['index']);router[_0x228f('0xa')]('/:id',auth[_0x228f('0xb')](),controller[_0x228f('0xc')]);router[_0x228f('0xa')]('/:id/download',auth[_0x228f('0xb')](),controller['download']);router[_0x228f('0xd')]('/',auth[_0x228f('0xb')](),controller['create']);router[_0x228f('0xe')](_0x228f('0xf'),auth[_0x228f('0xb')](),controller[_0x228f('0x10')]);router[_0x228f('0x11')]('/:id',auth[_0x228f('0xb')](),controller[_0x228f('0x12')]);module[_0x228f('0x13')]=router; \ No newline at end of file +var _0xdec3=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','post','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x165cd3,_0x526d11){var _0x36ee51=function(_0x263261){while(--_0x263261){_0x165cd3['push'](_0x165cd3['shift']());}};_0x36ee51(++_0x526d11);}(_0xdec3,0x89));var _0x3dec=function(_0xe9ae0b,_0x35dc88){_0xe9ae0b=_0xe9ae0b-0x0;var _0x2ff178=_0xdec3[_0xe9ae0b];return _0x2ff178;};'use strict';var multer=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var timeout=require(_0x3dec('0x2'));var express=require(_0x3dec('0x3'));var router=express['Router']();var fs_extra=require(_0x3dec('0x4'));var auth=require(_0x3dec('0x5'));var interaction=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var controller=require('./squareRecording.controller');router[_0x3dec('0x8')]('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0xa')]);router[_0x3dec('0x8')](_0x3dec('0xb'),auth[_0x3dec('0x9')](),controller[_0x3dec('0xc')]);router['get'](_0x3dec('0xd'),auth[_0x3dec('0x9')](),controller['download']);router[_0x3dec('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3dec('0xf')](_0x3dec('0xb'),auth['isAuthenticated'](),controller[_0x3dec('0x10')]);router[_0x3dec('0x11')]('/:id',auth[_0x3dec('0x9')](),controller[_0x3dec('0x12')]);module[_0x3dec('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1aed130..73d3ef8 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8292=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x3d1fd1,_0x546622){var _0x544edc=function(_0x44c916){while(--_0x44c916){_0x3d1fd1['push'](_0x3d1fd1['shift']());}};_0x544edc(++_0x546622);}(_0x8292,0x14c));var _0x2829=function(_0x5358cd,_0x293fd6){_0x5358cd=_0x5358cd-0x0;var _0xc144e2=_0x8292[_0x5358cd];return _0xc144e2;};'use strict';var Sequelize=require('sequelize');module[_0x2829('0x0')]={'uniqueid':{'type':Sequelize[_0x2829('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2829('0x1')]},'context':{'type':Sequelize[_0x2829('0x1')]},'extension':{'type':Sequelize[_0x2829('0x1')]},'priority':{'type':Sequelize[_0x2829('0x1')]},'accountcode':{'type':Sequelize[_0x2829('0x1')]},'dnid':{'type':Sequelize[_0x2829('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x2829('0x1')]},'filename':{'type':Sequelize[_0x2829('0x1')]},'savePath':{'type':Sequelize[_0x2829('0x1')]},'format':{'type':Sequelize[_0x2829('0x2')],'get':function(){var _0x20de64='';var _0x50de53=this[_0x2829('0x3')](_0x2829('0x4'));if(_0x50de53){_0x20de64=_0x50de53[_0x2829('0x5')](_0x50de53[_0x2829('0x6')]('.'));}return _0x20de64;}}}; \ No newline at end of file +var _0x7c27=['getDataValue','savePath','STRING','VIRTUAL'];(function(_0xf5eaa0,_0x5bfa29){var _0x47039e=function(_0x4b47a6){while(--_0x4b47a6){_0xf5eaa0['push'](_0xf5eaa0['shift']());}};_0x47039e(++_0x5bfa29);}(_0x7c27,0x14a));var _0x77c2=function(_0x3cab38,_0x439e61){_0x3cab38=_0x3cab38-0x0;var _0x187d60=_0x7c27[_0x3cab38];return _0x187d60;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x77c2('0x0')]},'callerid':{'type':Sequelize[_0x77c2('0x0')]},'calleridname':{'type':Sequelize[_0x77c2('0x0')]},'context':{'type':Sequelize[_0x77c2('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x77c2('0x0')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x77c2('0x0')]},'projectName':{'type':Sequelize[_0x77c2('0x0')]},'saveName':{'type':Sequelize[_0x77c2('0x0')]},'filename':{'type':Sequelize[_0x77c2('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x77c2('0x1')],'get':function(){var _0x58db5a='';var _0x48ec81=this[_0x77c2('0x2')](_0x77c2('0x3'));if(_0x48ec81){_0x58db5a=_0x48ec81['substring'](_0x48ec81['lastIndexOf']('.'));}return _0x58db5a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a43ec3e..06edfd6 100644 --- a/server/api/squareRecording/squareRecording.controller.js +++ b/server/api/squareRecording/squareRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57c3=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','reject','update','then','destroy','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','include','catch','show','params','includeAll','create','download','uniqueid','find','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv'];(function(_0x1f3001,_0x1a0c65){var _0x43dc1d=function(_0x503e79){while(--_0x503e79){_0x1f3001['push'](_0x1f3001['shift']());}};_0x43dc1d(++_0x1a0c65);}(_0x57c3,0xc2));var _0x357c=function(_0x191050,_0x23cfd3){_0x191050=_0x191050-0x0;var _0xcfd2aa=_0x57c3[_0x191050];return _0xcfd2aa;};'use strict';var emlformat=require(_0x357c('0x0'));var rimraf=require(_0x357c('0x1'));var zipdir=require(_0x357c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x357c('0x3'));var Mustache=require(_0x357c('0x4'));var util=require(_0x357c('0x5'));var path=require(_0x357c('0x6'));var sox=require('sox');var csv=require(_0x357c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x357c('0x8'));var _=require(_0x357c('0x9'));var squel=require(_0x357c('0xa'));var crypto=require(_0x357c('0xb'));var jsforce=require(_0x357c('0xc'));var deskjs=require(_0x357c('0xd'));var toCsv=require(_0x357c('0x7'));var querystring=require('querystring');var Papa=require(_0x357c('0xe'));var Redis=require(_0x357c('0xf'));var authService=require(_0x357c('0x10'));var qs=require(_0x357c('0x11'));var as=require(_0x357c('0x12'));var hardwareService=require(_0x357c('0x13'));var logger=require(_0x357c('0x14'))(_0x357c('0x15'));var utils=require(_0x357c('0x16'));var config=require(_0x357c('0x17'));var licenseUtil=require(_0x357c('0x18'));var db=require(_0x357c('0x19'))['db'];function respondWithStatusCode(_0x4e4741,_0x3a0a83){_0x3a0a83=_0x3a0a83||0xcc;return function(_0x2f6c24){if(_0x2f6c24){return _0x4e4741[_0x357c('0x1a')](_0x3a0a83);}return _0x4e4741['status'](_0x3a0a83)['end']();};}function respondWithResult(_0x45244b,_0x128da8){_0x128da8=_0x128da8||0xc8;return function(_0x1465ee){if(_0x1465ee){return _0x45244b[_0x357c('0x1b')](_0x128da8)[_0x357c('0x1c')](_0x1465ee);}};}function respondWithFilteredResult(_0xf2ccec,_0x53ef53){return function(_0x25de41){if(_0x25de41){var _0x288ed7=typeof _0x53ef53['offset']==='undefined'&&typeof _0x53ef53[_0x357c('0x1d')]===_0x357c('0x1e');var _0xfeb048=_0x25de41['count'];var _0x21d0f9=_0x288ed7?0x0:_0x53ef53[_0x357c('0x1f')];var _0x1ddb95=_0x288ed7?_0x25de41[_0x357c('0x20')]:_0x53ef53[_0x357c('0x1f')]+_0x53ef53[_0x357c('0x1d')];var _0xb60cf9;if(_0x1ddb95>=_0xfeb048){_0x1ddb95=_0xfeb048;_0xb60cf9=0xc8;}else{_0xb60cf9=0xce;}_0xf2ccec[_0x357c('0x1b')](_0xb60cf9);return _0xf2ccec[_0x357c('0x21')]('Content-Range',_0x21d0f9+'-'+_0x1ddb95+'/'+_0xfeb048)[_0x357c('0x1c')](_0x25de41);}return null;};}function patchUpdates(_0xe3956){return function(_0x496938){try{jsonpatch['apply'](_0x496938,_0xe3956,!![]);}catch(_0x12879b){return BPromise[_0x357c('0x22')](_0x12879b);}return _0x496938['save']();};}function saveUpdates(_0x437762,_0x1e6c7f){return function(_0x5e7f32){if(_0x5e7f32){return _0x5e7f32[_0x357c('0x23')](_0x437762)[_0x357c('0x24')](function(_0x39ffda){return _0x39ffda;});}return null;};}function removeEntity(_0x17da84,_0x324bff){return function(_0x1cbd6c){if(_0x1cbd6c){return _0x1cbd6c[_0x357c('0x25')]()[_0x357c('0x24')](function(){_0x17da84['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c9e1,_0xe1604d){return function(_0x134274){if(!_0x134274){_0x37c9e1[_0x357c('0x1a')](0x194);}return _0x134274;};}function handleError(_0x22fbff,_0x5287e4){_0x5287e4=_0x5287e4||0x1f4;return function(_0x40983e){logger['error'](_0x40983e[_0x357c('0x26')]);if(_0x40983e[_0x357c('0x27')]){delete _0x40983e[_0x357c('0x27')];}_0x22fbff['status'](_0x5287e4)[_0x357c('0x28')](_0x40983e);};}function getMustacheRender(_0x34d0a9,_0x34984f){return Mustache[_0x357c('0x29')](_0x34d0a9,_[_0x357c('0x2a')](_0x34984f[_0x357c('0x2b')],{'contact':_0x34984f[_0x357c('0x2c')],'message':_0x34984f[_0x357c('0x2d')],'agent':_0x34984f['agent'],'interaction':_0x34984f[_0x357c('0x2e')],'account':_0x34984f[_0x357c('0x2f')]}))||'';}exports[_0x357c('0x30')]=function(_0x4e9ea0,_0x288957){var _0x51b7f4={},_0x396740={},_0x859a04={'count':0x0,'rows':[]};var _0x2f52c3=_[_0x357c('0x31')](db[_0x357c('0x32')][_0x357c('0x33')],function(_0x3122b1){return{'name':_0x3122b1[_0x357c('0x34')],'type':_0x3122b1[_0x357c('0x35')][_0x357c('0x36')]};});_0x396740[_0x357c('0x37')]=_[_0x357c('0x31')](_0x2f52c3,_0x357c('0x27'));_0x396740['query']=_[_0x357c('0x38')](_0x4e9ea0[_0x357c('0x39')]);_0x396740['filters']=_[_0x357c('0x3a')](_0x396740[_0x357c('0x37')],_0x396740[_0x357c('0x39')]);_0x51b7f4[_0x357c('0x3b')]=_[_0x357c('0x3a')](_0x396740[_0x357c('0x37')],qs['fields'](_0x4e9ea0[_0x357c('0x39')][_0x357c('0x3c')]));_0x51b7f4[_0x357c('0x3b')]=_0x51b7f4['attributes'][_0x357c('0x3d')]?_0x51b7f4[_0x357c('0x3b')]:_0x396740[_0x357c('0x37')];if(!_0x4e9ea0['query']['hasOwnProperty'](_0x357c('0x3e'))){_0x51b7f4[_0x357c('0x1d')]=qs[_0x357c('0x1d')](_0x4e9ea0['query'][_0x357c('0x1d')]);_0x51b7f4['offset']=qs[_0x357c('0x1f')](_0x4e9ea0[_0x357c('0x39')][_0x357c('0x1f')]);}_0x51b7f4[_0x357c('0x3f')]=qs[_0x357c('0x40')](_0x4e9ea0['query'][_0x357c('0x40')]);_0x51b7f4[_0x357c('0x41')]=qs[_0x357c('0x42')](_[_0x357c('0x43')](_0x4e9ea0[_0x357c('0x39')],_0x396740[_0x357c('0x42')]),_0x2f52c3);if(_0x4e9ea0[_0x357c('0x39')][_0x357c('0x44')]){_0x51b7f4[_0x357c('0x41')]=_['merge'](_0x51b7f4[_0x357c('0x41')],{'$or':_[_0x357c('0x31')](_0x2f52c3,function(_0x4b2544){if(_0x4b2544[_0x357c('0x35')]!==_0x357c('0x45')){var _0x462d9f={};_0x462d9f[_0x4b2544[_0x357c('0x27')]]={'$like':'%'+_0x4e9ea0['query']['filter']+'%'};return _0x462d9f;}})});}_0x51b7f4=_[_0x357c('0x2a')]({},_0x51b7f4,_0x4e9ea0[_0x357c('0x46')]);var _0xee2bd4={'where':_0x51b7f4[_0x357c('0x41')]};return db[_0x357c('0x32')][_0x357c('0x20')](_0xee2bd4)[_0x357c('0x24')](function(_0x56f410){_0x859a04[_0x357c('0x20')]=_0x56f410;if(_0x4e9ea0[_0x357c('0x39')]['includeAll']){_0x51b7f4[_0x357c('0x47')]=[{'all':!![]}];}return db[_0x357c('0x32')]['findAll'](_0x51b7f4);})[_0x357c('0x24')](function(_0xaab73f){_0x859a04['rows']=_0xaab73f;return _0x859a04;})[_0x357c('0x24')](respondWithFilteredResult(_0x288957,_0x51b7f4))[_0x357c('0x48')](handleError(_0x288957,null));};exports[_0x357c('0x49')]=function(_0x32311a,_0x51b128){var _0x1e8424={'raw':!![],'where':{'id':_0x32311a[_0x357c('0x4a')]['id']}},_0x29114d={};_0x29114d[_0x357c('0x37')]=_[_0x357c('0x38')](db[_0x357c('0x32')][_0x357c('0x33')]);_0x29114d['query']=_[_0x357c('0x38')](_0x32311a['query']);_0x29114d[_0x357c('0x42')]=_['intersection'](_0x29114d[_0x357c('0x37')],_0x29114d[_0x357c('0x39')]);_0x1e8424[_0x357c('0x3b')]=_[_0x357c('0x3a')](_0x29114d['model'],qs['fields'](_0x32311a[_0x357c('0x39')]['fields']));_0x1e8424[_0x357c('0x3b')]=_0x1e8424['attributes']['length']?_0x1e8424[_0x357c('0x3b')]:_0x29114d[_0x357c('0x37')];if(_0x32311a[_0x357c('0x39')][_0x357c('0x4b')]){_0x1e8424[_0x357c('0x47')]=[{'all':!![]}];}_0x1e8424=_[_0x357c('0x2a')]({},_0x1e8424,_0x32311a['options']);return db[_0x357c('0x32')]['find'](_0x1e8424)[_0x357c('0x24')](handleEntityNotFound(_0x51b128,null))[_0x357c('0x24')](respondWithResult(_0x51b128,null))[_0x357c('0x48')](handleError(_0x51b128,null));};exports[_0x357c('0x4c')]=function(_0x44d8e6,_0x30387a){return db[_0x357c('0x32')][_0x357c('0x4c')](_0x44d8e6['body'],{})[_0x357c('0x24')](respondWithResult(_0x30387a,0xc9))[_0x357c('0x48')](handleError(_0x30387a,null));};exports[_0x357c('0x23')]=function(_0x15a9a1,_0x2ad2bb){if(_0x15a9a1['body']['id']){delete _0x15a9a1[_0x357c('0x2b')]['id'];}return db[_0x357c('0x32')]['find']({'where':{'id':_0x15a9a1[_0x357c('0x4a')]['id']}})[_0x357c('0x24')](handleEntityNotFound(_0x2ad2bb,null))[_0x357c('0x24')](saveUpdates(_0x15a9a1[_0x357c('0x2b')],null))[_0x357c('0x24')](respondWithResult(_0x2ad2bb,null))[_0x357c('0x48')](handleError(_0x2ad2bb,null));};exports[_0x357c('0x4d')]=function(_0x4b097b,_0x44420c,_0xd87912){var _0x53c8e7=require('../../components/encryptor');var _0x31a741=![];var _0x1282b2={};if(_0x4b097b[_0x357c('0x39')][_0x357c('0x35')]&&_0x4b097b[_0x357c('0x39')]['type']===_0x357c('0x4e')){_0x1282b2[_0x357c('0x4e')]=_0x4b097b['params']['id'];}else{_0x1282b2['id']=_0x4b097b[_0x357c('0x4a')]['id'];}return db[_0x357c('0x32')][_0x357c('0x4f')]({'where':_0x1282b2,'attributes':['id',_0x357c('0x50'),_0x357c('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x44420c,null))[_0x357c('0x24')](function(_0x4097aa){if(_0x4097aa){var _0x589ced=_0x4097aa[_0x357c('0x50')];var _0x2d0d50=util['format'](_0x357c('0x52'),_0x589ced);if(fs[_0x357c('0x53')](_0x2d0d50)){_0x31a741=!![];return _0x53c8e7[_0x357c('0x54')](_0x2d0d50,_0x589ced,config[_0x357c('0x55')][_0x357c('0x56')])[_0x357c('0x24')](function(){return _0x4097aa;});}return _0x4097aa;}})['then'](function(_0x55d89e){if(_0x55d89e){var _0xcb1afe=_0x55d89e[_0x357c('0x50')];if(!fs[_0x357c('0x53')](_0xcb1afe)){throw new db[(_0x357c('0x57'))][(_0x357c('0x58'))](_0x357c('0x59'));}if(_0x55d89e['filename']){return _0x44420c[_0x357c('0x4d')](_0xcb1afe,_0x55d89e[_0x357c('0x51')]+path[_0x357c('0x5a')](_0xcb1afe),function(){if(_0x31a741){fs[_0x357c('0x5b')](_0xcb1afe);}});}else{return _0x44420c[_0x357c('0x4d')](_0xcb1afe,function(_0x32363){if(_0x31a741){fs[_0x357c('0x5b')](_0xcb1afe);}});}}})[_0x357c('0x48')](function(_0x44cb19){if(_0x44cb19[_0x357c('0x2d')]===_0x357c('0x59')){_0x44420c[_0x357c('0x1b')](0x194)[_0x357c('0x28')](_0x357c('0x5c'));}else{return handleError(_0x44420c,null);}});};exports[_0x357c('0x25')]=function(_0x5b209d,_0x4f1e70){return db[_0x357c('0x32')][_0x357c('0x4f')]({'where':{'id':_0x5b209d['params']['id']}})[_0x357c('0x24')](function(_0xd99695){if(_[_0x357c('0x5d')](_0xd99695)){throw new ReferenceError(_0x357c('0x5e'));}return _0xd99695;})[_0x357c('0x24')](function(_0x233e64){var _0x40e0d0=_0x233e64[_0x357c('0x50')];logger[_0x357c('0x5f')](_0x357c('0x60'),_0x40e0d0);if(!_['isNil'](_0x233e64[_0x357c('0x50')])&&fs[_0x357c('0x53')](_0x40e0d0)){logger[_0x357c('0x5f')](_0x357c('0x61')+_0x40e0d0+_0x357c('0x62'));fs['unlinkSync'](_0x40e0d0);}_0x40e0d0=_0x40e0d0+_0x357c('0x63');if(!_[_0x357c('0x5d')](_0x233e64[_0x357c('0x50')])&&fs[_0x357c('0x53')](_0x40e0d0)){logger['info'](_0x357c('0x61')+_0x40e0d0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x357c('0x64')](_0x40e0d0);}return _0x233e64;})['then'](function(_0x394ecb){if(!_0x394ecb)throw new InternalError();return _0x394ecb[_0x357c('0x25')]();})[_0x357c('0x24')](function(){_0x4f1e70['status'](0xcc)['end']();})[_0x357c('0x48')](handleError(_0x4f1e70,null));}; \ No newline at end of file +var _0x723c=['order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','rawAttributes','fields','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','existsSync','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','unlink','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','render','merge','contact','message','agent','interaction','index','SquareRecording','type','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit'];(function(_0x201caa,_0x478ab0){var _0xed8d18=function(_0x59856a){while(--_0x59856a){_0x201caa['push'](_0x201caa['shift']());}};_0xed8d18(++_0x478ab0);}(_0x723c,0x1ad));var _0xc723=function(_0x1dcd59,_0x50dc65){_0x1dcd59=_0x1dcd59-0x0;var _0x2abe36=_0x723c[_0x1dcd59];return _0x2abe36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc723('0x0'));var zipdir=require(_0xc723('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc723('0x2'));var moment=require('moment');var BPromise=require(_0xc723('0x3'));var Mustache=require(_0xc723('0x4'));var util=require(_0xc723('0x5'));var path=require(_0xc723('0x6'));var sox=require(_0xc723('0x7'));var csv=require(_0xc723('0x8'));var ejs=require(_0xc723('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc723('0xa'));var squel=require(_0xc723('0xb'));var crypto=require('crypto');var jsforce=require(_0xc723('0xc'));var deskjs=require(_0xc723('0xd'));var toCsv=require(_0xc723('0x8'));var querystring=require(_0xc723('0xe'));var Papa=require(_0xc723('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc723('0x10'));var as=require(_0xc723('0x11'));var hardwareService=require(_0xc723('0x12'));var logger=require(_0xc723('0x13'))('api');var utils=require(_0xc723('0x14'));var config=require(_0xc723('0x15'));var licenseUtil=require(_0xc723('0x16'));var db=require(_0xc723('0x17'))['db'];function respondWithStatusCode(_0x3f4842,_0x5cffb4){_0x5cffb4=_0x5cffb4||0xcc;return function(_0x605b42){if(_0x605b42){return _0x3f4842[_0xc723('0x18')](_0x5cffb4);}return _0x3f4842[_0xc723('0x19')](_0x5cffb4)[_0xc723('0x1a')]();};}function respondWithResult(_0x2c7596,_0x4a3d86){_0x4a3d86=_0x4a3d86||0xc8;return function(_0x2e8be7){if(_0x2e8be7){return _0x2c7596['status'](_0x4a3d86)['json'](_0x2e8be7);}};}function respondWithFilteredResult(_0x1bb1ba,_0x110d83){return function(_0x212a77){if(_0x212a77){var _0x309574=typeof _0x110d83[_0xc723('0x1b')]===_0xc723('0x1c')&&typeof _0x110d83[_0xc723('0x1d')]===_0xc723('0x1c');var _0x5345a4=_0x212a77[_0xc723('0x1e')];var _0x41b4af=_0x309574?0x0:_0x110d83[_0xc723('0x1b')];var _0x100410=_0x309574?_0x212a77['count']:_0x110d83['offset']+_0x110d83[_0xc723('0x1d')];var _0x298470;if(_0x100410>=_0x5345a4){_0x100410=_0x5345a4;_0x298470=0xc8;}else{_0x298470=0xce;}_0x1bb1ba[_0xc723('0x19')](_0x298470);return _0x1bb1ba[_0xc723('0x1f')](_0xc723('0x20'),_0x41b4af+'-'+_0x100410+'/'+_0x5345a4)['json'](_0x212a77);}return null;};}function patchUpdates(_0x341584){return function(_0x23988a){try{jsonpatch[_0xc723('0x21')](_0x23988a,_0x341584,!![]);}catch(_0x172cf0){return BPromise[_0xc723('0x22')](_0x172cf0);}return _0x23988a[_0xc723('0x23')]();};}function saveUpdates(_0x38b980,_0x26b307){return function(_0x1de575){if(_0x1de575){return _0x1de575[_0xc723('0x24')](_0x38b980)[_0xc723('0x25')](function(_0xf77cc5){return _0xf77cc5;});}return null;};}function removeEntity(_0x545309,_0x16ae56){return function(_0x4cd1ee){if(_0x4cd1ee){return _0x4cd1ee[_0xc723('0x26')]()[_0xc723('0x25')](function(){_0x545309[_0xc723('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41fb45,_0x1a4811){return function(_0x4ed3ca){if(!_0x4ed3ca){_0x41fb45['sendStatus'](0x194);}return _0x4ed3ca;};}function handleError(_0x38adbe,_0xddf5bc){_0xddf5bc=_0xddf5bc||0x1f4;return function(_0x128261){logger[_0xc723('0x27')](_0x128261[_0xc723('0x28')]);if(_0x128261[_0xc723('0x29')]){delete _0x128261[_0xc723('0x29')];}_0x38adbe[_0xc723('0x19')](_0xddf5bc)['send'](_0x128261);};}function getMustacheRender(_0x567895,_0x2ccef6){return Mustache[_0xc723('0x2a')](_0x567895,_[_0xc723('0x2b')](_0x2ccef6['body'],{'contact':_0x2ccef6[_0xc723('0x2c')],'message':_0x2ccef6[_0xc723('0x2d')],'agent':_0x2ccef6[_0xc723('0x2e')],'interaction':_0x2ccef6[_0xc723('0x2f')],'account':_0x2ccef6['account']}))||'';}exports[_0xc723('0x30')]=function(_0x13407b,_0x81801){var _0x5acc14={},_0x35f71e={},_0x288171={'count':0x0,'rows':[]};var _0x389061=_['map'](db[_0xc723('0x31')]['rawAttributes'],function(_0x562739){return{'name':_0x562739['fieldName'],'type':_0x562739[_0xc723('0x32')][_0xc723('0x33')]};});_0x35f71e['model']=_[_0xc723('0x34')](_0x389061,_0xc723('0x29'));_0x35f71e[_0xc723('0x35')]=_[_0xc723('0x36')](_0x13407b[_0xc723('0x35')]);_0x35f71e[_0xc723('0x37')]=_[_0xc723('0x38')](_0x35f71e[_0xc723('0x39')],_0x35f71e[_0xc723('0x35')]);_0x5acc14[_0xc723('0x3a')]=_[_0xc723('0x38')](_0x35f71e[_0xc723('0x39')],qs['fields'](_0x13407b[_0xc723('0x35')]['fields']));_0x5acc14['attributes']=_0x5acc14[_0xc723('0x3a')]['length']?_0x5acc14['attributes']:_0x35f71e[_0xc723('0x39')];if(!_0x13407b[_0xc723('0x35')][_0xc723('0x3b')](_0xc723('0x3c'))){_0x5acc14['limit']=qs[_0xc723('0x1d')](_0x13407b[_0xc723('0x35')][_0xc723('0x1d')]);_0x5acc14[_0xc723('0x1b')]=qs[_0xc723('0x1b')](_0x13407b['query'][_0xc723('0x1b')]);}_0x5acc14[_0xc723('0x3d')]=qs[_0xc723('0x3e')](_0x13407b[_0xc723('0x35')][_0xc723('0x3e')]);_0x5acc14['where']=qs[_0xc723('0x37')](_['pick'](_0x13407b[_0xc723('0x35')],_0x35f71e[_0xc723('0x37')]),_0x389061);if(_0x13407b[_0xc723('0x35')][_0xc723('0x3f')]){_0x5acc14[_0xc723('0x40')]=_['merge'](_0x5acc14[_0xc723('0x40')],{'$or':_[_0xc723('0x34')](_0x389061,function(_0x8208e5){if(_0x8208e5[_0xc723('0x32')]!==_0xc723('0x41')){var _0x225c43={};_0x225c43[_0x8208e5['name']]={'$like':'%'+_0x13407b['query'][_0xc723('0x3f')]+'%'};return _0x225c43;}})});}_0x5acc14=_[_0xc723('0x2b')]({},_0x5acc14,_0x13407b[_0xc723('0x42')]);var _0x168e24={'where':_0x5acc14[_0xc723('0x40')]};return db['SquareRecording'][_0xc723('0x1e')](_0x168e24)[_0xc723('0x25')](function(_0x12bed1){_0x288171[_0xc723('0x1e')]=_0x12bed1;if(_0x13407b[_0xc723('0x35')][_0xc723('0x43')]){_0x5acc14[_0xc723('0x44')]=[{'all':!![]}];}return db[_0xc723('0x31')][_0xc723('0x45')](_0x5acc14);})[_0xc723('0x25')](function(_0x5943d6){_0x288171['rows']=_0x5943d6;return _0x288171;})['then'](respondWithFilteredResult(_0x81801,_0x5acc14))[_0xc723('0x46')](handleError(_0x81801,null));};exports['show']=function(_0x926e98,_0x26ad1e){var _0xcc18d5={'raw':!![],'where':{'id':_0x926e98['params']['id']}},_0x5cc27c={};_0x5cc27c['model']=_[_0xc723('0x36')](db[_0xc723('0x31')][_0xc723('0x47')]);_0x5cc27c[_0xc723('0x35')]=_['keys'](_0x926e98[_0xc723('0x35')]);_0x5cc27c[_0xc723('0x37')]=_[_0xc723('0x38')](_0x5cc27c[_0xc723('0x39')],_0x5cc27c[_0xc723('0x35')]);_0xcc18d5['attributes']=_[_0xc723('0x38')](_0x5cc27c[_0xc723('0x39')],qs[_0xc723('0x48')](_0x926e98[_0xc723('0x35')][_0xc723('0x48')]));_0xcc18d5[_0xc723('0x3a')]=_0xcc18d5[_0xc723('0x3a')]['length']?_0xcc18d5[_0xc723('0x3a')]:_0x5cc27c[_0xc723('0x39')];if(_0x926e98[_0xc723('0x35')]['includeAll']){_0xcc18d5[_0xc723('0x44')]=[{'all':!![]}];}_0xcc18d5=_[_0xc723('0x2b')]({},_0xcc18d5,_0x926e98[_0xc723('0x42')]);return db[_0xc723('0x31')][_0xc723('0x49')](_0xcc18d5)[_0xc723('0x25')](handleEntityNotFound(_0x26ad1e,null))[_0xc723('0x25')](respondWithResult(_0x26ad1e,null))[_0xc723('0x46')](handleError(_0x26ad1e,null));};exports[_0xc723('0x4a')]=function(_0x1ba868,_0xa06e37){return db[_0xc723('0x31')]['create'](_0x1ba868['body'],{})[_0xc723('0x25')](respondWithResult(_0xa06e37,0xc9))['catch'](handleError(_0xa06e37,null));};exports[_0xc723('0x24')]=function(_0x2938d3,_0x1e6d72){if(_0x2938d3[_0xc723('0x4b')]['id']){delete _0x2938d3['body']['id'];}return db[_0xc723('0x31')][_0xc723('0x49')]({'where':{'id':_0x2938d3[_0xc723('0x4c')]['id']}})[_0xc723('0x25')](handleEntityNotFound(_0x1e6d72,null))[_0xc723('0x25')](saveUpdates(_0x2938d3[_0xc723('0x4b')],null))[_0xc723('0x25')](respondWithResult(_0x1e6d72,null))['catch'](handleError(_0x1e6d72,null));};exports[_0xc723('0x4d')]=function(_0x34d371,_0xe865a4,_0x2a6a4d){var _0x4627a4=require(_0xc723('0x4e'));var _0x5dfb4b=![];var _0x4ab440={};if(_0x34d371[_0xc723('0x35')][_0xc723('0x32')]&&_0x34d371['query'][_0xc723('0x32')]===_0xc723('0x4f')){_0x4ab440[_0xc723('0x4f')]=_0x34d371[_0xc723('0x4c')]['id'];}else{_0x4ab440['id']=_0x34d371[_0xc723('0x4c')]['id'];}return db[_0xc723('0x31')][_0xc723('0x49')]({'where':_0x4ab440,'attributes':['id',_0xc723('0x50'),'filename'],'raw':!![]})[_0xc723('0x25')](handleEntityNotFound(_0xe865a4,null))[_0xc723('0x25')](function(_0x56ed6f){if(_0x56ed6f){var _0x39686a=_0x56ed6f[_0xc723('0x50')];var _0x2ca8ad=util['format']('%s.cypher',_0x39686a);if(fs[_0xc723('0x51')](_0x2ca8ad)){_0x5dfb4b=!![];return _0x4627a4[_0xc723('0x52')](_0x2ca8ad,_0x39686a,config['secrets']['recording'])['then'](function(){return _0x56ed6f;});}return _0x56ed6f;}})[_0xc723('0x25')](function(_0x48784e){if(_0x48784e){var _0x4d99c2=_0x48784e['savePath'];if(!fs[_0xc723('0x51')](_0x4d99c2)){throw new db[(_0xc723('0x53'))][(_0xc723('0x54'))](_0xc723('0x55'));}if(_0x48784e['filename']){return _0xe865a4[_0xc723('0x4d')](_0x4d99c2,_0x48784e[_0xc723('0x56')]+path['extname'](_0x4d99c2),function(){if(_0x5dfb4b){fs['unlink'](_0x4d99c2);}});}else{return _0xe865a4[_0xc723('0x4d')](_0x4d99c2,function(_0x2395b3){if(_0x5dfb4b){fs[_0xc723('0x57')](_0x4d99c2);}});}}})[_0xc723('0x46')](function(_0x264c31){if(_0x264c31['message']===_0xc723('0x55')){_0xe865a4['status'](0x194)[_0xc723('0x58')](_0xc723('0x59'));}else{return handleError(_0xe865a4,null);}});};exports['destroy']=function(_0x5ef4dd,_0x2f110c){return db[_0xc723('0x31')]['find']({'where':{'id':_0x5ef4dd['params']['id']}})[_0xc723('0x25')](function(_0x49c2e5){if(_[_0xc723('0x5a')](_0x49c2e5)){throw new ReferenceError(_0xc723('0x5b'));}return _0x49c2e5;})[_0xc723('0x25')](function(_0x2a1a1e){var _0x1ea184=_0x2a1a1e[_0xc723('0x50')];logger[_0xc723('0x5c')](_0xc723('0x5d'),_0x1ea184);if(!_[_0xc723('0x5a')](_0x2a1a1e[_0xc723('0x50')])&&fs[_0xc723('0x51')](_0x1ea184)){logger['info'](_0xc723('0x5e')+_0x1ea184+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1ea184);}_0x1ea184=_0x1ea184+_0xc723('0x5f');if(!_[_0xc723('0x5a')](_0x2a1a1e['savePath'])&&fs['existsSync'](_0x1ea184)){logger[_0xc723('0x5c')](_0xc723('0x5e')+_0x1ea184+_0xc723('0x60'));fs[_0xc723('0x61')](_0x1ea184);}return _0x2a1a1e;})['then'](function(_0x690f6a){if(!_0x690f6a)throw new InternalError();return _0x690f6a[_0xc723('0x26')]();})[_0xc723('0x25')](function(){_0x2f110c[_0xc723('0x19')](0xcc)[_0xc723('0x1a')]();})[_0xc723('0x46')](handleError(_0x2f110c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a75db8a..c641f89 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7269=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x594bf8,_0x54a6f9){var _0x55a979=function(_0x4cbf45){while(--_0x4cbf45){_0x594bf8['push'](_0x594bf8['shift']());}};_0x55a979(++_0x54a6f9);}(_0x7269,0x76));var _0x9726=function(_0x579e0c,_0x1f2132){_0x579e0c=_0x579e0c-0x0;var _0x4e3f99=_0x7269[_0x579e0c];return _0x4e3f99;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var logger=require(_0x9726('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9726('0x3'));var rp=require(_0x9726('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9726('0x5'));var config=require(_0x9726('0x6'));var attributes=require(_0x9726('0x7'));module[_0x9726('0x8')]=function(_0x795889,_0x832cb){return _0x795889[_0x9726('0x9')](_0x9726('0xa'),attributes,{'tableName':_0x9726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa064=['SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','path','../../config/environment','./squareRecording.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa064,0x192));var _0x4a06=function(_0x52cfab,_0x1034b5){_0x52cfab=_0x52cfab-0x0;var _0x58f135=_0xa064[_0x52cfab];return _0x58f135;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var logger=require(_0x4a06('0x2'))(_0x4a06('0x3'));var moment=require(_0x4a06('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a06('0x5'));var rimraf=require('rimraf');var config=require(_0x4a06('0x6'));var attributes=require(_0x4a06('0x7'));module['exports']=function(_0x3f2099,_0x54c9ed){return _0x3f2099['define'](_0x4a06('0x8'),attributes,{'tableName':_0x4a06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index f4e1432..e250ef8 100644 --- a/server/api/squareRecording/squareRecording.rpc.js +++ b/server/api/squareRecording/squareRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1809=['create','body','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateSquareRecording','SquareRecording'];(function(_0x754ef9,_0x5b8b47){var _0x510562=function(_0x3b8107){while(--_0x3b8107){_0x754ef9['push'](_0x754ef9['shift']());}};_0x510562(++_0x5b8b47);}(_0x1809,0x183));var _0x9180=function(_0x8ec298,_0x42003f){_0x8ec298=_0x8ec298-0x0;var _0x1e86ef=_0x1809[_0x8ec298];return _0x1e86ef;};'use strict';var _=require(_0x9180('0x0'));var util=require('util');var moment=require(_0x9180('0x1'));var BPromise=require('bluebird');var rs=require(_0x9180('0x2'));var fs=require('fs');var Redis=require(_0x9180('0x3'));var db=require(_0x9180('0x4'))['db'];var utils=require(_0x9180('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9180('0x6'));var jayson=require(_0x9180('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2093e3,_0x4e7e07,_0xa6dee3){return new BPromise(function(_0xeed5fb,_0x37434e){return client[_0x9180('0x8')](_0x2093e3,_0xa6dee3)[_0x9180('0x9')](function(_0x49467d){logger['info'](_0x9180('0xa'),_0x4e7e07,_0x9180('0xb'));logger[_0x9180('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4e7e07,'request\x20sent',JSON[_0x9180('0xd')](_0x49467d));if(_0x49467d['error']){if(_0x49467d[_0x9180('0xe')][_0x9180('0xf')]===0x1f4){logger[_0x9180('0xe')](_0x9180('0xa'),_0x4e7e07,_0x49467d[_0x9180('0xe')][_0x9180('0x10')]);return _0x37434e(_0x49467d['error']['message']);}logger[_0x9180('0xe')](_0x9180('0xa'),_0x4e7e07,_0x49467d[_0x9180('0xe')][_0x9180('0x10')]);return _0xeed5fb(_0x49467d[_0x9180('0xe')]['message']);}else{logger[_0x9180('0x11')](_0x9180('0xa'),_0x4e7e07,'request\x20sent');_0xeed5fb(_0x49467d[_0x9180('0x12')][_0x9180('0x10')]);}})['catch'](function(_0x4517e6){logger['error'](_0x9180('0xa'),_0x4e7e07,_0x4517e6);_0x37434e(_0x4517e6);});});}exports[_0x9180('0x13')]=function(_0x2839b0){var _0x54e4c1=this;return new Promise(function(_0x22df9f,_0x3de2b0){return db[_0x9180('0x14')][_0x9180('0x15')](_0x2839b0[_0x9180('0x16')],{'raw':_0x2839b0['options']?_0x2839b0['options'][_0x9180('0x17')]===undefined?!![]:![]:!![]})[_0x9180('0x9')](function(_0x8c015c){logger['info']('CreateSquareRecording',_0x2839b0);logger[_0x9180('0xc')]('CreateSquareRecording',_0x2839b0,JSON[_0x9180('0xd')](_0x8c015c));_0x22df9f(_0x8c015c);})['catch'](function(_0x37577d){logger[_0x9180('0xe')](_0x9180('0x13'),_0x37577d[_0x9180('0x10')],_0x2839b0);_0x3de2b0(_0x54e4c1[_0x9180('0xe')](0x1f4,_0x37577d[_0x9180('0x10')]));});});}; \ No newline at end of file +var _0x535f=['../../config/environment','client','http','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','CreateSquareRecording','SquareRecording','create','body','options','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x4c832d,_0x16941f){var _0x54cc19=function(_0x514aeb){while(--_0x514aeb){_0x4c832d['push'](_0x4c832d['shift']());}};_0x54cc19(++_0x16941f);}(_0x535f,0x1c3));var _0xf535=function(_0x250b4d,_0x219d51){_0x250b4d=_0x250b4d-0x0;var _0x5a5bc5=_0x535f[_0x250b4d];return _0x5a5bc5;};'use strict';var _=require(_0xf535('0x0'));var util=require(_0xf535('0x1'));var moment=require(_0xf535('0x2'));var BPromise=require(_0xf535('0x3'));var rs=require(_0xf535('0x4'));var fs=require('fs');var Redis=require(_0xf535('0x5'));var db=require(_0xf535('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf535('0x7'));var config=require(_0xf535('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf535('0x9')][_0xf535('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b8df4,_0x5599a2,_0x1e5b6c){return new BPromise(function(_0x39598e,_0x33180d){return client['request'](_0x4b8df4,_0x1e5b6c)['then'](function(_0x19223e){logger[_0xf535('0xb')]('SquareRecording,\x20%s,\x20%s',_0x5599a2,_0xf535('0xc'));logger[_0xf535('0xd')](_0xf535('0xe'),_0x5599a2,'request\x20sent',JSON[_0xf535('0xf')](_0x19223e));if(_0x19223e[_0xf535('0x10')]){if(_0x19223e[_0xf535('0x10')][_0xf535('0x11')]===0x1f4){logger['error'](_0xf535('0x12'),_0x5599a2,_0x19223e[_0xf535('0x10')]['message']);return _0x33180d(_0x19223e[_0xf535('0x10')][_0xf535('0x13')]);}logger[_0xf535('0x10')](_0xf535('0x12'),_0x5599a2,_0x19223e[_0xf535('0x10')][_0xf535('0x13')]);return _0x39598e(_0x19223e[_0xf535('0x10')][_0xf535('0x13')]);}else{logger[_0xf535('0xb')](_0xf535('0x12'),_0x5599a2,_0xf535('0xc'));_0x39598e(_0x19223e[_0xf535('0x14')][_0xf535('0x13')]);}})['catch'](function(_0x587569){logger[_0xf535('0x10')](_0xf535('0x12'),_0x5599a2,_0x587569);_0x33180d(_0x587569);});});}exports[_0xf535('0x15')]=function(_0x494ef6){var _0x30abe8=this;return new Promise(function(_0x374944,_0x3d9c09){return db[_0xf535('0x16')][_0xf535('0x17')](_0x494ef6[_0xf535('0x18')],{'raw':_0x494ef6[_0xf535('0x19')]?_0x494ef6[_0xf535('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x389817){logger[_0xf535('0xb')]('CreateSquareRecording',_0x494ef6);logger['debug'](_0xf535('0x15'),_0x494ef6,JSON[_0xf535('0xf')](_0x389817));_0x374944(_0x389817);})[_0xf535('0x1a')](function(_0x91d655){logger[_0xf535('0x10')](_0xf535('0x15'),_0x91d655[_0xf535('0x13')],_0x494ef6);_0x3d9c09(_0x30abe8[_0xf535('0x10')](0x1f4,_0x91d655[_0xf535('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d5cd867..ef83156 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe260=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','/describe'];(function(_0x27293d,_0x2f0d91){var _0x247ddd=function(_0x8414eb){while(--_0x8414eb){_0x27293d['push'](_0x27293d['shift']());}};_0x247ddd(++_0x2f0d91);}(_0xe260,0xb0));var _0x0e26=function(_0x2cdb1c,_0x2bb39c){_0x2cdb1c=_0x2cdb1c-0x0;var _0x4e5b7a=_0xe260[_0x2cdb1c];return _0x4e5b7a;};'use strict';var multer=require(_0x0e26('0x0'));var util=require(_0x0e26('0x1'));var path=require(_0x0e26('0x2'));var timeout=require(_0x0e26('0x3'));var express=require('express');var router=express[_0x0e26('0x4')]();var fs_extra=require(_0x0e26('0x5'));var auth=require(_0x0e26('0x6'));var interaction=require(_0x0e26('0x7'));var config=require(_0x0e26('0x8'));var controller=require(_0x0e26('0x9'));router[_0x0e26('0xa')]('/',auth[_0x0e26('0xb')](),controller['index']);router[_0x0e26('0xa')](_0x0e26('0xc'),auth[_0x0e26('0xb')](),controller['describe']);router['get'](_0x0e26('0xd'),auth[_0x0e26('0xb')](),controller[_0x0e26('0xe')]);router[_0x0e26('0xf')]('/',auth[_0x0e26('0xb')](),controller[_0x0e26('0x10')]);router[_0x0e26('0x11')](_0x0e26('0xd'),auth[_0x0e26('0xb')](),controller['update']);router[_0x0e26('0x12')](_0x0e26('0xd'),auth[_0x0e26('0xb')](),controller[_0x0e26('0x13')]);module[_0x0e26('0x14')]=router; \ No newline at end of file +var _0x26b0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','describe','/:id','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','path'];(function(_0x1a1a09,_0x35b5b5){var _0x125bbc=function(_0x12d057){while(--_0x12d057){_0x1a1a09['push'](_0x1a1a09['shift']());}};_0x125bbc(++_0x35b5b5);}(_0x26b0,0x138));var _0x026b=function(_0x15b184,_0x2755fc){_0x15b184=_0x15b184-0x0;var _0x2b9049=_0x26b0[_0x15b184];return _0x2b9049;};'use strict';var multer=require(_0x026b('0x0'));var util=require(_0x026b('0x1'));var path=require(_0x026b('0x2'));var timeout=require(_0x026b('0x3'));var express=require(_0x026b('0x4'));var router=express[_0x026b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x026b('0x6'));var interaction=require(_0x026b('0x7'));var config=require(_0x026b('0x8'));var controller=require(_0x026b('0x9'));router[_0x026b('0xa')]('/',auth['isAuthenticated'](),controller[_0x026b('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x026b('0xc')]);router[_0x026b('0xa')](_0x026b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x026b('0xe')]('/',auth[_0x026b('0xf')](),controller[_0x026b('0x10')]);router['put'](_0x026b('0xd'),auth[_0x026b('0xf')](),controller[_0x026b('0x11')]);router[_0x026b('0x12')]('/:id',auth[_0x026b('0xf')](),controller[_0x026b('0x13')]);module[_0x026b('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index da6e2cc..17bc78a 100644 --- a/server/api/squareReport/squareReport.attributes.js +++ b/server/api/squareReport/squareReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8cd=['exports','STRING','DATE','sequelize'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd8cd,0x1ab));var _0xdd8c=function(_0x4f1571,_0x3b315a){_0x4f1571=_0x4f1571-0x0;var _0x29e0a8=_0xd8cd[_0x4f1571];return _0x29e0a8;};'use strict';var Sequelize=require(_0xdd8c('0x0'));module[_0xdd8c('0x1')]={'network':{'type':Sequelize[_0xdd8c('0x2')]},'network_script':{'type':Sequelize[_0xdd8c('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdd8c('0x2')]},'language':{'type':Sequelize[_0xdd8c('0x2')]},'type':{'type':Sequelize[_0xdd8c('0x2')]},'uniqueid':{'type':Sequelize[_0xdd8c('0x2')]},'version':{'type':Sequelize[_0xdd8c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdd8c('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xdd8c('0x2')]},'callington':{'type':Sequelize[_0xdd8c('0x2')]},'callingtns':{'type':Sequelize[_0xdd8c('0x2')]},'dnid':{'type':Sequelize[_0xdd8c('0x2')]},'rdnis':{'type':Sequelize[_0xdd8c('0x2')]},'context':{'type':Sequelize[_0xdd8c('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdd8c('0x2')]},'enhanced':{'type':Sequelize[_0xdd8c('0x2')]},'accountcode':{'type':Sequelize[_0xdd8c('0x2')]},'threadid':{'type':Sequelize[_0xdd8c('0x2')]},'project_name':{'type':Sequelize[_0xdd8c('0x2')]},'joinAt':{'type':Sequelize[_0xdd8c('0x3')]},'leaveAt':{'type':Sequelize[_0xdd8c('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2911=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4904ba,_0x46a38f){var _0x30d586=function(_0x146e8e){while(--_0x146e8e){_0x4904ba['push'](_0x4904ba['shift']());}};_0x30d586(++_0x46a38f);}(_0x2911,0x183));var _0x1291=function(_0xed06aa,_0x47f7ca){_0xed06aa=_0xed06aa-0x0;var _0x566ed7=_0x2911[_0xed06aa];return _0x566ed7;};'use strict';var Sequelize=require(_0x1291('0x0'));module[_0x1291('0x1')]={'network':{'type':Sequelize[_0x1291('0x2')]},'network_script':{'type':Sequelize[_0x1291('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1291('0x2')]},'language':{'type':Sequelize[_0x1291('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1291('0x2')]},'version':{'type':Sequelize[_0x1291('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1291('0x2')]},'callingpres':{'type':Sequelize[_0x1291('0x2')]},'callingani2':{'type':Sequelize[_0x1291('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x1291('0x2')]},'dnid':{'type':Sequelize[_0x1291('0x2')]},'rdnis':{'type':Sequelize[_0x1291('0x2')]},'context':{'type':Sequelize[_0x1291('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1291('0x2')]},'enhanced':{'type':Sequelize[_0x1291('0x2')]},'accountcode':{'type':Sequelize[_0x1291('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x1291('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x1291('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d69c3d0..f305545 100644 --- a/server/api/squareReport/squareReport.controller.js +++ b/server/api/squareReport/squareReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc698=['../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','error','stack','name','send','render','body','contact','message','agent','account','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SquareReport','findAll','show','params','includeAll','include','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x19eb0c,_0x3b185d){var _0x5273b6=function(_0x428521){while(--_0x428521){_0x19eb0c['push'](_0x19eb0c['shift']());}};_0x5273b6(++_0x3b185d);}(_0xc698,0x85));var _0x8c69=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xc698[_0xae01dd];return _0x8c26df;};'use strict';var emlformat=require(_0x8c69('0x0'));var rimraf=require(_0x8c69('0x1'));var zipdir=require(_0x8c69('0x2'));var jsonpatch=require(_0x8c69('0x3'));var rp=require(_0x8c69('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8c69('0x5'));var util=require('util');var path=require(_0x8c69('0x6'));var sox=require('sox');var csv=require(_0x8c69('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c69('0x8'));var squel=require(_0x8c69('0x9'));var crypto=require(_0x8c69('0xa'));var jsforce=require(_0x8c69('0xb'));var deskjs=require(_0x8c69('0xc'));var toCsv=require(_0x8c69('0x7'));var querystring=require(_0x8c69('0xd'));var Papa=require(_0x8c69('0xe'));var Redis=require(_0x8c69('0xf'));var authService=require(_0x8c69('0x10'));var qs=require(_0x8c69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c69('0x12'));var logger=require(_0x8c69('0x13'))(_0x8c69('0x14'));var utils=require('../../config/utils');var config=require(_0x8c69('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c69('0x16'))['db'];function respondWithStatusCode(_0x5886d3,_0x33e020){_0x33e020=_0x33e020||0xcc;return function(_0x5bbd63){if(_0x5bbd63){return _0x5886d3[_0x8c69('0x17')](_0x33e020);}return _0x5886d3['status'](_0x33e020)[_0x8c69('0x18')]();};}function respondWithResult(_0x44fd99,_0x5e8143){_0x5e8143=_0x5e8143||0xc8;return function(_0x1147cb){if(_0x1147cb){return _0x44fd99['status'](_0x5e8143)[_0x8c69('0x19')](_0x1147cb);}};}function respondWithFilteredResult(_0x30254b,_0x11f45f){return function(_0x3a765c){if(_0x3a765c){var _0x557918=typeof _0x11f45f[_0x8c69('0x1a')]===_0x8c69('0x1b')&&typeof _0x11f45f[_0x8c69('0x1c')]==='undefined';var _0x3cde3f=_0x3a765c[_0x8c69('0x1d')];var _0xfc7224=_0x557918?0x0:_0x11f45f[_0x8c69('0x1a')];var _0x5a816c=_0x557918?_0x3a765c[_0x8c69('0x1d')]:_0x11f45f[_0x8c69('0x1a')]+_0x11f45f[_0x8c69('0x1c')];var _0x32b90d;if(_0x5a816c>=_0x3cde3f){_0x5a816c=_0x3cde3f;_0x32b90d=0xc8;}else{_0x32b90d=0xce;}_0x30254b[_0x8c69('0x1e')](_0x32b90d);return _0x30254b['set'](_0x8c69('0x1f'),_0xfc7224+'-'+_0x5a816c+'/'+_0x3cde3f)['json'](_0x3a765c);}return null;};}function patchUpdates(_0x5bd3bf){return function(_0x2b2bbe){try{jsonpatch[_0x8c69('0x20')](_0x2b2bbe,_0x5bd3bf,!![]);}catch(_0x34229b){return BPromise[_0x8c69('0x21')](_0x34229b);}return _0x2b2bbe['save']();};}function saveUpdates(_0x327ce4,_0x34d2fd){return function(_0x9718bf){if(_0x9718bf){return _0x9718bf[_0x8c69('0x22')](_0x327ce4)[_0x8c69('0x23')](function(_0x160810){return _0x160810;});}return null;};}function removeEntity(_0x47c56c,_0x3fdadd){return function(_0x2590d6){if(_0x2590d6){return _0x2590d6['destroy']()[_0x8c69('0x23')](function(){_0x47c56c[_0x8c69('0x1e')](0xcc)[_0x8c69('0x18')]();});}};}function handleEntityNotFound(_0x5373b7,_0x4c6ed4){return function(_0x3d2a42){if(!_0x3d2a42){_0x5373b7['sendStatus'](0x194);}return _0x3d2a42;};}function handleError(_0x578197,_0x4cf682){_0x4cf682=_0x4cf682||0x1f4;return function(_0x37ba0e){logger[_0x8c69('0x24')](_0x37ba0e[_0x8c69('0x25')]);if(_0x37ba0e[_0x8c69('0x26')]){delete _0x37ba0e[_0x8c69('0x26')];}_0x578197[_0x8c69('0x1e')](_0x4cf682)[_0x8c69('0x27')](_0x37ba0e);};}function getMustacheRender(_0x30d2ef,_0x41e7b5){return Mustache[_0x8c69('0x28')](_0x30d2ef,_['merge'](_0x41e7b5[_0x8c69('0x29')],{'contact':_0x41e7b5[_0x8c69('0x2a')],'message':_0x41e7b5[_0x8c69('0x2b')],'agent':_0x41e7b5[_0x8c69('0x2c')],'interaction':_0x41e7b5['interaction'],'account':_0x41e7b5[_0x8c69('0x2d')]}))||'';}exports[_0x8c69('0x2e')]=function(_0x51d0dd,_0x3aad39){var _0x4e4e6a={},_0x2e0c47={},_0x557791={'count':0x0,'rows':[]};var _0x3fdee9=_['map'](db['SquareReport'][_0x8c69('0x2f')],function(_0x5b2f50){return{'name':_0x5b2f50[_0x8c69('0x30')],'type':_0x5b2f50[_0x8c69('0x31')]['key']};});_0x2e0c47[_0x8c69('0x32')]=_[_0x8c69('0x33')](_0x3fdee9,_0x8c69('0x26'));_0x2e0c47[_0x8c69('0x34')]=_[_0x8c69('0x35')](_0x51d0dd[_0x8c69('0x34')]);_0x2e0c47['filters']=_[_0x8c69('0x36')](_0x2e0c47[_0x8c69('0x32')],_0x2e0c47[_0x8c69('0x34')]);_0x4e4e6a[_0x8c69('0x37')]=_['intersection'](_0x2e0c47[_0x8c69('0x32')],qs[_0x8c69('0x38')](_0x51d0dd['query']['fields']));_0x4e4e6a['attributes']=_0x4e4e6a['attributes'][_0x8c69('0x39')]?_0x4e4e6a[_0x8c69('0x37')]:_0x2e0c47['model'];if(!_0x51d0dd['query']['hasOwnProperty'](_0x8c69('0x3a'))){_0x4e4e6a[_0x8c69('0x1c')]=qs['limit'](_0x51d0dd['query'][_0x8c69('0x1c')]);_0x4e4e6a[_0x8c69('0x1a')]=qs[_0x8c69('0x1a')](_0x51d0dd['query'][_0x8c69('0x1a')]);}_0x4e4e6a[_0x8c69('0x3b')]=qs[_0x8c69('0x3c')](_0x51d0dd[_0x8c69('0x34')][_0x8c69('0x3c')]);_0x4e4e6a[_0x8c69('0x3d')]=qs[_0x8c69('0x3e')](_['pick'](_0x51d0dd[_0x8c69('0x34')],_0x2e0c47[_0x8c69('0x3e')]),_0x3fdee9);if(_0x51d0dd['query'][_0x8c69('0x3f')]){_0x4e4e6a[_0x8c69('0x3d')]=_[_0x8c69('0x40')](_0x4e4e6a[_0x8c69('0x3d')],{'$or':_['map'](_0x3fdee9,function(_0x1cdb1d){if(_0x1cdb1d[_0x8c69('0x31')]!==_0x8c69('0x41')){var _0xab3cba={};_0xab3cba[_0x1cdb1d['name']]={'$like':'%'+_0x51d0dd[_0x8c69('0x34')][_0x8c69('0x3f')]+'%'};return _0xab3cba;}})});}_0x4e4e6a=_[_0x8c69('0x40')]({},_0x4e4e6a,_0x51d0dd[_0x8c69('0x42')]);var _0x2b6655={'where':_0x4e4e6a[_0x8c69('0x3d')]};return db[_0x8c69('0x43')]['count'](_0x2b6655)[_0x8c69('0x23')](function(_0x4c6cfa){_0x557791['count']=_0x4c6cfa;if(_0x51d0dd[_0x8c69('0x34')]['includeAll']){_0x4e4e6a['include']=[{'all':!![]}];}return db['SquareReport'][_0x8c69('0x44')](_0x4e4e6a);})[_0x8c69('0x23')](function(_0x3b50c7){_0x557791['rows']=_0x3b50c7;return _0x557791;})['then'](respondWithFilteredResult(_0x3aad39,_0x4e4e6a))['catch'](handleError(_0x3aad39,null));};exports[_0x8c69('0x45')]=function(_0x4848ce,_0x575a09){var _0x523519={'raw':!![],'where':{'id':_0x4848ce[_0x8c69('0x46')]['id']}},_0x45be52={};_0x45be52[_0x8c69('0x32')]=_[_0x8c69('0x35')](db[_0x8c69('0x43')]['rawAttributes']);_0x45be52['query']=_[_0x8c69('0x35')](_0x4848ce[_0x8c69('0x34')]);_0x45be52[_0x8c69('0x3e')]=_[_0x8c69('0x36')](_0x45be52[_0x8c69('0x32')],_0x45be52['query']);_0x523519[_0x8c69('0x37')]=_['intersection'](_0x45be52[_0x8c69('0x32')],qs[_0x8c69('0x38')](_0x4848ce['query'][_0x8c69('0x38')]));_0x523519[_0x8c69('0x37')]=_0x523519[_0x8c69('0x37')][_0x8c69('0x39')]?_0x523519['attributes']:_0x45be52[_0x8c69('0x32')];if(_0x4848ce[_0x8c69('0x34')][_0x8c69('0x47')]){_0x523519[_0x8c69('0x48')]=[{'all':!![]}];}_0x523519=_[_0x8c69('0x40')]({},_0x523519,_0x4848ce[_0x8c69('0x42')]);return db[_0x8c69('0x43')][_0x8c69('0x49')](_0x523519)[_0x8c69('0x23')](handleEntityNotFound(_0x575a09,null))[_0x8c69('0x23')](respondWithResult(_0x575a09,null))[_0x8c69('0x4a')](handleError(_0x575a09,null));};exports[_0x8c69('0x4b')]=function(_0x515f27,_0x3fbd61){return db[_0x8c69('0x43')]['create'](_0x515f27['body'],{})[_0x8c69('0x23')](respondWithResult(_0x3fbd61,0xc9))['catch'](handleError(_0x3fbd61,null));};exports[_0x8c69('0x22')]=function(_0x4a9ad1,_0x4f28a9){if(_0x4a9ad1['body']['id']){delete _0x4a9ad1['body']['id'];}return db[_0x8c69('0x43')][_0x8c69('0x49')]({'where':{'id':_0x4a9ad1['params']['id']}})['then'](handleEntityNotFound(_0x4f28a9,null))[_0x8c69('0x23')](saveUpdates(_0x4a9ad1[_0x8c69('0x29')],null))['then'](respondWithResult(_0x4f28a9,null))[_0x8c69('0x4a')](handleError(_0x4f28a9,null));};exports['destroy']=function(_0xe205dd,_0x3f04e9){return db['SquareReport'][_0x8c69('0x49')]({'where':{'id':_0xe205dd[_0x8c69('0x46')]['id']}})[_0x8c69('0x23')](handleEntityNotFound(_0x3f04e9,null))[_0x8c69('0x23')](removeEntity(_0x3f04e9,null))[_0x8c69('0x4a')](handleError(_0x3f04e9,null));};exports['describe']=function(_0x390d04,_0x57fc7b){return db[_0x8c69('0x43')][_0x8c69('0x4c')]()[_0x8c69('0x23')](respondWithResult(_0x57fc7b,null))['catch'](handleError(_0x57fc7b,null));}; \ No newline at end of file +var _0xb01a=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','merge','body','message','agent','interaction','account','index','SquareReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0x3956a8,_0x5b141f){var _0xde7098=function(_0x87ad33){while(--_0x87ad33){_0x3956a8['push'](_0x3956a8['shift']());}};_0xde7098(++_0x5b141f);}(_0xb01a,0x1a1));var _0xab01=function(_0x3d9ba4,_0x2bd45a){_0x3d9ba4=_0x3d9ba4-0x0;var _0x37404e=_0xb01a[_0x3d9ba4];return _0x37404e;};'use strict';var emlformat=require(_0xab01('0x0'));var rimraf=require(_0xab01('0x1'));var zipdir=require(_0xab01('0x2'));var jsonpatch=require(_0xab01('0x3'));var rp=require(_0xab01('0x4'));var moment=require(_0xab01('0x5'));var BPromise=require(_0xab01('0x6'));var Mustache=require(_0xab01('0x7'));var util=require(_0xab01('0x8'));var path=require(_0xab01('0x9'));var sox=require(_0xab01('0xa'));var csv=require(_0xab01('0xb'));var ejs=require(_0xab01('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab01('0xd'));var squel=require(_0xab01('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab01('0xf'));var toCsv=require(_0xab01('0xb'));var querystring=require('querystring');var Papa=require(_0xab01('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab01('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab01('0x12'));var logger=require(_0xab01('0x13'))('api');var utils=require(_0xab01('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xab01('0x15'))['db'];function respondWithStatusCode(_0x37088b,_0x1ededa){_0x1ededa=_0x1ededa||0xcc;return function(_0xe9d23c){if(_0xe9d23c){return _0x37088b[_0xab01('0x16')](_0x1ededa);}return _0x37088b[_0xab01('0x17')](_0x1ededa)[_0xab01('0x18')]();};}function respondWithResult(_0x39c46c,_0x509ceb){_0x509ceb=_0x509ceb||0xc8;return function(_0x4812c6){if(_0x4812c6){return _0x39c46c['status'](_0x509ceb)['json'](_0x4812c6);}};}function respondWithFilteredResult(_0x32001d,_0x4c0557){return function(_0x2bfa8a){if(_0x2bfa8a){var _0x2d9c23=typeof _0x4c0557[_0xab01('0x19')]===_0xab01('0x1a')&&typeof _0x4c0557['limit']===_0xab01('0x1a');var _0x5c1276=_0x2bfa8a[_0xab01('0x1b')];var _0xb59105=_0x2d9c23?0x0:_0x4c0557['offset'];var _0x5a9940=_0x2d9c23?_0x2bfa8a[_0xab01('0x1b')]:_0x4c0557[_0xab01('0x19')]+_0x4c0557[_0xab01('0x1c')];var _0x1d5af2;if(_0x5a9940>=_0x5c1276){_0x5a9940=_0x5c1276;_0x1d5af2=0xc8;}else{_0x1d5af2=0xce;}_0x32001d[_0xab01('0x17')](_0x1d5af2);return _0x32001d[_0xab01('0x1d')](_0xab01('0x1e'),_0xb59105+'-'+_0x5a9940+'/'+_0x5c1276)[_0xab01('0x1f')](_0x2bfa8a);}return null;};}function patchUpdates(_0x457e75){return function(_0x331daf){try{jsonpatch['apply'](_0x331daf,_0x457e75,!![]);}catch(_0x9208cc){return BPromise[_0xab01('0x20')](_0x9208cc);}return _0x331daf[_0xab01('0x21')]();};}function saveUpdates(_0xac3a88,_0x405c93){return function(_0x180344){if(_0x180344){return _0x180344[_0xab01('0x22')](_0xac3a88)[_0xab01('0x23')](function(_0x511cae){return _0x511cae;});}return null;};}function removeEntity(_0x3fba2e,_0x152d5e){return function(_0x27b430){if(_0x27b430){return _0x27b430[_0xab01('0x24')]()[_0xab01('0x23')](function(){_0x3fba2e[_0xab01('0x17')](0xcc)[_0xab01('0x18')]();});}};}function handleEntityNotFound(_0x55831d,_0x1efebe){return function(_0x16a719){if(!_0x16a719){_0x55831d[_0xab01('0x16')](0x194);}return _0x16a719;};}function handleError(_0x44d2f7,_0x27e549){_0x27e549=_0x27e549||0x1f4;return function(_0x46088d){logger[_0xab01('0x25')](_0x46088d['stack']);if(_0x46088d[_0xab01('0x26')]){delete _0x46088d[_0xab01('0x26')];}_0x44d2f7[_0xab01('0x17')](_0x27e549)[_0xab01('0x27')](_0x46088d);};}function getMustacheRender(_0x3bb7fc,_0x409fa1){return Mustache['render'](_0x3bb7fc,_[_0xab01('0x28')](_0x409fa1[_0xab01('0x29')],{'contact':_0x409fa1['contact'],'message':_0x409fa1[_0xab01('0x2a')],'agent':_0x409fa1[_0xab01('0x2b')],'interaction':_0x409fa1[_0xab01('0x2c')],'account':_0x409fa1[_0xab01('0x2d')]}))||'';}exports[_0xab01('0x2e')]=function(_0x18b4de,_0x16a190){var _0x381e16={},_0x547423={},_0x256440={'count':0x0,'rows':[]};var _0x1a6529=_['map'](db[_0xab01('0x2f')][_0xab01('0x30')],function(_0x2638cb){return{'name':_0x2638cb[_0xab01('0x31')],'type':_0x2638cb[_0xab01('0x32')][_0xab01('0x33')]};});_0x547423['model']=_[_0xab01('0x34')](_0x1a6529,_0xab01('0x26'));_0x547423[_0xab01('0x35')]=_[_0xab01('0x36')](_0x18b4de[_0xab01('0x35')]);_0x547423[_0xab01('0x37')]=_[_0xab01('0x38')](_0x547423['model'],_0x547423['query']);_0x381e16['attributes']=_[_0xab01('0x38')](_0x547423[_0xab01('0x39')],qs[_0xab01('0x3a')](_0x18b4de[_0xab01('0x35')][_0xab01('0x3a')]));_0x381e16[_0xab01('0x3b')]=_0x381e16[_0xab01('0x3b')][_0xab01('0x3c')]?_0x381e16[_0xab01('0x3b')]:_0x547423[_0xab01('0x39')];if(!_0x18b4de[_0xab01('0x35')][_0xab01('0x3d')](_0xab01('0x3e'))){_0x381e16[_0xab01('0x1c')]=qs[_0xab01('0x1c')](_0x18b4de[_0xab01('0x35')]['limit']);_0x381e16['offset']=qs[_0xab01('0x19')](_0x18b4de[_0xab01('0x35')]['offset']);}_0x381e16[_0xab01('0x3f')]=qs[_0xab01('0x40')](_0x18b4de[_0xab01('0x35')]['sort']);_0x381e16[_0xab01('0x41')]=qs['filters'](_['pick'](_0x18b4de[_0xab01('0x35')],_0x547423[_0xab01('0x37')]),_0x1a6529);if(_0x18b4de['query'][_0xab01('0x42')]){_0x381e16[_0xab01('0x41')]=_['merge'](_0x381e16[_0xab01('0x41')],{'$or':_[_0xab01('0x34')](_0x1a6529,function(_0x265ec9){if(_0x265ec9[_0xab01('0x32')]!==_0xab01('0x43')){var _0x42728c={};_0x42728c[_0x265ec9['name']]={'$like':'%'+_0x18b4de[_0xab01('0x35')][_0xab01('0x42')]+'%'};return _0x42728c;}})});}_0x381e16=_[_0xab01('0x28')]({},_0x381e16,_0x18b4de[_0xab01('0x44')]);var _0x2a0dfd={'where':_0x381e16['where']};return db['SquareReport']['count'](_0x2a0dfd)[_0xab01('0x23')](function(_0x4095bb){_0x256440['count']=_0x4095bb;if(_0x18b4de[_0xab01('0x35')][_0xab01('0x45')]){_0x381e16[_0xab01('0x46')]=[{'all':!![]}];}return db[_0xab01('0x2f')][_0xab01('0x47')](_0x381e16);})[_0xab01('0x23')](function(_0x200210){_0x256440[_0xab01('0x48')]=_0x200210;return _0x256440;})[_0xab01('0x23')](respondWithFilteredResult(_0x16a190,_0x381e16))[_0xab01('0x49')](handleError(_0x16a190,null));};exports[_0xab01('0x4a')]=function(_0x13f1af,_0x2f0fc3){var _0x10f3d6={'raw':!![],'where':{'id':_0x13f1af[_0xab01('0x4b')]['id']}},_0x753a50={};_0x753a50[_0xab01('0x39')]=_['keys'](db['SquareReport'][_0xab01('0x30')]);_0x753a50[_0xab01('0x35')]=_[_0xab01('0x36')](_0x13f1af[_0xab01('0x35')]);_0x753a50[_0xab01('0x37')]=_[_0xab01('0x38')](_0x753a50['model'],_0x753a50[_0xab01('0x35')]);_0x10f3d6[_0xab01('0x3b')]=_['intersection'](_0x753a50[_0xab01('0x39')],qs[_0xab01('0x3a')](_0x13f1af[_0xab01('0x35')]['fields']));_0x10f3d6[_0xab01('0x3b')]=_0x10f3d6[_0xab01('0x3b')][_0xab01('0x3c')]?_0x10f3d6[_0xab01('0x3b')]:_0x753a50[_0xab01('0x39')];if(_0x13f1af['query'][_0xab01('0x45')]){_0x10f3d6['include']=[{'all':!![]}];}_0x10f3d6=_[_0xab01('0x28')]({},_0x10f3d6,_0x13f1af[_0xab01('0x44')]);return db[_0xab01('0x2f')]['find'](_0x10f3d6)[_0xab01('0x23')](handleEntityNotFound(_0x2f0fc3,null))[_0xab01('0x23')](respondWithResult(_0x2f0fc3,null))[_0xab01('0x49')](handleError(_0x2f0fc3,null));};exports[_0xab01('0x4c')]=function(_0x5e4316,_0x34f6c1){return db[_0xab01('0x2f')][_0xab01('0x4c')](_0x5e4316[_0xab01('0x29')],{})[_0xab01('0x23')](respondWithResult(_0x34f6c1,0xc9))['catch'](handleError(_0x34f6c1,null));};exports[_0xab01('0x22')]=function(_0x57ac48,_0x5c0b2f){if(_0x57ac48[_0xab01('0x29')]['id']){delete _0x57ac48[_0xab01('0x29')]['id'];}return db[_0xab01('0x2f')][_0xab01('0x4d')]({'where':{'id':_0x57ac48[_0xab01('0x4b')]['id']}})[_0xab01('0x23')](handleEntityNotFound(_0x5c0b2f,null))[_0xab01('0x23')](saveUpdates(_0x57ac48['body'],null))['then'](respondWithResult(_0x5c0b2f,null))[_0xab01('0x49')](handleError(_0x5c0b2f,null));};exports[_0xab01('0x24')]=function(_0x1a0a14,_0x35ac7b){return db['SquareReport']['find']({'where':{'id':_0x1a0a14[_0xab01('0x4b')]['id']}})[_0xab01('0x23')](handleEntityNotFound(_0x35ac7b,null))[_0xab01('0x23')](removeEntity(_0x35ac7b,null))[_0xab01('0x49')](handleError(_0x35ac7b,null));};exports[_0xab01('0x4e')]=function(_0x10e0de,_0x24bd8a){return db['SquareReport']['describe']()[_0xab01('0x23')](respondWithResult(_0x24bd8a,null))[_0xab01('0x49')](handleError(_0x24bd8a,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 32ac01c..4c7564c 100644 --- a/server/api/squareReport/squareReport.model.js +++ b/server/api/squareReport/squareReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8963=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash'];(function(_0x54b9c6,_0x2c697e){var _0x251824=function(_0x269f7c){while(--_0x269f7c){_0x54b9c6['push'](_0x54b9c6['shift']());}};_0x251824(++_0x2c697e);}(_0x8963,0x11f));var _0x3896=function(_0x11efb3,_0x8071ba){_0x11efb3=_0x11efb3-0x0;var _0x5b9261=_0x8963[_0x11efb3];return _0x5b9261;};'use strict';var _=require(_0x3896('0x0'));var util=require(_0x3896('0x1'));var logger=require(_0x3896('0x2'))(_0x3896('0x3'));var moment=require(_0x3896('0x4'));var BPromise=require(_0x3896('0x5'));var rp=require(_0x3896('0x6'));var fs=require('fs');var path=require(_0x3896('0x7'));var rimraf=require('rimraf');var config=require(_0x3896('0x8'));var attributes=require('./squareReport.attributes');module[_0x3896('0x9')]=function(_0x19464f,_0x48d01a){return _0x19464f[_0x3896('0xa')](_0x3896('0xb'),attributes,{'tableName':_0x3896('0xc'),'paranoid':![],'indexes':[{'name':_0x3896('0xd'),'fields':['uniqueid',_0x3896('0xe')]},{'name':_0x3896('0xf'),'fields':[_0x3896('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad08=['./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d8eb5,_0x2cdbdb){var _0x369934=function(_0x15ec3b){while(--_0x15ec3b){_0x2d8eb5['push'](_0x2d8eb5['shift']());}};_0x369934(++_0x2cdbdb);}(_0xad08,0x1dc));var _0x8ad0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xad08[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x8ad0('0x0'));var util=require(_0x8ad0('0x1'));var logger=require(_0x8ad0('0x2'))(_0x8ad0('0x3'));var moment=require(_0x8ad0('0x4'));var BPromise=require(_0x8ad0('0x5'));var rp=require(_0x8ad0('0x6'));var fs=require('fs');var path=require(_0x8ad0('0x7'));var rimraf=require(_0x8ad0('0x8'));var config=require(_0x8ad0('0x9'));var attributes=require(_0x8ad0('0xa'));module[_0x8ad0('0xb')]=function(_0x2b8431,_0x279721){return _0x2b8431[_0x8ad0('0xc')](_0x8ad0('0xd'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x8ad0('0xe'),'fields':[_0x8ad0('0xf'),_0x8ad0('0x10')]},{'name':_0x8ad0('0x11'),'fields':[_0x8ad0('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index f899feb..b0f2889 100644 --- a/server/api/squareReport/squareReport.rpc.js +++ b/server/api/squareReport/squareReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc97=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x4210d7,_0x1db32c){var _0x299785=function(_0x33d959){while(--_0x33d959){_0x4210d7['push'](_0x4210d7['shift']());}};_0x299785(++_0x1db32c);}(_0xdc97,0x13b));var _0x7dc9=function(_0x153906,_0x483056){_0x153906=_0x153906-0x0;var _0x45779e=_0xdc97[_0x153906];return _0x45779e;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});}exports['CreateSquareReport']=function(_0x22577e){var _0x4afb47=this;return new Promise(function(_0x1f5906,_0x1cc237){return db['SquareReport'][_0x7dc9('0x16')](_0x22577e[_0x7dc9('0x17')],{'raw':_0x22577e[_0x7dc9('0x18')]?_0x22577e[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![]})[_0x7dc9('0xb')](function(_0x2dad65){logger[_0x7dc9('0x13')](_0x7dc9('0x1a'),_0x22577e);logger[_0x7dc9('0xe')]('CreateSquareReport',_0x22577e,JSON['stringify'](_0x2dad65));_0x1f5906(_0x2dad65);})[_0x7dc9('0x15')](function(_0x5981e2){logger['error'](_0x7dc9('0x1a'),_0x5981e2[_0x7dc9('0x12')],_0x22577e);_0x1cc237(_0x4afb47['error'](0x1f4,_0x5981e2[_0x7dc9('0x12')]));});});};exports[_0x7dc9('0x1b')]=function(_0x41110a){var _0x4906b1=this;return new Promise(function(_0x424763,_0x1e3a8d){return db[_0x7dc9('0x1c')]['update'](_0x41110a['body'],{'raw':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41110a['options']?_0x41110a['options'][_0x7dc9('0x1d')]||null:null,'attributes':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1e')]||null:null,'limit':_0x41110a[_0x7dc9('0x18')]?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1f')]||null:null})[_0x7dc9('0xb')](function(_0x236d42){logger[_0x7dc9('0x13')](_0x7dc9('0x1b'),_0x41110a);logger[_0x7dc9('0xe')](_0x7dc9('0x1b'),_0x41110a,JSON[_0x7dc9('0x10')](_0x236d42));_0x424763(_0x236d42);})['catch'](function(_0x4e929c){logger['error']('UpdateSquareReport',_0x4e929c['message'],_0x41110a);_0x1e3a8d(_0x4906b1['error'](0x1f4,_0x4e929c['message']));});});}; \ No newline at end of file +var _0xabce=['CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','body','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabce,0x103));var _0xeabc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xabce[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('SquareReport,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')](_0x58a3c0['body'],{'raw':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0['options'][_0xeabc('0x18')]===undefined?!![]:![]:!![]})[_0xeabc('0x9')](function(_0x502947){logger[_0xeabc('0xa')](_0xeabc('0x14'),_0x58a3c0);logger[_0xeabc('0xd')](_0xeabc('0x14'),_0x58a3c0,JSON[_0xeabc('0xf')](_0x502947));_0x31dd53(_0x502947);})['catch'](function(_0xecdbf){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0xecdbf['message'],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0xecdbf[_0xeabc('0x12')]));});});};exports[_0xeabc('0x19')]=function(_0x319119){var _0x5b8838=this;return new Promise(function(_0x109e1d,_0x480440){return db[_0xeabc('0x15')]['update'](_0x319119[_0xeabc('0x1a')],{'raw':_0x319119[_0xeabc('0x17')]?_0x319119[_0xeabc('0x17')][_0xeabc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319119[_0xeabc('0x17')]?_0x319119[_0xeabc('0x17')][_0xeabc('0x1b')]||null:null,'attributes':_0x319119['options']?_0x319119['options'][_0xeabc('0x1c')]||null:null,'limit':_0x319119['options']?_0x319119[_0xeabc('0x17')][_0xeabc('0x1d')]||null:null})['then'](function(_0x2163e6){logger[_0xeabc('0xa')](_0xeabc('0x19'),_0x319119);logger[_0xeabc('0xd')](_0xeabc('0x19'),_0x319119,JSON[_0xeabc('0xf')](_0x2163e6));_0x109e1d(_0x2163e6);})[_0xeabc('0x1e')](function(_0x38dc0a){logger[_0xeabc('0x10')]('UpdateSquareReport',_0x38dc0a[_0xeabc('0x12')],_0x319119);_0x480440(_0x5b8838['error'](0x1f4,_0x38dc0a[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8789843..22f45c7 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0801=['isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x4a8191,_0x4f56d9){var _0x312ed9=function(_0x390652){while(--_0x390652){_0x4a8191['push'](_0x4a8191['shift']());}};_0x312ed9(++_0x4f56d9);}(_0x0801,0x79));var _0x1080=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x0801[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x1080('0x0'));var util=require(_0x1080('0x1'));var path=require(_0x1080('0x2'));var timeout=require(_0x1080('0x3'));var express=require(_0x1080('0x4'));var router=express[_0x1080('0x5')]();var fs_extra=require(_0x1080('0x6'));var auth=require(_0x1080('0x7'));var interaction=require(_0x1080('0x8'));var config=require(_0x1080('0x9'));var controller=require(_0x1080('0xa'));router['get']('/',auth[_0x1080('0xb')](),controller[_0x1080('0xc')]);router[_0x1080('0xd')](_0x1080('0xe'),auth['isAuthenticated'](),controller[_0x1080('0xf')]);router['get'](_0x1080('0x10'),auth[_0x1080('0xb')](),controller[_0x1080('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1080('0x12')]('/:id',auth[_0x1080('0xb')](),controller['update']);router[_0x1080('0x13')](_0x1080('0x10'),auth[_0x1080('0xb')](),controller[_0x1080('0x14')]);module[_0x1080('0x15')]=router; \ No newline at end of file +var _0x5782=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./squareReportDetail.controller'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5782,0x1a8));var _0x2578=function(_0x3d8ba1,_0x5ba1fd){_0x3d8ba1=_0x3d8ba1-0x0;var _0x87804e=_0x5782[_0x3d8ba1];return _0x87804e;};'use strict';var multer=require(_0x2578('0x0'));var util=require(_0x2578('0x1'));var path=require(_0x2578('0x2'));var timeout=require(_0x2578('0x3'));var express=require('express');var router=express[_0x2578('0x4')]();var fs_extra=require(_0x2578('0x5'));var auth=require(_0x2578('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2578('0x7'));router[_0x2578('0x8')]('/',auth[_0x2578('0x9')](),controller[_0x2578('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x2578('0x9')](),controller[_0x2578('0xb')]);router[_0x2578('0xc')]('/',auth[_0x2578('0x9')](),controller[_0x2578('0xd')]);router[_0x2578('0xe')](_0x2578('0xf'),auth[_0x2578('0x9')](),controller[_0x2578('0x10')]);router[_0x2578('0x11')]('/:id',auth[_0x2578('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 95b247b..3010622 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f41=['sequelize','exports','STRING','TEXT'];(function(_0x3d59d8,_0x4ebb33){var _0x5907aa=function(_0x27a1b6){while(--_0x27a1b6){_0x3d59d8['push'](_0x3d59d8['shift']());}};_0x5907aa(++_0x4ebb33);}(_0x6f41,0x74));var _0x16f4=function(_0x1a2325,_0x2334ec){_0x1a2325=_0x1a2325-0x0;var _0xe80f95=_0x6f41[_0x1a2325];return _0xe80f95;};'use strict';var Sequelize=require(_0x16f4('0x0'));module[_0x16f4('0x1')]={'uniqueid':{'type':Sequelize[_0x16f4('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x16f4('0x2')]},'data':{'type':Sequelize[_0x16f4('0x3')]},'project_name':{'type':Sequelize[_0x16f4('0x2')]},'callerid':{'type':Sequelize[_0x16f4('0x2')]}}; \ No newline at end of file +var _0x7cda=['STRING','TEXT','sequelize','exports'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x7cda,0x1d2));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa7cd('0x0'));module[_0xa7cd('0x1')]={'uniqueid':{'type':Sequelize[_0xa7cd('0x2')]},'node':{'type':Sequelize[_0xa7cd('0x2')]},'application':{'type':Sequelize[_0xa7cd('0x2')]},'data':{'type':Sequelize[_0xa7cd('0x3')]},'project_name':{'type':Sequelize[_0xa7cd('0x2')]},'callerid':{'type':Sequelize[_0xa7cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index dc6c9c6..81bc349 100644 --- a/server/api/squareReportDetail/squareReportDetail.controller.js +++ b/server/api/squareReportDetail/squareReportDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fdb=['count','set','Content-Range','reject','save','update','then','stack','name','send','merge','body','message','agent','account','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','type','SquareDetailsReport','include','findAll','catch','show','params','includeAll','find','create','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined'];(function(_0x151ecd,_0x18ecb1){var _0x4c2325=function(_0x3c654c){while(--_0x3c654c){_0x151ecd['push'](_0x151ecd['shift']());}};_0x4c2325(++_0x18ecb1);}(_0x7fdb,0xc6));var _0xb7fd=function(_0x340aa5,_0x2d5553){_0x340aa5=_0x340aa5-0x0;var _0x3a5b7f=_0x7fdb[_0x340aa5];return _0x3a5b7f;};'use strict';var emlformat=require(_0xb7fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb7fd('0x1'));var jsonpatch=require(_0xb7fd('0x2'));var rp=require(_0xb7fd('0x3'));var moment=require(_0xb7fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb7fd('0x5'));var util=require(_0xb7fd('0x6'));var path=require(_0xb7fd('0x7'));var sox=require('sox');var csv=require(_0xb7fd('0x8'));var ejs=require(_0xb7fd('0x9'));var fs=require('fs');var fs_extra=require(_0xb7fd('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb7fd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb7fd('0xc'));var toCsv=require(_0xb7fd('0x8'));var querystring=require(_0xb7fd('0xd'));var Papa=require(_0xb7fd('0xe'));var Redis=require(_0xb7fd('0xf'));var authService=require(_0xb7fd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb7fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7fd('0x12'))(_0xb7fd('0x13'));var utils=require(_0xb7fd('0x14'));var config=require(_0xb7fd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7fd('0x16'))['db'];function respondWithStatusCode(_0x10a893,_0x398890){_0x398890=_0x398890||0xcc;return function(_0x211ef1){if(_0x211ef1){return _0x10a893[_0xb7fd('0x17')](_0x398890);}return _0x10a893['status'](_0x398890)[_0xb7fd('0x18')]();};}function respondWithResult(_0x2879b0,_0x516f12){_0x516f12=_0x516f12||0xc8;return function(_0x4c0369){if(_0x4c0369){return _0x2879b0[_0xb7fd('0x19')](_0x516f12)[_0xb7fd('0x1a')](_0x4c0369);}};}function respondWithFilteredResult(_0xbb93f3,_0xf20519){return function(_0x4c6176){if(_0x4c6176){var _0xcf20fa=typeof _0xf20519[_0xb7fd('0x1b')]==='undefined'&&typeof _0xf20519[_0xb7fd('0x1c')]===_0xb7fd('0x1d');var _0x597a45=_0x4c6176[_0xb7fd('0x1e')];var _0x138884=_0xcf20fa?0x0:_0xf20519[_0xb7fd('0x1b')];var _0x5a576e=_0xcf20fa?_0x4c6176[_0xb7fd('0x1e')]:_0xf20519['offset']+_0xf20519['limit'];var _0xe0629;if(_0x5a576e>=_0x597a45){_0x5a576e=_0x597a45;_0xe0629=0xc8;}else{_0xe0629=0xce;}_0xbb93f3['status'](_0xe0629);return _0xbb93f3[_0xb7fd('0x1f')](_0xb7fd('0x20'),_0x138884+'-'+_0x5a576e+'/'+_0x597a45)[_0xb7fd('0x1a')](_0x4c6176);}return null;};}function patchUpdates(_0x28d82e){return function(_0x2bdcc2){try{jsonpatch['apply'](_0x2bdcc2,_0x28d82e,!![]);}catch(_0x100d9f){return BPromise[_0xb7fd('0x21')](_0x100d9f);}return _0x2bdcc2[_0xb7fd('0x22')]();};}function saveUpdates(_0x215551,_0x1c67d3){return function(_0x243a1f){if(_0x243a1f){return _0x243a1f[_0xb7fd('0x23')](_0x215551)[_0xb7fd('0x24')](function(_0x4574df){return _0x4574df;});}return null;};}function removeEntity(_0x3f6b95,_0x1721c9){return function(_0x1b8378){if(_0x1b8378){return _0x1b8378['destroy']()[_0xb7fd('0x24')](function(){_0x3f6b95[_0xb7fd('0x19')](0xcc)[_0xb7fd('0x18')]();});}};}function handleEntityNotFound(_0x550e2b,_0x3e9871){return function(_0x4ca5e5){if(!_0x4ca5e5){_0x550e2b['sendStatus'](0x194);}return _0x4ca5e5;};}function handleError(_0x52fc0f,_0x3da6e2){_0x3da6e2=_0x3da6e2||0x1f4;return function(_0x668fb9){logger['error'](_0x668fb9[_0xb7fd('0x25')]);if(_0x668fb9[_0xb7fd('0x26')]){delete _0x668fb9[_0xb7fd('0x26')];}_0x52fc0f[_0xb7fd('0x19')](_0x3da6e2)[_0xb7fd('0x27')](_0x668fb9);};}function getMustacheRender(_0x478660,_0x4ffcac){return Mustache['render'](_0x478660,_[_0xb7fd('0x28')](_0x4ffcac[_0xb7fd('0x29')],{'contact':_0x4ffcac['contact'],'message':_0x4ffcac[_0xb7fd('0x2a')],'agent':_0x4ffcac[_0xb7fd('0x2b')],'interaction':_0x4ffcac['interaction'],'account':_0x4ffcac[_0xb7fd('0x2c')]}))||'';}exports[_0xb7fd('0x2d')]=function(_0x4e9f57,_0x1c1869){var _0x2cd5f1={},_0x5c2e85={},_0x21aaad={'count':0x0,'rows':[]};var _0x3ababc=_[_0xb7fd('0x2e')](db['SquareDetailsReport'][_0xb7fd('0x2f')],function(_0x567557){return{'name':_0x567557[_0xb7fd('0x30')],'type':_0x567557['type'][_0xb7fd('0x31')]};});_0x5c2e85['model']=_[_0xb7fd('0x2e')](_0x3ababc,_0xb7fd('0x26'));_0x5c2e85[_0xb7fd('0x32')]=_[_0xb7fd('0x33')](_0x4e9f57[_0xb7fd('0x32')]);_0x5c2e85['filters']=_[_0xb7fd('0x34')](_0x5c2e85[_0xb7fd('0x35')],_0x5c2e85[_0xb7fd('0x32')]);_0x2cd5f1[_0xb7fd('0x36')]=_[_0xb7fd('0x34')](_0x5c2e85[_0xb7fd('0x35')],qs['fields'](_0x4e9f57['query'][_0xb7fd('0x37')]));_0x2cd5f1[_0xb7fd('0x36')]=_0x2cd5f1[_0xb7fd('0x36')][_0xb7fd('0x38')]?_0x2cd5f1[_0xb7fd('0x36')]:_0x5c2e85['model'];if(!_0x4e9f57[_0xb7fd('0x32')][_0xb7fd('0x39')](_0xb7fd('0x3a'))){_0x2cd5f1[_0xb7fd('0x1c')]=qs[_0xb7fd('0x1c')](_0x4e9f57[_0xb7fd('0x32')]['limit']);_0x2cd5f1[_0xb7fd('0x1b')]=qs['offset'](_0x4e9f57[_0xb7fd('0x32')][_0xb7fd('0x1b')]);}_0x2cd5f1[_0xb7fd('0x3b')]=qs['sort'](_0x4e9f57[_0xb7fd('0x32')]['sort']);_0x2cd5f1['where']=qs[_0xb7fd('0x3c')](_[_0xb7fd('0x3d')](_0x4e9f57[_0xb7fd('0x32')],_0x5c2e85['filters']),_0x3ababc);if(_0x4e9f57['query'][_0xb7fd('0x3e')]){_0x2cd5f1[_0xb7fd('0x3f')]=_[_0xb7fd('0x28')](_0x2cd5f1[_0xb7fd('0x3f')],{'$or':_['map'](_0x3ababc,function(_0x1eff61){if(_0x1eff61[_0xb7fd('0x40')]!=='VIRTUAL'){var _0x4878b3={};_0x4878b3[_0x1eff61['name']]={'$like':'%'+_0x4e9f57[_0xb7fd('0x32')][_0xb7fd('0x3e')]+'%'};return _0x4878b3;}})});}_0x2cd5f1=_['merge']({},_0x2cd5f1,_0x4e9f57['options']);var _0x16b3c7={'where':_0x2cd5f1[_0xb7fd('0x3f')]};return db[_0xb7fd('0x41')][_0xb7fd('0x1e')](_0x16b3c7)[_0xb7fd('0x24')](function(_0x1a1f58){_0x21aaad[_0xb7fd('0x1e')]=_0x1a1f58;if(_0x4e9f57[_0xb7fd('0x32')]['includeAll']){_0x2cd5f1[_0xb7fd('0x42')]=[{'all':!![]}];}return db[_0xb7fd('0x41')][_0xb7fd('0x43')](_0x2cd5f1);})[_0xb7fd('0x24')](function(_0x216b20){_0x21aaad['rows']=_0x216b20;return _0x21aaad;})['then'](respondWithFilteredResult(_0x1c1869,_0x2cd5f1))[_0xb7fd('0x44')](handleError(_0x1c1869,null));};exports[_0xb7fd('0x45')]=function(_0x1b9f2b,_0x33b236){var _0x57905d={'raw':!![],'where':{'id':_0x1b9f2b[_0xb7fd('0x46')]['id']}},_0x15bc15={};_0x15bc15[_0xb7fd('0x35')]=_[_0xb7fd('0x33')](db[_0xb7fd('0x41')][_0xb7fd('0x2f')]);_0x15bc15[_0xb7fd('0x32')]=_[_0xb7fd('0x33')](_0x1b9f2b[_0xb7fd('0x32')]);_0x15bc15[_0xb7fd('0x3c')]=_[_0xb7fd('0x34')](_0x15bc15['model'],_0x15bc15[_0xb7fd('0x32')]);_0x57905d['attributes']=_[_0xb7fd('0x34')](_0x15bc15[_0xb7fd('0x35')],qs[_0xb7fd('0x37')](_0x1b9f2b[_0xb7fd('0x32')][_0xb7fd('0x37')]));_0x57905d['attributes']=_0x57905d[_0xb7fd('0x36')][_0xb7fd('0x38')]?_0x57905d[_0xb7fd('0x36')]:_0x15bc15[_0xb7fd('0x35')];if(_0x1b9f2b['query'][_0xb7fd('0x47')]){_0x57905d[_0xb7fd('0x42')]=[{'all':!![]}];}_0x57905d=_[_0xb7fd('0x28')]({},_0x57905d,_0x1b9f2b['options']);return db[_0xb7fd('0x41')][_0xb7fd('0x48')](_0x57905d)[_0xb7fd('0x24')](handleEntityNotFound(_0x33b236,null))['then'](respondWithResult(_0x33b236,null))[_0xb7fd('0x44')](handleError(_0x33b236,null));};exports[_0xb7fd('0x49')]=function(_0x2dc079,_0xbcde56){return db[_0xb7fd('0x41')][_0xb7fd('0x49')](_0x2dc079[_0xb7fd('0x29')],{})[_0xb7fd('0x24')](respondWithResult(_0xbcde56,0xc9))[_0xb7fd('0x44')](handleError(_0xbcde56,null));};exports[_0xb7fd('0x23')]=function(_0x58864e,_0x244919){if(_0x58864e[_0xb7fd('0x29')]['id']){delete _0x58864e[_0xb7fd('0x29')]['id'];}return db['SquareDetailsReport'][_0xb7fd('0x48')]({'where':{'id':_0x58864e[_0xb7fd('0x46')]['id']}})['then'](handleEntityNotFound(_0x244919,null))[_0xb7fd('0x24')](saveUpdates(_0x58864e[_0xb7fd('0x29')],null))[_0xb7fd('0x24')](respondWithResult(_0x244919,null))['catch'](handleError(_0x244919,null));};exports[_0xb7fd('0x4a')]=function(_0x4e76c4,_0x32fc3f){return db[_0xb7fd('0x41')]['find']({'where':{'id':_0x4e76c4['params']['id']}})[_0xb7fd('0x24')](handleEntityNotFound(_0x32fc3f,null))[_0xb7fd('0x24')](removeEntity(_0x32fc3f,null))[_0xb7fd('0x44')](handleError(_0x32fc3f,null));};exports[_0xb7fd('0x4b')]=function(_0x4757d0,_0x536a7f){return db[_0xb7fd('0x41')]['describe']()[_0xb7fd('0x24')](respondWithResult(_0x536a7f,null))[_0xb7fd('0x44')](handleError(_0x536a7f,null));}; \ No newline at end of file +var _0xd64c=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge','body','contact','message','agent','interaction','index','map','SquareDetailsReport','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x2d0e35,_0x4a78ee){var _0x24dbdf=function(_0x4e6715){while(--_0x4e6715){_0x2d0e35['push'](_0x2d0e35['shift']());}};_0x24dbdf(++_0x4a78ee);}(_0xd64c,0x142));var _0xcd64=function(_0x4c1fe,_0x517593){_0x4c1fe=_0x4c1fe-0x0;var _0x31e143=_0xd64c[_0x4c1fe];return _0x31e143;};'use strict';var emlformat=require(_0xcd64('0x0'));var rimraf=require(_0xcd64('0x1'));var zipdir=require(_0xcd64('0x2'));var jsonpatch=require(_0xcd64('0x3'));var rp=require(_0xcd64('0x4'));var moment=require(_0xcd64('0x5'));var BPromise=require(_0xcd64('0x6'));var Mustache=require(_0xcd64('0x7'));var util=require('util');var path=require(_0xcd64('0x8'));var sox=require(_0xcd64('0x9'));var csv=require(_0xcd64('0xa'));var ejs=require(_0xcd64('0xb'));var fs=require('fs');var fs_extra=require(_0xcd64('0xc'));var _=require('lodash');var squel=require(_0xcd64('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd64('0xe'));var deskjs=require(_0xcd64('0xf'));var toCsv=require(_0xcd64('0xa'));var querystring=require(_0xcd64('0x10'));var Papa=require(_0xcd64('0x11'));var Redis=require(_0xcd64('0x12'));var authService=require(_0xcd64('0x13'));var qs=require(_0xcd64('0x14'));var as=require(_0xcd64('0x15'));var hardwareService=require(_0xcd64('0x16'));var logger=require(_0xcd64('0x17'))(_0xcd64('0x18'));var utils=require(_0xcd64('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xcd64('0x1a'));var db=require(_0xcd64('0x1b'))['db'];function respondWithStatusCode(_0x2c40bb,_0x39e054){_0x39e054=_0x39e054||0xcc;return function(_0x296a2b){if(_0x296a2b){return _0x2c40bb['sendStatus'](_0x39e054);}return _0x2c40bb[_0xcd64('0x1c')](_0x39e054)[_0xcd64('0x1d')]();};}function respondWithResult(_0x35aa1b,_0x323b88){_0x323b88=_0x323b88||0xc8;return function(_0x2af274){if(_0x2af274){return _0x35aa1b[_0xcd64('0x1c')](_0x323b88)[_0xcd64('0x1e')](_0x2af274);}};}function respondWithFilteredResult(_0x15d2a8,_0x5dbaf2){return function(_0x5bb314){if(_0x5bb314){var _0x2bde36=typeof _0x5dbaf2['offset']===_0xcd64('0x1f')&&typeof _0x5dbaf2[_0xcd64('0x20')]===_0xcd64('0x1f');var _0x33fbfe=_0x5bb314['count'];var _0x1c5d1c=_0x2bde36?0x0:_0x5dbaf2[_0xcd64('0x21')];var _0x19099e=_0x2bde36?_0x5bb314[_0xcd64('0x22')]:_0x5dbaf2[_0xcd64('0x21')]+_0x5dbaf2[_0xcd64('0x20')];var _0x12ed6a;if(_0x19099e>=_0x33fbfe){_0x19099e=_0x33fbfe;_0x12ed6a=0xc8;}else{_0x12ed6a=0xce;}_0x15d2a8[_0xcd64('0x1c')](_0x12ed6a);return _0x15d2a8[_0xcd64('0x23')](_0xcd64('0x24'),_0x1c5d1c+'-'+_0x19099e+'/'+_0x33fbfe)[_0xcd64('0x1e')](_0x5bb314);}return null;};}function patchUpdates(_0xf8ba5f){return function(_0x2d28ae){try{jsonpatch['apply'](_0x2d28ae,_0xf8ba5f,!![]);}catch(_0x36705b){return BPromise[_0xcd64('0x25')](_0x36705b);}return _0x2d28ae[_0xcd64('0x26')]();};}function saveUpdates(_0x58bfef,_0x168439){return function(_0x11f26a){if(_0x11f26a){return _0x11f26a[_0xcd64('0x27')](_0x58bfef)[_0xcd64('0x28')](function(_0x429b82){return _0x429b82;});}return null;};}function removeEntity(_0x5eeca1,_0x34c7d4){return function(_0x8bb1c7){if(_0x8bb1c7){return _0x8bb1c7[_0xcd64('0x29')]()[_0xcd64('0x28')](function(){_0x5eeca1[_0xcd64('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249531,_0x52b1a0){return function(_0x4f3ab1){if(!_0x4f3ab1){_0x249531[_0xcd64('0x2a')](0x194);}return _0x4f3ab1;};}function handleError(_0x9febd1,_0x24161c){_0x24161c=_0x24161c||0x1f4;return function(_0x1a6db9){logger[_0xcd64('0x2b')](_0x1a6db9[_0xcd64('0x2c')]);if(_0x1a6db9[_0xcd64('0x2d')]){delete _0x1a6db9[_0xcd64('0x2d')];}_0x9febd1[_0xcd64('0x1c')](_0x24161c)[_0xcd64('0x2e')](_0x1a6db9);};}function getMustacheRender(_0xd2761c,_0x30a51c){return Mustache[_0xcd64('0x2f')](_0xd2761c,_[_0xcd64('0x30')](_0x30a51c[_0xcd64('0x31')],{'contact':_0x30a51c[_0xcd64('0x32')],'message':_0x30a51c[_0xcd64('0x33')],'agent':_0x30a51c[_0xcd64('0x34')],'interaction':_0x30a51c[_0xcd64('0x35')],'account':_0x30a51c['account']}))||'';}exports[_0xcd64('0x36')]=function(_0x17a1c3,_0x298f6f){var _0x8e05a5={},_0x544ab1={},_0x42bde5={'count':0x0,'rows':[]};var _0x5ef2f0=_[_0xcd64('0x37')](db[_0xcd64('0x38')][_0xcd64('0x39')],function(_0x1dec52){return{'name':_0x1dec52['fieldName'],'type':_0x1dec52['type'][_0xcd64('0x3a')]};});_0x544ab1['model']=_[_0xcd64('0x37')](_0x5ef2f0,_0xcd64('0x2d'));_0x544ab1[_0xcd64('0x3b')]=_[_0xcd64('0x3c')](_0x17a1c3[_0xcd64('0x3b')]);_0x544ab1[_0xcd64('0x3d')]=_[_0xcd64('0x3e')](_0x544ab1[_0xcd64('0x3f')],_0x544ab1['query']);_0x8e05a5['attributes']=_[_0xcd64('0x3e')](_0x544ab1[_0xcd64('0x3f')],qs[_0xcd64('0x40')](_0x17a1c3[_0xcd64('0x3b')][_0xcd64('0x40')]));_0x8e05a5[_0xcd64('0x41')]=_0x8e05a5[_0xcd64('0x41')]['length']?_0x8e05a5['attributes']:_0x544ab1['model'];if(!_0x17a1c3[_0xcd64('0x3b')][_0xcd64('0x42')](_0xcd64('0x43'))){_0x8e05a5['limit']=qs[_0xcd64('0x20')](_0x17a1c3[_0xcd64('0x3b')][_0xcd64('0x20')]);_0x8e05a5[_0xcd64('0x21')]=qs[_0xcd64('0x21')](_0x17a1c3[_0xcd64('0x3b')]['offset']);}_0x8e05a5['order']=qs[_0xcd64('0x44')](_0x17a1c3[_0xcd64('0x3b')][_0xcd64('0x44')]);_0x8e05a5['where']=qs[_0xcd64('0x3d')](_[_0xcd64('0x45')](_0x17a1c3['query'],_0x544ab1[_0xcd64('0x3d')]),_0x5ef2f0);if(_0x17a1c3[_0xcd64('0x3b')][_0xcd64('0x46')]){_0x8e05a5['where']=_[_0xcd64('0x30')](_0x8e05a5[_0xcd64('0x47')],{'$or':_[_0xcd64('0x37')](_0x5ef2f0,function(_0x41b6ac){if(_0x41b6ac['type']!==_0xcd64('0x48')){var _0x29a213={};_0x29a213[_0x41b6ac[_0xcd64('0x2d')]]={'$like':'%'+_0x17a1c3[_0xcd64('0x3b')][_0xcd64('0x46')]+'%'};return _0x29a213;}})});}_0x8e05a5=_[_0xcd64('0x30')]({},_0x8e05a5,_0x17a1c3[_0xcd64('0x49')]);var _0x3509b6={'where':_0x8e05a5[_0xcd64('0x47')]};return db[_0xcd64('0x38')]['count'](_0x3509b6)[_0xcd64('0x28')](function(_0x358f26){_0x42bde5[_0xcd64('0x22')]=_0x358f26;if(_0x17a1c3[_0xcd64('0x3b')][_0xcd64('0x4a')]){_0x8e05a5['include']=[{'all':!![]}];}return db[_0xcd64('0x38')]['findAll'](_0x8e05a5);})[_0xcd64('0x28')](function(_0x4a3da6){_0x42bde5[_0xcd64('0x4b')]=_0x4a3da6;return _0x42bde5;})[_0xcd64('0x28')](respondWithFilteredResult(_0x298f6f,_0x8e05a5))[_0xcd64('0x4c')](handleError(_0x298f6f,null));};exports[_0xcd64('0x4d')]=function(_0x22adcc,_0x8eddde){var _0x14423b={'raw':!![],'where':{'id':_0x22adcc[_0xcd64('0x4e')]['id']}},_0x1f015d={};_0x1f015d['model']=_[_0xcd64('0x3c')](db[_0xcd64('0x38')][_0xcd64('0x39')]);_0x1f015d[_0xcd64('0x3b')]=_[_0xcd64('0x3c')](_0x22adcc[_0xcd64('0x3b')]);_0x1f015d['filters']=_[_0xcd64('0x3e')](_0x1f015d[_0xcd64('0x3f')],_0x1f015d['query']);_0x14423b[_0xcd64('0x41')]=_[_0xcd64('0x3e')](_0x1f015d[_0xcd64('0x3f')],qs['fields'](_0x22adcc[_0xcd64('0x3b')][_0xcd64('0x40')]));_0x14423b[_0xcd64('0x41')]=_0x14423b[_0xcd64('0x41')][_0xcd64('0x4f')]?_0x14423b[_0xcd64('0x41')]:_0x1f015d[_0xcd64('0x3f')];if(_0x22adcc[_0xcd64('0x3b')][_0xcd64('0x4a')]){_0x14423b[_0xcd64('0x50')]=[{'all':!![]}];}_0x14423b=_['merge']({},_0x14423b,_0x22adcc[_0xcd64('0x49')]);return db[_0xcd64('0x38')][_0xcd64('0x51')](_0x14423b)[_0xcd64('0x28')](handleEntityNotFound(_0x8eddde,null))[_0xcd64('0x28')](respondWithResult(_0x8eddde,null))[_0xcd64('0x4c')](handleError(_0x8eddde,null));};exports['create']=function(_0xc25035,_0x381c6b){return db['SquareDetailsReport'][_0xcd64('0x52')](_0xc25035[_0xcd64('0x31')],{})[_0xcd64('0x28')](respondWithResult(_0x381c6b,0xc9))[_0xcd64('0x4c')](handleError(_0x381c6b,null));};exports['update']=function(_0xc4d43a,_0xe06b1a){if(_0xc4d43a['body']['id']){delete _0xc4d43a['body']['id'];}return db[_0xcd64('0x38')][_0xcd64('0x51')]({'where':{'id':_0xc4d43a['params']['id']}})['then'](handleEntityNotFound(_0xe06b1a,null))[_0xcd64('0x28')](saveUpdates(_0xc4d43a[_0xcd64('0x31')],null))[_0xcd64('0x28')](respondWithResult(_0xe06b1a,null))[_0xcd64('0x4c')](handleError(_0xe06b1a,null));};exports[_0xcd64('0x29')]=function(_0x51fca2,_0x433a49){return db[_0xcd64('0x38')]['find']({'where':{'id':_0x51fca2[_0xcd64('0x4e')]['id']}})[_0xcd64('0x28')](handleEntityNotFound(_0x433a49,null))[_0xcd64('0x28')](removeEntity(_0x433a49,null))[_0xcd64('0x4c')](handleError(_0x433a49,null));};exports[_0xcd64('0x53')]=function(_0x1750c9,_0x15da0f){return db[_0xcd64('0x38')][_0xcd64('0x53')]()[_0xcd64('0x28')](respondWithResult(_0x15da0f,null))[_0xcd64('0x4c')](handleError(_0x15da0f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c9928b9..3184c34 100644 --- a/server/api/squareReportDetail/squareReportDetail.model.js +++ b/server/api/squareReportDetail/squareReportDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7af=['exports','SquareDetailsReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./squareReportDetail.attributes'];(function(_0x4045ff,_0x46cbcd){var _0x5797ac=function(_0x32003f){while(--_0x32003f){_0x4045ff['push'](_0x4045ff['shift']());}};_0x5797ac(++_0x46cbcd);}(_0xa7af,0x1a6));var _0xfa7a=function(_0x4d5ecb,_0x1b554d){_0x4d5ecb=_0x4d5ecb-0x0;var _0x172a53=_0xa7af[_0x4d5ecb];return _0x172a53;};'use strict';var _=require(_0xfa7a('0x0'));var util=require(_0xfa7a('0x1'));var logger=require(_0xfa7a('0x2'))(_0xfa7a('0x3'));var moment=require(_0xfa7a('0x4'));var BPromise=require(_0xfa7a('0x5'));var rp=require(_0xfa7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa7a('0x7'));module[_0xfa7a('0x8')]=function(_0x14b20f,_0x159a3b){return _0x14b20f['define'](_0xfa7a('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e5a=['exports','define','SquareDetailsReport','report_square_details','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes'];(function(_0x2f6e70,_0x1d478d){var _0x16c372=function(_0x133fbe){while(--_0x133fbe){_0x2f6e70['push'](_0x2f6e70['shift']());}};_0x16c372(++_0x1d478d);}(_0x0e5a,0x70));var _0xa0e5=function(_0x5187cc,_0x4d1b25){_0x5187cc=_0x5187cc-0x0;var _0x53a141=_0x0e5a[_0x5187cc];return _0x53a141;};'use strict';var _=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0e5('0x2'));var BPromise=require(_0xa0e5('0x3'));var rp=require(_0xa0e5('0x4'));var fs=require('fs');var path=require(_0xa0e5('0x5'));var rimraf=require('rimraf');var config=require(_0xa0e5('0x6'));var attributes=require(_0xa0e5('0x7'));module[_0xa0e5('0x8')]=function(_0x51deae,_0x49182b){return _0x51deae[_0xa0e5('0x9')](_0xa0e5('0xa'),attributes,{'tableName':_0xa0e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 2ef6af9..b9f9881 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92f7=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','create','body','options','raw','CreateSquareDetailsReport'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x92f7,0x122));var _0x792f=function(_0x40da26,_0x23369c){_0x40da26=_0x40da26-0x0;var _0x2a49a7=_0x92f7[_0x40da26];return _0x2a49a7;};'use strict';var _=require(_0x792f('0x0'));var util=require(_0x792f('0x1'));var moment=require('moment');var BPromise=require(_0x792f('0x2'));var rs=require(_0x792f('0x3'));var fs=require('fs');var Redis=require(_0x792f('0x4'));var db=require(_0x792f('0x5'))['db'];var utils=require(_0x792f('0x6'));var logger=require('../../config/logger')(_0x792f('0x7'));var config=require(_0x792f('0x8'));var jayson=require(_0x792f('0x9'));var client=jayson[_0x792f('0xa')][_0x792f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26a5bb,_0x43c188,_0x4fb791){return new BPromise(function(_0x565eb2,_0x59bf57){return client[_0x792f('0xc')](_0x26a5bb,_0x4fb791)[_0x792f('0xd')](function(_0x3b324d){logger[_0x792f('0xe')](_0x792f('0xf'),_0x43c188,'request\x20sent');logger[_0x792f('0x10')](_0x792f('0x11'),_0x43c188,'request\x20sent',JSON[_0x792f('0x12')](_0x3b324d));if(_0x3b324d[_0x792f('0x13')]){if(_0x3b324d[_0x792f('0x13')][_0x792f('0x14')]===0x1f4){logger[_0x792f('0x13')](_0x792f('0xf'),_0x43c188,_0x3b324d[_0x792f('0x13')][_0x792f('0x15')]);return _0x59bf57(_0x3b324d[_0x792f('0x13')][_0x792f('0x15')]);}logger[_0x792f('0x13')](_0x792f('0xf'),_0x43c188,_0x3b324d[_0x792f('0x13')]['message']);return _0x565eb2(_0x3b324d[_0x792f('0x13')][_0x792f('0x15')]);}else{logger[_0x792f('0xe')](_0x792f('0xf'),_0x43c188,_0x792f('0x16'));_0x565eb2(_0x3b324d[_0x792f('0x17')]['message']);}})['catch'](function(_0x80b293){logger[_0x792f('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x43c188,_0x80b293);_0x59bf57(_0x80b293);});});}exports['CreateSquareDetailsReport']=function(_0x29b040){var _0x4f479a=this;return new Promise(function(_0x3e1327,_0x5ef88c){return db['SquareDetailsReport'][_0x792f('0x18')](_0x29b040[_0x792f('0x19')],{'raw':_0x29b040[_0x792f('0x1a')]?_0x29b040[_0x792f('0x1a')][_0x792f('0x1b')]===undefined?!![]:![]:!![]})[_0x792f('0xd')](function(_0x5401f4){logger[_0x792f('0xe')](_0x792f('0x1c'),_0x29b040);logger['debug'](_0x792f('0x1c'),_0x29b040,JSON[_0x792f('0x12')](_0x5401f4));_0x3e1327(_0x5401f4);})['catch'](function(_0xd9f57a){logger[_0x792f('0x13')](_0x792f('0x1c'),_0xd9f57a[_0x792f('0x15')],_0x29b040);_0x5ef88c(_0x4f479a[_0x792f('0x13')](0x1f4,_0xd9f57a[_0x792f('0x15')]));});});}; \ No newline at end of file +var _0x32fd=['raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','create','options'];(function(_0x1c0e38,_0x4dbcc2){var _0x1bc204=function(_0x568d6b){while(--_0x568d6b){_0x1c0e38['push'](_0x1c0e38['shift']());}};_0x1bc204(++_0x4dbcc2);}(_0x32fd,0x169));var _0xd32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd32f('0x0'));var moment=require(_0xd32f('0x1'));var BPromise=require(_0xd32f('0x2'));var rs=require(_0xd32f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd32f('0x4'))['db'];var utils=require(_0xd32f('0x5'));var logger=require(_0xd32f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd32f('0x7'));var client=jayson['client'][_0xd32f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39502e,_0x1b29da,_0x5b56f5){return new BPromise(function(_0x470530,_0x149cc6){return client['request'](_0x39502e,_0x5b56f5)[_0xd32f('0x9')](function(_0x109e39){logger[_0xd32f('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x1b29da,_0xd32f('0xb'));logger[_0xd32f('0xc')](_0xd32f('0xd'),_0x1b29da,_0xd32f('0xb'),JSON[_0xd32f('0xe')](_0x109e39));if(_0x109e39['error']){if(_0x109e39[_0xd32f('0xf')]['code']===0x1f4){logger[_0xd32f('0xf')](_0xd32f('0x10'),_0x1b29da,_0x109e39['error'][_0xd32f('0x11')]);return _0x149cc6(_0x109e39['error'][_0xd32f('0x11')]);}logger['error'](_0xd32f('0x10'),_0x1b29da,_0x109e39[_0xd32f('0xf')][_0xd32f('0x11')]);return _0x470530(_0x109e39[_0xd32f('0xf')][_0xd32f('0x11')]);}else{logger[_0xd32f('0xa')](_0xd32f('0x10'),_0x1b29da,_0xd32f('0xb'));_0x470530(_0x109e39[_0xd32f('0x12')][_0xd32f('0x11')]);}})[_0xd32f('0x13')](function(_0x1d57c3){logger[_0xd32f('0xf')](_0xd32f('0x10'),_0x1b29da,_0x1d57c3);_0x149cc6(_0x1d57c3);});});}exports[_0xd32f('0x14')]=function(_0x10a771){var _0x492580=this;return new Promise(function(_0x55093b,_0x2bed70){return db['SquareDetailsReport'][_0xd32f('0x15')](_0x10a771['body'],{'raw':_0x10a771[_0xd32f('0x16')]?_0x10a771[_0xd32f('0x16')][_0xd32f('0x17')]===undefined?!![]:![]:!![]})[_0xd32f('0x9')](function(_0x33e82f){logger['info'](_0xd32f('0x14'),_0x10a771);logger[_0xd32f('0xc')](_0xd32f('0x14'),_0x10a771,JSON[_0xd32f('0xe')](_0x33e82f));_0x55093b(_0x33e82f);})['catch'](function(_0x22f56d){logger[_0xd32f('0xf')]('CreateSquareDetailsReport',_0x22f56d[_0xd32f('0x11')],_0x10a771);_0x2bed70(_0x492580[_0xd32f('0xf')](0x1f4,_0x22f56d[_0xd32f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index c7273db..d6b8ed6 100644 --- a/server/api/system/index.js +++ b/server/api/system/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a54=['./system.controller','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1a54,0x1d6));var _0x41a5=function(_0x384d54,_0x2daebf){_0x384d54=_0x384d54-0x0;var _0x3357d7=_0x1a54[_0x384d54];return _0x3357d7;};'use strict';var express=require(_0x41a5('0x0'));var router=express[_0x41a5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x41a5('0x2'));router['get']('/',auth[_0x41a5('0x3')](),controller[_0x41a5('0x4')]);router['get'](_0x41a5('0x5'),auth[_0x41a5('0x3')](),controller[_0x41a5('0x6')]);module[_0x41a5('0x7')]=router; \ No newline at end of file +var _0x5032=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','killProcess','exports'];(function(_0x29af1d,_0x59ad05){var _0x5ba558=function(_0xdcf3e5){while(--_0xdcf3e5){_0x29af1d['push'](_0x29af1d['shift']());}};_0x5ba558(++_0x59ad05);}(_0x5032,0x90));var _0x2503=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5032[_0x2d7f0e];return _0x110b07;};'use strict';var express=require(_0x2503('0x0'));var router=express[_0x2503('0x1')]();var auth=require(_0x2503('0x2'));var controller=require(_0x2503('0x3'));router[_0x2503('0x4')]('/',auth[_0x2503('0x5')](),controller['index']);router[_0x2503('0x4')]('/process/:pid/kill',auth[_0x2503('0x5')](),controller[_0x2503('0x6')]);module[_0x2503('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index effcb9e..e1218c4 100644 --- a/server/api/system/system.controller.js +++ b/server/api/system/system.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x439c=['status','send','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x25754e,_0xe3a078){var _0x4918ca=function(_0x3a4845){while(--_0x3a4845){_0x25754e['push'](_0x25754e['shift']());}};_0x4918ca(++_0xe3a078);}(_0x439c,0x86));var _0xc439=function(_0x2d1898,_0x433d66){_0x2d1898=_0x2d1898-0x0;var _0x21f268=_0x439c[_0x2d1898];return _0x21f268;};'use strict';var info=require(_0xc439('0x0'));var exec=require(_0xc439('0x1'))['exec'];var logger=require(_0xc439('0x2'))(_0xc439('0x3'));var util=require(_0xc439('0x4'));var BPromise=require(_0xc439('0x5'));var _=require(_0xc439('0x6'));function handleError(_0x26b55c,_0x124748,_0x116f4d){_0x124748=_0x124748||0x1f4;return function(_0x3c9ede){logger[_0xc439('0x7')](_0xc439('0x8'),_0x116f4d,_0x124748,util[_0xc439('0x9')](_0x3c9ede,{'showHidden':![],'depth':null}));delete _0x3c9ede[_0xc439('0xa')];_0x26b55c[_0xc439('0xb')](_0x124748)[_0xc439('0xc')](_0x3c9ede);};}exports['index']=function(_0x3a2338,_0x52c57c){return info[_0xc439('0xd')]()[_0xc439('0xe')](function(_0x1ccfdf){return _0x52c57c[_0xc439('0xb')](0xc8)[_0xc439('0xf')](_0x1ccfdf);})[_0xc439('0x10')](function(_0x17c4a5){return _0x52c57c[_0xc439('0xb')](0x1f4)[_0xc439('0xf')](_0x17c4a5);});};exports[_0xc439('0x11')]=function(_0x53cd43,_0x35b5fa){var _0x1e30b4=[_0xc439('0x12')];return new BPromise(function(_0x557159,_0x5252b5){return exec(util[_0xc439('0x13')](_0xc439('0x14'),_0x53cd43[_0xc439('0x15')]['pid']),function(_0x154cca,_0x3baac2,_0x4d850e){if(_0x154cca){return _0x5252b5(_0x154cca);}return _0x557159(_0x3baac2);});})[_0xc439('0xe')](function(_0x16d63d){var _0x5b013f=![];var _0x1b130d=_0x16d63d[_0xc439('0x16')](/\n/);for(var _0xa2f917=0x0,_0x10f058=_0x1e30b4[_0xc439('0x17')];_0xa2f917<_0x10f058,_0x5b013f===![];_0xa2f917+=0x1){if(_0x16d63d[_0xc439('0x18')](_0x1e30b4[_0xa2f917])>=0x0){_0x5b013f=!![];}}if(!_0x5b013f){throw new Error(util[_0xc439('0x13')](_0xc439('0x19'),_0x53cd43[_0xc439('0x15')][_0xc439('0x1a')]));}process[_0xc439('0x1b')](_0x53cd43[_0xc439('0x15')][_0xc439('0x1a')],'SIGINT');return _0x35b5fa['status'](0xc8)[_0xc439('0xf')]({'message':util[_0xc439('0x13')](_0xc439('0x1c'),_0x53cd43[_0xc439('0x15')][_0xc439('0x1a')])});})[_0xc439('0x10')](handleError(_0x35b5fa,null,_0xc439('0x11')));}; \ No newline at end of file +var _0x1f33=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x556ba1,_0x27cda1){var _0x5b1f8f=function(_0x117f64){while(--_0x117f64){_0x556ba1['push'](_0x556ba1['shift']());}};_0x5b1f8f(++_0x27cda1);}(_0x1f33,0xd2));var _0x31f3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1f33[_0x4c12ec];return _0x3ae42c;};'use strict';var info=require(_0x31f3('0x0'));var exec=require(_0x31f3('0x1'))['exec'];var logger=require(_0x31f3('0x2'))(_0x31f3('0x3'));var util=require(_0x31f3('0x4'));var BPromise=require(_0x31f3('0x5'));var _=require(_0x31f3('0x6'));function handleError(_0x46654f,_0x4235c7,_0x5b4c8f){_0x4235c7=_0x4235c7||0x1f4;return function(_0x4787db){logger[_0x31f3('0x7')](_0x31f3('0x8'),_0x5b4c8f,_0x4235c7,util['inspect'](_0x4787db,{'showHidden':![],'depth':null}));delete _0x4787db['name'];_0x46654f[_0x31f3('0x9')](_0x4235c7)['send'](_0x4787db);};}exports['index']=function(_0x5ceb6f,_0xd87090){return info[_0x31f3('0xa')]()[_0x31f3('0xb')](function(_0x35ac05){return _0xd87090[_0x31f3('0x9')](0xc8)[_0x31f3('0xc')](_0x35ac05);})[_0x31f3('0xd')](function(_0x1f8967){return _0xd87090[_0x31f3('0x9')](0x1f4)[_0x31f3('0xc')](_0x1f8967);});};exports[_0x31f3('0xe')]=function(_0x57160e,_0x5a2847){var _0x2f29c5=[_0x31f3('0xf')];return new BPromise(function(_0xa8adc3,_0x20c553){return exec(util[_0x31f3('0x10')](_0x31f3('0x11'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')]),function(_0x1a5132,_0x4542c5,_0x573362){if(_0x1a5132){return _0x20c553(_0x1a5132);}return _0xa8adc3(_0x4542c5);});})[_0x31f3('0xb')](function(_0x5c61cc){var _0x5cfdd9=![];var _0x4df0bd=_0x5c61cc[_0x31f3('0x14')](/\n/);for(var _0x3d3d71=0x0,_0x23d6aa=_0x2f29c5[_0x31f3('0x15')];_0x3d3d71<_0x23d6aa,_0x5cfdd9===![];_0x3d3d71+=0x1){if(_0x5c61cc[_0x31f3('0x16')](_0x2f29c5[_0x3d3d71])>=0x0){_0x5cfdd9=!![];}}if(!_0x5cfdd9){throw new Error(util[_0x31f3('0x10')](_0x31f3('0x17'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')]));}process[_0x31f3('0x18')](_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')],'SIGINT');return _0x5a2847['status'](0xc8)[_0x31f3('0xc')]({'message':util[_0x31f3('0x10')](_0x31f3('0x19'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')])});})[_0x31f3('0xd')](handleError(_0x5a2847,null,_0x31f3('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c56a2e6..fff9a8b 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d42=['../../components/auth/service','../../components/interaction/service','./tag.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4e4bc5,_0x5c2c2d){var _0x2e6a35=function(_0x5e3744){while(--_0x5e3744){_0x4e4bc5['push'](_0x4e4bc5['shift']());}};_0x2e6a35(++_0x5c2c2d);}(_0x3d42,0xb8));var _0x23d4=function(_0xab3958,_0x433493){_0xab3958=_0xab3958-0x0;var _0x45fc46=_0x3d42[_0xab3958];return _0x45fc46;};'use strict';var multer=require(_0x23d4('0x0'));var util=require(_0x23d4('0x1'));var path=require('path');var timeout=require(_0x23d4('0x2'));var express=require(_0x23d4('0x3'));var router=express[_0x23d4('0x4')]();var fs_extra=require(_0x23d4('0x5'));var auth=require(_0x23d4('0x6'));var interaction=require(_0x23d4('0x7'));var config=require('../../config/environment');var controller=require(_0x23d4('0x8'));router[_0x23d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x23d4('0xa')]);router['get']('/:id',auth[_0x23d4('0xb')](),controller[_0x23d4('0xc')]);router[_0x23d4('0xd')]('/',auth['isAuthenticated'](),controller[_0x23d4('0xe')]);router['put'](_0x23d4('0xf'),auth[_0x23d4('0xb')](),controller[_0x23d4('0x10')]);router[_0x23d4('0x11')](_0x23d4('0xf'),auth['isAuthenticated'](),controller[_0x23d4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x593a=['./tag.controller','get','isAuthenticated','index','show','post','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x187873,_0x2086cf){var _0x3132b0=function(_0x889b61){while(--_0x889b61){_0x187873['push'](_0x187873['shift']());}};_0x3132b0(++_0x2086cf);}(_0x593a,0x180));var _0xa593=function(_0x232083,_0xda0a){_0x232083=_0x232083-0x0;var _0xd332f0=_0x593a[_0x232083];return _0xd332f0;};'use strict';var multer=require(_0xa593('0x0'));var util=require(_0xa593('0x1'));var path=require('path');var timeout=require(_0xa593('0x2'));var express=require(_0xa593('0x3'));var router=express[_0xa593('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa593('0x5'));var interaction=require(_0xa593('0x6'));var config=require('../../config/environment');var controller=require(_0xa593('0x7'));router[_0xa593('0x8')]('/',auth[_0xa593('0x9')](),controller[_0xa593('0xa')]);router['get']('/:id',auth[_0xa593('0x9')](),controller[_0xa593('0xb')]);router[_0xa593('0xc')]('/',auth[_0xa593('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa593('0xd')]);router[_0xa593('0xe')](_0xa593('0xf'),auth[_0xa593('0x9')](),controller['destroy']);module[_0xa593('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3e7b3ba..e862422 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['name','#0091EA','sequelize','exports','STRING'];(function(_0x376866,_0x58b7f7){var _0x201d5b=function(_0x4bcc89){while(--_0x4bcc89){_0x376866['push'](_0x376866['shift']());}};_0x201d5b(++_0x58b7f7);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0xbdb7[_0x190ff6];return _0x5356d2;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'unique':_0x7bdb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x4')},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb7e7[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 45a220f..88e4f0a 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfa4=['undefined','limit','apply','reject','save','then','get','Tags','destroy','error','stack','name','merge','contact','message','interaction','account','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','Tag','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset'];(function(_0x137a23,_0x15f665){var _0x595695=function(_0x5f0836){while(--_0x5f0836){_0x137a23['push'](_0x137a23['shift']());}};_0x595695(++_0x15f665);}(_0xdfa4,0x89));var _0x4dfa=function(_0x29dd31,_0x4c08f6){_0x29dd31=_0x29dd31-0x0;var _0x26e842=_0xdfa4[_0x29dd31];return _0x26e842;};'use strict';var emlformat=require(_0x4dfa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4dfa('0x1'));var util=require(_0x4dfa('0x2'));var path=require('path');var sox=require(_0x4dfa('0x3'));var csv=require(_0x4dfa('0x4'));var ejs=require(_0x4dfa('0x5'));var fs=require('fs');var fs_extra=require(_0x4dfa('0x6'));var _=require(_0x4dfa('0x7'));var squel=require(_0x4dfa('0x8'));var crypto=require(_0x4dfa('0x9'));var jsforce=require(_0x4dfa('0xa'));var deskjs=require(_0x4dfa('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4dfa('0xc'));var Papa=require(_0x4dfa('0xd'));var Redis=require('ioredis');var authService=require(_0x4dfa('0xe'));var qs=require(_0x4dfa('0xf'));var as=require(_0x4dfa('0x10'));var hardwareService=require(_0x4dfa('0x11'));var logger=require(_0x4dfa('0x12'))(_0x4dfa('0x13'));var utils=require(_0x4dfa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4dfa('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x570183,_0xba1742){_0xba1742=_0xba1742||0xcc;return function(_0x548a4f){if(_0x548a4f){return _0x570183[_0x4dfa('0x16')](_0xba1742);}return _0x570183['status'](_0xba1742)[_0x4dfa('0x17')]();};}function respondWithResult(_0x53b838,_0x2d1c24){_0x2d1c24=_0x2d1c24||0xc8;return function(_0x4bb550){if(_0x4bb550){return _0x53b838[_0x4dfa('0x18')](_0x2d1c24)[_0x4dfa('0x19')](_0x4bb550);}};}function respondWithFilteredResult(_0x700e32,_0x308beb){return function(_0x24c7fe){if(_0x24c7fe){var _0x3bffd1=typeof _0x308beb[_0x4dfa('0x1a')]===_0x4dfa('0x1b')&&typeof _0x308beb[_0x4dfa('0x1c')]===_0x4dfa('0x1b');var _0x216043=_0x24c7fe['count'];var _0x25bd87=_0x3bffd1?0x0:_0x308beb[_0x4dfa('0x1a')];var _0x3f5664=_0x3bffd1?_0x24c7fe['count']:_0x308beb[_0x4dfa('0x1a')]+_0x308beb[_0x4dfa('0x1c')];var _0x154541;if(_0x3f5664>=_0x216043){_0x3f5664=_0x216043;_0x154541=0xc8;}else{_0x154541=0xce;}_0x700e32[_0x4dfa('0x18')](_0x154541);return _0x700e32['set']('Content-Range',_0x25bd87+'-'+_0x3f5664+'/'+_0x216043)[_0x4dfa('0x19')](_0x24c7fe);}return null;};}function patchUpdates(_0xb2f6ed){return function(_0x295d6c){try{jsonpatch[_0x4dfa('0x1d')](_0x295d6c,_0xb2f6ed,!![]);}catch(_0x41d522){return BPromise[_0x4dfa('0x1e')](_0x41d522);}return _0x295d6c[_0x4dfa('0x1f')]();};}function saveUpdates(_0x4ab11b,_0x294905){return function(_0x496a8b){if(_0x496a8b){return _0x496a8b['update'](_0x4ab11b)[_0x4dfa('0x20')](function(_0xc6bf48){return _0xc6bf48;});}return null;};}function removeEntity(_0x5d94fb,_0xdb908f){return function(_0x1cb389){if(_0x1cb389){return _0x1cb389['destroy']()[_0x4dfa('0x20')](function(){var _0x35cc0b=_0x1cb389[_0x4dfa('0x21')]({'plain':!![]});var _0x51f86d=_0x4dfa('0x22');return db['UserProfileResource'][_0x4dfa('0x23')]({'where':{'type':_0x51f86d,'resourceId':_0x35cc0b['id']}})[_0x4dfa('0x20')](function(){return _0x1cb389;});})['then'](function(){_0x5d94fb[_0x4dfa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c40d0,_0x2af126){return function(_0x2606fa){if(!_0x2606fa){_0x3c40d0[_0x4dfa('0x16')](0x194);}return _0x2606fa;};}function handleError(_0x7b1fa4,_0x1d5385){_0x1d5385=_0x1d5385||0x1f4;return function(_0x18106d){logger[_0x4dfa('0x24')](_0x18106d[_0x4dfa('0x25')]);if(_0x18106d[_0x4dfa('0x26')]){delete _0x18106d[_0x4dfa('0x26')];}_0x7b1fa4[_0x4dfa('0x18')](_0x1d5385)['send'](_0x18106d);};}function getMustacheRender(_0x482910,_0x9d7d6f){return Mustache['render'](_0x482910,_[_0x4dfa('0x27')](_0x9d7d6f['body'],{'contact':_0x9d7d6f[_0x4dfa('0x28')],'message':_0x9d7d6f[_0x4dfa('0x29')],'agent':_0x9d7d6f['agent'],'interaction':_0x9d7d6f[_0x4dfa('0x2a')],'account':_0x9d7d6f[_0x4dfa('0x2b')]}))||'';}exports[_0x4dfa('0x2c')]=function(_0xccf576,_0x227d63){var _0x6969de={},_0x431cdd={},_0x5735ed={'count':0x0,'rows':[]};var _0x51d0a5=_[_0x4dfa('0x2d')](db['Tag'][_0x4dfa('0x2e')],function(_0xfcd942){return{'name':_0xfcd942[_0x4dfa('0x2f')],'type':_0xfcd942[_0x4dfa('0x30')]['key']};});_0x431cdd['model']=_[_0x4dfa('0x2d')](_0x51d0a5,_0x4dfa('0x26'));_0x431cdd[_0x4dfa('0x31')]=_[_0x4dfa('0x32')](_0xccf576[_0x4dfa('0x31')]);_0x431cdd[_0x4dfa('0x33')]=_[_0x4dfa('0x34')](_0x431cdd[_0x4dfa('0x35')],_0x431cdd[_0x4dfa('0x31')]);_0x6969de[_0x4dfa('0x36')]=_[_0x4dfa('0x34')](_0x431cdd[_0x4dfa('0x35')],qs[_0x4dfa('0x37')](_0xccf576['query'][_0x4dfa('0x37')]));_0x6969de[_0x4dfa('0x36')]=_0x6969de[_0x4dfa('0x36')][_0x4dfa('0x38')]?_0x6969de[_0x4dfa('0x36')]:_0x431cdd[_0x4dfa('0x35')];if(!_0xccf576[_0x4dfa('0x31')][_0x4dfa('0x39')](_0x4dfa('0x3a'))){_0x6969de[_0x4dfa('0x1c')]=qs[_0x4dfa('0x1c')](_0xccf576['query'][_0x4dfa('0x1c')]);_0x6969de[_0x4dfa('0x1a')]=qs[_0x4dfa('0x1a')](_0xccf576[_0x4dfa('0x31')][_0x4dfa('0x1a')]);}_0x6969de['order']=qs[_0x4dfa('0x3b')](_0xccf576['query'][_0x4dfa('0x3b')]);_0x6969de[_0x4dfa('0x3c')]=qs[_0x4dfa('0x33')](_['pick'](_0xccf576[_0x4dfa('0x31')],_0x431cdd[_0x4dfa('0x33')]),_0x51d0a5);if(_0xccf576['query'][_0x4dfa('0x3d')]){_0x6969de[_0x4dfa('0x3c')]=_[_0x4dfa('0x27')](_0x6969de[_0x4dfa('0x3c')],{'$or':_['map'](_0x51d0a5,function(_0x525cae){if(_0x525cae['type']!==_0x4dfa('0x3e')){var _0x382aab={};_0x382aab[_0x525cae['name']]={'$like':'%'+_0xccf576['query'][_0x4dfa('0x3d')]+'%'};return _0x382aab;}})});}_0x6969de=_['merge']({},_0x6969de,_0xccf576['options']);var _0x549bd6={'where':_0x6969de['where']};return db['Tag'][_0x4dfa('0x3f')](_0x549bd6)[_0x4dfa('0x20')](function(_0x54119d){_0x5735ed[_0x4dfa('0x3f')]=_0x54119d;if(_0xccf576[_0x4dfa('0x31')][_0x4dfa('0x40')]){_0x6969de[_0x4dfa('0x41')]=[{'all':!![]}];}return db['Tag'][_0x4dfa('0x42')](_0x6969de);})[_0x4dfa('0x20')](function(_0x18d15a){_0x5735ed[_0x4dfa('0x43')]=_0x18d15a;return _0x5735ed;})[_0x4dfa('0x20')](respondWithFilteredResult(_0x227d63,_0x6969de))[_0x4dfa('0x44')](handleError(_0x227d63,null));};exports['show']=function(_0x3c639b,_0x5e09f7){var _0xe2a00f={'raw':!![],'where':{'id':_0x3c639b[_0x4dfa('0x45')]['id']}},_0x458eff={};_0x458eff[_0x4dfa('0x35')]=_[_0x4dfa('0x32')](db[_0x4dfa('0x46')][_0x4dfa('0x2e')]);_0x458eff[_0x4dfa('0x31')]=_[_0x4dfa('0x32')](_0x3c639b['query']);_0x458eff[_0x4dfa('0x33')]=_['intersection'](_0x458eff['model'],_0x458eff[_0x4dfa('0x31')]);_0xe2a00f['attributes']=_[_0x4dfa('0x34')](_0x458eff[_0x4dfa('0x35')],qs[_0x4dfa('0x37')](_0x3c639b[_0x4dfa('0x31')][_0x4dfa('0x37')]));_0xe2a00f['attributes']=_0xe2a00f[_0x4dfa('0x36')][_0x4dfa('0x38')]?_0xe2a00f['attributes']:_0x458eff[_0x4dfa('0x35')];if(_0x3c639b[_0x4dfa('0x31')][_0x4dfa('0x40')]){_0xe2a00f[_0x4dfa('0x41')]=[{'all':!![]}];}_0xe2a00f=_['merge']({},_0xe2a00f,_0x3c639b['options']);return db[_0x4dfa('0x46')]['find'](_0xe2a00f)[_0x4dfa('0x20')](handleEntityNotFound(_0x5e09f7,null))[_0x4dfa('0x20')](respondWithResult(_0x5e09f7,null))['catch'](handleError(_0x5e09f7,null));};exports[_0x4dfa('0x47')]=function(_0x5adf7c,_0x57de4e){return db[_0x4dfa('0x46')][_0x4dfa('0x47')](_0x5adf7c[_0x4dfa('0x48')],{})[_0x4dfa('0x20')](function(_0x2832a1){var _0x203d2c=_0x5adf7c[_0x4dfa('0x49')][_0x4dfa('0x21')]({'plain':!![]});if(!_0x203d2c)throw new Error(_0x4dfa('0x4a'));if(_0x203d2c[_0x4dfa('0x4b')]===_0x4dfa('0x49')){var _0x4a6434=_0x2832a1[_0x4dfa('0x21')]({'plain':!![]});var _0x40839c=_0x4dfa('0x22');return db['UserProfileSection'][_0x4dfa('0x4c')]({'where':{'name':_0x40839c,'userProfileId':_0x203d2c[_0x4dfa('0x4d')]},'raw':!![]})[_0x4dfa('0x20')](function(_0x16e86e){if(_0x16e86e&&_0x16e86e[_0x4dfa('0x4e')]===0x0){return db[_0x4dfa('0x4f')]['create']({'name':_0x4a6434[_0x4dfa('0x26')],'resourceId':_0x4a6434['id'],'type':_0x16e86e['name'],'sectionId':_0x16e86e['id']},{})[_0x4dfa('0x20')](function(){return _0x2832a1;});}else{return _0x2832a1;}})[_0x4dfa('0x44')](function(_0x4fbe12){logger[_0x4dfa('0x24')](_0x4dfa('0x50'),_0x4fbe12);throw _0x4fbe12;});}return _0x2832a1;})[_0x4dfa('0x20')](respondWithResult(_0x57de4e,0xc9))[_0x4dfa('0x44')](handleError(_0x57de4e,null));};exports[_0x4dfa('0x51')]=function(_0x9bce50,_0x30357d){if(_0x9bce50['body']['id']){delete _0x9bce50['body']['id'];}return db[_0x4dfa('0x46')][_0x4dfa('0x4c')]({'where':{'id':_0x9bce50[_0x4dfa('0x45')]['id']}})[_0x4dfa('0x20')](handleEntityNotFound(_0x30357d,null))[_0x4dfa('0x20')](saveUpdates(_0x9bce50[_0x4dfa('0x48')],null))[_0x4dfa('0x20')](respondWithResult(_0x30357d,null))[_0x4dfa('0x44')](handleError(_0x30357d,null));};exports['destroy']=function(_0x48914d,_0x1c54f3){return db[_0x4dfa('0x46')][_0x4dfa('0x4c')]({'where':{'id':_0x48914d['params']['id']}})[_0x4dfa('0x20')](handleEntityNotFound(_0x1c54f3,null))[_0x4dfa('0x20')](removeEntity(_0x1c54f3,null))['catch'](handleError(_0x1c54f3,null));}; \ No newline at end of file +var _0x9460=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','destroy','then','get','end','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','user','role','Tags','userProfileId','autoAssociation','UserProfileResource','error'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x9460,0x164));var _0x0946=function(_0x42e789,_0x5b63f2){_0x42e789=_0x42e789-0x0;var _0x48860c=_0x9460[_0x42e789];return _0x48860c;};'use strict';var emlformat=require(_0x0946('0x0'));var rimraf=require(_0x0946('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0946('0x2'));var rp=require(_0x0946('0x3'));var moment=require(_0x0946('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0946('0x5'));var util=require(_0x0946('0x6'));var path=require('path');var sox=require(_0x0946('0x7'));var csv=require(_0x0946('0x8'));var ejs=require(_0x0946('0x9'));var fs=require('fs');var fs_extra=require(_0x0946('0xa'));var _=require('lodash');var squel=require(_0x0946('0xb'));var crypto=require(_0x0946('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0946('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0946('0xe'));var Papa=require(_0x0946('0xf'));var Redis=require(_0x0946('0x10'));var authService=require(_0x0946('0x11'));var qs=require(_0x0946('0x12'));var as=require(_0x0946('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0946('0x14'))(_0x0946('0x15'));var utils=require(_0x0946('0x16'));var config=require(_0x0946('0x17'));var licenseUtil=require(_0x0946('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b2ee9,_0xb862d3){_0xb862d3=_0xb862d3||0xcc;return function(_0x34df6d){if(_0x34df6d){return _0x4b2ee9[_0x0946('0x19')](_0xb862d3);}return _0x4b2ee9[_0x0946('0x1a')](_0xb862d3)['end']();};}function respondWithResult(_0x4bfc18,_0x55e22d){_0x55e22d=_0x55e22d||0xc8;return function(_0x5a3ac3){if(_0x5a3ac3){return _0x4bfc18[_0x0946('0x1a')](_0x55e22d)['json'](_0x5a3ac3);}};}function respondWithFilteredResult(_0x1ee98c,_0x1ea81b){return function(_0x383729){if(_0x383729){var _0x105292=typeof _0x1ea81b[_0x0946('0x1b')]===_0x0946('0x1c')&&typeof _0x1ea81b[_0x0946('0x1d')]===_0x0946('0x1c');var _0x40f204=_0x383729[_0x0946('0x1e')];var _0x194700=_0x105292?0x0:_0x1ea81b[_0x0946('0x1b')];var _0x384a29=_0x105292?_0x383729[_0x0946('0x1e')]:_0x1ea81b[_0x0946('0x1b')]+_0x1ea81b['limit'];var _0x38176c;if(_0x384a29>=_0x40f204){_0x384a29=_0x40f204;_0x38176c=0xc8;}else{_0x38176c=0xce;}_0x1ee98c['status'](_0x38176c);return _0x1ee98c['set']('Content-Range',_0x194700+'-'+_0x384a29+'/'+_0x40f204)[_0x0946('0x1f')](_0x383729);}return null;};}function patchUpdates(_0x9166d5){return function(_0x40c96f){try{jsonpatch[_0x0946('0x20')](_0x40c96f,_0x9166d5,!![]);}catch(_0x1308c2){return BPromise[_0x0946('0x21')](_0x1308c2);}return _0x40c96f[_0x0946('0x22')]();};}function saveUpdates(_0x540a3,_0x4fd444){return function(_0x58ec70){if(_0x58ec70){return _0x58ec70[_0x0946('0x23')](_0x540a3)['then'](function(_0x12868f){return _0x12868f;});}return null;};}function removeEntity(_0x100e9d,_0x455f29){return function(_0x39edca){if(_0x39edca){return _0x39edca[_0x0946('0x24')]()[_0x0946('0x25')](function(){var _0x4e3516=_0x39edca[_0x0946('0x26')]({'plain':!![]});var _0x5a88fc='Tags';return db['UserProfileResource'][_0x0946('0x24')]({'where':{'type':_0x5a88fc,'resourceId':_0x4e3516['id']}})[_0x0946('0x25')](function(){return _0x39edca;});})[_0x0946('0x25')](function(){_0x100e9d[_0x0946('0x1a')](0xcc)[_0x0946('0x27')]();});}};}function handleEntityNotFound(_0xdedbea,_0xf057b4){return function(_0x1ecde1){if(!_0x1ecde1){_0xdedbea[_0x0946('0x19')](0x194);}return _0x1ecde1;};}function handleError(_0x359e76,_0x2299f4){_0x2299f4=_0x2299f4||0x1f4;return function(_0x259db2){logger['error'](_0x259db2[_0x0946('0x28')]);if(_0x259db2[_0x0946('0x29')]){delete _0x259db2['name'];}_0x359e76['status'](_0x2299f4)[_0x0946('0x2a')](_0x259db2);};}function getMustacheRender(_0x5f016c,_0x24d47d){return Mustache[_0x0946('0x2b')](_0x5f016c,_[_0x0946('0x2c')](_0x24d47d[_0x0946('0x2d')],{'contact':_0x24d47d[_0x0946('0x2e')],'message':_0x24d47d[_0x0946('0x2f')],'agent':_0x24d47d['agent'],'interaction':_0x24d47d[_0x0946('0x30')],'account':_0x24d47d[_0x0946('0x31')]}))||'';}exports[_0x0946('0x32')]=function(_0x3854fb,_0x1bcee5){var _0x511894={},_0x7725f1={},_0x31b258={'count':0x0,'rows':[]};var _0x2bafff=_[_0x0946('0x33')](db[_0x0946('0x34')][_0x0946('0x35')],function(_0x2f11ff){return{'name':_0x2f11ff[_0x0946('0x36')],'type':_0x2f11ff[_0x0946('0x37')][_0x0946('0x38')]};});_0x7725f1['model']=_[_0x0946('0x33')](_0x2bafff,_0x0946('0x29'));_0x7725f1[_0x0946('0x39')]=_[_0x0946('0x3a')](_0x3854fb[_0x0946('0x39')]);_0x7725f1['filters']=_[_0x0946('0x3b')](_0x7725f1[_0x0946('0x3c')],_0x7725f1[_0x0946('0x39')]);_0x511894[_0x0946('0x3d')]=_[_0x0946('0x3b')](_0x7725f1['model'],qs[_0x0946('0x3e')](_0x3854fb[_0x0946('0x39')][_0x0946('0x3e')]));_0x511894['attributes']=_0x511894['attributes'][_0x0946('0x3f')]?_0x511894[_0x0946('0x3d')]:_0x7725f1[_0x0946('0x3c')];if(!_0x3854fb[_0x0946('0x39')][_0x0946('0x40')](_0x0946('0x41'))){_0x511894[_0x0946('0x1d')]=qs[_0x0946('0x1d')](_0x3854fb[_0x0946('0x39')][_0x0946('0x1d')]);_0x511894['offset']=qs[_0x0946('0x1b')](_0x3854fb[_0x0946('0x39')]['offset']);}_0x511894[_0x0946('0x42')]=qs['sort'](_0x3854fb[_0x0946('0x39')][_0x0946('0x43')]);_0x511894[_0x0946('0x44')]=qs[_0x0946('0x45')](_[_0x0946('0x46')](_0x3854fb[_0x0946('0x39')],_0x7725f1[_0x0946('0x45')]),_0x2bafff);if(_0x3854fb['query'][_0x0946('0x47')]){_0x511894['where']=_[_0x0946('0x2c')](_0x511894[_0x0946('0x44')],{'$or':_[_0x0946('0x33')](_0x2bafff,function(_0x7263de){if(_0x7263de[_0x0946('0x37')]!==_0x0946('0x48')){var _0x557365={};_0x557365[_0x7263de[_0x0946('0x29')]]={'$like':'%'+_0x3854fb['query'][_0x0946('0x47')]+'%'};return _0x557365;}})});}_0x511894=_[_0x0946('0x2c')]({},_0x511894,_0x3854fb[_0x0946('0x49')]);var _0x219d60={'where':_0x511894[_0x0946('0x44')]};return db[_0x0946('0x34')][_0x0946('0x1e')](_0x219d60)[_0x0946('0x25')](function(_0x1a3cf7){_0x31b258[_0x0946('0x1e')]=_0x1a3cf7;if(_0x3854fb[_0x0946('0x39')][_0x0946('0x4a')]){_0x511894[_0x0946('0x4b')]=[{'all':!![]}];}return db[_0x0946('0x34')][_0x0946('0x4c')](_0x511894);})[_0x0946('0x25')](function(_0x49d93b){_0x31b258[_0x0946('0x4d')]=_0x49d93b;return _0x31b258;})[_0x0946('0x25')](respondWithFilteredResult(_0x1bcee5,_0x511894))[_0x0946('0x4e')](handleError(_0x1bcee5,null));};exports[_0x0946('0x4f')]=function(_0x4935e7,_0xa255b1){var _0x1cf133={'raw':!![],'where':{'id':_0x4935e7[_0x0946('0x50')]['id']}},_0x3aebb8={};_0x3aebb8[_0x0946('0x3c')]=_[_0x0946('0x3a')](db[_0x0946('0x34')]['rawAttributes']);_0x3aebb8[_0x0946('0x39')]=_[_0x0946('0x3a')](_0x4935e7[_0x0946('0x39')]);_0x3aebb8[_0x0946('0x45')]=_[_0x0946('0x3b')](_0x3aebb8[_0x0946('0x3c')],_0x3aebb8[_0x0946('0x39')]);_0x1cf133['attributes']=_[_0x0946('0x3b')](_0x3aebb8[_0x0946('0x3c')],qs['fields'](_0x4935e7[_0x0946('0x39')]['fields']));_0x1cf133[_0x0946('0x3d')]=_0x1cf133[_0x0946('0x3d')]['length']?_0x1cf133[_0x0946('0x3d')]:_0x3aebb8['model'];if(_0x4935e7[_0x0946('0x39')][_0x0946('0x4a')]){_0x1cf133['include']=[{'all':!![]}];}_0x1cf133=_[_0x0946('0x2c')]({},_0x1cf133,_0x4935e7['options']);return db[_0x0946('0x34')][_0x0946('0x51')](_0x1cf133)[_0x0946('0x25')](handleEntityNotFound(_0xa255b1,null))[_0x0946('0x25')](respondWithResult(_0xa255b1,null))[_0x0946('0x4e')](handleError(_0xa255b1,null));};exports['create']=function(_0x3a10a4,_0x5cb639){return db[_0x0946('0x34')]['create'](_0x3a10a4[_0x0946('0x2d')],{})[_0x0946('0x25')](function(_0xe8f70b){var _0x4cb6fe=_0x3a10a4[_0x0946('0x52')][_0x0946('0x26')]({'plain':!![]});if(!_0x4cb6fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cb6fe[_0x0946('0x53')]===_0x0946('0x52')){var _0x3aafc7=_0xe8f70b[_0x0946('0x26')]({'plain':!![]});var _0x2ada4e=_0x0946('0x54');return db['UserProfileSection'][_0x0946('0x51')]({'where':{'name':_0x2ada4e,'userProfileId':_0x4cb6fe[_0x0946('0x55')]},'raw':!![]})[_0x0946('0x25')](function(_0x4dfe8f){if(_0x4dfe8f&&_0x4dfe8f[_0x0946('0x56')]===0x0){return db[_0x0946('0x57')]['create']({'name':_0x3aafc7[_0x0946('0x29')],'resourceId':_0x3aafc7['id'],'type':_0x4dfe8f[_0x0946('0x29')],'sectionId':_0x4dfe8f['id']},{})['then'](function(){return _0xe8f70b;});}else{return _0xe8f70b;}})[_0x0946('0x4e')](function(_0x58593f){logger[_0x0946('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58593f);throw _0x58593f;});}return _0xe8f70b;})[_0x0946('0x25')](respondWithResult(_0x5cb639,0xc9))['catch'](handleError(_0x5cb639,null));};exports['update']=function(_0x358a49,_0x1fd633){if(_0x358a49[_0x0946('0x2d')]['id']){delete _0x358a49[_0x0946('0x2d')]['id'];}return db[_0x0946('0x34')]['find']({'where':{'id':_0x358a49[_0x0946('0x50')]['id']}})[_0x0946('0x25')](handleEntityNotFound(_0x1fd633,null))['then'](saveUpdates(_0x358a49[_0x0946('0x2d')],null))['then'](respondWithResult(_0x1fd633,null))[_0x0946('0x4e')](handleError(_0x1fd633,null));};exports['destroy']=function(_0x476846,_0x503819){return db[_0x0946('0x34')][_0x0946('0x51')]({'where':{'id':_0x476846[_0x0946('0x50')]['id']}})[_0x0946('0x25')](handleEntityNotFound(_0x503819,null))[_0x0946('0x25')](removeEntity(_0x503819,null))[_0x0946('0x4e')](handleError(_0x503819,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e7f508f..e50102e 100644 --- a/server/api/tag/tag.model.js +++ b/server/api/tag/tag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb30e=['path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','util','../../config/logger','api','bluebird'];(function(_0x5e6935,_0x23d0a4){var _0x5498f9=function(_0x592401){while(--_0x592401){_0x5e6935['push'](_0x5e6935['shift']());}};_0x5498f9(++_0x23d0a4);}(_0xb30e,0x17d));var _0xeb30=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb30e[_0x4ea69d];return _0x5318e0;};'use strict';var _=require('lodash');var util=require(_0xeb30('0x0'));var logger=require(_0xeb30('0x1'))(_0xeb30('0x2'));var moment=require('moment');var BPromise=require(_0xeb30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb30('0x4'));var rimraf=require(_0xeb30('0x5'));var config=require(_0xeb30('0x6'));var attributes=require(_0xeb30('0x7'));module[_0xeb30('0x8')]=function(_0x41c661,_0x2616d0){return _0x41c661[_0xeb30('0x9')]('Tag',attributes,{'tableName':_0xeb30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd19f=['tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','Tag'];(function(_0x160e4e,_0xd701eb){var _0x420307=function(_0x16aef3){while(--_0x16aef3){_0x160e4e['push'](_0x160e4e['shift']());}};_0x420307(++_0xd701eb);}(_0xd19f,0x161));var _0xfd19=function(_0x1602fb,_0x20b6b3){_0x1602fb=_0x1602fb-0x0;var _0x461831=_0xd19f[_0x1602fb];return _0x461831;};'use strict';var _=require(_0xfd19('0x0'));var util=require(_0xfd19('0x1'));var logger=require(_0xfd19('0x2'))('api');var moment=require(_0xfd19('0x3'));var BPromise=require(_0xfd19('0x4'));var rp=require(_0xfd19('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd19('0x6'));var config=require(_0xfd19('0x7'));var attributes=require(_0xfd19('0x8'));module['exports']=function(_0x2e40bc,_0xf54b1c){return _0x2e40bc['define'](_0xfd19('0x9'),attributes,{'tableName':_0xfd19('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index afae309..f9ef0d0 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xda3f,0xec));var _0xfda3=function(_0x33de24,_0x120bbc){_0x33de24=_0x33de24-0x0;var _0x1980c4=_0xda3f[_0x33de24];return _0x1980c4;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('Tag,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('Tag,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0x5ec6=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','Tag,\x20%s,\x20%s','debug'];(function(_0x2aadbe,_0x48f312){var _0x4c2d69=function(_0x1f3732){while(--_0x1f3732){_0x2aadbe['push'](_0x2aadbe['shift']());}};_0x4c2d69(++_0x48f312);}(_0x5ec6,0x7f));var _0x65ec=function(_0x17e78f,_0xe445be){_0x17e78f=_0x17e78f-0x0;var _0xb553b7=_0x5ec6[_0x17e78f];return _0xb553b7;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('Tag,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b2634fe..2b1ada8 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ab8=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getAgents','create','addQueues','post','addAgents','put','update','destroy','removeQueues','delete','removeAgents','exports','multer','util'];(function(_0x136a01,_0x3e0f10){var _0x39ccee=function(_0x1fa530){while(--_0x1fa530){_0x136a01['push'](_0x136a01['shift']());}};_0x39ccee(++_0x3e0f10);}(_0x0ab8,0x19e));var _0x80ab=function(_0x22da8f,_0x28c918){_0x22da8f=_0x22da8f-0x0;var _0x3506b8=_0x0ab8[_0x22da8f];return _0x3506b8;};'use strict';var multer=require(_0x80ab('0x0'));var util=require(_0x80ab('0x1'));var path=require(_0x80ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x80ab('0x3'));var router=express[_0x80ab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x80ab('0x5'));var interaction=require(_0x80ab('0x6'));var config=require(_0x80ab('0x7'));var controller=require('./team.controller');router[_0x80ab('0x8')]('/',auth[_0x80ab('0x9')](),controller[_0x80ab('0xa')]);router[_0x80ab('0x8')](_0x80ab('0xb'),auth[_0x80ab('0x9')](),controller[_0x80ab('0xc')]);router[_0x80ab('0x8')]('/:id/queues',auth[_0x80ab('0x9')](),controller['getQueues']);router[_0x80ab('0x8')](_0x80ab('0xd'),auth[_0x80ab('0x9')](),controller[_0x80ab('0xe')]);router['post']('/',auth[_0x80ab('0x9')](),controller[_0x80ab('0xf')]);router['post']('/:id/queues',auth[_0x80ab('0x9')](),controller[_0x80ab('0x10')]);router[_0x80ab('0x11')](_0x80ab('0xd'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x12')]);router[_0x80ab('0x13')](_0x80ab('0xb'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x14')]);router['delete'](_0x80ab('0xb'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x15')]);router['delete']('/:id/queues',auth[_0x80ab('0x9')](),controller[_0x80ab('0x16')]);router[_0x80ab('0x17')](_0x80ab('0xd'),auth[_0x80ab('0x9')](),controller[_0x80ab('0x18')]);module[_0x80ab('0x19')]=router; \ No newline at end of file +var _0x0b2f=['post','create','/:id/queues','addQueues','put','update','delete','destroy','removeQueues','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','show','/:id/users','isAuthenticated','getAgents'];(function(_0x5e5444,_0x472c72){var _0x568e86=function(_0x307375){while(--_0x307375){_0x5e5444['push'](_0x5e5444['shift']());}};_0x568e86(++_0x472c72);}(_0x0b2f,0x1aa));var _0xf0b2=function(_0x4406cd,_0x3b69c3){_0x4406cd=_0x4406cd-0x0;var _0x116c22=_0x0b2f[_0x4406cd];return _0x116c22;};'use strict';var multer=require(_0xf0b2('0x0'));var util=require(_0xf0b2('0x1'));var path=require(_0xf0b2('0x2'));var timeout=require(_0xf0b2('0x3'));var express=require('express');var router=express[_0xf0b2('0x4')]();var fs_extra=require(_0xf0b2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0b2('0x6'));var config=require(_0xf0b2('0x7'));var controller=require(_0xf0b2('0x8'));router[_0xf0b2('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0b2('0xa')]);router[_0xf0b2('0x9')](_0xf0b2('0xb'),auth['isAuthenticated'](),controller[_0xf0b2('0xc')]);router[_0xf0b2('0x9')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router['get'](_0xf0b2('0xd'),auth[_0xf0b2('0xe')](),controller[_0xf0b2('0xf')]);router[_0xf0b2('0x10')]('/',auth['isAuthenticated'](),controller[_0xf0b2('0x11')]);router['post'](_0xf0b2('0x12'),auth[_0xf0b2('0xe')](),controller[_0xf0b2('0x13')]);router[_0xf0b2('0x10')](_0xf0b2('0xd'),auth[_0xf0b2('0xe')](),controller['addAgents']);router[_0xf0b2('0x14')](_0xf0b2('0xb'),auth[_0xf0b2('0xe')](),controller[_0xf0b2('0x15')]);router[_0xf0b2('0x16')](_0xf0b2('0xb'),auth[_0xf0b2('0xe')](),controller[_0xf0b2('0x17')]);router[_0xf0b2('0x16')](_0xf0b2('0x12'),auth[_0xf0b2('0xe')](),controller[_0xf0b2('0x18')]);router[_0xf0b2('0x16')](_0xf0b2('0xd'),auth[_0xf0b2('0xe')](),controller['removeAgents']);module[_0xf0b2('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 0207f26..68df796 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d67=['STRING','sequelize'];(function(_0x2ec7e1,_0x339623){var _0x5dc254=function(_0x4a6394){while(--_0x4a6394){_0x2ec7e1['push'](_0x2ec7e1['shift']());}};_0x5dc254(++_0x339623);}(_0x3d67,0x13f));var _0x73d6=function(_0x5d984e,_0x40be4c){_0x5d984e=_0x5d984e-0x0;var _0x77fe9a=_0x3d67[_0x5d984e];return _0x77fe9a;};'use strict';var Sequelize=require(_0x73d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x73d6('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x321c=['name','sequelize','exports','STRING'];(function(_0x18704d,_0x53b797){var _0x1e4520=function(_0x281312){while(--_0x281312){_0x18704d['push'](_0x18704d['shift']());}};_0x1e4520(++_0x53b797);}(_0x321c,0xa9));var _0xc321=function(_0x359276,_0x1ebe6f){_0x359276=_0x359276-0x0;var _0xa9a73d=_0x321c[_0x359276];return _0xa9a73d;};'use strict';var Sequelize=require(_0xc321('0x0'));module[_0xc321('0x1')]={'name':{'type':Sequelize[_0xc321('0x2')],'allowNull':![],'unique':_0xc321('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index fbd0a64..4995dd5 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26cf=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','add','removeQueues','Sequelize','remove','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','TeamVoiceQueue','findOrCreate','emit','QueueId','User','online','interface','UserVoiceQueueRt','upsert','format','voicePause','all','spread','removeAgents','parse','Queue:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','sendStatus','status','json','undefined','limit','count','reject','update','destroy','then','get','end','error','stack','name','send','merge','body','message','agent','interaction','account','index','Team','rawAttributes','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','include','findAll','rows','show','params','length','includeAll','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5ebaf0,_0x4c7823){var _0xf4c876=function(_0x43d47d){while(--_0x43d47d){_0x5ebaf0['push'](_0x5ebaf0['shift']());}};_0xf4c876(++_0x4c7823);}(_0x26cf,0x135));var _0xf26c=function(_0x2f461f,_0x1177d7){_0x2f461f=_0x2f461f-0x0;var _0x5a5bf7=_0x26cf[_0x2f461f];return _0x5a5bf7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf26c('0x0'));var zipdir=require(_0xf26c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf26c('0x2'));var moment=require('moment');var BPromise=require(_0xf26c('0x3'));var Mustache=require('mustache');var util=require(_0xf26c('0x4'));var path=require(_0xf26c('0x5'));var sox=require('sox');var csv=require(_0xf26c('0x6'));var ejs=require(_0xf26c('0x7'));var fs=require('fs');var fs_extra=require(_0xf26c('0x8'));var _=require(_0xf26c('0x9'));var squel=require(_0xf26c('0xa'));var crypto=require(_0xf26c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf26c('0x6'));var querystring=require(_0xf26c('0xc'));var Papa=require(_0xf26c('0xd'));var Redis=require(_0xf26c('0xe'));var authService=require(_0xf26c('0xf'));var qs=require(_0xf26c('0x10'));var as=require(_0xf26c('0x11'));var hardwareService=require(_0xf26c('0x12'));var logger=require('../../config/logger')(_0xf26c('0x13'));var utils=require(_0xf26c('0x14'));var config=require(_0xf26c('0x15'));var licenseUtil=require(_0xf26c('0x16'));var db=require(_0xf26c('0x17'))['db'];config['redis']=_[_0xf26c('0x18')](config['redis'],{'host':_0xf26c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf26c('0x1a')]));require('./team.socket')[_0xf26c('0x1b')](socket);function respondWithStatusCode(_0x58669e,_0x4246d9){_0x4246d9=_0x4246d9||0xcc;return function(_0x2cdf68){if(_0x2cdf68){return _0x58669e[_0xf26c('0x1c')](_0x4246d9);}return _0x58669e[_0xf26c('0x1d')](_0x4246d9)['end']();};}function respondWithResult(_0x4c3d77,_0x181db8){_0x181db8=_0x181db8||0xc8;return function(_0x392896){if(_0x392896){return _0x4c3d77['status'](_0x181db8)[_0xf26c('0x1e')](_0x392896);}};}function respondWithFilteredResult(_0x7cb19e,_0x454f32){return function(_0x375009){if(_0x375009){var _0x2ea1ac=typeof _0x454f32['offset']===_0xf26c('0x1f')&&typeof _0x454f32[_0xf26c('0x20')]===_0xf26c('0x1f');var _0x36e59d=_0x375009[_0xf26c('0x21')];var _0x1d8577=_0x2ea1ac?0x0:_0x454f32['offset'];var _0x25a06a=_0x2ea1ac?_0x375009[_0xf26c('0x21')]:_0x454f32['offset']+_0x454f32['limit'];var _0x15b059;if(_0x25a06a>=_0x36e59d){_0x25a06a=_0x36e59d;_0x15b059=0xc8;}else{_0x15b059=0xce;}_0x7cb19e[_0xf26c('0x1d')](_0x15b059);return _0x7cb19e['set']('Content-Range',_0x1d8577+'-'+_0x25a06a+'/'+_0x36e59d)[_0xf26c('0x1e')](_0x375009);}return null;};}function patchUpdates(_0x265cc3){return function(_0x2cfe2d){try{jsonpatch['apply'](_0x2cfe2d,_0x265cc3,!![]);}catch(_0x37d8fb){return BPromise[_0xf26c('0x22')](_0x37d8fb);}return _0x2cfe2d['save']();};}function saveUpdates(_0x2be84b,_0x4e2366){return function(_0x220892){if(_0x220892){return _0x220892[_0xf26c('0x23')](_0x2be84b)['then'](function(_0x1014b4){return _0x1014b4;});}return null;};}function removeEntity(_0x5cd420,_0x5e3a87){return function(_0xc8ec10){if(_0xc8ec10){return _0xc8ec10[_0xf26c('0x24')]()[_0xf26c('0x25')](function(){var _0x373d15=_0xc8ec10[_0xf26c('0x26')]({'plain':!![]});var _0x373742='Teams';return db['UserProfileResource'][_0xf26c('0x24')]({'where':{'type':_0x373742,'resourceId':_0x373d15['id']}})[_0xf26c('0x25')](function(){return _0xc8ec10;});})[_0xf26c('0x25')](function(){_0x5cd420[_0xf26c('0x1d')](0xcc)[_0xf26c('0x27')]();});}};}function handleEntityNotFound(_0x4ce010,_0x56a524){return function(_0x43f5a4){if(!_0x43f5a4){_0x4ce010['sendStatus'](0x194);}return _0x43f5a4;};}function handleError(_0x53c943,_0x2cbca2){_0x2cbca2=_0x2cbca2||0x1f4;return function(_0x6cd75e){logger[_0xf26c('0x28')](_0x6cd75e[_0xf26c('0x29')]);if(_0x6cd75e['name']){delete _0x6cd75e[_0xf26c('0x2a')];}_0x53c943[_0xf26c('0x1d')](_0x2cbca2)[_0xf26c('0x2b')](_0x6cd75e);};}function getMustacheRender(_0x4f455d,_0x495a81){return Mustache['render'](_0x4f455d,_[_0xf26c('0x2c')](_0x495a81[_0xf26c('0x2d')],{'contact':_0x495a81['contact'],'message':_0x495a81[_0xf26c('0x2e')],'agent':_0x495a81[_0xf26c('0x2f')],'interaction':_0x495a81[_0xf26c('0x30')],'account':_0x495a81[_0xf26c('0x31')]}))||'';}exports[_0xf26c('0x32')]=function(_0x2609a7,_0x38a89f){var _0x41b5ee={},_0x379bac={},_0x7d7054={'count':0x0,'rows':[]};var _0x3b0d79=_['map'](db[_0xf26c('0x33')][_0xf26c('0x34')],function(_0x516c74){return{'name':_0x516c74['fieldName'],'type':_0x516c74['type']['key']};});_0x379bac[_0xf26c('0x35')]=_[_0xf26c('0x36')](_0x3b0d79,_0xf26c('0x2a'));_0x379bac[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0x2609a7['query']);_0x379bac[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x379bac[_0xf26c('0x35')],_0x379bac[_0xf26c('0x37')]);_0x41b5ee['attributes']=_['intersection'](_0x379bac[_0xf26c('0x35')],qs[_0xf26c('0x3b')](_0x2609a7[_0xf26c('0x37')]['fields']));_0x41b5ee[_0xf26c('0x3c')]=_0x41b5ee[_0xf26c('0x3c')]['length']?_0x41b5ee['attributes']:_0x379bac[_0xf26c('0x35')];if(!_0x2609a7[_0xf26c('0x37')][_0xf26c('0x3d')](_0xf26c('0x3e'))){_0x41b5ee['limit']=qs['limit'](_0x2609a7[_0xf26c('0x37')]['limit']);_0x41b5ee['offset']=qs[_0xf26c('0x3f')](_0x2609a7['query'][_0xf26c('0x3f')]);}_0x41b5ee[_0xf26c('0x40')]=qs[_0xf26c('0x41')](_0x2609a7[_0xf26c('0x37')][_0xf26c('0x41')]);_0x41b5ee[_0xf26c('0x42')]=qs['filters'](_[_0xf26c('0x43')](_0x2609a7[_0xf26c('0x37')],_0x379bac['filters']),_0x3b0d79);if(_0x2609a7[_0xf26c('0x37')][_0xf26c('0x44')]){_0x41b5ee[_0xf26c('0x42')]=_[_0xf26c('0x2c')](_0x41b5ee[_0xf26c('0x42')],{'$or':_['map'](_0x3b0d79,function(_0xe425be){if(_0xe425be['type']!=='VIRTUAL'){var _0x5bbdaf={};_0x5bbdaf[_0xe425be[_0xf26c('0x2a')]]={'$like':'%'+_0x2609a7[_0xf26c('0x37')][_0xf26c('0x44')]+'%'};return _0x5bbdaf;}})});}_0x41b5ee=_['merge']({},_0x41b5ee,_0x2609a7['options']);var _0x330303={'where':_0x41b5ee[_0xf26c('0x42')]};return db[_0xf26c('0x33')][_0xf26c('0x21')](_0x330303)[_0xf26c('0x25')](function(_0x2f1bed){_0x7d7054['count']=_0x2f1bed;if(_0x2609a7[_0xf26c('0x37')]['includeAll']){_0x41b5ee[_0xf26c('0x45')]=[{'all':!![]}];}return db[_0xf26c('0x33')][_0xf26c('0x46')](_0x41b5ee);})[_0xf26c('0x25')](function(_0x4788a1){_0x7d7054[_0xf26c('0x47')]=_0x4788a1;return _0x7d7054;})['then'](respondWithFilteredResult(_0x38a89f,_0x41b5ee))['catch'](handleError(_0x38a89f,null));};exports[_0xf26c('0x48')]=function(_0x5a0b74,_0xaf318a){var _0x393349={'raw':![],'where':{'id':_0x5a0b74[_0xf26c('0x49')]['id']}},_0x537278={};_0x537278[_0xf26c('0x35')]=_[_0xf26c('0x38')](db[_0xf26c('0x33')]['rawAttributes']);_0x537278[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0x5a0b74['query']);_0x537278[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x537278[_0xf26c('0x35')],_0x537278[_0xf26c('0x37')]);_0x393349[_0xf26c('0x3c')]=_['intersection'](_0x537278['model'],qs['fields'](_0x5a0b74[_0xf26c('0x37')][_0xf26c('0x3b')]));_0x393349['attributes']=_0x393349[_0xf26c('0x3c')][_0xf26c('0x4a')]?_0x393349[_0xf26c('0x3c')]:_0x537278['model'];if(_0x5a0b74['query'][_0xf26c('0x4b')]){_0x393349[_0xf26c('0x45')]=[{'all':!![]}];}_0x393349=_[_0xf26c('0x2c')]({},_0x393349,_0x5a0b74[_0xf26c('0x4c')]);return db[_0xf26c('0x33')][_0xf26c('0x4d')](_0x393349)[_0xf26c('0x25')](handleEntityNotFound(_0xaf318a,null))[_0xf26c('0x25')](respondWithResult(_0xaf318a,null))[_0xf26c('0x4e')](handleError(_0xaf318a,null));};exports[_0xf26c('0x4f')]=function(_0x3816c1,_0x4a0995){return db['Team'][_0xf26c('0x4f')](_0x3816c1[_0xf26c('0x2d')],{})[_0xf26c('0x25')](function(_0x411100){var _0x26c59e=_0x3816c1[_0xf26c('0x50')][_0xf26c('0x26')]({'plain':!![]});if(!_0x26c59e)throw new Error(_0xf26c('0x51'));if(_0x26c59e[_0xf26c('0x52')]===_0xf26c('0x50')){var _0x255818=_0x411100[_0xf26c('0x26')]({'plain':!![]});var _0x1313b5='Teams';return db[_0xf26c('0x53')][_0xf26c('0x4d')]({'where':{'name':_0x1313b5,'userProfileId':_0x26c59e[_0xf26c('0x54')]},'raw':!![]})['then'](function(_0x58ead3){if(_0x58ead3&&_0x58ead3[_0xf26c('0x55')]===0x0){return db['UserProfileResource'][_0xf26c('0x4f')]({'name':_0x255818[_0xf26c('0x2a')],'resourceId':_0x255818['id'],'type':_0x58ead3[_0xf26c('0x2a')],'sectionId':_0x58ead3['id']},{})[_0xf26c('0x25')](function(){return _0x411100;});}else{return _0x411100;}})[_0xf26c('0x4e')](function(_0x5dbe75){logger[_0xf26c('0x28')](_0xf26c('0x56'),_0x5dbe75);throw _0x5dbe75;});}return _0x411100;})['then'](respondWithResult(_0x4a0995,0xc9))[_0xf26c('0x4e')](handleError(_0x4a0995,null));};exports[_0xf26c('0x23')]=function(_0x35f82a,_0xfa7e6d){if(_0x35f82a['body']['id']){delete _0x35f82a[_0xf26c('0x2d')]['id'];}return db[_0xf26c('0x33')]['find']({'where':{'id':_0x35f82a[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0xfa7e6d,null))['then'](saveUpdates(_0x35f82a['body'],null))['then'](respondWithResult(_0xfa7e6d,null))[_0xf26c('0x4e')](handleError(_0xfa7e6d,null));};exports[_0xf26c('0x24')]=function(_0x55dd4f,_0x1a8ff6){return db[_0xf26c('0x33')][_0xf26c('0x4d')]({'where':{'id':_0x55dd4f[_0xf26c('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a8ff6,null))['then'](removeEntity(_0x1a8ff6,null))[_0xf26c('0x4e')](handleError(_0x1a8ff6,null));};exports['getQueues']=function(_0xd88677,_0xaa34cb,_0x335863){return db['Team'][_0xf26c('0x57')]({'where':{'id':_0xd88677[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0xaa34cb,null))[_0xf26c('0x25')](function(_0x9ee99c){if(!_0xd88677['query'][_0xf26c('0x58')]||!utils[_0xf26c('0x59')](_0xd88677[_0xf26c('0x37')][_0xf26c('0x58')])){throw new db['Sequelize'][(_0xf26c('0x5a'))](_0xf26c('0x5b'));}var _0x5d3e80={};var _0x3a44a9={};_0x3a44a9[_0xf26c('0x35')]=_[_0xf26c('0x38')](db[_[_0xf26c('0x5c')](_0xd88677['query'][_0xf26c('0x58')]['toLowerCase']())+_0xf26c('0x5d')][_0xf26c('0x34')]);_0x3a44a9[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0xd88677[_0xf26c('0x37')]);_0x3a44a9[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x3a44a9[_0xf26c('0x35')],_0x3a44a9[_0xf26c('0x37')]);_0x5d3e80[_0xf26c('0x3c')]=_[_0xf26c('0x3a')](_0x3a44a9[_0xf26c('0x35')],qs['fields'](_0xd88677[_0xf26c('0x37')][_0xf26c('0x3b')]));_0x5d3e80[_0xf26c('0x3c')]=_0x5d3e80[_0xf26c('0x3c')]['length']?_0x5d3e80[_0xf26c('0x3c')]:_0x3a44a9[_0xf26c('0x35')];_0x5d3e80[_0xf26c('0x20')]=qs[_0xf26c('0x20')](_0xd88677[_0xf26c('0x37')][_0xf26c('0x20')]);_0x5d3e80['offset']=qs['offset'](_0xd88677[_0xf26c('0x37')][_0xf26c('0x3f')]);_0x5d3e80[_0xf26c('0x40')]=qs[_0xf26c('0x41')](_0xd88677['query']['sort']);_0x5d3e80['where']=qs[_0xf26c('0x39')](_['pick'](_0xd88677[_0xf26c('0x37')],_0x3a44a9[_0xf26c('0x39')]));_0x5d3e80=_[_0xf26c('0x2c')]({},_0x5d3e80,_0xd88677[_0xf26c('0x4c')]);return _0x9ee99c[_0xf26c('0x26')+_[_0xf26c('0x5c')](_0xd88677[_0xf26c('0x37')][_0xf26c('0x58')][_0xf26c('0x5e')]())+_0xf26c('0x5f')](_0x5d3e80);})['then'](respondWithResult(_0xaa34cb,null))[_0xf26c('0x4e')](handleError(_0xaa34cb,null));};exports[_0xf26c('0x60')]=function(_0x1f3a5f,_0x269e00,_0x1e738b){return db[_0xf26c('0x33')][_0xf26c('0x57')]({'where':{'id':_0x1f3a5f['params']['id']}})['then'](function(_0x34e16a){if(_0x34e16a){if(!_0x1f3a5f[_0xf26c('0x2d')][_0xf26c('0x58')]||!utils[_0xf26c('0x59')](_0x1f3a5f[_0xf26c('0x2d')]['channel'])){throw new db['Sequelize'][(_0xf26c('0x5a'))](_0xf26c('0x5b'));}return _0x34e16a[_0xf26c('0x61')+_[_0xf26c('0x5c')](_0x1f3a5f['body'][_0xf26c('0x58')][_0xf26c('0x5e')]())+'Queues'](_0x1f3a5f['body']['ids']);}return null;})[_0xf26c('0x25')](handleEntityNotFound(_0x269e00,null))[_0xf26c('0x25')](respondWithStatusCode(_0x269e00,null))['catch'](handleError(_0x269e00,null));};exports[_0xf26c('0x62')]=function(_0x4efc80,_0x24b206,_0x59ef64){return db[_0xf26c('0x33')][_0xf26c('0x57')]({'where':{'id':_0x4efc80[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](function(_0x459bec){if(_0x459bec){if(!_0x4efc80['query']['channel']||!utils[_0xf26c('0x59')](_0x4efc80[_0xf26c('0x37')][_0xf26c('0x58')])){throw new db[(_0xf26c('0x63'))]['ValidationError'](_0xf26c('0x5b'));}return _0x459bec[_0xf26c('0x64')+_[_0xf26c('0x5c')](_0x4efc80[_0xf26c('0x37')][_0xf26c('0x58')][_0xf26c('0x5e')]())+_0xf26c('0x5f')](_0x4efc80['query'][_0xf26c('0x65')]);}return null;})[_0xf26c('0x25')](handleEntityNotFound(_0x24b206,null))[_0xf26c('0x25')](respondWithStatusCode(_0x24b206,null))[_0xf26c('0x4e')](handleError(_0x24b206,null));};exports[_0xf26c('0x66')]=function(_0x36976f,_0x255e6f){return db[_0xf26c('0x33')][_0xf26c('0x4d')]({'where':{'id':_0x36976f[_0xf26c('0x49')]['id']}})['then'](handleEntityNotFound(_0x255e6f,null))[_0xf26c('0x25')](function(_0x2d1f8d){if(_0x2d1f8d){var _0x2253df=[_0xf26c('0x67'),_0xf26c('0x68'),_0xf26c('0x69'),_0xf26c('0x6a'),_0xf26c('0x6b'),_0xf26c('0x6c'),_0xf26c('0x6d')];return db[_0xf26c('0x6e')][_0xf26c('0x6f')](function(_0x224164){var _0x395ee3=_[_0xf26c('0x36')](_0x2253df,function(_0x56c52a){var _0x3d9af2={'attributes':['id',_0xf26c('0x2a')]};if(_0x56c52a===_0xf26c('0x67')){_0x3d9af2[_0xf26c('0x70')]={'attributes':[_0xf26c('0x71')]};}return _0x2d1f8d[_0xf26c('0x26')+_0x56c52a+_0xf26c('0x5f')](_0x3d9af2)[_0xf26c('0x25')](function(_0x499985){var _0x471341=_[_0xf26c('0x36')](_0x499985,function(_0x5663ce){var _0x4d93e3=_[_0xf26c('0x36')](_0x36976f[_0xf26c('0x2d')]['ids'],function(_0x12b21b){var _0x572f75={'where':{'UserId':_0x12b21b,[_0x56c52a+'QueueId']:_0x5663ce['id']},'transaction':_0x224164};if(_0x56c52a==='Voice'){_0x572f75[_0xf26c('0x18')]={'penalty':_0x5663ce[_0xf26c('0x72')][_0xf26c('0x71')]};}return db['User'+_0x56c52a+_0xf26c('0x5d')][_0xf26c('0x73')](_0x572f75)[_0xf26c('0x25')](function(){socket[_0xf26c('0x74')](_0xf26c('0x50')+_0x56c52a+'Queue:save',{'UserId':_0x12b21b,[_0x56c52a+_0xf26c('0x75')]:_0x5663ce['id']});if(_0x56c52a!==_0xf26c('0x67'))return;return db[_0xf26c('0x76')]['findAll']({'where':{'id':_0x36976f['body'][_0xf26c('0x65')],'online':0x1},'attributes':['id',_0xf26c('0x2a'),_0xf26c('0x77'),'voicePause',_0xf26c('0x78')],'raw':!![]})[_0xf26c('0x25')](function(_0x22f444){var _0x5818ec=_[_0xf26c('0x36')](_0x22f444,function(_0x25148d){return db[_0xf26c('0x79')][_0xf26c('0x7a')]({'membername':_0x25148d[_0xf26c('0x2a')],'UserId':_0x25148d['id'],'queue_name':_0x5663ce[_0xf26c('0x2a')],'VoiceQueueId':_0x5663ce['id'],'interface':_['isNil'](_0x25148d[_0xf26c('0x78')])?util[_0xf26c('0x7b')]('SIP/%s',_0x25148d[_0xf26c('0x2a')]):_0x25148d[_0xf26c('0x78')],'paused':_0x25148d[_0xf26c('0x7c')]||![],'penalty':_0x5663ce[_0xf26c('0x72')][_0xf26c('0x71')]},{'transaction':_0x224164});});return Promise[_0xf26c('0x7d')](_0x5818ec);});});});return Promise['all'](_0x4d93e3);});return Promise['all'](_0x471341);});});return Promise[_0xf26c('0x7d')](_0x395ee3)[_0xf26c('0x25')](function(){return _0x2d1f8d[_0xf26c('0x66')](_0x36976f[_0xf26c('0x2d')][_0xf26c('0x65')],{'transaction':_0x224164})[_0xf26c('0x7e')](function(_0x12c779){return _0x12c779;});});});}})[_0xf26c('0x25')](respondWithResult(_0x255e6f,null))[_0xf26c('0x4e')](handleError(_0x255e6f,null));};exports[_0xf26c('0x7f')]=function(_0x5e732d,_0x4a4e9a){return db[_0xf26c('0x33')][_0xf26c('0x4d')]({'where':{'id':_0x5e732d[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0x4a4e9a,null))[_0xf26c('0x25')](function(_0x5b0b9e){if(_0x5b0b9e){var _0x33a6c6=[_0xf26c('0x67'),_0xf26c('0x68'),_0xf26c('0x69'),_0xf26c('0x6a'),_0xf26c('0x6b'),'Openchannel',_0xf26c('0x6d')];return db[_0xf26c('0x6e')][_0xf26c('0x6f')](function(_0x582c01){var _0x4c2dcf=_[_0xf26c('0x36')](_0x33a6c6,function(_0xd7f068){var _0xb6ce25={'attributes':['id','name']};return _0x5b0b9e[_0xf26c('0x26')+_0xd7f068+_0xf26c('0x5f')](_0xb6ce25)['then'](function(_0x4c17b0){var _0xd9da59=_[_0xf26c('0x36')](_0x4c17b0,function(_0x4c1543){return _0x4c1543[_0xf26c('0x7f')](_0x5e732d['query']['ids'],{'transaction':_0x582c01})[_0xf26c('0x25')](function(){var _0x21d48f=JSON[_0xf26c('0x80')]('['+_0x5e732d['query'][_0xf26c('0x65')]+']');var _0x35ae8c=_['map'](_0x21d48f,function(_0x216b86){socket[_0xf26c('0x74')]('user'+_0xd7f068+_0xf26c('0x81'),{'UserId':Number(_0x216b86),[_0xd7f068+_0xf26c('0x75')]:_0x4c1543['id']});if(_0xd7f068!==_0xf26c('0x67'))return;return db['UserVoiceQueueRt'][_0xf26c('0x24')]({'where':{'VoiceQueueId':_0x4c1543['id'],'UserId':_0x216b86},'transaction':_0x582c01});});return Promise['all'](_0x35ae8c);});});return Promise[_0xf26c('0x7d')](_0xd9da59);});});return Promise[_0xf26c('0x7d')](_0x4c2dcf)['then'](function(){return _0x5b0b9e['removeAgents'](_0x5e732d['query'][_0xf26c('0x65')],{'transaction':_0x582c01});});});}})['then'](respondWithStatusCode(_0x4a4e9a,null))[_0xf26c('0x4e')](handleError(_0x4a4e9a,null));};exports[_0xf26c('0x82')]=function(_0x51120a,_0x387f54,_0x96e7e8){var _0x22fc04={};var _0x5b4c0a={};var _0x1e3964;var _0x716622;return db[_0xf26c('0x33')][_0xf26c('0x57')]({'where':{'id':_0x51120a[_0xf26c('0x49')]['id']}})[_0xf26c('0x25')](handleEntityNotFound(_0x387f54,null))[_0xf26c('0x25')](function(_0x49427d){if(_0x49427d){_0x1e3964=_0x49427d;_0x5b4c0a[_0xf26c('0x35')]=_[_0xf26c('0x38')](db['User'][_0xf26c('0x34')]);_0x5b4c0a[_0xf26c('0x37')]=_[_0xf26c('0x38')](_0x51120a[_0xf26c('0x37')]);_0x5b4c0a[_0xf26c('0x39')]=_[_0xf26c('0x3a')](_0x5b4c0a[_0xf26c('0x35')],_0x5b4c0a[_0xf26c('0x37')]);_0x22fc04[_0xf26c('0x3c')]=_[_0xf26c('0x3a')](_0x5b4c0a[_0xf26c('0x35')],qs[_0xf26c('0x3b')](_0x51120a[_0xf26c('0x37')][_0xf26c('0x3b')]));_0x22fc04['attributes']=_0x22fc04['attributes'][_0xf26c('0x4a')]?_0x22fc04['attributes']:_0x5b4c0a['model'];_0x22fc04[_0xf26c('0x40')]=qs[_0xf26c('0x41')](_0x51120a['query'][_0xf26c('0x41')]);_0x22fc04[_0xf26c('0x42')]=qs[_0xf26c('0x39')](_[_0xf26c('0x43')](_0x51120a[_0xf26c('0x37')],_0x5b4c0a[_0xf26c('0x39')]));if(_0x51120a[_0xf26c('0x37')][_0xf26c('0x44')]){_0x22fc04['where']=_[_0xf26c('0x2c')](_0x22fc04['where'],{'$or':_[_0xf26c('0x36')](_0x22fc04[_0xf26c('0x3c')],function(_0x3098da){var _0x14e3b2={};_0x14e3b2[_0x3098da]={'$like':'%'+_0x51120a['query'][_0xf26c('0x44')]+'%'};return _0x14e3b2;})});}_0x22fc04=_[_0xf26c('0x2c')]({},_0x22fc04,_0x51120a[_0xf26c('0x4c')]);return _0x1e3964['getAgents'](_0x22fc04);}})['then'](function(_0x493260){if(_0x493260){_0x716622=_0x493260['length'];if(!_0x51120a['query'][_0xf26c('0x3d')]('nolimit')){_0x22fc04[_0xf26c('0x20')]=qs[_0xf26c('0x20')](_0x51120a[_0xf26c('0x37')]['limit']);_0x22fc04['offset']=qs[_0xf26c('0x3f')](_0x51120a[_0xf26c('0x37')][_0xf26c('0x3f')]);}return _0x1e3964['getAgents'](_0x22fc04);}})[_0xf26c('0x25')](function(_0x1a6874){if(_0x1a6874){return _0x1a6874?{'count':_0x716622,'rows':_0x1a6874}:null;}})[_0xf26c('0x25')](respondWithResult(_0x387f54,null))[_0xf26c('0x4e')](handleError(_0x387f54,null));}; \ No newline at end of file +var _0x04e5=['limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Whatsapp','sequelize','transaction','through','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','spread','removeAgents','Openchannel','parse','emit','Queue:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','offset','undefined','count','apply','reject','save','update','then','destroy','Teams','UserProfileResource','sendStatus','error','stack','name','send','render','merge','contact','message','agent','interaction','account','index','map','Team','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x04e5,0x1e8));var _0x504e=function(_0x284421,_0x504740){_0x284421=_0x284421-0x0;var _0x26467f=_0x04e5[_0x284421];return _0x26467f;};'use strict';var emlformat=require(_0x504e('0x0'));var rimraf=require(_0x504e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x504e('0x2'));var moment=require(_0x504e('0x3'));var BPromise=require(_0x504e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x504e('0x5'));var csv=require(_0x504e('0x6'));var ejs=require(_0x504e('0x7'));var fs=require('fs');var fs_extra=require(_0x504e('0x8'));var _=require(_0x504e('0x9'));var squel=require('squel');var crypto=require(_0x504e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x504e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x504e('0xc'));var Papa=require(_0x504e('0xd'));var Redis=require('ioredis');var authService=require(_0x504e('0xe'));var qs=require(_0x504e('0xf'));var as=require(_0x504e('0x10'));var hardwareService=require(_0x504e('0x11'));var logger=require(_0x504e('0x12'))(_0x504e('0x13'));var utils=require(_0x504e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x504e('0x15'));var db=require(_0x504e('0x16'))['db'];config[_0x504e('0x17')]=_[_0x504e('0x18')](config['redis'],{'host':_0x504e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x504e('0x17')]));require(_0x504e('0x1a'))[_0x504e('0x1b')](socket);function respondWithStatusCode(_0x2ceef5,_0x209356){_0x209356=_0x209356||0xcc;return function(_0x5202b7){if(_0x5202b7){return _0x2ceef5['sendStatus'](_0x209356);}return _0x2ceef5[_0x504e('0x1c')](_0x209356)[_0x504e('0x1d')]();};}function respondWithResult(_0x344b67,_0x1ce063){_0x1ce063=_0x1ce063||0xc8;return function(_0x28440f){if(_0x28440f){return _0x344b67[_0x504e('0x1c')](_0x1ce063)['json'](_0x28440f);}};}function respondWithFilteredResult(_0x5d1c38,_0x440552){return function(_0x4e723c){if(_0x4e723c){var _0x37bf7b=typeof _0x440552[_0x504e('0x1e')]===_0x504e('0x1f')&&typeof _0x440552['limit']===_0x504e('0x1f');var _0x1d09cc=_0x4e723c[_0x504e('0x20')];var _0x1e1a40=_0x37bf7b?0x0:_0x440552[_0x504e('0x1e')];var _0x270010=_0x37bf7b?_0x4e723c[_0x504e('0x20')]:_0x440552[_0x504e('0x1e')]+_0x440552['limit'];var _0x27c574;if(_0x270010>=_0x1d09cc){_0x270010=_0x1d09cc;_0x27c574=0xc8;}else{_0x27c574=0xce;}_0x5d1c38[_0x504e('0x1c')](_0x27c574);return _0x5d1c38['set']('Content-Range',_0x1e1a40+'-'+_0x270010+'/'+_0x1d09cc)['json'](_0x4e723c);}return null;};}function patchUpdates(_0x56a28b){return function(_0x4beaf1){try{jsonpatch[_0x504e('0x21')](_0x4beaf1,_0x56a28b,!![]);}catch(_0x3ba569){return BPromise[_0x504e('0x22')](_0x3ba569);}return _0x4beaf1[_0x504e('0x23')]();};}function saveUpdates(_0x2aff54,_0x4f82f7){return function(_0x36a708){if(_0x36a708){return _0x36a708[_0x504e('0x24')](_0x2aff54)[_0x504e('0x25')](function(_0x12d756){return _0x12d756;});}return null;};}function removeEntity(_0x5e6544,_0x1da3cf){return function(_0x3516a4){if(_0x3516a4){return _0x3516a4[_0x504e('0x26')]()[_0x504e('0x25')](function(){var _0xe3f29e=_0x3516a4['get']({'plain':!![]});var _0x2d96f6=_0x504e('0x27');return db[_0x504e('0x28')][_0x504e('0x26')]({'where':{'type':_0x2d96f6,'resourceId':_0xe3f29e['id']}})[_0x504e('0x25')](function(){return _0x3516a4;});})[_0x504e('0x25')](function(){_0x5e6544['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x303a8,_0x15ca8a){return function(_0x4c4932){if(!_0x4c4932){_0x303a8[_0x504e('0x29')](0x194);}return _0x4c4932;};}function handleError(_0x5e5b97,_0x33a4e5){_0x33a4e5=_0x33a4e5||0x1f4;return function(_0x555db8){logger[_0x504e('0x2a')](_0x555db8[_0x504e('0x2b')]);if(_0x555db8[_0x504e('0x2c')]){delete _0x555db8['name'];}_0x5e5b97['status'](_0x33a4e5)[_0x504e('0x2d')](_0x555db8);};}function getMustacheRender(_0x36f0e5,_0x303544){return Mustache[_0x504e('0x2e')](_0x36f0e5,_[_0x504e('0x2f')](_0x303544['body'],{'contact':_0x303544[_0x504e('0x30')],'message':_0x303544[_0x504e('0x31')],'agent':_0x303544[_0x504e('0x32')],'interaction':_0x303544[_0x504e('0x33')],'account':_0x303544[_0x504e('0x34')]}))||'';}exports[_0x504e('0x35')]=function(_0x3508d9,_0x365ec1){var _0x4926b0={},_0x3f5b81={},_0x3e6305={'count':0x0,'rows':[]};var _0x5bc7ad=_[_0x504e('0x36')](db[_0x504e('0x37')]['rawAttributes'],function(_0x4603d9){return{'name':_0x4603d9[_0x504e('0x38')],'type':_0x4603d9[_0x504e('0x39')]['key']};});_0x3f5b81['model']=_[_0x504e('0x36')](_0x5bc7ad,'name');_0x3f5b81[_0x504e('0x3a')]=_[_0x504e('0x3b')](_0x3508d9[_0x504e('0x3a')]);_0x3f5b81[_0x504e('0x3c')]=_['intersection'](_0x3f5b81[_0x504e('0x3d')],_0x3f5b81[_0x504e('0x3a')]);_0x4926b0['attributes']=_[_0x504e('0x3e')](_0x3f5b81['model'],qs['fields'](_0x3508d9[_0x504e('0x3a')][_0x504e('0x3f')]));_0x4926b0[_0x504e('0x40')]=_0x4926b0[_0x504e('0x40')][_0x504e('0x41')]?_0x4926b0[_0x504e('0x40')]:_0x3f5b81['model'];if(!_0x3508d9[_0x504e('0x3a')][_0x504e('0x42')](_0x504e('0x43'))){_0x4926b0[_0x504e('0x44')]=qs[_0x504e('0x44')](_0x3508d9[_0x504e('0x3a')][_0x504e('0x44')]);_0x4926b0[_0x504e('0x1e')]=qs[_0x504e('0x1e')](_0x3508d9[_0x504e('0x3a')]['offset']);}_0x4926b0[_0x504e('0x45')]=qs[_0x504e('0x46')](_0x3508d9[_0x504e('0x3a')][_0x504e('0x46')]);_0x4926b0[_0x504e('0x47')]=qs[_0x504e('0x3c')](_[_0x504e('0x48')](_0x3508d9[_0x504e('0x3a')],_0x3f5b81['filters']),_0x5bc7ad);if(_0x3508d9[_0x504e('0x3a')][_0x504e('0x49')]){_0x4926b0['where']=_[_0x504e('0x2f')](_0x4926b0[_0x504e('0x47')],{'$or':_[_0x504e('0x36')](_0x5bc7ad,function(_0x20e573){if(_0x20e573[_0x504e('0x39')]!==_0x504e('0x4a')){var _0x1aecae={};_0x1aecae[_0x20e573[_0x504e('0x2c')]]={'$like':'%'+_0x3508d9[_0x504e('0x3a')][_0x504e('0x49')]+'%'};return _0x1aecae;}})});}_0x4926b0=_['merge']({},_0x4926b0,_0x3508d9[_0x504e('0x4b')]);var _0x2fc648={'where':_0x4926b0[_0x504e('0x47')]};return db[_0x504e('0x37')][_0x504e('0x20')](_0x2fc648)[_0x504e('0x25')](function(_0x435a9){_0x3e6305[_0x504e('0x20')]=_0x435a9;if(_0x3508d9[_0x504e('0x3a')]['includeAll']){_0x4926b0[_0x504e('0x4c')]=[{'all':!![]}];}return db[_0x504e('0x37')][_0x504e('0x4d')](_0x4926b0);})['then'](function(_0x5992e9){_0x3e6305[_0x504e('0x4e')]=_0x5992e9;return _0x3e6305;})[_0x504e('0x25')](respondWithFilteredResult(_0x365ec1,_0x4926b0))[_0x504e('0x4f')](handleError(_0x365ec1,null));};exports[_0x504e('0x50')]=function(_0x282bfb,_0x5237cd){var _0x50a7e5={'raw':![],'where':{'id':_0x282bfb['params']['id']}},_0x491ad4={};_0x491ad4[_0x504e('0x3d')]=_['keys'](db['Team'][_0x504e('0x51')]);_0x491ad4['query']=_[_0x504e('0x3b')](_0x282bfb['query']);_0x491ad4[_0x504e('0x3c')]=_['intersection'](_0x491ad4[_0x504e('0x3d')],_0x491ad4[_0x504e('0x3a')]);_0x50a7e5[_0x504e('0x40')]=_[_0x504e('0x3e')](_0x491ad4[_0x504e('0x3d')],qs[_0x504e('0x3f')](_0x282bfb[_0x504e('0x3a')][_0x504e('0x3f')]));_0x50a7e5['attributes']=_0x50a7e5['attributes'][_0x504e('0x41')]?_0x50a7e5['attributes']:_0x491ad4['model'];if(_0x282bfb[_0x504e('0x3a')][_0x504e('0x52')]){_0x50a7e5[_0x504e('0x4c')]=[{'all':!![]}];}_0x50a7e5=_['merge']({},_0x50a7e5,_0x282bfb[_0x504e('0x4b')]);return db[_0x504e('0x37')][_0x504e('0x53')](_0x50a7e5)['then'](handleEntityNotFound(_0x5237cd,null))[_0x504e('0x25')](respondWithResult(_0x5237cd,null))['catch'](handleError(_0x5237cd,null));};exports[_0x504e('0x54')]=function(_0x56ce4f,_0x35f9c1){return db[_0x504e('0x37')][_0x504e('0x54')](_0x56ce4f[_0x504e('0x55')],{})[_0x504e('0x25')](function(_0x35fccb){var _0xdbb3c9=_0x56ce4f['user'][_0x504e('0x56')]({'plain':!![]});if(!_0xdbb3c9)throw new Error(_0x504e('0x57'));if(_0xdbb3c9[_0x504e('0x58')]===_0x504e('0x59')){var _0x12cc1a=_0x35fccb['get']({'plain':!![]});var _0x3ff9e6='Teams';return db['UserProfileSection'][_0x504e('0x53')]({'where':{'name':_0x3ff9e6,'userProfileId':_0xdbb3c9['userProfileId']},'raw':!![]})[_0x504e('0x25')](function(_0xc5f02e){if(_0xc5f02e&&_0xc5f02e[_0x504e('0x5a')]===0x0){return db['UserProfileResource'][_0x504e('0x54')]({'name':_0x12cc1a[_0x504e('0x2c')],'resourceId':_0x12cc1a['id'],'type':_0xc5f02e[_0x504e('0x2c')],'sectionId':_0xc5f02e['id']},{})[_0x504e('0x25')](function(){return _0x35fccb;});}else{return _0x35fccb;}})[_0x504e('0x4f')](function(_0x4e49f9){logger[_0x504e('0x2a')](_0x504e('0x5b'),_0x4e49f9);throw _0x4e49f9;});}return _0x35fccb;})['then'](respondWithResult(_0x35f9c1,0xc9))[_0x504e('0x4f')](handleError(_0x35f9c1,null));};exports[_0x504e('0x24')]=function(_0x582731,_0x428f4b){if(_0x582731[_0x504e('0x55')]['id']){delete _0x582731['body']['id'];}return db[_0x504e('0x37')][_0x504e('0x53')]({'where':{'id':_0x582731[_0x504e('0x5c')]['id']}})[_0x504e('0x25')](handleEntityNotFound(_0x428f4b,null))[_0x504e('0x25')](saveUpdates(_0x582731[_0x504e('0x55')],null))[_0x504e('0x25')](respondWithResult(_0x428f4b,null))[_0x504e('0x4f')](handleError(_0x428f4b,null));};exports['destroy']=function(_0x271d3d,_0x46febb){return db[_0x504e('0x37')][_0x504e('0x53')]({'where':{'id':_0x271d3d['params']['id']}})[_0x504e('0x25')](handleEntityNotFound(_0x46febb,null))[_0x504e('0x25')](removeEntity(_0x46febb,null))[_0x504e('0x4f')](handleError(_0x46febb,null));};exports[_0x504e('0x5d')]=function(_0x5d1403,_0x307700,_0xf6a5e){return db[_0x504e('0x37')][_0x504e('0x5e')]({'where':{'id':_0x5d1403[_0x504e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x307700,null))[_0x504e('0x25')](function(_0x2f54c9){if(!_0x5d1403['query'][_0x504e('0x5f')]||!utils[_0x504e('0x60')](_0x5d1403[_0x504e('0x3a')]['channel'])){throw new db[(_0x504e('0x61'))][(_0x504e('0x62'))]('Unknown\x20channel');}var _0x4f3dbc={};var _0x2d0c5a={};_0x2d0c5a[_0x504e('0x3d')]=_[_0x504e('0x3b')](db[_[_0x504e('0x63')](_0x5d1403['query'][_0x504e('0x5f')][_0x504e('0x64')]())+'Queue'][_0x504e('0x51')]);_0x2d0c5a['query']=_[_0x504e('0x3b')](_0x5d1403['query']);_0x2d0c5a['filters']=_[_0x504e('0x3e')](_0x2d0c5a[_0x504e('0x3d')],_0x2d0c5a['query']);_0x4f3dbc[_0x504e('0x40')]=_[_0x504e('0x3e')](_0x2d0c5a[_0x504e('0x3d')],qs[_0x504e('0x3f')](_0x5d1403[_0x504e('0x3a')][_0x504e('0x3f')]));_0x4f3dbc[_0x504e('0x40')]=_0x4f3dbc['attributes'][_0x504e('0x41')]?_0x4f3dbc['attributes']:_0x2d0c5a['model'];_0x4f3dbc['limit']=qs[_0x504e('0x44')](_0x5d1403[_0x504e('0x3a')][_0x504e('0x44')]);_0x4f3dbc[_0x504e('0x1e')]=qs[_0x504e('0x1e')](_0x5d1403[_0x504e('0x3a')]['offset']);_0x4f3dbc['order']=qs[_0x504e('0x46')](_0x5d1403[_0x504e('0x3a')][_0x504e('0x46')]);_0x4f3dbc[_0x504e('0x47')]=qs[_0x504e('0x3c')](_['pick'](_0x5d1403['query'],_0x2d0c5a['filters']));_0x4f3dbc=_[_0x504e('0x2f')]({},_0x4f3dbc,_0x5d1403[_0x504e('0x4b')]);return _0x2f54c9[_0x504e('0x56')+_[_0x504e('0x63')](_0x5d1403[_0x504e('0x3a')][_0x504e('0x5f')]['toLowerCase']())+_0x504e('0x65')](_0x4f3dbc);})[_0x504e('0x25')](respondWithResult(_0x307700,null))[_0x504e('0x4f')](handleError(_0x307700,null));};exports[_0x504e('0x66')]=function(_0x3ae613,_0x5df743,_0x372e45){return db[_0x504e('0x37')][_0x504e('0x5e')]({'where':{'id':_0x3ae613[_0x504e('0x5c')]['id']}})[_0x504e('0x25')](function(_0xa78f87){if(_0xa78f87){if(!_0x3ae613[_0x504e('0x55')][_0x504e('0x5f')]||!utils[_0x504e('0x60')](_0x3ae613['body'][_0x504e('0x5f')])){throw new db[(_0x504e('0x61'))][(_0x504e('0x62'))](_0x504e('0x67'));}return _0xa78f87[_0x504e('0x68')+_[_0x504e('0x63')](_0x3ae613[_0x504e('0x55')][_0x504e('0x5f')][_0x504e('0x64')]())+_0x504e('0x65')](_0x3ae613[_0x504e('0x55')][_0x504e('0x69')]);}return null;})[_0x504e('0x25')](handleEntityNotFound(_0x5df743,null))['then'](respondWithStatusCode(_0x5df743,null))[_0x504e('0x4f')](handleError(_0x5df743,null));};exports[_0x504e('0x6a')]=function(_0xad828,_0xe185e,_0x282519){return db[_0x504e('0x37')]['findOne']({'where':{'id':_0xad828[_0x504e('0x5c')]['id']}})[_0x504e('0x25')](function(_0x51abb1){if(_0x51abb1){if(!_0xad828[_0x504e('0x3a')][_0x504e('0x5f')]||!utils[_0x504e('0x60')](_0xad828[_0x504e('0x3a')][_0x504e('0x5f')])){throw new db[(_0x504e('0x61'))][(_0x504e('0x62'))](_0x504e('0x67'));}return _0x51abb1[_0x504e('0x6b')+_['capitalize'](_0xad828['query'][_0x504e('0x5f')][_0x504e('0x64')]())+_0x504e('0x65')](_0xad828['query'][_0x504e('0x69')]);}return null;})['then'](handleEntityNotFound(_0xe185e,null))[_0x504e('0x25')](respondWithStatusCode(_0xe185e,null))['catch'](handleError(_0xe185e,null));};exports[_0x504e('0x6c')]=function(_0xdef084,_0x2a2a94){return db[_0x504e('0x37')][_0x504e('0x53')]({'where':{'id':_0xdef084['params']['id']}})['then'](handleEntityNotFound(_0x2a2a94,null))['then'](function(_0x11d122){if(_0x11d122){var _0x1e250e=[_0x504e('0x6d'),_0x504e('0x6e'),_0x504e('0x6f'),_0x504e('0x70'),_0x504e('0x71'),'Openchannel',_0x504e('0x72')];return db[_0x504e('0x73')][_0x504e('0x74')](function(_0x1a4158){var _0x295aaa=_[_0x504e('0x36')](_0x1e250e,function(_0x4b44f1){var _0x2be24d={'attributes':['id','name']};if(_0x4b44f1==='Voice'){_0x2be24d[_0x504e('0x75')]={'attributes':[_0x504e('0x76')]};}return _0x11d122[_0x504e('0x56')+_0x4b44f1+'Queues'](_0x2be24d)[_0x504e('0x25')](function(_0x594c41){var _0x10b325=_['map'](_0x594c41,function(_0x490e39){var _0x5c82ae=_[_0x504e('0x36')](_0xdef084[_0x504e('0x55')]['ids'],function(_0x3278b8){var _0x1a7a5d={'where':{'UserId':_0x3278b8,[_0x4b44f1+_0x504e('0x77')]:_0x490e39['id']},'transaction':_0x1a4158};if(_0x4b44f1===_0x504e('0x6d')){_0x1a7a5d[_0x504e('0x18')]={'penalty':_0x490e39[_0x504e('0x78')][_0x504e('0x76')]};}return db[_0x504e('0x79')+_0x4b44f1+_0x504e('0x7a')][_0x504e('0x7b')](_0x1a7a5d)[_0x504e('0x25')](function(){socket['emit'](_0x504e('0x59')+_0x4b44f1+_0x504e('0x7c'),{'UserId':_0x3278b8,[_0x4b44f1+_0x504e('0x77')]:_0x490e39['id']});if(_0x4b44f1!==_0x504e('0x6d'))return;return db[_0x504e('0x79')][_0x504e('0x4d')]({'where':{'id':_0xdef084[_0x504e('0x55')]['ids'],'online':0x1},'attributes':['id',_0x504e('0x2c'),_0x504e('0x7d'),_0x504e('0x7e'),_0x504e('0x7f')],'raw':!![]})[_0x504e('0x25')](function(_0x51f3f4){var _0x27ffb5=_[_0x504e('0x36')](_0x51f3f4,function(_0x268183){return db[_0x504e('0x80')][_0x504e('0x81')]({'membername':_0x268183[_0x504e('0x2c')],'UserId':_0x268183['id'],'queue_name':_0x490e39['name'],'VoiceQueueId':_0x490e39['id'],'interface':_[_0x504e('0x82')](_0x268183[_0x504e('0x7f')])?util['format']('SIP/%s',_0x268183['name']):_0x268183[_0x504e('0x7f')],'paused':_0x268183[_0x504e('0x7e')]||![],'penalty':_0x490e39[_0x504e('0x78')][_0x504e('0x76')]},{'transaction':_0x1a4158});});return Promise[_0x504e('0x83')](_0x27ffb5);});});});return Promise[_0x504e('0x83')](_0x5c82ae);});return Promise['all'](_0x10b325);});});return Promise[_0x504e('0x83')](_0x295aaa)[_0x504e('0x25')](function(){return _0x11d122[_0x504e('0x6c')](_0xdef084[_0x504e('0x55')][_0x504e('0x69')],{'transaction':_0x1a4158})[_0x504e('0x84')](function(_0x246195){return _0x246195;});});});}})[_0x504e('0x25')](respondWithResult(_0x2a2a94,null))[_0x504e('0x4f')](handleError(_0x2a2a94,null));};exports[_0x504e('0x85')]=function(_0x113bb3,_0x26ec24){return db[_0x504e('0x37')][_0x504e('0x53')]({'where':{'id':_0x113bb3['params']['id']}})['then'](handleEntityNotFound(_0x26ec24,null))[_0x504e('0x25')](function(_0x2c1311){if(_0x2c1311){var _0x2ac82c=['Voice','Chat',_0x504e('0x6f'),'Sms',_0x504e('0x71'),_0x504e('0x86'),_0x504e('0x72')];return db[_0x504e('0x73')][_0x504e('0x74')](function(_0x4b2c0d){var _0x1b04ef=_['map'](_0x2ac82c,function(_0x160797){var _0x507f98={'attributes':['id','name']};return _0x2c1311['get'+_0x160797+_0x504e('0x65')](_0x507f98)[_0x504e('0x25')](function(_0x2a5f28){var _0x21b1a2=_['map'](_0x2a5f28,function(_0x4a0e0c){return _0x4a0e0c[_0x504e('0x85')](_0x113bb3[_0x504e('0x3a')]['ids'],{'transaction':_0x4b2c0d})[_0x504e('0x25')](function(){var _0x2f37f3=JSON[_0x504e('0x87')]('['+_0x113bb3[_0x504e('0x3a')][_0x504e('0x69')]+']');var _0x24c3a1=_[_0x504e('0x36')](_0x2f37f3,function(_0x385464){socket[_0x504e('0x88')]('user'+_0x160797+_0x504e('0x89'),{'UserId':Number(_0x385464),[_0x160797+'QueueId']:_0x4a0e0c['id']});if(_0x160797!==_0x504e('0x6d'))return;return db[_0x504e('0x80')][_0x504e('0x26')]({'where':{'VoiceQueueId':_0x4a0e0c['id'],'UserId':_0x385464},'transaction':_0x4b2c0d});});return Promise[_0x504e('0x83')](_0x24c3a1);});});return Promise[_0x504e('0x83')](_0x21b1a2);});});return Promise[_0x504e('0x83')](_0x1b04ef)[_0x504e('0x25')](function(){return _0x2c1311[_0x504e('0x85')](_0x113bb3[_0x504e('0x3a')]['ids'],{'transaction':_0x4b2c0d});});});}})['then'](respondWithStatusCode(_0x26ec24,null))[_0x504e('0x4f')](handleError(_0x26ec24,null));};exports[_0x504e('0x8a')]=function(_0x1ea614,_0x170a33,_0x27d25e){var _0x46f53e={};var _0x262116={};var _0x134b6a;var _0xfdc9;return db[_0x504e('0x37')][_0x504e('0x5e')]({'where':{'id':_0x1ea614['params']['id']}})[_0x504e('0x25')](handleEntityNotFound(_0x170a33,null))[_0x504e('0x25')](function(_0x49c2c9){if(_0x49c2c9){_0x134b6a=_0x49c2c9;_0x262116['model']=_[_0x504e('0x3b')](db[_0x504e('0x79')][_0x504e('0x51')]);_0x262116[_0x504e('0x3a')]=_[_0x504e('0x3b')](_0x1ea614['query']);_0x262116['filters']=_[_0x504e('0x3e')](_0x262116['model'],_0x262116['query']);_0x46f53e[_0x504e('0x40')]=_[_0x504e('0x3e')](_0x262116['model'],qs['fields'](_0x1ea614[_0x504e('0x3a')][_0x504e('0x3f')]));_0x46f53e[_0x504e('0x40')]=_0x46f53e[_0x504e('0x40')][_0x504e('0x41')]?_0x46f53e[_0x504e('0x40')]:_0x262116[_0x504e('0x3d')];_0x46f53e['order']=qs[_0x504e('0x46')](_0x1ea614[_0x504e('0x3a')][_0x504e('0x46')]);_0x46f53e[_0x504e('0x47')]=qs[_0x504e('0x3c')](_[_0x504e('0x48')](_0x1ea614['query'],_0x262116[_0x504e('0x3c')]));if(_0x1ea614[_0x504e('0x3a')][_0x504e('0x49')]){_0x46f53e['where']=_['merge'](_0x46f53e['where'],{'$or':_[_0x504e('0x36')](_0x46f53e[_0x504e('0x40')],function(_0x23455e){var _0x534215={};_0x534215[_0x23455e]={'$like':'%'+_0x1ea614[_0x504e('0x3a')]['filter']+'%'};return _0x534215;})});}_0x46f53e=_[_0x504e('0x2f')]({},_0x46f53e,_0x1ea614[_0x504e('0x4b')]);return _0x134b6a[_0x504e('0x8a')](_0x46f53e);}})[_0x504e('0x25')](function(_0x2920aa){if(_0x2920aa){_0xfdc9=_0x2920aa[_0x504e('0x41')];if(!_0x1ea614[_0x504e('0x3a')]['hasOwnProperty'](_0x504e('0x43'))){_0x46f53e[_0x504e('0x44')]=qs[_0x504e('0x44')](_0x1ea614[_0x504e('0x3a')][_0x504e('0x44')]);_0x46f53e[_0x504e('0x1e')]=qs['offset'](_0x1ea614[_0x504e('0x3a')][_0x504e('0x1e')]);}return _0x134b6a[_0x504e('0x8a')](_0x46f53e);}})[_0x504e('0x25')](function(_0x31e6c1){if(_0x31e6c1){return _0x31e6c1?{'count':_0xfdc9,'rows':_0x31e6c1}:null;}})[_0x504e('0x25')](respondWithResult(_0x170a33,null))['catch'](handleError(_0x170a33,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b86a8f9..570a1db 100644 --- a/server/api/team/team.events.js +++ b/server/api/team/team.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d6b=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hook'];(function(_0x18f8ff,_0x257e95){var _0x18de97=function(_0xc8eb68){while(--_0xc8eb68){_0x18f8ff['push'](_0x18f8ff['shift']());}};_0x18de97(++_0x257e95);}(_0x8d6b,0x79));var _0xb8d6=function(_0x36e637,_0x308719){_0x36e637=_0x36e637-0x0;var _0x59e4f0=_0x8d6b[_0x36e637];return _0x59e4f0;};'use strict';var EventEmitter=require(_0xb8d6('0x0'));var Team=require(_0xb8d6('0x1'))['db'][_0xb8d6('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb8d6('0x3')](0x0);var events={'afterCreate':_0xb8d6('0x4'),'afterUpdate':_0xb8d6('0x5'),'afterDestroy':_0xb8d6('0x6')};function emitEvent(_0x13b4b4){return function(_0xd48662,_0x1783cf,_0x3a301c){TeamEvents[_0xb8d6('0x7')](_0x13b4b4+':'+_0xd48662['id'],_0xd48662);TeamEvents[_0xb8d6('0x7')](_0x13b4b4,_0xd48662);_0x3a301c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xb8d6('0x8')](e,emitEvent(event));}}module[_0xb8d6('0x9')]=TeamEvents; \ No newline at end of file +var _0x5ef3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x4b77a4,_0x238eef){var _0x434550=function(_0x24ae69){while(--_0x24ae69){_0x4b77a4['push'](_0x4b77a4['shift']());}};_0x434550(++_0x238eef);}(_0x5ef3,0xa6));var _0x35ef=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x5ef3[_0x220f3f];return _0x1f170e;};'use strict';var EventEmitter=require(_0x35ef('0x0'));var Team=require(_0x35ef('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x35ef('0x2'),'afterUpdate':_0x35ef('0x3'),'afterDestroy':_0x35ef('0x4')};function emitEvent(_0x17cfce){return function(_0x2d6b98,_0x1d13fa,_0x2341fe){TeamEvents['emit'](_0x17cfce+':'+_0x2d6b98['id'],_0x2d6b98);TeamEvents[_0x35ef('0x5')](_0x17cfce,_0x2d6b98);_0x2341fe(null);};}for(var e in events){if(events[_0x35ef('0x6')](e)){var event=events[e];Team[_0x35ef('0x7')](e,emitEvent(event));}}module[_0x35ef('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 127613b..6087e8c 100644 --- a/server/api/team/team.model.js +++ b/server/api/team/team.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29e5=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x53aed1,_0x5c69dd){var _0x28c4ef=function(_0x25458b){while(--_0x25458b){_0x53aed1['push'](_0x53aed1['shift']());}};_0x28c4ef(++_0x5c69dd);}(_0x29e5,0x180));var _0x529e=function(_0x21667e,_0x43b956){_0x21667e=_0x21667e-0x0;var _0x36511a=_0x29e5[_0x21667e];return _0x36511a;};'use strict';var _=require(_0x529e('0x0'));var util=require(_0x529e('0x1'));var logger=require(_0x529e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x529e('0x3'));var rp=require(_0x529e('0x4'));var fs=require('fs');var path=require(_0x529e('0x5'));var rimraf=require(_0x529e('0x6'));var config=require(_0x529e('0x7'));var attributes=require(_0x529e('0x8'));module[_0x529e('0x9')]=function(_0x5b0cea,_0x22182b){return _0x5b0cea[_0x529e('0xa')](_0x529e('0xb'),attributes,{'tableName':_0x529e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffc=['exports','define','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./team.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ffc,0x66));var _0xc9ff=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0x9ffc[_0x577077];return _0x370769;};'use strict';var _=require(_0xc9ff('0x0'));var util=require(_0xc9ff('0x1'));var logger=require(_0xc9ff('0x2'))(_0xc9ff('0x3'));var moment=require(_0xc9ff('0x4'));var BPromise=require(_0xc9ff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9ff('0x6'));var rimraf=require(_0xc9ff('0x7'));var config=require(_0xc9ff('0x8'));var attributes=require(_0xc9ff('0x9'));module[_0xc9ff('0xa')]=function(_0x44a31c,_0x1d9cda){return _0x44a31c[_0xc9ff('0xb')](_0xc9ff('0xc'),attributes,{'tableName':_0xc9ff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index c39545a..a9bbe87 100644 --- a/server/api/team/team.rpc.js +++ b/server/api/team/team.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fc1=['error','code','Team,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x12a06b,_0x417b51){var _0x5d0bb8=function(_0x41d3d0){while(--_0x41d3d0){_0x12a06b['push'](_0x12a06b['shift']());}};_0x5d0bb8(++_0x417b51);}(_0x8fc1,0x14a));var _0x18fc=function(_0x58e207,_0x56ce67){_0x58e207=_0x58e207-0x0;var _0x5d43eb=_0x8fc1[_0x58e207];return _0x5d43eb;};'use strict';var _=require(_0x18fc('0x0'));var util=require('util');var moment=require(_0x18fc('0x1'));var BPromise=require(_0x18fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18fc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x18fc('0x4'));var logger=require(_0x18fc('0x5'))(_0x18fc('0x6'));var config=require(_0x18fc('0x7'));var jayson=require(_0x18fc('0x8'));var client=jayson[_0x18fc('0x9')]['http']({'port':0x232a});config[_0x18fc('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x18fc('0xb'))(new Redis(config[_0x18fc('0xa')]));require(_0x18fc('0xc'))[_0x18fc('0xd')](socket);function respondWithRpcPromise(_0x2a6396,_0x20aac9,_0x11325f){return new BPromise(function(_0x5dc9d7,_0x4b9c47){return client[_0x18fc('0xe')](_0x2a6396,_0x11325f)[_0x18fc('0xf')](function(_0x11ba5a){logger[_0x18fc('0x10')]('Team,\x20%s,\x20%s',_0x20aac9,_0x18fc('0x11'));logger[_0x18fc('0x12')](_0x18fc('0x13'),_0x20aac9,_0x18fc('0x11'),JSON['stringify'](_0x11ba5a));if(_0x11ba5a['error']){if(_0x11ba5a[_0x18fc('0x14')][_0x18fc('0x15')]===0x1f4){logger[_0x18fc('0x14')](_0x18fc('0x16'),_0x20aac9,_0x11ba5a[_0x18fc('0x14')]['message']);return _0x4b9c47(_0x11ba5a[_0x18fc('0x14')][_0x18fc('0x17')]);}logger[_0x18fc('0x14')](_0x18fc('0x16'),_0x20aac9,_0x11ba5a['error'][_0x18fc('0x17')]);return _0x5dc9d7(_0x11ba5a[_0x18fc('0x14')][_0x18fc('0x17')]);}else{logger['info'](_0x18fc('0x16'),_0x20aac9,_0x18fc('0x11'));_0x5dc9d7(_0x11ba5a[_0x18fc('0x18')][_0x18fc('0x17')]);}})['catch'](function(_0x8e36f8){logger[_0x18fc('0x14')](_0x18fc('0x16'),_0x20aac9,_0x8e36f8);_0x4b9c47(_0x8e36f8);});});} \ No newline at end of file +var _0x3389=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x40968d,_0x5c197b){var _0x10292b=function(_0xf9312e){while(--_0xf9312e){_0x40968d['push'](_0x40968d['shift']());}};_0x10292b(++_0x5c197b);}(_0x3389,0x1a0));var _0x9338=function(_0x3f8038,_0x120689){_0x3f8038=_0x3f8038-0x0;var _0x1c4b3d=_0x3389[_0x3f8038];return _0x1c4b3d;};'use strict';var _=require(_0x9338('0x0'));var util=require(_0x9338('0x1'));var moment=require(_0x9338('0x2'));var BPromise=require(_0x9338('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9338('0x4'));var db=require(_0x9338('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9338('0x6'))(_0x9338('0x7'));var config=require(_0x9338('0x8'));var jayson=require(_0x9338('0x9'));var client=jayson[_0x9338('0xa')]['http']({'port':0x232a});config[_0x9338('0xb')]=_[_0x9338('0xc')](config[_0x9338('0xb')],{'host':_0x9338('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9338('0xb')]));require(_0x9338('0xe'))[_0x9338('0xf')](socket);function respondWithRpcPromise(_0x1453ef,_0x297d20,_0x95ab17){return new BPromise(function(_0x259441,_0x48ff28){return client[_0x9338('0x10')](_0x1453ef,_0x95ab17)['then'](function(_0x3a52a6){logger[_0x9338('0x11')](_0x9338('0x12'),_0x297d20,'request\x20sent');logger[_0x9338('0x13')](_0x9338('0x14'),_0x297d20,'request\x20sent',JSON[_0x9338('0x15')](_0x3a52a6));if(_0x3a52a6[_0x9338('0x16')]){if(_0x3a52a6[_0x9338('0x16')][_0x9338('0x17')]===0x1f4){logger[_0x9338('0x16')]('Team,\x20%s,\x20%s',_0x297d20,_0x3a52a6[_0x9338('0x16')]['message']);return _0x48ff28(_0x3a52a6[_0x9338('0x16')][_0x9338('0x18')]);}logger[_0x9338('0x16')](_0x9338('0x12'),_0x297d20,_0x3a52a6[_0x9338('0x16')][_0x9338('0x18')]);return _0x259441(_0x3a52a6[_0x9338('0x16')][_0x9338('0x18')]);}else{logger[_0x9338('0x11')](_0x9338('0x12'),_0x297d20,_0x9338('0x19'));_0x259441(_0x3a52a6['result'][_0x9338('0x18')]);}})['catch'](function(_0x4eb916){logger[_0x9338('0x16')](_0x9338('0x12'),_0x297d20,_0x4eb916);_0x48ff28(_0x4eb916);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 1ac372f..2f9b149 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['team:','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x3e436c,_0xebf949){var _0x3e4924=function(_0xab2179){while(--_0xab2179){_0x3e436c['push'](_0x3e436c['shift']());}};_0x3e4924(++_0xebf949);}(_0xf61e,0x191));var _0xef61=function(_0x1bcf26,_0x30d715){_0x1bcf26=_0x1bcf26-0x0;var _0x3e5a58=_0xf61e[_0x1bcf26];return _0x3e5a58;};'use strict';var TeamEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){TeamEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);TeamEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file +var _0xe062=['register','team:','./team.events','save','emit','removeListener'];(function(_0x270a0a,_0x49b09e){var _0xa8c779=function(_0x3ad8fd){while(--_0x3ad8fd){_0x270a0a['push'](_0x270a0a['shift']());}};_0xa8c779(++_0x49b09e);}(_0xe062,0x1b8));var _0x2e06=function(_0x15c8c3,_0x2aa632){_0x15c8c3=_0x15c8c3-0x0;var _0x59a444=_0xe062[_0x15c8c3];return _0x59a444;};'use strict';var TeamEvents=require(_0x2e06('0x0'));var events=[_0x2e06('0x1'),'remove','update'];function createListener(_0x127419,_0x360c3d){return function(_0x15e7a9){_0x360c3d[_0x2e06('0x2')](_0x127419,_0x15e7a9);};}function removeListener(_0x361a02,_0x28e970){return function(){TeamEvents[_0x2e06('0x3')](_0x361a02,_0x28e970);};}exports[_0x2e06('0x4')]=function(_0x7fc3ae){for(var _0x480c91=0x0,_0x52b011=events['length'];_0x480c91<_0x52b011;_0x480c91++){var _0x559195=events[_0x480c91];var _0x3e4c06=createListener(_0x2e06('0x5')+_0x559195,_0x7fc3ae);TeamEvents['on'](_0x559195,_0x3e4c06);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 5173f8b..ad65b71 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x570f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x485f95,_0x174b92){var _0x4254f0=function(_0x5bee28){while(--_0x5bee28){_0x485f95['push'](_0x485f95['shift']());}};_0x4254f0(++_0x174b92);}(_0x570f,0x152));var _0xf570=function(_0x113bef,_0x82b4a5){_0x113bef=_0x113bef-0x0;var _0x3b6d82=_0x570f[_0x113bef];return _0x3b6d82;};'use strict';var multer=require(_0xf570('0x0'));var util=require(_0xf570('0x1'));var path=require(_0xf570('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf570('0x3')]();var fs_extra=require(_0xf570('0x4'));var auth=require(_0xf570('0x5'));var interaction=require(_0xf570('0x6'));var config=require(_0xf570('0x7'));module[_0xf570('0x8')]=router; \ No newline at end of file +var _0xa45b=['../../config/environment','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x373fb3,_0x1548c0){var _0x37f841=function(_0x128f14){while(--_0x128f14){_0x373fb3['push'](_0x373fb3['shift']());}};_0x37f841(++_0x1548c0);}(_0xa45b,0x199));var _0xba45=function(_0x23557c,_0x4b780a){_0x23557c=_0x23557c-0x0;var _0x55ea88=_0xa45b[_0x23557c];return _0x55ea88;};'use strict';var multer=require('multer');var util=require(_0xba45('0x0'));var path=require(_0xba45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xba45('0x2'));var auth=require(_0xba45('0x3'));var interaction=require(_0xba45('0x4'));var config=require(_0xba45('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 3b3933a..fa0ae7d 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3d9cfa,_0x596edc){var _0x21d89d=function(_0x5668c2){while(--_0x5668c2){_0x3d9cfa['push'](_0x3d9cfa['shift']());}};_0x21d89d(++_0x596edc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0xda2147,_0x398769){var _0xb83246=function(_0x275e74){while(--_0x275e74){_0xda2147['push'](_0xda2147['shift']());}};_0xb83246(++_0x398769);}(_0xe706,0xa3));var _0x6e70=function(_0x3793bb,_0x39dfdd){_0x3793bb=_0x3793bb-0x0;var _0x380006=_0xe706[_0x3793bb];return _0x380006;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 27f5e7b..0cb3ea5 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa97b=['../../config/logger','bluebird','request-promise','path','../../config/environment','TeamVoiceQueue'];(function(_0x43508e,_0x152447){var _0x451e35=function(_0x582e67){while(--_0x582e67){_0x43508e['push'](_0x43508e['shift']());}};_0x451e35(++_0x152447);}(_0xa97b,0x1c2));var _0xba97=function(_0x353c78,_0x575846){_0x353c78=_0x353c78-0x0;var _0x2a13d4=_0xa97b[_0x353c78];return _0x2a13d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xba97('0x0'))('api');var moment=require('moment');var BPromise=require(_0xba97('0x1'));var rp=require(_0xba97('0x2'));var fs=require('fs');var path=require(_0xba97('0x3'));var rimraf=require('rimraf');var config=require(_0xba97('0x4'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x8941ab,_0x7e7c5f){return _0x8941ab['define'](_0xba97('0x5'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x095f=['util','../../config/logger','moment','bluebird','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x2c9c3d,_0x5a73fe){var _0x3365c7=function(_0xdb1a82){while(--_0xdb1a82){_0x2c9c3d['push'](_0x2c9c3d['shift']());}};_0x3365c7(++_0x5a73fe);}(_0x095f,0x15b));var _0xf095=function(_0x479e39,_0x238a93){_0x479e39=_0x479e39-0x0;var _0x5a7731=_0x095f[_0x479e39];return _0x5a7731;};'use strict';var _=require(_0xf095('0x0'));var util=require(_0xf095('0x1'));var logger=require(_0xf095('0x2'))('api');var moment=require(_0xf095('0x3'));var BPromise=require(_0xf095('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf095('0x5'));var rimraf=require(_0xf095('0x6'));var config=require('../../config/environment');var attributes=require(_0xf095('0x7'));module[_0xf095('0x8')]=function(_0x5a8376,_0x4c38b9){return _0x5a8376[_0xf095('0x9')](_0xf095('0xa'),attributes,{'tableName':_0xf095('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 7129fac..b7a36b3 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9fc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2a696c,_0x16ad22){var _0x44f2e6=function(_0x25d867){while(--_0x25d867){_0x2a696c['push'](_0x2a696c['shift']());}};_0x44f2e6(++_0x16ad22);}(_0xa9fc,0x1f3));var _0xca9f=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xa9fc[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require(_0xca9f('0x5'));var db=require(_0xca9f('0x6'))['db'];var utils=require(_0xca9f('0x7'));var logger=require(_0xca9f('0x8'))(_0xca9f('0x9'));var config=require(_0xca9f('0xa'));var jayson=require(_0xca9f('0xb'));var client=jayson['client'][_0xca9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x391c6e,_0x1cf84a,_0x3ee126){return new BPromise(function(_0xd1131e,_0x3b7113){return client[_0xca9f('0xd')](_0x391c6e,_0x3ee126)[_0xca9f('0xe')](function(_0x33d589){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x1cf84a,_0xca9f('0x11'));logger['debug'](_0xca9f('0x12'),_0x1cf84a,_0xca9f('0x11'),JSON[_0xca9f('0x13')](_0x33d589));if(_0x33d589[_0xca9f('0x14')]){if(_0x33d589[_0xca9f('0x14')][_0xca9f('0x15')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x1cf84a,_0x33d589[_0xca9f('0x14')][_0xca9f('0x16')]);return _0x3b7113(_0x33d589['error'][_0xca9f('0x16')]);}logger[_0xca9f('0x14')](_0xca9f('0x10'),_0x1cf84a,_0x33d589[_0xca9f('0x14')][_0xca9f('0x16')]);return _0xd1131e(_0x33d589[_0xca9f('0x14')][_0xca9f('0x16')]);}else{logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x1cf84a,_0xca9f('0x11'));_0xd1131e(_0x33d589['result'][_0xca9f('0x16')]);}})['catch'](function(_0x23be53){logger[_0xca9f('0x14')](_0xca9f('0x10'),_0x1cf84a,_0x23be53);_0x3b7113(_0x23be53);});});} \ No newline at end of file +var _0x22f8=['request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x1839f8,_0x816767){var _0x2cdb88=function(_0x59f503){while(--_0x59f503){_0x1839f8['push'](_0x1839f8['shift']());}};_0x2cdb88(++_0x816767);}(_0x22f8,0x1d9));var _0x822f=function(_0x14135c,_0x35bd89){_0x14135c=_0x14135c-0x0;var _0x2f6f6e=_0x22f8[_0x14135c];return _0x2f6f6e;};'use strict';var _=require(_0x822f('0x0'));var util=require(_0x822f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x822f('0x2'));var fs=require('fs');var Redis=require(_0x822f('0x3'));var db=require(_0x822f('0x4'))['db'];var utils=require(_0x822f('0x5'));var logger=require(_0x822f('0x6'))('rpc');var config=require(_0x822f('0x7'));var jayson=require(_0x822f('0x8'));var client=jayson['client'][_0x822f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d1afb,_0x5d759b,_0x35b7fb){return new BPromise(function(_0x291c32,_0x2ee5b0){return client[_0x822f('0xa')](_0x3d1afb,_0x35b7fb)[_0x822f('0xb')](function(_0x5a5c7c){logger[_0x822f('0xc')](_0x822f('0xd'),_0x5d759b,_0x822f('0xe'));logger[_0x822f('0xf')](_0x822f('0x10'),_0x5d759b,'request\x20sent',JSON['stringify'](_0x5a5c7c));if(_0x5a5c7c[_0x822f('0x11')]){if(_0x5a5c7c[_0x822f('0x11')]['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5d759b,_0x5a5c7c[_0x822f('0x11')]['message']);return _0x2ee5b0(_0x5a5c7c[_0x822f('0x11')][_0x822f('0x12')]);}logger[_0x822f('0x11')](_0x822f('0xd'),_0x5d759b,_0x5a5c7c[_0x822f('0x11')][_0x822f('0x12')]);return _0x291c32(_0x5a5c7c[_0x822f('0x11')][_0x822f('0x12')]);}else{logger[_0x822f('0xc')](_0x822f('0xd'),_0x5d759b,'request\x20sent');_0x291c32(_0x5a5c7c[_0x822f('0x13')][_0x822f('0x12')]);}})[_0x822f('0x14')](function(_0xc5075d){logger['error'](_0x822f('0xd'),_0x5d759b,_0xc5075d);_0x2ee5b0(_0xc5075d);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 327ae2d..a9c9c4e 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['get','index','/:id','show','post','put','isAuthenticated','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./template.controller'];(function(_0x229d7c,_0x2e8fd1){var _0x35c63b=function(_0x2f6d3e){while(--_0x2f6d3e){_0x229d7c['push'](_0x229d7c['shift']());}};_0x35c63b(++_0x2e8fd1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2703ca,_0x84072a){_0x2703ca=_0x2703ca-0x0;var _0x10fd38=_0xd8fb[_0x2703ca];return _0x10fd38;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd8f('0xc')](_0xbd8f('0x9'),auth[_0xbd8f('0xd')](),controller['update']);router[_0xbd8f('0xe')](_0xbd8f('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xbd8f('0xf')]=router; \ No newline at end of file +var _0xabce=['../../config/environment','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xabce[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./template.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')]('/',auth['isAuthenticated'](),controller[_0xeabc('0xc')]);router[_0xeabc('0xd')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x10')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);module[_0xeabc('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a460bc7..c705176 100644 --- a/server/api/template/template.attributes.js +++ b/server/api/template/template.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b0e=['STRING','TEXT','sequelize','exports'];(function(_0x358206,_0x36283c){var _0x78feb8=function(_0x83c6e){while(--_0x83c6e){_0x358206['push'](_0x358206['shift']());}};_0x78feb8(++_0x36283c);}(_0x1b0e,0x132));var _0xe1b0=function(_0x3f907c,_0x9895a8){_0x3f907c=_0x3f907c-0x0;var _0x2f298a=_0x1b0e[_0x3f907c];return _0x2f298a;};'use strict';var Sequelize=require(_0xe1b0('0x0'));module[_0xe1b0('0x1')]={'name':{'type':Sequelize[_0xe1b0('0x2')]},'description':{'type':Sequelize[_0xe1b0('0x2')]},'html':{'type':Sequelize[_0xe1b0('0x3')]}}; \ No newline at end of file +var _0x9a26=['sequelize','exports','STRING'];(function(_0x268619,_0x2ddbd4){var _0x47c022=function(_0x2756b6){while(--_0x2756b6){_0x268619['push'](_0x268619['shift']());}};_0x47c022(++_0x2ddbd4);}(_0x9a26,0xdb));var _0x69a2=function(_0x213650,_0x51cdc1){_0x213650=_0x213650-0x0;var _0x5d0add=_0x9a26[_0x213650];return _0x5d0add;};'use strict';var Sequelize=require(_0x69a2('0x0'));module[_0x69a2('0x1')]={'name':{'type':Sequelize[_0x69a2('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0f51fd9..e256809 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x437f=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','error','stack','name','merge','contact','message','agent','index','Template','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xc43047,_0x5a8843){var _0x391ffb=function(_0x4baef5){while(--_0x4baef5){_0xc43047['push'](_0xc43047['shift']());}};_0x391ffb(++_0x5a8843);}(_0x437f,0x14c));var _0xf437=function(_0x32497d,_0x2d305a){_0x32497d=_0x32497d-0x0;var _0x5e05aa=_0x437f[_0x32497d];return _0x5e05aa;};'use strict';var emlformat=require(_0xf437('0x0'));var rimraf=require(_0xf437('0x1'));var zipdir=require(_0xf437('0x2'));var jsonpatch=require(_0xf437('0x3'));var rp=require(_0xf437('0x4'));var moment=require(_0xf437('0x5'));var BPromise=require(_0xf437('0x6'));var Mustache=require(_0xf437('0x7'));var util=require(_0xf437('0x8'));var path=require(_0xf437('0x9'));var sox=require(_0xf437('0xa'));var csv=require(_0xf437('0xb'));var ejs=require(_0xf437('0xc'));var fs=require('fs');var fs_extra=require(_0xf437('0xd'));var _=require(_0xf437('0xe'));var squel=require(_0xf437('0xf'));var crypto=require('crypto');var jsforce=require(_0xf437('0x10'));var deskjs=require(_0xf437('0x11'));var toCsv=require(_0xf437('0xb'));var querystring=require(_0xf437('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf437('0x13'));var qs=require(_0xf437('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf437('0x15'));var logger=require(_0xf437('0x16'))(_0xf437('0x17'));var utils=require('../../config/utils');var config=require(_0xf437('0x18'));var licenseUtil=require(_0xf437('0x19'));var db=require(_0xf437('0x1a'))['db'];function respondWithStatusCode(_0x3837fa,_0x59c576){_0x59c576=_0x59c576||0xcc;return function(_0xa84e96){if(_0xa84e96){return _0x3837fa[_0xf437('0x1b')](_0x59c576);}return _0x3837fa[_0xf437('0x1c')](_0x59c576)['end']();};}function respondWithResult(_0x2dc963,_0x37fff4){_0x37fff4=_0x37fff4||0xc8;return function(_0x4e6447){if(_0x4e6447){return _0x2dc963[_0xf437('0x1c')](_0x37fff4)[_0xf437('0x1d')](_0x4e6447);}};}function respondWithFilteredResult(_0x6a794d,_0x17e1c1){return function(_0x3a3668){if(_0x3a3668){var _0x1b79f6=typeof _0x17e1c1[_0xf437('0x1e')]===_0xf437('0x1f')&&typeof _0x17e1c1[_0xf437('0x20')]==='undefined';var _0x5cce2c=_0x3a3668['count'];var _0x2570b4=_0x1b79f6?0x0:_0x17e1c1['offset'];var _0x2c2bf3=_0x1b79f6?_0x3a3668[_0xf437('0x21')]:_0x17e1c1[_0xf437('0x1e')]+_0x17e1c1[_0xf437('0x20')];var _0x4f97f3;if(_0x2c2bf3>=_0x5cce2c){_0x2c2bf3=_0x5cce2c;_0x4f97f3=0xc8;}else{_0x4f97f3=0xce;}_0x6a794d[_0xf437('0x1c')](_0x4f97f3);return _0x6a794d['set'](_0xf437('0x22'),_0x2570b4+'-'+_0x2c2bf3+'/'+_0x5cce2c)[_0xf437('0x1d')](_0x3a3668);}return null;};}function patchUpdates(_0x24f5af){return function(_0x3b7064){try{jsonpatch[_0xf437('0x23')](_0x3b7064,_0x24f5af,!![]);}catch(_0x165554){return BPromise[_0xf437('0x24')](_0x165554);}return _0x3b7064[_0xf437('0x25')]();};}function saveUpdates(_0x377eed,_0xe4323c){return function(_0x38f93f){if(_0x38f93f){return _0x38f93f[_0xf437('0x26')](_0x377eed)[_0xf437('0x27')](function(_0x2e67c2){return _0x2e67c2;});}return null;};}function removeEntity(_0x1d191d,_0x5d67c0){return function(_0x4716bb){if(_0x4716bb){return _0x4716bb[_0xf437('0x28')]()['then'](function(){var _0x556a68=_0x4716bb[_0xf437('0x29')]({'plain':!![]});var _0x402ef5=_0xf437('0x2a');return db[_0xf437('0x2b')][_0xf437('0x28')]({'where':{'type':_0x402ef5,'resourceId':_0x556a68['id']}})[_0xf437('0x27')](function(){return _0x4716bb;});})['then'](function(){_0x1d191d['status'](0xcc)[_0xf437('0x2c')]();});}};}function handleEntityNotFound(_0x7b69eb,_0x191786){return function(_0x38bf53){if(!_0x38bf53){_0x7b69eb[_0xf437('0x1b')](0x194);}return _0x38bf53;};}function handleError(_0x79b299,_0x41df27){_0x41df27=_0x41df27||0x1f4;return function(_0x147851){logger[_0xf437('0x2d')](_0x147851[_0xf437('0x2e')]);if(_0x147851['name']){delete _0x147851[_0xf437('0x2f')];}_0x79b299[_0xf437('0x1c')](_0x41df27)['send'](_0x147851);};}function getMustacheRender(_0x230f2a,_0x3ffcc1){return Mustache['render'](_0x230f2a,_[_0xf437('0x30')](_0x3ffcc1['body'],{'contact':_0x3ffcc1[_0xf437('0x31')],'message':_0x3ffcc1[_0xf437('0x32')],'agent':_0x3ffcc1[_0xf437('0x33')],'interaction':_0x3ffcc1['interaction'],'account':_0x3ffcc1['account']}))||'';}exports[_0xf437('0x34')]=function(_0x2f7592,_0x13962e){var _0x44510c={},_0x5060aa={},_0x40803a={'count':0x0,'rows':[]};var _0x565c54=_['map'](db[_0xf437('0x35')]['rawAttributes'],function(_0x4e488b){return{'name':_0x4e488b[_0xf437('0x36')],'type':_0x4e488b[_0xf437('0x37')]['key']};});_0x5060aa[_0xf437('0x38')]=_[_0xf437('0x39')](_0x565c54,_0xf437('0x2f'));_0x5060aa[_0xf437('0x3a')]=_[_0xf437('0x3b')](_0x2f7592['query']);_0x5060aa[_0xf437('0x3c')]=_[_0xf437('0x3d')](_0x5060aa[_0xf437('0x38')],_0x5060aa['query']);_0x44510c[_0xf437('0x3e')]=_[_0xf437('0x3d')](_0x5060aa[_0xf437('0x38')],qs[_0xf437('0x3f')](_0x2f7592['query'][_0xf437('0x3f')]));_0x44510c[_0xf437('0x3e')]=_0x44510c[_0xf437('0x3e')][_0xf437('0x40')]?_0x44510c[_0xf437('0x3e')]:_0x5060aa['model'];if(!_0x2f7592[_0xf437('0x3a')][_0xf437('0x41')](_0xf437('0x42'))){_0x44510c[_0xf437('0x20')]=qs[_0xf437('0x20')](_0x2f7592[_0xf437('0x3a')][_0xf437('0x20')]);_0x44510c[_0xf437('0x1e')]=qs[_0xf437('0x1e')](_0x2f7592['query'][_0xf437('0x1e')]);}_0x44510c[_0xf437('0x43')]=qs[_0xf437('0x44')](_0x2f7592[_0xf437('0x3a')][_0xf437('0x44')]);_0x44510c[_0xf437('0x45')]=qs[_0xf437('0x3c')](_['pick'](_0x2f7592[_0xf437('0x3a')],_0x5060aa[_0xf437('0x3c')]),_0x565c54);if(_0x2f7592['query'][_0xf437('0x46')]){_0x44510c['where']=_[_0xf437('0x30')](_0x44510c[_0xf437('0x45')],{'$or':_[_0xf437('0x39')](_0x565c54,function(_0x3c9675){if(_0x3c9675['type']!=='VIRTUAL'){var _0x59bc24={};_0x59bc24[_0x3c9675[_0xf437('0x2f')]]={'$like':'%'+_0x2f7592[_0xf437('0x3a')][_0xf437('0x46')]+'%'};return _0x59bc24;}})});}_0x44510c=_[_0xf437('0x30')]({},_0x44510c,_0x2f7592[_0xf437('0x47')]);var _0x41d864={'where':_0x44510c['where']};return db['Template'][_0xf437('0x21')](_0x41d864)[_0xf437('0x27')](function(_0x3506cd){_0x40803a['count']=_0x3506cd;if(_0x2f7592[_0xf437('0x3a')][_0xf437('0x48')]){_0x44510c[_0xf437('0x49')]=[{'all':!![]}];}return db[_0xf437('0x35')]['findAll'](_0x44510c);})['then'](function(_0x160f65){_0x40803a[_0xf437('0x4a')]=_0x160f65;return _0x40803a;})[_0xf437('0x27')](respondWithFilteredResult(_0x13962e,_0x44510c))[_0xf437('0x4b')](handleError(_0x13962e,null));};exports['show']=function(_0x5d29dd,_0x265220){var _0x24e396={'raw':!![],'where':{'id':_0x5d29dd[_0xf437('0x4c')]['id']}},_0x6cd718={};_0x6cd718[_0xf437('0x38')]=_[_0xf437('0x3b')](db[_0xf437('0x35')][_0xf437('0x4d')]);_0x6cd718[_0xf437('0x3a')]=_[_0xf437('0x3b')](_0x5d29dd[_0xf437('0x3a')]);_0x6cd718[_0xf437('0x3c')]=_[_0xf437('0x3d')](_0x6cd718[_0xf437('0x38')],_0x6cd718[_0xf437('0x3a')]);_0x24e396[_0xf437('0x3e')]=_['intersection'](_0x6cd718[_0xf437('0x38')],qs['fields'](_0x5d29dd[_0xf437('0x3a')][_0xf437('0x3f')]));_0x24e396[_0xf437('0x3e')]=_0x24e396[_0xf437('0x3e')][_0xf437('0x40')]?_0x24e396[_0xf437('0x3e')]:_0x6cd718['model'];if(_0x5d29dd[_0xf437('0x3a')]['includeAll']){_0x24e396[_0xf437('0x49')]=[{'all':!![]}];}_0x24e396=_[_0xf437('0x30')]({},_0x24e396,_0x5d29dd[_0xf437('0x47')]);return db[_0xf437('0x35')]['find'](_0x24e396)['then'](handleEntityNotFound(_0x265220,null))[_0xf437('0x27')](respondWithResult(_0x265220,null))[_0xf437('0x4b')](handleError(_0x265220,null));};exports[_0xf437('0x4e')]=function(_0x404bad,_0x4fe33c){return db['Template'][_0xf437('0x4e')](_0x404bad[_0xf437('0x4f')],{})['then'](function(_0x5ba710){var _0x144c3c=_0x404bad[_0xf437('0x50')][_0xf437('0x29')]({'plain':!![]});if(!_0x144c3c)throw new Error(_0xf437('0x51'));if(_0x144c3c[_0xf437('0x52')]===_0xf437('0x50')){var _0x5d1d95=_0x5ba710['get']({'plain':!![]});var _0x251774=_0xf437('0x2a');return db['UserProfileSection'][_0xf437('0x53')]({'where':{'name':_0x251774,'userProfileId':_0x144c3c[_0xf437('0x54')]},'raw':!![]})[_0xf437('0x27')](function(_0xc16f1a){if(_0xc16f1a&&_0xc16f1a[_0xf437('0x55')]===0x0){return db[_0xf437('0x2b')][_0xf437('0x4e')]({'name':_0x5d1d95[_0xf437('0x2f')],'resourceId':_0x5d1d95['id'],'type':_0xc16f1a[_0xf437('0x2f')],'sectionId':_0xc16f1a['id']},{})[_0xf437('0x27')](function(){return _0x5ba710;});}else{return _0x5ba710;}})[_0xf437('0x4b')](function(_0x30da1c){logger[_0xf437('0x2d')](_0xf437('0x56'),_0x30da1c);throw _0x30da1c;});}return _0x5ba710;})[_0xf437('0x27')](respondWithResult(_0x4fe33c,0xc9))['catch'](handleError(_0x4fe33c,null));};exports[_0xf437('0x26')]=function(_0x4638c4,_0x5a1f1b){if(_0x4638c4[_0xf437('0x4f')]['id']){delete _0x4638c4[_0xf437('0x4f')]['id'];}return db[_0xf437('0x35')][_0xf437('0x53')]({'where':{'id':_0x4638c4[_0xf437('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a1f1b,null))[_0xf437('0x27')](saveUpdates(_0x4638c4['body'],null))[_0xf437('0x27')](respondWithResult(_0x5a1f1b,null))[_0xf437('0x4b')](handleError(_0x5a1f1b,null));};exports['destroy']=function(_0x4056e4,_0x20e19b){return db['Template']['find']({'where':{'id':_0x4056e4[_0xf437('0x4c')]['id']}})['then'](handleEntityNotFound(_0x20e19b,null))[_0xf437('0x27')](removeEntity(_0x20e19b,null))[_0xf437('0x4b')](handleError(_0x20e19b,null));}; \ No newline at end of file +var _0x3b00=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','merge','body','message','agent','interaction','account','index','Template','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x3b00,0x151));var _0x03b0=function(_0x1e8ddf,_0x1f1f3f){_0x1e8ddf=_0x1e8ddf-0x0;var _0x418fbc=_0x3b00[_0x1e8ddf];return _0x418fbc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03b0('0x0'));var zipdir=require(_0x03b0('0x1'));var jsonpatch=require(_0x03b0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x03b0('0x3'));var Mustache=require(_0x03b0('0x4'));var util=require(_0x03b0('0x5'));var path=require(_0x03b0('0x6'));var sox=require(_0x03b0('0x7'));var csv=require(_0x03b0('0x8'));var ejs=require(_0x03b0('0x9'));var fs=require('fs');var fs_extra=require(_0x03b0('0xa'));var _=require(_0x03b0('0xb'));var squel=require(_0x03b0('0xc'));var crypto=require(_0x03b0('0xd'));var jsforce=require(_0x03b0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x03b0('0x8'));var querystring=require('querystring');var Papa=require(_0x03b0('0xf'));var Redis=require(_0x03b0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x03b0('0x11'));var as=require(_0x03b0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03b0('0x13'))(_0x03b0('0x14'));var utils=require(_0x03b0('0x15'));var config=require(_0x03b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x03b0('0x17'))['db'];function respondWithStatusCode(_0x160874,_0x122b01){_0x122b01=_0x122b01||0xcc;return function(_0x32ddab){if(_0x32ddab){return _0x160874[_0x03b0('0x18')](_0x122b01);}return _0x160874[_0x03b0('0x19')](_0x122b01)[_0x03b0('0x1a')]();};}function respondWithResult(_0x207fc6,_0x2e825d){_0x2e825d=_0x2e825d||0xc8;return function(_0x3bdcea){if(_0x3bdcea){return _0x207fc6['status'](_0x2e825d)[_0x03b0('0x1b')](_0x3bdcea);}};}function respondWithFilteredResult(_0x5939f2,_0x22f5ef){return function(_0x427c90){if(_0x427c90){var _0x221652=typeof _0x22f5ef['offset']==='undefined'&&typeof _0x22f5ef['limit']==='undefined';var _0x599dcd=_0x427c90[_0x03b0('0x1c')];var _0x4a682a=_0x221652?0x0:_0x22f5ef[_0x03b0('0x1d')];var _0x55238c=_0x221652?_0x427c90[_0x03b0('0x1c')]:_0x22f5ef['offset']+_0x22f5ef[_0x03b0('0x1e')];var _0x23b335;if(_0x55238c>=_0x599dcd){_0x55238c=_0x599dcd;_0x23b335=0xc8;}else{_0x23b335=0xce;}_0x5939f2[_0x03b0('0x19')](_0x23b335);return _0x5939f2[_0x03b0('0x1f')]('Content-Range',_0x4a682a+'-'+_0x55238c+'/'+_0x599dcd)[_0x03b0('0x1b')](_0x427c90);}return null;};}function patchUpdates(_0x12f5d0){return function(_0x11dcf7){try{jsonpatch[_0x03b0('0x20')](_0x11dcf7,_0x12f5d0,!![]);}catch(_0x494485){return BPromise[_0x03b0('0x21')](_0x494485);}return _0x11dcf7[_0x03b0('0x22')]();};}function saveUpdates(_0x6c5b41,_0x46961d){return function(_0x4d2490){if(_0x4d2490){return _0x4d2490[_0x03b0('0x23')](_0x6c5b41)[_0x03b0('0x24')](function(_0x3c3741){return _0x3c3741;});}return null;};}function removeEntity(_0x12852f,_0x42e158){return function(_0x15b33a){if(_0x15b33a){return _0x15b33a[_0x03b0('0x25')]()[_0x03b0('0x24')](function(){var _0x42770b=_0x15b33a[_0x03b0('0x26')]({'plain':!![]});var _0x222f90='Templates';return db[_0x03b0('0x27')][_0x03b0('0x25')]({'where':{'type':_0x222f90,'resourceId':_0x42770b['id']}})[_0x03b0('0x24')](function(){return _0x15b33a;});})['then'](function(){_0x12852f[_0x03b0('0x19')](0xcc)[_0x03b0('0x1a')]();});}};}function handleEntityNotFound(_0x145ce7,_0x444eb3){return function(_0x354aec){if(!_0x354aec){_0x145ce7[_0x03b0('0x18')](0x194);}return _0x354aec;};}function handleError(_0x82bac4,_0x1ebd34){_0x1ebd34=_0x1ebd34||0x1f4;return function(_0xc56e7){logger[_0x03b0('0x28')](_0xc56e7[_0x03b0('0x29')]);if(_0xc56e7['name']){delete _0xc56e7[_0x03b0('0x2a')];}_0x82bac4['status'](_0x1ebd34)[_0x03b0('0x2b')](_0xc56e7);};}function getMustacheRender(_0x2f96c7,_0x17782f){return Mustache['render'](_0x2f96c7,_[_0x03b0('0x2c')](_0x17782f[_0x03b0('0x2d')],{'contact':_0x17782f['contact'],'message':_0x17782f[_0x03b0('0x2e')],'agent':_0x17782f[_0x03b0('0x2f')],'interaction':_0x17782f[_0x03b0('0x30')],'account':_0x17782f[_0x03b0('0x31')]}))||'';}exports[_0x03b0('0x32')]=function(_0x557d5a,_0x475774){var _0x4bc590={},_0x4cd315={},_0x5d1033={'count':0x0,'rows':[]};var _0x29f333=_['map'](db[_0x03b0('0x33')][_0x03b0('0x34')],function(_0x4ccc6f){return{'name':_0x4ccc6f[_0x03b0('0x35')],'type':_0x4ccc6f[_0x03b0('0x36')][_0x03b0('0x37')]};});_0x4cd315[_0x03b0('0x38')]=_[_0x03b0('0x39')](_0x29f333,'name');_0x4cd315[_0x03b0('0x3a')]=_['keys'](_0x557d5a['query']);_0x4cd315[_0x03b0('0x3b')]=_[_0x03b0('0x3c')](_0x4cd315['model'],_0x4cd315[_0x03b0('0x3a')]);_0x4bc590[_0x03b0('0x3d')]=_[_0x03b0('0x3c')](_0x4cd315[_0x03b0('0x38')],qs[_0x03b0('0x3e')](_0x557d5a[_0x03b0('0x3a')]['fields']));_0x4bc590[_0x03b0('0x3d')]=_0x4bc590[_0x03b0('0x3d')][_0x03b0('0x3f')]?_0x4bc590[_0x03b0('0x3d')]:_0x4cd315[_0x03b0('0x38')];if(!_0x557d5a[_0x03b0('0x3a')][_0x03b0('0x40')](_0x03b0('0x41'))){_0x4bc590[_0x03b0('0x1e')]=qs[_0x03b0('0x1e')](_0x557d5a[_0x03b0('0x3a')][_0x03b0('0x1e')]);_0x4bc590[_0x03b0('0x1d')]=qs[_0x03b0('0x1d')](_0x557d5a[_0x03b0('0x3a')][_0x03b0('0x1d')]);}_0x4bc590[_0x03b0('0x42')]=qs[_0x03b0('0x43')](_0x557d5a['query'][_0x03b0('0x43')]);_0x4bc590[_0x03b0('0x44')]=qs[_0x03b0('0x3b')](_['pick'](_0x557d5a[_0x03b0('0x3a')],_0x4cd315['filters']),_0x29f333);if(_0x557d5a[_0x03b0('0x3a')][_0x03b0('0x45')]){_0x4bc590[_0x03b0('0x44')]=_[_0x03b0('0x2c')](_0x4bc590['where'],{'$or':_['map'](_0x29f333,function(_0x2cb139){if(_0x2cb139['type']!==_0x03b0('0x46')){var _0x494533={};_0x494533[_0x2cb139[_0x03b0('0x2a')]]={'$like':'%'+_0x557d5a[_0x03b0('0x3a')][_0x03b0('0x45')]+'%'};return _0x494533;}})});}_0x4bc590=_[_0x03b0('0x2c')]({},_0x4bc590,_0x557d5a[_0x03b0('0x47')]);var _0x223852={'where':_0x4bc590[_0x03b0('0x44')]};return db[_0x03b0('0x33')][_0x03b0('0x1c')](_0x223852)[_0x03b0('0x24')](function(_0x3442e9){_0x5d1033[_0x03b0('0x1c')]=_0x3442e9;if(_0x557d5a['query'][_0x03b0('0x48')]){_0x4bc590[_0x03b0('0x49')]=[{'all':!![]}];}return db['Template'][_0x03b0('0x4a')](_0x4bc590);})[_0x03b0('0x24')](function(_0x292679){_0x5d1033[_0x03b0('0x4b')]=_0x292679;return _0x5d1033;})[_0x03b0('0x24')](respondWithFilteredResult(_0x475774,_0x4bc590))['catch'](handleError(_0x475774,null));};exports[_0x03b0('0x4c')]=function(_0x2f669e,_0x38445f){var _0x1db3e3={'raw':!![],'where':{'id':_0x2f669e['params']['id']}},_0x39cf09={};_0x39cf09[_0x03b0('0x38')]=_[_0x03b0('0x4d')](db[_0x03b0('0x33')][_0x03b0('0x34')]);_0x39cf09[_0x03b0('0x3a')]=_['keys'](_0x2f669e[_0x03b0('0x3a')]);_0x39cf09[_0x03b0('0x3b')]=_['intersection'](_0x39cf09[_0x03b0('0x38')],_0x39cf09['query']);_0x1db3e3[_0x03b0('0x3d')]=_['intersection'](_0x39cf09['model'],qs['fields'](_0x2f669e[_0x03b0('0x3a')][_0x03b0('0x3e')]));_0x1db3e3[_0x03b0('0x3d')]=_0x1db3e3[_0x03b0('0x3d')][_0x03b0('0x3f')]?_0x1db3e3[_0x03b0('0x3d')]:_0x39cf09['model'];if(_0x2f669e[_0x03b0('0x3a')][_0x03b0('0x48')]){_0x1db3e3['include']=[{'all':!![]}];}_0x1db3e3=_[_0x03b0('0x2c')]({},_0x1db3e3,_0x2f669e[_0x03b0('0x47')]);return db['Template'][_0x03b0('0x4e')](_0x1db3e3)['then'](handleEntityNotFound(_0x38445f,null))[_0x03b0('0x24')](respondWithResult(_0x38445f,null))[_0x03b0('0x4f')](handleError(_0x38445f,null));};exports[_0x03b0('0x50')]=function(_0x1dbb1b,_0x25a1ee){return db['Template']['create'](_0x1dbb1b[_0x03b0('0x2d')],{})[_0x03b0('0x24')](function(_0x957c65){var _0x11217c=_0x1dbb1b[_0x03b0('0x51')][_0x03b0('0x26')]({'plain':!![]});if(!_0x11217c)throw new Error(_0x03b0('0x52'));if(_0x11217c['role']==='user'){var _0x1d8d8f=_0x957c65[_0x03b0('0x26')]({'plain':!![]});var _0x17c0df=_0x03b0('0x53');return db['UserProfileSection'][_0x03b0('0x4e')]({'where':{'name':_0x17c0df,'userProfileId':_0x11217c[_0x03b0('0x54')]},'raw':!![]})['then'](function(_0x671856){if(_0x671856&&_0x671856[_0x03b0('0x55')]===0x0){return db[_0x03b0('0x27')][_0x03b0('0x50')]({'name':_0x1d8d8f[_0x03b0('0x2a')],'resourceId':_0x1d8d8f['id'],'type':_0x671856[_0x03b0('0x2a')],'sectionId':_0x671856['id']},{})[_0x03b0('0x24')](function(){return _0x957c65;});}else{return _0x957c65;}})[_0x03b0('0x4f')](function(_0x4e00c9){logger[_0x03b0('0x28')](_0x03b0('0x56'),_0x4e00c9);throw _0x4e00c9;});}return _0x957c65;})[_0x03b0('0x24')](respondWithResult(_0x25a1ee,0xc9))[_0x03b0('0x4f')](handleError(_0x25a1ee,null));};exports[_0x03b0('0x23')]=function(_0x4f9e03,_0x401da7){if(_0x4f9e03[_0x03b0('0x2d')]['id']){delete _0x4f9e03['body']['id'];}return db['Template'][_0x03b0('0x4e')]({'where':{'id':_0x4f9e03[_0x03b0('0x57')]['id']}})[_0x03b0('0x24')](handleEntityNotFound(_0x401da7,null))['then'](saveUpdates(_0x4f9e03[_0x03b0('0x2d')],null))[_0x03b0('0x24')](respondWithResult(_0x401da7,null))['catch'](handleError(_0x401da7,null));};exports[_0x03b0('0x25')]=function(_0x3694f9,_0x2006cb){return db[_0x03b0('0x33')][_0x03b0('0x4e')]({'where':{'id':_0x3694f9[_0x03b0('0x57')]['id']}})[_0x03b0('0x24')](handleEntityNotFound(_0x2006cb,null))['then'](removeEntity(_0x2006cb,null))[_0x03b0('0x4f')](handleError(_0x2006cb,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index cc982d8..6a09bb1 100644 --- a/server/api/template/template.model.js +++ b/server/api/template/template.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5807=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','tools_templates','lodash','util'];(function(_0x250bf4,_0x52ee71){var _0x10410a=function(_0x561f7f){while(--_0x561f7f){_0x250bf4['push'](_0x250bf4['shift']());}};_0x10410a(++_0x52ee71);}(_0x5807,0x102));var _0x7580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5807[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7580('0x0'));var util=require(_0x7580('0x1'));var logger=require(_0x7580('0x2'))(_0x7580('0x3'));var moment=require('moment');var BPromise=require(_0x7580('0x4'));var rp=require(_0x7580('0x5'));var fs=require('fs');var path=require(_0x7580('0x6'));var rimraf=require('rimraf');var config=require(_0x7580('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x10e2a4,_0x169448){return _0x10e2a4[_0x7580('0x8')]('Template',attributes,{'tableName':_0x7580('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8266=['api','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x47bd1b,_0x5af56c){var _0x4705d4=function(_0x257c5d){while(--_0x257c5d){_0x47bd1b['push'](_0x47bd1b['shift']());}};_0x4705d4(++_0x5af56c);}(_0x8266,0x189));var _0x6826=function(_0x147e21,_0x1850f6){_0x147e21=_0x147e21-0x0;var _0x3574ea=_0x8266[_0x147e21];return _0x3574ea;};'use strict';var _=require(_0x6826('0x0'));var util=require(_0x6826('0x1'));var logger=require(_0x6826('0x2'))(_0x6826('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6826('0x4'));var rimraf=require(_0x6826('0x5'));var config=require(_0x6826('0x6'));var attributes=require('./template.attributes');module[_0x6826('0x7')]=function(_0x4e779e,_0x293030){return _0x4e779e[_0x6826('0x8')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 974afbd..7314f21 100644 --- a/server/api/template/template.rpc.js +++ b/server/api/template/template.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29bb=['client','http','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','Template,\x20%s,\x20%s','message','catch','Template','findAll','options','raw','where','include','map','model','attributes','GetTemplate','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x36bdfc,_0x3c67f1){var _0x22a5be=function(_0x81f4b2){while(--_0x81f4b2){_0x36bdfc['push'](_0x36bdfc['shift']());}};_0x22a5be(++_0x3c67f1);}(_0x29bb,0x1d2));var _0xb29b=function(_0x3d3179,_0x5e3c51){_0x3d3179=_0x3d3179-0x0;var _0x5bde8e=_0x29bb[_0x3d3179];return _0x5bde8e;};'use strict';var _=require(_0xb29b('0x0'));var util=require(_0xb29b('0x1'));var moment=require('moment');var BPromise=require(_0xb29b('0x2'));var rs=require(_0xb29b('0x3'));var fs=require('fs');var Redis=require(_0xb29b('0x4'));var db=require(_0xb29b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb29b('0x6'))(_0xb29b('0x7'));var config=require(_0xb29b('0x8'));var jayson=require(_0xb29b('0x9'));var client=jayson[_0xb29b('0xa')][_0xb29b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb56cdc,_0x381fd2,_0x25cc43){return new BPromise(function(_0x814c9e,_0x5f40d4){return client[_0xb29b('0xc')](_0xb56cdc,_0x25cc43)[_0xb29b('0xd')](function(_0x1b65c5){logger[_0xb29b('0xe')]('Template,\x20%s,\x20%s',_0x381fd2,_0xb29b('0xf'));logger[_0xb29b('0x10')](_0xb29b('0x11'),_0x381fd2,_0xb29b('0xf'),JSON[_0xb29b('0x12')](_0x1b65c5));if(_0x1b65c5[_0xb29b('0x13')]){if(_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x14')]===0x1f4){logger[_0xb29b('0x13')](_0xb29b('0x15'),_0x381fd2,_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);return _0x5f40d4(_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);}logger['error'](_0xb29b('0x15'),_0x381fd2,_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);return _0x814c9e(_0x1b65c5[_0xb29b('0x13')][_0xb29b('0x16')]);}else{logger[_0xb29b('0xe')](_0xb29b('0x15'),_0x381fd2,_0xb29b('0xf'));_0x814c9e(_0x1b65c5['result'][_0xb29b('0x16')]);}})[_0xb29b('0x17')](function(_0x3bed28){logger['error'](_0xb29b('0x15'),_0x381fd2,_0x3bed28);_0x5f40d4(_0x3bed28);});});}exports['GetTemplate']=function(_0x43d197){var _0x4eeb36=this;return new Promise(function(_0x449e69,_0x5e6041){return db[_0xb29b('0x18')][_0xb29b('0x19')]({'raw':_0x43d197[_0xb29b('0x1a')]?_0x43d197['options'][_0xb29b('0x1b')]===undefined?!![]:![]:!![],'where':_0x43d197['options']?_0x43d197[_0xb29b('0x1a')][_0xb29b('0x1c')]||null:null,'attributes':_0x43d197[_0xb29b('0x1a')]?_0x43d197[_0xb29b('0x1a')]['attributes']||null:null,'limit':_0x43d197[_0xb29b('0x1a')]?_0x43d197[_0xb29b('0x1a')]['limit']||null:null,'include':_0x43d197[_0xb29b('0x1a')]?_0x43d197['options'][_0xb29b('0x1d')]?_[_0xb29b('0x1e')](_0x43d197['options']['include'],function(_0x1f4345){return{'model':db[_0x1f4345[_0xb29b('0x1f')]],'as':_0x1f4345['as'],'attributes':_0x1f4345[_0xb29b('0x20')],'include':_0x1f4345[_0xb29b('0x1d')]?_[_0xb29b('0x1e')](_0x1f4345[_0xb29b('0x1d')],function(_0xe855af){return{'model':db[_0xe855af[_0xb29b('0x1f')]],'as':_0xe855af['as'],'attributes':_0xe855af[_0xb29b('0x20')],'include':_0xe855af['include']?_[_0xb29b('0x1e')](_0xe855af['include'],function(_0x257328){return{'model':db[_0x257328[_0xb29b('0x1f')]],'as':_0x257328['as'],'attributes':_0x257328[_0xb29b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb29b('0xd')](function(_0xa7a12e){logger[_0xb29b('0xe')](_0xb29b('0x21'),_0x43d197);logger['debug']('GetTemplate',_0x43d197,JSON['stringify'](_0xa7a12e));_0x449e69(_0xa7a12e);})[_0xb29b('0x17')](function(_0x268848){logger['error'](_0xb29b('0x21'),_0x268848[_0xb29b('0x16')],_0x43d197);_0x5e6041(_0x4eeb36[_0xb29b('0x13')](0x1f4,_0x268848['message']));});});}; \ No newline at end of file +var _0xa036=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTemplate','Template','findAll','options','where','attributes','limit','include','map','model','catch','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x47e61e,_0x41ff6a){var _0x5de28f=function(_0x492a21){while(--_0x492a21){_0x47e61e['push'](_0x47e61e['shift']());}};_0x5de28f(++_0x41ff6a);}(_0xa036,0x7f));var _0x6a03=function(_0x42dcc8,_0x27040d){_0x42dcc8=_0x42dcc8-0x0;var _0x5870d5=_0xa036[_0x42dcc8];return _0x5870d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6a03('0x0'));var BPromise=require(_0x6a03('0x1'));var rs=require(_0x6a03('0x2'));var fs=require('fs');var Redis=require(_0x6a03('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a03('0x4'));var logger=require(_0x6a03('0x5'))(_0x6a03('0x6'));var config=require(_0x6a03('0x7'));var jayson=require(_0x6a03('0x8'));var client=jayson[_0x6a03('0x9')][_0x6a03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b574f,_0x141748,_0x1868a7){return new BPromise(function(_0x48433f,_0x5c092f){return client['request'](_0x2b574f,_0x1868a7)[_0x6a03('0xb')](function(_0x1a52ea){logger['info'](_0x6a03('0xc'),_0x141748,_0x6a03('0xd'));logger[_0x6a03('0xe')](_0x6a03('0xf'),_0x141748,_0x6a03('0xd'),JSON[_0x6a03('0x10')](_0x1a52ea));if(_0x1a52ea[_0x6a03('0x11')]){if(_0x1a52ea[_0x6a03('0x11')][_0x6a03('0x12')]===0x1f4){logger[_0x6a03('0x11')](_0x6a03('0xc'),_0x141748,_0x1a52ea['error']['message']);return _0x5c092f(_0x1a52ea[_0x6a03('0x11')]['message']);}logger[_0x6a03('0x11')]('Template,\x20%s,\x20%s',_0x141748,_0x1a52ea[_0x6a03('0x11')][_0x6a03('0x13')]);return _0x48433f(_0x1a52ea[_0x6a03('0x11')]['message']);}else{logger[_0x6a03('0x14')]('Template,\x20%s,\x20%s',_0x141748,_0x6a03('0xd'));_0x48433f(_0x1a52ea[_0x6a03('0x15')][_0x6a03('0x13')]);}})['catch'](function(_0x47b919){logger[_0x6a03('0x11')]('Template,\x20%s,\x20%s',_0x141748,_0x47b919);_0x5c092f(_0x47b919);});});}exports[_0x6a03('0x16')]=function(_0x324e7d){var _0x15a0f3=this;return new Promise(function(_0x496812,_0x12e101){return db[_0x6a03('0x17')][_0x6a03('0x18')]({'raw':_0x324e7d[_0x6a03('0x19')]?_0x324e7d[_0x6a03('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x324e7d['options']?_0x324e7d[_0x6a03('0x19')][_0x6a03('0x1a')]||null:null,'attributes':_0x324e7d[_0x6a03('0x19')]?_0x324e7d[_0x6a03('0x19')][_0x6a03('0x1b')]||null:null,'limit':_0x324e7d[_0x6a03('0x19')]?_0x324e7d[_0x6a03('0x19')][_0x6a03('0x1c')]||null:null,'include':_0x324e7d[_0x6a03('0x19')]?_0x324e7d[_0x6a03('0x19')][_0x6a03('0x1d')]?_[_0x6a03('0x1e')](_0x324e7d[_0x6a03('0x19')][_0x6a03('0x1d')],function(_0x4f59fd){return{'model':db[_0x4f59fd[_0x6a03('0x1f')]],'as':_0x4f59fd['as'],'attributes':_0x4f59fd['attributes'],'include':_0x4f59fd[_0x6a03('0x1d')]?_[_0x6a03('0x1e')](_0x4f59fd['include'],function(_0x2dd261){return{'model':db[_0x2dd261['model']],'as':_0x2dd261['as'],'attributes':_0x2dd261[_0x6a03('0x1b')],'include':_0x2dd261['include']?_['map'](_0x2dd261['include'],function(_0x35a558){return{'model':db[_0x35a558[_0x6a03('0x1f')]],'as':_0x35a558['as'],'attributes':_0x35a558[_0x6a03('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6a03('0xb')](function(_0xa3331b){logger[_0x6a03('0x14')](_0x6a03('0x16'),_0x324e7d);logger[_0x6a03('0xe')](_0x6a03('0x16'),_0x324e7d,JSON[_0x6a03('0x10')](_0xa3331b));_0x496812(_0xa3331b);})[_0x6a03('0x20')](function(_0x4e9447){logger['error'](_0x6a03('0x16'),_0x4e9447[_0x6a03('0x13')],_0x324e7d);_0x12e101(_0x15a0f3[_0x6a03('0x11')](0x1f4,_0x4e9447[_0x6a03('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a475203..b273cab 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20dd=['addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','post'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x20dd,0x64));var _0xd20d=function(_0x323968,_0x52db1c){_0x323968=_0x323968-0x0;var _0x39d420=_0x20dd[_0x323968];return _0x39d420;};'use strict';var multer=require('multer');var util=require(_0xd20d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd20d('0x1'));var router=express['Router']();var fs_extra=require(_0xd20d('0x2'));var auth=require(_0xd20d('0x3'));var interaction=require(_0xd20d('0x4'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd20d('0x5')]);router[_0xd20d('0x6')](_0xd20d('0x7'),auth[_0xd20d('0x8')](),controller[_0xd20d('0x9')]);router[_0xd20d('0x6')](_0xd20d('0xa'),auth[_0xd20d('0x8')](),controller[_0xd20d('0xb')]);router[_0xd20d('0x6')](_0xd20d('0xc'),auth[_0xd20d('0x8')](),controller['getAnyConditions']);router[_0xd20d('0x6')](_0xd20d('0xd'),auth[_0xd20d('0x8')](),controller['getActions']);router[_0xd20d('0xe')]('/',auth[_0xd20d('0x8')](),controller['create']);router[_0xd20d('0xe')](_0xd20d('0xa'),auth[_0xd20d('0x8')](),controller[_0xd20d('0xf')]);router[_0xd20d('0xe')](_0xd20d('0xc'),auth['isAuthenticated'](),controller[_0xd20d('0x10')]);router[_0xd20d('0xe')](_0xd20d('0xd'),auth['isAuthenticated'](),controller[_0xd20d('0x11')]);router[_0xd20d('0x12')]('/:id',auth[_0xd20d('0x8')](),controller[_0xd20d('0x13')]);router[_0xd20d('0x14')](_0xd20d('0x7'),auth['isAuthenticated'](),controller[_0xd20d('0x15')]);module[_0xd20d('0x16')]=router; \ No newline at end of file +var _0x903a=['../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/actions','addAction','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1291c9,_0x53f5d0){var _0x157ea3=function(_0x1bbd17){while(--_0x1bbd17){_0x1291c9['push'](_0x1291c9['shift']());}};_0x157ea3(++_0x53f5d0);}(_0x903a,0x172));var _0xa903=function(_0x574ce7,_0x41ed5a){_0x574ce7=_0x574ce7-0x0;var _0x47e574=_0x903a[_0x574ce7];return _0x47e574;};'use strict';var multer=require('multer');var util=require(_0xa903('0x0'));var path=require(_0xa903('0x1'));var timeout=require(_0xa903('0x2'));var express=require(_0xa903('0x3'));var router=express[_0xa903('0x4')]();var fs_extra=require(_0xa903('0x5'));var auth=require(_0xa903('0x6'));var interaction=require(_0xa903('0x7'));var config=require(_0xa903('0x8'));var controller=require(_0xa903('0x9'));router[_0xa903('0xa')]('/',auth['isAuthenticated'](),controller[_0xa903('0xb')]);router[_0xa903('0xa')](_0xa903('0xc'),auth[_0xa903('0xd')](),controller['show']);router[_0xa903('0xa')](_0xa903('0xe'),auth[_0xa903('0xd')](),controller[_0xa903('0xf')]);router['get'](_0xa903('0x10'),auth[_0xa903('0xd')](),controller[_0xa903('0x11')]);router[_0xa903('0xa')]('/:id/actions',auth['isAuthenticated'](),controller[_0xa903('0x12')]);router[_0xa903('0x13')]('/',auth['isAuthenticated'](),controller[_0xa903('0x14')]);router[_0xa903('0x13')]('/:id/all_conditions',auth[_0xa903('0xd')](),controller['addAllCondition']);router[_0xa903('0x13')](_0xa903('0x10'),auth[_0xa903('0xd')](),controller['addAnyCondition']);router[_0xa903('0x13')](_0xa903('0x15'),auth['isAuthenticated'](),controller[_0xa903('0x16')]);router[_0xa903('0x17')](_0xa903('0xc'),auth[_0xa903('0xd')](),controller[_0xa903('0x18')]);router['delete'](_0xa903('0xc'),auth[_0xa903('0xd')](),controller[_0xa903('0x19')]);module[_0xa903('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 99d3fc8..e58388b 100644 --- a/server/api/trigger/trigger.attributes.js +++ b/server/api/trigger/trigger.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea9a=['sequelize','STRING'];(function(_0x1d2db7,_0x50c9db){var _0x4d907a=function(_0x2d5562){while(--_0x2d5562){_0x1d2db7['push'](_0x1d2db7['shift']());}};_0x4d907a(++_0x50c9db);}(_0xea9a,0xfa));var _0xaea9=function(_0x1f78f8,_0x2f72c5){_0x1f78f8=_0x1f78f8-0x0;var _0x121a3b=_0xea9a[_0x1f78f8];return _0x121a3b;};'use strict';var Sequelize=require(_0xaea9('0x0'));module['exports']={'name':{'type':Sequelize[_0xaea9('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaea9('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x33e2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1539cd,_0xb85924){var _0x5a7ffb=function(_0x50ad15){while(--_0x50ad15){_0x1539cd['push'](_0x1539cd['shift']());}};_0x5a7ffb(++_0xb85924);}(_0x33e2,0x1b1));var _0x233e=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x33e2[_0x9edfd5];return _0x330738;};'use strict';var Sequelize=require(_0x233e('0x0'));module[_0x233e('0x1')]={'name':{'type':Sequelize[_0x233e('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x233e('0x2')]},'status':{'type':Sequelize[_0x233e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 6258f14..ee058c9 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa864=['length','hasOwnProperty','order','sort','where','filters','pick','filter','options','Trigger','includeAll','include','findAll','rows','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','keys','nolimit','getAnyConditions','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','UserProfileResource','error','stack','name','render','merge','body','account','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes'];(function(_0x1fe672,_0x3aa7f8){var _0x4b2b4f=function(_0x417284){while(--_0x417284){_0x1fe672['push'](_0x1fe672['shift']());}};_0x4b2b4f(++_0x3aa7f8);}(_0xa864,0x141));var _0x4a86=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xa864[_0x550d12];return _0x12103d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a86('0x0'));var zipdir=require(_0x4a86('0x1'));var jsonpatch=require(_0x4a86('0x2'));var rp=require(_0x4a86('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a86('0x4'));var path=require(_0x4a86('0x5'));var sox=require(_0x4a86('0x6'));var csv=require(_0x4a86('0x7'));var ejs=require(_0x4a86('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a86('0x9'));var crypto=require('crypto');var jsforce=require(_0x4a86('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4a86('0x7'));var querystring=require(_0x4a86('0xb'));var Papa=require(_0x4a86('0xc'));var Redis=require('ioredis');var authService=require(_0x4a86('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4a86('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a86('0xf'))(_0x4a86('0x10'));var utils=require(_0x4a86('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4a86('0x12'));var db=require(_0x4a86('0x13'))['db'];function respondWithStatusCode(_0x3e7da1,_0x53188e){_0x53188e=_0x53188e||0xcc;return function(_0x135548){if(_0x135548){return _0x3e7da1[_0x4a86('0x14')](_0x53188e);}return _0x3e7da1[_0x4a86('0x15')](_0x53188e)[_0x4a86('0x16')]();};}function respondWithResult(_0x3ea2df,_0x39b5d9){_0x39b5d9=_0x39b5d9||0xc8;return function(_0x2bac3a){if(_0x2bac3a){return _0x3ea2df[_0x4a86('0x15')](_0x39b5d9)[_0x4a86('0x17')](_0x2bac3a);}};}function respondWithFilteredResult(_0xa261ac,_0x5a69fb){return function(_0x3c6fd4){if(_0x3c6fd4){var _0x2f92cc=typeof _0x5a69fb[_0x4a86('0x18')]==='undefined'&&typeof _0x5a69fb[_0x4a86('0x19')]===_0x4a86('0x1a');var _0x1d1afd=_0x3c6fd4[_0x4a86('0x1b')];var _0x3123d1=_0x2f92cc?0x0:_0x5a69fb[_0x4a86('0x18')];var _0x680c9f=_0x2f92cc?_0x3c6fd4[_0x4a86('0x1b')]:_0x5a69fb[_0x4a86('0x18')]+_0x5a69fb['limit'];var _0x32a8cf;if(_0x680c9f>=_0x1d1afd){_0x680c9f=_0x1d1afd;_0x32a8cf=0xc8;}else{_0x32a8cf=0xce;}_0xa261ac[_0x4a86('0x15')](_0x32a8cf);return _0xa261ac['set'](_0x4a86('0x1c'),_0x3123d1+'-'+_0x680c9f+'/'+_0x1d1afd)[_0x4a86('0x17')](_0x3c6fd4);}return null;};}function patchUpdates(_0x2e74c0){return function(_0x19d7fc){try{jsonpatch[_0x4a86('0x1d')](_0x19d7fc,_0x2e74c0,!![]);}catch(_0x123e35){return BPromise[_0x4a86('0x1e')](_0x123e35);}return _0x19d7fc[_0x4a86('0x1f')]();};}function saveUpdates(_0xa4df66,_0x29f637){return function(_0x361d1f){if(_0x361d1f){return _0x361d1f[_0x4a86('0x20')](_0xa4df66)['then'](function(_0x5ba482){return _0x5ba482;});}return null;};}function removeEntity(_0x224353,_0x199420){return function(_0x1876d1){if(_0x1876d1){return _0x1876d1[_0x4a86('0x21')]()[_0x4a86('0x22')](function(){var _0x494570=_0x1876d1[_0x4a86('0x23')]({'plain':!![]});var _0x18d15f=_0x4a86('0x24');return db[_0x4a86('0x25')][_0x4a86('0x21')]({'where':{'type':_0x18d15f,'resourceId':_0x494570['id']}})[_0x4a86('0x22')](function(){return _0x1876d1;});})[_0x4a86('0x22')](function(){_0x224353[_0x4a86('0x15')](0xcc)[_0x4a86('0x16')]();});}};}function handleEntityNotFound(_0x1d0b73,_0x36c8ee){return function(_0x827508){if(!_0x827508){_0x1d0b73[_0x4a86('0x14')](0x194);}return _0x827508;};}function handleError(_0x5b6447,_0x491996){_0x491996=_0x491996||0x1f4;return function(_0x3dc539){logger[_0x4a86('0x26')](_0x3dc539[_0x4a86('0x27')]);if(_0x3dc539[_0x4a86('0x28')]){delete _0x3dc539[_0x4a86('0x28')];}_0x5b6447[_0x4a86('0x15')](_0x491996)['send'](_0x3dc539);};}function getMustacheRender(_0x174075,_0x4761a2){return Mustache[_0x4a86('0x29')](_0x174075,_[_0x4a86('0x2a')](_0x4761a2[_0x4a86('0x2b')],{'contact':_0x4761a2['contact'],'message':_0x4761a2['message'],'agent':_0x4761a2['agent'],'interaction':_0x4761a2['interaction'],'account':_0x4761a2[_0x4a86('0x2c')]}))||'';}exports['index']=function(_0x4bada2,_0x384cd0){var _0x357510={},_0xa2a78d={},_0xbe22d0={'count':0x0,'rows':[]};var _0x19e534=_['map'](db['Trigger'][_0x4a86('0x2d')],function(_0x1c3ed9){return{'name':_0x1c3ed9[_0x4a86('0x2e')],'type':_0x1c3ed9[_0x4a86('0x2f')][_0x4a86('0x30')]};});_0xa2a78d[_0x4a86('0x31')]=_[_0x4a86('0x32')](_0x19e534,_0x4a86('0x28'));_0xa2a78d[_0x4a86('0x33')]=_['keys'](_0x4bada2['query']);_0xa2a78d['filters']=_['intersection'](_0xa2a78d[_0x4a86('0x31')],_0xa2a78d[_0x4a86('0x33')]);_0x357510['attributes']=_[_0x4a86('0x34')](_0xa2a78d[_0x4a86('0x31')],qs[_0x4a86('0x35')](_0x4bada2[_0x4a86('0x33')][_0x4a86('0x35')]));_0x357510['attributes']=_0x357510[_0x4a86('0x36')][_0x4a86('0x37')]?_0x357510[_0x4a86('0x36')]:_0xa2a78d[_0x4a86('0x31')];if(!_0x4bada2[_0x4a86('0x33')][_0x4a86('0x38')]('nolimit')){_0x357510[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x4bada2[_0x4a86('0x33')]['limit']);_0x357510[_0x4a86('0x18')]=qs[_0x4a86('0x18')](_0x4bada2[_0x4a86('0x33')][_0x4a86('0x18')]);}_0x357510[_0x4a86('0x39')]=qs['sort'](_0x4bada2[_0x4a86('0x33')][_0x4a86('0x3a')]);_0x357510[_0x4a86('0x3b')]=qs[_0x4a86('0x3c')](_[_0x4a86('0x3d')](_0x4bada2[_0x4a86('0x33')],_0xa2a78d['filters']),_0x19e534);if(_0x4bada2[_0x4a86('0x33')][_0x4a86('0x3e')]){_0x357510[_0x4a86('0x3b')]=_[_0x4a86('0x2a')](_0x357510[_0x4a86('0x3b')],{'$or':_[_0x4a86('0x32')](_0x19e534,function(_0xa0f951){if(_0xa0f951[_0x4a86('0x2f')]!=='VIRTUAL'){var _0x144485={};_0x144485[_0xa0f951[_0x4a86('0x28')]]={'$like':'%'+_0x4bada2[_0x4a86('0x33')]['filter']+'%'};return _0x144485;}})});}_0x357510=_[_0x4a86('0x2a')]({},_0x357510,_0x4bada2[_0x4a86('0x3f')]);var _0x16349d={'where':_0x357510[_0x4a86('0x3b')]};return db[_0x4a86('0x40')][_0x4a86('0x1b')](_0x16349d)[_0x4a86('0x22')](function(_0x579f3f){_0xbe22d0['count']=_0x579f3f;if(_0x4bada2[_0x4a86('0x33')][_0x4a86('0x41')]){_0x357510[_0x4a86('0x42')]=[{'all':!![]}];}return db[_0x4a86('0x40')][_0x4a86('0x43')](_0x357510);})['then'](function(_0x185303){_0xbe22d0[_0x4a86('0x44')]=_0x185303;return _0xbe22d0;})[_0x4a86('0x22')](respondWithFilteredResult(_0x384cd0,_0x357510))['catch'](handleError(_0x384cd0,null));};exports[_0x4a86('0x45')]=function(_0x320a5a,_0x30816d){var _0x1b666a={'raw':![],'where':{'id':_0x320a5a[_0x4a86('0x46')]['id']}},_0x1b03cf={};_0x1b03cf[_0x4a86('0x31')]=_['keys'](db[_0x4a86('0x40')][_0x4a86('0x2d')]);_0x1b03cf[_0x4a86('0x33')]=_['keys'](_0x320a5a['query']);_0x1b03cf[_0x4a86('0x3c')]=_['intersection'](_0x1b03cf[_0x4a86('0x31')],_0x1b03cf[_0x4a86('0x33')]);_0x1b666a[_0x4a86('0x36')]=_[_0x4a86('0x34')](_0x1b03cf[_0x4a86('0x31')],qs[_0x4a86('0x35')](_0x320a5a['query'][_0x4a86('0x35')]));_0x1b666a[_0x4a86('0x36')]=_0x1b666a[_0x4a86('0x36')][_0x4a86('0x37')]?_0x1b666a[_0x4a86('0x36')]:_0x1b03cf['model'];if(_0x320a5a['query'][_0x4a86('0x41')]){_0x1b666a[_0x4a86('0x42')]=[{'all':!![]}];}_0x1b666a=_[_0x4a86('0x2a')]({},_0x1b666a,_0x320a5a[_0x4a86('0x3f')]);return db[_0x4a86('0x40')]['find'](_0x1b666a)[_0x4a86('0x22')](handleEntityNotFound(_0x30816d,null))[_0x4a86('0x22')](respondWithResult(_0x30816d,null))[_0x4a86('0x47')](handleError(_0x30816d,null));};exports[_0x4a86('0x48')]=function(_0x31c9ce,_0x31515e){return db[_0x4a86('0x40')]['create'](_0x31c9ce[_0x4a86('0x2b')],{})['then'](function(_0x7266e){var _0x259e44=_0x31c9ce[_0x4a86('0x49')]['get']({'plain':!![]});if(!_0x259e44)throw new Error(_0x4a86('0x4a'));if(_0x259e44[_0x4a86('0x4b')]===_0x4a86('0x49')){var _0x4d2c62=_0x7266e[_0x4a86('0x23')]({'plain':!![]});var _0x1ef3c8=_0x4a86('0x24');return db[_0x4a86('0x4c')][_0x4a86('0x4d')]({'where':{'name':_0x1ef3c8,'userProfileId':_0x259e44[_0x4a86('0x4e')]},'raw':!![]})['then'](function(_0xe294b0){if(_0xe294b0&&_0xe294b0[_0x4a86('0x4f')]===0x0){return db[_0x4a86('0x25')][_0x4a86('0x48')]({'name':_0x4d2c62[_0x4a86('0x28')],'resourceId':_0x4d2c62['id'],'type':_0xe294b0[_0x4a86('0x28')],'sectionId':_0xe294b0['id']},{})[_0x4a86('0x22')](function(){return _0x7266e;});}else{return _0x7266e;}})['catch'](function(_0x1bc9df){logger[_0x4a86('0x26')](_0x4a86('0x50'),_0x1bc9df);throw _0x1bc9df;});}return _0x7266e;})['then'](respondWithResult(_0x31515e,0xc9))[_0x4a86('0x47')](handleError(_0x31515e,null));};exports['update']=function(_0x4cee6b,_0x9aac70){if(_0x4cee6b[_0x4a86('0x2b')]['id']){delete _0x4cee6b[_0x4a86('0x2b')]['id'];}return db['Trigger'][_0x4a86('0x4d')]({'where':{'id':_0x4cee6b[_0x4a86('0x46')]['id']}})[_0x4a86('0x22')](handleEntityNotFound(_0x9aac70,null))[_0x4a86('0x22')](saveUpdates(_0x4cee6b[_0x4a86('0x2b')],null))[_0x4a86('0x22')](respondWithResult(_0x9aac70,null))['catch'](handleError(_0x9aac70,null));};exports[_0x4a86('0x21')]=function(_0x4b78a2,_0x1aa58f){return db['Trigger'][_0x4a86('0x4d')]({'where':{'id':_0x4b78a2[_0x4a86('0x46')]['id']}})['then'](handleEntityNotFound(_0x1aa58f,null))[_0x4a86('0x22')](removeEntity(_0x1aa58f,null))['catch'](handleError(_0x1aa58f,null));};exports[_0x4a86('0x51')]=function(_0x599a8e,_0x239457,_0x1619ca){if(_0x599a8e['body']['id']){delete _0x599a8e[_0x4a86('0x2b')]['id'];}return db[_0x4a86('0x40')][_0x4a86('0x4d')]({'where':{'id':_0x599a8e['params']['id']}})['then'](handleEntityNotFound(_0x239457,null))['then'](function(_0x177076){if(_0x177076){_0x599a8e[_0x4a86('0x2b')][_0x4a86('0x52')]=_0x177076['id'];return db[_0x4a86('0x53')][_0x4a86('0x48')](_0x599a8e[_0x4a86('0x2b')]);}})[_0x4a86('0x22')](respondWithResult(_0x239457,null))[_0x4a86('0x47')](handleError(_0x239457,null));};exports[_0x4a86('0x54')]=function(_0x462a55,_0x15862f,_0x3dcb9b){if(_0x462a55[_0x4a86('0x2b')]['id']){delete _0x462a55[_0x4a86('0x2b')]['id'];}return db[_0x4a86('0x40')][_0x4a86('0x4d')]({'where':{'id':_0x462a55[_0x4a86('0x46')]['id']}})[_0x4a86('0x22')](handleEntityNotFound(_0x15862f,null))[_0x4a86('0x22')](function(_0x6071bb){if(_0x6071bb){_0x462a55[_0x4a86('0x2b')][_0x4a86('0x55')]=_0x6071bb['id'];return db[_0x4a86('0x53')]['create'](_0x462a55[_0x4a86('0x2b')]);}})[_0x4a86('0x22')](respondWithResult(_0x15862f,null))[_0x4a86('0x47')](handleError(_0x15862f,null));};exports[_0x4a86('0x56')]=function(_0x4d41ad,_0x41a94d,_0x59d3b7){var _0x251172={};var _0x1da8b0={};var _0x1b685a;var _0x4cee8d;return db[_0x4a86('0x40')][_0x4a86('0x57')]({'where':{'id':_0x4d41ad[_0x4a86('0x46')]['id']}})['then'](handleEntityNotFound(_0x41a94d,null))[_0x4a86('0x22')](function(_0x54aca8){if(_0x54aca8){_0x1b685a=_0x54aca8;_0x1da8b0['model']=_[_0x4a86('0x58')](db[_0x4a86('0x53')][_0x4a86('0x2d')]);_0x1da8b0['query']=_[_0x4a86('0x58')](_0x4d41ad[_0x4a86('0x33')]);_0x1da8b0[_0x4a86('0x3c')]=_[_0x4a86('0x34')](_0x1da8b0[_0x4a86('0x31')],_0x1da8b0[_0x4a86('0x33')]);_0x251172[_0x4a86('0x36')]=_['intersection'](_0x1da8b0[_0x4a86('0x31')],qs['fields'](_0x4d41ad[_0x4a86('0x33')]['fields']));_0x251172['attributes']=_0x251172[_0x4a86('0x36')][_0x4a86('0x37')]?_0x251172[_0x4a86('0x36')]:_0x1da8b0['model'];_0x251172[_0x4a86('0x39')]=qs['sort'](_0x4d41ad['query'][_0x4a86('0x3a')]);_0x251172['where']=qs['filters'](_[_0x4a86('0x3d')](_0x4d41ad['query'],_0x1da8b0[_0x4a86('0x3c')]));if(_0x4d41ad[_0x4a86('0x33')]['filter']){_0x251172['where']=_[_0x4a86('0x2a')](_0x251172[_0x4a86('0x3b')],{'$or':_['map'](_0x251172[_0x4a86('0x36')],function(_0x132e3b){var _0x330227={};_0x330227[_0x132e3b]={'$like':'%'+_0x4d41ad[_0x4a86('0x33')]['filter']+'%'};return _0x330227;})});}_0x251172=_[_0x4a86('0x2a')]({},_0x251172,_0x4d41ad[_0x4a86('0x3f')]);return _0x1b685a[_0x4a86('0x56')](_0x251172);}})[_0x4a86('0x22')](function(_0x5eda11){if(_0x5eda11){_0x4cee8d=_0x5eda11[_0x4a86('0x37')];if(!_0x4d41ad['query'][_0x4a86('0x38')](_0x4a86('0x59'))){_0x251172[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x4d41ad[_0x4a86('0x33')][_0x4a86('0x19')]);_0x251172['offset']=qs[_0x4a86('0x18')](_0x4d41ad[_0x4a86('0x33')]['offset']);}return _0x1b685a[_0x4a86('0x56')](_0x251172);}})[_0x4a86('0x22')](function(_0x468154){if(_0x468154){return _0x468154?{'count':_0x4cee8d,'rows':_0x468154}:null;}})['then'](respondWithResult(_0x41a94d,null))['catch'](handleError(_0x41a94d,null));};exports[_0x4a86('0x5a')]=function(_0x5ae53c,_0x2cf50e,_0x4281ee){var _0x1b4c11={};var _0xe7b87b={};var _0x348c49;var _0x5b98f7;return db[_0x4a86('0x40')][_0x4a86('0x57')]({'where':{'id':_0x5ae53c['params']['id']}})['then'](handleEntityNotFound(_0x2cf50e,null))[_0x4a86('0x22')](function(_0x217594){if(_0x217594){_0x348c49=_0x217594;_0xe7b87b[_0x4a86('0x31')]=_['keys'](db['Condition'][_0x4a86('0x2d')]);_0xe7b87b['query']=_[_0x4a86('0x58')](_0x5ae53c[_0x4a86('0x33')]);_0xe7b87b[_0x4a86('0x3c')]=_[_0x4a86('0x34')](_0xe7b87b[_0x4a86('0x31')],_0xe7b87b['query']);_0x1b4c11[_0x4a86('0x36')]=_[_0x4a86('0x34')](_0xe7b87b['model'],qs[_0x4a86('0x35')](_0x5ae53c['query'][_0x4a86('0x35')]));_0x1b4c11[_0x4a86('0x36')]=_0x1b4c11['attributes'][_0x4a86('0x37')]?_0x1b4c11['attributes']:_0xe7b87b[_0x4a86('0x31')];_0x1b4c11[_0x4a86('0x39')]=qs[_0x4a86('0x3a')](_0x5ae53c[_0x4a86('0x33')][_0x4a86('0x3a')]);_0x1b4c11[_0x4a86('0x3b')]=qs['filters'](_[_0x4a86('0x3d')](_0x5ae53c['query'],_0xe7b87b['filters']));if(_0x5ae53c[_0x4a86('0x33')][_0x4a86('0x3e')]){_0x1b4c11[_0x4a86('0x3b')]=_[_0x4a86('0x2a')](_0x1b4c11[_0x4a86('0x3b')],{'$or':_[_0x4a86('0x32')](_0x1b4c11['attributes'],function(_0x865437){var _0x4e603f={};_0x4e603f[_0x865437]={'$like':'%'+_0x5ae53c[_0x4a86('0x33')][_0x4a86('0x3e')]+'%'};return _0x4e603f;})});}_0x1b4c11=_['merge']({},_0x1b4c11,_0x5ae53c[_0x4a86('0x3f')]);return _0x348c49['getAnyConditions'](_0x1b4c11);}})['then'](function(_0x12cc46){if(_0x12cc46){_0x5b98f7=_0x12cc46[_0x4a86('0x37')];if(!_0x5ae53c[_0x4a86('0x33')]['hasOwnProperty'](_0x4a86('0x59'))){_0x1b4c11[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x5ae53c[_0x4a86('0x33')]['limit']);_0x1b4c11[_0x4a86('0x18')]=qs[_0x4a86('0x18')](_0x5ae53c[_0x4a86('0x33')]['offset']);}return _0x348c49[_0x4a86('0x5a')](_0x1b4c11);}})[_0x4a86('0x22')](function(_0x39d121){if(_0x39d121){return _0x39d121?{'count':_0x5b98f7,'rows':_0x39d121}:null;}})['then'](respondWithResult(_0x2cf50e,null))[_0x4a86('0x47')](handleError(_0x2cf50e,null));};exports[_0x4a86('0x5b')]=function(_0x4f3164,_0xee6521,_0x559e98){if(_0x4f3164[_0x4a86('0x2b')]['id']){delete _0x4f3164['body']['id'];}return db[_0x4a86('0x40')][_0x4a86('0x4d')]({'where':{'id':_0x4f3164[_0x4a86('0x46')]['id']}})['then'](handleEntityNotFound(_0xee6521,null))['then'](function(_0xc49cd8){if(_0xc49cd8){_0x4f3164[_0x4a86('0x2b')]['TriggerId']=_0xc49cd8['id'];return db[_0x4a86('0x5c')][_0x4a86('0x48')](_0x4f3164[_0x4a86('0x2b')]);}})['then'](respondWithResult(_0xee6521,null))[_0x4a86('0x47')](handleError(_0xee6521,null));};exports[_0x4a86('0x5d')]=function(_0x335935,_0x43b897,_0x1000a3){var _0x22a1a4={};var _0x355d6e={};var _0x3d4566;var _0x2d453a;return db['Trigger'][_0x4a86('0x57')]({'where':{'id':_0x335935[_0x4a86('0x46')]['id']}})[_0x4a86('0x22')](handleEntityNotFound(_0x43b897,null))[_0x4a86('0x22')](function(_0x2dc106){if(_0x2dc106){_0x3d4566=_0x2dc106;_0x355d6e['model']=_[_0x4a86('0x58')](db[_0x4a86('0x5c')][_0x4a86('0x2d')]);_0x355d6e[_0x4a86('0x33')]=_[_0x4a86('0x58')](_0x335935[_0x4a86('0x33')]);_0x355d6e['filters']=_[_0x4a86('0x34')](_0x355d6e[_0x4a86('0x31')],_0x355d6e[_0x4a86('0x33')]);_0x22a1a4[_0x4a86('0x36')]=_['intersection'](_0x355d6e['model'],qs['fields'](_0x335935[_0x4a86('0x33')][_0x4a86('0x35')]));_0x22a1a4[_0x4a86('0x36')]=_0x22a1a4[_0x4a86('0x36')][_0x4a86('0x37')]?_0x22a1a4[_0x4a86('0x36')]:_0x355d6e['model'];_0x22a1a4['order']=qs[_0x4a86('0x3a')](_0x335935[_0x4a86('0x33')]['sort']);_0x22a1a4[_0x4a86('0x3b')]=qs[_0x4a86('0x3c')](_[_0x4a86('0x3d')](_0x335935[_0x4a86('0x33')],_0x355d6e['filters']));if(_0x335935['query'][_0x4a86('0x3e')]){_0x22a1a4['where']=_[_0x4a86('0x2a')](_0x22a1a4['where'],{'$or':_[_0x4a86('0x32')](_0x22a1a4[_0x4a86('0x36')],function(_0x23eca0){var _0x1b540a={};_0x1b540a[_0x23eca0]={'$like':'%'+_0x335935[_0x4a86('0x33')][_0x4a86('0x3e')]+'%'};return _0x1b540a;})});}_0x22a1a4=_[_0x4a86('0x2a')]({},_0x22a1a4,_0x335935[_0x4a86('0x3f')]);return _0x3d4566['getActions'](_0x22a1a4);}})[_0x4a86('0x22')](function(_0x41cfc6){if(_0x41cfc6){_0x2d453a=_0x41cfc6['length'];if(!_0x335935['query']['hasOwnProperty'](_0x4a86('0x59'))){_0x22a1a4[_0x4a86('0x19')]=qs[_0x4a86('0x19')](_0x335935[_0x4a86('0x33')][_0x4a86('0x19')]);_0x22a1a4[_0x4a86('0x18')]=qs['offset'](_0x335935[_0x4a86('0x33')][_0x4a86('0x18')]);}return _0x3d4566['getActions'](_0x22a1a4);}})[_0x4a86('0x22')](function(_0x78e45a){if(_0x78e45a){return _0x78e45a?{'count':_0x2d453a,'rows':_0x78e45a}:null;}})[_0x4a86('0x22')](respondWithResult(_0x43b897,null))[_0x4a86('0x47')](handleError(_0x43b897,null));}; \ No newline at end of file +var _0x92e2=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Triggers','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addAllCondition','TriggerAllId','Condition','getAllConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x92e2,0x18d));var _0x292e=function(_0x24681b,_0x31424e){_0x24681b=_0x24681b-0x0;var _0x10d992=_0x92e2[_0x24681b];return _0x10d992;};'use strict';var emlformat=require(_0x292e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x292e('0x1'));var jsonpatch=require(_0x292e('0x2'));var rp=require(_0x292e('0x3'));var moment=require(_0x292e('0x4'));var BPromise=require(_0x292e('0x5'));var Mustache=require(_0x292e('0x6'));var util=require(_0x292e('0x7'));var path=require('path');var sox=require(_0x292e('0x8'));var csv=require(_0x292e('0x9'));var ejs=require(_0x292e('0xa'));var fs=require('fs');var fs_extra=require(_0x292e('0xb'));var _=require(_0x292e('0xc'));var squel=require(_0x292e('0xd'));var crypto=require(_0x292e('0xe'));var jsforce=require(_0x292e('0xf'));var deskjs=require(_0x292e('0x10'));var toCsv=require(_0x292e('0x9'));var querystring=require('querystring');var Papa=require(_0x292e('0x11'));var Redis=require(_0x292e('0x12'));var authService=require(_0x292e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x292e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x292e('0x15'))(_0x292e('0x16'));var utils=require('../../config/utils');var config=require(_0x292e('0x17'));var licenseUtil=require(_0x292e('0x18'));var db=require(_0x292e('0x19'))['db'];function respondWithStatusCode(_0x5879e2,_0x4cccc7){_0x4cccc7=_0x4cccc7||0xcc;return function(_0x2da5d){if(_0x2da5d){return _0x5879e2[_0x292e('0x1a')](_0x4cccc7);}return _0x5879e2[_0x292e('0x1b')](_0x4cccc7)['end']();};}function respondWithResult(_0x27535f,_0x3fd3b3){_0x3fd3b3=_0x3fd3b3||0xc8;return function(_0x2ec932){if(_0x2ec932){return _0x27535f['status'](_0x3fd3b3)[_0x292e('0x1c')](_0x2ec932);}};}function respondWithFilteredResult(_0x4ddefe,_0x1bf7e8){return function(_0xc62022){if(_0xc62022){var _0x34a0d7=typeof _0x1bf7e8[_0x292e('0x1d')]===_0x292e('0x1e')&&typeof _0x1bf7e8[_0x292e('0x1f')]==='undefined';var _0x4ad6c3=_0xc62022[_0x292e('0x20')];var _0x275e5c=_0x34a0d7?0x0:_0x1bf7e8[_0x292e('0x1d')];var _0x475211=_0x34a0d7?_0xc62022[_0x292e('0x20')]:_0x1bf7e8[_0x292e('0x1d')]+_0x1bf7e8[_0x292e('0x1f')];var _0x2121f3;if(_0x475211>=_0x4ad6c3){_0x475211=_0x4ad6c3;_0x2121f3=0xc8;}else{_0x2121f3=0xce;}_0x4ddefe[_0x292e('0x1b')](_0x2121f3);return _0x4ddefe[_0x292e('0x21')](_0x292e('0x22'),_0x275e5c+'-'+_0x475211+'/'+_0x4ad6c3)[_0x292e('0x1c')](_0xc62022);}return null;};}function patchUpdates(_0x252263){return function(_0x8ca17c){try{jsonpatch[_0x292e('0x23')](_0x8ca17c,_0x252263,!![]);}catch(_0x46d7c0){return BPromise[_0x292e('0x24')](_0x46d7c0);}return _0x8ca17c['save']();};}function saveUpdates(_0xb3bff2,_0x1b8ef1){return function(_0x10cacf){if(_0x10cacf){return _0x10cacf[_0x292e('0x25')](_0xb3bff2)[_0x292e('0x26')](function(_0x3eb892){return _0x3eb892;});}return null;};}function removeEntity(_0x1b125c,_0x4515c5){return function(_0x1f85d3){if(_0x1f85d3){return _0x1f85d3[_0x292e('0x27')]()[_0x292e('0x26')](function(){var _0x3b824d=_0x1f85d3['get']({'plain':!![]});var _0x5bed63=_0x292e('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5bed63,'resourceId':_0x3b824d['id']}})[_0x292e('0x26')](function(){return _0x1f85d3;});})[_0x292e('0x26')](function(){_0x1b125c[_0x292e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddab68,_0x12eaab){return function(_0x4f9420){if(!_0x4f9420){_0xddab68['sendStatus'](0x194);}return _0x4f9420;};}function handleError(_0x413813,_0x4609c3){_0x4609c3=_0x4609c3||0x1f4;return function(_0x2875b6){logger[_0x292e('0x29')](_0x2875b6[_0x292e('0x2a')]);if(_0x2875b6[_0x292e('0x2b')]){delete _0x2875b6['name'];}_0x413813['status'](_0x4609c3)[_0x292e('0x2c')](_0x2875b6);};}function getMustacheRender(_0x4046fe,_0x4db13b){return Mustache[_0x292e('0x2d')](_0x4046fe,_[_0x292e('0x2e')](_0x4db13b[_0x292e('0x2f')],{'contact':_0x4db13b[_0x292e('0x30')],'message':_0x4db13b[_0x292e('0x31')],'agent':_0x4db13b[_0x292e('0x32')],'interaction':_0x4db13b[_0x292e('0x33')],'account':_0x4db13b[_0x292e('0x34')]}))||'';}exports[_0x292e('0x35')]=function(_0x2598cc,_0x55cb61){var _0x3c2822={},_0x590cdc={},_0x3ec6b7={'count':0x0,'rows':[]};var _0x305f18=_[_0x292e('0x36')](db[_0x292e('0x37')][_0x292e('0x38')],function(_0x5b4753){return{'name':_0x5b4753[_0x292e('0x39')],'type':_0x5b4753[_0x292e('0x3a')]['key']};});_0x590cdc[_0x292e('0x3b')]=_['map'](_0x305f18,_0x292e('0x2b'));_0x590cdc[_0x292e('0x3c')]=_[_0x292e('0x3d')](_0x2598cc['query']);_0x590cdc[_0x292e('0x3e')]=_[_0x292e('0x3f')](_0x590cdc[_0x292e('0x3b')],_0x590cdc[_0x292e('0x3c')]);_0x3c2822['attributes']=_[_0x292e('0x3f')](_0x590cdc[_0x292e('0x3b')],qs[_0x292e('0x40')](_0x2598cc[_0x292e('0x3c')][_0x292e('0x40')]));_0x3c2822[_0x292e('0x41')]=_0x3c2822['attributes'][_0x292e('0x42')]?_0x3c2822[_0x292e('0x41')]:_0x590cdc[_0x292e('0x3b')];if(!_0x2598cc[_0x292e('0x3c')][_0x292e('0x43')](_0x292e('0x44'))){_0x3c2822[_0x292e('0x1f')]=qs[_0x292e('0x1f')](_0x2598cc[_0x292e('0x3c')][_0x292e('0x1f')]);_0x3c2822[_0x292e('0x1d')]=qs[_0x292e('0x1d')](_0x2598cc['query'][_0x292e('0x1d')]);}_0x3c2822[_0x292e('0x45')]=qs[_0x292e('0x46')](_0x2598cc[_0x292e('0x3c')][_0x292e('0x46')]);_0x3c2822[_0x292e('0x47')]=qs[_0x292e('0x3e')](_[_0x292e('0x48')](_0x2598cc[_0x292e('0x3c')],_0x590cdc[_0x292e('0x3e')]),_0x305f18);if(_0x2598cc[_0x292e('0x3c')][_0x292e('0x49')]){_0x3c2822[_0x292e('0x47')]=_[_0x292e('0x2e')](_0x3c2822[_0x292e('0x47')],{'$or':_[_0x292e('0x36')](_0x305f18,function(_0x3bd94f){if(_0x3bd94f['type']!==_0x292e('0x4a')){var _0xc5bdbd={};_0xc5bdbd[_0x3bd94f[_0x292e('0x2b')]]={'$like':'%'+_0x2598cc[_0x292e('0x3c')][_0x292e('0x49')]+'%'};return _0xc5bdbd;}})});}_0x3c2822=_['merge']({},_0x3c2822,_0x2598cc[_0x292e('0x4b')]);var _0x66daa9={'where':_0x3c2822[_0x292e('0x47')]};return db['Trigger']['count'](_0x66daa9)['then'](function(_0x49416c){_0x3ec6b7[_0x292e('0x20')]=_0x49416c;if(_0x2598cc[_0x292e('0x3c')][_0x292e('0x4c')]){_0x3c2822[_0x292e('0x4d')]=[{'all':!![]}];}return db['Trigger'][_0x292e('0x4e')](_0x3c2822);})[_0x292e('0x26')](function(_0x93e56d){_0x3ec6b7[_0x292e('0x4f')]=_0x93e56d;return _0x3ec6b7;})[_0x292e('0x26')](respondWithFilteredResult(_0x55cb61,_0x3c2822))[_0x292e('0x50')](handleError(_0x55cb61,null));};exports[_0x292e('0x51')]=function(_0x253714,_0x2c29d1){var _0x572d28={'raw':![],'where':{'id':_0x253714['params']['id']}},_0x1896c0={};_0x1896c0[_0x292e('0x3b')]=_[_0x292e('0x3d')](db[_0x292e('0x37')][_0x292e('0x38')]);_0x1896c0[_0x292e('0x3c')]=_[_0x292e('0x3d')](_0x253714[_0x292e('0x3c')]);_0x1896c0[_0x292e('0x3e')]=_[_0x292e('0x3f')](_0x1896c0['model'],_0x1896c0['query']);_0x572d28['attributes']=_[_0x292e('0x3f')](_0x1896c0[_0x292e('0x3b')],qs['fields'](_0x253714['query'][_0x292e('0x40')]));_0x572d28[_0x292e('0x41')]=_0x572d28['attributes'][_0x292e('0x42')]?_0x572d28[_0x292e('0x41')]:_0x1896c0[_0x292e('0x3b')];if(_0x253714[_0x292e('0x3c')][_0x292e('0x4c')]){_0x572d28[_0x292e('0x4d')]=[{'all':!![]}];}_0x572d28=_[_0x292e('0x2e')]({},_0x572d28,_0x253714['options']);return db[_0x292e('0x37')]['find'](_0x572d28)[_0x292e('0x26')](handleEntityNotFound(_0x2c29d1,null))[_0x292e('0x26')](respondWithResult(_0x2c29d1,null))['catch'](handleError(_0x2c29d1,null));};exports['create']=function(_0x67ba64,_0x4bf12b){return db['Trigger']['create'](_0x67ba64[_0x292e('0x2f')],{})['then'](function(_0x35544c){var _0x52e134=_0x67ba64[_0x292e('0x52')]['get']({'plain':!![]});if(!_0x52e134)throw new Error(_0x292e('0x53'));if(_0x52e134[_0x292e('0x54')]===_0x292e('0x52')){var _0x37f19a=_0x35544c[_0x292e('0x55')]({'plain':!![]});var _0x26b987=_0x292e('0x28');return db[_0x292e('0x56')]['find']({'where':{'name':_0x26b987,'userProfileId':_0x52e134[_0x292e('0x57')]},'raw':!![]})[_0x292e('0x26')](function(_0x17994e){if(_0x17994e&&_0x17994e[_0x292e('0x58')]===0x0){return db[_0x292e('0x59')][_0x292e('0x5a')]({'name':_0x37f19a[_0x292e('0x2b')],'resourceId':_0x37f19a['id'],'type':_0x17994e[_0x292e('0x2b')],'sectionId':_0x17994e['id']},{})[_0x292e('0x26')](function(){return _0x35544c;});}else{return _0x35544c;}})[_0x292e('0x50')](function(_0x11aad0){logger[_0x292e('0x29')](_0x292e('0x5b'),_0x11aad0);throw _0x11aad0;});}return _0x35544c;})['then'](respondWithResult(_0x4bf12b,0xc9))[_0x292e('0x50')](handleError(_0x4bf12b,null));};exports[_0x292e('0x25')]=function(_0x576d0b,_0x56c28c){if(_0x576d0b[_0x292e('0x2f')]['id']){delete _0x576d0b[_0x292e('0x2f')]['id'];}return db[_0x292e('0x37')][_0x292e('0x5c')]({'where':{'id':_0x576d0b[_0x292e('0x5d')]['id']}})[_0x292e('0x26')](handleEntityNotFound(_0x56c28c,null))[_0x292e('0x26')](saveUpdates(_0x576d0b[_0x292e('0x2f')],null))[_0x292e('0x26')](respondWithResult(_0x56c28c,null))[_0x292e('0x50')](handleError(_0x56c28c,null));};exports['destroy']=function(_0x1e9336,_0x81f235){return db[_0x292e('0x37')][_0x292e('0x5c')]({'where':{'id':_0x1e9336[_0x292e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x81f235,null))[_0x292e('0x26')](removeEntity(_0x81f235,null))[_0x292e('0x50')](handleError(_0x81f235,null));};exports[_0x292e('0x5e')]=function(_0xb16abf,_0x5b5639,_0x3048a3){if(_0xb16abf[_0x292e('0x2f')]['id']){delete _0xb16abf['body']['id'];}return db[_0x292e('0x37')][_0x292e('0x5c')]({'where':{'id':_0xb16abf[_0x292e('0x5d')]['id']}})[_0x292e('0x26')](handleEntityNotFound(_0x5b5639,null))[_0x292e('0x26')](function(_0x2aa0dc){if(_0x2aa0dc){_0xb16abf[_0x292e('0x2f')][_0x292e('0x5f')]=_0x2aa0dc['id'];return db[_0x292e('0x60')][_0x292e('0x5a')](_0xb16abf[_0x292e('0x2f')]);}})[_0x292e('0x26')](respondWithResult(_0x5b5639,null))[_0x292e('0x50')](handleError(_0x5b5639,null));};exports['addAnyCondition']=function(_0x2fcb32,_0x429182,_0x5aac9f){if(_0x2fcb32[_0x292e('0x2f')]['id']){delete _0x2fcb32[_0x292e('0x2f')]['id'];}return db[_0x292e('0x37')][_0x292e('0x5c')]({'where':{'id':_0x2fcb32[_0x292e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x429182,null))[_0x292e('0x26')](function(_0x5dfadc){if(_0x5dfadc){_0x2fcb32[_0x292e('0x2f')]['TriggerAnyId']=_0x5dfadc['id'];return db['Condition'][_0x292e('0x5a')](_0x2fcb32[_0x292e('0x2f')]);}})['then'](respondWithResult(_0x429182,null))[_0x292e('0x50')](handleError(_0x429182,null));};exports[_0x292e('0x61')]=function(_0x277f18,_0x553c56,_0x7781e9){var _0x51a809={};var _0x24a382={};var _0x3a51b1;var _0x39aaff;return db['Trigger'][_0x292e('0x62')]({'where':{'id':_0x277f18[_0x292e('0x5d')]['id']}})[_0x292e('0x26')](handleEntityNotFound(_0x553c56,null))[_0x292e('0x26')](function(_0x5b3bf6){if(_0x5b3bf6){_0x3a51b1=_0x5b3bf6;_0x24a382[_0x292e('0x3b')]=_[_0x292e('0x3d')](db[_0x292e('0x60')][_0x292e('0x38')]);_0x24a382[_0x292e('0x3c')]=_[_0x292e('0x3d')](_0x277f18[_0x292e('0x3c')]);_0x24a382['filters']=_[_0x292e('0x3f')](_0x24a382[_0x292e('0x3b')],_0x24a382[_0x292e('0x3c')]);_0x51a809[_0x292e('0x41')]=_[_0x292e('0x3f')](_0x24a382[_0x292e('0x3b')],qs[_0x292e('0x40')](_0x277f18[_0x292e('0x3c')][_0x292e('0x40')]));_0x51a809['attributes']=_0x51a809[_0x292e('0x41')]['length']?_0x51a809['attributes']:_0x24a382['model'];_0x51a809['order']=qs[_0x292e('0x46')](_0x277f18[_0x292e('0x3c')][_0x292e('0x46')]);_0x51a809[_0x292e('0x47')]=qs[_0x292e('0x3e')](_['pick'](_0x277f18['query'],_0x24a382[_0x292e('0x3e')]));if(_0x277f18['query'][_0x292e('0x49')]){_0x51a809[_0x292e('0x47')]=_[_0x292e('0x2e')](_0x51a809[_0x292e('0x47')],{'$or':_[_0x292e('0x36')](_0x51a809[_0x292e('0x41')],function(_0x46f657){var _0x32eb3a={};_0x32eb3a[_0x46f657]={'$like':'%'+_0x277f18['query'][_0x292e('0x49')]+'%'};return _0x32eb3a;})});}_0x51a809=_[_0x292e('0x2e')]({},_0x51a809,_0x277f18[_0x292e('0x4b')]);return _0x3a51b1['getAllConditions'](_0x51a809);}})[_0x292e('0x26')](function(_0x10e772){if(_0x10e772){_0x39aaff=_0x10e772['length'];if(!_0x277f18[_0x292e('0x3c')][_0x292e('0x43')](_0x292e('0x44'))){_0x51a809[_0x292e('0x1f')]=qs[_0x292e('0x1f')](_0x277f18[_0x292e('0x3c')][_0x292e('0x1f')]);_0x51a809['offset']=qs[_0x292e('0x1d')](_0x277f18[_0x292e('0x3c')][_0x292e('0x1d')]);}return _0x3a51b1[_0x292e('0x61')](_0x51a809);}})[_0x292e('0x26')](function(_0x260c92){if(_0x260c92){return _0x260c92?{'count':_0x39aaff,'rows':_0x260c92}:null;}})['then'](respondWithResult(_0x553c56,null))[_0x292e('0x50')](handleError(_0x553c56,null));};exports['getAnyConditions']=function(_0x2dc68d,_0x577b11,_0x1341a5){var _0x2384f3={};var _0x4d3729={};var _0x2f0b4e;var _0xa46a85;return db[_0x292e('0x37')]['findOne']({'where':{'id':_0x2dc68d['params']['id']}})[_0x292e('0x26')](handleEntityNotFound(_0x577b11,null))[_0x292e('0x26')](function(_0x3ec4c1){if(_0x3ec4c1){_0x2f0b4e=_0x3ec4c1;_0x4d3729['model']=_[_0x292e('0x3d')](db['Condition'][_0x292e('0x38')]);_0x4d3729[_0x292e('0x3c')]=_['keys'](_0x2dc68d['query']);_0x4d3729[_0x292e('0x3e')]=_[_0x292e('0x3f')](_0x4d3729[_0x292e('0x3b')],_0x4d3729['query']);_0x2384f3[_0x292e('0x41')]=_[_0x292e('0x3f')](_0x4d3729['model'],qs[_0x292e('0x40')](_0x2dc68d[_0x292e('0x3c')]['fields']));_0x2384f3[_0x292e('0x41')]=_0x2384f3[_0x292e('0x41')][_0x292e('0x42')]?_0x2384f3[_0x292e('0x41')]:_0x4d3729[_0x292e('0x3b')];_0x2384f3[_0x292e('0x45')]=qs[_0x292e('0x46')](_0x2dc68d[_0x292e('0x3c')][_0x292e('0x46')]);_0x2384f3[_0x292e('0x47')]=qs[_0x292e('0x3e')](_[_0x292e('0x48')](_0x2dc68d['query'],_0x4d3729[_0x292e('0x3e')]));if(_0x2dc68d[_0x292e('0x3c')]['filter']){_0x2384f3[_0x292e('0x47')]=_[_0x292e('0x2e')](_0x2384f3[_0x292e('0x47')],{'$or':_[_0x292e('0x36')](_0x2384f3[_0x292e('0x41')],function(_0x3028fb){var _0x1957b4={};_0x1957b4[_0x3028fb]={'$like':'%'+_0x2dc68d['query'][_0x292e('0x49')]+'%'};return _0x1957b4;})});}_0x2384f3=_[_0x292e('0x2e')]({},_0x2384f3,_0x2dc68d[_0x292e('0x4b')]);return _0x2f0b4e['getAnyConditions'](_0x2384f3);}})[_0x292e('0x26')](function(_0x4f9162){if(_0x4f9162){_0xa46a85=_0x4f9162[_0x292e('0x42')];if(!_0x2dc68d[_0x292e('0x3c')][_0x292e('0x43')]('nolimit')){_0x2384f3[_0x292e('0x1f')]=qs[_0x292e('0x1f')](_0x2dc68d['query'][_0x292e('0x1f')]);_0x2384f3[_0x292e('0x1d')]=qs[_0x292e('0x1d')](_0x2dc68d[_0x292e('0x3c')][_0x292e('0x1d')]);}return _0x2f0b4e['getAnyConditions'](_0x2384f3);}})[_0x292e('0x26')](function(_0x480619){if(_0x480619){return _0x480619?{'count':_0xa46a85,'rows':_0x480619}:null;}})[_0x292e('0x26')](respondWithResult(_0x577b11,null))[_0x292e('0x50')](handleError(_0x577b11,null));};exports[_0x292e('0x63')]=function(_0x3ea5c8,_0x30a9e1,_0x3a55e8){if(_0x3ea5c8[_0x292e('0x2f')]['id']){delete _0x3ea5c8[_0x292e('0x2f')]['id'];}return db[_0x292e('0x37')]['find']({'where':{'id':_0x3ea5c8['params']['id']}})[_0x292e('0x26')](handleEntityNotFound(_0x30a9e1,null))['then'](function(_0x4bcffa){if(_0x4bcffa){_0x3ea5c8[_0x292e('0x2f')][_0x292e('0x64')]=_0x4bcffa['id'];return db[_0x292e('0x65')][_0x292e('0x5a')](_0x3ea5c8[_0x292e('0x2f')]);}})[_0x292e('0x26')](respondWithResult(_0x30a9e1,null))[_0x292e('0x50')](handleError(_0x30a9e1,null));};exports[_0x292e('0x66')]=function(_0x3d724a,_0x17c046,_0x4560c0){var _0xd2710c={};var _0x407fa1={};var _0x16c136;var _0x38498f;return db[_0x292e('0x37')][_0x292e('0x62')]({'where':{'id':_0x3d724a[_0x292e('0x5d')]['id']}})[_0x292e('0x26')](handleEntityNotFound(_0x17c046,null))[_0x292e('0x26')](function(_0x4c7765){if(_0x4c7765){_0x16c136=_0x4c7765;_0x407fa1[_0x292e('0x3b')]=_[_0x292e('0x3d')](db[_0x292e('0x65')][_0x292e('0x38')]);_0x407fa1[_0x292e('0x3c')]=_['keys'](_0x3d724a[_0x292e('0x3c')]);_0x407fa1[_0x292e('0x3e')]=_[_0x292e('0x3f')](_0x407fa1[_0x292e('0x3b')],_0x407fa1[_0x292e('0x3c')]);_0xd2710c[_0x292e('0x41')]=_['intersection'](_0x407fa1['model'],qs['fields'](_0x3d724a['query'][_0x292e('0x40')]));_0xd2710c[_0x292e('0x41')]=_0xd2710c['attributes']['length']?_0xd2710c[_0x292e('0x41')]:_0x407fa1[_0x292e('0x3b')];_0xd2710c[_0x292e('0x45')]=qs[_0x292e('0x46')](_0x3d724a[_0x292e('0x3c')][_0x292e('0x46')]);_0xd2710c['where']=qs[_0x292e('0x3e')](_[_0x292e('0x48')](_0x3d724a[_0x292e('0x3c')],_0x407fa1[_0x292e('0x3e')]));if(_0x3d724a[_0x292e('0x3c')][_0x292e('0x49')]){_0xd2710c['where']=_[_0x292e('0x2e')](_0xd2710c[_0x292e('0x47')],{'$or':_['map'](_0xd2710c[_0x292e('0x41')],function(_0x5ba79e){var _0x547d39={};_0x547d39[_0x5ba79e]={'$like':'%'+_0x3d724a[_0x292e('0x3c')][_0x292e('0x49')]+'%'};return _0x547d39;})});}_0xd2710c=_[_0x292e('0x2e')]({},_0xd2710c,_0x3d724a['options']);return _0x16c136[_0x292e('0x66')](_0xd2710c);}})[_0x292e('0x26')](function(_0x52d834){if(_0x52d834){_0x38498f=_0x52d834[_0x292e('0x42')];if(!_0x3d724a[_0x292e('0x3c')][_0x292e('0x43')](_0x292e('0x44'))){_0xd2710c[_0x292e('0x1f')]=qs[_0x292e('0x1f')](_0x3d724a[_0x292e('0x3c')][_0x292e('0x1f')]);_0xd2710c[_0x292e('0x1d')]=qs[_0x292e('0x1d')](_0x3d724a['query'][_0x292e('0x1d')]);}return _0x16c136[_0x292e('0x66')](_0xd2710c);}})[_0x292e('0x26')](function(_0x29800d){if(_0x29800d){return _0x29800d?{'count':_0x38498f,'rows':_0x29800d}:null;}})[_0x292e('0x26')](respondWithResult(_0x17c046,null))[_0x292e('0x50')](handleError(_0x17c046,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index bbbb5da..6d00ef8 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa88c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x4df28a,_0x406fdc){var _0x15503a=function(_0x2e7478){while(--_0x2e7478){_0x4df28a['push'](_0x4df28a['shift']());}};_0x15503a(++_0x406fdc);}(_0xa88c,0xc3));var _0xca88=function(_0x306be6,_0x1b6114){_0x306be6=_0x306be6-0x0;var _0x1490fb=_0xa88c[_0x306be6];return _0x1490fb;};'use strict';var _=require(_0xca88('0x0'));var util=require(_0xca88('0x1'));var logger=require(_0xca88('0x2'))(_0xca88('0x3'));var moment=require('moment');var BPromise=require(_0xca88('0x4'));var rp=require(_0xca88('0x5'));var fs=require('fs');var path=require(_0xca88('0x6'));var rimraf=require(_0xca88('0x7'));var config=require('../../config/environment');var attributes=require(_0xca88('0x8'));module[_0xca88('0x9')]=function(_0x11ba19,_0x54b073){return _0x11ba19[_0xca88('0xa')](_0xca88('0xb'),attributes,{'tableName':_0xca88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x245e=['api','moment','bluebird','request-promise','path','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x245e,0x1a4));var _0xe245=function(_0x594cf1,_0x3b6b81){_0x594cf1=_0x594cf1-0x0;var _0x2ff334=_0x245e[_0x594cf1];return _0x2ff334;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe245('0x0'));var moment=require(_0xe245('0x1'));var BPromise=require(_0xe245('0x2'));var rp=require(_0xe245('0x3'));var fs=require('fs');var path=require(_0xe245('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe245('0x5'));module[_0xe245('0x6')]=function(_0x3d7c5b,_0x4c43d0){return _0x3d7c5b[_0xe245('0x7')](_0xe245('0x8'),attributes,{'tableName':_0xe245('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index c06be10..dc54271 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab40=['Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Trigger','findAll','options','limit','include','model','map','attributes','GetTrigger','ShowTrigger','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40cc92,_0x4114ad){var _0x5c68e5=function(_0x2b7b46){while(--_0x2b7b46){_0x40cc92['push'](_0x40cc92['shift']());}};_0x5c68e5(++_0x4114ad);}(_0xab40,0xcd));var _0x0ab4=function(_0x132e1c,_0x9ef7da){_0x132e1c=_0x132e1c-0x0;var _0x4147c1=_0xab40[_0x132e1c];return _0x4147c1;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10d92b,_0x46d16a,_0x11e99f){return new BPromise(function(_0x6d135d,_0x4cf8de){return client['request'](_0x10d92b,_0x11e99f)['then'](function(_0x24271e){logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));logger[_0x0ab4('0xb')](_0x0ab4('0xc'),_0x46d16a,_0x0ab4('0xa'),JSON[_0x0ab4('0xd')](_0x24271e));if(_0x24271e['error']){if(_0x24271e['error'][_0x0ab4('0xe')]===0x1f4){logger['error'](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x4cf8de(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}logger[_0x0ab4('0xf')](_0x0ab4('0x9'),_0x46d16a,_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);return _0x6d135d(_0x24271e[_0x0ab4('0xf')][_0x0ab4('0x10')]);}else{logger[_0x0ab4('0x8')](_0x0ab4('0x9'),_0x46d16a,_0x0ab4('0xa'));_0x6d135d(_0x24271e[_0x0ab4('0x11')][_0x0ab4('0x10')]);}})[_0x0ab4('0x12')](function(_0x2bdda7){logger['error']('Trigger,\x20%s,\x20%s',_0x46d16a,_0x2bdda7);_0x4cf8de(_0x2bdda7);});});}exports['GetTrigger']=function(_0x17422f){var _0x30d5df=this;return new Promise(function(_0x2f50d2,_0x53723c){return db[_0x0ab4('0x13')][_0x0ab4('0x14')]({'raw':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17422f['options']?_0x17422f[_0x0ab4('0x15')]['where']||null:null,'attributes':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['attributes']||null:null,'limit':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x16')]||null:null,'include':_0x17422f[_0x0ab4('0x15')]?_0x17422f[_0x0ab4('0x15')]['include']?_['map'](_0x17422f[_0x0ab4('0x15')][_0x0ab4('0x17')],function(_0x392afe){return{'model':db[_0x392afe[_0x0ab4('0x18')]],'as':_0x392afe['as'],'attributes':_0x392afe['attributes'],'include':_0x392afe[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x392afe[_0x0ab4('0x17')],function(_0x4ea9aa){return{'model':db[_0x4ea9aa['model']],'as':_0x4ea9aa['as'],'attributes':_0x4ea9aa[_0x0ab4('0x1a')],'include':_0x4ea9aa[_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x4ea9aa['include'],function(_0x519b23){return{'model':db[_0x519b23['model']],'as':_0x519b23['as'],'attributes':_0x519b23[_0x0ab4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bf844){logger[_0x0ab4('0x8')]('GetTrigger',_0x17422f);logger['debug']('GetTrigger',_0x17422f,JSON[_0x0ab4('0xd')](_0x3bf844));_0x2f50d2(_0x3bf844);})[_0x0ab4('0x12')](function(_0x1cfdad){logger[_0x0ab4('0xf')](_0x0ab4('0x1b'),_0x1cfdad['message'],_0x17422f);_0x53723c(_0x30d5df['error'](0x1f4,_0x1cfdad['message']));});});};exports[_0x0ab4('0x1c')]=function(_0x2b66d5){var _0x155d96=this;return new Promise(function(_0x182bbe,_0x46eda7){return db['Trigger']['find']({'raw':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b66d5['options']?_0x2b66d5['options'][_0x0ab4('0x1e')]||null:null,'attributes':_0x2b66d5['options']?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x1a')]||null:null,'include':_0x2b66d5[_0x0ab4('0x15')]?_0x2b66d5[_0x0ab4('0x15')][_0x0ab4('0x17')]?_[_0x0ab4('0x19')](_0x2b66d5['options'][_0x0ab4('0x17')],function(_0x4696fc){return{'model':db[_0x4696fc[_0x0ab4('0x18')]],'as':_0x4696fc['as'],'attributes':_0x4696fc[_0x0ab4('0x1a')],'include':_0x4696fc['include']?_['map'](_0x4696fc[_0x0ab4('0x17')],function(_0x3e65a1){return{'model':db[_0x3e65a1[_0x0ab4('0x18')]],'as':_0x3e65a1['as'],'attributes':_0x3e65a1['attributes'],'include':_0x3e65a1['include']?_['map'](_0x3e65a1[_0x0ab4('0x17')],function(_0x35eab3){return{'model':db[_0x35eab3[_0x0ab4('0x18')]],'as':_0x35eab3['as'],'attributes':_0x35eab3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x492943){logger[_0x0ab4('0x8')](_0x0ab4('0x1c'),_0x2b66d5);logger[_0x0ab4('0xb')](_0x0ab4('0x1c'),_0x2b66d5,JSON[_0x0ab4('0xd')](_0x492943));_0x182bbe(_0x492943);})[_0x0ab4('0x12')](function(_0x52d9bf){logger[_0x0ab4('0xf')](_0x0ab4('0x1c'),_0x52d9bf[_0x0ab4('0x10')],_0x2b66d5);_0x46eda7(_0x155d96['error'](0x1f4,_0x52d9bf[_0x0ab4('0x10')]));});});}; \ No newline at end of file +var _0x3f8c=['jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','debug','catch','find','raw','ShowTrigger','moment','bluebird','randomstring','ioredis'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x3f8c,0x104));var _0xc3f8=function(_0x37156a,_0x5b5f52){_0x37156a=_0x37156a-0x0;var _0x488989=_0x3f8c[_0x37156a];return _0x488989;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('Trigger,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')]({'raw':_0x2e7c0f['options']?_0x2e7c0f[_0xc3f8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x16')]||null:null,'attributes':_0x2e7c0f['options']?_0x2e7c0f['options'][_0xc3f8('0x17')]||null:null,'limit':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x18')]||null:null,'include':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2e7c0f['options']['include'],function(_0x4b83f0){return{'model':db[_0x4b83f0[_0xc3f8('0x1b')]],'as':_0x4b83f0['as'],'attributes':_0x4b83f0['attributes'],'include':_0x4b83f0[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4b83f0['include'],function(_0x4569c2){return{'model':db[_0x4569c2[_0xc3f8('0x1b')]],'as':_0x4569c2['as'],'attributes':_0x4569c2[_0xc3f8('0x17')],'include':_0x4569c2[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4569c2[_0xc3f8('0x19')],function(_0xf1d460){return{'model':db[_0xf1d460[_0xc3f8('0x1b')]],'as':_0xf1d460['as'],'attributes':_0xf1d460[_0xc3f8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x22c8e6){logger[_0xc3f8('0x9')](_0xc3f8('0x12'),_0x2e7c0f);logger[_0xc3f8('0x1c')]('GetTrigger',_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x22c8e6));_0xb4ab67(_0x22c8e6);})[_0xc3f8('0x1d')](function(_0x218029){logger['error'](_0xc3f8('0x12'),_0x218029['message'],_0x2e7c0f);_0x47a185(_0x35500f[_0xc3f8('0xe')](0x1f4,_0x218029[_0xc3f8('0x10')]));});});};exports['ShowTrigger']=function(_0x48b32e){var _0x21a225=this;return new Promise(function(_0x25df65,_0xd32b09){return db[_0xc3f8('0x13')][_0xc3f8('0x1e')]({'raw':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['where']||null:null,'attributes':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x17')]||null:null,'include':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['include']?_['map'](_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x19')],function(_0x76ef00){return{'model':db[_0x76ef00[_0xc3f8('0x1b')]],'as':_0x76ef00['as'],'attributes':_0x76ef00[_0xc3f8('0x17')],'include':_0x76ef00['include']?_[_0xc3f8('0x1a')](_0x76ef00[_0xc3f8('0x19')],function(_0x2ba6aa){return{'model':db[_0x2ba6aa['model']],'as':_0x2ba6aa['as'],'attributes':_0x2ba6aa[_0xc3f8('0x17')],'include':_0x2ba6aa[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2ba6aa['include'],function(_0x21a725){return{'model':db[_0x21a725[_0xc3f8('0x1b')]],'as':_0x21a725['as'],'attributes':_0x21a725['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x84d5d2){logger[_0xc3f8('0x9')](_0xc3f8('0x20'),_0x48b32e);logger[_0xc3f8('0x1c')](_0xc3f8('0x20'),_0x48b32e,JSON['stringify'](_0x84d5d2));_0x25df65(_0x84d5d2);})[_0xc3f8('0x1d')](function(_0x2e4880){logger[_0xc3f8('0xe')](_0xc3f8('0x20'),_0x2e4880[_0xc3f8('0x10')],_0x48b32e);_0xd32b09(_0x21a225['error'](0x1f4,_0x2e4880[_0xc3f8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8523407..3491c45 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedeb=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','show','post','/:id/clone','isAuthenticated','clone','create','put','update','delete','destroy','exports','multer','path'];(function(_0xfdc26,_0x139e49){var _0xa3a052=function(_0x1cfa5b){while(--_0x1cfa5b){_0xfdc26['push'](_0xfdc26['shift']());}};_0xa3a052(++_0x139e49);}(_0xedeb,0x19c));var _0xbede=function(_0x29ecbc,_0x2929d9){_0x29ecbc=_0x29ecbc-0x0;var _0x5709b0=_0xedeb[_0x29ecbc];return _0x5709b0;};'use strict';var multer=require(_0xbede('0x0'));var util=require('util');var path=require(_0xbede('0x1'));var timeout=require(_0xbede('0x2'));var express=require(_0xbede('0x3'));var router=express[_0xbede('0x4')]();var fs_extra=require(_0xbede('0x5'));var auth=require(_0xbede('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbede('0x7'));var controller=require(_0xbede('0x8'));router[_0xbede('0x9')]('/',auth['isAuthenticated'](),controller[_0xbede('0xa')]);router[_0xbede('0x9')](_0xbede('0xb'),auth['isAuthenticated'](),controller[_0xbede('0xc')]);router[_0xbede('0xd')](_0xbede('0xe'),auth[_0xbede('0xf')](),controller[_0xbede('0x10')]);router[_0xbede('0xd')]('/',auth[_0xbede('0xf')](),controller[_0xbede('0x11')]);router[_0xbede('0x12')](_0xbede('0xb'),auth[_0xbede('0xf')](),controller[_0xbede('0x13')]);router[_0xbede('0x14')](_0xbede('0xb'),auth[_0xbede('0xf')](),controller[_0xbede('0x15')]);module[_0xbede('0x16')]=router; \ No newline at end of file +var _0x21cb=['isAuthenticated','/:id','show','post','/:id/clone','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x27f491,_0x1cd76c){var _0x550a09=function(_0x197180){while(--_0x197180){_0x27f491['push'](_0x27f491['shift']());}};_0x550a09(++_0x1cd76c);}(_0x21cb,0x199));var _0xb21c=function(_0x1ef44f,_0x51cc09){_0x1ef44f=_0x1ef44f-0x0;var _0x57c070=_0x21cb[_0x1ef44f];return _0x57c070;};'use strict';var multer=require(_0xb21c('0x0'));var util=require(_0xb21c('0x1'));var path=require(_0xb21c('0x2'));var timeout=require(_0xb21c('0x3'));var express=require(_0xb21c('0x4'));var router=express[_0xb21c('0x5')]();var fs_extra=require(_0xb21c('0x6'));var auth=require(_0xb21c('0x7'));var interaction=require(_0xb21c('0x8'));var config=require(_0xb21c('0x9'));var controller=require(_0xb21c('0xa'));router['get']('/',auth[_0xb21c('0xb')](),controller['index']);router['get'](_0xb21c('0xc'),auth[_0xb21c('0xb')](),controller[_0xb21c('0xd')]);router[_0xb21c('0xe')](_0xb21c('0xf'),auth[_0xb21c('0xb')](),controller['clone']);router[_0xb21c('0xe')]('/',auth[_0xb21c('0xb')](),controller[_0xb21c('0x10')]);router[_0xb21c('0x11')]('/:id',auth[_0xb21c('0xb')](),controller[_0xb21c('0x12')]);router['delete']('/:id',auth[_0xb21c('0xb')](),controller[_0xb21c('0x13')]);module[_0xb21c('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8bb2035..7f4761b 100644 --- a/server/api/trunk/trunk.attributes.js +++ b/server/api/trunk/trunk.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe4c=['transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','all','ulaw;alaw;gsm','join','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','accept','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xfe4c,0x1bd));var _0xcfe4=function(_0x70075a,_0x33562d){_0x70075a=_0x70075a-0x0;var _0x85bc93=_0xfe4c[_0x70075a];return _0x85bc93;};'use strict';var Sequelize=require(_0xcfe4('0x0'));module[_0xcfe4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcfe4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x4'),_0xcfe4('0x5'),'peer'),'allowNull':![],'defaultValue':_0xcfe4('0x4')},'context':{'type':Sequelize[_0xcfe4('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x7'),_0xcfe4('0x8'),_0xcfe4('0x9'),_0xcfe4('0xa'),_0xcfe4('0xb'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xcfe4('0xc'))},'deny':{'type':Sequelize[_0xcfe4('0x6')]},'permit':{'type':Sequelize[_0xcfe4('0x6')]},'secret':{'type':Sequelize[_0xcfe4('0x6')]},'md5secret':{'type':Sequelize[_0xcfe4('0x6')]},'remotesecret':{'type':Sequelize[_0xcfe4('0x6')]},'transport':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0xd'),'set':function(_0x559338){this['setDataValue'](_0xcfe4('0xe'),_0x559338?_0x559338['join'](','):null);},'get':function(){return this[_0xcfe4('0xf')](_0xcfe4('0xe'))?this[_0xcfe4('0xf')]('transport')[_0xcfe4('0x10')](','):null;},'comment':_0xcfe4('0x11')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xcfe4('0x12'),_0xcfe4('0x13'),_0xcfe4('0x14'),_0xcfe4('0x15')),'defaultValue':_0xcfe4('0x16')},'directmedia':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no',_0xcfe4('0x18'),_0xcfe4('0x19'),_0xcfe4('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcfe4('0x6')]},'directmediadeny':{'type':Sequelize[_0xcfe4('0x6')]},'nat':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x1b'),'set':function(_0x433696){this[_0xcfe4('0x1c')]('nat',_0x433696?_0x433696['join'](','):null);},'get':function(){return this['getDataValue'](_0xcfe4('0x1d'))?this['getDataValue']('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xcfe4('0x6')]},'namedcallgroup':{'type':Sequelize[_0xcfe4('0x6')]},'pickupgroup':{'type':Sequelize[_0xcfe4('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xcfe4('0x6')]},'language':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x1e')},'allow':{'type':Sequelize[_0xcfe4('0x6')],'allowNull':![],'defaultValue':_0xcfe4('0x1f'),'set':function(_0x157210){this[_0xcfe4('0x1c')]('allow',_0x157210?_0x157210[_0xcfe4('0x20')](';'):_0xcfe4('0x1f'));},'get':function(){return this['getDataValue'](_0xcfe4('0x21'))?this[_0xcfe4('0xf')](_0xcfe4('0x21'))[_0xcfe4('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x22'),'set':function(_0x2c8add){this['setDataValue'](_0xcfe4('0x23'),_0x2c8add?_0x2c8add['join'](','):null);},'get':function(){return this[_0xcfe4('0xf')]('insecure')?this['getDataValue']('insecure')[_0xcfe4('0x10')](','):null;},'comment':_0xcfe4('0x24')},'trustrpid':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcfe4('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x25')},'amaflags':{'type':Sequelize[_0xcfe4('0x6')]},'callcounter':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xcfe4('0x6')]},'template':{'type':Sequelize[_0xcfe4('0x6')]},'videosupport':{'type':Sequelize[_0xcfe4('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'mailbox':{'type':Sequelize[_0xcfe4('0x6')]},'session_timers':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x27'),'refuse',_0xcfe4('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xcfe4('0x29'),_0xcfe4('0x2a')),'defaultValue':_0xcfe4('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xcfe4('0x6')]},'regexten':{'type':Sequelize[_0xcfe4('0x6')]},'fromdomain':{'type':Sequelize[_0xcfe4('0x6')]},'fromuser':{'type':Sequelize[_0xcfe4('0x6')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':_0xcfe4('0x17')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xcfe4('0x6')]},'rtptimeout':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no',_0xcfe4('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcfe4('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'timerb':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xcfe4('0x6')]},'contactdeny':{'type':Sequelize[_0xcfe4('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xcfe4('0x6')]},'use_q850_reason':{'type':Sequelize[_0xcfe4('0x6')]},'maxforwards':{'type':Sequelize[_0xcfe4('0x26')](0xb)},'encryption':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no')},'icesupport':{'type':Sequelize[_0xcfe4('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no',_0xcfe4('0x2c'),_0xcfe4('0x2d'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xcfe4('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xcfe4('0x6')]},'dtlscipher':{'type':Sequelize[_0xcfe4('0x6')]},'dtlscafile':{'type':Sequelize[_0xcfe4('0x6')]},'dtlscapath':{'type':Sequelize[_0xcfe4('0x6')]},'dtlssetup':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x2e'),_0xcfe4('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xcfe4('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcfe4('0x6')]},'recordofffeature':{'type':Sequelize[_0xcfe4('0x6')]},'call_limit':{'type':Sequelize[_0xcfe4('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xcfe4('0x3')](_0xcfe4('0x17'),'no')},'vmexten':{'type':Sequelize[_0xcfe4('0x6')]},'mohinterpret':{'type':Sequelize[_0xcfe4('0x6')]},'mohsuggest':{'type':Sequelize[_0xcfe4('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcfe4('0x6')],'defaultValue':_0xcfe4('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xcfe4('0x17'),'no',_0xcfe4('0x18'),_0xcfe4('0x19'),_0xcfe4('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcfe4('0x6')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcfe4('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xe8e3=['join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','uac','uas','pai','fingerprint','active','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport'];(function(_0x4e7787,_0x298a6b){var _0x1877bb=function(_0x401c47){while(--_0x401c47){_0x4e7787['push'](_0x4e7787['shift']());}};_0x1877bb(++_0x298a6b);}(_0xe8e3,0x115));var _0x3e8e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe8e3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x3e8e('0x0'));module[_0x3e8e('0x1')]={'name':{'type':Sequelize[_0x3e8e('0x2')],'allowNull':![],'unique':_0x3e8e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x5'),_0x3e8e('0x6'),'peer'),'allowNull':![],'defaultValue':_0x3e8e('0x5')},'context':{'type':Sequelize[_0x3e8e('0x2')],'allowNull':![],'defaultValue':_0x3e8e('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x3e8e('0x8'),_0x3e8e('0x9'),_0x3e8e('0xa'),_0x3e8e('0xb'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x3e8e('0xc'),_0x3e8e('0xd'))},'deny':{'type':Sequelize[_0x3e8e('0x2')]},'permit':{'type':Sequelize[_0x3e8e('0x2')]},'secret':{'type':Sequelize[_0x3e8e('0x2')]},'md5secret':{'type':Sequelize[_0x3e8e('0x2')]},'remotesecret':{'type':Sequelize[_0x3e8e('0x2')]},'transport':{'type':Sequelize[_0x3e8e('0x2')],'defaultValue':_0x3e8e('0xe'),'set':function(_0x2a25c7){this[_0x3e8e('0xf')](_0x3e8e('0x10'),_0x2a25c7?_0x2a25c7[_0x3e8e('0x11')](','):null);},'get':function(){return this[_0x3e8e('0x12')]('transport')?this[_0x3e8e('0x12')](_0x3e8e('0x10'))['split'](','):null;},'comment':_0x3e8e('0x13')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x3e8e('0x14'),_0x3e8e('0x15'),_0x3e8e('0x16'),_0x3e8e('0x17')),'defaultValue':_0x3e8e('0x18')},'directmedia':{'type':Sequelize['ENUM'](_0x3e8e('0x19'),'no',_0x3e8e('0x1a'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3e8e('0x2')]},'directmediadeny':{'type':Sequelize[_0x3e8e('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x3ba331){this[_0x3e8e('0xf')]('nat',_0x3ba331?_0x3ba331[_0x3e8e('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x3e8e('0x1b'))?this['getDataValue'](_0x3e8e('0x1b'))[_0x3e8e('0x1c')](','):null;},'comment':_0x3e8e('0x1d')},'callgroup':{'type':Sequelize[_0x3e8e('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3e8e('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3e8e('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3e8e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3e8e('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3e8e('0x2')],'allowNull':![],'defaultValue':_0x3e8e('0x1e'),'set':function(_0x54ffa5){this[_0x3e8e('0xf')](_0x3e8e('0x1f'),_0x54ffa5?_0x54ffa5[_0x3e8e('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3e8e('0x12')]('allow')?this[_0x3e8e('0x12')](_0x3e8e('0x1f'))[_0x3e8e('0x1c')](';'):null;},'comment':_0x3e8e('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0x3e8e('0x19'),'no')},'insecure':{'type':Sequelize[_0x3e8e('0x2')],'defaultValue':_0x3e8e('0x21'),'set':function(_0x2faf07){this[_0x3e8e('0xf')](_0x3e8e('0x22'),_0x2faf07?_0x2faf07[_0x3e8e('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x3e8e('0x22'))?this[_0x3e8e('0x12')](_0x3e8e('0x22'))[_0x3e8e('0x1c')](','):null;},'comment':_0x3e8e('0x23')},'trustrpid':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x3e8e('0x24'))},'promiscredir':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'accountcode':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'setvar':{'type':Sequelize[_0x3e8e('0x2')]},'callerid':{'type':Sequelize[_0x3e8e('0x2')],'defaultValue':_0x3e8e('0x26')},'amaflags':{'type':Sequelize[_0x3e8e('0x2')]},'callcounter':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3e8e('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x3e8e('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x3e8e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'mailbox':{'type':Sequelize[_0x3e8e('0x2')]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x27'),_0x3e8e('0x28')),'defaultValue':_0x3e8e('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x3e8e('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3e8e('0x25')](0x5)},'qualify':{'type':Sequelize[_0x3e8e('0x4')]('yes','no'),'defaultValue':_0x3e8e('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x3e8e('0x2')]},'rtptimeout':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no',_0x3e8e('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'timerb':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x3e8e('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x3e8e('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x3e8e('0x2')]},'maxforwards':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'encryption':{'type':Sequelize[_0x3e8e('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3e8e('0x19'),'no')},'force_avp':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x3e8e('0x4')]('yes','no',_0x3e8e('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3e8e('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3e8e('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3e8e('0x2')]},'dtlscipher':{'type':Sequelize[_0x3e8e('0x2')]},'dtlscafile':{'type':Sequelize[_0x3e8e('0x2')]},'dtlscapath':{'type':Sequelize[_0x3e8e('0x2')]},'dtlssetup':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x2b'),'passive',_0x3e8e('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x3e8e('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3e8e('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x3e8e('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x3e8e('0x2')]},'description':{'type':Sequelize[_0x3e8e('0x2')]},'host':{'type':Sequelize[_0x3e8e('0x2')],'defaultValue':_0x3e8e('0x2d')},'canreinvite':{'type':Sequelize[_0x3e8e('0x4')](_0x3e8e('0x19'),'no','nonat',_0x3e8e('0x2e'),_0x3e8e('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3e8e('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3e8e('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3e8e('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 8783e87..b65aea0 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','Trunks','UserProfileResource','destroy','stack','name','render','body','agent','interaction','account','index','map','Trunk','rawAttributes','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','include','find','get','omit','createdAt','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','update','params','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Reload','rimraf','zip-dir','fast-json-patch'];(function(_0x2ea754,_0xf70140){var _0x32c0e8=function(_0x532475){while(--_0x532475){_0x2ea754['push'](_0x2ea754['shift']());}};_0x32c0e8(++_0xf70140);}(_0x2032,0xd9));var _0x2203=function(_0x5d4c7f,_0xc44c9f){_0x5d4c7f=_0x5d4c7f-0x0;var _0xcfb220=_0x2032[_0x5d4c7f];return _0xcfb220;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f56ff,_0x4bad7c,_0x238772,_0x538b30){return new BPromise(function(_0x592e47,_0x21a3af){var _0x472265=_0x538b30||client;return _0x472265[_0x2203('0x18')](_0x5f56ff,_0x238772)[_0x2203('0x19')](function(_0x226209){logger[_0x2203('0x1a')](_0x2203('0x1b'),_0x4bad7c,_0x2203('0x1c'));logger[_0x2203('0x1d')](_0x2203('0x1e'),_0x4bad7c,'request\x20sent',JSON[_0x2203('0x1f')](_0x226209));if(_0x226209[_0x2203('0x20')]){if(_0x226209['error'][_0x2203('0x21')]===0x1f4){logger[_0x2203('0x20')]('Trunk,\x20%s,\x20%s',_0x4bad7c,_0x226209[_0x2203('0x20')]['message']);return _0x21a3af(_0x226209[_0x2203('0x20')][_0x2203('0x22')]);}logger[_0x2203('0x20')](_0x2203('0x1b'),_0x4bad7c,_0x226209[_0x2203('0x20')][_0x2203('0x22')]);return _0x592e47(_0x226209['error'][_0x2203('0x22')]);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x4bad7c,_0x2203('0x1c'));_0x592e47(_0x226209['result'][_0x2203('0x22')]);}})[_0x2203('0x23')](function(_0x5d4c4e){logger[_0x2203('0x20')]('Trunk,\x20%s,\x20%s',_0x4bad7c,_0x5d4c4e);_0x21a3af(_0x5d4c4e);});});}function respondWithStatusCode(_0x5c8da9,_0x226374){_0x226374=_0x226374||0xcc;return function(_0x2718f5){if(_0x2718f5){return _0x5c8da9[_0x2203('0x24')](_0x226374);}return _0x5c8da9[_0x2203('0x25')](_0x226374)[_0x2203('0x26')]();};}function respondWithResult(_0x3114ef,_0x49c12){_0x49c12=_0x49c12||0xc8;return function(_0x250349){if(_0x250349){return _0x3114ef['status'](_0x49c12)[_0x2203('0x27')](_0x250349);}};}function respondWithFilteredResult(_0x36b958,_0x39a11a){return function(_0x5f11bf){if(_0x5f11bf){var _0xb2071b=typeof _0x39a11a[_0x2203('0x28')]==='undefined'&&typeof _0x39a11a[_0x2203('0x29')]===_0x2203('0x2a');var _0x1c6a77=_0x5f11bf[_0x2203('0x2b')];var _0x28ae02=_0xb2071b?0x0:_0x39a11a[_0x2203('0x28')];var _0x9c53f=_0xb2071b?_0x5f11bf['count']:_0x39a11a[_0x2203('0x28')]+_0x39a11a[_0x2203('0x29')];var _0x406ce9;if(_0x9c53f>=_0x1c6a77){_0x9c53f=_0x1c6a77;_0x406ce9=0xc8;}else{_0x406ce9=0xce;}_0x36b958[_0x2203('0x25')](_0x406ce9);return _0x36b958['set'](_0x2203('0x2c'),_0x28ae02+'-'+_0x9c53f+'/'+_0x1c6a77)[_0x2203('0x27')](_0x5f11bf);}return null;};}function patchUpdates(_0x287c95){return function(_0xf59954){try{jsonpatch['apply'](_0xf59954,_0x287c95,!![]);}catch(_0xea1637){return BPromise[_0x2203('0x2d')](_0xea1637);}return _0xf59954['save']();};}function saveUpdates(_0x5c0157,_0x1d5f74){return function(_0x52fafc){if(_0x52fafc){return _0x52fafc['update'](_0x5c0157)[_0x2203('0x19')](function(_0x464c88){return _0x464c88;});}return null;};}function removeEntity(_0x191894,_0x1e0aa9){return function(_0xf2801d){if(_0xf2801d){return _0xf2801d['destroy']()[_0x2203('0x19')](function(){var _0x2324c0=_0xf2801d['get']({'plain':!![]});var _0x2a2ee7=_0x2203('0x2e');return db[_0x2203('0x2f')][_0x2203('0x30')]({'where':{'type':_0x2a2ee7,'resourceId':_0x2324c0['id']}})[_0x2203('0x19')](function(){return _0xf2801d;});})[_0x2203('0x19')](function(){_0x191894[_0x2203('0x25')](0xcc)[_0x2203('0x26')]();});}};}function handleEntityNotFound(_0x708faa,_0x522a69){return function(_0x15c0ad){if(!_0x15c0ad){_0x708faa[_0x2203('0x24')](0x194);}return _0x15c0ad;};}function handleError(_0x56f9b2,_0x54b90b){_0x54b90b=_0x54b90b||0x1f4;return function(_0x2c58b1){logger['error'](_0x2c58b1[_0x2203('0x31')]);if(_0x2c58b1[_0x2203('0x32')]){delete _0x2c58b1[_0x2203('0x32')];}_0x56f9b2['status'](_0x54b90b)['send'](_0x2c58b1);};}function getMustacheRender(_0x34cdeb,_0x47c93a){return Mustache[_0x2203('0x33')](_0x34cdeb,_['merge'](_0x47c93a[_0x2203('0x34')],{'contact':_0x47c93a['contact'],'message':_0x47c93a[_0x2203('0x22')],'agent':_0x47c93a[_0x2203('0x35')],'interaction':_0x47c93a[_0x2203('0x36')],'account':_0x47c93a[_0x2203('0x37')]}))||'';}exports[_0x2203('0x38')]=function(_0x5436d2,_0x5f1561){var _0x4c0e9e={},_0x7ea79b={},_0x25a2dc={'count':0x0,'rows':[]};var _0x323798=_[_0x2203('0x39')](db[_0x2203('0x3a')][_0x2203('0x3b')],function(_0x1c7e3d){return{'name':_0x1c7e3d['fieldName'],'type':_0x1c7e3d[_0x2203('0x3c')][_0x2203('0x3d')]};});_0x7ea79b[_0x2203('0x3e')]=_[_0x2203('0x39')](_0x323798,'name');_0x7ea79b['query']=_[_0x2203('0x3f')](_0x5436d2['query']);_0x7ea79b[_0x2203('0x40')]=_[_0x2203('0x41')](_0x7ea79b[_0x2203('0x3e')],_0x7ea79b['query']);_0x4c0e9e['attributes']=_[_0x2203('0x41')](_0x7ea79b[_0x2203('0x3e')],qs[_0x2203('0x42')](_0x5436d2[_0x2203('0x43')][_0x2203('0x42')]));_0x4c0e9e[_0x2203('0x44')]=_0x4c0e9e['attributes'][_0x2203('0x45')]?_0x4c0e9e[_0x2203('0x44')]:_0x7ea79b[_0x2203('0x3e')];if(!_0x5436d2[_0x2203('0x43')][_0x2203('0x46')](_0x2203('0x47'))){_0x4c0e9e[_0x2203('0x29')]=qs[_0x2203('0x29')](_0x5436d2[_0x2203('0x43')][_0x2203('0x29')]);_0x4c0e9e['offset']=qs[_0x2203('0x28')](_0x5436d2[_0x2203('0x43')][_0x2203('0x28')]);}_0x4c0e9e[_0x2203('0x48')]=qs['sort'](_0x5436d2['query'][_0x2203('0x49')]);_0x4c0e9e['where']=qs[_0x2203('0x40')](_[_0x2203('0x4a')](_0x5436d2[_0x2203('0x43')],_0x7ea79b[_0x2203('0x40')]),_0x323798);if(_0x5436d2['query'][_0x2203('0x4b')]){_0x4c0e9e[_0x2203('0x4c')]=_['merge'](_0x4c0e9e[_0x2203('0x4c')],{'$or':_[_0x2203('0x39')](_0x323798,function(_0x35b2e9){if(_0x35b2e9[_0x2203('0x3c')]!=='VIRTUAL'){var _0x4c1a29={};_0x4c1a29[_0x35b2e9[_0x2203('0x32')]]={'$like':'%'+_0x5436d2['query']['filter']+'%'};return _0x4c1a29;}})});}_0x4c0e9e=_[_0x2203('0x4d')]({},_0x4c0e9e,_0x5436d2[_0x2203('0x4e')]);var _0x1a2665={'where':_0x4c0e9e['where']};return db['Trunk'][_0x2203('0x2b')](_0x1a2665)[_0x2203('0x19')](function(_0x12d7fa){_0x25a2dc[_0x2203('0x2b')]=_0x12d7fa;if(_0x5436d2[_0x2203('0x43')][_0x2203('0x4f')]){_0x4c0e9e['include']=[{'all':!![]}];}return db[_0x2203('0x3a')]['findAll'](_0x4c0e9e);})[_0x2203('0x19')](function(_0x39ff6f){_0x25a2dc[_0x2203('0x50')]=_0x39ff6f;return _0x25a2dc;})[_0x2203('0x19')](respondWithFilteredResult(_0x5f1561,_0x4c0e9e))['catch'](handleError(_0x5f1561,null));};exports['show']=function(_0x30d503,_0x1f772d){var _0x126aad={'raw':![],'where':{'id':_0x30d503['params']['id']}},_0x1a1c00={};_0x1a1c00['model']=_['keys'](db[_0x2203('0x3a')][_0x2203('0x3b')]);_0x1a1c00['query']=_[_0x2203('0x3f')](_0x30d503[_0x2203('0x43')]);_0x1a1c00['filters']=_[_0x2203('0x41')](_0x1a1c00[_0x2203('0x3e')],_0x1a1c00[_0x2203('0x43')]);_0x126aad[_0x2203('0x44')]=_['intersection'](_0x1a1c00[_0x2203('0x3e')],qs['fields'](_0x30d503[_0x2203('0x43')][_0x2203('0x42')]));_0x126aad['attributes']=_0x126aad[_0x2203('0x44')][_0x2203('0x45')]?_0x126aad[_0x2203('0x44')]:_0x1a1c00[_0x2203('0x3e')];if(_0x30d503[_0x2203('0x43')][_0x2203('0x4f')]){_0x126aad['include']=[{'all':!![]}];}_0x126aad=_['merge']({},_0x126aad,_0x30d503[_0x2203('0x4e')]);return db['Trunk']['find'](_0x126aad)[_0x2203('0x19')](handleEntityNotFound(_0x1f772d,null))[_0x2203('0x19')](respondWithResult(_0x1f772d,null))[_0x2203('0x23')](handleError(_0x1f772d,null));};exports['clone']=function(_0x213c24,_0x4b2788){var _0x5ddf9e={'where':{'id':_0x213c24['params']['id']}},_0xeb6b44={};_0xeb6b44['model']=_['keys'](db[_0x2203('0x3a')][_0x2203('0x3b')]);_0x5ddf9e[_0x2203('0x44')]=_[_0x2203('0x41')](_0xeb6b44[_0x2203('0x3e')],qs[_0x2203('0x42')](_0x213c24[_0x2203('0x43')][_0x2203('0x42')]));_0x5ddf9e[_0x2203('0x44')]=_0x5ddf9e[_0x2203('0x44')][_0x2203('0x45')]?_0x5ddf9e[_0x2203('0x44')]:_0xeb6b44['model'];if(_0x213c24['query'][_0x2203('0x4f')]){_0x5ddf9e[_0x2203('0x51')]=[{'all':!![]}];}_0x5ddf9e=_[_0x2203('0x4d')]({},_0x5ddf9e,_0x213c24[_0x2203('0x4e')]);return db[_0x2203('0x3a')][_0x2203('0x52')](_0x5ddf9e)['then'](handleEntityNotFound(_0x4b2788,null))['then'](function(_0xb49120){if(_0xb49120){var _0x34358e=_0xb49120[_0x2203('0x53')]({'plain':!![]});_0x34358e=qs[_0x2203('0x54')](_0x34358e,['id',_0x2203('0x55'),_0x2203('0x56')]);_0x213c24[_0x2203('0x34')]=_[_0x2203('0x54')](_0x213c24[_0x2203('0x34')],['id',_0x2203('0x55'),_0x2203('0x56')]);return db['Trunk'][_0x2203('0x57')](_[_0x2203('0x4d')](_0x34358e,_0x213c24[_0x2203('0x34')]),{'include':_0x213c24[_0x2203('0x43')][_0x2203('0x4f')]?[{'all':!![]}]:undefined})[_0x2203('0x19')](function(_0x52c159){var _0x544756=_0x213c24[_0x2203('0x58')][_0x2203('0x53')]({'plain':!![]});if(!_0x544756)throw new Error(_0x2203('0x59'));if(_0x544756[_0x2203('0x5a')]===_0x2203('0x58')){var _0x24179a=_0x52c159[_0x2203('0x53')]({'plain':!![]});var _0x34e820=_0x2203('0x2e');return db[_0x2203('0x5b')][_0x2203('0x52')]({'where':{'name':_0x34e820,'userProfileId':_0x544756[_0x2203('0x5c')]},'raw':!![]})['then'](function(_0x468619){if(_0x468619&&_0x468619[_0x2203('0x5d')]===0x0){return db[_0x2203('0x2f')]['create']({'name':_0x24179a[_0x2203('0x32')],'resourceId':_0x24179a['id'],'type':_0x468619[_0x2203('0x32')],'sectionId':_0x468619['id']},{})[_0x2203('0x19')](function(){return _0x52c159;});}else{return _0x52c159;}})[_0x2203('0x23')](function(_0x403b89){logger['error'](_0x2203('0x5e'),_0x403b89);throw _0x403b89;});}return _0x52c159;});}})[_0x2203('0x19')](respondWithResult(_0x4b2788,0xc9))[_0x2203('0x23')](handleError(_0x4b2788,null));};exports['create']=function(_0x5507b6,_0x5d9ae2,_0x485e5b){var _0x595814;return db[_0x2203('0x3a')][_0x2203('0x57')](_0x5507b6[_0x2203('0x34')],{'raw':!![]})[_0x2203('0x19')](function(_0x4287f4){_0x595814=_0x4287f4;return db[_0x2203('0x3a')][_0x2203('0x5f')]({'raw':!![]});})[_0x2203('0x19')](function(_0x56dcbe){var _0x500860=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x63')),_0x2203('0x64'));var _0x32a348=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x65')),_0x2203('0x64'));var _0xf16e1d=ejs[_0x2203('0x33')](_0x500860,{'trunks':_0x56dcbe||[]});fs[_0x2203('0x66')](_0x2203('0x67'),_0xf16e1d);if(_0x595814[_0x2203('0x68')]){var _0x3fe739=ejs[_0x2203('0x33')](_0x32a348,{'trunks':_0x56dcbe||[]});fs[_0x2203('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x3fe739);}})[_0x2203('0x19')](function(){return respondWithRpcPromise('Reload',_0x2203('0x57'),{'module':'chan_sip.so'});})[_0x2203('0x19')](function(){var _0xf71e7e=_0x5507b6[_0x2203('0x58')][_0x2203('0x53')]({'plain':!![]});if(!_0xf71e7e)throw new Error(_0x2203('0x59'));if(_0xf71e7e[_0x2203('0x5a')]===_0x2203('0x58')){var _0x2eab08=_0x595814['get']({'plain':!![]});return db['UserProfileSection'][_0x2203('0x52')]({'where':{'name':_0x2203('0x2e'),'userProfileId':_0xf71e7e[_0x2203('0x5c')]},'raw':!![]})['then'](function(_0x48c6c9){if(_0x48c6c9&&_0x48c6c9['autoAssociation']===0x0){return db[_0x2203('0x2f')][_0x2203('0x57')]({'name':_0x2eab08[_0x2203('0x32')],'resourceId':_0x2eab08['id'],'type':_0x48c6c9[_0x2203('0x32')],'sectionId':_0x48c6c9['id']},{})['then'](function(){return _0x595814;});}else{return _0x595814;}})[_0x2203('0x23')](function(_0x47a2c7){logger[_0x2203('0x20')](_0x2203('0x5e'),_0x47a2c7);throw _0x47a2c7;});}return _0x595814;})[_0x2203('0x19')](respondWithResult(_0x5d9ae2,0xc9))[_0x2203('0x23')](handleError(_0x5d9ae2,null));};exports[_0x2203('0x69')]=function(_0x56c79a,_0x4592fa,_0x247f26){var _0x18663f;return db['Trunk'][_0x2203('0x52')]({'where':{'id':_0x56c79a[_0x2203('0x6a')]['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x4592fa,null))[_0x2203('0x19')](saveUpdates(_0x56c79a[_0x2203('0x34')],null))[_0x2203('0x19')](function(_0x1a2b7c){if(_0x1a2b7c){_0x18663f=_0x1a2b7c;return db[_0x2203('0x3a')][_0x2203('0x5f')]({'raw':!![]});}})[_0x2203('0x19')](function(_0x112385){if(_0x112385){var _0x5db33f=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x63')),_0x2203('0x64'));var _0x52c35e=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x65')),_0x2203('0x64'));var _0x1cc668=ejs['render'](_0x5db33f,{'trunks':_0x112385||[]});fs['writeFileSync'](_0x2203('0x67'),_0x1cc668);var _0x3a1c63=ejs[_0x2203('0x33')](_0x52c35e,{'trunks':_0x112385||[]});fs[_0x2203('0x66')](_0x2203('0x6b'),_0x3a1c63);return respondWithRpcPromise('Reload',_0x2203('0x69'),{'module':_0x2203('0x6c')});}return null;})['then'](function(_0x511689){if(_0x511689){return _0x18663f;}})['then'](respondWithResult(_0x4592fa,null))['catch'](handleError(_0x4592fa,null));};exports['destroy']=function(_0x2952fc,_0x6319a3,_0x437095){var _0x49fd02;return db['Trunk']['find']({'where':{'id':_0x2952fc[_0x2203('0x6a')]['id']}})[_0x2203('0x19')](handleEntityNotFound(_0x6319a3,null))[_0x2203('0x19')](removeEntity(_0x6319a3,null))[_0x2203('0x19')](function(){return db[_0x2203('0x3a')][_0x2203('0x5f')]({'raw':!![]});})[_0x2203('0x19')](function(_0x52f25e){var _0x3bf2c9=fs[_0x2203('0x60')](path[_0x2203('0x61')](config[_0x2203('0x62')],_0x2203('0x63')),_0x2203('0x64'));var _0x13e11f=fs['readFileSync'](path[_0x2203('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x2203('0x64'));var _0x5cd030=ejs[_0x2203('0x33')](_0x3bf2c9,{'trunks':_0x52f25e});var _0x39e7b9=ejs['render'](_0x13e11f,{'trunks':_0x52f25e});fs[_0x2203('0x66')](_0x2203('0x67'),_0x5cd030);fs[_0x2203('0x66')](_0x2203('0x6b'),_0x39e7b9);return respondWithRpcPromise(_0x2203('0x6d'),_0x2203('0x30'),{'module':'chan_sip.so'});})[_0x2203('0x23')](handleError(_0x6319a3,null));}; \ No newline at end of file +var _0x757a=['/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_registers.conf','server/files/templates/registry.ejs','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','render','merge','body','contact','agent','interaction','index','map','Trunk','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','clone','options','omit','createdAt','updatedAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','utf8','writeFileSync'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x757a,0xde));var _0xa757=function(_0x1409ff,_0x49e282){_0x1409ff=_0x1409ff-0x0;var _0x2a293d=_0x757a[_0x1409ff];return _0x2a293d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa757('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564187,_0x2ed0d2,_0x513b1f,_0x481508){return new BPromise(function(_0x32112b,_0x1b670e){var _0x355f0a=_0x481508||client;return _0x355f0a[_0xa757('0x16')](_0x564187,_0x513b1f)[_0xa757('0x17')](function(_0x31cfd2){logger[_0xa757('0x18')](_0xa757('0x19'),_0x2ed0d2,_0xa757('0x1a'));logger[_0xa757('0x1b')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2ed0d2,_0xa757('0x1a'),JSON[_0xa757('0x1c')](_0x31cfd2));if(_0x31cfd2[_0xa757('0x1d')]){if(_0x31cfd2['error']['code']===0x1f4){logger[_0xa757('0x1d')](_0xa757('0x19'),_0x2ed0d2,_0x31cfd2[_0xa757('0x1d')][_0xa757('0x1e')]);return _0x1b670e(_0x31cfd2[_0xa757('0x1d')][_0xa757('0x1e')]);}logger['error'](_0xa757('0x19'),_0x2ed0d2,_0x31cfd2['error'][_0xa757('0x1e')]);return _0x32112b(_0x31cfd2[_0xa757('0x1d')][_0xa757('0x1e')]);}else{logger[_0xa757('0x18')]('Trunk,\x20%s,\x20%s',_0x2ed0d2,'request\x20sent');_0x32112b(_0x31cfd2[_0xa757('0x1f')][_0xa757('0x1e')]);}})[_0xa757('0x20')](function(_0x8d121f){logger[_0xa757('0x1d')](_0xa757('0x19'),_0x2ed0d2,_0x8d121f);_0x1b670e(_0x8d121f);});});}function respondWithStatusCode(_0x2ca10d,_0x21f1af){_0x21f1af=_0x21f1af||0xcc;return function(_0x2bf276){if(_0x2bf276){return _0x2ca10d['sendStatus'](_0x21f1af);}return _0x2ca10d[_0xa757('0x21')](_0x21f1af)['end']();};}function respondWithResult(_0x422e9e,_0x47903b){_0x47903b=_0x47903b||0xc8;return function(_0x40551d){if(_0x40551d){return _0x422e9e[_0xa757('0x21')](_0x47903b)[_0xa757('0x22')](_0x40551d);}};}function respondWithFilteredResult(_0x4d58a4,_0x2b19d5){return function(_0xcd98bd){if(_0xcd98bd){var _0x471e84=typeof _0x2b19d5[_0xa757('0x23')]==='undefined'&&typeof _0x2b19d5[_0xa757('0x24')]==='undefined';var _0x5a5664=_0xcd98bd['count'];var _0x4f8de2=_0x471e84?0x0:_0x2b19d5[_0xa757('0x23')];var _0x596ae2=_0x471e84?_0xcd98bd[_0xa757('0x25')]:_0x2b19d5[_0xa757('0x23')]+_0x2b19d5['limit'];var _0x2a0c9a;if(_0x596ae2>=_0x5a5664){_0x596ae2=_0x5a5664;_0x2a0c9a=0xc8;}else{_0x2a0c9a=0xce;}_0x4d58a4['status'](_0x2a0c9a);return _0x4d58a4[_0xa757('0x26')](_0xa757('0x27'),_0x4f8de2+'-'+_0x596ae2+'/'+_0x5a5664)['json'](_0xcd98bd);}return null;};}function patchUpdates(_0x235e54){return function(_0x5ade7b){try{jsonpatch[_0xa757('0x28')](_0x5ade7b,_0x235e54,!![]);}catch(_0x27b3e2){return BPromise[_0xa757('0x29')](_0x27b3e2);}return _0x5ade7b[_0xa757('0x2a')]();};}function saveUpdates(_0xcc87c0,_0x2c1885){return function(_0x1a44a9){if(_0x1a44a9){return _0x1a44a9[_0xa757('0x2b')](_0xcc87c0)[_0xa757('0x17')](function(_0x384424){return _0x384424;});}return null;};}function removeEntity(_0x1f5d5a,_0x20735f){return function(_0x25dfbb){if(_0x25dfbb){return _0x25dfbb[_0xa757('0x2c')]()[_0xa757('0x17')](function(){var _0xc1cc20=_0x25dfbb[_0xa757('0x2d')]({'plain':!![]});var _0x1ad384=_0xa757('0x2e');return db[_0xa757('0x2f')][_0xa757('0x2c')]({'where':{'type':_0x1ad384,'resourceId':_0xc1cc20['id']}})[_0xa757('0x17')](function(){return _0x25dfbb;});})[_0xa757('0x17')](function(){_0x1f5d5a[_0xa757('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2adf93,_0x21d6b3){return function(_0x1e9d63){if(!_0x1e9d63){_0x2adf93[_0xa757('0x30')](0x194);}return _0x1e9d63;};}function handleError(_0x1c4c40,_0x51e2aa){_0x51e2aa=_0x51e2aa||0x1f4;return function(_0x1d4414){logger[_0xa757('0x1d')](_0x1d4414[_0xa757('0x31')]);if(_0x1d4414[_0xa757('0x32')]){delete _0x1d4414[_0xa757('0x32')];}_0x1c4c40[_0xa757('0x21')](_0x51e2aa)['send'](_0x1d4414);};}function getMustacheRender(_0x1346c2,_0x444639){return Mustache[_0xa757('0x33')](_0x1346c2,_[_0xa757('0x34')](_0x444639[_0xa757('0x35')],{'contact':_0x444639[_0xa757('0x36')],'message':_0x444639[_0xa757('0x1e')],'agent':_0x444639[_0xa757('0x37')],'interaction':_0x444639[_0xa757('0x38')],'account':_0x444639['account']}))||'';}exports[_0xa757('0x39')]=function(_0x34fba8,_0x9f73c6){var _0x35c15a={},_0x2531be={},_0x2fd99e={'count':0x0,'rows':[]};var _0x501e26=_[_0xa757('0x3a')](db[_0xa757('0x3b')]['rawAttributes'],function(_0x5eae0b){return{'name':_0x5eae0b[_0xa757('0x3c')],'type':_0x5eae0b[_0xa757('0x3d')]['key']};});_0x2531be['model']=_[_0xa757('0x3a')](_0x501e26,_0xa757('0x32'));_0x2531be[_0xa757('0x3e')]=_['keys'](_0x34fba8[_0xa757('0x3e')]);_0x2531be[_0xa757('0x3f')]=_[_0xa757('0x40')](_0x2531be[_0xa757('0x41')],_0x2531be[_0xa757('0x3e')]);_0x35c15a['attributes']=_[_0xa757('0x40')](_0x2531be['model'],qs['fields'](_0x34fba8[_0xa757('0x3e')][_0xa757('0x42')]));_0x35c15a[_0xa757('0x43')]=_0x35c15a[_0xa757('0x43')][_0xa757('0x44')]?_0x35c15a['attributes']:_0x2531be['model'];if(!_0x34fba8[_0xa757('0x3e')][_0xa757('0x45')](_0xa757('0x46'))){_0x35c15a[_0xa757('0x24')]=qs[_0xa757('0x24')](_0x34fba8[_0xa757('0x3e')]['limit']);_0x35c15a[_0xa757('0x23')]=qs[_0xa757('0x23')](_0x34fba8['query'][_0xa757('0x23')]);}_0x35c15a['order']=qs[_0xa757('0x47')](_0x34fba8[_0xa757('0x3e')]['sort']);_0x35c15a[_0xa757('0x48')]=qs[_0xa757('0x3f')](_['pick'](_0x34fba8[_0xa757('0x3e')],_0x2531be[_0xa757('0x3f')]),_0x501e26);if(_0x34fba8[_0xa757('0x3e')][_0xa757('0x49')]){_0x35c15a['where']=_[_0xa757('0x34')](_0x35c15a[_0xa757('0x48')],{'$or':_[_0xa757('0x3a')](_0x501e26,function(_0xec4610){if(_0xec4610['type']!==_0xa757('0x4a')){var _0x5b6017={};_0x5b6017[_0xec4610['name']]={'$like':'%'+_0x34fba8[_0xa757('0x3e')][_0xa757('0x49')]+'%'};return _0x5b6017;}})});}_0x35c15a=_[_0xa757('0x34')]({},_0x35c15a,_0x34fba8['options']);var _0x421c65={'where':_0x35c15a['where']};return db[_0xa757('0x3b')][_0xa757('0x25')](_0x421c65)[_0xa757('0x17')](function(_0xbef575){_0x2fd99e[_0xa757('0x25')]=_0xbef575;if(_0x34fba8[_0xa757('0x3e')][_0xa757('0x4b')]){_0x35c15a[_0xa757('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0xa757('0x4d')](_0x35c15a);})[_0xa757('0x17')](function(_0x33347a){_0x2fd99e[_0xa757('0x4e')]=_0x33347a;return _0x2fd99e;})[_0xa757('0x17')](respondWithFilteredResult(_0x9f73c6,_0x35c15a))[_0xa757('0x20')](handleError(_0x9f73c6,null));};exports[_0xa757('0x4f')]=function(_0x2c5b3c,_0x405397){var _0x1d05d7={'raw':![],'where':{'id':_0x2c5b3c[_0xa757('0x50')]['id']}},_0x16644b={};_0x16644b[_0xa757('0x41')]=_[_0xa757('0x51')](db[_0xa757('0x3b')][_0xa757('0x52')]);_0x16644b['query']=_[_0xa757('0x51')](_0x2c5b3c['query']);_0x16644b[_0xa757('0x3f')]=_[_0xa757('0x40')](_0x16644b[_0xa757('0x41')],_0x16644b[_0xa757('0x3e')]);_0x1d05d7['attributes']=_[_0xa757('0x40')](_0x16644b[_0xa757('0x41')],qs[_0xa757('0x42')](_0x2c5b3c[_0xa757('0x3e')]['fields']));_0x1d05d7[_0xa757('0x43')]=_0x1d05d7[_0xa757('0x43')][_0xa757('0x44')]?_0x1d05d7[_0xa757('0x43')]:_0x16644b[_0xa757('0x41')];if(_0x2c5b3c[_0xa757('0x3e')]['includeAll']){_0x1d05d7['include']=[{'all':!![]}];}_0x1d05d7=_['merge']({},_0x1d05d7,_0x2c5b3c['options']);return db[_0xa757('0x3b')][_0xa757('0x53')](_0x1d05d7)[_0xa757('0x17')](handleEntityNotFound(_0x405397,null))[_0xa757('0x17')](respondWithResult(_0x405397,null))[_0xa757('0x20')](handleError(_0x405397,null));};exports[_0xa757('0x54')]=function(_0x5efb32,_0xe31752){var _0x163d99={'where':{'id':_0x5efb32[_0xa757('0x50')]['id']}},_0x34e03f={};_0x34e03f['model']=_[_0xa757('0x51')](db[_0xa757('0x3b')]['rawAttributes']);_0x163d99[_0xa757('0x43')]=_['intersection'](_0x34e03f[_0xa757('0x41')],qs['fields'](_0x5efb32[_0xa757('0x3e')]['fields']));_0x163d99['attributes']=_0x163d99[_0xa757('0x43')][_0xa757('0x44')]?_0x163d99[_0xa757('0x43')]:_0x34e03f[_0xa757('0x41')];if(_0x5efb32[_0xa757('0x3e')][_0xa757('0x4b')]){_0x163d99['include']=[{'all':!![]}];}_0x163d99=_['merge']({},_0x163d99,_0x5efb32[_0xa757('0x55')]);return db[_0xa757('0x3b')][_0xa757('0x53')](_0x163d99)['then'](handleEntityNotFound(_0xe31752,null))['then'](function(_0x18dff7){if(_0x18dff7){var _0x31c4cd=_0x18dff7[_0xa757('0x2d')]({'plain':!![]});_0x31c4cd=qs[_0xa757('0x56')](_0x31c4cd,['id',_0xa757('0x57'),_0xa757('0x58')]);_0x5efb32['body']=_[_0xa757('0x56')](_0x5efb32[_0xa757('0x35')],['id',_0xa757('0x57'),_0xa757('0x58')]);return db[_0xa757('0x3b')][_0xa757('0x59')](_[_0xa757('0x34')](_0x31c4cd,_0x5efb32[_0xa757('0x35')]),{'include':_0x5efb32[_0xa757('0x3e')][_0xa757('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x9e96e6){var _0x5c803a=_0x5efb32['user'][_0xa757('0x2d')]({'plain':!![]});if(!_0x5c803a)throw new Error(_0xa757('0x5a'));if(_0x5c803a[_0xa757('0x5b')]===_0xa757('0x5c')){var _0x3c3ff1=_0x9e96e6[_0xa757('0x2d')]({'plain':!![]});var _0x1b34ad=_0xa757('0x2e');return db[_0xa757('0x5d')][_0xa757('0x53')]({'where':{'name':_0x1b34ad,'userProfileId':_0x5c803a[_0xa757('0x5e')]},'raw':!![]})['then'](function(_0x3f8c5c){if(_0x3f8c5c&&_0x3f8c5c[_0xa757('0x5f')]===0x0){return db['UserProfileResource'][_0xa757('0x59')]({'name':_0x3c3ff1[_0xa757('0x32')],'resourceId':_0x3c3ff1['id'],'type':_0x3f8c5c[_0xa757('0x32')],'sectionId':_0x3f8c5c['id']},{})[_0xa757('0x17')](function(){return _0x9e96e6;});}else{return _0x9e96e6;}})[_0xa757('0x20')](function(_0x113a33){logger['error'](_0xa757('0x60'),_0x113a33);throw _0x113a33;});}return _0x9e96e6;});}})['then'](respondWithResult(_0xe31752,0xc9))[_0xa757('0x20')](handleError(_0xe31752,null));};exports[_0xa757('0x59')]=function(_0x2d9d97,_0x3c87c0,_0x39ca41){var _0x5c0870;return db['Trunk'][_0xa757('0x59')](_0x2d9d97[_0xa757('0x35')],{'raw':!![]})[_0xa757('0x17')](function(_0x5f450f){_0x5c0870=_0x5f450f;return db[_0xa757('0x3b')]['findAll']({'raw':!![]});})[_0xa757('0x17')](function(_0x294165){var _0x2b0ad4=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],'server/files/templates/trunk.ejs'),_0xa757('0x64'));var _0x193233=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],'server/files/templates/registry.ejs'),_0xa757('0x64'));var _0x423f3a=ejs[_0xa757('0x33')](_0x2b0ad4,{'trunks':_0x294165||[]});fs[_0xa757('0x65')](_0xa757('0x66'),_0x423f3a);if(_0x5c0870['registry']){var _0x3f1327=ejs[_0xa757('0x33')](_0x193233,{'trunks':_0x294165||[]});fs[_0xa757('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3f1327);}})[_0xa757('0x17')](function(){return respondWithRpcPromise(_0xa757('0x67'),_0xa757('0x59'),{'module':_0xa757('0x68')});})[_0xa757('0x17')](function(){var _0x4695ef=_0x2d9d97[_0xa757('0x5c')][_0xa757('0x2d')]({'plain':!![]});if(!_0x4695ef)throw new Error(_0xa757('0x5a'));if(_0x4695ef[_0xa757('0x5b')]===_0xa757('0x5c')){var _0x404afb=_0x5c0870[_0xa757('0x2d')]({'plain':!![]});return db[_0xa757('0x5d')]['find']({'where':{'name':_0xa757('0x2e'),'userProfileId':_0x4695ef[_0xa757('0x5e')]},'raw':!![]})['then'](function(_0x11f2b3){if(_0x11f2b3&&_0x11f2b3[_0xa757('0x5f')]===0x0){return db['UserProfileResource'][_0xa757('0x59')]({'name':_0x404afb[_0xa757('0x32')],'resourceId':_0x404afb['id'],'type':_0x11f2b3[_0xa757('0x32')],'sectionId':_0x11f2b3['id']},{})[_0xa757('0x17')](function(){return _0x5c0870;});}else{return _0x5c0870;}})[_0xa757('0x20')](function(_0x312542){logger[_0xa757('0x1d')](_0xa757('0x60'),_0x312542);throw _0x312542;});}return _0x5c0870;})[_0xa757('0x17')](respondWithResult(_0x3c87c0,0xc9))[_0xa757('0x20')](handleError(_0x3c87c0,null));};exports[_0xa757('0x2b')]=function(_0x189195,_0x2c2b40,_0x46bc34){var _0x27604c;return db[_0xa757('0x3b')]['find']({'where':{'id':_0x189195[_0xa757('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c2b40,null))[_0xa757('0x17')](saveUpdates(_0x189195[_0xa757('0x35')],null))[_0xa757('0x17')](function(_0x3d92ca){if(_0x3d92ca){_0x27604c=_0x3d92ca;return db[_0xa757('0x3b')]['findAll']({'raw':!![]});}})[_0xa757('0x17')](function(_0x67a58b){if(_0x67a58b){var _0x3a8dce=fs['readFileSync'](path[_0xa757('0x62')](config[_0xa757('0x63')],_0xa757('0x69')),'utf8');var _0x501134=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],'server/files/templates/registry.ejs'),_0xa757('0x64'));var _0x4cc1ad=ejs['render'](_0x3a8dce,{'trunks':_0x67a58b||[]});fs[_0xa757('0x65')](_0xa757('0x66'),_0x4cc1ad);var _0x476297=ejs['render'](_0x501134,{'trunks':_0x67a58b||[]});fs[_0xa757('0x65')](_0xa757('0x6a'),_0x476297);return respondWithRpcPromise(_0xa757('0x67'),_0xa757('0x2b'),{'module':_0xa757('0x68')});}return null;})[_0xa757('0x17')](function(_0x26dcec){if(_0x26dcec){return _0x27604c;}})[_0xa757('0x17')](respondWithResult(_0x2c2b40,null))[_0xa757('0x20')](handleError(_0x2c2b40,null));};exports[_0xa757('0x2c')]=function(_0x180fee,_0xafcf19,_0x5a7042){var _0x3aca47;return db[_0xa757('0x3b')][_0xa757('0x53')]({'where':{'id':_0x180fee[_0xa757('0x50')]['id']}})[_0xa757('0x17')](handleEntityNotFound(_0xafcf19,null))[_0xa757('0x17')](removeEntity(_0xafcf19,null))[_0xa757('0x17')](function(){return db[_0xa757('0x3b')][_0xa757('0x4d')]({'raw':!![]});})[_0xa757('0x17')](function(_0x3997f8){var _0x2f5a0f=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],_0xa757('0x69')),_0xa757('0x64'));var _0x3c4e41=fs[_0xa757('0x61')](path[_0xa757('0x62')](config[_0xa757('0x63')],_0xa757('0x6b')),'utf8');var _0x768a79=ejs[_0xa757('0x33')](_0x2f5a0f,{'trunks':_0x3997f8});var _0x5b91de=ejs[_0xa757('0x33')](_0x3c4e41,{'trunks':_0x3997f8});fs['writeFileSync'](_0xa757('0x66'),_0x768a79);fs[_0xa757('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x5b91de);return respondWithRpcPromise(_0xa757('0x67'),_0xa757('0x2c'),{'module':_0xa757('0x68')});})[_0xa757('0x20')](handleError(_0xafcf19,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 36756a9..82c2d32 100644 --- a/server/api/trunk/trunk.model.js +++ b/server/api/trunk/trunk.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed8a=['request-promise','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed8a,0x8b));var _0xaed8=function(_0xc45be6,_0x253576){_0xc45be6=_0xc45be6-0x0;var _0x209816=_0xed8a[_0xc45be6];return _0x209816;};'use strict';var _=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var logger=require(_0xaed8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaed8('0x3'));var rp=require(_0xaed8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaed8('0x5'));var attributes=require(_0xaed8('0x6'));module[_0xaed8('0x7')]=function(_0x908964,_0x179e7f){return _0x908964[_0xaed8('0x8')](_0xaed8('0x9'),attributes,{'tableName':_0xaed8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa716=['Trunk','tools_trunks','lodash','util','api','bluebird','request-promise','path','rimraf','./trunk.attributes','define'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0xa716,0xa7));var _0x6a71=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xa716[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x6a71('0x0'));var util=require(_0x6a71('0x1'));var logger=require('../../config/logger')(_0x6a71('0x2'));var moment=require('moment');var BPromise=require(_0x6a71('0x3'));var rp=require(_0x6a71('0x4'));var fs=require('fs');var path=require(_0x6a71('0x5'));var rimraf=require(_0x6a71('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a71('0x7'));module['exports']=function(_0x5e15d5,_0x567dbb){return _0x5e15d5[_0x6a71('0x8')](_0x6a71('0x9'),attributes,{'tableName':_0x6a71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 3559f89..2fdce09 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','GetTrunk','debug','stringify','ShowTrunk','find','lodash'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x66fa,0x117));var _0xa66f=function(_0x316299,_0x966935){_0x316299=_0x316299-0x0;var _0x357872=_0x66fa[_0x316299];return _0x357872;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Trunk,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Trunk,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['GetTrunk']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')]({'raw':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x18')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'limit':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1a')]||null:null,'include':_0x1cbe64['options']?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0x1cbe64[_0xa66f('0x16')]['include'],function(_0x337602){return{'model':db[_0x337602[_0xa66f('0x1d')]],'as':_0x337602['as'],'attributes':_0x337602[_0xa66f('0x19')],'include':_0x337602[_0xa66f('0x1b')]?_['map'](_0x337602['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x19')],'include':_0xed98b9[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1d')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x17c103){logger[_0xa66f('0xc')](_0xa66f('0x1e'),_0x1cbe64);logger[_0xa66f('0x1f')](_0xa66f('0x1e'),_0x1cbe64,JSON[_0xa66f('0x20')](_0x17c103));_0x4a28d4(_0x17c103);})[_0xa66f('0x13')](function(_0x63650b){logger[_0xa66f('0xf')](_0xa66f('0x1e'),_0x63650b['message'],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x63650b[_0xa66f('0x12')]));});});};exports[_0xa66f('0x21')]=function(_0x55f309){var _0x44c79a=this;return new Promise(function(_0x2de5f3,_0x4cd7f2){return db[_0xa66f('0x14')][_0xa66f('0x22')]({'raw':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x55f309['options']?_0x55f309[_0xa66f('0x16')]['where']||null:null,'attributes':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'include':_0x55f309['options']?_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')]?_['map'](_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')],function(_0xba9457){return{'model':db[_0xba9457[_0xa66f('0x1d')]],'as':_0xba9457['as'],'attributes':_0xba9457[_0xa66f('0x19')],'include':_0xba9457[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xba9457[_0xa66f('0x1b')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1d')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1b')]?_['map'](_0x35ef27[_0xa66f('0x1b')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1d')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x201432){logger[_0xa66f('0xc')](_0xa66f('0x21'),_0x55f309);logger['debug'](_0xa66f('0x21'),_0x55f309,JSON['stringify'](_0x201432));_0x2de5f3(_0x201432);})[_0xa66f('0x13')](function(_0x45eeb8){logger[_0xa66f('0xf')]('ShowTrunk',_0x45eeb8['message'],_0x55f309);_0x4cd7f2(_0x44c79a[_0xa66f('0xf')](0x1f4,_0x45eeb8[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x4ed7db,_0x5cf7f3){var _0x71c971=function(_0x24cbfc){while(--_0x24cbfc){_0x4ed7db['push'](_0x4ed7db['shift']());}};_0x71c971(++_0x5cf7f3);}(_0x14a0,0x8e));var _0x014a=function(_0x5b6911,_0x1a55bf){_0x5b6911=_0x5b6911-0x0;var _0x5c5e0c=_0x14a0[_0x5b6911];return _0x5c5e0c;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Trunk,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 58f369d..11d8b49 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e69=['update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','addContacts','bulkCreate','post','join','server/files/images/','format','%s-%s','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/square_projects','/:id/api_key','createApiKey','put'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1e69,0x85));var _0x91e6=function(_0x845eb1,_0x2368a7){_0x845eb1=_0x845eb1-0x0;var _0x64aba4=_0x1e69[_0x845eb1];return _0x64aba4;};'use strict';var multer=require('multer');var util=require(_0x91e6('0x0'));var path=require(_0x91e6('0x1'));var timeout=require(_0x91e6('0x2'));var express=require(_0x91e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x91e6('0x4'));var interaction=require(_0x91e6('0x5'));var config=require(_0x91e6('0x6'));var controller=require(_0x91e6('0x7'));router[_0x91e6('0x8')]('/',auth[_0x91e6('0x9')](),controller[_0x91e6('0xa')]);router[_0x91e6('0x8')](_0x91e6('0xb'),auth[_0x91e6('0x9')](),controller[_0x91e6('0xc')]);router[_0x91e6('0x8')](_0x91e6('0xd'),auth['isAuthenticated'](),controller['whoami']);router[_0x91e6('0x8')](_0x91e6('0xe'),auth[_0x91e6('0x9')](),controller[_0x91e6('0xf')]);router['get'](_0x91e6('0x10'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x11')]);router[_0x91e6('0x8')]('/:id/avatar',controller[_0x91e6('0x12')]);router[_0x91e6('0x8')](_0x91e6('0x13'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x14')]);router[_0x91e6('0x8')](_0x91e6('0x15'),auth['isAuthenticated'](),controller[_0x91e6('0x16')]);router[_0x91e6('0x8')](_0x91e6('0x17'),auth[_0x91e6('0x9')](),controller['getQueues']);router[_0x91e6('0x8')](_0x91e6('0x18'),auth['isAuthenticated'](),controller[_0x91e6('0x19')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router[_0x91e6('0x8')](_0x91e6('0x1a'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x91e6('0x8')](_0x91e6('0x1b'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x1c')]);router[_0x91e6('0x8')](_0x91e6('0x1d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x1e')]);router[_0x91e6('0x8')](_0x91e6('0x1f'),auth['isAuthenticated'](),controller[_0x91e6('0x20')]);router[_0x91e6('0x8')](_0x91e6('0x21'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x22')]);router[_0x91e6('0x8')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x91e6('0x23')]);router[_0x91e6('0x8')](_0x91e6('0x24'),auth[_0x91e6('0x9')](),controller['getFaxInteractions']);router[_0x91e6('0x8')](_0x91e6('0x25'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x26')]);router[_0x91e6('0x8')](_0x91e6('0x27'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x28')]);router[_0x91e6('0x8')](_0x91e6('0x29'),auth[_0x91e6('0x9')](),controller['getLists']);router[_0x91e6('0x8')](_0x91e6('0x2a'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x2b')]);router[_0x91e6('0x8')]('/:id/prefixes',auth[_0x91e6('0x9')](),controller[_0x91e6('0x2c')]);router['get'](_0x91e6('0x2d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x2e')]);router['get'](_0x91e6('0x2f'),auth[_0x91e6('0x9')](),controller['getMailAccounts']);router[_0x91e6('0x8')](_0x91e6('0x30'),auth['isAuthenticated'](),controller[_0x91e6('0x31')]);router['get'](_0x91e6('0x32'),auth[_0x91e6('0x9')](),controller['getSmsAccounts']);router[_0x91e6('0x8')]('/:id/chat_websites',auth[_0x91e6('0x9')](),controller[_0x91e6('0x33')]);router[_0x91e6('0x8')](_0x91e6('0x34'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x35')]);router[_0x91e6('0x8')]('/:id/square_projects',auth[_0x91e6('0x9')](),controller['getSquareProjects']);router[_0x91e6('0x8')](_0x91e6('0x36'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x37')]);router[_0x91e6('0x8')]('/:id/api_key',auth[_0x91e6('0x9')](),controller[_0x91e6('0x38')]);router['post'](_0x91e6('0x15'),auth['isAuthenticated'](),controller[_0x91e6('0x39')]);router['post']('/',auth[_0x91e6('0x9')](),controller['create']);router['post']('/create_many',auth[_0x91e6('0x9')](),controller[_0x91e6('0x3a')]);router[_0x91e6('0x3b')](_0x91e6('0x17'),auth[_0x91e6('0x9')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ccf6e,_0x10babf,_0x238a17){_0x238a17(null,path[_0x91e6('0x3c')](config['root'],_0x91e6('0x3d')));},'filename':function(_0x17aeb9,_0x4df33b,_0x5d3c18){_0x5d3c18(null,util[_0x91e6('0x3e')](_0x91e6('0x3f'),Date['now'](),_0x4df33b[_0x91e6('0x40')]));}})});router[_0x91e6('0x3b')](_0x91e6('0x41'),upload[_0x91e6('0x42')](_0x91e6('0x43')),controller[_0x91e6('0x44')]);router[_0x91e6('0x3b')](_0x91e6('0x45'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x46')]);router['post'](_0x91e6('0x47'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x48')]);router[_0x91e6('0x3b')](_0x91e6('0x49'),auth[_0x91e6('0x9')](),controller['pause']);router[_0x91e6('0x3b')](_0x91e6('0x4a'),auth['isAuthenticated'](),controller[_0x91e6('0x4b')]);router['post'](_0x91e6('0x27'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x4c')]);router[_0x91e6('0x3b')](_0x91e6('0x4d'),auth['isAuthenticated'](),controller[_0x91e6('0x4e')]);router['post'](_0x91e6('0x4f'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x50')]);router[_0x91e6('0x3b')](_0x91e6('0x51'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x52')]);router[_0x91e6('0x3b')]('/:id/sms_interactions',auth[_0x91e6('0x9')](),controller[_0x91e6('0x53')]);router[_0x91e6('0x3b')](_0x91e6('0x54'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x55')]);router[_0x91e6('0x3b')](_0x91e6('0x56'),auth['isAuthenticated'](),controller[_0x91e6('0x57')]);router[_0x91e6('0x3b')](_0x91e6('0x2d'),auth['isAuthenticated'](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0x91e6('0x9')](),controller[_0x91e6('0x58')]);router[_0x91e6('0x3b')](_0x91e6('0x30'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x59')]);router[_0x91e6('0x3b')](_0x91e6('0x32'),auth['isAuthenticated'](),controller[_0x91e6('0x5a')]);router[_0x91e6('0x3b')](_0x91e6('0x5b'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x5c')]);router[_0x91e6('0x3b')](_0x91e6('0x34'),auth[_0x91e6('0x9')](),controller['addWhatsappAccounts']);router['post'](_0x91e6('0x5d'),auth[_0x91e6('0x9')](),controller['addSquareProjects']);router[_0x91e6('0x3b')](_0x91e6('0x5e'),auth['isAuthenticated'](),controller[_0x91e6('0x5f')]);router[_0x91e6('0x60')](_0x91e6('0x10'),auth['isAuthenticated'](),controller[_0x91e6('0x61')]);router['put'](_0x91e6('0x62'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x63')]);router[_0x91e6('0x64')](_0x91e6('0x17'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x65')]);router[_0x91e6('0x64')](_0x91e6('0x27'),auth['isAuthenticated'](),controller[_0x91e6('0x66')]);router['delete'](_0x91e6('0x10'),auth[_0x91e6('0x9')](),controller['destroy']);router['delete'](_0x91e6('0x4d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x67')]);router[_0x91e6('0x64')](_0x91e6('0x4f'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x68')]);router[_0x91e6('0x64')](_0x91e6('0x51'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x91e6('0x64')](_0x91e6('0x69'),auth[_0x91e6('0x9')](),controller['removeSmsInteractions']);router[_0x91e6('0x64')](_0x91e6('0x54'),auth['isAuthenticated'](),controller[_0x91e6('0x6a')]);router[_0x91e6('0x64')]('/:id/whatsapp_interactions',auth[_0x91e6('0x9')](),controller[_0x91e6('0x6b')]);router['delete'](_0x91e6('0x2d'),auth['isAuthenticated'](),controller[_0x91e6('0x6c')]);router['delete'](_0x91e6('0x2f'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x6d')]);router['delete'](_0x91e6('0x30'),auth[_0x91e6('0x9')](),controller['removeOpenchannelAccounts']);router[_0x91e6('0x64')](_0x91e6('0x32'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x6e')]);router[_0x91e6('0x64')](_0x91e6('0x5b'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x6f')]);router[_0x91e6('0x64')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x91e6('0x64')](_0x91e6('0x5d'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x70')]);router[_0x91e6('0x64')](_0x91e6('0x5e'),auth[_0x91e6('0x9')](),controller[_0x91e6('0x71')]);module[_0x91e6('0x72')]=router; \ No newline at end of file +var _0xbe48=['/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','/whoami','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts'];(function(_0x4f6007,_0x35429f){var _0x323692=function(_0x4ba8cf){while(--_0x4ba8cf){_0x4f6007['push'](_0x4f6007['shift']());}};_0x323692(++_0x35429f);}(_0xbe48,0x121));var _0x8be4=function(_0x5bc7ed,_0x563bc1){_0x5bc7ed=_0x5bc7ed-0x0;var _0xe55a4e=_0xbe48[_0x5bc7ed];return _0xe55a4e;};'use strict';var multer=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var path=require(_0x8be4('0x2'));var timeout=require(_0x8be4('0x3'));var express=require(_0x8be4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8be4('0x5'));var interaction=require(_0x8be4('0x6'));var config=require('../../config/environment');var controller=require(_0x8be4('0x7'));router[_0x8be4('0x8')]('/',auth[_0x8be4('0x9')](),controller[_0x8be4('0xa')]);router[_0x8be4('0x8')](_0x8be4('0xb'),auth[_0x8be4('0x9')](),controller['describe']);router[_0x8be4('0x8')](_0x8be4('0xc'),auth['isAuthenticated'](),controller['whoami']);router[_0x8be4('0x8')]('/presence',auth['isAuthenticated'](),controller[_0x8be4('0xd')]);router[_0x8be4('0x8')](_0x8be4('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8be4('0xf'),controller[_0x8be4('0x10')]);router[_0x8be4('0x8')](_0x8be4('0x11'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x8be4('0x8')](_0x8be4('0x12'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x13')]);router['get'](_0x8be4('0x14'),auth['isAuthenticated'](),controller[_0x8be4('0x15')]);router[_0x8be4('0x8')](_0x8be4('0x16'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x17')]);router[_0x8be4('0x8')](_0x8be4('0x18'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x19')]);router[_0x8be4('0x8')](_0x8be4('0x1a'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x1b')]);router[_0x8be4('0x8')](_0x8be4('0x1c'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x1d')]);router[_0x8be4('0x8')]('/:id/chat/interactions',auth[_0x8be4('0x9')](),controller[_0x8be4('0x1e')]);router[_0x8be4('0x8')](_0x8be4('0x1f'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x20')]);router['get'](_0x8be4('0x21'),auth[_0x8be4('0x9')](),controller['getMailInteractions']);router[_0x8be4('0x8')]('/:id/sms/interactions',auth[_0x8be4('0x9')](),controller[_0x8be4('0x22')]);router['get'](_0x8be4('0x23'),auth['isAuthenticated'](),controller[_0x8be4('0x24')]);router['get'](_0x8be4('0x25'),auth['isAuthenticated'](),controller[_0x8be4('0x26')]);router[_0x8be4('0x8')](_0x8be4('0x27'),auth[_0x8be4('0x9')](),controller['getTeams']);router[_0x8be4('0x8')](_0x8be4('0x28'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x29')]);router[_0x8be4('0x8')](_0x8be4('0x2a'),auth['isAuthenticated'](),controller[_0x8be4('0x2b')]);router[_0x8be4('0x8')](_0x8be4('0x2c'),auth['isAuthenticated'](),controller[_0x8be4('0x2d')]);router[_0x8be4('0x8')](_0x8be4('0x2e'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x2f')]);router[_0x8be4('0x8')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['getMailAccounts']);router['get'](_0x8be4('0x30'),auth['isAuthenticated'](),controller[_0x8be4('0x31')]);router[_0x8be4('0x8')](_0x8be4('0x32'),auth[_0x8be4('0x9')](),controller['getSmsAccounts']);router[_0x8be4('0x8')](_0x8be4('0x33'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x34')]);router['get'](_0x8be4('0x35'),auth[_0x8be4('0x9')](),controller['getWhatsappAccounts']);router['get'](_0x8be4('0x36'),auth[_0x8be4('0x9')](),controller['getSquareProjects']);router[_0x8be4('0x8')]('/:id/scheduled_calls',auth[_0x8be4('0x9')](),controller[_0x8be4('0x37')]);router['get'](_0x8be4('0x38'),auth[_0x8be4('0x9')](),controller['getApiKey']);router[_0x8be4('0x39')](_0x8be4('0x12'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x3a')]);router[_0x8be4('0x39')]('/',auth['isAuthenticated'](),controller[_0x8be4('0x3b')]);router[_0x8be4('0x39')](_0x8be4('0x3c'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x3d')]);router[_0x8be4('0x39')]('/:id/queues',auth[_0x8be4('0x9')](),controller[_0x8be4('0x3e')]);var upload=multer({'storage':multer[_0x8be4('0x3f')]({'destination':function(_0xe8f294,_0x5639f4,_0x377b3d){_0x377b3d(null,path['join'](config['root'],_0x8be4('0x40')));},'filename':function(_0x12044c,_0x11951b,_0x576c15){_0x576c15(null,util['format'](_0x8be4('0x41'),Date[_0x8be4('0x42')](),_0x11951b[_0x8be4('0x43')]));}})});router['post'](_0x8be4('0xf'),upload[_0x8be4('0x44')](_0x8be4('0x45')),controller[_0x8be4('0x46')]);router[_0x8be4('0x39')](_0x8be4('0x47'),auth['isAuthenticated'](),controller[_0x8be4('0x48')]);router[_0x8be4('0x39')](_0x8be4('0x49'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x4a')]);router[_0x8be4('0x39')](_0x8be4('0x4b'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x4c')]);router[_0x8be4('0x39')](_0x8be4('0x4d'),auth['isAuthenticated'](),controller[_0x8be4('0x4e')]);router[_0x8be4('0x39')](_0x8be4('0x27'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x4f')]);router[_0x8be4('0x39')](_0x8be4('0x50'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x51')]);router[_0x8be4('0x39')](_0x8be4('0x52'),auth[_0x8be4('0x9')](),controller['addMailInteractions']);router['post'](_0x8be4('0x53'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x54')]);router['post'](_0x8be4('0x55'),auth[_0x8be4('0x9')](),controller['addSmsInteractions']);router[_0x8be4('0x39')](_0x8be4('0x56'),auth[_0x8be4('0x9')](),controller['addOpenchannelInteractions']);router[_0x8be4('0x39')](_0x8be4('0x57'),auth[_0x8be4('0x9')](),controller['addWhatsappInteractions']);router[_0x8be4('0x39')](_0x8be4('0x2e'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x58')]);router[_0x8be4('0x39')](_0x8be4('0x59'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x8be4('0x39')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x8be4('0x5a')]);router[_0x8be4('0x39')]('/:id/sms_accounts',auth[_0x8be4('0x9')](),controller[_0x8be4('0x5b')]);router[_0x8be4('0x39')]('/:id/chat_websites',auth[_0x8be4('0x9')](),controller[_0x8be4('0x5c')]);router[_0x8be4('0x39')]('/:id/whatsapp_accounts',auth[_0x8be4('0x9')](),controller[_0x8be4('0x5d')]);router[_0x8be4('0x39')](_0x8be4('0x36'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x5e')]);router[_0x8be4('0x39')](_0x8be4('0x38'),auth[_0x8be4('0x9')](),controller['createApiKey']);router[_0x8be4('0x5f')](_0x8be4('0xe'),auth[_0x8be4('0x9')](),controller['update']);router[_0x8be4('0x5f')](_0x8be4('0x60'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x61')]);router[_0x8be4('0x62')]('/:id/queues',auth[_0x8be4('0x9')](),controller['removeQueues']);router[_0x8be4('0x62')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8be4('0x63')]);router['delete'](_0x8be4('0xe'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x64')]);router['delete'](_0x8be4('0x50'),auth['isAuthenticated'](),controller[_0x8be4('0x65')]);router[_0x8be4('0x62')](_0x8be4('0x52'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x66')]);router[_0x8be4('0x62')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x8be4('0x62')](_0x8be4('0x55'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x67')]);router[_0x8be4('0x62')](_0x8be4('0x56'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x68')]);router[_0x8be4('0x62')](_0x8be4('0x57'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x69')]);router[_0x8be4('0x62')](_0x8be4('0x2e'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x8be4('0x62')]('/:id/mail_accounts',auth[_0x8be4('0x9')](),controller[_0x8be4('0x6a')]);router[_0x8be4('0x62')](_0x8be4('0x30'),auth['isAuthenticated'](),controller[_0x8be4('0x6b')]);router[_0x8be4('0x62')](_0x8be4('0x32'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x6c')]);router['delete'](_0x8be4('0x33'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x6d')]);router[_0x8be4('0x62')](_0x8be4('0x35'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x6e')]);router[_0x8be4('0x62')](_0x8be4('0x36'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x6f')]);router['delete'](_0x8be4('0x38'),auth[_0x8be4('0x9')](),controller[_0x8be4('0x70')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d4e8f46..d529a14 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89db=['ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','nat','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','originate','uas','fingerprint','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsprivatekey','dtlsverify','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','exports','name','setDataValue','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','format','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','friend','from-sip'];(function(_0x33adf0,_0x197fd3){var _0x422e69=function(_0xbce4dd){while(--_0xbce4dd){_0x33adf0['push'](_0x33adf0['shift']());}};_0x422e69(++_0x197fd3);}(_0x89db,0xdf));var _0xb89d=function(_0x433c29,_0x5ec3f7){_0x433c29=_0x433c29-0x0;var _0x27621c=_0x89db[_0x433c29];return _0x27621c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb89d('0x0'));var util=require('util');var _=require('lodash');module[_0xb89d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb89d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2f1bd6){this[_0xb89d('0x3')]('name',_0x2f1bd6);this[_0xb89d('0x3')]('defaultuser',_0x2f1bd6);},'comment':_0xb89d('0x4')},'fullname':{'type':Sequelize[_0xb89d('0x5')],'allowNull':![],'set':function(_0x5e2784){this[_0xb89d('0x3')](_0xb89d('0x6'),_0x5e2784);this[_0xb89d('0x3')](_0xb89d('0x7'),util['format'](_0xb89d('0x8'),_0x5e2784,this[_0xb89d('0x9')](_0xb89d('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb89d('0xb'),'validate':{'isEmail':!![]},'set':function(_0x63d03f){if(_0x63d03f){this[_0xb89d('0x3')](_0xb89d('0xb'),_0x63d03f['toLowerCase']());}}},'role':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0xd'),_0xb89d('0xe'),_0xb89d('0xf'),_0xb89d('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':_0xb89d('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x1d2b08){this[_0xb89d('0x3')](_0xb89d('0xa'),_0x1d2b08);this[_0xb89d('0x3')](_0xb89d('0x12'),_0x1d2b08);this['setDataValue'](_0xb89d('0x7'),util[_0xb89d('0x13')]('\x22%s\x22\x20<%s>',this[_0xb89d('0x9')](_0xb89d('0x6')),_0x1d2b08));}},'salt':{'type':Sequelize[_0xb89d('0x5')]},'phone':{'type':Sequelize[_0xb89d('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xb89d('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb89d('0x5')]},'city':{'type':Sequelize[_0xb89d('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb89d('0x14')]},'voicePause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':_0xb89d('0x16')},'lastPauseAt':{'type':Sequelize[_0xb89d('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb89d('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x18'),_0xb89d('0xe'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':_0xb89d('0x19')},'callingpres':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x1a'),'ALLOWED_PASSED_SCREEN',_0xb89d('0x1b'),'ALLOWED','PROHIB_NOT_SCREENED',_0xb89d('0x1c'),_0xb89d('0x1d'),_0xb89d('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':_0xb89d('0x1f'),'set':function(_0x3e00bf){this['setDataValue']('transport',_0x3e00bf?_0x3e00bf[_0xb89d('0x20')](','):null);},'get':function(){return this[_0xb89d('0x9')](_0xb89d('0x21'))?this[_0xb89d('0x9')]('transport')[_0xb89d('0x22')](','):null;},'comment':_0xb89d('0x23')},'dtmfmode':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x24'),'info',_0xb89d('0x25'),_0xb89d('0x26'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no',_0xb89d('0x28'),_0xb89d('0x29'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x176e99){this[_0xb89d('0x3')](_0xb89d('0x2a'),_0x176e99?_0x176e99['join'](','):null);},'get':function(){return this[_0xb89d('0x9')]('nat')?this[_0xb89d('0x9')]('nat')[_0xb89d('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb89d('0x5')]},'namedcallgroup':{'type':Sequelize[_0xb89d('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb89d('0x5')]},'language':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xb89d('0x5')],'allowNull':![],'defaultValue':_0xb89d('0x2b')},'allow':{'type':Sequelize[_0xb89d('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xc66383){this[_0xb89d('0x3')](_0xb89d('0x2c'),_0xc66383?_0xc66383[_0xb89d('0x20')](';'):_0xb89d('0x2d'));},'get':function(){return this['getDataValue']('allow')?this[_0xb89d('0x9')](_0xb89d('0x2c'))[_0xb89d('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'set':function(_0x3e7e2f){this['setDataValue'](_0xb89d('0x2e'),_0x3e7e2f?_0x3e7e2f['join'](','):null);},'get':function(){return this[_0xb89d('0x9')](_0xb89d('0x2e'))?this[_0xb89d('0x9')](_0xb89d('0x2e'))['split'](','):null;},'comment':_0xb89d('0x2f')},'trustrpid':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':_0xb89d('0x27')},'busylevel':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no',_0xb89d('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x31'),_0xb89d('0x32'),_0xb89d('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xb89d('0x34')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':_0xb89d('0x27')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no',_0xb89d('0x35'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb89d('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xb89d('0x36'),_0xb89d('0x37')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb89d('0xc')](_0xb89d('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xb89d('0x27'),'no',_0xb89d('0x28'),_0xb89d('0x29'),_0xb89d('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb89d('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb89d('0x39')]},'showWebBar':{'type':Sequelize[_0xb89d('0x17')],'defaultValue':0x0,'set':function(_0x87d781){this['setDataValue'](_0xb89d('0x3a'),_0x87d781);var _0x5c28d6=this[_0xb89d('0x3b')]({'plain':!![]});switch(_0x87d781){case 0x0:case 0x1:var _0x239c4c=_0x5c28d6[_0xb89d('0x21')]?_[_0xb89d('0x3c')](_0x5c28d6['transport'])?_0x5c28d6[_0xb89d('0x21')][_0xb89d('0x20')]():_0x5c28d6[_0xb89d('0x21')]:'udp';if(_0x239c4c===_0xb89d('0x3d')){_0x239c4c='udp';}this['setDataValue']('transport',_0x239c4c);this['setDataValue'](_0xb89d('0x3e'),'no');this[_0xb89d('0x3')](_0xb89d('0x3f'),null);this[_0xb89d('0x3')](_0xb89d('0x40'),null);this[_0xb89d('0x3')](_0xb89d('0x41'),null);this['setDataValue'](_0xb89d('0x42'),null);this[_0xb89d('0x3')]('dtlsverify',null);this[_0xb89d('0x3')]('dtlssetup',null);this[_0xb89d('0x3')]('dtlscertfile',null);this['setDataValue'](_0xb89d('0x43'),null);this[_0xb89d('0x3')]('rtcp_mux','no');break;case 0x2:this['setDataValue']('transport',_0xb89d('0x3d'));this[_0xb89d('0x3')](_0xb89d('0x3e'),'yes');this[_0xb89d('0x3')](_0xb89d('0x3f'),_0xb89d('0x27'));this['setDataValue'](_0xb89d('0x40'),_0xb89d('0x27'));this[_0xb89d('0x3')](_0xb89d('0x41'),_0xb89d('0x27'));this['setDataValue']('dtlsenable','yes');this['setDataValue'](_0xb89d('0x44'),'no');this[_0xb89d('0x3')](_0xb89d('0x45'),'actpass');this[_0xb89d('0x3')]('dtlscertfile',_0x5c28d6[_0xb89d('0x46')]||_0xb89d('0x47'));this['setDataValue']('dtlsprivatekey',_0x5c28d6[_0xb89d('0x43')]||'/etc/pki/tls/private/motion.key');this[_0xb89d('0x3')]('rtcp_mux',_0xb89d('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0xb89d('0x39')],'set':function(_0xe3e7f7){this[_0xb89d('0x3')](_0xb89d('0x48'),_0xe3e7f7?_0xe3e7f7[_0xb89d('0x20')](','):[]);},'get':function(){return this[_0xb89d('0x9')]('permissions')?_[_0xb89d('0x49')](this[_0xb89d('0x9')]('permissions')[_0xb89d('0x22')](','),function(_0x286550){return parseInt(_0x286550,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb89d('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb89d('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb89d('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb89d('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb89d('0x4a')],'get':function(){return this[_0xb89d('0x9')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb89d('0x9')](_0xb89d('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb89d('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb89d('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![],'set':function(_0x5ed535){if(typeof _0x5ed535==='string'){var _0x2b92b7=_0x5ed535==='1'?!![]:_0x5ed535==='0'?![]:_0x5ed535===_0xb89d('0x4c')?!![]:_0x5ed535===_0xb89d('0x4d')?![]:![];this[_0xb89d('0x3')]('screenrecording',_0x2b92b7);}else{this[_0xb89d('0x3')](_0xb89d('0x4e'),_0x5ed535);}}},'blocked':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![],'set':function(_0x2ec583){this[_0xb89d('0x3')](_0xb89d('0x4f'),_0x2ec583);if(_0x2ec583===!![]){this['setDataValue'](_0xb89d('0x50'),moment());this[_0xb89d('0x3')](_0xb89d('0x51'),0x0);}else{this[_0xb89d('0x3')](_0xb89d('0x50'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb89d('0x17')](0x5)[_0xb89d('0x52')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb89d('0x15')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc1bc=['name','setDataValue','The\x20name\x20of\x20the\x20user','format','getDataValue','email','toLowerCase','user','agent','telephone','INTEGER','internal','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','nonat','update','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','actpass','update,nonat','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','force_avp','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','STRING'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xc1bc,0x173));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xcc1b('0x0'));var moment=require(_0xcc1b('0x1'));var util=require('util');var _=require(_0xcc1b('0x2'));module[_0xcc1b('0x3')]={'name':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':![],'unique':_0xcc1b('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1b57ef){this[_0xcc1b('0x6')](_0xcc1b('0x5'),_0x1b57ef);this[_0xcc1b('0x6')]('defaultuser',_0x1b57ef);},'comment':_0xcc1b('0x7')},'fullname':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':![],'set':function(_0x172878){this['setDataValue']('fullname',_0x172878);this[_0xcc1b('0x6')]('callerid',util[_0xcc1b('0x8')]('\x22%s\x22\x20<%s>',_0x172878,this[_0xcc1b('0x9')]('internal')));}},'alias':{'type':Sequelize[_0xcc1b('0x4')]},'email':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':![],'unique':_0xcc1b('0xa'),'validate':{'isEmail':!![]},'set':function(_0x1999c8){if(_0x1999c8){this['setDataValue'](_0xcc1b('0xa'),_0x1999c8[_0xcc1b('0xb')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0xcc1b('0xc'),_0xcc1b('0xd'),_0xcc1b('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xcc1b('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':![],'unique':'internal','set':function(_0x43ecd4){this['setDataValue'](_0xcc1b('0x10'),_0x43ecd4);this[_0xcc1b('0x6')]('accountcode',_0x43ecd4);this[_0xcc1b('0x6')](_0xcc1b('0x11'),util['format'](_0xcc1b('0x12'),this[_0xcc1b('0x9')]('fullname'),_0x43ecd4));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xcc1b('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xcc1b('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xcc1b('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xcc1b('0x4')]},'online':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xcc1b('0x14')},'lastPauseAt':{'type':Sequelize[_0xcc1b('0x15')]},'chatCapacity':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xcc1b('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xcc1b('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![],'defaultValue':_0xcc1b('0x16')},'ipaddr':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcc1b('0x17')]('friend','user',_0xcc1b('0x18')),'allowNull':!![],'defaultValue':_0xcc1b('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcc1b('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0xcc1b('0x1b'),_0xcc1b('0x1c'),_0xcc1b('0x1d'),_0xcc1b('0x1e'),_0xcc1b('0x1f'),_0xcc1b('0x20'),_0xcc1b('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcc1b('0x22'),'set':function(_0x3a030c){this[_0xcc1b('0x6')](_0xcc1b('0x23'),_0x3a030c?_0x3a030c['join'](','):null);},'get':function(){return this[_0xcc1b('0x9')](_0xcc1b('0x23'))?this[_0xcc1b('0x9')](_0xcc1b('0x23'))[_0xcc1b('0x24')](','):null;},'comment':_0xcc1b('0x25')},'dtmfmode':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x26'),_0xcc1b('0x27'),_0xcc1b('0x28'),_0xcc1b('0x29'),'auto'),'allowNull':!![],'defaultValue':_0xcc1b('0x26')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xcc1b('0x2a'),_0xcc1b('0x2b'),_0xcc1b('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4cbb21){this['setDataValue'](_0xcc1b('0x2e'),_0x4cbb21?_0x4cbb21['join'](','):null);},'get':function(){return this['getDataValue'](_0xcc1b('0x2e'))?this[_0xcc1b('0x9')](_0xcc1b('0x2e'))['split'](','):null;},'comment':_0xcc1b('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xcc1b('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xcc1b('0x4')]},'language':{'type':Sequelize[_0xcc1b('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcc1b('0x4')]},'disallow':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':![],'defaultValue':_0xcc1b('0x30')},'allow':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':![],'defaultValue':_0xcc1b('0x31'),'set':function(_0x25572b){this['setDataValue'](_0xcc1b('0x32'),_0x25572b?_0x25572b[_0xcc1b('0x33')](';'):_0xcc1b('0x31'));},'get':function(){return this[_0xcc1b('0x9')](_0xcc1b('0x32'))?this[_0xcc1b('0x9')](_0xcc1b('0x32'))[_0xcc1b('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![],'set':function(_0x476c85){this[_0xcc1b('0x6')](_0xcc1b('0x34'),_0x476c85?_0x476c85['join'](','):null);},'get':function(){return this[_0xcc1b('0x9')](_0xcc1b('0x34'))?this[_0xcc1b('0x9')]('insecure')[_0xcc1b('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no',_0xcc1b('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![],'defaultValue':_0xcc1b('0x36')},'amaflags':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xcc1b('0x2d')},'busylevel':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xcc1b('0x17')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no',_0xcc1b('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x38'),_0xcc1b('0x39'),_0xcc1b('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x3b'),_0xcc1b('0x3c')),'allowNull':!![],'defaultValue':_0xcc1b('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xcc1b('0x17')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xcc1b('0x17')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xcc1b('0x17')]('yes','no',_0xcc1b('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xcc1b('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xcc1b('0x3e'),'passive',_0xcc1b('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xcc1b('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xcc1b('0x17')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no','nonat',_0xcc1b('0x2b'),_0xcc1b('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xcc1b('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xcc1b('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0,'set':function(_0x38c8fb){this[_0xcc1b('0x6')](_0xcc1b('0x41'),_0x38c8fb);var _0x530a6e=this[_0xcc1b('0x42')]({'plain':!![]});switch(_0x38c8fb){case 0x0:case 0x1:var _0x1af9ac=_0x530a6e['transport']?_[_0xcc1b('0x43')](_0x530a6e[_0xcc1b('0x23')])?_0x530a6e[_0xcc1b('0x23')][_0xcc1b('0x33')]():_0x530a6e[_0xcc1b('0x23')]:'udp';if(_0x1af9ac==='wss'){_0x1af9ac='udp';}this[_0xcc1b('0x6')]('transport',_0x1af9ac);this[_0xcc1b('0x6')](_0xcc1b('0x44'),'no');this[_0xcc1b('0x6')](_0xcc1b('0x45'),null);this[_0xcc1b('0x6')]('force_avp',null);this['setDataValue'](_0xcc1b('0x46'),null);this[_0xcc1b('0x6')](_0xcc1b('0x47'),null);this[_0xcc1b('0x6')](_0xcc1b('0x48'),null);this[_0xcc1b('0x6')](_0xcc1b('0x49'),null);this[_0xcc1b('0x6')](_0xcc1b('0x4a'),null);this[_0xcc1b('0x6')](_0xcc1b('0x4b'),null);this[_0xcc1b('0x6')](_0xcc1b('0x4c'),'no');break;case 0x2:this['setDataValue'](_0xcc1b('0x23'),_0xcc1b('0x4d'));this[_0xcc1b('0x6')](_0xcc1b('0x44'),_0xcc1b('0x2d'));this[_0xcc1b('0x6')](_0xcc1b('0x45'),_0xcc1b('0x2d'));this[_0xcc1b('0x6')](_0xcc1b('0x4e'),_0xcc1b('0x2d'));this[_0xcc1b('0x6')]('icesupport','yes');this['setDataValue'](_0xcc1b('0x47'),_0xcc1b('0x2d'));this[_0xcc1b('0x6')]('dtlsverify','no');this[_0xcc1b('0x6')](_0xcc1b('0x49'),_0xcc1b('0x3f'));this[_0xcc1b('0x6')](_0xcc1b('0x4a'),_0x530a6e[_0xcc1b('0x4a')]||_0xcc1b('0x4f'));this[_0xcc1b('0x6')](_0xcc1b('0x4b'),_0x530a6e[_0xcc1b('0x4b')]||_0xcc1b('0x50'));this[_0xcc1b('0x6')](_0xcc1b('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xcc1b('0x51')],'set':function(_0x2eeb4f){this['setDataValue']('permissions',_0x2eeb4f?_0x2eeb4f['join'](','):[]);},'get':function(){return this[_0xcc1b('0x9')](_0xcc1b('0x52'))?_[_0xcc1b('0x53')](this[_0xcc1b('0x9')](_0xcc1b('0x52'))[_0xcc1b('0x24')](','),function(_0x28e0da){return parseInt(_0x28e0da,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcc1b('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xcc1b('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xcc1b('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xcc1b('0x17')](_0xcc1b('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xcc1b('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xcc1b('0x54')],'get':function(){return this[_0xcc1b('0x9')](_0xcc1b('0x55'))?this['getDataValue'](_0xcc1b('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xcc1b('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xcc1b('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![],'set':function(_0x38b025){if(typeof _0x38b025===_0xcc1b('0x56')){var _0x37943e=_0x38b025==='1'?!![]:_0x38b025==='0'?![]:_0x38b025===_0xcc1b('0x57')?!![]:_0x38b025===_0xcc1b('0x58')?![]:![];this[_0xcc1b('0x6')](_0xcc1b('0x59'),_0x37943e);}else{this[_0xcc1b('0x6')](_0xcc1b('0x59'),_0x38b025);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x279e76){this[_0xcc1b('0x6')](_0xcc1b('0x5a'),_0x279e76);if(_0x279e76===!![]){this['setDataValue']('blockedAt',moment());this['setDataValue'](_0xcc1b('0x5b'),0x0);}else{this[_0xcc1b('0x6')](_0xcc1b('0x5c'),null);}}},'blockedAt':{'type':Sequelize[_0xcc1b('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xcc1b('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xcc1b('0xf')](0x5)[_0xcc1b('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcc1b('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 09923cb..6015ddf 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ab8=['flatten','transaction','getDataValue','removeTeams','Sms','Fax','removeAgent','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','retrieveApiKey','json','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','ringing','voiceStatus','busy','slice','toUpperCase','QueryTypes','select','field','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./user.socket','jayson/promise','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Users','user','agent','telephone','filter','map','value','includes','find','UserProfileResource','stack','name','render','merge','body','account','index','User','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','sequelize','col','lower','options','include','push','findAll','true','length','chat','rows','sms','dataValues','fax','openchannel','whatsapp','show','params','includeAll','openTabs','mail','role','describe','addContacts','ids','omit','internal','Setting','securePassword','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','VoiceMail','email','permissions','101','102','103','113','110','104','105','106','107','109','100','111','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','checkUserLimits','settingsEnabled','UserProfileSection','Telephones','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','Agents','userProfileId','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','each','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','existsSync','download','join','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','findOne','CmContact','pick','CmList','List','Tag','color','tag','Queue','Unknown\x20role','getVoiceQueuesRt','order','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','mailPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','Pause','manual','getTeams','Team','getVoiceQueues','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel'];(function(_0x53968e,_0x107ff8){var _0x839590=function(_0xd5e7f8){while(--_0xd5e7f8){_0x53968e['push'](_0x53968e['shift']());}};_0x839590(++_0x107ff8);}(_0x9ab8,0x81));var _0x89ab=function(_0x2bc101,_0x2c9e39){_0x2bc101=_0x2bc101-0x0;var _0x2b55c4=_0x9ab8[_0x2bc101];return _0x2b55c4;};'use strict';var emlformat=require(_0x89ab('0x0'));var rimraf=require(_0x89ab('0x1'));var zipdir=require(_0x89ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x89ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89ab('0x4'));var util=require(_0x89ab('0x5'));var path=require('path');var sox=require(_0x89ab('0x6'));var csv=require(_0x89ab('0x7'));var ejs=require(_0x89ab('0x8'));var fs=require('fs');var fs_extra=require(_0x89ab('0x9'));var _=require(_0x89ab('0xa'));var squel=require(_0x89ab('0xb'));var crypto=require(_0x89ab('0xc'));var jsforce=require(_0x89ab('0xd'));var deskjs=require(_0x89ab('0xe'));var toCsv=require(_0x89ab('0x7'));var querystring=require(_0x89ab('0xf'));var Papa=require(_0x89ab('0x10'));var Redis=require('ioredis');var values;var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x89ab('0x11'))(_0x89ab('0x12'));var utils=require(_0x89ab('0x13'));var config=require(_0x89ab('0x14'));var licenseUtil=require(_0x89ab('0x15'));var db=require(_0x89ab('0x16'))['db'];config[_0x89ab('0x17')]=_['defaults'](config[_0x89ab('0x17')],{'host':_0x89ab('0x18'),'port':0x18eb});var socket=require(_0x89ab('0x19'))(new Redis(config[_0x89ab('0x17')]));require(_0x89ab('0x1a'))['register'](socket);var jayson=require(_0x89ab('0x1b'));var client=jayson[_0x89ab('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x585cf8,_0x5d70d9,_0x57037f,_0x4fd002){return new BPromise(function(_0x49a104,_0x24d866){var _0x1ce918=_0x4fd002||client;return _0x1ce918[_0x89ab('0x1d')](_0x585cf8,_0x57037f)[_0x89ab('0x1e')](function(_0x3ae7ae){logger[_0x89ab('0x1f')](_0x89ab('0x20'),_0x5d70d9,_0x89ab('0x21'));logger[_0x89ab('0x22')]('User,\x20%s,\x20%s,\x20%s',_0x5d70d9,_0x89ab('0x21'),JSON[_0x89ab('0x23')](_0x3ae7ae));if(_0x3ae7ae['error']){if(_0x3ae7ae['error'][_0x89ab('0x24')]===0x1f4){logger[_0x89ab('0x25')]('User,\x20%s,\x20%s',_0x5d70d9,_0x3ae7ae[_0x89ab('0x25')][_0x89ab('0x26')]);return _0x24d866(_0x3ae7ae[_0x89ab('0x25')][_0x89ab('0x26')]);}logger[_0x89ab('0x25')](_0x89ab('0x20'),_0x5d70d9,_0x3ae7ae[_0x89ab('0x25')][_0x89ab('0x26')]);return _0x49a104(_0x3ae7ae[_0x89ab('0x25')][_0x89ab('0x26')]);}else{logger[_0x89ab('0x1f')](_0x89ab('0x20'),_0x5d70d9,_0x89ab('0x21'));_0x49a104(_0x3ae7ae[_0x89ab('0x27')][_0x89ab('0x26')]);}})[_0x89ab('0x28')](function(_0x4877f4){logger[_0x89ab('0x25')]('User,\x20%s,\x20%s',_0x5d70d9,_0x4877f4);_0x24d866(_0x4877f4);});});}function respondWithStatusCode(_0x13359b,_0x599422){_0x599422=_0x599422||0xcc;return function(_0x5b2c3d){if(_0x5b2c3d){return _0x13359b[_0x89ab('0x29')](_0x599422);}return _0x13359b['status'](_0x599422)['end']();};}function respondWithResult(_0x313d8,_0x3ff78a){_0x3ff78a=_0x3ff78a||0xc8;return function(_0x2b08a1){if(_0x2b08a1){return _0x313d8[_0x89ab('0x2a')](_0x3ff78a)['json'](_0x2b08a1);}};}function respondWithFilteredResult(_0x27e94b,_0x2535c7){return function(_0x1919ee){if(_0x1919ee){var _0xf8a71=typeof _0x2535c7['offset']===_0x89ab('0x2b')&&typeof _0x2535c7[_0x89ab('0x2c')]===_0x89ab('0x2b');var _0x211ca3=_0x1919ee[_0x89ab('0x2d')];var _0x645894=_0xf8a71?0x0:_0x2535c7[_0x89ab('0x2e')];var _0x34550c=_0xf8a71?_0x1919ee[_0x89ab('0x2d')]:_0x2535c7[_0x89ab('0x2e')]+_0x2535c7[_0x89ab('0x2c')];var _0x2d352b;if(_0x34550c>=_0x211ca3){_0x34550c=_0x211ca3;_0x2d352b=0xc8;}else{_0x2d352b=0xce;}_0x27e94b['status'](_0x2d352b);return _0x27e94b[_0x89ab('0x2f')](_0x89ab('0x30'),_0x645894+'-'+_0x34550c+'/'+_0x211ca3)['json'](_0x1919ee);}return null;};}function patchUpdates(_0x567f99){return function(_0x531bb7){try{jsonpatch[_0x89ab('0x31')](_0x531bb7,_0x567f99,!![]);}catch(_0x59df12){return BPromise[_0x89ab('0x32')](_0x59df12);}return _0x531bb7[_0x89ab('0x33')]();};}function saveUpdates(_0x15d32c,_0x373ba5){return function(_0x48c28b){if(_0x48c28b){return _0x48c28b[_0x89ab('0x34')](_0x15d32c)[_0x89ab('0x1e')](function(_0x5478fa){return _0x5478fa;});}return null;};}function removeEntity(_0x3f4a38,_0x16ce79){return function(_0x5624cb){if(_0x5624cb){return _0x5624cb[_0x89ab('0x35')]()[_0x89ab('0x1e')](function(){var _0x30ad35=_0x5624cb[_0x89ab('0x36')]({'plain':!![]});if(_0x30ad35['role']==='admin')return;var _0x3e3f65=[{'name':_0x89ab('0x37'),'value':_0x89ab('0x38'),'ignore':!![]},{'name':'Agents','value':_0x89ab('0x39'),'ignore':![]},{'name':'Telephones','value':_0x89ab('0x3a'),'ignore':![]}];var _0xfe089d=_(_0x3e3f65)[_0x89ab('0x3b')]('ignore')[_0x89ab('0x3c')](_0x89ab('0x3d'))[_0x89ab('0x3d')]();if(_[_0x89ab('0x3e')](_0xfe089d,_0x30ad35['role'])){return;}var _0x32ff16=_[_0x89ab('0x3f')](_0x3e3f65,[_0x89ab('0x3d'),_0x30ad35['role']])['name'];return db[_0x89ab('0x40')]['destroy']({'where':{'type':_0x32ff16,'resourceId':_0x30ad35['id']}})[_0x89ab('0x1e')](function(){return _0x5624cb;});})[_0x89ab('0x1e')](function(){_0x3f4a38[_0x89ab('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc98d,_0x4c0498){return function(_0x5d7adf){if(!_0x5d7adf){_0x2fc98d[_0x89ab('0x29')](0x194);}return _0x5d7adf;};}function handleError(_0xadfb9f,_0x863031){_0x863031=_0x863031||0x1f4;return function(_0x3ee5c8){logger[_0x89ab('0x25')](_0x3ee5c8[_0x89ab('0x41')]);if(_0x3ee5c8[_0x89ab('0x42')]){delete _0x3ee5c8[_0x89ab('0x42')];}_0xadfb9f['status'](_0x863031)['send'](_0x3ee5c8);};}function getMustacheRender(_0x17c4d1,_0x387102){return Mustache[_0x89ab('0x43')](_0x17c4d1,_[_0x89ab('0x44')](_0x387102[_0x89ab('0x45')],{'contact':_0x387102['contact'],'message':_0x387102[_0x89ab('0x26')],'agent':_0x387102[_0x89ab('0x39')],'interaction':_0x387102['interaction'],'account':_0x387102[_0x89ab('0x46')]}))||'';}exports[_0x89ab('0x47')]=function(_0x15b0c2,_0x45fac9){var _0x1ea611={},_0x51be1a={},_0x1fe126={'count':0x0,'rows':[]};var _0x479998=_[_0x89ab('0x3c')](db[_0x89ab('0x48')][_0x89ab('0x49')],function(_0x7bdf0b){return{'name':_0x7bdf0b[_0x89ab('0x4a')],'type':_0x7bdf0b[_0x89ab('0x4b')][_0x89ab('0x4c')]};});_0x51be1a[_0x89ab('0x4d')]=_[_0x89ab('0x4e')](_[_0x89ab('0x3c')](_0x479998,_0x89ab('0x42')),[_0x89ab('0x4f'),_0x89ab('0x50')]);_0x51be1a[_0x89ab('0x51')]=_[_0x89ab('0x52')](_0x15b0c2[_0x89ab('0x51')]);_0x51be1a[_0x89ab('0x53')]=_[_0x89ab('0x54')](_0x51be1a[_0x89ab('0x4d')],_0x51be1a['query']);_0x1ea611[_0x89ab('0x55')]=_[_0x89ab('0x54')](_0x51be1a[_0x89ab('0x4d')],qs[_0x89ab('0x56')](_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x56')]));_0x1ea611[_0x89ab('0x55')]=_0x1ea611[_0x89ab('0x55')]['length']?_0x1ea611[_0x89ab('0x55')]:_0x51be1a[_0x89ab('0x4d')];if(!_0x15b0c2['query'][_0x89ab('0x57')](_0x89ab('0x58'))){_0x1ea611[_0x89ab('0x2c')]=qs[_0x89ab('0x2c')](_0x15b0c2['query']['limit']);_0x1ea611[_0x89ab('0x2e')]=qs[_0x89ab('0x2e')](_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x2e')]);}_0x1ea611['order']=qs[_0x89ab('0x59')](_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x59')]);_0x1ea611[_0x89ab('0x5a')]=qs['filters'](_['pick'](_0x15b0c2[_0x89ab('0x51')],_0x51be1a[_0x89ab('0x53')]),_0x479998);if(_0x15b0c2[_0x89ab('0x51')][_0x89ab('0x3b')]){_0x1ea611[_0x89ab('0x5a')]=_['merge'](_0x1ea611[_0x89ab('0x5a')],{'$or':_[_0x89ab('0x3c')](_0x479998,function(_0x5cd49a){if(_0x5cd49a[_0x89ab('0x4b')]!==_0x89ab('0x5b')){return db[_0x89ab('0x5c')][_0x89ab('0x5a')](db[_0x89ab('0x5c')]['fn']('lower',db[_0x89ab('0x5c')][_0x89ab('0x5d')](_0x5cd49a[_0x89ab('0x42')])),{'$like':db['sequelize']['fn'](_0x89ab('0x5e'),'%'+_0x15b0c2['query'][_0x89ab('0x3b')]+'%')});}})});}_0x1ea611=_[_0x89ab('0x44')]({},_0x1ea611,_0x15b0c2[_0x89ab('0x5f')]);var _0x4116d8={'where':_0x1ea611[_0x89ab('0x5a')]};return db[_0x89ab('0x48')]['count'](_0x4116d8)[_0x89ab('0x1e')](function(_0x9ae000){_0x1fe126['count']=_0x9ae000;if(_0x15b0c2[_0x89ab('0x51')]['includeAll']){_0x1ea611[_0x89ab('0x60')]=[{'all':!![]}];}if(!_[_0x89ab('0x3e')](_0x1ea611[_0x89ab('0x55')],'id')){_0x1ea611[_0x89ab('0x55')][_0x89ab('0x61')]('id');}return db[_0x89ab('0x48')][_0x89ab('0x62')](_0x1ea611);})['then'](function(_0x4e6573){_0x1fe126['rows']=_0x4e6573;if(_0x15b0c2[_0x89ab('0x51')]['openTabs']===_0x89ab('0x63')){var _0x33ce21=[];for(var _0x4b0e48=0x0;_0x4b0e48<_0x1fe126['rows'][_0x89ab('0x64')];_0x4b0e48++){_0x33ce21['push'](get_open_tabs(_0x89ab('0x65'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48]['dataValues']));_0x33ce21[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x67'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21['push'](get_open_tabs(_0x89ab('0x69'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21[_0x89ab('0x61')](get_open_tabs('mail',_0x1fe126['rows'][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21['push'](get_open_tabs(_0x89ab('0x6a'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48][_0x89ab('0x68')]));_0x33ce21[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x6b'),_0x1fe126[_0x89ab('0x66')][_0x4b0e48]['dataValues']));}return BPromise['all'](_0x33ce21)['then'](function(_0x3b0baa){return _0x1fe126;});}else{return _0x1fe126;}})[_0x89ab('0x1e')](respondWithFilteredResult(_0x45fac9,_0x1ea611))[_0x89ab('0x28')](handleError(_0x45fac9,null));};exports[_0x89ab('0x6c')]=function(_0x152cb6,_0x1199bb){var _0x4c7719={'raw':![],'where':{'id':_0x152cb6[_0x89ab('0x6d')]['id']}},_0x4697c3={};_0x4697c3[_0x89ab('0x4d')]=_['differenceBy'](_['keys'](db[_0x89ab('0x48')][_0x89ab('0x49')]),[_0x89ab('0x4f'),_0x89ab('0x50')]);_0x4697c3[_0x89ab('0x51')]=_[_0x89ab('0x52')](_0x152cb6[_0x89ab('0x51')]);_0x4697c3[_0x89ab('0x53')]=_[_0x89ab('0x54')](_0x4697c3[_0x89ab('0x4d')],_0x4697c3['query']);_0x4c7719[_0x89ab('0x55')]=_[_0x89ab('0x54')](_0x4697c3[_0x89ab('0x4d')],qs['fields'](_0x152cb6[_0x89ab('0x51')]['fields']));_0x4c7719[_0x89ab('0x55')]=_0x4c7719[_0x89ab('0x55')][_0x89ab('0x64')]?_0x4c7719['attributes']:_0x4697c3[_0x89ab('0x4d')];if(_0x152cb6[_0x89ab('0x51')][_0x89ab('0x6e')]){_0x4c7719[_0x89ab('0x60')]=[{'all':!![]}];}_0x4c7719=_[_0x89ab('0x44')]({},_0x4c7719,_0x152cb6[_0x89ab('0x5f')]);if(!_[_0x89ab('0x3e')](_0x4c7719[_0x89ab('0x55')],'id')){_0x4c7719[_0x89ab('0x55')]['push']('id');}return db[_0x89ab('0x48')]['find'](_0x4c7719)[_0x89ab('0x1e')](handleEntityNotFound(_0x1199bb,null))[_0x89ab('0x1e')](function(_0x537f34){var _0x277b57=[];values=_0x537f34;if(_0x152cb6[_0x89ab('0x51')][_0x89ab('0x6f')]===_0x89ab('0x63')){_0x277b57['push'](get_open_tabs('chat',_0x537f34[_0x89ab('0x68')]));_0x277b57[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x67'),_0x537f34[_0x89ab('0x68')]));_0x277b57['push'](get_open_tabs(_0x89ab('0x6a'),_0x537f34[_0x89ab('0x68')]));_0x277b57['push'](get_open_tabs(_0x89ab('0x6b'),_0x537f34[_0x89ab('0x68')]));_0x277b57['push'](get_open_tabs(_0x89ab('0x69'),_0x537f34[_0x89ab('0x68')]));_0x277b57[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x70'),_0x537f34[_0x89ab('0x68')]));return BPromise['all'](_0x277b57);}else{return values;}})[_0x89ab('0x1e')](function(_0x621cdb){return values;})[_0x89ab('0x1e')](respondWithResult(_0x1199bb,null))['catch'](handleError(_0x1199bb,null));};exports[_0x89ab('0x34')]=function(_0x158b87,_0x12f0d0){if(_0x158b87[_0x89ab('0x45')]['id']){delete _0x158b87[_0x89ab('0x45')]['id'];}delete _0x158b87[_0x89ab('0x45')][_0x89ab('0x71')];return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x158b87[_0x89ab('0x6d')]['id']}})[_0x89ab('0x1e')](handleEntityNotFound(_0x12f0d0,null))['then'](saveUpdates(_0x158b87[_0x89ab('0x45')],null))['then'](respondWithResult(_0x12f0d0,null))[_0x89ab('0x28')](handleError(_0x12f0d0,null));};exports[_0x89ab('0x72')]=function(_0x427c55,_0x5ec81a){return db['User'][_0x89ab('0x72')]()[_0x89ab('0x1e')](respondWithResult(_0x5ec81a,null))[_0x89ab('0x28')](handleError(_0x5ec81a,null));};exports[_0x89ab('0x73')]=function(_0x6f92b7,_0x184a85,_0x401fc5){return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x6f92b7[_0x89ab('0x6d')]['id']}})[_0x89ab('0x1e')](handleEntityNotFound(_0x184a85,null))[_0x89ab('0x1e')](function(_0x40ce15){if(_0x40ce15){return _0x40ce15[_0x89ab('0x73')](_0x6f92b7['body'][_0x89ab('0x74')],_[_0x89ab('0x75')](_0x6f92b7[_0x89ab('0x45')],[_0x89ab('0x74'),'id'])||{});}})[_0x89ab('0x1e')](respondWithResult(_0x184a85,null))['catch'](handleError(_0x184a85,null));};function validateUser(_0x5e4c36){return new BPromise(function(_0x253c6e,_0x495845){if(_0x5e4c36[_0x89ab('0x76')])return _0x253c6e(_0x5e4c36);return db[_0x89ab('0x77')]['findById'](0x1)[_0x89ab('0x1e')](function(_0x75e0de){if(_0x75e0de[_0x89ab('0x78')])authService['validatePasswordPattern'](_0x5e4c36[_0x89ab('0x4f')]);db[_0x89ab('0x48')][_0x89ab('0x79')](_0x89ab('0x76'))[_0x89ab('0x1e')](function(_0x46e1c9){if(_[_0x89ab('0x7a')](_0x46e1c9)){_0x5e4c36[_0x89ab('0x76')]=_0x75e0de[_0x89ab('0x7b')]||0x1;return;}if(_[_0x89ab('0x7a')](_0x75e0de[_0x89ab('0x7b')])||_0x75e0de[_0x89ab('0x7b')]===_0x46e1c9){_0x5e4c36[_0x89ab('0x76')]=_0x46e1c9+0x1;return;}if(_0x75e0de[_0x89ab('0x7b')]>_0x46e1c9){_0x5e4c36[_0x89ab('0x76')]=_0x75e0de[_0x89ab('0x7b')];return;}return db['sequelize'][_0x89ab('0x51')](_0x89ab('0x7c'),{'type':db['sequelize']['QueryTypes'][_0x89ab('0x7d')]})[_0x89ab('0x1e')](function(_0x42ca46){if(_0x42ca46&&_0x42ca46[_0x89ab('0x64')]){for(var _0x21d855=0x0,_0x37e7cb=_0x42ca46[_0x89ab('0x64')];_0x21d855<_0x37e7cb&&_[_0x89ab('0x7a')](_0x5e4c36[_0x89ab('0x76')]);_0x21d855++){if(_0x75e0de['min_internal']<=_0x42ca46[_0x21d855][_0x89ab('0x7e')]){_0x5e4c36[_0x89ab('0x76')]=_0x42ca46[_0x21d855][_0x89ab('0x7e')];}else if(_0x75e0de[_0x89ab('0x7b')]>_0x42ca46[_0x21d855][_0x89ab('0x7e')]&&_0x75e0de['min_internal']<=_0x42ca46[_0x21d855]['to']){_0x5e4c36[_0x89ab('0x76')]=_0x75e0de[_0x89ab('0x7b')];}}}if(_[_0x89ab('0x7a')](_0x5e4c36['internal'])){_0x5e4c36[_0x89ab('0x76')]=_0x46e1c9+0x1;}return _0x253c6e(_0x5e4c36);});});})[_0x89ab('0x28')](function(_0x62c920){_0x495845(_0x62c920);});});}function updateUser(_0x948e19){return new BPromise(function(_0x3b7b12,_0x1ebb2f){try{if(_0x948e19[_0x89ab('0x7f')]){_0x948e19['mailbox']=_0x948e19[_0x89ab('0x76')];_0x948e19[_0x89ab('0x80')]={'mailbox':_0x948e19[_0x89ab('0x76')],'password':_0x948e19[_0x89ab('0x4f')],'fullname':_0x948e19['fullname'],'email':_0x948e19[_0x89ab('0x81')]};}if(_0x948e19[_0x89ab('0x71')]===_0x89ab('0x39')){if(!_0x948e19[_0x89ab('0x82')])_0x948e19[_0x89ab('0x82')]=[_0x89ab('0x83'),_0x89ab('0x84'),_0x89ab('0x85'),_0x89ab('0x86'),_0x89ab('0x87'),_0x89ab('0x88'),_0x89ab('0x89'),_0x89ab('0x8a'),_0x89ab('0x8b'),'108',_0x89ab('0x8c'),_0x89ab('0x8d'),_0x89ab('0x8e'),_0x89ab('0x8f'),'115'];}_0x3b7b12(_0x948e19);}catch(_0x5a70e6){_0x1ebb2f(_0x5a70e6);}});}exports[_0x89ab('0x90')]=function(_0x314303,_0x3973ad){if(_0x314303[_0x89ab('0x38')][_0x89ab('0x71')]===_0x89ab('0x39'))throw new Error(_0x89ab('0x91'));if(_0x314303['body'][_0x89ab('0x71')]===_0x89ab('0x38')&&_0x314303[_0x89ab('0x38')][_0x89ab('0x71')]!=='admin'){throw new Error(_0x89ab('0x92'));}if(_0x314303[_0x89ab('0x45')]['role']==='admin'&&_0x314303[_0x89ab('0x38')]['role']!==_0x89ab('0x93')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x89ab('0x94')]([_0x314303['body']])[_0x89ab('0x1e')](function(){return validateUser(_0x314303[_0x89ab('0x45')]);})[_0x89ab('0x1e')](function(_0x520ae5){return updateUser(_0x520ae5)['then'](function(_0x4e6aff){if(_0x4e6aff['role']===_0x89ab('0x93')){_0x4e6aff[_0x89ab('0x95')]=_0x314303[_0x89ab('0x38')]['settingsEnabled'];delete _0x4e6aff['userProfileId'];}return _0x4e6aff;});})[_0x89ab('0x1e')](function(_0x210c17){return db['User'][_0x89ab('0x90')](_0x210c17,{'include':[{'model':db[_0x89ab('0x80')],'as':_0x89ab('0x80')}]});})[_0x89ab('0x1e')](function(_0x19cf77){if(_0x314303[_0x89ab('0x45')][_0x89ab('0x71')]===_0x89ab('0x38'))return _0x19cf77;if(_0x314303['user'][_0x89ab('0x71')]!=='user')return _0x19cf77;return db[_0x89ab('0x96')]['find']({'where':{'name':_0x19cf77[_0x89ab('0x71')]===_0x89ab('0x39')?'Agents':_0x89ab('0x97'),'userProfileId':_0x314303[_0x89ab('0x38')]['userProfileId']},'raw':!![]})[_0x89ab('0x1e')](function(_0xa0553d){if(!_0xa0553d||_0xa0553d[_0x89ab('0x98')]!=0x0)return _0x19cf77;return db['UserProfileResource'][_0x89ab('0x90')]({'name':_0x19cf77['name'],'resourceId':_0x19cf77['id'],'type':_0xa0553d['name'],'sectionId':_0xa0553d['id']},{})[_0x89ab('0x1e')](function(){return _0x19cf77;});})['catch'](function(_0x4be14f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4be14f);throw _0x4be14f;});})[_0x89ab('0x1e')](respondWithResult(_0x3973ad,0xc9))[_0x89ab('0x28')](handleError(_0x3973ad,null));};exports[_0x89ab('0x99')]=function(_0x429143,_0x3e42da){var _0x3d6aba=_0x429143[_0x89ab('0x45')];var _0x6cb263=[];if(_0x429143['user'][_0x89ab('0x71')]===_0x89ab('0x39'))throw new Error(_0x89ab('0x91'));if(_[_0x89ab('0x9a')](_0x3d6aba,[_0x89ab('0x71'),_0x89ab('0x38')])&&_0x429143[_0x89ab('0x38')][_0x89ab('0x71')]!==_0x89ab('0x93')){throw new Error(_0x89ab('0x92'));}if(_['some'](_0x3d6aba,['role','admin'])&&_0x429143['user']['role']!=='admin'){throw new Error(_0x89ab('0x9b'));}return licenseUtil['checkUserLimits'](_0x3d6aba)[_0x89ab('0x1e')](function(){return validateUser(_0x3d6aba[0x0]);})[_0x89ab('0x1e')](function(){for(var _0x2e983b=0x1;_0x2e983b<_0x3d6aba[_0x89ab('0x64')];_0x2e983b++){var _0x176f8e=_0x3d6aba[_0x2e983b-0x1]['internal'];if(!_0x3d6aba[_0x2e983b][_0x89ab('0x76')])_0x3d6aba[_0x2e983b][_0x89ab('0x76')]=_0x176f8e+0x1;_0x6cb263['push'](validateUser(_0x3d6aba[_0x2e983b]));}return BPromise['all'](_0x6cb263);})['then'](function(){_0x6cb263=[];for(var _0x49969c=0x0;_0x49969c<_0x3d6aba[_0x89ab('0x64')];_0x49969c++){_0x6cb263[_0x89ab('0x61')](updateUser(_0x3d6aba[_0x49969c]));}return BPromise[_0x89ab('0x9c')](_0x6cb263);})[_0x89ab('0x1e')](function(){return BPromise['each'](_0x3d6aba,function(_0x525d50){return db['User']['create'](_0x525d50,{'include':[{'model':db[_0x89ab('0x80')],'as':_0x89ab('0x80')}]})['then'](function(_0x406a4e){_0x525d50['id']=_0x406a4e['id'];return _0x525d50;});});})[_0x89ab('0x1e')](function(_0x35afcb){if(_0x429143[_0x89ab('0x45')][_0x89ab('0x71')]===_0x89ab('0x38'))return _0x35afcb;if(_0x429143[_0x89ab('0x38')][_0x89ab('0x71')]!==_0x89ab('0x38'))return _0x35afcb;var _0x57a6d0=_[_0x89ab('0x9a')](_0x35afcb,function(_0x1307ec){return _0x1307ec['role']==='agent'||_0x1307ec[_0x89ab('0x71')]===_0x89ab('0x3a');});if(!_0x57a6d0)return _0x35afcb;return db[_0x89ab('0x96')]['findAll']({'where':{'name':{'$or':[_0x89ab('0x9d'),_0x89ab('0x97')]},'userProfileId':_0x429143[_0x89ab('0x38')][_0x89ab('0x9e')]},'raw':!![]})[_0x89ab('0x1e')](function(_0x14d593){if(_[_0x89ab('0x9f')](_0x14d593)||!_[_0x89ab('0x9a')](_0x14d593,[_0x89ab('0x98'),0x0]))return _0x35afcb;_0x6cb263=[];var _0x442564=_(_0x14d593)[_0x89ab('0x3c')](function(_0x239a7c){if(_0x239a7c[_0x89ab('0x98')]===0x1)return;return _0x239a7c[_0x89ab('0x42')]==='Agents'?'agent':_0x89ab('0x3a');})[_0x89ab('0xa0')]()['value']();for(var _0x3ac20b=0x0;_0x3ac20b<_0x35afcb['length'];_0x3ac20b++){if(!_[_0x89ab('0x3e')](_0x442564,_0x35afcb[_0x3ac20b][_0x89ab('0x71')]))return;var _0x495798=_0x35afcb[_0x3ac20b][_0x89ab('0x71')]===_0x89ab('0x39')?'Agents':_0x89ab('0x97');_0x6cb263[_0x89ab('0x61')](db['UserProfileResource'][_0x89ab('0x90')]({'name':_0x35afcb[_0x3ac20b][_0x89ab('0x42')],'resourceId':_0x35afcb[_0x3ac20b]['id'],'type':_0x495798,'sectionId':_[_0x89ab('0x3f')](_0x14d593,[_0x89ab('0x42'),_0x495798])['id']},{}));}return BPromise[_0x89ab('0x9c')](_0x6cb263);});})[_0x89ab('0x1e')](respondWithResult(_0x3e42da,0xc9))[_0x89ab('0x28')](handleError(_0x3e42da,null));};exports[_0x89ab('0xa1')]=function(_0x3a7379,_0x4fa4ed,_0xfff03f){if(_0x3a7379[_0x89ab('0x45')]['id']){delete _0x3a7379['body']['id'];}return db[_0x89ab('0x48')][_0x89ab('0x3f')]({'where':{'id':_0x3a7379[_0x89ab('0x6d')]['id']}})[_0x89ab('0x1e')](function(_0x23afd0){if(!_0x23afd0)return null;if(_0x23afd0['id']===_0x3a7379[_0x89ab('0x38')]['id']){if(!_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa2')]||!_0x3a7379['body'][_0x89ab('0xa3')]){throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0xa6'));}if(!_0x23afd0[_0x89ab('0xa7')](_0x3a7379['body'][_0x89ab('0xa2')])){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xa8'));}if(_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa2')]===_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa3')]){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xa9'));}}else if(_0x3a7379[_0x89ab('0x38')][_0x89ab('0x71')]==='admin'){if(!_0x3a7379['body'][_0x89ab('0xa3')]){throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0xaa'));}}else if(_0x3a7379['user'][_0x89ab('0x71')]===_0x89ab('0x38')){if(!_0x3a7379[_0x89ab('0x45')]['newPassword']){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xaa'));}if(_0x23afd0[_0x89ab('0x71')]!=='agent'){throw new db['Sequelize'][(_0x89ab('0xa5'))]('Unauthorized');}}else{throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0x91'));}return _0x23afd0;})[_0x89ab('0x1e')](handleEntityNotFound(_0x4fa4ed,null))[_0x89ab('0x1e')](function(_0x5bc383){return db[_0x89ab('0x77')]['findOne']({'attributes':['id',_0x89ab('0x78'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x89ab('0x1e')](function(_0x2b6eca){if(_0x2b6eca[_0x89ab('0x78')])authService[_0x89ab('0xab')](_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa3')]);if(!_0x2b6eca[_0x89ab('0xac')]||!_0x5bc383[_0x89ab('0xad')])return _0x5bc383;authService['validatePasswordHistory'](_0x3a7379['body'][_0x89ab('0xa3')],_0x5bc383['previousPasswords'],_0x2b6eca[_0x89ab('0xae')]);return _0x5bc383;})[_0x89ab('0x1e')](saveUpdates({'password':_0x3a7379[_0x89ab('0x45')]['newPassword'],'passwordResetAt':_0x3a7379[_0x89ab('0x38')]['id']==_0x3a7379[_0x89ab('0x6d')]['id']?moment():null,'previousPasswords':authService[_0x89ab('0xaf')](_0x3a7379[_0x89ab('0x45')][_0x89ab('0xa3')],_0x5bc383[_0x89ab('0xad')])},null));})['then'](respondWithResult(_0x4fa4ed,null))[_0x89ab('0x28')](handleError(_0x4fa4ed,null));};exports[_0x89ab('0xb0')]=function(_0x4307e1,_0x496272,_0x64b258){var _0x4e518e=_0x4307e1[_0x89ab('0x45')][_0x89ab('0xb1')];return db[_0x89ab('0x48')][_0x89ab('0x3f')]({'where':{'id':_0x4307e1[_0x89ab('0x6d')]['id']},'attributes':['id',_0x89ab('0x42'),'role',_0x89ab('0xb2'),_0x89ab('0xb3'),_0x89ab('0xb4'),_0x89ab('0xb5')]})[_0x89ab('0x1e')](handleEntityNotFound(_0x496272,null))[_0x89ab('0x1e')](function(_0x25cab6){if(_0x25cab6){if(!utils['isValidChannel'](_0x4e518e)){throw new db[(_0x89ab('0xa4'))][(_0x89ab('0xa5'))](_0x89ab('0xb6'));}return _0x25cab6[_0x89ab('0xb7')+_[_0x89ab('0xb8')](_0x4e518e[_0x89ab('0xb9')]())+_0x89ab('0xba')](_0x4307e1[_0x89ab('0x45')]['ids'],{'penalty':_0x4307e1['body'][_0x89ab('0xbb')]||0x0})[_0x89ab('0xbc')](function(_0x194fc5){for(var _0x3a22bb=0x0;_0x3a22bb<_0x4307e1[_0x89ab('0x45')][_0x89ab('0x74')]['length'];_0x3a22bb+=0x1){var _0x1a8ac5={'UserId':_0x4307e1['params']['id']};_0x1a8ac5[_[_0x89ab('0xb8')](_0x4e518e[_0x89ab('0xb9')]())+_0x89ab('0xbd')]=_0x4307e1[_0x89ab('0x45')]['ids'][_0x3a22bb];socket[_0x89ab('0xbe')]('user'+_['capitalize'](_0x4e518e[_0x89ab('0xb9')]())+_0x89ab('0xbf'),_0x1a8ac5);}return _0x194fc5;})[_0x89ab('0x1e')](function(){if(_0x4e518e===_0x89ab('0xc0')){return db[_0x89ab('0xc1')][_0x89ab('0x62')]({'where':{'id':_0x4307e1[_0x89ab('0x45')][_0x89ab('0x74')]||[]},'raw':!![],'attributes':['id',_0x89ab('0x42')]});}})[_0x89ab('0x1e')](function(_0x735cfe){var _0x27f4cb=_0x25cab6[_0x89ab('0x36')]({'plain':!![]});var _0x1fb591=[];if(_0x4e518e===_0x89ab('0xc0')&&_0x27f4cb[_0x89ab('0x71')]==='agent'&&_0x27f4cb[_0x89ab('0xb2')]){for(var _0x143ae2=0x0;_0x143ae2<_0x735cfe['length'];_0x143ae2+=0x1){_0x1fb591['push']({'membername':_0x27f4cb[_0x89ab('0x42')],'UserId':_0x27f4cb['id'],'queue_name':_0x735cfe[_0x143ae2][_0x89ab('0x42')],'VoiceQueueId':_0x735cfe[_0x143ae2]['id'],'interface':_[_0x89ab('0x7a')](_0x27f4cb['interface'])?util[_0x89ab('0xc2')](_0x89ab('0xc3'),_0x27f4cb[_0x89ab('0x42')]):_0x27f4cb[_0x89ab('0xb5')],'paused':_0x27f4cb[_0x89ab('0xb4')]||![],'penalty':_0x4307e1['body'][_0x89ab('0xbb')]||0x0});}return BPromise[_0x89ab('0xc4')](_0x1fb591,function(_0x43b37f){return db[_0x89ab('0xc5')][_0x89ab('0xc6')](_0x43b37f);});}return _0x25cab6;});}})[_0x89ab('0x1e')](respondWithStatusCode(_0x496272,null))[_0x89ab('0x28')](handleError(_0x496272,null));};exports[_0x89ab('0xc7')]=function(_0x16b270,_0x4f6d3f,_0x28fe22){var _0x568fe9;return db[_0x89ab('0x48')][_0x89ab('0x3f')]({'where':{'id':_0x16b270[_0x89ab('0x6d')]['id']},'attributes':['id',_0x89ab('0x42'),_0x89ab('0x71')]})['then'](handleEntityNotFound(_0x4f6d3f,null))['then'](function(_0xd5e65f){if(_0xd5e65f){_0x568fe9=_0xd5e65f;if(!_0x16b270[_0x89ab('0x51')]['channel']||!utils[_0x89ab('0xc8')](_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')])){throw new db['Sequelize'][(_0x89ab('0xa5'))](_0x89ab('0xb6'));}return _0xd5e65f['remove'+_[_0x89ab('0xb8')](_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')][_0x89ab('0xb9')]())+_0x89ab('0xba')](_0x16b270[_0x89ab('0x51')]['ids']);}})[_0x89ab('0x1e')](function(_0x4f7496){for(var _0x2472fd=0x0;_0x2472fd<_0x16b270[_0x89ab('0x51')][_0x89ab('0x74')][_0x89ab('0x64')];_0x2472fd+=0x1){var _0xbd676c={'UserId':_0x16b270[_0x89ab('0x6d')]['id']};_0xbd676c[_[_0x89ab('0xb8')](_0x16b270[_0x89ab('0x51')]['channel'][_0x89ab('0xb9')]())+_0x89ab('0xbd')]=_0x16b270[_0x89ab('0x51')][_0x89ab('0x74')][_0x2472fd];socket[_0x89ab('0xbe')]('user'+_[_0x89ab('0xb8')](_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')][_0x89ab('0xb9')]())+_0x89ab('0xc9'),_0xbd676c);}return _0x4f7496;})[_0x89ab('0x1e')](function(){if(_0x16b270[_0x89ab('0x51')][_0x89ab('0xb1')]===_0x89ab('0xc0')){return db['UserVoiceQueueRt'][_0x89ab('0x35')]({'where':{'UserId':_0x16b270[_0x89ab('0x6d')]['id'],'VoiceQueueId':_0x16b270[_0x89ab('0x51')][_0x89ab('0x74')]},'individualHooks':!![]})[_0x89ab('0x1e')](function(){return _0x568fe9;});}return _0x568fe9;})[_0x89ab('0x1e')](respondWithStatusCode(_0x4f6d3f,null))[_0x89ab('0x28')](handleError(_0x4f6d3f,null));};exports[_0x89ab('0xca')]=function(_0x132e69,_0x1efd2d,_0x51dd8a){_0x132e69[_0x89ab('0x45')][_0x89ab('0xcb')]=_0x132e69[_0x89ab('0xcc')][_0x89ab('0xcd')];return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x132e69['params']['id']}})[_0x89ab('0x1e')](handleEntityNotFound(_0x1efd2d,null))[_0x89ab('0x1e')](saveUpdates(_0x132e69[_0x89ab('0x45')],null))[_0x89ab('0x1e')](respondWithResult(_0x1efd2d,null))[_0x89ab('0x28')](handleError(_0x1efd2d,null));};exports[_0x89ab('0xce')]=function(_0x2dd7d9,_0x3831d5,_0x7056e){var _0x31ce30=path['join'](config[_0x89ab('0xcf')],_0x89ab('0xd0'));return db['User'][_0x89ab('0x3f')]({'where':{'id':_0x2dd7d9[_0x89ab('0x6d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x89ab('0x1e')](handleEntityNotFound(_0x3831d5,null))[_0x89ab('0x1e')](function(_0x5d027a){if(_0x5d027a){if(_[_0x89ab('0x7a')](_0x5d027a[_0x89ab('0xcb')])){return _0x3831d5['download'](_0x31ce30);}else{if(!fs[_0x89ab('0xd1')](path['join'](config['root'],'server/files/images/',_0x5d027a[_0x89ab('0xcb')]))){return _0x3831d5[_0x89ab('0xd2')](_0x31ce30);}return _0x3831d5['download'](path[_0x89ab('0xd3')](config['root'],'server/files/images/',_0x5d027a['userpic']));}}})[_0x89ab('0x28')](handleError(_0x3831d5,null));};exports[_0x89ab('0xd4')]=function(_0x266a57,_0x33b246,_0x394b95){return db[_0x89ab('0x48')]['find']({'where':{'id':_0x266a57[_0x89ab('0x6d')]['id']},'attributes':['id']})[_0x89ab('0x1e')](handleEntityNotFound(_0x33b246,null))['then'](function(_0xc6409b){var _0x1017d5=[];values=_0xc6409b[_0x89ab('0x68')];_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x65'),_0xc6409b[_0x89ab('0x68')]));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x67'),_0xc6409b[_0x89ab('0x68')]));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x6a'),_0xc6409b['dataValues']));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x6b'),_0xc6409b['dataValues']));_0x1017d5[_0x89ab('0x61')](get_open_tabs(_0x89ab('0x69'),_0xc6409b['dataValues']));_0x1017d5['push'](get_open_tabs(_0x89ab('0x70'),_0xc6409b[_0x89ab('0x68')]));return BPromise[_0x89ab('0x9c')](_0x1017d5);})[_0x89ab('0x1e')](function(_0x410633){var _0x376866=[];if(_0x410633){for(var _0x1a4b69=0x0;_0x1a4b69=_0x3a9cb6){_0x50a9d0=_0x3a9cb6;_0x1dac45=0xc8;}else{_0x1dac45=0xce;}_0x1db2d1[_0x2243('0x31')](_0x1dac45);return _0x1db2d1[_0x2243('0x37')]('Content-Range',_0x18a2ae+'-'+_0x50a9d0+'/'+_0x3a9cb6)[_0x2243('0x32')](_0x4e3acf);}return null;};}function patchUpdates(_0x1617d7){return function(_0x41acde){try{jsonpatch['apply'](_0x41acde,_0x1617d7,!![]);}catch(_0x2da77){return BPromise[_0x2243('0x38')](_0x2da77);}return _0x41acde[_0x2243('0x39')]();};}function saveUpdates(_0x4d0e1e,_0x541d76){return function(_0x124e95){if(_0x124e95){return _0x124e95[_0x2243('0x3a')](_0x4d0e1e)[_0x2243('0x25')](function(_0x267ab6){return _0x267ab6;});}return null;};}function removeEntity(_0x5dca2d,_0x3fabed){return function(_0x29d5db){if(_0x29d5db){return _0x29d5db[_0x2243('0x3b')]()['then'](function(){var _0x107f79=_0x29d5db[_0x2243('0x3c')]({'plain':!![]});if(_0x107f79[_0x2243('0x3d')]===_0x2243('0x3e'))return;var _0x58a9ee=[{'name':_0x2243('0x3f'),'value':_0x2243('0x40'),'ignore':!![]},{'name':_0x2243('0x41'),'value':_0x2243('0x42'),'ignore':![]},{'name':_0x2243('0x43'),'value':'telephone','ignore':![]}];var _0x1ea79e=_(_0x58a9ee)[_0x2243('0x44')](_0x2243('0x45'))[_0x2243('0x46')](_0x2243('0x47'))[_0x2243('0x47')]();if(_[_0x2243('0x48')](_0x1ea79e,_0x107f79[_0x2243('0x3d')])){return;}var _0x5b7e4=_[_0x2243('0x49')](_0x58a9ee,['value',_0x107f79[_0x2243('0x3d')]])['name'];return db[_0x2243('0x4a')][_0x2243('0x3b')]({'where':{'type':_0x5b7e4,'resourceId':_0x107f79['id']}})[_0x2243('0x25')](function(){return _0x29d5db;});})['then'](function(){_0x5dca2d['status'](0xcc)[_0x2243('0x4b')]();});}};}function handleEntityNotFound(_0x3b8406,_0x42f258){return function(_0x45fbd8){if(!_0x45fbd8){_0x3b8406[_0x2243('0x30')](0x194);}return _0x45fbd8;};}function handleError(_0x1ae029,_0xd1e38d){_0xd1e38d=_0xd1e38d||0x1f4;return function(_0x22663d){logger[_0x2243('0x2b')](_0x22663d[_0x2243('0x4c')]);if(_0x22663d[_0x2243('0x4d')]){delete _0x22663d['name'];}_0x1ae029[_0x2243('0x31')](_0xd1e38d)[_0x2243('0x4e')](_0x22663d);};}function getMustacheRender(_0x4be1aa,_0x390263){return Mustache['render'](_0x4be1aa,_[_0x2243('0x4f')](_0x390263[_0x2243('0x50')],{'contact':_0x390263[_0x2243('0x51')],'message':_0x390263[_0x2243('0x2d')],'agent':_0x390263[_0x2243('0x42')],'interaction':_0x390263[_0x2243('0x52')],'account':_0x390263['account']}))||'';}exports[_0x2243('0x53')]=function(_0xa2872c,_0x427869){var _0xbc8409={},_0x2e7194={},_0x429285={'count':0x0,'rows':[]};var _0x572473=_[_0x2243('0x46')](db[_0x2243('0x54')][_0x2243('0x55')],function(_0x38888b){return{'name':_0x38888b['fieldName'],'type':_0x38888b[_0x2243('0x56')]['key']};});_0x2e7194[_0x2243('0x57')]=_[_0x2243('0x58')](_['map'](_0x572473,'name'),['password','salt']);_0x2e7194[_0x2243('0x59')]=_['keys'](_0xa2872c[_0x2243('0x59')]);_0x2e7194[_0x2243('0x5a')]=_[_0x2243('0x5b')](_0x2e7194[_0x2243('0x57')],_0x2e7194[_0x2243('0x59')]);_0xbc8409[_0x2243('0x5c')]=_[_0x2243('0x5b')](_0x2e7194['model'],qs[_0x2243('0x5d')](_0xa2872c[_0x2243('0x59')][_0x2243('0x5d')]));_0xbc8409['attributes']=_0xbc8409[_0x2243('0x5c')][_0x2243('0x5e')]?_0xbc8409[_0x2243('0x5c')]:_0x2e7194[_0x2243('0x57')];if(!_0xa2872c[_0x2243('0x59')][_0x2243('0x5f')](_0x2243('0x60'))){_0xbc8409[_0x2243('0x35')]=qs[_0x2243('0x35')](_0xa2872c[_0x2243('0x59')][_0x2243('0x35')]);_0xbc8409['offset']=qs[_0x2243('0x33')](_0xa2872c['query'][_0x2243('0x33')]);}_0xbc8409['order']=qs[_0x2243('0x61')](_0xa2872c[_0x2243('0x59')]['sort']);_0xbc8409['where']=qs[_0x2243('0x5a')](_[_0x2243('0x62')](_0xa2872c[_0x2243('0x59')],_0x2e7194['filters']),_0x572473);if(_0xa2872c[_0x2243('0x59')][_0x2243('0x44')]){_0xbc8409['where']=_[_0x2243('0x4f')](_0xbc8409['where'],{'$or':_[_0x2243('0x46')](_0x572473,function(_0x4bf6ab){if(_0x4bf6ab['type']!==_0x2243('0x63')){return db['sequelize'][_0x2243('0x64')](db[_0x2243('0x65')]['fn'](_0x2243('0x66'),db[_0x2243('0x65')]['col'](_0x4bf6ab[_0x2243('0x4d')])),{'$like':db[_0x2243('0x65')]['fn'](_0x2243('0x66'),'%'+_0xa2872c['query'][_0x2243('0x44')]+'%')});}})});}_0xbc8409=_[_0x2243('0x4f')]({},_0xbc8409,_0xa2872c[_0x2243('0x67')]);var _0x3dd0ec={'where':_0xbc8409[_0x2243('0x64')]};return db[_0x2243('0x54')]['count'](_0x3dd0ec)[_0x2243('0x25')](function(_0x3845ed){_0x429285[_0x2243('0x36')]=_0x3845ed;if(_0xa2872c[_0x2243('0x59')][_0x2243('0x68')]){_0xbc8409['include']=[{'all':!![]}];}if(!_[_0x2243('0x48')](_0xbc8409[_0x2243('0x5c')],'id')){_0xbc8409[_0x2243('0x5c')]['push']('id');}return db[_0x2243('0x54')][_0x2243('0x69')](_0xbc8409);})[_0x2243('0x25')](function(_0x2569d0){_0x429285[_0x2243('0x6a')]=_0x2569d0;if(_0xa2872c[_0x2243('0x59')][_0x2243('0x6b')]===_0x2243('0x6c')){var _0x10f59a=[];for(var _0x31e49e=0x0;_0x31e49e<_0x429285['rows'][_0x2243('0x5e')];_0x31e49e++){_0x10f59a[_0x2243('0x6d')](get_open_tabs('chat',_0x429285['rows'][_0x31e49e][_0x2243('0x6e')]));_0x10f59a['push'](get_open_tabs(_0x2243('0x6f'),_0x429285['rows'][_0x31e49e][_0x2243('0x6e')]));_0x10f59a['push'](get_open_tabs(_0x2243('0x70'),_0x429285[_0x2243('0x6a')][_0x31e49e][_0x2243('0x6e')]));_0x10f59a[_0x2243('0x6d')](get_open_tabs(_0x2243('0x71'),_0x429285[_0x2243('0x6a')][_0x31e49e]['dataValues']));_0x10f59a[_0x2243('0x6d')](get_open_tabs(_0x2243('0x72'),_0x429285['rows'][_0x31e49e][_0x2243('0x6e')]));_0x10f59a[_0x2243('0x6d')](get_open_tabs(_0x2243('0x73'),_0x429285[_0x2243('0x6a')][_0x31e49e][_0x2243('0x6e')]));}return BPromise[_0x2243('0x74')](_0x10f59a)[_0x2243('0x25')](function(_0x5e694b){return _0x429285;});}else{return _0x429285;}})[_0x2243('0x25')](respondWithFilteredResult(_0x427869,_0xbc8409))[_0x2243('0x2f')](handleError(_0x427869,null));};exports[_0x2243('0x75')]=function(_0x4f481d,_0x21e1b2){var _0xe9c3cc={'raw':![],'where':{'id':_0x4f481d[_0x2243('0x76')]['id']}},_0x1ae9e2={};_0x1ae9e2['model']=_[_0x2243('0x58')](_[_0x2243('0x77')](db[_0x2243('0x54')][_0x2243('0x55')]),[_0x2243('0x78'),_0x2243('0x79')]);_0x1ae9e2[_0x2243('0x59')]=_[_0x2243('0x77')](_0x4f481d['query']);_0x1ae9e2[_0x2243('0x5a')]=_['intersection'](_0x1ae9e2['model'],_0x1ae9e2[_0x2243('0x59')]);_0xe9c3cc['attributes']=_['intersection'](_0x1ae9e2[_0x2243('0x57')],qs[_0x2243('0x5d')](_0x4f481d[_0x2243('0x59')][_0x2243('0x5d')]));_0xe9c3cc[_0x2243('0x5c')]=_0xe9c3cc[_0x2243('0x5c')][_0x2243('0x5e')]?_0xe9c3cc[_0x2243('0x5c')]:_0x1ae9e2[_0x2243('0x57')];if(_0x4f481d['query'][_0x2243('0x68')]){_0xe9c3cc[_0x2243('0x7a')]=[{'all':!![]}];}_0xe9c3cc=_[_0x2243('0x4f')]({},_0xe9c3cc,_0x4f481d['options']);if(!_[_0x2243('0x48')](_0xe9c3cc[_0x2243('0x5c')],'id')){_0xe9c3cc['attributes']['push']('id');}return db[_0x2243('0x54')][_0x2243('0x49')](_0xe9c3cc)[_0x2243('0x25')](handleEntityNotFound(_0x21e1b2,null))[_0x2243('0x25')](function(_0x4a6681){var _0x51b5a0=[];values=_0x4a6681;if(_0x4f481d['query'][_0x2243('0x6b')]==='true'){_0x51b5a0[_0x2243('0x6d')](get_open_tabs(_0x2243('0x7b'),_0x4a6681[_0x2243('0x6e')]));_0x51b5a0['push'](get_open_tabs(_0x2243('0x6f'),_0x4a6681[_0x2243('0x6e')]));_0x51b5a0[_0x2243('0x6d')](get_open_tabs(_0x2243('0x72'),_0x4a6681[_0x2243('0x6e')]));_0x51b5a0[_0x2243('0x6d')](get_open_tabs(_0x2243('0x73'),_0x4a6681[_0x2243('0x6e')]));_0x51b5a0['push'](get_open_tabs(_0x2243('0x70'),_0x4a6681[_0x2243('0x6e')]));_0x51b5a0[_0x2243('0x6d')](get_open_tabs(_0x2243('0x71'),_0x4a6681[_0x2243('0x6e')]));return BPromise[_0x2243('0x74')](_0x51b5a0);}else{return values;}})[_0x2243('0x25')](function(_0x43fa47){return values;})['then'](respondWithResult(_0x21e1b2,null))[_0x2243('0x2f')](handleError(_0x21e1b2,null));};exports[_0x2243('0x3a')]=function(_0x45a274,_0x44436c){if(_0x45a274[_0x2243('0x50')]['id']){delete _0x45a274[_0x2243('0x50')]['id'];}delete _0x45a274[_0x2243('0x50')][_0x2243('0x3d')];return db[_0x2243('0x54')]['find']({'where':{'id':_0x45a274[_0x2243('0x76')]['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x44436c,null))[_0x2243('0x25')](saveUpdates(_0x45a274[_0x2243('0x50')],null))[_0x2243('0x25')](respondWithResult(_0x44436c,null))[_0x2243('0x2f')](handleError(_0x44436c,null));};exports[_0x2243('0x7c')]=function(_0x40ef41,_0x1dc952){return db[_0x2243('0x54')]['describe']()[_0x2243('0x25')](respondWithResult(_0x1dc952,null))[_0x2243('0x2f')](handleError(_0x1dc952,null));};exports[_0x2243('0x7d')]=function(_0x781269,_0x45f2cf,_0x3867b7){return db[_0x2243('0x54')][_0x2243('0x49')]({'where':{'id':_0x781269[_0x2243('0x76')]['id']}})[_0x2243('0x25')](handleEntityNotFound(_0x45f2cf,null))[_0x2243('0x25')](function(_0x293b44){if(_0x293b44){return _0x293b44[_0x2243('0x7d')](_0x781269['body'][_0x2243('0x7e')],_[_0x2243('0x7f')](_0x781269[_0x2243('0x50')],[_0x2243('0x7e'),'id'])||{});}})[_0x2243('0x25')](respondWithResult(_0x45f2cf,null))['catch'](handleError(_0x45f2cf,null));};function validateUser(_0x290c81){return new BPromise(function(_0x25522b,_0x3d1f73){if(_0x290c81[_0x2243('0x80')])return _0x25522b(_0x290c81);return db['Setting']['findById'](0x1)['then'](function(_0x41c001){if(_0x41c001[_0x2243('0x81')])authService[_0x2243('0x82')](_0x290c81[_0x2243('0x78')]);db[_0x2243('0x54')][_0x2243('0x83')](_0x2243('0x80'))[_0x2243('0x25')](function(_0x3e9e09){if(_[_0x2243('0x84')](_0x3e9e09)){_0x290c81[_0x2243('0x80')]=_0x41c001[_0x2243('0x85')]||0x1;return;}if(_[_0x2243('0x84')](_0x41c001['min_internal'])||_0x41c001[_0x2243('0x85')]===_0x3e9e09){_0x290c81[_0x2243('0x80')]=_0x3e9e09+0x1;return;}if(_0x41c001['min_internal']>_0x3e9e09){_0x290c81['internal']=_0x41c001[_0x2243('0x85')];return;}return db[_0x2243('0x65')][_0x2243('0x59')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x2243('0x65')]['QueryTypes']['SELECT']})[_0x2243('0x25')](function(_0x3a5989){if(_0x3a5989&&_0x3a5989[_0x2243('0x5e')]){for(var _0xc7ff8a=0x0,_0xa9d5cc=_0x3a5989[_0x2243('0x5e')];_0xc7ff8a<_0xa9d5cc&&_[_0x2243('0x84')](_0x290c81[_0x2243('0x80')]);_0xc7ff8a++){if(_0x41c001[_0x2243('0x85')]<=_0x3a5989[_0xc7ff8a][_0x2243('0x86')]){_0x290c81[_0x2243('0x80')]=_0x3a5989[_0xc7ff8a]['from'];}else if(_0x41c001['min_internal']>_0x3a5989[_0xc7ff8a][_0x2243('0x86')]&&_0x41c001[_0x2243('0x85')]<=_0x3a5989[_0xc7ff8a]['to']){_0x290c81['internal']=_0x41c001[_0x2243('0x85')];}}}if(_[_0x2243('0x84')](_0x290c81['internal'])){_0x290c81[_0x2243('0x80')]=_0x3e9e09+0x1;}return _0x25522b(_0x290c81);});});})[_0x2243('0x2f')](function(_0x56d977){_0x3d1f73(_0x56d977);});});}function updateUser(_0x231c2b){return new BPromise(function(_0x3edc51,_0x58d8a0){try{if(_0x231c2b['voicemail']){_0x231c2b['mailbox']=_0x231c2b['internal'];_0x231c2b[_0x2243('0x87')]={'mailbox':_0x231c2b[_0x2243('0x80')],'password':_0x231c2b[_0x2243('0x78')],'fullname':_0x231c2b[_0x2243('0x88')],'email':_0x231c2b['email']};}if(_0x231c2b[_0x2243('0x3d')]===_0x2243('0x42')){if(!_0x231c2b['permissions'])_0x231c2b[_0x2243('0x89')]=['101',_0x2243('0x8a'),'103',_0x2243('0x8b'),_0x2243('0x8c'),'104',_0x2243('0x8d'),_0x2243('0x8e'),_0x2243('0x8f'),_0x2243('0x90'),_0x2243('0x91'),_0x2243('0x92'),_0x2243('0x93'),_0x2243('0x94'),_0x2243('0x95')];}_0x3edc51(_0x231c2b);}catch(_0x1148c1){_0x58d8a0(_0x1148c1);}});}exports[_0x2243('0x96')]=function(_0x1bf956,_0x39a98b){if(_0x1bf956[_0x2243('0x40')][_0x2243('0x3d')]===_0x2243('0x42'))throw new Error(_0x2243('0x97'));if(_0x1bf956[_0x2243('0x50')][_0x2243('0x3d')]===_0x2243('0x40')&&_0x1bf956['user'][_0x2243('0x3d')]!==_0x2243('0x3e')){throw new Error(_0x2243('0x98'));}if(_0x1bf956[_0x2243('0x50')][_0x2243('0x3d')]===_0x2243('0x3e')&&_0x1bf956[_0x2243('0x40')][_0x2243('0x3d')]!=='admin'){throw new Error(_0x2243('0x99'));}return licenseUtil[_0x2243('0x9a')]([_0x1bf956['body']])[_0x2243('0x25')](function(){return validateUser(_0x1bf956['body']);})[_0x2243('0x25')](function(_0x8da855){return updateUser(_0x8da855)[_0x2243('0x25')](function(_0x516873){if(_0x516873[_0x2243('0x3d')]===_0x2243('0x3e')){_0x516873[_0x2243('0x9b')]=_0x1bf956['user'][_0x2243('0x9b')];delete _0x516873[_0x2243('0x9c')];}return _0x516873;});})[_0x2243('0x25')](function(_0x4723f8){return db[_0x2243('0x54')][_0x2243('0x96')](_0x4723f8,{'include':[{'model':db[_0x2243('0x87')],'as':'VoiceMail'}]});})[_0x2243('0x25')](function(_0x52287c){if(_0x1bf956['body'][_0x2243('0x3d')]==='user')return _0x52287c;if(_0x1bf956[_0x2243('0x40')]['role']!=='user')return _0x52287c;return db['UserProfileSection'][_0x2243('0x49')]({'where':{'name':_0x52287c[_0x2243('0x3d')]===_0x2243('0x42')?_0x2243('0x41'):'Telephones','userProfileId':_0x1bf956[_0x2243('0x40')][_0x2243('0x9c')]},'raw':!![]})[_0x2243('0x25')](function(_0x4dac0f){if(!_0x4dac0f||_0x4dac0f[_0x2243('0x9d')]!=0x0)return _0x52287c;return db[_0x2243('0x4a')][_0x2243('0x96')]({'name':_0x52287c[_0x2243('0x4d')],'resourceId':_0x52287c['id'],'type':_0x4dac0f[_0x2243('0x4d')],'sectionId':_0x4dac0f['id']},{})[_0x2243('0x25')](function(){return _0x52287c;});})['catch'](function(_0x5c46dd){logger['error'](_0x2243('0x9e'),_0x5c46dd);throw _0x5c46dd;});})[_0x2243('0x25')](respondWithResult(_0x39a98b,0xc9))[_0x2243('0x2f')](handleError(_0x39a98b,null));};exports[_0x2243('0x9f')]=function(_0x5271f6,_0x1652d2){var _0x5d03a3=_0x5271f6[_0x2243('0x50')];var _0x2c4c8d=[];if(_0x5271f6[_0x2243('0x40')][_0x2243('0x3d')]==='agent')throw new Error(_0x2243('0x97'));if(_[_0x2243('0xa0')](_0x5d03a3,[_0x2243('0x3d'),_0x2243('0x40')])&&_0x5271f6[_0x2243('0x40')][_0x2243('0x3d')]!==_0x2243('0x3e')){throw new Error(_0x2243('0x98'));}if(_[_0x2243('0xa0')](_0x5d03a3,[_0x2243('0x3d'),'admin'])&&_0x5271f6['user']['role']!=='admin'){throw new Error(_0x2243('0xa1'));}return licenseUtil[_0x2243('0x9a')](_0x5d03a3)['then'](function(){return validateUser(_0x5d03a3[0x0]);})[_0x2243('0x25')](function(){for(var _0xf3f116=0x1;_0xf3f116<_0x5d03a3[_0x2243('0x5e')];_0xf3f116++){var _0x145644=_0x5d03a3[_0xf3f116-0x1]['internal'];if(!_0x5d03a3[_0xf3f116][_0x2243('0x80')])_0x5d03a3[_0xf3f116]['internal']=_0x145644+0x1;_0x2c4c8d['push'](validateUser(_0x5d03a3[_0xf3f116]));}return BPromise[_0x2243('0x74')](_0x2c4c8d);})[_0x2243('0x25')](function(){_0x2c4c8d=[];for(var _0x51bcdd=0x0;_0x51bcdd<_0x5d03a3[_0x2243('0x5e')];_0x51bcdd++){_0x2c4c8d[_0x2243('0x6d')](updateUser(_0x5d03a3[_0x51bcdd]));}return BPromise[_0x2243('0x74')](_0x2c4c8d);})[_0x2243('0x25')](function(){return BPromise[_0x2243('0xa2')](_0x5d03a3,function(_0xd0c2ff){return db[_0x2243('0x54')][_0x2243('0x96')](_0xd0c2ff,{'include':[{'model':db[_0x2243('0x87')],'as':_0x2243('0x87')}]})[_0x2243('0x25')](function(_0x4eac58){_0xd0c2ff['id']=_0x4eac58['id'];return _0xd0c2ff;});});})[_0x2243('0x25')](function(_0x288c36){if(_0x5271f6[_0x2243('0x50')][_0x2243('0x3d')]===_0x2243('0x40'))return _0x288c36;if(_0x5271f6[_0x2243('0x40')][_0x2243('0x3d')]!==_0x2243('0x40'))return _0x288c36;var _0x607bc7=_[_0x2243('0xa0')](_0x288c36,function(_0x40f595){return _0x40f595[_0x2243('0x3d')]==='agent'||_0x40f595[_0x2243('0x3d')]===_0x2243('0xa3');});if(!_0x607bc7)return _0x288c36;return db[_0x2243('0xa4')][_0x2243('0x69')]({'where':{'name':{'$or':['Agents',_0x2243('0x43')]},'userProfileId':_0x5271f6[_0x2243('0x40')][_0x2243('0x9c')]},'raw':!![]})['then'](function(_0x37e735){if(_[_0x2243('0xa5')](_0x37e735)||!_[_0x2243('0xa0')](_0x37e735,[_0x2243('0x9d'),0x0]))return _0x288c36;_0x2c4c8d=[];var _0xd3f1e5=_(_0x37e735)['map'](function(_0x2999d4){if(_0x2999d4[_0x2243('0x9d')]===0x1)return;return _0x2999d4['name']==='Agents'?'agent':_0x2243('0xa3');})['compact']()['value']();for(var _0x2826ba=0x0;_0x2826ba<_0x288c36[_0x2243('0x5e')];_0x2826ba++){if(!_[_0x2243('0x48')](_0xd3f1e5,_0x288c36[_0x2826ba][_0x2243('0x3d')]))return;var _0x5b6e91=_0x288c36[_0x2826ba][_0x2243('0x3d')]==='agent'?'Agents':'Telephones';_0x2c4c8d[_0x2243('0x6d')](db[_0x2243('0x4a')][_0x2243('0x96')]({'name':_0x288c36[_0x2826ba][_0x2243('0x4d')],'resourceId':_0x288c36[_0x2826ba]['id'],'type':_0x5b6e91,'sectionId':_[_0x2243('0x49')](_0x37e735,['name',_0x5b6e91])['id']},{}));}return BPromise['all'](_0x2c4c8d);});})[_0x2243('0x25')](respondWithResult(_0x1652d2,0xc9))[_0x2243('0x2f')](handleError(_0x1652d2,null));};exports[_0x2243('0xa6')]=function(_0x53a650,_0x45a715,_0xd13436){if(_0x53a650['body']['id']){delete _0x53a650['body']['id'];}return db['User'][_0x2243('0x49')]({'where':{'id':_0x53a650['params']['id']}})[_0x2243('0x25')](function(_0xab4ef8){if(!_0xab4ef8)return null;if(_0xab4ef8['id']===_0x53a650['user']['id']){if(!_0x53a650[_0x2243('0x50')]['oldPassword']||!_0x53a650['body'][_0x2243('0xa7')]){throw new db[(_0x2243('0xa8'))][(_0x2243('0xa9'))](_0x2243('0xaa'));}if(!_0xab4ef8[_0x2243('0xab')](_0x53a650[_0x2243('0x50')]['oldPassword'])){throw new db[(_0x2243('0xa8'))][(_0x2243('0xa9'))](_0x2243('0xac'));}if(_0x53a650['body'][_0x2243('0xad')]===_0x53a650['body'][_0x2243('0xa7')]){throw new db[(_0x2243('0xa8'))][(_0x2243('0xa9'))](_0x2243('0xae'));}}else if(_0x53a650[_0x2243('0x40')][_0x2243('0x3d')]===_0x2243('0x3e')){if(!_0x53a650['body'][_0x2243('0xa7')]){throw new db[(_0x2243('0xa8'))][(_0x2243('0xa9'))](_0x2243('0xaf'));}}else if(_0x53a650[_0x2243('0x40')][_0x2243('0x3d')]===_0x2243('0x40')){if(!_0x53a650[_0x2243('0x50')][_0x2243('0xa7')]){throw new db[(_0x2243('0xa8'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0xab4ef8[_0x2243('0x3d')]!==_0x2243('0x42')){throw new db[(_0x2243('0xa8'))][(_0x2243('0xa9'))]('Unauthorized');}}else{throw new db[(_0x2243('0xa8'))]['ValidationError']('Unauthorized');}return _0xab4ef8;})['then'](handleEntityNotFound(_0x45a715,null))[_0x2243('0x25')](function(_0x5a53bc){return db[_0x2243('0xb0')][_0x2243('0xb1')]({'attributes':['id',_0x2243('0x81'),'enforcePasswordHistory',_0x2243('0xb2')]})['then'](function(_0x38d624){if(_0x38d624['securePassword'])authService[_0x2243('0x82')](_0x53a650[_0x2243('0x50')][_0x2243('0xa7')]);if(!_0x38d624[_0x2243('0xb3')]||!_0x5a53bc[_0x2243('0xb4')])return _0x5a53bc;authService[_0x2243('0xb5')](_0x53a650['body'][_0x2243('0xa7')],_0x5a53bc[_0x2243('0xb4')],_0x38d624[_0x2243('0xb2')]);return _0x5a53bc;})[_0x2243('0x25')](saveUpdates({'password':_0x53a650['body']['newPassword'],'passwordResetAt':_0x53a650[_0x2243('0x40')]['id']==_0x53a650[_0x2243('0x76')]['id']?moment():null,'previousPasswords':authService[_0x2243('0xb6')](_0x53a650[_0x2243('0x50')][_0x2243('0xa7')],_0x5a53bc[_0x2243('0xb4')])},null));})[_0x2243('0x25')](respondWithResult(_0x45a715,null))[_0x2243('0x2f')](handleError(_0x45a715,null));};exports[_0x2243('0xb7')]=function(_0xd7d510,_0x3f12c1,_0x105755){var _0x2e9729=_0xd7d510[_0x2243('0x50')][_0x2243('0xb8')];return db['User'][_0x2243('0x49')]({'where':{'id':_0xd7d510['params']['id']},'attributes':['id',_0x2243('0x4d'),'role',_0x2243('0xb9'),_0x2243('0xba'),'voicePause',_0x2243('0xbb')]})[_0x2243('0x25')](handleEntityNotFound(_0x3f12c1,null))[_0x2243('0x25')](function(_0xa35b05){if(_0xa35b05){if(!utils[_0x2243('0xbc')](_0x2e9729)){throw new db[(_0x2243('0xa8'))][(_0x2243('0xa9'))](_0x2243('0xbd'));}return _0xa35b05[_0x2243('0xbe')+_[_0x2243('0xbf')](_0x2e9729[_0x2243('0xc0')]())+_0x2243('0xc1')](_0xd7d510[_0x2243('0x50')][_0x2243('0x7e')],{'penalty':_0xd7d510[_0x2243('0x50')][_0x2243('0xc2')]||0x0})[_0x2243('0xc3')](function(_0x256798){for(var _0xc3a46=0x0;_0xc3a46<_0xd7d510[_0x2243('0x50')][_0x2243('0x7e')][_0x2243('0x5e')];_0xc3a46+=0x1){var _0x2c8f3b={'UserId':_0xd7d510[_0x2243('0x76')]['id']};_0x2c8f3b[_[_0x2243('0xbf')](_0x2e9729[_0x2243('0xc0')]())+_0x2243('0xc4')]=_0xd7d510[_0x2243('0x50')][_0x2243('0x7e')][_0xc3a46];socket[_0x2243('0xc5')](_0x2243('0x40')+_[_0x2243('0xbf')](_0x2e9729[_0x2243('0xc0')]())+_0x2243('0xc6'),_0x2c8f3b);}return _0x256798;})[_0x2243('0x25')](function(){if(_0x2e9729==='voice'){return db['VoiceQueue'][_0x2243('0x69')]({'where':{'id':_0xd7d510[_0x2243('0x50')][_0x2243('0x7e')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x260a02){var _0x128f5d=_0xa35b05[_0x2243('0x3c')]({'plain':!![]});var _0x315d7d=[];if(_0x2e9729==='voice'&&_0x128f5d[_0x2243('0x3d')]===_0x2243('0x42')&&_0x128f5d['online']){for(var _0x178ce1=0x0;_0x178ce1<_0x260a02['length'];_0x178ce1+=0x1){_0x315d7d['push']({'membername':_0x128f5d['name'],'UserId':_0x128f5d['id'],'queue_name':_0x260a02[_0x178ce1][_0x2243('0x4d')],'VoiceQueueId':_0x260a02[_0x178ce1]['id'],'interface':_[_0x2243('0x84')](_0x128f5d[_0x2243('0xbb')])?util['format'](_0x2243('0xc7'),_0x128f5d['name']):_0x128f5d[_0x2243('0xbb')],'paused':_0x128f5d['voicePause']||![],'penalty':_0xd7d510[_0x2243('0x50')][_0x2243('0xc2')]||0x0});}return BPromise['each'](_0x315d7d,function(_0x4e37dd){return db['UserVoiceQueueRt'][_0x2243('0xc8')](_0x4e37dd);});}return _0xa35b05;});}})[_0x2243('0x25')](respondWithStatusCode(_0x3f12c1,null))[_0x2243('0x2f')](handleError(_0x3f12c1,null));};exports[_0x2243('0xc9')]=function(_0xd3cf96,_0x3f5a8c,_0x5763a1){var _0x39ec44;return db[_0x2243('0x54')][_0x2243('0x49')]({'where':{'id':_0xd3cf96[_0x2243('0x76')]['id']},'attributes':['id','name',_0x2243('0x3d')]})[_0x2243('0x25')](handleEntityNotFound(_0x3f5a8c,null))[_0x2243('0x25')](function(_0x32900f){if(_0x32900f){_0x39ec44=_0x32900f;if(!_0xd3cf96[_0x2243('0x59')][_0x2243('0xb8')]||!utils[_0x2243('0xbc')](_0xd3cf96['query']['channel'])){throw new db[(_0x2243('0xa8'))]['ValidationError'](_0x2243('0xbd'));}return _0x32900f[_0x2243('0xca')+_[_0x2243('0xbf')](_0xd3cf96[_0x2243('0x59')]['channel']['toLowerCase']())+'Queues'](_0xd3cf96['query']['ids']);}})[_0x2243('0x25')](function(_0x4b02cf){for(var _0x246d96=0x0;_0x246d96<_0xd3cf96[_0x2243('0x59')]['ids'][_0x2243('0x5e')];_0x246d96+=0x1){var _0x276483={'UserId':_0xd3cf96['params']['id']};_0x276483[_[_0x2243('0xbf')](_0xd3cf96['query'][_0x2243('0xb8')][_0x2243('0xc0')]())+_0x2243('0xc4')]=_0xd3cf96[_0x2243('0x59')][_0x2243('0x7e')][_0x246d96];socket[_0x2243('0xc5')](_0x2243('0x40')+_[_0x2243('0xbf')](_0xd3cf96[_0x2243('0x59')][_0x2243('0xb8')][_0x2243('0xc0')]())+_0x2243('0xcb'),_0x276483);}return _0x4b02cf;})[_0x2243('0x25')](function(){if(_0xd3cf96['query']['channel']===_0x2243('0xcc')){return db[_0x2243('0xcd')][_0x2243('0x3b')]({'where':{'UserId':_0xd3cf96[_0x2243('0x76')]['id'],'VoiceQueueId':_0xd3cf96[_0x2243('0x59')][_0x2243('0x7e')]},'individualHooks':!![]})[_0x2243('0x25')](function(){return _0x39ec44;});}return _0x39ec44;})[_0x2243('0x25')](respondWithStatusCode(_0x3f5a8c,null))[_0x2243('0x2f')](handleError(_0x3f5a8c,null));};exports[_0x2243('0xce')]=function(_0x10326b,_0x5a7954,_0x5d62e2){_0x10326b['body'][_0x2243('0xcf')]=_0x10326b[_0x2243('0xd0')]['filename'];return db[_0x2243('0x54')][_0x2243('0x49')]({'where':{'id':_0x10326b[_0x2243('0x76')]['id']}})['then'](handleEntityNotFound(_0x5a7954,null))[_0x2243('0x25')](saveUpdates(_0x10326b[_0x2243('0x50')],null))[_0x2243('0x25')](respondWithResult(_0x5a7954,null))[_0x2243('0x2f')](handleError(_0x5a7954,null));};exports[_0x2243('0xd1')]=function(_0x5da6c8,_0x2fea99,_0x531d45){var _0x558a93=path[_0x2243('0xd2')](config[_0x2243('0xd3')],_0x2243('0xd4'));return db[_0x2243('0x54')][_0x2243('0x49')]({'where':{'id':_0x5da6c8[_0x2243('0x76')]['id']},'attributes':['id',_0x2243('0xcf')],'raw':!![]})[_0x2243('0x25')](handleEntityNotFound(_0x2fea99,null))['then'](function(_0x42632e){if(_0x42632e){if(_[_0x2243('0x84')](_0x42632e[_0x2243('0xcf')])){return _0x2fea99['download'](_0x558a93);}else{if(!fs[_0x2243('0xd5')](path[_0x2243('0xd2')](config[_0x2243('0xd3')],_0x2243('0xd6'),_0x42632e['userpic']))){return _0x2fea99[_0x2243('0xd7')](_0x558a93);}return _0x2fea99['download'](path[_0x2243('0xd2')](config[_0x2243('0xd3')],_0x2243('0xd6'),_0x42632e[_0x2243('0xcf')]));}}})[_0x2243('0x2f')](handleError(_0x2fea99,null));};exports[_0x2243('0xd8')]=function(_0x1c0e97,_0x3f0ad3,_0x36f57a){return db[_0x2243('0x54')][_0x2243('0x49')]({'where':{'id':_0x1c0e97[_0x2243('0x76')]['id']},'attributes':['id']})[_0x2243('0x25')](handleEntityNotFound(_0x3f0ad3,null))[_0x2243('0x25')](function(_0xfdb586){var _0x319b01=[];values=_0xfdb586[_0x2243('0x6e')];_0x319b01[_0x2243('0x6d')](get_open_tabs('chat',_0xfdb586['dataValues']));_0x319b01[_0x2243('0x6d')](get_open_tabs(_0x2243('0x6f'),_0xfdb586['dataValues']));_0x319b01['push'](get_open_tabs(_0x2243('0x72'),_0xfdb586[_0x2243('0x6e')]));_0x319b01['push'](get_open_tabs(_0x2243('0x73'),_0xfdb586['dataValues']));_0x319b01[_0x2243('0x6d')](get_open_tabs(_0x2243('0x70'),_0xfdb586['dataValues']));_0x319b01[_0x2243('0x6d')](get_open_tabs(_0x2243('0x71'),_0xfdb586['dataValues']));return BPromise[_0x2243('0x74')](_0x319b01);})['then'](function(_0x56eeb1){var _0x21f0bc=[];if(_0x56eeb1){for(var _0x12989d=0x0;_0x12989d=_0x39ac23[_0xac1d('0x51')]){throw new Error(_0xac1d('0x52'));}})[_0xac1d('0x10')](function(){if(_0x29fd0d){return db[_0xac1d('0x41')][_0xac1d('0x53')]({'where':{'membername':_0x29fd0d[_0xac1d('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x29fd0d){return _0x29fd0d['getVoiceQueues']({'raw':!![]});}})[_0xac1d('0x10')](function(_0x51dc95){if(_0x29fd0d){if(_0x51dc95){var _0x629bfd=[];_0x62d69a=_0x51dc95;if(_0x62d69a['length']){for(var _0x3e066d=0x0;_0x3e066d<_0x62d69a['length'];_0x3e066d++){_0x629bfd[_0xac1d('0x34')](db[_0xac1d('0x41')][_0xac1d('0x54')]({'membername':_0x29fd0d[_0xac1d('0x28')],'UserId':_0x29fd0d['id'],'queue_name':_0x62d69a[_0x3e066d][_0xac1d('0x28')],'VoiceQueueId':_0x62d69a[_0x3e066d]['id'],'interface':_0x137f31,'paused':_0x29fd0d[_0xac1d('0x55')]||![],'penalty':_0x62d69a[_0x3e066d][_0xac1d('0x56')]||0x0}));}return BPromise[_0xac1d('0x4b')](_0x629bfd);}}}})[_0xac1d('0x10')](function(){if(_0x29fd0d){return db[_0xac1d('0x2c')][_0xac1d('0x2d')]({'where':{'membername':_0x29fd0d[_0xac1d('0x28')],'exitAt':null}});}})[_0xac1d('0x10')](function(_0x6d0bc5){if(_0x29fd0d){if(_0x6d0bc5&&_0x6d0bc5[_0xac1d('0x2f')]){var _0x34b8e8=[];_0x6d0bc5[_0xac1d('0x4a')](function(_0x517057){_0x34b8e8[_0xac1d('0x34')](_0x517057[_0xac1d('0x3a')]({'exitAt':moment()[_0xac1d('0x30')](_0xac1d('0x31'))}));});return BPromise[_0xac1d('0x4b')](_0x34b8e8);}}})[_0xac1d('0x10')](function(_0x5dea60){if(_0x29fd0d){var _0x4d5ca4=[];var _0x47defb=[];var _0x4f9061=utils['getChannels']();var _0x5bfa57={'membername':_0x29fd0d[_0xac1d('0x28')],'interface':_0x137f31,'enterAt':moment()[_0xac1d('0x30')](_0xac1d('0x31')),'role':_0x29fd0d['role'],'internal':_0x29fd0d[_0xac1d('0x2a')]};_0x4f9061['forEach'](function(_0x50ba9c){_0x4d5ca4[_0xac1d('0x34')](_['merge']({'channel':_0x50ba9c,'type':'LOGIN','data1':_0xac1d('0x57'),'data2':_0x137f31},_0x5bfa57));if(_0x29fd0d[_0xac1d('0x55')]){_0x47defb[_0xac1d('0x34')](_[_0xac1d('0x58')]({'channel':_0x50ba9c,'type':_0xac1d('0x2e'),'data1':_0xac1d('0x59')},_0x5bfa57));}});return db[_0xac1d('0x2c')][_0xac1d('0x39')](_0x4d5ca4[_0xac1d('0x5a')](_0x47defb),{'individualHooks':!![]});}})[_0xac1d('0x10')](function(){if(_0x29fd0d){return _0x29fd0d['update']({'online':!![],'lastLoginAt':moment()[_0xac1d('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x29fd0d[_0xac1d('0x55')]||![],'mailPause':_0x29fd0d[_0xac1d('0x55')]||![],'chatPause':_0x29fd0d[_0xac1d('0x55')]||![],'faxPause':_0x29fd0d[_0xac1d('0x55')]||![],'smsPause':_0x29fd0d[_0xac1d('0x55')]||![],'openchannelPause':_0x29fd0d[_0xac1d('0x55')]||![],'pauseType':_0x29fd0d[_0xac1d('0x55')]?_0xac1d('0x59'):null,'lastPauseAt':moment()[_0xac1d('0x30')](_0xac1d('0x31')),'interface':_0x137f31});}})[_0xac1d('0x10')](function(_0x5818d7){_0x1d9659(_0x5818d7);})[_0xac1d('0x1b')](function(_0x5eec56){_0x326fc5(_0x3f08de[_0xac1d('0x17')](0x1f4,_0x5eec56[_0xac1d('0x19')]));});});}; \ No newline at end of file +var _0xa2cd=['mail','fax','sms','channel','set','%s%s','Pause','push','all','LogoutUser','destroy','LoginUser','findOne','mobile','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','LOGIN','callysquare','merge','LOGININPAUSE','concat','util','ioredis','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','catch','User','options','raw','where','attributes','limit','map','model','include','then','GetUser','find','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','findAll','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','isNil','format','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','isValidChannel','Unknown\x20channel','voice','PAUSE','system'];(function(_0x2da4d4,_0x342853){var _0x4174ac=function(_0x17217c){while(--_0x17217c){_0x2da4d4['push'](_0x2da4d4['shift']());}};_0x4174ac(++_0x342853);}(_0xa2cd,0x1e4));var _0xda2c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa2cd[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0xda2c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda2c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xda2c('0x2'));var logger=require('../../config/logger')(_0xda2c('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xda2c('0x4')][_0xda2c('0x5')]({'port':0x232a});config[_0xda2c('0x6')]=_[_0xda2c('0x7')](config[_0xda2c('0x6')],{'host':_0xda2c('0x8'),'port':0x18eb});var socket=require(_0xda2c('0x9'))(new Redis(config['redis']));require(_0xda2c('0xa'))[_0xda2c('0xb')](socket);function respondWithRpcPromise(_0x1dc55d,_0x160e8b,_0x15d576){return new BPromise(function(_0x1b690f,_0x3f9863){return client[_0xda2c('0xc')](_0x1dc55d,_0x15d576)['then'](function(_0x14e58b){logger[_0xda2c('0xd')]('User,\x20%s,\x20%s',_0x160e8b,_0xda2c('0xe'));logger[_0xda2c('0xf')](_0xda2c('0x10'),_0x160e8b,_0xda2c('0xe'),JSON[_0xda2c('0x11')](_0x14e58b));if(_0x14e58b[_0xda2c('0x12')]){if(_0x14e58b['error'][_0xda2c('0x13')]===0x1f4){logger[_0xda2c('0x12')](_0xda2c('0x14'),_0x160e8b,_0x14e58b[_0xda2c('0x12')]['message']);return _0x3f9863(_0x14e58b[_0xda2c('0x12')][_0xda2c('0x15')]);}logger[_0xda2c('0x12')](_0xda2c('0x14'),_0x160e8b,_0x14e58b[_0xda2c('0x12')]['message']);return _0x1b690f(_0x14e58b[_0xda2c('0x12')][_0xda2c('0x15')]);}else{logger['info'](_0xda2c('0x14'),_0x160e8b,_0xda2c('0xe'));_0x1b690f(_0x14e58b['result']['message']);}})[_0xda2c('0x16')](function(_0x24631c){logger['error'](_0xda2c('0x14'),_0x160e8b,_0x24631c);_0x3f9863(_0x24631c);});});}exports['GetUser']=function(_0x4b980d){var _0x33ca61=this;return new Promise(function(_0x11b4df,_0x299c76){return db[_0xda2c('0x17')]['findAll']({'raw':_0x4b980d[_0xda2c('0x18')]?_0x4b980d[_0xda2c('0x18')][_0xda2c('0x19')]===undefined?!![]:![]:!![],'where':_0x4b980d[_0xda2c('0x18')]?_0x4b980d[_0xda2c('0x18')][_0xda2c('0x1a')]||null:null,'attributes':_0x4b980d[_0xda2c('0x18')]?_0x4b980d[_0xda2c('0x18')][_0xda2c('0x1b')]||null:null,'limit':_0x4b980d[_0xda2c('0x18')]?_0x4b980d[_0xda2c('0x18')][_0xda2c('0x1c')]||null:null,'include':_0x4b980d[_0xda2c('0x18')]?_0x4b980d['options']['include']?_[_0xda2c('0x1d')](_0x4b980d[_0xda2c('0x18')]['include'],function(_0x57d5b0){return{'model':db[_0x57d5b0[_0xda2c('0x1e')]],'as':_0x57d5b0['as'],'attributes':_0x57d5b0['attributes'],'include':_0x57d5b0[_0xda2c('0x1f')]?_[_0xda2c('0x1d')](_0x57d5b0[_0xda2c('0x1f')],function(_0x59e292){return{'model':db[_0x59e292[_0xda2c('0x1e')]],'as':_0x59e292['as'],'attributes':_0x59e292[_0xda2c('0x1b')],'include':_0x59e292[_0xda2c('0x1f')]?_[_0xda2c('0x1d')](_0x59e292[_0xda2c('0x1f')],function(_0x5e2723){return{'model':db[_0x5e2723['model']],'as':_0x5e2723['as'],'attributes':_0x5e2723[_0xda2c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda2c('0x20')](function(_0x3920d1){logger[_0xda2c('0xd')](_0xda2c('0x21'),_0x4b980d);logger['debug'](_0xda2c('0x21'),_0x4b980d,JSON['stringify'](_0x3920d1));_0x11b4df(_0x3920d1);})['catch'](function(_0x175906){logger[_0xda2c('0x12')]('GetUser',_0x175906['message'],_0x4b980d);_0x299c76(_0x33ca61[_0xda2c('0x12')](0x1f4,_0x175906[_0xda2c('0x15')]));});});};exports['ShowUser']=function(_0x2da82b){var _0x4ba2cc=this;return new Promise(function(_0x39966c,_0x43ab13){return db[_0xda2c('0x17')][_0xda2c('0x22')]({'raw':_0x2da82b[_0xda2c('0x18')]?_0x2da82b['options'][_0xda2c('0x19')]===undefined?!![]:![]:!![],'where':_0x2da82b[_0xda2c('0x18')]?_0x2da82b[_0xda2c('0x18')][_0xda2c('0x1a')]||null:null,'attributes':_0x2da82b[_0xda2c('0x18')]?_0x2da82b[_0xda2c('0x18')]['attributes']||null:null,'include':_0x2da82b['options']?_0x2da82b[_0xda2c('0x18')][_0xda2c('0x1f')]?_[_0xda2c('0x1d')](_0x2da82b['options']['include'],function(_0x4dd0c4){return{'model':db[_0x4dd0c4[_0xda2c('0x1e')]],'as':_0x4dd0c4['as'],'attributes':_0x4dd0c4['attributes'],'include':_0x4dd0c4['include']?_[_0xda2c('0x1d')](_0x4dd0c4[_0xda2c('0x1f')],function(_0x6ca043){return{'model':db[_0x6ca043[_0xda2c('0x1e')]],'as':_0x6ca043['as'],'attributes':_0x6ca043['attributes'],'include':_0x6ca043[_0xda2c('0x1f')]?_[_0xda2c('0x1d')](_0x6ca043[_0xda2c('0x1f')],function(_0x282ee5){return{'model':db[_0x282ee5[_0xda2c('0x1e')]],'as':_0x282ee5['as'],'attributes':_0x282ee5[_0xda2c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda2c('0x20')](function(_0x3f1507){logger[_0xda2c('0xd')](_0xda2c('0x23'),_0x2da82b);logger[_0xda2c('0xf')](_0xda2c('0x23'),_0x2da82b,JSON['stringify'](_0x3f1507));_0x39966c(_0x3f1507);})[_0xda2c('0x16')](function(_0x5c73f6){logger[_0xda2c('0x12')](_0xda2c('0x23'),_0x5c73f6[_0xda2c('0x15')],_0x2da82b);_0x43ab13(_0x4ba2cc['error'](0x1f4,_0x5c73f6[_0xda2c('0x15')]));});});};exports[_0xda2c('0x24')]=function(_0x4b248a){var _0x477531=this;return new Promise(function(_0x3496af,_0x206b30){var _0xa454e9;return db[_0xda2c('0x17')][_0xda2c('0x22')]({'where':_0x4b248a[_0xda2c('0x18')][_0xda2c('0x1a')]||{},'attributes':['id',_0xda2c('0x25'),_0xda2c('0x26'),_0xda2c('0x27'),_0xda2c('0x28')]})[_0xda2c('0x20')](function(_0x2bc58e){if(_0x2bc58e){_0xa454e9=_0x2bc58e;return db[_0xda2c('0x29')][_0xda2c('0x2a')]({'paused':0x1},{'where':{'UserId':_0xa454e9['id']},'individualHooks':!![]});}})[_0xda2c('0x20')](function(){if(_0xa454e9){return db[_0xda2c('0x2b')][_0xda2c('0x2c')]({'where':{'membername':_0xa454e9[_0xda2c('0x25')],'type':'PAUSE','exitAt':null}});}})[_0xda2c('0x20')](function(_0x388488){if(_0xa454e9){if(_0x388488&&_0x388488[_0xda2c('0x2d')]){var _0x53fb04=moment()['format'](_0xda2c('0x2e'));for(var _0x23957c=0x0,_0x1ca677=_0x388488[_0xda2c('0x2d')];_0x23957c<_0x1ca677;_0x23957c++){_0x388488[_0x23957c][_0xda2c('0x2f')]({'exitAt':_0x53fb04});}}}})[_0xda2c('0x20')](function(){if(_0xa454e9){var _0x262cdf=[];var _0x2c4170=utils['getChannels']();_0x2c4170[_0xda2c('0x30')](function(_0x38625e){_0x262cdf['push']({'channel':_0x38625e,'membername':_0xa454e9[_0xda2c('0x25')],'interface':_[_0xda2c('0x31')](_0xa454e9[_0xda2c('0x28')])?util[_0xda2c('0x32')](_0xda2c('0x33'),_0xa454e9['name']):_0xa454e9[_0xda2c('0x28')],'type':'PAUSE','enterAt':moment()['format'](_0xda2c('0x2e')),'data1':_0x4b248a[_0xda2c('0x34')]['type']||_0xda2c('0x35'),'role':_0xa454e9[_0xda2c('0x26')],'internal':_0xa454e9[_0xda2c('0x27')],'uniqueid':_0x4b248a[_0xda2c('0x34')][_0xda2c('0x36')]||null});});return db['MemberReport'][_0xda2c('0x37')](_0x262cdf,{'individualHooks':!![]});}})[_0xda2c('0x20')](function(){if(_0xa454e9){return _0xa454e9[_0xda2c('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4b248a[_0xda2c('0x34')]['type']||_0xda2c('0x35'),'lastPauseAt':moment()['format'](_0xda2c('0x2e'))});}})['then'](function(_0x1522ce){_0x3496af(_0x1522ce);})[_0xda2c('0x16')](function(_0x4eec56){_0x206b30(_0x477531[_0xda2c('0x12')](0x1f4,_0x4eec56[_0xda2c('0x15')]));});});};exports[_0xda2c('0x38')]=function(_0x28d209){var _0x1bd6f8=this;return new Promise(function(_0x6a89b8,_0xfb28a6){var _0x3b1445;return db['User']['findOne']({'where':_0x28d209['options'][_0xda2c('0x1a')]||{},'attributes':['id','name']})[_0xda2c('0x20')](function(_0xe28f2a){if(_0xe28f2a){_0x3b1445=_0xe28f2a;if(_0x28d209[_0xda2c('0x34')]['channel']&&!utils[_0xda2c('0x39')](_0x28d209['body']['channel'])){throw new Error(_0xda2c('0x3a'));}switch(_0x28d209[_0xda2c('0x34')]['channel']){case _0xda2c('0x3b'):return db['UserVoiceQueueRt'][_0xda2c('0x2a')]({'paused':0x0},{'where':{'UserId':_0x3b1445['id']}})['then'](function(){return db['MemberReport'][_0xda2c('0x22')]({'where':{'channel':_0x28d209['body']['channel'],'membername':_0x3b1445[_0xda2c('0x25')],'type':_0xda2c('0x3c'),'exitAt':null}});})[_0xda2c('0x20')](function(_0x35814b){if(_0x35814b){return _0x35814b[_0xda2c('0x2a')]({'exitAt':moment()[_0xda2c('0x32')](_0xda2c('0x2e')),'data2':_0xda2c('0x3d')},{'individualHooks':!![]});}return null;})[_0xda2c('0x20')](function(){return _0x3b1445[_0xda2c('0x2a')]({'voicePause':![]});});case _0xda2c('0x3e'):case'chat':case _0xda2c('0x3f'):case _0xda2c('0x40'):case'openchannel':case'whatsapp':return db[_0xda2c('0x2b')]['find']({'where':{'channel':_0x28d209[_0xda2c('0x34')][_0xda2c('0x41')],'membername':_0x3b1445[_0xda2c('0x25')],'type':'PAUSE','exitAt':null}})['then'](function(_0x1021e6){return _0x1021e6[_0xda2c('0x2a')]({'exitAt':moment()[_0xda2c('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xda2c('0x3d')},{'individualHooks':!![]});})['then'](function(){var _0x5da266={};_[_0xda2c('0x42')](_0x5da266,util[_0xda2c('0x32')](_0xda2c('0x43'),_0x28d209['body']['channel'],_0xda2c('0x44')),![]);return _0x3b1445['update'](_0x5da266);});default:return db[_0xda2c('0x29')][_0xda2c('0x2a')]({'paused':0x0},{'where':{'UserId':_0x3b1445['id']}})['then'](function(){return db[_0xda2c('0x2b')][_0xda2c('0x2c')]({'where':{'membername':_0x3b1445[_0xda2c('0x25')],'type':_0xda2c('0x3c'),'exitAt':null}});})[_0xda2c('0x20')](function(_0x39b682){var _0x1bf8a0=[];_0x39b682[_0xda2c('0x30')](function(_0x24d065){_0x1bf8a0[_0xda2c('0x45')](_0x24d065[_0xda2c('0x2a')]({'exitAt':moment()[_0xda2c('0x32')](_0xda2c('0x2e')),'data2':_0xda2c('0x3d')}));});return BPromise[_0xda2c('0x46')](_0x1bf8a0);})[_0xda2c('0x20')](function(){return _0x3b1445['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xda2c('0x20')](function(_0x10f683){_0x6a89b8(_0x10f683);})[_0xda2c('0x16')](function(_0x4fc32d){_0xfb28a6(_0x1bd6f8['error'](0x1f4,_0x4fc32d[_0xda2c('0x15')]));});});};exports[_0xda2c('0x47')]=function(_0x5a4362){var _0x49b934=this;return new Promise(function(_0x4bfede,_0x11bc96){var _0x10b90d;return db[_0xda2c('0x17')]['findOne']({'where':_0x5a4362[_0xda2c('0x18')]['where']||{},'attributes':['id',_0xda2c('0x25')]})[_0xda2c('0x20')](function(_0x560afd){if(_0x560afd){_0x10b90d=_0x560afd;return db[_0xda2c('0x29')][_0xda2c('0x48')]({'where':{'membername':_0x10b90d[_0xda2c('0x25')]},'individualHooks':!![]});}})[_0xda2c('0x20')](function(){if(_0x10b90d){return db[_0xda2c('0x2b')][_0xda2c('0x2c')]({'where':{'membername':_0x10b90d['name'],'exitAt':null}});}})[_0xda2c('0x20')](function(_0x42871f){if(_0x10b90d){if(_0x42871f&&_0x42871f[_0xda2c('0x2d')]){var _0x4ea42a=[];_0x42871f[_0xda2c('0x30')](function(_0x27ef23){_0x4ea42a['push'](_0x27ef23['update']({'exitAt':moment()[_0xda2c('0x32')](_0xda2c('0x2e'))}));});return BPromise['all'](_0x4ea42a);}}})[_0xda2c('0x20')](function(){if(_0x10b90d){return _0x10b90d['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xda2c('0x20')](function(_0x5cfe53){_0x4bfede(_0x5cfe53);})[_0xda2c('0x16')](function(_0x18d212){_0x11bc96(_0x49b934['error'](0x1f4,_0x18d212[_0xda2c('0x15')]));});});};exports[_0xda2c('0x49')]=function(_0x5c00a3){var _0x39cad6=this;return new Promise(function(_0x58787d,_0x9b3527){var _0x3e1fb1;var _0x27b927;var _0x5eaae6;var _0x424e3e;return db[_0xda2c('0x17')][_0xda2c('0x4a')]({'where':_0x5c00a3[_0xda2c('0x18')]['where']||{},'attributes':['id',_0xda2c('0x25'),_0xda2c('0x26'),_0xda2c('0x4b'),'phone','internal',_0xda2c('0x4c'),_0xda2c('0x28')]})['then'](function(_0x28eb38){if(_0x28eb38){_0x3e1fb1=_0x28eb38;_0x424e3e=_0x5c00a3[_0xda2c('0x34')]['interface']?_0x5c00a3[_0xda2c('0x34')][_0xda2c('0x28')]:util[_0xda2c('0x32')](_0xda2c('0x33'),_0x3e1fb1[_0xda2c('0x25')]);return db[_0xda2c('0x17')][_0xda2c('0x4d')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3e1fb1['id']}}});}})['then'](function(_0x3373db){if(_0x3373db){_0x5eaae6=_0x3373db;return require(_0xda2c('0x4e'))[_0xda2c('0x4f')]();}})['then'](function(_0x5eb1ea){if(_0x5eb1ea&&_0x5eb1ea[_0xda2c('0x50')]&&_0x5eaae6>=_0x5eb1ea[_0xda2c('0x50')]){throw new Error(_0xda2c('0x51'));}})['then'](function(){if(_0x3e1fb1){return db[_0xda2c('0x29')][_0xda2c('0x48')]({'where':{'membername':_0x3e1fb1[_0xda2c('0x25')]},'individualHooks':!![]});}})[_0xda2c('0x20')](function(){if(_0x3e1fb1){return _0x3e1fb1[_0xda2c('0x52')]({'raw':!![]});}})[_0xda2c('0x20')](function(_0x44ff5d){if(_0x3e1fb1){if(_0x44ff5d){var _0x51adaf=[];_0x27b927=_0x44ff5d;if(_0x27b927['length']){for(var _0x514c9b=0x0;_0x514c9b<_0x27b927[_0xda2c('0x2d')];_0x514c9b++){_0x51adaf['push'](db['UserVoiceQueueRt'][_0xda2c('0x53')]({'membername':_0x3e1fb1[_0xda2c('0x25')],'UserId':_0x3e1fb1['id'],'queue_name':_0x27b927[_0x514c9b][_0xda2c('0x25')],'VoiceQueueId':_0x27b927[_0x514c9b]['id'],'interface':_0x424e3e,'paused':_0x3e1fb1[_0xda2c('0x4c')]||![],'penalty':_0x27b927[_0x514c9b][_0xda2c('0x54')]||0x0}));}return BPromise[_0xda2c('0x46')](_0x51adaf);}}}})[_0xda2c('0x20')](function(){if(_0x3e1fb1){return db[_0xda2c('0x2b')][_0xda2c('0x2c')]({'where':{'membername':_0x3e1fb1['name'],'exitAt':null}});}})[_0xda2c('0x20')](function(_0x796fda){if(_0x3e1fb1){if(_0x796fda&&_0x796fda[_0xda2c('0x2d')]){var _0x4c204a=[];_0x796fda[_0xda2c('0x30')](function(_0x193ae1){_0x4c204a[_0xda2c('0x45')](_0x193ae1[_0xda2c('0x2a')]({'exitAt':moment()[_0xda2c('0x32')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xda2c('0x46')](_0x4c204a);}}})[_0xda2c('0x20')](function(_0x104f61){if(_0x3e1fb1){var _0x416640=[];var _0x2f5156=[];var _0x37db7f=utils[_0xda2c('0x55')]();var _0x2aaae8={'membername':_0x3e1fb1[_0xda2c('0x25')],'interface':_0x424e3e,'enterAt':moment()[_0xda2c('0x32')](_0xda2c('0x2e')),'role':_0x3e1fb1['role'],'internal':_0x3e1fb1[_0xda2c('0x27')]};_0x37db7f[_0xda2c('0x30')](function(_0x2ab17b){_0x416640['push'](_['merge']({'channel':_0x2ab17b,'type':_0xda2c('0x56'),'data1':_0xda2c('0x57'),'data2':_0x424e3e},_0x2aaae8));if(_0x3e1fb1['loginInPause']){_0x2f5156[_0xda2c('0x45')](_[_0xda2c('0x58')]({'channel':_0x2ab17b,'type':_0xda2c('0x3c'),'data1':_0xda2c('0x59')},_0x2aaae8));}});return db[_0xda2c('0x2b')][_0xda2c('0x37')](_0x416640[_0xda2c('0x5a')](_0x2f5156),{'individualHooks':!![]});}})[_0xda2c('0x20')](function(){if(_0x3e1fb1){return _0x3e1fb1[_0xda2c('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xda2c('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3e1fb1[_0xda2c('0x4c')]||![],'mailPause':_0x3e1fb1[_0xda2c('0x4c')]||![],'chatPause':_0x3e1fb1[_0xda2c('0x4c')]||![],'faxPause':_0x3e1fb1['loginInPause']||![],'smsPause':_0x3e1fb1[_0xda2c('0x4c')]||![],'openchannelPause':_0x3e1fb1[_0xda2c('0x4c')]||![],'pauseType':_0x3e1fb1[_0xda2c('0x4c')]?_0xda2c('0x59'):null,'lastPauseAt':moment()[_0xda2c('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x424e3e});}})[_0xda2c('0x20')](function(_0x284e90){_0x58787d(_0x284e90);})[_0xda2c('0x16')](function(_0x328628){_0x9b3527(_0x39cad6[_0xda2c('0x12')](0x1f4,_0x328628[_0xda2c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7be531d..4d855dc 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8000=['emit','length','./user.events','save','update'];(function(_0x35fac6,_0x10b30e){var _0x117c82=function(_0x4770c3){while(--_0x4770c3){_0x35fac6['push'](_0x35fac6['shift']());}};_0x117c82(++_0x10b30e);}(_0x8000,0xca));var _0x0800=function(_0x3df0fa,_0x5418e8){_0x3df0fa=_0x3df0fa-0x0;var _0x1c1bbf=_0x8000[_0x3df0fa];return _0x1c1bbf;};'use strict';var UserEvents=require(_0x0800('0x0'));var events=[_0x0800('0x1'),'remove',_0x0800('0x2')];function createListener(_0x2f495e,_0x2ab220){return function(_0x2e68ec){_0x2ab220[_0x0800('0x3')](_0x2f495e,_0x2e68ec);};}function removeListener(_0x26fa51,_0xe543f3){return function(){UserEvents['removeListener'](_0x26fa51,_0xe543f3);};}exports['register']=function(_0x40e069){for(var _0x3ae58b=0x0,_0x1a4873=events[_0x0800('0x4')];_0x3ae58b<_0x1a4873;_0x3ae58b++){var _0x3ec335=events[_0x3ae58b];var _0x1744c9=createListener('user:'+_0x3ec335,_0x40e069);UserEvents['on'](_0x3ec335,_0x1744c9);}}; \ No newline at end of file +var _0x3290=['length','user:','./user.events','save','remove','update','removeListener','register'];(function(_0x4283e9,_0x55c057){var _0x4e4c67=function(_0x3c700c){while(--_0x3c700c){_0x4283e9['push'](_0x4283e9['shift']());}};_0x4e4c67(++_0x55c057);}(_0x3290,0x1a2));var _0x0329=function(_0x48e029,_0x5da014){_0x48e029=_0x48e029-0x0;var _0x20feaf=_0x3290[_0x48e029];return _0x20feaf;};'use strict';var UserEvents=require(_0x0329('0x0'));var events=[_0x0329('0x1'),_0x0329('0x2'),_0x0329('0x3')];function createListener(_0x337f4f,_0x4fd55a){return function(_0x4fc49f){_0x4fd55a['emit'](_0x337f4f,_0x4fc49f);};}function removeListener(_0x69a3f5,_0xf7805f){return function(){UserEvents[_0x0329('0x4')](_0x69a3f5,_0xf7805f);};}exports[_0x0329('0x5')]=function(_0x462fdb){for(var _0x1afd6f=0x0,_0x1f84fb=events[_0x0329('0x6')];_0x1afd6f<_0x1f84fb;_0x1afd6f++){var _0x27e8c9=events[_0x1afd6f];var _0x5147a1=createListener(_0x0329('0x7')+_0x27e8c9,_0x462fdb);UserEvents['on'](_0x27e8c9,_0x5147a1);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 5ba8f94..eec3f99 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x693f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x4637a9,_0x36ccdb){var _0x2b5179=function(_0x1df93a){while(--_0x1df93a){_0x4637a9['push'](_0x4637a9['shift']());}};_0x2b5179(++_0x36ccdb);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var path=require(_0xf693('0x2'));var timeout=require(_0xf693('0x3'));var express=require('express');var router=express[_0xf693('0x4')]();var fs_extra=require(_0xf693('0x5'));var auth=require(_0xf693('0x6'));var interaction=require(_0xf693('0x7'));var config=require(_0xf693('0x8'));module[_0xf693('0x9')]=router; \ No newline at end of file +var _0xb12d=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express','fs-extra'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xb12d,0x124));var _0xdb12=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xb12d[_0x3718b7];return _0xf8c91e;};'use strict';var multer=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var path=require(_0xdb12('0x2'));var timeout=require('connect-timeout');var express=require(_0xdb12('0x3'));var router=express['Router']();var fs_extra=require(_0xdb12('0x4'));var auth=require(_0xdb12('0x5'));var interaction=require(_0xdb12('0x6'));var config=require(_0xdb12('0x7'));module[_0xdb12('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index fbfc736..0a60933 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['sequelize','INTEGER'];(function(_0x479ea9,_0x426cea){var _0x26ffa4=function(_0x30cc38){while(--_0x30cc38){_0x479ea9['push'](_0x479ea9['shift']());}};_0x26ffa4(++_0x426cea);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d2f15,_0x1107c6){_0x1d2f15=_0x1d2f15-0x0;var _0x19efd2=_0xb10b[_0x1d2f15];return _0x19efd2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x34178d,_0x26dbc9){var _0x36e32e=function(_0x1248ce){while(--_0x1248ce){_0x34178d['push'](_0x34178d['shift']());}};_0x36e32e(++_0x26dbc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 736a4ac..6eeb191 100644 --- a/server/api/userChatQueue/userChatQueue.model.js +++ b/server/api/userChatQueue/userChatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11d5=['../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x4a5c16,_0x2eb3c4){var _0x4c9004=function(_0x207a76){while(--_0x207a76){_0x4a5c16['push'](_0x4a5c16['shift']());}};_0x4c9004(++_0x2eb3c4);}(_0x11d5,0x130));var _0x511d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x11d5[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x511d('0x0'));var util=require(_0x511d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x511d('0x2'));var BPromise=require(_0x511d('0x3'));var rp=require(_0x511d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x511d('0x5'));var config=require(_0x511d('0x6'));var attributes=require(_0x511d('0x7'));module['exports']=function(_0x1c1bb6,_0x1dc190){return _0x1c1bb6[_0x511d('0x8')](_0x511d('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8654=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','util','../../config/logger'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8654,0xfa));var _0x4865=function(_0x3c7802,_0x57ec30){_0x3c7802=_0x3c7802-0x0;var _0x5db8f7=_0x8654[_0x3c7802];return _0x5db8f7;};'use strict';var _=require('lodash');var util=require(_0x4865('0x0'));var logger=require(_0x4865('0x1'))(_0x4865('0x2'));var moment=require(_0x4865('0x3'));var BPromise=require(_0x4865('0x4'));var rp=require(_0x4865('0x5'));var fs=require('fs');var path=require(_0x4865('0x6'));var rimraf=require(_0x4865('0x7'));var config=require(_0x4865('0x8'));var attributes=require(_0x4865('0x9'));module['exports']=function(_0x34d3b3,_0x1bf9b1){return _0x34d3b3[_0x4865('0xa')](_0x4865('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index c3b7e18..4b5947d 100644 --- a/server/api/userChatQueue/userChatQueue.rpc.js +++ b/server/api/userChatQueue/userChatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0068=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x586af3,_0x225c2){var _0x25e557=function(_0x43be17){while(--_0x43be17){_0x586af3['push'](_0x586af3['shift']());}};_0x25e557(++_0x225c2);}(_0x0068,0x15a));var _0x8006=function(_0x28d434,_0x2d2610){_0x28d434=_0x28d434-0x0;var _0x1109c6=_0x0068[_0x28d434];return _0x1109c6;};'use strict';var _=require(_0x8006('0x0'));var util=require(_0x8006('0x1'));var moment=require(_0x8006('0x2'));var BPromise=require('bluebird');var rs=require(_0x8006('0x3'));var fs=require('fs');var Redis=require(_0x8006('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8006('0x5'))(_0x8006('0x6'));var config=require(_0x8006('0x7'));var jayson=require(_0x8006('0x8'));var client=jayson[_0x8006('0x9')][_0x8006('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7caef2,_0x29297f,_0x13f5bb){return new BPromise(function(_0x29a520,_0x1c2a28){return client['request'](_0x7caef2,_0x13f5bb)[_0x8006('0xb')](function(_0x415a12){logger[_0x8006('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x29297f,_0x8006('0xd'));logger['debug'](_0x8006('0xe'),_0x29297f,_0x8006('0xd'),JSON['stringify'](_0x415a12));if(_0x415a12[_0x8006('0xf')]){if(_0x415a12['error']['code']===0x1f4){logger[_0x8006('0xf')](_0x8006('0x10'),_0x29297f,_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);return _0x1c2a28(_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);}logger['error'](_0x8006('0x10'),_0x29297f,_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);return _0x29a520(_0x415a12[_0x8006('0xf')][_0x8006('0x11')]);}else{logger['info'](_0x8006('0x10'),_0x29297f,_0x8006('0xd'));_0x29a520(_0x415a12[_0x8006('0x12')][_0x8006('0x11')]);}})[_0x8006('0x13')](function(_0x4d8d5c){logger[_0x8006('0xf')](_0x8006('0x10'),_0x29297f,_0x4d8d5c);_0x1c2a28(_0x4d8d5c);});});} \ No newline at end of file +var _0xc9f1=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0xc9f1,0x152));var _0x1c9f=function(_0x2464bf,_0x40719b){_0x2464bf=_0x2464bf-0x0;var _0x3e5fd8=_0xc9f1[_0x2464bf];return _0x3e5fd8;};'use strict';var _=require('lodash');var util=require(_0x1c9f('0x0'));var moment=require(_0x1c9f('0x1'));var BPromise=require(_0x1c9f('0x2'));var rs=require(_0x1c9f('0x3'));var fs=require('fs');var Redis=require(_0x1c9f('0x4'));var db=require(_0x1c9f('0x5'))['db'];var utils=require(_0x1c9f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1c9f('0x7'));var jayson=require(_0x1c9f('0x8'));var client=jayson[_0x1c9f('0x9')][_0x1c9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35d504,_0x274cdf,_0x103cdd){return new BPromise(function(_0x126585,_0x4770db){return client[_0x1c9f('0xb')](_0x35d504,_0x103cdd)['then'](function(_0x4b7bcd){logger['info'](_0x1c9f('0xc'),_0x274cdf,_0x1c9f('0xd'));logger[_0x1c9f('0xe')](_0x1c9f('0xf'),_0x274cdf,_0x1c9f('0xd'),JSON['stringify'](_0x4b7bcd));if(_0x4b7bcd[_0x1c9f('0x10')]){if(_0x4b7bcd[_0x1c9f('0x10')][_0x1c9f('0x11')]===0x1f4){logger[_0x1c9f('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x274cdf,_0x4b7bcd['error']['message']);return _0x4770db(_0x4b7bcd['error'][_0x1c9f('0x12')]);}logger[_0x1c9f('0x10')](_0x1c9f('0xc'),_0x274cdf,_0x4b7bcd[_0x1c9f('0x10')][_0x1c9f('0x12')]);return _0x126585(_0x4b7bcd[_0x1c9f('0x10')][_0x1c9f('0x12')]);}else{logger[_0x1c9f('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x274cdf,_0x1c9f('0xd'));_0x126585(_0x4b7bcd[_0x1c9f('0x14')][_0x1c9f('0x12')]);}})[_0x1c9f('0x15')](function(_0x4d0aa0){logger[_0x1c9f('0x10')](_0x1c9f('0xc'),_0x274cdf,_0x4d0aa0);_0x4770db(_0x4d0aa0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c63584d..1aeb482 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['../../config/environment','util','path','fs-extra','../../components/interaction/service'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0xda3f,0xec));var _0xfda3=function(_0x319a34,_0x4db06){_0x319a34=_0x319a34-0x0;var _0x23234c=_0xda3f[_0x319a34];return _0x23234c;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));module['exports']=router; \ No newline at end of file +var _0x878f=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x415a70,_0x216c4b){var _0x4d9774=function(_0x244a28){while(--_0x244a28){_0x415a70['push'](_0x415a70['shift']());}};_0x4d9774(++_0x216c4b);}(_0x878f,0x173));var _0xf878=function(_0x48597d,_0xff077f){_0x48597d=_0x48597d-0x0;var _0x1563aa=_0x878f[_0x48597d];return _0x1563aa;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));module[_0xf878('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ccc701e..6604a47 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['INTEGER','STRING','sequelize','exports'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3544a2,_0xe1a949){_0x3544a2=_0x3544a2-0x0;var _0x3e2cad=_0x9ffd[_0x3544a2];return _0x3e2cad;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'penalty':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd9ff('0x3')]}}; \ No newline at end of file +var _0x7916=['sequelize','INTEGER'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x7916,0x128));var _0x6791=function(_0x2d518d,_0x4e74a7){_0x2d518d=_0x2d518d-0x0;var _0x46da35=_0x7916[_0x2d518d];return _0x46da35;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f42fdf3..1bb9d17 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3da5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','api'];(function(_0x5ed21f,_0x24e6c6){var _0x18a335=function(_0x29dd35){while(--_0x29dd35){_0x5ed21f['push'](_0x5ed21f['shift']());}};_0x18a335(++_0x24e6c6);}(_0x3da5,0x131));var _0x53da=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x3da5[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x53da('0x0'));var util=require(_0x53da('0x1'));var logger=require('../../config/logger')(_0x53da('0x2'));var moment=require(_0x53da('0x3'));var BPromise=require(_0x53da('0x4'));var rp=require(_0x53da('0x5'));var fs=require('fs');var path=require(_0x53da('0x6'));var rimraf=require(_0x53da('0x7'));var config=require(_0x53da('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x53da('0x9')]=function(_0x264b50,_0x1a6f40){return _0x264b50[_0x53da('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5269=['lodash','bluebird','request-promise','path','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues'];(function(_0x46f419,_0x5f8270){var _0x71cf35=function(_0x26156f){while(--_0x26156f){_0x46f419['push'](_0x46f419['shift']());}};_0x71cf35(++_0x5f8270);}(_0x5269,0x150));var _0x9526=function(_0x6a29da,_0x15b849){_0x6a29da=_0x6a29da-0x0;var _0x536e48=_0x5269[_0x6a29da];return _0x536e48;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9526('0x1'));var rp=require(_0x9526('0x2'));var fs=require('fs');var path=require(_0x9526('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9526('0x4'));module['exports']=function(_0x15d394,_0x9cf5eb){return _0x15d394[_0x9526('0x5')](_0x9526('0x6'),attributes,{'tableName':_0x9526('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index b9edbe0..b5d7e32 100644 --- a/server/api/userFaxQueue/userFaxQueue.rpc.js +++ b/server/api/userFaxQueue/userFaxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cbc=['../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x248c00,_0x4f5e0f){var _0x716e84=function(_0x223f63){while(--_0x223f63){_0x248c00['push'](_0x248c00['shift']());}};_0x716e84(++_0x4f5e0f);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0x1cbc[_0x2a6fd5];return _0x43c6a4;};'use strict';var _=require(_0xc1cb('0x0'));var util=require('util');var moment=require(_0xc1cb('0x1'));var BPromise=require(_0xc1cb('0x2'));var rs=require(_0xc1cb('0x3'));var fs=require('fs');var Redis=require(_0xc1cb('0x4'));var db=require(_0xc1cb('0x5'))['db'];var utils=require(_0xc1cb('0x6'));var logger=require(_0xc1cb('0x7'))(_0xc1cb('0x8'));var config=require(_0xc1cb('0x9'));var jayson=require(_0xc1cb('0xa'));var client=jayson[_0xc1cb('0xb')][_0xc1cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56f1c8,_0x1735ab,_0x54cd03){return new BPromise(function(_0xe5da07,_0x271f7d){return client['request'](_0x56f1c8,_0x54cd03)[_0xc1cb('0xd')](function(_0xb3fff7){logger[_0xc1cb('0xe')](_0xc1cb('0xf'),_0x1735ab,_0xc1cb('0x10'));logger[_0xc1cb('0x11')](_0xc1cb('0x12'),_0x1735ab,_0xc1cb('0x10'),JSON['stringify'](_0xb3fff7));if(_0xb3fff7[_0xc1cb('0x13')]){if(_0xb3fff7['error'][_0xc1cb('0x14')]===0x1f4){logger[_0xc1cb('0x13')](_0xc1cb('0xf'),_0x1735ab,_0xb3fff7[_0xc1cb('0x13')][_0xc1cb('0x15')]);return _0x271f7d(_0xb3fff7[_0xc1cb('0x13')][_0xc1cb('0x15')]);}logger['error'](_0xc1cb('0xf'),_0x1735ab,_0xb3fff7[_0xc1cb('0x13')][_0xc1cb('0x15')]);return _0xe5da07(_0xb3fff7[_0xc1cb('0x13')]['message']);}else{logger[_0xc1cb('0xe')](_0xc1cb('0xf'),_0x1735ab,'request\x20sent');_0xe5da07(_0xb3fff7['result'][_0xc1cb('0x15')]);}})[_0xc1cb('0x16')](function(_0xc10170){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1735ab,_0xc10170);_0x271f7d(_0xc10170);});});} \ No newline at end of file +var _0x34a5=['stringify','error','message','info','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34a5,0xc2));var _0x534a=function(_0x3897dc,_0x4d89ec){_0x3897dc=_0x3897dc-0x0;var _0x2a93b7=_0x34a5[_0x3897dc];return _0x2a93b7;};'use strict';var _=require(_0x534a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x534a('0x1'));var fs=require('fs');var Redis=require(_0x534a('0x2'));var db=require(_0x534a('0x3'))['db'];var utils=require(_0x534a('0x4'));var logger=require(_0x534a('0x5'))(_0x534a('0x6'));var config=require(_0x534a('0x7'));var jayson=require(_0x534a('0x8'));var client=jayson[_0x534a('0x9')][_0x534a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27b2cd,_0x31a4e7,_0x167ea5){return new BPromise(function(_0x3c85e8,_0x10ebcc){return client['request'](_0x27b2cd,_0x167ea5)[_0x534a('0xb')](function(_0x3d86ff){logger['info'](_0x534a('0xc'),_0x31a4e7,_0x534a('0xd'));logger[_0x534a('0xe')](_0x534a('0xf'),_0x31a4e7,_0x534a('0xd'),JSON[_0x534a('0x10')](_0x3d86ff));if(_0x3d86ff[_0x534a('0x11')]){if(_0x3d86ff[_0x534a('0x11')]['code']===0x1f4){logger[_0x534a('0x11')](_0x534a('0xc'),_0x31a4e7,_0x3d86ff['error'][_0x534a('0x12')]);return _0x10ebcc(_0x3d86ff[_0x534a('0x11')][_0x534a('0x12')]);}logger[_0x534a('0x11')](_0x534a('0xc'),_0x31a4e7,_0x3d86ff['error'][_0x534a('0x12')]);return _0x3c85e8(_0x3d86ff[_0x534a('0x11')][_0x534a('0x12')]);}else{logger[_0x534a('0x13')](_0x534a('0xc'),_0x31a4e7,_0x534a('0xd'));_0x3c85e8(_0x3d86ff[_0x534a('0x14')][_0x534a('0x12')]);}})['catch'](function(_0x4f2a7d){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x31a4e7,_0x4f2a7d);_0x10ebcc(_0x4f2a7d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5d6711b..8aaad67 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6ed=['multer','path','connect-timeout','express','../../components/auth/service','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x3cd7fb,_0x4a14da){_0x3cd7fb=_0x3cd7fb-0x0;var _0x3cfd4b=_0xf6ed[_0x3cd7fb];return _0x3cfd4b;};'use strict';var multer=require(_0xdf6e('0x0'));var util=require('util');var path=require(_0xdf6e('0x1'));var timeout=require(_0xdf6e('0x2'));var express=require(_0xdf6e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdf6e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdf6e('0x5')]=router; \ No newline at end of file +var _0xd139=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17fd72,_0x2b8254){var _0xa8d8c6=function(_0x12bb6d){while(--_0x12bb6d){_0x17fd72['push'](_0x17fd72['shift']());}};_0xa8d8c6(++_0x2b8254);}(_0xd139,0x14e));var _0x9d13=function(_0x11fc17,_0x59ab4f){_0x11fc17=_0x11fc17-0x0;var _0x36645d=_0xd139[_0x11fc17];return _0x36645d;};'use strict';var multer=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9d13('0x2'));var router=express[_0x9d13('0x3')]();var fs_extra=require(_0x9d13('0x4'));var auth=require(_0x9d13('0x5'));var interaction=require(_0x9d13('0x6'));var config=require(_0x9d13('0x7'));module[_0x9d13('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 065527b..ad1f262 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1a3c7d,_0x1d871d){var _0x2134ed=function(_0x2b99dc){while(--_0x2b99dc){_0x1a3c7d['push'](_0x1a3c7d['shift']());}};_0x2134ed(++_0x1d871d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 22e03a3..2bb072e 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x3ff703,_0x56f6cb){var _0x500d02=function(_0xf852f4){while(--_0xf852f4){_0x3ff703['push'](_0x3ff703['shift']());}};_0x500d02(++_0x56f6cb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb7e7[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x193d18,_0x372422){var _0x27b830=function(_0x27ff1b){while(--_0x27ff1b){_0x193d18['push'](_0x193d18['shift']());}};_0x27b830(++_0x372422);}(_0xe706,0xa3));var _0x6e70=function(_0xb95e68,_0x46fea5){_0xb95e68=_0xb95e68-0x0;var _0x274df0=_0xe706[_0xb95e68];return _0x274df0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e8da556..37f2fba 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b0a=['util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x66da2e,_0x286aaf){var _0x1f232d=function(_0x250db3){while(--_0x250db3){_0x66da2e['push'](_0x66da2e['shift']());}};_0x1f232d(++_0x286aaf);}(_0x2b0a,0x84));var _0xa2b0=function(_0x4b2b2d,_0x55f1e5){_0x4b2b2d=_0x4b2b2d-0x0;var _0xf90dcb=_0x2b0a[_0x4b2b2d];return _0xf90dcb;};'use strict';var _=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var moment=require('moment');var BPromise=require(_0xa2b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa2b0('0x3'))(_0xa2b0('0x4'));var config=require(_0xa2b0('0x5'));var jayson=require(_0xa2b0('0x6'));var client=jayson[_0xa2b0('0x7')][_0xa2b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ea48a,_0x5dd8e5,_0x2e1c2a){return new BPromise(function(_0x5e5b24,_0x53be2f){return client[_0xa2b0('0x9')](_0x5ea48a,_0x2e1c2a)[_0xa2b0('0xa')](function(_0x336127){logger[_0xa2b0('0xb')](_0xa2b0('0xc'),_0x5dd8e5,_0xa2b0('0xd'));logger['debug'](_0xa2b0('0xe'),_0x5dd8e5,_0xa2b0('0xd'),JSON[_0xa2b0('0xf')](_0x336127));if(_0x336127['error']){if(_0x336127[_0xa2b0('0x10')][_0xa2b0('0x11')]===0x1f4){logger['error'](_0xa2b0('0xc'),_0x5dd8e5,_0x336127['error'][_0xa2b0('0x12')]);return _0x53be2f(_0x336127[_0xa2b0('0x10')][_0xa2b0('0x12')]);}logger[_0xa2b0('0x10')](_0xa2b0('0xc'),_0x5dd8e5,_0x336127[_0xa2b0('0x10')][_0xa2b0('0x12')]);return _0x5e5b24(_0x336127[_0xa2b0('0x10')][_0xa2b0('0x12')]);}else{logger[_0xa2b0('0xb')](_0xa2b0('0xc'),_0x5dd8e5,_0xa2b0('0xd'));_0x5e5b24(_0x336127['result']['message']);}})['catch'](function(_0xe2ed83){logger['error'](_0xa2b0('0xc'),_0x5dd8e5,_0xe2ed83);_0x53be2f(_0xe2ed83);});});} \ No newline at end of file +var _0x3975=['debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x3975,0x197));var _0x5397=function(_0x1b2675,_0x728ddb){_0x1b2675=_0x1b2675-0x0;var _0x196efc=_0x3975[_0x1b2675];return _0x196efc;};'use strict';var _=require(_0x5397('0x0'));var util=require(_0x5397('0x1'));var moment=require('moment');var BPromise=require(_0x5397('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5397('0x3'))['db'];var utils=require(_0x5397('0x4'));var logger=require('../../config/logger')(_0x5397('0x5'));var config=require(_0x5397('0x6'));var jayson=require(_0x5397('0x7'));var client=jayson[_0x5397('0x8')][_0x5397('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x286060,_0x3a85a0,_0x183e24){return new BPromise(function(_0x18af5f,_0x49876f){return client['request'](_0x286060,_0x183e24)[_0x5397('0xa')](function(_0x5ef45b){logger[_0x5397('0xb')]('UserMailQueue,\x20%s,\x20%s',_0x3a85a0,_0x5397('0xc'));logger[_0x5397('0xd')](_0x5397('0xe'),_0x3a85a0,_0x5397('0xc'),JSON[_0x5397('0xf')](_0x5ef45b));if(_0x5ef45b[_0x5397('0x10')]){if(_0x5ef45b[_0x5397('0x10')][_0x5397('0x11')]===0x1f4){logger[_0x5397('0x10')](_0x5397('0x12'),_0x3a85a0,_0x5ef45b[_0x5397('0x10')]['message']);return _0x49876f(_0x5ef45b[_0x5397('0x10')][_0x5397('0x13')]);}logger['error'](_0x5397('0x12'),_0x3a85a0,_0x5ef45b['error'][_0x5397('0x13')]);return _0x18af5f(_0x5ef45b[_0x5397('0x10')]['message']);}else{logger[_0x5397('0xb')](_0x5397('0x12'),_0x3a85a0,_0x5397('0xc'));_0x18af5f(_0x5ef45b['result'][_0x5397('0x13')]);}})[_0x5397('0x14')](function(_0x1972bc){logger[_0x5397('0x10')](_0x5397('0x12'),_0x3a85a0,_0x1972bc);_0x49876f(_0x1972bc);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a4481a7..8130c3b 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34ff=['sendUserNotification','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0x9fe970,_0x2e9f2e){var _0x2256d0=function(_0x50f677){while(--_0x50f677){_0x9fe970['push'](_0x9fe970['shift']());}};_0x2256d0(++_0x2e9f2e);}(_0x34ff,0x91));var _0xf34f=function(_0x50c21b,_0x4532d0){_0x50c21b=_0x50c21b-0x0;var _0x20efc2=_0x34ff[_0x50c21b];return _0x20efc2;};'use strict';var multer=require(_0xf34f('0x0'));var util=require('util');var path=require(_0xf34f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf34f('0x2'));var router=express[_0xf34f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf34f('0x4'));var interaction=require(_0xf34f('0x5'));var config=require('../../config/environment');var controller=require(_0xf34f('0x6'));router[_0xf34f('0x7')]('/',auth['isAuthenticated'](),controller[_0xf34f('0x8')]);module['exports']=router; \ No newline at end of file +var _0x57a4=['fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','sendUserNotification','multer','util','Router'];(function(_0x4178d7,_0x1b800d){var _0x9ee11c=function(_0x5c719e){while(--_0x5c719e){_0x4178d7['push'](_0x4178d7['shift']());}};_0x9ee11c(++_0x1b800d);}(_0x57a4,0x84));var _0x457a=function(_0x1d297a,_0x387665){_0x1d297a=_0x1d297a-0x0;var _0x5d2f48=_0x57a4[_0x1d297a];return _0x5d2f48;};'use strict';var multer=require(_0x457a('0x0'));var util=require(_0x457a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x457a('0x2')]();var fs_extra=require(_0x457a('0x3'));var auth=require(_0x457a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x457a('0x5'));var controller=require(_0x457a('0x6'));router[_0x457a('0x7')]('/',auth['isAuthenticated'](),controller[_0x457a('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 6524a7b..cc233fa 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2926=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5303cf,_0x44450c){var _0xfa81a8=function(_0x439417){while(--_0x439417){_0x5303cf['push'](_0x5303cf['shift']());}};_0xfa81a8(++_0x44450c);}(_0x2926,0xd4));var _0x6292=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x2926[_0x24697b];return _0x585b99;};'use strict';var Sequelize=require(_0x6292('0x0'));module[_0x6292('0x1')]={'body':{'type':Sequelize[_0x6292('0x2')]},'senderName':{'type':Sequelize[_0x6292('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x6292('0x3')]},'beep':{'type':Sequelize[_0x6292('0x4')]}}; \ No newline at end of file +var _0x27a0=['exports','TEXT','STRING'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x27a0,0x1d4));var _0x027a=function(_0x2e4531,_0x86061a){_0x2e4531=_0x2e4531-0x0;var _0x454b60=_0x27a0[_0x2e4531];return _0x454b60;};'use strict';var Sequelize=require('sequelize');module[_0x027a('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x027a('0x1')]},'recipientsDescription':{'type':Sequelize[_0x027a('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9e7054b..163b2d7 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3996=['User','union','ids','queue','replace','Queue','push','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','name','render','merge','body','contact','message','agent','account','sendUserNotification','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','some','includes','model','toLowerCase','senderName','user','fullname','isEmpty','recipientsDescription','beep','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase'];(function(_0x1abbd1,_0x26581f){var _0x41a7f2=function(_0x3e8820){while(--_0x3e8820){_0x1abbd1['push'](_0x1abbd1['shift']());}};_0x41a7f2(++_0x26581f);}(_0x3996,0x144));var _0x6399=function(_0x3bd466,_0x4e3d68){_0x3bd466=_0x3bd466-0x0;var _0x3778c0=_0x3996[_0x3bd466];return _0x3778c0;};'use strict';var emlformat=require(_0x6399('0x0'));var rimraf=require(_0x6399('0x1'));var zipdir=require(_0x6399('0x2'));var jsonpatch=require(_0x6399('0x3'));var rp=require(_0x6399('0x4'));var moment=require(_0x6399('0x5'));var BPromise=require(_0x6399('0x6'));var Mustache=require(_0x6399('0x7'));var util=require(_0x6399('0x8'));var path=require(_0x6399('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6399('0xa'));var _=require(_0x6399('0xb'));var squel=require(_0x6399('0xc'));var crypto=require(_0x6399('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6399('0xe'));var toCsv=require(_0x6399('0xf'));var querystring=require(_0x6399('0x10'));var Papa=require('papaparse');var Redis=require(_0x6399('0x11'));var authService=require(_0x6399('0x12'));var qs=require(_0x6399('0x13'));var as=require(_0x6399('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6399('0x15'));var utils=require('../../config/utils');var config=require(_0x6399('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6399('0x17'))['db'];config[_0x6399('0x18')]=_[_0x6399('0x19')](config[_0x6399('0x18')],{'host':_0x6399('0x1a'),'port':0x18eb});var socket=require(_0x6399('0x1b'))(new Redis(config[_0x6399('0x18')]));require('./userNotification.socket')[_0x6399('0x1c')](socket);function respondWithStatusCode(_0x1a6950,_0x653ecd){_0x653ecd=_0x653ecd||0xcc;return function(_0x288d0b){if(_0x288d0b){return _0x1a6950[_0x6399('0x1d')](_0x653ecd);}return _0x1a6950[_0x6399('0x1e')](_0x653ecd)[_0x6399('0x1f')]();};}function respondWithResult(_0x32e57b,_0x4f8db1){_0x4f8db1=_0x4f8db1||0xc8;return function(_0x3c5688){if(_0x3c5688){return _0x32e57b[_0x6399('0x1e')](_0x4f8db1)['json'](_0x3c5688);}};}function respondWithFilteredResult(_0x4b9ea8,_0x2ddd7a){return function(_0x585610){if(_0x585610){var _0x47382f=typeof _0x2ddd7a['offset']===_0x6399('0x20')&&typeof _0x2ddd7a[_0x6399('0x21')]==='undefined';var _0x13a01e=_0x585610[_0x6399('0x22')];var _0x5bdec1=_0x47382f?0x0:_0x2ddd7a[_0x6399('0x23')];var _0x51f1a7=_0x47382f?_0x585610[_0x6399('0x22')]:_0x2ddd7a[_0x6399('0x23')]+_0x2ddd7a[_0x6399('0x21')];var _0x14832b;if(_0x51f1a7>=_0x13a01e){_0x51f1a7=_0x13a01e;_0x14832b=0xc8;}else{_0x14832b=0xce;}_0x4b9ea8['status'](_0x14832b);return _0x4b9ea8[_0x6399('0x24')](_0x6399('0x25'),_0x5bdec1+'-'+_0x51f1a7+'/'+_0x13a01e)[_0x6399('0x26')](_0x585610);}return null;};}function patchUpdates(_0x42dcb9){return function(_0xf2c0c0){try{jsonpatch[_0x6399('0x27')](_0xf2c0c0,_0x42dcb9,!![]);}catch(_0x875370){return BPromise[_0x6399('0x28')](_0x875370);}return _0xf2c0c0[_0x6399('0x29')]();};}function saveUpdates(_0x4c8d42,_0x1abbd8){return function(_0x49d82c){if(_0x49d82c){return _0x49d82c[_0x6399('0x2a')](_0x4c8d42)[_0x6399('0x2b')](function(_0x552efa){return _0x552efa;});}return null;};}function removeEntity(_0x25bf2b,_0x38c7ab){return function(_0x296903){if(_0x296903){return _0x296903['destroy']()[_0x6399('0x2b')](function(){_0x25bf2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x529ba4,_0xe7910d){return function(_0x1da98f){if(!_0x1da98f){_0x529ba4[_0x6399('0x1d')](0x194);}return _0x1da98f;};}function handleError(_0x33734d,_0x1a1bd8){_0x1a1bd8=_0x1a1bd8||0x1f4;return function(_0x42f6e9){logger['error'](_0x42f6e9['stack']);if(_0x42f6e9[_0x6399('0x2c')]){delete _0x42f6e9[_0x6399('0x2c')];}_0x33734d['status'](_0x1a1bd8)['send'](_0x42f6e9);};}function getMustacheRender(_0x3efff7,_0x196475){return Mustache[_0x6399('0x2d')](_0x3efff7,_[_0x6399('0x2e')](_0x196475[_0x6399('0x2f')],{'contact':_0x196475[_0x6399('0x30')],'message':_0x196475[_0x6399('0x31')],'agent':_0x196475[_0x6399('0x32')],'interaction':_0x196475['interaction'],'account':_0x196475[_0x6399('0x33')]}))||'';}exports[_0x6399('0x34')]=function(_0x25ce35,_0x6d8e85,_0x5f2b7f){if(!_0x25ce35['body'][_0x6399('0x35')]('text')&&!_0x25ce35['body']['hasOwnProperty'](_0x6399('0x36'))){throw new db['Sequelize']['ValidationError'](_0x6399('0x37'));}else{if(_0x25ce35[_0x6399('0x2f')][_0x6399('0x35')]('TemplateId')&&!_0x25ce35[_0x6399('0x2f')]['hasOwnProperty'](_0x6399('0x38'))){throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))](_0x6399('0x3b'));}if(!_0x25ce35[_0x6399('0x2f')][_0x6399('0x35')](_0x6399('0x3c'))){throw new db['Sequelize']['ValidationError'](_0x6399('0x3d'));}else{try{var _0x523488=JSON[_0x6399('0x3e')](_0x25ce35[_0x6399('0x2f')][_0x6399('0x3c')]);}catch(_0x57dc58){logger[_0x6399('0x3f')](_0x57dc58);throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))](_0x6399('0x40'));}var _0x4abf46=['chatqueue',_0x6399('0x41'),_0x6399('0x42'),_0x6399('0x43'),_0x6399('0x44'),'voicequeue',_0x6399('0x45'),'team','user'];if(_[_0x6399('0x46')](_0x523488,function(_0x153131){return!_[_0x6399('0x47')](_0x4abf46,_0x153131[_0x6399('0x48')][_0x6399('0x49')]());})){throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x122aef={};_0x122aef[_0x6399('0x4a')]=_0x25ce35['body'][_0x6399('0x35')](_0x6399('0x4a'))?_0x25ce35[_0x6399('0x2f')][_0x6399('0x4a')]:_0x25ce35[_0x6399('0x4b')][_0x6399('0x4c')];_0x122aef['recipientsDescription']=_[_0x6399('0x4d')](_0x25ce35['body']['recipientsDescription'])?null:_0x25ce35['body'][_0x6399('0x4e')];_0x122aef[_0x6399('0x4f')]=_0x25ce35['body'][_0x6399('0x4f')]||![];_0x122aef['SenderId']=_0x25ce35[_0x6399('0x4b')]['id'];return getContent(_0x25ce35[_0x6399('0x2f')])[_0x6399('0x2b')](function(_0x56cb83){_0x122aef[_0x6399('0x2f')]=_0x56cb83;return getRecipients(_0x523488);})['then'](function(_0x3342dd){_0x122aef['recipientsId']=_[_0x6399('0x50')](_0x3342dd)[_0x6399('0x51')](',');return db[_0x6399('0x52')][_0x6399('0x53')](function(_0x4b624f){return db['UserNotification'][_0x6399('0x54')](_0x122aef,{'raw':!![],'transaction':_0x4b624f})[_0x6399('0x2b')](function(_0x521343){var _0x3113e8={'sender':_0x122aef['senderName'],'description':_0x122aef[_0x6399('0x4e')],'content':_0x122aef[_0x6399('0x2f')],'beep':_0x122aef['beep']};_0x3342dd[_0x6399('0x55')](function(_0x207783){_0x3113e8[_0x6399('0x56')]=_0x207783;socket[_0x6399('0x57')](_0x6399('0x58'),_0x3113e8);});return _0x521343;});});})['then'](respondWithResult(_0x6d8e85,0xc9))['catch'](handleError(_0x6d8e85,null));};function getContent(_0x177036){return new BPromise(function(_0x539185,_0x4bf457){if(_0x177036['text']){_0x539185(_0x177036[_0x6399('0x59')]);return;}return db[_0x6399('0x5a')][_0x6399('0x5b')]({'attributes':[_0x6399('0x5c')],'where':{'id':_0x177036[_0x6399('0x36')]},'raw':!![]})[_0x6399('0x2b')](function(_0x5c48e2){if(!_0x5c48e2)throw new db[(_0x6399('0x39'))][(_0x6399('0x3a'))](_0x6399('0x5d'));var _0x1d0667=Mustache['render'](_0x5c48e2[_0x6399('0x5c')],_0x177036[_0x6399('0x38')]);_0x539185(_0x1d0667);})[_0x6399('0x5e')](function(_0x51f53e){_0x4bf457(_0x51f53e);});});}function getRecipients(_0x5bddcb){return new BPromise(function(_0x58ffef,_0x5a417e){var _0x4798e5=[];var _0x443d8c=[];_0x5bddcb[_0x6399('0x55')](function(_0x3f884d){var _0x16814d=_[_0x6399('0x5f')](_0x3f884d[_0x6399('0x48')]['toLowerCase']());if(_0x16814d===_0x6399('0x60')){_0x4798e5=_[_0x6399('0x61')](_0x4798e5,_0x3f884d[_0x6399('0x62')]);}else{if(_[_0x6399('0x47')](_0x16814d,_0x6399('0x63')))_0x16814d=_0x16814d[_0x6399('0x64')](_0x6399('0x63'),_0x6399('0x65'));_0x3f884d['ids'][_0x6399('0x55')](function(_0x27a378){_0x443d8c[_0x6399('0x66')](getAgents(_0x16814d,_0x27a378));});}});return BPromise['all'](_0x443d8c)[_0x6399('0x2b')](function(_0x2c4e3f){_0x4798e5=_['union'](_0x4798e5,_[_0x6399('0x67')](_0x2c4e3f));_0x58ffef(_0x4798e5);})[_0x6399('0x5e')](function(_0x5614fe){_0x5a417e(_0x5614fe);});});}function getAgents(_0x28967d,_0xe46cc6){return new BPromise(function(_0x1b09ca,_0x34a87b){return db[_0x28967d]['findOne']({'where':{'id':_0xe46cc6}})[_0x6399('0x2b')](function(_0xff0255){return _0xff0255[_0x6399('0x68')]({'attributes':['id'],'raw':!![]})[_0x6399('0x2b')](function(_0xf05311){var _0x23a24b=_['map'](_0xf05311,'id');_0x1b09ca(_0x23a24b);});})[_0x6399('0x5e')](function(_0x35aded){_0x34a87b(_0x35aded);});});} \ No newline at end of file +var _0xd4d5=['Content-Range','apply','reject','then','destroy','error','name','contact','message','agent','interaction','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','forEach','recipient','emit','catch','Template','findOne','html','render','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x3847f0,_0x43a9bc){var _0x212231=function(_0x10dca1){while(--_0x10dca1){_0x3847f0['push'](_0x3847f0['shift']());}};_0x212231(++_0x43a9bc);}(_0xd4d5,0x17f));var _0x5d4d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd4d5[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x5d4d('0x0'));var rimraf=require(_0x5d4d('0x1'));var zipdir=require(_0x5d4d('0x2'));var jsonpatch=require(_0x5d4d('0x3'));var rp=require('request-promise');var moment=require(_0x5d4d('0x4'));var BPromise=require(_0x5d4d('0x5'));var Mustache=require(_0x5d4d('0x6'));var util=require(_0x5d4d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x5d4d('0x8'));var ejs=require(_0x5d4d('0x9'));var fs=require('fs');var fs_extra=require(_0x5d4d('0xa'));var _=require(_0x5d4d('0xb'));var squel=require(_0x5d4d('0xc'));var crypto=require(_0x5d4d('0xd'));var jsforce=require(_0x5d4d('0xe'));var deskjs=require(_0x5d4d('0xf'));var toCsv=require(_0x5d4d('0x8'));var querystring=require(_0x5d4d('0x10'));var Papa=require(_0x5d4d('0x11'));var Redis=require(_0x5d4d('0x12'));var authService=require(_0x5d4d('0x13'));var qs=require(_0x5d4d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d4d('0x15'));var logger=require(_0x5d4d('0x16'))(_0x5d4d('0x17'));var utils=require(_0x5d4d('0x18'));var config=require(_0x5d4d('0x19'));var licenseUtil=require(_0x5d4d('0x1a'));var db=require(_0x5d4d('0x1b'))['db'];config[_0x5d4d('0x1c')]=_[_0x5d4d('0x1d')](config['redis'],{'host':_0x5d4d('0x1e'),'port':0x18eb});var socket=require(_0x5d4d('0x1f'))(new Redis(config[_0x5d4d('0x1c')]));require('./userNotification.socket')[_0x5d4d('0x20')](socket);function respondWithStatusCode(_0x17b5b2,_0x2e280a){_0x2e280a=_0x2e280a||0xcc;return function(_0xa89fb){if(_0xa89fb){return _0x17b5b2[_0x5d4d('0x21')](_0x2e280a);}return _0x17b5b2[_0x5d4d('0x22')](_0x2e280a)['end']();};}function respondWithResult(_0x52fe6b,_0x2bdb8f){_0x2bdb8f=_0x2bdb8f||0xc8;return function(_0x5c08df){if(_0x5c08df){return _0x52fe6b[_0x5d4d('0x22')](_0x2bdb8f)[_0x5d4d('0x23')](_0x5c08df);}};}function respondWithFilteredResult(_0x29a67c,_0xe5e993){return function(_0x3db2f2){if(_0x3db2f2){var _0x54dbf3=typeof _0xe5e993[_0x5d4d('0x24')]===_0x5d4d('0x25')&&typeof _0xe5e993[_0x5d4d('0x26')]===_0x5d4d('0x25');var _0x2f71d2=_0x3db2f2[_0x5d4d('0x27')];var _0x19dda5=_0x54dbf3?0x0:_0xe5e993[_0x5d4d('0x24')];var _0x4fe17b=_0x54dbf3?_0x3db2f2[_0x5d4d('0x27')]:_0xe5e993[_0x5d4d('0x24')]+_0xe5e993[_0x5d4d('0x26')];var _0x4672c1;if(_0x4fe17b>=_0x2f71d2){_0x4fe17b=_0x2f71d2;_0x4672c1=0xc8;}else{_0x4672c1=0xce;}_0x29a67c[_0x5d4d('0x22')](_0x4672c1);return _0x29a67c[_0x5d4d('0x28')](_0x5d4d('0x29'),_0x19dda5+'-'+_0x4fe17b+'/'+_0x2f71d2)[_0x5d4d('0x23')](_0x3db2f2);}return null;};}function patchUpdates(_0x6e3761){return function(_0x2e3098){try{jsonpatch[_0x5d4d('0x2a')](_0x2e3098,_0x6e3761,!![]);}catch(_0xd96293){return BPromise[_0x5d4d('0x2b')](_0xd96293);}return _0x2e3098['save']();};}function saveUpdates(_0x5e55c1,_0x3a070f){return function(_0x1045d3){if(_0x1045d3){return _0x1045d3['update'](_0x5e55c1)[_0x5d4d('0x2c')](function(_0xebcbb6){return _0xebcbb6;});}return null;};}function removeEntity(_0x2b301d,_0x203026){return function(_0x4eed6e){if(_0x4eed6e){return _0x4eed6e[_0x5d4d('0x2d')]()[_0x5d4d('0x2c')](function(){_0x2b301d[_0x5d4d('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa9fdff,_0x157b92){return function(_0x3f040a){if(!_0x3f040a){_0xa9fdff[_0x5d4d('0x21')](0x194);}return _0x3f040a;};}function handleError(_0x3cecb0,_0x48f4e5){_0x48f4e5=_0x48f4e5||0x1f4;return function(_0x5c7393){logger[_0x5d4d('0x2e')](_0x5c7393['stack']);if(_0x5c7393['name']){delete _0x5c7393[_0x5d4d('0x2f')];}_0x3cecb0['status'](_0x48f4e5)['send'](_0x5c7393);};}function getMustacheRender(_0x2272cf,_0xee8f43){return Mustache['render'](_0x2272cf,_['merge'](_0xee8f43['body'],{'contact':_0xee8f43[_0x5d4d('0x30')],'message':_0xee8f43[_0x5d4d('0x31')],'agent':_0xee8f43[_0x5d4d('0x32')],'interaction':_0xee8f43[_0x5d4d('0x33')],'account':_0xee8f43['account']}))||'';}exports[_0x5d4d('0x34')]=function(_0x3be300,_0x471266,_0x137919){if(!_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x36')](_0x5d4d('0x37'))&&!_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x36')](_0x5d4d('0x38'))){throw new db[(_0x5d4d('0x39'))][(_0x5d4d('0x3a'))](_0x5d4d('0x3b'));}else{if(_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x36')](_0x5d4d('0x38'))&&!_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x36')](_0x5d4d('0x3c'))){throw new db['Sequelize'][(_0x5d4d('0x3a'))](_0x5d4d('0x3d'));}if(!_0x3be300['body'][_0x5d4d('0x36')](_0x5d4d('0x3e'))){throw new db[(_0x5d4d('0x39'))][(_0x5d4d('0x3a'))](_0x5d4d('0x3f'));}else{try{var _0x567584=JSON[_0x5d4d('0x40')](_0x3be300['body'][_0x5d4d('0x3e')]);}catch(_0xb5a64e){logger[_0x5d4d('0x2e')](_0xb5a64e);throw new db[(_0x5d4d('0x39'))][(_0x5d4d('0x3a'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x617596=[_0x5d4d('0x41'),_0x5d4d('0x42'),_0x5d4d('0x43'),'openchannelqueue',_0x5d4d('0x44'),_0x5d4d('0x45'),_0x5d4d('0x46'),'team',_0x5d4d('0x47')];if(_['some'](_0x567584,function(_0x252b0c){return!_[_0x5d4d('0x48')](_0x617596,_0x252b0c[_0x5d4d('0x49')][_0x5d4d('0x4a')]());})){throw new db['Sequelize'][(_0x5d4d('0x3a'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x33a2b0={};_0x33a2b0[_0x5d4d('0x4b')]=_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x36')](_0x5d4d('0x4b'))?_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x4b')]:_0x3be300['user'][_0x5d4d('0x4c')];_0x33a2b0[_0x5d4d('0x4d')]=_[_0x5d4d('0x4e')](_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x4d')])?null:_0x3be300['body']['recipientsDescription'];_0x33a2b0[_0x5d4d('0x4f')]=_0x3be300[_0x5d4d('0x35')][_0x5d4d('0x4f')]||![];_0x33a2b0[_0x5d4d('0x50')]=_0x3be300[_0x5d4d('0x47')]['id'];return getContent(_0x3be300[_0x5d4d('0x35')])[_0x5d4d('0x2c')](function(_0x4b8efd){_0x33a2b0['body']=_0x4b8efd;return getRecipients(_0x567584);})[_0x5d4d('0x2c')](function(_0x1e49fd){_0x33a2b0[_0x5d4d('0x51')]=_['sortBy'](_0x1e49fd)[_0x5d4d('0x52')](',');return db[_0x5d4d('0x53')][_0x5d4d('0x54')](function(_0x445155){return db[_0x5d4d('0x55')]['create'](_0x33a2b0,{'raw':!![],'transaction':_0x445155})[_0x5d4d('0x2c')](function(_0x31087a){var _0x40c130={'sender':_0x33a2b0[_0x5d4d('0x4b')],'description':_0x33a2b0[_0x5d4d('0x4d')],'content':_0x33a2b0['body'],'beep':_0x33a2b0[_0x5d4d('0x4f')]};_0x1e49fd[_0x5d4d('0x56')](function(_0x4ccefb){_0x40c130[_0x5d4d('0x57')]=_0x4ccefb;socket[_0x5d4d('0x58')]('userNotification:send',_0x40c130);});return _0x31087a;});});})[_0x5d4d('0x2c')](respondWithResult(_0x471266,0xc9))[_0x5d4d('0x59')](handleError(_0x471266,null));};function getContent(_0x45f54a){return new BPromise(function(_0x24811a,_0xf7aae2){if(_0x45f54a['text']){_0x24811a(_0x45f54a[_0x5d4d('0x37')]);return;}return db[_0x5d4d('0x5a')][_0x5d4d('0x5b')]({'attributes':[_0x5d4d('0x5c')],'where':{'id':_0x45f54a[_0x5d4d('0x38')]},'raw':!![]})[_0x5d4d('0x2c')](function(_0x3cc684){if(!_0x3cc684)throw new db[(_0x5d4d('0x39'))][(_0x5d4d('0x3a'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xfed891=Mustache[_0x5d4d('0x5d')](_0x3cc684[_0x5d4d('0x5c')],_0x45f54a[_0x5d4d('0x3c')]);_0x24811a(_0xfed891);})[_0x5d4d('0x59')](function(_0x1ab97a){_0xf7aae2(_0x1ab97a);});});}function getRecipients(_0xf38471){return new BPromise(function(_0x489ca6,_0x42565a){var _0x256c80=[];var _0x2a5df5=[];_0xf38471[_0x5d4d('0x56')](function(_0x2a1f35){var _0x18018c=_[_0x5d4d('0x5e')](_0x2a1f35[_0x5d4d('0x49')][_0x5d4d('0x4a')]());if(_0x18018c===_0x5d4d('0x5f')){_0x256c80=_[_0x5d4d('0x60')](_0x256c80,_0x2a1f35[_0x5d4d('0x61')]);}else{if(_[_0x5d4d('0x48')](_0x18018c,_0x5d4d('0x62')))_0x18018c=_0x18018c[_0x5d4d('0x63')](_0x5d4d('0x62'),_0x5d4d('0x64'));_0x2a1f35[_0x5d4d('0x61')]['forEach'](function(_0x435cdf){_0x2a5df5[_0x5d4d('0x65')](getAgents(_0x18018c,_0x435cdf));});}});return BPromise[_0x5d4d('0x66')](_0x2a5df5)[_0x5d4d('0x2c')](function(_0x4d0ab1){_0x256c80=_[_0x5d4d('0x60')](_0x256c80,_[_0x5d4d('0x67')](_0x4d0ab1));_0x489ca6(_0x256c80);})[_0x5d4d('0x59')](function(_0x142c6c){_0x42565a(_0x142c6c);});});}function getAgents(_0x1561cf,_0x5c0519){return new BPromise(function(_0x20f686,_0x2f2e63){return db[_0x1561cf][_0x5d4d('0x5b')]({'where':{'id':_0x5c0519}})[_0x5d4d('0x2c')](function(_0x4c5b4b){return _0x4c5b4b[_0x5d4d('0x68')]({'attributes':['id'],'raw':!![]})[_0x5d4d('0x2c')](function(_0x52858f){var _0x353e25=_[_0x5d4d('0x69')](_0x52858f,'id');_0x20f686(_0x353e25);});})[_0x5d4d('0x59')](function(_0x83513){_0x2f2e63(_0x83513);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9a3f0f0..a36c133 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners','save','remove','emit'];(function(_0x57a48f,_0x77ce62){var _0x46490e=function(_0x1c9e61){while(--_0x1c9e61){_0x57a48f['push'](_0x57a48f['shift']());}};_0x46490e(++_0x77ce62);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x24ca[_0x2df724];return _0x1b2504;};'use strict';var EventEmitter=require(_0xa24c('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xa24c('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa24c('0x2')](0x0);var events={'afterCreate':_0xa24c('0x3'),'afterUpdate':'update','afterDestroy':_0xa24c('0x4')};function emitEvent(_0x8a54a0){return function(_0x195e60,_0x28aa2f,_0xe76a30){UserNotificationEvents[_0xa24c('0x5')](_0x8a54a0+':'+_0x195e60['id'],_0x195e60);UserNotificationEvents[_0xa24c('0x5')](_0x8a54a0,_0x195e60);_0xe76a30(null);};}for(var e in events){if(events[_0xa24c('0x6')](e)){var event=events[e];UserNotification[_0xa24c('0x7')](e,emitEvent(event));}}module[_0xa24c('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xd6d6=['events','../../mysqldb','UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x8a41fe,_0x40b33d){var _0xfae559=function(_0x1bb49b){while(--_0x1bb49b){_0x8a41fe['push'](_0x8a41fe['shift']());}};_0xfae559(++_0x40b33d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4c0124,_0x2e24b2){_0x4c0124=_0x4c0124-0x0;var _0x101f05=_0xd6d6[_0x4c0124];return _0x101f05;};'use strict';var EventEmitter=require(_0x6d6d('0x0'));var UserNotification=require(_0x6d6d('0x1'))['db'][_0x6d6d('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6d6d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d6d('0x4'),'afterDestroy':_0x6d6d('0x5')};function emitEvent(_0x1b8610){return function(_0x2a838a,_0x5207c9,_0x16e259){UserNotificationEvents[_0x6d6d('0x6')](_0x1b8610+':'+_0x2a838a['id'],_0x2a838a);UserNotificationEvents['emit'](_0x1b8610,_0x2a838a);_0x16e259(null);};}for(var e in events){if(events[_0x6d6d('0x7')](e)){var event=events[e];UserNotification[_0x6d6d('0x8')](e,emitEvent(event));}}module[_0x6d6d('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 2ac0aba..f2577b1 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fee=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications'];(function(_0xf7d93d,_0x3cdeee){var _0x18fbaf=function(_0xab7b77){while(--_0xab7b77){_0xf7d93d['push'](_0xf7d93d['shift']());}};_0x18fbaf(++_0x3cdeee);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7fee[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var logger=require(_0xe7fe('0x2'))(_0xe7fe('0x3'));var moment=require(_0xe7fe('0x4'));var BPromise=require(_0xe7fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7fe('0x6'));var rimraf=require(_0xe7fe('0x7'));var config=require(_0xe7fe('0x8'));var attributes=require('./userNotification.attributes');module[_0xe7fe('0x9')]=function(_0x5b6d58,_0x183b0b){return _0x5b6d58[_0xe7fe('0xa')](_0xe7fe('0xb'),attributes,{'tableName':_0xe7fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7fe('0xd'),'collate':_0xe7fe('0xe')});}; \ No newline at end of file +var _0x9a1b=['utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','define','userNotifications'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x22cd70,_0x2961e2){_0x22cd70=_0x22cd70-0x0;var _0x5273ee=_0x9a1b[_0x22cd70];return _0x5273ee;};'use strict';var _=require(_0xb9a1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb9a1('0x1'));var BPromise=require(_0xb9a1('0x2'));var rp=require(_0xb9a1('0x3'));var fs=require('fs');var path=require(_0xb9a1('0x4'));var rimraf=require('rimraf');var config=require(_0xb9a1('0x5'));var attributes=require(_0xb9a1('0x6'));module['exports']=function(_0x69b74e,_0x455fac){return _0x69b74e[_0xb9a1('0x7')]('UserNotification',attributes,{'tableName':_0xb9a1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9a1('0x9'),'collate':_0xb9a1('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index cb3d8cc..e5cfd1e 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e17=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','debug','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0x0e17,0x111));var _0x70e1=function(_0x57f8dc,_0x2a39ad){_0x57f8dc=_0x57f8dc-0x0;var _0x467d59=_0x0e17[_0x57f8dc];return _0x467d59;};'use strict';var _=require('lodash');var util=require(_0x70e1('0x0'));var moment=require(_0x70e1('0x1'));var BPromise=require(_0x70e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70e1('0x3'));var db=require(_0x70e1('0x4'))['db'];var utils=require(_0x70e1('0x5'));var logger=require(_0x70e1('0x6'))(_0x70e1('0x7'));var config=require(_0x70e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70e1('0x9')][_0x70e1('0xa')]({'port':0x232a});config['redis']=_[_0x70e1('0xb')](config[_0x70e1('0xc')],{'host':_0x70e1('0xd'),'port':0x18eb});var socket=require(_0x70e1('0xe'))(new Redis(config['redis']));require('./userNotification.socket')[_0x70e1('0xf')](socket);function respondWithRpcPromise(_0x42d8c2,_0x5e44bd,_0x1ceeaa){return new BPromise(function(_0x598ef8,_0x1eb33a){return client[_0x70e1('0x10')](_0x42d8c2,_0x1ceeaa)['then'](function(_0x33bf6e){logger[_0x70e1('0x11')]('UserNotification,\x20%s,\x20%s',_0x5e44bd,'request\x20sent');logger[_0x70e1('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5e44bd,_0x70e1('0x13'),JSON[_0x70e1('0x14')](_0x33bf6e));if(_0x33bf6e['error']){if(_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x16')]===0x1f4){logger[_0x70e1('0x15')](_0x70e1('0x17'),_0x5e44bd,_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x18')]);return _0x1eb33a(_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x18')]);}logger[_0x70e1('0x15')](_0x70e1('0x17'),_0x5e44bd,_0x33bf6e['error']['message']);return _0x598ef8(_0x33bf6e[_0x70e1('0x15')][_0x70e1('0x18')]);}else{logger[_0x70e1('0x11')](_0x70e1('0x17'),_0x5e44bd,_0x70e1('0x13'));_0x598ef8(_0x33bf6e[_0x70e1('0x19')][_0x70e1('0x18')]);}})[_0x70e1('0x1a')](function(_0xb3cbbe){logger[_0x70e1('0x15')](_0x70e1('0x17'),_0x5e44bd,_0xb3cbbe);_0x1eb33a(_0xb3cbbe);});});} \ No newline at end of file +var _0x0b3c=['redis','localhost','socket.io-emitter','./userNotification.socket','register','then','request\x20sent','debug','error','code','UserNotification,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x0b3c,0x138));var _0xc0b3=function(_0x5396d4,_0x86297a){_0x5396d4=_0x5396d4-0x0;var _0x9fa122=_0x0b3c[_0x5396d4];return _0x9fa122;};'use strict';var _=require(_0xc0b3('0x0'));var util=require('util');var moment=require(_0xc0b3('0x1'));var BPromise=require(_0xc0b3('0x2'));var rs=require(_0xc0b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0b3('0x4'))['db'];var utils=require(_0xc0b3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc0b3('0x6'));var jayson=require(_0xc0b3('0x7'));var client=jayson['client'][_0xc0b3('0x8')]({'port':0x232a});config['redis']=_[_0xc0b3('0x9')](config[_0xc0b3('0xa')],{'host':_0xc0b3('0xb'),'port':0x18eb});var socket=require(_0xc0b3('0xc'))(new Redis(config[_0xc0b3('0xa')]));require(_0xc0b3('0xd'))[_0xc0b3('0xe')](socket);function respondWithRpcPromise(_0x5e07cd,_0x3c1105,_0x188f17){return new BPromise(function(_0x16acfc,_0x488a50){return client['request'](_0x5e07cd,_0x188f17)[_0xc0b3('0xf')](function(_0x43ca32){logger['info']('UserNotification,\x20%s,\x20%s',_0x3c1105,_0xc0b3('0x10'));logger[_0xc0b3('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x3c1105,_0xc0b3('0x10'),JSON['stringify'](_0x43ca32));if(_0x43ca32[_0xc0b3('0x12')]){if(_0x43ca32[_0xc0b3('0x12')][_0xc0b3('0x13')]===0x1f4){logger['error'](_0xc0b3('0x14'),_0x3c1105,_0x43ca32[_0xc0b3('0x12')]['message']);return _0x488a50(_0x43ca32['error']['message']);}logger[_0xc0b3('0x12')](_0xc0b3('0x14'),_0x3c1105,_0x43ca32[_0xc0b3('0x12')][_0xc0b3('0x15')]);return _0x16acfc(_0x43ca32[_0xc0b3('0x12')][_0xc0b3('0x15')]);}else{logger[_0xc0b3('0x16')](_0xc0b3('0x14'),_0x3c1105,_0xc0b3('0x10'));_0x16acfc(_0x43ca32['result'][_0xc0b3('0x15')]);}})['catch'](function(_0x5bd52a){logger[_0xc0b3('0x12')](_0xc0b3('0x14'),_0x3c1105,_0x5bd52a);_0x488a50(_0x5bd52a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3b67345..f1f3375 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5031=['./userNotification.events','save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x4f5965,_0x6f48ba){var _0x843d4f=function(_0x2f650b){while(--_0x2f650b){_0x4f5965['push'](_0x4f5965['shift']());}};_0x843d4f(++_0x6f48ba);}(_0x5031,0x144));var _0x1503=function(_0x87c2fc,_0x4fe84a){_0x87c2fc=_0x87c2fc-0x0;var _0x36b6e2=_0x5031[_0x87c2fc];return _0x36b6e2;};'use strict';var UserNotificationEvents=require(_0x1503('0x0'));var events=[_0x1503('0x1'),_0x1503('0x2'),_0x1503('0x3')];function createListener(_0x12aead,_0x5d2d67){return function(_0x58700c){_0x5d2d67[_0x1503('0x4')](_0x12aead,_0x58700c);};}function removeListener(_0x29353e,_0x175a7e){return function(){UserNotificationEvents[_0x1503('0x5')](_0x29353e,_0x175a7e);};}exports[_0x1503('0x6')]=function(_0x3b44d1){for(var _0xaeae3=0x0,_0x114bec=events[_0x1503('0x7')];_0xaeae3<_0x114bec;_0xaeae3++){var _0x4c93e7=events[_0xaeae3];var _0x2007d0=createListener(_0x1503('0x8')+_0x4c93e7,_0x3b44d1);UserNotificationEvents['on'](_0x4c93e7,_0x2007d0);}}; \ No newline at end of file +var _0x1f75=['removeListener','register','length','userNotification:','./userNotification.events','save','remove','emit'];(function(_0x8d7822,_0x30e65a){var _0x42777=function(_0x179afc){while(--_0x179afc){_0x8d7822['push'](_0x8d7822['shift']());}};_0x42777(++_0x30e65a);}(_0x1f75,0x12c));var _0x51f7=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x1f75[_0x8de54f];return _0x14cba4;};'use strict';var UserNotificationEvents=require(_0x51f7('0x0'));var events=[_0x51f7('0x1'),_0x51f7('0x2'),'update'];function createListener(_0xc7556d,_0x131535){return function(_0x10fc45){_0x131535[_0x51f7('0x3')](_0xc7556d,_0x10fc45);};}function removeListener(_0x3df27f,_0x4e6fc){return function(){UserNotificationEvents[_0x51f7('0x4')](_0x3df27f,_0x4e6fc);};}exports[_0x51f7('0x5')]=function(_0x292480){for(var _0x22fc29=0x0,_0x3eb36d=events[_0x51f7('0x6')];_0x22fc29<_0x3eb36d;_0x22fc29++){var _0x5a1f98=events[_0x22fc29];var _0x2d944f=createListener(_0x51f7('0x7')+_0x5a1f98,_0x292480);UserNotificationEvents['on'](_0x5a1f98,_0x2d944f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 6db1798..db36144 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfef3=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x137bf4,_0x320371){var _0x401654=function(_0x49084d){while(--_0x49084d){_0x137bf4['push'](_0x137bf4['shift']());}};_0x401654(++_0x320371);}(_0xfef3,0x118));var _0x3fef=function(_0x7430b6,_0x4fe9f4){_0x7430b6=_0x7430b6-0x0;var _0x3cd462=_0xfef3[_0x7430b6];return _0x3cd462;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fef('0x4'));var interaction=require(_0x3fef('0x5'));var config=require('../../config/environment');module[_0x3fef('0x6')]=router; \ No newline at end of file +var _0xceb0=['fs-extra','../../components/auth/service','../../components/interaction/service','express'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xceb0,0x173));var _0x0ceb=function(_0x2c25cd,_0x18c138){_0x2c25cd=_0x2c25cd-0x0;var _0x3945df=_0xceb0[_0x2c25cd];return _0x3945df;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ceb('0x0'));var router=express['Router']();var fs_extra=require(_0x0ceb('0x1'));var auth=require(_0x0ceb('0x2'));var interaction=require(_0x0ceb('0x3'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index bfc5d5e..5be899d 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x409315,_0x123e35){var _0x283290=function(_0x1277eb){while(--_0x1277eb){_0x409315['push'](_0x409315['shift']());}};_0x283290(++_0x123e35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 357d897..dd845fa 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa68a=['api','moment','bluebird','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x5382f0,_0x585ba7){var _0x2437b3=function(_0x21d3dc){while(--_0x21d3dc){_0x5382f0['push'](_0x5382f0['shift']());}};_0x2437b3(++_0x585ba7);}(_0xa68a,0x9f));var _0xaa68=function(_0x57b743,_0x1576ea){_0x57b743=_0x57b743-0x0;var _0xf6c89b=_0xa68a[_0x57b743];return _0xf6c89b;};'use strict';var _=require(_0xaa68('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa68('0x1'));var moment=require(_0xaa68('0x2'));var BPromise=require(_0xaa68('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa68('0x4'));var attributes=require(_0xaa68('0x5'));module[_0xaa68('0x6')]=function(_0x2a2dd0,_0x5a3ac6){return _0x2a2dd0[_0xaa68('0x7')](_0xaa68('0x8'),attributes,{'tableName':_0xaa68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab59=['bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes','exports','define','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab59,0x1f0));var _0x9ab5=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0xab59[_0x284807];return _0x50c774;};'use strict';var _=require(_0x9ab5('0x0'));var util=require(_0x9ab5('0x1'));var logger=require('../../config/logger')(_0x9ab5('0x2'));var moment=require(_0x9ab5('0x3'));var BPromise=require(_0x9ab5('0x4'));var rp=require(_0x9ab5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ab5('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ab5('0x7'));module[_0x9ab5('0x8')]=function(_0x4d8436,_0x1f059a){return _0x4d8436[_0x9ab5('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 3d9f322..3bc5917 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b7f=['request','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3a8b9b,_0x4b1728){var _0x1a3bba=function(_0x37a74e){while(--_0x37a74e){_0x3a8b9b['push'](_0x3a8b9b['shift']());}};_0x1a3bba(++_0x4b1728);}(_0x6b7f,0x119));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6b7('0x0'));var util=require(_0xf6b7('0x1'));var moment=require(_0xf6b7('0x2'));var BPromise=require(_0xf6b7('0x3'));var rs=require(_0xf6b7('0x4'));var fs=require('fs');var Redis=require(_0xf6b7('0x5'));var db=require(_0xf6b7('0x6'))['db'];var utils=require(_0xf6b7('0x7'));var logger=require(_0xf6b7('0x8'))(_0xf6b7('0x9'));var config=require('../../config/environment');var jayson=require(_0xf6b7('0xa'));var client=jayson[_0xf6b7('0xb')][_0xf6b7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e2d9f,_0x68adda,_0x43cbe4){return new BPromise(function(_0x880f35,_0x4acbb0){return client[_0xf6b7('0xd')](_0x4e2d9f,_0x43cbe4)['then'](function(_0x498add){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x68adda,_0xf6b7('0xe'));logger[_0xf6b7('0xf')](_0xf6b7('0x10'),_0x68adda,_0xf6b7('0xe'),JSON['stringify'](_0x498add));if(_0x498add[_0xf6b7('0x11')]){if(_0x498add[_0xf6b7('0x11')][_0xf6b7('0x12')]===0x1f4){logger[_0xf6b7('0x11')](_0xf6b7('0x13'),_0x68adda,_0x498add[_0xf6b7('0x11')][_0xf6b7('0x14')]);return _0x4acbb0(_0x498add[_0xf6b7('0x11')]['message']);}logger[_0xf6b7('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x68adda,_0x498add[_0xf6b7('0x11')][_0xf6b7('0x14')]);return _0x880f35(_0x498add[_0xf6b7('0x11')][_0xf6b7('0x14')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x68adda,_0xf6b7('0xe'));_0x880f35(_0x498add['result']['message']);}})['catch'](function(_0x1f8a01){logger[_0xf6b7('0x11')](_0xf6b7('0x13'),_0x68adda,_0x1f8a01);_0x4acbb0(_0x1f8a01);});});} \ No newline at end of file +var _0x04d6=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x4d91d4,_0x39f249){var _0x5bb73c=function(_0x4ef09a){while(--_0x4ef09a){_0x4d91d4['push'](_0x4d91d4['shift']());}};_0x5bb73c(++_0x39f249);}(_0x04d6,0x8a));var _0x604d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x04d6[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x604d('0x0'));var util=require(_0x604d('0x1'));var moment=require(_0x604d('0x2'));var BPromise=require(_0x604d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x604d('0x4'));var db=require(_0x604d('0x5'))['db'];var utils=require(_0x604d('0x6'));var logger=require(_0x604d('0x7'))(_0x604d('0x8'));var config=require(_0x604d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x604d('0xa')][_0x604d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d724e,_0x46fedd,_0x4528dd){return new BPromise(function(_0x1eb8b7,_0x54c832){return client[_0x604d('0xc')](_0x2d724e,_0x4528dd)['then'](function(_0x339fa5){logger[_0x604d('0xd')](_0x604d('0xe'),_0x46fedd,_0x604d('0xf'));logger[_0x604d('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x46fedd,_0x604d('0xf'),JSON[_0x604d('0x11')](_0x339fa5));if(_0x339fa5[_0x604d('0x12')]){if(_0x339fa5[_0x604d('0x12')][_0x604d('0x13')]===0x1f4){logger[_0x604d('0x12')](_0x604d('0xe'),_0x46fedd,_0x339fa5[_0x604d('0x12')][_0x604d('0x14')]);return _0x54c832(_0x339fa5[_0x604d('0x12')]['message']);}logger[_0x604d('0x12')](_0x604d('0xe'),_0x46fedd,_0x339fa5['error'][_0x604d('0x14')]);return _0x1eb8b7(_0x339fa5['error'][_0x604d('0x14')]);}else{logger['info'](_0x604d('0xe'),_0x46fedd,_0x604d('0xf'));_0x1eb8b7(_0x339fa5[_0x604d('0x15')]['message']);}})[_0x604d('0x16')](function(_0x74a108){logger['error'](_0x604d('0xe'),_0x46fedd,_0x74a108);_0x54c832(_0x74a108);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b5e9813..7e44c06 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc090=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','describe','show','/:id/sections','getSections','/:id/resources','create','post','addSections','addResources','put','/:id','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x56b3cb,_0x3fe0a7){var _0x29a7de=function(_0xe862b5){while(--_0xe862b5){_0x56b3cb['push'](_0x56b3cb['shift']());}};_0x29a7de(++_0x3fe0a7);}(_0xc090,0x112));var _0x0c09=function(_0x5d9a40,_0x18a0e7){_0x5d9a40=_0x5d9a40-0x0;var _0x376f63=_0xc090[_0x5d9a40];return _0x376f63;};'use strict';var multer=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var path=require(_0x0c09('0x2'));var timeout=require(_0x0c09('0x3'));var express=require(_0x0c09('0x4'));var router=express[_0x0c09('0x5')]();var fs_extra=require(_0x0c09('0x6'));var auth=require(_0x0c09('0x7'));var interaction=require(_0x0c09('0x8'));var config=require('../../config/environment');var controller=require(_0x0c09('0x9'));router[_0x0c09('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0c09('0xa')]('/describe',auth[_0x0c09('0xb')](),controller[_0x0c09('0xc')]);router[_0x0c09('0xa')]('/:id',auth[_0x0c09('0xb')](),controller[_0x0c09('0xd')]);router['get'](_0x0c09('0xe'),auth['isAuthenticated'](),controller[_0x0c09('0xf')]);router[_0x0c09('0xa')](_0x0c09('0x10'),auth[_0x0c09('0xb')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0x0c09('0x11')]);router['post']('/:id/clone',auth[_0x0c09('0xb')](),controller['clone']);router[_0x0c09('0x12')](_0x0c09('0xe'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x13')]);router[_0x0c09('0x12')](_0x0c09('0x10'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x14')]);router[_0x0c09('0x15')](_0x0c09('0x16'),auth['isAuthenticated'](),controller[_0x0c09('0x17')]);router[_0x0c09('0x18')](_0x0c09('0x16'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x19')]);router[_0x0c09('0x18')](_0x0c09('0xe'),auth[_0x0c09('0xb')](),controller[_0x0c09('0x1a')]);router[_0x0c09('0x18')](_0x0c09('0x10'),auth[_0x0c09('0xb')](),controller['removeResources']);module[_0x0c09('0x1b')]=router; \ No newline at end of file +var _0xf842=['/:id/clone','clone','addResources','put','update','delete','destroy','removeSections','/:id/resources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getResources','post','create'];(function(_0x358bcd,_0x2321b9){var _0x479c55=function(_0x41fda7){while(--_0x41fda7){_0x358bcd['push'](_0x358bcd['shift']());}};_0x479c55(++_0x2321b9);}(_0xf842,0x172));var _0x2f84=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xf842[_0x562f3b];return _0x1edd55;};'use strict';var multer=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var path=require(_0x2f84('0x2'));var timeout=require(_0x2f84('0x3'));var express=require('express');var router=express[_0x2f84('0x4')]();var fs_extra=require(_0x2f84('0x5'));var auth=require(_0x2f84('0x6'));var interaction=require(_0x2f84('0x7'));var config=require(_0x2f84('0x8'));var controller=require('./userProfile.controller');router[_0x2f84('0x9')]('/',auth[_0x2f84('0xa')](),controller[_0x2f84('0xb')]);router['get'](_0x2f84('0xc'),auth[_0x2f84('0xa')](),controller[_0x2f84('0xd')]);router[_0x2f84('0x9')](_0x2f84('0xe'),auth[_0x2f84('0xa')](),controller[_0x2f84('0xf')]);router[_0x2f84('0x9')](_0x2f84('0x10'),auth[_0x2f84('0xa')](),controller['getSections']);router[_0x2f84('0x9')]('/:id/resources',auth[_0x2f84('0xa')](),controller[_0x2f84('0x11')]);router[_0x2f84('0x12')]('/',auth[_0x2f84('0xa')](),controller[_0x2f84('0x13')]);router[_0x2f84('0x12')](_0x2f84('0x14'),auth[_0x2f84('0xa')](),controller[_0x2f84('0x15')]);router[_0x2f84('0x12')](_0x2f84('0x10'),auth[_0x2f84('0xa')](),controller['addSections']);router['post']('/:id/resources',auth[_0x2f84('0xa')](),controller[_0x2f84('0x16')]);router[_0x2f84('0x17')]('/:id',auth[_0x2f84('0xa')](),controller[_0x2f84('0x18')]);router[_0x2f84('0x19')]('/:id',auth[_0x2f84('0xa')](),controller[_0x2f84('0x1a')]);router[_0x2f84('0x19')](_0x2f84('0x10'),auth['isAuthenticated'](),controller[_0x2f84('0x1b')]);router['delete'](_0x2f84('0x1c'),auth['isAuthenticated'](),controller['removeResources']);module[_0x2f84('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 71cd179..2630d9a 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x261b=['STRING','BOOLEAN','sequelize','exports','setDataValue','join','crudPermissions','split'];(function(_0x47df1d,_0x53ab52){var _0x140f36=function(_0x51411f){while(--_0x51411f){_0x47df1d['push'](_0x47df1d['shift']());}};_0x140f36(++_0x53ab52);}(_0x261b,0x15a));var _0xb261=function(_0x1f7986,_0x598e97){_0x1f7986=_0x1f7986-0x0;var _0x2f3475=_0x261b[_0x1f7986];return _0x2f3475;};'use strict';var Sequelize=require(_0xb261('0x0'));module[_0xb261('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x48c7f0){this[_0xb261('0x2')]('crudPermissions',_0x48c7f0?_0x48c7f0[_0xb261('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xb261('0x4'))?this['getDataValue'](_0xb261('0x4'))[_0xb261('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb261('0x6')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb261('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb261('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9c00=['join','getDataValue','BOOLEAN','sequelize','exports','STRING','crudPermissions'];(function(_0x5c1471,_0x4f753c){var _0x14c3d4=function(_0x399f2d){while(--_0x399f2d){_0x5c1471['push'](_0x5c1471['shift']());}};_0x14c3d4(++_0x4f753c);}(_0x9c00,0x1a0));var _0x09c0=function(_0x326ad4,_0x1744ac){_0x326ad4=_0x326ad4-0x0;var _0x58df34=_0x9c00[_0x326ad4];return _0x58df34;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x09c0('0x2')],'set':function(_0x8c9907){this['setDataValue'](_0x09c0('0x3'),_0x8c9907?_0x8c9907[_0x09c0('0x4')](''):[]);},'get':function(){return this[_0x09c0('0x5')](_0x09c0('0x3'))?this[_0x09c0('0x5')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x09c0('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x09c0('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index fa51c6a..fbd5aba 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4af6=['color','ThroughTags','tag','Agents','openTabs','true','chat','dataValues','sms','openchannel','whatsapp','charAt','toUpperCase','slice','select','ui.','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','teams','Team','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','metrics','AnalyticMetric','WhatsappAccount','screenrecordings','ScreenRecording','UserId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','sendStatus','stack','name','render','merge','body','contact','interaction','account','index','UserProfile','rawAttributes','type','key','model','map','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','create','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','destroy','describe','addSections','UserProfileResource','push','removeSections','ids','getSections','enabled','includes','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','Sequelize','Unknown\x20section','mergeResources','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','isEmpty','childModel','nolimit','pick','field','foreignKey','associatedResources','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags'];(function(_0x5f4b90,_0x135c3f){var _0x5de28e=function(_0x43ee8c){while(--_0x43ee8c){_0x5f4b90['push'](_0x5f4b90['shift']());}};_0x5de28e(++_0x135c3f);}(_0x4af6,0x7d));var _0x64af=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x4af6[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x64af('0x0'));var rimraf=require(_0x64af('0x1'));var zipdir=require(_0x64af('0x2'));var jsonpatch=require(_0x64af('0x3'));var rp=require(_0x64af('0x4'));var moment=require(_0x64af('0x5'));var BPromise=require(_0x64af('0x6'));var Mustache=require('mustache');var util=require(_0x64af('0x7'));var path=require('path');var sox=require(_0x64af('0x8'));var csv=require('to-csv');var ejs=require(_0x64af('0x9'));var fs=require('fs');var fs_extra=require(_0x64af('0xa'));var _=require(_0x64af('0xb'));var squel=require(_0x64af('0xc'));var crypto=require(_0x64af('0xd'));var jsforce=require(_0x64af('0xe'));var deskjs=require(_0x64af('0xf'));var toCsv=require(_0x64af('0x10'));var querystring=require('querystring');var Papa=require(_0x64af('0x11'));var Redis=require(_0x64af('0x12'));var authService=require(_0x64af('0x13'));var qs=require(_0x64af('0x14'));var as=require(_0x64af('0x15'));var hardwareService=require(_0x64af('0x16'));var logger=require(_0x64af('0x17'))(_0x64af('0x18'));var utils=require(_0x64af('0x19'));var config=require(_0x64af('0x1a'));var licenseUtil=require(_0x64af('0x1b'));var db=require(_0x64af('0x1c'))['db'];config[_0x64af('0x1d')]=_[_0x64af('0x1e')](config['redis'],{'host':_0x64af('0x1f'),'port':0x18eb});var socket=require(_0x64af('0x20'))(new Redis(config['redis']));require(_0x64af('0x21'))['register'](socket);function respondWithStatusCode(_0x20c769,_0x359ea1){_0x359ea1=_0x359ea1||0xcc;return function(_0x1e2cf1){if(_0x1e2cf1){return _0x20c769['sendStatus'](_0x359ea1);}return _0x20c769['status'](_0x359ea1)[_0x64af('0x22')]();};}function respondWithResult(_0x4f533f,_0xbac223){_0xbac223=_0xbac223||0xc8;return function(_0x28e326){if(_0x28e326){return _0x4f533f['status'](_0xbac223)[_0x64af('0x23')](_0x28e326);}};}function respondWithFilteredResult(_0x413c89,_0x397a22){return function(_0x5ef459){if(_0x5ef459){var _0x103f95=typeof _0x397a22[_0x64af('0x24')]===_0x64af('0x25')&&typeof _0x397a22[_0x64af('0x26')]===_0x64af('0x25');var _0x27dd77=_0x5ef459[_0x64af('0x27')];var _0x4abf84=_0x103f95?0x0:_0x397a22[_0x64af('0x24')];var _0x354c0f=_0x103f95?_0x5ef459[_0x64af('0x27')]:_0x397a22[_0x64af('0x24')]+_0x397a22[_0x64af('0x26')];var _0xa18d1d;if(_0x354c0f>=_0x27dd77){_0x354c0f=_0x27dd77;_0xa18d1d=0xc8;}else{_0xa18d1d=0xce;}_0x413c89[_0x64af('0x28')](_0xa18d1d);return _0x413c89[_0x64af('0x29')](_0x64af('0x2a'),_0x4abf84+'-'+_0x354c0f+'/'+_0x27dd77)[_0x64af('0x23')](_0x5ef459);}return null;};}function patchUpdates(_0x512c97){return function(_0x25cd18){try{jsonpatch[_0x64af('0x2b')](_0x25cd18,_0x512c97,!![]);}catch(_0xa714e7){return BPromise['reject'](_0xa714e7);}return _0x25cd18[_0x64af('0x2c')]();};}function saveUpdates(_0x676bcf,_0x40a2e3){return function(_0x3ed3ad){if(_0x3ed3ad){return _0x3ed3ad[_0x64af('0x2d')](_0x676bcf)[_0x64af('0x2e')](function(_0x234d05){return _0x234d05;});}return null;};}function removeEntity(_0x319e13,_0x35fd32){return function(_0x31cb93){if(_0x31cb93){return _0x31cb93['destroy']()[_0x64af('0x2e')](function(){_0x319e13['status'](0xcc)[_0x64af('0x22')]();});}};}function handleEntityNotFound(_0xfeb355,_0x2fe7a5){return function(_0xe37e35){if(!_0xe37e35){_0xfeb355[_0x64af('0x2f')](0x194);}return _0xe37e35;};}function handleError(_0x94cf63,_0x5c4aff){_0x5c4aff=_0x5c4aff||0x1f4;return function(_0x4758a4){logger['error'](_0x4758a4[_0x64af('0x30')]);if(_0x4758a4['name']){delete _0x4758a4[_0x64af('0x31')];}_0x94cf63['status'](_0x5c4aff)['send'](_0x4758a4);};}function getMustacheRender(_0x25be09,_0x45330b){return Mustache[_0x64af('0x32')](_0x25be09,_[_0x64af('0x33')](_0x45330b[_0x64af('0x34')],{'contact':_0x45330b[_0x64af('0x35')],'message':_0x45330b['message'],'agent':_0x45330b['agent'],'interaction':_0x45330b[_0x64af('0x36')],'account':_0x45330b[_0x64af('0x37')]}))||'';}exports[_0x64af('0x38')]=function(_0x137627,_0x5ea67d){var _0x297596={},_0x44685f={},_0x5eb410={'count':0x0,'rows':[]};var _0x46adbe=_['map'](db[_0x64af('0x39')][_0x64af('0x3a')],function(_0x587f54){return{'name':_0x587f54['fieldName'],'type':_0x587f54[_0x64af('0x3b')][_0x64af('0x3c')]};});_0x44685f[_0x64af('0x3d')]=_[_0x64af('0x3e')](_0x46adbe,'name');_0x44685f[_0x64af('0x3f')]=_['keys'](_0x137627[_0x64af('0x3f')]);_0x44685f['filters']=_['intersection'](_0x44685f[_0x64af('0x3d')],_0x44685f['query']);_0x297596['attributes']=_['intersection'](_0x44685f[_0x64af('0x3d')],qs[_0x64af('0x40')](_0x137627['query'][_0x64af('0x40')]));_0x297596[_0x64af('0x41')]=_0x297596[_0x64af('0x41')][_0x64af('0x42')]?_0x297596[_0x64af('0x41')]:_0x44685f[_0x64af('0x3d')];if(!_0x137627[_0x64af('0x3f')][_0x64af('0x43')]('nolimit')){_0x297596['limit']=qs[_0x64af('0x26')](_0x137627[_0x64af('0x3f')][_0x64af('0x26')]);_0x297596[_0x64af('0x24')]=qs['offset'](_0x137627[_0x64af('0x3f')][_0x64af('0x24')]);}_0x297596[_0x64af('0x44')]=qs['sort'](_0x137627[_0x64af('0x3f')][_0x64af('0x45')]);_0x297596[_0x64af('0x46')]=qs[_0x64af('0x47')](_['pick'](_0x137627[_0x64af('0x3f')],_0x44685f[_0x64af('0x47')]),_0x46adbe);if(_0x137627[_0x64af('0x3f')][_0x64af('0x48')]){_0x297596[_0x64af('0x46')]=_[_0x64af('0x33')](_0x297596[_0x64af('0x46')],{'$or':_['map'](_0x46adbe,function(_0x484093){if(_0x484093[_0x64af('0x3b')]!==_0x64af('0x49')){var _0x431afa={};_0x431afa[_0x484093[_0x64af('0x31')]]={'$like':'%'+_0x137627['query'][_0x64af('0x48')]+'%'};return _0x431afa;}})});}_0x297596=_['merge']({},_0x297596,_0x137627['options']);var _0x365a47={'where':_0x297596[_0x64af('0x46')]};return db[_0x64af('0x39')][_0x64af('0x27')](_0x365a47)[_0x64af('0x2e')](function(_0x3b89e2){_0x5eb410['count']=_0x3b89e2;if(_0x137627[_0x64af('0x3f')][_0x64af('0x4a')]){_0x297596[_0x64af('0x4b')]=[{'all':!![]}];}return db['UserProfile'][_0x64af('0x4c')](_0x297596);})[_0x64af('0x2e')](function(_0x22d46c){_0x5eb410[_0x64af('0x4d')]=_0x22d46c;return _0x5eb410;})[_0x64af('0x2e')](respondWithFilteredResult(_0x5ea67d,_0x297596))[_0x64af('0x4e')](handleError(_0x5ea67d,null));};exports[_0x64af('0x4f')]=function(_0x3fb176,_0x409dea){var _0x518d78={'raw':![],'where':{'id':_0x3fb176[_0x64af('0x50')]['id']}},_0x59a7f9={};_0x59a7f9[_0x64af('0x3d')]=_[_0x64af('0x51')](db[_0x64af('0x39')][_0x64af('0x3a')]);_0x59a7f9[_0x64af('0x3f')]=_[_0x64af('0x51')](_0x3fb176[_0x64af('0x3f')]);_0x59a7f9[_0x64af('0x47')]=_[_0x64af('0x52')](_0x59a7f9[_0x64af('0x3d')],_0x59a7f9['query']);_0x518d78['attributes']=_[_0x64af('0x52')](_0x59a7f9[_0x64af('0x3d')],qs['fields'](_0x3fb176['query'][_0x64af('0x40')]));_0x518d78[_0x64af('0x41')]=_0x518d78['attributes'][_0x64af('0x42')]?_0x518d78['attributes']:_0x59a7f9[_0x64af('0x3d')];if(_0x3fb176[_0x64af('0x3f')][_0x64af('0x4a')]){_0x518d78[_0x64af('0x4b')]=[{'all':!![]}];}_0x518d78=_['merge']({},_0x518d78,_0x3fb176[_0x64af('0x53')]);return db[_0x64af('0x39')]['find'](_0x518d78)[_0x64af('0x2e')](handleEntityNotFound(_0x409dea,null))[_0x64af('0x2e')](respondWithResult(_0x409dea,null))[_0x64af('0x4e')](handleError(_0x409dea,null));};exports['create']=function(_0x311342,_0xa55e54){return db['UserProfile'][_0x64af('0x54')](_0x311342[_0x64af('0x34')],{})['then'](respondWithResult(_0xa55e54,0xc9))[_0x64af('0x4e')](handleError(_0xa55e54,null));};exports[_0x64af('0x55')]=function(_0x3153c3,_0x365090){var _0x4796c4={'where':{'id':_0x3153c3[_0x64af('0x50')]['id']}},_0xd58c05={};_0xd58c05['model']=_[_0x64af('0x51')](db[_0x64af('0x39')]['rawAttributes']);_0x4796c4[_0x64af('0x41')]=_[_0x64af('0x52')](_0xd58c05['model'],qs[_0x64af('0x40')](_0x3153c3['query'][_0x64af('0x40')]));_0x4796c4[_0x64af('0x41')]=_0x4796c4[_0x64af('0x41')][_0x64af('0x42')]?_0x4796c4[_0x64af('0x41')]:_0xd58c05[_0x64af('0x3d')];if(_0x3153c3['query'][_0x64af('0x4a')]){_0x4796c4[_0x64af('0x4b')]=[{'all':!![]}];}_0x4796c4=_[_0x64af('0x33')]({},_0x4796c4,_0x3153c3[_0x64af('0x53')]);return db[_0x64af('0x39')][_0x64af('0x56')](_0x4796c4)['then'](handleEntityNotFound(_0x365090,null))[_0x64af('0x2e')](function(_0x519c18){if(_0x519c18){var _0x11e8b6=_0x519c18[_0x64af('0x57')]({'plain':!![]});_0x11e8b6=qs[_0x64af('0x58')](_0x11e8b6,['id',_0x64af('0x59'),_0x64af('0x5a'),_0x64af('0x5b')]);_0x3153c3[_0x64af('0x34')]=_[_0x64af('0x58')](_0x3153c3['body'],['id','createdAt',_0x64af('0x5a')]);return db[_0x64af('0x5c')][_0x64af('0x5d')](function(_0x1e1239){return db[_0x64af('0x39')]['create'](_[_0x64af('0x33')](_0x11e8b6,_0x3153c3[_0x64af('0x34')]),{'include':_0x3153c3[_0x64af('0x3f')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1e1239})[_0x64af('0x2e')](function(_0x511014){var _0x5629b4=_0x511014[_0x64af('0x57')]({'plain':!![]});return db['UserProfileSection'][_0x64af('0x4c')]({'where':{'userProfileId':_0x3153c3[_0x64af('0x50')]['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x10446a){if(_0x10446a){return BPromise['each'](_0x10446a,function(_0x304ebe){return new BPromise(function(_0x167d66,_0x45d492){if(_0x304ebe[_0x64af('0x5e')]===null||_0x304ebe[_0x64af('0x5e')]===0x1)_0x167d66(null);return db['UserProfileResource'][_0x64af('0x4c')]({'where':{'sectionId':_0x304ebe['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x591fb1){var _0x4667b2=_[_0x64af('0x3e')](_0x591fb1,function(_0x1996ec){return qs['omit'](_0x1996ec,['id',_0x64af('0x59'),_0x64af('0x5a'),_0x64af('0x5f')]);});_0x167d66(_0x4667b2);})[_0x64af('0x4e')](function(_0x26f654){_0x45d492(_0x26f654);});})[_0x64af('0x2e')](function(_0x32431b){var _0x1e452f=qs[_0x64af('0x58')](_0x304ebe,['id','createdAt',_0x64af('0x5a')]);_0x1e452f[_0x64af('0x60')]=_0x5629b4['id'];if(_0x32431b)_0x1e452f[_0x64af('0x61')]=_0x32431b;return _0x1e452f;})[_0x64af('0x2e')](function(_0x462fce){return db[_0x64af('0x62')][_0x64af('0x54')](_0x462fce,{'include':[{'model':db['UserProfileResource'],'as':_0x64af('0x61')}],'raw':!![],'transaction':_0x1e1239});});})[_0x64af('0x2e')](function(){return _0x5629b4;});}});});});}})[_0x64af('0x2e')](respondWithResult(_0x365090,0xc9))[_0x64af('0x4e')](handleError(_0x365090,null));};exports[_0x64af('0x2d')]=function(_0x47ff7d,_0x50d2e3){if(_0x47ff7d['body']['id']){delete _0x47ff7d[_0x64af('0x34')]['id'];}return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x47ff7d[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x50d2e3,null))[_0x64af('0x2e')](saveUpdates(_0x47ff7d[_0x64af('0x34')],null))[_0x64af('0x2e')](respondWithResult(_0x50d2e3,null))[_0x64af('0x4e')](handleError(_0x50d2e3,null));};exports[_0x64af('0x63')]=function(_0x56e881,_0x440a98){return db[_0x64af('0x39')]['find']({'where':{'id':_0x56e881[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x440a98,null))[_0x64af('0x2e')](removeEntity(_0x440a98,null))[_0x64af('0x4e')](handleError(_0x440a98,null));};exports['describe']=function(_0x37e252,_0x239dad){return db[_0x64af('0x39')][_0x64af('0x64')]()[_0x64af('0x2e')](respondWithResult(_0x239dad,null))[_0x64af('0x4e')](handleError(_0x239dad,null));};exports[_0x64af('0x65')]=function(_0x2d3204,_0x3a08f9){var _0x27ae57=_0x2d3204[_0x64af('0x34')];return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x2d3204['params']['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x3a08f9,null))[_0x64af('0x2e')](function(_0x3adb56){if(_0x3adb56){return db[_0x64af('0x5c')][_0x64af('0x5d')](function(_0x4d4741){return db[_0x64af('0x62')][_0x64af('0x63')]({'where':{'userProfileId':_0x2d3204[_0x64af('0x50')]['id'],'sectionId':_[_0x64af('0x3e')](_0x27ae57,function(_0x27115a){return _0x27115a[_0x64af('0x5f')];})},'transaction':_0x4d4741})[_0x64af('0x2e')](function(){var _0x971ac1=_[_0x64af('0x3e')](_0x27ae57,function(_0x59902b){_0x59902b[_0x64af('0x60')]=_0x2d3204['params']['id'];return _0x59902b;});var _0x47984d=[];return BPromise['each'](_0x971ac1,function(_0x236946){return db[_0x64af('0x62')][_0x64af('0x54')](_0x236946,{'include':[{'model':db[_0x64af('0x66')],'as':_0x64af('0x61')}],'raw':!![],'transaction':_0x4d4741})[_0x64af('0x2e')](function(_0x26d272){_0x47984d[_0x64af('0x67')](_0x26d272['get']({'plain':!![]}));});})[_0x64af('0x2e')](function(){return _0x47984d;});});});}})[_0x64af('0x2e')](function(_0x4de5fc){return _0x4de5fc;})[_0x64af('0x2e')](respondWithResult(_0x3a08f9,null))[_0x64af('0x4e')](handleError(_0x3a08f9,null));};exports[_0x64af('0x68')]=function(_0x45c4a9,_0x2aa790){var _0x1b4568;return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x45c4a9[_0x64af('0x50')]['id']},'attributes':['id',_0x64af('0x31')]})['then'](handleEntityNotFound(_0x2aa790,null))['then'](function(_0x22876b){if(_0x22876b){_0x1b4568=_0x22876b;return db[_0x64af('0x62')][_0x64af('0x63')]({'where':{'userProfileId':_0x45c4a9[_0x64af('0x50')]['id'],'sectionId':_0x45c4a9['query'][_0x64af('0x69')]}});}})[_0x64af('0x2e')](function(){return _0x1b4568;})['then'](respondWithStatusCode(_0x2aa790,null))[_0x64af('0x4e')](handleError(_0x2aa790,null));};exports[_0x64af('0x6a')]=function(_0x223852,_0x462ee3){var _0x534ecf=[];var _0x281b3c=[];return db[_0x64af('0x62')][_0x64af('0x4c')]({'where':{'userProfileId':_0x223852['params']['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x1d1615){_0x534ecf=_[_0x64af('0x48')](_0x1d1615,function(_0x107fe7){return _0x107fe7[_0x64af('0x6b')]===0x1||_[_0x64af('0x6c')]([0x3eb,0x709],_0x107fe7[_0x64af('0x5f')]);});if(!_['isEmpty'](_0x534ecf)){return _[_0x64af('0x3e')](_0x534ecf,function(_0x1a5d9d){return _0x1a5d9d[_0x64af('0x5f')];});}else{return;}})[_0x64af('0x2e')](function(_0x525819){if(_0x525819)_0x281b3c=_0x525819;if(_[_0x64af('0x6c')](_0x281b3c,0x64)){var _0x18de0a=_['find'](_0x534ecf,{'sectionId':0x64});return hasDefaultDashboard(_0x18de0a)[_0x64af('0x2e')](function(_0x3fc2df){return _[_0x64af('0x3e')](_0x534ecf,function(_0x34a9e5){if(_0x34a9e5[_0x64af('0x5f')]===0x64){_0x34a9e5['subsections']=_0x3fc2df;}return _0x34a9e5;});});}else{return;}})['then'](function(_0x3c86ed){if(_0x3c86ed)_0x534ecf=_0x3c86ed;if(_[_0x64af('0x6c')](_0x281b3c,0x3eb)){var _0x23a58b=_[_0x64af('0x56')](_0x534ecf,{'sectionId':0x3eb});return getCustomDashboards(_0x23a58b)[_0x64af('0x2e')](function(_0x4902b8){return _[_0x64af('0x3e')](_0x534ecf,function(_0x1512df){if(_0x23a58b['enabled']){if(_0x1512df[_0x64af('0x5f')]===0x3eb){_0x1512df['subsections']=_0x4902b8;}}else{if(_0x1512df[_0x64af('0x5f')]===0x64){_0x1512df['subsections']=_0x4902b8;}}return _0x1512df;});});}else{return;}})[_0x64af('0x2e')](function(_0xb10de7){if(_0xb10de7)_0x534ecf=_0xb10de7;if(_[_0x64af('0x6c')](_0x281b3c,0x709)){var _0x402b18=_['find'](_0x534ecf,{'sectionId':0x709});return getPlugins(_0x402b18)['then'](function(_0x2a8ca3){if(_0x402b18[_0x64af('0x6b')]){return _[_0x64af('0x3e')](_0x534ecf,function(_0x3cfd38){if(_0x3cfd38[_0x64af('0x5f')]===0x709){_0x3cfd38['subsections']=_0x2a8ca3;}return _0x3cfd38;});}else{var _0x357828={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2a8ca3};var _0x3450bd=_['map'](_0x534ecf);_0x3450bd[_0x64af('0x67')](_0x357828);return _0x3450bd;}});}else{return;}})[_0x64af('0x2e')](function(_0x47ebcf){if(_0x47ebcf)_0x534ecf=_0x47ebcf;return _[_0x64af('0x48')](_0x534ecf,['enabled',0x1]);})['then'](respondWithResult(_0x462ee3,null))[_0x64af('0x4e')](handleError(_0x462ee3,null));};function hasDefaultDashboard(_0x41879a){var _0x1b5160=[0x65];return new BPromise(function(_0x109a5f,_0x212536){try{if(_0x41879a[_0x64af('0x5e')]){_0x109a5f(_0x1b5160);}else{return db[_0x64af('0x66')][_0x64af('0x6d')]({'where':{'sectionId':_0x41879a['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x24e6a8){_0x24e6a8?_0x109a5f(_0x1b5160):_0x109a5f();});}}catch(_0x11304a){_0x212536(_0x11304a);}});}function getCustomDashboards(_0x3fc4ec){var _0x24605d=[];return new BPromise(function(_0x2ad828,_0x2a3707){try{if(_0x3fc4ec[_0x64af('0x5e')]){return db[_0x64af('0x6e')][_0x64af('0x4c')]({'raw':!![]})[_0x64af('0x2e')](function(_0x286d6b){_0x286d6b['forEach'](function(_0x425cad){_0x24605d[_0x64af('0x67')](_0x425cad['id']+0x1869f);});_0x2ad828(_0x24605d);});}else{return db[_0x64af('0x66')][_0x64af('0x4c')]({'where':{'sectionId':_0x3fc4ec['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x157248){_0x157248[_0x64af('0x6f')](function(_0x1685fa){_0x24605d[_0x64af('0x67')](_0x1685fa[_0x64af('0x70')]+0x1869f);});_0x2ad828(_0x24605d);});}}catch(_0xeff211){_0x2a3707(_0xeff211);}});}function getPlugins(_0x1467b2){var _0x5b82a9=[];return new BPromise(function(_0x20067e,_0x321a26){try{if(_0x1467b2['autoAssociation']){return db['Plugin'][_0x64af('0x4c')]({'raw':!![]})[_0x64af('0x2e')](function(_0x14a7e1){_0x14a7e1[_0x64af('0x6f')](function(_0x1e59d5){_0x5b82a9[_0x64af('0x67')](_0x1e59d5['id']+0x15b38);});_0x20067e(_0x5b82a9);});}else{return db['UserProfileResource'][_0x64af('0x4c')]({'where':{'sectionId':_0x1467b2['id']},'raw':!![]})['then'](function(_0xdb2a1a){_0xdb2a1a[_0x64af('0x6f')](function(_0x29656e){_0x5b82a9[_0x64af('0x67')](_0x29656e[_0x64af('0x70')]+0x15b38);});_0x20067e(_0x5b82a9);});}}catch(_0x91efba){_0x321a26(_0x91efba);}});}exports[_0x64af('0x71')]=function(_0x4c4034,_0x2c8af3){return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x4c4034[_0x64af('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c8af3,null))[_0x64af('0x2e')](function(_0x8e6327){if(_0x8e6327){return db[_0x64af('0x5c')][_0x64af('0x5d')](function(_0x110f0c){return db[_0x64af('0x62')]['findAll']({'where':{'userProfileId':_0x4c4034['params']['id']},'attributes':['id'],'raw':!![]})[_0x64af('0x2e')](function(_0x576e00){if(_0x576e00){return db[_0x64af('0x62')][_0x64af('0x63')]({'where':{'userProfileId':_0x4c4034[_0x64af('0x50')]['id'],'id':_[_0x64af('0x3e')](_0x576e00,function(_0x4af8a8){return _0x4af8a8['id'];})},'transaction':_0x110f0c});}})[_0x64af('0x2e')](function(_0x41747e){var _0x377015=_[_0x64af('0x3e')](_0x4c4034[_0x64af('0x34')],function(_0x34063f){_0x34063f[_0x64af('0x60')]=_0x4c4034[_0x64af('0x50')]['id'];return _0x34063f;});return db[_0x64af('0x62')][_0x64af('0x72')](_0x377015,{'raw':!![],'transaction':_0x110f0c});})[_0x64af('0x2e')](function(_0x4d82dd){var _0x3d0814=_[_0x64af('0x48')](_[_0x64af('0x3e')](_0x4d82dd,function(_0x39e9b8){return _0x39e9b8[_0x64af('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x3d0814){return db[_0x64af('0x62')][_0x64af('0x4c')]({'where':{'userProfileId':_0x4c4034[_0x64af('0x50')]['id'],'sectionId':_[_0x64af('0x3e')](_0x3d0814,function(_0x1ac242){return _0x1ac242[_0x64af('0x5f')];})},'attributes':['id',_0x64af('0x5f')],'raw':!![]})['then'](function(_0x571a36){var _0x574707=_[_0x64af('0x3e')](_0x4c4034[_0x64af('0x34')],function(_0x587364){_0x587364[_0x64af('0x60')]=_0x4c4034['params']['id'];return _0x587364;});return db[_0x64af('0x66')][_0x64af('0x72')](_0x574707,{'raw':!![],'transaction':_0x110f0c});});}})[_0x64af('0x4e')](handleError(_0x2c8af3,null));});}})[_0x64af('0x2e')](function(_0x46eb44){var _0xf0d5e2=_[_0x64af('0x3e')](_0x46eb44,function(_0x37a2b3){return _0x37a2b3['get']({'plain':!![]});});})[_0x64af('0x2e')](respondWithResult(_0x2c8af3,null))[_0x64af('0x4e')](handleError(_0x2c8af3,null));};exports['removeResources']=function(_0x4bca64,_0x24b7ba,_0x393ab8){return db[_0x64af('0x39')][_0x64af('0x56')]({'where':{'id':_0x4bca64[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x24b7ba,null))['then'](function(_0x4f02b7){if(_0x4f02b7){return _0x4f02b7[_0x64af('0x73')](_0x4bca64[_0x64af('0x3f')][_0x64af('0x69')]);}})[_0x64af('0x2e')](respondWithStatusCode(_0x24b7ba,null))[_0x64af('0x4e')](handleError(_0x24b7ba,null));};exports['getResources']=function(_0x2458f5,_0x23faeb){var _0xf86961={'raw':![],'where':{}};var _0x2d2114={};var _0x21bfd9={'count':0x0,'rows':[]};var _0x583f0f=_0x2458f5[_0x64af('0x3f')][_0x64af('0x74')];if(typeof _0x583f0f==='undefined'){throw new db[(_0x64af('0x75'))]['ValidationError'](_0x64af('0x76'));}var _0x5e1f82=_0x2458f5['query'][_0x64af('0x77')]||![];var _0x1648ea=getQueryModels(_0x583f0f,_0x5e1f82);if(typeof _0x1648ea['childModel']===_0x64af('0x25')){throw new db[(_0x64af('0x75'))][(_0x64af('0x78'))](_0x64af('0x79')+_0x583f0f+'\x27');}var _0x5b4171=[];if(!_['isEmpty'](_0x1648ea[_0x64af('0x7a')])){_0x5b4171=_0x1648ea[_0x64af('0x7a')];}else{_0x5b4171=[{'name':_0x583f0f}];}return db[_0x64af('0x39')][_0x64af('0x6d')]({'where':{'id':_0x2458f5[_0x64af('0x50')]['id']}})[_0x64af('0x2e')](handleEntityNotFound(_0x23faeb,null))[_0x64af('0x2e')](function(_0x214c25){if(_0x214c25){var _0x49d125=[];for(var _0x2b07e9=0x0;_0x2b07e9<_0x5b4171[_0x64af('0x42')];_0x2b07e9++){_0x49d125[_0x64af('0x67')](db[_0x64af('0x62')]['findOne']({'where':{'userProfileId':_0x214c25['id'],'name':_0x5b4171[_0x2b07e9][_0x64af('0x31')]},'raw':!![]}));}return BPromise[_0x64af('0x7b')](_0x49d125);}})['then'](function(_0x57a459){var _0x516975=_[_0x64af('0x48')](_0x57a459,function(_0x550d6c){return _0x550d6c?_0x550d6c:undefined;});var _0x55fcbf=_['filter'](_0x5b4171,[_0x64af('0x7c'),!![]]);var _0x21d637=_[_0x64af('0x7d')](_0x516975)&&_[_0x64af('0x7d')](_0x55fcbf)?null:_['union'](_0x55fcbf,_0x516975);if(_0x21d637){var _0x581d5f=[];for(var _0x34c92c=0x0;_0x34c92c<_0x21d637['length'];_0x34c92c++){var _0xa9aca0=_[_0x64af('0x56')](_0x5b4171,function(_0x518359){return _0x21d637[_0x34c92c]?_0x518359[_0x64af('0x31')]===_0x21d637[_0x34c92c][_0x64af('0x31')]:null;});if(_0xa9aca0){if(_0x21d637[_0x34c92c][_0x64af('0x7c')]){_0x581d5f[_0x64af('0x67')](getAllResources(_0x1648ea[_0x64af('0x7e')],_0x21d637[_0x34c92c]));}else{if(!_0x21d637[_0x34c92c][_0x64af('0x5e')]){_0x581d5f[_0x64af('0x67')](getAllowedResources(_0xa9aca0,_0x21d637[_0x34c92c],_0x1648ea[_0x64af('0x7e')]));}else{if(_0xa9aca0['model']){_0x581d5f[_0x64af('0x67')](getAllFilteredResources(_0xa9aca0,_0x21d637[_0x34c92c]));}}}}}return BPromise['all'](_0x581d5f);}else{return null;}})['then'](function(_0x7f2187){var _0x25c242=_0x7f2187;var _0xcd04d8=null;if(_0x25c242){_0xcd04d8=_0x25c242[_0x64af('0x42')]===0x1?_0x25c242[0x0]:null;}if(_0xcd04d8||_0x25c242){var _0x51c54a=db[_0x1648ea[_0x64af('0x7e')]]['rawAttributes'];_0x2d2114['model']=_[_0x64af('0x51')](_0x51c54a);_0x2d2114[_0x64af('0x3f')]=_[_0x64af('0x51')](_0x2458f5['query']);_0x2d2114[_0x64af('0x47')]=_[_0x64af('0x52')](_0x2d2114['model'],_0x2d2114[_0x64af('0x3f')]);_0xf86961['attributes']=_[_0x64af('0x52')](_0x2d2114[_0x64af('0x3d')],qs[_0x64af('0x40')](_0x2458f5[_0x64af('0x3f')][_0x64af('0x40')]));_0xf86961[_0x64af('0x41')]=_0xf86961[_0x64af('0x41')][_0x64af('0x42')]?_0xf86961[_0x64af('0x41')]:_0x2d2114[_0x64af('0x3d')];if(!_0x2458f5[_0x64af('0x3f')][_0x64af('0x43')](_0x64af('0x7f'))){_0xf86961[_0x64af('0x26')]=qs['limit'](_0x2458f5[_0x64af('0x3f')][_0x64af('0x26')]);_0xf86961[_0x64af('0x24')]=qs['offset'](_0x2458f5['query'][_0x64af('0x24')]);}_0xf86961[_0x64af('0x44')]=qs[_0x64af('0x45')](_0x2458f5[_0x64af('0x3f')][_0x64af('0x45')]);_0xf86961['where']=qs[_0x64af('0x47')](_[_0x64af('0x80')](_0x2458f5[_0x64af('0x3f')],_0x2d2114[_0x64af('0x47')]));if(_0x2458f5[_0x64af('0x3f')][_0x64af('0x48')]){_0xf86961[_0x64af('0x46')]=_[_0x64af('0x33')](_0xf86961['where'],{'$or':_[_0x64af('0x3e')](_0x51c54a,function(_0x13ee5b){if(_0x13ee5b[_0x64af('0x3b')]['key']!==_0x64af('0x49')){var _0x7970d8={};_0x7970d8[_0x13ee5b[_0x64af('0x81')]]={'$like':'%'+_0x2458f5['query'][_0x64af('0x48')]+'%'};return _0x7970d8;}})});}var _0x443703=[];if(_0xcd04d8){var _0x2ad3f1=_[_0x64af('0x56')](_0x5b4171,['name',_0xcd04d8[_0x64af('0x31')]]);if(_0x2ad3f1[_0x64af('0x81')]){var _0x248715={};if(_0x1648ea[_0x64af('0x7e')]==='AnalyticExtractedReport'){_0x248715[_0x2ad3f1[_0x64af('0x82')]]=_[_0x64af('0x3e')](_0xcd04d8[_0x64af('0x83')],'id');}else{_0x248715[_0x2ad3f1[_0x64af('0x82')]]=_0xcd04d8['associatedResources'];}_0x443703[_0x64af('0x67')](_0x248715);}else{_0xf86961[_0x64af('0x46')]['id']=_0xcd04d8[_0x64af('0x83')];}}else{for(var _0x398fc9=0x0;_0x398fc9<_0x25c242['length'];_0x398fc9++){var _0x2ad3f1=_[_0x64af('0x56')](_0x5b4171,[_0x64af('0x31'),_0x25c242[_0x398fc9][_0x64af('0x31')]]);if(_0x2ad3f1[_0x64af('0x81')]){var _0x248715={};_0x248715[_0x2ad3f1[_0x64af('0x82')]]=_0x25c242[_0x398fc9][_0x64af('0x83')];_0x443703[_0x64af('0x67')](_0x248715);}else{if(!_0xf86961[_0x64af('0x46')]['id'])_0xf86961[_0x64af('0x46')]['id']=[];_0x25c242[_0x398fc9][_0x64af('0x83')][_0x64af('0x6f')](function(_0x129c91){_0xf86961[_0x64af('0x46')]['id']['push'](_0x129c91);});}}}if(!_[_0x64af('0x7d')](_0x443703)){_0xf86961[_0x64af('0x46')]=_[_0x64af('0x33')](_0xf86961[_0x64af('0x46')],{'$and':{'$or':_0x443703}});}_0xf86961=_[_0x64af('0x33')]({},_0xf86961,_0x2458f5['options']);if(_0xcd04d8&&!_0xcd04d8['autoAssociation']&&_0x1648ea['childModel']==='AnalyticExtractedReport'){if(_0x2458f5['query']['includeAll']){_0xf86961['include']=[{'all':!![]}];}return db[_0x1648ea['childModel']][_0x64af('0x4c')](_0xf86961)[_0x64af('0x2e')](function(_0x2b0435){var _0x180975=[];_0x2b0435[_0x64af('0x6f')](function(_0x58d6bc){var _0xc0e99f;switch(_0x58d6bc['reportType']){case _0x64af('0x84'):_0xc0e99f=_[_0x64af('0x56')](_0xcd04d8[_0x64af('0x83')],function(_0x2888c7){return _0x2888c7['id']===_0x58d6bc[_0x64af('0x85')]&&_0x2888c7['type']===_0x64af('0x86');});break;case _0x64af('0x87'):_0xc0e99f=_[_0x64af('0x56')](_0xcd04d8['associatedResources'],function(_0x1c348c){return _0x1c348c['id']===_0x58d6bc[_0x64af('0x85')]&&_0x1c348c[_0x64af('0x3b')]===_0x64af('0x88');});break;}if(_0xc0e99f)_0x180975[_0x64af('0x67')](_0x58d6bc);});_0x21bfd9[_0x64af('0x27')]=_0x180975[_0x64af('0x42')];_0x21bfd9[_0x64af('0x4d')]=_0x180975;return _0x21bfd9;});}else{return db[_0x1648ea[_0x64af('0x7e')]][_0x64af('0x27')]({'where':_0xf86961[_0x64af('0x46')]})[_0x64af('0x2e')](function(_0x1a7741){_0x21bfd9[_0x64af('0x27')]=_0x1a7741;if(_0x2458f5[_0x64af('0x3f')][_0x64af('0x4a')]){if(_0x1648ea[_0x64af('0x7e')]===_0x64af('0x89')){_0xf86961[_0x64af('0x4b')]=[{'model':db[_0x64af('0x8a')],'as':_0x64af('0x8b'),'attributes':['id',_0x64af('0x31'),_0x64af('0x8c')],'required':_0x2458f5[_0x64af('0x3f')]['tag']?!![]:![]},{'model':db[_0x64af('0x8a')],'as':_0x64af('0x8d'),'attributes':['id',_0x64af('0x31'),_0x64af('0x8c')],'through':_0x2458f5[_0x64af('0x3f')][_0x64af('0x8e')]?{'attributes':[],'where':{'TagId':_0x2458f5[_0x64af('0x3f')][_0x64af('0x8e')]||undefined}}:{},'required':_0x2458f5[_0x64af('0x3f')][_0x64af('0x8e')]?!![]:![]}];}else{_0xf86961[_0x64af('0x4b')]=[{'all':!![]}];}}return db[_0x1648ea[_0x64af('0x7e')]][_0x64af('0x4c')](_0xf86961);})[_0x64af('0x2e')](function(_0x3127f1){_0x21bfd9[_0x64af('0x4d')]=_0x3127f1;if(_0x583f0f===_0x64af('0x8f')&&_0x2458f5[_0x64af('0x3f')][_0x64af('0x90')]===_0x64af('0x91')){var _0x5c3422=[];for(var _0x5edfb6=0x0;_0x5edfb6<_0x21bfd9['rows']['length'];_0x5edfb6++){_0x5c3422[_0x64af('0x67')](getOpenTabs(_0x64af('0x92'),_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422[_0x64af('0x67')](getOpenTabs(_0x64af('0x94'),_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422[_0x64af('0x67')](getOpenTabs('fax',_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422[_0x64af('0x67')](getOpenTabs('mail',_0x21bfd9[_0x64af('0x4d')][_0x5edfb6][_0x64af('0x93')]));_0x5c3422['push'](getOpenTabs(_0x64af('0x95'),_0x21bfd9[_0x64af('0x4d')][_0x5edfb6]['dataValues']));_0x5c3422[_0x64af('0x67')](getOpenTabs(_0x64af('0x96'),_0x21bfd9['rows'][_0x5edfb6][_0x64af('0x93')]));}return Promise[_0x64af('0x7b')](_0x5c3422)['then'](function(){return _0x21bfd9;});}return _0x21bfd9;});}}else{return _0x21bfd9;}})['then'](respondWithFilteredResult(_0x23faeb,_0xf86961))[_0x64af('0x4e')](handleError(_0x23faeb,null));};function getOpenTabs(_0x50fe1d,_0x8ba50){var _0x22424a=_0x50fe1d[_0x64af('0x97')](0x0)[_0x64af('0x98')]()+_0x50fe1d[_0x64af('0x99')](0x1);var _0x7a0a98={'type':db[_0x64af('0x75')]['QueryTypes']['SELECT'],'raw':!![]};return new BPromise(function(_0x3fd685,_0x5da6ba){var _0x45c434=squel[_0x64af('0x9a')]()[_0x64af('0x81')](_0x64af('0x9b')+_0x22424a+'InteractionId','id')[_0x64af('0x81')](_0x64af('0x9c'))['from'](_0x64af('0x9d')+_0x50fe1d+'_interactions','ui')[_0x64af('0x46')](_0x64af('0x9e'),_0x8ba50['id']);return db[_0x64af('0x5c')][_0x64af('0x3f')](_0x45c434['toString'](),_0x7a0a98)['then'](function(_0x7b6d6e){_0x8ba50[_0x22424a+_0x64af('0x9f')]=_0x7b6d6e;_0x3fd685(_0x7b6d6e);})[_0x64af('0x4e')](function(_0x45be94){_0x5da6ba(_0x45be94);});});}function getAllResources(_0x29d231,_0x543fb5){return new BPromise(function(_0x22477a,_0x248e09){if(_0x543fb5){var _0x5245b=_0x543fb5[_0x64af('0x48')]?{[_0x543fb5[_0x64af('0x48')][_0x64af('0x81')]]:_0x543fb5[_0x64af('0x48')][_0x64af('0xa0')]}:undefined;return db[_0x29d231][_0x64af('0x4c')]({'where':_0x5245b,'raw':!![]})[_0x64af('0x2e')](function(_0x317cd3){_0x543fb5['associatedResources']=_[_0x64af('0x3e')](_0x317cd3,'id');_0x22477a(_0x543fb5);})[_0x64af('0x4e')](function(_0x2063c1){_0x248e09(_0x2063c1);});}else{_0x22477a(null);}});}function getAllFilteredResources(_0x2c8ecb,_0x55ade3){return new BPromise(function(_0x38ec67,_0x40bd1a){var _0x47d8ea=_0x2c8ecb[_0x64af('0x48')]?{[_0x2c8ecb[_0x64af('0x48')][_0x64af('0x81')]]:_0x2c8ecb[_0x64af('0x48')][_0x64af('0xa0')]}:undefined;return db[_0x2c8ecb[_0x64af('0x3d')]][_0x64af('0x4c')]({'where':_0x47d8ea,'raw':!![]})[_0x64af('0x2e')](function(_0x58ad6e){_0x55ade3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x58ad6e,function(_0xd0dc76){return _0x2c8ecb['field']?_0xd0dc76[_0x2c8ecb[_0x64af('0x81')]]:_0xd0dc76[_0x64af('0x31')];});_0x38ec67(_0x55ade3);})[_0x64af('0x4e')](function(_0x3a222d){_0x40bd1a(_0x3a222d);});});}function getAllowedResources(_0x25a09e,_0x4097f3,_0x29340f){return new BPromise(function(_0x3583f2,_0xadb860){if(_0x4097f3){return db[_0x64af('0x66')][_0x64af('0x4c')]({'where':{'sectionId':_0x4097f3['id']},'raw':!![]})[_0x64af('0x2e')](function(_0x2e91df){if(_0x25a09e[_0x64af('0x81')]&&_0x25a09e['field']!=='id'){_0x4097f3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x2e91df,function(_0x48284e){return _0x48284e[_0x25a09e[_0x64af('0x81')]];});}else{if(_0x29340f==='AnalyticExtractedReport'){_0x4097f3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x2e91df,function(_0x51dffa){return{'id':_0x51dffa[_0x64af('0x70')],'type':_0x51dffa[_0x64af('0x3b')]};});}else{_0x4097f3[_0x64af('0x83')]=_[_0x64af('0x3e')](_0x2e91df,function(_0x55d0bc){return _0x55d0bc[_0x64af('0x70')];});}}_0x3583f2(_0x4097f3);})[_0x64af('0x4e')](function(_0x583c1b){_0xadb860(_0x583c1b);});}else{_0x3583f2(null);}});}function getQueryModels(_0x205e43,_0x265ee7){var _0x9a2a08=_0x205e43[_0x64af('0xa1')]();var _0x5f82a3={'childModel':undefined,'parentSections':[]};switch(_0x9a2a08){case'squareprojects':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xa2');break;case _0x64af('0xa3'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xa4');break;case _0x64af('0xa5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xa6');_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0xa7'),'field':_0x64af('0x31'),'foreignKey':_0x64af('0xa8')}];break;case _0x64af('0xa9'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xaa');break;case _0x64af('0xab'):_0x5f82a3['childModel']=_0x64af('0x89');_0x5f82a3['parentSections']=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x64af('0xac'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xad');break;case _0x64af('0xae'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xaf');break;case'globalcustomfields':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xb0');break;case _0x64af('0xb1'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xb2');break;case _0x64af('0xb3'):_0x5f82a3[_0x64af('0x7e')]='ChatWebsite';break;case _0x64af('0xb4'):_0x5f82a3[_0x64af('0x7e')]='FaxQueue';break;case _0x64af('0xb5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xb6');break;case _0x64af('0xb7'):case _0x64af('0xb8'):case _0x64af('0xb9'):_0x5f82a3['childModel']=_0x64af('0xba');break;case'contexts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xbb');break;case _0x64af('0xbc'):_0x5f82a3['childModel']=_0x64af('0xbd');break;case _0x64af('0xbe'):_0x5f82a3[_0x64af('0x7e')]='VoiceRecording';_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0x8f'),'field':'name','foreignKey':_0x64af('0xbf'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':['agent']}},{'name':_0x64af('0xc2'),'field':'name','foreignKey':_0x64af('0xbf'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':[_0x64af('0xc3')]}},{'name':_0x64af('0xc4'),'field':_0x64af('0x31'),'foreignKey':_0x64af('0xc5'),'model':_0x64af('0xc6'),'filter':{'field':_0x64af('0x3b'),'value':['inbound']}},{'name':_0x64af('0xc7'),'field':_0x64af('0x31'),'foreignKey':'queue','model':_0x64af('0xc6'),'filter':{'field':_0x64af('0x3b'),'value':[_0x64af('0xc8')]}}];break;case'musiconholds':_0x5f82a3['childModel']='VoiceMusicOnHold';break;case _0x64af('0xc9'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xca');break;case _0x64af('0xcb'):_0x5f82a3['childModel']=_0x64af('0xcc');break;case'ivrcampaigns':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xcd');break;case _0x64af('0xce'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xcf');break;case _0x64af('0xd0'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd1');break;case _0x64af('0xd2'):_0x5f82a3[_0x64af('0x7e')]='MailSubstatus';break;case _0x64af('0xd3'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd4');break;case _0x64af('0xd5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd6');break;case _0x64af('0xd7'):_0x5f82a3['childModel']=_0x64af('0xd8');break;case'smsaccounts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xd9');break;case'whatsappqueues':_0x5f82a3['childModel']='WhatsappQueue';break;case _0x64af('0xda'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xdb');break;case'voicequeues':case'queuecampaigns':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xc6');if(_0x265ee7){_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0xc4')},{'name':_0x64af('0xc7')}];}break;case'users':case _0x64af('0xdc'):case _0x64af('0xdd'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xc0');if(_0x265ee7){_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0xde'),'filter':{'field':_0x64af('0xc1'),'value':[_0x64af('0xdf'),_0x64af('0xe0')]},'ignore':!![]},{'name':_0x64af('0x8f')},{'name':_0x64af('0xc2')}];}break;case _0x64af('0xe1'):_0x5f82a3['childModel']=_0x64af('0xe2');break;case _0x64af('0xe3'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe4');break;case _0x64af('0xe5'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe6');break;case'sugarcrmaccounts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe7');break;case _0x64af('0xe8'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xe9');break;case _0x64af('0xea'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xeb');break;case _0x64af('0xec'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xc0');break;case _0x64af('0xed'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xee');break;case _0x64af('0xef'):_0x5f82a3['childModel']=_0x64af('0xf0');break;case _0x64af('0xf1'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x6e');break;case'intervals':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xf2');break;case _0x64af('0xf3'):_0x5f82a3['childModel']=_0x64af('0xf4');break;case _0x64af('0xf5'):_0x5f82a3['childModel']=_0x64af('0xf6');break;case _0x64af('0xf7'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xf8');break;case _0x64af('0xf9'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x8a');break;case'templates':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xfa');break;case _0x64af('0xfb'):_0x5f82a3[_0x64af('0x7e')]='Trigger';break;case _0x64af('0xfc'):_0x5f82a3['childModel']=_0x64af('0xfd');break;case _0x64af('0xfe'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0xff');break;case _0x64af('0x100'):_0x5f82a3['childModel']=_0x64af('0x101');break;case'extractedreports':_0x5f82a3[_0x64af('0x7e')]='AnalyticExtractedReport';_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0x102'),'field':'id','foreignKey':_0x64af('0x85')}];break;case _0x64af('0x103'):_0x5f82a3['childModel']=_0x64af('0x104');break;case'whatsappaccounts':_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x105');break;case _0x64af('0x106'):_0x5f82a3[_0x64af('0x7e')]=_0x64af('0x107');_0x5f82a3[_0x64af('0x7a')]=[{'name':_0x64af('0x8f'),'field':'id','foreignKey':_0x64af('0x108'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':['agent']}},{'name':'Telephones','field':'id','foreignKey':_0x64af('0x108'),'model':_0x64af('0xc0'),'filter':{'field':_0x64af('0xc1'),'value':[_0x64af('0xc3')]}}];break;default:return _0x5f82a3;}return _0x5f82a3;} \ No newline at end of file +var _0x566a=['outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','WhatsappQueue','Team','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','customdashboards','pauses','Schedule','sounds','Sound','tags','triggers','Trigger','trunks','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','screenrecordings','ScreenRecording','UserId','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./userProfile.socket','register','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','merge','body','agent','interaction','index','map','UserProfile','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','count','include','findAll','params','keys','includeAll','options','catch','create','clone','find','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','update','describe','addSections','sectionId','removeSections','getSections','enabled','includes','subsections','findOne','Dashboard','push','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','ids','getResources','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','isEmpty','childModel','nolimit','order','type','VIRTUAL','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','DefaultReports','custom','reportId','CmContact','Tag','tag','ThroughTags','color','rows','Agents','openTabs','dataValues','fax','mail','openchannel','whatsapp','charAt','slice','QueryTypes','SELECT','select','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','value','toLowerCase','squareprojects','SquareProject','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes'];(function(_0x3ea5f0,_0x2e4157){var _0x16041e=function(_0x33669a){while(--_0x33669a){_0x3ea5f0['push'](_0x3ea5f0['shift']());}};_0x16041e(++_0x2e4157);}(_0x566a,0x147));var _0xa566=function(_0x324b46,_0x4e9ea8){_0x324b46=_0x324b46-0x0;var _0x84ce54=_0x566a[_0x324b46];return _0x84ce54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa566('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa566('0x1'));var rp=require(_0xa566('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa566('0x3'));var util=require(_0xa566('0x4'));var path=require(_0xa566('0x5'));var sox=require(_0xa566('0x6'));var csv=require(_0xa566('0x7'));var ejs=require(_0xa566('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa566('0x9'));var squel=require(_0xa566('0xa'));var crypto=require('crypto');var jsforce=require(_0xa566('0xb'));var deskjs=require(_0xa566('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa566('0xd'));var Papa=require(_0xa566('0xe'));var Redis=require(_0xa566('0xf'));var authService=require(_0xa566('0x10'));var qs=require(_0xa566('0x11'));var as=require(_0xa566('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa566('0x13'))(_0xa566('0x14'));var utils=require(_0xa566('0x15'));var config=require(_0xa566('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa566('0x17'))['db'];config[_0xa566('0x18')]=_['defaults'](config[_0xa566('0x18')],{'host':_0xa566('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa566('0x18')]));require(_0xa566('0x1a'))[_0xa566('0x1b')](socket);function respondWithStatusCode(_0x162b43,_0xe366c5){_0xe366c5=_0xe366c5||0xcc;return function(_0x44a3ee){if(_0x44a3ee){return _0x162b43[_0xa566('0x1c')](_0xe366c5);}return _0x162b43[_0xa566('0x1d')](_0xe366c5)[_0xa566('0x1e')]();};}function respondWithResult(_0x4a9287,_0x2f2736){_0x2f2736=_0x2f2736||0xc8;return function(_0x5a3642){if(_0x5a3642){return _0x4a9287[_0xa566('0x1d')](_0x2f2736)['json'](_0x5a3642);}};}function respondWithFilteredResult(_0x5e0ba2,_0x1d4cce){return function(_0x37ce2a){if(_0x37ce2a){var _0x542e3e=typeof _0x1d4cce[_0xa566('0x1f')]==='undefined'&&typeof _0x1d4cce[_0xa566('0x20')]===_0xa566('0x21');var _0x35ae1e=_0x37ce2a['count'];var _0x3f59c5=_0x542e3e?0x0:_0x1d4cce['offset'];var _0xcd9a1d=_0x542e3e?_0x37ce2a['count']:_0x1d4cce['offset']+_0x1d4cce['limit'];var _0xb15d7b;if(_0xcd9a1d>=_0x35ae1e){_0xcd9a1d=_0x35ae1e;_0xb15d7b=0xc8;}else{_0xb15d7b=0xce;}_0x5e0ba2[_0xa566('0x1d')](_0xb15d7b);return _0x5e0ba2[_0xa566('0x22')](_0xa566('0x23'),_0x3f59c5+'-'+_0xcd9a1d+'/'+_0x35ae1e)[_0xa566('0x24')](_0x37ce2a);}return null;};}function patchUpdates(_0x43eb63){return function(_0x48e1d7){try{jsonpatch[_0xa566('0x25')](_0x48e1d7,_0x43eb63,!![]);}catch(_0x18c389){return BPromise[_0xa566('0x26')](_0x18c389);}return _0x48e1d7[_0xa566('0x27')]();};}function saveUpdates(_0x4c56d1,_0xfffcdf){return function(_0x1e2397){if(_0x1e2397){return _0x1e2397['update'](_0x4c56d1)[_0xa566('0x28')](function(_0x413f13){return _0x413f13;});}return null;};}function removeEntity(_0x189ff4,_0x128b6f){return function(_0x386706){if(_0x386706){return _0x386706[_0xa566('0x29')]()[_0xa566('0x28')](function(){_0x189ff4['status'](0xcc)[_0xa566('0x1e')]();});}};}function handleEntityNotFound(_0x359da8,_0xdf3c18){return function(_0x26cdd8){if(!_0x26cdd8){_0x359da8[_0xa566('0x1c')](0x194);}return _0x26cdd8;};}function handleError(_0x59e7eb,_0x8b225d){_0x8b225d=_0x8b225d||0x1f4;return function(_0x219444){logger[_0xa566('0x2a')](_0x219444[_0xa566('0x2b')]);if(_0x219444[_0xa566('0x2c')]){delete _0x219444[_0xa566('0x2c')];}_0x59e7eb[_0xa566('0x1d')](_0x8b225d)[_0xa566('0x2d')](_0x219444);};}function getMustacheRender(_0x682734,_0x2aca29){return Mustache['render'](_0x682734,_[_0xa566('0x2e')](_0x2aca29[_0xa566('0x2f')],{'contact':_0x2aca29['contact'],'message':_0x2aca29['message'],'agent':_0x2aca29[_0xa566('0x30')],'interaction':_0x2aca29[_0xa566('0x31')],'account':_0x2aca29['account']}))||'';}exports[_0xa566('0x32')]=function(_0x36ff0c,_0x2cc78d){var _0xb53ccd={},_0x27f38e={},_0x202d78={'count':0x0,'rows':[]};var _0x41e36c=_[_0xa566('0x33')](db[_0xa566('0x34')][_0xa566('0x35')],function(_0x4dd1bd){return{'name':_0x4dd1bd[_0xa566('0x36')],'type':_0x4dd1bd['type'][_0xa566('0x37')]};});_0x27f38e[_0xa566('0x38')]=_[_0xa566('0x33')](_0x41e36c,_0xa566('0x2c'));_0x27f38e[_0xa566('0x39')]=_['keys'](_0x36ff0c['query']);_0x27f38e[_0xa566('0x3a')]=_[_0xa566('0x3b')](_0x27f38e[_0xa566('0x38')],_0x27f38e[_0xa566('0x39')]);_0xb53ccd[_0xa566('0x3c')]=_[_0xa566('0x3b')](_0x27f38e[_0xa566('0x38')],qs[_0xa566('0x3d')](_0x36ff0c[_0xa566('0x39')][_0xa566('0x3d')]));_0xb53ccd[_0xa566('0x3c')]=_0xb53ccd[_0xa566('0x3c')][_0xa566('0x3e')]?_0xb53ccd['attributes']:_0x27f38e['model'];if(!_0x36ff0c[_0xa566('0x39')][_0xa566('0x3f')]('nolimit')){_0xb53ccd[_0xa566('0x20')]=qs['limit'](_0x36ff0c[_0xa566('0x39')][_0xa566('0x20')]);_0xb53ccd['offset']=qs[_0xa566('0x1f')](_0x36ff0c[_0xa566('0x39')]['offset']);}_0xb53ccd['order']=qs[_0xa566('0x40')](_0x36ff0c[_0xa566('0x39')][_0xa566('0x40')]);_0xb53ccd[_0xa566('0x41')]=qs[_0xa566('0x3a')](_['pick'](_0x36ff0c[_0xa566('0x39')],_0x27f38e[_0xa566('0x3a')]),_0x41e36c);if(_0x36ff0c[_0xa566('0x39')][_0xa566('0x42')]){_0xb53ccd[_0xa566('0x41')]=_['merge'](_0xb53ccd['where'],{'$or':_[_0xa566('0x33')](_0x41e36c,function(_0x390992){if(_0x390992['type']!=='VIRTUAL'){var _0x29026c={};_0x29026c[_0x390992[_0xa566('0x2c')]]={'$like':'%'+_0x36ff0c[_0xa566('0x39')][_0xa566('0x42')]+'%'};return _0x29026c;}})});}_0xb53ccd=_['merge']({},_0xb53ccd,_0x36ff0c['options']);var _0x47761a={'where':_0xb53ccd[_0xa566('0x41')]};return db['UserProfile'][_0xa566('0x43')](_0x47761a)['then'](function(_0x3dfa7c){_0x202d78[_0xa566('0x43')]=_0x3dfa7c;if(_0x36ff0c[_0xa566('0x39')]['includeAll']){_0xb53ccd[_0xa566('0x44')]=[{'all':!![]}];}return db[_0xa566('0x34')][_0xa566('0x45')](_0xb53ccd);})['then'](function(_0xf49ca3){_0x202d78['rows']=_0xf49ca3;return _0x202d78;})[_0xa566('0x28')](respondWithFilteredResult(_0x2cc78d,_0xb53ccd))['catch'](handleError(_0x2cc78d,null));};exports['show']=function(_0x198c44,_0x24049a){var _0x307ab1={'raw':![],'where':{'id':_0x198c44[_0xa566('0x46')]['id']}},_0x214c8c={};_0x214c8c[_0xa566('0x38')]=_[_0xa566('0x47')](db[_0xa566('0x34')][_0xa566('0x35')]);_0x214c8c[_0xa566('0x39')]=_[_0xa566('0x47')](_0x198c44[_0xa566('0x39')]);_0x214c8c[_0xa566('0x3a')]=_[_0xa566('0x3b')](_0x214c8c['model'],_0x214c8c[_0xa566('0x39')]);_0x307ab1[_0xa566('0x3c')]=_[_0xa566('0x3b')](_0x214c8c[_0xa566('0x38')],qs[_0xa566('0x3d')](_0x198c44[_0xa566('0x39')][_0xa566('0x3d')]));_0x307ab1[_0xa566('0x3c')]=_0x307ab1[_0xa566('0x3c')]['length']?_0x307ab1['attributes']:_0x214c8c[_0xa566('0x38')];if(_0x198c44[_0xa566('0x39')][_0xa566('0x48')]){_0x307ab1[_0xa566('0x44')]=[{'all':!![]}];}_0x307ab1=_['merge']({},_0x307ab1,_0x198c44[_0xa566('0x49')]);return db[_0xa566('0x34')]['find'](_0x307ab1)[_0xa566('0x28')](handleEntityNotFound(_0x24049a,null))[_0xa566('0x28')](respondWithResult(_0x24049a,null))[_0xa566('0x4a')](handleError(_0x24049a,null));};exports[_0xa566('0x4b')]=function(_0x14843e,_0x3e3610){return db[_0xa566('0x34')]['create'](_0x14843e[_0xa566('0x2f')],{})['then'](respondWithResult(_0x3e3610,0xc9))[_0xa566('0x4a')](handleError(_0x3e3610,null));};exports[_0xa566('0x4c')]=function(_0xd6e33e,_0x1cee00){var _0x4564f7={'where':{'id':_0xd6e33e['params']['id']}},_0x14c07d={};_0x14c07d[_0xa566('0x38')]=_[_0xa566('0x47')](db['UserProfile'][_0xa566('0x35')]);_0x4564f7[_0xa566('0x3c')]=_[_0xa566('0x3b')](_0x14c07d[_0xa566('0x38')],qs['fields'](_0xd6e33e['query']['fields']));_0x4564f7['attributes']=_0x4564f7['attributes'][_0xa566('0x3e')]?_0x4564f7[_0xa566('0x3c')]:_0x14c07d[_0xa566('0x38')];if(_0xd6e33e[_0xa566('0x39')][_0xa566('0x48')]){_0x4564f7[_0xa566('0x44')]=[{'all':!![]}];}_0x4564f7=_[_0xa566('0x2e')]({},_0x4564f7,_0xd6e33e[_0xa566('0x49')]);return db[_0xa566('0x34')][_0xa566('0x4d')](_0x4564f7)[_0xa566('0x28')](handleEntityNotFound(_0x1cee00,null))[_0xa566('0x28')](function(_0x411e07){if(_0x411e07){var _0x8b28c0=_0x411e07[_0xa566('0x4e')]({'plain':!![]});_0x8b28c0=qs[_0xa566('0x4f')](_0x8b28c0,['id',_0xa566('0x50'),_0xa566('0x51'),'crudPermissions']);_0xd6e33e[_0xa566('0x2f')]=_[_0xa566('0x4f')](_0xd6e33e[_0xa566('0x2f')],['id',_0xa566('0x50'),_0xa566('0x51')]);return db[_0xa566('0x52')][_0xa566('0x53')](function(_0x560f81){return db['UserProfile'][_0xa566('0x4b')](_[_0xa566('0x2e')](_0x8b28c0,_0xd6e33e[_0xa566('0x2f')]),{'include':_0xd6e33e[_0xa566('0x39')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x560f81})[_0xa566('0x28')](function(_0x1aa1f8){var _0x602fc8=_0x1aa1f8['get']({'plain':!![]});return db[_0xa566('0x54')]['findAll']({'where':{'userProfileId':_0xd6e33e[_0xa566('0x46')]['id']},'raw':!![]})[_0xa566('0x28')](function(_0x49f1be){if(_0x49f1be){return BPromise[_0xa566('0x55')](_0x49f1be,function(_0x2af76c){return new BPromise(function(_0x1e4f29,_0x326c07){if(_0x2af76c[_0xa566('0x56')]===null||_0x2af76c[_0xa566('0x56')]===0x1)_0x1e4f29(null);return db[_0xa566('0x57')][_0xa566('0x45')]({'where':{'sectionId':_0x2af76c['id']},'raw':!![]})['then'](function(_0xdf7c4d){var _0x16a4e4=_[_0xa566('0x33')](_0xdf7c4d,function(_0x529a4f){return qs[_0xa566('0x4f')](_0x529a4f,['id',_0xa566('0x50'),'updatedAt','sectionId']);});_0x1e4f29(_0x16a4e4);})[_0xa566('0x4a')](function(_0x1dc873){_0x326c07(_0x1dc873);});})[_0xa566('0x28')](function(_0x2c6cba){var _0x5e98fc=qs[_0xa566('0x4f')](_0x2af76c,['id',_0xa566('0x50'),_0xa566('0x51')]);_0x5e98fc[_0xa566('0x58')]=_0x602fc8['id'];if(_0x2c6cba)_0x5e98fc[_0xa566('0x59')]=_0x2c6cba;return _0x5e98fc;})['then'](function(_0x4376d3){return db['UserProfileSection'][_0xa566('0x4b')](_0x4376d3,{'include':[{'model':db['UserProfileResource'],'as':_0xa566('0x59')}],'raw':!![],'transaction':_0x560f81});});})[_0xa566('0x28')](function(){return _0x602fc8;});}});});});}})['then'](respondWithResult(_0x1cee00,0xc9))[_0xa566('0x4a')](handleError(_0x1cee00,null));};exports[_0xa566('0x5a')]=function(_0x17b83b,_0x400106){if(_0x17b83b[_0xa566('0x2f')]['id']){delete _0x17b83b[_0xa566('0x2f')]['id'];}return db[_0xa566('0x34')][_0xa566('0x4d')]({'where':{'id':_0x17b83b[_0xa566('0x46')]['id']}})[_0xa566('0x28')](handleEntityNotFound(_0x400106,null))[_0xa566('0x28')](saveUpdates(_0x17b83b[_0xa566('0x2f')],null))[_0xa566('0x28')](respondWithResult(_0x400106,null))['catch'](handleError(_0x400106,null));};exports[_0xa566('0x29')]=function(_0x4a9879,_0x203721){return db[_0xa566('0x34')][_0xa566('0x4d')]({'where':{'id':_0x4a9879[_0xa566('0x46')]['id']}})[_0xa566('0x28')](handleEntityNotFound(_0x203721,null))[_0xa566('0x28')](removeEntity(_0x203721,null))[_0xa566('0x4a')](handleError(_0x203721,null));};exports['describe']=function(_0x36054f,_0x555979){return db[_0xa566('0x34')][_0xa566('0x5b')]()[_0xa566('0x28')](respondWithResult(_0x555979,null))[_0xa566('0x4a')](handleError(_0x555979,null));};exports[_0xa566('0x5c')]=function(_0x400fc2,_0x12b28f){var _0x1ea63d=_0x400fc2[_0xa566('0x2f')];return db['UserProfile'][_0xa566('0x4d')]({'where':{'id':_0x400fc2[_0xa566('0x46')]['id']}})[_0xa566('0x28')](handleEntityNotFound(_0x12b28f,null))[_0xa566('0x28')](function(_0x4181e0){if(_0x4181e0){return db['sequelize']['transaction'](function(_0x527ee5){return db[_0xa566('0x54')][_0xa566('0x29')]({'where':{'userProfileId':_0x400fc2[_0xa566('0x46')]['id'],'sectionId':_[_0xa566('0x33')](_0x1ea63d,function(_0x5b55c5){return _0x5b55c5[_0xa566('0x5d')];})},'transaction':_0x527ee5})[_0xa566('0x28')](function(){var _0x22eb20=_['map'](_0x1ea63d,function(_0x4ec2a8){_0x4ec2a8[_0xa566('0x58')]=_0x400fc2[_0xa566('0x46')]['id'];return _0x4ec2a8;});var _0x1f0cfb=[];return BPromise[_0xa566('0x55')](_0x22eb20,function(_0x15a870){return db[_0xa566('0x54')][_0xa566('0x4b')](_0x15a870,{'include':[{'model':db[_0xa566('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x527ee5})[_0xa566('0x28')](function(_0x1eb423){_0x1f0cfb['push'](_0x1eb423[_0xa566('0x4e')]({'plain':!![]}));});})[_0xa566('0x28')](function(){return _0x1f0cfb;});});});}})[_0xa566('0x28')](function(_0xebff5e){return _0xebff5e;})['then'](respondWithResult(_0x12b28f,null))[_0xa566('0x4a')](handleError(_0x12b28f,null));};exports[_0xa566('0x5e')]=function(_0x19c316,_0xe16b54){var _0x1c4d45;return db[_0xa566('0x34')][_0xa566('0x4d')]({'where':{'id':_0x19c316[_0xa566('0x46')]['id']},'attributes':['id',_0xa566('0x2c')]})[_0xa566('0x28')](handleEntityNotFound(_0xe16b54,null))['then'](function(_0xc1f01b){if(_0xc1f01b){_0x1c4d45=_0xc1f01b;return db['UserProfileSection'][_0xa566('0x29')]({'where':{'userProfileId':_0x19c316[_0xa566('0x46')]['id'],'sectionId':_0x19c316['query']['ids']}});}})['then'](function(){return _0x1c4d45;})['then'](respondWithStatusCode(_0xe16b54,null))[_0xa566('0x4a')](handleError(_0xe16b54,null));};exports[_0xa566('0x5f')]=function(_0x4303a3,_0x4f5731){var _0x8c24c4=[];var _0x26abc7=[];return db[_0xa566('0x54')][_0xa566('0x45')]({'where':{'userProfileId':_0x4303a3[_0xa566('0x46')]['id']},'raw':!![]})[_0xa566('0x28')](function(_0x296882){_0x8c24c4=_['filter'](_0x296882,function(_0x551206){return _0x551206[_0xa566('0x60')]===0x1||_[_0xa566('0x61')]([0x3eb,0x709],_0x551206[_0xa566('0x5d')]);});if(!_['isEmpty'](_0x8c24c4)){return _['map'](_0x8c24c4,function(_0x5d843a){return _0x5d843a[_0xa566('0x5d')];});}else{return;}})[_0xa566('0x28')](function(_0x1f67dc){if(_0x1f67dc)_0x26abc7=_0x1f67dc;if(_[_0xa566('0x61')](_0x26abc7,0x64)){var _0x161c36=_[_0xa566('0x4d')](_0x8c24c4,{'sectionId':0x64});return hasDefaultDashboard(_0x161c36)[_0xa566('0x28')](function(_0x1b8461){return _[_0xa566('0x33')](_0x8c24c4,function(_0x16824e){if(_0x16824e[_0xa566('0x5d')]===0x64){_0x16824e['subsections']=_0x1b8461;}return _0x16824e;});});}else{return;}})[_0xa566('0x28')](function(_0x46debf){if(_0x46debf)_0x8c24c4=_0x46debf;if(_[_0xa566('0x61')](_0x26abc7,0x3eb)){var _0x44113c=_['find'](_0x8c24c4,{'sectionId':0x3eb});return getCustomDashboards(_0x44113c)[_0xa566('0x28')](function(_0x5e7430){return _[_0xa566('0x33')](_0x8c24c4,function(_0x5573db){if(_0x44113c[_0xa566('0x60')]){if(_0x5573db[_0xa566('0x5d')]===0x3eb){_0x5573db[_0xa566('0x62')]=_0x5e7430;}}else{if(_0x5573db[_0xa566('0x5d')]===0x64){_0x5573db['subsections']=_0x5e7430;}}return _0x5573db;});});}else{return;}})[_0xa566('0x28')](function(_0x50b260){if(_0x50b260)_0x8c24c4=_0x50b260;if(_['includes'](_0x26abc7,0x709)){var _0x5be5a1=_[_0xa566('0x4d')](_0x8c24c4,{'sectionId':0x709});return getPlugins(_0x5be5a1)[_0xa566('0x28')](function(_0x360728){if(_0x5be5a1['enabled']){return _[_0xa566('0x33')](_0x8c24c4,function(_0x2b1670){if(_0x2b1670[_0xa566('0x5d')]===0x709){_0x2b1670[_0xa566('0x62')]=_0x360728;}return _0x2b1670;});}else{var _0x3d920d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x360728};var _0x318d73=_[_0xa566('0x33')](_0x8c24c4);_0x318d73['push'](_0x3d920d);return _0x318d73;}});}else{return;}})[_0xa566('0x28')](function(_0x267cc6){if(_0x267cc6)_0x8c24c4=_0x267cc6;return _['filter'](_0x8c24c4,[_0xa566('0x60'),0x1]);})[_0xa566('0x28')](respondWithResult(_0x4f5731,null))['catch'](handleError(_0x4f5731,null));};function hasDefaultDashboard(_0x3d00fb){var _0x9c5c4e=[0x65];return new BPromise(function(_0xe4b057,_0x8de52f){try{if(_0x3d00fb['autoAssociation']){_0xe4b057(_0x9c5c4e);}else{return db[_0xa566('0x57')][_0xa566('0x63')]({'where':{'sectionId':_0x3d00fb['id']},'raw':!![]})[_0xa566('0x28')](function(_0x2dfddf){_0x2dfddf?_0xe4b057(_0x9c5c4e):_0xe4b057();});}}catch(_0x328a02){_0x8de52f(_0x328a02);}});}function getCustomDashboards(_0xb749cc){var _0x367972=[];return new BPromise(function(_0x14ce93,_0x436520){try{if(_0xb749cc[_0xa566('0x56')]){return db[_0xa566('0x64')][_0xa566('0x45')]({'raw':!![]})[_0xa566('0x28')](function(_0x256f53){_0x256f53['forEach'](function(_0x35617d){_0x367972[_0xa566('0x65')](_0x35617d['id']+0x1869f);});_0x14ce93(_0x367972);});}else{return db[_0xa566('0x57')][_0xa566('0x45')]({'where':{'sectionId':_0xb749cc['id']},'raw':!![]})[_0xa566('0x28')](function(_0x4a5a91){_0x4a5a91['forEach'](function(_0xfc370f){_0x367972[_0xa566('0x65')](_0xfc370f[_0xa566('0x66')]+0x1869f);});_0x14ce93(_0x367972);});}}catch(_0x209dc9){_0x436520(_0x209dc9);}});}function getPlugins(_0x41023c){var _0x1761a5=[];return new BPromise(function(_0x106e2f,_0x4ffddd){try{if(_0x41023c[_0xa566('0x56')]){return db[_0xa566('0x67')][_0xa566('0x45')]({'raw':!![]})['then'](function(_0x484f0a){_0x484f0a[_0xa566('0x68')](function(_0x11e1c8){_0x1761a5['push'](_0x11e1c8['id']+0x15b38);});_0x106e2f(_0x1761a5);});}else{return db[_0xa566('0x57')]['findAll']({'where':{'sectionId':_0x41023c['id']},'raw':!![]})['then'](function(_0x394c15){_0x394c15[_0xa566('0x68')](function(_0x5a77db){_0x1761a5[_0xa566('0x65')](_0x5a77db[_0xa566('0x66')]+0x15b38);});_0x106e2f(_0x1761a5);});}}catch(_0x35b58f){_0x4ffddd(_0x35b58f);}});}exports[_0xa566('0x69')]=function(_0x57ce92,_0x1f99a6){return db[_0xa566('0x34')][_0xa566('0x4d')]({'where':{'id':_0x57ce92[_0xa566('0x46')]['id']}})[_0xa566('0x28')](handleEntityNotFound(_0x1f99a6,null))[_0xa566('0x28')](function(_0x34cd73){if(_0x34cd73){return db[_0xa566('0x52')][_0xa566('0x53')](function(_0x167cf3){return db[_0xa566('0x54')][_0xa566('0x45')]({'where':{'userProfileId':_0x57ce92[_0xa566('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xa566('0x28')](function(_0x436b14){if(_0x436b14){return db['UserProfileSection'][_0xa566('0x29')]({'where':{'userProfileId':_0x57ce92[_0xa566('0x46')]['id'],'id':_['map'](_0x436b14,function(_0xb8204e){return _0xb8204e['id'];})},'transaction':_0x167cf3});}})[_0xa566('0x28')](function(_0xf617f6){var _0x11c03d=_[_0xa566('0x33')](_0x57ce92[_0xa566('0x2f')],function(_0x4e1c2b){_0x4e1c2b[_0xa566('0x58')]=_0x57ce92[_0xa566('0x46')]['id'];return _0x4e1c2b;});return db[_0xa566('0x54')][_0xa566('0x6a')](_0x11c03d,{'raw':!![],'transaction':_0x167cf3});})[_0xa566('0x28')](function(_0x4ba979){var _0x1c47d0=_[_0xa566('0x42')](_[_0xa566('0x33')](_0x4ba979,function(_0x36036b){return _0x36036b[_0xa566('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x1c47d0){return db[_0xa566('0x54')][_0xa566('0x45')]({'where':{'userProfileId':_0x57ce92[_0xa566('0x46')]['id'],'sectionId':_[_0xa566('0x33')](_0x1c47d0,function(_0x5b505c){return _0x5b505c[_0xa566('0x5d')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xa566('0x28')](function(_0x3e06e4){var _0x417a95=_[_0xa566('0x33')](_0x57ce92[_0xa566('0x2f')],function(_0x39031a){_0x39031a[_0xa566('0x58')]=_0x57ce92[_0xa566('0x46')]['id'];return _0x39031a;});return db[_0xa566('0x57')][_0xa566('0x6a')](_0x417a95,{'raw':!![],'transaction':_0x167cf3});});}})[_0xa566('0x4a')](handleError(_0x1f99a6,null));});}})['then'](function(_0x156e25){var _0x479756=_[_0xa566('0x33')](_0x156e25,function(_0x46a5c1){return _0x46a5c1[_0xa566('0x4e')]({'plain':!![]});});})[_0xa566('0x28')](respondWithResult(_0x1f99a6,null))[_0xa566('0x4a')](handleError(_0x1f99a6,null));};exports[_0xa566('0x6b')]=function(_0x4f6359,_0x59df78,_0x36e393){return db[_0xa566('0x34')]['find']({'where':{'id':_0x4f6359[_0xa566('0x46')]['id']}})[_0xa566('0x28')](handleEntityNotFound(_0x59df78,null))[_0xa566('0x28')](function(_0x621286){if(_0x621286){return _0x621286[_0xa566('0x6b')](_0x4f6359[_0xa566('0x39')][_0xa566('0x6c')]);}})['then'](respondWithStatusCode(_0x59df78,null))[_0xa566('0x4a')](handleError(_0x59df78,null));};exports[_0xa566('0x6d')]=function(_0x379592,_0x45cfe9){var _0x2cdbc2={'raw':![],'where':{}};var _0x3fd213={};var _0x308bd9={'count':0x0,'rows':[]};var _0x3e7361=_0x379592[_0xa566('0x39')]['section'];if(typeof _0x3e7361===_0xa566('0x21')){throw new db[(_0xa566('0x6e'))][(_0xa566('0x6f'))](_0xa566('0x70'));}var _0x227634=_0x379592['query'][_0xa566('0x71')]||![];var _0x3bae5d=getQueryModels(_0x3e7361,_0x227634);if(typeof _0x3bae5d['childModel']===_0xa566('0x21')){throw new db['Sequelize']['ValidationError'](_0xa566('0x72')+_0x3e7361+'\x27');}var _0xf7fc96=[];if(!_['isEmpty'](_0x3bae5d[_0xa566('0x73')])){_0xf7fc96=_0x3bae5d['parentSections'];}else{_0xf7fc96=[{'name':_0x3e7361}];}return db[_0xa566('0x34')][_0xa566('0x63')]({'where':{'id':_0x379592[_0xa566('0x46')]['id']}})[_0xa566('0x28')](handleEntityNotFound(_0x45cfe9,null))[_0xa566('0x28')](function(_0x1f15c7){if(_0x1f15c7){var _0x31686e=[];for(var _0x2eca22=0x0;_0x2eca22<_0xf7fc96[_0xa566('0x3e')];_0x2eca22++){_0x31686e[_0xa566('0x65')](db[_0xa566('0x54')]['findOne']({'where':{'userProfileId':_0x1f15c7['id'],'name':_0xf7fc96[_0x2eca22][_0xa566('0x2c')]},'raw':!![]}));}return BPromise[_0xa566('0x74')](_0x31686e);}})[_0xa566('0x28')](function(_0x1fe297){var _0x13efd9=_[_0xa566('0x42')](_0x1fe297,function(_0x3ac5f6){return _0x3ac5f6?_0x3ac5f6:undefined;});var _0x1ff49f=_[_0xa566('0x42')](_0xf7fc96,[_0xa566('0x75'),!![]]);var _0x6214ce=_[_0xa566('0x76')](_0x13efd9)&&_[_0xa566('0x76')](_0x1ff49f)?null:_['union'](_0x1ff49f,_0x13efd9);if(_0x6214ce){var _0x570171=[];for(var _0x5e610c=0x0;_0x5e610c<_0x6214ce[_0xa566('0x3e')];_0x5e610c++){var _0xf2af3=_['find'](_0xf7fc96,function(_0x4ec6ad){return _0x6214ce[_0x5e610c]?_0x4ec6ad[_0xa566('0x2c')]===_0x6214ce[_0x5e610c][_0xa566('0x2c')]:null;});if(_0xf2af3){if(_0x6214ce[_0x5e610c][_0xa566('0x75')]){_0x570171[_0xa566('0x65')](getAllResources(_0x3bae5d[_0xa566('0x77')],_0x6214ce[_0x5e610c]));}else{if(!_0x6214ce[_0x5e610c][_0xa566('0x56')]){_0x570171[_0xa566('0x65')](getAllowedResources(_0xf2af3,_0x6214ce[_0x5e610c],_0x3bae5d[_0xa566('0x77')]));}else{if(_0xf2af3[_0xa566('0x38')]){_0x570171[_0xa566('0x65')](getAllFilteredResources(_0xf2af3,_0x6214ce[_0x5e610c]));}}}}}return BPromise[_0xa566('0x74')](_0x570171);}else{return null;}})[_0xa566('0x28')](function(_0x536c54){var _0x29260f=_0x536c54;var _0x5a4ce8=null;if(_0x29260f){_0x5a4ce8=_0x29260f['length']===0x1?_0x29260f[0x0]:null;}if(_0x5a4ce8||_0x29260f){var _0x3c925f=db[_0x3bae5d[_0xa566('0x77')]]['rawAttributes'];_0x3fd213['model']=_[_0xa566('0x47')](_0x3c925f);_0x3fd213[_0xa566('0x39')]=_[_0xa566('0x47')](_0x379592[_0xa566('0x39')]);_0x3fd213['filters']=_[_0xa566('0x3b')](_0x3fd213[_0xa566('0x38')],_0x3fd213['query']);_0x2cdbc2[_0xa566('0x3c')]=_['intersection'](_0x3fd213['model'],qs[_0xa566('0x3d')](_0x379592[_0xa566('0x39')][_0xa566('0x3d')]));_0x2cdbc2[_0xa566('0x3c')]=_0x2cdbc2[_0xa566('0x3c')]['length']?_0x2cdbc2[_0xa566('0x3c')]:_0x3fd213[_0xa566('0x38')];if(!_0x379592[_0xa566('0x39')][_0xa566('0x3f')](_0xa566('0x78'))){_0x2cdbc2[_0xa566('0x20')]=qs[_0xa566('0x20')](_0x379592[_0xa566('0x39')]['limit']);_0x2cdbc2['offset']=qs[_0xa566('0x1f')](_0x379592[_0xa566('0x39')][_0xa566('0x1f')]);}_0x2cdbc2[_0xa566('0x79')]=qs['sort'](_0x379592[_0xa566('0x39')][_0xa566('0x40')]);_0x2cdbc2['where']=qs[_0xa566('0x3a')](_['pick'](_0x379592['query'],_0x3fd213[_0xa566('0x3a')]));if(_0x379592[_0xa566('0x39')][_0xa566('0x42')]){_0x2cdbc2[_0xa566('0x41')]=_[_0xa566('0x2e')](_0x2cdbc2['where'],{'$or':_[_0xa566('0x33')](_0x3c925f,function(_0x50e509){if(_0x50e509[_0xa566('0x7a')][_0xa566('0x37')]!==_0xa566('0x7b')){var _0x1303f8={};_0x1303f8[_0x50e509[_0xa566('0x7c')]]={'$like':'%'+_0x379592['query'][_0xa566('0x42')]+'%'};return _0x1303f8;}})});}var _0x115e1f=[];if(_0x5a4ce8){var _0x19ed32=_[_0xa566('0x4d')](_0xf7fc96,[_0xa566('0x2c'),_0x5a4ce8[_0xa566('0x2c')]]);if(_0x19ed32['field']){var _0x51ea26={};if(_0x3bae5d['childModel']===_0xa566('0x7d')){_0x51ea26[_0x19ed32['foreignKey']]=_[_0xa566('0x33')](_0x5a4ce8[_0xa566('0x7e')],'id');}else{_0x51ea26[_0x19ed32[_0xa566('0x7f')]]=_0x5a4ce8[_0xa566('0x7e')];}_0x115e1f[_0xa566('0x65')](_0x51ea26);}else{_0x2cdbc2['where']['id']=_0x5a4ce8[_0xa566('0x7e')];}}else{for(var _0x4ecf71=0x0;_0x4ecf71<_0x29260f[_0xa566('0x3e')];_0x4ecf71++){var _0x19ed32=_[_0xa566('0x4d')](_0xf7fc96,[_0xa566('0x2c'),_0x29260f[_0x4ecf71][_0xa566('0x2c')]]);if(_0x19ed32[_0xa566('0x7c')]){var _0x51ea26={};_0x51ea26[_0x19ed32[_0xa566('0x7f')]]=_0x29260f[_0x4ecf71][_0xa566('0x7e')];_0x115e1f['push'](_0x51ea26);}else{if(!_0x2cdbc2['where']['id'])_0x2cdbc2[_0xa566('0x41')]['id']=[];_0x29260f[_0x4ecf71][_0xa566('0x7e')][_0xa566('0x68')](function(_0x3b9ba0){_0x2cdbc2[_0xa566('0x41')]['id'][_0xa566('0x65')](_0x3b9ba0);});}}}if(!_[_0xa566('0x76')](_0x115e1f)){_0x2cdbc2['where']=_['merge'](_0x2cdbc2[_0xa566('0x41')],{'$and':{'$or':_0x115e1f}});}_0x2cdbc2=_[_0xa566('0x2e')]({},_0x2cdbc2,_0x379592[_0xa566('0x49')]);if(_0x5a4ce8&&!_0x5a4ce8[_0xa566('0x56')]&&_0x3bae5d[_0xa566('0x77')]===_0xa566('0x7d')){if(_0x379592[_0xa566('0x39')][_0xa566('0x48')]){_0x2cdbc2[_0xa566('0x44')]=[{'all':!![]}];}return db[_0x3bae5d['childModel']][_0xa566('0x45')](_0x2cdbc2)[_0xa566('0x28')](function(_0x26aa42){var _0x386437=[];_0x26aa42[_0xa566('0x68')](function(_0x59862e){var _0x438a1f;switch(_0x59862e[_0xa566('0x80')]){case'default':_0x438a1f=_[_0xa566('0x4d')](_0x5a4ce8['associatedResources'],function(_0x555dba){return _0x555dba['id']===_0x59862e['reportId']&&_0x555dba['type']===_0xa566('0x81');});break;case _0xa566('0x82'):_0x438a1f=_[_0xa566('0x4d')](_0x5a4ce8[_0xa566('0x7e')],function(_0xadf534){return _0xadf534['id']===_0x59862e[_0xa566('0x83')]&&_0xadf534['type']==='CustomReports';});break;}if(_0x438a1f)_0x386437[_0xa566('0x65')](_0x59862e);});_0x308bd9['count']=_0x386437['length'];_0x308bd9['rows']=_0x386437;return _0x308bd9;});}else{return db[_0x3bae5d[_0xa566('0x77')]]['count']({'where':_0x2cdbc2['where']})[_0xa566('0x28')](function(_0x155687){_0x308bd9[_0xa566('0x43')]=_0x155687;if(_0x379592[_0xa566('0x39')][_0xa566('0x48')]){if(_0x3bae5d['childModel']===_0xa566('0x84')){_0x2cdbc2[_0xa566('0x44')]=[{'model':db[_0xa566('0x85')],'as':'Tags','attributes':['id',_0xa566('0x2c'),'color'],'required':_0x379592[_0xa566('0x39')][_0xa566('0x86')]?!![]:![]},{'model':db[_0xa566('0x85')],'as':_0xa566('0x87'),'attributes':['id',_0xa566('0x2c'),_0xa566('0x88')],'through':_0x379592[_0xa566('0x39')][_0xa566('0x86')]?{'attributes':[],'where':{'TagId':_0x379592[_0xa566('0x39')][_0xa566('0x86')]||undefined}}:{},'required':_0x379592[_0xa566('0x39')][_0xa566('0x86')]?!![]:![]}];}else{_0x2cdbc2[_0xa566('0x44')]=[{'all':!![]}];}}return db[_0x3bae5d[_0xa566('0x77')]][_0xa566('0x45')](_0x2cdbc2);})[_0xa566('0x28')](function(_0x5cf628){_0x308bd9[_0xa566('0x89')]=_0x5cf628;if(_0x3e7361===_0xa566('0x8a')&&_0x379592[_0xa566('0x39')][_0xa566('0x8b')]==='true'){var _0x18557e=[];for(var _0x481d04=0x0;_0x481d04<_0x308bd9[_0xa566('0x89')][_0xa566('0x3e')];_0x481d04++){_0x18557e['push'](getOpenTabs('chat',_0x308bd9[_0xa566('0x89')][_0x481d04][_0xa566('0x8c')]));_0x18557e[_0xa566('0x65')](getOpenTabs('sms',_0x308bd9[_0xa566('0x89')][_0x481d04]['dataValues']));_0x18557e[_0xa566('0x65')](getOpenTabs(_0xa566('0x8d'),_0x308bd9[_0xa566('0x89')][_0x481d04]['dataValues']));_0x18557e[_0xa566('0x65')](getOpenTabs(_0xa566('0x8e'),_0x308bd9['rows'][_0x481d04][_0xa566('0x8c')]));_0x18557e['push'](getOpenTabs(_0xa566('0x8f'),_0x308bd9[_0xa566('0x89')][_0x481d04][_0xa566('0x8c')]));_0x18557e[_0xa566('0x65')](getOpenTabs(_0xa566('0x90'),_0x308bd9[_0xa566('0x89')][_0x481d04][_0xa566('0x8c')]));}return Promise['all'](_0x18557e)[_0xa566('0x28')](function(){return _0x308bd9;});}return _0x308bd9;});}}else{return _0x308bd9;}})['then'](respondWithFilteredResult(_0x45cfe9,_0x2cdbc2))[_0xa566('0x4a')](handleError(_0x45cfe9,null));};function getOpenTabs(_0x26de44,_0x5ee330){var _0x5dcb7f=_0x26de44[_0xa566('0x91')](0x0)['toUpperCase']()+_0x26de44[_0xa566('0x92')](0x1);var _0x291594={'type':db[_0xa566('0x6e')][_0xa566('0x93')][_0xa566('0x94')],'raw':!![]};return new BPromise(function(_0x2228aa,_0x5c6f09){var _0x42abe6=squel[_0xa566('0x95')]()['field']('ui.'+_0x5dcb7f+_0xa566('0x96'),'id')['field']('ui.createdAt')[_0xa566('0x97')](_0xa566('0x98')+_0x26de44+_0xa566('0x99'),'ui')[_0xa566('0x41')](_0xa566('0x9a'),_0x5ee330['id']);return db[_0xa566('0x52')][_0xa566('0x39')](_0x42abe6[_0xa566('0x9b')](),_0x291594)['then'](function(_0x47c5e4){_0x5ee330[_0x5dcb7f+_0xa566('0x9c')]=_0x47c5e4;_0x2228aa(_0x47c5e4);})['catch'](function(_0x4dd9c8){_0x5c6f09(_0x4dd9c8);});});}function getAllResources(_0x12e924,_0xc221d7){return new BPromise(function(_0x396c69,_0x1c00de){if(_0xc221d7){var _0x31da47=_0xc221d7[_0xa566('0x42')]?{[_0xc221d7[_0xa566('0x42')][_0xa566('0x7c')]]:_0xc221d7[_0xa566('0x42')][_0xa566('0x9d')]}:undefined;return db[_0x12e924][_0xa566('0x45')]({'where':_0x31da47,'raw':!![]})[_0xa566('0x28')](function(_0x837c2){_0xc221d7[_0xa566('0x7e')]=_[_0xa566('0x33')](_0x837c2,'id');_0x396c69(_0xc221d7);})[_0xa566('0x4a')](function(_0x332689){_0x1c00de(_0x332689);});}else{_0x396c69(null);}});}function getAllFilteredResources(_0x3035ca,_0x1586f4){return new BPromise(function(_0x42a774,_0x40e580){var _0x567720=_0x3035ca['filter']?{[_0x3035ca[_0xa566('0x42')][_0xa566('0x7c')]]:_0x3035ca[_0xa566('0x42')][_0xa566('0x9d')]}:undefined;return db[_0x3035ca[_0xa566('0x38')]][_0xa566('0x45')]({'where':_0x567720,'raw':!![]})[_0xa566('0x28')](function(_0x10e013){_0x1586f4[_0xa566('0x7e')]=_[_0xa566('0x33')](_0x10e013,function(_0x4ea9a6){return _0x3035ca[_0xa566('0x7c')]?_0x4ea9a6[_0x3035ca['field']]:_0x4ea9a6[_0xa566('0x2c')];});_0x42a774(_0x1586f4);})['catch'](function(_0x14738a){_0x40e580(_0x14738a);});});}function getAllowedResources(_0x1ce5f2,_0xdec687,_0x31013c){return new BPromise(function(_0x3246c4,_0x44b5fa){if(_0xdec687){return db[_0xa566('0x57')][_0xa566('0x45')]({'where':{'sectionId':_0xdec687['id']},'raw':!![]})['then'](function(_0x4f5860){if(_0x1ce5f2[_0xa566('0x7c')]&&_0x1ce5f2['field']!=='id'){_0xdec687[_0xa566('0x7e')]=_['map'](_0x4f5860,function(_0x18370c){return _0x18370c[_0x1ce5f2[_0xa566('0x7c')]];});}else{if(_0x31013c===_0xa566('0x7d')){_0xdec687[_0xa566('0x7e')]=_[_0xa566('0x33')](_0x4f5860,function(_0x1e2cd4){return{'id':_0x1e2cd4[_0xa566('0x66')],'type':_0x1e2cd4[_0xa566('0x7a')]};});}else{_0xdec687[_0xa566('0x7e')]=_[_0xa566('0x33')](_0x4f5860,function(_0x4eccaf){return _0x4eccaf[_0xa566('0x66')];});}}_0x3246c4(_0xdec687);})[_0xa566('0x4a')](function(_0x1fc5a9){_0x44b5fa(_0x1fc5a9);});}else{_0x3246c4(null);}});}function getQueryModels(_0x545268,_0x51f069){var _0x9ac37b=_0x545268[_0xa566('0x9e')]();var _0x44d529={'childModel':undefined,'parentSections':[]};switch(_0x9ac37b){case _0xa566('0x9f'):_0x44d529[_0xa566('0x77')]=_0xa566('0xa0');break;case'odbc':_0x44d529[_0xa566('0x77')]='SquareOdbc';break;case'squarerecordings':_0x44d529[_0xa566('0x77')]='SquareRecording';_0x44d529['parentSections']=[{'name':_0xa566('0xa1'),'field':_0xa566('0x2c'),'foreignKey':_0xa566('0xa2')}];break;case _0xa566('0xa3'):_0x44d529[_0xa566('0x77')]=_0xa566('0xa4');break;case _0xa566('0xa5'):_0x44d529[_0xa566('0x77')]=_0xa566('0x84');_0x44d529[_0xa566('0x73')]=[{'name':'Lists','field':'id','foreignKey':_0xa566('0xa6')}];break;case _0xa566('0xa7'):_0x44d529[_0xa566('0x77')]=_0xa566('0xa8');break;case _0xa566('0xa9'):_0x44d529['childModel']=_0xa566('0xaa');break;case _0xa566('0xab'):_0x44d529[_0xa566('0x77')]=_0xa566('0xac');break;case _0xa566('0xad'):_0x44d529['childModel']=_0xa566('0xae');break;case'chatwebsites':_0x44d529[_0xa566('0x77')]=_0xa566('0xaf');break;case _0xa566('0xb0'):_0x44d529['childModel']=_0xa566('0xb1');break;case'faxaccounts':_0x44d529[_0xa566('0x77')]=_0xa566('0xb2');break;case _0xa566('0xb3'):case _0xa566('0xb4'):case _0xa566('0xb5'):_0x44d529[_0xa566('0x77')]='VoiceExtension';break;case _0xa566('0xb6'):_0x44d529[_0xa566('0x77')]=_0xa566('0xb7');break;case _0xa566('0xb8'):_0x44d529[_0xa566('0x77')]='VoiceMail';break;case _0xa566('0xb9'):_0x44d529['childModel']=_0xa566('0xba');_0x44d529[_0xa566('0x73')]=[{'name':_0xa566('0x8a'),'field':_0xa566('0x2c'),'foreignKey':_0xa566('0xbb'),'model':_0xa566('0xbc'),'filter':{'field':_0xa566('0xbd'),'value':['agent']}},{'name':_0xa566('0xbe'),'field':_0xa566('0x2c'),'foreignKey':'membername','model':'User','filter':{'field':_0xa566('0xbd'),'value':[_0xa566('0xbf')]}},{'name':_0xa566('0xc0'),'field':_0xa566('0x2c'),'foreignKey':_0xa566('0xc1'),'model':_0xa566('0xc2'),'filter':{'field':'type','value':[_0xa566('0xc3')]}},{'name':_0xa566('0xc4'),'field':_0xa566('0x2c'),'foreignKey':_0xa566('0xc1'),'model':_0xa566('0xc2'),'filter':{'field':_0xa566('0x7a'),'value':[_0xa566('0xc5')]}}];break;case _0xa566('0xc6'):_0x44d529[_0xa566('0x77')]='VoiceMusicOnHold';break;case _0xa566('0xc7'):_0x44d529[_0xa566('0x77')]='VoiceChanSpy';break;case _0xa566('0xc8'):_0x44d529[_0xa566('0x77')]='VoicePrefix';break;case _0xa566('0xc9'):_0x44d529['childModel']=_0xa566('0xca');break;case _0xa566('0xcb'):_0x44d529[_0xa566('0x77')]='MailQueue';break;case _0xa566('0xcc'):_0x44d529[_0xa566('0x77')]=_0xa566('0xcd');break;case _0xa566('0xce'):_0x44d529[_0xa566('0x77')]=_0xa566('0xcf');break;case'openchannelqueues':_0x44d529[_0xa566('0x77')]=_0xa566('0xd0');break;case _0xa566('0xd1'):_0x44d529['childModel']=_0xa566('0xd2');break;case'smsqueues':_0x44d529[_0xa566('0x77')]=_0xa566('0xd3');break;case _0xa566('0xd4'):_0x44d529['childModel']='SmsAccount';break;case'whatsappqueues':_0x44d529[_0xa566('0x77')]=_0xa566('0xd5');break;case'teams':_0x44d529[_0xa566('0x77')]=_0xa566('0xd6');break;case'voicequeues':case'queuecampaigns':_0x44d529[_0xa566('0x77')]='VoiceQueue';if(_0x51f069){_0x44d529['parentSections']=[{'name':_0xa566('0xc0')},{'name':'QueueCampaigns'}];}break;case _0xa566('0xd7'):case _0xa566('0xd8'):case _0xa566('0xd9'):_0x44d529['childModel']='User';if(_0x51f069){_0x44d529[_0xa566('0x73')]=[{'name':_0xa566('0xda'),'filter':{'field':_0xa566('0xbd'),'value':[_0xa566('0xdb'),_0xa566('0xdc')]},'ignore':!![]},{'name':_0xa566('0x8a')},{'name':_0xa566('0xbe')}];}break;case'zendeskaccounts':_0x44d529[_0xa566('0x77')]=_0xa566('0xdd');break;case _0xa566('0xde'):_0x44d529[_0xa566('0x77')]=_0xa566('0xdf');break;case _0xa566('0xe0'):_0x44d529[_0xa566('0x77')]='FreshdeskAccount';break;case _0xa566('0xe1'):_0x44d529[_0xa566('0x77')]=_0xa566('0xe2');break;case _0xa566('0xe3'):_0x44d529[_0xa566('0x77')]=_0xa566('0xe4');break;case _0xa566('0xe5'):_0x44d529[_0xa566('0x77')]=_0xa566('0xe6');break;case _0xa566('0xe7'):_0x44d529['childModel']=_0xa566('0xbc');break;case _0xa566('0xe8'):_0x44d529[_0xa566('0x77')]='CannedAnswer';break;case _0xa566('0xe9'):_0x44d529[_0xa566('0x77')]='Disposition';break;case _0xa566('0xea'):_0x44d529['childModel']=_0xa566('0x64');break;case'intervals':_0x44d529[_0xa566('0x77')]='Interval';break;case _0xa566('0xeb'):_0x44d529[_0xa566('0x77')]='Pause';break;case'scheduler':_0x44d529[_0xa566('0x77')]=_0xa566('0xec');break;case _0xa566('0xed'):_0x44d529['childModel']=_0xa566('0xee');break;case _0xa566('0xef'):_0x44d529['childModel']='Tag';break;case'templates':_0x44d529[_0xa566('0x77')]='Template';break;case _0xa566('0xf0'):_0x44d529[_0xa566('0x77')]=_0xa566('0xf1');break;case _0xa566('0xf2'):_0x44d529['childModel']='Trunk';break;case'variables':_0x44d529[_0xa566('0x77')]=_0xa566('0xf3');break;case _0xa566('0xf4'):_0x44d529['childModel']=_0xa566('0x67');break;case _0xa566('0xf5'):_0x44d529[_0xa566('0x77')]=_0xa566('0x7d');_0x44d529[_0xa566('0x73')]=[{'name':_0xa566('0xf6'),'field':'id','foreignKey':_0xa566('0x83')}];break;case _0xa566('0xf7'):_0x44d529[_0xa566('0x77')]=_0xa566('0xf8');break;case _0xa566('0xf9'):_0x44d529[_0xa566('0x77')]=_0xa566('0xfa');break;case _0xa566('0xfb'):_0x44d529[_0xa566('0x77')]=_0xa566('0xfc');_0x44d529[_0xa566('0x73')]=[{'name':_0xa566('0x8a'),'field':'id','foreignKey':'UserId','model':'User','filter':{'field':_0xa566('0xbd'),'value':[_0xa566('0x30')]}},{'name':_0xa566('0xbe'),'field':'id','foreignKey':_0xa566('0xfd'),'model':'User','filter':{'field':'role','value':[_0xa566('0xbf')]}}];break;default:return _0x44d529;}return _0x44d529;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e5272b4..6304f31 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2649=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2c2e26,_0x44119c){var _0xe089fd=function(_0x29d518){while(--_0x29d518){_0x2c2e26['push'](_0x2c2e26['shift']());}};_0xe089fd(++_0x44119c);}(_0x2649,0x8d));var _0x9264=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x2649[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0x9264('0x0'));var UserProfile=require(_0x9264('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9264('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9264('0x3')};function emitEvent(_0x8f778){return function(_0xb68c0e,_0x2198fc,_0x55b31b){UserProfileEvents[_0x9264('0x4')](_0x8f778+':'+_0xb68c0e['id'],_0xb68c0e);UserProfileEvents['emit'](_0x8f778,_0xb68c0e);_0x55b31b(null);};}for(var e in events){if(events[_0x9264('0x5')](e)){var event=events[e];UserProfile[_0x9264('0x6')](e,emitEvent(event));}}module[_0x9264('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x2d53=['UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x50e090,_0x2d7577){var _0x42bd5e=function(_0x347634){while(--_0x347634){_0x50e090['push'](_0x50e090['shift']());}};_0x42bd5e(++_0x2d7577);}(_0x2d53,0x17f));var _0x32d5=function(_0x4dfecb,_0x8d2259){_0x4dfecb=_0x4dfecb-0x0;var _0x4fc85c=_0x2d53[_0x4dfecb];return _0x4fc85c;};'use strict';var EventEmitter=require(_0x32d5('0x0'));var UserProfile=require(_0x32d5('0x1'))['db'][_0x32d5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x32d5('0x3')](0x0);var events={'afterCreate':_0x32d5('0x4'),'afterUpdate':_0x32d5('0x5'),'afterDestroy':_0x32d5('0x6')};function emitEvent(_0x315897){return function(_0x530c7c,_0x39875f,_0x3b2c70){UserProfileEvents[_0x32d5('0x7')](_0x315897+':'+_0x530c7c['id'],_0x530c7c);UserProfileEvents[_0x32d5('0x7')](_0x315897,_0x530c7c);_0x3b2c70(null);};}for(var e in events){if(events[_0x32d5('0x8')](e)){var event=events[e];UserProfile[_0x32d5('0x9')](e,emitEvent(event));}}module[_0x32d5('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0bbe359..7f173f0 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc224=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','UserProfile','user_profiles','models','update','privacyEnabled','lodash'];(function(_0xd46333,_0x1b05c1){var _0x336108=function(_0x4a39ad){while(--_0x4a39ad){_0xd46333['push'](_0xd46333['shift']());}};_0x336108(++_0x1b05c1);}(_0xc224,0x1af));var _0x4c22=function(_0x3c35d0,_0x20aac1){_0x3c35d0=_0x3c35d0-0x0;var _0x39c194=_0xc224[_0x3c35d0];return _0x39c194;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var logger=require(_0x4c22('0x2'))('api');var moment=require(_0x4c22('0x3'));var BPromise=require(_0x4c22('0x4'));var rp=require(_0x4c22('0x5'));var fs=require('fs');var path=require(_0x4c22('0x6'));var rimraf=require(_0x4c22('0x7'));var config=require(_0x4c22('0x8'));var attributes=require(_0x4c22('0x9'));module[_0x4c22('0xa')]=function(_0x576de1,_0x5d036f){return _0x576de1['define'](_0x4c22('0xb'),attributes,{'tableName':_0x4c22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x45397c,_0x309dad,_0x2d1508){var _0x3f0626=_0x576de1[_0x4c22('0xd')];_0x3f0626['User'][_0x4c22('0xe')]({'privacyEnabled':_0x45397c[_0x4c22('0xf')]},{'where':{'UserProfileId':_0x45397c['id']}})['then'](function(){_0x2d1508();})['catch'](function(_0x2e1c02){_0x2d1508(_0x2e1c02);});}}});}; \ No newline at end of file +var _0x3750=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfile.attributes','exports','define','user_profiles','models','update','privacyEnabled','then','catch'];(function(_0x60647d,_0x470d60){var _0x4cc48e=function(_0x359900){while(--_0x359900){_0x60647d['push'](_0x60647d['shift']());}};_0x4cc48e(++_0x470d60);}(_0x3750,0xbb));var _0x0375=function(_0x28e714,_0x1ca825){_0x28e714=_0x28e714-0x0;var _0x2c3bf2=_0x3750[_0x28e714];return _0x2c3bf2;};'use strict';var _=require(_0x0375('0x0'));var util=require(_0x0375('0x1'));var logger=require(_0x0375('0x2'))(_0x0375('0x3'));var moment=require(_0x0375('0x4'));var BPromise=require('bluebird');var rp=require(_0x0375('0x5'));var fs=require('fs');var path=require(_0x0375('0x6'));var rimraf=require('rimraf');var config=require(_0x0375('0x7'));var attributes=require(_0x0375('0x8'));module[_0x0375('0x9')]=function(_0x405517,_0xd3c20a){return _0x405517[_0x0375('0xa')]('UserProfile',attributes,{'tableName':_0x0375('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x42c111,_0x698f18,_0x37d9d3){var _0x1274b3=_0x405517[_0x0375('0xc')];_0x1274b3['User'][_0x0375('0xd')]({'privacyEnabled':_0x42c111[_0x0375('0xe')]},{'where':{'UserProfileId':_0x42c111['id']}})[_0x0375('0xf')](function(){_0x37d9d3();})[_0x0375('0x10')](function(_0x38a528){_0x37d9d3(_0x38a528);});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ec8169b..16325e8 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['http','defaults','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5b4a83,_0x4da2e2){var _0x55c65d=function(_0x462815){while(--_0x462815){_0x5b4a83['push'](_0x5b4a83['shift']());}};_0x55c65d(++_0x4da2e2);}(_0xd8fb,0x99));var _0xbd8f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd8fb[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});config['redis']=_[_0xbd8f('0x9')](config['redis'],{'host':_0xbd8f('0xa'),'port':0x18eb});var socket=require(_0xbd8f('0xb'))(new Redis(config['redis']));require('./userProfile.socket')[_0xbd8f('0xc')](socket);function respondWithRpcPromise(_0x2393a9,_0x2a55b5,_0x53a2c6){return new BPromise(function(_0x255af3,_0x42ae20){return client['request'](_0x2393a9,_0x53a2c6)['then'](function(_0x342bcb){logger[_0xbd8f('0xd')](_0xbd8f('0xe'),_0x2a55b5,'request\x20sent');logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x2a55b5,_0xbd8f('0x11'),JSON[_0xbd8f('0x12')](_0x342bcb));if(_0x342bcb[_0xbd8f('0x13')]){if(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x14')]===0x1f4){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x2a55b5,_0x342bcb['error'][_0xbd8f('0x15')]);return _0x42ae20(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);}logger[_0xbd8f('0x13')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);return _0x255af3(_0x342bcb['error'][_0xbd8f('0x15')]);}else{logger[_0xbd8f('0xd')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0xbd8f('0x11'));_0x255af3(_0x342bcb[_0xbd8f('0x16')]['message']);}})['catch'](function(_0x33f77c){logger['error']('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x33f77c);_0x42ae20(_0x33f77c);});});} \ No newline at end of file +var _0x46ed=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','stringify','code','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x4b3089,_0x399ee7){var _0x405dbc=function(_0x4c7287){while(--_0x4c7287){_0x4b3089['push'](_0x4b3089['shift']());}};_0x405dbc(++_0x399ee7);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});config[_0xd46e('0xb')]=_[_0xd46e('0xc')](config[_0xd46e('0xb')],{'host':_0xd46e('0xd'),'port':0x18eb});var socket=require(_0xd46e('0xe'))(new Redis(config[_0xd46e('0xb')]));require(_0xd46e('0xf'))['register'](socket);function respondWithRpcPromise(_0x7b2d69,_0x81235b,_0x50ccd3){return new BPromise(function(_0x3585e7,_0x15b5cb){return client[_0xd46e('0x10')](_0x7b2d69,_0x50ccd3)[_0xd46e('0x11')](function(_0x1ad723){logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'),JSON[_0xd46e('0x14')](_0x1ad723));if(_0x1ad723['error']){if(_0x1ad723['error'][_0xd46e('0x15')]===0x1f4){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x15b5cb(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x1ad723[_0xd46e('0x16')]['message']);return _0x3585e7(_0x1ad723[_0xd46e('0x16')][_0xd46e('0x18')]);}else{logger[_0xd46e('0x12')]('UserProfile,\x20%s,\x20%s',_0x81235b,'request\x20sent');_0x3585e7(_0x1ad723[_0xd46e('0x19')][_0xd46e('0x18')]);}})['catch'](function(_0x4fd1f2){logger[_0xd46e('0x16')](_0xd46e('0x17'),_0x81235b,_0x4fd1f2);_0x15b5cb(_0x4fd1f2);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3ef4680..51e9917 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa124=['save','emit','removeListener','register','length','userProfile:'];(function(_0x5ac19e,_0x34493f){var _0x1d22c2=function(_0x2ce94a){while(--_0x2ce94a){_0x5ac19e['push'](_0x5ac19e['shift']());}};_0x1d22c2(++_0x34493f);}(_0xa124,0xfc));var _0x4a12=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xa124[_0x487b0c];return _0x1adbdc;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x4a12('0x0'),'remove','update'];function createListener(_0x4991db,_0x415518){return function(_0xe81c7f){_0x415518[_0x4a12('0x1')](_0x4991db,_0xe81c7f);};}function removeListener(_0x340354,_0x439c28){return function(){UserProfileEvents[_0x4a12('0x2')](_0x340354,_0x439c28);};}exports[_0x4a12('0x3')]=function(_0x5a3624){for(var _0xf09595=0x0,_0x52bc51=events[_0x4a12('0x4')];_0xf09595<_0x52bc51;_0xf09595++){var _0x36b63a=events[_0xf09595];var _0x4a9857=createListener(_0x4a12('0x5')+_0x36b63a,_0x5a3624);UserProfileEvents['on'](_0x36b63a,_0x4a9857);}}; \ No newline at end of file +var _0x3b54=['remove','update','emit','removeListener','length','./userProfile.events','save'];(function(_0x353d74,_0x3b6e1b){var _0x5c02fe=function(_0x118773){while(--_0x118773){_0x353d74['push'](_0x353d74['shift']());}};_0x5c02fe(++_0x3b6e1b);}(_0x3b54,0x178));var _0x43b5=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x3b54[_0x4bb145];return _0x4db596;};'use strict';var UserProfileEvents=require(_0x43b5('0x0'));var events=[_0x43b5('0x1'),_0x43b5('0x2'),_0x43b5('0x3')];function createListener(_0x3991c5,_0x131a57){return function(_0x43fc49){_0x131a57[_0x43b5('0x4')](_0x3991c5,_0x43fc49);};}function removeListener(_0x200ba8,_0x177065){return function(){UserProfileEvents[_0x43b5('0x5')](_0x200ba8,_0x177065);};}exports['register']=function(_0x4ab431){for(var _0x168bdb=0x0,_0x1594f8=events[_0x43b5('0x6')];_0x168bdb<_0x1594f8;_0x168bdb++){var _0x42fcc4=events[_0x168bdb];var _0x5af89f=createListener('userProfile:'+_0x42fcc4,_0x4ab431);UserProfileEvents['on'](_0x42fcc4,_0x5af89f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 33dae03..ad5e6eb 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x656a=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','/describe','describe','get','show','put','/:id','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x656a,0x1b6));var _0xa656=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0x656a[_0x1937c8];return _0x48bedf;};'use strict';var multer=require(_0xa656('0x0'));var util=require(_0xa656('0x1'));var path=require(_0xa656('0x2'));var timeout=require(_0xa656('0x3'));var express=require(_0xa656('0x4'));var router=express[_0xa656('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa656('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xa656('0x7')](),controller[_0xa656('0x8')]);router['get'](_0xa656('0x9'),auth[_0xa656('0x7')](),controller[_0xa656('0xa')]);router[_0xa656('0xb')]('/:id',auth[_0xa656('0x7')](),controller[_0xa656('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa656('0xd')](_0xa656('0xe'),auth[_0xa656('0x7')](),controller[_0xa656('0xf')]);router[_0xa656('0x10')](_0xa656('0xe'),auth[_0xa656('0x7')](),controller[_0xa656('0x11')]);module[_0xa656('0x12')]=router; \ No newline at end of file +var _0xeff5=['describe','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x50c73c,_0x14f817){var _0x2ffc0d=function(_0x2ddfad){while(--_0x2ddfad){_0x50c73c['push'](_0x50c73c['shift']());}};_0x2ffc0d(++_0x14f817);}(_0xeff5,0x6c));var _0x5eff=function(_0x3a116d,_0x3cb9c9){_0x3a116d=_0x3a116d-0x0;var _0x4d0c80=_0xeff5[_0x3a116d];return _0x4d0c80;};'use strict';var multer=require('multer');var util=require(_0x5eff('0x0'));var path=require(_0x5eff('0x1'));var timeout=require(_0x5eff('0x2'));var express=require(_0x5eff('0x3'));var router=express[_0x5eff('0x4')]();var fs_extra=require(_0x5eff('0x5'));var auth=require(_0x5eff('0x6'));var interaction=require(_0x5eff('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x5eff('0x8')]('/',auth[_0x5eff('0x9')](),controller[_0x5eff('0xa')]);router[_0x5eff('0x8')](_0x5eff('0xb'),auth[_0x5eff('0x9')](),controller[_0x5eff('0xc')]);router['get'](_0x5eff('0xd'),auth['isAuthenticated'](),controller[_0x5eff('0xe')]);router[_0x5eff('0xf')]('/',auth[_0x5eff('0x9')](),controller[_0x5eff('0x10')]);router['put'](_0x5eff('0xd'),auth[_0x5eff('0x9')](),controller[_0x5eff('0x11')]);router[_0x5eff('0x12')]('/:id',auth[_0x5eff('0x9')](),controller[_0x5eff('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index dd17db5..547315e 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0647=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0647,0x198));var _0x7064=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x0647[_0x246148];return _0x453d94;};'use strict';var Sequelize=require(_0x7064('0x0'));module[_0x7064('0x1')]={'name':{'type':Sequelize[_0x7064('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x7064('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3153=['STRING','INTEGER'];(function(_0x2a10f2,_0x50618d){var _0x415dff=function(_0x56ba3d){while(--_0x56ba3d){_0x2a10f2['push'](_0x2a10f2['shift']());}};_0x415dff(++_0x50618d);}(_0x3153,0x19e));var _0x3315=function(_0x4501eb,_0x22403e){_0x4501eb=_0x4501eb-0x0;var _0x4cda86=_0x3153[_0x4501eb];return _0x4cda86;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3315('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3315('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3315('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index ab0f4fb..9b734ac 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe485=['error','stack','name','render','merge','message','interaction','account','index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','catch','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x159152,_0x174251){var _0x50a4aa=function(_0x1a46f7){while(--_0x1a46f7){_0x159152['push'](_0x159152['shift']());}};_0x50a4aa(++_0x174251);}(_0xe485,0x114));var _0x5e48=function(_0x5a2e8f,_0x516577){_0x5a2e8f=_0x5a2e8f-0x0;var _0x3075ef=_0xe485[_0x5a2e8f];return _0x3075ef;};'use strict';var emlformat=require(_0x5e48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e48('0x1'));var jsonpatch=require(_0x5e48('0x2'));var rp=require(_0x5e48('0x3'));var moment=require('moment');var BPromise=require(_0x5e48('0x4'));var Mustache=require(_0x5e48('0x5'));var util=require('util');var path=require(_0x5e48('0x6'));var sox=require(_0x5e48('0x7'));var csv=require(_0x5e48('0x8'));var ejs=require(_0x5e48('0x9'));var fs=require('fs');var fs_extra=require(_0x5e48('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e48('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5e48('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5e48('0xd'));var Papa=require(_0x5e48('0xe'));var Redis=require('ioredis');var authService=require(_0x5e48('0xf'));var qs=require(_0x5e48('0x10'));var as=require(_0x5e48('0x11'));var hardwareService=require(_0x5e48('0x12'));var logger=require(_0x5e48('0x13'))(_0x5e48('0x14'));var utils=require(_0x5e48('0x15'));var config=require(_0x5e48('0x16'));var licenseUtil=require(_0x5e48('0x17'));var db=require(_0x5e48('0x18'))['db'];function respondWithStatusCode(_0x5026b1,_0x3226f7){_0x3226f7=_0x3226f7||0xcc;return function(_0x4bf743){if(_0x4bf743){return _0x5026b1[_0x5e48('0x19')](_0x3226f7);}return _0x5026b1[_0x5e48('0x1a')](_0x3226f7)[_0x5e48('0x1b')]();};}function respondWithResult(_0x2b6f32,_0x4a61ae){_0x4a61ae=_0x4a61ae||0xc8;return function(_0x18176b){if(_0x18176b){return _0x2b6f32['status'](_0x4a61ae)[_0x5e48('0x1c')](_0x18176b);}};}function respondWithFilteredResult(_0x8b2e45,_0x15ba1f){return function(_0x17a9e1){if(_0x17a9e1){var _0x3173c7=typeof _0x15ba1f[_0x5e48('0x1d')]==='undefined'&&typeof _0x15ba1f[_0x5e48('0x1e')]==='undefined';var _0x4db5d0=_0x17a9e1['count'];var _0x627d9=_0x3173c7?0x0:_0x15ba1f[_0x5e48('0x1d')];var _0x32995a=_0x3173c7?_0x17a9e1[_0x5e48('0x1f')]:_0x15ba1f['offset']+_0x15ba1f[_0x5e48('0x1e')];var _0x1c2363;if(_0x32995a>=_0x4db5d0){_0x32995a=_0x4db5d0;_0x1c2363=0xc8;}else{_0x1c2363=0xce;}_0x8b2e45[_0x5e48('0x1a')](_0x1c2363);return _0x8b2e45[_0x5e48('0x20')](_0x5e48('0x21'),_0x627d9+'-'+_0x32995a+'/'+_0x4db5d0)['json'](_0x17a9e1);}return null;};}function patchUpdates(_0x412089){return function(_0x56bdc9){try{jsonpatch[_0x5e48('0x22')](_0x56bdc9,_0x412089,!![]);}catch(_0x1fe41e){return BPromise[_0x5e48('0x23')](_0x1fe41e);}return _0x56bdc9[_0x5e48('0x24')]();};}function saveUpdates(_0xf858fe,_0x4f46b1){return function(_0x4e8080){if(_0x4e8080){return _0x4e8080[_0x5e48('0x25')](_0xf858fe)[_0x5e48('0x26')](function(_0x1ac943){return _0x1ac943;});}return null;};}function removeEntity(_0xa32c13,_0x2c15d4){return function(_0x584204){if(_0x584204){return _0x584204[_0x5e48('0x27')]()[_0x5e48('0x26')](function(){_0xa32c13[_0x5e48('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a7eb4,_0x350816){return function(_0x46040f){if(!_0x46040f){_0x5a7eb4[_0x5e48('0x19')](0x194);}return _0x46040f;};}function handleError(_0x46ca21,_0x4d0f06){_0x4d0f06=_0x4d0f06||0x1f4;return function(_0x4f574a){logger[_0x5e48('0x28')](_0x4f574a[_0x5e48('0x29')]);if(_0x4f574a['name']){delete _0x4f574a[_0x5e48('0x2a')];}_0x46ca21['status'](_0x4d0f06)['send'](_0x4f574a);};}function getMustacheRender(_0x4f395f,_0xfd072d){return Mustache[_0x5e48('0x2b')](_0x4f395f,_[_0x5e48('0x2c')](_0xfd072d['body'],{'contact':_0xfd072d['contact'],'message':_0xfd072d[_0x5e48('0x2d')],'agent':_0xfd072d['agent'],'interaction':_0xfd072d[_0x5e48('0x2e')],'account':_0xfd072d[_0x5e48('0x2f')]}))||'';}exports[_0x5e48('0x30')]=function(_0x4ecbd9,_0x4c4c8d){var _0x29b7cf={},_0x40db41={},_0x18f1c0={'count':0x0,'rows':[]};var _0x2bd6d2=_[_0x5e48('0x31')](db[_0x5e48('0x32')][_0x5e48('0x33')],function(_0xaeeb04){return{'name':_0xaeeb04['fieldName'],'type':_0xaeeb04[_0x5e48('0x34')][_0x5e48('0x35')]};});_0x40db41[_0x5e48('0x36')]=_[_0x5e48('0x31')](_0x2bd6d2,'name');_0x40db41[_0x5e48('0x37')]=_[_0x5e48('0x38')](_0x4ecbd9[_0x5e48('0x37')]);_0x40db41[_0x5e48('0x39')]=_['intersection'](_0x40db41[_0x5e48('0x36')],_0x40db41['query']);_0x29b7cf[_0x5e48('0x3a')]=_[_0x5e48('0x3b')](_0x40db41[_0x5e48('0x36')],qs[_0x5e48('0x3c')](_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x3c')]));_0x29b7cf[_0x5e48('0x3a')]=_0x29b7cf['attributes'][_0x5e48('0x3d')]?_0x29b7cf[_0x5e48('0x3a')]:_0x40db41[_0x5e48('0x36')];if(!_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x3e')](_0x5e48('0x3f'))){_0x29b7cf[_0x5e48('0x1e')]=qs[_0x5e48('0x1e')](_0x4ecbd9['query'][_0x5e48('0x1e')]);_0x29b7cf['offset']=qs[_0x5e48('0x1d')](_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x1d')]);}_0x29b7cf['order']=qs[_0x5e48('0x40')](_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x40')]);_0x29b7cf[_0x5e48('0x41')]=qs[_0x5e48('0x39')](_[_0x5e48('0x42')](_0x4ecbd9['query'],_0x40db41[_0x5e48('0x39')]),_0x2bd6d2);if(_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x43')]){_0x29b7cf[_0x5e48('0x41')]=_[_0x5e48('0x2c')](_0x29b7cf[_0x5e48('0x41')],{'$or':_['map'](_0x2bd6d2,function(_0x374c35){if(_0x374c35[_0x5e48('0x34')]!=='VIRTUAL'){var _0x5f3854={};_0x5f3854[_0x374c35['name']]={'$like':'%'+_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x43')]+'%'};return _0x5f3854;}})});}_0x29b7cf=_[_0x5e48('0x2c')]({},_0x29b7cf,_0x4ecbd9[_0x5e48('0x44')]);var _0x39f484={'where':_0x29b7cf[_0x5e48('0x41')]};return db[_0x5e48('0x32')]['count'](_0x39f484)[_0x5e48('0x26')](function(_0x36df6b){_0x18f1c0[_0x5e48('0x1f')]=_0x36df6b;if(_0x4ecbd9[_0x5e48('0x37')][_0x5e48('0x45')]){_0x29b7cf[_0x5e48('0x46')]=[{'all':!![]}];}return db[_0x5e48('0x32')][_0x5e48('0x47')](_0x29b7cf);})['then'](function(_0x5829d9){_0x18f1c0[_0x5e48('0x48')]=_0x5829d9;return _0x18f1c0;})[_0x5e48('0x26')](respondWithFilteredResult(_0x4c4c8d,_0x29b7cf))['catch'](handleError(_0x4c4c8d,null));};exports[_0x5e48('0x49')]=function(_0x317aa3,_0x1b66b1){var _0x44991b={'raw':![],'where':{'id':_0x317aa3[_0x5e48('0x4a')]['id']}},_0x5337d0={};_0x5337d0[_0x5e48('0x36')]=_[_0x5e48('0x38')](db[_0x5e48('0x32')][_0x5e48('0x33')]);_0x5337d0[_0x5e48('0x37')]=_[_0x5e48('0x38')](_0x317aa3[_0x5e48('0x37')]);_0x5337d0[_0x5e48('0x39')]=_[_0x5e48('0x3b')](_0x5337d0[_0x5e48('0x36')],_0x5337d0[_0x5e48('0x37')]);_0x44991b[_0x5e48('0x3a')]=_[_0x5e48('0x3b')](_0x5337d0[_0x5e48('0x36')],qs[_0x5e48('0x3c')](_0x317aa3[_0x5e48('0x37')]['fields']));_0x44991b['attributes']=_0x44991b[_0x5e48('0x3a')]['length']?_0x44991b['attributes']:_0x5337d0[_0x5e48('0x36')];if(_0x317aa3[_0x5e48('0x37')][_0x5e48('0x45')]){_0x44991b['include']=[{'all':!![]}];}_0x44991b=_[_0x5e48('0x2c')]({},_0x44991b,_0x317aa3[_0x5e48('0x44')]);return db[_0x5e48('0x32')]['find'](_0x44991b)[_0x5e48('0x26')](handleEntityNotFound(_0x1b66b1,null))[_0x5e48('0x26')](respondWithResult(_0x1b66b1,null))[_0x5e48('0x4b')](handleError(_0x1b66b1,null));};exports['create']=function(_0x22fdcc,_0x5a9c7d){return db[_0x5e48('0x32')]['create'](_0x22fdcc[_0x5e48('0x4c')],{})[_0x5e48('0x26')](respondWithResult(_0x5a9c7d,0xc9))['catch'](handleError(_0x5a9c7d,null));};exports[_0x5e48('0x25')]=function(_0x328c78,_0x4b5db2){if(_0x328c78[_0x5e48('0x4c')]['id']){delete _0x328c78[_0x5e48('0x4c')]['id'];}return db[_0x5e48('0x32')][_0x5e48('0x4d')]({'where':{'id':_0x328c78[_0x5e48('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b5db2,null))['then'](saveUpdates(_0x328c78['body'],null))[_0x5e48('0x26')](respondWithResult(_0x4b5db2,null))[_0x5e48('0x4b')](handleError(_0x4b5db2,null));};exports['destroy']=function(_0x191a11,_0x4cd89b){return db[_0x5e48('0x32')][_0x5e48('0x4d')]({'where':{'id':_0x191a11[_0x5e48('0x4a')]['id']}})[_0x5e48('0x26')](handleEntityNotFound(_0x4cd89b,null))[_0x5e48('0x26')](removeEntity(_0x4cd89b,null))[_0x5e48('0x4b')](handleError(_0x4cd89b,null));};exports[_0x5e48('0x4e')]=function(_0xd70b16,_0x46e530){return db[_0x5e48('0x32')][_0x5e48('0x4e')]()[_0x5e48('0x26')](respondWithResult(_0x46e530,null))[_0x5e48('0x4b')](handleError(_0x46e530,null));}; \ No newline at end of file +var _0x6299=['render','merge','contact','message','agent','interaction','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','UserProfileResource','includeAll','include','rows','show','params','create','body','catch','update','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','then','destroy','error','stack','name','send'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x6299,0x169));var _0x9629=function(_0xc8aac7,_0x6b014b){_0xc8aac7=_0xc8aac7-0x0;var _0x2e5b19=_0x6299[_0xc8aac7];return _0x2e5b19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9629('0x0'));var jsonpatch=require(_0x9629('0x1'));var rp=require(_0x9629('0x2'));var moment=require(_0x9629('0x3'));var BPromise=require(_0x9629('0x4'));var Mustache=require(_0x9629('0x5'));var util=require('util');var path=require(_0x9629('0x6'));var sox=require(_0x9629('0x7'));var csv=require(_0x9629('0x8'));var ejs=require(_0x9629('0x9'));var fs=require('fs');var fs_extra=require(_0x9629('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9629('0xb'));var jsforce=require(_0x9629('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9629('0xd'));var Redis=require(_0x9629('0xe'));var authService=require(_0x9629('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9629('0x10'));var hardwareService=require(_0x9629('0x11'));var logger=require(_0x9629('0x12'))('api');var utils=require(_0x9629('0x13'));var config=require(_0x9629('0x14'));var licenseUtil=require(_0x9629('0x15'));var db=require(_0x9629('0x16'))['db'];function respondWithStatusCode(_0x37a60e,_0x4e7334){_0x4e7334=_0x4e7334||0xcc;return function(_0x2e2964){if(_0x2e2964){return _0x37a60e[_0x9629('0x17')](_0x4e7334);}return _0x37a60e[_0x9629('0x18')](_0x4e7334)[_0x9629('0x19')]();};}function respondWithResult(_0x216adc,_0x196eef){_0x196eef=_0x196eef||0xc8;return function(_0x5358c5){if(_0x5358c5){return _0x216adc[_0x9629('0x18')](_0x196eef)[_0x9629('0x1a')](_0x5358c5);}};}function respondWithFilteredResult(_0x73793b,_0x1fdf53){return function(_0xa4b554){if(_0xa4b554){var _0x365c6d=typeof _0x1fdf53['offset']===_0x9629('0x1b')&&typeof _0x1fdf53[_0x9629('0x1c')]===_0x9629('0x1b');var _0x33c7f3=_0xa4b554[_0x9629('0x1d')];var _0x3f777a=_0x365c6d?0x0:_0x1fdf53[_0x9629('0x1e')];var _0x447f28=_0x365c6d?_0xa4b554[_0x9629('0x1d')]:_0x1fdf53['offset']+_0x1fdf53[_0x9629('0x1c')];var _0x57ce58;if(_0x447f28>=_0x33c7f3){_0x447f28=_0x33c7f3;_0x57ce58=0xc8;}else{_0x57ce58=0xce;}_0x73793b[_0x9629('0x18')](_0x57ce58);return _0x73793b[_0x9629('0x1f')]('Content-Range',_0x3f777a+'-'+_0x447f28+'/'+_0x33c7f3)[_0x9629('0x1a')](_0xa4b554);}return null;};}function patchUpdates(_0x4ab24f){return function(_0x3a4c7a){try{jsonpatch[_0x9629('0x20')](_0x3a4c7a,_0x4ab24f,!![]);}catch(_0x1746cd){return BPromise['reject'](_0x1746cd);}return _0x3a4c7a['save']();};}function saveUpdates(_0x248d17,_0x169576){return function(_0x2956ed){if(_0x2956ed){return _0x2956ed['update'](_0x248d17)[_0x9629('0x21')](function(_0x7a93de){return _0x7a93de;});}return null;};}function removeEntity(_0xfc1c2c,_0x4ae0c7){return function(_0x5caac4){if(_0x5caac4){return _0x5caac4[_0x9629('0x22')]()[_0x9629('0x21')](function(){_0xfc1c2c[_0x9629('0x18')](0xcc)[_0x9629('0x19')]();});}};}function handleEntityNotFound(_0x1232ec,_0xaa1b76){return function(_0x4ae694){if(!_0x4ae694){_0x1232ec[_0x9629('0x17')](0x194);}return _0x4ae694;};}function handleError(_0x499bb3,_0x25ae31){_0x25ae31=_0x25ae31||0x1f4;return function(_0x1db0d9){logger[_0x9629('0x23')](_0x1db0d9[_0x9629('0x24')]);if(_0x1db0d9[_0x9629('0x25')]){delete _0x1db0d9[_0x9629('0x25')];}_0x499bb3[_0x9629('0x18')](_0x25ae31)[_0x9629('0x26')](_0x1db0d9);};}function getMustacheRender(_0xf05efd,_0x52f5cd){return Mustache[_0x9629('0x27')](_0xf05efd,_[_0x9629('0x28')](_0x52f5cd['body'],{'contact':_0x52f5cd[_0x9629('0x29')],'message':_0x52f5cd[_0x9629('0x2a')],'agent':_0x52f5cd[_0x9629('0x2b')],'interaction':_0x52f5cd[_0x9629('0x2c')],'account':_0x52f5cd['account']}))||'';}exports[_0x9629('0x2d')]=function(_0x2de66e,_0x5cf1b6){var _0x160eb9={},_0x505590={},_0x3145b0={'count':0x0,'rows':[]};var _0x117d82=_['map'](db['UserProfileResource'][_0x9629('0x2e')],function(_0x2cd400){return{'name':_0x2cd400[_0x9629('0x2f')],'type':_0x2cd400[_0x9629('0x30')][_0x9629('0x31')]};});_0x505590[_0x9629('0x32')]=_[_0x9629('0x33')](_0x117d82,_0x9629('0x25'));_0x505590[_0x9629('0x34')]=_[_0x9629('0x35')](_0x2de66e[_0x9629('0x34')]);_0x505590['filters']=_[_0x9629('0x36')](_0x505590['model'],_0x505590[_0x9629('0x34')]);_0x160eb9[_0x9629('0x37')]=_[_0x9629('0x36')](_0x505590[_0x9629('0x32')],qs[_0x9629('0x38')](_0x2de66e['query'][_0x9629('0x38')]));_0x160eb9[_0x9629('0x37')]=_0x160eb9[_0x9629('0x37')][_0x9629('0x39')]?_0x160eb9[_0x9629('0x37')]:_0x505590[_0x9629('0x32')];if(!_0x2de66e['query'][_0x9629('0x3a')](_0x9629('0x3b'))){_0x160eb9['limit']=qs['limit'](_0x2de66e[_0x9629('0x34')][_0x9629('0x1c')]);_0x160eb9[_0x9629('0x1e')]=qs['offset'](_0x2de66e[_0x9629('0x34')][_0x9629('0x1e')]);}_0x160eb9[_0x9629('0x3c')]=qs[_0x9629('0x3d')](_0x2de66e[_0x9629('0x34')][_0x9629('0x3d')]);_0x160eb9[_0x9629('0x3e')]=qs[_0x9629('0x3f')](_[_0x9629('0x40')](_0x2de66e[_0x9629('0x34')],_0x505590[_0x9629('0x3f')]),_0x117d82);if(_0x2de66e['query'][_0x9629('0x41')]){_0x160eb9[_0x9629('0x3e')]=_[_0x9629('0x28')](_0x160eb9['where'],{'$or':_[_0x9629('0x33')](_0x117d82,function(_0x3197e6){if(_0x3197e6['type']!==_0x9629('0x42')){var _0x38c565={};_0x38c565[_0x3197e6['name']]={'$like':'%'+_0x2de66e['query'][_0x9629('0x41')]+'%'};return _0x38c565;}})});}_0x160eb9=_[_0x9629('0x28')]({},_0x160eb9,_0x2de66e[_0x9629('0x43')]);var _0x456326={'where':_0x160eb9['where']};return db[_0x9629('0x44')][_0x9629('0x1d')](_0x456326)[_0x9629('0x21')](function(_0x229ce0){_0x3145b0['count']=_0x229ce0;if(_0x2de66e[_0x9629('0x34')][_0x9629('0x45')]){_0x160eb9[_0x9629('0x46')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x160eb9);})[_0x9629('0x21')](function(_0x2fcf6c){_0x3145b0[_0x9629('0x47')]=_0x2fcf6c;return _0x3145b0;})['then'](respondWithFilteredResult(_0x5cf1b6,_0x160eb9))['catch'](handleError(_0x5cf1b6,null));};exports[_0x9629('0x48')]=function(_0x1b6978,_0x31fb2f){var _0x309970={'raw':![],'where':{'id':_0x1b6978[_0x9629('0x49')]['id']}},_0x2abd0b={};_0x2abd0b['model']=_[_0x9629('0x35')](db[_0x9629('0x44')][_0x9629('0x2e')]);_0x2abd0b[_0x9629('0x34')]=_[_0x9629('0x35')](_0x1b6978[_0x9629('0x34')]);_0x2abd0b[_0x9629('0x3f')]=_['intersection'](_0x2abd0b['model'],_0x2abd0b[_0x9629('0x34')]);_0x309970[_0x9629('0x37')]=_[_0x9629('0x36')](_0x2abd0b[_0x9629('0x32')],qs[_0x9629('0x38')](_0x1b6978['query']['fields']));_0x309970[_0x9629('0x37')]=_0x309970[_0x9629('0x37')][_0x9629('0x39')]?_0x309970['attributes']:_0x2abd0b[_0x9629('0x32')];if(_0x1b6978['query'][_0x9629('0x45')]){_0x309970[_0x9629('0x46')]=[{'all':!![]}];}_0x309970=_[_0x9629('0x28')]({},_0x309970,_0x1b6978[_0x9629('0x43')]);return db[_0x9629('0x44')]['find'](_0x309970)[_0x9629('0x21')](handleEntityNotFound(_0x31fb2f,null))[_0x9629('0x21')](respondWithResult(_0x31fb2f,null))['catch'](handleError(_0x31fb2f,null));};exports[_0x9629('0x4a')]=function(_0x5638d2,_0xefd2cf){return db['UserProfileResource'][_0x9629('0x4a')](_0x5638d2[_0x9629('0x4b')],{})[_0x9629('0x21')](respondWithResult(_0xefd2cf,0xc9))[_0x9629('0x4c')](handleError(_0xefd2cf,null));};exports[_0x9629('0x4d')]=function(_0x32ac39,_0x24bb35){if(_0x32ac39[_0x9629('0x4b')]['id']){delete _0x32ac39['body']['id'];}return db[_0x9629('0x44')][_0x9629('0x4e')]({'where':{'id':_0x32ac39[_0x9629('0x49')]['id']}})[_0x9629('0x21')](handleEntityNotFound(_0x24bb35,null))[_0x9629('0x21')](saveUpdates(_0x32ac39[_0x9629('0x4b')],null))[_0x9629('0x21')](respondWithResult(_0x24bb35,null))[_0x9629('0x4c')](handleError(_0x24bb35,null));};exports[_0x9629('0x22')]=function(_0x1a4a9d,_0x2ad0d7){return db[_0x9629('0x44')][_0x9629('0x4e')]({'where':{'id':_0x1a4a9d[_0x9629('0x49')]['id']}})[_0x9629('0x21')](handleEntityNotFound(_0x2ad0d7,null))[_0x9629('0x21')](removeEntity(_0x2ad0d7,null))[_0x9629('0x4c')](handleError(_0x2ad0d7,null));};exports['describe']=function(_0x5d897d,_0x56803f){return db['UserProfileResource'][_0x9629('0x4f')]()[_0x9629('0x21')](respondWithResult(_0x56803f,null))['catch'](handleError(_0x56803f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4949adc..32f4dca 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x144e=['resourceId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x46bc86,_0x15dbe1){var _0x2d1b56=function(_0x572f21){while(--_0x572f21){_0x46bc86['push'](_0x46bc86['shift']());}};_0x2d1b56(++_0x15dbe1);}(_0x144e,0x181));var _0xe144=function(_0x3bdaf3,_0x2ed581){_0x3bdaf3=_0x3bdaf3-0x0;var _0x49830b=_0x144e[_0x3bdaf3];return _0x49830b;};'use strict';var _=require(_0xe144('0x0'));var util=require(_0xe144('0x1'));var logger=require(_0xe144('0x2'))('api');var moment=require(_0xe144('0x3'));var BPromise=require('bluebird');var rp=require(_0xe144('0x4'));var fs=require('fs');var path=require(_0xe144('0x5'));var rimraf=require(_0xe144('0x6'));var config=require(_0xe144('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x6b0102,_0x27fb98){return _0x6b0102['define'](_0xe144('0x8'),attributes,{'tableName':_0xe144('0x9'),'paranoid':![],'indexes':[{'name':_0xe144('0xa'),'fields':[_0xe144('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0872=['../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','sectionId','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x4dda69,_0x2a0fe4){var _0x9014a9=function(_0x3d2b40){while(--_0x3d2b40){_0x4dda69['push'](_0x4dda69['shift']());}};_0x9014a9(++_0x2a0fe4);}(_0x0872,0x1a9));var _0x2087=function(_0x4c5a52,_0x48be0e){_0x4c5a52=_0x4c5a52-0x0;var _0x266cd6=_0x0872[_0x4c5a52];return _0x266cd6;};'use strict';var _=require(_0x2087('0x0'));var util=require(_0x2087('0x1'));var logger=require(_0x2087('0x2'))(_0x2087('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2087('0x4'));var fs=require('fs');var path=require(_0x2087('0x5'));var rimraf=require(_0x2087('0x6'));var config=require(_0x2087('0x7'));var attributes=require(_0x2087('0x8'));module[_0x2087('0x9')]=function(_0x2dfa7f,_0x39dad2){return _0x2dfa7f['define'](_0x2087('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x2087('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 7bbd3bd..229efa9 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9d5=['../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x262f67,_0x46dfc3){var _0x35ed8a=function(_0x381220){while(--_0x381220){_0x262f67['push'](_0x262f67['shift']());}};_0x35ed8a(++_0x46dfc3);}(_0xb9d5,0xb6));var _0x5b9d=function(_0x5d5d54,_0x167ce9){_0x5d5d54=_0x5d5d54-0x0;var _0x3184a1=_0xb9d5[_0x5d5d54];return _0x3184a1;};'use strict';var _=require('lodash');var util=require(_0x5b9d('0x0'));var moment=require(_0x5b9d('0x1'));var BPromise=require(_0x5b9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b9d('0x3'))['db'];var utils=require(_0x5b9d('0x4'));var logger=require(_0x5b9d('0x5'))(_0x5b9d('0x6'));var config=require(_0x5b9d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b9d('0x8')][_0x5b9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c89ce,_0x35bde3,_0x300797){return new BPromise(function(_0x546207,_0x2fb79c){return client['request'](_0x9c89ce,_0x300797)[_0x5b9d('0xa')](function(_0x35c60b){logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));logger['debug'](_0x5b9d('0xe'),_0x35bde3,_0x5b9d('0xd'),JSON[_0x5b9d('0xf')](_0x35c60b));if(_0x35c60b['error']){if(_0x35c60b['error'][_0x5b9d('0x10')]===0x1f4){logger[_0x5b9d('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x35bde3,_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);return _0x2fb79c(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}logger[_0x5b9d('0x11')](_0x5b9d('0xc'),_0x35bde3,_0x35c60b[_0x5b9d('0x11')]['message']);return _0x546207(_0x35c60b[_0x5b9d('0x11')][_0x5b9d('0x12')]);}else{logger[_0x5b9d('0xb')](_0x5b9d('0xc'),_0x35bde3,_0x5b9d('0xd'));_0x546207(_0x35c60b[_0x5b9d('0x13')][_0x5b9d('0x12')]);}})[_0x5b9d('0x14')](function(_0xea2730){logger['error'](_0x5b9d('0xc'),_0x35bde3,_0xea2730);_0x2fb79c(_0xea2730);});});} \ No newline at end of file +var _0xf8e6=['UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','then','info'];(function(_0x27b436,_0x14d508){var _0xf9ee4a=function(_0x10b308){while(--_0x10b308){_0x27b436['push'](_0x27b436['shift']());}};_0xf9ee4a(++_0x14d508);}(_0xf8e6,0x14b));var _0x6f8e=function(_0x7888f6,_0x1f4881){_0x7888f6=_0x7888f6-0x0;var _0x5e8c57=_0xf8e6[_0x7888f6];return _0x5e8c57;};'use strict';var _=require('lodash');var util=require(_0x6f8e('0x0'));var moment=require(_0x6f8e('0x1'));var BPromise=require(_0x6f8e('0x2'));var rs=require(_0x6f8e('0x3'));var fs=require('fs');var Redis=require(_0x6f8e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f8e('0x5'));var logger=require('../../config/logger')(_0x6f8e('0x6'));var config=require(_0x6f8e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c379f,_0xb61799,_0x2dca60){return new BPromise(function(_0x5e98c9,_0xb4c86a){return client[_0x6f8e('0x8')](_0x1c379f,_0x2dca60)[_0x6f8e('0x9')](function(_0x103b99){logger[_0x6f8e('0xa')](_0x6f8e('0xb'),_0xb61799,_0x6f8e('0xc'));logger['debug'](_0x6f8e('0xd'),_0xb61799,_0x6f8e('0xc'),JSON['stringify'](_0x103b99));if(_0x103b99[_0x6f8e('0xe')]){if(_0x103b99[_0x6f8e('0xe')][_0x6f8e('0xf')]===0x1f4){logger[_0x6f8e('0xe')](_0x6f8e('0xb'),_0xb61799,_0x103b99[_0x6f8e('0xe')]['message']);return _0xb4c86a(_0x103b99[_0x6f8e('0xe')][_0x6f8e('0x10')]);}logger[_0x6f8e('0xe')]('UserProfileResource,\x20%s,\x20%s',_0xb61799,_0x103b99[_0x6f8e('0xe')][_0x6f8e('0x10')]);return _0x5e98c9(_0x103b99['error'][_0x6f8e('0x10')]);}else{logger[_0x6f8e('0xa')](_0x6f8e('0xb'),_0xb61799,_0x6f8e('0xc'));_0x5e98c9(_0x103b99[_0x6f8e('0x11')][_0x6f8e('0x10')]);}})[_0x6f8e('0x12')](function(_0x2a2d3a){logger[_0x6f8e('0xe')](_0x6f8e('0xb'),_0xb61799,_0x2a2d3a);_0xb4c86a(_0x2a2d3a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8e13254..2fcb976 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a06=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe','/:id','create','update','delete','destroy','exports'];(function(_0x4f3bdd,_0x527557){var _0x1b6af5=function(_0x4c868d){while(--_0x4c868d){_0x4f3bdd['push'](_0x4f3bdd['shift']());}};_0x1b6af5(++_0x527557);}(_0x5a06,0x130));var _0x65a0=function(_0x4adbb0,_0x5f5a74){_0x4adbb0=_0x4adbb0-0x0;var _0x5e235c=_0x5a06[_0x4adbb0];return _0x5e235c;};'use strict';var multer=require(_0x65a0('0x0'));var util=require('util');var path=require(_0x65a0('0x1'));var timeout=require(_0x65a0('0x2'));var express=require('express');var router=express[_0x65a0('0x3')]();var fs_extra=require(_0x65a0('0x4'));var auth=require(_0x65a0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x65a0('0x6')]('/',auth[_0x65a0('0x7')](),controller[_0x65a0('0x8')]);router[_0x65a0('0x6')]('/describe',auth[_0x65a0('0x7')](),controller[_0x65a0('0x9')]);router[_0x65a0('0x6')](_0x65a0('0xa'),auth[_0x65a0('0x7')](),controller['show']);router['post']('/',auth[_0x65a0('0x7')](),controller[_0x65a0('0xb')]);router['put'](_0x65a0('0xa'),auth[_0x65a0('0x7')](),controller[_0x65a0('0xc')]);router[_0x65a0('0xd')](_0x65a0('0xa'),auth['isAuthenticated'](),controller[_0x65a0('0xe')]);module[_0x65a0('0xf')]=router; \ No newline at end of file +var _0x66b1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','destroy','exports','multer','util','express','Router'];(function(_0x442a5d,_0x2a6745){var _0x51d134=function(_0x5cae90){while(--_0x5cae90){_0x442a5d['push'](_0x442a5d['shift']());}};_0x51d134(++_0x2a6745);}(_0x66b1,0xd4));var _0x166b=function(_0x17580b,_0x2baaba){_0x17580b=_0x17580b-0x0;var _0x549b5f=_0x66b1[_0x17580b];return _0x549b5f;};'use strict';var multer=require(_0x166b('0x0'));var util=require(_0x166b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x166b('0x2'));var router=express[_0x166b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x166b('0x4'));var interaction=require(_0x166b('0x5'));var config=require(_0x166b('0x6'));var controller=require(_0x166b('0x7'));router[_0x166b('0x8')]('/',auth[_0x166b('0x9')](),controller[_0x166b('0xa')]);router['get'](_0x166b('0xb'),auth[_0x166b('0x9')](),controller['describe']);router[_0x166b('0x8')](_0x166b('0xc'),auth[_0x166b('0x9')](),controller[_0x166b('0xd')]);router[_0x166b('0xe')]('/',auth[_0x166b('0x9')](),controller[_0x166b('0xf')]);router['put'](_0x166b('0xc'),auth[_0x166b('0x9')](),controller['update']);router['delete'](_0x166b('0xc'),auth[_0x166b('0x9')](),controller[_0x166b('0x10')]);module[_0x166b('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 76c00fb..a605ec4 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7b4=['BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize','STRING'];(function(_0x4c9345,_0xe6b30c){var _0x1738cb=function(_0x467f6e){while(--_0x467f6e){_0x4c9345['push'](_0x4c9345['shift']());}};_0x1738cb(++_0xe6b30c);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4c7b('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c7b('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x4c7b('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x4c7b('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4c7b('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4c7b('0x1')],'set':function(_0x2a8b1d){this[_0x4c7b('0x3')]('crudPermissions',_0x2a8b1d?_0x2a8b1d[_0x4c7b('0x4')](''):[]);},'get':function(){return this[_0x4c7b('0x5')](_0x4c7b('0x6'))?this[_0x4c7b('0x5')](_0x4c7b('0x6'))[_0x4c7b('0x7')](''):[];}}}; \ No newline at end of file +var _0x0207=['getDataValue','split','exports','INTEGER','BOOLEAN','STRING','setDataValue','crudPermissions'];(function(_0x233d57,_0x284678){var _0x3eec8c=function(_0x56d91b){while(--_0x56d91b){_0x233d57['push'](_0x233d57['shift']());}};_0x3eec8c(++_0x284678);}(_0x0207,0x162));var _0x7020=function(_0x5f027c,_0x37ff66){_0x5f027c=_0x5f027c-0x0;var _0x202e3d=_0x0207[_0x5f027c];return _0x202e3d;};'use strict';var Sequelize=require('sequelize');module[_0x7020('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7020('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x7020('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7020('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7020('0x3')],'set':function(_0x2e62fd){this[_0x7020('0x4')](_0x7020('0x5'),_0x2e62fd?_0x2e62fd['join'](''):[]);},'get':function(){return this['getDataValue'](_0x7020('0x5'))?this[_0x7020('0x6')](_0x7020('0x5'))[_0x7020('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 7d5b5fc..07f92a4 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa464=['merge','body','contact','message','agent','interaction','index','map','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','UserProfileSection','findAll','rows','catch','params','keys','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','then','destroy','stack','send','render'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xa464,0x115));var _0x4a46=function(_0xaacb57,_0x1befa9){_0xaacb57=_0xaacb57-0x0;var _0x13f10c=_0xa464[_0xaacb57];return _0x13f10c;};'use strict';var emlformat=require(_0x4a46('0x0'));var rimraf=require(_0x4a46('0x1'));var zipdir=require(_0x4a46('0x2'));var jsonpatch=require(_0x4a46('0x3'));var rp=require(_0x4a46('0x4'));var moment=require(_0x4a46('0x5'));var BPromise=require(_0x4a46('0x6'));var Mustache=require('mustache');var util=require(_0x4a46('0x7'));var path=require(_0x4a46('0x8'));var sox=require(_0x4a46('0x9'));var csv=require(_0x4a46('0xa'));var ejs=require(_0x4a46('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a46('0xc'));var squel=require(_0x4a46('0xd'));var crypto=require('crypto');var jsforce=require(_0x4a46('0xe'));var deskjs=require(_0x4a46('0xf'));var toCsv=require(_0x4a46('0xa'));var querystring=require(_0x4a46('0x10'));var Papa=require(_0x4a46('0x11'));var Redis=require('ioredis');var authService=require(_0x4a46('0x12'));var qs=require(_0x4a46('0x13'));var as=require(_0x4a46('0x14'));var hardwareService=require(_0x4a46('0x15'));var logger=require(_0x4a46('0x16'))(_0x4a46('0x17'));var utils=require(_0x4a46('0x18'));var config=require(_0x4a46('0x19'));var licenseUtil=require(_0x4a46('0x1a'));var db=require(_0x4a46('0x1b'))['db'];function respondWithStatusCode(_0x352b5f,_0x1a72c1){_0x1a72c1=_0x1a72c1||0xcc;return function(_0x14da1f){if(_0x14da1f){return _0x352b5f[_0x4a46('0x1c')](_0x1a72c1);}return _0x352b5f[_0x4a46('0x1d')](_0x1a72c1)[_0x4a46('0x1e')]();};}function respondWithResult(_0x2cbc93,_0x129cf4){_0x129cf4=_0x129cf4||0xc8;return function(_0x273ce3){if(_0x273ce3){return _0x2cbc93[_0x4a46('0x1d')](_0x129cf4)[_0x4a46('0x1f')](_0x273ce3);}};}function respondWithFilteredResult(_0x435673,_0x30eb54){return function(_0x10e12f){if(_0x10e12f){var _0x432b8b=typeof _0x30eb54[_0x4a46('0x20')]===_0x4a46('0x21')&&typeof _0x30eb54['limit']===_0x4a46('0x21');var _0xea41e=_0x10e12f[_0x4a46('0x22')];var _0x14c5e1=_0x432b8b?0x0:_0x30eb54[_0x4a46('0x20')];var _0x155ea8=_0x432b8b?_0x10e12f['count']:_0x30eb54[_0x4a46('0x20')]+_0x30eb54[_0x4a46('0x23')];var _0x413170;if(_0x155ea8>=_0xea41e){_0x155ea8=_0xea41e;_0x413170=0xc8;}else{_0x413170=0xce;}_0x435673[_0x4a46('0x1d')](_0x413170);return _0x435673['set'](_0x4a46('0x24'),_0x14c5e1+'-'+_0x155ea8+'/'+_0xea41e)[_0x4a46('0x1f')](_0x10e12f);}return null;};}function patchUpdates(_0x39d17a){return function(_0x229aa9){try{jsonpatch['apply'](_0x229aa9,_0x39d17a,!![]);}catch(_0x926973){return BPromise[_0x4a46('0x25')](_0x926973);}return _0x229aa9['save']();};}function saveUpdates(_0x83ca77,_0x1c8149){return function(_0x3c3f70){if(_0x3c3f70){return _0x3c3f70['update'](_0x83ca77)[_0x4a46('0x26')](function(_0x3d62ba){return _0x3d62ba;});}return null;};}function removeEntity(_0x102c6d,_0x22e3c8){return function(_0xd4212b){if(_0xd4212b){return _0xd4212b[_0x4a46('0x27')]()[_0x4a46('0x26')](function(){_0x102c6d['status'](0xcc)[_0x4a46('0x1e')]();});}};}function handleEntityNotFound(_0x32597e,_0x576bd8){return function(_0x2a0582){if(!_0x2a0582){_0x32597e['sendStatus'](0x194);}return _0x2a0582;};}function handleError(_0x475f76,_0xfc2214){_0xfc2214=_0xfc2214||0x1f4;return function(_0x3991e9){logger['error'](_0x3991e9[_0x4a46('0x28')]);if(_0x3991e9['name']){delete _0x3991e9['name'];}_0x475f76['status'](_0xfc2214)[_0x4a46('0x29')](_0x3991e9);};}function getMustacheRender(_0x4a29b8,_0x4c6f52){return Mustache[_0x4a46('0x2a')](_0x4a29b8,_[_0x4a46('0x2b')](_0x4c6f52[_0x4a46('0x2c')],{'contact':_0x4c6f52[_0x4a46('0x2d')],'message':_0x4c6f52[_0x4a46('0x2e')],'agent':_0x4c6f52[_0x4a46('0x2f')],'interaction':_0x4c6f52[_0x4a46('0x30')],'account':_0x4c6f52['account']}))||'';}exports[_0x4a46('0x31')]=function(_0x3b183e,_0x59bf2e){var _0x27d423={},_0xa941={},_0x3d9edd={'count':0x0,'rows':[]};var _0x276a3b=_[_0x4a46('0x32')](db['UserProfileSection'][_0x4a46('0x33')],function(_0x4aef89){return{'name':_0x4aef89['fieldName'],'type':_0x4aef89[_0x4a46('0x34')][_0x4a46('0x35')]};});_0xa941[_0x4a46('0x36')]=_[_0x4a46('0x32')](_0x276a3b,_0x4a46('0x37'));_0xa941[_0x4a46('0x38')]=_['keys'](_0x3b183e[_0x4a46('0x38')]);_0xa941[_0x4a46('0x39')]=_[_0x4a46('0x3a')](_0xa941['model'],_0xa941[_0x4a46('0x38')]);_0x27d423['attributes']=_[_0x4a46('0x3a')](_0xa941['model'],qs[_0x4a46('0x3b')](_0x3b183e[_0x4a46('0x38')][_0x4a46('0x3b')]));_0x27d423[_0x4a46('0x3c')]=_0x27d423[_0x4a46('0x3c')][_0x4a46('0x3d')]?_0x27d423[_0x4a46('0x3c')]:_0xa941[_0x4a46('0x36')];if(!_0x3b183e[_0x4a46('0x38')]['hasOwnProperty'](_0x4a46('0x3e'))){_0x27d423[_0x4a46('0x23')]=qs[_0x4a46('0x23')](_0x3b183e['query'][_0x4a46('0x23')]);_0x27d423[_0x4a46('0x20')]=qs[_0x4a46('0x20')](_0x3b183e[_0x4a46('0x38')][_0x4a46('0x20')]);}_0x27d423[_0x4a46('0x3f')]=qs[_0x4a46('0x40')](_0x3b183e['query'][_0x4a46('0x40')]);_0x27d423[_0x4a46('0x41')]=qs[_0x4a46('0x39')](_['pick'](_0x3b183e['query'],_0xa941[_0x4a46('0x39')]),_0x276a3b);if(_0x3b183e[_0x4a46('0x38')][_0x4a46('0x42')]){_0x27d423['where']=_[_0x4a46('0x2b')](_0x27d423[_0x4a46('0x41')],{'$or':_[_0x4a46('0x32')](_0x276a3b,function(_0x2bb941){if(_0x2bb941[_0x4a46('0x34')]!==_0x4a46('0x43')){var _0x19401c={};_0x19401c[_0x2bb941['name']]={'$like':'%'+_0x3b183e['query']['filter']+'%'};return _0x19401c;}})});}_0x27d423=_[_0x4a46('0x2b')]({},_0x27d423,_0x3b183e[_0x4a46('0x44')]);var _0x4bd529={'where':_0x27d423[_0x4a46('0x41')]};return db['UserProfileSection']['count'](_0x4bd529)[_0x4a46('0x26')](function(_0x4aea16){_0x3d9edd[_0x4a46('0x22')]=_0x4aea16;if(_0x3b183e['query'][_0x4a46('0x45')]){_0x27d423[_0x4a46('0x46')]=[{'all':!![]}];}return db[_0x4a46('0x47')][_0x4a46('0x48')](_0x27d423);})[_0x4a46('0x26')](function(_0x5bb424){_0x3d9edd[_0x4a46('0x49')]=_0x5bb424;return _0x3d9edd;})[_0x4a46('0x26')](respondWithFilteredResult(_0x59bf2e,_0x27d423))[_0x4a46('0x4a')](handleError(_0x59bf2e,null));};exports['show']=function(_0x2ebba8,_0x4511fb){var _0x1833aa={'raw':![],'where':{'id':_0x2ebba8[_0x4a46('0x4b')]['id']}},_0x1a35d3={};_0x1a35d3[_0x4a46('0x36')]=_[_0x4a46('0x4c')](db['UserProfileSection'][_0x4a46('0x33')]);_0x1a35d3[_0x4a46('0x38')]=_[_0x4a46('0x4c')](_0x2ebba8[_0x4a46('0x38')]);_0x1a35d3[_0x4a46('0x39')]=_[_0x4a46('0x3a')](_0x1a35d3[_0x4a46('0x36')],_0x1a35d3[_0x4a46('0x38')]);_0x1833aa['attributes']=_[_0x4a46('0x3a')](_0x1a35d3[_0x4a46('0x36')],qs[_0x4a46('0x3b')](_0x2ebba8[_0x4a46('0x38')][_0x4a46('0x3b')]));_0x1833aa[_0x4a46('0x3c')]=_0x1833aa['attributes']['length']?_0x1833aa[_0x4a46('0x3c')]:_0x1a35d3[_0x4a46('0x36')];if(_0x2ebba8[_0x4a46('0x38')][_0x4a46('0x45')]){_0x1833aa[_0x4a46('0x46')]=[{'all':!![]}];}_0x1833aa=_['merge']({},_0x1833aa,_0x2ebba8[_0x4a46('0x44')]);return db[_0x4a46('0x47')][_0x4a46('0x4d')](_0x1833aa)[_0x4a46('0x26')](handleEntityNotFound(_0x4511fb,null))[_0x4a46('0x26')](respondWithResult(_0x4511fb,null))[_0x4a46('0x4a')](handleError(_0x4511fb,null));};exports[_0x4a46('0x4e')]=function(_0x4e9e87,_0x556342){return db[_0x4a46('0x47')][_0x4a46('0x4e')](_0x4e9e87[_0x4a46('0x2c')],{})[_0x4a46('0x26')](respondWithResult(_0x556342,0xc9))[_0x4a46('0x4a')](handleError(_0x556342,null));};exports['update']=function(_0x57b466,_0x4d02ff){if(_0x57b466[_0x4a46('0x2c')]['id']){delete _0x57b466[_0x4a46('0x2c')]['id'];}return db[_0x4a46('0x47')]['find']({'where':{'id':_0x57b466['params']['id']}})['then'](handleEntityNotFound(_0x4d02ff,null))['then'](saveUpdates(_0x57b466[_0x4a46('0x2c')],null))[_0x4a46('0x26')](respondWithResult(_0x4d02ff,null))[_0x4a46('0x4a')](handleError(_0x4d02ff,null));};exports[_0x4a46('0x27')]=function(_0x2d784c,_0x4857b7){return db[_0x4a46('0x47')]['find']({'where':{'id':_0x2d784c[_0x4a46('0x4b')]['id']}})[_0x4a46('0x26')](handleEntityNotFound(_0x4857b7,null))[_0x4a46('0x26')](removeEntity(_0x4857b7,null))[_0x4a46('0x4a')](handleError(_0x4857b7,null));};exports[_0x4a46('0x4f')]=function(_0x398a3a,_0x357f09){return db[_0x4a46('0x47')][_0x4a46('0x4f')]()[_0x4a46('0x26')](respondWithResult(_0x357f09,null))[_0x4a46('0x4a')](handleError(_0x357f09,null));}; \ No newline at end of file +var _0xb004=['find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','options','rows','catch','show','includeAll','include'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xb004,0x193));var _0x4b00=function(_0x1d26cd,_0x2f6559){_0x1d26cd=_0x1d26cd-0x0;var _0x5a99f8=_0xb004[_0x1d26cd];return _0x5a99f8;};'use strict';var emlformat=require(_0x4b00('0x0'));var rimraf=require(_0x4b00('0x1'));var zipdir=require(_0x4b00('0x2'));var jsonpatch=require(_0x4b00('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b00('0x4'));var util=require('util');var path=require(_0x4b00('0x5'));var sox=require(_0x4b00('0x6'));var csv=require(_0x4b00('0x7'));var ejs=require(_0x4b00('0x8'));var fs=require('fs');var fs_extra=require(_0x4b00('0x9'));var _=require('lodash');var squel=require(_0x4b00('0xa'));var crypto=require(_0x4b00('0xb'));var jsforce=require(_0x4b00('0xc'));var deskjs=require(_0x4b00('0xd'));var toCsv=require(_0x4b00('0x7'));var querystring=require(_0x4b00('0xe'));var Papa=require(_0x4b00('0xf'));var Redis=require(_0x4b00('0x10'));var authService=require(_0x4b00('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b00('0x12'))(_0x4b00('0x13'));var utils=require(_0x4b00('0x14'));var config=require(_0x4b00('0x15'));var licenseUtil=require(_0x4b00('0x16'));var db=require(_0x4b00('0x17'))['db'];function respondWithStatusCode(_0xdf0f4,_0xa4c634){_0xa4c634=_0xa4c634||0xcc;return function(_0x20546d){if(_0x20546d){return _0xdf0f4['sendStatus'](_0xa4c634);}return _0xdf0f4[_0x4b00('0x18')](_0xa4c634)[_0x4b00('0x19')]();};}function respondWithResult(_0xd53e58,_0x19e490){_0x19e490=_0x19e490||0xc8;return function(_0x43f091){if(_0x43f091){return _0xd53e58[_0x4b00('0x18')](_0x19e490)['json'](_0x43f091);}};}function respondWithFilteredResult(_0x2bb960,_0x5878b4){return function(_0x21c2d6){if(_0x21c2d6){var _0x27a8b8=typeof _0x5878b4[_0x4b00('0x1a')]===_0x4b00('0x1b')&&typeof _0x5878b4[_0x4b00('0x1c')]==='undefined';var _0x1699cc=_0x21c2d6['count'];var _0x3df96f=_0x27a8b8?0x0:_0x5878b4[_0x4b00('0x1a')];var _0x2015bd=_0x27a8b8?_0x21c2d6[_0x4b00('0x1d')]:_0x5878b4[_0x4b00('0x1a')]+_0x5878b4[_0x4b00('0x1c')];var _0x3d8ae4;if(_0x2015bd>=_0x1699cc){_0x2015bd=_0x1699cc;_0x3d8ae4=0xc8;}else{_0x3d8ae4=0xce;}_0x2bb960[_0x4b00('0x18')](_0x3d8ae4);return _0x2bb960[_0x4b00('0x1e')](_0x4b00('0x1f'),_0x3df96f+'-'+_0x2015bd+'/'+_0x1699cc)[_0x4b00('0x20')](_0x21c2d6);}return null;};}function patchUpdates(_0x4edc8a){return function(_0x1d8e99){try{jsonpatch[_0x4b00('0x21')](_0x1d8e99,_0x4edc8a,!![]);}catch(_0x19324c){return BPromise['reject'](_0x19324c);}return _0x1d8e99[_0x4b00('0x22')]();};}function saveUpdates(_0x5b3504,_0x57d226){return function(_0x2f6cd4){if(_0x2f6cd4){return _0x2f6cd4[_0x4b00('0x23')](_0x5b3504)[_0x4b00('0x24')](function(_0x3839d7){return _0x3839d7;});}return null;};}function removeEntity(_0x15648e,_0x16d4a1){return function(_0xf24503){if(_0xf24503){return _0xf24503[_0x4b00('0x25')]()['then'](function(){_0x15648e[_0x4b00('0x18')](0xcc)[_0x4b00('0x19')]();});}};}function handleEntityNotFound(_0x2395d1,_0x38be09){return function(_0x336a34){if(!_0x336a34){_0x2395d1[_0x4b00('0x26')](0x194);}return _0x336a34;};}function handleError(_0x323f9a,_0xf718eb){_0xf718eb=_0xf718eb||0x1f4;return function(_0x2f4c3b){logger[_0x4b00('0x27')](_0x2f4c3b[_0x4b00('0x28')]);if(_0x2f4c3b[_0x4b00('0x29')]){delete _0x2f4c3b[_0x4b00('0x29')];}_0x323f9a[_0x4b00('0x18')](_0xf718eb)[_0x4b00('0x2a')](_0x2f4c3b);};}function getMustacheRender(_0x5c0bc2,_0xda9557){return Mustache[_0x4b00('0x2b')](_0x5c0bc2,_[_0x4b00('0x2c')](_0xda9557[_0x4b00('0x2d')],{'contact':_0xda9557[_0x4b00('0x2e')],'message':_0xda9557[_0x4b00('0x2f')],'agent':_0xda9557[_0x4b00('0x30')],'interaction':_0xda9557[_0x4b00('0x31')],'account':_0xda9557[_0x4b00('0x32')]}))||'';}exports[_0x4b00('0x33')]=function(_0x5d2a5d,_0x175af9){var _0x121ecc={},_0xb1af8f={},_0x2bb8ac={'count':0x0,'rows':[]};var _0xf5c1c1=_[_0x4b00('0x34')](db[_0x4b00('0x35')][_0x4b00('0x36')],function(_0x2a4121){return{'name':_0x2a4121[_0x4b00('0x37')],'type':_0x2a4121[_0x4b00('0x38')][_0x4b00('0x39')]};});_0xb1af8f[_0x4b00('0x3a')]=_['map'](_0xf5c1c1,_0x4b00('0x29'));_0xb1af8f[_0x4b00('0x3b')]=_[_0x4b00('0x3c')](_0x5d2a5d[_0x4b00('0x3b')]);_0xb1af8f[_0x4b00('0x3d')]=_[_0x4b00('0x3e')](_0xb1af8f['model'],_0xb1af8f[_0x4b00('0x3b')]);_0x121ecc['attributes']=_[_0x4b00('0x3e')](_0xb1af8f[_0x4b00('0x3a')],qs[_0x4b00('0x3f')](_0x5d2a5d[_0x4b00('0x3b')]['fields']));_0x121ecc[_0x4b00('0x40')]=_0x121ecc[_0x4b00('0x40')]['length']?_0x121ecc[_0x4b00('0x40')]:_0xb1af8f['model'];if(!_0x5d2a5d[_0x4b00('0x3b')][_0x4b00('0x41')](_0x4b00('0x42'))){_0x121ecc[_0x4b00('0x1c')]=qs[_0x4b00('0x1c')](_0x5d2a5d['query'][_0x4b00('0x1c')]);_0x121ecc[_0x4b00('0x1a')]=qs['offset'](_0x5d2a5d[_0x4b00('0x3b')][_0x4b00('0x1a')]);}_0x121ecc[_0x4b00('0x43')]=qs['sort'](_0x5d2a5d[_0x4b00('0x3b')][_0x4b00('0x44')]);_0x121ecc['where']=qs[_0x4b00('0x3d')](_[_0x4b00('0x45')](_0x5d2a5d[_0x4b00('0x3b')],_0xb1af8f[_0x4b00('0x3d')]),_0xf5c1c1);if(_0x5d2a5d[_0x4b00('0x3b')]['filter']){_0x121ecc[_0x4b00('0x46')]=_[_0x4b00('0x2c')](_0x121ecc[_0x4b00('0x46')],{'$or':_[_0x4b00('0x34')](_0xf5c1c1,function(_0x3bedd1){if(_0x3bedd1[_0x4b00('0x38')]!=='VIRTUAL'){var _0x12783b={};_0x12783b[_0x3bedd1[_0x4b00('0x29')]]={'$like':'%'+_0x5d2a5d[_0x4b00('0x3b')]['filter']+'%'};return _0x12783b;}})});}_0x121ecc=_[_0x4b00('0x2c')]({},_0x121ecc,_0x5d2a5d[_0x4b00('0x47')]);var _0x2e6e11={'where':_0x121ecc[_0x4b00('0x46')]};return db['UserProfileSection']['count'](_0x2e6e11)[_0x4b00('0x24')](function(_0x4dac59){_0x2bb8ac[_0x4b00('0x1d')]=_0x4dac59;if(_0x5d2a5d[_0x4b00('0x3b')]['includeAll']){_0x121ecc['include']=[{'all':!![]}];}return db[_0x4b00('0x35')]['findAll'](_0x121ecc);})[_0x4b00('0x24')](function(_0x42c37c){_0x2bb8ac[_0x4b00('0x48')]=_0x42c37c;return _0x2bb8ac;})['then'](respondWithFilteredResult(_0x175af9,_0x121ecc))[_0x4b00('0x49')](handleError(_0x175af9,null));};exports[_0x4b00('0x4a')]=function(_0x251fcb,_0x5e0cd7){var _0x36cd5f={'raw':![],'where':{'id':_0x251fcb['params']['id']}},_0x3ab2eb={};_0x3ab2eb[_0x4b00('0x3a')]=_[_0x4b00('0x3c')](db[_0x4b00('0x35')]['rawAttributes']);_0x3ab2eb['query']=_[_0x4b00('0x3c')](_0x251fcb[_0x4b00('0x3b')]);_0x3ab2eb['filters']=_[_0x4b00('0x3e')](_0x3ab2eb[_0x4b00('0x3a')],_0x3ab2eb[_0x4b00('0x3b')]);_0x36cd5f['attributes']=_['intersection'](_0x3ab2eb['model'],qs[_0x4b00('0x3f')](_0x251fcb['query'][_0x4b00('0x3f')]));_0x36cd5f[_0x4b00('0x40')]=_0x36cd5f['attributes']['length']?_0x36cd5f[_0x4b00('0x40')]:_0x3ab2eb['model'];if(_0x251fcb[_0x4b00('0x3b')][_0x4b00('0x4b')]){_0x36cd5f[_0x4b00('0x4c')]=[{'all':!![]}];}_0x36cd5f=_[_0x4b00('0x2c')]({},_0x36cd5f,_0x251fcb[_0x4b00('0x47')]);return db['UserProfileSection'][_0x4b00('0x4d')](_0x36cd5f)[_0x4b00('0x24')](handleEntityNotFound(_0x5e0cd7,null))[_0x4b00('0x24')](respondWithResult(_0x5e0cd7,null))[_0x4b00('0x49')](handleError(_0x5e0cd7,null));};exports['create']=function(_0x3ea0c9,_0x4498c3){return db[_0x4b00('0x35')]['create'](_0x3ea0c9['body'],{})['then'](respondWithResult(_0x4498c3,0xc9))['catch'](handleError(_0x4498c3,null));};exports[_0x4b00('0x23')]=function(_0xd241a6,_0x5137ce){if(_0xd241a6[_0x4b00('0x2d')]['id']){delete _0xd241a6[_0x4b00('0x2d')]['id'];}return db[_0x4b00('0x35')]['find']({'where':{'id':_0xd241a6[_0x4b00('0x4e')]['id']}})[_0x4b00('0x24')](handleEntityNotFound(_0x5137ce,null))[_0x4b00('0x24')](saveUpdates(_0xd241a6[_0x4b00('0x2d')],null))[_0x4b00('0x24')](respondWithResult(_0x5137ce,null))['catch'](handleError(_0x5137ce,null));};exports[_0x4b00('0x25')]=function(_0xe8aa15,_0x1f0e1e){return db['UserProfileSection'][_0x4b00('0x4d')]({'where':{'id':_0xe8aa15[_0x4b00('0x4e')]['id']}})[_0x4b00('0x24')](handleEntityNotFound(_0x1f0e1e,null))['then'](removeEntity(_0x1f0e1e,null))[_0x4b00('0x49')](handleError(_0x1f0e1e,null));};exports[_0x4b00('0x4f')]=function(_0x169a36,_0x150525){return db['UserProfileSection'][_0x4b00('0x4f')]()[_0x4b00('0x24')](respondWithResult(_0x150525,null))['catch'](handleError(_0x150525,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 4cc330d..4b78c0e 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0xe5b5[_0x7d62cb];return _0x3a6266;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[{'name':_0x5e5b('0xf'),'fields':[_0x5e5b('0x10'),_0x5e5b('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd433=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12cba8,_0x4874df){var _0x2d350d=function(_0x188e50){while(--_0x188e50){_0x12cba8['push'](_0x12cba8['shift']());}};_0x2d350d(++_0x4874df);}(_0xd433,0x1c8));var _0x3d43=function(_0x6dc4bc,_0x46dd31){_0x6dc4bc=_0x6dc4bc-0x0;var _0x27c29f=_0xd433[_0x6dc4bc];return _0x27c29f;};'use strict';var _=require(_0x3d43('0x0'));var util=require(_0x3d43('0x1'));var logger=require('../../config/logger')(_0x3d43('0x2'));var moment=require(_0x3d43('0x3'));var BPromise=require(_0x3d43('0x4'));var rp=require(_0x3d43('0x5'));var fs=require('fs');var path=require(_0x3d43('0x6'));var rimraf=require(_0x3d43('0x7'));var config=require(_0x3d43('0x8'));var attributes=require(_0x3d43('0x9'));module[_0x3d43('0xa')]=function(_0x17cbda,_0x4f90fd){return _0x17cbda[_0x3d43('0xb')](_0x3d43('0xc'),attributes,{'tableName':_0x3d43('0xd'),'paranoid':![],'indexes':[{'name':_0x3d43('0xe'),'fields':['sectionId',_0x3d43('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e0db765..0b0e745 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ee9=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x2f7c40,_0xb36203){var _0x57a4a5=function(_0x47db35){while(--_0x47db35){_0x2f7c40['push'](_0x2f7c40['shift']());}};_0x57a4a5(++_0xb36203);}(_0x2ee9,0x78));var _0x92ee=function(_0x183e16,_0x20e28e){_0x183e16=_0x183e16-0x0;var _0x497e20=_0x2ee9[_0x183e16];return _0x497e20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x92ee('0x0'));var BPromise=require(_0x92ee('0x1'));var rs=require(_0x92ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x92ee('0x4'))(_0x92ee('0x5'));var config=require(_0x92ee('0x6'));var jayson=require(_0x92ee('0x7'));var client=jayson[_0x92ee('0x8')][_0x92ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x161437,_0x33c246,_0x9b0f3){return new BPromise(function(_0x51e44f,_0x1a442d){return client[_0x92ee('0xa')](_0x161437,_0x9b0f3)[_0x92ee('0xb')](function(_0xf7ca9a){logger[_0x92ee('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x33c246,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x33c246,_0x92ee('0xd'),JSON[_0x92ee('0xe')](_0xf7ca9a));if(_0xf7ca9a[_0x92ee('0xf')]){if(_0xf7ca9a[_0x92ee('0xf')][_0x92ee('0x10')]===0x1f4){logger[_0x92ee('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x33c246,_0xf7ca9a['error'][_0x92ee('0x11')]);return _0x1a442d(_0xf7ca9a[_0x92ee('0xf')][_0x92ee('0x11')]);}logger[_0x92ee('0xf')](_0x92ee('0x12'),_0x33c246,_0xf7ca9a[_0x92ee('0xf')][_0x92ee('0x11')]);return _0x51e44f(_0xf7ca9a[_0x92ee('0xf')]['message']);}else{logger[_0x92ee('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x33c246,_0x92ee('0xd'));_0x51e44f(_0xf7ca9a[_0x92ee('0x13')]['message']);}})[_0x92ee('0x14')](function(_0x77ab09){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x33c246,_0x77ab09);_0x1a442d(_0x77ab09);});});} \ No newline at end of file +var _0x0ec6=['client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x9e867,_0x4f286a){var _0x2b36a3=function(_0x701f58){while(--_0x701f58){_0x9e867['push'](_0x9e867['shift']());}};_0x2b36a3(++_0x4f286a);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x144c85,_0x2be240){_0x144c85=_0x144c85-0x0;var _0x40f783=_0x0ec6[_0x144c85];return _0x40f783;};'use strict';var _=require(_0x60ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x60ec('0x1'));var rs=require(_0x60ec('0x2'));var fs=require('fs');var Redis=require(_0x60ec('0x3'));var db=require(_0x60ec('0x4'))['db'];var utils=require(_0x60ec('0x5'));var logger=require(_0x60ec('0x6'))(_0x60ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x60ec('0x8'));var client=jayson[_0x60ec('0x9')][_0x60ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x74adc4,_0x5d4cba,_0xcb974c){return new BPromise(function(_0x488ab8,_0x2c4a14){return client[_0x60ec('0xb')](_0x74adc4,_0xcb974c)[_0x60ec('0xc')](function(_0x1363c2){logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,'request\x20sent');logger['debug'](_0x60ec('0xf'),_0x5d4cba,_0x60ec('0x10'),JSON[_0x60ec('0x11')](_0x1363c2));if(_0x1363c2[_0x60ec('0x12')]){if(_0x1363c2[_0x60ec('0x12')]['code']===0x1f4){logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x2c4a14(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}logger['error'](_0x60ec('0xe'),_0x5d4cba,_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);return _0x488ab8(_0x1363c2[_0x60ec('0x12')][_0x60ec('0x13')]);}else{logger[_0x60ec('0xd')](_0x60ec('0xe'),_0x5d4cba,_0x60ec('0x10'));_0x488ab8(_0x1363c2[_0x60ec('0x14')]['message']);}})[_0x60ec('0x15')](function(_0x2778dd){logger[_0x60ec('0x12')](_0x60ec('0xe'),_0x5d4cba,_0x2778dd);_0x2c4a14(_0x2778dd);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2c58fad..5487471 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefe3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','multer'];(function(_0x2a8c9d,_0x2193da){var _0x29fbc0=function(_0x4b410f){while(--_0x4b410f){_0x2a8c9d['push'](_0x2a8c9d['shift']());}};_0x29fbc0(++_0x2193da);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3efe('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3efe('0x1'));var router=express[_0x3efe('0x2')]();var fs_extra=require(_0x3efe('0x3'));var auth=require(_0x3efe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3efe('0x5'));module['exports']=router; \ No newline at end of file +var _0xa887=['../../config/environment','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5c4960,_0x51ba77){var _0x2914b4=function(_0x2aad5b){while(--_0x2aad5b){_0x5c4960['push'](_0x5c4960['shift']());}};_0x2914b4(++_0x51ba77);}(_0xa887,0x89));var _0x7a88=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa887[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x7a88('0x0'));var util=require('util');var path=require(_0x7a88('0x1'));var timeout=require(_0x7a88('0x2'));var express=require('express');var router=express[_0x7a88('0x3')]();var fs_extra=require(_0x7a88('0x4'));var auth=require(_0x7a88('0x5'));var interaction=require(_0x7a88('0x6'));var config=require(_0x7a88('0x7'));module[_0x7a88('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a2c128e..33e81ff 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x4ae459,_0x3bf329){var _0x51d0c9=function(_0x1ce66b){while(--_0x1ce66b){_0x4ae459['push'](_0x4ae459['shift']());}};_0x51d0c9(++_0x3bf329);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x22d48c,_0x50bbba){var _0x2a4d58=function(_0x27defd){while(--_0x27defd){_0x22d48c['push'](_0x22d48c['shift']());}};_0x2a4d58(++_0x50bbba);}(_0xe706,0xa3));var _0x6e70=function(_0x2e8860,_0x5de6db){_0x2e8860=_0x2e8860-0x0;var _0x449410=_0xe706[_0x2e8860];return _0x449410;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b99871f..eca4eb9 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d88=['define','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x590f85,_0x75df3d){var _0x407f13=function(_0x205100){while(--_0x205100){_0x590f85['push'](_0x590f85['shift']());}};_0x407f13(++_0x75df3d);}(_0x2d88,0x116));var _0x82d8=function(_0x5ddda9,_0x43e558){_0x5ddda9=_0x5ddda9-0x0;var _0x53a004=_0x2d88[_0x5ddda9];return _0x53a004;};'use strict';var _=require(_0x82d8('0x0'));var util=require('util');var logger=require(_0x82d8('0x1'))(_0x82d8('0x2'));var moment=require(_0x82d8('0x3'));var BPromise=require(_0x82d8('0x4'));var rp=require(_0x82d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82d8('0x6'));var config=require(_0x82d8('0x7'));var attributes=require(_0x82d8('0x8'));module[_0x82d8('0x9')]=function(_0x151c24,_0x395d85){return _0x151c24[_0x82d8('0xa')]('UserSmsQueue',attributes,{'tableName':_0x82d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eb2=['moment','request-promise','rimraf','./userSmsQueue.attributes','exports','define','lodash','util','api'];(function(_0xe87e7f,_0x168854){var _0x28065a=function(_0x30dfc4){while(--_0x30dfc4){_0xe87e7f['push'](_0xe87e7f['shift']());}};_0x28065a(++_0x168854);}(_0x5eb2,0xf0));var _0x25eb=function(_0xcee193,_0x319b69){_0xcee193=_0xcee193-0x0;var _0x51c4be=_0x5eb2[_0xcee193];return _0x51c4be;};'use strict';var _=require(_0x25eb('0x0'));var util=require(_0x25eb('0x1'));var logger=require('../../config/logger')(_0x25eb('0x2'));var moment=require(_0x25eb('0x3'));var BPromise=require('bluebird');var rp=require(_0x25eb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25eb('0x5'));var config=require('../../config/environment');var attributes=require(_0x25eb('0x6'));module[_0x25eb('0x7')]=function(_0x4ba5f6,_0x26293b){return _0x4ba5f6[_0x25eb('0x8')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 27b82c1..5b0d0b4 100644 --- a/server/api/userSmsQueue/userSmsQueue.rpc.js +++ b/server/api/userSmsQueue/userSmsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e12=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x62507b,_0x49420b){var _0x3c5574=function(_0x43780f){while(--_0x43780f){_0x62507b['push'](_0x62507b['shift']());}};_0x3c5574(++_0x49420b);}(_0x4e12,0x129));var _0x24e1=function(_0x48caf5,_0x56b3b9){_0x48caf5=_0x48caf5-0x0;var _0x4169a5=_0x4e12[_0x48caf5];return _0x4169a5;};'use strict';var _=require('lodash');var util=require(_0x24e1('0x0'));var moment=require(_0x24e1('0x1'));var BPromise=require(_0x24e1('0x2'));var rs=require(_0x24e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24e1('0x4'))['db'];var utils=require(_0x24e1('0x5'));var logger=require(_0x24e1('0x6'))(_0x24e1('0x7'));var config=require(_0x24e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24e1('0x9')][_0x24e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35e339,_0x30eb69,_0x28ae35){return new BPromise(function(_0x271301,_0x29ec73){return client[_0x24e1('0xb')](_0x35e339,_0x28ae35)[_0x24e1('0xc')](function(_0x4f18ae){logger[_0x24e1('0xd')](_0x24e1('0xe'),_0x30eb69,_0x24e1('0xf'));logger[_0x24e1('0x10')](_0x24e1('0x11'),_0x30eb69,'request\x20sent',JSON[_0x24e1('0x12')](_0x4f18ae));if(_0x4f18ae[_0x24e1('0x13')]){if(_0x4f18ae[_0x24e1('0x13')][_0x24e1('0x14')]===0x1f4){logger[_0x24e1('0x13')](_0x24e1('0xe'),_0x30eb69,_0x4f18ae['error']['message']);return _0x29ec73(_0x4f18ae['error'][_0x24e1('0x15')]);}logger[_0x24e1('0x13')](_0x24e1('0xe'),_0x30eb69,_0x4f18ae[_0x24e1('0x13')][_0x24e1('0x15')]);return _0x271301(_0x4f18ae['error'][_0x24e1('0x15')]);}else{logger[_0x24e1('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x30eb69,_0x24e1('0xf'));_0x271301(_0x4f18ae['result']['message']);}})[_0x24e1('0x16')](function(_0x490f78){logger[_0x24e1('0x13')](_0x24e1('0xe'),_0x30eb69,_0x490f78);_0x29ec73(_0x490f78);});});} \ No newline at end of file +var _0x145d=['http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0xd26ade,_0x5a4378){var _0x5a6957=function(_0x28a9bd){while(--_0x28a9bd){_0xd26ade['push'](_0xd26ade['shift']());}};_0x5a6957(++_0x5a4378);}(_0x145d,0xc9));var _0xd145=function(_0x1cea7e,_0x4e9be8){_0x1cea7e=_0x1cea7e-0x0;var _0xdb85fa=_0x145d[_0x1cea7e];return _0xdb85fa;};'use strict';var _=require(_0xd145('0x0'));var util=require(_0xd145('0x1'));var moment=require(_0xd145('0x2'));var BPromise=require(_0xd145('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd145('0x4'))['db'];var utils=require(_0xd145('0x5'));var logger=require('../../config/logger')(_0xd145('0x6'));var config=require('../../config/environment');var jayson=require(_0xd145('0x7'));var client=jayson[_0xd145('0x8')][_0xd145('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x190bdf,_0xd54480,_0x495748){return new BPromise(function(_0x367475,_0x506eef){return client['request'](_0x190bdf,_0x495748)[_0xd145('0xa')](function(_0x11b8bd){logger[_0xd145('0xb')](_0xd145('0xc'),_0xd54480,_0xd145('0xd'));logger[_0xd145('0xe')](_0xd145('0xf'),_0xd54480,_0xd145('0xd'),JSON['stringify'](_0x11b8bd));if(_0x11b8bd['error']){if(_0x11b8bd['error'][_0xd145('0x10')]===0x1f4){logger[_0xd145('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0xd54480,_0x11b8bd[_0xd145('0x11')][_0xd145('0x12')]);return _0x506eef(_0x11b8bd[_0xd145('0x11')][_0xd145('0x12')]);}logger['error'](_0xd145('0xc'),_0xd54480,_0x11b8bd['error'][_0xd145('0x12')]);return _0x367475(_0x11b8bd['error'][_0xd145('0x12')]);}else{logger[_0xd145('0xb')](_0xd145('0xc'),_0xd54480,_0xd145('0xd'));_0x367475(_0x11b8bd[_0xd145('0x13')][_0xd145('0x12')]);}})[_0xd145('0x14')](function(_0x4a0e2e){logger['error'](_0xd145('0xc'),_0xd54480,_0x4a0e2e);_0x506eef(_0x4a0e2e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index bcde1b4..01f9fa6 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1399=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x169be2,_0x478d76){var _0x12e475=function(_0x2de996){while(--_0x2de996){_0x169be2['push'](_0x169be2['shift']());}};_0x12e475(++_0x478d76);}(_0x1399,0x16c));var _0x9139=function(_0x1f43f4,_0x16d500){_0x1f43f4=_0x1f43f4-0x0;var _0x5435b7=_0x1399[_0x1f43f4];return _0x5435b7;};'use strict';var multer=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var path=require('path');var timeout=require(_0x9139('0x2'));var express=require('express');var router=express[_0x9139('0x3')]();var fs_extra=require(_0x9139('0x4'));var auth=require(_0x9139('0x5'));var interaction=require(_0x9139('0x6'));var config=require(_0x9139('0x7'));module[_0x9139('0x8')]=router; \ No newline at end of file +var _0x85d3=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x85d3,0xc8));var _0x385d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x85d3[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x385d('0x2'));var router=express[_0x385d('0x3')]();var fs_extra=require(_0x385d('0x4'));var auth=require(_0x385d('0x5'));var interaction=require(_0x385d('0x6'));var config=require(_0x385d('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 207b08a..5b0a5dd 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0xb7386a,_0x29c5ad){var _0x3344e4=function(_0x391d2d){while(--_0x391d2d){_0xb7386a['push'](_0xb7386a['shift']());}};_0x3344e4(++_0x29c5ad);}(_0xe706,0xa3));var _0x6e70=function(_0x1704d5,_0x1f1740){_0x1704d5=_0x1704d5-0x0;var _0x58b71d=_0xe706[_0x1704d5];return _0x58b71d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x387e67,_0x351681){var _0x3fc3ca=function(_0x14d6c4){while(--_0x14d6c4){_0x387e67['push'](_0x387e67['shift']());}};_0x3fc3ca(++_0x351681);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index b95c455..75269ca 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.model.js +++ b/server/api/userVoiceQueue/userVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf006=['bluebird','path','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','../../config/logger','api'];(function(_0x7f6cdf,_0x715e63){var _0x2ddd9c=function(_0x35c901){while(--_0x35c901){_0x7f6cdf['push'](_0x7f6cdf['shift']());}};_0x2ddd9c(++_0x715e63);}(_0xf006,0x146));var _0x6f00=function(_0x2d3420,_0x11202b){_0x2d3420=_0x2d3420-0x0;var _0x2a5377=_0xf006[_0x2d3420];return _0x2a5377;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('UserVoiceQueue',attributes,{'tableName':_0x6f00('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x207c=['api','moment','bluebird','request-promise','path','../../config/environment','define','UserVoiceQueue','util','../../config/logger'];(function(_0x2579e1,_0x4fa603){var _0x4b7c10=function(_0x1fa898){while(--_0x1fa898){_0x2579e1['push'](_0x2579e1['shift']());}};_0x4b7c10(++_0x4fa603);}(_0x207c,0x1e8));var _0xc207=function(_0x3327e2,_0x251554){_0x3327e2=_0x3327e2-0x0;var _0x59fb5c=_0x207c[_0x3327e2];return _0x59fb5c;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var BPromise=require(_0xc207('0x4'));var rp=require(_0xc207('0x5'));var fs=require('fs');var path=require(_0xc207('0x6'));var rimraf=require('rimraf');var config=require(_0xc207('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x55023e,_0xc88789){return _0x55023e[_0xc207('0x8')](_0xc207('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 05adb02..977cda7 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.rpc.js +++ b/server/api/userVoiceQueue/userVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54e2=['debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xc397d5,_0x166972){var _0x258729=function(_0x211494){while(--_0x211494){_0xc397d5['push'](_0xc397d5['shift']());}};_0x258729(++_0x166972);}(_0x54e2,0x192));var _0x254e=function(_0x5e8455,_0x41b383){_0x5e8455=_0x5e8455-0x0;var _0x2f8957=_0x54e2[_0x5e8455];return _0x2f8957;};'use strict';var _=require(_0x254e('0x0'));var util=require(_0x254e('0x1'));var moment=require(_0x254e('0x2'));var BPromise=require(_0x254e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x254e('0x4'));var db=require(_0x254e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x254e('0x6'))(_0x254e('0x7'));var config=require(_0x254e('0x8'));var jayson=require(_0x254e('0x9'));var client=jayson[_0x254e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x361dcb,_0x3e44b5,_0x340cf2){return new BPromise(function(_0x32e44e,_0x4e1900){return client[_0x254e('0xb')](_0x361dcb,_0x340cf2)[_0x254e('0xc')](function(_0x1d9624){logger[_0x254e('0xd')](_0x254e('0xe'),_0x3e44b5,_0x254e('0xf'));logger[_0x254e('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3e44b5,_0x254e('0xf'),JSON[_0x254e('0x11')](_0x1d9624));if(_0x1d9624['error']){if(_0x1d9624[_0x254e('0x12')][_0x254e('0x13')]===0x1f4){logger[_0x254e('0x12')](_0x254e('0xe'),_0x3e44b5,_0x1d9624[_0x254e('0x12')][_0x254e('0x14')]);return _0x4e1900(_0x1d9624[_0x254e('0x12')][_0x254e('0x14')]);}logger[_0x254e('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x3e44b5,_0x1d9624[_0x254e('0x12')]['message']);return _0x32e44e(_0x1d9624[_0x254e('0x12')][_0x254e('0x14')]);}else{logger[_0x254e('0xd')](_0x254e('0xe'),_0x3e44b5,_0x254e('0xf'));_0x32e44e(_0x1d9624[_0x254e('0x15')][_0x254e('0x14')]);}})['catch'](function(_0x216210){logger[_0x254e('0x12')](_0x254e('0xe'),_0x3e44b5,_0x216210);_0x4e1900(_0x216210);});});} \ No newline at end of file +var _0xa330=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa330,0xc5));var _0x0a33=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xa330[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0x0a33('0x0'));var moment=require(_0x0a33('0x1'));var BPromise=require(_0x0a33('0x2'));var rs=require(_0x0a33('0x3'));var fs=require('fs');var Redis=require(_0x0a33('0x4'));var db=require(_0x0a33('0x5'))['db'];var utils=require(_0x0a33('0x6'));var logger=require(_0x0a33('0x7'))(_0x0a33('0x8'));var config=require(_0x0a33('0x9'));var jayson=require(_0x0a33('0xa'));var client=jayson[_0x0a33('0xb')][_0x0a33('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14ee1f,_0x538270,_0x268af3){return new BPromise(function(_0x13417f,_0x724fdd){return client[_0x0a33('0xd')](_0x14ee1f,_0x268af3)[_0x0a33('0xe')](function(_0x4279c7){logger[_0x0a33('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x538270,'request\x20sent');logger[_0x0a33('0x10')](_0x0a33('0x11'),_0x538270,'request\x20sent',JSON[_0x0a33('0x12')](_0x4279c7));if(_0x4279c7[_0x0a33('0x13')]){if(_0x4279c7['error']['code']===0x1f4){logger[_0x0a33('0x13')](_0x0a33('0x14'),_0x538270,_0x4279c7['error'][_0x0a33('0x15')]);return _0x724fdd(_0x4279c7[_0x0a33('0x13')][_0x0a33('0x15')]);}logger[_0x0a33('0x13')](_0x0a33('0x14'),_0x538270,_0x4279c7[_0x0a33('0x13')]['message']);return _0x13417f(_0x4279c7['error']['message']);}else{logger[_0x0a33('0xf')](_0x0a33('0x14'),_0x538270,_0x0a33('0x16'));_0x13417f(_0x4279c7[_0x0a33('0x17')][_0x0a33('0x15')]);}})[_0x0a33('0x18')](function(_0x504144){logger[_0x0a33('0x13')](_0x0a33('0x14'),_0x538270,_0x504144);_0x724fdd(_0x504144);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a26898b..15ae665 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd61e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x158b55,_0x516baf){var _0x1cee23=function(_0xb7240){while(--_0xb7240){_0x158b55['push'](_0x158b55['shift']());}};_0x1cee23(++_0x516baf);}(_0xd61e,0x13d));var _0xed61=function(_0x2d8907,_0x507fe8){_0x2d8907=_0x2d8907-0x0;var _0x5f5587=_0xd61e[_0x2d8907];return _0x5f5587;};'use strict';var multer=require(_0xed61('0x0'));var util=require(_0xed61('0x1'));var path=require(_0xed61('0x2'));var timeout=require(_0xed61('0x3'));var express=require(_0xed61('0x4'));var router=express[_0xed61('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xed61('0x6'));var interaction=require(_0xed61('0x7'));var config=require(_0xed61('0x8'));module[_0xed61('0x9')]=router; \ No newline at end of file +var _0x6075=['connect-timeout','express','../../components/auth/service','exports','multer','util'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x6075,0x142));var _0x5607=function(_0x3f0f00,_0x3171e0){_0x3f0f00=_0x3f0f00-0x0;var _0xabc616=_0x6075[_0x3f0f00];return _0xabc616;};'use strict';var multer=require(_0x5607('0x0'));var util=require(_0x5607('0x1'));var path=require('path');var timeout=require(_0x5607('0x2'));var express=require(_0x5607('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5607('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x5607('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8e12fa0..ad77058 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96bf=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2d8864,_0x34171a){var _0x435a6a=function(_0x3deecd){while(--_0x3deecd){_0x2d8864['push'](_0x2d8864['shift']());}};_0x435a6a(++_0x34171a);}(_0x96bf,0x74));var _0xf96b=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x96bf[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0xf96b('0x0'));module[_0xf96b('0x1')]={'uniqueid':{'type':Sequelize[_0xf96b('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf96b('0x3')},'membername':{'type':Sequelize[_0xf96b('0x4')],'allowNull':![],'comment':_0xf96b('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf96b('0x4')],'allowNull':![],'unique':_0xf96b('0x5'),'comment':_0xf96b('0x3')},'VoiceQueueId':{'type':Sequelize[_0xf96b('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf96b('0x4')],'allowNull':![],'unique':_0xf96b('0x5'),'comment':_0xf96b('0x3')},'penalty':{'type':Sequelize[_0xf96b('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xb65d=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x10d07b,_0x3b4820){var _0x3e362d=function(_0x38c806){while(--_0x38c806){_0x10d07b['push'](_0x10d07b['shift']());}};_0x3e362d(++_0x3b4820);}(_0xb65d,0x10f));var _0xdb65=function(_0x1d0baf,_0x9a3561){_0x1d0baf=_0x1d0baf-0x0;var _0x3aa270=_0xb65d[_0x1d0baf];return _0x3aa270;};'use strict';var Sequelize=require(_0xdb65('0x0'));module[_0xdb65('0x1')]={'uniqueid':{'type':Sequelize[_0xdb65('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xdb65('0x3')},'membername':{'type':Sequelize[_0xdb65('0x4')],'allowNull':![],'comment':_0xdb65('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xdb65('0x4')],'allowNull':![],'unique':_0xdb65('0x5'),'comment':_0xdb65('0x3')},'VoiceQueueId':{'type':Sequelize[_0xdb65('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xdb65('0x4')],'allowNull':![],'unique':_0xdb65('0x5'),'comment':_0xdb65('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xdb65('0x3')},'paused':{'type':Sequelize[_0xdb65('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 3c9841a..8571e5b 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x606e=['save','update','remove','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0xc95c08,_0x5ed3e3){var _0xac63e9=function(_0x3289ef){while(--_0x3289ef){_0xc95c08['push'](_0xc95c08['shift']());}};_0xac63e9(++_0x5ed3e3);}(_0x606e,0x75));var _0xe606=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0x606e[_0x5b8310];return _0xd3ebc1;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe606('0x0'))['db'][_0xe606('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe606('0x2')](0x0);var events={'afterCreate':_0xe606('0x3'),'afterUpdate':_0xe606('0x4'),'afterDestroy':_0xe606('0x5')};function emitEvent(_0x37886e){return function(_0x1faf2f,_0x5b7ef2,_0x147f36){UserVoiceQueueRtEvents['emit'](_0x37886e+':'+_0x1faf2f['id'],_0x1faf2f);UserVoiceQueueRtEvents['emit'](_0x37886e,_0x1faf2f);_0x147f36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe606('0x6')](e,emitEvent(event));}}module[_0xe606('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7e36=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x475e1b,_0x2e871a){var _0x137d45=function(_0x3de411){while(--_0x3de411){_0x475e1b['push'](_0x475e1b['shift']());}};_0x137d45(++_0x2e871a);}(_0x7e36,0xbd));var _0x67e3=function(_0x34e14d,_0x5dea39){_0x34e14d=_0x34e14d-0x0;var _0x3d8e08=_0x7e36[_0x34e14d];return _0x3d8e08;};'use strict';var EventEmitter=require(_0x67e3('0x0'));var UserVoiceQueueRt=require(_0x67e3('0x1'))['db'][_0x67e3('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x67e3('0x3')](0x0);var events={'afterCreate':_0x67e3('0x4'),'afterUpdate':_0x67e3('0x5'),'afterDestroy':_0x67e3('0x6')};function emitEvent(_0x14c125){return function(_0xac4a8e,_0x208b47,_0x39b2f0){UserVoiceQueueRtEvents['emit'](_0x14c125+':'+_0xac4a8e['id'],_0xac4a8e);UserVoiceQueueRtEvents[_0x67e3('0x7')](_0x14c125,_0xac4a8e);_0x39b2f0(null);};}for(var e in events){if(events[_0x67e3('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x67e3('0x9')](e,emitEvent(event));}}module[_0x67e3('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index cdf43c7..5fa7377 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc88c=['../../config/logger','api','path','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0xa08526,_0xd2a376){var _0x2684eb=function(_0x2bfe3a){while(--_0x2bfe3a){_0xa08526['push'](_0xa08526['shift']());}};_0x2684eb(++_0xd2a376);}(_0xc88c,0x187));var _0xcc88=function(_0x5de446,_0x2c10ee){_0x5de446=_0x5de446-0x0;var _0x3b23fd=_0xc88c[_0x5de446];return _0x3b23fd;};'use strict';var _=require(_0xcc88('0x0'));var util=require('util');var logger=require(_0xcc88('0x1'))(_0xcc88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc88('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0xcc88('0x4')]=function(_0x433714,_0x7aa967){return _0x433714[_0xcc88('0x5')](_0xcc88('0x6'),attributes,{'tableName':_0xcc88('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8034=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','../../config/logger','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8034,0x11d));var _0x4803=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8034[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4803('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4803('0x1'));var fs=require('fs');var path=require(_0x4803('0x2'));var rimraf=require(_0x4803('0x3'));var config=require(_0x4803('0x4'));var attributes=require(_0x4803('0x5'));module['exports']=function(_0x364139,_0x18c60b){return _0x364139[_0x4803('0x6')]('UserVoiceQueueRt',attributes,{'tableName':_0x4803('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index cb4267d..f548f3b 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d28=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x0d28,0xf1));var _0x80d2=function(_0x2bf5d1,_0x14e28f){_0x2bf5d1=_0x2bf5d1-0x0;var _0x3472c6=_0x0d28[_0x2bf5d1];return _0x3472c6;};'use strict';var _=require(_0x80d2('0x0'));var util=require(_0x80d2('0x1'));var moment=require(_0x80d2('0x2'));var BPromise=require('bluebird');var rs=require(_0x80d2('0x3'));var fs=require('fs');var Redis=require(_0x80d2('0x4'));var db=require(_0x80d2('0x5'))['db'];var utils=require(_0x80d2('0x6'));var logger=require(_0x80d2('0x7'))(_0x80d2('0x8'));var config=require('../../config/environment');var jayson=require(_0x80d2('0x9'));var client=jayson['client'][_0x80d2('0xa')]({'port':0x232a});config[_0x80d2('0xb')]=_[_0x80d2('0xc')](config[_0x80d2('0xb')],{'host':_0x80d2('0xd'),'port':0x18eb});var socket=require(_0x80d2('0xe'))(new Redis(config[_0x80d2('0xb')]));require('./userVoiceQueueRt.socket')[_0x80d2('0xf')](socket);function respondWithRpcPromise(_0x3b7f12,_0x2ff025,_0x34ab28){return new BPromise(function(_0x5dbd8e,_0xac95b5){return client[_0x80d2('0x10')](_0x3b7f12,_0x34ab28)[_0x80d2('0x11')](function(_0x35fbe1){logger[_0x80d2('0x12')](_0x80d2('0x13'),_0x2ff025,_0x80d2('0x14'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2ff025,_0x80d2('0x14'),JSON[_0x80d2('0x15')](_0x35fbe1));if(_0x35fbe1[_0x80d2('0x16')]){if(_0x35fbe1[_0x80d2('0x16')]['code']===0x1f4){logger[_0x80d2('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2ff025,_0x35fbe1['error']['message']);return _0xac95b5(_0x35fbe1['error'][_0x80d2('0x17')]);}logger[_0x80d2('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2ff025,_0x35fbe1['error'][_0x80d2('0x17')]);return _0x5dbd8e(_0x35fbe1['error']['message']);}else{logger[_0x80d2('0x12')](_0x80d2('0x13'),_0x2ff025,_0x80d2('0x14'));_0x5dbd8e(_0x35fbe1[_0x80d2('0x18')][_0x80d2('0x17')]);}})[_0x80d2('0x19')](function(_0x5f52b3){logger[_0x80d2('0x16')](_0x80d2('0x13'),_0x2ff025,_0x5f52b3);_0xac95b5(_0x5f52b3);});});}exports[_0x80d2('0x1a')]=function(_0x5dafd0){var _0xfe7718=this;return new Promise(function(_0x352356,_0x2cf5a1){return db['UserVoiceQueueRt'][_0x80d2('0x1b')]({'raw':_0x5dafd0[_0x80d2('0x1c')]?_0x5dafd0[_0x80d2('0x1c')][_0x80d2('0x1d')]===undefined?!![]:![]:!![],'where':_0x5dafd0['options']?_0x5dafd0['options'][_0x80d2('0x1e')]||null:null,'attributes':[[db[_0x80d2('0x1f')]['fn'](_0x80d2('0x20'),db[_0x80d2('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x80d2('0x21')))),_0x80d2('0x22')]]})['then'](function(_0x2bdd3d){logger[_0x80d2('0x12')]('GetVoiceQueueRtPauses',_0x5dafd0);logger[_0x80d2('0x23')](_0x80d2('0x1a'),_0x5dafd0,JSON[_0x80d2('0x15')](_0x2bdd3d));_0x352356(_0x2bdd3d);})[_0x80d2('0x19')](function(_0x53e934){logger[_0x80d2('0x16')](_0x80d2('0x1a'),_0x53e934[_0x80d2('0x17')],_0x5dafd0);_0x2cf5a1(_0xfe7718[_0x80d2('0x16')](0x1f4,_0x53e934[_0x80d2('0x17')]));});});}; \ No newline at end of file +var _0xdc21=['debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','info','result','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses'];(function(_0x658435,_0x23bb4b){var _0xfaeb=function(_0x221f70){while(--_0x221f70){_0x658435['push'](_0x658435['shift']());}};_0xfaeb(++_0x23bb4b);}(_0xdc21,0x7a));var _0x1dc2=function(_0x58633e,_0x1a7bfa){_0x58633e=_0x58633e-0x0;var _0x364194=_0xdc21[_0x58633e];return _0x364194;};'use strict';var _=require(_0x1dc2('0x0'));var util=require(_0x1dc2('0x1'));var moment=require(_0x1dc2('0x2'));var BPromise=require(_0x1dc2('0x3'));var rs=require(_0x1dc2('0x4'));var fs=require('fs');var Redis=require(_0x1dc2('0x5'));var db=require(_0x1dc2('0x6'))['db'];var utils=require(_0x1dc2('0x7'));var logger=require('../../config/logger')(_0x1dc2('0x8'));var config=require(_0x1dc2('0x9'));var jayson=require(_0x1dc2('0xa'));var client=jayson[_0x1dc2('0xb')][_0x1dc2('0xc')]({'port':0x232a});config[_0x1dc2('0xd')]=_[_0x1dc2('0xe')](config[_0x1dc2('0xd')],{'host':_0x1dc2('0xf'),'port':0x18eb});var socket=require(_0x1dc2('0x10'))(new Redis(config[_0x1dc2('0xd')]));require(_0x1dc2('0x11'))[_0x1dc2('0x12')](socket);function respondWithRpcPromise(_0x4e7215,_0x3361e5,_0x6b3757){return new BPromise(function(_0x578b09,_0x1c8727){return client['request'](_0x4e7215,_0x6b3757)[_0x1dc2('0x13')](function(_0x2447f8){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3361e5,_0x1dc2('0x14'));logger['debug'](_0x1dc2('0x15'),_0x3361e5,'request\x20sent',JSON[_0x1dc2('0x16')](_0x2447f8));if(_0x2447f8[_0x1dc2('0x17')]){if(_0x2447f8['error'][_0x1dc2('0x18')]===0x1f4){logger[_0x1dc2('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3361e5,_0x2447f8['error'][_0x1dc2('0x19')]);return _0x1c8727(_0x2447f8['error']['message']);}logger[_0x1dc2('0x17')](_0x1dc2('0x1a'),_0x3361e5,_0x2447f8[_0x1dc2('0x17')][_0x1dc2('0x19')]);return _0x578b09(_0x2447f8[_0x1dc2('0x17')][_0x1dc2('0x19')]);}else{logger[_0x1dc2('0x1b')](_0x1dc2('0x1a'),_0x3361e5,'request\x20sent');_0x578b09(_0x2447f8[_0x1dc2('0x1c')][_0x1dc2('0x19')]);}})['catch'](function(_0x5dfcbe){logger[_0x1dc2('0x17')](_0x1dc2('0x1a'),_0x3361e5,_0x5dfcbe);_0x1c8727(_0x5dfcbe);});});}exports['GetVoiceQueueRtPauses']=function(_0x420b50){var _0x3ed565=this;return new Promise(function(_0x182f22,_0x8a6cfd){return db[_0x1dc2('0x1d')][_0x1dc2('0x1e')]({'raw':_0x420b50[_0x1dc2('0x1f')]?_0x420b50[_0x1dc2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x420b50[_0x1dc2('0x1f')]?_0x420b50[_0x1dc2('0x1f')][_0x1dc2('0x20')]||null:null,'attributes':[[db[_0x1dc2('0x21')]['fn'](_0x1dc2('0x22'),db[_0x1dc2('0x21')]['fn']('IF',db['sequelize'][_0x1dc2('0x23')](_0x1dc2('0x24')))),'outboundQueuePauses']]})[_0x1dc2('0x13')](function(_0x57c6aa){logger[_0x1dc2('0x1b')](_0x1dc2('0x25'),_0x420b50);logger[_0x1dc2('0x26')]('GetVoiceQueueRtPauses',_0x420b50,JSON[_0x1dc2('0x16')](_0x57c6aa));_0x182f22(_0x57c6aa);})[_0x1dc2('0x27')](function(_0xd4befd){logger[_0x1dc2('0x17')](_0x1dc2('0x25'),_0xd4befd[_0x1dc2('0x19')],_0x420b50);_0x8a6cfd(_0x3ed565['error'](0x1f4,_0xd4befd[_0x1dc2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d38c1f0..a7b576c 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3d9=['update','emit','removeListener','register','length','userVoiceQueueRt:','save','remove'];(function(_0x33bf06,_0x129f28){var _0x2c6e64=function(_0x432950){while(--_0x432950){_0x33bf06['push'](_0x33bf06['shift']());}};_0x2c6e64(++_0x129f28);}(_0xd3d9,0x126));var _0x9d3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd3d9[_0x19950b];return _0x3c6b41;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x9d3d('0x0'),_0x9d3d('0x1'),_0x9d3d('0x2')];function createListener(_0x44c9af,_0x1968a7){return function(_0x3345ae){_0x1968a7[_0x9d3d('0x3')](_0x44c9af,_0x3345ae);};}function removeListener(_0x34e0ca,_0x517d40){return function(){UserVoiceQueueRtEvents[_0x9d3d('0x4')](_0x34e0ca,_0x517d40);};}exports[_0x9d3d('0x5')]=function(_0x3d5bd4){for(var _0x38702c=0x0,_0x23dc44=events[_0x9d3d('0x6')];_0x38702c<_0x23dc44;_0x38702c++){var _0x5bc3ad=events[_0x38702c];var _0x3c3f0b=createListener(_0x9d3d('0x7')+_0x5bc3ad,_0x3d5bd4);UserVoiceQueueRtEvents['on'](_0x5bc3ad,_0x3c3f0b);}}; \ No newline at end of file +var _0x00ba=['./userVoiceQueueRt.events','save','remove','update','register','userVoiceQueueRt:'];(function(_0x59668e,_0x2b736e){var _0x53e545=function(_0x36ed46){while(--_0x36ed46){_0x59668e['push'](_0x59668e['shift']());}};_0x53e545(++_0x2b736e);}(_0x00ba,0x1a4));var _0xa00b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00ba[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xa00b('0x0'));var events=[_0xa00b('0x1'),_0xa00b('0x2'),_0xa00b('0x3')];function createListener(_0x32d975,_0x13a911){return function(_0x803e70){_0x13a911['emit'](_0x32d975,_0x803e70);};}function removeListener(_0x1a3e7a,_0x1912cc){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1a3e7a,_0x1912cc);};}exports[_0xa00b('0x4')]=function(_0x477a80){for(var _0x1d95d5=0x0,_0x4d59c8=events['length'];_0x1d95d5<_0x4d59c8;_0x1d95d5++){var _0x8abcc8=events[_0x1d95d5];var _0x23686f=createListener(_0xa00b('0x5')+_0x8abcc8,_0x477a80);UserVoiceQueueRtEvents['on'](_0x8abcc8,_0x23686f);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 7e71bdb..81f4016 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d5a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports','util','path'];(function(_0x2c158b,_0x5b825d){var _0x397f2b=function(_0x363c7b){while(--_0x363c7b){_0x2c158b['push'](_0x2c158b['shift']());}};_0x397f2b(++_0x5b825d);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4d5a[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require(_0xa4d5('0x0'));var path=require(_0xa4d5('0x1'));var timeout=require(_0xa4d5('0x2'));var express=require('express');var router=express[_0xa4d5('0x3')]();var fs_extra=require(_0xa4d5('0x4'));var auth=require(_0xa4d5('0x5'));var interaction=require(_0xa4d5('0x6'));var config=require('../../config/environment');module[_0xa4d5('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5b4915,_0x336b69){var _0x4eaaca=function(_0x5e9047){while(--_0x5e9047){_0x5b4915['push'](_0x5b4915['shift']());}};_0x4eaaca(++_0x336b69);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 84eac78..835328c 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x5e58b2,_0x1b7ed4){var _0x4facd0=function(_0x58d136){while(--_0x58d136){_0x5e58b2['push'](_0x5e58b2['shift']());}};_0x4facd0(++_0x1b7ed4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5f4029,_0x37cab3){var _0x33fc42=function(_0x19145c){while(--_0x19145c){_0x5f4029['push'](_0x5f4029['shift']());}};_0x33fc42(++_0x37cab3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 45477c5..643a7ab 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d25=['api','moment','bluebird','request-promise','path','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger'];(function(_0x3cd283,_0x2b8542){var _0x5ea1f0=function(_0x5d7e1c){while(--_0x5d7e1c){_0x3cd283['push'](_0x3cd283['shift']());}};_0x5ea1f0(++_0x2b8542);}(_0x7d25,0x8a));var _0x57d2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7d25[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97c1=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x515016,_0x5cc189){var _0x4b08ae=function(_0x39a4bb){while(--_0x39a4bb){_0x515016['push'](_0x515016['shift']());}};_0x4b08ae(++_0x5cc189);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var logger=require('../../config/logger')(_0x197c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x197c('0x3'));var fs=require('fs');var path=require(_0x197c('0x4'));var rimraf=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var attributes=require(_0x197c('0x7'));module['exports']=function(_0x5cbff6,_0x1cb6e1){return _0x5cbff6[_0x197c('0x8')](_0x197c('0x9'),attributes,{'tableName':_0x197c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c1eb22c..98f7672 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xec8ac1,_0x42a5c2){var _0x12661c=function(_0x2e4bc2){while(--_0x2e4bc2){_0xec8ac1['push'](_0xec8ac1['shift']());}};_0x12661c(++_0x42a5c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1eabf2,_0x3ba6a4){var _0x1c93ac=function(_0xa9a84c){while(--_0xa9a84c){_0x1eabf2['push'](_0x1eabf2['shift']());}};_0x1c93ac(++_0x3ba6a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d8db101..762d594 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e6a=['index','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./variable.controller','isAuthenticated'];(function(_0x5ec95a,_0x3db81c){var _0x1e1b6a=function(_0x39f4db){while(--_0x39f4db){_0x5ec95a['push'](_0x5ec95a['shift']());}};_0x1e1b6a(++_0x3db81c);}(_0x9e6a,0x86));var _0xa9e6=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0x9e6a[_0x1806d4];return _0x392c2c;};'use strict';var multer=require(_0xa9e6('0x0'));var util=require(_0xa9e6('0x1'));var path=require(_0xa9e6('0x2'));var timeout=require(_0xa9e6('0x3'));var express=require(_0xa9e6('0x4'));var router=express[_0xa9e6('0x5')]();var fs_extra=require(_0xa9e6('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9e6('0x7'));var controller=require(_0xa9e6('0x8'));router['get']('/',auth[_0xa9e6('0x9')](),controller[_0xa9e6('0xa')]);router['get'](_0xa9e6('0xb'),auth[_0xa9e6('0x9')](),controller[_0xa9e6('0xc')]);router['post']('/',auth[_0xa9e6('0x9')](),controller[_0xa9e6('0xd')]);router[_0xa9e6('0xe')](_0xa9e6('0xb'),auth['isAuthenticated'](),controller[_0xa9e6('0xf')]);router[_0xa9e6('0x10')](_0xa9e6('0xb'),auth[_0xa9e6('0x9')](),controller[_0xa9e6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9b16=['isAuthenticated','index','/:id','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0x2d5b80,_0x14f2cf){var _0x4c3001=function(_0x2b2655){while(--_0x2b2655){_0x2d5b80['push'](_0x2d5b80['shift']());}};_0x4c3001(++_0x14f2cf);}(_0x9b16,0x1d3));var _0x69b1=function(_0x553ac6,_0xbd1290){_0x553ac6=_0x553ac6-0x0;var _0x4210a9=_0x9b16[_0x553ac6];return _0x4210a9;};'use strict';var multer=require('multer');var util=require(_0x69b1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x69b1('0x1'));var router=express[_0x69b1('0x2')]();var fs_extra=require(_0x69b1('0x3'));var auth=require(_0x69b1('0x4'));var interaction=require(_0x69b1('0x5'));var config=require(_0x69b1('0x6'));var controller=require(_0x69b1('0x7'));router[_0x69b1('0x8')]('/',auth[_0x69b1('0x9')](),controller[_0x69b1('0xa')]);router[_0x69b1('0x8')](_0x69b1('0xb'),auth[_0x69b1('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x69b1('0xc')](_0x69b1('0xb'),auth[_0x69b1('0x9')](),controller[_0x69b1('0xd')]);router[_0x69b1('0xe')](_0x69b1('0xb'),auth[_0x69b1('0x9')](),controller[_0x69b1('0xf')]);module[_0x69b1('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d05eabf..c3b5186 100644 --- a/server/api/variable/variable.attributes.js +++ b/server/api/variable/variable.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb81b=['sequelize','exports','STRING','name'];(function(_0x3777ef,_0x20db8a){var _0x4e7452=function(_0x454667){while(--_0x454667){_0x3777ef['push'](_0x3777ef['shift']());}};_0x4e7452(++_0x20db8a);}(_0xb81b,0x16c));var _0xbb81=function(_0x4269e7,_0xf2408d){_0x4269e7=_0x4269e7-0x0;var _0x5291ea=_0xb81b[_0x4269e7];return _0x5291ea;};'use strict';var Sequelize=require(_0xbb81('0x0'));module[_0xbb81('0x1')]={'name':{'type':Sequelize[_0xbb81('0x2')],'unique':_0xbb81('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x93f9=['exports','name','STRING'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x93f9,0x1ef));var _0x993f=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x93f9[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require('sequelize');module[_0x993f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x993f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x993f('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b13b394..73d6661 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf981=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','Variables','destroy','error','stack','name','send','render','body','message','account','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','fields','find','catch','create','user','get','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf981,0xe6));var _0x1f98=function(_0x111475,_0x4314a5){_0x111475=_0x111475-0x0;var _0x4a273b=_0xf981[_0x111475];return _0x4a273b;};'use strict';var emlformat=require(_0x1f98('0x0'));var rimraf=require(_0x1f98('0x1'));var zipdir=require(_0x1f98('0x2'));var jsonpatch=require(_0x1f98('0x3'));var rp=require(_0x1f98('0x4'));var moment=require(_0x1f98('0x5'));var BPromise=require(_0x1f98('0x6'));var Mustache=require(_0x1f98('0x7'));var util=require('util');var path=require(_0x1f98('0x8'));var sox=require(_0x1f98('0x9'));var csv=require(_0x1f98('0xa'));var ejs=require(_0x1f98('0xb'));var fs=require('fs');var fs_extra=require(_0x1f98('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f98('0xe'));var toCsv=require(_0x1f98('0xa'));var querystring=require(_0x1f98('0xf'));var Papa=require(_0x1f98('0x10'));var Redis=require(_0x1f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1f98('0x12'));var as=require(_0x1f98('0x13'));var hardwareService=require(_0x1f98('0x14'));var logger=require(_0x1f98('0x15'))('api');var utils=require(_0x1f98('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1f98('0x17'));var db=require(_0x1f98('0x18'))['db'];function respondWithStatusCode(_0x47322b,_0x4d14ae){_0x4d14ae=_0x4d14ae||0xcc;return function(_0x5e34f9){if(_0x5e34f9){return _0x47322b['sendStatus'](_0x4d14ae);}return _0x47322b[_0x1f98('0x19')](_0x4d14ae)[_0x1f98('0x1a')]();};}function respondWithResult(_0x2e599d,_0x2d9c83){_0x2d9c83=_0x2d9c83||0xc8;return function(_0x87ffbd){if(_0x87ffbd){return _0x2e599d[_0x1f98('0x19')](_0x2d9c83)[_0x1f98('0x1b')](_0x87ffbd);}};}function respondWithFilteredResult(_0x5d38ba,_0x1a21cd){return function(_0x547b5c){if(_0x547b5c){var _0x2fc335=typeof _0x1a21cd['offset']===_0x1f98('0x1c')&&typeof _0x1a21cd[_0x1f98('0x1d')]===_0x1f98('0x1c');var _0x466bbd=_0x547b5c[_0x1f98('0x1e')];var _0x414268=_0x2fc335?0x0:_0x1a21cd[_0x1f98('0x1f')];var _0x52966d=_0x2fc335?_0x547b5c[_0x1f98('0x1e')]:_0x1a21cd['offset']+_0x1a21cd[_0x1f98('0x1d')];var _0x23221d;if(_0x52966d>=_0x466bbd){_0x52966d=_0x466bbd;_0x23221d=0xc8;}else{_0x23221d=0xce;}_0x5d38ba[_0x1f98('0x19')](_0x23221d);return _0x5d38ba[_0x1f98('0x20')](_0x1f98('0x21'),_0x414268+'-'+_0x52966d+'/'+_0x466bbd)[_0x1f98('0x1b')](_0x547b5c);}return null;};}function patchUpdates(_0x21e416){return function(_0x3b9e54){try{jsonpatch[_0x1f98('0x22')](_0x3b9e54,_0x21e416,!![]);}catch(_0x56f46c){return BPromise['reject'](_0x56f46c);}return _0x3b9e54['save']();};}function saveUpdates(_0xa07804,_0x431958){return function(_0x46582d){if(_0x46582d){return _0x46582d['update'](_0xa07804)[_0x1f98('0x23')](function(_0x1b48d1){return _0x1b48d1;});}return null;};}function removeEntity(_0x5049d9,_0x55d29e){return function(_0x1de1cd){if(_0x1de1cd){return _0x1de1cd['destroy']()[_0x1f98('0x23')](function(){var _0x5a6f37=_0x1de1cd['get']({'plain':!![]});var _0x48a5dc=_0x1f98('0x24');return db['UserProfileResource'][_0x1f98('0x25')]({'where':{'type':_0x48a5dc,'resourceId':_0x5a6f37['id']}})[_0x1f98('0x23')](function(){return _0x1de1cd;});})[_0x1f98('0x23')](function(){_0x5049d9[_0x1f98('0x19')](0xcc)[_0x1f98('0x1a')]();});}};}function handleEntityNotFound(_0x3e1c19,_0x401606){return function(_0x1721fc){if(!_0x1721fc){_0x3e1c19['sendStatus'](0x194);}return _0x1721fc;};}function handleError(_0x10069b,_0x4aef13){_0x4aef13=_0x4aef13||0x1f4;return function(_0x18d13b){logger[_0x1f98('0x26')](_0x18d13b[_0x1f98('0x27')]);if(_0x18d13b[_0x1f98('0x28')]){delete _0x18d13b['name'];}_0x10069b['status'](_0x4aef13)[_0x1f98('0x29')](_0x18d13b);};}function getMustacheRender(_0x23ad11,_0x2df3fb){return Mustache[_0x1f98('0x2a')](_0x23ad11,_['merge'](_0x2df3fb[_0x1f98('0x2b')],{'contact':_0x2df3fb['contact'],'message':_0x2df3fb[_0x1f98('0x2c')],'agent':_0x2df3fb['agent'],'interaction':_0x2df3fb['interaction'],'account':_0x2df3fb[_0x1f98('0x2d')]}))||'';}exports[_0x1f98('0x2e')]=function(_0x474e74,_0x269aba){var _0x3e621c={},_0xb24ee6={},_0x52fae2={'count':0x0,'rows':[]};var _0x36f2fe=_[_0x1f98('0x2f')](db[_0x1f98('0x30')][_0x1f98('0x31')],function(_0x1f157f){return{'name':_0x1f157f[_0x1f98('0x32')],'type':_0x1f157f[_0x1f98('0x33')][_0x1f98('0x34')]};});_0xb24ee6[_0x1f98('0x35')]=_[_0x1f98('0x2f')](_0x36f2fe,_0x1f98('0x28'));_0xb24ee6[_0x1f98('0x36')]=_[_0x1f98('0x37')](_0x474e74[_0x1f98('0x36')]);_0xb24ee6[_0x1f98('0x38')]=_[_0x1f98('0x39')](_0xb24ee6[_0x1f98('0x35')],_0xb24ee6[_0x1f98('0x36')]);_0x3e621c['attributes']=_['intersection'](_0xb24ee6[_0x1f98('0x35')],qs['fields'](_0x474e74[_0x1f98('0x36')]['fields']));_0x3e621c[_0x1f98('0x3a')]=_0x3e621c[_0x1f98('0x3a')][_0x1f98('0x3b')]?_0x3e621c[_0x1f98('0x3a')]:_0xb24ee6[_0x1f98('0x35')];if(!_0x474e74[_0x1f98('0x36')]['hasOwnProperty'](_0x1f98('0x3c'))){_0x3e621c['limit']=qs['limit'](_0x474e74[_0x1f98('0x36')][_0x1f98('0x1d')]);_0x3e621c[_0x1f98('0x1f')]=qs[_0x1f98('0x1f')](_0x474e74[_0x1f98('0x36')]['offset']);}_0x3e621c[_0x1f98('0x3d')]=qs[_0x1f98('0x3e')](_0x474e74[_0x1f98('0x36')][_0x1f98('0x3e')]);_0x3e621c[_0x1f98('0x3f')]=qs[_0x1f98('0x38')](_[_0x1f98('0x40')](_0x474e74[_0x1f98('0x36')],_0xb24ee6['filters']),_0x36f2fe);if(_0x474e74[_0x1f98('0x36')][_0x1f98('0x41')]){_0x3e621c[_0x1f98('0x3f')]=_[_0x1f98('0x42')](_0x3e621c['where'],{'$or':_['map'](_0x36f2fe,function(_0x26683c){if(_0x26683c['type']!==_0x1f98('0x43')){var _0x9db84={};_0x9db84[_0x26683c[_0x1f98('0x28')]]={'$like':'%'+_0x474e74[_0x1f98('0x36')]['filter']+'%'};return _0x9db84;}})});}_0x3e621c=_['merge']({},_0x3e621c,_0x474e74['options']);var _0x1598c3={'where':_0x3e621c[_0x1f98('0x3f')]};return db[_0x1f98('0x30')][_0x1f98('0x1e')](_0x1598c3)[_0x1f98('0x23')](function(_0x4f9a42){_0x52fae2[_0x1f98('0x1e')]=_0x4f9a42;if(_0x474e74[_0x1f98('0x36')][_0x1f98('0x44')]){_0x3e621c[_0x1f98('0x45')]=[{'all':!![]}];}return db[_0x1f98('0x30')]['findAll'](_0x3e621c);})[_0x1f98('0x23')](function(_0x2ffc47){_0x52fae2[_0x1f98('0x46')]=_0x2ffc47;return _0x52fae2;})[_0x1f98('0x23')](respondWithFilteredResult(_0x269aba,_0x3e621c))['catch'](handleError(_0x269aba,null));};exports['show']=function(_0x160e06,_0x3e7fc0){var _0x19936a={'raw':!![],'where':{'id':_0x160e06[_0x1f98('0x47')]['id']}},_0x408a51={};_0x408a51[_0x1f98('0x35')]=_['keys'](db[_0x1f98('0x30')][_0x1f98('0x31')]);_0x408a51[_0x1f98('0x36')]=_[_0x1f98('0x37')](_0x160e06['query']);_0x408a51[_0x1f98('0x38')]=_[_0x1f98('0x39')](_0x408a51[_0x1f98('0x35')],_0x408a51['query']);_0x19936a[_0x1f98('0x3a')]=_[_0x1f98('0x39')](_0x408a51[_0x1f98('0x35')],qs[_0x1f98('0x48')](_0x160e06[_0x1f98('0x36')][_0x1f98('0x48')]));_0x19936a['attributes']=_0x19936a[_0x1f98('0x3a')][_0x1f98('0x3b')]?_0x19936a['attributes']:_0x408a51[_0x1f98('0x35')];if(_0x160e06[_0x1f98('0x36')][_0x1f98('0x44')]){_0x19936a[_0x1f98('0x45')]=[{'all':!![]}];}_0x19936a=_['merge']({},_0x19936a,_0x160e06['options']);return db[_0x1f98('0x30')][_0x1f98('0x49')](_0x19936a)[_0x1f98('0x23')](handleEntityNotFound(_0x3e7fc0,null))[_0x1f98('0x23')](respondWithResult(_0x3e7fc0,null))[_0x1f98('0x4a')](handleError(_0x3e7fc0,null));};exports[_0x1f98('0x4b')]=function(_0x4af13c,_0x5ec2d4){return db[_0x1f98('0x30')]['create'](_0x4af13c[_0x1f98('0x2b')],{})[_0x1f98('0x23')](function(_0x5dbc76){var _0x320ad6=_0x4af13c[_0x1f98('0x4c')][_0x1f98('0x4d')]({'plain':!![]});if(!_0x320ad6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x320ad6[_0x1f98('0x4e')]===_0x1f98('0x4c')){var _0x3bc5ad=_0x5dbc76[_0x1f98('0x4d')]({'plain':!![]});var _0x5de9dc=_0x1f98('0x24');return db['UserProfileSection'][_0x1f98('0x49')]({'where':{'name':_0x5de9dc,'userProfileId':_0x320ad6['userProfileId']},'raw':!![]})[_0x1f98('0x23')](function(_0x82183a){if(_0x82183a&&_0x82183a[_0x1f98('0x4f')]===0x0){return db[_0x1f98('0x50')][_0x1f98('0x4b')]({'name':_0x3bc5ad['name'],'resourceId':_0x3bc5ad['id'],'type':_0x82183a['name'],'sectionId':_0x82183a['id']},{})[_0x1f98('0x23')](function(){return _0x5dbc76;});}else{return _0x5dbc76;}})['catch'](function(_0xb1d0e){logger['error'](_0x1f98('0x51'),_0xb1d0e);throw _0xb1d0e;});}return _0x5dbc76;})[_0x1f98('0x23')](respondWithResult(_0x5ec2d4,0xc9))[_0x1f98('0x4a')](handleError(_0x5ec2d4,null));};exports[_0x1f98('0x52')]=function(_0x1fc4d6,_0xcdb24e){if(_0x1fc4d6[_0x1f98('0x2b')]['id']){delete _0x1fc4d6[_0x1f98('0x2b')]['id'];}return db[_0x1f98('0x30')][_0x1f98('0x49')]({'where':{'id':_0x1fc4d6[_0x1f98('0x47')]['id']}})[_0x1f98('0x23')](handleEntityNotFound(_0xcdb24e,null))['then'](saveUpdates(_0x1fc4d6['body'],null))[_0x1f98('0x23')](respondWithResult(_0xcdb24e,null))['catch'](handleError(_0xcdb24e,null));};exports[_0x1f98('0x25')]=function(_0x356148,_0x533c06){return db['Variable'][_0x1f98('0x49')]({'where':{'id':_0x356148[_0x1f98('0x47')]['id']}})['then'](handleEntityNotFound(_0x533c06,null))['then'](removeEntity(_0x533c06,null))[_0x1f98('0x4a')](handleError(_0x533c06,null));}; \ No newline at end of file +var _0x7f05=['reject','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','Variable','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','show','find','catch','create','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0x7f05,0xdc));var _0x57f0=function(_0x1ab7a5,_0xec8b18){_0x1ab7a5=_0x1ab7a5-0x0;var _0x13484f=_0x7f05[_0x1ab7a5];return _0x13484f;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd266,_0x5615ff){_0x5615ff=_0x5615ff||0xcc;return function(_0x1aa9c8){if(_0x1aa9c8){return _0x5cd266[_0x57f0('0x13')](_0x5615ff);}return _0x5cd266[_0x57f0('0x14')](_0x5615ff)[_0x57f0('0x15')]();};}function respondWithResult(_0x599a6b,_0x4d8d89){_0x4d8d89=_0x4d8d89||0xc8;return function(_0x471f97){if(_0x471f97){return _0x599a6b[_0x57f0('0x14')](_0x4d8d89)[_0x57f0('0x16')](_0x471f97);}};}function respondWithFilteredResult(_0x2e57df,_0x238245){return function(_0x2130ca){if(_0x2130ca){var _0x555e18=typeof _0x238245['offset']===_0x57f0('0x17')&&typeof _0x238245['limit']==='undefined';var _0x48eadd=_0x2130ca['count'];var _0x20d0ba=_0x555e18?0x0:_0x238245[_0x57f0('0x18')];var _0x124f9e=_0x555e18?_0x2130ca['count']:_0x238245[_0x57f0('0x18')]+_0x238245[_0x57f0('0x19')];var _0x3d0cf6;if(_0x124f9e>=_0x48eadd){_0x124f9e=_0x48eadd;_0x3d0cf6=0xc8;}else{_0x3d0cf6=0xce;}_0x2e57df['status'](_0x3d0cf6);return _0x2e57df[_0x57f0('0x1a')](_0x57f0('0x1b'),_0x20d0ba+'-'+_0x124f9e+'/'+_0x48eadd)['json'](_0x2130ca);}return null;};}function patchUpdates(_0x589c18){return function(_0x1f8483){try{jsonpatch[_0x57f0('0x1c')](_0x1f8483,_0x589c18,!![]);}catch(_0x599aa2){return BPromise[_0x57f0('0x1d')](_0x599aa2);}return _0x1f8483['save']();};}function saveUpdates(_0x3a5b6f,_0x9c498){return function(_0x426a09){if(_0x426a09){return _0x426a09[_0x57f0('0x1e')](_0x3a5b6f)['then'](function(_0x5d16a6){return _0x5d16a6;});}return null;};}function removeEntity(_0x43a679,_0x56ceb5){return function(_0x1279ae){if(_0x1279ae){return _0x1279ae[_0x57f0('0x1f')]()[_0x57f0('0x20')](function(){var _0x3f5d1e=_0x1279ae[_0x57f0('0x21')]({'plain':!![]});var _0x1c2cae=_0x57f0('0x22');return db[_0x57f0('0x23')]['destroy']({'where':{'type':_0x1c2cae,'resourceId':_0x3f5d1e['id']}})[_0x57f0('0x20')](function(){return _0x1279ae;});})['then'](function(){_0x43a679['status'](0xcc)[_0x57f0('0x15')]();});}};}function handleEntityNotFound(_0x58a529,_0x407829){return function(_0x50347e){if(!_0x50347e){_0x58a529['sendStatus'](0x194);}return _0x50347e;};}function handleError(_0x23564f,_0x1fd10){_0x1fd10=_0x1fd10||0x1f4;return function(_0x16c711){logger[_0x57f0('0x24')](_0x16c711[_0x57f0('0x25')]);if(_0x16c711[_0x57f0('0x26')]){delete _0x16c711[_0x57f0('0x26')];}_0x23564f[_0x57f0('0x14')](_0x1fd10)[_0x57f0('0x27')](_0x16c711);};}function getMustacheRender(_0x41ef0f,_0x5c7095){return Mustache[_0x57f0('0x28')](_0x41ef0f,_[_0x57f0('0x29')](_0x5c7095[_0x57f0('0x2a')],{'contact':_0x5c7095[_0x57f0('0x2b')],'message':_0x5c7095[_0x57f0('0x2c')],'agent':_0x5c7095[_0x57f0('0x2d')],'interaction':_0x5c7095[_0x57f0('0x2e')],'account':_0x5c7095[_0x57f0('0x2f')]}))||'';}exports[_0x57f0('0x30')]=function(_0x12da92,_0x2c13cf){var _0x249557={},_0x12fb54={},_0x3a8e5f={'count':0x0,'rows':[]};var _0x559440=_[_0x57f0('0x31')](db[_0x57f0('0x32')][_0x57f0('0x33')],function(_0x3751d7){return{'name':_0x3751d7['fieldName'],'type':_0x3751d7['type']['key']};});_0x12fb54[_0x57f0('0x34')]=_['map'](_0x559440,_0x57f0('0x26'));_0x12fb54[_0x57f0('0x35')]=_[_0x57f0('0x36')](_0x12da92['query']);_0x12fb54[_0x57f0('0x37')]=_[_0x57f0('0x38')](_0x12fb54[_0x57f0('0x34')],_0x12fb54[_0x57f0('0x35')]);_0x249557[_0x57f0('0x39')]=_[_0x57f0('0x38')](_0x12fb54[_0x57f0('0x34')],qs[_0x57f0('0x3a')](_0x12da92[_0x57f0('0x35')][_0x57f0('0x3a')]));_0x249557[_0x57f0('0x39')]=_0x249557[_0x57f0('0x39')][_0x57f0('0x3b')]?_0x249557[_0x57f0('0x39')]:_0x12fb54[_0x57f0('0x34')];if(!_0x12da92[_0x57f0('0x35')][_0x57f0('0x3c')](_0x57f0('0x3d'))){_0x249557[_0x57f0('0x19')]=qs['limit'](_0x12da92['query'][_0x57f0('0x19')]);_0x249557[_0x57f0('0x18')]=qs[_0x57f0('0x18')](_0x12da92['query'][_0x57f0('0x18')]);}_0x249557[_0x57f0('0x3e')]=qs[_0x57f0('0x3f')](_0x12da92[_0x57f0('0x35')][_0x57f0('0x3f')]);_0x249557[_0x57f0('0x40')]=qs[_0x57f0('0x37')](_[_0x57f0('0x41')](_0x12da92[_0x57f0('0x35')],_0x12fb54['filters']),_0x559440);if(_0x12da92[_0x57f0('0x35')][_0x57f0('0x42')]){_0x249557[_0x57f0('0x40')]=_[_0x57f0('0x29')](_0x249557['where'],{'$or':_[_0x57f0('0x31')](_0x559440,function(_0x1d1dd5){if(_0x1d1dd5['type']!==_0x57f0('0x43')){var _0x46525c={};_0x46525c[_0x1d1dd5[_0x57f0('0x26')]]={'$like':'%'+_0x12da92[_0x57f0('0x35')][_0x57f0('0x42')]+'%'};return _0x46525c;}})});}_0x249557=_[_0x57f0('0x29')]({},_0x249557,_0x12da92[_0x57f0('0x44')]);var _0x4f3271={'where':_0x249557[_0x57f0('0x40')]};return db['Variable'][_0x57f0('0x45')](_0x4f3271)['then'](function(_0x116c5a){_0x3a8e5f[_0x57f0('0x45')]=_0x116c5a;if(_0x12da92[_0x57f0('0x35')][_0x57f0('0x46')]){_0x249557[_0x57f0('0x47')]=[{'all':!![]}];}return db[_0x57f0('0x32')][_0x57f0('0x48')](_0x249557);})[_0x57f0('0x20')](function(_0x3f89af){_0x3a8e5f[_0x57f0('0x49')]=_0x3f89af;return _0x3a8e5f;})[_0x57f0('0x20')](respondWithFilteredResult(_0x2c13cf,_0x249557))['catch'](handleError(_0x2c13cf,null));};exports[_0x57f0('0x4a')]=function(_0x45c6f7,_0x59b4eb){var _0x490ea2={'raw':!![],'where':{'id':_0x45c6f7['params']['id']}},_0x382a8a={};_0x382a8a[_0x57f0('0x34')]=_[_0x57f0('0x36')](db[_0x57f0('0x32')]['rawAttributes']);_0x382a8a[_0x57f0('0x35')]=_[_0x57f0('0x36')](_0x45c6f7['query']);_0x382a8a[_0x57f0('0x37')]=_[_0x57f0('0x38')](_0x382a8a[_0x57f0('0x34')],_0x382a8a[_0x57f0('0x35')]);_0x490ea2[_0x57f0('0x39')]=_[_0x57f0('0x38')](_0x382a8a['model'],qs[_0x57f0('0x3a')](_0x45c6f7[_0x57f0('0x35')]['fields']));_0x490ea2[_0x57f0('0x39')]=_0x490ea2['attributes'][_0x57f0('0x3b')]?_0x490ea2['attributes']:_0x382a8a[_0x57f0('0x34')];if(_0x45c6f7['query']['includeAll']){_0x490ea2[_0x57f0('0x47')]=[{'all':!![]}];}_0x490ea2=_[_0x57f0('0x29')]({},_0x490ea2,_0x45c6f7[_0x57f0('0x44')]);return db['Variable'][_0x57f0('0x4b')](_0x490ea2)[_0x57f0('0x20')](handleEntityNotFound(_0x59b4eb,null))[_0x57f0('0x20')](respondWithResult(_0x59b4eb,null))[_0x57f0('0x4c')](handleError(_0x59b4eb,null));};exports[_0x57f0('0x4d')]=function(_0x3349fa,_0xced2ac){return db[_0x57f0('0x32')][_0x57f0('0x4d')](_0x3349fa['body'],{})[_0x57f0('0x20')](function(_0x3515e3){var _0x5a2a7b=_0x3349fa[_0x57f0('0x4e')][_0x57f0('0x21')]({'plain':!![]});if(!_0x5a2a7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a2a7b['role']===_0x57f0('0x4e')){var _0x71081b=_0x3515e3['get']({'plain':!![]});var _0x5d6138='Variables';return db[_0x57f0('0x4f')][_0x57f0('0x4b')]({'where':{'name':_0x5d6138,'userProfileId':_0x5a2a7b['userProfileId']},'raw':!![]})[_0x57f0('0x20')](function(_0x4f4fe9){if(_0x4f4fe9&&_0x4f4fe9[_0x57f0('0x50')]===0x0){return db[_0x57f0('0x23')]['create']({'name':_0x71081b[_0x57f0('0x26')],'resourceId':_0x71081b['id'],'type':_0x4f4fe9[_0x57f0('0x26')],'sectionId':_0x4f4fe9['id']},{})['then'](function(){return _0x3515e3;});}else{return _0x3515e3;}})[_0x57f0('0x4c')](function(_0x22e2d2){logger['error'](_0x57f0('0x51'),_0x22e2d2);throw _0x22e2d2;});}return _0x3515e3;})[_0x57f0('0x20')](respondWithResult(_0xced2ac,0xc9))[_0x57f0('0x4c')](handleError(_0xced2ac,null));};exports['update']=function(_0x40edee,_0x429469){if(_0x40edee[_0x57f0('0x2a')]['id']){delete _0x40edee['body']['id'];}return db[_0x57f0('0x32')][_0x57f0('0x4b')]({'where':{'id':_0x40edee[_0x57f0('0x52')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x429469,null))[_0x57f0('0x20')](saveUpdates(_0x40edee[_0x57f0('0x2a')],null))[_0x57f0('0x20')](respondWithResult(_0x429469,null))[_0x57f0('0x4c')](handleError(_0x429469,null));};exports[_0x57f0('0x1f')]=function(_0x4af55b,_0x1f0d2c){return db[_0x57f0('0x32')][_0x57f0('0x4b')]({'where':{'id':_0x4af55b[_0x57f0('0x52')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x1f0d2c,null))[_0x57f0('0x20')](removeEntity(_0x1f0d2c,null))['catch'](handleError(_0x1f0d2c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3a5892f..a188d4b 100644 --- a/server/api/variable/variable.model.js +++ b/server/api/variable/variable.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x928c=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','../../config/logger'];(function(_0x4fcb7c,_0x5c951d){var _0x23f187=function(_0x4be661){while(--_0x4be661){_0x4fcb7c['push'](_0x4fcb7c['shift']());}};_0x23f187(++_0x5c951d);}(_0x928c,0x17f));var _0xc928=function(_0x2b4085,_0x4e21fe){_0x2b4085=_0x2b4085-0x0;var _0x5cc0c5=_0x928c[_0x2b4085];return _0x5cc0c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc928('0x0'))(_0xc928('0x1'));var moment=require('moment');var BPromise=require(_0xc928('0x2'));var rp=require(_0xc928('0x3'));var fs=require('fs');var path=require(_0xc928('0x4'));var rimraf=require(_0xc928('0x5'));var config=require(_0xc928('0x6'));var attributes=require('./variable.attributes');module[_0xc928('0x7')]=function(_0x4704bc,_0x8c0fa5){return _0x4704bc['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe130=['api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','lodash','util'];(function(_0x36888a,_0x34e7ee){var _0x4bac23=function(_0x41cc6a){while(--_0x41cc6a){_0x36888a['push'](_0x36888a['shift']());}};_0x4bac23(++_0x34e7ee);}(_0xe130,0x127));var _0x0e13=function(_0x3c9daa,_0xee134d){_0x3c9daa=_0x3c9daa-0x0;var _0x4bab34=_0xe130[_0x3c9daa];return _0x4bab34;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var logger=require('../../config/logger')(_0x0e13('0x2'));var moment=require(_0x0e13('0x3'));var BPromise=require(_0x0e13('0x4'));var rp=require(_0x0e13('0x5'));var fs=require('fs');var path=require(_0x0e13('0x6'));var rimraf=require('rimraf');var config=require(_0x0e13('0x7'));var attributes=require(_0x0e13('0x8'));module[_0x0e13('0x9')]=function(_0xcd92e,_0x50a80e){return _0xcd92e[_0x0e13('0xa')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index dc08987..e2457ff 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83ec=['ShowVariable','Variable','find','raw','options','where','include','map','model','then','lodash','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x10b15d,_0x3cc5b5){var _0x44dd13=function(_0x438278){while(--_0x438278){_0x10b15d['push'](_0x10b15d['shift']());}};_0x44dd13(++_0x3cc5b5);}(_0x83ec,0xbe));var _0xc83e=function(_0x202176,_0x521bde){_0x202176=_0x202176-0x0;var _0x247f0f=_0x83ec[_0x202176];return _0x247f0f;};'use strict';var _=require(_0xc83e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc83e('0x1'));var fs=require('fs');var Redis=require(_0xc83e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc83e('0x3'));var logger=require(_0xc83e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc83e('0x5'));var client=jayson[_0xc83e('0x6')][_0xc83e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b4ca4,_0x38ba3a,_0x562c02){return new BPromise(function(_0x32b36a,_0xaf57d4){return client[_0xc83e('0x8')](_0x3b4ca4,_0x562c02)['then'](function(_0x94b25c){logger[_0xc83e('0x9')](_0xc83e('0xa'),_0x38ba3a,_0xc83e('0xb'));logger[_0xc83e('0xc')](_0xc83e('0xd'),_0x38ba3a,_0xc83e('0xb'),JSON[_0xc83e('0xe')](_0x94b25c));if(_0x94b25c[_0xc83e('0xf')]){if(_0x94b25c['error'][_0xc83e('0x10')]===0x1f4){logger[_0xc83e('0xf')]('Variable,\x20%s,\x20%s',_0x38ba3a,_0x94b25c[_0xc83e('0xf')][_0xc83e('0x11')]);return _0xaf57d4(_0x94b25c['error'][_0xc83e('0x11')]);}logger[_0xc83e('0xf')](_0xc83e('0xa'),_0x38ba3a,_0x94b25c[_0xc83e('0xf')][_0xc83e('0x11')]);return _0x32b36a(_0x94b25c['error'][_0xc83e('0x11')]);}else{logger[_0xc83e('0x9')](_0xc83e('0xa'),_0x38ba3a,_0xc83e('0xb'));_0x32b36a(_0x94b25c[_0xc83e('0x12')]['message']);}})[_0xc83e('0x13')](function(_0x5bd3f5){logger[_0xc83e('0xf')](_0xc83e('0xa'),_0x38ba3a,_0x5bd3f5);_0xaf57d4(_0x5bd3f5);});});}exports[_0xc83e('0x14')]=function(_0x547a34){var _0x8fb638=this;return new Promise(function(_0x488fb3,_0x1e5c8b){return db[_0xc83e('0x15')][_0xc83e('0x16')]({'raw':_0x547a34['options']?_0x547a34['options'][_0xc83e('0x17')]===undefined?!![]:![]:!![],'where':_0x547a34[_0xc83e('0x18')]?_0x547a34[_0xc83e('0x18')][_0xc83e('0x19')]||null:null,'attributes':_0x547a34[_0xc83e('0x18')]?_0x547a34[_0xc83e('0x18')]['attributes']||null:null,'include':_0x547a34[_0xc83e('0x18')]?_0x547a34[_0xc83e('0x18')][_0xc83e('0x1a')]?_[_0xc83e('0x1b')](_0x547a34['options']['include'],function(_0x14e6a8){return{'model':db[_0x14e6a8[_0xc83e('0x1c')]],'as':_0x14e6a8['as'],'attributes':_0x14e6a8['attributes'],'include':_0x14e6a8[_0xc83e('0x1a')]?_[_0xc83e('0x1b')](_0x14e6a8[_0xc83e('0x1a')],function(_0x5c7f56){return{'model':db[_0x5c7f56[_0xc83e('0x1c')]],'as':_0x5c7f56['as'],'attributes':_0x5c7f56['attributes'],'include':_0x5c7f56[_0xc83e('0x1a')]?_[_0xc83e('0x1b')](_0x5c7f56[_0xc83e('0x1a')],function(_0x3a9bda){return{'model':db[_0x3a9bda[_0xc83e('0x1c')]],'as':_0x3a9bda['as'],'attributes':_0x3a9bda['attributes']};}):[]};}):[]};}):[]:[]})[_0xc83e('0x1d')](function(_0xf01f84){logger[_0xc83e('0x9')](_0xc83e('0x14'),_0x547a34);logger[_0xc83e('0xc')](_0xc83e('0x14'),_0x547a34,JSON[_0xc83e('0xe')](_0xf01f84));_0x488fb3(_0xf01f84);})[_0xc83e('0x13')](function(_0x1a5482){logger[_0xc83e('0xf')](_0xc83e('0x14'),_0x1a5482['message'],_0x547a34);_0x1e5c8b(_0x8fb638[_0xc83e('0xf')](0x1f4,_0x1a5482[_0xc83e('0x11')]));});});}; \ No newline at end of file +var _0x21c3=['find','options','raw','where','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowVariable','Variable'];(function(_0x55a802,_0x10ab3a){var _0x1a0461=function(_0x43d162){while(--_0x43d162){_0x55a802['push'](_0x55a802['shift']());}};_0x1a0461(++_0x10ab3a);}(_0x21c3,0x148));var _0x321c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x21c3[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x321c('0x0'));var util=require(_0x321c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x321c('0x2'));var fs=require('fs');var Redis=require(_0x321c('0x3'));var db=require(_0x321c('0x4'))['db'];var utils=require(_0x321c('0x5'));var logger=require(_0x321c('0x6'))(_0x321c('0x7'));var config=require('../../config/environment');var jayson=require(_0x321c('0x8'));var client=jayson[_0x321c('0x9')][_0x321c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44db07,_0x5b2f0b,_0x10b93f){return new BPromise(function(_0xaae704,_0x38910e){return client[_0x321c('0xb')](_0x44db07,_0x10b93f)[_0x321c('0xc')](function(_0x531f2b){logger[_0x321c('0xd')](_0x321c('0xe'),_0x5b2f0b,_0x321c('0xf'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x5b2f0b,_0x321c('0xf'),JSON[_0x321c('0x10')](_0x531f2b));if(_0x531f2b['error']){if(_0x531f2b[_0x321c('0x11')][_0x321c('0x12')]===0x1f4){logger[_0x321c('0x11')](_0x321c('0xe'),_0x5b2f0b,_0x531f2b['error'][_0x321c('0x13')]);return _0x38910e(_0x531f2b[_0x321c('0x11')][_0x321c('0x13')]);}logger['error'](_0x321c('0xe'),_0x5b2f0b,_0x531f2b[_0x321c('0x11')][_0x321c('0x13')]);return _0xaae704(_0x531f2b['error'][_0x321c('0x13')]);}else{logger['info'](_0x321c('0xe'),_0x5b2f0b,_0x321c('0xf'));_0xaae704(_0x531f2b[_0x321c('0x14')][_0x321c('0x13')]);}})[_0x321c('0x15')](function(_0x30764f){logger['error'](_0x321c('0xe'),_0x5b2f0b,_0x30764f);_0x38910e(_0x30764f);});});}exports[_0x321c('0x16')]=function(_0x1b11ad){var _0x33f7cd=this;return new Promise(function(_0x2d0e12,_0x2b97d4){return db[_0x321c('0x17')][_0x321c('0x18')]({'raw':_0x1b11ad[_0x321c('0x19')]?_0x1b11ad['options'][_0x321c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b11ad[_0x321c('0x19')]?_0x1b11ad[_0x321c('0x19')][_0x321c('0x1b')]||null:null,'attributes':_0x1b11ad[_0x321c('0x19')]?_0x1b11ad[_0x321c('0x19')][_0x321c('0x1c')]||null:null,'include':_0x1b11ad[_0x321c('0x19')]?_0x1b11ad[_0x321c('0x19')][_0x321c('0x1d')]?_[_0x321c('0x1e')](_0x1b11ad[_0x321c('0x19')]['include'],function(_0x1087db){return{'model':db[_0x1087db[_0x321c('0x1f')]],'as':_0x1087db['as'],'attributes':_0x1087db[_0x321c('0x1c')],'include':_0x1087db[_0x321c('0x1d')]?_['map'](_0x1087db[_0x321c('0x1d')],function(_0x334702){return{'model':db[_0x334702['model']],'as':_0x334702['as'],'attributes':_0x334702['attributes'],'include':_0x334702[_0x321c('0x1d')]?_[_0x321c('0x1e')](_0x334702[_0x321c('0x1d')],function(_0x4c977e){return{'model':db[_0x4c977e[_0x321c('0x1f')]],'as':_0x4c977e['as'],'attributes':_0x4c977e[_0x321c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x321c('0xc')](function(_0x1ce75d){logger['info'](_0x321c('0x16'),_0x1b11ad);logger['debug']('ShowVariable',_0x1b11ad,JSON[_0x321c('0x10')](_0x1ce75d));_0x2d0e12(_0x1ce75d);})[_0x321c('0x15')](function(_0x442f36){logger[_0x321c('0x11')](_0x321c('0x16'),_0x442f36['message'],_0x1b11ad);_0x2b97d4(_0x33f7cd[_0x321c('0x11')](0x1f4,_0x442f36[_0x321c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 55ae230..90bd54d 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78ac=['migrations','exports','Router','../../components/auth/service','./version.controller','index','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','/restart','restart','/migrations'];(function(_0x1007cf,_0x566564){var _0x3d96ec=function(_0x364e12){while(--_0x364e12){_0x1007cf['push'](_0x1007cf['shift']());}};_0x3d96ec(++_0x566564);}(_0x78ac,0xbd));var _0xc78a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x78ac[_0x2e4aa2];return _0x5e6092;};'use strict';var express=require('express');var router=express[_0xc78a('0x0')]();var auth=require(_0xc78a('0x1'));var controller=require(_0xc78a('0x2'));router['get']('/',controller[_0xc78a('0x3')]);router[_0xc78a('0x4')](_0xc78a('0x5'),auth['isAuthenticated'](),auth[_0xc78a('0x6')](),controller[_0xc78a('0x7')]);router[_0xc78a('0x4')](_0xc78a('0x8'),auth[_0xc78a('0x9')](),auth[_0xc78a('0x6')](),controller['reset']);router[_0xc78a('0x4')](_0xc78a('0xa'),auth[_0xc78a('0x9')](),auth[_0xc78a('0x6')](),controller[_0xc78a('0xb')]);router[_0xc78a('0x4')](_0xc78a('0xc'),auth[_0xc78a('0x9')](),controller[_0xc78a('0xd')]);router[_0xc78a('0x4')](_0xc78a('0xe'),controller[_0xc78a('0xf')]);module[_0xc78a('0x10')]=router; \ No newline at end of file +var _0x4e3a=['/pull','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset'];(function(_0x1b8a09,_0xfa4f73){var _0x53c51c=function(_0x198446){while(--_0x198446){_0x1b8a09['push'](_0x1b8a09['shift']());}};_0x53c51c(++_0xfa4f73);}(_0x4e3a,0x116));var _0xa4e3=function(_0x21f934,_0x4d0bc5){_0x21f934=_0x21f934-0x0;var _0x30dac2=_0x4e3a[_0x21f934];return _0x30dac2;};'use strict';var express=require(_0xa4e3('0x0'));var router=express[_0xa4e3('0x1')]();var auth=require(_0xa4e3('0x2'));var controller=require(_0xa4e3('0x3'));router[_0xa4e3('0x4')]('/',controller[_0xa4e3('0x5')]);router[_0xa4e3('0x4')](_0xa4e3('0x6'),auth[_0xa4e3('0x7')](),auth[_0xa4e3('0x8')](),controller['fetch']);router['get'](_0xa4e3('0x9'),auth[_0xa4e3('0x7')](),auth[_0xa4e3('0x8')](),controller[_0xa4e3('0xa')]);router[_0xa4e3('0x4')](_0xa4e3('0xb'),auth[_0xa4e3('0x7')](),auth[_0xa4e3('0x8')](),controller[_0xa4e3('0xc')]);router[_0xa4e3('0x4')](_0xa4e3('0xd'),auth[_0xa4e3('0x7')](),controller[_0xa4e3('0xe')]);router[_0xa4e3('0x4')](_0xa4e3('0xf'),controller['migrations']);module[_0xa4e3('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 16423a5..5137e98 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x649f=['../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','version','status','json','origin','master','git\x20fetch','reset','--hard','FETCH_HEAD','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','migrations','readdirSync','join','length','.js','push','sequelize','Migration','getQueryInterface','constructor','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','exec','../../mysqldb'];(function(_0x2d4bf3,_0x216403){var _0x46565f=function(_0x47dfae){while(--_0x47dfae){_0x2d4bf3['push'](_0x2d4bf3['shift']());}};_0x46565f(++_0x216403);}(_0x649f,0x93));var _0xf649=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x649f[_0x5cb1af];return _0x8d7940;};'use strict';var Umzug=require(_0xf649('0x0'));var path=require(_0xf649('0x1'));var fs=require('fs');var _=require(_0xf649('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xf649('0x3'));var exec=require('child_process')[_0xf649('0x4')];var db=require(_0xf649('0x5'))['db'];var config=require(_0xf649('0x6'));var pm2=require(_0xf649('0x7'));var logger=require(_0xf649('0x8'))(_0xf649('0x9'));var git=require(_0xf649('0xa'))(config[_0xf649('0xb')]);exports['index']=function(_0x53e568,_0x144078){var _0x14cd22={'current':module[_0xf649('0xc')]['version'],'phonebar':0x2};if(_0x53e568[_0xf649('0xd')]&&_0x53e568[_0xf649('0xd')][_0xf649('0xe')]){return git[_0xf649('0xf')]()['tags'](function(_0x7f5eda,_0x3ae675){_0x14cd22[_0xf649('0xe')]=(_0x7f5eda?module[_0xf649('0xc')][_0xf649('0x10')]:_0x3ae675[_0xf649('0xe')])||'2.0.0';return _0x144078[_0xf649('0x11')](0xc8)['json'](_0x14cd22);});}else{return _0x144078['status'](0xc8)[_0xf649('0x12')](_0x14cd22);}};exports[_0xf649('0xf')]=function(_0x5a23d0,_0xcf02d8){return git[_0xf649('0xf')]([_0xf649('0x13'),_0xf649('0x14')],function(_0x2bd72c){if(_0x2bd72c){logger['error'](_0x2bd72c);return _0xcf02d8[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0x2bd72c);}logger['info'](_0xf649('0x15'));return _0xcf02d8[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x25a7c1,_0x1e1740){return git[_0xf649('0x16')]([_0xf649('0x17'),_0xf649('0x18')],function(_0x2d956d){if(_0x2d956d){logger[_0xf649('0x19')](_0x2d956d);return _0x1e1740[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0x2d956d);}logger[_0xf649('0x1a')](_0xf649('0x1b'));return _0x1e1740[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':_0xf649('0x1c')});});};exports[_0xf649('0x1d')]=function(_0x6cfc72,_0x344224){exec(_0xf649('0x1e'),function(_0x28e98e,_0x51be40,_0x472598){logger['info'](_0x51be40);logger[_0xf649('0x1a')](_0x472598);if(_0x28e98e){logger[_0xf649('0x19')](_0x28e98e);return _0x344224[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0x28e98e);}return _0x344224[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':_0x51be40});});};exports[_0xf649('0x1f')]=function(_0x44fddb,_0xcc440a){return pm2[_0xf649('0x1f')]('motion2')[_0xf649('0x20')](function(_0x55247a){logger['info'](_0xf649('0x21'),_0x55247a);return _0xcc440a[_0xf649('0x11')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0xc66995){logger[_0xf649('0x19')](_0xc66995);return _0xcc440a[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0xc66995);});};exports[_0xf649('0x22')]=function(_0x42e8cd,_0xef0b39){var _0x283147=fs[_0xf649('0x23')](path[_0xf649('0x24')](config[_0xf649('0xb')],'server',_0xf649('0x22')));var _0x39c4da=[];for(var _0x4a99ee=0x0;_0x4a99ee<_0x283147[_0xf649('0x25')];_0x4a99ee++){var _0x554fa9=_0x283147[_0x4a99ee]['replace'](_0xf649('0x26'),'');if(compareVersions(module[_0xf649('0xc')][_0xf649('0x10')],_0x554fa9)===-0x1){_0x39c4da[_0xf649('0x27')](_0x554fa9);}}if(_0x39c4da[_0xf649('0x25')]){var _0x5fff1c=_0x39c4da['sort'](compareVersions);var _0x3e07ca=new Umzug({'storage':_0xf649('0x28'),'storageOptions':{'model':db[_0xf649('0x29')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xf649('0x28')][_0xf649('0x2a')](),db[_0xf649('0x28')][_0xf649('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xf649('0x24')](config[_0xf649('0xb')],_0xf649('0x2c'),_0xf649('0x22')),'pattern':/\.js$/}});_0x3e07ca['up']({'migrations':_[_0xf649('0x2d')](_0x5fff1c,function(_0x4638b4){return _0x4638b4+_0xf649('0x26');})})[_0xf649('0x20')](function(){return _0xef0b39[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':_0xf649('0x2e')+module['exports'][_0xf649('0x10')]+'\x20to\x20'+_[_0xf649('0x2f')](_0x5fff1c),'migrations':_[_0xf649('0x24')](_0x5fff1c)});})[_0xf649('0x30')](function(_0xaac553){if(_0xaac553 instanceof db[_0xf649('0x28')][_0xf649('0x31')]){return _0xef0b39[_0xf649('0x11')](0xc8)[_0xf649('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xef0b39[_0xf649('0x11')](0x1f4)[_0xf649('0x12')](_0xaac553);}});}else{return _0xef0b39['status'](0xc8)[_0xf649('0x12')]({'output':_0xf649('0x32')});}}; \ No newline at end of file +var _0xae6e=['Migration','getQueryInterface','constructor','migrations','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','umzug','path','lodash','pkginfo','version','child_process','../../mysqldb','update','simple-git','index','exports','query','latest','tags','2.0.0','json','fetch','origin','master','error','status','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','root','server','length','replace','.js','push','sort','sequelize'];(function(_0x4e00a6,_0x119e1e){var _0x4e0714=function(_0x372cc4){while(--_0x372cc4){_0x4e00a6['push'](_0x4e00a6['shift']());}};_0x4e0714(++_0x119e1e);}(_0xae6e,0x1e5));var _0xeae6=function(_0x1997cf,_0x495dae){_0x1997cf=_0x1997cf-0x0;var _0x377074=_0xae6e[_0x1997cf];return _0x377074;};'use strict';var Umzug=require(_0xeae6('0x0'));var path=require(_0xeae6('0x1'));var fs=require('fs');var _=require(_0xeae6('0x2'));var pkginfo=require(_0xeae6('0x3'))(module,_0xeae6('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xeae6('0x5'))['exec'];var db=require(_0xeae6('0x6'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xeae6('0x7'));var git=require(_0xeae6('0x8'))(config['root']);exports[_0xeae6('0x9')]=function(_0x44d211,_0x59ec94){var _0x551f45={'current':module[_0xeae6('0xa')][_0xeae6('0x4')],'phonebar':0x2};if(_0x44d211[_0xeae6('0xb')]&&_0x44d211[_0xeae6('0xb')][_0xeae6('0xc')]){return git['fetch']()[_0xeae6('0xd')](function(_0x21d2d8,_0x592ad2){_0x551f45[_0xeae6('0xc')]=(_0x21d2d8?module[_0xeae6('0xa')][_0xeae6('0x4')]:_0x592ad2[_0xeae6('0xc')])||_0xeae6('0xe');return _0x59ec94['status'](0xc8)[_0xeae6('0xf')](_0x551f45);});}else{return _0x59ec94['status'](0xc8)['json'](_0x551f45);}};exports[_0xeae6('0x10')]=function(_0x433194,_0x1741a5){return git[_0xeae6('0x10')]([_0xeae6('0x11'),_0xeae6('0x12')],function(_0x209fe2){if(_0x209fe2){logger[_0xeae6('0x13')](_0x209fe2);return _0x1741a5[_0xeae6('0x14')](0x1f4)['json'](_0x209fe2);}logger['info'](_0xeae6('0x15'));return _0x1741a5[_0xeae6('0x14')](0xc8)[_0xeae6('0xf')]({'output':_0xeae6('0x16')});});};exports['reset']=function(_0x257290,_0x3376b6){return git[_0xeae6('0x17')]([_0xeae6('0x18'),_0xeae6('0x19')],function(_0xc99e){if(_0xc99e){logger[_0xeae6('0x13')](_0xc99e);return _0x3376b6[_0xeae6('0x14')](0x1f4)['json'](_0xc99e);}logger['info'](_0xeae6('0x1a'));return _0x3376b6['status'](0xc8)[_0xeae6('0xf')]({'output':_0xeae6('0x1b')});});};exports[_0xeae6('0x1c')]=function(_0x48843c,_0x145bfa){exec(_0xeae6('0x1d'),function(_0x2dbc6d,_0x1e8c0f,_0xfd44b5){logger[_0xeae6('0x1e')](_0x1e8c0f);logger[_0xeae6('0x1e')](_0xfd44b5);if(_0x2dbc6d){logger[_0xeae6('0x13')](_0x2dbc6d);return _0x145bfa['status'](0x1f4)['json'](_0x2dbc6d);}return _0x145bfa['status'](0xc8)[_0xeae6('0xf')]({'output':_0x1e8c0f});});};exports[_0xeae6('0x1f')]=function(_0x47435b,_0x1b0128){return pm2[_0xeae6('0x1f')](_0xeae6('0x20'))[_0xeae6('0x21')](function(_0x4e9d77){logger[_0xeae6('0x1e')]('pm2\x20restart\x20motion\x20%s',_0x4e9d77);return _0x1b0128['status'](0xc8)['json']({'output':_0xeae6('0x22')});})[_0xeae6('0x23')](function(_0x56f857){logger[_0xeae6('0x13')](_0x56f857);return _0x1b0128['status'](0x1f4)['json'](_0x56f857);});};exports['migrations']=function(_0x22fa08,_0x21a54e){var _0x1f702a=fs['readdirSync'](path[_0xeae6('0x24')](config[_0xeae6('0x25')],_0xeae6('0x26'),'migrations'));var _0x54bee5=[];for(var _0x2c3a4e=0x0;_0x2c3a4e<_0x1f702a[_0xeae6('0x27')];_0x2c3a4e++){var _0x10b576=_0x1f702a[_0x2c3a4e][_0xeae6('0x28')](_0xeae6('0x29'),'');if(compareVersions(module[_0xeae6('0xa')][_0xeae6('0x4')],_0x10b576)===-0x1){_0x54bee5[_0xeae6('0x2a')](_0x10b576);}}if(_0x54bee5[_0xeae6('0x27')]){var _0x1726cd=_0x54bee5[_0xeae6('0x2b')](compareVersions);var _0x45fb24=new Umzug({'storage':_0xeae6('0x2c'),'storageOptions':{'model':db['Migration'],'modelName':_0xeae6('0x2d'),'columnName':_0xeae6('0x4')},'migrations':{'params':[db[_0xeae6('0x2c')][_0xeae6('0x2e')](),db[_0xeae6('0x2c')][_0xeae6('0x2f')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xeae6('0x24')](config[_0xeae6('0x25')],_0xeae6('0x26'),_0xeae6('0x30')),'pattern':/\.js$/}});_0x45fb24['up']({'migrations':_[_0xeae6('0x31')](_0x1726cd,function(_0x31cfe3){return _0x31cfe3+_0xeae6('0x29');})})[_0xeae6('0x21')](function(){return _0x21a54e[_0xeae6('0x14')](0xc8)['json']({'output':_0xeae6('0x32')+module[_0xeae6('0xa')][_0xeae6('0x4')]+_0xeae6('0x33')+_['last'](_0x1726cd),'migrations':_[_0xeae6('0x24')](_0x1726cd)});})[_0xeae6('0x23')](function(_0x15eb87){if(_0x15eb87 instanceof db['sequelize'][_0xeae6('0x34')]){return _0x21a54e['status'](0xc8)[_0xeae6('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x21a54e[_0xeae6('0x14')](0x1f4)[_0xeae6('0xf')](_0x15eb87);}});}else{return _0x21a54e['status'](0xc8)[_0xeae6('0xf')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7516b31..6f3a6de 100644 --- a/server/api/voiceAgentReport/index.js +++ b/server/api/voiceAgentReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','get','/describe','describe'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')]('/',auth[_0x7b7e('0xc')](),controller['create']);router[_0x7b7e('0xf')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);router[_0x7b7e('0x11')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x12')]);module[_0x7b7e('0x13')]=router; \ No newline at end of file +var _0x0713=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x502742,_0xad2771){var _0x462096=function(_0x238512){while(--_0x238512){_0x502742['push'](_0x502742['shift']());}};_0x462096(++_0xad2771);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xd'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d0b1244..ac03a4a 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xa630,0xbe));var _0x0a63=function(_0x5d77bf,_0x1a1808){_0x5d77bf=_0x5d77bf-0x0;var _0x591804=_0xa630[_0x5d77bf];return _0x591804;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a63('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a63('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0a63('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0a63('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0a63('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x0a63('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x0a63('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0a63('0x4')]},'agentcomplete':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0a63('0x4')]},'agentacw':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0a63('0x2')]},'lastevent':{'type':Sequelize[_0x0a63('0x2')]},'channel':{'type':Sequelize[_0x0a63('0x2')]},'channelstate':{'type':Sequelize[_0x0a63('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0a63('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0a63('0x2')]},'connectedlinename':{'type':Sequelize[_0x0a63('0x2')]},'language':{'type':Sequelize[_0x0a63('0x2')]},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize[_0x0a63('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0a63('0x2')]},'destchannel':{'type':Sequelize[_0x0a63('0x2')]},'destchannelstate':{'type':Sequelize[_0x0a63('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x0a63('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x0a63('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0a63('0x2')]},'destlanguage':{'type':Sequelize[_0x0a63('0x2')]},'destaccountcode':{'type':Sequelize[_0x0a63('0x2')]},'destcontext':{'type':Sequelize[_0x0a63('0x2')]},'destexten':{'type':Sequelize[_0x0a63('0x2')]},'destpriority':{'type':Sequelize[_0x0a63('0x2')]},'destuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0a63('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0a63('0x6')},'transferexten':{'type':Sequelize[_0x0a63('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0a63('0x2')]},'agententerreason':{'type':Sequelize[_0x0a63('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x12ca65,_0x1bdef9){var _0x2bfa48=function(_0x38f6ca){while(--_0x38f6ca){_0x12ca65['push'](_0x12ca65['shift']());}};_0x2bfa48(++_0x1bdef9);}(_0x425d,0x1e0));var _0xd425=function(_0x2dd81a,_0xe73ee7){_0x2dd81a=_0x2dd81a-0x0;var _0x371ada=_0x425d[_0x2dd81a];return _0x371ada;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'type':{'type':Sequelize[_0xd425('0x1')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'queue':{'type':Sequelize[_0xd425('0x1')]},'interface':{'type':Sequelize[_0xd425('0x1')]},'membername':{'type':Sequelize[_0xd425('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd425('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd425('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd425('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x3')]},'agentcomplete':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd425('0x3')]},'agentacw':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd425('0x3')]},'reason':{'type':Sequelize[_0xd425('0x1')]},'lastevent':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize[_0xd425('0x1')]},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x1')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd425('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xd425('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd425('0x1')],'comment':_0xd425('0x5')},'transferexten':{'type':Sequelize[_0xd425('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd425('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 99fab19..2711b35 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52aa=['query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','catch','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','update','then','destroy','end','error','name','send','render','merge','body','contact','agent','interaction','index','VoiceAgentReport','fieldName','type','key','model','map','keys'];(function(_0x20473a,_0x38b93f){var _0x5b11ff=function(_0xddd1d2){while(--_0xddd1d2){_0x20473a['push'](_0x20473a['shift']());}};_0x5b11ff(++_0x38b93f);}(_0x52aa,0x102));var _0xa52a=function(_0x411f64,_0x6d0133){_0x411f64=_0x411f64-0x0;var _0x5ed013=_0x52aa[_0x411f64];return _0x5ed013;};'use strict';var emlformat=require(_0xa52a('0x0'));var rimraf=require(_0xa52a('0x1'));var zipdir=require(_0xa52a('0x2'));var jsonpatch=require(_0xa52a('0x3'));var rp=require('request-promise');var moment=require(_0xa52a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa52a('0x5'));var util=require(_0xa52a('0x6'));var path=require(_0xa52a('0x7'));var sox=require('sox');var csv=require(_0xa52a('0x8'));var ejs=require(_0xa52a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa52a('0xa'));var squel=require(_0xa52a('0xb'));var crypto=require(_0xa52a('0xc'));var jsforce=require(_0xa52a('0xd'));var deskjs=require(_0xa52a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa52a('0xf'));var Papa=require('papaparse');var Redis=require(_0xa52a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa52a('0x11'));var as=require(_0xa52a('0x12'));var hardwareService=require(_0xa52a('0x13'));var logger=require(_0xa52a('0x14'))(_0xa52a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa52a('0x16'));var db=require(_0xa52a('0x17'))['db'];function respondWithStatusCode(_0x382292,_0x28b8be){_0x28b8be=_0x28b8be||0xcc;return function(_0x24034f){if(_0x24034f){return _0x382292[_0xa52a('0x18')](_0x28b8be);}return _0x382292[_0xa52a('0x19')](_0x28b8be)['end']();};}function respondWithResult(_0x14a0df,_0x3b02e1){_0x3b02e1=_0x3b02e1||0xc8;return function(_0xc7a661){if(_0xc7a661){return _0x14a0df[_0xa52a('0x19')](_0x3b02e1)[_0xa52a('0x1a')](_0xc7a661);}};}function respondWithFilteredResult(_0x2ea4a8,_0x2ab2c7){return function(_0x3b139c){if(_0x3b139c){var _0x7402f8=typeof _0x2ab2c7['offset']===_0xa52a('0x1b')&&typeof _0x2ab2c7[_0xa52a('0x1c')]==='undefined';var _0x443f78=_0x3b139c[_0xa52a('0x1d')];var _0x4999db=_0x7402f8?0x0:_0x2ab2c7[_0xa52a('0x1e')];var _0x97fc57=_0x7402f8?_0x3b139c[_0xa52a('0x1d')]:_0x2ab2c7['offset']+_0x2ab2c7[_0xa52a('0x1c')];var _0x341702;if(_0x97fc57>=_0x443f78){_0x97fc57=_0x443f78;_0x341702=0xc8;}else{_0x341702=0xce;}_0x2ea4a8['status'](_0x341702);return _0x2ea4a8['set'](_0xa52a('0x1f'),_0x4999db+'-'+_0x97fc57+'/'+_0x443f78)[_0xa52a('0x1a')](_0x3b139c);}return null;};}function patchUpdates(_0x1423a0){return function(_0x5332a1){try{jsonpatch['apply'](_0x5332a1,_0x1423a0,!![]);}catch(_0x2ab546){return BPromise[_0xa52a('0x20')](_0x2ab546);}return _0x5332a1['save']();};}function saveUpdates(_0x4f7138,_0x28ca31){return function(_0x4385a6){if(_0x4385a6){return _0x4385a6[_0xa52a('0x21')](_0x4f7138)[_0xa52a('0x22')](function(_0x446a7a){return _0x446a7a;});}return null;};}function removeEntity(_0x45300a,_0x22f845){return function(_0x58b7f8){if(_0x58b7f8){return _0x58b7f8[_0xa52a('0x23')]()[_0xa52a('0x22')](function(){_0x45300a[_0xa52a('0x19')](0xcc)[_0xa52a('0x24')]();});}};}function handleEntityNotFound(_0x7c0a85,_0x567235){return function(_0x527381){if(!_0x527381){_0x7c0a85['sendStatus'](0x194);}return _0x527381;};}function handleError(_0x2c638c,_0x53ee75){_0x53ee75=_0x53ee75||0x1f4;return function(_0x227633){logger[_0xa52a('0x25')](_0x227633['stack']);if(_0x227633[_0xa52a('0x26')]){delete _0x227633[_0xa52a('0x26')];}_0x2c638c[_0xa52a('0x19')](_0x53ee75)[_0xa52a('0x27')](_0x227633);};}function getMustacheRender(_0x576335,_0x20c3df){return Mustache[_0xa52a('0x28')](_0x576335,_[_0xa52a('0x29')](_0x20c3df[_0xa52a('0x2a')],{'contact':_0x20c3df[_0xa52a('0x2b')],'message':_0x20c3df['message'],'agent':_0x20c3df[_0xa52a('0x2c')],'interaction':_0x20c3df[_0xa52a('0x2d')],'account':_0x20c3df['account']}))||'';}exports[_0xa52a('0x2e')]=function(_0x3788fb,_0x4dd0d1){var _0x3570e9={},_0x4b3023={},_0x800b1a={'count':0x0,'rows':[]};var _0x23327a=_['map'](db[_0xa52a('0x2f')]['rawAttributes'],function(_0x4f60d8){return{'name':_0x4f60d8[_0xa52a('0x30')],'type':_0x4f60d8[_0xa52a('0x31')][_0xa52a('0x32')]};});_0x4b3023[_0xa52a('0x33')]=_[_0xa52a('0x34')](_0x23327a,_0xa52a('0x26'));_0x4b3023['query']=_[_0xa52a('0x35')](_0x3788fb[_0xa52a('0x36')]);_0x4b3023[_0xa52a('0x37')]=_[_0xa52a('0x38')](_0x4b3023['model'],_0x4b3023[_0xa52a('0x36')]);_0x3570e9[_0xa52a('0x39')]=_[_0xa52a('0x38')](_0x4b3023[_0xa52a('0x33')],qs[_0xa52a('0x3a')](_0x3788fb['query'][_0xa52a('0x3a')]));_0x3570e9['attributes']=_0x3570e9[_0xa52a('0x39')]['length']?_0x3570e9[_0xa52a('0x39')]:_0x4b3023[_0xa52a('0x33')];if(!_0x3788fb['query'][_0xa52a('0x3b')]('nolimit')){_0x3570e9[_0xa52a('0x1c')]=qs[_0xa52a('0x1c')](_0x3788fb[_0xa52a('0x36')][_0xa52a('0x1c')]);_0x3570e9[_0xa52a('0x1e')]=qs['offset'](_0x3788fb['query'][_0xa52a('0x1e')]);}_0x3570e9['order']=qs[_0xa52a('0x3c')](_0x3788fb['query'][_0xa52a('0x3c')]);_0x3570e9[_0xa52a('0x3d')]=qs[_0xa52a('0x37')](_[_0xa52a('0x3e')](_0x3788fb['query'],_0x4b3023[_0xa52a('0x37')]),_0x23327a);if(_0x3788fb[_0xa52a('0x36')][_0xa52a('0x3f')]){_0x3570e9['where']=_[_0xa52a('0x29')](_0x3570e9[_0xa52a('0x3d')],{'$or':_[_0xa52a('0x34')](_0x23327a,function(_0x5ad81f){if(_0x5ad81f[_0xa52a('0x31')]!==_0xa52a('0x40')){var _0x5246f8={};_0x5246f8[_0x5ad81f['name']]={'$like':'%'+_0x3788fb['query'][_0xa52a('0x3f')]+'%'};return _0x5246f8;}})});}_0x3570e9=_['merge']({},_0x3570e9,_0x3788fb[_0xa52a('0x41')]);var _0x219fb5={'where':_0x3570e9[_0xa52a('0x3d')]};return db['VoiceAgentReport'][_0xa52a('0x1d')](_0x219fb5)[_0xa52a('0x22')](function(_0x82f5f5){_0x800b1a[_0xa52a('0x1d')]=_0x82f5f5;if(_0x3788fb[_0xa52a('0x36')]['includeAll']){_0x3570e9[_0xa52a('0x42')]=[{'all':!![]}];}return db[_0xa52a('0x2f')][_0xa52a('0x43')](_0x3570e9);})['then'](function(_0x294926){_0x800b1a[_0xa52a('0x44')]=_0x294926;return _0x800b1a;})[_0xa52a('0x22')](respondWithFilteredResult(_0x4dd0d1,_0x3570e9))['catch'](handleError(_0x4dd0d1,null));};exports[_0xa52a('0x45')]=function(_0xb542b7,_0x413de1){var _0x19b656={'raw':![],'where':{'id':_0xb542b7[_0xa52a('0x46')]['id']}},_0x3b5ef7={};_0x3b5ef7[_0xa52a('0x33')]=_[_0xa52a('0x35')](db[_0xa52a('0x2f')][_0xa52a('0x47')]);_0x3b5ef7[_0xa52a('0x36')]=_['keys'](_0xb542b7[_0xa52a('0x36')]);_0x3b5ef7[_0xa52a('0x37')]=_['intersection'](_0x3b5ef7['model'],_0x3b5ef7[_0xa52a('0x36')]);_0x19b656['attributes']=_[_0xa52a('0x38')](_0x3b5ef7[_0xa52a('0x33')],qs[_0xa52a('0x3a')](_0xb542b7[_0xa52a('0x36')][_0xa52a('0x3a')]));_0x19b656['attributes']=_0x19b656[_0xa52a('0x39')][_0xa52a('0x48')]?_0x19b656[_0xa52a('0x39')]:_0x3b5ef7[_0xa52a('0x33')];if(_0xb542b7['query'][_0xa52a('0x49')]){_0x19b656['include']=[{'all':!![]}];}_0x19b656=_['merge']({},_0x19b656,_0xb542b7[_0xa52a('0x41')]);return db[_0xa52a('0x2f')][_0xa52a('0x4a')](_0x19b656)[_0xa52a('0x22')](handleEntityNotFound(_0x413de1,null))[_0xa52a('0x22')](respondWithResult(_0x413de1,null))[_0xa52a('0x4b')](handleError(_0x413de1,null));};exports['create']=function(_0x42e814,_0xd62be2){return db[_0xa52a('0x2f')][_0xa52a('0x4c')](_0x42e814['body'],{})[_0xa52a('0x22')](respondWithResult(_0xd62be2,0xc9))[_0xa52a('0x4b')](handleError(_0xd62be2,null));};exports[_0xa52a('0x21')]=function(_0x368e66,_0x40f7d4){if(_0x368e66[_0xa52a('0x2a')]['id']){delete _0x368e66['body']['id'];}return db[_0xa52a('0x2f')][_0xa52a('0x4a')]({'where':{'id':_0x368e66['params']['id']}})[_0xa52a('0x22')](handleEntityNotFound(_0x40f7d4,null))[_0xa52a('0x22')](saveUpdates(_0x368e66[_0xa52a('0x2a')],null))['then'](respondWithResult(_0x40f7d4,null))[_0xa52a('0x4b')](handleError(_0x40f7d4,null));};exports['destroy']=function(_0x3aa8b8,_0x4f33c2){return db[_0xa52a('0x2f')][_0xa52a('0x4a')]({'where':{'id':_0x3aa8b8[_0xa52a('0x46')]['id']}})[_0xa52a('0x22')](handleEntityNotFound(_0x4f33c2,null))[_0xa52a('0x22')](removeEntity(_0x4f33c2,null))[_0xa52a('0x4b')](handleError(_0x4f33c2,null));};exports[_0xa52a('0x4d')]=function(_0x372036,_0x3839e6){return db[_0xa52a('0x2f')][_0xa52a('0x4d')]()[_0xa52a('0x22')](respondWithResult(_0x3839e6,null))[_0xa52a('0x4b')](handleError(_0x3839e6,null));}; \ No newline at end of file +var _0x2120=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','merge','contact','message','agent','interaction','map','type','key','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','VoiceAgentReport','includeAll','include','findAll','show','params','rawAttributes','intersection','find','catch','create','body','describe','eml-format'];(function(_0x4fe684,_0x3b6019){var _0x2c1667=function(_0x8c92ae){while(--_0x8c92ae){_0x4fe684['push'](_0x4fe684['shift']());}};_0x2c1667(++_0x3b6019);}(_0x2120,0x143));var _0x0212=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x2120[_0x596f6e];return _0x1e0803;};'use strict';var emlformat=require(_0x0212('0x0'));var rimraf=require(_0x0212('0x1'));var zipdir=require(_0x0212('0x2'));var jsonpatch=require(_0x0212('0x3'));var rp=require(_0x0212('0x4'));var moment=require(_0x0212('0x5'));var BPromise=require(_0x0212('0x6'));var Mustache=require('mustache');var util=require(_0x0212('0x7'));var path=require(_0x0212('0x8'));var sox=require('sox');var csv=require(_0x0212('0x9'));var ejs=require(_0x0212('0xa'));var fs=require('fs');var fs_extra=require(_0x0212('0xb'));var _=require(_0x0212('0xc'));var squel=require(_0x0212('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0212('0xe'));var toCsv=require(_0x0212('0x9'));var querystring=require(_0x0212('0xf'));var Papa=require(_0x0212('0x10'));var Redis=require(_0x0212('0x11'));var authService=require(_0x0212('0x12'));var qs=require(_0x0212('0x13'));var as=require(_0x0212('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0212('0x15'))(_0x0212('0x16'));var utils=require(_0x0212('0x17'));var config=require(_0x0212('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0212('0x19'))['db'];function respondWithStatusCode(_0x126b9d,_0x30c446){_0x30c446=_0x30c446||0xcc;return function(_0x5008fd){if(_0x5008fd){return _0x126b9d['sendStatus'](_0x30c446);}return _0x126b9d[_0x0212('0x1a')](_0x30c446)[_0x0212('0x1b')]();};}function respondWithResult(_0xc28f4a,_0x2b59c7){_0x2b59c7=_0x2b59c7||0xc8;return function(_0x248af5){if(_0x248af5){return _0xc28f4a[_0x0212('0x1a')](_0x2b59c7)[_0x0212('0x1c')](_0x248af5);}};}function respondWithFilteredResult(_0x261ce0,_0x3a7b47){return function(_0x8a3688){if(_0x8a3688){var _0x52046=typeof _0x3a7b47[_0x0212('0x1d')]==='undefined'&&typeof _0x3a7b47[_0x0212('0x1e')]===_0x0212('0x1f');var _0x2674c6=_0x8a3688[_0x0212('0x20')];var _0x18fedf=_0x52046?0x0:_0x3a7b47[_0x0212('0x1d')];var _0x25c395=_0x52046?_0x8a3688[_0x0212('0x20')]:_0x3a7b47['offset']+_0x3a7b47['limit'];var _0x22f40e;if(_0x25c395>=_0x2674c6){_0x25c395=_0x2674c6;_0x22f40e=0xc8;}else{_0x22f40e=0xce;}_0x261ce0['status'](_0x22f40e);return _0x261ce0[_0x0212('0x21')](_0x0212('0x22'),_0x18fedf+'-'+_0x25c395+'/'+_0x2674c6)[_0x0212('0x1c')](_0x8a3688);}return null;};}function patchUpdates(_0x56de9d){return function(_0x46fc5a){try{jsonpatch[_0x0212('0x23')](_0x46fc5a,_0x56de9d,!![]);}catch(_0x324da3){return BPromise[_0x0212('0x24')](_0x324da3);}return _0x46fc5a[_0x0212('0x25')]();};}function saveUpdates(_0x53a880,_0x18306d){return function(_0x32e9ea){if(_0x32e9ea){return _0x32e9ea[_0x0212('0x26')](_0x53a880)[_0x0212('0x27')](function(_0x4a8de2){return _0x4a8de2;});}return null;};}function removeEntity(_0x462680,_0x53295b){return function(_0x95c173){if(_0x95c173){return _0x95c173[_0x0212('0x28')]()['then'](function(){_0x462680['status'](0xcc)[_0x0212('0x1b')]();});}};}function handleEntityNotFound(_0x368231,_0x284543){return function(_0x5df622){if(!_0x5df622){_0x368231[_0x0212('0x29')](0x194);}return _0x5df622;};}function handleError(_0x36a5c7,_0x105bda){_0x105bda=_0x105bda||0x1f4;return function(_0x4fd483){logger[_0x0212('0x2a')](_0x4fd483[_0x0212('0x2b')]);if(_0x4fd483[_0x0212('0x2c')]){delete _0x4fd483['name'];}_0x36a5c7['status'](_0x105bda)[_0x0212('0x2d')](_0x4fd483);};}function getMustacheRender(_0x3b8e4e,_0x5a7b94){return Mustache['render'](_0x3b8e4e,_[_0x0212('0x2e')](_0x5a7b94['body'],{'contact':_0x5a7b94[_0x0212('0x2f')],'message':_0x5a7b94[_0x0212('0x30')],'agent':_0x5a7b94[_0x0212('0x31')],'interaction':_0x5a7b94[_0x0212('0x32')],'account':_0x5a7b94['account']}))||'';}exports['index']=function(_0x6782bc,_0x3286a5){var _0x1ca563={},_0x391274={},_0x2fc983={'count':0x0,'rows':[]};var _0x670896=_[_0x0212('0x33')](db['VoiceAgentReport']['rawAttributes'],function(_0x160a43){return{'name':_0x160a43['fieldName'],'type':_0x160a43[_0x0212('0x34')][_0x0212('0x35')]};});_0x391274['model']=_['map'](_0x670896,_0x0212('0x2c'));_0x391274['query']=_[_0x0212('0x36')](_0x6782bc[_0x0212('0x37')]);_0x391274[_0x0212('0x38')]=_['intersection'](_0x391274['model'],_0x391274['query']);_0x1ca563[_0x0212('0x39')]=_['intersection'](_0x391274[_0x0212('0x3a')],qs['fields'](_0x6782bc['query'][_0x0212('0x3b')]));_0x1ca563['attributes']=_0x1ca563[_0x0212('0x39')][_0x0212('0x3c')]?_0x1ca563[_0x0212('0x39')]:_0x391274[_0x0212('0x3a')];if(!_0x6782bc['query'][_0x0212('0x3d')](_0x0212('0x3e'))){_0x1ca563['limit']=qs[_0x0212('0x1e')](_0x6782bc[_0x0212('0x37')][_0x0212('0x1e')]);_0x1ca563[_0x0212('0x1d')]=qs[_0x0212('0x1d')](_0x6782bc[_0x0212('0x37')][_0x0212('0x1d')]);}_0x1ca563[_0x0212('0x3f')]=qs[_0x0212('0x40')](_0x6782bc[_0x0212('0x37')][_0x0212('0x40')]);_0x1ca563[_0x0212('0x41')]=qs[_0x0212('0x38')](_['pick'](_0x6782bc[_0x0212('0x37')],_0x391274['filters']),_0x670896);if(_0x6782bc[_0x0212('0x37')][_0x0212('0x42')]){_0x1ca563['where']=_[_0x0212('0x2e')](_0x1ca563[_0x0212('0x41')],{'$or':_['map'](_0x670896,function(_0x2ab857){if(_0x2ab857[_0x0212('0x34')]!=='VIRTUAL'){var _0x476478={};_0x476478[_0x2ab857['name']]={'$like':'%'+_0x6782bc[_0x0212('0x37')][_0x0212('0x42')]+'%'};return _0x476478;}})});}_0x1ca563=_[_0x0212('0x2e')]({},_0x1ca563,_0x6782bc[_0x0212('0x43')]);var _0x159418={'where':_0x1ca563['where']};return db[_0x0212('0x44')]['count'](_0x159418)['then'](function(_0x57cab3){_0x2fc983[_0x0212('0x20')]=_0x57cab3;if(_0x6782bc[_0x0212('0x37')][_0x0212('0x45')]){_0x1ca563[_0x0212('0x46')]=[{'all':!![]}];}return db[_0x0212('0x44')][_0x0212('0x47')](_0x1ca563);})[_0x0212('0x27')](function(_0x51e71a){_0x2fc983['rows']=_0x51e71a;return _0x2fc983;})[_0x0212('0x27')](respondWithFilteredResult(_0x3286a5,_0x1ca563))['catch'](handleError(_0x3286a5,null));};exports[_0x0212('0x48')]=function(_0x427049,_0x4475a5){var _0x3f5aa0={'raw':![],'where':{'id':_0x427049[_0x0212('0x49')]['id']}},_0xd4ccc9={};_0xd4ccc9[_0x0212('0x3a')]=_[_0x0212('0x36')](db['VoiceAgentReport'][_0x0212('0x4a')]);_0xd4ccc9[_0x0212('0x37')]=_[_0x0212('0x36')](_0x427049['query']);_0xd4ccc9['filters']=_[_0x0212('0x4b')](_0xd4ccc9['model'],_0xd4ccc9[_0x0212('0x37')]);_0x3f5aa0[_0x0212('0x39')]=_[_0x0212('0x4b')](_0xd4ccc9['model'],qs[_0x0212('0x3b')](_0x427049[_0x0212('0x37')][_0x0212('0x3b')]));_0x3f5aa0[_0x0212('0x39')]=_0x3f5aa0['attributes'][_0x0212('0x3c')]?_0x3f5aa0[_0x0212('0x39')]:_0xd4ccc9[_0x0212('0x3a')];if(_0x427049['query'][_0x0212('0x45')]){_0x3f5aa0[_0x0212('0x46')]=[{'all':!![]}];}_0x3f5aa0=_['merge']({},_0x3f5aa0,_0x427049[_0x0212('0x43')]);return db[_0x0212('0x44')][_0x0212('0x4c')](_0x3f5aa0)[_0x0212('0x27')](handleEntityNotFound(_0x4475a5,null))[_0x0212('0x27')](respondWithResult(_0x4475a5,null))[_0x0212('0x4d')](handleError(_0x4475a5,null));};exports[_0x0212('0x4e')]=function(_0x59d1a1,_0x503346){return db[_0x0212('0x44')][_0x0212('0x4e')](_0x59d1a1['body'],{})[_0x0212('0x27')](respondWithResult(_0x503346,0xc9))[_0x0212('0x4d')](handleError(_0x503346,null));};exports[_0x0212('0x26')]=function(_0x701a3,_0x1957e3){if(_0x701a3['body']['id']){delete _0x701a3[_0x0212('0x4f')]['id'];}return db[_0x0212('0x44')][_0x0212('0x4c')]({'where':{'id':_0x701a3[_0x0212('0x49')]['id']}})[_0x0212('0x27')](handleEntityNotFound(_0x1957e3,null))[_0x0212('0x27')](saveUpdates(_0x701a3[_0x0212('0x4f')],null))[_0x0212('0x27')](respondWithResult(_0x1957e3,null))[_0x0212('0x4d')](handleError(_0x1957e3,null));};exports[_0x0212('0x28')]=function(_0x32169a,_0x420d2f){return db[_0x0212('0x44')][_0x0212('0x4c')]({'where':{'id':_0x32169a[_0x0212('0x49')]['id']}})['then'](handleEntityNotFound(_0x420d2f,null))[_0x0212('0x27')](removeEntity(_0x420d2f,null))[_0x0212('0x4d')](handleError(_0x420d2f,null));};exports[_0x0212('0x50')]=function(_0x4ba223,_0x21fae0){return db['VoiceAgentReport']['describe']()[_0x0212('0x27')](respondWithResult(_0x21fae0,null))[_0x0212('0x4d')](handleError(_0x21fae0,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 71e64ae..1f76a3c 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88a5=['destuniqueid','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x2f3637,_0x26f649){var _0x208720=function(_0x4bb5e5){while(--_0x4bb5e5){_0x2f3637['push'](_0x2f3637['shift']());}};_0x208720(++_0x26f649);}(_0x88a5,0x90));var _0x588a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x88a5[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x588a('0x0'));var logger=require(_0x588a('0x1'))(_0x588a('0x2'));var moment=require(_0x588a('0x3'));var BPromise=require(_0x588a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x588a('0x5'));var attributes=require(_0x588a('0x6'));module[_0x588a('0x7')]=function(_0x514650,_0x3dd769){return _0x514650[_0x588a('0x8')](_0x588a('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x588a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x535f=['uniqueid','destuniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent'];(function(_0x405d8b,_0x23f87c){var _0x34fecb=function(_0x11b74f){while(--_0x11b74f){_0x405d8b['push'](_0x405d8b['shift']());}};_0x34fecb(++_0x23f87c);}(_0x535f,0x160));var _0xf535=function(_0x2ac42c,_0x400eff){_0x2ac42c=_0x2ac42c-0x0;var _0x29b7f3=_0x535f[_0x2ac42c];return _0x29b7f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf535('0x0'))(_0xf535('0x1'));var moment=require(_0xf535('0x2'));var BPromise=require(_0xf535('0x3'));var rp=require(_0xf535('0x4'));var fs=require('fs');var path=require(_0xf535('0x5'));var rimraf=require(_0xf535('0x6'));var config=require(_0xf535('0x7'));var attributes=require(_0xf535('0x8'));module['exports']=function(_0x1ff8cc,_0x3303c8){return _0x1ff8cc[_0xf535('0x9')](_0xf535('0xa'),attributes,{'tableName':_0xf535('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf535('0xc'),_0xf535('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index fa5f153..17c78a3 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaabf=['rpc','client','info','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','where','attributes','limit','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xaabf,0x11c));var _0xfaab=function(_0x2e963d,_0x15e940){_0x2e963d=_0x2e963d-0x0;var _0x256157=_0xaabf[_0x2e963d];return _0x256157;};'use strict';var _=require('lodash');var util=require(_0xfaab('0x0'));var moment=require('moment');var BPromise=require(_0xfaab('0x1'));var rs=require(_0xfaab('0x2'));var fs=require('fs');var Redis=require(_0xfaab('0x3'));var db=require(_0xfaab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaab('0x5'))(_0xfaab('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfaab('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21a54b,_0x3b7c58,_0x17ca87){return new BPromise(function(_0x56493f,_0x209544){return client['request'](_0x21a54b,_0x17ca87)['then'](function(_0x333430){logger[_0xfaab('0x8')](_0xfaab('0x9'),_0x3b7c58,'request\x20sent');logger[_0xfaab('0xa')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3b7c58,_0xfaab('0xb'),JSON[_0xfaab('0xc')](_0x333430));if(_0x333430[_0xfaab('0xd')]){if(_0x333430['error'][_0xfaab('0xe')]===0x1f4){logger[_0xfaab('0xd')](_0xfaab('0x9'),_0x3b7c58,_0x333430[_0xfaab('0xd')][_0xfaab('0xf')]);return _0x209544(_0x333430['error']['message']);}logger[_0xfaab('0xd')](_0xfaab('0x9'),_0x3b7c58,_0x333430[_0xfaab('0xd')][_0xfaab('0xf')]);return _0x56493f(_0x333430[_0xfaab('0xd')][_0xfaab('0xf')]);}else{logger[_0xfaab('0x8')]('VoiceAgentReport,\x20%s,\x20%s',_0x3b7c58,_0xfaab('0xb'));_0x56493f(_0x333430[_0xfaab('0x10')][_0xfaab('0xf')]);}})[_0xfaab('0x11')](function(_0x19fcd1){logger[_0xfaab('0xd')](_0xfaab('0x9'),_0x3b7c58,_0x19fcd1);_0x209544(_0x19fcd1);});});}exports[_0xfaab('0x12')]=function(_0x2008f2){var _0x8fe170=this;return new Promise(function(_0x1efc71,_0xc7a460){return db[_0xfaab('0x13')][_0xfaab('0x14')](_0x2008f2[_0xfaab('0x15')],{'raw':_0x2008f2[_0xfaab('0x16')]?_0x2008f2[_0xfaab('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x159d7e){logger['info']('CreateVoiceAgentReport',_0x2008f2);logger['debug'](_0xfaab('0x12'),_0x2008f2,JSON[_0xfaab('0xc')](_0x159d7e));_0x1efc71(_0x159d7e);})[_0xfaab('0x11')](function(_0x3e5e87){logger[_0xfaab('0xd')]('CreateVoiceAgentReport',_0x3e5e87[_0xfaab('0xf')],_0x2008f2);_0xc7a460(_0x8fe170['error'](0x1f4,_0x3e5e87['message']));});});};exports[_0xfaab('0x17')]=function(_0x1c5286){var _0xa9b61=this;return new Promise(function(_0x44be01,_0x398302){return db[_0xfaab('0x13')][_0xfaab('0x18')](_0x1c5286['body'],{'raw':_0x1c5286[_0xfaab('0x16')]?_0x1c5286['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c5286[_0xfaab('0x16')]?_0x1c5286[_0xfaab('0x16')][_0xfaab('0x19')]||null:null,'attributes':_0x1c5286['options']?_0x1c5286[_0xfaab('0x16')][_0xfaab('0x1a')]||null:null,'limit':_0x1c5286[_0xfaab('0x16')]?_0x1c5286[_0xfaab('0x16')][_0xfaab('0x1b')]||null:null})[_0xfaab('0x1c')](function(_0x3da98d){logger[_0xfaab('0x8')](_0xfaab('0x17'),_0x1c5286);logger[_0xfaab('0xa')](_0xfaab('0x17'),_0x1c5286,JSON[_0xfaab('0xc')](_0x3da98d));_0x44be01(_0x3da98d);})[_0xfaab('0x11')](function(_0x542c3f){logger[_0xfaab('0xd')](_0xfaab('0x17'),_0x542c3f[_0xfaab('0xf')],_0x1c5286);_0x398302(_0xa9b61[_0xfaab('0xd')](0x1f4,_0x542c3f[_0xfaab('0xf')]));});});}; \ No newline at end of file +var _0xd83d=['stringify','UpdateVoiceAgentReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd83d,0x1c4));var _0xdd83=function(_0x4f5e1f,_0x2c6bec){_0x4f5e1f=_0x4f5e1f-0x0;var _0x45fa0c=_0xd83d[_0x4f5e1f];return _0x45fa0c;};'use strict';var _=require(_0xdd83('0x0'));var util=require(_0xdd83('0x1'));var moment=require(_0xdd83('0x2'));var BPromise=require(_0xdd83('0x3'));var rs=require(_0xdd83('0x4'));var fs=require('fs');var Redis=require(_0xdd83('0x5'));var db=require(_0xdd83('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd83('0x7'))(_0xdd83('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd83('0x9'));var client=jayson['client'][_0xdd83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x570a45,_0x4b26db,_0x172baf){return new BPromise(function(_0xb17249,_0x5235f4){return client[_0xdd83('0xb')](_0x570a45,_0x172baf)[_0xdd83('0xc')](function(_0x270d63){logger[_0xdd83('0xd')](_0xdd83('0xe'),_0x4b26db,_0xdd83('0xf'));logger['debug'](_0xdd83('0x10'),_0x4b26db,'request\x20sent',JSON['stringify'](_0x270d63));if(_0x270d63[_0xdd83('0x11')]){if(_0x270d63[_0xdd83('0x11')][_0xdd83('0x12')]===0x1f4){logger[_0xdd83('0x11')](_0xdd83('0xe'),_0x4b26db,_0x270d63[_0xdd83('0x11')][_0xdd83('0x13')]);return _0x5235f4(_0x270d63['error'][_0xdd83('0x13')]);}logger[_0xdd83('0x11')](_0xdd83('0xe'),_0x4b26db,_0x270d63[_0xdd83('0x11')][_0xdd83('0x13')]);return _0xb17249(_0x270d63[_0xdd83('0x11')]['message']);}else{logger[_0xdd83('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x4b26db,_0xdd83('0xf'));_0xb17249(_0x270d63[_0xdd83('0x14')][_0xdd83('0x13')]);}})['catch'](function(_0x5a0e4c){logger[_0xdd83('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x4b26db,_0x5a0e4c);_0x5235f4(_0x5a0e4c);});});}exports[_0xdd83('0x15')]=function(_0x5d708a){var _0x310cb9=this;return new Promise(function(_0x34ec04,_0x3151f2){return db[_0xdd83('0x16')][_0xdd83('0x17')](_0x5d708a[_0xdd83('0x18')],{'raw':_0x5d708a[_0xdd83('0x19')]?_0x5d708a[_0xdd83('0x19')][_0xdd83('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x160520){logger[_0xdd83('0xd')](_0xdd83('0x15'),_0x5d708a);logger[_0xdd83('0x1b')](_0xdd83('0x15'),_0x5d708a,JSON[_0xdd83('0x1c')](_0x160520));_0x34ec04(_0x160520);})['catch'](function(_0x1f9a11){logger['error'](_0xdd83('0x15'),_0x1f9a11[_0xdd83('0x13')],_0x5d708a);_0x3151f2(_0x310cb9[_0xdd83('0x11')](0x1f4,_0x1f9a11[_0xdd83('0x13')]));});});};exports[_0xdd83('0x1d')]=function(_0x4bbba5){var _0x1c08ac=this;return new Promise(function(_0x19aa8a,_0x1caac8){return db[_0xdd83('0x16')][_0xdd83('0x1e')](_0x4bbba5[_0xdd83('0x18')],{'raw':_0x4bbba5[_0xdd83('0x19')]?_0x4bbba5[_0xdd83('0x19')][_0xdd83('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbba5[_0xdd83('0x19')]?_0x4bbba5[_0xdd83('0x19')][_0xdd83('0x1f')]||null:null,'attributes':_0x4bbba5['options']?_0x4bbba5[_0xdd83('0x19')]['attributes']||null:null,'limit':_0x4bbba5[_0xdd83('0x19')]?_0x4bbba5[_0xdd83('0x19')]['limit']||null:null})[_0xdd83('0xc')](function(_0x2709a3){logger['info']('UpdateVoiceAgentReport',_0x4bbba5);logger['debug'](_0xdd83('0x1d'),_0x4bbba5,JSON[_0xdd83('0x1c')](_0x2709a3));_0x19aa8a(_0x2709a3);})['catch'](function(_0x213c85){logger[_0xdd83('0x11')]('UpdateVoiceAgentReport',_0x213c85[_0xdd83('0x13')],_0x4bbba5);_0x1caac8(_0x1c08ac[_0xdd83('0x11')](0x1f4,_0x213c85[_0xdd83('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3c8fb35..4c27713 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','show','post'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 1a65460..1b27359 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2123=['ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x55b7a4,_0x32f472){var _0x1fe954=function(_0x2019e3){while(--_0x2019e3){_0x55b7a4['push'](_0x55b7a4['shift']());}};_0x1fe954(++_0x32f472);}(_0x2123,0x190));var _0x3212=function(_0x30c19a,_0x31e308){_0x30c19a=_0x30c19a-0x0;var _0xbe7598=_0x2123[_0x30c19a];return _0xbe7598;};'use strict';var Sequelize=require(_0x3212('0x0'));module[_0x3212('0x1')]={'uniqueid':{'type':Sequelize[_0x3212('0x2')]},'type':{'type':Sequelize[_0x3212('0x3')](_0x3212('0x4'),_0x3212('0x5'),_0x3212('0x6'),_0x3212('0x7'),_0x3212('0x8'),_0x3212('0x9'))},'tag':{'type':Sequelize[_0x3212('0x2')]},'accountcode':{'type':Sequelize[_0x3212('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x3212('0x2')]},'destinationcontext':{'type':Sequelize[_0x3212('0x2')]},'callerid':{'type':Sequelize[_0x3212('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x3212('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x3212('0xa')]},'starttime':{'type':Sequelize[_0x3212('0xb')]},'systemanswertime':{'type':Sequelize[_0x3212('0xb')]},'answertime':{'type':Sequelize[_0x3212('0xb')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x3212('0xc')]},'mohtime':{'type':Sequelize[_0x3212('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3212('0x2')]},'amaflags':{'type':Sequelize[_0x3212('0x2')]},'userfield':{'type':Sequelize[_0x3212('0x2')]},'userDisposition':{'type':Sequelize[_0x3212('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x3212('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x3212('0x2')]},'note':{'type':Sequelize[_0x3212('0x2')]},'prefix':{'type':Sequelize[_0x3212('0x2')]},'routeid':{'type':Sequelize[_0x3212('0xc')]},'sipcallid':{'type':Sequelize[_0x3212('0x2')]}}; \ No newline at end of file +var _0x11e5=['STRING','ENUM','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x32a96b,_0x3745b7){var _0x5da8f1=function(_0x275ca3){while(--_0x275ca3){_0x32a96b['push'](_0x32a96b['shift']());}};_0x5da8f1(++_0x3745b7);}(_0x11e5,0x8b));var _0x511e=function(_0x87e0dc,_0x577dce){_0x87e0dc=_0x87e0dc-0x0;var _0x2cd2d1=_0x11e5[_0x87e0dc];return _0x2cd2d1;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x511e('0x1')]},'type':{'type':Sequelize[_0x511e('0x2')]('inbound',_0x511e('0x3'),_0x511e('0x4'),_0x511e('0x5'),'outbound-fax',_0x511e('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x511e('0x1')]},'destination':{'type':Sequelize[_0x511e('0x1')]},'destinationcontext':{'type':Sequelize[_0x511e('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x511e('0x1')]},'lastapplication':{'type':Sequelize[_0x511e('0x1')]},'lastdata':{'type':Sequelize[_0x511e('0x7')]},'starttime':{'type':Sequelize[_0x511e('0x8')]},'systemanswertime':{'type':Sequelize[_0x511e('0x8')]},'answertime':{'type':Sequelize[_0x511e('0x8')]},'endtime':{'type':Sequelize[_0x511e('0x8')]},'duration':{'type':Sequelize[_0x511e('0x9')]},'billableseconds':{'type':Sequelize[_0x511e('0x9')]},'mohtime':{'type':Sequelize[_0x511e('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x511e('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x511e('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x511e('0x1')]},'note':{'type':Sequelize[_0x511e('0x1')]},'prefix':{'type':Sequelize[_0x511e('0x1')]},'routeid':{'type':Sequelize[_0x511e('0x9')]},'sipcallid':{'type':Sequelize[_0x511e('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 48a893e..3699eb8 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9b6=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','then','sendStatus','error','stack','name','send','render','merge','body','contact','message','index','map','VoiceCallReport','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','fullname','User','catch','show','params','rawAttributes','filters','includeAll','create','destroy','find','describe','uniqueid','user','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe9b6,0x12c));var _0x6e9b=function(_0x188e64,_0x316e7e){_0x188e64=_0x188e64-0x0;var _0x5d2b36=_0xe9b6[_0x188e64];return _0x5d2b36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e9b('0x0'));var zipdir=require(_0x6e9b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e9b('0x2'));var moment=require(_0x6e9b('0x3'));var BPromise=require(_0x6e9b('0x4'));var Mustache=require('mustache');var util=require(_0x6e9b('0x5'));var path=require(_0x6e9b('0x6'));var sox=require('sox');var csv=require(_0x6e9b('0x7'));var ejs=require(_0x6e9b('0x8'));var fs=require('fs');var fs_extra=require(_0x6e9b('0x9'));var _=require('lodash');var squel=require(_0x6e9b('0xa'));var crypto=require('crypto');var jsforce=require(_0x6e9b('0xb'));var deskjs=require(_0x6e9b('0xc'));var toCsv=require(_0x6e9b('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6e9b('0xd'));var authService=require(_0x6e9b('0xe'));var qs=require(_0x6e9b('0xf'));var as=require(_0x6e9b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e9b('0x11'))(_0x6e9b('0x12'));var utils=require('../../config/utils');var config=require(_0x6e9b('0x13'));var licenseUtil=require(_0x6e9b('0x14'));var db=require(_0x6e9b('0x15'))['db'];function respondWithStatusCode(_0x35e3f4,_0x17b46c){_0x17b46c=_0x17b46c||0xcc;return function(_0x28bb33){if(_0x28bb33){return _0x35e3f4['sendStatus'](_0x17b46c);}return _0x35e3f4['status'](_0x17b46c)[_0x6e9b('0x16')]();};}function respondWithResult(_0x761465,_0xa84807){_0xa84807=_0xa84807||0xc8;return function(_0x216d16){if(_0x216d16){return _0x761465['status'](_0xa84807)[_0x6e9b('0x17')](_0x216d16);}};}function respondWithFilteredResult(_0x4e1703,_0x30d7fa){return function(_0x104c5b){if(_0x104c5b){var _0x1dbf2f=typeof _0x30d7fa['offset']===_0x6e9b('0x18')&&typeof _0x30d7fa[_0x6e9b('0x19')]===_0x6e9b('0x18');var _0x552214=_0x104c5b[_0x6e9b('0x1a')];var _0x2ee97f=_0x1dbf2f?0x0:_0x30d7fa['offset'];var _0x161a53=_0x1dbf2f?_0x104c5b[_0x6e9b('0x1a')]:_0x30d7fa[_0x6e9b('0x1b')]+_0x30d7fa[_0x6e9b('0x19')];var _0x4f4784;if(_0x161a53>=_0x552214){_0x161a53=_0x552214;_0x4f4784=0xc8;}else{_0x4f4784=0xce;}_0x4e1703[_0x6e9b('0x1c')](_0x4f4784);return _0x4e1703[_0x6e9b('0x1d')](_0x6e9b('0x1e'),_0x2ee97f+'-'+_0x161a53+'/'+_0x552214)['json'](_0x104c5b);}return null;};}function patchUpdates(_0x27184b){return function(_0x320e49){try{jsonpatch['apply'](_0x320e49,_0x27184b,!![]);}catch(_0x377059){return BPromise[_0x6e9b('0x1f')](_0x377059);}return _0x320e49['save']();};}function saveUpdates(_0x53b4fe,_0x5bda18){return function(_0x1c1ddf){if(_0x1c1ddf){return _0x1c1ddf[_0x6e9b('0x20')](_0x53b4fe)[_0x6e9b('0x21')](function(_0x5e448d){return _0x5e448d;});}return null;};}function removeEntity(_0x23b4df,_0x3fd04c){return function(_0x2722f7){if(_0x2722f7){return _0x2722f7['destroy']()[_0x6e9b('0x21')](function(){_0x23b4df[_0x6e9b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e5f3,_0x92e838){return function(_0x409373){if(!_0x409373){_0x44e5f3[_0x6e9b('0x22')](0x194);}return _0x409373;};}function handleError(_0x3924c0,_0xb882ae){_0xb882ae=_0xb882ae||0x1f4;return function(_0x5bece7){logger[_0x6e9b('0x23')](_0x5bece7[_0x6e9b('0x24')]);if(_0x5bece7['name']){delete _0x5bece7[_0x6e9b('0x25')];}_0x3924c0['status'](_0xb882ae)[_0x6e9b('0x26')](_0x5bece7);};}function getMustacheRender(_0x5ac174,_0x489065){return Mustache[_0x6e9b('0x27')](_0x5ac174,_[_0x6e9b('0x28')](_0x489065[_0x6e9b('0x29')],{'contact':_0x489065[_0x6e9b('0x2a')],'message':_0x489065[_0x6e9b('0x2b')],'agent':_0x489065['agent'],'interaction':_0x489065['interaction'],'account':_0x489065['account']}))||'';}exports[_0x6e9b('0x2c')]=function(_0x6b1df,_0x1dd732){var _0x4830a2={},_0x264ba2={},_0x5c07e8={'count':0x0,'rows':[]};var _0x3fc16d=_[_0x6e9b('0x2d')](db[_0x6e9b('0x2e')]['rawAttributes'],function(_0x414c49){return{'name':_0x414c49[_0x6e9b('0x2f')],'type':_0x414c49[_0x6e9b('0x30')]['key']};});_0x264ba2['model']=_['map'](_0x3fc16d,_0x6e9b('0x25'));_0x264ba2[_0x6e9b('0x31')]=_[_0x6e9b('0x32')](_0x6b1df[_0x6e9b('0x31')]);_0x264ba2['filters']=_[_0x6e9b('0x33')](_0x264ba2[_0x6e9b('0x34')],_0x264ba2[_0x6e9b('0x31')]);_0x4830a2[_0x6e9b('0x35')]=_[_0x6e9b('0x33')](_0x264ba2[_0x6e9b('0x34')],qs[_0x6e9b('0x36')](_0x6b1df['query'][_0x6e9b('0x36')]));_0x4830a2[_0x6e9b('0x35')]=_0x4830a2['attributes'][_0x6e9b('0x37')]?_0x4830a2[_0x6e9b('0x35')]:_0x264ba2[_0x6e9b('0x34')];if(!_0x6b1df[_0x6e9b('0x31')]['hasOwnProperty'](_0x6e9b('0x38'))){_0x4830a2['limit']=qs[_0x6e9b('0x19')](_0x6b1df[_0x6e9b('0x31')]['limit']);_0x4830a2[_0x6e9b('0x1b')]=qs[_0x6e9b('0x1b')](_0x6b1df[_0x6e9b('0x31')][_0x6e9b('0x1b')]);}_0x4830a2[_0x6e9b('0x39')]=qs[_0x6e9b('0x3a')](_0x6b1df['query']['sort']);_0x4830a2[_0x6e9b('0x3b')]=qs['filters'](_[_0x6e9b('0x3c')](_0x6b1df[_0x6e9b('0x31')],_0x264ba2['filters']),_0x3fc16d);if(_0x6b1df[_0x6e9b('0x31')][_0x6e9b('0x3d')]){_0x4830a2['where']=_[_0x6e9b('0x28')](_0x4830a2[_0x6e9b('0x3b')],{'$or':_[_0x6e9b('0x2d')](_0x3fc16d,function(_0x116dd1){if(_0x116dd1[_0x6e9b('0x30')]!==_0x6e9b('0x3e')){var _0x230da0={};_0x230da0[_0x116dd1[_0x6e9b('0x25')]]={'$like':'%'+_0x6b1df[_0x6e9b('0x31')][_0x6e9b('0x3d')]+'%'};return _0x230da0;}})});}_0x4830a2=_[_0x6e9b('0x28')]({},_0x4830a2,_0x6b1df[_0x6e9b('0x3f')]);var _0x1724d5={'where':_0x4830a2['where']};return db[_0x6e9b('0x2e')][_0x6e9b('0x1a')](_0x1724d5)[_0x6e9b('0x21')](function(_0x54ddf5){_0x5c07e8['count']=_0x54ddf5;if(_0x6b1df[_0x6e9b('0x31')]['includeAll']){_0x4830a2[_0x6e9b('0x40')]=[{'attributes':['id',_0x6e9b('0x25'),_0x6e9b('0x41'),'alias'],'model':db[_0x6e9b('0x42')],'as':_0x6e9b('0x42')}];}return db[_0x6e9b('0x2e')]['findAll'](_0x4830a2);})[_0x6e9b('0x21')](function(_0x2ab96e){_0x5c07e8['rows']=_0x2ab96e;return _0x5c07e8;})[_0x6e9b('0x21')](respondWithFilteredResult(_0x1dd732,_0x4830a2))[_0x6e9b('0x43')](handleError(_0x1dd732,null));};exports[_0x6e9b('0x44')]=function(_0x570c45,_0x15b3ce){var _0x3a596f={'raw':!![],'where':{'id':_0x570c45[_0x6e9b('0x45')]['id']}},_0x4f4804={};_0x4f4804['model']=_[_0x6e9b('0x32')](db[_0x6e9b('0x2e')][_0x6e9b('0x46')]);_0x4f4804[_0x6e9b('0x31')]=_[_0x6e9b('0x32')](_0x570c45['query']);_0x4f4804[_0x6e9b('0x47')]=_[_0x6e9b('0x33')](_0x4f4804[_0x6e9b('0x34')],_0x4f4804[_0x6e9b('0x31')]);_0x3a596f['attributes']=_['intersection'](_0x4f4804[_0x6e9b('0x34')],qs[_0x6e9b('0x36')](_0x570c45['query']['fields']));_0x3a596f['attributes']=_0x3a596f[_0x6e9b('0x35')][_0x6e9b('0x37')]?_0x3a596f['attributes']:_0x4f4804['model'];if(_0x570c45[_0x6e9b('0x31')][_0x6e9b('0x48')]){_0x3a596f[_0x6e9b('0x40')]=[{'all':!![]}];}_0x3a596f=_[_0x6e9b('0x28')]({},_0x3a596f,_0x570c45[_0x6e9b('0x3f')]);return db[_0x6e9b('0x2e')]['find'](_0x3a596f)[_0x6e9b('0x21')](handleEntityNotFound(_0x15b3ce,null))[_0x6e9b('0x21')](respondWithResult(_0x15b3ce,null))[_0x6e9b('0x43')](handleError(_0x15b3ce,null));};exports['create']=function(_0x45d955,_0x3d93fe){return db[_0x6e9b('0x2e')][_0x6e9b('0x49')](_0x45d955[_0x6e9b('0x29')],{})['then'](respondWithResult(_0x3d93fe,0xc9))[_0x6e9b('0x43')](handleError(_0x3d93fe,null));};exports[_0x6e9b('0x4a')]=function(_0x22f920,_0x3723cc){return db[_0x6e9b('0x2e')][_0x6e9b('0x4b')]({'where':{'id':_0x22f920[_0x6e9b('0x45')]['id']}})[_0x6e9b('0x21')](handleEntityNotFound(_0x3723cc,null))[_0x6e9b('0x21')](removeEntity(_0x3723cc,null))['catch'](handleError(_0x3723cc,null));};exports[_0x6e9b('0x4c')]=function(_0x510ca4,_0x573d1d){return db[_0x6e9b('0x2e')][_0x6e9b('0x4c')]()['then'](respondWithResult(_0x573d1d,null))[_0x6e9b('0x43')](handleError(_0x573d1d,null));};exports[_0x6e9b('0x20')]=function(_0x4499da,_0x562a02){if(_0x4499da[_0x6e9b('0x29')]['uniqueid']){delete _0x4499da[_0x6e9b('0x29')][_0x6e9b('0x4d')];}return db[_0x6e9b('0x2e')][_0x6e9b('0x4b')]({'where':{'uniqueid':_0x4499da['params']['id'],'UserId':{'$or':[null,_0x4499da[_0x6e9b('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x562a02,null))[_0x6e9b('0x21')](saveUpdates(_0x4499da[_0x6e9b('0x29')],null))['then'](respondWithResult(_0x562a02,null))[_0x6e9b('0x43')](handleError(_0x562a02,null));}; \ No newline at end of file +var _0x9158=['alias','User','findAll','rows','catch','show','rawAttributes','include','find','create','describe','uniqueid','params','user','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','render','body','contact','agent','interaction','account','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','VoiceCallReport','includeAll','fullname'];(function(_0x433502,_0x4aaee9){var _0x5cee48=function(_0x4023fc){while(--_0x4023fc){_0x433502['push'](_0x433502['shift']());}};_0x5cee48(++_0x4aaee9);}(_0x9158,0x16e));var _0x8915=function(_0x1025a0,_0x53d358){_0x1025a0=_0x1025a0-0x0;var _0x17ca0=_0x9158[_0x1025a0];return _0x17ca0;};'use strict';var emlformat=require(_0x8915('0x0'));var rimraf=require(_0x8915('0x1'));var zipdir=require(_0x8915('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8915('0x3'));var moment=require('moment');var BPromise=require(_0x8915('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8915('0x5'));var sox=require(_0x8915('0x6'));var csv=require(_0x8915('0x7'));var ejs=require(_0x8915('0x8'));var fs=require('fs');var fs_extra=require(_0x8915('0x9'));var _=require(_0x8915('0xa'));var squel=require(_0x8915('0xb'));var crypto=require(_0x8915('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8915('0xd'));var toCsv=require(_0x8915('0x7'));var querystring=require(_0x8915('0xe'));var Papa=require(_0x8915('0xf'));var Redis=require(_0x8915('0x10'));var authService=require(_0x8915('0x11'));var qs=require(_0x8915('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8915('0x13'))(_0x8915('0x14'));var utils=require(_0x8915('0x15'));var config=require(_0x8915('0x16'));var licenseUtil=require(_0x8915('0x17'));var db=require(_0x8915('0x18'))['db'];function respondWithStatusCode(_0x4d0b59,_0x36bd1f){_0x36bd1f=_0x36bd1f||0xcc;return function(_0x246eca){if(_0x246eca){return _0x4d0b59['sendStatus'](_0x36bd1f);}return _0x4d0b59[_0x8915('0x19')](_0x36bd1f)['end']();};}function respondWithResult(_0x1f619b,_0x56294f){_0x56294f=_0x56294f||0xc8;return function(_0xf12520){if(_0xf12520){return _0x1f619b[_0x8915('0x19')](_0x56294f)[_0x8915('0x1a')](_0xf12520);}};}function respondWithFilteredResult(_0x430741,_0x8dff4d){return function(_0x57c012){if(_0x57c012){var _0x343b9f=typeof _0x8dff4d[_0x8915('0x1b')]===_0x8915('0x1c')&&typeof _0x8dff4d[_0x8915('0x1d')]===_0x8915('0x1c');var _0x57e453=_0x57c012[_0x8915('0x1e')];var _0x913dc=_0x343b9f?0x0:_0x8dff4d['offset'];var _0x5987d4=_0x343b9f?_0x57c012[_0x8915('0x1e')]:_0x8dff4d[_0x8915('0x1b')]+_0x8dff4d[_0x8915('0x1d')];var _0x19d295;if(_0x5987d4>=_0x57e453){_0x5987d4=_0x57e453;_0x19d295=0xc8;}else{_0x19d295=0xce;}_0x430741[_0x8915('0x19')](_0x19d295);return _0x430741[_0x8915('0x1f')](_0x8915('0x20'),_0x913dc+'-'+_0x5987d4+'/'+_0x57e453)[_0x8915('0x1a')](_0x57c012);}return null;};}function patchUpdates(_0x511dcd){return function(_0x562386){try{jsonpatch[_0x8915('0x21')](_0x562386,_0x511dcd,!![]);}catch(_0x3a9dfc){return BPromise[_0x8915('0x22')](_0x3a9dfc);}return _0x562386[_0x8915('0x23')]();};}function saveUpdates(_0x532ade,_0x2eebe1){return function(_0x474442){if(_0x474442){return _0x474442[_0x8915('0x24')](_0x532ade)[_0x8915('0x25')](function(_0x1249c6){return _0x1249c6;});}return null;};}function removeEntity(_0x4550fe,_0x2440fb){return function(_0x2568d8){if(_0x2568d8){return _0x2568d8['destroy']()[_0x8915('0x25')](function(){_0x4550fe['status'](0xcc)[_0x8915('0x26')]();});}};}function handleEntityNotFound(_0xe12795,_0x4bfcd2){return function(_0x24d707){if(!_0x24d707){_0xe12795[_0x8915('0x27')](0x194);}return _0x24d707;};}function handleError(_0x379c51,_0x404266){_0x404266=_0x404266||0x1f4;return function(_0x46bedf){logger[_0x8915('0x28')](_0x46bedf[_0x8915('0x29')]);if(_0x46bedf['name']){delete _0x46bedf[_0x8915('0x2a')];}_0x379c51[_0x8915('0x19')](_0x404266)['send'](_0x46bedf);};}function getMustacheRender(_0x2124cc,_0x54d3c7){return Mustache[_0x8915('0x2b')](_0x2124cc,_['merge'](_0x54d3c7[_0x8915('0x2c')],{'contact':_0x54d3c7[_0x8915('0x2d')],'message':_0x54d3c7['message'],'agent':_0x54d3c7[_0x8915('0x2e')],'interaction':_0x54d3c7[_0x8915('0x2f')],'account':_0x54d3c7[_0x8915('0x30')]}))||'';}exports[_0x8915('0x31')]=function(_0xd3eccb,_0x492fa7){var _0x40c661={},_0x4ec8e3={},_0x37d151={'count':0x0,'rows':[]};var _0x1d397e=_[_0x8915('0x32')](db['VoiceCallReport']['rawAttributes'],function(_0xbeab87){return{'name':_0xbeab87[_0x8915('0x33')],'type':_0xbeab87['type'][_0x8915('0x34')]};});_0x4ec8e3['model']=_[_0x8915('0x32')](_0x1d397e,_0x8915('0x2a'));_0x4ec8e3[_0x8915('0x35')]=_[_0x8915('0x36')](_0xd3eccb[_0x8915('0x35')]);_0x4ec8e3[_0x8915('0x37')]=_[_0x8915('0x38')](_0x4ec8e3[_0x8915('0x39')],_0x4ec8e3[_0x8915('0x35')]);_0x40c661[_0x8915('0x3a')]=_['intersection'](_0x4ec8e3[_0x8915('0x39')],qs[_0x8915('0x3b')](_0xd3eccb[_0x8915('0x35')]['fields']));_0x40c661['attributes']=_0x40c661[_0x8915('0x3a')][_0x8915('0x3c')]?_0x40c661[_0x8915('0x3a')]:_0x4ec8e3[_0x8915('0x39')];if(!_0xd3eccb[_0x8915('0x35')][_0x8915('0x3d')](_0x8915('0x3e'))){_0x40c661['limit']=qs[_0x8915('0x1d')](_0xd3eccb[_0x8915('0x35')][_0x8915('0x1d')]);_0x40c661[_0x8915('0x1b')]=qs[_0x8915('0x1b')](_0xd3eccb[_0x8915('0x35')][_0x8915('0x1b')]);}_0x40c661[_0x8915('0x3f')]=qs[_0x8915('0x40')](_0xd3eccb[_0x8915('0x35')][_0x8915('0x40')]);_0x40c661[_0x8915('0x41')]=qs[_0x8915('0x37')](_['pick'](_0xd3eccb[_0x8915('0x35')],_0x4ec8e3['filters']),_0x1d397e);if(_0xd3eccb[_0x8915('0x35')][_0x8915('0x42')]){_0x40c661[_0x8915('0x41')]=_['merge'](_0x40c661[_0x8915('0x41')],{'$or':_['map'](_0x1d397e,function(_0x5e3d64){if(_0x5e3d64[_0x8915('0x43')]!==_0x8915('0x44')){var _0x14309a={};_0x14309a[_0x5e3d64[_0x8915('0x2a')]]={'$like':'%'+_0xd3eccb['query']['filter']+'%'};return _0x14309a;}})});}_0x40c661=_[_0x8915('0x45')]({},_0x40c661,_0xd3eccb[_0x8915('0x46')]);var _0x4f2176={'where':_0x40c661[_0x8915('0x41')]};return db[_0x8915('0x47')]['count'](_0x4f2176)['then'](function(_0x2fa78){_0x37d151[_0x8915('0x1e')]=_0x2fa78;if(_0xd3eccb['query'][_0x8915('0x48')]){_0x40c661['include']=[{'attributes':['id',_0x8915('0x2a'),_0x8915('0x49'),_0x8915('0x4a')],'model':db[_0x8915('0x4b')],'as':_0x8915('0x4b')}];}return db['VoiceCallReport'][_0x8915('0x4c')](_0x40c661);})[_0x8915('0x25')](function(_0xcfbb47){_0x37d151[_0x8915('0x4d')]=_0xcfbb47;return _0x37d151;})['then'](respondWithFilteredResult(_0x492fa7,_0x40c661))[_0x8915('0x4e')](handleError(_0x492fa7,null));};exports[_0x8915('0x4f')]=function(_0x5e8b3f,_0x325be6){var _0x1205e3={'raw':!![],'where':{'id':_0x5e8b3f['params']['id']}},_0x4a7e3d={};_0x4a7e3d[_0x8915('0x39')]=_[_0x8915('0x36')](db[_0x8915('0x47')][_0x8915('0x50')]);_0x4a7e3d[_0x8915('0x35')]=_['keys'](_0x5e8b3f[_0x8915('0x35')]);_0x4a7e3d['filters']=_[_0x8915('0x38')](_0x4a7e3d[_0x8915('0x39')],_0x4a7e3d[_0x8915('0x35')]);_0x1205e3[_0x8915('0x3a')]=_[_0x8915('0x38')](_0x4a7e3d[_0x8915('0x39')],qs[_0x8915('0x3b')](_0x5e8b3f['query'][_0x8915('0x3b')]));_0x1205e3[_0x8915('0x3a')]=_0x1205e3[_0x8915('0x3a')][_0x8915('0x3c')]?_0x1205e3[_0x8915('0x3a')]:_0x4a7e3d[_0x8915('0x39')];if(_0x5e8b3f[_0x8915('0x35')]['includeAll']){_0x1205e3[_0x8915('0x51')]=[{'all':!![]}];}_0x1205e3=_[_0x8915('0x45')]({},_0x1205e3,_0x5e8b3f[_0x8915('0x46')]);return db[_0x8915('0x47')][_0x8915('0x52')](_0x1205e3)['then'](handleEntityNotFound(_0x325be6,null))['then'](respondWithResult(_0x325be6,null))[_0x8915('0x4e')](handleError(_0x325be6,null));};exports[_0x8915('0x53')]=function(_0x50d9df,_0x408f7b){return db[_0x8915('0x47')][_0x8915('0x53')](_0x50d9df['body'],{})[_0x8915('0x25')](respondWithResult(_0x408f7b,0xc9))[_0x8915('0x4e')](handleError(_0x408f7b,null));};exports['destroy']=function(_0x315eef,_0x235bf7){return db[_0x8915('0x47')][_0x8915('0x52')]({'where':{'id':_0x315eef['params']['id']}})['then'](handleEntityNotFound(_0x235bf7,null))[_0x8915('0x25')](removeEntity(_0x235bf7,null))['catch'](handleError(_0x235bf7,null));};exports['describe']=function(_0xf30bfc,_0x3029a7){return db[_0x8915('0x47')][_0x8915('0x54')]()[_0x8915('0x25')](respondWithResult(_0x3029a7,null))[_0x8915('0x4e')](handleError(_0x3029a7,null));};exports[_0x8915('0x24')]=function(_0x396a12,_0x5f276f){if(_0x396a12[_0x8915('0x2c')][_0x8915('0x55')]){delete _0x396a12[_0x8915('0x2c')][_0x8915('0x55')];}return db[_0x8915('0x47')][_0x8915('0x52')]({'where':{'uniqueid':_0x396a12[_0x8915('0x56')]['id'],'UserId':{'$or':[null,_0x396a12[_0x8915('0x57')]['id']]}}})[_0x8915('0x25')](handleEntityNotFound(_0x5f276f,null))[_0x8915('0x25')](saveUpdates(_0x396a12[_0x8915('0x2c')],null))['then'](respondWithResult(_0x5f276f,null))['catch'](handleError(_0x5f276f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b7e619c..98715a0 100644 --- a/server/api/voiceCallReport/voiceCallReport.model.js +++ b/server/api/voiceCallReport/voiceCallReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c09=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceCallReport','util'];(function(_0x404e21,_0x2c3195){var _0x3ccd0c=function(_0x1f634e){while(--_0x1f634e){_0x404e21['push'](_0x404e21['shift']());}};_0x3ccd0c(++_0x2c3195);}(_0x8c09,0x10d));var _0x98c0=function(_0x4be2ad,_0x2134b){_0x4be2ad=_0x4be2ad-0x0;var _0x1904b5=_0x8c09[_0x4be2ad];return _0x1904b5;};'use strict';var _=require('lodash');var util=require(_0x98c0('0x0'));var logger=require('../../config/logger')(_0x98c0('0x1'));var moment=require('moment');var BPromise=require(_0x98c0('0x2'));var rp=require(_0x98c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98c0('0x4'));var config=require(_0x98c0('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x98c0('0x6')]=function(_0x53aaf8,_0x589a49){return _0x53aaf8[_0x98c0('0x7')](_0x98c0('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9950=['../../config/logger','api','request-promise','path','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','util'];(function(_0x3b07ca,_0x56c4bc){var _0x61e09=function(_0x5cd016){while(--_0x5cd016){_0x3b07ca['push'](_0x3b07ca['shift']());}};_0x61e09(++_0x56c4bc);}(_0x9950,0x11d));var _0x0995=function(_0x14b8ef,_0x394e9a){_0x14b8ef=_0x14b8ef-0x0;var _0x59ff6f=_0x9950[_0x14b8ef];return _0x59ff6f;};'use strict';var _=require('lodash');var util=require(_0x0995('0x0'));var logger=require(_0x0995('0x1'))(_0x0995('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0995('0x3'));var fs=require('fs');var path=require(_0x0995('0x4'));var rimraf=require('rimraf');var config=require(_0x0995('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x0995('0x6')]=function(_0x1f1d1f,_0x741c1a){return _0x1f1d1f[_0x0995('0x7')](_0x0995('0x8'),attributes,{'tableName':_0x0995('0x9'),'paranoid':![],'indexes':[{'fields':[_0x0995('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 649c2f4..60bfcd1 100644 --- a/server/api/voiceCallReport/voiceCallReport.rpc.js +++ b/server/api/voiceCallReport/voiceCallReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6474=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x6474,0x1e7));var _0x4647=function(_0x3ea60e,_0x5140ed){_0x3ea60e=_0x3ea60e-0x0;var _0x1962b9=_0x6474[_0x3ea60e];return _0x1962b9;};'use strict';var _=require(_0x4647('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4647('0x1'));var db=require(_0x4647('0x2'))['db'];var utils=require(_0x4647('0x3'));var logger=require(_0x4647('0x4'))(_0x4647('0x5'));var config=require(_0x4647('0x6'));var jayson=require(_0x4647('0x7'));var client=jayson[_0x4647('0x8')][_0x4647('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xafa0e8,_0x5811c4,_0x5b95e7){return new BPromise(function(_0x2667ea,_0x270d8b){return client[_0x4647('0xa')](_0xafa0e8,_0x5b95e7)[_0x4647('0xb')](function(_0x2b051c){logger[_0x4647('0xc')](_0x4647('0xd'),_0x5811c4,_0x4647('0xe'));logger[_0x4647('0xf')](_0x4647('0x10'),_0x5811c4,_0x4647('0xe'),JSON[_0x4647('0x11')](_0x2b051c));if(_0x2b051c['error']){if(_0x2b051c[_0x4647('0x12')][_0x4647('0x13')]===0x1f4){logger[_0x4647('0x12')](_0x4647('0xd'),_0x5811c4,_0x2b051c[_0x4647('0x12')]['message']);return _0x270d8b(_0x2b051c['error']['message']);}logger[_0x4647('0x12')](_0x4647('0xd'),_0x5811c4,_0x2b051c[_0x4647('0x12')][_0x4647('0x14')]);return _0x2667ea(_0x2b051c[_0x4647('0x12')][_0x4647('0x14')]);}else{logger[_0x4647('0xc')](_0x4647('0xd'),_0x5811c4,_0x4647('0xe'));_0x2667ea(_0x2b051c['result'][_0x4647('0x14')]);}})[_0x4647('0x15')](function(_0x15d9bb){logger['error'](_0x4647('0xd'),_0x5811c4,_0x15d9bb);_0x270d8b(_0x15d9bb);});});}exports[_0x4647('0x16')]=function(_0x4b1d6a){var _0x1f8cc1=this;return new Promise(function(_0x278a61,_0x14ed1b){return db[_0x4647('0x17')][_0x4647('0x18')]({'raw':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b1d6a['options']?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1b')]||null:null,'attributes':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a['options'][_0x4647('0x1c')]||null:null,'limit':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1d')]||null:null,'include':_0x4b1d6a[_0x4647('0x19')]?_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1e')]?_[_0x4647('0x1f')](_0x4b1d6a[_0x4647('0x19')][_0x4647('0x1e')],function(_0x4794f0){return{'model':db[_0x4794f0[_0x4647('0x20')]],'as':_0x4794f0['as'],'attributes':_0x4794f0['attributes'],'include':_0x4794f0[_0x4647('0x1e')]?_[_0x4647('0x1f')](_0x4794f0[_0x4647('0x1e')],function(_0x22c2e0){return{'model':db[_0x22c2e0[_0x4647('0x20')]],'as':_0x22c2e0['as'],'attributes':_0x22c2e0[_0x4647('0x1c')],'include':_0x22c2e0[_0x4647('0x1e')]?_[_0x4647('0x1f')](_0x22c2e0['include'],function(_0x431e0f){return{'model':db[_0x431e0f[_0x4647('0x20')]],'as':_0x431e0f['as'],'attributes':_0x431e0f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4647('0xb')](function(_0xd37879){logger[_0x4647('0xc')](_0x4647('0x16'),_0x4b1d6a);logger['debug'](_0x4647('0x16'),_0x4b1d6a,JSON[_0x4647('0x11')](_0xd37879));_0x278a61(_0xd37879);})[_0x4647('0x15')](function(_0x47077d){logger['error'](_0x4647('0x16'),_0x47077d['message'],_0x4b1d6a);_0x14ed1b(_0x1f8cc1[_0x4647('0x12')](0x1f4,_0x47077d['message']));});});};exports[_0x4647('0x21')]=function(_0x33d422){var _0x129a82=this;return new Promise(function(_0x5296e7,_0x20cb6f){return db[_0x4647('0x17')][_0x4647('0x22')](_0x33d422[_0x4647('0x23')],{'raw':_0x33d422[_0x4647('0x19')]?_0x33d422[_0x4647('0x19')][_0x4647('0x1a')]===undefined?!![]:![]:!![]})[_0x4647('0xb')](function(_0x52d2b1){logger[_0x4647('0xc')]('CreateVoiceCallReport',_0x33d422);logger[_0x4647('0xf')](_0x4647('0x21'),_0x33d422,JSON['stringify'](_0x52d2b1));_0x5296e7(_0x52d2b1);})[_0x4647('0x15')](function(_0x5989e8){logger['error']('CreateVoiceCallReport',_0x5989e8[_0x4647('0x14')],_0x33d422);_0x20cb6f(_0x129a82[_0x4647('0x12')](0x1f4,_0x5989e8['message']));});});};exports[_0x4647('0x24')]=function(_0x101854){var _0xd73aa=this;return new Promise(function(_0x51a065,_0xd733f0){return db['VoiceCallReport'][_0x4647('0x25')](_0x101854[_0x4647('0x23')],{'raw':_0x101854[_0x4647('0x19')]?_0x101854['options'][_0x4647('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101854[_0x4647('0x19')]?_0x101854[_0x4647('0x19')][_0x4647('0x1b')]||null:null,'attributes':_0x101854[_0x4647('0x19')]?_0x101854[_0x4647('0x19')][_0x4647('0x1c')]||null:null,'limit':_0x101854[_0x4647('0x19')]?_0x101854[_0x4647('0x19')][_0x4647('0x1d')]||null:null})[_0x4647('0xb')](function(_0x46309a){logger[_0x4647('0xc')](_0x4647('0x24'),_0x101854);logger[_0x4647('0xf')](_0x4647('0x24'),_0x101854,JSON[_0x4647('0x11')](_0x46309a));_0x51a065(_0x46309a);})[_0x4647('0x15')](function(_0x5de8e3){logger[_0x4647('0x12')](_0x4647('0x24'),_0x5de8e3['message'],_0x101854);_0xd733f0(_0xd73aa[_0x4647('0x12')](0x1f4,_0x5de8e3[_0x4647('0x14')]));});});}; \ No newline at end of file +var _0x441b=['error','code','message','info','result','catch','VoiceCallReport','options','raw','where','attributes','limit','include','map','model','stringify','GetVoiceCallReport','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x441b,0xff));var _0xb441=function(_0x115acd,_0x55a3d4){_0x115acd=_0x115acd-0x0;var _0x3769d0=_0x441b[_0x115acd];return _0x3769d0;};'use strict';var _=require(_0xb441('0x0'));var util=require(_0xb441('0x1'));var moment=require(_0xb441('0x2'));var BPromise=require(_0xb441('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb441('0x4'));var db=require(_0xb441('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb441('0x6'))(_0xb441('0x7'));var config=require(_0xb441('0x8'));var jayson=require(_0xb441('0x9'));var client=jayson[_0xb441('0xa')][_0xb441('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d9d29,_0x397b10,_0x3a41a6){return new BPromise(function(_0x1759b3,_0x4daa35){return client[_0xb441('0xc')](_0x5d9d29,_0x3a41a6)[_0xb441('0xd')](function(_0x5396a0){logger['info'](_0xb441('0xe'),_0x397b10,_0xb441('0xf'));logger[_0xb441('0x10')](_0xb441('0x11'),_0x397b10,'request\x20sent',JSON['stringify'](_0x5396a0));if(_0x5396a0[_0xb441('0x12')]){if(_0x5396a0[_0xb441('0x12')][_0xb441('0x13')]===0x1f4){logger[_0xb441('0x12')](_0xb441('0xe'),_0x397b10,_0x5396a0[_0xb441('0x12')][_0xb441('0x14')]);return _0x4daa35(_0x5396a0[_0xb441('0x12')][_0xb441('0x14')]);}logger['error'](_0xb441('0xe'),_0x397b10,_0x5396a0[_0xb441('0x12')]['message']);return _0x1759b3(_0x5396a0[_0xb441('0x12')][_0xb441('0x14')]);}else{logger[_0xb441('0x15')](_0xb441('0xe'),_0x397b10,'request\x20sent');_0x1759b3(_0x5396a0[_0xb441('0x16')][_0xb441('0x14')]);}})[_0xb441('0x17')](function(_0x475eac){logger[_0xb441('0x12')](_0xb441('0xe'),_0x397b10,_0x475eac);_0x4daa35(_0x475eac);});});}exports['GetVoiceCallReport']=function(_0x1f1038){var _0x508e84=this;return new Promise(function(_0x1b8162,_0x1e5ef6){return db[_0xb441('0x18')]['findAll']({'raw':_0x1f1038['options']?_0x1f1038[_0xb441('0x19')][_0xb441('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f1038[_0xb441('0x19')]?_0x1f1038[_0xb441('0x19')][_0xb441('0x1b')]||null:null,'attributes':_0x1f1038['options']?_0x1f1038[_0xb441('0x19')][_0xb441('0x1c')]||null:null,'limit':_0x1f1038['options']?_0x1f1038[_0xb441('0x19')][_0xb441('0x1d')]||null:null,'include':_0x1f1038[_0xb441('0x19')]?_0x1f1038[_0xb441('0x19')][_0xb441('0x1e')]?_[_0xb441('0x1f')](_0x1f1038[_0xb441('0x19')]['include'],function(_0x51b3d4){return{'model':db[_0x51b3d4[_0xb441('0x20')]],'as':_0x51b3d4['as'],'attributes':_0x51b3d4[_0xb441('0x1c')],'include':_0x51b3d4[_0xb441('0x1e')]?_[_0xb441('0x1f')](_0x51b3d4[_0xb441('0x1e')],function(_0xaa5c9){return{'model':db[_0xaa5c9['model']],'as':_0xaa5c9['as'],'attributes':_0xaa5c9['attributes'],'include':_0xaa5c9[_0xb441('0x1e')]?_[_0xb441('0x1f')](_0xaa5c9[_0xb441('0x1e')],function(_0x196ae3){return{'model':db[_0x196ae3[_0xb441('0x20')]],'as':_0x196ae3['as'],'attributes':_0x196ae3['attributes']};}):[]};}):[]};}):[]:[]})[_0xb441('0xd')](function(_0x145ff2){logger[_0xb441('0x15')]('GetVoiceCallReport',_0x1f1038);logger[_0xb441('0x10')]('GetVoiceCallReport',_0x1f1038,JSON[_0xb441('0x21')](_0x145ff2));_0x1b8162(_0x145ff2);})[_0xb441('0x17')](function(_0x31adf6){logger[_0xb441('0x12')](_0xb441('0x22'),_0x31adf6['message'],_0x1f1038);_0x1e5ef6(_0x508e84[_0xb441('0x12')](0x1f4,_0x31adf6[_0xb441('0x14')]));});});};exports[_0xb441('0x23')]=function(_0x286421){var _0x226ae0=this;return new Promise(function(_0x2a70d0,_0x308c85){return db[_0xb441('0x18')]['create'](_0x286421[_0xb441('0x24')],{'raw':_0x286421[_0xb441('0x19')]?_0x286421[_0xb441('0x19')][_0xb441('0x1a')]===undefined?!![]:![]:!![]})[_0xb441('0xd')](function(_0x591702){logger['info']('CreateVoiceCallReport',_0x286421);logger[_0xb441('0x10')](_0xb441('0x23'),_0x286421,JSON['stringify'](_0x591702));_0x2a70d0(_0x591702);})[_0xb441('0x17')](function(_0x1d5110){logger[_0xb441('0x12')](_0xb441('0x23'),_0x1d5110[_0xb441('0x14')],_0x286421);_0x308c85(_0x226ae0[_0xb441('0x12')](0x1f4,_0x1d5110[_0xb441('0x14')]));});});};exports[_0xb441('0x25')]=function(_0x2040ac){var _0xe5e623=this;return new Promise(function(_0x1045b8,_0x38c3da){return db[_0xb441('0x18')][_0xb441('0x26')](_0x2040ac[_0xb441('0x24')],{'raw':_0x2040ac[_0xb441('0x19')]?_0x2040ac[_0xb441('0x19')][_0xb441('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2040ac[_0xb441('0x19')]?_0x2040ac[_0xb441('0x19')]['where']||null:null,'attributes':_0x2040ac[_0xb441('0x19')]?_0x2040ac[_0xb441('0x19')][_0xb441('0x1c')]||null:null,'limit':_0x2040ac['options']?_0x2040ac[_0xb441('0x19')][_0xb441('0x1d')]||null:null})[_0xb441('0xd')](function(_0x2ad393){logger[_0xb441('0x15')](_0xb441('0x25'),_0x2040ac);logger[_0xb441('0x10')](_0xb441('0x25'),_0x2040ac,JSON[_0xb441('0x21')](_0x2ad393));_0x1045b8(_0x2ad393);})[_0xb441('0x17')](function(_0x21dffa){logger['error'](_0xb441('0x25'),_0x21dffa[_0xb441('0x14')],_0x2040ac);_0x38c3da(_0xe5e623[_0xb441('0x12')](0x1f4,_0x21dffa[_0xb441('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c5b4007..c702dcc 100644 --- a/server/api/voiceChanSpy/index.js +++ b/server/api/voiceChanSpy/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x091f=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x1dca9b,_0x3ceaba){var _0x1e8e0a=function(_0x5b8bfc){while(--_0x5b8bfc){_0x1dca9b['push'](_0x1dca9b['shift']());}};_0x1e8e0a(++_0x3ceaba);}(_0x091f,0x72));var _0xf091=function(_0x5b6fd3,_0x4af8d4){_0x5b6fd3=_0x5b6fd3-0x0;var _0x75ef1e=_0x091f[_0x5b6fd3];return _0x75ef1e;};'use strict';var multer=require(_0xf091('0x0'));var util=require(_0xf091('0x1'));var path=require(_0xf091('0x2'));var timeout=require(_0xf091('0x3'));var express=require('express');var router=express[_0xf091('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf091('0x5'));var interaction=require(_0xf091('0x6'));var config=require(_0xf091('0x7'));var controller=require('./voiceChanSpy.controller');router[_0xf091('0x8')]('/',auth[_0xf091('0x9')](),controller[_0xf091('0xa')]);router[_0xf091('0x8')](_0xf091('0xb'),auth[_0xf091('0x9')](),controller[_0xf091('0xc')]);router[_0xf091('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf091('0xe')](_0xf091('0xb'),auth[_0xf091('0x9')](),controller[_0xf091('0xf')]);router[_0xf091('0x10')]('/:id',auth[_0xf091('0x9')](),controller[_0xf091('0x11')]);module[_0xf091('0x12')]=router; \ No newline at end of file +var _0xe283=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','show','post','create'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0xe283,0x116));var _0x3e28=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0xe283[_0x488ca1];return _0x4dd0a4;};'use strict';var multer=require(_0x3e28('0x0'));var util=require('util');var path=require(_0x3e28('0x1'));var timeout=require(_0x3e28('0x2'));var express=require(_0x3e28('0x3'));var router=express[_0x3e28('0x4')]();var fs_extra=require(_0x3e28('0x5'));var auth=require(_0x3e28('0x6'));var interaction=require(_0x3e28('0x7'));var config=require(_0x3e28('0x8'));var controller=require(_0x3e28('0x9'));router['get']('/',auth[_0x3e28('0xa')](),controller[_0x3e28('0xb')]);router[_0x3e28('0xc')]('/:id',auth[_0x3e28('0xa')](),controller[_0x3e28('0xd')]);router[_0x3e28('0xe')]('/',auth[_0x3e28('0xa')](),controller[_0x3e28('0xf')]);router[_0x3e28('0x10')](_0x3e28('0x11'),auth['isAuthenticated'](),controller[_0x3e28('0x12')]);router[_0x3e28('0x13')](_0x3e28('0x11'),auth[_0x3e28('0xa')](),controller['destroy']);module[_0x3e28('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e406a35..619d1fb 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.attributes.js +++ b/server/api/voiceChanSpy/voiceChanSpy.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5d5=['sequelize','STRING','options','getDataValue','split'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xf5d5,0x186));var _0x5f5d=function(_0x190945,_0x8f08e5){_0x190945=_0x190945-0x0;var _0x110f8d=_0xf5d5[_0x190945];return _0x110f8d;};'use strict';var Sequelize=require(_0x5f5d('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f5d('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1b9d2c){this['setDataValue'](_0x5f5d('0x2'),_0x1b9d2c?_0x1b9d2c['join'](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x5f5d('0x3')]('options')[_0x5f5d('0x4')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x5f5d('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5f5d('0x1')]},'description':{'type':Sequelize[_0x5f5d('0x1')]}}; \ No newline at end of file +var _0x1cad=['STRING','name','setDataValue','options','getDataValue','split','exports'];(function(_0x2d012d,_0x12e55f){var _0x4f80ac=function(_0x1ef4c6){while(--_0x1ef4c6){_0x2d012d['push'](_0x2d012d['shift']());}};_0x4f80ac(++_0x12e55f);}(_0x1cad,0x8b));var _0xd1ca=function(_0x476bde,_0x978075){_0x476bde=_0x476bde-0x0;var _0x364f53=_0x1cad[_0x476bde];return _0x364f53;};'use strict';var Sequelize=require('sequelize');module[_0xd1ca('0x0')]={'name':{'type':Sequelize[_0xd1ca('0x1')]},'prefix':{'type':Sequelize[_0xd1ca('0x1')],'unique':_0xd1ca('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x451b92){this[_0xd1ca('0x3')](_0xd1ca('0x4'),_0x451b92?_0x451b92['join'](''):[]);},'get':function(){return this[_0xd1ca('0x5')](_0xd1ca('0x4'))?this[_0xd1ca('0x5')](_0xd1ca('0x4'))[_0xd1ca('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xd1ca('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd1ca('0x1')]},'description':{'type':Sequelize[_0xd1ca('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d484b94..be48c59 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.controller.js +++ b/server/api/voiceChanSpy/voiceChanSpy.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17db=['show','keys','includeAll','include','options','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','merge','body','contact','agent','interaction','account','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x214993,_0x5e8817){var _0x457aeb=function(_0x5b9c07){while(--_0x5b9c07){_0x214993['push'](_0x214993['shift']());}};_0x457aeb(++_0x5e8817);}(_0x17db,0xb2));var _0xb17d=function(_0xdb7e5b,_0x382b2c){_0xdb7e5b=_0xdb7e5b-0x0;var _0x2f11cc=_0x17db[_0xdb7e5b];return _0x2f11cc;};'use strict';var emlformat=require(_0xb17d('0x0'));var rimraf=require(_0xb17d('0x1'));var zipdir=require(_0xb17d('0x2'));var jsonpatch=require(_0xb17d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb17d('0x4'));var Mustache=require('mustache');var util=require(_0xb17d('0x5'));var path=require(_0xb17d('0x6'));var sox=require(_0xb17d('0x7'));var csv=require(_0xb17d('0x8'));var ejs=require(_0xb17d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb17d('0xa'));var crypto=require(_0xb17d('0xb'));var jsforce=require(_0xb17d('0xc'));var deskjs=require(_0xb17d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb17d('0xe'));var Redis=require(_0xb17d('0xf'));var authService=require(_0xb17d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb17d('0x11'));var logger=require(_0xb17d('0x12'))(_0xb17d('0x13'));var utils=require('../../config/utils');var config=require(_0xb17d('0x14'));var licenseUtil=require(_0xb17d('0x15'));var db=require(_0xb17d('0x16'))['db'];function respondWithStatusCode(_0x10bc4e,_0x4a1bda){_0x4a1bda=_0x4a1bda||0xcc;return function(_0x219ace){if(_0x219ace){return _0x10bc4e[_0xb17d('0x17')](_0x4a1bda);}return _0x10bc4e[_0xb17d('0x18')](_0x4a1bda)[_0xb17d('0x19')]();};}function respondWithResult(_0x478e7e,_0x251f5c){_0x251f5c=_0x251f5c||0xc8;return function(_0xf396ba){if(_0xf396ba){return _0x478e7e[_0xb17d('0x18')](_0x251f5c)[_0xb17d('0x1a')](_0xf396ba);}};}function respondWithFilteredResult(_0x384a8b,_0x1674a7){return function(_0x192580){if(_0x192580){var _0x2b9f5b=typeof _0x1674a7[_0xb17d('0x1b')]===_0xb17d('0x1c')&&typeof _0x1674a7[_0xb17d('0x1d')]===_0xb17d('0x1c');var _0x550db2=_0x192580[_0xb17d('0x1e')];var _0x331e19=_0x2b9f5b?0x0:_0x1674a7['offset'];var _0x827ff8=_0x2b9f5b?_0x192580[_0xb17d('0x1e')]:_0x1674a7['offset']+_0x1674a7[_0xb17d('0x1d')];var _0x2e678c;if(_0x827ff8>=_0x550db2){_0x827ff8=_0x550db2;_0x2e678c=0xc8;}else{_0x2e678c=0xce;}_0x384a8b[_0xb17d('0x18')](_0x2e678c);return _0x384a8b[_0xb17d('0x1f')](_0xb17d('0x20'),_0x331e19+'-'+_0x827ff8+'/'+_0x550db2)[_0xb17d('0x1a')](_0x192580);}return null;};}function patchUpdates(_0x1dcbbb){return function(_0x552b89){try{jsonpatch['apply'](_0x552b89,_0x1dcbbb,!![]);}catch(_0x32b17a){return BPromise[_0xb17d('0x21')](_0x32b17a);}return _0x552b89[_0xb17d('0x22')]();};}function saveUpdates(_0xf4f890,_0x4ced93){return function(_0x353a97){if(_0x353a97){return _0x353a97[_0xb17d('0x23')](_0xf4f890)[_0xb17d('0x24')](function(_0x58cd28){return _0x58cd28;});}return null;};}function removeEntity(_0x575adb,_0x16f7c3){return function(_0x473a33){if(_0x473a33){return _0x473a33[_0xb17d('0x25')]()['then'](function(){var _0x14a1ae=_0x473a33[_0xb17d('0x26')]({'plain':!![]});var _0x35921f=_0xb17d('0x27');return db['UserProfileResource'][_0xb17d('0x25')]({'where':{'type':_0x35921f,'resourceId':_0x14a1ae['id']}})[_0xb17d('0x24')](function(){return _0x473a33;});})[_0xb17d('0x24')](function(){_0x575adb[_0xb17d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a414,_0x3b2285){return function(_0x2a76b4){if(!_0x2a76b4){_0x14a414[_0xb17d('0x17')](0x194);}return _0x2a76b4;};}function handleError(_0xd97c8b,_0x4d5efc){_0x4d5efc=_0x4d5efc||0x1f4;return function(_0x3ee6bd){logger[_0xb17d('0x28')](_0x3ee6bd[_0xb17d('0x29')]);if(_0x3ee6bd[_0xb17d('0x2a')]){delete _0x3ee6bd[_0xb17d('0x2a')];}_0xd97c8b[_0xb17d('0x18')](_0x4d5efc)[_0xb17d('0x2b')](_0x3ee6bd);};}function getMustacheRender(_0x329978,_0x24f607){return Mustache['render'](_0x329978,_[_0xb17d('0x2c')](_0x24f607[_0xb17d('0x2d')],{'contact':_0x24f607[_0xb17d('0x2e')],'message':_0x24f607['message'],'agent':_0x24f607[_0xb17d('0x2f')],'interaction':_0x24f607[_0xb17d('0x30')],'account':_0x24f607[_0xb17d('0x31')]}))||'';}exports['index']=function(_0x524c1f,_0x5defe9){var _0x4f22a3={},_0x26ff29={},_0x1f2a76={'count':0x0,'rows':[]};var _0x514de0=_[_0xb17d('0x32')](db[_0xb17d('0x33')][_0xb17d('0x34')],function(_0x522099){return{'name':_0x522099[_0xb17d('0x35')],'type':_0x522099[_0xb17d('0x36')]['key']};});_0x26ff29[_0xb17d('0x37')]=_[_0xb17d('0x32')](_0x514de0,_0xb17d('0x2a'));_0x26ff29[_0xb17d('0x38')]=_['keys'](_0x524c1f[_0xb17d('0x38')]);_0x26ff29[_0xb17d('0x39')]=_['intersection'](_0x26ff29[_0xb17d('0x37')],_0x26ff29[_0xb17d('0x38')]);_0x4f22a3[_0xb17d('0x3a')]=_[_0xb17d('0x3b')](_0x26ff29[_0xb17d('0x37')],qs['fields'](_0x524c1f[_0xb17d('0x38')][_0xb17d('0x3c')]));_0x4f22a3[_0xb17d('0x3a')]=_0x4f22a3[_0xb17d('0x3a')][_0xb17d('0x3d')]?_0x4f22a3['attributes']:_0x26ff29['model'];if(!_0x524c1f['query'][_0xb17d('0x3e')](_0xb17d('0x3f'))){_0x4f22a3['limit']=qs[_0xb17d('0x1d')](_0x524c1f[_0xb17d('0x38')][_0xb17d('0x1d')]);_0x4f22a3[_0xb17d('0x1b')]=qs['offset'](_0x524c1f['query'][_0xb17d('0x1b')]);}_0x4f22a3[_0xb17d('0x40')]=qs[_0xb17d('0x41')](_0x524c1f['query'][_0xb17d('0x41')]);_0x4f22a3[_0xb17d('0x42')]=qs[_0xb17d('0x39')](_['pick'](_0x524c1f[_0xb17d('0x38')],_0x26ff29['filters']),_0x514de0);if(_0x524c1f['query'][_0xb17d('0x43')]){_0x4f22a3['where']=_[_0xb17d('0x2c')](_0x4f22a3[_0xb17d('0x42')],{'$or':_[_0xb17d('0x32')](_0x514de0,function(_0x2e8b2a){if(_0x2e8b2a[_0xb17d('0x36')]!=='VIRTUAL'){var _0x4bf801={};_0x4bf801[_0x2e8b2a[_0xb17d('0x2a')]]={'$like':'%'+_0x524c1f[_0xb17d('0x38')][_0xb17d('0x43')]+'%'};return _0x4bf801;}})});}_0x4f22a3=_[_0xb17d('0x2c')]({},_0x4f22a3,_0x524c1f['options']);var _0x3da60a={'where':_0x4f22a3[_0xb17d('0x42')]};return db['VoiceChanSpy'][_0xb17d('0x1e')](_0x3da60a)[_0xb17d('0x24')](function(_0x9b84a9){_0x1f2a76['count']=_0x9b84a9;if(_0x524c1f['query']['includeAll']){_0x4f22a3['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x4f22a3);})[_0xb17d('0x24')](function(_0x5de122){_0x1f2a76['rows']=_0x5de122;return _0x1f2a76;})[_0xb17d('0x24')](respondWithFilteredResult(_0x5defe9,_0x4f22a3))['catch'](handleError(_0x5defe9,null));};exports[_0xb17d('0x44')]=function(_0x88c898,_0x2d3419){var _0x52b482={'raw':![],'where':{'id':_0x88c898['params']['id']}},_0x11773c={};_0x11773c['model']=_[_0xb17d('0x45')](db[_0xb17d('0x33')]['rawAttributes']);_0x11773c[_0xb17d('0x38')]=_[_0xb17d('0x45')](_0x88c898[_0xb17d('0x38')]);_0x11773c[_0xb17d('0x39')]=_[_0xb17d('0x3b')](_0x11773c[_0xb17d('0x37')],_0x11773c[_0xb17d('0x38')]);_0x52b482[_0xb17d('0x3a')]=_[_0xb17d('0x3b')](_0x11773c['model'],qs[_0xb17d('0x3c')](_0x88c898[_0xb17d('0x38')]['fields']));_0x52b482[_0xb17d('0x3a')]=_0x52b482[_0xb17d('0x3a')][_0xb17d('0x3d')]?_0x52b482['attributes']:_0x11773c[_0xb17d('0x37')];if(_0x88c898[_0xb17d('0x38')][_0xb17d('0x46')]){_0x52b482[_0xb17d('0x47')]=[{'all':!![]}];}_0x52b482=_['merge']({},_0x52b482,_0x88c898[_0xb17d('0x48')]);return db[_0xb17d('0x33')][_0xb17d('0x49')](_0x52b482)[_0xb17d('0x24')](handleEntityNotFound(_0x2d3419,null))[_0xb17d('0x24')](respondWithResult(_0x2d3419,null))[_0xb17d('0x4a')](handleError(_0x2d3419,null));};exports[_0xb17d('0x4b')]=function(_0x169446,_0x37aad2){return db[_0xb17d('0x33')][_0xb17d('0x4b')](_0x169446[_0xb17d('0x2d')],{})['then'](function(_0x4ad8fc){var _0x5d5963=_0x169446[_0xb17d('0x4c')][_0xb17d('0x26')]({'plain':!![]});if(!_0x5d5963)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d5963['role']==='user'){var _0x1d0c19=_0x4ad8fc['get']({'plain':!![]});var _0x1d244a='ChanSpies';return db[_0xb17d('0x4d')][_0xb17d('0x49')]({'where':{'name':_0x1d244a,'userProfileId':_0x5d5963[_0xb17d('0x4e')]},'raw':!![]})['then'](function(_0x3992ef){if(_0x3992ef&&_0x3992ef[_0xb17d('0x4f')]===0x0){return db[_0xb17d('0x50')][_0xb17d('0x4b')]({'name':_0x1d0c19['name'],'resourceId':_0x1d0c19['id'],'type':_0x3992ef[_0xb17d('0x2a')],'sectionId':_0x3992ef['id']},{})['then'](function(){return _0x4ad8fc;});}else{return _0x4ad8fc;}})[_0xb17d('0x4a')](function(_0x45248){logger[_0xb17d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45248);throw _0x45248;});}return _0x4ad8fc;})[_0xb17d('0x24')](respondWithResult(_0x37aad2,0xc9))[_0xb17d('0x4a')](handleError(_0x37aad2,null));};exports[_0xb17d('0x23')]=function(_0x5c0feb,_0x52e75e){if(_0x5c0feb[_0xb17d('0x2d')]['id']){delete _0x5c0feb['body']['id'];}return db[_0xb17d('0x33')][_0xb17d('0x49')]({'where':{'id':_0x5c0feb[_0xb17d('0x51')]['id']}})[_0xb17d('0x24')](handleEntityNotFound(_0x52e75e,null))[_0xb17d('0x24')](saveUpdates(_0x5c0feb['body'],null))[_0xb17d('0x24')](respondWithResult(_0x52e75e,null))['catch'](handleError(_0x52e75e,null));};exports[_0xb17d('0x25')]=function(_0x317801,_0x1c13f8){return db['VoiceChanSpy'][_0xb17d('0x49')]({'where':{'id':_0x317801[_0xb17d('0x51')]['id']}})[_0xb17d('0x24')](handleEntityNotFound(_0x1c13f8,null))['then'](removeEntity(_0x1c13f8,null))[_0xb17d('0x4a')](handleError(_0x1c13f8,null));}; \ No newline at end of file +var _0x76f6=['type','VIRTUAL','VoiceChanSpy','findAll','rows','catch','show','params','include','options','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','merge','body','contact','agent','interaction','account','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4bcbe1,_0x4575fc){var _0x4d9bb3=function(_0x5a1593){while(--_0x5a1593){_0x4bcbe1['push'](_0x4bcbe1['shift']());}};_0x4d9bb3(++_0x4575fc);}(_0x76f6,0x67));var _0x676f=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x76f6[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x676f('0x0'));var rimraf=require(_0x676f('0x1'));var zipdir=require(_0x676f('0x2'));var jsonpatch=require(_0x676f('0x3'));var rp=require(_0x676f('0x4'));var moment=require(_0x676f('0x5'));var BPromise=require(_0x676f('0x6'));var Mustache=require(_0x676f('0x7'));var util=require('util');var path=require(_0x676f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x676f('0x9'));var fs=require('fs');var fs_extra=require(_0x676f('0xa'));var _=require(_0x676f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x676f('0xc'));var deskjs=require(_0x676f('0xd'));var toCsv=require(_0x676f('0xe'));var querystring=require('querystring');var Papa=require(_0x676f('0xf'));var Redis=require(_0x676f('0x10'));var authService=require(_0x676f('0x11'));var qs=require(_0x676f('0x12'));var as=require(_0x676f('0x13'));var hardwareService=require(_0x676f('0x14'));var logger=require('../../config/logger')(_0x676f('0x15'));var utils=require(_0x676f('0x16'));var config=require(_0x676f('0x17'));var licenseUtil=require(_0x676f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb81bf6,_0x43b52c){_0x43b52c=_0x43b52c||0xcc;return function(_0x119a1a){if(_0x119a1a){return _0xb81bf6[_0x676f('0x19')](_0x43b52c);}return _0xb81bf6[_0x676f('0x1a')](_0x43b52c)[_0x676f('0x1b')]();};}function respondWithResult(_0xef4c3b,_0x48f2b8){_0x48f2b8=_0x48f2b8||0xc8;return function(_0x23245b){if(_0x23245b){return _0xef4c3b[_0x676f('0x1a')](_0x48f2b8)[_0x676f('0x1c')](_0x23245b);}};}function respondWithFilteredResult(_0xa712be,_0x34b23a){return function(_0x3e9f7e){if(_0x3e9f7e){var _0x128a8b=typeof _0x34b23a[_0x676f('0x1d')]===_0x676f('0x1e')&&typeof _0x34b23a[_0x676f('0x1f')]===_0x676f('0x1e');var _0x106e0d=_0x3e9f7e['count'];var _0xacc131=_0x128a8b?0x0:_0x34b23a[_0x676f('0x1d')];var _0x2c0bc9=_0x128a8b?_0x3e9f7e[_0x676f('0x20')]:_0x34b23a['offset']+_0x34b23a[_0x676f('0x1f')];var _0x10b9e1;if(_0x2c0bc9>=_0x106e0d){_0x2c0bc9=_0x106e0d;_0x10b9e1=0xc8;}else{_0x10b9e1=0xce;}_0xa712be[_0x676f('0x1a')](_0x10b9e1);return _0xa712be['set']('Content-Range',_0xacc131+'-'+_0x2c0bc9+'/'+_0x106e0d)[_0x676f('0x1c')](_0x3e9f7e);}return null;};}function patchUpdates(_0x39228f){return function(_0x3ab8db){try{jsonpatch[_0x676f('0x21')](_0x3ab8db,_0x39228f,!![]);}catch(_0xb11c6a){return BPromise[_0x676f('0x22')](_0xb11c6a);}return _0x3ab8db[_0x676f('0x23')]();};}function saveUpdates(_0x3a2525,_0xeac32b){return function(_0x2fdfc3){if(_0x2fdfc3){return _0x2fdfc3[_0x676f('0x24')](_0x3a2525)[_0x676f('0x25')](function(_0x5b3a6e){return _0x5b3a6e;});}return null;};}function removeEntity(_0x3b9543,_0x1e4a8d){return function(_0x310a37){if(_0x310a37){return _0x310a37[_0x676f('0x26')]()[_0x676f('0x25')](function(){var _0x224558=_0x310a37[_0x676f('0x27')]({'plain':!![]});var _0x579fb9=_0x676f('0x28');return db[_0x676f('0x29')][_0x676f('0x26')]({'where':{'type':_0x579fb9,'resourceId':_0x224558['id']}})[_0x676f('0x25')](function(){return _0x310a37;});})[_0x676f('0x25')](function(){_0x3b9543[_0x676f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x589567,_0x1387ae){return function(_0x3c97a7){if(!_0x3c97a7){_0x589567['sendStatus'](0x194);}return _0x3c97a7;};}function handleError(_0x52c544,_0x5e264d){_0x5e264d=_0x5e264d||0x1f4;return function(_0x3bd1f7){logger[_0x676f('0x2a')](_0x3bd1f7[_0x676f('0x2b')]);if(_0x3bd1f7[_0x676f('0x2c')]){delete _0x3bd1f7['name'];}_0x52c544[_0x676f('0x1a')](_0x5e264d)[_0x676f('0x2d')](_0x3bd1f7);};}function getMustacheRender(_0x1bb958,_0x1fec11){return Mustache['render'](_0x1bb958,_[_0x676f('0x2e')](_0x1fec11[_0x676f('0x2f')],{'contact':_0x1fec11[_0x676f('0x30')],'message':_0x1fec11['message'],'agent':_0x1fec11[_0x676f('0x31')],'interaction':_0x1fec11[_0x676f('0x32')],'account':_0x1fec11[_0x676f('0x33')]}))||'';}exports['index']=function(_0x400889,_0x19a4b7){var _0x21fe61={},_0x5bc12e={},_0x3f988c={'count':0x0,'rows':[]};var _0xbb32c1=_['map'](db['VoiceChanSpy'][_0x676f('0x34')],function(_0x244f1){return{'name':_0x244f1[_0x676f('0x35')],'type':_0x244f1['type'][_0x676f('0x36')]};});_0x5bc12e[_0x676f('0x37')]=_['map'](_0xbb32c1,'name');_0x5bc12e['query']=_[_0x676f('0x38')](_0x400889['query']);_0x5bc12e[_0x676f('0x39')]=_[_0x676f('0x3a')](_0x5bc12e[_0x676f('0x37')],_0x5bc12e[_0x676f('0x3b')]);_0x21fe61['attributes']=_[_0x676f('0x3a')](_0x5bc12e[_0x676f('0x37')],qs['fields'](_0x400889[_0x676f('0x3b')][_0x676f('0x3c')]));_0x21fe61['attributes']=_0x21fe61[_0x676f('0x3d')][_0x676f('0x3e')]?_0x21fe61['attributes']:_0x5bc12e['model'];if(!_0x400889['query'][_0x676f('0x3f')](_0x676f('0x40'))){_0x21fe61[_0x676f('0x1f')]=qs['limit'](_0x400889['query']['limit']);_0x21fe61[_0x676f('0x1d')]=qs[_0x676f('0x1d')](_0x400889[_0x676f('0x3b')][_0x676f('0x1d')]);}_0x21fe61[_0x676f('0x41')]=qs[_0x676f('0x42')](_0x400889[_0x676f('0x3b')][_0x676f('0x42')]);_0x21fe61[_0x676f('0x43')]=qs[_0x676f('0x39')](_[_0x676f('0x44')](_0x400889[_0x676f('0x3b')],_0x5bc12e[_0x676f('0x39')]),_0xbb32c1);if(_0x400889[_0x676f('0x3b')]['filter']){_0x21fe61['where']=_[_0x676f('0x2e')](_0x21fe61[_0x676f('0x43')],{'$or':_['map'](_0xbb32c1,function(_0xf37197){if(_0xf37197[_0x676f('0x45')]!==_0x676f('0x46')){var _0x5859cf={};_0x5859cf[_0xf37197[_0x676f('0x2c')]]={'$like':'%'+_0x400889[_0x676f('0x3b')]['filter']+'%'};return _0x5859cf;}})});}_0x21fe61=_['merge']({},_0x21fe61,_0x400889['options']);var _0x135c8f={'where':_0x21fe61[_0x676f('0x43')]};return db[_0x676f('0x47')][_0x676f('0x20')](_0x135c8f)[_0x676f('0x25')](function(_0x5dda5c){_0x3f988c[_0x676f('0x20')]=_0x5dda5c;if(_0x400889['query']['includeAll']){_0x21fe61['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x676f('0x48')](_0x21fe61);})[_0x676f('0x25')](function(_0x3bddd8){_0x3f988c[_0x676f('0x49')]=_0x3bddd8;return _0x3f988c;})['then'](respondWithFilteredResult(_0x19a4b7,_0x21fe61))[_0x676f('0x4a')](handleError(_0x19a4b7,null));};exports[_0x676f('0x4b')]=function(_0x5ded87,_0x5bbfb4){var _0x24119d={'raw':![],'where':{'id':_0x5ded87[_0x676f('0x4c')]['id']}},_0x429eda={};_0x429eda[_0x676f('0x37')]=_[_0x676f('0x38')](db[_0x676f('0x47')][_0x676f('0x34')]);_0x429eda[_0x676f('0x3b')]=_[_0x676f('0x38')](_0x5ded87[_0x676f('0x3b')]);_0x429eda['filters']=_[_0x676f('0x3a')](_0x429eda['model'],_0x429eda['query']);_0x24119d[_0x676f('0x3d')]=_['intersection'](_0x429eda['model'],qs[_0x676f('0x3c')](_0x5ded87[_0x676f('0x3b')][_0x676f('0x3c')]));_0x24119d[_0x676f('0x3d')]=_0x24119d['attributes'][_0x676f('0x3e')]?_0x24119d['attributes']:_0x429eda[_0x676f('0x37')];if(_0x5ded87[_0x676f('0x3b')]['includeAll']){_0x24119d[_0x676f('0x4d')]=[{'all':!![]}];}_0x24119d=_[_0x676f('0x2e')]({},_0x24119d,_0x5ded87[_0x676f('0x4e')]);return db[_0x676f('0x47')][_0x676f('0x4f')](_0x24119d)['then'](handleEntityNotFound(_0x5bbfb4,null))[_0x676f('0x25')](respondWithResult(_0x5bbfb4,null))[_0x676f('0x4a')](handleError(_0x5bbfb4,null));};exports[_0x676f('0x50')]=function(_0x5098cb,_0xb9f19f){return db[_0x676f('0x47')][_0x676f('0x50')](_0x5098cb['body'],{})[_0x676f('0x25')](function(_0x3e1d11){var _0x12f356=_0x5098cb[_0x676f('0x51')][_0x676f('0x27')]({'plain':!![]});if(!_0x12f356)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12f356['role']===_0x676f('0x51')){var _0x35c5db=_0x3e1d11[_0x676f('0x27')]({'plain':!![]});var _0x3c207c=_0x676f('0x28');return db[_0x676f('0x52')][_0x676f('0x4f')]({'where':{'name':_0x3c207c,'userProfileId':_0x12f356[_0x676f('0x53')]},'raw':!![]})['then'](function(_0x31cadd){if(_0x31cadd&&_0x31cadd[_0x676f('0x54')]===0x0){return db[_0x676f('0x29')][_0x676f('0x50')]({'name':_0x35c5db[_0x676f('0x2c')],'resourceId':_0x35c5db['id'],'type':_0x31cadd[_0x676f('0x2c')],'sectionId':_0x31cadd['id']},{})[_0x676f('0x25')](function(){return _0x3e1d11;});}else{return _0x3e1d11;}})[_0x676f('0x4a')](function(_0x588c17){logger[_0x676f('0x2a')](_0x676f('0x55'),_0x588c17);throw _0x588c17;});}return _0x3e1d11;})[_0x676f('0x25')](respondWithResult(_0xb9f19f,0xc9))[_0x676f('0x4a')](handleError(_0xb9f19f,null));};exports[_0x676f('0x24')]=function(_0x33a4a7,_0x12f479){if(_0x33a4a7[_0x676f('0x2f')]['id']){delete _0x33a4a7['body']['id'];}return db[_0x676f('0x47')][_0x676f('0x4f')]({'where':{'id':_0x33a4a7[_0x676f('0x4c')]['id']}})[_0x676f('0x25')](handleEntityNotFound(_0x12f479,null))[_0x676f('0x25')](saveUpdates(_0x33a4a7[_0x676f('0x2f')],null))['then'](respondWithResult(_0x12f479,null))[_0x676f('0x4a')](handleError(_0x12f479,null));};exports[_0x676f('0x26')]=function(_0x1bf139,_0x35f348){return db['VoiceChanSpy'][_0x676f('0x4f')]({'where':{'id':_0x1bf139[_0x676f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x35f348,null))[_0x676f('0x25')](removeEntity(_0x35f348,null))[_0x676f('0x4a')](handleError(_0x35f348,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9b796d9..4f4bdc2 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb315=['catch','destroy','bulkCreate','lodash','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','merge','format','CDR(type)=%s','chanspy','record','push','MixMonitor','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','User','agent','then','exports','models','define','VoiceChanSpy','length','VoiceExtension'];(function(_0xd5518b,_0x6bbeb2){var _0xc32ace=function(_0x55e41e){while(--_0x55e41e){_0xd5518b['push'](_0xd5518b['shift']());}};_0xc32ace(++_0x6bbeb2);}(_0xb315,0x6f));var _0x5b31=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb315[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0x5b31('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x5b31('0x1'));var getUserApplications=function(_0x4a79eb,_0x9bf5dd,_0x3c04c6){var _0x4f1704=0x1;var _0xa46410=[];var _0x1cac89={'context':_0x9bf5dd[_0x5b31('0x2')]||_0x5b31('0x3'),'exten':util['format'](_0x5b31('0x4'),_0x4a79eb[_0x5b31('0x5')],_0x3c04c6),'type':_0x5b31('0x6'),'isApp':![],'ChanSpyId':_0x4a79eb['id'],'UserId':_0x9bf5dd['id']};_0xa46410['push'](_[_0x5b31('0x7')]({'app':'Set','appdata':util[_0x5b31('0x8')](_0x5b31('0x9'),_0x5b31('0xa')),'priority':_0x4f1704++},_0x1cac89));if(_0x4a79eb[_0x5b31('0xb')]){_0xa46410[_0x5b31('0xc')](_[_0x5b31('0x7')]({'app':_0x5b31('0xd'),'appdata':util[_0x5b31('0x8')]('${UNIQUEID}.%s,a',_0x4a79eb['recordingFormat']),'priority':_0x4f1704++},_0x1cac89));}if(_0x4a79eb['auth']){_0xa46410[_0x5b31('0xc')](_['merge']({'app':_0x5b31('0xe'),'appdata':_0x4a79eb[_0x5b31('0xf')],'priority':_0x4f1704++},_0x1cac89));}_0xa46410[_0x5b31('0xc')](_[_0x5b31('0x7')]({'app':_0x5b31('0x10'),'appdata':util[_0x5b31('0x8')](_0x5b31('0x11'),_0x9bf5dd['name'],_0x4a79eb[_0x5b31('0x12')]?_0x4a79eb[_0x5b31('0x12')][_0x5b31('0x13')](''):''),'priority':_0x4f1704++},_0x1cac89));if(_0x4a79eb[_0x5b31('0xb')]){_0xa46410[_0x5b31('0xc')](_[_0x5b31('0x7')]({'app':_0x5b31('0x14'),'priority':_0x4f1704++},_0x1cac89));}return _0xa46410;};var getChanSpyApplications=function(_0x160842,_0x2010d3){var _0x404916=[];for(var _0x2e07cc=0x0,_0x5abf37=0x1;_0x2e07cc<_0x2010d3['length'];_0x2e07cc++,_0x5abf37=0x1){_0x404916=_0x404916[_0x5b31('0x15')](getUserApplications(_0x160842,_0x2010d3[_0x2e07cc],_0x2010d3[_0x2e07cc][_0x5b31('0x16')]));if(_0x2010d3[_0x2e07cc][_0x5b31('0x16')]!=_0x2010d3[_0x2e07cc][_0x5b31('0x17')]){_0x404916=_0x404916[_0x5b31('0x15')](getUserApplications(_0x160842,_0x2010d3[_0x2e07cc],_0x2010d3[_0x2e07cc]['name']));}}return _0x404916;};var getChanSpyPromise=function(_0x4d9d4f,_0x579e66){return new BPromise(function(_0x45ac12,_0x1370bd){return _0x4d9d4f[_0x5b31('0x18')]['findAll']({'attributes':['id','name',_0x5b31('0x16')],'where':{'role':_0x5b31('0x19'),'chanspy':!![]},'raw':!![]})[_0x5b31('0x1a')](function(_0x87da5b){if(_0x87da5b){return _0x45ac12(getChanSpyApplications(_0x579e66,_0x87da5b));}return _0x45ac12([]);})['catch'](function(_0x5daa7d){_0x1370bd(_0x5daa7d);});});};module[_0x5b31('0x1b')]=function(_0x2992b2,_0x5bea9e){var _0x3bae51=_0x2992b2[_0x5b31('0x1c')];return _0x2992b2[_0x5b31('0x1d')](_0x5b31('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2893d9,_0xc8b353,_0x36e27d){return getChanSpyPromise(_0x3bae51,_0x2893d9)[_0x5b31('0x1a')](function(_0x20d4c9){if(_0x20d4c9&&_0x20d4c9[_0x5b31('0x1f')]){return _0x3bae51[_0x5b31('0x20')]['bulkCreate'](_0x20d4c9);}})[_0x5b31('0x1a')](function(){_0x36e27d();})[_0x5b31('0x21')](function(_0x1304ab){_0x36e27d(_0x1304ab);});},'afterUpdate':function(_0xf5792b,_0x207ef7,_0x5627a9){return _0x3bae51['VoiceExtension'][_0x5b31('0x22')]({'where':{'ChanSpyId':_0xf5792b['id']}})[_0x5b31('0x1a')](function(){return getChanSpyPromise(_0x3bae51,_0xf5792b);})[_0x5b31('0x1a')](function(_0x479276){if(_0x479276&&_0x479276['length']){return _0x3bae51[_0x5b31('0x20')][_0x5b31('0x23')](_0x479276);}})['then'](function(){_0x5627a9();})[_0x5b31('0x21')](function(_0x1611ca){_0x5627a9(_0x1611ca);});},'afterDestroy':function(_0x18c414,_0x5c88ef,_0x405137){return _0x3bae51[_0x5b31('0x20')][_0x5b31('0x22')]({'where':{'ChanSpyId':_0x18c414['id']}})[_0x5b31('0x1a')](function(){_0x405137();})[_0x5b31('0x21')](function(_0x490728){_0x405137(_0x490728);});}}});}; \ No newline at end of file +var _0x153f=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x153f,0x15b));var _0xf153=function(_0x57e88c,_0x204c7b){_0x57e88c=_0x57e88c-0x0;var _0x571059=_0x153f[_0x57e88c];return _0x571059;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var BPromise=require(_0xf153('0x2'));var attributes=require(_0xf153('0x3'));var getUserApplications=function(_0x2afb9a,_0x1ccc1c,_0x3b85fc){var _0x59757c=0x1;var _0x364e65=[];var _0x5c49c7={'context':_0x1ccc1c[_0xf153('0x4')]||_0xf153('0x5'),'exten':util[_0xf153('0x6')](_0xf153('0x7'),_0x2afb9a[_0xf153('0x8')],_0x3b85fc),'type':'system','isApp':![],'ChanSpyId':_0x2afb9a['id'],'UserId':_0x1ccc1c['id']};_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0xb'),'appdata':util[_0xf153('0x6')](_0xf153('0xc'),_0xf153('0xd')),'priority':_0x59757c++},_0x5c49c7));if(_0x2afb9a[_0xf153('0xe')]){_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0xf'),'appdata':util['format'](_0xf153('0x10'),_0x2afb9a[_0xf153('0x11')]),'priority':_0x59757c++},_0x5c49c7));}if(_0x2afb9a[_0xf153('0x12')]){_0x364e65['push'](_[_0xf153('0xa')]({'app':_0xf153('0x13'),'appdata':_0x2afb9a[_0xf153('0x14')],'priority':_0x59757c++},_0x5c49c7));}_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0x15'),'appdata':util[_0xf153('0x6')](_0xf153('0x16'),_0x1ccc1c[_0xf153('0x17')],_0x2afb9a['options']?_0x2afb9a[_0xf153('0x18')][_0xf153('0x19')](''):''),'priority':_0x59757c++},_0x5c49c7));if(_0x2afb9a[_0xf153('0xe')]){_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0x1a'),'priority':_0x59757c++},_0x5c49c7));}return _0x364e65;};var getChanSpyApplications=function(_0x273a90,_0x287bc6){var _0x47fbfe=[];for(var _0x35f4e8=0x0,_0x564eeb=0x1;_0x35f4e8<_0x287bc6[_0xf153('0x1b')];_0x35f4e8++,_0x564eeb=0x1){_0x47fbfe=_0x47fbfe[_0xf153('0x1c')](getUserApplications(_0x273a90,_0x287bc6[_0x35f4e8],_0x287bc6[_0x35f4e8][_0xf153('0x1d')]));if(_0x287bc6[_0x35f4e8][_0xf153('0x1d')]!=_0x287bc6[_0x35f4e8]['name']){_0x47fbfe=_0x47fbfe[_0xf153('0x1c')](getUserApplications(_0x273a90,_0x287bc6[_0x35f4e8],_0x287bc6[_0x35f4e8][_0xf153('0x17')]));}}return _0x47fbfe;};var getChanSpyPromise=function(_0x41946a,_0x14b83f){return new BPromise(function(_0x15230c,_0x2f290f){return _0x41946a[_0xf153('0x1e')][_0xf153('0x1f')]({'attributes':['id',_0xf153('0x17'),_0xf153('0x1d')],'where':{'role':_0xf153('0x20'),'chanspy':!![]},'raw':!![]})[_0xf153('0x21')](function(_0x493e8a){if(_0x493e8a){return _0x15230c(getChanSpyApplications(_0x14b83f,_0x493e8a));}return _0x15230c([]);})[_0xf153('0x22')](function(_0x395f28){_0x2f290f(_0x395f28);});});};module[_0xf153('0x23')]=function(_0x32e759,_0x5c9f44){var _0x3e94b5=_0x32e759[_0xf153('0x24')];return _0x32e759[_0xf153('0x25')](_0xf153('0x26'),attributes,{'tableName':_0xf153('0x27'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1570fc,_0x39f3ed,_0x35cfe3){return getChanSpyPromise(_0x3e94b5,_0x1570fc)[_0xf153('0x21')](function(_0xe490f8){if(_0xe490f8&&_0xe490f8[_0xf153('0x1b')]){return _0x3e94b5[_0xf153('0x28')][_0xf153('0x29')](_0xe490f8);}})[_0xf153('0x21')](function(){_0x35cfe3();})[_0xf153('0x22')](function(_0x48ebdc){_0x35cfe3(_0x48ebdc);});},'afterUpdate':function(_0x6d62ef,_0x3f1c6f,_0x576788){return _0x3e94b5[_0xf153('0x28')][_0xf153('0x2a')]({'where':{'ChanSpyId':_0x6d62ef['id']}})['then'](function(){return getChanSpyPromise(_0x3e94b5,_0x6d62ef);})[_0xf153('0x21')](function(_0x10295e){if(_0x10295e&&_0x10295e[_0xf153('0x1b')]){return _0x3e94b5[_0xf153('0x28')][_0xf153('0x29')](_0x10295e);}})[_0xf153('0x21')](function(){_0x576788();})[_0xf153('0x22')](function(_0x3b5f4f){_0x576788(_0x3b5f4f);});},'afterDestroy':function(_0x19a568,_0x8e31bf,_0x13b541){return _0x3e94b5[_0xf153('0x28')]['destroy']({'where':{'ChanSpyId':_0x19a568['id']}})[_0xf153('0x21')](function(){_0x13b541();})[_0xf153('0x22')](function(_0x313516){_0x13b541(_0x313516);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 34f388d..181d140 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45b2=['code','message','info','request\x20sent','result','catch','lodash','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x29b4d5,_0x5b94c7){var _0x241d61=function(_0x127991){while(--_0x127991){_0x29b4d5['push'](_0x29b4d5['shift']());}};_0x241d61(++_0x5b94c7);}(_0x45b2,0xe2));var _0x245b=function(_0x4a2b0a,_0x1ff15a){_0x4a2b0a=_0x4a2b0a-0x0;var _0x56579a=_0x45b2[_0x4a2b0a];return _0x56579a;};'use strict';var _=require(_0x245b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x245b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x245b('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x245b('0x3'));var config=require(_0x245b('0x4'));var jayson=require(_0x245b('0x5'));var client=jayson[_0x245b('0x6')][_0x245b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ac740,_0x4ff3df,_0x4873b7){return new BPromise(function(_0x3133cc,_0x42d223){return client['request'](_0x1ac740,_0x4873b7)[_0x245b('0x8')](function(_0x5c4c88){logger['info'](_0x245b('0x9'),_0x4ff3df,'request\x20sent');logger[_0x245b('0xa')](_0x245b('0xb'),_0x4ff3df,'request\x20sent',JSON[_0x245b('0xc')](_0x5c4c88));if(_0x5c4c88[_0x245b('0xd')]){if(_0x5c4c88[_0x245b('0xd')][_0x245b('0xe')]===0x1f4){logger[_0x245b('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ff3df,_0x5c4c88[_0x245b('0xd')]['message']);return _0x42d223(_0x5c4c88[_0x245b('0xd')][_0x245b('0xf')]);}logger[_0x245b('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x4ff3df,_0x5c4c88[_0x245b('0xd')][_0x245b('0xf')]);return _0x3133cc(_0x5c4c88[_0x245b('0xd')][_0x245b('0xf')]);}else{logger[_0x245b('0x10')](_0x245b('0x9'),_0x4ff3df,_0x245b('0x11'));_0x3133cc(_0x5c4c88[_0x245b('0x12')][_0x245b('0xf')]);}})[_0x245b('0x13')](function(_0x3e2b8a){logger['error'](_0x245b('0x9'),_0x4ff3df,_0x3e2b8a);_0x42d223(_0x3e2b8a);});});} \ No newline at end of file +var _0xe756=['debug','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x444b7b,_0x3992a7){var _0x3d9de6=function(_0x55b15d){while(--_0x55b15d){_0x444b7b['push'](_0x444b7b['shift']());}};_0x3d9de6(++_0x3992a7);}(_0xe756,0x10f));var _0x6e75=function(_0x1eadaa,_0x4fc8fc){_0x1eadaa=_0x1eadaa-0x0;var _0x29dd3a=_0xe756[_0x1eadaa];return _0x29dd3a;};'use strict';var _=require(_0x6e75('0x0'));var util=require(_0x6e75('0x1'));var moment=require('moment');var BPromise=require(_0x6e75('0x2'));var rs=require(_0x6e75('0x3'));var fs=require('fs');var Redis=require(_0x6e75('0x4'));var db=require(_0x6e75('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e75('0x6'))(_0x6e75('0x7'));var config=require(_0x6e75('0x8'));var jayson=require(_0x6e75('0x9'));var client=jayson[_0x6e75('0xa')][_0x6e75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ebc64,_0x5ecc38,_0x3a612c){return new BPromise(function(_0x5f1a31,_0x295ee4){return client['request'](_0x2ebc64,_0x3a612c)[_0x6e75('0xc')](function(_0x5a5351){logger['info'](_0x6e75('0xd'),_0x5ecc38,_0x6e75('0xe'));logger[_0x6e75('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5ecc38,_0x6e75('0xe'),JSON['stringify'](_0x5a5351));if(_0x5a5351[_0x6e75('0x10')]){if(_0x5a5351[_0x6e75('0x10')][_0x6e75('0x11')]===0x1f4){logger[_0x6e75('0x10')](_0x6e75('0xd'),_0x5ecc38,_0x5a5351[_0x6e75('0x10')][_0x6e75('0x12')]);return _0x295ee4(_0x5a5351[_0x6e75('0x10')][_0x6e75('0x12')]);}logger[_0x6e75('0x10')](_0x6e75('0xd'),_0x5ecc38,_0x5a5351['error']['message']);return _0x5f1a31(_0x5a5351[_0x6e75('0x10')]['message']);}else{logger[_0x6e75('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x5ecc38,_0x6e75('0xe'));_0x5f1a31(_0x5a5351[_0x6e75('0x14')][_0x6e75('0x12')]);}})[_0x6e75('0x15')](function(_0x19361a){logger[_0x6e75('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5ecc38,_0x19361a);_0x295ee4(_0x19361a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index aee266e..51f471e 100644 --- a/server/api/voiceContext/index.js +++ b/server/api/voiceContext/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb32d=['../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4e3c02,_0x734e35){var _0x5a1912=function(_0x49c24b){while(--_0x49c24b){_0x4e3c02['push'](_0x4e3c02['shift']());}};_0x5a1912(++_0x734e35);}(_0xb32d,0x1da));var _0xdb32=function(_0xd8a959,_0x169203){_0xd8a959=_0xd8a959-0x0;var _0x536e01=_0xb32d[_0xd8a959];return _0x536e01;};'use strict';var multer=require(_0xdb32('0x0'));var util=require(_0xdb32('0x1'));var path=require(_0xdb32('0x2'));var timeout=require(_0xdb32('0x3'));var express=require(_0xdb32('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdb32('0x5'));var interaction=require(_0xdb32('0x6'));var config=require('../../config/environment');var controller=require(_0xdb32('0x7'));router[_0xdb32('0x8')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xa')]);router[_0xdb32('0x8')](_0xdb32('0xb'),auth['isAuthenticated'](),controller[_0xdb32('0xc')]);router[_0xdb32('0xd')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0xe')]);router[_0xdb32('0xf')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x10')]);router[_0xdb32('0x11')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x12')]);module[_0xdb32('0x13')]=router; \ No newline at end of file +var _0x057a=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x057a,0x1a6));var _0xa057=function(_0x396925,_0x5a664a){_0x396925=_0x396925-0x0;var _0x41b00b=_0x057a[_0x396925];return _0x41b00b;};'use strict';var multer=require(_0xa057('0x0'));var util=require(_0xa057('0x1'));var path=require(_0xa057('0x2'));var timeout=require('connect-timeout');var express=require(_0xa057('0x3'));var router=express['Router']();var fs_extra=require(_0xa057('0x4'));var auth=require(_0xa057('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa057('0x6'));var controller=require(_0xa057('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa057('0x8')]);router[_0xa057('0x9')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0xc')]);router[_0xa057('0xd')]('/',auth[_0xa057('0xb')](),controller[_0xa057('0xe')]);router[_0xa057('0xf')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0x10')]);router[_0xa057('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa057('0x12')]);module[_0xa057('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 9c8d384..0a7a241 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x4be02c,_0x41dee4){var _0xde6630=function(_0x15bc92){while(--_0x15bc92){_0x4be02c['push'](_0x4be02c['shift']());}};_0xde6630(++_0x41dee4);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x3ce76a,_0x465d60){var _0x3b3bef=function(_0x139c70){while(--_0x139c70){_0x3ce76a['push'](_0x3ce76a['shift']());}};_0x3b3bef(++_0x465d60);}(_0x3e74,0x175));var _0x43e7=function(_0x180e85,_0x3cd6b1){_0x180e85=_0x180e85-0x0;var _0x58da36=_0x3e74[_0x180e85];return _0x58da36;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 479616b..d578a8e 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d1f=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','params','create','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','readFileSync','server/files/templates/context.ejs','Reload','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','then','get','UserProfileResource','destroy','name','send','render','body','contact','agent','interaction','account','map','rawAttributes','fieldName'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x4d1f,0x16b));var _0xf4d1=function(_0x3a46be,_0x2c0e3e){_0x3a46be=_0x3a46be-0x0;var _0x401e3e=_0x4d1f[_0x3a46be];return _0x401e3e;};'use strict';var emlformat=require(_0xf4d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4d1('0x1'));var jsonpatch=require(_0xf4d1('0x2'));var rp=require('request-promise');var moment=require(_0xf4d1('0x3'));var BPromise=require(_0xf4d1('0x4'));var Mustache=require(_0xf4d1('0x5'));var util=require(_0xf4d1('0x6'));var path=require(_0xf4d1('0x7'));var sox=require(_0xf4d1('0x8'));var csv=require(_0xf4d1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4d1('0xa'));var _=require(_0xf4d1('0xb'));var squel=require(_0xf4d1('0xc'));var crypto=require(_0xf4d1('0xd'));var jsforce=require(_0xf4d1('0xe'));var deskjs=require(_0xf4d1('0xf'));var toCsv=require(_0xf4d1('0x9'));var querystring=require(_0xf4d1('0x10'));var Papa=require(_0xf4d1('0x11'));var Redis=require(_0xf4d1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf4d1('0x13'));var utils=require(_0xf4d1('0x14'));var config=require(_0xf4d1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4d1('0x16'))['db'];var jayson=require(_0xf4d1('0x17'));var client=jayson[_0xf4d1('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16db18,_0x33a7e2,_0x129114,_0x343c6e){return new BPromise(function(_0x2bcc53,_0x3cf337){var _0x21582a=_0x343c6e||client;return _0x21582a[_0xf4d1('0x19')](_0x16db18,_0x129114)['then'](function(_0x2aa0b7){logger[_0xf4d1('0x1a')](_0xf4d1('0x1b'),_0x33a7e2,_0xf4d1('0x1c'));logger['debug'](_0xf4d1('0x1d'),_0x33a7e2,_0xf4d1('0x1c'),JSON[_0xf4d1('0x1e')](_0x2aa0b7));if(_0x2aa0b7[_0xf4d1('0x1f')]){if(_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x20')]===0x1f4){logger[_0xf4d1('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x33a7e2,_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);return _0x3cf337(_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);}logger[_0xf4d1('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x33a7e2,_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);return _0x2bcc53(_0x2aa0b7[_0xf4d1('0x1f')][_0xf4d1('0x21')]);}else{logger[_0xf4d1('0x1a')](_0xf4d1('0x1b'),_0x33a7e2,_0xf4d1('0x1c'));_0x2bcc53(_0x2aa0b7[_0xf4d1('0x22')][_0xf4d1('0x21')]);}})[_0xf4d1('0x23')](function(_0x489b55){logger[_0xf4d1('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x33a7e2,_0x489b55);_0x3cf337(_0x489b55);});});}function respondWithStatusCode(_0x3802e0,_0x3c60a0){_0x3c60a0=_0x3c60a0||0xcc;return function(_0x194dc4){if(_0x194dc4){return _0x3802e0[_0xf4d1('0x24')](_0x3c60a0);}return _0x3802e0[_0xf4d1('0x25')](_0x3c60a0)[_0xf4d1('0x26')]();};}function respondWithResult(_0x1d776b,_0x5eb36b){_0x5eb36b=_0x5eb36b||0xc8;return function(_0x4ea82f){if(_0x4ea82f){return _0x1d776b[_0xf4d1('0x25')](_0x5eb36b)['json'](_0x4ea82f);}};}function respondWithFilteredResult(_0x2fe994,_0x2ce8e8){return function(_0x4e01db){if(_0x4e01db){var _0x345393=typeof _0x2ce8e8[_0xf4d1('0x27')]===_0xf4d1('0x28')&&typeof _0x2ce8e8[_0xf4d1('0x29')]===_0xf4d1('0x28');var _0x82ffff=_0x4e01db['count'];var _0x1f341d=_0x345393?0x0:_0x2ce8e8[_0xf4d1('0x27')];var _0x1816b7=_0x345393?_0x4e01db[_0xf4d1('0x2a')]:_0x2ce8e8[_0xf4d1('0x27')]+_0x2ce8e8[_0xf4d1('0x29')];var _0x228921;if(_0x1816b7>=_0x82ffff){_0x1816b7=_0x82ffff;_0x228921=0xc8;}else{_0x228921=0xce;}_0x2fe994[_0xf4d1('0x25')](_0x228921);return _0x2fe994[_0xf4d1('0x2b')](_0xf4d1('0x2c'),_0x1f341d+'-'+_0x1816b7+'/'+_0x82ffff)['json'](_0x4e01db);}return null;};}function patchUpdates(_0x2802ba){return function(_0x1663e7){try{jsonpatch['apply'](_0x1663e7,_0x2802ba,!![]);}catch(_0x5e7e94){return BPromise[_0xf4d1('0x2d')](_0x5e7e94);}return _0x1663e7['save']();};}function saveUpdates(_0x125514,_0x46291d){return function(_0x455cf6){if(_0x455cf6){return _0x455cf6['update'](_0x125514)[_0xf4d1('0x2e')](function(_0x34c5f4){return _0x34c5f4;});}return null;};}function removeEntity(_0x27a357,_0x59cc7a){return function(_0x3c8a3d){if(_0x3c8a3d){return _0x3c8a3d['destroy']()['then'](function(){var _0x304d5e=_0x3c8a3d[_0xf4d1('0x2f')]({'plain':!![]});var _0x1366ab='Contexts';return db[_0xf4d1('0x30')][_0xf4d1('0x31')]({'where':{'type':_0x1366ab,'resourceId':_0x304d5e['id']}})[_0xf4d1('0x2e')](function(){return _0x3c8a3d;});})[_0xf4d1('0x2e')](function(){_0x27a357[_0xf4d1('0x25')](0xcc)[_0xf4d1('0x26')]();});}};}function handleEntityNotFound(_0x1bb0a8,_0x3fc081){return function(_0x1ca678){if(!_0x1ca678){_0x1bb0a8[_0xf4d1('0x24')](0x194);}return _0x1ca678;};}function handleError(_0x13fb7b,_0x5ba7e6){_0x5ba7e6=_0x5ba7e6||0x1f4;return function(_0xe34e65){logger[_0xf4d1('0x1f')](_0xe34e65['stack']);if(_0xe34e65[_0xf4d1('0x32')]){delete _0xe34e65[_0xf4d1('0x32')];}_0x13fb7b[_0xf4d1('0x25')](_0x5ba7e6)[_0xf4d1('0x33')](_0xe34e65);};}function getMustacheRender(_0x363e4b,_0x12c9d1){return Mustache[_0xf4d1('0x34')](_0x363e4b,_['merge'](_0x12c9d1[_0xf4d1('0x35')],{'contact':_0x12c9d1[_0xf4d1('0x36')],'message':_0x12c9d1[_0xf4d1('0x21')],'agent':_0x12c9d1[_0xf4d1('0x37')],'interaction':_0x12c9d1[_0xf4d1('0x38')],'account':_0x12c9d1[_0xf4d1('0x39')]}))||'';}exports['index']=function(_0x5472e9,_0x1cdbac){var _0x4f3c92={},_0x16804b={},_0x26c264={'count':0x0,'rows':[]};var _0x1ef646=_[_0xf4d1('0x3a')](db['VoiceContext'][_0xf4d1('0x3b')],function(_0x41965e){return{'name':_0x41965e[_0xf4d1('0x3c')],'type':_0x41965e[_0xf4d1('0x3d')][_0xf4d1('0x3e')]};});_0x16804b[_0xf4d1('0x3f')]=_[_0xf4d1('0x3a')](_0x1ef646,_0xf4d1('0x32'));_0x16804b[_0xf4d1('0x40')]=_[_0xf4d1('0x41')](_0x5472e9[_0xf4d1('0x40')]);_0x16804b[_0xf4d1('0x42')]=_[_0xf4d1('0x43')](_0x16804b[_0xf4d1('0x3f')],_0x16804b[_0xf4d1('0x40')]);_0x4f3c92[_0xf4d1('0x44')]=_[_0xf4d1('0x43')](_0x16804b[_0xf4d1('0x3f')],qs[_0xf4d1('0x45')](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x45')]));_0x4f3c92[_0xf4d1('0x44')]=_0x4f3c92[_0xf4d1('0x44')][_0xf4d1('0x46')]?_0x4f3c92['attributes']:_0x16804b[_0xf4d1('0x3f')];if(!_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x47')]('nolimit')){_0x4f3c92[_0xf4d1('0x29')]=qs['limit'](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x29')]);_0x4f3c92[_0xf4d1('0x27')]=qs['offset'](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x27')]);}_0x4f3c92['order']=qs[_0xf4d1('0x48')](_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x48')]);_0x4f3c92[_0xf4d1('0x49')]=qs[_0xf4d1('0x42')](_[_0xf4d1('0x4a')](_0x5472e9['query'],_0x16804b['filters']),_0x1ef646);if(_0x5472e9['query'][_0xf4d1('0x4b')]){_0x4f3c92[_0xf4d1('0x49')]=_[_0xf4d1('0x4c')](_0x4f3c92[_0xf4d1('0x49')],{'$or':_['map'](_0x1ef646,function(_0x5ace78){if(_0x5ace78[_0xf4d1('0x3d')]!==_0xf4d1('0x4d')){var _0x5e04a9={};_0x5e04a9[_0x5ace78['name']]={'$like':'%'+_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x4b')]+'%'};return _0x5e04a9;}})});}_0x4f3c92=_['merge']({},_0x4f3c92,_0x5472e9[_0xf4d1('0x4e')]);var _0x39d8fc={'where':_0x4f3c92[_0xf4d1('0x49')]};return db[_0xf4d1('0x4f')]['count'](_0x39d8fc)[_0xf4d1('0x2e')](function(_0x5c75df){_0x26c264[_0xf4d1('0x2a')]=_0x5c75df;if(_0x5472e9[_0xf4d1('0x40')][_0xf4d1('0x50')]){_0x4f3c92[_0xf4d1('0x51')]=[{'all':!![]}];}return db[_0xf4d1('0x4f')][_0xf4d1('0x52')](_0x4f3c92);})[_0xf4d1('0x2e')](function(_0x1b7f73){_0x26c264[_0xf4d1('0x53')]=_0x1b7f73;return _0x26c264;})[_0xf4d1('0x2e')](respondWithFilteredResult(_0x1cdbac,_0x4f3c92))[_0xf4d1('0x23')](handleError(_0x1cdbac,null));};exports[_0xf4d1('0x54')]=function(_0x3c0c24,_0x2563d6){var _0x1ada29={'raw':![],'where':{'id':_0x3c0c24[_0xf4d1('0x55')]['id']}},_0x5cac66={};_0x5cac66[_0xf4d1('0x3f')]=_[_0xf4d1('0x41')](db[_0xf4d1('0x4f')][_0xf4d1('0x3b')]);_0x5cac66[_0xf4d1('0x40')]=_[_0xf4d1('0x41')](_0x3c0c24['query']);_0x5cac66[_0xf4d1('0x42')]=_[_0xf4d1('0x43')](_0x5cac66['model'],_0x5cac66[_0xf4d1('0x40')]);_0x1ada29[_0xf4d1('0x44')]=_['intersection'](_0x5cac66[_0xf4d1('0x3f')],qs[_0xf4d1('0x45')](_0x3c0c24['query']['fields']));_0x1ada29['attributes']=_0x1ada29[_0xf4d1('0x44')][_0xf4d1('0x46')]?_0x1ada29['attributes']:_0x5cac66['model'];if(_0x3c0c24['query'][_0xf4d1('0x50')]){_0x1ada29[_0xf4d1('0x51')]=[{'all':!![]}];}_0x1ada29=_[_0xf4d1('0x4c')]({},_0x1ada29,_0x3c0c24[_0xf4d1('0x4e')]);return db[_0xf4d1('0x4f')]['find'](_0x1ada29)[_0xf4d1('0x2e')](handleEntityNotFound(_0x2563d6,null))[_0xf4d1('0x2e')](respondWithResult(_0x2563d6,null))[_0xf4d1('0x23')](handleError(_0x2563d6,null));};exports[_0xf4d1('0x56')]=function(_0x2b4bb8,_0x5bda57,_0x196064){var _0x259c97;return db[_0xf4d1('0x4f')][_0xf4d1('0x56')](_0x2b4bb8[_0xf4d1('0x35')],{'raw':!![]})[_0xf4d1('0x2e')](function(_0x36ed2e){_0x259c97=_0x36ed2e;return db[_0xf4d1('0x4f')][_0xf4d1('0x52')]({'raw':!![]});})[_0xf4d1('0x2e')](function(_0xc7bb88){var _0x331452=fs['readFileSync'](path[_0xf4d1('0x57')](config[_0xf4d1('0x58')],'server/files/templates/context.ejs'),_0xf4d1('0x59'));var _0x5d7539=ejs['render'](_0x331452,{'contexts':_0xc7bb88||[]});fs[_0xf4d1('0x5a')](_0xf4d1('0x5b'),_0x5d7539);})[_0xf4d1('0x2e')](function(){return respondWithRpcPromise('Reload',_0xf4d1('0x56'),{'module':_0xf4d1('0x5c')});})[_0xf4d1('0x2e')](function(){var _0x2d65a7=_0x2b4bb8['user'][_0xf4d1('0x2f')]({'plain':!![]});if(!_0x2d65a7)throw new Error(_0xf4d1('0x5d'));if(_0x2d65a7[_0xf4d1('0x5e')]===_0xf4d1('0x5f')){var _0x15877c=_0x259c97[_0xf4d1('0x2f')]({'plain':!![]});return db[_0xf4d1('0x60')]['find']({'where':{'name':_0xf4d1('0x61'),'userProfileId':_0x2d65a7[_0xf4d1('0x62')]},'raw':!![]})['then'](function(_0x4cb1af){if(_0x4cb1af&&_0x4cb1af[_0xf4d1('0x63')]===0x0){return db[_0xf4d1('0x30')]['create']({'name':_0x15877c['name'],'resourceId':_0x15877c['id'],'type':_0x4cb1af[_0xf4d1('0x32')],'sectionId':_0x4cb1af['id']},{})[_0xf4d1('0x2e')](function(){return _0x259c97;});}else{return _0x259c97;}})['catch'](function(_0x23fe37){logger[_0xf4d1('0x1f')](_0xf4d1('0x64'),_0x23fe37);throw _0x23fe37;});}return _0x259c97;})[_0xf4d1('0x2e')](respondWithResult(_0x5bda57,0xc9))[_0xf4d1('0x23')](handleError(_0x5bda57,null));};exports[_0xf4d1('0x65')]=function(_0x1dbdea,_0x749ad2,_0x4f2098){var _0x42b404;return db[_0xf4d1('0x4f')][_0xf4d1('0x66')]({'where':{'id':_0x1dbdea[_0xf4d1('0x55')]['id']}})['then'](handleEntityNotFound(_0x749ad2,null))[_0xf4d1('0x2e')](saveUpdates(_0x1dbdea[_0xf4d1('0x35')],null))[_0xf4d1('0x2e')](function(_0x5658ef){if(_0x5658ef){_0x42b404=_0x5658ef;return db[_0xf4d1('0x4f')][_0xf4d1('0x52')]({'raw':!![]});}})[_0xf4d1('0x2e')](function(_0x36a88b){var _0x46fe9a=fs[_0xf4d1('0x67')](path[_0xf4d1('0x57')](config[_0xf4d1('0x58')],_0xf4d1('0x68')),_0xf4d1('0x59'));var _0x2eeae6=ejs[_0xf4d1('0x34')](_0x46fe9a,{'contexts':_0x36a88b||[]});fs['writeFileSync'](_0xf4d1('0x5b'),_0x2eeae6);})[_0xf4d1('0x2e')](function(){return respondWithRpcPromise(_0xf4d1('0x69'),_0xf4d1('0x65'),{'module':_0xf4d1('0x5c')});})[_0xf4d1('0x2e')](function(){return _0x42b404;})[_0xf4d1('0x2e')](respondWithResult(_0x749ad2,null))[_0xf4d1('0x23')](handleError(_0x749ad2,null));};exports[_0xf4d1('0x31')]=function(_0xe8148e,_0x4990d4,_0x20bbd0){var _0x6aff00;return db[_0xf4d1('0x4f')][_0xf4d1('0x66')]({'where':{'id':_0xe8148e[_0xf4d1('0x55')]['id']}})[_0xf4d1('0x2e')](handleEntityNotFound(_0x4990d4,null))[_0xf4d1('0x2e')](removeEntity(_0x4990d4,null))[_0xf4d1('0x2e')](function(){return db[_0xf4d1('0x4f')][_0xf4d1('0x52')]({'raw':!![]});})[_0xf4d1('0x2e')](function(_0xe8ec90){var _0xb8a694=fs[_0xf4d1('0x67')](path[_0xf4d1('0x57')](config[_0xf4d1('0x58')],_0xf4d1('0x68')),_0xf4d1('0x59'));var _0x5dfe29=ejs[_0xf4d1('0x34')](_0xb8a694,{'contexts':_0xe8ec90});fs[_0xf4d1('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5dfe29);return respondWithRpcPromise(_0xf4d1('0x69'),_0xf4d1('0x31'),{'module':_0xf4d1('0x5c')});})[_0xf4d1('0x23')](handleError(_0x4990d4,null));}; \ No newline at end of file +var _0x6860=['stack','name','render','merge','body','contact','agent','interaction','account','index','map','VoiceContext','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','catch','keys','options','find','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','get','Contexts','UserProfileResource','destroy'];(function(_0x179293,_0x28da36){var _0x5ba3ce=function(_0x3a5863){while(--_0x3a5863){_0x179293['push'](_0x179293['shift']());}};_0x5ba3ce(++_0x28da36);}(_0x6860,0x179));var _0x0686=function(_0x1e273e,_0x524859){_0x1e273e=_0x1e273e-0x0;var _0x24d354=_0x6860[_0x1e273e];return _0x24d354;};'use strict';var emlformat=require(_0x0686('0x0'));var rimraf=require(_0x0686('0x1'));var zipdir=require(_0x0686('0x2'));var jsonpatch=require(_0x0686('0x3'));var rp=require(_0x0686('0x4'));var moment=require(_0x0686('0x5'));var BPromise=require(_0x0686('0x6'));var Mustache=require('mustache');var util=require(_0x0686('0x7'));var path=require(_0x0686('0x8'));var sox=require('sox');var csv=require(_0x0686('0x9'));var ejs=require(_0x0686('0xa'));var fs=require('fs');var fs_extra=require(_0x0686('0xb'));var _=require(_0x0686('0xc'));var squel=require(_0x0686('0xd'));var crypto=require('crypto');var jsforce=require(_0x0686('0xe'));var deskjs=require(_0x0686('0xf'));var toCsv=require(_0x0686('0x9'));var querystring=require(_0x0686('0x10'));var Papa=require('papaparse');var Redis=require(_0x0686('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0686('0x12'));var as=require(_0x0686('0x13'));var hardwareService=require(_0x0686('0x14'));var logger=require(_0x0686('0x15'))(_0x0686('0x16'));var utils=require(_0x0686('0x17'));var config=require(_0x0686('0x18'));var licenseUtil=require(_0x0686('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0686('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x184217,_0x2a95f0,_0x19d0b5,_0x3a78aa){return new BPromise(function(_0x515e79,_0x2eabec){var _0x45a5e8=_0x3a78aa||client;return _0x45a5e8[_0x0686('0x1b')](_0x184217,_0x19d0b5)[_0x0686('0x1c')](function(_0x3744a0){logger[_0x0686('0x1d')](_0x0686('0x1e'),_0x2a95f0,'request\x20sent');logger['debug'](_0x0686('0x1f'),_0x2a95f0,_0x0686('0x20'),JSON[_0x0686('0x21')](_0x3744a0));if(_0x3744a0[_0x0686('0x22')]){if(_0x3744a0['error'][_0x0686('0x23')]===0x1f4){logger[_0x0686('0x22')](_0x0686('0x1e'),_0x2a95f0,_0x3744a0[_0x0686('0x22')][_0x0686('0x24')]);return _0x2eabec(_0x3744a0['error'][_0x0686('0x24')]);}logger[_0x0686('0x22')](_0x0686('0x1e'),_0x2a95f0,_0x3744a0[_0x0686('0x22')][_0x0686('0x24')]);return _0x515e79(_0x3744a0[_0x0686('0x22')][_0x0686('0x24')]);}else{logger[_0x0686('0x1d')](_0x0686('0x1e'),_0x2a95f0,_0x0686('0x20'));_0x515e79(_0x3744a0[_0x0686('0x25')][_0x0686('0x24')]);}})['catch'](function(_0x1bb4b9){logger['error'](_0x0686('0x1e'),_0x2a95f0,_0x1bb4b9);_0x2eabec(_0x1bb4b9);});});}function respondWithStatusCode(_0xbc0b4b,_0x2dc2e6){_0x2dc2e6=_0x2dc2e6||0xcc;return function(_0x32f49e){if(_0x32f49e){return _0xbc0b4b[_0x0686('0x26')](_0x2dc2e6);}return _0xbc0b4b[_0x0686('0x27')](_0x2dc2e6)[_0x0686('0x28')]();};}function respondWithResult(_0x4c387c,_0x5406a8){_0x5406a8=_0x5406a8||0xc8;return function(_0x21780d){if(_0x21780d){return _0x4c387c['status'](_0x5406a8)['json'](_0x21780d);}};}function respondWithFilteredResult(_0x30bc27,_0x5f3d9a){return function(_0x469f70){if(_0x469f70){var _0xfeb78d=typeof _0x5f3d9a[_0x0686('0x29')]==='undefined'&&typeof _0x5f3d9a['limit']===_0x0686('0x2a');var _0xf2fb70=_0x469f70[_0x0686('0x2b')];var _0x3d69f4=_0xfeb78d?0x0:_0x5f3d9a[_0x0686('0x29')];var _0x3ed123=_0xfeb78d?_0x469f70['count']:_0x5f3d9a[_0x0686('0x29')]+_0x5f3d9a[_0x0686('0x2c')];var _0x2a3d6f;if(_0x3ed123>=_0xf2fb70){_0x3ed123=_0xf2fb70;_0x2a3d6f=0xc8;}else{_0x2a3d6f=0xce;}_0x30bc27[_0x0686('0x27')](_0x2a3d6f);return _0x30bc27[_0x0686('0x2d')](_0x0686('0x2e'),_0x3d69f4+'-'+_0x3ed123+'/'+_0xf2fb70)[_0x0686('0x2f')](_0x469f70);}return null;};}function patchUpdates(_0x5f0bc2){return function(_0x1e816c){try{jsonpatch[_0x0686('0x30')](_0x1e816c,_0x5f0bc2,!![]);}catch(_0x5d49b3){return BPromise[_0x0686('0x31')](_0x5d49b3);}return _0x1e816c['save']();};}function saveUpdates(_0x2051bb,_0x355f3){return function(_0x28e138){if(_0x28e138){return _0x28e138[_0x0686('0x32')](_0x2051bb)[_0x0686('0x1c')](function(_0x2c82f7){return _0x2c82f7;});}return null;};}function removeEntity(_0x149afe,_0x4b7615){return function(_0x451a63){if(_0x451a63){return _0x451a63['destroy']()[_0x0686('0x1c')](function(){var _0x29dfe7=_0x451a63[_0x0686('0x33')]({'plain':!![]});var _0x57af5a=_0x0686('0x34');return db[_0x0686('0x35')][_0x0686('0x36')]({'where':{'type':_0x57af5a,'resourceId':_0x29dfe7['id']}})[_0x0686('0x1c')](function(){return _0x451a63;});})[_0x0686('0x1c')](function(){_0x149afe[_0x0686('0x27')](0xcc)[_0x0686('0x28')]();});}};}function handleEntityNotFound(_0x2d8e92,_0xbd8d34){return function(_0xb678cb){if(!_0xb678cb){_0x2d8e92[_0x0686('0x26')](0x194);}return _0xb678cb;};}function handleError(_0x2f4a67,_0x2bb657){_0x2bb657=_0x2bb657||0x1f4;return function(_0x42e0e6){logger[_0x0686('0x22')](_0x42e0e6[_0x0686('0x37')]);if(_0x42e0e6['name']){delete _0x42e0e6[_0x0686('0x38')];}_0x2f4a67[_0x0686('0x27')](_0x2bb657)['send'](_0x42e0e6);};}function getMustacheRender(_0x618f6b,_0x2c0c78){return Mustache[_0x0686('0x39')](_0x618f6b,_[_0x0686('0x3a')](_0x2c0c78[_0x0686('0x3b')],{'contact':_0x2c0c78[_0x0686('0x3c')],'message':_0x2c0c78[_0x0686('0x24')],'agent':_0x2c0c78[_0x0686('0x3d')],'interaction':_0x2c0c78[_0x0686('0x3e')],'account':_0x2c0c78[_0x0686('0x3f')]}))||'';}exports[_0x0686('0x40')]=function(_0x16ca1d,_0x54bca2){var _0x5860e3={},_0x5ed284={},_0x1c22aa={'count':0x0,'rows':[]};var _0x27e083=_[_0x0686('0x41')](db[_0x0686('0x42')][_0x0686('0x43')],function(_0x3a67c0){return{'name':_0x3a67c0['fieldName'],'type':_0x3a67c0[_0x0686('0x44')][_0x0686('0x45')]};});_0x5ed284[_0x0686('0x46')]=_[_0x0686('0x41')](_0x27e083,_0x0686('0x38'));_0x5ed284['query']=_['keys'](_0x16ca1d[_0x0686('0x47')]);_0x5ed284[_0x0686('0x48')]=_['intersection'](_0x5ed284[_0x0686('0x46')],_0x5ed284[_0x0686('0x47')]);_0x5860e3[_0x0686('0x49')]=_[_0x0686('0x4a')](_0x5ed284[_0x0686('0x46')],qs[_0x0686('0x4b')](_0x16ca1d['query'][_0x0686('0x4b')]));_0x5860e3[_0x0686('0x49')]=_0x5860e3[_0x0686('0x49')][_0x0686('0x4c')]?_0x5860e3['attributes']:_0x5ed284['model'];if(!_0x16ca1d['query'][_0x0686('0x4d')](_0x0686('0x4e'))){_0x5860e3['limit']=qs[_0x0686('0x2c')](_0x16ca1d[_0x0686('0x47')][_0x0686('0x2c')]);_0x5860e3[_0x0686('0x29')]=qs[_0x0686('0x29')](_0x16ca1d[_0x0686('0x47')][_0x0686('0x29')]);}_0x5860e3[_0x0686('0x4f')]=qs[_0x0686('0x50')](_0x16ca1d[_0x0686('0x47')][_0x0686('0x50')]);_0x5860e3[_0x0686('0x51')]=qs[_0x0686('0x48')](_[_0x0686('0x52')](_0x16ca1d['query'],_0x5ed284[_0x0686('0x48')]),_0x27e083);if(_0x16ca1d[_0x0686('0x47')][_0x0686('0x53')]){_0x5860e3[_0x0686('0x51')]=_['merge'](_0x5860e3[_0x0686('0x51')],{'$or':_[_0x0686('0x41')](_0x27e083,function(_0x2c9610){if(_0x2c9610[_0x0686('0x44')]!==_0x0686('0x54')){var _0x40c044={};_0x40c044[_0x2c9610[_0x0686('0x38')]]={'$like':'%'+_0x16ca1d[_0x0686('0x47')][_0x0686('0x53')]+'%'};return _0x40c044;}})});}_0x5860e3=_[_0x0686('0x3a')]({},_0x5860e3,_0x16ca1d['options']);var _0x784a24={'where':_0x5860e3[_0x0686('0x51')]};return db[_0x0686('0x42')][_0x0686('0x2b')](_0x784a24)['then'](function(_0x55c8a5){_0x1c22aa[_0x0686('0x2b')]=_0x55c8a5;if(_0x16ca1d[_0x0686('0x47')][_0x0686('0x55')]){_0x5860e3[_0x0686('0x56')]=[{'all':!![]}];}return db[_0x0686('0x42')]['findAll'](_0x5860e3);})['then'](function(_0x54805c){_0x1c22aa['rows']=_0x54805c;return _0x1c22aa;})[_0x0686('0x1c')](respondWithFilteredResult(_0x54bca2,_0x5860e3))[_0x0686('0x57')](handleError(_0x54bca2,null));};exports['show']=function(_0x52da5d,_0x2dc922){var _0x5094f4={'raw':![],'where':{'id':_0x52da5d['params']['id']}},_0x12a804={};_0x12a804[_0x0686('0x46')]=_[_0x0686('0x58')](db[_0x0686('0x42')][_0x0686('0x43')]);_0x12a804[_0x0686('0x47')]=_[_0x0686('0x58')](_0x52da5d[_0x0686('0x47')]);_0x12a804[_0x0686('0x48')]=_[_0x0686('0x4a')](_0x12a804['model'],_0x12a804[_0x0686('0x47')]);_0x5094f4['attributes']=_[_0x0686('0x4a')](_0x12a804[_0x0686('0x46')],qs[_0x0686('0x4b')](_0x52da5d[_0x0686('0x47')]['fields']));_0x5094f4[_0x0686('0x49')]=_0x5094f4[_0x0686('0x49')][_0x0686('0x4c')]?_0x5094f4[_0x0686('0x49')]:_0x12a804[_0x0686('0x46')];if(_0x52da5d[_0x0686('0x47')][_0x0686('0x55')]){_0x5094f4[_0x0686('0x56')]=[{'all':!![]}];}_0x5094f4=_[_0x0686('0x3a')]({},_0x5094f4,_0x52da5d[_0x0686('0x59')]);return db[_0x0686('0x42')][_0x0686('0x5a')](_0x5094f4)[_0x0686('0x1c')](handleEntityNotFound(_0x2dc922,null))[_0x0686('0x1c')](respondWithResult(_0x2dc922,null))[_0x0686('0x57')](handleError(_0x2dc922,null));};exports[_0x0686('0x5b')]=function(_0x1fbf4c,_0x496ed0,_0x41880e){var _0x1ed7d3;return db[_0x0686('0x42')]['create'](_0x1fbf4c[_0x0686('0x3b')],{'raw':!![]})[_0x0686('0x1c')](function(_0x34d5ae){_0x1ed7d3=_0x34d5ae;return db['VoiceContext'][_0x0686('0x5c')]({'raw':!![]});})[_0x0686('0x1c')](function(_0x43daae){var _0x5a4875=fs[_0x0686('0x5d')](path[_0x0686('0x5e')](config[_0x0686('0x5f')],_0x0686('0x60')),'utf8');var _0x497cb5=ejs[_0x0686('0x39')](_0x5a4875,{'contexts':_0x43daae||[]});fs[_0x0686('0x61')](_0x0686('0x62'),_0x497cb5);})[_0x0686('0x1c')](function(){return respondWithRpcPromise(_0x0686('0x63'),_0x0686('0x5b'),{'module':_0x0686('0x64')});})[_0x0686('0x1c')](function(){var _0x1e92dc=_0x1fbf4c[_0x0686('0x65')]['get']({'plain':!![]});if(!_0x1e92dc)throw new Error(_0x0686('0x66'));if(_0x1e92dc[_0x0686('0x67')]===_0x0686('0x65')){var _0x258b06=_0x1ed7d3[_0x0686('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x0686('0x5a')]({'where':{'name':_0x0686('0x34'),'userProfileId':_0x1e92dc[_0x0686('0x68')]},'raw':!![]})[_0x0686('0x1c')](function(_0x2dd290){if(_0x2dd290&&_0x2dd290[_0x0686('0x69')]===0x0){return db[_0x0686('0x35')][_0x0686('0x5b')]({'name':_0x258b06[_0x0686('0x38')],'resourceId':_0x258b06['id'],'type':_0x2dd290[_0x0686('0x38')],'sectionId':_0x2dd290['id']},{})[_0x0686('0x1c')](function(){return _0x1ed7d3;});}else{return _0x1ed7d3;}})[_0x0686('0x57')](function(_0x18c6e6){logger[_0x0686('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18c6e6);throw _0x18c6e6;});}return _0x1ed7d3;})[_0x0686('0x1c')](respondWithResult(_0x496ed0,0xc9))[_0x0686('0x57')](handleError(_0x496ed0,null));};exports[_0x0686('0x32')]=function(_0x5d161a,_0x567f24,_0x11a025){var _0x3fbef4;return db['VoiceContext'][_0x0686('0x5a')]({'where':{'id':_0x5d161a[_0x0686('0x6a')]['id']}})[_0x0686('0x1c')](handleEntityNotFound(_0x567f24,null))[_0x0686('0x1c')](saveUpdates(_0x5d161a[_0x0686('0x3b')],null))[_0x0686('0x1c')](function(_0x5e6444){if(_0x5e6444){_0x3fbef4=_0x5e6444;return db[_0x0686('0x42')][_0x0686('0x5c')]({'raw':!![]});}})[_0x0686('0x1c')](function(_0x3017d3){var _0x442765=fs[_0x0686('0x5d')](path['join'](config['root'],_0x0686('0x60')),_0x0686('0x6b'));var _0x450c28=ejs[_0x0686('0x39')](_0x442765,{'contexts':_0x3017d3||[]});fs[_0x0686('0x61')](_0x0686('0x62'),_0x450c28);})['then'](function(){return respondWithRpcPromise(_0x0686('0x63'),_0x0686('0x32'),{'module':_0x0686('0x64')});})[_0x0686('0x1c')](function(){return _0x3fbef4;})[_0x0686('0x1c')](respondWithResult(_0x567f24,null))[_0x0686('0x57')](handleError(_0x567f24,null));};exports[_0x0686('0x36')]=function(_0x6fc787,_0x51780,_0x38da74){var _0x30a424;return db[_0x0686('0x42')][_0x0686('0x5a')]({'where':{'id':_0x6fc787[_0x0686('0x6a')]['id']}})['then'](handleEntityNotFound(_0x51780,null))['then'](removeEntity(_0x51780,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x0686('0x1c')](function(_0x2dc95f){var _0x2dca37=fs[_0x0686('0x5d')](path[_0x0686('0x5e')](config[_0x0686('0x5f')],'server/files/templates/context.ejs'),_0x0686('0x6b'));var _0x5354a4=ejs[_0x0686('0x39')](_0x2dca37,{'contexts':_0x2dc95f});fs['writeFileSync'](_0x0686('0x62'),_0x5354a4);return respondWithRpcPromise('Reload',_0x0686('0x36'),{'module':_0x0686('0x64')});})[_0x0686('0x57')](handleError(_0x51780,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d299cc1..2e01061 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['voice_contexts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','VoiceContext'];(function(_0x31df18,_0xd1f6c5){var _0x527798=function(_0x18adb7){while(--_0x18adb7){_0x31df18['push'](_0x31df18['shift']());}};_0x527798(++_0xd1f6c5);}(_0xd8fb,0x121));var _0xbd8f=function(_0x5aa72a,_0x48c3bf){_0x5aa72a=_0x5aa72a-0x0;var _0x15663f=_0xd8fb[_0x5aa72a];return _0x15663f;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))('api');var moment=require(_0xbd8f('0x3'));var BPromise=require(_0xbd8f('0x4'));var rp=require(_0xbd8f('0x5'));var fs=require('fs');var path=require(_0xbd8f('0x6'));var rimraf=require('rimraf');var config=require(_0xbd8f('0x7'));var attributes=require(_0xbd8f('0x8'));module[_0xbd8f('0x9')]=function(_0x2f4fe0,_0x588b11){return _0x2f4fe0['define'](_0xbd8f('0xa'),attributes,{'tableName':_0xbd8f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfccb=['define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x8abbd0,_0x3ee1d5){var _0x1f1727=function(_0x20eea6){while(--_0x20eea6){_0x8abbd0['push'](_0x8abbd0['shift']());}};_0x1f1727(++_0x3ee1d5);}(_0xfccb,0x120));var _0xbfcc=function(_0x258748,_0x4eab8a){_0x258748=_0x258748-0x0;var _0x1e1008=_0xfccb[_0x258748];return _0x1e1008;};'use strict';var _=require(_0xbfcc('0x0'));var util=require(_0xbfcc('0x1'));var logger=require(_0xbfcc('0x2'))(_0xbfcc('0x3'));var moment=require(_0xbfcc('0x4'));var BPromise=require(_0xbfcc('0x5'));var rp=require(_0xbfcc('0x6'));var fs=require('fs');var path=require(_0xbfcc('0x7'));var rimraf=require(_0xbfcc('0x8'));var config=require(_0xbfcc('0x9'));var attributes=require(_0xbfcc('0xa'));module[_0xbfcc('0xb')]=function(_0x39eb06,_0x2a9caa){return _0x39eb06[_0xbfcc('0xc')](_0xbfcc('0xd'),attributes,{'tableName':_0xbfcc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index fee2f75..f90cee9 100644 --- a/server/api/voiceContext/voiceContext.rpc.js +++ b/server/api/voiceContext/voiceContext.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f7e=['client','http','then','info','request\x20sent','debug','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xf7c208,_0x5cbc84){var _0x16992d=function(_0x2fe157){while(--_0x2fe157){_0xf7c208['push'](_0xf7c208['shift']());}};_0x16992d(++_0x5cbc84);}(_0x9f7e,0x156));var _0xe9f7=function(_0x493af3,_0x1c8111){_0x493af3=_0x493af3-0x0;var _0x408c30=_0x9f7e[_0x493af3];return _0x408c30;};'use strict';var _=require('lodash');var util=require(_0xe9f7('0x0'));var moment=require(_0xe9f7('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9f7('0x2'));var fs=require('fs');var Redis=require(_0xe9f7('0x3'));var db=require(_0xe9f7('0x4'))['db'];var utils=require(_0xe9f7('0x5'));var logger=require(_0xe9f7('0x6'))(_0xe9f7('0x7'));var config=require(_0xe9f7('0x8'));var jayson=require(_0xe9f7('0x9'));var client=jayson[_0xe9f7('0xa')][_0xe9f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x233a6f,_0x4370c0,_0x324d73){return new BPromise(function(_0x3e18fa,_0x1a8782){return client['request'](_0x233a6f,_0x324d73)[_0xe9f7('0xc')](function(_0x3cb027){logger[_0xe9f7('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4370c0,_0xe9f7('0xe'));logger[_0xe9f7('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4370c0,_0xe9f7('0xe'),JSON[_0xe9f7('0x10')](_0x3cb027));if(_0x3cb027[_0xe9f7('0x11')]){if(_0x3cb027[_0xe9f7('0x11')][_0xe9f7('0x12')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4370c0,_0x3cb027[_0xe9f7('0x11')][_0xe9f7('0x13')]);return _0x1a8782(_0x3cb027['error'][_0xe9f7('0x13')]);}logger[_0xe9f7('0x11')]('VoiceContext,\x20%s,\x20%s',_0x4370c0,_0x3cb027[_0xe9f7('0x11')][_0xe9f7('0x13')]);return _0x3e18fa(_0x3cb027[_0xe9f7('0x11')]['message']);}else{logger[_0xe9f7('0xd')](_0xe9f7('0x14'),_0x4370c0,_0xe9f7('0xe'));_0x3e18fa(_0x3cb027['result']['message']);}})[_0xe9f7('0x15')](function(_0xa55902){logger[_0xe9f7('0x11')](_0xe9f7('0x14'),_0x4370c0,_0xa55902);_0x1a8782(_0xa55902);});});} \ No newline at end of file +var _0x4201=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0x1e1ecf,_0x175529){var _0x52be90=function(_0x2da012){while(--_0x2da012){_0x1e1ecf['push'](_0x1e1ecf['shift']());}};_0x52be90(++_0x175529);}(_0x4201,0x102));var _0x1420=function(_0x27e2bc,_0x1f5bb1){_0x27e2bc=_0x27e2bc-0x0;var _0x303eed=_0x4201[_0x27e2bc];return _0x303eed;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require(_0x1420('0x2'));var BPromise=require('bluebird');var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1420('0x6'));var config=require(_0x1420('0x7'));var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dae38,_0x174ccf,_0x272e97){return new BPromise(function(_0x5c6211,_0xf9d2f6){return client[_0x1420('0xb')](_0x2dae38,_0x272e97)['then'](function(_0x4cc945){logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));logger[_0x1420('0xf')](_0x1420('0x10'),_0x174ccf,'request\x20sent',JSON['stringify'](_0x4cc945));if(_0x4cc945[_0x1420('0x11')]){if(_0x4cc945[_0x1420('0x11')]['code']===0x1f4){logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0xf9d2f6(_0x4cc945['error'][_0x1420('0x12')]);}logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0x5c6211(_0x4cc945['error'][_0x1420('0x12')]);}else{logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));_0x5c6211(_0x4cc945[_0x1420('0x13')]['message']);}})[_0x1420('0x14')](function(_0x901a0a){logger['error'](_0x1420('0xd'),_0x174ccf,_0x901a0a);_0xf9d2f6(_0x901a0a);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e9cc20a..adc838d 100644 --- a/server/api/voiceDialReport/index.js +++ b/server/api/voiceDialReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22fb=['./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1e3d0d,_0x1d38ec){var _0x289bc6=function(_0x31cecd){while(--_0x31cecd){_0x1e3d0d['push'](_0x1e3d0d['shift']());}};_0x289bc6(++_0x1d38ec);}(_0x22fb,0x192));var _0xb22f=function(_0x52acf5,_0x37ef26){_0x52acf5=_0x52acf5-0x0;var _0x3f619b=_0x22fb[_0x52acf5];return _0x3f619b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x34e5=['index','/describe','describe','/:id','post','create','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated'];(function(_0x59bd0e,_0x857c91){var _0x192382=function(_0x5c6825){while(--_0x5c6825){_0x59bd0e['push'](_0x59bd0e['shift']());}};_0x192382(++_0x857c91);}(_0x34e5,0x172));var _0x534e=function(_0x332117,_0x24345f){_0x332117=_0x332117-0x0;var _0x1c9562=_0x34e5[_0x332117];return _0x1c9562;};'use strict';var multer=require('multer');var util=require(_0x534e('0x0'));var path=require('path');var timeout=require(_0x534e('0x1'));var express=require(_0x534e('0x2'));var router=express[_0x534e('0x3')]();var fs_extra=require(_0x534e('0x4'));var auth=require(_0x534e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x534e('0x6'));var controller=require(_0x534e('0x7'));router[_0x534e('0x8')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xa')]);router[_0x534e('0x8')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0xc')]);router[_0x534e('0x8')](_0x534e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x534e('0xe')]('/',auth['isAuthenticated'](),controller[_0x534e('0xf')]);router['put'](_0x534e('0xd'),auth[_0x534e('0x9')](),controller[_0x534e('0x10')]);router['delete'](_0x534e('0xd'),auth[_0x534e('0x9')](),controller[_0x534e('0x11')]);module[_0x534e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 219c166..a3a963a 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf6b=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x30bbb3,_0x2826a1){var _0x507d27=function(_0x2a5b50){while(--_0x2a5b50){_0x30bbb3['push'](_0x30bbb3['shift']());}};_0x507d27(++_0x2826a1);}(_0xcf6b,0x1d5));var _0xbcf6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcf6b[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xbcf6('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xbcf6('0x1')]},'channel':{'type':Sequelize[_0xbcf6('0x1')]},'channelstate':{'type':Sequelize[_0xbcf6('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbcf6('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbcf6('0x1')]},'connectedlinename':{'type':Sequelize[_0xbcf6('0x1')]},'language':{'type':Sequelize[_0xbcf6('0x1')]},'accountcode':{'type':Sequelize[_0xbcf6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xbcf6('0x1')]},'priority':{'type':Sequelize[_0xbcf6('0x2')]},'uniqueid':{'type':Sequelize[_0xbcf6('0x1')]},'linkedid':{'type':Sequelize[_0xbcf6('0x1')]},'destchannel':{'type':Sequelize[_0xbcf6('0x1')]},'destchannelstate':{'type':Sequelize[_0xbcf6('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xbcf6('0x1')]},'destcalleridnum':{'type':Sequelize[_0xbcf6('0x1')]},'destcalleridname':{'type':Sequelize[_0xbcf6('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xbcf6('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xbcf6('0x1')]},'destexten':{'type':Sequelize[_0xbcf6('0x1')]},'destpriority':{'type':Sequelize[_0xbcf6('0x2')]},'destuniqueid':{'type':Sequelize[_0xbcf6('0x1')]},'destlinkedid':{'type':Sequelize[_0xbcf6('0x1')]},'dialstring':{'type':Sequelize[_0xbcf6('0x1')]},'dialstatus':{'type':Sequelize[_0xbcf6('0x1')]},'starttime':{'type':Sequelize[_0xbcf6('0x3')]},'answertime':{'type':Sequelize[_0xbcf6('0x3')]},'endtime':{'type':Sequelize[_0xbcf6('0x3')]},'lastevent':{'type':Sequelize[_0xbcf6('0x1')],'comment':_0xbcf6('0x4')},'routeId':{'type':Sequelize[_0xbcf6('0x2')]},'duration':{'type':Sequelize[_0xbcf6('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xbcf6('0x2')]}}; \ No newline at end of file +var _0xe03a=['sequelize','STRING','INTEGER','DATE','called,connect,complete'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xe03a,0xb9));var _0xae03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe03a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xae03('0x0'));module['exports']={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xae03('0x1')]},'channelstate':{'type':Sequelize[_0xae03('0x2')]},'channelstatedesc':{'type':Sequelize[_0xae03('0x1')]},'calleridnum':{'type':Sequelize[_0xae03('0x1')]},'calleridname':{'type':Sequelize[_0xae03('0x1')]},'connectedlinenum':{'type':Sequelize[_0xae03('0x1')]},'connectedlinename':{'type':Sequelize[_0xae03('0x1')]},'language':{'type':Sequelize[_0xae03('0x1')]},'accountcode':{'type':Sequelize[_0xae03('0x1')]},'context':{'type':Sequelize[_0xae03('0x1')]},'exten':{'type':Sequelize[_0xae03('0x1')]},'priority':{'type':Sequelize[_0xae03('0x2')]},'uniqueid':{'type':Sequelize[_0xae03('0x1')]},'linkedid':{'type':Sequelize[_0xae03('0x1')]},'destchannel':{'type':Sequelize[_0xae03('0x1')]},'destchannelstate':{'type':Sequelize[_0xae03('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xae03('0x1')]},'destcalleridnum':{'type':Sequelize[_0xae03('0x1')]},'destcalleridname':{'type':Sequelize[_0xae03('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xae03('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xae03('0x1')]},'destlanguage':{'type':Sequelize[_0xae03('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xae03('0x1')]},'destexten':{'type':Sequelize[_0xae03('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xae03('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xae03('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xae03('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xae03('0x1')],'comment':_0xae03('0x4')},'routeId':{'type':Sequelize[_0xae03('0x2')]},'duration':{'type':Sequelize[_0xae03('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xae03('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 7b1ea70..7fb0f28 100644 --- a/server/api/voiceDialReport/voiceDialReport.controller.js +++ b/server/api/voiceDialReport/voiceDialReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f49=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','sendStatus','error','stack','name','render','merge','contact','message','agent','interaction','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','type','VIRTUAL','VoiceDialReport','then','includeAll','include','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x3fd4c7,_0x2256fa){var _0x38905e=function(_0x208c78){while(--_0x208c78){_0x3fd4c7['push'](_0x3fd4c7['shift']());}};_0x38905e(++_0x2256fa);}(_0x2f49,0x7e));var _0x92f4=function(_0x2eb3d0,_0x57ae7f){_0x2eb3d0=_0x2eb3d0-0x0;var _0x492b0c=_0x2f49[_0x2eb3d0];return _0x492b0c;};'use strict';var emlformat=require(_0x92f4('0x0'));var rimraf=require(_0x92f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92f4('0x2'));var rp=require(_0x92f4('0x3'));var moment=require(_0x92f4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x92f4('0x5'));var sox=require(_0x92f4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f4('0x7'));var _=require('lodash');var squel=require(_0x92f4('0x8'));var crypto=require(_0x92f4('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92f4('0xa'));var querystring=require(_0x92f4('0xb'));var Papa=require(_0x92f4('0xc'));var Redis=require(_0x92f4('0xd'));var authService=require(_0x92f4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x92f4('0xf'));var utils=require(_0x92f4('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x92f4('0x11'));var db=require(_0x92f4('0x12'))['db'];function respondWithStatusCode(_0xbbed7a,_0x5c2448){_0x5c2448=_0x5c2448||0xcc;return function(_0x45431e){if(_0x45431e){return _0xbbed7a['sendStatus'](_0x5c2448);}return _0xbbed7a[_0x92f4('0x13')](_0x5c2448)[_0x92f4('0x14')]();};}function respondWithResult(_0x1434a4,_0x1ed751){_0x1ed751=_0x1ed751||0xc8;return function(_0x25c19a){if(_0x25c19a){return _0x1434a4['status'](_0x1ed751)[_0x92f4('0x15')](_0x25c19a);}};}function respondWithFilteredResult(_0x1a68b0,_0x2f0450){return function(_0x2948f4){if(_0x2948f4){var _0x2fdbdf=typeof _0x2f0450[_0x92f4('0x16')]===_0x92f4('0x17')&&typeof _0x2f0450[_0x92f4('0x18')]==='undefined';var _0x6b15fa=_0x2948f4[_0x92f4('0x19')];var _0x459c94=_0x2fdbdf?0x0:_0x2f0450[_0x92f4('0x16')];var _0x193f52=_0x2fdbdf?_0x2948f4[_0x92f4('0x19')]:_0x2f0450[_0x92f4('0x16')]+_0x2f0450['limit'];var _0x5487ff;if(_0x193f52>=_0x6b15fa){_0x193f52=_0x6b15fa;_0x5487ff=0xc8;}else{_0x5487ff=0xce;}_0x1a68b0['status'](_0x5487ff);return _0x1a68b0[_0x92f4('0x1a')](_0x92f4('0x1b'),_0x459c94+'-'+_0x193f52+'/'+_0x6b15fa)[_0x92f4('0x15')](_0x2948f4);}return null;};}function patchUpdates(_0x40d882){return function(_0x43ddc7){try{jsonpatch[_0x92f4('0x1c')](_0x43ddc7,_0x40d882,!![]);}catch(_0x1bb08c){return BPromise[_0x92f4('0x1d')](_0x1bb08c);}return _0x43ddc7[_0x92f4('0x1e')]();};}function saveUpdates(_0x2fd7df,_0x3705f8){return function(_0x496d67){if(_0x496d67){return _0x496d67['update'](_0x2fd7df)['then'](function(_0x3597ae){return _0x3597ae;});}return null;};}function removeEntity(_0x2f2f05,_0x2d8bcf){return function(_0xde8367){if(_0xde8367){return _0xde8367['destroy']()['then'](function(){_0x2f2f05[_0x92f4('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd74b83,_0x7b5c00){return function(_0x240e63){if(!_0x240e63){_0xd74b83[_0x92f4('0x1f')](0x194);}return _0x240e63;};}function handleError(_0x41ed4b,_0xe807c3){_0xe807c3=_0xe807c3||0x1f4;return function(_0x25fe55){logger[_0x92f4('0x20')](_0x25fe55[_0x92f4('0x21')]);if(_0x25fe55[_0x92f4('0x22')]){delete _0x25fe55[_0x92f4('0x22')];}_0x41ed4b[_0x92f4('0x13')](_0xe807c3)['send'](_0x25fe55);};}function getMustacheRender(_0x227dd2,_0x244ca2){return Mustache[_0x92f4('0x23')](_0x227dd2,_[_0x92f4('0x24')](_0x244ca2['body'],{'contact':_0x244ca2[_0x92f4('0x25')],'message':_0x244ca2[_0x92f4('0x26')],'agent':_0x244ca2[_0x92f4('0x27')],'interaction':_0x244ca2[_0x92f4('0x28')],'account':_0x244ca2['account']}))||'';}exports[_0x92f4('0x29')]=function(_0x52e22f,_0x383799){var _0x8d9e19={},_0x5a3fc3={},_0x125f79={'count':0x0,'rows':[]};var _0x4ccfcc=_['map'](db['VoiceDialReport'][_0x92f4('0x2a')],function(_0x4afef8){return{'name':_0x4afef8[_0x92f4('0x2b')],'type':_0x4afef8['type'][_0x92f4('0x2c')]};});_0x5a3fc3[_0x92f4('0x2d')]=_['map'](_0x4ccfcc,_0x92f4('0x22'));_0x5a3fc3[_0x92f4('0x2e')]=_[_0x92f4('0x2f')](_0x52e22f[_0x92f4('0x2e')]);_0x5a3fc3[_0x92f4('0x30')]=_[_0x92f4('0x31')](_0x5a3fc3[_0x92f4('0x2d')],_0x5a3fc3[_0x92f4('0x2e')]);_0x8d9e19['attributes']=_[_0x92f4('0x31')](_0x5a3fc3[_0x92f4('0x2d')],qs[_0x92f4('0x32')](_0x52e22f[_0x92f4('0x2e')][_0x92f4('0x32')]));_0x8d9e19['attributes']=_0x8d9e19[_0x92f4('0x33')][_0x92f4('0x34')]?_0x8d9e19[_0x92f4('0x33')]:_0x5a3fc3[_0x92f4('0x2d')];if(!_0x52e22f[_0x92f4('0x2e')]['hasOwnProperty'](_0x92f4('0x35'))){_0x8d9e19[_0x92f4('0x18')]=qs[_0x92f4('0x18')](_0x52e22f[_0x92f4('0x2e')][_0x92f4('0x18')]);_0x8d9e19[_0x92f4('0x16')]=qs[_0x92f4('0x16')](_0x52e22f['query']['offset']);}_0x8d9e19['order']=qs[_0x92f4('0x36')](_0x52e22f[_0x92f4('0x2e')][_0x92f4('0x36')]);_0x8d9e19[_0x92f4('0x37')]=qs[_0x92f4('0x30')](_[_0x92f4('0x38')](_0x52e22f[_0x92f4('0x2e')],_0x5a3fc3['filters']),_0x4ccfcc);if(_0x52e22f[_0x92f4('0x2e')]['filter']){_0x8d9e19['where']=_['merge'](_0x8d9e19['where'],{'$or':_['map'](_0x4ccfcc,function(_0x837e03){if(_0x837e03[_0x92f4('0x39')]!==_0x92f4('0x3a')){var _0x4f0dd9={};_0x4f0dd9[_0x837e03[_0x92f4('0x22')]]={'$like':'%'+_0x52e22f[_0x92f4('0x2e')]['filter']+'%'};return _0x4f0dd9;}})});}_0x8d9e19=_['merge']({},_0x8d9e19,_0x52e22f['options']);var _0x446ee7={'where':_0x8d9e19[_0x92f4('0x37')]};return db[_0x92f4('0x3b')]['count'](_0x446ee7)[_0x92f4('0x3c')](function(_0x2edde2){_0x125f79[_0x92f4('0x19')]=_0x2edde2;if(_0x52e22f['query'][_0x92f4('0x3d')]){_0x8d9e19[_0x92f4('0x3e')]=[{'all':!![]}];}return db[_0x92f4('0x3b')]['findAll'](_0x8d9e19);})[_0x92f4('0x3c')](function(_0x4d877d){_0x125f79[_0x92f4('0x3f')]=_0x4d877d;return _0x125f79;})[_0x92f4('0x3c')](respondWithFilteredResult(_0x383799,_0x8d9e19))[_0x92f4('0x40')](handleError(_0x383799,null));};exports[_0x92f4('0x41')]=function(_0x551eac,_0x16ceb4){var _0x1f517f={'raw':!![],'where':{'id':_0x551eac[_0x92f4('0x42')]['id']}},_0x1c7e17={};_0x1c7e17[_0x92f4('0x2d')]=_[_0x92f4('0x2f')](db[_0x92f4('0x3b')]['rawAttributes']);_0x1c7e17[_0x92f4('0x2e')]=_[_0x92f4('0x2f')](_0x551eac['query']);_0x1c7e17[_0x92f4('0x30')]=_[_0x92f4('0x31')](_0x1c7e17[_0x92f4('0x2d')],_0x1c7e17[_0x92f4('0x2e')]);_0x1f517f[_0x92f4('0x33')]=_[_0x92f4('0x31')](_0x1c7e17[_0x92f4('0x2d')],qs['fields'](_0x551eac[_0x92f4('0x2e')][_0x92f4('0x32')]));_0x1f517f[_0x92f4('0x33')]=_0x1f517f['attributes'][_0x92f4('0x34')]?_0x1f517f['attributes']:_0x1c7e17['model'];if(_0x551eac['query'][_0x92f4('0x3d')]){_0x1f517f[_0x92f4('0x3e')]=[{'all':!![]}];}_0x1f517f=_['merge']({},_0x1f517f,_0x551eac[_0x92f4('0x43')]);return db['VoiceDialReport'][_0x92f4('0x44')](_0x1f517f)[_0x92f4('0x3c')](handleEntityNotFound(_0x16ceb4,null))['then'](respondWithResult(_0x16ceb4,null))[_0x92f4('0x40')](handleError(_0x16ceb4,null));};exports['create']=function(_0x14056f,_0x3fd5a3){return db[_0x92f4('0x3b')][_0x92f4('0x45')](_0x14056f[_0x92f4('0x46')],{})['then'](respondWithResult(_0x3fd5a3,0xc9))['catch'](handleError(_0x3fd5a3,null));};exports['update']=function(_0x4c870d,_0x57cf7a){if(_0x4c870d[_0x92f4('0x46')]['id']){delete _0x4c870d[_0x92f4('0x46')]['id'];}return db[_0x92f4('0x3b')]['find']({'where':{'id':_0x4c870d[_0x92f4('0x42')]['id']}})['then'](handleEntityNotFound(_0x57cf7a,null))[_0x92f4('0x3c')](saveUpdates(_0x4c870d[_0x92f4('0x46')],null))['then'](respondWithResult(_0x57cf7a,null))[_0x92f4('0x40')](handleError(_0x57cf7a,null));};exports[_0x92f4('0x47')]=function(_0x32d1ad,_0x541692){return db[_0x92f4('0x3b')][_0x92f4('0x44')]({'where':{'id':_0x32d1ad[_0x92f4('0x42')]['id']}})[_0x92f4('0x3c')](handleEntityNotFound(_0x541692,null))[_0x92f4('0x3c')](removeEntity(_0x541692,null))['catch'](handleError(_0x541692,null));};exports[_0x92f4('0x48')]=function(_0x1ab5d0,_0x577546){return db['VoiceDialReport']['describe']()[_0x92f4('0x3c')](respondWithResult(_0x577546,null))['catch'](handleError(_0x577546,null));}; \ No newline at end of file +var _0x333a=['save','update','then','destroy','error','stack','name','send','body','contact','account','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x2dc6f3,_0x5b9e78){var _0x12493f=function(_0x406318){while(--_0x406318){_0x2dc6f3['push'](_0x2dc6f3['shift']());}};_0x12493f(++_0x5b9e78);}(_0x333a,0xcd));var _0xa333=function(_0x26fcf9,_0xb00d93){_0x26fcf9=_0x26fcf9-0x0;var _0x4cf3ba=_0x333a[_0x26fcf9];return _0x4cf3ba;};'use strict';var emlformat=require(_0xa333('0x0'));var rimraf=require(_0xa333('0x1'));var zipdir=require(_0xa333('0x2'));var jsonpatch=require(_0xa333('0x3'));var rp=require('request-promise');var moment=require(_0xa333('0x4'));var BPromise=require(_0xa333('0x5'));var Mustache=require(_0xa333('0x6'));var util=require(_0xa333('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa333('0x8'));var fs=require('fs');var fs_extra=require(_0xa333('0x9'));var _=require(_0xa333('0xa'));var squel=require(_0xa333('0xb'));var crypto=require(_0xa333('0xc'));var jsforce=require(_0xa333('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa333('0xe'));var querystring=require('querystring');var Papa=require(_0xa333('0xf'));var Redis=require('ioredis');var authService=require(_0xa333('0x10'));var qs=require(_0xa333('0x11'));var as=require(_0xa333('0x12'));var hardwareService=require(_0xa333('0x13'));var logger=require('../../config/logger')(_0xa333('0x14'));var utils=require(_0xa333('0x15'));var config=require(_0xa333('0x16'));var licenseUtil=require(_0xa333('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x144cfd,_0x20e91a){_0x20e91a=_0x20e91a||0xcc;return function(_0x482e0a){if(_0x482e0a){return _0x144cfd['sendStatus'](_0x20e91a);}return _0x144cfd[_0xa333('0x18')](_0x20e91a)[_0xa333('0x19')]();};}function respondWithResult(_0x234ffe,_0x5a6872){_0x5a6872=_0x5a6872||0xc8;return function(_0xe1b5e3){if(_0xe1b5e3){return _0x234ffe[_0xa333('0x18')](_0x5a6872)[_0xa333('0x1a')](_0xe1b5e3);}};}function respondWithFilteredResult(_0x4494a2,_0x48964e){return function(_0x216ae1){if(_0x216ae1){var _0x1396b1=typeof _0x48964e['offset']===_0xa333('0x1b')&&typeof _0x48964e[_0xa333('0x1c')]===_0xa333('0x1b');var _0xdf59e0=_0x216ae1[_0xa333('0x1d')];var _0x25a77b=_0x1396b1?0x0:_0x48964e['offset'];var _0x133e42=_0x1396b1?_0x216ae1['count']:_0x48964e[_0xa333('0x1e')]+_0x48964e[_0xa333('0x1c')];var _0x386319;if(_0x133e42>=_0xdf59e0){_0x133e42=_0xdf59e0;_0x386319=0xc8;}else{_0x386319=0xce;}_0x4494a2[_0xa333('0x18')](_0x386319);return _0x4494a2[_0xa333('0x1f')](_0xa333('0x20'),_0x25a77b+'-'+_0x133e42+'/'+_0xdf59e0)[_0xa333('0x1a')](_0x216ae1);}return null;};}function patchUpdates(_0xaea76e){return function(_0x272292){try{jsonpatch[_0xa333('0x21')](_0x272292,_0xaea76e,!![]);}catch(_0x5baf56){return BPromise[_0xa333('0x22')](_0x5baf56);}return _0x272292[_0xa333('0x23')]();};}function saveUpdates(_0xcf9374,_0x2a918e){return function(_0x42d04e){if(_0x42d04e){return _0x42d04e[_0xa333('0x24')](_0xcf9374)[_0xa333('0x25')](function(_0x5ed204){return _0x5ed204;});}return null;};}function removeEntity(_0x251898,_0x11af4e){return function(_0xba19bf){if(_0xba19bf){return _0xba19bf[_0xa333('0x26')]()['then'](function(){_0x251898[_0xa333('0x18')](0xcc)[_0xa333('0x19')]();});}};}function handleEntityNotFound(_0x4f1664,_0xa17c63){return function(_0x485f70){if(!_0x485f70){_0x4f1664['sendStatus'](0x194);}return _0x485f70;};}function handleError(_0xbe45b2,_0x84f2f6){_0x84f2f6=_0x84f2f6||0x1f4;return function(_0x127211){logger[_0xa333('0x27')](_0x127211[_0xa333('0x28')]);if(_0x127211[_0xa333('0x29')]){delete _0x127211[_0xa333('0x29')];}_0xbe45b2[_0xa333('0x18')](_0x84f2f6)[_0xa333('0x2a')](_0x127211);};}function getMustacheRender(_0x327695,_0x22cab7){return Mustache['render'](_0x327695,_['merge'](_0x22cab7[_0xa333('0x2b')],{'contact':_0x22cab7[_0xa333('0x2c')],'message':_0x22cab7['message'],'agent':_0x22cab7['agent'],'interaction':_0x22cab7['interaction'],'account':_0x22cab7[_0xa333('0x2d')]}))||'';}exports[_0xa333('0x2e')]=function(_0x15b885,_0x2a8e7d){var _0x1c51a4={},_0x2de4b9={},_0x26fcbb={'count':0x0,'rows':[]};var _0x4529b0=_[_0xa333('0x2f')](db[_0xa333('0x30')]['rawAttributes'],function(_0xe6100c){return{'name':_0xe6100c[_0xa333('0x31')],'type':_0xe6100c[_0xa333('0x32')][_0xa333('0x33')]};});_0x2de4b9[_0xa333('0x34')]=_[_0xa333('0x2f')](_0x4529b0,_0xa333('0x29'));_0x2de4b9[_0xa333('0x35')]=_[_0xa333('0x36')](_0x15b885[_0xa333('0x35')]);_0x2de4b9['filters']=_['intersection'](_0x2de4b9[_0xa333('0x34')],_0x2de4b9[_0xa333('0x35')]);_0x1c51a4[_0xa333('0x37')]=_[_0xa333('0x38')](_0x2de4b9[_0xa333('0x34')],qs[_0xa333('0x39')](_0x15b885['query'][_0xa333('0x39')]));_0x1c51a4[_0xa333('0x37')]=_0x1c51a4[_0xa333('0x37')][_0xa333('0x3a')]?_0x1c51a4['attributes']:_0x2de4b9[_0xa333('0x34')];if(!_0x15b885[_0xa333('0x35')][_0xa333('0x3b')]('nolimit')){_0x1c51a4[_0xa333('0x1c')]=qs[_0xa333('0x1c')](_0x15b885[_0xa333('0x35')][_0xa333('0x1c')]);_0x1c51a4['offset']=qs[_0xa333('0x1e')](_0x15b885['query'][_0xa333('0x1e')]);}_0x1c51a4[_0xa333('0x3c')]=qs[_0xa333('0x3d')](_0x15b885[_0xa333('0x35')][_0xa333('0x3d')]);_0x1c51a4[_0xa333('0x3e')]=qs[_0xa333('0x3f')](_[_0xa333('0x40')](_0x15b885[_0xa333('0x35')],_0x2de4b9[_0xa333('0x3f')]),_0x4529b0);if(_0x15b885['query'][_0xa333('0x41')]){_0x1c51a4[_0xa333('0x3e')]=_[_0xa333('0x42')](_0x1c51a4['where'],{'$or':_[_0xa333('0x2f')](_0x4529b0,function(_0x2f9858){if(_0x2f9858[_0xa333('0x32')]!==_0xa333('0x43')){var _0x422f36={};_0x422f36[_0x2f9858[_0xa333('0x29')]]={'$like':'%'+_0x15b885[_0xa333('0x35')][_0xa333('0x41')]+'%'};return _0x422f36;}})});}_0x1c51a4=_[_0xa333('0x42')]({},_0x1c51a4,_0x15b885[_0xa333('0x44')]);var _0x3bb24d={'where':_0x1c51a4[_0xa333('0x3e')]};return db[_0xa333('0x30')][_0xa333('0x1d')](_0x3bb24d)[_0xa333('0x25')](function(_0x2b445d){_0x26fcbb[_0xa333('0x1d')]=_0x2b445d;if(_0x15b885[_0xa333('0x35')][_0xa333('0x45')]){_0x1c51a4[_0xa333('0x46')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xa333('0x47')](_0x1c51a4);})['then'](function(_0x2e57e6){_0x26fcbb[_0xa333('0x48')]=_0x2e57e6;return _0x26fcbb;})['then'](respondWithFilteredResult(_0x2a8e7d,_0x1c51a4))[_0xa333('0x49')](handleError(_0x2a8e7d,null));};exports[_0xa333('0x4a')]=function(_0x375544,_0x44f9b4){var _0x4b6f25={'raw':!![],'where':{'id':_0x375544['params']['id']}},_0x2f2331={};_0x2f2331[_0xa333('0x34')]=_[_0xa333('0x36')](db['VoiceDialReport'][_0xa333('0x4b')]);_0x2f2331[_0xa333('0x35')]=_['keys'](_0x375544[_0xa333('0x35')]);_0x2f2331['filters']=_[_0xa333('0x38')](_0x2f2331[_0xa333('0x34')],_0x2f2331['query']);_0x4b6f25[_0xa333('0x37')]=_['intersection'](_0x2f2331['model'],qs[_0xa333('0x39')](_0x375544[_0xa333('0x35')][_0xa333('0x39')]));_0x4b6f25[_0xa333('0x37')]=_0x4b6f25[_0xa333('0x37')]['length']?_0x4b6f25[_0xa333('0x37')]:_0x2f2331['model'];if(_0x375544[_0xa333('0x35')][_0xa333('0x45')]){_0x4b6f25[_0xa333('0x46')]=[{'all':!![]}];}_0x4b6f25=_[_0xa333('0x42')]({},_0x4b6f25,_0x375544[_0xa333('0x44')]);return db[_0xa333('0x30')][_0xa333('0x4c')](_0x4b6f25)[_0xa333('0x25')](handleEntityNotFound(_0x44f9b4,null))['then'](respondWithResult(_0x44f9b4,null))[_0xa333('0x49')](handleError(_0x44f9b4,null));};exports[_0xa333('0x4d')]=function(_0x488b70,_0x31eed4){return db[_0xa333('0x30')][_0xa333('0x4d')](_0x488b70[_0xa333('0x2b')],{})['then'](respondWithResult(_0x31eed4,0xc9))[_0xa333('0x49')](handleError(_0x31eed4,null));};exports[_0xa333('0x24')]=function(_0x1f5a6a,_0x54cd51){if(_0x1f5a6a[_0xa333('0x2b')]['id']){delete _0x1f5a6a[_0xa333('0x2b')]['id'];}return db['VoiceDialReport'][_0xa333('0x4c')]({'where':{'id':_0x1f5a6a[_0xa333('0x4e')]['id']}})[_0xa333('0x25')](handleEntityNotFound(_0x54cd51,null))['then'](saveUpdates(_0x1f5a6a[_0xa333('0x2b')],null))[_0xa333('0x25')](respondWithResult(_0x54cd51,null))[_0xa333('0x49')](handleError(_0x54cd51,null));};exports[_0xa333('0x26')]=function(_0x345ea9,_0x1df6d1){return db[_0xa333('0x30')][_0xa333('0x4c')]({'where':{'id':_0x345ea9[_0xa333('0x4e')]['id']}})[_0xa333('0x25')](handleEntityNotFound(_0x1df6d1,null))[_0xa333('0x25')](removeEntity(_0x1df6d1,null))[_0xa333('0x49')](handleError(_0x1df6d1,null));};exports[_0xa333('0x4f')]=function(_0xc2d6b2,_0x57365e){return db[_0xa333('0x30')][_0xa333('0x4f')]()[_0xa333('0x25')](respondWithResult(_0x57365e,null))[_0xa333('0x49')](handleError(_0x57365e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index b24469a..6de46cd 100644 --- a/server/api/voiceDialReport/voiceDialReport.model.js +++ b/server/api/voiceDialReport/voiceDialReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60e0=['rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60e0,0x1ce));var _0x060e=function(_0x4e65de,_0x56931a){_0x4e65de=_0x4e65de-0x0;var _0x8308dd=_0x60e0[_0x4e65de];return _0x8308dd;};'use strict';var _=require(_0x060e('0x0'));var util=require(_0x060e('0x1'));var logger=require(_0x060e('0x2'))(_0x060e('0x3'));var moment=require('moment');var BPromise=require(_0x060e('0x4'));var rp=require(_0x060e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x060e('0x6'));var config=require(_0x060e('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x060e('0x8')]=function(_0xf496c0,_0x4fb88d){return _0xf496c0[_0x060e('0x9')](_0x060e('0xa'),attributes,{'tableName':_0x060e('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d4d=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x315445,_0x1b37c2){var _0x1c4ccf=function(_0x11aa48){while(--_0x11aa48){_0x315445['push'](_0x315445['shift']());}};_0x1c4ccf(++_0x1b37c2);}(_0x0d4d,0xe4));var _0xd0d4=function(_0x350735,_0x233deb){_0x350735=_0x350735-0x0;var _0x58073c=_0x0d4d[_0x350735];return _0x58073c;};'use strict';var _=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var logger=require(_0xd0d4('0x2'))(_0xd0d4('0x3'));var moment=require(_0xd0d4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0d4('0x5'));var rimraf=require(_0xd0d4('0x6'));var config=require(_0xd0d4('0x7'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x2811e6,_0x2c363b){return _0x2811e6[_0xd0d4('0x8')](_0xd0d4('0x9'),attributes,{'tableName':_0xd0d4('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd0d4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6dd07a2..43a15ac 100644 --- a/server/api/voiceDialReport/voiceDialReport.rpc.js +++ b/server/api/voiceDialReport/voiceDialReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b40=['result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x5311e8,_0x57c5bb){var _0x582ad8=function(_0x1909af){while(--_0x1909af){_0x5311e8['push'](_0x5311e8['shift']());}};_0x582ad8(++_0x57c5bb);}(_0x9b40,0x122));var _0x09b4=function(_0x23bf11,_0x3c3292){_0x23bf11=_0x23bf11-0x0;var _0x3ff5c3=_0x9b40[_0x23bf11];return _0x3ff5c3;};'use strict';var _=require('lodash');var util=require(_0x09b4('0x0'));var moment=require('moment');var BPromise=require(_0x09b4('0x1'));var rs=require(_0x09b4('0x2'));var fs=require('fs');var Redis=require(_0x09b4('0x3'));var db=require(_0x09b4('0x4'))['db'];var utils=require(_0x09b4('0x5'));var logger=require(_0x09b4('0x6'))('rpc');var config=require(_0x09b4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x09b4('0x8')][_0x09b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x490f4d,_0x118b58,_0x5ad3f8){return new BPromise(function(_0x596e1e,_0x4bec40){return client[_0x09b4('0xa')](_0x490f4d,_0x5ad3f8)[_0x09b4('0xb')](function(_0x578eea){logger['info'](_0x09b4('0xc'),_0x118b58,_0x09b4('0xd'));logger[_0x09b4('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x118b58,_0x09b4('0xd'),JSON[_0x09b4('0xf')](_0x578eea));if(_0x578eea[_0x09b4('0x10')]){if(_0x578eea[_0x09b4('0x10')][_0x09b4('0x11')]===0x1f4){logger[_0x09b4('0x10')](_0x09b4('0xc'),_0x118b58,_0x578eea[_0x09b4('0x10')]['message']);return _0x4bec40(_0x578eea[_0x09b4('0x10')][_0x09b4('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x118b58,_0x578eea[_0x09b4('0x10')][_0x09b4('0x12')]);return _0x596e1e(_0x578eea[_0x09b4('0x10')][_0x09b4('0x12')]);}else{logger[_0x09b4('0x13')](_0x09b4('0xc'),_0x118b58,'request\x20sent');_0x596e1e(_0x578eea[_0x09b4('0x14')][_0x09b4('0x12')]);}})['catch'](function(_0x53e0fb){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x118b58,_0x53e0fb);_0x4bec40(_0x53e0fb);});});}exports[_0x09b4('0x15')]=function(_0x20fe40){var _0x14be54=this;return new Promise(function(_0x520b0a,_0x13e282){return db[_0x09b4('0x16')][_0x09b4('0x17')](_0x20fe40[_0x09b4('0x18')],{'raw':_0x20fe40[_0x09b4('0x19')]?_0x20fe40[_0x09b4('0x19')][_0x09b4('0x1a')]===undefined?!![]:![]:!![]})[_0x09b4('0xb')](function(_0x569823){logger['info']('CreateVoiceDialReport',_0x20fe40);logger[_0x09b4('0xe')](_0x09b4('0x15'),_0x20fe40,JSON[_0x09b4('0xf')](_0x569823));_0x520b0a(_0x569823);})[_0x09b4('0x1b')](function(_0x330ede){logger[_0x09b4('0x10')]('CreateVoiceDialReport',_0x330ede['message'],_0x20fe40);_0x13e282(_0x14be54[_0x09b4('0x10')](0x1f4,_0x330ede[_0x09b4('0x12')]));});});};exports[_0x09b4('0x1c')]=function(_0x46a328){var _0x2d064a=this;return new Promise(function(_0x2d100d,_0x356997){return db[_0x09b4('0x16')]['update'](_0x46a328[_0x09b4('0x18')],{'raw':_0x46a328['options']?_0x46a328['options'][_0x09b4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a328[_0x09b4('0x19')]?_0x46a328['options']['where']||null:null,'attributes':_0x46a328[_0x09b4('0x19')]?_0x46a328[_0x09b4('0x19')][_0x09b4('0x1d')]||null:null,'limit':_0x46a328[_0x09b4('0x19')]?_0x46a328['options'][_0x09b4('0x1e')]||null:null})[_0x09b4('0xb')](function(_0x450e76){logger[_0x09b4('0x13')](_0x09b4('0x1c'),_0x46a328);logger['debug'](_0x09b4('0x1c'),_0x46a328,JSON[_0x09b4('0xf')](_0x450e76));_0x2d100d(_0x450e76);})[_0x09b4('0x1b')](function(_0x4cd4ba){logger['error']('UpdateVoiceDialReport',_0x4cd4ba[_0x09b4('0x12')],_0x46a328);_0x356997(_0x2d064a[_0x09b4('0x10')](0x1f4,_0x4cd4ba[_0x09b4('0x12')]));});});}; \ No newline at end of file +var _0xec1c=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','options','raw','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec1c,0x13c));var _0xcec1=function(_0x1740ae,_0x5889d2){_0x1740ae=_0x1740ae-0x0;var _0x2eddc6=_0xec1c[_0x1740ae];return _0x2eddc6;};'use strict';var _=require(_0xcec1('0x0'));var util=require(_0xcec1('0x1'));var moment=require(_0xcec1('0x2'));var BPromise=require(_0xcec1('0x3'));var rs=require(_0xcec1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcec1('0x5'));var logger=require('../../config/logger')(_0xcec1('0x6'));var config=require(_0xcec1('0x7'));var jayson=require(_0xcec1('0x8'));var client=jayson[_0xcec1('0x9')][_0xcec1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c9d9,_0x16dfa2,_0x8268df){return new BPromise(function(_0x17820b,_0x5a16f5){return client['request'](_0x18c9d9,_0x8268df)[_0xcec1('0xb')](function(_0x44d2c5){logger[_0xcec1('0xc')](_0xcec1('0xd'),_0x16dfa2,_0xcec1('0xe'));logger[_0xcec1('0xf')](_0xcec1('0x10'),_0x16dfa2,_0xcec1('0xe'),JSON[_0xcec1('0x11')](_0x44d2c5));if(_0x44d2c5[_0xcec1('0x12')]){if(_0x44d2c5[_0xcec1('0x12')][_0xcec1('0x13')]===0x1f4){logger[_0xcec1('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x16dfa2,_0x44d2c5[_0xcec1('0x12')][_0xcec1('0x14')]);return _0x5a16f5(_0x44d2c5['error'][_0xcec1('0x14')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x16dfa2,_0x44d2c5[_0xcec1('0x12')][_0xcec1('0x14')]);return _0x17820b(_0x44d2c5[_0xcec1('0x12')]['message']);}else{logger[_0xcec1('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x16dfa2,_0xcec1('0xe'));_0x17820b(_0x44d2c5[_0xcec1('0x15')][_0xcec1('0x14')]);}})[_0xcec1('0x16')](function(_0x1316bd){logger['error'](_0xcec1('0xd'),_0x16dfa2,_0x1316bd);_0x5a16f5(_0x1316bd);});});}exports[_0xcec1('0x17')]=function(_0x4ea250){var _0x4292ee=this;return new Promise(function(_0x10ca43,_0x59eef3){return db['VoiceDialReport'][_0xcec1('0x18')](_0x4ea250['body'],{'raw':_0x4ea250['options']?_0x4ea250[_0xcec1('0x19')][_0xcec1('0x1a')]===undefined?!![]:![]:!![]})[_0xcec1('0xb')](function(_0xc9aea3){logger[_0xcec1('0xc')](_0xcec1('0x17'),_0x4ea250);logger['debug']('CreateVoiceDialReport',_0x4ea250,JSON[_0xcec1('0x11')](_0xc9aea3));_0x10ca43(_0xc9aea3);})[_0xcec1('0x16')](function(_0x3de3d2){logger[_0xcec1('0x12')](_0xcec1('0x17'),_0x3de3d2[_0xcec1('0x14')],_0x4ea250);_0x59eef3(_0x4292ee[_0xcec1('0x12')](0x1f4,_0x3de3d2['message']));});});};exports[_0xcec1('0x1b')]=function(_0x28e140){var _0xad64da=this;return new Promise(function(_0x1daacf,_0x3d5ad7){return db['VoiceDialReport'][_0xcec1('0x1c')](_0x28e140[_0xcec1('0x1d')],{'raw':_0x28e140['options']?_0x28e140[_0xcec1('0x19')][_0xcec1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28e140[_0xcec1('0x19')]?_0x28e140[_0xcec1('0x19')][_0xcec1('0x1e')]||null:null,'attributes':_0x28e140[_0xcec1('0x19')]?_0x28e140['options'][_0xcec1('0x1f')]||null:null,'limit':_0x28e140[_0xcec1('0x19')]?_0x28e140[_0xcec1('0x19')][_0xcec1('0x20')]||null:null})['then'](function(_0x6b525){logger['info'](_0xcec1('0x1b'),_0x28e140);logger[_0xcec1('0xf')](_0xcec1('0x1b'),_0x28e140,JSON[_0xcec1('0x11')](_0x6b525));_0x1daacf(_0x6b525);})['catch'](function(_0x2a52fd){logger[_0xcec1('0x12')](_0xcec1('0x1b'),_0x2a52fd['message'],_0x28e140);_0x3d5ad7(_0xad64da['error'](0x1f4,_0x2a52fd[_0xcec1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e6876f8..da0d096 100644 --- a/server/api/voiceExtension/index.js +++ b/server/api/voiceExtension/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e86=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x5c5fbd,_0x43ff30){var _0x59f2e2=function(_0x420dfb){while(--_0x420dfb){_0x5c5fbd['push'](_0x5c5fbd['shift']());}};_0x59f2e2(++_0x43ff30);}(_0x1e86,0xf8));var _0x61e8=function(_0x424c00,_0x46c7b9){_0x424c00=_0x424c00-0x0;var _0x5e29d2=_0x1e86[_0x424c00];return _0x5e29d2;};'use strict';var multer=require(_0x61e8('0x0'));var util=require(_0x61e8('0x1'));var path=require(_0x61e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x61e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x61e8('0x4'));var interaction=require(_0x61e8('0x5'));var config=require('../../config/environment');var controller=require(_0x61e8('0x6'));router[_0x61e8('0x7')]('/',auth[_0x61e8('0x8')](),controller['index']);router['get'](_0x61e8('0x9'),auth['isAuthenticated'](),controller[_0x61e8('0xa')]);router[_0x61e8('0xb')]('/',auth[_0x61e8('0x8')](),controller[_0x61e8('0xc')]);router['post'](_0x61e8('0xd'),auth['isAuthenticated'](),controller[_0x61e8('0xe')]);router[_0x61e8('0xf')](_0x61e8('0x9'),auth[_0x61e8('0x8')](),controller[_0x61e8('0x10')]);router[_0x61e8('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x61e8('0x12')]=router; \ No newline at end of file +var _0xa5a8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','create','post','/:id/applications','put','/:id','update','destroy','multer','path','connect-timeout'];(function(_0x4a9a7f,_0x218458){var _0x39b8ea=function(_0x4a1581){while(--_0x4a1581){_0x4a9a7f['push'](_0x4a9a7f['shift']());}};_0x39b8ea(++_0x218458);}(_0xa5a8,0xf4));var _0x8a5a=function(_0x940712,_0x64dfdd){_0x940712=_0x940712-0x0;var _0x31b8ed=_0xa5a8[_0x940712];return _0x31b8ed;};'use strict';var multer=require(_0x8a5a('0x0'));var util=require('util');var path=require(_0x8a5a('0x1'));var timeout=require(_0x8a5a('0x2'));var express=require(_0x8a5a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a5a('0x4'));var interaction=require(_0x8a5a('0x5'));var config=require(_0x8a5a('0x6'));var controller=require(_0x8a5a('0x7'));router[_0x8a5a('0x8')]('/',auth[_0x8a5a('0x9')](),controller[_0x8a5a('0xa')]);router[_0x8a5a('0x8')]('/:id',auth[_0x8a5a('0x9')](),controller[_0x8a5a('0xb')]);router['post']('/',auth[_0x8a5a('0x9')](),controller[_0x8a5a('0xc')]);router[_0x8a5a('0xd')](_0x8a5a('0xe'),auth[_0x8a5a('0x9')](),controller['addApplications']);router[_0x8a5a('0xf')](_0x8a5a('0x10'),auth[_0x8a5a('0x9')](),controller[_0x8a5a('0x11')]);router['delete']('/:id',auth[_0x8a5a('0x9')](),controller[_0x8a5a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index b539ec6..f611ea0 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x109462,_0x1e3e8a){var _0x25ca96=function(_0x27e4ab){while(--_0x27e4ab){_0x109462['push'](_0x109462['shift']());}};_0x25ca96(++_0x1e3e8a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1220ed,_0x33c647){var _0x4f60f9=function(_0x8e7582){while(--_0x8e7582){_0x1220ed['push'](_0x1220ed['shift']());}};_0x4f60f9(++_0x33c647);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index f1c2a80..72aefe6 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19dc=['filter','map','value','includes','type','find','name','UserProfileResource','then','end','error','send','render','merge','body','contact','message','agent','index','VoiceExtension','fieldName','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','include','rows','catch','show','rawAttributes','intersection','length','includeAll','options','params','create','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','limit','count','offset','apply','reject','save','update','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19dc,0x11e));var _0xc19d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19dc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc19d('0x0'));var rimraf=require(_0xc19d('0x1'));var zipdir=require(_0xc19d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc19d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc19d('0x4'));var path=require(_0xc19d('0x5'));var sox=require(_0xc19d('0x6'));var csv=require(_0xc19d('0x7'));var ejs=require(_0xc19d('0x8'));var fs=require('fs');var fs_extra=require(_0xc19d('0x9'));var _=require(_0xc19d('0xa'));var squel=require(_0xc19d('0xb'));var crypto=require(_0xc19d('0xc'));var jsforce=require(_0xc19d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc19d('0xe'));var Redis=require(_0xc19d('0xf'));var authService=require(_0xc19d('0x10'));var qs=require(_0xc19d('0x11'));var as=require(_0xc19d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc19d('0x13'));var config=require(_0xc19d('0x14'));var licenseUtil=require(_0xc19d('0x15'));var db=require(_0xc19d('0x16'))['db'];config[_0xc19d('0x17')]=_[_0xc19d('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc19d('0x19'))(new Redis(config[_0xc19d('0x17')]));require('./voiceExtension.socket')[_0xc19d('0x1a')](socket);function respondWithStatusCode(_0x3d1c35,_0x5bfc9d){_0x5bfc9d=_0x5bfc9d||0xcc;return function(_0x41d49e){if(_0x41d49e){return _0x3d1c35[_0xc19d('0x1b')](_0x5bfc9d);}return _0x3d1c35[_0xc19d('0x1c')](_0x5bfc9d)['end']();};}function respondWithResult(_0x4422ee,_0x1cfb72){_0x1cfb72=_0x1cfb72||0xc8;return function(_0x26da6d){if(_0x26da6d){return _0x4422ee['status'](_0x1cfb72)[_0xc19d('0x1d')](_0x26da6d);}};}function respondWithFilteredResult(_0x555ead,_0x166c85){return function(_0x168d24){if(_0x168d24){var _0x5b7dbc=typeof _0x166c85['offset']==='undefined'&&typeof _0x166c85[_0xc19d('0x1e')]==='undefined';var _0x255c37=_0x168d24[_0xc19d('0x1f')];var _0x11c2bc=_0x5b7dbc?0x0:_0x166c85[_0xc19d('0x20')];var _0x779d46=_0x5b7dbc?_0x168d24[_0xc19d('0x1f')]:_0x166c85[_0xc19d('0x20')]+_0x166c85[_0xc19d('0x1e')];var _0x842eb7;if(_0x779d46>=_0x255c37){_0x779d46=_0x255c37;_0x842eb7=0xc8;}else{_0x842eb7=0xce;}_0x555ead[_0xc19d('0x1c')](_0x842eb7);return _0x555ead['set']('Content-Range',_0x11c2bc+'-'+_0x779d46+'/'+_0x255c37)[_0xc19d('0x1d')](_0x168d24);}return null;};}function patchUpdates(_0x5a7bcc){return function(_0x52a11a){try{jsonpatch[_0xc19d('0x21')](_0x52a11a,_0x5a7bcc,!![]);}catch(_0x1013b3){return BPromise[_0xc19d('0x22')](_0x1013b3);}return _0x52a11a[_0xc19d('0x23')]();};}function saveUpdates(_0x5b4266,_0x5d0581){return function(_0x7ecc28){if(_0x7ecc28){return _0x7ecc28[_0xc19d('0x24')](_0x5b4266)['then'](function(_0x135153){return _0x135153;});}return null;};}function removeEntity(_0x48432f,_0xc1b9e1){return function(_0x146dcb){if(_0x146dcb){return _0x146dcb[_0xc19d('0x25')]()['then'](function(){var _0x1bc38a=_0x146dcb[_0xc19d('0x26')]({'plain':!![]});var _0x4201ec=[{'name':_0xc19d('0x27'),'value':_0xc19d('0x28'),'ignore':![]},{'name':_0xc19d('0x29'),'value':_0xc19d('0x2a'),'ignore':![]},{'name':_0xc19d('0x2b'),'value':'internal','ignore':![]}];var _0x1dfc0e=_(_0x4201ec)[_0xc19d('0x2c')]('ignore')[_0xc19d('0x2d')](_0xc19d('0x2e'))[_0xc19d('0x2e')]();if(_[_0xc19d('0x2f')](_0x1dfc0e,_0x1bc38a[_0xc19d('0x30')])){return;}var _0x153dba=_[_0xc19d('0x31')](_0x4201ec,[_0xc19d('0x2e'),_0x1bc38a[_0xc19d('0x30')]])[_0xc19d('0x32')];return db[_0xc19d('0x33')][_0xc19d('0x25')]({'where':{'type':_0x153dba,'resourceId':_0x1bc38a['id']}})[_0xc19d('0x34')](function(){return _0x146dcb;});})['then'](function(){_0x48432f[_0xc19d('0x1c')](0xcc)[_0xc19d('0x35')]();});}};}function handleEntityNotFound(_0xe36f69,_0x531147){return function(_0x179d39){if(!_0x179d39){_0xe36f69['sendStatus'](0x194);}return _0x179d39;};}function handleError(_0x400c5c,_0x3b3cc9){_0x3b3cc9=_0x3b3cc9||0x1f4;return function(_0x154db2){logger[_0xc19d('0x36')](_0x154db2['stack']);if(_0x154db2[_0xc19d('0x32')]){delete _0x154db2['name'];}_0x400c5c[_0xc19d('0x1c')](_0x3b3cc9)[_0xc19d('0x37')](_0x154db2);};}function getMustacheRender(_0x31740f,_0x41c71b){return Mustache[_0xc19d('0x38')](_0x31740f,_[_0xc19d('0x39')](_0x41c71b[_0xc19d('0x3a')],{'contact':_0x41c71b[_0xc19d('0x3b')],'message':_0x41c71b[_0xc19d('0x3c')],'agent':_0x41c71b[_0xc19d('0x3d')],'interaction':_0x41c71b['interaction'],'account':_0x41c71b['account']}))||'';}exports[_0xc19d('0x3e')]=function(_0x544000,_0x217728){var _0x35217d={},_0x26cdf0={},_0x297263={'count':0x0,'rows':[]};var _0x407668=_[_0xc19d('0x2d')](db[_0xc19d('0x3f')]['rawAttributes'],function(_0x52190b){return{'name':_0x52190b[_0xc19d('0x40')],'type':_0x52190b[_0xc19d('0x30')][_0xc19d('0x41')]};});_0x26cdf0[_0xc19d('0x42')]=_[_0xc19d('0x2d')](_0x407668,'name');_0x26cdf0[_0xc19d('0x43')]=_[_0xc19d('0x44')](_0x544000['query']);_0x26cdf0[_0xc19d('0x45')]=_['intersection'](_0x26cdf0['model'],_0x26cdf0['query']);_0x35217d['attributes']=_['intersection'](_0x26cdf0['model'],qs[_0xc19d('0x46')](_0x544000[_0xc19d('0x43')]['fields']));_0x35217d[_0xc19d('0x47')]=_0x35217d['attributes']['length']?_0x35217d[_0xc19d('0x47')]:_0x26cdf0[_0xc19d('0x42')];if(!_0x544000[_0xc19d('0x43')][_0xc19d('0x48')](_0xc19d('0x49'))){_0x35217d[_0xc19d('0x1e')]=qs[_0xc19d('0x1e')](_0x544000[_0xc19d('0x43')][_0xc19d('0x1e')]);_0x35217d[_0xc19d('0x20')]=qs[_0xc19d('0x20')](_0x544000[_0xc19d('0x43')][_0xc19d('0x20')]);}_0x35217d['order']=qs[_0xc19d('0x4a')](_0x544000[_0xc19d('0x43')][_0xc19d('0x4a')]);_0x35217d[_0xc19d('0x4b')]=qs[_0xc19d('0x45')](_[_0xc19d('0x4c')](_0x544000[_0xc19d('0x43')],_0x26cdf0['filters']),_0x407668);if(_0x544000[_0xc19d('0x43')][_0xc19d('0x2c')]){_0x35217d[_0xc19d('0x4b')]=_[_0xc19d('0x39')](_0x35217d[_0xc19d('0x4b')],{'$or':_[_0xc19d('0x2d')](_0x407668,function(_0x4bb0a3){if(_0x4bb0a3[_0xc19d('0x30')]!==_0xc19d('0x4d')){var _0x671eb={};_0x671eb[_0x4bb0a3[_0xc19d('0x32')]]={'$like':'%'+_0x544000['query'][_0xc19d('0x2c')]+'%'};return _0x671eb;}})});}_0x35217d=_[_0xc19d('0x39')]({},_0x35217d,_0x544000['options']);var _0x4cf5d3={'where':_0x35217d[_0xc19d('0x4b')]};return db[_0xc19d('0x3f')]['count'](_0x4cf5d3)[_0xc19d('0x34')](function(_0x1f1f33){_0x297263[_0xc19d('0x1f')]=_0x1f1f33;if(_0x544000[_0xc19d('0x43')]['includeAll']){_0x35217d[_0xc19d('0x4e')]=[{'all':!![]}];}return db[_0xc19d('0x3f')]['findAll'](_0x35217d);})[_0xc19d('0x34')](function(_0x3c37b7){_0x297263[_0xc19d('0x4f')]=_0x3c37b7;return _0x297263;})['then'](respondWithFilteredResult(_0x217728,_0x35217d))[_0xc19d('0x50')](handleError(_0x217728,null));};exports[_0xc19d('0x51')]=function(_0x399f6a,_0x30ef28){var _0x5e47e1={'raw':![],'where':{'id':_0x399f6a['params']['id']}},_0x39ae36={};_0x39ae36['model']=_[_0xc19d('0x44')](db[_0xc19d('0x3f')][_0xc19d('0x52')]);_0x39ae36[_0xc19d('0x43')]=_['keys'](_0x399f6a[_0xc19d('0x43')]);_0x39ae36[_0xc19d('0x45')]=_[_0xc19d('0x53')](_0x39ae36[_0xc19d('0x42')],_0x39ae36['query']);_0x5e47e1[_0xc19d('0x47')]=_[_0xc19d('0x53')](_0x39ae36[_0xc19d('0x42')],qs[_0xc19d('0x46')](_0x399f6a[_0xc19d('0x43')][_0xc19d('0x46')]));_0x5e47e1[_0xc19d('0x47')]=_0x5e47e1[_0xc19d('0x47')][_0xc19d('0x54')]?_0x5e47e1['attributes']:_0x39ae36[_0xc19d('0x42')];if(_0x399f6a[_0xc19d('0x43')][_0xc19d('0x55')]){_0x5e47e1['include']=[{'all':!![]}];}_0x5e47e1=_[_0xc19d('0x39')]({},_0x5e47e1,_0x399f6a[_0xc19d('0x56')]);return db[_0xc19d('0x3f')]['find'](_0x5e47e1)[_0xc19d('0x34')](handleEntityNotFound(_0x30ef28,null))[_0xc19d('0x34')](respondWithResult(_0x30ef28,null))[_0xc19d('0x50')](handleError(_0x30ef28,null));};exports['destroy']=function(_0x180e02,_0x3ac1c1){return db[_0xc19d('0x3f')][_0xc19d('0x31')]({'where':{'id':_0x180e02[_0xc19d('0x57')]['id']}})[_0xc19d('0x34')](handleEntityNotFound(_0x3ac1c1,null))[_0xc19d('0x34')](removeEntity(_0x3ac1c1,null))[_0xc19d('0x50')](handleError(_0x3ac1c1,null));};exports[_0xc19d('0x58')]=function(_0x43ebef,_0x44f368){if(_0x43ebef['body']['type']==='outbound'&&!_[_0xc19d('0x59')](_0x43ebef[_0xc19d('0x3a')][_0xc19d('0x5a')],'_')){_0x43ebef[_0xc19d('0x3a')]['exten']='_'['concat'](_0x43ebef['body']['exten']);}return db[_0xc19d('0x3f')][_0xc19d('0x58')](_0x43ebef[_0xc19d('0x3a')],{'raw':![]})[_0xc19d('0x34')](function(_0x539037){var _0x299df3=_0x43ebef['user'][_0xc19d('0x26')]({'plain':!![]});if(!_0x299df3)throw new Error(_0xc19d('0x5b'));if(_0x299df3['role']==='user'){var _0x2ad2cd=_0x539037['get']({'plain':!![]});var _0x4f9756=[{'name':_0xc19d('0x27'),'value':_0xc19d('0x28')},{'name':_0xc19d('0x29'),'value':'outbound'},{'name':'InternalRoutes','value':_0xc19d('0x5c')}];var _0xb706f2=_[_0xc19d('0x31')](_0x4f9756,['value',_0x2ad2cd[_0xc19d('0x30')]])['name'];return db[_0xc19d('0x5d')][_0xc19d('0x31')]({'where':{'name':_0xb706f2,'userProfileId':_0x299df3[_0xc19d('0x5e')]},'raw':!![]})[_0xc19d('0x34')](function(_0x584e9d){if(_0x584e9d&&_0x584e9d[_0xc19d('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x2ad2cd[_0xc19d('0x32')],'resourceId':_0x2ad2cd['id'],'type':_0x584e9d[_0xc19d('0x32')],'sectionId':_0x584e9d['id']},{})[_0xc19d('0x34')](function(){return _0x539037;});}else{return _0x539037;}})['catch'](function(_0x38c4da){logger[_0xc19d('0x36')](_0xc19d('0x60'),_0x38c4da);throw _0x38c4da;});}return _0x539037;})[_0xc19d('0x34')](respondWithResult(_0x44f368,0xc9))[_0xc19d('0x50')](handleError(_0x44f368,null));};exports[_0xc19d('0x24')]=function(_0x3bc959,_0x425e98){if(_0x3bc959[_0xc19d('0x3a')]['id']){delete _0x3bc959[_0xc19d('0x3a')]['id'];}return db[_0xc19d('0x3f')][_0xc19d('0x31')]({'where':{'id':_0x3bc959[_0xc19d('0x57')]['id']}})['then'](handleEntityNotFound(_0x425e98,null))[_0xc19d('0x34')](function(_0x114092){if(_0x114092){return db[_0xc19d('0x3f')]['update'](_[_0xc19d('0x4c')](_0x3bc959[_0xc19d('0x3a')],[_0xc19d('0x5a'),_0xc19d('0x61'),_0xc19d('0x62'),_0xc19d('0x63'),_0xc19d('0x64'),_0xc19d('0x65')]),{'where':{'context':_0x114092[_0xc19d('0x61')],'exten':_0x114092[_0xc19d('0x5a')]},'individualHooks':!![]})['then'](function(_0xc60675){return _0xc60675;});}return null;})[_0xc19d('0x34')](respondWithStatusCode(_0x425e98,null))[_0xc19d('0x50')](handleError(_0x425e98,null));};exports[_0xc19d('0x66')]=function(_0x4573d3,_0xfc5fba,_0x2518e8){return db[_0xc19d('0x3f')][_0xc19d('0x67')]({'where':{'id':_0x4573d3['params']['id']}})[_0xc19d('0x34')](handleEntityNotFound(_0xfc5fba,null))[_0xc19d('0x34')](function(_0x10ed3b){if(_0x10ed3b){return db[_0xc19d('0x68')][_0xc19d('0x69')](function(_0x53a84f){return db['VoiceExtension'][_0xc19d('0x25')]({'where':{'VoiceExtensionId':_0x4573d3[_0xc19d('0x57')]['id']},'transaction':_0x53a84f})[_0xc19d('0x34')](function(_0x27eee4){var _0x5c171d=_[_0xc19d('0x2d')](_0x4573d3['body'],function(_0x2f43a5){_0x2f43a5[_0xc19d('0x6a')]=_0x4573d3[_0xc19d('0x57')]['id'];return _0x2f43a5;});return db['VoiceExtension'][_0xc19d('0x6b')](_0x5c171d,{'transaction':_0x53a84f});});})[_0xc19d('0x34')](function(){return db['VoiceExtension'][_0xc19d('0x6c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4573d3['params']['id']},'order':_0xc19d('0x6d')});});}})[_0xc19d('0x34')](respondWithResult(_0xfc5fba,null))[_0xc19d('0x50')](handleError(_0xfc5fba,null));}; \ No newline at end of file +var _0x5368=['autoAssociation','error','update','params','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type','find','name','UserProfileResource','sendStatus','send','render','body','contact','message','account','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','rawAttributes','includeAll','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','internal','userProfileId'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x5368,0x1db));var _0x8536=function(_0x3b9f1a,_0x3f85dc){_0x3b9f1a=_0x3b9f1a-0x0;var _0x3a590d=_0x5368[_0x3b9f1a];return _0x3a590d;};'use strict';var emlformat=require(_0x8536('0x0'));var rimraf=require(_0x8536('0x1'));var zipdir=require(_0x8536('0x2'));var jsonpatch=require(_0x8536('0x3'));var rp=require(_0x8536('0x4'));var moment=require(_0x8536('0x5'));var BPromise=require(_0x8536('0x6'));var Mustache=require(_0x8536('0x7'));var util=require(_0x8536('0x8'));var path=require(_0x8536('0x9'));var sox=require(_0x8536('0xa'));var csv=require(_0x8536('0xb'));var ejs=require(_0x8536('0xc'));var fs=require('fs');var fs_extra=require(_0x8536('0xd'));var _=require(_0x8536('0xe'));var squel=require(_0x8536('0xf'));var crypto=require(_0x8536('0x10'));var jsforce=require(_0x8536('0x11'));var deskjs=require(_0x8536('0x12'));var toCsv=require(_0x8536('0xb'));var querystring=require('querystring');var Papa=require(_0x8536('0x13'));var Redis=require(_0x8536('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x8536('0x15'));var as=require(_0x8536('0x16'));var hardwareService=require(_0x8536('0x17'));var logger=require(_0x8536('0x18'))(_0x8536('0x19'));var utils=require(_0x8536('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x8536('0x1b'));var db=require(_0x8536('0x1c'))['db'];config['redis']=_['defaults'](config[_0x8536('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x8536('0x1e'))(new Redis(config['redis']));require(_0x8536('0x1f'))['register'](socket);function respondWithStatusCode(_0x3f6d46,_0x48d192){_0x48d192=_0x48d192||0xcc;return function(_0x2e3339){if(_0x2e3339){return _0x3f6d46['sendStatus'](_0x48d192);}return _0x3f6d46[_0x8536('0x20')](_0x48d192)[_0x8536('0x21')]();};}function respondWithResult(_0x27e5ec,_0x277b88){_0x277b88=_0x277b88||0xc8;return function(_0x38ca1c){if(_0x38ca1c){return _0x27e5ec['status'](_0x277b88)['json'](_0x38ca1c);}};}function respondWithFilteredResult(_0x4b604e,_0x581c42){return function(_0xa47e3b){if(_0xa47e3b){var _0x39ff21=typeof _0x581c42[_0x8536('0x22')]===_0x8536('0x23')&&typeof _0x581c42[_0x8536('0x24')]===_0x8536('0x23');var _0x638851=_0xa47e3b[_0x8536('0x25')];var _0x3dcdde=_0x39ff21?0x0:_0x581c42[_0x8536('0x22')];var _0x520f48=_0x39ff21?_0xa47e3b[_0x8536('0x25')]:_0x581c42[_0x8536('0x22')]+_0x581c42['limit'];var _0x582e40;if(_0x520f48>=_0x638851){_0x520f48=_0x638851;_0x582e40=0xc8;}else{_0x582e40=0xce;}_0x4b604e[_0x8536('0x20')](_0x582e40);return _0x4b604e[_0x8536('0x26')](_0x8536('0x27'),_0x3dcdde+'-'+_0x520f48+'/'+_0x638851)[_0x8536('0x28')](_0xa47e3b);}return null;};}function patchUpdates(_0x51cddf){return function(_0x3af285){try{jsonpatch[_0x8536('0x29')](_0x3af285,_0x51cddf,!![]);}catch(_0x4380b9){return BPromise['reject'](_0x4380b9);}return _0x3af285[_0x8536('0x2a')]();};}function saveUpdates(_0x27f9c1,_0x538fc5){return function(_0x34938b){if(_0x34938b){return _0x34938b['update'](_0x27f9c1)[_0x8536('0x2b')](function(_0x5e6a3c){return _0x5e6a3c;});}return null;};}function removeEntity(_0x45a1b4,_0x441568){return function(_0x3c315b){if(_0x3c315b){return _0x3c315b[_0x8536('0x2c')]()[_0x8536('0x2b')](function(){var _0x2cc2e9=_0x3c315b[_0x8536('0x2d')]({'plain':!![]});var _0x3ee02d=[{'name':_0x8536('0x2e'),'value':'inbound','ignore':![]},{'name':_0x8536('0x2f'),'value':_0x8536('0x30'),'ignore':![]},{'name':_0x8536('0x31'),'value':'internal','ignore':![]}];var _0x1be7d7=_(_0x3ee02d)[_0x8536('0x32')](_0x8536('0x33'))[_0x8536('0x34')](_0x8536('0x35'))['value']();if(_['includes'](_0x1be7d7,_0x2cc2e9[_0x8536('0x36')])){return;}var _0x2917fc=_[_0x8536('0x37')](_0x3ee02d,[_0x8536('0x35'),_0x2cc2e9[_0x8536('0x36')]])[_0x8536('0x38')];return db[_0x8536('0x39')][_0x8536('0x2c')]({'where':{'type':_0x2917fc,'resourceId':_0x2cc2e9['id']}})[_0x8536('0x2b')](function(){return _0x3c315b;});})[_0x8536('0x2b')](function(){_0x45a1b4[_0x8536('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309558,_0x1faea8){return function(_0x334c5f){if(!_0x334c5f){_0x309558[_0x8536('0x3a')](0x194);}return _0x334c5f;};}function handleError(_0x472849,_0x1ed58c){_0x1ed58c=_0x1ed58c||0x1f4;return function(_0x522617){logger['error'](_0x522617['stack']);if(_0x522617[_0x8536('0x38')]){delete _0x522617[_0x8536('0x38')];}_0x472849['status'](_0x1ed58c)[_0x8536('0x3b')](_0x522617);};}function getMustacheRender(_0x561684,_0x32508c){return Mustache[_0x8536('0x3c')](_0x561684,_['merge'](_0x32508c[_0x8536('0x3d')],{'contact':_0x32508c[_0x8536('0x3e')],'message':_0x32508c[_0x8536('0x3f')],'agent':_0x32508c['agent'],'interaction':_0x32508c['interaction'],'account':_0x32508c[_0x8536('0x40')]}))||'';}exports[_0x8536('0x41')]=function(_0x3b93e0,_0x4f9c9e){var _0x3c47={},_0x531d81={},_0x4162f4={'count':0x0,'rows':[]};var _0x4ede4d=_['map'](db[_0x8536('0x42')]['rawAttributes'],function(_0x40955){return{'name':_0x40955[_0x8536('0x43')],'type':_0x40955[_0x8536('0x36')][_0x8536('0x44')]};});_0x531d81[_0x8536('0x45')]=_['map'](_0x4ede4d,_0x8536('0x38'));_0x531d81[_0x8536('0x46')]=_[_0x8536('0x47')](_0x3b93e0[_0x8536('0x46')]);_0x531d81[_0x8536('0x48')]=_[_0x8536('0x49')](_0x531d81['model'],_0x531d81['query']);_0x3c47[_0x8536('0x4a')]=_[_0x8536('0x49')](_0x531d81['model'],qs[_0x8536('0x4b')](_0x3b93e0[_0x8536('0x46')][_0x8536('0x4b')]));_0x3c47['attributes']=_0x3c47[_0x8536('0x4a')][_0x8536('0x4c')]?_0x3c47['attributes']:_0x531d81['model'];if(!_0x3b93e0[_0x8536('0x46')][_0x8536('0x4d')](_0x8536('0x4e'))){_0x3c47[_0x8536('0x24')]=qs[_0x8536('0x24')](_0x3b93e0[_0x8536('0x46')][_0x8536('0x24')]);_0x3c47[_0x8536('0x22')]=qs[_0x8536('0x22')](_0x3b93e0[_0x8536('0x46')][_0x8536('0x22')]);}_0x3c47['order']=qs[_0x8536('0x4f')](_0x3b93e0[_0x8536('0x46')][_0x8536('0x4f')]);_0x3c47[_0x8536('0x50')]=qs[_0x8536('0x48')](_[_0x8536('0x51')](_0x3b93e0[_0x8536('0x46')],_0x531d81[_0x8536('0x48')]),_0x4ede4d);if(_0x3b93e0['query'][_0x8536('0x32')]){_0x3c47[_0x8536('0x50')]=_['merge'](_0x3c47[_0x8536('0x50')],{'$or':_[_0x8536('0x34')](_0x4ede4d,function(_0x3931f9){if(_0x3931f9['type']!==_0x8536('0x52')){var _0x225052={};_0x225052[_0x3931f9[_0x8536('0x38')]]={'$like':'%'+_0x3b93e0[_0x8536('0x46')][_0x8536('0x32')]+'%'};return _0x225052;}})});}_0x3c47=_[_0x8536('0x53')]({},_0x3c47,_0x3b93e0[_0x8536('0x54')]);var _0x51727a={'where':_0x3c47[_0x8536('0x50')]};return db['VoiceExtension'][_0x8536('0x25')](_0x51727a)['then'](function(_0x4e1acb){_0x4162f4[_0x8536('0x25')]=_0x4e1acb;if(_0x3b93e0[_0x8536('0x46')]['includeAll']){_0x3c47[_0x8536('0x55')]=[{'all':!![]}];}return db[_0x8536('0x42')][_0x8536('0x56')](_0x3c47);})[_0x8536('0x2b')](function(_0x541ee7){_0x4162f4[_0x8536('0x57')]=_0x541ee7;return _0x4162f4;})['then'](respondWithFilteredResult(_0x4f9c9e,_0x3c47))[_0x8536('0x58')](handleError(_0x4f9c9e,null));};exports['show']=function(_0x197d24,_0x5c8344){var _0x3e127b={'raw':![],'where':{'id':_0x197d24['params']['id']}},_0x5f0ef4={};_0x5f0ef4[_0x8536('0x45')]=_[_0x8536('0x47')](db[_0x8536('0x42')][_0x8536('0x59')]);_0x5f0ef4['query']=_[_0x8536('0x47')](_0x197d24[_0x8536('0x46')]);_0x5f0ef4['filters']=_[_0x8536('0x49')](_0x5f0ef4[_0x8536('0x45')],_0x5f0ef4[_0x8536('0x46')]);_0x3e127b[_0x8536('0x4a')]=_[_0x8536('0x49')](_0x5f0ef4[_0x8536('0x45')],qs[_0x8536('0x4b')](_0x197d24['query']['fields']));_0x3e127b[_0x8536('0x4a')]=_0x3e127b[_0x8536('0x4a')]['length']?_0x3e127b['attributes']:_0x5f0ef4['model'];if(_0x197d24['query'][_0x8536('0x5a')]){_0x3e127b[_0x8536('0x55')]=[{'all':!![]}];}_0x3e127b=_[_0x8536('0x53')]({},_0x3e127b,_0x197d24[_0x8536('0x54')]);return db[_0x8536('0x42')][_0x8536('0x37')](_0x3e127b)[_0x8536('0x2b')](handleEntityNotFound(_0x5c8344,null))['then'](respondWithResult(_0x5c8344,null))[_0x8536('0x58')](handleError(_0x5c8344,null));};exports[_0x8536('0x2c')]=function(_0x244dbb,_0x43304e){return db[_0x8536('0x42')][_0x8536('0x37')]({'where':{'id':_0x244dbb['params']['id']}})[_0x8536('0x2b')](handleEntityNotFound(_0x43304e,null))[_0x8536('0x2b')](removeEntity(_0x43304e,null))[_0x8536('0x58')](handleError(_0x43304e,null));};exports['create']=function(_0x22f1a7,_0x355de4){if(_0x22f1a7['body'][_0x8536('0x36')]===_0x8536('0x30')&&!_[_0x8536('0x5b')](_0x22f1a7[_0x8536('0x3d')][_0x8536('0x5c')],'_')){_0x22f1a7[_0x8536('0x3d')]['exten']='_'[_0x8536('0x5d')](_0x22f1a7['body'][_0x8536('0x5c')]);}return db['VoiceExtension'][_0x8536('0x5e')](_0x22f1a7[_0x8536('0x3d')],{'raw':![]})['then'](function(_0x5242e1){var _0xdd9b02=_0x22f1a7[_0x8536('0x5f')][_0x8536('0x2d')]({'plain':!![]});if(!_0xdd9b02)throw new Error(_0x8536('0x60'));if(_0xdd9b02['role']==='user'){var _0x16a34a=_0x5242e1[_0x8536('0x2d')]({'plain':!![]});var _0x5b6bb4=[{'name':_0x8536('0x2e'),'value':_0x8536('0x61')},{'name':'OutboundRoutes','value':_0x8536('0x30')},{'name':'InternalRoutes','value':_0x8536('0x62')}];var _0xe6a5e7=_[_0x8536('0x37')](_0x5b6bb4,[_0x8536('0x35'),_0x16a34a[_0x8536('0x36')]])[_0x8536('0x38')];return db['UserProfileSection'][_0x8536('0x37')]({'where':{'name':_0xe6a5e7,'userProfileId':_0xdd9b02[_0x8536('0x63')]},'raw':!![]})['then'](function(_0x44b7ff){if(_0x44b7ff&&_0x44b7ff[_0x8536('0x64')]===0x0){return db[_0x8536('0x39')][_0x8536('0x5e')]({'name':_0x16a34a['name'],'resourceId':_0x16a34a['id'],'type':_0x44b7ff['name'],'sectionId':_0x44b7ff['id']},{})[_0x8536('0x2b')](function(){return _0x5242e1;});}else{return _0x5242e1;}})[_0x8536('0x58')](function(_0x66219f){logger[_0x8536('0x65')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x66219f);throw _0x66219f;});}return _0x5242e1;})['then'](respondWithResult(_0x355de4,0xc9))[_0x8536('0x58')](handleError(_0x355de4,null));};exports[_0x8536('0x66')]=function(_0x2bc41f,_0x13ca32){if(_0x2bc41f[_0x8536('0x3d')]['id']){delete _0x2bc41f[_0x8536('0x3d')]['id'];}return db['VoiceExtension'][_0x8536('0x37')]({'where':{'id':_0x2bc41f[_0x8536('0x67')]['id']}})[_0x8536('0x2b')](handleEntityNotFound(_0x13ca32,null))[_0x8536('0x2b')](function(_0x24abef){if(_0x24abef){return db[_0x8536('0x42')][_0x8536('0x66')](_['pick'](_0x2bc41f['body'],[_0x8536('0x5c'),_0x8536('0x68'),_0x8536('0x69'),_0x8536('0x6a'),_0x8536('0x6b'),_0x8536('0x6c')]),{'where':{'context':_0x24abef['context'],'exten':_0x24abef[_0x8536('0x5c')]},'individualHooks':!![]})[_0x8536('0x2b')](function(_0x3e0f58){return _0x3e0f58;});}return null;})[_0x8536('0x2b')](respondWithStatusCode(_0x13ca32,null))[_0x8536('0x58')](handleError(_0x13ca32,null));};exports['addApplications']=function(_0x122fa5,_0x1fcbc6,_0x27b24c){return db[_0x8536('0x42')][_0x8536('0x6d')]({'where':{'id':_0x122fa5['params']['id']}})[_0x8536('0x2b')](handleEntityNotFound(_0x1fcbc6,null))[_0x8536('0x2b')](function(_0x38f2a2){if(_0x38f2a2){return db[_0x8536('0x6e')]['transaction'](function(_0xbfbc33){return db[_0x8536('0x42')][_0x8536('0x2c')]({'where':{'VoiceExtensionId':_0x122fa5[_0x8536('0x67')]['id']},'transaction':_0xbfbc33})[_0x8536('0x2b')](function(_0x46a8cc){var _0x576df5=_[_0x8536('0x34')](_0x122fa5[_0x8536('0x3d')],function(_0xf4cb80){_0xf4cb80[_0x8536('0x6f')]=_0x122fa5['params']['id'];return _0xf4cb80;});return db[_0x8536('0x42')][_0x8536('0x70')](_0x576df5,{'transaction':_0xbfbc33});});})[_0x8536('0x2b')](function(){return db[_0x8536('0x42')][_0x8536('0x71')]({'where':{'isApp':!![],'VoiceExtensionId':_0x122fa5[_0x8536('0x67')]['id']},'order':_0x8536('0x72')});});}})[_0x8536('0x2b')](respondWithResult(_0x1fcbc6,null))[_0x8536('0x58')](handleError(_0x1fcbc6,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 29d16e5..4aa17aa 100644 --- a/server/api/voiceExtension/voiceExtension.events.js +++ b/server/api/voiceExtension/voiceExtension.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ac5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x349481,_0x1f4059){var _0x3cc046=function(_0xb2acaf){while(--_0xb2acaf){_0x349481['push'](_0x349481['shift']());}};_0x3cc046(++_0x1f4059);}(_0x8ac5,0x105));var _0x58ac=function(_0x49c6cc,_0x308bdb){_0x49c6cc=_0x49c6cc-0x0;var _0x22e239=_0x8ac5[_0x49c6cc];return _0x22e239;};'use strict';var EventEmitter=require(_0x58ac('0x0'));var VoiceExtension=require(_0x58ac('0x1'))['db'][_0x58ac('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x58ac('0x3')](0x0);var events={'afterCreate':_0x58ac('0x4'),'afterUpdate':_0x58ac('0x5'),'afterDestroy':_0x58ac('0x6')};function emitEvent(_0x276bc0){return function(_0x474fa3,_0x27aae0,_0x4d6dfb){VoiceExtensionEvents[_0x58ac('0x7')](_0x276bc0+':'+_0x474fa3['id'],_0x474fa3);VoiceExtensionEvents[_0x58ac('0x7')](_0x276bc0,_0x474fa3);_0x4d6dfb(null);};}for(var e in events){if(events[_0x58ac('0x8')](e)){var event=events[e];VoiceExtension[_0x58ac('0x9')](e,emitEvent(event));}}module[_0x58ac('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9e72=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','emit'];(function(_0x5597a4,_0x161921){var _0x26ed19=function(_0x245cf7){while(--_0x245cf7){_0x5597a4['push'](_0x5597a4['shift']());}};_0x26ed19(++_0x161921);}(_0x9e72,0xfa));var _0x29e7=function(_0x17d486,_0x3f1b5c){_0x17d486=_0x17d486-0x0;var _0x358fc4=_0x9e72[_0x17d486];return _0x358fc4;};'use strict';var EventEmitter=require(_0x29e7('0x0'));var VoiceExtension=require(_0x29e7('0x1'))['db'][_0x29e7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x29e7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x29e7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14c120){return function(_0x26ef0a,_0x294ca5,_0x2f9446){VoiceExtensionEvents['emit'](_0x14c120+':'+_0x26ef0a['id'],_0x26ef0a);VoiceExtensionEvents[_0x29e7('0x5')](_0x14c120,_0x26ef0a);_0x2f9446(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x29e7('0x6')](e,emitEvent(event));}}module[_0x29e7('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8a2b825..62dc435 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcad8=['bluebird','path','rimraf','../../config/environment','exports','define','voice_extensions','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcad8,0xac));var _0x8cad=function(_0x25e8bf,_0x24205c){_0x25e8bf=_0x25e8bf-0x0;var _0x163352=_0xcad8[_0x25e8bf];return _0x163352;};'use strict';var _=require(_0x8cad('0x0'));var util=require(_0x8cad('0x1'));var logger=require('../../config/logger')(_0x8cad('0x2'));var moment=require(_0x8cad('0x3'));var BPromise=require(_0x8cad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cad('0x5'));var rimraf=require(_0x8cad('0x6'));var config=require(_0x8cad('0x7'));var attributes=require('./voiceExtension.attributes');module[_0x8cad('0x8')]=function(_0x289796,_0x24c256){return _0x289796[_0x8cad('0x9')]('VoiceExtension',attributes,{'tableName':_0x8cad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49d4=['../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x597834,_0x159bb6){var _0x12da6c=function(_0x161c38){while(--_0x161c38){_0x597834['push'](_0x597834['shift']());}};_0x12da6c(++_0x159bb6);}(_0x49d4,0x1d9));var _0x449d=function(_0x529441,_0xcec754){_0x529441=_0x529441-0x0;var _0x5d5629=_0x49d4[_0x529441];return _0x5d5629;};'use strict';var _=require(_0x449d('0x0'));var util=require(_0x449d('0x1'));var logger=require(_0x449d('0x2'))(_0x449d('0x3'));var moment=require(_0x449d('0x4'));var BPromise=require('bluebird');var rp=require(_0x449d('0x5'));var fs=require('fs');var path=require(_0x449d('0x6'));var rimraf=require(_0x449d('0x7'));var config=require(_0x449d('0x8'));var attributes=require(_0x449d('0x9'));module[_0x449d('0xa')]=function(_0x1009a8,_0x152a8d){return _0x1009a8['define'](_0x449d('0xb'),attributes,{'tableName':_0x449d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d8f7ee0..6997137 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a5=['client','http','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','jayson/promise'];(function(_0x5c7939,_0x22f61e){var _0x5bcfbc=function(_0x80c86){while(--_0x80c86){_0x5c7939['push'](_0x5c7939['shift']());}};_0x5bcfbc(++_0x22f61e);}(_0xa8a5,0x13e));var _0x5a8a=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xa8a5[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0x5a8a('0x0'));var util=require(_0x5a8a('0x1'));var moment=require(_0x5a8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a8a('0x3'));var fs=require('fs');var Redis=require(_0x5a8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5a8a('0x5'));var client=jayson[_0x5a8a('0x6')][_0x5a8a('0x7')]({'port':0x232a});config['redis']=_[_0x5a8a('0x8')](config['redis'],{'host':_0x5a8a('0x9'),'port':0x18eb});var socket=require(_0x5a8a('0xa'))(new Redis(config[_0x5a8a('0xb')]));require(_0x5a8a('0xc'))[_0x5a8a('0xd')](socket);function respondWithRpcPromise(_0xe08dac,_0x292533,_0x2ed186){return new BPromise(function(_0x13a158,_0x51db9b){return client['request'](_0xe08dac,_0x2ed186)[_0x5a8a('0xe')](function(_0x4d33d1){logger[_0x5a8a('0xf')](_0x5a8a('0x10'),_0x292533,'request\x20sent');logger[_0x5a8a('0x11')](_0x5a8a('0x12'),_0x292533,_0x5a8a('0x13'),JSON[_0x5a8a('0x14')](_0x4d33d1));if(_0x4d33d1[_0x5a8a('0x15')]){if(_0x4d33d1[_0x5a8a('0x15')]['code']===0x1f4){logger[_0x5a8a('0x15')](_0x5a8a('0x10'),_0x292533,_0x4d33d1['error'][_0x5a8a('0x16')]);return _0x51db9b(_0x4d33d1[_0x5a8a('0x15')]['message']);}logger['error'](_0x5a8a('0x10'),_0x292533,_0x4d33d1['error'][_0x5a8a('0x16')]);return _0x13a158(_0x4d33d1[_0x5a8a('0x15')]['message']);}else{logger[_0x5a8a('0xf')](_0x5a8a('0x10'),_0x292533,_0x5a8a('0x13'));_0x13a158(_0x4d33d1[_0x5a8a('0x17')][_0x5a8a('0x16')]);}})[_0x5a8a('0x18')](function(_0x113788){logger[_0x5a8a('0x15')](_0x5a8a('0x10'),_0x292533,_0x113788);_0x51db9b(_0x113788);});});}exports[_0x5a8a('0x19')]=function(_0x1f7729){var _0x4e9ef2=this;return new Promise(function(_0x398128,_0x6c48f4){return db[_0x5a8a('0x1a')][_0x5a8a('0x1b')]({'raw':_0x1f7729['options']?_0x1f7729['options'][_0x5a8a('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f7729['options']?_0x1f7729[_0x5a8a('0x1d')][_0x5a8a('0x1e')]||null:null,'attributes':_0x1f7729['options']?_0x1f7729[_0x5a8a('0x1d')][_0x5a8a('0x1f')]||null:null,'limit':_0x1f7729[_0x5a8a('0x1d')]?_0x1f7729['options'][_0x5a8a('0x20')]||null:null,'include':_0x1f7729[_0x5a8a('0x1d')]?_0x1f7729[_0x5a8a('0x1d')][_0x5a8a('0x21')]?_[_0x5a8a('0x22')](_0x1f7729['options'][_0x5a8a('0x21')],function(_0x4e7d33){return{'model':db[_0x4e7d33[_0x5a8a('0x23')]],'as':_0x4e7d33['as'],'attributes':_0x4e7d33['attributes'],'include':_0x4e7d33[_0x5a8a('0x21')]?_[_0x5a8a('0x22')](_0x4e7d33[_0x5a8a('0x21')],function(_0x504435){return{'model':db[_0x504435['model']],'as':_0x504435['as'],'attributes':_0x504435[_0x5a8a('0x1f')],'include':_0x504435[_0x5a8a('0x21')]?_[_0x5a8a('0x22')](_0x504435[_0x5a8a('0x21')],function(_0x206089){return{'model':db[_0x206089[_0x5a8a('0x23')]],'as':_0x206089['as'],'attributes':_0x206089['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a8a('0xe')](function(_0xf3eb38){logger['info'](_0x5a8a('0x19'),_0x1f7729);logger['debug'](_0x5a8a('0x19'),_0x1f7729,JSON[_0x5a8a('0x14')](_0xf3eb38));_0x398128(_0xf3eb38);})[_0x5a8a('0x18')](function(_0x17edcd){logger[_0x5a8a('0x15')](_0x5a8a('0x19'),_0x17edcd[_0x5a8a('0x16')],_0x1f7729);_0x6c48f4(_0x4e9ef2[_0x5a8a('0x15')](0x1f4,_0x17edcd[_0x5a8a('0x16')]));});});}; \ No newline at end of file +var _0xd1fa=['request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','limit','include','map','model','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1fa,0xc0));var _0xad1f=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xd1fa[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0xad1f('0x0'));var util=require('util');var moment=require(_0xad1f('0x1'));var BPromise=require('bluebird');var rs=require(_0xad1f('0x2'));var fs=require('fs');var Redis=require(_0xad1f('0x3'));var db=require(_0xad1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad1f('0x5'));var config=require(_0xad1f('0x6'));var jayson=require(_0xad1f('0x7'));var client=jayson[_0xad1f('0x8')]['http']({'port':0x232a});config[_0xad1f('0x9')]=_[_0xad1f('0xa')](config[_0xad1f('0x9')],{'host':_0xad1f('0xb'),'port':0x18eb});var socket=require(_0xad1f('0xc'))(new Redis(config[_0xad1f('0x9')]));require('./voiceExtension.socket')[_0xad1f('0xd')](socket);function respondWithRpcPromise(_0xeada06,_0x1dda90,_0x37c4ec){return new BPromise(function(_0x1fde6f,_0x4fd30b){return client[_0xad1f('0xe')](_0xeada06,_0x37c4ec)[_0xad1f('0xf')](function(_0x3797a6){logger[_0xad1f('0x10')](_0xad1f('0x11'),_0x1dda90,_0xad1f('0x12'));logger[_0xad1f('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1dda90,_0xad1f('0x12'),JSON[_0xad1f('0x14')](_0x3797a6));if(_0x3797a6[_0xad1f('0x15')]){if(_0x3797a6[_0xad1f('0x15')][_0xad1f('0x16')]===0x1f4){logger[_0xad1f('0x15')](_0xad1f('0x11'),_0x1dda90,_0x3797a6[_0xad1f('0x15')][_0xad1f('0x17')]);return _0x4fd30b(_0x3797a6[_0xad1f('0x15')]['message']);}logger[_0xad1f('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x1dda90,_0x3797a6[_0xad1f('0x15')]['message']);return _0x1fde6f(_0x3797a6['error'][_0xad1f('0x17')]);}else{logger[_0xad1f('0x10')](_0xad1f('0x11'),_0x1dda90,_0xad1f('0x12'));_0x1fde6f(_0x3797a6[_0xad1f('0x18')][_0xad1f('0x17')]);}})[_0xad1f('0x19')](function(_0x3d844c){logger[_0xad1f('0x15')](_0xad1f('0x11'),_0x1dda90,_0x3d844c);_0x4fd30b(_0x3d844c);});});}exports[_0xad1f('0x1a')]=function(_0x14f92e){var _0x48f7be=this;return new Promise(function(_0x58186f,_0x36d1ca){return db['VoiceExtension'][_0xad1f('0x1b')]({'raw':_0x14f92e[_0xad1f('0x1c')]?_0x14f92e[_0xad1f('0x1c')][_0xad1f('0x1d')]===undefined?!![]:![]:!![],'where':_0x14f92e[_0xad1f('0x1c')]?_0x14f92e[_0xad1f('0x1c')]['where']||null:null,'attributes':_0x14f92e[_0xad1f('0x1c')]?_0x14f92e[_0xad1f('0x1c')]['attributes']||null:null,'limit':_0x14f92e[_0xad1f('0x1c')]?_0x14f92e['options'][_0xad1f('0x1e')]||null:null,'include':_0x14f92e[_0xad1f('0x1c')]?_0x14f92e[_0xad1f('0x1c')][_0xad1f('0x1f')]?_[_0xad1f('0x20')](_0x14f92e['options'][_0xad1f('0x1f')],function(_0x8e9582){return{'model':db[_0x8e9582[_0xad1f('0x21')]],'as':_0x8e9582['as'],'attributes':_0x8e9582['attributes'],'include':_0x8e9582[_0xad1f('0x1f')]?_[_0xad1f('0x20')](_0x8e9582['include'],function(_0x4a74a3){return{'model':db[_0x4a74a3[_0xad1f('0x21')]],'as':_0x4a74a3['as'],'attributes':_0x4a74a3[_0xad1f('0x22')],'include':_0x4a74a3[_0xad1f('0x1f')]?_[_0xad1f('0x20')](_0x4a74a3[_0xad1f('0x1f')],function(_0x322867){return{'model':db[_0x322867[_0xad1f('0x21')]],'as':_0x322867['as'],'attributes':_0x322867['attributes']};}):[]};}):[]};}):[]:[]})[_0xad1f('0xf')](function(_0x114f6d){logger['info']('GetVoiceExtension',_0x14f92e);logger[_0xad1f('0x13')](_0xad1f('0x1a'),_0x14f92e,JSON[_0xad1f('0x14')](_0x114f6d));_0x58186f(_0x114f6d);})[_0xad1f('0x19')](function(_0x383977){logger[_0xad1f('0x15')](_0xad1f('0x1a'),_0x383977[_0xad1f('0x17')],_0x14f92e);_0x36d1ca(_0x48f7be['error'](0x1f4,_0x383977[_0xad1f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0afd092..193e3f1 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf76a=['remove','update','emit','register','length','./voiceExtension.events','save'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf76a,0x147));var _0xaf76=function(_0x4363b8,_0xf6c1f2){_0x4363b8=_0x4363b8-0x0;var _0x2d9a66=_0xf76a[_0x4363b8];return _0x2d9a66;};'use strict';var VoiceExtensionEvents=require(_0xaf76('0x0'));var events=[_0xaf76('0x1'),_0xaf76('0x2'),_0xaf76('0x3')];function createListener(_0x267962,_0x54e272){return function(_0x1c3b9a){_0x54e272[_0xaf76('0x4')](_0x267962,_0x1c3b9a);};}function removeListener(_0xe5efc4,_0x1730ae){return function(){VoiceExtensionEvents['removeListener'](_0xe5efc4,_0x1730ae);};}exports[_0xaf76('0x5')]=function(_0x3baf71){for(var _0x66a0c2=0x0,_0x2e8319=events[_0xaf76('0x6')];_0x66a0c2<_0x2e8319;_0x66a0c2++){var _0x10b79b=events[_0x66a0c2];var _0x5afee8=createListener('voiceExtension:'+_0x10b79b,_0x3baf71);VoiceExtensionEvents['on'](_0x10b79b,_0x5afee8);}}; \ No newline at end of file +var _0xe4a6=['update','emit','removeListener','register','length','./voiceExtension.events','save','remove'];(function(_0x3fdab4,_0x41eca9){var _0x484516=function(_0x3ccbb3){while(--_0x3ccbb3){_0x3fdab4['push'](_0x3fdab4['shift']());}};_0x484516(++_0x41eca9);}(_0xe4a6,0x1bd));var _0x6e4a=function(_0x264d4d,_0x118fb5){_0x264d4d=_0x264d4d-0x0;var _0xc917e2=_0xe4a6[_0x264d4d];return _0xc917e2;};'use strict';var VoiceExtensionEvents=require(_0x6e4a('0x0'));var events=[_0x6e4a('0x1'),_0x6e4a('0x2'),_0x6e4a('0x3')];function createListener(_0x4637b9,_0x42cf30){return function(_0xb25d9f){_0x42cf30[_0x6e4a('0x4')](_0x4637b9,_0xb25d9f);};}function removeListener(_0x59e9a7,_0x204cf5){return function(){VoiceExtensionEvents[_0x6e4a('0x5')](_0x59e9a7,_0x204cf5);};}exports[_0x6e4a('0x6')]=function(_0x356537){for(var _0x3b8d3f=0x0,_0x3667c6=events[_0x6e4a('0x7')];_0x3b8d3f<_0x3667c6;_0x3b8d3f++){var _0x3b73ec=events[_0x3b8d3f];var _0x5ce820=createListener('voiceExtension:'+_0x3b73ec,_0x356537);VoiceExtensionEvents['on'](_0x3b73ec,_0x5ce820);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 698d0d1..60c7391 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b0f=['show','/:id/messages','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x741b9a,_0x44c670){var _0x4bf212=function(_0x55e5b6){while(--_0x55e5b6){_0x741b9a['push'](_0x741b9a['shift']());}};_0x4bf212(++_0x44c670);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x1947c7,_0x524b2c){_0x1947c7=_0x1947c7-0x0;var _0xbbca75=_0x4b0f[_0x1947c7];return _0xbbca75;};'use strict';var multer=require('multer');var util=require(_0xf4b0('0x0'));var path=require(_0xf4b0('0x1'));var timeout=require(_0xf4b0('0x2'));var express=require('express');var router=express[_0xf4b0('0x3')]();var fs_extra=require(_0xf4b0('0x4'));var auth=require(_0xf4b0('0x5'));var interaction=require(_0xf4b0('0x6'));var config=require(_0xf4b0('0x7'));var controller=require(_0xf4b0('0x8'));router[_0xf4b0('0x9')]('/',auth[_0xf4b0('0xa')](),controller[_0xf4b0('0xb')]);router[_0xf4b0('0x9')](_0xf4b0('0xc'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0xd')]);router[_0xf4b0('0x9')](_0xf4b0('0xe'),auth[_0xf4b0('0xa')](),controller['getMessages']);router[_0xf4b0('0xf')]('/',auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x10')]);router[_0xf4b0('0x11')](_0xf4b0('0xc'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x12')]);router[_0xf4b0('0x13')](_0xf4b0('0xc'),auth[_0xf4b0('0xa')](),controller[_0xf4b0('0x14')]);module[_0xf4b0('0x15')]=router; \ No newline at end of file +var _0x14b7=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/messages','post','create'];(function(_0x2cba72,_0x311d04){var _0x1c91d7=function(_0x54239d){while(--_0x54239d){_0x2cba72['push'](_0x2cba72['shift']());}};_0x1c91d7(++_0x311d04);}(_0x14b7,0x144));var _0x714b=function(_0x5754c1,_0x564a97){_0x5754c1=_0x5754c1-0x0;var _0x242cef=_0x14b7[_0x5754c1];return _0x242cef;};'use strict';var multer=require(_0x714b('0x0'));var util=require(_0x714b('0x1'));var path=require(_0x714b('0x2'));var timeout=require(_0x714b('0x3'));var express=require('express');var router=express[_0x714b('0x4')]();var fs_extra=require(_0x714b('0x5'));var auth=require(_0x714b('0x6'));var interaction=require(_0x714b('0x7'));var config=require(_0x714b('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x714b('0x9')](),controller[_0x714b('0xa')]);router[_0x714b('0xb')]('/:id',auth[_0x714b('0x9')](),controller[_0x714b('0xc')]);router[_0x714b('0xb')](_0x714b('0xd'),auth[_0x714b('0x9')](),controller['getMessages']);router[_0x714b('0xe')]('/',auth[_0x714b('0x9')](),controller[_0x714b('0xf')]);router['put'](_0x714b('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x714b('0x11')](_0x714b('0x10'),auth['isAuthenticated'](),controller[_0x714b('0x12')]);module[_0x714b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 09f8db8..1f54ff2 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['STRING','from-voicemail','contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports'];(function(_0x44dba1,_0x270ad5){var _0x2fbd3f=function(_0x5e0865){while(--_0x5e0865){_0x44dba1['push'](_0x44dba1['shift']());}};_0x2fbd3f(++_0x270ad5);}(_0xb688,0xcf));var _0x8b68=function(_0x5c4abf,_0x4cbf66){_0x5c4abf=_0x5c4abf-0x0;var _0x14a441=_0xb688[_0x5c4abf];return _0x14a441;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'customer_id':{'type':Sequelize[_0x8b68('0x1')]},'context':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x2'),'unique':_0x8b68('0x3')},'mailbox':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x8b68('0x1')]},'fullname':{'type':Sequelize[_0x8b68('0x1')]},'email':{'type':Sequelize[_0x8b68('0x1')],'validate':{'isEmail':!![]},'set':function(_0x12d40e){this['setDataValue'](_0x8b68('0x4'),typeof _0x12d40e==='string'&&_0x12d40e[_0x8b68('0x5')]()?_0x12d40e[_0x8b68('0x5')]():null);}},'pager':{'type':Sequelize[_0x8b68('0x1')]},'tz':{'type':Sequelize[_0x8b68('0x1')],'defaultValue':_0x8b68('0x6')},'attach':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8b68('0x1')]},'callback':{'type':Sequelize[_0x8b68('0x1')]},'review':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8b68('0x7')](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8b68('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8b68('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8b68('0x8'),'no'),'defaultValue':_0x8b68('0x8'),'allowNull':![]},'stamp':{'type':_0x8b68('0xa')},'emailsubject':{'type':Sequelize[_0x8b68('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8b68('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8b68('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8b68('0xc')](_0x8b68('0xd'))+_0x8b68('0xe')+this[_0x8b68('0xc')](_0x8b68('0xf'));}}}; \ No newline at end of file +var _0x13f6=['getDataValue','fullname','\x20-\x20','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0xf1a516,_0x4b7594){var _0x6792d2=function(_0x2bbdf1){while(--_0x2bbdf1){_0xf1a516['push'](_0xf1a516['shift']());}};_0x6792d2(++_0x4b7594);}(_0x13f6,0x124));var _0x613f=function(_0x1125d2,_0x4a49cb){_0x1125d2=_0x1125d2-0x0;var _0x3b1372=_0x13f6[_0x1125d2];return _0x3b1372;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x613f('0x2'),'unique':_0x613f('0x3')},'mailbox':{'type':Sequelize[_0x613f('0x4')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x613f('0x4')]},'fullname':{'type':Sequelize[_0x613f('0x4')]},'email':{'type':Sequelize[_0x613f('0x4')],'validate':{'isEmail':!![]},'set':function(_0x5c9aa9){this[_0x613f('0x5')](_0x613f('0x6'),typeof _0x5c9aa9==='string'&&_0x5c9aa9['trim']()?_0x5c9aa9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x613f('0x4')],'defaultValue':_0x613f('0x7')},'attach':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x613f('0x4')]},'review':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x613f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x613f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'stamp':{'type':_0x613f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x613f('0x4')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x613f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x613f('0xd')],'get':function(){return this[_0x613f('0xe')](_0x613f('0xf'))+_0x613f('0x10')+this[_0x613f('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2995a1c..924435e 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72bf=['query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','VoiceMail','includeAll','findAll','rows','catch','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','getMessages','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Voicemails','sendStatus','error','stack','name','send','render','merge','contact','message','agent','map','type','model'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x72bf,0x199));var _0xf72b=function(_0x1767dc,_0x4d27c8){_0x1767dc=_0x1767dc-0x0;var _0x2f0f7a=_0x72bf[_0x1767dc];return _0x2f0f7a;};'use strict';var emlformat=require(_0xf72b('0x0'));var rimraf=require(_0xf72b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf72b('0x2'));var rp=require(_0xf72b('0x3'));var moment=require('moment');var BPromise=require(_0xf72b('0x4'));var Mustache=require(_0xf72b('0x5'));var util=require(_0xf72b('0x6'));var path=require(_0xf72b('0x7'));var sox=require(_0xf72b('0x8'));var csv=require(_0xf72b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf72b('0xa'));var _=require(_0xf72b('0xb'));var squel=require('squel');var crypto=require(_0xf72b('0xc'));var jsforce=require(_0xf72b('0xd'));var deskjs=require(_0xf72b('0xe'));var toCsv=require(_0xf72b('0x9'));var querystring=require(_0xf72b('0xf'));var Papa=require(_0xf72b('0x10'));var Redis=require(_0xf72b('0x11'));var authService=require(_0xf72b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf72b('0x13'));var hardwareService=require(_0xf72b('0x14'));var logger=require(_0xf72b('0x15'))(_0xf72b('0x16'));var utils=require(_0xf72b('0x17'));var config=require(_0xf72b('0x18'));var licenseUtil=require(_0xf72b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8e9e00,_0x14867b){_0x14867b=_0x14867b||0xcc;return function(_0x130869){if(_0x130869){return _0x8e9e00['sendStatus'](_0x14867b);}return _0x8e9e00[_0xf72b('0x1a')](_0x14867b)[_0xf72b('0x1b')]();};}function respondWithResult(_0x5e2911,_0x4573e1){_0x4573e1=_0x4573e1||0xc8;return function(_0x2b6e1f){if(_0x2b6e1f){return _0x5e2911[_0xf72b('0x1a')](_0x4573e1)['json'](_0x2b6e1f);}};}function respondWithFilteredResult(_0x58b1e6,_0x5237f7){return function(_0x4b00df){if(_0x4b00df){var _0x13d717=typeof _0x5237f7[_0xf72b('0x1c')]===_0xf72b('0x1d')&&typeof _0x5237f7[_0xf72b('0x1e')]==='undefined';var _0x2e0e9e=_0x4b00df['count'];var _0x11d80e=_0x13d717?0x0:_0x5237f7['offset'];var _0x22ee12=_0x13d717?_0x4b00df[_0xf72b('0x1f')]:_0x5237f7[_0xf72b('0x1c')]+_0x5237f7[_0xf72b('0x1e')];var _0x3a6ed2;if(_0x22ee12>=_0x2e0e9e){_0x22ee12=_0x2e0e9e;_0x3a6ed2=0xc8;}else{_0x3a6ed2=0xce;}_0x58b1e6[_0xf72b('0x1a')](_0x3a6ed2);return _0x58b1e6[_0xf72b('0x20')](_0xf72b('0x21'),_0x11d80e+'-'+_0x22ee12+'/'+_0x2e0e9e)[_0xf72b('0x22')](_0x4b00df);}return null;};}function patchUpdates(_0x21019f){return function(_0x337af2){try{jsonpatch[_0xf72b('0x23')](_0x337af2,_0x21019f,!![]);}catch(_0x48cfb6){return BPromise[_0xf72b('0x24')](_0x48cfb6);}return _0x337af2[_0xf72b('0x25')]();};}function saveUpdates(_0x5d0494,_0x5df8ac){return function(_0x104229){if(_0x104229){return _0x104229[_0xf72b('0x26')](_0x5d0494)['then'](function(_0x3fdfea){return _0x3fdfea;});}return null;};}function removeEntity(_0x518cf1,_0xb3f82c){return function(_0x947e30){if(_0x947e30){return _0x947e30[_0xf72b('0x27')]()[_0xf72b('0x28')](function(){var _0x5f17f3=_0x947e30[_0xf72b('0x29')]({'plain':!![]});var _0x3bb8e3=_0xf72b('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x3bb8e3,'resourceId':_0x5f17f3['id']}})[_0xf72b('0x28')](function(){return _0x947e30;});})[_0xf72b('0x28')](function(){_0x518cf1[_0xf72b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1937e8,_0x1873a3){return function(_0xd0edda){if(!_0xd0edda){_0x1937e8[_0xf72b('0x2b')](0x194);}return _0xd0edda;};}function handleError(_0x2cf3d4,_0x4d037f){_0x4d037f=_0x4d037f||0x1f4;return function(_0x2ce1ac){logger[_0xf72b('0x2c')](_0x2ce1ac[_0xf72b('0x2d')]);if(_0x2ce1ac['name']){delete _0x2ce1ac[_0xf72b('0x2e')];}_0x2cf3d4[_0xf72b('0x1a')](_0x4d037f)[_0xf72b('0x2f')](_0x2ce1ac);};}function getMustacheRender(_0x4ae727,_0x4cad11){return Mustache[_0xf72b('0x30')](_0x4ae727,_[_0xf72b('0x31')](_0x4cad11['body'],{'contact':_0x4cad11[_0xf72b('0x32')],'message':_0x4cad11[_0xf72b('0x33')],'agent':_0x4cad11[_0xf72b('0x34')],'interaction':_0x4cad11['interaction'],'account':_0x4cad11['account']}))||'';}exports['index']=function(_0x2bea5b,_0x45797c){var _0x193f71={},_0x3155fc={},_0x2dd3e1={'count':0x0,'rows':[]};var _0x343835=_[_0xf72b('0x35')](db['VoiceMail']['rawAttributes'],function(_0x4bc66d){return{'name':_0x4bc66d['fieldName'],'type':_0x4bc66d[_0xf72b('0x36')]['key']};});_0x3155fc[_0xf72b('0x37')]=_[_0xf72b('0x35')](_0x343835,'name');_0x3155fc[_0xf72b('0x38')]=_[_0xf72b('0x39')](_0x2bea5b['query']);_0x3155fc[_0xf72b('0x3a')]=_[_0xf72b('0x3b')](_0x3155fc['model'],_0x3155fc[_0xf72b('0x38')]);_0x193f71['attributes']=_['intersection'](_0x3155fc[_0xf72b('0x37')],qs[_0xf72b('0x3c')](_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x3c')]));_0x193f71[_0xf72b('0x3d')]=_0x193f71['attributes']['length']?_0x193f71[_0xf72b('0x3d')]:_0x3155fc[_0xf72b('0x37')];if(!_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x3e')]('nolimit')){_0x193f71[_0xf72b('0x1e')]=qs[_0xf72b('0x1e')](_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x1e')]);_0x193f71[_0xf72b('0x1c')]=qs[_0xf72b('0x1c')](_0x2bea5b['query'][_0xf72b('0x1c')]);}_0x193f71[_0xf72b('0x3f')]=qs[_0xf72b('0x40')](_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x40')]);_0x193f71[_0xf72b('0x41')]=qs['filters'](_[_0xf72b('0x42')](_0x2bea5b[_0xf72b('0x38')],_0x3155fc['filters']),_0x343835);if(_0x2bea5b[_0xf72b('0x38')]['filter']){_0x193f71[_0xf72b('0x41')]=_[_0xf72b('0x31')](_0x193f71[_0xf72b('0x41')],{'$or':_[_0xf72b('0x35')](_0x343835,function(_0x5c13b5){if(_0x5c13b5[_0xf72b('0x36')]!==_0xf72b('0x43')){var _0x1b4273={};_0x1b4273[_0x5c13b5['name']]={'$like':'%'+_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x44')]+'%'};return _0x1b4273;}})});}_0x193f71=_[_0xf72b('0x31')]({},_0x193f71,_0x2bea5b[_0xf72b('0x45')]);var _0x4521de={'where':_0x193f71[_0xf72b('0x41')]};return db[_0xf72b('0x46')][_0xf72b('0x1f')](_0x4521de)[_0xf72b('0x28')](function(_0x4568d1){_0x2dd3e1['count']=_0x4568d1;if(_0x2bea5b[_0xf72b('0x38')][_0xf72b('0x47')]){_0x193f71['include']=[{'all':!![]}];}return db['VoiceMail'][_0xf72b('0x48')](_0x193f71);})[_0xf72b('0x28')](function(_0xdc8f31){_0x2dd3e1[_0xf72b('0x49')]=_0xdc8f31;return _0x2dd3e1;})[_0xf72b('0x28')](respondWithFilteredResult(_0x45797c,_0x193f71))[_0xf72b('0x4a')](handleError(_0x45797c,null));};exports[_0xf72b('0x4b')]=function(_0x30f135,_0x546c7d){var _0x1ac848={'raw':!![],'where':{'id':_0x30f135[_0xf72b('0x4c')]['id']}},_0x109d03={};_0x109d03['model']=_['keys'](db[_0xf72b('0x46')]['rawAttributes']);_0x109d03['query']=_[_0xf72b('0x39')](_0x30f135[_0xf72b('0x38')]);_0x109d03['filters']=_[_0xf72b('0x3b')](_0x109d03[_0xf72b('0x37')],_0x109d03[_0xf72b('0x38')]);_0x1ac848[_0xf72b('0x3d')]=_[_0xf72b('0x3b')](_0x109d03[_0xf72b('0x37')],qs[_0xf72b('0x3c')](_0x30f135[_0xf72b('0x38')][_0xf72b('0x3c')]));_0x1ac848[_0xf72b('0x3d')]=_0x1ac848[_0xf72b('0x3d')][_0xf72b('0x4d')]?_0x1ac848[_0xf72b('0x3d')]:_0x109d03['model'];if(_0x30f135[_0xf72b('0x38')][_0xf72b('0x47')]){_0x1ac848[_0xf72b('0x4e')]=[{'all':!![]}];}_0x1ac848=_[_0xf72b('0x31')]({},_0x1ac848,_0x30f135['options']);return db[_0xf72b('0x46')]['find'](_0x1ac848)[_0xf72b('0x28')](handleEntityNotFound(_0x546c7d,null))[_0xf72b('0x28')](respondWithResult(_0x546c7d,null))[_0xf72b('0x4a')](handleError(_0x546c7d,null));};exports[_0xf72b('0x4f')]=function(_0x44fa05,_0x39732f){return db[_0xf72b('0x46')][_0xf72b('0x4f')](_0x44fa05[_0xf72b('0x50')],{})['then'](function(_0x46b14a){var _0x467748=_0x44fa05[_0xf72b('0x51')]['get']({'plain':!![]});if(!_0x467748)throw new Error(_0xf72b('0x52'));if(_0x467748[_0xf72b('0x53')]===_0xf72b('0x51')){var _0x15cfbe=_0x46b14a[_0xf72b('0x29')]({'plain':!![]});var _0x36689c=_0xf72b('0x2a');return db[_0xf72b('0x54')][_0xf72b('0x55')]({'where':{'name':_0x36689c,'userProfileId':_0x467748[_0xf72b('0x56')]},'raw':!![]})['then'](function(_0x34f140){if(_0x34f140&&_0x34f140['autoAssociation']===0x0){return db[_0xf72b('0x57')]['create']({'name':_0x15cfbe[_0xf72b('0x2e')],'resourceId':_0x15cfbe['id'],'type':_0x34f140[_0xf72b('0x2e')],'sectionId':_0x34f140['id']},{})[_0xf72b('0x28')](function(){return _0x46b14a;});}else{return _0x46b14a;}})[_0xf72b('0x4a')](function(_0x3c6f57){logger[_0xf72b('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c6f57);throw _0x3c6f57;});}return _0x46b14a;})[_0xf72b('0x28')](respondWithResult(_0x39732f,0xc9))[_0xf72b('0x4a')](handleError(_0x39732f,null));};exports[_0xf72b('0x26')]=function(_0x9a35a,_0x2bf891){if(_0x9a35a['body']['id']){delete _0x9a35a[_0xf72b('0x50')]['id'];}return db[_0xf72b('0x46')][_0xf72b('0x55')]({'where':{'id':_0x9a35a[_0xf72b('0x4c')]['id']}})[_0xf72b('0x28')](handleEntityNotFound(_0x2bf891,null))[_0xf72b('0x28')](saveUpdates(_0x9a35a[_0xf72b('0x50')],null))[_0xf72b('0x28')](respondWithResult(_0x2bf891,null))['catch'](handleError(_0x2bf891,null));};exports['destroy']=function(_0x8b4f3e,_0x5dfdcf){return db[_0xf72b('0x46')][_0xf72b('0x55')]({'where':{'id':_0x8b4f3e[_0xf72b('0x4c')]['id']}})[_0xf72b('0x28')](handleEntityNotFound(_0x5dfdcf,null))['then'](removeEntity(_0x5dfdcf,null))[_0xf72b('0x4a')](handleError(_0x5dfdcf,null));};exports[_0xf72b('0x58')]=function(_0x142694,_0x2d7bff,_0x56312b){return db[_0xf72b('0x46')]['findOne']({'where':{'id':_0x142694[_0xf72b('0x4c')]['id']}})[_0xf72b('0x28')](handleEntityNotFound(_0x2d7bff,null))[_0xf72b('0x28')](function(_0x3294c4){var _0x108f9a;var _0x3bc03e={},_0x45557b={};_0x45557b[_0xf72b('0x37')]=_[_0xf72b('0x39')](db['VoiceMailMessage']['rawAttributes']);_0x45557b[_0xf72b('0x38')]=_[_0xf72b('0x39')](_0x142694['query']);_0x45557b[_0xf72b('0x3a')]=_['intersection'](_0x45557b['model'],_0x45557b[_0xf72b('0x38')]);_0x3bc03e[_0xf72b('0x3d')]=_[_0xf72b('0x3b')](_0x45557b['model'],qs[_0xf72b('0x3c')](_0x142694[_0xf72b('0x38')][_0xf72b('0x3c')]));_0x3bc03e['attributes']=_0x3bc03e[_0xf72b('0x3d')][_0xf72b('0x4d')]?_0x3bc03e[_0xf72b('0x3d')]:_0x45557b[_0xf72b('0x37')];if(!_0x142694[_0xf72b('0x38')][_0xf72b('0x3e')](_0xf72b('0x59'))){_0x3bc03e[_0xf72b('0x1e')]=qs[_0xf72b('0x1e')](_0x142694[_0xf72b('0x38')]['limit']);_0x3bc03e[_0xf72b('0x1c')]=qs[_0xf72b('0x1c')](_0x142694['query'][_0xf72b('0x1c')]);}_0x3bc03e[_0xf72b('0x3f')]=qs[_0xf72b('0x40')](_0x142694[_0xf72b('0x38')][_0xf72b('0x40')]);_0x3bc03e[_0xf72b('0x41')]=qs['filters'](_[_0xf72b('0x42')](_0x142694[_0xf72b('0x38')],_0x45557b[_0xf72b('0x3a')]));if(_0x142694['query'][_0xf72b('0x44')]){_0x3bc03e[_0xf72b('0x41')]=_[_0xf72b('0x31')](_0x3bc03e[_0xf72b('0x41')],{'$or':_['map'](_0x3bc03e[_0xf72b('0x3d')],function(_0x5e7078){var _0x535fe8={};_0x535fe8[_0x5e7078]={'$like':'%'+_0x142694[_0xf72b('0x38')][_0xf72b('0x44')]+'%'};return _0x535fe8;})});}_0x3bc03e[_0xf72b('0x41')]=_['merge'](_0x3bc03e[_0xf72b('0x41')],{'mailboxuser':_0x3294c4[_0xf72b('0x5a')]});_0x3bc03e=_['merge']({},_0x3bc03e,_0x142694[_0xf72b('0x45')]);return db[_0xf72b('0x5b')][_0xf72b('0x5c')](_0x3bc03e)[_0xf72b('0x28')](respondWithFilteredResult(_0x2d7bff,_0x3bc03e));})[_0xf72b('0x4a')](handleError(_0x2d7bff,null));}; \ No newline at end of file +var _0x3827=['key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','params','intersection','include','find','create','user','get','role','userProfileId','autoAssociation','UserProfileResource','update','findOne','VoiceMailMessage','hasOwnProperty','mailbox','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','then','Voicemails','destroy','sendStatus','error','name','render','merge','body','contact','message','agent','interaction','index','map','VoiceMail','rawAttributes','fieldName','type'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x3827,0xd0));var _0x7382=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x3827[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require(_0x7382('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7382('0x1'));var rp=require(_0x7382('0x2'));var moment=require(_0x7382('0x3'));var BPromise=require(_0x7382('0x4'));var Mustache=require(_0x7382('0x5'));var util=require(_0x7382('0x6'));var path=require('path');var sox=require(_0x7382('0x7'));var csv=require(_0x7382('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7382('0x9'));var _=require('lodash');var squel=require(_0x7382('0xa'));var crypto=require(_0x7382('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7382('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7382('0xd'));var Papa=require(_0x7382('0xe'));var Redis=require(_0x7382('0xf'));var authService=require(_0x7382('0x10'));var qs=require(_0x7382('0x11'));var as=require(_0x7382('0x12'));var hardwareService=require(_0x7382('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7382('0x14'));var config=require(_0x7382('0x15'));var licenseUtil=require(_0x7382('0x16'));var db=require(_0x7382('0x17'))['db'];function respondWithStatusCode(_0x81f03a,_0x51a729){_0x51a729=_0x51a729||0xcc;return function(_0x4cb011){if(_0x4cb011){return _0x81f03a['sendStatus'](_0x51a729);}return _0x81f03a[_0x7382('0x18')](_0x51a729)[_0x7382('0x19')]();};}function respondWithResult(_0x1d8cca,_0x3c600e){_0x3c600e=_0x3c600e||0xc8;return function(_0x7aa0a0){if(_0x7aa0a0){return _0x1d8cca[_0x7382('0x18')](_0x3c600e)['json'](_0x7aa0a0);}};}function respondWithFilteredResult(_0x3f3abd,_0x496afe){return function(_0x584d13){if(_0x584d13){var _0x143702=typeof _0x496afe[_0x7382('0x1a')]==='undefined'&&typeof _0x496afe[_0x7382('0x1b')]===_0x7382('0x1c');var _0x5a925e=_0x584d13['count'];var _0x1badb7=_0x143702?0x0:_0x496afe[_0x7382('0x1a')];var _0x8e79bc=_0x143702?_0x584d13[_0x7382('0x1d')]:_0x496afe[_0x7382('0x1a')]+_0x496afe[_0x7382('0x1b')];var _0x16a454;if(_0x8e79bc>=_0x5a925e){_0x8e79bc=_0x5a925e;_0x16a454=0xc8;}else{_0x16a454=0xce;}_0x3f3abd['status'](_0x16a454);return _0x3f3abd[_0x7382('0x1e')](_0x7382('0x1f'),_0x1badb7+'-'+_0x8e79bc+'/'+_0x5a925e)['json'](_0x584d13);}return null;};}function patchUpdates(_0x332d4d){return function(_0x4f8bc5){try{jsonpatch[_0x7382('0x20')](_0x4f8bc5,_0x332d4d,!![]);}catch(_0x4c4aec){return BPromise[_0x7382('0x21')](_0x4c4aec);}return _0x4f8bc5['save']();};}function saveUpdates(_0x5b7809,_0x1a574c){return function(_0xe276d1){if(_0xe276d1){return _0xe276d1['update'](_0x5b7809)['then'](function(_0x24dcf5){return _0x24dcf5;});}return null;};}function removeEntity(_0x596ff3,_0x10a2ef){return function(_0x2a5725){if(_0x2a5725){return _0x2a5725['destroy']()[_0x7382('0x22')](function(){var _0x3b6ec5=_0x2a5725['get']({'plain':!![]});var _0x1df771=_0x7382('0x23');return db['UserProfileResource'][_0x7382('0x24')]({'where':{'type':_0x1df771,'resourceId':_0x3b6ec5['id']}})[_0x7382('0x22')](function(){return _0x2a5725;});})[_0x7382('0x22')](function(){_0x596ff3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe788,_0x3893f8){return function(_0x4be213){if(!_0x4be213){_0x1fe788[_0x7382('0x25')](0x194);}return _0x4be213;};}function handleError(_0x4bcfe9,_0x18a5b2){_0x18a5b2=_0x18a5b2||0x1f4;return function(_0x13ee06){logger[_0x7382('0x26')](_0x13ee06['stack']);if(_0x13ee06[_0x7382('0x27')]){delete _0x13ee06['name'];}_0x4bcfe9[_0x7382('0x18')](_0x18a5b2)['send'](_0x13ee06);};}function getMustacheRender(_0x4b34a3,_0xde3689){return Mustache[_0x7382('0x28')](_0x4b34a3,_[_0x7382('0x29')](_0xde3689[_0x7382('0x2a')],{'contact':_0xde3689[_0x7382('0x2b')],'message':_0xde3689[_0x7382('0x2c')],'agent':_0xde3689[_0x7382('0x2d')],'interaction':_0xde3689[_0x7382('0x2e')],'account':_0xde3689['account']}))||'';}exports[_0x7382('0x2f')]=function(_0x43c81a,_0x19dc13){var _0x29bba2={},_0x331b70={},_0x222d7e={'count':0x0,'rows':[]};var _0x4940b3=_[_0x7382('0x30')](db[_0x7382('0x31')][_0x7382('0x32')],function(_0x114064){return{'name':_0x114064[_0x7382('0x33')],'type':_0x114064[_0x7382('0x34')][_0x7382('0x35')]};});_0x331b70[_0x7382('0x36')]=_['map'](_0x4940b3,_0x7382('0x27'));_0x331b70[_0x7382('0x37')]=_[_0x7382('0x38')](_0x43c81a['query']);_0x331b70[_0x7382('0x39')]=_['intersection'](_0x331b70[_0x7382('0x36')],_0x331b70[_0x7382('0x37')]);_0x29bba2[_0x7382('0x3a')]=_['intersection'](_0x331b70[_0x7382('0x36')],qs[_0x7382('0x3b')](_0x43c81a[_0x7382('0x37')]['fields']));_0x29bba2[_0x7382('0x3a')]=_0x29bba2['attributes'][_0x7382('0x3c')]?_0x29bba2[_0x7382('0x3a')]:_0x331b70[_0x7382('0x36')];if(!_0x43c81a[_0x7382('0x37')]['hasOwnProperty'](_0x7382('0x3d'))){_0x29bba2['limit']=qs['limit'](_0x43c81a['query'][_0x7382('0x1b')]);_0x29bba2[_0x7382('0x1a')]=qs[_0x7382('0x1a')](_0x43c81a[_0x7382('0x37')][_0x7382('0x1a')]);}_0x29bba2[_0x7382('0x3e')]=qs['sort'](_0x43c81a['query'][_0x7382('0x3f')]);_0x29bba2[_0x7382('0x40')]=qs[_0x7382('0x39')](_[_0x7382('0x41')](_0x43c81a['query'],_0x331b70[_0x7382('0x39')]),_0x4940b3);if(_0x43c81a[_0x7382('0x37')][_0x7382('0x42')]){_0x29bba2[_0x7382('0x40')]=_[_0x7382('0x29')](_0x29bba2[_0x7382('0x40')],{'$or':_[_0x7382('0x30')](_0x4940b3,function(_0x574546){if(_0x574546[_0x7382('0x34')]!==_0x7382('0x43')){var _0x39c6b6={};_0x39c6b6[_0x574546[_0x7382('0x27')]]={'$like':'%'+_0x43c81a[_0x7382('0x37')][_0x7382('0x42')]+'%'};return _0x39c6b6;}})});}_0x29bba2=_[_0x7382('0x29')]({},_0x29bba2,_0x43c81a[_0x7382('0x44')]);var _0x3162e2={'where':_0x29bba2['where']};return db[_0x7382('0x31')][_0x7382('0x1d')](_0x3162e2)[_0x7382('0x22')](function(_0xd3811b){_0x222d7e[_0x7382('0x1d')]=_0xd3811b;if(_0x43c81a[_0x7382('0x37')][_0x7382('0x45')]){_0x29bba2['include']=[{'all':!![]}];}return db[_0x7382('0x31')][_0x7382('0x46')](_0x29bba2);})[_0x7382('0x22')](function(_0x5b8503){_0x222d7e['rows']=_0x5b8503;return _0x222d7e;})[_0x7382('0x22')](respondWithFilteredResult(_0x19dc13,_0x29bba2))['catch'](handleError(_0x19dc13,null));};exports['show']=function(_0x5e9391,_0x2a0e97){var _0x29bc1c={'raw':!![],'where':{'id':_0x5e9391[_0x7382('0x47')]['id']}},_0x2e567d={};_0x2e567d[_0x7382('0x36')]=_['keys'](db[_0x7382('0x31')]['rawAttributes']);_0x2e567d[_0x7382('0x37')]=_[_0x7382('0x38')](_0x5e9391[_0x7382('0x37')]);_0x2e567d['filters']=_['intersection'](_0x2e567d['model'],_0x2e567d[_0x7382('0x37')]);_0x29bc1c[_0x7382('0x3a')]=_[_0x7382('0x48')](_0x2e567d[_0x7382('0x36')],qs[_0x7382('0x3b')](_0x5e9391[_0x7382('0x37')][_0x7382('0x3b')]));_0x29bc1c['attributes']=_0x29bc1c['attributes']['length']?_0x29bc1c[_0x7382('0x3a')]:_0x2e567d[_0x7382('0x36')];if(_0x5e9391['query'][_0x7382('0x45')]){_0x29bc1c[_0x7382('0x49')]=[{'all':!![]}];}_0x29bc1c=_[_0x7382('0x29')]({},_0x29bc1c,_0x5e9391[_0x7382('0x44')]);return db[_0x7382('0x31')][_0x7382('0x4a')](_0x29bc1c)[_0x7382('0x22')](handleEntityNotFound(_0x2a0e97,null))['then'](respondWithResult(_0x2a0e97,null))['catch'](handleError(_0x2a0e97,null));};exports[_0x7382('0x4b')]=function(_0x31fd2b,_0x2c908e){return db['VoiceMail'][_0x7382('0x4b')](_0x31fd2b[_0x7382('0x2a')],{})[_0x7382('0x22')](function(_0x24ee8d){var _0x14aff8=_0x31fd2b[_0x7382('0x4c')][_0x7382('0x4d')]({'plain':!![]});if(!_0x14aff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14aff8[_0x7382('0x4e')]==='user'){var _0x4a53b6=_0x24ee8d['get']({'plain':!![]});var _0x275fdc='Voicemails';return db['UserProfileSection'][_0x7382('0x4a')]({'where':{'name':_0x275fdc,'userProfileId':_0x14aff8[_0x7382('0x4f')]},'raw':!![]})[_0x7382('0x22')](function(_0x7219fe){if(_0x7219fe&&_0x7219fe[_0x7382('0x50')]===0x0){return db[_0x7382('0x51')]['create']({'name':_0x4a53b6[_0x7382('0x27')],'resourceId':_0x4a53b6['id'],'type':_0x7219fe[_0x7382('0x27')],'sectionId':_0x7219fe['id']},{})[_0x7382('0x22')](function(){return _0x24ee8d;});}else{return _0x24ee8d;}})['catch'](function(_0x5a0373){logger[_0x7382('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a0373);throw _0x5a0373;});}return _0x24ee8d;})[_0x7382('0x22')](respondWithResult(_0x2c908e,0xc9))['catch'](handleError(_0x2c908e,null));};exports[_0x7382('0x52')]=function(_0x1ca5c4,_0x28651f){if(_0x1ca5c4[_0x7382('0x2a')]['id']){delete _0x1ca5c4[_0x7382('0x2a')]['id'];}return db[_0x7382('0x31')][_0x7382('0x4a')]({'where':{'id':_0x1ca5c4[_0x7382('0x47')]['id']}})[_0x7382('0x22')](handleEntityNotFound(_0x28651f,null))[_0x7382('0x22')](saveUpdates(_0x1ca5c4[_0x7382('0x2a')],null))[_0x7382('0x22')](respondWithResult(_0x28651f,null))['catch'](handleError(_0x28651f,null));};exports[_0x7382('0x24')]=function(_0x2abc7f,_0xfcd95e){return db[_0x7382('0x31')]['find']({'where':{'id':_0x2abc7f[_0x7382('0x47')]['id']}})[_0x7382('0x22')](handleEntityNotFound(_0xfcd95e,null))[_0x7382('0x22')](removeEntity(_0xfcd95e,null))['catch'](handleError(_0xfcd95e,null));};exports['getMessages']=function(_0xb65105,_0x2df576,_0x47fdcd){return db['VoiceMail'][_0x7382('0x53')]({'where':{'id':_0xb65105[_0x7382('0x47')]['id']}})['then'](handleEntityNotFound(_0x2df576,null))[_0x7382('0x22')](function(_0x32400d){var _0x40b779;var _0x332e72={},_0xaae2f2={};_0xaae2f2['model']=_['keys'](db[_0x7382('0x54')][_0x7382('0x32')]);_0xaae2f2[_0x7382('0x37')]=_[_0x7382('0x38')](_0xb65105[_0x7382('0x37')]);_0xaae2f2[_0x7382('0x39')]=_['intersection'](_0xaae2f2[_0x7382('0x36')],_0xaae2f2[_0x7382('0x37')]);_0x332e72[_0x7382('0x3a')]=_[_0x7382('0x48')](_0xaae2f2[_0x7382('0x36')],qs[_0x7382('0x3b')](_0xb65105['query']['fields']));_0x332e72['attributes']=_0x332e72['attributes'][_0x7382('0x3c')]?_0x332e72['attributes']:_0xaae2f2[_0x7382('0x36')];if(!_0xb65105[_0x7382('0x37')][_0x7382('0x55')](_0x7382('0x3d'))){_0x332e72[_0x7382('0x1b')]=qs[_0x7382('0x1b')](_0xb65105[_0x7382('0x37')][_0x7382('0x1b')]);_0x332e72[_0x7382('0x1a')]=qs[_0x7382('0x1a')](_0xb65105['query'][_0x7382('0x1a')]);}_0x332e72[_0x7382('0x3e')]=qs[_0x7382('0x3f')](_0xb65105[_0x7382('0x37')][_0x7382('0x3f')]);_0x332e72[_0x7382('0x40')]=qs[_0x7382('0x39')](_[_0x7382('0x41')](_0xb65105[_0x7382('0x37')],_0xaae2f2[_0x7382('0x39')]));if(_0xb65105[_0x7382('0x37')][_0x7382('0x42')]){_0x332e72[_0x7382('0x40')]=_[_0x7382('0x29')](_0x332e72[_0x7382('0x40')],{'$or':_[_0x7382('0x30')](_0x332e72[_0x7382('0x3a')],function(_0xc7b12b){var _0x909a41={};_0x909a41[_0xc7b12b]={'$like':'%'+_0xb65105[_0x7382('0x37')][_0x7382('0x42')]+'%'};return _0x909a41;})});}_0x332e72[_0x7382('0x40')]=_['merge'](_0x332e72['where'],{'mailboxuser':_0x32400d[_0x7382('0x56')]});_0x332e72=_['merge']({},_0x332e72,_0xb65105['options']);return db[_0x7382('0x54')]['findAndCountAll'](_0x332e72)[_0x7382('0x22')](respondWithFilteredResult(_0x2df576,_0x332e72));})['catch'](handleError(_0x2df576,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d7b752d..206fbec 100644 --- a/server/api/voiceMail/voiceMail.model.js +++ b/server/api/voiceMail/voiceMail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd250=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x43d69d,_0x5b4551){var _0x237952=function(_0x89bea){while(--_0x89bea){_0x43d69d['push'](_0x43d69d['shift']());}};_0x237952(++_0x5b4551);}(_0xd250,0x70));var _0x0d25=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0xd250[_0x1795df];return _0x3f13c0;};'use strict';var _=require(_0x0d25('0x0'));var util=require(_0x0d25('0x1'));var logger=require(_0x0d25('0x2'))(_0x0d25('0x3'));var moment=require(_0x0d25('0x4'));var BPromise=require(_0x0d25('0x5'));var rp=require(_0x0d25('0x6'));var fs=require('fs');var path=require(_0x0d25('0x7'));var rimraf=require(_0x0d25('0x8'));var config=require(_0x0d25('0x9'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x43a28d,_0x2bcbe8){return _0x43a28d[_0x0d25('0xa')](_0x0d25('0xb'),attributes,{'tableName':_0x0d25('0xc'),'paranoid':![],'indexes':[{'name':_0x0d25('0xd'),'fields':[_0x0d25('0xe'),_0x0d25('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe07e=['../../config/environment','./voiceMail.attributes','exports','voice_voicemail','mailbox_context','mailbox','context','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xe07e,0xa3));var _0xee07=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0xe07e[_0x46401e];return _0x447cba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee07('0x0'))(_0xee07('0x1'));var moment=require(_0xee07('0x2'));var BPromise=require(_0xee07('0x3'));var rp=require(_0xee07('0x4'));var fs=require('fs');var path=require(_0xee07('0x5'));var rimraf=require('rimraf');var config=require(_0xee07('0x6'));var attributes=require(_0xee07('0x7'));module[_0xee07('0x8')]=function(_0x154030,_0x7b75be){return _0x154030['define']('VoiceMail',attributes,{'tableName':_0xee07('0x9'),'paranoid':![],'indexes':[{'name':_0xee07('0xa'),'fields':[_0xee07('0xb'),_0xee07('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1567243..e707f2a 100644 --- a/server/api/voiceMail/voiceMail.rpc.js +++ b/server/api/voiceMail/voiceMail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf68b=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39d3a7,_0x17127e){var _0x2203bd=function(_0x294502){while(--_0x294502){_0x39d3a7['push'](_0x39d3a7['shift']());}};_0x2203bd(++_0x17127e);}(_0xf68b,0xd1));var _0xbf68=function(_0x5e1378,_0x12f94e){_0x5e1378=_0x5e1378-0x0;var _0x1a4b11=_0xf68b[_0x5e1378];return _0x1a4b11;};'use strict';var _=require(_0xbf68('0x0'));var util=require(_0xbf68('0x1'));var moment=require(_0xbf68('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf68('0x3'));var fs=require('fs');var Redis=require(_0xbf68('0x4'));var db=require(_0xbf68('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf68('0x6'));var config=require(_0xbf68('0x7'));var jayson=require(_0xbf68('0x8'));var client=jayson[_0xbf68('0x9')][_0xbf68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bdbad,_0x63cd7c,_0x433e75){return new BPromise(function(_0x4efa92,_0x222cb4){return client['request'](_0x2bdbad,_0x433e75)['then'](function(_0x4c935d){logger['info'](_0xbf68('0xb'),_0x63cd7c,_0xbf68('0xc'));logger[_0xbf68('0xd')](_0xbf68('0xe'),_0x63cd7c,_0xbf68('0xc'),JSON[_0xbf68('0xf')](_0x4c935d));if(_0x4c935d[_0xbf68('0x10')]){if(_0x4c935d[_0xbf68('0x10')][_0xbf68('0x11')]===0x1f4){logger[_0xbf68('0x10')]('VoiceMail,\x20%s,\x20%s',_0x63cd7c,_0x4c935d[_0xbf68('0x10')]['message']);return _0x222cb4(_0x4c935d[_0xbf68('0x10')][_0xbf68('0x12')]);}logger[_0xbf68('0x10')]('VoiceMail,\x20%s,\x20%s',_0x63cd7c,_0x4c935d[_0xbf68('0x10')][_0xbf68('0x12')]);return _0x4efa92(_0x4c935d[_0xbf68('0x10')]['message']);}else{logger[_0xbf68('0x13')](_0xbf68('0xb'),_0x63cd7c,'request\x20sent');_0x4efa92(_0x4c935d[_0xbf68('0x14')][_0xbf68('0x12')]);}})[_0xbf68('0x15')](function(_0x304879){logger['error'](_0xbf68('0xb'),_0x63cd7c,_0x304879);_0x222cb4(_0x304879);});});} \ No newline at end of file +var _0x1a85=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x6669e1,_0xc56430){var _0x11c3f0=function(_0x54fd69){while(--_0x54fd69){_0x6669e1['push'](_0x6669e1['shift']());}};_0x11c3f0(++_0xc56430);}(_0x1a85,0x19e));var _0x51a8=function(_0x165082,_0x207ae8){_0x165082=_0x165082-0x0;var _0x21989b=_0x1a85[_0x165082];return _0x21989b;};'use strict';var _=require(_0x51a8('0x0'));var util=require(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require(_0x51a8('0x3'));var rs=require(_0x51a8('0x4'));var fs=require('fs');var Redis=require(_0x51a8('0x5'));var db=require(_0x51a8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x51a8('0x7'))(_0x51a8('0x8'));var config=require(_0x51a8('0x9'));var jayson=require(_0x51a8('0xa'));var client=jayson[_0x51a8('0xb')][_0x51a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x421f87,_0x1d25f4,_0x13ef05){return new BPromise(function(_0x367f93,_0x71dd8a){return client[_0x51a8('0xd')](_0x421f87,_0x13ef05)[_0x51a8('0xe')](function(_0x3c66da){logger[_0x51a8('0xf')](_0x51a8('0x10'),_0x1d25f4,_0x51a8('0x11'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1d25f4,'request\x20sent',JSON['stringify'](_0x3c66da));if(_0x3c66da[_0x51a8('0x12')]){if(_0x3c66da[_0x51a8('0x12')][_0x51a8('0x13')]===0x1f4){logger['error'](_0x51a8('0x10'),_0x1d25f4,_0x3c66da[_0x51a8('0x12')][_0x51a8('0x14')]);return _0x71dd8a(_0x3c66da[_0x51a8('0x12')][_0x51a8('0x14')]);}logger[_0x51a8('0x12')](_0x51a8('0x10'),_0x1d25f4,_0x3c66da['error'][_0x51a8('0x14')]);return _0x367f93(_0x3c66da['error'][_0x51a8('0x14')]);}else{logger[_0x51a8('0xf')](_0x51a8('0x10'),_0x1d25f4,_0x51a8('0x11'));_0x367f93(_0x3c66da['result']['message']);}})[_0x51a8('0x15')](function(_0x3423a0){logger['error'](_0x51a8('0x10'),_0x1d25f4,_0x3423a0);_0x71dd8a(_0x3423a0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index b50c73a..9771049 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e60=['get','index','isAuthenticated','show','/:id/download','download','post','create','put','/:id','delete','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4ee89a,_0x56d642){var _0x42aca9=function(_0xa1f425){while(--_0xa1f425){_0x4ee89a['push'](_0x4ee89a['shift']());}};_0x42aca9(++_0x56d642);}(_0x2e60,0x10a));var _0x02e6=function(_0x3df600,_0x3350eb){_0x3df600=_0x3df600-0x0;var _0x59ed94=_0x2e60[_0x3df600];return _0x59ed94;};'use strict';var multer=require('multer');var util=require(_0x02e6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02e6('0x1'));var router=express['Router']();var fs_extra=require(_0x02e6('0x2'));var auth=require(_0x02e6('0x3'));var interaction=require(_0x02e6('0x4'));var config=require(_0x02e6('0x5'));var controller=require('./voiceMailMessage.controller');router[_0x02e6('0x6')]('/',auth['isAuthenticated'](),controller[_0x02e6('0x7')]);router[_0x02e6('0x6')]('/:id',auth[_0x02e6('0x8')](),controller[_0x02e6('0x9')]);router[_0x02e6('0x6')](_0x02e6('0xa'),auth[_0x02e6('0x8')](),controller[_0x02e6('0xb')]);router[_0x02e6('0xc')]('/',auth[_0x02e6('0x8')](),controller[_0x02e6('0xd')]);router[_0x02e6('0xe')](_0x02e6('0xf'),auth[_0x02e6('0x8')](),controller['update']);router[_0x02e6('0x10')]('/:id',auth[_0x02e6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19d1=['Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','download','post','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x19d1,0x6d));var _0x119d=function(_0x1884ec,_0x3fd0e6){_0x1884ec=_0x1884ec-0x0;var _0x35e212=_0x19d1[_0x1884ec];return _0x35e212;};'use strict';var multer=require(_0x119d('0x0'));var util=require(_0x119d('0x1'));var path=require(_0x119d('0x2'));var timeout=require(_0x119d('0x3'));var express=require(_0x119d('0x4'));var router=express[_0x119d('0x5')]();var fs_extra=require(_0x119d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x119d('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x119d('0x8')]('/',auth[_0x119d('0x9')](),controller[_0x119d('0xa')]);router[_0x119d('0x8')](_0x119d('0xb'),auth[_0x119d('0x9')](),controller[_0x119d('0xc')]);router['get']('/:id/download',auth[_0x119d('0x9')](),controller[_0x119d('0xd')]);router[_0x119d('0xe')]('/',auth['isAuthenticated'](),controller[_0x119d('0xf')]);router[_0x119d('0x10')](_0x119d('0xb'),auth[_0x119d('0x9')](),controller[_0x119d('0x11')]);router['delete'](_0x119d('0xb'),auth[_0x119d('0x9')](),controller['destroy']);module[_0x119d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8028a72..66c88c8 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.attributes.js +++ b/server/api/voiceMailMessage/voiceMailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5aae=['STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x424daf,_0x3e0500){var _0x191079=function(_0x4b0cc5){while(--_0x4b0cc5){_0x424daf['push'](_0x424daf['shift']());}};_0x191079(++_0x3e0500);}(_0x5aae,0xdc));var _0xe5aa=function(_0xdc5664,_0x4eef5a){_0xdc5664=_0xdc5664-0x0;var _0xd65a92=_0x5aae[_0xdc5664];return _0xd65a92;};'use strict';var Sequelize=require(_0xe5aa('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5aa('0x1')],'get':function(_0xe818ab){return this[_0xe5aa('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xe5aa('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xe5aa('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe5aa('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xe5aa('0x6')](_0xe5aa('0x7'))}}; \ No newline at end of file +var _0xdcd6=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xdcd6,0x113));var _0x6dcd=function(_0x52213a,_0x43f6bd){_0x52213a=_0x52213a-0x0;var _0x3d7c7f=_0xdcd6[_0x52213a];return _0x3d7c7f;};'use strict';var Sequelize=require(_0x6dcd('0x0'));module[_0x6dcd('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x267913){return this[_0x6dcd('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6dcd('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x6dcd('0x5')](_0x6dcd('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6dcd('0x4')],'defaultValue':''},'stamp':{'type':_0x6dcd('0x7'),'defaultValue':Sequelize[_0x6dcd('0x8')](_0x6dcd('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3803867..68bbf0a 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.controller.js +++ b/server/api/voiceMailMessage/voiceMailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c03=['hasOwnProperty','nolimit','order','sort','where','pick','filter','then','includeAll','rows','catch','params','keys','include','options','find','create','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','error','name','send','merge','body','contact','message','agent','interaction','account','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','length'];(function(_0x506d2b,_0x51eba7){var _0x1198da=function(_0xa1c688){while(--_0xa1c688){_0x506d2b['push'](_0x506d2b['shift']());}};_0x1198da(++_0x51eba7);}(_0x8c03,0x6f));var _0x38c0=function(_0x409380,_0x46d2c4){_0x409380=_0x409380-0x0;var _0x4400dd=_0x8c03[_0x409380];return _0x4400dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38c0('0x0'));var zipdir=require(_0x38c0('0x1'));var jsonpatch=require(_0x38c0('0x2'));var rp=require(_0x38c0('0x3'));var moment=require(_0x38c0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x38c0('0x5'));var path=require(_0x38c0('0x6'));var sox=require('sox');var csv=require(_0x38c0('0x7'));var ejs=require(_0x38c0('0x8'));var fs=require('fs');var fs_extra=require(_0x38c0('0x9'));var _=require(_0x38c0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38c0('0xb'));var deskjs=require(_0x38c0('0xc'));var toCsv=require(_0x38c0('0x7'));var querystring=require('querystring');var Papa=require(_0x38c0('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x38c0('0xe'));var as=require(_0x38c0('0xf'));var hardwareService=require(_0x38c0('0x10'));var logger=require(_0x38c0('0x11'))(_0x38c0('0x12'));var utils=require('../../config/utils');var config=require(_0x38c0('0x13'));var licenseUtil=require(_0x38c0('0x14'));var db=require(_0x38c0('0x15'))['db'];function respondWithStatusCode(_0x11a884,_0x10dab7){_0x10dab7=_0x10dab7||0xcc;return function(_0x34881c){if(_0x34881c){return _0x11a884[_0x38c0('0x16')](_0x10dab7);}return _0x11a884[_0x38c0('0x17')](_0x10dab7)[_0x38c0('0x18')]();};}function respondWithResult(_0x2e288c,_0x11efa2){_0x11efa2=_0x11efa2||0xc8;return function(_0x219175){if(_0x219175){return _0x2e288c[_0x38c0('0x17')](_0x11efa2)[_0x38c0('0x19')](_0x219175);}};}function respondWithFilteredResult(_0x2ff3fd,_0x32f5ae){return function(_0x4d316d){if(_0x4d316d){var _0x5ac99f=typeof _0x32f5ae[_0x38c0('0x1a')]==='undefined'&&typeof _0x32f5ae[_0x38c0('0x1b')]===_0x38c0('0x1c');var _0x38af09=_0x4d316d[_0x38c0('0x1d')];var _0x86fe8b=_0x5ac99f?0x0:_0x32f5ae[_0x38c0('0x1a')];var _0x2a5bcf=_0x5ac99f?_0x4d316d[_0x38c0('0x1d')]:_0x32f5ae[_0x38c0('0x1a')]+_0x32f5ae['limit'];var _0x190bed;if(_0x2a5bcf>=_0x38af09){_0x2a5bcf=_0x38af09;_0x190bed=0xc8;}else{_0x190bed=0xce;}_0x2ff3fd[_0x38c0('0x17')](_0x190bed);return _0x2ff3fd[_0x38c0('0x1e')](_0x38c0('0x1f'),_0x86fe8b+'-'+_0x2a5bcf+'/'+_0x38af09)[_0x38c0('0x19')](_0x4d316d);}return null;};}function patchUpdates(_0x287133){return function(_0x2c0d1e){try{jsonpatch['apply'](_0x2c0d1e,_0x287133,!![]);}catch(_0x8cba1d){return BPromise[_0x38c0('0x20')](_0x8cba1d);}return _0x2c0d1e[_0x38c0('0x21')]();};}function saveUpdates(_0x3cf0b0,_0x33ff72){return function(_0x580567){if(_0x580567){return _0x580567[_0x38c0('0x22')](_0x3cf0b0)['then'](function(_0x315b94){return _0x315b94;});}return null;};}function removeEntity(_0x43fc9b,_0x4d54aa){return function(_0x1161af){if(_0x1161af){return _0x1161af[_0x38c0('0x23')]()['then'](function(){_0x43fc9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54ac5c,_0x2361d1){return function(_0x4c3ce1){if(!_0x4c3ce1){_0x54ac5c[_0x38c0('0x16')](0x194);}return _0x4c3ce1;};}function handleError(_0x57d2c4,_0x7184dd){_0x7184dd=_0x7184dd||0x1f4;return function(_0x535c4a){logger[_0x38c0('0x24')](_0x535c4a['stack']);if(_0x535c4a[_0x38c0('0x25')]){delete _0x535c4a['name'];}_0x57d2c4[_0x38c0('0x17')](_0x7184dd)[_0x38c0('0x26')](_0x535c4a);};}function getMustacheRender(_0x515521,_0x43f5be){return Mustache['render'](_0x515521,_[_0x38c0('0x27')](_0x43f5be[_0x38c0('0x28')],{'contact':_0x43f5be[_0x38c0('0x29')],'message':_0x43f5be[_0x38c0('0x2a')],'agent':_0x43f5be[_0x38c0('0x2b')],'interaction':_0x43f5be[_0x38c0('0x2c')],'account':_0x43f5be[_0x38c0('0x2d')]}))||'';}exports['index']=function(_0x1f9b6f,_0x3e8aa6){var _0x1ab26a={},_0x3cfcd9={},_0x5ca005={'count':0x0,'rows':[]};var _0x21265b=_[_0x38c0('0x2e')](db[_0x38c0('0x2f')][_0x38c0('0x30')],function(_0x1c1ff4){return{'name':_0x1c1ff4[_0x38c0('0x31')],'type':_0x1c1ff4[_0x38c0('0x32')]['key']};});_0x3cfcd9[_0x38c0('0x33')]=_[_0x38c0('0x34')](_[_0x38c0('0x2e')](_0x21265b,_0x38c0('0x25')),[_0x38c0('0x25')]);_0x3cfcd9[_0x38c0('0x35')]=_['keys'](_0x1f9b6f[_0x38c0('0x35')]);_0x3cfcd9[_0x38c0('0x36')]=_[_0x38c0('0x37')](_0x3cfcd9['model'],_0x3cfcd9[_0x38c0('0x35')]);_0x1ab26a[_0x38c0('0x38')]=_[_0x38c0('0x37')](_0x3cfcd9[_0x38c0('0x33')],qs['fields'](_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x39')]));_0x1ab26a[_0x38c0('0x38')]=_0x1ab26a['attributes'][_0x38c0('0x3a')]?_0x1ab26a['attributes']:_0x3cfcd9['model'];if(!_0x1f9b6f['query'][_0x38c0('0x3b')](_0x38c0('0x3c'))){_0x1ab26a[_0x38c0('0x1b')]=qs[_0x38c0('0x1b')](_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x1b')]);_0x1ab26a[_0x38c0('0x1a')]=qs[_0x38c0('0x1a')](_0x1f9b6f[_0x38c0('0x35')]['offset']);}_0x1ab26a[_0x38c0('0x3d')]=qs[_0x38c0('0x3e')](_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x3e')]);_0x1ab26a[_0x38c0('0x3f')]=qs[_0x38c0('0x36')](_[_0x38c0('0x40')](_0x1f9b6f[_0x38c0('0x35')],_0x3cfcd9['filters']),_0x21265b);if(_0x1f9b6f[_0x38c0('0x35')]['filter']){_0x1ab26a['where']=_[_0x38c0('0x27')](_0x1ab26a[_0x38c0('0x3f')],{'$or':_[_0x38c0('0x2e')](_0x21265b,function(_0x19ba6c){if(_0x19ba6c[_0x38c0('0x32')]!=='VIRTUAL'){var _0x2d0fd4={};_0x2d0fd4[_0x19ba6c[_0x38c0('0x25')]]={'$like':'%'+_0x1f9b6f[_0x38c0('0x35')][_0x38c0('0x41')]+'%'};return _0x2d0fd4;}})});}_0x1ab26a=_[_0x38c0('0x27')]({},_0x1ab26a,_0x1f9b6f['options']);var _0x29d313={'where':_0x1ab26a['where']};return db[_0x38c0('0x2f')]['count'](_0x29d313)[_0x38c0('0x42')](function(_0x533c91){_0x5ca005[_0x38c0('0x1d')]=_0x533c91;if(_0x1f9b6f['query'][_0x38c0('0x43')]){_0x1ab26a['include']=[{'all':!![]}];}return db[_0x38c0('0x2f')]['findAll'](_0x1ab26a);})[_0x38c0('0x42')](function(_0x4412c4){_0x5ca005[_0x38c0('0x44')]=_0x4412c4;return _0x5ca005;})[_0x38c0('0x42')](respondWithFilteredResult(_0x3e8aa6,_0x1ab26a))[_0x38c0('0x45')](handleError(_0x3e8aa6,null));};exports['show']=function(_0x11c248,_0x318c3e){var _0xbc5600={'raw':!![],'where':{'id':_0x11c248[_0x38c0('0x46')]['id']}},_0xc55416={};_0xc55416['model']=_[_0x38c0('0x47')](db[_0x38c0('0x2f')][_0x38c0('0x30')]);_0xc55416[_0x38c0('0x35')]=_['keys'](_0x11c248[_0x38c0('0x35')]);_0xc55416[_0x38c0('0x36')]=_[_0x38c0('0x37')](_0xc55416['model'],_0xc55416[_0x38c0('0x35')]);_0xbc5600[_0x38c0('0x38')]=_['intersection'](_0xc55416[_0x38c0('0x33')],qs[_0x38c0('0x39')](_0x11c248[_0x38c0('0x35')][_0x38c0('0x39')]));_0xbc5600['attributes']=_0xbc5600[_0x38c0('0x38')][_0x38c0('0x3a')]?_0xbc5600[_0x38c0('0x38')]:_0xc55416['model'];if(_0x11c248[_0x38c0('0x35')]['includeAll']){_0xbc5600[_0x38c0('0x48')]=[{'all':!![]}];}_0xbc5600=_[_0x38c0('0x27')]({},_0xbc5600,_0x11c248[_0x38c0('0x49')]);return db[_0x38c0('0x2f')][_0x38c0('0x4a')](_0xbc5600)['then'](handleEntityNotFound(_0x318c3e,null))[_0x38c0('0x42')](respondWithResult(_0x318c3e,null))[_0x38c0('0x45')](handleError(_0x318c3e,null));};exports[_0x38c0('0x4b')]=function(_0x31d1b8,_0x5a24d6){return db['VoiceMailMessage'][_0x38c0('0x4b')](_0x31d1b8['body'],{})[_0x38c0('0x42')](respondWithResult(_0x5a24d6,0xc9))[_0x38c0('0x45')](handleError(_0x5a24d6,null));};exports[_0x38c0('0x22')]=function(_0x595d1d,_0x43013b){if(_0x595d1d[_0x38c0('0x28')]['id']){delete _0x595d1d['body']['id'];}return db[_0x38c0('0x2f')]['find']({'where':{'id':_0x595d1d[_0x38c0('0x46')]['id']}})[_0x38c0('0x42')](handleEntityNotFound(_0x43013b,null))[_0x38c0('0x42')](saveUpdates(_0x595d1d[_0x38c0('0x28')],null))[_0x38c0('0x42')](respondWithResult(_0x43013b,null))['catch'](handleError(_0x43013b,null));};exports[_0x38c0('0x23')]=function(_0x43135d,_0x4120e6){return db[_0x38c0('0x2f')]['find']({'where':{'id':_0x43135d[_0x38c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x4120e6,null))['then'](removeEntity(_0x4120e6,null))['catch'](handleError(_0x4120e6,null));};exports[_0x38c0('0x4c')]=function(_0x193829,_0x5e0ab8,_0x5c4fee){return db[_0x38c0('0x2f')]['find']({'where':{'id':_0x193829[_0x38c0('0x46')]['id']},'attributes':['id',_0x38c0('0x4d'),_0x38c0('0x4e')]})['then'](handleEntityNotFound(_0x5e0ab8,null))[_0x38c0('0x42')](function(_0x5353b8){if(_0x5353b8){if(!_0x5353b8[_0x38c0('0x4d')]){throw new db[(_0x38c0('0x4f'))][(_0x38c0('0x50'))](_0x38c0('0x51'));}var _0x33a875={'Content-Type':_0x38c0('0x52'),'Content-Disposition':'attachment'};if(_0x5353b8[_0x38c0('0x4e')]){_0x33a875['Content-Disposition']=_0x38c0('0x53')+_0x5353b8[_0x38c0('0x4e')]+_0x38c0('0x54');}_0x5e0ab8[_0x38c0('0x1e')](_0x33a875);return _0x5e0ab8['send'](new Buffer(_0x5353b8[_0x38c0('0x4d')]));}})['catch'](handleError(_0x5e0ab8,null));}; \ No newline at end of file +var _0x04f1=['rows','catch','show','params','fields','includeAll','find','create','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','merge','body','contact','interaction','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','name','query','keys','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','include','findAll'];(function(_0x4a18f5,_0x4e2b1e){var _0x4035d6=function(_0x21c2ef){while(--_0x21c2ef){_0x4a18f5['push'](_0x4a18f5['shift']());}};_0x4035d6(++_0x4e2b1e);}(_0x04f1,0xc4));var _0x104f=function(_0x1f7962,_0x181f16){_0x1f7962=_0x1f7962-0x0;var _0x3af491=_0x04f1[_0x1f7962];return _0x3af491;};'use strict';var emlformat=require(_0x104f('0x0'));var rimraf=require(_0x104f('0x1'));var zipdir=require(_0x104f('0x2'));var jsonpatch=require(_0x104f('0x3'));var rp=require(_0x104f('0x4'));var moment=require(_0x104f('0x5'));var BPromise=require(_0x104f('0x6'));var Mustache=require(_0x104f('0x7'));var util=require(_0x104f('0x8'));var path=require(_0x104f('0x9'));var sox=require(_0x104f('0xa'));var csv=require(_0x104f('0xb'));var ejs=require(_0x104f('0xc'));var fs=require('fs');var fs_extra=require(_0x104f('0xd'));var _=require(_0x104f('0xe'));var squel=require(_0x104f('0xf'));var crypto=require(_0x104f('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x104f('0xb'));var querystring=require(_0x104f('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x104f('0x12'));var qs=require(_0x104f('0x13'));var as=require(_0x104f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x104f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x104f('0x16'));var licenseUtil=require(_0x104f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x153131,_0x5bb774){_0x5bb774=_0x5bb774||0xcc;return function(_0x4740b){if(_0x4740b){return _0x153131[_0x104f('0x18')](_0x5bb774);}return _0x153131[_0x104f('0x19')](_0x5bb774)[_0x104f('0x1a')]();};}function respondWithResult(_0x3340ce,_0x1fa6f4){_0x1fa6f4=_0x1fa6f4||0xc8;return function(_0x3c81c5){if(_0x3c81c5){return _0x3340ce[_0x104f('0x19')](_0x1fa6f4)[_0x104f('0x1b')](_0x3c81c5);}};}function respondWithFilteredResult(_0x5c4439,_0x46d505){return function(_0x5979a6){if(_0x5979a6){var _0x9e13ef=typeof _0x46d505['offset']===_0x104f('0x1c')&&typeof _0x46d505[_0x104f('0x1d')]==='undefined';var _0x1670d7=_0x5979a6[_0x104f('0x1e')];var _0x55bdda=_0x9e13ef?0x0:_0x46d505[_0x104f('0x1f')];var _0x517e42=_0x9e13ef?_0x5979a6[_0x104f('0x1e')]:_0x46d505[_0x104f('0x1f')]+_0x46d505[_0x104f('0x1d')];var _0x51f3d5;if(_0x517e42>=_0x1670d7){_0x517e42=_0x1670d7;_0x51f3d5=0xc8;}else{_0x51f3d5=0xce;}_0x5c4439[_0x104f('0x19')](_0x51f3d5);return _0x5c4439['set'](_0x104f('0x20'),_0x55bdda+'-'+_0x517e42+'/'+_0x1670d7)[_0x104f('0x1b')](_0x5979a6);}return null;};}function patchUpdates(_0x59a135){return function(_0x3d1262){try{jsonpatch[_0x104f('0x21')](_0x3d1262,_0x59a135,!![]);}catch(_0x18ada2){return BPromise[_0x104f('0x22')](_0x18ada2);}return _0x3d1262[_0x104f('0x23')]();};}function saveUpdates(_0x13daf9,_0x2696b9){return function(_0x1c80be){if(_0x1c80be){return _0x1c80be[_0x104f('0x24')](_0x13daf9)[_0x104f('0x25')](function(_0x5cfc5c){return _0x5cfc5c;});}return null;};}function removeEntity(_0x43a3e2,_0x13159b){return function(_0x4cf4a2){if(_0x4cf4a2){return _0x4cf4a2[_0x104f('0x26')]()[_0x104f('0x25')](function(){_0x43a3e2[_0x104f('0x19')](0xcc)[_0x104f('0x1a')]();});}};}function handleEntityNotFound(_0x3158d9,_0x135f36){return function(_0x2db16e){if(!_0x2db16e){_0x3158d9[_0x104f('0x18')](0x194);}return _0x2db16e;};}function handleError(_0x2d4d01,_0x31f20f){_0x31f20f=_0x31f20f||0x1f4;return function(_0x4da431){logger[_0x104f('0x27')](_0x4da431[_0x104f('0x28')]);if(_0x4da431['name']){delete _0x4da431['name'];}_0x2d4d01['status'](_0x31f20f)[_0x104f('0x29')](_0x4da431);};}function getMustacheRender(_0x24d73e,_0x54b95d){return Mustache['render'](_0x24d73e,_[_0x104f('0x2a')](_0x54b95d[_0x104f('0x2b')],{'contact':_0x54b95d[_0x104f('0x2c')],'message':_0x54b95d['message'],'agent':_0x54b95d['agent'],'interaction':_0x54b95d[_0x104f('0x2d')],'account':_0x54b95d['account']}))||'';}exports['index']=function(_0x174286,_0x630b5c){var _0x44bbe2={},_0x557e65={},_0x14a320={'count':0x0,'rows':[]};var _0x25c223=_[_0x104f('0x2e')](db[_0x104f('0x2f')][_0x104f('0x30')],function(_0x139500){return{'name':_0x139500[_0x104f('0x31')],'type':_0x139500[_0x104f('0x32')][_0x104f('0x33')]};});_0x557e65['model']=_[_0x104f('0x34')](_['map'](_0x25c223,_0x104f('0x35')),['name']);_0x557e65[_0x104f('0x36')]=_[_0x104f('0x37')](_0x174286[_0x104f('0x36')]);_0x557e65['filters']=_[_0x104f('0x38')](_0x557e65[_0x104f('0x39')],_0x557e65['query']);_0x44bbe2[_0x104f('0x3a')]=_[_0x104f('0x38')](_0x557e65['model'],qs['fields'](_0x174286[_0x104f('0x36')]['fields']));_0x44bbe2[_0x104f('0x3a')]=_0x44bbe2['attributes'][_0x104f('0x3b')]?_0x44bbe2[_0x104f('0x3a')]:_0x557e65['model'];if(!_0x174286[_0x104f('0x36')][_0x104f('0x3c')]('nolimit')){_0x44bbe2['limit']=qs[_0x104f('0x1d')](_0x174286['query'][_0x104f('0x1d')]);_0x44bbe2[_0x104f('0x1f')]=qs[_0x104f('0x1f')](_0x174286[_0x104f('0x36')]['offset']);}_0x44bbe2[_0x104f('0x3d')]=qs[_0x104f('0x3e')](_0x174286[_0x104f('0x36')]['sort']);_0x44bbe2[_0x104f('0x3f')]=qs[_0x104f('0x40')](_[_0x104f('0x41')](_0x174286['query'],_0x557e65[_0x104f('0x40')]),_0x25c223);if(_0x174286[_0x104f('0x36')][_0x104f('0x42')]){_0x44bbe2['where']=_['merge'](_0x44bbe2[_0x104f('0x3f')],{'$or':_[_0x104f('0x2e')](_0x25c223,function(_0x100fa7){if(_0x100fa7[_0x104f('0x32')]!==_0x104f('0x43')){var _0x6c2650={};_0x6c2650[_0x100fa7[_0x104f('0x35')]]={'$like':'%'+_0x174286[_0x104f('0x36')][_0x104f('0x42')]+'%'};return _0x6c2650;}})});}_0x44bbe2=_[_0x104f('0x2a')]({},_0x44bbe2,_0x174286[_0x104f('0x44')]);var _0x36d4f2={'where':_0x44bbe2[_0x104f('0x3f')]};return db[_0x104f('0x2f')][_0x104f('0x1e')](_0x36d4f2)[_0x104f('0x25')](function(_0x42d3f8){_0x14a320[_0x104f('0x1e')]=_0x42d3f8;if(_0x174286['query']['includeAll']){_0x44bbe2[_0x104f('0x45')]=[{'all':!![]}];}return db[_0x104f('0x2f')][_0x104f('0x46')](_0x44bbe2);})['then'](function(_0xf35142){_0x14a320[_0x104f('0x47')]=_0xf35142;return _0x14a320;})[_0x104f('0x25')](respondWithFilteredResult(_0x630b5c,_0x44bbe2))[_0x104f('0x48')](handleError(_0x630b5c,null));};exports[_0x104f('0x49')]=function(_0xc26c62,_0x504b2a){var _0x37fd6e={'raw':!![],'where':{'id':_0xc26c62[_0x104f('0x4a')]['id']}},_0x35cf52={};_0x35cf52['model']=_[_0x104f('0x37')](db[_0x104f('0x2f')][_0x104f('0x30')]);_0x35cf52[_0x104f('0x36')]=_['keys'](_0xc26c62[_0x104f('0x36')]);_0x35cf52[_0x104f('0x40')]=_['intersection'](_0x35cf52['model'],_0x35cf52[_0x104f('0x36')]);_0x37fd6e[_0x104f('0x3a')]=_[_0x104f('0x38')](_0x35cf52[_0x104f('0x39')],qs[_0x104f('0x4b')](_0xc26c62[_0x104f('0x36')][_0x104f('0x4b')]));_0x37fd6e[_0x104f('0x3a')]=_0x37fd6e[_0x104f('0x3a')][_0x104f('0x3b')]?_0x37fd6e[_0x104f('0x3a')]:_0x35cf52[_0x104f('0x39')];if(_0xc26c62[_0x104f('0x36')][_0x104f('0x4c')]){_0x37fd6e['include']=[{'all':!![]}];}_0x37fd6e=_[_0x104f('0x2a')]({},_0x37fd6e,_0xc26c62[_0x104f('0x44')]);return db[_0x104f('0x2f')][_0x104f('0x4d')](_0x37fd6e)[_0x104f('0x25')](handleEntityNotFound(_0x504b2a,null))[_0x104f('0x25')](respondWithResult(_0x504b2a,null))['catch'](handleError(_0x504b2a,null));};exports[_0x104f('0x4e')]=function(_0x4ee9f0,_0x20abca){return db[_0x104f('0x2f')][_0x104f('0x4e')](_0x4ee9f0[_0x104f('0x2b')],{})[_0x104f('0x25')](respondWithResult(_0x20abca,0xc9))[_0x104f('0x48')](handleError(_0x20abca,null));};exports[_0x104f('0x24')]=function(_0x379c5a,_0x5b35f6){if(_0x379c5a[_0x104f('0x2b')]['id']){delete _0x379c5a[_0x104f('0x2b')]['id'];}return db['VoiceMailMessage'][_0x104f('0x4d')]({'where':{'id':_0x379c5a[_0x104f('0x4a')]['id']}})[_0x104f('0x25')](handleEntityNotFound(_0x5b35f6,null))[_0x104f('0x25')](saveUpdates(_0x379c5a[_0x104f('0x2b')],null))[_0x104f('0x25')](respondWithResult(_0x5b35f6,null))[_0x104f('0x48')](handleError(_0x5b35f6,null));};exports['destroy']=function(_0x1b818b,_0x229870){return db[_0x104f('0x2f')][_0x104f('0x4d')]({'where':{'id':_0x1b818b['params']['id']}})[_0x104f('0x25')](handleEntityNotFound(_0x229870,null))[_0x104f('0x25')](removeEntity(_0x229870,null))[_0x104f('0x48')](handleError(_0x229870,null));};exports['download']=function(_0x2a3ae4,_0x4e32f6,_0x267625){return db['VoiceMailMessage']['find']({'where':{'id':_0x2a3ae4[_0x104f('0x4a')]['id']},'attributes':['id',_0x104f('0x4f'),_0x104f('0x50')]})[_0x104f('0x25')](handleEntityNotFound(_0x4e32f6,null))['then'](function(_0x3beaae){if(_0x3beaae){if(!_0x3beaae[_0x104f('0x4f')]){throw new db[(_0x104f('0x51'))][(_0x104f('0x52'))](_0x104f('0x53'));}var _0x3f7ec9={'Content-Type':_0x104f('0x54'),'Content-Disposition':_0x104f('0x55')};if(_0x3beaae['msg_id']){_0x3f7ec9[_0x104f('0x56')]=_0x104f('0x57')+_0x3beaae[_0x104f('0x50')]+'.wav\x22';}_0x4e32f6[_0x104f('0x58')](_0x3f7ec9);return _0x4e32f6[_0x104f('0x29')](new Buffer(_0x3beaae[_0x104f('0x4f')]));}})[_0x104f('0x48')](handleError(_0x4e32f6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0e9e9f0..a39461f 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.model.js +++ b/server/api/voiceMailMessage/voiceMailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03db=['define','voice_voicemail_messages','lodash','../../config/logger','api','bluebird','path','../../config/environment','./voiceMailMessage.attributes'];(function(_0x39fd75,_0x41892e){var _0x16e820=function(_0x4c5df7){while(--_0x4c5df7){_0x39fd75['push'](_0x39fd75['shift']());}};_0x16e820(++_0x41892e);}(_0x03db,0x1a9));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb03d('0x0'));var util=require('util');var logger=require(_0xb03d('0x1'))(_0xb03d('0x2'));var moment=require('moment');var BPromise=require(_0xb03d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb03d('0x4'));var rimraf=require('rimraf');var config=require(_0xb03d('0x5'));var attributes=require(_0xb03d('0x6'));module['exports']=function(_0x3229c0,_0x27978d){return _0x3229c0[_0xb03d('0x7')]('VoiceMailMessage',attributes,{'tableName':_0xb03d('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x25d3=['dir','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x33da12,_0x41de8d){var _0x1ba77d=function(_0xcf08a1){while(--_0xcf08a1){_0x33da12['push'](_0x33da12['shift']());}};_0x1ba77d(++_0x41de8d);}(_0x25d3,0xcd));var _0x325d=function(_0x1d2f5a,_0xe4030c){_0x1d2f5a=_0x1d2f5a-0x0;var _0x3f89e5=_0x25d3[_0x1d2f5a];return _0x3f89e5;};'use strict';var _=require(_0x325d('0x0'));var util=require(_0x325d('0x1'));var logger=require(_0x325d('0x2'))(_0x325d('0x3'));var moment=require('moment');var BPromise=require(_0x325d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x325d('0x5'));var rimraf=require(_0x325d('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x325d('0x7')]=function(_0x53f2b8,_0x230a20){return _0x53f2b8[_0x325d('0x8')](_0x325d('0x9'),attributes,{'tableName':_0x325d('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x325d('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 1be8259..e405361 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x219c32,_0x2e5c63){var _0x442f4e=function(_0x52ba14){while(--_0x52ba14){_0x219c32['push'](_0x219c32['shift']());}};_0x442f4e(++_0x2e5c63);}(_0x14a0,0x8e));var _0x014a=function(_0x49d58f,_0x322374){_0x49d58f=_0x49d58f-0x0;var _0x6d011f=_0x14a0[_0x49d58f];return _0x6d011f;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x482398,_0x166298){var _0x42fa0d=function(_0x1d9113){while(--_0x1d9113){_0x482398['push'](_0x482398['shift']());}};_0x42fa0d(++_0x166298);}(_0x1a85,0x178));var _0x51a8=function(_0x34967e,_0x11f483){_0x34967e=_0x34967e-0x0;var _0x406971=_0x1a85[_0x34967e];return _0x406971;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index adb39ce..1136ac3 100644 --- a/server/api/voiceMusicOnHold/index.js +++ b/server/api/voiceMusicOnHold/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95e0=['update','delete','destroy','/:id/sounds/:id2','removeSound','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/sounds','isAuthenticated','getSounds','post','create','put'];(function(_0x411868,_0x1c9172){var _0x1b4f53=function(_0x52b4a2){while(--_0x52b4a2){_0x411868['push'](_0x411868['shift']());}};_0x1b4f53(++_0x1c9172);}(_0x95e0,0xf5));var _0x095e=function(_0x506506,_0x361f2b){_0x506506=_0x506506-0x0;var _0xeb789=_0x95e0[_0x506506];return _0xeb789;};'use strict';var multer=require('multer');var util=require(_0x095e('0x0'));var path=require(_0x095e('0x1'));var timeout=require(_0x095e('0x2'));var express=require(_0x095e('0x3'));var router=express[_0x095e('0x4')]();var fs_extra=require(_0x095e('0x5'));var auth=require(_0x095e('0x6'));var interaction=require(_0x095e('0x7'));var config=require(_0x095e('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x095e('0x9')]('/',auth['isAuthenticated'](),controller[_0x095e('0xa')]);router[_0x095e('0x9')](_0x095e('0xb'),auth['isAuthenticated'](),controller[_0x095e('0xc')]);router[_0x095e('0x9')](_0x095e('0xd'),auth[_0x095e('0xe')](),controller[_0x095e('0xf')]);router[_0x095e('0x10')]('/',auth['isAuthenticated'](),controller[_0x095e('0x11')]);router['post'](_0x095e('0xd'),auth[_0x095e('0xe')](),controller['addSound']);router[_0x095e('0x12')](_0x095e('0xb'),auth['isAuthenticated'](),controller[_0x095e('0x13')]);router[_0x095e('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x095e('0x15')]);router['delete'](_0x095e('0x16'),auth[_0x095e('0xe')](),controller[_0x095e('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf97d=['../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','getSounds','post','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf97d,0x85));var _0xdf97=function(_0x1ac6bb,_0x567138){_0x1ac6bb=_0x1ac6bb-0x0;var _0xb9233b=_0xf97d[_0x1ac6bb];return _0xb9233b;};'use strict';var multer=require(_0xdf97('0x0'));var util=require(_0xdf97('0x1'));var path=require(_0xdf97('0x2'));var timeout=require(_0xdf97('0x3'));var express=require(_0xdf97('0x4'));var router=express[_0xdf97('0x5')]();var fs_extra=require(_0xdf97('0x6'));var auth=require(_0xdf97('0x7'));var interaction=require(_0xdf97('0x8'));var config=require('../../config/environment');var controller=require(_0xdf97('0x9'));router[_0xdf97('0xa')]('/',auth[_0xdf97('0xb')](),controller[_0xdf97('0xc')]);router['get']('/:id',auth[_0xdf97('0xb')](),controller['show']);router[_0xdf97('0xa')](_0xdf97('0xd'),auth['isAuthenticated'](),controller[_0xdf97('0xe')]);router[_0xdf97('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdf97('0xf')]('/:id/sounds',auth[_0xdf97('0xb')](),controller['addSound']);router['put']('/:id',auth[_0xdf97('0xb')](),controller['update']);router[_0xdf97('0x10')]('/:id',auth[_0xdf97('0xb')](),controller[_0xdf97('0x11')]);router[_0xdf97('0x10')](_0xdf97('0x12'),auth[_0xdf97('0xb')](),controller[_0xdf97('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 165b70c..fb9e862 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3af2=['custom','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3af2,0xf7));var _0x23af=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x3af2[_0x27d8bc];return _0x4b04cb;};'use strict';var Sequelize=require(_0x23af('0x0'));module[_0x23af('0x1')]={'name':{'type':Sequelize[_0x23af('0x2')],'allowNull':![],'unique':_0x23af('0x3')},'mode':{'type':Sequelize[_0x23af('0x4')](_0x23af('0x5'),'files','mp3nb','quietmp3nb',_0x23af('0x6'),_0x23af('0x7')),'allowNull':!![],'defaultValue':_0x23af('0x8')},'directory':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![],'defaultValue':_0x23af('0x9')},'format':{'type':Sequelize[_0x23af('0x2')],'allowNull':!![]},'stamp':{'type':_0x23af('0xa')},'defaultEntry':{'type':Sequelize[_0x23af('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f26=['name','ENUM','custom','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x477495,_0x5de2c1){var _0x29078e=function(_0x19b2e9){while(--_0x19b2e9){_0x477495['push'](_0x477495['shift']());}};_0x29078e(++_0x5de2c1);}(_0x0f26,0x189));var _0x60f2=function(_0x4cde8b,_0x2ac0c8){_0x4cde8b=_0x4cde8b-0x0;var _0x1bd0d6=_0x0f26[_0x4cde8b];return _0x1bd0d6;};'use strict';var Sequelize=require(_0x60f2('0x0'));module[_0x60f2('0x1')]={'name':{'type':Sequelize[_0x60f2('0x2')],'allowNull':![],'unique':_0x60f2('0x3')},'mode':{'type':Sequelize[_0x60f2('0x4')](_0x60f2('0x5'),'files','mp3nb','quietmp3nb',_0x60f2('0x6'),_0x60f2('0x7')),'allowNull':!![],'defaultValue':_0x60f2('0x8')},'directory':{'type':Sequelize[_0x60f2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x60f2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x60f2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x60f2('0x2')],'allowNull':!![],'defaultValue':_0x60f2('0x9')},'format':{'type':Sequelize[_0x60f2('0x2')],'allowNull':!![]},'stamp':{'type':_0x60f2('0xa')},'defaultEntry':{'type':Sequelize[_0x60f2('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 00b8baf..f9b7692 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa74a=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','includeAll','include','options','find','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','destroy','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','getSounds','pick','eml-format','fast-json-patch','moment','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','body','contact','agent','account','index','map','VoiceMusicOnHold','fieldName','key'];(function(_0x107de1,_0x21dbe4){var _0x23dc6b=function(_0x19bf3b){while(--_0x19bf3b){_0x107de1['push'](_0x107de1['shift']());}};_0x23dc6b(++_0x21dbe4);}(_0xa74a,0x1e0));var _0xaa74=function(_0x26dae8,_0xfe1df0){_0x26dae8=_0x26dae8-0x0;var _0x25b42a=_0xa74a[_0x26dae8];return _0x25b42a;};'use strict';var emlformat=require(_0xaa74('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa74('0x1'));var rp=require('request-promise');var moment=require(_0xaa74('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xaa74('0x3'));var csv=require('to-csv');var ejs=require(_0xaa74('0x4'));var fs=require('fs');var fs_extra=require(_0xaa74('0x5'));var _=require(_0xaa74('0x6'));var squel=require(_0xaa74('0x7'));var crypto=require('crypto');var jsforce=require(_0xaa74('0x8'));var deskjs=require(_0xaa74('0x9'));var toCsv=require(_0xaa74('0xa'));var querystring=require(_0xaa74('0xb'));var Papa=require('papaparse');var Redis=require(_0xaa74('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xaa74('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa74('0xe'))('api');var utils=require(_0xaa74('0xf'));var config=require(_0xaa74('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa74('0x11'))['db'];function respondWithStatusCode(_0xeb62ff,_0x6e3904){_0x6e3904=_0x6e3904||0xcc;return function(_0x5401d1){if(_0x5401d1){return _0xeb62ff[_0xaa74('0x12')](_0x6e3904);}return _0xeb62ff[_0xaa74('0x13')](_0x6e3904)[_0xaa74('0x14')]();};}function respondWithResult(_0x42f5d6,_0x16aeab){_0x16aeab=_0x16aeab||0xc8;return function(_0xa9232c){if(_0xa9232c){return _0x42f5d6[_0xaa74('0x13')](_0x16aeab)[_0xaa74('0x15')](_0xa9232c);}};}function respondWithFilteredResult(_0x1a7aaf,_0x272a14){return function(_0x3dbf78){if(_0x3dbf78){var _0x20b963=typeof _0x272a14[_0xaa74('0x16')]===_0xaa74('0x17')&&typeof _0x272a14[_0xaa74('0x18')]===_0xaa74('0x17');var _0x1bc70f=_0x3dbf78['count'];var _0x390cec=_0x20b963?0x0:_0x272a14[_0xaa74('0x16')];var _0x543745=_0x20b963?_0x3dbf78[_0xaa74('0x19')]:_0x272a14[_0xaa74('0x16')]+_0x272a14[_0xaa74('0x18')];var _0x3968c3;if(_0x543745>=_0x1bc70f){_0x543745=_0x1bc70f;_0x3968c3=0xc8;}else{_0x3968c3=0xce;}_0x1a7aaf[_0xaa74('0x13')](_0x3968c3);return _0x1a7aaf[_0xaa74('0x1a')]('Content-Range',_0x390cec+'-'+_0x543745+'/'+_0x1bc70f)[_0xaa74('0x15')](_0x3dbf78);}return null;};}function patchUpdates(_0x1c0a7f){return function(_0x271d65){try{jsonpatch['apply'](_0x271d65,_0x1c0a7f,!![]);}catch(_0x39ddd9){return BPromise['reject'](_0x39ddd9);}return _0x271d65['save']();};}function saveUpdates(_0x27e0d1,_0x2b46a2){return function(_0x54ef41){if(_0x54ef41){return _0x54ef41[_0xaa74('0x1b')](_0x27e0d1)[_0xaa74('0x1c')](function(_0x4df816){return _0x4df816;});}return null;};}function removeEntity(_0xc144c4,_0x5525d7){return function(_0x15925c){if(_0x15925c){return _0x15925c['destroy']()[_0xaa74('0x1c')](function(){var _0x41914b=_0x15925c[_0xaa74('0x1d')]({'plain':!![]});var _0x145a56=_0xaa74('0x1e');return db[_0xaa74('0x1f')]['destroy']({'where':{'type':_0x145a56,'resourceId':_0x41914b['id']}})[_0xaa74('0x1c')](function(){return _0x15925c;});})['then'](function(){_0xc144c4[_0xaa74('0x13')](0xcc)[_0xaa74('0x14')]();});}};}function handleEntityNotFound(_0x4cca27,_0x79c3b){return function(_0x5a5f9e){if(!_0x5a5f9e){_0x4cca27[_0xaa74('0x12')](0x194);}return _0x5a5f9e;};}function handleError(_0x3f6c7e,_0x4fa677){_0x4fa677=_0x4fa677||0x1f4;return function(_0x50161a){logger[_0xaa74('0x20')](_0x50161a[_0xaa74('0x21')]);if(_0x50161a[_0xaa74('0x22')]){delete _0x50161a['name'];}_0x3f6c7e['status'](_0x4fa677)[_0xaa74('0x23')](_0x50161a);};}function getMustacheRender(_0x51a799,_0x4472be){return Mustache['render'](_0x51a799,_['merge'](_0x4472be[_0xaa74('0x24')],{'contact':_0x4472be[_0xaa74('0x25')],'message':_0x4472be['message'],'agent':_0x4472be[_0xaa74('0x26')],'interaction':_0x4472be['interaction'],'account':_0x4472be[_0xaa74('0x27')]}))||'';}exports[_0xaa74('0x28')]=function(_0x49d654,_0x414e69){var _0x39e2e3={},_0x3660ac={},_0x9d4ad7={'count':0x0,'rows':[]};var _0x3c7045=_[_0xaa74('0x29')](db[_0xaa74('0x2a')]['rawAttributes'],function(_0x1b73e3){return{'name':_0x1b73e3[_0xaa74('0x2b')],'type':_0x1b73e3['type'][_0xaa74('0x2c')]};});_0x3660ac[_0xaa74('0x2d')]=_[_0xaa74('0x29')](_0x3c7045,_0xaa74('0x22'));_0x3660ac[_0xaa74('0x2e')]=_[_0xaa74('0x2f')](_0x49d654[_0xaa74('0x2e')]);_0x3660ac['filters']=_[_0xaa74('0x30')](_0x3660ac['model'],_0x3660ac['query']);_0x39e2e3['attributes']=_[_0xaa74('0x30')](_0x3660ac[_0xaa74('0x2d')],qs['fields'](_0x49d654[_0xaa74('0x2e')][_0xaa74('0x31')]));_0x39e2e3[_0xaa74('0x32')]=_0x39e2e3[_0xaa74('0x32')][_0xaa74('0x33')]?_0x39e2e3[_0xaa74('0x32')]:_0x3660ac['model'];if(!_0x49d654[_0xaa74('0x2e')][_0xaa74('0x34')]('nolimit')){_0x39e2e3[_0xaa74('0x18')]=qs[_0xaa74('0x18')](_0x49d654[_0xaa74('0x2e')][_0xaa74('0x18')]);_0x39e2e3[_0xaa74('0x16')]=qs[_0xaa74('0x16')](_0x49d654[_0xaa74('0x2e')][_0xaa74('0x16')]);}_0x39e2e3['order']=qs[_0xaa74('0x35')](_0x49d654['query'][_0xaa74('0x35')]);delete _0x49d654[_0xaa74('0x2e')][_0xaa74('0x35')];_0x39e2e3[_0xaa74('0x36')]=qs[_0xaa74('0x37')](_['pick'](_0x49d654[_0xaa74('0x2e')],_0x3660ac[_0xaa74('0x37')]),_0x3c7045);if(_0x49d654[_0xaa74('0x2e')][_0xaa74('0x38')]){_0x39e2e3[_0xaa74('0x36')]=_[_0xaa74('0x39')](_0x39e2e3[_0xaa74('0x36')],{'$or':_[_0xaa74('0x29')](_0x3c7045,function(_0x333a6b){if(_0x333a6b[_0xaa74('0x3a')]!==_0xaa74('0x3b')){var _0x3beef2={};_0x3beef2[_0x333a6b[_0xaa74('0x22')]]={'$like':'%'+_0x49d654[_0xaa74('0x2e')][_0xaa74('0x38')]+'%'};return _0x3beef2;}})});}_0x39e2e3=_[_0xaa74('0x39')]({},_0x39e2e3,_0x49d654['options']);var _0x271c3b={'where':_0x39e2e3[_0xaa74('0x36')]};return db[_0xaa74('0x2a')][_0xaa74('0x19')](_0x271c3b)['then'](function(_0xcd4c9a){_0x9d4ad7['count']=_0xcd4c9a;if(_0x49d654[_0xaa74('0x2e')]['includeAll']){_0x39e2e3['include']=[{'all':!![]}];}return db[_0xaa74('0x2a')][_0xaa74('0x3c')](_0x39e2e3);})[_0xaa74('0x1c')](function(_0x48172a){_0x9d4ad7[_0xaa74('0x3d')]=_0x48172a;return _0x9d4ad7;})[_0xaa74('0x1c')](respondWithFilteredResult(_0x414e69,_0x39e2e3))[_0xaa74('0x3e')](handleError(_0x414e69,null));};exports[_0xaa74('0x3f')]=function(_0x175655,_0x511d1e){var _0x30caac={'raw':![],'where':{'id':_0x175655[_0xaa74('0x40')]['id']}},_0x30c8bf={};_0x30c8bf[_0xaa74('0x2d')]=_[_0xaa74('0x2f')](db[_0xaa74('0x2a')]['rawAttributes']);_0x30c8bf['query']=_[_0xaa74('0x2f')](_0x175655[_0xaa74('0x2e')]);_0x30c8bf[_0xaa74('0x37')]=_[_0xaa74('0x30')](_0x30c8bf[_0xaa74('0x2d')],_0x30c8bf[_0xaa74('0x2e')]);_0x30caac['attributes']=_[_0xaa74('0x30')](_0x30c8bf[_0xaa74('0x2d')],qs[_0xaa74('0x31')](_0x175655[_0xaa74('0x2e')][_0xaa74('0x31')]));_0x30caac['attributes']=_0x30caac[_0xaa74('0x32')][_0xaa74('0x33')]?_0x30caac[_0xaa74('0x32')]:_0x30c8bf[_0xaa74('0x2d')];if(_0x175655[_0xaa74('0x2e')][_0xaa74('0x41')]){_0x30caac[_0xaa74('0x42')]=[{'all':!![]}];}_0x30caac=_['merge']({},_0x30caac,_0x175655[_0xaa74('0x43')]);return db['VoiceMusicOnHold'][_0xaa74('0x44')](_0x30caac)[_0xaa74('0x1c')](handleEntityNotFound(_0x511d1e,null))['then'](respondWithResult(_0x511d1e,null))['catch'](handleError(_0x511d1e,null));};exports['update']=function(_0x543706,_0x16134d){if(_0x543706[_0xaa74('0x24')]['id']){delete _0x543706['body']['id'];}return db['VoiceMusicOnHold'][_0xaa74('0x44')]({'where':{'id':_0x543706[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](handleEntityNotFound(_0x16134d,null))[_0xaa74('0x1c')](saveUpdates(_0x543706[_0xaa74('0x24')],null))[_0xaa74('0x1c')](respondWithResult(_0x16134d,null))['catch'](handleError(_0x16134d,null));};exports[_0xaa74('0x45')]=function(_0x8a7d42,_0x3d9129,_0x2abf37){return db[_0xaa74('0x46')][_0xaa74('0x47')](function(_0x221ef6){if(_0x8a7d42[_0xaa74('0x24')][_0xaa74('0x48')]==='files'){_0x8a7d42[_0xaa74('0x24')][_0xaa74('0x49')]=path[_0xaa74('0x4a')](config[_0xaa74('0x4b')],_0xaa74('0x4c'),_0x8a7d42[_0xaa74('0x24')][_0xaa74('0x22')]);}return db['VoiceMusicOnHold'][_0xaa74('0x45')](_0x8a7d42['body'],{'transaction':_0x221ef6})[_0xaa74('0x1c')](function(_0x49af9d){if(_0x8a7d42[_0xaa74('0x24')]['mode']===_0xaa74('0x4d')){fs[_0xaa74('0x4e')](_0x49af9d[_0xaa74('0x49')],parseInt(_0xaa74('0x4f'),0x8));}var _0x100508=_0x8a7d42['user'][_0xaa74('0x1d')]({'plain':!![]});if(!_0x100508)throw new Error(_0xaa74('0x50'));if(_0x100508['role']===_0xaa74('0x51')){var _0x142598=_0x49af9d['get']({'plain':!![]});return db['UserProfileSection'][_0xaa74('0x44')]({'where':{'name':_0xaa74('0x1e'),'userProfileId':_0x100508[_0xaa74('0x52')]},'raw':!![]})[_0xaa74('0x1c')](function(_0x629f57){if(_0x629f57&&_0x629f57[_0xaa74('0x53')]===0x0){return db[_0xaa74('0x1f')][_0xaa74('0x45')]({'name':_0x142598[_0xaa74('0x22')],'resourceId':_0x142598['id'],'type':_0x629f57[_0xaa74('0x22')],'sectionId':_0x629f57['id']},{})[_0xaa74('0x1c')](function(){return _0x49af9d;});}else{return _0x49af9d;}})[_0xaa74('0x3e')](function(_0x17d58c){logger[_0xaa74('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17d58c);});}return _0x49af9d;});})[_0xaa74('0x1c')](respondWithResult(_0x3d9129,0xc9))[_0xaa74('0x3e')](handleError(_0x3d9129,null));};exports[_0xaa74('0x54')]=function(_0x5b5349,_0x19b924,_0x8170b9){var _0x91c6b8;return db[_0xaa74('0x2a')][_0xaa74('0x44')]({'where':{'id':_0x5b5349['params']['id']}})['then'](function(_0x5f41a9){if(_0x5f41a9){return db[_0xaa74('0x46')][_0xaa74('0x47')](function(_0x4b65a0){return _0x5f41a9[_0xaa74('0x54')]({'transaction':_0x4b65a0,'raw':!![]})[_0xaa74('0x1c')](function(_0x3cf041){if(_0x3cf041[_0xaa74('0x49')]){fs['readdirSync'](_0x3cf041[_0xaa74('0x49')])['forEach'](function(_0x4805f2){fs[_0xaa74('0x55')](path['join'](_0x3cf041['directory'],_0x4805f2));});fs[_0xaa74('0x56')](_0x3cf041[_0xaa74('0x49')]);}return _0x3cf041;});})[_0xaa74('0x3e')](function(_0x647f09){throw new db[(_0xaa74('0x57'))][(_0xaa74('0x58'))](_0x647f09[_0xaa74('0x59')]);});}})[_0xaa74('0x1c')](handleEntityNotFound(_0x19b924,null))[_0xaa74('0x1c')](removeEntity(_0x19b924,null))[_0xaa74('0x3e')](handleError(_0x19b924,null));};exports[_0xaa74('0x5a')]=function(_0x58f60e,_0x247ba1,_0x3def4a){return db[_0xaa74('0x46')][_0xaa74('0x47')](function(_0x4cdd0f){var _0x43ffde;return db[_0xaa74('0x2a')][_0xaa74('0x44')]({'where':{'id':_0x58f60e[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](function(_0x19a8d0){if(_0x19a8d0){_0x43ffde=_0x19a8d0;return _0x19a8d0[_0xaa74('0x5a')](_0x58f60e[_0xaa74('0x24')]['id'],{'transaction':_0x4cdd0f});}})[_0xaa74('0x1c')](function(_0x4210b9){if(_0x4210b9){return db[_0xaa74('0x5b')][_0xaa74('0x5c')]({'where':{'id':_0x58f60e[_0xaa74('0x24')]['id']},'attributes':['id','name',_0xaa74('0x5d'),_0xaa74('0x5e'),_0xaa74('0x5f')],'raw':!![]});}})[_0xaa74('0x1c')](function(_0x3f4233){if(_0x3f4233){var _0x5b1edf=path['join'](config['root'],_0xaa74('0x60'),util[_0xaa74('0x61')](_0xaa74('0x62'),path[_0xaa74('0x63')](_0x3f4233['save_name'],path[_0xaa74('0x64')](_0x3f4233[_0xaa74('0x5d')])),_0x3f4233[_0xaa74('0x5e')]));var _0x189a8d=path[_0xaa74('0x4a')](config[_0xaa74('0x4b')],_0xaa74('0x4c'),_0x43ffde[_0xaa74('0x22')],util[_0xaa74('0x61')]('%s.%s',_0x3f4233[_0xaa74('0x22')],_0x3f4233['converted_format']));fs['symlinkSync'](_0x5b1edf,_0x189a8d);return _0x3f4233;}})[_0xaa74('0x3e')](function(_0x1d4eeb){throw new db[(_0xaa74('0x57'))]['ValidationError'](_0x1d4eeb[_0xaa74('0x59')]);});})[_0xaa74('0x1c')](handleEntityNotFound(_0x247ba1,null))['then'](respondWithResult(_0x247ba1,0xc9))[_0xaa74('0x3e')](handleError(_0x247ba1,null));};exports[_0xaa74('0x65')]=function(_0x5a2ec3,_0xeb1799,_0x1f7e2c){return db['sequelize']['transaction'](function(_0x1e47a2){var _0x4072d5;return db[_0xaa74('0x2a')][_0xaa74('0x5c')]({'where':{'id':_0x5a2ec3[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](handleEntityNotFound(_0xeb1799,null))[_0xaa74('0x1c')](function(_0x348885){if(_0x348885){_0x4072d5=_0x348885;return _0x348885['removeSound'](_0x5a2ec3[_0xaa74('0x40')][_0xaa74('0x66')]);}})['then'](function(_0x248d69){if(_0x248d69){return db[_0xaa74('0x5b')][_0xaa74('0x5c')]({'where':{'id':_0x5a2ec3[_0xaa74('0x40')]['id2']},'attributes':['id',_0xaa74('0x22'),_0xaa74('0x5d'),_0xaa74('0x5e'),_0xaa74('0x5f')],'raw':!![]});}})['then'](function(_0x2759b8){if(_0x2759b8){fs['unlinkSync'](path[_0xaa74('0x4a')](_0x4072d5['directory'],util['format'](_0xaa74('0x62'),_0x2759b8['name'],_0x2759b8[_0xaa74('0x5e')])));return _0x2759b8;}})[_0xaa74('0x3e')](function(_0x3151dd){throw new db['Sequelize'][(_0xaa74('0x58'))](_0x3151dd[_0xaa74('0x59')]);});})[_0xaa74('0x1c')](handleEntityNotFound(_0xeb1799,null))['then'](respondWithStatusCode(_0xeb1799,0xcc))['catch'](handleError(_0xeb1799,null));};exports[_0xaa74('0x67')]=function(_0x1dcdfc,_0x2b778a,_0x290bba){var _0x5f0c87={};var _0x23cd67={};var _0x1af371;var _0x351163;return db[_0xaa74('0x2a')][_0xaa74('0x5c')]({'where':{'id':_0x1dcdfc[_0xaa74('0x40')]['id']}})[_0xaa74('0x1c')](handleEntityNotFound(_0x2b778a,null))['then'](function(_0x3176ce){if(_0x3176ce){_0x1af371=_0x3176ce;_0x23cd67[_0xaa74('0x2d')]=_[_0xaa74('0x2f')](db['Sound']['rawAttributes']);_0x23cd67[_0xaa74('0x2e')]=_[_0xaa74('0x2f')](_0x1dcdfc[_0xaa74('0x2e')]);_0x23cd67[_0xaa74('0x37')]=_['intersection'](_0x23cd67['model'],_0x23cd67[_0xaa74('0x2e')]);_0x5f0c87['attributes']=_[_0xaa74('0x30')](_0x23cd67[_0xaa74('0x2d')],qs['fields'](_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x31')]));_0x5f0c87[_0xaa74('0x32')]=_0x5f0c87['attributes'][_0xaa74('0x33')]?_0x5f0c87[_0xaa74('0x32')]:_0x23cd67['model'];_0x5f0c87['order']=qs[_0xaa74('0x35')](_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x35')]);_0x5f0c87[_0xaa74('0x36')]=qs['filters'](_[_0xaa74('0x68')](_0x1dcdfc[_0xaa74('0x2e')],_0x23cd67[_0xaa74('0x37')]));if(_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x38')]){_0x5f0c87['where']=_[_0xaa74('0x39')](_0x5f0c87[_0xaa74('0x36')],{'$or':_['map'](_0x5f0c87[_0xaa74('0x32')],function(_0x4d4b74){var _0x181e10={};_0x181e10[_0x4d4b74]={'$like':'%'+_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x38')]+'%'};return _0x181e10;})});}_0x5f0c87=_[_0xaa74('0x39')]({},_0x5f0c87,_0x1dcdfc[_0xaa74('0x43')]);return _0x1af371['getSounds'](_0x5f0c87);}})['then'](function(_0x1dfd09){if(_0x1dfd09){_0x351163=_0x1dfd09[_0xaa74('0x33')];if(!_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x34')]('nolimit')){_0x5f0c87[_0xaa74('0x18')]=qs['limit'](_0x1dcdfc[_0xaa74('0x2e')][_0xaa74('0x18')]);_0x5f0c87[_0xaa74('0x16')]=qs[_0xaa74('0x16')](_0x1dcdfc[_0xaa74('0x2e')]['offset']);}return _0x1af371[_0xaa74('0x67')](_0x5f0c87);}})[_0xaa74('0x1c')](function(_0x25df6e){if(_0x25df6e){return _0x25df6e?{'count':_0x351163,'rows':_0x25df6e}:null;}})[_0xaa74('0x1c')](respondWithResult(_0x2b778a,null))[_0xaa74('0x3e')](handleError(_0x2b778a,null));}; \ No newline at end of file +var _0xc27e=['limit','set','Content-Range','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','render','merge','body','contact','message','interaction','account','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','sequelize','transaction','mode','files','directory','join','root','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','extname','server/files/moh','format','symlinkSync','removeSound','findOne','id2','getSounds','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xc27e,0x1c5));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xec27('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec27('0x1'));var jsonpatch=require(_0xec27('0x2'));var rp=require('request-promise');var moment=require(_0xec27('0x3'));var BPromise=require(_0xec27('0x4'));var Mustache=require(_0xec27('0x5'));var util=require(_0xec27('0x6'));var path=require('path');var sox=require(_0xec27('0x7'));var csv=require(_0xec27('0x8'));var ejs=require(_0xec27('0x9'));var fs=require('fs');var fs_extra=require(_0xec27('0xa'));var _=require(_0xec27('0xb'));var squel=require(_0xec27('0xc'));var crypto=require(_0xec27('0xd'));var jsforce=require(_0xec27('0xe'));var deskjs=require(_0xec27('0xf'));var toCsv=require(_0xec27('0x8'));var querystring=require(_0xec27('0x10'));var Papa=require('papaparse');var Redis=require(_0xec27('0x11'));var authService=require(_0xec27('0x12'));var qs=require(_0xec27('0x13'));var as=require(_0xec27('0x14'));var hardwareService=require(_0xec27('0x15'));var logger=require(_0xec27('0x16'))(_0xec27('0x17'));var utils=require(_0xec27('0x18'));var config=require(_0xec27('0x19'));var licenseUtil=require(_0xec27('0x1a'));var db=require(_0xec27('0x1b'))['db'];function respondWithStatusCode(_0x231b26,_0x7a1bb0){_0x7a1bb0=_0x7a1bb0||0xcc;return function(_0x5d385b){if(_0x5d385b){return _0x231b26[_0xec27('0x1c')](_0x7a1bb0);}return _0x231b26['status'](_0x7a1bb0)[_0xec27('0x1d')]();};}function respondWithResult(_0xd28e76,_0x20c251){_0x20c251=_0x20c251||0xc8;return function(_0x4f68ea){if(_0x4f68ea){return _0xd28e76[_0xec27('0x1e')](_0x20c251)[_0xec27('0x1f')](_0x4f68ea);}};}function respondWithFilteredResult(_0x573605,_0x1a2c8c){return function(_0x33ba63){if(_0x33ba63){var _0xe728aa=typeof _0x1a2c8c['offset']==='undefined'&&typeof _0x1a2c8c['limit']===_0xec27('0x20');var _0x401814=_0x33ba63[_0xec27('0x21')];var _0x2aec19=_0xe728aa?0x0:_0x1a2c8c[_0xec27('0x22')];var _0x47bffb=_0xe728aa?_0x33ba63[_0xec27('0x21')]:_0x1a2c8c[_0xec27('0x22')]+_0x1a2c8c[_0xec27('0x23')];var _0x370652;if(_0x47bffb>=_0x401814){_0x47bffb=_0x401814;_0x370652=0xc8;}else{_0x370652=0xce;}_0x573605[_0xec27('0x1e')](_0x370652);return _0x573605[_0xec27('0x24')](_0xec27('0x25'),_0x2aec19+'-'+_0x47bffb+'/'+_0x401814)[_0xec27('0x1f')](_0x33ba63);}return null;};}function patchUpdates(_0x1d16ad){return function(_0x190dfa){try{jsonpatch['apply'](_0x190dfa,_0x1d16ad,!![]);}catch(_0x25ad4d){return BPromise[_0xec27('0x26')](_0x25ad4d);}return _0x190dfa['save']();};}function saveUpdates(_0xce10f7,_0x66618){return function(_0x3543b3){if(_0x3543b3){return _0x3543b3[_0xec27('0x27')](_0xce10f7)[_0xec27('0x28')](function(_0x904ee4){return _0x904ee4;});}return null;};}function removeEntity(_0x45bda7,_0x4016f3){return function(_0x1b900c){if(_0x1b900c){return _0x1b900c[_0xec27('0x29')]()[_0xec27('0x28')](function(){var _0x1aefb7=_0x1b900c[_0xec27('0x2a')]({'plain':!![]});var _0x5b6e9e=_0xec27('0x2b');return db[_0xec27('0x2c')][_0xec27('0x29')]({'where':{'type':_0x5b6e9e,'resourceId':_0x1aefb7['id']}})[_0xec27('0x28')](function(){return _0x1b900c;});})['then'](function(){_0x45bda7[_0xec27('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4287b6,_0x4166a5){return function(_0x219d27){if(!_0x219d27){_0x4287b6['sendStatus'](0x194);}return _0x219d27;};}function handleError(_0x591d5b,_0xe54395){_0xe54395=_0xe54395||0x1f4;return function(_0x1498bf){logger[_0xec27('0x2d')](_0x1498bf[_0xec27('0x2e')]);if(_0x1498bf[_0xec27('0x2f')]){delete _0x1498bf['name'];}_0x591d5b[_0xec27('0x1e')](_0xe54395)[_0xec27('0x30')](_0x1498bf);};}function getMustacheRender(_0x58d034,_0x691c9b){return Mustache[_0xec27('0x31')](_0x58d034,_[_0xec27('0x32')](_0x691c9b[_0xec27('0x33')],{'contact':_0x691c9b[_0xec27('0x34')],'message':_0x691c9b[_0xec27('0x35')],'agent':_0x691c9b['agent'],'interaction':_0x691c9b[_0xec27('0x36')],'account':_0x691c9b[_0xec27('0x37')]}))||'';}exports['index']=function(_0x2c673f,_0xde31d2){var _0x3759e9={},_0x467b5e={},_0x5aa51b={'count':0x0,'rows':[]};var _0x3eda1c=_['map'](db[_0xec27('0x38')][_0xec27('0x39')],function(_0x22c308){return{'name':_0x22c308[_0xec27('0x3a')],'type':_0x22c308[_0xec27('0x3b')][_0xec27('0x3c')]};});_0x467b5e['model']=_[_0xec27('0x3d')](_0x3eda1c,_0xec27('0x2f'));_0x467b5e[_0xec27('0x3e')]=_[_0xec27('0x3f')](_0x2c673f[_0xec27('0x3e')]);_0x467b5e[_0xec27('0x40')]=_[_0xec27('0x41')](_0x467b5e[_0xec27('0x42')],_0x467b5e[_0xec27('0x3e')]);_0x3759e9[_0xec27('0x43')]=_['intersection'](_0x467b5e[_0xec27('0x42')],qs['fields'](_0x2c673f[_0xec27('0x3e')][_0xec27('0x44')]));_0x3759e9[_0xec27('0x43')]=_0x3759e9[_0xec27('0x43')][_0xec27('0x45')]?_0x3759e9['attributes']:_0x467b5e['model'];if(!_0x2c673f['query'][_0xec27('0x46')](_0xec27('0x47'))){_0x3759e9[_0xec27('0x23')]=qs['limit'](_0x2c673f['query']['limit']);_0x3759e9[_0xec27('0x22')]=qs[_0xec27('0x22')](_0x2c673f['query'][_0xec27('0x22')]);}_0x3759e9[_0xec27('0x48')]=qs[_0xec27('0x49')](_0x2c673f[_0xec27('0x3e')]['sort']);delete _0x2c673f[_0xec27('0x3e')][_0xec27('0x49')];_0x3759e9['where']=qs[_0xec27('0x40')](_[_0xec27('0x4a')](_0x2c673f['query'],_0x467b5e[_0xec27('0x40')]),_0x3eda1c);if(_0x2c673f['query'][_0xec27('0x4b')]){_0x3759e9[_0xec27('0x4c')]=_['merge'](_0x3759e9['where'],{'$or':_[_0xec27('0x3d')](_0x3eda1c,function(_0xbfede1){if(_0xbfede1[_0xec27('0x3b')]!==_0xec27('0x4d')){var _0x5f5442={};_0x5f5442[_0xbfede1[_0xec27('0x2f')]]={'$like':'%'+_0x2c673f[_0xec27('0x3e')]['filter']+'%'};return _0x5f5442;}})});}_0x3759e9=_[_0xec27('0x32')]({},_0x3759e9,_0x2c673f['options']);var _0x732334={'where':_0x3759e9[_0xec27('0x4c')]};return db[_0xec27('0x38')]['count'](_0x732334)[_0xec27('0x28')](function(_0x3165f3){_0x5aa51b[_0xec27('0x21')]=_0x3165f3;if(_0x2c673f['query'][_0xec27('0x4e')]){_0x3759e9[_0xec27('0x4f')]=[{'all':!![]}];}return db[_0xec27('0x38')][_0xec27('0x50')](_0x3759e9);})['then'](function(_0x15c3f1){_0x5aa51b[_0xec27('0x51')]=_0x15c3f1;return _0x5aa51b;})[_0xec27('0x28')](respondWithFilteredResult(_0xde31d2,_0x3759e9))[_0xec27('0x52')](handleError(_0xde31d2,null));};exports['show']=function(_0x34e47c,_0x5c31e0){var _0x5d19ba={'raw':![],'where':{'id':_0x34e47c[_0xec27('0x53')]['id']}},_0x52f60e={};_0x52f60e[_0xec27('0x42')]=_[_0xec27('0x3f')](db[_0xec27('0x38')]['rawAttributes']);_0x52f60e['query']=_['keys'](_0x34e47c[_0xec27('0x3e')]);_0x52f60e[_0xec27('0x40')]=_[_0xec27('0x41')](_0x52f60e[_0xec27('0x42')],_0x52f60e[_0xec27('0x3e')]);_0x5d19ba[_0xec27('0x43')]=_[_0xec27('0x41')](_0x52f60e['model'],qs[_0xec27('0x44')](_0x34e47c['query'][_0xec27('0x44')]));_0x5d19ba[_0xec27('0x43')]=_0x5d19ba['attributes'][_0xec27('0x45')]?_0x5d19ba[_0xec27('0x43')]:_0x52f60e[_0xec27('0x42')];if(_0x34e47c[_0xec27('0x3e')][_0xec27('0x4e')]){_0x5d19ba[_0xec27('0x4f')]=[{'all':!![]}];}_0x5d19ba=_['merge']({},_0x5d19ba,_0x34e47c[_0xec27('0x54')]);return db[_0xec27('0x38')][_0xec27('0x55')](_0x5d19ba)[_0xec27('0x28')](handleEntityNotFound(_0x5c31e0,null))[_0xec27('0x28')](respondWithResult(_0x5c31e0,null))[_0xec27('0x52')](handleError(_0x5c31e0,null));};exports[_0xec27('0x27')]=function(_0x2ca3c0,_0x34ea4f){if(_0x2ca3c0[_0xec27('0x33')]['id']){delete _0x2ca3c0['body']['id'];}return db[_0xec27('0x38')][_0xec27('0x55')]({'where':{'id':_0x2ca3c0[_0xec27('0x53')]['id']}})[_0xec27('0x28')](handleEntityNotFound(_0x34ea4f,null))[_0xec27('0x28')](saveUpdates(_0x2ca3c0[_0xec27('0x33')],null))[_0xec27('0x28')](respondWithResult(_0x34ea4f,null))[_0xec27('0x52')](handleError(_0x34ea4f,null));};exports[_0xec27('0x56')]=function(_0x17930d,_0xaf2870,_0x2f7af7){return db[_0xec27('0x57')][_0xec27('0x58')](function(_0x4be009){if(_0x17930d[_0xec27('0x33')][_0xec27('0x59')]===_0xec27('0x5a')){_0x17930d['body'][_0xec27('0x5b')]=path[_0xec27('0x5c')](config[_0xec27('0x5d')],'server/files/moh',_0x17930d[_0xec27('0x33')][_0xec27('0x2f')]);}return db['VoiceMusicOnHold'][_0xec27('0x56')](_0x17930d[_0xec27('0x33')],{'transaction':_0x4be009})[_0xec27('0x28')](function(_0x4fc918){if(_0x17930d['body']['mode']===_0xec27('0x5a')){fs[_0xec27('0x5e')](_0x4fc918[_0xec27('0x5b')],parseInt(_0xec27('0x5f'),0x8));}var _0x1ec337=_0x17930d['user'][_0xec27('0x2a')]({'plain':!![]});if(!_0x1ec337)throw new Error(_0xec27('0x60'));if(_0x1ec337['role']===_0xec27('0x61')){var _0xbc597e=_0x4fc918[_0xec27('0x2a')]({'plain':!![]});return db[_0xec27('0x62')]['find']({'where':{'name':_0xec27('0x2b'),'userProfileId':_0x1ec337[_0xec27('0x63')]},'raw':!![]})[_0xec27('0x28')](function(_0x182d24){if(_0x182d24&&_0x182d24[_0xec27('0x64')]===0x0){return db['UserProfileResource'][_0xec27('0x56')]({'name':_0xbc597e['name'],'resourceId':_0xbc597e['id'],'type':_0x182d24[_0xec27('0x2f')],'sectionId':_0x182d24['id']},{})[_0xec27('0x28')](function(){return _0x4fc918;});}else{return _0x4fc918;}})[_0xec27('0x52')](function(_0x2973a7){logger[_0xec27('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2973a7);});}return _0x4fc918;});})[_0xec27('0x28')](respondWithResult(_0xaf2870,0xc9))[_0xec27('0x52')](handleError(_0xaf2870,null));};exports[_0xec27('0x29')]=function(_0x426cd4,_0x52f439,_0x2adb4a){var _0x2e76ea;return db['VoiceMusicOnHold'][_0xec27('0x55')]({'where':{'id':_0x426cd4[_0xec27('0x53')]['id']}})[_0xec27('0x28')](function(_0x51e41f){if(_0x51e41f){return db['sequelize'][_0xec27('0x58')](function(_0x29ca5a){return _0x51e41f[_0xec27('0x29')]({'transaction':_0x29ca5a,'raw':!![]})[_0xec27('0x28')](function(_0x597e71){if(_0x597e71['directory']){fs['readdirSync'](_0x597e71[_0xec27('0x5b')])[_0xec27('0x65')](function(_0x5bb4df){fs[_0xec27('0x66')](path[_0xec27('0x5c')](_0x597e71[_0xec27('0x5b')],_0x5bb4df));});fs[_0xec27('0x67')](_0x597e71['directory']);}return _0x597e71;});})['catch'](function(_0x281842){throw new db[(_0xec27('0x68'))][(_0xec27('0x69'))](_0x281842['message']);});}})[_0xec27('0x28')](handleEntityNotFound(_0x52f439,null))[_0xec27('0x28')](removeEntity(_0x52f439,null))['catch'](handleError(_0x52f439,null));};exports[_0xec27('0x6a')]=function(_0xd006fe,_0x522bbb,_0xfd78d5){return db[_0xec27('0x57')][_0xec27('0x58')](function(_0x439889){var _0x59928d;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xd006fe[_0xec27('0x53')]['id']}})[_0xec27('0x28')](function(_0x67023d){if(_0x67023d){_0x59928d=_0x67023d;return _0x67023d[_0xec27('0x6a')](_0xd006fe['body']['id'],{'transaction':_0x439889});}})['then'](function(_0x2991c4){if(_0x2991c4){return db[_0xec27('0x6b')]['findOne']({'where':{'id':_0xd006fe[_0xec27('0x33')]['id']},'attributes':['id',_0xec27('0x2f'),_0xec27('0x6c'),_0xec27('0x6d'),_0xec27('0x6e')],'raw':!![]});}})['then'](function(_0x54d2d7){if(_0x54d2d7){var _0x4245ed=path[_0xec27('0x5c')](config[_0xec27('0x5d')],_0xec27('0x6f'),util['format'](_0xec27('0x70'),path[_0xec27('0x71')](_0x54d2d7['save_name'],path[_0xec27('0x72')](_0x54d2d7['save_name'])),_0x54d2d7[_0xec27('0x6d')]));var _0x1d8d2d=path[_0xec27('0x5c')](config[_0xec27('0x5d')],_0xec27('0x73'),_0x59928d[_0xec27('0x2f')],util[_0xec27('0x74')](_0xec27('0x70'),_0x54d2d7[_0xec27('0x2f')],_0x54d2d7[_0xec27('0x6d')]));fs[_0xec27('0x75')](_0x4245ed,_0x1d8d2d);return _0x54d2d7;}})['catch'](function(_0xd746e5){throw new db['Sequelize'][(_0xec27('0x69'))](_0xd746e5[_0xec27('0x35')]);});})[_0xec27('0x28')](handleEntityNotFound(_0x522bbb,null))[_0xec27('0x28')](respondWithResult(_0x522bbb,0xc9))[_0xec27('0x52')](handleError(_0x522bbb,null));};exports[_0xec27('0x76')]=function(_0x2d8404,_0x5d8992,_0x5ddb08){return db[_0xec27('0x57')][_0xec27('0x58')](function(_0x378f5f){var _0x701db1;return db[_0xec27('0x38')][_0xec27('0x77')]({'where':{'id':_0x2d8404[_0xec27('0x53')]['id']}})[_0xec27('0x28')](handleEntityNotFound(_0x5d8992,null))['then'](function(_0x5e0c65){if(_0x5e0c65){_0x701db1=_0x5e0c65;return _0x5e0c65['removeSound'](_0x2d8404[_0xec27('0x53')][_0xec27('0x78')]);}})[_0xec27('0x28')](function(_0x91b834){if(_0x91b834){return db[_0xec27('0x6b')][_0xec27('0x77')]({'where':{'id':_0x2d8404['params'][_0xec27('0x78')]},'attributes':['id',_0xec27('0x2f'),_0xec27('0x6c'),'converted_format',_0xec27('0x6e')],'raw':!![]});}})[_0xec27('0x28')](function(_0x31d57b){if(_0x31d57b){fs[_0xec27('0x66')](path[_0xec27('0x5c')](_0x701db1[_0xec27('0x5b')],util[_0xec27('0x74')]('%s.%s',_0x31d57b[_0xec27('0x2f')],_0x31d57b['converted_format'])));return _0x31d57b;}})[_0xec27('0x52')](function(_0x519c77){throw new db['Sequelize']['ValidationError'](_0x519c77['message']);});})['then'](handleEntityNotFound(_0x5d8992,null))[_0xec27('0x28')](respondWithStatusCode(_0x5d8992,0xcc))[_0xec27('0x52')](handleError(_0x5d8992,null));};exports[_0xec27('0x79')]=function(_0x3b600d,_0x45d8ac,_0x1b69a3){var _0x4e8ef7={};var _0x61be7b={};var _0x398048;var _0x19f76b;return db[_0xec27('0x38')]['findOne']({'where':{'id':_0x3b600d['params']['id']}})[_0xec27('0x28')](handleEntityNotFound(_0x45d8ac,null))[_0xec27('0x28')](function(_0x2ac71c){if(_0x2ac71c){_0x398048=_0x2ac71c;_0x61be7b[_0xec27('0x42')]=_['keys'](db[_0xec27('0x6b')]['rawAttributes']);_0x61be7b[_0xec27('0x3e')]=_[_0xec27('0x3f')](_0x3b600d[_0xec27('0x3e')]);_0x61be7b[_0xec27('0x40')]=_[_0xec27('0x41')](_0x61be7b[_0xec27('0x42')],_0x61be7b[_0xec27('0x3e')]);_0x4e8ef7[_0xec27('0x43')]=_[_0xec27('0x41')](_0x61be7b[_0xec27('0x42')],qs[_0xec27('0x44')](_0x3b600d[_0xec27('0x3e')]['fields']));_0x4e8ef7[_0xec27('0x43')]=_0x4e8ef7[_0xec27('0x43')][_0xec27('0x45')]?_0x4e8ef7[_0xec27('0x43')]:_0x61be7b[_0xec27('0x42')];_0x4e8ef7[_0xec27('0x48')]=qs[_0xec27('0x49')](_0x3b600d['query'][_0xec27('0x49')]);_0x4e8ef7[_0xec27('0x4c')]=qs[_0xec27('0x40')](_['pick'](_0x3b600d[_0xec27('0x3e')],_0x61be7b[_0xec27('0x40')]));if(_0x3b600d[_0xec27('0x3e')][_0xec27('0x4b')]){_0x4e8ef7[_0xec27('0x4c')]=_['merge'](_0x4e8ef7[_0xec27('0x4c')],{'$or':_[_0xec27('0x3d')](_0x4e8ef7[_0xec27('0x43')],function(_0x547b6f){var _0x43d030={};_0x43d030[_0x547b6f]={'$like':'%'+_0x3b600d[_0xec27('0x3e')]['filter']+'%'};return _0x43d030;})});}_0x4e8ef7=_[_0xec27('0x32')]({},_0x4e8ef7,_0x3b600d[_0xec27('0x54')]);return _0x398048['getSounds'](_0x4e8ef7);}})[_0xec27('0x28')](function(_0x430184){if(_0x430184){_0x19f76b=_0x430184['length'];if(!_0x3b600d[_0xec27('0x3e')][_0xec27('0x46')](_0xec27('0x47'))){_0x4e8ef7[_0xec27('0x23')]=qs[_0xec27('0x23')](_0x3b600d[_0xec27('0x3e')][_0xec27('0x23')]);_0x4e8ef7[_0xec27('0x22')]=qs[_0xec27('0x22')](_0x3b600d[_0xec27('0x3e')][_0xec27('0x22')]);}return _0x398048[_0xec27('0x79')](_0x4e8ef7);}})[_0xec27('0x28')](function(_0x301e25){if(_0x301e25){return _0x301e25?{'count':_0x19f76b,'rows':_0x301e25}:null;}})[_0xec27('0x28')](respondWithResult(_0x45d8ac,null))['catch'](handleError(_0x45d8ac,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c0ac627..3f01c33 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb19b=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x2b2c7f,_0x4c987){var _0x5aa2c2=function(_0x5080b1){while(--_0x5080b1){_0x2b2c7f['push'](_0x2b2c7f['shift']());}};_0x5aa2c2(++_0x4c987);}(_0xb19b,0x117));var _0xbb19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb19b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb19('0x0'));var util=require(_0xbb19('0x1'));var logger=require(_0xbb19('0x2'))('api');var moment=require(_0xbb19('0x3'));var BPromise=require(_0xbb19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb19('0x5'));var rimraf=require('rimraf');var config=require(_0xbb19('0x6'));var attributes=require(_0xbb19('0x7'));module[_0xbb19('0x8')]=function(_0xb224bb,_0x246bac){return _0xb224bb[_0xbb19('0x9')](_0xbb19('0xa'),attributes,{'tableName':_0xbb19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca2=['voice_musiconhold','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold'];(function(_0x25eb68,_0x2b9197){var _0x359151=function(_0x32ea66){while(--_0x32ea66){_0x25eb68['push'](_0x25eb68['shift']());}};_0x359151(++_0x2b9197);}(_0x6ca2,0x161));var _0x26ca=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6ca2[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x26ca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x26ca('0x1'));var moment=require(_0x26ca('0x2'));var BPromise=require(_0x26ca('0x3'));var rp=require(_0x26ca('0x4'));var fs=require('fs');var path=require(_0x26ca('0x5'));var rimraf=require(_0x26ca('0x6'));var config=require(_0x26ca('0x7'));var attributes=require(_0x26ca('0x8'));module['exports']=function(_0x16ca4f,_0x5efcdd){return _0x16ca4f['define'](_0x26ca('0x9'),attributes,{'tableName':_0x26ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 70e66ce..d5cf939 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4501=['error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x52fdf4,_0x5d5597){var _0x3d4db7=function(_0x3a7426){while(--_0x3a7426){_0x52fdf4['push'](_0x52fdf4['shift']());}};_0x3d4db7(++_0x5d5597);}(_0x4501,0x1d9));var _0x1450=function(_0xf4dd47,_0x4aff75){_0xf4dd47=_0xf4dd47-0x0;var _0x3745ae=_0x4501[_0xf4dd47];return _0x3745ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1450('0x0'));var fs=require('fs');var Redis=require(_0x1450('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1450('0x2'));var logger=require('../../config/logger')(_0x1450('0x3'));var config=require(_0x1450('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1450('0x5')][_0x1450('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1bad99,_0x152141,_0x4287b6){return new BPromise(function(_0x2cc5f3,_0x36ddda){return client[_0x1450('0x7')](_0x1bad99,_0x4287b6)['then'](function(_0x2fe4ae){logger[_0x1450('0x8')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x1450('0x9'));logger[_0x1450('0xa')](_0x1450('0xb'),_0x152141,_0x1450('0x9'),JSON[_0x1450('0xc')](_0x2fe4ae));if(_0x2fe4ae[_0x1450('0xd')]){if(_0x2fe4ae[_0x1450('0xd')][_0x1450('0xe')]===0x1f4){logger['error'](_0x1450('0xf'),_0x152141,_0x2fe4ae[_0x1450('0xd')]['message']);return _0x36ddda(_0x2fe4ae['error'][_0x1450('0x10')]);}logger[_0x1450('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x2fe4ae[_0x1450('0xd')][_0x1450('0x10')]);return _0x2cc5f3(_0x2fe4ae[_0x1450('0xd')][_0x1450('0x10')]);}else{logger[_0x1450('0x8')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x1450('0x9'));_0x2cc5f3(_0x2fe4ae['result']['message']);}})[_0x1450('0x11')](function(_0x4a8879){logger[_0x1450('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x152141,_0x4a8879);_0x36ddda(_0x4a8879);});});} \ No newline at end of file +var _0x4c54=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0x4c54,0x18b));var _0x44c5=function(_0x193ba8,_0x23eeb2){_0x193ba8=_0x193ba8-0x0;var _0x4430dc=_0x4c54[_0x193ba8];return _0x4430dc;};'use strict';var _=require(_0x44c5('0x0'));var util=require(_0x44c5('0x1'));var moment=require('moment');var BPromise=require(_0x44c5('0x2'));var rs=require(_0x44c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44c5('0x4'))['db'];var utils=require(_0x44c5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x44c5('0x6'));var jayson=require(_0x44c5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x315d85,_0x4050d5,_0x47223a){return new BPromise(function(_0x47d1f2,_0x20bdfb){return client[_0x44c5('0x8')](_0x315d85,_0x47223a)['then'](function(_0x2826c7){logger['info'](_0x44c5('0x9'),_0x4050d5,_0x44c5('0xa'));logger[_0x44c5('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x4050d5,_0x44c5('0xa'),JSON['stringify'](_0x2826c7));if(_0x2826c7[_0x44c5('0xc')]){if(_0x2826c7['error'][_0x44c5('0xd')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x4050d5,_0x2826c7[_0x44c5('0xc')][_0x44c5('0xe')]);return _0x20bdfb(_0x2826c7['error'][_0x44c5('0xe')]);}logger[_0x44c5('0xc')](_0x44c5('0x9'),_0x4050d5,_0x2826c7[_0x44c5('0xc')]['message']);return _0x47d1f2(_0x2826c7[_0x44c5('0xc')][_0x44c5('0xe')]);}else{logger[_0x44c5('0xf')](_0x44c5('0x9'),_0x4050d5,_0x44c5('0xa'));_0x47d1f2(_0x2826c7[_0x44c5('0x10')]['message']);}})[_0x44c5('0x11')](function(_0x32c14b){logger[_0x44c5('0xc')](_0x44c5('0x9'),_0x4050d5,_0x32c14b);_0x20bdfb(_0x32c14b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 920db53..33f1e4e 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdbd=['put','/:id','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','describe','get','show','/:id/users','getAgents','post','create','addAgents'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0xfdbd[_0x2fa457];return _0x4f250a;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xd')](_0xdfdb('0xf'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0x11')]('/',auth['isAuthenticated'](),controller[_0xdfdb('0x12')]);router[_0xdfdb('0x11')]('/:id/users',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x13')]);router[_0xdfdb('0x14')](_0xdfdb('0x15'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x16')]);router[_0xdfdb('0x17')](_0xdfdb('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0xdfdb('0x17')]('/:id/users',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x18')]);module[_0xdfdb('0x19')]=router; \ No newline at end of file +var _0xfcf0=['describe','/:id','show','/:id/users','getAgents','create','post','addAgents','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0xfcf0[_0x2d8434];return _0x26b9e4;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['post']('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x12')]);router[_0x0fcf('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x0fcf('0x14')]);router[_0x0fcf('0x15')]('/:id',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x16')]);router[_0x0fcf('0x17')](_0x0fcf('0xe'),auth[_0x0fcf('0xa')](),controller['destroy']);router[_0x0fcf('0x17')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller['removeAgents']);module[_0x0fcf('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1681dd5..1807298 100644 --- a/server/api/voicePrefix/voicePrefix.attributes.js +++ b/server/api/voicePrefix/voicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa45d=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','name'];(function(_0x55d60c,_0x414b89){var _0x20624b=function(_0x190508){while(--_0x190508){_0x55d60c['push'](_0x55d60c['shift']());}};_0x20624b(++_0x414b89);}(_0xa45d,0x19a));var _0xda45=function(_0x2a3258,_0x47504d){_0x2a3258=_0x2a3258-0x0;var _0x225758=_0xa45d[_0x2a3258];return _0x225758;};'use strict';var Sequelize=require(_0xda45('0x0'));module[_0xda45('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xda45('0x2')},'prefix':{'type':Sequelize[_0xda45('0x3')],'get':function(_0xaef1e6){return _0xda45('0x4')+this[_0xda45('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xda45('0x6')]}}; \ No newline at end of file +var _0x5f6a=['VIRTUAL','system-','STRING','INTEGER','sequelize','name'];(function(_0x39c168,_0x1ab5c8){var _0x40f01f=function(_0x36812f){while(--_0x36812f){_0x39c168['push'](_0x39c168['shift']());}};_0x40f01f(++_0x1ab5c8);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x13d82f,_0xdea877){_0x13d82f=_0x13d82f-0x0;var _0xb48ed2=_0x5f6a[_0x13d82f];return _0xb48ed2;};'use strict';var Sequelize=require(_0xa5f6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa5f6('0x1')},'prefix':{'type':Sequelize[_0xa5f6('0x2')],'get':function(_0x2e23f3){return _0xa5f6('0x3')+this['getDataValue'](_0xa5f6('0x1'))+'-';}},'description':{'type':Sequelize[_0xa5f6('0x4')]},'callerIdAll':{'type':Sequelize[_0xa5f6('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0xa5f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ccb4d3f..a1226d9 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x475b=['bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','end','error','name','send','render','merge','body','contact','message','agent','interaction','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','VoicePrefix','include','findAll','rows','catch','show','params','find','create','sequelize','VoiceExtension','VoiceExtensionId','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0x475b,0x1a2));var _0xb475=function(_0x30f730,_0x5a1aad){_0x30f730=_0x30f730-0x0;var _0x4b3c3d=_0x475b[_0x30f730];return _0x4b3c3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb475('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb475('0x1'));var rp=require(_0xb475('0x2'));var moment=require(_0xb475('0x3'));var BPromise=require(_0xb475('0x4'));var Mustache=require(_0xb475('0x5'));var util=require(_0xb475('0x6'));var path=require(_0xb475('0x7'));var sox=require('sox');var csv=require(_0xb475('0x8'));var ejs=require(_0xb475('0x9'));var fs=require('fs');var fs_extra=require(_0xb475('0xa'));var _=require(_0xb475('0xb'));var squel=require(_0xb475('0xc'));var crypto=require(_0xb475('0xd'));var jsforce=require(_0xb475('0xe'));var deskjs=require(_0xb475('0xf'));var toCsv=require(_0xb475('0x8'));var querystring=require(_0xb475('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb475('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb475('0x12'));var hardwareService=require(_0xb475('0x13'));var logger=require('../../config/logger')(_0xb475('0x14'));var utils=require('../../config/utils');var config=require(_0xb475('0x15'));var licenseUtil=require(_0xb475('0x16'));var db=require('../../mysqldb')['db'];config[_0xb475('0x17')]=_[_0xb475('0x18')](config[_0xb475('0x17')],{'host':_0xb475('0x19'),'port':0x18eb});var socket=require(_0xb475('0x1a'))(new Redis(config[_0xb475('0x17')]));require(_0xb475('0x1b'))[_0xb475('0x1c')](socket);function respondWithStatusCode(_0x39db37,_0x211f4a){_0x211f4a=_0x211f4a||0xcc;return function(_0x11c88f){if(_0x11c88f){return _0x39db37[_0xb475('0x1d')](_0x211f4a);}return _0x39db37[_0xb475('0x1e')](_0x211f4a)['end']();};}function respondWithResult(_0x3a6a44,_0x3b2a58){_0x3b2a58=_0x3b2a58||0xc8;return function(_0x3e00fa){if(_0x3e00fa){return _0x3a6a44[_0xb475('0x1e')](_0x3b2a58)[_0xb475('0x1f')](_0x3e00fa);}};}function respondWithFilteredResult(_0x76ff77,_0x408fc8){return function(_0x489f8c){if(_0x489f8c){var _0x31c505=typeof _0x408fc8[_0xb475('0x20')]===_0xb475('0x21')&&typeof _0x408fc8['limit']===_0xb475('0x21');var _0x703023=_0x489f8c[_0xb475('0x22')];var _0x55f7ce=_0x31c505?0x0:_0x408fc8[_0xb475('0x20')];var _0x1a6fb3=_0x31c505?_0x489f8c[_0xb475('0x22')]:_0x408fc8[_0xb475('0x20')]+_0x408fc8['limit'];var _0x53b596;if(_0x1a6fb3>=_0x703023){_0x1a6fb3=_0x703023;_0x53b596=0xc8;}else{_0x53b596=0xce;}_0x76ff77[_0xb475('0x1e')](_0x53b596);return _0x76ff77[_0xb475('0x23')](_0xb475('0x24'),_0x55f7ce+'-'+_0x1a6fb3+'/'+_0x703023)[_0xb475('0x1f')](_0x489f8c);}return null;};}function patchUpdates(_0x481e57){return function(_0x151748){try{jsonpatch[_0xb475('0x25')](_0x151748,_0x481e57,!![]);}catch(_0x1e3540){return BPromise[_0xb475('0x26')](_0x1e3540);}return _0x151748['save']();};}function saveUpdates(_0x5852d2,_0x4e63bc){return function(_0x4a70aa){if(_0x4a70aa){return _0x4a70aa[_0xb475('0x27')](_0x5852d2)[_0xb475('0x28')](function(_0x26f527){return _0x26f527;});}return null;};}function removeEntity(_0x2a8f17,_0x5bf5dd){return function(_0x5e73c0){if(_0x5e73c0){return _0x5e73c0[_0xb475('0x29')]()['then'](function(){var _0xb8f9d=_0x5e73c0['get']({'plain':!![]});var _0x45fb5b=_0xb475('0x2a');return db[_0xb475('0x2b')][_0xb475('0x29')]({'where':{'type':_0x45fb5b,'resourceId':_0xb8f9d['id']}})['then'](function(){return _0x5e73c0;});})[_0xb475('0x28')](function(){_0x2a8f17[_0xb475('0x1e')](0xcc)[_0xb475('0x2c')]();});}};}function handleEntityNotFound(_0x6da704,_0x993adb){return function(_0x240c73){if(!_0x240c73){_0x6da704['sendStatus'](0x194);}return _0x240c73;};}function handleError(_0x1fdd9a,_0x14597d){_0x14597d=_0x14597d||0x1f4;return function(_0x58a621){logger[_0xb475('0x2d')](_0x58a621['stack']);if(_0x58a621[_0xb475('0x2e')]){delete _0x58a621[_0xb475('0x2e')];}_0x1fdd9a[_0xb475('0x1e')](_0x14597d)[_0xb475('0x2f')](_0x58a621);};}function getMustacheRender(_0x1efef6,_0x5e3210){return Mustache[_0xb475('0x30')](_0x1efef6,_[_0xb475('0x31')](_0x5e3210[_0xb475('0x32')],{'contact':_0x5e3210[_0xb475('0x33')],'message':_0x5e3210[_0xb475('0x34')],'agent':_0x5e3210[_0xb475('0x35')],'interaction':_0x5e3210[_0xb475('0x36')],'account':_0x5e3210['account']}))||'';}exports['index']=function(_0x9fb3a4,_0x2adabd){var _0x3726d6={},_0x1385f6={},_0x59f9f8={'count':0x0,'rows':[]};var _0xe2dde3=_['map'](db['VoicePrefix'][_0xb475('0x37')],function(_0x4afff4){return{'name':_0x4afff4['fieldName'],'type':_0x4afff4[_0xb475('0x38')]['key']};});_0x1385f6[_0xb475('0x39')]=_[_0xb475('0x3a')](_0xe2dde3,_0xb475('0x2e'));_0x1385f6[_0xb475('0x3b')]=_[_0xb475('0x3c')](_0x9fb3a4[_0xb475('0x3b')]);_0x1385f6[_0xb475('0x3d')]=_[_0xb475('0x3e')](_0x1385f6[_0xb475('0x39')],_0x1385f6[_0xb475('0x3b')]);_0x3726d6[_0xb475('0x3f')]=_[_0xb475('0x3e')](_0x1385f6[_0xb475('0x39')],qs['fields'](_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x40')]));_0x3726d6[_0xb475('0x3f')]=_0x3726d6[_0xb475('0x3f')][_0xb475('0x41')]?_0x3726d6[_0xb475('0x3f')]:_0x1385f6[_0xb475('0x39')];if(!_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x42')](_0xb475('0x43'))){_0x3726d6[_0xb475('0x44')]=qs[_0xb475('0x44')](_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x44')]);_0x3726d6['offset']=qs[_0xb475('0x20')](_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x20')]);}_0x3726d6[_0xb475('0x45')]=qs[_0xb475('0x46')](_0x9fb3a4['query']['sort']);_0x3726d6['where']=qs[_0xb475('0x3d')](_[_0xb475('0x47')](_0x9fb3a4[_0xb475('0x3b')],_0x1385f6['filters']),_0xe2dde3);if(_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x48')]){_0x3726d6[_0xb475('0x49')]=_['merge'](_0x3726d6[_0xb475('0x49')],{'$or':_['map'](_0xe2dde3,function(_0x3ca350){if(_0x3ca350[_0xb475('0x38')]!==_0xb475('0x4a')){var _0x2ce946={};_0x2ce946[_0x3ca350[_0xb475('0x2e')]]={'$like':'%'+_0x9fb3a4[_0xb475('0x3b')][_0xb475('0x48')]+'%'};return _0x2ce946;}})});}_0x3726d6=_[_0xb475('0x31')]({},_0x3726d6,_0x9fb3a4[_0xb475('0x4b')]);var _0xab9c54={'where':_0x3726d6[_0xb475('0x49')]};return db[_0xb475('0x4c')][_0xb475('0x22')](_0xab9c54)['then'](function(_0x221825){_0x59f9f8[_0xb475('0x22')]=_0x221825;if(_0x9fb3a4[_0xb475('0x3b')]['includeAll']){_0x3726d6[_0xb475('0x4d')]=[{'all':!![]}];}return db[_0xb475('0x4c')][_0xb475('0x4e')](_0x3726d6);})[_0xb475('0x28')](function(_0x1f3de6){_0x59f9f8[_0xb475('0x4f')]=_0x1f3de6;return _0x59f9f8;})[_0xb475('0x28')](respondWithFilteredResult(_0x2adabd,_0x3726d6))[_0xb475('0x50')](handleError(_0x2adabd,null));};exports[_0xb475('0x51')]=function(_0x3ae756,_0x395284){var _0x29a489={'raw':![],'where':{'id':_0x3ae756[_0xb475('0x52')]['id']}},_0x3c292c={};_0x3c292c['model']=_[_0xb475('0x3c')](db[_0xb475('0x4c')][_0xb475('0x37')]);_0x3c292c[_0xb475('0x3b')]=_[_0xb475('0x3c')](_0x3ae756[_0xb475('0x3b')]);_0x3c292c[_0xb475('0x3d')]=_[_0xb475('0x3e')](_0x3c292c[_0xb475('0x39')],_0x3c292c['query']);_0x29a489[_0xb475('0x3f')]=_[_0xb475('0x3e')](_0x3c292c[_0xb475('0x39')],qs[_0xb475('0x40')](_0x3ae756['query'][_0xb475('0x40')]));_0x29a489[_0xb475('0x3f')]=_0x29a489[_0xb475('0x3f')]['length']?_0x29a489['attributes']:_0x3c292c[_0xb475('0x39')];if(_0x3ae756[_0xb475('0x3b')]['includeAll']){_0x29a489[_0xb475('0x4d')]=[{'all':!![]}];}_0x29a489=_[_0xb475('0x31')]({},_0x29a489,_0x3ae756[_0xb475('0x4b')]);return db['VoicePrefix'][_0xb475('0x53')](_0x29a489)[_0xb475('0x28')](handleEntityNotFound(_0x395284,null))['then'](respondWithResult(_0x395284,null))[_0xb475('0x50')](handleError(_0x395284,null));};exports[_0xb475('0x29')]=function(_0xd8e393,_0x2a436a){return db['VoicePrefix'][_0xb475('0x53')]({'where':{'id':_0xd8e393[_0xb475('0x52')]['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x2a436a,null))[_0xb475('0x28')](removeEntity(_0x2a436a,null))[_0xb475('0x50')](handleError(_0x2a436a,null));};exports['describe']=function(_0xf08fc6,_0xa82afa){return db[_0xb475('0x4c')]['describe']()['then'](respondWithResult(_0xa82afa,null))[_0xb475('0x50')](handleError(_0xa82afa,null));};exports[_0xb475('0x54')]=function(_0x30d696,_0x3b4377){var _0x32ed03;return db[_0xb475('0x55')]['transaction'](function(_0x400621){return db[_0xb475('0x4c')][_0xb475('0x54')](_0x30d696[_0xb475('0x32')],{'transaction':_0x400621})['then'](function(_0x9f4c69){_0x32ed03=_0x9f4c69['get']({'plain':!![]});return db[_0xb475('0x56')][_0xb475('0x53')]({'where':{'id':_0x32ed03[_0xb475('0x57')]},'raw':!![]})['then'](function(_0x2f21a4){return createVoicePrefixExtensions(_0x32ed03,_0x2f21a4,_0x400621);});});})[_0xb475('0x28')](function(){var _0x5788db=_0x30d696[_0xb475('0x58')][_0xb475('0x59')]({'plain':!![]});if(!_0x5788db)throw new Error(_0xb475('0x5a'));if(_0x5788db[_0xb475('0x5b')]==='user'){var _0x155f07=_0x32ed03;return db[_0xb475('0x5c')][_0xb475('0x53')]({'where':{'name':_0xb475('0x2a'),'userProfileId':_0x5788db[_0xb475('0x5d')]},'raw':!![]})[_0xb475('0x28')](function(_0x42ca26){if(_0x42ca26&&_0x42ca26['autoAssociation']===0x0){return db[_0xb475('0x2b')][_0xb475('0x54')]({'name':_0x155f07['name'],'resourceId':_0x155f07['id'],'type':_0x42ca26[_0xb475('0x2e')],'sectionId':_0x42ca26['id']},{})[_0xb475('0x28')](function(){return _0x32ed03;});}else{return _0x32ed03;}})[_0xb475('0x50')](function(_0x47d706){logger[_0xb475('0x2d')](_0xb475('0x5e'),_0x47d706);throw _0x47d706;});}return _0x32ed03;})['then'](respondWithResult(_0x3b4377,null))[_0xb475('0x50')](handleError(_0x3b4377,null));};function Extension(_0x5039ed,_0x18c5ca,_0x39e566,_0x342b56){this[_0xb475('0x5f')]='from-sip';this[_0xb475('0x60')]=_0x5039ed;this[_0xb475('0x61')]=_0x39e566;this[_0xb475('0x38')]=_0xb475('0x62');this[_0xb475('0x63')]='Voice\x20Prefix\x20Extension';this[_0xb475('0x64')]=_0x18c5ca;this[_0xb475('0x65')]=_0x342b56;}function createVoicePrefixExtensions(_0x124081,_0x4fbe70,_0x8481a4){return new BPromise(function(_0x42e513,_0x2de7d5){var _0x32408b=new Extension(formatPrefixName(_0x124081[_0xb475('0x66')]),0x1,_0xb475('0x67'),_0xb475('0x68'));_0x32408b[_0xb475('0x69')]=_0x124081['id'];return db[_0xb475('0x56')][_0xb475('0x54')](_0x32408b,{'transaction':_0x8481a4})['then'](function(_0x3facd6){var _0x2ac2af=_0x3facd6[_0xb475('0x59')]({'plain':!![]});var _0x14de11=_[_0xb475('0x3a')](addVoicePrefixExtensions(_0x124081,_0x4fbe70),function(_0x23be0f){_0x23be0f['VoiceExtensionId']=_0x2ac2af['id'];_0x23be0f['VoicePrefixId']=_0x124081['id'];return _0x23be0f;});return db['VoiceExtension'][_0xb475('0x6a')](_0x14de11,{'transaction':_0x8481a4})['then'](function(_0x49fde2){if(!_0x49fde2){return _0x2de7d5(_0xb475('0x6b'));}else{return _0x42e513(_0x49fde2);}})[_0xb475('0x50')](function(_0x2a3821){return _0x2de7d5(_0x2a3821);});});;});};function addVoicePrefixExtensions(_0x5299dd,_0x27fbc9){var _0x14d856=[];var _0x24c911=formatPrefixName(_0x5299dd['prefix']);_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x2,_0xb475('0x6d'),_0xb475('0x6e')+_0x5299dd['name']));if(_0x5299dd[_0xb475('0x6f')]){_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x3,'Set',_0xb475('0x70')+_0x5299dd[_0xb475('0x6f')]));}else{_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x3,_0xb475('0x67'),_0xb475('0x71')));}_0x14d856[_0xb475('0x6c')](new Extension(_0x24c911,0x4,_0xb475('0x72'),_0x27fbc9['context']+','+_0xb475('0x73')+(0x8+_0x5299dd[_0xb475('0x2e')][_0xb475('0x41')])+'}'+','+0x1));return _0x14d856;}function formatPrefixName(_0x353a16){var _0x4d295e='_';for(var _0x404848=0x0;_0x404848<_0x353a16['length'];_0x404848++){if(_0x353a16[_0xb475('0x74')](_0x404848)=='-'){_0x4d295e+=_0x353a16[_0xb475('0x74')](_0x404848);}else{_0x4d295e+='['+_0x353a16[_0xb475('0x74')](_0x404848)+']';}}_0x4d295e+='.';return _0x4d295e;}exports['update']=function(_0x4f9305,_0x359ffe,_0x3e6d48){var _0x389879=_0x4f9305[_0xb475('0x32')];_0x389879[_0xb475('0x66')]=_0xb475('0x75')+_0x389879[_0xb475('0x2e')]+'-';return db[_0xb475('0x55')][_0xb475('0x76')](function(_0x3bd343){return db[_0xb475('0x4c')][_0xb475('0x27')](_0x389879,{'where':{'id':_0x389879['id']},'transaction':_0x3bd343})[_0xb475('0x28')](function(){return db[_0xb475('0x56')][_0xb475('0x29')]({'where':{'VoicePrefixId':_0x389879['id']},'transaction':_0x3bd343})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x389879['VoiceExtensionId']},'raw':!![]})['then'](function(_0x3132ef){return createVoicePrefixExtensions(_0x389879,_0x3132ef,_0x3bd343);});});});})[_0xb475('0x28')](function(){return db[_0xb475('0x4c')][_0xb475('0x77')](_0x389879['id']);})[_0xb475('0x28')](respondWithResult(_0x359ffe,null))[_0xb475('0x50')](handleError(_0x359ffe,null));};exports[_0xb475('0x78')]=function(_0x335565,_0x2671ab,_0x4514b9){return db[_0xb475('0x4c')][_0xb475('0x53')]({'where':{'id':_0x335565['params']['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x2671ab,null))[_0xb475('0x28')](function(_0x4be2a4){if(_0x4be2a4){return _0x4be2a4[_0xb475('0x78')](_0x335565[_0xb475('0x32')][_0xb475('0x79')],_[_0xb475('0x7a')](_0x335565[_0xb475('0x32')],[_0xb475('0x79'),'id'])||{})[_0xb475('0x7b')](function(_0x2121f0){for(var _0x235985=0x0;_0x235985<_0x335565['body'][_0xb475('0x79')][_0xb475('0x41')];_0x235985+=0x1){socket[_0xb475('0x7c')](_0xb475('0x7d'),{'UserId':_0x335565['body'][_0xb475('0x79')][_0x235985],'VoicePrefixId':_0x335565['params']['id']});}return _0x2121f0;});}})[_0xb475('0x28')](respondWithResult(_0x2671ab,null))[_0xb475('0x50')](handleError(_0x2671ab,null));};exports[_0xb475('0x7e')]=function(_0x24cf8b,_0x5a5583,_0x5057aa){return db['VoicePrefix'][_0xb475('0x53')]({'where':{'id':_0x24cf8b[_0xb475('0x52')]['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x5a5583,null))[_0xb475('0x28')](function(_0x453b62){if(_0x453b62){return _0x453b62[_0xb475('0x7e')](_0x24cf8b[_0xb475('0x3b')][_0xb475('0x79')])[_0xb475('0x28')](function(){if(_[_0xb475('0x7f')](_0x24cf8b['query'][_0xb475('0x79')])){for(var _0x27daa5=0x0;_0x27daa5<_0x24cf8b[_0xb475('0x3b')]['ids'][_0xb475('0x41')];_0x27daa5+=0x1){socket[_0xb475('0x7c')](_0xb475('0x80'),{'UserId':Number(_0x24cf8b[_0xb475('0x3b')]['ids'][_0x27daa5]),'VoicePrefixId':Number(_0x24cf8b[_0xb475('0x52')]['id'])});}}else{socket[_0xb475('0x7c')](_0xb475('0x80'),{'UserId':Number(_0x24cf8b[_0xb475('0x3b')][_0xb475('0x79')]),'VoicePrefixId':Number(_0x24cf8b[_0xb475('0x52')]['id'])});}});}})[_0xb475('0x28')](respondWithStatusCode(_0x5a5583,null))[_0xb475('0x50')](handleError(_0x5a5583,null));};exports[_0xb475('0x81')]=function(_0x50edfc,_0x40d08d,_0x7002e8){var _0x499814={};var _0x37b60a={};var _0x317bd7;var _0x1543d3;return db['VoicePrefix']['findOne']({'where':{'id':_0x50edfc['params']['id']}})[_0xb475('0x28')](handleEntityNotFound(_0x40d08d,null))['then'](function(_0x792648){if(_0x792648){_0x317bd7=_0x792648;_0x37b60a['model']=_[_0xb475('0x3c')](db[_0xb475('0x82')][_0xb475('0x37')]);_0x37b60a['query']=_[_0xb475('0x3c')](_0x50edfc[_0xb475('0x3b')]);_0x37b60a[_0xb475('0x3d')]=_[_0xb475('0x3e')](_0x37b60a[_0xb475('0x39')],_0x37b60a['query']);_0x499814[_0xb475('0x3f')]=_['intersection'](_0x37b60a[_0xb475('0x39')],qs['fields'](_0x50edfc[_0xb475('0x3b')][_0xb475('0x40')]));_0x499814['attributes']=_0x499814[_0xb475('0x3f')]['length']?_0x499814[_0xb475('0x3f')]:_0x37b60a[_0xb475('0x39')];_0x499814[_0xb475('0x45')]=qs[_0xb475('0x46')](_0x50edfc[_0xb475('0x3b')]['sort']);_0x499814['where']=qs['filters'](_[_0xb475('0x47')](_0x50edfc['query'],_0x37b60a[_0xb475('0x3d')]));if(_0x50edfc[_0xb475('0x3b')][_0xb475('0x48')]){_0x499814[_0xb475('0x49')]=_[_0xb475('0x31')](_0x499814[_0xb475('0x49')],{'$or':_['map'](_0x499814[_0xb475('0x3f')],function(_0x250703){var _0x419367={};_0x419367[_0x250703]={'$like':'%'+_0x50edfc['query']['filter']+'%'};return _0x419367;})});}_0x499814=_[_0xb475('0x31')]({},_0x499814,_0x50edfc[_0xb475('0x4b')]);return _0x317bd7['getAgents'](_0x499814);}})['then'](function(_0x522b8d){if(_0x522b8d){_0x1543d3=_0x522b8d[_0xb475('0x41')];if(!_0x50edfc[_0xb475('0x3b')]['hasOwnProperty']('nolimit')){_0x499814[_0xb475('0x44')]=qs['limit'](_0x50edfc[_0xb475('0x3b')][_0xb475('0x44')]);_0x499814[_0xb475('0x20')]=qs['offset'](_0x50edfc[_0xb475('0x3b')]['offset']);}return _0x317bd7[_0xb475('0x81')](_0x499814);}})[_0xb475('0x28')](function(_0x483498){if(_0x483498){return _0x483498?{'count':_0x1543d3,'rows':_0x483498}:null;}})[_0xb475('0x28')](respondWithResult(_0x40d08d,null))[_0xb475('0x50')](handleError(_0x40d08d,null));}; \ No newline at end of file +var _0x337a=['query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','find','params','describe','transaction','create','VoiceExtensionId','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','charAt','sequelize','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','options','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','render','body','contact','agent','interaction','account','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x337a,0x141));var _0xa337=function(_0x5cde2f,_0x28ee2){_0x5cde2f=_0x5cde2f-0x0;var _0x2efd70=_0x337a[_0x5cde2f];return _0x2efd70;};'use strict';var emlformat=require(_0xa337('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa337('0x1'));var jsonpatch=require(_0xa337('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa337('0x3'));var util=require(_0xa337('0x4'));var path=require(_0xa337('0x5'));var sox=require(_0xa337('0x6'));var csv=require('to-csv');var ejs=require(_0xa337('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa337('0x8'));var deskjs=require(_0xa337('0x9'));var toCsv=require(_0xa337('0xa'));var querystring=require(_0xa337('0xb'));var Papa=require(_0xa337('0xc'));var Redis=require(_0xa337('0xd'));var authService=require(_0xa337('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa337('0xf'));var logger=require(_0xa337('0x10'))('api');var utils=require(_0xa337('0x11'));var config=require(_0xa337('0x12'));var licenseUtil=require(_0xa337('0x13'));var db=require(_0xa337('0x14'))['db'];config[_0xa337('0x15')]=_[_0xa337('0x16')](config[_0xa337('0x15')],{'host':_0xa337('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa337('0x15')]));require(_0xa337('0x18'))[_0xa337('0x19')](socket);function respondWithStatusCode(_0x385fea,_0x22904d){_0x22904d=_0x22904d||0xcc;return function(_0x1d758b){if(_0x1d758b){return _0x385fea[_0xa337('0x1a')](_0x22904d);}return _0x385fea['status'](_0x22904d)[_0xa337('0x1b')]();};}function respondWithResult(_0x5b4334,_0x583c14){_0x583c14=_0x583c14||0xc8;return function(_0x385d1f){if(_0x385d1f){return _0x5b4334[_0xa337('0x1c')](_0x583c14)[_0xa337('0x1d')](_0x385d1f);}};}function respondWithFilteredResult(_0x268aa3,_0x1dbc1d){return function(_0x469fc1){if(_0x469fc1){var _0x285da7=typeof _0x1dbc1d[_0xa337('0x1e')]===_0xa337('0x1f')&&typeof _0x1dbc1d[_0xa337('0x20')]===_0xa337('0x1f');var _0x3153af=_0x469fc1[_0xa337('0x21')];var _0x455063=_0x285da7?0x0:_0x1dbc1d[_0xa337('0x1e')];var _0x130bf8=_0x285da7?_0x469fc1[_0xa337('0x21')]:_0x1dbc1d[_0xa337('0x1e')]+_0x1dbc1d[_0xa337('0x20')];var _0x2f79b4;if(_0x130bf8>=_0x3153af){_0x130bf8=_0x3153af;_0x2f79b4=0xc8;}else{_0x2f79b4=0xce;}_0x268aa3[_0xa337('0x1c')](_0x2f79b4);return _0x268aa3[_0xa337('0x22')](_0xa337('0x23'),_0x455063+'-'+_0x130bf8+'/'+_0x3153af)[_0xa337('0x1d')](_0x469fc1);}return null;};}function patchUpdates(_0x215236){return function(_0x17f68d){try{jsonpatch[_0xa337('0x24')](_0x17f68d,_0x215236,!![]);}catch(_0x57ee58){return BPromise[_0xa337('0x25')](_0x57ee58);}return _0x17f68d['save']();};}function saveUpdates(_0x253250,_0x135492){return function(_0x3a493f){if(_0x3a493f){return _0x3a493f[_0xa337('0x26')](_0x253250)[_0xa337('0x27')](function(_0x732562){return _0x732562;});}return null;};}function removeEntity(_0x3ebb21,_0x585570){return function(_0x3f9e57){if(_0x3f9e57){return _0x3f9e57[_0xa337('0x28')]()[_0xa337('0x27')](function(){var _0x306a71=_0x3f9e57[_0xa337('0x29')]({'plain':!![]});var _0x515574=_0xa337('0x2a');return db[_0xa337('0x2b')][_0xa337('0x28')]({'where':{'type':_0x515574,'resourceId':_0x306a71['id']}})['then'](function(){return _0x3f9e57;});})['then'](function(){_0x3ebb21['status'](0xcc)[_0xa337('0x1b')]();});}};}function handleEntityNotFound(_0xa612f3,_0x52f230){return function(_0xa2f335){if(!_0xa2f335){_0xa612f3[_0xa337('0x1a')](0x194);}return _0xa2f335;};}function handleError(_0x4573d2,_0x32aae2){_0x32aae2=_0x32aae2||0x1f4;return function(_0x1cc3c3){logger[_0xa337('0x2c')](_0x1cc3c3[_0xa337('0x2d')]);if(_0x1cc3c3[_0xa337('0x2e')]){delete _0x1cc3c3[_0xa337('0x2e')];}_0x4573d2[_0xa337('0x1c')](_0x32aae2)[_0xa337('0x2f')](_0x1cc3c3);};}function getMustacheRender(_0x1539af,_0x538400){return Mustache[_0xa337('0x30')](_0x1539af,_['merge'](_0x538400[_0xa337('0x31')],{'contact':_0x538400[_0xa337('0x32')],'message':_0x538400['message'],'agent':_0x538400[_0xa337('0x33')],'interaction':_0x538400[_0xa337('0x34')],'account':_0x538400[_0xa337('0x35')]}))||'';}exports[_0xa337('0x36')]=function(_0x47e64f,_0x1a38fc){var _0x448295={},_0x5a0af2={},_0x180777={'count':0x0,'rows':[]};var _0x853ff4=_[_0xa337('0x37')](db[_0xa337('0x38')][_0xa337('0x39')],function(_0xe4ec3f){return{'name':_0xe4ec3f[_0xa337('0x3a')],'type':_0xe4ec3f[_0xa337('0x3b')][_0xa337('0x3c')]};});_0x5a0af2[_0xa337('0x3d')]=_['map'](_0x853ff4,'name');_0x5a0af2['query']=_[_0xa337('0x3e')](_0x47e64f[_0xa337('0x3f')]);_0x5a0af2['filters']=_[_0xa337('0x40')](_0x5a0af2[_0xa337('0x3d')],_0x5a0af2['query']);_0x448295[_0xa337('0x41')]=_[_0xa337('0x40')](_0x5a0af2[_0xa337('0x3d')],qs[_0xa337('0x42')](_0x47e64f['query'][_0xa337('0x42')]));_0x448295['attributes']=_0x448295[_0xa337('0x41')][_0xa337('0x43')]?_0x448295[_0xa337('0x41')]:_0x5a0af2[_0xa337('0x3d')];if(!_0x47e64f[_0xa337('0x3f')][_0xa337('0x44')]('nolimit')){_0x448295[_0xa337('0x20')]=qs[_0xa337('0x20')](_0x47e64f[_0xa337('0x3f')][_0xa337('0x20')]);_0x448295[_0xa337('0x1e')]=qs['offset'](_0x47e64f[_0xa337('0x3f')]['offset']);}_0x448295[_0xa337('0x45')]=qs[_0xa337('0x46')](_0x47e64f['query'][_0xa337('0x46')]);_0x448295[_0xa337('0x47')]=qs[_0xa337('0x48')](_[_0xa337('0x49')](_0x47e64f[_0xa337('0x3f')],_0x5a0af2[_0xa337('0x48')]),_0x853ff4);if(_0x47e64f['query']['filter']){_0x448295[_0xa337('0x47')]=_[_0xa337('0x4a')](_0x448295[_0xa337('0x47')],{'$or':_[_0xa337('0x37')](_0x853ff4,function(_0x3b1c90){if(_0x3b1c90[_0xa337('0x3b')]!==_0xa337('0x4b')){var _0x37f6f1={};_0x37f6f1[_0x3b1c90[_0xa337('0x2e')]]={'$like':'%'+_0x47e64f['query'][_0xa337('0x4c')]+'%'};return _0x37f6f1;}})});}_0x448295=_[_0xa337('0x4a')]({},_0x448295,_0x47e64f['options']);var _0x543ab0={'where':_0x448295[_0xa337('0x47')]};return db[_0xa337('0x38')][_0xa337('0x21')](_0x543ab0)[_0xa337('0x27')](function(_0x5375b1){_0x180777[_0xa337('0x21')]=_0x5375b1;if(_0x47e64f[_0xa337('0x3f')][_0xa337('0x4d')]){_0x448295[_0xa337('0x4e')]=[{'all':!![]}];}return db[_0xa337('0x38')][_0xa337('0x4f')](_0x448295);})[_0xa337('0x27')](function(_0x3c79f0){_0x180777[_0xa337('0x50')]=_0x3c79f0;return _0x180777;})['then'](respondWithFilteredResult(_0x1a38fc,_0x448295))[_0xa337('0x51')](handleError(_0x1a38fc,null));};exports[_0xa337('0x52')]=function(_0x3dadec,_0x181856){var _0xe2f0cc={'raw':![],'where':{'id':_0x3dadec['params']['id']}},_0xf6b1ce={};_0xf6b1ce[_0xa337('0x3d')]=_[_0xa337('0x3e')](db[_0xa337('0x38')]['rawAttributes']);_0xf6b1ce['query']=_[_0xa337('0x3e')](_0x3dadec[_0xa337('0x3f')]);_0xf6b1ce[_0xa337('0x48')]=_['intersection'](_0xf6b1ce[_0xa337('0x3d')],_0xf6b1ce[_0xa337('0x3f')]);_0xe2f0cc['attributes']=_[_0xa337('0x40')](_0xf6b1ce[_0xa337('0x3d')],qs[_0xa337('0x42')](_0x3dadec[_0xa337('0x3f')]['fields']));_0xe2f0cc[_0xa337('0x41')]=_0xe2f0cc[_0xa337('0x41')][_0xa337('0x43')]?_0xe2f0cc[_0xa337('0x41')]:_0xf6b1ce[_0xa337('0x3d')];if(_0x3dadec[_0xa337('0x3f')][_0xa337('0x4d')]){_0xe2f0cc[_0xa337('0x4e')]=[{'all':!![]}];}_0xe2f0cc=_[_0xa337('0x4a')]({},_0xe2f0cc,_0x3dadec['options']);return db[_0xa337('0x38')][_0xa337('0x53')](_0xe2f0cc)[_0xa337('0x27')](handleEntityNotFound(_0x181856,null))[_0xa337('0x27')](respondWithResult(_0x181856,null))[_0xa337('0x51')](handleError(_0x181856,null));};exports[_0xa337('0x28')]=function(_0x139f78,_0x5fed52){return db[_0xa337('0x38')][_0xa337('0x53')]({'where':{'id':_0x139f78[_0xa337('0x54')]['id']}})[_0xa337('0x27')](handleEntityNotFound(_0x5fed52,null))[_0xa337('0x27')](removeEntity(_0x5fed52,null))[_0xa337('0x51')](handleError(_0x5fed52,null));};exports[_0xa337('0x55')]=function(_0x47fd64,_0x2d1fc2){return db[_0xa337('0x38')][_0xa337('0x55')]()[_0xa337('0x27')](respondWithResult(_0x2d1fc2,null))[_0xa337('0x51')](handleError(_0x2d1fc2,null));};exports['create']=function(_0x10237b,_0x8f0b5f){var _0x344b5c;return db['sequelize'][_0xa337('0x56')](function(_0x951837){return db[_0xa337('0x38')][_0xa337('0x57')](_0x10237b[_0xa337('0x31')],{'transaction':_0x951837})[_0xa337('0x27')](function(_0x1bc7e6){_0x344b5c=_0x1bc7e6[_0xa337('0x29')]({'plain':!![]});return db['VoiceExtension'][_0xa337('0x53')]({'where':{'id':_0x344b5c[_0xa337('0x58')]},'raw':!![]})['then'](function(_0x129743){return createVoicePrefixExtensions(_0x344b5c,_0x129743,_0x951837);});});})[_0xa337('0x27')](function(){var _0x10ff97=_0x10237b[_0xa337('0x59')][_0xa337('0x29')]({'plain':!![]});if(!_0x10ff97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10ff97[_0xa337('0x5a')]==='user'){var _0xc42e1b=_0x344b5c;return db[_0xa337('0x5b')][_0xa337('0x53')]({'where':{'name':_0xa337('0x2a'),'userProfileId':_0x10ff97[_0xa337('0x5c')]},'raw':!![]})['then'](function(_0x23d88e){if(_0x23d88e&&_0x23d88e['autoAssociation']===0x0){return db[_0xa337('0x2b')][_0xa337('0x57')]({'name':_0xc42e1b[_0xa337('0x2e')],'resourceId':_0xc42e1b['id'],'type':_0x23d88e['name'],'sectionId':_0x23d88e['id']},{})['then'](function(){return _0x344b5c;});}else{return _0x344b5c;}})['catch'](function(_0x29a60c){logger[_0xa337('0x2c')](_0xa337('0x5d'),_0x29a60c);throw _0x29a60c;});}return _0x344b5c;})[_0xa337('0x27')](respondWithResult(_0x8f0b5f,null))[_0xa337('0x51')](handleError(_0x8f0b5f,null));};function Extension(_0x161400,_0x5c9653,_0x49f1bb,_0x1ea941){this[_0xa337('0x5e')]=_0xa337('0x5f');this[_0xa337('0x60')]=_0x161400;this['app']=_0x49f1bb;this[_0xa337('0x3b')]=_0xa337('0x61');this[_0xa337('0x62')]=_0xa337('0x63');this[_0xa337('0x64')]=_0x5c9653;this[_0xa337('0x65')]=_0x1ea941;}function createVoicePrefixExtensions(_0x3adfe8,_0x20bbae,_0x228775){return new BPromise(function(_0x464e7e,_0x3a9191){var _0x127750=new Extension(formatPrefixName(_0x3adfe8['prefix']),0x1,'NoOp','Voice\x20Prefix');_0x127750[_0xa337('0x66')]=_0x3adfe8['id'];return db[_0xa337('0x67')][_0xa337('0x57')](_0x127750,{'transaction':_0x228775})[_0xa337('0x27')](function(_0x4e3df2){var _0x32f82e=_0x4e3df2[_0xa337('0x29')]({'plain':!![]});var _0x1373b8=_['map'](addVoicePrefixExtensions(_0x3adfe8,_0x20bbae),function(_0x5197e3){_0x5197e3['VoiceExtensionId']=_0x32f82e['id'];_0x5197e3[_0xa337('0x66')]=_0x3adfe8['id'];return _0x5197e3;});return db[_0xa337('0x67')][_0xa337('0x68')](_0x1373b8,{'transaction':_0x228775})[_0xa337('0x27')](function(_0x4c4605){if(!_0x4c4605){return _0x3a9191(_0xa337('0x69'));}else{return _0x464e7e(_0x4c4605);}})[_0xa337('0x51')](function(_0x1ed540){return _0x3a9191(_0x1ed540);});});;});};function addVoicePrefixExtensions(_0x5adbee,_0x3276bf){var _0x2ce9ad=[];var _0x176e51=formatPrefixName(_0x5adbee[_0xa337('0x6a')]);_0x2ce9ad[_0xa337('0x6b')](new Extension(_0x176e51,0x2,_0xa337('0x6c'),_0xa337('0x6d')+_0x5adbee[_0xa337('0x2e')]));if(_0x5adbee[_0xa337('0x6e')]){_0x2ce9ad[_0xa337('0x6b')](new Extension(_0x176e51,0x3,'Set',_0xa337('0x6f')+_0x5adbee[_0xa337('0x6e')]));}else{_0x2ce9ad[_0xa337('0x6b')](new Extension(_0x176e51,0x3,_0xa337('0x70'),'No\x20callerid\x20available'));}_0x2ce9ad[_0xa337('0x6b')](new Extension(_0x176e51,0x4,'goto',_0x3276bf[_0xa337('0x5e')]+','+'${EXTEN:'+(0x8+_0x5adbee[_0xa337('0x2e')][_0xa337('0x43')])+'}'+','+0x1));return _0x2ce9ad;}function formatPrefixName(_0xa3fe45){var _0x54425f='_';for(var _0x8aea51=0x0;_0x8aea51<_0xa3fe45[_0xa337('0x43')];_0x8aea51++){if(_0xa3fe45[_0xa337('0x71')](_0x8aea51)=='-'){_0x54425f+=_0xa3fe45[_0xa337('0x71')](_0x8aea51);}else{_0x54425f+='['+_0xa3fe45[_0xa337('0x71')](_0x8aea51)+']';}}_0x54425f+='.';return _0x54425f;}exports[_0xa337('0x26')]=function(_0x351d0c,_0x53d0e1,_0x537e49){var _0x43aebc=_0x351d0c[_0xa337('0x31')];_0x43aebc[_0xa337('0x6a')]='system-'+_0x43aebc[_0xa337('0x2e')]+'-';return db[_0xa337('0x72')]['transaction'](function(_0x2c7866){return db[_0xa337('0x38')][_0xa337('0x26')](_0x43aebc,{'where':{'id':_0x43aebc['id']},'transaction':_0x2c7866})['then'](function(){return db[_0xa337('0x67')][_0xa337('0x28')]({'where':{'VoicePrefixId':_0x43aebc['id']},'transaction':_0x2c7866})['then'](function(){return db[_0xa337('0x67')][_0xa337('0x53')]({'where':{'id':_0x43aebc[_0xa337('0x58')]},'raw':!![]})[_0xa337('0x27')](function(_0x3ffb6d){return createVoicePrefixExtensions(_0x43aebc,_0x3ffb6d,_0x2c7866);});});});})[_0xa337('0x27')](function(){return db[_0xa337('0x38')][_0xa337('0x73')](_0x43aebc['id']);})[_0xa337('0x27')](respondWithResult(_0x53d0e1,null))[_0xa337('0x51')](handleError(_0x53d0e1,null));};exports[_0xa337('0x74')]=function(_0x5d6913,_0x58e293,_0x5220ee){return db[_0xa337('0x38')][_0xa337('0x53')]({'where':{'id':_0x5d6913[_0xa337('0x54')]['id']}})[_0xa337('0x27')](handleEntityNotFound(_0x58e293,null))[_0xa337('0x27')](function(_0x45e9d2){if(_0x45e9d2){return _0x45e9d2[_0xa337('0x74')](_0x5d6913[_0xa337('0x31')][_0xa337('0x75')],_[_0xa337('0x76')](_0x5d6913[_0xa337('0x31')],['ids','id'])||{})[_0xa337('0x77')](function(_0x4fb458){for(var _0x33b03e=0x0;_0x33b03e<_0x5d6913[_0xa337('0x31')]['ids'][_0xa337('0x43')];_0x33b03e+=0x1){socket[_0xa337('0x78')]('userVoicePrefix:save',{'UserId':_0x5d6913[_0xa337('0x31')][_0xa337('0x75')][_0x33b03e],'VoicePrefixId':_0x5d6913[_0xa337('0x54')]['id']});}return _0x4fb458;});}})[_0xa337('0x27')](respondWithResult(_0x58e293,null))['catch'](handleError(_0x58e293,null));};exports[_0xa337('0x79')]=function(_0x51fc4f,_0x208752,_0x405af8){return db['VoicePrefix'][_0xa337('0x53')]({'where':{'id':_0x51fc4f[_0xa337('0x54')]['id']}})[_0xa337('0x27')](handleEntityNotFound(_0x208752,null))[_0xa337('0x27')](function(_0x351cf4){if(_0x351cf4){return _0x351cf4[_0xa337('0x79')](_0x51fc4f[_0xa337('0x3f')][_0xa337('0x75')])['then'](function(){if(_[_0xa337('0x7a')](_0x51fc4f[_0xa337('0x3f')][_0xa337('0x75')])){for(var _0x442336=0x0;_0x442336<_0x51fc4f['query'][_0xa337('0x75')][_0xa337('0x43')];_0x442336+=0x1){socket['emit'](_0xa337('0x7b'),{'UserId':Number(_0x51fc4f[_0xa337('0x3f')][_0xa337('0x75')][_0x442336]),'VoicePrefixId':Number(_0x51fc4f['params']['id'])});}}else{socket[_0xa337('0x78')](_0xa337('0x7b'),{'UserId':Number(_0x51fc4f[_0xa337('0x3f')]['ids']),'VoicePrefixId':Number(_0x51fc4f[_0xa337('0x54')]['id'])});}});}})[_0xa337('0x27')](respondWithStatusCode(_0x208752,null))['catch'](handleError(_0x208752,null));};exports[_0xa337('0x7c')]=function(_0x1021ac,_0x1cd993,_0xf7deb9){var _0x49f058={};var _0x1f46ef={};var _0x47bdc0;var _0x14d943;return db[_0xa337('0x38')][_0xa337('0x7d')]({'where':{'id':_0x1021ac[_0xa337('0x54')]['id']}})[_0xa337('0x27')](handleEntityNotFound(_0x1cd993,null))[_0xa337('0x27')](function(_0x14d3e7){if(_0x14d3e7){_0x47bdc0=_0x14d3e7;_0x1f46ef[_0xa337('0x3d')]=_[_0xa337('0x3e')](db[_0xa337('0x7e')][_0xa337('0x39')]);_0x1f46ef[_0xa337('0x3f')]=_['keys'](_0x1021ac[_0xa337('0x3f')]);_0x1f46ef[_0xa337('0x48')]=_['intersection'](_0x1f46ef[_0xa337('0x3d')],_0x1f46ef[_0xa337('0x3f')]);_0x49f058['attributes']=_[_0xa337('0x40')](_0x1f46ef[_0xa337('0x3d')],qs[_0xa337('0x42')](_0x1021ac[_0xa337('0x3f')][_0xa337('0x42')]));_0x49f058[_0xa337('0x41')]=_0x49f058['attributes'][_0xa337('0x43')]?_0x49f058[_0xa337('0x41')]:_0x1f46ef[_0xa337('0x3d')];_0x49f058[_0xa337('0x45')]=qs[_0xa337('0x46')](_0x1021ac[_0xa337('0x3f')][_0xa337('0x46')]);_0x49f058['where']=qs[_0xa337('0x48')](_[_0xa337('0x49')](_0x1021ac[_0xa337('0x3f')],_0x1f46ef['filters']));if(_0x1021ac['query'][_0xa337('0x4c')]){_0x49f058['where']=_[_0xa337('0x4a')](_0x49f058[_0xa337('0x47')],{'$or':_[_0xa337('0x37')](_0x49f058[_0xa337('0x41')],function(_0x1cbb3c){var _0x1222ae={};_0x1222ae[_0x1cbb3c]={'$like':'%'+_0x1021ac['query'][_0xa337('0x4c')]+'%'};return _0x1222ae;})});}_0x49f058=_[_0xa337('0x4a')]({},_0x49f058,_0x1021ac[_0xa337('0x7f')]);return _0x47bdc0['getAgents'](_0x49f058);}})[_0xa337('0x27')](function(_0x1c1273){if(_0x1c1273){_0x14d943=_0x1c1273[_0xa337('0x43')];if(!_0x1021ac['query'][_0xa337('0x44')]('nolimit')){_0x49f058[_0xa337('0x20')]=qs[_0xa337('0x20')](_0x1021ac[_0xa337('0x3f')]['limit']);_0x49f058[_0xa337('0x1e')]=qs['offset'](_0x1021ac[_0xa337('0x3f')][_0xa337('0x1e')]);}return _0x47bdc0[_0xa337('0x7c')](_0x49f058);}})[_0xa337('0x27')](function(_0x2e9180){if(_0x2e9180){return _0x2e9180?{'count':_0x14d943,'rows':_0x2e9180}:null;}})[_0xa337('0x27')](respondWithResult(_0x1cd993,null))[_0xa337('0x51')](handleError(_0x1cd993,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 00b7bbd..6c4fcf9 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xedd9,0xfc));var _0x9edd=function(_0x23ec15,_0x55b24a){_0x23ec15=_0x23ec15-0x0;var _0x317b5b=_0xedd9[_0x23ec15];return _0x317b5b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x2b2296,_0x3895df){var _0x5efd01=function(_0x42b665){while(--_0x42b665){_0x2b2296['push'](_0x2b2296['shift']());}};_0x5efd01(++_0x3895df);}(_0x70e0,0x17b));var _0x070e=function(_0x51f583,_0x45530d){_0x51f583=_0x51f583-0x0;var _0x3fe87c=_0x70e0[_0x51f583];return _0x3fe87c;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index def38dd..fa81d5b 100644 --- a/server/api/voicePrefix/voicePrefix.model.js +++ b/server/api/voicePrefix/voicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5375=['bluebird','request-promise','path','rimraf','./voicePrefix.attributes','define','voice_prefixes','lodash','api','moment'];(function(_0x1c6944,_0x5e6485){var _0x5f0239=function(_0x306d36){while(--_0x306d36){_0x1c6944['push'](_0x1c6944['shift']());}};_0x5f0239(++_0x5e6485);}(_0x5375,0x1c9));var _0x5537=function(_0x8d14f2,_0x2219de){_0x8d14f2=_0x8d14f2-0x0;var _0x34437b=_0x5375[_0x8d14f2];return _0x34437b;};'use strict';var _=require(_0x5537('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5537('0x1'));var moment=require(_0x5537('0x2'));var BPromise=require(_0x5537('0x3'));var rp=require(_0x5537('0x4'));var fs=require('fs');var path=require(_0x5537('0x5'));var rimraf=require(_0x5537('0x6'));var config=require('../../config/environment');var attributes=require(_0x5537('0x7'));module['exports']=function(_0x2a72dd,_0x27b092){return _0x2a72dd[_0x5537('0x8')]('VoicePrefix',attributes,{'tableName':_0x5537('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49b7=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','moment','path','../../config/environment'];(function(_0x4f0ecb,_0x352f3d){var _0xdb3702=function(_0x2ad621){while(--_0x2ad621){_0x4f0ecb['push'](_0x4f0ecb['shift']());}};_0xdb3702(++_0x352f3d);}(_0x49b7,0x10d));var _0x749b=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x49b7[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x749b('0x0'));var util=require(_0x749b('0x1'));var logger=require('../../config/logger')(_0x749b('0x2'));var moment=require(_0x749b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x749b('0x4'));var rimraf=require('rimraf');var config=require(_0x749b('0x5'));var attributes=require(_0x749b('0x6'));module[_0x749b('0x7')]=function(_0x410188,_0x5ac046){return _0x410188[_0x749b('0x8')](_0x749b('0x9'),attributes,{'tableName':_0x749b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index d84a372..13d1417 100644 --- a/server/api/voicePrefix/voicePrefix.rpc.js +++ b/server/api/voicePrefix/voicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3116=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3116,0x17e));var _0x6311=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x3116[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x6311('0x0'));var util=require(_0x6311('0x1'));var moment=require(_0x6311('0x2'));var BPromise=require(_0x6311('0x3'));var rs=require(_0x6311('0x4'));var fs=require('fs');var Redis=require(_0x6311('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6311('0x6'));var logger=require(_0x6311('0x7'))(_0x6311('0x8'));var config=require(_0x6311('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6311('0xa')][_0x6311('0xb')]({'port':0x232a});config[_0x6311('0xc')]=_[_0x6311('0xd')](config[_0x6311('0xc')],{'host':_0x6311('0xe'),'port':0x18eb});var socket=require(_0x6311('0xf'))(new Redis(config[_0x6311('0xc')]));require(_0x6311('0x10'))[_0x6311('0x11')](socket);function respondWithRpcPromise(_0x47fc42,_0x36ba58,_0x26b08f){return new BPromise(function(_0x18567d,_0xd1cb7d){return client['request'](_0x47fc42,_0x26b08f)['then'](function(_0x40b103){logger['info'](_0x6311('0x12'),_0x36ba58,_0x6311('0x13'));logger[_0x6311('0x14')](_0x6311('0x15'),_0x36ba58,_0x6311('0x13'),JSON['stringify'](_0x40b103));if(_0x40b103[_0x6311('0x16')]){if(_0x40b103[_0x6311('0x16')]['code']===0x1f4){logger[_0x6311('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x36ba58,_0x40b103[_0x6311('0x16')][_0x6311('0x17')]);return _0xd1cb7d(_0x40b103[_0x6311('0x16')]['message']);}logger[_0x6311('0x16')](_0x6311('0x12'),_0x36ba58,_0x40b103[_0x6311('0x16')][_0x6311('0x17')]);return _0x18567d(_0x40b103[_0x6311('0x16')]['message']);}else{logger[_0x6311('0x18')](_0x6311('0x12'),_0x36ba58,_0x6311('0x13'));_0x18567d(_0x40b103['result'][_0x6311('0x17')]);}})['catch'](function(_0x50add5){logger[_0x6311('0x16')](_0x6311('0x12'),_0x36ba58,_0x50add5);_0xd1cb7d(_0x50add5);});});} \ No newline at end of file +var _0x37fb=['message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x37fb,0xec));var _0xb37f=function(_0x3de725,_0x22a571){_0x3de725=_0x3de725-0x0;var _0x44d86a=_0x37fb[_0x3de725];return _0x44d86a;};'use strict';var _=require('lodash');var util=require(_0xb37f('0x0'));var moment=require(_0xb37f('0x1'));var BPromise=require(_0xb37f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb37f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb37f('0x4'))(_0xb37f('0x5'));var config=require(_0xb37f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb37f('0x7')][_0xb37f('0x8')]({'port':0x232a});config[_0xb37f('0x9')]=_[_0xb37f('0xa')](config[_0xb37f('0x9')],{'host':_0xb37f('0xb'),'port':0x18eb});var socket=require(_0xb37f('0xc'))(new Redis(config[_0xb37f('0x9')]));require(_0xb37f('0xd'))[_0xb37f('0xe')](socket);function respondWithRpcPromise(_0x380ef1,_0xee4392,_0x58bf7c){return new BPromise(function(_0x4c3110,_0x2bef42){return client[_0xb37f('0xf')](_0x380ef1,_0x58bf7c)[_0xb37f('0x10')](function(_0x3cc161){logger[_0xb37f('0x11')](_0xb37f('0x12'),_0xee4392,_0xb37f('0x13'));logger[_0xb37f('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xee4392,'request\x20sent',JSON[_0xb37f('0x15')](_0x3cc161));if(_0x3cc161[_0xb37f('0x16')]){if(_0x3cc161[_0xb37f('0x16')][_0xb37f('0x17')]===0x1f4){logger[_0xb37f('0x16')](_0xb37f('0x12'),_0xee4392,_0x3cc161[_0xb37f('0x16')]['message']);return _0x2bef42(_0x3cc161['error'][_0xb37f('0x18')]);}logger[_0xb37f('0x16')](_0xb37f('0x12'),_0xee4392,_0x3cc161['error'][_0xb37f('0x18')]);return _0x4c3110(_0x3cc161['error']['message']);}else{logger[_0xb37f('0x11')](_0xb37f('0x12'),_0xee4392,'request\x20sent');_0x4c3110(_0x3cc161['result'][_0xb37f('0x18')]);}})[_0xb37f('0x19')](function(_0x10ef02){logger[_0xb37f('0x16')](_0xb37f('0x12'),_0xee4392,_0x10ef02);_0x2bef42(_0x10ef02);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index cb2ecea..f4f1d2c 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xace7=['emit','removeListener','register','length','voicePrefix:','save','remove','update'];(function(_0x3d6752,_0x2e2616){var _0x5ad76d=function(_0x4e4652){while(--_0x4e4652){_0x3d6752['push'](_0x3d6752['shift']());}};_0x5ad76d(++_0x2e2616);}(_0xace7,0x19d));var _0x7ace=function(_0x18d29b,_0x3034d2){_0x18d29b=_0x18d29b-0x0;var _0x3c354f=_0xace7[_0x18d29b];return _0x3c354f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7ace('0x0'),_0x7ace('0x1'),_0x7ace('0x2')];function createListener(_0x4c83e1,_0x250512){return function(_0x126c4e){_0x250512[_0x7ace('0x3')](_0x4c83e1,_0x126c4e);};}function removeListener(_0x13fa41,_0x116428){return function(){VoicePrefixEvents[_0x7ace('0x4')](_0x13fa41,_0x116428);};}exports[_0x7ace('0x5')]=function(_0x37dd30){for(var _0x387185=0x0,_0x2714ce=events[_0x7ace('0x6')];_0x387185<_0x2714ce;_0x387185++){var _0x1be55c=events[_0x387185];var _0x11cdf1=createListener(_0x7ace('0x7')+_0x1be55c,_0x37dd30);VoicePrefixEvents['on'](_0x1be55c,_0x11cdf1);}}; \ No newline at end of file +var _0xd94d=['register','./voicePrefix.events','save','remove','update','removeListener'];(function(_0x3e3f27,_0x2c2ecf){var _0x15c868=function(_0x4b348d){while(--_0x4b348d){_0x3e3f27['push'](_0x3e3f27['shift']());}};_0x15c868(++_0x2c2ecf);}(_0xd94d,0xaf));var _0xdd94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd94d[_0x2641f9];return _0x585741;};'use strict';var VoicePrefixEvents=require(_0xdd94('0x0'));var events=[_0xdd94('0x1'),_0xdd94('0x2'),_0xdd94('0x3')];function createListener(_0x3d0ed0,_0x391762){return function(_0x813bd4){_0x391762['emit'](_0x3d0ed0,_0x813bd4);};}function removeListener(_0x1ab617,_0x1a5ebc){return function(){VoicePrefixEvents[_0xdd94('0x4')](_0x1ab617,_0x1a5ebc);};}exports[_0xdd94('0x5')]=function(_0x4c2cde){for(var _0x238240=0x0,_0x3f63b5=events['length'];_0x238240<_0x3f63b5;_0x238240++){var _0x47ec4d=events[_0x238240];var _0x727029=createListener('voicePrefix:'+_0x47ec4d,_0x4c2cde);VoicePrefixEvents['on'](_0x47ec4d,_0x727029);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index a2e8b5c..ac122f6 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e38=['removeBlackLists','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','/:id','/:id/hoppers','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addAgents','/:id/lists','addLists','addBlackLists','put','destroy','delete','removeAgents','removeLists'];(function(_0x3c1636,_0x3fdf33){var _0x14bd48=function(_0x289647){while(--_0x289647){_0x3c1636['push'](_0x3c1636['shift']());}};_0x14bd48(++_0x3fdf33);}(_0x5e38,0x1b0));var _0x85e3=function(_0x4a0677,_0x14e2c1){_0x4a0677=_0x4a0677-0x0;var _0x49ca78=_0x5e38[_0x4a0677];return _0x49ca78;};'use strict';var multer=require(_0x85e3('0x0'));var util=require(_0x85e3('0x1'));var path=require(_0x85e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x85e3('0x3'));var router=express[_0x85e3('0x4')]();var fs_extra=require(_0x85e3('0x5'));var auth=require(_0x85e3('0x6'));var interaction=require(_0x85e3('0x7'));var config=require(_0x85e3('0x8'));var controller=require(_0x85e3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x85e3('0xa')](_0x85e3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x85e3('0xa')](_0x85e3('0xc'),auth[_0x85e3('0xd')](),controller['getHoppers']);router[_0x85e3('0xa')](_0x85e3('0xe'),auth[_0x85e3('0xd')](),controller[_0x85e3('0xf')]);router[_0x85e3('0xa')](_0x85e3('0x10'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x11')]);router['get'](_0x85e3('0x12'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x13')]);router[_0x85e3('0xa')](_0x85e3('0x14'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x15')]);router[_0x85e3('0xa')](_0x85e3('0x16'),auth['isAuthenticated'](),controller[_0x85e3('0x17')]);router['get'](_0x85e3('0x18'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x19')]);router[_0x85e3('0xa')]('/:id/lists',auth[_0x85e3('0xd')](),controller['getLists']);router[_0x85e3('0xa')](_0x85e3('0x1a'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x1b')]);router['post']('/',auth[_0x85e3('0xd')](),controller[_0x85e3('0x1c')]);router[_0x85e3('0x1d')](_0x85e3('0x1e'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x1f')]);router[_0x85e3('0x1d')](_0x85e3('0x14'),auth[_0x85e3('0xd')](),controller['addTeams']);router['post'](_0x85e3('0x16'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x20')]);router[_0x85e3('0x1d')](_0x85e3('0x21'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x22')]);router['post']('/:id/blacklists',auth[_0x85e3('0xd')](),controller[_0x85e3('0x23')]);router[_0x85e3('0x24')](_0x85e3('0xb'),auth[_0x85e3('0xd')](),controller['update']);router['delete'](_0x85e3('0xb'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x25')]);router[_0x85e3('0x26')](_0x85e3('0x14'),auth[_0x85e3('0xd')](),controller['removeTeams']);router['delete'](_0x85e3('0x16'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x27')]);router[_0x85e3('0x26')](_0x85e3('0x21'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x28')]);router['delete'](_0x85e3('0x1a'),auth[_0x85e3('0xd')](),controller[_0x85e3('0x29')]);module[_0x85e3('0x2a')]=router; \ No newline at end of file +var _0xb63f=['removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getMembers','getLists','/:id/blacklists','getBlackLists','post','create','addTeams','addAgents','/:id/lists','update','delete','destroy','removeAgents'];(function(_0x443a44,_0x4eae75){var _0x1e638d=function(_0x17b2a5){while(--_0x17b2a5){_0x443a44['push'](_0x443a44['shift']());}};_0x1e638d(++_0x4eae75);}(_0xb63f,0x193));var _0xfb63=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xb63f[_0x3aeb36];return _0xa2ef21;};'use strict';var multer=require(_0xfb63('0x0'));var util=require(_0xfb63('0x1'));var path=require('path');var timeout=require(_0xfb63('0x2'));var express=require(_0xfb63('0x3'));var router=express[_0xfb63('0x4')]();var fs_extra=require(_0xfb63('0x5'));var auth=require(_0xfb63('0x6'));var interaction=require(_0xfb63('0x7'));var config=require('../../config/environment');var controller=require(_0xfb63('0x8'));router[_0xfb63('0x9')]('/',auth[_0xfb63('0xa')](),controller[_0xfb63('0xb')]);router[_0xfb63('0x9')](_0xfb63('0xc'),auth[_0xfb63('0xa')](),controller[_0xfb63('0xd')]);router[_0xfb63('0x9')](_0xfb63('0xe'),auth[_0xfb63('0xa')](),controller[_0xfb63('0xf')]);router[_0xfb63('0x9')]('/:id/hopper_histories',auth[_0xfb63('0xa')](),controller[_0xfb63('0x10')]);router['get'](_0xfb63('0x11'),auth['isAuthenticated'](),controller[_0xfb63('0x12')]);router['get'](_0xfb63('0x13'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x14')]);router['get'](_0xfb63('0x15'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x16')]);router[_0xfb63('0x9')](_0xfb63('0x17'),auth[_0xfb63('0xa')](),controller['getAgents']);router[_0xfb63('0x9')]('/:id/members',auth[_0xfb63('0xa')](),controller[_0xfb63('0x18')]);router[_0xfb63('0x9')]('/:id/lists',auth[_0xfb63('0xa')](),controller[_0xfb63('0x19')]);router['get'](_0xfb63('0x1a'),auth['isAuthenticated'](),controller[_0xfb63('0x1b')]);router[_0xfb63('0x1c')]('/',auth['isAuthenticated'](),controller[_0xfb63('0x1d')]);router[_0xfb63('0x1c')]('/:id/clone',auth[_0xfb63('0xa')](),controller['clone']);router[_0xfb63('0x1c')](_0xfb63('0x15'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x1e')]);router['post'](_0xfb63('0x17'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x1f')]);router[_0xfb63('0x1c')](_0xfb63('0x20'),auth[_0xfb63('0xa')](),controller['addLists']);router['post'](_0xfb63('0x1a'),auth[_0xfb63('0xa')](),controller['addBlackLists']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfb63('0x21')]);router[_0xfb63('0x22')](_0xfb63('0xc'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x23')]);router[_0xfb63('0x22')](_0xfb63('0x15'),auth[_0xfb63('0xa')](),controller['removeTeams']);router['delete'](_0xfb63('0x17'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x24')]);router[_0xfb63('0x22')](_0xfb63('0x20'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x25')]);router[_0xfb63('0x22')](_0xfb63('0x1a'),auth[_0xfb63('0xa')](),controller[_0xfb63('0x26')]);module[_0xfb63('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 89e7311..da55adb 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x113bef,_0x82b4a5){var _0x3b6d82=function(_0xc0df02){while(--_0xc0df02){_0x113bef['push'](_0x113bef['shift']());}};_0x3b6d82(++_0x82b4a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x4986a9,_0x311d65){var _0x2d31fe=function(_0x369848){while(--_0x369848){_0x4986a9['push'](_0x4986a9['shift']());}};_0x2d31fe(++_0x311d65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index e05c66d..8a57848 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd210=['hasOwnProperty','nolimit','order','sort','where','pick','includeAll','findAll','show','params','include','options','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','outbound','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','getHoppers','findOne','CmHopper','rows','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','push','all','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','into','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','./voiceQueue.socket','register','status','end','json','offset','limit','undefined','count','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','sendStatus','error','send','render','merge','body','contact','message','agent','interaction','account','index','VoiceQueue','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x26e206,_0x5e90cf){var _0x1b7024=function(_0x25b8bd){while(--_0x25b8bd){_0x26e206['push'](_0x26e206['shift']());}};_0x1b7024(++_0x5e90cf);}(_0xd210,0x125));var _0x0d21=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xd210[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d21('0x0'));var zipdir=require(_0x0d21('0x1'));var jsonpatch=require(_0x0d21('0x2'));var rp=require(_0x0d21('0x3'));var moment=require(_0x0d21('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d21('0x5'));var util=require(_0x0d21('0x6'));var path=require('path');var sox=require(_0x0d21('0x7'));var csv=require(_0x0d21('0x8'));var ejs=require(_0x0d21('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d21('0xa'));var deskjs=require(_0x0d21('0xb'));var toCsv=require(_0x0d21('0x8'));var querystring=require(_0x0d21('0xc'));var Papa=require(_0x0d21('0xd'));var Redis=require(_0x0d21('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0d21('0xf'));var as=require(_0x0d21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d21('0x11'))(_0x0d21('0x12'));var utils=require('../../config/utils');var config=require(_0x0d21('0x13'));var licenseUtil=require(_0x0d21('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0d21('0x15')](config[_0x0d21('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d21('0x16')]));require(_0x0d21('0x17'))[_0x0d21('0x18')](socket);function respondWithStatusCode(_0x5bb9ee,_0x3e6b99){_0x3e6b99=_0x3e6b99||0xcc;return function(_0xb7e11b){if(_0xb7e11b){return _0x5bb9ee['sendStatus'](_0x3e6b99);}return _0x5bb9ee[_0x0d21('0x19')](_0x3e6b99)[_0x0d21('0x1a')]();};}function respondWithResult(_0x353a7e,_0x429ba8){_0x429ba8=_0x429ba8||0xc8;return function(_0x398770){if(_0x398770){return _0x353a7e[_0x0d21('0x19')](_0x429ba8)[_0x0d21('0x1b')](_0x398770);}};}function respondWithFilteredResult(_0x1f5506,_0x2e7c31){return function(_0x9dfe35){if(_0x9dfe35){var _0x440860=typeof _0x2e7c31[_0x0d21('0x1c')]==='undefined'&&typeof _0x2e7c31[_0x0d21('0x1d')]===_0x0d21('0x1e');var _0x255bef=_0x9dfe35['count'];var _0x20af42=_0x440860?0x0:_0x2e7c31[_0x0d21('0x1c')];var _0xaf1952=_0x440860?_0x9dfe35[_0x0d21('0x1f')]:_0x2e7c31['offset']+_0x2e7c31[_0x0d21('0x1d')];var _0x421eb4;if(_0xaf1952>=_0x255bef){_0xaf1952=_0x255bef;_0x421eb4=0xc8;}else{_0x421eb4=0xce;}_0x1f5506['status'](_0x421eb4);return _0x1f5506['set']('Content-Range',_0x20af42+'-'+_0xaf1952+'/'+_0x255bef)[_0x0d21('0x1b')](_0x9dfe35);}return null;};}function patchUpdates(_0x2cff66){return function(_0x2da3ac){try{jsonpatch[_0x0d21('0x20')](_0x2da3ac,_0x2cff66,!![]);}catch(_0x2e3420){return BPromise['reject'](_0x2e3420);}return _0x2da3ac[_0x0d21('0x21')]();};}function saveUpdates(_0xa3811,_0x21b725){return function(_0xde0569){if(_0xde0569){return _0xde0569[_0x0d21('0x22')](_0xa3811)[_0x0d21('0x23')](function(_0x5be243){return _0x5be243;});}return null;};}function removeEntity(_0x5a504d,_0x39d1c7){return function(_0x4934c4){if(_0x4934c4){return _0x4934c4[_0x0d21('0x24')]()[_0x0d21('0x23')](function(){var _0x2408d8=_0x4934c4[_0x0d21('0x25')]({'plain':!![]});var _0x47235a=[{'name':'VoiceQueues','value':_0x0d21('0x26'),'ignore':![]},{'name':_0x0d21('0x27'),'value':'outbound','ignore':![]}];var _0xf31718=_(_0x47235a)[_0x0d21('0x28')](_0x0d21('0x29'))[_0x0d21('0x2a')]('value')[_0x0d21('0x2b')]();if(_[_0x0d21('0x2c')](_0xf31718,_0x2408d8[_0x0d21('0x2d')])){return;}var _0x145cb4=_[_0x0d21('0x2e')](_0x47235a,[_0x0d21('0x2b'),_0x2408d8[_0x0d21('0x2d')]])[_0x0d21('0x2f')];return db['UserProfileResource'][_0x0d21('0x24')]({'where':{'type':_0x145cb4,'resourceId':_0x2408d8['id']}})[_0x0d21('0x23')](function(){return _0x4934c4;});})[_0x0d21('0x23')](function(){_0x5a504d[_0x0d21('0x19')](0xcc)[_0x0d21('0x1a')]();});}};}function handleEntityNotFound(_0x4f5cf7,_0x5d0bbc){return function(_0x30c371){if(!_0x30c371){_0x4f5cf7[_0x0d21('0x30')](0x194);}return _0x30c371;};}function handleError(_0x10beb6,_0x2157bd){_0x2157bd=_0x2157bd||0x1f4;return function(_0x28c5d2){logger[_0x0d21('0x31')](_0x28c5d2['stack']);if(_0x28c5d2[_0x0d21('0x2f')]){delete _0x28c5d2[_0x0d21('0x2f')];}_0x10beb6[_0x0d21('0x19')](_0x2157bd)[_0x0d21('0x32')](_0x28c5d2);};}function getMustacheRender(_0x95a0c5,_0x330ac4){return Mustache[_0x0d21('0x33')](_0x95a0c5,_[_0x0d21('0x34')](_0x330ac4[_0x0d21('0x35')],{'contact':_0x330ac4[_0x0d21('0x36')],'message':_0x330ac4[_0x0d21('0x37')],'agent':_0x330ac4[_0x0d21('0x38')],'interaction':_0x330ac4[_0x0d21('0x39')],'account':_0x330ac4[_0x0d21('0x3a')]}))||'';}exports[_0x0d21('0x3b')]=function(_0x234f49,_0x747dc4){var _0x5a0cae={},_0x1c59db={},_0x2642b8={'count':0x0,'rows':[]};var _0x4e401c=_[_0x0d21('0x2a')](db[_0x0d21('0x3c')][_0x0d21('0x3d')],function(_0x356f2a){return{'name':_0x356f2a['fieldName'],'type':_0x356f2a[_0x0d21('0x2d')][_0x0d21('0x3e')]};});_0x1c59db[_0x0d21('0x3f')]=_[_0x0d21('0x2a')](_0x4e401c,_0x0d21('0x2f'));_0x1c59db['query']=_[_0x0d21('0x40')](_0x234f49[_0x0d21('0x41')]);_0x1c59db[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x1c59db[_0x0d21('0x3f')],_0x1c59db[_0x0d21('0x41')]);_0x5a0cae[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x1c59db['model'],qs['fields'](_0x234f49[_0x0d21('0x41')][_0x0d21('0x45')]));_0x5a0cae['attributes']=_0x5a0cae[_0x0d21('0x44')][_0x0d21('0x46')]?_0x5a0cae[_0x0d21('0x44')]:_0x1c59db[_0x0d21('0x3f')];if(!_0x234f49['query'][_0x0d21('0x47')](_0x0d21('0x48'))){_0x5a0cae[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x234f49[_0x0d21('0x41')]['limit']);_0x5a0cae[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x234f49[_0x0d21('0x41')][_0x0d21('0x1c')]);}_0x5a0cae[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x234f49[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x5a0cae[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x234f49[_0x0d21('0x41')],_0x1c59db[_0x0d21('0x42')]),_0x4e401c);if(_0x234f49['query'][_0x0d21('0x28')]){_0x5a0cae[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x5a0cae[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x4e401c,function(_0x103d0e){if(_0x103d0e[_0x0d21('0x2d')]!=='VIRTUAL'){var _0x2c78f5={};_0x2c78f5[_0x103d0e[_0x0d21('0x2f')]]={'$like':'%'+_0x234f49[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x2c78f5;}})});}_0x5a0cae=_['merge']({},_0x5a0cae,_0x234f49['options']);var _0x2e894e={'where':_0x5a0cae['where']};return db[_0x0d21('0x3c')][_0x0d21('0x1f')](_0x2e894e)[_0x0d21('0x23')](function(_0x51d6a9){_0x2642b8['count']=_0x51d6a9;if(_0x234f49[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x5a0cae['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x0d21('0x4e')](_0x5a0cae);})[_0x0d21('0x23')](function(_0x4be18a){_0x2642b8['rows']=_0x4be18a;return _0x2642b8;})['then'](respondWithFilteredResult(_0x747dc4,_0x5a0cae))['catch'](handleError(_0x747dc4,null));};exports[_0x0d21('0x4f')]=function(_0x380077,_0x383ea0){var _0x49141e={'raw':![],'where':{'id':_0x380077[_0x0d21('0x50')]['id']}},_0x580a28={};_0x580a28[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x3c')][_0x0d21('0x3d')]);_0x580a28[_0x0d21('0x41')]=_[_0x0d21('0x40')](_0x380077[_0x0d21('0x41')]);_0x580a28[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x580a28['model'],_0x580a28['query']);_0x49141e['attributes']=_[_0x0d21('0x43')](_0x580a28['model'],qs[_0x0d21('0x45')](_0x380077[_0x0d21('0x41')][_0x0d21('0x45')]));_0x49141e[_0x0d21('0x44')]=_0x49141e[_0x0d21('0x44')]['length']?_0x49141e[_0x0d21('0x44')]:_0x580a28['model'];if(_0x380077[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x49141e[_0x0d21('0x51')]=[{'all':!![]}];}_0x49141e=_[_0x0d21('0x34')]({},_0x49141e,_0x380077[_0x0d21('0x52')]);return db[_0x0d21('0x3c')][_0x0d21('0x2e')](_0x49141e)['then'](handleEntityNotFound(_0x383ea0,null))['then'](respondWithResult(_0x383ea0,null))[_0x0d21('0x53')](handleError(_0x383ea0,null));};exports[_0x0d21('0x54')]=function(_0x1bae1d,_0x5d6a6a){return db[_0x0d21('0x3c')]['create'](_0x1bae1d[_0x0d21('0x35')],{})[_0x0d21('0x23')](function(_0x4898d0){var _0x250a30=_0x1bae1d['user'][_0x0d21('0x25')]({'plain':!![]});if(!_0x250a30)throw new Error(_0x0d21('0x55'));if(_0x250a30[_0x0d21('0x56')]===_0x0d21('0x57')){var _0x5bcb0f=_0x4898d0[_0x0d21('0x25')]({'plain':!![]});var _0x1701a8=[{'name':_0x0d21('0x58'),'value':_0x0d21('0x26')},{'name':_0x0d21('0x27'),'value':_0x0d21('0x59')}];var _0x63af99=_['find'](_0x1701a8,[_0x0d21('0x2b'),_0x5bcb0f[_0x0d21('0x2d')]])[_0x0d21('0x2f')];return db[_0x0d21('0x5a')][_0x0d21('0x2e')]({'where':{'name':_0x63af99,'userProfileId':_0x250a30['userProfileId']},'raw':!![]})['then'](function(_0x19a14a){if(_0x19a14a&&_0x19a14a[_0x0d21('0x5b')]===0x0){return db[_0x0d21('0x5c')][_0x0d21('0x54')]({'name':_0x5bcb0f['name'],'resourceId':_0x5bcb0f['id'],'type':_0x19a14a['name'],'sectionId':_0x19a14a['id']},{})[_0x0d21('0x23')](function(){return _0x4898d0;});}else{return _0x4898d0;}})[_0x0d21('0x53')](function(_0x41f37e){logger[_0x0d21('0x31')](_0x0d21('0x5d'),_0x41f37e);throw _0x41f37e;});}return _0x4898d0;})[_0x0d21('0x23')](respondWithResult(_0x5d6a6a,0xc9))[_0x0d21('0x53')](handleError(_0x5d6a6a,null));};exports[_0x0d21('0x5e')]=function(_0x27d25a,_0x4b533e){var _0x112c49={'where':{'id':_0x27d25a['params']['id']}},_0x44039b={};_0x44039b[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x3c')][_0x0d21('0x3d')]);_0x112c49[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x44039b['model'],qs[_0x0d21('0x45')](_0x27d25a['query'][_0x0d21('0x45')]));_0x112c49['attributes']=_0x112c49[_0x0d21('0x44')][_0x0d21('0x46')]?_0x112c49[_0x0d21('0x44')]:_0x44039b[_0x0d21('0x3f')];if(_0x27d25a[_0x0d21('0x41')]['includeAll']){_0x112c49[_0x0d21('0x51')]=[{'all':!![]}];}_0x112c49=_['merge']({},_0x112c49,_0x27d25a['options']);return db[_0x0d21('0x3c')][_0x0d21('0x2e')](_0x112c49)[_0x0d21('0x23')](handleEntityNotFound(_0x4b533e,null))[_0x0d21('0x23')](function(_0x47b53c){if(_0x47b53c){var _0x36d309=_0x47b53c['get']({'plain':!![]});_0x36d309=qs['omit'](_0x36d309,['id',_0x0d21('0x5f'),_0x0d21('0x60')]);_0x27d25a['body']=_[_0x0d21('0x61')](_0x27d25a[_0x0d21('0x35')],['id','createdAt',_0x0d21('0x60')]);return db[_0x0d21('0x3c')][_0x0d21('0x54')](_['merge'](_0x36d309,_0x27d25a[_0x0d21('0x35')]),{'include':_0x27d25a[_0x0d21('0x41')][_0x0d21('0x4d')]?[{'all':!![]}]:undefined})[_0x0d21('0x23')](function(_0x2a703d){var _0x25fee7=_0x27d25a[_0x0d21('0x57')][_0x0d21('0x25')]({'plain':!![]});if(!_0x25fee7)throw new Error(_0x0d21('0x55'));if(_0x25fee7[_0x0d21('0x56')]===_0x0d21('0x57')){var _0x1b0cd0=_0x2a703d[_0x0d21('0x25')]({'plain':!![]});var _0x508bfc=[{'name':_0x0d21('0x58'),'value':_0x0d21('0x26')},{'name':'QueueCampaigns','value':_0x0d21('0x59')}];var _0x1ffc68=_[_0x0d21('0x2e')](_0x508bfc,[_0x0d21('0x2b'),_0x1b0cd0['type']])['name'];return db[_0x0d21('0x5a')][_0x0d21('0x2e')]({'where':{'name':_0x1ffc68,'userProfileId':_0x25fee7['userProfileId']},'raw':!![]})['then'](function(_0x4696df){if(_0x4696df&&_0x4696df[_0x0d21('0x5b')]===0x0){return db[_0x0d21('0x5c')][_0x0d21('0x54')]({'name':_0x1b0cd0[_0x0d21('0x2f')],'resourceId':_0x1b0cd0['id'],'type':_0x4696df[_0x0d21('0x2f')],'sectionId':_0x4696df['id']},{})['then'](function(){return _0x2a703d;});}else{return _0x2a703d;}})[_0x0d21('0x53')](function(_0x54fef8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54fef8);throw _0x54fef8;});}return _0x2a703d;});}})[_0x0d21('0x23')](respondWithResult(_0x4b533e,0xc9))['catch'](handleError(_0x4b533e,null));};exports[_0x0d21('0x22')]=function(_0x5b9ac3,_0x12a355){if(_0x5b9ac3[_0x0d21('0x35')]['id']){delete _0x5b9ac3[_0x0d21('0x35')]['id'];}return db[_0x0d21('0x3c')]['find']({'where':{'id':_0x5b9ac3['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x12a355,null))[_0x0d21('0x23')](saveUpdates(_0x5b9ac3[_0x0d21('0x35')],null))[_0x0d21('0x23')](respondWithResult(_0x12a355,null))[_0x0d21('0x53')](handleError(_0x12a355,null));};exports[_0x0d21('0x24')]=function(_0x552855,_0x58d85c){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x552855['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x58d85c,null))['then'](removeEntity(_0x58d85c,null))['catch'](handleError(_0x58d85c,null));};exports[_0x0d21('0x62')]=function(_0x526b09,_0x1b86a4,_0x2440c9){var _0xbcb6b5={'raw':![],'where':{}};var _0x3ec84b={};var _0xa0aaad={'count':0x0,'rows':[]};return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x526b09[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x1b86a4,null))[_0x0d21('0x23')](function(_0x483b27){if(_0x483b27){_0x3ec84b[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db['CmHopper'][_0x0d21('0x3d')]);_0x3ec84b['query']=_[_0x0d21('0x40')](_0x526b09[_0x0d21('0x41')]);_0x3ec84b['filters']=_[_0x0d21('0x43')](_0x3ec84b[_0x0d21('0x3f')],_0x3ec84b[_0x0d21('0x41')]);_0xbcb6b5[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x3ec84b['model'],qs[_0x0d21('0x45')](_0x526b09[_0x0d21('0x41')][_0x0d21('0x45')]));_0xbcb6b5[_0x0d21('0x44')]=_0xbcb6b5[_0x0d21('0x44')][_0x0d21('0x46')]?_0xbcb6b5[_0x0d21('0x44')]:_0x3ec84b[_0x0d21('0x3f')];if(!_0x526b09[_0x0d21('0x41')][_0x0d21('0x47')]('nolimit')){_0xbcb6b5['limit']=qs[_0x0d21('0x1d')](_0x526b09[_0x0d21('0x41')][_0x0d21('0x1d')]);_0xbcb6b5[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x526b09['query'][_0x0d21('0x1c')]);}_0xbcb6b5[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x526b09[_0x0d21('0x41')][_0x0d21('0x4a')]);_0xbcb6b5[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x526b09[_0x0d21('0x41')],_0x3ec84b[_0x0d21('0x42')]));_0xbcb6b5['where']['VoiceQueueId']=_0x483b27['id'];if(_0x526b09[_0x0d21('0x41')][_0x0d21('0x28')]){_0xbcb6b5[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0xbcb6b5[_0x0d21('0x4b')],{'$or':_['map'](_0xbcb6b5[_0x0d21('0x44')],function(_0x4220da){var _0x35a1e7={};_0x35a1e7[_0x4220da]={'$like':'%'+_0x526b09[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x35a1e7;})});}_0xbcb6b5=_[_0x0d21('0x34')]({},_0xbcb6b5,_0x526b09[_0x0d21('0x52')]);return db[_0x0d21('0x64')][_0x0d21('0x1f')]({'where':_0xbcb6b5[_0x0d21('0x4b')]})[_0x0d21('0x23')](function(_0x11958c){_0xa0aaad['count']=_0x11958c;if(_0x526b09['query'][_0x0d21('0x4d')]){_0xbcb6b5[_0x0d21('0x51')]=[{'all':!![]}];}return db['CmHopper'][_0x0d21('0x4e')](_0xbcb6b5);})[_0x0d21('0x23')](function(_0x24d8c2){_0xa0aaad[_0x0d21('0x65')]=_0x24d8c2;return _0xa0aaad;});}})[_0x0d21('0x23')](respondWithFilteredResult(_0x1b86a4,_0xbcb6b5))[_0x0d21('0x53')](handleError(_0x1b86a4,null));};exports[_0x0d21('0x66')]=function(_0x1780f8,_0x388723,_0xc34da7){var _0x1096ea={'raw':!![],'where':{}};var _0x1e9765={};var _0x4732a0={'count':0x0,'rows':[]};return db[_0x0d21('0x3c')]['findOne']({'where':{'id':_0x1780f8[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x388723,null))[_0x0d21('0x23')](function(_0xce0eae){if(_0xce0eae){_0x1e9765['model']=_[_0x0d21('0x40')](db[_0x0d21('0x67')][_0x0d21('0x3d')]);_0x1e9765[_0x0d21('0x41')]=_['keys'](_0x1780f8[_0x0d21('0x41')]);_0x1e9765[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x1e9765['model'],_0x1e9765[_0x0d21('0x41')]);_0x1096ea[_0x0d21('0x44')]=_['intersection'](_0x1e9765[_0x0d21('0x3f')],qs['fields'](_0x1780f8[_0x0d21('0x41')][_0x0d21('0x45')]));_0x1096ea['attributes']=_0x1096ea[_0x0d21('0x44')]['length']?_0x1096ea['attributes']:_0x1e9765['model'];if(!_0x1780f8[_0x0d21('0x41')][_0x0d21('0x47')](_0x0d21('0x48'))){_0x1096ea[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x1780f8[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x1096ea[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x1780f8['query'][_0x0d21('0x1c')]);}_0x1096ea[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x1780f8[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x1096ea[_0x0d21('0x4b')]=qs['filters'](_[_0x0d21('0x4c')](_0x1780f8[_0x0d21('0x41')],_0x1e9765[_0x0d21('0x42')]));_0x1096ea[_0x0d21('0x4b')][_0x0d21('0x68')]=_0xce0eae['id'];if(_0x1780f8[_0x0d21('0x41')]['filter']){_0x1096ea[_0x0d21('0x4b')]=_['merge'](_0x1096ea['where'],{'$or':_[_0x0d21('0x2a')](_0x1096ea[_0x0d21('0x44')],function(_0x311772){var _0x109192={};_0x109192[_0x311772]={'$like':'%'+_0x1780f8[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x109192;})});}_0x1096ea=_[_0x0d21('0x34')]({},_0x1096ea,_0x1780f8['options']);return db['CmHopperHistory'][_0x0d21('0x1f')]({'where':_0x1096ea[_0x0d21('0x4b')]})[_0x0d21('0x23')](function(_0x516e15){_0x4732a0[_0x0d21('0x1f')]=_0x516e15;if(_0x1780f8[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x1096ea['include']=[{'all':!![]}];}return db[_0x0d21('0x67')][_0x0d21('0x4e')](_0x1096ea);})[_0x0d21('0x23')](function(_0x5448ff){_0x4732a0[_0x0d21('0x65')]=_0x5448ff;return _0x4732a0;});}})[_0x0d21('0x23')](respondWithFilteredResult(_0x388723,_0x1096ea))['catch'](handleError(_0x388723,null));};exports[_0x0d21('0x69')]=function(_0x3b0bf6,_0x567abc,_0x226fff){var _0x1dba0f={'raw':!![],'where':{}};var _0x3c4330={};var _0x2e8c50={'count':0x0,'rows':[]};return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x3b0bf6[_0x0d21('0x50')]['id']}})['then'](handleEntityNotFound(_0x567abc,null))[_0x0d21('0x23')](function(_0x478b05){if(_0x478b05){_0x3c4330[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x6a')][_0x0d21('0x3d')]);_0x3c4330['query']=_[_0x0d21('0x40')](_0x3b0bf6['query']);_0x3c4330[_0x0d21('0x42')]=_['intersection'](_0x3c4330[_0x0d21('0x3f')],_0x3c4330['query']);_0x1dba0f[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x3c4330[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x3b0bf6['query'][_0x0d21('0x45')]));_0x1dba0f['attributes']=_0x1dba0f['attributes'][_0x0d21('0x46')]?_0x1dba0f[_0x0d21('0x44')]:_0x3c4330['model'];if(!_0x3b0bf6['query'][_0x0d21('0x47')]('nolimit')){_0x1dba0f[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x3b0bf6[_0x0d21('0x41')]['limit']);_0x1dba0f['offset']=qs[_0x0d21('0x1c')](_0x3b0bf6[_0x0d21('0x41')][_0x0d21('0x1c')]);}_0x1dba0f[_0x0d21('0x49')]=qs['sort'](_0x3b0bf6['query'][_0x0d21('0x4a')]);_0x1dba0f[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x3b0bf6[_0x0d21('0x41')],_0x3c4330[_0x0d21('0x42')]));_0x1dba0f['where'][_0x0d21('0x68')]=_0x478b05['id'];if(_0x3b0bf6[_0x0d21('0x41')]['filter']){_0x1dba0f[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x1dba0f['where'],{'$or':_['map'](_0x1dba0f['attributes'],function(_0x441866){var _0x5d8a95={};_0x5d8a95[_0x441866]={'$like':'%'+_0x3b0bf6[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x5d8a95;})});}_0x1dba0f=_[_0x0d21('0x34')]({},_0x1dba0f,_0x3b0bf6[_0x0d21('0x52')]);return db[_0x0d21('0x6a')]['count']({'where':_0x1dba0f[_0x0d21('0x4b')]})[_0x0d21('0x23')](function(_0x1338be){_0x2e8c50[_0x0d21('0x1f')]=_0x1338be;if(_0x3b0bf6[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x1dba0f[_0x0d21('0x51')]=[{'all':!![]}];}return db[_0x0d21('0x6a')]['findAll'](_0x1dba0f);})[_0x0d21('0x23')](function(_0x293f34){_0x2e8c50[_0x0d21('0x65')]=_0x293f34;return _0x2e8c50;});}})['then'](respondWithFilteredResult(_0x567abc,_0x1dba0f))[_0x0d21('0x53')](handleError(_0x567abc,null));};exports['getHopperBlacks']=function(_0x2ab9c0,_0x240837,_0x514465){var _0x33a785={'raw':!![],'where':{}};var _0x548ac2={};var _0xed1802={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0d21('0x63')]({'where':{'id':_0x2ab9c0[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x240837,null))['then'](function(_0x8ad815){if(_0x8ad815){_0x548ac2[_0x0d21('0x3f')]=_[_0x0d21('0x40')](db[_0x0d21('0x6b')][_0x0d21('0x3d')]);_0x548ac2['query']=_[_0x0d21('0x40')](_0x2ab9c0[_0x0d21('0x41')]);_0x548ac2[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x548ac2[_0x0d21('0x3f')],_0x548ac2[_0x0d21('0x41')]);_0x33a785[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x548ac2['model'],qs[_0x0d21('0x45')](_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x45')]));_0x33a785[_0x0d21('0x44')]=_0x33a785[_0x0d21('0x44')][_0x0d21('0x46')]?_0x33a785[_0x0d21('0x44')]:_0x548ac2[_0x0d21('0x3f')];if(!_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x47')]('nolimit')){_0x33a785[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x33a785['offset']=qs[_0x0d21('0x1c')](_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x1c')]);}_0x33a785[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x2ab9c0[_0x0d21('0x41')]['sort']);_0x33a785[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x2ab9c0[_0x0d21('0x41')],_0x548ac2['filters']));_0x33a785[_0x0d21('0x4b')][_0x0d21('0x68')]=_0x8ad815['id'];if(_0x2ab9c0[_0x0d21('0x41')]['filter']){_0x33a785['where']=_['merge'](_0x33a785[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x33a785[_0x0d21('0x44')],function(_0xc659be){var _0x558033={};_0x558033[_0xc659be]={'$like':'%'+_0x2ab9c0['query'][_0x0d21('0x28')]+'%'};return _0x558033;})});}_0x33a785=_[_0x0d21('0x34')]({},_0x33a785,_0x2ab9c0[_0x0d21('0x52')]);return db[_0x0d21('0x6b')]['count']({'where':_0x33a785['where']})[_0x0d21('0x23')](function(_0x148307){_0xed1802['count']=_0x148307;if(_0x2ab9c0[_0x0d21('0x41')][_0x0d21('0x4d')]){_0x33a785[_0x0d21('0x51')]=[{'all':!![]}];}return db[_0x0d21('0x6b')][_0x0d21('0x4e')](_0x33a785);})[_0x0d21('0x23')](function(_0x5544d5){_0xed1802[_0x0d21('0x65')]=_0x5544d5;return _0xed1802;});}})[_0x0d21('0x23')](respondWithFilteredResult(_0x240837,_0x33a785))['catch'](handleError(_0x240837,null));};exports[_0x0d21('0x6c')]=function(_0x110ee2,_0x4fb39d,_0x27ebd5){var _0x352b53={};var _0x5f5b77={};var _0x44d007;var _0x43e5ba;return db['VoiceQueue'][_0x0d21('0x63')]({'where':{'id':_0x110ee2[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x4fb39d,null))[_0x0d21('0x23')](function(_0x263824){if(_0x263824){_0x44d007=_0x263824;_0x5f5b77['model']=_['keys'](db['Team'][_0x0d21('0x3d')]);_0x5f5b77['query']=_[_0x0d21('0x40')](_0x110ee2[_0x0d21('0x41')]);_0x5f5b77[_0x0d21('0x42')]=_['intersection'](_0x5f5b77[_0x0d21('0x3f')],_0x5f5b77[_0x0d21('0x41')]);_0x352b53[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x5f5b77[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x110ee2[_0x0d21('0x41')][_0x0d21('0x45')]));_0x352b53['attributes']=_0x352b53[_0x0d21('0x44')]['length']?_0x352b53[_0x0d21('0x44')]:_0x5f5b77[_0x0d21('0x3f')];_0x352b53[_0x0d21('0x49')]=qs['sort'](_0x110ee2[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x352b53[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_['pick'](_0x110ee2[_0x0d21('0x41')],_0x5f5b77[_0x0d21('0x42')]));if(_0x110ee2[_0x0d21('0x41')][_0x0d21('0x28')]){_0x352b53[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x352b53[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x352b53[_0x0d21('0x44')],function(_0x342b6b){var _0x52584b={};_0x52584b[_0x342b6b]={'$like':'%'+_0x110ee2[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x52584b;})});}_0x352b53=_[_0x0d21('0x34')]({},_0x352b53,_0x110ee2[_0x0d21('0x52')]);return _0x44d007['getTeams'](_0x352b53);}})[_0x0d21('0x23')](function(_0x9a7005){if(_0x9a7005){_0x43e5ba=_0x9a7005['length'];if(!_0x110ee2[_0x0d21('0x41')][_0x0d21('0x47')](_0x0d21('0x48'))){_0x352b53[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x110ee2[_0x0d21('0x41')]['limit']);_0x352b53['offset']=qs[_0x0d21('0x1c')](_0x110ee2[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x44d007[_0x0d21('0x6c')](_0x352b53);}})[_0x0d21('0x23')](function(_0x204ab0){if(_0x204ab0){return _0x204ab0?{'count':_0x43e5ba,'rows':_0x204ab0}:null;}})['then'](respondWithResult(_0x4fb39d,null))['catch'](handleError(_0x4fb39d,null));};exports[_0x0d21('0x6d')]=function(_0x2b771c,_0x5ae937,_0x3f1479){var _0x3a5214=_0x2b771c[_0x0d21('0x35')][_0x0d21('0x6e')];var _0x220920=_['map'](_0x3a5214,'id');return db['Team'][_0x0d21('0x4e')]({'where':{'id':_0x220920},'attributes':['id'],'include':[{'model':db[_0x0d21('0x6f')],'as':_0x0d21('0x70'),'attributes':['id',_0x0d21('0x2f'),_0x0d21('0x71'),_0x0d21('0x72'),_0x0d21('0x73')],'raw':!![]}]})[_0x0d21('0x23')](function(_0x408ce1){if(_0x408ce1){var _0x26210b=_['flatMap'](_0x408ce1,function(_0x4e14c7){var _0x337f0a=_0x4e14c7[_0x0d21('0x25')]({'plain':!![]});_0x337f0a[_0x0d21('0x70')][_0x0d21('0x74')](function(_0x214ef9){_0x214ef9[_0x0d21('0x75')]=_[_0x0d21('0x2e')](_0x3a5214,{'id':_0x337f0a['id']})[_0x0d21('0x75')];});return _0x337f0a[_0x0d21('0x70')];});return db[_0x0d21('0x3c')]['find']({'where':{'id':_0x2b771c[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](function(_0x3ef7c8){return db[_0x0d21('0x76')][_0x0d21('0x77')](function(_0x49cba5){return _0x3ef7c8[_0x0d21('0x6d')](_0x220920,{'transaction':_0x49cba5})[_0x0d21('0x23')](function(){return BPromise[_0x0d21('0x78')](_0x3a5214,function(_0x43f03c){return db[_0x0d21('0x79')][_0x0d21('0x7a')]({'TeamId':_0x43f03c['id'],'VoiceQueueId':_0x2b771c[_0x0d21('0x50')]['id'],'penalty':_0x43f03c[_0x0d21('0x75')]},{'transaction':_0x49cba5});});})[_0x0d21('0x23')](function(){return BPromise[_0x0d21('0x78')](_0x26210b,function(_0x416206){return db[_0x0d21('0x7b')][_0x0d21('0x7c')]({'where':{'UserId':_0x416206['id'],'VoiceQueueId':_0x2b771c[_0x0d21('0x50')]['id']},'defaults':{'penalty':_0x416206[_0x0d21('0x75')]},'transaction':_0x49cba5});});})[_0x0d21('0x23')](function(){return BPromise[_0x0d21('0x78')](_[_0x0d21('0x28')](_0x26210b,{'online':!![]}),function(_0x1881ad){return db[_0x0d21('0x7d')][_0x0d21('0x7a')]({'membername':_0x1881ad[_0x0d21('0x2f')],'UserId':_0x1881ad['id'],'queue_name':_0x3ef7c8[_0x0d21('0x2f')],'VoiceQueueId':_0x3ef7c8['id'],'interface':_[_0x0d21('0x7e')](_0x1881ad[_0x0d21('0x73')])?util[_0x0d21('0x7f')](_0x0d21('0x80'),_0x1881ad[_0x0d21('0x2f')]):_0x1881ad[_0x0d21('0x73')],'paused':_0x1881ad[_0x0d21('0x72')]||![],'penalty':_0x1881ad[_0x0d21('0x75')]},{'transaction':_0x49cba5});});})[_0x0d21('0x23')](function(){_0x26210b[_0x0d21('0x74')](function(_0x435447){socket[_0x0d21('0x81')](_0x0d21('0x82'),{'UserId':_0x435447['id'],'VoiceQueueId':_0x3ef7c8['id']});});});});});}})[_0x0d21('0x23')](respondWithStatusCode(_0x5ae937,null))[_0x0d21('0x53')](handleError(_0x5ae937,null));};exports[_0x0d21('0x83')]=function(_0x44fe49,_0x3bfd23,_0x337964){return db['Team'][_0x0d21('0x4e')]({'where':{'id':_0x44fe49[_0x0d21('0x41')][_0x0d21('0x84')]},'attributes':['id'],'include':[{'model':db[_0x0d21('0x6f')],'as':_0x0d21('0x70'),'attributes':['id'],'raw':!![]}]})[_0x0d21('0x23')](handleEntityNotFound(_0x3bfd23,null))['then'](function(_0x5cd5fb){var _0x215b9f=_[_0x0d21('0x2a')](_0x5cd5fb,'id');var _0x31a429=[];var _0x159e9e=[];var _0x2b055d=squel[_0x0d21('0x85')]();_0x2b055d[_0x0d21('0x86')](_0x0d21('0x87'))['from'](_0x0d21('0x88'),'tq')[_0x0d21('0x89')]('user_has_teams','ut',_0x0d21('0x8a'))[_0x0d21('0x4b')](_0x0d21('0x8b'),_0x44fe49[_0x0d21('0x50')]['id']);for(var _0x404fca=0x0;_0x404fca<_0x5cd5fb['length'];_0x404fca+=0x1){let _0x288d57=_0x5cd5fb[_0x404fca];for(var _0x52cceb=0x0;_0x52cceb<_0x288d57['Agents'][_0x0d21('0x46')];_0x52cceb+=0x1){let _0x472937=_0x288d57[_0x0d21('0x70')][_0x52cceb];var _0x387a72=_0x2b055d[_0x0d21('0x5e')]();_0x387a72[_0x0d21('0x4b')](_0x0d21('0x8c'),_0x472937['id']);_0x159e9e['push'](db[_0x0d21('0x76')][_0x0d21('0x41')](_0x387a72['toString'](),{'type':db[_0x0d21('0x76')][_0x0d21('0x8d')][_0x0d21('0x8e')]})[_0x0d21('0x23')](function(_0x5ac5f3){if(_0x5ac5f3[_0x0d21('0x46')]===0x1){return _0x472937['id'];}else{var _0x45f01a=_[_0x0d21('0x8f')](_['map'](_0x5ac5f3,_0x0d21('0x90')),function(_0x29f9bc){return _['includes'](_0x215b9f,_0x29f9bc);});if(_0x45f01a){return _0x472937['id'];}}}));}}return BPromise['all'](_0x159e9e)[_0x0d21('0x23')](function(_0x21cfd7){_0x31a429=_(_0x31a429)[_0x0d21('0x91')](_0x21cfd7)['compact']()[_0x0d21('0x2b')]();return db[_0x0d21('0x3c')]['find']({'where':{'id':_0x44fe49['params']['id']}})[_0x0d21('0x23')](function(_0x37a9ab){return db[_0x0d21('0x76')][_0x0d21('0x77')](function(_0x153516){return _0x37a9ab[_0x0d21('0x83')](_0x44fe49['query']['ids'],{'transaction':_0x153516})[_0x0d21('0x23')](function(){if(!_[_0x0d21('0x92')](_0x31a429)){return _0x37a9ab[_0x0d21('0x93')](_0x31a429,{'transaction':_0x153516})['then'](function(){return db[_0x0d21('0x7d')][_0x0d21('0x24')]({'where':{'VoiceQueueId':_0x44fe49[_0x0d21('0x50')]['id'],'UserId':_0x31a429},'transaction':_0x153516});});}})[_0x0d21('0x23')](function(){_0x31a429[_0x0d21('0x74')](function(_0x3e1931){socket[_0x0d21('0x81')](_0x0d21('0x94'),{'UserId':_0x3e1931,'VoiceQueueId':_0x37a9ab['id']});});});});});});})[_0x0d21('0x23')](respondWithStatusCode(_0x3bfd23,null))[_0x0d21('0x53')](handleError(_0x3bfd23,null));};exports['addAgents']=function(_0x1a2d62,_0x49e358,_0x33a61e){var _0x38808e,_0x5a9958;return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x1a2d62[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x49e358,null))[_0x0d21('0x23')](function(_0x4b500e){if(_0x4b500e){_0x5a9958=_0x4b500e;return _0x4b500e[_0x0d21('0x95')](_0x1a2d62[_0x0d21('0x35')]['ids'],_[_0x0d21('0x61')](_0x1a2d62[_0x0d21('0x35')],[_0x0d21('0x84'),'id'])||{})['spread'](function(_0x2d9501){for(var _0x245c76=0x0;_0x245c76<_0x1a2d62[_0x0d21('0x35')][_0x0d21('0x84')][_0x0d21('0x46')];_0x245c76+=0x1){socket[_0x0d21('0x81')]('userVoiceQueue:save',{'UserId':_0x1a2d62[_0x0d21('0x35')]['ids'][_0x245c76],'VoiceQueueId':_0x1a2d62[_0x0d21('0x50')]['id']});}return _0x2d9501;});}})[_0x0d21('0x23')](function(_0x18a4e6){_0x38808e=_0x18a4e6||[];if(_0x5a9958){return db[_0x0d21('0x6f')][_0x0d21('0x4e')]({'where':{'id':_0x1a2d62['body']['ids']},'attributes':['id',_0x0d21('0x2f'),'online','voicePause','interface'],'raw':!![]});}})[_0x0d21('0x23')](function(_0xd76f0){if(!_[_0x0d21('0x92')](_0xd76f0)){var _0x1b12b2=[];for(var _0x4f522a=0x0;_0x4f522a<_0xd76f0['length'];_0x4f522a++){if(_0xd76f0[_0x4f522a][_0x0d21('0x71')]){_0x1b12b2[_0x0d21('0x96')](db[_0x0d21('0x7d')][_0x0d21('0x7a')]({'membername':_0xd76f0[_0x4f522a]['name'],'UserId':_0xd76f0[_0x4f522a]['id'],'queue_name':_0x5a9958[_0x0d21('0x2f')],'VoiceQueueId':_0x5a9958['id'],'interface':_[_0x0d21('0x7e')](_0xd76f0[_0x4f522a]['interface'])?util[_0x0d21('0x7f')](_0x0d21('0x80'),_0xd76f0[_0x4f522a]['name']):_0xd76f0[_0x4f522a][_0x0d21('0x73')],'paused':_0xd76f0[_0x4f522a]['voicePause']||![],'penalty':_0x1a2d62['body']['penalty']||0x0}));}}return BPromise[_0x0d21('0x97')](_0x1b12b2);}})[_0x0d21('0x23')](function(){return _0x38808e;})[_0x0d21('0x23')](respondWithResult(_0x49e358,null))[_0x0d21('0x53')](handleError(_0x49e358,null));};exports[_0x0d21('0x93')]=function(_0x5cc3b0,_0x23a315,_0x350a6b){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x5cc3b0['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x23a315,null))['then'](function(_0x22eead){if(_0x22eead){return _0x22eead['removeAgents'](_0x5cc3b0['query'][_0x0d21('0x84')])[_0x0d21('0x23')](function(){if(_[_0x0d21('0x98')](_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')])){for(var _0x34fe2f=0x0;_0x34fe2f<_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')]['length'];_0x34fe2f+=0x1){socket[_0x0d21('0x81')](_0x0d21('0x94'),{'UserId':Number(_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')][_0x34fe2f]),'VoiceQueueId':Number(_0x5cc3b0[_0x0d21('0x50')]['id'])});}}else{socket[_0x0d21('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')]),'VoiceQueueId':Number(_0x5cc3b0[_0x0d21('0x50')]['id'])});}});}})[_0x0d21('0x23')](function(_0x579d88){return db[_0x0d21('0x7d')][_0x0d21('0x24')]({'where':{'VoiceQueueId':_0x5cc3b0['params']['id'],'UserId':_0x5cc3b0[_0x0d21('0x41')][_0x0d21('0x84')]}})[_0x0d21('0x23')](function(){return _0x579d88;});})[_0x0d21('0x23')](respondWithStatusCode(_0x23a315,null))[_0x0d21('0x53')](handleError(_0x23a315,null));};exports[_0x0d21('0x99')]=function(_0x4e34ce,_0x422414,_0x2bf441){var _0x5b23b5={};var _0x4b5dd6={};var _0x12e811;var _0x593391;return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x4e34ce[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x422414,null))[_0x0d21('0x23')](function(_0xd9b731){if(_0xd9b731){_0x12e811=_0xd9b731;_0x4b5dd6['model']=_[_0x0d21('0x40')](db[_0x0d21('0x6f')]['rawAttributes']);_0x4b5dd6['query']=_[_0x0d21('0x40')](_0x4e34ce[_0x0d21('0x41')]);_0x4b5dd6['filters']=_[_0x0d21('0x43')](_0x4b5dd6[_0x0d21('0x3f')],_0x4b5dd6['query']);_0x5b23b5[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x4b5dd6[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x45')]));_0x5b23b5[_0x0d21('0x44')]=_0x5b23b5[_0x0d21('0x44')][_0x0d21('0x46')]?_0x5b23b5[_0x0d21('0x44')]:_0x4b5dd6[_0x0d21('0x3f')];_0x5b23b5['order']=qs[_0x0d21('0x4a')](_0x4e34ce[_0x0d21('0x41')]['sort']);_0x5b23b5['where']=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x4e34ce['query'],_0x4b5dd6[_0x0d21('0x42')]));if(_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x28')]){_0x5b23b5[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x5b23b5['where'],{'$or':_[_0x0d21('0x2a')](_0x5b23b5[_0x0d21('0x44')],function(_0xa63fcb){var _0x251225={};_0x251225[_0xa63fcb]={'$like':'%'+_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x28')]+'%'};return _0x251225;})});}_0x5b23b5=_[_0x0d21('0x34')]({},_0x5b23b5,_0x4e34ce[_0x0d21('0x52')]);return _0x12e811[_0x0d21('0x99')](_0x5b23b5);}})[_0x0d21('0x23')](function(_0x4c15a3){if(_0x4c15a3){_0x593391=_0x4c15a3[_0x0d21('0x46')];if(!_0x4e34ce['query'][_0x0d21('0x47')](_0x0d21('0x48'))){_0x5b23b5['limit']=qs['limit'](_0x4e34ce[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x5b23b5['offset']=qs[_0x0d21('0x1c')](_0x4e34ce['query']['offset']);}return _0x12e811[_0x0d21('0x99')](_0x5b23b5);}})[_0x0d21('0x23')](function(_0x5c9145){if(_0x5c9145){return _0x5c9145?{'count':_0x593391,'rows':_0x5c9145}:null;}})[_0x0d21('0x23')](respondWithResult(_0x422414,null))[_0x0d21('0x53')](handleError(_0x422414,null));};exports[_0x0d21('0x9a')]=function(_0x3d756a,_0xdeac9d,_0x143997){var _0x5cfbef={};var _0x13d97c={};var _0x22c008;var _0x1a6cfc;return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x3d756a['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0xdeac9d,null))[_0x0d21('0x23')](function(_0x1e1ddf){if(_0x1e1ddf){_0x22c008=_0x1e1ddf;_0x13d97c[_0x0d21('0x3f')]=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x13d97c['query']=_[_0x0d21('0x40')](_0x3d756a[_0x0d21('0x41')]);_0x13d97c['filters']=_[_0x0d21('0x43')](_0x13d97c['model'],_0x13d97c['query']);_0x5cfbef[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x13d97c['model'],qs[_0x0d21('0x45')](_0x3d756a[_0x0d21('0x41')]['fields']));_0x5cfbef[_0x0d21('0x44')]=_0x5cfbef['attributes']['length']?_0x5cfbef[_0x0d21('0x44')]:_0x13d97c[_0x0d21('0x3f')];_0x5cfbef['order']=qs[_0x0d21('0x4a')](_0x3d756a[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x5cfbef[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_[_0x0d21('0x4c')](_0x3d756a[_0x0d21('0x41')],_0x13d97c[_0x0d21('0x42')]));if(_0x3d756a[_0x0d21('0x41')][_0x0d21('0x28')]){_0x5cfbef[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x5cfbef[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x5cfbef[_0x0d21('0x44')],function(_0x89f5b4){var _0xdae26b={};_0xdae26b[_0x89f5b4]={'$like':'%'+_0x3d756a[_0x0d21('0x41')]['filter']+'%'};return _0xdae26b;})});}_0x5cfbef=_['merge']({},_0x5cfbef,_0x3d756a[_0x0d21('0x52')]);return _0x22c008[_0x0d21('0x9a')](_0x5cfbef);}})[_0x0d21('0x23')](function(_0x19eb76){if(_0x19eb76){_0x1a6cfc=_0x19eb76['length'];if(!_0x3d756a[_0x0d21('0x41')][_0x0d21('0x47')]('nolimit')){_0x5cfbef['limit']=qs[_0x0d21('0x1d')](_0x3d756a[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x5cfbef[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x3d756a[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x22c008[_0x0d21('0x9a')](_0x5cfbef);}})[_0x0d21('0x23')](function(_0x42a51b){return _0x42a51b?{'count':_0x1a6cfc,'rows':_0x42a51b}:null;})[_0x0d21('0x23')](respondWithResult(_0xdeac9d,null))[_0x0d21('0x53')](handleError(_0xdeac9d,null));};exports[_0x0d21('0x9b')]=function(_0x26b294,_0x57b292,_0x26115d){var _0x849a0d={};var _0x34a628={};var _0x5cd930;var _0x1a4de5;return db[_0x0d21('0x3c')]['findOne']({'where':{'id':_0x26b294[_0x0d21('0x50')]['id']}})['then'](handleEntityNotFound(_0x57b292,null))['then'](function(_0x580aa5){if(_0x580aa5){_0x5cd930=_0x580aa5;_0x34a628['model']=_[_0x0d21('0x40')](db['CmList'][_0x0d21('0x3d')]);_0x34a628[_0x0d21('0x41')]=_[_0x0d21('0x40')](_0x26b294[_0x0d21('0x41')]);_0x34a628[_0x0d21('0x42')]=_[_0x0d21('0x43')](_0x34a628['model'],_0x34a628['query']);_0x849a0d[_0x0d21('0x44')]=_[_0x0d21('0x43')](_0x34a628['model'],qs['fields'](_0x26b294[_0x0d21('0x41')][_0x0d21('0x45')]));_0x849a0d[_0x0d21('0x44')]=_0x849a0d[_0x0d21('0x44')][_0x0d21('0x46')]?_0x849a0d[_0x0d21('0x44')]:_0x34a628[_0x0d21('0x3f')];_0x849a0d['order']=qs[_0x0d21('0x4a')](_0x26b294['query'][_0x0d21('0x4a')]);_0x849a0d['where']=qs['filters'](_[_0x0d21('0x4c')](_0x26b294['query'],_0x34a628[_0x0d21('0x42')]));if(_0x26b294['query'][_0x0d21('0x28')]){_0x849a0d[_0x0d21('0x4b')]=_['merge'](_0x849a0d[_0x0d21('0x4b')],{'$or':_[_0x0d21('0x2a')](_0x849a0d['attributes'],function(_0x11d716){var _0x1c939b={};_0x1c939b[_0x11d716]={'$like':'%'+_0x26b294[_0x0d21('0x41')]['filter']+'%'};return _0x1c939b;})});}_0x849a0d=_['merge']({},_0x849a0d,_0x26b294[_0x0d21('0x52')]);return _0x5cd930[_0x0d21('0x9b')](_0x849a0d);}})[_0x0d21('0x23')](function(_0xc49fff){if(_0xc49fff){_0x1a4de5=_0xc49fff['length'];if(!_0x26b294['query'][_0x0d21('0x47')](_0x0d21('0x48'))){_0x849a0d['limit']=qs[_0x0d21('0x1d')](_0x26b294['query'][_0x0d21('0x1d')]);_0x849a0d[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x26b294[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x5cd930[_0x0d21('0x9b')](_0x849a0d);}})['then'](function(_0x1da19d){if(_0x1da19d){return _0x1da19d?{'count':_0x1a4de5,'rows':_0x1da19d}:null;}})['then'](respondWithResult(_0x57b292,null))[_0x0d21('0x53')](handleError(_0x57b292,null));};exports[_0x0d21('0x9c')]=function(_0x4a8d23,_0x545fcb,_0x20f3e0){var _0x37716f,_0x312080;return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x4a8d23[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x545fcb,null))['then'](function(_0x49f181){if(_0x49f181){_0x312080=_0x49f181;return _0x49f181[_0x0d21('0x9c')](_0x4a8d23['body'][_0x0d21('0x84')],_[_0x0d21('0x61')](_0x4a8d23[_0x0d21('0x35')],[_0x0d21('0x84'),'id'])||{});}return null;})['spread'](function(_0x50a1bc){var _0x10c182;_0x37716f=_0x50a1bc||[];var _0x23ff11=[];if(_0x50a1bc){for(var _0x47a2f4=0x0;_0x47a2f4<_0x50a1bc[_0x0d21('0x46')];_0x47a2f4+=0x1){var _0x487a1d=_0x50a1bc[_0x47a2f4][_0x0d21('0x25')]({'plain':!![]});_0x312080[_0x0d21('0x9d')]=_0x4a8d23[_0x0d21('0x35')][_0x0d21('0x9d')]?_0x4a8d23[_0x0d21('0x35')][_0x0d21('0x9d')]:_0x312080[_0x0d21('0x9d')];switch(_0x312080[_0x0d21('0x9d')]){case'always':_0x10c182=squel[_0x0d21('0x9e')]()['into'](_0x0d21('0x9f'))[_0x0d21('0xa0')]([_0x0d21('0xa1'),_0x0d21('0xa2'),_0x0d21('0xa3'),_0x0d21('0xa4'),_0x0d21('0x68'),_0x0d21('0x5f'),_0x0d21('0x60')],squel['select']()['field'](_0x0d21('0xa1'),_0x0d21('0xa1'))[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0xa2'))[_0x0d21('0x86')]('id',_0x0d21('0xa3'))['field'](_0x487a1d[_0x0d21('0xa6')]['toString'](),_0x0d21('0xa4'))[_0x0d21('0x86')](_0x4a8d23[_0x0d21('0x50')]['id'][_0x0d21('0xa7')](),_0x0d21('0x68'))['field'](_0x0d21('0xa5'),_0x0d21('0x5f'))[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0x60'))[_0x0d21('0xa8')](_0x0d21('0xa9'))[_0x0d21('0x4b')](_0x0d21('0xaa'))[_0x0d21('0x4b')](_0x0d21('0xab'),_0x487a1d[_0x0d21('0xa6')][_0x0d21('0xa7')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x0d21('0x4b')](_0x0d21('0xac'),squel[_0x0d21('0x85')]()[_0x0d21('0x86')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x0d21('0xad'))[_0x0d21('0x4b')]('VoiceQueueId\x20=\x20?',_0x4a8d23[_0x0d21('0x50')]['id'][_0x0d21('0xa7')]()))[_0x0d21('0x4b')](_0x0d21('0xac'),squel[_0x0d21('0x85')]()['field'](_0x0d21('0xae'))[_0x0d21('0xa8')](_0x0d21('0x9f'))[_0x0d21('0x4b')]('VoiceQueueId\x20=\x20?',_0x4a8d23[_0x0d21('0x50')]['id']['toString']())))[_0x0d21('0xa7')]();break;case'onlyIfOpen':_0x10c182=squel[_0x0d21('0x9e')]()['into']('cm_hopper')['fromQuery']([_0x0d21('0xa1'),_0x0d21('0xa2'),_0x0d21('0xa3'),_0x0d21('0xa4'),_0x0d21('0x68'),_0x0d21('0x5f'),_0x0d21('0x60')],squel[_0x0d21('0x85')]()[_0x0d21('0x86')](_0x0d21('0xa1'),'phone')[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0xa2'))['field']('id',_0x0d21('0xa3'))[_0x0d21('0x86')](_0x487a1d[_0x0d21('0xa6')][_0x0d21('0xa7')](),_0x0d21('0xa4'))[_0x0d21('0x86')](_0x4a8d23['params']['id']['toString'](),_0x0d21('0x68'))[_0x0d21('0x86')]('NOW()','createdAt')[_0x0d21('0x86')](_0x0d21('0xa5'),'updatedAt')[_0x0d21('0xa8')](_0x0d21('0xa9'))[_0x0d21('0x4b')](_0x0d21('0xaa'))[_0x0d21('0x4b')](_0x0d21('0xab'),_0x487a1d[_0x0d21('0xa6')][_0x0d21('0xa7')]())['where'](_0x0d21('0xaf'))[_0x0d21('0x4b')](_0x0d21('0xac'),squel[_0x0d21('0x85')]()['field'](_0x0d21('0xae'))[_0x0d21('0xa8')](_0x0d21('0x9f'))[_0x0d21('0x4b')](_0x0d21('0x8b'),_0x4a8d23['params']['id'][_0x0d21('0xa7')]())))[_0x0d21('0xa7')]();break;default:_0x10c182=squel[_0x0d21('0x9e')]()[_0x0d21('0xb0')](_0x0d21('0x9f'))['fromQuery']([_0x0d21('0xa1'),'scheduledAt','ContactId','ListId','VoiceQueueId',_0x0d21('0x5f'),_0x0d21('0x60')],squel[_0x0d21('0x85')]()['field'](_0x0d21('0xa1'),'phone')[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0xa2'))['field']('id',_0x0d21('0xa3'))[_0x0d21('0x86')](_0x487a1d['CmListId'][_0x0d21('0xa7')](),'ListId')[_0x0d21('0x86')](_0x4a8d23[_0x0d21('0x50')]['id'][_0x0d21('0xa7')](),_0x0d21('0x68'))[_0x0d21('0x86')](_0x0d21('0xa5'),_0x0d21('0x5f'))[_0x0d21('0x86')]('NOW()','updatedAt')[_0x0d21('0xa8')](_0x0d21('0xa9'))[_0x0d21('0x4b')](_0x0d21('0xaa'))[_0x0d21('0x4b')]('ListId\x20=\x20?',_0x487a1d[_0x0d21('0xa6')]['toString']())['where'](_0x0d21('0xaf')))[_0x0d21('0xa7')]();}_0x23ff11[_0x0d21('0x96')](db[_0x0d21('0x76')][_0x0d21('0x41')](_0x10c182));}return BPromise[_0x0d21('0x97')](_0x23ff11);}})[_0x0d21('0x23')](function(){return _0x37716f;})[_0x0d21('0x23')](respondWithResult(_0x545fcb,null))[_0x0d21('0x53')](handleError(_0x545fcb,null));};exports['removeLists']=function(_0x43c080,_0x2831e7,_0x494daf){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x43c080[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x2831e7,null))['then'](function(_0x11943a){if(_0x11943a){return _0x11943a['removeLists'](_0x43c080['query'][_0x0d21('0x84')]);}})['then'](function(_0x238a00){if(_0x238a00){return db['CmHopper'][_0x0d21('0x24')]({'where':{'ListId':_0x43c080[_0x0d21('0x41')][_0x0d21('0x84')],'VoiceQueueId':_0x43c080[_0x0d21('0x50')]['id']}})[_0x0d21('0x23')](function(){return _0x238a00;});}})[_0x0d21('0x23')](respondWithStatusCode(_0x2831e7,null))[_0x0d21('0x53')](handleError(_0x2831e7,null));};exports[_0x0d21('0xb1')]=function(_0x1417b2,_0x36aaaf,_0x478d4c){var _0x43ba5b={};var _0x43e37d={};var _0x6af4c4;var _0x10e56c;return db[_0x0d21('0x3c')][_0x0d21('0x63')]({'where':{'id':_0x1417b2['params']['id']}})[_0x0d21('0x23')](handleEntityNotFound(_0x36aaaf,null))['then'](function(_0x5392a6){if(_0x5392a6){_0x6af4c4=_0x5392a6;_0x43e37d['model']=_[_0x0d21('0x40')](db[_0x0d21('0xb2')][_0x0d21('0x3d')]);_0x43e37d[_0x0d21('0x41')]=_[_0x0d21('0x40')](_0x1417b2[_0x0d21('0x41')]);_0x43e37d['filters']=_[_0x0d21('0x43')](_0x43e37d['model'],_0x43e37d[_0x0d21('0x41')]);_0x43ba5b['attributes']=_[_0x0d21('0x43')](_0x43e37d[_0x0d21('0x3f')],qs[_0x0d21('0x45')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x45')]));_0x43ba5b[_0x0d21('0x44')]=_0x43ba5b[_0x0d21('0x44')][_0x0d21('0x46')]?_0x43ba5b[_0x0d21('0x44')]:_0x43e37d[_0x0d21('0x3f')];_0x43ba5b[_0x0d21('0x49')]=qs[_0x0d21('0x4a')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x4a')]);_0x43ba5b[_0x0d21('0x4b')]=qs[_0x0d21('0x42')](_['pick'](_0x1417b2['query'],_0x43e37d['filters']));if(_0x1417b2['query'][_0x0d21('0x28')]){_0x43ba5b[_0x0d21('0x4b')]=_[_0x0d21('0x34')](_0x43ba5b['where'],{'$or':_[_0x0d21('0x2a')](_0x43ba5b['attributes'],function(_0x28f396){var _0x5966f9={};_0x5966f9[_0x28f396]={'$like':'%'+_0x1417b2['query']['filter']+'%'};return _0x5966f9;})});}_0x43ba5b=_[_0x0d21('0x34')]({},_0x43ba5b,_0x1417b2[_0x0d21('0x52')]);return _0x6af4c4[_0x0d21('0xb1')](_0x43ba5b);}})['then'](function(_0x380088){if(_0x380088){_0x10e56c=_0x380088[_0x0d21('0x46')];if(!_0x1417b2[_0x0d21('0x41')]['hasOwnProperty']('nolimit')){_0x43ba5b[_0x0d21('0x1d')]=qs[_0x0d21('0x1d')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x1d')]);_0x43ba5b[_0x0d21('0x1c')]=qs[_0x0d21('0x1c')](_0x1417b2[_0x0d21('0x41')][_0x0d21('0x1c')]);}return _0x6af4c4[_0x0d21('0xb1')](_0x43ba5b);}})[_0x0d21('0x23')](function(_0x34bfd7){if(_0x34bfd7){return _0x34bfd7?{'count':_0x10e56c,'rows':_0x34bfd7}:null;}})[_0x0d21('0x23')](respondWithResult(_0x36aaaf,null))[_0x0d21('0x53')](handleError(_0x36aaaf,null));};exports[_0x0d21('0xb3')]=function(_0xcf410d,_0x4edb94,_0x11af9c){var _0x1dd1ac,_0x46ccbe;return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0xcf410d['params']['id']}})['then'](handleEntityNotFound(_0x4edb94,null))['then'](function(_0x22819c){if(_0x22819c){_0x46ccbe=_0x22819c;return _0x22819c[_0x0d21('0xb3')](_0xcf410d[_0x0d21('0x35')][_0x0d21('0x84')],_['omit'](_0xcf410d[_0x0d21('0x35')],[_0x0d21('0x84'),'id'])||{});}return null;})['spread'](function(_0x103a85){var _0x5de67a;_0x1dd1ac=_0x103a85||[];var _0x3d18d3=[];if(_0x103a85){for(var _0x125a0c=0x0;_0x125a0c<_0x103a85[_0x0d21('0x46')];_0x125a0c+=0x1){var _0x2c520a=_0x103a85[_0x125a0c]['get']({'plain':!![]});_0x5de67a=squel[_0x0d21('0x9e')]()[_0x0d21('0xb0')](_0x0d21('0xb4'))[_0x0d21('0xa0')](['phone',_0x0d21('0xa3'),_0x0d21('0xa4'),_0x0d21('0x68'),'createdAt',_0x0d21('0x60')],squel[_0x0d21('0x85')]()['field'](_0x0d21('0xa1'),'phone')[_0x0d21('0x86')]('id','ContactId')[_0x0d21('0x86')](_0x2c520a[_0x0d21('0xa6')]['toString'](),'ListId')[_0x0d21('0x86')](_0xcf410d['params']['id'][_0x0d21('0xa7')](),'VoiceQueueId')[_0x0d21('0x86')]('NOW()','createdAt')['field'](_0x0d21('0xa5'),'updatedAt')[_0x0d21('0xa8')](_0x0d21('0xa9'))['where']('deletedAt\x20IS\x20NULL')[_0x0d21('0x4b')](_0x0d21('0xab'),_0x2c520a[_0x0d21('0xa6')][_0x0d21('0xa7')]())['where'](_0x0d21('0xaf')))[_0x0d21('0xa7')]();_0x3d18d3[_0x0d21('0x96')](db[_0x0d21('0x76')][_0x0d21('0x41')](_0x5de67a));}return BPromise[_0x0d21('0x97')](_0x3d18d3);}})[_0x0d21('0x23')](function(){return _0x1dd1ac;})['then'](respondWithResult(_0x4edb94,null))[_0x0d21('0x53')](handleError(_0x4edb94,null));};exports['removeBlackLists']=function(_0x3aa422,_0x672015,_0x99d727){return db[_0x0d21('0x3c')][_0x0d21('0x2e')]({'where':{'id':_0x3aa422['params']['id']}})['then'](handleEntityNotFound(_0x672015,null))[_0x0d21('0x23')](function(_0x1b9adc){if(_0x1b9adc){return _0x1b9adc[_0x0d21('0xb5')](_0x3aa422[_0x0d21('0x41')]['ids']);}})['then'](function(_0x118c7f){if(_0x118c7f){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x3aa422['query'][_0x0d21('0x84')],'VoiceQueueId':_0x3aa422[_0x0d21('0x50')]['id']}})['then'](function(){return _0x118c7f;});}})[_0x0d21('0x23')](respondWithStatusCode(_0x672015,null))[_0x0d21('0x53')](handleError(_0x672015,null));}; \ No newline at end of file +var _0x2aff=['agent','account','index','VoiceQueue','rawAttributes','key','query','keys','filters','model','attributes','intersection','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','VoiceQueueId','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','order','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','SIP/%s','voicePause','forEach','emit','userVoiceQueue:save','removeTeams','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','format','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','updatedAt','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','./voiceQueue.socket','sendStatus','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','ignore','map','value','includes','type','name','UserProfileResource','status','end','error','stack','send','render','merge','contact'];(function(_0x3da1eb,_0x3b50f1){var _0x3ccea2=function(_0x25daa9){while(--_0x25daa9){_0x3da1eb['push'](_0x3da1eb['shift']());}};_0x3ccea2(++_0x3b50f1);}(_0x2aff,0x82));var _0xf2af=function(_0x566608,_0x39e58c){_0x566608=_0x566608-0x0;var _0x449448=_0x2aff[_0x566608];return _0x449448;};'use strict';var emlformat=require(_0xf2af('0x0'));var rimraf=require(_0xf2af('0x1'));var zipdir=require(_0xf2af('0x2'));var jsonpatch=require(_0xf2af('0x3'));var rp=require(_0xf2af('0x4'));var moment=require(_0xf2af('0x5'));var BPromise=require(_0xf2af('0x6'));var Mustache=require(_0xf2af('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf2af('0x8'));var csv=require(_0xf2af('0x9'));var ejs=require(_0xf2af('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2af('0xb'));var squel=require(_0xf2af('0xc'));var crypto=require(_0xf2af('0xd'));var jsforce=require(_0xf2af('0xe'));var deskjs=require(_0xf2af('0xf'));var toCsv=require(_0xf2af('0x9'));var querystring=require(_0xf2af('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf2af('0x11'));var qs=require(_0xf2af('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2af('0x13'));var logger=require(_0xf2af('0x14'))(_0xf2af('0x15'));var utils=require(_0xf2af('0x16'));var config=require(_0xf2af('0x17'));var licenseUtil=require(_0xf2af('0x18'));var db=require(_0xf2af('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf2af('0x1a'))['register'](socket);function respondWithStatusCode(_0x138c23,_0x3298f7){_0x3298f7=_0x3298f7||0xcc;return function(_0x155fbd){if(_0x155fbd){return _0x138c23[_0xf2af('0x1b')](_0x3298f7);}return _0x138c23['status'](_0x3298f7)['end']();};}function respondWithResult(_0xc0293c,_0x36f4ae){_0x36f4ae=_0x36f4ae||0xc8;return function(_0x57ccd3){if(_0x57ccd3){return _0xc0293c['status'](_0x36f4ae)[_0xf2af('0x1c')](_0x57ccd3);}};}function respondWithFilteredResult(_0x4cc627,_0x379b9a){return function(_0x44351c){if(_0x44351c){var _0x38b20a=typeof _0x379b9a[_0xf2af('0x1d')]===_0xf2af('0x1e')&&typeof _0x379b9a[_0xf2af('0x1f')]==='undefined';var _0x24f529=_0x44351c[_0xf2af('0x20')];var _0xc55b91=_0x38b20a?0x0:_0x379b9a['offset'];var _0x185750=_0x38b20a?_0x44351c[_0xf2af('0x20')]:_0x379b9a[_0xf2af('0x1d')]+_0x379b9a[_0xf2af('0x1f')];var _0x4b74bb;if(_0x185750>=_0x24f529){_0x185750=_0x24f529;_0x4b74bb=0xc8;}else{_0x4b74bb=0xce;}_0x4cc627['status'](_0x4b74bb);return _0x4cc627[_0xf2af('0x21')]('Content-Range',_0xc55b91+'-'+_0x185750+'/'+_0x24f529)[_0xf2af('0x1c')](_0x44351c);}return null;};}function patchUpdates(_0x2950ba){return function(_0x4db6b5){try{jsonpatch[_0xf2af('0x22')](_0x4db6b5,_0x2950ba,!![]);}catch(_0x49ece3){return BPromise['reject'](_0x49ece3);}return _0x4db6b5[_0xf2af('0x23')]();};}function saveUpdates(_0x58c01c,_0x55cb20){return function(_0x243651){if(_0x243651){return _0x243651[_0xf2af('0x24')](_0x58c01c)[_0xf2af('0x25')](function(_0x5b6c33){return _0x5b6c33;});}return null;};}function removeEntity(_0x3c1491,_0x7df536){return function(_0x5abbcb){if(_0x5abbcb){return _0x5abbcb[_0xf2af('0x26')]()[_0xf2af('0x25')](function(){var _0x3efc05=_0x5abbcb[_0xf2af('0x27')]({'plain':!![]});var _0x425822=[{'name':_0xf2af('0x28'),'value':'inbound','ignore':![]},{'name':_0xf2af('0x29'),'value':_0xf2af('0x2a'),'ignore':![]}];var _0x1a6d3c=_(_0x425822)['filter'](_0xf2af('0x2b'))[_0xf2af('0x2c')](_0xf2af('0x2d'))[_0xf2af('0x2d')]();if(_[_0xf2af('0x2e')](_0x1a6d3c,_0x3efc05['type'])){return;}var _0x569915=_['find'](_0x425822,[_0xf2af('0x2d'),_0x3efc05[_0xf2af('0x2f')]])[_0xf2af('0x30')];return db[_0xf2af('0x31')][_0xf2af('0x26')]({'where':{'type':_0x569915,'resourceId':_0x3efc05['id']}})[_0xf2af('0x25')](function(){return _0x5abbcb;});})[_0xf2af('0x25')](function(){_0x3c1491[_0xf2af('0x32')](0xcc)[_0xf2af('0x33')]();});}};}function handleEntityNotFound(_0x56d032,_0x833d9c){return function(_0x351f9d){if(!_0x351f9d){_0x56d032[_0xf2af('0x1b')](0x194);}return _0x351f9d;};}function handleError(_0x444dc0,_0x6184d4){_0x6184d4=_0x6184d4||0x1f4;return function(_0x11b9f0){logger[_0xf2af('0x34')](_0x11b9f0[_0xf2af('0x35')]);if(_0x11b9f0[_0xf2af('0x30')]){delete _0x11b9f0[_0xf2af('0x30')];}_0x444dc0[_0xf2af('0x32')](_0x6184d4)[_0xf2af('0x36')](_0x11b9f0);};}function getMustacheRender(_0xe958f0,_0x4c58e1){return Mustache[_0xf2af('0x37')](_0xe958f0,_[_0xf2af('0x38')](_0x4c58e1['body'],{'contact':_0x4c58e1[_0xf2af('0x39')],'message':_0x4c58e1['message'],'agent':_0x4c58e1[_0xf2af('0x3a')],'interaction':_0x4c58e1['interaction'],'account':_0x4c58e1[_0xf2af('0x3b')]}))||'';}exports[_0xf2af('0x3c')]=function(_0x28b0b1,_0x15f2eb){var _0xd6cd8f={},_0x47252b={},_0x1c9122={'count':0x0,'rows':[]};var _0x4bca60=_[_0xf2af('0x2c')](db[_0xf2af('0x3d')][_0xf2af('0x3e')],function(_0x29bf09){return{'name':_0x29bf09['fieldName'],'type':_0x29bf09[_0xf2af('0x2f')][_0xf2af('0x3f')]};});_0x47252b['model']=_['map'](_0x4bca60,_0xf2af('0x30'));_0x47252b[_0xf2af('0x40')]=_[_0xf2af('0x41')](_0x28b0b1[_0xf2af('0x40')]);_0x47252b[_0xf2af('0x42')]=_['intersection'](_0x47252b[_0xf2af('0x43')],_0x47252b[_0xf2af('0x40')]);_0xd6cd8f[_0xf2af('0x44')]=_[_0xf2af('0x45')](_0x47252b['model'],qs['fields'](_0x28b0b1['query']['fields']));_0xd6cd8f['attributes']=_0xd6cd8f[_0xf2af('0x44')][_0xf2af('0x46')]?_0xd6cd8f[_0xf2af('0x44')]:_0x47252b[_0xf2af('0x43')];if(!_0x28b0b1[_0xf2af('0x40')]['hasOwnProperty'](_0xf2af('0x47'))){_0xd6cd8f[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x28b0b1[_0xf2af('0x40')]['limit']);_0xd6cd8f[_0xf2af('0x1d')]=qs[_0xf2af('0x1d')](_0x28b0b1['query'][_0xf2af('0x1d')]);}_0xd6cd8f['order']=qs[_0xf2af('0x48')](_0x28b0b1['query'][_0xf2af('0x48')]);_0xd6cd8f[_0xf2af('0x49')]=qs['filters'](_[_0xf2af('0x4a')](_0x28b0b1[_0xf2af('0x40')],_0x47252b[_0xf2af('0x42')]),_0x4bca60);if(_0x28b0b1[_0xf2af('0x40')][_0xf2af('0x4b')]){_0xd6cd8f[_0xf2af('0x49')]=_[_0xf2af('0x38')](_0xd6cd8f[_0xf2af('0x49')],{'$or':_[_0xf2af('0x2c')](_0x4bca60,function(_0x2e33d6){if(_0x2e33d6[_0xf2af('0x2f')]!==_0xf2af('0x4c')){var _0x21a024={};_0x21a024[_0x2e33d6[_0xf2af('0x30')]]={'$like':'%'+_0x28b0b1[_0xf2af('0x40')]['filter']+'%'};return _0x21a024;}})});}_0xd6cd8f=_[_0xf2af('0x38')]({},_0xd6cd8f,_0x28b0b1[_0xf2af('0x4d')]);var _0x71479f={'where':_0xd6cd8f['where']};return db[_0xf2af('0x3d')]['count'](_0x71479f)['then'](function(_0x16d1e8){_0x1c9122[_0xf2af('0x20')]=_0x16d1e8;if(_0x28b0b1['query'][_0xf2af('0x4e')]){_0xd6cd8f['include']=[{'all':!![]}];}return db[_0xf2af('0x3d')][_0xf2af('0x4f')](_0xd6cd8f);})[_0xf2af('0x25')](function(_0x2ecbd9){_0x1c9122[_0xf2af('0x50')]=_0x2ecbd9;return _0x1c9122;})[_0xf2af('0x25')](respondWithFilteredResult(_0x15f2eb,_0xd6cd8f))[_0xf2af('0x51')](handleError(_0x15f2eb,null));};exports[_0xf2af('0x52')]=function(_0x2f569b,_0x5125ca){var _0x563e41={'raw':![],'where':{'id':_0x2f569b['params']['id']}},_0x1e0ab2={};_0x1e0ab2[_0xf2af('0x43')]=_['keys'](db['VoiceQueue'][_0xf2af('0x3e')]);_0x1e0ab2[_0xf2af('0x40')]=_[_0xf2af('0x41')](_0x2f569b[_0xf2af('0x40')]);_0x1e0ab2[_0xf2af('0x42')]=_[_0xf2af('0x45')](_0x1e0ab2[_0xf2af('0x43')],_0x1e0ab2[_0xf2af('0x40')]);_0x563e41[_0xf2af('0x44')]=_[_0xf2af('0x45')](_0x1e0ab2['model'],qs[_0xf2af('0x53')](_0x2f569b[_0xf2af('0x40')][_0xf2af('0x53')]));_0x563e41['attributes']=_0x563e41['attributes'][_0xf2af('0x46')]?_0x563e41['attributes']:_0x1e0ab2[_0xf2af('0x43')];if(_0x2f569b[_0xf2af('0x40')]['includeAll']){_0x563e41[_0xf2af('0x54')]=[{'all':!![]}];}_0x563e41=_['merge']({},_0x563e41,_0x2f569b[_0xf2af('0x4d')]);return db[_0xf2af('0x3d')][_0xf2af('0x55')](_0x563e41)['then'](handleEntityNotFound(_0x5125ca,null))[_0xf2af('0x25')](respondWithResult(_0x5125ca,null))[_0xf2af('0x51')](handleError(_0x5125ca,null));};exports['create']=function(_0x3b7126,_0x311736){return db[_0xf2af('0x3d')][_0xf2af('0x56')](_0x3b7126[_0xf2af('0x57')],{})[_0xf2af('0x25')](function(_0x156e94){var _0x234b6f=_0x3b7126[_0xf2af('0x58')]['get']({'plain':!![]});if(!_0x234b6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x234b6f[_0xf2af('0x59')]===_0xf2af('0x58')){var _0x572d23=_0x156e94[_0xf2af('0x27')]({'plain':!![]});var _0x27a7d6=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xf2af('0x2a')}];var _0x227866=_[_0xf2af('0x55')](_0x27a7d6,[_0xf2af('0x2d'),_0x572d23['type']])[_0xf2af('0x30')];return db[_0xf2af('0x5a')][_0xf2af('0x55')]({'where':{'name':_0x227866,'userProfileId':_0x234b6f[_0xf2af('0x5b')]},'raw':!![]})[_0xf2af('0x25')](function(_0xbdd512){if(_0xbdd512&&_0xbdd512[_0xf2af('0x5c')]===0x0){return db[_0xf2af('0x31')][_0xf2af('0x56')]({'name':_0x572d23['name'],'resourceId':_0x572d23['id'],'type':_0xbdd512[_0xf2af('0x30')],'sectionId':_0xbdd512['id']},{})['then'](function(){return _0x156e94;});}else{return _0x156e94;}})[_0xf2af('0x51')](function(_0x25f986){logger[_0xf2af('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25f986);throw _0x25f986;});}return _0x156e94;})['then'](respondWithResult(_0x311736,0xc9))[_0xf2af('0x51')](handleError(_0x311736,null));};exports['clone']=function(_0x46f552,_0x2f5635){var _0xabd52e={'where':{'id':_0x46f552[_0xf2af('0x5d')]['id']}},_0x854231={};_0x854231[_0xf2af('0x43')]=_[_0xf2af('0x41')](db[_0xf2af('0x3d')]['rawAttributes']);_0xabd52e['attributes']=_[_0xf2af('0x45')](_0x854231[_0xf2af('0x43')],qs['fields'](_0x46f552[_0xf2af('0x40')][_0xf2af('0x53')]));_0xabd52e[_0xf2af('0x44')]=_0xabd52e[_0xf2af('0x44')][_0xf2af('0x46')]?_0xabd52e[_0xf2af('0x44')]:_0x854231[_0xf2af('0x43')];if(_0x46f552['query'][_0xf2af('0x4e')]){_0xabd52e['include']=[{'all':!![]}];}_0xabd52e=_['merge']({},_0xabd52e,_0x46f552[_0xf2af('0x4d')]);return db[_0xf2af('0x3d')]['find'](_0xabd52e)[_0xf2af('0x25')](handleEntityNotFound(_0x2f5635,null))[_0xf2af('0x25')](function(_0x36d8bb){if(_0x36d8bb){var _0x3b54f8=_0x36d8bb[_0xf2af('0x27')]({'plain':!![]});_0x3b54f8=qs[_0xf2af('0x5e')](_0x3b54f8,['id',_0xf2af('0x5f'),'updatedAt']);_0x46f552[_0xf2af('0x57')]=_[_0xf2af('0x5e')](_0x46f552[_0xf2af('0x57')],['id',_0xf2af('0x5f'),'updatedAt']);return db[_0xf2af('0x3d')][_0xf2af('0x56')](_[_0xf2af('0x38')](_0x3b54f8,_0x46f552[_0xf2af('0x57')]),{'include':_0x46f552[_0xf2af('0x40')][_0xf2af('0x4e')]?[{'all':!![]}]:undefined})[_0xf2af('0x25')](function(_0x67afe4){var _0x3bd454=_0x46f552[_0xf2af('0x58')]['get']({'plain':!![]});if(!_0x3bd454)throw new Error(_0xf2af('0x60'));if(_0x3bd454[_0xf2af('0x59')]===_0xf2af('0x58')){var _0x1d4fed=_0x67afe4[_0xf2af('0x27')]({'plain':!![]});var _0x1d880c=[{'name':_0xf2af('0x28'),'value':_0xf2af('0x61')},{'name':_0xf2af('0x29'),'value':_0xf2af('0x2a')}];var _0x24d7c8=_[_0xf2af('0x55')](_0x1d880c,[_0xf2af('0x2d'),_0x1d4fed[_0xf2af('0x2f')]])[_0xf2af('0x30')];return db[_0xf2af('0x5a')][_0xf2af('0x55')]({'where':{'name':_0x24d7c8,'userProfileId':_0x3bd454[_0xf2af('0x5b')]},'raw':!![]})[_0xf2af('0x25')](function(_0x5377d6){if(_0x5377d6&&_0x5377d6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1d4fed['name'],'resourceId':_0x1d4fed['id'],'type':_0x5377d6[_0xf2af('0x30')],'sectionId':_0x5377d6['id']},{})[_0xf2af('0x25')](function(){return _0x67afe4;});}else{return _0x67afe4;}})[_0xf2af('0x51')](function(_0x3f2d7f){logger['error'](_0xf2af('0x62'),_0x3f2d7f);throw _0x3f2d7f;});}return _0x67afe4;});}})[_0xf2af('0x25')](respondWithResult(_0x2f5635,0xc9))[_0xf2af('0x51')](handleError(_0x2f5635,null));};exports[_0xf2af('0x24')]=function(_0x20374c,_0xf85743){if(_0x20374c[_0xf2af('0x57')]['id']){delete _0x20374c[_0xf2af('0x57')]['id'];}return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0x20374c[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0xf85743,null))[_0xf2af('0x25')](saveUpdates(_0x20374c['body'],null))[_0xf2af('0x25')](respondWithResult(_0xf85743,null))[_0xf2af('0x51')](handleError(_0xf85743,null));};exports[_0xf2af('0x26')]=function(_0x3818ed,_0x213508){return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0x3818ed['params']['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x213508,null))[_0xf2af('0x25')](removeEntity(_0x213508,null))[_0xf2af('0x51')](handleError(_0x213508,null));};exports[_0xf2af('0x63')]=function(_0x38671e,_0x358ab7,_0x5d0c9f){var _0x4a9aa4={'raw':![],'where':{}};var _0x262b5a={};var _0x54595c={'count':0x0,'rows':[]};return db[_0xf2af('0x3d')]['findOne']({'where':{'id':_0x38671e[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x358ab7,null))[_0xf2af('0x25')](function(_0x1a47c6){if(_0x1a47c6){_0x262b5a[_0xf2af('0x43')]=_[_0xf2af('0x41')](db[_0xf2af('0x64')][_0xf2af('0x3e')]);_0x262b5a[_0xf2af('0x40')]=_[_0xf2af('0x41')](_0x38671e['query']);_0x262b5a[_0xf2af('0x42')]=_['intersection'](_0x262b5a[_0xf2af('0x43')],_0x262b5a[_0xf2af('0x40')]);_0x4a9aa4[_0xf2af('0x44')]=_['intersection'](_0x262b5a['model'],qs[_0xf2af('0x53')](_0x38671e[_0xf2af('0x40')][_0xf2af('0x53')]));_0x4a9aa4[_0xf2af('0x44')]=_0x4a9aa4[_0xf2af('0x44')][_0xf2af('0x46')]?_0x4a9aa4[_0xf2af('0x44')]:_0x262b5a['model'];if(!_0x38671e[_0xf2af('0x40')]['hasOwnProperty'](_0xf2af('0x47'))){_0x4a9aa4[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x38671e['query'][_0xf2af('0x1f')]);_0x4a9aa4['offset']=qs[_0xf2af('0x1d')](_0x38671e[_0xf2af('0x40')][_0xf2af('0x1d')]);}_0x4a9aa4['order']=qs[_0xf2af('0x48')](_0x38671e[_0xf2af('0x40')][_0xf2af('0x48')]);_0x4a9aa4['where']=qs[_0xf2af('0x42')](_[_0xf2af('0x4a')](_0x38671e[_0xf2af('0x40')],_0x262b5a['filters']));_0x4a9aa4[_0xf2af('0x49')][_0xf2af('0x65')]=_0x1a47c6['id'];if(_0x38671e[_0xf2af('0x40')][_0xf2af('0x4b')]){_0x4a9aa4[_0xf2af('0x49')]=_[_0xf2af('0x38')](_0x4a9aa4[_0xf2af('0x49')],{'$or':_[_0xf2af('0x2c')](_0x4a9aa4[_0xf2af('0x44')],function(_0x18acd9){var _0x2b31c3={};_0x2b31c3[_0x18acd9]={'$like':'%'+_0x38671e['query'][_0xf2af('0x4b')]+'%'};return _0x2b31c3;})});}_0x4a9aa4=_['merge']({},_0x4a9aa4,_0x38671e[_0xf2af('0x4d')]);return db['CmHopper'][_0xf2af('0x20')]({'where':_0x4a9aa4['where']})[_0xf2af('0x25')](function(_0x45060e){_0x54595c[_0xf2af('0x20')]=_0x45060e;if(_0x38671e['query'][_0xf2af('0x4e')]){_0x4a9aa4[_0xf2af('0x54')]=[{'all':!![]}];}return db[_0xf2af('0x64')][_0xf2af('0x4f')](_0x4a9aa4);})['then'](function(_0x2cee85){_0x54595c[_0xf2af('0x50')]=_0x2cee85;return _0x54595c;});}})[_0xf2af('0x25')](respondWithFilteredResult(_0x358ab7,_0x4a9aa4))[_0xf2af('0x51')](handleError(_0x358ab7,null));};exports['getHopperHistories']=function(_0x1a6060,_0x3be5f1,_0x77fa34){var _0x486979={'raw':!![],'where':{}};var _0x4aa7e4={};var _0x3b44d8={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1a6060[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3be5f1,null))[_0xf2af('0x25')](function(_0x14923c){if(_0x14923c){_0x4aa7e4[_0xf2af('0x43')]=_[_0xf2af('0x41')](db[_0xf2af('0x66')][_0xf2af('0x3e')]);_0x4aa7e4['query']=_[_0xf2af('0x41')](_0x1a6060['query']);_0x4aa7e4[_0xf2af('0x42')]=_[_0xf2af('0x45')](_0x4aa7e4[_0xf2af('0x43')],_0x4aa7e4[_0xf2af('0x40')]);_0x486979[_0xf2af('0x44')]=_[_0xf2af('0x45')](_0x4aa7e4[_0xf2af('0x43')],qs['fields'](_0x1a6060['query'][_0xf2af('0x53')]));_0x486979[_0xf2af('0x44')]=_0x486979[_0xf2af('0x44')][_0xf2af('0x46')]?_0x486979['attributes']:_0x4aa7e4[_0xf2af('0x43')];if(!_0x1a6060[_0xf2af('0x40')][_0xf2af('0x67')]('nolimit')){_0x486979[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x1a6060['query'][_0xf2af('0x1f')]);_0x486979[_0xf2af('0x1d')]=qs[_0xf2af('0x1d')](_0x1a6060[_0xf2af('0x40')][_0xf2af('0x1d')]);}_0x486979['order']=qs[_0xf2af('0x48')](_0x1a6060[_0xf2af('0x40')][_0xf2af('0x48')]);_0x486979[_0xf2af('0x49')]=qs['filters'](_[_0xf2af('0x4a')](_0x1a6060[_0xf2af('0x40')],_0x4aa7e4[_0xf2af('0x42')]));_0x486979[_0xf2af('0x49')]['VoiceQueueId']=_0x14923c['id'];if(_0x1a6060[_0xf2af('0x40')][_0xf2af('0x4b')]){_0x486979[_0xf2af('0x49')]=_['merge'](_0x486979[_0xf2af('0x49')],{'$or':_['map'](_0x486979[_0xf2af('0x44')],function(_0x1f05ba){var _0x2d6e3f={};_0x2d6e3f[_0x1f05ba]={'$like':'%'+_0x1a6060[_0xf2af('0x40')][_0xf2af('0x4b')]+'%'};return _0x2d6e3f;})});}_0x486979=_[_0xf2af('0x38')]({},_0x486979,_0x1a6060[_0xf2af('0x4d')]);return db['CmHopperHistory'][_0xf2af('0x20')]({'where':_0x486979[_0xf2af('0x49')]})[_0xf2af('0x25')](function(_0x26706a){_0x3b44d8[_0xf2af('0x20')]=_0x26706a;if(_0x1a6060[_0xf2af('0x40')]['includeAll']){_0x486979[_0xf2af('0x54')]=[{'all':!![]}];}return db[_0xf2af('0x66')][_0xf2af('0x4f')](_0x486979);})[_0xf2af('0x25')](function(_0x407206){_0x3b44d8['rows']=_0x407206;return _0x3b44d8;});}})[_0xf2af('0x25')](respondWithFilteredResult(_0x3be5f1,_0x486979))[_0xf2af('0x51')](handleError(_0x3be5f1,null));};exports[_0xf2af('0x68')]=function(_0x32d3bc,_0x3d189d,_0x3c0aa4){var _0x58cfa1={'raw':!![],'where':{}};var _0x510170={};var _0x510421={'count':0x0,'rows':[]};return db[_0xf2af('0x3d')][_0xf2af('0x69')]({'where':{'id':_0x32d3bc[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3d189d,null))['then'](function(_0x445e31){if(_0x445e31){_0x510170[_0xf2af('0x43')]=_[_0xf2af('0x41')](db[_0xf2af('0x6a')][_0xf2af('0x3e')]);_0x510170['query']=_[_0xf2af('0x41')](_0x32d3bc[_0xf2af('0x40')]);_0x510170[_0xf2af('0x42')]=_['intersection'](_0x510170[_0xf2af('0x43')],_0x510170[_0xf2af('0x40')]);_0x58cfa1['attributes']=_[_0xf2af('0x45')](_0x510170[_0xf2af('0x43')],qs[_0xf2af('0x53')](_0x32d3bc[_0xf2af('0x40')][_0xf2af('0x53')]));_0x58cfa1[_0xf2af('0x44')]=_0x58cfa1[_0xf2af('0x44')][_0xf2af('0x46')]?_0x58cfa1[_0xf2af('0x44')]:_0x510170[_0xf2af('0x43')];if(!_0x32d3bc[_0xf2af('0x40')][_0xf2af('0x67')](_0xf2af('0x47'))){_0x58cfa1[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x32d3bc[_0xf2af('0x40')][_0xf2af('0x1f')]);_0x58cfa1[_0xf2af('0x1d')]=qs['offset'](_0x32d3bc['query'][_0xf2af('0x1d')]);}_0x58cfa1[_0xf2af('0x6b')]=qs[_0xf2af('0x48')](_0x32d3bc[_0xf2af('0x40')][_0xf2af('0x48')]);_0x58cfa1[_0xf2af('0x49')]=qs[_0xf2af('0x42')](_[_0xf2af('0x4a')](_0x32d3bc[_0xf2af('0x40')],_0x510170[_0xf2af('0x42')]));_0x58cfa1['where'][_0xf2af('0x65')]=_0x445e31['id'];if(_0x32d3bc[_0xf2af('0x40')][_0xf2af('0x4b')]){_0x58cfa1[_0xf2af('0x49')]=_['merge'](_0x58cfa1[_0xf2af('0x49')],{'$or':_[_0xf2af('0x2c')](_0x58cfa1[_0xf2af('0x44')],function(_0x11aa6d){var _0x1a41dd={};_0x1a41dd[_0x11aa6d]={'$like':'%'+_0x32d3bc['query']['filter']+'%'};return _0x1a41dd;})});}_0x58cfa1=_[_0xf2af('0x38')]({},_0x58cfa1,_0x32d3bc[_0xf2af('0x4d')]);return db['CmHopperFinal'][_0xf2af('0x20')]({'where':_0x58cfa1[_0xf2af('0x49')]})[_0xf2af('0x25')](function(_0x491cc9){_0x510421[_0xf2af('0x20')]=_0x491cc9;if(_0x32d3bc[_0xf2af('0x40')][_0xf2af('0x4e')]){_0x58cfa1[_0xf2af('0x54')]=[{'all':!![]}];}return db[_0xf2af('0x6a')][_0xf2af('0x4f')](_0x58cfa1);})[_0xf2af('0x25')](function(_0xf195c2){_0x510421['rows']=_0xf195c2;return _0x510421;});}})[_0xf2af('0x25')](respondWithFilteredResult(_0x3d189d,_0x58cfa1))[_0xf2af('0x51')](handleError(_0x3d189d,null));};exports['getHopperBlacks']=function(_0x524845,_0x3c6908,_0x9d517e){var _0x485a5e={'raw':!![],'where':{}};var _0x509848={};var _0x13f7f9={'count':0x0,'rows':[]};return db[_0xf2af('0x3d')][_0xf2af('0x69')]({'where':{'id':_0x524845[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3c6908,null))[_0xf2af('0x25')](function(_0x42757d){if(_0x42757d){_0x509848[_0xf2af('0x43')]=_[_0xf2af('0x41')](db['CmHopperBlack'][_0xf2af('0x3e')]);_0x509848[_0xf2af('0x40')]=_[_0xf2af('0x41')](_0x524845[_0xf2af('0x40')]);_0x509848[_0xf2af('0x42')]=_[_0xf2af('0x45')](_0x509848[_0xf2af('0x43')],_0x509848[_0xf2af('0x40')]);_0x485a5e[_0xf2af('0x44')]=_[_0xf2af('0x45')](_0x509848[_0xf2af('0x43')],qs['fields'](_0x524845[_0xf2af('0x40')][_0xf2af('0x53')]));_0x485a5e[_0xf2af('0x44')]=_0x485a5e[_0xf2af('0x44')]['length']?_0x485a5e[_0xf2af('0x44')]:_0x509848['model'];if(!_0x524845['query'][_0xf2af('0x67')]('nolimit')){_0x485a5e[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x524845['query']['limit']);_0x485a5e[_0xf2af('0x1d')]=qs[_0xf2af('0x1d')](_0x524845[_0xf2af('0x40')]['offset']);}_0x485a5e[_0xf2af('0x6b')]=qs[_0xf2af('0x48')](_0x524845['query'][_0xf2af('0x48')]);_0x485a5e[_0xf2af('0x49')]=qs[_0xf2af('0x42')](_[_0xf2af('0x4a')](_0x524845[_0xf2af('0x40')],_0x509848[_0xf2af('0x42')]));_0x485a5e[_0xf2af('0x49')][_0xf2af('0x65')]=_0x42757d['id'];if(_0x524845['query'][_0xf2af('0x4b')]){_0x485a5e['where']=_[_0xf2af('0x38')](_0x485a5e['where'],{'$or':_[_0xf2af('0x2c')](_0x485a5e[_0xf2af('0x44')],function(_0x2202f4){var _0x12ab05={};_0x12ab05[_0x2202f4]={'$like':'%'+_0x524845[_0xf2af('0x40')][_0xf2af('0x4b')]+'%'};return _0x12ab05;})});}_0x485a5e=_[_0xf2af('0x38')]({},_0x485a5e,_0x524845[_0xf2af('0x4d')]);return db[_0xf2af('0x6c')][_0xf2af('0x20')]({'where':_0x485a5e[_0xf2af('0x49')]})[_0xf2af('0x25')](function(_0x55c041){_0x13f7f9[_0xf2af('0x20')]=_0x55c041;if(_0x524845[_0xf2af('0x40')][_0xf2af('0x4e')]){_0x485a5e[_0xf2af('0x54')]=[{'all':!![]}];}return db[_0xf2af('0x6c')]['findAll'](_0x485a5e);})[_0xf2af('0x25')](function(_0x4ac431){_0x13f7f9['rows']=_0x4ac431;return _0x13f7f9;});}})['then'](respondWithFilteredResult(_0x3c6908,_0x485a5e))[_0xf2af('0x51')](handleError(_0x3c6908,null));};exports[_0xf2af('0x6d')]=function(_0x3cbca7,_0x12c0e8,_0x55fd9b){var _0xebebee={};var _0x580b85={};var _0x5086fa;var _0x5e5a84;return db[_0xf2af('0x3d')][_0xf2af('0x69')]({'where':{'id':_0x3cbca7[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x12c0e8,null))[_0xf2af('0x25')](function(_0x56509b){if(_0x56509b){_0x5086fa=_0x56509b;_0x580b85[_0xf2af('0x43')]=_[_0xf2af('0x41')](db[_0xf2af('0x6e')][_0xf2af('0x3e')]);_0x580b85[_0xf2af('0x40')]=_[_0xf2af('0x41')](_0x3cbca7[_0xf2af('0x40')]);_0x580b85['filters']=_[_0xf2af('0x45')](_0x580b85[_0xf2af('0x43')],_0x580b85[_0xf2af('0x40')]);_0xebebee['attributes']=_[_0xf2af('0x45')](_0x580b85['model'],qs[_0xf2af('0x53')](_0x3cbca7[_0xf2af('0x40')][_0xf2af('0x53')]));_0xebebee['attributes']=_0xebebee[_0xf2af('0x44')][_0xf2af('0x46')]?_0xebebee[_0xf2af('0x44')]:_0x580b85[_0xf2af('0x43')];_0xebebee[_0xf2af('0x6b')]=qs['sort'](_0x3cbca7[_0xf2af('0x40')]['sort']);_0xebebee[_0xf2af('0x49')]=qs['filters'](_[_0xf2af('0x4a')](_0x3cbca7['query'],_0x580b85[_0xf2af('0x42')]));if(_0x3cbca7[_0xf2af('0x40')]['filter']){_0xebebee[_0xf2af('0x49')]=_[_0xf2af('0x38')](_0xebebee[_0xf2af('0x49')],{'$or':_[_0xf2af('0x2c')](_0xebebee[_0xf2af('0x44')],function(_0x479d87){var _0x5e5cd9={};_0x5e5cd9[_0x479d87]={'$like':'%'+_0x3cbca7[_0xf2af('0x40')][_0xf2af('0x4b')]+'%'};return _0x5e5cd9;})});}_0xebebee=_[_0xf2af('0x38')]({},_0xebebee,_0x3cbca7[_0xf2af('0x4d')]);return _0x5086fa['getTeams'](_0xebebee);}})[_0xf2af('0x25')](function(_0x4ab69b){if(_0x4ab69b){_0x5e5a84=_0x4ab69b['length'];if(!_0x3cbca7['query'][_0xf2af('0x67')](_0xf2af('0x47'))){_0xebebee[_0xf2af('0x1f')]=qs['limit'](_0x3cbca7[_0xf2af('0x40')][_0xf2af('0x1f')]);_0xebebee['offset']=qs[_0xf2af('0x1d')](_0x3cbca7[_0xf2af('0x40')][_0xf2af('0x1d')]);}return _0x5086fa[_0xf2af('0x6d')](_0xebebee);}})[_0xf2af('0x25')](function(_0x2c2cdd){if(_0x2c2cdd){return _0x2c2cdd?{'count':_0x5e5a84,'rows':_0x2c2cdd}:null;}})['then'](respondWithResult(_0x12c0e8,null))[_0xf2af('0x51')](handleError(_0x12c0e8,null));};exports[_0xf2af('0x6f')]=function(_0x1fbde1,_0x2311c3,_0x2d22a9){var _0x2b9eb5=_0x1fbde1[_0xf2af('0x57')]['teams'];var _0x4dec37=_[_0xf2af('0x2c')](_0x2b9eb5,'id');return db['Team'][_0xf2af('0x4f')]({'where':{'id':_0x4dec37},'attributes':['id'],'include':[{'model':db[_0xf2af('0x70')],'as':_0xf2af('0x71'),'attributes':['id',_0xf2af('0x30'),_0xf2af('0x72'),'voicePause',_0xf2af('0x73')],'raw':!![]}]})['then'](function(_0x25bd82){if(_0x25bd82){var _0x73ff57=_[_0xf2af('0x74')](_0x25bd82,function(_0x46f6b1){var _0x500660=_0x46f6b1[_0xf2af('0x27')]({'plain':!![]});_0x500660[_0xf2af('0x71')]['forEach'](function(_0x223bec){_0x223bec[_0xf2af('0x75')]=_[_0xf2af('0x55')](_0x2b9eb5,{'id':_0x500660['id']})[_0xf2af('0x75')];});return _0x500660['Agents'];});return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0x1fbde1[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](function(_0x5f44af){return db[_0xf2af('0x76')][_0xf2af('0x77')](function(_0x4d5051){return _0x5f44af['addTeams'](_0x4dec37,{'transaction':_0x4d5051})[_0xf2af('0x25')](function(){return BPromise[_0xf2af('0x78')](_0x2b9eb5,function(_0x1f12cf){return db[_0xf2af('0x79')][_0xf2af('0x7a')]({'TeamId':_0x1f12cf['id'],'VoiceQueueId':_0x1fbde1['params']['id'],'penalty':_0x1f12cf['penalty']},{'transaction':_0x4d5051});});})[_0xf2af('0x25')](function(){return BPromise['each'](_0x73ff57,function(_0x51f8a5){return db[_0xf2af('0x7b')][_0xf2af('0x7c')]({'where':{'UserId':_0x51f8a5['id'],'VoiceQueueId':_0x1fbde1['params']['id']},'defaults':{'penalty':_0x51f8a5[_0xf2af('0x75')]},'transaction':_0x4d5051});});})[_0xf2af('0x25')](function(){return BPromise[_0xf2af('0x78')](_[_0xf2af('0x4b')](_0x73ff57,{'online':!![]}),function(_0x51909f){return db[_0xf2af('0x7d')]['upsert']({'membername':_0x51909f['name'],'UserId':_0x51909f['id'],'queue_name':_0x5f44af[_0xf2af('0x30')],'VoiceQueueId':_0x5f44af['id'],'interface':_['isNil'](_0x51909f[_0xf2af('0x73')])?util['format'](_0xf2af('0x7e'),_0x51909f[_0xf2af('0x30')]):_0x51909f[_0xf2af('0x73')],'paused':_0x51909f[_0xf2af('0x7f')]||![],'penalty':_0x51909f[_0xf2af('0x75')]},{'transaction':_0x4d5051});});})[_0xf2af('0x25')](function(){_0x73ff57[_0xf2af('0x80')](function(_0x10c0b6){socket[_0xf2af('0x81')](_0xf2af('0x82'),{'UserId':_0x10c0b6['id'],'VoiceQueueId':_0x5f44af['id']});});});});});}})[_0xf2af('0x25')](respondWithStatusCode(_0x2311c3,null))['catch'](handleError(_0x2311c3,null));};exports[_0xf2af('0x83')]=function(_0xc65092,_0x49c1a9,_0xdff4eb){return db[_0xf2af('0x6e')][_0xf2af('0x4f')]({'where':{'id':_0xc65092[_0xf2af('0x40')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49c1a9,null))[_0xf2af('0x25')](function(_0x2972d9){var _0x37d995=_[_0xf2af('0x2c')](_0x2972d9,'id');var _0x47f1f0=[];var _0x5978d5=[];var _0x1288ce=squel['select']();_0x1288ce['field'](_0xf2af('0x84'))[_0xf2af('0x85')](_0xf2af('0x86'),'tq')[_0xf2af('0x87')](_0xf2af('0x88'),'ut',_0xf2af('0x89'))['where'](_0xf2af('0x8a'),_0xc65092['params']['id']);for(var _0x5c81da=0x0;_0x5c81da<_0x2972d9[_0xf2af('0x46')];_0x5c81da+=0x1){let _0x521071=_0x2972d9[_0x5c81da];for(var _0x2da18d=0x0;_0x2da18d<_0x521071[_0xf2af('0x71')][_0xf2af('0x46')];_0x2da18d+=0x1){let _0x57a18c=_0x521071[_0xf2af('0x71')][_0x2da18d];var _0x2a0fd1=_0x1288ce[_0xf2af('0x8b')]();_0x2a0fd1[_0xf2af('0x49')](_0xf2af('0x8c'),_0x57a18c['id']);_0x5978d5[_0xf2af('0x8d')](db[_0xf2af('0x76')][_0xf2af('0x40')](_0x2a0fd1[_0xf2af('0x8e')](),{'type':db[_0xf2af('0x76')]['QueryTypes'][_0xf2af('0x8f')]})[_0xf2af('0x25')](function(_0x504378){if(_0x504378['length']===0x1){return _0x57a18c['id'];}else{var _0x362455=_['every'](_[_0xf2af('0x2c')](_0x504378,'TeamId'),function(_0x43e927){return _['includes'](_0x37d995,_0x43e927);});if(_0x362455){return _0x57a18c['id'];}}}));}}return BPromise['all'](_0x5978d5)['then'](function(_0x28591b){_0x47f1f0=_(_0x47f1f0)[_0xf2af('0x90')](_0x28591b)[_0xf2af('0x91')]()['value']();return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0xc65092[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](function(_0x2d03b8){return db['sequelize'][_0xf2af('0x77')](function(_0x5076b7){return _0x2d03b8[_0xf2af('0x83')](_0xc65092[_0xf2af('0x40')][_0xf2af('0x92')],{'transaction':_0x5076b7})[_0xf2af('0x25')](function(){if(!_[_0xf2af('0x93')](_0x47f1f0)){return _0x2d03b8[_0xf2af('0x94')](_0x47f1f0,{'transaction':_0x5076b7})['then'](function(){return db[_0xf2af('0x7d')][_0xf2af('0x26')]({'where':{'VoiceQueueId':_0xc65092[_0xf2af('0x5d')]['id'],'UserId':_0x47f1f0},'transaction':_0x5076b7});});}})[_0xf2af('0x25')](function(){_0x47f1f0[_0xf2af('0x80')](function(_0x292dec){socket[_0xf2af('0x81')](_0xf2af('0x95'),{'UserId':_0x292dec,'VoiceQueueId':_0x2d03b8['id']});});});});});});})[_0xf2af('0x25')](respondWithStatusCode(_0x49c1a9,null))[_0xf2af('0x51')](handleError(_0x49c1a9,null));};exports[_0xf2af('0x96')]=function(_0x3a6ef2,_0x11ee90,_0x3f1421){var _0xa320ff,_0xdaaa21;return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0x3a6ef2[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x11ee90,null))[_0xf2af('0x25')](function(_0x323549){if(_0x323549){_0xdaaa21=_0x323549;return _0x323549[_0xf2af('0x96')](_0x3a6ef2[_0xf2af('0x57')][_0xf2af('0x92')],_[_0xf2af('0x5e')](_0x3a6ef2['body'],[_0xf2af('0x92'),'id'])||{})[_0xf2af('0x97')](function(_0x2f05b2){for(var _0x597a51=0x0;_0x597a51<_0x3a6ef2['body'][_0xf2af('0x92')]['length'];_0x597a51+=0x1){socket[_0xf2af('0x81')](_0xf2af('0x82'),{'UserId':_0x3a6ef2[_0xf2af('0x57')][_0xf2af('0x92')][_0x597a51],'VoiceQueueId':_0x3a6ef2[_0xf2af('0x5d')]['id']});}return _0x2f05b2;});}})[_0xf2af('0x25')](function(_0x3ab4d8){_0xa320ff=_0x3ab4d8||[];if(_0xdaaa21){return db[_0xf2af('0x70')][_0xf2af('0x4f')]({'where':{'id':_0x3a6ef2[_0xf2af('0x57')]['ids']},'attributes':['id',_0xf2af('0x30'),_0xf2af('0x72'),_0xf2af('0x7f'),_0xf2af('0x73')],'raw':!![]});}})[_0xf2af('0x25')](function(_0x179344){if(!_['isEmpty'](_0x179344)){var _0x5f5256=[];for(var _0x3d3389=0x0;_0x3d3389<_0x179344['length'];_0x3d3389++){if(_0x179344[_0x3d3389]['online']){_0x5f5256[_0xf2af('0x8d')](db[_0xf2af('0x7d')][_0xf2af('0x7a')]({'membername':_0x179344[_0x3d3389][_0xf2af('0x30')],'UserId':_0x179344[_0x3d3389]['id'],'queue_name':_0xdaaa21[_0xf2af('0x30')],'VoiceQueueId':_0xdaaa21['id'],'interface':_['isNil'](_0x179344[_0x3d3389][_0xf2af('0x73')])?util[_0xf2af('0x98')]('SIP/%s',_0x179344[_0x3d3389][_0xf2af('0x30')]):_0x179344[_0x3d3389][_0xf2af('0x73')],'paused':_0x179344[_0x3d3389][_0xf2af('0x7f')]||![],'penalty':_0x3a6ef2[_0xf2af('0x57')][_0xf2af('0x75')]||0x0}));}}return BPromise[_0xf2af('0x99')](_0x5f5256);}})[_0xf2af('0x25')](function(){return _0xa320ff;})['then'](respondWithResult(_0x11ee90,null))[_0xf2af('0x51')](handleError(_0x11ee90,null));};exports[_0xf2af('0x94')]=function(_0x455654,_0x168ef3,_0x2b6b3){return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0x455654[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x168ef3,null))[_0xf2af('0x25')](function(_0x173c77){if(_0x173c77){return _0x173c77['removeAgents'](_0x455654[_0xf2af('0x40')][_0xf2af('0x92')])[_0xf2af('0x25')](function(){if(_[_0xf2af('0x9a')](_0x455654[_0xf2af('0x40')][_0xf2af('0x92')])){for(var _0x1684a3=0x0;_0x1684a3<_0x455654['query'][_0xf2af('0x92')]['length'];_0x1684a3+=0x1){socket[_0xf2af('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x455654[_0xf2af('0x40')][_0xf2af('0x92')][_0x1684a3]),'VoiceQueueId':Number(_0x455654[_0xf2af('0x5d')]['id'])});}}else{socket['emit'](_0xf2af('0x95'),{'UserId':Number(_0x455654['query']['ids']),'VoiceQueueId':Number(_0x455654['params']['id'])});}});}})['then'](function(_0x4515b2){return db['UserVoiceQueueRt'][_0xf2af('0x26')]({'where':{'VoiceQueueId':_0x455654[_0xf2af('0x5d')]['id'],'UserId':_0x455654[_0xf2af('0x40')][_0xf2af('0x92')]}})[_0xf2af('0x25')](function(){return _0x4515b2;});})['then'](respondWithStatusCode(_0x168ef3,null))[_0xf2af('0x51')](handleError(_0x168ef3,null));};exports[_0xf2af('0x9b')]=function(_0x2502b8,_0x3d79e8,_0x540fee){var _0x7d89ef={};var _0x2bd874={};var _0x3cd217;var _0x31c95;return db[_0xf2af('0x3d')][_0xf2af('0x69')]({'where':{'id':_0x2502b8[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x3d79e8,null))[_0xf2af('0x25')](function(_0x597a27){if(_0x597a27){_0x3cd217=_0x597a27;_0x2bd874[_0xf2af('0x43')]=_[_0xf2af('0x41')](db[_0xf2af('0x70')][_0xf2af('0x3e')]);_0x2bd874['query']=_[_0xf2af('0x41')](_0x2502b8[_0xf2af('0x40')]);_0x2bd874[_0xf2af('0x42')]=_['intersection'](_0x2bd874[_0xf2af('0x43')],_0x2bd874[_0xf2af('0x40')]);_0x7d89ef['attributes']=_[_0xf2af('0x45')](_0x2bd874[_0xf2af('0x43')],qs[_0xf2af('0x53')](_0x2502b8[_0xf2af('0x40')][_0xf2af('0x53')]));_0x7d89ef['attributes']=_0x7d89ef['attributes']['length']?_0x7d89ef[_0xf2af('0x44')]:_0x2bd874[_0xf2af('0x43')];_0x7d89ef[_0xf2af('0x6b')]=qs['sort'](_0x2502b8[_0xf2af('0x40')][_0xf2af('0x48')]);_0x7d89ef[_0xf2af('0x49')]=qs[_0xf2af('0x42')](_['pick'](_0x2502b8[_0xf2af('0x40')],_0x2bd874[_0xf2af('0x42')]));if(_0x2502b8['query'][_0xf2af('0x4b')]){_0x7d89ef[_0xf2af('0x49')]=_[_0xf2af('0x38')](_0x7d89ef[_0xf2af('0x49')],{'$or':_[_0xf2af('0x2c')](_0x7d89ef['attributes'],function(_0x51823b){var _0x345d6e={};_0x345d6e[_0x51823b]={'$like':'%'+_0x2502b8[_0xf2af('0x40')][_0xf2af('0x4b')]+'%'};return _0x345d6e;})});}_0x7d89ef=_['merge']({},_0x7d89ef,_0x2502b8[_0xf2af('0x4d')]);return _0x3cd217[_0xf2af('0x9b')](_0x7d89ef);}})[_0xf2af('0x25')](function(_0x59aa12){if(_0x59aa12){_0x31c95=_0x59aa12[_0xf2af('0x46')];if(!_0x2502b8[_0xf2af('0x40')][_0xf2af('0x67')](_0xf2af('0x47'))){_0x7d89ef[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x2502b8[_0xf2af('0x40')][_0xf2af('0x1f')]);_0x7d89ef[_0xf2af('0x1d')]=qs[_0xf2af('0x1d')](_0x2502b8[_0xf2af('0x40')][_0xf2af('0x1d')]);}return _0x3cd217[_0xf2af('0x9b')](_0x7d89ef);}})['then'](function(_0x3bfe01){if(_0x3bfe01){return _0x3bfe01?{'count':_0x31c95,'rows':_0x3bfe01}:null;}})['then'](respondWithResult(_0x3d79e8,null))['catch'](handleError(_0x3d79e8,null));};exports[_0xf2af('0x9c')]=function(_0x12db87,_0x169e1e,_0x51aa67){var _0x2d654f={};var _0x45d661={};var _0x383dd3;var _0xbf3cf2;return db[_0xf2af('0x3d')][_0xf2af('0x69')]({'where':{'id':_0x12db87[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x169e1e,null))[_0xf2af('0x25')](function(_0x407547){if(_0x407547){_0x383dd3=_0x407547;_0x45d661[_0xf2af('0x43')]=_[_0xf2af('0x41')](db['UserVoiceQueueRt'][_0xf2af('0x3e')]);_0x45d661['query']=_[_0xf2af('0x41')](_0x12db87[_0xf2af('0x40')]);_0x45d661[_0xf2af('0x42')]=_[_0xf2af('0x45')](_0x45d661[_0xf2af('0x43')],_0x45d661[_0xf2af('0x40')]);_0x2d654f[_0xf2af('0x44')]=_[_0xf2af('0x45')](_0x45d661[_0xf2af('0x43')],qs[_0xf2af('0x53')](_0x12db87[_0xf2af('0x40')][_0xf2af('0x53')]));_0x2d654f[_0xf2af('0x44')]=_0x2d654f['attributes'][_0xf2af('0x46')]?_0x2d654f['attributes']:_0x45d661[_0xf2af('0x43')];_0x2d654f[_0xf2af('0x6b')]=qs[_0xf2af('0x48')](_0x12db87[_0xf2af('0x40')][_0xf2af('0x48')]);_0x2d654f['where']=qs['filters'](_[_0xf2af('0x4a')](_0x12db87[_0xf2af('0x40')],_0x45d661[_0xf2af('0x42')]));if(_0x12db87[_0xf2af('0x40')][_0xf2af('0x4b')]){_0x2d654f[_0xf2af('0x49')]=_[_0xf2af('0x38')](_0x2d654f[_0xf2af('0x49')],{'$or':_[_0xf2af('0x2c')](_0x2d654f[_0xf2af('0x44')],function(_0x39f916){var _0x5868c9={};_0x5868c9[_0x39f916]={'$like':'%'+_0x12db87[_0xf2af('0x40')][_0xf2af('0x4b')]+'%'};return _0x5868c9;})});}_0x2d654f=_[_0xf2af('0x38')]({},_0x2d654f,_0x12db87[_0xf2af('0x4d')]);return _0x383dd3[_0xf2af('0x9c')](_0x2d654f);}})[_0xf2af('0x25')](function(_0x301e9c){if(_0x301e9c){_0xbf3cf2=_0x301e9c[_0xf2af('0x46')];if(!_0x12db87[_0xf2af('0x40')]['hasOwnProperty'](_0xf2af('0x47'))){_0x2d654f[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x12db87[_0xf2af('0x40')]['limit']);_0x2d654f[_0xf2af('0x1d')]=qs[_0xf2af('0x1d')](_0x12db87['query'][_0xf2af('0x1d')]);}return _0x383dd3['getMembers'](_0x2d654f);}})['then'](function(_0x3c311d){return _0x3c311d?{'count':_0xbf3cf2,'rows':_0x3c311d}:null;})['then'](respondWithResult(_0x169e1e,null))[_0xf2af('0x51')](handleError(_0x169e1e,null));};exports[_0xf2af('0x9d')]=function(_0x340d4b,_0x15290f,_0x90c5b8){var _0x400b6e={};var _0x1ad938={};var _0x27d949;var _0x2639df;return db['VoiceQueue'][_0xf2af('0x69')]({'where':{'id':_0x340d4b[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x15290f,null))[_0xf2af('0x25')](function(_0x17001d){if(_0x17001d){_0x27d949=_0x17001d;_0x1ad938[_0xf2af('0x43')]=_[_0xf2af('0x41')](db[_0xf2af('0x9e')][_0xf2af('0x3e')]);_0x1ad938[_0xf2af('0x40')]=_[_0xf2af('0x41')](_0x340d4b['query']);_0x1ad938[_0xf2af('0x42')]=_[_0xf2af('0x45')](_0x1ad938[_0xf2af('0x43')],_0x1ad938[_0xf2af('0x40')]);_0x400b6e[_0xf2af('0x44')]=_[_0xf2af('0x45')](_0x1ad938['model'],qs[_0xf2af('0x53')](_0x340d4b[_0xf2af('0x40')]['fields']));_0x400b6e['attributes']=_0x400b6e['attributes'][_0xf2af('0x46')]?_0x400b6e['attributes']:_0x1ad938['model'];_0x400b6e[_0xf2af('0x6b')]=qs['sort'](_0x340d4b[_0xf2af('0x40')][_0xf2af('0x48')]);_0x400b6e[_0xf2af('0x49')]=qs[_0xf2af('0x42')](_[_0xf2af('0x4a')](_0x340d4b[_0xf2af('0x40')],_0x1ad938[_0xf2af('0x42')]));if(_0x340d4b[_0xf2af('0x40')][_0xf2af('0x4b')]){_0x400b6e[_0xf2af('0x49')]=_[_0xf2af('0x38')](_0x400b6e[_0xf2af('0x49')],{'$or':_['map'](_0x400b6e['attributes'],function(_0x1cad9d){var _0x2fc916={};_0x2fc916[_0x1cad9d]={'$like':'%'+_0x340d4b['query']['filter']+'%'};return _0x2fc916;})});}_0x400b6e=_[_0xf2af('0x38')]({},_0x400b6e,_0x340d4b[_0xf2af('0x4d')]);return _0x27d949[_0xf2af('0x9d')](_0x400b6e);}})[_0xf2af('0x25')](function(_0x3f4189){if(_0x3f4189){_0x2639df=_0x3f4189[_0xf2af('0x46')];if(!_0x340d4b[_0xf2af('0x40')][_0xf2af('0x67')](_0xf2af('0x47'))){_0x400b6e[_0xf2af('0x1f')]=qs[_0xf2af('0x1f')](_0x340d4b[_0xf2af('0x40')][_0xf2af('0x1f')]);_0x400b6e['offset']=qs[_0xf2af('0x1d')](_0x340d4b[_0xf2af('0x40')][_0xf2af('0x1d')]);}return _0x27d949[_0xf2af('0x9d')](_0x400b6e);}})[_0xf2af('0x25')](function(_0x2f98d6){if(_0x2f98d6){return _0x2f98d6?{'count':_0x2639df,'rows':_0x2f98d6}:null;}})['then'](respondWithResult(_0x15290f,null))[_0xf2af('0x51')](handleError(_0x15290f,null));};exports[_0xf2af('0x9f')]=function(_0x3fca25,_0x19142c,_0x21e6e1){var _0x2daca2,_0xacdb8a;return db['VoiceQueue'][_0xf2af('0x55')]({'where':{'id':_0x3fca25['params']['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x19142c,null))[_0xf2af('0x25')](function(_0x49bc87){if(_0x49bc87){_0xacdb8a=_0x49bc87;return _0x49bc87[_0xf2af('0x9f')](_0x3fca25[_0xf2af('0x57')][_0xf2af('0x92')],_[_0xf2af('0x5e')](_0x3fca25[_0xf2af('0x57')],['ids','id'])||{});}return null;})[_0xf2af('0x97')](function(_0x487e57){var _0x43ac43;_0x2daca2=_0x487e57||[];var _0x6dcd68=[];if(_0x487e57){for(var _0x2471fb=0x0;_0x2471fb<_0x487e57['length'];_0x2471fb+=0x1){var _0x18d96d=_0x487e57[_0x2471fb][_0xf2af('0x27')]({'plain':!![]});_0xacdb8a[_0xf2af('0xa0')]=_0x3fca25[_0xf2af('0x57')][_0xf2af('0xa0')]?_0x3fca25[_0xf2af('0x57')][_0xf2af('0xa0')]:_0xacdb8a[_0xf2af('0xa0')];switch(_0xacdb8a['dialCheckDuplicateType']){case'always':_0x43ac43=squel[_0xf2af('0xa1')]()[_0xf2af('0xa2')](_0xf2af('0xa3'))[_0xf2af('0xa4')]([_0xf2af('0xa5'),_0xf2af('0xa6'),_0xf2af('0xa7'),_0xf2af('0xa8'),'VoiceQueueId',_0xf2af('0x5f'),'updatedAt'],squel[_0xf2af('0xa9')]()[_0xf2af('0xaa')](_0xf2af('0xa5'),_0xf2af('0xa5'))['field'](_0xf2af('0xab'),'scheduledAt')[_0xf2af('0xaa')]('id','ContactId')[_0xf2af('0xaa')](_0x18d96d[_0xf2af('0xac')][_0xf2af('0x8e')](),'ListId')[_0xf2af('0xaa')](_0x3fca25[_0xf2af('0x5d')]['id']['toString'](),_0xf2af('0x65'))['field'](_0xf2af('0xab'),_0xf2af('0x5f'))['field']('NOW()',_0xf2af('0xad'))[_0xf2af('0x85')]('cm_contacts')['where'](_0xf2af('0xae'))[_0xf2af('0x49')](_0xf2af('0xaf'),_0x18d96d[_0xf2af('0xac')]['toString']())[_0xf2af('0x49')](_0xf2af('0xb0'))['where'](_0xf2af('0xb1'),squel[_0xf2af('0xa9')]()['field'](_0xf2af('0xb2'))[_0xf2af('0x85')](_0xf2af('0xb3'))[_0xf2af('0x49')](_0xf2af('0x8a'),_0x3fca25[_0xf2af('0x5d')]['id'][_0xf2af('0x8e')]()))['where'](_0xf2af('0xb1'),squel[_0xf2af('0xa9')]()[_0xf2af('0xaa')](_0xf2af('0xb4'))[_0xf2af('0x85')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x3fca25[_0xf2af('0x5d')]['id'][_0xf2af('0x8e')]())))[_0xf2af('0x8e')]();break;case _0xf2af('0xb5'):_0x43ac43=squel[_0xf2af('0xa1')]()[_0xf2af('0xa2')](_0xf2af('0xa3'))[_0xf2af('0xa4')]([_0xf2af('0xa5'),_0xf2af('0xa6'),_0xf2af('0xa7'),'ListId',_0xf2af('0x65'),_0xf2af('0x5f'),_0xf2af('0xad')],squel[_0xf2af('0xa9')]()['field'](_0xf2af('0xa5'),'phone')[_0xf2af('0xaa')](_0xf2af('0xab'),_0xf2af('0xa6'))[_0xf2af('0xaa')]('id','ContactId')[_0xf2af('0xaa')](_0x18d96d[_0xf2af('0xac')][_0xf2af('0x8e')](),_0xf2af('0xa8'))[_0xf2af('0xaa')](_0x3fca25['params']['id']['toString'](),_0xf2af('0x65'))[_0xf2af('0xaa')](_0xf2af('0xab'),'createdAt')[_0xf2af('0xaa')](_0xf2af('0xab'),_0xf2af('0xad'))[_0xf2af('0x85')](_0xf2af('0xb6'))[_0xf2af('0x49')](_0xf2af('0xae'))[_0xf2af('0x49')](_0xf2af('0xaf'),_0x18d96d['CmListId']['toString']())['where'](_0xf2af('0xb0'))[_0xf2af('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf2af('0xa9')]()['field'](_0xf2af('0xb4'))[_0xf2af('0x85')](_0xf2af('0xa3'))[_0xf2af('0x49')](_0xf2af('0x8a'),_0x3fca25[_0xf2af('0x5d')]['id'][_0xf2af('0x8e')]())))['toString']();break;default:_0x43ac43=squel[_0xf2af('0xa1')]()[_0xf2af('0xa2')](_0xf2af('0xa3'))[_0xf2af('0xa4')]([_0xf2af('0xa5'),_0xf2af('0xa6'),_0xf2af('0xa7'),_0xf2af('0xa8'),_0xf2af('0x65'),'createdAt',_0xf2af('0xad')],squel[_0xf2af('0xa9')]()[_0xf2af('0xaa')](_0xf2af('0xa5'),_0xf2af('0xa5'))[_0xf2af('0xaa')](_0xf2af('0xab'),_0xf2af('0xa6'))['field']('id',_0xf2af('0xa7'))[_0xf2af('0xaa')](_0x18d96d['CmListId']['toString'](),'ListId')[_0xf2af('0xaa')](_0x3fca25['params']['id'][_0xf2af('0x8e')](),_0xf2af('0x65'))[_0xf2af('0xaa')](_0xf2af('0xab'),_0xf2af('0x5f'))[_0xf2af('0xaa')]('NOW()','updatedAt')[_0xf2af('0x85')](_0xf2af('0xb6'))[_0xf2af('0x49')](_0xf2af('0xae'))[_0xf2af('0x49')](_0xf2af('0xaf'),_0x18d96d[_0xf2af('0xac')]['toString']())['where'](_0xf2af('0xb0')))[_0xf2af('0x8e')]();}_0x6dcd68[_0xf2af('0x8d')](db[_0xf2af('0x76')]['query'](_0x43ac43));}return BPromise['all'](_0x6dcd68);}})['then'](function(){return _0x2daca2;})['then'](respondWithResult(_0x19142c,null))[_0xf2af('0x51')](handleError(_0x19142c,null));};exports[_0xf2af('0xb7')]=function(_0x1c354c,_0x5d792f,_0x3d3824){return db[_0xf2af('0x3d')]['find']({'where':{'id':_0x1c354c['params']['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x5d792f,null))['then'](function(_0x227dcb){if(_0x227dcb){return _0x227dcb[_0xf2af('0xb7')](_0x1c354c[_0xf2af('0x40')][_0xf2af('0x92')]);}})[_0xf2af('0x25')](function(_0x3caf74){if(_0x3caf74){return db[_0xf2af('0x64')][_0xf2af('0x26')]({'where':{'ListId':_0x1c354c['query'][_0xf2af('0x92')],'VoiceQueueId':_0x1c354c['params']['id']}})[_0xf2af('0x25')](function(){return _0x3caf74;});}})[_0xf2af('0x25')](respondWithStatusCode(_0x5d792f,null))[_0xf2af('0x51')](handleError(_0x5d792f,null));};exports[_0xf2af('0xb8')]=function(_0x2f757b,_0x38dc83,_0x164b3a){var _0x5d711c={};var _0x4ce258={};var _0x368a3b;var _0x41f72d;return db[_0xf2af('0x3d')][_0xf2af('0x69')]({'where':{'id':_0x2f757b[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x38dc83,null))['then'](function(_0x1b7472){if(_0x1b7472){_0x368a3b=_0x1b7472;_0x4ce258['model']=_[_0xf2af('0x41')](db['CmList'][_0xf2af('0x3e')]);_0x4ce258[_0xf2af('0x40')]=_[_0xf2af('0x41')](_0x2f757b[_0xf2af('0x40')]);_0x4ce258[_0xf2af('0x42')]=_[_0xf2af('0x45')](_0x4ce258['model'],_0x4ce258[_0xf2af('0x40')]);_0x5d711c['attributes']=_[_0xf2af('0x45')](_0x4ce258[_0xf2af('0x43')],qs[_0xf2af('0x53')](_0x2f757b[_0xf2af('0x40')]['fields']));_0x5d711c['attributes']=_0x5d711c[_0xf2af('0x44')][_0xf2af('0x46')]?_0x5d711c[_0xf2af('0x44')]:_0x4ce258[_0xf2af('0x43')];_0x5d711c['order']=qs[_0xf2af('0x48')](_0x2f757b[_0xf2af('0x40')]['sort']);_0x5d711c[_0xf2af('0x49')]=qs[_0xf2af('0x42')](_[_0xf2af('0x4a')](_0x2f757b['query'],_0x4ce258['filters']));if(_0x2f757b['query'][_0xf2af('0x4b')]){_0x5d711c[_0xf2af('0x49')]=_[_0xf2af('0x38')](_0x5d711c[_0xf2af('0x49')],{'$or':_[_0xf2af('0x2c')](_0x5d711c['attributes'],function(_0x59a175){var _0x87b910={};_0x87b910[_0x59a175]={'$like':'%'+_0x2f757b[_0xf2af('0x40')]['filter']+'%'};return _0x87b910;})});}_0x5d711c=_[_0xf2af('0x38')]({},_0x5d711c,_0x2f757b[_0xf2af('0x4d')]);return _0x368a3b[_0xf2af('0xb8')](_0x5d711c);}})[_0xf2af('0x25')](function(_0x4a8626){if(_0x4a8626){_0x41f72d=_0x4a8626[_0xf2af('0x46')];if(!_0x2f757b['query']['hasOwnProperty']('nolimit')){_0x5d711c['limit']=qs[_0xf2af('0x1f')](_0x2f757b['query']['limit']);_0x5d711c[_0xf2af('0x1d')]=qs[_0xf2af('0x1d')](_0x2f757b[_0xf2af('0x40')][_0xf2af('0x1d')]);}return _0x368a3b[_0xf2af('0xb8')](_0x5d711c);}})['then'](function(_0x13f989){if(_0x13f989){return _0x13f989?{'count':_0x41f72d,'rows':_0x13f989}:null;}})['then'](respondWithResult(_0x38dc83,null))[_0xf2af('0x51')](handleError(_0x38dc83,null));};exports['addBlackLists']=function(_0x15707a,_0x1a9415,_0x7778db){var _0x835379,_0x784fd6;return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0x15707a[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](handleEntityNotFound(_0x1a9415,null))['then'](function(_0x4d94b8){if(_0x4d94b8){_0x784fd6=_0x4d94b8;return _0x4d94b8[_0xf2af('0xb9')](_0x15707a[_0xf2af('0x57')]['ids'],_['omit'](_0x15707a['body'],[_0xf2af('0x92'),'id'])||{});}return null;})[_0xf2af('0x97')](function(_0x432aa3){var _0x107af7;_0x835379=_0x432aa3||[];var _0x3be3fd=[];if(_0x432aa3){for(var _0x4b1287=0x0;_0x4b1287<_0x432aa3[_0xf2af('0x46')];_0x4b1287+=0x1){var _0x5f5950=_0x432aa3[_0x4b1287][_0xf2af('0x27')]({'plain':!![]});_0x107af7=squel[_0xf2af('0xa1')]()[_0xf2af('0xa2')](_0xf2af('0xba'))['fromQuery']([_0xf2af('0xa5'),_0xf2af('0xa7'),'ListId',_0xf2af('0x65'),'createdAt',_0xf2af('0xad')],squel[_0xf2af('0xa9')]()[_0xf2af('0xaa')](_0xf2af('0xa5'),_0xf2af('0xa5'))[_0xf2af('0xaa')]('id',_0xf2af('0xa7'))[_0xf2af('0xaa')](_0x5f5950[_0xf2af('0xac')][_0xf2af('0x8e')](),_0xf2af('0xa8'))[_0xf2af('0xaa')](_0x15707a[_0xf2af('0x5d')]['id'][_0xf2af('0x8e')](),_0xf2af('0x65'))['field']('NOW()',_0xf2af('0x5f'))['field']('NOW()','updatedAt')['from'](_0xf2af('0xb6'))[_0xf2af('0x49')]('deletedAt\x20IS\x20NULL')[_0xf2af('0x49')](_0xf2af('0xaf'),_0x5f5950[_0xf2af('0xac')]['toString']())[_0xf2af('0x49')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3be3fd[_0xf2af('0x8d')](db['sequelize']['query'](_0x107af7));}return BPromise[_0xf2af('0x99')](_0x3be3fd);}})[_0xf2af('0x25')](function(){return _0x835379;})[_0xf2af('0x25')](respondWithResult(_0x1a9415,null))[_0xf2af('0x51')](handleError(_0x1a9415,null));};exports[_0xf2af('0xbb')]=function(_0x3c212f,_0x5bb83b,_0x37b15a){return db[_0xf2af('0x3d')][_0xf2af('0x55')]({'where':{'id':_0x3c212f[_0xf2af('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5bb83b,null))[_0xf2af('0x25')](function(_0x540f31){if(_0x540f31){return _0x540f31[_0xf2af('0xbb')](_0x3c212f['query']['ids']);}})[_0xf2af('0x25')](function(_0x286ad6){if(_0x286ad6){return db[_0xf2af('0x6c')][_0xf2af('0x26')]({'where':{'ListId':_0x3c212f['query'][_0xf2af('0x92')],'VoiceQueueId':_0x3c212f[_0xf2af('0x5d')]['id']}})[_0xf2af('0x25')](function(){return _0x286ad6;});}})[_0xf2af('0x25')](respondWithStatusCode(_0x5bb83b,null))[_0xf2af('0x51')](handleError(_0x5bb83b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9373a12..3f5b54f 100644 --- a/server/api/voiceQueue/voiceQueue.events.js +++ b/server/api/voiceQueue/voiceQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ae0=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x5edf3a,_0x27276c){var _0x3236f9=function(_0x447956){while(--_0x447956){_0x5edf3a['push'](_0x5edf3a['shift']());}};_0x3236f9(++_0x27276c);}(_0x1ae0,0xb8));var _0x01ae=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0x1ae0[_0x4fa738];return _0x55bf55;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x01ae('0x0'))['db'][_0x01ae('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x01ae('0x2')](0x0);var events={'afterCreate':_0x01ae('0x3'),'afterUpdate':_0x01ae('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45598b){return function(_0x45ede9,_0x3d8540,_0x2d6369){VoiceQueueEvents[_0x01ae('0x5')](_0x45598b+':'+_0x45ede9['id'],_0x45ede9);VoiceQueueEvents[_0x01ae('0x5')](_0x45598b,_0x45ede9);_0x2d6369(null);};}for(var e in events){if(events[_0x01ae('0x6')](e)){var event=events[e];VoiceQueue[_0x01ae('0x7')](e,emitEvent(event));}}module[_0x01ae('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x3da0=['update','remove','emit','hook','exports','events','VoiceQueue','setMaxListeners'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x3da0,0x6d));var _0x03da=function(_0x4d6298,_0x502f6b){_0x4d6298=_0x4d6298-0x0;var _0x57ccf0=_0x3da0[_0x4d6298];return _0x57ccf0;};'use strict';var EventEmitter=require(_0x03da('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x03da('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x03da('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x03da('0x3'),'afterDestroy':_0x03da('0x4')};function emitEvent(_0x8722d5){return function(_0xa57b1a,_0x5d0f8e,_0x1499fb){VoiceQueueEvents[_0x03da('0x5')](_0x8722d5+':'+_0xa57b1a['id'],_0xa57b1a);VoiceQueueEvents['emit'](_0x8722d5,_0xa57b1a);_0x1499fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x03da('0x6')](e,emitEvent(event));}}module[_0x03da('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e2df2bf..9f7de86 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9302=['util','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues'];(function(_0x36358f,_0x41bf85){var _0x5ce44e=function(_0x193322){while(--_0x193322){_0x36358f['push'](_0x36358f['shift']());}};_0x5ce44e(++_0x41bf85);}(_0x9302,0xdc));var _0x2930=function(_0x7390d4,_0x398159){_0x7390d4=_0x7390d4-0x0;var _0x1554a9=_0x9302[_0x7390d4];return _0x1554a9;};'use strict';var _=require('lodash');var util=require(_0x2930('0x0'));var logger=require('../../config/logger')(_0x2930('0x1'));var moment=require('moment');var BPromise=require(_0x2930('0x2'));var rp=require(_0x2930('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2930('0x4'));var config=require(_0x2930('0x5'));var attributes=require(_0x2930('0x6'));module[_0x2930('0x7')]=function(_0x54cf71,_0xfc6d9e){return _0x54cf71[_0x2930('0x8')](_0x2930('0x9'),attributes,{'tableName':_0x2930('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x863a=['voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x863a,0x112));var _0xa863=function(_0x44935a,_0x5865b7){_0x44935a=_0x44935a-0x0;var _0x8c0fdf=_0x863a[_0x44935a];return _0x8c0fdf;};'use strict';var _=require(_0xa863('0x0'));var util=require(_0xa863('0x1'));var logger=require(_0xa863('0x2'))(_0xa863('0x3'));var moment=require(_0xa863('0x4'));var BPromise=require(_0xa863('0x5'));var rp=require(_0xa863('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa863('0x7'));var config=require(_0xa863('0x8'));var attributes=require(_0xa863('0x9'));module[_0xa863('0xa')]=function(_0x572603,_0x514554){return _0x572603[_0xa863('0xb')]('VoiceQueue',attributes,{'tableName':_0xa863('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 722c3db..0752469 100644 --- a/server/api/voiceQueue/voiceQueue.rpc.js +++ b/server/api/voiceQueue/voiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a02=['code','message','result','VoiceQueue','options','raw','attributes','include','model','map','GetVoiceQueue','debug','ShowVoiceQueue','find','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./voiceQueue.socket','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3851be,_0x523903){var _0xdf3491=function(_0x9c1e27){while(--_0x9c1e27){_0x3851be['push'](_0x3851be['shift']());}};_0xdf3491(++_0x523903);}(_0x3a02,0x196));var _0x23a0=function(_0x2e8327,_0x1342f9){_0x2e8327=_0x2e8327-0x0;var _0x1100da=_0x3a02[_0x2e8327];return _0x1100da;};'use strict';var _=require(_0x23a0('0x0'));var util=require(_0x23a0('0x1'));var moment=require(_0x23a0('0x2'));var BPromise=require(_0x23a0('0x3'));var rs=require(_0x23a0('0x4'));var fs=require('fs');var Redis=require(_0x23a0('0x5'));var db=require(_0x23a0('0x6'))['db'];var utils=require(_0x23a0('0x7'));var logger=require(_0x23a0('0x8'))(_0x23a0('0x9'));var config=require('../../config/environment');var jayson=require(_0x23a0('0xa'));var client=jayson[_0x23a0('0xb')][_0x23a0('0xc')]({'port':0x232a});config[_0x23a0('0xd')]=_[_0x23a0('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23a0('0xd')]));require(_0x23a0('0xf'))['register'](socket);function respondWithRpcPromise(_0x186e36,_0xe203a3,_0x1a3a49){return new BPromise(function(_0x3a8c69,_0x538b57){return client['request'](_0x186e36,_0x1a3a49)[_0x23a0('0x10')](function(_0x4966c6){logger[_0x23a0('0x11')](_0x23a0('0x12'),_0xe203a3,_0x23a0('0x13'));logger['debug'](_0x23a0('0x14'),_0xe203a3,_0x23a0('0x13'),JSON[_0x23a0('0x15')](_0x4966c6));if(_0x4966c6[_0x23a0('0x16')]){if(_0x4966c6[_0x23a0('0x16')][_0x23a0('0x17')]===0x1f4){logger[_0x23a0('0x16')](_0x23a0('0x12'),_0xe203a3,_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);return _0x538b57(_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);}logger['error'](_0x23a0('0x12'),_0xe203a3,_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);return _0x3a8c69(_0x4966c6[_0x23a0('0x16')][_0x23a0('0x18')]);}else{logger[_0x23a0('0x11')]('VoiceQueue,\x20%s,\x20%s',_0xe203a3,_0x23a0('0x13'));_0x3a8c69(_0x4966c6[_0x23a0('0x19')][_0x23a0('0x18')]);}})['catch'](function(_0x1fb43c){logger[_0x23a0('0x16')](_0x23a0('0x12'),_0xe203a3,_0x1fb43c);_0x538b57(_0x1fb43c);});});}exports['GetVoiceQueue']=function(_0x1f48b1){var _0x23cfda=this;return new Promise(function(_0x7cb97d,_0x36c4d4){return db[_0x23a0('0x1a')]['findAll']({'raw':_0x1f48b1[_0x23a0('0x1b')]?_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f48b1[_0x23a0('0x1b')]?_0x1f48b1[_0x23a0('0x1b')]['where']||null:null,'attributes':_0x1f48b1['options']?_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1d')]||null:null,'limit':_0x1f48b1['options']?_0x1f48b1[_0x23a0('0x1b')]['limit']||null:null,'include':_0x1f48b1['options']?_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1e')]?_['map'](_0x1f48b1[_0x23a0('0x1b')][_0x23a0('0x1e')],function(_0x5b63b0){return{'model':db[_0x5b63b0[_0x23a0('0x1f')]],'as':_0x5b63b0['as'],'attributes':_0x5b63b0[_0x23a0('0x1d')],'include':_0x5b63b0[_0x23a0('0x1e')]?_['map'](_0x5b63b0['include'],function(_0x1e5518){return{'model':db[_0x1e5518[_0x23a0('0x1f')]],'as':_0x1e5518['as'],'attributes':_0x1e5518[_0x23a0('0x1d')],'include':_0x1e5518['include']?_[_0x23a0('0x20')](_0x1e5518[_0x23a0('0x1e')],function(_0x359b23){return{'model':db[_0x359b23[_0x23a0('0x1f')]],'as':_0x359b23['as'],'attributes':_0x359b23[_0x23a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23a0('0x10')](function(_0x5ea973){logger[_0x23a0('0x11')](_0x23a0('0x21'),_0x1f48b1);logger[_0x23a0('0x22')](_0x23a0('0x21'),_0x1f48b1,JSON[_0x23a0('0x15')](_0x5ea973));_0x7cb97d(_0x5ea973);})['catch'](function(_0x5ee017){logger[_0x23a0('0x16')](_0x23a0('0x21'),_0x5ee017[_0x23a0('0x18')],_0x1f48b1);_0x36c4d4(_0x23cfda[_0x23a0('0x16')](0x1f4,_0x5ee017['message']));});});};exports[_0x23a0('0x23')]=function(_0x577c61){var _0x6adeeb=this;return new Promise(function(_0x77b6c9,_0x2f4eb1){return db['VoiceQueue'][_0x23a0('0x24')]({'raw':_0x577c61[_0x23a0('0x1b')]?_0x577c61[_0x23a0('0x1b')][_0x23a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x577c61[_0x23a0('0x1b')]?_0x577c61[_0x23a0('0x1b')][_0x23a0('0x25')]||null:null,'attributes':_0x577c61[_0x23a0('0x1b')]?_0x577c61['options'][_0x23a0('0x1d')]||null:null,'include':_0x577c61['options']?_0x577c61[_0x23a0('0x1b')][_0x23a0('0x1e')]?_[_0x23a0('0x20')](_0x577c61[_0x23a0('0x1b')][_0x23a0('0x1e')],function(_0x5912ac){return{'model':db[_0x5912ac['model']],'as':_0x5912ac['as'],'attributes':_0x5912ac['attributes'],'include':_0x5912ac['include']?_[_0x23a0('0x20')](_0x5912ac['include'],function(_0xff91bf){return{'model':db[_0xff91bf[_0x23a0('0x1f')]],'as':_0xff91bf['as'],'attributes':_0xff91bf[_0x23a0('0x1d')],'include':_0xff91bf[_0x23a0('0x1e')]?_[_0x23a0('0x20')](_0xff91bf['include'],function(_0xe43fda){return{'model':db[_0xe43fda[_0x23a0('0x1f')]],'as':_0xe43fda['as'],'attributes':_0xe43fda[_0x23a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x23a0('0x10')](function(_0x686944){logger[_0x23a0('0x11')](_0x23a0('0x23'),_0x577c61);logger['debug'](_0x23a0('0x23'),_0x577c61,JSON[_0x23a0('0x15')](_0x686944));_0x77b6c9(_0x686944);})[_0x23a0('0x26')](function(_0x305b4a){logger[_0x23a0('0x16')]('ShowVoiceQueue',_0x305b4a['message'],_0x577c61);_0x2f4eb1(_0x6adeeb[_0x23a0('0x16')](0x1f4,_0x305b4a['message']));});});}; \ No newline at end of file +var _0x2ce9=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowVoiceQueue','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x589d3a,_0x574831){var _0x2fbbc4=function(_0x5742a5){while(--_0x5742a5){_0x589d3a['push'](_0x589d3a['shift']());}};_0x2fbbc4(++_0x574831);}(_0x2ce9,0x1a7));var _0x92ce=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0x2ce9[_0x3c5e54];return _0x3ae1f3;};'use strict';var _=require(_0x92ce('0x0'));var util=require('util');var moment=require(_0x92ce('0x1'));var BPromise=require(_0x92ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92ce('0x3'));var db=require(_0x92ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x92ce('0x5'))(_0x92ce('0x6'));var config=require(_0x92ce('0x7'));var jayson=require(_0x92ce('0x8'));var client=jayson[_0x92ce('0x9')][_0x92ce('0xa')]({'port':0x232a});config[_0x92ce('0xb')]=_[_0x92ce('0xc')](config[_0x92ce('0xb')],{'host':_0x92ce('0xd'),'port':0x18eb});var socket=require(_0x92ce('0xe'))(new Redis(config['redis']));require(_0x92ce('0xf'))[_0x92ce('0x10')](socket);function respondWithRpcPromise(_0x33dbdd,_0x288671,_0xe62eea){return new BPromise(function(_0x412711,_0xb45bb9){return client[_0x92ce('0x11')](_0x33dbdd,_0xe62eea)[_0x92ce('0x12')](function(_0x11a9e5){logger[_0x92ce('0x13')](_0x92ce('0x14'),_0x288671,_0x92ce('0x15'));logger[_0x92ce('0x16')](_0x92ce('0x17'),_0x288671,_0x92ce('0x15'),JSON[_0x92ce('0x18')](_0x11a9e5));if(_0x11a9e5['error']){if(_0x11a9e5['error'][_0x92ce('0x19')]===0x1f4){logger[_0x92ce('0x1a')](_0x92ce('0x14'),_0x288671,_0x11a9e5[_0x92ce('0x1a')][_0x92ce('0x1b')]);return _0xb45bb9(_0x11a9e5['error'][_0x92ce('0x1b')]);}logger['error'](_0x92ce('0x14'),_0x288671,_0x11a9e5[_0x92ce('0x1a')][_0x92ce('0x1b')]);return _0x412711(_0x11a9e5[_0x92ce('0x1a')][_0x92ce('0x1b')]);}else{logger[_0x92ce('0x13')](_0x92ce('0x14'),_0x288671,'request\x20sent');_0x412711(_0x11a9e5[_0x92ce('0x1c')][_0x92ce('0x1b')]);}})['catch'](function(_0x2884d1){logger[_0x92ce('0x1a')](_0x92ce('0x14'),_0x288671,_0x2884d1);_0xb45bb9(_0x2884d1);});});}exports[_0x92ce('0x1d')]=function(_0x59cef7){var _0x22055f=this;return new Promise(function(_0x16e50a,_0x4008ce){return db[_0x92ce('0x1e')][_0x92ce('0x1f')]({'raw':_0x59cef7['options']?_0x59cef7[_0x92ce('0x20')][_0x92ce('0x21')]===undefined?!![]:![]:!![],'where':_0x59cef7[_0x92ce('0x20')]?_0x59cef7[_0x92ce('0x20')]['where']||null:null,'attributes':_0x59cef7[_0x92ce('0x20')]?_0x59cef7['options'][_0x92ce('0x22')]||null:null,'limit':_0x59cef7[_0x92ce('0x20')]?_0x59cef7[_0x92ce('0x20')][_0x92ce('0x23')]||null:null,'include':_0x59cef7[_0x92ce('0x20')]?_0x59cef7['options'][_0x92ce('0x24')]?_[_0x92ce('0x25')](_0x59cef7[_0x92ce('0x20')][_0x92ce('0x24')],function(_0x121a3a){return{'model':db[_0x121a3a[_0x92ce('0x26')]],'as':_0x121a3a['as'],'attributes':_0x121a3a[_0x92ce('0x22')],'include':_0x121a3a[_0x92ce('0x24')]?_[_0x92ce('0x25')](_0x121a3a['include'],function(_0x365990){return{'model':db[_0x365990['model']],'as':_0x365990['as'],'attributes':_0x365990[_0x92ce('0x22')],'include':_0x365990[_0x92ce('0x24')]?_['map'](_0x365990[_0x92ce('0x24')],function(_0xbcc9eb){return{'model':db[_0xbcc9eb['model']],'as':_0xbcc9eb['as'],'attributes':_0xbcc9eb[_0x92ce('0x22')]};}):[]};}):[]};}):[]:[]})[_0x92ce('0x12')](function(_0x2f7845){logger[_0x92ce('0x13')](_0x92ce('0x1d'),_0x59cef7);logger[_0x92ce('0x16')]('GetVoiceQueue',_0x59cef7,JSON[_0x92ce('0x18')](_0x2f7845));_0x16e50a(_0x2f7845);})[_0x92ce('0x27')](function(_0x48d03d){logger[_0x92ce('0x1a')](_0x92ce('0x1d'),_0x48d03d[_0x92ce('0x1b')],_0x59cef7);_0x4008ce(_0x22055f[_0x92ce('0x1a')](0x1f4,_0x48d03d[_0x92ce('0x1b')]));});});};exports[_0x92ce('0x28')]=function(_0x29077d){var _0x427ebd=this;return new Promise(function(_0x11461b,_0x3438b3){return db[_0x92ce('0x1e')][_0x92ce('0x29')]({'raw':_0x29077d[_0x92ce('0x20')]?_0x29077d['options']['raw']===undefined?!![]:![]:!![],'where':_0x29077d[_0x92ce('0x20')]?_0x29077d[_0x92ce('0x20')][_0x92ce('0x2a')]||null:null,'attributes':_0x29077d[_0x92ce('0x20')]?_0x29077d['options']['attributes']||null:null,'include':_0x29077d['options']?_0x29077d['options'][_0x92ce('0x24')]?_['map'](_0x29077d[_0x92ce('0x20')][_0x92ce('0x24')],function(_0x19b398){return{'model':db[_0x19b398[_0x92ce('0x26')]],'as':_0x19b398['as'],'attributes':_0x19b398['attributes'],'include':_0x19b398['include']?_['map'](_0x19b398['include'],function(_0x25ff53){return{'model':db[_0x25ff53[_0x92ce('0x26')]],'as':_0x25ff53['as'],'attributes':_0x25ff53[_0x92ce('0x22')],'include':_0x25ff53['include']?_[_0x92ce('0x25')](_0x25ff53[_0x92ce('0x24')],function(_0x6828f2){return{'model':db[_0x6828f2[_0x92ce('0x26')]],'as':_0x6828f2['as'],'attributes':_0x6828f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x92ce('0x12')](function(_0x2b1378){logger['info'](_0x92ce('0x28'),_0x29077d);logger['debug']('ShowVoiceQueue',_0x29077d,JSON['stringify'](_0x2b1378));_0x11461b(_0x2b1378);})['catch'](function(_0x454f59){logger['error'](_0x92ce('0x28'),_0x454f59[_0x92ce('0x1b')],_0x29077d);_0x3438b3(_0x427ebd[_0x92ce('0x1a')](0x1f4,_0x454f59[_0x92ce('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index b411a4a..c579c0a 100644 --- a/server/api/voiceQueue/voiceQueue.socket.js +++ b/server/api/voiceQueue/voiceQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf29f=['voiceQueue:','save','remove','update','register','length'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xf29f,0x18d));var _0xff29=function(_0x52648f,_0x5d1c83){_0x52648f=_0x52648f-0x0;var _0x3eeff9=_0xf29f[_0x52648f];return _0x3eeff9;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xff29('0x0'),_0xff29('0x1'),_0xff29('0x2')];function createListener(_0x541750,_0x9b4a8c){return function(_0x30b850){_0x9b4a8c['emit'](_0x541750,_0x30b850);};}function removeListener(_0xeb0c24,_0x2c0125){return function(){VoiceQueueEvents['removeListener'](_0xeb0c24,_0x2c0125);};}exports[_0xff29('0x3')]=function(_0xbbe36b){for(var _0x4c814b=0x0,_0x566021=events[_0xff29('0x4')];_0x4c814b<_0x566021;_0x4c814b++){var _0x4faeb5=events[_0x4c814b];var _0x27df58=createListener(_0xff29('0x5')+_0x4faeb5,_0xbbe36b);VoiceQueueEvents['on'](_0x4faeb5,_0x27df58);}}; \ No newline at end of file +var _0xce9f=['emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0xce9f,0x137));var _0xfce9=function(_0xe27722,_0x249a63){_0xe27722=_0xe27722-0x0;var _0x21da64=_0xce9f[_0xe27722];return _0x21da64;};'use strict';var VoiceQueueEvents=require(_0xfce9('0x0'));var events=[_0xfce9('0x1'),_0xfce9('0x2'),_0xfce9('0x3')];function createListener(_0x4a3821,_0x13079a){return function(_0x3b2760){_0x13079a[_0xfce9('0x4')](_0x4a3821,_0x3b2760);};}function removeListener(_0x30b750,_0x38fa2c){return function(){VoiceQueueEvents[_0xfce9('0x5')](_0x30b750,_0x38fa2c);};}exports[_0xfce9('0x6')]=function(_0x5d4f0d){for(var _0x4af193=0x0,_0x3b95df=events[_0xfce9('0x7')];_0x4af193<_0x3b95df;_0x4af193++){var _0x5d04c9=events[_0x4af193];var _0x5a24ef=createListener(_0xfce9('0x8')+_0x5d04c9,_0x5d4f0d);VoiceQueueEvents['on'](_0x5d04c9,_0x5a24ef);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 50619b1..0c8e477 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8334=['fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router'];(function(_0x5592ac,_0x53136c){var _0x456dd2=function(_0x3df19b){while(--_0x3df19b){_0x5592ac['push'](_0x5592ac['shift']());}};_0x456dd2(++_0x53136c);}(_0x8334,0x96));var _0x4833=function(_0x404c67,_0x342af1){_0x404c67=_0x404c67-0x0;var _0x3e20bc=_0x8334[_0x404c67];return _0x3e20bc;};'use strict';var multer=require(_0x4833('0x0'));var util=require(_0x4833('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4833('0x2'));var router=express[_0x4833('0x3')]();var fs_extra=require(_0x4833('0x4'));var auth=require(_0x4833('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4833('0x6'));var controller=require(_0x4833('0x7'));router[_0x4833('0x8')]('/',auth[_0x4833('0x9')](),controller[_0x4833('0xa')]);router[_0x4833('0x8')](_0x4833('0xb'),auth[_0x4833('0x9')](),controller[_0x4833('0xc')]);router[_0x4833('0x8')](_0x4833('0xd'),auth[_0x4833('0x9')](),controller[_0x4833('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4833('0xf')]('/',auth[_0x4833('0x9')](),controller[_0x4833('0x10')]);router[_0x4833('0x11')](_0x4833('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x4833('0x13')]('/:id',auth[_0x4833('0x9')](),controller[_0x4833('0x14')]);module[_0x4833('0x15')]=router; \ No newline at end of file +var _0x08f8=['../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service'];(function(_0x3c0b75,_0x3b5cb3){var _0x101b35=function(_0x23c027){while(--_0x23c027){_0x3c0b75['push'](_0x3c0b75['shift']());}};_0x101b35(++_0x3b5cb3);}(_0x08f8,0x118));var _0x808f=function(_0x5cf126,_0x58eb50){_0x5cf126=_0x5cf126-0x0;var _0x3e6ea9=_0x08f8[_0x5cf126];return _0x3e6ea9;};'use strict';var multer=require(_0x808f('0x0'));var util=require(_0x808f('0x1'));var path=require(_0x808f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x808f('0x3'));var auth=require(_0x808f('0x4'));var interaction=require(_0x808f('0x5'));var config=require('../../config/environment');var controller=require(_0x808f('0x6'));router[_0x808f('0x7')]('/',auth[_0x808f('0x8')](),controller[_0x808f('0x9')]);router[_0x808f('0x7')](_0x808f('0xa'),auth[_0x808f('0x8')](),controller[_0x808f('0xb')]);router[_0x808f('0x7')](_0x808f('0xc'),auth['isAuthenticated'](),controller[_0x808f('0xd')]);router[_0x808f('0x7')](_0x808f('0xe'),auth[_0x808f('0x8')](),controller[_0x808f('0xf')]);router['post']('/',auth[_0x808f('0x8')](),controller['create']);router['put'](_0x808f('0xe'),auth[_0x808f('0x8')](),controller[_0x808f('0x10')]);router[_0x808f('0x11')](_0x808f('0xe'),auth[_0x808f('0x8')](),controller['destroy']);module[_0x808f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 37403a5..939a089 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xcb91[_0x39872b];return _0x55fa18;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x193c2d,_0x2ffba6){var _0xc86526=function(_0x1dcea2){while(--_0x1dcea2){_0x193c2d['push'](_0x193c2d['shift']());}};_0xc86526(++_0x2ffba6);}(_0xe706,0xa3));var _0x6e70=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0xe706[_0x147c96];return _0x4ec711;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6e70('0x3')]},'calleridnum':{'type':Sequelize[_0x6e70('0x3')]},'calleridname':{'type':Sequelize[_0x6e70('0x3')]},'queue':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e70('0x4')],'set':function(_0x376a8d){var _0x506db9=moment(_0x376a8d);var _0x1b0389=moment(this[_0x6e70('0x5')](_0x6e70('0x6')))[_0x6e70('0x7')](_0x6e70('0x8'));var _0x188ed3=_0x506db9[_0x6e70('0x9')](_0x1b0389,_0x6e70('0xa'));this[_0x6e70('0xb')](_0x6e70('0xc'),_0x376a8d);this[_0x6e70('0xb')](_0x6e70('0xd'),_0x188ed3||null);}},'position':{'type':Sequelize[_0x6e70('0xe')]},'count':{'type':Sequelize[_0x6e70('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e70('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6e70('0x3')],'comment':_0x6e70('0x10')},'originalposition':{'type':Sequelize[_0x6e70('0xe')]},'channel':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6e70('0x3')]},'connectedlinename':{'type':Sequelize[_0x6e70('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6e70('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6e70('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e70('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x6e70('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6e70('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index f0965bf..264e3b3 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3797=['includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','describe','getVoiceQueuesReport','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','render','merge','body','contact','message','interaction','account','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','VoiceQueueReport'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0x3797,0x10a));var _0x7379=function(_0x8806f5,_0x259bc6){_0x8806f5=_0x8806f5-0x0;var _0x39a9a8=_0x3797[_0x8806f5];return _0x39a9a8;};'use strict';var emlformat=require(_0x7379('0x0'));var rimraf=require(_0x7379('0x1'));var zipdir=require(_0x7379('0x2'));var jsonpatch=require(_0x7379('0x3'));var rp=require(_0x7379('0x4'));var moment=require('moment');var BPromise=require(_0x7379('0x5'));var Mustache=require(_0x7379('0x6'));var util=require(_0x7379('0x7'));var path=require(_0x7379('0x8'));var sox=require(_0x7379('0x9'));var csv=require(_0x7379('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7379('0xb'));var _=require(_0x7379('0xc'));var squel=require(_0x7379('0xd'));var crypto=require(_0x7379('0xe'));var jsforce=require(_0x7379('0xf'));var deskjs=require(_0x7379('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7379('0x11'));var Papa=require(_0x7379('0x12'));var Redis=require(_0x7379('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7379('0x14'));var hardwareService=require(_0x7379('0x15'));var logger=require(_0x7379('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7379('0x17')]=_[_0x7379('0x18')](config[_0x7379('0x17')],{'host':_0x7379('0x19'),'port':0x18eb});var socket=require(_0x7379('0x1a'))(new Redis(config[_0x7379('0x17')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x144c4e,_0x102829){_0x102829=_0x102829||0xcc;return function(_0x179a82){if(_0x179a82){return _0x144c4e[_0x7379('0x1b')](_0x102829);}return _0x144c4e['status'](_0x102829)[_0x7379('0x1c')]();};}function respondWithResult(_0x1b0378,_0x45761f){_0x45761f=_0x45761f||0xc8;return function(_0xb0f5ff){if(_0xb0f5ff){return _0x1b0378[_0x7379('0x1d')](_0x45761f)[_0x7379('0x1e')](_0xb0f5ff);}};}function respondWithFilteredResult(_0xec6e86,_0x2c74ec){return function(_0xcddb6f){if(_0xcddb6f){var _0x1c5019=typeof _0x2c74ec[_0x7379('0x1f')]===_0x7379('0x20')&&typeof _0x2c74ec[_0x7379('0x21')]===_0x7379('0x20');var _0x583ee7=_0xcddb6f[_0x7379('0x22')];var _0x38fa48=_0x1c5019?0x0:_0x2c74ec['offset'];var _0x318bc2=_0x1c5019?_0xcddb6f[_0x7379('0x22')]:_0x2c74ec[_0x7379('0x1f')]+_0x2c74ec[_0x7379('0x21')];var _0x3ea7ee;if(_0x318bc2>=_0x583ee7){_0x318bc2=_0x583ee7;_0x3ea7ee=0xc8;}else{_0x3ea7ee=0xce;}_0xec6e86['status'](_0x3ea7ee);return _0xec6e86['set']('Content-Range',_0x38fa48+'-'+_0x318bc2+'/'+_0x583ee7)[_0x7379('0x1e')](_0xcddb6f);}return null;};}function patchUpdates(_0x350802){return function(_0x275e69){try{jsonpatch[_0x7379('0x23')](_0x275e69,_0x350802,!![]);}catch(_0x16157c){return BPromise['reject'](_0x16157c);}return _0x275e69[_0x7379('0x24')]();};}function saveUpdates(_0xf71eaf,_0x196888){return function(_0x4bc8b4){if(_0x4bc8b4){return _0x4bc8b4[_0x7379('0x25')](_0xf71eaf)[_0x7379('0x26')](function(_0x66ad7b){return _0x66ad7b;});}return null;};}function removeEntity(_0x45cf58,_0x52fd4b){return function(_0x224e01){if(_0x224e01){return _0x224e01[_0x7379('0x27')]()[_0x7379('0x26')](function(){_0x45cf58[_0x7379('0x1d')](0xcc)[_0x7379('0x1c')]();});}};}function handleEntityNotFound(_0x5c9065,_0x4c5330){return function(_0x5bf7d0){if(!_0x5bf7d0){_0x5c9065['sendStatus'](0x194);}return _0x5bf7d0;};}function handleError(_0x45e3fa,_0x58ef93){_0x58ef93=_0x58ef93||0x1f4;return function(_0x3a7ac2){logger[_0x7379('0x28')](_0x3a7ac2[_0x7379('0x29')]);if(_0x3a7ac2[_0x7379('0x2a')]){delete _0x3a7ac2[_0x7379('0x2a')];}_0x45e3fa[_0x7379('0x1d')](_0x58ef93)[_0x7379('0x2b')](_0x3a7ac2);};}function getMustacheRender(_0x4fef55,_0x47f6a0){return Mustache[_0x7379('0x2c')](_0x4fef55,_[_0x7379('0x2d')](_0x47f6a0[_0x7379('0x2e')],{'contact':_0x47f6a0[_0x7379('0x2f')],'message':_0x47f6a0[_0x7379('0x30')],'agent':_0x47f6a0['agent'],'interaction':_0x47f6a0[_0x7379('0x31')],'account':_0x47f6a0[_0x7379('0x32')]}))||'';}exports['index']=function(_0x1e794e,_0x46dedc){var _0x2fa024={},_0x5dbb78={},_0x69c6f5={'count':0x0,'rows':[]};var _0x2d6e0e=_[_0x7379('0x33')](db['VoiceQueueReport'][_0x7379('0x34')],function(_0x4359a1){return{'name':_0x4359a1[_0x7379('0x35')],'type':_0x4359a1[_0x7379('0x36')][_0x7379('0x37')]};});_0x5dbb78[_0x7379('0x38')]=_['map'](_0x2d6e0e,'name');_0x5dbb78[_0x7379('0x39')]=_['keys'](_0x1e794e[_0x7379('0x39')]);_0x5dbb78[_0x7379('0x3a')]=_['intersection'](_0x5dbb78[_0x7379('0x38')],_0x5dbb78[_0x7379('0x39')]);_0x2fa024[_0x7379('0x3b')]=_[_0x7379('0x3c')](_0x5dbb78[_0x7379('0x38')],qs[_0x7379('0x3d')](_0x1e794e['query'][_0x7379('0x3d')]));_0x2fa024['attributes']=_0x2fa024[_0x7379('0x3b')]['length']?_0x2fa024[_0x7379('0x3b')]:_0x5dbb78[_0x7379('0x38')];if(!_0x1e794e[_0x7379('0x39')][_0x7379('0x3e')]('nolimit')){_0x2fa024[_0x7379('0x21')]=qs[_0x7379('0x21')](_0x1e794e[_0x7379('0x39')][_0x7379('0x21')]);_0x2fa024['offset']=qs[_0x7379('0x1f')](_0x1e794e[_0x7379('0x39')][_0x7379('0x1f')]);}_0x2fa024[_0x7379('0x3f')]=qs[_0x7379('0x40')](_0x1e794e['query']['sort']);_0x2fa024[_0x7379('0x41')]=qs['filters'](_['pick'](_0x1e794e[_0x7379('0x39')],_0x5dbb78[_0x7379('0x3a')]),_0x2d6e0e);if(_0x1e794e['query'][_0x7379('0x42')]){_0x2fa024['where']=_[_0x7379('0x2d')](_0x2fa024[_0x7379('0x41')],{'$or':_[_0x7379('0x33')](_0x2d6e0e,function(_0x39753e){if(_0x39753e[_0x7379('0x36')]!==_0x7379('0x43')){var _0x2092a8={};_0x2092a8[_0x39753e[_0x7379('0x2a')]]={'$like':'%'+_0x1e794e[_0x7379('0x39')][_0x7379('0x42')]+'%'};return _0x2092a8;}})});}_0x2fa024=_[_0x7379('0x2d')]({},_0x2fa024,_0x1e794e[_0x7379('0x44')]);var _0x270275={'where':_0x2fa024[_0x7379('0x41')]};return db[_0x7379('0x45')]['count'](_0x270275)[_0x7379('0x26')](function(_0x2509ef){_0x69c6f5[_0x7379('0x22')]=_0x2509ef;if(_0x1e794e[_0x7379('0x39')][_0x7379('0x46')]){_0x2fa024[_0x7379('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7379('0x48')](_0x2fa024);})['then'](function(_0x29f5e7){_0x69c6f5[_0x7379('0x49')]=_0x29f5e7;return _0x69c6f5;})['then'](respondWithFilteredResult(_0x46dedc,_0x2fa024))[_0x7379('0x4a')](handleError(_0x46dedc,null));};exports[_0x7379('0x4b')]=function(_0x55b1d7,_0x1e29a4){var _0x445003={'raw':![],'where':{'id':_0x55b1d7[_0x7379('0x4c')]['id']}},_0x205892={};_0x205892[_0x7379('0x38')]=_[_0x7379('0x4d')](db['VoiceQueueReport'][_0x7379('0x34')]);_0x205892[_0x7379('0x39')]=_[_0x7379('0x4d')](_0x55b1d7['query']);_0x205892[_0x7379('0x3a')]=_[_0x7379('0x3c')](_0x205892[_0x7379('0x38')],_0x205892[_0x7379('0x39')]);_0x445003[_0x7379('0x3b')]=_[_0x7379('0x3c')](_0x205892[_0x7379('0x38')],qs[_0x7379('0x3d')](_0x55b1d7['query'][_0x7379('0x3d')]));_0x445003[_0x7379('0x3b')]=_0x445003['attributes'][_0x7379('0x4e')]?_0x445003[_0x7379('0x3b')]:_0x205892[_0x7379('0x38')];if(_0x55b1d7[_0x7379('0x39')][_0x7379('0x46')]){_0x445003['include']=[{'all':!![]}];}_0x445003=_[_0x7379('0x2d')]({},_0x445003,_0x55b1d7[_0x7379('0x44')]);return db['VoiceQueueReport'][_0x7379('0x4f')](_0x445003)['then'](handleEntityNotFound(_0x1e29a4,null))['then'](respondWithResult(_0x1e29a4,null))[_0x7379('0x4a')](handleError(_0x1e29a4,null));};exports[_0x7379('0x50')]=function(_0x393f79,_0x22d6ec){return db[_0x7379('0x45')][_0x7379('0x50')](_0x393f79[_0x7379('0x2e')],{})[_0x7379('0x26')](respondWithResult(_0x22d6ec,0xc9))[_0x7379('0x4a')](handleError(_0x22d6ec,null));};exports['update']=function(_0x484c8a,_0x4577ea){if(_0x484c8a[_0x7379('0x2e')]['id']){delete _0x484c8a[_0x7379('0x2e')]['id'];}return db[_0x7379('0x45')][_0x7379('0x4f')]({'where':{'id':_0x484c8a['params']['id']}})['then'](handleEntityNotFound(_0x4577ea,null))[_0x7379('0x26')](saveUpdates(_0x484c8a['body'],null))[_0x7379('0x26')](respondWithResult(_0x4577ea,null))['catch'](handleError(_0x4577ea,null));};exports[_0x7379('0x27')]=function(_0x4123da,_0x3cc28f){return db[_0x7379('0x45')][_0x7379('0x4f')]({'where':{'id':_0x4123da[_0x7379('0x4c')]['id']}})[_0x7379('0x26')](handleEntityNotFound(_0x3cc28f,null))[_0x7379('0x26')](removeEntity(_0x3cc28f,null))[_0x7379('0x4a')](handleError(_0x3cc28f,null));};exports['describe']=function(_0x4b7643,_0x9e7b81){return db['VoiceQueueReport'][_0x7379('0x51')]()['then'](respondWithResult(_0x9e7b81,null))[_0x7379('0x4a')](handleError(_0x9e7b81,null));};exports[_0x7379('0x52')]=function(_0x3d7b6f,_0x23555a){var _0x3f222d={},_0x19c928={},_0x57c2fd={'count':0x0,'rows':[]};_0x19c928[_0x7379('0x38')]=_[_0x7379('0x4d')](db[_0x7379('0x45')][_0x7379('0x34')]);_0x19c928[_0x7379('0x39')]=_['keys'](_0x3d7b6f['query']);_0x19c928[_0x7379('0x3a')]=_['intersection'](_0x19c928[_0x7379('0x38')],_0x19c928[_0x7379('0x39')]);_0x3f222d[_0x7379('0x3b')]=_['intersection'](_0x19c928['model'],qs['fields'](_0x3d7b6f[_0x7379('0x39')][_0x7379('0x3d')]));_0x3f222d[_0x7379('0x3b')]=_0x3f222d['attributes']['length']?_0x3f222d['attributes']:_0x19c928['model'];if(!_0x3d7b6f[_0x7379('0x39')][_0x7379('0x3e')]('nolimit')){_0x3f222d[_0x7379('0x21')]=qs[_0x7379('0x21')](_0x3d7b6f['query'][_0x7379('0x21')]);_0x3f222d['offset']=qs[_0x7379('0x1f')](_0x3d7b6f[_0x7379('0x39')][_0x7379('0x1f')]);}_0x3f222d['order']=qs[_0x7379('0x40')](_0x3d7b6f[_0x7379('0x39')][_0x7379('0x40')]);_0x3f222d['where']=qs[_0x7379('0x3a')](_[_0x7379('0x53')](_0x3d7b6f[_0x7379('0x39')],_0x19c928['filters']));if(_0x3d7b6f['query'][_0x7379('0x42')]){_0x3f222d[_0x7379('0x41')]=_[_0x7379('0x2d')](_0x3f222d[_0x7379('0x41')],{'$or':_[_0x7379('0x33')](_0x3f222d[_0x7379('0x3b')],function(_0x14ded0){var _0x39ca7c={};_0x39ca7c[_0x14ded0]={'$like':'%'+_0x3d7b6f[_0x7379('0x39')][_0x7379('0x42')]+'%'};return _0x39ca7c;})});}_0x3f222d=_['merge']({},_0x3f222d,_0x3d7b6f[_0x7379('0x44')]);var _0x18698a={'where':_0x3f222d[_0x7379('0x41')]};return db['VoiceQueueReport']['count'](_0x18698a)['then'](function(_0x341770){_0x57c2fd[_0x7379('0x22')]=_0x341770;if(_0x3d7b6f['query'][_0x7379('0x46')]){_0x3f222d[_0x7379('0x47')]=[{'all':!![]}];}return db[_0x7379('0x45')][_0x7379('0x48')](_0x3f222d);})[_0x7379('0x26')](function(_0x4ef5a9){_0x57c2fd[_0x7379('0x49')]=_0x4ef5a9;return _0x57c2fd;})['then'](respondWithFilteredResult(_0x23555a,_0x3f222d,_0x7379('0x52')))[_0x7379('0x4a')](handleError(_0x23555a,null,_0x7379('0x52')));}; \ No newline at end of file +var _0xf8bd=['hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','describe','getVoiceQueuesReport','pick','options','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','error','stack','name','render','merge','body','contact','message','agent','interaction','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8bd,0x1d0));var _0xdf8b=function(_0x2c3458,_0x1f7efd){_0x2c3458=_0x2c3458-0x0;var _0x3f7e02=_0xf8bd[_0x2c3458];return _0x3f7e02;};'use strict';var emlformat=require(_0xdf8b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf8b('0x1'));var jsonpatch=require(_0xdf8b('0x2'));var rp=require(_0xdf8b('0x3'));var moment=require('moment');var BPromise=require(_0xdf8b('0x4'));var Mustache=require(_0xdf8b('0x5'));var util=require(_0xdf8b('0x6'));var path=require(_0xdf8b('0x7'));var sox=require(_0xdf8b('0x8'));var csv=require('to-csv');var ejs=require(_0xdf8b('0x9'));var fs=require('fs');var fs_extra=require(_0xdf8b('0xa'));var _=require('lodash');var squel=require(_0xdf8b('0xb'));var crypto=require(_0xdf8b('0xc'));var jsforce=require(_0xdf8b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdf8b('0xe'));var querystring=require(_0xdf8b('0xf'));var Papa=require(_0xdf8b('0x10'));var Redis=require(_0xdf8b('0x11'));var authService=require(_0xdf8b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf8b('0x13'));var logger=require('../../config/logger')(_0xdf8b('0x14'));var utils=require(_0xdf8b('0x15'));var config=require(_0xdf8b('0x16'));var licenseUtil=require(_0xdf8b('0x17'));var db=require(_0xdf8b('0x18'))['db'];config[_0xdf8b('0x19')]=_[_0xdf8b('0x1a')](config[_0xdf8b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf8b('0x1b'))(new Redis(config[_0xdf8b('0x19')]));require(_0xdf8b('0x1c'))[_0xdf8b('0x1d')](socket);function respondWithStatusCode(_0x543db3,_0x527e41){_0x527e41=_0x527e41||0xcc;return function(_0x820486){if(_0x820486){return _0x543db3[_0xdf8b('0x1e')](_0x527e41);}return _0x543db3[_0xdf8b('0x1f')](_0x527e41)[_0xdf8b('0x20')]();};}function respondWithResult(_0x56f2c0,_0x139c4f){_0x139c4f=_0x139c4f||0xc8;return function(_0x3716f8){if(_0x3716f8){return _0x56f2c0[_0xdf8b('0x1f')](_0x139c4f)[_0xdf8b('0x21')](_0x3716f8);}};}function respondWithFilteredResult(_0x32853e,_0xaf18fe){return function(_0x213056){if(_0x213056){var _0x23b632=typeof _0xaf18fe[_0xdf8b('0x22')]==='undefined'&&typeof _0xaf18fe['limit']===_0xdf8b('0x23');var _0x26a9e5=_0x213056[_0xdf8b('0x24')];var _0x507c9b=_0x23b632?0x0:_0xaf18fe[_0xdf8b('0x22')];var _0x575b9c=_0x23b632?_0x213056[_0xdf8b('0x24')]:_0xaf18fe[_0xdf8b('0x22')]+_0xaf18fe[_0xdf8b('0x25')];var _0xcfe134;if(_0x575b9c>=_0x26a9e5){_0x575b9c=_0x26a9e5;_0xcfe134=0xc8;}else{_0xcfe134=0xce;}_0x32853e[_0xdf8b('0x1f')](_0xcfe134);return _0x32853e['set'](_0xdf8b('0x26'),_0x507c9b+'-'+_0x575b9c+'/'+_0x26a9e5)[_0xdf8b('0x21')](_0x213056);}return null;};}function patchUpdates(_0x106089){return function(_0x57f511){try{jsonpatch[_0xdf8b('0x27')](_0x57f511,_0x106089,!![]);}catch(_0x1e9281){return BPromise['reject'](_0x1e9281);}return _0x57f511[_0xdf8b('0x28')]();};}function saveUpdates(_0x1491c9,_0x588662){return function(_0x485e70){if(_0x485e70){return _0x485e70['update'](_0x1491c9)['then'](function(_0x3851c6){return _0x3851c6;});}return null;};}function removeEntity(_0x3226ed,_0x4ef996){return function(_0x32672d){if(_0x32672d){return _0x32672d[_0xdf8b('0x29')]()['then'](function(){_0x3226ed['status'](0xcc)[_0xdf8b('0x20')]();});}};}function handleEntityNotFound(_0x158163,_0x4563ed){return function(_0x5f1f8a){if(!_0x5f1f8a){_0x158163[_0xdf8b('0x1e')](0x194);}return _0x5f1f8a;};}function handleError(_0x5211f0,_0x2cd655){_0x2cd655=_0x2cd655||0x1f4;return function(_0x5c3d66){logger[_0xdf8b('0x2a')](_0x5c3d66[_0xdf8b('0x2b')]);if(_0x5c3d66[_0xdf8b('0x2c')]){delete _0x5c3d66['name'];}_0x5211f0['status'](_0x2cd655)['send'](_0x5c3d66);};}function getMustacheRender(_0x93037a,_0x45e0b2){return Mustache[_0xdf8b('0x2d')](_0x93037a,_[_0xdf8b('0x2e')](_0x45e0b2[_0xdf8b('0x2f')],{'contact':_0x45e0b2[_0xdf8b('0x30')],'message':_0x45e0b2[_0xdf8b('0x31')],'agent':_0x45e0b2[_0xdf8b('0x32')],'interaction':_0x45e0b2[_0xdf8b('0x33')],'account':_0x45e0b2['account']}))||'';}exports[_0xdf8b('0x34')]=function(_0x4991f7,_0x1bfab8){var _0x38ab7f={},_0x49de7d={},_0x3d5994={'count':0x0,'rows':[]};var _0x195bc1=_['map'](db[_0xdf8b('0x35')][_0xdf8b('0x36')],function(_0x510bfe){return{'name':_0x510bfe[_0xdf8b('0x37')],'type':_0x510bfe[_0xdf8b('0x38')]['key']};});_0x49de7d[_0xdf8b('0x39')]=_[_0xdf8b('0x3a')](_0x195bc1,_0xdf8b('0x2c'));_0x49de7d[_0xdf8b('0x3b')]=_[_0xdf8b('0x3c')](_0x4991f7[_0xdf8b('0x3b')]);_0x49de7d['filters']=_[_0xdf8b('0x3d')](_0x49de7d[_0xdf8b('0x39')],_0x49de7d[_0xdf8b('0x3b')]);_0x38ab7f[_0xdf8b('0x3e')]=_[_0xdf8b('0x3d')](_0x49de7d[_0xdf8b('0x39')],qs[_0xdf8b('0x3f')](_0x4991f7[_0xdf8b('0x3b')]['fields']));_0x38ab7f[_0xdf8b('0x3e')]=_0x38ab7f['attributes']['length']?_0x38ab7f[_0xdf8b('0x3e')]:_0x49de7d[_0xdf8b('0x39')];if(!_0x4991f7[_0xdf8b('0x3b')][_0xdf8b('0x40')](_0xdf8b('0x41'))){_0x38ab7f[_0xdf8b('0x25')]=qs['limit'](_0x4991f7[_0xdf8b('0x3b')]['limit']);_0x38ab7f[_0xdf8b('0x22')]=qs['offset'](_0x4991f7[_0xdf8b('0x3b')]['offset']);}_0x38ab7f[_0xdf8b('0x42')]=qs['sort'](_0x4991f7[_0xdf8b('0x3b')][_0xdf8b('0x43')]);_0x38ab7f[_0xdf8b('0x44')]=qs[_0xdf8b('0x45')](_['pick'](_0x4991f7[_0xdf8b('0x3b')],_0x49de7d[_0xdf8b('0x45')]),_0x195bc1);if(_0x4991f7[_0xdf8b('0x3b')]['filter']){_0x38ab7f[_0xdf8b('0x44')]=_[_0xdf8b('0x2e')](_0x38ab7f[_0xdf8b('0x44')],{'$or':_[_0xdf8b('0x3a')](_0x195bc1,function(_0x55e8f0){if(_0x55e8f0[_0xdf8b('0x38')]!==_0xdf8b('0x46')){var _0x1b57aa={};_0x1b57aa[_0x55e8f0[_0xdf8b('0x2c')]]={'$like':'%'+_0x4991f7[_0xdf8b('0x3b')][_0xdf8b('0x47')]+'%'};return _0x1b57aa;}})});}_0x38ab7f=_[_0xdf8b('0x2e')]({},_0x38ab7f,_0x4991f7['options']);var _0x31cd02={'where':_0x38ab7f[_0xdf8b('0x44')]};return db[_0xdf8b('0x35')][_0xdf8b('0x24')](_0x31cd02)[_0xdf8b('0x48')](function(_0x55dce3){_0x3d5994[_0xdf8b('0x24')]=_0x55dce3;if(_0x4991f7[_0xdf8b('0x3b')][_0xdf8b('0x49')]){_0x38ab7f[_0xdf8b('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xdf8b('0x4b')](_0x38ab7f);})[_0xdf8b('0x48')](function(_0x45719d){_0x3d5994[_0xdf8b('0x4c')]=_0x45719d;return _0x3d5994;})['then'](respondWithFilteredResult(_0x1bfab8,_0x38ab7f))[_0xdf8b('0x4d')](handleError(_0x1bfab8,null));};exports[_0xdf8b('0x4e')]=function(_0x4b0dc7,_0x557c6d){var _0x114f6d={'raw':![],'where':{'id':_0x4b0dc7[_0xdf8b('0x4f')]['id']}},_0x4afcb9={};_0x4afcb9['model']=_[_0xdf8b('0x3c')](db[_0xdf8b('0x35')][_0xdf8b('0x36')]);_0x4afcb9[_0xdf8b('0x3b')]=_[_0xdf8b('0x3c')](_0x4b0dc7[_0xdf8b('0x3b')]);_0x4afcb9['filters']=_[_0xdf8b('0x3d')](_0x4afcb9[_0xdf8b('0x39')],_0x4afcb9[_0xdf8b('0x3b')]);_0x114f6d[_0xdf8b('0x3e')]=_[_0xdf8b('0x3d')](_0x4afcb9[_0xdf8b('0x39')],qs[_0xdf8b('0x3f')](_0x4b0dc7[_0xdf8b('0x3b')]['fields']));_0x114f6d[_0xdf8b('0x3e')]=_0x114f6d[_0xdf8b('0x3e')][_0xdf8b('0x50')]?_0x114f6d[_0xdf8b('0x3e')]:_0x4afcb9[_0xdf8b('0x39')];if(_0x4b0dc7[_0xdf8b('0x3b')][_0xdf8b('0x49')]){_0x114f6d[_0xdf8b('0x4a')]=[{'all':!![]}];}_0x114f6d=_[_0xdf8b('0x2e')]({},_0x114f6d,_0x4b0dc7['options']);return db[_0xdf8b('0x35')][_0xdf8b('0x51')](_0x114f6d)[_0xdf8b('0x48')](handleEntityNotFound(_0x557c6d,null))[_0xdf8b('0x48')](respondWithResult(_0x557c6d,null))[_0xdf8b('0x4d')](handleError(_0x557c6d,null));};exports[_0xdf8b('0x52')]=function(_0x27e5f2,_0x413020){return db[_0xdf8b('0x35')]['create'](_0x27e5f2[_0xdf8b('0x2f')],{})['then'](respondWithResult(_0x413020,0xc9))['catch'](handleError(_0x413020,null));};exports[_0xdf8b('0x53')]=function(_0x1589c4,_0xf05264){if(_0x1589c4['body']['id']){delete _0x1589c4[_0xdf8b('0x2f')]['id'];}return db['VoiceQueueReport'][_0xdf8b('0x51')]({'where':{'id':_0x1589c4[_0xdf8b('0x4f')]['id']}})[_0xdf8b('0x48')](handleEntityNotFound(_0xf05264,null))[_0xdf8b('0x48')](saveUpdates(_0x1589c4[_0xdf8b('0x2f')],null))[_0xdf8b('0x48')](respondWithResult(_0xf05264,null))['catch'](handleError(_0xf05264,null));};exports['destroy']=function(_0x177601,_0x5f4c72){return db[_0xdf8b('0x35')][_0xdf8b('0x51')]({'where':{'id':_0x177601[_0xdf8b('0x4f')]['id']}})[_0xdf8b('0x48')](handleEntityNotFound(_0x5f4c72,null))[_0xdf8b('0x48')](removeEntity(_0x5f4c72,null))[_0xdf8b('0x4d')](handleError(_0x5f4c72,null));};exports[_0xdf8b('0x54')]=function(_0x44efcb,_0x2a68b8){return db[_0xdf8b('0x35')][_0xdf8b('0x54')]()[_0xdf8b('0x48')](respondWithResult(_0x2a68b8,null))[_0xdf8b('0x4d')](handleError(_0x2a68b8,null));};exports[_0xdf8b('0x55')]=function(_0x11825b,_0x5b28a3){var _0x5ce77a={},_0x2dde67={},_0x5ba1cc={'count':0x0,'rows':[]};_0x2dde67[_0xdf8b('0x39')]=_['keys'](db['VoiceQueueReport'][_0xdf8b('0x36')]);_0x2dde67[_0xdf8b('0x3b')]=_[_0xdf8b('0x3c')](_0x11825b[_0xdf8b('0x3b')]);_0x2dde67[_0xdf8b('0x45')]=_['intersection'](_0x2dde67['model'],_0x2dde67[_0xdf8b('0x3b')]);_0x5ce77a[_0xdf8b('0x3e')]=_[_0xdf8b('0x3d')](_0x2dde67['model'],qs[_0xdf8b('0x3f')](_0x11825b[_0xdf8b('0x3b')]['fields']));_0x5ce77a[_0xdf8b('0x3e')]=_0x5ce77a['attributes'][_0xdf8b('0x50')]?_0x5ce77a['attributes']:_0x2dde67['model'];if(!_0x11825b[_0xdf8b('0x3b')][_0xdf8b('0x40')](_0xdf8b('0x41'))){_0x5ce77a[_0xdf8b('0x25')]=qs[_0xdf8b('0x25')](_0x11825b[_0xdf8b('0x3b')][_0xdf8b('0x25')]);_0x5ce77a[_0xdf8b('0x22')]=qs[_0xdf8b('0x22')](_0x11825b[_0xdf8b('0x3b')][_0xdf8b('0x22')]);}_0x5ce77a[_0xdf8b('0x42')]=qs['sort'](_0x11825b['query'][_0xdf8b('0x43')]);_0x5ce77a[_0xdf8b('0x44')]=qs['filters'](_[_0xdf8b('0x56')](_0x11825b[_0xdf8b('0x3b')],_0x2dde67['filters']));if(_0x11825b[_0xdf8b('0x3b')][_0xdf8b('0x47')]){_0x5ce77a['where']=_[_0xdf8b('0x2e')](_0x5ce77a[_0xdf8b('0x44')],{'$or':_[_0xdf8b('0x3a')](_0x5ce77a[_0xdf8b('0x3e')],function(_0x24c3a9){var _0x6c3b1f={};_0x6c3b1f[_0x24c3a9]={'$like':'%'+_0x11825b[_0xdf8b('0x3b')]['filter']+'%'};return _0x6c3b1f;})});}_0x5ce77a=_[_0xdf8b('0x2e')]({},_0x5ce77a,_0x11825b[_0xdf8b('0x57')]);var _0x46f8f8={'where':_0x5ce77a[_0xdf8b('0x44')]};return db['VoiceQueueReport'][_0xdf8b('0x24')](_0x46f8f8)[_0xdf8b('0x48')](function(_0x6823ee){_0x5ba1cc[_0xdf8b('0x24')]=_0x6823ee;if(_0x11825b[_0xdf8b('0x3b')][_0xdf8b('0x49')]){_0x5ce77a[_0xdf8b('0x4a')]=[{'all':!![]}];}return db[_0xdf8b('0x35')][_0xdf8b('0x4b')](_0x5ce77a);})['then'](function(_0x45f0e6){_0x5ba1cc[_0xdf8b('0x4c')]=_0x45f0e6;return _0x5ba1cc;})[_0xdf8b('0x48')](respondWithFilteredResult(_0x5b28a3,_0x5ce77a,_0xdf8b('0x55')))[_0xdf8b('0x4d')](handleError(_0x5b28a3,null,_0xdf8b('0x55')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 5173538..6075d74 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.events.js +++ b/server/api/voiceQueueReport/voiceQueueReport.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafdb=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x5323dc,_0x79eb95){var _0x398901=function(_0xada06a){while(--_0xada06a){_0x5323dc['push'](_0x5323dc['shift']());}};_0x398901(++_0x79eb95);}(_0xafdb,0x177));var _0xbafd=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xafdb[_0x4d7116];return _0x4593dc;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xbafd('0x0'))['db'][_0xbafd('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xbafd('0x2')](0x0);var events={'afterCreate':_0xbafd('0x3'),'afterUpdate':_0xbafd('0x4'),'afterDestroy':_0xbafd('0x5')};function emitEvent(_0xd08bcd){return function(_0x278fc0,_0xbec3e9,_0x10c35d){VoiceQueueReportEvents['emit'](_0xd08bcd+':'+_0x278fc0['id'],_0x278fc0);VoiceQueueReportEvents[_0xbafd('0x6')](_0xd08bcd,_0x278fc0);_0x10c35d(null);};}for(var e in events){if(events[_0xbafd('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xd596=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x149c54,_0x53cd9d){var _0x4ae4e9=function(_0x30053b){while(--_0x30053b){_0x149c54['push'](_0x149c54['shift']());}};_0x4ae4e9(++_0x53cd9d);}(_0xd596,0x14c));var _0x6d59=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xd596[_0x4b2cc6];return _0x3e0b08;};'use strict';var EventEmitter=require(_0x6d59('0x0'));var VoiceQueueReport=require(_0x6d59('0x1'))['db'][_0x6d59('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x6d59('0x3')](0x0);var events={'afterCreate':_0x6d59('0x4'),'afterUpdate':_0x6d59('0x5'),'afterDestroy':'remove'};function emitEvent(_0x183ecf){return function(_0x5017b8,_0x1ce087,_0x3e577a){VoiceQueueReportEvents[_0x6d59('0x6')](_0x183ecf+':'+_0x5017b8['id'],_0x5017b8);VoiceQueueReportEvents[_0x6d59('0x6')](_0x183ecf,_0x5017b8);_0x3e577a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x6d59('0x7')](e,emitEvent(event));}}module[_0x6d59('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8f842d4..5c7b951 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x8ec916,_0x39b8b1){var _0x18097a=function(_0x443c0a){while(--_0x443c0a){_0x8ec916['push'](_0x8ec916['shift']());}};_0x18097a(++_0x39b8b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x291d48,_0x447456){_0x291d48=_0x291d48-0x0;var _0x4ea2fb=_0x5f2f[_0x291d48];return _0x4ea2fb;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x27f556,_0x5c7322){var _0x24a0f9=function(_0x1059ad){while(--_0x1059ad){_0x27f556['push'](_0x27f556['shift']());}};_0x24a0f9(++_0x5c7322);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7c38246..473ea33 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.rpc.js +++ b/server/api/voiceQueueReport/voiceQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2dc=['socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','model','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x3e3ea1,_0xd9b9e9){var _0x295c32=function(_0xe2fd98){while(--_0xe2fd98){_0x3e3ea1['push'](_0x3e3ea1['shift']());}};_0x295c32(++_0xd9b9e9);}(_0xd2dc,0x175));var _0xcd2d=function(_0x14f7d2,_0x19d283){_0x14f7d2=_0x14f7d2-0x0;var _0x212d40=_0xd2dc[_0x14f7d2];return _0x212d40;};'use strict';var _=require(_0xcd2d('0x0'));var util=require(_0xcd2d('0x1'));var moment=require(_0xcd2d('0x2'));var BPromise=require(_0xcd2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd2d('0x4'));var db=require(_0xcd2d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd2d('0x6'))('rpc');var config=require(_0xcd2d('0x7'));var jayson=require(_0xcd2d('0x8'));var client=jayson[_0xcd2d('0x9')][_0xcd2d('0xa')]({'port':0x232a});config['redis']=_[_0xcd2d('0xb')](config[_0xcd2d('0xc')],{'host':_0xcd2d('0xd'),'port':0x18eb});var socket=require(_0xcd2d('0xe'))(new Redis(config[_0xcd2d('0xc')]));require(_0xcd2d('0xf'))[_0xcd2d('0x10')](socket);function respondWithRpcPromise(_0x49e4a4,_0x343fcc,_0x3cd3fa){return new BPromise(function(_0x51ebc9,_0x402588){return client['request'](_0x49e4a4,_0x3cd3fa)[_0xcd2d('0x11')](function(_0x4625b5){logger[_0xcd2d('0x12')](_0xcd2d('0x13'),_0x343fcc,_0xcd2d('0x14'));logger[_0xcd2d('0x15')](_0xcd2d('0x16'),_0x343fcc,'request\x20sent',JSON[_0xcd2d('0x17')](_0x4625b5));if(_0x4625b5[_0xcd2d('0x18')]){if(_0x4625b5['error'][_0xcd2d('0x19')]===0x1f4){logger[_0xcd2d('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x343fcc,_0x4625b5[_0xcd2d('0x18')]['message']);return _0x402588(_0x4625b5[_0xcd2d('0x18')]['message']);}logger[_0xcd2d('0x18')](_0xcd2d('0x13'),_0x343fcc,_0x4625b5[_0xcd2d('0x18')][_0xcd2d('0x1a')]);return _0x51ebc9(_0x4625b5[_0xcd2d('0x18')][_0xcd2d('0x1a')]);}else{logger['info'](_0xcd2d('0x13'),_0x343fcc,_0xcd2d('0x14'));_0x51ebc9(_0x4625b5[_0xcd2d('0x1b')]['message']);}})['catch'](function(_0x344e60){logger[_0xcd2d('0x18')](_0xcd2d('0x13'),_0x343fcc,_0x344e60);_0x402588(_0x344e60);});});}exports[_0xcd2d('0x1c')]=function(_0x5a3c2c){var _0x5c2dfa=this;return new Promise(function(_0x5cc00d,_0x5d2a6f){return db[_0xcd2d('0x1d')]['findAll']({'raw':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x20')]||null:null,'attributes':_0x5a3c2c['options']?_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x21')]||null:null,'limit':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c['options'][_0xcd2d('0x22')]||null:null,'include':_0x5a3c2c[_0xcd2d('0x1e')]?_0x5a3c2c['options'][_0xcd2d('0x23')]?_['map'](_0x5a3c2c[_0xcd2d('0x1e')][_0xcd2d('0x23')],function(_0x3fe2ad){return{'model':db[_0x3fe2ad[_0xcd2d('0x24')]],'as':_0x3fe2ad['as'],'attributes':_0x3fe2ad[_0xcd2d('0x21')],'include':_0x3fe2ad[_0xcd2d('0x23')]?_['map'](_0x3fe2ad[_0xcd2d('0x23')],function(_0x4ce5b2){return{'model':db[_0x4ce5b2[_0xcd2d('0x24')]],'as':_0x4ce5b2['as'],'attributes':_0x4ce5b2['attributes'],'include':_0x4ce5b2[_0xcd2d('0x23')]?_['map'](_0x4ce5b2[_0xcd2d('0x23')],function(_0x1bb61a){return{'model':db[_0x1bb61a[_0xcd2d('0x24')]],'as':_0x1bb61a['as'],'attributes':_0x1bb61a[_0xcd2d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcd2d('0x11')](function(_0x3b8ef1){logger[_0xcd2d('0x12')]('GetVoiceQueueReport',_0x5a3c2c);logger[_0xcd2d('0x15')]('GetVoiceQueueReport',_0x5a3c2c,JSON['stringify'](_0x3b8ef1));_0x5cc00d(_0x3b8ef1);})[_0xcd2d('0x25')](function(_0x312e36){logger[_0xcd2d('0x18')]('GetVoiceQueueReport',_0x312e36[_0xcd2d('0x1a')],_0x5a3c2c);_0x5d2a6f(_0x5c2dfa[_0xcd2d('0x18')](0x1f4,_0x312e36[_0xcd2d('0x1a')]));});});};exports['CreateVoiceQueueReport']=function(_0x55be1a){var _0x100313=this;return new Promise(function(_0x3a20ee,_0x5519a6){return db[_0xcd2d('0x1d')][_0xcd2d('0x26')](_0x55be1a[_0xcd2d('0x27')],{'raw':_0x55be1a[_0xcd2d('0x1e')]?_0x55be1a['options'][_0xcd2d('0x1f')]===undefined?!![]:![]:!![]})[_0xcd2d('0x11')](function(_0x3a9e39){logger[_0xcd2d('0x12')]('CreateVoiceQueueReport',_0x55be1a);logger[_0xcd2d('0x15')](_0xcd2d('0x28'),_0x55be1a,JSON['stringify'](_0x3a9e39));_0x3a20ee(_0x3a9e39);})[_0xcd2d('0x25')](function(_0x4f9b4b){logger[_0xcd2d('0x18')](_0xcd2d('0x28'),_0x4f9b4b['message'],_0x55be1a);_0x5519a6(_0x100313['error'](0x1f4,_0x4f9b4b['message']));});});};exports[_0xcd2d('0x29')]=function(_0x5a2bf9){var _0x38ba97=this;return new Promise(function(_0x53619e,_0x404152){return db[_0xcd2d('0x1d')][_0xcd2d('0x2a')](_0x5a2bf9[_0xcd2d('0x27')],{'raw':_0x5a2bf9[_0xcd2d('0x1e')]?_0x5a2bf9['options'][_0xcd2d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2bf9['options']?_0x5a2bf9[_0xcd2d('0x1e')][_0xcd2d('0x20')]||null:null,'attributes':_0x5a2bf9[_0xcd2d('0x1e')]?_0x5a2bf9[_0xcd2d('0x1e')][_0xcd2d('0x21')]||null:null,'limit':_0x5a2bf9[_0xcd2d('0x1e')]?_0x5a2bf9['options'][_0xcd2d('0x22')]||null:null})['then'](function(_0x37d7ea){logger[_0xcd2d('0x12')](_0xcd2d('0x29'),_0x5a2bf9);logger[_0xcd2d('0x15')](_0xcd2d('0x29'),_0x5a2bf9,JSON[_0xcd2d('0x17')](_0x37d7ea));_0x53619e(_0x37d7ea);})[_0xcd2d('0x25')](function(_0x3530be){logger[_0xcd2d('0x18')]('UpdateVoiceQueueReport',_0x3530be[_0xcd2d('0x1a')],_0x5a2bf9);_0x404152(_0x38ba97[_0xcd2d('0x18')](0x1f4,_0x3530be['message']));});});}; \ No newline at end of file +var _0x92e6=['catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','info','stringify','UpdateVoiceQueueReport','update','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4b4277,_0x22676f){var _0x1ff405=function(_0x2fa9e2){while(--_0x2fa9e2){_0x4b4277['push'](_0x4b4277['shift']());}};_0x1ff405(++_0x22676f);}(_0x92e6,0x141));var _0x692e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x92e6[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x692e('0x0'));var util=require('util');var moment=require(_0x692e('0x1'));var BPromise=require(_0x692e('0x2'));var rs=require(_0x692e('0x3'));var fs=require('fs');var Redis=require(_0x692e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x692e('0x5'));var logger=require(_0x692e('0x6'))(_0x692e('0x7'));var config=require('../../config/environment');var jayson=require(_0x692e('0x8'));var client=jayson[_0x692e('0x9')]['http']({'port':0x232a});config[_0x692e('0xa')]=_['defaults'](config[_0x692e('0xa')],{'host':_0x692e('0xb'),'port':0x18eb});var socket=require(_0x692e('0xc'))(new Redis(config[_0x692e('0xa')]));require('./voiceQueueReport.socket')[_0x692e('0xd')](socket);function respondWithRpcPromise(_0x5306b5,_0x20552d,_0x50bab2){return new BPromise(function(_0x74349f,_0x10d151){return client[_0x692e('0xe')](_0x5306b5,_0x50bab2)['then'](function(_0xac50aa){logger['info'](_0x692e('0xf'),_0x20552d,_0x692e('0x10'));logger[_0x692e('0x11')](_0x692e('0x12'),_0x20552d,_0x692e('0x10'),JSON['stringify'](_0xac50aa));if(_0xac50aa[_0x692e('0x13')]){if(_0xac50aa[_0x692e('0x13')][_0x692e('0x14')]===0x1f4){logger[_0x692e('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x20552d,_0xac50aa[_0x692e('0x13')][_0x692e('0x15')]);return _0x10d151(_0xac50aa[_0x692e('0x13')]['message']);}logger[_0x692e('0x13')](_0x692e('0xf'),_0x20552d,_0xac50aa['error'][_0x692e('0x15')]);return _0x74349f(_0xac50aa[_0x692e('0x13')][_0x692e('0x15')]);}else{logger['info'](_0x692e('0xf'),_0x20552d,_0x692e('0x10'));_0x74349f(_0xac50aa[_0x692e('0x16')][_0x692e('0x15')]);}})[_0x692e('0x17')](function(_0x4f0cf3){logger[_0x692e('0x13')](_0x692e('0xf'),_0x20552d,_0x4f0cf3);_0x10d151(_0x4f0cf3);});});}exports[_0x692e('0x18')]=function(_0xbfa431){var _0x7c1738=this;return new Promise(function(_0x249e7d,_0x3c8084){return db[_0x692e('0x19')][_0x692e('0x1a')]({'raw':_0xbfa431[_0x692e('0x1b')]?_0xbfa431['options'][_0x692e('0x1c')]===undefined?!![]:![]:!![],'where':_0xbfa431[_0x692e('0x1b')]?_0xbfa431[_0x692e('0x1b')][_0x692e('0x1d')]||null:null,'attributes':_0xbfa431[_0x692e('0x1b')]?_0xbfa431[_0x692e('0x1b')][_0x692e('0x1e')]||null:null,'limit':_0xbfa431[_0x692e('0x1b')]?_0xbfa431[_0x692e('0x1b')][_0x692e('0x1f')]||null:null,'include':_0xbfa431[_0x692e('0x1b')]?_0xbfa431[_0x692e('0x1b')][_0x692e('0x20')]?_[_0x692e('0x21')](_0xbfa431[_0x692e('0x1b')][_0x692e('0x20')],function(_0x64087f){return{'model':db[_0x64087f[_0x692e('0x22')]],'as':_0x64087f['as'],'attributes':_0x64087f[_0x692e('0x1e')],'include':_0x64087f[_0x692e('0x20')]?_[_0x692e('0x21')](_0x64087f['include'],function(_0x2891f8){return{'model':db[_0x2891f8[_0x692e('0x22')]],'as':_0x2891f8['as'],'attributes':_0x2891f8[_0x692e('0x1e')],'include':_0x2891f8[_0x692e('0x20')]?_[_0x692e('0x21')](_0x2891f8[_0x692e('0x20')],function(_0x37797f){return{'model':db[_0x37797f[_0x692e('0x22')]],'as':_0x37797f['as'],'attributes':_0x37797f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x533285){logger['info'](_0x692e('0x18'),_0xbfa431);logger[_0x692e('0x11')]('GetVoiceQueueReport',_0xbfa431,JSON['stringify'](_0x533285));_0x249e7d(_0x533285);})[_0x692e('0x17')](function(_0x43adf8){logger[_0x692e('0x13')](_0x692e('0x18'),_0x43adf8[_0x692e('0x15')],_0xbfa431);_0x3c8084(_0x7c1738['error'](0x1f4,_0x43adf8['message']));});});};exports[_0x692e('0x23')]=function(_0x30214b){var _0x5200b4=this;return new Promise(function(_0x5d76dc,_0xaa6bc1){return db[_0x692e('0x19')][_0x692e('0x24')](_0x30214b[_0x692e('0x25')],{'raw':_0x30214b[_0x692e('0x1b')]?_0x30214b[_0x692e('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x586951){logger[_0x692e('0x26')]('CreateVoiceQueueReport',_0x30214b);logger[_0x692e('0x11')](_0x692e('0x23'),_0x30214b,JSON[_0x692e('0x27')](_0x586951));_0x5d76dc(_0x586951);})[_0x692e('0x17')](function(_0x3620a6){logger['error'](_0x692e('0x23'),_0x3620a6[_0x692e('0x15')],_0x30214b);_0xaa6bc1(_0x5200b4['error'](0x1f4,_0x3620a6['message']));});});};exports[_0x692e('0x28')]=function(_0x30ccff){var _0x1e57cb=this;return new Promise(function(_0x27266a,_0x465280){return db[_0x692e('0x19')][_0x692e('0x29')](_0x30ccff[_0x692e('0x25')],{'raw':_0x30ccff[_0x692e('0x1b')]?_0x30ccff[_0x692e('0x1b')][_0x692e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30ccff['options']?_0x30ccff[_0x692e('0x1b')]['where']||null:null,'attributes':_0x30ccff[_0x692e('0x1b')]?_0x30ccff[_0x692e('0x1b')]['attributes']||null:null,'limit':_0x30ccff['options']?_0x30ccff['options'][_0x692e('0x1f')]||null:null})[_0x692e('0x2a')](function(_0x272943){logger[_0x692e('0x26')](_0x692e('0x28'),_0x30ccff);logger['debug'](_0x692e('0x28'),_0x30ccff,JSON['stringify'](_0x272943));_0x27266a(_0x272943);})['catch'](function(_0x4ed2ae){logger[_0x692e('0x13')](_0x692e('0x28'),_0x4ed2ae[_0x692e('0x15')],_0x30ccff);_0x465280(_0x1e57cb[_0x692e('0x13')](0x1f4,_0x4ed2ae['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 38b0c2d..7803d00 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbe7=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4ed88a,_0x2f95cc){var _0x330771=function(_0x3475dd){while(--_0x3475dd){_0x4ed88a['push'](_0x4ed88a['shift']());}};_0x330771(++_0x2f95cc);}(_0xbbe7,0xe2));var _0x7bbe=function(_0x55f6dd,_0x237a55){_0x55f6dd=_0x55f6dd-0x0;var _0xca16f7=_0xbbe7[_0x55f6dd];return _0xca16f7;};'use strict';var VoiceQueueReportEvents=require(_0x7bbe('0x0'));var events=[_0x7bbe('0x1'),_0x7bbe('0x2'),_0x7bbe('0x3')];function createListener(_0x44c304,_0x359b99){return function(_0x461eb6){_0x359b99[_0x7bbe('0x4')](_0x44c304,_0x461eb6);};}function removeListener(_0x294820,_0xfb9177){return function(){VoiceQueueReportEvents[_0x7bbe('0x5')](_0x294820,_0xfb9177);};}exports[_0x7bbe('0x6')]=function(_0x54a7fc){for(var _0x40cdef=0x0,_0x4c01db=events[_0x7bbe('0x7')];_0x40cdef<_0x4c01db;_0x40cdef++){var _0x21809a=events[_0x40cdef];var _0x47ccdc=createListener(_0x7bbe('0x8')+_0x21809a,_0x54a7fc);VoiceQueueReportEvents['on'](_0x21809a,_0x47ccdc);}}; \ No newline at end of file +var _0x39be=['length','voiceQueueReport:','./voiceQueueReport.events','remove','update','emit','register'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x39be,0xe9));var _0xe39b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39be[_0x3b380d];return _0x54502b;};'use strict';var VoiceQueueReportEvents=require(_0xe39b('0x0'));var events=['save',_0xe39b('0x1'),_0xe39b('0x2')];function createListener(_0x398352,_0x5d4c58){return function(_0x22e136){_0x5d4c58[_0xe39b('0x3')](_0x398352,_0x22e136);};}function removeListener(_0x247f9b,_0x93a6f0){return function(){VoiceQueueReportEvents['removeListener'](_0x247f9b,_0x93a6f0);};}exports[_0xe39b('0x4')]=function(_0x3d8b45){for(var _0x284324=0x0,_0xa14e73=events[_0xe39b('0x5')];_0x284324<_0xa14e73;_0x284324++){var _0x9899fa=events[_0x284324];var _0x392086=createListener(_0xe39b('0x6')+_0x9899fa,_0x3d8b45);VoiceQueueReportEvents['on'](_0x9899fa,_0x392086);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 531c633..d4db9c2 100644 --- a/server/api/voiceQueuesLog/index.js +++ b/server/api/voiceQueuesLog/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cfd=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x350ce5,_0x164c03){var _0x3f9ddb=function(_0x1b0ebd){while(--_0x1b0ebd){_0x350ce5['push'](_0x350ce5['shift']());}};_0x3f9ddb(++_0x164c03);}(_0x4cfd,0x170));var _0xd4cf=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x4cfd[_0x1627ae];return _0x34b38f;};'use strict';var multer=require(_0xd4cf('0x0'));var util=require(_0xd4cf('0x1'));var path=require('path');var timeout=require(_0xd4cf('0x2'));var express=require(_0xd4cf('0x3'));var router=express[_0xd4cf('0x4')]();var fs_extra=require(_0xd4cf('0x5'));var auth=require(_0xd4cf('0x6'));var interaction=require(_0xd4cf('0x7'));var config=require('../../config/environment');var controller=require(_0xd4cf('0x8'));router[_0xd4cf('0x9')]('/',auth[_0xd4cf('0xa')](),controller[_0xd4cf('0xb')]);router[_0xd4cf('0x9')](_0xd4cf('0xc'),auth['isAuthenticated'](),controller[_0xd4cf('0xd')]);router[_0xd4cf('0xe')]('/',auth[_0xd4cf('0xa')](),controller[_0xd4cf('0xf')]);router[_0xd4cf('0x10')](_0xd4cf('0xc'),auth[_0xd4cf('0xa')](),controller['update']);router[_0xd4cf('0x11')](_0xd4cf('0xc'),auth[_0xd4cf('0xa')](),controller[_0xd4cf('0x12')]);module[_0xd4cf('0x13')]=router; \ No newline at end of file +var _0xdcfa=['create','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4b8aa8,_0x44d6b8){var _0x1467fe=function(_0x440908){while(--_0x440908){_0x4b8aa8['push'](_0x4b8aa8['shift']());}};_0x1467fe(++_0x44d6b8);}(_0xdcfa,0xad));var _0xadcf=function(_0xa97e74,_0x17c03a){_0xa97e74=_0xa97e74-0x0;var _0x399b97=_0xdcfa[_0xa97e74];return _0x399b97;};'use strict';var multer=require(_0xadcf('0x0'));var util=require('util');var path=require(_0xadcf('0x1'));var timeout=require('connect-timeout');var express=require(_0xadcf('0x2'));var router=express[_0xadcf('0x3')]();var fs_extra=require(_0xadcf('0x4'));var auth=require(_0xadcf('0x5'));var interaction=require(_0xadcf('0x6'));var config=require(_0xadcf('0x7'));var controller=require(_0xadcf('0x8'));router[_0xadcf('0x9')]('/',auth[_0xadcf('0xa')](),controller[_0xadcf('0xb')]);router[_0xadcf('0x9')](_0xadcf('0xc'),auth['isAuthenticated'](),controller[_0xadcf('0xd')]);router['post']('/',auth[_0xadcf('0xa')](),controller[_0xadcf('0xe')]);router['put'](_0xadcf('0xc'),auth['isAuthenticated'](),controller[_0xadcf('0xf')]);router['delete'](_0xadcf('0xc'),auth[_0xadcf('0xa')](),controller['destroy']);module[_0xadcf('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index c2db01a..105c6c4 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65ba=['YYYY-MM-DD\x20HH:mm:ss','exports','STRING','DATE','format'];(function(_0x524b8c,_0x1b4576){var _0x398fad=function(_0x405cb5){while(--_0x405cb5){_0x524b8c['push'](_0x524b8c['shift']());}};_0x398fad(++_0x1b4576);}(_0x65ba,0x1af));var _0xa65b=function(_0x13b796,_0x19507b){_0x13b796=_0x13b796-0x0;var _0x54757d=_0x65ba[_0x13b796];return _0x54757d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xa65b('0x0')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa65b('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa65b('0x2')],'allowNull':![],'defaultValue':moment()[_0xa65b('0x3')](_0xa65b('0x4'))}}; \ No newline at end of file +var _0x98c5=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING','format'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x98c5,0x1c8));var _0x598c=function(_0x15c935,_0x128199){_0x15c935=_0x15c935-0x0;var _0x3fd088=_0x98c5[_0x15c935];return _0x3fd088;};'use strict';var Sequelize=require(_0x598c('0x0'));var moment=require(_0x598c('0x1'));module['exports']={'time':{'type':Sequelize[_0x598c('0x2')]},'callid':{'type':Sequelize[_0x598c('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x598c('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x598c('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x598c('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x598c('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x598c('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x598c('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x598c('0x3')](_0x598c('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c35a5f9..5d9cfa6 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['Content-Range','reject','update','then','destroy','error','stack','name','send','render','merge','contact','agent','account','index','map','VoiceQueuesLog','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x179170,_0x414a7a){var _0x2e0aac=function(_0x32ca3f){while(--_0x32ca3f){_0x179170['push'](_0x179170['shift']());}};_0x2e0aac(++_0x414a7a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0xcb91[_0x4de1b1];return _0x639f27;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}function getMustacheRender(_0x2e28fe,_0xb644b3){return Mustache[_0x1cb9('0x28')](_0x2e28fe,_[_0x1cb9('0x29')](_0xb644b3['body'],{'contact':_0xb644b3[_0x1cb9('0x2a')],'message':_0xb644b3['message'],'agent':_0xb644b3[_0x1cb9('0x2b')],'interaction':_0xb644b3['interaction'],'account':_0xb644b3[_0x1cb9('0x2c')]}))||'';}exports[_0x1cb9('0x2d')]=function(_0x3cd7f5,_0x2038aa){var _0x561d89={},_0x1c701f={},_0x4eba82={'count':0x0,'rows':[]};var _0xe0a0e2=_[_0x1cb9('0x2e')](db[_0x1cb9('0x2f')]['rawAttributes'],function(_0xae4c7a){return{'name':_0xae4c7a['fieldName'],'type':_0xae4c7a[_0x1cb9('0x30')]['key']};});_0x1c701f[_0x1cb9('0x31')]=_[_0x1cb9('0x2e')](_0xe0a0e2,_0x1cb9('0x26'));_0x1c701f[_0x1cb9('0x32')]=_['keys'](_0x3cd7f5[_0x1cb9('0x32')]);_0x1c701f[_0x1cb9('0x33')]=_[_0x1cb9('0x34')](_0x1c701f[_0x1cb9('0x31')],_0x1c701f[_0x1cb9('0x32')]);_0x561d89[_0x1cb9('0x35')]=_[_0x1cb9('0x34')](_0x1c701f[_0x1cb9('0x31')],qs[_0x1cb9('0x36')](_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x36')]));_0x561d89[_0x1cb9('0x35')]=_0x561d89[_0x1cb9('0x35')]['length']?_0x561d89['attributes']:_0x1c701f[_0x1cb9('0x31')];if(!_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x37')](_0x1cb9('0x38'))){_0x561d89[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x1c')]);_0x561d89['offset']=qs[_0x1cb9('0x1a')](_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x1a')]);}_0x561d89['order']=qs[_0x1cb9('0x39')](_0x3cd7f5['query'][_0x1cb9('0x39')]);_0x561d89['where']=qs[_0x1cb9('0x33')](_[_0x1cb9('0x3a')](_0x3cd7f5[_0x1cb9('0x32')],_0x1c701f[_0x1cb9('0x33')]),_0xe0a0e2);if(_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x3b')]){_0x561d89[_0x1cb9('0x3c')]=_['merge'](_0x561d89['where'],{'$or':_[_0x1cb9('0x2e')](_0xe0a0e2,function(_0x1d2723){if(_0x1d2723[_0x1cb9('0x30')]!==_0x1cb9('0x3d')){var _0x109483={};_0x109483[_0x1d2723[_0x1cb9('0x26')]]={'$like':'%'+_0x3cd7f5[_0x1cb9('0x32')]['filter']+'%'};return _0x109483;}})});}_0x561d89=_[_0x1cb9('0x29')]({},_0x561d89,_0x3cd7f5['options']);var _0x576ef2={'where':_0x561d89['where']};return db[_0x1cb9('0x2f')][_0x1cb9('0x1d')](_0x576ef2)[_0x1cb9('0x22')](function(_0x2e3cf3){_0x4eba82[_0x1cb9('0x1d')]=_0x2e3cf3;if(_0x3cd7f5['query'][_0x1cb9('0x3e')]){_0x561d89['include']=[{'all':!![]}];}return db[_0x1cb9('0x2f')][_0x1cb9('0x3f')](_0x561d89);})[_0x1cb9('0x22')](function(_0x5efd83){_0x4eba82[_0x1cb9('0x40')]=_0x5efd83;return _0x4eba82;})['then'](respondWithFilteredResult(_0x2038aa,_0x561d89))[_0x1cb9('0x41')](handleError(_0x2038aa,null));};exports[_0x1cb9('0x42')]=function(_0x51a898,_0x5839aa){var _0x24c643={'raw':!![],'where':{'id':_0x51a898[_0x1cb9('0x43')]['id']}},_0x339829={};_0x339829[_0x1cb9('0x31')]=_[_0x1cb9('0x44')](db['VoiceQueuesLog'][_0x1cb9('0x45')]);_0x339829['query']=_['keys'](_0x51a898['query']);_0x339829[_0x1cb9('0x33')]=_[_0x1cb9('0x34')](_0x339829[_0x1cb9('0x31')],_0x339829[_0x1cb9('0x32')]);_0x24c643[_0x1cb9('0x35')]=_[_0x1cb9('0x34')](_0x339829[_0x1cb9('0x31')],qs[_0x1cb9('0x36')](_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x36')]));_0x24c643[_0x1cb9('0x35')]=_0x24c643['attributes'][_0x1cb9('0x46')]?_0x24c643[_0x1cb9('0x35')]:_0x339829[_0x1cb9('0x31')];if(_0x51a898['query'][_0x1cb9('0x3e')]){_0x24c643[_0x1cb9('0x47')]=[{'all':!![]}];}_0x24c643=_[_0x1cb9('0x29')]({},_0x24c643,_0x51a898[_0x1cb9('0x48')]);return db[_0x1cb9('0x2f')]['find'](_0x24c643)[_0x1cb9('0x22')](handleEntityNotFound(_0x5839aa,null))['then'](respondWithResult(_0x5839aa,null))[_0x1cb9('0x41')](handleError(_0x5839aa,null));};exports['create']=function(_0x1cf2ee,_0x3aed49){return db[_0x1cb9('0x2f')][_0x1cb9('0x49')](_0x1cf2ee['body'],{})[_0x1cb9('0x22')](respondWithResult(_0x3aed49,0xc9))[_0x1cb9('0x41')](handleError(_0x3aed49,null));};exports[_0x1cb9('0x21')]=function(_0x3561a5,_0x21072f){if(_0x3561a5[_0x1cb9('0x4a')]['id']){delete _0x3561a5[_0x1cb9('0x4a')]['id'];}return db[_0x1cb9('0x2f')][_0x1cb9('0x4b')]({'where':{'id':_0x3561a5[_0x1cb9('0x43')]['id']}})['then'](handleEntityNotFound(_0x21072f,null))['then'](saveUpdates(_0x3561a5[_0x1cb9('0x4a')],null))[_0x1cb9('0x22')](respondWithResult(_0x21072f,null))[_0x1cb9('0x41')](handleError(_0x21072f,null));};exports[_0x1cb9('0x23')]=function(_0x20b253,_0x2d076b){return db[_0x1cb9('0x2f')][_0x1cb9('0x4b')]({'where':{'id':_0x20b253[_0x1cb9('0x43')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2d076b,null))['then'](removeEntity(_0x2d076b,null))[_0x1cb9('0x41')](handleError(_0x2d076b,null));}; \ No newline at end of file +var _0x0713=['update','then','destroy','stack','name','send','render','merge','body','contact','interaction','account','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','VoiceQueuesLog','findAll','rows','catch','show','params','includeAll','find','create','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x235175,_0x33c6d3){var _0x5a65c4=function(_0x377e24){while(--_0x377e24){_0x235175['push'](_0x235175['shift']());}};_0x5a65c4(++_0x33c6d3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}function getMustacheRender(_0x25b96b,_0x177b5f){return Mustache[_0x3071('0x2c')](_0x25b96b,_[_0x3071('0x2d')](_0x177b5f[_0x3071('0x2e')],{'contact':_0x177b5f[_0x3071('0x2f')],'message':_0x177b5f['message'],'agent':_0x177b5f['agent'],'interaction':_0x177b5f[_0x3071('0x30')],'account':_0x177b5f[_0x3071('0x31')]}))||'';}exports[_0x3071('0x32')]=function(_0x40be95,_0x3f6d90){var _0x29538c={},_0x32b6b1={},_0x1ccc41={'count':0x0,'rows':[]};var _0x53709a=_['map'](db['VoiceQueuesLog'][_0x3071('0x33')],function(_0x392800){return{'name':_0x392800['fieldName'],'type':_0x392800[_0x3071('0x34')][_0x3071('0x35')]};});_0x32b6b1[_0x3071('0x36')]=_[_0x3071('0x37')](_0x53709a,'name');_0x32b6b1[_0x3071('0x38')]=_[_0x3071('0x39')](_0x40be95[_0x3071('0x38')]);_0x32b6b1[_0x3071('0x3a')]=_[_0x3071('0x3b')](_0x32b6b1[_0x3071('0x36')],_0x32b6b1[_0x3071('0x38')]);_0x29538c[_0x3071('0x3c')]=_['intersection'](_0x32b6b1[_0x3071('0x36')],qs['fields'](_0x40be95['query'][_0x3071('0x3d')]));_0x29538c[_0x3071('0x3c')]=_0x29538c['attributes'][_0x3071('0x3e')]?_0x29538c[_0x3071('0x3c')]:_0x32b6b1[_0x3071('0x36')];if(!_0x40be95[_0x3071('0x38')][_0x3071('0x3f')](_0x3071('0x40'))){_0x29538c['limit']=qs[_0x3071('0x20')](_0x40be95[_0x3071('0x38')]['limit']);_0x29538c[_0x3071('0x1e')]=qs['offset'](_0x40be95[_0x3071('0x38')][_0x3071('0x1e')]);}_0x29538c['order']=qs['sort'](_0x40be95[_0x3071('0x38')][_0x3071('0x41')]);_0x29538c[_0x3071('0x42')]=qs['filters'](_[_0x3071('0x43')](_0x40be95['query'],_0x32b6b1[_0x3071('0x3a')]),_0x53709a);if(_0x40be95['query'][_0x3071('0x44')]){_0x29538c[_0x3071('0x42')]=_[_0x3071('0x2d')](_0x29538c[_0x3071('0x42')],{'$or':_[_0x3071('0x37')](_0x53709a,function(_0x593c9c){if(_0x593c9c['type']!==_0x3071('0x45')){var _0x17f9e6={};_0x17f9e6[_0x593c9c[_0x3071('0x2a')]]={'$like':'%'+_0x40be95[_0x3071('0x38')]['filter']+'%'};return _0x17f9e6;}})});}_0x29538c=_[_0x3071('0x2d')]({},_0x29538c,_0x40be95[_0x3071('0x46')]);var _0x3abcd8={'where':_0x29538c[_0x3071('0x42')]};return db[_0x3071('0x47')][_0x3071('0x21')](_0x3abcd8)['then'](function(_0x35a50d){_0x1ccc41['count']=_0x35a50d;if(_0x40be95['query']['includeAll']){_0x29538c['include']=[{'all':!![]}];}return db[_0x3071('0x47')][_0x3071('0x48')](_0x29538c);})[_0x3071('0x27')](function(_0xbb5c8d){_0x1ccc41[_0x3071('0x49')]=_0xbb5c8d;return _0x1ccc41;})[_0x3071('0x27')](respondWithFilteredResult(_0x3f6d90,_0x29538c))[_0x3071('0x4a')](handleError(_0x3f6d90,null));};exports[_0x3071('0x4b')]=function(_0x56589e,_0x1e8222){var _0x1641d9={'raw':!![],'where':{'id':_0x56589e[_0x3071('0x4c')]['id']}},_0x44a879={};_0x44a879[_0x3071('0x36')]=_['keys'](db['VoiceQueuesLog'][_0x3071('0x33')]);_0x44a879[_0x3071('0x38')]=_[_0x3071('0x39')](_0x56589e[_0x3071('0x38')]);_0x44a879[_0x3071('0x3a')]=_['intersection'](_0x44a879[_0x3071('0x36')],_0x44a879['query']);_0x1641d9[_0x3071('0x3c')]=_['intersection'](_0x44a879['model'],qs[_0x3071('0x3d')](_0x56589e['query'][_0x3071('0x3d')]));_0x1641d9['attributes']=_0x1641d9[_0x3071('0x3c')][_0x3071('0x3e')]?_0x1641d9[_0x3071('0x3c')]:_0x44a879[_0x3071('0x36')];if(_0x56589e['query'][_0x3071('0x4d')]){_0x1641d9['include']=[{'all':!![]}];}_0x1641d9=_[_0x3071('0x2d')]({},_0x1641d9,_0x56589e['options']);return db[_0x3071('0x47')][_0x3071('0x4e')](_0x1641d9)['then'](handleEntityNotFound(_0x1e8222,null))[_0x3071('0x27')](respondWithResult(_0x1e8222,null))[_0x3071('0x4a')](handleError(_0x1e8222,null));};exports[_0x3071('0x4f')]=function(_0x38bcc2,_0x349adb){return db[_0x3071('0x47')][_0x3071('0x4f')](_0x38bcc2['body'],{})[_0x3071('0x27')](respondWithResult(_0x349adb,0xc9))[_0x3071('0x4a')](handleError(_0x349adb,null));};exports[_0x3071('0x26')]=function(_0xda07a4,_0x4f676e){if(_0xda07a4[_0x3071('0x2e')]['id']){delete _0xda07a4[_0x3071('0x2e')]['id'];}return db[_0x3071('0x47')][_0x3071('0x4e')]({'where':{'id':_0xda07a4[_0x3071('0x4c')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x4f676e,null))[_0x3071('0x27')](saveUpdates(_0xda07a4[_0x3071('0x2e')],null))[_0x3071('0x27')](respondWithResult(_0x4f676e,null))[_0x3071('0x4a')](handleError(_0x4f676e,null));};exports[_0x3071('0x28')]=function(_0x111115,_0x24977b){return db[_0x3071('0x47')][_0x3071('0x4e')]({'where':{'id':_0x111115[_0x3071('0x4c')]['id']}})['then'](handleEntityNotFound(_0x24977b,null))['then'](removeEntity(_0x24977b,null))[_0x3071('0x4a')](handleError(_0x24977b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f94a44f..8253b93 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e4=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x98e07c,_0x264cc2){var _0x47a38a=function(_0x64ec74){while(--_0x64ec74){_0x98e07c['push'](_0x98e07c['shift']());}};_0x47a38a(++_0x264cc2);}(_0x70e4,0x192));var _0x470e=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x70e4[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var logger=require(_0x470e('0x2'))(_0x470e('0x3'));var moment=require('moment');var BPromise=require(_0x470e('0x4'));var rp=require(_0x470e('0x5'));var fs=require('fs');var path=require(_0x470e('0x6'));var rimraf=require(_0x470e('0x7'));var config=require(_0x470e('0x8'));var attributes=require(_0x470e('0x9'));module['exports']=function(_0x2dcd36,_0x22e7c2){return _0x2dcd36['define'](_0x470e('0xa'),attributes,{'tableName':_0x470e('0xb'),'paranoid':![],'indexes':[{'name':_0x470e('0xc'),'fields':[_0x470e('0xd'),_0x470e('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd5e7=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x4896e1,_0x43e8f2){var _0x22c4cd=function(_0x1bd799){while(--_0x1bd799){_0x4896e1['push'](_0x4896e1['shift']());}};_0x22c4cd(++_0x43e8f2);}(_0xd5e7,0xfe));var _0x7d5e=function(_0x15b1be,_0x48c267){_0x15b1be=_0x15b1be-0x0;var _0x57b763=_0xd5e7[_0x15b1be];return _0x57b763;};'use strict';var _=require(_0x7d5e('0x0'));var util=require(_0x7d5e('0x1'));var logger=require(_0x7d5e('0x2'))(_0x7d5e('0x3'));var moment=require(_0x7d5e('0x4'));var BPromise=require('bluebird');var rp=require(_0x7d5e('0x5'));var fs=require('fs');var path=require(_0x7d5e('0x6'));var rimraf=require(_0x7d5e('0x7'));var config=require(_0x7d5e('0x8'));var attributes=require(_0x7d5e('0x9'));module[_0x7d5e('0xa')]=function(_0x408862,_0x552ecc){return _0x408862[_0x7d5e('0xb')](_0x7d5e('0xc'),attributes,{'tableName':_0x7d5e('0xd'),'paranoid':![],'indexes':[{'name':_0x7d5e('0xe'),'fields':[_0x7d5e('0xf'),_0x7d5e('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d66f386..786de2f 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23a3=['stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x4a47f4,_0x530f79){var _0x28f77e=function(_0x251522){while(--_0x251522){_0x4a47f4['push'](_0x4a47f4['shift']());}};_0x28f77e(++_0x530f79);}(_0x23a3,0x131));var _0x323a=function(_0x23461e,_0x1aadf0){_0x23461e=_0x23461e-0x0;var _0x5133ec=_0x23a3[_0x23461e];return _0x5133ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});} \ No newline at end of file +var _0xfef3=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfef3,0x118));var _0x3fef=function(_0x1af420,_0x4ad7c5){_0x1af420=_0x1af420-0x0;var _0x572d5f=_0xfef3[_0x1af420];return _0x572d5f;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7ddfca7..ffd2f2d 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b5a=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5b5a,0xb0));var _0xa5b5=function(_0x5e7634,_0x5356a1){_0x5e7634=_0x5e7634-0x0;var _0x563eb3=_0x5b5a[_0x5e7634];return _0x563eb3;};'use strict';var multer=require(_0xa5b5('0x0'));var util=require(_0xa5b5('0x1'));var path=require(_0xa5b5('0x2'));var timeout=require(_0xa5b5('0x3'));var express=require(_0xa5b5('0x4'));var router=express[_0xa5b5('0x5')]();var fs_extra=require(_0xa5b5('0x6'));var auth=require(_0xa5b5('0x7'));var interaction=require(_0xa5b5('0x8'));var config=require('../../config/environment');var controller=require(_0xa5b5('0x9'));router[_0xa5b5('0xa')]('/',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0xc')]);router[_0xa5b5('0xa')](_0xa5b5('0xd'),auth['isAuthenticated'](),controller[_0xa5b5('0xe')]);router['get'](_0xa5b5('0xf'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x10')]);router[_0xa5b5('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xa5b5('0x11')]);router[_0xa5b5('0xa')](_0xa5b5('0x12'),controller[_0xa5b5('0x13')]);router[_0xa5b5('0xa')]('/:id/transcribe',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x14')]);router[_0xa5b5('0x15')]('/',auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x16')]);router[_0xa5b5('0x15')](_0xa5b5('0x17'),auth[_0xa5b5('0xb')](),controller[_0xa5b5('0x18')]);router['put'](_0xa5b5('0xf'),auth[_0xa5b5('0xb')](),controller['update']);router['delete'](_0xa5b5('0xf'),auth['isAuthenticated'](),controller[_0xa5b5('0x19')]);module['exports']=router; \ No newline at end of file +var _0xac07=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xac07,0xf7));var _0x7ac0=function(_0x557835,_0x2d699b){_0x557835=_0x557835-0x0;var _0xf5fe83=_0xac07[_0x557835];return _0xf5fe83;};'use strict';var multer=require(_0x7ac0('0x0'));var util=require(_0x7ac0('0x1'));var path=require(_0x7ac0('0x2'));var timeout=require(_0x7ac0('0x3'));var express=require(_0x7ac0('0x4'));var router=express[_0x7ac0('0x5')]();var fs_extra=require(_0x7ac0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7ac0('0x7'));var config=require(_0x7ac0('0x8'));var controller=require('./voiceRecording.controller');router[_0x7ac0('0x9')]('/',auth[_0x7ac0('0xa')](),controller[_0x7ac0('0xb')]);router['get'](_0x7ac0('0xc'),auth[_0x7ac0('0xa')](),controller[_0x7ac0('0xd')]);router[_0x7ac0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7ac0('0x9')]('/:id/download',auth[_0x7ac0('0xa')](),controller[_0x7ac0('0xe')]);router[_0x7ac0('0x9')](_0x7ac0('0xf'),controller[_0x7ac0('0x10')]);router[_0x7ac0('0x9')](_0x7ac0('0x11'),auth[_0x7ac0('0xa')](),controller[_0x7ac0('0x12')]);router[_0x7ac0('0x13')]('/',auth[_0x7ac0('0xa')](),controller[_0x7ac0('0x14')]);router[_0x7ac0('0x13')](_0x7ac0('0x11'),auth[_0x7ac0('0xa')](),controller[_0x7ac0('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7ac0('0x16')]);router[_0x7ac0('0x17')](_0x7ac0('0x18'),auth[_0x7ac0('0xa')](),controller[_0x7ac0('0x19')]);module[_0x7ac0('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a9198ef..7cf5239 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd60d=['channel','setDataValue','membername','INTEGER','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING'];(function(_0x53f6af,_0x3a5634){var _0x17cf93=function(_0x4fa33e){while(--_0x4fa33e){_0x53f6af['push'](_0x53f6af['shift']());}};_0x17cf93(++_0x3a5634);}(_0xd60d,0x19c));var _0xdd60=function(_0x3e5250,_0x40be21){_0x3e5250=_0x3e5250-0x0;var _0x3ed819=_0xd60d[_0x3e5250];return _0x3ed819;};'use strict';var Sequelize=require(_0xdd60('0x0'));var moment=require(_0xdd60('0x1'));var path=require(_0xdd60('0x2'));module['exports']={'format':{'type':Sequelize[_0xdd60('0x3')],'get':function(){return this[_0xdd60('0x4')](_0xdd60('0x5'))?path[_0xdd60('0x6')](this[_0xdd60('0x4')](_0xdd60('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xdd60('0x7')]},'channel':{'type':Sequelize[_0xdd60('0x7')],'set':function(_0x21dbf5){if(_0x21dbf5){this['setDataValue'](_0xdd60('0x8'),_0x21dbf5);this[_0xdd60('0x9')](_0xdd60('0xa'),_0x21dbf5['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdd60('0x7')]},'calleridname':{'type':Sequelize[_0xdd60('0x7')]},'connectedlinenum':{'type':Sequelize[_0xdd60('0x7')]},'connectedlinename':{'type':Sequelize[_0xdd60('0x7')]},'accountcode':{'type':Sequelize[_0xdd60('0x7')]},'context':{'type':Sequelize[_0xdd60('0x7')]},'exten':{'type':Sequelize[_0xdd60('0x7')]},'value':{'type':Sequelize[_0xdd60('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xdd60('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xdd60('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xdd60('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xdd60('0x7')]},'transcribeStatus':{'type':Sequelize[_0xdd60('0x7')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0xdd60('0x7')]},'sPositive':{'type':Sequelize[_0xdd60('0xc')]},'sNegative':{'type':Sequelize[_0xdd60('0xc')]},'sNeutral':{'type':Sequelize[_0xdd60('0xc')]},'sMixed':{'type':Sequelize[_0xdd60('0xc')]},'tempSentiment':{'type':Sequelize[_0xdd60('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xdd60('0xe')],'get':function(){return moment(this[_0xdd60('0x4')](_0xdd60('0xf')))[_0xdd60('0x10')](_0xdd60('0x11'))[_0xdd60('0x12')]();}},'updatedAt':{'type':Sequelize[_0xdd60('0xe')],'get':function(){return moment(this[_0xdd60('0x4')](_0xdd60('0x13')))['format'](_0xdd60('0x11'))['toString']();}}}; \ No newline at end of file +var _0x1d15=['getDataValue','value','extname','STRING','setDataValue','membername','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','exports','VIRTUAL'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x1d15,0x1b3));var _0x51d1=function(_0x198b9b,_0x16334c){_0x198b9b=_0x198b9b-0x0;var _0x6b642e=_0x1d15[_0x198b9b];return _0x6b642e;};'use strict';var Sequelize=require(_0x51d1('0x0'));var moment=require(_0x51d1('0x1'));var path=require(_0x51d1('0x2'));module[_0x51d1('0x3')]={'format':{'type':Sequelize[_0x51d1('0x4')],'get':function(){return this[_0x51d1('0x5')](_0x51d1('0x6'))?path[_0x51d1('0x7')](this[_0x51d1('0x5')](_0x51d1('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x51d1('0x8')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x3fa25e){if(_0x3fa25e){this[_0x51d1('0x9')]('channel',_0x3fa25e);this['setDataValue'](_0x51d1('0xa'),_0x3fa25e['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x51d1('0x8')]},'calleridnum':{'type':Sequelize[_0x51d1('0x8')]},'calleridname':{'type':Sequelize[_0x51d1('0x8')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x51d1('0x8')]},'accountcode':{'type':Sequelize[_0x51d1('0x8')]},'context':{'type':Sequelize[_0x51d1('0x8')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x51d1('0x8')]},'type':{'type':Sequelize[_0x51d1('0x8')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x51d1('0x8')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x51d1('0x8')]},'location':{'type':Sequelize[_0x51d1('0xb')]},'transcribeName':{'type':Sequelize[_0x51d1('0x8')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0x51d1('0xc')},'fileUri':{'type':Sequelize[_0x51d1('0xb')]},'fileText':{'type':Sequelize[_0x51d1('0xb')]},'failureReason':{'type':Sequelize[_0x51d1('0xb')]},'sentiment':{'type':Sequelize[_0x51d1('0x8')]},'sPositive':{'type':Sequelize[_0x51d1('0xd')]},'sNegative':{'type':Sequelize[_0x51d1('0xd')]},'sNeutral':{'type':Sequelize[_0x51d1('0xd')]},'sMixed':{'type':Sequelize[_0x51d1('0xd')]},'tempSentiment':{'type':Sequelize[_0x51d1('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x51d1('0xf')],'get':function(){return moment(this[_0x51d1('0x5')](_0x51d1('0x10')))[_0x51d1('0x11')](_0x51d1('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x51d1('0xf')],'get':function(){return moment(this[_0x51d1('0x5')]('updatedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x51d1('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 19b6f4e..4dfa78b 100644 --- a/server/api/voiceRecording/voiceRecording.controller.js +++ b/server/api/voiceRecording/voiceRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c10=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','count','offset','reject','then','error','stack','name','send','merge','body','contact','message','agent','account','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','update','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','destroy','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','mustache'];(function(_0x53c6b8,_0x4fa61f){var _0x165415=function(_0x402d88){while(--_0x402d88){_0x53c6b8['push'](_0x53c6b8['shift']());}};_0x165415(++_0x4fa61f);}(_0x1c10,0x1c5));var _0x01c1=function(_0x1a62a2,_0xecce5b){_0x1a62a2=_0x1a62a2-0x0;var _0x4cfd26=_0x1c10[_0x1a62a2];return _0x4cfd26;};'use strict';var emlformat=require(_0x01c1('0x0'));var rimraf=require(_0x01c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x01c1('0x2'));var util=require('util');var path=require(_0x01c1('0x3'));var sox=require(_0x01c1('0x4'));var csv=require(_0x01c1('0x5'));var ejs=require(_0x01c1('0x6'));var fs=require('fs');var fs_extra=require(_0x01c1('0x7'));var _=require('lodash');var squel=require(_0x01c1('0x8'));var crypto=require(_0x01c1('0x9'));var jsforce=require(_0x01c1('0xa'));var deskjs=require(_0x01c1('0xb'));var toCsv=require(_0x01c1('0x5'));var querystring=require(_0x01c1('0xc'));var Papa=require(_0x01c1('0xd'));var AWS=require(_0x01c1('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0x01c1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x01c1('0x10'));var as=require(_0x01c1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01c1('0x12'))(_0x01c1('0x13'));var utils=require(_0x01c1('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4ccd,_0x2ad8c2){_0x2ad8c2=_0x2ad8c2||0xcc;return function(_0x373c9b){if(_0x373c9b){return _0x5d4ccd[_0x01c1('0x15')](_0x2ad8c2);}return _0x5d4ccd[_0x01c1('0x16')](_0x2ad8c2)[_0x01c1('0x17')]();};}function respondWithResult(_0x2c70e7,_0x5089af){_0x5089af=_0x5089af||0xc8;return function(_0x28ff2e){if(_0x28ff2e){return _0x2c70e7[_0x01c1('0x16')](_0x5089af)[_0x01c1('0x18')](_0x28ff2e);}};}function respondWithFilteredResult(_0x289d54,_0x208dc9){return function(_0x30ff04){if(_0x30ff04){var _0x5bc88d=typeof _0x208dc9['offset']===_0x01c1('0x19')&&typeof _0x208dc9['limit']===_0x01c1('0x19');var _0xb69794=_0x30ff04[_0x01c1('0x1a')];var _0x2f5231=_0x5bc88d?0x0:_0x208dc9[_0x01c1('0x1b')];var _0x95c648=_0x5bc88d?_0x30ff04[_0x01c1('0x1a')]:_0x208dc9['offset']+_0x208dc9['limit'];var _0x30d35f;if(_0x95c648>=_0xb69794){_0x95c648=_0xb69794;_0x30d35f=0xc8;}else{_0x30d35f=0xce;}_0x289d54[_0x01c1('0x16')](_0x30d35f);return _0x289d54['set']('Content-Range',_0x2f5231+'-'+_0x95c648+'/'+_0xb69794)[_0x01c1('0x18')](_0x30ff04);}return null;};}function patchUpdates(_0x2e92c5){return function(_0x5be555){try{jsonpatch['apply'](_0x5be555,_0x2e92c5,!![]);}catch(_0x2fc93e){return BPromise[_0x01c1('0x1c')](_0x2fc93e);}return _0x5be555['save']();};}function saveUpdates(_0x4694ad,_0x38b984){return function(_0x29ab57){if(_0x29ab57){return _0x29ab57['update'](_0x4694ad)[_0x01c1('0x1d')](function(_0x553178){return _0x553178;});}return null;};}function removeEntity(_0x5c9da7,_0x59e5b5){return function(_0x54a7c4){if(_0x54a7c4){return _0x54a7c4['destroy']()['then'](function(){_0x5c9da7[_0x01c1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da72d,_0x58b127){return function(_0x550ece){if(!_0x550ece){_0x4da72d['sendStatus'](0x194);}return _0x550ece;};}function handleError(_0x24e6cf,_0x21085a){_0x21085a=_0x21085a||0x1f4;return function(_0x306b4a){logger[_0x01c1('0x1e')](_0x306b4a[_0x01c1('0x1f')]);if(_0x306b4a[_0x01c1('0x20')]){delete _0x306b4a[_0x01c1('0x20')];}_0x24e6cf[_0x01c1('0x16')](_0x21085a)[_0x01c1('0x21')](_0x306b4a);};}function getMustacheRender(_0x33de8c,_0x167f46){return Mustache['render'](_0x33de8c,_[_0x01c1('0x22')](_0x167f46[_0x01c1('0x23')],{'contact':_0x167f46[_0x01c1('0x24')],'message':_0x167f46[_0x01c1('0x25')],'agent':_0x167f46[_0x01c1('0x26')],'interaction':_0x167f46['interaction'],'account':_0x167f46[_0x01c1('0x27')]}))||'';}exports[_0x01c1('0x28')]=function(_0x418fe1,_0x167a4d){var _0x3ca9e9={},_0x4a016e={},_0x8cca1b={'count':0x0,'rows':[]};var _0x14546d=_[_0x01c1('0x29')](db[_0x01c1('0x2a')][_0x01c1('0x2b')],function(_0x4953a5){return{'name':_0x4953a5[_0x01c1('0x2c')],'type':_0x4953a5[_0x01c1('0x2d')][_0x01c1('0x2e')]};});_0x4a016e['model']=_['differenceBy'](_[_0x01c1('0x29')](_0x14546d,_0x01c1('0x20')),[_0x01c1('0x2f')]);_0x4a016e['query']=_['keys'](_0x418fe1[_0x01c1('0x30')]);_0x4a016e[_0x01c1('0x31')]=_[_0x01c1('0x32')](_0x4a016e[_0x01c1('0x33')],_0x4a016e[_0x01c1('0x30')]);_0x3ca9e9[_0x01c1('0x34')]=_[_0x01c1('0x32')](_0x4a016e[_0x01c1('0x33')],qs[_0x01c1('0x35')](_0x418fe1[_0x01c1('0x30')][_0x01c1('0x35')]));_0x3ca9e9[_0x01c1('0x34')]=_0x3ca9e9[_0x01c1('0x34')][_0x01c1('0x36')]?_0x3ca9e9[_0x01c1('0x34')]:_0x4a016e[_0x01c1('0x33')];if(!_0x418fe1['query'][_0x01c1('0x37')](_0x01c1('0x38'))){_0x3ca9e9[_0x01c1('0x39')]=qs['limit'](_0x418fe1[_0x01c1('0x30')]['limit']);_0x3ca9e9['offset']=qs[_0x01c1('0x1b')](_0x418fe1[_0x01c1('0x30')][_0x01c1('0x1b')]);}_0x3ca9e9['order']=qs[_0x01c1('0x3a')](_0x418fe1[_0x01c1('0x30')][_0x01c1('0x3a')]);_0x3ca9e9[_0x01c1('0x3b')]=qs['filters'](_[_0x01c1('0x3c')](_0x418fe1[_0x01c1('0x30')],_0x4a016e[_0x01c1('0x31')]),_0x14546d);if(_0x418fe1[_0x01c1('0x30')][_0x01c1('0x3d')]){_0x3ca9e9[_0x01c1('0x3b')]=_[_0x01c1('0x22')](_0x3ca9e9[_0x01c1('0x3b')],{'$or':_[_0x01c1('0x29')](_0x14546d,function(_0x5e0dfe){if(_0x5e0dfe[_0x01c1('0x2d')]!==_0x01c1('0x3e')){var _0x1415af={};_0x1415af[_0x5e0dfe[_0x01c1('0x20')]]={'$like':'%'+_0x418fe1['query'][_0x01c1('0x3d')]+'%'};return _0x1415af;}})});}_0x3ca9e9=_[_0x01c1('0x22')]({},_0x3ca9e9,_0x418fe1[_0x01c1('0x3f')]);var _0x20586f={'where':_0x3ca9e9[_0x01c1('0x3b')]};return db['VoiceRecording'][_0x01c1('0x1a')](_0x20586f)[_0x01c1('0x1d')](function(_0x2c4bb7){_0x8cca1b[_0x01c1('0x1a')]=_0x2c4bb7;if(_0x418fe1[_0x01c1('0x30')][_0x01c1('0x40')]){_0x3ca9e9[_0x01c1('0x41')]=[{'all':!![]}];}return db[_0x01c1('0x2a')][_0x01c1('0x42')](_0x3ca9e9);})['then'](function(_0x521665){_0x8cca1b[_0x01c1('0x43')]=_0x521665;return _0x8cca1b;})[_0x01c1('0x1d')](respondWithFilteredResult(_0x167a4d,_0x3ca9e9))[_0x01c1('0x44')](handleError(_0x167a4d,null));};exports[_0x01c1('0x45')]=function(_0x5e8480,_0x25c3e0){var _0x2fd9f1={'raw':![],'where':{'id':_0x5e8480[_0x01c1('0x46')]['id']}},_0x100499={};_0x100499['model']=_[_0x01c1('0x47')](db[_0x01c1('0x2a')]['rawAttributes']);_0x100499[_0x01c1('0x30')]=_[_0x01c1('0x47')](_0x5e8480[_0x01c1('0x30')]);_0x100499['filters']=_[_0x01c1('0x32')](_0x100499['model'],_0x100499[_0x01c1('0x30')]);_0x2fd9f1[_0x01c1('0x34')]=_[_0x01c1('0x32')](_0x100499[_0x01c1('0x33')],qs[_0x01c1('0x35')](_0x5e8480[_0x01c1('0x30')][_0x01c1('0x35')]));_0x2fd9f1[_0x01c1('0x34')]=_0x2fd9f1[_0x01c1('0x34')]['length']?_0x2fd9f1['attributes']:_0x100499[_0x01c1('0x33')];if(_0x5e8480[_0x01c1('0x30')]['includeAll']){_0x2fd9f1[_0x01c1('0x41')]=[{'all':!![]}];}_0x2fd9f1=_['merge']({},_0x2fd9f1,_0x5e8480['options']);return db[_0x01c1('0x2a')]['find'](_0x2fd9f1)['then'](handleEntityNotFound(_0x25c3e0,null))[_0x01c1('0x1d')](respondWithResult(_0x25c3e0,null))['catch'](handleError(_0x25c3e0,null));};exports['create']=function(_0x7f824,_0x6627a8){return db[_0x01c1('0x2a')][_0x01c1('0x48')](_0x7f824['body'],{})[_0x01c1('0x1d')](respondWithResult(_0x6627a8,0xc9))['catch'](handleError(_0x6627a8,null));};exports[_0x01c1('0x49')]=function(_0x52b12d,_0x5142c2){if(_0x52b12d[_0x01c1('0x23')]['id']){delete _0x52b12d[_0x01c1('0x23')]['id'];}return db['VoiceRecording'][_0x01c1('0x4a')]({'where':{'id':_0x52b12d[_0x01c1('0x46')]['id']}})[_0x01c1('0x1d')](handleEntityNotFound(_0x5142c2,null))[_0x01c1('0x1d')](saveUpdates(_0x52b12d['body'],null))[_0x01c1('0x1d')](respondWithResult(_0x5142c2,null))[_0x01c1('0x44')](handleError(_0x5142c2,null));};exports['describe']=function(_0x44dd32,_0x345766){return db[_0x01c1('0x2a')][_0x01c1('0x4b')]()[_0x01c1('0x1d')](respondWithResult(_0x345766,null))[_0x01c1('0x44')](handleError(_0x345766,null));};exports[_0x01c1('0x4c')]=function(_0x3da1f7,_0x48b6d9,_0x30c738){var _0x446a08=require(_0x01c1('0x4d'));var _0x15e2e5=![];var _0x4d2997={};if(_0x3da1f7['query']['type']&&_0x3da1f7[_0x01c1('0x30')][_0x01c1('0x2d')]===_0x01c1('0x4e')){_0x4d2997['uniqueid']=_0x3da1f7['params']['id'];}else{_0x4d2997['id']=_0x3da1f7[_0x01c1('0x46')]['id'];}return db[_0x01c1('0x2a')][_0x01c1('0x4a')]({'where':_0x4d2997,'attributes':['id','value'],'raw':!![]})[_0x01c1('0x1d')](handleEntityNotFound(_0x48b6d9,null))[_0x01c1('0x1d')](function(_0x1f20f4){if(_0x1f20f4){var _0x366802=_0x1f20f4[_0x01c1('0x4f')];var _0x5e3c86=util[_0x01c1('0x2f')](_0x01c1('0x50'),_0x366802);if(fs[_0x01c1('0x51')](_0x5e3c86)){_0x15e2e5=!![];return _0x446a08[_0x01c1('0x52')](_0x5e3c86,_0x366802,config[_0x01c1('0x53')][_0x01c1('0x54')])['then'](function(){return _0x1f20f4;});}return _0x1f20f4;}})[_0x01c1('0x1d')](function(_0x2a99d3){if(_0x2a99d3){var _0x5619fd=_0x2a99d3[_0x01c1('0x4f')];if(!fs[_0x01c1('0x51')](_0x5619fd)){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x2a99d3['filename']){return _0x48b6d9[_0x01c1('0x4c')](_0x5619fd,_0x2a99d3[_0x01c1('0x57')]+path[_0x01c1('0x58')](_0x5619fd),function(){if(_0x15e2e5){fs[_0x01c1('0x59')](_0x5619fd);}});}else{return _0x48b6d9[_0x01c1('0x4c')](_0x5619fd,function(_0x5aa41f){if(_0x15e2e5){fs[_0x01c1('0x59')](_0x5619fd);}});}}})[_0x01c1('0x44')](function(_0xc73c8e){if(_0xc73c8e[_0x01c1('0x25')]===_0x01c1('0x5a')){_0x48b6d9['status'](0x194)['send'](_0x01c1('0x5b'));}else{return handleError(_0x48b6d9,null);}});};exports[_0x01c1('0x5c')]=function(_0x2173cb,_0x3bbd75,_0x197b9){var _0x5784ae=require(_0x01c1('0x4d'));var _0x96a3b3=![];var _0x3b1a1f={'$and':[db[_0x01c1('0x5d')][_0x01c1('0x3b')](db[_0x01c1('0x5d')]['fn'](_0x01c1('0x5e'),db[_0x01c1('0x5d')]['col'](_0x01c1('0x4e'))),_0x2173cb['query'][_0x01c1('0x5f')])]};if(_0x2173cb[_0x01c1('0x30')]['type']&&_0x2173cb['query']['type']===_0x01c1('0x4e')){_0x3b1a1f[_0x01c1('0x60')][_0x01c1('0x61')]({'uniqueid':_0x2173cb[_0x01c1('0x46')]['id']});}else{_0x3b1a1f['$and'][_0x01c1('0x61')]({'id':_0x2173cb['params']['id']});}return db[_0x01c1('0x2a')]['find']({'where':_0x3b1a1f,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3bbd75,null))[_0x01c1('0x1d')](function(_0x5354c2){if(_0x5354c2){var _0x502405=util[_0x01c1('0x2f')](_0x01c1('0x50'),_0x5354c2[_0x01c1('0x4f')]);if(fs[_0x01c1('0x51')](_0x502405)){_0x96a3b3=!![];return _0x5784ae[_0x01c1('0x52')](_0x502405,_0x5354c2[_0x01c1('0x4f')],config[_0x01c1('0x53')][_0x01c1('0x54')])['then'](function(){return _0x5354c2;});}return _0x5354c2;}})[_0x01c1('0x1d')](function(_0x1defc5){if(_0x1defc5){if(!fs[_0x01c1('0x51')](_0x1defc5[_0x01c1('0x4f')])){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))](_0x01c1('0x5a'));}if(_0x1defc5[_0x01c1('0x57')]){return _0x3bbd75[_0x01c1('0x4c')](_0x1defc5[_0x01c1('0x4f')],_0x1defc5[_0x01c1('0x57')]+path['extname'](_0x1defc5[_0x01c1('0x4f')]),function(){if(_0x96a3b3){fs[_0x01c1('0x59')](_0x1defc5[_0x01c1('0x4f')]);}});}else{return _0x3bbd75[_0x01c1('0x4c')](_0x1defc5['value'],function(_0x306a19){if(_0x96a3b3){fs['unlink'](_0x1defc5['value']);}});}}})['catch'](handleError(_0x3bbd75,null));};exports['destroy']=function(_0x36d354,_0x4fe6f2){return db[_0x01c1('0x2a')]['find']({'where':{'id':_0x36d354['params']['id']}})['then'](function(_0x18726a){if(_[_0x01c1('0x62')](_0x18726a)){throw new ReferenceError(_0x01c1('0x63'));}return _0x18726a;})[_0x01c1('0x1d')](function(_0x3aa2e2){var _0x5b2692=_0x3aa2e2[_0x01c1('0x4f')];logger[_0x01c1('0x64')](_0x01c1('0x65'),_0x5b2692);if(!_[_0x01c1('0x62')](_0x3aa2e2[_0x01c1('0x4f')])&&fs[_0x01c1('0x51')](_0x5b2692)){logger['info'](_0x01c1('0x66')+_0x5b2692+_0x01c1('0x67'));fs[_0x01c1('0x68')](_0x5b2692);}_0x5b2692=_0x5b2692+_0x01c1('0x69');if(!_[_0x01c1('0x62')](_0x3aa2e2[_0x01c1('0x4f')])&&fs['existsSync'](_0x5b2692)){logger['info'](_0x01c1('0x66')+_0x5b2692+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x01c1('0x68')](_0x5b2692);}return _0x3aa2e2;})['then'](function(_0x38e736){if(!_0x38e736)throw new InternalError();return _0x38e736[_0x01c1('0x6a')]();})[_0x01c1('0x1d')](function(){_0x4fe6f2[_0x01c1('0x16')](0xcc)[_0x01c1('0x17')]();})[_0x01c1('0x44')](handleError(_0x4fe6f2,null));};function getBucketslist(_0x1c745e,_0x928328,_0x355780){return new Promise(function(_0x30a80f,_0x517223){var _0x5aec5f=new AWS['S3']({'accessKeyId':_0x928328,'secretAccessKey':_0x1c745e,'region':_0x355780});_0x5aec5f['listBuckets']({},function(_0x519e88,_0x26938a){if(_0x519e88){return _0x517223(_0x519e88);}else{return _0x30a80f(_0x26938a);}});});}function createBucket(_0x4a659e,_0x50d73d,_0x2adb46,_0x11820e){return new Promise(function(_0x477d6,_0x202e97){var _0x41acba=new AWS['S3']({'accessKeyId':_0x50d73d,'secretAccessKey':_0x4a659e,'region':_0x2adb46});_0x41acba[_0x01c1('0x6b')]({'Bucket':_0x11820e},function(_0x642b33,_0x23e68d){if(_0x642b33){return _0x202e97(_0x642b33);}else{return _0x477d6(_0x23e68d);}});});}function uploadFile(_0x14572d,_0x166946,_0x2c4c3a,_0x86e6c4,_0xa47023,_0xef6250){return new Promise(function(_0x59c2a7,_0x42ae17){var _0x4637a9=new AWS['S3']({'accessKeyId':_0x166946,'secretAccessKey':_0x14572d,'region':_0x2c4c3a});_0x4637a9[_0x01c1('0x6c')]({'Bucket':_0x86e6c4,'Key':_0xa47023,'Body':_0xef6250},function(_0x433573,_0x4b4451){if(_0x433573){return _0x42ae17(_0x433573);}else{return _0x59c2a7(_0x4b4451);}});});}function startTranscribe(_0x393ab5,_0x5a101b,_0xa1d534,_0x598c02,_0x2bdcaa,_0x149a30){return new Promise(function(_0x4f4e61,_0x4f66c7){var _0x4c9e66=new AWS[(_0x01c1('0x6d'))]({'accessKeyId':_0x5a101b,'secretAccessKey':_0x393ab5,'region':_0xa1d534});_0x4c9e66[_0x01c1('0x6e')]({'TranscriptionJobName':_0x598c02,'LanguageCode':_0x2bdcaa,'Media':{'MediaFileUri':_0x149a30}},function(_0x21d525,_0x39a602){if(_0x21d525){return _0x4f66c7(_0x21d525);}else{return _0x4f4e61(_0x39a602);}});});}function transcribe(_0xabe395,_0x162a98,_0x2db27f,_0x435143,_0x422a6e,_0x36b1a6,_0xf44efc){return new Promise(function(_0x4468e7,_0x2b4274){var _0x54c8f3={};logger['info'](util[_0x01c1('0x2f')](_0x01c1('0x6f'),_0xabe395,_0x422a6e));return uploadFile(_0x162a98,_0x2db27f,_0x435143,_0x422a6e,path['basename'](_0x36b1a6),fs[_0x01c1('0x70')](_0x36b1a6))[_0x01c1('0x1d')](function(_0x5b4034){logger['info'](util[_0x01c1('0x2f')](_0x01c1('0x71'),_0xabe395,_0x422a6e,_0x5b4034[_0x01c1('0x72')]));_0x54c8f3['bucket']=_0x5b4034[_0x01c1('0x73')];_0x54c8f3[_0x01c1('0x74')]=_0x5b4034[_0x01c1('0x72')];logger[_0x01c1('0x64')](util['format'](_0x01c1('0x75'),_0xabe395));return startTranscribe(_0x162a98,_0x2db27f,_0x435143,uuidv4(),_0xf44efc,_0x5b4034[_0x01c1('0x72')]);})['then'](function(_0x268143){logger[_0x01c1('0x64')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xabe395,_0x268143[_0x01c1('0x76')]['TranscriptionJobName']));_0x54c8f3['transcribeName']=_0x268143[_0x01c1('0x76')][_0x01c1('0x77')];_0x54c8f3[_0x01c1('0x78')]=_0x268143['TranscriptionJob'][_0x01c1('0x79')];return _0x4468e7(_0x54c8f3);})[_0x01c1('0x44')](function(_0x28c063){return _0x2b4274(_0x28c063);});});}exports[_0x01c1('0x7a')]=function(_0x43c8d4,_0x26a6a2,_0x1391b7){var _0x1919aa;var _0x3c906a;var _0x3340c7;var _0x121b5c=require('../../components/encryptor');return db['VoiceRecording'][_0x01c1('0x7b')]({'where':{'id':_0x43c8d4[_0x01c1('0x46')]['id']}})[_0x01c1('0x1d')](function(_0x1ee53f){if(_0x1ee53f){var _0x1d7a9=util['format'](_0x01c1('0x50'),_0x1ee53f['value']);if(fs['existsSync'](_0x1d7a9)){cypher=!![];return _0x121b5c[_0x01c1('0x52')](_0x1d7a9,_0x1ee53f['value'],config[_0x01c1('0x53')]['recording'])[_0x01c1('0x1d')](function(){return _0x1ee53f;});}return _0x1ee53f;}})['then'](function(_0x5d2d59){if(!_0x5d2d59){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))](_0x01c1('0x7c'));}_0x3c906a=_0x5d2d59;return db[_0x01c1('0x7d')]['findOne']({'where':{'id':0x1}});})[_0x01c1('0x1d')](handleEntityNotFound(_0x26a6a2,null))[_0x01c1('0x1d')](function(_0x2a2f84){if(_0x2a2f84){_0x1919aa=_0x2a2f84;if(!_0x1919aa[_0x01c1('0x7e')]||!_0x1919aa[_0x01c1('0x7f')]||!_0x1919aa[_0x01c1('0x80')]||!_0x1919aa['language']||!_0x1919aa[_0x01c1('0x81')]){throw new db['Sequelize'][(_0x01c1('0x56'))](_0x01c1('0x82'));}if(_0x43c8d4['body'][_0x01c1('0x83')]&&(!_0x1919aa[_0x01c1('0x84')]||!_0x1919aa[_0x01c1('0x85')]||!_0x1919aa[_0x01c1('0x86')]||!_0x1919aa[_0x01c1('0x87')]||!_0x1919aa[_0x01c1('0x81')])){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x01c1('0x88')]['findOne']({'where':{'id':_0x1919aa['transcribeAccountId']}});}})[_0x01c1('0x1d')](function(_0x1803b1){if(!_0x1803b1){throw new db['Sequelize'][(_0x01c1('0x56'))](_0x01c1('0x89'));}if(!_0x1803b1[_0x01c1('0x8a')]||!_0x1803b1['data2']){throw new db[(_0x01c1('0x55'))][(_0x01c1('0x56'))](_0x01c1('0x8b'));}_0x3340c7=_0x1803b1;return getBucketslist(_0x3340c7[_0x01c1('0x8a')],_0x3340c7[_0x01c1('0x8c')],_0x1919aa[_0x01c1('0x80')]);})[_0x01c1('0x1d')](function(_0x1f310c){if(_0x1f310c&&_0x1f310c[_0x01c1('0x8d')]){var _0x17ee11=_[_0x01c1('0x4a')](_0x1f310c[_0x01c1('0x8d')],function(_0x287a20){return _0x287a20['Name']===_0x1919aa[_0x01c1('0x81')];});if(!_0x17ee11){logger[_0x01c1('0x64')](util[_0x01c1('0x2f')](_0x01c1('0x8e'),_0x43c8d4[_0x01c1('0x46')]['id'],_0x1919aa[_0x01c1('0x81')]));return createBucket(_0x3340c7['data1'],_0x3340c7['data2'],_0x1919aa['transcribeRegion'],_0x1919aa[_0x01c1('0x81')]);}logger[_0x01c1('0x64')](util['format'](_0x01c1('0x8f'),_0x43c8d4[_0x01c1('0x46')]['id'],_0x1919aa['bucket']));return;}})[_0x01c1('0x1d')](function(_0x53ecf8){if(_0x3c906a['transcribeStatus']===_0x01c1('0x90')){return transcribe(_0x43c8d4[_0x01c1('0x46')]['id'],_0x3340c7[_0x01c1('0x8a')],_0x3340c7[_0x01c1('0x8c')],_0x1919aa[_0x01c1('0x80')],_0x1919aa['bucket'],_0x3c906a[_0x01c1('0x4f')],_0x1919aa[_0x01c1('0x87')]);}else{logger['info'](util[_0x01c1('0x2f')](_0x01c1('0x91'),_0x43c8d4[_0x01c1('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x01c1('0x1d')](function(_0x398cb0){if(_0x398cb0){_0x398cb0['tempSentiment']=_0x43c8d4['body'][_0x01c1('0x83')];return _0x3c906a[_0x01c1('0x92')](_0x398cb0);}})[_0x01c1('0x1d')](respondWithResult(_0x26a6a2,null))[_0x01c1('0x44')](handleError(_0x26a6a2,null));};function writeFile(_0x54d693,_0x259754){return new Promise(function(_0xeaaad9,_0x170b7c){fs[_0x01c1('0x93')](_0x259754,_0x54d693,function(_0x42397e,_0xf2833e){if(_0x42397e){return _0x170b7c(_0x42397e);}else{return _0xeaaad9(_0xf2833e);}});});}exports[_0x01c1('0x94')]=function(_0x4a124d,_0x188c1e,_0x1fc5d8){return db[_0x01c1('0x2a')][_0x01c1('0x7b')]({'where':{'id':_0x4a124d[_0x01c1('0x46')]['id']}})['then'](handleEntityNotFound(_0x188c1e))[_0x01c1('0x1d')](function(_0x3c39c0){if(_0x3c39c0&&_0x3c39c0[_0x01c1('0x95')]){var _0x48dead=_0x3c39c0[_0x01c1('0x95')];var _0x2f55c4=config['root']+_0x01c1('0x96')+_0x3c39c0['id']+'.txt';if(fs[_0x01c1('0x51')](_0x2f55c4)){return _0x2f55c4;}return writeFile(_0x48dead,_0x2f55c4)['then'](function(){return _0x2f55c4;});}else{throw new db[(_0x01c1('0x55'))]['ValidationError'](_0x01c1('0x97'));}})['then'](function(_0x7f15f9){return _0x188c1e[_0x01c1('0x4c')](_0x7f15f9);})['catch'](handleError(_0x188c1e));}; \ No newline at end of file +var _0xb763=['transcribeStatus','TranscriptionJobStatus','findOne','decryptFile','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','message','agent','interaction','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','merge','find','create','describe','download','../../components/encryptor','value','existsSync','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','Not\x20found','downloads','MD5','sequelize','col','token','uniqueid','$and','push','%s.cypher','recording','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','TranscriptionJobName'];(function(_0x57d70c,_0x4ae72f){var _0x5a2726=function(_0x5d68ae){while(--_0x5d68ae){_0x57d70c['push'](_0x57d70c['shift']());}};_0x5a2726(++_0x4ae72f);}(_0xb763,0xbe));var _0x3b76=function(_0x4fe2c3,_0xb0330){_0x4fe2c3=_0x4fe2c3-0x0;var _0x43e645=_0xb763[_0x4fe2c3];return _0x43e645;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b76('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b76('0x1'));var rp=require(_0x3b76('0x2'));var moment=require('moment');var BPromise=require(_0x3b76('0x3'));var Mustache=require('mustache');var util=require(_0x3b76('0x4'));var path=require(_0x3b76('0x5'));var sox=require(_0x3b76('0x6'));var csv=require(_0x3b76('0x7'));var ejs=require(_0x3b76('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b76('0x9'));var squel=require(_0x3b76('0xa'));var crypto=require(_0x3b76('0xb'));var jsforce=require(_0x3b76('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3b76('0x7'));var querystring=require(_0x3b76('0xd'));var Papa=require('papaparse');var AWS=require(_0x3b76('0xe'));var uuidv4=require(_0x3b76('0xf'));var Redis=require(_0x3b76('0x10'));var authService=require(_0x3b76('0x11'));var qs=require(_0x3b76('0x12'));var as=require(_0x3b76('0x13'));var hardwareService=require(_0x3b76('0x14'));var logger=require('../../config/logger')(_0x3b76('0x15'));var utils=require(_0x3b76('0x16'));var config=require(_0x3b76('0x17'));var licenseUtil=require(_0x3b76('0x18'));var db=require(_0x3b76('0x19'))['db'];function respondWithStatusCode(_0xbe2369,_0x5804ec){_0x5804ec=_0x5804ec||0xcc;return function(_0x41e5db){if(_0x41e5db){return _0xbe2369['sendStatus'](_0x5804ec);}return _0xbe2369[_0x3b76('0x1a')](_0x5804ec)[_0x3b76('0x1b')]();};}function respondWithResult(_0x47c9cc,_0x5791e4){_0x5791e4=_0x5791e4||0xc8;return function(_0x73cfde){if(_0x73cfde){return _0x47c9cc[_0x3b76('0x1a')](_0x5791e4)[_0x3b76('0x1c')](_0x73cfde);}};}function respondWithFilteredResult(_0xd4117,_0x4e0652){return function(_0x51e5ac){if(_0x51e5ac){var _0x3295eb=typeof _0x4e0652['offset']===_0x3b76('0x1d')&&typeof _0x4e0652[_0x3b76('0x1e')]===_0x3b76('0x1d');var _0x3739df=_0x51e5ac['count'];var _0x58edd3=_0x3295eb?0x0:_0x4e0652[_0x3b76('0x1f')];var _0x5391c5=_0x3295eb?_0x51e5ac['count']:_0x4e0652[_0x3b76('0x1f')]+_0x4e0652['limit'];var _0x168ca9;if(_0x5391c5>=_0x3739df){_0x5391c5=_0x3739df;_0x168ca9=0xc8;}else{_0x168ca9=0xce;}_0xd4117[_0x3b76('0x1a')](_0x168ca9);return _0xd4117[_0x3b76('0x20')](_0x3b76('0x21'),_0x58edd3+'-'+_0x5391c5+'/'+_0x3739df)[_0x3b76('0x1c')](_0x51e5ac);}return null;};}function patchUpdates(_0x29a453){return function(_0x123961){try{jsonpatch[_0x3b76('0x22')](_0x123961,_0x29a453,!![]);}catch(_0x177229){return BPromise[_0x3b76('0x23')](_0x177229);}return _0x123961[_0x3b76('0x24')]();};}function saveUpdates(_0x2482d7,_0x3b76ad){return function(_0x3a37fd){if(_0x3a37fd){return _0x3a37fd[_0x3b76('0x25')](_0x2482d7)[_0x3b76('0x26')](function(_0x3c7f0e){return _0x3c7f0e;});}return null;};}function removeEntity(_0x558eb9,_0x12df93){return function(_0x531f3b){if(_0x531f3b){return _0x531f3b[_0x3b76('0x27')]()[_0x3b76('0x26')](function(){_0x558eb9[_0x3b76('0x1a')](0xcc)[_0x3b76('0x1b')]();});}};}function handleEntityNotFound(_0x54a8a0,_0x301c07){return function(_0x2a5a1c){if(!_0x2a5a1c){_0x54a8a0[_0x3b76('0x28')](0x194);}return _0x2a5a1c;};}function handleError(_0x36696b,_0x5c07e2){_0x5c07e2=_0x5c07e2||0x1f4;return function(_0x39762a){logger[_0x3b76('0x29')](_0x39762a[_0x3b76('0x2a')]);if(_0x39762a[_0x3b76('0x2b')]){delete _0x39762a['name'];}_0x36696b[_0x3b76('0x1a')](_0x5c07e2)[_0x3b76('0x2c')](_0x39762a);};}function getMustacheRender(_0x5e457e,_0x1fd59d){return Mustache['render'](_0x5e457e,_['merge'](_0x1fd59d[_0x3b76('0x2d')],{'contact':_0x1fd59d['contact'],'message':_0x1fd59d[_0x3b76('0x2e')],'agent':_0x1fd59d[_0x3b76('0x2f')],'interaction':_0x1fd59d[_0x3b76('0x30')],'account':_0x1fd59d['account']}))||'';}exports['index']=function(_0x43854a,_0x5873fc){var _0x42a696={},_0x2014ef={},_0x133f5a={'count':0x0,'rows':[]};var _0x2d2e7f=_['map'](db[_0x3b76('0x31')]['rawAttributes'],function(_0x371712){return{'name':_0x371712[_0x3b76('0x32')],'type':_0x371712[_0x3b76('0x33')][_0x3b76('0x34')]};});_0x2014ef[_0x3b76('0x35')]=_[_0x3b76('0x36')](_['map'](_0x2d2e7f,'name'),[_0x3b76('0x37')]);_0x2014ef[_0x3b76('0x38')]=_[_0x3b76('0x39')](_0x43854a[_0x3b76('0x38')]);_0x2014ef[_0x3b76('0x3a')]=_['intersection'](_0x2014ef['model'],_0x2014ef[_0x3b76('0x38')]);_0x42a696[_0x3b76('0x3b')]=_[_0x3b76('0x3c')](_0x2014ef[_0x3b76('0x35')],qs[_0x3b76('0x3d')](_0x43854a[_0x3b76('0x38')][_0x3b76('0x3d')]));_0x42a696[_0x3b76('0x3b')]=_0x42a696['attributes'][_0x3b76('0x3e')]?_0x42a696[_0x3b76('0x3b')]:_0x2014ef[_0x3b76('0x35')];if(!_0x43854a[_0x3b76('0x38')][_0x3b76('0x3f')](_0x3b76('0x40'))){_0x42a696[_0x3b76('0x1e')]=qs[_0x3b76('0x1e')](_0x43854a['query'][_0x3b76('0x1e')]);_0x42a696[_0x3b76('0x1f')]=qs[_0x3b76('0x1f')](_0x43854a[_0x3b76('0x38')][_0x3b76('0x1f')]);}_0x42a696['order']=qs[_0x3b76('0x41')](_0x43854a[_0x3b76('0x38')][_0x3b76('0x41')]);_0x42a696[_0x3b76('0x42')]=qs[_0x3b76('0x3a')](_[_0x3b76('0x43')](_0x43854a[_0x3b76('0x38')],_0x2014ef[_0x3b76('0x3a')]),_0x2d2e7f);if(_0x43854a[_0x3b76('0x38')][_0x3b76('0x44')]){_0x42a696[_0x3b76('0x42')]=_['merge'](_0x42a696[_0x3b76('0x42')],{'$or':_['map'](_0x2d2e7f,function(_0x2ca8e2){if(_0x2ca8e2[_0x3b76('0x33')]!==_0x3b76('0x45')){var _0x57ae4f={};_0x57ae4f[_0x2ca8e2[_0x3b76('0x2b')]]={'$like':'%'+_0x43854a[_0x3b76('0x38')][_0x3b76('0x44')]+'%'};return _0x57ae4f;}})});}_0x42a696=_['merge']({},_0x42a696,_0x43854a[_0x3b76('0x46')]);var _0x2e532d={'where':_0x42a696[_0x3b76('0x42')]};return db['VoiceRecording'][_0x3b76('0x47')](_0x2e532d)['then'](function(_0x3535e4){_0x133f5a['count']=_0x3535e4;if(_0x43854a['query'][_0x3b76('0x48')]){_0x42a696['include']=[{'all':!![]}];}return db[_0x3b76('0x31')][_0x3b76('0x49')](_0x42a696);})[_0x3b76('0x26')](function(_0x3c4ef2){_0x133f5a[_0x3b76('0x4a')]=_0x3c4ef2;return _0x133f5a;})[_0x3b76('0x26')](respondWithFilteredResult(_0x5873fc,_0x42a696))[_0x3b76('0x4b')](handleError(_0x5873fc,null));};exports[_0x3b76('0x4c')]=function(_0x966935,_0x285151){var _0xfc0b05={'raw':![],'where':{'id':_0x966935[_0x3b76('0x4d')]['id']}},_0x4786f9={};_0x4786f9[_0x3b76('0x35')]=_['keys'](db['VoiceRecording'][_0x3b76('0x4e')]);_0x4786f9['query']=_[_0x3b76('0x39')](_0x966935['query']);_0x4786f9['filters']=_['intersection'](_0x4786f9[_0x3b76('0x35')],_0x4786f9[_0x3b76('0x38')]);_0xfc0b05[_0x3b76('0x3b')]=_[_0x3b76('0x3c')](_0x4786f9[_0x3b76('0x35')],qs[_0x3b76('0x3d')](_0x966935[_0x3b76('0x38')][_0x3b76('0x3d')]));_0xfc0b05[_0x3b76('0x3b')]=_0xfc0b05[_0x3b76('0x3b')][_0x3b76('0x3e')]?_0xfc0b05['attributes']:_0x4786f9[_0x3b76('0x35')];if(_0x966935[_0x3b76('0x38')]['includeAll']){_0xfc0b05[_0x3b76('0x4f')]=[{'all':!![]}];}_0xfc0b05=_[_0x3b76('0x50')]({},_0xfc0b05,_0x966935['options']);return db[_0x3b76('0x31')][_0x3b76('0x51')](_0xfc0b05)[_0x3b76('0x26')](handleEntityNotFound(_0x285151,null))[_0x3b76('0x26')](respondWithResult(_0x285151,null))[_0x3b76('0x4b')](handleError(_0x285151,null));};exports['create']=function(_0xb07f44,_0x2f8e19){return db[_0x3b76('0x31')][_0x3b76('0x52')](_0xb07f44[_0x3b76('0x2d')],{})[_0x3b76('0x26')](respondWithResult(_0x2f8e19,0xc9))[_0x3b76('0x4b')](handleError(_0x2f8e19,null));};exports[_0x3b76('0x25')]=function(_0xd75d98,_0x2ecefd){if(_0xd75d98[_0x3b76('0x2d')]['id']){delete _0xd75d98['body']['id'];}return db[_0x3b76('0x31')][_0x3b76('0x51')]({'where':{'id':_0xd75d98[_0x3b76('0x4d')]['id']}})[_0x3b76('0x26')](handleEntityNotFound(_0x2ecefd,null))[_0x3b76('0x26')](saveUpdates(_0xd75d98[_0x3b76('0x2d')],null))[_0x3b76('0x26')](respondWithResult(_0x2ecefd,null))[_0x3b76('0x4b')](handleError(_0x2ecefd,null));};exports[_0x3b76('0x53')]=function(_0x4e1e28,_0x39d9ac){return db[_0x3b76('0x31')][_0x3b76('0x53')]()[_0x3b76('0x26')](respondWithResult(_0x39d9ac,null))[_0x3b76('0x4b')](handleError(_0x39d9ac,null));};exports[_0x3b76('0x54')]=function(_0x595fb3,_0x379b1a,_0x2751be){var _0x2ff314=require(_0x3b76('0x55'));var _0x469426=![];var _0x3ed0b9={};if(_0x595fb3[_0x3b76('0x38')][_0x3b76('0x33')]&&_0x595fb3[_0x3b76('0x38')]['type']==='uniqueid'){_0x3ed0b9['uniqueid']=_0x595fb3[_0x3b76('0x4d')]['id'];}else{_0x3ed0b9['id']=_0x595fb3[_0x3b76('0x4d')]['id'];}return db['VoiceRecording'][_0x3b76('0x51')]({'where':_0x3ed0b9,'attributes':['id',_0x3b76('0x56')],'raw':!![]})[_0x3b76('0x26')](handleEntityNotFound(_0x379b1a,null))[_0x3b76('0x26')](function(_0x2fc988){if(_0x2fc988){var _0x26322d=_0x2fc988[_0x3b76('0x56')];var _0x41747e=util[_0x3b76('0x37')]('%s.cypher',_0x26322d);if(fs[_0x3b76('0x57')](_0x41747e)){_0x469426=!![];return _0x2ff314['decryptFile'](_0x41747e,_0x26322d,config[_0x3b76('0x58')]['recording'])[_0x3b76('0x26')](function(){return _0x2fc988;});}return _0x2fc988;}})[_0x3b76('0x26')](function(_0x59f81d){if(_0x59f81d){var _0x293563=_0x59f81d[_0x3b76('0x56')];if(!fs['existsSync'](_0x293563)){throw new db[(_0x3b76('0x59'))][(_0x3b76('0x5a'))](_0x3b76('0x5b'));}if(_0x59f81d[_0x3b76('0x5c')]){return _0x379b1a[_0x3b76('0x54')](_0x293563,_0x59f81d[_0x3b76('0x5c')]+path[_0x3b76('0x5d')](_0x293563),function(){if(_0x469426){fs['unlink'](_0x293563);}});}else{return _0x379b1a[_0x3b76('0x54')](_0x293563,function(_0x28746f){if(_0x469426){fs['unlink'](_0x293563);}});}}})[_0x3b76('0x4b')](function(_0x48cc56){if(_0x48cc56[_0x3b76('0x2e')]===_0x3b76('0x5b')){_0x379b1a[_0x3b76('0x1a')](0x194)[_0x3b76('0x2c')](_0x3b76('0x5e'));}else{return handleError(_0x379b1a,null);}});};exports[_0x3b76('0x5f')]=function(_0x5f2069,_0x3d38c1,_0x477943){var _0x4528f3=require(_0x3b76('0x55'));var _0x2a9469=![];var _0x1e784d={'$and':[db['sequelize']['where'](db['sequelize']['fn'](_0x3b76('0x60'),db[_0x3b76('0x61')][_0x3b76('0x62')]('uniqueid')),_0x5f2069[_0x3b76('0x38')][_0x3b76('0x63')])]};if(_0x5f2069[_0x3b76('0x38')][_0x3b76('0x33')]&&_0x5f2069[_0x3b76('0x38')][_0x3b76('0x33')]===_0x3b76('0x64')){_0x1e784d[_0x3b76('0x65')][_0x3b76('0x66')]({'uniqueid':_0x5f2069[_0x3b76('0x4d')]['id']});}else{_0x1e784d[_0x3b76('0x65')][_0x3b76('0x66')]({'id':_0x5f2069[_0x3b76('0x4d')]['id']});}return db['VoiceRecording'][_0x3b76('0x51')]({'where':_0x1e784d,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3d38c1,null))['then'](function(_0x5f462c){if(_0x5f462c){var _0x9dfbd0=util[_0x3b76('0x37')](_0x3b76('0x67'),_0x5f462c[_0x3b76('0x56')]);if(fs['existsSync'](_0x9dfbd0)){_0x2a9469=!![];return _0x4528f3['decryptFile'](_0x9dfbd0,_0x5f462c[_0x3b76('0x56')],config['secrets'][_0x3b76('0x68')])[_0x3b76('0x26')](function(){return _0x5f462c;});}return _0x5f462c;}})[_0x3b76('0x26')](function(_0x27b4e1){if(_0x27b4e1){if(!fs[_0x3b76('0x57')](_0x27b4e1[_0x3b76('0x56')])){throw new db[(_0x3b76('0x59'))]['ValidationError'](_0x3b76('0x5b'));}if(_0x27b4e1[_0x3b76('0x5c')]){return _0x3d38c1[_0x3b76('0x54')](_0x27b4e1['value'],_0x27b4e1[_0x3b76('0x5c')]+path[_0x3b76('0x5d')](_0x27b4e1[_0x3b76('0x56')]),function(){if(_0x2a9469){fs[_0x3b76('0x69')](_0x27b4e1[_0x3b76('0x56')]);}});}else{return _0x3d38c1[_0x3b76('0x54')](_0x27b4e1[_0x3b76('0x56')],function(_0x200ea1){if(_0x2a9469){fs['unlink'](_0x27b4e1[_0x3b76('0x56')]);}});}}})[_0x3b76('0x4b')](handleError(_0x3d38c1,null));};exports[_0x3b76('0x27')]=function(_0x314d97,_0x5acfa0){return db['VoiceRecording']['find']({'where':{'id':_0x314d97[_0x3b76('0x4d')]['id']}})[_0x3b76('0x26')](function(_0xa4deca){if(_[_0x3b76('0x6a')](_0xa4deca)){throw new ReferenceError(_0x3b76('0x6b'));}return _0xa4deca;})[_0x3b76('0x26')](function(_0x2c93e){var _0x5178e5=_0x2c93e[_0x3b76('0x56')];logger[_0x3b76('0x6c')](_0x3b76('0x6d'),_0x5178e5);if(!_['isNil'](_0x2c93e['value'])&&fs[_0x3b76('0x57')](_0x5178e5)){logger[_0x3b76('0x6c')](_0x3b76('0x6e')+_0x5178e5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5178e5);}_0x5178e5=_0x5178e5+'.cypher';if(!_[_0x3b76('0x6a')](_0x2c93e[_0x3b76('0x56')])&&fs[_0x3b76('0x57')](_0x5178e5)){logger[_0x3b76('0x6c')](_0x3b76('0x6e')+_0x5178e5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3b76('0x6f')](_0x5178e5);}return _0x2c93e;})['then'](function(_0x14c37d){if(!_0x14c37d)throw new InternalError();return _0x14c37d[_0x3b76('0x27')]();})['then'](function(){_0x5acfa0[_0x3b76('0x1a')](0xcc)['end']();})[_0x3b76('0x4b')](handleError(_0x5acfa0,null));};function getBucketslist(_0x412e9f,_0x5f3d59,_0x56cb64){return new Promise(function(_0x1e42d3,_0x1d9b29){var _0x2c89f8=new AWS['S3']({'accessKeyId':_0x5f3d59,'secretAccessKey':_0x412e9f,'region':_0x56cb64});_0x2c89f8[_0x3b76('0x70')]({},function(_0x1647c3,_0x332f46){if(_0x1647c3){return _0x1d9b29(_0x1647c3);}else{return _0x1e42d3(_0x332f46);}});});}function createBucket(_0x237ebd,_0x481ffc,_0x2ae817,_0x1207a2){return new Promise(function(_0x16ceb6,_0x2877c2){var _0x4ec707=new AWS['S3']({'accessKeyId':_0x481ffc,'secretAccessKey':_0x237ebd,'region':_0x2ae817});_0x4ec707[_0x3b76('0x71')]({'Bucket':_0x1207a2},function(_0x45d932,_0x48bd68){if(_0x45d932){return _0x2877c2(_0x45d932);}else{return _0x16ceb6(_0x48bd68);}});});}function uploadFile(_0x5e3603,_0x3b50fa,_0x477ade,_0x1b66a3,_0x47c975,_0x2fb13d){return new Promise(function(_0x3d428a,_0xe1e987){var _0x5a8224=new AWS['S3']({'accessKeyId':_0x3b50fa,'secretAccessKey':_0x5e3603,'region':_0x477ade});_0x5a8224[_0x3b76('0x72')]({'Bucket':_0x1b66a3,'Key':_0x47c975,'Body':_0x2fb13d},function(_0x182308,_0x46fc70){if(_0x182308){return _0xe1e987(_0x182308);}else{return _0x3d428a(_0x46fc70);}});});}function startTranscribe(_0x18e511,_0x3cf3a1,_0x71410e,_0x40a052,_0x182e19,_0x15299c){return new Promise(function(_0x39462c,_0xa3dfd2){var _0x2675bf=new AWS[(_0x3b76('0x73'))]({'accessKeyId':_0x3cf3a1,'secretAccessKey':_0x18e511,'region':_0x71410e});_0x2675bf[_0x3b76('0x74')]({'TranscriptionJobName':_0x40a052,'LanguageCode':_0x182e19,'Media':{'MediaFileUri':_0x15299c}},function(_0x13dc3d,_0x10cfca){if(_0x13dc3d){return _0xa3dfd2(_0x13dc3d);}else{return _0x39462c(_0x10cfca);}});});}function transcribe(_0x555952,_0x36591b,_0x31fadb,_0x22849a,_0x17cf3e,_0x9d2ae8,_0x3ce9e0){return new Promise(function(_0x5db3a4,_0x54da37){var _0x127738={};logger[_0x3b76('0x6c')](util['format'](_0x3b76('0x75'),_0x555952,_0x17cf3e));return uploadFile(_0x36591b,_0x31fadb,_0x22849a,_0x17cf3e,path[_0x3b76('0x76')](_0x9d2ae8),fs['readFileSync'](_0x9d2ae8))[_0x3b76('0x26')](function(_0x1c0916){logger[_0x3b76('0x6c')](util[_0x3b76('0x37')](_0x3b76('0x77'),_0x555952,_0x17cf3e,_0x1c0916['Location']));_0x127738['bucket']=_0x1c0916[_0x3b76('0x78')];_0x127738[_0x3b76('0x79')]=_0x1c0916[_0x3b76('0x7a')];logger['info'](util[_0x3b76('0x37')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x555952));return startTranscribe(_0x36591b,_0x31fadb,_0x22849a,uuidv4(),_0x3ce9e0,_0x1c0916[_0x3b76('0x7a')]);})[_0x3b76('0x26')](function(_0x42d0e9){logger[_0x3b76('0x6c')](util[_0x3b76('0x37')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x555952,_0x42d0e9['TranscriptionJob'][_0x3b76('0x7b')]));_0x127738['transcribeName']=_0x42d0e9['TranscriptionJob']['TranscriptionJobName'];_0x127738[_0x3b76('0x7c')]=_0x42d0e9['TranscriptionJob'][_0x3b76('0x7d')];return _0x5db3a4(_0x127738);})['catch'](function(_0x1dc94a){return _0x54da37(_0x1dc94a);});});}exports['runTranscribe']=function(_0x3e54c5,_0x1b8289,_0x631a1a){var _0x241e20;var _0x2a0097;var _0x1f50f2;var _0x13501f=require(_0x3b76('0x55'));return db['VoiceRecording'][_0x3b76('0x7e')]({'where':{'id':_0x3e54c5['params']['id']}})[_0x3b76('0x26')](function(_0x569621){if(_0x569621){var _0x3e683b=util[_0x3b76('0x37')](_0x3b76('0x67'),_0x569621[_0x3b76('0x56')]);if(fs[_0x3b76('0x57')](_0x3e683b)){cypher=!![];return _0x13501f[_0x3b76('0x7f')](_0x3e683b,_0x569621['value'],config[_0x3b76('0x58')][_0x3b76('0x68')])[_0x3b76('0x26')](function(){return _0x569621;});}return _0x569621;}})[_0x3b76('0x26')](function(_0x300330){if(!_0x300330){throw new db[(_0x3b76('0x59'))][(_0x3b76('0x5a'))](_0x3b76('0x80'));}_0x2a0097=_0x300330;return db[_0x3b76('0x81')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1b8289,null))[_0x3b76('0x26')](function(_0x584c89){if(_0x584c89){_0x241e20=_0x584c89;if(!_0x241e20[_0x3b76('0x82')]||!_0x241e20[_0x3b76('0x83')]||!_0x241e20['transcribeRegion']||!_0x241e20[_0x3b76('0x84')]||!_0x241e20[_0x3b76('0x85')]){throw new db[(_0x3b76('0x59'))][(_0x3b76('0x5a'))](_0x3b76('0x86'));}if(_0x3e54c5['body'][_0x3b76('0x87')]&&(!_0x241e20[_0x3b76('0x88')]||!_0x241e20[_0x3b76('0x89')]||!_0x241e20[_0x3b76('0x8a')]||!_0x241e20['language']||!_0x241e20[_0x3b76('0x85')])){throw new db[(_0x3b76('0x59'))][(_0x3b76('0x5a'))](_0x3b76('0x8b'));}return db['CloudProvider'][_0x3b76('0x7e')]({'where':{'id':_0x241e20[_0x3b76('0x83')]}});}})[_0x3b76('0x26')](function(_0x4c458e){if(!_0x4c458e){throw new db[(_0x3b76('0x59'))][(_0x3b76('0x5a'))](_0x3b76('0x8c'));}if(!_0x4c458e[_0x3b76('0x8d')]||!_0x4c458e[_0x3b76('0x8e')]){throw new db['Sequelize'][(_0x3b76('0x5a'))]('Cloud\x20Provider\x20not\x20configured');}_0x1f50f2=_0x4c458e;return getBucketslist(_0x1f50f2[_0x3b76('0x8d')],_0x1f50f2[_0x3b76('0x8e')],_0x241e20[_0x3b76('0x8f')]);})[_0x3b76('0x26')](function(_0x61aebb){if(_0x61aebb&&_0x61aebb[_0x3b76('0x90')]){var _0x4acfc2=_[_0x3b76('0x51')](_0x61aebb[_0x3b76('0x90')],function(_0x1b0b5a){return _0x1b0b5a[_0x3b76('0x91')]===_0x241e20[_0x3b76('0x85')];});if(!_0x4acfc2){logger[_0x3b76('0x6c')](util['format'](_0x3b76('0x92'),_0x3e54c5[_0x3b76('0x4d')]['id'],_0x241e20[_0x3b76('0x85')]));return createBucket(_0x1f50f2[_0x3b76('0x8d')],_0x1f50f2[_0x3b76('0x8e')],_0x241e20[_0x3b76('0x8f')],_0x241e20[_0x3b76('0x85')]);}logger[_0x3b76('0x6c')](util[_0x3b76('0x37')](_0x3b76('0x93'),_0x3e54c5[_0x3b76('0x4d')]['id'],_0x241e20[_0x3b76('0x85')]));return;}})[_0x3b76('0x26')](function(_0x1e4a79){if(_0x2a0097['transcribeStatus']==='NEW'){return transcribe(_0x3e54c5[_0x3b76('0x4d')]['id'],_0x1f50f2[_0x3b76('0x8d')],_0x1f50f2['data2'],_0x241e20['transcribeRegion'],_0x241e20['bucket'],_0x2a0097[_0x3b76('0x56')],_0x241e20[_0x3b76('0x84')]);}else{logger[_0x3b76('0x6c')](util[_0x3b76('0x37')](_0x3b76('0x94'),_0x3e54c5[_0x3b76('0x4d')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x3b76('0x26')](function(_0x3da9ee){if(_0x3da9ee){_0x3da9ee['tempSentiment']=_0x3e54c5['body']['runSentiment'];return _0x2a0097[_0x3b76('0x95')](_0x3da9ee);}})[_0x3b76('0x26')](respondWithResult(_0x1b8289,null))['catch'](handleError(_0x1b8289,null));};function writeFile(_0xfaf5af,_0x201ea9){return new Promise(function(_0x1a53ad,_0x2e9363){fs[_0x3b76('0x96')](_0x201ea9,_0xfaf5af,function(_0x391559,_0xccf16f){if(_0x391559){return _0x2e9363(_0x391559);}else{return _0x1a53ad(_0xccf16f);}});});}exports[_0x3b76('0x97')]=function(_0x34c28f,_0x2d3b56,_0x41e341){return db[_0x3b76('0x31')][_0x3b76('0x7e')]({'where':{'id':_0x34c28f[_0x3b76('0x4d')]['id']}})[_0x3b76('0x26')](handleEntityNotFound(_0x2d3b56))[_0x3b76('0x26')](function(_0xd7fb0c){if(_0xd7fb0c&&_0xd7fb0c[_0x3b76('0x98')]){var _0x4fba38=_0xd7fb0c[_0x3b76('0x98')];var _0x311846=config[_0x3b76('0x99')]+_0x3b76('0x9a')+_0xd7fb0c['id']+_0x3b76('0x9b');if(fs[_0x3b76('0x57')](_0x311846)){return _0x311846;}return writeFile(_0x4fba38,_0x311846)[_0x3b76('0x26')](function(){return _0x311846;});}else{throw new db[(_0x3b76('0x59'))][(_0x3b76('0x5a'))](_0x3b76('0x9c'));}})['then'](function(_0x101c9d){return _0x2d3b56['download'](_0x101c9d);})[_0x3b76('0x4b')](handleError(_0x2d3b56));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index e647342..15ed9b6 100644 --- a/server/api/voiceRecording/voiceRecording.model.js +++ b/server/api/voiceRecording/voiceRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f54=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash'];(function(_0x4b52a0,_0x51164b){var _0x5355e1=function(_0x5c3ba5){while(--_0x5c3ba5){_0x4b52a0['push'](_0x4b52a0['shift']());}};_0x5355e1(++_0x51164b);}(_0x8f54,0x9b));var _0x48f5=function(_0x5f489a,_0x4c3b21){_0x5f489a=_0x5f489a-0x0;var _0x1c6328=_0x8f54[_0x5f489a];return _0x1c6328;};'use strict';var _=require(_0x48f5('0x0'));var util=require(_0x48f5('0x1'));var logger=require(_0x48f5('0x2'))('api');var moment=require(_0x48f5('0x3'));var BPromise=require(_0x48f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48f5('0x5'));var rimraf=require(_0x48f5('0x6'));var config=require(_0x48f5('0x7'));var attributes=require(_0x48f5('0x8'));module['exports']=function(_0x911b21,_0x294219){return _0x911b21[_0x48f5('0x9')](_0x48f5('0xa'),attributes,{'tableName':_0x48f5('0xb'),'paranoid':![],'indexes':[{'name':_0x48f5('0xc'),'fields':[_0x48f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d7d=['VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define'];(function(_0x396516,_0x8e07de){var _0x28bbc8=function(_0x35dcfc){while(--_0x35dcfc){_0x396516['push'](_0x396516['shift']());}};_0x28bbc8(++_0x8e07de);}(_0x4d7d,0x73));var _0xd4d7=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x4d7d[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xd4d7('0x0'));var util=require('util');var logger=require(_0xd4d7('0x1'))(_0xd4d7('0x2'));var moment=require(_0xd4d7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd4d7('0x4'));var fs=require('fs');var path=require(_0xd4d7('0x5'));var rimraf=require(_0xd4d7('0x6'));var config=require(_0xd4d7('0x7'));var attributes=require(_0xd4d7('0x8'));module[_0xd4d7('0x9')]=function(_0x3968c7,_0x640bb8){return _0x3968c7[_0xd4d7('0xa')](_0xd4d7('0xb'),attributes,{'tableName':_0xd4d7('0xc'),'paranoid':![],'indexes':[{'name':_0xd4d7('0xd'),'fields':[_0xd4d7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index cc7101f..bb0debd 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x4ffafb,_0x20171a){var _0x4ab472=function(_0x1afc75){while(--_0x1afc75){_0x4ffafb['push'](_0x4ffafb['shift']());}};_0x4ab472(++_0x20171a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x73a84b,_0x23d3bb){var _0x9e2a66=function(_0x2153dc){while(--_0x2153dc){_0x73a84b['push'](_0x73a84b['shift']());}};_0x9e2a66(++_0x23d3bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d64f2f1..88d6c37 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1c1=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd1c1,0x18a));var _0x1d1c=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0xd1c1[_0x4a4a43];return _0x5893a6;};'use strict';var multer=require(_0x1d1c('0x0'));var util=require(_0x1d1c('0x1'));var path=require(_0x1d1c('0x2'));var timeout=require(_0x1d1c('0x3'));var express=require(_0x1d1c('0x4'));var router=express[_0x1d1c('0x5')]();var fs_extra=require(_0x1d1c('0x6'));var auth=require(_0x1d1c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1d1c('0x8'));var controller=require(_0x1d1c('0x9'));router[_0x1d1c('0xa')]('/',auth[_0x1d1c('0xb')](),controller[_0x1d1c('0xc')]);router['get'](_0x1d1c('0xd'),auth['isAuthenticated'](),controller[_0x1d1c('0xe')]);router[_0x1d1c('0xa')](_0x1d1c('0xf'),auth[_0x1d1c('0xb')](),controller[_0x1d1c('0x10')]);router['post']('/',auth[_0x1d1c('0xb')](),controller['create']);router[_0x1d1c('0x11')]('/:id',auth[_0x1d1c('0xb')](),controller[_0x1d1c('0x12')]);router[_0x1d1c('0x13')](_0x1d1c('0xf'),auth[_0x1d1c('0xb')](),controller[_0x1d1c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x279f=['/:id','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x21cecb,_0x2872d2){var _0x191984=function(_0x2fee8a){while(--_0x2fee8a){_0x21cecb['push'](_0x21cecb['shift']());}};_0x191984(++_0x2872d2);}(_0x279f,0x7d));var _0xf279=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x279f[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0xf279('0x0'));var util=require(_0xf279('0x1'));var path=require(_0xf279('0x2'));var timeout=require(_0xf279('0x3'));var express=require(_0xf279('0x4'));var router=express[_0xf279('0x5')]();var fs_extra=require(_0xf279('0x6'));var auth=require(_0xf279('0x7'));var interaction=require(_0xf279('0x8'));var config=require(_0xf279('0x9'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xf279('0xa')](),controller[_0xf279('0xb')]);router[_0xf279('0xc')](_0xf279('0xd'),auth['isAuthenticated'](),controller[_0xf279('0xe')]);router[_0xf279('0xc')](_0xf279('0xf'),auth[_0xf279('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf279('0x10')]);router[_0xf279('0x11')]('/:id',auth[_0xf279('0xa')](),controller[_0xf279('0x12')]);router[_0xf279('0x13')]('/:id',auth[_0xf279('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index ad1f687..46f3e41 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.attributes.js +++ b/server/api/voiceTransferReport/voiceTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a87=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1a87,0x97));var _0x71a8=function(_0x1bea85,_0x31d23d){_0x1bea85=_0x1bea85-0x0;var _0x1049e5=_0x1a87[_0x1bea85];return _0x1049e5;};'use strict';var Sequelize=require(_0x71a8('0x0'));var moment=require(_0x71a8('0x1'));module[_0x71a8('0x2')]={'type':{'type':Sequelize[_0x71a8('0x3')](_0x71a8('0x4'),_0x71a8('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x71a8('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x71a8('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x71a8('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x71a8('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x71a8('0x6')]},'transferercontext':{'type':Sequelize[_0x71a8('0x6')]},'transfererexten':{'type':Sequelize[_0x71a8('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x71a8('0x6')]},'transfereechannel':{'type':Sequelize[_0x71a8('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x71a8('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x71a8('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x71a8('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x71a8('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x71a8('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x71a8('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0x71a8('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x71a8('0x6')]}}; \ No newline at end of file +var _0xf15e=['exports','ENUM','blind','STRING','Yes','sequelize','moment'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xf15e,0x1b0));var _0xef15=function(_0x46a99f,_0x2410a3){_0x46a99f=_0x46a99f-0x0;var _0x1832f5=_0xf15e[_0x46a99f];return _0x1832f5;};'use strict';var Sequelize=require(_0xef15('0x0'));var moment=require(_0xef15('0x1'));module[_0xef15('0x2')]={'type':{'type':Sequelize[_0xef15('0x3')](_0xef15('0x4'),'attended')},'result':{'type':Sequelize[_0xef15('0x5')]},'transfererchannel':{'type':Sequelize[_0xef15('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xef15('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xef15('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xef15('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xef15('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xef15('0x5')]},'transfereechannel':{'type':Sequelize[_0xef15('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xef15('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xef15('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xef15('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xef15('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xef15('0x5')]},'isexternal':{'type':Sequelize[_0xef15('0x3')](_0xef15('0x6'),'No')},'context':{'type':Sequelize[_0xef15('0x5')]},'extension':{'type':Sequelize[_0xef15('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 81b25e4..32224a4 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.controller.js +++ b/server/api/voiceTransferReport/voiceTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cb2=['body','contact','agent','interaction','account','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','pick','where','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','fields','find','describe','rimraf','fast-json-patch','moment','sox','ejs','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','render','merge'];(function(_0x48e02f,_0x85a9d7){var _0x3b986a=function(_0x5a3f0e){while(--_0x5a3f0e){_0x48e02f['push'](_0x48e02f['shift']());}};_0x3b986a(++_0x85a9d7);}(_0x6cb2,0x6a));var _0x26cb=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x6cb2[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26cb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26cb('0x1'));var rp=require('request-promise');var moment=require(_0x26cb('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x26cb('0x3'));var csv=require('to-csv');var ejs=require(_0x26cb('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x26cb('0x5'));var crypto=require(_0x26cb('0x6'));var jsforce=require(_0x26cb('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x26cb('0x8'));var querystring=require(_0x26cb('0x9'));var Papa=require('papaparse');var Redis=require(_0x26cb('0xa'));var authService=require(_0x26cb('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x26cb('0xc'));var hardwareService=require(_0x26cb('0xd'));var logger=require(_0x26cb('0xe'))('api');var utils=require(_0x26cb('0xf'));var config=require(_0x26cb('0x10'));var licenseUtil=require(_0x26cb('0x11'));var db=require(_0x26cb('0x12'))['db'];function respondWithStatusCode(_0x3915f3,_0xdf28b7){_0xdf28b7=_0xdf28b7||0xcc;return function(_0x31bb54){if(_0x31bb54){return _0x3915f3[_0x26cb('0x13')](_0xdf28b7);}return _0x3915f3[_0x26cb('0x14')](_0xdf28b7)['end']();};}function respondWithResult(_0x34b453,_0x1e4e7c){_0x1e4e7c=_0x1e4e7c||0xc8;return function(_0x18b8ba){if(_0x18b8ba){return _0x34b453['status'](_0x1e4e7c)['json'](_0x18b8ba);}};}function respondWithFilteredResult(_0xc52e39,_0x53c01e){return function(_0x2a0bca){if(_0x2a0bca){var _0xfc8cc=typeof _0x53c01e[_0x26cb('0x15')]==='undefined'&&typeof _0x53c01e[_0x26cb('0x16')]===_0x26cb('0x17');var _0x283094=_0x2a0bca[_0x26cb('0x18')];var _0x261ebd=_0xfc8cc?0x0:_0x53c01e['offset'];var _0x2bd095=_0xfc8cc?_0x2a0bca[_0x26cb('0x18')]:_0x53c01e[_0x26cb('0x15')]+_0x53c01e['limit'];var _0x40e2c9;if(_0x2bd095>=_0x283094){_0x2bd095=_0x283094;_0x40e2c9=0xc8;}else{_0x40e2c9=0xce;}_0xc52e39[_0x26cb('0x14')](_0x40e2c9);return _0xc52e39[_0x26cb('0x19')](_0x26cb('0x1a'),_0x261ebd+'-'+_0x2bd095+'/'+_0x283094)['json'](_0x2a0bca);}return null;};}function patchUpdates(_0x1d824a){return function(_0x1dcd67){try{jsonpatch[_0x26cb('0x1b')](_0x1dcd67,_0x1d824a,!![]);}catch(_0x5407f1){return BPromise['reject'](_0x5407f1);}return _0x1dcd67[_0x26cb('0x1c')]();};}function saveUpdates(_0x591fe4,_0x40b60f){return function(_0x3c02bc){if(_0x3c02bc){return _0x3c02bc[_0x26cb('0x1d')](_0x591fe4)[_0x26cb('0x1e')](function(_0x41cea8){return _0x41cea8;});}return null;};}function removeEntity(_0x5cf30e,_0x3c983b){return function(_0x2b8e7c){if(_0x2b8e7c){return _0x2b8e7c[_0x26cb('0x1f')]()[_0x26cb('0x1e')](function(){_0x5cf30e['status'](0xcc)[_0x26cb('0x20')]();});}};}function handleEntityNotFound(_0x292c67,_0x21cf11){return function(_0x29498a){if(!_0x29498a){_0x292c67[_0x26cb('0x13')](0x194);}return _0x29498a;};}function handleError(_0xca2823,_0x1e0f1b){_0x1e0f1b=_0x1e0f1b||0x1f4;return function(_0x40d00b){logger[_0x26cb('0x21')](_0x40d00b[_0x26cb('0x22')]);if(_0x40d00b[_0x26cb('0x23')]){delete _0x40d00b[_0x26cb('0x23')];}_0xca2823[_0x26cb('0x14')](_0x1e0f1b)['send'](_0x40d00b);};}function getMustacheRender(_0xcd2b19,_0x313776){return Mustache[_0x26cb('0x24')](_0xcd2b19,_[_0x26cb('0x25')](_0x313776[_0x26cb('0x26')],{'contact':_0x313776[_0x26cb('0x27')],'message':_0x313776['message'],'agent':_0x313776[_0x26cb('0x28')],'interaction':_0x313776[_0x26cb('0x29')],'account':_0x313776[_0x26cb('0x2a')]}))||'';}exports['index']=function(_0x42d141,_0x1b5b18){var _0x27d8bf={},_0x5f3de6={},_0x3c604b={'count':0x0,'rows':[]};var _0x1db0eb=_['map'](db[_0x26cb('0x2b')][_0x26cb('0x2c')],function(_0xe8a0cb){return{'name':_0xe8a0cb[_0x26cb('0x2d')],'type':_0xe8a0cb[_0x26cb('0x2e')][_0x26cb('0x2f')]};});_0x5f3de6[_0x26cb('0x30')]=_['map'](_0x1db0eb,_0x26cb('0x23'));_0x5f3de6[_0x26cb('0x31')]=_['keys'](_0x42d141[_0x26cb('0x31')]);_0x5f3de6[_0x26cb('0x32')]=_[_0x26cb('0x33')](_0x5f3de6[_0x26cb('0x30')],_0x5f3de6[_0x26cb('0x31')]);_0x27d8bf[_0x26cb('0x34')]=_[_0x26cb('0x33')](_0x5f3de6['model'],qs['fields'](_0x42d141[_0x26cb('0x31')]['fields']));_0x27d8bf[_0x26cb('0x34')]=_0x27d8bf[_0x26cb('0x34')][_0x26cb('0x35')]?_0x27d8bf[_0x26cb('0x34')]:_0x5f3de6[_0x26cb('0x30')];if(!_0x42d141[_0x26cb('0x31')]['hasOwnProperty'](_0x26cb('0x36'))){_0x27d8bf[_0x26cb('0x16')]=qs['limit'](_0x42d141[_0x26cb('0x31')][_0x26cb('0x16')]);_0x27d8bf[_0x26cb('0x15')]=qs['offset'](_0x42d141['query'][_0x26cb('0x15')]);}_0x27d8bf[_0x26cb('0x37')]=qs[_0x26cb('0x38')](_0x42d141[_0x26cb('0x31')][_0x26cb('0x38')]);_0x27d8bf['where']=qs[_0x26cb('0x32')](_[_0x26cb('0x39')](_0x42d141[_0x26cb('0x31')],_0x5f3de6['filters']),_0x1db0eb);if(_0x42d141[_0x26cb('0x31')]['filter']){_0x27d8bf[_0x26cb('0x3a')]=_['merge'](_0x27d8bf[_0x26cb('0x3a')],{'$or':_[_0x26cb('0x3b')](_0x1db0eb,function(_0x4a868c){if(_0x4a868c[_0x26cb('0x2e')]!==_0x26cb('0x3c')){var _0x46c4f9={};_0x46c4f9[_0x4a868c[_0x26cb('0x23')]]={'$like':'%'+_0x42d141[_0x26cb('0x31')]['filter']+'%'};return _0x46c4f9;}})});}_0x27d8bf=_[_0x26cb('0x25')]({},_0x27d8bf,_0x42d141[_0x26cb('0x3d')]);var _0x34aa10={'where':_0x27d8bf['where']};return db[_0x26cb('0x2b')]['count'](_0x34aa10)[_0x26cb('0x1e')](function(_0x15b818){_0x3c604b[_0x26cb('0x18')]=_0x15b818;if(_0x42d141[_0x26cb('0x31')][_0x26cb('0x3e')]){_0x27d8bf[_0x26cb('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x27d8bf);})['then'](function(_0x180ce2){_0x3c604b[_0x26cb('0x40')]=_0x180ce2;return _0x3c604b;})[_0x26cb('0x1e')](respondWithFilteredResult(_0x1b5b18,_0x27d8bf))[_0x26cb('0x41')](handleError(_0x1b5b18,null));};exports[_0x26cb('0x42')]=function(_0x21e269,_0x15598c){var _0x2a3982={'raw':!![],'where':{'id':_0x21e269[_0x26cb('0x43')]['id']}},_0x51b1f1={};_0x51b1f1[_0x26cb('0x30')]=_[_0x26cb('0x44')](db[_0x26cb('0x2b')][_0x26cb('0x2c')]);_0x51b1f1[_0x26cb('0x31')]=_[_0x26cb('0x44')](_0x21e269[_0x26cb('0x31')]);_0x51b1f1['filters']=_[_0x26cb('0x33')](_0x51b1f1[_0x26cb('0x30')],_0x51b1f1[_0x26cb('0x31')]);_0x2a3982[_0x26cb('0x34')]=_[_0x26cb('0x33')](_0x51b1f1[_0x26cb('0x30')],qs[_0x26cb('0x45')](_0x21e269[_0x26cb('0x31')]['fields']));_0x2a3982[_0x26cb('0x34')]=_0x2a3982[_0x26cb('0x34')][_0x26cb('0x35')]?_0x2a3982[_0x26cb('0x34')]:_0x51b1f1['model'];if(_0x21e269['query'][_0x26cb('0x3e')]){_0x2a3982[_0x26cb('0x3f')]=[{'all':!![]}];}_0x2a3982=_[_0x26cb('0x25')]({},_0x2a3982,_0x21e269[_0x26cb('0x3d')]);return db[_0x26cb('0x2b')]['find'](_0x2a3982)['then'](handleEntityNotFound(_0x15598c,null))[_0x26cb('0x1e')](respondWithResult(_0x15598c,null))[_0x26cb('0x41')](handleError(_0x15598c,null));};exports['create']=function(_0x43fca6,_0x290187){return db[_0x26cb('0x2b')]['create'](_0x43fca6['body'],{})[_0x26cb('0x1e')](respondWithResult(_0x290187,0xc9))[_0x26cb('0x41')](handleError(_0x290187,null));};exports[_0x26cb('0x1d')]=function(_0x37d23c,_0x5006f2){if(_0x37d23c[_0x26cb('0x26')]['id']){delete _0x37d23c[_0x26cb('0x26')]['id'];}return db[_0x26cb('0x2b')][_0x26cb('0x46')]({'where':{'id':_0x37d23c[_0x26cb('0x43')]['id']}})[_0x26cb('0x1e')](handleEntityNotFound(_0x5006f2,null))[_0x26cb('0x1e')](saveUpdates(_0x37d23c[_0x26cb('0x26')],null))['then'](respondWithResult(_0x5006f2,null))[_0x26cb('0x41')](handleError(_0x5006f2,null));};exports[_0x26cb('0x1f')]=function(_0x45c82e,_0x2af932){return db[_0x26cb('0x2b')]['find']({'where':{'id':_0x45c82e[_0x26cb('0x43')]['id']}})[_0x26cb('0x1e')](handleEntityNotFound(_0x2af932,null))[_0x26cb('0x1e')](removeEntity(_0x2af932,null))[_0x26cb('0x41')](handleError(_0x2af932,null));};exports[_0x26cb('0x47')]=function(_0x563a4c,_0x47cad0){return db[_0x26cb('0x2b')]['describe']()[_0x26cb('0x1e')](respondWithResult(_0x47cad0,null))[_0x26cb('0x41')](handleError(_0x47cad0,null));}; \ No newline at end of file +var _0x8fa7=['params','find','create','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','send','merge','body','contact','message','interaction','account','map','VoiceTransferReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','name','includeAll','include','findAll','rows','catch','show'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0x8fa7,0x13c));var _0x78fa=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x8fa7[_0x455c6c];return _0x488242;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78fa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78fa('0x1'));var rp=require(_0x78fa('0x2'));var moment=require(_0x78fa('0x3'));var BPromise=require(_0x78fa('0x4'));var Mustache=require(_0x78fa('0x5'));var util=require(_0x78fa('0x6'));var path=require(_0x78fa('0x7'));var sox=require(_0x78fa('0x8'));var csv=require('to-csv');var ejs=require(_0x78fa('0x9'));var fs=require('fs');var fs_extra=require(_0x78fa('0xa'));var _=require('lodash');var squel=require(_0x78fa('0xb'));var crypto=require(_0x78fa('0xc'));var jsforce=require(_0x78fa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x78fa('0xe'));var querystring=require(_0x78fa('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78fa('0x10'));var qs=require(_0x78fa('0x11'));var as=require(_0x78fa('0x12'));var hardwareService=require(_0x78fa('0x13'));var logger=require('../../config/logger')(_0x78fa('0x14'));var utils=require(_0x78fa('0x15'));var config=require(_0x78fa('0x16'));var licenseUtil=require(_0x78fa('0x17'));var db=require(_0x78fa('0x18'))['db'];function respondWithStatusCode(_0x59e89c,_0xf2761a){_0xf2761a=_0xf2761a||0xcc;return function(_0x3e6fb5){if(_0x3e6fb5){return _0x59e89c[_0x78fa('0x19')](_0xf2761a);}return _0x59e89c[_0x78fa('0x1a')](_0xf2761a)[_0x78fa('0x1b')]();};}function respondWithResult(_0x553075,_0x404c5c){_0x404c5c=_0x404c5c||0xc8;return function(_0x701d94){if(_0x701d94){return _0x553075['status'](_0x404c5c)[_0x78fa('0x1c')](_0x701d94);}};}function respondWithFilteredResult(_0x5306c8,_0x45addf){return function(_0x24705c){if(_0x24705c){var _0x31db98=typeof _0x45addf[_0x78fa('0x1d')]===_0x78fa('0x1e')&&typeof _0x45addf[_0x78fa('0x1f')]===_0x78fa('0x1e');var _0x581a89=_0x24705c[_0x78fa('0x20')];var _0x595afc=_0x31db98?0x0:_0x45addf[_0x78fa('0x1d')];var _0x40bda3=_0x31db98?_0x24705c['count']:_0x45addf[_0x78fa('0x1d')]+_0x45addf[_0x78fa('0x1f')];var _0x31304b;if(_0x40bda3>=_0x581a89){_0x40bda3=_0x581a89;_0x31304b=0xc8;}else{_0x31304b=0xce;}_0x5306c8[_0x78fa('0x1a')](_0x31304b);return _0x5306c8[_0x78fa('0x21')](_0x78fa('0x22'),_0x595afc+'-'+_0x40bda3+'/'+_0x581a89)[_0x78fa('0x1c')](_0x24705c);}return null;};}function patchUpdates(_0x49f110){return function(_0x323956){try{jsonpatch[_0x78fa('0x23')](_0x323956,_0x49f110,!![]);}catch(_0x11596c){return BPromise[_0x78fa('0x24')](_0x11596c);}return _0x323956[_0x78fa('0x25')]();};}function saveUpdates(_0xee4e80,_0x4d6751){return function(_0x3b1cbe){if(_0x3b1cbe){return _0x3b1cbe[_0x78fa('0x26')](_0xee4e80)[_0x78fa('0x27')](function(_0x278a2a){return _0x278a2a;});}return null;};}function removeEntity(_0x32267a,_0xcdeaa2){return function(_0x5f92a6){if(_0x5f92a6){return _0x5f92a6['destroy']()[_0x78fa('0x27')](function(){_0x32267a[_0x78fa('0x1a')](0xcc)[_0x78fa('0x1b')]();});}};}function handleEntityNotFound(_0x1f92b9,_0x10db02){return function(_0x49cdd9){if(!_0x49cdd9){_0x1f92b9[_0x78fa('0x19')](0x194);}return _0x49cdd9;};}function handleError(_0x254792,_0x2c0dda){_0x2c0dda=_0x2c0dda||0x1f4;return function(_0x51cd02){logger['error'](_0x51cd02[_0x78fa('0x28')]);if(_0x51cd02['name']){delete _0x51cd02['name'];}_0x254792['status'](_0x2c0dda)[_0x78fa('0x29')](_0x51cd02);};}function getMustacheRender(_0x42ed28,_0x2d42a4){return Mustache['render'](_0x42ed28,_[_0x78fa('0x2a')](_0x2d42a4[_0x78fa('0x2b')],{'contact':_0x2d42a4[_0x78fa('0x2c')],'message':_0x2d42a4[_0x78fa('0x2d')],'agent':_0x2d42a4['agent'],'interaction':_0x2d42a4[_0x78fa('0x2e')],'account':_0x2d42a4[_0x78fa('0x2f')]}))||'';}exports['index']=function(_0x4509aa,_0x53986b){var _0x994a75={},_0x385a40={},_0x54d661={'count':0x0,'rows':[]};var _0x38a174=_[_0x78fa('0x30')](db[_0x78fa('0x31')][_0x78fa('0x32')],function(_0x3ee3f2){return{'name':_0x3ee3f2['fieldName'],'type':_0x3ee3f2[_0x78fa('0x33')][_0x78fa('0x34')]};});_0x385a40[_0x78fa('0x35')]=_[_0x78fa('0x30')](_0x38a174,'name');_0x385a40[_0x78fa('0x36')]=_[_0x78fa('0x37')](_0x4509aa[_0x78fa('0x36')]);_0x385a40['filters']=_[_0x78fa('0x38')](_0x385a40[_0x78fa('0x35')],_0x385a40['query']);_0x994a75['attributes']=_[_0x78fa('0x38')](_0x385a40['model'],qs[_0x78fa('0x39')](_0x4509aa[_0x78fa('0x36')]['fields']));_0x994a75[_0x78fa('0x3a')]=_0x994a75['attributes'][_0x78fa('0x3b')]?_0x994a75[_0x78fa('0x3a')]:_0x385a40[_0x78fa('0x35')];if(!_0x4509aa['query'][_0x78fa('0x3c')]('nolimit')){_0x994a75[_0x78fa('0x1f')]=qs['limit'](_0x4509aa['query'][_0x78fa('0x1f')]);_0x994a75['offset']=qs['offset'](_0x4509aa[_0x78fa('0x36')][_0x78fa('0x1d')]);}_0x994a75[_0x78fa('0x3d')]=qs['sort'](_0x4509aa[_0x78fa('0x36')][_0x78fa('0x3e')]);_0x994a75[_0x78fa('0x3f')]=qs[_0x78fa('0x40')](_[_0x78fa('0x41')](_0x4509aa[_0x78fa('0x36')],_0x385a40[_0x78fa('0x40')]),_0x38a174);if(_0x4509aa[_0x78fa('0x36')][_0x78fa('0x42')]){_0x994a75[_0x78fa('0x3f')]=_[_0x78fa('0x2a')](_0x994a75[_0x78fa('0x3f')],{'$or':_[_0x78fa('0x30')](_0x38a174,function(_0x60e72b){if(_0x60e72b[_0x78fa('0x33')]!=='VIRTUAL'){var _0x9ff957={};_0x9ff957[_0x60e72b[_0x78fa('0x43')]]={'$like':'%'+_0x4509aa[_0x78fa('0x36')][_0x78fa('0x42')]+'%'};return _0x9ff957;}})});}_0x994a75=_[_0x78fa('0x2a')]({},_0x994a75,_0x4509aa['options']);var _0x31cddf={'where':_0x994a75[_0x78fa('0x3f')]};return db[_0x78fa('0x31')][_0x78fa('0x20')](_0x31cddf)[_0x78fa('0x27')](function(_0x1812a8){_0x54d661[_0x78fa('0x20')]=_0x1812a8;if(_0x4509aa[_0x78fa('0x36')][_0x78fa('0x44')]){_0x994a75[_0x78fa('0x45')]=[{'all':!![]}];}return db[_0x78fa('0x31')][_0x78fa('0x46')](_0x994a75);})[_0x78fa('0x27')](function(_0x36c052){_0x54d661[_0x78fa('0x47')]=_0x36c052;return _0x54d661;})[_0x78fa('0x27')](respondWithFilteredResult(_0x53986b,_0x994a75))[_0x78fa('0x48')](handleError(_0x53986b,null));};exports[_0x78fa('0x49')]=function(_0x20fe38,_0x1dede5){var _0x37d676={'raw':!![],'where':{'id':_0x20fe38[_0x78fa('0x4a')]['id']}},_0x5c684c={};_0x5c684c[_0x78fa('0x35')]=_['keys'](db[_0x78fa('0x31')][_0x78fa('0x32')]);_0x5c684c[_0x78fa('0x36')]=_[_0x78fa('0x37')](_0x20fe38[_0x78fa('0x36')]);_0x5c684c[_0x78fa('0x40')]=_['intersection'](_0x5c684c['model'],_0x5c684c[_0x78fa('0x36')]);_0x37d676[_0x78fa('0x3a')]=_['intersection'](_0x5c684c[_0x78fa('0x35')],qs[_0x78fa('0x39')](_0x20fe38[_0x78fa('0x36')][_0x78fa('0x39')]));_0x37d676[_0x78fa('0x3a')]=_0x37d676[_0x78fa('0x3a')][_0x78fa('0x3b')]?_0x37d676['attributes']:_0x5c684c[_0x78fa('0x35')];if(_0x20fe38[_0x78fa('0x36')][_0x78fa('0x44')]){_0x37d676[_0x78fa('0x45')]=[{'all':!![]}];}_0x37d676=_['merge']({},_0x37d676,_0x20fe38['options']);return db['VoiceTransferReport'][_0x78fa('0x4b')](_0x37d676)[_0x78fa('0x27')](handleEntityNotFound(_0x1dede5,null))[_0x78fa('0x27')](respondWithResult(_0x1dede5,null))['catch'](handleError(_0x1dede5,null));};exports[_0x78fa('0x4c')]=function(_0x3db34b,_0x1bf0d8){return db[_0x78fa('0x31')][_0x78fa('0x4c')](_0x3db34b[_0x78fa('0x2b')],{})[_0x78fa('0x27')](respondWithResult(_0x1bf0d8,0xc9))['catch'](handleError(_0x1bf0d8,null));};exports['update']=function(_0x5bec46,_0xa59159){if(_0x5bec46[_0x78fa('0x2b')]['id']){delete _0x5bec46[_0x78fa('0x2b')]['id'];}return db['VoiceTransferReport'][_0x78fa('0x4b')]({'where':{'id':_0x5bec46[_0x78fa('0x4a')]['id']}})[_0x78fa('0x27')](handleEntityNotFound(_0xa59159,null))[_0x78fa('0x27')](saveUpdates(_0x5bec46[_0x78fa('0x2b')],null))['then'](respondWithResult(_0xa59159,null))[_0x78fa('0x48')](handleError(_0xa59159,null));};exports[_0x78fa('0x4d')]=function(_0x864315,_0x53fd10){return db['VoiceTransferReport'][_0x78fa('0x4b')]({'where':{'id':_0x864315[_0x78fa('0x4a')]['id']}})[_0x78fa('0x27')](handleEntityNotFound(_0x53fd10,null))['then'](removeEntity(_0x53fd10,null))[_0x78fa('0x48')](handleError(_0x53fd10,null));};exports['describe']=function(_0x393609,_0x5b849b){return db['VoiceTransferReport']['describe']()[_0x78fa('0x27')](respondWithResult(_0x5b849b,null))[_0x78fa('0x48')](handleError(_0x5b849b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a2f96db..10738c0 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.model.js +++ b/server/api/voiceTransferReport/voiceTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5332=['api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5332,0x12a));var _0x2533=function(_0x2a4414,_0xa705c4){_0x2a4414=_0x2a4414-0x0;var _0x461948=_0x5332[_0x2a4414];return _0x461948;};'use strict';var _=require(_0x2533('0x0'));var util=require('util');var logger=require(_0x2533('0x1'))(_0x2533('0x2'));var moment=require(_0x2533('0x3'));var BPromise=require('bluebird');var rp=require(_0x2533('0x4'));var fs=require('fs');var path=require(_0x2533('0x5'));var rimraf=require(_0x2533('0x6'));var config=require('../../config/environment');var attributes=require(_0x2533('0x7'));module[_0x2533('0x8')]=function(_0x4bc6dc,_0x5ec155){return _0x4bc6dc[_0x2533('0x9')](_0x2533('0xa'),attributes,{'tableName':_0x2533('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf438=['../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4a8768,_0x5b0dab){var _0x55e6be=function(_0x3f48ed){while(--_0x3f48ed){_0x4a8768['push'](_0x4a8768['shift']());}};_0x55e6be(++_0x5b0dab);}(_0xf438,0xe0));var _0x8f43=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xf438[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x8f43('0x0'));var logger=require(_0x8f43('0x1'))(_0x8f43('0x2'));var moment=require(_0x8f43('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f43('0x4'));var fs=require('fs');var path=require(_0x8f43('0x5'));var rimraf=require(_0x8f43('0x6'));var config=require(_0x8f43('0x7'));var attributes=require(_0x8f43('0x8'));module['exports']=function(_0x816681,_0xe33c3a){return _0x816681[_0x8f43('0x9')](_0x8f43('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index fe557c5..7d5b84c 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.rpc.js +++ b/server/api/voiceTransferReport/voiceTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58e9=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x58e9,0x15e));var _0x958e=function(_0x218623,_0x1afd98){_0x218623=_0x218623-0x0;var _0x39560f=_0x58e9[_0x218623];return _0x39560f;};'use strict';var _=require(_0x958e('0x0'));var util=require(_0x958e('0x1'));var moment=require('moment');var BPromise=require(_0x958e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x958e('0x3'));var db=require(_0x958e('0x4'))['db'];var utils=require(_0x958e('0x5'));var logger=require(_0x958e('0x6'))(_0x958e('0x7'));var config=require('../../config/environment');var jayson=require(_0x958e('0x8'));var client=jayson[_0x958e('0x9')][_0x958e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d4534,_0x404407,_0x1d3cf5){return new BPromise(function(_0x80e1a7,_0x7b1e23){return client[_0x958e('0xb')](_0x5d4534,_0x1d3cf5)[_0x958e('0xc')](function(_0x42ce26){logger[_0x958e('0xd')](_0x958e('0xe'),_0x404407,_0x958e('0xf'));logger[_0x958e('0x10')](_0x958e('0x11'),_0x404407,_0x958e('0xf'),JSON[_0x958e('0x12')](_0x42ce26));if(_0x42ce26[_0x958e('0x13')]){if(_0x42ce26['error']['code']===0x1f4){logger[_0x958e('0x13')](_0x958e('0xe'),_0x404407,_0x42ce26[_0x958e('0x13')][_0x958e('0x14')]);return _0x7b1e23(_0x42ce26[_0x958e('0x13')][_0x958e('0x14')]);}logger[_0x958e('0x13')](_0x958e('0xe'),_0x404407,_0x42ce26['error'][_0x958e('0x14')]);return _0x80e1a7(_0x42ce26[_0x958e('0x13')][_0x958e('0x14')]);}else{logger[_0x958e('0xd')](_0x958e('0xe'),_0x404407,_0x958e('0xf'));_0x80e1a7(_0x42ce26[_0x958e('0x15')]['message']);}})[_0x958e('0x16')](function(_0x403632){logger[_0x958e('0x13')](_0x958e('0xe'),_0x404407,_0x403632);_0x7b1e23(_0x403632);});});}exports[_0x958e('0x17')]=function(_0x3631a8){var _0x7ae00e=this;return new Promise(function(_0x5bf86c,_0x4aa710){return db['VoiceTransferReport'][_0x958e('0x18')](_0x3631a8[_0x958e('0x19')],{'raw':_0x3631a8[_0x958e('0x1a')]?_0x3631a8[_0x958e('0x1a')][_0x958e('0x1b')]===undefined?!![]:![]:!![]})[_0x958e('0xc')](function(_0x4fa943){logger[_0x958e('0xd')](_0x958e('0x17'),_0x3631a8);logger[_0x958e('0x10')](_0x958e('0x17'),_0x3631a8,JSON[_0x958e('0x12')](_0x4fa943));_0x5bf86c(_0x4fa943);})[_0x958e('0x16')](function(_0x5c45e4){logger['error'](_0x958e('0x17'),_0x5c45e4[_0x958e('0x14')],_0x3631a8);_0x4aa710(_0x7ae00e[_0x958e('0x13')](0x1f4,_0x5c45e4[_0x958e('0x14')]));});});}; \ No newline at end of file +var _0xa1fd=['jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreateVoiceTransferReport','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x423e15,_0x12b2b2){_0x423e15=_0x423e15-0x0;var _0x184279=_0xa1fd[_0x423e15];return _0x184279;};'use strict';var _=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var moment=require(_0xda1f('0x2'));var BPromise=require(_0xda1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda1f('0x4'));var db=require(_0xda1f('0x5'))['db'];var utils=require(_0xda1f('0x6'));var logger=require(_0xda1f('0x7'))(_0xda1f('0x8'));var config=require('../../config/environment');var jayson=require(_0xda1f('0x9'));var client=jayson[_0xda1f('0xa')][_0xda1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552ba4,_0x33502e,_0x46a29e){return new BPromise(function(_0x199a8d,_0x338463){return client[_0xda1f('0xc')](_0x552ba4,_0x46a29e)[_0xda1f('0xd')](function(_0x1493f8){logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,'request\x20sent');logger[_0xda1f('0x10')](_0xda1f('0x11'),_0x33502e,_0xda1f('0x12'),JSON[_0xda1f('0x13')](_0x1493f8));if(_0x1493f8['error']){if(_0x1493f8['error'][_0xda1f('0x14')]===0x1f4){logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x338463(_0x1493f8['error'][_0xda1f('0x16')]);}logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x199a8d(_0x1493f8[_0xda1f('0x15')]['message']);}else{logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,_0xda1f('0x12'));_0x199a8d(_0x1493f8[_0xda1f('0x17')]['message']);}})['catch'](function(_0x3020ea){logger['error'](_0xda1f('0xf'),_0x33502e,_0x3020ea);_0x338463(_0x3020ea);});});}exports[_0xda1f('0x18')]=function(_0x1e10af){var _0x59b7bf=this;return new Promise(function(_0xe81fc2,_0xe18a0a){return db['VoiceTransferReport'][_0xda1f('0x19')](_0x1e10af[_0xda1f('0x1a')],{'raw':_0x1e10af['options']?_0x1e10af[_0xda1f('0x1b')][_0xda1f('0x1c')]===undefined?!![]:![]:!![]})[_0xda1f('0xd')](function(_0xe85e94){logger[_0xda1f('0xe')](_0xda1f('0x18'),_0x1e10af);logger[_0xda1f('0x10')](_0xda1f('0x18'),_0x1e10af,JSON[_0xda1f('0x13')](_0xe85e94));_0xe81fc2(_0xe85e94);})[_0xda1f('0x1d')](function(_0x1d510b){logger[_0xda1f('0x15')]('CreateVoiceTransferReport',_0x1d510b[_0xda1f('0x16')],_0x1e10af);_0xe18a0a(_0x59b7bf['error'](0x1f4,_0x1d510b[_0xda1f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 637689d..e987162 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1da1=['unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','originate','isAuthenticated','hangup','/hold','hold','/unhold'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x1da1,0x1a4));var _0x11da=function(_0x40dc95,_0x227d30){_0x40dc95=_0x40dc95-0x0;var _0x5355db=_0x1da1[_0x40dc95];return _0x5355db;};'use strict';var express=require(_0x11da('0x0'));var router=express[_0x11da('0x1')]();var auth=require(_0x11da('0x2'));var controller=require(_0x11da('0x3'));router[_0x11da('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0x6')]);router[_0x11da('0x4')]('/hangup',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0x8')]);router['post']('/answer',auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller['answer']);router[_0x11da('0x4')](_0x11da('0x9'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xa')]);router[_0x11da('0x4')](_0x11da('0xb'),auth[_0x11da('0x7')](),auth[_0x11da('0x5')](),controller[_0x11da('0xc')]);router[_0x11da('0x4')](_0x11da('0xd'),auth['isAuthenticated'](),auth[_0x11da('0x5')](),controller[_0x11da('0xe')]);router[_0x11da('0x4')](_0x11da('0xf'),auth[_0x11da('0x7')](),auth['canUpdate'](),controller[_0x11da('0x10')]);module[_0x11da('0x11')]=router; \ No newline at end of file +var _0xca8d=['hangup','/answer','/hold','hold','/unhold','unhold','/calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup'];(function(_0x50538a,_0x1c5dbb){var _0x23ae67=function(_0x433a72){while(--_0x433a72){_0x50538a['push'](_0x50538a['shift']());}};_0x23ae67(++_0x1c5dbb);}(_0xca8d,0x172));var _0xdca8=function(_0x1aa7b1,_0xe9e31d){_0x1aa7b1=_0x1aa7b1-0x0;var _0x5d4ff4=_0xca8d[_0x1aa7b1];return _0x5d4ff4;};'use strict';var express=require(_0xdca8('0x0'));var router=express[_0xdca8('0x1')]();var auth=require(_0xdca8('0x2'));var controller=require(_0xdca8('0x3'));router[_0xdca8('0x4')](_0xdca8('0x5'),auth[_0xdca8('0x6')](),auth[_0xdca8('0x7')](),controller[_0xdca8('0x8')]);router[_0xdca8('0x4')](_0xdca8('0x9'),auth[_0xdca8('0x6')](),auth['canUpdate'](),controller[_0xdca8('0xa')]);router[_0xdca8('0x4')](_0xdca8('0xb'),auth[_0xdca8('0x6')](),auth[_0xdca8('0x7')](),controller['answer']);router[_0xdca8('0x4')](_0xdca8('0xc'),auth[_0xdca8('0x6')](),auth['canUpdate'](),controller[_0xdca8('0xd')]);router[_0xdca8('0x4')](_0xdca8('0xe'),auth[_0xdca8('0x6')](),auth[_0xdca8('0x7')](),controller[_0xdca8('0xf')]);router[_0xdca8('0x4')](_0xdca8('0x10'),auth[_0xdca8('0x6')](),auth['canUpdate'](),controller['calls']);router[_0xdca8('0x4')](_0xdca8('0x11'),auth[_0xdca8('0x6')](),auth[_0xdca8('0x7')](),controller[_0xdca8('0x12')]);module[_0xdca8('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9c13998..70e0998 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15a9=['redis','defaults','localhost','socket.io-emitter','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','findOne','VoiceChannels','then','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','validate','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','all','filter','UserId','conference','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x15a9,0x18a));var _0x915a=function(_0x440807,_0x1a4ca4){_0x440807=_0x440807-0x0;var _0x54d077=_0x15a9[_0x440807];return _0x54d077;};'use strict';var path=require(_0x915a('0x0'));var fs=require('fs');var _=require(_0x915a('0x1'));var db=require(_0x915a('0x2'))['db'];var config=require(_0x915a('0x3'));var util=require('util');var BPromise=require(_0x915a('0x4'));var jayson=require(_0x915a('0x5'));var amiClient=jayson[_0x915a('0x6')][_0x915a('0x7')]({'port':0x232a});var logger=require(_0x915a('0x8'))(_0x915a('0x9'));var Redis=require(_0x915a('0xa'));config[_0x915a('0xb')]=_[_0x915a('0xc')](config[_0x915a('0xb')],{'host':_0x915a('0xd'),'port':0x18eb});var io=require(_0x915a('0xe'))(new Redis(config[_0x915a('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x915a('0xf')]},'callNumber':{'type':_0x915a('0x10'),'required':[!![],_0x915a('0x11')]},'callerId':{'type':_0x915a('0x10')},'callbackUrl':{'type':_0x915a('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],_0x915a('0xf')]},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],_0x915a('0xf')]},'sessionId':{'type':'string','required':[!![],_0x915a('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x915a('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],_0x915a('0xf')]},'sessionId':{'type':_0x915a('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x915a('0x12'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x276d83,_0x5c58ad,_0x4fbcfd){logger[_0x915a('0x15')](_0x276d83,_0x5c58ad,JSON[_0x915a('0x16')](_0x4fbcfd));io['to'](_0x276d83)[_0x915a('0x17')](_0x5c58ad,_0x4fbcfd);}function handleError(_0xab705f){return function(_0x143a4c){console[_0x915a('0x18')](_0x915a('0x19'),_0x143a4c,_0x143a4c instanceof RangeError);logger[_0x915a('0x1a')](_0x143a4c[_0x915a('0x1b')]);if(_0x143a4c instanceof RangeError){if(_0x143a4c['name']){delete _0x143a4c[_0x915a('0x1c')];}_0xab705f[_0x915a('0x1d')](0x194)[_0x915a('0x1e')](_0x143a4c);}else{if(_0x143a4c[_0x915a('0x1c')]){delete _0x143a4c['name'];}_0xab705f['status'](0x1f4)['send'](_0x143a4c);}};}function checkError(){return function(_0x5a520c){if(!_0x5a520c){throw new RangeError(_0x915a('0x1f'));}return _0x5a520c;};}function respondWithRpcPromise(_0x3b4af9,_0x583c17){return new BPromise(function(_0x1e35b8,_0x1689f7){var _0x3e3f49=amiClient;return _0x3e3f49[_0x915a('0x20')](_0x3b4af9,_0x583c17)['then'](function(_0x2595f8){if(_0x2595f8[_0x915a('0x1a')]){if(_0x2595f8[_0x915a('0x1a')][_0x915a('0x21')]===0x1f4){return _0x1689f7(_0x2595f8[_0x915a('0x1a')]['message']);}return _0x1e35b8(_0x2595f8[_0x915a('0x1a')][_0x915a('0x22')]);}else{_0x1e35b8(_0x2595f8[_0x915a('0x23')]);}})[_0x915a('0x24')](function(_0x5cbf7e){_0x1689f7(_0x5cbf7e);});});}function getAgent(_0x185d9f){return db['User'][_0x915a('0x25')]({'where':{'id':_0x185d9f,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x4a6000,_0x3cfd93){return new BPromise(function(_0x3233bb,_0x343319){var _0x22166a=respondWithRpcPromise(_0x915a('0x26'));var _0x5c8c41=getAgent(_0x4a6000);Promise['all']([_0x22166a,_0x5c8c41])[_0x915a('0x27')](function(_0x55d16b){var _0x41696f=_0x55d16b[0x0];var _0x134251=_0x55d16b[0x1];var _0x42015e=_['filter'](_0x41696f[_0x915a('0x28')],function(_0x2cee01){return _0x2cee01['UserId']==_0x134251['id']&&_0x2cee01[_0x915a('0x29')]==_0x3cfd93;});if(_0x42015e[_0x915a('0x2a')]==0x1){_0x3233bb(_0x134251);}else{_0x343319(new RangeError(_0x915a('0x2b')+_0x3cfd93+_0x915a('0x2c')));}});});}exports['originate']=function(_0x4eb849,_0x5eadb7){logger['info'](_0x915a('0x2d'),_0x4eb849[_0x915a('0x2e')]);var _0x19a938=originateValidation['validate'](_0x4eb849[_0x915a('0x2e')]);if(_0x19a938[_0x915a('0x2a')]>0x0){return _0x5eadb7[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x19a938);}var _0x2bf77b=_0x4eb849[_0x915a('0x2e')][_0x915a('0x30')];var _0x3f70c5=_0x4eb849[_0x915a('0x2e')][_0x915a('0x31')];var _0x18ef8e=_0x4eb849['body'][_0x915a('0x32')];var _0x49a5e9=_0x4eb849['body'][_0x915a('0x33')];return getAgent(_0x2bf77b)['then'](function(_0x2352a3){logger[_0x915a('0x15')](_0x915a('0x34'),_0x2352a3[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x2352a3[_0x915a('0x1c')]),_0x915a('0x37'),{'callNumber':_0x3f70c5,'callerId':_0x18ef8e,'callbackUrl':_0x49a5e9});return _0x5eadb7[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x38')});})[_0x915a('0x24')](handleError(_0x5eadb7));};exports['hangup']=function(_0x562be2,_0x2d710d){logger[_0x915a('0x15')](_0x915a('0x39'),_0x562be2[_0x915a('0x2e')]);var _0x19ba2f=hangupValidation[_0x915a('0x3a')](_0x562be2[_0x915a('0x2e')]);if(_0x19ba2f[_0x915a('0x2a')]>0x0){return _0x2d710d[_0x915a('0x1d')](0x190)['json'](_0x19ba2f);}var _0x4739e7=_0x562be2[_0x915a('0x2e')]['userId'];var _0x5bd8a7=_0x562be2[_0x915a('0x2e')][_0x915a('0x29')];return getAgent(_0x4739e7)['then'](function(_0x35afcc){logger[_0x915a('0x15')](_0x915a('0x34'),_0x35afcc[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x35afcc[_0x915a('0x1c')]),_0x915a('0x3b'),{'sessionId':_0x5bd8a7});return _0x2d710d['status'](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x3c')});})[_0x915a('0x24')](handleError(_0x2d710d));};exports['answer']=function(_0x2a2a61,_0x1f4bac){logger[_0x915a('0x15')](_0x915a('0x3d'),_0x2a2a61['body']);var _0x9acab9=answerValidation[_0x915a('0x3a')](_0x2a2a61[_0x915a('0x2e')]);if(_0x9acab9[_0x915a('0x2a')]>0x0){return _0x1f4bac[_0x915a('0x1d')](0x190)['json'](_0x9acab9);}var _0x3f1558=_0x2a2a61[_0x915a('0x2e')][_0x915a('0x30')];var _0x540ee3=_0x2a2a61[_0x915a('0x2e')]['sessionId'];return getAgent(_0x3f1558)[_0x915a('0x27')](function(_0x38b7a6){logger['info']('entityFound:',_0x38b7a6[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x38b7a6['name']),_0x915a('0x3e'),{'sessionId':_0x540ee3});return _0x1f4bac[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x3f')});})[_0x915a('0x24')](handleError(_0x1f4bac));};exports[_0x915a('0x40')]=function(_0x3b89f,_0x372c37){logger[_0x915a('0x15')](_0x915a('0x41'),_0x3b89f['body']);var _0x8128b5=holdValidation[_0x915a('0x3a')](_0x3b89f[_0x915a('0x2e')]);if(_0x8128b5['length']>0x0){return _0x372c37[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x8128b5);}var _0x48f658=_0x3b89f[_0x915a('0x2e')][_0x915a('0x30')];var _0x2efc93=_0x3b89f[_0x915a('0x2e')][_0x915a('0x29')];return getAgent(_0x48f658)[_0x915a('0x27')](function(_0x57cdf6){logger[_0x915a('0x15')]('entityFound:',_0x57cdf6[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x57cdf6['name']),_0x915a('0x42'),{'sessionId':_0x2efc93});return _0x372c37[_0x915a('0x1d')](0xc8)['json']({'error':![],'message':_0x915a('0x43')});})['catch'](handleError(_0x372c37));};exports[_0x915a('0x44')]=function(_0x38f337,_0x402f9c){logger[_0x915a('0x15')](_0x915a('0x45'),_0x38f337['body']);var _0x276fe2=unholdValidation[_0x915a('0x3a')](_0x38f337[_0x915a('0x2e')]);if(_0x276fe2[_0x915a('0x2a')]>0x0){return _0x402f9c[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x276fe2);}var _0x5f2437=_0x38f337['body']['userId'];var _0x54af60=_0x38f337[_0x915a('0x2e')][_0x915a('0x29')];return getAgent(_0x5f2437)['then'](function(_0x3b8887){logger[_0x915a('0x15')](_0x915a('0x34'),_0x3b8887[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x3b8887['name']),'webbar:unhold',{'sessionId':_0x54af60});return _0x402f9c[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x402f9c));};exports[_0x915a('0x46')]=function(_0x3bbae5,_0x3bcdf5){logger[_0x915a('0x15')](_0x915a('0x47'),_0x3bcdf5[_0x915a('0x2e')]);var _0x3eac1f=callsValidation[_0x915a('0x3a')](_0x3bbae5['body']);if(_0x3eac1f[_0x915a('0x2a')]>0x0){return _0x3bcdf5[_0x915a('0x1d')](0x190)['json'](_0x3eac1f);}var _0x2da7d7=_0x3bbae5['body'][_0x915a('0x30')];var _0x4795f0=respondWithRpcPromise(_0x915a('0x26'));var _0x2fb10f=getAgent(_0x2da7d7);return Promise[_0x915a('0x48')]([_0x4795f0,_0x2fb10f])['then'](function(_0x575bc3){var _0x1f1d93=_0x575bc3[0x0];var _0x359a5f=_0x575bc3[0x1];var _0x3a5964=_[_0x915a('0x49')](_0x1f1d93['rows'],function(_0x51a6b4){return _0x51a6b4[_0x915a('0x4a')]==_0x359a5f['id'];});return _0x3bcdf5[_0x915a('0x1d')](0xc8)['json']({'count':_0x3a5964[_0x915a('0x2a')],'rows':_0x3a5964});})[_0x915a('0x24')](handleError(_0x3bcdf5));};exports[_0x915a('0x4b')]=function(_0x51870a,_0x16f3d3){logger[_0x915a('0x15')]('conference\x20fired:',_0x51870a[_0x915a('0x2e')]);var _0x5a0dd7=conferenceValidation[_0x915a('0x3a')](_0x51870a['body']);if(_0x5a0dd7[_0x915a('0x2a')]>0x0){return _0x16f3d3[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x5a0dd7);}var _0xd18c21=_0x51870a[_0x915a('0x2e')]['userId'];return getAgent(_0xd18c21)[_0x915a('0x27')](function(_0x4dfc4e){logger[_0x915a('0x15')]('entityFound:',_0x4dfc4e['name']);emit(util['format'](_0x915a('0x36'),_0x4dfc4e[_0x915a('0x1c')]),_0x915a('0x4c'));return _0x16f3d3[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':'conference\x20executed!'});})[_0x915a('0x24')](handleError(_0x16f3d3));};exports[_0x915a('0x4d')]=function(_0x587d5d,_0x28328b){logger['info']('transfer\x20fired:',_0x587d5d['body']);var _0x4ff160=transferValidation[_0x915a('0x3a')](_0x587d5d[_0x915a('0x2e')]);if(_0x4ff160['length']>0x0){return _0x28328b[_0x915a('0x1d')](0x190)[_0x915a('0x2f')](_0x4ff160);}var _0x43ea73=_0x587d5d['body'][_0x915a('0x30')];var _0x1a6a53=_0x587d5d[_0x915a('0x2e')][_0x915a('0x29')];var _0x4a4fc3=_0x587d5d[_0x915a('0x2e')][_0x915a('0x4e')];return getAgent(_0x43ea73)['then'](function(_0x4be0c6){logger[_0x915a('0x15')](_0x915a('0x34'),_0x4be0c6[_0x915a('0x1c')]);emit(util[_0x915a('0x35')](_0x915a('0x36'),_0x4be0c6[_0x915a('0x1c')]),_0x915a('0x4f'),{'sessionId':_0x1a6a53,'transferNumber':_0x4a4fc3});return _0x28328b[_0x915a('0x1d')](0xc8)[_0x915a('0x2f')]({'error':![],'message':_0x915a('0x50')});})['catch'](handleError(_0x28328b));}; \ No newline at end of file +var _0x3dbb=['rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','webbar:originate','catch','hangup\x20fired:','format','hangup\x20executed!','entityFound:','user:%s','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','UserId','conference\x20fired:','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../config/environment','util','jayson/promise','client','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','number','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','send','status','NotFound','then','code','message','User','findOne','agent','VoiceChannels','all','filter'];(function(_0x28c215,_0x168a07){var _0x3074f4=function(_0x19b30a){while(--_0x19b30a){_0x28c215['push'](_0x28c215['shift']());}};_0x3074f4(++_0x168a07);}(_0x3dbb,0x67));var _0xb3db=function(_0x3ab99a,_0x3ce898){_0x3ab99a=_0x3ab99a-0x0;var _0x454822=_0x3dbb[_0x3ab99a];return _0x454822;};'use strict';var path=require(_0xb3db('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xb3db('0x1'));var util=require(_0xb3db('0x2'));var BPromise=require('bluebird');var jayson=require(_0xb3db('0x3'));var amiClient=jayson[_0xb3db('0x4')][_0xb3db('0x5')]({'port':0x232a});var logger=require(_0xb3db('0x6'))('webbarapi');var Redis=require(_0xb3db('0x7'));config['redis']=_['defaults'](config[_0xb3db('0x8')],{'host':_0xb3db('0x9'),'port':0x18eb});var io=require(_0xb3db('0xa'))(new Redis(config['redis']));var Schema=require(_0xb3db('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb3db('0xc')]},'callNumber':{'type':_0xb3db('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xb3db('0xd')},'callbackUrl':{'type':_0xb3db('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb3db('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],_0xb3db('0xc')]},'sessionId':{'type':_0xb3db('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb3db('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xb3db('0xd'),'required':[!![],_0xb3db('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xb3db('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],_0xb3db('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb3db('0xe'),'required':[!![],_0xb3db('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb3db('0xc')]}});function emit(_0x140063,_0x20b31f,_0x3cb72c){logger[_0xb3db('0x10')](_0x140063,_0x20b31f,JSON[_0xb3db('0x11')](_0x3cb72c));io['to'](_0x140063)['emit'](_0x20b31f,_0x3cb72c);}function handleError(_0x415157){return function(_0x40939f){console[_0xb3db('0x12')](_0xb3db('0x13'),_0x40939f,_0x40939f instanceof RangeError);logger[_0xb3db('0x14')](_0x40939f[_0xb3db('0x15')]);if(_0x40939f instanceof RangeError){if(_0x40939f[_0xb3db('0x16')]){delete _0x40939f[_0xb3db('0x16')];}_0x415157['status'](0x194)[_0xb3db('0x17')](_0x40939f);}else{if(_0x40939f[_0xb3db('0x16')]){delete _0x40939f[_0xb3db('0x16')];}_0x415157[_0xb3db('0x18')](0x1f4)['send'](_0x40939f);}};}function checkError(){return function(_0x458f9f){if(!_0x458f9f){throw new RangeError(_0xb3db('0x19'));}return _0x458f9f;};}function respondWithRpcPromise(_0x33e33a,_0x7fc1a7){return new BPromise(function(_0x80f75e,_0x52d719){var _0x29c9f6=amiClient;return _0x29c9f6['request'](_0x33e33a,_0x7fc1a7)[_0xb3db('0x1a')](function(_0x3a8d67){if(_0x3a8d67[_0xb3db('0x14')]){if(_0x3a8d67['error'][_0xb3db('0x1b')]===0x1f4){return _0x52d719(_0x3a8d67[_0xb3db('0x14')][_0xb3db('0x1c')]);}return _0x80f75e(_0x3a8d67[_0xb3db('0x14')][_0xb3db('0x1c')]);}else{_0x80f75e(_0x3a8d67['result']);}})['catch'](function(_0x3db9a5){_0x52d719(_0x3db9a5);});});}function getAgent(_0x40e400){return db[_0xb3db('0x1d')][_0xb3db('0x1e')]({'where':{'id':_0x40e400,'role':_0xb3db('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x34bbb5,_0x102434){return new BPromise(function(_0x3c7533,_0x13697d){var _0x3045fc=respondWithRpcPromise(_0xb3db('0x20'));var _0x10e761=getAgent(_0x34bbb5);Promise[_0xb3db('0x21')]([_0x3045fc,_0x10e761])[_0xb3db('0x1a')](function(_0x287774){var _0x43596c=_0x287774[0x0];var _0x1844ec=_0x287774[0x1];var _0x417083=_[_0xb3db('0x22')](_0x43596c[_0xb3db('0x23')],function(_0x2baf84){return _0x2baf84['UserId']==_0x1844ec['id']&&_0x2baf84[_0xb3db('0x24')]==_0x102434;});if(_0x417083[_0xb3db('0x25')]==0x1){_0x3c7533(_0x1844ec);}else{_0x13697d(new RangeError(_0xb3db('0x26')+_0x102434+_0xb3db('0x27')));}});});}exports[_0xb3db('0x28')]=function(_0x5a8ce6,_0x5dfb8b){logger[_0xb3db('0x10')](_0xb3db('0x29'),_0x5a8ce6[_0xb3db('0x2a')]);var _0x19405c=originateValidation[_0xb3db('0xb')](_0x5a8ce6[_0xb3db('0x2a')]);if(_0x19405c['length']>0x0){return _0x5dfb8b[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x19405c);}var _0x3b9ceb=_0x5a8ce6['body'][_0xb3db('0x2c')];var _0x253033=_0x5a8ce6[_0xb3db('0x2a')][_0xb3db('0x2d')];var _0x480c89=_0x5a8ce6['body'][_0xb3db('0x2e')];var _0x5a9a66=_0x5a8ce6[_0xb3db('0x2a')][_0xb3db('0x2f')];return getAgent(_0x3b9ceb)['then'](function(_0x4d69b5){logger[_0xb3db('0x10')]('entityFound:',_0x4d69b5[_0xb3db('0x16')]);emit(util['format']('user:%s',_0x4d69b5[_0xb3db('0x16')]),_0xb3db('0x30'),{'callNumber':_0x253033,'callerId':_0x480c89,'callbackUrl':_0x5a9a66});return _0x5dfb8b['status'](0xc8)[_0xb3db('0x2b')]({'error':![],'message':'originate\x20executed!'});})[_0xb3db('0x31')](handleError(_0x5dfb8b));};exports['hangup']=function(_0x3c83b7,_0x1b9343){logger['info'](_0xb3db('0x32'),_0x3c83b7[_0xb3db('0x2a')]);var _0xfb8425=hangupValidation[_0xb3db('0xb')](_0x3c83b7[_0xb3db('0x2a')]);if(_0xfb8425['length']>0x0){return _0x1b9343[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0xfb8425);}var _0x403099=_0x3c83b7[_0xb3db('0x2a')]['userId'];var _0x43355e=_0x3c83b7[_0xb3db('0x2a')]['sessionId'];return getAgent(_0x403099)[_0xb3db('0x1a')](function(_0xfa15f8){logger['info']('entityFound:',_0xfa15f8[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')]('user:%s',_0xfa15f8['name']),'webbar:hangup',{'sessionId':_0x43355e});return _0x1b9343['status'](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x34')});})[_0xb3db('0x31')](handleError(_0x1b9343));};exports['answer']=function(_0x42898c,_0x47654a){logger[_0xb3db('0x10')]('answer\x20fired:',_0x42898c['body']);var _0x27ffc0=answerValidation['validate'](_0x42898c[_0xb3db('0x2a')]);if(_0x27ffc0[_0xb3db('0x25')]>0x0){return _0x47654a[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x27ffc0);}var _0xc65a28=_0x42898c['body'][_0xb3db('0x2c')];var _0x84b216=_0x42898c[_0xb3db('0x2a')][_0xb3db('0x24')];return getAgent(_0xc65a28)['then'](function(_0xb146bd){logger[_0xb3db('0x10')](_0xb3db('0x35'),_0xb146bd[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')](_0xb3db('0x36'),_0xb146bd[_0xb3db('0x16')]),'webbar:answer',{'sessionId':_0x84b216});return _0x47654a['status'](0xc8)['json']({'error':![],'message':_0xb3db('0x37')});})['catch'](handleError(_0x47654a));};exports[_0xb3db('0x38')]=function(_0x352658,_0x317dc6){logger[_0xb3db('0x10')](_0xb3db('0x39'),_0x352658['body']);var _0xb092df=holdValidation[_0xb3db('0xb')](_0x352658[_0xb3db('0x2a')]);if(_0xb092df[_0xb3db('0x25')]>0x0){return _0x317dc6[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0xb092df);}var _0x442151=_0x352658[_0xb3db('0x2a')][_0xb3db('0x2c')];var _0x78097=_0x352658[_0xb3db('0x2a')]['sessionId'];return getAgent(_0x442151)[_0xb3db('0x1a')](function(_0x141886){logger[_0xb3db('0x10')](_0xb3db('0x35'),_0x141886[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')](_0xb3db('0x36'),_0x141886[_0xb3db('0x16')]),_0xb3db('0x3a'),{'sessionId':_0x78097});return _0x317dc6[_0xb3db('0x18')](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x3b')});})['catch'](handleError(_0x317dc6));};exports['unhold']=function(_0x39c2d8,_0x3165c9){logger[_0xb3db('0x10')](_0xb3db('0x3c'),_0x39c2d8[_0xb3db('0x2a')]);var _0x33e8e3=unholdValidation[_0xb3db('0xb')](_0x39c2d8[_0xb3db('0x2a')]);if(_0x33e8e3['length']>0x0){return _0x3165c9['status'](0x190)[_0xb3db('0x2b')](_0x33e8e3);}var _0x2120ae=_0x39c2d8['body'][_0xb3db('0x2c')];var _0x1b5bca=_0x39c2d8[_0xb3db('0x2a')]['sessionId'];return getAgent(_0x2120ae)[_0xb3db('0x1a')](function(_0x2353e2){logger['info'](_0xb3db('0x35'),_0x2353e2[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')](_0xb3db('0x36'),_0x2353e2[_0xb3db('0x16')]),'webbar:unhold',{'sessionId':_0x1b5bca});return _0x3165c9['status'](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x3d')});})[_0xb3db('0x31')](handleError(_0x3165c9));};exports['calls']=function(_0xd1a45,_0x4cf00c){logger[_0xb3db('0x10')](_0xb3db('0x3e'),_0x4cf00c[_0xb3db('0x2a')]);var _0x392ad0=callsValidation['validate'](_0xd1a45[_0xb3db('0x2a')]);if(_0x392ad0[_0xb3db('0x25')]>0x0){return _0x4cf00c['status'](0x190)[_0xb3db('0x2b')](_0x392ad0);}var _0x363b68=_0xd1a45[_0xb3db('0x2a')][_0xb3db('0x2c')];var _0x21ab77=respondWithRpcPromise(_0xb3db('0x20'));var _0x584709=getAgent(_0x363b68);return Promise[_0xb3db('0x21')]([_0x21ab77,_0x584709])[_0xb3db('0x1a')](function(_0x3c83b5){var _0x50f56f=_0x3c83b5[0x0];var _0xde281=_0x3c83b5[0x1];var _0x46025b=_[_0xb3db('0x22')](_0x50f56f[_0xb3db('0x23')],function(_0x4864bc){return _0x4864bc[_0xb3db('0x3f')]==_0xde281['id'];});return _0x4cf00c[_0xb3db('0x18')](0xc8)[_0xb3db('0x2b')]({'count':_0x46025b[_0xb3db('0x25')],'rows':_0x46025b});})[_0xb3db('0x31')](handleError(_0x4cf00c));};exports['conference']=function(_0x24756d,_0x13409a){logger[_0xb3db('0x10')](_0xb3db('0x40'),_0x24756d['body']);var _0x5e87e6=conferenceValidation['validate'](_0x24756d[_0xb3db('0x2a')]);if(_0x5e87e6[_0xb3db('0x25')]>0x0){return _0x13409a[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x5e87e6);}var _0x74b31d=_0x24756d[_0xb3db('0x2a')][_0xb3db('0x2c')];return getAgent(_0x74b31d)[_0xb3db('0x1a')](function(_0x50c574){logger['info'](_0xb3db('0x35'),_0x50c574[_0xb3db('0x16')]);emit(util[_0xb3db('0x33')]('user:%s',_0x50c574['name']),'webbar:conference');return _0x13409a[_0xb3db('0x18')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xb3db('0x31')](handleError(_0x13409a));};exports[_0xb3db('0x41')]=function(_0x125fe1,_0x2cd4c9){logger[_0xb3db('0x10')]('transfer\x20fired:',_0x125fe1[_0xb3db('0x2a')]);var _0x31b0bc=transferValidation[_0xb3db('0xb')](_0x125fe1[_0xb3db('0x2a')]);if(_0x31b0bc[_0xb3db('0x25')]>0x0){return _0x2cd4c9[_0xb3db('0x18')](0x190)[_0xb3db('0x2b')](_0x31b0bc);}var _0x5c7c8a=_0x125fe1[_0xb3db('0x2a')][_0xb3db('0x2c')];var _0x3b9228=_0x125fe1['body'][_0xb3db('0x24')];var _0x49ef4a=_0x125fe1[_0xb3db('0x2a')][_0xb3db('0x42')];return getAgent(_0x5c7c8a)[_0xb3db('0x1a')](function(_0x33f9eb){logger['info'](_0xb3db('0x35'),_0x33f9eb['name']);emit(util[_0xb3db('0x33')]('user:%s',_0x33f9eb[_0xb3db('0x16')]),_0xb3db('0x43'),{'sessionId':_0x3b9228,'transferNumber':_0x49ef4a});return _0x2cd4c9[_0xb3db('0x18')](0xc8)[_0xb3db('0x2b')]({'error':![],'message':_0xb3db('0x44')});})[_0xb3db('0x31')](handleError(_0x2cd4c9));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 1d98d92..da74b2b 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6b5=['../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/canned_answers','getAgents','getApplications','post','/:id/dispositions','addDisposition','/:id/users','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4d79ca,_0x413286){var _0x57af1f=function(_0x5df6f3){while(--_0x5df6f3){_0x4d79ca['push'](_0x4d79ca['shift']());}};_0x57af1f(++_0x413286);}(_0xd6b5,0xc5));var _0x5d6b=function(_0x362400,_0x231f5c){_0x362400=_0x362400-0x0;var _0x11de1a=_0xd6b5[_0x362400];return _0x11de1a;};'use strict';var multer=require(_0x5d6b('0x0'));var util=require(_0x5d6b('0x1'));var path=require(_0x5d6b('0x2'));var timeout=require(_0x5d6b('0x3'));var express=require(_0x5d6b('0x4'));var router=express[_0x5d6b('0x5')]();var fs_extra=require(_0x5d6b('0x6'));var auth=require(_0x5d6b('0x7'));var interaction=require(_0x5d6b('0x8'));var config=require('../../config/environment');var controller=require(_0x5d6b('0x9'));router['get']('/',auth[_0x5d6b('0xa')](),controller['index']);router[_0x5d6b('0xb')](_0x5d6b('0xc'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0xd')]);router[_0x5d6b('0xb')](_0x5d6b('0xe'),auth['isAuthenticated'](),controller[_0x5d6b('0xf')]);router[_0x5d6b('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x5d6b('0xb')](_0x5d6b('0x10'),auth[_0x5d6b('0xa')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x11')]);router[_0x5d6b('0xb')]('/:id/applications',auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x12')]);router['post']('/',auth[_0x5d6b('0xa')](),controller['create']);router[_0x5d6b('0x13')](_0x5d6b('0x14'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x15')]);router[_0x5d6b('0x13')]('/:id/canned_answers',auth[_0x5d6b('0xa')](),controller['addAnswer']);router[_0x5d6b('0x13')](_0x5d6b('0x16'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x17')]);router[_0x5d6b('0x13')](_0x5d6b('0x18'),auth['isAuthenticated'](),controller[_0x5d6b('0x19')]);router[_0x5d6b('0x13')]('/:id/notify',controller[_0x5d6b('0x1a')]);router[_0x5d6b('0x13')](_0x5d6b('0x1b'),auth[_0x5d6b('0xa')](),controller['send']);router[_0x5d6b('0x1c')](_0x5d6b('0xe'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x1d')]);router[_0x5d6b('0x1e')](_0x5d6b('0xe'),auth[_0x5d6b('0xa')](),controller['destroy']);router['delete'](_0x5d6b('0x14'),auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x1f')]);router[_0x5d6b('0x1e')]('/:id/canned_answers',auth[_0x5d6b('0xa')](),controller[_0x5d6b('0x20')]);router[_0x5d6b('0x1e')](_0x5d6b('0x16'),auth[_0x5d6b('0xa')](),controller['removeAgents']);module[_0x5d6b('0x21')]=router; \ No newline at end of file +var _0xa37a=['/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','notify','/:id/send','send','put'];(function(_0x4ae6f1,_0x59ef51){var _0x35efe2=function(_0x26f3fc){while(--_0x26f3fc){_0x4ae6f1['push'](_0x4ae6f1['shift']());}};_0x35efe2(++_0x59ef51);}(_0xa37a,0x1e8));var _0xaa37=function(_0x3ca006,_0x3f1f13){_0x3ca006=_0x3ca006-0x0;var _0x2995da=_0xa37a[_0x3ca006];return _0x2995da;};'use strict';var multer=require(_0xaa37('0x0'));var util=require('util');var path=require(_0xaa37('0x1'));var timeout=require(_0xaa37('0x2'));var express=require(_0xaa37('0x3'));var router=express[_0xaa37('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaa37('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa37('0x6'));var controller=require(_0xaa37('0x7'));router[_0xaa37('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaa37('0x8')](_0xaa37('0x9'),auth[_0xaa37('0xa')](),controller[_0xaa37('0xb')]);router[_0xaa37('0x8')]('/:id',auth[_0xaa37('0xa')](),controller[_0xaa37('0xc')]);router['get'](_0xaa37('0xd'),auth['isAuthenticated'](),controller[_0xaa37('0xe')]);router[_0xaa37('0x8')](_0xaa37('0xf'),auth['isAuthenticated'](),controller[_0xaa37('0x10')]);router[_0xaa37('0x8')](_0xaa37('0x11'),auth[_0xaa37('0xa')](),controller['getAgents']);router[_0xaa37('0x8')](_0xaa37('0x12'),auth[_0xaa37('0xa')](),controller[_0xaa37('0x13')]);router[_0xaa37('0x14')]('/',auth['isAuthenticated'](),controller[_0xaa37('0x15')]);router[_0xaa37('0x14')](_0xaa37('0xd'),auth[_0xaa37('0xa')](),controller[_0xaa37('0x16')]);router['post'](_0xaa37('0xf'),auth[_0xaa37('0xa')](),controller[_0xaa37('0x17')]);router[_0xaa37('0x14')](_0xaa37('0x11'),auth[_0xaa37('0xa')](),controller[_0xaa37('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xaa37('0x19')]);router['post']('/:id/notify',controller[_0xaa37('0x1a')]);router['post'](_0xaa37('0x1b'),auth['isAuthenticated'](),controller[_0xaa37('0x1c')]);router[_0xaa37('0x1d')](_0xaa37('0x1e'),auth[_0xaa37('0xa')](),controller['update']);router[_0xaa37('0x1f')](_0xaa37('0x1e'),auth['isAuthenticated'](),controller[_0xaa37('0x20')]);router['delete']('/:id/dispositions',auth[_0xaa37('0xa')](),controller[_0xaa37('0x21')]);router[_0xaa37('0x1f')](_0xaa37('0xf'),auth[_0xaa37('0xa')](),controller[_0xaa37('0x22')]);router['delete']('/:id/users',auth[_0xaa37('0xa')](),controller[_0xaa37('0x23')]);module[_0xaa37('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 413dac3..0647a42 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ed3=['mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId'];(function(_0x4e2bc6,_0x5e2401){var _0x59357a=function(_0x437f8c){while(--_0x437f8c){_0x4e2bc6['push'](_0x4e2bc6['shift']());}};_0x59357a(++_0x5e2401);}(_0x6ed3,0xe8));var _0x36ed=function(_0x4d121d,_0x3fe733){_0x4d121d=_0x4d121d-0x0;var _0xffa031=_0x6ed3[_0x4d121d];return _0xffa031;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x36ed('0x0')]={'name':{'type':Sequelize[_0x36ed('0x1')],'unique':_0x36ed('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x36ed('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x36ed('0x3')]();}},'phone':{'type':Sequelize[_0x36ed('0x1')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x36ed('0x1')]},'authToken':{'type':Sequelize[_0x36ed('0x1')]},'notificationTemplate':{'type':Sequelize[_0x36ed('0x4')],'defaultValue':function(){return _0x36ed('0x5');}},'notificationSound':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x36ed('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x36ed('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x36ed('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12025b){if(!_0x12025b){this[_0x36ed('0x8')](_0x36ed('0x9'),null);}this[_0x36ed('0x8')](_0x36ed('0xa'),_0x12025b);}},'description':{'type':Sequelize[_0x36ed('0x1')]}}; \ No newline at end of file +var _0xdd17=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','mandatoryDispositionPauseId'];(function(_0x1f4827,_0x2e1e94){var _0x19a10d=function(_0x2c5c27){while(--_0x2c5c27){_0x1f4827['push'](_0x1f4827['shift']());}};_0x19a10d(++_0x2e1e94);}(_0xdd17,0x66));var _0x7dd1=function(_0x211679,_0x484f81){_0x211679=_0x211679-0x0;var _0x19b622=_0xdd17[_0x211679];return _0x19b622;};'use strict';var Sequelize=require(_0x7dd1('0x0'));var rs=require(_0x7dd1('0x1'));module[_0x7dd1('0x2')]={'name':{'type':Sequelize[_0x7dd1('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7dd1('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7dd1('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7dd1('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7dd1('0x4');}},'notificationSound':{'type':Sequelize[_0x7dd1('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7dd1('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7dd1('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7dd1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7dd1('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7dd1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7dd1('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2e74a1){if(!_0x2e74a1){this['setDataValue'](_0x7dd1('0x7'),null);}this[_0x7dd1('0x8')](_0x7dd1('0x9'),_0x2e74a1);}},'description':{'type':Sequelize[_0x7dd1('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a1d13a9..d2d6183 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc79f=['destroy','stack','name','send','render','merge','contact','agent','account','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','includeAll','findAll','rows','show','params','keys','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','order','WhatsappAccountId','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','transaction','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','Applications','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','mobile','from','From','replace','Body','MessageSid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','WhatsappMessage','messageId','AttachmentId','UserId','unshift','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','set','Content-Type','text/xml','\x0a','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','UserProfileResource'];(function(_0x5ed54f,_0x104679){var _0x4b2023=function(_0x5a570c){while(--_0x5a570c){_0x5ed54f['push'](_0x5ed54f['shift']());}};_0x4b2023(++_0x104679);}(_0xc79f,0x82));var _0xfc79=function(_0x2bf635,_0x454fe4){_0x2bf635=_0x2bf635-0x0;var _0xfed6a=_0xc79f[_0x2bf635];return _0xfed6a;};'use strict';var emlformat=require(_0xfc79('0x0'));var rimraf=require(_0xfc79('0x1'));var zipdir=require(_0xfc79('0x2'));var jsonpatch=require(_0xfc79('0x3'));var rp=require(_0xfc79('0x4'));var moment=require('moment');var BPromise=require(_0xfc79('0x5'));var Mustache=require(_0xfc79('0x6'));var util=require(_0xfc79('0x7'));var path=require(_0xfc79('0x8'));var sox=require(_0xfc79('0x9'));var csv=require(_0xfc79('0xa'));var ejs=require(_0xfc79('0xb'));var fs=require('fs');var fs_extra=require(_0xfc79('0xc'));var _=require(_0xfc79('0xd'));var squel=require('squel');var crypto=require(_0xfc79('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc79('0xf'));var toCsv=require(_0xfc79('0xa'));var querystring=require(_0xfc79('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc79('0x11'));var authService=require(_0xfc79('0x12'));var qs=require(_0xfc79('0x13'));var as=require(_0xfc79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc79('0x15'))(_0xfc79('0x16'));var utils=require(_0xfc79('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc79('0x18'));var db=require(_0xfc79('0x19'))['db'];config['redis']=_[_0xfc79('0x1a')](config['redis'],{'host':_0xfc79('0x1b'),'port':0x18eb});var socket=require(_0xfc79('0x1c'))(new Redis(config[_0xfc79('0x1d')]));require('./whatsappAccount.socket')[_0xfc79('0x1e')](socket);var jayson=require(_0xfc79('0x1f'));var client=jayson[_0xfc79('0x20')][_0xfc79('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x895b17,_0x7ef734,_0x4cb052,_0x228dab){return new BPromise(function(_0x4625da,_0x44e29e){var _0x322972=_0x228dab||client;return _0x322972['request'](_0x895b17,_0x4cb052)[_0xfc79('0x22')](function(_0x2eebdc){logger[_0xfc79('0x23')](_0xfc79('0x24'),_0x7ef734,'request\x20sent');logger['debug'](_0xfc79('0x25'),_0x7ef734,'request\x20sent',JSON[_0xfc79('0x26')](_0x2eebdc));if(_0x2eebdc[_0xfc79('0x27')]){if(_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x28')]===0x1f4){logger['error'](_0xfc79('0x24'),_0x7ef734,_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x29')]);return _0x44e29e(_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x29')]);}logger[_0xfc79('0x27')](_0xfc79('0x24'),_0x7ef734,_0x2eebdc['error'][_0xfc79('0x29')]);return _0x4625da(_0x2eebdc[_0xfc79('0x27')][_0xfc79('0x29')]);}else{logger[_0xfc79('0x23')](_0xfc79('0x24'),_0x7ef734,'request\x20sent');_0x4625da(_0x2eebdc['result']['message']);}})[_0xfc79('0x2a')](function(_0x3dc4e4){logger[_0xfc79('0x27')](_0xfc79('0x24'),_0x7ef734,_0x3dc4e4);_0x44e29e(_0x3dc4e4);});});}function respondWithStatusCode(_0x5dcf36,_0x1c152){_0x1c152=_0x1c152||0xcc;return function(_0x5ca265){if(_0x5ca265){return _0x5dcf36[_0xfc79('0x2b')](_0x1c152);}return _0x5dcf36['status'](_0x1c152)[_0xfc79('0x2c')]();};}function respondWithResult(_0x3206fb,_0x96ceeb){_0x96ceeb=_0x96ceeb||0xc8;return function(_0x523270){if(_0x523270){return _0x3206fb[_0xfc79('0x2d')](_0x96ceeb)[_0xfc79('0x2e')](_0x523270);}};}function respondWithFilteredResult(_0x168ec2,_0x3a8ca3){return function(_0x2ae979){if(_0x2ae979){var _0x158b2f=typeof _0x3a8ca3[_0xfc79('0x2f')]==='undefined'&&typeof _0x3a8ca3[_0xfc79('0x30')]===_0xfc79('0x31');var _0x333af1=_0x2ae979[_0xfc79('0x32')];var _0x52212b=_0x158b2f?0x0:_0x3a8ca3[_0xfc79('0x2f')];var _0x106f1a=_0x158b2f?_0x2ae979[_0xfc79('0x32')]:_0x3a8ca3[_0xfc79('0x2f')]+_0x3a8ca3[_0xfc79('0x30')];var _0x4715d8;if(_0x106f1a>=_0x333af1){_0x106f1a=_0x333af1;_0x4715d8=0xc8;}else{_0x4715d8=0xce;}_0x168ec2['status'](_0x4715d8);return _0x168ec2['set'](_0xfc79('0x33'),_0x52212b+'-'+_0x106f1a+'/'+_0x333af1)['json'](_0x2ae979);}return null;};}function patchUpdates(_0x137420){return function(_0x324b52){try{jsonpatch[_0xfc79('0x34')](_0x324b52,_0x137420,!![]);}catch(_0x23a827){return BPromise[_0xfc79('0x35')](_0x23a827);}return _0x324b52[_0xfc79('0x36')]();};}function saveUpdates(_0x284a7e,_0x384271){return function(_0x22b206){if(_0x22b206){return _0x22b206['update'](_0x284a7e)[_0xfc79('0x22')](function(_0x43a26d){return _0x43a26d;});}return null;};}function removeEntity(_0x36c224,_0x2aac80){return function(_0x19eb4c){if(_0x19eb4c){return _0x19eb4c['destroy']()[_0xfc79('0x22')](function(){var _0x25deb8=_0x19eb4c['get']({'plain':!![]});var _0x4f7df6='WhatsappAccounts';return db[_0xfc79('0x37')][_0xfc79('0x38')]({'where':{'type':_0x4f7df6,'resourceId':_0x25deb8['id']}})[_0xfc79('0x22')](function(){return _0x19eb4c;});})[_0xfc79('0x22')](function(){_0x36c224[_0xfc79('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2126f9,_0x2ef7f5){return function(_0x274edc){if(!_0x274edc){_0x2126f9['sendStatus'](0x194);}return _0x274edc;};}function handleError(_0xa101a1,_0x26632a){_0x26632a=_0x26632a||0x1f4;return function(_0x5acace){logger['error'](_0x5acace[_0xfc79('0x39')]);if(_0x5acace[_0xfc79('0x3a')]){delete _0x5acace[_0xfc79('0x3a')];}_0xa101a1[_0xfc79('0x2d')](_0x26632a)[_0xfc79('0x3b')](_0x5acace);};}function getMustacheRender(_0x2abb2a,_0x812fb5){return Mustache[_0xfc79('0x3c')](_0x2abb2a,_[_0xfc79('0x3d')](_0x812fb5['body'],{'contact':_0x812fb5[_0xfc79('0x3e')],'message':_0x812fb5[_0xfc79('0x29')],'agent':_0x812fb5[_0xfc79('0x3f')],'interaction':_0x812fb5['interaction'],'account':_0x812fb5[_0xfc79('0x40')]}))||'';}exports['index']=function(_0x1ae4e2,_0x36cb81){var _0x71dc7d={'include':[{'model':db[_0xfc79('0x41')],'as':_0xfc79('0x42')}]},_0x17d970={},_0x20f6ac={'count':0x0,'rows':[]};var _0x3022a7=_[_0xfc79('0x43')](db[_0xfc79('0x44')][_0xfc79('0x45')],function(_0xda4714){return{'name':_0xda4714[_0xfc79('0x46')],'type':_0xda4714[_0xfc79('0x47')][_0xfc79('0x48')]};});_0x17d970[_0xfc79('0x49')]=_[_0xfc79('0x43')](_0x3022a7,'name');_0x17d970[_0xfc79('0x4a')]=_['keys'](_0x1ae4e2[_0xfc79('0x4a')]);_0x17d970[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x17d970[_0xfc79('0x49')],_0x17d970[_0xfc79('0x4a')]);_0x71dc7d[_0xfc79('0x4d')]=_[_0xfc79('0x4c')](_0x17d970[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x4e')]));_0x71dc7d['attributes']=_0x71dc7d['attributes'][_0xfc79('0x4f')]?_0x71dc7d['attributes']:_0x17d970[_0xfc79('0x49')];if(!_0x1ae4e2['query']['hasOwnProperty'](_0xfc79('0x50'))){_0x71dc7d['limit']=qs[_0xfc79('0x30')](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x30')]);_0x71dc7d[_0xfc79('0x2f')]=qs['offset'](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x2f')]);}_0x71dc7d['order']=qs[_0xfc79('0x51')](_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x71dc7d[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_[_0xfc79('0x53')](_0x1ae4e2[_0xfc79('0x4a')],_0x17d970[_0xfc79('0x4b')]),_0x3022a7);if(_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x71dc7d['where']=_['merge'](_0x71dc7d['where'],{'$or':_[_0xfc79('0x43')](_0x3022a7,function(_0x2002d4){if(_0x2002d4['type']!=='VIRTUAL'){var _0x2c3b32={};_0x2c3b32[_0x2002d4[_0xfc79('0x3a')]]={'$like':'%'+_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x2c3b32;}})});}_0x71dc7d=_[_0xfc79('0x3d')]({},_0x71dc7d,_0x1ae4e2['options']);var _0x3148e5={'where':_0x71dc7d[_0xfc79('0x52')]};return db['WhatsappAccount'][_0xfc79('0x32')](_0x3148e5)['then'](function(_0x2cada8){_0x20f6ac[_0xfc79('0x32')]=_0x2cada8;if(_0x1ae4e2[_0xfc79('0x4a')][_0xfc79('0x55')]){_0x71dc7d['include']=[{'all':!![]}];}return db[_0xfc79('0x44')][_0xfc79('0x56')](_0x71dc7d);})[_0xfc79('0x22')](function(_0x44804b){_0x20f6ac[_0xfc79('0x57')]=_0x44804b;return _0x20f6ac;})['then'](respondWithFilteredResult(_0x36cb81,_0x71dc7d))[_0xfc79('0x2a')](handleError(_0x36cb81,null));};exports[_0xfc79('0x58')]=function(_0x4eceb2,_0x249705){var _0x42898b={'raw':![],'where':{'id':_0x4eceb2[_0xfc79('0x59')]['id']},'include':[{'model':db[_0xfc79('0x41')],'as':_0xfc79('0x42')}]},_0x4363ec={};_0x4363ec[_0xfc79('0x49')]=_['keys'](db['WhatsappAccount'][_0xfc79('0x45')]);_0x4363ec[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x4eceb2[_0xfc79('0x4a')]);_0x4363ec['filters']=_[_0xfc79('0x4c')](_0x4363ec[_0xfc79('0x49')],_0x4363ec[_0xfc79('0x4a')]);_0x42898b[_0xfc79('0x4d')]=_['intersection'](_0x4363ec[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x4eceb2[_0xfc79('0x4a')][_0xfc79('0x4e')]));_0x42898b[_0xfc79('0x4d')]=_0x42898b[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0x42898b[_0xfc79('0x4d')]:_0x4363ec['model'];if(_0x4eceb2[_0xfc79('0x4a')][_0xfc79('0x55')]){_0x42898b[_0xfc79('0x5b')]=[{'all':!![]}];}_0x42898b=_['merge']({},_0x42898b,_0x4eceb2['options']);return db[_0xfc79('0x44')][_0xfc79('0x5c')](_0x42898b)['then'](handleEntityNotFound(_0x249705,null))[_0xfc79('0x22')](respondWithResult(_0x249705,null))[_0xfc79('0x2a')](handleError(_0x249705,null));};exports['create']=function(_0x4885d4,_0x20dea4){return db['WhatsappAccount'][_0xfc79('0x5d')](_0x4885d4['body'],{})[_0xfc79('0x22')](function(_0x1ff468){var _0x171cf8=_0x4885d4[_0xfc79('0x5e')][_0xfc79('0x5f')]({'plain':!![]});if(!_0x171cf8)throw new Error(_0xfc79('0x60'));if(_0x171cf8['role']==='user'){var _0x42ed31=_0x1ff468['get']({'plain':!![]});var _0x1644be=_0xfc79('0x61');return db[_0xfc79('0x62')]['find']({'where':{'name':_0x1644be,'userProfileId':_0x171cf8[_0xfc79('0x63')]},'raw':!![]})[_0xfc79('0x22')](function(_0x2b1b25){if(_0x2b1b25&&_0x2b1b25[_0xfc79('0x64')]===0x0){return db[_0xfc79('0x37')][_0xfc79('0x5d')]({'name':_0x42ed31[_0xfc79('0x3a')],'resourceId':_0x42ed31['id'],'type':_0x2b1b25[_0xfc79('0x3a')],'sectionId':_0x2b1b25['id']},{})[_0xfc79('0x22')](function(){return _0x1ff468;});}else{return _0x1ff468;}})['catch'](function(_0x4b1667){logger[_0xfc79('0x27')](_0xfc79('0x65'),_0x4b1667);throw _0x4b1667;});}return _0x1ff468;})[_0xfc79('0x22')](respondWithResult(_0x20dea4,0xc9))[_0xfc79('0x2a')](handleError(_0x20dea4,null));};exports['update']=function(_0x173460,_0x4035b6){if(_0x173460[_0xfc79('0x66')]['id']){delete _0x173460[_0xfc79('0x66')]['id'];}return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x173460[_0xfc79('0x59')]['id']},'include':[{'model':db[_0xfc79('0x41')],'as':_0xfc79('0x42')}]})[_0xfc79('0x22')](handleEntityNotFound(_0x4035b6,null))[_0xfc79('0x22')](saveUpdates(_0x173460['body'],null))[_0xfc79('0x22')](respondWithResult(_0x4035b6,null))[_0xfc79('0x2a')](handleError(_0x4035b6,null));};exports[_0xfc79('0x38')]=function(_0xf894e,_0xd05ed3){return db['WhatsappAccount'][_0xfc79('0x5c')]({'where':{'id':_0xf894e['params']['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0xd05ed3,null))[_0xfc79('0x22')](removeEntity(_0xd05ed3,null))[_0xfc79('0x2a')](handleError(_0xd05ed3,null));};exports[_0xfc79('0x67')]=function(_0x8849cd,_0x316640){return db[_0xfc79('0x44')][_0xfc79('0x67')]()[_0xfc79('0x22')](respondWithResult(_0x316640,null))[_0xfc79('0x2a')](handleError(_0x316640,null));};exports[_0xfc79('0x68')]=function(_0x4e04e4,_0x362273,_0x59c330){if(_0x4e04e4[_0xfc79('0x66')]['id']){delete _0x4e04e4['body']['id'];}return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x4e04e4[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x362273,null))[_0xfc79('0x22')](function(_0x1883f5){if(_0x1883f5){_0x4e04e4[_0xfc79('0x66')]['WhatsappAccountId']=_0x1883f5['id'];return db[_0xfc79('0x69')][_0xfc79('0x5d')](_0x4e04e4['body']);}})['then'](respondWithResult(_0x362273,null))['catch'](handleError(_0x362273,null));};exports[_0xfc79('0x6a')]=function(_0x30f193,_0x20d5ac,_0x4d545c){var _0xdf008b={'raw':![],'where':{}};var _0x535854={};var _0x470650={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x30f193[_0xfc79('0x59')]['id']}})['then'](handleEntityNotFound(_0x20d5ac,null))['then'](function(_0x460a7d){if(_0x460a7d){_0x535854[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x69')]['rawAttributes']);_0x535854[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x30f193[_0xfc79('0x4a')]);_0x535854[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x535854[_0xfc79('0x49')],_0x535854['query']);_0xdf008b[_0xfc79('0x4d')]=_[_0xfc79('0x4c')](_0x535854[_0xfc79('0x49')],qs['fields'](_0x30f193['query'][_0xfc79('0x4e')]));_0xdf008b[_0xfc79('0x4d')]=_0xdf008b[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0xdf008b[_0xfc79('0x4d')]:_0x535854[_0xfc79('0x49')];if(!_0x30f193[_0xfc79('0x4a')]['hasOwnProperty']('nolimit')){_0xdf008b[_0xfc79('0x30')]=qs['limit'](_0x30f193[_0xfc79('0x4a')]['limit']);_0xdf008b[_0xfc79('0x2f')]=qs[_0xfc79('0x2f')](_0x30f193['query'][_0xfc79('0x2f')]);}_0xdf008b[_0xfc79('0x6b')]=qs[_0xfc79('0x51')](_0x30f193['query']['sort']);_0xdf008b['where']=qs['filters'](_[_0xfc79('0x53')](_0x30f193[_0xfc79('0x4a')],_0x535854[_0xfc79('0x4b')]));_0xdf008b[_0xfc79('0x52')][_0xfc79('0x6c')]=_0x460a7d['id'];if(_0x30f193['query'][_0xfc79('0x54')]){_0xdf008b[_0xfc79('0x52')]=_['merge'](_0xdf008b['where'],{'$or':_[_0xfc79('0x43')](_0xdf008b['attributes'],function(_0x288f94){var _0x23662b={};_0x23662b[_0x288f94]={'$like':'%'+_0x30f193[_0xfc79('0x4a')]['filter']+'%'};return _0x23662b;})});}_0xdf008b=_[_0xfc79('0x3d')]({},_0xdf008b,_0x30f193[_0xfc79('0x6d')]);return db[_0xfc79('0x69')][_0xfc79('0x32')]({'where':_0xdf008b['where']})['then'](function(_0x4407b1){_0x470650[_0xfc79('0x32')]=_0x4407b1;if(_0x30f193[_0xfc79('0x4a')][_0xfc79('0x55')]){_0xdf008b[_0xfc79('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0xfc79('0x56')](_0xdf008b);})[_0xfc79('0x22')](function(_0x36226a){_0x470650[_0xfc79('0x57')]=_0x36226a;return _0x470650;});}})[_0xfc79('0x22')](respondWithFilteredResult(_0x20d5ac,_0xdf008b))[_0xfc79('0x2a')](handleError(_0x20d5ac,null));};exports[_0xfc79('0x6e')]=function(_0x31a27c,_0x71b37,_0x2d3d0c){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x31a27c[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x71b37,null))[_0xfc79('0x22')](function(_0x1d4ae0){if(_0x1d4ae0){return _0x1d4ae0[_0xfc79('0x6e')](_0x31a27c['query'][_0xfc79('0x6f')]);}})[_0xfc79('0x22')](respondWithStatusCode(_0x71b37,null))[_0xfc79('0x2a')](handleError(_0x71b37,null));};exports[_0xfc79('0x70')]=function(_0x59d117,_0x14ef97,_0x361f69){if(_0x59d117[_0xfc79('0x66')]['id']){delete _0x59d117['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x59d117[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x14ef97,null))[_0xfc79('0x22')](function(_0x1ae589){if(_0x1ae589){_0x59d117[_0xfc79('0x66')][_0xfc79('0x6c')]=_0x1ae589['id'];return db[_0xfc79('0x71')][_0xfc79('0x5d')](_0x59d117['body']);}})[_0xfc79('0x22')](respondWithResult(_0x14ef97,null))['catch'](handleError(_0x14ef97,null));};exports[_0xfc79('0x72')]=function(_0x582b4b,_0x20f47e,_0x3c2361){var _0x526ca4={'raw':![],'where':{}};var _0x1640a4={};var _0xa9229={'count':0x0,'rows':[]};return db[_0xfc79('0x44')][_0xfc79('0x73')]({'where':{'id':_0x582b4b[_0xfc79('0x59')]['id']}})['then'](handleEntityNotFound(_0x20f47e,null))[_0xfc79('0x22')](function(_0x4ed043){if(_0x4ed043){_0x1640a4[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x71')]['rawAttributes']);_0x1640a4[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x582b4b[_0xfc79('0x4a')]);_0x1640a4[_0xfc79('0x4b')]=_['intersection'](_0x1640a4['model'],_0x1640a4[_0xfc79('0x4a')]);_0x526ca4['attributes']=_[_0xfc79('0x4c')](_0x1640a4[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x4e')]));_0x526ca4[_0xfc79('0x4d')]=_0x526ca4[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0x526ca4['attributes']:_0x1640a4[_0xfc79('0x49')];if(!_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x74')](_0xfc79('0x50'))){_0x526ca4[_0xfc79('0x30')]=qs['limit'](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x30')]);_0x526ca4['offset']=qs['offset'](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x2f')]);}_0x526ca4[_0xfc79('0x6b')]=qs['sort'](_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x526ca4[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_[_0xfc79('0x53')](_0x582b4b[_0xfc79('0x4a')],_0x1640a4[_0xfc79('0x4b')]));_0x526ca4[_0xfc79('0x52')]['WhatsappAccountId']=_0x4ed043['id'];if(_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x526ca4[_0xfc79('0x52')]=_[_0xfc79('0x3d')](_0x526ca4['where'],{'$or':_[_0xfc79('0x43')](_0x526ca4[_0xfc79('0x4d')],function(_0x436ae7){var _0x34391c={};_0x34391c[_0x436ae7]={'$like':'%'+_0x582b4b[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x34391c;})});}_0x526ca4=_[_0xfc79('0x3d')]({},_0x526ca4,_0x582b4b[_0xfc79('0x6d')]);return db[_0xfc79('0x71')][_0xfc79('0x32')]({'where':_0x526ca4['where']})['then'](function(_0x1a236d){_0xa9229['count']=_0x1a236d;if(_0x582b4b['query']['includeAll']){_0x526ca4[_0xfc79('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfc79('0x56')](_0x526ca4);})['then'](function(_0x8452b4){_0xa9229['rows']=_0x8452b4;return _0xa9229;});}})[_0xfc79('0x22')](respondWithFilteredResult(_0x20f47e,_0x526ca4))[_0xfc79('0x2a')](handleError(_0x20f47e,null));};exports[_0xfc79('0x75')]=function(_0x49f31e,_0x277bde,_0x417eec){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x49f31e['params']['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x277bde,null))[_0xfc79('0x22')](function(_0xdb9dc5){if(_0xdb9dc5){return _0xdb9dc5[_0xfc79('0x75')](_0x49f31e['query'][_0xfc79('0x6f')]);}})[_0xfc79('0x22')](respondWithStatusCode(_0x277bde,null))[_0xfc79('0x2a')](handleError(_0x277bde,null));};exports['addAgents']=function(_0x1d1fcc,_0x59a6f2,_0x3d79c0){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x1d1fcc[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x59a6f2,null))[_0xfc79('0x22')](function(_0x2b92e9){if(_0x2b92e9){return _0x2b92e9[_0xfc79('0x76')](_0x1d1fcc[_0xfc79('0x66')][_0xfc79('0x6f')],_[_0xfc79('0x77')](_0x1d1fcc['body'],[_0xfc79('0x6f'),'id'])||{})[_0xfc79('0x78')](function(_0x1cf991){for(var _0x5acd5c=0x0;_0x5acd5c<_0x1d1fcc[_0xfc79('0x66')][_0xfc79('0x6f')][_0xfc79('0x4f')];_0x5acd5c+=0x1){socket['emit'](_0xfc79('0x79'),{'UserId':_0x1d1fcc[_0xfc79('0x66')][_0xfc79('0x6f')][_0x5acd5c],'WhatsappAccountId':_0x1d1fcc[_0xfc79('0x59')]['id']});}return _0x1cf991;});}})[_0xfc79('0x22')](respondWithResult(_0x59a6f2,null))[_0xfc79('0x2a')](handleError(_0x59a6f2,null));};exports[_0xfc79('0x7a')]=function(_0x1e7c9a,_0x17d0b6,_0x1d74a3){return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x1e7c9a[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x17d0b6,null))[_0xfc79('0x22')](function(_0x2ab60d){if(_0x2ab60d){return _0x2ab60d[_0xfc79('0x7a')](_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')])[_0xfc79('0x22')](function(){if(_[_0xfc79('0x7b')](_0x1e7c9a['query'][_0xfc79('0x6f')])){for(var _0x16e844=0x0;_0x16e844<_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')][_0xfc79('0x4f')];_0x16e844+=0x1){socket['emit'](_0xfc79('0x7c'),{'UserId':Number(_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')][_0x16e844]),'WhatsappAccountId':Number(_0x1e7c9a[_0xfc79('0x59')]['id'])});}}else{socket['emit'](_0xfc79('0x7c'),{'UserId':Number(_0x1e7c9a[_0xfc79('0x4a')][_0xfc79('0x6f')]),'WhatsappAccountId':Number(_0x1e7c9a[_0xfc79('0x59')]['id'])});}});}})[_0xfc79('0x22')](respondWithStatusCode(_0x17d0b6,null))[_0xfc79('0x2a')](handleError(_0x17d0b6,null));};exports['getAgents']=function(_0x35ff21,_0x5ea80c,_0x48177e){var _0x3c8be8={};var _0x3cb350={};var _0x3fbdbe;var _0x51315b;return db['WhatsappAccount']['findOne']({'where':{'id':_0x35ff21[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x5ea80c,null))['then'](function(_0x344418){if(_0x344418){_0x3fbdbe=_0x344418;_0x3cb350[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x7d')]['rawAttributes']);_0x3cb350[_0xfc79('0x4a')]=_['keys'](_0x35ff21[_0xfc79('0x4a')]);_0x3cb350[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x3cb350[_0xfc79('0x49')],_0x3cb350[_0xfc79('0x4a')]);_0x3c8be8['attributes']=_['intersection'](_0x3cb350[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x35ff21['query'][_0xfc79('0x4e')]));_0x3c8be8[_0xfc79('0x4d')]=_0x3c8be8[_0xfc79('0x4d')]['length']?_0x3c8be8[_0xfc79('0x4d')]:_0x3cb350[_0xfc79('0x49')];_0x3c8be8['order']=qs[_0xfc79('0x51')](_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x3c8be8[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_['pick'](_0x35ff21[_0xfc79('0x4a')],_0x3cb350[_0xfc79('0x4b')]));if(_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x3c8be8[_0xfc79('0x52')]=_[_0xfc79('0x3d')](_0x3c8be8['where'],{'$or':_[_0xfc79('0x43')](_0x3c8be8[_0xfc79('0x4d')],function(_0x148522){var _0x15c19e={};_0x15c19e[_0x148522]={'$like':'%'+_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x15c19e;})});}_0x3c8be8=_['merge']({},_0x3c8be8,_0x35ff21[_0xfc79('0x6d')]);return _0x3fbdbe['getAgents'](_0x3c8be8);}})['then'](function(_0x14b39b){if(_0x14b39b){_0x51315b=_0x14b39b[_0xfc79('0x4f')];if(!_0x35ff21[_0xfc79('0x4a')][_0xfc79('0x74')](_0xfc79('0x50'))){_0x3c8be8['limit']=qs[_0xfc79('0x30')](_0x35ff21['query'][_0xfc79('0x30')]);_0x3c8be8[_0xfc79('0x2f')]=qs[_0xfc79('0x2f')](_0x35ff21['query'][_0xfc79('0x2f')]);}return _0x3fbdbe[_0xfc79('0x7e')](_0x3c8be8);}})['then'](function(_0x40d755){if(_0x40d755){return _0x40d755?{'count':_0x51315b,'rows':_0x40d755}:null;}})[_0xfc79('0x22')](respondWithResult(_0x5ea80c,null))['catch'](handleError(_0x5ea80c,null));};exports['addApplications']=function(_0x4458ff,_0x2a9215,_0x49cbf6){return db[_0xfc79('0x44')]['findOne']({'where':{'id':_0x4458ff[_0xfc79('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a9215,null))[_0xfc79('0x22')](function(_0x2aee9a){if(_0x2aee9a){return db['sequelize'][_0xfc79('0x7f')](function(_0x263a7e){return db[_0xfc79('0x80')]['destroy']({'where':{'WhatsappAccountId':_0x4458ff[_0xfc79('0x59')]['id']},'transaction':_0x263a7e})['then'](function(_0x4aaa11){var _0x427fcb=_[_0xfc79('0x43')](_0x4458ff[_0xfc79('0x66')],function(_0x59cd78){_0x59cd78[_0xfc79('0x6c')]=_0x4458ff[_0xfc79('0x59')]['id'];return _0x59cd78;});return db['WhatsappApplication'][_0xfc79('0x81')](_0x427fcb,{'transaction':_0x263a7e});});})[_0xfc79('0x22')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x4458ff[_0xfc79('0x59')]['id']},'order':_0xfc79('0x82')});});}})[_0xfc79('0x22')](respondWithResult(_0x2a9215,null))[_0xfc79('0x2a')](handleError(_0x2a9215,null));};exports[_0xfc79('0x83')]=function(_0x1e016b,_0x3a8880,_0x48c122){var _0x24366e={};var _0x596732={};var _0x1e3200;var _0x1656f5;return db['WhatsappAccount'][_0xfc79('0x73')]({'where':{'id':_0x1e016b[_0xfc79('0x59')]['id']}})[_0xfc79('0x22')](handleEntityNotFound(_0x3a8880,null))['then'](function(_0x3817e4){if(_0x3817e4){_0x1e3200=_0x3817e4;_0x596732[_0xfc79('0x49')]=_[_0xfc79('0x5a')](db[_0xfc79('0x80')]['rawAttributes']);_0x596732[_0xfc79('0x4a')]=_[_0xfc79('0x5a')](_0x1e016b[_0xfc79('0x4a')]);_0x596732[_0xfc79('0x4b')]=_[_0xfc79('0x4c')](_0x596732[_0xfc79('0x49')],_0x596732['query']);_0x24366e[_0xfc79('0x4d')]=_[_0xfc79('0x4c')](_0x596732[_0xfc79('0x49')],qs[_0xfc79('0x4e')](_0x1e016b['query'][_0xfc79('0x4e')]));_0x24366e[_0xfc79('0x4d')]=_0x24366e[_0xfc79('0x4d')][_0xfc79('0x4f')]?_0x24366e[_0xfc79('0x4d')]:_0x596732[_0xfc79('0x49')];_0x24366e[_0xfc79('0x6b')]=qs[_0xfc79('0x51')](_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x51')]);_0x24366e[_0xfc79('0x52')]=qs[_0xfc79('0x4b')](_[_0xfc79('0x53')](_0x1e016b['query'],_0x596732[_0xfc79('0x4b')]));if(_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x54')]){_0x24366e[_0xfc79('0x52')]=_[_0xfc79('0x3d')](_0x24366e[_0xfc79('0x52')],{'$or':_['map'](_0x24366e[_0xfc79('0x4d')],function(_0x5f43cd){var _0x9c9d56={};_0x9c9d56[_0x5f43cd]={'$like':'%'+_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x54')]+'%'};return _0x9c9d56;})});}_0x24366e=_[_0xfc79('0x3d')]({},_0x24366e,_0x1e016b[_0xfc79('0x6d')]);return _0x1e3200[_0xfc79('0x83')](_0x24366e);}})[_0xfc79('0x22')](function(_0x61b973){if(_0x61b973){_0x1656f5=_0x61b973[_0xfc79('0x4f')];if(!_0x1e016b['query'][_0xfc79('0x74')](_0xfc79('0x50'))){_0x24366e[_0xfc79('0x30')]=qs[_0xfc79('0x30')](_0x1e016b[_0xfc79('0x4a')][_0xfc79('0x30')]);_0x24366e[_0xfc79('0x2f')]=qs[_0xfc79('0x2f')](_0x1e016b['query'][_0xfc79('0x2f')]);}return _0x1e3200['getApplications'](_0x24366e);}})[_0xfc79('0x22')](function(_0xa9cb60){if(_0xa9cb60){return _0xa9cb60?{'count':_0x1656f5,'rows':_0xa9cb60}:null;}})['then'](respondWithResult(_0x3a8880,null))[_0xfc79('0x2a')](handleError(_0x3a8880,null));};exports['notify']=function(_0x561fa5,_0x1e196f,_0x5164ee){var _0x5e88a0={'channel':_0xfc79('0x84')};var _0xcee408=[];var _0x33ba54=[];var _0x1d6090={};return db[_0xfc79('0x44')][_0xfc79('0x5c')]({'where':{'id':_0x561fa5['params']['id']},'include':[{'model':db[_0xfc79('0x80')],'as':_0xfc79('0x85')}]})[_0xfc79('0x22')](handleEntityNotFound(_0x1e196f,null))[_0xfc79('0x22')](function(_0x45aad1){_0x5e88a0[_0xfc79('0x40')]=_0x45aad1;_0x5e88a0[_0xfc79('0x86')]=_[_0xfc79('0x87')](_0x45aad1['Applications'],[_0xfc79('0x82')],[_0xfc79('0x88')]);if(_0x5e88a0['account'][_0xfc79('0x85')]){delete _0x5e88a0[_0xfc79('0x40')][_0xfc79('0x85')];}return db[_0xfc79('0x89')][_0xfc79('0x67')]();})[_0xfc79('0x22')](function(_0x10ecff){if(!_0x10ecff){throw new db['Sequelize'][(_0xfc79('0x8a'))](_0xfc79('0x8b'));}_0xcee408=_['difference'](_[_0xfc79('0x5a')](_0x10ecff),[_0xfc79('0x8c'),'updatedAt']);_0x33ba54=_[_0xfc79('0x8d')](_[_0xfc79('0x5a')](_0x10ecff),[_0xfc79('0x8c'),_0xfc79('0x8e'),_0xfc79('0x8f'),'ListId']);_0x5e88a0[_0xfc79('0x66')]={'mapKey':_0xfc79('0x90')};if(_0x5e88a0[_0xfc79('0x40')]['type']&&_0x5e88a0['account'][_0xfc79('0x47')]==='twilio'){_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')]=_0x561fa5[_0xfc79('0x66')][_0xfc79('0x92')][_0xfc79('0x93')]('whatsapp:','');_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')]=_0x561fa5[_0xfc79('0x66')][_0xfc79('0x94')];_0x5e88a0[_0xfc79('0x66')]['messageId']=_0x561fa5['body'][_0xfc79('0x95')];}if(_0x5e88a0[_0xfc79('0x66')]['id']){delete _0x5e88a0[_0xfc79('0x66')]['id'];}if(_[_0xfc79('0x96')](_0x5e88a0[_0xfc79('0x66')]['from'])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')])||_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')]===''){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))](_0xfc79('0x98'));}if(_[_0xfc79('0x96')](_0x5e88a0['body'][_0xfc79('0x99')])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))](_0xfc79('0x9a')+_0x33ba54);}if(!_['includes'](_0x33ba54,_0x5e88a0[_0xfc79('0x66')]['mapKey'])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))](_0xfc79('0x9b')+_0x33ba54);}_0x1d6090[_0x5e88a0[_0xfc79('0x66')]['mapKey']]=_0x5e88a0[_0xfc79('0x66')]['from'];return db[_0xfc79('0x9c')][_0xfc79('0x5c')]({'where':{'id':_0x5e88a0[_0xfc79('0x40')][_0xfc79('0x9d')]},'include':[{'model':db['CmContact'],'as':_0xfc79('0x9e'),'where':_0x1d6090,'limit':0x1,'order':[[_0xfc79('0x8e'),_0xfc79('0x9f')]]}]});})[_0xfc79('0x22')](handleEntityNotFound(_0x1e196f,null))[_0xfc79('0x22')](function(_0x4b407d){if(_0x4b407d){_0x5e88a0['list']=_[_0xfc79('0x77')](_0x4b407d,['Contacts']);if(_0x4b407d['Contacts']['length']){return _0x4b407d[_0xfc79('0x9e')][0x0];}var _0x2fe8d4=_['defaults'](_0x5e88a0[_0xfc79('0x66')],{'firstName':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')],'ListId':_0x4b407d['id']});_0x2fe8d4[_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x99')]]=_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')];return db[_0xfc79('0x89')][_0xfc79('0x5d')](_0x2fe8d4,{'fields':_0xcee408,'raw':!![]});}})[_0xfc79('0x22')](handleEntityNotFound(_0x1e196f,null))[_0xfc79('0x22')](function(_0x5bfdd3){if(_0x5bfdd3){_0x5e88a0['contact']=_0x5bfdd3;var _0x3d6b2f={'ContactId':_0x5bfdd3['id'],'phone':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x91')],'WhatsappAccountId':_0x561fa5[_0xfc79('0x59')]['id']};var _0xbd6884={'ContactId':_0x5bfdd3['id'],'WhatsappAccountId':_0x561fa5['params']['id'],'closed':![]};return db[_0xfc79('0xa0')][_0xfc79('0x5c')]({'where':_0xbd6884})[_0xfc79('0x22')](function(_0x3fcadf){if(_0x3fcadf){return[_0x3fcadf,![]];}return db[_0xfc79('0xa0')][_0xfc79('0x5d')](_0x3d6b2f)[_0xfc79('0x22')](function(_0x3c2ab5){return[_0x3c2ab5,!![]];});});}})[_0xfc79('0x78')](function(_0x2cb3d8,_0x5ea4e8){_0x5e88a0[_0xfc79('0xa1')]=_0x2cb3d8[_0xfc79('0x5f')]({'plain':!![]});_0x5e88a0[_0xfc79('0xa1')][_0xfc79('0xa2')]=![];if(_0x5ea4e8){if(_0x5e88a0[_0xfc79('0x40')][_0xfc79('0xa3')]){_0x5e88a0['applications']['push']({'id':0x0,'priority':_0x5e88a0[_0xfc79('0x86')]['length']+0x1,'app':_0xfc79('0xa4'),'appdata':_0xfc79('0xa5'),'interval':'*,*,*,*'});}_0x5e88a0['interaction']['created']=!![];}return db[_0xfc79('0xa6')][_0xfc79('0x5d')]({'phone':_0x5e88a0['body']['from'],'messageId':_0x5e88a0['body'][_0xfc79('0xa7')],'body':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0x66')],'WhatsappAccountId':_0x561fa5[_0xfc79('0x59')]['id'],'WhatsappInteractionId':_0x2cb3d8['id'],'direction':'in','ContactId':_0x2cb3d8['ContactId'],'AttachmentId':_0x5e88a0[_0xfc79('0x66')][_0xfc79('0xa8')]});})[_0xfc79('0x22')](function(_0x2d7482){_0x5e88a0[_0xfc79('0x29')]=_0x2d7482;if(_0x5e88a0[_0xfc79('0xa1')][_0xfc79('0xa9')]){return db['User'][_0xfc79('0x5c')]({'attributes':['id',_0xfc79('0x3a')],'where':{'id':_0x5e88a0[_0xfc79('0xa1')]['UserId']}})[_0xfc79('0x22')](function(_0x49160b){if(_0x49160b){_0x5e88a0[_0xfc79('0x86')][_0xfc79('0xaa')]({'id':0x0,'priority':0x0,'app':_0xfc79('0x3f'),'appdata':_0x49160b['name']+','+(_0x5e88a0[_0xfc79('0x40')]['waitForTheAssignedAgent']||0xa),'interval':_0xfc79('0xab')});}return respondWithRpcPromise(_0xfc79('0xac'),_0xfc79('0xad'),_0x5e88a0);});}return respondWithRpcPromise(_0xfc79('0xac'),'startRouting',_0x5e88a0);})[_0xfc79('0x22')](function(_0x1a1cb6){if(_0x1a1cb6){var _0x30f039=0xc8;var _0x482ba9=_0xfc79('0xae');logger[_0xfc79('0x23')](_0xfc79('0x25'),_0x482ba9,_0x30f039,'entity\x20found');logger['debug'](_0xfc79('0xaf'),_0x482ba9,_0x30f039,_0xfc79('0xb0'),JSON[_0xfc79('0x26')](_0x1a1cb6));if(_0x5e88a0[_0xfc79('0x40')]['type']===_0xfc79('0xb1')){return _0x1e196f[_0xfc79('0x2d')](_0x30f039)[_0xfc79('0xb2')](_0xfc79('0xb3'),_0xfc79('0xb4'))[_0xfc79('0x3b')](_0xfc79('0xb5'));}else{return _0x1e196f[_0xfc79('0x2d')](_0x30f039)[_0xfc79('0x2e')](_0x1a1cb6);}}})['catch'](handleError(_0x1e196f,null));};exports[_0xfc79('0x3b')]=function(_0x119905,_0x5a8afe,_0x11b49a){var _0x366a66,_0x437844,_0x70d9d;if(_[_0xfc79('0x96')](_0x119905['body']['body'])||_0x119905[_0xfc79('0x66')]['body']===''){throw new db[(_0xfc79('0x97'))]['ValidationError'](_0xfc79('0x98'));}if(_[_0xfc79('0x96')](_0x119905[_0xfc79('0x66')]['to'])){throw new db[(_0xfc79('0x97'))][(_0xfc79('0x8a'))]('to\x20is\x20mandatory');}_0x366a66=_0x119905[_0xfc79('0x66')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x119905[_0xfc79('0x59')]['id']},'include':[{'model':db[_0xfc79('0x9c')],'as':_0xfc79('0xb6'),'include':[{'model':db[_0xfc79('0x89')],'as':'Contacts','where':{'mobile':_0x366a66},'limit':0x1,'order':[['updatedAt',_0xfc79('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x5a8afe,null))[_0xfc79('0x22')](function(_0x3352ed){if(_0x3352ed&&_0x3352ed[_0xfc79('0xb6')]){_0x437844=_0x3352ed['get']({'plain':!![]});if(_0x437844['List']&&_0x437844[_0xfc79('0xb6')]['Contacts'][_0xfc79('0x4f')]){return _0x437844[_0xfc79('0xb6')][_0xfc79('0x9e')][0x0];}return db[_0xfc79('0x89')][_0xfc79('0x5d')](_[_0xfc79('0x1a')](_0x119905['body'],{'firstName':_0x366a66,'mobile':_0x366a66,'phone':_0x366a66,'ListId':_0x437844[_0xfc79('0x9d')]}));}})[_0xfc79('0x22')](handleEntityNotFound(_0x5a8afe,null))[_0xfc79('0x22')](function(_0x4ff5a2){if(_0x4ff5a2){_0x70d9d=_0x4ff5a2;return db[_0xfc79('0xa0')][_0xfc79('0x5c')]({'where':{'ContactId':_0x70d9d['id'],'closed':![],'WhatsappAccountId':_0x437844['id']}})['then'](function(_0x237322){if(_0x237322){return[_0x237322,![]];}return db[_0xfc79('0xa0')]['create']({'UserId':_0x119905[_0xfc79('0x5e')]['id'],'ContactId':_0x70d9d['id'],'WhatsappAccountId':_0x437844['id'],'phone':_0x366a66,'firstMsgDirection':_0xfc79('0xb7'),'Messages':[_['merge'](_0x119905[_0xfc79('0x66')],{'read':![],'body':_0x119905[_0xfc79('0x66')]['body'],'phone':_0x366a66,'WhatsappAccountId':_0x437844['id'],'UserId':_0x119905[_0xfc79('0x5e')]['id'],'ContactId':_0x70d9d['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x26e2ac){return[_0x26e2ac,!![]];});});}})['spread'](function(_0x1afa4f,_0x327a87){if(_0x327a87){return _0x1afa4f;}return db['WhatsappMessage'][_0xfc79('0x5d')](_['merge'](_0x119905[_0xfc79('0x66')],{'read':![],'body':_0x119905[_0xfc79('0x66')]['body'],'phone':_0x366a66,'WhatsappAccountId':_0x437844['id'],'WhatsappInteractionId':_0x1afa4f['id'],'UserId':_0x119905[_0xfc79('0x5e')]['id'],'ContactId':_0x70d9d['id']}))[_0xfc79('0x22')](function(_0x3ea611){_0x1afa4f[_0xfc79('0xb8')][_0xfc79('0xb9')]=[];_0x1afa4f['dataValues'][_0xfc79('0xb9')]['push'](_0x3ea611[_0xfc79('0xb8')]);return _0x1afa4f;});})[_0xfc79('0x22')](respondWithResult(_0x5a8afe,null))[_0xfc79('0x2a')](handleError(_0x5a8afe,null));}; \ No newline at end of file +var _0x9b9b=['removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','whatsapp','Applications','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','Contacts','WhatsappInteraction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','WhatsappAccounts','sendStatus','stack','name','send','render','merge','body','contact','agent','interaction','account','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','CannedAnswer','getAnswers'];(function(_0x360532,_0x2d275d){var _0x7ed35c=function(_0x2704ec){while(--_0x2704ec){_0x360532['push'](_0x360532['shift']());}};_0x7ed35c(++_0x2d275d);}(_0x9b9b,0x114));var _0xb9b9=function(_0x505f51,_0x1a3e1d){_0x505f51=_0x505f51-0x0;var _0x5468b3=_0x9b9b[_0x505f51];return _0x5468b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b9('0x1'));var moment=require(_0xb9b9('0x2'));var BPromise=require(_0xb9b9('0x3'));var Mustache=require(_0xb9b9('0x4'));var util=require(_0xb9b9('0x5'));var path=require(_0xb9b9('0x6'));var sox=require(_0xb9b9('0x7'));var csv=require(_0xb9b9('0x8'));var ejs=require(_0xb9b9('0x9'));var fs=require('fs');var fs_extra=require(_0xb9b9('0xa'));var _=require(_0xb9b9('0xb'));var squel=require(_0xb9b9('0xc'));var crypto=require(_0xb9b9('0xd'));var jsforce=require(_0xb9b9('0xe'));var deskjs=require(_0xb9b9('0xf'));var toCsv=require(_0xb9b9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b9('0x10'));var authService=require(_0xb9b9('0x11'));var qs=require(_0xb9b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x13'));var logger=require(_0xb9b9('0x14'))(_0xb9b9('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b9('0x16'));var licenseUtil=require(_0xb9b9('0x17'));var db=require(_0xb9b9('0x18'))['db'];config[_0xb9b9('0x19')]=_[_0xb9b9('0x1a')](config[_0xb9b9('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9b9('0x19')]));require('./whatsappAccount.socket')[_0xb9b9('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb9b9('0x1c')][_0xb9b9('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x21fa2a,_0x29794c,_0x177ad9,_0x3fd09c){return new BPromise(function(_0x42a55f,_0x2b2e3d){var _0x4ae8e6=_0x3fd09c||client;return _0x4ae8e6[_0xb9b9('0x1e')](_0x21fa2a,_0x177ad9)['then'](function(_0x403a5b){logger[_0xb9b9('0x1f')](_0xb9b9('0x20'),_0x29794c,_0xb9b9('0x21'));logger['debug'](_0xb9b9('0x22'),_0x29794c,_0xb9b9('0x21'),JSON[_0xb9b9('0x23')](_0x403a5b));if(_0x403a5b[_0xb9b9('0x24')]){if(_0x403a5b[_0xb9b9('0x24')][_0xb9b9('0x25')]===0x1f4){logger[_0xb9b9('0x24')](_0xb9b9('0x20'),_0x29794c,_0x403a5b[_0xb9b9('0x24')][_0xb9b9('0x26')]);return _0x2b2e3d(_0x403a5b[_0xb9b9('0x24')][_0xb9b9('0x26')]);}logger[_0xb9b9('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x29794c,_0x403a5b[_0xb9b9('0x24')][_0xb9b9('0x26')]);return _0x42a55f(_0x403a5b[_0xb9b9('0x24')]['message']);}else{logger[_0xb9b9('0x1f')](_0xb9b9('0x20'),_0x29794c,'request\x20sent');_0x42a55f(_0x403a5b[_0xb9b9('0x27')][_0xb9b9('0x26')]);}})[_0xb9b9('0x28')](function(_0x40b801){logger[_0xb9b9('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x29794c,_0x40b801);_0x2b2e3d(_0x40b801);});});}function respondWithStatusCode(_0x4dfa3f,_0x33ab82){_0x33ab82=_0x33ab82||0xcc;return function(_0x426f2c){if(_0x426f2c){return _0x4dfa3f['sendStatus'](_0x33ab82);}return _0x4dfa3f[_0xb9b9('0x29')](_0x33ab82)[_0xb9b9('0x2a')]();};}function respondWithResult(_0x20ffc1,_0x21f68f){_0x21f68f=_0x21f68f||0xc8;return function(_0x125f6c){if(_0x125f6c){return _0x20ffc1['status'](_0x21f68f)[_0xb9b9('0x2b')](_0x125f6c);}};}function respondWithFilteredResult(_0x554850,_0x1e0c5e){return function(_0xe28f3c){if(_0xe28f3c){var _0x4f47da=typeof _0x1e0c5e[_0xb9b9('0x2c')]===_0xb9b9('0x2d')&&typeof _0x1e0c5e[_0xb9b9('0x2e')]==='undefined';var _0x16df87=_0xe28f3c[_0xb9b9('0x2f')];var _0x2e1d12=_0x4f47da?0x0:_0x1e0c5e[_0xb9b9('0x2c')];var _0x4f002a=_0x4f47da?_0xe28f3c[_0xb9b9('0x2f')]:_0x1e0c5e[_0xb9b9('0x2c')]+_0x1e0c5e['limit'];var _0x42b31f;if(_0x4f002a>=_0x16df87){_0x4f002a=_0x16df87;_0x42b31f=0xc8;}else{_0x42b31f=0xce;}_0x554850[_0xb9b9('0x29')](_0x42b31f);return _0x554850[_0xb9b9('0x30')](_0xb9b9('0x31'),_0x2e1d12+'-'+_0x4f002a+'/'+_0x16df87)['json'](_0xe28f3c);}return null;};}function patchUpdates(_0xd66ace){return function(_0x1bcac4){try{jsonpatch[_0xb9b9('0x32')](_0x1bcac4,_0xd66ace,!![]);}catch(_0x2f68c5){return BPromise['reject'](_0x2f68c5);}return _0x1bcac4[_0xb9b9('0x33')]();};}function saveUpdates(_0x28fe9b,_0x532fa4){return function(_0x126fe2){if(_0x126fe2){return _0x126fe2[_0xb9b9('0x34')](_0x28fe9b)[_0xb9b9('0x35')](function(_0xa680b5){return _0xa680b5;});}return null;};}function removeEntity(_0x359509,_0x17f3c3){return function(_0x5e10c9){if(_0x5e10c9){return _0x5e10c9[_0xb9b9('0x36')]()[_0xb9b9('0x35')](function(){var _0x48bcd2=_0x5e10c9[_0xb9b9('0x37')]({'plain':!![]});var _0x3bbfa1=_0xb9b9('0x38');return db['UserProfileResource'][_0xb9b9('0x36')]({'where':{'type':_0x3bbfa1,'resourceId':_0x48bcd2['id']}})['then'](function(){return _0x5e10c9;});})[_0xb9b9('0x35')](function(){_0x359509['status'](0xcc)[_0xb9b9('0x2a')]();});}};}function handleEntityNotFound(_0x1a8237,_0x22b567){return function(_0x1f1faf){if(!_0x1f1faf){_0x1a8237[_0xb9b9('0x39')](0x194);}return _0x1f1faf;};}function handleError(_0x76f4d4,_0x394c20){_0x394c20=_0x394c20||0x1f4;return function(_0x4960e1){logger['error'](_0x4960e1[_0xb9b9('0x3a')]);if(_0x4960e1[_0xb9b9('0x3b')]){delete _0x4960e1[_0xb9b9('0x3b')];}_0x76f4d4['status'](_0x394c20)[_0xb9b9('0x3c')](_0x4960e1);};}function getMustacheRender(_0x59caf9,_0x2778f9){return Mustache[_0xb9b9('0x3d')](_0x59caf9,_[_0xb9b9('0x3e')](_0x2778f9[_0xb9b9('0x3f')],{'contact':_0x2778f9[_0xb9b9('0x40')],'message':_0x2778f9[_0xb9b9('0x26')],'agent':_0x2778f9[_0xb9b9('0x41')],'interaction':_0x2778f9[_0xb9b9('0x42')],'account':_0x2778f9[_0xb9b9('0x43')]}))||'';}exports[_0xb9b9('0x44')]=function(_0x56b72c,_0xf484fd){var _0x2fd1bc={'include':[{'model':db[_0xb9b9('0x45')],'as':_0xb9b9('0x46')}]},_0x382131={},_0x2e50fa={'count':0x0,'rows':[]};var _0x36717c=_[_0xb9b9('0x47')](db[_0xb9b9('0x48')][_0xb9b9('0x49')],function(_0x500637){return{'name':_0x500637[_0xb9b9('0x4a')],'type':_0x500637[_0xb9b9('0x4b')][_0xb9b9('0x4c')]};});_0x382131[_0xb9b9('0x4d')]=_['map'](_0x36717c,_0xb9b9('0x3b'));_0x382131['query']=_['keys'](_0x56b72c[_0xb9b9('0x4e')]);_0x382131[_0xb9b9('0x4f')]=_['intersection'](_0x382131['model'],_0x382131[_0xb9b9('0x4e')]);_0x2fd1bc[_0xb9b9('0x50')]=_[_0xb9b9('0x51')](_0x382131[_0xb9b9('0x4d')],qs['fields'](_0x56b72c[_0xb9b9('0x4e')][_0xb9b9('0x52')]));_0x2fd1bc[_0xb9b9('0x50')]=_0x2fd1bc['attributes']['length']?_0x2fd1bc[_0xb9b9('0x50')]:_0x382131['model'];if(!_0x56b72c[_0xb9b9('0x4e')][_0xb9b9('0x53')](_0xb9b9('0x54'))){_0x2fd1bc[_0xb9b9('0x2e')]=qs['limit'](_0x56b72c[_0xb9b9('0x4e')][_0xb9b9('0x2e')]);_0x2fd1bc[_0xb9b9('0x2c')]=qs[_0xb9b9('0x2c')](_0x56b72c[_0xb9b9('0x4e')][_0xb9b9('0x2c')]);}_0x2fd1bc[_0xb9b9('0x55')]=qs[_0xb9b9('0x56')](_0x56b72c[_0xb9b9('0x4e')][_0xb9b9('0x56')]);_0x2fd1bc[_0xb9b9('0x57')]=qs[_0xb9b9('0x4f')](_['pick'](_0x56b72c[_0xb9b9('0x4e')],_0x382131['filters']),_0x36717c);if(_0x56b72c[_0xb9b9('0x4e')][_0xb9b9('0x58')]){_0x2fd1bc[_0xb9b9('0x57')]=_[_0xb9b9('0x3e')](_0x2fd1bc['where'],{'$or':_[_0xb9b9('0x47')](_0x36717c,function(_0x5be034){if(_0x5be034[_0xb9b9('0x4b')]!==_0xb9b9('0x59')){var _0x41dfa0={};_0x41dfa0[_0x5be034[_0xb9b9('0x3b')]]={'$like':'%'+_0x56b72c[_0xb9b9('0x4e')][_0xb9b9('0x58')]+'%'};return _0x41dfa0;}})});}_0x2fd1bc=_[_0xb9b9('0x3e')]({},_0x2fd1bc,_0x56b72c[_0xb9b9('0x5a')]);var _0x1c2f19={'where':_0x2fd1bc[_0xb9b9('0x57')]};return db[_0xb9b9('0x48')]['count'](_0x1c2f19)['then'](function(_0x4da7d8){_0x2e50fa[_0xb9b9('0x2f')]=_0x4da7d8;if(_0x56b72c['query'][_0xb9b9('0x5b')]){_0x2fd1bc[_0xb9b9('0x5c')]=[{'all':!![]}];}return db[_0xb9b9('0x48')][_0xb9b9('0x5d')](_0x2fd1bc);})['then'](function(_0x39c444){_0x2e50fa[_0xb9b9('0x5e')]=_0x39c444;return _0x2e50fa;})['then'](respondWithFilteredResult(_0xf484fd,_0x2fd1bc))[_0xb9b9('0x28')](handleError(_0xf484fd,null));};exports[_0xb9b9('0x5f')]=function(_0x52cc9f,_0x50f2e0){var _0x451f70={'raw':![],'where':{'id':_0x52cc9f[_0xb9b9('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0xb9b9('0x46')}]},_0x2bbe9f={};_0x2bbe9f[_0xb9b9('0x4d')]=_['keys'](db[_0xb9b9('0x48')][_0xb9b9('0x49')]);_0x2bbe9f[_0xb9b9('0x4e')]=_[_0xb9b9('0x61')](_0x52cc9f['query']);_0x2bbe9f[_0xb9b9('0x4f')]=_[_0xb9b9('0x51')](_0x2bbe9f[_0xb9b9('0x4d')],_0x2bbe9f['query']);_0x451f70[_0xb9b9('0x50')]=_[_0xb9b9('0x51')](_0x2bbe9f[_0xb9b9('0x4d')],qs[_0xb9b9('0x52')](_0x52cc9f[_0xb9b9('0x4e')]['fields']));_0x451f70['attributes']=_0x451f70[_0xb9b9('0x50')][_0xb9b9('0x62')]?_0x451f70[_0xb9b9('0x50')]:_0x2bbe9f[_0xb9b9('0x4d')];if(_0x52cc9f[_0xb9b9('0x4e')]['includeAll']){_0x451f70[_0xb9b9('0x5c')]=[{'all':!![]}];}_0x451f70=_[_0xb9b9('0x3e')]({},_0x451f70,_0x52cc9f[_0xb9b9('0x5a')]);return db[_0xb9b9('0x48')][_0xb9b9('0x63')](_0x451f70)['then'](handleEntityNotFound(_0x50f2e0,null))[_0xb9b9('0x35')](respondWithResult(_0x50f2e0,null))[_0xb9b9('0x28')](handleError(_0x50f2e0,null));};exports[_0xb9b9('0x64')]=function(_0x1e38f5,_0x5e81b0){return db[_0xb9b9('0x48')]['create'](_0x1e38f5[_0xb9b9('0x3f')],{})[_0xb9b9('0x35')](function(_0x19a252){var _0x386f85=_0x1e38f5[_0xb9b9('0x65')][_0xb9b9('0x37')]({'plain':!![]});if(!_0x386f85)throw new Error(_0xb9b9('0x66'));if(_0x386f85[_0xb9b9('0x67')]===_0xb9b9('0x65')){var _0x13add3=_0x19a252['get']({'plain':!![]});var _0xac7b51=_0xb9b9('0x38');return db[_0xb9b9('0x68')]['find']({'where':{'name':_0xac7b51,'userProfileId':_0x386f85[_0xb9b9('0x69')]},'raw':!![]})[_0xb9b9('0x35')](function(_0x412a7b){if(_0x412a7b&&_0x412a7b[_0xb9b9('0x6a')]===0x0){return db[_0xb9b9('0x6b')][_0xb9b9('0x64')]({'name':_0x13add3['name'],'resourceId':_0x13add3['id'],'type':_0x412a7b[_0xb9b9('0x3b')],'sectionId':_0x412a7b['id']},{})[_0xb9b9('0x35')](function(){return _0x19a252;});}else{return _0x19a252;}})[_0xb9b9('0x28')](function(_0x1e1da9){logger[_0xb9b9('0x24')](_0xb9b9('0x6c'),_0x1e1da9);throw _0x1e1da9;});}return _0x19a252;})[_0xb9b9('0x35')](respondWithResult(_0x5e81b0,0xc9))[_0xb9b9('0x28')](handleError(_0x5e81b0,null));};exports['update']=function(_0x15f2df,_0x27920f){if(_0x15f2df[_0xb9b9('0x3f')]['id']){delete _0x15f2df['body']['id'];}return db[_0xb9b9('0x48')][_0xb9b9('0x63')]({'where':{'id':_0x15f2df['params']['id']},'include':[{'model':db[_0xb9b9('0x45')],'as':_0xb9b9('0x46')}]})[_0xb9b9('0x35')](handleEntityNotFound(_0x27920f,null))[_0xb9b9('0x35')](saveUpdates(_0x15f2df[_0xb9b9('0x3f')],null))[_0xb9b9('0x35')](respondWithResult(_0x27920f,null))['catch'](handleError(_0x27920f,null));};exports[_0xb9b9('0x36')]=function(_0x246ed7,_0xff2dc0){return db[_0xb9b9('0x48')][_0xb9b9('0x63')]({'where':{'id':_0x246ed7['params']['id']}})['then'](handleEntityNotFound(_0xff2dc0,null))[_0xb9b9('0x35')](removeEntity(_0xff2dc0,null))[_0xb9b9('0x28')](handleError(_0xff2dc0,null));};exports[_0xb9b9('0x6d')]=function(_0x53159a,_0x30cf13){return db['WhatsappAccount'][_0xb9b9('0x6d')]()[_0xb9b9('0x35')](respondWithResult(_0x30cf13,null))[_0xb9b9('0x28')](handleError(_0x30cf13,null));};exports[_0xb9b9('0x6e')]=function(_0x2eb543,_0xaf8594,_0x2fbc92){if(_0x2eb543['body']['id']){delete _0x2eb543['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2eb543['params']['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0xaf8594,null))[_0xb9b9('0x35')](function(_0x273598){if(_0x273598){_0x2eb543[_0xb9b9('0x3f')][_0xb9b9('0x6f')]=_0x273598['id'];return db[_0xb9b9('0x70')][_0xb9b9('0x64')](_0x2eb543['body']);}})[_0xb9b9('0x35')](respondWithResult(_0xaf8594,null))[_0xb9b9('0x28')](handleError(_0xaf8594,null));};exports[_0xb9b9('0x71')]=function(_0xb54f42,_0x4df804,_0x4a724d){var _0x1039e9={'raw':![],'where':{}};var _0x7aeebf={};var _0x3110b5={'count':0x0,'rows':[]};return db[_0xb9b9('0x48')][_0xb9b9('0x72')]({'where':{'id':_0xb54f42['params']['id']}})['then'](handleEntityNotFound(_0x4df804,null))[_0xb9b9('0x35')](function(_0xe9b7f8){if(_0xe9b7f8){_0x7aeebf[_0xb9b9('0x4d')]=_[_0xb9b9('0x61')](db[_0xb9b9('0x70')]['rawAttributes']);_0x7aeebf[_0xb9b9('0x4e')]=_[_0xb9b9('0x61')](_0xb54f42[_0xb9b9('0x4e')]);_0x7aeebf[_0xb9b9('0x4f')]=_[_0xb9b9('0x51')](_0x7aeebf['model'],_0x7aeebf['query']);_0x1039e9[_0xb9b9('0x50')]=_[_0xb9b9('0x51')](_0x7aeebf[_0xb9b9('0x4d')],qs[_0xb9b9('0x52')](_0xb54f42['query'][_0xb9b9('0x52')]));_0x1039e9[_0xb9b9('0x50')]=_0x1039e9[_0xb9b9('0x50')][_0xb9b9('0x62')]?_0x1039e9['attributes']:_0x7aeebf[_0xb9b9('0x4d')];if(!_0xb54f42[_0xb9b9('0x4e')]['hasOwnProperty'](_0xb9b9('0x54'))){_0x1039e9[_0xb9b9('0x2e')]=qs['limit'](_0xb54f42[_0xb9b9('0x4e')]['limit']);_0x1039e9[_0xb9b9('0x2c')]=qs['offset'](_0xb54f42['query'][_0xb9b9('0x2c')]);}_0x1039e9[_0xb9b9('0x55')]=qs[_0xb9b9('0x56')](_0xb54f42[_0xb9b9('0x4e')][_0xb9b9('0x56')]);_0x1039e9[_0xb9b9('0x57')]=qs[_0xb9b9('0x4f')](_[_0xb9b9('0x73')](_0xb54f42[_0xb9b9('0x4e')],_0x7aeebf['filters']));_0x1039e9[_0xb9b9('0x57')]['WhatsappAccountId']=_0xe9b7f8['id'];if(_0xb54f42['query']['filter']){_0x1039e9[_0xb9b9('0x57')]=_['merge'](_0x1039e9['where'],{'$or':_[_0xb9b9('0x47')](_0x1039e9['attributes'],function(_0x405a5e){var _0xe7196a={};_0xe7196a[_0x405a5e]={'$like':'%'+_0xb54f42[_0xb9b9('0x4e')]['filter']+'%'};return _0xe7196a;})});}_0x1039e9=_[_0xb9b9('0x3e')]({},_0x1039e9,_0xb54f42['options']);return db[_0xb9b9('0x70')][_0xb9b9('0x2f')]({'where':_0x1039e9['where']})[_0xb9b9('0x35')](function(_0x4d123c){_0x3110b5[_0xb9b9('0x2f')]=_0x4d123c;if(_0xb54f42[_0xb9b9('0x4e')][_0xb9b9('0x5b')]){_0x1039e9['include']=[{'all':!![]}];}return db[_0xb9b9('0x70')][_0xb9b9('0x5d')](_0x1039e9);})[_0xb9b9('0x35')](function(_0x576c01){_0x3110b5[_0xb9b9('0x5e')]=_0x576c01;return _0x3110b5;});}})[_0xb9b9('0x35')](respondWithFilteredResult(_0x4df804,_0x1039e9))[_0xb9b9('0x28')](handleError(_0x4df804,null));};exports[_0xb9b9('0x74')]=function(_0x5b6500,_0x2fead4,_0x1c6b69){return db[_0xb9b9('0x48')][_0xb9b9('0x63')]({'where':{'id':_0x5b6500[_0xb9b9('0x60')]['id']}})['then'](handleEntityNotFound(_0x2fead4,null))['then'](function(_0x23db94){if(_0x23db94){return _0x23db94[_0xb9b9('0x74')](_0x5b6500[_0xb9b9('0x4e')][_0xb9b9('0x75')]);}})['then'](respondWithStatusCode(_0x2fead4,null))[_0xb9b9('0x28')](handleError(_0x2fead4,null));};exports['addAnswer']=function(_0x4e9283,_0xd8de61,_0x32a022){if(_0x4e9283['body']['id']){delete _0x4e9283['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x4e9283[_0xb9b9('0x60')]['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0xd8de61,null))['then'](function(_0x3d93d1){if(_0x3d93d1){_0x4e9283['body'][_0xb9b9('0x6f')]=_0x3d93d1['id'];return db[_0xb9b9('0x76')][_0xb9b9('0x64')](_0x4e9283[_0xb9b9('0x3f')]);}})[_0xb9b9('0x35')](respondWithResult(_0xd8de61,null))[_0xb9b9('0x28')](handleError(_0xd8de61,null));};exports[_0xb9b9('0x77')]=function(_0x30a3ab,_0x2ceba2,_0x39632a){var _0x404299={'raw':![],'where':{}};var _0x26c1e7={};var _0x291893={'count':0x0,'rows':[]};return db[_0xb9b9('0x48')][_0xb9b9('0x72')]({'where':{'id':_0x30a3ab[_0xb9b9('0x60')]['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0x2ceba2,null))[_0xb9b9('0x35')](function(_0x7aa221){if(_0x7aa221){_0x26c1e7[_0xb9b9('0x4d')]=_[_0xb9b9('0x61')](db[_0xb9b9('0x76')][_0xb9b9('0x49')]);_0x26c1e7[_0xb9b9('0x4e')]=_[_0xb9b9('0x61')](_0x30a3ab['query']);_0x26c1e7[_0xb9b9('0x4f')]=_[_0xb9b9('0x51')](_0x26c1e7[_0xb9b9('0x4d')],_0x26c1e7[_0xb9b9('0x4e')]);_0x404299[_0xb9b9('0x50')]=_[_0xb9b9('0x51')](_0x26c1e7[_0xb9b9('0x4d')],qs[_0xb9b9('0x52')](_0x30a3ab['query']['fields']));_0x404299[_0xb9b9('0x50')]=_0x404299[_0xb9b9('0x50')][_0xb9b9('0x62')]?_0x404299[_0xb9b9('0x50')]:_0x26c1e7[_0xb9b9('0x4d')];if(!_0x30a3ab['query'][_0xb9b9('0x53')]('nolimit')){_0x404299['limit']=qs['limit'](_0x30a3ab[_0xb9b9('0x4e')][_0xb9b9('0x2e')]);_0x404299[_0xb9b9('0x2c')]=qs[_0xb9b9('0x2c')](_0x30a3ab[_0xb9b9('0x4e')][_0xb9b9('0x2c')]);}_0x404299['order']=qs['sort'](_0x30a3ab['query'][_0xb9b9('0x56')]);_0x404299[_0xb9b9('0x57')]=qs[_0xb9b9('0x4f')](_['pick'](_0x30a3ab[_0xb9b9('0x4e')],_0x26c1e7[_0xb9b9('0x4f')]));_0x404299[_0xb9b9('0x57')][_0xb9b9('0x6f')]=_0x7aa221['id'];if(_0x30a3ab[_0xb9b9('0x4e')][_0xb9b9('0x58')]){_0x404299['where']=_[_0xb9b9('0x3e')](_0x404299[_0xb9b9('0x57')],{'$or':_[_0xb9b9('0x47')](_0x404299[_0xb9b9('0x50')],function(_0x5aaa68){var _0x4db67f={};_0x4db67f[_0x5aaa68]={'$like':'%'+_0x30a3ab['query'][_0xb9b9('0x58')]+'%'};return _0x4db67f;})});}_0x404299=_['merge']({},_0x404299,_0x30a3ab[_0xb9b9('0x5a')]);return db['CannedAnswer'][_0xb9b9('0x2f')]({'where':_0x404299[_0xb9b9('0x57')]})[_0xb9b9('0x35')](function(_0x27816c){_0x291893[_0xb9b9('0x2f')]=_0x27816c;if(_0x30a3ab['query'][_0xb9b9('0x5b')]){_0x404299[_0xb9b9('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb9b9('0x5d')](_0x404299);})[_0xb9b9('0x35')](function(_0x48337a){_0x291893[_0xb9b9('0x5e')]=_0x48337a;return _0x291893;});}})['then'](respondWithFilteredResult(_0x2ceba2,_0x404299))[_0xb9b9('0x28')](handleError(_0x2ceba2,null));};exports['removeAnswers']=function(_0xffbeab,_0x593c92,_0x54de49){return db[_0xb9b9('0x48')][_0xb9b9('0x63')]({'where':{'id':_0xffbeab[_0xb9b9('0x60')]['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0x593c92,null))[_0xb9b9('0x35')](function(_0xa977af){if(_0xa977af){return _0xa977af[_0xb9b9('0x78')](_0xffbeab[_0xb9b9('0x4e')]['ids']);}})[_0xb9b9('0x35')](respondWithStatusCode(_0x593c92,null))[_0xb9b9('0x28')](handleError(_0x593c92,null));};exports['addAgents']=function(_0x9f662e,_0x323360,_0x30ae6d){return db['WhatsappAccount'][_0xb9b9('0x63')]({'where':{'id':_0x9f662e['params']['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0x323360,null))[_0xb9b9('0x35')](function(_0x32aef6){if(_0x32aef6){return _0x32aef6[_0xb9b9('0x79')](_0x9f662e[_0xb9b9('0x3f')]['ids'],_['omit'](_0x9f662e[_0xb9b9('0x3f')],[_0xb9b9('0x75'),'id'])||{})[_0xb9b9('0x7a')](function(_0x4de523){for(var _0x19f90f=0x0;_0x19f90f<_0x9f662e[_0xb9b9('0x3f')][_0xb9b9('0x75')][_0xb9b9('0x62')];_0x19f90f+=0x1){socket[_0xb9b9('0x7b')](_0xb9b9('0x7c'),{'UserId':_0x9f662e[_0xb9b9('0x3f')][_0xb9b9('0x75')][_0x19f90f],'WhatsappAccountId':_0x9f662e[_0xb9b9('0x60')]['id']});}return _0x4de523;});}})[_0xb9b9('0x35')](respondWithResult(_0x323360,null))['catch'](handleError(_0x323360,null));};exports[_0xb9b9('0x7d')]=function(_0x519406,_0x5442c7,_0x172626){return db[_0xb9b9('0x48')]['find']({'where':{'id':_0x519406['params']['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0x5442c7,null))['then'](function(_0x37aec9){if(_0x37aec9){return _0x37aec9[_0xb9b9('0x7d')](_0x519406[_0xb9b9('0x4e')][_0xb9b9('0x75')])[_0xb9b9('0x35')](function(){if(_['isArray'](_0x519406[_0xb9b9('0x4e')][_0xb9b9('0x75')])){for(var _0x17db11=0x0;_0x17db11<_0x519406['query'][_0xb9b9('0x75')][_0xb9b9('0x62')];_0x17db11+=0x1){socket[_0xb9b9('0x7b')](_0xb9b9('0x7e'),{'UserId':Number(_0x519406[_0xb9b9('0x4e')][_0xb9b9('0x75')][_0x17db11]),'WhatsappAccountId':Number(_0x519406[_0xb9b9('0x60')]['id'])});}}else{socket[_0xb9b9('0x7b')](_0xb9b9('0x7e'),{'UserId':Number(_0x519406[_0xb9b9('0x4e')][_0xb9b9('0x75')]),'WhatsappAccountId':Number(_0x519406['params']['id'])});}});}})[_0xb9b9('0x35')](respondWithStatusCode(_0x5442c7,null))[_0xb9b9('0x28')](handleError(_0x5442c7,null));};exports[_0xb9b9('0x7f')]=function(_0x4b0c9d,_0x33d95f,_0x2c7b0f){var _0x5242e4={};var _0x28a896={};var _0x2ce492;var _0x213063;return db[_0xb9b9('0x48')][_0xb9b9('0x72')]({'where':{'id':_0x4b0c9d['params']['id']}})['then'](handleEntityNotFound(_0x33d95f,null))[_0xb9b9('0x35')](function(_0x94b4df){if(_0x94b4df){_0x2ce492=_0x94b4df;_0x28a896[_0xb9b9('0x4d')]=_[_0xb9b9('0x61')](db[_0xb9b9('0x80')]['rawAttributes']);_0x28a896[_0xb9b9('0x4e')]=_['keys'](_0x4b0c9d[_0xb9b9('0x4e')]);_0x28a896['filters']=_[_0xb9b9('0x51')](_0x28a896[_0xb9b9('0x4d')],_0x28a896[_0xb9b9('0x4e')]);_0x5242e4[_0xb9b9('0x50')]=_['intersection'](_0x28a896[_0xb9b9('0x4d')],qs[_0xb9b9('0x52')](_0x4b0c9d[_0xb9b9('0x4e')][_0xb9b9('0x52')]));_0x5242e4[_0xb9b9('0x50')]=_0x5242e4[_0xb9b9('0x50')][_0xb9b9('0x62')]?_0x5242e4[_0xb9b9('0x50')]:_0x28a896[_0xb9b9('0x4d')];_0x5242e4['order']=qs[_0xb9b9('0x56')](_0x4b0c9d[_0xb9b9('0x4e')][_0xb9b9('0x56')]);_0x5242e4['where']=qs[_0xb9b9('0x4f')](_[_0xb9b9('0x73')](_0x4b0c9d['query'],_0x28a896[_0xb9b9('0x4f')]));if(_0x4b0c9d[_0xb9b9('0x4e')][_0xb9b9('0x58')]){_0x5242e4[_0xb9b9('0x57')]=_[_0xb9b9('0x3e')](_0x5242e4[_0xb9b9('0x57')],{'$or':_[_0xb9b9('0x47')](_0x5242e4[_0xb9b9('0x50')],function(_0x11fc85){var _0x53fce9={};_0x53fce9[_0x11fc85]={'$like':'%'+_0x4b0c9d[_0xb9b9('0x4e')][_0xb9b9('0x58')]+'%'};return _0x53fce9;})});}_0x5242e4=_['merge']({},_0x5242e4,_0x4b0c9d['options']);return _0x2ce492[_0xb9b9('0x7f')](_0x5242e4);}})[_0xb9b9('0x35')](function(_0x371afc){if(_0x371afc){_0x213063=_0x371afc[_0xb9b9('0x62')];if(!_0x4b0c9d['query'][_0xb9b9('0x53')](_0xb9b9('0x54'))){_0x5242e4['limit']=qs[_0xb9b9('0x2e')](_0x4b0c9d[_0xb9b9('0x4e')]['limit']);_0x5242e4[_0xb9b9('0x2c')]=qs[_0xb9b9('0x2c')](_0x4b0c9d[_0xb9b9('0x4e')]['offset']);}return _0x2ce492['getAgents'](_0x5242e4);}})[_0xb9b9('0x35')](function(_0x263723){if(_0x263723){return _0x263723?{'count':_0x213063,'rows':_0x263723}:null;}})[_0xb9b9('0x35')](respondWithResult(_0x33d95f,null))['catch'](handleError(_0x33d95f,null));};exports[_0xb9b9('0x81')]=function(_0x93ec7b,_0x15286a,_0x298d84){return db[_0xb9b9('0x48')][_0xb9b9('0x72')]({'where':{'id':_0x93ec7b[_0xb9b9('0x60')]['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0x15286a,null))['then'](function(_0x403a56){if(_0x403a56){return db[_0xb9b9('0x82')][_0xb9b9('0x83')](function(_0x16108a){return db[_0xb9b9('0x84')][_0xb9b9('0x36')]({'where':{'WhatsappAccountId':_0x93ec7b[_0xb9b9('0x60')]['id']},'transaction':_0x16108a})['then'](function(_0x19ec94){var _0x4b3df5=_[_0xb9b9('0x47')](_0x93ec7b[_0xb9b9('0x3f')],function(_0x220703){_0x220703[_0xb9b9('0x6f')]=_0x93ec7b['params']['id'];return _0x220703;});return db[_0xb9b9('0x84')][_0xb9b9('0x85')](_0x4b3df5,{'transaction':_0x16108a});});})[_0xb9b9('0x35')](function(){return db['WhatsappApplication'][_0xb9b9('0x86')]({'where':{'WhatsappAccountId':_0x93ec7b[_0xb9b9('0x60')]['id']},'order':'priority'});});}})[_0xb9b9('0x35')](respondWithResult(_0x15286a,null))[_0xb9b9('0x28')](handleError(_0x15286a,null));};exports[_0xb9b9('0x87')]=function(_0x4d291c,_0x4603fe,_0x515f5d){var _0x3c9f00={};var _0x4459a8={};var _0x1fbf12;var _0x3d81ce;return db[_0xb9b9('0x48')][_0xb9b9('0x72')]({'where':{'id':_0x4d291c[_0xb9b9('0x60')]['id']}})[_0xb9b9('0x35')](handleEntityNotFound(_0x4603fe,null))[_0xb9b9('0x35')](function(_0xda26a5){if(_0xda26a5){_0x1fbf12=_0xda26a5;_0x4459a8['model']=_['keys'](db[_0xb9b9('0x84')]['rawAttributes']);_0x4459a8[_0xb9b9('0x4e')]=_[_0xb9b9('0x61')](_0x4d291c[_0xb9b9('0x4e')]);_0x4459a8[_0xb9b9('0x4f')]=_[_0xb9b9('0x51')](_0x4459a8[_0xb9b9('0x4d')],_0x4459a8[_0xb9b9('0x4e')]);_0x3c9f00[_0xb9b9('0x50')]=_[_0xb9b9('0x51')](_0x4459a8['model'],qs[_0xb9b9('0x52')](_0x4d291c['query']['fields']));_0x3c9f00[_0xb9b9('0x50')]=_0x3c9f00['attributes']['length']?_0x3c9f00['attributes']:_0x4459a8['model'];_0x3c9f00[_0xb9b9('0x55')]=qs[_0xb9b9('0x56')](_0x4d291c['query'][_0xb9b9('0x56')]);_0x3c9f00[_0xb9b9('0x57')]=qs[_0xb9b9('0x4f')](_[_0xb9b9('0x73')](_0x4d291c[_0xb9b9('0x4e')],_0x4459a8[_0xb9b9('0x4f')]));if(_0x4d291c[_0xb9b9('0x4e')][_0xb9b9('0x58')]){_0x3c9f00['where']=_[_0xb9b9('0x3e')](_0x3c9f00[_0xb9b9('0x57')],{'$or':_['map'](_0x3c9f00['attributes'],function(_0xc85164){var _0x150653={};_0x150653[_0xc85164]={'$like':'%'+_0x4d291c[_0xb9b9('0x4e')][_0xb9b9('0x58')]+'%'};return _0x150653;})});}_0x3c9f00=_[_0xb9b9('0x3e')]({},_0x3c9f00,_0x4d291c['options']);return _0x1fbf12[_0xb9b9('0x87')](_0x3c9f00);}})['then'](function(_0xe5c63f){if(_0xe5c63f){_0x3d81ce=_0xe5c63f['length'];if(!_0x4d291c['query'][_0xb9b9('0x53')](_0xb9b9('0x54'))){_0x3c9f00[_0xb9b9('0x2e')]=qs[_0xb9b9('0x2e')](_0x4d291c[_0xb9b9('0x4e')][_0xb9b9('0x2e')]);_0x3c9f00[_0xb9b9('0x2c')]=qs[_0xb9b9('0x2c')](_0x4d291c[_0xb9b9('0x4e')]['offset']);}return _0x1fbf12[_0xb9b9('0x87')](_0x3c9f00);}})['then'](function(_0xb6e54c){if(_0xb6e54c){return _0xb6e54c?{'count':_0x3d81ce,'rows':_0xb6e54c}:null;}})[_0xb9b9('0x35')](respondWithResult(_0x4603fe,null))[_0xb9b9('0x28')](handleError(_0x4603fe,null));};exports[_0xb9b9('0x88')]=function(_0x1390fd,_0x337826,_0x532436){var _0x471ada={'channel':_0xb9b9('0x89')};var _0x33c792=[];var _0x10688f=[];var _0x22a8e6={};return db[_0xb9b9('0x48')][_0xb9b9('0x63')]({'where':{'id':_0x1390fd[_0xb9b9('0x60')]['id']},'include':[{'model':db[_0xb9b9('0x84')],'as':_0xb9b9('0x8a')}]})[_0xb9b9('0x35')](handleEntityNotFound(_0x337826,null))['then'](function(_0x5e581d){_0x471ada['account']=_0x5e581d;_0x471ada[_0xb9b9('0x8b')]=_[_0xb9b9('0x8c')](_0x5e581d[_0xb9b9('0x8a')],[_0xb9b9('0x8d')],[_0xb9b9('0x8e')]);if(_0x471ada[_0xb9b9('0x43')][_0xb9b9('0x8a')]){delete _0x471ada[_0xb9b9('0x43')][_0xb9b9('0x8a')];}return db['CmContact'][_0xb9b9('0x6d')]();})[_0xb9b9('0x35')](function(_0x27050e){if(!_0x27050e){throw new db[(_0xb9b9('0x8f'))][(_0xb9b9('0x90'))](_0xb9b9('0x91'));}_0x33c792=_[_0xb9b9('0x92')](_[_0xb9b9('0x61')](_0x27050e),[_0xb9b9('0x93'),_0xb9b9('0x94')]);_0x10688f=_[_0xb9b9('0x92')](_[_0xb9b9('0x61')](_0x27050e),[_0xb9b9('0x93'),_0xb9b9('0x94'),_0xb9b9('0x95'),_0xb9b9('0x96')]);_0x471ada['body']={'mapKey':_0xb9b9('0x97')};if(_0x471ada[_0xb9b9('0x43')][_0xb9b9('0x4b')]&&_0x471ada['account']['type']===_0xb9b9('0x98')){_0x471ada['body'][_0xb9b9('0x99')]=_0x1390fd['body'][_0xb9b9('0x9a')][_0xb9b9('0x9b')](_0xb9b9('0x9c'),'');_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x3f')]=_0x1390fd[_0xb9b9('0x3f')][_0xb9b9('0x9d')];_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x9e')]=_0x1390fd[_0xb9b9('0x3f')][_0xb9b9('0x9f')];}if(_0x471ada[_0xb9b9('0x3f')]['id']){delete _0x471ada[_0xb9b9('0x3f')]['id'];}if(_['isNil'](_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x99')])){throw new db[(_0xb9b9('0x8f'))][(_0xb9b9('0x90'))](_0xb9b9('0xa0'));}if(_[_0xb9b9('0xa1')](_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x3f')])||_0x471ada[_0xb9b9('0x3f')]['body']===''){throw new db[(_0xb9b9('0x8f'))]['ValidationError'](_0xb9b9('0xa2'));}if(_[_0xb9b9('0xa1')](_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0xa3')])){throw new db[(_0xb9b9('0x8f'))][(_0xb9b9('0x90'))](_0xb9b9('0xa4')+_0x10688f);}if(!_[_0xb9b9('0xa5')](_0x10688f,_0x471ada['body'][_0xb9b9('0xa3')])){throw new db['Sequelize'][(_0xb9b9('0x90'))](_0xb9b9('0xa6')+_0x10688f);}_0x22a8e6[_0x471ada['body']['mapKey']]=_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x99')];return db[_0xb9b9('0xa7')][_0xb9b9('0x63')]({'where':{'id':_0x471ada['account']['ListId']},'include':[{'model':db[_0xb9b9('0xa8')],'as':'Contacts','where':_0x22a8e6,'limit':0x1,'order':[['updatedAt',_0xb9b9('0xa9')]]}]});})[_0xb9b9('0x35')](handleEntityNotFound(_0x337826,null))[_0xb9b9('0x35')](function(_0xbb8699){if(_0xbb8699){_0x471ada[_0xb9b9('0xaa')]=_['omit'](_0xbb8699,[_0xb9b9('0xab')]);if(_0xbb8699[_0xb9b9('0xab')]['length']){return _0xbb8699[_0xb9b9('0xab')][0x0];}var _0x546571=_[_0xb9b9('0x1a')](_0x471ada[_0xb9b9('0x3f')],{'firstName':_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x99')],'ListId':_0xbb8699['id']});_0x546571[_0x471ada['body'][_0xb9b9('0xa3')]]=_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x99')];return db[_0xb9b9('0xa8')]['create'](_0x546571,{'fields':_0x33c792,'raw':!![]});}})['then'](handleEntityNotFound(_0x337826,null))['then'](function(_0x1e94bc){if(_0x1e94bc){_0x471ada['contact']=_0x1e94bc;var _0x5255e6={'ContactId':_0x1e94bc['id'],'phone':_0x471ada[_0xb9b9('0x3f')]['from'],'WhatsappAccountId':_0x1390fd[_0xb9b9('0x60')]['id']};var _0xa9c5cf={'ContactId':_0x1e94bc['id'],'WhatsappAccountId':_0x1390fd[_0xb9b9('0x60')]['id'],'closed':![]};return db[_0xb9b9('0xac')][_0xb9b9('0x63')]({'where':_0xa9c5cf})[_0xb9b9('0x35')](function(_0x47eb53){if(_0x47eb53){return[_0x47eb53,![]];}return db[_0xb9b9('0xac')][_0xb9b9('0x64')](_0x5255e6)[_0xb9b9('0x35')](function(_0xe6296){return[_0xe6296,!![]];});});}})[_0xb9b9('0x7a')](function(_0x2530b1,_0x36080c){_0x471ada[_0xb9b9('0x42')]=_0x2530b1[_0xb9b9('0x37')]({'plain':!![]});_0x471ada[_0xb9b9('0x42')][_0xb9b9('0xad')]=![];if(_0x36080c){if(_0x471ada[_0xb9b9('0x43')][_0xb9b9('0xae')]){_0x471ada[_0xb9b9('0x8b')][_0xb9b9('0xaf')]({'id':0x0,'priority':_0x471ada[_0xb9b9('0x8b')][_0xb9b9('0x62')]+0x1,'app':_0xb9b9('0xb0'),'appdata':_0xb9b9('0xb1'),'interval':'*,*,*,*'});}_0x471ada[_0xb9b9('0x42')][_0xb9b9('0xad')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x99')],'messageId':_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x9e')],'body':_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0x3f')],'WhatsappAccountId':_0x1390fd[_0xb9b9('0x60')]['id'],'WhatsappInteractionId':_0x2530b1['id'],'direction':'in','ContactId':_0x2530b1[_0xb9b9('0xb2')],'AttachmentId':_0x471ada[_0xb9b9('0x3f')][_0xb9b9('0xb3')]});})[_0xb9b9('0x35')](function(_0x2e0da1){_0x471ada[_0xb9b9('0x26')]=_0x2e0da1;if(_0x471ada[_0xb9b9('0x42')]['UserId']){return db[_0xb9b9('0x80')]['find']({'attributes':['id',_0xb9b9('0x3b')],'where':{'id':_0x471ada['interaction'][_0xb9b9('0xb4')]}})['then'](function(_0x43b1ce){if(_0x43b1ce){_0x471ada[_0xb9b9('0x8b')][_0xb9b9('0xb5')]({'id':0x0,'priority':0x0,'app':_0xb9b9('0x41'),'appdata':_0x43b1ce['name']+','+(_0x471ada['account'][_0xb9b9('0xb6')]||0xa),'interval':_0xb9b9('0xb7')});}return respondWithRpcPromise(_0xb9b9('0xb8'),_0xb9b9('0xb9'),_0x471ada);});}return respondWithRpcPromise(_0xb9b9('0xb8'),_0xb9b9('0xb9'),_0x471ada);})[_0xb9b9('0x35')](function(_0x130c45){if(_0x130c45){var _0x257b32=0xc8;var _0x343507=_0xb9b9('0xba');logger['info'](_0xb9b9('0x22'),_0x343507,_0x257b32,_0xb9b9('0xbb'));logger[_0xb9b9('0xbc')](_0xb9b9('0xbd'),_0x343507,_0x257b32,_0xb9b9('0xbb'),JSON['stringify'](_0x130c45));if(_0x471ada['account']['type']===_0xb9b9('0x98')){return _0x337826[_0xb9b9('0x29')](_0x257b32)['set']('Content-Type',_0xb9b9('0xbe'))[_0xb9b9('0x3c')](_0xb9b9('0xbf'));}else{return _0x337826[_0xb9b9('0x29')](_0x257b32)[_0xb9b9('0x2b')](_0x130c45);}}})[_0xb9b9('0x28')](handleError(_0x337826,null));};exports['send']=function(_0x4b01c3,_0x2557c8,_0x10fd03){var _0x169ecb,_0x5780bf,_0x2b3f28;if(_['isNil'](_0x4b01c3[_0xb9b9('0x3f')][_0xb9b9('0x3f')])||_0x4b01c3[_0xb9b9('0x3f')][_0xb9b9('0x3f')]===''){throw new db[(_0xb9b9('0x8f'))]['ValidationError'](_0xb9b9('0xa2'));}if(_['isNil'](_0x4b01c3[_0xb9b9('0x3f')]['to'])){throw new db[(_0xb9b9('0x8f'))][(_0xb9b9('0x90'))](_0xb9b9('0xc0'));}_0x169ecb=_0x4b01c3[_0xb9b9('0x3f')]['to'];return db[_0xb9b9('0x48')][_0xb9b9('0x63')]({'where':{'id':_0x4b01c3[_0xb9b9('0x60')]['id']},'include':[{'model':db[_0xb9b9('0xa7')],'as':_0xb9b9('0xc1'),'include':[{'model':db['CmContact'],'as':_0xb9b9('0xab'),'where':{'mobile':_0x169ecb},'limit':0x1,'order':[[_0xb9b9('0x94'),_0xb9b9('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x2557c8,null))[_0xb9b9('0x35')](function(_0x18b213){if(_0x18b213&&_0x18b213['List']){_0x5780bf=_0x18b213[_0xb9b9('0x37')]({'plain':!![]});if(_0x5780bf[_0xb9b9('0xc1')]&&_0x5780bf[_0xb9b9('0xc1')][_0xb9b9('0xab')][_0xb9b9('0x62')]){return _0x5780bf[_0xb9b9('0xc1')][_0xb9b9('0xab')][0x0];}return db['CmContact']['create'](_['defaults'](_0x4b01c3[_0xb9b9('0x3f')],{'firstName':_0x169ecb,'mobile':_0x169ecb,'phone':_0x169ecb,'ListId':_0x5780bf[_0xb9b9('0x96')]}));}})[_0xb9b9('0x35')](handleEntityNotFound(_0x2557c8,null))['then'](function(_0x56834e){if(_0x56834e){_0x2b3f28=_0x56834e;return db[_0xb9b9('0xac')][_0xb9b9('0x63')]({'where':{'ContactId':_0x2b3f28['id'],'closed':![],'WhatsappAccountId':_0x5780bf['id']}})[_0xb9b9('0x35')](function(_0x3ec359){if(_0x3ec359){return[_0x3ec359,![]];}return db['WhatsappInteraction'][_0xb9b9('0x64')]({'UserId':_0x4b01c3[_0xb9b9('0x65')]['id'],'ContactId':_0x2b3f28['id'],'WhatsappAccountId':_0x5780bf['id'],'phone':_0x169ecb,'firstMsgDirection':_0xb9b9('0xc2'),'Messages':[_[_0xb9b9('0x3e')](_0x4b01c3[_0xb9b9('0x3f')],{'read':![],'body':_0x4b01c3['body'][_0xb9b9('0x3f')],'phone':_0x169ecb,'WhatsappAccountId':_0x5780bf['id'],'UserId':_0x4b01c3[_0xb9b9('0x65')]['id'],'ContactId':_0x2b3f28['id']})]},{'include':[{'model':db[_0xb9b9('0xc3')],'as':_0xb9b9('0xc4')}]})[_0xb9b9('0x35')](function(_0x496185){return[_0x496185,!![]];});});}})[_0xb9b9('0x7a')](function(_0x446a44,_0x1d4b6e){if(_0x1d4b6e){return _0x446a44;}return db[_0xb9b9('0xc3')]['create'](_[_0xb9b9('0x3e')](_0x4b01c3[_0xb9b9('0x3f')],{'read':![],'body':_0x4b01c3['body'][_0xb9b9('0x3f')],'phone':_0x169ecb,'WhatsappAccountId':_0x5780bf['id'],'WhatsappInteractionId':_0x446a44['id'],'UserId':_0x4b01c3[_0xb9b9('0x65')]['id'],'ContactId':_0x2b3f28['id']}))[_0xb9b9('0x35')](function(_0x5014a0){_0x446a44[_0xb9b9('0xc5')][_0xb9b9('0xc4')]=[];_0x446a44[_0xb9b9('0xc5')][_0xb9b9('0xc4')][_0xb9b9('0xaf')](_0x5014a0[_0xb9b9('0xc5')]);return _0x446a44;});})[_0xb9b9('0x35')](respondWithResult(_0x2557c8,null))['catch'](handleError(_0x2557c8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e452033..a95b6e4 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15ef=['../../mysqldb','WhatsappAccount','save','update','remove','emit','hook','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x15ef,0x80));var _0xf15e=function(_0xdab2d,_0x4a80ef){_0xdab2d=_0xdab2d-0x0;var _0x429827=_0x15ef[_0xdab2d];return _0x429827;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf15e('0x0'))['db'][_0xf15e('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf15e('0x2'),'afterUpdate':_0xf15e('0x3'),'afterDestroy':_0xf15e('0x4')};function emitEvent(_0x347c12){return function(_0x4e7241,_0x5d456b,_0x1b9a24){WhatsappAccountEvents[_0xf15e('0x5')](_0x347c12+':'+_0x4e7241['id'],_0x4e7241);WhatsappAccountEvents['emit'](_0x347c12,_0x4e7241);_0x1b9a24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf15e('0x6')](e,emitEvent(event));}}module[_0xf15e('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x1261=['update','remove','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0x1261,0x144));var _0x1126=function(_0xe3daee,_0x1064e1){_0xe3daee=_0xe3daee-0x0;var _0x1b5f0b=_0x1261[_0xe3daee];return _0x1b5f0b;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1126('0x2')](0x0);var events={'afterCreate':_0x1126('0x3'),'afterUpdate':_0x1126('0x4'),'afterDestroy':_0x1126('0x5')};function emitEvent(_0x3cc93f){return function(_0x4245ca,_0x21a480,_0x75a851){WhatsappAccountEvents['emit'](_0x3cc93f+':'+_0x4245ca['id'],_0x4245ca);WhatsappAccountEvents['emit'](_0x3cc93f,_0x4245ca);_0x75a851(null);};}for(var e in events){if(events[_0x1126('0x6')](e)){var event=events[e];WhatsappAccount[_0x1126('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2b4ca56..f1bd101 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6daf=['define','WhatsappAccount','lodash','util','../../config/logger','api','request-promise','rimraf','./whatsappAccount.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6daf,0x16a));var _0xf6da=function(_0xd69b80,_0x32a1cf){_0xd69b80=_0xd69b80-0x0;var _0x413583=_0x6daf[_0xd69b80];return _0x413583;};'use strict';var _=require(_0xf6da('0x0'));var util=require(_0xf6da('0x1'));var logger=require(_0xf6da('0x2'))(_0xf6da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6da('0x5'));var config=require('../../config/environment');var attributes=require(_0xf6da('0x6'));module[_0xf6da('0x7')]=function(_0x269a86,_0x4dc7ea){return _0x269a86[_0xf6da('0x8')](_0xf6da('0x9'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d97=['request-promise','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','util','api','bluebird'];(function(_0x3dd061,_0x8c0d96){var _0x169c45=function(_0xd2ca6e){while(--_0xd2ca6e){_0x3dd061['push'](_0x3dd061['shift']());}};_0x169c45(++_0x8c0d96);}(_0x1d97,0xc2));var _0x71d9=function(_0x4711b1,_0x4ebdca){_0x4711b1=_0x4711b1-0x0;var _0x192350=_0x1d97[_0x4711b1];return _0x192350;};'use strict';var _=require(_0x71d9('0x0'));var util=require(_0x71d9('0x1'));var logger=require('../../config/logger')(_0x71d9('0x2'));var moment=require('moment');var BPromise=require(_0x71d9('0x3'));var rp=require(_0x71d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71d9('0x5'));module[_0x71d9('0x6')]=function(_0x1ab395,_0x1deadb){return _0x1ab395[_0x71d9('0x7')](_0x71d9('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 9e3d6c5..923ed20 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a95=['catch','ShowWhatsappAccount','find','options','where','attributes','include','map','model','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2d9c9a,_0xbb837c){var _0x3cf5f9=function(_0x1d0ef3){while(--_0x1d0ef3){_0x2d9c9a['push'](_0x2d9c9a['shift']());}};_0x3cf5f9(++_0xbb837c);}(_0x6a95,0xdb));var _0x56a9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6a95[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56a9('0x3'))['db'];var utils=require(_0x56a9('0x4'));var logger=require(_0x56a9('0x5'))(_0x56a9('0x6'));var config=require(_0x56a9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56a9('0x8')]({'port':0x232a});config[_0x56a9('0x9')]=_[_0x56a9('0xa')](config[_0x56a9('0x9')],{'host':_0x56a9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x56a9('0xc'))[_0x56a9('0xd')](socket);function respondWithRpcPromise(_0x47e9d2,_0xf493a8,_0x1cae39){return new BPromise(function(_0x27a3bc,_0x2820d6){return client[_0x56a9('0xe')](_0x47e9d2,_0x1cae39)[_0x56a9('0xf')](function(_0xbbca09){logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xf493a8,'request\x20sent');logger[_0x56a9('0x12')](_0x56a9('0x13'),_0xf493a8,_0x56a9('0x14'),JSON[_0x56a9('0x15')](_0xbbca09));if(_0xbbca09[_0x56a9('0x16')]){if(_0xbbca09[_0x56a9('0x16')][_0x56a9('0x17')]===0x1f4){logger[_0x56a9('0x16')](_0x56a9('0x11'),_0xf493a8,_0xbbca09['error'][_0x56a9('0x18')]);return _0x2820d6(_0xbbca09['error'][_0x56a9('0x18')]);}logger[_0x56a9('0x16')](_0x56a9('0x11'),_0xf493a8,_0xbbca09[_0x56a9('0x16')][_0x56a9('0x18')]);return _0x27a3bc(_0xbbca09[_0x56a9('0x16')][_0x56a9('0x18')]);}else{logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xf493a8,'request\x20sent');_0x27a3bc(_0xbbca09[_0x56a9('0x19')]['message']);}})[_0x56a9('0x1a')](function(_0x5b79e6){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xf493a8,_0x5b79e6);_0x2820d6(_0x5b79e6);});});}exports[_0x56a9('0x1b')]=function(_0x8571f9){var _0x35620b=this;return new Promise(function(_0x36fec1,_0x212b3e){return db['WhatsappAccount'][_0x56a9('0x1c')]({'raw':_0x8571f9[_0x56a9('0x1d')]?_0x8571f9[_0x56a9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x8571f9['options']?_0x8571f9[_0x56a9('0x1d')][_0x56a9('0x1e')]||null:null,'attributes':_0x8571f9[_0x56a9('0x1d')]?_0x8571f9[_0x56a9('0x1d')][_0x56a9('0x1f')]||null:null,'include':_0x8571f9[_0x56a9('0x1d')]?_0x8571f9['options']['include']?_['map'](_0x8571f9[_0x56a9('0x1d')][_0x56a9('0x20')],function(_0x3681c3){return{'model':db[_0x3681c3['model']],'as':_0x3681c3['as'],'attributes':_0x3681c3[_0x56a9('0x1f')],'include':_0x3681c3[_0x56a9('0x20')]?_[_0x56a9('0x21')](_0x3681c3['include'],function(_0x1a4925){return{'model':db[_0x1a4925[_0x56a9('0x22')]],'as':_0x1a4925['as'],'attributes':_0x1a4925[_0x56a9('0x1f')],'include':_0x1a4925[_0x56a9('0x20')]?_[_0x56a9('0x21')](_0x1a4925[_0x56a9('0x20')],function(_0x3ad59a){return{'model':db[_0x3ad59a[_0x56a9('0x22')]],'as':_0x3ad59a['as'],'attributes':_0x3ad59a['attributes']};}):[]};}):[]};}):[]:[]})[_0x56a9('0xf')](function(_0x6899){logger[_0x56a9('0x10')](_0x56a9('0x1b'),_0x8571f9);logger['debug']('ShowWhatsappAccount',_0x8571f9,JSON[_0x56a9('0x15')](_0x6899));_0x36fec1(_0x6899);})[_0x56a9('0x1a')](function(_0x361706){logger[_0x56a9('0x16')](_0x56a9('0x1b'),_0x361706[_0x56a9('0x18')],_0x8571f9);_0x212b3e(_0x35620b[_0x56a9('0x16')](0x1f4,_0x361706['message']));});});}; \ No newline at end of file +var _0x4ca7=['error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','stringify','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x4aefef,_0x452b24){_0x4aefef=_0x4aefef-0x0;var _0x7a6670=_0x4ca7[_0x4aefef];return _0x7a6670;};'use strict';var _=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var moment=require(_0x74ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x74ca('0x3'));var fs=require('fs');var Redis=require(_0x74ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74ca('0x5'))('rpc');var config=require(_0x74ca('0x6'));var jayson=require(_0x74ca('0x7'));var client=jayson['client'][_0x74ca('0x8')]({'port':0x232a});config['redis']=_[_0x74ca('0x9')](config[_0x74ca('0xa')],{'host':_0x74ca('0xb'),'port':0x18eb});var socket=require(_0x74ca('0xc'))(new Redis(config[_0x74ca('0xa')]));require(_0x74ca('0xd'))[_0x74ca('0xe')](socket);function respondWithRpcPromise(_0x589f6a,_0x2d6679,_0x4b4f09){return new BPromise(function(_0x578574,_0x16764e){return client['request'](_0x589f6a,_0x4b4f09)[_0x74ca('0xf')](function(_0x349cea){logger[_0x74ca('0x10')](_0x74ca('0x11'),_0x2d6679,_0x74ca('0x12'));logger[_0x74ca('0x13')](_0x74ca('0x14'),_0x2d6679,_0x74ca('0x12'),JSON['stringify'](_0x349cea));if(_0x349cea[_0x74ca('0x15')]){if(_0x349cea[_0x74ca('0x15')][_0x74ca('0x16')]===0x1f4){logger[_0x74ca('0x15')](_0x74ca('0x11'),_0x2d6679,_0x349cea[_0x74ca('0x15')][_0x74ca('0x17')]);return _0x16764e(_0x349cea[_0x74ca('0x15')][_0x74ca('0x17')]);}logger[_0x74ca('0x15')](_0x74ca('0x11'),_0x2d6679,_0x349cea[_0x74ca('0x15')][_0x74ca('0x17')]);return _0x578574(_0x349cea[_0x74ca('0x15')]['message']);}else{logger[_0x74ca('0x10')](_0x74ca('0x11'),_0x2d6679,_0x74ca('0x12'));_0x578574(_0x349cea[_0x74ca('0x18')][_0x74ca('0x17')]);}})['catch'](function(_0x522014){logger[_0x74ca('0x15')](_0x74ca('0x11'),_0x2d6679,_0x522014);_0x16764e(_0x522014);});});}exports[_0x74ca('0x19')]=function(_0x2b4e1f){var _0x119208=this;return new Promise(function(_0x1fe991,_0x4eab63){return db[_0x74ca('0x1a')][_0x74ca('0x1b')]({'raw':_0x2b4e1f['options']?_0x2b4e1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b4e1f[_0x74ca('0x1c')]?_0x2b4e1f[_0x74ca('0x1c')][_0x74ca('0x1d')]||null:null,'attributes':_0x2b4e1f[_0x74ca('0x1c')]?_0x2b4e1f[_0x74ca('0x1c')][_0x74ca('0x1e')]||null:null,'include':_0x2b4e1f[_0x74ca('0x1c')]?_0x2b4e1f[_0x74ca('0x1c')][_0x74ca('0x1f')]?_[_0x74ca('0x20')](_0x2b4e1f['options']['include'],function(_0x1aeded){return{'model':db[_0x1aeded[_0x74ca('0x21')]],'as':_0x1aeded['as'],'attributes':_0x1aeded[_0x74ca('0x1e')],'include':_0x1aeded[_0x74ca('0x1f')]?_[_0x74ca('0x20')](_0x1aeded['include'],function(_0x422dad){return{'model':db[_0x422dad[_0x74ca('0x21')]],'as':_0x422dad['as'],'attributes':_0x422dad[_0x74ca('0x1e')],'include':_0x422dad[_0x74ca('0x1f')]?_[_0x74ca('0x20')](_0x422dad[_0x74ca('0x1f')],function(_0x227930){return{'model':db[_0x227930[_0x74ca('0x21')]],'as':_0x227930['as'],'attributes':_0x227930[_0x74ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x74ca('0xf')](function(_0x3491ef){logger[_0x74ca('0x10')]('ShowWhatsappAccount',_0x2b4e1f);logger['debug'](_0x74ca('0x19'),_0x2b4e1f,JSON[_0x74ca('0x22')](_0x3491ef));_0x1fe991(_0x3491ef);})[_0x74ca('0x23')](function(_0x27da17){logger[_0x74ca('0x15')]('ShowWhatsappAccount',_0x27da17[_0x74ca('0x17')],_0x2b4e1f);_0x4eab63(_0x119208[_0x74ca('0x15')](0x1f4,_0x27da17['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 9bd5087..b5499b5 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa146=['removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x1a0c8f,_0x500a58){var _0x5454cf=function(_0x56af60){while(--_0x56af60){_0x1a0c8f['push'](_0x1a0c8f['shift']());}};_0x5454cf(++_0x500a58);}(_0xa146,0x11b));var _0x6a14=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa146[_0x18ab2a];return _0x16dcee;};'use strict';var WhatsappAccountEvents=require(_0x6a14('0x0'));var events=[_0x6a14('0x1'),_0x6a14('0x2'),_0x6a14('0x3')];function createListener(_0x5b3bab,_0x18265b){return function(_0xf8b9dd){_0x18265b[_0x6a14('0x4')](_0x5b3bab,_0xf8b9dd);};}function removeListener(_0x1d8c07,_0x1deb4a){return function(){WhatsappAccountEvents[_0x6a14('0x5')](_0x1d8c07,_0x1deb4a);};}exports[_0x6a14('0x6')]=function(_0x3abbce){for(var _0x4187e5=0x0,_0x4c3fb7=events['length'];_0x4187e5<_0x4c3fb7;_0x4187e5++){var _0x371454=events[_0x4187e5];var _0x3a7c2b=createListener(_0x6a14('0x7')+_0x371454,_0x3abbce);WhatsappAccountEvents['on'](_0x371454,_0x3a7c2b);}}; \ No newline at end of file +var _0x4b4d=['length','whatsappAccount:','./whatsappAccount.events','save','update','emit','removeListener'];(function(_0x31c52d,_0x179a64){var _0x3697c6=function(_0x286476){while(--_0x286476){_0x31c52d['push'](_0x31c52d['shift']());}};_0x3697c6(++_0x179a64);}(_0x4b4d,0x183));var _0xd4b4=function(_0x525d99,_0x3fbe38){_0x525d99=_0x525d99-0x0;var _0x1d3503=_0x4b4d[_0x525d99];return _0x1d3503;};'use strict';var WhatsappAccountEvents=require(_0xd4b4('0x0'));var events=[_0xd4b4('0x1'),'remove',_0xd4b4('0x2')];function createListener(_0x180cce,_0x255bbc){return function(_0x4ce945){_0x255bbc[_0xd4b4('0x3')](_0x180cce,_0x4ce945);};}function removeListener(_0x104ab3,_0x1cb707){return function(){WhatsappAccountEvents[_0xd4b4('0x4')](_0x104ab3,_0x1cb707);};}exports['register']=function(_0x1dd7e3){for(var _0x4865e1=0x0,_0x24b511=events[_0xd4b4('0x5')];_0x4865e1<_0x24b511;_0x4865e1++){var _0x269d05=events[_0x4865e1];var _0x9e6bd9=createListener(_0xd4b4('0x6')+_0x269d05,_0x1dd7e3);WhatsappAccountEvents['on'](_0x269d05,_0x9e6bd9);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 9f373bf..169cfdb 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32db=['create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post'];(function(_0x40e075,_0x422fc6){var _0x42c78e=function(_0x46b10e){while(--_0x46b10e){_0x40e075['push'](_0x40e075['shift']());}};_0x42c78e(++_0x422fc6);}(_0x32db,0x9d));var _0xb32d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32db[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb32d('0x0'));var util=require('util');var path=require(_0xb32d('0x1'));var timeout=require(_0xb32d('0x2'));var express=require(_0xb32d('0x3'));var router=express[_0xb32d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb32d('0x5'));var interaction=require(_0xb32d('0x6'));var config=require(_0xb32d('0x7'));var controller=require(_0xb32d('0x8'));router[_0xb32d('0x9')]('/',auth[_0xb32d('0xa')](),controller[_0xb32d('0xb')]);router[_0xb32d('0x9')](_0xb32d('0xc'),auth[_0xb32d('0xa')](),controller['show']);router[_0xb32d('0xd')]('/',auth[_0xb32d('0xa')](),controller[_0xb32d('0xe')]);router[_0xb32d('0xf')]('/:id',auth[_0xb32d('0xa')](),controller[_0xb32d('0x10')]);router['delete']('/:id',auth[_0xb32d('0xa')](),controller[_0xb32d('0x11')]);module[_0xb32d('0x12')]=router; \ No newline at end of file +var _0x56dc=['show','post','create','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id'];(function(_0x5aa70d,_0x5b1330){var _0x3210c3=function(_0x48c7d3){while(--_0x48c7d3){_0x5aa70d['push'](_0x5aa70d['shift']());}};_0x3210c3(++_0x5b1330);}(_0x56dc,0x1a4));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc56d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc56d('0x1'));var express=require(_0xc56d('0x2'));var router=express[_0xc56d('0x3')]();var fs_extra=require(_0xc56d('0x4'));var auth=require(_0xc56d('0x5'));var interaction=require(_0xc56d('0x6'));var config=require(_0xc56d('0x7'));var controller=require(_0xc56d('0x8'));router[_0xc56d('0x9')]('/',auth[_0xc56d('0xa')](),controller['index']);router[_0xc56d('0x9')](_0xc56d('0xb'),auth[_0xc56d('0xa')](),controller[_0xc56d('0xc')]);router[_0xc56d('0xd')]('/',auth['isAuthenticated'](),controller[_0xc56d('0xe')]);router['put'](_0xc56d('0xb'),auth[_0xc56d('0xa')](),controller['update']);router['delete'](_0xc56d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xc56d('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e0661a1..532b624 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd613=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4877bc,_0x24b542){var _0x296c34=function(_0x45e2b0){while(--_0x45e2b0){_0x4877bc['push'](_0x4877bc['shift']());}};_0x296c34(++_0x24b542);}(_0xd613,0x110));var _0x3d61=function(_0x40c5cc,_0x4805df){_0x40c5cc=_0x40c5cc-0x0;var _0x33955f=_0xd613[_0x40c5cc];return _0x33955f;};'use strict';var Sequelize=require(_0x3d61('0x0'));module[_0x3d61('0x1')]={'priority':{'type':Sequelize[_0x3d61('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3d61('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3d61('0x4')]()},'description':{'type':Sequelize[_0x3d61('0x3')]},'interval':{'type':Sequelize[_0x3d61('0x3')],'defaultValue':_0x3d61('0x5')}}; \ No newline at end of file +var _0x3b76=['exports','INTEGER','STRING','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3b76,0xa8));var _0x63b7=function(_0x2e3ddf,_0x4e2626){_0x2e3ddf=_0x2e3ddf-0x0;var _0x9122de=_0x3b76[_0x2e3ddf];return _0x9122de;};'use strict';var Sequelize=require('sequelize');module[_0x63b7('0x0')]={'priority':{'type':Sequelize[_0x63b7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x63b7('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x63b7('0x3')]()},'description':{'type':Sequelize[_0x63b7('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 6e8369c..a8ef5c2 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1dcb=['count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','render','merge','contact','agent','interaction','account','index','WhatsappApplication','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','include','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','path','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit'];(function(_0x18d28a,_0x3a9c65){var _0x46dcab=function(_0x8fd892){while(--_0x8fd892){_0x18d28a['push'](_0x18d28a['shift']());}};_0x46dcab(++_0x3a9c65);}(_0x1dcb,0x79));var _0xb1dc=function(_0x10397a,_0x2f7526){_0x10397a=_0x10397a-0x0;var _0x10d3cb=_0x1dcb[_0x10397a];return _0x10d3cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1dc('0x0'));var zipdir=require(_0xb1dc('0x1'));var jsonpatch=require(_0xb1dc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb1dc('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1dc('0x4'));var squel=require(_0xb1dc('0x5'));var crypto=require('crypto');var jsforce=require(_0xb1dc('0x6'));var deskjs=require(_0xb1dc('0x7'));var toCsv=require(_0xb1dc('0x8'));var querystring=require('querystring');var Papa=require(_0xb1dc('0x9'));var Redis=require(_0xb1dc('0xa'));var authService=require(_0xb1dc('0xb'));var qs=require(_0xb1dc('0xc'));var as=require(_0xb1dc('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb1dc('0xe'));var config=require(_0xb1dc('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1dc('0x10'))['db'];function respondWithStatusCode(_0x960ea3,_0x1e0002){_0x1e0002=_0x1e0002||0xcc;return function(_0x19dff2){if(_0x19dff2){return _0x960ea3[_0xb1dc('0x11')](_0x1e0002);}return _0x960ea3['status'](_0x1e0002)['end']();};}function respondWithResult(_0x5659cc,_0xd640c4){_0xd640c4=_0xd640c4||0xc8;return function(_0x34ec70){if(_0x34ec70){return _0x5659cc[_0xb1dc('0x12')](_0xd640c4)['json'](_0x34ec70);}};}function respondWithFilteredResult(_0xe64b6a,_0x5067a5){return function(_0x28f106){if(_0x28f106){var _0x2e40b2=typeof _0x5067a5['offset']===_0xb1dc('0x13')&&typeof _0x5067a5[_0xb1dc('0x14')]===_0xb1dc('0x13');var _0x292f66=_0x28f106[_0xb1dc('0x15')];var _0x28bd72=_0x2e40b2?0x0:_0x5067a5[_0xb1dc('0x16')];var _0xe4f0a=_0x2e40b2?_0x28f106['count']:_0x5067a5['offset']+_0x5067a5[_0xb1dc('0x14')];var _0x33b571;if(_0xe4f0a>=_0x292f66){_0xe4f0a=_0x292f66;_0x33b571=0xc8;}else{_0x33b571=0xce;}_0xe64b6a[_0xb1dc('0x12')](_0x33b571);return _0xe64b6a[_0xb1dc('0x17')](_0xb1dc('0x18'),_0x28bd72+'-'+_0xe4f0a+'/'+_0x292f66)[_0xb1dc('0x19')](_0x28f106);}return null;};}function patchUpdates(_0x886dc){return function(_0x3870f9){try{jsonpatch[_0xb1dc('0x1a')](_0x3870f9,_0x886dc,!![]);}catch(_0x3f81dc){return BPromise[_0xb1dc('0x1b')](_0x3f81dc);}return _0x3870f9[_0xb1dc('0x1c')]();};}function saveUpdates(_0x145fb6,_0x32b02c){return function(_0x4a08bc){if(_0x4a08bc){return _0x4a08bc[_0xb1dc('0x1d')](_0x145fb6)[_0xb1dc('0x1e')](function(_0x547f06){return _0x547f06;});}return null;};}function removeEntity(_0x3499e0,_0x26991e){return function(_0x2cf0ab){if(_0x2cf0ab){return _0x2cf0ab[_0xb1dc('0x1f')]()[_0xb1dc('0x1e')](function(){_0x3499e0[_0xb1dc('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1612be,_0x3c3f32){return function(_0x3ce2e0){if(!_0x3ce2e0){_0x1612be[_0xb1dc('0x11')](0x194);}return _0x3ce2e0;};}function handleError(_0xa7c450,_0x562f1c){_0x562f1c=_0x562f1c||0x1f4;return function(_0x1ccf25){logger[_0xb1dc('0x20')](_0x1ccf25['stack']);if(_0x1ccf25[_0xb1dc('0x21')]){delete _0x1ccf25['name'];}_0xa7c450[_0xb1dc('0x12')](_0x562f1c)[_0xb1dc('0x22')](_0x1ccf25);};}function getMustacheRender(_0x25707d,_0x3c69c6){return Mustache[_0xb1dc('0x23')](_0x25707d,_[_0xb1dc('0x24')](_0x3c69c6['body'],{'contact':_0x3c69c6[_0xb1dc('0x25')],'message':_0x3c69c6['message'],'agent':_0x3c69c6[_0xb1dc('0x26')],'interaction':_0x3c69c6[_0xb1dc('0x27')],'account':_0x3c69c6[_0xb1dc('0x28')]}))||'';}exports[_0xb1dc('0x29')]=function(_0x419e2c,_0x130c00){var _0x308031={},_0x26feaa={},_0x45c533={'count':0x0,'rows':[]};var _0x5ccc3a=_['map'](db[_0xb1dc('0x2a')][_0xb1dc('0x2b')],function(_0x2ba131){return{'name':_0x2ba131['fieldName'],'type':_0x2ba131['type'][_0xb1dc('0x2c')]};});_0x26feaa[_0xb1dc('0x2d')]=_[_0xb1dc('0x2e')](_0x5ccc3a,_0xb1dc('0x21'));_0x26feaa[_0xb1dc('0x2f')]=_[_0xb1dc('0x30')](_0x419e2c[_0xb1dc('0x2f')]);_0x26feaa[_0xb1dc('0x31')]=_['intersection'](_0x26feaa[_0xb1dc('0x2d')],_0x26feaa[_0xb1dc('0x2f')]);_0x308031[_0xb1dc('0x32')]=_[_0xb1dc('0x33')](_0x26feaa['model'],qs[_0xb1dc('0x34')](_0x419e2c[_0xb1dc('0x2f')][_0xb1dc('0x34')]));_0x308031[_0xb1dc('0x32')]=_0x308031[_0xb1dc('0x32')][_0xb1dc('0x35')]?_0x308031[_0xb1dc('0x32')]:_0x26feaa['model'];if(!_0x419e2c[_0xb1dc('0x2f')][_0xb1dc('0x36')](_0xb1dc('0x37'))){_0x308031[_0xb1dc('0x14')]=qs[_0xb1dc('0x14')](_0x419e2c[_0xb1dc('0x2f')]['limit']);_0x308031[_0xb1dc('0x16')]=qs[_0xb1dc('0x16')](_0x419e2c['query'][_0xb1dc('0x16')]);}_0x308031[_0xb1dc('0x38')]=qs['sort'](_0x419e2c[_0xb1dc('0x2f')][_0xb1dc('0x39')]);_0x308031[_0xb1dc('0x3a')]=qs[_0xb1dc('0x31')](_['pick'](_0x419e2c['query'],_0x26feaa[_0xb1dc('0x31')]),_0x5ccc3a);if(_0x419e2c['query'][_0xb1dc('0x3b')]){_0x308031[_0xb1dc('0x3a')]=_['merge'](_0x308031[_0xb1dc('0x3a')],{'$or':_[_0xb1dc('0x2e')](_0x5ccc3a,function(_0x9bf52b){if(_0x9bf52b[_0xb1dc('0x3c')]!==_0xb1dc('0x3d')){var _0x13fa54={};_0x13fa54[_0x9bf52b['name']]={'$like':'%'+_0x419e2c['query'][_0xb1dc('0x3b')]+'%'};return _0x13fa54;}})});}_0x308031=_[_0xb1dc('0x24')]({},_0x308031,_0x419e2c['options']);var _0x4d63db={'where':_0x308031[_0xb1dc('0x3a')]};return db[_0xb1dc('0x2a')][_0xb1dc('0x15')](_0x4d63db)[_0xb1dc('0x1e')](function(_0x58882c){_0x45c533[_0xb1dc('0x15')]=_0x58882c;if(_0x419e2c[_0xb1dc('0x2f')]['includeAll']){_0x308031[_0xb1dc('0x3e')]=[{'all':!![]}];}return db[_0xb1dc('0x2a')]['findAll'](_0x308031);})[_0xb1dc('0x1e')](function(_0x13e25f){_0x45c533[_0xb1dc('0x3f')]=_0x13e25f;return _0x45c533;})[_0xb1dc('0x1e')](respondWithFilteredResult(_0x130c00,_0x308031))[_0xb1dc('0x40')](handleError(_0x130c00,null));};exports[_0xb1dc('0x41')]=function(_0x4b8b21,_0x1ed653){var _0x3deb59={'raw':!![],'where':{'id':_0x4b8b21[_0xb1dc('0x42')]['id']}},_0x3c08a4={};_0x3c08a4[_0xb1dc('0x2d')]=_[_0xb1dc('0x30')](db['WhatsappApplication'][_0xb1dc('0x2b')]);_0x3c08a4[_0xb1dc('0x2f')]=_[_0xb1dc('0x30')](_0x4b8b21['query']);_0x3c08a4[_0xb1dc('0x31')]=_[_0xb1dc('0x33')](_0x3c08a4[_0xb1dc('0x2d')],_0x3c08a4[_0xb1dc('0x2f')]);_0x3deb59[_0xb1dc('0x32')]=_['intersection'](_0x3c08a4[_0xb1dc('0x2d')],qs['fields'](_0x4b8b21[_0xb1dc('0x2f')][_0xb1dc('0x34')]));_0x3deb59[_0xb1dc('0x32')]=_0x3deb59[_0xb1dc('0x32')][_0xb1dc('0x35')]?_0x3deb59[_0xb1dc('0x32')]:_0x3c08a4[_0xb1dc('0x2d')];if(_0x4b8b21[_0xb1dc('0x2f')][_0xb1dc('0x43')]){_0x3deb59[_0xb1dc('0x3e')]=[{'all':!![]}];}_0x3deb59=_['merge']({},_0x3deb59,_0x4b8b21['options']);return db[_0xb1dc('0x2a')]['find'](_0x3deb59)[_0xb1dc('0x1e')](handleEntityNotFound(_0x1ed653,null))[_0xb1dc('0x1e')](respondWithResult(_0x1ed653,null))[_0xb1dc('0x40')](handleError(_0x1ed653,null));};exports[_0xb1dc('0x44')]=function(_0x5ecc64,_0x154a1c){return db['WhatsappApplication'][_0xb1dc('0x44')](_0x5ecc64[_0xb1dc('0x45')],{})['then'](respondWithResult(_0x154a1c,0xc9))[_0xb1dc('0x40')](handleError(_0x154a1c,null));};exports[_0xb1dc('0x1d')]=function(_0x184855,_0x2ecb99){if(_0x184855[_0xb1dc('0x45')]['id']){delete _0x184855['body']['id'];}return db[_0xb1dc('0x2a')][_0xb1dc('0x46')]({'where':{'id':_0x184855[_0xb1dc('0x42')]['id']}})[_0xb1dc('0x1e')](handleEntityNotFound(_0x2ecb99,null))[_0xb1dc('0x1e')](saveUpdates(_0x184855[_0xb1dc('0x45')],null))[_0xb1dc('0x1e')](respondWithResult(_0x2ecb99,null))[_0xb1dc('0x40')](handleError(_0x2ecb99,null));};exports[_0xb1dc('0x1f')]=function(_0x6a3f26,_0x405f5e){return db[_0xb1dc('0x2a')][_0xb1dc('0x46')]({'where':{'id':_0x6a3f26['params']['id']}})[_0xb1dc('0x1e')](handleEntityNotFound(_0x405f5e,null))[_0xb1dc('0x1e')](removeEntity(_0x405f5e,null))['catch'](handleError(_0x405f5e,null));}; \ No newline at end of file +var _0x2bcf=['pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','map','WhatsappApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x171713,_0x564d77){var _0x1a1f50=function(_0x4223b1){while(--_0x4223b1){_0x171713['push'](_0x171713['shift']());}};_0x1a1f50(++_0x564d77);}(_0x2bcf,0x161));var _0xf2bc=function(_0x583b14,_0x59fe86){_0x583b14=_0x583b14-0x0;var _0x8214dc=_0x2bcf[_0x583b14];return _0x8214dc;};'use strict';var emlformat=require(_0xf2bc('0x0'));var rimraf=require(_0xf2bc('0x1'));var zipdir=require(_0xf2bc('0x2'));var jsonpatch=require(_0xf2bc('0x3'));var rp=require(_0xf2bc('0x4'));var moment=require(_0xf2bc('0x5'));var BPromise=require(_0xf2bc('0x6'));var Mustache=require(_0xf2bc('0x7'));var util=require(_0xf2bc('0x8'));var path=require(_0xf2bc('0x9'));var sox=require(_0xf2bc('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2bc('0xb'));var _=require(_0xf2bc('0xc'));var squel=require(_0xf2bc('0xd'));var crypto=require(_0xf2bc('0xe'));var jsforce=require(_0xf2bc('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf2bc('0x10'));var Papa=require('papaparse');var Redis=require(_0xf2bc('0x11'));var authService=require(_0xf2bc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf2bc('0x13'));var hardwareService=require(_0xf2bc('0x14'));var logger=require('../../config/logger')(_0xf2bc('0x15'));var utils=require(_0xf2bc('0x16'));var config=require(_0xf2bc('0x17'));var licenseUtil=require(_0xf2bc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23579e,_0x44af8b){_0x44af8b=_0x44af8b||0xcc;return function(_0x4df207){if(_0x4df207){return _0x23579e[_0xf2bc('0x19')](_0x44af8b);}return _0x23579e[_0xf2bc('0x1a')](_0x44af8b)[_0xf2bc('0x1b')]();};}function respondWithResult(_0x368c88,_0x32f194){_0x32f194=_0x32f194||0xc8;return function(_0x53cc0e){if(_0x53cc0e){return _0x368c88['status'](_0x32f194)[_0xf2bc('0x1c')](_0x53cc0e);}};}function respondWithFilteredResult(_0x46b721,_0x141ad4){return function(_0x3c81f5){if(_0x3c81f5){var _0x2f15b4=typeof _0x141ad4[_0xf2bc('0x1d')]==='undefined'&&typeof _0x141ad4[_0xf2bc('0x1e')]===_0xf2bc('0x1f');var _0x3c5633=_0x3c81f5[_0xf2bc('0x20')];var _0x5ae5de=_0x2f15b4?0x0:_0x141ad4[_0xf2bc('0x1d')];var _0x288de6=_0x2f15b4?_0x3c81f5[_0xf2bc('0x20')]:_0x141ad4[_0xf2bc('0x1d')]+_0x141ad4[_0xf2bc('0x1e')];var _0x4a9a95;if(_0x288de6>=_0x3c5633){_0x288de6=_0x3c5633;_0x4a9a95=0xc8;}else{_0x4a9a95=0xce;}_0x46b721[_0xf2bc('0x1a')](_0x4a9a95);return _0x46b721[_0xf2bc('0x21')](_0xf2bc('0x22'),_0x5ae5de+'-'+_0x288de6+'/'+_0x3c5633)[_0xf2bc('0x1c')](_0x3c81f5);}return null;};}function patchUpdates(_0x529490){return function(_0x2b610f){try{jsonpatch[_0xf2bc('0x23')](_0x2b610f,_0x529490,!![]);}catch(_0x10a7ff){return BPromise[_0xf2bc('0x24')](_0x10a7ff);}return _0x2b610f[_0xf2bc('0x25')]();};}function saveUpdates(_0x1c8e93,_0x46425a){return function(_0x3e85dd){if(_0x3e85dd){return _0x3e85dd['update'](_0x1c8e93)[_0xf2bc('0x26')](function(_0x27666f){return _0x27666f;});}return null;};}function removeEntity(_0x5380fa,_0x1571e7){return function(_0x4346d5){if(_0x4346d5){return _0x4346d5['destroy']()[_0xf2bc('0x26')](function(){_0x5380fa[_0xf2bc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x115194,_0x41f7d0){return function(_0xd3c65f){if(!_0xd3c65f){_0x115194['sendStatus'](0x194);}return _0xd3c65f;};}function handleError(_0x105e14,_0x4b6f7d){_0x4b6f7d=_0x4b6f7d||0x1f4;return function(_0xfd81cb){logger[_0xf2bc('0x27')](_0xfd81cb[_0xf2bc('0x28')]);if(_0xfd81cb[_0xf2bc('0x29')]){delete _0xfd81cb[_0xf2bc('0x29')];}_0x105e14['status'](_0x4b6f7d)[_0xf2bc('0x2a')](_0xfd81cb);};}function getMustacheRender(_0x462728,_0x3dec3e){return Mustache[_0xf2bc('0x2b')](_0x462728,_[_0xf2bc('0x2c')](_0x3dec3e[_0xf2bc('0x2d')],{'contact':_0x3dec3e[_0xf2bc('0x2e')],'message':_0x3dec3e[_0xf2bc('0x2f')],'agent':_0x3dec3e[_0xf2bc('0x30')],'interaction':_0x3dec3e[_0xf2bc('0x31')],'account':_0x3dec3e[_0xf2bc('0x32')]}))||'';}exports['index']=function(_0x5f2d2d,_0x5eb3e1){var _0x5b91f1={},_0x9f873d={},_0x3ce2cf={'count':0x0,'rows':[]};var _0x2185df=_[_0xf2bc('0x33')](db[_0xf2bc('0x34')]['rawAttributes'],function(_0x507b93){return{'name':_0x507b93[_0xf2bc('0x35')],'type':_0x507b93['type'][_0xf2bc('0x36')]};});_0x9f873d[_0xf2bc('0x37')]=_[_0xf2bc('0x33')](_0x2185df,'name');_0x9f873d[_0xf2bc('0x38')]=_['keys'](_0x5f2d2d['query']);_0x9f873d[_0xf2bc('0x39')]=_[_0xf2bc('0x3a')](_0x9f873d[_0xf2bc('0x37')],_0x9f873d[_0xf2bc('0x38')]);_0x5b91f1[_0xf2bc('0x3b')]=_[_0xf2bc('0x3a')](_0x9f873d[_0xf2bc('0x37')],qs[_0xf2bc('0x3c')](_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x3c')]));_0x5b91f1[_0xf2bc('0x3b')]=_0x5b91f1['attributes'][_0xf2bc('0x3d')]?_0x5b91f1['attributes']:_0x9f873d['model'];if(!_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x3e')](_0xf2bc('0x3f'))){_0x5b91f1[_0xf2bc('0x1e')]=qs[_0xf2bc('0x1e')](_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x1e')]);_0x5b91f1[_0xf2bc('0x1d')]=qs[_0xf2bc('0x1d')](_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x1d')]);}_0x5b91f1[_0xf2bc('0x40')]=qs[_0xf2bc('0x41')](_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x41')]);_0x5b91f1[_0xf2bc('0x42')]=qs[_0xf2bc('0x39')](_[_0xf2bc('0x43')](_0x5f2d2d[_0xf2bc('0x38')],_0x9f873d[_0xf2bc('0x39')]),_0x2185df);if(_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x44')]){_0x5b91f1[_0xf2bc('0x42')]=_[_0xf2bc('0x2c')](_0x5b91f1[_0xf2bc('0x42')],{'$or':_[_0xf2bc('0x33')](_0x2185df,function(_0x25c924){if(_0x25c924[_0xf2bc('0x45')]!==_0xf2bc('0x46')){var _0x503dae={};_0x503dae[_0x25c924[_0xf2bc('0x29')]]={'$like':'%'+_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x44')]+'%'};return _0x503dae;}})});}_0x5b91f1=_[_0xf2bc('0x2c')]({},_0x5b91f1,_0x5f2d2d[_0xf2bc('0x47')]);var _0x4a3ea3={'where':_0x5b91f1[_0xf2bc('0x42')]};return db[_0xf2bc('0x34')]['count'](_0x4a3ea3)['then'](function(_0x498ec4){_0x3ce2cf[_0xf2bc('0x20')]=_0x498ec4;if(_0x5f2d2d[_0xf2bc('0x38')][_0xf2bc('0x48')]){_0x5b91f1[_0xf2bc('0x49')]=[{'all':!![]}];}return db[_0xf2bc('0x34')][_0xf2bc('0x4a')](_0x5b91f1);})[_0xf2bc('0x26')](function(_0x3b79db){_0x3ce2cf[_0xf2bc('0x4b')]=_0x3b79db;return _0x3ce2cf;})[_0xf2bc('0x26')](respondWithFilteredResult(_0x5eb3e1,_0x5b91f1))[_0xf2bc('0x4c')](handleError(_0x5eb3e1,null));};exports[_0xf2bc('0x4d')]=function(_0x326358,_0x22face){var _0x5d0e87={'raw':!![],'where':{'id':_0x326358[_0xf2bc('0x4e')]['id']}},_0x1c62aa={};_0x1c62aa[_0xf2bc('0x37')]=_[_0xf2bc('0x4f')](db[_0xf2bc('0x34')]['rawAttributes']);_0x1c62aa[_0xf2bc('0x38')]=_[_0xf2bc('0x4f')](_0x326358[_0xf2bc('0x38')]);_0x1c62aa[_0xf2bc('0x39')]=_[_0xf2bc('0x3a')](_0x1c62aa[_0xf2bc('0x37')],_0x1c62aa[_0xf2bc('0x38')]);_0x5d0e87[_0xf2bc('0x3b')]=_[_0xf2bc('0x3a')](_0x1c62aa[_0xf2bc('0x37')],qs[_0xf2bc('0x3c')](_0x326358[_0xf2bc('0x38')][_0xf2bc('0x3c')]));_0x5d0e87[_0xf2bc('0x3b')]=_0x5d0e87['attributes']['length']?_0x5d0e87['attributes']:_0x1c62aa[_0xf2bc('0x37')];if(_0x326358[_0xf2bc('0x38')]['includeAll']){_0x5d0e87[_0xf2bc('0x49')]=[{'all':!![]}];}_0x5d0e87=_[_0xf2bc('0x2c')]({},_0x5d0e87,_0x326358[_0xf2bc('0x47')]);return db[_0xf2bc('0x34')][_0xf2bc('0x50')](_0x5d0e87)[_0xf2bc('0x26')](handleEntityNotFound(_0x22face,null))['then'](respondWithResult(_0x22face,null))[_0xf2bc('0x4c')](handleError(_0x22face,null));};exports[_0xf2bc('0x51')]=function(_0x45908f,_0x408115){return db[_0xf2bc('0x34')]['create'](_0x45908f[_0xf2bc('0x2d')],{})[_0xf2bc('0x26')](respondWithResult(_0x408115,0xc9))[_0xf2bc('0x4c')](handleError(_0x408115,null));};exports[_0xf2bc('0x52')]=function(_0x4ce161,_0x26109a){if(_0x4ce161['body']['id']){delete _0x4ce161[_0xf2bc('0x2d')]['id'];}return db[_0xf2bc('0x34')][_0xf2bc('0x50')]({'where':{'id':_0x4ce161[_0xf2bc('0x4e')]['id']}})[_0xf2bc('0x26')](handleEntityNotFound(_0x26109a,null))['then'](saveUpdates(_0x4ce161[_0xf2bc('0x2d')],null))['then'](respondWithResult(_0x26109a,null))[_0xf2bc('0x4c')](handleError(_0x26109a,null));};exports[_0xf2bc('0x53')]=function(_0x3ce280,_0x261df5){return db['WhatsappApplication']['find']({'where':{'id':_0x3ce280[_0xf2bc('0x4e')]['id']}})[_0xf2bc('0x26')](handleEntityNotFound(_0x261df5,null))[_0xf2bc('0x26')](removeEntity(_0x261df5,null))[_0xf2bc('0x4c')](handleError(_0x261df5,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d89613d..e3b4eea 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x578f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x578f,0x143));var _0xf578=function(_0x41dca0,_0x51380a){_0x41dca0=_0x41dca0-0x0;var _0x3cabe3=_0x578f[_0x41dca0];return _0x3cabe3;};'use strict';var _=require(_0xf578('0x0'));var util=require(_0xf578('0x1'));var logger=require('../../config/logger')(_0xf578('0x2'));var moment=require(_0xf578('0x3'));var BPromise=require(_0xf578('0x4'));var rp=require(_0xf578('0x5'));var fs=require('fs');var path=require(_0xf578('0x6'));var rimraf=require(_0xf578('0x7'));var config=require(_0xf578('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0xf578('0x9')]=function(_0x398288,_0x3b8e8){return _0x398288['define']('WhatsappApplication',attributes,{'tableName':_0xf578('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf578('0xb'),'collate':_0xf578('0xc')});}; \ No newline at end of file +var _0x2a9f=['utf8mb4','lodash','api','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0x2a9f,0xe2));var _0xf2a9=function(_0x403c07,_0xea0564){_0x403c07=_0x403c07-0x0;var _0x72ab9f=_0x2a9f[_0x403c07];return _0x72ab9f;};'use strict';var _=require(_0xf2a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf2a9('0x1'));var moment=require('moment');var BPromise=require(_0xf2a9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf2a9('0x3'));var config=require(_0xf2a9('0x4'));var attributes=require(_0xf2a9('0x5'));module['exports']=function(_0x4c6dc4,_0x1bb936){return _0x4c6dc4[_0xf2a9('0x6')](_0xf2a9('0x7'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2a9('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index dffd0f2..839452c 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4351=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xa0fa61,_0x362cba){var _0x1b1878=function(_0x488f4b){while(--_0x488f4b){_0xa0fa61['push'](_0xa0fa61['shift']());}};_0x1b1878(++_0x362cba);}(_0x4351,0x1b5));var _0x1435=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4351[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var moment=require(_0x1435('0x2'));var BPromise=require(_0x1435('0x3'));var rs=require(_0x1435('0x4'));var fs=require('fs');var Redis=require(_0x1435('0x5'));var db=require(_0x1435('0x6'))['db'];var utils=require(_0x1435('0x7'));var logger=require(_0x1435('0x8'))(_0x1435('0x9'));var config=require(_0x1435('0xa'));var jayson=require(_0x1435('0xb'));var client=jayson[_0x1435('0xc')][_0x1435('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x337fd6,_0x56ce86,_0x10760d){return new BPromise(function(_0x5de4b0,_0x4d04c7){return client[_0x1435('0xe')](_0x337fd6,_0x10760d)[_0x1435('0xf')](function(_0x14a9e1){logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,'request\x20sent');logger[_0x1435('0x12')](_0x1435('0x13'),_0x56ce86,'request\x20sent',JSON['stringify'](_0x14a9e1));if(_0x14a9e1[_0x1435('0x14')]){if(_0x14a9e1['error'][_0x1435('0x15')]===0x1f4){logger['error'](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x4d04c7(_0x14a9e1['error'][_0x1435('0x16')]);}logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x5de4b0(_0x14a9e1[_0x1435('0x14')]['message']);}else{logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,_0x1435('0x17'));_0x5de4b0(_0x14a9e1[_0x1435('0x18')][_0x1435('0x16')]);}})[_0x1435('0x19')](function(_0x5ecd){logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x5ecd);_0x4d04c7(_0x5ecd);});});} \ No newline at end of file +var _0x44e8=['WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug'];(function(_0x26fa23,_0x5f0a06){var _0x3e7760=function(_0x272496){while(--_0x272496){_0x26fa23['push'](_0x26fa23['shift']());}};_0x3e7760(++_0x5f0a06);}(_0x44e8,0xd7));var _0x844e=function(_0x1337ae,_0x5f5dbf){_0x1337ae=_0x1337ae-0x0;var _0x4b716d=_0x44e8[_0x1337ae];return _0x4b716d;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x844e('0x1'));var rs=require(_0x844e('0x2'));var fs=require('fs');var Redis=require(_0x844e('0x3'));var db=require(_0x844e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x844e('0x5'))(_0x844e('0x6'));var config=require(_0x844e('0x7'));var jayson=require(_0x844e('0x8'));var client=jayson['client'][_0x844e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238796,_0x1706b3,_0x11cbd6){return new BPromise(function(_0x571b91,_0x31ab50){return client[_0x844e('0xa')](_0x238796,_0x11cbd6)[_0x844e('0xb')](function(_0x134672){logger[_0x844e('0xc')](_0x844e('0xd'),_0x1706b3,'request\x20sent');logger[_0x844e('0xe')](_0x844e('0xf'),_0x1706b3,_0x844e('0x10'),JSON[_0x844e('0x11')](_0x134672));if(_0x134672[_0x844e('0x12')]){if(_0x134672[_0x844e('0x12')][_0x844e('0x13')]===0x1f4){logger['error'](_0x844e('0xd'),_0x1706b3,_0x134672[_0x844e('0x12')]['message']);return _0x31ab50(_0x134672[_0x844e('0x12')][_0x844e('0x14')]);}logger['error'](_0x844e('0xd'),_0x1706b3,_0x134672[_0x844e('0x12')][_0x844e('0x14')]);return _0x571b91(_0x134672['error'][_0x844e('0x14')]);}else{logger[_0x844e('0xc')](_0x844e('0xd'),_0x1706b3,_0x844e('0x10'));_0x571b91(_0x134672[_0x844e('0x15')][_0x844e('0x14')]);}})[_0x844e('0x16')](function(_0x5506ef){logger['error'](_0x844e('0xd'),_0x1706b3,_0x5506ef);_0x31ab50(_0x5506ef);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 674a8ca..1bc3ff2 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8286=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','exports'];(function(_0x420b13,_0x26a7cf){var _0x33e4eb=function(_0x4a9d7){while(--_0x4a9d7){_0x420b13['push'](_0x420b13['shift']());}};_0x33e4eb(++_0x26a7cf);}(_0x8286,0x1ed));var _0x6828=function(_0x33ce05,_0x269397){_0x33ce05=_0x33ce05-0x0;var _0x1c3c73=_0x8286[_0x33ce05];return _0x1c3c73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6828('0x0'));var timeout=require(_0x6828('0x1'));var express=require('express');var router=express[_0x6828('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6828('0x3'));var interaction=require(_0x6828('0x4'));var config=require(_0x6828('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x6828('0x6')]('/',auth[_0x6828('0x7')](),controller[_0x6828('0x8')]);router['get'](_0x6828('0x9'),auth[_0x6828('0x7')](),controller['describe']);router[_0x6828('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x6828('0xa'),auth[_0x6828('0x7')](),controller[_0x6828('0xb')]);router['get'](_0x6828('0xc'),auth[_0x6828('0x7')](),controller[_0x6828('0xd')]);router[_0x6828('0xe')]('/',auth['isAuthenticated'](),controller[_0x6828('0xf')]);router['post']('/:id/messages',auth[_0x6828('0x7')](),controller[_0x6828('0x10')]);router[_0x6828('0xe')](_0x6828('0x11'),auth[_0x6828('0x7')](),interaction['tracked']('whatsapp',_0x6828('0x12')),controller[_0x6828('0x13')]);router[_0x6828('0x14')](_0x6828('0x15'),auth[_0x6828('0x7')](),interaction[_0x6828('0x16')](_0x6828('0x17'),_0x6828('0x18')),controller[_0x6828('0x19')]);router[_0x6828('0x1a')](_0x6828('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x6828('0x17'),_0x6828('0x1b')),controller['destroy']);router[_0x6828('0x1a')](_0x6828('0x11'),auth[_0x6828('0x7')](),controller['removeTags']);module[_0x6828('0x1c')]=router; \ No newline at end of file +var _0xc4ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','exports','util'];(function(_0xd79dd3,_0x561232){var _0x34b0b9=function(_0x2f6de9){while(--_0x2f6de9){_0xd79dd3['push'](_0xd79dd3['shift']());}};_0x34b0b9(++_0x561232);}(_0xc4ed,0x1b1));var _0xdc4e=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xc4ed[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require('multer');var util=require(_0xdc4e('0x0'));var path=require(_0xdc4e('0x1'));var timeout=require(_0xdc4e('0x2'));var express=require(_0xdc4e('0x3'));var router=express['Router']();var fs_extra=require(_0xdc4e('0x4'));var auth=require(_0xdc4e('0x5'));var interaction=require(_0xdc4e('0x6'));var config=require(_0xdc4e('0x7'));var controller=require(_0xdc4e('0x8'));router[_0xdc4e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdc4e('0xa'),auth[_0xdc4e('0xb')](),controller['describe']);router[_0xdc4e('0x9')](_0xdc4e('0xc'),auth['isAuthenticated'](),controller[_0xdc4e('0xd')]);router['get'](_0xdc4e('0xe'),auth[_0xdc4e('0xb')](),controller[_0xdc4e('0xf')]);router['get'](_0xdc4e('0x10'),auth[_0xdc4e('0xb')](),controller[_0xdc4e('0x11')]);router[_0xdc4e('0x12')]('/',auth[_0xdc4e('0xb')](),controller['create']);router['post']('/:id/messages',auth[_0xdc4e('0xb')](),controller['addMessage']);router['post'](_0xdc4e('0x13'),auth['isAuthenticated'](),interaction[_0xdc4e('0x14')](_0xdc4e('0x15'),_0xdc4e('0x16')),controller[_0xdc4e('0x17')]);router[_0xdc4e('0x18')](_0xdc4e('0xc'),auth[_0xdc4e('0xb')](),interaction['tracked'](_0xdc4e('0x15'),_0xdc4e('0x19')),controller[_0xdc4e('0x1a')]);router[_0xdc4e('0x1b')]('/:id',auth[_0xdc4e('0xb')](),interaction[_0xdc4e('0x14')](_0xdc4e('0x15'),'whatsappinteraction:destroy'),controller[_0xdc4e('0x1c')]);router[_0xdc4e('0x1b')](_0xdc4e('0x13'),auth[_0xdc4e('0xb')](),controller[_0xdc4e('0x1d')]);module[_0xdc4e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1b68d69..37aeeac 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85cf=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x275f94,_0x2b723a){var _0x302f39=function(_0x47363d){while(--_0x47363d){_0x275f94['push'](_0x275f94['shift']());}};_0x302f39(++_0x2b723a);}(_0x85cf,0x76));var _0xf85c=function(_0x53e9fa,_0x58be07){_0x53e9fa=_0x53e9fa-0x0;var _0x19181f=_0x85cf[_0x53e9fa];return _0x19181f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf85c('0x0'));module[_0xf85c('0x1')]={'closed':{'type':Sequelize[_0xf85c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf85c('0x3')]},'disposition':{'type':Sequelize[_0xf85c('0x4')]},'secondDisposition':{'type':Sequelize[_0xf85c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf85c('0x4')]},'note':{'type':Sequelize[_0xf85c('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf85c('0x5')]('in',_0xf85c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf85c('0x5')]('in',_0xf85c('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x55e4=['ENUM','out','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x2bafda,_0x549e45){var _0x451a1e=function(_0x2ea385){while(--_0x2ea385){_0x2bafda['push'](_0x2bafda['shift']());}};_0x451a1e(++_0x549e45);}(_0x55e4,0x142));var _0x455e=function(_0x95da01,_0x20c704){_0x95da01=_0x95da01-0x0;var _0x4bced7=_0x55e4[_0x95da01];return _0x4bced7;};'use strict';var Sequelize=require(_0x455e('0x0'));var moment=require(_0x455e('0x1'));module[_0x455e('0x2')]={'closed':{'type':Sequelize[_0x455e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x455e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x455e('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x455e('0x4')]},'read1stAt':{'type':Sequelize[_0x455e('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x455e('0x6')]('in',_0x455e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0654c40..428901c 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c60=['offset','undefined','limit','set','Content-Range','apply','update','then','destroy','end','stack','name','send','body','message','agent','account','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','key','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','order','sort','where','pick','field','color','from','tools_tags','u.id','ui.WhatsappInteractionId','left_join','users','select','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','getFullTextValue','ContactId','buildExpression','type','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','start','some','isEmpty','i.WhatsappAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','WhatsappAccountId','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','count','merge','fields','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','rows','show','params','rawAttributes','includeAll','options','create','catch','describe','addMessage','ids','getMessages','WhatsappMessage','filter','YYYY-MM-DD\x20HH:mm:ss','include','findAll','spread','Tag','emit','whatsappInteractionTags:save','download','toString','join','root','server','files','tmp','attachments','firstName','Attachment','Messages','createdAt','WhatsappAccount','Owner','get','mkdirSync','N.A.','format','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','Contact','lastName','secret','renderFile','views','downloadInteraction.html','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','json'];(function(_0x2efbc1,_0x32efa9){var _0x2de0f2=function(_0x412576){while(--_0x412576){_0x2efbc1['push'](_0x2efbc1['shift']());}};_0x2de0f2(++_0x32efa9);}(_0x4c60,0xc1));var _0x04c6=function(_0x4b2d70,_0x22de89){_0x4b2d70=_0x4b2d70-0x0;var _0x58f1e3=_0x4c60[_0x4b2d70];return _0x58f1e3;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x04c6('0x10'));var logger=require(_0x04c6('0x11'))('api');var utils=require(_0x04c6('0x12'));var config=require(_0x04c6('0x13'));var licenseUtil=require(_0x04c6('0x14'));var db=require(_0x04c6('0x15'))['db'];config['redis']=_[_0x04c6('0x16')](config[_0x04c6('0x17')],{'host':_0x04c6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04c6('0x17')]));require(_0x04c6('0x19'))[_0x04c6('0x1a')](socket);function respondWithStatusCode(_0x3e80a6,_0x4760f8){_0x4760f8=_0x4760f8||0xcc;return function(_0x19a26f){if(_0x19a26f){return _0x3e80a6[_0x04c6('0x1b')](_0x4760f8);}return _0x3e80a6[_0x04c6('0x1c')](_0x4760f8)['end']();};}function respondWithResult(_0x31edf9,_0xa2bc92){_0xa2bc92=_0xa2bc92||0xc8;return function(_0x382e58){if(_0x382e58){return _0x31edf9[_0x04c6('0x1c')](_0xa2bc92)[_0x04c6('0x1d')](_0x382e58);}};}function respondWithFilteredResult(_0xfb4db5,_0x21674a){return function(_0x423ea9){if(_0x423ea9){var _0x47f400=typeof _0x21674a[_0x04c6('0x1e')]===_0x04c6('0x1f')&&typeof _0x21674a[_0x04c6('0x20')]==='undefined';var _0x4cef4e=_0x423ea9['count'];var _0x41ad4f=_0x47f400?0x0:_0x21674a[_0x04c6('0x1e')];var _0x50dd61=_0x47f400?_0x423ea9['count']:_0x21674a[_0x04c6('0x1e')]+_0x21674a[_0x04c6('0x20')];var _0x3cd448;if(_0x50dd61>=_0x4cef4e){_0x50dd61=_0x4cef4e;_0x3cd448=0xc8;}else{_0x3cd448=0xce;}_0xfb4db5['status'](_0x3cd448);return _0xfb4db5[_0x04c6('0x21')](_0x04c6('0x22'),_0x41ad4f+'-'+_0x50dd61+'/'+_0x4cef4e)[_0x04c6('0x1d')](_0x423ea9);}return null;};}function patchUpdates(_0x49c179){return function(_0x2d3277){try{jsonpatch[_0x04c6('0x23')](_0x2d3277,_0x49c179,!![]);}catch(_0x562491){return BPromise['reject'](_0x562491);}return _0x2d3277['save']();};}function saveUpdates(_0x348ea3,_0x3a2014){return function(_0xd5828d){if(_0xd5828d){return _0xd5828d[_0x04c6('0x24')](_0x348ea3)[_0x04c6('0x25')](function(_0x52e5f5){return _0x52e5f5;});}return null;};}function removeEntity(_0x562952,_0x383435){return function(_0x2ab1d2){if(_0x2ab1d2){return _0x2ab1d2[_0x04c6('0x26')]()[_0x04c6('0x25')](function(){_0x562952[_0x04c6('0x1c')](0xcc)[_0x04c6('0x27')]();});}};}function handleEntityNotFound(_0x47c69a,_0x1d0d3f){return function(_0x165cb5){if(!_0x165cb5){_0x47c69a['sendStatus'](0x194);}return _0x165cb5;};}function handleError(_0x264cde,_0x1cd16a){_0x1cd16a=_0x1cd16a||0x1f4;return function(_0x5f1331){logger['error'](_0x5f1331[_0x04c6('0x28')]);if(_0x5f1331[_0x04c6('0x29')]){delete _0x5f1331[_0x04c6('0x29')];}_0x264cde[_0x04c6('0x1c')](_0x1cd16a)[_0x04c6('0x2a')](_0x5f1331);};}function getMustacheRender(_0x43884e,_0x49c4ed){return Mustache['render'](_0x43884e,_['merge'](_0x49c4ed[_0x04c6('0x2b')],{'contact':_0x49c4ed['contact'],'message':_0x49c4ed[_0x04c6('0x2c')],'agent':_0x49c4ed[_0x04c6('0x2d')],'interaction':_0x49c4ed['interaction'],'account':_0x49c4ed[_0x04c6('0x2e')]}))||'';}function getInteractionUsers(_0x36f2af,_0x6e43fb){return new BPromise(function(_0x14b6f6,_0x5b2056){try{if(_0x6e43fb[_0x36f2af['id']]){_0x36f2af[_0x04c6('0x2f')]=_[_0x04c6('0x30')](_0x6e43fb[_0x36f2af['id']],function(_0x3f7de7){return{'id':_0x3f7de7['id'],'fullname':_0x3f7de7[_0x04c6('0x31')]};});}}catch(_0x3762af){_0x5b2056(_0x3762af);}_0x14b6f6(_0x36f2af);});}function getInteractionTags(_0x902e66,_0x3e59b2){return new BPromise(function(_0x46380e,_0x19a05b){try{if(_0x902e66[_0x04c6('0x32')]){_0x902e66[_0x04c6('0x33')]=[];_0x902e66[_0x04c6('0x32')][_0x04c6('0x34')](',')[_0x04c6('0x35')](function(_0x209f88){_0x902e66['Tags'][_0x04c6('0x36')](_0x3e59b2[_0x209f88]);});}delete _0x902e66[_0x04c6('0x32')];}catch(_0x332811){_0x19a05b(_0x332811);}_0x46380e(_0x902e66);});}function updateWhatsappInteraction(_0x206e32,_0x5a2e6a,_0x181736){return new BPromise(function(_0x31de0f,_0x4e1cfa){return getInteractionUsers(_0x206e32,_0x181736)['then'](function(_0x4aac49){return getInteractionTags(_0x4aac49,_0x5a2e6a);})[_0x04c6('0x25')](function(_0x2382ff){_0x31de0f(_0x2382ff);})['catch'](function(_0x3fbdd0){_0x4e1cfa(_0x3fbdd0);});});}exports['index']=function(_0x15c270,_0x1373ca){var _0x3806ea={},_0x2b28cd={},_0x5144f5={'count':0x0,'rows':[]};var _0x57ce4b=_[_0x04c6('0x30')](db[_0x04c6('0x37')]['rawAttributes'],function(_0x3f4fad){return{'name':_0x3f4fad['fieldName'],'type':_0x3f4fad['type'][_0x04c6('0x38')]};});_0x2b28cd['model']=_[_0x04c6('0x30')](_0x57ce4b,_0x04c6('0x29'));_0x2b28cd['query']=_[_0x04c6('0x39')](_0x15c270['query']);_0x2b28cd[_0x04c6('0x3a')]=_[_0x04c6('0x3b')](_0x2b28cd[_0x04c6('0x3c')],_0x2b28cd[_0x04c6('0x3d')]);_0x3806ea[_0x04c6('0x3e')]=_['intersection'](_0x2b28cd[_0x04c6('0x3c')],qs['fields'](_0x15c270[_0x04c6('0x3d')]['fields']));_0x3806ea[_0x04c6('0x3e')]=_0x3806ea[_0x04c6('0x3e')][_0x04c6('0x3f')]?_0x3806ea[_0x04c6('0x3e')]:_0x2b28cd[_0x04c6('0x3c')];if(!_0x15c270[_0x04c6('0x3d')][_0x04c6('0x40')]('nolimit')){_0x3806ea[_0x04c6('0x20')]=qs['limit'](_0x15c270[_0x04c6('0x3d')]['limit']);_0x3806ea['offset']=qs[_0x04c6('0x1e')](_0x15c270['query'][_0x04c6('0x1e')]);}_0x3806ea[_0x04c6('0x41')]=qs[_0x04c6('0x42')](_0x15c270['query'][_0x04c6('0x42')]);_0x3806ea[_0x04c6('0x43')]=qs[_0x04c6('0x3a')](_[_0x04c6('0x44')](_0x15c270[_0x04c6('0x3d')],_0x2b28cd[_0x04c6('0x3a')]),_0x57ce4b);var _0x240a22=[];var _0x5a2d24=squel['select']()[_0x04c6('0x45')]('id')[_0x04c6('0x45')](_0x04c6('0x29'))['field'](_0x04c6('0x46'))[_0x04c6('0x47')](_0x04c6('0x48'));var _0x549911=squel['select']()['field'](_0x04c6('0x49'))[_0x04c6('0x45')]('u.fullname')[_0x04c6('0x45')](_0x04c6('0x4a'))[_0x04c6('0x47')]('user_has_whatsapp_interactions','ui')[_0x04c6('0x4b')](_0x04c6('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x25a6fc=squel[_0x04c6('0x4d')]()[_0x04c6('0x47')](_0x04c6('0x4e'),'i')['left_join'](_0x04c6('0x4f'),'c',_0x04c6('0x50'))[_0x04c6('0x4b')](_0x04c6('0x4c'),'o','o.id\x20=\x20i.UserId')[_0x04c6('0x4b')](_0x04c6('0x51'),'a',_0x04c6('0x52'))[_0x04c6('0x4b')]('whatsapp_messages','me',_0x04c6('0x53'))[_0x04c6('0x4b')](_0x04c6('0x54'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x04c6('0x4b')](_0x04c6('0x48'),'t',_0x04c6('0x55'));var _0xd31976=squel[_0x04c6('0x56')]();var _0x28e563=[];var _0x1b8fa4=squel[_0x04c6('0x56')]();var _0x623acf;if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x57')]){_0x623acf=as[_0x04c6('0x58')](_0x15c270[_0x04c6('0x3d')]['search']);var _0x3a80f6=_0x623acf[_0x04c6('0x59')];for(var _0x5ce521=0x0;_0x5ce521<_0x623acf[_0x04c6('0x5a')][_0x04c6('0x3f')];_0x5ce521++){var _0x48124f=_0x623acf[_0x04c6('0x5a')][_0x5ce521];var _0x17778b='i';var _0xc29082=_[_0x04c6('0x5b')](_0x57ce4b,[_0x04c6('0x29'),_0x48124f[_0x04c6('0x45')]]);if(!_0xc29082){switch(_0x48124f[_0x04c6('0x45')]){case _0x04c6('0x5c'):if(_0x48124f[_0x04c6('0x5d')]==0x1){_0x25a6fc[_0x04c6('0x5e')]('`'+_0x48124f['field']+'`\x20=\x200');}else{_0x25a6fc['having']('`'+_0x48124f['field']+_0x04c6('0x5f'));}break;case'Contact':if(_0x48124f[_0x04c6('0x60')]==='$substring'){if(_0x48124f[_0x04c6('0x5d')][_0x04c6('0x34')]('\x20')['length']>0x1){_0xd31976[_0x3a80f6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x04c6('0x61')](_0x48124f[_0x04c6('0x5d')]),null);}else{var _0x35020f='%'+_0x48124f[_0x04c6('0x5d')]+'%';_0xd31976[_0x3a80f6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x35020f,_0x35020f,_0x35020f);}}else{_0xc29082=_[_0x04c6('0x5b')](_0x57ce4b,[_0x04c6('0x29'),_0x04c6('0x62')]);_0x48124f[_0x04c6('0x45')]=_0x04c6('0x62');_0x1492d0=as[_0x04c6('0x63')](_0x17778b,_0xc29082[_0x04c6('0x64')],_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0['text'],_0x1492d0[_0x04c6('0x5d')]['start'],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x27')]);}break;case'Tag':var _0x3477b7=_0x48124f[_0x04c6('0x5d')][_0x04c6('0x34')](',')[_0x04c6('0x30')](function(_0x28299e){return Number(_0x28299e);});_0x3477b7[_0x04c6('0x35')](function(_0xf073a8){_0x1b8fa4['or'](_0x04c6('0x65'),'%,'+_0xf073a8+',%');});_0x28e563=_['union'](_0x28e563,_0x3477b7);break;case _0x04c6('0x66'):if(_0x48124f['operator']===_0x04c6('0x67')){_0xd31976[_0x3a80f6](_0x04c6('0x68'),'%'+_0x48124f['value']+'%',null);}else{_0xc29082=_['find'](_0x57ce4b,[_0x04c6('0x29'),'UserId']);_0x48124f[_0x04c6('0x45')]=_0x04c6('0x69');_0x1492d0=as['buildExpression'](_0x17778b,_0xc29082[_0x04c6('0x64')],_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0[_0x04c6('0x6a')],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x6b')],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x27')]);}break;case _0x04c6('0x2b'):_0x1492d0=as[_0x04c6('0x63')]('me',null,_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0[_0x04c6('0x6a')],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x6b')],_0x1492d0['value'][_0x04c6('0x27')]);break;}}else{var _0x1492d0=as[_0x04c6('0x63')](_0x17778b,_0xc29082[_0x04c6('0x64')],_0x48124f);_0xd31976[_0x3a80f6](_0x1492d0['text'],_0x1492d0[_0x04c6('0x5d')][_0x04c6('0x6b')],_0x1492d0[_0x04c6('0x5d')]['end']);}}}else{var _0x563862=_(_0x15c270[_0x04c6('0x3d')])[_0x04c6('0x39')]()[_0x04c6('0x30')](function(_0x396f79){return _[_0x04c6('0x6c')](_0x57ce4b,[_0x04c6('0x29'),_0x396f79])?_0x396f79:undefined;})['compact']()[_0x04c6('0x5d')]();if(!_[_0x04c6('0x6d')](_0x563862)){_0x563862[_0x04c6('0x35')](function(_0x596ac0){if(_0x596ac0==='WhatsappAccountId'){_0x25a6fc[_0x04c6('0x43')](_0x04c6('0x6e'),[][_0x04c6('0x6f')](_0x15c270[_0x04c6('0x3d')][_0x596ac0]));}else if(_0x596ac0==='createdAt'){var _0x13111c=JSON['parse'](_0x15c270['query'][_0x596ac0])[_0x04c6('0x70')];var _0xe178dd=JSON[_0x04c6('0x71')](_0x15c270[_0x04c6('0x3d')][_0x596ac0])[_0x04c6('0x72')];_0x25a6fc[_0x04c6('0x43')](_0x04c6('0x73'),_0x13111c,_0xe178dd);}else{if(_0x15c270['query'][_0x596ac0]===_0x04c6('0x74')){_0x25a6fc[_0x04c6('0x43')]('i.'+_0x596ac0+_0x04c6('0x75'));}else{_0x25a6fc[_0x04c6('0x43')]('i.'+_0x596ac0+_0x04c6('0x76'),_0x15c270['query'][_0x596ac0]);}}});}if(_0x15c270['query'][_0x04c6('0x77')]){if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x77')]==0x1){_0x25a6fc['having'](_0x04c6('0x78'));}else{_0x25a6fc[_0x04c6('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')]){_0x28e563=_[_0x04c6('0x7a')](_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')])?_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')]:new Array(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x79')]);_0x28e563[_0x04c6('0x35')](function(_0x2d7ecc){_0x1b8fa4['or'](_0x04c6('0x65'),'%,'+_0x2d7ecc+',%');});}if(_0x15c270[_0x04c6('0x3d')]['filter']){var _0xd1a5fd=_0x15c270[_0x04c6('0x3d')]['filter'][_0x04c6('0x7b')]('\x5c','\x5c\x5c')[_0x04c6('0x7b')](/'/g,'\x27\x27');if(qs[_0x04c6('0x7c')](_0xd1a5fd)){_0xd31976['or'](_0x04c6('0x7d'),_0xd1a5fd+'%')['or'](_0x04c6('0x7e'),_0xd1a5fd+'%');}else{_0xd31976['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x04c6('0x61')](_0xd1a5fd))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xd1a5fd+'%');}}}_0x25a6fc[_0x04c6('0x43')](_0xd31976);_0x25a6fc['group'](_0x04c6('0x7f'));var _0x1110f2={'type':db[_0x04c6('0x80')][_0x04c6('0x81')][_0x04c6('0x82')],'raw':!![]};var _0x150639=_0x25a6fc[_0x04c6('0x83')]();_0x150639[_0x04c6('0x45')](_0x04c6('0x7f'));_0x150639['field'](_0x04c6('0x84'),_0x04c6('0x5c'));if(_0x3806ea['order']){_0x3806ea[_0x04c6('0x41')]['forEach'](function(_0x102f17){var _0x111382=_0x102f17[0x0]==='contactName'?_0x102f17[0x0]:'i.'+_0x102f17[0x0];_0x25a6fc[_0x04c6('0x41')](_0x111382,_0x102f17[0x1]===_0x04c6('0x85')?![]:!![]);});}if(!_['isEmpty'](_0x28e563)){_0x25a6fc[_0x04c6('0x5e')](_0x1b8fa4);_0x150639[_0x04c6('0x43')]('t.id\x20IN\x20?',_0x28e563);}BPromise[_0x04c6('0x86')]()[_0x04c6('0x25')](function(){if(!_0x623acf){if(_0x15c270['query'][_0x04c6('0x87')])return;_0x150639[_0x04c6('0x43')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x25a6fc['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x15c270[_0x04c6('0x88')][_0x04c6('0x89')]!==_0x04c6('0x2d'))return;return _0x15c270[_0x04c6('0x88')][_0x04c6('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4667ba){if(_[_0x04c6('0x6d')](_0x4667ba)){_0x150639[_0x04c6('0x43')](_0x04c6('0x8b'));_0x25a6fc[_0x04c6('0x43')](_0x04c6('0x8b'));}else{_0x150639[_0x04c6('0x43')]('i.WhatsappAccountId\x20IN\x20?',_[_0x04c6('0x30')](_0x4667ba,'id'));_0x25a6fc['where'](_0x04c6('0x6e'),_['map'](_0x4667ba,'id'));}});})['then'](function(){if(_0x15c270[_0x04c6('0x88')]['role']===_0x04c6('0x2d')&&!_0x623acf&&!_0x15c270[_0x04c6('0x3d')][_0x04c6('0x87')])return[];return db[_0x04c6('0x8c')][_0x04c6('0x3d')](_0x150639['toString'](),_0x1110f2);})['then'](function(_0x45b648){_0x5144f5[_0x04c6('0x8d')]=_0x45b648[_0x04c6('0x3f')];if(_0x5144f5[_0x04c6('0x8d')]===0x0)return[];return db[_0x04c6('0x8c')][_0x04c6('0x3d')](_0x5a2d24['toString'](),_0x1110f2)[_0x04c6('0x25')](function(_0x4c3f9e){_0x240a22=_['keyBy'](_0x4c3f9e,'id');_0x1110f2=_[_0x04c6('0x8e')](_0x1110f2,{'model':db[_0x04c6('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15c270[_0x04c6('0x3d')][_0x04c6('0x8f')]){_0x3806ea[_0x04c6('0x3e')][_0x04c6('0x35')](function(_0x2e65f0){_0x25a6fc[_0x04c6('0x45')]('i.'+_0x2e65f0);});}else{_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x84'),_0x04c6('0x5c'));_0x25a6fc['field'](_0x04c6('0x90'),'Account.key');_0x25a6fc['field'](_0x04c6('0x91'),_0x04c6('0x92'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x93'),_0x04c6('0x94'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x95'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x96'),_0x04c6('0x97'));_0x25a6fc[_0x04c6('0x45')]('c.lastName','Contact.lastName');_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x98'),'Contact.email');_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x99'),'Contact.phone');_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x9a'),_0x04c6('0x9b'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x9c'),_0x04c6('0x9d'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0x9e'),'Owner.fullname');_0x25a6fc[_0x04c6('0x45')]('o.internal',_0x04c6('0x9f'));_0x25a6fc[_0x04c6('0x45')](_0x04c6('0xa0'),_0x04c6('0x32'));}if(_0x3806ea[_0x04c6('0x20')])_0x25a6fc[_0x04c6('0x20')](_0x3806ea['limit']);if(_0x3806ea[_0x04c6('0x1e')])_0x25a6fc[_0x04c6('0x1e')](_0x3806ea[_0x04c6('0x1e')]);return db['sequelize']['query'](_0x25a6fc['toString'](),_0x1110f2);})[_0x04c6('0x25')](function(_0x181268){if(_0x181268['length']>0x0)_0x549911[_0x04c6('0x43')](_0x04c6('0xa1'),_[_0x04c6('0x30')](_0x181268,'id'));return db['sequelize'][_0x04c6('0x3d')](_0x549911['toString'](),_0x1110f2)[_0x04c6('0x25')](function(_0x3a1b76){var _0x13ddf2=_['groupBy'](_0x3a1b76,'WhatsappInteractionId');var _0x2e314f=[];_0x181268[_0x04c6('0x35')](function(_0x2e92d5){_0x2e314f[_0x04c6('0x36')](updateWhatsappInteraction(_0x2e92d5,_0x240a22,_0x13ddf2));});return BPromise['all'](_0x2e314f);});});})['then'](function(_0x3e12a4){_0x5144f5[_0x04c6('0xa2')]=_0x3e12a4;return _0x5144f5;})[_0x04c6('0x25')](respondWithFilteredResult(_0x1373ca,_0x3806ea))['catch'](handleError(_0x1373ca,null));};exports[_0x04c6('0xa3')]=function(_0xe08ff4,_0x2dd699){var _0x3bfef2={'raw':![],'where':{'id':_0xe08ff4[_0x04c6('0xa4')]['id']}},_0x49f1e0={};_0x49f1e0[_0x04c6('0x3c')]=_[_0x04c6('0x39')](db[_0x04c6('0x37')][_0x04c6('0xa5')]);_0x49f1e0['query']=_[_0x04c6('0x39')](_0xe08ff4[_0x04c6('0x3d')]);_0x49f1e0[_0x04c6('0x3a')]=_[_0x04c6('0x3b')](_0x49f1e0[_0x04c6('0x3c')],_0x49f1e0[_0x04c6('0x3d')]);_0x3bfef2[_0x04c6('0x3e')]=_['intersection'](_0x49f1e0[_0x04c6('0x3c')],qs[_0x04c6('0x8f')](_0xe08ff4[_0x04c6('0x3d')][_0x04c6('0x8f')]));_0x3bfef2[_0x04c6('0x3e')]=_0x3bfef2[_0x04c6('0x3e')][_0x04c6('0x3f')]?_0x3bfef2[_0x04c6('0x3e')]:_0x49f1e0['model'];if(_0xe08ff4[_0x04c6('0x3d')][_0x04c6('0xa6')]){_0x3bfef2['include']=[{'all':!![]}];}_0x3bfef2=_[_0x04c6('0x8e')]({},_0x3bfef2,_0xe08ff4[_0x04c6('0xa7')]);return db[_0x04c6('0x37')][_0x04c6('0x5b')](_0x3bfef2)[_0x04c6('0x25')](handleEntityNotFound(_0x2dd699,null))['then'](respondWithResult(_0x2dd699,null))['catch'](handleError(_0x2dd699,null));};exports[_0x04c6('0xa8')]=function(_0x2d0697,_0x849fe6){return db['WhatsappInteraction'][_0x04c6('0xa8')](_0x2d0697[_0x04c6('0x2b')],{})['then'](respondWithResult(_0x849fe6,0xc9))['catch'](handleError(_0x849fe6,null));};exports[_0x04c6('0x24')]=function(_0x7a04df,_0x5cddf9){if(_0x7a04df[_0x04c6('0x2b')]['id']){delete _0x7a04df[_0x04c6('0x2b')]['id'];}return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x7a04df['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x5cddf9,null))[_0x04c6('0x25')](saveUpdates(_0x7a04df[_0x04c6('0x2b')],null))[_0x04c6('0x25')](respondWithResult(_0x5cddf9,null))[_0x04c6('0xa9')](handleError(_0x5cddf9,null));};exports[_0x04c6('0x26')]=function(_0x57278a,_0x1ede30){return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x57278a[_0x04c6('0xa4')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x1ede30,null))[_0x04c6('0x25')](removeEntity(_0x1ede30,null))[_0x04c6('0xa9')](handleError(_0x1ede30,null));};exports[_0x04c6('0xaa')]=function(_0x4ff35b,_0x4b900a){return db[_0x04c6('0x37')][_0x04c6('0xaa')]()[_0x04c6('0x25')](respondWithResult(_0x4b900a,null))['catch'](handleError(_0x4b900a,null));};exports[_0x04c6('0xab')]=function(_0x38c3b,_0x2980ea,_0x57895c){return db['WhatsappMessage'][_0x04c6('0x5b')]({'where':{'id':_0x38c3b[_0x04c6('0xa4')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x2980ea,null))[_0x04c6('0x25')](function(_0x71bf62){if(_0x71bf62){return _0x71bf62[_0x04c6('0xab')](_0x38c3b['body']['ids'],_['omit'](_0x38c3b[_0x04c6('0x2b')],[_0x04c6('0xac'),'id'])||{});}})['then'](respondWithResult(_0x2980ea,null))[_0x04c6('0xa9')](handleError(_0x2980ea,null));};exports[_0x04c6('0xad')]=function(_0x15a74a,_0x50876e,_0x406dc8){var _0x312efd={'raw':![],'where':{}};var _0x1ee1fa={};var _0x11cc16={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x15a74a['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x50876e,null))[_0x04c6('0x25')](function(_0x4bf39a){if(_0x4bf39a){_0x1ee1fa['model']=_['keys'](db[_0x04c6('0xae')]['rawAttributes']);_0x1ee1fa[_0x04c6('0x3d')]=_[_0x04c6('0x39')](_0x15a74a[_0x04c6('0x3d')]);_0x1ee1fa[_0x04c6('0x3a')]=_[_0x04c6('0x3b')](_0x1ee1fa[_0x04c6('0x3c')],_0x1ee1fa['query']);_0x312efd[_0x04c6('0x3e')]=_[_0x04c6('0x3b')](_0x1ee1fa[_0x04c6('0x3c')],qs[_0x04c6('0x8f')](_0x15a74a[_0x04c6('0x3d')]['fields']));_0x312efd[_0x04c6('0x3e')]=_0x312efd[_0x04c6('0x3e')][_0x04c6('0x3f')]?_0x312efd['attributes']:_0x1ee1fa[_0x04c6('0x3c')];if(!_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x40')]('nolimit')){_0x312efd[_0x04c6('0x20')]=qs[_0x04c6('0x20')](_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x20')]);_0x312efd[_0x04c6('0x1e')]=qs[_0x04c6('0x1e')](_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x1e')]);}_0x312efd['order']=qs[_0x04c6('0x42')](_0x15a74a[_0x04c6('0x3d')][_0x04c6('0x42')]);_0x312efd['where']=qs['filters'](_['pick'](_0x15a74a[_0x04c6('0x3d')],_0x1ee1fa[_0x04c6('0x3a')]));_0x312efd[_0x04c6('0x43')]['WhatsappInteractionId']=_0x4bf39a['id'];if(_0x15a74a[_0x04c6('0x3d')][_0x04c6('0xaf')]){_0x312efd[_0x04c6('0x43')]=_[_0x04c6('0x8e')](_0x312efd['where'],{'$or':_[_0x04c6('0x30')](_0x312efd[_0x04c6('0x3e')],function(_0x31e6bf){var _0x2902f4={};_0x2902f4[_0x31e6bf]={'$like':'%'+_0x15a74a['query'][_0x04c6('0xaf')]+'%'};return _0x2902f4;})});}if(_0x15a74a['query'][_0x04c6('0x70')]){var _0xbfbdd6=_0x15a74a['query'][_0x04c6('0x70')][_0x04c6('0x34')](',');var _0x46a009={};_0x46a009[_0xbfbdd6[0x0]]={'$gte':moment(_0xbfbdd6[0x1])['format'](_0x04c6('0xb0'))};_0x312efd[_0x04c6('0x43')]=_[_0x04c6('0x8e')](_0x312efd['where'],_0x46a009);}_0x312efd=_[_0x04c6('0x8e')]({},_0x312efd,_0x15a74a[_0x04c6('0xa7')]);return db['WhatsappMessage']['count']({'where':_0x312efd['where']})['then'](function(_0x259aac){_0x11cc16[_0x04c6('0x8d')]=_0x259aac;if(_0x15a74a['query'][_0x04c6('0xa6')]){_0x312efd[_0x04c6('0xb1')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x04c6('0xb2')](_0x312efd);})[_0x04c6('0x25')](function(_0x4cb4c6){_0x11cc16[_0x04c6('0xa2')]=_0x4cb4c6;return _0x11cc16;});}})[_0x04c6('0x25')](respondWithFilteredResult(_0x50876e,_0x312efd))[_0x04c6('0xa9')](handleError(_0x50876e,null));};exports['addTags']=function(_0x4c616d,_0x4d5dd2,_0x30c1a9){return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x4c616d['params']['id']}})['then'](handleEntityNotFound(_0x4d5dd2,null))['then'](function(_0x29e5b4){if(_0x29e5b4){return _0x29e5b4['setTags'](_0x4c616d['body'][_0x04c6('0xac')],_['omit'](_0x4c616d[_0x04c6('0x2b')],[_0x04c6('0xac'),'id'])||{})[_0x04c6('0xb3')](function(){return db[_0x04c6('0xb4')][_0x04c6('0xb2')]({'attributes':['id','name','color'],'where':{'id':_0x4c616d[_0x04c6('0x2b')][_0x04c6('0xac')]}});})[_0x04c6('0x25')](function(_0x300b7e){socket[_0x04c6('0xb5')](_0x04c6('0xb6'),{'id':Number(_0x4c616d['params']['id']),'tags':_0x300b7e||[]});return{'id':Number(_0x4c616d['params']['id']),'tags':_0x300b7e||[]};});}})[_0x04c6('0x25')](respondWithResult(_0x4d5dd2,null))[_0x04c6('0xa9')](handleError(_0x4d5dd2,null));};exports['removeTags']=function(_0x2c0c74,_0x4d16fe,_0x49d50e){return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x2c0c74['params']['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x4d16fe,null))[_0x04c6('0x25')](function(_0x389dd3){if(_0x389dd3){return _0x389dd3['removeTags'](_0x2c0c74[_0x04c6('0x3d')][_0x04c6('0xac')]);}})[_0x04c6('0x25')](respondWithStatusCode(_0x4d16fe,null))[_0x04c6('0xa9')](handleError(_0x4d16fe,null));};exports[_0x04c6('0xb7')]=function(_0x2b107f,_0x4321f2){var _0x402b1a=moment()['unix']()[_0x04c6('0xb8')]();var _0x514e47=path[_0x04c6('0xb9')](config[_0x04c6('0xba')],_0x04c6('0xbb'),_0x04c6('0xbc'),_0x04c6('0xbd'));var _0x47e8c3=path[_0x04c6('0xb9')](config[_0x04c6('0xba')],'server',_0x04c6('0xbc'),_0x04c6('0xbe'));var _0x3aafbe=path['join'](_0x514e47,_0x402b1a);var _0x62e8c6=util['format']('transcript-%d-%s.zip',_0x2b107f[_0x04c6('0xa4')]['id'],_0x402b1a);var _0x4f529a=path[_0x04c6('0xb9')](_0x514e47,_0x62e8c6);var _0x14f915=[];_0x14f915[_0x04c6('0x36')]({'model':db['User'],'as':_0x04c6('0x66'),'attributes':['id','fullname'],'raw':!![]});_0x14f915[_0x04c6('0x36')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x04c6('0xbf'),'lastName'],'raw':!![]});if(_0x2b107f[_0x04c6('0x3d')][_0x04c6('0xbe')]){_0x14f915[_0x04c6('0x36')]({'model':db[_0x04c6('0xc0')],'as':_0x04c6('0xc0'),'raw':!![]});}var _0x1fffaa=[{'model':db[_0x04c6('0xae')],'as':_0x04c6('0xc1'),'attributes':['id',_0x04c6('0x2b'),_0x04c6('0xc2'),'direction','secret',_0x04c6('0x77')],'include':_0x14f915}];_0x1fffaa[_0x04c6('0x36')]({'model':db[_0x04c6('0xc3')],'as':'Account','attributes':['id',_0x04c6('0x29')]});_0x1fffaa['push']({'model':db['User'],'as':_0x04c6('0xc4'),'attributes':['id',_0x04c6('0x31')]});return db[_0x04c6('0x37')][_0x04c6('0x5b')]({'where':{'id':_0x2b107f['params']['id']},'include':_0x1fffaa})['then'](handleEntityNotFound(_0x4321f2,null))[_0x04c6('0x25')](function(_0x2cda03){if(_0x2cda03){var _0x5a88f4=_0x2cda03[_0x04c6('0xc5')]({'plain':!![]});fs[_0x04c6('0xc6')](_0x3aafbe);var _0x29bf00={'channel':'Whatsapp','account':_0x5a88f4['Account'][_0x04c6('0x29')],'agent':_0x5a88f4[_0x04c6('0xc4')]?_0x5a88f4[_0x04c6('0xc4')][_0x04c6('0x31')]:_0x04c6('0xc7'),'createdAt':moment(_0x5a88f4[_0x04c6('0xc2')])[_0x04c6('0xc8')](_0x04c6('0xb0'))['toString'](),'closedAt':_0x5a88f4['closed']?moment(_0x5a88f4['closedAt'])[_0x04c6('0xc8')](_0x04c6('0xb0'))[_0x04c6('0xb8')]():'','disposition':_0x5a88f4[_0x04c6('0xc9')],'messages':_(_0x5a88f4[_0x04c6('0xc1')])[_0x04c6('0xaf')]({'secret':![]})[_0x04c6('0x30')](function(_0x53982d){if(_0x53982d[_0x04c6('0xc0')]){var _0x4d52e6=path['join'](_0x47e8c3,_0x53982d[_0x04c6('0xc0')][_0x04c6('0xca')]);if(fs[_0x04c6('0xcb')](_0x4d52e6)){fs[_0x04c6('0xcc')](_0x4d52e6)[_0x04c6('0xcd')](fs[_0x04c6('0xce')](path[_0x04c6('0xb9')](_0x3aafbe,_0x53982d['Attachment']['basename'])));}}return{'date':moment(_0x53982d[_0x04c6('0xc2')])[_0x04c6('0xc8')](_0x04c6('0xb0'))['toString'](),'sender':_0x53982d[_0x04c6('0xcf')]===_0x04c6('0xd0')?_0x53982d[_0x04c6('0x66')]?_0x53982d[_0x04c6('0x66')]['fullname']:_0x04c6('0xd1'):_0x53982d[_0x04c6('0xd2')][_0x04c6('0xbf')]+(_0x53982d['Contact'][_0x04c6('0xd3')]?'\x20'+_0x53982d[_0x04c6('0xd2')][_0x04c6('0xd3')]:''),'body':_0x53982d[_0x04c6('0xc0')]?_0x53982d[_0x04c6('0xc0')][_0x04c6('0xca')]:_0x53982d[_0x04c6('0x2b')],'direction':_0x53982d[_0x04c6('0xcf')]===_0x04c6('0xd0')?'A':'C','secret':_0x53982d[_0x04c6('0xd4')],'read':_0x53982d['read'],'attachment':_0x53982d[_0x04c6('0xc0')]};})['value']()};return ejs[_0x04c6('0xd5')](path[_0x04c6('0xb9')](config[_0x04c6('0xba')],_0x04c6('0xbb'),_0x04c6('0xd6'),_0x04c6('0xd7')),{'interaction':_0x29bf00})['then'](function(_0x8b5e65){var _0x186921=path[_0x04c6('0xb9')](_0x3aafbe,_0x04c6('0xd8')+_0x5a88f4['id']+'-'+_0x402b1a+_0x04c6('0xd9'));var _0x111c54={'path':_0x186921,'channel':_0x04c6('0xda'),'interactionId':_0x5a88f4['id']};return pdf[_0x04c6('0xdb')](_0x8b5e65,_0x111c54);})[_0x04c6('0x25')](function(){return new BPromise(function(_0x1b3f20,_0x124d22){zipdir(_0x3aafbe,{'saveTo':_0x4f529a},function(_0x6952e2,_0x313253){if(_0x6952e2)return _0x124d22(_0x6952e2);return _0x1b3f20(_0x313253);});})[_0x04c6('0x25')](function(){return new BPromise(function(_0x1cf567,_0x382ed3){rimraf(_0x3aafbe,function(_0x1cd784){if(_0x1cd784)_0x382ed3(_0x1cd784);return _0x1cf567();});});})['then'](function(){return _0x4321f2[_0x04c6('0xb7')](_0x4f529a,_0x62e8c6,function(_0x44b284){if(_0x44b284){console[_0x04c6('0xdc')](_0x04c6('0xdd'),_0x44b284);}else{fs[_0x04c6('0xde')](_0x4f529a);}});});});}else{return _0x4321f2[_0x04c6('0x1b')](0xc8);}})[_0x04c6('0xa9')](handleError(_0x4321f2,null));}; \ No newline at end of file +var _0x6fc2=['removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','Attachment','Messages','createdAt','secret','WhatsappAccount','Account','User','Owner','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','direction','renderFile','views','downloadInteraction.html','.pdf','log','err','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','body','contact','message','agent','interaction','account','map','fullname','TagIds','split','forEach','Tags','index','WhatsappInteraction','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','buildExpression','some','isEmpty','WhatsappAccountId','concat','parse','$gte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','rows','show','params','include','options','create','catch','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','ids','emit'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x6fc2,0x117));var _0x26fc=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6fc2[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x26fc('0x0'));var rimraf=require(_0x26fc('0x1'));var zipdir=require(_0x26fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26fc('0x3'));var moment=require(_0x26fc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x26fc('0x5'));var sox=require(_0x26fc('0x6'));var csv=require('to-csv');var ejs=require(_0x26fc('0x7'));var fs=require('fs');var fs_extra=require(_0x26fc('0x8'));var _=require(_0x26fc('0x9'));var squel=require(_0x26fc('0xa'));var crypto=require('crypto');var jsforce=require(_0x26fc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x26fc('0xc'));var Papa=require(_0x26fc('0xd'));var Redis=require(_0x26fc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x26fc('0xf'));var as=require(_0x26fc('0x10'));var pdf=require(_0x26fc('0x11'));var hardwareService=require(_0x26fc('0x12'));var logger=require(_0x26fc('0x13'))(_0x26fc('0x14'));var utils=require(_0x26fc('0x15'));var config=require(_0x26fc('0x16'));var licenseUtil=require(_0x26fc('0x17'));var db=require(_0x26fc('0x18'))['db'];config[_0x26fc('0x19')]=_[_0x26fc('0x1a')](config[_0x26fc('0x19')],{'host':_0x26fc('0x1b'),'port':0x18eb});var socket=require(_0x26fc('0x1c'))(new Redis(config[_0x26fc('0x19')]));require('./whatsappInteraction.socket')[_0x26fc('0x1d')](socket);function respondWithStatusCode(_0x2a2d09,_0x1f1903){_0x1f1903=_0x1f1903||0xcc;return function(_0x405139){if(_0x405139){return _0x2a2d09[_0x26fc('0x1e')](_0x1f1903);}return _0x2a2d09[_0x26fc('0x1f')](_0x1f1903)[_0x26fc('0x20')]();};}function respondWithResult(_0x383f2f,_0x351926){_0x351926=_0x351926||0xc8;return function(_0x54f0e5){if(_0x54f0e5){return _0x383f2f[_0x26fc('0x1f')](_0x351926)['json'](_0x54f0e5);}};}function respondWithFilteredResult(_0x2da252,_0x3507b1){return function(_0x2732a4){if(_0x2732a4){var _0x3b3a92=typeof _0x3507b1['offset']===_0x26fc('0x21')&&typeof _0x3507b1[_0x26fc('0x22')]===_0x26fc('0x21');var _0x9a9c2=_0x2732a4[_0x26fc('0x23')];var _0x5f454f=_0x3b3a92?0x0:_0x3507b1['offset'];var _0x5c10c6=_0x3b3a92?_0x2732a4['count']:_0x3507b1['offset']+_0x3507b1['limit'];var _0x2339ad;if(_0x5c10c6>=_0x9a9c2){_0x5c10c6=_0x9a9c2;_0x2339ad=0xc8;}else{_0x2339ad=0xce;}_0x2da252['status'](_0x2339ad);return _0x2da252[_0x26fc('0x24')](_0x26fc('0x25'),_0x5f454f+'-'+_0x5c10c6+'/'+_0x9a9c2)['json'](_0x2732a4);}return null;};}function patchUpdates(_0x4e62d8){return function(_0x288c8d){try{jsonpatch[_0x26fc('0x26')](_0x288c8d,_0x4e62d8,!![]);}catch(_0x1641f2){return BPromise[_0x26fc('0x27')](_0x1641f2);}return _0x288c8d[_0x26fc('0x28')]();};}function saveUpdates(_0x4b320b,_0x346fe0){return function(_0x435d72){if(_0x435d72){return _0x435d72[_0x26fc('0x29')](_0x4b320b)[_0x26fc('0x2a')](function(_0x281511){return _0x281511;});}return null;};}function removeEntity(_0x3be613,_0x430a98){return function(_0x5b9dba){if(_0x5b9dba){return _0x5b9dba[_0x26fc('0x2b')]()[_0x26fc('0x2a')](function(){_0x3be613[_0x26fc('0x1f')](0xcc)[_0x26fc('0x20')]();});}};}function handleEntityNotFound(_0x57851e,_0x12ecb7){return function(_0x4f968a){if(!_0x4f968a){_0x57851e[_0x26fc('0x1e')](0x194);}return _0x4f968a;};}function handleError(_0x4218a0,_0x3bff70){_0x3bff70=_0x3bff70||0x1f4;return function(_0x32088c){logger[_0x26fc('0x2c')](_0x32088c[_0x26fc('0x2d')]);if(_0x32088c[_0x26fc('0x2e')]){delete _0x32088c[_0x26fc('0x2e')];}_0x4218a0['status'](_0x3bff70)['send'](_0x32088c);};}function getMustacheRender(_0x47b642,_0x297e53){return Mustache['render'](_0x47b642,_['merge'](_0x297e53[_0x26fc('0x2f')],{'contact':_0x297e53[_0x26fc('0x30')],'message':_0x297e53[_0x26fc('0x31')],'agent':_0x297e53[_0x26fc('0x32')],'interaction':_0x297e53[_0x26fc('0x33')],'account':_0x297e53[_0x26fc('0x34')]}))||'';}function getInteractionUsers(_0x2b1385,_0x1661cd){return new BPromise(function(_0x260339,_0x2466ab){try{if(_0x1661cd[_0x2b1385['id']]){_0x2b1385['Users']=_[_0x26fc('0x35')](_0x1661cd[_0x2b1385['id']],function(_0x3e51b0){return{'id':_0x3e51b0['id'],'fullname':_0x3e51b0[_0x26fc('0x36')]};});}}catch(_0x115985){_0x2466ab(_0x115985);}_0x260339(_0x2b1385);});}function getInteractionTags(_0x2fde81,_0x190092){return new BPromise(function(_0x143a56,_0x5201fa){try{if(_0x2fde81[_0x26fc('0x37')]){_0x2fde81['Tags']=[];_0x2fde81[_0x26fc('0x37')][_0x26fc('0x38')](',')[_0x26fc('0x39')](function(_0x324e43){_0x2fde81[_0x26fc('0x3a')]['push'](_0x190092[_0x324e43]);});}delete _0x2fde81[_0x26fc('0x37')];}catch(_0x4664ec){_0x5201fa(_0x4664ec);}_0x143a56(_0x2fde81);});}function updateWhatsappInteraction(_0x47c4df,_0x1cf6f0,_0x56be15){return new BPromise(function(_0x440451,_0x4264a0){return getInteractionUsers(_0x47c4df,_0x56be15)[_0x26fc('0x2a')](function(_0x1973bd){return getInteractionTags(_0x1973bd,_0x1cf6f0);})[_0x26fc('0x2a')](function(_0x31bb59){_0x440451(_0x31bb59);})['catch'](function(_0x5b34c9){_0x4264a0(_0x5b34c9);});});}exports[_0x26fc('0x3b')]=function(_0xdc8ef3,_0x31a2fe){var _0x1205e8={},_0x4c69e4={},_0x235861={'count':0x0,'rows':[]};var _0x3909fc=_['map'](db[_0x26fc('0x3c')][_0x26fc('0x3d')],function(_0x5e4c3d){return{'name':_0x5e4c3d[_0x26fc('0x3e')],'type':_0x5e4c3d[_0x26fc('0x3f')][_0x26fc('0x40')]};});_0x4c69e4['model']=_[_0x26fc('0x35')](_0x3909fc,_0x26fc('0x2e'));_0x4c69e4['query']=_[_0x26fc('0x41')](_0xdc8ef3['query']);_0x4c69e4[_0x26fc('0x42')]=_[_0x26fc('0x43')](_0x4c69e4[_0x26fc('0x44')],_0x4c69e4[_0x26fc('0x45')]);_0x1205e8[_0x26fc('0x46')]=_[_0x26fc('0x43')](_0x4c69e4[_0x26fc('0x44')],qs[_0x26fc('0x47')](_0xdc8ef3[_0x26fc('0x45')][_0x26fc('0x47')]));_0x1205e8[_0x26fc('0x46')]=_0x1205e8[_0x26fc('0x46')]['length']?_0x1205e8[_0x26fc('0x46')]:_0x4c69e4[_0x26fc('0x44')];if(!_0xdc8ef3[_0x26fc('0x45')][_0x26fc('0x48')](_0x26fc('0x49'))){_0x1205e8[_0x26fc('0x22')]=qs[_0x26fc('0x22')](_0xdc8ef3['query']['limit']);_0x1205e8[_0x26fc('0x4a')]=qs[_0x26fc('0x4a')](_0xdc8ef3['query'][_0x26fc('0x4a')]);}_0x1205e8[_0x26fc('0x4b')]=qs[_0x26fc('0x4c')](_0xdc8ef3['query'][_0x26fc('0x4c')]);_0x1205e8[_0x26fc('0x4d')]=qs[_0x26fc('0x42')](_[_0x26fc('0x4e')](_0xdc8ef3[_0x26fc('0x45')],_0x4c69e4[_0x26fc('0x42')]),_0x3909fc);var _0x1395a8=[];var _0x44b16e=squel[_0x26fc('0x4f')]()[_0x26fc('0x50')]('id')[_0x26fc('0x50')]('name')[_0x26fc('0x50')](_0x26fc('0x51'))['from'](_0x26fc('0x52'));var _0x354ec0=squel[_0x26fc('0x4f')]()['field'](_0x26fc('0x53'))[_0x26fc('0x50')](_0x26fc('0x54'))[_0x26fc('0x50')](_0x26fc('0x55'))['from'](_0x26fc('0x56'),'ui')[_0x26fc('0x57')]('users','u',_0x26fc('0x58'));var _0x399cb8=squel[_0x26fc('0x4f')]()['from'](_0x26fc('0x59'),'i')[_0x26fc('0x57')](_0x26fc('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x26fc('0x5b'),'o',_0x26fc('0x5c'))[_0x26fc('0x57')](_0x26fc('0x5d'),'a',_0x26fc('0x5e'))['left_join']('whatsapp_messages','me',_0x26fc('0x5f'))['left_join']('whatsapp_interaction_has_tags','it',_0x26fc('0x60'))[_0x26fc('0x57')](_0x26fc('0x52'),'t',_0x26fc('0x61'));var _0x4671db=squel[_0x26fc('0x62')]();var _0x6c753=[];var _0x21915b=squel[_0x26fc('0x62')]();var _0x1a8ede;if(_0xdc8ef3['query'][_0x26fc('0x63')]){_0x1a8ede=as[_0x26fc('0x64')](_0xdc8ef3[_0x26fc('0x45')]['search']);var _0x79fed0=_0x1a8ede['sqlOperator'];for(var _0x5ddde5=0x0;_0x5ddde5<_0x1a8ede[_0x26fc('0x65')]['length'];_0x5ddde5++){var _0x52194c=_0x1a8ede[_0x26fc('0x65')][_0x5ddde5];var _0x4fc2e6='i';var _0xdcdd06=_[_0x26fc('0x66')](_0x3909fc,['name',_0x52194c[_0x26fc('0x50')]]);if(!_0xdcdd06){switch(_0x52194c[_0x26fc('0x50')]){case _0x26fc('0x67'):if(_0x52194c[_0x26fc('0x68')]==0x1){_0x399cb8[_0x26fc('0x69')]('`'+_0x52194c[_0x26fc('0x50')]+'`\x20=\x200');}else{_0x399cb8[_0x26fc('0x69')]('`'+_0x52194c['field']+_0x26fc('0x6a'));}break;case _0x26fc('0x6b'):if(_0x52194c[_0x26fc('0x6c')]===_0x26fc('0x6d')){if(_0x52194c[_0x26fc('0x68')][_0x26fc('0x38')]('\x20')[_0x26fc('0x6e')]>0x1){_0x4671db[_0x79fed0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x26fc('0x6f')](_0x52194c[_0x26fc('0x68')]),null);}else{var _0x3626f2='%'+_0x52194c[_0x26fc('0x68')]+'%';_0x4671db[_0x79fed0](_0x26fc('0x70'),_0x3626f2,_0x3626f2,_0x3626f2);}}else{_0xdcdd06=_[_0x26fc('0x66')](_0x3909fc,['name',_0x26fc('0x71')]);_0x52194c[_0x26fc('0x50')]=_0x26fc('0x71');_0x2539ec=as['buildExpression'](_0x4fc2e6,_0xdcdd06[_0x26fc('0x3f')],_0x52194c);_0x4671db[_0x79fed0](_0x2539ec[_0x26fc('0x72')],_0x2539ec['value'][_0x26fc('0x73')],_0x2539ec[_0x26fc('0x68')][_0x26fc('0x20')]);}break;case _0x26fc('0x74'):var _0x1773f0=_0x52194c[_0x26fc('0x68')][_0x26fc('0x38')](',')['map'](function(_0x36cee3){return Number(_0x36cee3);});_0x1773f0['forEach'](function(_0x13e2ac){_0x21915b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13e2ac+',%');});_0x6c753=_[_0x26fc('0x75')](_0x6c753,_0x1773f0);break;case'User':if(_0x52194c[_0x26fc('0x6c')]===_0x26fc('0x6d')){_0x4671db[_0x79fed0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x52194c[_0x26fc('0x68')]+'%',null);}else{_0xdcdd06=_[_0x26fc('0x66')](_0x3909fc,[_0x26fc('0x2e'),'UserId']);_0x52194c['field']='UserId';_0x2539ec=as[_0x26fc('0x76')](_0x4fc2e6,_0xdcdd06['type'],_0x52194c);_0x4671db[_0x79fed0](_0x2539ec['text'],_0x2539ec[_0x26fc('0x68')][_0x26fc('0x73')],_0x2539ec['value']['end']);}break;case _0x26fc('0x2f'):_0x2539ec=as[_0x26fc('0x76')]('me',null,_0x52194c);_0x4671db[_0x79fed0](_0x2539ec[_0x26fc('0x72')],_0x2539ec[_0x26fc('0x68')]['start'],_0x2539ec[_0x26fc('0x68')]['end']);break;}}else{var _0x2539ec=as['buildExpression'](_0x4fc2e6,_0xdcdd06['type'],_0x52194c);_0x4671db[_0x79fed0](_0x2539ec[_0x26fc('0x72')],_0x2539ec[_0x26fc('0x68')][_0x26fc('0x73')],_0x2539ec[_0x26fc('0x68')]['end']);}}}else{var _0x3e9c3e=_(_0xdc8ef3[_0x26fc('0x45')])[_0x26fc('0x41')]()[_0x26fc('0x35')](function(_0x298310){return _[_0x26fc('0x77')](_0x3909fc,[_0x26fc('0x2e'),_0x298310])?_0x298310:undefined;})['compact']()[_0x26fc('0x68')]();if(!_[_0x26fc('0x78')](_0x3e9c3e)){_0x3e9c3e[_0x26fc('0x39')](function(_0x3cecf3){if(_0x3cecf3===_0x26fc('0x79')){_0x399cb8[_0x26fc('0x4d')]('i.WhatsappAccountId\x20IN\x20?',[][_0x26fc('0x7a')](_0xdc8ef3[_0x26fc('0x45')][_0x3cecf3]));}else if(_0x3cecf3==='createdAt'){var _0x156d84=JSON[_0x26fc('0x7b')](_0xdc8ef3[_0x26fc('0x45')][_0x3cecf3])[_0x26fc('0x7c')];var _0x8aa523=JSON[_0x26fc('0x7b')](_0xdc8ef3[_0x26fc('0x45')][_0x3cecf3])['$lte'];_0x399cb8[_0x26fc('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x156d84,_0x8aa523);}else{if(_0xdc8ef3[_0x26fc('0x45')][_0x3cecf3]==='null'){_0x399cb8[_0x26fc('0x4d')]('i.'+_0x3cecf3+_0x26fc('0x7d'));}else{_0x399cb8[_0x26fc('0x4d')]('i.'+_0x3cecf3+'\x20=\x20?',_0xdc8ef3[_0x26fc('0x45')][_0x3cecf3]);}}});}if(_0xdc8ef3[_0x26fc('0x45')][_0x26fc('0x7e')]){if(_0xdc8ef3[_0x26fc('0x45')]['read']==0x1){_0x399cb8[_0x26fc('0x69')](_0x26fc('0x7f'));}else{_0x399cb8[_0x26fc('0x69')](_0x26fc('0x80'));}}if(_0xdc8ef3['query'][_0x26fc('0x81')]){_0x6c753=_[_0x26fc('0x82')](_0xdc8ef3[_0x26fc('0x45')][_0x26fc('0x81')])?_0xdc8ef3[_0x26fc('0x45')]['tag']:new Array(_0xdc8ef3[_0x26fc('0x45')][_0x26fc('0x81')]);_0x6c753[_0x26fc('0x39')](function(_0x5e7754){_0x21915b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5e7754+',%');});}if(_0xdc8ef3[_0x26fc('0x45')][_0x26fc('0x83')]){var _0x285f0d=_0xdc8ef3[_0x26fc('0x45')]['filter']['replace']('\x5c','\x5c\x5c')[_0x26fc('0x84')](/'/g,'\x27\x27');if(qs[_0x26fc('0x85')](_0x285f0d)){_0x4671db['or'](_0x26fc('0x86'),_0x285f0d+'%')['or'](_0x26fc('0x87'),_0x285f0d+'%');}else{_0x4671db['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x26fc('0x6f')](_0x285f0d))['or'](_0x26fc('0x88'),_0x285f0d+'%');}}}_0x399cb8[_0x26fc('0x4d')](_0x4671db);_0x399cb8[_0x26fc('0x89')](_0x26fc('0x8a'));var _0x377f88={'type':db[_0x26fc('0x8b')][_0x26fc('0x8c')]['SELECT'],'raw':!![]};var _0xeb7d53=_0x399cb8[_0x26fc('0x8d')]();_0xeb7d53[_0x26fc('0x50')](_0x26fc('0x8a'));_0xeb7d53[_0x26fc('0x50')](_0x26fc('0x8e'),'unreadMessages');if(_0x1205e8[_0x26fc('0x4b')]){_0x1205e8['order'][_0x26fc('0x39')](function(_0x6ab76){var _0x37ca33=_0x6ab76[0x0]===_0x26fc('0x8f')?_0x6ab76[0x0]:'i.'+_0x6ab76[0x0];_0x399cb8[_0x26fc('0x4b')](_0x37ca33,_0x6ab76[0x1]==='DESC'?![]:!![]);});}if(!_[_0x26fc('0x78')](_0x6c753)){_0x399cb8[_0x26fc('0x69')](_0x21915b);_0xeb7d53[_0x26fc('0x4d')](_0x26fc('0x90'),_0x6c753);}BPromise[_0x26fc('0x91')]()[_0x26fc('0x2a')](function(){if(!_0x1a8ede){if(_0xdc8ef3[_0x26fc('0x45')]['WhatsappAccountId'])return;_0xeb7d53[_0x26fc('0x4d')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x399cb8['where'](_0x26fc('0x92'));return;}if(_0xdc8ef3[_0x26fc('0x93')][_0x26fc('0x94')]!=='agent')return;return _0xdc8ef3['user'][_0x26fc('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5162c7){if(_[_0x26fc('0x78')](_0x5162c7)){_0xeb7d53[_0x26fc('0x4d')]('i.WhatsappAccountId\x20IS\x20NULL');_0x399cb8[_0x26fc('0x4d')](_0x26fc('0x96'));}else{_0xeb7d53[_0x26fc('0x4d')](_0x26fc('0x97'),_['map'](_0x5162c7,'id'));_0x399cb8[_0x26fc('0x4d')](_0x26fc('0x97'),_['map'](_0x5162c7,'id'));}});})['then'](function(){if(_0xdc8ef3[_0x26fc('0x93')][_0x26fc('0x94')]===_0x26fc('0x32')&&!_0x1a8ede&&!_0xdc8ef3['query'][_0x26fc('0x79')])return[];return db['sequelize'][_0x26fc('0x45')](_0xeb7d53[_0x26fc('0x98')](),_0x377f88);})['then'](function(_0x2e5bf6){_0x235861[_0x26fc('0x23')]=_0x2e5bf6[_0x26fc('0x6e')];if(_0x235861['count']===0x0)return[];return db[_0x26fc('0x99')][_0x26fc('0x45')](_0x44b16e['toString'](),_0x377f88)[_0x26fc('0x2a')](function(_0x160871){_0x1395a8=_[_0x26fc('0x9a')](_0x160871,'id');_0x377f88=_[_0x26fc('0x9b')](_0x377f88,{'model':db[_0x26fc('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xdc8ef3[_0x26fc('0x45')]['fields']){_0x1205e8[_0x26fc('0x46')]['forEach'](function(_0x42a8eb){_0x399cb8[_0x26fc('0x50')]('i.'+_0x42a8eb);});}else{_0x399cb8[_0x26fc('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x26fc('0x67'));_0x399cb8[_0x26fc('0x50')](_0x26fc('0x9c'),_0x26fc('0x9d'));_0x399cb8[_0x26fc('0x50')](_0x26fc('0x9e'),_0x26fc('0x9f'));_0x399cb8[_0x26fc('0x50')](_0x26fc('0xa0'),_0x26fc('0x8f'));_0x399cb8['field']('i.*');_0x399cb8[_0x26fc('0x50')](_0x26fc('0xa1'),'Contact.firstName');_0x399cb8[_0x26fc('0x50')](_0x26fc('0xa2'),_0x26fc('0xa3'));_0x399cb8[_0x26fc('0x50')]('c.email',_0x26fc('0xa4'));_0x399cb8[_0x26fc('0x50')]('c.phone',_0x26fc('0xa5'));_0x399cb8[_0x26fc('0x50')](_0x26fc('0xa6'),'Contact.mobile');_0x399cb8['field'](_0x26fc('0xa7'),_0x26fc('0xa8'));_0x399cb8['field'](_0x26fc('0xa9'),_0x26fc('0xaa'));_0x399cb8[_0x26fc('0x50')]('o.internal',_0x26fc('0xab'));_0x399cb8[_0x26fc('0x50')](_0x26fc('0xac'),_0x26fc('0x37'));}if(_0x1205e8['limit'])_0x399cb8['limit'](_0x1205e8[_0x26fc('0x22')]);if(_0x1205e8[_0x26fc('0x4a')])_0x399cb8[_0x26fc('0x4a')](_0x1205e8[_0x26fc('0x4a')]);return db['sequelize'][_0x26fc('0x45')](_0x399cb8['toString'](),_0x377f88);})[_0x26fc('0x2a')](function(_0x210827){if(_0x210827['length']>0x0)_0x354ec0[_0x26fc('0x4d')](_0x26fc('0xad'),_[_0x26fc('0x35')](_0x210827,'id'));return db['sequelize'][_0x26fc('0x45')](_0x354ec0[_0x26fc('0x98')](),_0x377f88)[_0x26fc('0x2a')](function(_0x1e3ddb){var _0x327518=_[_0x26fc('0xae')](_0x1e3ddb,_0x26fc('0xaf'));var _0x324481=[];_0x210827[_0x26fc('0x39')](function(_0x483711){_0x324481[_0x26fc('0xb0')](updateWhatsappInteraction(_0x483711,_0x1395a8,_0x327518));});return BPromise[_0x26fc('0xb1')](_0x324481);});});})['then'](function(_0x2860df){_0x235861[_0x26fc('0xb2')]=_0x2860df;return _0x235861;})[_0x26fc('0x2a')](respondWithFilteredResult(_0x31a2fe,_0x1205e8))['catch'](handleError(_0x31a2fe,null));};exports[_0x26fc('0xb3')]=function(_0x3c2db5,_0x50a3e6){var _0x5ad139={'raw':![],'where':{'id':_0x3c2db5[_0x26fc('0xb4')]['id']}},_0x48c954={};_0x48c954[_0x26fc('0x44')]=_['keys'](db[_0x26fc('0x3c')]['rawAttributes']);_0x48c954[_0x26fc('0x45')]=_[_0x26fc('0x41')](_0x3c2db5[_0x26fc('0x45')]);_0x48c954[_0x26fc('0x42')]=_[_0x26fc('0x43')](_0x48c954[_0x26fc('0x44')],_0x48c954[_0x26fc('0x45')]);_0x5ad139[_0x26fc('0x46')]=_['intersection'](_0x48c954[_0x26fc('0x44')],qs[_0x26fc('0x47')](_0x3c2db5[_0x26fc('0x45')][_0x26fc('0x47')]));_0x5ad139['attributes']=_0x5ad139['attributes'][_0x26fc('0x6e')]?_0x5ad139[_0x26fc('0x46')]:_0x48c954[_0x26fc('0x44')];if(_0x3c2db5[_0x26fc('0x45')]['includeAll']){_0x5ad139[_0x26fc('0xb5')]=[{'all':!![]}];}_0x5ad139=_[_0x26fc('0x9b')]({},_0x5ad139,_0x3c2db5[_0x26fc('0xb6')]);return db['WhatsappInteraction'][_0x26fc('0x66')](_0x5ad139)[_0x26fc('0x2a')](handleEntityNotFound(_0x50a3e6,null))[_0x26fc('0x2a')](respondWithResult(_0x50a3e6,null))['catch'](handleError(_0x50a3e6,null));};exports[_0x26fc('0xb7')]=function(_0x5e3176,_0x4909e5){return db[_0x26fc('0x3c')][_0x26fc('0xb7')](_0x5e3176[_0x26fc('0x2f')],{})['then'](respondWithResult(_0x4909e5,0xc9))[_0x26fc('0xb8')](handleError(_0x4909e5,null));};exports[_0x26fc('0x29')]=function(_0x36f407,_0x524535){if(_0x36f407[_0x26fc('0x2f')]['id']){delete _0x36f407[_0x26fc('0x2f')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x36f407[_0x26fc('0xb4')]['id']}})['then'](handleEntityNotFound(_0x524535,null))['then'](saveUpdates(_0x36f407['body'],null))[_0x26fc('0x2a')](respondWithResult(_0x524535,null))[_0x26fc('0xb8')](handleError(_0x524535,null));};exports[_0x26fc('0x2b')]=function(_0x2190dc,_0x29d842){return db['WhatsappInteraction'][_0x26fc('0x66')]({'where':{'id':_0x2190dc[_0x26fc('0xb4')]['id']}})[_0x26fc('0x2a')](handleEntityNotFound(_0x29d842,null))[_0x26fc('0x2a')](removeEntity(_0x29d842,null))[_0x26fc('0xb8')](handleError(_0x29d842,null));};exports[_0x26fc('0xb9')]=function(_0x527cda,_0x4a55b5){return db['WhatsappInteraction'][_0x26fc('0xb9')]()[_0x26fc('0x2a')](respondWithResult(_0x4a55b5,null))[_0x26fc('0xb8')](handleError(_0x4a55b5,null));};exports[_0x26fc('0xba')]=function(_0x2e7f83,_0x1bd7b4,_0x272bd8){return db[_0x26fc('0xbb')][_0x26fc('0x66')]({'where':{'id':_0x2e7f83[_0x26fc('0xb4')]['id']}})[_0x26fc('0x2a')](handleEntityNotFound(_0x1bd7b4,null))[_0x26fc('0x2a')](function(_0x338087){if(_0x338087){return _0x338087['addMessage'](_0x2e7f83[_0x26fc('0x2f')]['ids'],_[_0x26fc('0xbc')](_0x2e7f83[_0x26fc('0x2f')],['ids','id'])||{});}})[_0x26fc('0x2a')](respondWithResult(_0x1bd7b4,null))[_0x26fc('0xb8')](handleError(_0x1bd7b4,null));};exports[_0x26fc('0xbd')]=function(_0x3af93c,_0x5762cb,_0x108eab){var _0x33dfb8={'raw':![],'where':{}};var _0x220afa={};var _0xab3347={'count':0x0,'rows':[]};return db[_0x26fc('0x3c')][_0x26fc('0xbe')]({'where':{'id':_0x3af93c[_0x26fc('0xb4')]['id']}})[_0x26fc('0x2a')](handleEntityNotFound(_0x5762cb,null))[_0x26fc('0x2a')](function(_0x5e42bd){if(_0x5e42bd){_0x220afa[_0x26fc('0x44')]=_[_0x26fc('0x41')](db[_0x26fc('0xbb')][_0x26fc('0x3d')]);_0x220afa[_0x26fc('0x45')]=_[_0x26fc('0x41')](_0x3af93c[_0x26fc('0x45')]);_0x220afa[_0x26fc('0x42')]=_['intersection'](_0x220afa['model'],_0x220afa[_0x26fc('0x45')]);_0x33dfb8['attributes']=_[_0x26fc('0x43')](_0x220afa[_0x26fc('0x44')],qs[_0x26fc('0x47')](_0x3af93c[_0x26fc('0x45')][_0x26fc('0x47')]));_0x33dfb8[_0x26fc('0x46')]=_0x33dfb8['attributes'][_0x26fc('0x6e')]?_0x33dfb8[_0x26fc('0x46')]:_0x220afa[_0x26fc('0x44')];if(!_0x3af93c[_0x26fc('0x45')]['hasOwnProperty'](_0x26fc('0x49'))){_0x33dfb8[_0x26fc('0x22')]=qs[_0x26fc('0x22')](_0x3af93c[_0x26fc('0x45')]['limit']);_0x33dfb8[_0x26fc('0x4a')]=qs[_0x26fc('0x4a')](_0x3af93c[_0x26fc('0x45')][_0x26fc('0x4a')]);}_0x33dfb8['order']=qs[_0x26fc('0x4c')](_0x3af93c[_0x26fc('0x45')][_0x26fc('0x4c')]);_0x33dfb8[_0x26fc('0x4d')]=qs[_0x26fc('0x42')](_[_0x26fc('0x4e')](_0x3af93c['query'],_0x220afa[_0x26fc('0x42')]));_0x33dfb8[_0x26fc('0x4d')][_0x26fc('0xaf')]=_0x5e42bd['id'];if(_0x3af93c[_0x26fc('0x45')]['filter']){_0x33dfb8['where']=_[_0x26fc('0x9b')](_0x33dfb8[_0x26fc('0x4d')],{'$or':_[_0x26fc('0x35')](_0x33dfb8[_0x26fc('0x46')],function(_0x13054d){var _0x10a1cf={};_0x10a1cf[_0x13054d]={'$like':'%'+_0x3af93c['query'][_0x26fc('0x83')]+'%'};return _0x10a1cf;})});}if(_0x3af93c[_0x26fc('0x45')][_0x26fc('0x7c')]){var _0x278205=_0x3af93c[_0x26fc('0x45')][_0x26fc('0x7c')][_0x26fc('0x38')](',');var _0x49cbc5={};_0x49cbc5[_0x278205[0x0]]={'$gte':moment(_0x278205[0x1])[_0x26fc('0xbf')](_0x26fc('0xc0'))};_0x33dfb8[_0x26fc('0x4d')]=_[_0x26fc('0x9b')](_0x33dfb8[_0x26fc('0x4d')],_0x49cbc5);}_0x33dfb8=_['merge']({},_0x33dfb8,_0x3af93c[_0x26fc('0xb6')]);return db[_0x26fc('0xbb')][_0x26fc('0x23')]({'where':_0x33dfb8[_0x26fc('0x4d')]})[_0x26fc('0x2a')](function(_0x31d056){_0xab3347[_0x26fc('0x23')]=_0x31d056;if(_0x3af93c[_0x26fc('0x45')][_0x26fc('0xc1')]){_0x33dfb8[_0x26fc('0xb5')]=[{'all':!![]}];}return db[_0x26fc('0xbb')][_0x26fc('0xc2')](_0x33dfb8);})[_0x26fc('0x2a')](function(_0x24dd10){_0xab3347[_0x26fc('0xb2')]=_0x24dd10;return _0xab3347;});}})[_0x26fc('0x2a')](respondWithFilteredResult(_0x5762cb,_0x33dfb8))[_0x26fc('0xb8')](handleError(_0x5762cb,null));};exports[_0x26fc('0xc3')]=function(_0x47c555,_0x18e6a6,_0x4a7a2e){return db[_0x26fc('0x3c')][_0x26fc('0x66')]({'where':{'id':_0x47c555[_0x26fc('0xb4')]['id']}})[_0x26fc('0x2a')](handleEntityNotFound(_0x18e6a6,null))[_0x26fc('0x2a')](function(_0x8a2476){if(_0x8a2476){return _0x8a2476[_0x26fc('0xc4')](_0x47c555[_0x26fc('0x2f')][_0x26fc('0xc5')],_['omit'](_0x47c555[_0x26fc('0x2f')],[_0x26fc('0xc5'),'id'])||{})['spread'](function(){return db['Tag'][_0x26fc('0xc2')]({'attributes':['id','name',_0x26fc('0x51')],'where':{'id':_0x47c555[_0x26fc('0x2f')]['ids']}});})[_0x26fc('0x2a')](function(_0x20bf92){socket[_0x26fc('0xc6')]('whatsappInteractionTags:save',{'id':Number(_0x47c555[_0x26fc('0xb4')]['id']),'tags':_0x20bf92||[]});return{'id':Number(_0x47c555[_0x26fc('0xb4')]['id']),'tags':_0x20bf92||[]};});}})['then'](respondWithResult(_0x18e6a6,null))[_0x26fc('0xb8')](handleError(_0x18e6a6,null));};exports[_0x26fc('0xc7')]=function(_0x3f662d,_0x7c4f25,_0x51e881){return db[_0x26fc('0x3c')][_0x26fc('0x66')]({'where':{'id':_0x3f662d[_0x26fc('0xb4')]['id']}})['then'](handleEntityNotFound(_0x7c4f25,null))['then'](function(_0x4910de){if(_0x4910de){return _0x4910de[_0x26fc('0xc7')](_0x3f662d[_0x26fc('0x45')][_0x26fc('0xc5')]);}})[_0x26fc('0x2a')](respondWithStatusCode(_0x7c4f25,null))['catch'](handleError(_0x7c4f25,null));};exports[_0x26fc('0xc8')]=function(_0x37c58a,_0x5a0b08){var _0x5ae8b0=moment()[_0x26fc('0xc9')]()[_0x26fc('0x98')]();var _0x214472=path[_0x26fc('0xca')](config[_0x26fc('0xcb')],_0x26fc('0xcc'),_0x26fc('0xcd'),_0x26fc('0xce'));var _0x20bb90=path[_0x26fc('0xca')](config[_0x26fc('0xcb')],_0x26fc('0xcc'),_0x26fc('0xcd'),_0x26fc('0xcf'));var _0x17241d=path[_0x26fc('0xca')](_0x214472,_0x5ae8b0);var _0x27647c=util[_0x26fc('0xbf')]('transcript-%d-%s.zip',_0x37c58a['params']['id'],_0x5ae8b0);var _0x5a16b7=path[_0x26fc('0xca')](_0x214472,_0x27647c);var _0x1c7a95=[];_0x1c7a95[_0x26fc('0xb0')]({'model':db['User'],'as':'User','attributes':['id',_0x26fc('0x36')],'raw':!![]});_0x1c7a95[_0x26fc('0xb0')]({'model':db[_0x26fc('0xd0')],'as':'Contact','attributes':['id',_0x26fc('0xd1'),'lastName'],'raw':!![]});if(_0x37c58a[_0x26fc('0x45')][_0x26fc('0xcf')]){_0x1c7a95[_0x26fc('0xb0')]({'model':db[_0x26fc('0xd2')],'as':_0x26fc('0xd2'),'raw':!![]});}var _0x5725f1=[{'model':db['WhatsappMessage'],'as':_0x26fc('0xd3'),'attributes':['id','body',_0x26fc('0xd4'),'direction',_0x26fc('0xd5'),_0x26fc('0x7e')],'include':_0x1c7a95}];_0x5725f1[_0x26fc('0xb0')]({'model':db[_0x26fc('0xd6')],'as':_0x26fc('0xd7'),'attributes':['id',_0x26fc('0x2e')]});_0x5725f1[_0x26fc('0xb0')]({'model':db[_0x26fc('0xd8')],'as':_0x26fc('0xd9'),'attributes':['id',_0x26fc('0x36')]});return db[_0x26fc('0x3c')][_0x26fc('0x66')]({'where':{'id':_0x37c58a[_0x26fc('0xb4')]['id']},'include':_0x5725f1})[_0x26fc('0x2a')](handleEntityNotFound(_0x5a0b08,null))[_0x26fc('0x2a')](function(_0x38290b){if(_0x38290b){var _0x127db8=_0x38290b['get']({'plain':!![]});fs[_0x26fc('0xda')](_0x17241d);var _0x242934={'channel':_0x26fc('0xdb'),'account':_0x127db8[_0x26fc('0xd7')][_0x26fc('0x2e')],'agent':_0x127db8[_0x26fc('0xd9')]?_0x127db8[_0x26fc('0xd9')][_0x26fc('0x36')]:_0x26fc('0xdc'),'createdAt':moment(_0x127db8[_0x26fc('0xd4')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x26fc('0x98')](),'closedAt':_0x127db8[_0x26fc('0xdd')]?moment(_0x127db8[_0x26fc('0xde')])[_0x26fc('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x26fc('0x98')]():'','disposition':_0x127db8[_0x26fc('0xdf')],'messages':_(_0x127db8[_0x26fc('0xd3')])[_0x26fc('0x83')]({'secret':![]})[_0x26fc('0x35')](function(_0x1d11f0){if(_0x1d11f0[_0x26fc('0xd2')]){var _0x17291f=path[_0x26fc('0xca')](_0x20bb90,_0x1d11f0['Attachment'][_0x26fc('0xe0')]);if(fs[_0x26fc('0xe1')](_0x17291f)){fs[_0x26fc('0xe2')](_0x17291f)[_0x26fc('0xe3')](fs[_0x26fc('0xe4')](path['join'](_0x17241d,_0x1d11f0[_0x26fc('0xd2')][_0x26fc('0xe0')])));}}return{'date':moment(_0x1d11f0['createdAt'])[_0x26fc('0xbf')](_0x26fc('0xc0'))['toString'](),'sender':_0x1d11f0['direction']===_0x26fc('0xe5')?_0x1d11f0[_0x26fc('0xd8')]?_0x1d11f0[_0x26fc('0xd8')][_0x26fc('0x36')]:_0x26fc('0xe6'):_0x1d11f0[_0x26fc('0x6b')][_0x26fc('0xd1')]+(_0x1d11f0[_0x26fc('0x6b')]['lastName']?'\x20'+_0x1d11f0[_0x26fc('0x6b')][_0x26fc('0xe7')]:''),'body':_0x1d11f0[_0x26fc('0xd2')]?_0x1d11f0[_0x26fc('0xd2')][_0x26fc('0xe0')]:_0x1d11f0['body'],'direction':_0x1d11f0[_0x26fc('0xe8')]===_0x26fc('0xe5')?'A':'C','secret':_0x1d11f0[_0x26fc('0xd5')],'read':_0x1d11f0[_0x26fc('0x7e')],'attachment':_0x1d11f0[_0x26fc('0xd2')]};})['value']()};return ejs[_0x26fc('0xe9')](path[_0x26fc('0xca')](config[_0x26fc('0xcb')],'server',_0x26fc('0xea'),_0x26fc('0xeb')),{'interaction':_0x242934})[_0x26fc('0x2a')](function(_0x159108){var _0x4caa20=path[_0x26fc('0xca')](_0x17241d,'transcript-'+_0x127db8['id']+'-'+_0x5ae8b0+_0x26fc('0xec'));var _0x2fdc3c={'path':_0x4caa20,'channel':_0x26fc('0xdb'),'interactionId':_0x127db8['id']};return pdf['createPdfFromHTML'](_0x159108,_0x2fdc3c);})[_0x26fc('0x2a')](function(){return new BPromise(function(_0x267628,_0x521f39){zipdir(_0x17241d,{'saveTo':_0x5a16b7},function(_0xde348e,_0x52b79f){if(_0xde348e)return _0x521f39(_0xde348e);return _0x267628(_0x52b79f);});})[_0x26fc('0x2a')](function(){return new BPromise(function(_0x1eab0e,_0xe44e85){rimraf(_0x17241d,function(_0x361c69){if(_0x361c69)_0xe44e85(_0x361c69);return _0x1eab0e();});});})[_0x26fc('0x2a')](function(){return _0x5a0b08['download'](_0x5a16b7,_0x27647c,function(_0x738c3e){if(_0x738c3e){console[_0x26fc('0xed')](_0x26fc('0xee'),_0x738c3e);}else{fs['unlinkSync'](_0x5a16b7);}});});});}else{return _0x5a0b08['sendStatus'](0xc8);}})[_0x26fc('0xb8')](handleError(_0x5a0b08,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6976c64..f0f314f 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef05=['events','../../mysqldb','WhatsappMessage','save','remove','then','map','findAll','setDataValue','unreadMessages','emit','catch','hook','exports'];(function(_0x2d8b24,_0x3a7aa9){var _0x5ca81e=function(_0x5265f2){while(--_0x5265f2){_0x2d8b24['push'](_0x2d8b24['shift']());}};_0x5ca81e(++_0x3a7aa9);}(_0xef05,0x126));var _0x5ef0=function(_0xca316b,_0x3d0d57){_0xca316b=_0xca316b-0x0;var _0x3623f5=_0xef05[_0xca316b];return _0x3623f5;};'use strict';var EventEmitter=require(_0x5ef0('0x0'));var WhatsappInteraction=require(_0x5ef0('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5ef0('0x1'))['db'][_0x5ef0('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ef0('0x3'),'afterUpdate':'update','afterDestroy':_0x5ef0('0x4')};function emitEvent(_0x16e47c){return function(_0x530649,_0x35486d,_0x2e9aac){_0x530649['getUsers']({'attributes':['id'],'raw':!![]})[_0x5ef0('0x5')](function(_0x6d70c){_0x530649['setDataValue']('Users',_0x6d70c[_0x5ef0('0x6')](function(_0x1cc2cd){return{'id':_0x1cc2cd['id']};}));return WhatsappMessage[_0x5ef0('0x7')]({'where':{'WhatsappInteractionId':_0x530649['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ef0('0x5')](function(_0x79b3b6){_0x530649[_0x5ef0('0x8')](_0x5ef0('0x9'),_0x79b3b6['length']);WhatsappInteractionEvents[_0x5ef0('0xa')](_0x16e47c+':'+_0x530649['id'],_0x530649);WhatsappInteractionEvents[_0x5ef0('0xa')](_0x16e47c,_0x530649);_0x2e9aac(null);})[_0x5ef0('0xb')](_0x2e9aac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x5ef0('0xc')](e,emitEvent(event));}}module[_0x5ef0('0xd')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xe7db=['update','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save'];(function(_0x26b9cb,_0x12bc4c){var _0x3f44e6=function(_0x1a5a4e){while(--_0x1a5a4e){_0x26b9cb['push'](_0x26b9cb['shift']());}};_0x3f44e6(++_0x12bc4c);}(_0xe7db,0x193));var _0xbe7d=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xe7db[_0x3a13cf];return _0x4817c;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xbe7d('0x0'))['db'][_0xbe7d('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xbe7d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbe7d('0x3')](0x0);var events={'afterCreate':_0xbe7d('0x4'),'afterUpdate':_0xbe7d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x309c56){return function(_0x31a82a,_0x3db012,_0x4905cb){_0x31a82a[_0xbe7d('0x6')]({'attributes':['id'],'raw':!![]})[_0xbe7d('0x7')](function(_0x4a2cf6){_0x31a82a[_0xbe7d('0x8')]('Users',_0x4a2cf6['map'](function(_0x2c2957){return{'id':_0x2c2957['id']};}));return WhatsappMessage[_0xbe7d('0x9')]({'where':{'WhatsappInteractionId':_0x31a82a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe7d('0x7')](function(_0x22b370){_0x31a82a[_0xbe7d('0x8')](_0xbe7d('0xa'),_0x22b370[_0xbe7d('0xb')]);WhatsappInteractionEvents['emit'](_0x309c56+':'+_0x31a82a['id'],_0x31a82a);WhatsappInteractionEvents[_0xbe7d('0xc')](_0x309c56,_0x31a82a);_0x4905cb(null);})[_0xbe7d('0xd')](_0x4905cb(null));};}for(var e in events){if(events[_0xbe7d('0xe')](e)){var event=events[e];WhatsappInteraction[_0xbe7d('0xf')](e,emitEvent(event));}}module[_0xbe7d('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b7fb550..bbfe351 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x920f=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closed'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x920f,0x1ed));var _0xf920=function(_0x1f3c75,_0x2952aa){_0x1f3c75=_0x1f3c75-0x0;var _0x5ec157=_0x920f[_0x1f3c75];return _0x5ec157;};'use strict';var _=require(_0xf920('0x0'));var util=require(_0xf920('0x1'));var logger=require(_0xf920('0x2'))(_0xf920('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf920('0x4'));var config=require(_0xf920('0x5'));var attributes=require(_0xf920('0x6'));module[_0xf920('0x7')]=function(_0x339c21,_0x2e1eae){return _0x339c21['define'](_0xf920('0x8'),attributes,{'tableName':_0xf920('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d3b0d,_0xbdb6b1,_0x4472fe){if(_0x2d3b0d['changed'](_0xf920('0xa'))){_0x2d3b0d[_0xf920('0xb')]=moment()[_0xf920('0xc')](_0xf920('0xd'));}_0x4472fe(null,_0x2d3b0d);}}});}; \ No newline at end of file +var _0xaa00=['moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x2352c0,_0x74d3e5){var _0x5b8096=function(_0x2c2220){while(--_0x2c2220){_0x2352c0['push'](_0x2352c0['shift']());}};_0x5b8096(++_0x74d3e5);}(_0xaa00,0xed));var _0x0aa0=function(_0x41a4af,_0x1bd811){_0x41a4af=_0x41a4af-0x0;var _0x34fb53=_0xaa00[_0x41a4af];return _0x34fb53;};'use strict';var _=require('lodash');var util=require(_0x0aa0('0x0'));var logger=require(_0x0aa0('0x1'))(_0x0aa0('0x2'));var moment=require(_0x0aa0('0x3'));var BPromise=require(_0x0aa0('0x4'));var rp=require(_0x0aa0('0x5'));var fs=require('fs');var path=require(_0x0aa0('0x6'));var rimraf=require('rimraf');var config=require(_0x0aa0('0x7'));var attributes=require(_0x0aa0('0x8'));module[_0x0aa0('0x9')]=function(_0x8dae23,_0xe08991){return _0x8dae23[_0x0aa0('0xa')](_0x0aa0('0xb'),attributes,{'tableName':_0x0aa0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2394cf,_0x1da724,_0x2f3a8e){if(_0x2394cf['changed'](_0x0aa0('0xd'))){_0x2394cf['closedAt']=moment()[_0x0aa0('0xe')](_0x0aa0('0xf'));}_0x2f3a8e(null,_0x2394cf);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4689303..e9f6ba9 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x114e=['UpdateWhatsappInteraction','update','options','raw','attributes','limit','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','body','ids','omit','spread','AddTags','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x114e,0x1d3));var _0xe114=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x114e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe114('0x0'));var moment=require(_0xe114('0x1'));var BPromise=require(_0xe114('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe114('0x3'));var db=require(_0xe114('0x4'))['db'];var utils=require(_0xe114('0x5'));var logger=require(_0xe114('0x6'))(_0xe114('0x7'));var config=require(_0xe114('0x8'));var jayson=require(_0xe114('0x9'));var client=jayson[_0xe114('0xa')][_0xe114('0xb')]({'port':0x232a});config[_0xe114('0xc')]=_[_0xe114('0xd')](config['redis'],{'host':_0xe114('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe114('0xc')]));require(_0xe114('0xf'))[_0xe114('0x10')](socket);function respondWithRpcPromise(_0x5da164,_0x1fee59,_0x3b3a68){return new BPromise(function(_0xb727e0,_0x451816){return client[_0xe114('0x11')](_0x5da164,_0x3b3a68)[_0xe114('0x12')](function(_0x1461d5){logger[_0xe114('0x13')](_0xe114('0x14'),_0x1fee59,_0xe114('0x15'));logger['debug'](_0xe114('0x16'),_0x1fee59,_0xe114('0x15'),JSON[_0xe114('0x17')](_0x1461d5));if(_0x1461d5[_0xe114('0x18')]){if(_0x1461d5[_0xe114('0x18')][_0xe114('0x19')]===0x1f4){logger[_0xe114('0x18')](_0xe114('0x14'),_0x1fee59,_0x1461d5[_0xe114('0x18')]['message']);return _0x451816(_0x1461d5[_0xe114('0x18')][_0xe114('0x1a')]);}logger[_0xe114('0x18')](_0xe114('0x14'),_0x1fee59,_0x1461d5[_0xe114('0x18')]['message']);return _0xb727e0(_0x1461d5['error']['message']);}else{logger['info'](_0xe114('0x14'),_0x1fee59,_0xe114('0x15'));_0xb727e0(_0x1461d5[_0xe114('0x1b')][_0xe114('0x1a')]);}})['catch'](function(_0x2ccb1a){logger[_0xe114('0x18')](_0xe114('0x14'),_0x1fee59,_0x2ccb1a);_0x451816(_0x2ccb1a);});});}exports[_0xe114('0x1c')]=function(_0x8ea9bf){var _0x6dcfb9=this;return new Promise(function(_0x22a0b0,_0x21e4c7){return db['WhatsappInteraction'][_0xe114('0x1d')](_0x8ea9bf['body'],{'raw':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')][_0xe114('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')]['where']||null:null,'attributes':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')][_0xe114('0x20')]||null:null,'limit':_0x8ea9bf[_0xe114('0x1e')]?_0x8ea9bf[_0xe114('0x1e')][_0xe114('0x21')]||null:null})['then'](function(_0x2d547a){logger[_0xe114('0x13')](_0xe114('0x1c'),_0x8ea9bf);logger['debug'](_0xe114('0x1c'),_0x8ea9bf,JSON[_0xe114('0x17')](_0x2d547a));_0x22a0b0(_0x2d547a);})[_0xe114('0x22')](function(_0x2de61a){logger[_0xe114('0x18')](_0xe114('0x1c'),_0x2de61a[_0xe114('0x1a')],_0x8ea9bf);_0x21e4c7(_0x6dcfb9['error'](0x1f4,_0x2de61a[_0xe114('0x1a')]));});});};exports[_0xe114('0x23')]=function(_0x43f7f9){return new Promise(function(_0x202609,_0x3c7708){return db[_0xe114('0x24')][_0xe114('0x25')]({'where':_0x43f7f9[_0xe114('0x1e')]?_0x43f7f9[_0xe114('0x1e')][_0xe114('0x26')]||null:null})[_0xe114('0x12')](function(_0x52e58e){if(_0x52e58e){return _0x52e58e['addTags'](_0x43f7f9[_0xe114('0x27')][_0xe114('0x28')],_[_0xe114('0x29')](_0x43f7f9['body'],[_0xe114('0x28'),'id'])||{});}})[_0xe114('0x2a')](function(_0x1d214b){logger[_0xe114('0x13')](_0xe114('0x2b'),_0x43f7f9);logger[_0xe114('0x2c')](_0xe114('0x2b'),_0x43f7f9,JSON['stringify'](_0x1d214b));_0x202609(_0x1d214b);})[_0xe114('0x22')](function(_0x2c1661){logger['error']('AddTags',_0x2c1661['message'],_0x43f7f9);_0x3c7708(_this['error'](0x1f4,_0x2c1661[_0xe114('0x1a')]));});});}; \ No newline at end of file +var _0xbc88=['UpdateWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','WhatsappInteraction','update','body','options','raw','limit'];(function(_0x5bac6b,_0xa74138){var _0xcb3a86=function(_0x37706){while(--_0x37706){_0x5bac6b['push'](_0x5bac6b['shift']());}};_0xcb3a86(++_0xa74138);}(_0xbc88,0x104));var _0x8bc8=function(_0x18cfcf,_0x283dad){_0x18cfcf=_0x18cfcf-0x0;var _0x7f37f9=_0xbc88[_0x18cfcf];return _0x7f37f9;};'use strict';var _=require('lodash');var util=require(_0x8bc8('0x0'));var moment=require(_0x8bc8('0x1'));var BPromise=require('bluebird');var rs=require(_0x8bc8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bc8('0x3'))['db'];var utils=require(_0x8bc8('0x4'));var logger=require(_0x8bc8('0x5'))(_0x8bc8('0x6'));var config=require(_0x8bc8('0x7'));var jayson=require(_0x8bc8('0x8'));var client=jayson[_0x8bc8('0x9')][_0x8bc8('0xa')]({'port':0x232a});config['redis']=_[_0x8bc8('0xb')](config[_0x8bc8('0xc')],{'host':_0x8bc8('0xd'),'port':0x18eb});var socket=require(_0x8bc8('0xe'))(new Redis(config[_0x8bc8('0xc')]));require(_0x8bc8('0xf'))[_0x8bc8('0x10')](socket);function respondWithRpcPromise(_0xe5851c,_0xb16796,_0x47d258){return new BPromise(function(_0x228e40,_0x53beb1){return client[_0x8bc8('0x11')](_0xe5851c,_0x47d258)[_0x8bc8('0x12')](function(_0x1ca44b){logger[_0x8bc8('0x13')](_0x8bc8('0x14'),_0xb16796,_0x8bc8('0x15'));logger[_0x8bc8('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xb16796,'request\x20sent',JSON[_0x8bc8('0x17')](_0x1ca44b));if(_0x1ca44b[_0x8bc8('0x18')]){if(_0x1ca44b['error']['code']===0x1f4){logger[_0x8bc8('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0xb16796,_0x1ca44b[_0x8bc8('0x18')]['message']);return _0x53beb1(_0x1ca44b[_0x8bc8('0x18')]['message']);}logger['error'](_0x8bc8('0x14'),_0xb16796,_0x1ca44b[_0x8bc8('0x18')][_0x8bc8('0x19')]);return _0x228e40(_0x1ca44b[_0x8bc8('0x18')][_0x8bc8('0x19')]);}else{logger[_0x8bc8('0x13')](_0x8bc8('0x14'),_0xb16796,_0x8bc8('0x15'));_0x228e40(_0x1ca44b[_0x8bc8('0x1a')][_0x8bc8('0x19')]);}})[_0x8bc8('0x1b')](function(_0x3e9a72){logger['error'](_0x8bc8('0x14'),_0xb16796,_0x3e9a72);_0x53beb1(_0x3e9a72);});});}exports['UpdateWhatsappInteraction']=function(_0x1b5f1a){var _0x955581=this;return new Promise(function(_0x4857d8,_0x17947d){return db[_0x8bc8('0x1c')][_0x8bc8('0x1d')](_0x1b5f1a[_0x8bc8('0x1e')],{'raw':_0x1b5f1a[_0x8bc8('0x1f')]?_0x1b5f1a[_0x8bc8('0x1f')][_0x8bc8('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5f1a[_0x8bc8('0x1f')]?_0x1b5f1a[_0x8bc8('0x1f')]['where']||null:null,'attributes':_0x1b5f1a[_0x8bc8('0x1f')]?_0x1b5f1a['options']['attributes']||null:null,'limit':_0x1b5f1a[_0x8bc8('0x1f')]?_0x1b5f1a['options'][_0x8bc8('0x21')]||null:null})[_0x8bc8('0x12')](function(_0x425524){logger[_0x8bc8('0x13')](_0x8bc8('0x22'),_0x1b5f1a);logger['debug'](_0x8bc8('0x22'),_0x1b5f1a,JSON[_0x8bc8('0x17')](_0x425524));_0x4857d8(_0x425524);})[_0x8bc8('0x1b')](function(_0x26546f){logger[_0x8bc8('0x18')](_0x8bc8('0x22'),_0x26546f['message'],_0x1b5f1a);_0x17947d(_0x955581['error'](0x1f4,_0x26546f[_0x8bc8('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1d6cb3){return new Promise(function(_0x483acc,_0xadb4f8){return db[_0x8bc8('0x1c')][_0x8bc8('0x23')]({'where':_0x1d6cb3[_0x8bc8('0x1f')]?_0x1d6cb3[_0x8bc8('0x1f')][_0x8bc8('0x24')]||null:null})[_0x8bc8('0x12')](function(_0x42565b){if(_0x42565b){return _0x42565b[_0x8bc8('0x25')](_0x1d6cb3[_0x8bc8('0x1e')][_0x8bc8('0x26')],_[_0x8bc8('0x27')](_0x1d6cb3[_0x8bc8('0x1e')],['ids','id'])||{});}})[_0x8bc8('0x28')](function(_0x4c9cc2){logger[_0x8bc8('0x13')](_0x8bc8('0x29'),_0x1d6cb3);logger[_0x8bc8('0x16')]('AddTags',_0x1d6cb3,JSON[_0x8bc8('0x17')](_0x4c9cc2));_0x483acc(_0x4c9cc2);})[_0x8bc8('0x1b')](function(_0x201326){logger[_0x8bc8('0x18')]('AddTags',_0x201326[_0x8bc8('0x19')],_0x1d6cb3);_0xadb4f8(_this[_0x8bc8('0x18')](0x1f4,_0x201326[_0x8bc8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d304e3e..7a09d0f 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23d8=['emit','removeListener','register','length','whatsappInteraction:','save','remove'];(function(_0x2e8897,_0x1093fc){var _0x6d5478=function(_0x41a282){while(--_0x41a282){_0x2e8897['push'](_0x2e8897['shift']());}};_0x6d5478(++_0x1093fc);}(_0x23d8,0x12b));var _0x823d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x23d8[_0x14add3];return _0x4a174f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x823d('0x0'),_0x823d('0x1'),'update'];function createListener(_0x2b2a28,_0x2a1b9b){return function(_0x70aab3){_0x2a1b9b[_0x823d('0x2')](_0x2b2a28,_0x70aab3);};}function removeListener(_0x48dee8,_0x9128f1){return function(){WhatsappInteractionEvents[_0x823d('0x3')](_0x48dee8,_0x9128f1);};}exports[_0x823d('0x4')]=function(_0x1eae39){for(var _0x216205=0x0,_0x348656=events[_0x823d('0x5')];_0x216205<_0x348656;_0x216205++){var _0x3c0aa2=events[_0x216205];var _0x2dd1a3=createListener(_0x823d('0x6')+_0x3c0aa2,_0x1eae39);WhatsappInteractionEvents['on'](_0x3c0aa2,_0x2dd1a3);}}; \ No newline at end of file +var _0xd4f7=['register','whatsappInteraction:','save','remove','update','emit'];(function(_0x3c109c,_0xd567bd){var _0x2274f5=function(_0x40874e){while(--_0x40874e){_0x3c109c['push'](_0x3c109c['shift']());}};_0x2274f5(++_0xd567bd);}(_0xd4f7,0x11c));var _0x7d4f=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0xd4f7[_0x4af01e];return _0x178c11;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x7d4f('0x0'),_0x7d4f('0x1'),_0x7d4f('0x2')];function createListener(_0x5ebf54,_0x102428){return function(_0x59cfab){_0x102428[_0x7d4f('0x3')](_0x5ebf54,_0x59cfab);};}function removeListener(_0x445010,_0x404848){return function(){WhatsappInteractionEvents['removeListener'](_0x445010,_0x404848);};}exports[_0x7d4f('0x4')]=function(_0x26eb6a){for(var _0x4400d7=0x0,_0x416dc3=events['length'];_0x4400d7<_0x416dc3;_0x4400d7++){var _0x4fd7b9=events[_0x4400d7];var _0x1876a5=createListener(_0x7d4f('0x5')+_0x4fd7b9,_0x26eb6a);WhatsappInteractionEvents['on'](_0x4fd7b9,_0x1876a5);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9c38bcb..558b643 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x686105,_0x46bdb5){var _0x143475=function(_0x422134){while(--_0x422134){_0x686105['push'](_0x686105['shift']());}};_0x143475(++_0x46bdb5);}(_0x34e8,0x12c));var _0x834e=function(_0x48033b,_0x2ec5bb){_0x48033b=_0x48033b-0x0;var _0x592358=_0x34e8[_0x48033b];return _0x592358;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')]('/',auth[_0x834e('0xd')](),interaction[_0x834e('0x12')](_0x834e('0x13'),_0x834e('0x14')),controller[_0x834e('0x15')]);router[_0x834e('0x11')](_0x834e('0x16'),controller[_0x834e('0x17')]);router[_0x834e('0x18')]('/:id',auth[_0x834e('0xd')](),controller[_0x834e('0x19')]);router['put'](_0x834e('0x1a'),auth[_0x834e('0xd')](),controller[_0x834e('0x1b')]);router[_0x834e('0x18')]('/:id/reject',auth[_0x834e('0xd')](),controller[_0x834e('0x1c')]);router['delete'](_0x834e('0xf'),auth['isAuthenticated'](),controller[_0x834e('0x1d')]);module[_0x834e('0x1e')]=router; \ No newline at end of file +var _0x4bc3=['/:id/status','put','accept','reject','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','post','whatsapp','whatsappmessage:create','create'];(function(_0x317b8c,_0x25e059){var _0x42df31=function(_0x15a1ff){while(--_0x15a1ff){_0x317b8c['push'](_0x317b8c['shift']());}};_0x42df31(++_0x25e059);}(_0x4bc3,0x16e));var _0x34bc=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x4bc3[_0x11ce46];return _0x368a1e;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x34bc('0xf'),_0x34bc('0x10')),controller[_0x34bc('0x11')]);router['post'](_0x34bc('0x12'),controller['status']);router[_0x34bc('0x13')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x13')]('/:id/accept',auth[_0x34bc('0xa')](),controller[_0x34bc('0x14')]);router[_0x34bc('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x34bc('0x15')]);router['delete'](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0x16')]);module[_0x34bc('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index fd959bf..aa8d261 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a12=['BOOLEAN','ENUM','out','STRING','TEXT','sequelize','exports','medium'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x3a12,0x85));var _0x23a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a12[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x23a1('0x0'));module[_0x23a1('0x1')]={'body':{'type':Sequelize['TEXT'](_0x23a1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x23a1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x23a1('0x4')]('in',_0x23a1('0x5')),'defaultValue':_0x23a1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x23a1('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x23a1('0x6')]},'providerResponse':{'type':Sequelize[_0x23a1('0x7')]}}; \ No newline at end of file +var _0xa3a0=['DATE','BOOLEAN','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x3b13b5,_0x2d2900){var _0x21040c=function(_0x54f557){while(--_0x54f557){_0x3b13b5['push'](_0x3b13b5['shift']());}};_0x21040c(++_0x2d2900);}(_0xa3a0,0x16a));var _0x0a3a=function(_0x5477d7,_0x16cd92){_0x5477d7=_0x5477d7-0x0;var _0x304807=_0xa3a0[_0x5477d7];return _0x304807;};'use strict';var Sequelize=require('sequelize');module[_0x0a3a('0x0')]={'body':{'type':Sequelize[_0x0a3a('0x1')](_0x0a3a('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0a3a('0x3')]('in',_0x0a3a('0x4')),'defaultValue':_0x0a3a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0a3a('0x5')](0xbe)},'phone':{'type':Sequelize[_0x0a3a('0x5')]},'readAt':{'type':Sequelize[_0x0a3a('0x6')]},'secret':{'type':Sequelize[_0x0a3a('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0a3a('0x5')]},'providerResponse':{'type':Sequelize[_0x0a3a('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0431b22..8cdafec 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79a6=['sort','where','pick','filter','VIRTUAL','includeAll','rows','catch','show','params','create','body','destroy','find','describe','whatsapp-interactions','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','accept','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','type','inspect','twilio','MessageSid','messageId','MessageStatus','update','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','name','send','render','merge','contact','interaction','map','WhatsappMessage','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order'];(function(_0x49c756,_0x37f990){var _0x15fc63=function(_0x563ca0){while(--_0x563ca0){_0x49c756['push'](_0x49c756['shift']());}};_0x15fc63(++_0x37f990);}(_0x79a6,0x145));var _0x679a=function(_0x463183,_0x56bd4e){_0x463183=_0x463183-0x0;var _0xd5fe56=_0x79a6[_0x463183];return _0xd5fe56;};'use strict';var emlformat=require(_0x679a('0x0'));var rimraf=require(_0x679a('0x1'));var zipdir=require(_0x679a('0x2'));var jsonpatch=require(_0x679a('0x3'));var rp=require(_0x679a('0x4'));var moment=require('moment');var BPromise=require(_0x679a('0x5'));var Mustache=require(_0x679a('0x6'));var util=require(_0x679a('0x7'));var path=require(_0x679a('0x8'));var sox=require(_0x679a('0x9'));var csv=require(_0x679a('0xa'));var ejs=require(_0x679a('0xb'));var fs=require('fs');var fs_extra=require(_0x679a('0xc'));var _=require(_0x679a('0xd'));var squel=require(_0x679a('0xe'));var crypto=require(_0x679a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x679a('0x10'));var toCsv=require(_0x679a('0xa'));var querystring=require(_0x679a('0x11'));var Papa=require(_0x679a('0x12'));var Redis=require(_0x679a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x679a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x679a('0x15'));var logger=require(_0x679a('0x16'))(_0x679a('0x17'));var utils=require(_0x679a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x679a('0x19'));var db=require(_0x679a('0x1a'))['db'];config[_0x679a('0x1b')]=_[_0x679a('0x1c')](config[_0x679a('0x1b')],{'host':_0x679a('0x1d'),'port':0x18eb});var socket=require(_0x679a('0x1e'))(new Redis(config[_0x679a('0x1b')]));require(_0x679a('0x1f'))[_0x679a('0x20')](socket);var jayson=require(_0x679a('0x21'));var client=jayson[_0x679a('0x22')][_0x679a('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x679a('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2a0a68,_0x52e2e0,_0x25bbe2,_0x58803a){return new BPromise(function(_0x25eeb5,_0x26987a){var _0x28e97f=_0x58803a||client;return _0x28e97f[_0x679a('0x24')](_0x2a0a68,_0x25bbe2)['then'](function(_0x5993c4){logger[_0x679a('0x25')](_0x679a('0x26'),_0x52e2e0,_0x679a('0x27'));logger[_0x679a('0x28')](_0x679a('0x29'),_0x52e2e0,_0x679a('0x27'),JSON[_0x679a('0x2a')](_0x5993c4));if(_0x5993c4[_0x679a('0x2b')]){if(_0x5993c4[_0x679a('0x2b')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x52e2e0,_0x5993c4['error'][_0x679a('0x2c')]);return _0x26987a(_0x5993c4[_0x679a('0x2b')][_0x679a('0x2c')]);}logger[_0x679a('0x2b')](_0x679a('0x26'),_0x52e2e0,_0x5993c4['error'][_0x679a('0x2c')]);return _0x25eeb5(_0x5993c4['error'][_0x679a('0x2c')]);}else{logger['info'](_0x679a('0x26'),_0x52e2e0,'request\x20sent');_0x25eeb5(_0x5993c4[_0x679a('0x2d')][_0x679a('0x2c')]);}})['catch'](function(_0x34aa2a){logger[_0x679a('0x2b')](_0x679a('0x26'),_0x52e2e0,_0x34aa2a);_0x26987a(_0x34aa2a);});});}function respondWithStatusCode(_0x2389dd,_0x54af51){_0x54af51=_0x54af51||0xcc;return function(_0x1bc55a){if(_0x1bc55a){return _0x2389dd[_0x679a('0x2e')](_0x54af51);}return _0x2389dd[_0x679a('0x2f')](_0x54af51)[_0x679a('0x30')]();};}function respondWithResult(_0x4001d6,_0x51b0e4){_0x51b0e4=_0x51b0e4||0xc8;return function(_0x6ccd88){if(_0x6ccd88){return _0x4001d6['status'](_0x51b0e4)[_0x679a('0x31')](_0x6ccd88);}};}function respondWithFilteredResult(_0x2acb23,_0x383595){return function(_0x3844af){if(_0x3844af){var _0x19e7d5=typeof _0x383595[_0x679a('0x32')]===_0x679a('0x33')&&typeof _0x383595['limit']===_0x679a('0x33');var _0x4ef7af=_0x3844af[_0x679a('0x34')];var _0x5e9cae=_0x19e7d5?0x0:_0x383595[_0x679a('0x32')];var _0x29c741=_0x19e7d5?_0x3844af[_0x679a('0x34')]:_0x383595[_0x679a('0x32')]+_0x383595[_0x679a('0x35')];var _0x200447;if(_0x29c741>=_0x4ef7af){_0x29c741=_0x4ef7af;_0x200447=0xc8;}else{_0x200447=0xce;}_0x2acb23[_0x679a('0x2f')](_0x200447);return _0x2acb23[_0x679a('0x36')](_0x679a('0x37'),_0x5e9cae+'-'+_0x29c741+'/'+_0x4ef7af)[_0x679a('0x31')](_0x3844af);}return null;};}function patchUpdates(_0x3b6848){return function(_0x2faf28){try{jsonpatch['apply'](_0x2faf28,_0x3b6848,!![]);}catch(_0x1a7558){return BPromise[_0x679a('0x38')](_0x1a7558);}return _0x2faf28[_0x679a('0x39')]();};}function saveUpdates(_0x573384,_0x74984c){return function(_0x50eefe){if(_0x50eefe){return _0x50eefe['update'](_0x573384)[_0x679a('0x3a')](function(_0x1cf3ce){return _0x1cf3ce;});}return null;};}function removeEntity(_0x233c9e,_0x41dde7){return function(_0x1183f6){if(_0x1183f6){return _0x1183f6['destroy']()[_0x679a('0x3a')](function(){_0x233c9e[_0x679a('0x2f')](0xcc)[_0x679a('0x30')]();});}};}function handleEntityNotFound(_0x2ae3ce,_0x492db8){return function(_0x496cf4){if(!_0x496cf4){_0x2ae3ce[_0x679a('0x2e')](0x194);}return _0x496cf4;};}function handleError(_0x575df6,_0x3b2579){_0x3b2579=_0x3b2579||0x1f4;return function(_0x4df385){logger['error'](_0x4df385['stack']);if(_0x4df385[_0x679a('0x3b')]){delete _0x4df385[_0x679a('0x3b')];}_0x575df6[_0x679a('0x2f')](_0x3b2579)[_0x679a('0x3c')](_0x4df385);};}function getMustacheRender(_0x39cf4b,_0xc02be2){return Mustache[_0x679a('0x3d')](_0x39cf4b,_[_0x679a('0x3e')](_0xc02be2['body'],{'contact':_0xc02be2[_0x679a('0x3f')],'message':_0xc02be2[_0x679a('0x2c')],'agent':_0xc02be2['agent'],'interaction':_0xc02be2[_0x679a('0x40')],'account':_0xc02be2['account']}))||'';}exports['index']=function(_0x1bb7bc,_0x1ed533){var _0x342c9d={},_0xa5306e={},_0x2f4c58={'count':0x0,'rows':[]};var _0x1c19cd=_[_0x679a('0x41')](db[_0x679a('0x42')][_0x679a('0x43')],function(_0x4fc670){return{'name':_0x4fc670[_0x679a('0x44')],'type':_0x4fc670['type'][_0x679a('0x45')]};});_0xa5306e['model']=_[_0x679a('0x41')](_0x1c19cd,_0x679a('0x3b'));_0xa5306e['query']=_[_0x679a('0x46')](_0x1bb7bc[_0x679a('0x47')]);_0xa5306e[_0x679a('0x48')]=_[_0x679a('0x49')](_0xa5306e[_0x679a('0x4a')],_0xa5306e[_0x679a('0x47')]);_0x342c9d['attributes']=_[_0x679a('0x49')](_0xa5306e['model'],qs['fields'](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x4b')]));_0x342c9d['attributes']=_0x342c9d[_0x679a('0x4c')][_0x679a('0x4d')]?_0x342c9d[_0x679a('0x4c')]:_0xa5306e['model'];if(!_0x1bb7bc[_0x679a('0x47')]['hasOwnProperty'](_0x679a('0x4e'))){_0x342c9d['limit']=qs[_0x679a('0x35')](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x35')]);_0x342c9d[_0x679a('0x32')]=qs[_0x679a('0x32')](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x32')]);}_0x342c9d[_0x679a('0x4f')]=qs[_0x679a('0x50')](_0x1bb7bc[_0x679a('0x47')][_0x679a('0x50')]);_0x342c9d[_0x679a('0x51')]=qs[_0x679a('0x48')](_[_0x679a('0x52')](_0x1bb7bc[_0x679a('0x47')],_0xa5306e[_0x679a('0x48')]),_0x1c19cd);if(_0x1bb7bc[_0x679a('0x47')][_0x679a('0x53')]){_0x342c9d[_0x679a('0x51')]=_[_0x679a('0x3e')](_0x342c9d[_0x679a('0x51')],{'$or':_['map'](_0x1c19cd,function(_0x483e9e){if(_0x483e9e['type']!==_0x679a('0x54')){var _0x3dd75d={};_0x3dd75d[_0x483e9e[_0x679a('0x3b')]]={'$like':'%'+_0x1bb7bc[_0x679a('0x47')]['filter']+'%'};return _0x3dd75d;}})});}_0x342c9d=_[_0x679a('0x3e')]({},_0x342c9d,_0x1bb7bc['options']);var _0x3594ea={'where':_0x342c9d[_0x679a('0x51')]};return db[_0x679a('0x42')][_0x679a('0x34')](_0x3594ea)[_0x679a('0x3a')](function(_0x5659f7){_0x2f4c58[_0x679a('0x34')]=_0x5659f7;if(_0x1bb7bc[_0x679a('0x47')][_0x679a('0x55')]){_0x342c9d['include']=[{'all':!![]}];}return db[_0x679a('0x42')]['findAll'](_0x342c9d);})[_0x679a('0x3a')](function(_0x27014b){_0x2f4c58[_0x679a('0x56')]=_0x27014b;return _0x2f4c58;})['then'](respondWithFilteredResult(_0x1ed533,_0x342c9d))[_0x679a('0x57')](handleError(_0x1ed533,null));};exports[_0x679a('0x58')]=function(_0x16c55d,_0x366ff0){var _0xae83db={'raw':!![],'where':{'id':_0x16c55d[_0x679a('0x59')]['id']}},_0x4387bf={};_0x4387bf[_0x679a('0x4a')]=_[_0x679a('0x46')](db['WhatsappMessage'][_0x679a('0x43')]);_0x4387bf[_0x679a('0x47')]=_[_0x679a('0x46')](_0x16c55d['query']);_0x4387bf['filters']=_[_0x679a('0x49')](_0x4387bf['model'],_0x4387bf['query']);_0xae83db[_0x679a('0x4c')]=_[_0x679a('0x49')](_0x4387bf[_0x679a('0x4a')],qs[_0x679a('0x4b')](_0x16c55d['query']['fields']));_0xae83db['attributes']=_0xae83db[_0x679a('0x4c')][_0x679a('0x4d')]?_0xae83db[_0x679a('0x4c')]:_0x4387bf[_0x679a('0x4a')];if(_0x16c55d[_0x679a('0x47')][_0x679a('0x55')]){_0xae83db['include']=[{'all':!![]}];}_0xae83db=_['merge']({},_0xae83db,_0x16c55d['options']);return db[_0x679a('0x42')]['find'](_0xae83db)[_0x679a('0x3a')](handleEntityNotFound(_0x366ff0,null))[_0x679a('0x3a')](respondWithResult(_0x366ff0,null))[_0x679a('0x57')](handleError(_0x366ff0,null));};exports[_0x679a('0x5a')]=function(_0x2212b9,_0x4d92f3){return db[_0x679a('0x42')][_0x679a('0x5a')](_0x2212b9['body'],{})[_0x679a('0x3a')](respondWithResult(_0x4d92f3,0xc9))['catch'](handleError(_0x4d92f3,null));};exports['update']=function(_0x1d2454,_0x1d872a){if(_0x1d2454[_0x679a('0x5b')]['id']){delete _0x1d2454[_0x679a('0x5b')]['id'];}return db[_0x679a('0x42')]['find']({'where':{'id':_0x1d2454['params']['id']}})['then'](handleEntityNotFound(_0x1d872a,null))[_0x679a('0x3a')](saveUpdates(_0x1d2454[_0x679a('0x5b')],null))[_0x679a('0x3a')](respondWithResult(_0x1d872a,null))[_0x679a('0x57')](handleError(_0x1d872a,null));};exports[_0x679a('0x5c')]=function(_0x34b4da,_0xd93021){return db[_0x679a('0x42')][_0x679a('0x5d')]({'where':{'id':_0x34b4da['params']['id']}})[_0x679a('0x3a')](handleEntityNotFound(_0xd93021,null))[_0x679a('0x3a')](removeEntity(_0xd93021,null))['catch'](handleError(_0xd93021,null));};exports[_0x679a('0x5e')]=function(_0x54495c,_0x3adacc){return db['WhatsappMessage']['describe']()[_0x679a('0x3a')](respondWithResult(_0x3adacc,null))[_0x679a('0x57')](handleError(_0x3adacc,null));};var interaction_log=require(_0x679a('0x16'))(_0x679a('0x5f'));exports['accept']=function(_0x382a96,_0x99da21,_0x215c9f){var _0x32461e={'agent':{},'channel':_0x679a('0x60')};if(_0x382a96[_0x679a('0x5b')]['id']){delete _0x382a96[_0x679a('0x5b')]['id'];}_0x382a96['body'][_0x679a('0x61')]=!![];_0x382a96[_0x679a('0x5b')][_0x679a('0x62')]=moment()['format'](_0x679a('0x63'));_0x382a96[_0x679a('0x5b')][_0x679a('0x64')]=_0x382a96['body'][_0x679a('0x64')]||_0x382a96[_0x679a('0x65')]['id'];_0x32461e[_0x679a('0x66')]['id']=_0x382a96[_0x679a('0x5b')][_0x679a('0x64')];return db[_0x679a('0x42')][_0x679a('0x5d')]({'where':{'id':_0x382a96[_0x679a('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x679a('0x67')],'as':_0x679a('0x68')}]})[_0x679a('0x3a')](handleEntityNotFound(_0x99da21,null))[_0x679a('0x3a')](saveUpdates(_0x382a96[_0x679a('0x5b')],null))[_0x679a('0x3a')](function(_0x2c9491){if(_0x2c9491){_0x32461e[_0x679a('0x2c')]=_0x2c9491['get']({'plain':!![]});return db[_0x679a('0x69')][_0x679a('0x5d')]({'where':{'id':_0x2c9491[_0x679a('0x6a')]}});}return null;})[_0x679a('0x3a')](handleEntityNotFound(_0x99da21,null))[_0x679a('0x3a')](function(_0x26c294){if(_0x26c294){return _0x26c294['update']({'UserId':_0x382a96[_0x679a('0x5b')][_0x679a('0x64')],'read1stAt':_['isNil'](_0x26c294['read1stAt'])?moment()['format'](_0x679a('0x63')):undefined});}return null;})[_0x679a('0x3a')](function(_0x32033d){if(_0x32033d){_0x32461e[_0x679a('0x40')]=_0x32033d[_0x679a('0x6b')]({'plain':!![]});interaction_log[_0x679a('0x25')](_0x679a('0x6c'),_0x382a96[_0x679a('0x65')]['id'],_0x382a96[_0x679a('0x65')]['name'],_0x382a96[_0x679a('0x65')][_0x679a('0x6d')],_0x32461e[_0x679a('0x40')]['id'],_0x382a96[_0x679a('0x5b')]?JSON[_0x679a('0x2a')](_0x382a96[_0x679a('0x5b')]):_0x679a('0x6e'));return respondWithRpcPromise(_0x679a('0x6f'),_0x679a('0x70'),_0x32461e);}return null;})[_0x679a('0x3a')](function(_0x5eb233){if(_0x5eb233){if(_0x382a96[_0x679a('0x5b')][_0x679a('0x71')]){_0x32461e[_0x679a('0x2c')][_0x679a('0x72')]=util[_0x679a('0x73')](_0x679a('0x74'),_0x382a96['user'][_0x679a('0x3b')]);_0x32461e[_0x679a('0x2c')][_0x679a('0x75')]=_0x32461e[_0x679a('0x75')];_0x32461e[_0x679a('0x2c')][_0x679a('0x76')]=_0x679a('0x77');return respondWithRpcPromise(_0x679a('0x78'),_0x679a('0x78'),{'event':'acceptmessage','message':_0x32461e['message']},client9002)[_0x679a('0x3a')](function(){return _0x32461e;});}return _0x32461e;}return null;})[_0x679a('0x3a')](respondWithResult(_0x99da21,null))[_0x679a('0x57')](handleError(_0x99da21,null));};var interaction_log=require(_0x679a('0x16'))(_0x679a('0x5f'));exports['reject']=function(_0x2a929a,_0x5c440f,_0x399f53){var _0x179862={'agent':{},'channel':_0x679a('0x60')};if(_0x2a929a[_0x679a('0x5b')]['id']){delete _0x2a929a['body']['id'];}_0x2a929a['body'][_0x679a('0x64')]=_0x2a929a[_0x679a('0x5b')][_0x679a('0x64')]||_0x2a929a['user']['id'];_0x179862[_0x679a('0x66')]['id']=_0x2a929a[_0x679a('0x5b')][_0x679a('0x64')];return db[_0x679a('0x42')]['find']({'where':{'id':_0x2a929a[_0x679a('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c440f,null))[_0x679a('0x3a')](function(_0x1d9c06){if(_0x1d9c06){_0x179862[_0x679a('0x2c')]=_0x1d9c06['get']({'plain':!![]});return db[_0x679a('0x69')]['find']({'where':{'id':_0x1d9c06[_0x679a('0x6a')]}});}return null;})[_0x679a('0x3a')](handleEntityNotFound(_0x5c440f,null))[_0x679a('0x3a')](function(_0x58dd37){if(_0x58dd37){_0x179862[_0x679a('0x40')]=_0x58dd37[_0x679a('0x6b')]({'plain':!![]});interaction_log[_0x679a('0x25')](_0x679a('0x79'),_0x2a929a[_0x679a('0x65')]['id'],_0x2a929a[_0x679a('0x65')][_0x679a('0x3b')],_0x2a929a['user'][_0x679a('0x6d')],_0x179862[_0x679a('0x40')]['id'],_0x2a929a[_0x679a('0x5b')]?JSON[_0x679a('0x2a')](_0x2a929a[_0x679a('0x5b')]):_0x679a('0x6e'));return respondWithRpcPromise(_0x679a('0x7a'),_0x679a('0x7b'),_0x179862);}return null;})[_0x679a('0x3a')](function(_0x12a77f){if(_0x12a77f){_0x12a77f[_0x679a('0x2c')][_0x679a('0x72')]=util[_0x679a('0x73')]('SIP/%s',_0x2a929a[_0x679a('0x65')][_0x679a('0x3b')]);_0x12a77f['message'][_0x679a('0x75')]=_0x179862[_0x679a('0x75')];_0x12a77f[_0x679a('0x2c')][_0x679a('0x76')]=_0x679a('0x38');respondWithRpcPromise(_0x679a('0x78'),_0x679a('0x78'),{'event':_0x679a('0x7c'),'message':_0x12a77f[_0x679a('0x2c')]},client9002);return _0x179862;}return null;})[_0x679a('0x3a')](respondWithResult(_0x5c440f,null))[_0x679a('0x57')](handleError(_0x5c440f,null));};exports[_0x679a('0x2f')]=function(_0x4d64fc,_0x156210,_0x7564be){if(_0x4d64fc['body']['id']){delete _0x4d64fc[_0x679a('0x5b')]['id'];}var _0x3a8602;return db['WhatsappMessage'][_0x679a('0x5d')]({'where':{'id':_0x4d64fc['params']['id']}})[_0x679a('0x3a')](handleEntityNotFound(_0x156210,null))['then'](function(_0x32d6d3){if(_0x32d6d3){_0x3a8602=_0x32d6d3;return db[_0x679a('0x7d')]['find']({'where':{'id':_0x32d6d3['WhatsappAccountId']}});}})[_0x679a('0x3a')](handleEntityNotFound(_0x156210,null))['then'](function(_0xff409c){if(_0xff409c){logger[_0x679a('0x28')](_0x679a('0x7e'),_0x679a('0x2f'),'received\x20delivery\x20report\x20from',_0xff409c[_0x679a('0x7f')],util[_0x679a('0x80')](_0x4d64fc[_0x679a('0x5b')],{'showHidden':![],'depth':null}));switch(_0xff409c[_0x679a('0x7f')]){case _0x679a('0x81'):if(_0x4d64fc[_0x679a('0x5b')][_0x679a('0x82')]&&_0x4d64fc[_0x679a('0x5b')][_0x679a('0x82')]===_0x3a8602[_0x679a('0x83')]&&_0x4d64fc[_0x679a('0x5b')]['MessageStatus']&&_0x4d64fc[_0x679a('0x5b')][_0x679a('0x84')]===_0x679a('0x61')){return _0x3a8602[_0x679a('0x85')]({'read':!![]});}else{logger['error'](_0x679a('0x86'),'status',_0x679a('0x81'),util['inspect'](_0x4d64fc['body'],{'showHidden':![],'depth':null}));}break;}return _0x3a8602;}})[_0x679a('0x3a')](respondWithResult(_0x156210,null))['catch'](handleError(_0x156210,null));}; \ No newline at end of file +var _0xdf69=['send','render','body','contact','interaction','account','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','rows','show','create','find','params','describe','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','role','manual','interface','format','SIP/%s','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','null','rejectMessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','result','catch','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf69,0x154));var _0x9df6=function(_0x5ac39d,_0x554c8f){_0x5ac39d=_0x5ac39d-0x0;var _0x431887=_0xdf69[_0x5ac39d];return _0x431887;};'use strict';var emlformat=require(_0x9df6('0x0'));var rimraf=require(_0x9df6('0x1'));var zipdir=require(_0x9df6('0x2'));var jsonpatch=require(_0x9df6('0x3'));var rp=require(_0x9df6('0x4'));var moment=require(_0x9df6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9df6('0x6'));var path=require(_0x9df6('0x7'));var sox=require(_0x9df6('0x8'));var csv=require(_0x9df6('0x9'));var ejs=require(_0x9df6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9df6('0xb'));var squel=require(_0x9df6('0xc'));var crypto=require(_0x9df6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9df6('0xe'));var toCsv=require(_0x9df6('0x9'));var querystring=require(_0x9df6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9df6('0x10'));var qs=require(_0x9df6('0x11'));var as=require(_0x9df6('0x12'));var hardwareService=require(_0x9df6('0x13'));var logger=require(_0x9df6('0x14'))(_0x9df6('0x15'));var utils=require('../../config/utils');var config=require(_0x9df6('0x16'));var licenseUtil=require(_0x9df6('0x17'));var db=require(_0x9df6('0x18'))['db'];config[_0x9df6('0x19')]=_['defaults'](config['redis'],{'host':_0x9df6('0x1a'),'port':0x18eb});var socket=require(_0x9df6('0x1b'))(new Redis(config['redis']));require(_0x9df6('0x1c'))['register'](socket);var jayson=require(_0x9df6('0x1d'));var client=jayson[_0x9df6('0x1e')][_0x9df6('0x1f')]({'port':0x232c});var client9002=jayson[_0x9df6('0x1e')][_0x9df6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e83b2,_0x54adc0,_0x4ded29,_0x33ab77){return new BPromise(function(_0x1c0089,_0x8ca998){var _0x3f6443=_0x33ab77||client;return _0x3f6443[_0x9df6('0x20')](_0x3e83b2,_0x4ded29)['then'](function(_0x40b3a5){logger[_0x9df6('0x21')](_0x9df6('0x22'),_0x54adc0,'request\x20sent');logger[_0x9df6('0x23')](_0x9df6('0x24'),_0x54adc0,_0x9df6('0x25'),JSON[_0x9df6('0x26')](_0x40b3a5));if(_0x40b3a5['error']){if(_0x40b3a5['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x54adc0,_0x40b3a5['error'][_0x9df6('0x27')]);return _0x8ca998(_0x40b3a5['error'][_0x9df6('0x27')]);}logger[_0x9df6('0x28')](_0x9df6('0x22'),_0x54adc0,_0x40b3a5[_0x9df6('0x28')][_0x9df6('0x27')]);return _0x1c0089(_0x40b3a5['error'][_0x9df6('0x27')]);}else{logger[_0x9df6('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x54adc0,_0x9df6('0x25'));_0x1c0089(_0x40b3a5[_0x9df6('0x29')][_0x9df6('0x27')]);}})[_0x9df6('0x2a')](function(_0xecbdd7){logger[_0x9df6('0x28')](_0x9df6('0x22'),_0x54adc0,_0xecbdd7);_0x8ca998(_0xecbdd7);});});}function respondWithStatusCode(_0x4b3d26,_0x11819c){_0x11819c=_0x11819c||0xcc;return function(_0x5ebd0d){if(_0x5ebd0d){return _0x4b3d26['sendStatus'](_0x11819c);}return _0x4b3d26[_0x9df6('0x2b')](_0x11819c)['end']();};}function respondWithResult(_0x11ea3a,_0xf9b6d2){_0xf9b6d2=_0xf9b6d2||0xc8;return function(_0x33ca89){if(_0x33ca89){return _0x11ea3a['status'](_0xf9b6d2)[_0x9df6('0x2c')](_0x33ca89);}};}function respondWithFilteredResult(_0x542660,_0x5cb0a5){return function(_0x1a0e05){if(_0x1a0e05){var _0xf8881a=typeof _0x5cb0a5[_0x9df6('0x2d')]===_0x9df6('0x2e')&&typeof _0x5cb0a5['limit']===_0x9df6('0x2e');var _0x5c48ad=_0x1a0e05[_0x9df6('0x2f')];var _0x197efb=_0xf8881a?0x0:_0x5cb0a5[_0x9df6('0x2d')];var _0x3e6183=_0xf8881a?_0x1a0e05['count']:_0x5cb0a5[_0x9df6('0x2d')]+_0x5cb0a5['limit'];var _0x4ad504;if(_0x3e6183>=_0x5c48ad){_0x3e6183=_0x5c48ad;_0x4ad504=0xc8;}else{_0x4ad504=0xce;}_0x542660['status'](_0x4ad504);return _0x542660[_0x9df6('0x30')](_0x9df6('0x31'),_0x197efb+'-'+_0x3e6183+'/'+_0x5c48ad)[_0x9df6('0x2c')](_0x1a0e05);}return null;};}function patchUpdates(_0x4536a4){return function(_0x4c6afd){try{jsonpatch[_0x9df6('0x32')](_0x4c6afd,_0x4536a4,!![]);}catch(_0x44dcb8){return BPromise[_0x9df6('0x33')](_0x44dcb8);}return _0x4c6afd[_0x9df6('0x34')]();};}function saveUpdates(_0x288ada,_0x20e9ba){return function(_0x462e26){if(_0x462e26){return _0x462e26[_0x9df6('0x35')](_0x288ada)[_0x9df6('0x36')](function(_0xb26aea){return _0xb26aea;});}return null;};}function removeEntity(_0x3381fb,_0x3a86e1){return function(_0x3a0431){if(_0x3a0431){return _0x3a0431[_0x9df6('0x37')]()['then'](function(){_0x3381fb[_0x9df6('0x2b')](0xcc)[_0x9df6('0x38')]();});}};}function handleEntityNotFound(_0x402638,_0x6f3de4){return function(_0x2c2e17){if(!_0x2c2e17){_0x402638[_0x9df6('0x39')](0x194);}return _0x2c2e17;};}function handleError(_0x4c2b94,_0x3a3f2e){_0x3a3f2e=_0x3a3f2e||0x1f4;return function(_0x56d134){logger['error'](_0x56d134['stack']);if(_0x56d134[_0x9df6('0x3a')]){delete _0x56d134[_0x9df6('0x3a')];}_0x4c2b94[_0x9df6('0x2b')](_0x3a3f2e)[_0x9df6('0x3b')](_0x56d134);};}function getMustacheRender(_0x2a3154,_0x711564){return Mustache[_0x9df6('0x3c')](_0x2a3154,_['merge'](_0x711564[_0x9df6('0x3d')],{'contact':_0x711564[_0x9df6('0x3e')],'message':_0x711564['message'],'agent':_0x711564['agent'],'interaction':_0x711564[_0x9df6('0x3f')],'account':_0x711564[_0x9df6('0x40')]}))||'';}exports[_0x9df6('0x41')]=function(_0x2c9858,_0x3a9f31){var _0x4a8d5a={},_0x54de48={},_0x16206b={'count':0x0,'rows':[]};var _0x40ce31=_[_0x9df6('0x42')](db['WhatsappMessage'][_0x9df6('0x43')],function(_0x150f2a){return{'name':_0x150f2a[_0x9df6('0x44')],'type':_0x150f2a[_0x9df6('0x45')][_0x9df6('0x46')]};});_0x54de48[_0x9df6('0x47')]=_[_0x9df6('0x42')](_0x40ce31,'name');_0x54de48['query']=_[_0x9df6('0x48')](_0x2c9858[_0x9df6('0x49')]);_0x54de48['filters']=_['intersection'](_0x54de48[_0x9df6('0x47')],_0x54de48[_0x9df6('0x49')]);_0x4a8d5a['attributes']=_[_0x9df6('0x4a')](_0x54de48[_0x9df6('0x47')],qs['fields'](_0x2c9858[_0x9df6('0x49')][_0x9df6('0x4b')]));_0x4a8d5a[_0x9df6('0x4c')]=_0x4a8d5a[_0x9df6('0x4c')][_0x9df6('0x4d')]?_0x4a8d5a[_0x9df6('0x4c')]:_0x54de48[_0x9df6('0x47')];if(!_0x2c9858[_0x9df6('0x49')][_0x9df6('0x4e')]('nolimit')){_0x4a8d5a['limit']=qs[_0x9df6('0x4f')](_0x2c9858['query']['limit']);_0x4a8d5a['offset']=qs[_0x9df6('0x2d')](_0x2c9858['query'][_0x9df6('0x2d')]);}_0x4a8d5a[_0x9df6('0x50')]=qs[_0x9df6('0x51')](_0x2c9858[_0x9df6('0x49')][_0x9df6('0x51')]);_0x4a8d5a[_0x9df6('0x52')]=qs['filters'](_[_0x9df6('0x53')](_0x2c9858[_0x9df6('0x49')],_0x54de48[_0x9df6('0x54')]),_0x40ce31);if(_0x2c9858[_0x9df6('0x49')][_0x9df6('0x55')]){_0x4a8d5a[_0x9df6('0x52')]=_[_0x9df6('0x56')](_0x4a8d5a[_0x9df6('0x52')],{'$or':_[_0x9df6('0x42')](_0x40ce31,function(_0x20cc51){if(_0x20cc51[_0x9df6('0x45')]!==_0x9df6('0x57')){var _0x138c77={};_0x138c77[_0x20cc51[_0x9df6('0x3a')]]={'$like':'%'+_0x2c9858[_0x9df6('0x49')][_0x9df6('0x55')]+'%'};return _0x138c77;}})});}_0x4a8d5a=_['merge']({},_0x4a8d5a,_0x2c9858[_0x9df6('0x58')]);var _0x5370fb={'where':_0x4a8d5a[_0x9df6('0x52')]};return db[_0x9df6('0x59')][_0x9df6('0x2f')](_0x5370fb)[_0x9df6('0x36')](function(_0x5aa320){_0x16206b[_0x9df6('0x2f')]=_0x5aa320;if(_0x2c9858['query'][_0x9df6('0x5a')]){_0x4a8d5a[_0x9df6('0x5b')]=[{'all':!![]}];}return db[_0x9df6('0x59')]['findAll'](_0x4a8d5a);})[_0x9df6('0x36')](function(_0x1aed70){_0x16206b[_0x9df6('0x5c')]=_0x1aed70;return _0x16206b;})[_0x9df6('0x36')](respondWithFilteredResult(_0x3a9f31,_0x4a8d5a))[_0x9df6('0x2a')](handleError(_0x3a9f31,null));};exports[_0x9df6('0x5d')]=function(_0x49c40e,_0x2065f9){var _0x113d81={'raw':!![],'where':{'id':_0x49c40e['params']['id']}},_0x4d6410={};_0x4d6410[_0x9df6('0x47')]=_[_0x9df6('0x48')](db[_0x9df6('0x59')][_0x9df6('0x43')]);_0x4d6410[_0x9df6('0x49')]=_[_0x9df6('0x48')](_0x49c40e[_0x9df6('0x49')]);_0x4d6410['filters']=_[_0x9df6('0x4a')](_0x4d6410[_0x9df6('0x47')],_0x4d6410['query']);_0x113d81[_0x9df6('0x4c')]=_['intersection'](_0x4d6410['model'],qs[_0x9df6('0x4b')](_0x49c40e[_0x9df6('0x49')][_0x9df6('0x4b')]));_0x113d81['attributes']=_0x113d81[_0x9df6('0x4c')][_0x9df6('0x4d')]?_0x113d81[_0x9df6('0x4c')]:_0x4d6410[_0x9df6('0x47')];if(_0x49c40e[_0x9df6('0x49')][_0x9df6('0x5a')]){_0x113d81[_0x9df6('0x5b')]=[{'all':!![]}];}_0x113d81=_[_0x9df6('0x56')]({},_0x113d81,_0x49c40e[_0x9df6('0x58')]);return db[_0x9df6('0x59')]['find'](_0x113d81)[_0x9df6('0x36')](handleEntityNotFound(_0x2065f9,null))[_0x9df6('0x36')](respondWithResult(_0x2065f9,null))['catch'](handleError(_0x2065f9,null));};exports[_0x9df6('0x5e')]=function(_0x4082fe,_0xe999d0){return db[_0x9df6('0x59')][_0x9df6('0x5e')](_0x4082fe[_0x9df6('0x3d')],{})['then'](respondWithResult(_0xe999d0,0xc9))[_0x9df6('0x2a')](handleError(_0xe999d0,null));};exports[_0x9df6('0x35')]=function(_0x37c749,_0x1b8709){if(_0x37c749['body']['id']){delete _0x37c749[_0x9df6('0x3d')]['id'];}return db[_0x9df6('0x59')][_0x9df6('0x5f')]({'where':{'id':_0x37c749[_0x9df6('0x60')]['id']}})[_0x9df6('0x36')](handleEntityNotFound(_0x1b8709,null))[_0x9df6('0x36')](saveUpdates(_0x37c749[_0x9df6('0x3d')],null))[_0x9df6('0x36')](respondWithResult(_0x1b8709,null))[_0x9df6('0x2a')](handleError(_0x1b8709,null));};exports['destroy']=function(_0x411e48,_0x11e3ef){return db['WhatsappMessage'][_0x9df6('0x5f')]({'where':{'id':_0x411e48[_0x9df6('0x60')]['id']}})[_0x9df6('0x36')](handleEntityNotFound(_0x11e3ef,null))[_0x9df6('0x36')](removeEntity(_0x11e3ef,null))[_0x9df6('0x2a')](handleError(_0x11e3ef,null));};exports[_0x9df6('0x61')]=function(_0x47c508,_0x408f29){return db['WhatsappMessage'][_0x9df6('0x61')]()['then'](respondWithResult(_0x408f29,null))[_0x9df6('0x2a')](handleError(_0x408f29,null));};var interaction_log=require(_0x9df6('0x14'))('whatsapp-interactions');exports['accept']=function(_0x30b64e,_0xf5300f,_0x2604fb){var _0x5c243c={'agent':{},'channel':_0x9df6('0x62')};if(_0x30b64e[_0x9df6('0x3d')]['id']){delete _0x30b64e[_0x9df6('0x3d')]['id'];}_0x30b64e[_0x9df6('0x3d')][_0x9df6('0x63')]=!![];_0x30b64e[_0x9df6('0x3d')]['readAt']=moment()['format'](_0x9df6('0x64'));_0x30b64e[_0x9df6('0x3d')]['UserId']=_0x30b64e[_0x9df6('0x3d')][_0x9df6('0x65')]||_0x30b64e[_0x9df6('0x66')]['id'];_0x5c243c[_0x9df6('0x67')]['id']=_0x30b64e[_0x9df6('0x3d')][_0x9df6('0x65')];return db[_0x9df6('0x59')]['find']({'where':{'id':_0x30b64e[_0x9df6('0x60')]['id'],'UserId':null},'include':[{'model':db[_0x9df6('0x68')],'as':_0x9df6('0x69')}]})[_0x9df6('0x36')](handleEntityNotFound(_0xf5300f,null))[_0x9df6('0x36')](saveUpdates(_0x30b64e['body'],null))[_0x9df6('0x36')](function(_0x3311fb){if(_0x3311fb){_0x5c243c['message']=_0x3311fb[_0x9df6('0x6a')]({'plain':!![]});return db[_0x9df6('0x6b')][_0x9df6('0x5f')]({'where':{'id':_0x3311fb[_0x9df6('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0xf5300f,null))[_0x9df6('0x36')](function(_0x2b5033){if(_0x2b5033){return _0x2b5033[_0x9df6('0x35')]({'UserId':_0x30b64e['body'][_0x9df6('0x65')],'read1stAt':_[_0x9df6('0x6d')](_0x2b5033[_0x9df6('0x6e')])?moment()['format'](_0x9df6('0x64')):undefined});}return null;})[_0x9df6('0x36')](function(_0x3392e1){if(_0x3392e1){_0x5c243c[_0x9df6('0x3f')]=_0x3392e1[_0x9df6('0x6a')]({'plain':!![]});interaction_log[_0x9df6('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30b64e[_0x9df6('0x66')]['id'],_0x30b64e['user'][_0x9df6('0x3a')],_0x30b64e[_0x9df6('0x66')][_0x9df6('0x6f')],_0x5c243c[_0x9df6('0x3f')]['id'],_0x30b64e[_0x9df6('0x3d')]?JSON[_0x9df6('0x26')](_0x30b64e[_0x9df6('0x3d')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5c243c);}return null;})[_0x9df6('0x36')](function(_0x5e6d63){if(_0x5e6d63){if(_0x30b64e[_0x9df6('0x3d')][_0x9df6('0x70')]){_0x5c243c[_0x9df6('0x27')][_0x9df6('0x71')]=util[_0x9df6('0x72')](_0x9df6('0x73'),_0x30b64e[_0x9df6('0x66')][_0x9df6('0x3a')]);_0x5c243c[_0x9df6('0x27')]['channel']=_0x5c243c[_0x9df6('0x74')];_0x5c243c[_0x9df6('0x27')][_0x9df6('0x75')]=_0x9df6('0x76');return respondWithRpcPromise('EventManager',_0x9df6('0x77'),{'event':_0x9df6('0x78'),'message':_0x5c243c[_0x9df6('0x27')]},client9002)[_0x9df6('0x36')](function(){return _0x5c243c;});}return _0x5c243c;}return null;})[_0x9df6('0x36')](respondWithResult(_0xf5300f,null))['catch'](handleError(_0xf5300f,null));};var interaction_log=require('../../config/logger')(_0x9df6('0x79'));exports[_0x9df6('0x33')]=function(_0x169337,_0x3beed6,_0x298f43){var _0x3ea95={'agent':{},'channel':_0x9df6('0x62')};if(_0x169337[_0x9df6('0x3d')]['id']){delete _0x169337[_0x9df6('0x3d')]['id'];}_0x169337[_0x9df6('0x3d')][_0x9df6('0x65')]=_0x169337[_0x9df6('0x3d')]['UserId']||_0x169337[_0x9df6('0x66')]['id'];_0x3ea95[_0x9df6('0x67')]['id']=_0x169337[_0x9df6('0x3d')][_0x9df6('0x65')];return db[_0x9df6('0x59')][_0x9df6('0x5f')]({'where':{'id':_0x169337['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3beed6,null))['then'](function(_0x255360){if(_0x255360){_0x3ea95[_0x9df6('0x27')]=_0x255360[_0x9df6('0x6a')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x255360[_0x9df6('0x6c')]}});}return null;})[_0x9df6('0x36')](handleEntityNotFound(_0x3beed6,null))['then'](function(_0x340d50){if(_0x340d50){_0x3ea95[_0x9df6('0x3f')]=_0x340d50[_0x9df6('0x6a')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x169337['user']['id'],_0x169337['user'][_0x9df6('0x3a')],_0x169337['user'][_0x9df6('0x6f')],_0x3ea95[_0x9df6('0x3f')]['id'],_0x169337[_0x9df6('0x3d')]?JSON['stringify'](_0x169337['body']):_0x9df6('0x7a'));return respondWithRpcPromise('RejectMessage',_0x9df6('0x7b'),_0x3ea95);}return null;})[_0x9df6('0x36')](function(_0x106dfc){if(_0x106dfc){_0x106dfc['message'][_0x9df6('0x71')]=util[_0x9df6('0x72')]('SIP/%s',_0x169337[_0x9df6('0x66')][_0x9df6('0x3a')]);_0x106dfc['message'][_0x9df6('0x74')]=_0x3ea95[_0x9df6('0x74')];_0x106dfc[_0x9df6('0x27')][_0x9df6('0x75')]=_0x9df6('0x33');respondWithRpcPromise('EventManager',_0x9df6('0x77'),{'event':'rejectmessage','message':_0x106dfc[_0x9df6('0x27')]},client9002);return _0x3ea95;}return null;})[_0x9df6('0x36')](respondWithResult(_0x3beed6,null))[_0x9df6('0x2a')](handleError(_0x3beed6,null));};exports[_0x9df6('0x2b')]=function(_0x19ddd8,_0x133b1a,_0x4370cc){if(_0x19ddd8['body']['id']){delete _0x19ddd8['body']['id'];}var _0xd50e9c;return db[_0x9df6('0x59')][_0x9df6('0x5f')]({'where':{'id':_0x19ddd8[_0x9df6('0x60')]['id']}})[_0x9df6('0x36')](handleEntityNotFound(_0x133b1a,null))[_0x9df6('0x36')](function(_0x498e24){if(_0x498e24){_0xd50e9c=_0x498e24;return db[_0x9df6('0x7c')][_0x9df6('0x5f')]({'where':{'id':_0x498e24[_0x9df6('0x7d')]}});}})[_0x9df6('0x36')](handleEntityNotFound(_0x133b1a,null))[_0x9df6('0x36')](function(_0x11f6b7){if(_0x11f6b7){logger[_0x9df6('0x23')](_0x9df6('0x7e'),_0x9df6('0x2b'),_0x9df6('0x7f'),_0x11f6b7[_0x9df6('0x45')],util[_0x9df6('0x80')](_0x19ddd8[_0x9df6('0x3d')],{'showHidden':![],'depth':null}));switch(_0x11f6b7[_0x9df6('0x45')]){case _0x9df6('0x81'):if(_0x19ddd8[_0x9df6('0x3d')][_0x9df6('0x82')]&&_0x19ddd8[_0x9df6('0x3d')][_0x9df6('0x82')]===_0xd50e9c['messageId']&&_0x19ddd8['body'][_0x9df6('0x83')]&&_0x19ddd8[_0x9df6('0x3d')][_0x9df6('0x83')]==='read'){return _0xd50e9c[_0x9df6('0x35')]({'read':!![]});}else{logger[_0x9df6('0x28')](_0x9df6('0x84'),_0x9df6('0x2b'),_0x9df6('0x81'),util[_0x9df6('0x80')](_0x19ddd8['body'],{'showHidden':![],'depth':null}));}break;}return _0xd50e9c;}})[_0x9df6('0x36')](respondWithResult(_0x133b1a,null))[_0x9df6('0x2a')](handleError(_0x133b1a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9d240d4..942d512 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4acf22,_0x1fbfd3){var _0x4fc728=function(_0x10e3e8){while(--_0x10e3e8){_0x4acf22['push'](_0x4acf22['shift']());}};_0x4fc728(++_0x1fbfd3);}(_0x7a54,0x106));var _0x47a5=function(_0x3308e6,_0x5e8cfd){_0x3308e6=_0x3308e6-0x0;var _0x10135e=_0x7a54[_0x3308e6];return _0x10135e;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x44eaa1,_0x161863){var _0x4d0918=function(_0x248a01){while(--_0x248a01){_0x44eaa1['push'](_0x44eaa1['shift']());}};_0x4d0918(++_0x161863);}(_0x5f2f,0x73));var _0xf5f2=function(_0x566006,_0x2d2ef1){_0x566006=_0x566006-0x0;var _0x3bc1d2=_0x5f2f[_0x566006];return _0x3bc1d2;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0d7e499..0c70696 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2deb=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','token','then','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','finally','lodash'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))(_0xb2de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2de('0x4'));var fs=require('fs');var path=require(_0xb2de('0x5'));var rimraf=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x201fcc,_0x2ed8ec){return _0x201fcc[_0xb2de('0x8')]('WhatsappMessage',attributes,{'tableName':_0xb2de('0x9'),'paranoid':![],'indexes':[{'name':_0xb2de('0xa'),'fields':['messageId']},{'name':_0xb2de('0xb'),'fields':[_0xb2de('0xc')],'type':_0xb2de('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x523fa4,_0x4490ea,_0x2e38d8){var _0x2b4e96=_0x201fcc[_0xb2de('0xe')];var _0x5dc248=_0x523fa4['get']({'plain':!![]});if(_0x5dc248[_0xb2de('0xf')][_0xb2de('0x10')]()==='in'||_0x5dc248[_0xb2de('0xf')]['toLowerCase']()===_0xb2de('0x11')&&!_0x5dc248[_0xb2de('0x12')]&&!_[_0xb2de('0x13')](_0x5dc248['UserId'])){_0x2b4e96[_0xb2de('0x14')]['findOne']({'where':{'id':_0x5dc248[_0xb2de('0x15')]}})['then'](function(_0x10ef21){if(_0x10ef21){_0x10ef21[_0xb2de('0x16')]({'lastMsgAt':_0x5dc248[_0xb2de('0x17')],'lastMsgDirection':_0x5dc248['direction'][_0xb2de('0x10')]()});}})[_0xb2de('0x18')](function(_0x2dc98f){console[_0xb2de('0x19')](_0x2dc98f);});}if(_0x5dc248[_0xb2de('0xf')]===_0xb2de('0x11')&&!_0x5dc248[_0xb2de('0x12')]){var _0x2db287;_0x2b4e96[_0xb2de('0x1a')]['find']({'where':{'id':_0x5dc248[_0xb2de('0x1b')]},'raw':!![]})['then'](function(_0x405e5d){_0x2db287=_0x405e5d;if(_0x2db287&&_0x2db287[_0xb2de('0x1c')]){switch(_0x2db287['type']){case _0xb2de('0x1d'):var _0x337bfe=require('twilio');if(_0x2db287[_0xb2de('0x1e')]&&_0x2db287[_0xb2de('0x1f')]&&_0x2db287[_0xb2de('0x20')]){var _0x148c91=new _0x337bfe(_0x2db287[_0xb2de('0x1e')],_0x2db287[_0xb2de('0x1f')]);_0x148c91[_0xb2de('0x21')][_0xb2de('0x22')]({'body':_0x5dc248[_0xb2de('0xc')],'to':'whatsapp:'+_0x5dc248[_0xb2de('0x20')],'from':_0xb2de('0x23')+_0x2db287[_0xb2de('0x20')],'statusCallback':_0x2db287[_0xb2de('0x24')]+'/api/whatsapp/messages/'+_0x5dc248['id']+'/status?token='+_0x2db287[_0xb2de('0x25')]})[_0xb2de('0x26')](function(_0x3d9ece){if(_0x3d9ece['sid']){return _0x523fa4[_0xb2de('0x16')]({'messageId':_0x3d9ece[_0xb2de('0x27')]});}})['catch'](function(_0x16c249){logger['error'](_0xb2de('0x28'),_0xb2de('0x29'),_0xb2de('0x1d'),util[_0xb2de('0x2a')](_0x16c249,{'showHidden':![],'depth':null}));});}else{logger[_0xb2de('0x19')](_0xb2de('0x28'),'afterCreate',_0xb2de('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xb2de('0x2b')](function(){_0x2e38d8();});}else{_0x2e38d8();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0120=['/api/whatsapp/messages/','/status?token=','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','secret','WhatsappInteractionId','update','catch','out','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x0120,0x6f));var _0x0012=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0120[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'paranoid':![],'indexes':[{'name':_0x0012('0xe'),'fields':[_0x0012('0xe')]},{'name':_0x0012('0xf'),'fields':['body'],'type':_0x0012('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d484c,_0x1dc1b2,_0x323282){var _0x520171=_0x4eaa5b[_0x0012('0x11')];var _0x4b2068=_0x2d484c[_0x0012('0x12')]({'plain':!![]});if(_0x4b2068[_0x0012('0x13')][_0x0012('0x14')]()==='in'||_0x4b2068[_0x0012('0x13')][_0x0012('0x14')]()==='out'&&!_0x4b2068[_0x0012('0x15')]&&!_['isNil'](_0x4b2068['UserId'])){_0x520171['WhatsappInteraction']['findOne']({'where':{'id':_0x4b2068[_0x0012('0x16')]}})['then'](function(_0x3995fd){if(_0x3995fd){_0x3995fd[_0x0012('0x17')]({'lastMsgAt':_0x4b2068['createdAt'],'lastMsgDirection':_0x4b2068[_0x0012('0x13')][_0x0012('0x14')]()});}})[_0x0012('0x18')](function(_0x3b8dfc){console['error'](_0x3b8dfc);});}if(_0x4b2068['direction']===_0x0012('0x19')&&!_0x4b2068[_0x0012('0x15')]){var _0x3948bf;_0x520171[_0x0012('0x1a')][_0x0012('0x1b')]({'where':{'id':_0x4b2068[_0x0012('0x1c')]},'raw':!![]})[_0x0012('0x1d')](function(_0x2eb3fa){_0x3948bf=_0x2eb3fa;if(_0x3948bf&&_0x3948bf['type']){switch(_0x3948bf[_0x0012('0x1e')]){case _0x0012('0x1f'):var _0x5797dd=require(_0x0012('0x1f'));if(_0x3948bf[_0x0012('0x20')]&&_0x3948bf[_0x0012('0x21')]&&_0x3948bf[_0x0012('0x22')]){var _0x53ac2d=new _0x5797dd(_0x3948bf['accountSid'],_0x3948bf[_0x0012('0x21')]);_0x53ac2d[_0x0012('0x23')][_0x0012('0x24')]({'body':_0x4b2068[_0x0012('0x25')],'to':_0x0012('0x26')+_0x4b2068[_0x0012('0x22')],'from':_0x0012('0x26')+_0x3948bf[_0x0012('0x22')],'statusCallback':_0x3948bf['remote']+_0x0012('0x27')+_0x4b2068['id']+_0x0012('0x28')+_0x3948bf['token']})[_0x0012('0x1d')](function(_0x13a78e){if(_0x13a78e[_0x0012('0x29')]){return _0x2d484c[_0x0012('0x17')]({'messageId':_0x13a78e[_0x0012('0x29')]});}})['catch'](function(_0x351ffd){logger[_0x0012('0x2a')](_0x0012('0x2b'),_0x0012('0x2c'),_0x0012('0x1f'),util[_0x0012('0x2d')](_0x351ffd,{'showHidden':![],'depth':null}));});}else{logger[_0x0012('0x2a')](_0x0012('0x2b'),_0x0012('0x2c'),_0x0012('0x1f'),_0x0012('0x2e'));}break;}}})[_0x0012('0x2f')](function(){_0x323282();});}else{_0x323282();}}},'charset':_0x0012('0x30'),'collate':_0x0012('0x31')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1e4b909..0bd3f9e 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe88=['randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','util','moment','bluebird'];(function(_0x48b952,_0x5239ea){var _0x5df39f=function(_0x3cc6fb){while(--_0x3cc6fb){_0x48b952['push'](_0x48b952['shift']());}};_0x5df39f(++_0x5239ea);}(_0xbe88,0x190));var _0x8be8=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xbe88[_0x1c34e7];return _0x378cb1;};'use strict';var _=require('lodash');var util=require(_0x8be8('0x0'));var moment=require(_0x8be8('0x1'));var BPromise=require(_0x8be8('0x2'));var rs=require(_0x8be8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8be8('0x4'))('rpc');var config=require(_0x8be8('0x5'));var jayson=require(_0x8be8('0x6'));var client=jayson[_0x8be8('0x7')][_0x8be8('0x8')]({'port':0x232a});config[_0x8be8('0x9')]=_[_0x8be8('0xa')](config[_0x8be8('0x9')],{'host':_0x8be8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8be8('0xc'))[_0x8be8('0xd')](socket);function respondWithRpcPromise(_0x165281,_0x592c08,_0x3a95aa){return new BPromise(function(_0x4f80bf,_0x3ae067){return client[_0x8be8('0xe')](_0x165281,_0x3a95aa)[_0x8be8('0xf')](function(_0x4bd450){logger[_0x8be8('0x10')](_0x8be8('0x11'),_0x592c08,_0x8be8('0x12'));logger[_0x8be8('0x13')](_0x8be8('0x14'),_0x592c08,'request\x20sent',JSON[_0x8be8('0x15')](_0x4bd450));if(_0x4bd450[_0x8be8('0x16')]){if(_0x4bd450['error']['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x592c08,_0x4bd450[_0x8be8('0x16')][_0x8be8('0x17')]);return _0x3ae067(_0x4bd450['error'][_0x8be8('0x17')]);}logger[_0x8be8('0x16')](_0x8be8('0x11'),_0x592c08,_0x4bd450[_0x8be8('0x16')][_0x8be8('0x17')]);return _0x4f80bf(_0x4bd450[_0x8be8('0x16')][_0x8be8('0x17')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x592c08,_0x8be8('0x12'));_0x4f80bf(_0x4bd450[_0x8be8('0x18')][_0x8be8('0x17')]);}})[_0x8be8('0x19')](function(_0x4f2990){logger[_0x8be8('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x592c08,_0x4f2990);_0x3ae067(_0x4f2990);});});}exports[_0x8be8('0x1a')]=function(_0x4b949e){var _0x39a59d=this;return new Promise(function(_0x5e5ce9,_0x470eb4){return db[_0x8be8('0x1b')][_0x8be8('0x1c')](_0x4b949e['body'],{'raw':_0x4b949e[_0x8be8('0x1d')]?_0x4b949e[_0x8be8('0x1d')][_0x8be8('0x1e')]===undefined?!![]:![]:!![]})[_0x8be8('0xf')](function(_0x4f3d2e){logger[_0x8be8('0x10')](_0x8be8('0x1a'),_0x4b949e);logger[_0x8be8('0x13')]('CreateWhatsappMessage',_0x4b949e,JSON[_0x8be8('0x15')](_0x4f3d2e));_0x5e5ce9(_0x4f3d2e);})['catch'](function(_0x190d3e){logger[_0x8be8('0x16')](_0x8be8('0x1a'),_0x190d3e[_0x8be8('0x17')],_0x4b949e);_0x470eb4(_0x39a59d[_0x8be8('0x16')](0x1f4,_0x190d3e[_0x8be8('0x17')]));});});}; \ No newline at end of file +var _0xbddc=['rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2627ba,_0x49cfe0){var _0xc8b67a=function(_0x4c3d4f){while(--_0x4c3d4f){_0x2627ba['push'](_0x2627ba['shift']());}};_0xc8b67a(++_0x49cfe0);}(_0xbddc,0x1bc));var _0xcbdd=function(_0x5c7bd8,_0x25d723){_0x5c7bd8=_0x5c7bd8-0x0;var _0x175ac0=_0xbddc[_0x5c7bd8];return _0x175ac0;};'use strict';var _=require(_0xcbdd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbdd('0x1'));var rs=require(_0xcbdd('0x2'));var fs=require('fs');var Redis=require(_0xcbdd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbdd('0x4'));var logger=require(_0xcbdd('0x5'))(_0xcbdd('0x6'));var config=require(_0xcbdd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcbdd('0x8')]['http']({'port':0x232a});config['redis']=_[_0xcbdd('0x9')](config[_0xcbdd('0xa')],{'host':_0xcbdd('0xb'),'port':0x18eb});var socket=require(_0xcbdd('0xc'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xcbdd('0xd')](socket);function respondWithRpcPromise(_0x28be10,_0x5eaa3d,_0x5452c4){return new BPromise(function(_0x174633,_0x1dd9f4){return client['request'](_0x28be10,_0x5452c4)[_0xcbdd('0xe')](function(_0x1c67dd){logger[_0xcbdd('0xf')](_0xcbdd('0x10'),_0x5eaa3d,_0xcbdd('0x11'));logger[_0xcbdd('0x12')](_0xcbdd('0x13'),_0x5eaa3d,_0xcbdd('0x11'),JSON['stringify'](_0x1c67dd));if(_0x1c67dd[_0xcbdd('0x14')]){if(_0x1c67dd[_0xcbdd('0x14')][_0xcbdd('0x15')]===0x1f4){logger[_0xcbdd('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x5eaa3d,_0x1c67dd['error'][_0xcbdd('0x16')]);return _0x1dd9f4(_0x1c67dd[_0xcbdd('0x14')][_0xcbdd('0x16')]);}logger['error'](_0xcbdd('0x10'),_0x5eaa3d,_0x1c67dd['error']['message']);return _0x174633(_0x1c67dd[_0xcbdd('0x14')][_0xcbdd('0x16')]);}else{logger['info'](_0xcbdd('0x10'),_0x5eaa3d,_0xcbdd('0x11'));_0x174633(_0x1c67dd[_0xcbdd('0x17')]['message']);}})['catch'](function(_0x25fc2e){logger[_0xcbdd('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x5eaa3d,_0x25fc2e);_0x1dd9f4(_0x25fc2e);});});}exports[_0xcbdd('0x18')]=function(_0x57501e){var _0x1ede31=this;return new Promise(function(_0x2615d6,_0x2f799c){return db[_0xcbdd('0x19')][_0xcbdd('0x1a')](_0x57501e[_0xcbdd('0x1b')],{'raw':_0x57501e[_0xcbdd('0x1c')]?_0x57501e[_0xcbdd('0x1c')][_0xcbdd('0x1d')]===undefined?!![]:![]:!![]})[_0xcbdd('0xe')](function(_0x39a666){logger[_0xcbdd('0xf')](_0xcbdd('0x18'),_0x57501e);logger[_0xcbdd('0x12')](_0xcbdd('0x18'),_0x57501e,JSON['stringify'](_0x39a666));_0x2615d6(_0x39a666);})['catch'](function(_0x3c3c46){logger[_0xcbdd('0x14')]('CreateWhatsappMessage',_0x3c3c46['message'],_0x57501e);_0x2f799c(_0x1ede31[_0xcbdd('0x14')](0x1f4,_0x3c3c46[_0xcbdd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e8faf8e..4132686 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa169=['removeListener','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa169,0x1ed));var _0x9a16=function(_0x5a8d27,_0x37c21f){_0x5a8d27=_0x5a8d27-0x0;var _0x338a09=_0xa169[_0x5a8d27];return _0x338a09;};'use strict';var WhatsappMessageEvents=require(_0x9a16('0x0'));var events=[_0x9a16('0x1'),'remove','update'];function createListener(_0x4040bc,_0x1bfa9d){return function(_0x5b4495){_0x1bfa9d['emit'](_0x4040bc,_0x5b4495);};}function removeListener(_0x59c316,_0xa8eb54){return function(){WhatsappMessageEvents[_0x9a16('0x2')](_0x59c316,_0xa8eb54);};}exports['register']=function(_0x3c775f){for(var _0x515526=0x0,_0x18e9b0=events[_0x9a16('0x3')];_0x515526<_0x18e9b0;_0x515526++){var _0x117ffd=events[_0x515526];var _0x43a34d=createListener(_0x9a16('0x4')+_0x117ffd,_0x3c775f);WhatsappMessageEvents['on'](_0x117ffd,_0x43a34d);}}; \ No newline at end of file +var _0xa615=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x4b1fc2,_0x2b0e9d){var _0x2be5d9=function(_0x5e2162){while(--_0x5e2162){_0x4b1fc2['push'](_0x4b1fc2['shift']());}};_0x2be5d9(++_0x2b0e9d);}(_0xa615,0x186));var _0x5a61=function(_0x59606d,_0x469e33){_0x59606d=_0x59606d-0x0;var _0x438617=_0xa615[_0x59606d];return _0x438617;};'use strict';var WhatsappMessageEvents=require(_0x5a61('0x0'));var events=[_0x5a61('0x1'),'remove',_0x5a61('0x2')];function createListener(_0x1cb60b,_0x495957){return function(_0x28e70c){_0x495957[_0x5a61('0x3')](_0x1cb60b,_0x28e70c);};}function removeListener(_0x4c072b,_0x1344c7){return function(){WhatsappMessageEvents['removeListener'](_0x4c072b,_0x1344c7);};}exports[_0x5a61('0x4')]=function(_0x280a27){for(var _0x4ad781=0x0,_0x52c2c2=events[_0x5a61('0x5')];_0x4ad781<_0x52c2c2;_0x4ad781++){var _0x2a50d7=events[_0x4ad781];var _0x418b7a=createListener(_0x5a61('0x6')+_0x2a50d7,_0x280a27);WhatsappMessageEvents['on'](_0x2a50d7,_0x418b7a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index b736b7c..2db2228 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46c4=['describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x46c4,0x16e));var _0x446c=function(_0xdafe39,_0x11348d){_0xdafe39=_0xdafe39-0x0;var _0x3b53b4=_0x46c4[_0xdafe39];return _0x3b53b4;};'use strict';var multer=require(_0x446c('0x0'));var util=require('util');var path=require(_0x446c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x446c('0x2')]();var fs_extra=require(_0x446c('0x3'));var auth=require(_0x446c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x446c('0x5'));var controller=require('./whatsappQueue.controller');router[_0x446c('0x6')]('/',auth[_0x446c('0x7')](),controller['index']);router[_0x446c('0x6')](_0x446c('0x8'),auth['isAuthenticated'](),controller[_0x446c('0x9')]);router[_0x446c('0x6')](_0x446c('0xa'),auth[_0x446c('0x7')](),controller['show']);router[_0x446c('0x6')](_0x446c('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0x446c('0x6')](_0x446c('0xc'),auth[_0x446c('0x7')](),controller[_0x446c('0xd')]);router[_0x446c('0x6')](_0x446c('0xe'),auth['isAuthenticated'](),controller[_0x446c('0xf')]);router[_0x446c('0x10')]('/',auth[_0x446c('0x7')](),controller[_0x446c('0x11')]);router['post'](_0x446c('0xc'),auth['isAuthenticated'](),controller[_0x446c('0x12')]);router['post'](_0x446c('0xe'),auth[_0x446c('0x7')](),controller['addAgents']);router[_0x446c('0x13')]('/:id',auth[_0x446c('0x7')](),controller['update']);router[_0x446c('0x14')](_0x446c('0xa'),auth[_0x446c('0x7')](),controller[_0x446c('0x15')]);router[_0x446c('0x14')]('/:id/teams',auth[_0x446c('0x7')](),controller[_0x446c('0x16')]);router[_0x446c('0x14')](_0x446c('0xe'),auth[_0x446c('0x7')](),controller[_0x446c('0x17')]);module[_0x446c('0x18')]=router; \ No newline at end of file +var _0x8cd4=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getTeams','getAgents','post','create','/:id/users','addAgents','put','/:id','delete','/:id/teams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13594c,_0x512740){var _0x2aedfc=function(_0x1075d8){while(--_0x1075d8){_0x13594c['push'](_0x13594c['shift']());}};_0x2aedfc(++_0x512740);}(_0x8cd4,0x80));var _0x48cd=function(_0x525e56,_0x1f0f2f){_0x525e56=_0x525e56-0x0;var _0x525252=_0x8cd4[_0x525e56];return _0x525252;};'use strict';var multer=require('multer');var util=require(_0x48cd('0x0'));var path=require(_0x48cd('0x1'));var timeout=require(_0x48cd('0x2'));var express=require('express');var router=express[_0x48cd('0x3')]();var fs_extra=require(_0x48cd('0x4'));var auth=require(_0x48cd('0x5'));var interaction=require(_0x48cd('0x6'));var config=require(_0x48cd('0x7'));var controller=require('./whatsappQueue.controller');router[_0x48cd('0x8')]('/',auth[_0x48cd('0x9')](),controller[_0x48cd('0xa')]);router[_0x48cd('0x8')](_0x48cd('0xb'),auth[_0x48cd('0x9')](),controller[_0x48cd('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x48cd('0xd')]);router['get'](_0x48cd('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x48cd('0x8')]('/:id/teams',auth[_0x48cd('0x9')](),controller[_0x48cd('0xf')]);router[_0x48cd('0x8')]('/:id/users',auth[_0x48cd('0x9')](),controller[_0x48cd('0x10')]);router[_0x48cd('0x11')]('/',auth[_0x48cd('0x9')](),controller[_0x48cd('0x12')]);router[_0x48cd('0x11')]('/:id/teams',auth[_0x48cd('0x9')](),controller['addTeams']);router['post'](_0x48cd('0x13'),auth[_0x48cd('0x9')](),controller[_0x48cd('0x14')]);router[_0x48cd('0x15')](_0x48cd('0x16'),auth[_0x48cd('0x9')](),controller['update']);router[_0x48cd('0x17')](_0x48cd('0x16'),auth[_0x48cd('0x9')](),controller['destroy']);router['delete'](_0x48cd('0x18'),auth[_0x48cd('0x9')](),controller['removeTeams']);router[_0x48cd('0x17')](_0x48cd('0x13'),auth[_0x48cd('0x9')](),controller[_0x48cd('0x19')]);module[_0x48cd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 42c8d74..3856317 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1435=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x1435,0x161));var _0x5143=function(_0x4abff5,_0x261a72){_0x4abff5=_0x4abff5-0x0;var _0x12f89d=_0x1435[_0x4abff5];return _0x12f89d;};'use strict';var Sequelize=require(_0x5143('0x0'));module[_0x5143('0x1')]={'name':{'type':Sequelize[_0x5143('0x2')],'unique':_0x5143('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5143('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5143('0x5')](_0x5143('0x6'),'beepall',_0x5143('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x60a3=['INTEGER','rrmemory','beepall','STRING','sequelize','exports'];(function(_0x3076b5,_0x6bc9df){var _0x5ef5da=function(_0xac1ad1){while(--_0xac1ad1){_0x3076b5['push'](_0x3076b5['shift']());}};_0x5ef5da(++_0x6bc9df);}(_0x60a3,0x8e));var _0x360a=function(_0x295282,_0x3aa519){_0x295282=_0x295282-0x0;var _0x2cc73b=_0x60a3[_0x295282];return _0x2cc73b;};'use strict';var Sequelize=require(_0x360a('0x0'));module[_0x360a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x360a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x360a('0x3'),_0x360a('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x360a('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 740761d..6a2cc49 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x988e=['describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','User','findAndCountAll','whatsappPause','updatedAt','createdAt','rows','format','SIP','Team','getTeams','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','send','message','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappQueue','findAll','catch','params','fields','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','body'];(function(_0x31aa0d,_0x217049){var _0x53e7e0=function(_0x244397){while(--_0x244397){_0x31aa0d['push'](_0x31aa0d['shift']());}};_0x53e7e0(++_0x217049);}(_0x988e,0x1f1));var _0xe988=function(_0x3e7b4a,_0x3a6e54){_0x3e7b4a=_0x3e7b4a-0x0;var _0x5f4aa4=_0x988e[_0x3e7b4a];return _0x5f4aa4;};'use strict';var emlformat=require(_0xe988('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe988('0x1'));var jsonpatch=require(_0xe988('0x2'));var rp=require(_0xe988('0x3'));var moment=require(_0xe988('0x4'));var BPromise=require(_0xe988('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe988('0x6'));var csv=require(_0xe988('0x7'));var ejs=require(_0xe988('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe988('0x9'));var squel=require(_0xe988('0xa'));var crypto=require(_0xe988('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe988('0xc'));var toCsv=require(_0xe988('0x7'));var querystring=require(_0xe988('0xd'));var Papa=require(_0xe988('0xe'));var Redis=require('ioredis');var authService=require(_0xe988('0xf'));var qs=require(_0xe988('0x10'));var as=require(_0xe988('0x11'));var hardwareService=require(_0xe988('0x12'));var logger=require(_0xe988('0x13'))(_0xe988('0x14'));var utils=require(_0xe988('0x15'));var config=require(_0xe988('0x16'));var licenseUtil=require(_0xe988('0x17'));var db=require(_0xe988('0x18'))['db'];config['redis']=_[_0xe988('0x19')](config[_0xe988('0x1a')],{'host':_0xe988('0x1b'),'port':0x18eb});var socket=require(_0xe988('0x1c'))(new Redis(config[_0xe988('0x1a')]));require(_0xe988('0x1d'))[_0xe988('0x1e')](socket);function respondWithStatusCode(_0x269923,_0x1bdf7b){_0x1bdf7b=_0x1bdf7b||0xcc;return function(_0x1bc680){if(_0x1bc680){return _0x269923[_0xe988('0x1f')](_0x1bdf7b);}return _0x269923[_0xe988('0x20')](_0x1bdf7b)[_0xe988('0x21')]();};}function respondWithResult(_0x5c3abe,_0x1b1e6d){_0x1b1e6d=_0x1b1e6d||0xc8;return function(_0xff81a8){if(_0xff81a8){return _0x5c3abe[_0xe988('0x20')](_0x1b1e6d)[_0xe988('0x22')](_0xff81a8);}};}function respondWithFilteredResult(_0xdc3827,_0x3f0cad){return function(_0x278fb2){if(_0x278fb2){var _0x23f6fd=typeof _0x3f0cad['offset']===_0xe988('0x23')&&typeof _0x3f0cad[_0xe988('0x24')]===_0xe988('0x23');var _0xd1960=_0x278fb2['count'];var _0x175328=_0x23f6fd?0x0:_0x3f0cad[_0xe988('0x25')];var _0x526346=_0x23f6fd?_0x278fb2[_0xe988('0x26')]:_0x3f0cad[_0xe988('0x25')]+_0x3f0cad[_0xe988('0x24')];var _0x1e16b2;if(_0x526346>=_0xd1960){_0x526346=_0xd1960;_0x1e16b2=0xc8;}else{_0x1e16b2=0xce;}_0xdc3827[_0xe988('0x20')](_0x1e16b2);return _0xdc3827[_0xe988('0x27')](_0xe988('0x28'),_0x175328+'-'+_0x526346+'/'+_0xd1960)[_0xe988('0x22')](_0x278fb2);}return null;};}function patchUpdates(_0xa401da){return function(_0x31e0d0){try{jsonpatch[_0xe988('0x29')](_0x31e0d0,_0xa401da,!![]);}catch(_0x517457){return BPromise[_0xe988('0x2a')](_0x517457);}return _0x31e0d0[_0xe988('0x2b')]();};}function saveUpdates(_0xf5847f,_0x188fe2){return function(_0x33d25f){if(_0x33d25f){return _0x33d25f['update'](_0xf5847f)[_0xe988('0x2c')](function(_0x5c346b){return _0x5c346b;});}return null;};}function removeEntity(_0x1e0fa5,_0x228621){return function(_0x7a6e44){if(_0x7a6e44){return _0x7a6e44[_0xe988('0x2d')]()[_0xe988('0x2c')](function(){var _0x2c62c3=_0x7a6e44['get']({'plain':!![]});var _0x1a6ba8=_0xe988('0x2e');return db[_0xe988('0x2f')][_0xe988('0x2d')]({'where':{'type':_0x1a6ba8,'resourceId':_0x2c62c3['id']}})['then'](function(){return _0x7a6e44;});})[_0xe988('0x2c')](function(){_0x1e0fa5[_0xe988('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c2ea,_0x463289){return function(_0x413de2){if(!_0x413de2){_0x14c2ea[_0xe988('0x1f')](0x194);}return _0x413de2;};}function handleError(_0x5c79ef,_0x4fc9e9){_0x4fc9e9=_0x4fc9e9||0x1f4;return function(_0x5c4e27){logger[_0xe988('0x30')](_0x5c4e27[_0xe988('0x31')]);if(_0x5c4e27['name']){delete _0x5c4e27[_0xe988('0x32')];}_0x5c79ef[_0xe988('0x20')](_0x4fc9e9)[_0xe988('0x33')](_0x5c4e27);};}function getMustacheRender(_0x188ced,_0x2506a0){return Mustache['render'](_0x188ced,_['merge'](_0x2506a0['body'],{'contact':_0x2506a0['contact'],'message':_0x2506a0[_0xe988('0x34')],'agent':_0x2506a0[_0xe988('0x35')],'interaction':_0x2506a0[_0xe988('0x36')],'account':_0x2506a0[_0xe988('0x37')]}))||'';}exports[_0xe988('0x38')]=function(_0x285bf3,_0x2e4b5c){var _0x418480={},_0x5317c9={},_0x21a11f={'count':0x0,'rows':[]};var _0x5239ab=_[_0xe988('0x39')](db['WhatsappQueue'][_0xe988('0x3a')],function(_0x34b943){return{'name':_0x34b943[_0xe988('0x3b')],'type':_0x34b943[_0xe988('0x3c')][_0xe988('0x3d')]};});_0x5317c9[_0xe988('0x3e')]=_['map'](_0x5239ab,_0xe988('0x32'));_0x5317c9[_0xe988('0x3f')]=_[_0xe988('0x40')](_0x285bf3[_0xe988('0x3f')]);_0x5317c9[_0xe988('0x41')]=_[_0xe988('0x42')](_0x5317c9['model'],_0x5317c9['query']);_0x418480[_0xe988('0x43')]=_[_0xe988('0x42')](_0x5317c9[_0xe988('0x3e')],qs['fields'](_0x285bf3[_0xe988('0x3f')]['fields']));_0x418480[_0xe988('0x43')]=_0x418480[_0xe988('0x43')][_0xe988('0x44')]?_0x418480['attributes']:_0x5317c9[_0xe988('0x3e')];if(!_0x285bf3[_0xe988('0x3f')][_0xe988('0x45')](_0xe988('0x46'))){_0x418480[_0xe988('0x24')]=qs[_0xe988('0x24')](_0x285bf3['query'][_0xe988('0x24')]);_0x418480[_0xe988('0x25')]=qs['offset'](_0x285bf3[_0xe988('0x3f')][_0xe988('0x25')]);}_0x418480['order']=qs[_0xe988('0x47')](_0x285bf3[_0xe988('0x3f')][_0xe988('0x47')]);_0x418480[_0xe988('0x48')]=qs[_0xe988('0x41')](_[_0xe988('0x49')](_0x285bf3[_0xe988('0x3f')],_0x5317c9['filters']),_0x5239ab);if(_0x285bf3['query'][_0xe988('0x4a')]){_0x418480[_0xe988('0x48')]=_[_0xe988('0x4b')](_0x418480[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0x5239ab,function(_0x2d007c){if(_0x2d007c[_0xe988('0x3c')]!==_0xe988('0x4c')){var _0x2d4dbf={};_0x2d4dbf[_0x2d007c[_0xe988('0x32')]]={'$like':'%'+_0x285bf3[_0xe988('0x3f')][_0xe988('0x4a')]+'%'};return _0x2d4dbf;}})});}_0x418480=_[_0xe988('0x4b')]({},_0x418480,_0x285bf3[_0xe988('0x4d')]);var _0x25ac46={'where':_0x418480['where']};return db['WhatsappQueue'][_0xe988('0x26')](_0x25ac46)['then'](function(_0x1fff06){_0x21a11f[_0xe988('0x26')]=_0x1fff06;if(_0x285bf3['query'][_0xe988('0x4e')]){_0x418480[_0xe988('0x4f')]=[{'all':!![]}];}return db[_0xe988('0x50')][_0xe988('0x51')](_0x418480);})[_0xe988('0x2c')](function(_0xdc7585){_0x21a11f['rows']=_0xdc7585;return _0x21a11f;})['then'](respondWithFilteredResult(_0x2e4b5c,_0x418480))[_0xe988('0x52')](handleError(_0x2e4b5c,null));};exports['show']=function(_0x43f1cc,_0x43deeb){var _0x10dbc6={'raw':!![],'where':{'id':_0x43f1cc[_0xe988('0x53')]['id']}},_0x4854d7={};_0x4854d7[_0xe988('0x3e')]=_[_0xe988('0x40')](db['WhatsappQueue'][_0xe988('0x3a')]);_0x4854d7[_0xe988('0x3f')]=_[_0xe988('0x40')](_0x43f1cc[_0xe988('0x3f')]);_0x4854d7[_0xe988('0x41')]=_[_0xe988('0x42')](_0x4854d7['model'],_0x4854d7[_0xe988('0x3f')]);_0x10dbc6[_0xe988('0x43')]=_['intersection'](_0x4854d7[_0xe988('0x3e')],qs[_0xe988('0x54')](_0x43f1cc[_0xe988('0x3f')][_0xe988('0x54')]));_0x10dbc6[_0xe988('0x43')]=_0x10dbc6[_0xe988('0x43')][_0xe988('0x44')]?_0x10dbc6[_0xe988('0x43')]:_0x4854d7[_0xe988('0x3e')];if(_0x43f1cc[_0xe988('0x3f')][_0xe988('0x4e')]){_0x10dbc6[_0xe988('0x4f')]=[{'all':!![]}];}_0x10dbc6=_[_0xe988('0x4b')]({},_0x10dbc6,_0x43f1cc[_0xe988('0x4d')]);return db[_0xe988('0x50')]['find'](_0x10dbc6)[_0xe988('0x2c')](handleEntityNotFound(_0x43deeb,null))[_0xe988('0x2c')](respondWithResult(_0x43deeb,null))[_0xe988('0x52')](handleError(_0x43deeb,null));};exports[_0xe988('0x55')]=function(_0x13a32b,_0x340f54){return db['WhatsappQueue'][_0xe988('0x55')](_0x13a32b['body'],{})[_0xe988('0x2c')](function(_0x3ec5d7){var _0x68a094=_0x13a32b[_0xe988('0x56')][_0xe988('0x57')]({'plain':!![]});if(!_0x68a094)throw new Error(_0xe988('0x58'));if(_0x68a094[_0xe988('0x59')]==='user'){var _0x225a78=_0x3ec5d7[_0xe988('0x57')]({'plain':!![]});var _0x4a9bf3=_0xe988('0x2e');return db['UserProfileSection'][_0xe988('0x5a')]({'where':{'name':_0x4a9bf3,'userProfileId':_0x68a094[_0xe988('0x5b')]},'raw':!![]})['then'](function(_0x58ed9e){if(_0x58ed9e&&_0x58ed9e[_0xe988('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x225a78[_0xe988('0x32')],'resourceId':_0x225a78['id'],'type':_0x58ed9e[_0xe988('0x32')],'sectionId':_0x58ed9e['id']},{})[_0xe988('0x2c')](function(){return _0x3ec5d7;});}else{return _0x3ec5d7;}})[_0xe988('0x52')](function(_0x28a631){logger[_0xe988('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28a631);throw _0x28a631;});}return _0x3ec5d7;})[_0xe988('0x2c')](respondWithResult(_0x340f54,0xc9))[_0xe988('0x52')](handleError(_0x340f54,null));};exports[_0xe988('0x5d')]=function(_0x4d387a,_0x57f5e3){if(_0x4d387a[_0xe988('0x5e')]['id']){delete _0x4d387a['body']['id'];}return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0x4d387a[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x57f5e3,null))[_0xe988('0x2c')](saveUpdates(_0x4d387a[_0xe988('0x5e')],null))[_0xe988('0x2c')](respondWithResult(_0x57f5e3,null))['catch'](handleError(_0x57f5e3,null));};exports[_0xe988('0x2d')]=function(_0x1ab7ab,_0x38873b){return db['WhatsappQueue']['find']({'where':{'id':_0x1ab7ab[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x38873b,null))['then'](removeEntity(_0x38873b,null))[_0xe988('0x52')](handleError(_0x38873b,null));};exports[_0xe988('0x5f')]=function(_0x56ca18,_0x265765){return db[_0xe988('0x50')]['describe']()['then'](respondWithResult(_0x265765,null))[_0xe988('0x52')](handleError(_0x265765,null));};exports[_0xe988('0x60')]=function(_0x34c2cb,_0x57f64e,_0x5e0bac){var _0x217b0a={'raw':!![],'where':{}},_0x2c56f0={},_0x2c1c06;return db['WhatsappQueue'][_0xe988('0x61')]({'where':{'id':_0x34c2cb['params']['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x57f64e,null))[_0xe988('0x2c')](function(_0x20b869){if(_0x20b869){_0x2c1c06=_0x20b869[_0xe988('0x57')]({'plain':!![]});_0x2c56f0[_0xe988('0x3e')]=_[_0xe988('0x40')](db[_0xe988('0x62')][_0xe988('0x3a')]);_0x2c56f0['query']=_[_0xe988('0x40')](_0x34c2cb[_0xe988('0x3f')]);_0x2c56f0[_0xe988('0x41')]=_[_0xe988('0x42')](_0x2c56f0['model'],_0x2c56f0[_0xe988('0x3f')]);_0x217b0a[_0xe988('0x43')]=_[_0xe988('0x42')](_0x2c56f0[_0xe988('0x3e')],qs[_0xe988('0x54')](_0x34c2cb['query'][_0xe988('0x54')]));_0x217b0a[_0xe988('0x43')]=_0x217b0a[_0xe988('0x43')][_0xe988('0x44')]?_0x217b0a[_0xe988('0x43')]:_0x2c56f0[_0xe988('0x3e')];if(!_0x34c2cb[_0xe988('0x3f')][_0xe988('0x45')](_0xe988('0x46'))){_0x217b0a['limit']=qs[_0xe988('0x24')](_0x34c2cb['query'][_0xe988('0x24')]);_0x217b0a[_0xe988('0x25')]=qs[_0xe988('0x25')](_0x34c2cb[_0xe988('0x3f')][_0xe988('0x25')]);}_0x217b0a[_0xe988('0x63')]=qs[_0xe988('0x47')](_0x34c2cb[_0xe988('0x3f')][_0xe988('0x47')]);_0x217b0a[_0xe988('0x48')]=qs[_0xe988('0x41')](_['pick'](_0x34c2cb[_0xe988('0x3f')],_0x2c56f0[_0xe988('0x41')]));_0x217b0a['where'][_0xe988('0x64')]=_0x20b869['id'];if(_0x34c2cb[_0xe988('0x3f')][_0xe988('0x4a')]){_0x217b0a[_0xe988('0x48')]=_[_0xe988('0x4b')](_0x217b0a[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0x217b0a[_0xe988('0x43')],function(_0x41fe58){var _0x24387b={};_0x24387b[_0x41fe58]={'$like':'%'+_0x34c2cb['query'][_0xe988('0x4a')]+'%'};return _0x24387b;})});}_0x217b0a=_['merge']({},_0x217b0a,_0x34c2cb[_0xe988('0x4d')]);return db[_0xe988('0x62')][_0xe988('0x51')](_0x217b0a);}})[_0xe988('0x2c')](function(_0x56b9ed){if(_0x56b9ed){return db[_0xe988('0x65')][_0xe988('0x66')]({'where':{'id':_['map'](_0x56b9ed,'UserId'),'role':_0xe988('0x35')},'attributes':['id','name',_0xe988('0x67'),_0xe988('0x68'),_0xe988('0x69')]});}})[_0xe988('0x2c')](function(_0x4ebe2a){if(_0x4ebe2a){return{'count':_0x4ebe2a[_0xe988('0x26')],'rows':_[_0xe988('0x39')](_0x4ebe2a[_0xe988('0x6a')],function(_0x4609b1){return{'membername':_0x4609b1['name'],'UserId':_0x4609b1['id'],'queue_name':_0x2c1c06['name'],'WhatsappQueueId':_0x2c1c06['id'],'interface':util[_0xe988('0x6b')]('%s/%s',_0xe988('0x6c'),_0x4609b1['name']),'penalty':0x0,'paused':_0x4609b1[_0xe988('0x67')],'createdAt':_0x4609b1[_0xe988('0x69')],'updatedAt':_0x4609b1[_0xe988('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe988('0x2c')](respondWithFilteredResult(_0x57f64e,_0x217b0a))['catch'](handleError(_0x57f64e,null));};exports['getTeams']=function(_0x15cbb8,_0x44567d,_0x5b68ae){var _0xabd672={};var _0x2718d2={};var _0x101c37;var _0x2df5f3;return db[_0xe988('0x50')][_0xe988('0x61')]({'where':{'id':_0x15cbb8[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x44567d,null))['then'](function(_0x15a744){if(_0x15a744){_0x101c37=_0x15a744;_0x2718d2[_0xe988('0x3e')]=_[_0xe988('0x40')](db[_0xe988('0x6d')][_0xe988('0x3a')]);_0x2718d2[_0xe988('0x3f')]=_[_0xe988('0x40')](_0x15cbb8[_0xe988('0x3f')]);_0x2718d2[_0xe988('0x41')]=_[_0xe988('0x42')](_0x2718d2[_0xe988('0x3e')],_0x2718d2[_0xe988('0x3f')]);_0xabd672[_0xe988('0x43')]=_['intersection'](_0x2718d2[_0xe988('0x3e')],qs['fields'](_0x15cbb8[_0xe988('0x3f')]['fields']));_0xabd672[_0xe988('0x43')]=_0xabd672[_0xe988('0x43')][_0xe988('0x44')]?_0xabd672['attributes']:_0x2718d2['model'];_0xabd672[_0xe988('0x63')]=qs[_0xe988('0x47')](_0x15cbb8[_0xe988('0x3f')][_0xe988('0x47')]);_0xabd672['where']=qs['filters'](_[_0xe988('0x49')](_0x15cbb8[_0xe988('0x3f')],_0x2718d2['filters']));if(_0x15cbb8[_0xe988('0x3f')]['filter']){_0xabd672[_0xe988('0x48')]=_[_0xe988('0x4b')](_0xabd672[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0xabd672[_0xe988('0x43')],function(_0x29a54d){var _0x480536={};_0x480536[_0x29a54d]={'$like':'%'+_0x15cbb8[_0xe988('0x3f')][_0xe988('0x4a')]+'%'};return _0x480536;})});}_0xabd672=_[_0xe988('0x4b')]({},_0xabd672,_0x15cbb8[_0xe988('0x4d')]);return _0x101c37[_0xe988('0x6e')](_0xabd672);}})[_0xe988('0x2c')](function(_0x4ba30d){if(_0x4ba30d){_0x2df5f3=_0x4ba30d[_0xe988('0x44')];if(!_0x15cbb8['query'][_0xe988('0x45')](_0xe988('0x46'))){_0xabd672[_0xe988('0x24')]=qs['limit'](_0x15cbb8[_0xe988('0x3f')][_0xe988('0x24')]);_0xabd672[_0xe988('0x25')]=qs[_0xe988('0x25')](_0x15cbb8[_0xe988('0x3f')][_0xe988('0x25')]);}return _0x101c37[_0xe988('0x6e')](_0xabd672);}})[_0xe988('0x2c')](function(_0x461182){if(_0x461182){return _0x461182?{'count':_0x2df5f3,'rows':_0x461182}:null;}})[_0xe988('0x2c')](respondWithResult(_0x44567d,null))['catch'](handleError(_0x44567d,null));};exports[_0xe988('0x6f')]=function(_0x121d33,_0x36dde4,_0x5a53e5){var _0x5ace0e=_0x121d33[_0xe988('0x5e')][_0xe988('0x70')];return db[_0xe988('0x6d')][_0xe988('0x51')]({'where':{'id':_0x5ace0e},'attributes':['id'],'include':[{'model':db[_0xe988('0x65')],'as':'Agents','attributes':['id',_0xe988('0x32'),_0xe988('0x71'),_0xe988('0x72'),'interface'],'raw':!![]}]})[_0xe988('0x2c')](function(_0x45b787){if(_0x45b787){var _0x31787e=_['flatMap'](_0x45b787,function(_0x28bccc){var _0x5d3bb6=_0x28bccc[_0xe988('0x57')]({'plain':!![]});return _0x5d3bb6[_0xe988('0x73')];});return db['WhatsappQueue'][_0xe988('0x5a')]({'where':{'id':_0x121d33[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](function(_0x537b7e){return db[_0xe988('0x74')][_0xe988('0x75')](function(_0xa88e19){return _0x537b7e[_0xe988('0x6f')](_0x5ace0e,{'transaction':_0xa88e19})['then'](function(){return BPromise[_0xe988('0x76')](_0x31787e,function(_0x4c3d9f){return db[_0xe988('0x62')]['findOrCreate']({'where':{'UserId':_0x4c3d9f['id'],'WhatsappQueueId':_0x121d33['params']['id']},'transaction':_0xa88e19});});})[_0xe988('0x2c')](function(){_0x31787e['forEach'](function(_0x5d2542){socket['emit'](_0xe988('0x77'),{'UserId':_0x5d2542['id'],'WhatsappQueueId':_0x537b7e['id']});});});});});}})[_0xe988('0x2c')](respondWithStatusCode(_0x36dde4,null))[_0xe988('0x52')](handleError(_0x36dde4,null));};exports['removeTeams']=function(_0x17e675,_0x511387,_0xce914b){return db[_0xe988('0x6d')][_0xe988('0x51')]({'where':{'id':_0x17e675[_0xe988('0x3f')][_0xe988('0x70')]},'attributes':['id'],'include':[{'model':db[_0xe988('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe988('0x2c')](handleEntityNotFound(_0x511387,null))[_0xe988('0x2c')](function(_0x10bb56){var _0x383969=_[_0xe988('0x39')](_0x10bb56,'id');var _0x502c68=[];var _0x4180d9=[];var _0x49b5cd=squel[_0xe988('0x78')]();_0x49b5cd[_0xe988('0x79')](_0xe988('0x7a'))[_0xe988('0x7b')](_0xe988('0x7c'),'tq')['join'](_0xe988('0x7d'),'ut',_0xe988('0x7e'))[_0xe988('0x48')](_0xe988('0x7f'),_0x17e675[_0xe988('0x53')]['id']);for(var _0x4c5c5a=0x0;_0x4c5c5a<_0x10bb56['length'];_0x4c5c5a+=0x1){let _0x168ba6=_0x10bb56[_0x4c5c5a];for(var _0x4ff2f1=0x0;_0x4ff2f1<_0x168ba6[_0xe988('0x73')]['length'];_0x4ff2f1+=0x1){let _0x406e16=_0x168ba6[_0xe988('0x73')][_0x4ff2f1];var _0x549a4f=_0x49b5cd[_0xe988('0x80')]();_0x549a4f[_0xe988('0x48')]('ut.UserId\x20=\x20?',_0x406e16['id']);_0x4180d9[_0xe988('0x81')](db[_0xe988('0x74')][_0xe988('0x3f')](_0x549a4f['toString'](),{'type':db['sequelize'][_0xe988('0x82')]['SELECT']})['then'](function(_0x1ca488){if(_0x1ca488[_0xe988('0x44')]===0x1){return _0x406e16['id'];}else{var _0x1c4493=_[_0xe988('0x83')](_['map'](_0x1ca488,_0xe988('0x84')),function(_0x4f0b64){return _[_0xe988('0x85')](_0x383969,_0x4f0b64);});if(_0x1c4493){return _0x406e16['id'];}}}));}}return BPromise[_0xe988('0x86')](_0x4180d9)[_0xe988('0x2c')](function(_0x3d8648){_0x502c68=_(_0x502c68)[_0xe988('0x87')](_0x3d8648)[_0xe988('0x88')]()[_0xe988('0x89')]();return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0x17e675[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](function(_0x9fd4e7){return db[_0xe988('0x74')]['transaction'](function(_0xf80347){return _0x9fd4e7[_0xe988('0x8a')](_0x17e675[_0xe988('0x3f')]['ids'],{'transaction':_0xf80347})[_0xe988('0x2c')](function(){if(!_[_0xe988('0x8b')](_0x502c68)){return _0x9fd4e7[_0xe988('0x8c')](_0x502c68,{'transaction':_0xf80347});}})[_0xe988('0x2c')](function(){_0x502c68[_0xe988('0x8d')](function(_0x149e04){socket[_0xe988('0x8e')](_0xe988('0x8f'),{'UserId':_0x149e04,'WhatsappQueueId':_0x9fd4e7['id']});});});});});});})['then'](respondWithStatusCode(_0x511387,null))[_0xe988('0x52')](handleError(_0x511387,null));};exports[_0xe988('0x90')]=function(_0x2b586b,_0x43377a,_0x3a3d4e){return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0x2b586b[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x43377a,null))[_0xe988('0x2c')](function(_0x45aef1){if(_0x45aef1){return _0x45aef1[_0xe988('0x90')](_0x2b586b[_0xe988('0x5e')][_0xe988('0x70')],_[_0xe988('0x91')](_0x2b586b['body'],[_0xe988('0x70'),'id'])||{})[_0xe988('0x92')](function(_0x33d735){for(var _0x2e9880=0x0;_0x2e9880<_0x2b586b[_0xe988('0x5e')][_0xe988('0x70')][_0xe988('0x44')];_0x2e9880+=0x1){socket[_0xe988('0x8e')](_0xe988('0x77'),{'UserId':_0x2b586b[_0xe988('0x5e')][_0xe988('0x70')][_0x2e9880],'WhatsappQueueId':_0x2b586b['params']['id']});}return _0x33d735;});}})[_0xe988('0x2c')](respondWithResult(_0x43377a,null))[_0xe988('0x52')](handleError(_0x43377a,null));};exports[_0xe988('0x8c')]=function(_0xf8e8b,_0x4fac15,_0x3701f9){return db[_0xe988('0x50')][_0xe988('0x5a')]({'where':{'id':_0xf8e8b[_0xe988('0x53')]['id']}})['then'](handleEntityNotFound(_0x4fac15,null))[_0xe988('0x2c')](function(_0x26519b){if(_0x26519b){return _0x26519b['removeAgents'](_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')])['then'](function(){if(_['isArray'](_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')])){for(var _0x8204b9=0x0;_0x8204b9<_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')]['length'];_0x8204b9+=0x1){socket[_0xe988('0x8e')](_0xe988('0x8f'),{'UserId':Number(_0xf8e8b[_0xe988('0x3f')]['ids'][_0x8204b9]),'WhatsappQueueId':Number(_0xf8e8b[_0xe988('0x53')]['id'])});}}else{socket[_0xe988('0x8e')](_0xe988('0x8f'),{'UserId':Number(_0xf8e8b[_0xe988('0x3f')][_0xe988('0x70')]),'WhatsappQueueId':Number(_0xf8e8b['params']['id'])});}});}})[_0xe988('0x2c')](respondWithStatusCode(_0x4fac15,null))['catch'](handleError(_0x4fac15,null));};exports[_0xe988('0x93')]=function(_0x561687,_0x248a6a,_0x4de6a9){var _0x91307d={};var _0x558dd4={};var _0xc9cc3f;var _0x43c92d;return db[_0xe988('0x50')][_0xe988('0x61')]({'where':{'id':_0x561687[_0xe988('0x53')]['id']}})[_0xe988('0x2c')](handleEntityNotFound(_0x248a6a,null))[_0xe988('0x2c')](function(_0x5aa931){if(_0x5aa931){_0xc9cc3f=_0x5aa931;_0x558dd4[_0xe988('0x3e')]=_['keys'](db[_0xe988('0x65')][_0xe988('0x3a')]);_0x558dd4[_0xe988('0x3f')]=_['keys'](_0x561687['query']);_0x558dd4[_0xe988('0x41')]=_[_0xe988('0x42')](_0x558dd4[_0xe988('0x3e')],_0x558dd4[_0xe988('0x3f')]);_0x91307d['attributes']=_['intersection'](_0x558dd4[_0xe988('0x3e')],qs[_0xe988('0x54')](_0x561687[_0xe988('0x3f')][_0xe988('0x54')]));_0x91307d[_0xe988('0x43')]=_0x91307d[_0xe988('0x43')]['length']?_0x91307d['attributes']:_0x558dd4[_0xe988('0x3e')];_0x91307d[_0xe988('0x63')]=qs[_0xe988('0x47')](_0x561687['query'][_0xe988('0x47')]);_0x91307d[_0xe988('0x48')]=qs[_0xe988('0x41')](_[_0xe988('0x49')](_0x561687[_0xe988('0x3f')],_0x558dd4[_0xe988('0x41')]));if(_0x561687['query'][_0xe988('0x4a')]){_0x91307d['where']=_[_0xe988('0x4b')](_0x91307d[_0xe988('0x48')],{'$or':_[_0xe988('0x39')](_0x91307d['attributes'],function(_0x1ec243){var _0x20ca33={};_0x20ca33[_0x1ec243]={'$like':'%'+_0x561687[_0xe988('0x3f')][_0xe988('0x4a')]+'%'};return _0x20ca33;})});}_0x91307d=_[_0xe988('0x4b')]({},_0x91307d,_0x561687['options']);return _0xc9cc3f[_0xe988('0x93')](_0x91307d);}})[_0xe988('0x2c')](function(_0x3a6ba){if(_0x3a6ba){_0x43c92d=_0x3a6ba[_0xe988('0x44')];if(!_0x561687[_0xe988('0x3f')][_0xe988('0x45')](_0xe988('0x46'))){_0x91307d[_0xe988('0x24')]=qs[_0xe988('0x24')](_0x561687[_0xe988('0x3f')][_0xe988('0x24')]);_0x91307d[_0xe988('0x25')]=qs[_0xe988('0x25')](_0x561687[_0xe988('0x3f')][_0xe988('0x25')]);}return _0xc9cc3f[_0xe988('0x93')](_0x91307d);}})[_0xe988('0x2c')](function(_0x3a65ea){if(_0x3a65ea){return _0x3a65ea?{'count':_0x43c92d,'rows':_0x3a65ea}:null;}})[_0xe988('0x2c')](respondWithResult(_0x248a6a,null))['catch'](handleError(_0x248a6a,null));}; \ No newline at end of file +var _0xc0ea=['TeamId','includes','compact','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','body','contact','message','agent','interaction','account','index','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','length','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','fields','pick','WhatsappQueueId','UserWhatsappQueue','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','Team','getTeams','ids','User','Agents','voicePause','interface','flatMap','findOrCreate','emit','userWhatsappQueue:save','field','tq.TeamId','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every'];(function(_0x553a33,_0x5cff65){var _0x1d2f71=function(_0x5d39ba){while(--_0x5d39ba){_0x553a33['push'](_0x553a33['shift']());}};_0x1d2f71(++_0x5cff65);}(_0xc0ea,0x1cb));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac0e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac0e('0x1'));var rp=require(_0xac0e('0x2'));var moment=require(_0xac0e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac0e('0x4'));var util=require(_0xac0e('0x5'));var path=require(_0xac0e('0x6'));var sox=require('sox');var csv=require(_0xac0e('0x7'));var ejs=require(_0xac0e('0x8'));var fs=require('fs');var fs_extra=require(_0xac0e('0x9'));var _=require(_0xac0e('0xa'));var squel=require('squel');var crypto=require(_0xac0e('0xb'));var jsforce=require(_0xac0e('0xc'));var deskjs=require(_0xac0e('0xd'));var toCsv=require(_0xac0e('0x7'));var querystring=require(_0xac0e('0xe'));var Papa=require(_0xac0e('0xf'));var Redis=require(_0xac0e('0x10'));var authService=require(_0xac0e('0x11'));var qs=require(_0xac0e('0x12'));var as=require(_0xac0e('0x13'));var hardwareService=require(_0xac0e('0x14'));var logger=require(_0xac0e('0x15'))(_0xac0e('0x16'));var utils=require(_0xac0e('0x17'));var config=require(_0xac0e('0x18'));var licenseUtil=require(_0xac0e('0x19'));var db=require(_0xac0e('0x1a'))['db'];config['redis']=_['defaults'](config[_0xac0e('0x1b')],{'host':_0xac0e('0x1c'),'port':0x18eb});var socket=require(_0xac0e('0x1d'))(new Redis(config['redis']));require(_0xac0e('0x1e'))[_0xac0e('0x1f')](socket);function respondWithStatusCode(_0x55eb0a,_0x1ff9a4){_0x1ff9a4=_0x1ff9a4||0xcc;return function(_0x11cea5){if(_0x11cea5){return _0x55eb0a[_0xac0e('0x20')](_0x1ff9a4);}return _0x55eb0a['status'](_0x1ff9a4)[_0xac0e('0x21')]();};}function respondWithResult(_0x4f91ea,_0x50d24f){_0x50d24f=_0x50d24f||0xc8;return function(_0x445cc4){if(_0x445cc4){return _0x4f91ea[_0xac0e('0x22')](_0x50d24f)[_0xac0e('0x23')](_0x445cc4);}};}function respondWithFilteredResult(_0xe5a495,_0x22786a){return function(_0x179c76){if(_0x179c76){var _0x10aee2=typeof _0x22786a[_0xac0e('0x24')]===_0xac0e('0x25')&&typeof _0x22786a[_0xac0e('0x26')]==='undefined';var _0x2031ad=_0x179c76[_0xac0e('0x27')];var _0x5c440a=_0x10aee2?0x0:_0x22786a[_0xac0e('0x24')];var _0x4424f6=_0x10aee2?_0x179c76[_0xac0e('0x27')]:_0x22786a[_0xac0e('0x24')]+_0x22786a[_0xac0e('0x26')];var _0x4a3f47;if(_0x4424f6>=_0x2031ad){_0x4424f6=_0x2031ad;_0x4a3f47=0xc8;}else{_0x4a3f47=0xce;}_0xe5a495[_0xac0e('0x22')](_0x4a3f47);return _0xe5a495[_0xac0e('0x28')](_0xac0e('0x29'),_0x5c440a+'-'+_0x4424f6+'/'+_0x2031ad)[_0xac0e('0x23')](_0x179c76);}return null;};}function patchUpdates(_0x49dfda){return function(_0xbb2dd4){try{jsonpatch[_0xac0e('0x2a')](_0xbb2dd4,_0x49dfda,!![]);}catch(_0x104264){return BPromise[_0xac0e('0x2b')](_0x104264);}return _0xbb2dd4[_0xac0e('0x2c')]();};}function saveUpdates(_0x5a0de1,_0x273cbb){return function(_0x1ec279){if(_0x1ec279){return _0x1ec279['update'](_0x5a0de1)[_0xac0e('0x2d')](function(_0x1c8ac9){return _0x1c8ac9;});}return null;};}function removeEntity(_0x10ded4,_0x4c9f22){return function(_0x341ecc){if(_0x341ecc){return _0x341ecc[_0xac0e('0x2e')]()['then'](function(){var _0x1828c9=_0x341ecc[_0xac0e('0x2f')]({'plain':!![]});var _0x574e39=_0xac0e('0x30');return db[_0xac0e('0x31')][_0xac0e('0x2e')]({'where':{'type':_0x574e39,'resourceId':_0x1828c9['id']}})[_0xac0e('0x2d')](function(){return _0x341ecc;});})[_0xac0e('0x2d')](function(){_0x10ded4['status'](0xcc)[_0xac0e('0x21')]();});}};}function handleEntityNotFound(_0x54e9af,_0x16ffec){return function(_0x4303ec){if(!_0x4303ec){_0x54e9af[_0xac0e('0x20')](0x194);}return _0x4303ec;};}function handleError(_0x578a19,_0x132b7a){_0x132b7a=_0x132b7a||0x1f4;return function(_0x5858cf){logger[_0xac0e('0x32')](_0x5858cf[_0xac0e('0x33')]);if(_0x5858cf['name']){delete _0x5858cf[_0xac0e('0x34')];}_0x578a19['status'](_0x132b7a)[_0xac0e('0x35')](_0x5858cf);};}function getMustacheRender(_0x3547b1,_0x3a7953){return Mustache['render'](_0x3547b1,_['merge'](_0x3a7953[_0xac0e('0x36')],{'contact':_0x3a7953[_0xac0e('0x37')],'message':_0x3a7953[_0xac0e('0x38')],'agent':_0x3a7953[_0xac0e('0x39')],'interaction':_0x3a7953[_0xac0e('0x3a')],'account':_0x3a7953[_0xac0e('0x3b')]}))||'';}exports[_0xac0e('0x3c')]=function(_0x32bfef,_0x49460d){var _0x2ead51={},_0x359c5b={},_0x4d68c0={'count':0x0,'rows':[]};var _0x1a7f5f=_[_0xac0e('0x3d')](db[_0xac0e('0x3e')][_0xac0e('0x3f')],function(_0x5383b4){return{'name':_0x5383b4['fieldName'],'type':_0x5383b4[_0xac0e('0x40')][_0xac0e('0x41')]};});_0x359c5b[_0xac0e('0x42')]=_[_0xac0e('0x3d')](_0x1a7f5f,_0xac0e('0x34'));_0x359c5b[_0xac0e('0x43')]=_[_0xac0e('0x44')](_0x32bfef[_0xac0e('0x43')]);_0x359c5b[_0xac0e('0x45')]=_[_0xac0e('0x46')](_0x359c5b[_0xac0e('0x42')],_0x359c5b[_0xac0e('0x43')]);_0x2ead51['attributes']=_[_0xac0e('0x46')](_0x359c5b[_0xac0e('0x42')],qs['fields'](_0x32bfef[_0xac0e('0x43')]['fields']));_0x2ead51['attributes']=_0x2ead51[_0xac0e('0x47')]['length']?_0x2ead51[_0xac0e('0x47')]:_0x359c5b['model'];if(!_0x32bfef[_0xac0e('0x43')][_0xac0e('0x48')](_0xac0e('0x49'))){_0x2ead51[_0xac0e('0x26')]=qs[_0xac0e('0x26')](_0x32bfef[_0xac0e('0x43')][_0xac0e('0x26')]);_0x2ead51[_0xac0e('0x24')]=qs[_0xac0e('0x24')](_0x32bfef[_0xac0e('0x43')][_0xac0e('0x24')]);}_0x2ead51[_0xac0e('0x4a')]=qs[_0xac0e('0x4b')](_0x32bfef[_0xac0e('0x43')][_0xac0e('0x4b')]);_0x2ead51['where']=qs[_0xac0e('0x45')](_['pick'](_0x32bfef[_0xac0e('0x43')],_0x359c5b[_0xac0e('0x45')]),_0x1a7f5f);if(_0x32bfef[_0xac0e('0x43')][_0xac0e('0x4c')]){_0x2ead51[_0xac0e('0x4d')]=_[_0xac0e('0x4e')](_0x2ead51[_0xac0e('0x4d')],{'$or':_[_0xac0e('0x3d')](_0x1a7f5f,function(_0x35e00b){if(_0x35e00b['type']!==_0xac0e('0x4f')){var _0x1de8f7={};_0x1de8f7[_0x35e00b[_0xac0e('0x34')]]={'$like':'%'+_0x32bfef[_0xac0e('0x43')][_0xac0e('0x4c')]+'%'};return _0x1de8f7;}})});}_0x2ead51=_[_0xac0e('0x4e')]({},_0x2ead51,_0x32bfef[_0xac0e('0x50')]);var _0x2180d7={'where':_0x2ead51[_0xac0e('0x4d')]};return db[_0xac0e('0x3e')][_0xac0e('0x27')](_0x2180d7)[_0xac0e('0x2d')](function(_0x46080b){_0x4d68c0[_0xac0e('0x27')]=_0x46080b;if(_0x32bfef[_0xac0e('0x43')][_0xac0e('0x51')]){_0x2ead51['include']=[{'all':!![]}];}return db[_0xac0e('0x3e')][_0xac0e('0x52')](_0x2ead51);})[_0xac0e('0x2d')](function(_0x16c295){_0x4d68c0[_0xac0e('0x53')]=_0x16c295;return _0x4d68c0;})['then'](respondWithFilteredResult(_0x49460d,_0x2ead51))['catch'](handleError(_0x49460d,null));};exports['show']=function(_0xcc867d,_0x25f168){var _0x1d0dd8={'raw':!![],'where':{'id':_0xcc867d['params']['id']}},_0x353190={};_0x353190[_0xac0e('0x42')]=_[_0xac0e('0x44')](db['WhatsappQueue']['rawAttributes']);_0x353190['query']=_[_0xac0e('0x44')](_0xcc867d[_0xac0e('0x43')]);_0x353190['filters']=_[_0xac0e('0x46')](_0x353190[_0xac0e('0x42')],_0x353190['query']);_0x1d0dd8[_0xac0e('0x47')]=_[_0xac0e('0x46')](_0x353190[_0xac0e('0x42')],qs['fields'](_0xcc867d[_0xac0e('0x43')]['fields']));_0x1d0dd8[_0xac0e('0x47')]=_0x1d0dd8[_0xac0e('0x47')][_0xac0e('0x54')]?_0x1d0dd8['attributes']:_0x353190['model'];if(_0xcc867d['query'][_0xac0e('0x51')]){_0x1d0dd8['include']=[{'all':!![]}];}_0x1d0dd8=_[_0xac0e('0x4e')]({},_0x1d0dd8,_0xcc867d[_0xac0e('0x50')]);return db['WhatsappQueue'][_0xac0e('0x55')](_0x1d0dd8)[_0xac0e('0x2d')](handleEntityNotFound(_0x25f168,null))[_0xac0e('0x2d')](respondWithResult(_0x25f168,null))[_0xac0e('0x56')](handleError(_0x25f168,null));};exports['create']=function(_0x784f9c,_0x48656b){return db[_0xac0e('0x3e')]['create'](_0x784f9c['body'],{})[_0xac0e('0x2d')](function(_0x5cef6a){var _0x37ca90=_0x784f9c[_0xac0e('0x57')]['get']({'plain':!![]});if(!_0x37ca90)throw new Error(_0xac0e('0x58'));if(_0x37ca90[_0xac0e('0x59')]===_0xac0e('0x57')){var _0x466798=_0x5cef6a[_0xac0e('0x2f')]({'plain':!![]});var _0x145f3b='WhatsappQueues';return db[_0xac0e('0x5a')][_0xac0e('0x55')]({'where':{'name':_0x145f3b,'userProfileId':_0x37ca90['userProfileId']},'raw':!![]})[_0xac0e('0x2d')](function(_0x489eca){if(_0x489eca&&_0x489eca[_0xac0e('0x5b')]===0x0){return db[_0xac0e('0x31')]['create']({'name':_0x466798[_0xac0e('0x34')],'resourceId':_0x466798['id'],'type':_0x489eca[_0xac0e('0x34')],'sectionId':_0x489eca['id']},{})['then'](function(){return _0x5cef6a;});}else{return _0x5cef6a;}})[_0xac0e('0x56')](function(_0x5d588d){logger[_0xac0e('0x32')](_0xac0e('0x5c'),_0x5d588d);throw _0x5d588d;});}return _0x5cef6a;})['then'](respondWithResult(_0x48656b,0xc9))['catch'](handleError(_0x48656b,null));};exports[_0xac0e('0x5d')]=function(_0x102185,_0x2a1019){if(_0x102185[_0xac0e('0x36')]['id']){delete _0x102185['body']['id'];}return db[_0xac0e('0x3e')][_0xac0e('0x55')]({'where':{'id':_0x102185[_0xac0e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2a1019,null))[_0xac0e('0x2d')](saveUpdates(_0x102185['body'],null))[_0xac0e('0x2d')](respondWithResult(_0x2a1019,null))[_0xac0e('0x56')](handleError(_0x2a1019,null));};exports[_0xac0e('0x2e')]=function(_0x2d6c97,_0x2a358b){return db[_0xac0e('0x3e')][_0xac0e('0x55')]({'where':{'id':_0x2d6c97[_0xac0e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2a358b,null))['then'](removeEntity(_0x2a358b,null))[_0xac0e('0x56')](handleError(_0x2a358b,null));};exports[_0xac0e('0x5f')]=function(_0x5e6d27,_0x3d37bb){return db[_0xac0e('0x3e')][_0xac0e('0x5f')]()[_0xac0e('0x2d')](respondWithResult(_0x3d37bb,null))[_0xac0e('0x56')](handleError(_0x3d37bb,null));};exports['getMembers']=function(_0x1ac139,_0x12c76c,_0x161205){var _0x9249d2={'raw':!![],'where':{}},_0x5b1a99={},_0x28bfe4;return db[_0xac0e('0x3e')][_0xac0e('0x60')]({'where':{'id':_0x1ac139[_0xac0e('0x5e')]['id']}})[_0xac0e('0x2d')](handleEntityNotFound(_0x12c76c,null))['then'](function(_0x39712){if(_0x39712){_0x28bfe4=_0x39712[_0xac0e('0x2f')]({'plain':!![]});_0x5b1a99[_0xac0e('0x42')]=_[_0xac0e('0x44')](db['UserWhatsappQueue'][_0xac0e('0x3f')]);_0x5b1a99[_0xac0e('0x43')]=_['keys'](_0x1ac139[_0xac0e('0x43')]);_0x5b1a99[_0xac0e('0x45')]=_['intersection'](_0x5b1a99[_0xac0e('0x42')],_0x5b1a99[_0xac0e('0x43')]);_0x9249d2[_0xac0e('0x47')]=_[_0xac0e('0x46')](_0x5b1a99[_0xac0e('0x42')],qs[_0xac0e('0x61')](_0x1ac139[_0xac0e('0x43')][_0xac0e('0x61')]));_0x9249d2[_0xac0e('0x47')]=_0x9249d2[_0xac0e('0x47')][_0xac0e('0x54')]?_0x9249d2[_0xac0e('0x47')]:_0x5b1a99[_0xac0e('0x42')];if(!_0x1ac139['query']['hasOwnProperty'](_0xac0e('0x49'))){_0x9249d2[_0xac0e('0x26')]=qs[_0xac0e('0x26')](_0x1ac139[_0xac0e('0x43')]['limit']);_0x9249d2[_0xac0e('0x24')]=qs[_0xac0e('0x24')](_0x1ac139[_0xac0e('0x43')][_0xac0e('0x24')]);}_0x9249d2[_0xac0e('0x4a')]=qs['sort'](_0x1ac139[_0xac0e('0x43')][_0xac0e('0x4b')]);_0x9249d2[_0xac0e('0x4d')]=qs[_0xac0e('0x45')](_[_0xac0e('0x62')](_0x1ac139[_0xac0e('0x43')],_0x5b1a99[_0xac0e('0x45')]));_0x9249d2['where'][_0xac0e('0x63')]=_0x39712['id'];if(_0x1ac139['query'][_0xac0e('0x4c')]){_0x9249d2['where']=_[_0xac0e('0x4e')](_0x9249d2[_0xac0e('0x4d')],{'$or':_[_0xac0e('0x3d')](_0x9249d2[_0xac0e('0x47')],function(_0x3c4f7e){var _0x4fd163={};_0x4fd163[_0x3c4f7e]={'$like':'%'+_0x1ac139[_0xac0e('0x43')]['filter']+'%'};return _0x4fd163;})});}_0x9249d2=_['merge']({},_0x9249d2,_0x1ac139['options']);return db[_0xac0e('0x64')][_0xac0e('0x52')](_0x9249d2);}})[_0xac0e('0x2d')](function(_0x54b734){if(_0x54b734){return db['User'][_0xac0e('0x65')]({'where':{'id':_[_0xac0e('0x3d')](_0x54b734,_0xac0e('0x66')),'role':'agent'},'attributes':['id',_0xac0e('0x34'),_0xac0e('0x67'),_0xac0e('0x68'),_0xac0e('0x69')]});}})[_0xac0e('0x2d')](function(_0x39f4f5){if(_0x39f4f5){return{'count':_0x39f4f5['count'],'rows':_[_0xac0e('0x3d')](_0x39f4f5[_0xac0e('0x53')],function(_0x5ca2f5){return{'membername':_0x5ca2f5[_0xac0e('0x34')],'UserId':_0x5ca2f5['id'],'queue_name':_0x28bfe4[_0xac0e('0x34')],'WhatsappQueueId':_0x28bfe4['id'],'interface':util[_0xac0e('0x6a')](_0xac0e('0x6b'),'SIP',_0x5ca2f5[_0xac0e('0x34')]),'penalty':0x0,'paused':_0x5ca2f5[_0xac0e('0x67')],'createdAt':_0x5ca2f5[_0xac0e('0x69')],'updatedAt':_0x5ca2f5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xac0e('0x2d')](respondWithFilteredResult(_0x12c76c,_0x9249d2))[_0xac0e('0x56')](handleError(_0x12c76c,null));};exports['getTeams']=function(_0x172517,_0x3a59ca,_0x40dded){var _0x5873ec={};var _0x15d9ac={};var _0x22cc6e;var _0x34639d;return db[_0xac0e('0x3e')][_0xac0e('0x60')]({'where':{'id':_0x172517[_0xac0e('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3a59ca,null))[_0xac0e('0x2d')](function(_0x186810){if(_0x186810){_0x22cc6e=_0x186810;_0x15d9ac[_0xac0e('0x42')]=_[_0xac0e('0x44')](db[_0xac0e('0x6c')][_0xac0e('0x3f')]);_0x15d9ac[_0xac0e('0x43')]=_[_0xac0e('0x44')](_0x172517['query']);_0x15d9ac['filters']=_[_0xac0e('0x46')](_0x15d9ac[_0xac0e('0x42')],_0x15d9ac[_0xac0e('0x43')]);_0x5873ec[_0xac0e('0x47')]=_[_0xac0e('0x46')](_0x15d9ac[_0xac0e('0x42')],qs[_0xac0e('0x61')](_0x172517[_0xac0e('0x43')][_0xac0e('0x61')]));_0x5873ec[_0xac0e('0x47')]=_0x5873ec['attributes'][_0xac0e('0x54')]?_0x5873ec['attributes']:_0x15d9ac[_0xac0e('0x42')];_0x5873ec[_0xac0e('0x4a')]=qs[_0xac0e('0x4b')](_0x172517[_0xac0e('0x43')][_0xac0e('0x4b')]);_0x5873ec[_0xac0e('0x4d')]=qs[_0xac0e('0x45')](_[_0xac0e('0x62')](_0x172517[_0xac0e('0x43')],_0x15d9ac['filters']));if(_0x172517[_0xac0e('0x43')]['filter']){_0x5873ec[_0xac0e('0x4d')]=_[_0xac0e('0x4e')](_0x5873ec[_0xac0e('0x4d')],{'$or':_['map'](_0x5873ec['attributes'],function(_0x41abd7){var _0x3de031={};_0x3de031[_0x41abd7]={'$like':'%'+_0x172517[_0xac0e('0x43')][_0xac0e('0x4c')]+'%'};return _0x3de031;})});}_0x5873ec=_['merge']({},_0x5873ec,_0x172517[_0xac0e('0x50')]);return _0x22cc6e[_0xac0e('0x6d')](_0x5873ec);}})['then'](function(_0x2f1d82){if(_0x2f1d82){_0x34639d=_0x2f1d82[_0xac0e('0x54')];if(!_0x172517[_0xac0e('0x43')][_0xac0e('0x48')](_0xac0e('0x49'))){_0x5873ec[_0xac0e('0x26')]=qs[_0xac0e('0x26')](_0x172517['query'][_0xac0e('0x26')]);_0x5873ec[_0xac0e('0x24')]=qs[_0xac0e('0x24')](_0x172517[_0xac0e('0x43')][_0xac0e('0x24')]);}return _0x22cc6e['getTeams'](_0x5873ec);}})[_0xac0e('0x2d')](function(_0x285822){if(_0x285822){return _0x285822?{'count':_0x34639d,'rows':_0x285822}:null;}})[_0xac0e('0x2d')](respondWithResult(_0x3a59ca,null))[_0xac0e('0x56')](handleError(_0x3a59ca,null));};exports['addTeams']=function(_0x3cbce3,_0x3df9b9,_0x49d443){var _0x5889ec=_0x3cbce3[_0xac0e('0x36')][_0xac0e('0x6e')];return db[_0xac0e('0x6c')][_0xac0e('0x52')]({'where':{'id':_0x5889ec},'attributes':['id'],'include':[{'model':db[_0xac0e('0x6f')],'as':_0xac0e('0x70'),'attributes':['id',_0xac0e('0x34'),'online',_0xac0e('0x71'),_0xac0e('0x72')],'raw':!![]}]})['then'](function(_0x5cb3eb){if(_0x5cb3eb){var _0x1021b1=_[_0xac0e('0x73')](_0x5cb3eb,function(_0x42da55){var _0x4656cc=_0x42da55[_0xac0e('0x2f')]({'plain':!![]});return _0x4656cc[_0xac0e('0x70')];});return db[_0xac0e('0x3e')]['find']({'where':{'id':_0x3cbce3[_0xac0e('0x5e')]['id']}})[_0xac0e('0x2d')](function(_0x326cad){return db['sequelize']['transaction'](function(_0xf2584c){return _0x326cad['addTeams'](_0x5889ec,{'transaction':_0xf2584c})[_0xac0e('0x2d')](function(){return BPromise['each'](_0x1021b1,function(_0x3bc137){return db[_0xac0e('0x64')][_0xac0e('0x74')]({'where':{'UserId':_0x3bc137['id'],'WhatsappQueueId':_0x3cbce3['params']['id']},'transaction':_0xf2584c});});})[_0xac0e('0x2d')](function(){_0x1021b1['forEach'](function(_0x48c04e){socket[_0xac0e('0x75')](_0xac0e('0x76'),{'UserId':_0x48c04e['id'],'WhatsappQueueId':_0x326cad['id']});});});});});}})[_0xac0e('0x2d')](respondWithStatusCode(_0x3df9b9,null))[_0xac0e('0x56')](handleError(_0x3df9b9,null));};exports['removeTeams']=function(_0x342fa1,_0x281c50,_0x3e3440){return db[_0xac0e('0x6c')][_0xac0e('0x52')]({'where':{'id':_0x342fa1[_0xac0e('0x43')][_0xac0e('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xac0e('0x6f')],'as':_0xac0e('0x70'),'attributes':['id'],'raw':!![]}]})[_0xac0e('0x2d')](handleEntityNotFound(_0x281c50,null))[_0xac0e('0x2d')](function(_0x2359e1){var _0x3ed16b=_[_0xac0e('0x3d')](_0x2359e1,'id');var _0x131544=[];var _0x55285d=[];var _0x223b28=squel['select']();_0x223b28[_0xac0e('0x77')](_0xac0e('0x78'))[_0xac0e('0x79')](_0xac0e('0x7a'),'tq')['join']('user_has_teams','ut',_0xac0e('0x7b'))[_0xac0e('0x4d')](_0xac0e('0x7c'),_0x342fa1['params']['id']);for(var _0x233434=0x0;_0x233434<_0x2359e1[_0xac0e('0x54')];_0x233434+=0x1){let _0xb50a5f=_0x2359e1[_0x233434];for(var _0x57c3a4=0x0;_0x57c3a4<_0xb50a5f[_0xac0e('0x70')][_0xac0e('0x54')];_0x57c3a4+=0x1){let _0x4b6407=_0xb50a5f[_0xac0e('0x70')][_0x57c3a4];var _0x501238=_0x223b28[_0xac0e('0x7d')]();_0x501238[_0xac0e('0x4d')](_0xac0e('0x7e'),_0x4b6407['id']);_0x55285d[_0xac0e('0x7f')](db[_0xac0e('0x80')][_0xac0e('0x43')](_0x501238[_0xac0e('0x81')](),{'type':db[_0xac0e('0x80')][_0xac0e('0x82')][_0xac0e('0x83')]})[_0xac0e('0x2d')](function(_0x3c5915){if(_0x3c5915[_0xac0e('0x54')]===0x1){return _0x4b6407['id'];}else{var _0x56b38e=_[_0xac0e('0x84')](_[_0xac0e('0x3d')](_0x3c5915,_0xac0e('0x85')),function(_0x544e12){return _[_0xac0e('0x86')](_0x3ed16b,_0x544e12);});if(_0x56b38e){return _0x4b6407['id'];}}}));}}return BPromise['all'](_0x55285d)[_0xac0e('0x2d')](function(_0x650671){_0x131544=_(_0x131544)['union'](_0x650671)[_0xac0e('0x87')]()[_0xac0e('0x88')]();return db[_0xac0e('0x3e')]['find']({'where':{'id':_0x342fa1['params']['id']}})[_0xac0e('0x2d')](function(_0x462527){return db[_0xac0e('0x80')][_0xac0e('0x89')](function(_0x375b04){return _0x462527[_0xac0e('0x8a')](_0x342fa1[_0xac0e('0x43')]['ids'],{'transaction':_0x375b04})[_0xac0e('0x2d')](function(){if(!_[_0xac0e('0x8b')](_0x131544)){return _0x462527[_0xac0e('0x8c')](_0x131544,{'transaction':_0x375b04});}})['then'](function(){_0x131544[_0xac0e('0x8d')](function(_0x535aab){socket[_0xac0e('0x75')](_0xac0e('0x8e'),{'UserId':_0x535aab,'WhatsappQueueId':_0x462527['id']});});});});});});})[_0xac0e('0x2d')](respondWithStatusCode(_0x281c50,null))['catch'](handleError(_0x281c50,null));};exports[_0xac0e('0x8f')]=function(_0x348ff7,_0x118ccd,_0x20791a){return db[_0xac0e('0x3e')][_0xac0e('0x55')]({'where':{'id':_0x348ff7['params']['id']}})[_0xac0e('0x2d')](handleEntityNotFound(_0x118ccd,null))[_0xac0e('0x2d')](function(_0x2fbdf0){if(_0x2fbdf0){return _0x2fbdf0[_0xac0e('0x8f')](_0x348ff7[_0xac0e('0x36')]['ids'],_[_0xac0e('0x90')](_0x348ff7[_0xac0e('0x36')],[_0xac0e('0x6e'),'id'])||{})[_0xac0e('0x91')](function(_0xc023f6){for(var _0x2a839b=0x0;_0x2a839b<_0x348ff7[_0xac0e('0x36')]['ids'][_0xac0e('0x54')];_0x2a839b+=0x1){socket['emit'](_0xac0e('0x76'),{'UserId':_0x348ff7[_0xac0e('0x36')][_0xac0e('0x6e')][_0x2a839b],'WhatsappQueueId':_0x348ff7['params']['id']});}return _0xc023f6;});}})['then'](respondWithResult(_0x118ccd,null))[_0xac0e('0x56')](handleError(_0x118ccd,null));};exports[_0xac0e('0x8c')]=function(_0x3601c6,_0x325375,_0xe48fdb){return db[_0xac0e('0x3e')][_0xac0e('0x55')]({'where':{'id':_0x3601c6['params']['id']}})['then'](handleEntityNotFound(_0x325375,null))['then'](function(_0x218f96){if(_0x218f96){return _0x218f96[_0xac0e('0x8c')](_0x3601c6[_0xac0e('0x43')]['ids'])['then'](function(){if(_[_0xac0e('0x92')](_0x3601c6['query'][_0xac0e('0x6e')])){for(var _0x232981=0x0;_0x232981<_0x3601c6[_0xac0e('0x43')]['ids'][_0xac0e('0x54')];_0x232981+=0x1){socket['emit'](_0xac0e('0x8e'),{'UserId':Number(_0x3601c6[_0xac0e('0x43')][_0xac0e('0x6e')][_0x232981]),'WhatsappQueueId':Number(_0x3601c6[_0xac0e('0x5e')]['id'])});}}else{socket[_0xac0e('0x75')](_0xac0e('0x8e'),{'UserId':Number(_0x3601c6[_0xac0e('0x43')][_0xac0e('0x6e')]),'WhatsappQueueId':Number(_0x3601c6[_0xac0e('0x5e')]['id'])});}});}})[_0xac0e('0x2d')](respondWithStatusCode(_0x325375,null))[_0xac0e('0x56')](handleError(_0x325375,null));};exports[_0xac0e('0x93')]=function(_0x9aed9e,_0x46cf6f,_0x2c062e){var _0x21ef6b={};var _0x36eecb={};var _0x56dd01;var _0x5f3582;return db['WhatsappQueue']['findOne']({'where':{'id':_0x9aed9e['params']['id']}})['then'](handleEntityNotFound(_0x46cf6f,null))[_0xac0e('0x2d')](function(_0xa6d65c){if(_0xa6d65c){_0x56dd01=_0xa6d65c;_0x36eecb[_0xac0e('0x42')]=_[_0xac0e('0x44')](db[_0xac0e('0x6f')][_0xac0e('0x3f')]);_0x36eecb[_0xac0e('0x43')]=_[_0xac0e('0x44')](_0x9aed9e['query']);_0x36eecb[_0xac0e('0x45')]=_[_0xac0e('0x46')](_0x36eecb[_0xac0e('0x42')],_0x36eecb[_0xac0e('0x43')]);_0x21ef6b['attributes']=_[_0xac0e('0x46')](_0x36eecb[_0xac0e('0x42')],qs[_0xac0e('0x61')](_0x9aed9e[_0xac0e('0x43')][_0xac0e('0x61')]));_0x21ef6b[_0xac0e('0x47')]=_0x21ef6b[_0xac0e('0x47')]['length']?_0x21ef6b['attributes']:_0x36eecb['model'];_0x21ef6b['order']=qs[_0xac0e('0x4b')](_0x9aed9e[_0xac0e('0x43')]['sort']);_0x21ef6b[_0xac0e('0x4d')]=qs[_0xac0e('0x45')](_[_0xac0e('0x62')](_0x9aed9e[_0xac0e('0x43')],_0x36eecb[_0xac0e('0x45')]));if(_0x9aed9e[_0xac0e('0x43')]['filter']){_0x21ef6b[_0xac0e('0x4d')]=_[_0xac0e('0x4e')](_0x21ef6b['where'],{'$or':_[_0xac0e('0x3d')](_0x21ef6b[_0xac0e('0x47')],function(_0x725fd0){var _0x522ca3={};_0x522ca3[_0x725fd0]={'$like':'%'+_0x9aed9e[_0xac0e('0x43')][_0xac0e('0x4c')]+'%'};return _0x522ca3;})});}_0x21ef6b=_[_0xac0e('0x4e')]({},_0x21ef6b,_0x9aed9e[_0xac0e('0x50')]);return _0x56dd01[_0xac0e('0x93')](_0x21ef6b);}})[_0xac0e('0x2d')](function(_0x1a17e4){if(_0x1a17e4){_0x5f3582=_0x1a17e4[_0xac0e('0x54')];if(!_0x9aed9e[_0xac0e('0x43')][_0xac0e('0x48')]('nolimit')){_0x21ef6b[_0xac0e('0x26')]=qs[_0xac0e('0x26')](_0x9aed9e[_0xac0e('0x43')][_0xac0e('0x26')]);_0x21ef6b[_0xac0e('0x24')]=qs[_0xac0e('0x24')](_0x9aed9e['query'][_0xac0e('0x24')]);}return _0x56dd01[_0xac0e('0x93')](_0x21ef6b);}})['then'](function(_0xd28ae3){if(_0xd28ae3){return _0xd28ae3?{'count':_0x5f3582,'rows':_0xd28ae3}:null;}})[_0xac0e('0x2d')](respondWithResult(_0x46cf6f,null))[_0xac0e('0x56')](handleError(_0x46cf6f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 5293b90..da73026 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1857=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1857,0x17a));var _0x7185=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1857[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x7185('0x0'));var WhatsappQueue=require(_0x7185('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7185('0x2')](0x0);var events={'afterCreate':_0x7185('0x3'),'afterUpdate':_0x7185('0x4'),'afterDestroy':'remove'};function emitEvent(_0x27f285){return function(_0x3a473f,_0x15586e,_0x368e4e){WhatsappQueueEvents[_0x7185('0x5')](_0x27f285+':'+_0x3a473f['id'],_0x3a473f);WhatsappQueueEvents[_0x7185('0x5')](_0x27f285,_0x3a473f);_0x368e4e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x7185('0x6')](e,emitEvent(event));}}module[_0x7185('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4ad8=['remove','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners','save','update'];(function(_0x4be0de,_0x411b20){var _0x3f4e84=function(_0x2f2a1c){while(--_0x2f2a1c){_0x4be0de['push'](_0x4be0de['shift']());}};_0x3f4e84(++_0x411b20);}(_0x4ad8,0x136));var _0x84ad=function(_0x4ef152,_0x2387f6){_0x4ef152=_0x4ef152-0x0;var _0x2ed717=_0x4ad8[_0x4ef152];return _0x2ed717;};'use strict';var EventEmitter=require(_0x84ad('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x84ad('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x84ad('0x2')](0x0);var events={'afterCreate':_0x84ad('0x3'),'afterUpdate':_0x84ad('0x4'),'afterDestroy':_0x84ad('0x5')};function emitEvent(_0x1527cd){return function(_0x244f4b,_0x1e77fd,_0xaa8900){WhatsappQueueEvents['emit'](_0x1527cd+':'+_0x244f4b['id'],_0x244f4b);WhatsappQueueEvents['emit'](_0x1527cd,_0x244f4b);_0xaa8900(null);};}for(var e in events){if(events[_0x84ad('0x6')](e)){var event=events[e];WhatsappQueue[_0x84ad('0x7')](e,emitEvent(event));}}module[_0x84ad('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index c3be13d..f70b91c 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea8d=['define','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x4d4ad6,_0x58d5a2){var _0x1f1898=function(_0x3a45a2){while(--_0x3a45a2){_0x4d4ad6['push'](_0x4d4ad6['shift']());}};_0x1f1898(++_0x58d5a2);}(_0xea8d,0x8e));var _0xdea8=function(_0x40ca84,_0x5ea1f2){_0x40ca84=_0x40ca84-0x0;var _0x21ed2b=_0xea8d[_0x40ca84];return _0x21ed2b;};'use strict';var _=require(_0xdea8('0x0'));var util=require(_0xdea8('0x1'));var logger=require(_0xdea8('0x2'))(_0xdea8('0x3'));var moment=require(_0xdea8('0x4'));var BPromise=require(_0xdea8('0x5'));var rp=require(_0xdea8('0x6'));var fs=require('fs');var path=require(_0xdea8('0x7'));var rimraf=require(_0xdea8('0x8'));var config=require(_0xdea8('0x9'));var attributes=require(_0xdea8('0xa'));module[_0xdea8('0xb')]=function(_0x2ebe4b,_0x49e4ec){return _0x2ebe4b[_0xdea8('0xc')]('WhatsappQueue',attributes,{'tableName':_0xdea8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd329=['exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c0ff4,_0x5b96fb){var _0x56da2e=function(_0x550d8b){while(--_0x550d8b){_0x5c0ff4['push'](_0x5c0ff4['shift']());}};_0x56da2e(++_0x5b96fb);}(_0xd329,0xac));var _0x9d32=function(_0x1c9821,_0x433a98){_0x1c9821=_0x1c9821-0x0;var _0x349546=_0xd329[_0x1c9821];return _0x349546;};'use strict';var _=require(_0x9d32('0x0'));var util=require(_0x9d32('0x1'));var logger=require(_0x9d32('0x2'))(_0x9d32('0x3'));var moment=require(_0x9d32('0x4'));var BPromise=require(_0x9d32('0x5'));var rp=require(_0x9d32('0x6'));var fs=require('fs');var path=require(_0x9d32('0x7'));var rimraf=require(_0x9d32('0x8'));var config=require(_0x9d32('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0x9d32('0xa')]=function(_0x2e8c7f,_0x5a948c){return _0x2e8c7f['define'](_0x9d32('0xb'),attributes,{'tableName':_0x9d32('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 7edaa52..d6145ae 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd608=['socket.io-emitter','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowWhatsappQueue','find','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xd608,0x11d));var _0x8d60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd608[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8d60('0x0'));var moment=require(_0x8d60('0x1'));var BPromise=require(_0x8d60('0x2'));var rs=require(_0x8d60('0x3'));var fs=require('fs');var Redis=require(_0x8d60('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8d60('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8d60('0x6')][_0x8d60('0x7')]({'port':0x232a});config[_0x8d60('0x8')]=_[_0x8d60('0x9')](config['redis'],{'host':_0x8d60('0xa'),'port':0x18eb});var socket=require(_0x8d60('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8d60('0xc')](socket);function respondWithRpcPromise(_0x4ba945,_0x3cfc69,_0x2fd461){return new BPromise(function(_0x5f4712,_0x840322){return client[_0x8d60('0xd')](_0x4ba945,_0x2fd461)['then'](function(_0x1f2a50){logger['info'](_0x8d60('0xe'),_0x3cfc69,'request\x20sent');logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3cfc69,_0x8d60('0xf'),JSON[_0x8d60('0x10')](_0x1f2a50));if(_0x1f2a50[_0x8d60('0x11')]){if(_0x1f2a50[_0x8d60('0x11')]['code']===0x1f4){logger['error'](_0x8d60('0xe'),_0x3cfc69,_0x1f2a50['error']['message']);return _0x840322(_0x1f2a50[_0x8d60('0x11')][_0x8d60('0x12')]);}logger[_0x8d60('0x11')](_0x8d60('0xe'),_0x3cfc69,_0x1f2a50[_0x8d60('0x11')][_0x8d60('0x12')]);return _0x5f4712(_0x1f2a50[_0x8d60('0x11')][_0x8d60('0x12')]);}else{logger[_0x8d60('0x13')](_0x8d60('0xe'),_0x3cfc69,_0x8d60('0xf'));_0x5f4712(_0x1f2a50[_0x8d60('0x14')]['message']);}})[_0x8d60('0x15')](function(_0x3a9f2b){logger[_0x8d60('0x11')](_0x8d60('0xe'),_0x3cfc69,_0x3a9f2b);_0x840322(_0x3a9f2b);});});}exports[_0x8d60('0x16')]=function(_0x24bd2a){var _0x15d1bf=this;return new Promise(function(_0x10e91b,_0x4ed0ef){return db[_0x8d60('0x17')][_0x8d60('0x18')]({'raw':_0x24bd2a[_0x8d60('0x19')]?_0x24bd2a[_0x8d60('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x24bd2a['options']?_0x24bd2a['options'][_0x8d60('0x1a')]||null:null,'attributes':_0x24bd2a[_0x8d60('0x19')]?_0x24bd2a['options'][_0x8d60('0x1b')]||null:null,'limit':_0x24bd2a['options']?_0x24bd2a[_0x8d60('0x19')][_0x8d60('0x1c')]||null:null,'include':_0x24bd2a['options']?_0x24bd2a[_0x8d60('0x19')][_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x24bd2a[_0x8d60('0x19')][_0x8d60('0x1d')],function(_0x56897e){return{'model':db[_0x56897e['model']],'as':_0x56897e['as'],'attributes':_0x56897e['attributes'],'include':_0x56897e[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x56897e[_0x8d60('0x1d')],function(_0x18e933){return{'model':db[_0x18e933[_0x8d60('0x1f')]],'as':_0x18e933['as'],'attributes':_0x18e933[_0x8d60('0x1b')],'include':_0x18e933[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x18e933[_0x8d60('0x1d')],function(_0x8d473d){return{'model':db[_0x8d473d[_0x8d60('0x1f')]],'as':_0x8d473d['as'],'attributes':_0x8d473d[_0x8d60('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d60('0x20')](function(_0x2a12b7){logger[_0x8d60('0x13')]('GetWhatsappQueue',_0x24bd2a);logger['debug']('GetWhatsappQueue',_0x24bd2a,JSON[_0x8d60('0x10')](_0x2a12b7));_0x10e91b(_0x2a12b7);})[_0x8d60('0x15')](function(_0x422de0){logger[_0x8d60('0x11')](_0x8d60('0x16'),_0x422de0[_0x8d60('0x12')],_0x24bd2a);_0x4ed0ef(_0x15d1bf[_0x8d60('0x11')](0x1f4,_0x422de0[_0x8d60('0x12')]));});});};exports[_0x8d60('0x21')]=function(_0x22d27b){var _0x37944e=this;return new Promise(function(_0x53203f,_0x2e9294){return db[_0x8d60('0x17')][_0x8d60('0x22')]({'raw':_0x22d27b[_0x8d60('0x19')]?_0x22d27b['options'][_0x8d60('0x23')]===undefined?!![]:![]:!![],'where':_0x22d27b[_0x8d60('0x19')]?_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1a')]||null:null,'attributes':_0x22d27b[_0x8d60('0x19')]?_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1b')]||null:null,'include':_0x22d27b[_0x8d60('0x19')]?_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x22d27b[_0x8d60('0x19')][_0x8d60('0x1d')],function(_0x7f0fa6){return{'model':db[_0x7f0fa6[_0x8d60('0x1f')]],'as':_0x7f0fa6['as'],'attributes':_0x7f0fa6[_0x8d60('0x1b')],'include':_0x7f0fa6[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x7f0fa6['include'],function(_0x2335e8){return{'model':db[_0x2335e8[_0x8d60('0x1f')]],'as':_0x2335e8['as'],'attributes':_0x2335e8[_0x8d60('0x1b')],'include':_0x2335e8[_0x8d60('0x1d')]?_[_0x8d60('0x1e')](_0x2335e8[_0x8d60('0x1d')],function(_0x14f96c){return{'model':db[_0x14f96c['model']],'as':_0x14f96c['as'],'attributes':_0x14f96c[_0x8d60('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8d60('0x20')](function(_0x4818d5){logger[_0x8d60('0x13')](_0x8d60('0x21'),_0x22d27b);logger[_0x8d60('0x24')](_0x8d60('0x21'),_0x22d27b,JSON[_0x8d60('0x10')](_0x4818d5));_0x53203f(_0x4818d5);})['catch'](function(_0x176ba4){logger[_0x8d60('0x11')](_0x8d60('0x21'),_0x176ba4['message'],_0x22d27b);_0x2e9294(_0x37944e[_0x8d60('0x11')](0x1f4,_0x176ba4[_0x8d60('0x12')]));});});}; \ No newline at end of file +var _0x533c=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','localhost','socket.io-emitter','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','find','then','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring'];(function(_0x465836,_0x1fa2c9){var _0x91e8d6=function(_0x2ffae0){while(--_0x2ffae0){_0x465836['push'](_0x465836['shift']());}};_0x91e8d6(++_0x1fa2c9);}(_0x533c,0xb9));var _0xc533=function(_0x287c47,_0x3eb4f3){_0x287c47=_0x287c47-0x0;var _0x47c234=_0x533c[_0x287c47];return _0x47c234;};'use strict';var _=require(_0xc533('0x0'));var util=require(_0xc533('0x1'));var moment=require(_0xc533('0x2'));var BPromise=require(_0xc533('0x3'));var rs=require(_0xc533('0x4'));var fs=require('fs');var Redis=require(_0xc533('0x5'));var db=require(_0xc533('0x6'))['db'];var utils=require(_0xc533('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc533('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc533('0x9')]['http']({'port':0x232a});config[_0xc533('0xa')]=_['defaults'](config[_0xc533('0xa')],{'host':_0xc533('0xb'),'port':0x18eb});var socket=require(_0xc533('0xc'))(new Redis(config[_0xc533('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x104fe6,_0x58b345,_0x5858b0){return new BPromise(function(_0x3f1bff,_0x2ca874){return client['request'](_0x104fe6,_0x5858b0)['then'](function(_0x2d79f5){logger[_0xc533('0xd')](_0xc533('0xe'),_0x58b345,'request\x20sent');logger[_0xc533('0xf')](_0xc533('0x10'),_0x58b345,_0xc533('0x11'),JSON[_0xc533('0x12')](_0x2d79f5));if(_0x2d79f5[_0xc533('0x13')]){if(_0x2d79f5[_0xc533('0x13')][_0xc533('0x14')]===0x1f4){logger[_0xc533('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x58b345,_0x2d79f5[_0xc533('0x13')]['message']);return _0x2ca874(_0x2d79f5[_0xc533('0x13')][_0xc533('0x15')]);}logger['error'](_0xc533('0xe'),_0x58b345,_0x2d79f5[_0xc533('0x13')]['message']);return _0x3f1bff(_0x2d79f5[_0xc533('0x13')][_0xc533('0x15')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x58b345,_0xc533('0x11'));_0x3f1bff(_0x2d79f5[_0xc533('0x16')][_0xc533('0x15')]);}})[_0xc533('0x17')](function(_0xe6652f){logger[_0xc533('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x58b345,_0xe6652f);_0x2ca874(_0xe6652f);});});}exports[_0xc533('0x18')]=function(_0x4d2ca2){var _0x292108=this;return new Promise(function(_0x271c47,_0x49863e){return db[_0xc533('0x19')][_0xc533('0x1a')]({'raw':_0x4d2ca2['options']?_0x4d2ca2[_0xc533('0x1b')][_0xc533('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d2ca2[_0xc533('0x1b')]?_0x4d2ca2['options'][_0xc533('0x1d')]||null:null,'attributes':_0x4d2ca2[_0xc533('0x1b')]?_0x4d2ca2[_0xc533('0x1b')][_0xc533('0x1e')]||null:null,'limit':_0x4d2ca2[_0xc533('0x1b')]?_0x4d2ca2['options'][_0xc533('0x1f')]||null:null,'include':_0x4d2ca2[_0xc533('0x1b')]?_0x4d2ca2[_0xc533('0x1b')][_0xc533('0x20')]?_['map'](_0x4d2ca2['options'][_0xc533('0x20')],function(_0x4c314){return{'model':db[_0x4c314[_0xc533('0x21')]],'as':_0x4c314['as'],'attributes':_0x4c314[_0xc533('0x1e')],'include':_0x4c314[_0xc533('0x20')]?_['map'](_0x4c314[_0xc533('0x20')],function(_0x5e4ca7){return{'model':db[_0x5e4ca7['model']],'as':_0x5e4ca7['as'],'attributes':_0x5e4ca7[_0xc533('0x1e')],'include':_0x5e4ca7[_0xc533('0x20')]?_[_0xc533('0x22')](_0x5e4ca7[_0xc533('0x20')],function(_0x1623c7){return{'model':db[_0x1623c7[_0xc533('0x21')]],'as':_0x1623c7['as'],'attributes':_0x1623c7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4328ce){logger[_0xc533('0xd')](_0xc533('0x18'),_0x4d2ca2);logger[_0xc533('0xf')](_0xc533('0x18'),_0x4d2ca2,JSON['stringify'](_0x4328ce));_0x271c47(_0x4328ce);})[_0xc533('0x17')](function(_0xe1f8ae){logger['error']('GetWhatsappQueue',_0xe1f8ae[_0xc533('0x15')],_0x4d2ca2);_0x49863e(_0x292108[_0xc533('0x13')](0x1f4,_0xe1f8ae[_0xc533('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x1a8671){var _0x123abc=this;return new Promise(function(_0x576ce0,_0x528116){return db[_0xc533('0x19')][_0xc533('0x23')]({'raw':_0x1a8671['options']?_0x1a8671[_0xc533('0x1b')][_0xc533('0x1c')]===undefined?!![]:![]:!![],'where':_0x1a8671[_0xc533('0x1b')]?_0x1a8671[_0xc533('0x1b')]['where']||null:null,'attributes':_0x1a8671[_0xc533('0x1b')]?_0x1a8671['options'][_0xc533('0x1e')]||null:null,'include':_0x1a8671[_0xc533('0x1b')]?_0x1a8671['options'][_0xc533('0x20')]?_[_0xc533('0x22')](_0x1a8671[_0xc533('0x1b')]['include'],function(_0x3dafbe){return{'model':db[_0x3dafbe['model']],'as':_0x3dafbe['as'],'attributes':_0x3dafbe[_0xc533('0x1e')],'include':_0x3dafbe[_0xc533('0x20')]?_['map'](_0x3dafbe[_0xc533('0x20')],function(_0xdc6ee4){return{'model':db[_0xdc6ee4[_0xc533('0x21')]],'as':_0xdc6ee4['as'],'attributes':_0xdc6ee4['attributes'],'include':_0xdc6ee4[_0xc533('0x20')]?_[_0xc533('0x22')](_0xdc6ee4[_0xc533('0x20')],function(_0xa8df34){return{'model':db[_0xa8df34[_0xc533('0x21')]],'as':_0xa8df34['as'],'attributes':_0xa8df34[_0xc533('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc533('0x24')](function(_0x2e9b88){logger[_0xc533('0xd')](_0xc533('0x25'),_0x1a8671);logger['debug'](_0xc533('0x25'),_0x1a8671,JSON[_0xc533('0x12')](_0x2e9b88));_0x576ce0(_0x2e9b88);})[_0xc533('0x17')](function(_0x102f25){logger[_0xc533('0x13')](_0xc533('0x25'),_0x102f25[_0xc533('0x15')],_0x1a8671);_0x528116(_0x123abc[_0xc533('0x13')](0x1f4,_0x102f25[_0xc533('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b003402..33c444d 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c33=['emit','length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0x11b7de,_0x2316fb){var _0x46d94a=function(_0x2d64c0){while(--_0x2d64c0){_0x11b7de['push'](_0x11b7de['shift']());}};_0x46d94a(++_0x2316fb);}(_0x4c33,0x93));var _0x34c3=function(_0x3f8184,_0x4f443a){_0x3f8184=_0x3f8184-0x0;var _0x2cbc73=_0x4c33[_0x3f8184];return _0x2cbc73;};'use strict';var WhatsappQueueEvents=require(_0x34c3('0x0'));var events=['save',_0x34c3('0x1'),_0x34c3('0x2')];function createListener(_0x2d9061,_0x23d1a0){return function(_0x5a14e5){_0x23d1a0[_0x34c3('0x3')](_0x2d9061,_0x5a14e5);};}function removeListener(_0x3f319d,_0x452e82){return function(){WhatsappQueueEvents['removeListener'](_0x3f319d,_0x452e82);};}exports['register']=function(_0x42ce71){for(var _0x5550ea=0x0,_0x2b6638=events[_0x34c3('0x4')];_0x5550ea<_0x2b6638;_0x5550ea++){var _0x134c9d=events[_0x5550ea];var _0x23b22f=createListener(_0x34c3('0x5')+_0x134c9d,_0x42ce71);WhatsappQueueEvents['on'](_0x134c9d,_0x23b22f);}}; \ No newline at end of file +var _0xc732=['save','remove','update','emit','register','length','./whatsappQueue.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc732,0xa7));var _0x2c73=function(_0xb14e75,_0x2db4fe){_0xb14e75=_0xb14e75-0x0;var _0x460f73=_0xc732[_0xb14e75];return _0x460f73;};'use strict';var WhatsappQueueEvents=require(_0x2c73('0x0'));var events=[_0x2c73('0x1'),_0x2c73('0x2'),_0x2c73('0x3')];function createListener(_0x33d205,_0x20fbcb){return function(_0x139b9f){_0x20fbcb[_0x2c73('0x4')](_0x33d205,_0x139b9f);};}function removeListener(_0xb5962c,_0x1613e6){return function(){WhatsappQueueEvents['removeListener'](_0xb5962c,_0x1613e6);};}exports[_0x2c73('0x5')]=function(_0x495812){for(var _0x1ccb09=0x0,_0x554515=events[_0x2c73('0x6')];_0x1ccb09<_0x554515;_0x1ccb09++){var _0x1e192e=events[_0x1ccb09];var _0x3f5275=createListener('whatsappQueue:'+_0x1e192e,_0x495812);WhatsappQueueEvents['on'](_0x1e192e,_0x3f5275);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3d1ea74..637c92d 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb677=['../../config/environment','get','isAuthenticated','index','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x51e7d5,_0x4651b2){var _0x7e0d83=function(_0x53c4a8){while(--_0x53c4a8){_0x51e7d5['push'](_0x51e7d5['shift']());}};_0x7e0d83(++_0x4651b2);}(_0xb677,0x119));var _0x7b67=function(_0x3a8169,_0x504022){_0x3a8169=_0x3a8169-0x0;var _0x545328=_0xb677[_0x3a8169];return _0x545328;};'use strict';var multer=require(_0x7b67('0x0'));var util=require('util');var path=require(_0x7b67('0x1'));var timeout=require(_0x7b67('0x2'));var express=require(_0x7b67('0x3'));var router=express[_0x7b67('0x4')]();var fs_extra=require(_0x7b67('0x5'));var auth=require(_0x7b67('0x6'));var interaction=require(_0x7b67('0x7'));var config=require(_0x7b67('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x7b67('0x9')]('/',auth[_0x7b67('0xa')](),controller[_0x7b67('0xb')]);router[_0x7b67('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7b67('0x9')]('/:id',auth[_0x7b67('0xa')](),controller['show']);router[_0x7b67('0xc')]('/',auth[_0x7b67('0xa')](),controller['create']);router[_0x7b67('0xd')]('/:id',auth[_0x7b67('0xa')](),controller[_0x7b67('0xe')]);router[_0x7b67('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7b67('0x10')]=router; \ No newline at end of file +var _0xcea2=['create','put','update','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcea2,0x15a));var _0x2cea=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xcea2[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0xe')]('/',auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x11')]);router['delete']('/:id',auth[_0x2cea('0x8')](),controller[_0x2cea('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index a88dc00..74f72f7 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0xf3cd[_0x271537];return _0x19dc22;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file +var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x5d7bd1,_0x5361f5){var _0x3cb039=function(_0x1fb957){while(--_0x1fb957){_0x5d7bd1['push'](_0x5d7bd1['shift']());}};_0x3cb039(++_0x5361f5);}(_0x00bb,0x1d8));var _0xb00b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x00bb[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'uniqueid':{'type':Sequelize[_0xb00b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb00b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb00b('0x3')]},'exitAt':{'type':Sequelize[_0xb00b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f6e11e4..c887290 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb3b=['show','params','options','find','create','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','render','merge','body','contact','message','interaction','account','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','includeAll','include','findAll','rows','catch'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xdb3b,0xac));var _0xbdb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb3b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xbdb3('0x0'));var rimraf=require(_0xbdb3('0x1'));var zipdir=require(_0xbdb3('0x2'));var jsonpatch=require(_0xbdb3('0x3'));var rp=require(_0xbdb3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbdb3('0x5'));var util=require(_0xbdb3('0x6'));var path=require(_0xbdb3('0x7'));var sox=require(_0xbdb3('0x8'));var csv=require(_0xbdb3('0x9'));var ejs=require(_0xbdb3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbdb3('0xb'));var squel=require(_0xbdb3('0xc'));var crypto=require(_0xbdb3('0xd'));var jsforce=require(_0xbdb3('0xe'));var deskjs=require(_0xbdb3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbdb3('0x10'));var Papa=require(_0xbdb3('0x11'));var Redis=require(_0xbdb3('0x12'));var authService=require(_0xbdb3('0x13'));var qs=require(_0xbdb3('0x14'));var as=require(_0xbdb3('0x15'));var hardwareService=require(_0xbdb3('0x16'));var logger=require('../../config/logger')(_0xbdb3('0x17'));var utils=require(_0xbdb3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xbdb3('0x19'));var db=require(_0xbdb3('0x1a'))['db'];function respondWithStatusCode(_0x1db3c0,_0x56f4fc){_0x56f4fc=_0x56f4fc||0xcc;return function(_0x27b1a4){if(_0x27b1a4){return _0x1db3c0[_0xbdb3('0x1b')](_0x56f4fc);}return _0x1db3c0['status'](_0x56f4fc)['end']();};}function respondWithResult(_0x249588,_0x36856e){_0x36856e=_0x36856e||0xc8;return function(_0x5ba8b1){if(_0x5ba8b1){return _0x249588[_0xbdb3('0x1c')](_0x36856e)[_0xbdb3('0x1d')](_0x5ba8b1);}};}function respondWithFilteredResult(_0x285388,_0xa526c8){return function(_0x1603ef){if(_0x1603ef){var _0xda0f29=typeof _0xa526c8[_0xbdb3('0x1e')]===_0xbdb3('0x1f')&&typeof _0xa526c8[_0xbdb3('0x20')]===_0xbdb3('0x1f');var _0x454b2a=_0x1603ef[_0xbdb3('0x21')];var _0x4f87c5=_0xda0f29?0x0:_0xa526c8[_0xbdb3('0x1e')];var _0x38b6aa=_0xda0f29?_0x1603ef['count']:_0xa526c8['offset']+_0xa526c8[_0xbdb3('0x20')];var _0x236998;if(_0x38b6aa>=_0x454b2a){_0x38b6aa=_0x454b2a;_0x236998=0xc8;}else{_0x236998=0xce;}_0x285388[_0xbdb3('0x1c')](_0x236998);return _0x285388[_0xbdb3('0x22')](_0xbdb3('0x23'),_0x4f87c5+'-'+_0x38b6aa+'/'+_0x454b2a)[_0xbdb3('0x1d')](_0x1603ef);}return null;};}function patchUpdates(_0x2e2e6e){return function(_0x1e07a7){try{jsonpatch['apply'](_0x1e07a7,_0x2e2e6e,!![]);}catch(_0x24b655){return BPromise['reject'](_0x24b655);}return _0x1e07a7[_0xbdb3('0x24')]();};}function saveUpdates(_0x581d3c,_0xa2a1be){return function(_0x2699d2){if(_0x2699d2){return _0x2699d2[_0xbdb3('0x25')](_0x581d3c)[_0xbdb3('0x26')](function(_0x3c5745){return _0x3c5745;});}return null;};}function removeEntity(_0x4dfaa4,_0x5ce41e){return function(_0x236198){if(_0x236198){return _0x236198[_0xbdb3('0x27')]()[_0xbdb3('0x26')](function(){_0x4dfaa4[_0xbdb3('0x1c')](0xcc)[_0xbdb3('0x28')]();});}};}function handleEntityNotFound(_0x49cb53,_0x2533f2){return function(_0x3d4750){if(!_0x3d4750){_0x49cb53[_0xbdb3('0x1b')](0x194);}return _0x3d4750;};}function handleError(_0x1f96d6,_0x54108c){_0x54108c=_0x54108c||0x1f4;return function(_0x5703f9){logger[_0xbdb3('0x29')](_0x5703f9[_0xbdb3('0x2a')]);if(_0x5703f9[_0xbdb3('0x2b')]){delete _0x5703f9[_0xbdb3('0x2b')];}_0x1f96d6[_0xbdb3('0x1c')](_0x54108c)[_0xbdb3('0x2c')](_0x5703f9);};}function getMustacheRender(_0x5c7256,_0x50dc77){return Mustache[_0xbdb3('0x2d')](_0x5c7256,_[_0xbdb3('0x2e')](_0x50dc77[_0xbdb3('0x2f')],{'contact':_0x50dc77[_0xbdb3('0x30')],'message':_0x50dc77[_0xbdb3('0x31')],'agent':_0x50dc77['agent'],'interaction':_0x50dc77[_0xbdb3('0x32')],'account':_0x50dc77[_0xbdb3('0x33')]}))||'';}exports[_0xbdb3('0x34')]=function(_0xd83d7a,_0x485628){var _0x380d3c={},_0x35ae20={},_0x2d3474={'count':0x0,'rows':[]};var _0x4f07d3=_[_0xbdb3('0x35')](db[_0xbdb3('0x36')][_0xbdb3('0x37')],function(_0x479a8b){return{'name':_0x479a8b[_0xbdb3('0x38')],'type':_0x479a8b[_0xbdb3('0x39')][_0xbdb3('0x3a')]};});_0x35ae20[_0xbdb3('0x3b')]=_[_0xbdb3('0x35')](_0x4f07d3,_0xbdb3('0x2b'));_0x35ae20['query']=_[_0xbdb3('0x3c')](_0xd83d7a[_0xbdb3('0x3d')]);_0x35ae20[_0xbdb3('0x3e')]=_[_0xbdb3('0x3f')](_0x35ae20['model'],_0x35ae20[_0xbdb3('0x3d')]);_0x380d3c[_0xbdb3('0x40')]=_[_0xbdb3('0x3f')](_0x35ae20['model'],qs[_0xbdb3('0x41')](_0xd83d7a[_0xbdb3('0x3d')]['fields']));_0x380d3c[_0xbdb3('0x40')]=_0x380d3c[_0xbdb3('0x40')][_0xbdb3('0x42')]?_0x380d3c[_0xbdb3('0x40')]:_0x35ae20['model'];if(!_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x43')](_0xbdb3('0x44'))){_0x380d3c[_0xbdb3('0x20')]=qs[_0xbdb3('0x20')](_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x20')]);_0x380d3c[_0xbdb3('0x1e')]=qs[_0xbdb3('0x1e')](_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x1e')]);}_0x380d3c['order']=qs[_0xbdb3('0x45')](_0xd83d7a['query'][_0xbdb3('0x45')]);_0x380d3c['where']=qs[_0xbdb3('0x3e')](_[_0xbdb3('0x46')](_0xd83d7a['query'],_0x35ae20[_0xbdb3('0x3e')]),_0x4f07d3);if(_0xd83d7a[_0xbdb3('0x3d')]['filter']){_0x380d3c[_0xbdb3('0x47')]=_[_0xbdb3('0x2e')](_0x380d3c[_0xbdb3('0x47')],{'$or':_[_0xbdb3('0x35')](_0x4f07d3,function(_0x52f995){if(_0x52f995['type']!=='VIRTUAL'){var _0x23a047={};_0x23a047[_0x52f995[_0xbdb3('0x2b')]]={'$like':'%'+_0xd83d7a[_0xbdb3('0x3d')]['filter']+'%'};return _0x23a047;}})});}_0x380d3c=_[_0xbdb3('0x2e')]({},_0x380d3c,_0xd83d7a['options']);var _0x3b26c9={'where':_0x380d3c[_0xbdb3('0x47')]};return db[_0xbdb3('0x36')][_0xbdb3('0x21')](_0x3b26c9)[_0xbdb3('0x26')](function(_0x53b2fe){_0x2d3474[_0xbdb3('0x21')]=_0x53b2fe;if(_0xd83d7a[_0xbdb3('0x3d')][_0xbdb3('0x48')]){_0x380d3c[_0xbdb3('0x49')]=[{'all':!![]}];}return db[_0xbdb3('0x36')][_0xbdb3('0x4a')](_0x380d3c);})[_0xbdb3('0x26')](function(_0x50a49a){_0x2d3474[_0xbdb3('0x4b')]=_0x50a49a;return _0x2d3474;})[_0xbdb3('0x26')](respondWithFilteredResult(_0x485628,_0x380d3c))[_0xbdb3('0x4c')](handleError(_0x485628,null));};exports[_0xbdb3('0x4d')]=function(_0x21eeff,_0x4b7286){var _0x3d3140={'raw':!![],'where':{'id':_0x21eeff[_0xbdb3('0x4e')]['id']}},_0x67c67b={};_0x67c67b[_0xbdb3('0x3b')]=_[_0xbdb3('0x3c')](db[_0xbdb3('0x36')][_0xbdb3('0x37')]);_0x67c67b[_0xbdb3('0x3d')]=_[_0xbdb3('0x3c')](_0x21eeff[_0xbdb3('0x3d')]);_0x67c67b[_0xbdb3('0x3e')]=_[_0xbdb3('0x3f')](_0x67c67b[_0xbdb3('0x3b')],_0x67c67b['query']);_0x3d3140[_0xbdb3('0x40')]=_[_0xbdb3('0x3f')](_0x67c67b[_0xbdb3('0x3b')],qs[_0xbdb3('0x41')](_0x21eeff['query'][_0xbdb3('0x41')]));_0x3d3140['attributes']=_0x3d3140[_0xbdb3('0x40')][_0xbdb3('0x42')]?_0x3d3140[_0xbdb3('0x40')]:_0x67c67b[_0xbdb3('0x3b')];if(_0x21eeff[_0xbdb3('0x3d')][_0xbdb3('0x48')]){_0x3d3140['include']=[{'all':!![]}];}_0x3d3140=_[_0xbdb3('0x2e')]({},_0x3d3140,_0x21eeff[_0xbdb3('0x4f')]);return db[_0xbdb3('0x36')][_0xbdb3('0x50')](_0x3d3140)[_0xbdb3('0x26')](handleEntityNotFound(_0x4b7286,null))[_0xbdb3('0x26')](respondWithResult(_0x4b7286,null))['catch'](handleError(_0x4b7286,null));};exports[_0xbdb3('0x51')]=function(_0x121a89,_0x5780be){return db[_0xbdb3('0x36')][_0xbdb3('0x51')](_0x121a89[_0xbdb3('0x2f')],{})[_0xbdb3('0x26')](respondWithResult(_0x5780be,0xc9))[_0xbdb3('0x4c')](handleError(_0x5780be,null));};exports[_0xbdb3('0x25')]=function(_0x24eb98,_0x301e01){if(_0x24eb98[_0xbdb3('0x2f')]['id']){delete _0x24eb98[_0xbdb3('0x2f')]['id'];}return db[_0xbdb3('0x36')][_0xbdb3('0x50')]({'where':{'id':_0x24eb98[_0xbdb3('0x4e')]['id']}})[_0xbdb3('0x26')](handleEntityNotFound(_0x301e01,null))['then'](saveUpdates(_0x24eb98[_0xbdb3('0x2f')],null))[_0xbdb3('0x26')](respondWithResult(_0x301e01,null))[_0xbdb3('0x4c')](handleError(_0x301e01,null));};exports[_0xbdb3('0x27')]=function(_0x1d9c5f,_0x52423f){return db[_0xbdb3('0x36')][_0xbdb3('0x50')]({'where':{'id':_0x1d9c5f[_0xbdb3('0x4e')]['id']}})[_0xbdb3('0x26')](handleEntityNotFound(_0x52423f,null))['then'](removeEntity(_0x52423f,null))['catch'](handleError(_0x52423f,null));};exports[_0xbdb3('0x52')]=function(_0x1f585f,_0x1af536){return db['WhatsappQueueReport'][_0xbdb3('0x52')]()[_0xbdb3('0x26')](respondWithResult(_0x1af536,null))[_0xbdb3('0x4c')](handleError(_0x1af536,null));}; \ No newline at end of file +var _0x2cb5=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','render','merge','body','contact','agent','interaction','index','map','WhatsappQueueReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','describe'];(function(_0x12f5f1,_0x7da3fc){var _0x1df348=function(_0x51e2e5){while(--_0x51e2e5){_0x12f5f1['push'](_0x12f5f1['shift']());}};_0x1df348(++_0x7da3fc);}(_0x2cb5,0x9a));var _0x52cb=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x2cb5[_0x43941d];return _0x27b82a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x52cb('0x0'));var jsonpatch=require(_0x52cb('0x1'));var rp=require(_0x52cb('0x2'));var moment=require(_0x52cb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x52cb('0x4'));var util=require(_0x52cb('0x5'));var path=require('path');var sox=require(_0x52cb('0x6'));var csv=require('to-csv');var ejs=require(_0x52cb('0x7'));var fs=require('fs');var fs_extra=require(_0x52cb('0x8'));var _=require(_0x52cb('0x9'));var squel=require('squel');var crypto=require(_0x52cb('0xa'));var jsforce=require(_0x52cb('0xb'));var deskjs=require(_0x52cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x52cb('0xd'));var Papa=require(_0x52cb('0xe'));var Redis=require('ioredis');var authService=require(_0x52cb('0xf'));var qs=require(_0x52cb('0x10'));var as=require(_0x52cb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x52cb('0x12'));var utils=require(_0x52cb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x52cb('0x14'))['db'];function respondWithStatusCode(_0x4bcaa5,_0x5977fe){_0x5977fe=_0x5977fe||0xcc;return function(_0x25068c){if(_0x25068c){return _0x4bcaa5[_0x52cb('0x15')](_0x5977fe);}return _0x4bcaa5[_0x52cb('0x16')](_0x5977fe)[_0x52cb('0x17')]();};}function respondWithResult(_0x22d60d,_0x288306){_0x288306=_0x288306||0xc8;return function(_0x5774b5){if(_0x5774b5){return _0x22d60d[_0x52cb('0x16')](_0x288306)[_0x52cb('0x18')](_0x5774b5);}};}function respondWithFilteredResult(_0x5801f6,_0x274483){return function(_0x4a989f){if(_0x4a989f){var _0x66141d=typeof _0x274483[_0x52cb('0x19')]===_0x52cb('0x1a')&&typeof _0x274483[_0x52cb('0x1b')]===_0x52cb('0x1a');var _0x1c34f6=_0x4a989f[_0x52cb('0x1c')];var _0x2c5ab6=_0x66141d?0x0:_0x274483[_0x52cb('0x19')];var _0x31353=_0x66141d?_0x4a989f[_0x52cb('0x1c')]:_0x274483[_0x52cb('0x19')]+_0x274483[_0x52cb('0x1b')];var _0x15af03;if(_0x31353>=_0x1c34f6){_0x31353=_0x1c34f6;_0x15af03=0xc8;}else{_0x15af03=0xce;}_0x5801f6[_0x52cb('0x16')](_0x15af03);return _0x5801f6[_0x52cb('0x1d')](_0x52cb('0x1e'),_0x2c5ab6+'-'+_0x31353+'/'+_0x1c34f6)['json'](_0x4a989f);}return null;};}function patchUpdates(_0x5b145c){return function(_0x241565){try{jsonpatch[_0x52cb('0x1f')](_0x241565,_0x5b145c,!![]);}catch(_0x1eb3e2){return BPromise[_0x52cb('0x20')](_0x1eb3e2);}return _0x241565[_0x52cb('0x21')]();};}function saveUpdates(_0x21b366,_0x34815f){return function(_0x3ef5cd){if(_0x3ef5cd){return _0x3ef5cd[_0x52cb('0x22')](_0x21b366)[_0x52cb('0x23')](function(_0x5af975){return _0x5af975;});}return null;};}function removeEntity(_0x1a0b8b,_0xa4533e){return function(_0x466dbb){if(_0x466dbb){return _0x466dbb[_0x52cb('0x24')]()[_0x52cb('0x23')](function(){_0x1a0b8b[_0x52cb('0x16')](0xcc)[_0x52cb('0x17')]();});}};}function handleEntityNotFound(_0x64bdad,_0x4eba4c){return function(_0x579c26){if(!_0x579c26){_0x64bdad['sendStatus'](0x194);}return _0x579c26;};}function handleError(_0x3f9b1d,_0x841b98){_0x841b98=_0x841b98||0x1f4;return function(_0x27cac4){logger[_0x52cb('0x25')](_0x27cac4['stack']);if(_0x27cac4[_0x52cb('0x26')]){delete _0x27cac4[_0x52cb('0x26')];}_0x3f9b1d[_0x52cb('0x16')](_0x841b98)[_0x52cb('0x27')](_0x27cac4);};}function getMustacheRender(_0x2b530e,_0x53e77e){return Mustache[_0x52cb('0x28')](_0x2b530e,_[_0x52cb('0x29')](_0x53e77e[_0x52cb('0x2a')],{'contact':_0x53e77e[_0x52cb('0x2b')],'message':_0x53e77e['message'],'agent':_0x53e77e[_0x52cb('0x2c')],'interaction':_0x53e77e[_0x52cb('0x2d')],'account':_0x53e77e['account']}))||'';}exports[_0x52cb('0x2e')]=function(_0x2b7f1c,_0x362c88){var _0x46b786={},_0x55ffd7={},_0x1dc3af={'count':0x0,'rows':[]};var _0x5c364f=_[_0x52cb('0x2f')](db[_0x52cb('0x30')]['rawAttributes'],function(_0x46bb7f){return{'name':_0x46bb7f[_0x52cb('0x31')],'type':_0x46bb7f[_0x52cb('0x32')][_0x52cb('0x33')]};});_0x55ffd7['model']=_[_0x52cb('0x2f')](_0x5c364f,'name');_0x55ffd7['query']=_[_0x52cb('0x34')](_0x2b7f1c[_0x52cb('0x35')]);_0x55ffd7[_0x52cb('0x36')]=_[_0x52cb('0x37')](_0x55ffd7[_0x52cb('0x38')],_0x55ffd7[_0x52cb('0x35')]);_0x46b786[_0x52cb('0x39')]=_[_0x52cb('0x37')](_0x55ffd7[_0x52cb('0x38')],qs[_0x52cb('0x3a')](_0x2b7f1c[_0x52cb('0x35')][_0x52cb('0x3a')]));_0x46b786[_0x52cb('0x39')]=_0x46b786[_0x52cb('0x39')][_0x52cb('0x3b')]?_0x46b786['attributes']:_0x55ffd7[_0x52cb('0x38')];if(!_0x2b7f1c[_0x52cb('0x35')][_0x52cb('0x3c')]('nolimit')){_0x46b786[_0x52cb('0x1b')]=qs[_0x52cb('0x1b')](_0x2b7f1c[_0x52cb('0x35')][_0x52cb('0x1b')]);_0x46b786[_0x52cb('0x19')]=qs[_0x52cb('0x19')](_0x2b7f1c[_0x52cb('0x35')][_0x52cb('0x19')]);}_0x46b786[_0x52cb('0x3d')]=qs[_0x52cb('0x3e')](_0x2b7f1c['query'][_0x52cb('0x3e')]);_0x46b786['where']=qs[_0x52cb('0x36')](_[_0x52cb('0x3f')](_0x2b7f1c[_0x52cb('0x35')],_0x55ffd7[_0x52cb('0x36')]),_0x5c364f);if(_0x2b7f1c[_0x52cb('0x35')][_0x52cb('0x40')]){_0x46b786['where']=_[_0x52cb('0x29')](_0x46b786[_0x52cb('0x41')],{'$or':_[_0x52cb('0x2f')](_0x5c364f,function(_0x480713){if(_0x480713[_0x52cb('0x32')]!==_0x52cb('0x42')){var _0x35370a={};_0x35370a[_0x480713[_0x52cb('0x26')]]={'$like':'%'+_0x2b7f1c[_0x52cb('0x35')][_0x52cb('0x40')]+'%'};return _0x35370a;}})});}_0x46b786=_['merge']({},_0x46b786,_0x2b7f1c[_0x52cb('0x43')]);var _0x596217={'where':_0x46b786['where']};return db[_0x52cb('0x30')][_0x52cb('0x1c')](_0x596217)[_0x52cb('0x23')](function(_0x3f9df4){_0x1dc3af[_0x52cb('0x1c')]=_0x3f9df4;if(_0x2b7f1c[_0x52cb('0x35')][_0x52cb('0x44')]){_0x46b786[_0x52cb('0x45')]=[{'all':!![]}];}return db[_0x52cb('0x30')]['findAll'](_0x46b786);})[_0x52cb('0x23')](function(_0x20868d){_0x1dc3af['rows']=_0x20868d;return _0x1dc3af;})[_0x52cb('0x23')](respondWithFilteredResult(_0x362c88,_0x46b786))[_0x52cb('0x46')](handleError(_0x362c88,null));};exports[_0x52cb('0x47')]=function(_0x12456e,_0x5f1b00){var _0x4b86bc={'raw':!![],'where':{'id':_0x12456e[_0x52cb('0x48')]['id']}},_0x2e696c={};_0x2e696c[_0x52cb('0x38')]=_[_0x52cb('0x34')](db[_0x52cb('0x30')][_0x52cb('0x49')]);_0x2e696c[_0x52cb('0x35')]=_[_0x52cb('0x34')](_0x12456e[_0x52cb('0x35')]);_0x2e696c[_0x52cb('0x36')]=_[_0x52cb('0x37')](_0x2e696c[_0x52cb('0x38')],_0x2e696c[_0x52cb('0x35')]);_0x4b86bc['attributes']=_[_0x52cb('0x37')](_0x2e696c[_0x52cb('0x38')],qs[_0x52cb('0x3a')](_0x12456e[_0x52cb('0x35')][_0x52cb('0x3a')]));_0x4b86bc[_0x52cb('0x39')]=_0x4b86bc[_0x52cb('0x39')][_0x52cb('0x3b')]?_0x4b86bc[_0x52cb('0x39')]:_0x2e696c[_0x52cb('0x38')];if(_0x12456e[_0x52cb('0x35')][_0x52cb('0x44')]){_0x4b86bc['include']=[{'all':!![]}];}_0x4b86bc=_[_0x52cb('0x29')]({},_0x4b86bc,_0x12456e[_0x52cb('0x43')]);return db[_0x52cb('0x30')][_0x52cb('0x4a')](_0x4b86bc)[_0x52cb('0x23')](handleEntityNotFound(_0x5f1b00,null))[_0x52cb('0x23')](respondWithResult(_0x5f1b00,null))[_0x52cb('0x46')](handleError(_0x5f1b00,null));};exports[_0x52cb('0x4b')]=function(_0x41ffe7,_0x3ba58a){return db['WhatsappQueueReport'][_0x52cb('0x4b')](_0x41ffe7[_0x52cb('0x2a')],{})[_0x52cb('0x23')](respondWithResult(_0x3ba58a,0xc9))['catch'](handleError(_0x3ba58a,null));};exports[_0x52cb('0x22')]=function(_0x55daa4,_0x2ae4ba){if(_0x55daa4['body']['id']){delete _0x55daa4[_0x52cb('0x2a')]['id'];}return db[_0x52cb('0x30')][_0x52cb('0x4a')]({'where':{'id':_0x55daa4[_0x52cb('0x48')]['id']}})[_0x52cb('0x23')](handleEntityNotFound(_0x2ae4ba,null))[_0x52cb('0x23')](saveUpdates(_0x55daa4['body'],null))['then'](respondWithResult(_0x2ae4ba,null))[_0x52cb('0x46')](handleError(_0x2ae4ba,null));};exports[_0x52cb('0x24')]=function(_0x244216,_0x108fe4){return db[_0x52cb('0x30')][_0x52cb('0x4a')]({'where':{'id':_0x244216['params']['id']}})['then'](handleEntityNotFound(_0x108fe4,null))['then'](removeEntity(_0x108fe4,null))[_0x52cb('0x46')](handleError(_0x108fe4,null));};exports[_0x52cb('0x4c')]=function(_0x5c70a4,_0x382985){return db[_0x52cb('0x30')][_0x52cb('0x4c')]()[_0x52cb('0x23')](respondWithResult(_0x382985,null))[_0x52cb('0x46')](handleError(_0x382985,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c5e12ce..f2687d8 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60d0=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2c8d11,_0x1e4251){var _0x44e0cc=function(_0x1c16d6){while(--_0x1c16d6){_0x2c8d11['push'](_0x2c8d11['shift']());}};_0x44e0cc(++_0x1e4251);}(_0x60d0,0x103));var _0x060d=function(_0x3ea4b1,_0x1c59b4){_0x3ea4b1=_0x3ea4b1-0x0;var _0x4fec31=_0x60d0[_0x3ea4b1];return _0x4fec31;};'use strict';var _=require(_0x060d('0x0'));var util=require('util');var logger=require(_0x060d('0x1'))(_0x060d('0x2'));var moment=require(_0x060d('0x3'));var BPromise=require(_0x060d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x060d('0x5'));var rimraf=require(_0x060d('0x6'));var config=require(_0x060d('0x7'));var attributes=require(_0x060d('0x8'));module['exports']=function(_0x32bc76,_0x590778){return _0x32bc76['define'](_0x060d('0x9'),attributes,{'tableName':_0x060d('0xa'),'paranoid':![],'indexes':[{'name':_0x060d('0xb'),'fields':[_0x060d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47aa=['define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x2ab5d7,_0x1243d9){var _0x516388=function(_0x412cd1){while(--_0x412cd1){_0x2ab5d7['push'](_0x2ab5d7['shift']());}};_0x516388(++_0x1243d9);}(_0x47aa,0x116));var _0xa47a=function(_0x496934,_0x1d0f93){_0x496934=_0x496934-0x0;var _0x243dfb=_0x47aa[_0x496934];return _0x243dfb;};'use strict';var _=require(_0xa47a('0x0'));var util=require('util');var logger=require(_0xa47a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa47a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa47a('0x3'));var rimraf=require(_0xa47a('0x4'));var config=require(_0xa47a('0x5'));var attributes=require(_0xa47a('0x6'));module[_0xa47a('0x7')]=function(_0x2d0155,_0x4ae52f){return _0x2d0155[_0xa47a('0x8')](_0xa47a('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa47a('0xa'),'fields':[_0xa47a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index caa2890..5f024f3 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7a1=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappQueueReport','create','body','options','raw','WhatsappQueueReport','where','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring'];(function(_0x1ae1d3,_0x3a31b4){var _0x491a20=function(_0x3f44c5){while(--_0x3f44c5){_0x1ae1d3['push'](_0x1ae1d3['shift']());}};_0x491a20(++_0x3a31b4);}(_0xb7a1,0x150));var _0x1b7a=function(_0x27e84b,_0x5eb0c7){_0x27e84b=_0x27e84b-0x0;var _0x1b1888=_0xb7a1[_0x27e84b];return _0x1b1888;};'use strict';var _=require(_0x1b7a('0x0'));var util=require(_0x1b7a('0x1'));var moment=require(_0x1b7a('0x2'));var BPromise=require(_0x1b7a('0x3'));var rs=require(_0x1b7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b7a('0x5'))['db'];var utils=require(_0x1b7a('0x6'));var logger=require('../../config/logger')(_0x1b7a('0x7'));var config=require(_0x1b7a('0x8'));var jayson=require(_0x1b7a('0x9'));var client=jayson['client'][_0x1b7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dcdfe,_0x127b50,_0x1b2c5a){return new BPromise(function(_0x4051e5,_0x334da0){return client[_0x1b7a('0xb')](_0x3dcdfe,_0x1b2c5a)[_0x1b7a('0xc')](function(_0x264839){logger[_0x1b7a('0xd')](_0x1b7a('0xe'),_0x127b50,_0x1b7a('0xf'));logger[_0x1b7a('0x10')](_0x1b7a('0x11'),_0x127b50,_0x1b7a('0xf'),JSON[_0x1b7a('0x12')](_0x264839));if(_0x264839[_0x1b7a('0x13')]){if(_0x264839[_0x1b7a('0x13')]['code']===0x1f4){logger[_0x1b7a('0x13')](_0x1b7a('0xe'),_0x127b50,_0x264839[_0x1b7a('0x13')][_0x1b7a('0x14')]);return _0x334da0(_0x264839[_0x1b7a('0x13')][_0x1b7a('0x14')]);}logger[_0x1b7a('0x13')](_0x1b7a('0xe'),_0x127b50,_0x264839[_0x1b7a('0x13')]['message']);return _0x4051e5(_0x264839[_0x1b7a('0x13')]['message']);}else{logger[_0x1b7a('0xd')](_0x1b7a('0xe'),_0x127b50,_0x1b7a('0xf'));_0x4051e5(_0x264839['result'][_0x1b7a('0x14')]);}})[_0x1b7a('0x15')](function(_0xe3b691){logger[_0x1b7a('0x13')](_0x1b7a('0xe'),_0x127b50,_0xe3b691);_0x334da0(_0xe3b691);});});}exports[_0x1b7a('0x16')]=function(_0x581445){var _0x109c15=this;return new Promise(function(_0x54b877,_0x188f67){return db['WhatsappQueueReport'][_0x1b7a('0x17')](_0x581445[_0x1b7a('0x18')],{'raw':_0x581445[_0x1b7a('0x19')]?_0x581445[_0x1b7a('0x19')][_0x1b7a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x372f74){logger['info']('CreateWhatsappQueueReport',_0x581445);logger[_0x1b7a('0x10')]('CreateWhatsappQueueReport',_0x581445,JSON[_0x1b7a('0x12')](_0x372f74));_0x54b877(_0x372f74);})[_0x1b7a('0x15')](function(_0x441a80){logger[_0x1b7a('0x13')](_0x1b7a('0x16'),_0x441a80[_0x1b7a('0x14')],_0x581445);_0x188f67(_0x109c15[_0x1b7a('0x13')](0x1f4,_0x441a80[_0x1b7a('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4894b3){var _0x543bff=this;return new Promise(function(_0x2f6394,_0x505e69){return db[_0x1b7a('0x1b')]['update'](_0x4894b3['body'],{'raw':_0x4894b3['options']?_0x4894b3[_0x1b7a('0x19')][_0x1b7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4894b3[_0x1b7a('0x19')]?_0x4894b3[_0x1b7a('0x19')][_0x1b7a('0x1c')]||null:null,'attributes':_0x4894b3[_0x1b7a('0x19')]?_0x4894b3['options']['attributes']||null:null,'limit':_0x4894b3[_0x1b7a('0x19')]?_0x4894b3[_0x1b7a('0x19')][_0x1b7a('0x1d')]||null:null})['then'](function(_0x4dd63f){logger['info'](_0x1b7a('0x1e'),_0x4894b3);logger['debug'](_0x1b7a('0x1e'),_0x4894b3,JSON[_0x1b7a('0x12')](_0x4dd63f));_0x2f6394(_0x4dd63f);})['catch'](function(_0x1aa73c){logger[_0x1b7a('0x13')]('UpdateWhatsappQueueReport',_0x1aa73c[_0x1b7a('0x14')],_0x4894b3);_0x505e69(_0x543bff['error'](0x1f4,_0x1aa73c['message']));});});}; \ No newline at end of file +var _0x6d45=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','debug','request\x20sent','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','WhatsappQueueReport','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0x6d45,0x13a));var _0x56d4=function(_0x45a4e0,_0x345f4d){_0x45a4e0=_0x45a4e0-0x0;var _0x43f49d=_0x6d45[_0x45a4e0];return _0x43f49d;};'use strict';var _=require(_0x56d4('0x0'));var util=require(_0x56d4('0x1'));var moment=require(_0x56d4('0x2'));var BPromise=require(_0x56d4('0x3'));var rs=require(_0x56d4('0x4'));var fs=require('fs');var Redis=require(_0x56d4('0x5'));var db=require(_0x56d4('0x6'))['db'];var utils=require(_0x56d4('0x7'));var logger=require('../../config/logger')(_0x56d4('0x8'));var config=require(_0x56d4('0x9'));var jayson=require(_0x56d4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfa256d,_0x563070,_0x44fcaa){return new BPromise(function(_0x2553ef,_0x268a81){return client[_0x56d4('0xb')](_0xfa256d,_0x44fcaa)[_0x56d4('0xc')](function(_0x5dba93){logger[_0x56d4('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x563070,'request\x20sent');logger[_0x56d4('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x563070,_0x56d4('0xf'),JSON[_0x56d4('0x10')](_0x5dba93));if(_0x5dba93[_0x56d4('0x11')]){if(_0x5dba93[_0x56d4('0x11')]['code']===0x1f4){logger[_0x56d4('0x11')](_0x56d4('0x12'),_0x563070,_0x5dba93[_0x56d4('0x11')]['message']);return _0x268a81(_0x5dba93[_0x56d4('0x11')][_0x56d4('0x13')]);}logger[_0x56d4('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x563070,_0x5dba93[_0x56d4('0x11')][_0x56d4('0x13')]);return _0x2553ef(_0x5dba93['error'][_0x56d4('0x13')]);}else{logger[_0x56d4('0xd')](_0x56d4('0x12'),_0x563070,_0x56d4('0xf'));_0x2553ef(_0x5dba93[_0x56d4('0x14')]['message']);}})[_0x56d4('0x15')](function(_0x372fa5){logger[_0x56d4('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x563070,_0x372fa5);_0x268a81(_0x372fa5);});});}exports[_0x56d4('0x16')]=function(_0x465e3e){var _0x505b50=this;return new Promise(function(_0x57a75a,_0x2bab35){return db['WhatsappQueueReport'][_0x56d4('0x17')](_0x465e3e[_0x56d4('0x18')],{'raw':_0x465e3e[_0x56d4('0x19')]?_0x465e3e[_0x56d4('0x19')][_0x56d4('0x1a')]===undefined?!![]:![]:!![]})[_0x56d4('0xc')](function(_0x4df399){logger[_0x56d4('0xd')](_0x56d4('0x16'),_0x465e3e);logger['debug'](_0x56d4('0x16'),_0x465e3e,JSON[_0x56d4('0x10')](_0x4df399));_0x57a75a(_0x4df399);})['catch'](function(_0x52d973){logger[_0x56d4('0x11')](_0x56d4('0x16'),_0x52d973[_0x56d4('0x13')],_0x465e3e);_0x2bab35(_0x505b50[_0x56d4('0x11')](0x1f4,_0x52d973['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x5023f4){var _0x2fdcda=this;return new Promise(function(_0x1ad948,_0x529a4e){return db[_0x56d4('0x1b')]['update'](_0x5023f4[_0x56d4('0x18')],{'raw':_0x5023f4['options']?_0x5023f4['options'][_0x56d4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5023f4[_0x56d4('0x19')]?_0x5023f4[_0x56d4('0x19')][_0x56d4('0x1c')]||null:null,'attributes':_0x5023f4[_0x56d4('0x19')]?_0x5023f4[_0x56d4('0x19')][_0x56d4('0x1d')]||null:null,'limit':_0x5023f4[_0x56d4('0x19')]?_0x5023f4[_0x56d4('0x19')][_0x56d4('0x1e')]||null:null})[_0x56d4('0xc')](function(_0x26fb5e){logger[_0x56d4('0xd')](_0x56d4('0x1f'),_0x5023f4);logger[_0x56d4('0xe')](_0x56d4('0x1f'),_0x5023f4,JSON['stringify'](_0x26fb5e));_0x1ad948(_0x26fb5e);})['catch'](function(_0x14ad4f){logger['error']('UpdateWhatsappQueueReport',_0x14ad4f['message'],_0x5023f4);_0x529a4e(_0x2fdcda['error'](0x1f4,_0x14ad4f[_0x56d4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f513608..5808e59 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8320=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8320,0x141));var _0x0832=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x8320[_0x1d3791];return _0x40fbf5;};'use strict';var multer=require(_0x0832('0x0'));var util=require(_0x0832('0x1'));var path=require(_0x0832('0x2'));var timeout=require(_0x0832('0x3'));var express=require(_0x0832('0x4'));var router=express[_0x0832('0x5')]();var fs_extra=require(_0x0832('0x6'));var auth=require(_0x0832('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0832('0x8'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x0832('0x9')](),controller[_0x0832('0xa')]);router[_0x0832('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0832('0xb')](_0x0832('0xc'),auth[_0x0832('0x9')](),controller[_0x0832('0xd')]);router[_0x0832('0xe')]('/',auth[_0x0832('0x9')](),controller[_0x0832('0xf')]);router[_0x0832('0x10')](_0x0832('0xc'),auth[_0x0832('0x9')](),controller[_0x0832('0x11')]);router[_0x0832('0x12')](_0x0832('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0832('0x13')]=router; \ No newline at end of file +var _0xd1d9=['../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1398f7,_0x8f6dfa){var _0x1468ac=function(_0x187a2b){while(--_0x187a2b){_0x1398f7['push'](_0x1398f7['shift']());}};_0x1468ac(++_0x8f6dfa);}(_0xd1d9,0x71));var _0x9d1d=function(_0x3d28cc,_0x4025fd){_0x3d28cc=_0x3d28cc-0x0;var _0x25c7e7=_0xd1d9[_0x3d28cc];return _0x25c7e7;};'use strict';var multer=require('multer');var util=require(_0x9d1d('0x0'));var path=require(_0x9d1d('0x1'));var timeout=require(_0x9d1d('0x2'));var express=require('express');var router=express[_0x9d1d('0x3')]();var fs_extra=require(_0x9d1d('0x4'));var auth=require(_0x9d1d('0x5'));var interaction=require(_0x9d1d('0x6'));var config=require('../../config/environment');var controller=require(_0x9d1d('0x7'));router[_0x9d1d('0x8')]('/',auth[_0x9d1d('0x9')](),controller[_0x9d1d('0xa')]);router[_0x9d1d('0x8')](_0x9d1d('0xb'),auth['isAuthenticated'](),controller[_0x9d1d('0xc')]);router[_0x9d1d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9d1d('0xd')]);router[_0x9d1d('0xe')]('/',auth[_0x9d1d('0x9')](),controller['create']);router[_0x9d1d('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9d1d('0x10')]('/:id',auth[_0x9d1d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index bdb6c3d..78e33fe 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x46fd98,_0x14a05a){var _0x2108b9=function(_0xbd6a9d){while(--_0xbd6a9d){_0x46fd98['push'](_0x46fd98['shift']());}};_0x2108b9(++_0x14a05a);}(_0x2032,0xd9));var _0x2203=function(_0x2c52ca,_0x3a389c){_0x2c52ca=_0x2c52ca-0x0;var _0x2302a0=_0x2032[_0x2c52ca];return _0x2302a0;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 2600db8..0a5a589 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff2f=['../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','destroy','then','error','stack','name','send','render','merge','body','contact','message','agent','interaction','account','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','create','update','params','describe','eml-format','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x3bc391,_0x34b959){var _0x4063b7=function(_0x1d0054){while(--_0x1d0054){_0x3bc391['push'](_0x3bc391['shift']());}};_0x4063b7(++_0x34b959);}(_0xff2f,0xd8));var _0xfff2=function(_0x38ac44,_0x38c414){_0x38ac44=_0x38ac44-0x0;var _0x42e9ae=_0xff2f[_0x38ac44];return _0x42e9ae;};'use strict';var emlformat=require(_0xfff2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfff2('0x1'));var moment=require(_0xfff2('0x2'));var BPromise=require(_0xfff2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfff2('0x4'));var sox=require(_0xfff2('0x5'));var csv=require(_0xfff2('0x6'));var ejs=require(_0xfff2('0x7'));var fs=require('fs');var fs_extra=require(_0xfff2('0x8'));var _=require(_0xfff2('0x9'));var squel=require(_0xfff2('0xa'));var crypto=require(_0xfff2('0xb'));var jsforce=require(_0xfff2('0xc'));var deskjs=require(_0xfff2('0xd'));var toCsv=require(_0xfff2('0x6'));var querystring=require('querystring');var Papa=require(_0xfff2('0xe'));var Redis=require(_0xfff2('0xf'));var authService=require(_0xfff2('0x10'));var qs=require(_0xfff2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfff2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfff2('0x13'));var config=require(_0xfff2('0x14'));var licenseUtil=require(_0xfff2('0x15'));var db=require(_0xfff2('0x16'))['db'];function respondWithStatusCode(_0x430dd0,_0x303678){_0x303678=_0x303678||0xcc;return function(_0x31b0b6){if(_0x31b0b6){return _0x430dd0['sendStatus'](_0x303678);}return _0x430dd0[_0xfff2('0x17')](_0x303678)[_0xfff2('0x18')]();};}function respondWithResult(_0x577b0a,_0x3bd26f){_0x3bd26f=_0x3bd26f||0xc8;return function(_0x583905){if(_0x583905){return _0x577b0a[_0xfff2('0x17')](_0x3bd26f)['json'](_0x583905);}};}function respondWithFilteredResult(_0x616dcb,_0x41f366){return function(_0x5297e4){if(_0x5297e4){var _0x553311=typeof _0x41f366['offset']==='undefined'&&typeof _0x41f366['limit']==='undefined';var _0x189cb3=_0x5297e4[_0xfff2('0x19')];var _0x3bc52c=_0x553311?0x0:_0x41f366['offset'];var _0x22a210=_0x553311?_0x5297e4[_0xfff2('0x19')]:_0x41f366[_0xfff2('0x1a')]+_0x41f366[_0xfff2('0x1b')];var _0x4440ee;if(_0x22a210>=_0x189cb3){_0x22a210=_0x189cb3;_0x4440ee=0xc8;}else{_0x4440ee=0xce;}_0x616dcb[_0xfff2('0x17')](_0x4440ee);return _0x616dcb[_0xfff2('0x1c')](_0xfff2('0x1d'),_0x3bc52c+'-'+_0x22a210+'/'+_0x189cb3)[_0xfff2('0x1e')](_0x5297e4);}return null;};}function patchUpdates(_0xc78e5){return function(_0x3ce12c){try{jsonpatch['apply'](_0x3ce12c,_0xc78e5,!![]);}catch(_0x513c42){return BPromise[_0xfff2('0x1f')](_0x513c42);}return _0x3ce12c['save']();};}function saveUpdates(_0xbb1d3c,_0x103b17){return function(_0x3e8e6e){if(_0x3e8e6e){return _0x3e8e6e['update'](_0xbb1d3c)['then'](function(_0x336dfc){return _0x336dfc;});}return null;};}function removeEntity(_0x5eb5dd,_0x3305b5){return function(_0x31faff){if(_0x31faff){return _0x31faff[_0xfff2('0x20')]()[_0xfff2('0x21')](function(){_0x5eb5dd[_0xfff2('0x17')](0xcc)[_0xfff2('0x18')]();});}};}function handleEntityNotFound(_0x3fa613,_0x4257e6){return function(_0x572768){if(!_0x572768){_0x3fa613['sendStatus'](0x194);}return _0x572768;};}function handleError(_0x2901b8,_0x18476e){_0x18476e=_0x18476e||0x1f4;return function(_0xbad814){logger[_0xfff2('0x22')](_0xbad814[_0xfff2('0x23')]);if(_0xbad814[_0xfff2('0x24')]){delete _0xbad814[_0xfff2('0x24')];}_0x2901b8['status'](_0x18476e)[_0xfff2('0x25')](_0xbad814);};}function getMustacheRender(_0x35edd3,_0x2490e4){return Mustache[_0xfff2('0x26')](_0x35edd3,_[_0xfff2('0x27')](_0x2490e4[_0xfff2('0x28')],{'contact':_0x2490e4[_0xfff2('0x29')],'message':_0x2490e4[_0xfff2('0x2a')],'agent':_0x2490e4[_0xfff2('0x2b')],'interaction':_0x2490e4[_0xfff2('0x2c')],'account':_0x2490e4[_0xfff2('0x2d')]}))||'';}exports[_0xfff2('0x2e')]=function(_0xa4a4c8,_0x1396d3){var _0x34cec7={},_0x216f80={},_0x2a5f6f={'count':0x0,'rows':[]};var _0x976787=_[_0xfff2('0x2f')](db[_0xfff2('0x30')][_0xfff2('0x31')],function(_0x2d5f50){return{'name':_0x2d5f50['fieldName'],'type':_0x2d5f50[_0xfff2('0x32')][_0xfff2('0x33')]};});_0x216f80[_0xfff2('0x34')]=_[_0xfff2('0x2f')](_0x976787,_0xfff2('0x24'));_0x216f80[_0xfff2('0x35')]=_[_0xfff2('0x36')](_0xa4a4c8[_0xfff2('0x35')]);_0x216f80[_0xfff2('0x37')]=_[_0xfff2('0x38')](_0x216f80['model'],_0x216f80[_0xfff2('0x35')]);_0x34cec7[_0xfff2('0x39')]=_[_0xfff2('0x38')](_0x216f80[_0xfff2('0x34')],qs[_0xfff2('0x3a')](_0xa4a4c8['query'][_0xfff2('0x3a')]));_0x34cec7[_0xfff2('0x39')]=_0x34cec7[_0xfff2('0x39')]['length']?_0x34cec7[_0xfff2('0x39')]:_0x216f80[_0xfff2('0x34')];if(!_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x3b')](_0xfff2('0x3c'))){_0x34cec7['limit']=qs[_0xfff2('0x1b')](_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x1b')]);_0x34cec7[_0xfff2('0x1a')]=qs[_0xfff2('0x1a')](_0xa4a4c8['query'][_0xfff2('0x1a')]);}_0x34cec7['order']=qs[_0xfff2('0x3d')](_0xa4a4c8[_0xfff2('0x35')]['sort']);_0x34cec7[_0xfff2('0x3e')]=qs[_0xfff2('0x37')](_[_0xfff2('0x3f')](_0xa4a4c8[_0xfff2('0x35')],_0x216f80[_0xfff2('0x37')]),_0x976787);if(_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x40')]){_0x34cec7[_0xfff2('0x3e')]=_[_0xfff2('0x27')](_0x34cec7['where'],{'$or':_[_0xfff2('0x2f')](_0x976787,function(_0x10e274){if(_0x10e274['type']!==_0xfff2('0x41')){var _0x4ebe85={};_0x4ebe85[_0x10e274[_0xfff2('0x24')]]={'$like':'%'+_0xa4a4c8[_0xfff2('0x35')]['filter']+'%'};return _0x4ebe85;}})});}_0x34cec7=_[_0xfff2('0x27')]({},_0x34cec7,_0xa4a4c8[_0xfff2('0x42')]);var _0x41d19a={'where':_0x34cec7[_0xfff2('0x3e')]};return db['WhatsappTransferReport'][_0xfff2('0x19')](_0x41d19a)['then'](function(_0x1a1200){_0x2a5f6f[_0xfff2('0x19')]=_0x1a1200;if(_0xa4a4c8[_0xfff2('0x35')][_0xfff2('0x43')]){_0x34cec7[_0xfff2('0x44')]=[{'all':!![]}];}return db[_0xfff2('0x30')][_0xfff2('0x45')](_0x34cec7);})[_0xfff2('0x21')](function(_0x142696){_0x2a5f6f[_0xfff2('0x46')]=_0x142696;return _0x2a5f6f;})['then'](respondWithFilteredResult(_0x1396d3,_0x34cec7))['catch'](handleError(_0x1396d3,null));};exports[_0xfff2('0x47')]=function(_0x2900e9,_0x2aa031){var _0x55b613={'raw':!![],'where':{'id':_0x2900e9['params']['id']}},_0x1da341={};_0x1da341[_0xfff2('0x34')]=_[_0xfff2('0x36')](db['WhatsappTransferReport']['rawAttributes']);_0x1da341[_0xfff2('0x35')]=_[_0xfff2('0x36')](_0x2900e9['query']);_0x1da341[_0xfff2('0x37')]=_[_0xfff2('0x38')](_0x1da341[_0xfff2('0x34')],_0x1da341[_0xfff2('0x35')]);_0x55b613[_0xfff2('0x39')]=_['intersection'](_0x1da341[_0xfff2('0x34')],qs[_0xfff2('0x3a')](_0x2900e9[_0xfff2('0x35')][_0xfff2('0x3a')]));_0x55b613['attributes']=_0x55b613[_0xfff2('0x39')][_0xfff2('0x48')]?_0x55b613[_0xfff2('0x39')]:_0x1da341[_0xfff2('0x34')];if(_0x2900e9['query'][_0xfff2('0x43')]){_0x55b613[_0xfff2('0x44')]=[{'all':!![]}];}_0x55b613=_[_0xfff2('0x27')]({},_0x55b613,_0x2900e9['options']);return db['WhatsappTransferReport'][_0xfff2('0x49')](_0x55b613)[_0xfff2('0x21')](handleEntityNotFound(_0x2aa031,null))[_0xfff2('0x21')](respondWithResult(_0x2aa031,null))[_0xfff2('0x4a')](handleError(_0x2aa031,null));};exports[_0xfff2('0x4b')]=function(_0x38717f,_0x435873){return db[_0xfff2('0x30')][_0xfff2('0x4b')](_0x38717f[_0xfff2('0x28')],{})[_0xfff2('0x21')](respondWithResult(_0x435873,0xc9))[_0xfff2('0x4a')](handleError(_0x435873,null));};exports[_0xfff2('0x4c')]=function(_0x49554d,_0x9ea28){if(_0x49554d[_0xfff2('0x28')]['id']){delete _0x49554d[_0xfff2('0x28')]['id'];}return db[_0xfff2('0x30')][_0xfff2('0x49')]({'where':{'id':_0x49554d[_0xfff2('0x4d')]['id']}})[_0xfff2('0x21')](handleEntityNotFound(_0x9ea28,null))[_0xfff2('0x21')](saveUpdates(_0x49554d[_0xfff2('0x28')],null))['then'](respondWithResult(_0x9ea28,null))[_0xfff2('0x4a')](handleError(_0x9ea28,null));};exports[_0xfff2('0x20')]=function(_0x2ebf78,_0x1c6ad7){return db[_0xfff2('0x30')][_0xfff2('0x49')]({'where':{'id':_0x2ebf78['params']['id']}})['then'](handleEntityNotFound(_0x1c6ad7,null))[_0xfff2('0x21')](removeEntity(_0x1c6ad7,null))[_0xfff2('0x4a')](handleError(_0x1c6ad7,null));};exports['describe']=function(_0x453f30,_0x42d9c0){return db[_0xfff2('0x30')][_0xfff2('0x4e')]()[_0xfff2('0x21')](respondWithResult(_0x42d9c0,null))['catch'](handleError(_0x42d9c0,null));}; \ No newline at end of file +var _0x2f03=['find','create','update','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','apply','reject','save','then','destroy','end','sendStatus','error','name','send','render','merge','body','contact','interaction','account','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','WhatsappTransferReport','rows','catch','show','params','keys','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f03,0x1bf));var _0x32f0=function(_0x50023e,_0x2bad27){_0x50023e=_0x50023e-0x0;var _0x583c6d=_0x2f03[_0x50023e];return _0x583c6d;};'use strict';var emlformat=require(_0x32f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32f0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32f0('0x2'));var moment=require(_0x32f0('0x3'));var BPromise=require(_0x32f0('0x4'));var Mustache=require('mustache');var util=require(_0x32f0('0x5'));var path=require(_0x32f0('0x6'));var sox=require(_0x32f0('0x7'));var csv=require(_0x32f0('0x8'));var ejs=require(_0x32f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32f0('0xa'));var squel=require(_0x32f0('0xb'));var crypto=require(_0x32f0('0xc'));var jsforce=require(_0x32f0('0xd'));var deskjs=require(_0x32f0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x32f0('0xf'));var Redis=require('ioredis');var authService=require(_0x32f0('0x10'));var qs=require(_0x32f0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32f0('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x32f0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x32f0('0x14'));var db=require(_0x32f0('0x15'))['db'];function respondWithStatusCode(_0x16c481,_0x2e0a86){_0x2e0a86=_0x2e0a86||0xcc;return function(_0x3a9c24){if(_0x3a9c24){return _0x16c481['sendStatus'](_0x2e0a86);}return _0x16c481[_0x32f0('0x16')](_0x2e0a86)['end']();};}function respondWithResult(_0x4fe209,_0x485f32){_0x485f32=_0x485f32||0xc8;return function(_0x160e2c){if(_0x160e2c){return _0x4fe209['status'](_0x485f32)[_0x32f0('0x17')](_0x160e2c);}};}function respondWithFilteredResult(_0x218f84,_0x352360){return function(_0x34ac64){if(_0x34ac64){var _0x5c1562=typeof _0x352360[_0x32f0('0x18')]===_0x32f0('0x19')&&typeof _0x352360[_0x32f0('0x1a')]===_0x32f0('0x19');var _0x230f6a=_0x34ac64['count'];var _0x4db1ad=_0x5c1562?0x0:_0x352360[_0x32f0('0x18')];var _0x545d4f=_0x5c1562?_0x34ac64['count']:_0x352360[_0x32f0('0x18')]+_0x352360[_0x32f0('0x1a')];var _0x5b79bf;if(_0x545d4f>=_0x230f6a){_0x545d4f=_0x230f6a;_0x5b79bf=0xc8;}else{_0x5b79bf=0xce;}_0x218f84[_0x32f0('0x16')](_0x5b79bf);return _0x218f84[_0x32f0('0x1b')]('Content-Range',_0x4db1ad+'-'+_0x545d4f+'/'+_0x230f6a)[_0x32f0('0x17')](_0x34ac64);}return null;};}function patchUpdates(_0x1ed5b1){return function(_0x464fb0){try{jsonpatch[_0x32f0('0x1c')](_0x464fb0,_0x1ed5b1,!![]);}catch(_0x2da28c){return BPromise[_0x32f0('0x1d')](_0x2da28c);}return _0x464fb0[_0x32f0('0x1e')]();};}function saveUpdates(_0x651da5,_0x563502){return function(_0x100944){if(_0x100944){return _0x100944['update'](_0x651da5)[_0x32f0('0x1f')](function(_0x4f1cf1){return _0x4f1cf1;});}return null;};}function removeEntity(_0x3e3ec5,_0x1efda3){return function(_0x718bab){if(_0x718bab){return _0x718bab[_0x32f0('0x20')]()['then'](function(){_0x3e3ec5[_0x32f0('0x16')](0xcc)[_0x32f0('0x21')]();});}};}function handleEntityNotFound(_0x8f45e4,_0x3e1d5d){return function(_0x45299f){if(!_0x45299f){_0x8f45e4[_0x32f0('0x22')](0x194);}return _0x45299f;};}function handleError(_0x9962e8,_0x378a8c){_0x378a8c=_0x378a8c||0x1f4;return function(_0x1cc042){logger[_0x32f0('0x23')](_0x1cc042['stack']);if(_0x1cc042[_0x32f0('0x24')]){delete _0x1cc042[_0x32f0('0x24')];}_0x9962e8[_0x32f0('0x16')](_0x378a8c)[_0x32f0('0x25')](_0x1cc042);};}function getMustacheRender(_0x345a7c,_0x3f2e5d){return Mustache[_0x32f0('0x26')](_0x345a7c,_[_0x32f0('0x27')](_0x3f2e5d[_0x32f0('0x28')],{'contact':_0x3f2e5d[_0x32f0('0x29')],'message':_0x3f2e5d['message'],'agent':_0x3f2e5d['agent'],'interaction':_0x3f2e5d[_0x32f0('0x2a')],'account':_0x3f2e5d[_0x32f0('0x2b')]}))||'';}exports['index']=function(_0x1684f5,_0x2cb5f3){var _0x59ffb9={},_0x1c708c={},_0x35d847={'count':0x0,'rows':[]};var _0x5d2901=_[_0x32f0('0x2c')](db['WhatsappTransferReport'][_0x32f0('0x2d')],function(_0x10ad08){return{'name':_0x10ad08[_0x32f0('0x2e')],'type':_0x10ad08[_0x32f0('0x2f')]['key']};});_0x1c708c[_0x32f0('0x30')]=_[_0x32f0('0x2c')](_0x5d2901,_0x32f0('0x24'));_0x1c708c[_0x32f0('0x31')]=_['keys'](_0x1684f5['query']);_0x1c708c[_0x32f0('0x32')]=_[_0x32f0('0x33')](_0x1c708c[_0x32f0('0x30')],_0x1c708c['query']);_0x59ffb9[_0x32f0('0x34')]=_['intersection'](_0x1c708c[_0x32f0('0x30')],qs[_0x32f0('0x35')](_0x1684f5[_0x32f0('0x31')][_0x32f0('0x35')]));_0x59ffb9[_0x32f0('0x34')]=_0x59ffb9[_0x32f0('0x34')]['length']?_0x59ffb9[_0x32f0('0x34')]:_0x1c708c['model'];if(!_0x1684f5[_0x32f0('0x31')]['hasOwnProperty'](_0x32f0('0x36'))){_0x59ffb9[_0x32f0('0x1a')]=qs['limit'](_0x1684f5['query'][_0x32f0('0x1a')]);_0x59ffb9[_0x32f0('0x18')]=qs['offset'](_0x1684f5['query'][_0x32f0('0x18')]);}_0x59ffb9['order']=qs['sort'](_0x1684f5[_0x32f0('0x31')][_0x32f0('0x37')]);_0x59ffb9[_0x32f0('0x38')]=qs[_0x32f0('0x32')](_[_0x32f0('0x39')](_0x1684f5[_0x32f0('0x31')],_0x1c708c[_0x32f0('0x32')]),_0x5d2901);if(_0x1684f5['query'][_0x32f0('0x3a')]){_0x59ffb9['where']=_['merge'](_0x59ffb9[_0x32f0('0x38')],{'$or':_[_0x32f0('0x2c')](_0x5d2901,function(_0xb03ba8){if(_0xb03ba8[_0x32f0('0x2f')]!==_0x32f0('0x3b')){var _0x133f1e={};_0x133f1e[_0xb03ba8['name']]={'$like':'%'+_0x1684f5[_0x32f0('0x31')][_0x32f0('0x3a')]+'%'};return _0x133f1e;}})});}_0x59ffb9=_['merge']({},_0x59ffb9,_0x1684f5[_0x32f0('0x3c')]);var _0x22ec7b={'where':_0x59ffb9[_0x32f0('0x38')]};return db['WhatsappTransferReport'][_0x32f0('0x3d')](_0x22ec7b)['then'](function(_0x1e8ea9){_0x35d847[_0x32f0('0x3d')]=_0x1e8ea9;if(_0x1684f5[_0x32f0('0x31')][_0x32f0('0x3e')]){_0x59ffb9[_0x32f0('0x3f')]=[{'all':!![]}];}return db[_0x32f0('0x40')]['findAll'](_0x59ffb9);})[_0x32f0('0x1f')](function(_0x225388){_0x35d847[_0x32f0('0x41')]=_0x225388;return _0x35d847;})['then'](respondWithFilteredResult(_0x2cb5f3,_0x59ffb9))[_0x32f0('0x42')](handleError(_0x2cb5f3,null));};exports[_0x32f0('0x43')]=function(_0x342f16,_0x4a2dbe){var _0x24375c={'raw':!![],'where':{'id':_0x342f16[_0x32f0('0x44')]['id']}},_0xb0f2a6={};_0xb0f2a6[_0x32f0('0x30')]=_[_0x32f0('0x45')](db[_0x32f0('0x40')]['rawAttributes']);_0xb0f2a6[_0x32f0('0x31')]=_[_0x32f0('0x45')](_0x342f16[_0x32f0('0x31')]);_0xb0f2a6[_0x32f0('0x32')]=_[_0x32f0('0x33')](_0xb0f2a6[_0x32f0('0x30')],_0xb0f2a6[_0x32f0('0x31')]);_0x24375c[_0x32f0('0x34')]=_[_0x32f0('0x33')](_0xb0f2a6[_0x32f0('0x30')],qs[_0x32f0('0x35')](_0x342f16['query'][_0x32f0('0x35')]));_0x24375c[_0x32f0('0x34')]=_0x24375c[_0x32f0('0x34')][_0x32f0('0x46')]?_0x24375c['attributes']:_0xb0f2a6[_0x32f0('0x30')];if(_0x342f16[_0x32f0('0x31')][_0x32f0('0x3e')]){_0x24375c[_0x32f0('0x3f')]=[{'all':!![]}];}_0x24375c=_['merge']({},_0x24375c,_0x342f16[_0x32f0('0x3c')]);return db['WhatsappTransferReport'][_0x32f0('0x47')](_0x24375c)[_0x32f0('0x1f')](handleEntityNotFound(_0x4a2dbe,null))['then'](respondWithResult(_0x4a2dbe,null))[_0x32f0('0x42')](handleError(_0x4a2dbe,null));};exports[_0x32f0('0x48')]=function(_0x3982d2,_0x818456){return db['WhatsappTransferReport'][_0x32f0('0x48')](_0x3982d2[_0x32f0('0x28')],{})['then'](respondWithResult(_0x818456,0xc9))[_0x32f0('0x42')](handleError(_0x818456,null));};exports[_0x32f0('0x49')]=function(_0x53e7af,_0x7f2eca){if(_0x53e7af[_0x32f0('0x28')]['id']){delete _0x53e7af['body']['id'];}return db[_0x32f0('0x40')][_0x32f0('0x47')]({'where':{'id':_0x53e7af['params']['id']}})[_0x32f0('0x1f')](handleEntityNotFound(_0x7f2eca,null))['then'](saveUpdates(_0x53e7af[_0x32f0('0x28')],null))[_0x32f0('0x1f')](respondWithResult(_0x7f2eca,null))['catch'](handleError(_0x7f2eca,null));};exports['destroy']=function(_0x437bd6,_0x3160ad){return db[_0x32f0('0x40')][_0x32f0('0x47')]({'where':{'id':_0x437bd6[_0x32f0('0x44')]['id']}})[_0x32f0('0x1f')](handleEntityNotFound(_0x3160ad,null))[_0x32f0('0x1f')](removeEntity(_0x3160ad,null))[_0x32f0('0x42')](handleError(_0x3160ad,null));};exports['describe']=function(_0x593403,_0xd88993){return db[_0x32f0('0x40')]['describe']()[_0x32f0('0x1f')](respondWithResult(_0xd88993,null))['catch'](handleError(_0xd88993,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d0cfc3c..41dedeb 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe36f=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','../../config/logger','api','moment','path'];(function(_0x28fe98,_0x36592a){var _0x3b482d=function(_0x30405c){while(--_0x30405c){_0x28fe98['push'](_0x28fe98['shift']());}};_0x3b482d(++_0x36592a);}(_0xe36f,0xac));var _0xfe36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe36f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfe36('0x0'))(_0xfe36('0x1'));var moment=require(_0xfe36('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe36('0x3'));var rimraf=require(_0xfe36('0x4'));var config=require(_0xfe36('0x5'));var attributes=require(_0xfe36('0x6'));module[_0xfe36('0x7')]=function(_0x3c3ee8,_0x5a9e49){return _0x3c3ee8[_0xfe36('0x8')](_0xfe36('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xfe36('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x21dd=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','./whatsappTransferReport.attributes'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x21dd,0x1f3));var _0xd21d=function(_0x599404,_0x227848){_0x599404=_0x599404-0x0;var _0x2b050b=_0x21dd[_0x599404];return _0x2b050b;};'use strict';var _=require(_0xd21d('0x0'));var util=require(_0xd21d('0x1'));var logger=require(_0xd21d('0x2'))(_0xd21d('0x3'));var moment=require(_0xd21d('0x4'));var BPromise=require(_0xd21d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd21d('0x6'));module['exports']=function(_0x1e0971,_0x2829d8){return _0x1e0971[_0xd21d('0x7')](_0xd21d('0x8'),attributes,{'tableName':_0xd21d('0x9'),'paranoid':![],'indexes':[{'name':_0xd21d('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d8f1c4a..59769c8 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9b8927,_0x1caaa7){var _0x13afbc=function(_0x24fc88){while(--_0x24fc88){_0x9b8927['push'](_0x9b8927['shift']());}};_0x13afbc(++_0x1caaa7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3d6893,_0x2ed882){var _0x102195=function(_0x248b31){while(--_0x248b31){_0x3d6893['push'](_0x3d6893['shift']());}};_0x102195(++_0x2ed882);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2eb84c9..cf2542f 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x235b=['lodash','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','listen','info','start','map','online','name','join','Offline\x20apps:','filter','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','exit'];(function(_0x3d256b,_0x3ea550){var _0x3c5076=function(_0x5e0b1c){while(--_0x5e0b1c){_0x3d256b['push'](_0x3d256b['shift']());}};_0x3c5076(++_0x3ea550);}(_0x235b,0x1ed));var _0xb235=function(_0x4422f4,_0x195737){_0x4422f4=_0x4422f4-0x0;var _0x1bfde1=_0x235b[_0x4422f4];return _0x1bfde1;};'use strict';var _=require(_0xb235('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0xb235('0x1'));var logger=require(_0xb235('0x2'))(_0xb235('0x3'));var pm2=require(_0xb235('0x4'));var pm2Config=require(_0xb235('0x5'));var schedule=require(_0xb235('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xb235('0x7'));var transcribe=require(_0xb235('0x8'));function main(){return mysqldb['db'][_0xb235('0x9')]['sync']()[_0xb235('0xa')](function(){return rpc[_0xb235('0xb')]();})[_0xb235('0xa')](function(_0x436d63){logger[_0xb235('0xc')](_0x436d63);return chat['start']();})['then'](function(){return whatsapp[_0xb235('0xd')]();})[_0xb235('0xa')](function(){return schedule[_0xb235('0xd')]();})[_0xb235('0xa')](function(){return transcribe[_0xb235('0xd')]();})[_0xb235('0xa')](function(_0x369bf6){logger[_0xb235('0xc')](_0x369bf6);return pm2['start'](pm2Config);})[_0xb235('0xa')](function(_0x289582){logger[_0xb235('0xc')]('Online\x20apps:',_[_0xb235('0xe')](_['filter'](_0x289582,{'status':_0xb235('0xf')}),_0xb235('0x10'))[_0xb235('0x11')]());logger[_0xb235('0xc')](_0xb235('0x12'),_[_0xb235('0xe')](_[_0xb235('0x13')](_0x289582,function(_0x53b15a){return _0x53b15a[_0xb235('0x14')]!==_0xb235('0xf');}),_0xb235('0x10'))[_0xb235('0x11')]()||_0xb235('0x15'));config[_0xb235('0x16')]&&require(_0xb235('0x17'))[_0xb235('0x18')]();require(_0xb235('0x19'))[_0xb235('0x18')]();})[_0xb235('0x1a')](function(_0x1b9eae){logger[_0xb235('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1b9eae);process[_0xb235('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x7d8a=['filter','status','join','None','seedDB','./config/seedDB','default','./config/license','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','listen','then','info','start','Online\x20apps:','map','online','name'];(function(_0x5517c1,_0x377cc9){var _0x15143c=function(_0x93f3dc){while(--_0x93f3dc){_0x5517c1['push'](_0x5517c1['shift']());}};_0x15143c(++_0x377cc9);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x7d8a[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xa7d8('0x0'));var mysqldb=require(_0xa7d8('0x1'));var rpc=require(_0xa7d8('0x2'));var config=require(_0xa7d8('0x3'));var logger=require(_0xa7d8('0x4'))(_0xa7d8('0x5'));var pm2=require(_0xa7d8('0x6'));var pm2Config=require(_0xa7d8('0x7'));var schedule=require(_0xa7d8('0x8'));var chat=require(_0xa7d8('0x9'));var whatsapp=require(_0xa7d8('0xa'));var transcribe=require(_0xa7d8('0xb'));function main(){return mysqldb['db'][_0xa7d8('0xc')][_0xa7d8('0xd')]()['then'](function(){return rpc[_0xa7d8('0xe')]();})[_0xa7d8('0xf')](function(_0x1807cc){logger[_0xa7d8('0x10')](_0x1807cc);return chat[_0xa7d8('0x11')]();})['then'](function(){return whatsapp[_0xa7d8('0x11')]();})['then'](function(){return schedule[_0xa7d8('0x11')]();})['then'](function(){return transcribe[_0xa7d8('0x11')]();})['then'](function(_0x46922b){logger[_0xa7d8('0x10')](_0x46922b);return pm2['start'](pm2Config);})[_0xa7d8('0xf')](function(_0x486f93){logger[_0xa7d8('0x10')](_0xa7d8('0x12'),_[_0xa7d8('0x13')](_['filter'](_0x486f93,{'status':_0xa7d8('0x14')}),_0xa7d8('0x15'))['join']());logger['info']('Offline\x20apps:',_[_0xa7d8('0x13')](_[_0xa7d8('0x16')](_0x486f93,function(_0x4835e9){return _0x4835e9[_0xa7d8('0x17')]!==_0xa7d8('0x14');}),_0xa7d8('0x15'))[_0xa7d8('0x18')]()||_0xa7d8('0x19'));config[_0xa7d8('0x1a')]&&require(_0xa7d8('0x1b'))[_0xa7d8('0x1c')]();require(_0xa7d8('0x1d'))[_0xa7d8('0x1c')]();})['catch'](function(_0x34eac8){logger[_0xa7d8('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x34eac8);process[_0xa7d8('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 96a5338..13390cd 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f58=['smsPause','openchannelPause','pauseType','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','json','unmanaged','Unmanaged.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','pass','Wrong\x20credentials.','Bearer','apikey','getUuid','query','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','join','promisify','sign','secret','session','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','email','userpic','permissions','md5secret','voicePause','mailPause'];(function(_0x56b50d,_0x2f4d83){var _0x1a732d=function(_0x19b500){while(--_0x19b500){_0x56b50d['push'](_0x56b50d['shift']());}};_0x1a732d(++_0x2f4d83);}(_0x0f58,0x164));var _0x80f5=function(_0xe15934,_0x5439fd){_0xe15934=_0xe15934-0x0;var _0x486c48=_0x0f58[_0xe15934];return _0x486c48;};'use strict';var db=require(_0x80f5('0x0'))['db'];var config=require(_0x80f5('0x1'));var hardwareConf=require(_0x80f5('0x2'));var licenseUtil=require(_0x80f5('0x3'));var encryptor=require(_0x80f5('0x4'));var _=require('lodash');var jwt=require(_0x80f5('0x5'));var expressJwt=require(_0x80f5('0x6'));var compose=require(_0x80f5('0x7'));var basicAuth=require(_0x80f5('0x8'));var crypto=require(_0x80f5('0x9'));var BPromise=require(_0x80f5('0xa'));var util=require(_0x80f5('0xb'));var moment=require(_0x80f5('0xc'));var validateJwt=expressJwt({'secret':config[_0x80f5('0xd')]['session']});var userAttributes=['id',_0x80f5('0xe'),'fullname',_0x80f5('0xf'),'internal',_0x80f5('0x10'),_0x80f5('0x11'),_0x80f5('0x12'),_0x80f5('0x13'),_0x80f5('0x14'),'chatPause',_0x80f5('0x15'),'faxPause',_0x80f5('0x16'),_0x80f5('0x17'),_0x80f5('0x18'),'showWebBar','lastLoginAt','lastPauseAt',_0x80f5('0x19'),_0x80f5('0x1a'),_0x80f5('0x1b'),'alias',_0x80f5('0x1c'),'phoneBarAutoAnswerDelay',_0x80f5('0x1d'),_0x80f5('0x1e'),_0x80f5('0x1f'),_0x80f5('0x20'),_0x80f5('0x21'),_0x80f5('0x22'),_0x80f5('0x23'),_0x80f5('0x24'),_0x80f5('0x25'),_0x80f5('0x26'),_0x80f5('0x27'),_0x80f5('0x28'),_0x80f5('0x29'),'wssPort','downloadVoiceRecordings',_0x80f5('0x2a'),_0x80f5('0x2b')];exports[_0x80f5('0x2c')]=function(){return this['isAuthenticated'](!![])[_0x80f5('0x2d')](function(_0x3f35a7,_0x1f5947,_0x38ecf0){if(_0x3f35a7[_0x80f5('0x2e')]){_0x38ecf0();}else{return db[_0x80f5('0x2f')][_0x80f5('0x30')]({'where':{'id':_0x3f35a7[_0x80f5('0x31')]['id']},'attributes':['id',_0x80f5('0x32'),_0x80f5('0x33')],'raw':!![]})[_0x80f5('0x34')](function(_0x45fdb9){if(_0x45fdb9&&_0x45fdb9['closed']){return _0x1f5947[_0x80f5('0x35')](_0x45fdb9['disposition']==='unmanaged'?0x195:0x193)[_0x80f5('0x36')]({'message':_0x45fdb9[_0x80f5('0x33')]===_0x80f5('0x37')?_0x80f5('0x38'):'Forbidden.'});}else{_0x38ecf0();}})[_0x80f5('0x39')](function(_0x3a1d16){_0x38ecf0(_0x3a1d16);});}});};exports[_0x80f5('0x3a')]=function isAuthenticated(_0xdfb7ad){return compose()[_0x80f5('0x2d')](function(_0x116508,_0x37e2ce,_0x423763){var _0x58668f;if(_0x116508[_0x80f5('0x3b')][_0x80f5('0x3c')]){if(_[_0x80f5('0x3d')](_0x116508[_0x80f5('0x3b')][_0x80f5('0x3c')],_0x80f5('0x3e'))){var _0x4207f9=basicAuth(_0x116508);db[_0x80f5('0x3f')]['find']({'where':{'name':_0x4207f9[_0x80f5('0xf')]}})[_0x80f5('0x34')](function(_0x5ad803){if(!_0x5ad803||!_0x5ad803['authenticate'](_0x4207f9[_0x80f5('0x40')])){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x41')});}_0x116508['user']={'id':_0x5ad803['id']};_0x423763();})[_0x80f5('0x39')](function(_0x254fb2){_0x423763(_0x254fb2);});}else if(_[_0x80f5('0x3d')](_0x116508[_0x80f5('0x3b')][_0x80f5('0x3c')],_0x80f5('0x42'))){validateJwt(_0x116508,_0x37e2ce,_0x423763);}else{if(_0xdfb7ad){_0x423763();}else{return _0x37e2ce[_0x80f5('0x35')](0x193)[_0x80f5('0x36')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x116508['query'][_0x80f5('0x43')]){try{var _0x3610b9={'audience':hardwareConf[_0x80f5('0x44')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x116508[_0x80f5('0x45')][_0x80f5('0x43')],_0x3610b9)[_0x80f5('0x34')](function(_0x4b23af){return db[_0x80f5('0x3f')][_0x80f5('0x46')]({'where':{'id':_0x4b23af[_0x80f5('0x47')]}})[_0x80f5('0x34')](function(_0x507a5c){_0x58668f=_0x507a5c;return db[_0x80f5('0x48')][_0x80f5('0x30')]({'where':{'id':0x1},'attributes':[_0x80f5('0x49'),_0x80f5('0x4a')],'raw':!![]});})[_0x80f5('0x34')](function(_0x10a3f2){if(!_0x58668f||!_[_0x80f5('0x4b')](_0x58668f['apiKeyNonce'],_0x4b23af[_0x80f5('0x4c')])){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4d')});}if(_0x58668f[_0x80f5('0x4e')]){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});}if(_0x58668f[_0x80f5('0x50')]){if(_0x10a3f2[_0x80f5('0x4a')]>0x0){if(moment(_0x58668f['blockedAt'])['add'](_0x10a3f2[_0x80f5('0x4a')],_0x80f5('0x51'))>moment()){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});}}else{return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});}}_0x116508[_0x80f5('0x2e')]={'id':_0x58668f['id']};_0x423763();});})[_0x80f5('0x39')](function(){return _0x37e2ce[_0x80f5('0x35')](0x191)[_0x80f5('0x36')]({'message':_0x80f5('0x4f')});});}catch(_0x1057b6){_0x423763(_0x1057b6);}}else if(_0xdfb7ad){_0x423763();}else{return _0x37e2ce[_0x80f5('0x35')](0x193)['json']({'message':_0x80f5('0x52')});}})[_0x80f5('0x2d')](function(_0x4ba683,_0xd94a82,_0x1f3438){if(_0x4ba683['user']){db[_0x80f5('0x3f')][_0x80f5('0x46')]({'where':{'id':_0x4ba683[_0x80f5('0x2e')]['id']},'attributes':userAttributes})['then'](function(_0x39caed){if(!_0x39caed){return _0xd94a82[_0x80f5('0x35')](0x194)[_0x80f5('0x36')]({'message':_0x80f5('0x53')});}_0x4ba683[_0x80f5('0x2e')]=_0x39caed;_0x1f3438();})[_0x80f5('0x39')](function(_0x388518){_0x1f3438(_0x388518);});}else if(_0xdfb7ad){_0x1f3438();}else{return _0xd94a82[_0x80f5('0x35')](0x194)[_0x80f5('0x36')]({'message':_0x80f5('0x54')});}});};exports[_0x80f5('0x55')]=function canUpdate(){return compose()[_0x80f5('0x2d')](function(_0x1822ae,_0x12dc7c,_0x21e0cb){return licenseUtil['getLicense']()[_0x80f5('0x34')](function(_0x544dcd){if(_0x544dcd[_0x80f5('0x56')]){_0x21e0cb();}else{return _0x12dc7c[_0x80f5('0x35')](0x193)[_0x80f5('0x36')]({'message':_0x80f5('0x57')});}})['catch'](function(_0x5c69eb){_0x21e0cb(_0x5c69eb);});});};exports[_0x80f5('0x58')]=function(_0x1da06d,_0x4a22e5,_0x321fcf){_0x1da06d[_0x80f5('0x58')]=!![];return _0x321fcf();};exports[_0x80f5('0x59')]=function signToken(_0x3835e2){return signJwt(_0x3835e2);};exports['setTokenCookie']=function(_0x428e85,_0x1570f1){if(!_0x428e85[_0x80f5('0x2e')]){return _0x1570f1[_0x80f5('0x35')](0x194)[_0x80f5('0x36')]({'message':_0x80f5('0x5a')});}var _0x1ad1a9={'payload':{'id':_0x428e85[_0x80f5('0x2e')]['id'],'role':_0x428e85[_0x80f5('0x2e')][_0x80f5('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1ad1a9)[_0x80f5('0x34')](function(_0x4b1897){_0x1570f1[_0x80f5('0x5b')](_0x80f5('0x5c'),_0x4b1897);_0x1570f1['redirect'](_0x80f5('0x5d'));})[_0x80f5('0x39')](function(_0x2e7132){return _0x1570f1[_0x80f5('0x35')](0x1f4)[_0x80f5('0x5e')](_0x2e7132);});};exports['retrieveApiKey']=function(_0x399f76){if(_[_0x80f5('0x5f')](_0x399f76[_0x80f5('0x60')])||_['isNil'](_0x399f76[_0x80f5('0x61')])){return null;}else{return createJwt(_0x399f76);}};exports[_0x80f5('0x62')]=function(_0x4fb838){_0x4fb838[_0x80f5('0x60')]=generateNonce();_0x4fb838[_0x80f5('0x61')]=generateIssuedAt();return createJwt(_0x4fb838);};exports[_0x80f5('0x63')]=function(_0x303c17,_0x833f7){var _0x21abd1=_0x303c17[_0x80f5('0x45')][_0x80f5('0x43')];if(_0x21abd1){var _0x4f28e3={'nonce':_0x833f7[_0x80f5('0x60')],'iat':_0x833f7['apiKeyIat'],'audience':hardwareConf[_0x80f5('0x44')](),'issuer':hardwareConf[_0x80f5('0x44')]()};return verifyJwt(_0x21abd1,_0x4f28e3)[_0x80f5('0x34')](function(){return generateApiKey(_0x833f7);});}else{throw{'message':_0x80f5('0x64')};}};exports[_0x80f5('0x65')]=function(_0x12d3d5){var _0x47c1cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x47c1cb['test'](_0x12d3d5))throw new db[(_0x80f5('0x66'))][(_0x80f5('0x67'))](_0x80f5('0x68'));return;};exports[_0x80f5('0x69')]=function(_0x5386de,_0x4e4852,_0xe97373){var _0x165129=encryptor[_0x80f5('0x6a')](_0x4e4852)[_0x80f5('0x6b')](',');for(var _0x427393=0x0;_0x427393<_0xe97373;_0x427393++){if(!_0x165129[_0x427393])break;if(_0x5386de[_0x80f5('0x6c')]()===_0x165129[_0x427393]['toLowerCase']()){var _0x7a657=util[_0x80f5('0x6d')](_0x80f5('0x6e'),_0xe97373);if(_0xe97373===0x1){_0x7a657=_0x80f5('0x6f');}throw new db['Sequelize'][(_0x80f5('0x67'))](_0x7a657);}}return;};exports[_0x80f5('0x70')]=function(_0x4af110,_0x1faaf3){var _0x445056=_0x1faaf3?encryptor[_0x80f5('0x6a')](_0x1faaf3)[_0x80f5('0x6b')](','):[];if(_0x445056['length']===0x5){_0x445056['splice'](-0x1,0x1);}_0x445056['unshift'](_0x4af110);return encryptor['encryptString'](_0x445056[_0x80f5('0x71')](','));};function signJwt(_0x2de122){var _0x1d433d=BPromise[_0x80f5('0x72')](jwt[_0x80f5('0x73')],{'context':jwt});var _0x28122f=_0x2de122[_0x80f5('0x74')]||config['secrets'][_0x80f5('0x75')];return new BPromise(function(_0x447767,_0x26388c){_0x1d433d(_0x2de122[_0x80f5('0x76')],_0x28122f,_0x2de122['options'])['then'](function(_0x449965){_0x447767(_0x449965);})[_0x80f5('0x39')](function(_0x289478){_0x26388c(_0x289478);});});}function verifyJwt(_0x4b8791,_0x2a6b08,_0x3b774e){var _0x3615af=BPromise['promisify'](jwt[_0x80f5('0x77')],{'context':jwt});var _0x33fbef=_0x3b774e||config[_0x80f5('0xd')]['session'];return new BPromise(function(_0x4b6676,_0x2a41b7){_0x3615af(_0x4b8791,_0x33fbef,_0x2a6b08)[_0x80f5('0x34')](function(_0x24748b){_0x4b6676(_0x24748b);})['catch'](function(_0x2062f6){_0x2a41b7(_0x2062f6);});});}function generateNonce(){return crypto[_0x80f5('0x78')](0x10)[_0x80f5('0x79')](_0x80f5('0x7a'));}function generateIssuedAt(){return Math[_0x80f5('0x7b')](Date[_0x80f5('0x7c')]()/0x3e8)[_0x80f5('0x79')]();}function createJwt(_0x1ae4d7){var _0x2e0238={'payload':{'iat':_0x1ae4d7[_0x80f5('0x61')],'nonce':_0x1ae4d7[_0x80f5('0x60')]},'options':{'algorithm':_0x80f5('0x7d'),'subject':_0x1ae4d7['id'][_0x80f5('0x79')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2e0238)['then'](function(_0x14f23){return{'iat':_0x1ae4d7[_0x80f5('0x61')],'nonce':_0x1ae4d7['apiKeyNonce'],'token':_0x14f23};});} \ No newline at end of file +var _0xf8eb=['composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','closed','status','unmanaged','json','disposition','catch','use','headers','authorization','startsWith','Basic','find','then','user','Bearer','Unknown\x20authorization\x20format','getUuid','User','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','query','apikey','validatePasswordPattern','Sequelize','ValidationError','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','sign','secret','payload','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf8eb,0x159));var _0xbf8e=function(_0x880009,_0x1a36f4){_0x880009=_0x880009-0x0;var _0x541685=_0xf8eb[_0x880009];return _0x541685;};'use strict';var db=require(_0xbf8e('0x0'))['db'];var config=require(_0xbf8e('0x1'));var hardwareConf=require(_0xbf8e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xbf8e('0x3'));var jwt=require(_0xbf8e('0x4'));var expressJwt=require(_0xbf8e('0x5'));var compose=require(_0xbf8e('0x6'));var basicAuth=require(_0xbf8e('0x7'));var crypto=require('crypto');var BPromise=require(_0xbf8e('0x8'));var util=require(_0xbf8e('0x9'));var moment=require(_0xbf8e('0xa'));var validateJwt=expressJwt({'secret':config[_0xbf8e('0xb')][_0xbf8e('0xc')]});var userAttributes=['id',_0xbf8e('0xd'),_0xbf8e('0xe'),_0xbf8e('0xf'),_0xbf8e('0x10'),_0xbf8e('0x11'),_0xbf8e('0x12'),_0xbf8e('0x13'),'md5secret',_0xbf8e('0x14'),_0xbf8e('0x15'),_0xbf8e('0x16'),_0xbf8e('0x17'),_0xbf8e('0x18'),_0xbf8e('0x19'),_0xbf8e('0x1a'),_0xbf8e('0x1b'),'lastLoginAt',_0xbf8e('0x1c'),'crudPermissions',_0xbf8e('0x1d'),_0xbf8e('0x1e'),_0xbf8e('0x1f'),_0xbf8e('0x20'),'phoneBarAutoAnswerDelay',_0xbf8e('0x21'),'phoneBarEnableRecording',_0xbf8e('0x22'),'phoneBarEnableSettings',_0xbf8e('0x23'),'phoneBarPrefixRequired',_0xbf8e('0x24'),_0xbf8e('0x25'),_0xbf8e('0x26'),_0xbf8e('0x27'),'userProfileId','privacyEnabled',_0xbf8e('0x28'),_0xbf8e('0x29'),_0xbf8e('0x2a'),'downloadOmnichannelInteractions',_0xbf8e('0x2b')];exports[_0xbf8e('0x2c')]=function(){return this[_0xbf8e('0x2d')](!![])['use'](function(_0x39ec63,_0x4f2647,_0x29fc5a){if(_0x39ec63['user']){_0x29fc5a();}else{return db[_0xbf8e('0x2e')][_0xbf8e('0x2f')]({'where':{'id':_0x39ec63['params']['id']},'attributes':['id',_0xbf8e('0x30'),'disposition'],'raw':!![]})['then'](function(_0x41978a){if(_0x41978a&&_0x41978a[_0xbf8e('0x30')]){return _0x4f2647[_0xbf8e('0x31')](_0x41978a['disposition']===_0xbf8e('0x32')?0x195:0x193)[_0xbf8e('0x33')]({'message':_0x41978a[_0xbf8e('0x34')]===_0xbf8e('0x32')?'Unmanaged.':'Forbidden.'});}else{_0x29fc5a();}})[_0xbf8e('0x35')](function(_0x3cef7b){_0x29fc5a(_0x3cef7b);});}});};exports[_0xbf8e('0x2d')]=function isAuthenticated(_0x2d0178){return compose()[_0xbf8e('0x36')](function(_0x3aafeb,_0x2e4e26,_0xfe6572){var _0x3c68db;if(_0x3aafeb[_0xbf8e('0x37')][_0xbf8e('0x38')]){if(_[_0xbf8e('0x39')](_0x3aafeb[_0xbf8e('0x37')][_0xbf8e('0x38')],_0xbf8e('0x3a'))){var _0x553905=basicAuth(_0x3aafeb);db['User'][_0xbf8e('0x3b')]({'where':{'name':_0x553905[_0xbf8e('0xf')]}})[_0xbf8e('0x3c')](function(_0x415c14){if(!_0x415c14||!_0x415c14['authenticate'](_0x553905['pass'])){return _0x2e4e26[_0xbf8e('0x31')](0x191)[_0xbf8e('0x33')]({'message':'Wrong\x20credentials.'});}_0x3aafeb[_0xbf8e('0x3d')]={'id':_0x415c14['id']};_0xfe6572();})['catch'](function(_0x1e59b6){_0xfe6572(_0x1e59b6);});}else if(_['startsWith'](_0x3aafeb[_0xbf8e('0x37')][_0xbf8e('0x38')],_0xbf8e('0x3e'))){validateJwt(_0x3aafeb,_0x2e4e26,_0xfe6572);}else{if(_0x2d0178){_0xfe6572();}else{return _0x2e4e26[_0xbf8e('0x31')](0x193)['json']({'message':_0xbf8e('0x3f')});}}}else if(_0x3aafeb['query']['apikey']){try{var _0x1a1a8c={'audience':hardwareConf[_0xbf8e('0x40')](),'issuer':hardwareConf[_0xbf8e('0x40')]()};verifyJwt(_0x3aafeb['query']['apikey'],_0x1a1a8c)['then'](function(_0x28dfb5){return db[_0xbf8e('0x41')][_0xbf8e('0x3b')]({'where':{'id':_0x28dfb5[_0xbf8e('0x42')]}})[_0xbf8e('0x3c')](function(_0x13877){_0x3c68db=_0x13877;return db['Setting'][_0xbf8e('0x2f')]({'where':{'id':0x1},'attributes':[_0xbf8e('0x43'),_0xbf8e('0x44')],'raw':!![]});})[_0xbf8e('0x3c')](function(_0x4c1acc){if(!_0x3c68db||!_[_0xbf8e('0x45')](_0x3c68db[_0xbf8e('0x46')],_0x28dfb5['nonce'])){return _0x2e4e26['status'](0x191)['json']({'message':_0xbf8e('0x47')});}if(_0x3c68db[_0xbf8e('0x48')]){return _0x2e4e26[_0xbf8e('0x31')](0x191)[_0xbf8e('0x33')]({'message':_0xbf8e('0x49')});}if(_0x3c68db['blocked']){if(_0x4c1acc[_0xbf8e('0x44')]>0x0){if(moment(_0x3c68db[_0xbf8e('0x4a')])['add'](_0x4c1acc[_0xbf8e('0x44')],'minutes')>moment()){return _0x2e4e26[_0xbf8e('0x31')](0x191)['json']({'message':_0xbf8e('0x49')});}}else{return _0x2e4e26['status'](0x191)[_0xbf8e('0x33')]({'message':_0xbf8e('0x49')});}}_0x3aafeb['user']={'id':_0x3c68db['id']};_0xfe6572();});})['catch'](function(){return _0x2e4e26['status'](0x191)['json']({'message':_0xbf8e('0x49')});});}catch(_0x4494a4){_0xfe6572(_0x4494a4);}}else if(_0x2d0178){_0xfe6572();}else{return _0x2e4e26['status'](0x193)[_0xbf8e('0x33')]({'message':_0xbf8e('0x3f')});}})['use'](function(_0x470495,_0x44b96b,_0x394e31){if(_0x470495[_0xbf8e('0x3d')]){db[_0xbf8e('0x41')][_0xbf8e('0x3b')]({'where':{'id':_0x470495['user']['id']},'attributes':userAttributes})['then'](function(_0x8f5491){if(!_0x8f5491){return _0x44b96b['status'](0x194)[_0xbf8e('0x33')]({'message':_0xbf8e('0x4b')});}_0x470495[_0xbf8e('0x3d')]=_0x8f5491;_0x394e31();})[_0xbf8e('0x35')](function(_0x235686){_0x394e31(_0x235686);});}else if(_0x2d0178){_0x394e31();}else{return _0x44b96b[_0xbf8e('0x31')](0x194)[_0xbf8e('0x33')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xbf8e('0x4c')]=function canUpdate(){return compose()['use'](function(_0x279dad,_0xbddee4,_0x354fd4){return licenseUtil[_0xbf8e('0x4d')]()[_0xbf8e('0x3c')](function(_0x21fca4){if(_0x21fca4[_0xbf8e('0x4e')]){_0x354fd4();}else{return _0xbddee4[_0xbf8e('0x31')](0x193)[_0xbf8e('0x33')]({'message':_0xbf8e('0x4f')});}})['catch'](function(_0x5550ee){_0x354fd4(_0x5550ee);});});};exports[_0xbf8e('0x50')]=function(_0x44451c,_0x47d325,_0xf0b5f4){_0x44451c[_0xbf8e('0x50')]=!![];return _0xf0b5f4();};exports[_0xbf8e('0x51')]=function signToken(_0x38eba2){return signJwt(_0x38eba2);};exports[_0xbf8e('0x52')]=function(_0x5f297f,_0x232604){if(!_0x5f297f[_0xbf8e('0x3d')]){return _0x232604['status'](0x194)[_0xbf8e('0x33')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x33b8d5={'payload':{'id':_0x5f297f[_0xbf8e('0x3d')]['id'],'role':_0x5f297f[_0xbf8e('0x3d')][_0xbf8e('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x33b8d5)[_0xbf8e('0x3c')](function(_0x44a80a){_0x232604[_0xbf8e('0x53')](_0xbf8e('0x54'),_0x44a80a);_0x232604['redirect'](_0xbf8e('0x55'));})['catch'](function(_0x76a157){return _0x232604[_0xbf8e('0x31')](0x1f4)[_0xbf8e('0x56')](_0x76a157);});};exports[_0xbf8e('0x57')]=function(_0x5af4d9){if(_[_0xbf8e('0x58')](_0x5af4d9[_0xbf8e('0x46')])||_[_0xbf8e('0x58')](_0x5af4d9[_0xbf8e('0x59')])){return null;}else{return createJwt(_0x5af4d9);}};exports[_0xbf8e('0x5a')]=function(_0x377c00){_0x377c00[_0xbf8e('0x46')]=generateNonce();_0x377c00[_0xbf8e('0x59')]=generateIssuedAt();return createJwt(_0x377c00);};exports[_0xbf8e('0x5b')]=function(_0x4fa5c4,_0x21c516){var _0x35d1fa=_0x4fa5c4[_0xbf8e('0x5c')][_0xbf8e('0x5d')];if(_0x35d1fa){var _0x76da5f={'nonce':_0x21c516[_0xbf8e('0x46')],'iat':_0x21c516[_0xbf8e('0x59')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xbf8e('0x40')]()};return verifyJwt(_0x35d1fa,_0x76da5f)[_0xbf8e('0x3c')](function(){return generateApiKey(_0x21c516);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xbf8e('0x5e')]=function(_0x302b8e){var _0x4cd2d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4cd2d3['test'](_0x302b8e))throw new db[(_0xbf8e('0x5f'))][(_0xbf8e('0x60'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x16bf1e,_0x2b2887,_0x47adc4){var _0x293fe4=encryptor[_0xbf8e('0x61')](_0x2b2887)[_0xbf8e('0x62')](',');for(var _0x44e928=0x0;_0x44e928<_0x47adc4;_0x44e928++){if(!_0x293fe4[_0x44e928])break;if(_0x16bf1e[_0xbf8e('0x63')]()===_0x293fe4[_0x44e928][_0xbf8e('0x63')]()){var _0x4b5fb6=util[_0xbf8e('0x64')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x47adc4);if(_0x47adc4===0x1){_0x4b5fb6=_0xbf8e('0x65');}throw new db[(_0xbf8e('0x5f'))]['ValidationError'](_0x4b5fb6);}}return;};exports[_0xbf8e('0x66')]=function(_0xbf1c14,_0x30ffc6){var _0x5cf01b=_0x30ffc6?encryptor[_0xbf8e('0x61')](_0x30ffc6)['split'](','):[];if(_0x5cf01b[_0xbf8e('0x67')]===0x5){_0x5cf01b[_0xbf8e('0x68')](-0x1,0x1);}_0x5cf01b[_0xbf8e('0x69')](_0xbf1c14);return encryptor[_0xbf8e('0x6a')](_0x5cf01b['join'](','));};function signJwt(_0x5686da){var _0x2dfb62=BPromise[_0xbf8e('0x6b')](jwt[_0xbf8e('0x6c')],{'context':jwt});var _0x2250ef=_0x5686da[_0xbf8e('0x6d')]||config[_0xbf8e('0xb')][_0xbf8e('0xc')];return new BPromise(function(_0x63814f,_0x11d0c6){_0x2dfb62(_0x5686da[_0xbf8e('0x6e')],_0x2250ef,_0x5686da['options'])[_0xbf8e('0x3c')](function(_0x433b98){_0x63814f(_0x433b98);})[_0xbf8e('0x35')](function(_0x1f4f89){_0x11d0c6(_0x1f4f89);});});}function verifyJwt(_0x1caea4,_0x9347a3,_0x335cfa){var _0x201535=BPromise['promisify'](jwt[_0xbf8e('0x6f')],{'context':jwt});var _0x2a2b0f=_0x335cfa||config['secrets']['session'];return new BPromise(function(_0x37670f,_0x3400c1){_0x201535(_0x1caea4,_0x2a2b0f,_0x9347a3)[_0xbf8e('0x3c')](function(_0x19984a){_0x37670f(_0x19984a);})[_0xbf8e('0x35')](function(_0x42d57e){_0x3400c1(_0x42d57e);});});}function generateNonce(){return crypto[_0xbf8e('0x70')](0x10)[_0xbf8e('0x71')](_0xbf8e('0x72'));}function generateIssuedAt(){return Math[_0xbf8e('0x73')](Date[_0xbf8e('0x74')]()/0x3e8)[_0xbf8e('0x71')]();}function createJwt(_0x313e1d){var _0x28d886={'payload':{'iat':_0x313e1d[_0xbf8e('0x59')],'nonce':_0x313e1d[_0xbf8e('0x46')]},'options':{'algorithm':'HS512','subject':_0x313e1d['id']['toString'](),'issuer':hardwareConf[_0xbf8e('0x40')](),'audience':hardwareConf[_0xbf8e('0x40')]()}};return signJwt(_0x28d886)[_0xbf8e('0x3c')](function(_0xcc0646){return{'iat':_0x313e1d['apiKeyIat'],'nonce':_0x313e1d[_0xbf8e('0x46')],'token':_0xcc0646};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index a48d03c..2038da2 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8e8=['filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','end','binary','close','unlink','decryptFile','createDecipher','write','final','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','session','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers'];(function(_0x315114,_0x7aab60){var _0x7d16b7=function(_0x14747a){while(--_0x14747a){_0x315114['push'](_0x315114['shift']());}};_0x7d16b7(++_0x7aab60);}(_0xd8e8,0x13e));var _0x8d8e=function(_0x6009e4,_0x53d114){_0x6009e4=_0x6009e4-0x0;var _0x3c4161=_0xd8e8[_0x6009e4];return _0x3c4161;};'use strict';var crypto=require(_0x8d8e('0x0'));var fs=require('fs');var BPromise=require(_0x8d8e('0x1'));var _=require(_0x8d8e('0x2'));var config=require(_0x8d8e('0x3'));var logger=require('../../config/logger')(_0x8d8e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x8d8e('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x8d8e('0x6')};if(config[_0x8d8e('0x7')]&&config[_0x8d8e('0x7')][_0x8d8e('0x8')]){var isSupported=isAlgorithmSupported(config[_0x8d8e('0x7')][_0x8d8e('0x8')]);if(isSupported){fileOptions[_0x8d8e('0x8')]=config['encrypt'][_0x8d8e('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x8d8e('0x9')](config[_0x8d8e('0x7')][_0x8d8e('0x8')],_0x8d8e('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x5bcc5e){return AES_SUPPORTED_RX['test'](_0x5bcc5e);}function getSupportedCiphers(){return crypto[_0x8d8e('0xb')]()[_0x8d8e('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x2130d7){return getSupportedCiphers()['indexOf'](_0x2130d7)>-0x1;}function combineOptions(_0x16d690){var _0x3141b9={};for(var _0x256bbd in fileOptions){if(fileOptions[_0x8d8e('0xd')](_0x256bbd)){_0x3141b9[_0x256bbd]=fileOptions[_0x256bbd];}}if(_0x16d690){for(var _0x35b30e in _0x16d690){if(_0x16d690['hasOwnProperty'](_0x35b30e)){_0x3141b9[_0x35b30e]=_0x16d690[_0x35b30e];}}}return _0x3141b9;}exports[_0x8d8e('0xe')]=function(_0x4fd1e2,_0x391340,_0x3f0049,_0x15129b){return new BPromise(function(_0x20c6b2,_0x2fc793){_0x15129b=combineOptions(_0x15129b);var _0x40dc25=new Buffer(_0x3f0049);var _0x5db067=fs[_0x8d8e('0xf')](_0x4fd1e2);var _0x22a926=fs[_0x8d8e('0x10')](_0x391340);var _0x402fd0=crypto[_0x8d8e('0x11')](_0x15129b[_0x8d8e('0x8')],_0x40dc25);_0x5db067['on'](_0x8d8e('0x12'),function(_0xd6e13){var _0x3b2b9c=new Buffer(_0x402fd0[_0x8d8e('0x13')](_0xd6e13),'binary');_0x22a926['write'](_0x3b2b9c);});_0x5db067['on'](_0x8d8e('0x14'),function(){try{var _0x107850=new Buffer(_0x402fd0['final']('binary'),_0x8d8e('0x15'));_0x22a926['write'](_0x107850);_0x22a926[_0x8d8e('0x14')]();_0x22a926['on'](_0x8d8e('0x16'),function(){return _0x20c6b2(_0x391340);});}catch(_0x48a6b9){fs[_0x8d8e('0x17')](_0x391340);return _0x2fc793(_0x48a6b9);}});});};exports[_0x8d8e('0x18')]=function(_0x17c203,_0x115152,_0x311f19,_0x78b349){return new BPromise(function(_0x311424,_0x8bcadc){_0x78b349=combineOptions(_0x78b349);var _0x21a990=new Buffer(_0x311f19);var _0x1f8669=fs[_0x8d8e('0xf')](_0x17c203);var _0x559c66=fs[_0x8d8e('0x10')](_0x115152);var _0xea170f=crypto[_0x8d8e('0x19')](_0x78b349[_0x8d8e('0x8')],_0x21a990);_0x1f8669['on']('data',function(_0x4bf57f){var _0x5dc765=new Buffer(_0xea170f['update'](_0x4bf57f),_0x8d8e('0x15'));_0x559c66[_0x8d8e('0x1a')](_0x5dc765);});_0x1f8669['on'](_0x8d8e('0x14'),function(){try{var _0x5a7df1=new Buffer(_0xea170f[_0x8d8e('0x1b')](_0x8d8e('0x15')),_0x8d8e('0x15'));_0x559c66[_0x8d8e('0x1a')](_0x5a7df1);_0x559c66['end']();_0x559c66['on']('close',function(){return _0x311424(_0x115152);});}catch(_0x46b761){fs['unlink'](_0x115152);return _0x8bcadc(_0x46b761);}});});};exports[_0x8d8e('0x1c')]=function(_0x80a086,_0x12c1b1,_0x486f60){var _0x28f573=_0x486f60||stringOptions[_0x8d8e('0x8')];var _0x139e06=_0x12c1b1||stringOptions[_0x8d8e('0x1d')];var _0x5bd543=crypto[_0x8d8e('0x11')](_0x28f573,_0x139e06);var _0x199c1b=_0x5bd543[_0x8d8e('0x13')](_0x80a086,_0x8d8e('0x1e'),_0x8d8e('0x1f'));_0x199c1b+=_0x5bd543[_0x8d8e('0x1b')](_0x8d8e('0x1f'));return _0x199c1b;};exports[_0x8d8e('0x20')]=function(_0x4f0faa,_0x42a416,_0x22a083){var _0x23677a=_0x22a083||stringOptions['algorithm'];var _0x14771e=_0x42a416||stringOptions[_0x8d8e('0x1d')];var _0x593847=crypto[_0x8d8e('0x19')](_0x23677a,_0x14771e);var _0xdfe0b9=_0x593847[_0x8d8e('0x13')](_0x4f0faa,_0x8d8e('0x1f'),'utf8');_0xdfe0b9+=_0x593847['final']('utf8');return _0xdfe0b9;}; \ No newline at end of file +var _0x8a93=['../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','indexOf','hasOwnProperty','createReadStream','data','update','binary','write','end','final','unlink','decryptFile','createWriteStream','close','encryptString','createCipher','utf8','base64','decryptString','secret','createDecipher','crypto','bluebird','lodash'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8a93,0x141));var _0x38a9=function(_0xf27a5d,_0x5a3b2f){_0xf27a5d=_0xf27a5d-0x0;var _0x217da7=_0x8a93[_0xf27a5d];return _0x217da7;};'use strict';var crypto=require(_0x38a9('0x0'));var fs=require('fs');var BPromise=require(_0x38a9('0x1'));var _=require(_0x38a9('0x2'));var config=require(_0x38a9('0x3'));var logger=require(_0x38a9('0x4'))(_0x38a9('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x38a9('0x6')][_0x38a9('0x7')],'algorithm':_0x38a9('0x8')};const fileOptions={'algorithm':_0x38a9('0x9')};if(config[_0x38a9('0xa')]&&config[_0x38a9('0xa')][_0x38a9('0xb')]){var isSupported=isAlgorithmSupported(config[_0x38a9('0xa')][_0x38a9('0xb')]);if(isSupported){fileOptions[_0x38a9('0xb')]=config[_0x38a9('0xa')][_0x38a9('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x38a9('0xc')](',\x20');logger[_0x38a9('0xd')](config[_0x38a9('0xa')][_0x38a9('0xb')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x36d65a){return AES_SUPPORTED_RX[_0x38a9('0xe')](_0x36d65a);}function getSupportedCiphers(){return crypto[_0x38a9('0xf')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x13deae){return getSupportedCiphers()[_0x38a9('0x10')](_0x13deae)>-0x1;}function combineOptions(_0x119059){var _0x2ecc19={};for(var _0x1c94ca in fileOptions){if(fileOptions[_0x38a9('0x11')](_0x1c94ca)){_0x2ecc19[_0x1c94ca]=fileOptions[_0x1c94ca];}}if(_0x119059){for(var _0x6edaf7 in _0x119059){if(_0x119059[_0x38a9('0x11')](_0x6edaf7)){_0x2ecc19[_0x6edaf7]=_0x119059[_0x6edaf7];}}}return _0x2ecc19;}exports['encryptFile']=function(_0xc068e7,_0x48384a,_0x5d6cca,_0x4b4cb2){return new BPromise(function(_0x3f5edf,_0xb58728){_0x4b4cb2=combineOptions(_0x4b4cb2);var _0x5109b7=new Buffer(_0x5d6cca);var _0x252f96=fs[_0x38a9('0x12')](_0xc068e7);var _0x43f37e=fs['createWriteStream'](_0x48384a);var _0x3ac759=crypto['createCipher'](_0x4b4cb2['algorithm'],_0x5109b7);_0x252f96['on'](_0x38a9('0x13'),function(_0x1831a1){var _0x5c56d2=new Buffer(_0x3ac759[_0x38a9('0x14')](_0x1831a1),_0x38a9('0x15'));_0x43f37e[_0x38a9('0x16')](_0x5c56d2);});_0x252f96['on'](_0x38a9('0x17'),function(){try{var _0x5bbe78=new Buffer(_0x3ac759[_0x38a9('0x18')](_0x38a9('0x15')),'binary');_0x43f37e[_0x38a9('0x16')](_0x5bbe78);_0x43f37e['end']();_0x43f37e['on']('close',function(){return _0x3f5edf(_0x48384a);});}catch(_0x2d69fb){fs[_0x38a9('0x19')](_0x48384a);return _0xb58728(_0x2d69fb);}});});};exports[_0x38a9('0x1a')]=function(_0x390ff7,_0x40b340,_0x5e12b5,_0x44776b){return new BPromise(function(_0x332a45,_0x569bfa){_0x44776b=combineOptions(_0x44776b);var _0xc21d87=new Buffer(_0x5e12b5);var _0x43b077=fs[_0x38a9('0x12')](_0x390ff7);var _0x2ed7b1=fs[_0x38a9('0x1b')](_0x40b340);var _0xb9d2b9=crypto['createDecipher'](_0x44776b[_0x38a9('0xb')],_0xc21d87);_0x43b077['on'](_0x38a9('0x13'),function(_0x4dd224){var _0x22ad96=new Buffer(_0xb9d2b9[_0x38a9('0x14')](_0x4dd224),_0x38a9('0x15'));_0x2ed7b1[_0x38a9('0x16')](_0x22ad96);});_0x43b077['on'](_0x38a9('0x17'),function(){try{var _0x26a17a=new Buffer(_0xb9d2b9[_0x38a9('0x18')](_0x38a9('0x15')),_0x38a9('0x15'));_0x2ed7b1[_0x38a9('0x16')](_0x26a17a);_0x2ed7b1[_0x38a9('0x17')]();_0x2ed7b1['on'](_0x38a9('0x1c'),function(){return _0x332a45(_0x40b340);});}catch(_0x11e260){fs['unlink'](_0x40b340);return _0x569bfa(_0x11e260);}});});};exports[_0x38a9('0x1d')]=function(_0x2f2669,_0x34027f,_0x469f0a){var _0xe18df6=_0x469f0a||stringOptions[_0x38a9('0xb')];var _0x144429=_0x34027f||stringOptions['secret'];var _0x115342=crypto[_0x38a9('0x1e')](_0xe18df6,_0x144429);var _0x11c18a=_0x115342[_0x38a9('0x14')](_0x2f2669,_0x38a9('0x1f'),_0x38a9('0x20'));_0x11c18a+=_0x115342[_0x38a9('0x18')](_0x38a9('0x20'));return _0x11c18a;};exports[_0x38a9('0x21')]=function(_0x5c8ed7,_0x131d61,_0x2164f2){var _0x515140=_0x2164f2||stringOptions['algorithm'];var _0x11eaf2=_0x131d61||stringOptions[_0x38a9('0x22')];var _0x7b3843=crypto[_0x38a9('0x23')](_0x515140,_0x11eaf2);var _0x4b8004=_0x7b3843[_0x38a9('0x14')](_0x5c8ed7,_0x38a9('0x20'),_0x38a9('0x1f'));_0x4b8004+=_0x7b3843[_0x38a9('0x18')](_0x38a9('0x1f'));return _0x4b8004;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6ae66f0..c3e3537 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10ab=['then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','%s.%s','csv','writeFileSync','zip','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x10ab,0x6d));var _0xb10a=function(_0x2c6805,_0x46f0c5){_0x2c6805=_0x2c6805-0x0;var _0x523793=_0x10ab[_0x2c6805];return _0x523793;};'use strict';var util=require(_0xb10a('0x0'));var path=require(_0xb10a('0x1'));var _=require(_0xb10a('0x2'));var csv=require(_0xb10a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xb10a('0x4'));var rimraf=require(_0xb10a('0x5'));var db=require(_0xb10a('0x6'))['db'];var dbH=require(_0xb10a('0x6'))[_0xb10a('0x7')];var logger=require('../../config/logger')(_0xb10a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb10a('0x9')][0x2]);var QUERY=process[_0xb10a('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cabd5,_0x34c044){var _0x1db285={'status':_0x2cabd5};var _0x58b7bc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34c044){_0x1db285['savename']=_0x34c044;}return db[_0xb10a('0xa')][_0xb10a('0xb')](_0x1db285,_0x58b7bc);}function main(){var _0x17c234=0x1388;var _0x446701;logger[_0xb10a('0xc')](util[_0xb10a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xb10a('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb10a('0xf'),_0xb10a('0x10')]})[_0xb10a('0x11')](function(_0x94bdb){if(_0x94bdb){_0x446701=_0x94bdb;_0x17c234=_0x446701[_0xb10a('0x10')]||0x1388;}})['then'](function(){return dbH[_0xb10a('0x12')][_0xb10a('0x13')](util['format'](_0xb10a('0x14'),QUERY),{'type':dbH[_0xb10a('0x12')][_0xb10a('0x15')][_0xb10a('0x16')]});})[_0xb10a('0x11')](function(_0x3a5c46){if(!_0x3a5c46[0x0][_0xb10a('0x17')]){return analyticExtractedReport('Empty');}var _0x36b9a3=[];var _0x319020=0x0;var _0x34098b=!![];if(_0x3a5c46&&_0x3a5c46[_0xb10a('0x18')]){var _0x56845f=_0x3a5c46[0x0][_0xb10a('0x17')]%(_0x319020+_0x17c234);if(_0x446701[_0xb10a('0xf')]){for(;_0x34098b;_0x319020+=_0x17c234,_0x56845f=_0x3a5c46[0x0]['num']%(_0x319020+_0x17c234)){if(_0x56845f==0x0||_0x56845f==_0x3a5c46[0x0]['num']){_0x34098b=![];}_0x36b9a3[_0xb10a('0x19')](dbH[_0xb10a('0x12')][_0xb10a('0x13')](util[_0xb10a('0xd')](_0xb10a('0x1a'),QUERY,_0x17c234,_0x319020),{'type':dbH[_0xb10a('0x12')]['QueryTypes']['SELECT']}));}}else{_0x36b9a3[_0xb10a('0x19')](dbH[_0xb10a('0x12')][_0xb10a('0x13')](QUERY,{'type':dbH[_0xb10a('0x12')]['QueryTypes'][_0xb10a('0x16')]}));}}var _0x20ac27=path['dirname'](PATH);var _0x4abc4a=path[_0xb10a('0x1b')](PATH,_0xb10a('0x1c'));var _0x1bfdd2=_0x446701[_0xb10a('0xf')]&&_0x36b9a3[_0xb10a('0x18')]>0x1;var _0x4eaef6=[];if(!fs[_0xb10a('0x1d')](path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a))&&_0x1bfdd2){fs[_0xb10a('0x1f')](path['join'](_0x20ac27,_0x4abc4a));}return BPromise[_0xb10a('0x20')](_0x36b9a3,function(_0x58fd0f){_0x4eaef6[_0xb10a('0x19')](_0x58fd0f);})[_0xb10a('0x11')](function(){for(var _0x2a9b45=0x0;_0x2a9b45<_0x4eaef6[_0xb10a('0x18')];_0x2a9b45+=0x1){var _0x504a36;var _0x3458a6=_0x4eaef6[_0x2a9b45];if(_0x1bfdd2){_0x504a36=path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a,util['format']('%s%d.%s',_0x4abc4a,_0x2a9b45,'csv'));}else{_0x504a36=path[_0xb10a('0x1e')](_0x20ac27,util['format'](_0xb10a('0x21'),_0x4abc4a,_0xb10a('0x22')));}fs[_0xb10a('0x23')](_0x504a36,csv(_0x3458a6));}})[_0xb10a('0x11')](function(){if(_0x1bfdd2){zipdir(path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a),{'saveTo':path['join'](_0x20ac27,util[_0xb10a('0xd')](_0xb10a('0x21'),_0x4abc4a,_0xb10a('0x24')))},function(_0x48813b,_0x28cb79){});rimraf(path[_0xb10a('0x1e')](_0x20ac27,_0x4abc4a),function(){});}})['then'](function(){logger[_0xb10a('0xc')](util[_0xb10a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb10a('0x25')));return analyticExtractedReport(_0xb10a('0x26'),_0x1bfdd2?util[_0xb10a('0xd')](_0xb10a('0x21'),_0x4abc4a,_0x1bfdd2?'zip':_0xb10a('0x22')):null);});})[_0xb10a('0x27')](function(_0x4814f7){logger['info'](util['format'](_0xb10a('0x28'),EXTRACTED_REPORT_ID,_0xb10a('0x25')),util['inspect'](_0x4814f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb10a('0x29'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1f0f=['finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','SELECT','num','Empty','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','length','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1f0f,0x1bb));var _0xf1f0=function(_0x5ab403,_0x34aa42){_0x5ab403=_0x5ab403-0x0;var _0x2e30f1=_0x1f0f[_0x5ab403];return _0x2e30f1;};'use strict';var util=require(_0xf1f0('0x0'));var path=require(_0xf1f0('0x1'));var _=require(_0xf1f0('0x2'));var csv=require(_0xf1f0('0x3'));var fs=require('fs');var BPromise=require(_0xf1f0('0x4'));var zipdir=require(_0xf1f0('0x5'));var rimraf=require(_0xf1f0('0x6'));var db=require(_0xf1f0('0x7'))['db'];var dbH=require(_0xf1f0('0x7'))[_0xf1f0('0x8')];var logger=require('../../config/logger')(_0xf1f0('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xf1f0('0xa')][0x2]);var QUERY=process[_0xf1f0('0xa')][0x3];var PATH=process[_0xf1f0('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x29842f,_0x165671){var _0x3b6a12={'status':_0x29842f};var _0x3cb8c0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x165671){_0x3b6a12[_0xf1f0('0xb')]=_0x165671;}return db[_0xf1f0('0xc')]['update'](_0x3b6a12,_0x3cb8c0);}function main(){var _0x393e5c=0x1388;var _0x5698bb;logger[_0xf1f0('0xd')](util[_0xf1f0('0xe')](_0xf1f0('0xf'),EXTRACTED_REPORT_ID,_0xf1f0('0x10')));return db['Setting'][_0xf1f0('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf1f0('0x12'),'splitSizeCsv']})['then'](function(_0x383537){if(_0x383537){_0x5698bb=_0x383537;_0x393e5c=_0x5698bb[_0xf1f0('0x13')]||0x1388;}})[_0xf1f0('0x14')](function(){return dbH[_0xf1f0('0x15')]['query'](util[_0xf1f0('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf1f0('0x15')]['QueryTypes'][_0xf1f0('0x16')]});})[_0xf1f0('0x14')](function(_0x48b5b4){if(!_0x48b5b4[0x0][_0xf1f0('0x17')]){return analyticExtractedReport(_0xf1f0('0x18'));}var _0x15f0a4=[];var _0x154af2=0x0;var _0x18ecff=!![];if(_0x48b5b4&&_0x48b5b4['length']){var _0x4afc83=_0x48b5b4[0x0][_0xf1f0('0x17')]%(_0x154af2+_0x393e5c);if(_0x5698bb[_0xf1f0('0x12')]){for(;_0x18ecff;_0x154af2+=_0x393e5c,_0x4afc83=_0x48b5b4[0x0][_0xf1f0('0x17')]%(_0x154af2+_0x393e5c)){if(_0x4afc83==0x0||_0x4afc83==_0x48b5b4[0x0][_0xf1f0('0x17')]){_0x18ecff=![];}_0x15f0a4['push'](dbH[_0xf1f0('0x15')][_0xf1f0('0x19')](util['format'](_0xf1f0('0x1a'),QUERY,_0x393e5c,_0x154af2),{'type':dbH[_0xf1f0('0x15')][_0xf1f0('0x1b')][_0xf1f0('0x16')]}));}}else{_0x15f0a4[_0xf1f0('0x1c')](dbH[_0xf1f0('0x15')][_0xf1f0('0x19')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xf1f0('0x16')]}));}}var _0x3edcec=path[_0xf1f0('0x1d')](PATH);var _0x10a528=path[_0xf1f0('0x1e')](PATH,_0xf1f0('0x1f'));var _0x1d32bb=_0x5698bb[_0xf1f0('0x12')]&&_0x15f0a4['length']>0x1;var _0x11dfce=[];if(!fs[_0xf1f0('0x20')](path[_0xf1f0('0x21')](_0x3edcec,_0x10a528))&&_0x1d32bb){fs[_0xf1f0('0x22')](path[_0xf1f0('0x21')](_0x3edcec,_0x10a528));}return BPromise[_0xf1f0('0x23')](_0x15f0a4,function(_0x249abc){_0x11dfce[_0xf1f0('0x1c')](_0x249abc);})[_0xf1f0('0x14')](function(){for(var _0x1c86c5=0x0;_0x1c86c5<_0x11dfce[_0xf1f0('0x24')];_0x1c86c5+=0x1){var _0x2f31db;var _0x505004=_0x11dfce[_0x1c86c5];if(_0x1d32bb){_0x2f31db=path[_0xf1f0('0x21')](_0x3edcec,_0x10a528,util[_0xf1f0('0xe')]('%s%d.%s',_0x10a528,_0x1c86c5,'csv'));}else{_0x2f31db=path[_0xf1f0('0x21')](_0x3edcec,util[_0xf1f0('0xe')](_0xf1f0('0x25'),_0x10a528,_0xf1f0('0x26')));}fs[_0xf1f0('0x27')](_0x2f31db,csv(_0x505004));}})['then'](function(){if(_0x1d32bb){zipdir(path[_0xf1f0('0x21')](_0x3edcec,_0x10a528),{'saveTo':path['join'](_0x3edcec,util[_0xf1f0('0xe')](_0xf1f0('0x25'),_0x10a528,_0xf1f0('0x28')))},function(_0x50211f,_0x413a72){});rimraf(path[_0xf1f0('0x21')](_0x3edcec,_0x10a528),function(){});}})['then'](function(){logger[_0xf1f0('0xd')](util['format'](_0xf1f0('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf1f0('0x2a'),_0x1d32bb?util[_0xf1f0('0xe')](_0xf1f0('0x25'),_0x10a528,_0x1d32bb?_0xf1f0('0x28'):_0xf1f0('0x26')):null);});})[_0xf1f0('0x2b')](function(_0xaece02){logger['info'](util[_0xf1f0('0xe')](_0xf1f0('0x2c'),EXTRACTED_REPORT_ID,_0xf1f0('0x10')),util[_0xf1f0('0x2d')](_0xaece02,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf1f0('0x2e'));})[_0xf1f0('0x2f')](function(){process[_0xf1f0('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index c6b89ad..c550250 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa58=['%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','value','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','pageBreak','before','margin','push','landscape','toString','black','right','Empty','dirname','basename','.pdf','join','Setting','find','split','splitSizePdf','then','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','mkdirSync','all','flatten','createPdfKitDocument','pdf'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfa58,0x1d0));var _0x8fa5=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xfa58[_0x8af54b];return _0x27d8f0;};'use strict';var _=require(_0x8fa5('0x0'));var fs=require('fs');var util=require(_0x8fa5('0x1'));var path=require(_0x8fa5('0x2'));var moment=require(_0x8fa5('0x3'));var htmlToPdfmake=require(_0x8fa5('0x4'));var PdfPrinter=require(_0x8fa5('0x5'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x8fa5('0x6'))[_0x8fa5('0x7')];var window=new JSDOM('')[_0x8fa5('0x8')];var db=require(_0x8fa5('0x9'))['db'];var dbH=require(_0x8fa5('0x9'))['dbH'];var logger=require('../../config/logger')(_0x8fa5('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x8fa5('0xb')][0x2]);var QUERY=process[_0x8fa5('0xb')][0x3];var PATH=process[_0x8fa5('0xb')][0x4];var NAME=process[_0x8fa5('0xb')][0x5];var FORMAT=_0x8fa5('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f5291,_0x33f411){var _0x5070b6={'status':_0x1f5291};var _0x2192c1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33f411){_0x5070b6[_0x8fa5('0xd')]=_0x33f411;}return db[_0x8fa5('0xe')]['update'](_0x5070b6,_0x2192c1);}function getHeaders(_0x486499){return _[_0x8fa5('0xf')](_0x486499,function(_0x310ffd){return{'text':_0x310ffd,'style':'tableHeader'};});}function getRows(_0x3d57e7,_0x31a6d6){return _[_0x8fa5('0xf')](_0x31a6d6,function(_0x578058){return _(_0x578058)[_0x8fa5('0x10')](_0x3d57e7)['map'](function(_0x4a689d){return _0x4a689d?_['toString'](_0x4a689d):'';})[_0x8fa5('0x11')]();});}function createTable(_0x570883,_0x4e2112){var _0x596082={'widths':_['fill'](Array(_0x570883[_0x8fa5('0x12')]),0x91),'heights':function(_0x20ab07){return _0x20ab07===0x0?_0x8fa5('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x9610b2=getHeaders(_0x570883);_0x596082[_0x8fa5('0x14')]['push'](_0x9610b2);var _0x435c92=getRows(_0x570883,_0x4e2112);_0x596082['body']=_0x596082[_0x8fa5('0x14')][_0x8fa5('0x15')](_0x435c92);return _0x596082;}function createTables(_0x4af42b){var _0x11e801=[];var _0x54510e=Object['keys'](_0x4af42b[0x0]);if(_0x54510e['length']>0x5)_0x54510e=_[_0x8fa5('0x16')](Object[_0x8fa5('0x17')](_0x4af42b[0x0]),0x5);_0x54510e[_0x8fa5('0x18')](function(_0x4f6e40){_0x11e801['push'](createTable(_0x4f6e40,_0x4af42b));});return _0x11e801;}function getPDFDocDefinition(_0x30109a){var _0x3fcb4b=util[_0x8fa5('0x19')](_0x8fa5('0x1a'),NAME,EXTRACTED_REPORT[_0x8fa5('0x1b')],moment(EXTRACTED_REPORT[_0x8fa5('0x1c')])[_0x8fa5('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8fa5('0x19')](FORMAT));var _0x13b1fa=[];for(var _0x3e5bab=0x0;_0x3e5bab<_0x30109a['length'];_0x3e5bab++){var _0x1a9ac=[];if(_0x3e5bab===0x0){_0x1a9ac['push']({'text':_0x3fcb4b,'style':'header'});}var _0x445450={'table':_0x30109a[_0x3e5bab]};if(_0x3e5bab>0x0){_0x445450[_0x8fa5('0x1d')]=_0x8fa5('0x1e');_0x445450[_0x8fa5('0x1f')]=[0x0,0x46,0x0,0x0];}_0x1a9ac[_0x8fa5('0x20')](_0x445450);_0x13b1fa['push'](_0x1a9ac);}return{'pageSize':'A4','pageOrientation':_0x8fa5('0x21'),'content':_0x13b1fa,'footer':function(_0x4de143,_0x452511){return{'text':_0x4de143[_0x8fa5('0x22')]()+'\x20/\x20'+_0x452511,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8fa5('0x23')},'footer':{'alignment':_0x8fa5('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x568e05){var _0x21a1e8=0x1388;var _0x339372;if(!_0x568e05[0x0]['num']){return analyticExtractedReport(_0x8fa5('0x25'));}var _0x42e115=[];var _0x397251=0x0;var _0x49234f=!![];var _0x292ce8=path[_0x8fa5('0x26')](PATH);var _0x471930=path[_0x8fa5('0x27')](PATH,_0x8fa5('0x28'));var _0x3c09c4=path[_0x8fa5('0x29')](_0x292ce8,util[_0x8fa5('0x19')]('%s.%s',_0x471930,'pdf'));var _0xad668e=![];return db[_0x8fa5('0x2a')][_0x8fa5('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8fa5('0x2c'),_0x8fa5('0x2d')]})[_0x8fa5('0x2e')](function(_0x2e76d5){if(_0x2e76d5){_0x339372=_0x2e76d5;_0x21a1e8=_0x339372[_0x8fa5('0x2d')]||0x3e8;}})[_0x8fa5('0x2e')](function(){if(_0x568e05&&_0x568e05[_0x8fa5('0x12')]){var _0x3f9470=_0x568e05[0x0][_0x8fa5('0x2f')]%(_0x397251+_0x21a1e8);if(_0x339372[_0x8fa5('0x2c')]){for(;_0x49234f;_0x397251+=_0x21a1e8,_0x3f9470=_0x568e05[0x0][_0x8fa5('0x2f')]%(_0x397251+_0x21a1e8)){if(_0x3f9470==0x0||_0x3f9470==_0x568e05[0x0]['num']){_0x49234f=![];}_0x42e115[_0x8fa5('0x20')](dbH[_0x8fa5('0x30')][_0x8fa5('0x31')](util['format'](_0x8fa5('0x32'),QUERY,_0x21a1e8,_0x397251),{'type':dbH[_0x8fa5('0x30')][_0x8fa5('0x33')][_0x8fa5('0x34')]}));}}else{_0x42e115['push'](dbH[_0x8fa5('0x30')][_0x8fa5('0x31')](QUERY,{'type':dbH['sequelize'][_0x8fa5('0x33')]['SELECT']}));}}_0xad668e=_0x339372[_0x8fa5('0x2c')]&&_0x42e115[_0x8fa5('0x12')]>0x1;if(!fs['existsSync'](path['join'](_0x292ce8,_0x471930))&&_0xad668e){fs[_0x8fa5('0x35')](path[_0x8fa5('0x29')](_0x292ce8,_0x471930));}return Promise[_0x8fa5('0x36')](_0x42e115);})[_0x8fa5('0x2e')](function(_0x2c3b65){return createTables(_[_0x8fa5('0x37')](_0x2c3b65));})[_0x8fa5('0x2e')](function(_0x410505){var _0x148fc8=getPDFDocDefinition(_0x410505);var _0x344f0c=getPDFPrinter();var _0x336a6c=_0x344f0c[_0x8fa5('0x38')](_0x148fc8);if(_0xad668e)_0x3c09c4=path[_0x8fa5('0x29')](_0x292ce8,_0x471930,util[_0x8fa5('0x19')]('%s%d.%s',_0x471930,index,_0x8fa5('0x39')));return writePDFDocument(_0x336a6c,_0x3c09c4);})[_0x8fa5('0x2e')](function(){if(!_0xad668e)return;zipdir(path['join'](_0x292ce8,_0x471930),{'saveTo':path[_0x8fa5('0x29')](_0x292ce8,util[_0x8fa5('0x19')](_0x8fa5('0x3a'),_0x471930,'zip'))},function(_0x432051){if(_0x432051)throw _0x432051;return;});})[_0x8fa5('0x2e')](function(){if(!_0xad668e)return;rimraf(path[_0x8fa5('0x29')](_0x292ce8,_0x471930),function(){});})[_0x8fa5('0x2e')](function(){logger[_0x8fa5('0x3b')](util[_0x8fa5('0x19')](_0x8fa5('0x3c'),EXTRACTED_REPORT_ID,_0x8fa5('0x3d')));return analyticExtractedReport(_0x8fa5('0x3e'),_0xad668e?util[_0x8fa5('0x19')](_0x8fa5('0x3a'),_0x471930,_0xad668e?'zip':_0x8fa5('0x39')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8fa5('0x3b')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8fa5('0x3f')));return db[_0x8fa5('0xe')][_0x8fa5('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x290541){EXTRACTED_REPORT=_0x290541;return dbH['sequelize']['query'](util['format'](_0x8fa5('0x41'),QUERY),{'type':dbH['sequelize'][_0x8fa5('0x33')][_0x8fa5('0x34')]});})[_0x8fa5('0x2e')](extractReport)[_0x8fa5('0x42')](function(_0x58a281){logger[_0x8fa5('0x3b')](util[_0x8fa5('0x19')](_0x8fa5('0x43'),EXTRACTED_REPORT_ID,_0x8fa5('0x3f')),util[_0x8fa5('0x44')](_0x58a281,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8fa5('0x45'));})[_0x8fa5('0x46')](function(){process[_0x8fa5('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3d3230=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8fa5('0x48'),'italics':__dirname+_0x8fa5('0x49'),'bolditalics':__dirname+_0x8fa5('0x4a')}});return _0x3d3230;}function getPDFDocDefinitionFromHTML(_0xc9024f,_0x3990e9){var _0x26b234=util[_0x8fa5('0x19')](_0x8fa5('0x4b'),_0x3990e9['channel'],_0x3990e9[_0x8fa5('0x4c')]);var _0xfe325e=moment()[_0x8fa5('0x19')](_0x8fa5('0x4d'))[_0x8fa5('0x22')]();var _0x22fb79=htmlToPdfmake(_0xc9024f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x22fb79],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8fa5('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8fa5('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8fa5('0x4e')}},'header':function(){return[{'text':_0x8fa5('0x4f'),'style':_0x8fa5('0x50')}];},'footer':function(_0x428651,_0x3e8044){return[{'text':util[_0x8fa5('0x19')](_0x8fa5('0x51'),_0x26b234,_0x428651,_0x3e8044,_0xfe325e),'style':_0x8fa5('0x52')}];}};}function writePDFDocument(_0x857aee,_0x294528){return new Promise(function(_0x26ebee,_0x2354e2){var _0x43cd1e=_0x857aee[_0x8fa5('0x53')](fs['createWriteStream'](_0x294528));_0x43cd1e['on'](_0x8fa5('0x54'),function(){_0x26ebee(_0x8fa5('0x54'));});_0x43cd1e['on'](_0x8fa5('0x55'),function(_0x2a9c53){_0x2354e2(_0x2a9c53);});_0x857aee['end']();});}exports[_0x8fa5('0x56')]=function(_0x3677f2,_0x4df6f8){var _0x46cd2c=getPDFPrinter();var _0x111bd3=getPDFDocDefinitionFromHTML(_0x3677f2,_0x4df6f8);var _0x202ea1=_0x46cd2c[_0x8fa5('0x38')](_0x111bd3);return writePDFDocument(_0x202ea1,_0x4df6f8[_0x8fa5('0x2')])[_0x8fa5('0x42')](function(_0x3c2e62){throw _0x3c2e62;});}; \ No newline at end of file +var _0xdc88=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','keys','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','landscape','Arial','num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','find','splitSizePdf','then','split','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','all','flatten','createPdfKitDocument','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed'];(function(_0x30c071,_0xa66aeb){var _0x5141f6=function(_0x89a480){while(--_0x89a480){_0x30c071['push'](_0x30c071['shift']());}};_0x5141f6(++_0xa66aeb);}(_0xdc88,0x6f));var _0x8dc8=function(_0xc689c7,_0x63165a){_0xc689c7=_0xc689c7-0x0;var _0x535e43=_0xdc88[_0xc689c7];return _0x535e43;};'use strict';var _=require(_0x8dc8('0x0'));var fs=require('fs');var util=require(_0x8dc8('0x1'));var path=require(_0x8dc8('0x2'));var moment=require(_0x8dc8('0x3'));var htmlToPdfmake=require(_0x8dc8('0x4'));var PdfPrinter=require(_0x8dc8('0x5'));var zipdir=require(_0x8dc8('0x6'));var rimraf=require('rimraf');var JSDOM=require(_0x8dc8('0x7'))[_0x8dc8('0x8')];var window=new JSDOM('')[_0x8dc8('0x9')];var db=require(_0x8dc8('0xa'))['db'];var dbH=require('../../mysqldb')[_0x8dc8('0xb')];var logger=require(_0x8dc8('0xc'))(_0x8dc8('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x8dc8('0xe')][0x2]);var QUERY=process[_0x8dc8('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x8dc8('0xe')][0x5];var FORMAT=_0x8dc8('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x36be9,_0x33e138){var _0x331cd2={'status':_0x36be9};var _0x245ce4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33e138){_0x331cd2['savename']=_0x33e138;}return db['AnalyticExtractedReport'][_0x8dc8('0x10')](_0x331cd2,_0x245ce4);}function getHeaders(_0x48e28b){return _[_0x8dc8('0x11')](_0x48e28b,function(_0x54a1be){return{'text':_0x54a1be,'style':_0x8dc8('0x12')};});}function getRows(_0x21a5f0,_0x1eb1e1){return _[_0x8dc8('0x11')](_0x1eb1e1,function(_0x51ecfc){return _(_0x51ecfc)[_0x8dc8('0x13')](_0x21a5f0)[_0x8dc8('0x11')](function(_0x405a2b){return _0x405a2b?_[_0x8dc8('0x14')](_0x405a2b):'';})[_0x8dc8('0x15')]();});}function createTable(_0x42cd2f,_0x2ebabd){var _0x5bdf86={'widths':_[_0x8dc8('0x16')](Array(_0x42cd2f[_0x8dc8('0x17')]),0x91),'heights':function(_0x2c3147){return _0x2c3147===0x0?_0x8dc8('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x36d483=getHeaders(_0x42cd2f);_0x5bdf86[_0x8dc8('0x19')][_0x8dc8('0x1a')](_0x36d483);var _0x2cb579=getRows(_0x42cd2f,_0x2ebabd);_0x5bdf86[_0x8dc8('0x19')]=_0x5bdf86[_0x8dc8('0x19')][_0x8dc8('0x1b')](_0x2cb579);return _0x5bdf86;}function createTables(_0x22b872){var _0x2bc3e8=[];var _0x15dd25=Object[_0x8dc8('0x1c')](_0x22b872[0x0]);if(_0x15dd25[_0x8dc8('0x17')]>0x5)_0x15dd25=_[_0x8dc8('0x1d')](Object[_0x8dc8('0x1c')](_0x22b872[0x0]),0x5);_0x15dd25['forEach'](function(_0x20cfbb){_0x2bc3e8['push'](createTable(_0x20cfbb,_0x22b872));});return _0x2bc3e8;}function getPDFDocDefinition(_0x161342){var _0x193813=util[_0x8dc8('0x1e')](_0x8dc8('0x1f'),NAME,EXTRACTED_REPORT[_0x8dc8('0x20')],moment(EXTRACTED_REPORT[_0x8dc8('0x21')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x8dc8('0x22')])[_0x8dc8('0x1e')](FORMAT));var _0x419002=[];for(var _0xe1aa7c=0x0;_0xe1aa7c<_0x161342[_0x8dc8('0x17')];_0xe1aa7c++){var _0x58ebc0=[];if(_0xe1aa7c===0x0){_0x58ebc0['push']({'text':_0x193813,'style':_0x8dc8('0x23')});}var _0x5887e5={'table':_0x161342[_0xe1aa7c]};if(_0xe1aa7c>0x0){_0x5887e5['pageBreak']=_0x8dc8('0x24');_0x5887e5[_0x8dc8('0x25')]=[0x0,0x46,0x0,0x0];}_0x58ebc0[_0x8dc8('0x1a')](_0x5887e5);_0x419002[_0x8dc8('0x1a')](_0x58ebc0);}return{'pageSize':'A4','pageOrientation':_0x8dc8('0x26'),'content':_0x419002,'footer':function(_0x38be10,_0x8bad29){return{'text':_0x38be10[_0x8dc8('0x14')]()+'\x20/\x20'+_0x8bad29,'style':'footer'};},'defaultStyle':{'font':_0x8dc8('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x210cdf){var _0x46f65d=0x1388;var _0x597a40;if(!_0x210cdf[0x0][_0x8dc8('0x28')]){return analyticExtractedReport(_0x8dc8('0x29'));}var _0x59caef=[];var _0x40e8cb=0x0;var _0x185b41=!![];var _0x15e1d0=path[_0x8dc8('0x2a')](PATH);var _0x313cb9=path[_0x8dc8('0x2b')](PATH,_0x8dc8('0x2c'));var _0x15ebb1=path[_0x8dc8('0x2d')](_0x15e1d0,util['format'](_0x8dc8('0x2e'),_0x313cb9,_0x8dc8('0x2f')));var _0x3a8cda=![];return db['Setting'][_0x8dc8('0x30')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8dc8('0x31')]})[_0x8dc8('0x32')](function(_0x1cc17c){if(_0x1cc17c){_0x597a40=_0x1cc17c;_0x46f65d=_0x597a40[_0x8dc8('0x31')]||0x3e8;}})[_0x8dc8('0x32')](function(){if(_0x210cdf&&_0x210cdf[_0x8dc8('0x17')]){var _0x5e9140=_0x210cdf[0x0][_0x8dc8('0x28')]%(_0x40e8cb+_0x46f65d);if(_0x597a40[_0x8dc8('0x33')]){for(;_0x185b41;_0x40e8cb+=_0x46f65d,_0x5e9140=_0x210cdf[0x0][_0x8dc8('0x28')]%(_0x40e8cb+_0x46f65d)){if(_0x5e9140==0x0||_0x5e9140==_0x210cdf[0x0][_0x8dc8('0x28')]){_0x185b41=![];}_0x59caef['push'](dbH[_0x8dc8('0x34')][_0x8dc8('0x35')](util[_0x8dc8('0x1e')](_0x8dc8('0x36'),QUERY,_0x46f65d,_0x40e8cb),{'type':dbH[_0x8dc8('0x34')][_0x8dc8('0x37')][_0x8dc8('0x38')]}));}}else{_0x59caef[_0x8dc8('0x1a')](dbH['sequelize'][_0x8dc8('0x35')](QUERY,{'type':dbH[_0x8dc8('0x34')]['QueryTypes'][_0x8dc8('0x38')]}));}}_0x3a8cda=_0x597a40[_0x8dc8('0x33')]&&_0x59caef[_0x8dc8('0x17')]>0x1;if(!fs[_0x8dc8('0x39')](path[_0x8dc8('0x2d')](_0x15e1d0,_0x313cb9))&&_0x3a8cda){fs['mkdirSync'](path[_0x8dc8('0x2d')](_0x15e1d0,_0x313cb9));}return Promise[_0x8dc8('0x3a')](_0x59caef);})['then'](function(_0x343fd7){return createTables(_[_0x8dc8('0x3b')](_0x343fd7));})[_0x8dc8('0x32')](function(_0x18c47c){var _0x2b8934=getPDFDocDefinition(_0x18c47c);var _0x485d1f=getPDFPrinter();var _0x1a0814=_0x485d1f[_0x8dc8('0x3c')](_0x2b8934);if(_0x3a8cda)_0x15ebb1=path[_0x8dc8('0x2d')](_0x15e1d0,_0x313cb9,util['format'](_0x8dc8('0x3d'),_0x313cb9,index,_0x8dc8('0x2f')));return writePDFDocument(_0x1a0814,_0x15ebb1);})[_0x8dc8('0x32')](function(){if(!_0x3a8cda)return;zipdir(path['join'](_0x15e1d0,_0x313cb9),{'saveTo':path[_0x8dc8('0x2d')](_0x15e1d0,util[_0x8dc8('0x1e')](_0x8dc8('0x2e'),_0x313cb9,_0x8dc8('0x3e')))},function(_0x21407c){if(_0x21407c)throw _0x21407c;return;});})[_0x8dc8('0x32')](function(){if(!_0x3a8cda)return;rimraf(path[_0x8dc8('0x2d')](_0x15e1d0,_0x313cb9),function(){});})[_0x8dc8('0x32')](function(){logger[_0x8dc8('0x3f')](util[_0x8dc8('0x1e')](_0x8dc8('0x40'),EXTRACTED_REPORT_ID,_0x8dc8('0x41')));return analyticExtractedReport(_0x8dc8('0x42'),_0x3a8cda?util[_0x8dc8('0x1e')](_0x8dc8('0x2e'),_0x313cb9,_0x3a8cda?'zip':'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8dc8('0x3f')](util['format'](_0x8dc8('0x43'),EXTRACTED_REPORT_ID,_0x8dc8('0x44')));return db[_0x8dc8('0x45')][_0x8dc8('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8dc8('0x32')](function(_0x48856b){EXTRACTED_REPORT=_0x48856b;return dbH[_0x8dc8('0x34')][_0x8dc8('0x35')](util[_0x8dc8('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x8dc8('0x37')][_0x8dc8('0x38')]});})['then'](extractReport)['catch'](function(_0x29ef43){logger[_0x8dc8('0x3f')](util['format'](_0x8dc8('0x47'),EXTRACTED_REPORT_ID,_0x8dc8('0x44')),util[_0x8dc8('0x48')](_0x29ef43,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8dc8('0x49'));})[_0x8dc8('0x4a')](function(){process[_0x8dc8('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x581d3c=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8dc8('0x4c'),'italics':__dirname+_0x8dc8('0x4d'),'bolditalics':__dirname+_0x8dc8('0x4e')}});return _0x581d3c;}function getPDFDocDefinitionFromHTML(_0x476a2c,_0x5a0f49){var _0xe55fc9=util[_0x8dc8('0x1e')]('%s\x20#%d',_0x5a0f49['channel'],_0x5a0f49['interactionId']);var _0x4296b1=moment()['format']('YYYY-MM-DD')[_0x8dc8('0x14')]();var _0x5d7233=htmlToPdfmake(_0x476a2c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5d7233],'defaultStyle':{'font':_0x8dc8('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8dc8('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8dc8('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8dc8('0x4f')}},'header':function(){return[{'text':_0x8dc8('0x50'),'style':_0x8dc8('0x23')}];},'footer':function(_0x46b3df,_0x43f306){return[{'text':util[_0x8dc8('0x1e')](_0x8dc8('0x51'),_0xe55fc9,_0x46b3df,_0x43f306,_0x4296b1),'style':_0x8dc8('0x52')}];}};}function writePDFDocument(_0x3ef300,_0x3c0cad){return new Promise(function(_0x4edefc,_0x286e9b){var _0x17ea51=_0x3ef300['pipe'](fs[_0x8dc8('0x53')](_0x3c0cad));_0x17ea51['on'](_0x8dc8('0x54'),function(){_0x4edefc(_0x8dc8('0x54'));});_0x17ea51['on'](_0x8dc8('0x55'),function(_0x8aad04){_0x286e9b(_0x8aad04);});_0x3ef300[_0x8dc8('0x56')]();});}exports[_0x8dc8('0x57')]=function(_0x14b44f,_0xffbed7){var _0x1346ed=getPDFPrinter();var _0x298a4d=getPDFDocDefinitionFromHTML(_0x14b44f,_0xffbed7);var _0x2075ab=_0x1346ed[_0x8dc8('0x3c')](_0x298a4d);return writePDFDocument(_0x2075ab,_0xffbed7[_0x8dc8('0x2')])[_0x8dc8('0x58')](function(_0x5e224e){throw _0x5e224e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d961fc9..310bc2e 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa9e0=['QueryTypes','SELECT','num','split','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','each','length','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x2be104,_0x4bf5d0){var _0x31c115=function(_0x41d524){while(--_0x41d524){_0x2be104['push'](_0x2be104['shift']());}};_0x31c115(++_0x4bf5d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x307b3e[_0x0a9e('0x14')]){if(_0x52a03d&&_0x52a03d['length']){var _0x225616=_0x52a03d[0x0]['num']%(_0x519dfd+_0xf81284);for(;_0x16033c;_0x519dfd+=_0xf81284,_0x225616=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x225616==0x0||_0x225616==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x14')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1c')](path[_0x0a9e('0x1b')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1d')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x1e')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,json2xls(_0x33161b),_0x0a9e('0x22'));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1b')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1b')](_0x20f109,util['format'](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x23')))},function(_0x2b1f27,_0x2ec755){});rimraf(path['join'](_0x20f109,_0x588269),function(){});}})[_0x0a9e('0xe')](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x24'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')));return analyticExtractedReport(_0x0a9e('0x26'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x23'):'xlsx'):null);});})[_0x0a9e('0x27')](function(_0x5d1e0e){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x28'),EXTRACTED_REPORT_ID,_0x0a9e('0x25')),util[_0x0a9e('0x29')](_0x5d1e0e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0a9e('0x2a')](function(){process[_0x0a9e('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2eac875..08d50cf 100644 --- a/server/components/extensions/rewrite.js +++ b/server/components/extensions/rewrite.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d4d=['error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','push','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','length','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','transaction','destroy','bulkCreate','sortBy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d4d,0x94));var _0xd2d4=function(_0x57e1f0,_0x23af44){_0x57e1f0=_0x57e1f0-0x0;var _0x2ee288=_0x2d4d[_0x57e1f0];return _0x2ee288;};'use strict';var _=require(_0xd2d4('0x0'));var util=require('util');function rewrite(_0x4e59de,_0x566965){var _0x2783a3=this;return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x2')][_0xd2d4('0x3')]({'raw':!![]})[_0xd2d4('0x4')](function(_0x3811e8){_0x2783a3[_0xd2d4('0x5')]=_0x3811e8;return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x6')][_0xd2d4('0x3')]({'where':{'IntervalId':_0x566965['IntervalId']},'raw':!![]});})[_0xd2d4('0x4')](function(_0x57bae4){return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x6')][_0xd2d4('0x3')]({'where':{'exten':{'$in':_[_0xd2d4('0x7')](_[_0xd2d4('0x8')](_0x57bae4,_0xd2d4('0x9')))}},'order':[{'raw':_0xd2d4('0xa')}],'raw':!![]});})[_0xd2d4('0x4')](function(_0x2c5b3c){var _0x2705d8=_[_0xd2d4('0xb')](_0x2c5b3c,{'priority':'1'});var _0x1504b9=_[_0xd2d4('0xb')](_0x2c5b3c,{'isApp':0x1});var _0x238bff=_[_0xd2d4('0xc')](_0x1504b9,_0xd2d4('0x9'));var _0x772a5f=[_0xd2d4('0xd'),_0xd2d4('0xe')];var _0x279c80=[];var _0x13a0ad=[];for(var _0x3dc00c in _0x238bff){if(_0x238bff[_0xd2d4('0xf')](_0x3dc00c)){_0x2783a3[_0xd2d4('0x10')]=0x2;_0x2783a3[_0xd2d4('0x11')]=[];_0x2783a3[_0xd2d4('0x12')]=_[_0xd2d4('0x13')](_0x2705d8,{'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')]});_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':util[_0xd2d4('0x16')](_0xd2d4('0x17'),_0x238bff[_0x3dc00c][0x0]['type']),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3['priority']++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});if(_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')]===_0xd2d4('0x1a')){if(_0x2783a3[_0xd2d4('0x12')]){_0x2783a3['extensions']['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x1b')+(_0x2783a3['extension'][_0xd2d4('0x1c')]?_0xd2d4('0x1d')+_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x1c')]+'}':_0xd2d4('0x1e')),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0]['exten'],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x20')+_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')],'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});var _0x4f3087=_0x2783a3[_0xd2d4('0x10')]++;_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4f3087+0x2)+_0xd2d4('0x22')+(_0x4f3087+0x1)+')','context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x4f3087,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId']});if(_0x2783a3[_0xd2d4('0x12')]){_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0]['type'],'app':_0xd2d4('0x15'),'appdata':_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x2783a3['extension']['cutdigits']+'}':_0xd2d4('0x23'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0]['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x24')+_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId'],'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3['priority']++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});if(_0x2783a3[_0xd2d4('0x12')]&&_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0xf')](_0xd2d4('0x25'))&&_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x25')]!==_0xd2d4('0x26')){_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0]['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x27'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0]['exten'],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});_0x2783a3['extensions']['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2783a3[_0xd2d4('0x12')][_0xd2d4('0x25')]||_0xd2d4('0x28'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}}_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x29'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId']});_0x2783a3[_0xd2d4('0x11')]['push']({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x2a'),'context':_0x238bff[_0x3dc00c][0x0]['context'],'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0]['VoiceExtensionId']});_0x2783a3['extensions'][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':'Set','appdata':_0xd2d4('0x2b'),'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'exten':_0x238bff[_0x3dc00c][0x0]['exten'],'priority':_0x2783a3[_0xd2d4('0x10')]++,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});for(var _0xb87ba7=0x0,_0x4c53b5=0x0;_0xb87ba7<_0x238bff[_0x3dc00c]['length'];_0xb87ba7+=0x1,_0x4c53b5=0x0){var _0x10af94=_0x238bff[_0x3dc00c][_0xb87ba7];if(_0x10af94[_0xd2d4('0x14')]){_0x10af94[_0xd2d4('0x14')]=_0x10af94[_0xd2d4('0x14')][_0xd2d4('0x2c')]();}var _0x545234=[];var _0x51f917=[];delete _0x10af94['id'];delete _0x10af94[_0xd2d4('0x2d')];delete _0x10af94['updatedAt'];var _0x488bb5=_0x10af94[_0xd2d4('0x2e')]!==_0xd2d4('0x2f')?[_0x10af94['interval']]:_0x10af94[_0xd2d4('0x30')]?_[_0xd2d4('0x8')](_[_0xd2d4('0xb')](_0x2783a3[_0xd2d4('0x5')],{'IntervalId':_0x10af94[_0xd2d4('0x30')]}),'interval'):[];if(_0x10af94[_0xd2d4('0xf')](_0xd2d4('0x31'))){if(_0x10af94['tag']&&_0x10af94[_0xd2d4('0x31')]!=='--'){_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x32')+_0x10af94[_0xd2d4('0x31')],'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5['length']+_0x2783a3['priority']+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}}if(_0x10af94['type']==='outbound'&&_0x10af94[_0xd2d4('0xf')]('callerID')){if(_0x10af94['callerID']){_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94['type'],'app':_0xd2d4('0x21'),'appdata':_0xd2d4('0x33')+_0x10af94[_0xd2d4('0x34')]+')','context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}else{_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x10af94['context'],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}}if(_0x10af94[_0xd2d4('0xf')](_0xd2d4('0x36'))){if(_0x772a5f[_0xd2d4('0x37')](_0x10af94[_0xd2d4('0x38')][_0xd2d4('0x2c')]())>=0x0&&_0x10af94[_0xd2d4('0x39')]!==_0xd2d4('0x3a')){if(_0x10af94[_0xd2d4('0x36')]){_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':'ExecIf','appdata':_0xd2d4('0x3b'),'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5['length']+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94['type'],'app':_0xd2d4('0x15'),'appdata':_0xd2d4('0x3c'),'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94['exten'],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94['VoiceExtensionId']});}else{_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x21'),'appdata':_0xd2d4('0x3d'),'context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94['exten'],'priority':_0x488bb5['length']+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});_0x545234[_0xd2d4('0x1f')]({'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x10af94[_0xd2d4('0x18')],'exten':_0x10af94[_0xd2d4('0x9')],'priority':_0x488bb5[_0xd2d4('0x35')]+_0x2783a3[_0xd2d4('0x10')]+_0x4c53b5++,'VoiceExtensionId':_0x10af94[_0xd2d4('0x19')]});}}}for(var _0x3effc0=0x0;_0x3effc0<_0x488bb5['length'];_0x3effc0+=0x1){var _0x4367b2=_0x2783a3['priority']+_0x488bb5['length'];var _0x322149=_0x3effc0===_0x488bb5[_0xd2d4('0x35')]-0x1?_0x2783a3[_0xd2d4('0x10')]+_0x545234[_0xd2d4('0x35')]+_0x51f917['length']+0x2:_0x2783a3[_0xd2d4('0x10')]+_0x3effc0+0x1;_0x545234[_0xd2d4('0x3e')](_0x3effc0,0x0,{'type':_0x10af94[_0xd2d4('0x14')],'app':_0xd2d4('0x3f'),'appdata':_0x488bb5[_0x3effc0]+'?'+_0x10af94['context']+_0xd2d4('0x40')+_0x4367b2+':'+_0x10af94[_0xd2d4('0x18')]+',${EXTEN},'+_0x322149,'exten':_0x10af94[_0xd2d4('0x9')],'context':_0x10af94['context'],'priority':_0x2783a3['priority']+_0x3effc0,'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});}_0x10af94['priority']=_0x545234[_0xd2d4('0x35')]?_[_0xd2d4('0x41')](_0x545234)['priority']+0x1:_0x2783a3[_0xd2d4('0x10')];_0x2783a3[_0xd2d4('0x10')]=(_0x51f917[_0xd2d4('0x35')]?_[_0xd2d4('0x41')](_0x51f917)[_0xd2d4('0x10')]:_0x10af94[_0xd2d4('0x10')])+0x1;_0x2783a3[_0xd2d4('0x11')]=_['concat'](_0x2783a3[_0xd2d4('0x11')],_0x545234,[_0x10af94],_0x51f917);}_0x2783a3[_0xd2d4('0x11')][_0xd2d4('0x1f')]({'type':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x14')],'app':_0xd2d4('0x42'),'exten':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x9')],'context':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x18')],'priority':_0x2783a3[_0xd2d4('0x10')],'VoiceExtensionId':_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]});_0x279c80[_0xd2d4('0x1f')](_0x238bff[_0x3dc00c][0x0][_0xd2d4('0x19')]);_0x13a0ad=_['concat'](_0x13a0ad,_0x2783a3[_0xd2d4('0x11')]);}}return _0x4e59de[_0xd2d4('0x43')](function(_0x351d16){return _0x4e59de[_0xd2d4('0x1')]['VoiceExtension'][_0xd2d4('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x279c80}},'transaction':_0x351d16})[_0xd2d4('0x4')](function(_0x425a0f){return _0x4e59de[_0xd2d4('0x1')][_0xd2d4('0x6')][_0xd2d4('0x45')](_[_0xd2d4('0x46')](_0x13a0ad,_0xd2d4('0x10')),{'transaction':_0x351d16});});});})['catch'](function(_0x422f61){console[_0xd2d4('0x47')](_0x422f61);});}exports[_0xd2d4('0x48')]=rewrite; \ No newline at end of file +var _0x86d7=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','map','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','util','models','Interval','findAll','IntervalId','then','VoiceExtension','uniq','exten','filter','queue','playback','priority','extensions','find','push','type','Set','format','context','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none'];(function(_0x2fb6da,_0x56779b){var _0x431722=function(_0x2ff8d0){while(--_0x2ff8d0){_0x2fb6da['push'](_0x2fb6da['shift']());}};_0x431722(++_0x56779b);}(_0x86d7,0xab));var _0x786d=function(_0x984aca,_0x118f04){_0x984aca=_0x984aca-0x0;var _0x2a8c76=_0x86d7[_0x984aca];return _0x2a8c76;};'use strict';var _=require('lodash');var util=require(_0x786d('0x0'));function rewrite(_0x5372c9,_0x554bb4){var _0x42553d=this;return _0x5372c9[_0x786d('0x1')][_0x786d('0x2')][_0x786d('0x3')]({'raw':!![]})['then'](function(_0x1f19c9){_0x42553d['intervals']=_0x1f19c9;return _0x5372c9[_0x786d('0x1')]['VoiceExtension'][_0x786d('0x3')]({'where':{'IntervalId':_0x554bb4[_0x786d('0x4')]},'raw':!![]});})[_0x786d('0x5')](function(_0x380285){return _0x5372c9[_0x786d('0x1')][_0x786d('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x786d('0x7')](_['map'](_0x380285,_0x786d('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x786d('0x5')](function(_0x4d3b4c){var _0x4fe094=_[_0x786d('0x9')](_0x4d3b4c,{'priority':'1'});var _0x5bb1cd=_[_0x786d('0x9')](_0x4d3b4c,{'isApp':0x1});var _0x5743b0=_['groupBy'](_0x5bb1cd,'exten');var _0x2faf0e=[_0x786d('0xa'),_0x786d('0xb')];var _0x22aa5c=[];var _0x1d66f1=[];for(var _0x5b96a2 in _0x5743b0){if(_0x5743b0['hasOwnProperty'](_0x5b96a2)){_0x42553d[_0x786d('0xc')]=0x2;_0x42553d[_0x786d('0xd')]=[];_0x42553d['extension']=_[_0x786d('0xe')](_0x4fe094,{'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')]});_0x42553d[_0x786d('0xd')][_0x786d('0xf')]({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':_0x786d('0x11'),'appdata':util[_0x786d('0x12')]('CDR(type)=%s',_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')]),'context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d['priority']++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});if(_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')]===_0x786d('0x15')){if(_0x42553d[_0x786d('0x16')]){_0x42553d['extensions']['push']({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':'Set','appdata':_0x786d('0x17')+(_0x42553d[_0x786d('0x16')][_0x786d('0x18')]?'${EXTEN:'+_0x42553d[_0x786d('0x16')][_0x786d('0x18')]+'}':_0x786d('0x19')),'context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d[_0x786d('0xc')]++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0]['VoiceExtensionId']});}_0x42553d[_0x786d('0xd')][_0x786d('0xf')]({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':'Set','appdata':'CDR(routeid)='+_0x5743b0[_0x5b96a2][0x0]['VoiceExtensionId'],'context':_0x5743b0[_0x5b96a2][0x0]['context'],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d[_0x786d('0xc')]++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});var _0x23777f=_0x42553d['priority']++;_0x42553d[_0x786d('0xd')]['push']({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x23777f+0x2)+_0x786d('0x1a')+(_0x23777f+0x1)+')','context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x23777f,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});if(_0x42553d['extension']){_0x42553d[_0x786d('0xd')]['push']({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':'Set','appdata':_0x42553d['extension'][_0x786d('0x18')]?_0x786d('0x1b')+_0x42553d[_0x786d('0x16')][_0x786d('0x18')]+'}':_0x786d('0x1c'),'context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d[_0x786d('0xc')]++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});}_0x42553d[_0x786d('0xd')][_0x786d('0xf')]({'type':_0x5743b0[_0x5b96a2][0x0]['type'],'app':_0x786d('0x11'),'appdata':_0x786d('0x1d')+_0x5743b0[_0x5b96a2][0x0]['VoiceExtensionId'],'context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d['priority']++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0]['VoiceExtensionId']});if(_0x42553d[_0x786d('0x16')]&&_0x42553d[_0x786d('0x16')][_0x786d('0x1e')](_0x786d('0x1f'))&&_0x42553d['extension'][_0x786d('0x1f')]!==_0x786d('0x20')){_0x42553d['extensions'][_0x786d('0xf')]({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':_0x786d('0x11'),'appdata':_0x786d('0x21'),'context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d[_0x786d('0xc')]++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});_0x42553d[_0x786d('0xd')]['push']({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':_0x786d('0x11'),'appdata':_0x786d('0x22')+_0x42553d[_0x786d('0x16')][_0x786d('0x1f')]||'wav','context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d[_0x786d('0xc')]++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0]['VoiceExtensionId']});}}_0x42553d['extensions']['push']({'type':_0x5743b0[_0x5b96a2][0x0]['type'],'app':_0x786d('0x11'),'appdata':_0x786d('0x23'),'context':_0x5743b0[_0x5b96a2][0x0]['context'],'exten':_0x5743b0[_0x5b96a2][0x0]['exten'],'priority':_0x42553d['priority']++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});_0x42553d['extensions']['push']({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':_0x786d('0x11'),'appdata':_0x786d('0x24'),'context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d[_0x786d('0xc')]++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});_0x42553d[_0x786d('0xd')]['push']({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':_0x786d('0x11'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5743b0[_0x5b96a2][0x0]['context'],'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'priority':_0x42553d[_0x786d('0xc')]++,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});for(var _0x33281a=0x0,_0x33e614=0x0;_0x33281a<_0x5743b0[_0x5b96a2][_0x786d('0x25')];_0x33281a+=0x1,_0x33e614=0x0){var _0x18579d=_0x5743b0[_0x5b96a2][_0x33281a];if(_0x18579d[_0x786d('0x10')]){_0x18579d[_0x786d('0x10')]=_0x18579d[_0x786d('0x10')][_0x786d('0x26')]();}var _0x456c0c=[];var _0x3a9507=[];delete _0x18579d['id'];delete _0x18579d[_0x786d('0x27')];delete _0x18579d[_0x786d('0x28')];var _0x37e4f5=_0x18579d['interval']!==_0x786d('0x29')?[_0x18579d[_0x786d('0x2a')]]:_0x18579d[_0x786d('0x4')]?_[_0x786d('0x2b')](_[_0x786d('0x9')](_0x42553d[_0x786d('0x2c')],{'IntervalId':_0x18579d[_0x786d('0x4')]}),_0x786d('0x2a')):[];if(_0x18579d['hasOwnProperty']('tag')){if(_0x18579d['tag']&&_0x18579d[_0x786d('0x2d')]!=='--'){_0x456c0c['push']({'type':_0x18579d[_0x786d('0x10')],'app':'Set','appdata':_0x786d('0x2e')+_0x18579d[_0x786d('0x2d')],'context':_0x18579d[_0x786d('0x13')],'exten':_0x18579d['exten'],'priority':_0x37e4f5['length']+_0x42553d[_0x786d('0xc')]+_0x33e614++,'VoiceExtensionId':_0x18579d[_0x786d('0x14')]});}}if(_0x18579d[_0x786d('0x10')]==='outbound'&&_0x18579d[_0x786d('0x1e')]('callerID')){if(_0x18579d[_0x786d('0x2f')]){_0x456c0c['push']({'type':_0x18579d['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x18579d[_0x786d('0x2f')]+')','context':_0x18579d[_0x786d('0x13')],'exten':_0x18579d[_0x786d('0x8')],'priority':_0x37e4f5[_0x786d('0x25')]+_0x42553d[_0x786d('0xc')]+_0x33e614++,'VoiceExtensionId':_0x18579d[_0x786d('0x14')]});}else{_0x456c0c['push']({'type':_0x18579d['type'],'app':_0x786d('0x30'),'appdata':_0x786d('0x31'),'context':_0x18579d['context'],'exten':_0x18579d[_0x786d('0x8')],'priority':_0x37e4f5[_0x786d('0x25')]+_0x42553d[_0x786d('0xc')]+_0x33e614++,'VoiceExtensionId':_0x18579d['VoiceExtensionId']});}}if(_0x18579d[_0x786d('0x1e')](_0x786d('0x32'))){if(_0x2faf0e[_0x786d('0x33')](_0x18579d[_0x786d('0x34')][_0x786d('0x26')]())>=0x0&&_0x18579d[_0x786d('0x35')]!==_0x786d('0x36')){if(_0x18579d[_0x786d('0x32')]){_0x456c0c[_0x786d('0xf')]({'type':_0x18579d[_0x786d('0x10')],'app':_0x786d('0x30'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x18579d[_0x786d('0x13')],'exten':_0x18579d[_0x786d('0x8')],'priority':_0x37e4f5['length']+_0x42553d[_0x786d('0xc')]+_0x33e614++,'VoiceExtensionId':_0x18579d[_0x786d('0x14')]});_0x456c0c[_0x786d('0xf')]({'type':_0x18579d[_0x786d('0x10')],'app':_0x786d('0x11'),'appdata':_0x786d('0x37'),'context':_0x18579d[_0x786d('0x13')],'exten':_0x18579d['exten'],'priority':_0x37e4f5[_0x786d('0x25')]+_0x42553d[_0x786d('0xc')]+_0x33e614++,'VoiceExtensionId':_0x18579d[_0x786d('0x14')]});}else{_0x456c0c['push']({'type':_0x18579d[_0x786d('0x10')],'app':'ExecIf','appdata':_0x786d('0x38'),'context':_0x18579d['context'],'exten':_0x18579d['exten'],'priority':_0x37e4f5[_0x786d('0x25')]+_0x42553d['priority']+_0x33e614++,'VoiceExtensionId':_0x18579d[_0x786d('0x14')]});_0x456c0c['push']({'type':_0x18579d['type'],'app':'Set','appdata':_0x786d('0x39'),'context':_0x18579d[_0x786d('0x13')],'exten':_0x18579d[_0x786d('0x8')],'priority':_0x37e4f5[_0x786d('0x25')]+_0x42553d['priority']+_0x33e614++,'VoiceExtensionId':_0x18579d[_0x786d('0x14')]});}}}for(var _0x52c9b3=0x0;_0x52c9b3<_0x37e4f5['length'];_0x52c9b3+=0x1){var _0x498a25=_0x42553d['priority']+_0x37e4f5[_0x786d('0x25')];var _0x393cde=_0x52c9b3===_0x37e4f5[_0x786d('0x25')]-0x1?_0x42553d[_0x786d('0xc')]+_0x456c0c['length']+_0x3a9507[_0x786d('0x25')]+0x2:_0x42553d[_0x786d('0xc')]+_0x52c9b3+0x1;_0x456c0c[_0x786d('0x3a')](_0x52c9b3,0x0,{'type':_0x18579d[_0x786d('0x10')],'app':'GotoIfTime','appdata':_0x37e4f5[_0x52c9b3]+'?'+_0x18579d[_0x786d('0x13')]+_0x786d('0x3b')+_0x498a25+':'+_0x18579d[_0x786d('0x13')]+_0x786d('0x3b')+_0x393cde,'exten':_0x18579d[_0x786d('0x8')],'context':_0x18579d[_0x786d('0x13')],'priority':_0x42553d[_0x786d('0xc')]+_0x52c9b3,'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});}_0x18579d[_0x786d('0xc')]=_0x456c0c['length']?_[_0x786d('0x3c')](_0x456c0c)[_0x786d('0xc')]+0x1:_0x42553d['priority'];_0x42553d[_0x786d('0xc')]=(_0x3a9507['length']?_[_0x786d('0x3c')](_0x3a9507)[_0x786d('0xc')]:_0x18579d[_0x786d('0xc')])+0x1;_0x42553d[_0x786d('0xd')]=_[_0x786d('0x3d')](_0x42553d[_0x786d('0xd')],_0x456c0c,[_0x18579d],_0x3a9507);}_0x42553d[_0x786d('0xd')][_0x786d('0xf')]({'type':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x10')],'app':_0x786d('0x3e'),'exten':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x8')],'context':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x13')],'priority':_0x42553d[_0x786d('0xc')],'VoiceExtensionId':_0x5743b0[_0x5b96a2][0x0][_0x786d('0x14')]});_0x22aa5c['push'](_0x5743b0[_0x5b96a2][0x0]['VoiceExtensionId']);_0x1d66f1=_[_0x786d('0x3d')](_0x1d66f1,_0x42553d[_0x786d('0xd')]);}}return _0x5372c9['transaction'](function(_0x54a48f){return _0x5372c9[_0x786d('0x1')][_0x786d('0x6')][_0x786d('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x22aa5c}},'transaction':_0x54a48f})['then'](function(_0x5ef061){return _0x5372c9[_0x786d('0x1')][_0x786d('0x6')][_0x786d('0x40')](_[_0x786d('0x41')](_0x1d66f1,_0x786d('0xc')),{'transaction':_0x54a48f});});});})['catch'](function(_0x3f021c){console[_0x786d('0x42')](_0x3f021c);});}exports[_0x786d('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c45d07b..fe18a67 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file +var _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0x6fdd0d,_0x1efb08){var _0x2bae5f=function(_0x20a9ee){while(--_0x20a9ee){_0x6fdd0d['push'](_0x6fdd0d['shift']());}};_0x2bae5f(++_0x1efb08);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9a62a1f..4503368 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c55=['phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','phone','scheduledat','ListId','createdAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','insert','cm_hopper_black','ContactId','updatedAt','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','cm_contacts','deletedAt\x20IS\x20NULL','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','main','stringify','send','start','socket_timestamp','root','.csv','header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','agent\x20not\x20exists','email','dateOfBirth','isValid','firstName','SystemRow','contact:import:','Abort\x20parser','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x0c55,0x185));var _0x50c5=function(_0x35b68e,_0x17f1bf){_0x35b68e=_0x35b68e-0x0;var _0x18eeed=_0x0c55[_0x35b68e];return _0x18eeed;};'use strict';var fs=require('fs');var path=require(_0x50c5('0x0'));var _=require(_0x50c5('0x1'));var Papa=require('papaparse');var util=require(_0x50c5('0x2'));var BPromise=require('bluebird');var moment=require(_0x50c5('0x3'));var squel=require(_0x50c5('0x4'));var Redis=require(_0x50c5('0x5'));var db=require(_0x50c5('0x6'))['db'];var config=require(_0x50c5('0x7'));var logger=require(_0x50c5('0x8'))('import');config[_0x50c5('0x9')]=_[_0x50c5('0xa')](config[_0x50c5('0x9')],{'host':_0x50c5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50c5('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x50c5('0xc')](_0x50c5('0xd'));function isEmail(_0x388832){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x388832);}function selectNotIn(_0x1fb553,_0x2bfabf,_0x2b7e87,_0x51b1e5,_0x25e5e1){return squel[_0x50c5('0xe')]()[_0x50c5('0xf')]('phone')[_0x50c5('0x10')](_0x51b1e5)['join'](_0x2bfabf,null,_0x2bfabf+_0x50c5('0x11')+_0x51b1e5+'.'+_0x2b7e87)['where'](_0x51b1e5+'.'+_0x2b7e87+_0x50c5('0x12')+_0x1fb553+'.'+_0x2b7e87)['where'](_0x2bfabf+_0x50c5('0x13')+_0x25e5e1[_0x50c5('0x14')]()+')');}function insertCmHopper(_0x4e094a,_0x426777,_0x2ad3a1,_0xb65261,_0x174e0d){var _0x3ddbd1=[_0x50c5('0x15'),_0x50c5('0x16'),_0x50c5('0x17'),'cm_contacts.ListId',_0x426777+'.'+_0xb65261,_0x50c5('0x18'),_0x50c5('0x19'),'cm_contacts.priority',_0x50c5('0x1a'),'\x22'+_0x174e0d+'\x22'];return squel['insert']()[_0x50c5('0x1b')](_0x50c5('0x1c'))[_0x50c5('0x1d')]([_0x50c5('0x1e'),_0x50c5('0x1f'),'ContactId',_0x50c5('0x20'),_0xb65261,_0x50c5('0x21'),'updatedAt','priority',_0x50c5('0x22'),_0x50c5('0x23')],squel[_0x50c5('0xe')]()[_0x50c5('0x24')](_0x3ddbd1)[_0x50c5('0x10')](_0x426777)[_0x50c5('0x14')]('cm_contacts',null,_0x50c5('0x25')+_0x426777+_0x50c5('0x26'))[_0x50c5('0x14')](_0x2ad3a1,null,_0x2ad3a1+_0x50c5('0x11')+_0x426777+'.'+_0xb65261)[_0x50c5('0x27')](_0x426777+_0x50c5('0x28'),_0x4e094a)['where'](_0x50c5('0x29'),NOW)[_0x50c5('0x27')](_0x50c5('0x2a'),selectNotIn(_0x426777,_0x2ad3a1,_0xb65261,_0x50c5('0x1c'),[_0x50c5('0x2b'),_0x50c5('0x2c')]))['where'](_0x50c5('0x2a'),selectNotIn(_0x426777,_0x2ad3a1,_0xb65261,'cm_hopper',['\x22always\x22'])))[_0x50c5('0x2d')]();}function insertCmHopperBlack(_0x2de940,_0x3c8095,_0x936292,_0x85484a){var _0x352b46=[_0x50c5('0x15'),_0x50c5('0x17'),_0x50c5('0x2e'),_0x3c8095+'.'+_0x85484a,'cm_contacts.createdAt',_0x50c5('0x19')];return squel[_0x50c5('0x2f')]()['into'](_0x50c5('0x30'))[_0x50c5('0x1d')](['phone',_0x50c5('0x31'),_0x50c5('0x20'),_0x85484a,'createdAt',_0x50c5('0x32')],squel[_0x50c5('0xe')]()[_0x50c5('0x24')](_0x352b46)[_0x50c5('0x10')](_0x3c8095)[_0x50c5('0x14')]('cm_contacts',null,_0x50c5('0x25')+_0x3c8095+_0x50c5('0x26'))[_0x50c5('0x14')](_0x936292,null,_0x936292+_0x50c5('0x11')+_0x3c8095+'.'+_0x85484a)[_0x50c5('0x27')](_0x3c8095+_0x50c5('0x28'),_0x2de940)[_0x50c5('0x27')](_0x50c5('0x29'),NOW)[_0x50c5('0x27')](_0x50c5('0x2a'),squel[_0x50c5('0xe')]()[_0x50c5('0xf')]('phone')['from'](_0x50c5('0x30'))[_0x50c5('0x27')](_0x50c5('0x33'),_0x2de940)[_0x50c5('0x27')](_0x85484a+_0x50c5('0x34'),_0x3c8095+'.'+_0x85484a)))['toString']();}function insertCmContact(_0x6049c1,_0x2933c0,_0x56952a,_0x5302d1){var _0x31cb08=_['concat'](_[_0x50c5('0x35')](_0x5302d1),[_0x50c5('0x20'),_0x50c5('0x36'),_0x50c5('0x21'),_0x50c5('0x32')]);return squel[_0x50c5('0x2f')]()['into'](_0x50c5('0x37'))['fromQuery'](_0x31cb08,squel[_0x50c5('0xe')]()[_0x50c5('0x24')](_0x31cb08)[_0x50c5('0x10')](_0x2933c0)[_0x50c5('0x27')]('('+_0x56952a[_0x50c5('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0x50c5('0xe')]()['fields'](_0x56952a)[_0x50c5('0x10')](_0x50c5('0x37'))['where'](_0x50c5('0x33'),_0x6049c1)[_0x50c5('0x27')](_0x50c5('0x38')))[_0x50c5('0x27')]('id\x20IN\x20?',squel[_0x50c5('0xe')]()[_0x50c5('0xf')]('MIN(id)',_0x50c5('0x39'))[_0x50c5('0x10')](_0x2933c0)[_0x50c5('0x3a')](_0x56952a[_0x50c5('0x14')](','))))[_0x50c5('0x2d')]();}function handleStop(){logger[_0x50c5('0x3b')](_0x50c5('0x3c'));stopped=!![];}function handleUncaughtException(_0x5b09e5){logger[_0x50c5('0x3d')](_0x5b09e5[_0x50c5('0x3e')]);process[_0x50c5('0x3f')](0x1);}function handleError(_0x74c7a4,_0x8b0810){stats[_0x50c5('0x40')][_0x50c5('0x41')]({'name':_0x8b0810[_0x50c5('0x42')],'message':_0x8b0810['message'],'row':_0x74c7a4});}function handleQuery(_0xf5aa31){logger[_0x50c5('0x3b')](_0xf5aa31);return db[_0x50c5('0x43')][_0x50c5('0x44')](_0xf5aa31)[_0x50c5('0x45')](function(_0x1a24ec){results['push'](_0x1a24ec);})[_0x50c5('0x46')](function(_0x17c324){logger['error'](_0x17c324[_0x50c5('0x3e')]);});}function main(_0x5205b,_0x1f11e2,_0x3ea628,_0x2d38c8){logger['info'](_0x50c5('0x47'),_0x5205b,JSON[_0x50c5('0x48')](_0x1f11e2));process[_0x50c5('0x49')](_0x50c5('0x4a'));var _0x1e9753=_0x1f11e2['binding'];var _0x37b635=_0x1f11e2[_0x50c5('0x4b')];var _0x2afe4c=path[_0x50c5('0x14')](config[_0x50c5('0x4c')],'server/files/tmp',_0x37b635+_0x50c5('0x4d'));var _0x588ca2=_[_0x50c5('0x35')](_0x1e9753)['join']();logger[_0x50c5('0x3b')](_0x50c5('0x4e'),_0x588ca2);fs[_0x50c5('0x4f')](_0x2afe4c,_0x588ca2+'\x0a');Papa[_0x50c5('0x50')](fs['createReadStream'](_0x5205b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e3698,_0x1bc455){try{for(var _0x4cf799=0x0,_0x3e4978=[];_0x4cf799<_0x2e3698[_0x50c5('0x51')][_0x50c5('0x52')];_0x4cf799++){stats[_0x50c5('0x53')]+=0x1;if(_0x2e3698[_0x50c5('0x40')][_0x4cf799]){handleError(_0x2e3698[_0x50c5('0x51')][_0x4cf799],_0x2e3698[_0x50c5('0x40')][_0x4cf799]);}else{var _0x88351f=[];for(var _0x16f14e in _0x1e9753){if(_0x1e9753[_0x50c5('0x54')](_0x16f14e)){if(_0x2e3698[_0x50c5('0x51')][_0x4cf799][_0x1e9753[_0x16f14e]]){var _0x35ed81=_[_0x50c5('0x55')](_0x2e3698[_0x50c5('0x51')][_0x4cf799][_0x1e9753[_0x16f14e]][_0x50c5('0x56')](/"/g,'\x27'));switch(_0x16f14e){case _0x50c5('0x1f'):var _0x3f7a2b=moment(_0x35ed81,_0x50c5('0xd'),!![]);if(_0x3f7a2b['isValid']()){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}else{_0x88351f[_0x50c5('0x41')](_0x50c5('0x57'));}break;case _0x50c5('0x58'):var _0x1a0fe8=parseInt(_0x35ed81);_0x35ed81=_['isNaN'](_0x1a0fe8)||_0x1a0fe8<0x0||_0x1a0fe8>0x4?_0x2d38c8?0x3:0x2:_0x1a0fe8;_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');break;case'UserId':var _0x55f9df=parseInt(_0x35ed81);if(_[_0x50c5('0x59')](_0x55f9df)&&_['includes'](_0x3ea628,_0x55f9df)){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x55f9df+'\x22');}else{_0x88351f[_0x50c5('0x41')](_0x50c5('0x5a'));}break;case _0x50c5('0x5b'):if(isEmail(_0x35ed81)){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}else{_0x88351f['push']('email\x20wrong\x20format');}break;case _0x50c5('0x5c'):var _0x4d0e82=moment(_0x35ed81,'YYYY-MM-DD',!![]);if(_0x4d0e82[_0x50c5('0x5d')]()){_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}else{_0x88351f[_0x50c5('0x41')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x3e4978[_0x50c5('0x41')]('\x22'+_0x35ed81+'\x22');}}else{switch(_0x16f14e){case _0x50c5('0x5e'):case _0x50c5('0x1e'):_0x88351f[_0x50c5('0x41')](_0x16f14e+'\x20not\x20specified');break;default:_0x3e4978[_0x50c5('0x41')]('\x22\x22');}}}}if(_0x88351f['length']){handleError(_0x2e3698[_0x50c5('0x51')][_0x4cf799],{'code':_0x50c5('0x5f'),'message':_0x88351f['join']()});}else{fs['appendFileSync'](_0x2afe4c,_0x3e4978[_0x50c5('0x14')]()+'\x0a');}_0x3e4978=[];}if(!(stats[_0x50c5('0x53')]%0xc8)){socket['emit'](_0x50c5('0x60')+_0x37b635,stats);stats[_0x50c5('0x40')]=[];}}if(stopped){logger['info'](_0x50c5('0x61'));_0x1bc455['abort']();}}catch(_0x1f2d05){handleError(_0x2e3698[_0x50c5('0x51')][_0x4cf799],{'code':_0x50c5('0x62'),'message':_0x1f2d05[_0x50c5('0x3e')]});logger[_0x50c5('0x3d')]('step',_0x1f2d05[_0x50c5('0x3e')]);}},'complete':function(){try{var _0x1ff7e2=[];var _0x176fec='cm_contacts';if(_0x1f11e2[_0x50c5('0x63')]&&_0x1f11e2[_0x50c5('0x63')]['length']){_0x176fec=_0x50c5('0x64')+_0x37b635;_0x1ff7e2[_0x50c5('0x41')]('CREATE\x20TABLE\x20'+_0x176fec+_0x50c5('0x65'));}var _0x322451=util[_0x50c5('0xc')](_0x50c5('0x66'),_0x2afe4c,_0x176fec,_0x588ca2,_0x1f11e2[_0x50c5('0x20')],_0x1f11e2[_0x50c5('0x36')]||null,NOW,NOW);if(_[_0x50c5('0x67')](_0x1e9753[_0x50c5('0x1f')])){_0x322451+=_0x50c5('0x68');}_0x1ff7e2[_0x50c5('0x41')](_0x322451);if(_0x1f11e2[_0x50c5('0x63')]&&_0x1f11e2[_0x50c5('0x63')][_0x50c5('0x52')]){_0x1ff7e2[_0x50c5('0x41')](insertCmContact(_0x1f11e2['ListId'],_0x176fec,_0x1f11e2[_0x50c5('0x63')],_0x1e9753));_0x1ff7e2[_0x50c5('0x41')]('DROP\x20TABLE\x20'+_0x176fec+';');}_0x1ff7e2[_0x50c5('0x41')](insertCmHopper(_0x1f11e2[_0x50c5('0x20')],'voice_queues_has_cm_lists','voice_queues','VoiceQueueId',_0x2d38c8));_0x1ff7e2[_0x50c5('0x41')](insertCmHopperBlack(_0x1f11e2[_0x50c5('0x20')],_0x50c5('0x69'),_0x50c5('0x6a'),_0x50c5('0x6b')));_0x1ff7e2[_0x50c5('0x41')](insertCmHopper(_0x1f11e2[_0x50c5('0x20')],_0x50c5('0x6c'),_0x50c5('0x6d'),_0x50c5('0x6e'),_0x2d38c8));_0x1ff7e2[_0x50c5('0x41')](insertCmHopperBlack(_0x1f11e2['ListId'],'campaigns_has_cm_blacklists','campaigns','CampaignId'));BPromise[_0x50c5('0x6f')](_0x1ff7e2,handleQuery)[_0x50c5('0x70')](function(_0x2e820e){stats[_0x50c5('0x71')]=!![];stats[_0x50c5('0x72')]=_0x1f11e2[_0x50c5('0x63')]&&_0x1f11e2[_0x50c5('0x63')][_0x50c5('0x52')]?results[0x2]['affectedRows']:results[0x0][_0x50c5('0x72')];socket['emit'](_0x50c5('0x60')+_0x37b635,stats);fs[_0x50c5('0x73')](_0x5205b);fs[_0x50c5('0x73')](_0x2afe4c);process[_0x50c5('0x3f')](0x0);})[_0x50c5('0x46')](function(_0x4ce76f){logger['error'](_0x4ce76f['message']);process[_0x50c5('0x3f')](0x1);});}catch(_0x1352a4){logger[_0x50c5('0x3d')](_0x50c5('0x74'),_0x1352a4['message']);process[_0x50c5('0x3f')](0x1);}},'error':function(_0x4f4a73,_0x7e3948,_0x1c3eb4,_0x52be9c){throw new Error(_0x52be9c);}});}function validate(){if(process[_0x50c5('0x75')]&&process[_0x50c5('0x75')][_0x50c5('0x52')]<0x4){throw new Error(_0x50c5('0x76'));}var _0x1fa656=path[_0x50c5('0x14')](config[_0x50c5('0x4c')],_0x50c5('0x77'),process[_0x50c5('0x75')][0x2]);if(!fs['existsSync'](_0x1fa656)){throw new Error(_0x50c5('0x78'));}var _0x1e2891={};try{_0x1e2891=JSON[_0x50c5('0x50')](process[_0x50c5('0x75')][0x3]);if(!_0x1e2891['binding']){throw new Error(_0x50c5('0x79'));}if(!_0x1e2891[_0x50c5('0x7a')][_0x50c5('0x1e')]){throw new Error(_0x50c5('0x7b'));}if(!_0x1e2891[_0x50c5('0x7a')][_0x50c5('0x5e')]){throw new Error('firstName\x20is\x20mandatory');}var _0x396587=0x0;if(_0x1e2891['binding'][_0x50c5('0x22')]){_0x396587=0x1;}if(!_0x1e2891[_0x50c5('0x20')]){throw new Error(_0x50c5('0x7c'));}}catch(_0x195317){throw new Error(_0x50c5('0x7d'));}var _0x229aad=[];try{_0x229aad=_['map'](JSON[_0x50c5('0x50')](process[_0x50c5('0x75')][0x4]),'id');}catch(_0x2866a6){logger[_0x50c5('0x3b')](_0x50c5('0x7e'));}main(_0x1fa656,_0x1e2891,_0x229aad,_0x396587);}validate();process['on']('SIGINT',handleStop);process['on'](_0x50c5('0x7f'),handleUncaughtException); \ No newline at end of file +var _0x528c=['\x20=\x20','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_contacts.ListId','into','cm_hopper_black','fromQuery','\x20=\x20?','toString','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','error','message','exit','errors','push','sequelize','query','spread','catch','send','server/files/tmp','.csv','writeFileSync','createReadStream','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','ListId','isNil','length','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','then','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','parse','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where'];(function(_0x53f5ef,_0x148d30){var _0xe236bb=function(_0x54c6c0){while(--_0x54c6c0){_0x53f5ef['push'](_0x53f5ef['shift']());}};_0xe236bb(++_0x148d30);}(_0x528c,0xe3));var _0xc528=function(_0x3e5bf0,_0x3aa543){_0x3e5bf0=_0x3e5bf0-0x0;var _0x1e0940=_0x528c[_0x3e5bf0];return _0x1e0940;};'use strict';var fs=require('fs');var path=require(_0xc528('0x0'));var _=require(_0xc528('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require(_0xc528('0x2'));var squel=require(_0xc528('0x3'));var Redis=require(_0xc528('0x4'));var db=require(_0xc528('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xc528('0x6'))(_0xc528('0x7'));config[_0xc528('0x8')]=_['defaults'](config['redis'],{'host':_0xc528('0x9'),'port':0x18eb});var socket=require(_0xc528('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xc528('0xb')](_0xc528('0xc'));function isEmail(_0x49b701){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xc528('0xd')](_0x49b701);}function selectNotIn(_0x40b038,_0x29bd3f,_0x30bbae,_0x2f1cd4,_0x1d8847){return squel[_0xc528('0xe')]()[_0xc528('0xf')](_0xc528('0x10'))[_0xc528('0x11')](_0x2f1cd4)[_0xc528('0x12')](_0x29bd3f,null,_0x29bd3f+_0xc528('0x13')+_0x2f1cd4+'.'+_0x30bbae)[_0xc528('0x14')](_0x2f1cd4+'.'+_0x30bbae+_0xc528('0x15')+_0x40b038+'.'+_0x30bbae)['where'](_0x29bd3f+'.dialCheckDuplicateType\x20IN\x20('+_0x1d8847[_0xc528('0x12')]()+')');}function insertCmHopper(_0x1cfef4,_0x318f26,_0x33e4d1,_0x1d7a1a,_0x22162b){var _0x201f89=[_0xc528('0x16'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x318f26+'.'+_0x1d7a1a,_0xc528('0x17'),_0xc528('0x18'),_0xc528('0x19'),_0xc528('0x1a'),'\x22'+_0x22162b+'\x22'];return squel[_0xc528('0x1b')]()['into'](_0xc528('0x1c'))['fromQuery']([_0xc528('0x10'),_0xc528('0x1d'),_0xc528('0x1e'),'ListId',_0x1d7a1a,_0xc528('0x1f'),_0xc528('0x20'),'priority','UserId','recallme'],squel[_0xc528('0xe')]()[_0xc528('0x21')](_0x201f89)[_0xc528('0x11')](_0x318f26)[_0xc528('0x12')](_0xc528('0x22'),null,_0xc528('0x23')+_0x318f26+_0xc528('0x24'))['join'](_0x33e4d1,null,_0x33e4d1+_0xc528('0x13')+_0x318f26+'.'+_0x1d7a1a)[_0xc528('0x14')](_0x318f26+_0xc528('0x25'),_0x1cfef4)['where'](_0xc528('0x26'),NOW)[_0xc528('0x14')](_0xc528('0x27'),selectNotIn(_0x318f26,_0x33e4d1,_0x1d7a1a,'cm_hopper',[_0xc528('0x28'),_0xc528('0x29')]))[_0xc528('0x14')](_0xc528('0x27'),selectNotIn(_0x318f26,_0x33e4d1,_0x1d7a1a,'cm_hopper',[_0xc528('0x28')])))['toString']();}function insertCmHopperBlack(_0x4f2307,_0x156adf,_0x55ce09,_0x491dc6){var _0x4267fa=[_0xc528('0x16'),_0xc528('0x2a'),_0xc528('0x2b'),_0x156adf+'.'+_0x491dc6,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xc528('0x1b')]()[_0xc528('0x2c')](_0xc528('0x2d'))[_0xc528('0x2e')]([_0xc528('0x10'),_0xc528('0x1e'),'ListId',_0x491dc6,_0xc528('0x1f'),'updatedAt'],squel['select']()[_0xc528('0x21')](_0x4267fa)[_0xc528('0x11')](_0x156adf)[_0xc528('0x12')](_0xc528('0x22'),null,_0xc528('0x23')+_0x156adf+_0xc528('0x24'))[_0xc528('0x12')](_0x55ce09,null,_0x55ce09+'.id\x20=\x20'+_0x156adf+'.'+_0x491dc6)[_0xc528('0x14')](_0x156adf+'.CmListId\x20=\x20?',_0x4f2307)[_0xc528('0x14')](_0xc528('0x26'),NOW)[_0xc528('0x14')](_0xc528('0x27'),squel[_0xc528('0xe')]()[_0xc528('0xf')](_0xc528('0x10'))[_0xc528('0x11')](_0xc528('0x2d'))['where']('ListId\x20=\x20?',_0x4f2307)[_0xc528('0x14')](_0x491dc6+_0xc528('0x2f'),_0x156adf+'.'+_0x491dc6)))[_0xc528('0x30')]();}function insertCmContact(_0x2578bc,_0x3d8e85,_0x533920,_0x1be49f){var _0x292c6d=_[_0xc528('0x31')](_[_0xc528('0x32')](_0x1be49f),['ListId',_0xc528('0x33'),_0xc528('0x1f'),'updatedAt']);return squel[_0xc528('0x1b')]()[_0xc528('0x2c')](_0xc528('0x22'))[_0xc528('0x2e')](_0x292c6d,squel['select']()['fields'](_0x292c6d)['from'](_0x3d8e85)[_0xc528('0x14')]('('+_0x533920['join'](',')+_0xc528('0x34'),squel[_0xc528('0xe')]()[_0xc528('0x21')](_0x533920)[_0xc528('0x11')](_0xc528('0x22'))[_0xc528('0x14')](_0xc528('0x35'),_0x2578bc)[_0xc528('0x14')](_0xc528('0x36')))[_0xc528('0x14')](_0xc528('0x37'),squel[_0xc528('0xe')]()['field'](_0xc528('0x38'),'min_id')['from'](_0x3d8e85)[_0xc528('0x39')](_0x533920[_0xc528('0x12')](','))))[_0xc528('0x30')]();}function handleStop(){logger[_0xc528('0x3a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3def93){logger[_0xc528('0x3b')](_0x3def93[_0xc528('0x3c')]);process[_0xc528('0x3d')](0x1);}function handleError(_0x1f93eb,_0x56d7d3){stats[_0xc528('0x3e')][_0xc528('0x3f')]({'name':_0x56d7d3['code'],'message':_0x56d7d3['message'],'row':_0x1f93eb});}function handleQuery(_0xbc8fd2){logger[_0xc528('0x3a')](_0xbc8fd2);return db[_0xc528('0x40')][_0xc528('0x41')](_0xbc8fd2)[_0xc528('0x42')](function(_0x6a4875){results[_0xc528('0x3f')](_0x6a4875);})[_0xc528('0x43')](function(_0x205d60){logger[_0xc528('0x3b')](_0x205d60[_0xc528('0x3c')]);});}function main(_0x17b756,_0x9d59aa,_0x50c4e9,_0x1bd9a2){logger[_0xc528('0x3a')]('main',_0x17b756,JSON['stringify'](_0x9d59aa));process[_0xc528('0x44')]('start');var _0x53d412=_0x9d59aa['binding'];var _0x84918e=_0x9d59aa['socket_timestamp'];var _0xcf9b4c=path['join'](config['root'],_0xc528('0x45'),_0x84918e+_0xc528('0x46'));var _0x1ab444=_[_0xc528('0x32')](_0x53d412)[_0xc528('0x12')]();logger[_0xc528('0x3a')]('header',_0x1ab444);fs[_0xc528('0x47')](_0xcf9b4c,_0x1ab444+'\x0a');Papa['parse'](fs[_0xc528('0x48')](_0x17b756),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1bcc51,_0x38dcf1){try{for(var _0x33cde0=0x0,_0xf826b2=[];_0x33cde0<_0x1bcc51[_0xc528('0x49')]['length'];_0x33cde0++){stats['rows']+=0x1;if(_0x1bcc51['errors'][_0x33cde0]){handleError(_0x1bcc51[_0xc528('0x49')][_0x33cde0],_0x1bcc51[_0xc528('0x3e')][_0x33cde0]);}else{var _0x22890d=[];for(var _0x4155db in _0x53d412){if(_0x53d412['hasOwnProperty'](_0x4155db)){if(_0x1bcc51[_0xc528('0x49')][_0x33cde0][_0x53d412[_0x4155db]]){var _0x17693d=_[_0xc528('0x4a')](_0x1bcc51[_0xc528('0x49')][_0x33cde0][_0x53d412[_0x4155db]][_0xc528('0x4b')](/"/g,'\x27'));switch(_0x4155db){case'scheduledat':var _0x5b4f21=moment(_0x17693d,_0xc528('0xc'),!![]);if(_0x5b4f21[_0xc528('0x4c')]()){_0xf826b2[_0xc528('0x3f')]('\x22'+_0x17693d+'\x22');}else{_0x22890d[_0xc528('0x3f')](_0xc528('0x4d'));}break;case _0xc528('0x4e'):var _0x42c6e3=parseInt(_0x17693d);_0x17693d=_[_0xc528('0x4f')](_0x42c6e3)||_0x42c6e3<0x0||_0x42c6e3>0x4?_0x1bd9a2?0x3:0x2:_0x42c6e3;_0xf826b2[_0xc528('0x3f')]('\x22'+_0x17693d+'\x22');break;case'UserId':var _0xcb6331=parseInt(_0x17693d);if(_[_0xc528('0x50')](_0xcb6331)&&_['includes'](_0x50c4e9,_0xcb6331)){_0xf826b2[_0xc528('0x3f')]('\x22'+_0xcb6331+'\x22');}else{_0x22890d['push'](_0xc528('0x51'));}break;case'email':if(isEmail(_0x17693d)){_0xf826b2['push']('\x22'+_0x17693d+'\x22');}else{_0x22890d['push'](_0xc528('0x52'));}break;case'dateOfBirth':var _0x2f6baf=moment(_0x17693d,'YYYY-MM-DD',!![]);if(_0x2f6baf[_0xc528('0x4c')]()){_0xf826b2[_0xc528('0x3f')]('\x22'+_0x17693d+'\x22');}else{_0x22890d[_0xc528('0x3f')](_0xc528('0x53'));}break;default:_0xf826b2[_0xc528('0x3f')]('\x22'+_0x17693d+'\x22');}}else{switch(_0x4155db){case'firstName':case _0xc528('0x10'):_0x22890d['push'](_0x4155db+'\x20not\x20specified');break;default:_0xf826b2[_0xc528('0x3f')]('\x22\x22');}}}}if(_0x22890d['length']){handleError(_0x1bcc51[_0xc528('0x49')][_0x33cde0],{'code':_0xc528('0x54'),'message':_0x22890d['join']()});}else{fs[_0xc528('0x55')](_0xcf9b4c,_0xf826b2[_0xc528('0x12')]()+'\x0a');}_0xf826b2=[];}if(!(stats['rows']%0xc8)){socket[_0xc528('0x56')](_0xc528('0x57')+_0x84918e,stats);stats['errors']=[];}}if(stopped){logger[_0xc528('0x3a')](_0xc528('0x58'));_0x38dcf1[_0xc528('0x59')]();}}catch(_0x17edc6){handleError(_0x1bcc51[_0xc528('0x49')][_0x33cde0],{'code':_0xc528('0x5a'),'message':_0x17edc6['message']});logger['error'](_0xc528('0x5b'),_0x17edc6[_0xc528('0x3c')]);}},'complete':function(){try{var _0x4b9d24=[];var _0x5edccc='cm_contacts';if(_0x9d59aa['duplicates']&&_0x9d59aa[_0xc528('0x5c')]['length']){_0x5edccc=_0xc528('0x5d')+_0x84918e;_0x4b9d24[_0xc528('0x3f')](_0xc528('0x5e')+_0x5edccc+_0xc528('0x5f'));}var _0x1c6ca2=util[_0xc528('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0xcf9b4c,_0x5edccc,_0x1ab444,_0x9d59aa[_0xc528('0x60')],_0x9d59aa[_0xc528('0x33')]||null,NOW,NOW);if(_[_0xc528('0x61')](_0x53d412[_0xc528('0x1d')])){_0x1c6ca2+=',\x20scheduledAt\x20=\x20NOW()';}_0x4b9d24[_0xc528('0x3f')](_0x1c6ca2);if(_0x9d59aa[_0xc528('0x5c')]&&_0x9d59aa[_0xc528('0x5c')][_0xc528('0x62')]){_0x4b9d24[_0xc528('0x3f')](insertCmContact(_0x9d59aa[_0xc528('0x60')],_0x5edccc,_0x9d59aa[_0xc528('0x5c')],_0x53d412));_0x4b9d24[_0xc528('0x3f')](_0xc528('0x63')+_0x5edccc+';');}_0x4b9d24[_0xc528('0x3f')](insertCmHopper(_0x9d59aa[_0xc528('0x60')],_0xc528('0x64'),_0xc528('0x65'),'VoiceQueueId',_0x1bd9a2));_0x4b9d24[_0xc528('0x3f')](insertCmHopperBlack(_0x9d59aa[_0xc528('0x60')],_0xc528('0x66'),_0xc528('0x65'),_0xc528('0x67')));_0x4b9d24[_0xc528('0x3f')](insertCmHopper(_0x9d59aa['ListId'],_0xc528('0x68'),'campaigns',_0xc528('0x69'),_0x1bd9a2));_0x4b9d24[_0xc528('0x3f')](insertCmHopperBlack(_0x9d59aa[_0xc528('0x60')],_0xc528('0x6a'),_0xc528('0x6b'),_0xc528('0x69')));BPromise['each'](_0x4b9d24,handleQuery)[_0xc528('0x6c')](function(_0x2d9c54){stats[_0xc528('0x6d')]=!![];stats['affectedRows']=_0x9d59aa[_0xc528('0x5c')]&&_0x9d59aa[_0xc528('0x5c')][_0xc528('0x62')]?results[0x2][_0xc528('0x6e')]:results[0x0][_0xc528('0x6e')];socket[_0xc528('0x56')](_0xc528('0x57')+_0x84918e,stats);fs[_0xc528('0x6f')](_0x17b756);fs[_0xc528('0x6f')](_0xcf9b4c);process['exit'](0x0);})['catch'](function(_0x303031){logger[_0xc528('0x3b')](_0x303031[_0xc528('0x3c')]);process['exit'](0x1);});}catch(_0x509d13){logger[_0xc528('0x3b')]('complete',_0x509d13['message']);process[_0xc528('0x3d')](0x1);}},'error':function(_0x553dad,_0x329191,_0x17b39e,_0xc3ad9c){throw new Error(_0xc3ad9c);}});}function validate(){if(process[_0xc528('0x70')]&&process['argv'][_0xc528('0x62')]<0x4){throw new Error(_0xc528('0x71'));}var _0x484b35=path[_0xc528('0x12')](config['root'],_0xc528('0x45'),process[_0xc528('0x70')][0x2]);if(!fs['existsSync'](_0x484b35)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3e3db6={};try{_0x3e3db6=JSON[_0xc528('0x72')](process[_0xc528('0x70')][0x3]);if(!_0x3e3db6[_0xc528('0x73')]){throw new Error(_0xc528('0x74'));}if(!_0x3e3db6[_0xc528('0x73')][_0xc528('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x3e3db6['binding']['firstName']){throw new Error(_0xc528('0x75'));}var _0x3c4ee7=0x0;if(_0x3e3db6[_0xc528('0x73')][_0xc528('0x76')]){_0x3c4ee7=0x1;}if(!_0x3e3db6[_0xc528('0x60')]){throw new Error(_0xc528('0x77'));}}catch(_0x46a416){throw new Error(_0xc528('0x78'));}var _0x56d341=[];try{_0x56d341=_[_0xc528('0x79')](JSON[_0xc528('0x72')](process['argv'][0x4]),'id');}catch(_0x5224f4){logger[_0xc528('0x3a')]('No\x20agent\x20available');}main(_0x484b35,_0x3e3db6,_0x56d341,_0x3c4ee7);}validate();process['on'](_0xc528('0x7a'),handleStop);process['on'](_0xc528('0x7b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index a20a8d2..d3d2b3c 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['ContactId','ListId','updatedAt','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.updatedAt','cm_hopper_black','createdAt','cm_contacts.createdAt\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','CmHopperId','cm_contact_has_items','concat','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','Received\x20SIGINT','exit','errors','code','info','message','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','name','_description','header','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','replace','priority','includes','agent\x20not\x20exists','email','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','contact','contactId','DROP\x20TABLE\x20','each','finish','affectedRows','emit','unlink','catch','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','error','AdditionalPhones','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e802e,_0x6f953){_0x4e802e=_0x4e802e-0x0;var _0x479220=_0xedd9[_0x4e802e];return _0x479220;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x9edd('0x0'));var Papa=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var BPromise=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var squel=require(_0x9edd('0x5'));var Redis=require(_0x9edd('0x6'));var db=require(_0x9edd('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0x9edd('0x8'))(_0x9edd('0x9'));config[_0x9edd('0xa')]=_[_0x9edd('0xb')](config['redis'],{'host':_0x9edd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9edd('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x9edd('0xd')](_0x9edd('0xe'));var tempTableName=_0x9edd('0xf')+moment()['format'](_0x9edd('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5d2f90){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x9edd('0x11')](_0x5d2f90);}function selectNotIn(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00){return squel[_0x9edd('0x12')]()[_0x9edd('0x13')](_0x9edd('0x14'))[_0x9edd('0x15')](_0x13dc4f)[_0x9edd('0x16')](_0x523026,null,_0x523026+_0x9edd('0x17')+_0x13dc4f+'.'+_0xbf9da6)[_0x9edd('0x18')](_0x13dc4f+'.'+_0xbf9da6+_0x9edd('0x19')+_0x138767+'.'+_0xbf9da6)['where'](_0x523026+_0x9edd('0x1a')+_0x5b6c00[_0x9edd('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x891832,_0x4d9a7){promisesAdditionalPhones=[];promisesContact=[];return db[_0x9edd('0x1b')][_0x9edd('0x1c')](_0x9edd('0x1d')+tempTableName)[_0x9edd('0x1e')](function(_0x4ea60f){if(_0x4ea60f!==null){var _0x5f5bf4=[];for(var _0x448996=0x0;_0x448996<_0x4ea60f[_0x9edd('0x1f')];_0x448996++){var _0x5acf65=_0x4ea60f[_0x448996];if(!_[_0x9edd('0x20')](_0x5acf65[_0x9edd('0x14')])){if(!_[_0x9edd('0x20')](_0x5acf65['AdditionalPhones']))_0x5f5bf4[_0x9edd('0x21')](insertAdditionalPhones(_0x5acf65));promisesContact['push']({'contact':_0x5acf65});}}}Promise[_0x9edd('0x22')](_0x5f5bf4)[_0x9edd('0x23')](function(){_0x891832({'val':0x1});});})['catch'](function(_0x498977){logger[_0x9edd('0x24')](_0x498977['message']);});});}function insertAdditionalPhones(_0x27a95a){return new Promise(function(_0x54a03f,_0x535f37){var _0x356751=_0x27a95a[_0x9edd('0x25')];if(_['isNil'](_0x356751))_0x535f37({'val':0x0});else{var _0x5823bc=_0x356751[_0x9edd('0x26')](';');var _0x186186=[];orderBy=0x0;for(var _0x477878=0x0;_0x477878<_0x5823bc['length'];_0x477878++){_0x186186[_0x9edd('0x21')](splitAdditionalPhone(_0x27a95a['id'],_0x5823bc[_0x477878]));}Promise[_0x9edd('0x22')](_0x186186)[_0x9edd('0x23')](function(){_0x54a03f({'val':_0x5823bc[_0x9edd('0x1f')]});});}});}function splitAdditionalPhone(_0x339a0d,_0x4c75d2){return new Promise(function(_0x46c383,_0xeaf55a){var _0x3a1ea5=_0x4c75d2[_0x9edd('0x26')](':');var _0x310a4d=_0x3a1ea5[0x0];var _0x4d507f=_0x3a1ea5[0x1];if(_0x4d507f!==''){var _0x4b3d1b=_0x4d507f[_0x9edd('0x26')]('|');var _0xfeca7b=[];for(var _0x8d67aa=0x0;_0x8d67aa<_0x4b3d1b[_0x9edd('0x1f')];_0x8d67aa++){if(_0x4b3d1b[_0x8d67aa]!==''){var _0x3c2227=_['filter'](promisesAdditionalPhones,{'contactId':_0x339a0d,'phone':_0x4b3d1b[_0x8d67aa]});if(_0x3c2227['length']==0x0){orderBy++;promisesAdditionalPhones[_0x9edd('0x21')]({'contactId':_0x339a0d,'contactTypeId':_0x310a4d,'phone':_0x4b3d1b[_0x8d67aa],'orderBy':orderBy});}}}_0x46c383({'ok':0x1});}else _0x46c383({'res':0x0});});}function createAdditionalPhone(_0x257a26,_0x1c762c,_0x52746a,_0x238b22){var _0x28cfae='';var _0x2ae8dd='';var _0x41af53=_0x52746a['split']('§');_0x28cfae=_0x41af53[0x0];if(_0x41af53[_0x9edd('0x1f')]==0x2)_0x2ae8dd=_0x41af53[0x1];return new Promise(function(_0x3fb556,_0xbe87e1){return db[_0x9edd('0x27')][_0x9edd('0x28')]({'where':{'CmContactId':_0x257a26,'item':_0x28cfae}})[_0x9edd('0x23')](function(_0x209aba){if(_0x209aba){return db[_0x9edd('0x27')][_0x9edd('0x29')]({'ItemTypeId':_0x1c762c,'description':_0x2ae8dd,'OrderBy':_0x238b22},{'where':{'CmContactId':_0x257a26,'item':_0x28cfae}})[_0x9edd('0x23')](function(_0x4fd03f){_0x3fb556({'res':_0x9edd('0x2a')});});}else{return db[_0x9edd('0x27')][_0x9edd('0x2b')]({'CmContactId':_0x257a26,'item':_0x28cfae,'ItemTypeId':_0x1c762c,'description':_0x2ae8dd,'OrderBy':_0x238b22,'ItemClass':_0x9edd('0x2c')})['then'](function(_0x1453d2){_0x3fb556({'res':_0x9edd('0x2d')});});}});});}function updateContact(_0x267c74){return new Promise(function(_0x5d1707,_0x2d2f88){var _0x3990fb=_0x267c74['id'];delete _0x267c74['id'];return db[_0x9edd('0x2e')][_0x9edd('0x29')](_0x267c74,{'where':{'id':_0x3990fb}})[_0x9edd('0x23')](function(_0x2bc4ed){updatedRows+=0x1;return db[_0x9edd('0x2f')][_0x9edd('0x29')]({'phone':_0x267c74[_0x9edd('0x14')]},{'where':{'ContactId':_0x3990fb}})[_0x9edd('0x23')](function(_0x29e789){_0x5d1707({'ret':'OK'});});});});}function insertCmHopper(_0x42c1d9,_0x27eb7e,_0x14f780,_0x5757fc,_0x37fcb2){var _0x5ed62d=[_0x9edd('0x30'),_0x9edd('0x31'),_0x9edd('0x32'),_0x9edd('0x33'),_0x27eb7e+'.'+_0x5757fc,_0x9edd('0x34'),'cm_contacts.updatedAt',_0x9edd('0x35'),_0x9edd('0x36'),'\x22'+_0x37fcb2+'\x22'];return squel[_0x9edd('0x37')]()[_0x9edd('0x38')](_0x9edd('0x39'))[_0x9edd('0x3a')]([_0x9edd('0x14'),_0x9edd('0x3b'),_0x9edd('0x3c'),_0x9edd('0x3d'),_0x5757fc,'createdAt',_0x9edd('0x3e'),'priority',_0x9edd('0x3f'),'recallme'],squel[_0x9edd('0x12')]()[_0x9edd('0x40')](_0x5ed62d)[_0x9edd('0x15')](_0x27eb7e)['join'](_0x9edd('0x41'),null,_0x9edd('0x42')+_0x27eb7e+_0x9edd('0x43'))['join'](_0x14f780,null,_0x14f780+_0x9edd('0x17')+_0x27eb7e+'.'+_0x5757fc)['where'](_0x27eb7e+_0x9edd('0x44'),_0x42c1d9)[_0x9edd('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9edd('0x18')](_0x9edd('0x45'),selectNotIn(_0x27eb7e,_0x14f780,_0x5757fc,_0x9edd('0x39'),[_0x9edd('0x46'),'\x22onlyIfOpen\x22']))[_0x9edd('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x27eb7e,_0x14f780,_0x5757fc,_0x9edd('0x39'),[_0x9edd('0x46')])))['toString']();}function insertCmHopperBlack(_0x318757,_0x49a128,_0x548299,_0x369b69){var _0x9cab86=[_0x9edd('0x30'),_0x9edd('0x32'),_0x9edd('0x33'),_0x49a128+'.'+_0x369b69,_0x9edd('0x34'),_0x9edd('0x47')];return squel[_0x9edd('0x37')]()[_0x9edd('0x38')](_0x9edd('0x48'))[_0x9edd('0x3a')]([_0x9edd('0x14'),_0x9edd('0x3c'),_0x9edd('0x3d'),_0x369b69,_0x9edd('0x49'),'updatedAt'],squel[_0x9edd('0x12')]()[_0x9edd('0x40')](_0x9cab86)[_0x9edd('0x15')](_0x49a128)[_0x9edd('0x16')](_0x9edd('0x41'),null,_0x9edd('0x42')+_0x49a128+_0x9edd('0x43'))['join'](_0x548299,null,_0x548299+'.id\x20=\x20'+_0x49a128+'.'+_0x369b69)['where'](_0x49a128+_0x9edd('0x44'),_0x318757)['where'](_0x9edd('0x4a'),NOW)[_0x9edd('0x18')](_0x9edd('0x45'),squel[_0x9edd('0x12')]()[_0x9edd('0x13')]('phone')[_0x9edd('0x15')](_0x9edd('0x48'))[_0x9edd('0x18')]('ListId\x20=\x20?',_0x318757)[_0x9edd('0x18')](_0x369b69+_0x9edd('0x4b'),_0x49a128+'.'+_0x369b69)))[_0x9edd('0x4c')]();}function insertCmHopperAdditionalPhones(_0x293b03){var _0x1d78c4=[_0x9edd('0x4d'),'cm_contact_has_items.item',_0x9edd('0x4e'),_0x9edd('0x4f'),'cm_contact_has_items.updatedAt'];return squel[_0x9edd('0x37')]()[_0x9edd('0x38')]('cm_hopper_additional_phones')[_0x9edd('0x3a')]([_0x9edd('0x50'),_0x9edd('0x14'),'OrderBy',_0x9edd('0x49'),_0x9edd('0x3e')],squel[_0x9edd('0x12')]()[_0x9edd('0x40')](_0x1d78c4)['from'](_0x9edd('0x39'))[_0x9edd('0x16')](_0x9edd('0x41'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x9edd('0x16')](_0x9edd('0x51'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x9edd('0x18')]('cm_hopper.ListId\x20=\x20?',_0x293b03)[_0x9edd('0x18')](_0x9edd('0x4a'),NOW))[_0x9edd('0x4c')]();}function insertCmContact(_0x3fcdf5,_0x1e3c19,_0x18548e,_0x2334d4){var _0x14dd27=_[_0x9edd('0x52')](_[_0x9edd('0x53')](_0x2334d4),[_0x9edd('0x3d'),'CompanyId',_0x9edd('0x49'),_0x9edd('0x3e')]);return squel[_0x9edd('0x37')]()['into'](_0x9edd('0x41'))['fromQuery'](_0x14dd27,squel['select']()['fields'](_0x14dd27)[_0x9edd('0x15')](_0x1e3c19)[_0x9edd('0x18')]('('+_0x18548e[_0x9edd('0x16')](',')+_0x9edd('0x54'),squel['select']()['fields'](_0x18548e)['from'](_0x9edd('0x41'))[_0x9edd('0x18')](_0x9edd('0x55'),_0x3fcdf5))[_0x9edd('0x18')](_0x9edd('0x56'),squel[_0x9edd('0x12')]()[_0x9edd('0x13')](_0x9edd('0x57'),'min_id')[_0x9edd('0x15')](_0x1e3c19)['group'](_0x18548e[_0x9edd('0x16')](','))))[_0x9edd('0x4c')]();}function handleStop(){logger['info'](_0x9edd('0x58'));stopped=!![];}function handleUncaughtException(_0x322359){logger[_0x9edd('0x24')](_0x322359['message']);process[_0x9edd('0x59')](0x1);}function handleError(_0x2e1ce3,_0x430eb4){stats[_0x9edd('0x5a')][_0x9edd('0x21')]({'name':_0x430eb4[_0x9edd('0x5b')],'message':_0x430eb4['message'],'row':_0x2e1ce3});}function handleQuery(_0x4aa337){logger[_0x9edd('0x5c')](_0x4aa337);return db['sequelize'][_0x9edd('0x1c')](_0x4aa337)[_0x9edd('0x1e')](function(_0x439083){results[_0x9edd('0x21')](_0x439083);})['catch'](function(_0x21ead2){logger['error'](_0x21ead2[_0x9edd('0x5d')]);});}function main(_0x344692,_0xc6bde6,_0x5ca123,_0x2651a2){logger['info'](_0x9edd('0x5e'),_0x344692,JSON[_0x9edd('0x5f')](_0xc6bde6));process['send'](_0x9edd('0x60'));var _0x4a72d0=_0xc6bde6[_0x9edd('0x61')];var _0x134c9c=_[_0x9edd('0x62')](_0x4a72d0);var _0x50f4fc=_0xc6bde6[_0x9edd('0x63')];var _0x321485=path[_0x9edd('0x16')](config[_0x9edd('0x64')],_0x9edd('0x65'),_0x50f4fc+'.csv');logger['info'](_0x9edd('0x66'),_0xc6bde6);db[_0x9edd('0x67')]['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x1bc89b){for(var _0x4e003a=0x0;_0x4e003a<_0x1bc89b['length'];_0x4e003a++){if(_0x1bc89b[_0x4e003a][_0x9edd('0x68')]in _0x4a72d0){contactItemTypes[_0x9edd('0x21')](_0x1bc89b[_0x4e003a]);delete _0x134c9c[_0x1bc89b[_0x4e003a]['name']];hasAdditionalPhones=!![];}for(var _0xb9ebeb in _0x4a72d0){if(_0x1bc89b[_0x4e003a][_0x9edd('0x68')]+_0x9edd('0x69')===_0xb9ebeb){phoneDescriptions['push']({'itemTypeId':_0x1bc89b[_0x4e003a]['id'],'description':_0xb9ebeb});delete _0x134c9c[_0xb9ebeb];}}}if(hasAdditionalPhones)_0x134c9c[_0x9edd('0x25')]='';var _0x57695c=_[_0x9edd('0x53')](_0x134c9c)[_0x9edd('0x16')]();logger['info'](_0x9edd('0x6a'),_0x57695c);fs[_0x9edd('0x6b')](_0x321485,_0x57695c+'\x0a');Papa['parse'](fs[_0x9edd('0x6c')](_0x344692),{'header':!![],'skipEmptyLines':!![],'step':function(_0x475dc3,_0x460a92){try{for(var _0x1d9536=0x0,_0x5ce70b=[];_0x1d9536<_0x475dc3[_0x9edd('0x6d')]['length'];_0x1d9536++){stats[_0x9edd('0x6e')]+=0x1;if(_0x475dc3[_0x9edd('0x5a')][_0x1d9536]){handleError(_0x475dc3[_0x9edd('0x6d')][_0x1d9536],_0x475dc3['errors'][_0x1d9536]);}else{var _0x106a67=[];var _0x286593=[];var _0x130dba={};for(var _0x383cb9 in _0x4a72d0){let _0x25626a=contactItemTypes[_0x9edd('0x6f')](_0x3fa4a9=>_0x3fa4a9['name']===_0x383cb9);let _0x5e29d0=contactItemTypes[_0x9edd('0x6f')](_0x3c7874=>_0x3c7874[_0x9edd('0x68')]+_0x9edd('0x69')===_0x383cb9);if(_[_0x9edd('0x20')](_0x25626a)&&_['isNil'](_0x5e29d0)){if(_0x4a72d0[_0x9edd('0x70')](_0x383cb9)){if(_0x475dc3[_0x9edd('0x6d')][_0x1d9536][_0x4a72d0[_0x383cb9]]){var _0x3e284d=_['trim'](_0x475dc3[_0x9edd('0x6d')][_0x1d9536][_0x4a72d0[_0x383cb9]][_0x9edd('0x71')](/"/g,'\x27'));switch(_0x383cb9){case'scheduledat':var _0x3f3093=moment(_0x3e284d,_0x9edd('0xe'),!![]);if(_0x3f3093['isValid']()){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}else{_0x106a67[_0x9edd('0x21')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x9edd('0x72'):var _0x4b8cbc=parseInt(_0x3e284d);_0x3e284d=_['isNaN'](_0x4b8cbc)||_0x4b8cbc<0x0||_0x4b8cbc>0x4?_0x2651a2?0x3:0x2:_0x4b8cbc;_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');break;case _0x9edd('0x3f'):var _0x44b426=parseInt(_0x3e284d);if(_['isNumber'](_0x44b426)&&_[_0x9edd('0x73')](_0x5ca123,_0x44b426)){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x44b426+'\x22');}else{_0x106a67['push'](_0x9edd('0x74'));}break;case _0x9edd('0x75'):if(isEmail(_0x3e284d)){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}else{_0x106a67[_0x9edd('0x21')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1129b7=moment(_0x3e284d,'YYYY-MM-DD',!![]);if(_0x1129b7[_0x9edd('0x76')]()){_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}else{_0x106a67[_0x9edd('0x21')](_0x9edd('0x77'));}break;default:_0x5ce70b[_0x9edd('0x21')]('\x22'+_0x3e284d+'\x22');}}else{switch(_0x383cb9){case _0x9edd('0x78'):case _0x9edd('0x14'):_0x106a67[_0x9edd('0x21')](_0x383cb9+_0x9edd('0x79'));break;default:_0x5ce70b['push']('\x22\x22');}}}}else{var _0x1f66fa='';if(!_[_0x9edd('0x20')](_0x25626a)){if(!_0x130dba[_0x9edd('0x70')](_0x25626a['id'])){for(var _0x8cc956=0x0;_0x8cc956<_0x4a72d0[_0x383cb9][_0x9edd('0x1f')];_0x8cc956++){var _0x3e284d=_[_0x9edd('0x7a')](_0x475dc3['data'][_0x1d9536][_0x4a72d0[_0x383cb9][_0x8cc956]][_0x9edd('0x71')](/"/g,'\x27'));var _0x454992=phoneDescriptions['find'](_0x26c11a=>_0x26c11a[_0x9edd('0x7b')]===_0x25626a['id']);if(!_['isNil'](_0x454992)){var _0x304e56=_[_0x9edd('0x7a')](_0x475dc3[_0x9edd('0x6d')][_0x1d9536][_0x4a72d0[_0x454992['description']][0x0]][_0x9edd('0x71')](/"/g,'\x27'));if(!_[_0x9edd('0x20')](_0x304e56))_0x3e284d=_0x3e284d+'§'+_0x304e56;}if(_0x1f66fa=='')_0x1f66fa=_0x3e284d;else _0x1f66fa+='|'+_0x3e284d;}_0x286593[_0x9edd('0x21')](_0x25626a['id']+':'+_0x1f66fa);_0x130dba[_0x25626a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5ce70b['push']('\x22'+_0x286593['join'](';')+'\x22');}if(_0x106a67['length']){handleError(_0x475dc3['data'][_0x1d9536],{'code':_0x9edd('0x7c'),'message':_0x106a67[_0x9edd('0x16')]()});}else{fs[_0x9edd('0x7d')](_0x321485,_0x5ce70b['join']()+'\x0a');}_0x5ce70b=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x9edd('0x7e')+_0x50f4fc,stats);stats[_0x9edd('0x5a')]=[];}}if(stopped){logger[_0x9edd('0x5c')](_0x9edd('0x7f'));_0x460a92[_0x9edd('0x80')]();}}catch(_0x18b25e){handleError(_0x475dc3[_0x9edd('0x6d')][_0x1d9536],{'code':_0x9edd('0x81'),'message':_0x18b25e[_0x9edd('0x5d')]});logger[_0x9edd('0x24')](_0x9edd('0x82'),_0x18b25e[_0x9edd('0x5d')]);}},'complete':function(){try{var _0x4cfa99=[];var _0x367fc6=tempTableName;_0x4cfa99[_0x9edd('0x21')](_0x9edd('0x83')+_0x367fc6+_0x9edd('0x84'));logger[_0x9edd('0x5c')](_0x9edd('0x85'),contactItemTypes[_0x9edd('0x1f')]);var _0x16b69c=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x321485,_0x367fc6,_0x57695c,_0xc6bde6[_0x9edd('0x3d')],_0xc6bde6['CompanyId']||null,NOW,NOW);if(_[_0x9edd('0x20')](_0x4a72d0['scheduledat'])){_0x16b69c+=_0x9edd('0x86');}_0x4cfa99[_0x9edd('0x21')](_0x16b69c);BPromise['each'](_0x4cfa99,handleQuery)[_0x9edd('0x23')](function(_0x411134){BPromise['all']([handleAdditionalPhones()])[_0x9edd('0x23')](function(){_0x4cfa99=[];for(var _0x3d1294=0x0;_0x3d1294\x20\x20','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','ioredis','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','field','phone','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','push','all','catch','error','message','AdditionalPhones','then','split','CmContactHasItem','findOne','updated','create','inserted','CmContact','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','select','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','fromQuery','ListId'];(function(_0x596bfa,_0x22bd70){var _0x1a32e1=function(_0x1570b7){while(--_0x1570b7){_0x596bfa['push'](_0x596bfa['shift']());}};_0x1a32e1(++_0x22bd70);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x49c4('0x0'));var util=require(_0x49c4('0x1'));var BPromise=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var squel=require(_0x49c4('0x4'));var Redis=require(_0x49c4('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x49c4('0x6'))('import');config[_0x49c4('0x7')]=_[_0x49c4('0x8')](config[_0x49c4('0x7')],{'host':_0x49c4('0x9'),'port':0x18eb});var socket=require(_0x49c4('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x49c4('0xb')](_0x49c4('0xc'));var tempTableName=_0x49c4('0xd')+moment()[_0x49c4('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5ab4a3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x49c4('0xe')](_0x5ab4a3);}function selectNotIn(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c){return squel['select']()[_0x49c4('0xf')](_0x49c4('0x10'))['from'](_0x459d09)[_0x49c4('0x11')](_0x58cad7,null,_0x58cad7+_0x49c4('0x12')+_0x459d09+'.'+_0xb611a1)['where'](_0x459d09+'.'+_0xb611a1+_0x49c4('0x13')+_0x313e73+'.'+_0xb611a1)[_0x49c4('0x14')](_0x58cad7+_0x49c4('0x15')+_0x4adb3c[_0x49c4('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x12777c,_0x18211c){promisesAdditionalPhones=[];promisesContact=[];return db[_0x49c4('0x16')][_0x49c4('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0x49c4('0x18')](function(_0x141003){if(_0x141003!==null){var _0x13a2db=[];for(var _0x81e831=0x0;_0x81e831<_0x141003[_0x49c4('0x19')];_0x81e831++){var _0x53e3a2=_0x141003[_0x81e831];if(!_[_0x49c4('0x1a')](_0x53e3a2[_0x49c4('0x10')])){if(!_['isNil'](_0x53e3a2['AdditionalPhones']))_0x13a2db[_0x49c4('0x1b')](insertAdditionalPhones(_0x53e3a2));promisesContact[_0x49c4('0x1b')]({'contact':_0x53e3a2});}}}Promise[_0x49c4('0x1c')](_0x13a2db)['then'](function(){_0x12777c({'val':0x1});});})[_0x49c4('0x1d')](function(_0x50b151){logger[_0x49c4('0x1e')](_0x50b151[_0x49c4('0x1f')]);});});}function insertAdditionalPhones(_0xe31fcc){return new Promise(function(_0x291526,_0x382040){var _0x41078c=_0xe31fcc[_0x49c4('0x20')];if(_[_0x49c4('0x1a')](_0x41078c))_0x382040({'val':0x0});else{var _0x2197d2=_0x41078c['split'](';');var _0x527126=[];orderBy=0x0;for(var _0x57f502=0x0;_0x57f502<_0x2197d2[_0x49c4('0x19')];_0x57f502++){_0x527126['push'](splitAdditionalPhone(_0xe31fcc['id'],_0x2197d2[_0x57f502]));}Promise['all'](_0x527126)[_0x49c4('0x21')](function(){_0x291526({'val':_0x2197d2[_0x49c4('0x19')]});});}});}function splitAdditionalPhone(_0x26c640,_0xd335e4){return new Promise(function(_0x4811c4,_0x5850f2){var _0x180276=_0xd335e4[_0x49c4('0x22')](':');var _0x565423=_0x180276[0x0];var _0x207358=_0x180276[0x1];if(_0x207358!==''){var _0x43e014=_0x207358[_0x49c4('0x22')]('|');var _0xa7a826=[];for(var _0x531d92=0x0;_0x531d92<_0x43e014['length'];_0x531d92++){if(_0x43e014[_0x531d92]!==''){var _0x449960=_['filter'](promisesAdditionalPhones,{'contactId':_0x26c640,'phone':_0x43e014[_0x531d92]});if(_0x449960[_0x49c4('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x49c4('0x1b')]({'contactId':_0x26c640,'contactTypeId':_0x565423,'phone':_0x43e014[_0x531d92],'orderBy':orderBy});}}}_0x4811c4({'ok':0x1});}else _0x4811c4({'res':0x0});});}function createAdditionalPhone(_0x3f1708,_0x372a47,_0x5987ae,_0x889909){var _0x2b2793='';var _0x46e04d='';var _0x4f28a2=_0x5987ae[_0x49c4('0x22')]('§');_0x2b2793=_0x4f28a2[0x0];if(_0x4f28a2[_0x49c4('0x19')]==0x2)_0x46e04d=_0x4f28a2[0x1];return new Promise(function(_0x26ba17,_0x427b26){return db[_0x49c4('0x23')][_0x49c4('0x24')]({'where':{'CmContactId':_0x3f1708,'item':_0x2b2793}})[_0x49c4('0x21')](function(_0x4ea6ea){if(_0x4ea6ea){return db['CmContactHasItem']['update']({'ItemTypeId':_0x372a47,'description':_0x46e04d,'OrderBy':_0x889909},{'where':{'CmContactId':_0x3f1708,'item':_0x2b2793}})[_0x49c4('0x21')](function(_0x7ee704){_0x26ba17({'res':_0x49c4('0x25')});});}else{return db[_0x49c4('0x23')][_0x49c4('0x26')]({'CmContactId':_0x3f1708,'item':_0x2b2793,'ItemTypeId':_0x372a47,'description':_0x46e04d,'OrderBy':_0x889909,'ItemClass':'PHONE'})[_0x49c4('0x21')](function(_0x116eb4){_0x26ba17({'res':_0x49c4('0x27')});});}});});}function updateContact(_0x24bba9){return new Promise(function(_0x58e252,_0x57a29c){var _0xce57ef=_0x24bba9['id'];delete _0x24bba9['id'];return db[_0x49c4('0x28')][_0x49c4('0x29')](_0x24bba9,{'where':{'id':_0xce57ef}})[_0x49c4('0x21')](function(_0xd38540){updatedRows+=0x1;return db['CmHopper'][_0x49c4('0x29')]({'phone':_0x24bba9[_0x49c4('0x10')]},{'where':{'ContactId':_0xce57ef}})[_0x49c4('0x21')](function(_0x512d02){_0x58e252({'ret':'OK'});});});});}function insertCmHopper(_0x5ba924,_0x85dce2,_0x1991e9,_0x3bec0a,_0x1238c0){var _0x2b45a1=[_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c'),_0x49c4('0x2d'),_0x85dce2+'.'+_0x3bec0a,'cm_contacts.createdAt',_0x49c4('0x2e'),'cm_contacts.priority',_0x49c4('0x2f'),'\x22'+_0x1238c0+'\x22'];return squel[_0x49c4('0x30')]()[_0x49c4('0x31')](_0x49c4('0x32'))['fromQuery']([_0x49c4('0x10'),_0x49c4('0x33'),_0x49c4('0x34'),'ListId',_0x3bec0a,_0x49c4('0x35'),_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38'),_0x49c4('0x39')],squel[_0x49c4('0x3a')]()[_0x49c4('0x3b')](_0x2b45a1)[_0x49c4('0x3c')](_0x85dce2)[_0x49c4('0x11')](_0x49c4('0x3d'),null,_0x49c4('0x3e')+_0x85dce2+'.CmListId')[_0x49c4('0x11')](_0x1991e9,null,_0x1991e9+_0x49c4('0x12')+_0x85dce2+'.'+_0x3bec0a)[_0x49c4('0x14')](_0x85dce2+_0x49c4('0x3f'),_0x5ba924)[_0x49c4('0x14')](_0x49c4('0x40'),NOW)[_0x49c4('0x14')](_0x49c4('0x41'),selectNotIn(_0x85dce2,_0x1991e9,_0x3bec0a,_0x49c4('0x32'),[_0x49c4('0x42'),_0x49c4('0x43')]))[_0x49c4('0x14')](_0x49c4('0x41'),selectNotIn(_0x85dce2,_0x1991e9,_0x3bec0a,'cm_hopper',[_0x49c4('0x42')])))['toString']();}function insertCmHopperBlack(_0x104efb,_0x4915bc,_0x28d4fb,_0x1480da){var _0x239327=[_0x49c4('0x2a'),'cm_contacts.id','cm_contacts.ListId',_0x4915bc+'.'+_0x1480da,_0x49c4('0x44'),_0x49c4('0x2e')];return squel[_0x49c4('0x30')]()[_0x49c4('0x31')]('cm_hopper_black')[_0x49c4('0x45')]([_0x49c4('0x10'),_0x49c4('0x34'),_0x49c4('0x46'),_0x1480da,_0x49c4('0x35'),_0x49c4('0x36')],squel[_0x49c4('0x3a')]()[_0x49c4('0x3b')](_0x239327)[_0x49c4('0x3c')](_0x4915bc)['join'](_0x49c4('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x4915bc+_0x49c4('0x47'))[_0x49c4('0x11')](_0x28d4fb,null,_0x28d4fb+_0x49c4('0x12')+_0x4915bc+'.'+_0x1480da)[_0x49c4('0x14')](_0x4915bc+_0x49c4('0x3f'),_0x104efb)['where'](_0x49c4('0x40'),NOW)[_0x49c4('0x14')](_0x49c4('0x41'),squel[_0x49c4('0x3a')]()[_0x49c4('0xf')](_0x49c4('0x10'))[_0x49c4('0x3c')]('cm_hopper_black')[_0x49c4('0x14')]('ListId\x20=\x20?',_0x104efb)[_0x49c4('0x14')](_0x1480da+_0x49c4('0x48'),_0x4915bc+'.'+_0x1480da)))[_0x49c4('0x49')]();}function insertCmHopperAdditionalPhones(_0x27adfe){var _0x2d8087=[_0x49c4('0x4a'),_0x49c4('0x4b'),'cm_contact_has_items.OrderBy',_0x49c4('0x4c'),_0x49c4('0x4d')];return squel['insert']()[_0x49c4('0x31')](_0x49c4('0x4e'))[_0x49c4('0x45')]([_0x49c4('0x4f'),'phone','OrderBy',_0x49c4('0x35'),'updatedAt'],squel[_0x49c4('0x3a')]()[_0x49c4('0x3b')](_0x2d8087)[_0x49c4('0x3c')](_0x49c4('0x32'))[_0x49c4('0x11')](_0x49c4('0x3d'),null,_0x49c4('0x50'))['join'](_0x49c4('0x51'),null,_0x49c4('0x52'))[_0x49c4('0x14')](_0x49c4('0x53'),_0x27adfe)[_0x49c4('0x14')](_0x49c4('0x40'),NOW))[_0x49c4('0x49')]();}function insertCmContact(_0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f){var _0x5e63f0=_[_0x49c4('0x54')](_[_0x49c4('0x55')](_0x5b822f),['ListId','CompanyId',_0x49c4('0x35'),'updatedAt']);return squel['insert']()[_0x49c4('0x31')](_0x49c4('0x3d'))[_0x49c4('0x45')](_0x5e63f0,squel[_0x49c4('0x3a')]()[_0x49c4('0x3b')](_0x5e63f0)[_0x49c4('0x3c')](_0x1e0b4f)[_0x49c4('0x14')]('('+_0x1856be['join'](',')+_0x49c4('0x56'),squel[_0x49c4('0x3a')]()[_0x49c4('0x3b')](_0x1856be)[_0x49c4('0x3c')](_0x49c4('0x3d'))[_0x49c4('0x14')]('ListId\x20=\x20?',_0x25d174))['where'](_0x49c4('0x57'),squel[_0x49c4('0x3a')]()[_0x49c4('0xf')](_0x49c4('0x58'),_0x49c4('0x59'))[_0x49c4('0x3c')](_0x1e0b4f)[_0x49c4('0x5a')](_0x1856be['join'](','))))[_0x49c4('0x49')]();}function handleStop(){logger[_0x49c4('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x42928c){logger['error'](_0x42928c[_0x49c4('0x1f')]);process[_0x49c4('0x5c')](0x1);}function handleError(_0x9eaa84,_0x2fe89a){stats[_0x49c4('0x5d')][_0x49c4('0x1b')]({'name':_0x2fe89a[_0x49c4('0x5e')],'message':_0x2fe89a[_0x49c4('0x1f')],'row':_0x9eaa84});}function handleQuery(_0x483770){logger[_0x49c4('0x5b')](_0x483770);return db[_0x49c4('0x16')]['query'](_0x483770)[_0x49c4('0x18')](function(_0x299e74){results['push'](_0x299e74);})[_0x49c4('0x1d')](function(_0x42e0e6){logger['error'](_0x42e0e6['message']);});}function main(_0x589484,_0x513879,_0xc43386,_0x54947d){logger[_0x49c4('0x5b')](_0x49c4('0x5f'),_0x589484,JSON['stringify'](_0x513879));process[_0x49c4('0x60')](_0x49c4('0x61'));var _0x5ac9f0=_0x513879[_0x49c4('0x62')];var _0x3dcf4c=_[_0x49c4('0x63')](_0x5ac9f0);var _0x35f46f=_0x513879['socket_timestamp'];var _0x431921=path[_0x49c4('0x11')](config[_0x49c4('0x64')],_0x49c4('0x65'),_0x35f46f+'.csv');logger[_0x49c4('0x5b')]('body',_0x513879);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id','name']})[_0x49c4('0x21')](function(_0x32eaef){for(var _0x2ac7df=0x0;_0x2ac7df<_0x32eaef[_0x49c4('0x19')];_0x2ac7df++){if(_0x32eaef[_0x2ac7df]['name']in _0x5ac9f0){contactItemTypes['push'](_0x32eaef[_0x2ac7df]);delete _0x3dcf4c[_0x32eaef[_0x2ac7df][_0x49c4('0x66')]];hasAdditionalPhones=!![];}for(var _0x109b81 in _0x5ac9f0){if(_0x32eaef[_0x2ac7df][_0x49c4('0x66')]+_0x49c4('0x67')===_0x109b81){phoneDescriptions[_0x49c4('0x1b')]({'itemTypeId':_0x32eaef[_0x2ac7df]['id'],'description':_0x109b81});delete _0x3dcf4c[_0x109b81];}}}if(hasAdditionalPhones)_0x3dcf4c[_0x49c4('0x20')]='';var _0x3ba0d6=_[_0x49c4('0x55')](_0x3dcf4c)['join']();logger[_0x49c4('0x5b')]('header',_0x3ba0d6);fs[_0x49c4('0x68')](_0x431921,_0x3ba0d6+'\x0a');Papa[_0x49c4('0x69')](fs[_0x49c4('0x6a')](_0x589484),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1ea1b4,_0x3a1c81){try{for(var _0x2e062f=0x0,_0x13d657=[];_0x2e062f<_0x1ea1b4[_0x49c4('0x6b')][_0x49c4('0x19')];_0x2e062f++){stats[_0x49c4('0x6c')]+=0x1;if(_0x1ea1b4[_0x49c4('0x5d')][_0x2e062f]){handleError(_0x1ea1b4[_0x49c4('0x6b')][_0x2e062f],_0x1ea1b4[_0x49c4('0x5d')][_0x2e062f]);}else{var _0x14bd09=[];var _0x2d5f63=[];var _0x453cf2={};for(var _0x371e49 in _0x5ac9f0){let _0x3485c0=contactItemTypes['find'](_0x5ec201=>_0x5ec201[_0x49c4('0x66')]===_0x371e49);let _0x16b3e8=contactItemTypes['find'](_0x1a15f3=>_0x1a15f3[_0x49c4('0x66')]+_0x49c4('0x67')===_0x371e49);if(_[_0x49c4('0x1a')](_0x3485c0)&&_['isNil'](_0x16b3e8)){if(_0x5ac9f0['hasOwnProperty'](_0x371e49)){if(_0x1ea1b4['data'][_0x2e062f][_0x5ac9f0[_0x371e49]]){var _0xbb7f42=_[_0x49c4('0x6d')](_0x1ea1b4[_0x49c4('0x6b')][_0x2e062f][_0x5ac9f0[_0x371e49]][_0x49c4('0x6e')](/"/g,'\x27'));switch(_0x371e49){case _0x49c4('0x33'):var _0x146706=moment(_0xbb7f42,_0x49c4('0xc'),!![]);if(_0x146706[_0x49c4('0x6f')]()){_0x13d657[_0x49c4('0x1b')]('\x22'+_0xbb7f42+'\x22');}else{_0x14bd09['push'](_0x49c4('0x70'));}break;case _0x49c4('0x37'):var _0x342f8f=parseInt(_0xbb7f42);_0xbb7f42=_['isNaN'](_0x342f8f)||_0x342f8f<0x0||_0x342f8f>0x4?_0x54947d?0x3:0x2:_0x342f8f;_0x13d657[_0x49c4('0x1b')]('\x22'+_0xbb7f42+'\x22');break;case _0x49c4('0x38'):var _0x1fa0a6=parseInt(_0xbb7f42);if(_[_0x49c4('0x71')](_0x1fa0a6)&&_[_0x49c4('0x72')](_0xc43386,_0x1fa0a6)){_0x13d657[_0x49c4('0x1b')]('\x22'+_0x1fa0a6+'\x22');}else{_0x14bd09[_0x49c4('0x1b')](_0x49c4('0x73'));}break;case'email':if(isEmail(_0xbb7f42)){_0x13d657[_0x49c4('0x1b')]('\x22'+_0xbb7f42+'\x22');}else{_0x14bd09[_0x49c4('0x1b')](_0x49c4('0x74'));}break;case _0x49c4('0x75'):var _0x1e948a=moment(_0xbb7f42,'YYYY-MM-DD',!![]);if(_0x1e948a['isValid']()){_0x13d657[_0x49c4('0x1b')]('\x22'+_0xbb7f42+'\x22');}else{_0x14bd09['push'](_0x49c4('0x76'));}break;default:_0x13d657['push']('\x22'+_0xbb7f42+'\x22');}}else{switch(_0x371e49){case _0x49c4('0x77'):case _0x49c4('0x10'):_0x14bd09[_0x49c4('0x1b')](_0x371e49+_0x49c4('0x78'));break;default:_0x13d657['push']('\x22\x22');}}}}else{var _0x123060='';if(!_[_0x49c4('0x1a')](_0x3485c0)){if(!_0x453cf2[_0x49c4('0x79')](_0x3485c0['id'])){for(var _0x42e19a=0x0;_0x42e19a<_0x5ac9f0[_0x371e49][_0x49c4('0x19')];_0x42e19a++){var _0xbb7f42=_[_0x49c4('0x6d')](_0x1ea1b4[_0x49c4('0x6b')][_0x2e062f][_0x5ac9f0[_0x371e49][_0x42e19a]][_0x49c4('0x6e')](/"/g,'\x27'));var _0x2d4ea6=phoneDescriptions['find'](_0x228189=>_0x228189[_0x49c4('0x7a')]===_0x3485c0['id']);if(!_['isNil'](_0x2d4ea6)){var _0x15bee0=_['trim'](_0x1ea1b4[_0x49c4('0x6b')][_0x2e062f][_0x5ac9f0[_0x2d4ea6[_0x49c4('0x7b')]][0x0]][_0x49c4('0x6e')](/"/g,'\x27'));if(!_[_0x49c4('0x1a')](_0x15bee0))_0xbb7f42=_0xbb7f42+'§'+_0x15bee0;}if(_0x123060=='')_0x123060=_0xbb7f42;else _0x123060+='|'+_0xbb7f42;}_0x2d5f63[_0x49c4('0x1b')](_0x3485c0['id']+':'+_0x123060);_0x453cf2[_0x3485c0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x13d657['push']('\x22'+_0x2d5f63[_0x49c4('0x11')](';')+'\x22');}if(_0x14bd09[_0x49c4('0x19')]){handleError(_0x1ea1b4['data'][_0x2e062f],{'code':_0x49c4('0x7c'),'message':_0x14bd09[_0x49c4('0x11')]()});}else{fs['appendFileSync'](_0x431921,_0x13d657[_0x49c4('0x11')]()+'\x0a');}_0x13d657=[];}if(!(stats[_0x49c4('0x6c')]%0xc8)){socket['emit'](_0x49c4('0x7d')+_0x35f46f,stats);stats[_0x49c4('0x5d')]=[];}}if(stopped){logger[_0x49c4('0x5b')](_0x49c4('0x7e'));_0x3a1c81['abort']();}}catch(_0x999ae2){handleError(_0x1ea1b4[_0x49c4('0x6b')][_0x2e062f],{'code':'SystemError','message':_0x999ae2[_0x49c4('0x1f')]});logger['error']('step',_0x999ae2[_0x49c4('0x1f')]);}},'complete':function(){try{var _0x507078=[];var _0x50fd24=tempTableName;_0x507078[_0x49c4('0x1b')](_0x49c4('0x7f')+_0x50fd24+'\x20LIKE\x20cm_contacts;');logger[_0x49c4('0x5b')]('CIS\x20len',contactItemTypes['length']);var _0x4c4bed=util[_0x49c4('0xb')](_0x49c4('0x80'),_0x431921,_0x50fd24,_0x3ba0d6,_0x513879[_0x49c4('0x46')],_0x513879[_0x49c4('0x81')]||null,NOW,NOW);if(_['isNil'](_0x5ac9f0['scheduledat'])){_0x4c4bed+=_0x49c4('0x82');}_0x507078['push'](_0x4c4bed);BPromise[_0x49c4('0x83')](_0x507078,handleQuery)['then'](function(_0x4e381c){BPromise[_0x49c4('0x1c')]([handleAdditionalPhones()])[_0x49c4('0x21')](function(){_0x507078=[];for(var _0x1076be=0x0;_0x1076be=_0x33c499){return _0x4c8fc2[_0x4c94('0x10')](0x193)[_0x4c94('0x11')]({'message':util[_0x4c94('0x8')](_0x4c94('0x12'),_0x2d1766)});}_0x21e99e();})[_0x4c94('0x13')](function(_0x81c899){_0x21e99e(_0x81c899);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4c94('0x14')],{'where':{'$or':[{'role':_0x4c94('0x15')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xc818=['base64','utf8','parse','hasOwnProperty','use','License','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','user','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr'];(function(_0x166079,_0x25f162){var _0x1f3a7c=function(_0x320491){while(--_0x320491){_0x166079['push'](_0x166079['shift']());}};_0x1f3a7c(++_0x25f162);}(_0xc818,0x133));var _0x8c81=function(_0x328634,_0x10a79e){_0x328634=_0x328634-0x0;var _0x16042c=_0xc818[_0x328634];return _0x16042c;};'use strict';var crypto=require('crypto');var util=require(_0x8c81('0x0'));var compose=require(_0x8c81('0x1'));var db=require(_0x8c81('0x2'))['db'];var config=require(_0x8c81('0x3'));function getValueFromLicense(_0x1297d5,_0x20206b){if(_0x1297d5&&_0x20206b){if(_0x20206b[_0x8c81('0x4')]&&_0x20206b[_0x8c81('0x5')]){var _0x375745=_0x20206b[_0x8c81('0x4')];var _0x413224=_0x20206b['license'];var _0x519664=_0x375745['split']('-')[0x4];var _0x1a9926=_0x375745[_0x8c81('0x6')]('-')[0x0];var _0x56e143=crypto['createDecipher'](_0x8c81('0x7'),util['format']('%s:%s:%s',_0x519664,_0x375745,_0x1a9926));var _0x1127b6=_0x56e143['update'](_0x413224,_0x8c81('0x8'),_0x8c81('0x9'));_0x1127b6+=_0x56e143['final'](_0x8c81('0x9'));var _0x460014=JSON[_0x8c81('0xa')](_0x1127b6);return _0x460014[_0x8c81('0xb')](_0x1297d5)?_0x460014[_0x1297d5]:null;}}return null;}function isLimit(_0xebede7,_0x5dffcd,_0x2c4eac,_0x98bb){var _0x5a5874=_0x5dffcd;return compose()[_0x8c81('0xc')](function(_0x254e44,_0x332cab,_0x1d4d08){return db[_0x8c81('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x8c81('0xe')](function(_0x261770){var _0x4ddaed=getValueFromLicense(_0xebede7,_0x261770);return _0x4ddaed?_0x4ddaed:_0x5a5874;})[_0x8c81('0xe')](function(_0x11f16c){_0x5a5874=_0x11f16c;return _0x2c4eac[_0x8c81('0xf')](_0x98bb);})[_0x8c81('0xe')](function(_0xaf9e1f){if(_0xaf9e1f>=_0x5a5874){return _0x332cab[_0x8c81('0x10')](0x193)['json']({'message':util[_0x8c81('0x11')](_0x8c81('0x12'),_0xebede7)});}_0x1d4d08();})['catch'](function(_0x1eb79){_0x1d4d08(_0x1eb79);});});}function isUserLimit(){return isLimit(_0x8c81('0x13'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x8c81('0x14')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5d7f2ef..5633624 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8000=['$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','text','includes','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$substring','shift','hours','minutes','seconds','lodash','moment','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','push','DATE','operator'];(function(_0x485e0b,_0x5eb3e3){var _0x12283c=function(_0x12b84b){while(--_0x12b84b){_0x485e0b['push'](_0x485e0b['shift']());}};_0x12283c(++_0x5eb3e3);}(_0x8000,0x121));var _0x0800=function(_0x2aa4b9,_0x39044f){_0x2aa4b9=_0x2aa4b9-0x0;var _0x10ba69=_0x8000[_0x2aa4b9];return _0x10ba69;};'use strict';var _=require(_0x0800('0x0'));var moment=require(_0x0800('0x1'));exports['parseSearch']=function(_0x5e9ad5){var _0x1e0156={'conditions':[]};_0x1e0156[_0x0800('0x2')]=_['startsWith'](_0x5e9ad5,_0x0800('0x3'))?'or':_0x0800('0x4');var _0x556362=_0x5e9ad5[_0x0800('0x5')](_0x0800('0x6'),'')[_0x0800('0x5')](_0x0800('0x3'),'')[_0x0800('0x7')]('||');for(var _0x503ce8=0x0;_0x503ce8<_0x556362[_0x0800('0x8')];_0x503ce8++){var _0x40cff3=_0x556362[_0x503ce8][_0x0800('0x7')](':=');var _0x12e03a=_0x40cff3[0x0];var _0x18f1e0=_0x40cff3[_0x0800('0x9')](0x1);_0x18f1e0[_0x0800('0xa')](function(_0x126fb4){var _0x13b54a=_0x126fb4['split']('[')['shift']();var _0xf59b00=_0x126fb4[_0x0800('0xb')](/\[(.*?)\]/g);_0xf59b00['forEach'](function(_0x1e05b3){var _0x5dc7c6=_0x1e05b3[_0x0800('0x7')]('[')[_0x0800('0xc')](function(_0x2179ad){return _0x2179ad[_0x0800('0xd')](']')>-0x1;})['map'](function(_0x367993){return _0x367993[_0x0800('0x7')](']')[0x0];})[0x0];_0x1e0156['conditions'][_0x0800('0xe')]({'field':_0x12e03a,'operator':_0x13b54a,'value':_0x5dc7c6});});});}return _0x1e0156;};exports['buildExpression']=function(_0x46d3a1,_0xea6834,_0xe3a3e){var _0x298dff={};if(_0xea6834===_0x0800('0xf')){if(_0xe3a3e[_0x0800('0x10')]===_0x0800('0x11')){_0xe3a3e[_0x0800('0x10')]=_0x0800('0x12');_0xe3a3e['value']+=','+_0xe3a3e[_0x0800('0x13')];}else if(_['includes']([_0x0800('0x14'),_0x0800('0x15')],_0xe3a3e['operator'])){_0xe3a3e['value']=moment(_0xe3a3e[_0x0800('0x13')])[_0x0800('0x16')](0x1,_0x0800('0x17'))[_0x0800('0x18')](_0x0800('0x19'));}}if(_0xe3a3e['castTo']){_0xea6834=_0xe3a3e[_0x0800('0x1a')];_0x298dff['text']='CAST('+_0x46d3a1+'.'+_0xe3a3e[_0x0800('0x1b')]+_0x0800('0x1c')+_0xe3a3e[_0x0800('0x1a')]+')\x20'+parseOperator(_0xe3a3e[_0x0800('0x10')]);}else{_0x298dff[_0x0800('0x1d')]=_0x46d3a1+'.'+_0xe3a3e[_0x0800('0x1b')]+'\x20'+parseOperator(_0xe3a3e[_0x0800('0x10')]);}if(_[_0x0800('0x1e')](['$ne',_0x0800('0x1f')],_0xe3a3e[_0x0800('0x10')]))_0x298dff[_0x0800('0x1d')]='('+_0x298dff[_0x0800('0x1d')]+'\x20OR\x20'+_0x46d3a1+'.'+_0xe3a3e['field']+_0x0800('0x20');_0x298dff['value']=parseValue(_0xea6834,_0xe3a3e['operator'],_0xe3a3e[_0x0800('0x13')]);return _0x298dff;};function parseOperator(_0x14353c){var _0x1a3903;switch(_0x14353c){case _0x0800('0x21'):_0x1a3903=_0x0800('0x22');break;case _0x0800('0x1f'):_0x1a3903=_0x0800('0x23');break;case _0x0800('0x11'):_0x1a3903=_0x0800('0x24');break;case'$ne':_0x1a3903=_0x0800('0x25');break;case'$substring':case _0x0800('0x26'):case _0x0800('0x27'):_0x1a3903='LIKE\x20?';break;case'$lt':_0x1a3903=_0x0800('0x28');break;case _0x0800('0x14'):_0x1a3903=_0x0800('0x29');break;case _0x0800('0x15'):_0x1a3903=_0x0800('0x2a');break;case _0x0800('0x2b'):_0x1a3903='>=\x20?';break;case _0x0800('0x12'):_0x1a3903=_0x0800('0x2c');break;}return _0x1a3903;}function parseValue(_0x210d13,_0x3c5276,_0x3b0c23){var _0x3f4f13={'start':undefined,'end':undefined};switch(_0x3c5276){case _0x0800('0x21'):case'$notIn':_0x3f4f13[_0x0800('0x2d')]=_0x3b0c23[_0x0800('0x7')](',');break;case _0x0800('0x2e'):_0x3f4f13[_0x0800('0x2d')]='%'+_0x3b0c23+'%';break;case _0x0800('0x26'):_0x3f4f13[_0x0800('0x2d')]=_0x3b0c23+'%';break;case _0x0800('0x27'):_0x3f4f13[_0x0800('0x2d')]='%'+_0x3b0c23;break;case _0x0800('0x12'):var _0x5e51b9=_0x3b0c23[_0x0800('0x7')](',');var _0x3b0c23=_0x5e51b9[_0x0800('0x2f')]();var _0x406870=_0x5e51b9['pop']();if(_0x210d13===_0x0800('0xf')){_0x3b0c23=moment(_0x3b0c23)['utcOffset'](0x0,!![])[_0x0800('0x18')]();_0x406870=moment(_0x406870)['utcOffset'](0x0,!![])[_0x0800('0x16')](0x17,_0x0800('0x30'))['add'](0x3b,_0x0800('0x31'))['add'](0x3b,_0x0800('0x32'))[_0x0800('0x18')]();}_0x3f4f13={'start':_0x3b0c23,'end':_0x406870};break;default:_0x3f4f13[_0x0800('0x2d')]=_0x3b0c23;break;}return _0x3f4f13;} \ No newline at end of file +var _0x3c5c=['includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','$between','start','$endsWith','utcOffset','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','DATE','operator','$eq','value'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0x3c5c,0xc6));var _0xc3c5=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x3c5c[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xc3c5('0x0'));var moment=require(_0xc3c5('0x1'));exports[_0xc3c5('0x2')]=function(_0x152d13){var _0x24e4b9={'conditions':[]};_0x24e4b9[_0xc3c5('0x3')]=_[_0xc3c5('0x4')](_0x152d13,_0xc3c5('0x5'))?'or':_0xc3c5('0x6');var _0x4d368f=_0x152d13['replace']('[$and]','')[_0xc3c5('0x7')](_0xc3c5('0x5'),'')[_0xc3c5('0x8')]('||');for(var _0x2d9d45=0x0;_0x2d9d45<_0x4d368f[_0xc3c5('0x9')];_0x2d9d45++){var _0x4ed9ea=_0x4d368f[_0x2d9d45][_0xc3c5('0x8')](':=');var _0xcbfe8b=_0x4ed9ea[0x0];var _0x4df6a2=_0x4ed9ea[_0xc3c5('0xa')](0x1);_0x4df6a2[_0xc3c5('0xb')](function(_0xce9a67){var _0x43265f=_0xce9a67[_0xc3c5('0x8')]('[')[_0xc3c5('0xc')]();var _0x1d9592=_0xce9a67[_0xc3c5('0xd')](/\[(.*?)\]/g);_0x1d9592[_0xc3c5('0xb')](function(_0x5c57ed){var _0x4ef9fb=_0x5c57ed[_0xc3c5('0x8')]('[')[_0xc3c5('0xe')](function(_0x25c641){return _0x25c641[_0xc3c5('0xf')](']')>-0x1;})['map'](function(_0x1893e9){return _0x1893e9['split'](']')[0x0];})[0x0];_0x24e4b9[_0xc3c5('0x10')][_0xc3c5('0x11')]({'field':_0xcbfe8b,'operator':_0x43265f,'value':_0x4ef9fb});});});}return _0x24e4b9;};exports['buildExpression']=function(_0x2954be,_0x4433d0,_0x3365f7){var _0x5db55d={};if(_0x4433d0===_0xc3c5('0x12')){if(_0x3365f7[_0xc3c5('0x13')]===_0xc3c5('0x14')){_0x3365f7[_0xc3c5('0x13')]='$between';_0x3365f7[_0xc3c5('0x15')]+=','+_0x3365f7[_0xc3c5('0x15')];}else if(_[_0xc3c5('0x16')]([_0xc3c5('0x17'),_0xc3c5('0x18')],_0x3365f7[_0xc3c5('0x13')])){_0x3365f7[_0xc3c5('0x15')]=moment(_0x3365f7[_0xc3c5('0x15')])[_0xc3c5('0x19')](0x1,_0xc3c5('0x1a'))[_0xc3c5('0x1b')](_0xc3c5('0x1c'));}}if(_0x3365f7[_0xc3c5('0x1d')]){_0x4433d0=_0x3365f7[_0xc3c5('0x1d')];_0x5db55d[_0xc3c5('0x1e')]=_0xc3c5('0x1f')+_0x2954be+'.'+_0x3365f7['field']+'\x20AS\x20'+_0x3365f7[_0xc3c5('0x1d')]+')\x20'+parseOperator(_0x3365f7[_0xc3c5('0x13')]);}else{_0x5db55d['text']=_0x2954be+'.'+_0x3365f7[_0xc3c5('0x20')]+'\x20'+parseOperator(_0x3365f7[_0xc3c5('0x13')]);}if(_['includes']([_0xc3c5('0x21'),_0xc3c5('0x22')],_0x3365f7[_0xc3c5('0x13')]))_0x5db55d[_0xc3c5('0x1e')]='('+_0x5db55d['text']+'\x20OR\x20'+_0x2954be+'.'+_0x3365f7[_0xc3c5('0x20')]+_0xc3c5('0x23');_0x5db55d[_0xc3c5('0x15')]=parseValue(_0x4433d0,_0x3365f7[_0xc3c5('0x13')],_0x3365f7[_0xc3c5('0x15')]);return _0x5db55d;};function parseOperator(_0xe476bc){var _0x11666a;switch(_0xe476bc){case _0xc3c5('0x24'):_0x11666a=_0xc3c5('0x25');break;case _0xc3c5('0x22'):_0x11666a=_0xc3c5('0x26');break;case'$eq':_0x11666a=_0xc3c5('0x27');break;case _0xc3c5('0x21'):_0x11666a=_0xc3c5('0x28');break;case _0xc3c5('0x29'):case _0xc3c5('0x2a'):case'$endsWith':_0x11666a=_0xc3c5('0x2b');break;case _0xc3c5('0x2c'):_0x11666a=_0xc3c5('0x2d');break;case _0xc3c5('0x17'):_0x11666a=_0xc3c5('0x2e');break;case _0xc3c5('0x18'):_0x11666a=_0xc3c5('0x2f');break;case'$gte':_0x11666a=_0xc3c5('0x30');break;case _0xc3c5('0x31'):_0x11666a='BETWEEN\x20?\x20AND\x20?';break;}return _0x11666a;}function parseValue(_0x5df3fa,_0x1e0855,_0x13e805){var _0x552db3={'start':undefined,'end':undefined};switch(_0x1e0855){case _0xc3c5('0x24'):case _0xc3c5('0x22'):_0x552db3[_0xc3c5('0x32')]=_0x13e805['split'](',');break;case _0xc3c5('0x29'):_0x552db3['start']='%'+_0x13e805+'%';break;case _0xc3c5('0x2a'):_0x552db3[_0xc3c5('0x32')]=_0x13e805+'%';break;case _0xc3c5('0x33'):_0x552db3[_0xc3c5('0x32')]='%'+_0x13e805;break;case _0xc3c5('0x31'):var _0x539f9e=_0x13e805[_0xc3c5('0x8')](',');var _0x13e805=_0x539f9e[_0xc3c5('0xc')]();var _0x9e8f95=_0x539f9e['pop']();if(_0x5df3fa==='DATE'){_0x13e805=moment(_0x13e805)[_0xc3c5('0x34')](0x0,!![])['format']();_0x9e8f95=moment(_0x9e8f95)[_0xc3c5('0x34')](0x0,!![])['add'](0x17,_0xc3c5('0x35'))[_0xc3c5('0x19')](0x3b,_0xc3c5('0x36'))[_0xc3c5('0x19')](0x3b,'seconds')['format']();}_0x552db3={'start':_0x13e805,'end':_0x9e8f95};break;default:_0x552db3['start']=_0x13e805;break;}return _0x552db3;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 3de2662..44bc5b9 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf296=['isArray','limit','sort','map','priority','cast','unsigned','substr','DESC','col','ASC','omit','length','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','replace','includes','join','lodash','sequelize','moment','fields','split','filters','isEmpty','find','type','DATE','parse','$gte','format','YYYY-MM-DD','$lte','subtract','name','uniqueid'];(function(_0x5e800d,_0x55539d){var _0xa98ae1=function(_0x46991b){while(--_0x46991b){_0x5e800d['push'](_0x5e800d['shift']());}};_0xa98ae1(++_0x55539d);}(_0xf296,0xff));var _0x6f29=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0xf296[_0x11ba46];return _0x1c8c6f;};'use strict';var _=require(_0x6f29('0x0'));var sequelize=require(_0x6f29('0x1'));var moment=require(_0x6f29('0x2'));var LIMIT_VALUE=0xfa;exports[_0x6f29('0x3')]=function(_0x5b7f98){var _0x27abe8=null;if(_0x5b7f98){_0x27abe8=_0x5b7f98[_0x6f29('0x4')](',');}return _0x27abe8;};exports[_0x6f29('0x5')]=function(_0x861170,_0x57bbe7){var _0xfc6152={};if(!_[_0x6f29('0x6')](_0x861170)){_['forOwn'](_0x861170,function(_0x2b48fd,_0x333199){try{if(_0x57bbe7){var _0x262460=_[_0x6f29('0x7')](_0x57bbe7,{'name':_0x333199})||{};if(_0x262460[_0x6f29('0x8')]===_0x6f29('0x9')&&_['isPlainObject'](_0x2b48fd)){var _0x36b496=JSON[_0x6f29('0xa')](_0x2b48fd);var _0x443e99={'$gte':moment(moment(_0x36b496[_0x6f29('0xb')])[_0x6f29('0xc')](_0x6f29('0xd')))['utc']()[_0x6f29('0xc')](),'$lte':moment(moment(_0x36b496[_0x6f29('0xe')])[_0x6f29('0xc')]('YYYY-MM-DD'))['utc']()[_0x6f29('0xf')](0x1,'s')[_0x6f29('0xc')]()};_0xfc6152[_0x333199]=_0x443e99;}else if(_0x262460[_0x6f29('0x10')]===_0x6f29('0x11')){_0xfc6152[_0x333199]=_0x2b48fd;}else{_0xfc6152[_0x333199]=_[_0x6f29('0x12')](_0x2b48fd)?_0x2b48fd:JSON['parse'](_0x2b48fd);}}else{_0xfc6152[_0x333199]=_[_0x6f29('0x12')](_0x2b48fd)?_0x2b48fd:JSON[_0x6f29('0xa')](_0x2b48fd);}}catch(_0x34b405){_0xfc6152[_0x333199]=_0x2b48fd[_0x6f29('0x4')](',');}});}return _0xfc6152;};exports[_0x6f29('0x13')]=function(_0x3a58a1){_0x3a58a1=parseInt(_0x3a58a1,0xa);if(!_0x3a58a1||_0x3a58a1<0x0){_0x3a58a1=LIMIT_VALUE;}return _0x3a58a1;};exports['offset']=function(_0x370e6b){_0x370e6b=parseInt(_0x370e6b,0xa);if(!_0x370e6b||_0x370e6b<0x0){_0x370e6b=0x0;}return _0x370e6b;};exports[_0x6f29('0x14')]=function(_0x285be1){var _0x809884,_0x3fabad=null;if(_0x285be1){_0x809884=_0x285be1['split'](',');_0x3fabad=_[_0x6f29('0x15')](_0x809884,function(_0x22dd41){if(_0x22dd41['indexOf']('-')===0x0){return[_0x22dd41===_0x6f29('0x16')?sequelize[_0x6f29('0x17')](sequelize['col'](_0x6f29('0x16')),_0x6f29('0x18')):_0x22dd41[_0x6f29('0x19')](0x1),_0x6f29('0x1a')];}else{return[_0x22dd41==='priority'?sequelize[_0x6f29('0x17')](sequelize[_0x6f29('0x1b')](_0x6f29('0x16')),'unsigned'):_0x22dd41,_0x6f29('0x1c')];}});}return _0x3fabad;};exports[_0x6f29('0x1d')]=function(_0x160187,_0x379e17){if(_[_0x6f29('0x6')](_0x160187)){return _0x160187;}if(_[_0x6f29('0x12')](_0x160187)){for(var _0x339649=0x0;_0x339649<_0x160187[_0x6f29('0x1e')];_0x339649+=0x1){_0x160187[_0x339649]=this[_0x6f29('0x1d')](_0x160187[_0x339649],_0x379e17);}return _0x160187;}if(!_['isObject'](_0x160187)){return _0x160187;}if(_['isString'](_0x379e17)){_0x379e17=[_0x379e17];}if(!_['isArray'](_0x379e17)){return _0x160187;}for(var _0x3d3340=0x0;_0x3d3340<_0x379e17['length'];_0x3d3340+=0x1){_[_0x6f29('0x1f')](_0x160187,_0x379e17[_0x3d3340]);}for(var _0x25ab56 in _0x160187){if(_0x160187[_0x6f29('0x20')](_0x25ab56)){_0x160187[_0x25ab56]=this[_0x6f29('0x1d')](_0x160187[_0x25ab56],_0x379e17);}}return _0x160187;};exports['isNumeric']=function(_0x30b0b1){return _0x30b0b1[_0x6f29('0x21')](RegExp(_0x6f29('0x22')))?!![]:![];};exports['isEmail']=function(_0x2af90e){return _0x2af90e['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x6f29('0x23')]=function(_0x512f93){var _0x31fd21=[];_0x512f93['split'](/[ ,]+/)['forEach'](function(_0x35d66d){_0x35d66d=_0x35d66d[_0x6f29('0x24')](/([^:]")"+/g,'$1');_0x35d66d='+'+_0x35d66d+'*';if(_0x35d66d[_0x6f29('0x25')]('@'))_0x35d66d='\x22'+_0x35d66d+'\x22';_0x31fd21['push'](_0x35d66d);});return _0x31fd21[_0x6f29('0x26')]('\x20');}; \ No newline at end of file +var _0x5e0e=['forEach','replace','includes','push','join','lodash','sequelize','moment','fields','split','filters','forOwn','find','type','DATE','parse','$gte','format','$lte','YYYY-MM-DD','utc','subtract','name','isArray','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','isEmpty','omit','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','getFullTextValue'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5e0e,0x1de));var _0xe5e0=function(_0x5be8ab,_0x4000a6){_0x5be8ab=_0x5be8ab-0x0;var _0x35914d=_0x5e0e[_0x5be8ab];return _0x35914d;};'use strict';var _=require(_0xe5e0('0x0'));var sequelize=require(_0xe5e0('0x1'));var moment=require(_0xe5e0('0x2'));var LIMIT_VALUE=0xfa;exports[_0xe5e0('0x3')]=function(_0xe9e238){var _0x128e03=null;if(_0xe9e238){_0x128e03=_0xe9e238[_0xe5e0('0x4')](',');}return _0x128e03;};exports[_0xe5e0('0x5')]=function(_0xc0a595,_0x6fae4e){var _0x145200={};if(!_['isEmpty'](_0xc0a595)){_[_0xe5e0('0x6')](_0xc0a595,function(_0xcfc997,_0x3a605c){try{if(_0x6fae4e){var _0x1f4d56=_[_0xe5e0('0x7')](_0x6fae4e,{'name':_0x3a605c})||{};if(_0x1f4d56[_0xe5e0('0x8')]===_0xe5e0('0x9')&&_['isPlainObject'](_0xcfc997)){var _0x20072b=JSON[_0xe5e0('0xa')](_0xcfc997);var _0x475f69={'$gte':moment(moment(_0x20072b[_0xe5e0('0xb')])[_0xe5e0('0xc')]('YYYY-MM-DD'))['utc']()[_0xe5e0('0xc')](),'$lte':moment(moment(_0x20072b[_0xe5e0('0xd')])[_0xe5e0('0xc')](_0xe5e0('0xe')))[_0xe5e0('0xf')]()[_0xe5e0('0x10')](0x1,'s')[_0xe5e0('0xc')]()};_0x145200[_0x3a605c]=_0x475f69;}else if(_0x1f4d56[_0xe5e0('0x11')]==='uniqueid'){_0x145200[_0x3a605c]=_0xcfc997;}else{_0x145200[_0x3a605c]=_[_0xe5e0('0x12')](_0xcfc997)?_0xcfc997:JSON[_0xe5e0('0xa')](_0xcfc997);}}else{_0x145200[_0x3a605c]=_['isArray'](_0xcfc997)?_0xcfc997:JSON[_0xe5e0('0xa')](_0xcfc997);}}catch(_0x4b6e4c){_0x145200[_0x3a605c]=_0xcfc997[_0xe5e0('0x4')](',');}});}return _0x145200;};exports['limit']=function(_0x4508d9){_0x4508d9=parseInt(_0x4508d9,0xa);if(!_0x4508d9||_0x4508d9<0x0){_0x4508d9=LIMIT_VALUE;}return _0x4508d9;};exports[_0xe5e0('0x13')]=function(_0x3da33b){_0x3da33b=parseInt(_0x3da33b,0xa);if(!_0x3da33b||_0x3da33b<0x0){_0x3da33b=0x0;}return _0x3da33b;};exports[_0xe5e0('0x14')]=function(_0x478df4){var _0x2704fc,_0x3e95fb=null;if(_0x478df4){_0x2704fc=_0x478df4[_0xe5e0('0x4')](',');_0x3e95fb=_[_0xe5e0('0x15')](_0x2704fc,function(_0x592bbf){if(_0x592bbf[_0xe5e0('0x16')]('-')===0x0){return[_0x592bbf===_0xe5e0('0x17')?sequelize[_0xe5e0('0x18')](sequelize[_0xe5e0('0x19')](_0xe5e0('0x17')),_0xe5e0('0x1a')):_0x592bbf[_0xe5e0('0x1b')](0x1),_0xe5e0('0x1c')];}else{return[_0x592bbf==='priority'?sequelize[_0xe5e0('0x18')](sequelize[_0xe5e0('0x19')](_0xe5e0('0x17')),_0xe5e0('0x1a')):_0x592bbf,'ASC'];}});}return _0x3e95fb;};exports['omit']=function(_0x5dabe3,_0x48e734){if(_[_0xe5e0('0x1d')](_0x5dabe3)){return _0x5dabe3;}if(_[_0xe5e0('0x12')](_0x5dabe3)){for(var _0x1c8537=0x0;_0x1c8537<_0x5dabe3['length'];_0x1c8537+=0x1){_0x5dabe3[_0x1c8537]=this[_0xe5e0('0x1e')](_0x5dabe3[_0x1c8537],_0x48e734);}return _0x5dabe3;}if(!_[_0xe5e0('0x1f')](_0x5dabe3)){return _0x5dabe3;}if(_[_0xe5e0('0x20')](_0x48e734)){_0x48e734=[_0x48e734];}if(!_[_0xe5e0('0x12')](_0x48e734)){return _0x5dabe3;}for(var _0x3e5f8e=0x0;_0x3e5f8e<_0x48e734['length'];_0x3e5f8e+=0x1){_[_0xe5e0('0x21')](_0x5dabe3,_0x48e734[_0x3e5f8e]);}for(var _0x246521 in _0x5dabe3){if(_0x5dabe3[_0xe5e0('0x22')](_0x246521)){_0x5dabe3[_0x246521]=this[_0xe5e0('0x1e')](_0x5dabe3[_0x246521],_0x48e734);}}return _0x5dabe3;};exports['isNumeric']=function(_0x49dbda){return _0x49dbda['match'](RegExp(_0xe5e0('0x23')))?!![]:![];};exports[_0xe5e0('0x24')]=function(_0x3b820d){return _0x3b820d['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xe5e0('0x25')]=function(_0x12c15a){var _0x4d6629=[];_0x12c15a[_0xe5e0('0x4')](/[ ,]+/)[_0xe5e0('0x26')](function(_0x15ddf1){_0x15ddf1=_0x15ddf1[_0xe5e0('0x27')](/([^:]")"+/g,'$1');_0x15ddf1='+'+_0x15ddf1+'*';if(_0x15ddf1[_0xe5e0('0x28')]('@'))_0x15ddf1='\x22'+_0x15ddf1+'\x22';_0x4d6629[_0xe5e0('0x29')](_0x15ddf1);});return _0x4d6629[_0xe5e0('0x2a')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 53b8975..0c7462b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82a2=['cors','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','public','client','use','json\x20replacer','split','static','views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize','body-parser','method-override','cookie-parser','path','passport'];(function(_0xd37615,_0x4c9887){var _0x4d641d=function(_0x15d3d2){while(--_0x15d3d2){_0xd37615['push'](_0xd37615['shift']());}};_0x4d641d(++_0x4c9887);}(_0x82a2,0xd4));var _0x282a=function(_0x59529f,_0x4efdef){_0x59529f=_0x59529f-0x0;var _0x23c992=_0x82a2[_0x59529f];return _0x23c992;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x282a('0x0'));var methodOverride=require(_0x282a('0x1'));var cookieParser=require(_0x282a('0x2'));var errorHandler=require('errorhandler');var path=require(_0x282a('0x3'));var passport=require(_0x282a('0x4'));var cors=require(_0x282a('0x5'));var moment=require('moment');var config=require(_0x282a('0x6'));var db=require(_0x282a('0x7'))['db'];exports[_0x282a('0x8')]=function(_0x410f52){var _0x1843df=_0x410f52[_0x282a('0x9')](_0x282a('0xa'));if(_0x1843df===_0x282a('0xb')){_0x410f52[_0x282a('0xc')](_0x282a('0xd'),path[_0x282a('0xe')](config[_0x282a('0xf')],_0x282a('0x10')));}if(_0x1843df==='development'||_0x1843df==='test'){_0x410f52[_0x282a('0xc')](_0x282a('0xd'),path[_0x282a('0xe')](config[_0x282a('0xf')],_0x282a('0x11')));_0x410f52[_0x282a('0x12')](errorHandler());}_0x410f52[_0x282a('0xc')](_0x282a('0x13'),function(_0x174d01,_0xd96827){if(this[_0x174d01]instanceof Date){_0xd96827=this[_0x174d01]['toISOString']()[_0x282a('0x14')]('.')[0x0]+'Z';}return _0xd96827;});_0x410f52[_0x282a('0x12')](express[_0x282a('0x15')](_0x410f52[_0x282a('0x9')](_0x282a('0xd'))));_0x410f52['set'](_0x282a('0x16'),config[_0x282a('0xf')]+'/server/views');_0x410f52[_0x282a('0x17')](_0x282a('0x18'),require(_0x282a('0x19'))[_0x282a('0x1a')]);_0x410f52['set'](_0x282a('0x1b'),_0x282a('0x18'));_0x410f52['use'](bodyParser[_0x282a('0x1c')]({'limit':_0x282a('0x1d'),'extended':!![]}));_0x410f52[_0x282a('0x12')](bodyParser['json']({'limit':_0x282a('0x1d')}));_0x410f52['use'](cors());_0x410f52[_0x282a('0x12')](methodOverride());_0x410f52[_0x282a('0x12')](cookieParser());_0x410f52['use'](passport[_0x282a('0x1e')]());}; \ No newline at end of file +var _0x07aa=['view\x20engine','html','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','./environment','../mysqldb','default','get','env','production','set','appPath','root','development','test','join','client','use','json\x20replacer','toISOString','split','static','views','/server/views','engine','ejs','renderFile'];(function(_0x1db153,_0x1ab5d){var _0x530cbe=function(_0x4115f7){while(--_0x4115f7){_0x1db153['push'](_0x1db153['shift']());}};_0x530cbe(++_0x1ab5d);}(_0x07aa,0xb9));var _0xa07a=function(_0x438eed,_0x31d240){_0x438eed=_0x438eed-0x0;var _0x212ec4=_0x07aa[_0x438eed];return _0x212ec4;};'use strict';var express=require(_0xa07a('0x0'));var favicon=require(_0xa07a('0x1'));var bodyParser=require(_0xa07a('0x2'));var methodOverride=require(_0xa07a('0x3'));var cookieParser=require(_0xa07a('0x4'));var errorHandler=require(_0xa07a('0x5'));var path=require(_0xa07a('0x6'));var passport=require(_0xa07a('0x7'));var cors=require('cors');var moment=require('moment');var config=require(_0xa07a('0x8'));var db=require(_0xa07a('0x9'))['db'];exports[_0xa07a('0xa')]=function(_0x485539){var _0x37dd4a=_0x485539[_0xa07a('0xb')](_0xa07a('0xc'));if(_0x37dd4a===_0xa07a('0xd')){_0x485539[_0xa07a('0xe')](_0xa07a('0xf'),path['join'](config[_0xa07a('0x10')],'public'));}if(_0x37dd4a===_0xa07a('0x11')||_0x37dd4a===_0xa07a('0x12')){_0x485539[_0xa07a('0xe')](_0xa07a('0xf'),path[_0xa07a('0x13')](config[_0xa07a('0x10')],_0xa07a('0x14')));_0x485539[_0xa07a('0x15')](errorHandler());}_0x485539['set'](_0xa07a('0x16'),function(_0x5b293c,_0x674210){if(this[_0x5b293c]instanceof Date){_0x674210=this[_0x5b293c][_0xa07a('0x17')]()[_0xa07a('0x18')]('.')[0x0]+'Z';}return _0x674210;});_0x485539[_0xa07a('0x15')](express[_0xa07a('0x19')](_0x485539['get'](_0xa07a('0xf'))));_0x485539[_0xa07a('0xe')](_0xa07a('0x1a'),config['root']+_0xa07a('0x1b'));_0x485539[_0xa07a('0x1c')]('html',require(_0xa07a('0x1d'))[_0xa07a('0x1e')]);_0x485539[_0xa07a('0xe')](_0xa07a('0x1f'),_0xa07a('0x20'));_0x485539[_0xa07a('0x15')](bodyParser[_0xa07a('0x21')]({'limit':_0xa07a('0x22'),'extended':!![]}));_0x485539[_0xa07a('0x15')](bodyParser[_0xa07a('0x23')]({'limit':'50mb'}));_0x485539[_0xa07a('0x15')](cors());_0x485539[_0xa07a('0x15')](methodOverride());_0x485539[_0xa07a('0x15')](cookieParser());_0x485539[_0xa07a('0x15')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 08bd11d..fe6007d 100644 --- a/server/config/license/hardware.js +++ b/server/config/license/hardware.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c2f=['address','getFirstInterface','cpus','map','model','join','md5','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','createHash','update','substring','child_process','networkInterfaces','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00'];(function(_0x41e2cf,_0x5b18e6){var _0x348c99=function(_0xe7ea6e){while(--_0xe7ea6e){_0x41e2cf['push'](_0x41e2cf['shift']());}};_0x348c99(++_0x5b18e6);}(_0x8c2f,0xdc));var _0xf8c2=function(_0x17b287,_0x4bed1c){_0x17b287=_0x17b287-0x0;var _0x177054=_0x8c2f[_0x17b287];return _0x177054;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xf8c2('0x0'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x16b0c9=[];var _0x4bf6d7=os[_0xf8c2('0x1')]();var _0xa021f8=_[_0xf8c2('0x2')](_['keys'](_0x4bf6d7));for(var _0x3c186a=0x0;_0x3c186a<_0xa021f8['length'];_0x3c186a++){var _0x27589d=_0x4bf6d7[_0xa021f8[_0x3c186a]][_0xf8c2('0x3')](function(_0x16ccf7){return _0x16ccf7[_0xf8c2('0x4')]===_0xf8c2('0x5')&&_0x16ccf7[_0xf8c2('0x6')]===![];});_0x16b0c9=_0x16b0c9[_0xf8c2('0x7')](_0x27589d);}return _0x16b0c9;}function getFirstInterface(){var _0xdbcfdc=_[_0xf8c2('0x8')](getInterfaces());return{'macAddress':_0xdbcfdc&&_0xdbcfdc[_0xf8c2('0x9')]?_0xdbcfdc[_0xf8c2('0x9')]:_0xf8c2('0xa'),'ipAddress':_0xdbcfdc&&_0xdbcfdc[_0xf8c2('0xb')]?_0xdbcfdc[_0xf8c2('0xb')]:'127.0.0.1'};}exports[_0xf8c2('0xc')]=getFirstInterface;function getCPUhash(){var _0x5978bf=_[_0xf8c2('0x2')](os[_0xf8c2('0xd')]()[_0xf8c2('0xe')](function(_0x4be6bb){return _0x4be6bb[_0xf8c2('0xf')];}))[_0xf8c2('0x10')](':');return crypto['createHash'](_0xf8c2('0x11'))['update'](_0x5978bf)[_0xf8c2('0x12')](_0xf8c2('0x13'));}exports[_0xf8c2('0x14')]=function(){var _0x27c243=os[_0xf8c2('0x15')]();var _0x39e1f1=/[0-9a-f-]{36}/;if(config[_0xf8c2('0x16')]&&_0x39e1f1[_0xf8c2('0x17')](config[_0xf8c2('0x16')])){return config[_0xf8c2('0x16')];}else if(_0x27c243===_0xf8c2('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xf8c2('0x19')})[_0xf8c2('0x1a')]('\x0d\x0a','');}else{var _0x2b65ab=getFirstInterface();var _0x19197a=getCPUhash();var _0x33fee9=_0x19197a+'|'+os[_0xf8c2('0x1b')]()+'|'+_0x2b65ab[_0xf8c2('0x1c')]+'|'+_0x2b65ab[_0xf8c2('0x1d')];var _0x536149=crypto[_0xf8c2('0x1e')](_0xf8c2('0x11'))[_0xf8c2('0x1f')](_0x33fee9)[_0xf8c2('0x12')]('hex');return _0x536149[_0xf8c2('0x20')](0x0,0x8)+'-'+_0x536149['substring'](0x8,0xc)+'-'+_0x536149[_0xf8c2('0x20')](0xc,0x10)+'-'+_0x536149[_0xf8c2('0x20')](0x10,0x14)+'-'+_0x536149[_0xf8c2('0x20')](0x14);}}; \ No newline at end of file +var _0x21ce=['orderBy','cpus','map','model','createHash','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','substring','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface'];(function(_0x13d53f,_0x5d91ce){var _0x8040f9=function(_0x2a594c){while(--_0x2a594c){_0x13d53f['push'](_0x13d53f['shift']());}};_0x8040f9(++_0x5d91ce);}(_0x21ce,0x196));var _0xe21c=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x21ce[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0xe21c('0x0'));var exec=require('child_process')[_0xe21c('0x1')];var config=require(_0xe21c('0x2'));function getInterfaces(){var _0x354a4c=[];var _0x318e39=os[_0xe21c('0x3')]();var _0x1fb8d9=_['orderBy'](_[_0xe21c('0x4')](_0x318e39));for(var _0xf9d302=0x0;_0xf9d302<_0x1fb8d9['length'];_0xf9d302++){var _0x199819=_0x318e39[_0x1fb8d9[_0xf9d302]][_0xe21c('0x5')](function(_0x547e33){return _0x547e33[_0xe21c('0x6')]===_0xe21c('0x7')&&_0x547e33['internal']===![];});_0x354a4c=_0x354a4c[_0xe21c('0x8')](_0x199819);}return _0x354a4c;}function getFirstInterface(){var _0x1c115a=_['head'](getInterfaces());return{'macAddress':_0x1c115a&&_0x1c115a['mac']?_0x1c115a[_0xe21c('0x9')]:_0xe21c('0xa'),'ipAddress':_0x1c115a&&_0x1c115a['address']?_0x1c115a[_0xe21c('0xb')]:_0xe21c('0xc')};}exports[_0xe21c('0xd')]=getFirstInterface;function getCPUhash(){var _0x34feb9=_[_0xe21c('0xe')](os[_0xe21c('0xf')]()[_0xe21c('0x10')](function(_0x36aca7){return _0x36aca7[_0xe21c('0x11')];}))['join'](':');return crypto[_0xe21c('0x12')]('md5')[_0xe21c('0x13')](_0x34feb9)[_0xe21c('0x14')](_0xe21c('0x15'));}exports[_0xe21c('0x16')]=function(){var _0x579763=os[_0xe21c('0x17')]();var _0x453146=/[0-9a-f-]{36}/;if(config[_0xe21c('0x18')]&&_0x453146[_0xe21c('0x19')](config[_0xe21c('0x18')])){return config['licenseToken'];}else if(_0x579763===_0xe21c('0x1a')){return exec(_0xe21c('0x1b'),{'encoding':_0xe21c('0x1c')})[_0xe21c('0x1d')]('\x0d\x0a','');}else{var _0xd02d02=getFirstInterface();var _0xea5678=getCPUhash();var _0x4e7fe3=_0xea5678+'|'+os[_0xe21c('0x1e')]()+'|'+_0xd02d02[_0xe21c('0x1f')]+'|'+_0xd02d02[_0xe21c('0x20')];var _0x32041c=crypto['createHash'](_0xe21c('0x21'))[_0xe21c('0x13')](_0x4e7fe3)[_0xe21c('0x14')]('hex');return _0x32041c[_0xe21c('0x22')](0x0,0x8)+'-'+_0x32041c[_0xe21c('0x22')](0x8,0xc)+'-'+_0x32041c['substring'](0xc,0x10)+'-'+_0x32041c[_0xe21c('0x22')](0x10,0x14)+'-'+_0x32041c[_0xe21c('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index fb7e9f5..e06eb43 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0630=['util','moment','request-promise','pkginfo','version','../../components/encryptor','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x0630,0x138));var _0x0063=function(_0x1e8f1f,_0x350974){_0x1e8f1f=_0x1e8f1f-0x0;var _0x2c271c=_0x0630[_0x1e8f1f];return _0x2c271c;};'use strict';var util=require(_0x0063('0x0'));var moment=require(_0x0063('0x1'));var rp=require(_0x0063('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x0063('0x3'))(module,_0x0063('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x0063('0x5'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST=_0x0063('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1ac962){return new BPromise(function(_0x38020a,_0x61f091){var _0x84e0dd=util[_0x0063('0x7')](_0x0063('0x8'),HOST,_0x1ac962,module[_0x0063('0x9')]['version']);if(oldToken){_0x84e0dd=util[_0x0063('0x7')](_0x0063('0xa'),HOST,_0x1ac962,module[_0x0063('0x9')]['version'],oldToken);}var _0xfba4dd={'uri':_0x84e0dd,'method':_0x0063('0xb'),'timeout':0xea60,'json':!![]};return rp(_0xfba4dd)[_0x0063('0xc')](function(_0x369a34){_0x38020a(_0x369a34);})[_0x0063('0xd')](function(_0x213d3c){_0x61f091(_0x213d3c);});});}function manageLicense(_0x492cf7,_0x5f37ad){var _0x2f6f1d=_0x5f37ad[_0x0063('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x2f6f1d[_0x0063('0xf')]!==_0x492cf7&&!_0x2f6f1d['data2']){oldToken=_0x2f6f1d[_0x0063('0xf')];}httpRequest(_0x492cf7)[_0x0063('0xc')](function(_0x26cb0c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x26cb0c['active']){isOldTokenSent=![];if(!_0x2f6f1d[_0x0063('0x10')]&&_0x2f6f1d[_0x0063('0x10')]!=_0x26cb0c[_0x0063('0x10')]||_0x2f6f1d[_0x0063('0x10')]&&_0x2f6f1d[_0x0063('0x11')]){logger[_0x0063('0x12')](_0x0063('0x13'));}if(_0x2f6f1d[_0x0063('0x10')]&&!_0x2f6f1d[_0x0063('0x11')]&&_0x2f6f1d['license']!=_0x26cb0c[_0x0063('0x10')]){logger[_0x0063('0x12')](_0x0063('0x14'));}if(_0x2f6f1d[_0x0063('0x10')]&&!_0x2f6f1d[_0x0063('0x11')]&&_0x2f6f1d[_0x0063('0x10')]==_0x26cb0c[_0x0063('0x10')]){return _0x5f37ad;}return _0x5f37ad[_0x0063('0x15')]({'data1':_0x492cf7,'data2':null,'license':_0x26cb0c['license']});}else{if(_0x26cb0c[_0x0063('0x10')]||_0x2f6f1d['license']){if(!_0x2f6f1d[_0x0063('0x11')]){if(_0x2f6f1d[_0x0063('0xf')]==_0x492cf7){GRAY_PERIOD_REASON=_0x0063('0x16');logger[_0x0063('0x12')](_0x0063('0x17'));}else{GRAY_PERIOD_REASON=_0x0063('0x18');logger[_0x0063('0x12')](_0x0063('0x19'),_0x2f6f1d[_0x0063('0xf')],_0x492cf7);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x0063('0x1a')](),moment()[_0x0063('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x5f37ad[_0x0063('0x15')]({'data2':encryptor[_0x0063('0x1b')](moment()['format'](_0x0063('0x1c')))});}else{if(moment()[_0x0063('0x1d')](encryptor[_0x0063('0x1e')](_0x2f6f1d[_0x0063('0x11')]),'days')>DAYS){logger[_0x0063('0x12')](_0x0063('0x1f'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5f37ad[_0x0063('0x15')]({'data1':_0x492cf7,'data2':null,'license':null});}}}else{if(_0x2f6f1d[_0x0063('0xf')]!=_0x492cf7){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2f6f1d[_0x0063('0xf')],_0x492cf7);return _0x5f37ad[_0x0063('0x15')]({'data1':_0x492cf7,'data2':null,'license':null});}}}return _0x5f37ad;})['then'](function(_0x266367){_0x5f37ad=_0x266367;})[_0x0063('0xd')](function(_0x428718){logger[_0x0063('0x20')](_0x428718[_0x0063('0x21')]);})[_0x0063('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5f37ad);},TIME);});}function defaultLicense(){var _0xb5f64=hardware[_0x0063('0x23')]();if(_0xb5f64){return db['License'][_0x0063('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xb5f64}})[_0x0063('0x25')](function(_0x5715a9,_0x19743a){logger[_0x0063('0x12')](_0x0063('0x26'),_0xb5f64);manageLicense(_0xb5f64,_0x5715a9);})[_0x0063('0xd')](function(_0x259d1f){logger['error'](_0x259d1f[_0x0063('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x217a=['findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','bluebird','version','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data1','then','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','getUuid','License'];(function(_0x213267,_0xf89d72){var _0x5a7684=function(_0x4046db){while(--_0x4046db){_0x213267['push'](_0x213267['shift']());}};_0x5a7684(++_0xf89d72);}(_0x217a,0x1e4));var _0xa217=function(_0x2cfb02,_0x4fd9c4){_0x2cfb02=_0x2cfb02-0x0;var _0x235d97=_0x217a[_0x2cfb02];return _0x235d97;};'use strict';var util=require(_0xa217('0x0'));var moment=require(_0xa217('0x1'));var rp=require('request-promise');var BPromise=require(_0xa217('0x2'));var pkginfo=require('pkginfo')(module,_0xa217('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xa217('0x4'));var logger=require(_0xa217('0x5'))(_0xa217('0x6'));var HOST=_0xa217('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3fbb32){return new BPromise(function(_0x2e199d,_0x5ac97c){var _0x319d7f=util[_0xa217('0x8')](_0xa217('0x9'),HOST,_0x3fbb32,module[_0xa217('0xa')][_0xa217('0x3')]);if(oldToken){_0x319d7f=util[_0xa217('0x8')](_0xa217('0xb'),HOST,_0x3fbb32,module[_0xa217('0xa')][_0xa217('0x3')],oldToken);}var _0x250819={'uri':_0x319d7f,'method':_0xa217('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x250819)['then'](function(_0x297437){_0x2e199d(_0x297437);})[_0xa217('0xd')](function(_0x4077c6){_0x5ac97c(_0x4077c6);});});}function manageLicense(_0x39877e,_0x17c301){var _0x42bef4=_0x17c301['get']({'plain':!![]});if(!isOldTokenSent&&_0x42bef4[_0xa217('0xe')]!==_0x39877e&&!_0x42bef4['data2']){oldToken=_0x42bef4['data1'];}httpRequest(_0x39877e)[_0xa217('0xf')](function(_0x587801){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x587801['active']){isOldTokenSent=![];if(!_0x42bef4[_0xa217('0x6')]&&_0x42bef4['license']!=_0x587801['license']||_0x42bef4[_0xa217('0x6')]&&_0x42bef4[_0xa217('0x10')]){logger[_0xa217('0x11')](_0xa217('0x12'));}if(_0x42bef4[_0xa217('0x6')]&&!_0x42bef4[_0xa217('0x10')]&&_0x42bef4[_0xa217('0x6')]!=_0x587801[_0xa217('0x6')]){logger[_0xa217('0x11')](_0xa217('0x13'));}if(_0x42bef4['license']&&!_0x42bef4[_0xa217('0x10')]&&_0x42bef4[_0xa217('0x6')]==_0x587801[_0xa217('0x6')]){return _0x17c301;}return _0x17c301[_0xa217('0x14')]({'data1':_0x39877e,'data2':null,'license':_0x587801['license']});}else{if(_0x587801['license']||_0x42bef4[_0xa217('0x6')]){if(!_0x42bef4['data2']){if(_0x42bef4[_0xa217('0xe')]==_0x39877e){GRAY_PERIOD_REASON=_0xa217('0x15');logger['info'](_0xa217('0x16'));}else{GRAY_PERIOD_REASON=_0xa217('0x17');logger[_0xa217('0x11')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x42bef4[_0xa217('0xe')],_0x39877e);}logger[_0xa217('0x11')](_0xa217('0x18'),GRAY_PERIOD_REASON[_0xa217('0x19')](),moment()[_0xa217('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x17c301[_0xa217('0x14')]({'data2':encryptor[_0xa217('0x1a')](moment()[_0xa217('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xa217('0x1b')](encryptor[_0xa217('0x1c')](_0x42bef4[_0xa217('0x10')]),_0xa217('0x1d'))>DAYS){logger[_0xa217('0x11')](_0xa217('0x1e'),moment()['format'](_0xa217('0x1f')));isOldTokenSent=![];return _0x17c301['update']({'data1':_0x39877e,'data2':null,'license':null});}}}else{if(_0x42bef4[_0xa217('0xe')]!=_0x39877e){logger[_0xa217('0x11')](_0xa217('0x20'),_0x42bef4[_0xa217('0xe')],_0x39877e);return _0x17c301['update']({'data1':_0x39877e,'data2':null,'license':null});}}}return _0x17c301;})['then'](function(_0x3d8ada){_0x17c301=_0x3d8ada;})[_0xa217('0xd')](function(_0x379ad3){logger['error'](_0x379ad3[_0xa217('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xa217('0x22')](),_0x17c301);},TIME);});}function defaultLicense(){var _0x29799=hardware[_0xa217('0x22')]();if(_0x29799){return db[_0xa217('0x23')][_0xa217('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x29799}})['spread'](function(_0x5cf036,_0x2499f5){logger[_0xa217('0x11')](_0xa217('0x25'),_0x29799);manageLicense(_0x29799,_0x5cf036);})[_0xa217('0xd')](function(_0xa39865){logger[_0xa217('0x26')](_0xa39865[_0xa217('0x21')]);});}}exports[_0xa217('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a4d8470..605005d 100644 --- a/server/config/license/util.js +++ b/server/config/license/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e72=['../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','parse','demo','gray','days','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','catch','pick','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','./hardware'];(function(_0x19dcc2,_0x41b678){var _0xbdd7dc=function(_0x4a9e6a){while(--_0x4a9e6a){_0x19dcc2['push'](_0x19dcc2['shift']());}};_0xbdd7dc(++_0x41b678);}(_0x6e72,0xac));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x26e7('0x0'));var _=require(_0x26e7('0x1'));var moment=require(_0x26e7('0x2'));var BPromise=require('bluebird');var hardware=require(_0x26e7('0x3'));var encryptor=require(_0x26e7('0x4'));var db=require(_0x26e7('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x26e7('0x6'),'machineUuid':hardware[_0x26e7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x26e7('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x26e7('0x9'),'machineUuid':hardware[_0x26e7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x399fc8){return new BPromise(function(_0x552d23,_0x2d483d){return db[_0x26e7('0xa')]['find'](_[_0x26e7('0xb')](_0x399fc8,{'raw':!![],'where':{'id':0x1}}))[_0x26e7('0xc')](function(_0x16c22a){return checkLicense(_0x16c22a,null);})[_0x26e7('0xc')](function(_0x40fa8b){_0x552d23(_0x40fa8b);return;})['catch'](function(_0x37e158){_0x2d483d(_0x37e158);});});}function checkLicense(_0x2653d2,_0xad54fd){if(!_0x2653d2){demoLicense[_0x26e7('0xd')]=_0x2653d2[_0x26e7('0xe')];return demoLicense;}try{var _0x9e5b1b=_0xad54fd||_0x2653d2[_0x26e7('0xf')];if(_[_0x26e7('0x10')](_0x9e5b1b)){throw new Error(_0x26e7('0x11'));}var _0x5dc0a2=_0x2653d2[_0x26e7('0xe')];var _0xef191f=_0x2653d2[_0x26e7('0x12')];var _0x3f8f43=_0x5dc0a2[_0x26e7('0x13')]('-')[0x4];var _0x1aa820=_0x5dc0a2[_0x26e7('0x13')]('-')[0x0];var _0x4261a2=encryptor['decryptString'](_0x9e5b1b,util[_0x26e7('0x14')]('%s:%s:%s',_0x3f8f43,_0x5dc0a2,_0x1aa820));var _0x271499=JSON[_0x26e7('0x15')](_0x4261a2);_0x271499[_0x26e7('0x16')]=![];_0x271499['uuid']=_0x5dc0a2;_0x271499['machineUuid']=hardware['getUuid']();if(_0xef191f){var _0x2877d6=encryptor['decryptString'](_0xef191f);_0x271499[_0x26e7('0x17')]=_0x2877d6;_0x271499['deadline']=moment(_0x2877d6)['add'](0x7,_0x26e7('0x18'))[_0x26e7('0x14')]();_0x271499['grayReason']=_0x271499[_0x26e7('0xd')]!=_0x271499[_0x26e7('0x19')]?_0x26e7('0x1a'):_0x26e7('0x1b');}return _0x271499;}catch(_0x44ec24){breakingLicense[_0x26e7('0xd')]=_0x2653d2['data1'];breakingLicense['message']=_0x44ec24[_0x26e7('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x468756,_0xd41779){getLicense()[_0x26e7('0xc')](function(_0x346bdf){return db[_0x26e7('0x1d')][_0x26e7('0x1e')]({'attributes':[_0x26e7('0x1f'),[db[_0x26e7('0x20')]['fn'](_0x26e7('0x21'),db[_0x26e7('0x20')][_0x26e7('0x22')](_0x26e7('0x1f'))),_0x26e7('0x23')]],'group':_0x26e7('0x1f'),'where':{'role':{'$or':[_0x26e7('0x24'),_0x26e7('0x25'),_0x26e7('0x26')]}},'raw':!![]})[_0x26e7('0xc')](function(_0x2fcabb){var _0x28891b={'user':_0x346bdf[_0x26e7('0x27')]||0x0,'telephone':_0x346bdf[_0x26e7('0x28')]||0x0};_0x2fcabb['forEach'](function(_0x46a9a2){var _0x2d3d84=_0x46a9a2[_0x26e7('0x1f')]==='admin'?_0x26e7('0x25'):_0x46a9a2[_0x26e7('0x1f')];_0x28891b[_0x2d3d84]-=_0x46a9a2[_0x26e7('0x23')];if(_0x28891b[_0x2d3d84]<0x0)_0x28891b[_0x2d3d84]=0x0;});_0x468756(_0x28891b);return;});})[_0x26e7('0x29')](function(_0x111356){_0xd41779(_0x111356);});});}function checkUserLimits(_0x35146c){return new BPromise(function(_0x1ac6c5,_0x142b3d){getLimits()[_0x26e7('0xc')](function(_0x3cc381){var _0x14b176=_[_0x26e7('0x2a')](_['countBy'](_0x35146c,'role'),['admin','user',_0x26e7('0x26')]);var _0x546129=(_0x14b176[_0x26e7('0x24')]||0x0)+(_0x14b176[_0x26e7('0x25')]||0x0);var _0x17ce9b=_0x14b176[_0x26e7('0x26')]||0x0;if(_0x546129>_0x3cc381['user'])return _0x142b3d('License\x20limit\x20reached\x20for\x20users');if(_0x17ce9b>_0x3cc381[_0x26e7('0x26')])return _0x142b3d(_0x26e7('0x2b'));return _0x1ac6c5();})[_0x26e7('0x29')](function(_0x59b71f){_0x142b3d(_0x59b71f);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x5a47=['bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','decryptString','format','parse','machineUuid','deadline','add','days','grayReason','changed','disabled','User','findAll','role','sequelize','COUNT','col','admin','forEach','user','pick','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment'];(function(_0xfdcf25,_0x5ade00){var _0x75fae9=function(_0x363b06){while(--_0x363b06){_0xfdcf25['push'](_0xfdcf25['shift']());}};_0x75fae9(++_0x5ade00);}(_0x5a47,0xd4));var _0x75a4=function(_0x17c740,_0x5133e0){_0x17c740=_0x17c740-0x0;var _0x26f17b=_0x5a47[_0x17c740];return _0x26f17b;};'use strict';var util=require(_0x75a4('0x0'));var _=require(_0x75a4('0x1'));var moment=require(_0x75a4('0x2'));var BPromise=require(_0x75a4('0x3'));var hardware=require(_0x75a4('0x4'));var encryptor=require(_0x75a4('0x5'));var db=require(_0x75a4('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x75a4('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x75a4('0x8'),'machineUuid':hardware[_0x75a4('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x75a4('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x75a4('0xa'),'machineUuid':hardware[_0x75a4('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x366d8e){return new BPromise(function(_0x234680,_0x153c2a){return db[_0x75a4('0xb')]['find'](_[_0x75a4('0xc')](_0x366d8e,{'raw':!![],'where':{'id':0x1}}))[_0x75a4('0xd')](function(_0x1f9bc7){return checkLicense(_0x1f9bc7,null);})[_0x75a4('0xd')](function(_0x1973e1){_0x234680(_0x1973e1);return;})['catch'](function(_0x3305d7){_0x153c2a(_0x3305d7);});});}function checkLicense(_0x5209a1,_0x404cd6){if(!_0x5209a1){demoLicense[_0x75a4('0xe')]=_0x5209a1['data1'];return demoLicense;}try{var _0x16e328=_0x404cd6||_0x5209a1[_0x75a4('0xf')];if(_[_0x75a4('0x10')](_0x16e328)){throw new Error(_0x75a4('0x11'));}var _0xd772ba=_0x5209a1[_0x75a4('0x12')];var _0x48369c=_0x5209a1['data2'];var _0x3af07d=_0xd772ba[_0x75a4('0x13')]('-')[0x4];var _0x2edfcd=_0xd772ba[_0x75a4('0x13')]('-')[0x0];var _0x33b4f5=encryptor[_0x75a4('0x14')](_0x16e328,util[_0x75a4('0x15')]('%s:%s:%s',_0x3af07d,_0xd772ba,_0x2edfcd));var _0x37a823=JSON[_0x75a4('0x16')](_0x33b4f5);_0x37a823['demo']=![];_0x37a823['uuid']=_0xd772ba;_0x37a823[_0x75a4('0x17')]=hardware[_0x75a4('0x9')]();if(_0x48369c){var _0x2fe903=encryptor[_0x75a4('0x14')](_0x48369c);_0x37a823['gray']=_0x2fe903;_0x37a823[_0x75a4('0x18')]=moment(_0x2fe903)[_0x75a4('0x19')](0x7,_0x75a4('0x1a'))['format']();_0x37a823[_0x75a4('0x1b')]=_0x37a823['uuid']!=_0x37a823['machineUuid']?_0x75a4('0x1c'):_0x75a4('0x1d');}return _0x37a823;}catch(_0x2719af){breakingLicense[_0x75a4('0xe')]=_0x5209a1[_0x75a4('0x12')];breakingLicense['message']=_0x2719af['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3b0d31,_0x444f67){getLicense()[_0x75a4('0xd')](function(_0x11e725){return db[_0x75a4('0x1e')][_0x75a4('0x1f')]({'attributes':[_0x75a4('0x20'),[db[_0x75a4('0x21')]['fn'](_0x75a4('0x22'),db[_0x75a4('0x21')][_0x75a4('0x23')](_0x75a4('0x20'))),'count']],'group':_0x75a4('0x20'),'where':{'role':{'$or':[_0x75a4('0x24'),'user','telephone']}},'raw':!![]})[_0x75a4('0xd')](function(_0xc1ff56){var _0x23f420={'user':_0x11e725['users']||0x0,'telephone':_0x11e725['telephones']||0x0};_0xc1ff56[_0x75a4('0x25')](function(_0x5937ad){var _0x4f2321=_0x5937ad[_0x75a4('0x20')]===_0x75a4('0x24')?_0x75a4('0x26'):_0x5937ad[_0x75a4('0x20')];_0x23f420[_0x4f2321]-=_0x5937ad['count'];if(_0x23f420[_0x4f2321]<0x0)_0x23f420[_0x4f2321]=0x0;});_0x3b0d31(_0x23f420);return;});})['catch'](function(_0x194e85){_0x444f67(_0x194e85);});});}function checkUserLimits(_0x31f47f){return new BPromise(function(_0x37168f,_0x365483){getLimits()['then'](function(_0x73017b){var _0x4f896d=_[_0x75a4('0x27')](_['countBy'](_0x31f47f,_0x75a4('0x20')),[_0x75a4('0x24'),_0x75a4('0x26'),'telephone']);var _0x52f2b9=(_0x4f896d[_0x75a4('0x24')]||0x0)+(_0x4f896d[_0x75a4('0x26')]||0x0);var _0x22fd0a=_0x4f896d[_0x75a4('0x28')]||0x0;if(_0x52f2b9>_0x73017b[_0x75a4('0x26')])return _0x365483('License\x20limit\x20reached\x20for\x20users');if(_0x22fd0a>_0x73017b['telephone'])return _0x365483(_0x75a4('0x29'));return _0x37168f();})['catch'](function(_0x5a3f95){_0x365483(_0x5a3f95);});});}module[_0x75a4('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 3bd1e38..a4e0b49 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8404=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x8404,0x15d));var _0x4840=function(_0x43604d,_0x2f7df4){_0x43604d=_0x43604d-0x0;var _0x2b6882=_0x8404[_0x43604d];return _0x2b6882;};'use strict';module[_0x4840('0x0')]={'DOMAIN':_0x4840('0x1'),'SESSION_SECRET':_0x4840('0x2'),'GOOGLE_ID':_0x4840('0x3'),'GOOGLE_SECRET':_0x4840('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x81b8=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x44caef,_0xc7754){var _0x1b0dd1=function(_0x16c65f){while(--_0x16c65f){_0x44caef['push'](_0x44caef['shift']());}};_0x1b0dd1(++_0xc7754);}(_0x81b8,0x1ce));var _0x881b=function(_0x547f20,_0x3c9465){_0x547f20=_0x547f20-0x0;var _0x1acc5c=_0x81b8[_0x547f20];return _0x1acc5c;};'use strict';module[_0x881b('0x0')]={'DOMAIN':_0x881b('0x1'),'SESSION_SECRET':_0x881b('0x2'),'GOOGLE_ID':_0x881b('0x3'),'GOOGLE_SECRET':_0x881b('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 48f30df..7d60486 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd459=['Console','debugLevel','moment','winston','util','path','join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','%s-%s','error','File','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd459,0xb1));var _0x9d45=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xd459[_0x6cf19c];return _0xce14f3;};'use strict';var moment=require(_0x9d45('0x0'));var winston=require(_0x9d45('0x1'));var util=require(_0x9d45('0x2'));var path=require(_0x9d45('0x3'));var debugLevel='INFO';function filename(_0x4257c9,_0x384fa0){return path[_0x9d45('0x4')](_0x9d45('0x5'),_0x9d45('0x6'),_0x9d45('0x7'),util[_0x9d45('0x8')](_0x9d45('0x9'),_0x4257c9,_0x384fa0));}function formatter(_0x434924,_0x38f07f){_0x38f07f[_0x9d45('0xa')]=_0x38f07f['message'][_0x9d45('0xb')](/@@{/g,_0x9d45('0xc'))[_0x9d45('0xb')](/}@@/g,_0x9d45('0xd'))['replace'](/@{/g,'{{')[_0x9d45('0xb')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x9d45('0x8')](_0x9d45('0xe')),_0x38f07f['level'][_0x9d45('0xf')](),_0x434924,_0x38f07f[_0x9d45('0xa')]);}module[_0x9d45('0x10')]=function(_0x2aff5e){return new winston[(_0x9d45('0x11'))]({'transports':[new winston[(_0x9d45('0x12'))]['File']({'name':util[_0x9d45('0x8')](_0x9d45('0x13'),_0x2aff5e,_0x9d45('0x14')),'filename':filename(_0x2aff5e,'error'),'level':_0x9d45('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4c4fa1){return formatter(_0x2aff5e,_0x4c4fa1);}}),new winston[(_0x9d45('0x12'))][(_0x9d45('0x15'))]({'name':util['format']('%s-%s',_0x2aff5e,_0x9d45('0x16')),'filename':filename(_0x2aff5e,_0x9d45('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x36b177){return formatter(_0x2aff5e,_0x36b177);}}),new winston[(_0x9d45('0x12'))][(_0x9d45('0x17'))]({'level':process['env'][_0x9d45('0x18')]||debugLevel,'json':![],'formatter':function(_0x58da6f){return formatter(_0x2aff5e,_0x58da6f);}})]});}; \ No newline at end of file +var _0xd086=['transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','INFO','join','/var','log','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger'];(function(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0xd086,0x18e));var _0x6d08=function(_0x413a97,_0x2eb020){_0x413a97=_0x413a97-0x0;var _0x3a0675=_0xd086[_0x413a97];return _0x3a0675;};'use strict';var moment=require(_0x6d08('0x0'));var winston=require(_0x6d08('0x1'));var util=require(_0x6d08('0x2'));var path=require('path');var debugLevel=_0x6d08('0x3');function filename(_0x245900,_0x15a7ca){return path[_0x6d08('0x4')](_0x6d08('0x5'),_0x6d08('0x6'),_0x6d08('0x7'),util[_0x6d08('0x8')]('%s-%s.log',_0x245900,_0x15a7ca));}function formatter(_0x11c8b5,_0x113d59){_0x113d59[_0x6d08('0x9')]=_0x113d59[_0x6d08('0x9')][_0x6d08('0xa')](/@@{/g,_0x6d08('0xb'))[_0x6d08('0xa')](/}@@/g,_0x6d08('0xc'))[_0x6d08('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x6d08('0x8')](_0x6d08('0xd'),moment()[_0x6d08('0x8')](_0x6d08('0xe')),_0x113d59[_0x6d08('0xf')]['toUpperCase'](),_0x11c8b5,_0x113d59[_0x6d08('0x9')]);}module[_0x6d08('0x10')]=function(_0x1b947f){return new winston[(_0x6d08('0x11'))]({'transports':[new winston[(_0x6d08('0x12'))][(_0x6d08('0x13'))]({'name':util['format'](_0x6d08('0x14'),_0x1b947f,_0x6d08('0x15')),'filename':filename(_0x1b947f,_0x6d08('0x15')),'level':_0x6d08('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xbc4499){return formatter(_0x1b947f,_0xbc4499);}}),new winston[(_0x6d08('0x12'))][(_0x6d08('0x13'))]({'name':util[_0x6d08('0x8')](_0x6d08('0x14'),_0x1b947f,_0x6d08('0x16')),'filename':filename(_0x1b947f,_0x6d08('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ca071){return formatter(_0x1b947f,_0x5ca071);}}),new winston[(_0x6d08('0x12'))][(_0x6d08('0x17'))]({'level':process[_0x6d08('0x18')][_0x6d08('0x19')]||debugLevel,'json':![],'formatter':function(_0x546cd6){return formatter(_0x1b947f,_0x546cd6);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c6046dd..ce7aa20 100644 --- a/server/config/pm2/config.js +++ b/server/config/pm2/config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff98=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x4faaa8,_0x4e91d5){var _0x1bf49b=function(_0x649b7b){while(--_0x649b7b){_0x4faaa8['push'](_0x4faaa8['shift']());}};_0x1bf49b(++_0x4e91d5);}(_0xff98,0x9c));var _0x8ff9=function(_0x139e6d,_0x359b30){_0x139e6d=_0x139e6d-0x0;var _0xf6a6f=_0xff98[_0x139e6d];return _0xf6a6f;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x8ff9('0x0'),'script':path[_0x8ff9('0x1')](__dirname,_0x8ff9('0x2'))},{'name':_0x8ff9('0x3'),'script':path['join'](__dirname,_0x8ff9('0x4'))},{'name':'agi','script':path[_0x8ff9('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0x8ff9('0x5'),'script':path['join'](__dirname,_0x8ff9('0x6'))},{'name':_0x8ff9('0x7'),'script':path[_0x8ff9('0x1')](__dirname,_0x8ff9('0x8'))},{'name':_0x8ff9('0x9'),'script':path[_0x8ff9('0x1')](__dirname,_0x8ff9('0xa'))}]};module[_0x8ff9('0xb')]=config; \ No newline at end of file +var _0x8865=['../../services/express/index.js','ami','../../services/ami/index.js','agi','join','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','path'];(function(_0x36d222,_0x4f9922){var _0x5bec67=function(_0x340944){while(--_0x340944){_0x36d222['push'](_0x36d222['shift']());}};_0x5bec67(++_0x4f9922);}(_0x8865,0x173));var _0x5886=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8865[_0x29d94e];return _0x106237;};'use strict';var path=require(_0x5886('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x5886('0x1'))},{'name':_0x5886('0x2'),'script':path['join'](__dirname,_0x5886('0x3'))},{'name':_0x5886('0x4'),'script':path[_0x5886('0x5')](__dirname,_0x5886('0x6'))},{'name':_0x5886('0x7'),'script':path[_0x5886('0x5')](__dirname,_0x5886('0x8'))},{'name':_0x5886('0x9'),'script':path[_0x5886('0x5')](__dirname,'../../services/routing/index.js')},{'name':_0x5886('0xa'),'script':path[_0x5886('0x5')](__dirname,_0x5886('0xb'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 8f2fb29..6acc1ad 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x598a=['bluebird','./config','then','start','stop','disconnect','restart','list','describe','delete','dump','pm2'];(function(_0xacaf13,_0x1ea63d){var _0x452ba7=function(_0xb3a3d0){while(--_0xb3a3d0){_0xacaf13['push'](_0xacaf13['shift']());}};_0x452ba7(++_0x1ea63d);}(_0x598a,0xfb));var _0xa598=function(_0x3d3685,_0x4b8762){_0x3d3685=_0x3d3685-0x0;var _0x4fd83a=_0x598a[_0x3d3685];return _0x4fd83a;};'use strict';var pm2=require(_0xa598('0x0'));var BPromise=require(_0xa598('0x1'));var config=require(_0xa598('0x2'));function connect(){return new BPromise(function(_0x3d9230,_0x414db5){return pm2['connect'](function(_0x3a2794){if(_0x3a2794){return _0x414db5(_0x3a2794);}return _0x3d9230('connected');});});};exports['start']=function(_0x4a1f8d){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0x8f041b,_0x41ebaa){return pm2[_0xa598('0x4')](_0x4a1f8d,function(_0xc65a6c,_0x4d82ee){if(_0xc65a6c){return _0x41ebaa(_0xc65a6c);}pm2['disconnect']();return _0x8f041b(_0x4d82ee);});});});};exports[_0xa598('0x5')]=function(_0xebf6e5){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0xe36e4f,_0x190ccf){return pm2[_0xa598('0x5')](_0xebf6e5,function(_0x5207d5,_0x5871a3){if(_0x5207d5){return _0x190ccf(_0x5207d5);}pm2[_0xa598('0x6')]();return _0xe36e4f(_0x5871a3);});});});};exports[_0xa598('0x7')]=function(_0x1aae78){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0xa1c53,_0x4fb7c0){return pm2[_0xa598('0x7')](_0x1aae78,function(_0x4109ff,_0x468710){if(_0x4109ff){return _0x4fb7c0(_0x4109ff);}pm2['disconnect']();return _0xa1c53(_0x468710);});});});};exports[_0xa598('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3a88f9,_0x23b343){return pm2[_0xa598('0x8')](function(_0x38afa9,_0x1949b5){if(_0x38afa9){return _0x23b343(_0x38afa9);}pm2[_0xa598('0x6')]();return _0x3a88f9(_0x1949b5);});});});};exports[_0xa598('0x9')]=function(_0x41d3fe){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0x4b100b,_0x88df86){return pm2[_0xa598('0x9')](_0x41d3fe,function(_0x6e6ff5,_0x27c34e){if(_0x6e6ff5){return _0x88df86(_0x6e6ff5);}pm2[_0xa598('0x6')]();return _0x4b100b(_0x27c34e);});});});};exports[_0xa598('0xa')]=function(_0x3cbb9f){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0x36492f,_0x44c872){return pm2['delete'](_0x3cbb9f,function(_0x1ed03f,_0x80e1ad){if(_0x1ed03f){return _0x44c872(_0x1ed03f);}pm2[_0xa598('0x6')]();return _0x36492f(_0x80e1ad);});});});};exports[_0xa598('0xb')]=function(){return connect()[_0xa598('0x3')](function(){return new BPromise(function(_0xcdf1b6,_0x53d689){return pm2['dump'](function(_0x2923d5){if(_0x2923d5){return _0x53d689(_0x2923d5);}return _0xcdf1b6('saved');});});});}; \ No newline at end of file +var _0xe599=['list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop'];(function(_0x3d9c4a,_0x116a19){var _0xa6ba56=function(_0x351ffd){while(--_0x351ffd){_0x3d9c4a['push'](_0x3d9c4a['shift']());}};_0xa6ba56(++_0x116a19);}(_0xe599,0x1e5));var _0x9e59=function(_0x38e55a,_0x36fe74){_0x38e55a=_0x38e55a-0x0;var _0x969d2d=_0xe599[_0x38e55a];return _0x969d2d;};'use strict';var pm2=require(_0x9e59('0x0'));var BPromise=require(_0x9e59('0x1'));var config=require(_0x9e59('0x2'));function connect(){return new BPromise(function(_0xfe3ea3,_0x250181){return pm2[_0x9e59('0x3')](function(_0x3fdc53){if(_0x3fdc53){return _0x250181(_0x3fdc53);}return _0xfe3ea3(_0x9e59('0x4'));});});};exports[_0x9e59('0x5')]=function(_0x568c08){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x36f378,_0x523089){return pm2[_0x9e59('0x5')](_0x568c08,function(_0x599400,_0x290f63){if(_0x599400){return _0x523089(_0x599400);}pm2[_0x9e59('0x7')]();return _0x36f378(_0x290f63);});});});};exports['stop']=function(_0x1c975c){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x2556e2,_0x1a6a13){return pm2[_0x9e59('0x8')](_0x1c975c,function(_0x14a5d7,_0x578fdc){if(_0x14a5d7){return _0x1a6a13(_0x14a5d7);}pm2[_0x9e59('0x7')]();return _0x2556e2(_0x578fdc);});});});};exports['restart']=function(_0x366941){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x21c404,_0x77f87e){return pm2['restart'](_0x366941,function(_0x9a4bb6,_0x126e57){if(_0x9a4bb6){return _0x77f87e(_0x9a4bb6);}pm2['disconnect']();return _0x21c404(_0x126e57);});});});};exports[_0x9e59('0x9')]=function(){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x27bf9b,_0x257a39){return pm2['list'](function(_0x3c9cba,_0xcd37b5){if(_0x3c9cba){return _0x257a39(_0x3c9cba);}pm2[_0x9e59('0x7')]();return _0x27bf9b(_0xcd37b5);});});});};exports[_0x9e59('0xa')]=function(_0x1ec55a){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x1e0f80,_0x82dffd){return pm2['describe'](_0x1ec55a,function(_0x78b8e2,_0x4bfd39){if(_0x78b8e2){return _0x82dffd(_0x78b8e2);}pm2['disconnect']();return _0x1e0f80(_0x4bfd39);});});});};exports['delete']=function(_0x29dc13){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x51e05b,_0x224bc7){return pm2[_0x9e59('0xb')](_0x29dc13,function(_0x40f315,_0xd789aa){if(_0x40f315){return _0x224bc7(_0x40f315);}pm2[_0x9e59('0x7')]();return _0x51e05b(_0xd789aa);});});});};exports[_0x9e59('0xc')]=function(){return connect()[_0x9e59('0x6')](function(){return new BPromise(function(_0x48fa20,_0x1ba8f9){return pm2[_0x9e59('0xc')](function(_0x52bf05){if(_0x52bf05){return _0x1ba8f9(_0x52bf05);}return _0x48fa20('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 2405ee7..d482ecc 100644 --- a/server/config/schedule/chat.js +++ b/server/config/schedule/chat.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd71b=['../../mysqldb','../logger','schedule','redis','defaults','localhost','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment'];(function(_0xb5f4f6,_0x44e6f0){var _0x45fbc0=function(_0x3de6e5){while(--_0x3de6e5){_0xb5f4f6['push'](_0xb5f4f6['shift']());}};_0x45fbc0(++_0x44e6f0);}(_0xd71b,0x15a));var _0xbd71=function(_0x1823a0,_0x38947d){_0x1823a0=_0x1823a0-0x0;var _0x2b780c=_0xd71b[_0x1823a0];return _0x2b780c;};'use strict';var _=require(_0xbd71('0x0'));var moment=require(_0xbd71('0x1'));var Redis=require('ioredis');var util=require(_0xbd71('0x2'));var config=require(_0xbd71('0x3'));var db=require(_0xbd71('0x4'))['db'];var logger=require(_0xbd71('0x5'))(_0xbd71('0x6'));config[_0xbd71('0x7')]=_[_0xbd71('0x8')](config[_0xbd71('0x7')],{'host':_0xbd71('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd71('0x7')]));function closeInteractions(){var _0x162c44=0x0;var _0x18173f=[];return db[_0xbd71('0xa')][_0xbd71('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xbd71('0xc')](function(_0x17d23b){_0x162c44=_0x17d23b[_0xbd71('0xd')];if(_0x162c44){return db[_0xbd71('0xe')][_0xbd71('0xf')]({'raw':!![],'attributes':['id',_0xbd71('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbd71('0x11')](_0x17d23b[_0xbd71('0xd')],_0xbd71('0x12'))}}});}else{return[];}})[_0xbd71('0xc')](function(_0xbb5c86){if(_0xbb5c86&&_0xbb5c86[_0xbd71('0x13')]){_0x18173f=_[_0xbd71('0x14')](_0xbb5c86||[],'id');logger[_0xbd71('0x15')](_0xbd71('0x16'),_0x18173f[_0xbd71('0x17')]());return db['ChatInteraction'][_0xbd71('0x18')]({'closeReason':'system','disposition':_0xbd71('0x19'),'closed':!![],'closedAt':moment()[_0xbd71('0x1a')](_0xbd71('0x1b'))},{'where':{'id':_0x18173f}});}})[_0xbd71('0xc')](function(){if(_0x18173f&&_0x18173f[_0xbd71('0x13')]){logger[_0xbd71('0x15')](_0xbd71('0x1c'),_0x18173f[_0xbd71('0x17')]());for(var _0x1c694e=0x0;_0x1c694e<_0x18173f[_0xbd71('0x13')];_0x1c694e++){io[_0xbd71('0x1d')](_0xbd71('0x1e'),{'id':_0x18173f[_0x1c694e],'closed':!![]});}}})[_0xbd71('0x1f')](function(_0x11c765){logger[_0xbd71('0x20')](_0xbd71('0x21'),_0x11c765?util[_0xbd71('0x22')](_0x11c765,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5526=['lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','find','then','ChatInteraction','findAll','chatTimeout','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','timeout','format','YYYY-MM-DD\x20HH:mm:ss','join','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start'];(function(_0x4f3cb8,_0x445472){var _0x42f455=function(_0x2d29ba){while(--_0x2d29ba){_0x4f3cb8['push'](_0x4f3cb8['shift']());}};_0x42f455(++_0x445472);}(_0x5526,0xb4));var _0x6552=function(_0xf03f9e,_0x2f85e8){_0xf03f9e=_0xf03f9e-0x0;var _0x2326a7=_0x5526[_0xf03f9e];return _0x2326a7;};'use strict';var _=require(_0x6552('0x0'));var moment=require(_0x6552('0x1'));var Redis=require(_0x6552('0x2'));var util=require(_0x6552('0x3'));var config=require(_0x6552('0x4'));var db=require(_0x6552('0x5'))['db'];var logger=require(_0x6552('0x6'))(_0x6552('0x7'));config[_0x6552('0x8')]=_[_0x6552('0x9')](config[_0x6552('0x8')],{'host':_0x6552('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6552('0x8')]));function closeInteractions(){var _0x503f4b=0x0;var _0x53951e=[];return db['Setting'][_0x6552('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x6552('0xc')](function(_0x3316fe){_0x503f4b=_0x3316fe['chatTimeout'];if(_0x503f4b){return db[_0x6552('0xd')][_0x6552('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3316fe[_0x6552('0xf')],_0x6552('0x10'))}}});}else{return[];}})[_0x6552('0xc')](function(_0xf916f3){if(_0xf916f3&&_0xf916f3[_0x6552('0x11')]){_0x53951e=_[_0x6552('0x12')](_0xf916f3||[],'id');logger[_0x6552('0x13')](_0x6552('0x14'),_0x53951e['join']());return db[_0x6552('0xd')]['update']({'closeReason':'system','disposition':_0x6552('0x15'),'closed':!![],'closedAt':moment()[_0x6552('0x16')](_0x6552('0x17'))},{'where':{'id':_0x53951e}});}})['then'](function(){if(_0x53951e&&_0x53951e[_0x6552('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x53951e[_0x6552('0x18')]());for(var _0x5e828a=0x0;_0x5e828a<_0x53951e[_0x6552('0x11')];_0x5e828a++){io[_0x6552('0x19')](_0x6552('0x1a'),{'id':_0x53951e[_0x5e828a],'closed':!![]});}}})['catch'](function(_0x185ef1){logger[_0x6552('0x1b')](_0x6552('0x1c'),_0x185ef1?util['inspect'](_0x185ef1,{'showHidden':![],'depth':null}):'');});}exports[_0x6552('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index fa3ba70..8f1652b 100644 --- a/server/config/schedule/index.js +++ b/server/config/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89db=['toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','deleteJob','stop\x20cron','length','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','email','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','basename','existsSync','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','stringify','email\x20sent','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','name','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','map','toString','keyBy','intersection','exists','stop','delete\x20cron'];(function(_0x38aacd,_0x50a722){var _0x5021cc=function(_0x5d9723){while(--_0x5d9723){_0x38aacd['push'](_0x38aacd['shift']());}};_0x5021cc(++_0x50a722);}(_0x89db,0x1ce));var _0xb89d=function(_0x38a76e,_0x55db2f){_0x38a76e=_0x38a76e-0x0;var _0xd13d92=_0x89db[_0x38a76e];return _0xd13d92;};'use strict';var fs=require('fs');var util=require(_0xb89d('0x0'));var path=require(_0xb89d('0x1'));var _=require(_0xb89d('0x2'));var moment=require(_0xb89d('0x3'));var CronJobManager=require(_0xb89d('0x4'));var jayson=require(_0xb89d('0x5'));var BPromise=require(_0xb89d('0x6'));var logger=require(_0xb89d('0x7'))(_0xb89d('0x8'));var db=require(_0xb89d('0x9'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xb89d('0xa'));var client=jayson[_0xb89d('0xb')][_0xb89d('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3cc99b,_0x52c305){return function(){logger[_0xb89d('0xd')](_0xb89d('0xe'),_0x3cc99b['email']);var _0x584bcb=!![];var _0x28f7aa={'tls':{'rejectUnauthorized':![]}};if(_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x10')]){_0x28f7aa['service']=_0x3cc99b[_0xb89d('0x11')][_0xb89d('0xf')][_0xb89d('0x10')];}else{_0x28f7aa[_0xb89d('0x12')]=_0x3cc99b[_0xb89d('0x11')]['Smtp'][_0xb89d('0x12')];_0x28f7aa[_0xb89d('0x13')]=_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x13')];_0x28f7aa[_0xb89d('0x14')]=_0x3cc99b[_0xb89d('0x11')][_0xb89d('0xf')]['secure'];}if(_0x3cc99b['MailAccount']['Smtp'][_0xb89d('0x15')]){_0x28f7aa['auth']={'user':_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x16')],'pass':_0x3cc99b[_0xb89d('0x11')][_0xb89d('0xf')][_0xb89d('0x17')]};}var _0x48f644={'account':_0x28f7aa,'message':{'from':util[_0xb89d('0x18')](_0xb89d('0x19'),_0x3cc99b[_0xb89d('0x11')]['name'],_0x3cc99b['MailAccount'][_0xb89d('0x1a')]||_0x3cc99b['MailAccount'][_0xb89d('0xf')][_0xb89d('0x16')]),'to':_0x3cc99b[_0xb89d('0x1a')],'cc':_0x3cc99b['cc'],'bcc':_0x3cc99b['bcc'],'subject':util[_0xb89d('0x18')](_0xb89d('0x1b'),_0x52c305['name'],_0x3cc99b['subtractNumber'],_0x3cc99b['subtractUnit'])}};var _0x152d19=path[_0xb89d('0x1c')](__dirname,_0xb89d('0x1d'));var _0x359a4e=_0x52c305[_0xb89d('0x1e')];var _0x30b56b=util[_0xb89d('0x18')](_0xb89d('0x1f'),path[_0xb89d('0x20')](_0x52c305[_0xb89d('0x1e')],path['extname'](_0x52c305[_0xb89d('0x1e')])),'zip');var _0x1ba7b0=path[_0xb89d('0x1c')](_0x152d19,_0x359a4e);var _0x566aef=path[_0xb89d('0x1c')](_0x152d19,_0x30b56b);if(fs[_0xb89d('0x21')](_0x1ba7b0)){_0x52c305['status']='Sent';_0x48f644[_0xb89d('0x22')][_0xb89d('0x23')]=[{'filename':_0x359a4e,'path':_0x1ba7b0}];_0x48f644[_0xb89d('0x22')][_0xb89d('0x24')]=util['format'](_0xb89d('0x25'),JSON['stringify'](_0x52c305,null,0x2));}else if(fs['existsSync'](_0x566aef)){_0x52c305[_0xb89d('0x26')]=_0xb89d('0x27');_0x48f644['message'][_0xb89d('0x23')]=[{'filename':_0x30b56b,'path':_0x566aef}];}else{_0x48f644['message']['text']=_0xb89d('0x28');if(!_0x3cc99b[_0xb89d('0x29')]){_0x584bcb=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x584bcb){return client[_0xb89d('0x2a')](_0xb89d('0x2b'),_0x48f644)[_0xb89d('0x2c')](function(_0xaa4d12){if(_0xaa4d12[_0xb89d('0x2d')]){return logger[_0xb89d('0x2d')]('error\x20mail',JSON[_0xb89d('0x2e')](_0xaa4d12));}return logger['info'](_0xb89d('0x2f'));})['catch'](function(_0x1455c0){return logger[_0xb89d('0x2d')](_0xb89d('0x30'),JSON[_0xb89d('0x2e')](_0x1455c0));});}};}function handleError(){return function(_0x34a6db){return logger['error'](JSON[_0xb89d('0x2e')](_0x34a6db));};}function handleResult(_0x1848a6){return function(_0x1645ce){logger[_0xb89d('0xd')]('data',JSON['stringify'](_0x1645ce));if(_0x1848a6['MailAccount']&&_0x1848a6['MailAccount'][_0xb89d('0xf')]&&!_[_0xb89d('0x31')](_0x1848a6[_0xb89d('0x1a')])){setTimeout(handleSendEmail(_0x1848a6,_0x1645ce),0x3c*0x3e8);}};}function handleJob(_0x370a4c){return function(){try{if(_[_0xb89d('0x31')](_0x370a4c['subtractNumber'])){return logger['info'](_0xb89d('0x32'));}if(_[_0xb89d('0x31')](_0x370a4c[_0xb89d('0x33')])){return logger[_0xb89d('0xd')](_0xb89d('0x34'));}var _0x34a485={'startDate':moment()['subtract'](_0x370a4c['subtractNumber'],_0x370a4c['subtractUnit'])[_0xb89d('0x18')](_0xb89d('0x35')),'endDate':moment()[_0xb89d('0x18')](_0xb89d('0x35')),'type':'scheduled','output':_0x370a4c[_0xb89d('0x36')],'name':_0x370a4c[_0xb89d('0x37')]};if(!_[_0xb89d('0x31')](_0x370a4c[_0xb89d('0x38')])){logger[_0xb89d('0xd')](_0xb89d('0x39'),_0x370a4c[_0xb89d('0x38')]);return analyticDefaultReportController[_0xb89d('0x3a')]({'id':_0x370a4c[_0xb89d('0x38')]},_0x34a485)[_0xb89d('0x2c')](handleResult(_0x370a4c))[_0xb89d('0x3b')](handleError());}if(!_[_0xb89d('0x31')](_0x370a4c[_0xb89d('0x3c')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x370a4c[_0xb89d('0x3c')]);return analyticCustomReportController[_0xb89d('0x3a')]({'id':_0x370a4c['CustomReportId']},_0x34a485)[_0xb89d('0x2c')](handleResult(_0x370a4c))[_0xb89d('0x3b')](handleError());}}catch(_0x308b24){logger[_0xb89d('0x2d')](JSON[_0xb89d('0x2e')](_0x308b24));}return logger[_0xb89d('0xd')](_0xb89d('0x3d'));};}function getJobs(_0x489efa){var _0x58b0ed={};if(_0x489efa){_0x58b0ed['id']=_0x489efa;}return db[_0xb89d('0x3e')]['findAll']({'where':_0x58b0ed,'include':[{'model':db[_0xb89d('0x11')],'attributes':['id',_0xb89d('0x37'),_0xb89d('0x1a')],'include':[{'model':db[_0xb89d('0x3f')],'as':_0xb89d('0xf')}]}]})[_0xb89d('0x2c')](function(_0x381a10){var _0x2a1e5c=_[_0xb89d('0x40')](manager['jobs']);var _0x3c2afa=_[_0xb89d('0x41')](_0x381a10,function(_0x5dd06b){return _0x5dd06b['id'][_0xb89d('0x42')]();});var _0x70cb6b=_[_0xb89d('0x43')](_0x381a10,function(_0x1ec8d5){return _0x1ec8d5['id'][_0xb89d('0x42')]();});var _0xd96216=_0x489efa?_0x3c2afa:_['difference'](_0x3c2afa,_0x2a1e5c);var _0x253eb5=_[_0xb89d('0x44')](_0x3c2afa,_0x2a1e5c);var _0x3ec758=_['difference'](_0x2a1e5c,_0x3c2afa);var _0x112032;var _0x53e64f;for(_0x112032=0x0;_0x112032<_0x3ec758['length']&&!_0x489efa;_0x112032+=0x1){_0x53e64f=_0x3ec758[_0x112032][_0xb89d('0x42')]();if(manager[_0xb89d('0x45')](_0x53e64f)){manager[_0xb89d('0x46')](_0x53e64f);manager['deleteJob'](_0x53e64f);logger[_0xb89d('0xd')](_0xb89d('0x47'),_0x53e64f);}}logger['info'](_0xb89d('0x48'),JSON[_0xb89d('0x2e')](_0xd96216));for(_0x112032=0x0;_0x112032<_0xd96216['length'];_0x112032+=0x1){_0x53e64f=_0xd96216[_0x112032][_0xb89d('0x42')]();logger['info']('index',_0x53e64f);if(_0x489efa){logger['info'](_0xb89d('0x49'),_0x489efa);logger[_0xb89d('0xd')](JSON[_0xb89d('0x2e')](_0x70cb6b[_0x53e64f]));BPromise[_0xb89d('0x4a')]()['then'](handleJob(_0x70cb6b[_0x53e64f]));logger[_0xb89d('0xd')](_0xb89d('0x4b'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}else if(_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]&&_0x70cb6b[_0x53e64f][_0xb89d('0x4d')]&&moment()[_0xb89d('0x4e')](_0x70cb6b[_0x53e64f][_0xb89d('0x4f')],_0x70cb6b[_0x53e64f][_0xb89d('0x50')])){manager['add'](_0x53e64f,_0x70cb6b[_0x53e64f][_0xb89d('0x4c')],handleJob(_0x70cb6b[_0x53e64f]));manager[_0xb89d('0x51')](_0x53e64f);logger[_0xb89d('0xd')](_0xb89d('0x52'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}else if(manager[_0xb89d('0x45')](_0x53e64f)){manager['stop'](_0x53e64f);manager[_0xb89d('0x53')](_0x53e64f);logger[_0xb89d('0xd')](_0xb89d('0x54'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}}for(_0x112032=0x0,_0x53e64f;_0x112032<_0x253eb5[_0xb89d('0x55')]&&!_0x489efa;_0x112032+=0x1){_0x53e64f=_0x253eb5[_0x112032]['toString']();if(manager['exists'](_0x53e64f)){if(_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]&&_0x70cb6b[_0x53e64f]['active']&&moment()['isBetween'](_0x70cb6b[_0x53e64f][_0xb89d('0x4f')],_0x70cb6b[_0x53e64f][_0xb89d('0x50')])){manager[_0xb89d('0x56')](_0x53e64f,_0x70cb6b[_0x53e64f]['cron'],handleJob(_0x70cb6b[_0x53e64f]));logger[_0xb89d('0xd')](_0xb89d('0x57'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}else{manager[_0xb89d('0x46')](_0x53e64f);manager[_0xb89d('0x53')](_0x53e64f);logger['info'](_0xb89d('0x54'),_0x70cb6b[_0x53e64f][_0xb89d('0x37')],_0x70cb6b[_0x53e64f][_0xb89d('0x4c')]);}}}})[_0xb89d('0x3b')](function(_0x303a57){logger[_0xb89d('0x2d')](JSON['stringify'](_0x303a57));});}exports[_0xb89d('0x58')]=function(_0x28779c){return getJobs(_0x28779c);};exports[_0xb89d('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xba7c=['\x22%s\x22\x20<%s>','name','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','savename','extname','zip','status','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','data','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','isNil','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','difference','length','stop','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','endAt','start','add\x20cron','exists','stop\x20cron','startAt','update\x20cron','deleteJob','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass'];(function(_0x189d81,_0x3ed1c9){var _0x1ca8e2=function(_0xa2f685){while(--_0xa2f685){_0x189d81['push'](_0x189d81['shift']());}};_0x1ca8e2(++_0x3ed1c9);}(_0xba7c,0x9d));var _0xcba7=function(_0x56bc4a,_0x3be12f){_0x56bc4a=_0x56bc4a-0x0;var _0x11685f=_0xba7c[_0x56bc4a];return _0x11685f;};'use strict';var fs=require('fs');var util=require(_0xcba7('0x0'));var path=require(_0xcba7('0x1'));var _=require(_0xcba7('0x2'));var moment=require(_0xcba7('0x3'));var CronJobManager=require(_0xcba7('0x4'));var jayson=require(_0xcba7('0x5'));var BPromise=require(_0xcba7('0x6'));var logger=require('../logger')(_0xcba7('0x7'));var db=require(_0xcba7('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xcba7('0x9'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x12334a,_0x13487e){return function(){logger[_0xcba7('0xa')](_0xcba7('0xb'),_0x12334a[_0xcba7('0xc')]);var _0xed7b0a=!![];var _0x16a408={'tls':{'rejectUnauthorized':![]}};if(_0x12334a[_0xcba7('0xd')]['Smtp'][_0xcba7('0xe')]){_0x16a408['service']=_0x12334a[_0xcba7('0xd')][_0xcba7('0xf')][_0xcba7('0xe')];}else{_0x16a408[_0xcba7('0x10')]=_0x12334a[_0xcba7('0xd')]['Smtp'][_0xcba7('0x10')];_0x16a408[_0xcba7('0x11')]=_0x12334a[_0xcba7('0xd')][_0xcba7('0xf')]['port'];_0x16a408[_0xcba7('0x12')]=_0x12334a['MailAccount']['Smtp']['secure'];}if(_0x12334a['MailAccount'][_0xcba7('0xf')][_0xcba7('0x13')]){_0x16a408[_0xcba7('0x14')]={'user':_0x12334a['MailAccount'][_0xcba7('0xf')][_0xcba7('0x15')],'pass':_0x12334a[_0xcba7('0xd')]['Smtp'][_0xcba7('0x16')]};}var _0x52b9ca={'account':_0x16a408,'message':{'from':util['format'](_0xcba7('0x17'),_0x12334a[_0xcba7('0xd')][_0xcba7('0x18')],_0x12334a[_0xcba7('0xd')][_0xcba7('0xc')]||_0x12334a['MailAccount'][_0xcba7('0xf')]['user']),'to':_0x12334a['email'],'cc':_0x12334a['cc'],'bcc':_0x12334a[_0xcba7('0x19')],'subject':util[_0xcba7('0x1a')]('Report\x20%s\x20last\x20%s\x20%s',_0x13487e['name'],_0x12334a[_0xcba7('0x1b')],_0x12334a[_0xcba7('0x1c')])}};var _0x3f49c9=path[_0xcba7('0x1d')](__dirname,_0xcba7('0x1e'));var _0x2f6ec9=_0x13487e['savename'];var _0x4f3ff9=util[_0xcba7('0x1a')](_0xcba7('0x1f'),path['basename'](_0x13487e[_0xcba7('0x20')],path[_0xcba7('0x21')](_0x13487e['savename'])),_0xcba7('0x22'));var _0x2c3967=path[_0xcba7('0x1d')](_0x3f49c9,_0x2f6ec9);var _0x166ae1=path[_0xcba7('0x1d')](_0x3f49c9,_0x4f3ff9);if(fs['existsSync'](_0x2c3967)){_0x13487e[_0xcba7('0x23')]=_0xcba7('0x24');_0x52b9ca['message'][_0xcba7('0x25')]=[{'filename':_0x2f6ec9,'path':_0x2c3967}];_0x52b9ca['message'][_0xcba7('0x26')]=util[_0xcba7('0x1a')](_0xcba7('0x27'),JSON[_0xcba7('0x28')](_0x13487e,null,0x2));}else if(fs[_0xcba7('0x29')](_0x166ae1)){_0x13487e[_0xcba7('0x23')]=_0xcba7('0x24');_0x52b9ca['message'][_0xcba7('0x25')]=[{'filename':_0x4f3ff9,'path':_0x166ae1}];}else{_0x52b9ca[_0xcba7('0x2a')][_0xcba7('0x26')]=_0xcba7('0x2b');if(!_0x12334a[_0xcba7('0x2c')]){_0xed7b0a=![];logger[_0xcba7('0xa')](_0xcba7('0x2d'));}}if(_0xed7b0a){return client[_0xcba7('0x2e')](_0xcba7('0x2f'),_0x52b9ca)[_0xcba7('0x30')](function(_0x300a66){if(_0x300a66[_0xcba7('0x31')]){return logger[_0xcba7('0x31')]('error\x20mail',JSON[_0xcba7('0x28')](_0x300a66));}return logger[_0xcba7('0xa')](_0xcba7('0x32'));})[_0xcba7('0x33')](function(_0x53c748){return logger[_0xcba7('0x31')]('error\x20mail',JSON[_0xcba7('0x28')](_0x53c748));});}};}function handleError(){return function(_0x4af7a7){return logger['error'](JSON[_0xcba7('0x28')](_0x4af7a7));};}function handleResult(_0x114832){return function(_0x4cb880){logger[_0xcba7('0xa')](_0xcba7('0x34'),JSON['stringify'](_0x4cb880));if(_0x114832[_0xcba7('0xd')]&&_0x114832[_0xcba7('0xd')][_0xcba7('0xf')]&&!_['isNil'](_0x114832['email'])){setTimeout(handleSendEmail(_0x114832,_0x4cb880),0x3c*0x3e8);}};}function handleJob(_0x2a42f2){return function(){try{if(_['isNil'](_0x2a42f2[_0xcba7('0x1b')])){return logger['info'](_0xcba7('0x35'));}if(_['isNil'](_0x2a42f2[_0xcba7('0x1c')])){return logger['info'](_0xcba7('0x36'));}var _0x2c6dd3={'startDate':moment()[_0xcba7('0x37')](_0x2a42f2[_0xcba7('0x1b')],_0x2a42f2['subtractUnit'])[_0xcba7('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xcba7('0x1a')](_0xcba7('0x38')),'type':'scheduled','output':_0x2a42f2[_0xcba7('0x39')],'name':_0x2a42f2[_0xcba7('0x18')]};if(!_[_0xcba7('0x3a')](_0x2a42f2['DefaultReportId'])){logger[_0xcba7('0xa')](_0xcba7('0x3b'),_0x2a42f2[_0xcba7('0x3c')]);return analyticDefaultReportController[_0xcba7('0x3d')]({'id':_0x2a42f2['DefaultReportId']},_0x2c6dd3)['then'](handleResult(_0x2a42f2))['catch'](handleError());}if(!_[_0xcba7('0x3a')](_0x2a42f2[_0xcba7('0x3e')])){logger[_0xcba7('0xa')](_0xcba7('0x3f'),_0x2a42f2[_0xcba7('0x3e')]);return analyticCustomReportController[_0xcba7('0x3d')]({'id':_0x2a42f2[_0xcba7('0x3e')]},_0x2c6dd3)[_0xcba7('0x30')](handleResult(_0x2a42f2))[_0xcba7('0x33')](handleError());}}catch(_0x3d3c2b){logger[_0xcba7('0x31')](JSON[_0xcba7('0x28')](_0x3d3c2b));}return logger[_0xcba7('0xa')](_0xcba7('0x40'));};}function getJobs(_0x5b3135){var _0x21ba99={};if(_0x5b3135){_0x21ba99['id']=_0x5b3135;}return db[_0xcba7('0x41')][_0xcba7('0x42')]({'where':_0x21ba99,'include':[{'model':db[_0xcba7('0xd')],'attributes':['id',_0xcba7('0x18'),_0xcba7('0xc')],'include':[{'model':db[_0xcba7('0x43')],'as':_0xcba7('0xf')}]}]})[_0xcba7('0x30')](function(_0x170bb1){var _0xde59e3=_[_0xcba7('0x44')](manager['jobs']);var _0x4bbba0=_[_0xcba7('0x45')](_0x170bb1,function(_0x1092df){return _0x1092df['id'][_0xcba7('0x46')]();});var _0x3c1d37=_[_0xcba7('0x47')](_0x170bb1,function(_0x24ae4a){return _0x24ae4a['id'][_0xcba7('0x46')]();});var _0x418f41=_0x5b3135?_0x4bbba0:_[_0xcba7('0x48')](_0x4bbba0,_0xde59e3);var _0x13d8ce=_['intersection'](_0x4bbba0,_0xde59e3);var _0x10fe80=_[_0xcba7('0x48')](_0xde59e3,_0x4bbba0);var _0x1fd217;var _0x4e5ab6;for(_0x1fd217=0x0;_0x1fd217<_0x10fe80[_0xcba7('0x49')]&&!_0x5b3135;_0x1fd217+=0x1){_0x4e5ab6=_0x10fe80[_0x1fd217][_0xcba7('0x46')]();if(manager['exists'](_0x4e5ab6)){manager[_0xcba7('0x4a')](_0x4e5ab6);manager['deleteJob'](_0x4e5ab6);logger[_0xcba7('0xa')](_0xcba7('0x4b'),_0x4e5ab6);}}logger['info'](_0xcba7('0x4c'),JSON['stringify'](_0x418f41));for(_0x1fd217=0x0;_0x1fd217<_0x418f41['length'];_0x1fd217+=0x1){_0x4e5ab6=_0x418f41[_0x1fd217][_0xcba7('0x46')]();logger[_0xcba7('0xa')]('index',_0x4e5ab6);if(_0x5b3135){logger[_0xcba7('0xa')]('my\x20id',_0x5b3135);logger['info'](JSON[_0xcba7('0x28')](_0x3c1d37[_0x4e5ab6]));BPromise[_0xcba7('0x4d')]()[_0xcba7('0x30')](handleJob(_0x3c1d37[_0x4e5ab6]));logger[_0xcba7('0xa')](_0xcba7('0x4e'),_0x3c1d37[_0x4e5ab6][_0xcba7('0x18')],_0x3c1d37[_0x4e5ab6][_0xcba7('0x4f')]);}else if(_0x3c1d37[_0x4e5ab6][_0xcba7('0x4f')]&&_0x3c1d37[_0x4e5ab6][_0xcba7('0x50')]&&moment()[_0xcba7('0x51')](_0x3c1d37[_0x4e5ab6]['startAt'],_0x3c1d37[_0x4e5ab6][_0xcba7('0x52')])){manager['add'](_0x4e5ab6,_0x3c1d37[_0x4e5ab6][_0xcba7('0x4f')],handleJob(_0x3c1d37[_0x4e5ab6]));manager[_0xcba7('0x53')](_0x4e5ab6);logger['info'](_0xcba7('0x54'),_0x3c1d37[_0x4e5ab6][_0xcba7('0x18')],_0x3c1d37[_0x4e5ab6][_0xcba7('0x4f')]);}else if(manager[_0xcba7('0x55')](_0x4e5ab6)){manager[_0xcba7('0x4a')](_0x4e5ab6);manager['deleteJob'](_0x4e5ab6);logger['info'](_0xcba7('0x56'),_0x3c1d37[_0x4e5ab6][_0xcba7('0x18')],_0x3c1d37[_0x4e5ab6]['cron']);}}for(_0x1fd217=0x0,_0x4e5ab6;_0x1fd217<_0x13d8ce[_0xcba7('0x49')]&&!_0x5b3135;_0x1fd217+=0x1){_0x4e5ab6=_0x13d8ce[_0x1fd217][_0xcba7('0x46')]();if(manager[_0xcba7('0x55')](_0x4e5ab6)){if(_0x3c1d37[_0x4e5ab6][_0xcba7('0x4f')]&&_0x3c1d37[_0x4e5ab6][_0xcba7('0x50')]&&moment()[_0xcba7('0x51')](_0x3c1d37[_0x4e5ab6][_0xcba7('0x57')],_0x3c1d37[_0x4e5ab6]['endAt'])){manager['update'](_0x4e5ab6,_0x3c1d37[_0x4e5ab6][_0xcba7('0x4f')],handleJob(_0x3c1d37[_0x4e5ab6]));logger[_0xcba7('0xa')](_0xcba7('0x58'),_0x3c1d37[_0x4e5ab6][_0xcba7('0x18')],_0x3c1d37[_0x4e5ab6]['cron']);}else{manager[_0xcba7('0x4a')](_0x4e5ab6);manager[_0xcba7('0x59')](_0x4e5ab6);logger[_0xcba7('0xa')]('stop\x20cron',_0x3c1d37[_0x4e5ab6][_0xcba7('0x18')],_0x3c1d37[_0x4e5ab6][_0xcba7('0x4f')]);}}}})['catch'](function(_0x3286e0){logger[_0xcba7('0x31')](JSON[_0xcba7('0x28')](_0x3286e0));});}exports['run']=function(_0x166be9){return getJobs(_0x166be9);};exports[_0xcba7('0x53')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index d0cc0c4..456a7fd 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae02=['name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','length','Setting','Settings\x20not\x20available','transcribeAccountId','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','fileText','transcripts','transcript','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','Positive','catch'];(function(_0x335136,_0x131d00){var _0x234b60=function(_0x1ba3a8){while(--_0x1ba3a8){_0x335136['push'](_0x335136['shift']());}};_0x234b60(++_0x131d00);}(_0xae02,0x19a));var _0x2ae0=function(_0x255bba,_0x4dd398){_0x255bba=_0x255bba-0x0;var _0xe8e46=_0xae02[_0x255bba];return _0xe8e46;};var _=require(_0x2ae0('0x0'));var AWS=require(_0x2ae0('0x1'));var rp=require('request-promise');var util=require(_0x2ae0('0x2'));var BPromise=require(_0x2ae0('0x3'));var db=require(_0x2ae0('0x4'))['db'];var logger=require('../../config/logger')(_0x2ae0('0x5'));function getTranscriptionJob(_0x1c56f1,_0x2d9cbf,_0x54c51d,_0x591a30){return new Promise(function(_0x322830,_0x28b444){var _0x3ccc0c=new AWS[(_0x2ae0('0x6'))]({'accessKeyId':_0x2d9cbf,'secretAccessKey':_0x1c56f1,'region':_0x54c51d});_0x3ccc0c[_0x2ae0('0x7')]({'TranscriptionJobName':_0x591a30},function(_0xdd5f14,_0x19d56e){if(_0xdd5f14){return _0x28b444(_0xdd5f14);}else{return _0x322830(_0x19d56e);}});});}function sentiment(_0x2bc6e9,_0x434dd5,_0x357245,_0xe9a93a,_0x3a3f17){return new Promise(function(_0x51cb7a,_0x43d260){var _0x27f5c4=new AWS['Comprehend']({'accessKeyId':_0x434dd5,'secretAccessKey':_0x2bc6e9,'region':_0x357245});_0x27f5c4['detectSentiment']({'Text':_0xe9a93a,'LanguageCode':_0x3a3f17[_0x2ae0('0x8')](0x0,0x2)},function(_0x155ed9,_0x5dde0f){if(_0x155ed9){return _0x43d260(_0x155ed9);}else{return _0x51cb7a(_0x5dde0f);}});});}function checkTranscribeJob(_0x5bacbc,_0x373bd7,_0x186336){var _0x592359;return new BPromise(function(_0x4400c5,_0x5590d4){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0xb'),_0x5bacbc['id'],_0x5bacbc[_0x2ae0('0xc')]));return getTranscriptionJob(_0x186336[_0x2ae0('0xd')],_0x186336[_0x2ae0('0xe')],_0x373bd7[_0x2ae0('0xf')],_0x5bacbc[_0x2ae0('0xc')])['then'](function(_0xf69015){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x10'),_0x5bacbc['id'],_0x5bacbc['transcribeName'],_0xf69015[_0x2ae0('0x11')]['TranscriptionJobStatus']));if(!_0x5bacbc['fileText']){switch(_0xf69015[_0x2ae0('0x11')][_0x2ae0('0x12')]){case _0x2ae0('0x13'):var _0x4a0750={'transcribeStatus':_0xf69015[_0x2ae0('0x11')][_0x2ae0('0x12')],'fileUri':_0xf69015['TranscriptionJob'][_0x2ae0('0x14')]['TranscriptFileUri']};logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x5bacbc['id']));return rp({'uri':_0xf69015[_0x2ae0('0x11')][_0x2ae0('0x14')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x2fe931){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x15'),_0x5bacbc['id']));if(_0x2fe931&&_0x2fe931['results']&&_0x2fe931[_0x2ae0('0x16')]['transcripts']&&_0x2fe931[_0x2ae0('0x16')]['transcripts']['length']){_0x4a0750[_0x2ae0('0x17')]='';for(var _0xac4b33=0x0;_0xac4b33<_0x2fe931[_0x2ae0('0x16')]['transcripts']['length'];_0xac4b33++){_0x4a0750['fileText']+=_0x2fe931[_0x2ae0('0x16')][_0x2ae0('0x18')][_0xac4b33][_0x2ae0('0x19')]+'';}}return _0x5bacbc['update'](_0x4a0750);})[_0x2ae0('0x1a')](function(){logger['info'](util[_0x2ae0('0xa')](_0x2ae0('0x1b'),_0x5bacbc['id']));if(!_0x5bacbc['tempSentiment']){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x1e'));}if(!_0x373bd7['sentiment']||!_0x373bd7[_0x2ae0('0x1f')]||!_0x373bd7['sentimentRegion']||!_0x373bd7[_0x2ae0('0x20')]||!_0x373bd7[_0x2ae0('0x21')]){throw new db[(_0x2ae0('0x1c'))]['ValidationError'](_0x2ae0('0x22'));}if(!_0x4a0750[_0x2ae0('0x17')]){throw new Error(_0x2ae0('0x23'));}if(_0x373bd7[_0x2ae0('0x1f')]===_0x186336['id']){return _0x186336;}else{return db[_0x2ae0('0x24')][_0x2ae0('0x25')]({'where':{'id':_settings[_0x2ae0('0x1f')]}});}})[_0x2ae0('0x1a')](function(_0x5cbc2b){if(!_0x5cbc2b){throw new db[(_0x2ae0('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5cbc2b['data1']||!_0x5cbc2b[_0x2ae0('0xe')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592359=_0x5cbc2b;logger['info'](util['format'](_0x2ae0('0x26'),_0x5bacbc['id']));return sentiment(_0x592359['data1'],_0x592359[_0x2ae0('0xe')],_0x373bd7[_0x2ae0('0x27')],_0x4a0750['fileText'],_0x373bd7[_0x2ae0('0x20')]);})[_0x2ae0('0x1a')](function(_0x43d9e9){logger[_0x2ae0('0x9')](util['format'](_0x2ae0('0x28'),_0x5bacbc['id']));return _0x5bacbc[_0x2ae0('0x29')]({'sentiment':_0x43d9e9[_0x2ae0('0x2a')],'sPositive':_0x43d9e9['SentimentScore']['Positive'],'sNegative':_0x43d9e9[_0x2ae0('0x2b')]['Negative'],'sMixed':_0x43d9e9[_0x2ae0('0x2b')][_0x2ae0('0x2c')],'sNeutral':_0x43d9e9[_0x2ae0('0x2b')][_0x2ae0('0x2d')]});})['then'](function(){logger[_0x2ae0('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5bacbc['id']));_0x4400c5();});case _0x2ae0('0x2e'):return _0x5bacbc['update']({'transcribeStatus':_0x2ae0('0x2e'),'failureReason':_0xf69015[_0x2ae0('0x11')]['FailureReason']})[_0x2ae0('0x1a')](function(){logger['info'](util[_0x2ae0('0xa')](_0x2ae0('0x1b'),_0x5bacbc['id']));_0x4400c5();});default:logger['info'](util[_0x2ae0('0xa')](_0x2ae0('0x2f'),_0x5bacbc['id']));break;}}else{return BPromise[_0x2ae0('0x30')]()[_0x2ae0('0x1a')](function(){if(!_0x5bacbc['tempSentiment']){throw new db[(_0x2ae0('0x1c'))]['ValidationError'](_0x2ae0('0x1e'));}if(!_0x373bd7['sentiment']||!_0x373bd7[_0x2ae0('0x1f')]||!_0x373bd7['sentimentRegion']||!_0x373bd7[_0x2ae0('0x20')]||!_0x373bd7['bucket']){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x22'));}if(!_0x5bacbc[_0x2ae0('0x17')]){throw new Error(_0x2ae0('0x23'));}if(_0x373bd7['sentimentAccountId']===_0x186336['id']){return _0x186336;}else{return db[_0x2ae0('0x24')][_0x2ae0('0x25')]({'where':{'id':_settings[_0x2ae0('0x1f')]}});}})[_0x2ae0('0x1a')](function(_0x367822){if(!_0x367822){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x31'));}if(!_0x367822['data1']||!_0x367822['data2']){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592359=_0x367822;logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5bacbc['id']));return sentiment(_0x592359['data1'],_0x592359[_0x2ae0('0xe')],_0x373bd7[_0x2ae0('0x27')],_0x5bacbc['fileText'],_0x373bd7['language']);})[_0x2ae0('0x1a')](function(_0x12b300){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x28'),_0x5bacbc['id']));return _0x5bacbc[_0x2ae0('0x29')]({'sentiment':_0x12b300[_0x2ae0('0x2a')],'sPositive':_0x12b300[_0x2ae0('0x2b')][_0x2ae0('0x32')],'sNegative':_0x12b300[_0x2ae0('0x2b')]['Negative'],'sMixed':_0x12b300['SentimentScore'][_0x2ae0('0x2c')],'sNeutral':_0x12b300[_0x2ae0('0x2b')]['Neutral'],'transcribeStatus':_0x2ae0('0x13')});})[_0x2ae0('0x1a')](function(){logger[_0x2ae0('0x9')](util[_0x2ae0('0xa')](_0x2ae0('0x1b'),_0x5bacbc['id']));_0x4400c5();});}})[_0x2ae0('0x33')](function(_0x3be541){if(_0x3be541){if(!_0x3be541[_0x2ae0('0x34')]||_0x3be541[_0x2ae0('0x34')]!==_0x2ae0('0x35')){logger['error'](util[_0x2ae0('0xa')](_0x2ae0('0x36'),_0x5bacbc['id']),util[_0x2ae0('0x37')](_0x3be541,{'showHidden':![],'depth':null}));}}_0x4400c5();});});}function checkTranscribe(){var _0x2193fa;var _0x1ac815;var _0x1b374b;return db[_0x2ae0('0x38')][_0x2ae0('0x39')]({'where':{'transcribeStatus':_0x2ae0('0x3a')}})[_0x2ae0('0x1a')](function(_0x151cba){if(!_0x151cba||!_0x151cba[_0x2ae0('0x3b')]){throw new db['Sequelize'][(_0x2ae0('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2193fa=_0x151cba;return db[_0x2ae0('0x3c')][_0x2ae0('0x25')]({'where':{'id':0x1}});})['then'](function(_0x45053f){if(!_0x45053f){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))](_0x2ae0('0x3d'));}_0x1ac815=_0x45053f;if(!_0x1ac815['transcribe']||!_0x1ac815[_0x2ae0('0x3e')]||!_0x1ac815[_0x2ae0('0xf')]||!_0x1ac815[_0x2ae0('0x20')]||!_0x1ac815[_0x2ae0('0x21')]){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x2ae0('0x24')]['findOne']({'where':{'id':_0x1ac815[_0x2ae0('0x3e')]}});})[_0x2ae0('0x1a')](function(_0x3aa6e1){if(!_0x3aa6e1){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3aa6e1[_0x2ae0('0xd')]||!_0x3aa6e1[_0x2ae0('0xe')]){throw new db[(_0x2ae0('0x1c'))][(_0x2ae0('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x1b374b=_0x3aa6e1;var _0x5356ca=[];_0x2193fa['forEach'](function(_0x1da8a1){_0x5356ca[_0x2ae0('0x3f')](checkTranscribeJob(_0x1da8a1,_0x1ac815,_0x1b374b));});return BPromise[_0x2ae0('0x40')](_0x5356ca);})['catch'](function(_0x54ddea){if(_0x54ddea){if(!_0x54ddea[_0x2ae0('0x34')]||_0x54ddea[_0x2ae0('0x34')]!==_0x2ae0('0x35')){logger['error'](util[_0x2ae0('0x37')](_0x54ddea,{'showHidden':![],'depth':null}));}}});}exports[_0x2ae0('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x198d=['FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','Setting','forEach','push','all','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','SentimentScore','Positive','Negative','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED'];(function(_0x196e02,_0x309998){var _0x3bdb56=function(_0x35f7f7){while(--_0x35f7f7){_0x196e02['push'](_0x196e02['shift']());}};_0x3bdb56(++_0x309998);}(_0x198d,0x1b7));var _0xd198=function(_0x3f88bc,_0x5ae966){_0x3f88bc=_0x3f88bc-0x0;var _0x31825b=_0x198d[_0x3f88bc];return _0x31825b;};var _=require(_0xd198('0x0'));var AWS=require(_0xd198('0x1'));var rp=require(_0xd198('0x2'));var util=require(_0xd198('0x3'));var BPromise=require(_0xd198('0x4'));var db=require(_0xd198('0x5'))['db'];var logger=require(_0xd198('0x6'))(_0xd198('0x7'));function getTranscriptionJob(_0xc0ba1a,_0x2eb4eb,_0x4014da,_0x215f75){return new Promise(function(_0x25b4f6,_0x328d8b){var _0x368216=new AWS[(_0xd198('0x8'))]({'accessKeyId':_0x2eb4eb,'secretAccessKey':_0xc0ba1a,'region':_0x4014da});_0x368216[_0xd198('0x9')]({'TranscriptionJobName':_0x215f75},function(_0x3f5fa4,_0x4c7f48){if(_0x3f5fa4){return _0x328d8b(_0x3f5fa4);}else{return _0x25b4f6(_0x4c7f48);}});});}function sentiment(_0x5c05a4,_0x33f127,_0x556c0d,_0xce1b5a,_0x168e72){return new Promise(function(_0x56013d,_0x3ed211){var _0x5eecb0=new AWS[(_0xd198('0xa'))]({'accessKeyId':_0x33f127,'secretAccessKey':_0x5c05a4,'region':_0x556c0d});_0x5eecb0['detectSentiment']({'Text':_0xce1b5a,'LanguageCode':_0x168e72[_0xd198('0xb')](0x0,0x2)},function(_0x1b5e22,_0x1120ad){if(_0x1b5e22){return _0x3ed211(_0x1b5e22);}else{return _0x56013d(_0x1120ad);}});});}function checkTranscribeJob(_0x2a9ebe,_0x4b1c96,_0xdab6d8){var _0x32db9c;return new BPromise(function(_0x4802df,_0x5cb404){logger[_0xd198('0xc')](util[_0xd198('0xd')](_0xd198('0xe'),_0x2a9ebe['id'],_0x2a9ebe[_0xd198('0xf')]));return getTranscriptionJob(_0xdab6d8[_0xd198('0x10')],_0xdab6d8[_0xd198('0x11')],_0x4b1c96['transcribeRegion'],_0x2a9ebe['transcribeName'])[_0xd198('0x12')](function(_0x3dbe5c){logger['info'](util['format'](_0xd198('0x13'),_0x2a9ebe['id'],_0x2a9ebe[_0xd198('0xf')],_0x3dbe5c[_0xd198('0x14')][_0xd198('0x15')]));if(!_0x2a9ebe[_0xd198('0x16')]){switch(_0x3dbe5c['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x749c29={'transcribeStatus':_0x3dbe5c[_0xd198('0x14')][_0xd198('0x15')],'fileUri':_0x3dbe5c[_0xd198('0x14')][_0xd198('0x17')][_0xd198('0x18')]};logger[_0xd198('0xc')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2a9ebe['id']));return rp({'uri':_0x3dbe5c[_0xd198('0x14')][_0xd198('0x17')]['TranscriptFileUri'],'json':!![]})[_0xd198('0x12')](function(_0x511806){logger[_0xd198('0xc')](util[_0xd198('0xd')](_0xd198('0x19'),_0x2a9ebe['id']));if(_0x511806&&_0x511806[_0xd198('0x1a')]&&_0x511806[_0xd198('0x1a')][_0xd198('0x1b')]&&_0x511806[_0xd198('0x1a')][_0xd198('0x1b')][_0xd198('0x1c')]){_0x749c29['fileText']='';for(var _0xc5bd74=0x0;_0xc5bd74<_0x511806[_0xd198('0x1a')]['transcripts'][_0xd198('0x1c')];_0xc5bd74++){_0x749c29[_0xd198('0x16')]+=_0x511806['results']['transcripts'][_0xc5bd74][_0xd198('0x1d')]+'';}}return _0x2a9ebe[_0xd198('0x1e')](_0x749c29);})[_0xd198('0x12')](function(){logger[_0xd198('0xc')](util[_0xd198('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a9ebe['id']));if(!_0x2a9ebe[_0xd198('0x1f')]){throw new db['Sequelize'][(_0xd198('0x20'))](_0xd198('0x21'));}if(!_0x4b1c96[_0xd198('0x22')]||!_0x4b1c96['sentimentAccountId']||!_0x4b1c96[_0xd198('0x23')]||!_0x4b1c96[_0xd198('0x24')]||!_0x4b1c96['bucket']){throw new db['Sequelize'][(_0xd198('0x20'))](_0xd198('0x25'));}if(!_0x749c29[_0xd198('0x16')]){throw new Error(_0xd198('0x26'));}if(_0x4b1c96[_0xd198('0x27')]===_0xdab6d8['id']){return _0xdab6d8;}else{return db[_0xd198('0x28')][_0xd198('0x29')]({'where':{'id':_settings[_0xd198('0x27')]}});}})[_0xd198('0x12')](function(_0x857020){if(!_0x857020){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))](_0xd198('0x2b'));}if(!_0x857020['data1']||!_0x857020['data2']){throw new db['Sequelize']['ValidationError'](_0xd198('0x2c'));}_0x32db9c=_0x857020;logger[_0xd198('0xc')](util['format'](_0xd198('0x2d'),_0x2a9ebe['id']));return sentiment(_0x32db9c[_0xd198('0x10')],_0x32db9c[_0xd198('0x11')],_0x4b1c96[_0xd198('0x23')],_0x749c29['fileText'],_0x4b1c96[_0xd198('0x24')]);})[_0xd198('0x12')](function(_0x571f96){logger[_0xd198('0xc')](util[_0xd198('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2a9ebe['id']));return _0x2a9ebe[_0xd198('0x1e')]({'sentiment':_0x571f96['Sentiment'],'sPositive':_0x571f96[_0xd198('0x2e')][_0xd198('0x2f')],'sNegative':_0x571f96[_0xd198('0x2e')][_0xd198('0x30')],'sMixed':_0x571f96['SentimentScore']['Mixed'],'sNeutral':_0x571f96[_0xd198('0x2e')]['Neutral']});})[_0xd198('0x12')](function(){logger[_0xd198('0xc')](util[_0xd198('0xd')](_0xd198('0x31'),_0x2a9ebe['id']));_0x4802df();});case _0xd198('0x32'):return _0x2a9ebe[_0xd198('0x1e')]({'transcribeStatus':_0xd198('0x32'),'failureReason':_0x3dbe5c['TranscriptionJob'][_0xd198('0x33')]})[_0xd198('0x12')](function(){logger[_0xd198('0xc')](util[_0xd198('0xd')](_0xd198('0x31'),_0x2a9ebe['id']));_0x4802df();});default:logger[_0xd198('0xc')](util[_0xd198('0xd')](_0xd198('0x34'),_0x2a9ebe['id']));break;}}else{return BPromise[_0xd198('0x35')]()[_0xd198('0x12')](function(){if(!_0x2a9ebe[_0xd198('0x1f')]){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))](_0xd198('0x21'));}if(!_0x4b1c96[_0xd198('0x22')]||!_0x4b1c96[_0xd198('0x27')]||!_0x4b1c96[_0xd198('0x23')]||!_0x4b1c96[_0xd198('0x24')]||!_0x4b1c96[_0xd198('0x36')]){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2a9ebe['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x4b1c96[_0xd198('0x27')]===_0xdab6d8['id']){return _0xdab6d8;}else{return db[_0xd198('0x28')][_0xd198('0x29')]({'where':{'id':_settings[_0xd198('0x27')]}});}})[_0xd198('0x12')](function(_0x17f66b){if(!_0x17f66b){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))](_0xd198('0x2b'));}if(!_0x17f66b[_0xd198('0x10')]||!_0x17f66b[_0xd198('0x11')]){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x32db9c=_0x17f66b;logger['info'](util[_0xd198('0xd')](_0xd198('0x2d'),_0x2a9ebe['id']));return sentiment(_0x32db9c[_0xd198('0x10')],_0x32db9c['data2'],_0x4b1c96['sentimentRegion'],_0x2a9ebe[_0xd198('0x16')],_0x4b1c96[_0xd198('0x24')]);})[_0xd198('0x12')](function(_0x469ad0){logger[_0xd198('0xc')](util[_0xd198('0xd')](_0xd198('0x37'),_0x2a9ebe['id']));return _0x2a9ebe['update']({'sentiment':_0x469ad0['Sentiment'],'sPositive':_0x469ad0[_0xd198('0x2e')]['Positive'],'sNegative':_0x469ad0[_0xd198('0x2e')]['Negative'],'sMixed':_0x469ad0[_0xd198('0x2e')][_0xd198('0x38')],'sNeutral':_0x469ad0[_0xd198('0x2e')][_0xd198('0x39')],'transcribeStatus':_0xd198('0x3a')});})[_0xd198('0x12')](function(){logger[_0xd198('0xc')](util[_0xd198('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2a9ebe['id']));_0x4802df();});}})[_0xd198('0x3b')](function(_0x27a147){if(_0x27a147){if(!_0x27a147[_0xd198('0x3c')]||_0x27a147['name']!==_0xd198('0x3d')){logger[_0xd198('0x3e')](util[_0xd198('0xd')](_0xd198('0x3f'),_0x2a9ebe['id']),util['inspect'](_0x27a147,{'showHidden':![],'depth':null}));}}_0x4802df();});});}function checkTranscribe(){var _0x2786d9;var _0xf34795;var _0x3bdb1c;return db['VoiceRecording'][_0xd198('0x40')]({'where':{'transcribeStatus':_0xd198('0x41')}})['then'](function(_0x2a4973){if(!_0x2a4973||!_0x2a4973[_0xd198('0x1c')]){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2786d9=_0x2a4973;return db[_0xd198('0x42')]['findOne']({'where':{'id':0x1}});})[_0xd198('0x12')](function(_0x1362a1){if(!_0x1362a1){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))]('Settings\x20not\x20available');}_0xf34795=_0x1362a1;if(!_0xf34795[_0xd198('0x7')]||!_0xf34795['transcribeAccountId']||!_0xf34795['transcribeRegion']||!_0xf34795[_0xd198('0x24')]||!_0xf34795['bucket']){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))]('Transcribe\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0xf34795['transcribeAccountId']}});})['then'](function(_0x56c2d3){if(!_0x56c2d3){throw new db['Sequelize'][(_0xd198('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x56c2d3[_0xd198('0x10')]||!_0x56c2d3['data2']){throw new db[(_0xd198('0x2a'))][(_0xd198('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x3bdb1c=_0x56c2d3;var _0x16c88d=[];_0x2786d9[_0xd198('0x43')](function(_0x384bbe){_0x16c88d[_0xd198('0x44')](checkTranscribeJob(_0x384bbe,_0xf34795,_0x3bdb1c));});return BPromise[_0xd198('0x45')](_0x16c88d);})[_0xd198('0x3b')](function(_0x5755b8){if(_0x5755b8){if(!_0x5755b8[_0xd198('0x3c')]||_0x5755b8[_0xd198('0x3c')]!=='SequelizeValidationError'){logger[_0xd198('0x3e')](util['inspect'](_0x5755b8,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index d7c8031..be6f5d9 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc68e=['redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','util','../../config/environment','../../mysqldb','../logger','schedule','defaults'];(function(_0x55b606,_0x4c0d6a){var _0x35826a=function(_0x526cf6){while(--_0x526cf6){_0x55b606['push'](_0x55b606['shift']());}};_0x35826a(++_0x4c0d6a);}(_0xc68e,0xb3));var _0xec68=function(_0x11456d,_0x238968){_0x11456d=_0x11456d-0x0;var _0x2d058c=_0xc68e[_0x11456d];return _0x2d058c;};'use strict';var _=require(_0xec68('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xec68('0x1'));var config=require(_0xec68('0x2'));var db=require(_0xec68('0x3'))['db'];var logger=require(_0xec68('0x4'))(_0xec68('0x5'));config['redis']=_[_0xec68('0x6')](config[_0xec68('0x7')],{'host':_0xec68('0x8'),'port':0x18eb});var io=require(_0xec68('0x9'))(new Redis(config[_0xec68('0x7')]));function closeInteractions(){var _0xb82880=[];return db[_0xec68('0xa')][_0xec68('0xb')]({'raw':!![],'attributes':['id',_0xec68('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xec68('0xd'))}}})[_0xec68('0xe')](function(_0x3515bb){if(_0x3515bb&&_0x3515bb[_0xec68('0xf')]){_0xb82880=_[_0xec68('0x10')](_0x3515bb||[],'id');logger[_0xec68('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xb82880['join']());return db[_0xec68('0xa')][_0xec68('0x12')]({'closeReason':_0xec68('0x13'),'disposition':_0xec68('0x14'),'closed':!![],'closedAt':moment()['format'](_0xec68('0x15'))},{'where':{'id':_0xb82880}});}})['then'](function(){if(_0xb82880&&_0xb82880[_0xec68('0xf')]){logger[_0xec68('0x11')](_0xec68('0x16'),_0xb82880[_0xec68('0x17')]());for(var _0x590fef=0x0;_0x590fef<_0xb82880[_0xec68('0xf')];_0x590fef++){io[_0xec68('0x18')](_0xec68('0x19'),{'id':_0xb82880[_0x590fef],'closed':!![]});}}})[_0xec68('0x1a')](function(_0x54e69e){logger[_0xec68('0x1b')](_0xec68('0x1c'),_0x54e69e?util[_0xec68('0x1d')](_0x54e69e,{'showHidden':![],'depth':null}):'');});}exports[_0xec68('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb1ad=['join','update','system','timeout','format','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x27ff96,_0x3ecbe4){var _0x27957c=function(_0x331822){while(--_0x331822){_0x27ff96['push'](_0x27ff96['shift']());}};_0x27957c(++_0x3ecbe4);}(_0xb1ad,0xd8));var _0xdb1a=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xb1ad[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xdb1a('0x0'));var moment=require(_0xdb1a('0x1'));var Redis=require('ioredis');var util=require(_0xdb1a('0x2'));var config=require(_0xdb1a('0x3'));var db=require(_0xdb1a('0x4'))['db'];var logger=require(_0xdb1a('0x5'))('schedule');config[_0xdb1a('0x6')]=_[_0xdb1a('0x7')](config[_0xdb1a('0x6')],{'host':_0xdb1a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0xe2e04b=[];return db[_0xdb1a('0x9')][_0xdb1a('0xa')]({'raw':!![],'attributes':['id',_0xdb1a('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xdb1a('0xc'))}}})[_0xdb1a('0xd')](function(_0x463458){if(_0x463458&&_0x463458['length']){_0xe2e04b=_[_0xdb1a('0xe')](_0x463458||[],'id');logger['info'](_0xdb1a('0xf'),_0xe2e04b[_0xdb1a('0x10')]());return db[_0xdb1a('0x9')][_0xdb1a('0x11')]({'closeReason':_0xdb1a('0x12'),'disposition':_0xdb1a('0x13'),'closed':!![],'closedAt':moment()[_0xdb1a('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xe2e04b}});}})[_0xdb1a('0xd')](function(){if(_0xe2e04b&&_0xe2e04b[_0xdb1a('0x15')]){logger[_0xdb1a('0x16')](_0xdb1a('0x17'),_0xe2e04b[_0xdb1a('0x10')]());for(var _0x3c323c=0x0;_0x3c323c<_0xe2e04b[_0xdb1a('0x15')];_0x3c323c++){io[_0xdb1a('0x18')]('whatsappInteraction:update',{'id':_0xe2e04b[_0x3c323c],'closed':!![]});}}})['catch'](function(_0x58c36b){logger[_0xdb1a('0x19')](_0xdb1a('0x1a'),_0x58c36b?util[_0xdb1a('0x1b')](_0x58c36b,{'showHidden':![],'depth':null}):'');});}exports[_0xdb1a('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 5d10e26..6dc3eab 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf9a=['destroy','then','bulkCreate','finished\x20populating','CmHopper','log','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact'];(function(_0xdf9b0a,_0x1acf1c){var _0x57fdc3=function(_0xa45e57){while(--_0xa45e57){_0xdf9b0a['push'](_0xdf9b0a['shift']());}};_0x57fdc3(++_0x1acf1c);}(_0xdf9a,0x1b1));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xadf9('0x0'));var db=require(_0xadf9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xadf9('0x2')]({'id':i,'firstName':_0xadf9('0x3')+i,'lastName':_0xadf9('0x4')+i,'phone':0xf879fb460+i,'email':_0xadf9('0x5')+i+_0xadf9('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xadf9('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xadf9('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xadf9('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xadf9('0x2')]({'id':i,'firstName':_0xadf9('0x3')+i,'lastName':_0xadf9('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xadf9('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xadf9('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xadf9('0x7')](),'updatedAt':Date[_0xadf9('0x7')]()});}db[_0xadf9('0x8')][_0xadf9('0x9')]({'where':{}})[_0xadf9('0xa')](function(){return db[_0xadf9('0x8')][_0xadf9('0xb')](contacts);})[_0xadf9('0xa')](function(){console['log'](_0xadf9('0xc'),'contacts1');return db[_0xadf9('0xd')][_0xadf9('0x9')]({'where':{}});})[_0xadf9('0xa')](function(){return db[_0xadf9('0xd')][_0xadf9('0xb')](hopper);})[_0xadf9('0xa')](function(){console['log'](_0xadf9('0xc'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0xadf9('0xa')](function(){console[_0xadf9('0xe')](_0xadf9('0xc'),_0xadf9('0xf'));return db[_0xadf9('0xd')]['bulkCreate'](hopper2);})[_0xadf9('0xa')](function(){console[_0xadf9('0xe')]('finished\x20populating',_0xadf9('0x10'));})['catch'](function(_0x2c4359){console[_0xadf9('0xe')](_0x2c4359);}); \ No newline at end of file +var _0xe0b0=['bulkCreate','log','contacts1','CmHopper','destroy','finished\x20populating','hopper1','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','then'];(function(_0x232293,_0x34a3d7){var _0x127872=function(_0x458e58){while(--_0x458e58){_0x232293['push'](_0x232293['shift']());}};_0x127872(++_0x34a3d7);}(_0xe0b0,0xd4));var _0x0e0b=function(_0x1266b4,_0x513c9c){_0x1266b4=_0x1266b4-0x0;var _0x1632f5=_0xe0b0[_0x1266b4];return _0x1632f5;};'use strict';var util=require(_0x0e0b('0x0'));var db=require(_0x0e0b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x0e0b('0x2')]({'id':i,'firstName':_0x0e0b('0x3')+i,'lastName':_0x0e0b('0x4')+i,'phone':0xf879fb460+i,'email':_0x0e0b('0x5')+i+_0x0e0b('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x0e0b('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0e0b('0x7')](),'updatedAt':Date[_0x0e0b('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0e0b('0x2')]({'id':i,'firstName':_0x0e0b('0x3')+i,'lastName':_0x0e0b('0x4')+i,'phone':0xf879fb460+i,'email':_0x0e0b('0x5')+i+_0x0e0b('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0e0b('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x0e0b('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0e0b('0x7')]()});}db['CmContact']['destroy']({'where':{}})[_0x0e0b('0x8')](function(){return db['CmContact'][_0x0e0b('0x9')](contacts);})[_0x0e0b('0x8')](function(){console[_0x0e0b('0xa')]('finished\x20populating',_0x0e0b('0xb'));return db[_0x0e0b('0xc')][_0x0e0b('0xd')]({'where':{}});})['then'](function(){return db[_0x0e0b('0xc')][_0x0e0b('0x9')](hopper);})[_0x0e0b('0x8')](function(){console[_0x0e0b('0xa')](_0x0e0b('0xe'),_0x0e0b('0xf'));return db['CmContact'][_0x0e0b('0x9')](contacts2);})[_0x0e0b('0x8')](function(){console[_0x0e0b('0xa')]('finished\x20populating','contacts2');return db[_0x0e0b('0xc')]['bulkCreate'](hopper2);})[_0x0e0b('0x8')](function(){console[_0x0e0b('0xa')](_0x0e0b('0xe'),'hopper2');})[_0x0e0b('0x10')](function(_0xad6530){console[_0x0e0b('0xa')](_0xad6530);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9c729c7..9d48fb9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51d2=['format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','log','util','push'];(function(_0x1c6c5e,_0x34c672){var _0x10abfc=function(_0x48d95c){while(--_0x48d95c){_0x1c6c5e['push'](_0x1c6c5e['shift']());}};_0x10abfc(++_0x34c672);}(_0x51d2,0x8a));var _0x251d=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0x51d2[_0x364b32];return _0x3f3ea0;};'use strict';var util=require(_0x251d('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x251d('0x1')]({'name':util[_0x251d('0x2')](_0x251d('0x3'),_0x251d('0x4'),i),'fullname':util[_0x251d('0x2')](_0x251d('0x3'),_0x251d('0x4'),i),'email':util[_0x251d('0x2')](_0x251d('0x5'),'agent',i),'role':'agent','password':_0x251d('0x6'),'internal':0xfa0+i,'type':_0x251d('0x7'),'transport':[_0x251d('0x8'),'ws',_0x251d('0x9')],'disallow':[_0x251d('0xa')],'allow':['ulaw'],'defaultuser':util[_0x251d('0x2')]('%s%s',_0x251d('0x4'),i),'encryption':_0x251d('0xb'),'avpf':'yes','force_avp':_0x251d('0xb'),'icesupport':_0x251d('0xb'),'dtlsenable':_0x251d('0xb'),'dtlsverify':'no','dtlscertfile':_0x251d('0xc'),'dtlsprivatekey':_0x251d('0xd'),'dtlssetup':'actpass','callerid':util[_0x251d('0x2')](_0x251d('0xe'),util[_0x251d('0x2')](_0x251d('0x3'),'agent',i),0xfa0+i)});}db[_0x251d('0xf')][_0x251d('0x10')](users)[_0x251d('0x11')](function(){console['log'](_0x251d('0x12'));})['catch'](function(_0x20b303){console[_0x251d('0x13')](_0x20b303);}); \ No newline at end of file +var _0x3dfa=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','push','%s%s','agent','format','%s%s@xcally.com','password','friend','wss'];(function(_0x2bbbfe,_0x3f8d0d){var _0x1fe553=function(_0x37f34e){while(--_0x37f34e){_0x2bbbfe['push'](_0x2bbbfe['shift']());}};_0x1fe553(++_0x3f8d0d);}(_0x3dfa,0x137));var _0xa3df=function(_0x5c3834,_0x2f4bcc){_0x5c3834=_0x5c3834-0x0;var _0x415f97=_0x3dfa[_0x5c3834];return _0x415f97;};'use strict';var util=require(_0xa3df('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa3df('0x1')]({'name':util['format'](_0xa3df('0x2'),_0xa3df('0x3'),i),'fullname':util[_0xa3df('0x4')](_0xa3df('0x2'),_0xa3df('0x3'),i),'email':util[_0xa3df('0x4')](_0xa3df('0x5'),_0xa3df('0x3'),i),'role':_0xa3df('0x3'),'password':_0xa3df('0x6'),'internal':0xfa0+i,'type':_0xa3df('0x7'),'transport':['udp','ws',_0xa3df('0x8')],'disallow':[_0xa3df('0x9')],'allow':[_0xa3df('0xa')],'defaultuser':util[_0xa3df('0x4')](_0xa3df('0x2'),_0xa3df('0x3'),i),'encryption':_0xa3df('0xb'),'avpf':'yes','force_avp':_0xa3df('0xb'),'icesupport':'yes','dtlsenable':_0xa3df('0xb'),'dtlsverify':'no','dtlscertfile':_0xa3df('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xa3df('0xd'),'callerid':util[_0xa3df('0x4')](_0xa3df('0xe'),util[_0xa3df('0x4')](_0xa3df('0x2'),_0xa3df('0x3'),i),0xfa0+i)});}db[_0xa3df('0xf')][_0xa3df('0x10')](users)[_0xa3df('0x11')](function(){console[_0xa3df('0x12')](_0xa3df('0x13'));})['catch'](function(_0x4facc7){console[_0xa3df('0x12')](_0x4facc7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d348d09..7af7f0e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f61=['getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','format','trunk:%s','campaign:%s:%s','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','Agents','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','push','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueue','OpenchannelQueues','OpenchannelQueue','IvrCampaigns','getFaxQueues','getSmsQueues','getMailQueues'];(function(_0x24ad8c,_0x526e8d){var _0x389053=function(_0x50b662){while(--_0x50b662){_0x24ad8c['push'](_0x24ad8c['shift']());}};_0x389053(++_0x526e8d);}(_0x4f61,0x149));var _0x14f6=function(_0x5ae692,_0x631e92){_0x5ae692=_0x5ae692-0x0;var _0x2d9609=_0x4f61[_0x5ae692];return _0x2d9609;};'use strict';var _=require(_0x14f6('0x0'));var util=require(_0x14f6('0x1'));var BPromise=require(_0x14f6('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x14f6('0x3'));var queryQueues={'attributes':['id',_0x14f6('0x4')],'include':[{'as':'Agents','model':db[_0x14f6('0x5')],'attributes':['id',_0x14f6('0x4'),_0x14f6('0x6')],'raw':!![],'where':{'role':_0x14f6('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x14f6('0x4')],'where':{'role':_0x14f6('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x14f6('0x4')],'where':{'role':_0x14f6('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x14f6('0x4'),_0x14f6('0x9')],'where':{'type':_0x14f6('0xa')}};function getAssociatedResources(_0x50344c,_0x39feb6,_0x1b7c50){return db[_0x14f6('0xb')]['findOne']({'where':{'name':_0x50344c,'userProfileId':_0x39feb6},'raw':!![]})[_0x14f6('0xc')](function(_0x45cbd3){if(_0x45cbd3){if(_0x45cbd3['autoAssociation']){switch(_0x50344c){case _0x14f6('0xd'):case _0x14f6('0xe'):case _0x14f6('0xf'):case _0x14f6('0x10'):case _0x14f6('0x11'):case'OpenchannelQueues':case _0x14f6('0x12'):return db[_0x1b7c50][_0x14f6('0x13')](queryQueues);case _0x14f6('0x14'):return db[_0x1b7c50][_0x14f6('0x13')](queryTelephones);case _0x14f6('0x15'):return db[_0x1b7c50][_0x14f6('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x1b7c50][_0x14f6('0x13')](queryCampaigns);}}else{return db[_0x14f6('0x16')]['findAll']({'attributes':[_0x14f6('0x17')],'where':{'sectionId':_0x45cbd3['id']},'raw':!![]})[_0x14f6('0xc')](function(_0x305f24){if(_0x305f24){var _0x24f3d8={'where':{'id':_[_0x14f6('0x18')](_0x305f24,_0x14f6('0x17'))},'raw':!![]};switch(_0x1b7c50){case _0x14f6('0x5'):_0x24f3d8[_0x14f6('0x19')][_0x14f6('0x6')]=_0x14f6('0x8');break;case _0x14f6('0x1a'):_0x24f3d8['where'][_0x14f6('0x9')]=_0x14f6('0xa');break;}return db[_0x1b7c50][_0x14f6('0x13')](_0x24f3d8);}else{return[];}});}}else{return[];}})[_0x14f6('0xc')](function(_0x4fd7b1){return _0x4fd7b1;});}function joinOrLeaveQueues(_0x4d8ae6,_0x59f56c,_0x16a9b8,_0x1dae57){_0x4d8ae6[_0x59f56c](util['format'](_0x14f6('0x1b'),_0x16a9b8,_0x1dae57[_0x14f6('0x4')]));if(_0x1dae57[_0x14f6('0x1c')]){for(var _0xd47ce8=0x0;_0xd47ce8<_0x1dae57['Agents'][_0x14f6('0x1d')];_0xd47ce8+=0x1){_0x4d8ae6[_0x59f56c](util['format'](_0x14f6('0x1e'),_0x1dae57[_0x14f6('0x1c')][_0xd47ce8]['name']));}}}function joinOrLeave(_0x427245,_0x4c2935,_0x336956){var _0x4914d9;if(_0x427245[_0x14f6('0x1f')][_0x14f6('0x20')]['id']){db[_0x14f6('0x5')]['find']({'attributes':['id','name',_0x14f6('0x6'),_0x14f6('0x21')],'where':{'id':_0x427245['handshake']['query']['id']},'include':[{'model':db[_0x14f6('0x22')],'as':_0x14f6('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x24')],'as':_0x14f6('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x26')],'as':_0x14f6('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x28')],'as':_0x14f6('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x2a')],'as':_0x14f6('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x14f6('0x2c')],'as':_0x14f6('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x14f6('0xc')](function(_0x4fb81d){if(_0x4fb81d){_0x4914d9=_0x4fb81d;_0x427245[_0x4c2935](util['format']('user:%s',_0x4fb81d[_0x14f6('0x4')]));var _0x3481ba=[];switch(_0x4fb81d['role']){case _0x14f6('0x2e'):_0x427245[_0x4c2935]('voice:inbound');_0x427245[_0x4c2935](_0x14f6('0x2f'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x3481ba[_0x14f6('0x30')](db['VoiceQueue']['findAll'](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x31')]['findAll'](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x32')][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db['SmsQueue'][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x33')][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db['OpenchannelQueue']['findAll'](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x34')][_0x14f6('0x13')](queryQueues));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x5')]['findAll'](queryTelephones));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x35')]['findAll'](queryTrunks));_0x3481ba[_0x14f6('0x30')](db['Campaign']['findAll'](queryCampaigns));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x5')][_0x14f6('0x13')](queryAgents));break;case _0x14f6('0x36'):_0x427245[_0x4c2935](_0x14f6('0x37'));_0x427245[_0x4c2935](_0x14f6('0x2f'));_0x3481ba['push'](getAssociatedResources(_0x14f6('0xd'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x38')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0xe'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x31')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0xf'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x32')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x10'),_0x4fb81d[_0x14f6('0x21')],'SmsQueue'));_0x3481ba[_0x14f6('0x30')](getAssociatedResources('MailQueues',_0x4fb81d[_0x14f6('0x21')],'MailQueue'));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x39'),_0x4fb81d['userProfileId'],_0x14f6('0x3a')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x12'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x34')));_0x3481ba['push'](getAssociatedResources(_0x14f6('0x14'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x5')));_0x3481ba[_0x14f6('0x30')](getAssociatedResources(_0x14f6('0x15'),_0x4fb81d['userProfileId'],'Trunk'));_0x3481ba['push'](getAssociatedResources(_0x14f6('0x3b'),_0x4fb81d[_0x14f6('0x21')],_0x14f6('0x1a')));_0x3481ba[_0x14f6('0x30')](db[_0x14f6('0x5')][_0x14f6('0x13')](queryAgents));break;case _0x14f6('0x7'):_0x427245[_0x4c2935](_0x14f6('0x37'));_0x427245[_0x4c2935]('voice:outbound');_0x3481ba[_0x14f6('0x30')](_0x4fb81d['getVoiceQueues']({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d['getChatQueues']({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x3c')]({'attributes':['id','name']}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x3d')]({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba['push'](_0x4fb81d[_0x14f6('0x3e')]({'attributes':['id','name']}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x3f')]({'attributes':['id',_0x14f6('0x4')]}));_0x3481ba[_0x14f6('0x30')](_0x4fb81d[_0x14f6('0x40')]({'attributes':['id',_0x14f6('0x4')]}));break;}return BPromise[_0x14f6('0x41')](_0x3481ba);}})['then'](function(_0x5ce88d){if(_0x5ce88d&&_0x5ce88d[_0x14f6('0x1d')]){for(var _0x28950b=0x0;_0x28950b<_0x5ce88d[_0x14f6('0x1d')];_0x28950b+=0x1){for(var _0x52a436=0x0;_0x52a436<_0x5ce88d[_0x28950b][_0x14f6('0x1d')];_0x52a436+=0x1){switch(_0x28950b){case 0x0:joinOrLeaveQueues(_0x427245,_0x4c2935,'voice',_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x1:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x42'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x2:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x43'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x3:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x44'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x4:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x45'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x5:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x46'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x6:joinOrLeaveQueues(_0x427245,_0x4c2935,_0x14f6('0x47'),_0x5ce88d[_0x28950b][_0x52a436]);break;case 0x7:if(_0x4914d9[_0x14f6('0x6')]!==_0x14f6('0x7'))_0x427245[_0x4c2935](util[_0x14f6('0x48')]('telephone:%s',_0x5ce88d[_0x28950b][_0x52a436]['name']));break;case 0x8:if(_0x4914d9[_0x14f6('0x6')]!==_0x14f6('0x7'))_0x427245[_0x4c2935](util[_0x14f6('0x48')](_0x14f6('0x49'),_0x5ce88d[_0x28950b][_0x52a436][_0x14f6('0x4')]));break;case 0x9:if(_0x4914d9['role']!==_0x14f6('0x7'))_0x427245[_0x4c2935](util[_0x14f6('0x48')](_0x14f6('0x4a'),_0x5ce88d[_0x28950b][_0x52a436][_0x14f6('0x9')],_0x5ce88d[_0x28950b][_0x52a436][_0x14f6('0x4')]));break;case 0xa:_0x427245[_0x4c2935](util['format'](_0x14f6('0x1e'),_0x5ce88d[_0x28950b][_0x52a436]['name']));break;}}}}})['then'](function(){if(_0x4c2935==='leave'){var _0x42edbe=_[_0x14f6('0x18')](_0x4914d9[_0x14f6('0x23')],'id');return _0x4914d9[_0x14f6('0x4b')](_0x42edbe)[_0x14f6('0xc')](function(){for(var _0x3429dd=0x0;_0x3429dd<_0x42edbe['length'];_0x3429dd+=0x1){_0x336956['emit'](_0x14f6('0x4c'),{'ChatInteractionId':Number(_0x42edbe[_0x3429dd]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935==='leave'){var _0x8348b2=_['map'](_0x4914d9[_0x14f6('0x25')],'id');return _0x4914d9[_0x14f6('0x4d')](_0x8348b2)[_0x14f6('0xc')](function(){for(var _0x53e14d=0x0;_0x53e14d<_0x8348b2[_0x14f6('0x1d')];_0x53e14d+=0x1){_0x336956[_0x14f6('0x4e')](_0x14f6('0x4f'),{'MailInteractionId':Number(_0x8348b2[_0x53e14d]),'UserId':Number(_0x4914d9['id'])});}});}})['then'](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x1cdd15=_[_0x14f6('0x18')](_0x4914d9[_0x14f6('0x27')],'id');return _0x4914d9[_0x14f6('0x51')](_0x1cdd15)['then'](function(){for(var _0x3cb064=0x0;_0x3cb064<_0x1cdd15[_0x14f6('0x1d')];_0x3cb064+=0x1){_0x336956[_0x14f6('0x4e')](_0x14f6('0x52'),{'FaxInteractionId':Number(_0x1cdd15[_0x3cb064]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x113f36=_['map'](_0x4914d9['SmsInteractions'],'id');return _0x4914d9[_0x14f6('0x53')](_0x113f36)[_0x14f6('0xc')](function(){for(var _0x2a0595=0x0;_0x2a0595<_0x113f36['length'];_0x2a0595+=0x1){_0x336956[_0x14f6('0x4e')](_0x14f6('0x54'),{'SmsInteractionId':Number(_0x113f36[_0x2a0595]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x516d24=_[_0x14f6('0x18')](_0x4914d9[_0x14f6('0x2b')],'id');return _0x4914d9['removeOpenchannelInteractions'](_0x516d24)[_0x14f6('0xc')](function(){for(var _0x58bc7a=0x0;_0x58bc7a<_0x516d24['length'];_0x58bc7a+=0x1){_0x336956[_0x14f6('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x516d24[_0x58bc7a]),'UserId':Number(_0x4914d9['id'])});}});}})[_0x14f6('0xc')](function(){if(_0x4c2935===_0x14f6('0x50')){var _0x450cb4=_['map'](_0x4914d9['WhatsappInteractions'],'id');return _0x4914d9[_0x14f6('0x55')](_0x450cb4)[_0x14f6('0xc')](function(){for(var _0x46c891=0x0;_0x46c891<_0x450cb4['length'];_0x46c891+=0x1){_0x336956['emit'](_0x14f6('0x56'),{'WhatsappInteractionId':Number(_0x450cb4[_0x46c891]),'UserId':Number(_0x4914d9['id'])});}});}})['catch'](function(_0x48a14d){_0x427245['log'](_0x48a14d);});}}function onDisconnect(_0x3807b2,_0x295ea9){joinOrLeave(_0x3807b2,_0x14f6('0x50'),_0x295ea9);}function onConnect(_0x38e733){joinOrLeave(_0x38e733,'join');}exports['default']=function(_0x3e65db){_0x3e65db['on']('connection',function(_0x228fb9){_0x228fb9['setMaxListeners'](0x0);_0x228fb9[_0x14f6('0x57')]=_0x228fb9[_0x14f6('0x58')][_0x14f6('0x59')][_0x14f6('0x5a')]+':'+_0x228fb9[_0x14f6('0x58')][_0x14f6('0x59')][_0x14f6('0x5b')];_0x228fb9[_0x14f6('0x5c')]=new Date();_0x228fb9[_0x14f6('0x5d')]=function(_0x483d12){console[_0x14f6('0x5d')](_0x14f6('0x5e')+_0x228fb9[_0x14f6('0x5f')][_0x14f6('0x4')]+'['+_0x228fb9[_0x14f6('0x57')]+']',_0x483d12);};_0x228fb9['on']('disconnect',function(){onDisconnect(_0x228fb9,_0x3e65db);_0x228fb9[_0x14f6('0x5d')](_0x14f6('0x60'));});onConnect(_0x228fb9);_0x228fb9[_0x14f6('0x5d')](_0x14f6('0x61'));});}; \ No newline at end of file +var _0xdebe=['whatsapp','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','request','connectedAt','nsp','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','role','telephone','Campaign','where','type','format','%s:queue:%s','Agents','length','user:%s','handshake','query','userProfileId','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','SmsQueues','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','openchannel'];(function(_0x12fc65,_0x135b89){var _0x4c43b4=function(_0x35b9c1){while(--_0x35b9c1){_0x12fc65['push'](_0x12fc65['shift']());}};_0x4c43b4(++_0x135b89);}(_0xdebe,0x142));var _0xedeb=function(_0x66c2fb,_0x2843f9){_0x66c2fb=_0x66c2fb-0x0;var _0x5c122f=_0xdebe[_0x66c2fb];return _0x5c122f;};'use strict';var _=require(_0xedeb('0x0'));var util=require(_0xedeb('0x1'));var BPromise=require(_0xedeb('0x2'));var db=require(_0xedeb('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xedeb('0x4')],'include':[{'as':'Agents','model':db[_0xedeb('0x5')],'attributes':['id',_0xedeb('0x4'),'role'],'raw':!![],'where':{'role':_0xedeb('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xedeb('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xedeb('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xedeb('0x4'),'type'],'where':{'type':_0xedeb('0x7')}};function getAssociatedResources(_0x58538a,_0x412e7c,_0xfd527e){return db[_0xedeb('0x8')][_0xedeb('0x9')]({'where':{'name':_0x58538a,'userProfileId':_0x412e7c},'raw':!![]})[_0xedeb('0xa')](function(_0x586403){if(_0x586403){if(_0x586403[_0xedeb('0xb')]){switch(_0x58538a){case _0xedeb('0xc'):case _0xedeb('0xd'):case _0xedeb('0xe'):case'SmsQueues':case'MailQueues':case _0xedeb('0xf'):case _0xedeb('0x10'):return db[_0xfd527e][_0xedeb('0x11')](queryQueues);case _0xedeb('0x12'):return db[_0xfd527e]['findAll'](queryTelephones);case _0xedeb('0x13'):return db[_0xfd527e]['findAll'](queryTrunks);case _0xedeb('0x14'):return db[_0xfd527e][_0xedeb('0x11')](queryCampaigns);}}else{return db[_0xedeb('0x15')][_0xedeb('0x11')]({'attributes':[_0xedeb('0x16')],'where':{'sectionId':_0x586403['id']},'raw':!![]})[_0xedeb('0xa')](function(_0x385f93){if(_0x385f93){var _0x209b11={'where':{'id':_['map'](_0x385f93,_0xedeb('0x16'))},'raw':!![]};switch(_0xfd527e){case _0xedeb('0x5'):_0x209b11['where'][_0xedeb('0x17')]=_0xedeb('0x18');break;case _0xedeb('0x19'):_0x209b11[_0xedeb('0x1a')][_0xedeb('0x1b')]=_0xedeb('0x7');break;}return db[_0xfd527e][_0xedeb('0x11')](_0x209b11);}else{return[];}});}}else{return[];}})[_0xedeb('0xa')](function(_0x1bbc90){return _0x1bbc90;});}function joinOrLeaveQueues(_0x1323ec,_0x1fc8b8,_0x12270a,_0x15fd29){_0x1323ec[_0x1fc8b8](util[_0xedeb('0x1c')](_0xedeb('0x1d'),_0x12270a,_0x15fd29[_0xedeb('0x4')]));if(_0x15fd29['Agents']){for(var _0xc8359a=0x0;_0xc8359a<_0x15fd29[_0xedeb('0x1e')][_0xedeb('0x1f')];_0xc8359a+=0x1){_0x1323ec[_0x1fc8b8](util[_0xedeb('0x1c')](_0xedeb('0x20'),_0x15fd29[_0xedeb('0x1e')][_0xc8359a][_0xedeb('0x4')]));}}}function joinOrLeave(_0x1d1eba,_0x4bcaf4,_0xadf097){var _0x2b7051;if(_0x1d1eba[_0xedeb('0x21')][_0xedeb('0x22')]['id']){db[_0xedeb('0x5')]['find']({'attributes':['id','name',_0xedeb('0x17'),_0xedeb('0x23')],'where':{'id':_0x1d1eba['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xedeb('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xedeb('0x25')],'as':_0xedeb('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xedeb('0x27')],'as':_0xedeb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xedeb('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xedeb('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xedeb('0x2b')],'as':_0xedeb('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xedeb('0xa')](function(_0x3f92fa){if(_0x3f92fa){_0x2b7051=_0x3f92fa;_0x1d1eba[_0x4bcaf4](util[_0xedeb('0x1c')](_0xedeb('0x20'),_0x3f92fa[_0xedeb('0x4')]));var _0x58cc63=[];switch(_0x3f92fa[_0xedeb('0x17')]){case'admin':_0x1d1eba[_0x4bcaf4](_0xedeb('0x2d'));_0x1d1eba[_0x4bcaf4](_0xedeb('0x2e'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x30')][_0xedeb('0x11')](queryQueues));_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x31')][_0xedeb('0x11')](queryQueues));_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x32')][_0xedeb('0x11')](queryQueues));_0x58cc63['push'](db[_0xedeb('0x33')][_0xedeb('0x11')](queryQueues));_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x34')][_0xedeb('0x11')](queryQueues));_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x35')]['findAll'](queryQueues));_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x36')]['findAll'](queryQueues));_0x58cc63[_0xedeb('0x2f')](db['User'][_0xedeb('0x11')](queryTelephones));_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x37')][_0xedeb('0x11')](queryTrunks));_0x58cc63[_0xedeb('0x2f')](db[_0xedeb('0x19')][_0xedeb('0x11')](queryCampaigns));_0x58cc63['push'](db[_0xedeb('0x5')][_0xedeb('0x11')](queryAgents));break;case _0xedeb('0x38'):_0x1d1eba[_0x4bcaf4](_0xedeb('0x2d'));_0x1d1eba[_0x4bcaf4](_0xedeb('0x2e'));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources(_0xedeb('0xc'),_0x3f92fa['userProfileId'],_0xedeb('0x30')));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources(_0xedeb('0xd'),_0x3f92fa[_0xedeb('0x23')],'ChatQueue'));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources(_0xedeb('0xe'),_0x3f92fa[_0xedeb('0x23')],_0xedeb('0x32')));_0x58cc63['push'](getAssociatedResources(_0xedeb('0x39'),_0x3f92fa[_0xedeb('0x23')],_0xedeb('0x33')));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources(_0xedeb('0x3a'),_0x3f92fa[_0xedeb('0x23')],'MailQueue'));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources(_0xedeb('0xf'),_0x3f92fa[_0xedeb('0x23')],'OpenchannelQueue'));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources(_0xedeb('0x10'),_0x3f92fa[_0xedeb('0x23')],_0xedeb('0x36')));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources('Telephones',_0x3f92fa[_0xedeb('0x23')],'User'));_0x58cc63['push'](getAssociatedResources(_0xedeb('0x13'),_0x3f92fa[_0xedeb('0x23')],'Trunk'));_0x58cc63[_0xedeb('0x2f')](getAssociatedResources(_0xedeb('0x14'),_0x3f92fa[_0xedeb('0x23')],_0xedeb('0x19')));_0x58cc63['push'](db[_0xedeb('0x5')]['findAll'](queryAgents));break;case _0xedeb('0x6'):_0x1d1eba[_0x4bcaf4](_0xedeb('0x2d'));_0x1d1eba[_0x4bcaf4](_0xedeb('0x2e'));_0x58cc63[_0xedeb('0x2f')](_0x3f92fa[_0xedeb('0x3b')]({'attributes':['id',_0xedeb('0x4')]}));_0x58cc63[_0xedeb('0x2f')](_0x3f92fa[_0xedeb('0x3c')]({'attributes':['id',_0xedeb('0x4')]}));_0x58cc63[_0xedeb('0x2f')](_0x3f92fa[_0xedeb('0x3d')]({'attributes':['id',_0xedeb('0x4')]}));_0x58cc63[_0xedeb('0x2f')](_0x3f92fa[_0xedeb('0x3e')]({'attributes':['id',_0xedeb('0x4')]}));_0x58cc63[_0xedeb('0x2f')](_0x3f92fa['getMailQueues']({'attributes':['id',_0xedeb('0x4')]}));_0x58cc63[_0xedeb('0x2f')](_0x3f92fa[_0xedeb('0x3f')]({'attributes':['id',_0xedeb('0x4')]}));_0x58cc63[_0xedeb('0x2f')](_0x3f92fa[_0xedeb('0x40')]({'attributes':['id',_0xedeb('0x4')]}));break;}return BPromise[_0xedeb('0x41')](_0x58cc63);}})[_0xedeb('0xa')](function(_0x13bd50){if(_0x13bd50&&_0x13bd50[_0xedeb('0x1f')]){for(var _0xe28d61=0x0;_0xe28d61<_0x13bd50['length'];_0xe28d61+=0x1){for(var _0x34b005=0x0;_0x34b005<_0x13bd50[_0xe28d61][_0xedeb('0x1f')];_0x34b005+=0x1){switch(_0xe28d61){case 0x0:joinOrLeaveQueues(_0x1d1eba,_0x4bcaf4,_0xedeb('0x42'),_0x13bd50[_0xe28d61][_0x34b005]);break;case 0x1:joinOrLeaveQueues(_0x1d1eba,_0x4bcaf4,'chat',_0x13bd50[_0xe28d61][_0x34b005]);break;case 0x2:joinOrLeaveQueues(_0x1d1eba,_0x4bcaf4,_0xedeb('0x43'),_0x13bd50[_0xe28d61][_0x34b005]);break;case 0x3:joinOrLeaveQueues(_0x1d1eba,_0x4bcaf4,_0xedeb('0x44'),_0x13bd50[_0xe28d61][_0x34b005]);break;case 0x4:joinOrLeaveQueues(_0x1d1eba,_0x4bcaf4,'mail',_0x13bd50[_0xe28d61][_0x34b005]);break;case 0x5:joinOrLeaveQueues(_0x1d1eba,_0x4bcaf4,_0xedeb('0x45'),_0x13bd50[_0xe28d61][_0x34b005]);break;case 0x6:joinOrLeaveQueues(_0x1d1eba,_0x4bcaf4,_0xedeb('0x46'),_0x13bd50[_0xe28d61][_0x34b005]);break;case 0x7:if(_0x2b7051[_0xedeb('0x17')]!==_0xedeb('0x6'))_0x1d1eba[_0x4bcaf4](util['format']('telephone:%s',_0x13bd50[_0xe28d61][_0x34b005][_0xedeb('0x4')]));break;case 0x8:if(_0x2b7051[_0xedeb('0x17')]!=='agent')_0x1d1eba[_0x4bcaf4](util[_0xedeb('0x1c')](_0xedeb('0x47'),_0x13bd50[_0xe28d61][_0x34b005][_0xedeb('0x4')]));break;case 0x9:if(_0x2b7051[_0xedeb('0x17')]!==_0xedeb('0x6'))_0x1d1eba[_0x4bcaf4](util[_0xedeb('0x1c')](_0xedeb('0x48'),_0x13bd50[_0xe28d61][_0x34b005][_0xedeb('0x1b')],_0x13bd50[_0xe28d61][_0x34b005]['name']));break;case 0xa:_0x1d1eba[_0x4bcaf4](util[_0xedeb('0x1c')]('user:%s',_0x13bd50[_0xe28d61][_0x34b005][_0xedeb('0x4')]));break;}}}}})[_0xedeb('0xa')](function(){if(_0x4bcaf4==='leave'){var _0x5e158d=_[_0xedeb('0x49')](_0x2b7051[_0xedeb('0x24')],'id');return _0x2b7051[_0xedeb('0x4a')](_0x5e158d)[_0xedeb('0xa')](function(){for(var _0x183025=0x0;_0x183025<_0x5e158d[_0xedeb('0x1f')];_0x183025+=0x1){_0xadf097[_0xedeb('0x4b')](_0xedeb('0x4c'),{'ChatInteractionId':Number(_0x5e158d[_0x183025]),'UserId':Number(_0x2b7051['id'])});}});}})[_0xedeb('0xa')](function(){if(_0x4bcaf4===_0xedeb('0x4d')){var _0xf7521=_['map'](_0x2b7051['MailInteractions'],'id');return _0x2b7051[_0xedeb('0x4e')](_0xf7521)[_0xedeb('0xa')](function(){for(var _0x109269=0x0;_0x109269<_0xf7521[_0xedeb('0x1f')];_0x109269+=0x1){_0xadf097[_0xedeb('0x4b')](_0xedeb('0x4f'),{'MailInteractionId':Number(_0xf7521[_0x109269]),'UserId':Number(_0x2b7051['id'])});}});}})[_0xedeb('0xa')](function(){if(_0x4bcaf4===_0xedeb('0x4d')){var _0xd88087=_[_0xedeb('0x49')](_0x2b7051[_0xedeb('0x28')],'id');return _0x2b7051['removeFaxInteractions'](_0xd88087)['then'](function(){for(var _0x1b958b=0x0;_0x1b958b<_0xd88087[_0xedeb('0x1f')];_0x1b958b+=0x1){_0xadf097['emit'](_0xedeb('0x50'),{'FaxInteractionId':Number(_0xd88087[_0x1b958b]),'UserId':Number(_0x2b7051['id'])});}});}})[_0xedeb('0xa')](function(){if(_0x4bcaf4===_0xedeb('0x4d')){var _0x2dcd27=_[_0xedeb('0x49')](_0x2b7051['SmsInteractions'],'id');return _0x2b7051[_0xedeb('0x51')](_0x2dcd27)[_0xedeb('0xa')](function(){for(var _0x302aec=0x0;_0x302aec<_0x2dcd27[_0xedeb('0x1f')];_0x302aec+=0x1){_0xadf097[_0xedeb('0x4b')](_0xedeb('0x52'),{'SmsInteractionId':Number(_0x2dcd27[_0x302aec]),'UserId':Number(_0x2b7051['id'])});}});}})['then'](function(){if(_0x4bcaf4==='leave'){var _0x5e0a0a=_[_0xedeb('0x49')](_0x2b7051[_0xedeb('0x2a')],'id');return _0x2b7051[_0xedeb('0x53')](_0x5e0a0a)['then'](function(){for(var _0x8214ed=0x0;_0x8214ed<_0x5e0a0a['length'];_0x8214ed+=0x1){_0xadf097[_0xedeb('0x4b')](_0xedeb('0x54'),{'OpenchannelInteractionId':Number(_0x5e0a0a[_0x8214ed]),'UserId':Number(_0x2b7051['id'])});}});}})[_0xedeb('0xa')](function(){if(_0x4bcaf4==='leave'){var _0x4b7d59=_['map'](_0x2b7051['WhatsappInteractions'],'id');return _0x2b7051[_0xedeb('0x55')](_0x4b7d59)['then'](function(){for(var _0x1c7f7b=0x0;_0x1c7f7b<_0x4b7d59[_0xedeb('0x1f')];_0x1c7f7b+=0x1){_0xadf097[_0xedeb('0x4b')](_0xedeb('0x56'),{'WhatsappInteractionId':Number(_0x4b7d59[_0x1c7f7b]),'UserId':Number(_0x2b7051['id'])});}});}})[_0xedeb('0x57')](function(_0x2298f4){_0x1d1eba[_0xedeb('0x58')](_0x2298f4);});}}function onDisconnect(_0x2b75ff,_0xf56daf){joinOrLeave(_0x2b75ff,_0xedeb('0x4d'),_0xf56daf);}function onConnect(_0x429edc){joinOrLeave(_0x429edc,'join');}exports[_0xedeb('0x59')]=function(_0x532208){_0x532208['on'](_0xedeb('0x5a'),function(_0x4af6e9){_0x4af6e9[_0xedeb('0x5b')](0x0);_0x4af6e9['address']=_0x4af6e9[_0xedeb('0x5c')][_0xedeb('0x5a')]['remoteAddress']+':'+_0x4af6e9[_0xedeb('0x5c')][_0xedeb('0x5a')]['remotePort'];_0x4af6e9[_0xedeb('0x5d')]=new Date();_0x4af6e9['log']=function(_0x10e490){console['log']('SocketIO\x20'+_0x4af6e9[_0xedeb('0x5e')][_0xedeb('0x4')]+'['+_0x4af6e9[_0xedeb('0x5f')]+']',_0x10e490);};_0x4af6e9['on'](_0xedeb('0x60'),function(){onDisconnect(_0x4af6e9,_0x532208);_0x4af6e9[_0xedeb('0x58')]('DISCONNECTED');});onConnect(_0x4af6e9);_0x4af6e9[_0xedeb('0x58')](_0xedeb('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index ca3d317..912d063 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed95=['ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','closedinteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','Trigger,\x20%s','EventManager','error','code','catch','get','channel','event','UserId','User','find','interface','format','name','outgoingmessage','closed','default','length','hasOwnProperty','model','hook','callback','toLowerCase','util','../../mysqldb','../logger','triggers','client','http','afterCreate','Chat','afterUpdate'];(function(_0x3ed93c,_0x9495c9){var _0x909ce9=function(_0x116119){while(--_0x116119){_0x3ed93c['push'](_0x3ed93c['shift']());}};_0x909ce9(++_0x9495c9);}(_0xed95,0x12f));var _0x5ed9=function(_0x1103d7,_0x34fa8c){_0x1103d7=_0x1103d7-0x0;var _0x446dfc=_0xed95[_0x1103d7];return _0x446dfc;};'use strict';var util=require(_0x5ed9('0x0'));var db=require(_0x5ed9('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x5ed9('0x2'))(_0x5ed9('0x3'));var client=jayson[_0x5ed9('0x4')][_0x5ed9('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x5ed9('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x5ed9('0x7'),'model':'ChatInteraction','event':_0x5ed9('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5ed9('0x7'),'model':_0x5ed9('0x9'),'event':_0x5ed9('0x6'),'condition':_0x5ed9('0xa'),'callback':afterCreateMessage},{'channel':_0x5ed9('0xb'),'model':_0x5ed9('0xc'),'event':_0x5ed9('0x6'),'condition':_0x5ed9('0xd'),'callback':afterCreate},{'channel':_0x5ed9('0xb'),'model':_0x5ed9('0xc'),'event':_0x5ed9('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5ed9('0xb'),'model':_0x5ed9('0xe'),'event':_0x5ed9('0x6'),'condition':_0x5ed9('0xa'),'callback':afterCreateMessage},{'channel':_0x5ed9('0xf'),'model':_0x5ed9('0x10'),'event':_0x5ed9('0x6'),'condition':_0x5ed9('0xd'),'callback':afterCreate},{'channel':_0x5ed9('0xf'),'model':'WhatsappInteraction','event':_0x5ed9('0x8'),'condition':_0x5ed9('0x11'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x5ed9('0x12'),'event':'afterCreate','condition':_0x5ed9('0xa'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x5ed9('0x13'),'event':_0x5ed9('0x6'),'condition':_0x5ed9('0xd'),'callback':afterCreate},{'channel':'Fax','model':_0x5ed9('0x13'),'event':_0x5ed9('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5ed9('0x14'),'model':_0x5ed9('0x15'),'event':'afterCreate','condition':_0x5ed9('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x5ed9('0x6'),'condition':_0x5ed9('0xd'),'callback':afterCreate},{'channel':'Mail','model':_0x5ed9('0x16'),'event':_0x5ed9('0x8'),'condition':_0x5ed9('0x11'),'callback':afterUpdate},{'channel':_0x5ed9('0x17'),'model':'MailMessage','event':_0x5ed9('0x6'),'condition':_0x5ed9('0xa'),'callback':afterCreateMessage},{'channel':_0x5ed9('0x18'),'model':'OpenchannelInteraction','event':_0x5ed9('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0x5ed9('0x19'),'event':_0x5ed9('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5ed9('0x18'),'model':_0x5ed9('0x1a'),'event':_0x5ed9('0x6'),'condition':_0x5ed9('0xa'),'callback':afterCreateMessage}];function request(_0x584495){return client[_0x5ed9('0x1b')]('EventManager',_0x584495)[_0x5ed9('0x1c')](function(_0xdbd375){logger['info'](_0x5ed9('0x1d'),_0x5ed9('0x1e'),_0xdbd375);if(_0xdbd375[_0x5ed9('0x1f')]){if(_0xdbd375[_0x5ed9('0x1f')][_0x5ed9('0x20')]===0x1f4){logger[_0x5ed9('0x1f')](_0x5ed9('0x1d'),_0x5ed9('0x1e'),_0xdbd375[_0x5ed9('0x1f')]);}}})[_0x5ed9('0x21')](function(_0x12c9b1){logger[_0x5ed9('0x1f')]('Trigger,\x20%s',_0x5ed9('0x1e'),_0x12c9b1);});}function afterCreateMessage(_0x3fa960,_0xf616fc){return function(_0x55d0ef,_0x1445fb){_0x55d0ef=_0x55d0ef[_0x5ed9('0x22')]({'plain':!![]});_0x55d0ef[_0x5ed9('0x23')]=_0x3fa960;_0x55d0ef[_0x5ed9('0x24')]=_0x55d0ef['direction'];if(_0x55d0ef[_0x5ed9('0x25')]){return db[_0x5ed9('0x26')][_0x5ed9('0x27')]({'where':{'id':_0x55d0ef['UserId']},'attributes':['id','name'],'raw':!![]})['then'](function(_0x2a6d03){_0x55d0ef[_0x5ed9('0x28')]=util[_0x5ed9('0x29')]('SIP/%s',_0x2a6d03[_0x5ed9('0x2a')]);_0x55d0ef[_0x5ed9('0x23')]=_0x3fa960;return request({'event':'incomingmessage','message':_0x55d0ef});})[_0x5ed9('0x21')](function(_0x26c09c){console[_0x5ed9('0x1f')](_0x26c09c);});}else{return request({'event':_0x5ed9('0x2b'),'message':_0x55d0ef});}};}function afterCreate(_0x542a78,_0x27d374){return function(_0x211839,_0x5656f9){_0x211839=_0x211839[_0x5ed9('0x22')]({'plain':!![]});_0x211839[_0x5ed9('0x23')]=_0x542a78;_0x211839[_0x5ed9('0x24')]='opened';return request({'event':_0x27d374,'message':_0x211839});};}function afterUpdate(_0x66a376,_0x17771b){return function(_0x86f501,_0xd1e452){if(_0x86f501['changed'](_0x5ed9('0x2c'))&&_0x86f501[_0x5ed9('0x2c')]){_0x86f501=_0x86f501[_0x5ed9('0x22')]({'plain':!![]});_0x86f501[_0x5ed9('0x23')]=_0x66a376;_0x86f501[_0x5ed9('0x24')]=_0x5ed9('0x2c');if(_0x86f501[_0x5ed9('0x25')]){return db[_0x5ed9('0x26')][_0x5ed9('0x27')]({'where':{'id':_0x86f501['UserId']},'attributes':['id','name'],'raw':!![]})[_0x5ed9('0x1c')](function(_0x5c6a27){_0x86f501[_0x5ed9('0x28')]=util[_0x5ed9('0x29')]('SIP/%s',_0x5c6a27['name']);return request({'event':_0x17771b,'message':_0x86f501});})['catch'](function(_0x4c6521){console[_0x5ed9('0x1f')](_0x4c6521);});}else{return request({'event':_0x17771b,'message':_0x86f501});}}};}exports[_0x5ed9('0x2d')]=function(){for(var _0x4f0a29=0x0;_0x4f0a29=_0x4eb7f7[_0x536a('0x16')]){throw Error(_0x536a('0x17'));}_0x27a85b(_0x3bf7de);})[_0x536a('0x18')](function(_0x1335c7){_0x4701d2(_0x1335c7);});});}; \ No newline at end of file +var _0x0640=['lodash','bluebird','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','clearBlockUser','blockedAt','updateAttributes','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x0640,0x19e));var _0x0064=function(_0x1e4e3a,_0x5d214d){_0x1e4e3a=_0x1e4e3a-0x0;var _0x1be363=_0x0640[_0x1e4e3a];return _0x1be363;};'use strict';var _=require(_0x0064('0x0'));var BPromise=require(_0x0064('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x0064('0x2'));var channels=[_0x0064('0x3'),_0x0064('0x4'),_0x0064('0x5'),_0x0064('0x6'),_0x0064('0x7'),_0x0064('0x8'),_0x0064('0x9')];exports[_0x0064('0xa')]=function(){return channels;};exports[_0x0064('0xb')]=function(_0x171d6e){_0x171d6e=_0x171d6e['toLowerCase']();return _['includes'](channels,_0x171d6e);};exports[_0x0064('0xc')]=function(_0x3c8a2f,_0x27fd7d,_0x2c1c1b,_0x7915aa){var _0x392ab5={'loginAttempts':_0x27fd7d,'blocked':_0x2c1c1b};if(!_['isUndefined'](_0x7915aa)){_0x392ab5[_0x0064('0xd')]=_0x7915aa;}return _0x3c8a2f[_0x0064('0xe')](_0x392ab5);};exports[_0x0064('0xf')]=function(_0x4ea0ed){return new BPromise(function(_0x5c3530,_0x2502c1){var _0x3cace8=0x0;if(_0x4ea0ed[_0x0064('0x10')]!=='agent'){_0x5c3530(_0x4ea0ed);}db['User'][_0x0064('0x11')]({'where':{'role':_0x0064('0x12'),'online':!![],'id':{'$ne':_0x4ea0ed['id']}}})[_0x0064('0x13')](function(_0x3d5f60){_0x3cace8=_0x3d5f60;return util[_0x0064('0xf')]();})['then'](function(_0xdc57a1){if(_0xdc57a1&&_0xdc57a1[_0x0064('0x14')]&&_0x3cace8>=_0xdc57a1[_0x0064('0x14')]){throw Error(_0x0064('0x15'));}_0x5c3530(_0x4ea0ed);})[_0x0064('0x16')](function(_0x37927a){_0x2502c1(_0x37927a);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index fdfa92f..3e4116d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd769=['status','render','json','send','exports','404'];(function(_0x3ad321,_0x3dc523){var _0xe3724b=function(_0x58941d){while(--_0x58941d){_0x3ad321['push'](_0x3ad321['shift']());}};_0xe3724b(++_0x3dc523);}(_0xd769,0x12a));var _0x9d76=function(_0x1ca761,_0x341ed6){_0x1ca761=_0x1ca761-0x0;var _0x25104e=_0xd769[_0x1ca761];return _0x25104e;};'use strict';module[_0x9d76('0x0')][0x194]=function pageNotFound(_0x39f947,_0xcba1ea){var _0x439592=_0x9d76('0x1');var _0x478904=0x194;var _0x36c9bb={'status':_0x478904};_0xcba1ea['status'](_0x36c9bb[_0x9d76('0x2')]);_0xcba1ea[_0x9d76('0x3')](_0x439592,{},function(_0x3dfdc3,_0x1cd727){if(_0x3dfdc3){return _0xcba1ea[_0x9d76('0x2')](_0x36c9bb[_0x9d76('0x2')])[_0x9d76('0x4')](_0x36c9bb);}_0xcba1ea[_0x9d76('0x5')](_0x1cd727);});}; \ No newline at end of file +var _0xf756=['json','send','exports','404','status','render'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf756,0x182));var _0x6f75=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf756[_0x2dafbe];return _0x58a45a;};'use strict';module[_0x6f75('0x0')][0x194]=function pageNotFound(_0x3ec4d8,_0x32eead){var _0x191e77=_0x6f75('0x1');var _0xcec97d=0x194;var _0xd5ec95={'status':_0xcec97d};_0x32eead[_0x6f75('0x2')](_0xd5ec95[_0x6f75('0x2')]);_0x32eead[_0x6f75('0x3')](_0x191e77,{},function(_0xcd462c,_0x36dba8){if(_0xcd462c){return _0x32eead[_0x6f75('0x2')](_0xd5ec95[_0x6f75('0x2')])[_0x6f75('0x4')](_0xd5ec95);}_0x32eead[_0x6f75('0x5')](_0x36dba8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d2a6be2..6b5cd81 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd599=['UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','AgentReports','uniqueid','ContactId','MailServerIn','MailAccountId','MailServerOut','Imap','Smtp','Answers','Interactions','List','TemplateId','mandatoryDispositionPause','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','MailQueueReport','ListId','Dashboard','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','Dispositions','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Queue','ChatMessage','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','ChatGroupId','chat_group_has_users','Website','JscriptySessions','CompanyId','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','AutomationAllId','Any','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','AnalyticDefaultReport','DefaultReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','CustomReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SubjectId','DeskAccount','DeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','FreshsalesField','ChatQueueReport','ToId','SessionId','JscriptyAnswerReport','ProjectId','MailQueues','team_has_fax_queues','team_has_openchannel_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','jstz','determine','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','database','password','username','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','hasMany','VoiceRecording','UserVoiceQueueRt','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueues'];(function(_0x151302,_0x4f7bce){var _0x31528d=function(_0xb1b4ac){while(--_0xb1b4ac){_0x151302['push'](_0x151302['shift']());}};_0x31528d(++_0x4f7bce);}(_0xd599,0xbf));var _0x9d59=function(_0x424f76,_0x50e784){_0x424f76=_0x424f76-0x0;var _0x30036c=_0xd599[_0x424f76];return _0x30036c;};'use strict';var path=require(_0x9d59('0x0'));var config=require(_0x9d59('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x9d59('0x2'));var timezone=jstz[_0x9d59('0x3')]();config[_0x9d59('0x4')]=_[_0x9d59('0x5')](config[_0x9d59('0x4')],{'database':'motion2','username':_0x9d59('0x6'),'password':_0x9d59('0x7'),'options':{'host':_0x9d59('0x8'),'port':0xcea,'dialect':_0x9d59('0x9'),'dialectOptions':{'charset':_0x9d59('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9d59('0xb'),'collate':_0x9d59('0xc')}}});config['sequelizeHistory']=_[_0x9d59('0x5')](config[_0x9d59('0xd')],{'database':'motion2','username':_0x9d59('0x6'),'password':_0x9d59('0x7'),'options':{'host':_0x9d59('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x9d59('0xe')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9d59('0x4')][_0x9d59('0xf')],config[_0x9d59('0x4')]['username'],config[_0x9d59('0x4')][_0x9d59('0x10')],config[_0x9d59('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9d59('0xd')][_0x9d59('0xf')],config[_0x9d59('0xd')][_0x9d59('0x11')],config[_0x9d59('0xd')][_0x9d59('0x10')],config[_0x9d59('0xd')][_0x9d59('0x12')])};db[_0x9d59('0x13')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/user/user.model');db[_0x9d59('0x15')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x16'));db[_0x9d59('0x17')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x18'));db[_0x9d59('0x19')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1a'));db[_0x9d59('0x1b')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1c'));db[_0x9d59('0x1d')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1e'));db['VoiceRecording']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x1f'));db[_0x9d59('0x20')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/screenRecording/screenRecording.model');db[_0x9d59('0x21')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x22'));db[_0x9d59('0x23')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x9d59('0x24')]=db['sequelize']['import'](_0x9d59('0x25'));db['VoiceDialReport']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x26'));db[_0x9d59('0x27')]=db['sequelize'][_0x9d59('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x9d59('0x28')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x29'));db[_0x9d59('0x2a')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x2b'));db[_0x9d59('0x2c')]=db[_0x9d59('0x4')]['import']('../api/trunk/trunk.model');db[_0x9d59('0x2d')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x2e'));db['UserVoiceQueueRt']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x2f'));db[_0x9d59('0x30')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x31'));db['UserChatQueue']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x32'));db[_0x9d59('0x33')]=db['sequelize']['import'](_0x9d59('0x34'));db['UserFaxQueue']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/userFaxQueue/userFaxQueue.model');db[_0x9d59('0x35')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x36'));db[_0x9d59('0x37')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x38'));db[_0x9d59('0x39')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x3a'));db['MailServerIn']=db[_0x9d59('0x4')]['import'](_0x9d59('0x3b'));db['MailServerOut']=db[_0x9d59('0x4')]['import'](_0x9d59('0x3c'));db[_0x9d59('0x3d')]=db['sequelize']['import']('../api/mailAccount/mailAccount.model');db[_0x9d59('0x3e')]=db['sequelize'][_0x9d59('0x14')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x9d59('0x4')]['import'](_0x9d59('0x3f'));db[_0x9d59('0x40')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x9d59('0x41')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x42'));db[_0x9d59('0x43')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x44'));db['MailQueueReport']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x9d59('0x4')]['import'](_0x9d59('0x45'));db['DashboardItem']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x46'));db[_0x9d59('0x47')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x48'));db[_0x9d59('0x49')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x4a'));db[_0x9d59('0x4b')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x4c'));db[_0x9d59('0x4d')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x4e'));db[_0x9d59('0x4f')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x50'));db[_0x9d59('0x51')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x52'));db[_0x9d59('0x53')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x54'));db['SmsApplication']=db[_0x9d59('0x4')]['import'](_0x9d59('0x55'));db[_0x9d59('0x56')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x57'));db[_0x9d59('0x58')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x59'));db[_0x9d59('0x5a')]=db['sequelize']['import'](_0x9d59('0x5b'));db[_0x9d59('0x5c')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x5d'));db[_0x9d59('0x5e')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x5f'));db[_0x9d59('0x60')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x61'));db[_0x9d59('0x62')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x63'));db[_0x9d59('0x64')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x9d59('0x65')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x66'));db['OpenchannelQueueReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x67'));db[_0x9d59('0x68')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x69'));db[_0x9d59('0x6a')]=db[_0x9d59('0x4')]['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x6b'));db[_0x9d59('0x6c')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x6d'));db[_0x9d59('0x6e')]=db['sequelize'][_0x9d59('0x14')]('../api/chatGroup/chatGroup.model');db[_0x9d59('0x6f')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x70'));db[_0x9d59('0x71')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/cmCompany/cmCompany.model');db[_0x9d59('0x72')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x73'));db[_0x9d59('0x74')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x75'));db['CmHopperBlack']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x76'));db[_0x9d59('0x77')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x78'));db[_0x9d59('0x79')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x7a'));db[_0x9d59('0x7b')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x9d59('0x7c')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x7d'));db[_0x9d59('0x7e')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x7f'));db[_0x9d59('0x80')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x81'));db[_0x9d59('0x82')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x83'));db[_0x9d59('0x84')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/disposition/disposition.model');db[_0x9d59('0x85')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/condition/condition.model');db[_0x9d59('0x86')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/interval/interval.model');db[_0x9d59('0x87')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x88'));db[_0x9d59('0x89')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x8a'));db[_0x9d59('0x8b')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x8c'));db['Schedule']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x8d'));db[_0x9d59('0x8e')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x8f'));db[_0x9d59('0x90')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/tag/tag.model');db[_0x9d59('0x91')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/template/template.model');db[_0x9d59('0x92')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x93'));db[_0x9d59('0x94')]=db['sequelize'][_0x9d59('0x14')]('../api/variable/variable.model');db[_0x9d59('0x95')]=db['sequelize']['import'](_0x9d59('0x96'));db[_0x9d59('0x97')]=db['sequelize']['import'](_0x9d59('0x98'));db[_0x9d59('0x99')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x9a'));db['AnalyticDefaultReport']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x9b'));db['AnalyticExtractedReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x9c'));db['AnalyticMetric']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x9d'));db[_0x9d59('0x9e')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x9f'));db[_0x9d59('0xa0')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xa1'));db[_0x9d59('0xa2')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xa3'));db[_0x9d59('0xa4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xa5'));db[_0x9d59('0xa6')]=db['sequelize'][_0x9d59('0x14')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xa7'));db[_0x9d59('0xa8')]=db['sequelize']['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x9d59('0xa9')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xaa'));db[_0x9d59('0xab')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xac'));db['DeskField']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xad'));db[_0x9d59('0xae')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xaf'));db[_0x9d59('0xb0')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x9d59('0xb1')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intZohoField/intZohoField.model');db[_0x9d59('0xb2')]=db['sequelize']['import'](_0x9d59('0xb3'));db[_0x9d59('0xb4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xb5'));db[_0x9d59('0xb6')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0x9d59('0xb7')]=db[_0x9d59('0x4')]['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x9d59('0xb8')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9d59('0xb9')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xba'));db[_0x9d59('0xbb')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xbc'));db['VtigerConfiguration']=db[_0x9d59('0x4')]['import'](_0x9d59('0xbd'));db['VtigerField']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x9d59('0xbe')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x9d59('0xbf')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xc0'));db[_0x9d59('0xc1')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xc2'));db[_0x9d59('0xc3')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xc4'));db[_0x9d59('0xc5')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x9d59('0xc6')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x9d59('0xc7')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xc8'));db[_0x9d59('0xc9')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xca'));db['FreshsalesField']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xcb'));db['Integration']=db['sequelize'][_0x9d59('0x14')]('../api/integration/integration.model');db[_0x9d59('0xcc')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xcd'));db['ChatQueueReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xce'));db[_0x9d59('0xcf')]=db[_0x9d59('0x4')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xd0'));db[_0x9d59('0xd1')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xd2'));db[_0x9d59('0xd3')]=db['sequelize'][_0x9d59('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x9d59('0xd4')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xd5'));db[_0x9d59('0xd6')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xd7'));db[_0x9d59('0xd8')]=db['sequelize']['import'](_0x9d59('0xd9'));db[_0x9d59('0xda')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xdb'));db[_0x9d59('0xdc')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xdd'));db[_0x9d59('0xde')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xdf'));db['SquareProject']=db['sequelize'][_0x9d59('0x14')]('../api/squareProject/squareProject.model');db[_0x9d59('0xe0')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xe1'));db[_0x9d59('0xe2')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe3'));db[_0x9d59('0xe4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe5'));db[_0x9d59('0xe6')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe7'));db[_0x9d59('0xe8')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xe9'));db[_0x9d59('0xea')]=db[_0x9d59('0x4')]['import']('../api/migration/migration.model');db[_0x9d59('0xeb')]=db[_0x9d59('0x4')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/plugin/plugin.model');db[_0x9d59('0xec')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xed'));db[_0x9d59('0xee')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xef'));db[_0x9d59('0xf0')]=db[_0x9d59('0x4')]['import'](_0x9d59('0xf1'));db[_0x9d59('0xf2')]=db['sequelize']['import'](_0x9d59('0xf3'));db[_0x9d59('0xf4')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xf5'));db['CmList']=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0xf6'));db[_0x9d59('0xf7')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xf8'));db['UserProfile']=db['sequelize']['import'](_0x9d59('0xf9'));db[_0x9d59('0xfa')]=db['sequelize']['import'](_0x9d59('0xfb'));db[_0x9d59('0xfc')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xfd'));db[_0x9d59('0xfe')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0xff'));db[_0x9d59('0x100')]=db[_0x9d59('0x4')][_0x9d59('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0x9d59('0x101')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x102'));db[_0x9d59('0x103')]=db[_0x9d59('0x4')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x9d59('0x104')]=db[_0x9d59('0x4')][_0x9d59('0x14')](_0x9d59('0x105'));db[_0x9d59('0x106')]=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x107'));db[_0x9d59('0x108')]=db[_0x9d59('0x4')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0x9d59('0x14')](_0x9d59('0x109'));db[_0x9d59('0x10a')]=db[_0x9d59('0x4')]['import'](_0x9d59('0x10b'));db[_0x9d59('0x13')][_0x9d59('0x10c')](db[_0x9d59('0x21')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x10f')],{'as':'Recordings','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x110')],{'as':_0x9d59('0x111'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db['VoiceExtension'],{'as':_0x9d59('0x112'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x13')][_0x9d59('0x10e')](db['CmHopperFinal'],{'as':_0x9d59('0x114'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':_0x9d59('0x115'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')]['hasMany'](db[_0x9d59('0x7b')],{'as':_0x9d59('0x7b'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x60')],{'as':_0x9d59('0x116'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x6a')],{'as':_0x9d59('0x117'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x56')],{'as':_0x9d59('0x118'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')]['hasMany'](db[_0x9d59('0x4b')],{'as':_0x9d59('0x119'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x13')][_0x9d59('0x10e')](db[_0x9d59('0x40')],{'as':_0x9d59('0x11a'),'foreignKey':_0x9d59('0x10d')});db['User'][_0x9d59('0x10e')](db[_0x9d59('0x101')],{'as':_0x9d59('0x11b'),'foreignKey':'UserId'});db['User'][_0x9d59('0x10e')](db[_0x9d59('0xfe')],{'as':_0x9d59('0x11c'),'foreignKey':_0x9d59('0x11d')});db[_0x9d59('0x13')][_0x9d59('0x11e')](db[_0x9d59('0x11f')],{'as':_0x9d59('0x11f'),'foreignKey':_0x9d59('0x120')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x6e')],{'as':_0x9d59('0x122'),'through':'chat_group_has_users'});db['User'][_0x9d59('0x121')](db['CmContact'],{'as':_0x9d59('0x123'),'through':_0x9d59('0x124')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x125')],{'as':_0x9d59('0x126'),'through':_0x9d59('0x127')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0xe4')],{'through':_0x9d59('0x128')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x40')],{'as':_0x9d59('0x11a'),'through':_0x9d59('0x129')});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x6a')],{'as':_0x9d59('0x117'),'through':_0x9d59('0x12a')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x4b')],{'as':'FaxInteractions','through':_0x9d59('0x12b')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x56')],{'as':_0x9d59('0x118'),'through':'user_has_sms_interactions'});db[_0x9d59('0x13')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x9d59('0x116'),'through':'user_has_openchannel_interactions'});db['User'][_0x9d59('0x121')](db['WhatsappInteraction'],{'as':_0x9d59('0x11b'),'through':_0x9d59('0x12c')});db[_0x9d59('0x13')][_0x9d59('0x121')](db['VoiceQueue'],{'as':_0x9d59('0x12d'),'through':_0x9d59('0x30'),'required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x3e')],{'as':'MailQueues','through':_0x9d59('0x33'),'required':![]});db[_0x9d59('0x13')]['belongsToMany'](db[_0x9d59('0x6c')],{'as':_0x9d59('0x12e'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x9d59('0x13')]['belongsToMany'](db['FaxQueue'],{'as':_0x9d59('0x12f'),'through':_0x9d59('0x130'),'required':![]});db[_0x9d59('0x13')]['belongsToMany'](db['SmsQueue'],{'as':_0x9d59('0x131'),'through':_0x9d59('0x35'),'required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db['OpenchannelQueue'],{'as':_0x9d59('0x132'),'through':_0x9d59('0x37'),'required':![]});db['User'][_0x9d59('0x121')](db[_0x9d59('0x108')],{'as':_0x9d59('0x133'),'through':'UserWhatsappQueue','required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db['CmList'],{'through':_0x9d59('0x127')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0xf7')],{'as':_0x9d59('0x134'),'through':_0x9d59('0x135'),'required':![]});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x65')],{'as':_0x9d59('0x136'),'through':_0x9d59('0x137')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x47')],{'as':_0x9d59('0x138'),'through':_0x9d59('0x139')});db[_0x9d59('0x13')][_0x9d59('0x121')](db['MailAccount'],{'as':_0x9d59('0x13a'),'through':_0x9d59('0x13b')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x5c')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db['User'][_0x9d59('0x121')](db[_0x9d59('0x53')],{'as':'SmsAccounts','through':_0x9d59('0x13c')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x13d')],{'as':'WhatsappAccounts','through':_0x9d59('0x13e')});db[_0x9d59('0x13')][_0x9d59('0x121')](db[_0x9d59('0x13f')],{'as':'SquareProjects','through':_0x9d59('0x140')});db['VoiceChanSpy']['hasMany'](db[_0x9d59('0x19')],{'as':'SpiedAgents','onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x141')});db[_0x9d59('0x17')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'onDelete':_0x9d59('0x113')});db[_0x9d59('0x19')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'as':_0x9d59('0x142'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x1b')][_0x9d59('0x121')](db['Sound'],{'as':_0x9d59('0x143'),'through':'moh_has_sounds'});db[_0x9d59('0x1d')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x9d59('0x144'),'foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x74')],{'as':_0x9d59('0x146'),'foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x77')],{'as':'HopperFinals','foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':_0x9d59('0x147'),'foreignKey':'VoiceQueueId'});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x7b')],{'as':_0x9d59('0x7b'),'foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x10e')](db[_0x9d59('0x148')],{'as':_0x9d59('0x149'),'foreignKey':'VoiceQueueId'});db[_0x9d59('0x1d')]['hasMany'](db[_0x9d59('0xd3')],{'as':'JscriptySessions','foreignKey':_0x9d59('0x145')});db[_0x9d59('0x1d')][_0x9d59('0x11e')](db['Trunk'],{'as':_0x9d59('0x2c'),'foreignKey':_0x9d59('0x14a')});db[_0x9d59('0x1d')]['belongsTo'](db[_0x9d59('0x2c')],{'as':_0x9d59('0x14b'),'foreignKey':_0x9d59('0x14c')});db[_0x9d59('0x1d')][_0x9d59('0x11e')](db[_0x9d59('0x86')],{'as':_0x9d59('0x86'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x1d')][_0x9d59('0x11e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x1d')]['belongsToMany'](db[_0x9d59('0x125')],{'as':'Lists','through':_0x9d59('0x14f')});db[_0x9d59('0x1d')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x30')});db[_0x9d59('0x1d')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'as':_0x9d59('0x151'),'through':'TeamVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0x9d59('0x125')],{'as':_0x9d59('0x152'),'through':_0x9d59('0x153')});db[_0x9d59('0x10f')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':'User','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x20')][_0x9d59('0x11e')](db['User'],{'as':_0x9d59('0x13'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x21')][_0x9d59('0x10e')](db[_0x9d59('0x23')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x155'),'sourceKey':_0x9d59('0x156')});db[_0x9d59('0x23')][_0x9d59('0x11e')](db[_0x9d59('0x21')],{'foreignKey':'mailboxuser','targetKey':_0x9d59('0x156')});db[_0x9d59('0x24')]['hasMany'](db[_0x9d59('0x28')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x9d59('0x24')][_0x9d59('0x10e')](db[_0x9d59('0x27')],{'as':_0x9d59('0x157'),'foreignKey':_0x9d59('0x158'),'constraints':![]});db['VoiceCallReport'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x13'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x24')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x15a')][_0x9d59('0x11e')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x15c')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x3d'),'foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x3d')][_0x9d59('0x10c')](db[_0x9d59('0x15a')],{'as':_0x9d59('0x15d'),'onDelete':'cascade'});db[_0x9d59('0x3d')][_0x9d59('0x10c')](db['MailServerOut'],{'as':_0x9d59('0x15e'),'onDelete':'cascade'});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db['CannedAnswer'],{'as':_0x9d59('0x15f'),'foreignKey':'MailAccountId'});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db[_0x9d59('0x41')],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x15b')});db['MailAccount'][_0x9d59('0x10e')](db[_0x9d59('0x40')],{'as':_0x9d59('0x160')});db[_0x9d59('0x3d')][_0x9d59('0x10e')](db[_0x9d59('0x43')],{'as':'Applications'});db[_0x9d59('0x3d')]['belongsTo'](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':'ListId'});db[_0x9d59('0x3d')][_0x9d59('0x11e')](db[_0x9d59('0x91')],{'as':_0x9d59('0x91'),'foreignKey':_0x9d59('0x162')});db['MailAccount'][_0x9d59('0x11e')](db['Pause'],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x3d')][_0x9d59('0x121')](db['User'],{'as':_0x9d59('0x150'),'through':_0x9d59('0x13b')});db['MailQueue'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x33')});db[_0x9d59('0x3e')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':_0x9d59('0x164'),'as':'Teams'});db['MailInteraction'][_0x9d59('0x10e')](db[_0x9d59('0x41')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':'MailInteractionId'});db[_0x9d59('0x40')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x40')][_0x9d59('0x11e')](db['CmContact'],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x40')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x10d')});db['MailInteraction'][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x168'),'as':_0x9d59('0x169')});db[_0x9d59('0x40')]['belongsToMany'](db[_0x9d59('0x90')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x9d59('0x40')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':'user_has_mail_interactions','foreignKey':_0x9d59('0x16b')});db['MailMessage'][_0x9d59('0x10e')](db[_0x9d59('0xeb')],{'as':_0x9d59('0x16c'),'onDelete':'cascade'});db[_0x9d59('0x41')][_0x9d59('0x11e')](db['User'],{'as':'User'});db[_0x9d59('0x41')][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db['MailMessage'][_0x9d59('0x11e')](db[_0x9d59('0x40')],{'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x16b')});db[_0x9d59('0x41')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x15b')});db[_0x9d59('0x41')]['belongsTo'](db[_0x9d59('0x65')],{'as':_0x9d59('0x65'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x9d59('0x11e')](db[_0x9d59('0x16e')],{'as':_0x9d59('0x16e'),'foreignKey':_0x9d59('0x16f')});db['MailApplication']['belongsTo'](db['User'],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x43')][_0x9d59('0x11e')](db['MailQueue'],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x43')][_0x9d59('0x11e')](db['MailAccount'],{'onDelete':_0x9d59('0x170')});db['MailApplication'][_0x9d59('0x11e')](db['Interval'],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x14d')});db['MailApplication'][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':'restrict','foreignKey':_0x9d59('0x171')});db[_0x9d59('0x172')][_0x9d59('0x11e')](db['MailAccount'],{});db['MailQueueReport'][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x172')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x172')]['belongsTo'](db[_0x9d59('0x40')],{});db[_0x9d59('0x172')][_0x9d59('0x11e')](db[_0x9d59('0x41')],{});db[_0x9d59('0x172')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x172')][_0x9d59('0x11e')](db[_0x9d59('0x3e')],{});db[_0x9d59('0x174')][_0x9d59('0x10e')](db[_0x9d59('0x175')],{'as':_0x9d59('0x176'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x47')][_0x9d59('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x9d59('0x47')]['hasMany'](db[_0x9d59('0x82')],{'as':'Answers','foreignKey':_0x9d59('0x177')});db[_0x9d59('0x47')]['hasMany'](db[_0x9d59('0x4b')],{'as':_0x9d59('0x160')});db[_0x9d59('0x47')][_0x9d59('0x10e')](db[_0x9d59('0x49')],{'as':'Applications'});db[_0x9d59('0x47')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'as':_0x9d59('0x178'),'onDelete':'cascade'});db[_0x9d59('0x47')][_0x9d59('0x10e')](db[_0x9d59('0x4d')],{'as':'Messages'});db[_0x9d59('0x47')]['belongsTo'](db['Trunk'],{'as':_0x9d59('0x2c')});db[_0x9d59('0x47')]['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x47')][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x47')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x139')});db[_0x9d59('0x49')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':'restrict'});db[_0x9d59('0x49')]['belongsTo'](db[_0x9d59('0x4f')],{'onDelete':'restrict'});db[_0x9d59('0x49')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'onDelete':_0x9d59('0x170')});db['FaxApplication']['belongsTo'](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x4b')][_0x9d59('0x10e')](db[_0x9d59('0x4d')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':'FaxInteractionId'});db[_0x9d59('0x4b')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x177')});db[_0x9d59('0x4b')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db['FaxInteraction'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x4b')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x179'),'as':'Tags'});db[_0x9d59('0x4b')]['belongsToMany'](db[_0x9d59('0x90')],{'through':'fax_interaction_has_tags','as':_0x9d59('0x17a')});db[_0x9d59('0x4b')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db['User'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x13')});db[_0x9d59('0x4d')]['belongsTo'](db[_0x9d59('0x4b')],{'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x17b')});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db['Attachment'],{'as':_0x9d59('0xeb'),'foreignKey':_0x9d59('0x17c')});db[_0x9d59('0x4d')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x177')});db['FaxQueue'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'UserFaxQueue'});db['FaxQueue'][_0x9d59('0x121')](db['Team'],{'through':'team_has_fax_queues','as':_0x9d59('0x151')});db['FaxQueueReport'][_0x9d59('0x11e')](db[_0x9d59('0x47')],{});db['FaxQueueReport']['belongsTo'](db[_0x9d59('0x125')],{'as':'List','foreignKey':_0x9d59('0x173')});db[_0x9d59('0x51')]['belongsTo'](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId'});db[_0x9d59('0x51')][_0x9d59('0x11e')](db[_0x9d59('0x4b')],{});db[_0x9d59('0x51')]['belongsTo'](db[_0x9d59('0x4d')],{});db[_0x9d59('0x51')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x51')][_0x9d59('0x11e')](db[_0x9d59('0x4f')],{});db[_0x9d59('0x53')][_0x9d59('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x53')][_0x9d59('0x10e')](db[_0x9d59('0x82')],{'as':_0x9d59('0x15f'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x53')][_0x9d59('0x10e')](db['SmsMessage'],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x53')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0x9d59('0x10e')](db['SmsApplication'],{'as':_0x9d59('0x142')});db[_0x9d59('0x53')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x53')][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x53')]['belongsToMany'](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'user_has_sms_accounts'});db[_0x9d59('0x17e')]['belongsTo'](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x17e')][_0x9d59('0x11e')](db['SmsQueue'],{'onDelete':_0x9d59('0x170')});db['SmsApplication']['belongsTo'](db[_0x9d59('0x53')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x17e')][_0x9d59('0x11e')](db['Interval'],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x17e')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x56')][_0x9d59('0x10e')](db[_0x9d59('0x58')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x17f')});db[_0x9d59('0x56')][_0x9d59('0x11e')](db[_0x9d59('0x53')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x56')][_0x9d59('0x11e')](db['CmContact'],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db['SmsInteraction'][_0x9d59('0x11e')](db['User'],{'as':'Owner','foreignKey':_0x9d59('0x10d')});db['SmsInteraction'][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x180'),'as':_0x9d59('0x169')});db[_0x9d59('0x56')][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x180'),'as':_0x9d59('0x17a')});db['SmsInteraction'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Users','through':_0x9d59('0x181'),'foreignKey':_0x9d59('0x17f')});db[_0x9d59('0x58')]['belongsTo'](db[_0x9d59('0x13')],{'as':_0x9d59('0x13')});db['SmsMessage'][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db[_0x9d59('0x58')][_0x9d59('0x11e')](db['SmsInteraction'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x17f')});db[_0x9d59('0x58')][_0x9d59('0x11e')](db[_0x9d59('0x53')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x17d')});db[_0x9d59('0x5a')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x9d59('0x182')});db[_0x9d59('0x5a')]['belongsToMany'](db['Team'],{'through':_0x9d59('0x183'),'as':_0x9d59('0x151')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x9d59('0x184')});db[_0x9d59('0x5c')][_0x9d59('0x10e')](db[_0x9d59('0x82')],{'as':_0x9d59('0x15f'),'foreignKey':_0x9d59('0x184')});db[_0x9d59('0x5c')][_0x9d59('0x10e')](db[_0x9d59('0x60')],{'as':_0x9d59('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x5c')][_0x9d59('0x10e')](db[_0x9d59('0x62')],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x184')});db['OpenchannelAccount']['hasMany'](db[_0x9d59('0x5e')],{'as':'Applications','foreignKey':_0x9d59('0x184')});db['OpenchannelAccount']['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x5c')][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x5c')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db['OpenchannelQueue'],{'onDelete':_0x9d59('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db[_0x9d59('0x86')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x5e')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':'restrict','foreignKey':_0x9d59('0x171')});db[_0x9d59('0x60')][_0x9d59('0x10e')](db[_0x9d59('0x62')],{'as':'Messages','onDelete':_0x9d59('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x9d59('0x60')][_0x9d59('0x11e')](db[_0x9d59('0x5c')],{'as':_0x9d59('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x60')]['belongsTo'](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x60')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x9d59('0x60')][_0x9d59('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x9d59('0x169')});db['OpenchannelInteraction'][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x185'),'as':_0x9d59('0x17a')});db[_0x9d59('0x60')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x186'),'foreignKey':_0x9d59('0x187')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x13')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x187')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db['Attachment'],{'as':_0x9d59('0xeb'),'foreignKey':_0x9d59('0x17c')});db[_0x9d59('0x62')][_0x9d59('0x11e')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x9d59('0x64')]['belongsToMany'](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0x9d59('0x64')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':'team_has_openchannel_queues','as':_0x9d59('0x151')});db['ChatWebsite'][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':_0x9d59('0x188'),'foreignKey':_0x9d59('0x189')});db[_0x9d59('0x65')][_0x9d59('0x10e')](db[_0x9d59('0x82')],{'as':_0x9d59('0x15f'),'foreignKey':'ChatWebsiteId'});db[_0x9d59('0x65')][_0x9d59('0x10e')](db['ChatProactiveAction'],{'as':_0x9d59('0x18a')});db['ChatWebsite'][_0x9d59('0x10e')](db[_0x9d59('0x6a')],{'as':_0x9d59('0x160')});db[_0x9d59('0x65')][_0x9d59('0x10e')](db[_0x9d59('0x68')],{'as':'Applications'});db['ChatWebsite'][_0x9d59('0x10e')](db['ChatMessage'],{'as':_0x9d59('0x154')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':'ListId'});db[_0x9d59('0x65')][_0x9d59('0x11e')](db[_0x9d59('0x86')],{'as':_0x9d59('0x86'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x65')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'as':_0x9d59('0x3d'),'foreignKey':_0x9d59('0x15b')});db['ChatWebsite'][_0x9d59('0x11e')](db[_0x9d59('0x87')],{'as':_0x9d59('0x163'),'foreignKey':_0x9d59('0x14e')});db[_0x9d59('0x65')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':'user_has_chat_websites'});db[_0x9d59('0x18b')]['belongsTo'](db[_0x9d59('0x5c')],{});db[_0x9d59('0x18b')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x18b')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x18b')]['belongsTo'](db[_0x9d59('0x60')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x9d59('0x62')],{});db['OpenchannelQueueReport'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x18b')][_0x9d59('0x11e')](db['OpenchannelQueue'],{});db[_0x9d59('0x68')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':'Agent','foreignKey':_0x9d59('0x10d'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x68')]['belongsTo'](db['ChatQueue'],{'as':_0x9d59('0x18c'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0x9d59('0x68')][_0x9d59('0x11e')](db[_0x9d59('0x65')],{'as':'Website','foreignKey':_0x9d59('0x189'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x68')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x6a')][_0x9d59('0x10e')](db[_0x9d59('0x18d')],{'as':_0x9d59('0x154'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x18e')});db[_0x9d59('0x6a')]['belongsTo'](db[_0x9d59('0x65')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x189')});db['ChatInteraction'][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x6a')]['belongsTo'](db[_0x9d59('0x13')],{'as':'Owner','foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x6a')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':'chat_interaction_has_tags','as':_0x9d59('0x169')});db[_0x9d59('0x6a')]['belongsToMany'](db[_0x9d59('0x90')],{'through':_0x9d59('0x18f'),'as':_0x9d59('0x17a')});db['ChatInteraction'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x12a'),'foreignKey':_0x9d59('0x18e')});db[_0x9d59('0x18d')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':'cascade','as':_0x9d59('0x13')});db[_0x9d59('0x18d')][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x18d')]['belongsTo'](db[_0x9d59('0x6a')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x18e')});db[_0x9d59('0x18d')][_0x9d59('0x11e')](db['Attachment'],{'as':_0x9d59('0xeb'),'foreignKey':'AttachmentId'});db[_0x9d59('0x18d')]['belongsTo'](db[_0x9d59('0x65')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x189')});db[_0x9d59('0x16e')][_0x9d59('0x10e')](db['Attachment'],{'as':'Attachments','foreignKey':_0x9d59('0x16f'),'onDelete':'cascade','hooks':!![]});db[_0x9d59('0x16e')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x16e')][_0x9d59('0x11e')](db['ChatWebsite'],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x189')});db[_0x9d59('0x6c')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x190'),'hooks':!![]});db[_0x9d59('0x6c')][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':'team_has_chat_queues','as':_0x9d59('0x151')});db[_0x9d59('0x6e')]['hasMany'](db[_0x9d59('0xcf')],{'as':_0x9d59('0x154'),'foreignKey':_0x9d59('0x191'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x6e')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x144'),'through':_0x9d59('0x192')});db[_0x9d59('0x6f')][_0x9d59('0x11e')](db[_0x9d59('0x65')],{'as':_0x9d59('0x193'),'foreignKey':'ChatWebsiteId'});db[_0x9d59('0x71')][_0x9d59('0x10e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x123'),'foreignKey':'CompanyId'});db[_0x9d59('0x72')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')]['hasMany'](db[_0x9d59('0x77')],{'as':'HopperFinals','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db['CmHopperHistory'],{'as':_0x9d59('0x147'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db['ReportAgentPreview'],{'as':_0x9d59('0x7b'),'foreignKey':_0x9d59('0x159')});db['CmContact']['hasMany'](db['JscriptySessionReport'],{'as':_0x9d59('0x194'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db['OpenchannelInteraction'],{'as':_0x9d59('0x116'),'foreignKey':_0x9d59('0x159'),'onDelete':'restrict'});db['CmContact'][_0x9d59('0x10e')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x9d59('0x72')]['hasMany'](db[_0x9d59('0x56')],{'as':_0x9d59('0x118'),'foreignKey':_0x9d59('0x159'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db[_0x9d59('0x4b')],{'as':_0x9d59('0x119'),'foreignKey':_0x9d59('0x159'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x72')][_0x9d59('0x10e')](db[_0x9d59('0x40')],{'as':'MailInteractions','foreignKey':_0x9d59('0x159'),'onDelete':'restrict'});db[_0x9d59('0x72')][_0x9d59('0x11e')](db[_0x9d59('0x71')],{'as':'Company','foreignKey':_0x9d59('0x195')});db[_0x9d59('0x72')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':_0x9d59('0x161'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x9d59('0x72')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':'cm_user_has_contacts'});db[_0x9d59('0x72')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'as':_0x9d59('0x169'),'through':_0x9d59('0x196')});db[_0x9d59('0x72')][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x196'),'as':'ThroughTags'});db['CmHopper'][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId','onDelete':_0x9d59('0x113')});db[_0x9d59('0x74')][_0x9d59('0x11e')](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':'ListId','onDelete':_0x9d59('0x113')});db[_0x9d59('0x74')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x197'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x74')][_0x9d59('0x11e')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x9d59('0x145'),'onDelete':_0x9d59('0x113')});db['CmHopper']['belongsTo'](db[_0x9d59('0xe8')],{'as':_0x9d59('0xe8'),'foreignKey':_0x9d59('0x198'),'onDelete':_0x9d59('0x113')});db['CmHopper'][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x199')});db[_0x9d59('0x148')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x9d59('0x148')][_0x9d59('0x11e')](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x148')][_0x9d59('0x11e')](db[_0x9d59('0x1d')],{'as':_0x9d59('0x18c'),'foreignKey':_0x9d59('0x145'),'onDelete':_0x9d59('0x113')});db['CmHopperBlack'][_0x9d59('0x11e')](db[_0x9d59('0xe8')],{'as':_0x9d59('0xe8'),'foreignKey':_0x9d59('0x198'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x80')][_0x9d59('0x10e')](db['Condition'],{'as':{'plural':_0x9d59('0x19a'),'singular':'OneAll'},'foreignKey':_0x9d59('0x19b'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x80')][_0x9d59('0x10e')](db[_0x9d59('0x85')],{'as':{'plural':_0x9d59('0x19c'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x9d59('0x80')]['hasMany'](db[_0x9d59('0x7e')],{'as':_0x9d59('0x19d'),'foreignKey':_0x9d59('0x19e'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x84')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':'Dispositions','foreignKey':_0x9d59('0x19f'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0x86')]['hasMany'](db[_0x9d59('0x86')],{'as':_0x9d59('0x1a0'),'foreignKey':_0x9d59('0x14d'),'onDelete':_0x9d59('0x113'),'hooks':!![],'required':![]});db[_0x9d59('0x86')][_0x9d59('0x10e')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x9d59('0x14d'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x86')][_0x9d59('0x10e')](db[_0x9d59('0x43')],{'as':_0x9d59('0x1a1'),'foreignKey':'IntervalId'});db[_0x9d59('0x86')][_0x9d59('0x10e')](db[_0x9d59('0x68')],{'as':'ChatApplications','foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x86')][_0x9d59('0x10e')](db['FaxApplication'],{'as':_0x9d59('0x1a2'),'foreignKey':_0x9d59('0x14d')});db[_0x9d59('0x86')][_0x9d59('0x10e')](db[_0x9d59('0x17e')],{'as':_0x9d59('0x1a3'),'foreignKey':'IntervalId'});db[_0x9d59('0x1a4')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{});db[_0x9d59('0x1a4')][_0x9d59('0x11e')](db[_0x9d59('0x1a5')],{'foreignKey':_0x9d59('0x1a6')});db[_0x9d59('0x1a4')][_0x9d59('0x11e')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x9d59('0x8e')]['belongsToMany'](db[_0x9d59('0x1b')],{'as':_0x9d59('0x1a7'),'through':_0x9d59('0x1a8'),'onDelete':_0x9d59('0x170')});db[_0x9d59('0x90')]['belongsToMany'](db[_0x9d59('0x72')],{'through':_0x9d59('0x196')});db[_0x9d59('0x90')][_0x9d59('0x121')](db[_0x9d59('0x6a')],{'through':_0x9d59('0x18f')});db[_0x9d59('0x90')][_0x9d59('0x121')](db[_0x9d59('0x40')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x9d59('0x121')](db[_0x9d59('0x56')],{'through':_0x9d59('0x180')});db[_0x9d59('0x90')][_0x9d59('0x121')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x9d59('0x90')][_0x9d59('0x121')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x9d59('0x90')]['belongsToMany'](db[_0x9d59('0x101')],{'through':_0x9d59('0x1a9')});db['Trigger'][_0x9d59('0x10e')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x9d59('0x1aa')},'foreignKey':_0x9d59('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x9d59('0x92')][_0x9d59('0x10e')](db[_0x9d59('0x85')],{'as':{'plural':_0x9d59('0x1ac'),'singular':_0x9d59('0x1ad')},'foreignKey':_0x9d59('0x1ae'),'onDelete':_0x9d59('0x113'),'hooks':!![]});db['Trigger'][_0x9d59('0x10e')](db[_0x9d59('0x7e')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x9d59('0x113'),'hooks':!![]});db[_0x9d59('0x99')][_0x9d59('0x10e')](db[_0x9d59('0x9e')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b0'),'hooks':!![]});db['AnalyticDefaultReport'][_0x9d59('0x10e')](db[_0x9d59('0x9e')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1a6')});db[_0x9d59('0x1b1')][_0x9d59('0x10e')](db[_0x9d59('0x9e')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x9d59('0x11e')](db[_0x9d59('0x1b1')],{'foreignKey':_0x9d59('0x1b2')});db['SalesforceAccount'][_0x9d59('0x10e')](db['SalesforceConfiguration'],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa4')]['hasMany'](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1b5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x9d59('0xa4')]['hasMany'](db['SalesforceField'],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b7')});db['SalesforceConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b8')});db['SalesforceConfiguration'][_0x9d59('0x11e')](db[_0x9d59('0xa2')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa6')][_0x9d59('0x10e')](db['SalesforceField'],{'as':_0x9d59('0x1b9'),'foreignKey':'SubjectId'});db[_0x9d59('0xa6')][_0x9d59('0x10e')](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xa6')][_0x9d59('0x10e')](db[_0x9d59('0xa6')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xa6')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0x1bd')][_0x9d59('0x10e')](db[_0x9d59('0xa8')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa8')]['hasMany'](db[_0x9d59('0xa9')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xa8')][_0x9d59('0x10e')](db[_0x9d59('0xa9')],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':'DescriptionId'});db[_0x9d59('0xa8')]['hasMany'](db[_0x9d59('0xa9')],{'as':_0x9d59('0x1af'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xa8')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xa9')][_0x9d59('0x10e')](db['SugarcrmField'],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xa9')][_0x9d59('0x10e')](db[_0x9d59('0xa9')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xa9')]['hasMany'](db['SugarcrmField'],{'as':_0x9d59('0x1bb'),'foreignKey':'FieldId'});db[_0x9d59('0xa9')][_0x9d59('0x11e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x9d59('0x1bf')]['hasMany'](db[_0x9d59('0xab')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xab')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xab')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1b6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x9d59('0xab')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1af'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xab')][_0x9d59('0x11e')](db['DeskAccount'],{'as':'Account','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xab')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':'int_desk_configuration_has_tags'});db[_0x9d59('0x1c0')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1b9'),'foreignKey':'SubjectId'});db['DeskField'][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0x1c0')][_0x9d59('0x10e')](db[_0x9d59('0x1c0')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db['DeskField']['belongsTo'](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xae')][_0x9d59('0x10e')](db[_0x9d59('0xb0')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db['ZohoConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xb0')][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb0')][_0x9d59('0x10e')](db['ZohoField'],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb0')][_0x9d59('0x11e')](db[_0x9d59('0xae')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xb1')]['hasMany'](db[_0x9d59('0xb1')],{'as':_0x9d59('0x1b9'),'foreignKey':'SubjectId'});db['ZohoField'][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x9d59('0xb1')][_0x9d59('0x10e')](db[_0x9d59('0xb1')],{'as':'Field','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb1')]['belongsTo'](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xb2')][_0x9d59('0x10e')](db[_0x9d59('0xb4')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xb4')][_0x9d59('0x10e')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xb4')][_0x9d59('0x10e')](db[_0x9d59('0xb6')],{'as':'Descriptions','foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb4')]['hasMany'](db[_0x9d59('0xb6')],{'as':'Fields','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb4')][_0x9d59('0x11e')](db[_0x9d59('0xb2')],{'as':_0x9d59('0x165'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x1c1')});db[_0x9d59('0xb6')]['hasMany'](db[_0x9d59('0xb6')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db['ZendeskField'][_0x9d59('0x10e')](db['ZendeskField'],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb6')][_0x9d59('0x10e')](db['ZendeskField'],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db['ZendeskField'][_0x9d59('0x11e')](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db['FreshdeskAccount'][_0x9d59('0x10e')](db[_0x9d59('0xb8')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xb8')][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':'Descriptions','onDelete':_0x9d59('0x113'),'foreignKey':'DescriptionId'});db[_0x9d59('0xb8')][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb8')][_0x9d59('0x11e')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x9d59('0x1b4')});db['FreshdeskConfiguration'][_0x9d59('0x121')](db['Tag'],{'through':_0x9d59('0x1c2')});db['FreshdeskField'][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':'Subject','foreignKey':_0x9d59('0x1be')});db['FreshdeskField']['hasMany'](db[_0x9d59('0xb9')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xb9')][_0x9d59('0x10e')](db[_0x9d59('0xb9')],{'as':'Field','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xb9')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':'VariableId'});db[_0x9d59('0xbb')][_0x9d59('0x10e')](db[_0x9d59('0x1c3')],{'as':_0x9d59('0x1b3'),'onDelete':'cascade','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0x1c3')][_0x9d59('0x10e')](db['VtigerField'],{'as':_0x9d59('0x1b5'),'foreignKey':_0x9d59('0x1be')});db['VtigerConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1b6'),'foreignKey':_0x9d59('0x1b7')});db['VtigerConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1af'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0x1c3')]['belongsTo'](db[_0x9d59('0xbb')],{'as':'Account','foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0x1c4')][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0x1c4')]['hasMany'](db[_0x9d59('0x1c4')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db['VtigerField'][_0x9d59('0x10e')](db[_0x9d59('0x1c4')],{'as':'Field','foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0x1c4')][_0x9d59('0x11e')](db['Variable'],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xbe')][_0x9d59('0x10e')](db[_0x9d59('0xbf')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xbf')]['hasMany'](db['ServicenowField'],{'as':_0x9d59('0x1b5'),'foreignKey':_0x9d59('0x1be')});db['ServicenowConfiguration']['hasMany'](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1b6'),'foreignKey':_0x9d59('0x1b7')});db['ServicenowConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1af'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xbf')][_0x9d59('0x11e')](db[_0x9d59('0xbe')],{'as':_0x9d59('0x165'),'foreignKey':'AccountId'});db['ServicenowField']['hasMany'](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xc1')]['hasMany'](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xc1')][_0x9d59('0x10e')](db[_0x9d59('0xc1')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0xc1')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xc3')][_0x9d59('0x10e')](db[_0x9d59('0xc5')],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db['Dynamics365Configuration'][_0x9d59('0x10e')](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1b5'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1be')});db['Dynamics365Configuration'][_0x9d59('0x10e')](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1b6'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b7')});db['Dynamics365Configuration'][_0x9d59('0x10e')](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1af'),'onDelete':_0x9d59('0x113'),'foreignKey':'FieldId'});db[_0x9d59('0xc5')]['belongsTo'](db['Dynamics365Account'],{'as':_0x9d59('0x165'),'foreignKey':'AccountId'});db[_0x9d59('0xc6')]['hasMany'](db[_0x9d59('0xc6')],{'as':'Subject','foreignKey':_0x9d59('0x1be')});db[_0x9d59('0xc6')]['hasMany'](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db['Dynamics365Field']['hasMany'](db[_0x9d59('0xc6')],{'as':_0x9d59('0x1bb'),'foreignKey':'FieldId'});db[_0x9d59('0xc6')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0xc7')][_0x9d59('0x10e')](db['FreshsalesConfiguration'],{'as':_0x9d59('0x1b3'),'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0xc9')]['hasMany'](db[_0x9d59('0x1c5')],{'as':'Subjects','foreignKey':_0x9d59('0x1be')});db['FreshsalesConfiguration'][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1b6'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0xc9')][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1af'),'foreignKey':_0x9d59('0x1b8')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1b4')});db[_0x9d59('0x1c5')][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1b9'),'foreignKey':_0x9d59('0x1be')});db[_0x9d59('0x1c5')][_0x9d59('0x10e')](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1ba'),'foreignKey':_0x9d59('0x1b7')});db[_0x9d59('0x1c5')]['hasMany'](db[_0x9d59('0x1c5')],{'as':_0x9d59('0x1bb'),'foreignKey':_0x9d59('0x1b8')});db[_0x9d59('0x1c5')][_0x9d59('0x11e')](db[_0x9d59('0x94')],{'as':_0x9d59('0x94'),'foreignKey':_0x9d59('0x1bc')});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x65')],{});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':'List','foreignKey':_0x9d59('0x173')});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':'ContactId'});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x6a')],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db[_0x9d59('0x1c6')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0x1c6')]['belongsTo'](db[_0x9d59('0x6c')],{});db[_0x9d59('0xcf')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x9d59('0xcf')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1c7')});db[_0x9d59('0xd3')][_0x9d59('0x10e')](db[_0x9d59('0xd1')],{'foreignKey':_0x9d59('0x1c8'),'onDelete':_0x9d59('0x113')});db['JscriptySessionReport'][_0x9d59('0x10e')](db[_0x9d59('0x1c9')],{'foreignKey':_0x9d59('0x1c8'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db['SmsAccount'],{});db['SmsQueueReport'][_0x9d59('0x11e')](db['CmList'],{'as':'List','foreignKey':_0x9d59('0x173')});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db['SmsInteraction'],{});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db[_0x9d59('0x58')],{});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{});db[_0x9d59('0xd4')][_0x9d59('0x11e')](db['SmsQueue'],{});db[_0x9d59('0xda')][_0x9d59('0x10e')](db[_0x9d59('0xd3')],{'foreignKey':_0x9d59('0x1ca')});db[_0x9d59('0xda')][_0x9d59('0x10e')](db[_0x9d59('0xd1')],{'foreignKey':_0x9d59('0x1ca')});db[_0x9d59('0xda')][_0x9d59('0x10e')](db[_0x9d59('0x1c9')],{'foreignKey':_0x9d59('0x1ca')});db[_0x9d59('0x13f')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x140')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db['User'],{'as':_0x9d59('0x150'),'through':'user_has_teams'});db['Team'][_0x9d59('0x121')](db[_0x9d59('0x1d')],{'through':_0x9d59('0x10a'),'as':_0x9d59('0x12d')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db[_0x9d59('0x3e')],{'through':_0x9d59('0x164'),'as':_0x9d59('0x1cb')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x9d59('0x12e')});db[_0x9d59('0xe4')]['belongsToMany'](db[_0x9d59('0x4f')],{'through':_0x9d59('0x1cc'),'as':_0x9d59('0x12f')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db['SmsQueue'],{'through':_0x9d59('0x183'),'as':_0x9d59('0x131')});db[_0x9d59('0xe4')][_0x9d59('0x121')](db[_0x9d59('0x64')],{'through':_0x9d59('0x1cd'),'as':_0x9d59('0x132')});db[_0x9d59('0xe4')]['belongsToMany'](db[_0x9d59('0x108')],{'through':_0x9d59('0x1ce'),'as':_0x9d59('0x133')});db[_0x9d59('0xe8')][_0x9d59('0x10e')](db[_0x9d59('0x74')],{'as':_0x9d59('0x146'),'foreignKey':'CampaignId'});db['Campaign'][_0x9d59('0x10e')](db[_0x9d59('0x77')],{'as':_0x9d59('0x114'),'foreignKey':_0x9d59('0x198')});db[_0x9d59('0xe8')][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':_0x9d59('0x147'),'foreignKey':_0x9d59('0x198')});db[_0x9d59('0xe8')]['hasMany'](db[_0x9d59('0x148')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x9d59('0xe8')]['belongsTo'](db[_0x9d59('0x2c')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x9d59('0xe8')][_0x9d59('0x11e')](db[_0x9d59('0x2c')],{'as':_0x9d59('0x14b'),'foreignKey':_0x9d59('0x14c')});db[_0x9d59('0xe8')][_0x9d59('0x11e')](db['Interval'],{'as':_0x9d59('0x86'),'foreignKey':'IntervalId'});db[_0x9d59('0xe8')]['belongsTo'](db[_0x9d59('0x13f')],{'as':_0x9d59('0x13f'),'foreignKey':_0x9d59('0x1cf')});db['Campaign'][_0x9d59('0x121')](db[_0x9d59('0x125')],{'as':_0x9d59('0x126'),'through':'campaigns_has_cm_lists'});db[_0x9d59('0xe8')]['belongsToMany'](db['CmList'],{'as':_0x9d59('0x152'),'through':_0x9d59('0x1d0')});db[_0x9d59('0xeb')][_0x9d59('0x11e')](db[_0x9d59('0x16e')],{'as':_0x9d59('0x16e'),'foreignKey':_0x9d59('0x16f')});db['MailTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x41')],{});db[_0x9d59('0xec')]['belongsTo'](db['MailInteraction'],{});db[_0x9d59('0xec')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'foreignKey':_0x9d59('0x1d1'),'as':_0x9d59('0x1d2')});db[_0x9d59('0xec')][_0x9d59('0x11e')](db['User'],{'foreignKey':_0x9d59('0x1d3'),'as':_0x9d59('0x1d4')});db[_0x9d59('0xec')]['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':_0x9d59('0x1d6')});db['MailTransferReport']['belongsTo'](db[_0x9d59('0x3e')],{'foreignKey':_0x9d59('0x1d7'),'as':_0x9d59('0x1d8')});db[_0x9d59('0xec')][_0x9d59('0x11e')](db[_0x9d59('0x3d')],{'foreignKey':_0x9d59('0x1d9'),'as':'ToAccount'});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x18d')],{});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x6a')],{});db[_0x9d59('0xee')]['belongsTo'](db[_0x9d59('0x65')],{'foreignKey':_0x9d59('0x1da'),'as':'FromAccount'});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d3'),'as':'FromAgent'});db[_0x9d59('0xee')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db[_0x9d59('0xee')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x9d59('0x1db'),'as':_0x9d59('0x1d8')});db['ChatTransferReport'][_0x9d59('0x11e')](db['ChatWebsite'],{'foreignKey':_0x9d59('0x1dc'),'as':'ToAccount'});db[_0x9d59('0xf0')]['belongsTo'](db[_0x9d59('0x4d')],{});db['FaxTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x4b')],{});db[_0x9d59('0xf0')][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':'FromUserId','as':_0x9d59('0x1d4')});db[_0x9d59('0xf0')][_0x9d59('0x11e')](db['User'],{'foreignKey':'ToUserId','as':_0x9d59('0x1d6')});db[_0x9d59('0xf0')][_0x9d59('0x11e')](db[_0x9d59('0x4f')],{'foreignKey':'ToFaxQueueId','as':_0x9d59('0x1d8')});db['FaxTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x47')],{'foreignKey':_0x9d59('0x1dd'),'as':_0x9d59('0x1de')});db['OpenchannelTransferReport']['belongsTo'](db[_0x9d59('0x62')],{});db[_0x9d59('0xf2')]['belongsTo'](db[_0x9d59('0x60')],{});db[_0x9d59('0xf2')][_0x9d59('0x11e')](db[_0x9d59('0x5c')],{'foreignKey':_0x9d59('0x1df'),'as':_0x9d59('0x1d2')});db[_0x9d59('0xf2')]['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d3'),'as':_0x9d59('0x1d4')});db[_0x9d59('0xf2')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x9d59('0x64')],{'foreignKey':_0x9d59('0x1e0'),'as':_0x9d59('0x1d8')});db[_0x9d59('0xf2')][_0x9d59('0x11e')](db[_0x9d59('0x5c')],{'foreignKey':_0x9d59('0x1e1'),'as':_0x9d59('0x1de')});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x58')],{});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x56')],{});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x53')],{'foreignKey':_0x9d59('0x1e2'),'as':_0x9d59('0x1d2')});db['SmsTransferReport']['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d3'),'as':_0x9d59('0x1d4')});db[_0x9d59('0xf4')]['belongsTo'](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db[_0x9d59('0xf4')][_0x9d59('0x11e')](db[_0x9d59('0x5a')],{'foreignKey':_0x9d59('0x1e3'),'as':_0x9d59('0x1d8')});db['SmsTransferReport']['belongsTo'](db[_0x9d59('0x53')],{'foreignKey':_0x9d59('0x1e4'),'as':'ToAccount'});db[_0x9d59('0x125')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':_0x9d59('0x188'),'foreignKey':_0x9d59('0x173')});db[_0x9d59('0x125')]['hasMany'](db[_0x9d59('0x7c')],{'as':_0x9d59('0x1e5'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmContact'],{'as':_0x9d59('0x123'),'onDelete':_0x9d59('0x113'),'foreignKey':'ListId'});db[_0x9d59('0x125')][_0x9d59('0x10e')](db[_0x9d59('0x77')],{'as':_0x9d59('0x114'),'foreignKey':_0x9d59('0x173')});db['CmList'][_0x9d59('0x10e')](db[_0x9d59('0x79')],{'as':'HopperHistory','foreignKey':_0x9d59('0x173')});db[_0x9d59('0x125')][_0x9d59('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x9d59('0x173')});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':_0x9d59('0x1e6'),'through':_0x9d59('0x14f')});db['CmList'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x127')});db[_0x9d59('0xf7')][_0x9d59('0x10e')](db[_0x9d59('0x19')],{'as':_0x9d59('0x112'),'onDelete':_0x9d59('0x113')});db[_0x9d59('0xf7')][_0x9d59('0x121')](db['User'],{'as':'Agents','through':_0x9d59('0x135')});db[_0x9d59('0x11f')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x9d59('0x120')});db['UserProfile']['hasMany'](db[_0x9d59('0xfa')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x9d59('0x113')});db[_0x9d59('0xfa')][_0x9d59('0x10e')](db[_0x9d59('0xfc')],{'as':_0x9d59('0x1e7'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db[_0x9d59('0x84')],{'as':_0x9d59('0x188'),'foreignKey':'WhatsappAccountId'});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db['CannedAnswer'],{'as':_0x9d59('0x15f'),'foreignKey':_0x9d59('0x1e8')});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db[_0x9d59('0x103')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x9d59('0x13d')]['hasMany'](db[_0x9d59('0x101')],{'as':'Interactions'});db[_0x9d59('0x13d')][_0x9d59('0x10e')](db['WhatsappApplication'],{'as':_0x9d59('0x142')});db[_0x9d59('0x13d')]['belongsTo'](db['CmList'],{'as':_0x9d59('0x161'),'foreignKey':_0x9d59('0x173')});db['WhatsappAccount'][_0x9d59('0x11e')](db['Pause'],{'as':_0x9d59('0x163'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9d59('0x13d')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':'Agents','through':_0x9d59('0x13e')});db[_0x9d59('0x100')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'onDelete':_0x9d59('0x170')});db['WhatsappApplication'][_0x9d59('0x11e')](db[_0x9d59('0x108')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x100')][_0x9d59('0x11e')](db[_0x9d59('0x13d')],{'onDelete':_0x9d59('0x170')});db[_0x9d59('0x100')][_0x9d59('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x9d59('0x100')][_0x9d59('0x11e')](db[_0x9d59('0x90')],{'onDelete':_0x9d59('0x170'),'foreignKey':_0x9d59('0x171')});db[_0x9d59('0x101')]['hasMany'](db[_0x9d59('0x103')],{'as':'Messages','onDelete':_0x9d59('0x113'),'foreignKey':_0x9d59('0x1e9')});db['WhatsappInteraction']['belongsTo'](db[_0x9d59('0x13d')],{'as':_0x9d59('0x165'),'foreignKey':_0x9d59('0x1e8')});db[_0x9d59('0x101')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':_0x9d59('0x166'),'foreignKey':_0x9d59('0x159')});db[_0x9d59('0x101')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'as':_0x9d59('0x167'),'foreignKey':_0x9d59('0x10d')});db[_0x9d59('0x101')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':_0x9d59('0x1a9'),'as':'Tags'});db[_0x9d59('0x101')][_0x9d59('0x121')](db[_0x9d59('0x90')],{'through':'whatsapp_interaction_has_tags','as':_0x9d59('0x17a')});db[_0x9d59('0x101')][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x16a'),'through':_0x9d59('0x12c'),'foreignKey':_0x9d59('0x1e9')});db['WhatsappMessage'][_0x9d59('0x11e')](db['User'],{'as':_0x9d59('0x13')});db['WhatsappMessage'][_0x9d59('0x11e')](db['CmContact'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x166')});db[_0x9d59('0x103')][_0x9d59('0x11e')](db['WhatsappInteraction'],{'onDelete':_0x9d59('0x113'),'as':_0x9d59('0x16d'),'foreignKey':_0x9d59('0x1e9')});db[_0x9d59('0x103')]['belongsTo'](db[_0x9d59('0x13d')],{'as':'Account','foreignKey':_0x9d59('0x1e8')});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x13d')],{});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x125')],{'as':'List','foreignKey':'ListId'});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x72')],{'as':'Contact','foreignKey':_0x9d59('0x159')});db[_0x9d59('0x104')][_0x9d59('0x11e')](db[_0x9d59('0x101')],{});db[_0x9d59('0x104')]['belongsTo'](db['WhatsappQueue'],{});db[_0x9d59('0x104')][_0x9d59('0x11e')](db['WhatsappMessage'],{});db[_0x9d59('0x104')][_0x9d59('0x11e')](db['User'],{});db[_0x9d59('0x106')][_0x9d59('0x11e')](db[_0x9d59('0x103')],{});db['WhatsappTransferReport'][_0x9d59('0x11e')](db[_0x9d59('0x101')],{});db[_0x9d59('0x106')][_0x9d59('0x11e')](db['WhatsappAccount'],{'foreignKey':_0x9d59('0x1ea'),'as':'FromAccount'});db[_0x9d59('0x106')][_0x9d59('0x11e')](db[_0x9d59('0x13d')],{'foreignKey':_0x9d59('0x1eb'),'as':'ToAccount'});db[_0x9d59('0x106')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x9d59('0x1ec'),'as':_0x9d59('0x1d8')});db[_0x9d59('0x106')][_0x9d59('0x11e')](db['User'],{'foreignKey':_0x9d59('0x1d3'),'as':'FromAgent'});db[_0x9d59('0x106')][_0x9d59('0x11e')](db[_0x9d59('0x13')],{'foreignKey':_0x9d59('0x1d5'),'as':'ToAgent'});db['WhatsappQueue'][_0x9d59('0x121')](db[_0x9d59('0x13')],{'as':_0x9d59('0x150'),'through':_0x9d59('0x39'),'foreignKey':_0x9d59('0x1ed')});db['WhatsappQueue'][_0x9d59('0x121')](db[_0x9d59('0xe4')],{'through':_0x9d59('0x1ce'),'as':_0x9d59('0x151')});module[_0x9d59('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf6cc=['../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','User','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','HopperFinals','HopperHistory','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotification','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','Applications','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','hasOne','Imap','Smtp','Dispositions','MailAccountId','CannedAnswer','MailApplication','List','ListId','UserMailQueue','Teams','Messages','MailInteractionId','Account','Contact','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','Items','FaxAccountId','Answers','Interactions','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','UserFaxQueue','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsApplication','user_has_sms_accounts','IntervalId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','CompanyId','Company','cm_contact_has_tags','CampaignId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','whatsapp_interaction_has_tags','AllCondition','AnyConditions','AnyCondition','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SubjectId','DescriptionId','FieldId','SalesforceAccount','Subject','Description','Field','SugarcrmAccount','Descriptions','SugarcrmField','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','Subjects','ZohoField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','ServicenowField','FreshsalesConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','SmsQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','utf8mb4','name','utf8_general_ci','sequelizeHistory','xcall','mysql','utf8','database','username','options','password','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard'];(function(_0x2bf538,_0x4ec3b2){var _0xc8250e=function(_0x5b1f84){while(--_0x5b1f84){_0x2bf538['push'](_0x2bf538['shift']());}};_0xc8250e(++_0x4ec3b2);}(_0xf6cc,0x1b6));var _0xcf6c=function(_0x2dc16e,_0x24a71b){_0x2dc16e=_0x2dc16e-0x0;var _0x52c492=_0xf6cc[_0x2dc16e];return _0x52c492;};'use strict';var path=require(_0xcf6c('0x0'));var config=require(_0xcf6c('0x1'));var Sequelize=require(_0xcf6c('0x2'));var _=require(_0xcf6c('0x3'));var jstz=require(_0xcf6c('0x4'));var timezone=jstz[_0xcf6c('0x5')]();config[_0xcf6c('0x2')]=_[_0xcf6c('0x6')](config['sequelize'],{'database':_0xcf6c('0x7'),'username':'xcall','password':_0xcf6c('0x8'),'options':{'host':_0xcf6c('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xcf6c('0xa')},'logging':![],'timezone':timezone[_0xcf6c('0xb')](),'define':{'charset':'utf8','collate':_0xcf6c('0xc')}}});config[_0xcf6c('0xd')]=_[_0xcf6c('0x6')](config[_0xcf6c('0xd')],{'database':_0xcf6c('0x7'),'username':_0xcf6c('0xe'),'password':_0xcf6c('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xcf6c('0xf'),'dialectOptions':{'charset':_0xcf6c('0xa')},'logging':![],'timezone':timezone[_0xcf6c('0xb')](),'define':{'charset':_0xcf6c('0x10'),'collate':_0xcf6c('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcf6c('0x2')][_0xcf6c('0x11')],config[_0xcf6c('0x2')][_0xcf6c('0x12')],config['sequelize']['password'],config[_0xcf6c('0x2')][_0xcf6c('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcf6c('0xd')]['database'],config[_0xcf6c('0xd')][_0xcf6c('0x12')],config['sequelizeHistory'][_0xcf6c('0x14')],config['sequelizeHistory'][_0xcf6c('0x13')])};db['User']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x16'));db[_0xcf6c('0x17')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x18'));db[_0xcf6c('0x19')]=db['sequelize']['import'](_0xcf6c('0x1a'));db[_0xcf6c('0x1b')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x1c'));db['VoiceMusicOnHold']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x1d'));db[_0xcf6c('0x1e')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x1f'));db[_0xcf6c('0x20')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x21'));db[_0xcf6c('0x22')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x23'));db[_0xcf6c('0x24')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x25'));db['VoiceMailMessage']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x26'));db[_0xcf6c('0x27')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0xcf6c('0x28')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x29'));db[_0xcf6c('0x2a')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x2b'));db[_0xcf6c('0x2c')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x2d'));db[_0xcf6c('0x2e')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x2f'));db['Trunk']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x30'));db[_0xcf6c('0x31')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xcf6c('0x32')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x33'));db[_0xcf6c('0x34')]=db['sequelize']['import'](_0xcf6c('0x35'));db[_0xcf6c('0x36')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x37'));db['UserMailQueue']=db['sequelize']['import'](_0xcf6c('0x38'));db['UserFaxQueue']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x39'));db[_0xcf6c('0x3a')]=db['sequelize']['import'](_0xcf6c('0x3b'));db[_0xcf6c('0x3c')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x3d'));db['UserWhatsappQueue']=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xcf6c('0x3e')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x3f'));db['MailServerOut']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x40'));db['MailAccount']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x41'));db[_0xcf6c('0x42')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x43'));db[_0xcf6c('0x44')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x45'));db[_0xcf6c('0x46')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x47'));db[_0xcf6c('0x48')]=db['sequelize']['import'](_0xcf6c('0x49'));db['MailApplication']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x4a'));db[_0xcf6c('0x4b')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x4c'));db[_0xcf6c('0x4d')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x4e'));db[_0xcf6c('0x4f')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x50'));db['FaxAccount']=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x51'));db[_0xcf6c('0x52')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x53'));db[_0xcf6c('0x54')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x55'));db[_0xcf6c('0x56')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x57'));db[_0xcf6c('0x58')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x59'));db['FaxQueueReport']=db['sequelize'][_0xcf6c('0x15')]('../api/faxQueueReport/faxQueueReport.model');db[_0xcf6c('0x5a')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x5b'));db['SmsApplication']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x5c'));db[_0xcf6c('0x5d')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x5e'));db['SmsMessage']=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x5f'));db[_0xcf6c('0x60')]=db['sequelize'][_0xcf6c('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0xcf6c('0x61')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x62'));db[_0xcf6c('0x63')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x64'));db[_0xcf6c('0x65')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x66'));db[_0xcf6c('0x67')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x68'));db[_0xcf6c('0x69')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x6a'));db['OpenchannelQueueReport']=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x6b'));db[_0xcf6c('0x6c')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x6d'));db[_0xcf6c('0x6e')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x6f'));db[_0xcf6c('0x70')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x71'));db['ChatQueue']=db['sequelize']['import'](_0xcf6c('0x72'));db[_0xcf6c('0x73')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x74'));db[_0xcf6c('0x75')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x76'));db[_0xcf6c('0x77')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/cmCompany/cmCompany.model');db[_0xcf6c('0x78')]=db['sequelize']['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xcf6c('0x2')]['import']('../api/cmHopper/cmHopper.model');db[_0xcf6c('0x79')]=db['sequelize'][_0xcf6c('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xcf6c('0x7a')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x7b'));db[_0xcf6c('0x7c')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xcf6c('0x7d')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x7e'));db[_0xcf6c('0x7f')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x80'));db['Action']=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x81'));db['Automation']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x82'));db['CannedAnswer']=db['sequelize']['import'](_0xcf6c('0x83'));db[_0xcf6c('0x84')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x85'));db[_0xcf6c('0x86')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x87'));db['Interval']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x88'));db[_0xcf6c('0x89')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x8a'));db[_0xcf6c('0x8b')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x8c'));db[_0xcf6c('0x8d')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x8e'));db[_0xcf6c('0x8f')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/schedule/schedule.model');db[_0xcf6c('0x90')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x91'));db[_0xcf6c('0x92')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x93'));db[_0xcf6c('0x94')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x95'));db[_0xcf6c('0x96')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x97'));db[_0xcf6c('0x98')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x99'));db['Integration']=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0x9a'));db[_0xcf6c('0x9b')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/integrationReport/integrationReport.model');db[_0xcf6c('0x9c')]=db['sequelize']['import'](_0xcf6c('0x9d'));db['AnalyticDefaultReport']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x9e'));db[_0xcf6c('0x9f')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xa0'));db['AnalyticMetric']=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0xcf6c('0xa1')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xa2'));db['AnalyticTreeReport']=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xa3'));db['SalesforceAccount']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xa4'));db[_0xcf6c('0xa5')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xa6'));db[_0xcf6c('0xa7')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xa8'));db[_0xcf6c('0xa9')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xaa'));db['SugarcrmField']=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xcf6c('0xab')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xac'));db['DeskConfiguration']=db['sequelize'][_0xcf6c('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xcf6c('0xad')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xae'));db['ZohoAccount']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xaf'));db['ZohoConfiguration']=db['sequelize'][_0xcf6c('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xb0'));db[_0xcf6c('0xb1')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xb2'));db[_0xcf6c('0xb3')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xcf6c('0xb4')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xb5'));db[_0xcf6c('0xb6')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xb7'));db[_0xcf6c('0xb8')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xb9'));db[_0xcf6c('0xba')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xbb'));db['VtigerAccount']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xbc'));db[_0xcf6c('0xbd')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xbe'));db[_0xcf6c('0xbf')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xc0'));db[_0xcf6c('0xc1')]=db[_0xcf6c('0x2')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xc2'));db['ServicenowField']=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0xcf6c('0xc3')]=db['sequelize'][_0xcf6c('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xcf6c('0xc4')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xc5'));db[_0xcf6c('0xc6')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xc7'));db[_0xcf6c('0xc8')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xc9'));db[_0xcf6c('0xca')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xcb'));db[_0xcf6c('0xcc')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x9a'));db[_0xcf6c('0xcd')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xce'));db[_0xcf6c('0xcf')]=db['sequelize'][_0xcf6c('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0xcf6c('0xd0')]=db[_0xcf6c('0x2')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xd1'));db['JscriptyQuestionReport']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xd2'));db[_0xcf6c('0xd3')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xd4'));db[_0xcf6c('0xd5')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xd6'));db[_0xcf6c('0xd7')]=db['sequelize'][_0xcf6c('0x15')]('../api/squareReport/squareReport.model');db[_0xcf6c('0xd8')]=db['sequelize']['import'](_0xcf6c('0xd9'));db[_0xcf6c('0xda')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xdb'));db[_0xcf6c('0xdc')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xdd'));db[_0xcf6c('0xde')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xdf'));db[_0xcf6c('0xe0')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/squareProject/squareProject.model');db[_0xcf6c('0xe1')]=db[_0xcf6c('0x2')]['import']('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/squareMessage/squareMessage.model');db[_0xcf6c('0xe2')]=db[_0xcf6c('0x2')]['import']('../api/team/team.model');db[_0xcf6c('0xe3')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xe4'));db[_0xcf6c('0xe5')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xe6'));db['Migration']=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/migration/migration.model');db[_0xcf6c('0xe7')]=db['sequelize']['import'](_0xcf6c('0xe8'));db[_0xcf6c('0xe9')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xea'));db['MailTransferReport']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xeb'));db[_0xcf6c('0xec')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xed'));db['FaxTransferReport']=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xee'));db['OpenchannelTransferReport']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xef'));db[_0xcf6c('0xf0')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xf1'));db[_0xcf6c('0xf2')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xf3'));db[_0xcf6c('0xf4')]=db['sequelize'][_0xcf6c('0x15')](_0xcf6c('0xf5'));db['UserProfile']=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0xcf6c('0xf6')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xf7'));db['UserProfileResource']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xf8'));db['UserNotification']=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xf9'));db['WhatsappAccount']=db[_0xcf6c('0x2')][_0xcf6c('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0xcf6c('0xfa')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xfb'));db[_0xcf6c('0xfc')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0xfd'));db['WhatsappMessage']=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0xfe'));db[_0xcf6c('0xff')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x100'));db[_0xcf6c('0x101')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x102'));db[_0xcf6c('0x103')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x104'));db[_0xcf6c('0x105')]=db[_0xcf6c('0x2')][_0xcf6c('0x15')](_0xcf6c('0x106'));db[_0xcf6c('0x107')]=db[_0xcf6c('0x2')]['import'](_0xcf6c('0x108'));db[_0xcf6c('0x109')]['hasOne'](db['VoiceMail'],{'as':_0xcf6c('0x24'),'onDelete':'cascade','foreignKey':_0xcf6c('0x10a')});db['User'][_0xcf6c('0x10b')](db[_0xcf6c('0x20')],{'as':_0xcf6c('0x10c'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x109')][_0xcf6c('0x10b')](db[_0xcf6c('0x32')],{'as':_0xcf6c('0x10d'),'foreignKey':'UserId'});db[_0xcf6c('0x109')]['hasMany'](db[_0xcf6c('0x1b')],{'as':_0xcf6c('0x10e'),'onDelete':_0xcf6c('0x10f'),'hooks':!![]});db[_0xcf6c('0x109')][_0xcf6c('0x10b')](db[_0xcf6c('0x7a')],{'as':_0xcf6c('0x110'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x109')]['hasMany'](db[_0xcf6c('0x7c')],{'as':_0xcf6c('0x111'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x109')][_0xcf6c('0x10b')](db['ReportAgentPreview'],{'as':_0xcf6c('0x7d'),'foreignKey':'UserId'});db[_0xcf6c('0x109')][_0xcf6c('0x10b')](db[_0xcf6c('0x63')],{'as':'OpenchannelInteractions','foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x109')]['hasMany'](db[_0xcf6c('0x112')],{'as':_0xcf6c('0x113'),'foreignKey':_0xcf6c('0x10a')});db['User'][_0xcf6c('0x10b')](db[_0xcf6c('0x5d')],{'as':_0xcf6c('0x114'),'foreignKey':'UserId'});db[_0xcf6c('0x109')][_0xcf6c('0x10b')](db[_0xcf6c('0x54')],{'as':_0xcf6c('0x115'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x109')][_0xcf6c('0x10b')](db['MailInteraction'],{'as':_0xcf6c('0x116'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x109')][_0xcf6c('0x10b')](db[_0xcf6c('0xfc')],{'as':'WhatsappInteractions','foreignKey':_0xcf6c('0x10a')});db['User'][_0xcf6c('0x10b')](db[_0xcf6c('0x117')],{'as':_0xcf6c('0x118'),'foreignKey':_0xcf6c('0x119')});db[_0xcf6c('0x109')][_0xcf6c('0x11a')](db['UserProfile'],{'as':_0xcf6c('0x11b'),'foreignKey':_0xcf6c('0x11c')});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x73')],{'as':'Groups','through':'chat_group_has_users'});db['User']['belongsToMany'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x11e'),'through':_0xcf6c('0x11f')});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db['CmList'],{'as':_0xcf6c('0x120'),'through':'cm_user_has_lists'});db[_0xcf6c('0x109')]['belongsToMany'](db[_0xcf6c('0xe2')],{'through':_0xcf6c('0x121')});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x46')],{'as':_0xcf6c('0x116'),'through':_0xcf6c('0x122')});db['User']['belongsToMany'](db[_0xcf6c('0x112')],{'as':_0xcf6c('0x113'),'through':_0xcf6c('0x123')});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x54')],{'as':_0xcf6c('0x115'),'through':_0xcf6c('0x124')});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x5d')],{'as':_0xcf6c('0x114'),'through':_0xcf6c('0x125')});db[_0xcf6c('0x109')]['belongsToMany'](db[_0xcf6c('0x63')],{'as':_0xcf6c('0x126'),'through':_0xcf6c('0x127')});db['User']['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0xcf6c('0x128')});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x1e')],{'as':_0xcf6c('0x129'),'through':'UserVoiceQueue','required':![]});db['User']['belongsToMany'](db['MailQueue'],{'as':_0xcf6c('0x12a'),'through':'UserMailQueue','required':![]});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x12b')],{'as':_0xcf6c('0x12c'),'through':_0xcf6c('0x36'),'required':![],'hooks':!![]});db[_0xcf6c('0x109')]['belongsToMany'](db['FaxQueue'],{'as':_0xcf6c('0x12d'),'through':'UserFaxQueue','required':![]});db[_0xcf6c('0x109')]['belongsToMany'](db[_0xcf6c('0x12e')],{'as':'SmsQueues','through':_0xcf6c('0x3a'),'required':![]});db['User'][_0xcf6c('0x11d')](db['OpenchannelQueue'],{'as':_0xcf6c('0x12f'),'through':_0xcf6c('0x3c'),'required':![]});db['User']['belongsToMany'](db[_0xcf6c('0x103')],{'as':_0xcf6c('0x130'),'through':_0xcf6c('0x131'),'required':![]});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db['CmList'],{'through':_0xcf6c('0x132')});db[_0xcf6c('0x109')]['belongsToMany'](db['VoicePrefix'],{'as':_0xcf6c('0x133'),'through':_0xcf6c('0x134'),'required':![]});db[_0xcf6c('0x109')]['belongsToMany'](db['ChatWebsite'],{'as':_0xcf6c('0x135'),'through':_0xcf6c('0x136')});db[_0xcf6c('0x109')]['belongsToMany'](db[_0xcf6c('0x137')],{'as':_0xcf6c('0x138'),'through':_0xcf6c('0x139')});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x13a')],{'as':_0xcf6c('0x13b'),'through':'user_has_mail_accounts'});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db['OpenchannelAccount'],{'as':_0xcf6c('0x13c'),'through':_0xcf6c('0x13d')});db['User'][_0xcf6c('0x11d')](db[_0xcf6c('0x5a')],{'as':_0xcf6c('0x13e'),'through':'user_has_sms_accounts'});db[_0xcf6c('0x109')][_0xcf6c('0x11d')](db[_0xcf6c('0x13f')],{'as':_0xcf6c('0x140'),'through':_0xcf6c('0x141')});db['User'][_0xcf6c('0x11d')](db['SquareProject'],{'as':_0xcf6c('0x142'),'through':_0xcf6c('0x143')});db[_0xcf6c('0x17')][_0xcf6c('0x10b')](db[_0xcf6c('0x1b')],{'as':_0xcf6c('0x144'),'onDelete':_0xcf6c('0x10f'),'foreignKey':'ChanSpyId'});db[_0xcf6c('0x19')][_0xcf6c('0x10b')](db[_0xcf6c('0x1b')],{'onDelete':_0xcf6c('0x10f')});db['VoiceExtension']['hasMany'](db[_0xcf6c('0x1b')],{'as':_0xcf6c('0x145'),'onDelete':_0xcf6c('0x10f')});db['VoiceMusicOnHold'][_0xcf6c('0x11d')](db['Sound'],{'as':_0xcf6c('0x146'),'through':_0xcf6c('0x147')});db[_0xcf6c('0x1e')]['hasMany'](db[_0xcf6c('0x32')],{'as':'Members','foreignKey':_0xcf6c('0x148')});db[_0xcf6c('0x1e')][_0xcf6c('0x10b')](db[_0xcf6c('0x149')],{'as':_0xcf6c('0x14a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xcf6c('0x10b')](db['CmHopperFinal'],{'as':_0xcf6c('0x110'),'foreignKey':_0xcf6c('0x148')});db[_0xcf6c('0x1e')][_0xcf6c('0x10b')](db['CmHopperHistory'],{'as':_0xcf6c('0x14b'),'foreignKey':_0xcf6c('0x148')});db[_0xcf6c('0x1e')][_0xcf6c('0x10b')](db[_0xcf6c('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0xcf6c('0x148')});db[_0xcf6c('0x1e')][_0xcf6c('0x10b')](db['CmHopperBlack'],{'as':_0xcf6c('0x14c'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0xcf6c('0x14d'),'foreignKey':'VoiceQueueId'});db[_0xcf6c('0x1e')][_0xcf6c('0x11a')](db['Trunk'],{'as':_0xcf6c('0x14e'),'foreignKey':_0xcf6c('0x14f')});db['VoiceQueue'][_0xcf6c('0x11a')](db[_0xcf6c('0x14e')],{'as':_0xcf6c('0x150'),'foreignKey':'TrunkBackupId'});db[_0xcf6c('0x1e')]['belongsTo'](db[_0xcf6c('0x151')],{'as':_0xcf6c('0x151'),'foreignKey':'IntervalId'});db[_0xcf6c('0x1e')][_0xcf6c('0x11a')](db[_0xcf6c('0x89')],{'as':_0xcf6c('0x152'),'foreignKey':_0xcf6c('0x153')});db[_0xcf6c('0x1e')][_0xcf6c('0x11d')](db['CmList'],{'as':'Lists','through':_0xcf6c('0x154')});db[_0xcf6c('0x1e')][_0xcf6c('0x11d')](db['User'],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x34')});db[_0xcf6c('0x1e')]['belongsToMany'](db[_0xcf6c('0xe2')],{'as':'Teams','through':_0xcf6c('0x107')});db[_0xcf6c('0x1e')][_0xcf6c('0x11d')](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x156'),'through':_0xcf6c('0x157')});db[_0xcf6c('0x20')]['belongsTo'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x109'),'foreignKey':_0xcf6c('0x10a')});db['ScreenRecording'][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x109'),'foreignKey':_0xcf6c('0x10a')});db['VoiceMail'][_0xcf6c('0x10b')](db[_0xcf6c('0x158')],{'as':'Messages','onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x159'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0xcf6c('0x11a')](db[_0xcf6c('0x24')],{'foreignKey':_0xcf6c('0x159'),'targetKey':_0xcf6c('0x15a')});db[_0xcf6c('0x27')]['hasMany'](db[_0xcf6c('0x2c')],{'as':_0xcf6c('0x15b'),'foreignKey':_0xcf6c('0x15c'),'constraints':![]});db[_0xcf6c('0x27')][_0xcf6c('0x10b')](db[_0xcf6c('0x2a')],{'as':_0xcf6c('0x15d'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xcf6c('0x11a')](db['User'],{'as':_0xcf6c('0x109'),'foreignKey':_0xcf6c('0x10a')});db['VoiceCallReport']['belongsTo'](db[_0xcf6c('0x78')],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn'][_0xcf6c('0x11a')](db['MailAccount'],{'as':_0xcf6c('0x13a'),'foreignKey':'MailAccountId'});db['MailServerOut']['belongsTo'](db[_0xcf6c('0x13a')],{'as':_0xcf6c('0x13a'),'foreignKey':'MailAccountId'});db[_0xcf6c('0x13a')][_0xcf6c('0x15e')](db[_0xcf6c('0x3e')],{'as':_0xcf6c('0x15f'),'onDelete':_0xcf6c('0x10f')});db['MailAccount']['hasOne'](db['MailServerOut'],{'as':_0xcf6c('0x160'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x13a')][_0xcf6c('0x10b')](db[_0xcf6c('0x84')],{'as':_0xcf6c('0x161'),'foreignKey':_0xcf6c('0x162')});db['MailAccount'][_0xcf6c('0x10b')](db[_0xcf6c('0x163')],{'as':'Answers','foreignKey':_0xcf6c('0x162')});db['MailAccount']['hasMany'](db[_0xcf6c('0x48')],{'as':'Messages','foreignKey':_0xcf6c('0x162')});db[_0xcf6c('0x13a')][_0xcf6c('0x10b')](db[_0xcf6c('0x46')],{'as':'Interactions'});db[_0xcf6c('0x13a')][_0xcf6c('0x10b')](db[_0xcf6c('0x164')],{'as':'Applications'});db['MailAccount'][_0xcf6c('0x11a')](db['CmList'],{'as':_0xcf6c('0x165'),'foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0x13a')][_0xcf6c('0x11a')](db[_0xcf6c('0x94')],{'as':'Template','foreignKey':'TemplateId'});db[_0xcf6c('0x13a')][_0xcf6c('0x11a')](db[_0xcf6c('0x89')],{'as':_0xcf6c('0x152'),'foreignKey':_0xcf6c('0x153')});db[_0xcf6c('0x13a')]['belongsToMany'](db['User'],{'as':_0xcf6c('0x155'),'through':'user_has_mail_accounts'});db[_0xcf6c('0x42')]['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x167')});db[_0xcf6c('0x42')][_0xcf6c('0x11d')](db[_0xcf6c('0xe2')],{'through':'team_has_mail_queues','as':_0xcf6c('0x168')});db['MailInteraction'][_0xcf6c('0x10b')](db[_0xcf6c('0x48')],{'as':_0xcf6c('0x169'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x16a')});db[_0xcf6c('0x46')][_0xcf6c('0x11a')](db[_0xcf6c('0x13a')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x162')});db['MailInteraction']['belongsTo'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x46')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x16e'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x46')]['belongsToMany'](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x16f'),'as':_0xcf6c('0x170')});db[_0xcf6c('0x46')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':'mail_interaction_has_tags','as':_0xcf6c('0x171')});db[_0xcf6c('0x46')]['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x172'),'through':_0xcf6c('0x122'),'foreignKey':_0xcf6c('0x16a')});db[_0xcf6c('0x48')][_0xcf6c('0x10b')](db[_0xcf6c('0xe7')],{'as':_0xcf6c('0x173'),'onDelete':'cascade'});db[_0xcf6c('0x48')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x109')});db[_0xcf6c('0x48')]['belongsTo'](db[_0xcf6c('0x78')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x16c')});db[_0xcf6c('0x48')][_0xcf6c('0x11a')](db[_0xcf6c('0x46')],{'as':_0xcf6c('0x174'),'foreignKey':_0xcf6c('0x16a')});db[_0xcf6c('0x48')]['belongsTo'](db[_0xcf6c('0x13a')],{'as':_0xcf6c('0x16b'),'foreignKey':'MailAccountId'});db[_0xcf6c('0x48')]['belongsTo'](db[_0xcf6c('0x69')],{'as':_0xcf6c('0x69'),'foreignKey':_0xcf6c('0x175')});db['MailMessage'][_0xcf6c('0x11a')](db['ChatOfflineMessage'],{'as':_0xcf6c('0x70'),'foreignKey':_0xcf6c('0x176')});db['MailApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x164')]['belongsTo'](db[_0xcf6c('0x42')],{'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x164')][_0xcf6c('0x11a')](db[_0xcf6c('0x13a')],{'onDelete':'restrict'});db[_0xcf6c('0x164')][_0xcf6c('0x11a')](db[_0xcf6c('0x151')],{'onDelete':_0xcf6c('0x177'),'foreignKey':'IntervalId'});db[_0xcf6c('0x164')][_0xcf6c('0x11a')](db[_0xcf6c('0x92')],{'onDelete':_0xcf6c('0x177'),'foreignKey':'TagId'});db[_0xcf6c('0x4b')]['belongsTo'](db['MailAccount'],{});db['MailQueueReport'][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':'List','foreignKey':'ListId'});db[_0xcf6c('0x4b')]['belongsTo'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x4b')][_0xcf6c('0x11a')](db[_0xcf6c('0x46')],{});db[_0xcf6c('0x4b')][_0xcf6c('0x11a')](db[_0xcf6c('0x48')],{});db[_0xcf6c('0x4b')][_0xcf6c('0x11a')](db['User'],{});db[_0xcf6c('0x4b')][_0xcf6c('0x11a')](db[_0xcf6c('0x42')],{});db[_0xcf6c('0x4d')]['hasMany'](db[_0xcf6c('0x4f')],{'as':_0xcf6c('0x178'),'onDelete':_0xcf6c('0x10f')});db['FaxAccount'][_0xcf6c('0x10b')](db[_0xcf6c('0x84')],{'as':_0xcf6c('0x161'),'foreignKey':_0xcf6c('0x179')});db[_0xcf6c('0x137')][_0xcf6c('0x10b')](db[_0xcf6c('0x163')],{'as':_0xcf6c('0x17a'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xcf6c('0x10b')](db[_0xcf6c('0x54')],{'as':_0xcf6c('0x17b')});db[_0xcf6c('0x137')][_0xcf6c('0x10b')](db[_0xcf6c('0x52')],{'as':_0xcf6c('0x145')});db[_0xcf6c('0x137')]['hasMany'](db['VoiceExtension'],{'as':_0xcf6c('0x17c'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x137')][_0xcf6c('0x10b')](db[_0xcf6c('0x56')],{'as':_0xcf6c('0x169')});db[_0xcf6c('0x137')]['belongsTo'](db['Trunk'],{'as':_0xcf6c('0x14e')});db['FaxAccount']['belongsTo'](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x165'),'foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0x137')][_0xcf6c('0x11a')](db[_0xcf6c('0x89')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':'Agents','through':_0xcf6c('0x139')});db[_0xcf6c('0x52')][_0xcf6c('0x11a')](db['User'],{'onDelete':_0xcf6c('0x177')});db['FaxApplication'][_0xcf6c('0x11a')](db['FaxQueue'],{'onDelete':_0xcf6c('0x177')});db['FaxApplication'][_0xcf6c('0x11a')](db['FaxAccount'],{'onDelete':_0xcf6c('0x177')});db['FaxApplication']['belongsTo'](db[_0xcf6c('0x92')],{'onDelete':_0xcf6c('0x177'),'foreignKey':_0xcf6c('0x17d')});db[_0xcf6c('0x54')][_0xcf6c('0x10b')](db[_0xcf6c('0x56')],{'as':'Messages','onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x17e')});db['FaxInteraction'][_0xcf6c('0x11a')](db[_0xcf6c('0x137')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x179')});db['FaxInteraction'][_0xcf6c('0x11a')](db['CmContact'],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db['FaxInteraction'][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'as':'Owner','foreignKey':'UserId'});db[_0xcf6c('0x54')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x17f'),'as':'Tags'});db[_0xcf6c('0x54')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x17f'),'as':_0xcf6c('0x171')});db[_0xcf6c('0x54')]['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x172'),'through':_0xcf6c('0x124'),'foreignKey':_0xcf6c('0x17e')});db['FaxMessage'][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x109')});db[_0xcf6c('0x56')][_0xcf6c('0x11a')](db[_0xcf6c('0x54')],{'as':_0xcf6c('0x174'),'foreignKey':_0xcf6c('0x17e')});db['FaxMessage'][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x16c')});db[_0xcf6c('0x56')]['belongsTo'](db[_0xcf6c('0xe7')],{'as':_0xcf6c('0xe7'),'foreignKey':_0xcf6c('0x180')});db[_0xcf6c('0x56')][_0xcf6c('0x11a')](db[_0xcf6c('0x137')],{'as':_0xcf6c('0x16b'),'foreignKey':'FaxAccountId'});db[_0xcf6c('0x58')][_0xcf6c('0x11d')](db['User'],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x181')});db['FaxQueue'][_0xcf6c('0x11d')](db[_0xcf6c('0xe2')],{'through':_0xcf6c('0x182'),'as':_0xcf6c('0x168')});db[_0xcf6c('0x183')]['belongsTo'](db[_0xcf6c('0x137')],{});db[_0xcf6c('0x183')][_0xcf6c('0x11a')](db['CmList'],{'as':_0xcf6c('0x165'),'foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0x183')][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x183')][_0xcf6c('0x11a')](db[_0xcf6c('0x54')],{});db[_0xcf6c('0x183')][_0xcf6c('0x11a')](db[_0xcf6c('0x56')],{});db[_0xcf6c('0x183')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{});db['FaxQueueReport']['belongsTo'](db[_0xcf6c('0x58')],{});db[_0xcf6c('0x5a')][_0xcf6c('0x10b')](db[_0xcf6c('0x84')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0xcf6c('0x5a')][_0xcf6c('0x10b')](db[_0xcf6c('0x163')],{'as':_0xcf6c('0x17a'),'foreignKey':_0xcf6c('0x184')});db[_0xcf6c('0x5a')][_0xcf6c('0x10b')](db[_0xcf6c('0x185')],{'as':'Messages','foreignKey':_0xcf6c('0x184')});db[_0xcf6c('0x5a')][_0xcf6c('0x10b')](db[_0xcf6c('0x5d')],{'as':_0xcf6c('0x17b')});db[_0xcf6c('0x5a')][_0xcf6c('0x10b')](db[_0xcf6c('0x186')],{'as':_0xcf6c('0x145')});db[_0xcf6c('0x5a')][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':'List','foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0x5a')][_0xcf6c('0x11a')](db[_0xcf6c('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0xcf6c('0x153')});db['SmsAccount']['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x187')});db['SmsApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'onDelete':_0xcf6c('0x177')});db['SmsApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x12e')],{'onDelete':_0xcf6c('0x177')});db['SmsApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x5a')],{'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x186')][_0xcf6c('0x11a')](db[_0xcf6c('0x151')],{'onDelete':_0xcf6c('0x177'),'foreignKey':_0xcf6c('0x188')});db[_0xcf6c('0x186')][_0xcf6c('0x11a')](db[_0xcf6c('0x92')],{'onDelete':_0xcf6c('0x177'),'foreignKey':_0xcf6c('0x17d')});db[_0xcf6c('0x5d')]['hasMany'](db[_0xcf6c('0x185')],{'as':_0xcf6c('0x169'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x189')});db[_0xcf6c('0x5d')][_0xcf6c('0x11a')](db[_0xcf6c('0x5a')],{'as':_0xcf6c('0x16b'),'foreignKey':'SmsAccountId'});db[_0xcf6c('0x5d')]['belongsTo'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db['SmsInteraction']['belongsTo'](db[_0xcf6c('0x109')],{'as':'Owner','foreignKey':'UserId'});db[_0xcf6c('0x5d')]['belongsToMany'](db[_0xcf6c('0x92')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0xcf6c('0x5d')]['belongsToMany'](db['Tag'],{'through':_0xcf6c('0x18a'),'as':_0xcf6c('0x171')});db[_0xcf6c('0x5d')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x172'),'through':_0xcf6c('0x125'),'foreignKey':'SmsInteractionId'});db[_0xcf6c('0x185')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'as':'User'});db[_0xcf6c('0x185')][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x16c')});db[_0xcf6c('0x185')][_0xcf6c('0x11a')](db[_0xcf6c('0x5d')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x174'),'foreignKey':_0xcf6c('0x189')});db[_0xcf6c('0x185')][_0xcf6c('0x11a')](db[_0xcf6c('0x5a')],{'as':'Account','foreignKey':_0xcf6c('0x184')});db[_0xcf6c('0x12e')][_0xcf6c('0x11d')](db['User'],{'as':'Agents','through':_0xcf6c('0x3a'),'foreignKey':'SmsQueueId'});db[_0xcf6c('0x12e')][_0xcf6c('0x11d')](db[_0xcf6c('0xe2')],{'through':_0xcf6c('0x18b'),'as':_0xcf6c('0x168')});db[_0xcf6c('0x60')][_0xcf6c('0x10b')](db['Disposition'],{'as':_0xcf6c('0x161'),'foreignKey':_0xcf6c('0x18c')});db[_0xcf6c('0x60')][_0xcf6c('0x10b')](db[_0xcf6c('0x163')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0xcf6c('0x60')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xcf6c('0x17b'),'foreignKey':_0xcf6c('0x18c')});db['OpenchannelAccount']['hasMany'](db[_0xcf6c('0x65')],{'as':_0xcf6c('0x169'),'foreignKey':_0xcf6c('0x18c')});db[_0xcf6c('0x60')]['hasMany'](db[_0xcf6c('0x61')],{'as':_0xcf6c('0x145'),'foreignKey':_0xcf6c('0x18c')});db[_0xcf6c('0x60')][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':'List','foreignKey':_0xcf6c('0x166')});db['OpenchannelAccount'][_0xcf6c('0x11a')](db[_0xcf6c('0x89')],{'as':_0xcf6c('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcf6c('0x60')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x13d')});db[_0xcf6c('0x61')][_0xcf6c('0x11a')](db['User'],{'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x61')][_0xcf6c('0x11a')](db[_0xcf6c('0x67')],{'onDelete':_0xcf6c('0x177'),'foreignKey':_0xcf6c('0x18d')});db['OpenchannelApplication']['belongsTo'](db[_0xcf6c('0x60')],{'onDelete':'restrict','foreignKey':_0xcf6c('0x18c')});db['OpenchannelApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x151')],{'onDelete':_0xcf6c('0x177'),'foreignKey':'IntervalId'});db[_0xcf6c('0x61')][_0xcf6c('0x11a')](db['Tag'],{'onDelete':_0xcf6c('0x177'),'foreignKey':_0xcf6c('0x17d')});db[_0xcf6c('0x63')][_0xcf6c('0x10b')](db['OpenchannelMessage'],{'as':_0xcf6c('0x169'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x18e')});db[_0xcf6c('0x63')][_0xcf6c('0x11a')](db[_0xcf6c('0x60')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x18c')});db[_0xcf6c('0x63')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x63')]['belongsTo'](db[_0xcf6c('0x109')],{'as':'Owner','foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x63')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':'openchannel_interaction_has_tags','as':_0xcf6c('0x170')});db[_0xcf6c('0x63')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x18f'),'as':_0xcf6c('0x171')});db[_0xcf6c('0x63')]['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x172'),'through':_0xcf6c('0x127'),'foreignKey':'OpenchannelInteractionId'});db[_0xcf6c('0x65')][_0xcf6c('0x11a')](db['User'],{'onDelete':'cascade','as':_0xcf6c('0x109')});db[_0xcf6c('0x65')][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x16c')});db['OpenchannelMessage'][_0xcf6c('0x11a')](db[_0xcf6c('0x63')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x174'),'foreignKey':_0xcf6c('0x18e')});db['OpenchannelMessage'][_0xcf6c('0x11a')](db[_0xcf6c('0xe7')],{'as':_0xcf6c('0xe7'),'foreignKey':_0xcf6c('0x180')});db[_0xcf6c('0x65')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x18c')});db[_0xcf6c('0x67')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x3c'),'foreignKey':_0xcf6c('0x18d')});db[_0xcf6c('0x67')][_0xcf6c('0x11d')](db[_0xcf6c('0xe2')],{'through':_0xcf6c('0x190'),'as':_0xcf6c('0x168')});db[_0xcf6c('0x69')]['hasMany'](db['Disposition'],{'as':_0xcf6c('0x161'),'foreignKey':'ChatWebsiteId'});db[_0xcf6c('0x69')]['hasMany'](db[_0xcf6c('0x163')],{'as':_0xcf6c('0x17a'),'foreignKey':_0xcf6c('0x175')});db[_0xcf6c('0x69')][_0xcf6c('0x10b')](db[_0xcf6c('0x75')],{'as':_0xcf6c('0x191')});db[_0xcf6c('0x69')][_0xcf6c('0x10b')](db[_0xcf6c('0x112')],{'as':_0xcf6c('0x17b')});db[_0xcf6c('0x69')][_0xcf6c('0x10b')](db['ChatApplication'],{'as':_0xcf6c('0x145')});db[_0xcf6c('0x69')]['hasMany'](db['ChatMessage'],{'as':_0xcf6c('0x169')});db[_0xcf6c('0x69')][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x165'),'foreignKey':'ListId'});db[_0xcf6c('0x69')]['belongsTo'](db[_0xcf6c('0x151')],{'as':_0xcf6c('0x151'),'foreignKey':_0xcf6c('0x188')});db[_0xcf6c('0x69')][_0xcf6c('0x11a')](db['MailAccount'],{'as':_0xcf6c('0x13a'),'foreignKey':_0xcf6c('0x162')});db[_0xcf6c('0x69')]['belongsTo'](db[_0xcf6c('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0xcf6c('0x153')});db[_0xcf6c('0x69')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x136')});db[_0xcf6c('0x192')][_0xcf6c('0x11a')](db[_0xcf6c('0x60')],{});db[_0xcf6c('0x192')][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x165'),'foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0x192')][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x192')]['belongsTo'](db[_0xcf6c('0x63')],{});db[_0xcf6c('0x192')]['belongsTo'](db[_0xcf6c('0x65')],{});db[_0xcf6c('0x192')][_0xcf6c('0x11a')](db['User'],{});db[_0xcf6c('0x192')][_0xcf6c('0x11a')](db[_0xcf6c('0x67')],{});db[_0xcf6c('0x6c')][_0xcf6c('0x11a')](db['User'],{'as':_0xcf6c('0x193'),'foreignKey':_0xcf6c('0x10a'),'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x6c')][_0xcf6c('0x11a')](db[_0xcf6c('0x12b')],{'as':_0xcf6c('0x194'),'foreignKey':_0xcf6c('0x195'),'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x6c')][_0xcf6c('0x11a')](db[_0xcf6c('0x69')],{'as':_0xcf6c('0x196'),'foreignKey':_0xcf6c('0x175'),'onDelete':_0xcf6c('0x177')});db['ChatApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x92')],{'onDelete':_0xcf6c('0x177'),'foreignKey':_0xcf6c('0x17d')});db[_0xcf6c('0x112')][_0xcf6c('0x10b')](db[_0xcf6c('0x6e')],{'as':_0xcf6c('0x169'),'onDelete':_0xcf6c('0x10f'),'foreignKey':'ChatInteractionId'});db[_0xcf6c('0x112')][_0xcf6c('0x11a')](db[_0xcf6c('0x69')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x175')});db[_0xcf6c('0x112')][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x112')][_0xcf6c('0x11a')](db['User'],{'as':_0xcf6c('0x16e'),'foreignKey':'UserId'});db[_0xcf6c('0x112')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x197'),'as':_0xcf6c('0x170')});db[_0xcf6c('0x112')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x197'),'as':_0xcf6c('0x171')});db[_0xcf6c('0x112')][_0xcf6c('0x11d')](db['User'],{'as':_0xcf6c('0x172'),'through':_0xcf6c('0x123'),'foreignKey':_0xcf6c('0x198')});db['ChatMessage'][_0xcf6c('0x11a')](db['User'],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x109')});db[_0xcf6c('0x6e')][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x6e')][_0xcf6c('0x11a')](db[_0xcf6c('0x112')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x174'),'foreignKey':_0xcf6c('0x198')});db[_0xcf6c('0x6e')][_0xcf6c('0x11a')](db[_0xcf6c('0xe7')],{'as':_0xcf6c('0xe7'),'foreignKey':'AttachmentId'});db[_0xcf6c('0x6e')][_0xcf6c('0x11a')](db[_0xcf6c('0x69')],{'as':_0xcf6c('0x16b'),'foreignKey':'ChatWebsiteId'});db[_0xcf6c('0x70')][_0xcf6c('0x10b')](db[_0xcf6c('0xe7')],{'as':_0xcf6c('0x173'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xcf6c('0x10f'),'hooks':!![]});db['ChatOfflineMessage'][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x70')][_0xcf6c('0x11a')](db[_0xcf6c('0x69')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x175')});db[_0xcf6c('0x12b')]['belongsToMany'](db[_0xcf6c('0x109')],{'as':'Agents','through':_0xcf6c('0x36'),'hooks':!![]});db[_0xcf6c('0x12b')]['belongsToMany'](db['Team'],{'through':_0xcf6c('0x199'),'as':_0xcf6c('0x168')});db['ChatGroup'][_0xcf6c('0x10b')](db[_0xcf6c('0xd0')],{'as':'Messages','foreignKey':_0xcf6c('0x19a'),'onDelete':'cascade'});db[_0xcf6c('0x73')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x19b'),'through':_0xcf6c('0x19c')});db[_0xcf6c('0x75')][_0xcf6c('0x11a')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xcf6c('0x175')});db[_0xcf6c('0x77')]['hasMany'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x11e'),'foreignKey':_0xcf6c('0x19d')});db['CmContact'][_0xcf6c('0x10b')](db[_0xcf6c('0x149')],{'as':_0xcf6c('0x14a'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x78')]['hasMany'](db[_0xcf6c('0x7a')],{'as':'HopperFinals','foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x78')]['hasMany'](db[_0xcf6c('0x7c')],{'as':'HopperHistories','foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x78')]['hasMany'](db[_0xcf6c('0x7d')],{'as':_0xcf6c('0x7d'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x78')][_0xcf6c('0x10b')](db[_0xcf6c('0xd3')],{'as':_0xcf6c('0x14d'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0x78')][_0xcf6c('0x10b')](db[_0xcf6c('0x63')],{'as':_0xcf6c('0x126'),'foreignKey':_0xcf6c('0x16d'),'onDelete':'restrict'});db[_0xcf6c('0x78')]['hasMany'](db[_0xcf6c('0x112')],{'as':'ChatInteractions','foreignKey':_0xcf6c('0x16d'),'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x78')][_0xcf6c('0x10b')](db['SmsInteraction'],{'as':_0xcf6c('0x114'),'foreignKey':_0xcf6c('0x16d'),'onDelete':'restrict'});db['CmContact'][_0xcf6c('0x10b')](db['FaxInteraction'],{'as':_0xcf6c('0x115'),'foreignKey':'ContactId','onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x78')][_0xcf6c('0x10b')](db[_0xcf6c('0x46')],{'as':_0xcf6c('0x116'),'foreignKey':'ContactId','onDelete':_0xcf6c('0x177')});db[_0xcf6c('0x78')][_0xcf6c('0x11a')](db[_0xcf6c('0x77')],{'as':_0xcf6c('0x19e'),'foreignKey':_0xcf6c('0x19d')});db[_0xcf6c('0x78')][_0xcf6c('0x11a')](db['CmList'],{'as':_0xcf6c('0x165'),'foreignKey':_0xcf6c('0x166'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x78')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x172'),'through':'cm_user_has_contacts'});db[_0xcf6c('0x78')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'as':_0xcf6c('0x170'),'through':_0xcf6c('0x19f')});db[_0xcf6c('0x78')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':'cm_contact_has_tags','as':_0xcf6c('0x171')});db[_0xcf6c('0x149')]['belongsTo'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':'ContactId','onDelete':_0xcf6c('0x10f')});db['CmHopper'][_0xcf6c('0x11a')](db['CmList'],{'as':_0xcf6c('0x165'),'foreignKey':_0xcf6c('0x166'),'onDelete':_0xcf6c('0x10f')});db['CmHopper']['belongsTo'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x193'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0x149')][_0xcf6c('0x11a')](db[_0xcf6c('0x1e')],{'as':'Queue','foreignKey':_0xcf6c('0x148'),'onDelete':_0xcf6c('0x10f')});db['CmHopper'][_0xcf6c('0x11a')](db[_0xcf6c('0xe5')],{'as':_0xcf6c('0xe5'),'foreignKey':_0xcf6c('0x1a0'),'onDelete':'cascade'});db[_0xcf6c('0x149')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x16e'),'foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d'),'onDelete':_0xcf6c('0x10f')});db['CmHopperBlack']['belongsTo'](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x165'),'foreignKey':_0xcf6c('0x166'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x79')][_0xcf6c('0x11a')](db[_0xcf6c('0x1e')],{'as':_0xcf6c('0x194'),'foreignKey':_0xcf6c('0x148'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x79')]['belongsTo'](db[_0xcf6c('0xe5')],{'as':_0xcf6c('0xe5'),'foreignKey':'CampaignId','onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x1a1')][_0xcf6c('0x10b')](db['Condition'],{'as':{'plural':_0xcf6c('0x1a2'),'singular':_0xcf6c('0x1a3')},'foreignKey':_0xcf6c('0x1a4'),'onDelete':_0xcf6c('0x10f'),'hooks':!![]});db[_0xcf6c('0x1a1')][_0xcf6c('0x10b')](db['Condition'],{'as':{'plural':_0xcf6c('0x1a5'),'singular':_0xcf6c('0x1a6')},'foreignKey':_0xcf6c('0x1a7'),'onDelete':_0xcf6c('0x10f'),'hooks':!![]});db['Automation']['hasMany'](db[_0xcf6c('0x1a8')],{'as':_0xcf6c('0x1a9'),'foreignKey':_0xcf6c('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0xcf6c('0x84')][_0xcf6c('0x10b')](db[_0xcf6c('0x84')],{'as':_0xcf6c('0x161'),'foreignKey':_0xcf6c('0x1ab'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x151')]['hasMany'](db[_0xcf6c('0x151')],{'as':_0xcf6c('0x1ac'),'foreignKey':_0xcf6c('0x188'),'onDelete':_0xcf6c('0x10f'),'hooks':!![],'required':![]});db['Interval'][_0xcf6c('0x10b')](db['VoiceExtension'],{'as':_0xcf6c('0x10e'),'foreignKey':_0xcf6c('0x188'),'onDelete':'restrict'});db['Interval'][_0xcf6c('0x10b')](db[_0xcf6c('0x164')],{'as':_0xcf6c('0x1ad'),'foreignKey':_0xcf6c('0x188')});db[_0xcf6c('0x151')][_0xcf6c('0x10b')](db[_0xcf6c('0x6c')],{'as':_0xcf6c('0x1ae'),'foreignKey':'IntervalId'});db[_0xcf6c('0x151')][_0xcf6c('0x10b')](db[_0xcf6c('0x52')],{'as':_0xcf6c('0x1af'),'foreignKey':_0xcf6c('0x188')});db[_0xcf6c('0x151')][_0xcf6c('0x10b')](db[_0xcf6c('0x186')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xcf6c('0x8f')][_0xcf6c('0x11a')](db[_0xcf6c('0x13a')],{});db[_0xcf6c('0x8f')][_0xcf6c('0x11a')](db[_0xcf6c('0x1b0')],{'foreignKey':_0xcf6c('0x1b1')});db[_0xcf6c('0x8f')][_0xcf6c('0x11a')](db[_0xcf6c('0x9c')],{'foreignKey':_0xcf6c('0x1b2')});db[_0xcf6c('0x90')]['belongsToMany'](db[_0xcf6c('0x1b3')],{'as':_0xcf6c('0x1b4'),'through':_0xcf6c('0x147'),'onDelete':'restrict'});db[_0xcf6c('0x92')][_0xcf6c('0x11d')](db['CmContact'],{'through':_0xcf6c('0x19f')});db[_0xcf6c('0x92')][_0xcf6c('0x11d')](db[_0xcf6c('0x112')],{'through':_0xcf6c('0x197')});db['Tag'][_0xcf6c('0x11d')](db[_0xcf6c('0x46')],{'through':_0xcf6c('0x16f')});db[_0xcf6c('0x92')][_0xcf6c('0x11d')](db[_0xcf6c('0x5d')],{'through':'sms_interaction_has_tags'});db[_0xcf6c('0x92')]['belongsToMany'](db[_0xcf6c('0x54')],{'through':_0xcf6c('0x17f')});db[_0xcf6c('0x92')][_0xcf6c('0x11d')](db[_0xcf6c('0x63')],{'through':_0xcf6c('0x18f')});db['Tag'][_0xcf6c('0x11d')](db[_0xcf6c('0xfc')],{'through':_0xcf6c('0x1b5')});db['Trigger'][_0xcf6c('0x10b')](db[_0xcf6c('0x86')],{'as':{'plural':'AllConditions','singular':_0xcf6c('0x1b6')},'foreignKey':'TriggerAllId','onDelete':_0xcf6c('0x10f'),'hooks':!![]});db[_0xcf6c('0x96')][_0xcf6c('0x10b')](db[_0xcf6c('0x86')],{'as':{'plural':_0xcf6c('0x1b7'),'singular':_0xcf6c('0x1b8')},'foreignKey':'TriggerAnyId','onDelete':_0xcf6c('0x10f'),'hooks':!![]});db['Trigger'][_0xcf6c('0x10b')](db[_0xcf6c('0x1a8')],{'as':_0xcf6c('0x1a9'),'foreignKey':'TriggerId','onDelete':_0xcf6c('0x10f'),'hooks':!![]});db[_0xcf6c('0x9c')][_0xcf6c('0x10b')](db[_0xcf6c('0xa1')],{'as':_0xcf6c('0x1b9'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1b2'),'hooks':!![]});db[_0xcf6c('0x1b0')][_0xcf6c('0x10b')](db[_0xcf6c('0xa1')],{'as':_0xcf6c('0x1b9'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1b1')});db[_0xcf6c('0x1ba')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xcf6c('0x1b9'),'onDelete':'cascade','foreignKey':_0xcf6c('0x1bb')});db['AnalyticFieldReport'][_0xcf6c('0x11a')](db[_0xcf6c('0x1ba')],{'foreignKey':_0xcf6c('0x1bb')});db['SalesforceAccount'][_0xcf6c('0x10b')](db[_0xcf6c('0xa5')],{'as':_0xcf6c('0x1bc'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xa5')]['hasMany'](db[_0xcf6c('0xa7')],{'as':'Subjects','onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0xa5')]['hasMany'](db[_0xcf6c('0xa7')],{'as':'Descriptions','onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0xa5')][_0xcf6c('0x10b')](db['SalesforceField'],{'as':_0xcf6c('0x1b9'),'onDelete':'cascade','foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xa5')][_0xcf6c('0x11a')](db[_0xcf6c('0x1c1')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xa7')][_0xcf6c('0x10b')](db[_0xcf6c('0xa7')],{'as':_0xcf6c('0x1c2'),'foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0xa7')][_0xcf6c('0x10b')](db[_0xcf6c('0xa7')],{'as':_0xcf6c('0x1c3'),'foreignKey':'DescriptionId'});db[_0xcf6c('0xa7')][_0xcf6c('0x10b')](db['SalesforceField'],{'as':_0xcf6c('0x1c4'),'foreignKey':_0xcf6c('0x1c0')});db['SalesforceField'][_0xcf6c('0x11a')](db[_0xcf6c('0x98')],{'as':_0xcf6c('0x98'),'foreignKey':'VariableId'});db[_0xcf6c('0x1c5')][_0xcf6c('0x10b')](db[_0xcf6c('0xa9')],{'as':_0xcf6c('0x1bc'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xa9')][_0xcf6c('0x10b')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1be')});db['SugarcrmConfiguration'][_0xcf6c('0x10b')](db['SugarcrmField'],{'as':_0xcf6c('0x1c6'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bf')});db['SugarcrmConfiguration'][_0xcf6c('0x10b')](db[_0xcf6c('0x1c7')],{'as':'Fields','onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xa9')][_0xcf6c('0x11a')](db['SugarcrmAccount'],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1bd')});db['SugarcrmField'][_0xcf6c('0x10b')](db[_0xcf6c('0x1c7')],{'as':'Subject','foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0x1c7')][_0xcf6c('0x10b')](db[_0xcf6c('0x1c7')],{'as':'Description','foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0x1c7')][_0xcf6c('0x10b')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0xcf6c('0x1c7')][_0xcf6c('0x11a')](db[_0xcf6c('0x98')],{'as':_0xcf6c('0x98'),'foreignKey':_0xcf6c('0x1c8')});db['DeskAccount'][_0xcf6c('0x10b')](db[_0xcf6c('0x1c9')],{'as':_0xcf6c('0x1bc'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0x1c9')][_0xcf6c('0x10b')](db[_0xcf6c('0xad')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0x1c9')][_0xcf6c('0x10b')](db[_0xcf6c('0xad')],{'as':_0xcf6c('0x1c6'),'onDelete':_0xcf6c('0x10f'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db[_0xcf6c('0xad')],{'as':_0xcf6c('0x1b9'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0x1c9')][_0xcf6c('0x11a')](db[_0xcf6c('0xab')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1bd')});db['DeskConfiguration'][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x1ca')});db[_0xcf6c('0xad')][_0xcf6c('0x10b')](db['DeskField'],{'as':_0xcf6c('0x1c2'),'foreignKey':'SubjectId'});db[_0xcf6c('0xad')][_0xcf6c('0x10b')](db[_0xcf6c('0xad')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField'][_0xcf6c('0x10b')](db[_0xcf6c('0xad')],{'as':_0xcf6c('0x1c4'),'foreignKey':'FieldId'});db[_0xcf6c('0xad')][_0xcf6c('0x11a')](db[_0xcf6c('0x98')],{'as':_0xcf6c('0x98'),'foreignKey':_0xcf6c('0x1c8')});db[_0xcf6c('0x1cb')][_0xcf6c('0x10b')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xcf6c('0x1cc')][_0xcf6c('0x10b')](db['ZohoField'],{'as':_0xcf6c('0x1cd'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1be')});db['ZohoConfiguration'][_0xcf6c('0x10b')](db['ZohoField'],{'as':_0xcf6c('0x1c6'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0x1cc')]['hasMany'](db['ZohoField'],{'as':_0xcf6c('0x1b9'),'onDelete':_0xcf6c('0x10f'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xcf6c('0x11a')](db[_0xcf6c('0x1cb')],{'as':'Account','foreignKey':_0xcf6c('0x1bd')});db['ZohoField'][_0xcf6c('0x10b')](db['ZohoField'],{'as':_0xcf6c('0x1c2'),'foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0x1ce')][_0xcf6c('0x10b')](db[_0xcf6c('0x1ce')],{'as':_0xcf6c('0x1c3'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0x1ce')][_0xcf6c('0x10b')](db[_0xcf6c('0x1ce')],{'as':_0xcf6c('0x1c4'),'foreignKey':'FieldId'});db[_0xcf6c('0x1ce')][_0xcf6c('0x11a')](db['Variable'],{'as':_0xcf6c('0x98'),'foreignKey':_0xcf6c('0x1c8')});db[_0xcf6c('0xb1')][_0xcf6c('0x10b')](db['ZendeskConfiguration'],{'as':_0xcf6c('0x1bc'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xb3')][_0xcf6c('0x10b')](db[_0xcf6c('0xb4')],{'as':_0xcf6c('0x1cd'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xcf6c('0x10b')](db[_0xcf6c('0xb4')],{'as':_0xcf6c('0x1c6'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0xb3')][_0xcf6c('0x10b')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xb3')][_0xcf6c('0x11a')](db['ZendeskAccount'],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xb3')][_0xcf6c('0x11d')](db['Tag'],{'through':_0xcf6c('0x1cf')});db[_0xcf6c('0xb4')]['hasMany'](db[_0xcf6c('0xb4')],{'as':_0xcf6c('0x1c2'),'foreignKey':_0xcf6c('0x1be')});db['ZendeskField'][_0xcf6c('0x10b')](db[_0xcf6c('0xb4')],{'as':_0xcf6c('0x1c3'),'foreignKey':'DescriptionId'});db[_0xcf6c('0xb4')][_0xcf6c('0x10b')](db[_0xcf6c('0xb4')],{'as':'Field','foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xb4')][_0xcf6c('0x11a')](db['Variable'],{'as':'Variable','foreignKey':_0xcf6c('0x1c8')});db[_0xcf6c('0xb6')][_0xcf6c('0x10b')](db[_0xcf6c('0xb8')],{'as':_0xcf6c('0x1bc'),'onDelete':'cascade','foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xb8')][_0xcf6c('0x10b')](db[_0xcf6c('0xba')],{'as':'Subjects','onDelete':_0xcf6c('0x10f'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xcf6c('0x10b')](db['FreshdeskField'],{'as':_0xcf6c('0x1c6'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0xb8')][_0xcf6c('0x10b')](db[_0xcf6c('0xba')],{'as':_0xcf6c('0x1b9'),'onDelete':'cascade','foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xb8')][_0xcf6c('0x11a')](db[_0xcf6c('0xb6')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xb8')]['belongsToMany'](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x1d0')});db[_0xcf6c('0xba')]['hasMany'](db['FreshdeskField'],{'as':_0xcf6c('0x1c2'),'foreignKey':'SubjectId'});db[_0xcf6c('0xba')]['hasMany'](db[_0xcf6c('0xba')],{'as':'Description','foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0xba')][_0xcf6c('0x10b')](db[_0xcf6c('0xba')],{'as':_0xcf6c('0x1c4'),'foreignKey':'FieldId'});db[_0xcf6c('0xba')]['belongsTo'](db[_0xcf6c('0x98')],{'as':_0xcf6c('0x98'),'foreignKey':_0xcf6c('0x1c8')});db[_0xcf6c('0x1d1')][_0xcf6c('0x10b')](db[_0xcf6c('0xbd')],{'as':_0xcf6c('0x1bc'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xbd')][_0xcf6c('0x10b')](db[_0xcf6c('0xbf')],{'as':_0xcf6c('0x1cd'),'foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0xbd')]['hasMany'](db[_0xcf6c('0xbf')],{'as':'Descriptions','foreignKey':_0xcf6c('0x1bf')});db['VtigerConfiguration'][_0xcf6c('0x10b')](db[_0xcf6c('0xbf')],{'as':_0xcf6c('0x1b9'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xbd')][_0xcf6c('0x11a')](db[_0xcf6c('0x1d1')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1bd')});db['VtigerField'][_0xcf6c('0x10b')](db[_0xcf6c('0xbf')],{'as':_0xcf6c('0x1c2'),'foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0xbf')]['hasMany'](db[_0xcf6c('0xbf')],{'as':'Description','foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0xbf')]['hasMany'](db[_0xcf6c('0xbf')],{'as':_0xcf6c('0x1c4'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xbf')][_0xcf6c('0x11a')](db[_0xcf6c('0x98')],{'as':_0xcf6c('0x98'),'foreignKey':'VariableId'});db[_0xcf6c('0xc1')][_0xcf6c('0x10b')](db[_0xcf6c('0x1d2')],{'as':_0xcf6c('0x1bc'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0x1d2')][_0xcf6c('0x10b')](db[_0xcf6c('0x1d3')],{'as':_0xcf6c('0x1cd'),'foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0x1d2')][_0xcf6c('0x10b')](db['ServicenowField'],{'as':_0xcf6c('0x1c6'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0x1d2')][_0xcf6c('0x10b')](db[_0xcf6c('0x1d3')],{'as':_0xcf6c('0x1b9'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0x1d2')][_0xcf6c('0x11a')](db[_0xcf6c('0xc1')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0x1d3')][_0xcf6c('0x10b')](db[_0xcf6c('0x1d3')],{'as':'Subject','foreignKey':_0xcf6c('0x1be')});db['ServicenowField'][_0xcf6c('0x10b')](db[_0xcf6c('0x1d3')],{'as':_0xcf6c('0x1c3'),'foreignKey':'DescriptionId'});db[_0xcf6c('0x1d3')][_0xcf6c('0x10b')](db['ServicenowField'],{'as':'Field','foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0x1d3')]['belongsTo'](db[_0xcf6c('0x98')],{'as':_0xcf6c('0x98'),'foreignKey':'VariableId'});db[_0xcf6c('0xc3')][_0xcf6c('0x10b')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcf6c('0x1bd')});db['Dynamics365Configuration'][_0xcf6c('0x10b')](db[_0xcf6c('0xc6')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0xcf6c('0xc4')][_0xcf6c('0x10b')](db['Dynamics365Field'],{'as':_0xcf6c('0x1c6'),'onDelete':'cascade','foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0xc4')]['hasMany'](db[_0xcf6c('0xc6')],{'as':_0xcf6c('0x1b9'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xc4')]['belongsTo'](db[_0xcf6c('0xc3')],{'as':_0xcf6c('0x16b'),'foreignKey':'AccountId'});db[_0xcf6c('0xc6')][_0xcf6c('0x10b')](db[_0xcf6c('0xc6')],{'as':'Subject','foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0xc6')][_0xcf6c('0x10b')](db['Dynamics365Field'],{'as':_0xcf6c('0x1c3'),'foreignKey':'DescriptionId'});db[_0xcf6c('0xc6')][_0xcf6c('0x10b')](db['Dynamics365Field'],{'as':_0xcf6c('0x1c4'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xc6')][_0xcf6c('0x11a')](db[_0xcf6c('0x98')],{'as':_0xcf6c('0x98'),'foreignKey':_0xcf6c('0x1c8')});db[_0xcf6c('0xc8')][_0xcf6c('0x10b')](db[_0xcf6c('0x1d4')],{'as':'Configurations','onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0x1d4')][_0xcf6c('0x10b')](db[_0xcf6c('0xca')],{'as':_0xcf6c('0x1cd'),'foreignKey':'SubjectId'});db[_0xcf6c('0x1d4')][_0xcf6c('0x10b')](db['FreshsalesField'],{'as':_0xcf6c('0x1c6'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0x1d4')][_0xcf6c('0x10b')](db['FreshsalesField'],{'as':_0xcf6c('0x1b9'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0x1d4')]['belongsTo'](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0xcf6c('0x1bd')});db[_0xcf6c('0xca')][_0xcf6c('0x10b')](db[_0xcf6c('0xca')],{'as':'Subject','foreignKey':_0xcf6c('0x1be')});db[_0xcf6c('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0xcf6c('0x1c3'),'foreignKey':_0xcf6c('0x1bf')});db[_0xcf6c('0xca')][_0xcf6c('0x10b')](db[_0xcf6c('0xca')],{'as':_0xcf6c('0x1c4'),'foreignKey':_0xcf6c('0x1c0')});db[_0xcf6c('0xca')][_0xcf6c('0x11a')](db['Variable'],{'as':_0xcf6c('0x98'),'foreignKey':_0xcf6c('0x1c8')});db[_0xcf6c('0xcf')]['belongsTo'](db['ChatWebsite'],{});db[_0xcf6c('0xcf')]['belongsTo'](db[_0xcf6c('0xf2')],{'as':'List','foreignKey':_0xcf6c('0x166')});db['ChatQueueReport'][_0xcf6c('0x11a')](db['CmContact'],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0xcf')][_0xcf6c('0x11a')](db[_0xcf6c('0x112')],{});db['ChatQueueReport']['belongsTo'](db[_0xcf6c('0x6e')],{});db['ChatQueueReport']['belongsTo'](db[_0xcf6c('0x109')],{});db[_0xcf6c('0xcf')][_0xcf6c('0x11a')](db['ChatQueue'],{});db[_0xcf6c('0xd0')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1d5')});db[_0xcf6c('0xd0')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x1d6')});db[_0xcf6c('0xd3')][_0xcf6c('0x10b')](db[_0xcf6c('0x1d7')],{'foreignKey':_0xcf6c('0x1d8'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0xd3')][_0xcf6c('0x10b')](db[_0xcf6c('0x1d9')],{'foreignKey':_0xcf6c('0x1d8'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0xd5')]['belongsTo'](db[_0xcf6c('0x5a')],{});db['SmsQueueReport'][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x165'),'foreignKey':'ListId'});db[_0xcf6c('0xd5')][_0xcf6c('0x11a')](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0xd5')][_0xcf6c('0x11a')](db[_0xcf6c('0x5d')],{});db[_0xcf6c('0xd5')][_0xcf6c('0x11a')](db['SmsMessage'],{});db[_0xcf6c('0xd5')][_0xcf6c('0x11a')](db['User'],{});db[_0xcf6c('0xd5')][_0xcf6c('0x11a')](db[_0xcf6c('0x12e')],{});db['JscriptyProject'][_0xcf6c('0x10b')](db[_0xcf6c('0xd3')],{'foreignKey':'ProjectId'});db[_0xcf6c('0xda')]['hasMany'](db[_0xcf6c('0x1d7')],{'foreignKey':_0xcf6c('0x1da')});db[_0xcf6c('0xda')][_0xcf6c('0x10b')](db['JscriptyAnswerReport'],{'foreignKey':_0xcf6c('0x1da')});db[_0xcf6c('0xe0')]['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x172'),'through':_0xcf6c('0x143')});db['Team']['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x121')});db[_0xcf6c('0xe2')][_0xcf6c('0x11d')](db[_0xcf6c('0x1e')],{'through':_0xcf6c('0x107'),'as':_0xcf6c('0x129')});db[_0xcf6c('0xe2')][_0xcf6c('0x11d')](db[_0xcf6c('0x42')],{'through':_0xcf6c('0x1db'),'as':'MailQueues'});db[_0xcf6c('0xe2')][_0xcf6c('0x11d')](db[_0xcf6c('0x12b')],{'through':_0xcf6c('0x199'),'as':_0xcf6c('0x12c')});db[_0xcf6c('0xe2')][_0xcf6c('0x11d')](db[_0xcf6c('0x58')],{'through':_0xcf6c('0x182'),'as':_0xcf6c('0x12d')});db['Team'][_0xcf6c('0x11d')](db[_0xcf6c('0x12e')],{'through':_0xcf6c('0x18b'),'as':_0xcf6c('0x1dc')});db[_0xcf6c('0xe2')][_0xcf6c('0x11d')](db['OpenchannelQueue'],{'through':_0xcf6c('0x190'),'as':_0xcf6c('0x12f')});db[_0xcf6c('0xe2')][_0xcf6c('0x11d')](db['WhatsappQueue'],{'through':_0xcf6c('0x1dd'),'as':_0xcf6c('0x130')});db[_0xcf6c('0xe5')][_0xcf6c('0x10b')](db[_0xcf6c('0x149')],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0xcf6c('0x10b')](db[_0xcf6c('0x7a')],{'as':_0xcf6c('0x110'),'foreignKey':_0xcf6c('0x1a0')});db[_0xcf6c('0xe5')]['hasMany'](db[_0xcf6c('0x7c')],{'as':'HopperHistories','foreignKey':_0xcf6c('0x1a0')});db[_0xcf6c('0xe5')]['hasMany'](db[_0xcf6c('0x79')],{'as':_0xcf6c('0x14c'),'foreignKey':_0xcf6c('0x1a0')});db[_0xcf6c('0xe5')][_0xcf6c('0x11a')](db[_0xcf6c('0x14e')],{'as':'Trunk','foreignKey':_0xcf6c('0x14f')});db[_0xcf6c('0xe5')][_0xcf6c('0x11a')](db[_0xcf6c('0x14e')],{'as':_0xcf6c('0x150'),'foreignKey':_0xcf6c('0x1de')});db[_0xcf6c('0xe5')][_0xcf6c('0x11a')](db['Interval'],{'as':'Interval','foreignKey':_0xcf6c('0x188')});db[_0xcf6c('0xe5')][_0xcf6c('0x11a')](db[_0xcf6c('0xe0')],{'as':_0xcf6c('0xe0'),'foreignKey':_0xcf6c('0x1df')});db[_0xcf6c('0xe5')][_0xcf6c('0x11d')](db['CmList'],{'as':_0xcf6c('0x120'),'through':_0xcf6c('0x1e0')});db[_0xcf6c('0xe5')][_0xcf6c('0x11d')](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x156'),'through':_0xcf6c('0x1e1')});db[_0xcf6c('0xe7')][_0xcf6c('0x11a')](db['ChatOfflineMessage'],{'as':_0xcf6c('0x70'),'foreignKey':_0xcf6c('0x176')});db[_0xcf6c('0x1e2')][_0xcf6c('0x11a')](db[_0xcf6c('0x48')],{});db[_0xcf6c('0x1e2')]['belongsTo'](db['MailInteraction'],{});db[_0xcf6c('0x1e2')]['belongsTo'](db[_0xcf6c('0x13a')],{'foreignKey':_0xcf6c('0x1e3'),'as':_0xcf6c('0x1e4')});db['MailTransferReport']['belongsTo'](db[_0xcf6c('0x109')],{'foreignKey':'FromUserId','as':_0xcf6c('0x1e5')});db[_0xcf6c('0x1e2')][_0xcf6c('0x11a')](db['User'],{'foreignKey':_0xcf6c('0x1e6'),'as':_0xcf6c('0x1e7')});db['MailTransferReport'][_0xcf6c('0x11a')](db[_0xcf6c('0x42')],{'foreignKey':_0xcf6c('0x1e8'),'as':_0xcf6c('0x1e9')});db[_0xcf6c('0x1e2')][_0xcf6c('0x11a')](db[_0xcf6c('0x13a')],{'foreignKey':_0xcf6c('0x1ea'),'as':_0xcf6c('0x1eb')});db[_0xcf6c('0xec')][_0xcf6c('0x11a')](db[_0xcf6c('0x6e')],{});db['ChatTransferReport'][_0xcf6c('0x11a')](db['ChatInteraction'],{});db[_0xcf6c('0xec')][_0xcf6c('0x11a')](db['ChatWebsite'],{'foreignKey':_0xcf6c('0x1ec'),'as':_0xcf6c('0x1e4')});db['ChatTransferReport'][_0xcf6c('0x11a')](db['User'],{'foreignKey':_0xcf6c('0x1ed'),'as':_0xcf6c('0x1e5')});db[_0xcf6c('0xec')][_0xcf6c('0x11a')](db['User'],{'foreignKey':_0xcf6c('0x1e6'),'as':_0xcf6c('0x1e7')});db[_0xcf6c('0xec')]['belongsTo'](db[_0xcf6c('0x12b')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0xcf6c('0x11a')](db[_0xcf6c('0x69')],{'foreignKey':'ToChatWebsiteId','as':_0xcf6c('0x1eb')});db[_0xcf6c('0x1ee')][_0xcf6c('0x11a')](db[_0xcf6c('0x56')],{});db[_0xcf6c('0x1ee')][_0xcf6c('0x11a')](db[_0xcf6c('0x54')],{});db[_0xcf6c('0x1ee')][_0xcf6c('0x11a')](db[_0xcf6c('0x137')],{'foreignKey':_0xcf6c('0x1ef'),'as':_0xcf6c('0x1e4')});db['FaxTransferReport'][_0xcf6c('0x11a')](db['User'],{'foreignKey':'FromUserId','as':_0xcf6c('0x1e5')});db[_0xcf6c('0x1ee')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'foreignKey':_0xcf6c('0x1e6'),'as':_0xcf6c('0x1e7')});db[_0xcf6c('0x1ee')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xcf6c('0x1f0'),'as':_0xcf6c('0x1e9')});db[_0xcf6c('0x1ee')][_0xcf6c('0x11a')](db[_0xcf6c('0x137')],{'foreignKey':_0xcf6c('0x1f1'),'as':'ToAccount'});db[_0xcf6c('0x1f2')][_0xcf6c('0x11a')](db['OpenchannelMessage'],{});db[_0xcf6c('0x1f2')][_0xcf6c('0x11a')](db['OpenchannelInteraction'],{});db[_0xcf6c('0x1f2')]['belongsTo'](db[_0xcf6c('0x60')],{'foreignKey':'FromOpenchannelAccountId','as':_0xcf6c('0x1e4')});db[_0xcf6c('0x1f2')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'foreignKey':_0xcf6c('0x1ed'),'as':'FromAgent'});db[_0xcf6c('0x1f2')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'foreignKey':'ToUserId','as':_0xcf6c('0x1e7')});db['OpenchannelTransferReport'][_0xcf6c('0x11a')](db['OpenchannelQueue'],{'foreignKey':_0xcf6c('0x1f3'),'as':_0xcf6c('0x1e9')});db[_0xcf6c('0x1f2')]['belongsTo'](db[_0xcf6c('0x60')],{'foreignKey':_0xcf6c('0x1f4'),'as':'ToAccount'});db[_0xcf6c('0xf0')][_0xcf6c('0x11a')](db[_0xcf6c('0x185')],{});db['SmsTransferReport'][_0xcf6c('0x11a')](db['SmsInteraction'],{});db[_0xcf6c('0xf0')]['belongsTo'](db[_0xcf6c('0x5a')],{'foreignKey':'FromSmsAccountId','as':_0xcf6c('0x1e4')});db[_0xcf6c('0xf0')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'foreignKey':_0xcf6c('0x1ed'),'as':_0xcf6c('0x1e5')});db[_0xcf6c('0xf0')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'foreignKey':'ToUserId','as':_0xcf6c('0x1e7')});db[_0xcf6c('0xf0')][_0xcf6c('0x11a')](db[_0xcf6c('0x12e')],{'foreignKey':_0xcf6c('0x1f5'),'as':_0xcf6c('0x1e9')});db['SmsTransferReport'][_0xcf6c('0x11a')](db['SmsAccount'],{'foreignKey':_0xcf6c('0x1f6'),'as':'ToAccount'});db['CmList'][_0xcf6c('0x10b')](db[_0xcf6c('0x84')],{'as':_0xcf6c('0x161'),'foreignKey':'ListId'});db['CmList'][_0xcf6c('0x10b')](db[_0xcf6c('0x7f')],{'as':_0xcf6c('0x1f7'),'foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0xf2')][_0xcf6c('0x10b')](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x11e'),'onDelete':_0xcf6c('0x10f'),'foreignKey':_0xcf6c('0x166')});db['CmList'][_0xcf6c('0x10b')](db[_0xcf6c('0x7a')],{'as':_0xcf6c('0x110'),'foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0xf2')][_0xcf6c('0x10b')](db[_0xcf6c('0x7c')],{'as':'HopperHistory','foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0xf2')][_0xcf6c('0x10b')](db[_0xcf6c('0x7d')],{'as':_0xcf6c('0x7d'),'foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0xf2')]['belongsToMany'](db[_0xcf6c('0x1e')],{'as':_0xcf6c('0x1f8'),'through':_0xcf6c('0x154')});db['CmList']['belongsToMany'](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':'cm_user_has_lists'});db[_0xcf6c('0xf4')][_0xcf6c('0x10b')](db[_0xcf6c('0x1b')],{'as':'Extensions','onDelete':'cascade'});db[_0xcf6c('0xf4')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':'Agents','through':_0xcf6c('0x134')});db['UserProfile']['hasMany'](db['User'],{'as':'Users','foreignKey':_0xcf6c('0x11c')});db[_0xcf6c('0x11b')]['hasMany'](db[_0xcf6c('0xf6')],{'as':_0xcf6c('0x1f9'),'foreignKey':_0xcf6c('0x11c'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0xf6')][_0xcf6c('0x10b')](db[_0xcf6c('0x1fa')],{'as':_0xcf6c('0x1fb'),'foreignKey':_0xcf6c('0x1fc'),'onDelete':_0xcf6c('0x10f')});db[_0xcf6c('0x13f')][_0xcf6c('0x10b')](db[_0xcf6c('0x84')],{'as':_0xcf6c('0x161'),'foreignKey':_0xcf6c('0x1fd')});db['WhatsappAccount']['hasMany'](db[_0xcf6c('0x163')],{'as':_0xcf6c('0x17a'),'foreignKey':_0xcf6c('0x1fd')});db[_0xcf6c('0x13f')][_0xcf6c('0x10b')](db[_0xcf6c('0x1fe')],{'as':_0xcf6c('0x169'),'foreignKey':_0xcf6c('0x1fd')});db['WhatsappAccount'][_0xcf6c('0x10b')](db[_0xcf6c('0xfc')],{'as':_0xcf6c('0x17b')});db[_0xcf6c('0x13f')][_0xcf6c('0x10b')](db[_0xcf6c('0xfa')],{'as':_0xcf6c('0x145')});db[_0xcf6c('0x13f')][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':'List','foreignKey':_0xcf6c('0x166')});db[_0xcf6c('0x13f')][_0xcf6c('0x11a')](db[_0xcf6c('0x89')],{'as':_0xcf6c('0x152'),'foreignKey':_0xcf6c('0x153')});db[_0xcf6c('0x13f')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x141')});db['WhatsappApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0xfa')]['belongsTo'](db[_0xcf6c('0x103')],{'onDelete':_0xcf6c('0x177')});db[_0xcf6c('0xfa')]['belongsTo'](db[_0xcf6c('0x13f')],{'onDelete':_0xcf6c('0x177')});db['WhatsappApplication'][_0xcf6c('0x11a')](db[_0xcf6c('0x151')],{'onDelete':'restrict','foreignKey':_0xcf6c('0x188')});db[_0xcf6c('0xfa')][_0xcf6c('0x11a')](db[_0xcf6c('0x92')],{'onDelete':_0xcf6c('0x177'),'foreignKey':_0xcf6c('0x17d')});db[_0xcf6c('0xfc')][_0xcf6c('0x10b')](db['WhatsappMessage'],{'as':_0xcf6c('0x169'),'onDelete':'cascade','foreignKey':_0xcf6c('0x1ff')});db[_0xcf6c('0xfc')][_0xcf6c('0x11a')](db[_0xcf6c('0x13f')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1fd')});db['WhatsappInteraction'][_0xcf6c('0x11a')](db['CmContact'],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0xfc')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x16e'),'foreignKey':_0xcf6c('0x10a')});db[_0xcf6c('0xfc')][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x1b5'),'as':_0xcf6c('0x170')});db['WhatsappInteraction'][_0xcf6c('0x11d')](db[_0xcf6c('0x92')],{'through':_0xcf6c('0x1b5'),'as':_0xcf6c('0x171')});db[_0xcf6c('0xfc')][_0xcf6c('0x11d')](db[_0xcf6c('0x109')],{'as':_0xcf6c('0x172'),'through':_0xcf6c('0x128'),'foreignKey':'WhatsappInteractionId'});db[_0xcf6c('0x1fe')][_0xcf6c('0x11a')](db['User'],{'as':_0xcf6c('0x109')});db[_0xcf6c('0x1fe')][_0xcf6c('0x11a')](db['CmContact'],{'onDelete':_0xcf6c('0x10f'),'as':'Contact'});db[_0xcf6c('0x1fe')][_0xcf6c('0x11a')](db[_0xcf6c('0xfc')],{'onDelete':_0xcf6c('0x10f'),'as':_0xcf6c('0x174'),'foreignKey':_0xcf6c('0x1ff')});db['WhatsappMessage'][_0xcf6c('0x11a')](db[_0xcf6c('0x13f')],{'as':_0xcf6c('0x16b'),'foreignKey':_0xcf6c('0x1fd')});db[_0xcf6c('0xff')][_0xcf6c('0x11a')](db[_0xcf6c('0x13f')],{});db[_0xcf6c('0xff')][_0xcf6c('0x11a')](db[_0xcf6c('0xf2')],{'as':_0xcf6c('0x165'),'foreignKey':'ListId'});db[_0xcf6c('0xff')]['belongsTo'](db[_0xcf6c('0x78')],{'as':_0xcf6c('0x16c'),'foreignKey':_0xcf6c('0x16d')});db[_0xcf6c('0xff')][_0xcf6c('0x11a')](db[_0xcf6c('0xfc')],{});db[_0xcf6c('0xff')]['belongsTo'](db[_0xcf6c('0x103')],{});db[_0xcf6c('0xff')][_0xcf6c('0x11a')](db['WhatsappMessage'],{});db[_0xcf6c('0xff')]['belongsTo'](db['User'],{});db[_0xcf6c('0x101')][_0xcf6c('0x11a')](db[_0xcf6c('0x1fe')],{});db[_0xcf6c('0x101')]['belongsTo'](db[_0xcf6c('0xfc')],{});db[_0xcf6c('0x101')][_0xcf6c('0x11a')](db[_0xcf6c('0x13f')],{'foreignKey':_0xcf6c('0x200'),'as':_0xcf6c('0x1e4')});db['WhatsappTransferReport']['belongsTo'](db[_0xcf6c('0x13f')],{'foreignKey':'ToWhatsappAccountId','as':_0xcf6c('0x1eb')});db[_0xcf6c('0x101')][_0xcf6c('0x11a')](db['WhatsappQueue'],{'foreignKey':_0xcf6c('0x201'),'as':_0xcf6c('0x1e9')});db[_0xcf6c('0x101')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'foreignKey':'FromUserId','as':_0xcf6c('0x1e5')});db[_0xcf6c('0x101')][_0xcf6c('0x11a')](db[_0xcf6c('0x109')],{'foreignKey':_0xcf6c('0x1e6'),'as':_0xcf6c('0x1e7')});db[_0xcf6c('0x103')][_0xcf6c('0x11d')](db['User'],{'as':_0xcf6c('0x155'),'through':_0xcf6c('0x131'),'foreignKey':_0xcf6c('0x202')});db[_0xcf6c('0x103')][_0xcf6c('0x11d')](db[_0xcf6c('0xe2')],{'through':'team_has_whatsapp_queues','as':_0xcf6c('0x168')});module[_0xcf6c('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index a4029e1..9adc83f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa414=['/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','get','appPath','/index.html','username','password','firstName','lastName','street','phone','fax','clientId','clientSecret','securityToken','code','accessKey','token','channelSecret','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','exten','vidaooApiKey','privateKey','pass','accountSid','localstationid','dsn','registry','oldPassword','isPlainObject','isArray','isString','replace','@@{','}@@','includes','lodash','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','x-forwarded-for','headers','connection','url','statusCode','responseTime','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','remoteAddress','device','other','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xa414,0x17e));var _0x4a41=function(_0x571d9a,_0x4b7f19){_0x571d9a=_0x571d9a-0x0;var _0x757a3f=_0xa414[_0x571d9a];return _0x757a3f;};'use strict';var _=require(_0x4a41('0x0'));var path=require('path');var express=require('express');var ewinston=require(_0x4a41('0x1'));var util=require(_0x4a41('0x2'));var errors=require(_0x4a41('0x3'));var config=require('./config/environment');var logger=require(_0x4a41('0x4'))(_0x4a41('0x5'));var authLogger=require(_0x4a41('0x4'))(_0x4a41('0x6'));exports[_0x4a41('0x7')]=function(_0x3a8058){_0x3a8058[_0x4a41('0x8')](ewinston[_0x4a41('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3373d8,_0x25b93b){var _0x336028=_0x4a41('0xa');if(!_[_0x4a41('0xb')](_0x3373d8[_0x4a41('0xc')])){_0x336028+=_0x4a41('0xd');var _0x3c86c8=_0x3373d8[_0x4a41('0xc')];maskSensitiveData(_0x3c86c8);}return util['format'](_0x336028,_0x3373d8['method'],_0x3373d8['headers'][_0x4a41('0xe')]?_0x3373d8[_0x4a41('0xf')][_0x4a41('0xe')]:_0x3373d8[_0x4a41('0x10')]['remoteAddress']||_0x3373d8['ip'],_0x3373d8[_0x4a41('0x11')],_0x25b93b[_0x4a41('0x12')],_0x25b93b[_0x4a41('0x13')],_0x3373d8[_0x4a41('0x14')]?_0x3373d8[_0x4a41('0x14')]['id']:null,_0x3373d8[_0x4a41('0x14')]?_0x3373d8[_0x4a41('0x14')]['name']:null,_0x3373d8[_0x4a41('0x14')]?_0x3373d8[_0x4a41('0x14')]['role']:null,_0x3c86c8?util[_0x4a41('0x15')](_0x3c86c8,![],null):'');}}));_0x3a8058['use'](ewinston[_0x4a41('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3373b4,_0x4431ec){var _0x24c301=_0x4a41('0x16');if(_0x3373b4[_0x4a41('0xc')]&&_0x3373b4[_0x4a41('0xc')]['device']&&_0x3373b4[_0x4a41('0xc')][_0x4a41('0x17')]){_0x24c301=_0x4a41('0x18');}return util['format'](_0x24c301,_0x3373b4[_0x4a41('0x19')],_0x3373b4[_0x4a41('0xf')][_0x4a41('0xe')]?_0x3373b4[_0x4a41('0xf')][_0x4a41('0xe')]:_0x3373b4[_0x4a41('0x10')][_0x4a41('0x1a')]||_0x3373b4['ip'],_0x3373b4['url'],_0x4431ec[_0x4a41('0x12')],_0x4431ec[_0x4a41('0x13')],_0x3373b4[_0x4a41('0x14')]?_0x3373b4['user']['id']:null,_0x3373b4['user']?_0x3373b4[_0x4a41('0x14')]['name']:null,_0x3373b4[_0x4a41('0x14')]?_0x3373b4[_0x4a41('0x14')]['role']:null,_0x3373b4['body']&&_0x3373b4[_0x4a41('0xc')][_0x4a41('0x1b')]?_0x3373b4[_0x4a41('0xc')]['device']:_0x4a41('0x1c'),_0x3373b4[_0x4a41('0xc')]&&_0x3373b4[_0x4a41('0xc')]['agent_id']?_0x3373b4[_0x4a41('0xc')]['agent_id']:'',_0x3373b4[_0x4a41('0xc')]&&_0x3373b4[_0x4a41('0xc')][_0x4a41('0x1d')]?_0x3373b4[_0x4a41('0xc')][_0x4a41('0x1d')]:'');},'ignoreRoute':function(_0x3ece34){var _0x473088=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x473088[_0x4a41('0x1e')](_0x3ece34[_0x4a41('0x11')]);}}));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x1f'),require('./api/user'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x20'),require(_0x4a41('0x21')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x22'),require('./api/voiceContext'));_0x3a8058[_0x4a41('0x8')]('/api/voice/extensions',require(_0x4a41('0x23')));_0x3a8058[_0x4a41('0x8')]('/api/voice/mohs',require(_0x4a41('0x24')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x25'),require('./api/voiceQueue'));_0x3a8058['use'](_0x4a41('0x26'),require(_0x4a41('0x27')));_0x3a8058['use']('/api/screen/recordings',require(_0x4a41('0x28')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x29'),require(_0x4a41('0x2a')));_0x3a8058['use'](_0x4a41('0x2b'),require(_0x4a41('0x2c')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x2d'),require(_0x4a41('0x2e')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x2f'),require(_0x4a41('0x30')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x31'),require(_0x4a41('0x32')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x33'),require(_0x4a41('0x34')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x35'),require(_0x4a41('0x36')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x37'),require(_0x4a41('0x38')));_0x3a8058['use'](_0x4a41('0x39'),require(_0x4a41('0x3a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x3b'),require(_0x4a41('0x3c')));_0x3a8058['use'](_0x4a41('0x3d'),require(_0x4a41('0x3e')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x3f'),require(_0x4a41('0x40')));_0x3a8058[_0x4a41('0x8')]('/api/mail/substatuses',require(_0x4a41('0x41')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x42'),require(_0x4a41('0x43')));_0x3a8058[_0x4a41('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x44'),require('./api/mailApplication'));_0x3a8058['use'](_0x4a41('0x45'),require(_0x4a41('0x46')));_0x3a8058['use'](_0x4a41('0x47'),require(_0x4a41('0x48')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x49'),require(_0x4a41('0x4a')));_0x3a8058['use']('/api/fax/accounts',require(_0x4a41('0x4b')));_0x3a8058[_0x4a41('0x8')]('/api/fax/applications',require(_0x4a41('0x4c')));_0x3a8058['use'](_0x4a41('0x4d'),require('./api/faxInteraction'));_0x3a8058['use'](_0x4a41('0x4e'),require(_0x4a41('0x4f')));_0x3a8058['use']('/api/fax/queues',require('./api/faxQueue'));_0x3a8058['use'](_0x4a41('0x50'),require('./api/faxQueueReport'));_0x3a8058[_0x4a41('0x8')]('/api/sms/accounts',require(_0x4a41('0x51')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x52'),require('./api/smsApplication'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x53'),require(_0x4a41('0x54')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x55'),require(_0x4a41('0x56')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x57'),require(_0x4a41('0x58')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x59'),require(_0x4a41('0x5a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x5b'),require(_0x4a41('0x5c')));_0x3a8058[_0x4a41('0x8')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x3a8058[_0x4a41('0x8')]('/api/openchannel/messages',require(_0x4a41('0x5d')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x5e'),require(_0x4a41('0x5f')));_0x3a8058[_0x4a41('0x8')]('/api/chat/websites',require('./api/chatWebsite'));_0x3a8058['use'](_0x4a41('0x60'),require(_0x4a41('0x61')));_0x3a8058['use'](_0x4a41('0x62'),require('./api/chatApplication'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x63'),require(_0x4a41('0x64')));_0x3a8058['use'](_0x4a41('0x65'),require(_0x4a41('0x66')));_0x3a8058[_0x4a41('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x67'),require(_0x4a41('0x68')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x69'),require('./api/chatGroup'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6a'),require(_0x4a41('0x6b')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6c'),require('./api/cmCompany'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6d'),require(_0x4a41('0x6e')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x6f'),require('./api/cmHopper'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x70'),require(_0x4a41('0x71')));_0x3a8058['use'](_0x4a41('0x72'),require('./api/cmHopperFinal'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x73'),require('./api/cmHopperHistory'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x74'),require(_0x4a41('0x75')));_0x3a8058['use']('/api/actions',require(_0x4a41('0x76')));_0x3a8058['use'](_0x4a41('0x77'),require('./api/automation'));_0x3a8058['use'](_0x4a41('0x78'),require('./api/cannedAnswer'));_0x3a8058['use'](_0x4a41('0x79'),require(_0x4a41('0x7a')));_0x3a8058['use']('/api/conditions',require(_0x4a41('0x7b')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x7c'),require(_0x4a41('0x7d')));_0x3a8058['use']('/api/pauses',require('./api/pause'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x7e'),require('./api/cdr'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x7f'),require(_0x4a41('0x80')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x81'),require('./api/schedule'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x82'),require(_0x4a41('0x83')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x84'),require(_0x4a41('0x85')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x86'),require(_0x4a41('0x87')));_0x3a8058[_0x4a41('0x8')]('/api/triggers',require(_0x4a41('0x88')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x89'),require(_0x4a41('0x8a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x8b'),require(_0x4a41('0x8c')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x8d'),require(_0x4a41('0x8e')));_0x3a8058[_0x4a41('0x8')]('/api/analytics/custom_reports',require(_0x4a41('0x8f')));_0x3a8058[_0x4a41('0x8')]('/api/analytics/default_reports',require(_0x4a41('0x90')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x91'),require(_0x4a41('0x92')));_0x3a8058[_0x4a41('0x8')]('/api/analytics/metrics',require(_0x4a41('0x93')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x94'),require(_0x4a41('0x95')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x96'),require(_0x4a41('0x97')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x98'),require(_0x4a41('0x99')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9a'),require(_0x4a41('0x9b')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9c'),require('./api/intSalesforceField'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9d'),require(_0x4a41('0x9e')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x9f'),require(_0x4a41('0xa0')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa1'),require(_0x4a41('0xa2')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa3'),require(_0x4a41('0xa4')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa5'),require(_0x4a41('0xa6')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa7'),require('./api/intZohoConfiguration'));_0x3a8058[_0x4a41('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xa8'),require(_0x4a41('0xa9')));_0x3a8058['use'](_0x4a41('0xaa'),require('./api/intZendeskConfiguration'));_0x3a8058['use'](_0x4a41('0xab'),require('./api/intZendeskField'));_0x3a8058['use']('/api/integrations/freshdesk/accounts',require(_0x4a41('0xac')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xad'),require(_0x4a41('0xae')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/freshdesk/fields',require(_0x4a41('0xaf')));_0x3a8058['use'](_0x4a41('0xb0'),require(_0x4a41('0xb1')));_0x3a8058['use'](_0x4a41('0xb2'),require(_0x4a41('0xb3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xb4'),require(_0x4a41('0xb5')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xb6'),require(_0x4a41('0xb7')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xb8'),require(_0x4a41('0xb9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xba'),require(_0x4a41('0xbb')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xbc'),require(_0x4a41('0xbd')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xbe'),require(_0x4a41('0xbf')));_0x3a8058[_0x4a41('0x8')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xc0'),require(_0x4a41('0xc1')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xc2'),require(_0x4a41('0xc3')));_0x3a8058[_0x4a41('0x8')]('/api/networks',require('./api/network'));_0x3a8058[_0x4a41('0x8')]('/api/chat/reports/queue',require(_0x4a41('0xc4')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xc5'),require('./api/chatInternalMessage'));_0x3a8058['use'](_0x4a41('0xc6'),require('./api/jscriptyAnswerReport'));_0x3a8058['use'](_0x4a41('0xc7'),require('./api/jscriptyQuestionReport'));_0x3a8058[_0x4a41('0x8')]('/api/jscripty/sessions/reports',require(_0x4a41('0xc8')));_0x3a8058['use']('/api/sms/reports/queue',require(_0x4a41('0xc9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xca'),require(_0x4a41('0xcb')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xcc'),require(_0x4a41('0xcd')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xce'),require(_0x4a41('0xcf')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd0'),require(_0x4a41('0xd1')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd2'),require(_0x4a41('0xd3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd4'),require(_0x4a41('0xd5')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xd6'),require(_0x4a41('0xd7')));_0x3a8058['use']('/api/square/messages',require(_0x4a41('0xd8')));_0x3a8058[_0x4a41('0x8')]('/api/teams',require(_0x4a41('0xd9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xda'),require(_0x4a41('0xdb')));_0x3a8058['use'](_0x4a41('0xdc'),require(_0x4a41('0xdd')));_0x3a8058[_0x4a41('0x8')]('/api/migrations',require(_0x4a41('0xde')));_0x3a8058[_0x4a41('0x8')]('/api/attachments',require(_0x4a41('0xdf')));_0x3a8058['use'](_0x4a41('0xe0'),require(_0x4a41('0xe1')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xe2'),require(_0x4a41('0xe3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xe4'),require(_0x4a41('0xe5')));_0x3a8058['use']('/api/fax/reports/transfer',require(_0x4a41('0xe6')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xe7'),require('./api/openchannelTransferReport'));_0x3a8058['use'](_0x4a41('0xe8'),require(_0x4a41('0xe9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xea'),require(_0x4a41('0xeb')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xec'),require('./api/voicePrefix'));_0x3a8058[_0x4a41('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xed'),require(_0x4a41('0xee')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xef'),require(_0x4a41('0xf0')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf1'),require('./api/userNotification'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf2'),require(_0x4a41('0xf3')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf4'),require(_0x4a41('0xf5')));_0x3a8058[_0x4a41('0x8')]('/api/whatsapp/interactions',require(_0x4a41('0xf6')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xf7'),require(_0x4a41('0xf8')));_0x3a8058[_0x4a41('0x8')]('/api/whatsapp/reports/queue',require(_0x4a41('0xf9')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xfa'),require(_0x4a41('0xfb')));_0x3a8058['use'](_0x4a41('0xfc'),require(_0x4a41('0xfd')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0xfe'),require(_0x4a41('0xff')));_0x3a8058[_0x4a41('0x8')]('/api/auth/local',require('./api/authLocal'));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x100'),require(_0x4a41('0x101')));_0x3a8058['use']('/api/jira',require(_0x4a41('0x102')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x103'),require(_0x4a41('0x104')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x105'),require(_0x4a41('0x106')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x107'),require(_0x4a41('0x108')));_0x3a8058[_0x4a41('0x8')]('/api/pm2',require(_0x4a41('0x109')));_0x3a8058[_0x4a41('0x8')]('/api/webbar',require(_0x4a41('0x10a')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x10b'),express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],_0x4a41('0x10b'))));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x10f'),express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],'/www')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x110'),express[_0x4a41('0x10c')](path['join'](config[_0x4a41('0x10e')],'/demo')));_0x3a8058[_0x4a41('0x8')]('/snippet',express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],_0x4a41('0x111'),'3.0.0')));_0x3a8058[_0x4a41('0x8')](_0x4a41('0x112'),express[_0x4a41('0x10c')](path[_0x4a41('0x10d')](config[_0x4a41('0x10e')],'/server/files/plugins')));_0x3a8058[_0x4a41('0x113')](_0x4a41('0x114'))['get'](errors[0x194]);_0x3a8058['route']('/*')['get'](function(_0xd2f4fd,_0x57514f){_0x57514f[_0x4a41('0x115')](path['resolve'](_0x3a8058[_0x4a41('0x116')](_0x4a41('0x117'))+_0x4a41('0x118')));});};var sensitiveFields=[_0x4a41('0x119'),_0x4a41('0x11a'),'newPassword','apiKey',_0x4a41('0x11b'),_0x4a41('0x11c'),_0x4a41('0x11d'),_0x4a41('0x11e'),'mobile',_0x4a41('0x11f'),'email',_0x4a41('0x120'),_0x4a41('0x121'),_0x4a41('0x122'),_0x4a41('0x123'),_0x4a41('0x124'),'tenantId',_0x4a41('0x125'),_0x4a41('0x126'),'accessToken',_0x4a41('0x127'),'authToken',_0x4a41('0x128'),_0x4a41('0x129'),_0x4a41('0x12a'),_0x4a41('0x12b'),'calleridnum',_0x4a41('0x12c'),_0x4a41('0x12d'),'clientEmail',_0x4a41('0x12e'),'accesskeyid','secretaccesskey','key',_0x4a41('0x14'),_0x4a41('0x12f'),_0x4a41('0x130'),_0x4a41('0x131'),_0x4a41('0x132'),'secret',_0x4a41('0x133'),_0x4a41('0x134')];function maskSensitiveData(_0x24d0f4){var _0x52b5a1=/(?!^)[\s\S](?!$)/g;if(!_[_0x4a41('0x135')](_0x24d0f4))return;for(var _0x59a8fb in _0x24d0f4){if(_[_0x4a41('0x136')](_0x24d0f4[_0x59a8fb])){for(var _0x2481d1=0x0;_0x2481d1<_0x24d0f4[_0x59a8fb]['length'];_0x2481d1++){maskSensitiveData(_0x24d0f4[_0x59a8fb][_0x2481d1]);}}else if(_[_0x4a41('0x135')](_0x24d0f4[_0x59a8fb])){maskSensitiveData(_0x24d0f4[_0x59a8fb]);}else if(_[_0x4a41('0x137')](_0x24d0f4[_0x59a8fb])){_0x24d0f4[_0x59a8fb]=_0x24d0f4[_0x59a8fb][_0x4a41('0x138')](/{{{/g,_0x4a41('0x139'))[_0x4a41('0x138')](/}}}/g,_0x4a41('0x13a'))['replace'](/{{/g,'@{')[_0x4a41('0x138')](/}}/g,'}@');if(_[_0x4a41('0x13b')](sensitiveFields,_0x59a8fb)){_0x24d0f4[_0x59a8fb]=_0x24d0f4[_0x59a8fb][_0x4a41('0x138')](_0x52b5a1,'*');}}}} \ No newline at end of file +var _0x4a05=['./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/trigger','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','resolve','appPath','/index.html','password','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','code','accessKey','accessToken','accessTokenSecret','authToken','consumerKey','membername','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','./config/environment','./config/logger','api','auth','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','name','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x4a05,0x10e));var _0x54a0=function(_0x255036,_0xf94145){_0x255036=_0x255036-0x0;var _0x3c4c56=_0x4a05[_0x255036];return _0x3c4c56;};'use strict';var _=require(_0x54a0('0x0'));var path=require(_0x54a0('0x1'));var express=require(_0x54a0('0x2'));var ewinston=require(_0x54a0('0x3'));var util=require('util');var errors=require('./errors');var config=require(_0x54a0('0x4'));var logger=require(_0x54a0('0x5'))(_0x54a0('0x6'));var authLogger=require('./config/logger')(_0x54a0('0x7'));exports[_0x54a0('0x8')]=function(_0xf89c12){_0xf89c12['use'](ewinston[_0x54a0('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x14e5a9,_0x2783f9){var _0xc628c7=_0x54a0('0xa');if(!_[_0x54a0('0xb')](_0x14e5a9[_0x54a0('0xc')])){_0xc628c7+=_0x54a0('0xd');var _0x4e84ca=_0x14e5a9[_0x54a0('0xc')];maskSensitiveData(_0x4e84ca);}return util[_0x54a0('0xe')](_0xc628c7,_0x14e5a9['method'],_0x14e5a9[_0x54a0('0xf')][_0x54a0('0x10')]?_0x14e5a9['headers'][_0x54a0('0x10')]:_0x14e5a9[_0x54a0('0x11')][_0x54a0('0x12')]||_0x14e5a9['ip'],_0x14e5a9[_0x54a0('0x13')],_0x2783f9[_0x54a0('0x14')],_0x2783f9[_0x54a0('0x15')],_0x14e5a9[_0x54a0('0x16')]?_0x14e5a9[_0x54a0('0x16')]['id']:null,_0x14e5a9[_0x54a0('0x16')]?_0x14e5a9['user']['name']:null,_0x14e5a9[_0x54a0('0x16')]?_0x14e5a9[_0x54a0('0x16')][_0x54a0('0x17')]:null,_0x4e84ca?util[_0x54a0('0x18')](_0x4e84ca,![],null):'');}}));_0xf89c12[_0x54a0('0x19')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5eb9f1,_0x5eceef){var _0x33f732=_0x54a0('0x1a');if(_0x5eb9f1[_0x54a0('0xc')]&&_0x5eb9f1[_0x54a0('0xc')][_0x54a0('0x1b')]&&_0x5eb9f1['body'][_0x54a0('0x1c')]){_0x33f732=_0x54a0('0x1d');}return util[_0x54a0('0xe')](_0x33f732,_0x5eb9f1[_0x54a0('0x1e')],_0x5eb9f1[_0x54a0('0xf')][_0x54a0('0x10')]?_0x5eb9f1[_0x54a0('0xf')][_0x54a0('0x10')]:_0x5eb9f1[_0x54a0('0x11')][_0x54a0('0x12')]||_0x5eb9f1['ip'],_0x5eb9f1['url'],_0x5eceef[_0x54a0('0x14')],_0x5eceef[_0x54a0('0x15')],_0x5eb9f1[_0x54a0('0x16')]?_0x5eb9f1[_0x54a0('0x16')]['id']:null,_0x5eb9f1[_0x54a0('0x16')]?_0x5eb9f1['user'][_0x54a0('0x1f')]:null,_0x5eb9f1['user']?_0x5eb9f1[_0x54a0('0x16')][_0x54a0('0x17')]:null,_0x5eb9f1[_0x54a0('0xc')]&&_0x5eb9f1[_0x54a0('0xc')]['device']?_0x5eb9f1['body'][_0x54a0('0x1b')]:_0x54a0('0x20'),_0x5eb9f1[_0x54a0('0xc')]&&_0x5eb9f1['body']['agent_id']?_0x5eb9f1[_0x54a0('0xc')][_0x54a0('0x1c')]:'',_0x5eb9f1[_0x54a0('0xc')]&&_0x5eb9f1[_0x54a0('0xc')][_0x54a0('0x21')]?_0x5eb9f1[_0x54a0('0xc')][_0x54a0('0x21')]:'');},'ignoreRoute':function(_0x3a49ea){var _0xf5e551=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xf5e551[_0x54a0('0x22')](_0x3a49ea[_0x54a0('0x13')]);}}));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x23'),require(_0x54a0('0x24')));_0xf89c12['use'](_0x54a0('0x25'),require(_0x54a0('0x26')));_0xf89c12['use'](_0x54a0('0x27'),require(_0x54a0('0x28')));_0xf89c12['use'](_0x54a0('0x29'),require(_0x54a0('0x2a')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x2b'),require('./api/voiceMusicOnHold'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x2c'),require(_0x54a0('0x2d')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x2e'),require('./api/voiceRecording'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x2f'),require(_0x54a0('0x30')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x31'),require(_0x54a0('0x32')));_0xf89c12['use']('/api/voice/mails/messages',require(_0x54a0('0x33')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x34'),require(_0x54a0('0x35')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x36'),require('./api/voiceDialReport'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x37'),require('./api/voiceAgentReport'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x38'),require(_0x54a0('0x39')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x3a'),require(_0x54a0('0x3b')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x3c'),require('./api/trunk'));_0xf89c12[_0x54a0('0x19')]('/api/voice/transfers/reports',require(_0x54a0('0x3d')));_0xf89c12['use'](_0x54a0('0x3e'),require(_0x54a0('0x3f')));_0xf89c12['use'](_0x54a0('0x40'),require('./api/mailAccount'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x41'),require(_0x54a0('0x42')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x43'),require('./api/mailSubstatus'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x44'),require(_0x54a0('0x45')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x46'),require(_0x54a0('0x47')));_0xf89c12[_0x54a0('0x19')]('/api/mail/applications',require(_0x54a0('0x48')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x49'),require(_0x54a0('0x4a')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x4b'),require('./api/dashboard'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x4c'),require(_0x54a0('0x4d')));_0xf89c12['use']('/api/fax/accounts',require(_0x54a0('0x4e')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x4f'),require('./api/faxApplication'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x50'),require(_0x54a0('0x51')));_0xf89c12['use'](_0x54a0('0x52'),require(_0x54a0('0x53')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x54'),require('./api/faxQueue'));_0xf89c12['use'](_0x54a0('0x55'),require(_0x54a0('0x56')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x57'),require('./api/smsAccount'));_0xf89c12[_0x54a0('0x19')]('/api/sms/applications',require(_0x54a0('0x58')));_0xf89c12[_0x54a0('0x19')]('/api/sms/interactions',require('./api/smsInteraction'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x59'),require(_0x54a0('0x5a')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x5b'),require(_0x54a0('0x5c')));_0xf89c12['use'](_0x54a0('0x5d'),require(_0x54a0('0x5e')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x5f'),require(_0x54a0('0x60')));_0xf89c12[_0x54a0('0x19')]('/api/openchannel/interactions',require(_0x54a0('0x61')));_0xf89c12[_0x54a0('0x19')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x62'),require('./api/openchannelQueue'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x63'),require(_0x54a0('0x64')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x65'),require('./api/openchannelQueueReport'));_0xf89c12['use'](_0x54a0('0x66'),require(_0x54a0('0x67')));_0xf89c12[_0x54a0('0x19')]('/api/chat/interactions',require(_0x54a0('0x68')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x69'),require(_0x54a0('0x6a')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x6b'),require(_0x54a0('0x6c')));_0xf89c12['use'](_0x54a0('0x6d'),require(_0x54a0('0x6e')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x6f'),require('./api/chatGroup'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x70'),require(_0x54a0('0x71')));_0xf89c12[_0x54a0('0x19')]('/api/cm/companies',require(_0x54a0('0x72')));_0xf89c12['use']('/api/cm/contacts',require(_0x54a0('0x73')));_0xf89c12[_0x54a0('0x19')]('/api/cm/hopper',require(_0x54a0('0x74')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x75'),require(_0x54a0('0x76')));_0xf89c12[_0x54a0('0x19')]('/api/cm/hopper_final',require(_0x54a0('0x77')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x78'),require('./api/cmHopperHistory'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x79'),require('./api/cmCustomField'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x7a'),require('./api/action'));_0xf89c12[_0x54a0('0x19')]('/api/automations',require(_0x54a0('0x7b')));_0xf89c12[_0x54a0('0x19')]('/api/canned_answers',require(_0x54a0('0x7c')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x7d'),require(_0x54a0('0x7e')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x7f'),require(_0x54a0('0x80')));_0xf89c12[_0x54a0('0x19')]('/api/intervals',require(_0x54a0('0x81')));_0xf89c12['use']('/api/pauses',require(_0x54a0('0x82')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x83'),require(_0x54a0('0x84')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x85'),require(_0x54a0('0x86')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x87'),require(_0x54a0('0x88')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x89'),require(_0x54a0('0x8a')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x8b'),require(_0x54a0('0x8c')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x8d'),require('./api/template'));_0xf89c12[_0x54a0('0x19')]('/api/triggers',require(_0x54a0('0x8e')));_0xf89c12[_0x54a0('0x19')]('/api/variables',require('./api/variable'));_0xf89c12[_0x54a0('0x19')]('/api/integrations',require(_0x54a0('0x8f')));_0xf89c12['use']('/api/integrations/reports',require(_0x54a0('0x90')));_0xf89c12['use'](_0x54a0('0x91'),require(_0x54a0('0x92')));_0xf89c12[_0x54a0('0x19')]('/api/analytics/default_reports',require(_0x54a0('0x93')));_0xf89c12[_0x54a0('0x19')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x94'),require(_0x54a0('0x95')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x96'),require(_0x54a0('0x97')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x98'),require(_0x54a0('0x99')));_0xf89c12[_0x54a0('0x19')]('/api/integrations/salesforce/accounts',require(_0x54a0('0x9a')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x9b'),require(_0x54a0('0x9c')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x9d'),require(_0x54a0('0x9e')));_0xf89c12[_0x54a0('0x19')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0xf89c12[_0x54a0('0x19')]('/api/integrations/sugarcrm/configurations',require(_0x54a0('0x9f')));_0xf89c12['use'](_0x54a0('0xa0'),require(_0x54a0('0xa1')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xa2'),require('./api/intDeskAccount'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xa3'),require(_0x54a0('0xa4')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xa5'),require(_0x54a0('0xa6')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xa7'),require(_0x54a0('0xa8')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xa9'),require(_0x54a0('0xaa')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xab'),require(_0x54a0('0xac')));_0xf89c12['use'](_0x54a0('0xad'),require(_0x54a0('0xae')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xaf'),require('./api/intZendeskConfiguration'));_0xf89c12['use']('/api/integrations/zendesk/fields',require(_0x54a0('0xb0')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xb1'),require(_0x54a0('0xb2')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xb3'),require(_0x54a0('0xb4')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xb5'),require(_0x54a0('0xb6')));_0xf89c12[_0x54a0('0x19')]('/api/integrations/vtiger/accounts',require(_0x54a0('0xb7')));_0xf89c12[_0x54a0('0x19')]('/api/integrations/vtiger/configurations',require(_0x54a0('0xb8')));_0xf89c12[_0x54a0('0x19')]('/api/integrations/vtiger/fields',require(_0x54a0('0xb9')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xba'),require(_0x54a0('0xbb')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xbc'),require(_0x54a0('0xbd')));_0xf89c12[_0x54a0('0x19')]('/api/integrations/servicenow/fields',require(_0x54a0('0xbe')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xbf'),require('./api/intDynamics365Account'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xc0'),require(_0x54a0('0xc1')));_0xf89c12['use'](_0x54a0('0xc2'),require(_0x54a0('0xc3')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xc4'),require(_0x54a0('0xc5')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xc6'),require('./api/intFreshsalesConfiguration'));_0xf89c12[_0x54a0('0x19')]('/api/integrations/freshsales/fields',require(_0x54a0('0xc7')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xc8'),require(_0x54a0('0xc9')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xca'),require(_0x54a0('0xcb')));_0xf89c12['use']('/api/chat/internal/messages',require(_0x54a0('0xcc')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xcd'),require(_0x54a0('0xce')));_0xf89c12[_0x54a0('0x19')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xcf'),require(_0x54a0('0xd0')));_0xf89c12['use']('/api/sms/reports/queue',require(_0x54a0('0xd1')));_0xf89c12[_0x54a0('0x19')]('/api/square/reports',require(_0x54a0('0xd2')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xd3'),require(_0x54a0('0xd4')));_0xf89c12['use']('/api/jscripty/projects',require(_0x54a0('0xd5')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xd6'),require(_0x54a0('0xd7')));_0xf89c12['use'](_0x54a0('0xd8'),require(_0x54a0('0xd9')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xda'),require(_0x54a0('0xdb')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xdc'),require(_0x54a0('0xdd')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xde'),require(_0x54a0('0xdf')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xe0'),require(_0x54a0('0xe1')));_0xf89c12['use'](_0x54a0('0xe2'),require(_0x54a0('0xe3')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xe4'),require(_0x54a0('0xe5')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xe6'),require(_0x54a0('0xe7')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xe8'),require('./api/attachment'));_0xf89c12['use']('/api/plugins',require('./api/plugin'));_0xf89c12['use'](_0x54a0('0xe9'),require('./api/mailTransferReport'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xea'),require(_0x54a0('0xeb')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xec'),require('./api/faxTransferReport'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xed'),require(_0x54a0('0xee')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xef'),require(_0x54a0('0xf0')));_0xf89c12['use'](_0x54a0('0xf1'),require(_0x54a0('0xf2')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xf3'),require(_0x54a0('0xf4')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xf5'),require(_0x54a0('0xf6')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xf7'),require('./api/userProfileSection'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xf8'),require('./api/userProfileResource'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xf9'),require('./api/userNotification'));_0xf89c12['use'](_0x54a0('0xfa'),require('./api/whatsappAccount'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xfb'),require(_0x54a0('0xfc')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0xfd'),require('./api/whatsappInteraction'));_0xf89c12['use'](_0x54a0('0xfe'),require('./api/whatsappMessage'));_0xf89c12['use']('/api/whatsapp/reports/queue',require(_0x54a0('0xff')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x100'),require(_0x54a0('0x101')));_0xf89c12['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x102'),require(_0x54a0('0x103')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x104'),require(_0x54a0('0x105')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x106'),require(_0x54a0('0x107')));_0xf89c12['use'](_0x54a0('0x108'),require('./api/jira'));_0xf89c12[_0x54a0('0x19')]('/api/rpc',require(_0x54a0('0x109')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x10a'),require('./api/version'));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x10b'),require(_0x54a0('0x10c')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x10d'),require(_0x54a0('0x10e')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x10f'),require(_0x54a0('0x110')));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x111'),express[_0x54a0('0x112')](path[_0x54a0('0x113')](config[_0x54a0('0x114')],_0x54a0('0x111'))));_0xf89c12['use'](_0x54a0('0x115'),express[_0x54a0('0x112')](path[_0x54a0('0x113')](config['root'],_0x54a0('0x115'))));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x116'),express['static'](path['join'](config[_0x54a0('0x114')],_0x54a0('0x116'))));_0xf89c12[_0x54a0('0x19')](_0x54a0('0x117'),express['static'](path[_0x54a0('0x113')](config[_0x54a0('0x114')],'snippet',_0x54a0('0x118'))));_0xf89c12['use'](_0x54a0('0x119'),express['static'](path['join'](config[_0x54a0('0x114')],_0x54a0('0x11a'))));_0xf89c12['route'](_0x54a0('0x11b'))['get'](errors[0x194]);_0xf89c12[_0x54a0('0x11c')]('/*')[_0x54a0('0x11d')](function(_0x42a50d,_0x238cbd){_0x238cbd[_0x54a0('0x11e')](path[_0x54a0('0x11f')](_0xf89c12[_0x54a0('0x11d')](_0x54a0('0x120'))+_0x54a0('0x121')));});};var sensitiveFields=['username',_0x54a0('0x122'),_0x54a0('0x123'),_0x54a0('0x124'),_0x54a0('0x125'),'lastName',_0x54a0('0x126'),_0x54a0('0x127'),_0x54a0('0x128'),'fax',_0x54a0('0x129'),_0x54a0('0x12a'),'clientSecret','securityToken',_0x54a0('0x12b'),_0x54a0('0x12c'),'tenantId','token','channelSecret',_0x54a0('0x12d'),_0x54a0('0x12e'),_0x54a0('0x12f'),_0x54a0('0x130'),'consumerSecret',_0x54a0('0x131'),'calleridname',_0x54a0('0x132'),_0x54a0('0x133'),_0x54a0('0x134'),_0x54a0('0x135'),_0x54a0('0x136'),'accesskeyid',_0x54a0('0x137'),_0x54a0('0x138'),'user',_0x54a0('0x139'),_0x54a0('0x13a'),_0x54a0('0x13b'),_0x54a0('0x13c'),'secret',_0x54a0('0x13d'),_0x54a0('0x13e')];function maskSensitiveData(_0x4d006c){var _0x2367ad=/(?!^)[\s\S](?!$)/g;if(!_[_0x54a0('0x13f')](_0x4d006c))return;for(var _0x46951a in _0x4d006c){if(_[_0x54a0('0x140')](_0x4d006c[_0x46951a])){for(var _0x20cd6a=0x0;_0x20cd6a<_0x4d006c[_0x46951a][_0x54a0('0x141')];_0x20cd6a++){maskSensitiveData(_0x4d006c[_0x46951a][_0x20cd6a]);}}else if(_[_0x54a0('0x13f')](_0x4d006c[_0x46951a])){maskSensitiveData(_0x4d006c[_0x46951a]);}else if(_[_0x54a0('0x142')](_0x4d006c[_0x46951a])){_0x4d006c[_0x46951a]=_0x4d006c[_0x46951a][_0x54a0('0x143')](/{{{/g,_0x54a0('0x144'))['replace'](/}}}/g,_0x54a0('0x145'))[_0x54a0('0x143')](/{{/g,'@{')[_0x54a0('0x143')](/}}/g,'}@');if(_[_0x54a0('0x146')](sensitiveFields,_0x46951a)){_0x4d006c[_0x46951a]=_0x4d006c[_0x46951a]['replace'](_0x2367ad,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index f2757ae..0e6d60e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca2e=['../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca2e,0x10a));var _0xeca2=function(_0x437b4f,_0xb4cef1){_0x437b4f=_0x437b4f-0x0;var _0x5d0c2b=_0xca2e[_0x437b4f];return _0x5d0c2b;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require('lodash');var config=require('../config/environment');exports[_0xeca2('0x0')]=function(){return new BPromise(function(_0x2a9751,_0xc6613a){var _0x13ce27={};_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x4')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/voiceRecording/voiceRecording.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x5')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x6')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x7')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x8')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x9')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xa')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xb')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xc')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xd')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/mailMessage/mailMessage.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0xe')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0xf')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x10')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/faxApplication/faxApplication.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x11')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x12')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x13')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x14')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x15')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x16')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x17')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/smsQueue/smsQueue.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x18')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x19')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1a')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1b')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1c')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x1d')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x1e')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x1f')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x20')));_0x13ce27=_['merge'](_0x13ce27,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x21')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x22')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x23')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x24')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x25')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/sound/sound.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x26')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x27')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x28')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x29')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2a')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2b')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x2c')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x2d')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2e')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x2f')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x30')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x31')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x32')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/squareReport/squareReport.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x33')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x34')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x35')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x36')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require('../api/squareRecording/squareRecording.rpc'));_0x13ce27=_['merge'](_0x13ce27,require('../api/squareMessage/squareMessage.rpc'));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x37')));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x38')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x39')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3a')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3b')));_0x13ce27=_[_0xeca2('0x1')](_0x13ce27,require(_0xeca2('0x3c')));_0x13ce27=_['merge'](_0x13ce27,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x13ce27=_['merge'](_0x13ce27,require(_0xeca2('0x3d')));var _0x1d3713=jayson[_0xeca2('0x3e')](_0x13ce27)[_0xeca2('0x3f')]();var _0x3be8e7=config['rpc'][_0xeca2('0x40')]||config[_0xeca2('0x40')]+0x1;var _0xe9ec7b=config[_0xeca2('0x41')]['ip']||_0xeca2('0x42');_0x1d3713['on'](_0xeca2('0x43'),function(_0x58317d){return _0xc6613a(_0x58317d);});_0x1d3713[_0xeca2('0x0')](_0x3be8e7,_0xe9ec7b,function(){console[_0xeca2('0x44')](_0xeca2('0x45'),_0xe9ec7b,_0x3be8e7);require('../config/triggers')[_0xeca2('0x46')]();return _0x2a9751(_0xeca2('0x47')+_0xe9ec7b+':'+_0x3be8e7);});});}; \ No newline at end of file +var _0xe465=['../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0xe465,0xee));var _0x5e46=function(_0x53c6a6,_0x3a6c19){_0x53c6a6=_0x53c6a6-0x0;var _0x2272fa=_0xe465[_0x53c6a6];return _0x2272fa;};'use strict';var jayson=require(_0x5e46('0x0'));var BPromise=require(_0x5e46('0x1'));var _=require(_0x5e46('0x2'));var config=require('../config/environment');exports[_0x5e46('0x3')]=function(){return new BPromise(function(_0xf42fc0,_0x56eedc){var _0x15b317={};_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x5')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/voiceExtension/voiceExtension.rpc'));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x6')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x7')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x8')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x9')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0xa')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0xb')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0xc')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0xd')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0xe')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0xf')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x10')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/mailAccount/mailAccount.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x11')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/mailInteraction/mailInteraction.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x12')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x13')));_0x15b317=_['merge'](_0x15b317,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x15b317=_['merge'](_0x15b317,require('../api/faxAccount/faxAccount.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x14')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x15')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x16')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x17')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/smsAccount/smsAccount.rpc'));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x18')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x19')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x1a')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x1b')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x1c')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x1d')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/chatInteraction/chatInteraction.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x1e')));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x1f')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x20')));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x21')));_0x15b317=_['merge'](_0x15b317,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x22')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x23')));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x24')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x25')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x26')));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x27')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x28')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x29')));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x2a')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x2b')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x2c')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x2d')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x2e')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x15b317=_['merge'](_0x15b317,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x2f')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x30')));_0x15b317=_['merge'](_0x15b317,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x31')));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x32')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x33')));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x34')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x35')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x36')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x37')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x38')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/squareMessage/squareMessage.rpc'));_0x15b317=_['merge'](_0x15b317,require(_0x5e46('0x39')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x3a')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/plugin/plugin.rpc'));_0x15b317=_['merge'](_0x15b317,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x3b')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x3c')));_0x15b317=_[_0x5e46('0x4')](_0x15b317,require(_0x5e46('0x3d')));var _0x420bf3=jayson['server'](_0x15b317)[_0x5e46('0x3e')]();var _0x141b9b=config[_0x5e46('0x3f')][_0x5e46('0x40')]||config[_0x5e46('0x40')]+0x1;var _0x4d0f5c=config[_0x5e46('0x3f')]['ip']||_0x5e46('0x41');_0x420bf3['on'](_0x5e46('0x42'),function(_0x4c42ab){return _0x56eedc(_0x4c42ab);});_0x420bf3[_0x5e46('0x3')](_0x141b9b,_0x4d0f5c,function(){console[_0x5e46('0x43')](_0x5e46('0x44'),_0x4d0f5c,_0x141b9b);require(_0x5e46('0x45'))['default']();return _0xf42fc0('RPC\x20listening\x20on\x20'+_0x4d0f5c+':'+_0x141b9b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 213be16..cd37560 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x21100e,_0x136844){var _0x75a799=function(_0x574c92){while(--_0x574c92){_0x21100e['push'](_0x21100e['shift']());}};_0x75a799(++_0x136844);}(_0x70e0,0x17b));var _0x070e=function(_0xc51032,_0x4fe95d){_0xc51032=_0xc51032-0x0;var _0x57c7e1=_0x70e0[_0xc51032];return _0x57c7e1;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x1e9837,_0x53e497){var _0x4cf75b=function(_0x45ce8f){while(--_0x45ce8f){_0x1e9837['push'](_0x1e9837['shift']());}};_0x4cf75b(++_0x53e497);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index cc11d24..c8f6526 100644 --- a/server/services/agi/error.js +++ b/server/services/agi/error.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2ea=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x211c0a,_0x54f209){var _0x26f1a1=function(_0x13b0cd){while(--_0x13b0cd){_0x211c0a['push'](_0x211c0a['shift']());}};_0x26f1a1(++_0x54f209);}(_0xd2ea,0x15f));var _0xad2e=function(_0x26b343,_0x1d1c39){_0x26b343=_0x26b343-0x0;var _0x5334e4=_0xd2ea[_0x26b343];return _0x5334e4;};'use strict';var util=require(_0xad2e('0x0'));var error={'E_AGI_UNDEFINED':_0xad2e('0x1'),'E_AGI_ARGUMENT_PORT':_0xad2e('0x2'),'E_AGI_SERVER_ERROR':_0xad2e('0x3'),'E_AGI_SERVER_CLOSE':_0xad2e('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xad2e('0x5'),'E_AGI_SOCKET_ERROR':_0xad2e('0x6'),'E_AGI_SOCKET_CLOSE':_0xad2e('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xad2e('0x8'),'E_AGI_COMMAND_EMPTY':_0xad2e('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xad2e('0xa'),'E_AGI_IVR_ENTRY':_0xad2e('0xb')};function AGIError(_0x592e8b){var _0x592e8b=_0x592e8b||null,_0x3e3d1f=_0x3e3d1f||[],_0x2ff7b2=0x1,_0x5710ac='';if(!error[_0x592e8b]){_0x592e8b=_0xad2e('0xc');}_0x3e3d1f[_0xad2e('0xd')](error[_0x592e8b]);while(arguments[_0x2ff7b2]){_0x3e3d1f['push'](arguments[_0x2ff7b2]);_0x2ff7b2++;}_0x5710ac=util[_0xad2e('0xe')]['apply'](util,_0x3e3d1f);this[_0xad2e('0xf')]=_0x5710ac;this[_0xad2e('0x10')]=_0x592e8b;}module[_0xad2e('0x11')]=AGIError; \ No newline at end of file +var _0xb2ff=['push','apply','name','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xb2ff,0x123));var _0xfb2f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2ff[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xfb2f('0x0'));var error={'E_AGI_UNDEFINED':_0xfb2f('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xfb2f('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xfb2f('0x3'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xfb2f('0x4'),'E_AGI_COMMAND_EMPTY':_0xfb2f('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfb2f('0x6'),'E_AGI_IVR_ENTRY':_0xfb2f('0x7')};function AGIError(_0x542ce7){var _0x542ce7=_0x542ce7||null,_0x28cb13=_0x28cb13||[],_0x4ff2df=0x1,_0x34c04e='';if(!error[_0x542ce7]){_0x542ce7=_0xfb2f('0x8');}_0x28cb13[_0xfb2f('0x9')](error[_0x542ce7]);while(arguments[_0x4ff2df]){_0x28cb13[_0xfb2f('0x9')](arguments[_0x4ff2df]);_0x4ff2df++;}_0x34c04e=util['format'][_0xfb2f('0xa')](util,_0x28cb13);this['message']=_0x34c04e;this[_0xfb2f('0xb')]=_0x542ce7;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 8b39bbb..39bbfb8 100644 --- a/server/services/agi/graph/index.js +++ b/server/services/agi/graph/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c2c=['lodash','../../../config/logger','getsecretdigits','edges','numberOfEdges','prototype','addEdge','push','size','vertices','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','menu','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc9c2('0x0'));var logger=require(_0xc9c2('0x1'))('agi');var verticesWithRetry=['menu','getdigits',_0xc9c2('0x2')];var Graph=function(){this['vertices']={};this[_0xc9c2('0x3')]={};this[_0xc9c2('0x4')]=0x0;};Graph['prototype']['addVertex']=function(_0x35818b){this['vertices'][_0x35818b['id']]=_0x35818b;this[_0xc9c2('0x3')][_0x35818b['id']]=[];};Graph[_0xc9c2('0x5')][_0xc9c2('0x6')]=function(_0x18a815,_0x270572,_0xd7fb27){this[_0xc9c2('0x3')][_0x18a815][_0xc9c2('0x7')]({'target':_0x270572,'condition':_0xd7fb27});this[_0xc9c2('0x4')]+=0x1;};Graph['prototype'][_0xc9c2('0x8')]=function(){return _['size'](this[_0xc9c2('0x9')]);};Graph[_0xc9c2('0x5')][_0xc9c2('0xa')]=function(){return this[_0xc9c2('0x4')];};Graph['prototype']['getVertex']=function(_0x10c97d){return this[_0xc9c2('0x9')][_0x10c97d];};Graph['prototype'][_0xc9c2('0xb')]=function(_0x1f08a7,_0x3e7cfb){if(!this[_0xc9c2('0x9')][_0x1f08a7]){return logger[_0xc9c2('0xc')](_0xc9c2('0xd'));}var _0x33b288=_0x3e7cfb(this[_0xc9c2('0x9')][_0x1f08a7]);if(!_0x33b288){return logger[_0xc9c2('0xc')](_0xc9c2('0xe'));}if(this[_0xc9c2('0x3')][_0x1f08a7][_0xc9c2('0xf')]===0x0){return logger['info'](_0xc9c2('0x10'));}for(var _0xc554be=0x0,_0x728017=[],_0x240099=![];_0xc554be\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','createSquareReport','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','response','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','catch','connection','xml2json','syncho','util','moment','../../config/logger'];(function(_0x3be2b5,_0x1d14eb){var _0xd67367=function(_0x3a97ad){while(--_0x3a97ad){_0x3be2b5['push'](_0x3be2b5['shift']());}};_0xd67367(++_0x1d14eb);}(_0xbeea,0xb1));var _0xabee=function(_0x5949d0,_0x34a473){_0x5949d0=_0x5949d0-0x0;var _0x4d1c7f=_0xbeea[_0x5949d0];return _0x4d1c7f;};'use strict';var parser=require(_0xabee('0x0'));var _=require('lodash');var syncho=require(_0xabee('0x1'));var util=require(_0xabee('0x2'));var moment=require(_0xabee('0x3'));var config=require('../../config/environment');var logger=require(_0xabee('0x4'))('agi');var utilLicense=require(_0xabee('0x5'));var rpc=require(_0xabee('0x6'));var mailRpc=require(_0xabee('0x7'));var Graph=require(_0xabee('0x8'));var Vertices=require(_0xabee('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_['defaults'](config[_0xabee('0xa')],{'ip':_0xabee('0xb'),'port':0x11dd});function connectionHandler(_0x4a2999){process[_0xabee('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4a2999);agiHandler(_0x4a2999);}catch(_0x507deb){logger[_0xabee('0xd')](_0x507deb[_0xabee('0xe')]);}});});}function listeningHandler(){console[_0xabee('0xf')](_0xabee('0x10'),config[_0xabee('0xa')][_0xabee('0x11')]);logger['info'](util[_0xabee('0x12')](_0xabee('0x13'),config[_0xabee('0xa')]['ip'],config['agi'][_0xabee('0x11')]));}function errorHandler(_0x168202){if(_0x168202&&_0x168202[_0xabee('0x14')]&&_0x168202['message']){logger['error'](util['format']('[%s]\x20%s',_0x168202['name'],_0x168202[_0xabee('0x15')]));}else{logger[_0xabee('0xd')](util[_0xabee('0x12')](_0xabee('0x16'),_0x168202[_0xabee('0xe')]));}}function closeHandler(){logger['info'](util[_0xabee('0x12')](_0xabee('0x17'),this[_0xabee('0x18')],this[_0xabee('0x19')],this[_0xabee('0x1a')],this[_0xabee('0x1b')],this[_0xabee('0x1c')]));try{createSquareReport(this);}catch(_0x5a9562){logger[_0xabee('0xd')](_0x5a9562[_0xabee('0xe')]);}}function timeoutHandler(){logger[_0xabee('0x1d')](util[_0xabee('0x12')](_0xabee('0x1e'),this[_0xabee('0x18')],this['calleridname'],this['callerid'],this[_0xabee('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xabee('0x12')](_0xabee('0x1f'),this[_0xabee('0x18')],this[_0xabee('0x19')],this[_0xabee('0x1a')],this['dnid'],this[_0xabee('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x4f5501){return parser['toJson'](_0x4f5501,{'object':!![]})[_0xabee('0x20')]['root'];}function addVertex(_0x870569,_0x2834e3,_0x520bc){_0x2834e3[_0xabee('0x21')]=_0x520bc;if(_0x2834e3[_0xabee('0x22')](_0xabee('0x23'))){_0x2834e3[_0xabee('0x24')]=parseInt(_0x2834e3['retry'],0xa);}_0x870569[_0xabee('0x25')](_[_0xabee('0x26')](_0x2834e3,_0xabee('0x27')));}function initGraph(_0x21e4fd,_0x4ae65e){var _0x2aa470=new Graph();for(var _0x123d58 in _0x21e4fd){if(_0x21e4fd['hasOwnProperty'](_0x123d58)){if(_[_0xabee('0x28')](_0x21e4fd[_0x123d58])){for(var _0x232144=0x0;_0x232144<_0x21e4fd[_0x123d58][_0xabee('0x29')];_0x232144+=0x1){addVertex(_0x2aa470,_0x21e4fd[_0x123d58][_0x232144],_0x123d58);}}else{addVertex(_0x2aa470,_0x21e4fd[_0x123d58],_0x123d58);}}}for(var _0x26a5d1=0x0;_0x26a5d1<_0x4ae65e['length'];_0x26a5d1+=0x1){if(_0x4ae65e[_0x26a5d1][_0xabee('0x2a')]&&_0x4ae65e[_0x26a5d1][_0xabee('0x2b')]){_0x2aa470[_0xabee('0x2c')](_0x4ae65e[_0x26a5d1][_0xabee('0x2a')],_0x4ae65e[_0x26a5d1][_0xabee('0x2b')],_0x4ae65e[_0x26a5d1][_0xabee('0x2d')]);}}return _0x2aa470;}function getSquareProject(_0x3df00d,_0x42368d){rpc[_0xabee('0x2e')](_0x3df00d)['then'](function(_0x2a2441){_0x42368d(null,_0x2a2441);})['catch'](function(_0x1afe17){_0x42368d(null,_0x1afe17);});}function createSquareReport(_0x1ebc01,_0xe0b7bd){rpc[_0xabee('0x2f')](_0x1ebc01)['then'](function(_0x297180){if(_0xe0b7bd){_0xe0b7bd(null,_0x297180);}})['catch'](function(_0x4098ec){if(_0xe0b7bd){_0xe0b7bd(null,_0x4098ec);}});}function setChannelVariables(_0x525e85){for(var _0x123a34 in _0x525e85){if(_0x525e85['hasOwnProperty'](_0x123a34)){if(_0x123a34['indexOf'](_0xabee('0x30'))===0x0){_0x525e85[_0x123a34[_0xabee('0x31')](0x4)]=_0x525e85[_0x123a34];delete _0x525e85[_0x123a34];}}}}function getLogFromObject(_0x3c839e){return util[_0xabee('0x32')](_0x3c839e,{'showHidden':![],'depth':null});}function agiHandler(_0x42e434){var _0xaefbc3,_0x199929,_0x2a67fb,_0x55a27b,_0x261bfb;logger[_0xabee('0x33')](_0xabee('0x34'),JSON[_0xabee('0x35')](_0x42e434,null,0x2));logger[_0xabee('0x1d')](util[_0xabee('0x12')](_0xabee('0x36'),_0x42e434[_0xabee('0x18')],_0x42e434[_0xabee('0x19')],_0x42e434[_0xabee('0x1a')],_0x42e434[_0xabee('0x1b')],_0x42e434[_0xabee('0x1c')]));_0x42e434['on'](_0xabee('0xd'),errorHandler);_0x42e434['on'](_0xabee('0x37'),closeHandler);_0x42e434['on'](_0xabee('0x38'),timeoutHandler);_0x42e434[_0xabee('0x39')]=![];_0x42e434['on'](_0xabee('0x3a'),hangupHandler);var _0x491279=getSquareProject['sync'](null,_0x42e434[_0xabee('0x18')]);if(_0x491279){if(_0x491279[_0xabee('0x3b')]){_0xaefbc3=getRoot(_0x491279[_0xabee('0x3b')]);if(_0xaefbc3&&_0xaefbc3[_0xabee('0x3c')]){logger['debug'](_0xabee('0x3d'),JSON[_0xabee('0x35')](_0xaefbc3,null,0x2));_0x42e434[_0xabee('0x3e')]=moment()['format'](_0xabee('0x3f'));_0x199929=initGraph(_['omit'](_0xaefbc3,_0xabee('0x27')),_0xaefbc3[_0xabee('0x27')]);_0x2a67fb=new Vertices(_0x42e434,rpc,mailRpc);logger[_0xabee('0x1d')](util[_0xabee('0x12')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42e434['arg_1'],_0x42e434[_0xabee('0x19')],_0x42e434[_0xabee('0x1a')],_0x42e434[_0xabee('0x1b')],_0x42e434[_0xabee('0x1c')]));_0x199929[_0xabee('0x40')](_0xaefbc3['start']['id'],function(_0x229b00){try{_0x229b00=_0x2a67fb[_0xabee('0x41')](_0x229b00);logger['debug'](_0xabee('0x42'),JSON[_0xabee('0x35')](_0x229b00,null,0x2));if(_0x229b00['agicommand']===_0xabee('0x43')){logger[_0xabee('0x1d')](_0xabee('0x44'));_0x42e434[_0xabee('0x45')]=_0x229b00[_0xabee('0x45')]||_0x42e434[_0xabee('0x45')];_0x42e434[_0xabee('0x46')]=_0x229b00['extension'];_0x42e434[_0xabee('0x47')]=_0x229b00[_0xabee('0x47')]?_0x229b00[_0xabee('0x47')]-0x1:0x1;return null;}else if(_0x229b00&&_0x2a67fb[_0x229b00['agicommand']]){_0x261bfb=_0x2a67fb[_0x229b00[_0xabee('0x21')]](_0x229b00);logger[_0xabee('0x1d')]('response',JSON[_0xabee('0x35')](_0x261bfb,null,0x2));if(_0x261bfb&&_0x261bfb[_0xabee('0x48')]===AGI_CODE_SUCCESS&&_0x261bfb['result']!==AGI_RESULT_ERROR&&!_0x42e434[_0xabee('0x39')]){logger[_0xabee('0x33')](_0xabee('0x49'),getLogFromObject(_0x261bfb));return _[_0xabee('0x4a')](_0x261bfb[_0xabee('0x4b')])?null:_0x261bfb[_0xabee('0x4b')][_0xabee('0x4c')]();}else{logger['error'](_0xabee('0x49'),getLogFromObject(_0x261bfb));return null;}}else{logger[_0xabee('0xd')](_0xabee('0x4d'));return null;}}catch(_0x5e1879){logger[_0xabee('0xd')](_0x5e1879[_0xabee('0xe')]);return null;}});if(_0xaefbc3['finally']){logger['info'](util['format'](_0xabee('0x4e'),_0x42e434[_0xabee('0x18')],_0x42e434['calleridname'],_0x42e434['callerid'],_0x42e434[_0xabee('0x1b')],_0x42e434[_0xabee('0x1c')]));_0x199929[_0xabee('0x40')](_0xaefbc3[_0xabee('0x4f')]['id'],function(_0x184058){try{_0x184058=_0x2a67fb[_0xabee('0x41')](_0x184058);logger[_0xabee('0x33')](_0xabee('0x42'),JSON[_0xabee('0x35')](_0x184058,null,0x2));if(_0x184058&&_0x2a67fb[_0x184058[_0xabee('0x21')]]){_0x261bfb=_0x2a67fb[_0x184058[_0xabee('0x21')]](_0x184058);if(_0x261bfb){logger[_0xabee('0x33')](_0xabee('0x49'),getLogFromObject(_0x261bfb));return _[_0xabee('0x4a')](_0x261bfb[_0xabee('0x4b')])?null:_0x261bfb[_0xabee('0x4b')][_0xabee('0x4c')]();}else{logger[_0xabee('0xd')]('response',getLogFromObject(_0x261bfb));return null;}}else{logger[_0xabee('0xd')](_0xabee('0x4d'));return null;}}catch(_0x4bee06){logger['error'](_0x4bee06[_0xabee('0xe')]);return null;}});}logger[_0xabee('0x1d')](util[_0xabee('0x12')](_0xabee('0x50'),_0x42e434[_0xabee('0x18')],_0x42e434[_0xabee('0x19')],_0x42e434[_0xabee('0x1a')],_0x42e434['dnid'],_0x42e434[_0xabee('0x1c')]));logger['info'](util[_0xabee('0x12')](_0xabee('0x51'),_0x42e434['context'],_0x42e434[_0xabee('0x46')],parseInt(_0x42e434[_0xabee('0x47')],0xa)+0x1));_0x42e434[_0xabee('0x52')](_0x42e434['context'],_0x42e434[_0xabee('0x46')],parseInt(_0x42e434['priority'],0xa)+0x1);_0x42e434[_0xabee('0x37')]();}}else{logger[_0xabee('0xd')](util[_0xabee('0x12')]('Project\x20%s\x20not\x20published',_0x42e434[_0xabee('0x18')]));_0x42e434[_0xabee('0x52')](_0x42e434[_0xabee('0x45')],_0x42e434['extension'],parseInt(_0x42e434[_0xabee('0x47')],0xa)+0x1);_0x42e434[_0xabee('0x37')]();}}else{logger[_0xabee('0xd')](util[_0xabee('0x12')]('Project\x20%s\x20not\x20found',_0x42e434[_0xabee('0x18')]));_0x42e434[_0xabee('0x52')](_0x42e434[_0xabee('0x45')],_0x42e434['extension'],parseInt(_0x42e434[_0xabee('0x47')],0xa)+0x1);_0x42e434[_0xabee('0x37')]();}}function main(){var _0x92baa3;return utilLicense[_0xabee('0x53')]()[_0xabee('0x54')](function(_0x105130){if(_0x105130){if(_0x105130[_0xabee('0x55')]){if(_0x105130[_0xabee('0x56')]&&_0x105130[_0xabee('0x56')]>0x0){logger['info'](util['format'](_0xabee('0x57'),_0x105130[_0xabee('0x56')]));_0x92baa3=_0x105130[_0xabee('0x56')];}else{logger[_0xabee('0x1d')](_0xabee('0x58'));}}else{logger[_0xabee('0x1d')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x92baa3=-0x1;}}})[_0xabee('0x59')](function(_0x269fed){logger[_0xabee('0xd')]('[LICENSE]',_0x269fed['stack']);})[_0xabee('0x4f')](function(){var _0x4b1448=require('./server')(config['agi'][_0xabee('0x11')],config['agi']['ip'],_0x92baa3);_0x4b1448['on'](_0xabee('0xd'),errorHandler);_0x4b1448['on']('listening',listeningHandler);_0x4b1448['on'](_0xabee('0x5a'),connectionHandler);_0x4b1448['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xe198=['finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','catch','createSquareReport','then','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','isUndefined','toString'];(function(_0x150a5e,_0x25f2dc){var _0x37c97b=function(_0x3cd5eb){while(--_0x3cd5eb){_0x150a5e['push'](_0x150a5e['shift']());}};_0x37c97b(++_0x25f2dc);}(_0xe198,0x6f));var _0x8e19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe198[_0x3ab51d];return _0x29a04e;};'use strict';var parser=require(_0x8e19('0x0'));var _=require(_0x8e19('0x1'));var syncho=require('syncho');var util=require('util');var moment=require(_0x8e19('0x2'));var config=require(_0x8e19('0x3'));var logger=require(_0x8e19('0x4'))(_0x8e19('0x5'));var utilLicense=require(_0x8e19('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x8e19('0x7'));var Graph=require(_0x8e19('0x8'));var Vertices=require(_0x8e19('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8e19('0x5')]=_[_0x8e19('0xa')](config[_0x8e19('0x5')],{'ip':_0x8e19('0xb'),'port':0x11dd});function connectionHandler(_0xfc45e){process[_0x8e19('0xc')](function(){syncho(function(){try{setChannelVariables(_0xfc45e);agiHandler(_0xfc45e);}catch(_0x1646d4){logger[_0x8e19('0xd')](_0x1646d4[_0x8e19('0xe')]);}});});}function listeningHandler(){console[_0x8e19('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x8e19('0x5')][_0x8e19('0x10')]);logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x13'),config[_0x8e19('0x5')]['ip'],config[_0x8e19('0x5')][_0x8e19('0x10')]));}function errorHandler(_0x48433d){if(_0x48433d&&_0x48433d['name']&&_0x48433d[_0x8e19('0x14')]){logger['error'](util['format'](_0x8e19('0x15'),_0x48433d[_0x8e19('0x16')],_0x48433d[_0x8e19('0x14')]));}else{logger[_0x8e19('0xd')](util['format'](_0x8e19('0x17'),_0x48433d[_0x8e19('0xe')]));}}function closeHandler(){logger['info'](util[_0x8e19('0x12')](_0x8e19('0x18'),this['arg_1'],this[_0x8e19('0x19')],this[_0x8e19('0x1a')],this[_0x8e19('0x1b')],this[_0x8e19('0x1c')]));try{createSquareReport(this);}catch(_0x368896){logger[_0x8e19('0xd')](_0x368896[_0x8e19('0xe')]);}}function timeoutHandler(){logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x1d'),this[_0x8e19('0x1e')],this[_0x8e19('0x19')],this[_0x8e19('0x1a')],this[_0x8e19('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x1f'),this[_0x8e19('0x1e')],this[_0x8e19('0x19')],this[_0x8e19('0x1a')],this[_0x8e19('0x1b')],this[_0x8e19('0x1c')]));this[_0x8e19('0x20')]=!![];}function getRoot(_0x1223c9){return parser[_0x8e19('0x21')](_0x1223c9,{'object':!![]})[_0x8e19('0x22')][_0x8e19('0x23')];}function addVertex(_0x56b5bf,_0x33d921,_0x556f61){_0x33d921['agicommand']=_0x556f61;if(_0x33d921[_0x8e19('0x24')](_0x8e19('0x25'))){_0x33d921[_0x8e19('0x26')]=parseInt(_0x33d921['retry'],0xa);}_0x56b5bf[_0x8e19('0x27')](_[_0x8e19('0x28')](_0x33d921,_0x8e19('0x29')));}function initGraph(_0x35e5a5,_0x16ad8d){var _0x406d21=new Graph();for(var _0x49314a in _0x35e5a5){if(_0x35e5a5[_0x8e19('0x24')](_0x49314a)){if(_[_0x8e19('0x2a')](_0x35e5a5[_0x49314a])){for(var _0x25dd6b=0x0;_0x25dd6b<_0x35e5a5[_0x49314a][_0x8e19('0x2b')];_0x25dd6b+=0x1){addVertex(_0x406d21,_0x35e5a5[_0x49314a][_0x25dd6b],_0x49314a);}}else{addVertex(_0x406d21,_0x35e5a5[_0x49314a],_0x49314a);}}}for(var _0x551feb=0x0;_0x551feb<_0x16ad8d[_0x8e19('0x2b')];_0x551feb+=0x1){if(_0x16ad8d[_0x551feb][_0x8e19('0x2c')]&&_0x16ad8d[_0x551feb]['target']){_0x406d21['addEdge'](_0x16ad8d[_0x551feb][_0x8e19('0x2c')],_0x16ad8d[_0x551feb][_0x8e19('0x2d')],_0x16ad8d[_0x551feb][_0x8e19('0x2e')]);}}return _0x406d21;}function getSquareProject(_0x343e9d,_0x3195a8){rpc[_0x8e19('0x2f')](_0x343e9d)['then'](function(_0x5b53b2){_0x3195a8(null,_0x5b53b2);})[_0x8e19('0x30')](function(_0x5e0cf7){_0x3195a8(null,_0x5e0cf7);});}function createSquareReport(_0xb99bbe,_0x13010b){rpc[_0x8e19('0x31')](_0xb99bbe)[_0x8e19('0x32')](function(_0x5693c1){if(_0x13010b){_0x13010b(null,_0x5693c1);}})[_0x8e19('0x30')](function(_0x1b8b1d){if(_0x13010b){_0x13010b(null,_0x1b8b1d);}});}function setChannelVariables(_0x5aef26){for(var _0x4bf173 in _0x5aef26){if(_0x5aef26[_0x8e19('0x24')](_0x4bf173)){if(_0x4bf173[_0x8e19('0x33')](_0x8e19('0x34'))===0x0){_0x5aef26[_0x4bf173[_0x8e19('0x35')](0x4)]=_0x5aef26[_0x4bf173];delete _0x5aef26[_0x4bf173];}}}}function getLogFromObject(_0x457024){return util[_0x8e19('0x36')](_0x457024,{'showHidden':![],'depth':null});}function agiHandler(_0x264a65){var _0x11d6ac,_0x4b0f3f,_0x46a38c,_0xa4a108,_0x5e880a;logger[_0x8e19('0x37')](_0x8e19('0x38'),JSON[_0x8e19('0x39')](_0x264a65,null,0x2));logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x3a'),_0x264a65[_0x8e19('0x1e')],_0x264a65['calleridname'],_0x264a65[_0x8e19('0x1a')],_0x264a65[_0x8e19('0x1b')],_0x264a65[_0x8e19('0x1c')]));_0x264a65['on'](_0x8e19('0xd'),errorHandler);_0x264a65['on'](_0x8e19('0x3b'),closeHandler);_0x264a65['on'](_0x8e19('0x3c'),timeoutHandler);_0x264a65[_0x8e19('0x20')]=![];_0x264a65['on'](_0x8e19('0x3d'),hangupHandler);var _0x15e4e6=getSquareProject[_0x8e19('0x3e')](null,_0x264a65[_0x8e19('0x1e')]);if(_0x15e4e6){if(_0x15e4e6[_0x8e19('0x3f')]){_0x11d6ac=getRoot(_0x15e4e6['production']);if(_0x11d6ac&&_0x11d6ac[_0x8e19('0x40')]){logger['debug']('root',JSON['stringify'](_0x11d6ac,null,0x2));_0x264a65['joinAt']=moment()[_0x8e19('0x12')](_0x8e19('0x41'));_0x4b0f3f=initGraph(_[_0x8e19('0x28')](_0x11d6ac,_0x8e19('0x29')),_0x11d6ac['mxCell']);_0x46a38c=new Vertices(_0x264a65,rpc,mailRpc);logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x42'),_0x264a65[_0x8e19('0x1e')],_0x264a65[_0x8e19('0x19')],_0x264a65[_0x8e19('0x1a')],_0x264a65['dnid'],_0x264a65['uniqueid']));_0x4b0f3f[_0x8e19('0x43')](_0x11d6ac[_0x8e19('0x40')]['id'],function(_0x7b0bd){try{_0x7b0bd=_0x46a38c[_0x8e19('0x44')](_0x7b0bd);logger['debug'](_0x8e19('0x45'),JSON[_0x8e19('0x39')](_0x7b0bd,null,0x2));if(_0x7b0bd['agicommand']===_0x8e19('0x46')){logger[_0x8e19('0x11')](_0x8e19('0x47'));_0x264a65['context']=_0x7b0bd['context']||_0x264a65[_0x8e19('0x48')];_0x264a65[_0x8e19('0x49')]=_0x7b0bd[_0x8e19('0x49')];_0x264a65['priority']=_0x7b0bd[_0x8e19('0x4a')]?_0x7b0bd[_0x8e19('0x4a')]-0x1:0x1;return null;}else if(_0x7b0bd&&_0x46a38c[_0x7b0bd[_0x8e19('0x4b')]]){_0x5e880a=_0x46a38c[_0x7b0bd[_0x8e19('0x4b')]](_0x7b0bd);logger['info'](_0x8e19('0x4c'),JSON[_0x8e19('0x39')](_0x5e880a,null,0x2));if(_0x5e880a&&_0x5e880a[_0x8e19('0x4d')]===AGI_CODE_SUCCESS&&_0x5e880a[_0x8e19('0x4e')]!==AGI_RESULT_ERROR&&!_0x264a65['evtHangup']){logger[_0x8e19('0x37')](_0x8e19('0x4c'),getLogFromObject(_0x5e880a));return _[_0x8e19('0x4f')](_0x5e880a[_0x8e19('0x4e')])?null:_0x5e880a[_0x8e19('0x4e')][_0x8e19('0x50')]();}else{logger[_0x8e19('0xd')](_0x8e19('0x4c'),getLogFromObject(_0x5e880a));return null;}}else{logger[_0x8e19('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x446b7b){logger['error'](_0x446b7b[_0x8e19('0xe')]);return null;}});if(_0x11d6ac[_0x8e19('0x51')]){logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x52'),_0x264a65[_0x8e19('0x1e')],_0x264a65[_0x8e19('0x19')],_0x264a65[_0x8e19('0x1a')],_0x264a65['dnid'],_0x264a65[_0x8e19('0x1c')]));_0x4b0f3f[_0x8e19('0x43')](_0x11d6ac[_0x8e19('0x51')]['id'],function(_0x477cb6){try{_0x477cb6=_0x46a38c[_0x8e19('0x44')](_0x477cb6);logger[_0x8e19('0x37')](_0x8e19('0x45'),JSON[_0x8e19('0x39')](_0x477cb6,null,0x2));if(_0x477cb6&&_0x46a38c[_0x477cb6[_0x8e19('0x4b')]]){_0x5e880a=_0x46a38c[_0x477cb6['agicommand']](_0x477cb6);if(_0x5e880a){logger[_0x8e19('0x37')](_0x8e19('0x4c'),getLogFromObject(_0x5e880a));return _[_0x8e19('0x4f')](_0x5e880a[_0x8e19('0x4e')])?null:_0x5e880a[_0x8e19('0x4e')][_0x8e19('0x50')]();}else{logger[_0x8e19('0xd')]('response',getLogFromObject(_0x5e880a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x22f71b){logger[_0x8e19('0xd')](_0x22f71b[_0x8e19('0xe')]);return null;}});}logger[_0x8e19('0x11')](util[_0x8e19('0x12')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x264a65[_0x8e19('0x1e')],_0x264a65[_0x8e19('0x19')],_0x264a65[_0x8e19('0x1a')],_0x264a65[_0x8e19('0x1b')],_0x264a65[_0x8e19('0x1c')]));logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x53'),_0x264a65['context'],_0x264a65['extension'],parseInt(_0x264a65[_0x8e19('0x4a')],0xa)+0x1));_0x264a65[_0x8e19('0x54')](_0x264a65[_0x8e19('0x48')],_0x264a65[_0x8e19('0x49')],parseInt(_0x264a65[_0x8e19('0x4a')],0xa)+0x1);_0x264a65[_0x8e19('0x3b')]();}}else{logger[_0x8e19('0xd')](util[_0x8e19('0x12')](_0x8e19('0x55'),_0x264a65[_0x8e19('0x1e')]));_0x264a65[_0x8e19('0x54')](_0x264a65[_0x8e19('0x48')],_0x264a65[_0x8e19('0x49')],parseInt(_0x264a65[_0x8e19('0x4a')],0xa)+0x1);_0x264a65[_0x8e19('0x3b')]();}}else{logger[_0x8e19('0xd')](util[_0x8e19('0x12')](_0x8e19('0x56'),_0x264a65['arg_1']));_0x264a65['continueAt'](_0x264a65[_0x8e19('0x48')],_0x264a65[_0x8e19('0x49')],parseInt(_0x264a65['priority'],0xa)+0x1);_0x264a65[_0x8e19('0x3b')]();}}function main(){var _0x48edb1;return utilLicense[_0x8e19('0x57')]()['then'](function(_0x2d84b5){if(_0x2d84b5){if(_0x2d84b5[_0x8e19('0x58')]){if(_0x2d84b5[_0x8e19('0x59')]&&_0x2d84b5[_0x8e19('0x59')]>0x0){logger[_0x8e19('0x11')](util[_0x8e19('0x12')](_0x8e19('0x5a'),_0x2d84b5[_0x8e19('0x59')]));_0x48edb1=_0x2d84b5['callysquare'];}else{logger[_0x8e19('0x11')](_0x8e19('0x5b'));}}else{logger[_0x8e19('0x11')](_0x8e19('0x5c'));_0x48edb1=-0x1;}}})[_0x8e19('0x30')](function(_0x4c30ac){logger[_0x8e19('0xd')]('[LICENSE]',_0x4c30ac[_0x8e19('0xe')]);})[_0x8e19('0x51')](function(){var _0x114227=require(_0x8e19('0x5d'))(config['agi']['port'],config[_0x8e19('0x5')]['ip'],_0x48edb1);_0x114227['on']('error',errorHandler);_0x114227['on'](_0x8e19('0x5e'),listeningHandler);_0x114227['on'](_0x8e19('0x5f'),connectionHandler);_0x114227['on'](_0x8e19('0x3b'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index d0ccaa4..98a06dd 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x279477,_0x490470){var _0x354a01=function(_0x30f38f){while(--_0x30f38f){_0x279477['push'](_0x279477['shift']());}};_0x354a01(++_0x490470);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x34d717,_0x4f9431){var _0x50b8cc=function(_0x263986){while(--_0x263986){_0x34d717['push'](_0x34d717['shift']());}};_0x50b8cc(++_0x4f9431);}(_0x814b,0x1a2));var _0xb814=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0x814b[_0x146837];return _0x3d7e60;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 760feee..ab36f27 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x530804,_0x44e860){_0x530804=_0x530804-0x0;var _0x3c0f69=_0xb10b[_0x530804];return _0x3c0f69;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3df93e,_0x5af13a){var _0x2d4f2a=function(_0x14c85c){while(--_0x14c85c){_0x3df93e['push'](_0x3df93e['shift']());}};_0x2d4f2a(++_0x5af13a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d0a2c,_0x2e4ef8){_0x2d0a2c=_0x2d0a2c-0x0;var _0xda6457=_0x5f2f[_0x2d0a2c];return _0xda6457;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0feb9be..89e1073 100644 --- a/server/services/agi/rpc/index.js +++ b/server/services/agi/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc90=['ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','http','request','then','message','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Intervals','getSmsAccountById'];(function(_0x421eb3,_0x28301b){var _0x184acb=function(_0x62a13e){while(--_0x62a13e){_0x421eb3['push'](_0x421eb3['shift']());}};_0x184acb(++_0x28301b);}(_0xbc90,0xee));var _0x0bc9=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xbc90[_0x16d10f];return _0x50c823;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0bc9('0x0'));var _=require(_0x0bc9('0x1'));var util=require('util');var jayson=require(_0x0bc9('0x2'));var client=jayson[_0x0bc9('0x3')][_0x0bc9('0x4')]({'port':0x2329});function request(_0x4b14eb,_0x319a2c){return new BPromise(function(_0x26690b,_0x182910){return client[_0x0bc9('0x5')](_0x4b14eb,_0x319a2c)[_0x0bc9('0x6')](function(_0x430e6f){if(_0x430e6f['error']){return _0x182910(_0x430e6f['error'][_0x0bc9('0x7')]);}else{return _0x26690b(_0x430e6f[_0x0bc9('0x8')]);}})['catch'](function(_0xd18150){return _0x182910(_0xd18150);});});}exports[_0x0bc9('0x9')]=function(_0xcef4e2){return request(_0x0bc9('0xa'),{'options':{'raw':![],'where':{'name':_0xcef4e2},'attributes':['production']}});};exports[_0x0bc9('0xb')]=function(_0x40f446){return request(_0x0bc9('0xc'),{'options':{'raw':![],'where':{'id':_0x40f446},'include':[{'model':_0x0bc9('0xd'),'as':_0x0bc9('0xe')}],'attributes':['id',_0x0bc9('0xf'),_0x0bc9('0x10')]}});};exports[_0x0bc9('0x11')]=function(_0x4a791b){return request('ShowSquareProject',{'options':{'where':{'id':_0x4a791b},'attributes':['name']}});};exports[_0x0bc9('0x12')]=function(_0x53bba5){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x53bba5},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x13')]=function(_0x50a62f){return request('ShowVariable',{'options':{'where':{'id':_0x50a62f},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x14')]=function(_0x2a08f7){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2a08f7},'attributes':[_0x0bc9('0x15')]}});};exports[_0x0bc9('0x16')]=function(_0x3b0b33){return request(_0x0bc9('0x17'),{'options':{'where':{'id':_0x3b0b33},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x18')]=function(_0x8fed32){return request(_0x0bc9('0x19'),{'options':{'where':{'id':_0x8fed32},'attributes':['name']}});};exports[_0x0bc9('0x1a')]=function(_0x2f9781){return request(_0x0bc9('0x1b'),{'options':{'where':{'id':_0x2f9781},'attributes':[_0x0bc9('0x1c')]}});};exports[_0x0bc9('0x1d')]=function(_0x7aaea3){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x7aaea3},'include':[{'model':'Interval','as':_0x0bc9('0x1e')}]}});};exports[_0x0bc9('0x1f')]=function(_0x196a36){return request(_0x0bc9('0x20'),{'options':{'where':{'id':_0x196a36},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x596273){return request(_0x0bc9('0x21'),{'body':_0x596273});};exports[_0x0bc9('0x22')]=function(_0x2f49ac){return request(_0x0bc9('0x23'),{'body':_0x2f49ac});};exports[_0x0bc9('0x24')]=function(_0x353260){return request('CreateSquareReport',{'body':_[_0x0bc9('0x25')](_0x353260,{'project_name':_0x353260[_0x0bc9('0x26')],'prev_project_name':_0x353260['arg_2']||'','is_subproject':_0x353260['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x0bc9('0x27'))})});};exports[_0x0bc9('0x28')]=function(_0x50651f){return request('CreateSquareRecording',{'body':_0x50651f});};exports[_0x0bc9('0x29')]=function(_0xc93fda){return request(_0x0bc9('0x2a'),{'body':_0xc93fda});};exports[_0x0bc9('0x2b')]=function(_0x4709e2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4709e2['phone'],'ListId':_0x4709e2[_0x0bc9('0x2c')]}}})[_0x0bc9('0x6')](function(_0x5bc986){if(_0x5bc986){return _0x5bc986;}return request(_0x0bc9('0x2d'),{'body':_0x4709e2});});};exports[_0x0bc9('0x2e')]=function(_0x59b986){return request(_0x0bc9('0x2f'),{'options':{'where':{'id':_0x59b986},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x30')]=function(_0x126ed5,_0xc09b02){return request('LoginUser',{'body':{'interface':_0xc09b02},'options':{'where':_0x126ed5}});};exports[_0x0bc9('0x31')]=function(_0x39bca1,_0x2f02c0,_0xaa4f0c){return request(_0x0bc9('0x32'),{'body':{'type':_0x2f02c0,'uniqueid':_0xaa4f0c},'options':{'where':_0x39bca1}});};exports['agentUnpause']=function(_0x348687){return request(_0x0bc9('0x33'),{'body':{},'options':{'where':_0x348687}});};exports[_0x0bc9('0x34')]=function(_0x4c5393){return request(_0x0bc9('0x35'),{'body':{},'options':{'where':_0x4c5393}});}; \ No newline at end of file +var _0x1ef8=['production','getMailAccountById','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','request','then','error','message','result','catch','ShowSquareProject'];(function(_0x4b1eae,_0x59193e){var _0x5ada20=function(_0x4b6826){while(--_0x4b6826){_0x4b1eae['push'](_0x4b1eae['shift']());}};_0x5ada20(++_0x59193e);}(_0x1ef8,0xa2));var _0x81ef=function(_0x3d091e,_0x3540e4){_0x3d091e=_0x3d091e-0x0;var _0x26998a=_0x1ef8[_0x3d091e];return _0x26998a;};'use strict';var BPromise=require(_0x81ef('0x0'));var moment=require(_0x81ef('0x1'));var _=require('lodash');var util=require(_0x81ef('0x2'));var jayson=require(_0x81ef('0x3'));var client=jayson[_0x81ef('0x4')]['http']({'port':0x2329});function request(_0x55169b,_0x693662){return new BPromise(function(_0x5e64ab,_0x305bc2){return client[_0x81ef('0x5')](_0x55169b,_0x693662)[_0x81ef('0x6')](function(_0x368f16){if(_0x368f16['error']){return _0x305bc2(_0x368f16[_0x81ef('0x7')][_0x81ef('0x8')]);}else{return _0x5e64ab(_0x368f16[_0x81ef('0x9')]);}})[_0x81ef('0xa')](function(_0x1adaa3){return _0x305bc2(_0x1adaa3);});});}exports['getSquareProject']=function(_0x3842b6){return request(_0x81ef('0xb'),{'options':{'raw':![],'where':{'name':_0x3842b6},'attributes':[_0x81ef('0xc')]}});};exports[_0x81ef('0xd')]=function(_0x30784d){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x30784d},'include':[{'model':_0x81ef('0xe'),'as':_0x81ef('0xf')}],'attributes':['id',_0x81ef('0x10'),'email']}});};exports[_0x81ef('0x11')]=function(_0x2d683a){return request('ShowSquareProject',{'options':{'where':{'id':_0x2d683a},'attributes':['name']}});};exports[_0x81ef('0x12')]=function(_0x2a787b){return request(_0x81ef('0x13'),{'options':{'where':{'id':_0x2a787b},'attributes':[_0x81ef('0x10')]}});};exports[_0x81ef('0x14')]=function(_0x17ecd3){return request(_0x81ef('0x15'),{'options':{'where':{'id':_0x17ecd3},'attributes':[_0x81ef('0x10')]}});};exports[_0x81ef('0x16')]=function(_0x516a10){return request(_0x81ef('0x17'),{'options':{'where':{'id':_0x516a10},'attributes':[_0x81ef('0x18')]}});};exports[_0x81ef('0x19')]=function(_0x4b8d0e){return request('ShowUser',{'options':{'where':{'id':_0x4b8d0e},'attributes':['name']}});};exports['getTrunkById']=function(_0x1bf6d0){return request('ShowTrunk',{'options':{'where':{'id':_0x1bf6d0},'attributes':[_0x81ef('0x10')]}});};exports[_0x81ef('0x1a')]=function(_0x26954a){return request('ShowSound',{'options':{'where':{'id':_0x26954a},'attributes':[_0x81ef('0x1b')]}});};exports[_0x81ef('0x1c')]=function(_0x2a09d5){return request(_0x81ef('0x1d'),{'options':{'raw':![],'where':{'id':_0x2a09d5},'include':[{'model':_0x81ef('0x1e'),'as':_0x81ef('0x1f')}]}});};exports[_0x81ef('0x20')]=function(_0x139378){return request(_0x81ef('0x21'),{'options':{'where':{'id':_0x139378},'attributes':['id',_0x81ef('0x10')]}});};exports[_0x81ef('0x22')]=function(_0x6469b){return request(_0x81ef('0x23'),{'body':_0x6469b});};exports[_0x81ef('0x24')]=function(_0x3f8803){return request('CreateSquareDetailsReport',{'body':_0x3f8803});};exports['createSquareReport']=function(_0x36a6c7){return request('CreateSquareReport',{'body':_[_0x81ef('0x25')](_0x36a6c7,{'project_name':_0x36a6c7[_0x81ef('0x26')],'prev_project_name':_0x36a6c7[_0x81ef('0x27')]||'','is_subproject':_0x36a6c7[_0x81ef('0x27')]?!![]:![],'leaveAt':moment()['format'](_0x81ef('0x28'))})});};exports[_0x81ef('0x29')]=function(_0x227aba){return request(_0x81ef('0x2a'),{'body':_0x227aba});};exports[_0x81ef('0x2b')]=function(_0x131b11){return request(_0x81ef('0x2c'),{'body':_0x131b11});};exports[_0x81ef('0x2d')]=function(_0x40cd12){return request(_0x81ef('0x2e'),{'options':{'raw':![],'where':{'phone':_0x40cd12[_0x81ef('0x2f')],'ListId':_0x40cd12[_0x81ef('0x30')]}}})[_0x81ef('0x6')](function(_0x23f817){if(_0x23f817){return _0x23f817;}return request(_0x81ef('0x31'),{'body':_0x40cd12});});};exports[_0x81ef('0x32')]=function(_0x40d748){return request(_0x81ef('0x33'),{'options':{'where':{'id':_0x40d748},'attributes':['name']}});};exports[_0x81ef('0x34')]=function(_0x49d98b,_0x370632){return request(_0x81ef('0x35'),{'body':{'interface':_0x370632},'options':{'where':_0x49d98b}});};exports['agentPause']=function(_0x55bca0,_0x56efab,_0x175d71){return request(_0x81ef('0x36'),{'body':{'type':_0x56efab,'uniqueid':_0x175d71},'options':{'where':_0x55bca0}});};exports[_0x81ef('0x37')]=function(_0x3696b0){return request('UnpauseUser',{'body':{},'options':{'where':_0x3696b0}});};exports[_0x81ef('0x38')]=function(_0x12a90c){return request(_0x81ef('0x39'),{'body':{},'options':{'where':_0x12a90c}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 8778ab3..36a28d7 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5636=['./polly','./lex'];(function(_0x3b2746,_0x10e4e9){var _0x3ce071=function(_0x2ea00c){while(--_0x2ea00c){_0x3b2746['push'](_0x3b2746['shift']());}};_0x3ce071(++_0x10e4e9);}(_0x5636,0x102));var _0x6563=function(_0x48db36,_0xd7ba4d){_0x48db36=_0x48db36-0x0;var _0x3cca1d=_0x5636[_0x48db36];return _0x3cca1d;};var polly=require(_0x6563('0x0'));var lex=require(_0x6563('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xda55=['./lex','./polly'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda55,0x6d));var _0x5da5=function(_0x48a509,_0x30df45){_0x48a509=_0x48a509-0x0;var _0x4155e9=_0xda55[_0x48a509];return _0x4155e9;};var polly=require(_0x5da5('0x0'));var lex=require(_0x5da5('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 69d1ff8..34130de 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9567=['./lib/api','exports'];(function(_0x3040cf,_0x2709bb){var _0x373fb4=function(_0x3d4e27){while(--_0x3d4e27){_0x3040cf['push'](_0x3040cf['shift']());}};_0x373fb4(++_0x2709bb);}(_0x9567,0xdc));var _0x7956=function(_0x3feb17,_0xd4558b){_0x3feb17=_0x3feb17-0x0;var _0x15164a=_0x9567[_0x3feb17];return _0x15164a;};'use strict';var lex=require(_0x7956('0x0'));module[_0x7956('0x1')]=function(_0x4311ba,_0x59c14e,_0x4459ae,_0x50169f,_0x4da79a,_0x1f51a7){return lex(_0x4311ba,_0x59c14e,_0x4459ae,_0x50169f,_0x4da79a,_0x1f51a7);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x7aa5f9,_0xd38168,_0x304285,_0x586c8f,_0x130341,_0x4b6d75){return lex(_0x7aa5f9,_0xd38168,_0x304285,_0x586c8f,_0x130341,_0x4b6d75);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index f3abb52..0d10109 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4db7=['postText','slots','slot_','$LATEST','bluebird','aws-sdk'];(function(_0x23a3d3,_0x3d06e6){var _0x588ad7=function(_0x5275df){while(--_0x5275df){_0x23a3d3['push'](_0x23a3d3['shift']());}};_0x588ad7(++_0x3d06e6);}(_0x4db7,0x178));var _0x74db=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4db7[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x74db('0x0'));var AWS=require(_0x74db('0x1'));function lexResult(_0x378644,_0x2f9051){return new BPromise(function(_0x31b103,_0x5ffed3){_0x378644[_0x74db('0x2')](_0x2f9051,function(_0x1038e8,_0x56e74e){if(_0x1038e8){_0x5ffed3(_0x1038e8);}if(_0x56e74e['slots']){for(const _0x35d0dc in _0x56e74e['slots']){if(_0x56e74e[_0x74db('0x3')]['hasOwnProperty'](_0x35d0dc)){var _0x2f222c=_0x56e74e[_0x74db('0x3')][_0x35d0dc];_0x56e74e[_0x74db('0x4')+_0x35d0dc]=_0x2f222c;}}}_0x31b103(_0x56e74e);});});}module['exports']=function(_0x4bbad6,_0x2b3ba0,_0x5a335c,_0xa4e9e6,_0x529629,_0x145215){var _0x32f26f=new AWS['LexRuntime']({'accessKeyId':_0x2b3ba0,'secretAccessKey':_0x5a335c,'region':_0xa4e9e6});var _0x23aeb1={'botAlias':_0x74db('0x5'),'botName':_0x145215,'inputText':_0x529629,'userId':_0x4bbad6};return lexResult(_0x32f26f,_0x23aeb1);}; \ No newline at end of file +var _0xfac2=['exports','LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfac2,0xd4));var _0x2fac=function(_0x3a1084,_0x359566){_0x3a1084=_0x3a1084-0x0;var _0x106443=_0xfac2[_0x3a1084];return _0x106443;};'use strict';var BPromise=require(_0x2fac('0x0'));var AWS=require(_0x2fac('0x1'));function lexResult(_0x2867fa,_0x32f57d){return new BPromise(function(_0x2318f0,_0x533555){_0x2867fa['postText'](_0x32f57d,function(_0xbecfc3,_0x27f403){if(_0xbecfc3){_0x533555(_0xbecfc3);}if(_0x27f403[_0x2fac('0x2')]){for(const _0x5c30ea in _0x27f403[_0x2fac('0x2')]){if(_0x27f403[_0x2fac('0x2')][_0x2fac('0x3')](_0x5c30ea)){var _0x1b57d3=_0x27f403[_0x2fac('0x2')][_0x5c30ea];_0x27f403['slot_'+_0x5c30ea]=_0x1b57d3;}}}_0x2318f0(_0x27f403);});});}module[_0x2fac('0x4')]=function(_0x4c1028,_0x5acaea,_0x5b4b54,_0x1b3119,_0x1d8509,_0x68b8bd){var _0x57d3d2=new AWS[(_0x2fac('0x5'))]({'accessKeyId':_0x5acaea,'secretAccessKey':_0x5b4b54,'region':_0x1b3119});var _0x53ba7b={'botAlias':'$LATEST','botName':_0x68b8bd,'inputText':_0x1d8509,'userId':_0x4c1028};return lexResult(_0x57d3d2,_0x53ba7b);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 28dbbdb..fdc1e96 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa01=['./lib/api'];(function(_0x37cc6a,_0x578bd9){var _0x51cfeb=function(_0x1cde5e){while(--_0x1cde5e){_0x37cc6a['push'](_0x37cc6a['shift']());}};_0x51cfeb(++_0x578bd9);}(_0xfa01,0x93));var _0x1fa0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa01[_0x20a584];return _0x4b41a8;};'use strict';var polly=require(_0x1fa0('0x0'));module['exports']=function(_0xbd1af6,_0x9d087b,_0x1f449c,_0x545318,_0x516609,_0x4b7636,_0x1512cf){return polly(_0xbd1af6,_0x9d087b,_0x1f449c,_0x545318,_0x516609,_0x4b7636,_0x1512cf);}; \ No newline at end of file +var _0xb7dc=['exports','./lib/api'];(function(_0x2e12c8,_0xfcd43b){var _0xc871b0=function(_0x3b6ca6){while(--_0x3b6ca6){_0x2e12c8['push'](_0x2e12c8['shift']());}};_0xc871b0(++_0xfcd43b);}(_0xb7dc,0x1e3));var _0xcb7d=function(_0x11db1e,_0x327836){_0x11db1e=_0x11db1e-0x0;var _0x34c39b=_0xb7dc[_0x11db1e];return _0x34c39b;};'use strict';var polly=require(_0xcb7d('0x0'));module[_0xcb7d('0x1')]=function(_0x155999,_0x3c4792,_0x4b2cac,_0xb60988,_0xa8a06,_0x23dab4,_0x44ef9f){return polly(_0x155999,_0x3c4792,_0x4b2cac,_0xb60988,_0xa8a06,_0x23dab4,_0x44ef9f);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 20c45c4..f7c210c 100644 --- a/server/services/agi/scripts/aws/polly/lib/api.js +++ b/server/services/agi/scripts/aws/polly/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x655b=['writeFile','exports','text','path','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x1a1128,_0x1784d8){var _0x1f5bd2=function(_0x8e0c15){while(--_0x8e0c15){_0x1a1128['push'](_0x1a1128['shift']());}};_0x1f5bd2(++_0x1784d8);}(_0x655b,0x1cb));var _0xb655=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x655b[_0x334841];return _0x5beb4b;};'use strict';var fs=require('fs');var path=require(_0xb655('0x0'));var BPromise=require(_0xb655('0x1'));var rs=require(_0xb655('0x2'));var AWS=require(_0xb655('0x3'));function pollyResult(_0x212caa,_0x4b6631,_0x5e5e39){return new BPromise(function(_0x2ca2da,_0x237a89){_0x212caa['synthesizeSpeech'](_0x4b6631,function(_0x427638,_0xf6e0ff){if(_0x427638){_0x237a89(_0x427638);}else if(_0xf6e0ff){if(_0xf6e0ff[_0xb655('0x4')]instanceof Buffer){fs[_0xb655('0x5')](_0x5e5e39,_0xf6e0ff[_0xb655('0x4')],function(_0x10fce8){if(_0x10fce8){_0x237a89(_0x10fce8);}else{_0x2ca2da();}});}else{_0x237a89(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x237a89(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xb655('0x6')]=function(_0x52a105,_0x8d9cc4,_0x22c16f,_0x5752f0,_0x18fd45,_0x5c848e,_0xaf5079){var _0x28e38c=new AWS['Polly']({'accessKeyId':_0x52a105,'secretAccessKey':_0x8d9cc4,'region':_0x22c16f});var _0x27ff2b={'Text':_0x18fd45,'TextType':_0x5c848e||_0xb655('0x7'),'OutputFormat':'mp3','VoiceId':_0x5752f0};return pollyResult(_0x28e38c,_0x27ff2b,_0xaf5079);}; \ No newline at end of file +var _0xaae0=['aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','bluebird','randomstring'];(function(_0x383f7f,_0x3eadf4){var _0x3a38de=function(_0xd022db){while(--_0xd022db){_0x383f7f['push'](_0x383f7f['shift']());}};_0x3a38de(++_0x3eadf4);}(_0xaae0,0x1d6));var _0x0aae=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xaae0[_0x40a045];return _0x1a687c;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x0aae('0x0'));var rs=require(_0x0aae('0x1'));var AWS=require(_0x0aae('0x2'));function pollyResult(_0xef7951,_0x51570d,_0x411ce1){return new BPromise(function(_0x4a38d5,_0x41f412){_0xef7951['synthesizeSpeech'](_0x51570d,function(_0xa6c5ea,_0x3e5112){if(_0xa6c5ea){_0x41f412(_0xa6c5ea);}else if(_0x3e5112){if(_0x3e5112[_0x0aae('0x3')]instanceof Buffer){fs[_0x0aae('0x4')](_0x411ce1,_0x3e5112[_0x0aae('0x3')],function(_0x3942f2){if(_0x3942f2){_0x41f412(_0x3942f2);}else{_0x4a38d5();}});}else{_0x41f412(new Error(_0x0aae('0x5')));}}else{_0x41f412(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x0aae('0x6')]=function(_0x5abdad,_0x4b2f37,_0x5919f4,_0x3cc32d,_0x77d9c2,_0x270fee,_0x88c281){var _0x2ce7ad=new AWS['Polly']({'accessKeyId':_0x5abdad,'secretAccessKey':_0x4b2f37,'region':_0x5919f4});var _0x413584={'Text':_0x77d9c2,'TextType':_0x270fee||_0x0aae('0x7'),'OutputFormat':'mp3','VoiceId':_0x3cc32d};return pollyResult(_0x2ce7ad,_0x413584,_0x88c281);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 8a2508e..77da94a 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33a4=['./lib/api','exports'];(function(_0x49870c,_0x4d2e2b){var _0x2c98f5=function(_0x32d62b){while(--_0x32d62b){_0x49870c['push'](_0x49870c['shift']());}};_0x2c98f5(++_0x4d2e2b);}(_0x33a4,0x1a6));var _0x433a=function(_0x6d0945,_0x4e8b4c){_0x6d0945=_0x6d0945-0x0;var _0xb027c=_0x33a4[_0x6d0945];return _0xb027c;};'use strict';var asr=require(_0x433a('0x0'));module[_0x433a('0x1')]=function(_0x42ae8c,_0x384d10,_0x161186,_0x161905){return asr(_0x42ae8c,_0x384d10,_0x161186);}; \ No newline at end of file +var _0x0bbe=['exports'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x0bbe,0x1db));var _0xe0bb=function(_0x9d90f,_0x4782a1){_0x9d90f=_0x9d90f-0x0;var _0x246e52=_0x0bbe[_0x9d90f];return _0x246e52;};'use strict';var asr=require('./lib/api');module[_0xe0bb('0x0')]=function(_0x599a12,_0x186aa6,_0x3dda6a,_0x3f4d14){return asr(_0x599a12,_0x186aa6,_0x3dda6a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 980a750..82b9dae 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70a7=['length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x5ca964,_0x1e1366){var _0x447a23=function(_0x5a53b7){while(--_0x5a53b7){_0x5ca964['push'](_0x5ca964['shift']());}};_0x447a23(++_0x1e1366);}(_0x70a7,0x113));var _0x770a=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x70a7[_0x1e6db3];return _0x1de886;};'use strict';var url=require(_0x770a('0x0'));var BPromise=require(_0x770a('0x1'));var fs=require('fs');var host=_0x770a('0x2');module[_0x770a('0x3')]=function(_0x213896,_0x57a410,_0x1dffe3){return new BPromise(function(_0x4dcdc2,_0x249ff2){var _0x460c67;if(typeof _0x213896!==_0x770a('0x4')||_0x213896[_0x770a('0x5')]===0x0){return _0x249ff2(_0x770a('0x6'));}if(typeof _0x57a410!==_0x770a('0x4')||_0x57a410[_0x770a('0x5')]===0x0){return _0x249ff2('key\x20should\x20be\x20a\x20string');}if(typeof _0x1dffe3!==_0x770a('0x7')&&(typeof _0x1dffe3!==_0x770a('0x4')||_0x1dffe3[_0x770a('0x5')]===0x0)){return _0x249ff2(_0x770a('0x8'));}try{_0x460c67=fs[_0x770a('0x9')](_0x213896)[_0x770a('0xa')]('base64');}catch(_0xd9e7e5){return _0x249ff2(_0xd9e7e5);}return _0x4dcdc2({'method':_0x770a('0xb'),'uri':host+_0x770a('0xc')+_0x57a410,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x770a('0xd'),'languageCode':_0x1dffe3},'audio':{'content':_0x460c67}},'json':!![]});});}; \ No newline at end of file +var _0x3d70=['filepath\x20should\x20be\x20a\x20string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x180c55,_0x351d11){var _0x608f4a=function(_0x2b48d8){while(--_0x2b48d8){_0x180c55['push'](_0x180c55['shift']());}};_0x608f4a(++_0x351d11);}(_0x3d70,0x1bc));var _0x03d7=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x3d70[_0x4394b6];return _0x360244;};'use strict';var url=require('url');var BPromise=require(_0x03d7('0x0'));var fs=require('fs');var host=_0x03d7('0x1');module[_0x03d7('0x2')]=function(_0x4a34cf,_0x48d4b5,_0x11e2c9){return new BPromise(function(_0xd28db2,_0x416a00){var _0x45d87e;if(typeof _0x4a34cf!==_0x03d7('0x3')||_0x4a34cf['length']===0x0){return _0x416a00(_0x03d7('0x4'));}if(typeof _0x48d4b5!==_0x03d7('0x3')||_0x48d4b5[_0x03d7('0x5')]===0x0){return _0x416a00('key\x20should\x20be\x20a\x20string');}if(typeof _0x11e2c9!==_0x03d7('0x6')&&(typeof _0x11e2c9!==_0x03d7('0x3')||_0x11e2c9['length']===0x0)){return _0x416a00(_0x03d7('0x7'));}try{_0x45d87e=fs[_0x03d7('0x8')](_0x4a34cf)[_0x03d7('0x9')](_0x03d7('0xa'));}catch(_0x25062c){return _0x416a00(_0x25062c);}return _0xd28db2({'method':_0x03d7('0xb'),'uri':host+_0x03d7('0xc')+_0x48d4b5,'body':{'config':{'encoding':_0x03d7('0xd'),'sampleRateHertz':'8000','languageCode':_0x11e2c9},'audio':{'content':_0x45d87e}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index be3b886..eb6aa12 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cb1=['./asr','exports'];(function(_0xd58679,_0x56a9cf){var _0x355220=function(_0x4f699b){while(--_0x4f699b){_0xd58679['push'](_0xd58679['shift']());}};_0x355220(++_0x56a9cf);}(_0x8cb1,0xf4));var _0x18cb=function(_0x258c9f,_0x376e01){_0x258c9f=_0x258c9f-0x0;var _0x2f716e=_0x8cb1[_0x258c9f];return _0x2f716e;};var asr=require(_0x18cb('0x0'));module[_0x18cb('0x1')]={'asr':asr}; \ No newline at end of file +var _0x171c=['exports','./asr'];(function(_0x442955,_0x410333){var _0x14f4b3=function(_0x3f0bc3){while(--_0x3f0bc3){_0x442955['push'](_0x442955['shift']());}};_0x14f4b3(++_0x410333);}(_0x171c,0x16d));var _0xc171=function(_0x57832a,_0x57673d){_0x57832a=_0x57832a-0x0;var _0x66c4fc=_0x171c[_0x57832a];return _0x66c4fc;};var asr=require(_0xc171('0x0'));module[_0xc171('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 6a76ea3..220909d 100644 --- a/server/services/agi/scripts/index.js +++ b/server/services/agi/scripts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e25=['google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','error','download\x20error','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','POST','.mp3','from','audioContent','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','data','writeFileSync','unlink','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','length','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','Data','audiofile','dirName','dialogflow','http','https','md5','querystring','sox'];(function(_0x5c96dd,_0x3017af){var _0x20416f=function(_0x30a54e){while(--_0x30a54e){_0x5c96dd['push'](_0x5c96dd['shift']());}};_0x20416f(++_0x3017af);}(_0x7e25,0x198));var _0x57e2=function(_0x25d6ce,_0x30d64a){_0x25d6ce=_0x25d6ce-0x0;var _0x1aef15=_0x7e25[_0x25d6ce];return _0x1aef15;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x57e2('0x0'));var fs=require('fs');var http=require(_0x57e2('0x1'));var https=require(_0x57e2('0x2'));var md5=require(_0x57e2('0x3'));var path=require('path');var querystring=require(_0x57e2('0x4'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x57e2('0x5'));var tts=require(_0x57e2('0x6'));var urlParse=require(_0x57e2('0x7'))[_0x57e2('0x8')];var util=require(_0x57e2('0x9'));var aws=require(_0x57e2('0xa'));var google=require(_0x57e2('0xb'));var sestek=require(_0x57e2('0xc'));var tilde=require(_0x57e2('0xd'));var logger=require(_0x57e2('0xe'))(_0x57e2('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5d37a1,_0x18e502){return new BPromise(function(_0x4eaa6f,_0x243dc6){var _0x79cf6c=urlParse(_0x5d37a1);var _0x538ad6=_0x79cf6c[_0x57e2('0x10')]===_0x57e2('0x11')?https:http;var _0x2be27a={'host':_0x79cf6c[_0x57e2('0x12')],'path':_0x79cf6c[_0x57e2('0x13')],'headers':{'user-agent':_0x57e2('0x14')}};_0x538ad6[_0x57e2('0x15')](_0x2be27a,function(_0x5789f6){if(_0x5789f6[_0x57e2('0x16')]!==0xc8){logger['error'](_0x57e2('0x17')+_0x5d37a1+_0x57e2('0x18')+_0x5789f6[_0x57e2('0x16')]+'\x20('+_0x5789f6[_0x57e2('0x19')]+')');_0x243dc6(new Error('request\x20to\x20'+_0x5d37a1+'\x20failed,\x20status\x20code\x20=\x20'+_0x5789f6['statusCode']+'\x20('+_0x5789f6['statusMessage']+')'));return;}var _0x45df18=fs[_0x57e2('0x1a')](_0x18e502);_0x45df18['on'](_0x57e2('0x1b'),function(){logger['info']('finish\x20download\x20file');_0x45df18[_0x57e2('0x1c')](_0x4eaa6f);});_0x45df18['on'](_0x57e2('0x1d'),function(_0x40b3c8){fs['unlink'](_0x18e502);logger[_0x57e2('0x1d')](_0x57e2('0x1e'),_0x40b3c8);_0x243dc6(_0x40b3c8);});_0x5789f6['pipe'](_0x45df18);})['on']('error',function(_0x29439a){logger[_0x57e2('0x1d')](_0x29439a);_0x243dc6(_0x29439a);})[_0x57e2('0x1f')]();});}function uploadFile(_0x17fdfb){return new BPromise(function(_0x4e5b4f,_0x13223f){var _0x467df2=urlParse(_0x17fdfb);var _0xd10de4=_0x467df2[_0x57e2('0x10')]===_0x57e2('0x11')?https:http;var _0x21ca3a={'host':_0x467df2['host'],'path':_0x467df2[_0x57e2('0x13')],'headers':{'user-agent':_0x57e2('0x14')}};_0xd10de4[_0x57e2('0x15')](_0x21ca3a,function(_0x3e1738){if(_0x3e1738[_0x57e2('0x16')]!==0xc8){_0x13223f(new Error(_0x57e2('0x17')+_0x17fdfb+_0x57e2('0x18')+_0x3e1738[_0x57e2('0x16')]+'\x20('+_0x3e1738[_0x57e2('0x19')]+')'));return;}var _0x1f3b11='';_0x3e1738['on']('data',function(_0x28935f){_0x1f3b11+=_0x28935f;});_0x3e1738['on'](_0x57e2('0x1f'),function(){_0x4e5b4f(_0x1f3b11);});})['on'](_0x57e2('0x1d'),function(_0x1fa492){_0x13223f(_0x1fa492);})['end']();});}function convertFile(_0x53ca9d,_0x529ffe){return new BPromise(function(_0x426d10,_0x5d5171){var _0x5768fa=sox[_0x57e2('0x20')](_0x53ca9d,_0x529ffe,{'sampleRate':0x1f40,'format':_0x57e2('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5768fa['on'](_0x57e2('0x1d'),function(_0x10f7ea){logger['error'](_0x57e2('0x22'),_0x10f7ea);_0x5d5171(_0x10f7ea);});_0x5768fa['on'](_0x57e2('0x1f'),function(){logger['info'](_0x57e2('0x23'));_0x426d10();});_0x5768fa[_0x57e2('0x24')]();});}function base64Decode(_0x28aa57,_0x571cd2){var _0x235c31=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28'));fs['writeFileSync'](_0x235c31,_0x28aa57,_0x57e2('0x29'));return convertFile(_0x235c31,_0x571cd2)[_0x57e2('0x2a')](function(){try{fs['unlink'](_0x235c31);fs[_0x57e2('0x2b')](_0x571cd2,_0x57e2('0x2c'));}catch(_0x300416){logger['error'](_0x300416);}return _0x571cd2[_0x57e2('0x2d')]('.')[0x0];});}function base64Encode(_0x559014){var _0x2aa888=fs[_0x57e2('0x2e')](_0x559014);return new Buffer(_0x2aa888)[_0x57e2('0x2f')]('base64');}exports[_0x57e2('0x30')]=function(_0xc36811,_0x50ff7c,_0x2a57e0,_0x4b6cdc,_0x4aebfb,_0x127886){var _0x2d09fa,_0x37e0e3;var _0x2fc8c5=_0x57e2('0x31');var _0xe9082e=_0x57e2('0x32')+_0xc36811;var _0x50fe2e={};if(_0x50ff7c==='ssml'){_0x50fe2e['input']={'ssml':_0x2a57e0};}else{_0x50fe2e[_0x57e2('0x33')]={'text':_0x2a57e0};};_0x50fe2e['voice']={'languageCode':_0x4b6cdc,'ssmlGender':_0x4aebfb};_0x50fe2e[_0x57e2('0x34')]={'audioEncoding':_0x57e2('0x35'),'sampleRateHertz':0x1f40};var _0x5b8d0e={'url':_0x2fc8c5+'text:synthesize'+_0xe9082e,'method':_0x57e2('0x36'),'json':!![],'body':_0x50fe2e};return rp(_0x5b8d0e)['then'](function(_0xbc198b){return new BPromise(function(_0x37dc58,_0x189603){_0x2d09fa=path[_0x57e2('0x25')](__dirname,'tmp',rs[_0x57e2('0x27')](0x4)+_0x57e2('0x37'));var _0x57a5d9=Buffer[_0x57e2('0x38')](_0xbc198b[_0x57e2('0x39')],_0x57e2('0x29'));return fs['writeFile'](_0x2d09fa,_0x57a5d9,function(_0x4df0a3){_0x189603(_0x4df0a3);},function(_0x262277){fs[_0x57e2('0x2b')](_0x2d09fa,_0x57e2('0x2c'));_0x37dc58(_0x262277);});});})[_0x57e2('0x2a')](function(_0x5b726f){_0x37e0e3=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28'));return convertFile(_0x2d09fa,_0x37e0e3);})[_0x57e2('0x2a')](function(){try{fs['unlink'](_0x2d09fa);fs['chmodSync'](_0x37e0e3,_0x57e2('0x2c'));}catch(_0x5b87e5){logger[_0x57e2('0x1d')](_0x5b87e5);}logger[_0x57e2('0x3a')](_0x57e2('0x3b'),_0x37e0e3['split']('.')[0x0]);return _0x37e0e3[_0x57e2('0x2d')]('.')[0x0];});};exports[_0x57e2('0x3c')]=function(_0x2b9d06,_0x342c71){var _0x175586=_0x57e2('0x3d');var _0x46c416,_0x41c5d7;var _0x2d36b6;var _0x15d027={'encoding':'utf8','method':_0x57e2('0x36'),'timeout':0x2710,'url':_0x175586,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x57e2('0x3e')+encodeURIComponent(JSON[_0x57e2('0x3f')]([[[_0x57e2('0x40'),JSON[_0x57e2('0x3f')]([_0x2b9d06,_0x342c71||'en',![],_0x57e2('0x41')]),null,_0x57e2('0x42')]]]))};return rp(_0x15d027)[_0x57e2('0x2a')](function(_0x115a98){try{_0x2d36b6=eval(_0x115a98[_0x57e2('0x43')](0x5))[0x0][0x2];}catch(_0x2174dc){throw new Error(_0x57e2('0x44')+_0x115a98['data']);}if(!_0x2d36b6){if(_0x2b9d06['length']>0xc8){throw new Error(_0x57e2('0x45'));}else{throw new Error(_0x57e2('0x46')+_0x342c71+_0x57e2('0x47'));}}try{_0x2d36b6=eval(_0x2d36b6)[0x0];}catch(_0x338b0e){throw new Error(_0x57e2('0x44')+res[_0x57e2('0x48')]);}const _0x333e44=_0x2d36b6;_0x46c416=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs['generate'](0x4)+_0x57e2('0x37'));fs[_0x57e2('0x49')](_0x46c416,_0x2d36b6,{'encoding':_0x57e2('0x29')});_0x41c5d7=path['resolve'](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28'));return convertFile(_0x46c416,_0x41c5d7);})['then'](function(){try{fs[_0x57e2('0x4a')](_0x46c416);fs['chmodSync'](_0x41c5d7,'777');}catch(_0x5cfafe){logger[_0x57e2('0x1d')](_0x5cfafe);}logger[_0x57e2('0x3a')](_0x57e2('0x4b'),_0x41c5d7[_0x57e2('0x2d')]('.')[0x0]);return _0x41c5d7['split']('.')[0x0];});};exports[_0x57e2('0x4c')]=function(_0x4eb58c,_0x2ac07e,_0x187009){return google[_0x57e2('0x4d')](_0x4eb58c,_0x2ac07e,_0x187009)[_0x57e2('0x2a')](function(_0x15dda5){logger[_0x57e2('0x3a')](_0x15dda5[_0x57e2('0x4e')]);return rp(_0x15dda5);})[_0x57e2('0x2a')](function(_0x27106e){var _0x57cf54='';var _0x4e752d=0x0;try{fs['unlink'](_0x4eb58c);}catch(_0x752096){logger['error'](_0x752096);}if(_0x27106e&&_0x27106e[_0x57e2('0x4f')]){_0x57cf54=_0x27106e[_0x57e2('0x4f')][_0x57e2('0x50')](function(_0x4c4a5c){return _0x4c4a5c&&_0x4c4a5c[_0x57e2('0x51')][0x0]&&_0x4c4a5c['alternatives'][0x0][_0x57e2('0x52')]?_0x4c4a5c[_0x57e2('0x51')][0x0][_0x57e2('0x52')]:'';})[_0x57e2('0x53')]('\x0a');_0x4e752d=_0x27106e[_0x57e2('0x4f')][_0x57e2('0x50')](function(_0x3de6df){return _0x3de6df&&_0x3de6df['alternatives'][0x0]&&_0x3de6df[_0x57e2('0x51')][0x0][_0x57e2('0x54')]?_0x3de6df[_0x57e2('0x51')][0x0][_0x57e2('0x54')]:0x0;})[_0x57e2('0x53')]('\x0a');}logger[_0x57e2('0x3a')](_0x57e2('0x55'),_0x57cf54);logger[_0x57e2('0x3a')]('googleASR\x20confidence',_0x4e752d);return{'transcript':_0x57cf54,'confidence':_0x4e752d};})[_0x57e2('0x56')](function(_0x1dd40b){logger[_0x57e2('0x1d')](_0x57e2('0x57'),_0x1dd40b[_0x57e2('0x16')],_0x1dd40b['name'],_0x1dd40b[_0x57e2('0x58')]);});};exports['googleDialogflow']=function(_0x5bc13a,_0x5cb1bd,_0x2338c7,_0x51561d){var _0x32100b=apiai(_0x5cb1bd,{'language':_0x51561d||'en'});return _0x32100b['textRequest'](_0x2338c7,{'sessionId':md5(_0x5bc13a)})[_0x57e2('0x2a')](function(_0x45389b){logger['info'](JSON[_0x57e2('0x3f')](_0x45389b));return{'source':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5a')],'resolvedQuery':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5b')],'action':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5c')],'actionIncomplete':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5d')],'speech':_0x45389b[_0x57e2('0x59')][_0x57e2('0x5e')][_0x57e2('0x5f')],'score':_0x45389b[_0x57e2('0x59')][_0x57e2('0x60')],'statusCode':_0x45389b[_0x57e2('0x61')][_0x57e2('0x62')],'endConversation':_0x45389b['result'][_0x57e2('0x63')][_0x57e2('0x64')]||![],'isFallbackIntent':_0x45389b[_0x57e2('0x59')]['metadata'][_0x57e2('0x65')]};});};exports[_0x57e2('0x66')]=function(_0x42e6d7,_0x51077c,_0x47318f,_0x4569be,_0x3fb77d,_0x101d44){var _0x36dad8=_0x4569be[_0x57e2('0x67')](/\\n/g,'\x0a');var _0x30d09b={'credentials':{'private_key':_0x36dad8,'client_email':_0x47318f}};var _0x254a1d=new dialogflow[(_0x57e2('0x68'))](_0x30d09b);var _0x572c66=_0x254a1d[_0x57e2('0x69')](_0x51077c,md5(_0x42e6d7));var _0x4c6715={'session':_0x572c66,'queryInput':{'text':{'text':_0x3fb77d,'languageCode':_0x101d44}}};return _0x254a1d['detectIntent'](_0x4c6715)[_0x57e2('0x2a')](function(_0x518b30){if(_0x518b30&&_0x518b30[_0x57e2('0x6a')]){logger[_0x57e2('0x3a')](_0x57e2('0x6b'),JSON[_0x57e2('0x3f')](_0x518b30));var _0x2d3b91=_0x518b30[0x0];if(_0x2d3b91){var _0x3206a6={'action':_0x2d3b91['queryResult']['action'],'allRequiredParamsPresent':_0x2d3b91['queryResult'][_0x57e2('0x6c')],'endConversation':_0x2d3b91['queryResult'][_0x57e2('0x6d')]&&_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x6d')][_0x57e2('0x6f')]?_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x6d')][_0x57e2('0x6f')]['end_conversation'][_0x57e2('0x70')]:![],'fulfillmentText':_0x2d3b91['queryResult'][_0x57e2('0x71')],'intentName':_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x72')]['name'],'intentDisplayName':_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x72')][_0x57e2('0x73')],'isFallbackIntent':_0x2d3b91[_0x57e2('0x6e')]['intent'][_0x57e2('0x74')],'languageCode':_0x2d3b91[_0x57e2('0x6e')]['languageCode'],'queryText':_0x2d3b91[_0x57e2('0x6e')][_0x57e2('0x75')],'responseId':_0x2d3b91['responseId'],'score':_0x2d3b91['queryResult']['intentDetectionConfidence'],'speech':_0x2d3b91[_0x57e2('0x6e')]['fulfillmentText'],'providerResponse':JSON[_0x57e2('0x3f')](_0x518b30)};return _0x3206a6;}}});};exports[_0x57e2('0x76')]=function(_0x5e0eb8,_0x360b63,_0x449573,_0x4697cc){return tilde['asr'](_0x5e0eb8,_0x360b63,_0x449573,_0x4697cc)[_0x57e2('0x2a')](function(_0x33616c){try{fs[_0x57e2('0x4a')](_0x5e0eb8);}catch(_0x5ace57){logger[_0x57e2('0x1d')](_0x5ace57);}logger[_0x57e2('0x3a')]('Tilde\x20ASR\x20transcription',_0x33616c[_0x57e2('0x52')]);logger[_0x57e2('0x3a')](_0x57e2('0x77'),_0x33616c[_0x57e2('0x54')]);return _0x33616c;});};exports[_0x57e2('0x78')]=function(_0x1737ea,_0x59f702,_0x362093,_0x250c73,_0x2e05a4,_0xa260ca){var _0x46e5d2=path[_0x57e2('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x57e2('0x37'));var _0x40a856;return aws[_0x57e2('0x79')](_0x1737ea,_0x59f702,_0x362093,_0x250c73,_0x2e05a4,_0xa260ca,_0x46e5d2)[_0x57e2('0x2a')](function(){_0x40a856=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs['generate'](0x4)+_0x57e2('0x28'));return convertFile(_0x46e5d2,_0x40a856);})[_0x57e2('0x2a')](function(){try{fs[_0x57e2('0x4a')](_0x46e5d2);fs[_0x57e2('0x2b')](_0x40a856,_0x57e2('0x2c'));}catch(_0x1d4ca9){logger[_0x57e2('0x1d')](_0x1d4ca9);}return _0x40a856[_0x57e2('0x2d')]('.')[0x0];});};exports[_0x57e2('0x7a')]=function(_0x2fb70b,_0x3bf07b,_0x2659de,_0x555424,_0x949b94,_0x2a6e7f){return aws['lex'](_0x2fb70b,_0x3bf07b,_0x2659de,_0x555424,_0x949b94,_0x2a6e7f)[_0x57e2('0x2a')](function(_0x15f362){logger['info'](JSON[_0x57e2('0x3f')](_0x15f362));return _0x15f362;});};exports[_0x57e2('0x7b')]=function(_0x351200,_0x233097,_0x3816ea,_0x2ef421){var _0x41c25e=util[_0x57e2('0x7c')](_0x57e2('0x7d'),ISPEECH_API,_0x351200,encodeURIComponent(_0x233097),_0x3816ea,_0x2ef421);var _0x1ca049=path[_0x57e2('0x25')](__dirname,'tmp',rs[_0x57e2('0x27')](0x4)+_0x57e2('0x37'));var _0x24e71b;return downloadFile(_0x41c25e,_0x1ca049)['then'](function(){_0x24e71b=path[_0x57e2('0x25')](__dirname,_0x57e2('0x26'),rs[_0x57e2('0x27')](0x4)+'.wav');return convertFile(_0x1ca049,_0x24e71b);})[_0x57e2('0x2a')](function(){try{fs[_0x57e2('0x4a')](_0x1ca049);fs[_0x57e2('0x2b')](_0x24e71b,_0x57e2('0x2c'));}catch(_0xeb1db9){logger[_0x57e2('0x1d')](_0xeb1db9);}return _0x24e71b['split']('.')[0x0];});};exports[_0x57e2('0x7e')]=function(_0x3820d3,_0x409811,_0x483fac,_0x533a8e){var _0x2135ea=util[_0x57e2('0x7c')](_0x57e2('0x7f'),ISPEECH_API,_0x409811,_0x483fac,base64Encode(_0x3820d3),_0x533a8e?util['format'](_0x57e2('0x80'),encodeURIComponent(_0x533a8e)):_0x57e2('0x81'));return uploadFile(_0x2135ea)[_0x57e2('0x2a')](function(_0x307abe){return querystring[_0x57e2('0x8')](_0x307abe);});};exports[_0x57e2('0x82')]=function(_0x2da100,_0x223ed3){return sestek[_0x57e2('0x83')](_0x2da100,_0x223ed3)[_0x57e2('0x2a')](function(_0x317de2){logger['info'](JSON['stringify'](_0x317de2));var _0x257223={'speech':_0x317de2['text'],'action':_0x317de2[_0x57e2('0x84')]?_0x317de2[_0x57e2('0x84')][_0x57e2('0x85')]:undefined,'actiondata':_0x317de2['channelData']?_0x317de2[_0x57e2('0x84')][_0x57e2('0x86')]:undefined};if(_0x317de2[_0x57e2('0x84')]&&_0x317de2[_0x57e2('0x84')]['AudioFromTts']){return base64Decode(_0x317de2['channelData']['AudioFromTts'][_0x57e2('0x87')],path[_0x57e2('0x25')](__dirname,'tmp',rs[_0x57e2('0x27')](0x4)+_0x57e2('0x28')))[_0x57e2('0x2a')](function(_0x576f58){_0x257223[_0x57e2('0x88')]=_0x576f58;return _0x257223;});}return _0x257223;});};exports[_0x57e2('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x28a4=['textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','md5','request-promise','randomstring','sox','google-tts-api','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','start','resolve','tmp','.wav','then','chmodSync','777','split','readFileSync','toString','base64','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','POST','generate','.mp3','writeFile','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','slice','text\x20length\x20limit\x20reached','lang\x20\x22','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','name','googleDialogflow'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x28a4,0x13e));var _0x428a=function(_0x4e9f1a,_0x35e3f3){_0x4e9f1a=_0x4e9f1a-0x0;var _0x441f20=_0x28a4[_0x4e9f1a];return _0x441f20;};'use strict';var apiai=require(_0x428a('0x0'));var BPromise=require(_0x428a('0x1'));var dialogflow=require(_0x428a('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x428a('0x3'));var path=require('path');var querystring=require('querystring');var rp=require(_0x428a('0x4'));var rs=require(_0x428a('0x5'));var sox=require(_0x428a('0x6'));var tts=require(_0x428a('0x7'));var urlParse=require('url')['parse'];var util=require(_0x428a('0x8'));var aws=require('./aws');var google=require(_0x428a('0x9'));var sestek=require('./sestek');var tilde=require(_0x428a('0xa'));var logger=require(_0x428a('0xb'))(_0x428a('0xc'));var ISPEECH_API=_0x428a('0xd');function downloadFile(_0x2be42b,_0xf29be7){return new BPromise(function(_0x108056,_0x6bb71){var _0x1da68b=urlParse(_0x2be42b);var _0x5dd9e2=_0x1da68b[_0x428a('0xe')]===_0x428a('0xf')?https:http;var _0x3eebd={'host':_0x1da68b[_0x428a('0x10')],'path':_0x1da68b[_0x428a('0x11')],'headers':{'user-agent':_0x428a('0x12')}};_0x5dd9e2[_0x428a('0x13')](_0x3eebd,function(_0x39799f){if(_0x39799f[_0x428a('0x14')]!==0xc8){logger['error'](_0x428a('0x15')+_0x2be42b+'\x20failed,\x20status\x20code\x20=\x20'+_0x39799f['statusCode']+'\x20('+_0x39799f[_0x428a('0x16')]+')');_0x6bb71(new Error(_0x428a('0x15')+_0x2be42b+'\x20failed,\x20status\x20code\x20=\x20'+_0x39799f['statusCode']+'\x20('+_0x39799f[_0x428a('0x16')]+')'));return;}var _0x215d36=fs['createWriteStream'](_0xf29be7);_0x215d36['on'](_0x428a('0x17'),function(){logger[_0x428a('0x18')](_0x428a('0x19'));_0x215d36[_0x428a('0x1a')](_0x108056);});_0x215d36['on'](_0x428a('0x1b'),function(_0x39f659){fs[_0x428a('0x1c')](_0xf29be7);logger[_0x428a('0x1b')](_0x428a('0x1d'),_0x39f659);_0x6bb71(_0x39f659);});_0x39799f[_0x428a('0x1e')](_0x215d36);})['on']('error',function(_0x78d6ae){logger['error'](_0x78d6ae);_0x6bb71(_0x78d6ae);})[_0x428a('0x1f')]();});}function uploadFile(_0xe8d65b){return new BPromise(function(_0x39846c,_0x26300a){var _0xda6551=urlParse(_0xe8d65b);var _0x1335e9=_0xda6551[_0x428a('0xe')]===_0x428a('0xf')?https:http;var _0x5d20e2={'host':_0xda6551[_0x428a('0x10')],'path':_0xda6551[_0x428a('0x11')],'headers':{'user-agent':'WHAT_EVER'}};_0x1335e9[_0x428a('0x13')](_0x5d20e2,function(_0x10c9bd){if(_0x10c9bd[_0x428a('0x14')]!==0xc8){_0x26300a(new Error(_0x428a('0x15')+_0xe8d65b+_0x428a('0x20')+_0x10c9bd['statusCode']+'\x20('+_0x10c9bd[_0x428a('0x16')]+')'));return;}var _0x172220='';_0x10c9bd['on'](_0x428a('0x21'),function(_0x1cf48f){_0x172220+=_0x1cf48f;});_0x10c9bd['on'](_0x428a('0x1f'),function(){_0x39846c(_0x172220);});})['on'](_0x428a('0x1b'),function(_0x3ad8a7){_0x26300a(_0x3ad8a7);})[_0x428a('0x1f')]();});}function convertFile(_0x43ae59,_0x3e4eb3){return new BPromise(function(_0x208657,_0x99656e){var _0x5d3118=sox[_0x428a('0x22')](_0x43ae59,_0x3e4eb3,{'sampleRate':0x1f40,'format':_0x428a('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5d3118['on'](_0x428a('0x1b'),function(_0x43dc80){logger[_0x428a('0x1b')]('error\x20convert',_0x43dc80);_0x99656e(_0x43dc80);});_0x5d3118['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x208657();});_0x5d3118[_0x428a('0x24')]();});}function base64Decode(_0x10a9a6,_0x35a341){var _0xa568ab=path[_0x428a('0x25')](__dirname,_0x428a('0x26'),rs['generate'](0x4)+_0x428a('0x27'));fs['writeFileSync'](_0xa568ab,_0x10a9a6,'base64');return convertFile(_0xa568ab,_0x35a341)[_0x428a('0x28')](function(){try{fs[_0x428a('0x1c')](_0xa568ab);fs[_0x428a('0x29')](_0x35a341,_0x428a('0x2a'));}catch(_0x51eab6){logger[_0x428a('0x1b')](_0x51eab6);}return _0x35a341[_0x428a('0x2b')]('.')[0x0];});}function base64Encode(_0x3dad3b){var _0x524a90=fs[_0x428a('0x2c')](_0x3dad3b);return new Buffer(_0x524a90)[_0x428a('0x2d')](_0x428a('0x2e'));}exports['googleCloudTTS']=function(_0x4f813b,_0x4c205c,_0x111cef,_0x1897ca,_0xe54951,_0x398a8d){var _0xdb5c0,_0x4b3606;var _0x507145=_0x428a('0x2f');var _0x385b44=_0x428a('0x30')+_0x4f813b;var _0x10798b={};if(_0x4c205c===_0x428a('0x31')){_0x10798b['input']={'ssml':_0x111cef};}else{_0x10798b['input']={'text':_0x111cef};};_0x10798b[_0x428a('0x32')]={'languageCode':_0x1897ca,'ssmlGender':_0xe54951};_0x10798b[_0x428a('0x33')]={'audioEncoding':_0x428a('0x34'),'sampleRateHertz':0x1f40};var _0xf989d6={'url':_0x507145+'text:synthesize'+_0x385b44,'method':_0x428a('0x35'),'json':!![],'body':_0x10798b};return rp(_0xf989d6)[_0x428a('0x28')](function(_0x49ff04){return new BPromise(function(_0x208f6d,_0x10f503){_0xdb5c0=path[_0x428a('0x25')](__dirname,_0x428a('0x26'),rs[_0x428a('0x36')](0x4)+_0x428a('0x37'));var _0x3f0905=Buffer['from'](_0x49ff04['audioContent'],_0x428a('0x2e'));return fs[_0x428a('0x38')](_0xdb5c0,_0x3f0905,function(_0x4063bc){_0x10f503(_0x4063bc);},function(_0x216375){fs[_0x428a('0x29')](_0xdb5c0,_0x428a('0x2a'));_0x208f6d(_0x216375);});});})[_0x428a('0x28')](function(_0x11034){_0x4b3606=path[_0x428a('0x25')](__dirname,_0x428a('0x26'),rs[_0x428a('0x36')](0x4)+'.wav');return convertFile(_0xdb5c0,_0x4b3606);})[_0x428a('0x28')](function(){try{fs['unlink'](_0xdb5c0);fs[_0x428a('0x29')](_0x4b3606,_0x428a('0x2a'));}catch(_0xb941c9){logger[_0x428a('0x1b')](_0xb941c9);}logger[_0x428a('0x18')]('googleCloudTTS\x20path',_0x4b3606[_0x428a('0x2b')]('.')[0x0]);return _0x4b3606[_0x428a('0x2b')]('.')[0x0];});};exports['googleTTS']=function(_0x143a75,_0x202590){var _0x3aa7df=_0x428a('0x39');var _0x4cc68c,_0x56bc94;var _0x309d8e;var _0x491422={'encoding':'utf8','method':_0x428a('0x35'),'timeout':0x2710,'url':_0x3aa7df,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x428a('0x3a')+encodeURIComponent(JSON[_0x428a('0x3b')]([[[_0x428a('0x3c'),JSON['stringify']([_0x143a75,_0x202590||'en',![],_0x428a('0x3d')]),null,_0x428a('0x3e')]]]))};return rp(_0x491422)[_0x428a('0x28')](function(_0x2bc896){try{_0x309d8e=eval(_0x2bc896[_0x428a('0x3f')](0x5))[0x0][0x2];}catch(_0x4012b7){throw new Error('parse\x20response\x20failed:\x0a'+_0x2bc896[_0x428a('0x21')]);}if(!_0x309d8e){if(_0x143a75['length']>0xc8){throw new Error(_0x428a('0x40'));}else{throw new Error(_0x428a('0x41')+_0x202590+'\x22\x20might\x20not\x20exist');}}try{_0x309d8e=eval(_0x309d8e)[0x0];}catch(_0x3aeb7f){throw new Error(_0x428a('0x42')+res[_0x428a('0x21')]);}const _0x455cd0=_0x309d8e;_0x4cc68c=path['resolve'](__dirname,_0x428a('0x26'),rs['generate'](0x4)+'.mp3');fs[_0x428a('0x43')](_0x4cc68c,_0x309d8e,{'encoding':_0x428a('0x2e')});_0x56bc94=path[_0x428a('0x25')](__dirname,'tmp',rs[_0x428a('0x36')](0x4)+_0x428a('0x27'));return convertFile(_0x4cc68c,_0x56bc94);})[_0x428a('0x28')](function(){try{fs[_0x428a('0x1c')](_0x4cc68c);fs['chmodSync'](_0x56bc94,_0x428a('0x2a'));}catch(_0x4b483b){logger['error'](_0x4b483b);}logger[_0x428a('0x18')](_0x428a('0x44'),_0x56bc94[_0x428a('0x2b')]('.')[0x0]);return _0x56bc94[_0x428a('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0x2b1361,_0x2ee65d,_0x1db4b6){return google[_0x428a('0x45')](_0x2b1361,_0x2ee65d,_0x1db4b6)[_0x428a('0x28')](function(_0x11afb9){logger[_0x428a('0x18')](_0x11afb9[_0x428a('0x46')]);return rp(_0x11afb9);})[_0x428a('0x28')](function(_0x2bf7c7){var _0x2973e='';var _0x20a742=0x0;try{fs[_0x428a('0x1c')](_0x2b1361);}catch(_0x57b6ab){logger[_0x428a('0x1b')](_0x57b6ab);}if(_0x2bf7c7&&_0x2bf7c7[_0x428a('0x47')]){_0x2973e=_0x2bf7c7[_0x428a('0x47')][_0x428a('0x48')](function(_0xd57070){return _0xd57070&&_0xd57070['alternatives'][0x0]&&_0xd57070['alternatives'][0x0]['transcript']?_0xd57070[_0x428a('0x49')][0x0][_0x428a('0x4a')]:'';})['join']('\x0a');_0x20a742=_0x2bf7c7[_0x428a('0x47')]['map'](function(_0x3bf09a){return _0x3bf09a&&_0x3bf09a[_0x428a('0x49')][0x0]&&_0x3bf09a['alternatives'][0x0][_0x428a('0x4b')]?_0x3bf09a[_0x428a('0x49')][0x0][_0x428a('0x4b')]:0x0;})[_0x428a('0x4c')]('\x0a');}logger[_0x428a('0x18')](_0x428a('0x4d'),_0x2973e);logger[_0x428a('0x18')]('googleASR\x20confidence',_0x20a742);return{'transcript':_0x2973e,'confidence':_0x20a742};})[_0x428a('0x4e')](function(_0x50caba){logger['error']('[%s]\x20%s:%s',_0x50caba['statusCode'],_0x50caba[_0x428a('0x4f')],_0x50caba['message']);});};exports[_0x428a('0x50')]=function(_0x46f7e1,_0x50950d,_0x474d01,_0x155f75){var _0x12bfdc=apiai(_0x50950d,{'language':_0x155f75||'en'});return _0x12bfdc[_0x428a('0x51')](_0x474d01,{'sessionId':md5(_0x46f7e1)})['then'](function(_0x4b55bd){logger[_0x428a('0x18')](JSON[_0x428a('0x3b')](_0x4b55bd));return{'source':_0x4b55bd[_0x428a('0x52')][_0x428a('0x53')],'resolvedQuery':_0x4b55bd[_0x428a('0x52')][_0x428a('0x54')],'action':_0x4b55bd[_0x428a('0x52')]['action'],'actionIncomplete':_0x4b55bd[_0x428a('0x52')][_0x428a('0x55')],'speech':_0x4b55bd[_0x428a('0x52')][_0x428a('0x56')][_0x428a('0x57')],'score':_0x4b55bd[_0x428a('0x52')][_0x428a('0x58')],'statusCode':_0x4b55bd[_0x428a('0x59')][_0x428a('0x5a')],'endConversation':_0x4b55bd['result'][_0x428a('0x5b')][_0x428a('0x5c')]||![],'isFallbackIntent':_0x4b55bd[_0x428a('0x52')][_0x428a('0x5b')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x14fccf,_0x31dd21,_0x496468,_0x35f43c,_0x358bba,_0xe251ce){var _0x34196a=_0x35f43c['replace'](/\\n/g,'\x0a');var _0x4c3b6a={'credentials':{'private_key':_0x34196a,'client_email':_0x496468}};var _0x4a5725=new dialogflow[(_0x428a('0x5d'))](_0x4c3b6a);var _0x20b283=_0x4a5725[_0x428a('0x5e')](_0x31dd21,md5(_0x14fccf));var _0x455b69={'session':_0x20b283,'queryInput':{'text':{'text':_0x358bba,'languageCode':_0xe251ce}}};return _0x4a5725[_0x428a('0x5f')](_0x455b69)[_0x428a('0x28')](function(_0x18cf6c){if(_0x18cf6c&&_0x18cf6c[_0x428a('0x60')]){logger[_0x428a('0x18')](_0x428a('0x61'),JSON['stringify'](_0x18cf6c));var _0x5abed3=_0x18cf6c[0x0];if(_0x5abed3){var _0x2bc0a3={'action':_0x5abed3[_0x428a('0x62')][_0x428a('0x63')],'allRequiredParamsPresent':_0x5abed3[_0x428a('0x62')][_0x428a('0x64')],'endConversation':_0x5abed3[_0x428a('0x62')][_0x428a('0x65')]&&_0x5abed3[_0x428a('0x62')][_0x428a('0x65')][_0x428a('0x66')]?_0x5abed3[_0x428a('0x62')][_0x428a('0x65')][_0x428a('0x66')][_0x428a('0x67')][_0x428a('0x68')]:![],'fulfillmentText':_0x5abed3[_0x428a('0x62')][_0x428a('0x69')],'intentName':_0x5abed3[_0x428a('0x62')][_0x428a('0x6a')][_0x428a('0x4f')],'intentDisplayName':_0x5abed3[_0x428a('0x62')][_0x428a('0x6a')]['displayName'],'isFallbackIntent':_0x5abed3[_0x428a('0x62')][_0x428a('0x6a')][_0x428a('0x6b')],'languageCode':_0x5abed3[_0x428a('0x62')][_0x428a('0x6c')],'queryText':_0x5abed3[_0x428a('0x62')][_0x428a('0x6d')],'responseId':_0x5abed3[_0x428a('0x6e')],'score':_0x5abed3['queryResult'][_0x428a('0x6f')],'speech':_0x5abed3['queryResult'][_0x428a('0x69')],'providerResponse':JSON['stringify'](_0x18cf6c)};return _0x2bc0a3;}}});};exports[_0x428a('0x70')]=function(_0x2f1c6b,_0x3bdbf2,_0x467b2c,_0x3c96ba){return tilde[_0x428a('0x45')](_0x2f1c6b,_0x3bdbf2,_0x467b2c,_0x3c96ba)[_0x428a('0x28')](function(_0x164ca9){try{fs[_0x428a('0x1c')](_0x2f1c6b);}catch(_0x56c86d){logger[_0x428a('0x1b')](_0x56c86d);}logger[_0x428a('0x18')](_0x428a('0x71'),_0x164ca9['transcript']);logger[_0x428a('0x18')](_0x428a('0x72'),_0x164ca9[_0x428a('0x4b')]);return _0x164ca9;});};exports[_0x428a('0x73')]=function(_0x3937a5,_0x9e941c,_0x1f9dd8,_0x43f4c8,_0xe28ddc,_0x2a284d){var _0x1e2efb=path[_0x428a('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x428a('0x37'));var _0x31bd25;return aws[_0x428a('0x74')](_0x3937a5,_0x9e941c,_0x1f9dd8,_0x43f4c8,_0xe28ddc,_0x2a284d,_0x1e2efb)['then'](function(){_0x31bd25=path[_0x428a('0x25')](__dirname,_0x428a('0x26'),rs[_0x428a('0x36')](0x4)+_0x428a('0x27'));return convertFile(_0x1e2efb,_0x31bd25);})[_0x428a('0x28')](function(){try{fs[_0x428a('0x1c')](_0x1e2efb);fs[_0x428a('0x29')](_0x31bd25,'777');}catch(_0x285662){logger[_0x428a('0x1b')](_0x285662);}return _0x31bd25[_0x428a('0x2b')]('.')[0x0];});};exports['awsLex']=function(_0x5cbe70,_0x9aa051,_0x579baf,_0x4c9daf,_0x3b4a01,_0x1b9440){return aws[_0x428a('0x75')](_0x5cbe70,_0x9aa051,_0x579baf,_0x4c9daf,_0x3b4a01,_0x1b9440)['then'](function(_0x4b4097){logger[_0x428a('0x18')](JSON[_0x428a('0x3b')](_0x4b4097));return _0x4b4097;});};exports[_0x428a('0x76')]=function(_0x507deb,_0x21f85f,_0x2936e2,_0x201dd1){var _0x1ab901=util[_0x428a('0x77')](_0x428a('0x78'),ISPEECH_API,_0x507deb,encodeURIComponent(_0x21f85f),_0x2936e2,_0x201dd1);var _0x229b68=path[_0x428a('0x25')](__dirname,_0x428a('0x26'),rs[_0x428a('0x36')](0x4)+'.mp3');var _0x2b5357;return downloadFile(_0x1ab901,_0x229b68)[_0x428a('0x28')](function(){_0x2b5357=path[_0x428a('0x25')](__dirname,_0x428a('0x26'),rs[_0x428a('0x36')](0x4)+_0x428a('0x27'));return convertFile(_0x229b68,_0x2b5357);})[_0x428a('0x28')](function(){try{fs['unlink'](_0x229b68);fs[_0x428a('0x29')](_0x2b5357,_0x428a('0x2a'));}catch(_0x1e0d97){logger['error'](_0x1e0d97);}return _0x2b5357['split']('.')[0x0];});};exports[_0x428a('0x79')]=function(_0x13d4bb,_0x73caf5,_0x5bb298,_0x4f7aaa){var _0x7564f7=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x73caf5,_0x5bb298,base64Encode(_0x13d4bb),_0x4f7aaa?util[_0x428a('0x77')](_0x428a('0x7a'),encodeURIComponent(_0x4f7aaa)):_0x428a('0x7b'));return uploadFile(_0x7564f7)[_0x428a('0x28')](function(_0x39ea02){return querystring[_0x428a('0x7c')](_0x39ea02);});};exports[_0x428a('0x7d')]=function(_0x581051,_0x48eb6a){return sestek[_0x428a('0x7e')](_0x581051,_0x48eb6a)[_0x428a('0x28')](function(_0x36349f){logger[_0x428a('0x18')](JSON[_0x428a('0x3b')](_0x36349f));var _0x2d0810={'speech':_0x36349f[_0x428a('0x7f')],'action':_0x36349f[_0x428a('0x80')]?_0x36349f[_0x428a('0x80')][_0x428a('0x81')]:undefined,'actiondata':_0x36349f[_0x428a('0x80')]?_0x36349f[_0x428a('0x80')]['CustomActionData']:undefined};if(_0x36349f[_0x428a('0x80')]&&_0x36349f[_0x428a('0x80')][_0x428a('0x82')]){return base64Decode(_0x36349f[_0x428a('0x80')][_0x428a('0x82')][_0x428a('0x83')],path[_0x428a('0x25')](__dirname,_0x428a('0x26'),rs[_0x428a('0x36')](0x4)+_0x428a('0x27')))[_0x428a('0x28')](function(_0x277947){_0x2d0810[_0x428a('0x84')]=_0x277947;return _0x2d0810;});}return _0x2d0810;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 0e034f0..bb54e46 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0783=['exports','./nda'];(function(_0x3b45bb,_0x12c57c){var _0x1757dc=function(_0x139be3){while(--_0x139be3){_0x3b45bb['push'](_0x3b45bb['shift']());}};_0x1757dc(++_0x12c57c);}(_0x0783,0x199));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};var nda=require(_0x3078('0x0'));module[_0x3078('0x1')]={'nda':nda}; \ No newline at end of file +var _0x4898=['./nda'];(function(_0x5739e8,_0x31cac2){var _0x3e3e0d=function(_0x4be4d4){while(--_0x4be4d4){_0x5739e8['push'](_0x5739e8['shift']());}};_0x3e3e0d(++_0x31cac2);}(_0x4898,0x1f0));var _0x8489=function(_0x490321,_0x47dce4){_0x490321=_0x490321-0x0;var _0x39badb=_0x4898[_0x490321];return _0x39badb;};var nda=require(_0x8489('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 19effd9..11f9782 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65eb=['channelData','AudioOutputSettings','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','password','username','ndaactivity_type','message','Nda','uniqueid','dnid','text','project','body','ProjectName','ndagenerate_audio'];(function(_0x5de365,_0x1da106){var _0x336d66=function(_0x4666a2){while(--_0x4666a2){_0x5de365['push'](_0x5de365['shift']());}};_0x336d66(++_0x1da106);}(_0x65eb,0x6f));var _0xb65e=function(_0x516e14,_0x320e33){_0x516e14=_0x516e14-0x0;var _0x1eb8ff=_0x65eb[_0x516e14];return _0x1eb8ff;};'use strict';var rp=require(_0xb65e('0x0'));var url=require(_0xb65e('0x1'));var logger=require(_0xb65e('0x2'))(_0xb65e('0x3'));module[_0xb65e('0x4')]=function(_0xfd332a,_0x381f7c){var _0x8cec7d={'method':_0xb65e('0x5'),'uri':url['resolve'](_0x381f7c[_0xb65e('0x6')],'/token'),'form':{'grant_type':_0xb65e('0x7'),'username':_0x381f7c[_0xb65e('0x8')],'password':_0x381f7c['password']},'json':!![]};return rp(_0x8cec7d)['then'](function(_0x47e526){var _0xdc8874={'method':'POST','uri':url['resolve'](_0x381f7c['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x381f7c[_0xb65e('0x9')]||_0xb65e('0xa'),'channelId':_0xb65e('0xb'),'conversation':{'id':_0xfd332a[_0xb65e('0xc')]},'from':{'id':_0xfd332a['callerid'],'name':_0xfd332a['calleridname']},'recipient':{'id':_0xfd332a[_0xb65e('0xd')],'name':_0xfd332a['extension']},'text':_0x381f7c[_0xb65e('0xe')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x47e526['access_token']},'json':!![]};if(_0x381f7c[_0xb65e('0xf')]){_0xdc8874[_0xb65e('0x10')]['channelData'][_0xb65e('0x11')]=_0x381f7c[_0xb65e('0xf')];}if(_0x381f7c[_0xb65e('0x12')]=='1'){_0xdc8874[_0xb65e('0x10')][_0xb65e('0x13')][_0xb65e('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x381f7c['custom_action']){_0xdc8874[_0xb65e('0x10')][_0xb65e('0x13')][_0xb65e('0x15')]=_0x381f7c[_0xb65e('0x16')];if(_0x381f7c[_0xb65e('0x17')]){_0xdc8874['body'][_0xb65e('0x13')]['CustomActionData']=_0x381f7c[_0xb65e('0x17')];}}logger[_0xb65e('0x18')](JSON[_0xb65e('0x19')](_0xdc8874));return rp(_0xdc8874);});}; \ No newline at end of file +var _0xaa96=['CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action'];(function(_0x22287d,_0x900049){var _0x3b0fc1=function(_0x3fd937){while(--_0x3fd937){_0x22287d['push'](_0x22287d['shift']());}};_0x3b0fc1(++_0x900049);}(_0xaa96,0xc4));var _0x6aa9=function(_0x41e7d1,_0x36806d){_0x41e7d1=_0x41e7d1-0x0;var _0x210c92=_0xaa96[_0x41e7d1];return _0x210c92;};'use strict';var rp=require(_0x6aa9('0x0'));var url=require(_0x6aa9('0x1'));var logger=require(_0x6aa9('0x2'))(_0x6aa9('0x3'));module[_0x6aa9('0x4')]=function(_0x4455e2,_0x3b1363){var _0x50480b={'method':_0x6aa9('0x5'),'uri':url[_0x6aa9('0x6')](_0x3b1363['ndauth_url'],_0x6aa9('0x7')),'form':{'grant_type':_0x6aa9('0x8'),'username':_0x3b1363[_0x6aa9('0x9')],'password':_0x3b1363[_0x6aa9('0x8')]},'json':!![]};return rp(_0x50480b)['then'](function(_0xa520b2){var _0x1bfb7d={'method':_0x6aa9('0x5'),'uri':url[_0x6aa9('0x6')](_0x3b1363['ndassistant_url'],_0x6aa9('0xa')),'body':{'type':_0x3b1363[_0x6aa9('0xb')]||_0x6aa9('0xc'),'channelId':'Nda','conversation':{'id':_0x4455e2['uniqueid']},'from':{'id':_0x4455e2[_0x6aa9('0xd')],'name':_0x4455e2[_0x6aa9('0xe')]},'recipient':{'id':_0x4455e2[_0x6aa9('0xf')],'name':_0x4455e2[_0x6aa9('0x10')]},'text':_0x3b1363[_0x6aa9('0x11')],'channelData':{}},'headers':{'Authorization':_0x6aa9('0x12')+_0xa520b2[_0x6aa9('0x13')]},'json':!![]};if(_0x3b1363[_0x6aa9('0x14')]){_0x1bfb7d['body']['channelData'][_0x6aa9('0x15')]=_0x3b1363[_0x6aa9('0x14')];}if(_0x3b1363[_0x6aa9('0x16')]=='1'){_0x1bfb7d[_0x6aa9('0x17')][_0x6aa9('0x18')][_0x6aa9('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6aa9('0x1a')};}if(_0x3b1363[_0x6aa9('0x1b')]){_0x1bfb7d[_0x6aa9('0x17')][_0x6aa9('0x18')][_0x6aa9('0x1c')]=_0x3b1363[_0x6aa9('0x1b')];if(_0x3b1363[_0x6aa9('0x1d')]){_0x1bfb7d[_0x6aa9('0x17')][_0x6aa9('0x18')][_0x6aa9('0x1e')]=_0x3b1363[_0x6aa9('0x1d')];}}logger[_0x6aa9('0x1f')](JSON['stringify'](_0x1bfb7d));return rp(_0x1bfb7d);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 0f457ce..08b54e2 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01ca=['exports','./lib/api'];(function(_0xe3d4a2,_0x5dbf95){var _0x131efb=function(_0x90cd0){while(--_0x90cd0){_0xe3d4a2['push'](_0xe3d4a2['shift']());}};_0x131efb(++_0x5dbf95);}(_0x01ca,0xd7));var _0xa01c=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x01ca[_0x486f4a];return _0x135d99;};'use strict';var asr=require(_0xa01c('0x0'));module[_0xa01c('0x1')]=function(_0x5f1417,_0x1b023f,_0x247ad0,_0x2c3602){return asr(_0x5f1417,_0x1b023f,_0x247ad0,_0x2c3602);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x459b17,_0x324fa7,_0x49c5a9,_0x8467ab){return asr(_0x459b17,_0x324fa7,_0x49c5a9,_0x8467ab);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 23bc60f..3e3da9e 100644 --- a/server/services/agi/scripts/tilde/asr/lib/api.js +++ b/server/services/agi/scripts/tilde/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd15=['send','stringify','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','unix'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd15,0x179));var _0x5bd1=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0xbd15[_0x3fcc20];return _0x15d3ce;};'use strict';var BPromise=require(_0x5bd1('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5bd1('0x1'));var logger=require('../../../../../../config/logger')(_0x5bd1('0x2'));module[_0x5bd1('0x3')]=function(_0x2ac429,_0x3c704a,_0x931440,_0x4181d0){return new BPromise(function(_0x22fd29,_0x2b1e65){logger[_0x5bd1('0x4')](_0x5bd1('0x5'),_0x4181d0||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2c35d0=new WebSocket(_0x4181d0||_0x5bd1('0x6'),{'perMessageDeflate':![]});var _0x17de27='';var _0x57a596='0';var _0x5bb0be='1';var _0x11c62d=_0x5bd1('0x7');function _0x17a51e(_0x2dae5e){var _0x347f55=crypto['createHash'](_0x5bd1('0x8'));_0x347f55[_0x5bd1('0x9')](_0x2dae5e);return _0x347f55[_0x5bd1('0xa')](_0x5bd1('0xb'));}function _0x5bb848(){try{logger[_0x5bd1('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x3243c8=moment()[_0x5bd1('0xc')]();var _0x3dc01a=_0x17a51e(_0x3243c8+_0x3c704a+_0x931440);_0x2c35d0[_0x5bd1('0xd')](JSON[_0x5bd1('0xe')]({'appID':_0x3c704a,'timestamp':_0x3243c8,'appKey':_0x3dc01a}));var _0x466f14=fs[_0x5bd1('0xf')](_0x2ac429);_0x466f14['on'](_0x5bd1('0x10'),function(_0x3d580e){_0x2c35d0['send'](_0x3d580e);});_0x466f14['on'](_0x5bd1('0x11'),function(){_0x2c35d0['send']('EOS');});}catch(_0x23a333){logger['error'](_0x5bd1('0x12'),JSON[_0x5bd1('0xe')](_0x23a333));_0x2c35d0['terminate']();}}function _0x585db7(_0x2d138){try{if(_0x2d138){var _0x2d6b92=JSON[_0x5bd1('0x13')](_0x2d138);switch(_0x2d6b92[_0x5bd1('0x14')]){case 0x0:if(_0x2d6b92[_0x5bd1('0x15')]){if(_0x2d6b92['result'][_0x5bd1('0x16')]){logger['info'](_0x5bd1('0x17'),JSON[_0x5bd1('0xe')](_0x2d6b92[_0x5bd1('0x15')][_0x5bd1('0x18')]));_0x17de27=_0x2d6b92[_0x5bd1('0x15')][_0x5bd1('0x18')][0x0][_0x5bd1('0x19')];_0x57a596=_0x2d6b92[_0x5bd1('0x15')][_0x5bd1('0x18')][0x0]['likelihood'];_0x5bb0be='0';_0x11c62d=_0x5bd1('0x1a');_0x2c35d0[_0x5bd1('0x1b')]();}}break;case 0x1:logger[_0x5bd1('0x4')](_0x5bd1('0x7'));_0x5bb0be='1';_0x11c62d=_0x5bd1('0x7');break;case 0x2:logger[_0x5bd1('0x4')](_0x5bd1('0x1c'));_0x5bb0be='2';_0x11c62d=_0x5bd1('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5bb0be='9';_0x11c62d=_0x5bd1('0x1d');break;case 0xa:logger[_0x5bd1('0x4')](_0x5bd1('0x1e'));_0x5bb0be='10';_0x11c62d=_0x5bd1('0x1e');break;case 0xb:logger['info'](_0x5bd1('0x1f'));_0x5bb0be='11';_0x11c62d=_0x5bd1('0x1f');}}}catch(_0x4b76a5){logger['error'](_0x5bd1('0x20'),JSON['stringify'](_0x4b76a5));_0x2c35d0[_0x5bd1('0x1b')]();}}function _0x3182aa(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x22fd29({'transcript':_0x17de27,'confidence':_0x57a596,'status':_0x5bb0be,'status_message':_0x11c62d});}function _0x2dbbc2(_0x422789){logger[_0x5bd1('0x21')](_0x5bd1('0x22'));if(!_[_0x5bd1('0x23')](_0x422789)){logger['error'](_[_0x5bd1('0x24')](_0x422789)?JSON[_0x5bd1('0xe')](_0x422789):_0x422789);}}_0x2c35d0['on'](_0x5bd1('0x25'),_0x5bb848);_0x2c35d0['on'](_0x5bd1('0x26'),_0x585db7);_0x2c35d0['on'](_0x5bd1('0x11'),_0x3182aa);_0x2c35d0['on'](_0x5bd1('0x21'),_0x2dbbc2);});}; \ No newline at end of file +var _0x782f=['digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x782f,0xef));var _0xf782=function(_0x5c51ef,_0xc76334){_0x5c51ef=_0x5c51ef-0x0;var _0x27ec2b=_0x782f[_0x5c51ef];return _0x27ec2b;};'use strict';var BPromise=require(_0xf782('0x0'));var _=require(_0xf782('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf782('0x2'));var crypto=require(_0xf782('0x3'));var logger=require(_0xf782('0x4'))(_0xf782('0x5'));module[_0xf782('0x6')]=function(_0x22e57d,_0x56b231,_0x24f94c,_0x53eb3a){return new BPromise(function(_0x402718,_0x4260de){logger[_0xf782('0x7')]('Tilde\x20URI',_0x53eb3a||_0xf782('0x8'));var _0x1b87e5=new WebSocket(_0x53eb3a||_0xf782('0x8'),{'perMessageDeflate':![]});var _0x1b8212='';var _0x407a72='0';var _0x5d036d='1';var _0x2503da=_0xf782('0x9');function _0x4bf0ae(_0x25b8ac){var _0x39b48e=crypto[_0xf782('0xa')](_0xf782('0xb'));_0x39b48e[_0xf782('0xc')](_0x25b8ac);return _0x39b48e[_0xf782('0xd')](_0xf782('0xe'));}function _0x1571d9(){try{logger[_0xf782('0x7')](_0xf782('0xf'));var _0x22ca84=moment()[_0xf782('0x10')]();var _0x5331f7=_0x4bf0ae(_0x22ca84+_0x56b231+_0x24f94c);_0x1b87e5[_0xf782('0x11')](JSON[_0xf782('0x12')]({'appID':_0x56b231,'timestamp':_0x22ca84,'appKey':_0x5331f7}));var _0x2da5ee=fs[_0xf782('0x13')](_0x22e57d);_0x2da5ee['on'](_0xf782('0x14'),function(_0x209bdc){_0x1b87e5[_0xf782('0x11')](_0x209bdc);});_0x2da5ee['on']('close',function(){_0x1b87e5['send'](_0xf782('0x15'));});}catch(_0x2b9a50){logger[_0xf782('0x16')](_0xf782('0x17'),JSON[_0xf782('0x12')](_0x2b9a50));_0x1b87e5[_0xf782('0x18')]();}}function _0x1acd04(_0x31f199){try{if(_0x31f199){var _0x1e3293=JSON[_0xf782('0x19')](_0x31f199);switch(_0x1e3293[_0xf782('0x1a')]){case 0x0:if(_0x1e3293[_0xf782('0x1b')]){if(_0x1e3293[_0xf782('0x1b')][_0xf782('0x1c')]){logger[_0xf782('0x7')](_0xf782('0x1d'),JSON[_0xf782('0x12')](_0x1e3293[_0xf782('0x1b')][_0xf782('0x1e')]));_0x1b8212=_0x1e3293[_0xf782('0x1b')][_0xf782('0x1e')][0x0][_0xf782('0x1f')];_0x407a72=_0x1e3293[_0xf782('0x1b')]['hypotheses'][0x0]['likelihood'];_0x5d036d='0';_0x2503da=_0xf782('0x20');_0x1b87e5[_0xf782('0x18')]();}}break;case 0x1:logger[_0xf782('0x7')](_0xf782('0x9'));_0x5d036d='1';_0x2503da=_0xf782('0x9');break;case 0x2:logger[_0xf782('0x7')](_0xf782('0x21'));_0x5d036d='2';_0x2503da=_0xf782('0x21');break;case 0x9:logger['info'](_0xf782('0x22'));_0x5d036d='9';_0x2503da='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xf782('0x7')](_0xf782('0x23'));_0x5d036d='10';_0x2503da='Authentication\x20failed.';break;case 0xb:logger[_0xf782('0x7')](_0xf782('0x24'));_0x5d036d='11';_0x2503da=_0xf782('0x24');}}}catch(_0x51bfd3){logger[_0xf782('0x16')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xf782('0x12')](_0x51bfd3));_0x1b87e5[_0xf782('0x18')]();}}function _0x41ecbe(){logger[_0xf782('0x7')](_0xf782('0x25'));_0x402718({'transcript':_0x1b8212,'confidence':_0x407a72,'status':_0x5d036d,'status_message':_0x2503da});}function _0x3d8228(_0x1a4fef){logger[_0xf782('0x16')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xf782('0x26')](_0x1a4fef)){logger['error'](_[_0xf782('0x27')](_0x1a4fef)?JSON['stringify'](_0x1a4fef):_0x1a4fef);}}_0x1b87e5['on']('open',_0x1571d9);_0x1b87e5['on'](_0xf782('0x28'),_0x1acd04);_0x1b87e5['on'](_0xf782('0x29'),_0x41ecbe);_0x1b87e5['on'](_0xf782('0x16'),_0x3d8228);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 42e330e..2f86143 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aa0=['exports'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x0aa0,0xf5));var _0x00aa=function(_0x56d71f,_0x10d101){_0x56d71f=_0x56d71f-0x0;var _0x44f211=_0x0aa0[_0x56d71f];return _0x44f211;};var asr=require('./asr');module[_0x00aa('0x0')]={'asr':asr}; \ No newline at end of file +var _0x33b9=['exports'];(function(_0x23fafd,_0xe8a07c){var _0x3a0eff=function(_0x2ae28a){while(--_0x2ae28a){_0x23fafd['push'](_0x23fafd['shift']());}};_0x3a0eff(++_0xe8a07c);}(_0x33b9,0x138));var _0x933b=function(_0x5d5b4c,_0x247df8){_0x5d5b4c=_0x5d5b4c-0x0;var _0x29825a=_0x33b9[_0x5d5b4c];return _0x29825a;};var asr=require('./asr');module[_0x933b('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c26f33a..0fd9ef2 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x946e=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','close','nextTick','inherits','util','events','./error','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listening','getConnections','error'];(function(_0x4d2d07,_0x59b3f6){var _0x5b3dd5=function(_0x5d334d){while(--_0x5d334d){_0x4d2d07['push'](_0x4d2d07['shift']());}};_0x5b3dd5(++_0x59b3f6);}(_0x946e,0x1d0));var _0xe946=function(_0x19dc0d,_0x23650a){_0x19dc0d=_0x19dc0d-0x0;var _0xed20a=_0x946e[_0x19dc0d];return _0xed20a;};'use strict';var util=require(_0xe946('0x0'));var net=require('net');var EventEmitter=require(_0xe946('0x1'))['EventEmitter'];var AGIError=require(_0xe946('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x5c9b66,_0x31cade,_0xb981db){var _0x2b42cd=this,_0x5c9b66=_0x5c9b66||0x11dd,_0x31cade=_0x31cade||_0xe946('0x3'),_0x49224a=null,_0x123d0c=0x0;EventEmitter[_0xe946('0x4')](_0x2b42cd);function _0x4e9ca6(){if(!_0x5c9b66){_0x2b42cd[_0xe946('0x5')]('error',new AGIError(_0xe946('0x6')));return![];}_0x49224a=net[_0xe946('0x7')]();_0x49224a['listen'](_0x5c9b66,_0x31cade);_0x49224a['on']('listening',function(){_0x2b42cd['emit'](_0xe946('0x8'));});_0x49224a['on']('connection',function(_0x5679f6){_0x49224a[_0xe946('0x9')](function(_0xd0f134,_0x56d82e){if(_0xd0f134){_0x2b42cd['emit'](_0xe946('0xa'),new AGIError(_0xe946('0xb'),_0xd0f134));}else if(_0xb981db&&_0xb981db<0x0){_0x2b42cd['emit'](_0xe946('0xa'),new AGIError(_0xe946('0xc')));_0x5679f6[_0xe946('0xd')]();}else if(_0xb981db&&_0xb981db>0x0&&_0xb981db<_0x56d82e){_0x123d0c+=0x1;_0x2b42cd[_0xe946('0x5')](_0xe946('0xa'),new AGIError(_0xe946('0xe'),_0x123d0c));_0x5679f6[_0xe946('0xd')]();}else{var _0x5d0038=new AGIChannel(_0x5679f6);_0x5d0038['on']('ready',function(){_0x2b42cd[_0xe946('0x5')](_0xe946('0xf'),_0x5d0038);});}});});_0x49224a['on'](_0xe946('0xa'),function(_0x551686){_0x2b42cd[_0xe946('0x5')](_0xe946('0xa'),new AGIError(_0xe946('0xb'),_0x551686['code']));});_0x49224a['on'](_0xe946('0x10'),function(){_0x2b42cd[_0xe946('0x5')](_0xe946('0x10'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xe946('0x11')](function(){_0x4e9ca6();});};util[_0xe946('0x12')](AGIServer,EventEmitter);module['exports']=function(_0x2b2b66,_0x5d8602,_0x1489f4){return new AGIServer(_0x2b2b66,_0x5d8602,_0x1489f4);}; \ No newline at end of file +var _0xc770=['emit','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./error','./channel','127.0.0.1','error','E_AGI_ARGUMENT_PORT','createServer','listening'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0c77('0x0'));var net=require(_0x0c77('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0x0c77('0x2'));var AGIChannel=require(_0x0c77('0x3'));var AGIServer=function(_0x3eaca5,_0x23ae87,_0xdcfb07){var _0x18e293=this,_0x3eaca5=_0x3eaca5||0x11dd,_0x23ae87=_0x23ae87||_0x0c77('0x4'),_0x575bb3=null,_0x26a0ff=0x0;EventEmitter['call'](_0x18e293);function _0x221281(){if(!_0x3eaca5){_0x18e293['emit'](_0x0c77('0x5'),new AGIError(_0x0c77('0x6')));return![];}_0x575bb3=net[_0x0c77('0x7')]();_0x575bb3['listen'](_0x3eaca5,_0x23ae87);_0x575bb3['on'](_0x0c77('0x8'),function(){_0x18e293[_0x0c77('0x9')]('listening');});_0x575bb3['on']('connection',function(_0x2784dd){_0x575bb3['getConnections'](function(_0x145e17,_0x831896){if(_0x145e17){_0x18e293['emit'](_0x0c77('0x5'),new AGIError(_0x0c77('0xa'),_0x145e17));}else if(_0xdcfb07&&_0xdcfb07<0x0){_0x18e293[_0x0c77('0x9')](_0x0c77('0x5'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x2784dd['destroy']();}else if(_0xdcfb07&&_0xdcfb07>0x0&&_0xdcfb07<_0x831896){_0x26a0ff+=0x1;_0x18e293['emit'](_0x0c77('0x5'),new AGIError(_0x0c77('0xb'),_0x26a0ff));_0x2784dd[_0x0c77('0xc')]();}else{var _0x29b1d0=new AGIChannel(_0x2784dd);_0x29b1d0['on']('ready',function(){_0x18e293[_0x0c77('0x9')](_0x0c77('0xd'),_0x29b1d0);});}});});_0x575bb3['on']('error',function(_0x15fe04){_0x18e293[_0x0c77('0x9')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x15fe04[_0x0c77('0xe')]));});_0x575bb3['on'](_0x0c77('0xf'),function(){_0x18e293['emit']('close',new AGIError(_0x0c77('0x10')));});}process[_0x0c77('0x11')](function(){_0x221281();});};util[_0x0c77('0x12')](AGIServer,EventEmitter);module[_0x0c77('0x13')]=function(_0x4c5d2a,_0x152b9b,_0xef65a){return new AGIServer(_0x4c5d2a,_0x152b9b,_0xef65a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 458a56a..67e2a3c 100644 --- a/server/services/agi/vertices.js +++ b/server/services/agi/vertices.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','auth','pass','template_id','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','lodash','odbc','randomstring','moment','mustache','../../config/logger','agi','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','uniqueid','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','callback','scheduledAt','callback_priority','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','timeout','number','POST','PUT','method','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','body','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','format','%s.%s','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','noop','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','no\x20text\x20configured','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','googleDialogflow','out','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response'];(function(_0x3957dc,_0x525687){var _0x107bc4=function(_0x59ab60){while(--_0x59ab60){_0x3957dc['push'](_0x3957dc['shift']());}};_0x107bc4(++_0x525687);}(_0x31f0,0xb7));var _0x031f=function(_0x2644dc,_0x427925){_0x2644dc=_0x2644dc-0x0;var _0x9a59a7=_0x31f0[_0x2644dc];return _0x9a59a7;};'use strict';var fs=require('fs');var path=require(_0x031f('0x0'));var util=require('util');var _=require(_0x031f('0x1'));var sh=require('shelljs');var odbc=require(_0x031f('0x2'))();var rs=require(_0x031f('0x3'));var moment=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var rp=require('request-promise');var logger=require(_0x031f('0x6'))(_0x031f('0x7'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x031f('0x8'),'rawBody'];var verticesWithRetry=[_0x031f('0x9'),_0x031f('0xa'),_0x031f('0xb')];var AGIVertices=function(_0x3e41ed,_0x4d47c5,_0x2e5624){this[_0x031f('0xc')]=_0x3e41ed;this[_0x031f('0xd')]=_0x4d47c5;this[_0x031f('0xe')]=_0x2e5624;};AGIVertices[_0x031f('0xf')][_0x031f('0x10')]=function(_0x2202dc,_0x3fd541){this['rpc'][_0x031f('0x11')](_0x2202dc)[_0x031f('0x12')](function(_0x28da6e){_0x3fd541(null,_0x28da6e?_0x28da6e[_0x031f('0x13')]:![]);})[_0x031f('0x14')](function(_0x405896){_0x3fd541(_0x405896);});};AGIVertices[_0x031f('0xf')]['getVoiceQueue']=function(_0x1614d6,_0x23b40c){this[_0x031f('0xd')][_0x031f('0x15')](_0x1614d6)[_0x031f('0x12')](function(_0x57f9c0){_0x23b40c(null,_0x57f9c0?_0x57f9c0['name']:![]);})[_0x031f('0x14')](function(_0x3a10aa){_0x23b40c(_0x3a10aa);});};AGIVertices[_0x031f('0xf')][_0x031f('0x16')]=function(_0x5196b1,_0x1dc4a7){this[_0x031f('0xd')]['getSquareProjectById'](_0x5196b1)[_0x031f('0x12')](function(_0x535e70){_0x1dc4a7(null,_0x535e70?_0x535e70[_0x031f('0x13')]:![]);})[_0x031f('0x14')](function(_0x563bc8){_0x1dc4a7(_0x563bc8);});};AGIVertices[_0x031f('0xf')][_0x031f('0x17')]=function(_0x26cb5e,_0x1b76d6){this[_0x031f('0xd')][_0x031f('0x18')](_0x26cb5e)[_0x031f('0x12')](function(_0x29dd6e){_0x1b76d6(null,_0x29dd6e?_0x29dd6e['dsn']:![]);})[_0x031f('0x14')](function(_0x33926c){_0x1b76d6(_0x33926c);});};AGIVertices[_0x031f('0xf')]['getUser']=function(_0x5c4184,_0xa11a2b){this['rpc'][_0x031f('0x19')](_0x5c4184)['then'](function(_0x54d054){_0xa11a2b(null,_0x54d054?_0x54d054['name']:![]);})[_0x031f('0x14')](function(_0x12c406){_0xa11a2b(_0x12c406);});};AGIVertices[_0x031f('0xf')][_0x031f('0x1a')]=function(_0x494568,_0x374b65){this['rpc'][_0x031f('0x1b')](_0x494568)[_0x031f('0x12')](function(_0xfa77b1){_0x374b65(null,_0xfa77b1?_0xfa77b1['name']:![]);})[_0x031f('0x14')](function(_0x3b2a51){_0x374b65(_0x3b2a51);});};AGIVertices['prototype'][_0x031f('0x1c')]=function(_0x28a617,_0x2403e9){var _0x5395ea=this;this[_0x031f('0xd')][_0x031f('0x1d')](_0x28a617)[_0x031f('0x12')](function(_0xaf5bea){_0x2403e9(null,_0xaf5bea?_0x5395ea[_0x031f('0x1e')](_0xaf5bea[_0x031f('0x1f')]):![]);})['catch'](function(_0x1f62eb){_0x2403e9(_0x1f62eb);});};AGIVertices[_0x031f('0xf')][_0x031f('0x20')]=function(_0x2ea861,_0x428ec4){this[_0x031f('0xd')][_0x031f('0x21')](_0x2ea861)[_0x031f('0x12')](function(_0x2034ac){_0x428ec4(null,_0x2034ac?_0x2034ac:![]);})[_0x031f('0x14')](function(_0x2cf3a8){_0x428ec4(_0x2cf3a8);});};AGIVertices['prototype'][_0x031f('0x22')]=function(_0xe5f11c,_0xb3a6bd,_0x2f2616){this[_0x031f('0xe')][_0x031f('0x22')](_0xe5f11c,_0xb3a6bd)[_0x031f('0x12')](function(){_0x2f2616(null);})[_0x031f('0x14')](function(_0x217460){_0x2f2616(_0x217460);});};AGIVertices[_0x031f('0xf')][_0x031f('0x23')]=function(_0x17217d,_0x4610fa){this['rpc'][_0x031f('0x24')](_0x17217d)[_0x031f('0x12')](function(_0x4d1569){if(_0x4d1569){if(_0x4d1569[_0x031f('0x25')]){_0x4610fa(null,[_0x4d1569[_0x031f('0x26')]]);}else{_0x4610fa(null,_['map'](_0x4d1569[_0x031f('0x27')],_0x031f('0x26')));}}else{_0x4610fa(null,![]);}})[_0x031f('0x14')](function(_0x3ef166){_0x4610fa(_0x3ef166);});};AGIVertices['prototype']['getSoundPath']=function(_0x36ab13){return util['format'](_0x031f('0x28'),FILES_PATH,_0x36ab13);};AGIVertices[_0x031f('0xf')][_0x031f('0x29')]=function(_0x56a7f0,_0x5c33c5,_0x3c1e48){odbc['open'](_0x56a7f0,function(_0x57b9c8){if(_0x57b9c8){logger[_0x031f('0x2a')](_0x031f('0x2b'),_0x57b9c8);_0x3c1e48(_0x57b9c8);}else{logger[_0x031f('0x2c')](_0x031f('0x2d'));odbc[_0x031f('0x2e')](_0x5c33c5,function(_0x46b4f3,_0x1ffd03){if(_0x46b4f3){logger['info'](_0x031f('0x2f'),_0x5c33c5);_0x3c1e48(_0x46b4f3);}else{logger[_0x031f('0x2c')](_0x031f('0x30'),_0x5c33c5);odbc[_0x031f('0x31')](function(_0x58daa2){if(_0x58daa2){logger[_0x031f('0x2a')](_0x031f('0x32'),_0x58daa2);}_0x3c1e48(null,_0x1ffd03);});}});}});};AGIVertices[_0x031f('0xf')]['getSmsAccount']=function(_0x24ec95,_0x3b504c){this['rpc'][_0x031f('0x33')](_0x24ec95)[_0x031f('0x12')](function(_0x56a8f3){_0x3b504c(null,_0x56a8f3?_0x56a8f3:![]);})['catch'](function(_0x178135){_0x3b504c(_0x178135);});};AGIVertices[_0x031f('0xf')][_0x031f('0x34')]=function(_0x46885f,_0x2691b7){this[_0x031f('0xd')][_0x031f('0x34')](_0x46885f)['then'](function(_0x10eb0a){_0x2691b7(null,_0x10eb0a);})[_0x031f('0x14')](function(_0x4d701e){_0x2691b7(_0x4d701e);});};AGIVertices[_0x031f('0xf')]['createSquareDetailsReport']=function(_0x456a98,_0x260a3d,_0x56dd24){this[_0x031f('0xd')][_0x031f('0x35')]({'uniqueid':this[_0x031f('0xc')]['uniqueid'],'node':_0x456a98[_0x031f('0x36')],'application':_0x456a98[_0x031f('0x37')],'data':_0x260a3d||null,'project_name':this[_0x031f('0xc')][_0x031f('0x38')],'callerid':this[_0x031f('0xc')][_0x031f('0x39')]})[_0x031f('0x12')](function(_0x3f4b85){if(_0x56dd24){_0x56dd24(null,_0x3f4b85);}})[_0x031f('0x14')](function(_0x4a7a87){if(_0x56dd24){_0x56dd24(_0x4a7a87);}});};AGIVertices[_0x031f('0xf')][_0x031f('0x3a')]=function(_0x28f2b3,_0x3205ce,_0xcf2072,_0x2c879c){this[_0x031f('0xd')][_0x031f('0x3a')]({'uniqueid':this[_0x031f('0xc')]['uniqueid'],'callerid':this[_0x031f('0xc')]['callerid'],'calleridname':this['channel'][_0x031f('0x3b')],'context':this[_0x031f('0xc')][_0x031f('0x3c')],'extension':this[_0x031f('0xc')][_0x031f('0x3d')],'priority':this['channel'][_0x031f('0x3e')],'accountcode':this[_0x031f('0xc')][_0x031f('0x3f')],'dnid':this['channel'][_0x031f('0x40')],'projectName':this[_0x031f('0xc')][_0x031f('0x38')],'saveName':_0x3205ce,'filename':_0x28f2b3[_0x031f('0x41')]||_0x3205ce,'savePath':_0xcf2072})[_0x031f('0x12')](function(_0x12d28e){_0x2c879c(null,_0x12d28e);})['catch'](function(_0x569d8f){_0x2c879c(_0x569d8f);});};AGIVertices[_0x031f('0xf')]['createSquareMessage']=function(_0x3b8c04,_0x3bba44,_0x5a29e0,_0x3a0599,_0x4cd2ae){this['rpc'][_0x031f('0x42')]({'uniqueid':this['channel'][_0x031f('0x43')],'body':_0x3b8c04,'direction':_0x3bba44,'providerName':_0x5a29e0,'providerResponse':_0x3a0599})['then'](function(_0x11bf43){if(_0x4cd2ae){_0x4cd2ae(null,_0x11bf43);}})[_0x031f('0x14')](function(_0x5da62e){if(_0x4cd2ae){_0x4cd2ae(_0x5da62e);}});};AGIVertices[_0x031f('0xf')][_0x031f('0x44')]=function(_0x57e32d,_0x46471a){this['rpc'][_0x031f('0x44')]({'firstName':_['isEmpty'](_0x57e32d[_0x031f('0x13')])||_[_0x031f('0x45')](_0x57e32d[_0x031f('0x13')])?_0x031f('0x46')+Math[_0x031f('0x47')]():_0x57e32d['name'],'lastName':_[_0x031f('0x48')](_0x57e32d['lastName'])||_[_0x031f('0x45')](_0x57e32d[_0x031f('0x49')])?null:_0x57e32d['lastName'],'phone':_0x57e32d[_0x031f('0x4a')],'ListId':_0x57e32d[_0x031f('0x4b')],'scheduledat':_0x57e32d['scheduledAt'],'callbackUniqueid':this[_0x031f('0xc')][_0x031f('0x43')],'tags':_0x031f('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x57e32d[_0x031f('0x4d')]['toString'](),'priority':_0x57e32d[_0x031f('0x4e')]})['then'](function(_0x3bd6f4){_0x46471a(null,_0x3bd6f4);})['catch'](function(_0xa52a54){_0x46471a(_0xa52a54);});};AGIVertices[_0x031f('0xf')]['getPause']=function(_0x4c5061,_0x24525b){this[_0x031f('0xd')]['getPauseById'](_0x4c5061)[_0x031f('0x12')](function(_0xb44c73){_0x24525b(null,_0xb44c73?_0xb44c73[_0x031f('0x13')]:![]);})[_0x031f('0x14')](function(_0x21a89d){_0x24525b(_0x21a89d);});};AGIVertices[_0x031f('0xf')][_0x031f('0x4f')]=function(_0x405398,_0x4b25e5,_0xe452c2){var _0x915e75={'role':_0x031f('0x50')};_0x915e75[_0x405398]=this['channel'][_0x031f('0x39')];this[_0x031f('0xd')]['agentPause'](_0x915e75,_0x4b25e5,this[_0x031f('0xc')][_0x031f('0x43')])[_0x031f('0x12')](function(_0x198e2e){_0xe452c2(null,_['isNil'](_0x198e2e)?![]:!![]);})['catch'](function(_0x4b5db9){logger['error'](_0x4b5db9);_0xe452c2(null,![]);});};AGIVertices[_0x031f('0xf')][_0x031f('0x51')]=function(_0x4a7fbb,_0x10531d){var _0x28f026={'role':'agent'};_0x28f026[_0x4a7fbb]=this[_0x031f('0xc')][_0x031f('0x39')];this[_0x031f('0xd')][_0x031f('0x51')](_0x28f026)[_0x031f('0x12')](function(_0x3172b1){_0x10531d(null,_[_0x031f('0x45')](_0x3172b1)?![]:!![]);})[_0x031f('0x14')](function(_0x430667){logger['error'](_0x430667);_0x10531d(null,![]);});};AGIVertices[_0x031f('0xf')]['agentLogout']=function(_0x13409d,_0x2cc2d1){var _0x3d27d6={'role':'agent'};_0x3d27d6[_0x13409d]=this['channel'][_0x031f('0x39')];this[_0x031f('0xd')][_0x031f('0x52')](_0x3d27d6)[_0x031f('0x12')](function(_0x49507b){_0x2cc2d1(null,_[_0x031f('0x45')](_0x49507b)?![]:!![]);})['catch'](function(_0x478982){logger[_0x031f('0x2a')](_0x478982);_0x2cc2d1(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x71e67,_0x13dd0c){var _0x248f8b={'role':_0x031f('0x50')};_0x248f8b[_0x71e67]=this[_0x031f('0xc')]['callerid'];var _0x56b573=_0x71e67!=_0x031f('0x53')?util['format'](_0x031f('0x54'),_0x031f('0x55'),this['channel'][_0x031f('0x39')]):undefined;this[_0x031f('0xd')][_0x031f('0x56')](_0x248f8b,_0x56b573)[_0x031f('0x12')](function(_0x14fd99){_0x13dd0c(null,_[_0x031f('0x45')](_0x14fd99)?![]:!![]);})['catch'](function(_0x58f012){logger[_0x031f('0x2a')](_0x58f012);_0x13dd0c(null,![]);});};AGIVertices[_0x031f('0xf')][_0x031f('0x57')]=function(_0x1d973d,_0x6d85c8){sh[_0x031f('0x58')](_[_0x031f('0x59')](_0x1d973d),function(_0x5c99c6,_0x4e3384){var _0x4bd283=_0x4e3384['replace'](/(\r\n|\n|\r)/gm,'');_0x6d85c8(null,_0x4bd283);});};AGIVertices[_0x031f('0xf')][_0x031f('0x5a')]=function(_0x45977a,_0x4fb931){scripts[_0x031f('0x5a')](_0x45977a[_0x031f('0x5b')],_0x45977a['google_cloud_tts_text_type']||_0x031f('0x5c'),_0x45977a[_0x031f('0x5c')],_0x45977a[_0x031f('0x5d')]||_0x031f('0x5e'),_0x45977a[_0x031f('0x5f')]||_0x031f('0x60'),_0x45977a[_0x031f('0x61')]||'MP3')['then'](function(_0x8a448f){_0x4fb931(null,_0x8a448f);})['catch'](function(_0x2ed9c1){_0x4fb931(_0x2ed9c1);});};AGIVertices['prototype'][_0x031f('0x62')]=function(_0x1cefb8,_0x3424c9){scripts['googleTTS'](_0x1cefb8[_0x031f('0x5c')],_0x1cefb8['google_tts_language']||'en',0x1)[_0x031f('0x12')](function(_0xffb00){_0x3424c9(null,_0xffb00);})[_0x031f('0x14')](function(_0x4e7251){_0x3424c9(_0x4e7251);});};AGIVertices[_0x031f('0xf')][_0x031f('0x63')]=function(_0x3c4b09,_0x3e3ff5){var _0x45330f={'uri':_0x3c4b09['url'],'method':_0x3c4b09['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3c4b09[_0x031f('0x64')])===_0x031f('0x65')&&parseInt(_0x3c4b09['timeout'])>=0x1?parseInt(_0x3c4b09[_0x031f('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x031f('0x66'),_0x031f('0x67')],_0x45330f[_0x031f('0x68')][_0x031f('0x69')]())){try{_0x45330f['body']=_0x3c4b09[_0x031f('0x6a')]?JSON[_0x031f('0x6b')](_0x3c4b09[_0x031f('0x6a')]):{};}catch(_0x5b336f){logger[_0x031f('0x2a')](_0x031f('0x6c'),_0x5b336f);}}try{_0x45330f['headers']=_0x3c4b09[_0x031f('0x8')]?JSON[_0x031f('0x6b')](_0x3c4b09[_0x031f('0x8')]):{};}catch(_0x2fb2a8){logger[_0x031f('0x2a')](_0x031f('0x6d'),_0x2fb2a8);}if(_0x3c4b09[_0x031f('0x6e')]){try{var _0x596280=require(_0x3c4b09[_0x031f('0x6e')])[_0x031f('0x6f')](this,_0x45330f);_0x45330f[_0x031f('0x70')]=Mustache['render'](_0x3c4b09['url'],_0x596280,{},['$$','$$']);if(_0x45330f[_0x031f('0x71')]){_0x45330f['headers']=JSON['parse'](Mustache[_0x031f('0x72')](JSON[_0x031f('0x73')](_0x45330f[_0x031f('0x71')]),_0x596280,{},['$$','$$']));}if(_0x45330f[_0x031f('0x74')]){_0x45330f[_0x031f('0x74')]=JSON[_0x031f('0x6b')](Mustache[_0x031f('0x72')](JSON[_0x031f('0x73')](_0x45330f[_0x031f('0x74')]),_0x596280,{},['$$','$$']));}}catch(_0x30a3ea){logger[_0x031f('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x30a3ea);}}rp(_0x45330f)[_0x031f('0x12')](function(_0x2d867f){var _0x1f4ecf={'statusCode':_0x2d867f[_0x031f('0x75')]||0xc8,'statusMessage':_0x2d867f['statusMessage']||'OK','headers':_0x2d867f[_0x031f('0x71')]||{},'body':_0x2d867f['body']||{}};_0x3e3ff5(null,_0x1f4ecf);})['catch'](function(_0x22ce8a){var _0x2f4d09={'statusCode':_0x22ce8a['statusCode']||0x1f4,'statusMessage':_0x22ce8a['message']||_0x031f('0x76'),'headers':_0x22ce8a[_0x031f('0x77')][_0x031f('0x71')]||{},'body':_0x22ce8a[_0x031f('0x77')][_0x031f('0x74')]||{}};_0x3e3ff5(null,_0x2f4d09);});};AGIVertices[_0x031f('0xf')]['googleDialogflow']=function(_0x263658,_0x420f81){scripts['googleDialogflow'](this[_0x031f('0xc')][_0x031f('0x43')],_0x263658[_0x031f('0x78')],_0x263658[_0x031f('0x5c')],_0x263658[_0x031f('0x79')]||'en')[_0x031f('0x12')](function(_0x8741ff){_0x420f81(null,_0x8741ff);})['catch'](function(_0x412394){_0x420f81(_0x412394);});};AGIVertices['prototype'][_0x031f('0x7a')]=function(_0x1d5d61,_0x388ada){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x1d5d61[_0x031f('0x7b')],_0x1d5d61[_0x031f('0x7c')],_0x1d5d61[_0x031f('0x7d')],_0x1d5d61[_0x031f('0x5c')],_0x1d5d61[_0x031f('0x7e')]||'en')[_0x031f('0x12')](function(_0x232aa0){_0x388ada(null,_0x232aa0);})['catch'](function(_0x59995e){_0x388ada(_0x59995e);});};AGIVertices[_0x031f('0xf')][_0x031f('0x7f')]=function(_0x54d86e,_0xc2d0b1){scripts['sestekNDA'](this[_0x031f('0xc')],_0x54d86e)[_0x031f('0x12')](function(_0x5a6db6){_0xc2d0b1(null,_0x5a6db6);})[_0x031f('0x14')](function(_0x37af05){_0xc2d0b1(_0x37af05);});};AGIVertices['prototype'][_0x031f('0x80')]=function(_0x3c7dee,_0x1b588e){scripts['ispeechTTS'](_0x3c7dee[_0x031f('0x78')],_0x3c7dee[_0x031f('0x5c')],_0x3c7dee[_0x031f('0x81')]||_0x031f('0x5e'),_0x3c7dee[_0x031f('0x82')])[_0x031f('0x12')](function(_0x47ed2c){_0x1b588e(null,_0x47ed2c);})[_0x031f('0x14')](function(_0x1d64f9){_0x1b588e(_0x1d64f9);});};AGIVertices[_0x031f('0xf')][_0x031f('0x83')]=function(_0x4ef395,_0x33bf51,_0x467a76){scripts['ispeechASR'](_0x33bf51,_0x4ef395[_0x031f('0x78')],_0x4ef395[_0x031f('0x84')]||_0x031f('0x5e'),this[_0x031f('0x85')](_0x4ef395[_0x031f('0x86')])?_0x4ef395[_0x031f('0x86')]:undefined)[_0x031f('0x12')](function(_0xb35eef){_0x467a76(null,_0xb35eef);})[_0x031f('0x14')](function(_0x2ffe65){_0x467a76(_0x2ffe65);});};AGIVertices[_0x031f('0xf')][_0x031f('0x87')]=function(_0x4b077c,_0x24b834){scripts[_0x031f('0x87')](_0x4b077c['aws_access_key_id'],_0x4b077c[_0x031f('0x88')],_0x4b077c[_0x031f('0x89')],_0x4b077c[_0x031f('0x8a')]||_0x031f('0x8b'),_0x4b077c[_0x031f('0x5c')],_0x4b077c[_0x031f('0x8c')]||'text')['then'](function(_0x5acc87){_0x24b834(null,_0x5acc87);})[_0x031f('0x14')](function(_0x3840d4){_0x24b834(_0x3840d4);});};AGIVertices['prototype'][_0x031f('0x8d')]=function(_0x303cfa,_0x342eb9){scripts[_0x031f('0x8d')](this['channel'][_0x031f('0x43')],_0x303cfa[_0x031f('0x8e')],_0x303cfa[_0x031f('0x88')],_0x303cfa[_0x031f('0x8f')],_0x303cfa[_0x031f('0x5c')],_0x303cfa[_0x031f('0x90')])[_0x031f('0x12')](function(_0x1c0f3f){_0x342eb9(null,_0x1c0f3f);})[_0x031f('0x14')](function(_0x3a798a){_0x342eb9(_0x3a798a);});};AGIVertices[_0x031f('0xf')][_0x031f('0x91')]=function(_0x4bd749,_0x2541fd,_0x1f1f0e){scripts['googleASR'](_0x2541fd,_0x4bd749[_0x031f('0x78')],_0x4bd749[_0x031f('0x92')]||'en-US')[_0x031f('0x12')](function(_0x3bc88c){_0x1f1f0e(null,_0x3bc88c);})[_0x031f('0x14')](function(_0x314e0c){_0x1f1f0e(_0x314e0c);});};AGIVertices[_0x031f('0xf')][_0x031f('0x93')]=function(_0x134c48,_0x3cd2b1,_0x2e0e24){scripts['tildeASR'](_0x3cd2b1,_0x134c48[_0x031f('0x94')],_0x134c48[_0x031f('0x95')],_0x134c48[_0x031f('0x70')])['then'](function(_0x54b17b){_0x2e0e24(null,_0x54b17b);})[_0x031f('0x14')](function(_0x56ffc4){_0x2e0e24(_0x56ffc4);});};AGIVertices[_0x031f('0xf')][_0x031f('0x96')]=function(_0x4a96f2){var _0x1393bc=_[_0x031f('0x97')](verticesWithRetry,_0x4a96f2[_0x031f('0x37')])?_0x4a96f2:_[_0x031f('0x98')](_0x4a96f2);for(var _0x1d2143 in _0x1393bc){if(_0x1393bc[_0x031f('0x99')](_0x1d2143)){if(_0x1393bc[_0x1d2143]&&_[_0x031f('0x9a')](_0x1393bc[_0x1d2143])){if(_[_0x031f('0x97')](recursiveMapAttributes,_0x1d2143)){_0x1393bc[_0x1d2143]=this[_0x031f('0x9b')](_0x1393bc[_0x1d2143]);}else{_0x1393bc[_0x1d2143]=this[_0x031f('0x9c')](_0x1393bc[_0x1d2143]);}}}}return _0x1393bc;};AGIVertices[_0x031f('0xf')][_0x031f('0x9d')]=function(_0x21cff4){for(var _0x51c6c3 in _0x21cff4){if(_0x21cff4['hasOwnProperty'](_0x51c6c3)){if(_[_0x031f('0x9e')](_0x21cff4[_0x51c6c3])){this['recursiveNodeIndex'](_0x21cff4[_0x51c6c3]);}else if(_[_0x031f('0x9f')](_0x21cff4[_0x51c6c3])){for(var _0x48d4f2=0x0;_0x48d4f2<_0x21cff4[_0x51c6c3][_0x031f('0xa0')];_0x48d4f2++){this['recursiveNodeIndex'](_0x21cff4[_0x51c6c3][_0x48d4f2]);}}else if(_[_0x031f('0x9a')](_0x21cff4[_0x51c6c3])){_0x21cff4[_0x51c6c3]=this[_0x031f('0x9c')](_0x21cff4[_0x51c6c3]);}}}};AGIVertices['prototype'][_0x031f('0xa1')]=function(_0x2af84d,_0x124d51){for(var _0x144f72 in _0x2af84d){if(_0x2af84d[_0x031f('0x99')](_0x144f72)){if(_[_0x031f('0x9e')](_0x2af84d[_0x144f72])){if(!_[_0x031f('0x48')](_0x2af84d[_0x144f72])){this['saveRestApiResult'](_0x2af84d[_0x144f72],util[_0x031f('0xa2')](_0x031f('0xa3'),_0x124d51,_0x144f72));}}else if(_[_0x031f('0x9f')](_0x2af84d[_0x144f72])){for(var _0x46c69b=0x0;_0x46c69b<_0x2af84d[_0x144f72]['length'];_0x46c69b++){this['saveRestApiResult'](_0x2af84d[_0x144f72][_0x46c69b],util[_0x031f('0xa2')]('%s.%s',_0x124d51,_0x144f72+'['+_0x46c69b+']'));}}else{if(!_['isNil'](_0x2af84d[_0x144f72])){this[_0x031f('0xc')]['setVariable'](util['format'](_0x031f('0xa3'),_0x124d51,_0x144f72),_0x2af84d[_0x144f72]);}}}}};AGIVertices[_0x031f('0xf')][_0x031f('0x9b')]=function(_0x6551b6){try{var _0x605634=JSON[_0x031f('0x6b')](_0x6551b6);this['recursiveNodeIndex'](_0x605634);return JSON[_0x031f('0x73')](_0x605634);}catch(_0x2a7a02){return this['replaceAllVariables'](_0x6551b6);}};AGIVertices[_0x031f('0xf')][_0x031f('0x9c')]=function(_0x30c32f){var _0x352dad=_0x30c32f['split']('{');for(var _0x568574=0x1;_0x568574<_0x352dad['length'];_0x568574+=0x1){var _0x1502e4=_0x352dad[_0x568574][_0x031f('0xa4')]('}');if(_0x1502e4[_0x031f('0xa0')]>0x1){_0x30c32f=_0x30c32f[_0x031f('0xa5')]('{'+_0x1502e4[0x0]+'}',this[_0x031f('0xc')][_0x031f('0x10')](_0x1502e4[0x0])[_0x031f('0xa6')]||_0x1502e4[0x0]);}}if(_0x352dad[_0x031f('0xa0')]===0x1){return _0x30c32f[_0x031f('0xa7')]();}return this['replaceAllVariables'](_0x30c32f);};AGIVertices[_0x031f('0xf')][_0x031f('0xa8')]=function(_0x2f6c1b,_0x460cbb){var _0x38a31f=this['channel']['getVariable'](_0x2f6c1b);if(_0x38a31f['result']===-0x1){return _0x38a31f;}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xa9'),_0x460cbb,_0x38a31f[_0x031f('0xa6')]));return this['channel'][_0x031f('0xaa')](_0x460cbb,_0x38a31f['extra']);};AGIVertices[_0x031f('0xf')][_0x031f('0x85')]=function(_0x24aff3){return _0x24aff3&&_0x24aff3!=='0'&&_0x24aff3!=='-1'&&_0x24aff3!=='';};AGIVertices[_0x031f('0xf')][_0x031f('0xab')]=function(_0x498930){this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x498930,'-');_0x498930[_0x031f('0xac')]=_0x498930[_0x031f('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x031f('0xad')]=function(_0x2cf76a){logger['info'](util[_0x031f('0xa2')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2cf76a[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x2cf76a[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20text\x20configured');}var _0xab715d='\x22'+_0x2cf76a['text']+'\x22';if(this[_0x031f('0x85')](_0x2cf76a[_0x031f('0x77')])){_0xab715d+=','+_0x2cf76a['options'];}var _0x1fd20c=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xaf'),_0xab715d);if(_0x1fd20c[_0x031f('0xb0')]===-0x1){return _0x1fd20c;}return this['channel']['noop'](util['format'](_0x031f('0xb1'),_0xab715d));};AGIVertices['prototype'][_0x031f('0xb2')]=function(_0x22de62){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xb3'),_0x22de62['label']));if(!this[_0x031f('0x85')](_0x22de62['grammar'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xb4'));}var _0x54090d=_0x22de62[_0x031f('0xb5')];if(this[_0x031f('0x85')](_0x22de62[_0x031f('0x77')])){_0x54090d+=','+_0x22de62[_0x031f('0x77')];}var _0x5b092c=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xb6'),_0x54090d);if(_0x5b092c[_0x031f('0xb0')]===-0x1){return _0x5b092c;}var _0x4ac7f1=this[_0x031f('0xa8')]('RECOG_CONFIDENCE()',_0x031f('0xb7'));if(_0x4ac7f1[_0x031f('0xb0')]===-0x1){return _0x4ac7f1;}var _0x38e937=this[_0x031f('0xa8')](_0x031f('0xb8'),_0x031f('0xb9'));if(_0x38e937[_0x031f('0xb0')]===-0x1){return _0x38e937;}var _0x4a3d68=this[_0x031f('0xa8')](_0x031f('0xba'),_0x031f('0xbb'));if(_0x4a3d68[_0x031f('0xb0')]===-0x1){return _0x4a3d68;}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xbc'),_0x54090d));};AGIVertices[_0x031f('0xf')][_0x031f('0x7')]=function(_0x33abc7){logger['info'](util[_0x031f('0xa2')](_0x031f('0xbd'),_0x33abc7[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0x7')]([_0x33abc7['command'],_0x33abc7['args']]);};AGIVertices[_0x031f('0xf')][_0x031f('0xbe')]=function(_0x481ec4){logger[_0x031f('0x2c')](util['format'](_0x031f('0xbf'),_0x481ec4[_0x031f('0x36')]));if(this[_0x031f('0x85')](_0x481ec4[_0x031f('0x64')])){logger['info'](util['format'](_0x031f('0xc0'),_0x481ec4[_0x031f('0x64')]));var _0x2274bc=this[_0x031f('0xc')]['wait'](_0x481ec4[_0x031f('0x64')]);if(_0x2274bc[_0x031f('0xb0')]===-0x1){return _0x2274bc;}}return this[_0x031f('0xc')]['answer']();};AGIVertices[_0x031f('0xf')][_0x031f('0x4c')]=function(_0x233e8a){logger['info'](util[_0x031f('0xa2')](_0x031f('0xc1'),_0x233e8a[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x233e8a[_0x031f('0x4b')])){return this['channel'][_0x031f('0x2a')](_0x233e8a,_0x031f('0xc2'));}_0x233e8a[_0x031f('0x4d')]=moment();if(this[_0x031f('0x85')](_0x233e8a[_0x031f('0xc3')])){_0x233e8a[_0x031f('0x4d')]=moment()['add'](_0x233e8a['delay'],_0x031f('0xc4'));}if(!this[_0x031f('0x85')](_0x233e8a[_0x031f('0x4e')])){_0x233e8a[_0x031f('0x4e')]=0x2;}this[_0x031f('0x44')][_0x031f('0x6f')](this,_0x233e8a);return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xc5'),_0x233e8a[_0x031f('0x4a')],_0x233e8a[_0x031f('0x4b')],_0x233e8a[_0x031f('0x4d')]));};AGIVertices[_0x031f('0xf')][_0x031f('0xc6')]=function(_0x366710){logger['info'](util[_0x031f('0xa2')](_0x031f('0xc7'),_0x366710['label']));var _0x19a5d4=this[_0x031f('0xc')][_0x031f('0x58')](_0x366710[_0x031f('0xc8')],_0x366710[_0x031f('0x77')]);if(_0x19a5d4['result']===-0x1){return _0x19a5d4;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x366710['application'],_0x366710['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x110ef2){logger['info'](util[_0x031f('0xa2')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x110ef2[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x110ef2[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}var _0x817f3d='\x22'+_0x110ef2['text']+'\x22';if(this[_0x031f('0x85')](_0x110ef2[_0x031f('0x77')])){_0x817f3d+=','+_0x110ef2[_0x031f('0x77')];}var _0xefc45f=this[_0x031f('0xc')]['exec'](_0x031f('0xaf'),_0x817f3d);if(_0xefc45f[_0x031f('0xb0')]===-0x1){return _0xefc45f;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xb1'),_0x817f3d));};AGIVertices[_0x031f('0xf')][_0x031f('0xcb')]=function(_0x20bd74){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x20bd74[_0x031f('0x36')]));if(!this['isConfigured'](_0x20bd74[_0x031f('0x5c')])){return this['channel'][_0x031f('0xae')](_0x031f('0xca'));}var _0x4bf1c0='\x22'+_0x20bd74[_0x031f('0x5c')]+'\x22';if(this[_0x031f('0x85')](_0x20bd74['options'])){_0x4bf1c0+=','+_0x20bd74['options'];}var _0x17df22=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xaf'),_0x4bf1c0);if(_0x17df22[_0x031f('0xb0')]===-0x1){return _0x17df22;}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4bf1c0));};AGIVertices['prototype']['lumenvoxasr']=function(_0x1fb810){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xcc'),_0x1fb810[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x1fb810[_0x031f('0xb5')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xb4'));}var _0x24f859=_0x1fb810[_0x031f('0xb5')];if(this[_0x031f('0x85')](_0x1fb810['options'])){_0x24f859+=','+_0x1fb810[_0x031f('0x77')];}var _0x1d353f=this[_0x031f('0xc')][_0x031f('0x58')]('MRCPRecog',_0x24f859);if(_0x1d353f['result']===-0x1){return _0x1d353f;}var _0x538697=this[_0x031f('0xa8')](_0x031f('0xcd'),_0x031f('0xce'));if(_0x538697['result']===-0x1){return _0x538697;}var _0x5d46cf=this[_0x031f('0xa8')](_0x031f('0xb8'),_0x031f('0xcf'));if(_0x5d46cf[_0x031f('0xb0')]===-0x1){return _0x5d46cf;}var _0x441874=this[_0x031f('0xa8')](_0x031f('0xba'),_0x031f('0xd0'));if(_0x441874[_0x031f('0xb0')]===-0x1){return _0x441874;}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')]('Executed\x20command\x20MRCPRecog\x20%s',_0x24f859));};AGIVertices['prototype']['sestekasr']=function(_0x14977a){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xd1'),_0x14977a[_0x031f('0x36')]));if(!this['isConfigured'](_0x14977a['grammar'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xb4'));}var _0x2d2d9f=_0x14977a[_0x031f('0xb5')];if(this[_0x031f('0x85')](_0x14977a['options'])){_0x2d2d9f+=','+_0x14977a[_0x031f('0x77')];}var _0x519ff5=this[_0x031f('0xc')][_0x031f('0x58')]('MRCPRecog',_0x2d2d9f);if(_0x519ff5['result']===-0x1){return _0x519ff5;}var _0x2433d6=this[_0x031f('0xa8')](_0x031f('0xcd'),_0x031f('0xd2'));if(_0x2433d6[_0x031f('0xb0')]===-0x1){return _0x2433d6;}var _0x41c07d=this[_0x031f('0xa8')](_0x031f('0xb8'),_0x031f('0xd3'));if(_0x41c07d[_0x031f('0xb0')]===-0x1){return _0x41c07d;}var _0x6c24bc=this[_0x031f('0xa8')](_0x031f('0xba'),_0x031f('0xd4'));if(_0x6c24bc[_0x031f('0xb0')]===-0x1){return _0x6c24bc;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2d2d9f));};AGIVertices[_0x031f('0xf')]['database']=function(_0x3a8aa6){logger[_0x031f('0x2c')](util['format'](_0x031f('0xd5'),_0x3a8aa6[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3a8aa6[_0x031f('0xd6')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a8aa6,'no\x20database\x20selected');}var _0xb29553=this[_0x031f('0x17')]['sync'](this,_0x3a8aa6[_0x031f('0xd6')]);if(!_0xb29553){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a8aa6,_0x031f('0xd7'));}if(!this[_0x031f('0x85')](_0x3a8aa6[_0x031f('0x2e')])){return this['channel'][_0x031f('0x2a')](_0x3a8aa6,'no\x20query\x20configured');}var _0x548dd1=_0x3a8aa6[_0x031f('0x2e')][_0x031f('0xd8')](/(\r\n|\n|\r)/gm,'\x20');this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xd9'),_0x548dd1));var _0x3c8afe=this['getQueryOdbc'][_0x031f('0x6f')](this,_0xb29553,_0x548dd1);this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x3a8aa6,_0x548dd1);if(!this['isConfigured'](_0x3a8aa6[_0x031f('0xda')])){return this['channel']['noop'](_0x031f('0xdb'));}var _0x1efec5=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x3a8aa6[_0x031f('0xda')]);if(!_0x1efec5){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a8aa6,_0x031f('0xdc'));}var _0x51bf59=this;_0x3c8afe[_0x031f('0xdd')](function(_0x4243c9,_0x257153){Object[_0x031f('0xde')](_0x4243c9)['forEach'](function(_0x400513){_0x51bf59[_0x031f('0xc')][_0x031f('0xaa')](util['format']('%s[%s][%s]',_0x1efec5,_0x257153,_0x400513),_0x4243c9[_0x400513]);});});this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0xdf'),_0x1efec5),_0x3c8afe[_0x031f('0xa0')]);return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xe0'),_0x1efec5));};AGIVertices['prototype'][_0x031f('0xe1')]=function(_0x7f92c1){logger[_0x031f('0xe2')](util[_0x031f('0xa2')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x7f92c1[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x7f92c1[_0x031f('0xe3')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x7f92c1,_0x031f('0xe4'));}var _0x425ea3=this['getUser'][_0x031f('0x6f')](this,_0x7f92c1['sip_id']);if(!_0x425ea3){return this[_0x031f('0xc')]['error'](_0x7f92c1,_0x031f('0xe5'));}var _0x552f78=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xe6'),[util['format'](_0x031f('0xe7'),_0x425ea3),_0x7f92c1[_0x031f('0x64')],_0x7f92c1[_0x031f('0xe8')],_0x7f92c1[_0x031f('0xe9')]]);if(_0x552f78[_0x031f('0xb0')]===-0x1){return _0x552f78;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xea'),'DIAL'));};AGIVertices[_0x031f('0xf')][_0x031f('0xeb')]=function(_0x3909fc){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xec'),_0x3909fc[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3909fc['key'])){return this['channel'][_0x031f('0xae')]('no\x20key\x20configured');}if(!this[_0x031f('0x85')](_0x3909fc['text'])){return this['channel'][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xed')]=!![];this[_0x031f('0x35')](_0x3909fc);this['createSquareMessage'](_0x3909fc[_0x031f('0x5c')],'in','','');this['channel'][_0x031f('0xae')](util['format']('Trying\x20Dialogflow:\x20%s',_0x3909fc[_0x031f('0x5c')]));var _0x2b0b30=this[_0x031f('0xee')][_0x031f('0x6f')](this,_0x3909fc);if(_0x2b0b30){for(var _0x363acf in _0x2b0b30){if(_0x2b0b30['hasOwnProperty'](_0x363acf)){this['channel']['setVariable'](util[_0x031f('0xa2')]('DIALOGFLOW_%s',_0x363acf[_0x031f('0x69')]()),_0x2b0b30[_0x363acf]);}}this[_0x031f('0x42')](_0x2b0b30['speech'],_0x031f('0xef'),_0x031f('0xeb'),'');return this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0xf0'),_0x2b0b30[_0x031f('0xf1')]));}return this[_0x031f('0xc')]['error'](_0x3909fc,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x031f('0xf')]['dialogflowV2']=function(_0x577da0){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0xf2'),_0x577da0['label']));if(!this['isConfigured'](_0x577da0[_0x031f('0x7b')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xf3'));}if(!this[_0x031f('0x85')](_0x577da0[_0x031f('0x7c')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20client_email\x20configured');}if(!this[_0x031f('0x85')](_0x577da0[_0x031f('0x7d')])){return this[_0x031f('0xc')]['noop'](_0x031f('0xf4'));}if(!this['isConfigured'](_0x577da0[_0x031f('0x7e')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xf5'));}if(!this[_0x031f('0x85')](_0x577da0[_0x031f('0x5c')])){return this['channel'][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')]['bot']=!![];this[_0x031f('0x35')](_0x577da0);this[_0x031f('0x42')](_0x577da0['text'],'in','','');this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Trying\x20DialogflowV2:\x20%s',_0x577da0['text']));var _0x365859=this[_0x031f('0x7a')][_0x031f('0x6f')](this,_0x577da0);if(_0x365859){for(var _0x41d156 in _0x365859){if(_0x365859[_0x031f('0x99')](_0x41d156)){if(_0x41d156!==_0x031f('0xf6')){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')]('DIALOGFLOW_%s',_0x41d156[_0x031f('0x69')]()),_0x365859[_0x41d156]);}}}this[_0x031f('0x42')](_0x365859[_0x031f('0xf1')],_0x031f('0xef'),'dialogflowV2',_0x365859['providerResponse']);return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xf7'),_0x365859['speech']));}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x577da0,_0x031f('0xf8'));};AGIVertices['prototype'][_0x031f('0xf9')]=function(_0x35a723){logger['info'](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x35a723[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x35a723[_0x031f('0xfa')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xfb'));}if(!this[_0x031f('0x85')](_0x35a723['username'])){return this[_0x031f('0xc')]['noop'](_0x031f('0xfc'));}if(!this[_0x031f('0x85')](_0x35a723['password'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xfd'));}if(!this[_0x031f('0x85')](_0x35a723[_0x031f('0xfe')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this['channel'][_0x031f('0xed')]=!![];this[_0x031f('0x35')](_0x35a723);this[_0x031f('0x42')](_0x35a723['text'],'in','','');this['channel'][_0x031f('0xae')](util['format'](_0x031f('0xff'),_0x35a723['text']));var _0x5b832d=this['sestekNDA'][_0x031f('0x6f')](this,_0x35a723);if(_0x5b832d){for(var _0x2ca4a6 in _0x5b832d){if(_0x5b832d[_0x031f('0x99')](_0x2ca4a6)){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')]('SESTEK_NDA_%s',_0x2ca4a6[_0x031f('0x69')]()),_0x5b832d[_0x2ca4a6]);}}this['createSquareMessage'](_0x5b832d['speech'],'out',_0x031f('0xf9'),'');if(_0x5b832d[_0x031f('0x100')]){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x101'),_0x5b832d[_0x031f('0x100')]));var _0x401c22=this[_0x031f('0xc')][_0x031f('0x102')](_0x5b832d['audiofile']);try{fs[_0x031f('0x103')](_0x5b832d[_0x031f('0x100')]+_0x031f('0x104'));}catch(_0x222bdb){logger['error'](_0x222bdb);}return _0x401c22;}else{return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0x105'),_0x5b832d[_0x031f('0xf1')]));}}return this['channel'][_0x031f('0x2a')](_0x35a723,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x031f('0xf')][_0x031f('0x106')]=function(_0x1f6c23){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1f6c23[_0x031f('0x36')]));return this[_0x031f('0xc')]['noop']('end');};AGIVertices['prototype'][_0x031f('0x107')]=function(_0x3a3058){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x108'),_0x3a3058[_0x031f('0x36')]));var _0x42cf58='';if(_0x3a3058['trunk_id']){if(!this[_0x031f('0x85')](_0x3a3058[_0x031f('0x109')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a3058,'no\x20trunk\x20selected');}else{var _0x119db3=parseInt(_0x3a3058[_0x031f('0x109')],0xa);if(isNaN(_0x119db3)){_0x42cf58=_0x3a3058[_0x031f('0x109')];}else{_0x42cf58=this['getTrunk'][_0x031f('0x6f')](this,_0x3a3058['trunk_id']);if(!_0x42cf58){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a3058,_0x031f('0x10a'));}}}}else if(_0x3a3058[_0x031f('0x10b')]){_0x42cf58=_0x3a3058[_0x031f('0x10b')];}else{return this[_0x031f('0xc')][_0x031f('0x2a')](_0x3a3058,_0x031f('0x10c'));}var _0x17d422=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0xe6'),[util[_0x031f('0xa2')]('SIP/%s/%s',_0x42cf58,_0x3a3058[_0x031f('0x4a')]),_0x3a3058[_0x031f('0x64')],_0x3a3058['opts'],_0x3a3058[_0x031f('0xe9')]]);if(_0x17d422[_0x031f('0xb0')]===-0x1){return _0x17d422;}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x031f('0xf')]['finally']=function(_0x303ca9){logger['info'](util[_0x031f('0xa2')](_0x031f('0x10d'),_0x303ca9[_0x031f('0x36')]));return this['channel']['noop'](_0x031f('0x10e'));};AGIVertices[_0x031f('0xf')][_0x031f('0xa')]=function(_0x4ee78c){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4ee78c['label']));if(_0x4ee78c[_0x031f('0xac')]===0x0){return this[_0x031f('0xab')](_0x4ee78c);}_0x4ee78c[_0x031f('0xac')]-=0x1;if(!this[_0x031f('0x85')](_0x4ee78c[_0x031f('0x10f')])){return this['channel']['error'](_0x4ee78c,_0x031f('0x110'));}var _0x2e9167=this['getSound'][_0x031f('0x6f')](this,_0x4ee78c[_0x031f('0x10f')]);if(!_0x2e9167){return this['channel'][_0x031f('0x2a')](_0x4ee78c,_0x031f('0x111'));}if(!this['isConfigured'](_0x4ee78c[_0x031f('0xda')])){return this[_0x031f('0xc')]['error'](_0x031f('0xdb'));}var _0x35a7fa=this[_0x031f('0xc')]['getData'](_0x2e9167,_0x4ee78c[_0x031f('0x112')],_0x4ee78c['maxdigit']);var _0x7362fa=_0x35a7fa[_0x031f('0xb0')]?_0x35a7fa[_0x031f('0xb0')][_0x031f('0xa7')]():'';logger[_0x031f('0x2c')](_0x031f('0x113'),JSON['stringify'](_0x35a7fa));if(_0x35a7fa[_0x031f('0xb0')]===-0x1){this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x4ee78c,_0x7362fa);return _0x35a7fa;}else if(_0x35a7fa[_0x031f('0xa6')]===_0x031f('0x64')){_0x35a7fa['result']=_0x7362fa[_0x031f('0xa0')]>=parseInt(_0x4ee78c[_0x031f('0x114')])?'x':'i';}else{_0x35a7fa[_0x031f('0xb0')]=_0x7362fa[_0x031f('0xa0')]>=parseInt(_0x4ee78c[_0x031f('0x114')])&&_0x7362fa[_0x031f('0xa0')]<=parseInt(_0x4ee78c[_0x031f('0x115')])?'x':'i';}var _0x164886=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x4ee78c[_0x031f('0xda')]);if(!_0x164886){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x4ee78c,'no\x20variable\x20found');}this[_0x031f('0xc')][_0x031f('0xaa')](_0x164886,_0x7362fa);if(this[_0x031f('0x85')](_0x4ee78c[_0x031f('0x116')])){var _0x2d9a17=parseInt(_0x4ee78c['hiddendigitsnum'],0xa);var _0x143a26=rs[_0x031f('0x117')]({'charset':'*','length':_0x2d9a17});var _0x51f375=_0x7362fa['length'];if(_0x51f375>0x0){if(_0x51f375>_0x2d9a17){this[_0x031f('0x35')]['sync'](this,_0x4ee78c,_0x4ee78c[_0x031f('0x118')]===_0x031f('0x119')?_0x143a26+_0x7362fa[_0x031f('0x11a')](_0x2d9a17):_0x7362fa[_0x031f('0x11a')](0x0,_0x51f375-_0x2d9a17)+_0x143a26);}else{this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x4ee78c,rs['generate']({'charset':'*','length':_0x51f375}));}}else{this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x4ee78c,'');}}else{this[_0x031f('0x35')]['sync'](this,_0x4ee78c,_0x7362fa);}return _0x35a7fa;};AGIVertices[_0x031f('0xf')][_0x031f('0xb')]=function(_0x1855f2){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1855f2['label']));return this[_0x031f('0xa')](_0x1855f2);};AGIVertices[_0x031f('0xf')][_0x031f('0x11b')]=function(_0x11f0c2){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x11f0c2[_0x031f('0x36')]));this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x11f0c2,_0x11f0c2[_0x031f('0x11c')]);return this['channel']['noop'](util[_0x031f('0xa2')](_0x031f('0x11d'),_0x11f0c2[_0x031f('0x11c')]));};AGIVertices[_0x031f('0xf')]['awspolly']=function(_0x55d3be){logger[_0x031f('0x2c')](util['format'](_0x031f('0x11e'),_0x55d3be[_0x031f('0x36')]));if(!this['isConfigured'](_0x55d3be[_0x031f('0x8e')])||!this['isConfigured'](_0x55d3be[_0x031f('0x88')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x11f'));}if(!this[_0x031f('0x85')](_0x55d3be[_0x031f('0x5c')])){return this[_0x031f('0xc')]['noop'](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xae')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x55d3be[_0x031f('0x5c')]));var _0x4e801c=this[_0x031f('0x87')][_0x031f('0x6f')](this,_0x55d3be);if(_0x4e801c){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('aws\x20Polly\x20%s\x20file\x20created',_0x4e801c));var _0x2dac82=this[_0x031f('0xc')][_0x031f('0x102')](_0x4e801c);try{fs[_0x031f('0x103')](_0x4e801c+_0x031f('0x104'));}catch(_0x46c076){logger[_0x031f('0x2a')](_0x46c076);}return _0x2dac82;}return this[_0x031f('0xc')]['error'](_0x55d3be,_0x031f('0x120'));};AGIVertices['prototype']['awslex']=function(_0x2243ff){logger[_0x031f('0x2c')](util['format'](_0x031f('0x121'),_0x2243ff[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x2243ff[_0x031f('0x8e')])||!this[_0x031f('0x85')](_0x2243ff[_0x031f('0x88')])){return this['channel'][_0x031f('0xae')](_0x031f('0x11f'));}if(!this['isConfigured'](_0x2243ff[_0x031f('0x90')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x122'));}if(!this[_0x031f('0x85')](_0x2243ff['text'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this['channel'][_0x031f('0xed')]=!![];this['createSquareDetailsReport'](_0x2243ff);this[_0x031f('0x42')](_0x2243ff[_0x031f('0x5c')],'in','','');this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0x123'),_0x2243ff[_0x031f('0x5c')]));var _0x3509e3=this[_0x031f('0x8d')][_0x031f('0x6f')](this,_0x2243ff);if(_0x3509e3){for(var _0x3e3f24 in _0x3509e3){if(_0x3509e3[_0x031f('0x99')](_0x3e3f24)&&_[_0x031f('0x9a')](_0x3509e3[_0x3e3f24])){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x124'),_0x3e3f24[_0x031f('0x69')]()),_0x3509e3[_0x3e3f24]);}}if(_[_0x031f('0x45')](_0x3509e3[_0x031f('0x125')])){return this['channel'][_0x031f('0xae')](_0x031f('0x126'));}else{this[_0x031f('0x42')](_0x3509e3[_0x031f('0x125')],_0x031f('0xef'),_0x031f('0x127'),'');return this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0x128'),_0x3509e3[_0x031f('0x125')]));}}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x2243ff,_0x031f('0x129'));};AGIVertices[_0x031f('0xf')][_0x031f('0x12a')]=function(_0x255010){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x12b'),_0x255010[_0x031f('0x36')],_0x255010['timeout']));if(!this[_0x031f('0x85')](_0x255010[_0x031f('0x78')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x12c'));}var _0x247873=_0x031f('0x12d');var _0x117185=util['format'](_0x031f('0x12e'),FILES_PATH,rs[_0x031f('0x117')](0x4));var _0x1e71b1=util[_0x031f('0xa2')](_0x031f('0xa3'),_0x117185,_0x247873);var _0x251dc5=!![];if(_0x255010[_0x031f('0x12f')]===_0x031f('0x130')){_0x251dc5=![];}var _0x594acb=this[_0x031f('0xc')][_0x031f('0x131')](_0x117185,_0x247873,_0x255010[_0x031f('0x132')],_0x255010[_0x031f('0x64')],undefined,_0x251dc5);if(_0x594acb[_0x031f('0xb0')]!==-0x1){this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('google\x20%s\x20file\x20created',_0x1e71b1));var _0xb61d95=this[_0x031f('0x91')][_0x031f('0x6f')](this,_0x255010,_0x1e71b1);if(_0xb61d95){for(var _0x223bbd in _0xb61d95){if(_0xb61d95['hasOwnProperty'](_0x223bbd)){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x133'),_0x223bbd[_0x031f('0x69')]()),_0xb61d95[_0x223bbd]);}}return this['channel']['noop'](util[_0x031f('0xa2')](_0x031f('0x134'),JSON[_0x031f('0x73')](_0xb61d95)));}}return _0x594acb;};AGIVertices[_0x031f('0xf')][_0x031f('0x135')]=function(_0x56ea07){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x136'),_0x56ea07[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x56ea07['appid'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x137'));}if(!this[_0x031f('0x85')](_0x56ea07[_0x031f('0x95')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20appsecret\x20configured');}var _0x572e60=_0x031f('0x12d');var _0x95ab84=util['format'](_0x031f('0x12e'),FILES_PATH,rs[_0x031f('0x117')](0x4));var _0x45125d=util['format'](_0x031f('0xa3'),_0x95ab84,_0x572e60);var _0x145ace=!![];if(_0x56ea07[_0x031f('0x12f')]==='NOBEEP'){_0x145ace=![];}var _0x3956b6=this[_0x031f('0xc')][_0x031f('0x131')](_0x95ab84,_0x572e60,_0x56ea07['intKey'],_0x56ea07[_0x031f('0x64')],undefined,_0x145ace);if(_0x3956b6['result']!==-0x1){this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0x138'),_0x45125d));var _0x253a69=this[_0x031f('0x93')][_0x031f('0x6f')](this,_0x56ea07,_0x45125d);if(_0x253a69){for(var _0x2a35b7 in _0x253a69){if(_0x253a69['hasOwnProperty'](_0x2a35b7)){this[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x139'),_0x2a35b7[_0x031f('0x69')]()),_0x253a69[_0x2a35b7]);}}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x13a'),JSON[_0x031f('0x73')](_0x253a69)));}}return _0x3956b6;};AGIVertices['prototype'][_0x031f('0x13b')]=function(_0x5acbd3){logger['info'](util[_0x031f('0xa2')](_0x031f('0x13c'),_0x5acbd3['label']));return this['channel'][_0x031f('0x13d')](_0x5acbd3[_0x031f('0x3c')],_0x5acbd3['extension'],_0x5acbd3['priority']);};AGIVertices['prototype']['gotoif']=function(_0x37baed){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x13e'),_0x37baed['label']));if(!this[_0x031f('0x85')](_0x37baed['condition'])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x37baed,'no\x20condition\x20configured');}try{var _0x4f61ee=eval(_0x37baed[_0x031f('0x13f')])?_0x031f('0x140'):_0x031f('0x141');this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('EVAL\x20CONDITION\x20%s\x20%s',_0x37baed['condition'],_0x4f61ee));return{'code':0xc8,'result':_0x4f61ee};}catch(_0x1b66bd){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x031f('0xf')]['gotoiftime']=function(_0x3d5bf6){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x142'),_0x3d5bf6[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3d5bf6[_0x031f('0x143')])){return this['channel'][_0x031f('0x2a')](_0x3d5bf6,_0x031f('0x144'));}var _0x1dc23d=this[_0x031f('0x23')][_0x031f('0x6f')](this,_0x3d5bf6['interval_id']);if(!_0x1dc23d){return this['channel'][_0x031f('0x2a')](_0x3d5bf6,_0x031f('0x145'));}for(var _0x224ddf=0x0;_0x224ddf<_0x1dc23d[_0x031f('0xa0')];_0x224ddf+=0x1){var _0x3e1e54=this[_0x031f('0xc')][_0x031f('0x10')](util[_0x031f('0xa2')](_0x031f('0x146'),_0x1dc23d[_0x224ddf]));if(_0x3e1e54['result']===-0x1){return _0x3e1e54;}logger['info'](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],_0x3e1e54['extra']));if(_0x3e1e54[_0x031f('0xa6')]===_0x031f('0x140')){logger['info'](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],_0x031f('0x140')));this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],_0x031f('0x140')));return{'code':0xc8,'result':'true'};}else{logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],'false'));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x147'),_0x1dc23d[_0x224ddf],'false'));}}return{'code':0xc8,'result':_0x031f('0x141')};};AGIVertices['prototype'][_0x031f('0x148')]=function(_0x1eb358){logger['info'](util[_0x031f('0xa2')](_0x031f('0x149'),_0x1eb358[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0x148')]();};AGIVertices[_0x031f('0xf')][_0x031f('0x14a')]=function(_0x1f5578){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x14b'),_0x1f5578[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x1f5578[_0x031f('0x78')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x12c'));}var _0x13f901='wav';var _0x71fe50=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x031f('0x117')](0x4));var _0x35947e=util[_0x031f('0xa2')]('%s.%s',_0x71fe50,_0x13f901);var _0xef9c9=!![];if(_0x1f5578[_0x031f('0x12f')]===_0x031f('0x130')){_0xef9c9=![];}var _0x472f13=this[_0x031f('0xc')][_0x031f('0x131')](_0x71fe50,_0x13f901,_0x1f5578['intKey'],_0x1f5578['timeout'],undefined,_0xef9c9);if(_0x472f13['result']!==-0x1){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('ispeech\x20%s\x20file\x20created',_0x35947e));var _0x5495b3=this['ispeechASR'][_0x031f('0x6f')](this,_0x1f5578,_0x35947e);if(_0x5495b3){for(var _0x3694ae in _0x5495b3){if(_0x5495b3[_0x031f('0x99')](_0x3694ae)){this[_0x031f('0xc')][_0x031f('0xaa')](util['format']('ISPEECH_ASR_%s',_0x3694ae[_0x031f('0x69')]()),_0x5495b3[_0x3694ae]);}}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x14c'),JSON[_0x031f('0x73')](_0x5495b3)));}}return _0x472f13;};AGIVertices[_0x031f('0xf')][_0x031f('0x14d')]=function(_0x306e31){logger[_0x031f('0x2c')](util['format'](_0x031f('0x14e'),_0x306e31['label']));if(!this[_0x031f('0x85')](_0x306e31[_0x031f('0x78')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x12c'));}if(!this['isConfigured'](_0x306e31[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x14f'),_0x306e31[_0x031f('0x5c')]));var _0xbf5c81=this[_0x031f('0x80')]['sync'](this,_0x306e31);if(_0xbf5c81){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x150'),_0xbf5c81));var _0x3ce468=this[_0x031f('0xc')][_0x031f('0x102')](_0xbf5c81,_0x306e31[_0x031f('0x132')]);try{fs[_0x031f('0x103')](_0xbf5c81+_0x031f('0x104'));}catch(_0xdcf2a8){logger[_0x031f('0x2a')](_0xdcf2a8);}return _0x3ce468;}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x306e31,_0x031f('0x151'));};AGIVertices['prototype'][_0x031f('0x152')]=function(_0x5c0bc8){logger[_0x031f('0x2c')](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x5c0bc8[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x5c0bc8['findBy'])){return this['channel'][_0x031f('0x2a')](_0x5c0bc8,_0x031f('0x153'));}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x154'),this[_0x031f('0xc')][_0x031f('0x39')],_0x5c0bc8[_0x031f('0x155')]));var _0x37532b=this[_0x031f('0x56')][_0x031f('0x6f')](this,_0x5c0bc8[_0x031f('0x155')]);if(_0x37532b){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x156'),this[_0x031f('0xc')][_0x031f('0x39')],_0x5c0bc8[_0x031f('0x155')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5c0bc8[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x157')};}else{logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')]['callerid'],_0x5c0bc8[_0x031f('0x155')]));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x031f('0xc')][_0x031f('0x39')],_0x5c0bc8[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x159')};}};AGIVertices[_0x031f('0xf')][_0x031f('0x15a')]=function(_0x87d5ce){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x15b'),_0x87d5ce[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x87d5ce['findBy'])){return this[_0x031f('0xc')]['error'](_0x87d5ce,'no\x20find\x20by\x20configured');}logger[_0x031f('0x2c')](util['format'](_0x031f('0x154'),this['channel'][_0x031f('0x39')],_0x87d5ce[_0x031f('0x155')]));var _0x2de828=this[_0x031f('0x52')][_0x031f('0x6f')](this,_0x87d5ce['findBy']);if(_0x2de828){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x156'),this[_0x031f('0xc')]['callerid'],_0x87d5ce[_0x031f('0x155')]));this[_0x031f('0xc')][_0x031f('0xae')](util['format'](_0x031f('0x156'),this[_0x031f('0xc')]['callerid'],_0x87d5ce['findBy']));return{'code':0xc8,'result':_0x031f('0x157')};}else{logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x158'),this['channel'][_0x031f('0x39')],_0x87d5ce[_0x031f('0x155')]));this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')][_0x031f('0x39')],_0x87d5ce[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x159')};}};AGIVertices['prototype'][_0x031f('0x15c')]=function(_0x3a35c3){logger[_0x031f('0x2c')](util['format'](_0x031f('0x15d'),_0x3a35c3[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x3a35c3[_0x031f('0x15e')])){return this['channel'][_0x031f('0x2a')](_0x3a35c3,'no\x20operation\x20configured');}this[_0x031f('0xc')]['noop'](util['format']('math\x20%s',_0x3a35c3[_0x031f('0x15e')]));var _0x39cb44=eval(_0x3a35c3[_0x031f('0x15e')]);if(!this[_0x031f('0x85')](_0x3a35c3['variable_id'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xdb'));}var _0xbc917a=this[_0x031f('0x10')]['sync'](this,_0x3a35c3[_0x031f('0xda')]);if(!_0xbc917a){return this[_0x031f('0xc')]['error'](_0x3a35c3,_0x031f('0xdc'));}if(_[_0x031f('0x9f')](_0x39cb44)){var _0xca5b4f=this;_0x39cb44[_0x031f('0xdd')](function(_0x5e35af,_0x28f1fa){_0xca5b4f[_0x031f('0xc')][_0x031f('0xaa')](util[_0x031f('0xa2')](_0x031f('0x15f'),_0xbc917a,_0x28f1fa),_0x5e35af);});return this[_0x031f('0xc')]['noop'](util['format'](_0x031f('0x160'),_0xbc917a));}else{return this['channel'][_0x031f('0xaa')](_0xbc917a,_0x39cb44);}};AGIVertices[_0x031f('0xf')][_0x031f('0x9')]=function(_0x2edcc6){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2edcc6['label']));if(_0x2edcc6[_0x031f('0xac')]===0x0){return this['maxRetry'](_0x2edcc6);}_0x2edcc6['retry']-=0x1;if(!this[_0x031f('0x85')](_0x2edcc6[_0x031f('0x10f')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x2edcc6,_0x031f('0x110'));}var _0x56d18d=this[_0x031f('0x1c')][_0x031f('0x6f')](this,_0x2edcc6['file_id']);if(!_0x56d18d){return this[_0x031f('0xc')]['error'](_0x2edcc6,_0x031f('0x111'));}var _0x36321f=this[_0x031f('0xc')][_0x031f('0x161')](_0x56d18d,_0x2edcc6[_0x031f('0x112')],_0x2edcc6['digit']);var _0x39dace=_0x36321f[_0x031f('0xb0')];if(_0x36321f[_0x031f('0xb0')]===-0x1){this[_0x031f('0x35')]['sync'](this,_0x2edcc6,'-1');return _0x36321f;}else if(_0x36321f['extra']===_0x031f('0x64')){_0x36321f[_0x031f('0xb0')]=_0x36321f['result'][_0x031f('0xa0')]>0x0?_0x36321f['result']:'t';}else if(_[_0x031f('0x48')](_0x36321f[_0x031f('0xb0')])){_0x36321f[_0x031f('0xb0')]='#';_0x39dace='#';}if(!this[_0x031f('0x85')](_0x2edcc6[_0x031f('0xda')])){this[_0x031f('0xc')][_0x031f('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5c2cb3=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x2edcc6[_0x031f('0xda')]);if(!_0x5c2cb3){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x2edcc6,'no\x20variable\x20found');}this[_0x031f('0xc')][_0x031f('0xaa')](_0x5c2cb3,_0x39dace);}this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x2edcc6,_0x39dace);return _0x36321f;};AGIVertices[_0x031f('0xf')]['noop']=function(_0x3e4073){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x162'),_0x3e4073[_0x031f('0x36')]));return this['channel']['noop'](_0x3e4073['output']||_0x3e4073[_0x031f('0x36')]);};AGIVertices['prototype'][_0x031f('0x163')]=function(_0x507069){logger['info'](util[_0x031f('0xa2')](_0x031f('0x164'),_0x507069[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x507069[_0x031f('0x155')])){return this['channel'][_0x031f('0x2a')](_0x507069,_0x031f('0x153'));}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x154'),this[_0x031f('0xc')]['callerid'],_0x507069[_0x031f('0x155')]));var _0x207752=this['getPause'][_0x031f('0x6f')](this,_0x507069[_0x031f('0x165')]);var _0x4c8388=this[_0x031f('0x4f')]['sync'](this,_0x507069[_0x031f('0x155')],_0x207752);if(_0x4c8388){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x156'),this['channel'][_0x031f('0x39')],_0x507069[_0x031f('0x155')]));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x156'),this[_0x031f('0xc')][_0x031f('0x39')],_0x507069['findBy']));return{'code':0xc8,'result':_0x031f('0x157')};}else{logger['info'](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')]['callerid'],_0x507069[_0x031f('0x155')]));this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x031f('0x39')],_0x507069[_0x031f('0x155')]));return{'code':0xc8,'result':_0x031f('0x159')};}};AGIVertices[_0x031f('0xf')][_0x031f('0x166')]=function(_0x2b0cb2){logger['info'](util[_0x031f('0xa2')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2b0cb2[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x2b0cb2[_0x031f('0x10f')])){return this[_0x031f('0xc')]['error'](_0x2b0cb2,_0x031f('0x110'));}var _0x228b4e=this[_0x031f('0x1c')][_0x031f('0x6f')](this,_0x2b0cb2[_0x031f('0x10f')]);if(!_0x228b4e){return this['channel'][_0x031f('0x2a')](_0x2b0cb2,_0x031f('0x111'));}var _0x385449=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0x167'),[_0x228b4e,_0x2b0cb2[_0x031f('0xe8')]]);if(_0x385449[_0x031f('0xb0')]===-0x1){return _0x385449;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Executed\x20command\x20%s\x20%s',_0x031f('0x167'),_0x228b4e));};AGIVertices[_0x031f('0xf')][_0x031f('0x168')]=function(_0xa195c9){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x169'),_0xa195c9[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0xa195c9[_0x031f('0x16a')])){return this['channel'][_0x031f('0x2a')](_0xa195c9,_0x031f('0x16b'));}var _0xf4dcc1='';var _0x392023=parseInt(_0xa195c9[_0x031f('0x16a')],0xa);if(isNaN(_0x392023)){_0xf4dcc1=_0xa195c9['queue_id'];}else{_0xf4dcc1=this[_0x031f('0x16c')]['sync'](this,_0xa195c9[_0x031f('0x16a')]);if(!_0xf4dcc1){return this[_0x031f('0xc')][_0x031f('0x2a')](_0xa195c9,_0x031f('0x16d'));}}var _0x4efbc4='';if(this['isConfigured'](_0xa195c9['file_id'])){var _0x23b0fa=this['getSound'][_0x031f('0x6f')](this,_0xa195c9[_0x031f('0x10f')]);if(_0x23b0fa){_0x4efbc4=_0x23b0fa;}}this[_0x031f('0x35')]['sync'](this,_0xa195c9,_0xf4dcc1);if(_0xa195c9[_0x031f('0xe8')][_0x031f('0x16e')]('x')<0x0){_0xa195c9[_0x031f('0xe8')]+='x';}if(_0xa195c9[_0x031f('0xe8')]['indexOf']('X')<0x0){_0xa195c9['opts']+='X';}this['channel']['setVariable'](_0x031f('0x16f'),_0xf4dcc1?_0xf4dcc1['toLowerCase']():'');var _0x191f2b=this[_0x031f('0xc')][_0x031f('0x58')]('QUEUE',[_0xf4dcc1,_0xa195c9[_0x031f('0xe8')],_0xa195c9[_0x031f('0xe9')],_0x4efbc4,_0xa195c9['timeout'],_0xa195c9['agi'],_0xa195c9['macro'],_0xa195c9[_0x031f('0x170')],'',_0xa195c9[_0x031f('0x171')]]);if(_0x191f2b[_0x031f('0xb0')]===-0x1){return _0x191f2b;}return this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x031f('0x172'),_0xf4dcc1));};AGIVertices[_0x031f('0xf')][_0x031f('0x173')]=function(_0x713382){logger['info'](util[_0x031f('0xa2')](_0x031f('0x174'),_0x713382[_0x031f('0x36')]));var _0x59f082=_0x713382[_0x031f('0x175')]||'wav';var _0x17cba3=util['format'](_0x031f('0x176'),this['channel']['uniqueid'],rs[_0x031f('0x117')](0x5));var _0x272bdd=util['format'](_0x031f('0x177'),FILES_PATH,_0x17cba3,_0x59f082);var _0x5db71a=util[_0x031f('0xa2')]('%s/recordings/%s',FILES_PATH,_0x17cba3);this['createSquareRecording'][_0x031f('0x6f')](this,_0x713382,_0x17cba3,_0x272bdd);this[_0x031f('0xc')][_0x031f('0xaa')]('RECORDING_SAVENAME',_0x17cba3);logger['info'](_0x031f('0x178'),_0x5db71a,_0x59f082,_0x713382[_0x031f('0x179')],_0x713382[_0x031f('0x64')]);return this[_0x031f('0xc')][_0x031f('0x131')](_0x5db71a,_0x59f082,_0x713382[_0x031f('0x179')],_0x713382[_0x031f('0x64')],undefined,!![]);};AGIVertices[_0x031f('0xf')]['restapi']=function(_0x24039b){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x17a'),_0x24039b['label']));if(!this[_0x031f('0x85')](_0x24039b[_0x031f('0xe9')])){return this[_0x031f('0xc')]['noop'](_0x031f('0x17b'));}var _0x23701e=this['restAPI'][_0x031f('0x6f')](this,_0x24039b);logger['info'](util[_0x031f('0xa2')](_0x031f('0x17c'),util[_0x031f('0x17d')](_0x23701e,{'showHidden':![],'depth':null})));if(!this[_0x031f('0x85')](_0x24039b[_0x031f('0xda')])){return this['channel'][_0x031f('0xae')](_0x031f('0x17e'));}var _0x541989=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x24039b[_0x031f('0xda')]);if(!_0x541989){return this['channel'][_0x031f('0x2a')](_0x24039b,'no\x20variable\x20found');}this[_0x031f('0xc')]['setVariable'](util[_0x031f('0xa2')](_0x031f('0x17f'),_0x541989),_0x23701e['statusCode']?_0x23701e[_0x031f('0x75')]:'200');this['channel'][_0x031f('0xaa')](util['format']('%s_STATUS_MESSAGE',_0x541989),_0x23701e['statusMessage']?_0x23701e['statusMessage']:'OK');if(_0x23701e[_0x031f('0x74')]){try{this[_0x031f('0xa1')](_0x23701e[_0x031f('0x74')],_0x541989);}catch(_0x5a1261){logger[_0x031f('0x2a')](util[_0x031f('0xa2')](_0x031f('0x180'),_0x541989));}}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xe0'),_0x541989));};AGIVertices['prototype'][_0x031f('0x181')]=function(_0x37818f){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x182'),_0x37818f[_0x031f('0x36')]));return this['channel'][_0x031f('0x183')](_0x37818f[_0x031f('0x184')][_0x031f('0xd8')](/\s+/g,''),_0x37818f['escape_digits']);};AGIVertices['prototype'][_0x031f('0x185')]=function(_0x6149d2){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x6149d2[_0x031f('0x36')]));return this['channel'][_0x031f('0x186')](_0x6149d2[_0x031f('0x65')][_0x031f('0xd8')](/\s+/g,''),_0x6149d2['escape_digits']);};AGIVertices['prototype'][_0x031f('0x187')]=function(_0x40aa41){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x188'),_0x40aa41[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0x189')](_0x40aa41['text'],_0x40aa41[_0x031f('0x179')]);};AGIVertices[_0x031f('0xf')][_0x031f('0x18a')]=function(_0x277519){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x18b'),_0x277519[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x277519[_0x031f('0x18c')])){return this[_0x031f('0xc')]['noop'](_0x031f('0x18d'));}var _0xdf0bef=this['getMailAccount'][_0x031f('0x6f')](this,_0x277519['account_id']);if(!_0xdf0bef||!_0xdf0bef[_0x031f('0x18e')]){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x277519,_0x031f('0x18f'));}var _0x34b9a1={'from':util[_0x031f('0xa2')](_0x031f('0x190'),_0xdf0bef[_0x031f('0x13')],_0xdf0bef[_0x031f('0x191')]||_0xdf0bef[_0x031f('0x18e')][_0x031f('0x192')]),'to':_0x277519['to']||'','cc':_0x277519['cc']||'','bcc':_0x277519[_0x031f('0x193')]||'','subject':_0x277519[_0x031f('0x194')],'html':_0x277519[_0x031f('0x5c')],'text':_0x277519[_0x031f('0x5c')]};var _0x316e17={'tls':{'rejectUnauthorized':![]}};if(_0xdf0bef[_0x031f('0x18e')]['service']){_0x316e17[_0x031f('0x195')]=_0xdf0bef['Smtp'][_0x031f('0x195')];}else{_0x316e17['host']=_0xdf0bef[_0x031f('0x18e')][_0x031f('0x196')];_0x316e17[_0x031f('0x197')]=_0xdf0bef[_0x031f('0x18e')][_0x031f('0x197')];_0x316e17['secure']=_0xdf0bef[_0x031f('0x18e')]['secure'];}if(_0xdf0bef['Smtp']['authentication']){_0x316e17[_0x031f('0x198')]={'user':_0xdf0bef[_0x031f('0x18e')][_0x031f('0x192')],'pass':_0xdf0bef[_0x031f('0x18e')][_0x031f('0x199')]};}if(this[_0x031f('0x85')](_0x277519[_0x031f('0x19a')])){}logger['debug'](_0x031f('0x19b'),JSON[_0x031f('0x73')](_0x34b9a1));this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x277519,_0x277519['account_id']);this[_0x031f('0xc')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0xdf0bef[_0x031f('0x13')]));this[_0x031f('0x22')]['sync'](this,_0x316e17,_0x34b9a1);return this[_0x031f('0xc')][_0x031f('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x031f('0xf')][_0x031f('0x19c')]=function(_0x43e640){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x19d'),_0x43e640[_0x031f('0x36')]));return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x19e'));};AGIVertices['prototype'][_0x031f('0x19f')]=function(_0x138f24){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1a0'),_0x138f24[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x138f24[_0x031f('0x1a1')])){return this[_0x031f('0xc')][_0x031f('0xae')]('no\x20sms\x20account\x20configured');}var _0x477dc2=this['getSmsAccount']['sync'](this,_0x138f24[_0x031f('0x1a1')]);if(!_0x477dc2){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x138f24,'no\x20sms\x20account\x20found');}var _0x2ebda6={'body':_0x138f24['sms_text'],'phone':_0x138f24['to']||'','SmsAccountId':_0x477dc2['id']};logger[_0x031f('0xe2')](_0x031f('0x1a2'),JSON[_0x031f('0x73')](_0x2ebda6));this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x138f24,_0x138f24[_0x031f('0x1a1')]);this['channel'][_0x031f('0xae')](util['format'](_0x031f('0x1a3'),_0x477dc2[_0x031f('0x13')]));this[_0x031f('0x34')][_0x031f('0x6f')](this,_0x2ebda6);return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x1a4'));};AGIVertices[_0x031f('0xf')][_0x031f('0x1a5')]=function(_0x5e3267){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1a6'),_0x5e3267['label']));if(!this[_0x031f('0x85')](_0x5e3267[_0x031f('0xda')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5e3267,_0x031f('0x1a7'));}var _0x1d17de=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x5e3267[_0x031f('0xda')]);if(!_0x1d17de){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5e3267,'no\x20variable\x20found');}return this[_0x031f('0xc')][_0x031f('0xaa')](_0x1d17de,_0x5e3267[_0x031f('0x1a8')]);};AGIVertices[_0x031f('0xf')][_0x031f('0x1a9')]=function(_0x29ae92){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1aa'),_0x29ae92[_0x031f('0x36')]));this['channel'][_0x031f('0xae')](_0x031f('0x1ab'));if(_0x29ae92['answer']===_0x031f('0x1ac')){this['channel'][_0x031f('0xae')](_0x031f('0x1ad'));return this[_0x031f('0xc')][_0x031f('0xbe')]();}return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x1ae'));};AGIVertices[_0x031f('0xf')][_0x031f('0x1af')]=function(_0x43862f){logger['info'](util[_0x031f('0xa2')](_0x031f('0x1b0'),_0x43862f[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x43862f[_0x031f('0x1b1')])){return this[_0x031f('0xc')]['error'](_0x43862f,_0x031f('0x1b2'));}var _0x4c7c4d=this['getSquareProject'][_0x031f('0x6f')](this,_0x43862f['project_id']);if(!this[_0x031f('0x85')](_0x4c7c4d)){return this['channel']['error'](_0x43862f,util[_0x031f('0xa2')](_0x031f('0x1b3'),_0x43862f['project_id']));}if(_0x4c7c4d===this['channel']['arg_1']){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x43862f,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x031f('0x35')][_0x031f('0x6f')](this,_0x43862f,_0x4c7c4d);var _0x483cc9=this[_0x031f('0xc')][_0x031f('0x58')](_0x031f('0x1b4'),util['format'](_0x031f('0x1b5'),config[_0x031f('0x7')][_0x031f('0x196')]||_0x031f('0x1b6'),_0x4c7c4d,this[_0x031f('0xc')]['arg_1']));if(_0x483cc9['result']===-0x1){return _0x483cc9;}return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x031f('0x1b4'),_0x4c7c4d));};AGIVertices['prototype'][_0x031f('0x1b7')]=function(_0x56aefe){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x56aefe[_0x031f('0x36')]));var _0x5c3813=this[_0x031f('0x57')][_0x031f('0x6f')](this,_0x56aefe[_0x031f('0x1b8')]);this['createSquareDetailsReport']['sync'](this,_0x56aefe,_0x56aefe[_0x031f('0x1b8')]);if(this[_0x031f('0x85')](_0x56aefe[_0x031f('0xda')])){var _0x3bcd13=this[_0x031f('0x10')]['sync'](this,_0x56aefe[_0x031f('0xda')]);if(_0x3bcd13){this[_0x031f('0xc')]['setVariable'](_0x3bcd13,_0x5c3813);return this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1b9'),_0x56aefe[_0x031f('0x1b8')],_0x3bcd13));}}return this[_0x031f('0xc')][_0x031f('0xae')](util['format'](_0x031f('0x1ba'),_0x56aefe[_0x031f('0x1b8')]));};AGIVertices[_0x031f('0xf')]['google_cloud_tts']=function(_0x255166){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x1bb'),_0x255166[_0x031f('0x36')]));_0x255166['text']=_0x255166[_0x031f('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x255166[_0x031f('0x5b')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0x1bc'));}if(!this[_0x031f('0x85')](_0x255166['text'])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1bd'),_0x255166[_0x031f('0x5c')]));var _0x375440=this['googleCloudTTS'][_0x031f('0x6f')](this,_0x255166);if(_0x375440){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1be'),_0x375440));var _0x4a20c0=this['channel'][_0x031f('0x102')](_0x375440);try{fs[_0x031f('0x103')](_0x375440+_0x031f('0x104'));}catch(_0x3dedb9){logger['error'](_0x3dedb9);}return _0x4a20c0;}return this[_0x031f('0xc')][_0x031f('0x2a')](_0x255166,_0x031f('0x1bf'));};AGIVertices[_0x031f('0xf')][_0x031f('0x1c0')]=function(_0x49c677){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x49c677[_0x031f('0x36')]));_0x49c677['text']=_0x49c677['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x031f('0x85')](_0x49c677[_0x031f('0x5c')])){return this[_0x031f('0xc')][_0x031f('0xae')](_0x031f('0xca'));}this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')]('Trying\x20Google\x20TTS\x20%s',_0x49c677[_0x031f('0x5c')]));var _0x44dce7=this[_0x031f('0x62')][_0x031f('0x6f')](this,_0x49c677);if(_0x44dce7){this[_0x031f('0xc')][_0x031f('0xae')](util[_0x031f('0xa2')](_0x031f('0x1c1'),_0x44dce7));var _0x762902=this['channel'][_0x031f('0x102')](_0x44dce7);try{fs['unlink'](_0x44dce7+_0x031f('0x104'));}catch(_0x5ce8aa){logger[_0x031f('0x2a')](_0x5ce8aa);}return _0x762902;}return this['channel']['error'](_0x49c677,_0x031f('0x1c2'));};AGIVertices['prototype']['unpause']=function(_0x596ba0){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x1c3'),_0x596ba0[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x596ba0[_0x031f('0x155')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x596ba0,_0x031f('0x153'));}logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x154'),this[_0x031f('0xc')][_0x031f('0x39')],_0x596ba0['findBy']));var _0x484edb=this[_0x031f('0x51')][_0x031f('0x6f')](this,_0x596ba0[_0x031f('0x155')]);if(_0x484edb){logger[_0x031f('0x2c')](util[_0x031f('0xa2')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x031f('0xc')][_0x031f('0x39')],_0x596ba0['findBy']));this['channel'][_0x031f('0xae')](util[_0x031f('0xa2')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x031f('0xc')]['callerid'],_0x596ba0[_0x031f('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x031f('0x158'),this[_0x031f('0xc')]['callerid'],_0x596ba0[_0x031f('0x155')]));this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0x158'),this[_0x031f('0xc')][_0x031f('0x39')],_0x596ba0[_0x031f('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x031f('0xf')]['voicemail']=function(_0xfde8dc){logger[_0x031f('0x2c')](util[_0x031f('0xa2')](_0x031f('0x1c4'),_0xfde8dc[_0x031f('0x36')]));var _0x15acb9=this[_0x031f('0xc')][_0x031f('0x58')]('VOICEMAIL',[_0xfde8dc[_0x031f('0x1c5')],_0xfde8dc[_0x031f('0x77')]]);if(_0x15acb9[_0x031f('0xb0')]===-0x1){return _0x15acb9;}return this[_0x031f('0xc')]['noop'](util[_0x031f('0xa2')](_0x031f('0xc9'),_0x031f('0x1c6'),_0xfde8dc[_0x031f('0x1c5')]));};AGIVertices['prototype'][_0x031f('0x1c7')]=function(_0x5aa03a){logger['info'](util['format'](_0x031f('0x1c8'),_0x5aa03a[_0x031f('0x36')]));if(!this[_0x031f('0x85')](_0x5aa03a[_0x031f('0xda')])){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5aa03a,_0x031f('0x1a7'));}var _0x57e8b6=this[_0x031f('0x10')][_0x031f('0x6f')](this,_0x5aa03a['variable_id']);if(!_0x57e8b6){return this[_0x031f('0xc')][_0x031f('0x2a')](_0x5aa03a,_0x031f('0xdc'));}var _0x5e0d09=this[_0x031f('0xc')][_0x031f('0x10')](_0x57e8b6);return{'code':0xc8,'result':_0x5e0d09[_0x031f('0xa6')]?_0x5e0d09[_0x031f('0xa6')]:'-'};};String[_0x031f('0xf')][_0x031f('0xa5')]=function(_0x3a846e,_0xbf1189){return this[_0x031f('0xa4')](_0x3a846e)[_0x031f('0x1c9')](_0xbf1189);};module['exports']=AGIVertices; \ No newline at end of file +var _0xad68=['Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','length','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','agentLogout','math','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','answer','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','interval','map','Intervals','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','error','agentUnpause','agentLogin','internal','format','%s/%s@from-sip/n','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','parse','headers','computedVariables','sync','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','awsPolly','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xad68,0x100));var _0x8ad6=function(_0x471268,_0x5ce885){_0x471268=_0x471268-0x0;var _0x1298f3=_0xad68[_0x471268];return _0x1298f3;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x8ad6('0x0'));var sh=require(_0x8ad6('0x1'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x8ad6('0x2'));var Mustache=require(_0x8ad6('0x3'));var rp=require(_0x8ad6('0x4'));var logger=require(_0x8ad6('0x5'))(_0x8ad6('0x6'));var config=require(_0x8ad6('0x7'));var scripts=require(_0x8ad6('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8ad6('0x9'),_0x8ad6('0xa')];var verticesWithRetry=[_0x8ad6('0xb'),_0x8ad6('0xc'),_0x8ad6('0xd')];var AGIVertices=function(_0x5bf349,_0x5cf45f,_0xe8b4bd){this[_0x8ad6('0xe')]=_0x5bf349;this['rpc']=_0x5cf45f;this['mailRpc']=_0xe8b4bd;};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x10')]=function(_0x9fc298,_0x3bdaaf){this[_0x8ad6('0x11')][_0x8ad6('0x12')](_0x9fc298)[_0x8ad6('0x13')](function(_0x3bec44){_0x3bdaaf(null,_0x3bec44?_0x3bec44['name']:![]);})[_0x8ad6('0x14')](function(_0x4b8041){_0x3bdaaf(_0x4b8041);});};AGIVertices['prototype'][_0x8ad6('0x15')]=function(_0x4961c3,_0x329fca){this['rpc'][_0x8ad6('0x16')](_0x4961c3)[_0x8ad6('0x13')](function(_0xc0ca7f){_0x329fca(null,_0xc0ca7f?_0xc0ca7f['name']:![]);})[_0x8ad6('0x14')](function(_0x1fed01){_0x329fca(_0x1fed01);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x17')]=function(_0x10a21c,_0xb7e3e2){this[_0x8ad6('0x11')][_0x8ad6('0x18')](_0x10a21c)['then'](function(_0x8ca3e3){_0xb7e3e2(null,_0x8ca3e3?_0x8ca3e3[_0x8ad6('0x19')]:![]);})[_0x8ad6('0x14')](function(_0x28a9b8){_0xb7e3e2(_0x28a9b8);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1a')]=function(_0x144b50,_0x58a393){this[_0x8ad6('0x11')][_0x8ad6('0x1b')](_0x144b50)[_0x8ad6('0x13')](function(_0x52f4ab){_0x58a393(null,_0x52f4ab?_0x52f4ab[_0x8ad6('0x1c')]:![]);})[_0x8ad6('0x14')](function(_0x3074e7){_0x58a393(_0x3074e7);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1d')]=function(_0x46f5bf,_0x42f18b){this[_0x8ad6('0x11')][_0x8ad6('0x1e')](_0x46f5bf)['then'](function(_0x47af23){_0x42f18b(null,_0x47af23?_0x47af23[_0x8ad6('0x19')]:![]);})[_0x8ad6('0x14')](function(_0x558430){_0x42f18b(_0x558430);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1f')]=function(_0x18b3de,_0x4b4f9f){this['rpc']['getTrunkById'](_0x18b3de)[_0x8ad6('0x13')](function(_0x39228c){_0x4b4f9f(null,_0x39228c?_0x39228c[_0x8ad6('0x19')]:![]);})[_0x8ad6('0x14')](function(_0x1c79c9){_0x4b4f9f(_0x1c79c9);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x20')]=function(_0x3a6151,_0x44586f){var _0x3ead0c=this;this[_0x8ad6('0x11')][_0x8ad6('0x21')](_0x3a6151)[_0x8ad6('0x13')](function(_0x371f2b){_0x44586f(null,_0x371f2b?_0x3ead0c[_0x8ad6('0x22')](_0x371f2b[_0x8ad6('0x23')]):![]);})[_0x8ad6('0x14')](function(_0x3c2092){_0x44586f(_0x3c2092);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x24')]=function(_0x519545,_0x3dfedd){this[_0x8ad6('0x11')][_0x8ad6('0x25')](_0x519545)['then'](function(_0x18bf7b){_0x3dfedd(null,_0x18bf7b?_0x18bf7b:![]);})['catch'](function(_0x56ae60){_0x3dfedd(_0x56ae60);});};AGIVertices['prototype'][_0x8ad6('0x26')]=function(_0x40ed1e,_0x4e02a3,_0x1b8508){this[_0x8ad6('0x27')][_0x8ad6('0x26')](_0x40ed1e,_0x4e02a3)[_0x8ad6('0x13')](function(){_0x1b8508(null);})[_0x8ad6('0x14')](function(_0x47e576){_0x1b8508(_0x47e576);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x28')]=function(_0x4f61b6,_0x2bf358){this['rpc']['getIntervalById'](_0x4f61b6)[_0x8ad6('0x13')](function(_0x450fd8){if(_0x450fd8){if(_0x450fd8['IntervalId']){_0x2bf358(null,[_0x450fd8[_0x8ad6('0x29')]]);}else{_0x2bf358(null,_[_0x8ad6('0x2a')](_0x450fd8[_0x8ad6('0x2b')],_0x8ad6('0x29')));}}else{_0x2bf358(null,![]);}})['catch'](function(_0x337259){_0x2bf358(_0x337259);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x22')]=function(_0x26e66c){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x26e66c);};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x2c')]=function(_0xdb5c81,_0x5e57cd,_0x500804){odbc[_0x8ad6('0x2d')](_0xdb5c81,function(_0x2d6c75){if(_0x2d6c75){logger['error'](_0x8ad6('0x2e'),_0x2d6c75);_0x500804(_0x2d6c75);}else{logger[_0x8ad6('0x2f')]('ODBC\x20connection\x20successfully');odbc[_0x8ad6('0x30')](_0x5e57cd,function(_0x549303,_0x1b9bb5){if(_0x549303){logger['info'](_0x8ad6('0x31'),_0x5e57cd);_0x500804(_0x549303);}else{logger[_0x8ad6('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x5e57cd);odbc[_0x8ad6('0x32')](function(_0x50985b){if(_0x50985b){logger['error'](_0x8ad6('0x33'),_0x50985b);}_0x500804(null,_0x1b9bb5);});}});}});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x34')]=function(_0x1cd8c7,_0x44864c){this[_0x8ad6('0x11')][_0x8ad6('0x35')](_0x1cd8c7)[_0x8ad6('0x13')](function(_0x52614a){_0x44864c(null,_0x52614a?_0x52614a:![]);})[_0x8ad6('0x14')](function(_0x5052c1){_0x44864c(_0x5052c1);});};AGIVertices[_0x8ad6('0xf')]['createSmsMessage']=function(_0x1fe0cf,_0x1f74b0){this[_0x8ad6('0x11')][_0x8ad6('0x36')](_0x1fe0cf)['then'](function(_0x2ef6fc){_0x1f74b0(null,_0x2ef6fc);})[_0x8ad6('0x14')](function(_0x2eb7be){_0x1f74b0(_0x2eb7be);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x37')]=function(_0x5deb79,_0x4dba35,_0x1e429d){this[_0x8ad6('0x11')][_0x8ad6('0x37')]({'uniqueid':this[_0x8ad6('0xe')][_0x8ad6('0x38')],'node':_0x5deb79[_0x8ad6('0x39')],'application':_0x5deb79[_0x8ad6('0x3a')],'data':_0x4dba35||null,'project_name':this[_0x8ad6('0xe')][_0x8ad6('0x3b')],'callerid':this[_0x8ad6('0xe')]['callerid']})[_0x8ad6('0x13')](function(_0x19a21d){if(_0x1e429d){_0x1e429d(null,_0x19a21d);}})[_0x8ad6('0x14')](function(_0x1dea40){if(_0x1e429d){_0x1e429d(_0x1dea40);}});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x3c')]=function(_0x2c1760,_0x33ea35,_0x2b6dbc,_0x5b586e){this[_0x8ad6('0x11')][_0x8ad6('0x3c')]({'uniqueid':this[_0x8ad6('0xe')]['uniqueid'],'callerid':this['channel'][_0x8ad6('0x3d')],'calleridname':this[_0x8ad6('0xe')][_0x8ad6('0x3e')],'context':this[_0x8ad6('0xe')][_0x8ad6('0x3f')],'extension':this[_0x8ad6('0xe')][_0x8ad6('0x40')],'priority':this['channel'][_0x8ad6('0x41')],'accountcode':this[_0x8ad6('0xe')][_0x8ad6('0x42')],'dnid':this[_0x8ad6('0xe')][_0x8ad6('0x43')],'projectName':this[_0x8ad6('0xe')][_0x8ad6('0x3b')],'saveName':_0x33ea35,'filename':_0x2c1760[_0x8ad6('0x44')]||_0x33ea35,'savePath':_0x2b6dbc})['then'](function(_0x5ad49f){_0x5b586e(null,_0x5ad49f);})[_0x8ad6('0x14')](function(_0x14dab7){_0x5b586e(_0x14dab7);});};AGIVertices[_0x8ad6('0xf')]['createSquareMessage']=function(_0x4c2960,_0x51287d,_0x487795,_0x2ff9b1,_0x5b21b1){this[_0x8ad6('0x11')][_0x8ad6('0x45')]({'uniqueid':this['channel'][_0x8ad6('0x38')],'body':_0x4c2960,'direction':_0x51287d,'providerName':_0x487795,'providerResponse':_0x2ff9b1})[_0x8ad6('0x13')](function(_0x3633ac){if(_0x5b21b1){_0x5b21b1(null,_0x3633ac);}})[_0x8ad6('0x14')](function(_0x4ffb12){if(_0x5b21b1){_0x5b21b1(_0x4ffb12);}});};AGIVertices[_0x8ad6('0xf')]['createCmContact']=function(_0xc8a5b,_0x114f5b){this[_0x8ad6('0x11')][_0x8ad6('0x46')]({'firstName':_[_0x8ad6('0x47')](_0xc8a5b[_0x8ad6('0x19')])||_[_0x8ad6('0x48')](_0xc8a5b['name'])?'callback_'+Math[_0x8ad6('0x49')]():_0xc8a5b[_0x8ad6('0x19')],'lastName':_[_0x8ad6('0x47')](_0xc8a5b[_0x8ad6('0x4a')])||_[_0x8ad6('0x48')](_0xc8a5b['lastName'])?null:_0xc8a5b[_0x8ad6('0x4a')],'phone':_0xc8a5b[_0x8ad6('0x4b')],'ListId':_0xc8a5b['list_id'],'scheduledat':_0xc8a5b[_0x8ad6('0x4c')],'callbackUniqueid':this['channel'][_0x8ad6('0x38')],'tags':_0x8ad6('0x4d'),'description':'Callback\x20scheduled\x20at\x20'+_0xc8a5b['scheduledAt'][_0x8ad6('0x4e')](),'priority':_0xc8a5b['callback_priority']})['then'](function(_0x395a5e){_0x114f5b(null,_0x395a5e);})['catch'](function(_0x1774cf){_0x114f5b(_0x1774cf);});};AGIVertices['prototype'][_0x8ad6('0x4f')]=function(_0x28de79,_0x558e85){this[_0x8ad6('0x11')][_0x8ad6('0x50')](_0x28de79)[_0x8ad6('0x13')](function(_0x47ddff){_0x558e85(null,_0x47ddff?_0x47ddff['name']:![]);})[_0x8ad6('0x14')](function(_0x15b503){_0x558e85(_0x15b503);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x51')]=function(_0x1012c7,_0x3739b9,_0x35e8ad){var _0xbc6bab={'role':_0x8ad6('0x52')};_0xbc6bab[_0x1012c7]=this[_0x8ad6('0xe')][_0x8ad6('0x3d')];this[_0x8ad6('0x11')][_0x8ad6('0x51')](_0xbc6bab,_0x3739b9,this[_0x8ad6('0xe')][_0x8ad6('0x38')])['then'](function(_0x16398a){_0x35e8ad(null,_[_0x8ad6('0x48')](_0x16398a)?![]:!![]);})[_0x8ad6('0x14')](function(_0x544152){logger[_0x8ad6('0x53')](_0x544152);_0x35e8ad(null,![]);});};AGIVertices['prototype'][_0x8ad6('0x54')]=function(_0xacbcd0,_0xa3fd5b){var _0x386c0f={'role':'agent'};_0x386c0f[_0xacbcd0]=this[_0x8ad6('0xe')]['callerid'];this[_0x8ad6('0x11')][_0x8ad6('0x54')](_0x386c0f)[_0x8ad6('0x13')](function(_0x4dd122){_0xa3fd5b(null,_[_0x8ad6('0x48')](_0x4dd122)?![]:!![]);})[_0x8ad6('0x14')](function(_0x4d454c){logger['error'](_0x4d454c);_0xa3fd5b(null,![]);});};AGIVertices[_0x8ad6('0xf')]['agentLogout']=function(_0x532ca5,_0x406131){var _0x1aad03={'role':_0x8ad6('0x52')};_0x1aad03[_0x532ca5]=this[_0x8ad6('0xe')]['callerid'];this[_0x8ad6('0x11')]['agentLogout'](_0x1aad03)['then'](function(_0x5cf499){_0x406131(null,_['isNil'](_0x5cf499)?![]:!![]);})[_0x8ad6('0x14')](function(_0x2dceb0){logger[_0x8ad6('0x53')](_0x2dceb0);_0x406131(null,![]);});};AGIVertices['prototype'][_0x8ad6('0x55')]=function(_0x5d2264,_0x2f8175){var _0x2e51dd={'role':_0x8ad6('0x52')};_0x2e51dd[_0x5d2264]=this[_0x8ad6('0xe')][_0x8ad6('0x3d')];var _0x333c1a=_0x5d2264!=_0x8ad6('0x56')?util[_0x8ad6('0x57')](_0x8ad6('0x58'),'LOCAL',this[_0x8ad6('0xe')][_0x8ad6('0x3d')]):undefined;this['rpc'][_0x8ad6('0x55')](_0x2e51dd,_0x333c1a)[_0x8ad6('0x13')](function(_0x2ecd63){_0x2f8175(null,_[_0x8ad6('0x48')](_0x2ecd63)?![]:!![]);})[_0x8ad6('0x14')](function(_0x25de7b){logger['error'](_0x25de7b);_0x2f8175(null,![]);});};AGIVertices['prototype'][_0x8ad6('0x59')]=function(_0xe10590,_0x495dc9){sh[_0x8ad6('0x5a')](_[_0x8ad6('0x5b')](_0xe10590),function(_0xec8375,_0xf483b7){var _0xe0a60b=_0xf483b7['replace'](/(\r\n|\n|\r)/gm,'');_0x495dc9(null,_0xe0a60b);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x5c329f,_0x450e51){scripts[_0x8ad6('0x5c')](_0x5c329f[_0x8ad6('0x5d')],_0x5c329f[_0x8ad6('0x5e')]||_0x8ad6('0x5f'),_0x5c329f[_0x8ad6('0x5f')],_0x5c329f['languageCode']||_0x8ad6('0x60'),_0x5c329f[_0x8ad6('0x61')]||_0x8ad6('0x62'),_0x5c329f[_0x8ad6('0x63')]||'MP3')[_0x8ad6('0x13')](function(_0x5669e1){_0x450e51(null,_0x5669e1);})[_0x8ad6('0x14')](function(_0x4e1c73){_0x450e51(_0x4e1c73);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x64')]=function(_0x5104ac,_0x25b74d){scripts[_0x8ad6('0x64')](_0x5104ac[_0x8ad6('0x5f')],_0x5104ac[_0x8ad6('0x65')]||'en',0x1)[_0x8ad6('0x13')](function(_0x1f97f0){_0x25b74d(null,_0x1f97f0);})['catch'](function(_0x167f51){_0x25b74d(_0x167f51);});};AGIVertices['prototype'][_0x8ad6('0x66')]=function(_0x2b981a,_0x2eb726){var _0x459f7c={'uri':_0x2b981a[_0x8ad6('0x67')],'method':_0x2b981a[_0x8ad6('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2b981a[_0x8ad6('0x69')])===_0x8ad6('0x6a')&&parseInt(_0x2b981a[_0x8ad6('0x69')])>=0x1?parseInt(_0x2b981a[_0x8ad6('0x69')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x8ad6('0x6b'),_0x8ad6('0x6c')],_0x459f7c[_0x8ad6('0x68')][_0x8ad6('0x6d')]())){try{_0x459f7c['body']=_0x2b981a[_0x8ad6('0xa')]?JSON[_0x8ad6('0x6e')](_0x2b981a[_0x8ad6('0xa')]):{};}catch(_0x183dc6){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x183dc6);}}try{_0x459f7c[_0x8ad6('0x6f')]=_0x2b981a[_0x8ad6('0x9')]?JSON[_0x8ad6('0x6e')](_0x2b981a['rawHeaders']):{};}catch(_0x55d977){logger[_0x8ad6('0x53')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x55d977);}if(_0x2b981a[_0x8ad6('0x70')]){try{var _0x34755e=require(_0x2b981a[_0x8ad6('0x70')])[_0x8ad6('0x71')](this,_0x459f7c);_0x459f7c['uri']=Mustache['render'](_0x2b981a[_0x8ad6('0x67')],_0x34755e,{},['$$','$$']);if(_0x459f7c[_0x8ad6('0x6f')]){_0x459f7c[_0x8ad6('0x6f')]=JSON['parse'](Mustache[_0x8ad6('0x72')](JSON['stringify'](_0x459f7c[_0x8ad6('0x6f')]),_0x34755e,{},['$$','$$']));}if(_0x459f7c['body']){_0x459f7c[_0x8ad6('0x73')]=JSON[_0x8ad6('0x6e')](Mustache[_0x8ad6('0x72')](JSON[_0x8ad6('0x74')](_0x459f7c[_0x8ad6('0x73')]),_0x34755e,{},['$$','$$']));}}catch(_0x381d22){logger[_0x8ad6('0x53')](_0x8ad6('0x75'),_0x381d22);}}rp(_0x459f7c)['then'](function(_0xd5ab2c){var _0x4f7f78={'statusCode':_0xd5ab2c[_0x8ad6('0x76')]||0xc8,'statusMessage':_0xd5ab2c[_0x8ad6('0x77')]||'OK','headers':_0xd5ab2c[_0x8ad6('0x6f')]||{},'body':_0xd5ab2c[_0x8ad6('0x73')]||{}};_0x2eb726(null,_0x4f7f78);})[_0x8ad6('0x14')](function(_0x11f220){var _0x168c07={'statusCode':_0x11f220['statusCode']||0x1f4,'statusMessage':_0x11f220[_0x8ad6('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x11f220['options'][_0x8ad6('0x6f')]||{},'body':_0x11f220[_0x8ad6('0x79')][_0x8ad6('0x73')]||{}};_0x2eb726(null,_0x168c07);});};AGIVertices['prototype'][_0x8ad6('0x7a')]=function(_0x26f086,_0x29632f){scripts[_0x8ad6('0x7a')](this['channel'][_0x8ad6('0x38')],_0x26f086[_0x8ad6('0x7b')],_0x26f086[_0x8ad6('0x5f')],_0x26f086[_0x8ad6('0x7c')]||'en')[_0x8ad6('0x13')](function(_0x2b5be9){_0x29632f(null,_0x2b5be9);})[_0x8ad6('0x14')](function(_0x1fc200){_0x29632f(_0x1fc200);});};AGIVertices['prototype'][_0x8ad6('0x7d')]=function(_0x5f1d11,_0x389112){scripts[_0x8ad6('0x7d')](this[_0x8ad6('0xe')][_0x8ad6('0x38')],_0x5f1d11[_0x8ad6('0x7e')],_0x5f1d11[_0x8ad6('0x7f')],_0x5f1d11[_0x8ad6('0x80')],_0x5f1d11[_0x8ad6('0x5f')],_0x5f1d11[_0x8ad6('0x81')]||'en')[_0x8ad6('0x13')](function(_0x3fddc4){_0x389112(null,_0x3fddc4);})[_0x8ad6('0x14')](function(_0xffafdb){_0x389112(_0xffafdb);});};AGIVertices['prototype']['sestekNDA']=function(_0x15ff93,_0x46c83f){scripts['sestekNDA'](this[_0x8ad6('0xe')],_0x15ff93)[_0x8ad6('0x13')](function(_0x853938){_0x46c83f(null,_0x853938);})['catch'](function(_0x3207d3){_0x46c83f(_0x3207d3);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x82')]=function(_0x322a57,_0x17f30c){scripts[_0x8ad6('0x82')](_0x322a57[_0x8ad6('0x7b')],_0x322a57[_0x8ad6('0x5f')],_0x322a57['ispeech_tts_language']||'en-US',_0x322a57[_0x8ad6('0x83')])[_0x8ad6('0x13')](function(_0x435d85){_0x17f30c(null,_0x435d85);})['catch'](function(_0xc23e34){_0x17f30c(_0xc23e34);});};AGIVertices[_0x8ad6('0xf')]['ispeechASR']=function(_0x2317f2,_0x4d91bf,_0x4366bb){scripts[_0x8ad6('0x84')](_0x4d91bf,_0x2317f2[_0x8ad6('0x7b')],_0x2317f2[_0x8ad6('0x85')]||_0x8ad6('0x60'),this[_0x8ad6('0x86')](_0x2317f2['model'])?_0x2317f2['model']:undefined)[_0x8ad6('0x13')](function(_0x32ac40){_0x4366bb(null,_0x32ac40);})[_0x8ad6('0x14')](function(_0x2e31ce){_0x4366bb(_0x2e31ce);});};AGIVertices[_0x8ad6('0xf')]['awsPolly']=function(_0x572911,_0x33e8b6){scripts[_0x8ad6('0x87')](_0x572911['aws_access_key_id'],_0x572911[_0x8ad6('0x88')],_0x572911['aws_polly_region'],_0x572911[_0x8ad6('0x89')]||_0x8ad6('0x8a'),_0x572911[_0x8ad6('0x5f')],_0x572911['aws_text_type']||_0x8ad6('0x5f'))['then'](function(_0x2e0f08){_0x33e8b6(null,_0x2e0f08);})['catch'](function(_0x4a8496){_0x33e8b6(_0x4a8496);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x8b')]=function(_0x582bf3,_0x5e8166){scripts[_0x8ad6('0x8b')](this['channel'][_0x8ad6('0x38')],_0x582bf3[_0x8ad6('0x8c')],_0x582bf3[_0x8ad6('0x88')],_0x582bf3[_0x8ad6('0x8d')],_0x582bf3['text'],_0x582bf3[_0x8ad6('0x8e')])[_0x8ad6('0x13')](function(_0x1ae4d5){_0x5e8166(null,_0x1ae4d5);})[_0x8ad6('0x14')](function(_0x2aae16){_0x5e8166(_0x2aae16);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x8f')]=function(_0x4a5858,_0x580972,_0x589fdf){scripts[_0x8ad6('0x8f')](_0x580972,_0x4a5858[_0x8ad6('0x7b')],_0x4a5858[_0x8ad6('0x90')]||'en-US')[_0x8ad6('0x13')](function(_0x58398c){_0x589fdf(null,_0x58398c);})[_0x8ad6('0x14')](function(_0xa193cc){_0x589fdf(_0xa193cc);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x91')]=function(_0x6a5789,_0x2cb7f6,_0x5e79cb){scripts[_0x8ad6('0x91')](_0x2cb7f6,_0x6a5789[_0x8ad6('0x92')],_0x6a5789[_0x8ad6('0x93')],_0x6a5789[_0x8ad6('0x94')])[_0x8ad6('0x13')](function(_0x25a858){_0x5e79cb(null,_0x25a858);})[_0x8ad6('0x14')](function(_0x2195c3){_0x5e79cb(_0x2195c3);});};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x95')]=function(_0x2d52c2){var _0x510f92=_['includes'](verticesWithRetry,_0x2d52c2[_0x8ad6('0x3a')])?_0x2d52c2:_['clone'](_0x2d52c2);for(var _0x45a198 in _0x510f92){if(_0x510f92[_0x8ad6('0x96')](_0x45a198)){if(_0x510f92[_0x45a198]&&_[_0x8ad6('0x97')](_0x510f92[_0x45a198])){if(_['includes'](recursiveMapAttributes,_0x45a198)){_0x510f92[_0x45a198]=this[_0x8ad6('0x98')](_0x510f92[_0x45a198]);}else{_0x510f92[_0x45a198]=this['replaceAllVariables'](_0x510f92[_0x45a198]);}}}}return _0x510f92;};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x99')]=function(_0x4c09fd){for(var _0x1f42a8 in _0x4c09fd){if(_0x4c09fd[_0x8ad6('0x96')](_0x1f42a8)){if(_[_0x8ad6('0x9a')](_0x4c09fd[_0x1f42a8])){this[_0x8ad6('0x99')](_0x4c09fd[_0x1f42a8]);}else if(_[_0x8ad6('0x9b')](_0x4c09fd[_0x1f42a8])){for(var _0x3169d4=0x0;_0x3169d4<_0x4c09fd[_0x1f42a8]['length'];_0x3169d4++){this[_0x8ad6('0x99')](_0x4c09fd[_0x1f42a8][_0x3169d4]);}}else if(_['isString'](_0x4c09fd[_0x1f42a8])){_0x4c09fd[_0x1f42a8]=this[_0x8ad6('0x9c')](_0x4c09fd[_0x1f42a8]);}}}};AGIVertices['prototype'][_0x8ad6('0x9d')]=function(_0x509c5e,_0x44f989){for(var _0x57d053 in _0x509c5e){if(_0x509c5e[_0x8ad6('0x96')](_0x57d053)){if(_['isPlainObject'](_0x509c5e[_0x57d053])){if(!_[_0x8ad6('0x47')](_0x509c5e[_0x57d053])){this[_0x8ad6('0x9d')](_0x509c5e[_0x57d053],util[_0x8ad6('0x57')]('%s.%s',_0x44f989,_0x57d053));}}else if(_[_0x8ad6('0x9b')](_0x509c5e[_0x57d053])){for(var _0x546a2b=0x0;_0x546a2b<_0x509c5e[_0x57d053]['length'];_0x546a2b++){this[_0x8ad6('0x9d')](_0x509c5e[_0x57d053][_0x546a2b],util[_0x8ad6('0x57')](_0x8ad6('0x9e'),_0x44f989,_0x57d053+'['+_0x546a2b+']'));}}else{if(!_['isNil'](_0x509c5e[_0x57d053])){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util[_0x8ad6('0x57')](_0x8ad6('0x9e'),_0x44f989,_0x57d053),_0x509c5e[_0x57d053]);}}}}};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x98')]=function(_0x4d1045){try{var _0x352be1=JSON[_0x8ad6('0x6e')](_0x4d1045);this['recursiveNodeIndex'](_0x352be1);return JSON['stringify'](_0x352be1);}catch(_0x9c4858){return this['replaceAllVariables'](_0x4d1045);}};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x9c')]=function(_0x4a24cb){var _0x1503c4=_0x4a24cb[_0x8ad6('0xa0')]('{');for(var _0x2b73db=0x1;_0x2b73db<_0x1503c4['length'];_0x2b73db+=0x1){var _0x4f6b6e=_0x1503c4[_0x2b73db][_0x8ad6('0xa0')]('}');if(_0x4f6b6e['length']>0x1){_0x4a24cb=_0x4a24cb[_0x8ad6('0xa1')]('{'+_0x4f6b6e[0x0]+'}',this[_0x8ad6('0xe')]['getVariable'](_0x4f6b6e[0x0])[_0x8ad6('0xa2')]||_0x4f6b6e[0x0]);}}if(_0x1503c4['length']===0x1){return _0x4a24cb[_0x8ad6('0x4e')]();}return this[_0x8ad6('0x9c')](_0x4a24cb);};AGIVertices['prototype'][_0x8ad6('0xa3')]=function(_0xb76135,_0x4e7e77){var _0x32e8e9=this['channel'][_0x8ad6('0x10')](_0xb76135);if(_0x32e8e9[_0x8ad6('0xa4')]===-0x1){return _0x32e8e9;}logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0xa5'),_0x4e7e77,_0x32e8e9[_0x8ad6('0xa2')]));return this[_0x8ad6('0xe')][_0x8ad6('0x9f')](_0x4e7e77,_0x32e8e9['extra']);};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x86')]=function(_0x44c057){return _0x44c057&&_0x44c057!=='0'&&_0x44c057!=='-1'&&_0x44c057!=='';};AGIVertices['prototype'][_0x8ad6('0xa6')]=function(_0x1b39ee){this['createSquareDetailsReport'][_0x8ad6('0x71')](this,_0x1b39ee,'-');_0x1b39ee[_0x8ad6('0xa7')]=_0x1b39ee[_0x8ad6('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x1df450){logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0xa8'),_0x1df450[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x1df450['text'])){return this['channel'][_0x8ad6('0xa9')](_0x8ad6('0xaa'));}var _0x45a568='\x22'+_0x1df450[_0x8ad6('0x5f')]+'\x22';if(this[_0x8ad6('0x86')](_0x1df450[_0x8ad6('0x79')])){_0x45a568+=','+_0x1df450[_0x8ad6('0x79')];}var _0x313ee3=this['channel']['exec'](_0x8ad6('0xab'),_0x45a568);if(_0x313ee3[_0x8ad6('0xa4')]===-0x1){return _0x313ee3;}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x45a568));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0xac')]=function(_0x5ded6e){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0xad'),_0x5ded6e[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x5ded6e['grammar'])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xae'));}var _0x1daf66=_0x5ded6e[_0x8ad6('0xaf')];if(this[_0x8ad6('0x86')](_0x5ded6e[_0x8ad6('0x79')])){_0x1daf66+=','+_0x5ded6e[_0x8ad6('0x79')];}var _0x3b7908=this['channel']['exec']('MRCPRecog',_0x1daf66);if(_0x3b7908[_0x8ad6('0xa4')]===-0x1){return _0x3b7908;}var _0x1cc6cd=this[_0x8ad6('0xa3')](_0x8ad6('0xb0'),_0x8ad6('0xb1'));if(_0x1cc6cd[_0x8ad6('0xa4')]===-0x1){return _0x1cc6cd;}var _0x41d5d2=this['getAndSetVariable']('RECOG_INPUT()',_0x8ad6('0xb2'));if(_0x41d5d2[_0x8ad6('0xa4')]===-0x1){return _0x41d5d2;}var _0x3ad325=this[_0x8ad6('0xa3')](_0x8ad6('0xb3'),_0x8ad6('0xb4'));if(_0x3ad325[_0x8ad6('0xa4')]===-0x1){return _0x3ad325;}return this['channel'][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xb5'),_0x1daf66));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x6')]=function(_0x550e9e){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0xb6'),_0x550e9e[_0x8ad6('0x39')]));return this['channel'][_0x8ad6('0x6')]([_0x550e9e[_0x8ad6('0xb7')],_0x550e9e['args']]);};AGIVertices[_0x8ad6('0xf')]['answer']=function(_0x27e59e){logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0xb8'),_0x27e59e[_0x8ad6('0x39')]));if(this['isConfigured'](_0x27e59e['timeout'])){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0xb9'),_0x27e59e[_0x8ad6('0x69')]));var _0xeeb36c=this[_0x8ad6('0xe')][_0x8ad6('0xba')](_0x27e59e[_0x8ad6('0x69')]);if(_0xeeb36c[_0x8ad6('0xa4')]===-0x1){return _0xeeb36c;}}return this[_0x8ad6('0xe')]['answer']();};AGIVertices['prototype'][_0x8ad6('0x4d')]=function(_0x454035){logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0xbb'),_0x454035['label']));if(!this[_0x8ad6('0x86')](_0x454035[_0x8ad6('0xbc')])){return this[_0x8ad6('0xe')]['error'](_0x454035,_0x8ad6('0xbd'));}_0x454035[_0x8ad6('0x4c')]=moment();if(this[_0x8ad6('0x86')](_0x454035[_0x8ad6('0xbe')])){_0x454035[_0x8ad6('0x4c')]=moment()[_0x8ad6('0xbf')](_0x454035['delay'],'minutes');}if(!this['isConfigured'](_0x454035[_0x8ad6('0xc0')])){_0x454035['callback_priority']=0x2;}this[_0x8ad6('0x46')]['sync'](this,_0x454035);return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0xc1'),_0x454035[_0x8ad6('0x4b')],_0x454035[_0x8ad6('0xbc')],_0x454035['scheduledAt']));};AGIVertices['prototype'][_0x8ad6('0xc2')]=function(_0x28b0d2){logger['info'](util['format'](_0x8ad6('0xc3'),_0x28b0d2[_0x8ad6('0x39')]));var _0x575ccf=this[_0x8ad6('0xe')]['exec'](_0x28b0d2['application'],_0x28b0d2[_0x8ad6('0x79')]);if(_0x575ccf[_0x8ad6('0xa4')]===-0x1){return _0x575ccf;}return this['channel'][_0x8ad6('0xa9')](util['format'](_0x8ad6('0xc4'),_0x28b0d2[_0x8ad6('0xc5')],_0x28b0d2[_0x8ad6('0x79')]));};AGIVertices['prototype'][_0x8ad6('0xc6')]=function(_0x59239a){logger[_0x8ad6('0x2f')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x59239a['label']));if(!this[_0x8ad6('0x86')](_0x59239a['text'])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xaa'));}var _0x1c9cb0='\x22'+_0x59239a[_0x8ad6('0x5f')]+'\x22';if(this['isConfigured'](_0x59239a[_0x8ad6('0x79')])){_0x1c9cb0+=','+_0x59239a[_0x8ad6('0x79')];}var _0x5eabc0=this[_0x8ad6('0xe')]['exec'](_0x8ad6('0xab'),_0x1c9cb0);if(_0x5eabc0[_0x8ad6('0xa4')]===-0x1){return _0x5eabc0;}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xc7'),_0x1c9cb0));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0xc8')]=function(_0x34edb4){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0xc9'),_0x34edb4[_0x8ad6('0x39')]));if(!this['isConfigured'](_0x34edb4[_0x8ad6('0x5f')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xaa'));}var _0x1c2f18='\x22'+_0x34edb4[_0x8ad6('0x5f')]+'\x22';if(this[_0x8ad6('0x86')](_0x34edb4[_0x8ad6('0x79')])){_0x1c2f18+=','+_0x34edb4[_0x8ad6('0x79')];}var _0x46fc17=this['channel'][_0x8ad6('0x5a')]('MRCPSynth',_0x1c2f18);if(_0x46fc17['result']===-0x1){return _0x46fc17;}return this['channel'][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xc7'),_0x1c2f18));};AGIVertices[_0x8ad6('0xf')]['lumenvoxasr']=function(_0x35f6cf){logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0xca'),_0x35f6cf['label']));if(!this[_0x8ad6('0x86')](_0x35f6cf[_0x8ad6('0xaf')])){return this[_0x8ad6('0xe')]['noop'](_0x8ad6('0xae'));}var _0x2c37bb=_0x35f6cf[_0x8ad6('0xaf')];if(this[_0x8ad6('0x86')](_0x35f6cf[_0x8ad6('0x79')])){_0x2c37bb+=','+_0x35f6cf[_0x8ad6('0x79')];}var _0x165da8=this[_0x8ad6('0xe')]['exec']('MRCPRecog',_0x2c37bb);if(_0x165da8[_0x8ad6('0xa4')]===-0x1){return _0x165da8;}var _0x548efd=this[_0x8ad6('0xa3')]('RECOG_CONFIDENCE()',_0x8ad6('0xcb'));if(_0x548efd[_0x8ad6('0xa4')]===-0x1){return _0x548efd;}var _0x3d343e=this['getAndSetVariable'](_0x8ad6('0xcc'),_0x8ad6('0xcd'));if(_0x3d343e[_0x8ad6('0xa4')]===-0x1){return _0x3d343e;}var _0x3e3f90=this[_0x8ad6('0xa3')]('RECOG_INSTANCE()',_0x8ad6('0xce'));if(_0x3e3f90[_0x8ad6('0xa4')]===-0x1){return _0x3e3f90;}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2c37bb));};AGIVertices[_0x8ad6('0xf')]['sestekasr']=function(_0xc9c00e){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xc9c00e['label']));if(!this['isConfigured'](_0xc9c00e[_0x8ad6('0xaf')])){return this[_0x8ad6('0xe')]['noop'](_0x8ad6('0xae'));}var _0x3732e8=_0xc9c00e['grammar'];if(this[_0x8ad6('0x86')](_0xc9c00e[_0x8ad6('0x79')])){_0x3732e8+=','+_0xc9c00e[_0x8ad6('0x79')];}var _0x3510f3=this[_0x8ad6('0xe')]['exec']('MRCPRecog',_0x3732e8);if(_0x3510f3[_0x8ad6('0xa4')]===-0x1){return _0x3510f3;}var _0x47ed5c=this[_0x8ad6('0xa3')](_0x8ad6('0xb0'),_0x8ad6('0xcf'));if(_0x47ed5c[_0x8ad6('0xa4')]===-0x1){return _0x47ed5c;}var _0x5dee90=this[_0x8ad6('0xa3')]('RECOG_INPUT()',_0x8ad6('0xd0'));if(_0x5dee90[_0x8ad6('0xa4')]===-0x1){return _0x5dee90;}var _0x502c98=this[_0x8ad6('0xa3')](_0x8ad6('0xb3'),'SESTEK_ASR_INSTANCE');if(_0x502c98[_0x8ad6('0xa4')]===-0x1){return _0x502c98;}return this['channel'][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xb5'),_0x3732e8));};AGIVertices[_0x8ad6('0xf')]['database']=function(_0x1f8341){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0xd1'),_0x1f8341[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x1f8341[_0x8ad6('0xd2')])){return this['channel']['error'](_0x1f8341,_0x8ad6('0xd3'));}var _0x3b5cda=this[_0x8ad6('0x1a')][_0x8ad6('0x71')](this,_0x1f8341[_0x8ad6('0xd2')]);if(!_0x3b5cda){return this['channel']['error'](_0x1f8341,_0x8ad6('0xd4'));}if(!this[_0x8ad6('0x86')](_0x1f8341[_0x8ad6('0x30')])){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x1f8341,_0x8ad6('0xd5'));}var _0x11d951=_0x1f8341['query'][_0x8ad6('0xd6')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')]('query:\x20%s',_0x11d951));var _0x475cb6=this[_0x8ad6('0x2c')][_0x8ad6('0x71')](this,_0x3b5cda,_0x11d951);this[_0x8ad6('0x37')]['sync'](this,_0x1f8341,_0x11d951);if(!this[_0x8ad6('0x86')](_0x1f8341[_0x8ad6('0xd7')])){return this['channel'][_0x8ad6('0xa9')](_0x8ad6('0xd8'));}var _0x256c5f=this[_0x8ad6('0x10')][_0x8ad6('0x71')](this,_0x1f8341['variable_id']);if(!_0x256c5f){return this[_0x8ad6('0xe')]['error'](_0x1f8341,_0x8ad6('0xd9'));}var _0x4d9e1e=this;_0x475cb6[_0x8ad6('0xda')](function(_0x393e34,_0x257b7c){Object['keys'](_0x393e34)[_0x8ad6('0xda')](function(_0x33f7b1){_0x4d9e1e['channel'][_0x8ad6('0x9f')](util[_0x8ad6('0x57')](_0x8ad6('0xdb'),_0x256c5f,_0x257b7c,_0x33f7b1),_0x393e34[_0x33f7b1]);});});this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util[_0x8ad6('0x57')](_0x8ad6('0xdc'),_0x256c5f),_0x475cb6[_0x8ad6('0xdd')]);return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xde'),_0x256c5f));};AGIVertices[_0x8ad6('0xf')]['dial']=function(_0x5cdd68){logger['debug'](util['format'](_0x8ad6('0xdf'),_0x5cdd68[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x5cdd68['sip_id'])){return this['channel'][_0x8ad6('0x53')](_0x5cdd68,_0x8ad6('0xe0'));}var _0x4a5df8=this[_0x8ad6('0x1d')][_0x8ad6('0x71')](this,_0x5cdd68['sip_id']);if(!_0x4a5df8){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x5cdd68,_0x8ad6('0xe1'));}var _0x403419=this[_0x8ad6('0xe')]['exec'](_0x8ad6('0xe2'),[util['format']('SIP/%s',_0x4a5df8),_0x5cdd68[_0x8ad6('0x69')],_0x5cdd68['opts'],_0x5cdd68[_0x8ad6('0x67')]]);if(_0x403419[_0x8ad6('0xa4')]===-0x1){return _0x403419;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s',_0x8ad6('0xe2')));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0xe3')]=function(_0x4b9276){logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0xe4'),_0x4b9276[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x4b9276[_0x8ad6('0x7b')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xe5'));}if(!this[_0x8ad6('0x86')](_0x4b9276['text'])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xaa'));}this['channel'][_0x8ad6('0xe6')]=!![];this[_0x8ad6('0x37')](_0x4b9276);this[_0x8ad6('0x45')](_0x4b9276[_0x8ad6('0x5f')],'in','','');this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')](_0x8ad6('0xe7'),_0x4b9276[_0x8ad6('0x5f')]));var _0x280301=this[_0x8ad6('0x7a')][_0x8ad6('0x71')](this,_0x4b9276);if(_0x280301){for(var _0x178a59 in _0x280301){if(_0x280301[_0x8ad6('0x96')](_0x178a59)){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util['format'](_0x8ad6('0xe8'),_0x178a59[_0x8ad6('0x6d')]()),_0x280301[_0x178a59]);}}this[_0x8ad6('0x45')](_0x280301['speech'],_0x8ad6('0xe9'),_0x8ad6('0xe3'),'');return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0xea'),_0x280301[_0x8ad6('0xeb')]));}return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x4b9276,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0xec')]=function(_0x17424a){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0xed'),_0x17424a[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x17424a[_0x8ad6('0x7e')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xee'));}if(!this['isConfigured'](_0x17424a[_0x8ad6('0x7f')])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x17424a[_0x8ad6('0x80')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xef'));}if(!this[_0x8ad6('0x86')](_0x17424a[_0x8ad6('0x81')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xf0'));}if(!this['isConfigured'](_0x17424a['text'])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xaa'));}this['channel'][_0x8ad6('0xe6')]=!![];this[_0x8ad6('0x37')](_0x17424a);this['createSquareMessage'](_0x17424a['text'],'in','','');this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xf1'),_0x17424a['text']));var _0x376182=this['googleDialogflowV2'][_0x8ad6('0x71')](this,_0x17424a);if(_0x376182){for(var _0x2d3fc6 in _0x376182){if(_0x376182[_0x8ad6('0x96')](_0x2d3fc6)){if(_0x2d3fc6!==_0x8ad6('0xf2')){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util[_0x8ad6('0x57')]('DIALOGFLOW_%s',_0x2d3fc6[_0x8ad6('0x6d')]()),_0x376182[_0x2d3fc6]);}}}this[_0x8ad6('0x45')](_0x376182[_0x8ad6('0xeb')],'out',_0x8ad6('0xec'),_0x376182[_0x8ad6('0xf2')]);return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0xf3'),_0x376182['speech']));}return this['channel'][_0x8ad6('0x53')](_0x17424a,_0x8ad6('0xf4'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0xf5')]=function(_0x3cc7d5){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x3cc7d5['label']));if(!this[_0x8ad6('0x86')](_0x3cc7d5[_0x8ad6('0xf6')])){return this['channel'][_0x8ad6('0xa9')](_0x8ad6('0xf7'));}if(!this[_0x8ad6('0x86')](_0x3cc7d5[_0x8ad6('0xf8')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')]('no\x20username\x20configured');}if(!this[_0x8ad6('0x86')](_0x3cc7d5[_0x8ad6('0xf9')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xfa'));}if(!this[_0x8ad6('0x86')](_0x3cc7d5[_0x8ad6('0xfb')])){return this[_0x8ad6('0xe')]['noop'](_0x8ad6('0xaa'));}this['channel']['bot']=!![];this[_0x8ad6('0x37')](_0x3cc7d5);this[_0x8ad6('0x45')](_0x3cc7d5[_0x8ad6('0x5f')],'in','','');this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xfc'),_0x3cc7d5[_0x8ad6('0x5f')]));var _0xcd7ce1=this[_0x8ad6('0xfd')]['sync'](this,_0x3cc7d5);if(_0xcd7ce1){for(var _0x378ebf in _0xcd7ce1){if(_0xcd7ce1['hasOwnProperty'](_0x378ebf)){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util[_0x8ad6('0x57')](_0x8ad6('0xfe'),_0x378ebf[_0x8ad6('0x6d')]()),_0xcd7ce1[_0x378ebf]);}}this[_0x8ad6('0x45')](_0xcd7ce1[_0x8ad6('0xeb')],'out',_0x8ad6('0xf5'),'');if(_0xcd7ce1['audiofile']){this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xff'),_0xcd7ce1['audiofile']));var _0x50aada=this[_0x8ad6('0xe')][_0x8ad6('0x100')](_0xcd7ce1[_0x8ad6('0x101')]);try{fs[_0x8ad6('0x102')](_0xcd7ce1[_0x8ad6('0x101')]+_0x8ad6('0x103'));}catch(_0x2ed71f){logger[_0x8ad6('0x53')](_0x2ed71f);}return _0x50aada;}else{return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x104'),_0xcd7ce1[_0x8ad6('0xeb')]));}}return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x3cc7d5,_0x8ad6('0x105'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x106')]=function(_0x587243){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20END\x20(%s)\x20block',_0x587243['label']));return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x106'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x107')]=function(_0x1c0d17){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x108'),_0x1c0d17[_0x8ad6('0x39')]));var _0x336865='';if(_0x1c0d17[_0x8ad6('0x109')]){if(!this['isConfigured'](_0x1c0d17['trunk_id'])){return this['channel'][_0x8ad6('0x53')](_0x1c0d17,_0x8ad6('0x10a'));}else{var _0xc73040=parseInt(_0x1c0d17['trunk_id'],0xa);if(isNaN(_0xc73040)){_0x336865=_0x1c0d17['trunk_id'];}else{_0x336865=this[_0x8ad6('0x1f')][_0x8ad6('0x71')](this,_0x1c0d17[_0x8ad6('0x109')]);if(!_0x336865){return this['channel'][_0x8ad6('0x53')](_0x1c0d17,'no\x20trunk\x20found');}}}}else if(_0x1c0d17[_0x8ad6('0x10b')]){_0x336865=_0x1c0d17[_0x8ad6('0x10b')];}else{return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x1c0d17,'no\x20trunk\x20selected');}var _0x4cacbf=this['channel']['exec'](_0x8ad6('0xe2'),[util[_0x8ad6('0x57')]('SIP/%s/%s',_0x336865,_0x1c0d17[_0x8ad6('0x4b')]),_0x1c0d17[_0x8ad6('0x69')],_0x1c0d17[_0x8ad6('0x10c')],_0x1c0d17['url']]);if(_0x4cacbf[_0x8ad6('0xa4')]===-0x1){return _0x4cacbf;}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0x10d'),_0x8ad6('0xe2')));};AGIVertices['prototype'][_0x8ad6('0x10e')]=function(_0x50d3e2){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x10f'),_0x50d3e2[_0x8ad6('0x39')]));return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x10e'));};AGIVertices['prototype'][_0x8ad6('0xc')]=function(_0x3e6fa6){logger['info'](util['format'](_0x8ad6('0x110'),_0x3e6fa6[_0x8ad6('0x39')]));if(_0x3e6fa6['retry']===0x0){return this[_0x8ad6('0xa6')](_0x3e6fa6);}_0x3e6fa6[_0x8ad6('0xa7')]-=0x1;if(!this[_0x8ad6('0x86')](_0x3e6fa6[_0x8ad6('0x111')])){return this['channel'][_0x8ad6('0x53')](_0x3e6fa6,'no\x20file\x20audio\x20selected');}var _0x5d5b70=this[_0x8ad6('0x20')]['sync'](this,_0x3e6fa6['file_id']);if(!_0x5d5b70){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x3e6fa6,_0x8ad6('0x112'));}if(!this[_0x8ad6('0x86')](_0x3e6fa6[_0x8ad6('0xd7')])){return this['channel'][_0x8ad6('0x53')](_0x8ad6('0xd8'));}var _0x2c6a3a=this['channel'][_0x8ad6('0x113')](_0x5d5b70,_0x3e6fa6[_0x8ad6('0x114')],_0x3e6fa6['maxdigit']);var _0x846eee=_0x2c6a3a[_0x8ad6('0xa4')]?_0x2c6a3a[_0x8ad6('0xa4')][_0x8ad6('0x4e')]():'';logger[_0x8ad6('0x2f')](_0x8ad6('0x115'),JSON[_0x8ad6('0x74')](_0x2c6a3a));if(_0x2c6a3a[_0x8ad6('0xa4')]===-0x1){this[_0x8ad6('0x37')][_0x8ad6('0x71')](this,_0x3e6fa6,_0x846eee);return _0x2c6a3a;}else if(_0x2c6a3a[_0x8ad6('0xa2')]===_0x8ad6('0x69')){_0x2c6a3a[_0x8ad6('0xa4')]=_0x846eee[_0x8ad6('0xdd')]>=parseInt(_0x3e6fa6['mindigit'])?'x':'i';}else{_0x2c6a3a['result']=_0x846eee[_0x8ad6('0xdd')]>=parseInt(_0x3e6fa6[_0x8ad6('0x116')])&&_0x846eee[_0x8ad6('0xdd')]<=parseInt(_0x3e6fa6[_0x8ad6('0x117')])?'x':'i';}var _0x239943=this[_0x8ad6('0x10')][_0x8ad6('0x71')](this,_0x3e6fa6[_0x8ad6('0xd7')]);if(!_0x239943){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x3e6fa6,_0x8ad6('0xd9'));}this[_0x8ad6('0xe')][_0x8ad6('0x9f')](_0x239943,_0x846eee);if(this['isConfigured'](_0x3e6fa6[_0x8ad6('0x118')])){var _0x1d31f4=parseInt(_0x3e6fa6['hiddendigitsnum'],0xa);var _0x1b6510=rs[_0x8ad6('0x119')]({'charset':'*','length':_0x1d31f4});var _0x47f9a4=_0x846eee[_0x8ad6('0xdd')];if(_0x47f9a4>0x0){if(_0x47f9a4>_0x1d31f4){this[_0x8ad6('0x37')]['sync'](this,_0x3e6fa6,_0x3e6fa6[_0x8ad6('0x11a')]===_0x8ad6('0x11b')?_0x1b6510+_0x846eee[_0x8ad6('0x11c')](_0x1d31f4):_0x846eee[_0x8ad6('0x11c')](0x0,_0x47f9a4-_0x1d31f4)+_0x1b6510);}else{this[_0x8ad6('0x37')][_0x8ad6('0x71')](this,_0x3e6fa6,rs[_0x8ad6('0x119')]({'charset':'*','length':_0x47f9a4}));}}else{this[_0x8ad6('0x37')][_0x8ad6('0x71')](this,_0x3e6fa6,'');}}else{this[_0x8ad6('0x37')][_0x8ad6('0x71')](this,_0x3e6fa6,_0x846eee);}return _0x2c6a3a;};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0xd')]=function(_0x1a7049){logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0x11d'),_0x1a7049[_0x8ad6('0x39')]));return this[_0x8ad6('0xc')](_0x1a7049);};AGIVertices['prototype']['goal']=function(_0xb9fa8b){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x11e'),_0xb9fa8b['label']));this['createSquareDetailsReport']['sync'](this,_0xb9fa8b,_0xb9fa8b[_0x8ad6('0x11f')]);return this['channel'][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x120'),_0xb9fa8b[_0x8ad6('0x11f')]));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x121')]=function(_0x47241e){logger['info'](util['format'](_0x8ad6('0x122'),_0x47241e[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x47241e['aws_access_key_id'])||!this[_0x8ad6('0x86')](_0x47241e[_0x8ad6('0x88')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x47241e[_0x8ad6('0x5f')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xaa'));}this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')](_0x8ad6('0x123'),_0x47241e[_0x8ad6('0x5f')]));var _0x3a6e6a=this[_0x8ad6('0x87')][_0x8ad6('0x71')](this,_0x47241e);if(_0x3a6e6a){this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x124'),_0x3a6e6a));var _0x4f3178=this[_0x8ad6('0xe')]['streamFile'](_0x3a6e6a);try{fs[_0x8ad6('0x102')](_0x3a6e6a+_0x8ad6('0x103'));}catch(_0x3ce1c7){logger[_0x8ad6('0x53')](_0x3ce1c7);}return _0x4f3178;}return this['channel'][_0x8ad6('0x53')](_0x47241e,_0x8ad6('0x125'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x126')]=function(_0x214105){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x127'),_0x214105[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x214105[_0x8ad6('0x8c')])||!this[_0x8ad6('0x86')](_0x214105[_0x8ad6('0x88')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x128'));}if(!this[_0x8ad6('0x86')](_0x214105[_0x8ad6('0x8e')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')]('no\x20bot\x20name\x20configured');}if(!this[_0x8ad6('0x86')](_0x214105[_0x8ad6('0x5f')])){return this[_0x8ad6('0xe')]['noop'](_0x8ad6('0xaa'));}this[_0x8ad6('0xe')][_0x8ad6('0xe6')]=!![];this['createSquareDetailsReport'](_0x214105);this[_0x8ad6('0x45')](_0x214105[_0x8ad6('0x5f')],'in','','');this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x129'),_0x214105[_0x8ad6('0x5f')]));var _0x5f3acc=this[_0x8ad6('0x8b')]['sync'](this,_0x214105);if(_0x5f3acc){for(var _0x30ac30 in _0x5f3acc){if(_0x5f3acc[_0x8ad6('0x96')](_0x30ac30)&&_['isString'](_0x5f3acc[_0x30ac30])){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util[_0x8ad6('0x57')](_0x8ad6('0x12a'),_0x30ac30[_0x8ad6('0x6d')]()),_0x5f3acc[_0x30ac30]);}}if(_[_0x8ad6('0x48')](_0x5f3acc[_0x8ad6('0x78')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x12b'));}else{this[_0x8ad6('0x45')](_0x5f3acc[_0x8ad6('0x78')],_0x8ad6('0xe9'),_0x8ad6('0x12c'),'');return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x5f3acc[_0x8ad6('0x78')]));}}return this[_0x8ad6('0xe')]['error'](_0x214105,_0x8ad6('0x12d'));};AGIVertices['prototype']['googleasr']=function(_0x2fe96e){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x12e'),_0x2fe96e['label'],_0x2fe96e[_0x8ad6('0x69')]));if(!this[_0x8ad6('0x86')](_0x2fe96e[_0x8ad6('0x7b')])){return this[_0x8ad6('0xe')]['noop'](_0x8ad6('0xe5'));}var _0x40625f=_0x8ad6('0x12f');var _0x474b48=util['format'](_0x8ad6('0x130'),FILES_PATH,rs[_0x8ad6('0x119')](0x4));var _0x35610b=util[_0x8ad6('0x57')](_0x8ad6('0x9e'),_0x474b48,_0x40625f);var _0x5b4387=!![];if(_0x2fe96e[_0x8ad6('0x131')]===_0x8ad6('0x132')){_0x5b4387=![];}var _0x55c50e=this[_0x8ad6('0xe')][_0x8ad6('0x133')](_0x474b48,_0x40625f,_0x2fe96e[_0x8ad6('0x134')],_0x2fe96e[_0x8ad6('0x69')],undefined,_0x5b4387);if(_0x55c50e[_0x8ad6('0xa4')]!==-0x1){this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')]('google\x20%s\x20file\x20created',_0x35610b));var _0x2c0cd8=this[_0x8ad6('0x8f')][_0x8ad6('0x71')](this,_0x2fe96e,_0x35610b);if(_0x2c0cd8){for(var _0x5f00dd in _0x2c0cd8){if(_0x2c0cd8[_0x8ad6('0x96')](_0x5f00dd)){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util['format']('GOOGLE_ASR_%s',_0x5f00dd[_0x8ad6('0x6d')]()),_0x2c0cd8[_0x5f00dd]);}}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')]('GoogleASR\x20Result\x20%s',JSON[_0x8ad6('0x74')](_0x2c0cd8)));}}return _0x55c50e;};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x135')]=function(_0x452c4e){logger[_0x8ad6('0x2f')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x452c4e['label']));if(!this['isConfigured'](_0x452c4e[_0x8ad6('0x92')])){return this['channel'][_0x8ad6('0xa9')](_0x8ad6('0x136'));}if(!this[_0x8ad6('0x86')](_0x452c4e[_0x8ad6('0x93')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x137'));}var _0x22335a=_0x8ad6('0x12f');var _0x70e1b6=util[_0x8ad6('0x57')](_0x8ad6('0x130'),FILES_PATH,rs[_0x8ad6('0x119')](0x4));var _0x4c4fca=util[_0x8ad6('0x57')](_0x8ad6('0x9e'),_0x70e1b6,_0x22335a);var _0xfa2ab0=!![];if(_0x452c4e[_0x8ad6('0x131')]==='NOBEEP'){_0xfa2ab0=![];}var _0x471df6=this['channel']['recordFile'](_0x70e1b6,_0x22335a,_0x452c4e[_0x8ad6('0x134')],_0x452c4e[_0x8ad6('0x69')],undefined,_0xfa2ab0);if(_0x471df6[_0x8ad6('0xa4')]!==-0x1){this['channel'][_0x8ad6('0xa9')](util[_0x8ad6('0x57')]('tilde\x20%s\x20file\x20created',_0x4c4fca));var _0x408fc9=this[_0x8ad6('0x91')]['sync'](this,_0x452c4e,_0x4c4fca);if(_0x408fc9){for(var _0x2b7eef in _0x408fc9){if(_0x408fc9[_0x8ad6('0x96')](_0x2b7eef)){this[_0x8ad6('0xe')]['setVariable'](util[_0x8ad6('0x57')](_0x8ad6('0x138'),_0x2b7eef[_0x8ad6('0x6d')]()),_0x408fc9[_0x2b7eef]);}}return this['channel'][_0x8ad6('0xa9')](util[_0x8ad6('0x57')]('TildeASR\x20Result\x20%s',JSON[_0x8ad6('0x74')](_0x408fc9)));}}return _0x471df6;};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x139')]=function(_0x4eba5b){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x13a'),_0x4eba5b[_0x8ad6('0x39')]));return this[_0x8ad6('0xe')][_0x8ad6('0x13b')](_0x4eba5b[_0x8ad6('0x3f')],_0x4eba5b[_0x8ad6('0x40')],_0x4eba5b[_0x8ad6('0x41')]);};AGIVertices['prototype'][_0x8ad6('0x13c')]=function(_0x4c4267){logger['info'](util['format'](_0x8ad6('0x13d'),_0x4c4267[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x4c4267['condition'])){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x4c4267,_0x8ad6('0x13e'));}try{var _0x543c73=eval(_0x4c4267[_0x8ad6('0x13f')])?_0x8ad6('0x140'):_0x8ad6('0x141');this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x142'),_0x4c4267[_0x8ad6('0x13f')],_0x543c73));return{'code':0xc8,'result':_0x543c73};}catch(_0x3c745e){return{'code':0xc8,'result':_0x8ad6('0x141')};}};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x143')]=function(_0x14e3e3){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x144'),_0x14e3e3[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x14e3e3[_0x8ad6('0x145')])){return this['channel'][_0x8ad6('0x53')](_0x14e3e3,_0x8ad6('0x146'));}var _0x124ed6=this[_0x8ad6('0x28')][_0x8ad6('0x71')](this,_0x14e3e3[_0x8ad6('0x145')]);if(!_0x124ed6){return this['channel'][_0x8ad6('0x53')](_0x14e3e3,_0x8ad6('0x147'));}for(var _0x49a1ae=0x0;_0x49a1ae<_0x124ed6[_0x8ad6('0xdd')];_0x49a1ae+=0x1){var _0x531196=this[_0x8ad6('0xe')]['getVariable'](util[_0x8ad6('0x57')]('IFTIME(%s?true:false)',_0x124ed6[_0x49a1ae]));if(_0x531196['result']===-0x1){return _0x531196;}logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0x148'),_0x124ed6[_0x49a1ae],_0x531196[_0x8ad6('0xa2')]));if(_0x531196[_0x8ad6('0xa2')]===_0x8ad6('0x140')){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x148'),_0x124ed6[_0x49a1ae],_0x8ad6('0x140')));this['channel']['noop'](util[_0x8ad6('0x57')](_0x8ad6('0x148'),_0x124ed6[_0x49a1ae],'true'));return{'code':0xc8,'result':_0x8ad6('0x140')};}else{logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0x148'),_0x124ed6[_0x49a1ae],_0x8ad6('0x141')));this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')](_0x8ad6('0x148'),_0x124ed6[_0x49a1ae],_0x8ad6('0x141')));}}return{'code':0xc8,'result':_0x8ad6('0x141')};};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x149')]=function(_0x4ede35){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x14a'),_0x4ede35['label']));return this[_0x8ad6('0xe')][_0x8ad6('0x149')]();};AGIVertices['prototype'][_0x8ad6('0x14b')]=function(_0x41464f){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x14c'),_0x41464f[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x41464f[_0x8ad6('0x7b')])){return this[_0x8ad6('0xe')]['noop']('no\x20key\x20configured');}var _0x2ca131='wav';var _0x18a160=util[_0x8ad6('0x57')](_0x8ad6('0x130'),FILES_PATH,rs[_0x8ad6('0x119')](0x4));var _0x550107=util['format'](_0x8ad6('0x9e'),_0x18a160,_0x2ca131);var _0x280b43=!![];if(_0x41464f['beep']===_0x8ad6('0x132')){_0x280b43=![];}var _0x598c16=this[_0x8ad6('0xe')][_0x8ad6('0x133')](_0x18a160,_0x2ca131,_0x41464f[_0x8ad6('0x134')],_0x41464f[_0x8ad6('0x69')],undefined,_0x280b43);if(_0x598c16[_0x8ad6('0xa4')]!==-0x1){this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')](_0x8ad6('0x14d'),_0x550107));var _0x340ef8=this[_0x8ad6('0x84')][_0x8ad6('0x71')](this,_0x41464f,_0x550107);if(_0x340ef8){for(var _0x5ca8e0 in _0x340ef8){if(_0x340ef8['hasOwnProperty'](_0x5ca8e0)){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util['format']('ISPEECH_ASR_%s',_0x5ca8e0['toUpperCase']()),_0x340ef8[_0x5ca8e0]);}}return this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')](_0x8ad6('0x14e'),JSON[_0x8ad6('0x74')](_0x340ef8)));}}return _0x598c16;};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x14f')]=function(_0x1b5bfe){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x150'),_0x1b5bfe[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x1b5bfe[_0x8ad6('0x7b')])){return this['channel'][_0x8ad6('0xa9')](_0x8ad6('0xe5'));}if(!this[_0x8ad6('0x86')](_0x1b5bfe[_0x8ad6('0x5f')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')]('no\x20text\x20configured');}this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x151'),_0x1b5bfe[_0x8ad6('0x5f')]));var _0x39bbbe=this[_0x8ad6('0x82')][_0x8ad6('0x71')](this,_0x1b5bfe);if(_0x39bbbe){this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x14d'),_0x39bbbe));var _0x38afb2=this['channel'][_0x8ad6('0x100')](_0x39bbbe,_0x1b5bfe[_0x8ad6('0x134')]);try{fs[_0x8ad6('0x102')](_0x39bbbe+_0x8ad6('0x103'));}catch(_0x21e579){logger[_0x8ad6('0x53')](_0x21e579);}return _0x38afb2;}return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x1b5bfe,_0x8ad6('0x152'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x153')]=function(_0xc1352c){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xc1352c[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0xc1352c[_0x8ad6('0x154')])){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0xc1352c,_0x8ad6('0x155'));}logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0x156'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0xc1352c[_0x8ad6('0x154')]));var _0x137bf9=this['agentLogin'][_0x8ad6('0x71')](this,_0xc1352c[_0x8ad6('0x154')]);if(_0x137bf9){logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0x157'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0xc1352c[_0x8ad6('0x154')]));this[_0x8ad6('0xe')]['noop'](util[_0x8ad6('0x57')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad6('0xe')]['callerid'],_0xc1352c['findBy']));return{'code':0xc8,'result':_0x8ad6('0x158')};}else{logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0x159'),this[_0x8ad6('0xe')]['callerid'],_0xc1352c[_0x8ad6('0x154')]));this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x159'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0xc1352c[_0x8ad6('0x154')]));return{'code':0xc8,'result':_0x8ad6('0x15a')};}};AGIVertices[_0x8ad6('0xf')]['logout']=function(_0x1c141d){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1c141d[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x1c141d[_0x8ad6('0x154')])){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x1c141d,_0x8ad6('0x155'));}logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x156'),this['channel'][_0x8ad6('0x3d')],_0x1c141d[_0x8ad6('0x154')]));var _0x58fc29=this[_0x8ad6('0x15b')]['sync'](this,_0x1c141d['findBy']);if(_0x58fc29){logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0x157'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1c141d[_0x8ad6('0x154')]));this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0x157'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1c141d[_0x8ad6('0x154')]));return{'code':0xc8,'result':_0x8ad6('0x158')};}else{logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0x159'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1c141d[_0x8ad6('0x154')]));this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x159'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1c141d[_0x8ad6('0x154')]));return{'code':0xc8,'result':_0x8ad6('0x15a')};}};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x15c')]=function(_0x51e550){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x51e550[_0x8ad6('0x39')]));if(!this['isConfigured'](_0x51e550['operation'])){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x51e550,_0x8ad6('0x15d'));}this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0x15e'),_0x51e550['operation']));var _0x3ae9f0=eval(_0x51e550[_0x8ad6('0x15f')]);if(!this[_0x8ad6('0x86')](_0x51e550[_0x8ad6('0xd7')])){return this[_0x8ad6('0xe')]['noop'](_0x8ad6('0xd8'));}var _0x2cce1d=this[_0x8ad6('0x10')][_0x8ad6('0x71')](this,_0x51e550['variable_id']);if(!_0x2cce1d){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x51e550,_0x8ad6('0xd9'));}if(_[_0x8ad6('0x9b')](_0x3ae9f0)){var _0x3c92e7=this;_0x3ae9f0[_0x8ad6('0xda')](function(_0x5be490,_0x2a9a5b){_0x3c92e7[_0x8ad6('0xe')][_0x8ad6('0x9f')](util['format'](_0x8ad6('0x160'),_0x2cce1d,_0x2a9a5b),_0x5be490);});return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x161'),_0x2cce1d));}else{return this['channel'][_0x8ad6('0x9f')](_0x2cce1d,_0x3ae9f0);}};AGIVertices[_0x8ad6('0xf')]['menu']=function(_0x1c50c8){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x162'),_0x1c50c8[_0x8ad6('0x39')]));if(_0x1c50c8[_0x8ad6('0xa7')]===0x0){return this[_0x8ad6('0xa6')](_0x1c50c8);}_0x1c50c8['retry']-=0x1;if(!this[_0x8ad6('0x86')](_0x1c50c8[_0x8ad6('0x111')])){return this['channel'][_0x8ad6('0x53')](_0x1c50c8,'no\x20file\x20audio\x20selected');}var _0x1e01fe=this['getSound'][_0x8ad6('0x71')](this,_0x1c50c8[_0x8ad6('0x111')]);if(!_0x1e01fe){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x1c50c8,_0x8ad6('0x112'));}var _0x46a142=this['channel'][_0x8ad6('0x113')](_0x1e01fe,_0x1c50c8[_0x8ad6('0x114')],_0x1c50c8[_0x8ad6('0x163')]);var _0x39602b=_0x46a142[_0x8ad6('0xa4')];if(_0x46a142['result']===-0x1){this[_0x8ad6('0x37')][_0x8ad6('0x71')](this,_0x1c50c8,'-1');return _0x46a142;}else if(_0x46a142[_0x8ad6('0xa2')]===_0x8ad6('0x69')){_0x46a142['result']=_0x46a142[_0x8ad6('0xa4')][_0x8ad6('0xdd')]>0x0?_0x46a142[_0x8ad6('0xa4')]:'t';}else if(_[_0x8ad6('0x47')](_0x46a142[_0x8ad6('0xa4')])){_0x46a142[_0x8ad6('0xa4')]='#';_0x39602b='#';}if(!this[_0x8ad6('0x86')](_0x1c50c8[_0x8ad6('0xd7')])){this[_0x8ad6('0xe')][_0x8ad6('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x239523=this[_0x8ad6('0x10')][_0x8ad6('0x71')](this,_0x1c50c8[_0x8ad6('0xd7')]);if(!_0x239523){return this[_0x8ad6('0xe')]['error'](_0x1c50c8,_0x8ad6('0xd9'));}this[_0x8ad6('0xe')][_0x8ad6('0x9f')](_0x239523,_0x39602b);}this[_0x8ad6('0x37')]['sync'](this,_0x1c50c8,_0x39602b);return _0x46a142;};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0xa9')]=function(_0x864ac6){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x164'),_0x864ac6[_0x8ad6('0x39')]));return this['channel'][_0x8ad6('0xa9')](_0x864ac6['output']||_0x864ac6[_0x8ad6('0x39')]);};AGIVertices[_0x8ad6('0xf')]['pause']=function(_0x47aa3d){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x165'),_0x47aa3d[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x47aa3d[_0x8ad6('0x154')])){return this['channel'][_0x8ad6('0x53')](_0x47aa3d,_0x8ad6('0x155'));}logger['info'](util['format'](_0x8ad6('0x156'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x47aa3d['findBy']));var _0x1c2c0e=this[_0x8ad6('0x4f')][_0x8ad6('0x71')](this,_0x47aa3d['pause_id']);var _0x273832=this['agentPause'][_0x8ad6('0x71')](this,_0x47aa3d['findBy'],_0x1c2c0e);if(_0x273832){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x47aa3d[_0x8ad6('0x154')]));this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad6('0xe')]['callerid'],_0x47aa3d[_0x8ad6('0x154')]));return{'code':0xc8,'result':_0x8ad6('0x158')};}else{logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x47aa3d[_0x8ad6('0x154')]));this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x157'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x47aa3d[_0x8ad6('0x154')]));return{'code':0xc8,'result':_0x8ad6('0x15a')};}};AGIVertices[_0x8ad6('0xf')]['playback']=function(_0x4beff3){logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0x166'),_0x4beff3[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x4beff3[_0x8ad6('0x111')])){return this['channel']['error'](_0x4beff3,_0x8ad6('0x167'));}var _0x3c392c=this['getSound'][_0x8ad6('0x71')](this,_0x4beff3['file_id']);if(!_0x3c392c){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x4beff3,_0x8ad6('0x112'));}var _0x576806=this[_0x8ad6('0xe')]['exec'](_0x8ad6('0x168'),[_0x3c392c,_0x4beff3[_0x8ad6('0x10c')]]);if(_0x576806[_0x8ad6('0xa4')]===-0x1){return _0x576806;}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0xc4'),'PLAYBACK',_0x3c392c));};AGIVertices[_0x8ad6('0xf')]['queue']=function(_0x1b0d6e){logger['info'](util[_0x8ad6('0x57')](_0x8ad6('0x169'),_0x1b0d6e['label']));if(!this['isConfigured'](_0x1b0d6e[_0x8ad6('0x16a')])){return this[_0x8ad6('0xe')]['error'](_0x1b0d6e,_0x8ad6('0x16b'));}var _0x3b4219='';var _0x51d12e=parseInt(_0x1b0d6e[_0x8ad6('0x16a')],0xa);if(isNaN(_0x51d12e)){_0x3b4219=_0x1b0d6e['queue_id'];}else{_0x3b4219=this[_0x8ad6('0x15')][_0x8ad6('0x71')](this,_0x1b0d6e[_0x8ad6('0x16a')]);if(!_0x3b4219){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x1b0d6e,_0x8ad6('0x16c'));}}var _0x1cabad='';if(this[_0x8ad6('0x86')](_0x1b0d6e[_0x8ad6('0x111')])){var _0x532fdf=this[_0x8ad6('0x20')][_0x8ad6('0x71')](this,_0x1b0d6e[_0x8ad6('0x111')]);if(_0x532fdf){_0x1cabad=_0x532fdf;}}this[_0x8ad6('0x37')]['sync'](this,_0x1b0d6e,_0x3b4219);if(_0x1b0d6e['opts']['indexOf']('x')<0x0){_0x1b0d6e[_0x8ad6('0x10c')]+='x';}if(_0x1b0d6e[_0x8ad6('0x10c')]['indexOf']('X')<0x0){_0x1b0d6e[_0x8ad6('0x10c')]+='X';}this[_0x8ad6('0xe')][_0x8ad6('0x9f')](_0x8ad6('0x16d'),_0x3b4219?_0x3b4219[_0x8ad6('0x16e')]():'');var _0x124d72=this[_0x8ad6('0xe')][_0x8ad6('0x5a')](_0x8ad6('0x16f'),[_0x3b4219,_0x1b0d6e[_0x8ad6('0x10c')],_0x1b0d6e['url'],_0x1cabad,_0x1b0d6e[_0x8ad6('0x69')],_0x1b0d6e[_0x8ad6('0x6')],_0x1b0d6e[_0x8ad6('0x170')],_0x1b0d6e[_0x8ad6('0x171')],'',_0x1b0d6e[_0x8ad6('0x172')]]);if(_0x124d72['result']===-0x1){return _0x124d72;}return this['channel'][_0x8ad6('0xa9')](util[_0x8ad6('0x57')]('Executed\x20command\x20%s\x20%s',_0x8ad6('0x16f'),_0x3b4219));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x173')]=function(_0x1c21ec){logger['info'](util['format'](_0x8ad6('0x174'),_0x1c21ec['label']));var _0x50f40a=_0x1c21ec[_0x8ad6('0x175')]||_0x8ad6('0x12f');var _0x4c6cc4=util['format'](_0x8ad6('0x176'),this[_0x8ad6('0xe')]['uniqueid'],rs[_0x8ad6('0x119')](0x5));var _0x193327=util[_0x8ad6('0x57')](_0x8ad6('0x177'),FILES_PATH,_0x4c6cc4,_0x50f40a);var _0x4a9462=util[_0x8ad6('0x57')](_0x8ad6('0x130'),FILES_PATH,_0x4c6cc4);this['createSquareRecording'][_0x8ad6('0x71')](this,_0x1c21ec,_0x4c6cc4,_0x193327);this[_0x8ad6('0xe')][_0x8ad6('0x9f')](_0x8ad6('0x178'),_0x4c6cc4);logger[_0x8ad6('0x2f')](_0x8ad6('0x179'),_0x4a9462,_0x50f40a,_0x1c21ec[_0x8ad6('0x17a')],_0x1c21ec['timeout']);return this[_0x8ad6('0xe')][_0x8ad6('0x133')](_0x4a9462,_0x50f40a,_0x1c21ec[_0x8ad6('0x17a')],_0x1c21ec[_0x8ad6('0x69')],undefined,!![]);};AGIVertices['prototype'][_0x8ad6('0x17b')]=function(_0x314ae3){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x17c'),_0x314ae3['label']));if(!this['isConfigured'](_0x314ae3[_0x8ad6('0x67')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x17d'));}var _0x42ffe7=this[_0x8ad6('0x66')][_0x8ad6('0x71')](this,_0x314ae3);logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Response:',util[_0x8ad6('0x17e')](_0x42ffe7,{'showHidden':![],'depth':null})));if(!this[_0x8ad6('0x86')](_0x314ae3[_0x8ad6('0xd7')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x17f'));}var _0x45a3b2=this[_0x8ad6('0x10')][_0x8ad6('0x71')](this,_0x314ae3[_0x8ad6('0xd7')]);if(!_0x45a3b2){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x314ae3,_0x8ad6('0xd9'));}this[_0x8ad6('0xe')]['setVariable'](util[_0x8ad6('0x57')](_0x8ad6('0x180'),_0x45a3b2),_0x42ffe7[_0x8ad6('0x76')]?_0x42ffe7[_0x8ad6('0x76')]:_0x8ad6('0x181'));this[_0x8ad6('0xe')][_0x8ad6('0x9f')](util[_0x8ad6('0x57')](_0x8ad6('0x182'),_0x45a3b2),_0x42ffe7[_0x8ad6('0x77')]?_0x42ffe7[_0x8ad6('0x77')]:'OK');if(_0x42ffe7['body']){try{this[_0x8ad6('0x9d')](_0x42ffe7['body'],_0x45a3b2);}catch(_0xeed40){logger[_0x8ad6('0x53')](util[_0x8ad6('0x57')](_0x8ad6('0x183'),_0x45a3b2));}}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0xde'),_0x45a3b2));};AGIVertices[_0x8ad6('0xf')]['saydigits']=function(_0xfd0ea5){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xfd0ea5['label']));return this[_0x8ad6('0xe')][_0x8ad6('0x184')](_0xfd0ea5[_0x8ad6('0x185')]['replace'](/\s+/g,''),_0xfd0ea5['escape_digits']);};AGIVertices['prototype'][_0x8ad6('0x186')]=function(_0x3be9b7){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x187'),_0x3be9b7[_0x8ad6('0x39')]));return this[_0x8ad6('0xe')]['sayNumber'](_0x3be9b7['number'][_0x8ad6('0xd6')](/\s+/g,''),_0x3be9b7['escape_digits']);};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x188')]=function(_0x2bf81a){logger['info'](util[_0x8ad6('0x57')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2bf81a[_0x8ad6('0x39')]));return this[_0x8ad6('0xe')][_0x8ad6('0x189')](_0x2bf81a[_0x8ad6('0x5f')],_0x2bf81a[_0x8ad6('0x17a')]);};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x18a')]=function(_0x50e817){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x18b'),_0x50e817[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x50e817[_0x8ad6('0x18c')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')]('no\x20mail\x20account\x20configured');}var _0x235096=this['getMailAccount'][_0x8ad6('0x71')](this,_0x50e817[_0x8ad6('0x18c')]);if(!_0x235096||!_0x235096['Smtp']){return this['channel'][_0x8ad6('0x53')](_0x50e817,_0x8ad6('0x18d'));}var _0x14797a={'from':util[_0x8ad6('0x57')](_0x8ad6('0x18e'),_0x235096[_0x8ad6('0x19')],_0x235096['email']||_0x235096[_0x8ad6('0x18f')][_0x8ad6('0x190')]),'to':_0x50e817['to']||'','cc':_0x50e817['cc']||'','bcc':_0x50e817[_0x8ad6('0x191')]||'','subject':_0x50e817[_0x8ad6('0x192')],'html':_0x50e817[_0x8ad6('0x5f')],'text':_0x50e817['text']};var _0x205ade={'tls':{'rejectUnauthorized':![]}};if(_0x235096[_0x8ad6('0x18f')][_0x8ad6('0x193')]){_0x205ade[_0x8ad6('0x193')]=_0x235096[_0x8ad6('0x18f')][_0x8ad6('0x193')];}else{_0x205ade[_0x8ad6('0x194')]=_0x235096[_0x8ad6('0x18f')][_0x8ad6('0x194')];_0x205ade[_0x8ad6('0x195')]=_0x235096['Smtp'][_0x8ad6('0x195')];_0x205ade[_0x8ad6('0x196')]=_0x235096[_0x8ad6('0x18f')][_0x8ad6('0x196')];}if(_0x235096[_0x8ad6('0x18f')]['authentication']){_0x205ade[_0x8ad6('0x197')]={'user':_0x235096[_0x8ad6('0x18f')][_0x8ad6('0x190')],'pass':_0x235096['Smtp'][_0x8ad6('0x198')]};}if(this[_0x8ad6('0x86')](_0x50e817[_0x8ad6('0x199')])){}logger['debug'](_0x8ad6('0x19a'),JSON['stringify'](_0x14797a));this[_0x8ad6('0x37')][_0x8ad6('0x71')](this,_0x50e817,_0x50e817[_0x8ad6('0x18c')]);this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x235096[_0x8ad6('0x19')]));this[_0x8ad6('0x26')][_0x8ad6('0x71')](this,_0x205ade,_0x14797a);return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x19b'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x19c')]=function(_0x48a004){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x19d'),_0x48a004[_0x8ad6('0x39')]));return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x19e'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x19f')]=function(_0x341bc9){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x341bc9['label']));if(!this[_0x8ad6('0x86')](_0x341bc9[_0x8ad6('0x1a0')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x1a1'));}var _0x38b63f=this[_0x8ad6('0x34')][_0x8ad6('0x71')](this,_0x341bc9[_0x8ad6('0x1a0')]);if(!_0x38b63f){return this['channel'][_0x8ad6('0x53')](_0x341bc9,_0x8ad6('0x1a2'));}var _0x28e8af={'body':_0x341bc9[_0x8ad6('0x1a3')],'phone':_0x341bc9['to']||'','SmsAccountId':_0x38b63f['id']};logger['debug'](_0x8ad6('0x1a4'),JSON['stringify'](_0x28e8af));this[_0x8ad6('0x37')]['sync'](this,_0x341bc9,_0x341bc9[_0x8ad6('0x1a0')]);this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0x1a5'),_0x38b63f[_0x8ad6('0x19')]));this[_0x8ad6('0x36')][_0x8ad6('0x71')](this,_0x28e8af);return this['channel']['noop'](_0x8ad6('0x1a6'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1a7')]=function(_0x5705d8){logger[_0x8ad6('0x2f')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x5705d8[_0x8ad6('0x39')]));if(!this['isConfigured'](_0x5705d8[_0x8ad6('0xd7')])){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x5705d8,_0x8ad6('0x1a8'));}var _0x268a2c=this[_0x8ad6('0x10')][_0x8ad6('0x71')](this,_0x5705d8['variable_id']);if(!_0x268a2c){return this['channel'][_0x8ad6('0x53')](_0x5705d8,'no\x20variable\x20found');}return this[_0x8ad6('0xe')][_0x8ad6('0x9f')](_0x268a2c,_0x5705d8[_0x8ad6('0x1a9')]);};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1aa')]=function(_0x559809){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x1ab'),_0x559809['label']));this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x1ac'));if(_0x559809[_0x8ad6('0x1ad')]===_0x8ad6('0x1ae')){this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x1af'));return this[_0x8ad6('0xe')][_0x8ad6('0x1ad')]();}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0x1b0'));};AGIVertices[_0x8ad6('0xf')]['subproject']=function(_0x2ebb25){logger[_0x8ad6('0x2f')](util['format'](_0x8ad6('0x1b1'),_0x2ebb25[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x2ebb25[_0x8ad6('0x1b2')])){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x2ebb25,_0x8ad6('0x1b3'));}var _0x516264=this['getSquareProject'][_0x8ad6('0x71')](this,_0x2ebb25[_0x8ad6('0x1b2')]);if(!this[_0x8ad6('0x86')](_0x516264)){return this[_0x8ad6('0xe')]['error'](_0x2ebb25,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2ebb25[_0x8ad6('0x1b2')]));}if(_0x516264===this[_0x8ad6('0xe')]['arg_1']){return this['channel'][_0x8ad6('0x53')](_0x2ebb25,_0x8ad6('0x1b4'));}this[_0x8ad6('0x37')][_0x8ad6('0x71')](this,_0x2ebb25,_0x516264);var _0x5cbaf6=this[_0x8ad6('0xe')]['exec']('AGI',util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x8ad6('0x194')]||_0x8ad6('0x1b5'),_0x516264,this['channel']['arg_1']));if(_0x5cbaf6[_0x8ad6('0xa4')]===-0x1){return _0x5cbaf6;}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0xc4'),_0x8ad6('0x1b6'),_0x516264));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1b7')]=function(_0x5eb2b3){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x1b8'),_0x5eb2b3['label']));var _0x3be49e=this['shellCommand'][_0x8ad6('0x71')](this,_0x5eb2b3[_0x8ad6('0xb7')]);this['createSquareDetailsReport'][_0x8ad6('0x71')](this,_0x5eb2b3,_0x5eb2b3[_0x8ad6('0xb7')]);if(this['isConfigured'](_0x5eb2b3['variable_id'])){var _0x43359d=this['getVariable']['sync'](this,_0x5eb2b3[_0x8ad6('0xd7')]);if(_0x43359d){this[_0x8ad6('0xe')][_0x8ad6('0x9f')](_0x43359d,_0x3be49e);return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x1b9'),_0x5eb2b3[_0x8ad6('0xb7')],_0x43359d));}}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x1ba'),_0x5eb2b3[_0x8ad6('0xb7')]));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1bb')]=function(_0x428184){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x428184[_0x8ad6('0x39')]));_0x428184['text']=_0x428184[_0x8ad6('0x5f')][_0x8ad6('0xd6')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x428184['apiKey'])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')]('no\x20apiKey\x20configured');}if(!this[_0x8ad6('0x86')](_0x428184[_0x8ad6('0x5f')])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x8ad6('0x57')](_0x8ad6('0x1bc'),_0x428184[_0x8ad6('0x5f')]));var _0x5a3a89=this[_0x8ad6('0x5c')][_0x8ad6('0x71')](this,_0x428184);if(_0x5a3a89){this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util['format'](_0x8ad6('0x1bd'),_0x5a3a89));var _0x14cb35=this[_0x8ad6('0xe')][_0x8ad6('0x100')](_0x5a3a89);try{fs[_0x8ad6('0x102')](_0x5a3a89+_0x8ad6('0x103'));}catch(_0x5378fa){logger['error'](_0x5378fa);}return _0x14cb35;}return this[_0x8ad6('0xe')]['error'](_0x428184,_0x8ad6('0x1be'));};AGIVertices[_0x8ad6('0xf')]['tts']=function(_0x3ef45c){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x1bf'),_0x3ef45c['label']));_0x3ef45c[_0x8ad6('0x5f')]=_0x3ef45c[_0x8ad6('0x5f')][_0x8ad6('0xd6')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ad6('0x86')](_0x3ef45c['text'])){return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](_0x8ad6('0xaa'));}this['channel'][_0x8ad6('0xa9')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x3ef45c[_0x8ad6('0x5f')]));var _0x2e3f6f=this[_0x8ad6('0x64')][_0x8ad6('0x71')](this,_0x3ef45c);if(_0x2e3f6f){this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0x1c0'),_0x2e3f6f));var _0x239b24=this['channel'][_0x8ad6('0x100')](_0x2e3f6f);try{fs[_0x8ad6('0x102')](_0x2e3f6f+'.wav');}catch(_0xc1467f){logger['error'](_0xc1467f);}return _0x239b24;}return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x3ef45c,_0x8ad6('0x1c1'));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1c2')]=function(_0x1dbe12){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x1c3'),_0x1dbe12[_0x8ad6('0x39')]));if(!this['isConfigured'](_0x1dbe12['findBy'])){return this['channel'][_0x8ad6('0x53')](_0x1dbe12,_0x8ad6('0x155'));}logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1dbe12['findBy']));var _0x558d5b=this[_0x8ad6('0x54')]['sync'](this,_0x1dbe12[_0x8ad6('0x154')]);if(_0x558d5b){logger['info'](util[_0x8ad6('0x57')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1dbe12['findBy']));this['channel'][_0x8ad6('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1dbe12[_0x8ad6('0x154')]));return{'code':0xc8,'result':_0x8ad6('0x158')};}else{logger['info'](util['format'](_0x8ad6('0x159'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1dbe12[_0x8ad6('0x154')]));this['channel'][_0x8ad6('0xa9')](util['format'](_0x8ad6('0x159'),this[_0x8ad6('0xe')][_0x8ad6('0x3d')],_0x1dbe12[_0x8ad6('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8ad6('0xf')]['voicemail']=function(_0x110921){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x110921[_0x8ad6('0x39')]));var _0x4c2c2b=this['channel'][_0x8ad6('0x5a')]('VOICEMAIL',[_0x110921[_0x8ad6('0x1c4')],_0x110921[_0x8ad6('0x79')]]);if(_0x4c2c2b[_0x8ad6('0xa4')]===-0x1){return _0x4c2c2b;}return this[_0x8ad6('0xe')][_0x8ad6('0xa9')](util[_0x8ad6('0x57')](_0x8ad6('0xc4'),_0x8ad6('0x1c5'),_0x110921[_0x8ad6('0x1c4')]));};AGIVertices[_0x8ad6('0xf')][_0x8ad6('0x1c6')]=function(_0x307447){logger[_0x8ad6('0x2f')](util[_0x8ad6('0x57')](_0x8ad6('0x1c7'),_0x307447[_0x8ad6('0x39')]));if(!this[_0x8ad6('0x86')](_0x307447[_0x8ad6('0xd7')])){return this[_0x8ad6('0xe')]['error'](_0x307447,_0x8ad6('0x1a8'));}var _0x1eab4c=this[_0x8ad6('0x10')]['sync'](this,_0x307447[_0x8ad6('0xd7')]);if(!_0x1eab4c){return this[_0x8ad6('0xe')][_0x8ad6('0x53')](_0x307447,_0x8ad6('0xd9'));}var _0x2271ab=this[_0x8ad6('0xe')]['getVariable'](_0x1eab4c);return{'code':0xc8,'result':_0x2271ab[_0x8ad6('0xa2')]?_0x2271ab[_0x8ad6('0xa2')]:'-'};};String['prototype'][_0x8ad6('0xa1')]=function(_0x47ab08,_0x2f898c){return this['split'](_0x47ab08)[_0x8ad6('0x1c8')](_0x2f898c);};module[_0x8ad6('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 9f979f4..aacdee2 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x39e85c,_0x3bca61){var _0xf96780=function(_0x3b0708){while(--_0x3b0708){_0x39e85c['push'](_0x39e85c['shift']());}};_0xf96780(++_0x3bca61);}(_0x7a54,0x106));var _0x47a5=function(_0x3cd87e,_0x3001fe){_0x3cd87e=_0x3cd87e-0x0;var _0x211f57=_0x7a54[_0x3cd87e];return _0x211f57;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file +var _0x7a54=['[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0x235074,_0x554348){var _0x5be525=function(_0xf2ca26){while(--_0xf2ca26){_0x235074['push'](_0x235074['shift']());}};_0x5be525(++_0x554348);}(_0x7a54,0x106));var _0x47a5=function(_0x517640,_0x2afe64){_0x517640=_0x517640-0x0;var _0x43fe68=_0x7a54[_0x517640];return _0x43fe68;};'use strict';var util=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var ami=require('../ami');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x47a5('0x5'));function Acw(_0x11bf85){this[_0x47a5('0x6')]=_0x11bf85[_0x47a5('0x6')];this[_0x47a5('0x7')]=_0x11bf85['agents'];this[_0x47a5('0x8')]=_0x11bf85['timers'];this[_0x47a5('0x9')]={};ami['on'](_0x47a5('0xa'),this['syncAgentConnect'][_0x47a5('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x47a5('0xc'),this[_0x47a5('0xd')]['bind'](this));ami['on'](_0x47a5('0xe'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x47a5('0xf'),this[_0x47a5('0x10')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x11'),this[_0x47a5('0x12')][_0x47a5('0xb')](this));ami['on'](_0x47a5('0x13'),this['syncAgentConnectPreview'][_0x47a5('0xb')](this));}function getDiff(_0x221b54){var _0x1cf309=moment()[_0x47a5('0x14')](0x0);var _0x139f25=moment(_0x221b54)[_0x47a5('0x14')](0x0);return _0x1cf309[_0x47a5('0x15')](_0x139f25,_0x47a5('0x16'));}Acw['prototype'][_0x47a5('0x17')]=function(_0x11faf5){try{var _0x3b001e=this;var _0x2a2cbb=this[_0x47a5('0x9')][_0x11faf5]['interface'];var _0x549de3=this[_0x47a5('0x9')][_0x11faf5]['queue'];var _0x5247fd=this[_0x47a5('0x6')][_0x549de3];var _0xaf70a6=![];var _0x2ce454=_0x47a5('0x18');if(_0x5247fd[_0x47a5('0x19')]){if(_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')]){_0xaf70a6=!![];_0x2ce454=_0x5247fd[_0x47a5('0x1a')][_0x47a5('0x1b')];}}ami['Action']({'action':_0x47a5('0x1c'),'interface':_0x2a2cbb,'paused':!![],'reason':_0x2ce454})[_0x47a5('0x1d')](function(_0x47cf3c){if(_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]){return RpcUser[_0x47a5('0x1e')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb]['id'])['then'](function(_0xb8ae6c){if(_0xb8ae6c&&!_0xb8ae6c[_0x47a5('0x1f')]){logger[_0x47a5('0x20')](_0x47a5('0x21'),_0x11faf5,_0x2a2cbb,_0x549de3);var _0x5ef1b1=_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x22')]&&_0x3b001e['channels'][_0x11faf5][_0x47a5('0x23')]?_0x3b001e[_0x47a5('0x9')][_0x11faf5][_0x47a5('0x23')]:_0x11faf5;return RpcUser[_0x47a5('0x24')](_0x3b001e[_0x47a5('0x7')][_0x2a2cbb],_0x2ce454,_0x5ef1b1)['then'](function(_0x53078a){if(!_0xaf70a6){_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]={};logger['info'](_0x47a5('0x25'),_0x11faf5,_0x3b001e['voiceQueues'][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=setTimeout(_0x3b001e[_0x47a5('0x28')][_0x47a5('0xb')](_0x3b001e,_0x2a2cbb),_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')]*0x3e8);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x29')]=moment()[_0x47a5('0x2a')](_0x47a5('0x2b'));_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x2c')]=_0x11faf5;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2d')]=_0x549de3;_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2e')]=function(){var _0x9ac908=getDiff(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb]['lastPauseAt']);clearTimeout(_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]);_0x3b001e[_0x47a5('0x8')][_0x2a2cbb][_0x47a5('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x9ac908},_0x3b001e['timers'][_0x2a2cbb][_0x47a5('0x2c')],_0x2a2cbb)[_0x47a5('0x1d')](function(_0x5bd7eb){logger['info'](_0x47a5('0x2f'),_0x11faf5,_0x9ac908,_0x5bd7eb);})[_0x47a5('0x30')](function(_0x57bff6){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x11faf5,_0x57bff6);});delete _0x3b001e[_0x47a5('0x8')][_0x2a2cbb];};}});}else{logger[_0x47a5('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x11faf5,_0x2a2cbb,_0x549de3);}});}})['catch'](function(_0x274e34){logger['error'](_0x47a5('0x25'),_0x11faf5,_0x3b001e[_0x47a5('0x6')][_0x549de3][_0x47a5('0x26')],_0x2a2cbb,_0x549de3);})['finally'](function(){delete _0x3b001e[_0x47a5('0x9')][_0x11faf5];});}catch(_0x50c086){logger['error'](_0x47a5('0x32'),_0x50c086['message']);}};Acw[_0x47a5('0x33')]['stopAcw']=function(_0x21ad34){try{var _0x3534cb=this;if(_0x3534cb[_0x47a5('0x8')][_0x21ad34]){_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x27')]=![];var _0xed6320=_0x3534cb[_0x47a5('0x8')][_0x21ad34][_0x47a5('0x2c')];var _0x1a0d23=_0x3534cb['timers'][_0x21ad34][_0x47a5('0x2d')];var _0x10f136=_0x3534cb['voiceQueues'][_0x1a0d23][_0x47a5('0x26')];logger[_0x47a5('0x20')](_0x47a5('0x34'),_0xed6320,_0x21ad34);RpcUser['saveUnpause'](this[_0x47a5('0x7')][_0x21ad34]);RpcVoiceAgentReport[_0x47a5('0x35')]({'acwtime':_0x10f136,'agentacw':!![]},_0xed6320,_0x21ad34)['then'](function(_0x2ebba0){logger[_0x47a5('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0xed6320,_0x10f136,_0x2ebba0);})['catch'](function(_0x5ebd8c){logger[_0x47a5('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xed6320,_0x5ebd8c);});}else{logger[_0x47a5('0x31')](_0x47a5('0x36'),_0x21ad34);if(_0x3534cb[_0x47a5('0x8')]){logger[_0x47a5('0x20')](_0x47a5('0x37'),JSON[_0x47a5('0x38')](_0x3534cb[_0x47a5('0x8')]));}}}catch(_0x1f3d01){logger[_0x47a5('0x31')](_0x47a5('0x39'),_0x1f3d01[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x3b')]=function(_0x56dbbd){try{if(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x56dbbd[_0x47a5('0x2d')]]['acw']||this[_0x47a5('0x6')][_0x56dbbd['queue']]['mandatoryDisposition'])){if(this['agents'][_0x56dbbd['interface']]){this[_0x47a5('0x9')][_0x56dbbd['uniqueid']]={'queue':_0x56dbbd[_0x47a5('0x2d')],'interface':_0x56dbbd[_0x47a5('0x3c')],'destlinkedid':_0x56dbbd[_0x47a5('0x23')]};}}}catch(_0x494526){logger[_0x47a5('0x31')](_0x47a5('0x3d'),_0x494526['message']);}};Acw['prototype'][_0x47a5('0x3e')]=function(_0x4edf7f){try{if(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]]&&(this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x4')]||this[_0x47a5('0x6')][_0x4edf7f[_0x47a5('0x2d')]][_0x47a5('0x19')])){if(this[_0x47a5('0x7')][_0x4edf7f[_0x47a5('0x3c')]]){this[_0x47a5('0x9')][_0x4edf7f[_0x47a5('0x2c')]]={'queue':_0x4edf7f[_0x47a5('0x2d')],'interface':_0x4edf7f[_0x47a5('0x3c')]};}}}catch(_0x4e5e7){logger[_0x47a5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4e5e7[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncHangupRequest']=function(_0x52b3a8){try{if(this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['uniqueid']]['attended'])){logger[_0x47a5('0x20')]('[%s][HANGUP:UNIQUEID]',_0x52b3a8[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x52b3a8[_0x47a5('0x40')]]&&_[_0x47a5('0x3f')](this[_0x47a5('0x9')][_0x52b3a8['linkedid']]['attended'])){logger[_0x47a5('0x20')](_0x47a5('0x41'),_0x52b3a8[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x52b3a8[_0x47a5('0x40')]);}}catch(_0x2c0c86){logger[_0x47a5('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2c0c86[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0xd')]=function(_0x5c3c75){try{if(this[_0x47a5('0x9')][_0x5c3c75['uniqueid']]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x2c')]][_0x47a5('0x22')]){logger[_0x47a5('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5c3c75[_0x47a5('0x2c')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x2c')]);}else if(this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]&&this[_0x47a5('0x9')][_0x5c3c75[_0x47a5('0x40')]]['attended']){logger[_0x47a5('0x20')](_0x47a5('0x42'),_0x5c3c75[_0x47a5('0x40')]);this[_0x47a5('0x17')](_0x5c3c75[_0x47a5('0x40')]);}}catch(_0x1ab0bf){logger['error'](_0x47a5('0x43'),_0x1ab0bf[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')]['syncAttendedTransfer']=function(_0x4c5ed){try{if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfereeuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x45')]);if(this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']]){this['channels'][_0x4c5ed[_0x47a5('0x46')]]['attended']=!![];this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']]=this['channels'][_0x4c5ed[_0x47a5('0x46')]];delete this[_0x47a5('0x9')][_0x4c5ed['secondtransfereruniqueid']];}}else if(!_[_0x47a5('0x44')](this[_0x47a5('0x9')][_0x4c5ed['transfertargetuniqueid']])){this['startAcw'](_0x4c5ed[_0x47a5('0x47')]);if(this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x48')]]){this[_0x47a5('0x9')][_0x4c5ed['origtransfereruniqueid']][_0x47a5('0x22')]=!![];this[_0x47a5('0x9')][_0x4c5ed[_0x47a5('0x45')]]=this['channels'][_0x4c5ed[_0x47a5('0x48')]];delete this['channels'][_0x4c5ed[_0x47a5('0x48')]];}}}catch(_0x470da6){logger[_0x47a5('0x31')](_0x47a5('0x49'),_0x470da6[_0x47a5('0x3a')]);}};Acw['prototype'][_0x47a5('0x12')]=function(_0x5d1550){try{if(this['channels'][_0x5d1550['transfereruniqueid']]){logger['info'](_0x47a5('0x4a'),JSON[_0x47a5('0x38')](_0x5d1550[_0x47a5('0x4b')]));this['startAcw'](_0x5d1550['transfereruniqueid']);}else if(this[_0x47a5('0x9')][_0x5d1550[_0x47a5('0x4c')]]){logger[_0x47a5('0x20')](_0x47a5('0x4d'),JSON[_0x47a5('0x38')](_0x5d1550['transfererlinkedid']));this[_0x47a5('0x17')](_0x5d1550['transfererlinkedid']);}}catch(_0x22c886){logger[_0x47a5('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x22c886[_0x47a5('0x3a')]);}};Acw[_0x47a5('0x33')][_0x47a5('0x4e')]=function(_0x3e8274){try{if(this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]&&this[_0x47a5('0x6')][_0x3e8274[_0x47a5('0x2d')]]['autopause']===_0x47a5('0x4f')){if(this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]]){logger[_0x47a5('0x20')](_0x47a5('0x50'),_0x3e8274['uniqueid'],_0x3e8274[_0x47a5('0x3c')],_0x3e8274[_0x47a5('0x2d')]);return RpcUser[_0x47a5('0x24')](this[_0x47a5('0x7')][_0x3e8274[_0x47a5('0x3c')]],_0x47a5('0x51'),_0x3e8274[_0x47a5('0x2c')]);}}}catch(_0x149d34){logger[_0x47a5('0x31')](_0x47a5('0x52'),_0x149d34[_0x47a5('0x3a')]);}};module[_0x47a5('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 4191845..ea79651 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa607=['action','error','format','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','fullybooted','then','actionSipShowRegistry','actionCoreShowChannels','log','asterisk-manager','moment','util','lodash','ami','asterisk','port','password','keepConnected','Action','promisify'];(function(_0xa62004,_0x29f3b4){var _0xf42eaa=function(_0x18da7a){while(--_0x18da7a){_0xa62004['push'](_0xa62004['shift']());}};_0xf42eaa(++_0x29f3b4);}(_0xa607,0x1a2));var _0x7a60=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0xa607[_0x52666e];return _0x515330;};'use strict';var Manager=require(_0x7a60('0x0'));var BPromise=require('bluebird');var moment=require(_0x7a60('0x1'));var util=require(_0x7a60('0x2'));var _=require(_0x7a60('0x3'));var logger=require('../../config/logger')(_0x7a60('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x7a60('0x5')][_0x7a60('0x6')],config['asterisk']['ip'],config[_0x7a60('0x5')]['username'],config['asterisk'][_0x7a60('0x7')],!![]);ami[_0x7a60('0x8')]();ami[_0x7a60('0x9')]=BPromise[_0x7a60('0xa')](ami[_0x7a60('0xb')]);function error(_0x5cb253){logger[_0x7a60('0xc')](util[_0x7a60('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config[_0x7a60('0x5')]['port'],util[_0x7a60('0xf')](_0x5cb253,![],null)));}function close(){logger[_0x7a60('0xc')](util[_0x7a60('0xd')](_0x7a60('0x10'),config['asterisk'][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config['asterisk'][_0x7a60('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7a60('0x9')]({'action':_0x7a60('0x11')});};};ami[_0x7a60('0x12')]=function(){return function(){return ami[_0x7a60('0x9')]({'action':_0x7a60('0x13')});};};ami[_0x7a60('0x14')]=function(){return function(){return ami[_0x7a60('0x9')]({'action':'sippeerstatus'});};};ami[_0x7a60('0x15')]=function(){return function(){return ami[_0x7a60('0x9')]({'action':_0x7a60('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x7a60('0x9')]({'action':'coreshowchannels'});};};function connect(_0x3cb2ff){logger[_0x7a60('0x17')](util[_0x7a60('0xd')](_0x7a60('0x18'),config[_0x7a60('0x5')][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config[_0x7a60('0x5')][_0x7a60('0x6')]));ami[_0x7a60('0x19')](_0x7a60('0xc'),error);ami[_0x7a60('0x19')](_0x7a60('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7a60('0x1b'),function(_0x3d3644){logger['info'](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x7a60('0x5')][_0x7a60('0xe')],config[_0x7a60('0x5')]['ip'],config[_0x7a60('0x5')][_0x7a60('0x6')],util[_0x7a60('0xf')](_0x3d3644,![],null)));});ami['on'](_0x7a60('0x1c'),function(_0x461f8e){logger[_0x7a60('0x17')](util[_0x7a60('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x7a60('0x5')][_0x7a60('0xe')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise['resolve']()[_0x7a60('0x1d')](ami[_0x7a60('0x1e')]())[_0x7a60('0x1d')](ami[_0x7a60('0x12')]())[_0x7a60('0x1d')](ami[_0x7a60('0x14')]())[_0x7a60('0x1d')](ami[_0x7a60('0x15')]())[_0x7a60('0x1d')](ami[_0x7a60('0x1f')]())['catch'](function(_0x4b84e7){console[_0x7a60('0x20')](_0x4b84e7);});});ami['once'](_0x7a60('0xc'),error);ami[_0x7a60('0x19')](_0x7a60('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0xb250=['exports','asterisk-manager','bluebird','util','lodash','../../config/logger','../../config/environment','port','asterisk','username','password','keepConnected','promisify','error','format','inspect','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','actionCoreShowChannels','catch'];(function(_0x55fcad,_0xa2237f){var _0x5942a2=function(_0x4ffce1){while(--_0x4ffce1){_0x55fcad['push'](_0x55fcad['shift']());}};_0x5942a2(++_0xa2237f);}(_0xb250,0x121));var _0x0b25=function(_0x19d190,_0x3adb92){_0x19d190=_0x19d190-0x0;var _0x124753=_0xb250[_0x19d190];return _0x124753;};'use strict';var Manager=require(_0x0b25('0x0'));var BPromise=require(_0x0b25('0x1'));var moment=require('moment');var util=require(_0x0b25('0x2'));var _=require(_0x0b25('0x3'));var logger=require(_0x0b25('0x4'))('ami');var config=require(_0x0b25('0x5'));var ami=new Manager(config['asterisk'][_0x0b25('0x6')],config[_0x0b25('0x7')]['ip'],config[_0x0b25('0x7')][_0x0b25('0x8')],config['asterisk'][_0x0b25('0x9')],!![]);ami[_0x0b25('0xa')]();ami['Action']=BPromise[_0x0b25('0xb')](ami['action']);function error(_0x44586e){logger[_0x0b25('0xc')](util[_0x0b25('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x0b25('0x7')]['username'],config['asterisk']['ip'],config[_0x0b25('0x7')]['port'],util[_0x0b25('0xe')](_0x44586e,![],null)));}function close(){logger['error'](util[_0x0b25('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0x0b25('0x7')]['ip'],config[_0x0b25('0x7')]['port']));}ami[_0x0b25('0xf')]=function(){return function(){return ami[_0x0b25('0x10')]({'action':_0x0b25('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x0b25('0x10')]({'action':_0x0b25('0x12')});};};ami[_0x0b25('0x13')]=function(){return function(){return ami[_0x0b25('0x10')]({'action':_0x0b25('0x14')});};};ami[_0x0b25('0x15')]=function(){return function(){return ami[_0x0b25('0x10')]({'action':_0x0b25('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x384e34){logger[_0x0b25('0x17')](util['format'](_0x0b25('0x18'),config[_0x0b25('0x7')]['username'],config[_0x0b25('0x7')]['ip'],config[_0x0b25('0x7')][_0x0b25('0x6')]));ami[_0x0b25('0x19')](_0x0b25('0xc'),error);ami[_0x0b25('0x19')](_0x0b25('0x1a'),close);}ami['on'](_0x0b25('0x1b'),connect);ami['on'](_0x0b25('0x1c'),function(_0x5ad6b9){logger[_0x0b25('0x17')](util[_0x0b25('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x0b25('0x7')][_0x0b25('0x8')],config['asterisk']['ip'],config[_0x0b25('0x7')][_0x0b25('0x6')],util[_0x0b25('0xe')](_0x5ad6b9,![],null)));});ami['on'](_0x0b25('0x1d'),function(_0x2c2701){logger['info'](util[_0x0b25('0xd')](_0x0b25('0x1e'),config[_0x0b25('0x7')][_0x0b25('0x8')],config[_0x0b25('0x7')]['ip'],config[_0x0b25('0x7')][_0x0b25('0x6')]));return BPromise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x0b25('0x1f')](ami[_0x0b25('0x20')]())[_0x0b25('0x1f')](ami['actionSipPeerStatus']())['then'](ami[_0x0b25('0x15')]())['then'](ami[_0x0b25('0x21')]())[_0x0b25('0x22')](function(_0x2f8154){console['log'](_0x2f8154);});});ami[_0x0b25('0x19')](_0x0b25('0xc'),error);ami['once'](_0x0b25('0x1a'),close);module[_0x0b25('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0c04770..a57ab76 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d29=['memberReport','error','message','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','request','then','debug','rpc'];(function(_0x44e407,_0x4b386c){var _0x580208=function(_0x5c5f97){while(--_0x5c5f97){_0x44e407['push'](_0x44e407['shift']());}};_0x580208(++_0x4b386c);}(_0x3d29,0xc7));var _0x93d2=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x3d29[_0x186376];return _0x2dbdd9;};'use strict';var jayson=require(_0x93d2('0x0'));var BPromise=require(_0x93d2('0x1'));var logger=require(_0x93d2('0x2'))(_0x93d2('0x3'));var client=jayson[_0x93d2('0x4')][_0x93d2('0x5')]({'port':0x2329});client[_0x93d2('0x6')]=function(_0x4c01e5,_0x3b0c24){return new BPromise(function(_0x38ea8c,_0x486e3c){return client[_0x93d2('0x7')](_0x4c01e5,_0x3b0c24)[_0x93d2('0x8')](function(_0x59180a){logger[_0x93d2('0x9')](_0x93d2('0xa'),_0x93d2('0xb'),_0x4c01e5,_0x3b0c24,_0x59180a);if(_0x59180a[_0x93d2('0xc')]){logger[_0x93d2('0xc')](_0x93d2('0xa'),_0x93d2('0xb'),_0x4c01e5,_0x59180a[_0x93d2('0xc')][_0x93d2('0xd')],_0x3b0c24);return _0x486e3c(_0x59180a[_0x93d2('0xc')][_0x93d2('0xd')]);}else{return _0x38ea8c(_0x59180a['result']);}})[_0x93d2('0xe')](function(_0x22bbf7){logger['error'](_0x93d2('0xa'),'memberReport',_0x4c01e5,_0x22bbf7,_0x3b0c24);return _0x486e3c(_0x22bbf7);});});};module['exports']=client; \ No newline at end of file +var _0x4a8d=['jayson/promise','bluebird','../../config/logger','ami','client','debug','rpc','memberReport','error','message','result','exports'];(function(_0x3d5adf,_0x25c522){var _0x61fc46=function(_0x3a4ca5){while(--_0x3a4ca5){_0x3d5adf['push'](_0x3d5adf['shift']());}};_0x61fc46(++_0x25c522);}(_0x4a8d,0x1bc));var _0xd4a8=function(_0x58df58,_0x158167){_0x58df58=_0x58df58-0x0;var _0xcfb7b0=_0x4a8d[_0x58df58];return _0xcfb7b0;};'use strict';var jayson=require(_0xd4a8('0x0'));var BPromise=require(_0xd4a8('0x1'));var logger=require(_0xd4a8('0x2'))(_0xd4a8('0x3'));var client=jayson[_0xd4a8('0x4')]['http']({'port':0x2329});client['Request']=function(_0x46603e,_0x2cc9ce){return new BPromise(function(_0x29b7d9,_0x4c1137){return client['request'](_0x46603e,_0x2cc9ce)['then'](function(_0x5b5740){logger[_0xd4a8('0x5')](_0xd4a8('0x6'),_0xd4a8('0x7'),_0x46603e,_0x2cc9ce,_0x5b5740);if(_0x5b5740[_0xd4a8('0x8')]){logger[_0xd4a8('0x8')]('rpc',_0xd4a8('0x7'),_0x46603e,_0x5b5740[_0xd4a8('0x8')]['message'],_0x2cc9ce);return _0x4c1137(_0x5b5740[_0xd4a8('0x8')][_0xd4a8('0x9')]);}else{return _0x29b7d9(_0x5b5740[_0xd4a8('0xa')]);}})['catch'](function(_0x3d7f1c){logger[_0xd4a8('0x8')](_0xd4a8('0x6'),'memberReport',_0x46603e,_0x3d7f1c,_0x2cc9ce);return _0x4c1137(_0x3d7f1c);});});};module[_0xd4a8('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 6da45f6..8fbd17a 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81a4=['originatecalleridnum','originatecalleridname','getCaller','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x81a4,0x1a6));var _0x481a=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x81a4[_0x25e109];return _0xc0f7d6;};'use strict';var util=require(_0x481a('0x0'));var _=require(_0x481a('0x1'));var moment=require(_0x481a('0x2'));function checkNameSurname(_0x712a73,_0x5a1f1f,_0x39262a){var _0x4f7de1='';if(!_[_0x481a('0x3')](_0x5a1f1f)&&_0x481a('0x4')===typeof _0x5a1f1f){_0x4f7de1+=_0x5a1f1f;}if(!_[_0x481a('0x3')](_0x39262a)&&'string'===typeof _0x39262a){_0x4f7de1+='\x20'+_0x39262a;}if(_0x4f7de1!==''){return _0x4f7de1;}return _0x712a73;}function Action(_0x25c921,_0x3a6458,_0x17d40e){this[_0x481a('0x5')]=_0x25c921;this['uniqueid']=_0x17d40e||undefined;this[_0x481a('0x6')]=checkNameSurname(_0x3a6458[_0x481a('0x7')][_0x481a('0x8')],_0x3a6458[_0x481a('0x7')][_0x481a('0x9')],_0x3a6458[_0x481a('0x7')]['lastName']);this[_0x481a('0xa')]=_0x3a6458[_0x481a('0x7')][_0x481a('0x8')];this[_0x481a('0xb')]=_0x25c921[_0x481a('0x6')];this[_0x481a('0xc')]=_0x3a6458[_0x481a('0xc')]||![];this[_0x481a('0xd')]=_0x25c921[_0x481a('0xd')];this[_0x481a('0xe')]=_0x25c921['dialQueueTimeout']||0x3;this['scheduledat']=_0x3a6458[_0x481a('0xf')];this[_0x481a('0x10')]=_0x3a6458[_0x481a('0x10')];this[_0x481a('0x11')]=_0x3a6458[_0x481a('0x11')];this[_0x481a('0x12')]=_0x3a6458['countnoanswerretry'];this[_0x481a('0x13')]=_0x3a6458['countnosuchnumberretry'];this[_0x481a('0x14')]=_0x3a6458[_0x481a('0x14')];this[_0x481a('0x15')]=_0x3a6458['countabandonedretry'];this['countmachineretry']=_0x3a6458[_0x481a('0x16')];this[_0x481a('0x17')]=_0x3a6458[_0x481a('0x17')];this[_0x481a('0x18')]=_0x3a6458[_0x481a('0x18')];this[_0x481a('0x19')]=_0x3a6458[_0x481a('0x19')];this[_0x481a('0x1a')]=_0x3a6458[_0x481a('0x1a')];this[_0x481a('0x1b')]=_0x3a6458['VoiceQueueId'];this[_0x481a('0x1c')]=_0x3a6458[_0x481a('0x1c')];this[_0x481a('0x1d')]=_0x3a6458['id'];this[_0x481a('0x1e')]=_0x3a6458[_0x481a('0x7')]['firstName']||'';this[_0x481a('0x1f')]=moment()[_0x481a('0x20')](_0x481a('0x21'));this[_0x481a('0x22')]=_0x3a6458['callback'];this[_0x481a('0x23')]=_0x3a6458[_0x481a('0x23')];this[_0x481a('0x24')]=_0x3a6458[_0x481a('0x24')];this[_0x481a('0x25')]=_0x3a6458[_0x481a('0x25')];this[_0x481a('0x26')]='';this[_0x481a('0x27')]='';}Action['prototype'][_0x481a('0x28')]=function(){return util[_0x481a('0x20')]('\x22%s\x22\x20<%s>',this[_0x481a('0x6')],this['voiceQueue'][_0x481a('0x29')]>0x0?this[_0x481a('0xa')][_0x481a('0x2a')](this[_0x481a('0x5')]['dialCutDigit']):this[_0x481a('0xa')]);};Action[_0x481a('0x2b')][_0x481a('0x2c')]=function(){return this[_0x481a('0xb')];};module[_0x481a('0x2d')]=Action; \ No newline at end of file +var _0xefd7=['ListId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','queue','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x5e5bdc,_0x40fc5e){var _0x9f5500=function(_0x2fec39){while(--_0x2fec39){_0x5e5bdc['push'](_0x5e5bdc['shift']());}};_0x9f5500(++_0x40fc5e);}(_0xefd7,0x99));var _0x7efd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefd7[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x7efd('0x0'));var _=require('lodash');var moment=require(_0x7efd('0x1'));function checkNameSurname(_0x2e43c3,_0x236d4a,_0x5de610){var _0x6f55f5='';if(!_[_0x7efd('0x2')](_0x236d4a)&&_0x7efd('0x3')===typeof _0x236d4a){_0x6f55f5+=_0x236d4a;}if(!_[_0x7efd('0x2')](_0x5de610)&&'string'===typeof _0x5de610){_0x6f55f5+='\x20'+_0x5de610;}if(_0x6f55f5!==''){return _0x6f55f5;}return _0x2e43c3;}function Action(_0x397086,_0x308794,_0x3be366){this[_0x7efd('0x4')]=_0x397086;this[_0x7efd('0x5')]=_0x3be366||undefined;this[_0x7efd('0x6')]=checkNameSurname(_0x308794[_0x7efd('0x7')][_0x7efd('0x8')],_0x308794[_0x7efd('0x7')]['firstName'],_0x308794[_0x7efd('0x7')][_0x7efd('0x9')]);this['number']=_0x308794[_0x7efd('0x7')][_0x7efd('0x8')];this['queue']=_0x397086[_0x7efd('0x6')];this[_0x7efd('0xa')]=_0x308794['active']||![];this[_0x7efd('0xb')]=_0x397086[_0x7efd('0xb')];this[_0x7efd('0xc')]=_0x397086['dialQueueTimeout']||0x3;this['scheduledat']=_0x308794[_0x7efd('0xd')];this[_0x7efd('0xe')]=_0x308794[_0x7efd('0xe')];this['countcongestionretry']=_0x308794[_0x7efd('0xf')];this[_0x7efd('0x10')]=_0x308794[_0x7efd('0x10')];this['countnosuchnumberretry']=_0x308794[_0x7efd('0x11')];this[_0x7efd('0x12')]=_0x308794['countdropretry'];this[_0x7efd('0x13')]=_0x308794['countabandonedretry'];this[_0x7efd('0x14')]=_0x308794[_0x7efd('0x14')];this[_0x7efd('0x15')]=_0x308794['countagentrejectretry'];this[_0x7efd('0x16')]=_0x308794[_0x7efd('0x16')];this[_0x7efd('0x17')]=_0x308794[_0x7efd('0x17')];this['UserId']=_0x308794['UserId'];this[_0x7efd('0x18')]=_0x308794['VoiceQueueId'];this['CampaignId']=_0x308794[_0x7efd('0x19')];this[_0x7efd('0x1a')]=_0x308794['id'];this[_0x7efd('0x1b')]=_0x308794[_0x7efd('0x7')]['firstName']||'';this[_0x7efd('0x1c')]=moment()[_0x7efd('0x1d')](_0x7efd('0x1e'));this['callback']=_0x308794[_0x7efd('0x1f')];this[_0x7efd('0x20')]=_0x308794[_0x7efd('0x20')];this[_0x7efd('0x21')]=_0x308794[_0x7efd('0x21')];this['recallme']=_0x308794[_0x7efd('0x22')];this[_0x7efd('0x23')]='';this[_0x7efd('0x24')]='';}Action[_0x7efd('0x25')][_0x7efd('0x26')]=function(){return util[_0x7efd('0x1d')](_0x7efd('0x27'),this[_0x7efd('0x6')],this['voiceQueue'][_0x7efd('0x28')]>0x0?this[_0x7efd('0x29')][_0x7efd('0x2a')](this['voiceQueue'][_0x7efd('0x28')]):this[_0x7efd('0x29')]);};Action[_0x7efd('0x25')]['getQueue']=function(){return this[_0x7efd('0x2b')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index d058db6..4d45e47 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1324=['countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue'];(function(_0x530639,_0x334948){var _0x11da9a=function(_0x4a964c){while(--_0x4a964c){_0x530639['push'](_0x530639['shift']());}};_0x11da9a(++_0x334948);}(_0x1324,0x14c));var _0x4132=function(_0x355392,_0x3ce47a){_0x355392=_0x355392-0x0;var _0x2c320c=_0x1324[_0x355392];return _0x2c320c;};'use strict';var util=require(_0x4132('0x0'));var _=require(_0x4132('0x1'));var moment=require(_0x4132('0x2'));function getSeconds(_0x37bdce,_0x4ce00d){var _0x4fb4f2=moment(_0x37bdce)[_0x4132('0x3')](0x0);var _0x16b81c=moment(_0x4ce00d)[_0x4132('0x3')](0x0);return _0x4fb4f2[_0x4132('0x4')](_0x16b81c,'seconds');}function AdditionalPhone(_0x434824){this[_0x4132('0x5')]=_0x434824['uniqueid'];this[_0x4132('0x6')]=_0x434824[_0x4132('0x6')]||undefined;this[_0x4132('0x7')]=_0x434824['type'];this['campaigntype']=_0x434824[_0x4132('0x7')]===_0x4132('0x8')?_0x4132('0x9'):_0x434824[_0x4132('0x7')];this['countbusyretry']=_0x434824[_0x4132('0xa')];this[_0x4132('0xb')]=_0x434824[_0x4132('0xb')];this['countnoanswerretry']=_0x434824['countnoanswerretry'];this[_0x4132('0xc')]=_0x434824[_0x4132('0xa')]+_0x434824[_0x4132('0xb')]+_0x434824['countnoanswerretry']+_0x434824[_0x4132('0xd')]+_0x434824[_0x4132('0xe')]+_0x434824['countabandonedretry']+_0x434824['countmachineretry']+_0x434824[_0x4132('0xf')];this[_0x4132('0xd')]=_0x434824[_0x4132('0xd')];this[_0x4132('0xe')]=_0x434824[_0x4132('0xe')];this[_0x4132('0x10')]=_0x434824[_0x4132('0x10')];this[_0x4132('0x11')]=_0x434824['countmachineretry'];this[_0x4132('0xf')]=_0x434824[_0x4132('0xf')];this[_0x4132('0x9')]=_0x434824[_0x4132('0x9')];this[_0x4132('0x12')]=_0x434824[_0x4132('0x13')];this[_0x4132('0x14')]=_0x434824[_0x4132('0x15')];this[_0x4132('0x16')]=_0x434824[_0x4132('0x16')];this[_0x4132('0x17')]=_0x434824['responsetime'];this[_0x4132('0x18')]=_0x434824[_0x4132('0x17')];this[_0x4132('0x19')]=getSeconds(_0x434824[_0x4132('0x17')],_0x434824[_0x4132('0x16')]);this[_0x4132('0x1a')]=0x0;this[_0x4132('0x1b')]=0x0;this[_0x4132('0x1c')]=_0x434824[_0x4132('0x1c')];this[_0x4132('0x1d')]=_0x434824[_0x4132('0x1d')];this['callbackat']=_0x434824['callbackat'];this[_0x4132('0x1e')]=_0x434824['recallme'];this['ContactId']=_0x434824[_0x4132('0x1f')];this[_0x4132('0x20')]=_0x434824[_0x4132('0x20')];this['UserId']=_0x434824['UserId'];this[_0x4132('0x21')]=_0x434824['VoiceQueueId'];this[_0x4132('0x22')]=_0x434824[_0x4132('0x22')];this[_0x4132('0x23')]=_0x434824[_0x4132('0x23')]||'';this[_0x4132('0x24')]=_0x434824[_0x4132('0x24')]||'';}module[_0x4132('0x25')]=History; \ No newline at end of file +var _0x097f=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry'];(function(_0x4f9d26,_0x641341){var _0x57debc=function(_0x48f368){while(--_0x48f368){_0x4f9d26['push'](_0x4f9d26['shift']());}};_0x57debc(++_0x641341);}(_0x097f,0x1b3));var _0xf097=function(_0x56a616,_0x5a3c7c){_0x56a616=_0x56a616-0x0;var _0xe94844=_0x097f[_0x56a616];return _0xe94844;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf097('0x0'));function getSeconds(_0x23fbcf,_0xe6d2db){var _0x4bfc7f=moment(_0x23fbcf)[_0xf097('0x1')](0x0);var _0x5b9459=moment(_0xe6d2db)[_0xf097('0x1')](0x0);return _0x4bfc7f[_0xf097('0x2')](_0x5b9459,_0xf097('0x3'));}function AdditionalPhone(_0x4d75a0){this[_0xf097('0x4')]=_0x4d75a0[_0xf097('0x4')];this[_0xf097('0x5')]=_0x4d75a0[_0xf097('0x5')]||undefined;this['type']=_0x4d75a0['type'];this['campaigntype']=_0x4d75a0[_0xf097('0x6')]===_0xf097('0x7')?'queue':_0x4d75a0['type'];this[_0xf097('0x8')]=_0x4d75a0['countbusyretry'];this[_0xf097('0x9')]=_0x4d75a0['countcongestionretry'];this[_0xf097('0xa')]=_0x4d75a0[_0xf097('0xa')];this[_0xf097('0xb')]=_0x4d75a0[_0xf097('0x8')]+_0x4d75a0[_0xf097('0x9')]+_0x4d75a0[_0xf097('0xa')]+_0x4d75a0[_0xf097('0xc')]+_0x4d75a0[_0xf097('0xd')]+_0x4d75a0['countabandonedretry']+_0x4d75a0['countmachineretry']+_0x4d75a0[_0xf097('0xe')];this[_0xf097('0xc')]=_0x4d75a0[_0xf097('0xc')];this[_0xf097('0xd')]=_0x4d75a0[_0xf097('0xd')];this[_0xf097('0xf')]=_0x4d75a0[_0xf097('0xf')];this[_0xf097('0x10')]=_0x4d75a0[_0xf097('0x10')];this['countagentrejectretry']=_0x4d75a0[_0xf097('0xe')];this[_0xf097('0x11')]=_0x4d75a0[_0xf097('0x11')];this[_0xf097('0x12')]=_0x4d75a0[_0xf097('0x13')];this[_0xf097('0x14')]=_0x4d75a0[_0xf097('0x15')];this['starttime']=_0x4d75a0[_0xf097('0x16')];this[_0xf097('0x17')]=_0x4d75a0[_0xf097('0x17')];this[_0xf097('0x18')]=_0x4d75a0[_0xf097('0x17')];this[_0xf097('0x19')]=getSeconds(_0x4d75a0[_0xf097('0x17')],_0x4d75a0[_0xf097('0x16')]);this[_0xf097('0x1a')]=0x0;this[_0xf097('0x1b')]=0x0;this['callback']=_0x4d75a0['callback'];this['callbackuniqueid']=_0x4d75a0['callbackuniqueid'];this[_0xf097('0x1c')]=_0x4d75a0[_0xf097('0x1c')];this[_0xf097('0x1d')]=_0x4d75a0['recallme'];this[_0xf097('0x1e')]=_0x4d75a0[_0xf097('0x1e')];this[_0xf097('0x1f')]=_0x4d75a0[_0xf097('0x1f')];this['UserId']=_0x4d75a0[_0xf097('0x20')];this[_0xf097('0x21')]=_0x4d75a0[_0xf097('0x21')];this[_0xf097('0x22')]=_0x4d75a0[_0xf097('0x22')];this[_0xf097('0x23')]=_0x4d75a0[_0xf097('0x23')]||'';this[_0xf097('0x24')]=_0x4d75a0[_0xf097('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index e110cb7..d051ede 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a46=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','talktime','membername'];(function(_0x269ee9,_0x2a01d8){var _0x3f139c=function(_0x2e96eb){while(--_0x2e96eb){_0x269ee9['push'](_0x269ee9['shift']());}};_0x3f139c(++_0x2a01d8);}(_0x6a46,0x1a1));var _0x66a4=function(_0x1c1f23,_0x17a346){_0x1c1f23=_0x1c1f23-0x0;var _0x588f7a=_0x6a46[_0x1c1f23];return _0x588f7a;};'use strict';var util=require(_0x66a4('0x0'));var _=require(_0x66a4('0x1'));var moment=require(_0x66a4('0x2'));function getSeconds(_0x19b9b0,_0xa9402a){var _0x13e020=moment(_0x19b9b0)[_0x66a4('0x3')](0x0);var _0x1408dd=moment(_0xa9402a)['milliseconds'](0x0);return _0x13e020['diff'](_0x1408dd,_0x66a4('0x4'));}function AgentComplete(_0xe37ed,_0x387737){this[_0x66a4('0x5')]=0x4;this[_0x66a4('0x6')]=_0x66a4('0x7');this['scheduledat']=_0xe37ed[_0x66a4('0x8')];this[_0x66a4('0x9')]=_0xe37ed[_0x66a4('0x9')];this[_0x66a4('0xa')]=_0xe37ed[_0x66a4('0x9')]===_0x66a4('0xb')?_0x66a4('0xc'):_0xe37ed[_0x66a4('0x9')];this[_0x66a4('0xd')]=_0xe37ed[_0x66a4('0xd')];this[_0x66a4('0xe')]=_0xe37ed[_0x66a4('0xe')];this[_0x66a4('0xf')]=_0xe37ed['countnoanswerretry'];this[_0x66a4('0x10')]=_0xe37ed[_0x66a4('0xd')]+_0xe37ed['countcongestionretry']+_0xe37ed['countnoanswerretry']+_0xe37ed[_0x66a4('0x11')]+_0xe37ed[_0x66a4('0x12')]+_0xe37ed[_0x66a4('0x13')]+_0xe37ed['countmachineretry']+_0xe37ed[_0x66a4('0x14')];this['countnosuchnumberretry']=_0xe37ed[_0x66a4('0x11')];this[_0x66a4('0x12')]=_0xe37ed[_0x66a4('0x12')];this['countabandonedretry']=_0xe37ed['countabandonedretry'];this[_0x66a4('0x15')]=_0xe37ed[_0x66a4('0x15')];this['countagentrejectretry']=_0xe37ed['countagentrejectretry'];this[_0x66a4('0x16')]=_0x387737['uniqueid'];this[_0x66a4('0x17')]=_0xe37ed[_0x66a4('0x18')];this[_0x66a4('0x19')]=_0xe37ed[_0x66a4('0x1a')];this[_0x66a4('0x1b')]=_0xe37ed[_0x66a4('0x1b')];this[_0x66a4('0x1c')]=_0xe37ed[_0x66a4('0x1c')];this['answertime']=_0xe37ed['answertime'];this[_0x66a4('0x1d')]=moment()[_0x66a4('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0xe37ed[_0x66a4('0x1c')],_0xe37ed[_0x66a4('0x1b')]);this['holdtime']=getSeconds(_0xe37ed['answertime'],_0xe37ed[_0x66a4('0x1c')]);this[_0x66a4('0x1f')]=getSeconds(this[_0x66a4('0x1d')],_0xe37ed['answertime']);this[_0x66a4('0xc')]=_0x387737[_0x66a4('0xc')];this[_0x66a4('0x20')]=_0x387737[_0x66a4('0x20')];this['reason']=_0x387737['reason'];this[_0x66a4('0x21')]=_0xe37ed['callback'];this[_0x66a4('0x22')]=_0xe37ed[_0x66a4('0x22')];this[_0x66a4('0x23')]=_0xe37ed[_0x66a4('0x23')];this[_0x66a4('0x24')]=_0xe37ed[_0x66a4('0x24')];this[_0x66a4('0x25')]=_0xe37ed[_0x66a4('0x25')];this[_0x66a4('0x26')]=_0xe37ed['ListId'];this[_0x66a4('0x27')]=_0xe37ed[_0x66a4('0x27')];this[_0x66a4('0x28')]=_0xe37ed['VoiceQueueId'];this['CampaignId']=_0xe37ed[_0x66a4('0x29')];this[_0x66a4('0x2a')]=_0xe37ed['originatecalleridnum']||'';this[_0x66a4('0x2b')]=_0xe37ed['originatecalleridname']||'';}module[_0x66a4('0x2c')]=AgentComplete; \ No newline at end of file +var _0x45a7=['starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number'];(function(_0x3c757e,_0x19b4be){var _0x373024=function(_0x479601){while(--_0x479601){_0x3c757e['push'](_0x3c757e['shift']());}};_0x373024(++_0x19b4be);}(_0x45a7,0x1d6));var _0x745a=function(_0x245545,_0x4983b3){_0x245545=_0x245545-0x0;var _0x106a5f=_0x45a7[_0x245545];return _0x106a5f;};'use strict';var util=require(_0x745a('0x0'));var _=require(_0x745a('0x1'));var moment=require(_0x745a('0x2'));function getSeconds(_0x52baaa,_0x3af3c8){var _0x635f25=moment(_0x52baaa)[_0x745a('0x3')](0x0);var _0x50c64c=moment(_0x3af3c8)[_0x745a('0x3')](0x0);return _0x635f25[_0x745a('0x4')](_0x50c64c,_0x745a('0x5'));}function AgentComplete(_0x3fcc2e,_0x5eb40c){this[_0x745a('0x6')]=0x4;this['statedesc']=_0x745a('0x7');this[_0x745a('0x8')]=_0x3fcc2e[_0x745a('0x8')];this[_0x745a('0x9')]=_0x3fcc2e[_0x745a('0x9')];this[_0x745a('0xa')]=_0x3fcc2e[_0x745a('0x9')]==='outbound'?_0x745a('0xb'):_0x3fcc2e['type'];this[_0x745a('0xc')]=_0x3fcc2e[_0x745a('0xc')];this[_0x745a('0xd')]=_0x3fcc2e[_0x745a('0xd')];this['countnoanswerretry']=_0x3fcc2e[_0x745a('0xe')];this[_0x745a('0xf')]=_0x3fcc2e['countbusyretry']+_0x3fcc2e['countcongestionretry']+_0x3fcc2e[_0x745a('0xe')]+_0x3fcc2e[_0x745a('0x10')]+_0x3fcc2e[_0x745a('0x11')]+_0x3fcc2e[_0x745a('0x12')]+_0x3fcc2e[_0x745a('0x13')]+_0x3fcc2e[_0x745a('0x14')];this['countnosuchnumberretry']=_0x3fcc2e[_0x745a('0x10')];this[_0x745a('0x11')]=_0x3fcc2e[_0x745a('0x11')];this['countabandonedretry']=_0x3fcc2e['countabandonedretry'];this[_0x745a('0x13')]=_0x3fcc2e[_0x745a('0x13')];this[_0x745a('0x14')]=_0x3fcc2e[_0x745a('0x14')];this[_0x745a('0x15')]=_0x5eb40c[_0x745a('0x15')];this[_0x745a('0x16')]=_0x3fcc2e[_0x745a('0x17')];this['calleridnum']=_0x3fcc2e[_0x745a('0x18')];this[_0x745a('0x19')]=_0x3fcc2e[_0x745a('0x19')];this[_0x745a('0x1a')]=_0x3fcc2e[_0x745a('0x1a')];this[_0x745a('0x1b')]=_0x3fcc2e[_0x745a('0x1b')];this[_0x745a('0x1c')]=moment()[_0x745a('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x745a('0x1e')]=getSeconds(_0x3fcc2e[_0x745a('0x1a')],_0x3fcc2e['starttime']);this[_0x745a('0x1f')]=getSeconds(_0x3fcc2e['answertime'],_0x3fcc2e[_0x745a('0x1a')]);this[_0x745a('0x20')]=getSeconds(this[_0x745a('0x1c')],_0x3fcc2e['answertime']);this[_0x745a('0xb')]=_0x5eb40c[_0x745a('0xb')];this[_0x745a('0x21')]=_0x5eb40c[_0x745a('0x21')];this['reason']=_0x5eb40c['reason'];this[_0x745a('0x22')]=_0x3fcc2e[_0x745a('0x22')];this['callbackuniqueid']=_0x3fcc2e[_0x745a('0x23')];this[_0x745a('0x24')]=_0x3fcc2e[_0x745a('0x24')];this[_0x745a('0x25')]=_0x3fcc2e[_0x745a('0x25')];this[_0x745a('0x26')]=_0x3fcc2e[_0x745a('0x26')];this[_0x745a('0x27')]=_0x3fcc2e[_0x745a('0x27')];this[_0x745a('0x28')]=_0x3fcc2e[_0x745a('0x28')];this['VoiceQueueId']=_0x3fcc2e['VoiceQueueId'];this['CampaignId']=_0x3fcc2e[_0x745a('0x29')];this[_0x745a('0x2a')]=_0x3fcc2e[_0x745a('0x2a')]||'';this[_0x745a('0x2b')]=_0x3fcc2e['originatecalleridname']||'';}module[_0x745a('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 5f4cf37..3573043 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c63=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x27475e,_0x432c7f){var _0x21c8a5=function(_0x101e15){while(--_0x101e15){_0x27475e['push'](_0x27475e['shift']());}};_0x21c8a5(++_0x432c7f);}(_0x4c63,0x1c4));var _0x34c6=function(_0x5b14fa,_0x4fede8){_0x5b14fa=_0x5b14fa-0x0;var _0x32a41c=_0x4c63[_0x5b14fa];return _0x32a41c;};'use strict';var util=require(_0x34c6('0x0'));var _=require('lodash');var moment=require(_0x34c6('0x1'));function getSeconds(_0x29f68e,_0x517626){var _0x73d0b7=moment(_0x29f68e)[_0x34c6('0x2')](0x0);var _0x2b406f=moment(_0x517626)[_0x34c6('0x2')](0x0);return _0x73d0b7[_0x34c6('0x3')](_0x2b406f,_0x34c6('0x4'));}function Final(_0x24c096){this[_0x34c6('0x5')]=_0x24c096[_0x34c6('0x5')];this['scheduledat']=_0x24c096[_0x34c6('0x6')];this[_0x34c6('0x7')]=_0x24c096['type'];this[_0x34c6('0x8')]=_0x24c096['type']===_0x34c6('0x9')?'queue':_0x24c096[_0x34c6('0x7')];this[_0x34c6('0xa')]=_0x24c096[_0x34c6('0xa')];this['countcongestionretry']=_0x24c096['countcongestionretry'];this['countnoanswerretry']=_0x24c096[_0x34c6('0xb')];this[_0x34c6('0xc')]=_0x24c096['countbusyretry']+_0x24c096[_0x34c6('0xd')]+_0x24c096[_0x34c6('0xb')]+_0x24c096['countnosuchnumberretry']+_0x24c096[_0x34c6('0xe')]+_0x24c096[_0x34c6('0xf')]+_0x24c096[_0x34c6('0x10')]+_0x24c096[_0x34c6('0x11')];this['countnosuchnumberretry']=_0x24c096[_0x34c6('0x12')];this['countdropretry']=_0x24c096[_0x34c6('0xe')];this['countabandonedretry']=_0x24c096[_0x34c6('0xf')];this[_0x34c6('0x10')]=_0x24c096[_0x34c6('0x10')];this['countagentrejectretry']=_0x24c096['countagentrejectretry'];this[_0x34c6('0x13')]=_0x24c096[_0x34c6('0x13')];this[_0x34c6('0x14')]=_0x24c096[_0x34c6('0x14')];this[_0x34c6('0x15')]=_0x24c096[_0x34c6('0x15')];this[_0x34c6('0x16')]=_0x24c096[_0x34c6('0x16')];this['responsetime']=_0x24c096[_0x34c6('0x17')];this[_0x34c6('0x18')]=_0x24c096[_0x34c6('0x17')];this[_0x34c6('0x19')]=_0x24c096[_0x34c6('0x19')]||0x0;this[_0x34c6('0x1a')]=_0x24c096[_0x34c6('0x1a')]||0x0;this[_0x34c6('0x1b')]=_0x24c096[_0x34c6('0x1b')]||0x0;this[_0x34c6('0x1c')]=_0x24c096[_0x34c6('0x1c')];this['callbackuniqueid']=_0x24c096[_0x34c6('0x1d')];this[_0x34c6('0x1e')]=_0x24c096[_0x34c6('0x1e')];this[_0x34c6('0x1f')]=_0x24c096[_0x34c6('0x1f')];this[_0x34c6('0x20')]=_0x24c096[_0x34c6('0x20')];this['ListId']=_0x24c096[_0x34c6('0x21')];this[_0x34c6('0x22')]=_0x24c096[_0x34c6('0x22')];this[_0x34c6('0x23')]=_0x24c096[_0x34c6('0x23')];this[_0x34c6('0x24')]=_0x24c096[_0x34c6('0x24')];this[_0x34c6('0x25')]=_0x24c096[_0x34c6('0x25')]||'';this[_0x34c6('0x26')]=_0x24c096[_0x34c6('0x26')]||'';}module[_0x34c6('0x27')]=Final; \ No newline at end of file +var _0xbcf6=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x8e7cf1,_0x18b1ff){var _0x39e55e=function(_0x5460bc){while(--_0x5460bc){_0x8e7cf1['push'](_0x8e7cf1['shift']());}};_0x39e55e(++_0x18b1ff);}(_0xbcf6,0x15b));var _0x6bcf=function(_0x3d8995,_0x5f4f4b){_0x3d8995=_0x3d8995-0x0;var _0x5dd8ed=_0xbcf6[_0x3d8995];return _0x5dd8ed;};'use strict';var util=require(_0x6bcf('0x0'));var _=require('lodash');var moment=require(_0x6bcf('0x1'));function getSeconds(_0x215ff8,_0x5a8086){var _0x2072f0=moment(_0x215ff8)[_0x6bcf('0x2')](0x0);var _0x45ea51=moment(_0x5a8086)['milliseconds'](0x0);return _0x2072f0[_0x6bcf('0x3')](_0x45ea51,_0x6bcf('0x4'));}function Final(_0x4c8e3f){this[_0x6bcf('0x5')]=_0x4c8e3f[_0x6bcf('0x5')];this[_0x6bcf('0x6')]=_0x4c8e3f['scheduledat'];this['type']=_0x4c8e3f[_0x6bcf('0x7')];this[_0x6bcf('0x8')]=_0x4c8e3f[_0x6bcf('0x7')]===_0x6bcf('0x9')?_0x6bcf('0xa'):_0x4c8e3f[_0x6bcf('0x7')];this[_0x6bcf('0xb')]=_0x4c8e3f[_0x6bcf('0xb')];this['countcongestionretry']=_0x4c8e3f[_0x6bcf('0xc')];this[_0x6bcf('0xd')]=_0x4c8e3f['countnoanswerretry'];this['countglobal']=_0x4c8e3f[_0x6bcf('0xb')]+_0x4c8e3f['countcongestionretry']+_0x4c8e3f['countnoanswerretry']+_0x4c8e3f[_0x6bcf('0xe')]+_0x4c8e3f[_0x6bcf('0xf')]+_0x4c8e3f['countabandonedretry']+_0x4c8e3f['countmachineretry']+_0x4c8e3f[_0x6bcf('0x10')];this[_0x6bcf('0xe')]=_0x4c8e3f[_0x6bcf('0xe')];this[_0x6bcf('0xf')]=_0x4c8e3f[_0x6bcf('0xf')];this['countabandonedretry']=_0x4c8e3f[_0x6bcf('0x11')];this[_0x6bcf('0x12')]=_0x4c8e3f['countmachineretry'];this[_0x6bcf('0x10')]=_0x4c8e3f[_0x6bcf('0x10')];this[_0x6bcf('0xa')]=_0x4c8e3f[_0x6bcf('0xa')];this[_0x6bcf('0x13')]=_0x4c8e3f[_0x6bcf('0x13')];this[_0x6bcf('0x14')]=_0x4c8e3f[_0x6bcf('0x14')];this[_0x6bcf('0x15')]=_0x4c8e3f['starttime'];this[_0x6bcf('0x16')]=_0x4c8e3f[_0x6bcf('0x16')];this[_0x6bcf('0x17')]=_0x4c8e3f['responsetime'];this[_0x6bcf('0x18')]=_0x4c8e3f['ringtime']||0x0;this[_0x6bcf('0x19')]=_0x4c8e3f[_0x6bcf('0x19')]||0x0;this[_0x6bcf('0x1a')]=_0x4c8e3f[_0x6bcf('0x1a')]||0x0;this[_0x6bcf('0x1b')]=_0x4c8e3f[_0x6bcf('0x1b')];this['callbackuniqueid']=_0x4c8e3f[_0x6bcf('0x1c')];this[_0x6bcf('0x1d')]=_0x4c8e3f['callbackat'];this[_0x6bcf('0x1e')]=_0x4c8e3f[_0x6bcf('0x1e')];this[_0x6bcf('0x1f')]=_0x4c8e3f['ContactId'];this[_0x6bcf('0x20')]=_0x4c8e3f[_0x6bcf('0x20')];this[_0x6bcf('0x21')]=_0x4c8e3f[_0x6bcf('0x21')];this[_0x6bcf('0x22')]=_0x4c8e3f[_0x6bcf('0x22')];this[_0x6bcf('0x23')]=_0x4c8e3f[_0x6bcf('0x23')];this['originatecalleridnum']=_0x4c8e3f[_0x6bcf('0x24')]||'';this[_0x6bcf('0x25')]=_0x4c8e3f['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 8f14e53..bf5d472 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6b1=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x2f7b37,_0xa4c055){var _0x404377=function(_0x4ad9ac){while(--_0x4ad9ac){_0x2f7b37['push'](_0x2f7b37['shift']());}};_0x404377(++_0xa4c055);}(_0xb6b1,0xc7));var _0x1b6b=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0xb6b1[_0x5a7112];return _0x3147f7;};'use strict';var util=require(_0x1b6b('0x0'));var _=require(_0x1b6b('0x1'));var moment=require('moment');function getSeconds(_0x2ac9e1,_0xa37ad1){var _0x3ef03a=moment(_0x2ac9e1)['milliseconds'](0x0);var _0x193947=moment(_0xa37ad1)[_0x1b6b('0x2')](0x0);return _0x3ef03a[_0x1b6b('0x3')](_0x193947,_0x1b6b('0x4'));}function Hangup(_0xc94234,_0x5ac23e){this[_0x1b6b('0x5')]=0x4;this[_0x1b6b('0x6')]=_0x1b6b('0x7');this[_0x1b6b('0x8')]=_0xc94234['scheduledat'];this['type']=_0xc94234[_0x1b6b('0x9')];this['campaigntype']=_0xc94234[_0x1b6b('0x9')]===_0x1b6b('0xa')?_0x1b6b('0xb'):_0xc94234[_0x1b6b('0x9')];this[_0x1b6b('0xc')]=_0xc94234['countbusyretry'];this['countcongestionretry']=_0xc94234[_0x1b6b('0xd')];this[_0x1b6b('0xe')]=_0xc94234[_0x1b6b('0xe')];this['countglobal']=_0xc94234[_0x1b6b('0xc')]+_0xc94234[_0x1b6b('0xd')]+_0xc94234[_0x1b6b('0xe')]+_0xc94234[_0x1b6b('0xf')]+_0xc94234[_0x1b6b('0x10')]+_0xc94234[_0x1b6b('0x11')]+_0xc94234[_0x1b6b('0x12')]+_0xc94234['countagentrejectretry'];this[_0x1b6b('0xf')]=_0xc94234['countnosuchnumberretry'];this[_0x1b6b('0x10')]=_0xc94234['countdropretry'];this[_0x1b6b('0x11')]=_0xc94234[_0x1b6b('0x11')];this[_0x1b6b('0x12')]=_0xc94234['countmachineretry'];this[_0x1b6b('0x13')]=_0xc94234[_0x1b6b('0x13')];this[_0x1b6b('0x14')]=_0x5ac23e[_0x1b6b('0x14')];this[_0x1b6b('0x15')]=_0xc94234[_0x1b6b('0x16')];this[_0x1b6b('0x17')]=_0xc94234[_0x1b6b('0x18')];this[_0x1b6b('0x19')]=_0xc94234['starttime'];this[_0x1b6b('0x1a')]=_0xc94234[_0x1b6b('0x1a')];this[_0x1b6b('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1b6b('0x1c')]=getSeconds(_0xc94234[_0x1b6b('0x1a')],_0xc94234[_0x1b6b('0x19')]);this['holdtime']=0x0;this[_0x1b6b('0x1d')]=getSeconds(this[_0x1b6b('0x1b')],_0xc94234['responsetime']);this[_0x1b6b('0xb')]=_0xc94234[_0x1b6b('0xb')];this[_0x1b6b('0x1e')]=_0x1b6b('0x1f');this[_0x1b6b('0x20')]=_0x5ac23e[_0x1b6b('0x21')];this[_0x1b6b('0x22')]=_0xc94234[_0x1b6b('0x22')];this['callbackuniqueid']=_0xc94234[_0x1b6b('0x23')];this[_0x1b6b('0x24')]=_0xc94234[_0x1b6b('0x24')];this[_0x1b6b('0x25')]=_0xc94234[_0x1b6b('0x25')];this[_0x1b6b('0x26')]=_0xc94234[_0x1b6b('0x26')];this[_0x1b6b('0x27')]=_0xc94234[_0x1b6b('0x27')];this[_0x1b6b('0x28')]=_0xc94234[_0x1b6b('0x28')];this['VoiceQueueId']=_0xc94234[_0x1b6b('0x29')];this[_0x1b6b('0x2a')]=_0xc94234['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0xfb2a=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','type'];(function(_0x385ed5,_0x449f76){var _0x27f199=function(_0x47d08f){while(--_0x47d08f){_0x385ed5['push'](_0x385ed5['shift']());}};_0x27f199(++_0x449f76);}(_0xfb2a,0x138));var _0xafb2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb2a[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var _=require(_0xafb2('0x0'));var moment=require(_0xafb2('0x1'));function getSeconds(_0x3b890c,_0x116cb9){var _0x1b0da9=moment(_0x3b890c)[_0xafb2('0x2')](0x0);var _0x169fb8=moment(_0x116cb9)[_0xafb2('0x2')](0x0);return _0x1b0da9[_0xafb2('0x3')](_0x169fb8,_0xafb2('0x4'));}function Hangup(_0x4a09b3,_0x3f5a3e){this[_0xafb2('0x5')]=0x4;this[_0xafb2('0x6')]='Answer';this['scheduledat']=_0x4a09b3['scheduledat'];this['type']=_0x4a09b3[_0xafb2('0x7')];this['campaigntype']=_0x4a09b3[_0xafb2('0x7')]===_0xafb2('0x8')?_0xafb2('0x9'):_0x4a09b3[_0xafb2('0x7')];this[_0xafb2('0xa')]=_0x4a09b3[_0xafb2('0xa')];this[_0xafb2('0xb')]=_0x4a09b3[_0xafb2('0xb')];this[_0xafb2('0xc')]=_0x4a09b3[_0xafb2('0xc')];this[_0xafb2('0xd')]=_0x4a09b3[_0xafb2('0xa')]+_0x4a09b3[_0xafb2('0xb')]+_0x4a09b3[_0xafb2('0xc')]+_0x4a09b3['countnosuchnumberretry']+_0x4a09b3[_0xafb2('0xe')]+_0x4a09b3['countabandonedretry']+_0x4a09b3[_0xafb2('0xf')]+_0x4a09b3[_0xafb2('0x10')];this[_0xafb2('0x11')]=_0x4a09b3[_0xafb2('0x11')];this['countdropretry']=_0x4a09b3[_0xafb2('0xe')];this[_0xafb2('0x12')]=_0x4a09b3[_0xafb2('0x12')];this[_0xafb2('0xf')]=_0x4a09b3[_0xafb2('0xf')];this['countagentrejectretry']=_0x4a09b3['countagentrejectretry'];this[_0xafb2('0x13')]=_0x3f5a3e[_0xafb2('0x13')];this['calleridname']=_0x4a09b3[_0xafb2('0x14')];this[_0xafb2('0x15')]=_0x4a09b3['number'];this[_0xafb2('0x16')]=_0x4a09b3[_0xafb2('0x16')];this[_0xafb2('0x17')]=_0x4a09b3['responsetime'];this[_0xafb2('0x18')]=moment()[_0xafb2('0x19')](_0xafb2('0x1a'));this[_0xafb2('0x1b')]=getSeconds(_0x4a09b3['responsetime'],_0x4a09b3[_0xafb2('0x16')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0xafb2('0x18')],_0x4a09b3['responsetime']);this[_0xafb2('0x9')]=_0x4a09b3[_0xafb2('0x9')];this['membername']=_0xafb2('0x1c');this['reason']=_0x3f5a3e[_0xafb2('0x1d')];this[_0xafb2('0x1e')]=_0x4a09b3[_0xafb2('0x1e')];this[_0xafb2('0x1f')]=_0x4a09b3['callbackuniqueid'];this['callbackat']=_0x4a09b3[_0xafb2('0x20')];this[_0xafb2('0x21')]=_0x4a09b3['recallme'];this[_0xafb2('0x22')]=_0x4a09b3[_0xafb2('0x22')];this[_0xafb2('0x23')]=_0x4a09b3[_0xafb2('0x23')];this[_0xafb2('0x24')]=_0x4a09b3[_0xafb2('0x24')];this[_0xafb2('0x25')]=_0x4a09b3['VoiceQueueId'];this[_0xafb2('0x26')]=_0x4a09b3[_0xafb2('0x26')];}module[_0xafb2('0x27')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 1e357a1..16cae91 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d9e=['holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0d9e,0x18e));var _0xe0d9=function(_0x575939,_0x3e3d7a){_0x575939=_0x575939-0x0;var _0x5d9034=_0x0d9e[_0x575939];return _0x5d9034;};'use strict';var util=require(_0xe0d9('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x2f3424,_0x569c26){var _0x53fddd=moment(_0x2f3424)[_0xe0d9('0x1')](0x0);var _0x28c191=moment(_0x569c26)[_0xe0d9('0x1')](0x0);return _0x53fddd['diff'](_0x28c191,'seconds');}function History(_0x428a21){this['uniqueid']=_0x428a21[_0xe0d9('0x2')];this[_0xe0d9('0x3')]=_0x428a21[_0xe0d9('0x3')]||undefined;this['type']=_0x428a21[_0xe0d9('0x4')];this[_0xe0d9('0x5')]=_0x428a21[_0xe0d9('0x4')]===_0xe0d9('0x6')?_0xe0d9('0x7'):_0x428a21['type'];this['countbusyretry']=_0x428a21[_0xe0d9('0x8')];this[_0xe0d9('0x9')]=_0x428a21[_0xe0d9('0x9')];this['countnoanswerretry']=_0x428a21[_0xe0d9('0xa')];this['countglobal']=_0x428a21[_0xe0d9('0x8')]+_0x428a21[_0xe0d9('0x9')]+_0x428a21[_0xe0d9('0xa')]+_0x428a21[_0xe0d9('0xb')]+_0x428a21[_0xe0d9('0xc')]+_0x428a21[_0xe0d9('0xd')]+_0x428a21[_0xe0d9('0xe')]+_0x428a21[_0xe0d9('0xf')];this[_0xe0d9('0xb')]=_0x428a21[_0xe0d9('0xb')];this[_0xe0d9('0xc')]=_0x428a21[_0xe0d9('0xc')];this[_0xe0d9('0xd')]=_0x428a21[_0xe0d9('0xd')];this[_0xe0d9('0xe')]=_0x428a21[_0xe0d9('0xe')];this[_0xe0d9('0xf')]=_0x428a21[_0xe0d9('0xf')];this[_0xe0d9('0x7')]=_0x428a21['queue'];this[_0xe0d9('0x10')]=_0x428a21[_0xe0d9('0x11')];this[_0xe0d9('0x12')]=_0x428a21[_0xe0d9('0x13')];this[_0xe0d9('0x14')]=_0x428a21[_0xe0d9('0x14')];this['responsetime']=_0x428a21[_0xe0d9('0x15')];this['endtime']=_0x428a21[_0xe0d9('0x15')];this['ringtime']=getSeconds(_0x428a21[_0xe0d9('0x15')],_0x428a21[_0xe0d9('0x14')]);this[_0xe0d9('0x16')]=0x0;this[_0xe0d9('0x17')]=0x0;this[_0xe0d9('0x18')]=_0x428a21[_0xe0d9('0x18')];this['callbackuniqueid']=_0x428a21['callbackuniqueid'];this[_0xe0d9('0x19')]=_0x428a21[_0xe0d9('0x19')];this[_0xe0d9('0x1a')]=_0x428a21[_0xe0d9('0x1a')];this['ContactId']=_0x428a21[_0xe0d9('0x1b')];this['ListId']=_0x428a21[_0xe0d9('0x1c')];this['UserId']=_0x428a21[_0xe0d9('0x1d')];this[_0xe0d9('0x1e')]=_0x428a21[_0xe0d9('0x1e')];this[_0xe0d9('0x1f')]=_0x428a21[_0xe0d9('0x1f')];this[_0xe0d9('0x20')]=_0x428a21['originatecalleridnum']||'';this[_0xe0d9('0x21')]=_0x428a21[_0xe0d9('0x21')]||'';}module[_0xe0d9('0x22')]=History; \ No newline at end of file +var _0xaf76=['scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','milliseconds','uniqueid'];(function(_0x579f25,_0x4ac469){var _0x494d7b=function(_0x5de0ef){while(--_0x5de0ef){_0x579f25['push'](_0x579f25['shift']());}};_0x494d7b(++_0x4ac469);}(_0xaf76,0x1b6));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6af7('0x0'));var _=require(_0x6af7('0x1'));var moment=require('moment');function getSeconds(_0x1e23af,_0x3be9d6){var _0x21f997=moment(_0x1e23af)[_0x6af7('0x2')](0x0);var _0x57d1e3=moment(_0x3be9d6)['milliseconds'](0x0);return _0x21f997['diff'](_0x57d1e3,'seconds');}function History(_0x16688d){this['uniqueid']=_0x16688d[_0x6af7('0x3')];this['scheduledat']=_0x16688d[_0x6af7('0x4')]||undefined;this[_0x6af7('0x5')]=_0x16688d['type'];this['campaigntype']=_0x16688d['type']===_0x6af7('0x6')?'queue':_0x16688d[_0x6af7('0x5')];this[_0x6af7('0x7')]=_0x16688d[_0x6af7('0x7')];this[_0x6af7('0x8')]=_0x16688d[_0x6af7('0x8')];this[_0x6af7('0x9')]=_0x16688d[_0x6af7('0x9')];this[_0x6af7('0xa')]=_0x16688d['countbusyretry']+_0x16688d[_0x6af7('0x8')]+_0x16688d[_0x6af7('0x9')]+_0x16688d[_0x6af7('0xb')]+_0x16688d['countdropretry']+_0x16688d[_0x6af7('0xc')]+_0x16688d[_0x6af7('0xd')]+_0x16688d[_0x6af7('0xe')];this[_0x6af7('0xb')]=_0x16688d[_0x6af7('0xb')];this['countdropretry']=_0x16688d[_0x6af7('0xf')];this['countabandonedretry']=_0x16688d[_0x6af7('0xc')];this[_0x6af7('0xd')]=_0x16688d[_0x6af7('0xd')];this[_0x6af7('0xe')]=_0x16688d[_0x6af7('0xe')];this[_0x6af7('0x10')]=_0x16688d['queue'];this[_0x6af7('0x11')]=_0x16688d[_0x6af7('0x12')];this[_0x6af7('0x13')]=_0x16688d['number'];this[_0x6af7('0x14')]=_0x16688d['starttime'];this['responsetime']=_0x16688d[_0x6af7('0x15')];this['endtime']=_0x16688d['responsetime'];this[_0x6af7('0x16')]=getSeconds(_0x16688d['responsetime'],_0x16688d[_0x6af7('0x14')]);this[_0x6af7('0x17')]=0x0;this[_0x6af7('0x18')]=0x0;this[_0x6af7('0x19')]=_0x16688d[_0x6af7('0x19')];this[_0x6af7('0x1a')]=_0x16688d['callbackuniqueid'];this[_0x6af7('0x1b')]=_0x16688d[_0x6af7('0x1b')];this['recallme']=_0x16688d[_0x6af7('0x1c')];this[_0x6af7('0x1d')]=_0x16688d[_0x6af7('0x1d')];this['ListId']=_0x16688d['ListId'];this[_0x6af7('0x1e')]=_0x16688d[_0x6af7('0x1e')];this[_0x6af7('0x1f')]=_0x16688d[_0x6af7('0x1f')];this[_0x6af7('0x20')]=_0x16688d['CampaignId'];this['originatecalleridnum']=_0x16688d['originatecalleridnum']||'';this[_0x6af7('0x21')]=_0x16688d[_0x6af7('0x21')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 66f56e8..d3fd59b 100644 --- a/server/services/ami/dialer/index.js +++ b/server/services/ami/dialer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53a5=['GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','NONE','dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[countReScheduled]\x20','ACTIVE','checkIsBlackList','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','isEmpty','Intervals','\x20INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','state','statedesc','endtime','prototype','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','resolve','then','countReScheduled','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','CampaignId','[emptyContact]','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','buildObj','[syncHangupInAMDIvr]','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','VoiceQueueId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','syncAgentComplete','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','command','iftime\x20%s,%s','interval','true','content','all'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x53a5,0xc6));var _0x553a=function(_0x1a4812,_0x2be11e){_0x1a4812=_0x1a4812-0x0;var _0x3fc3e3=_0x53a5[_0x1a4812];return _0x3fc3e3;};'use strict';var util=require(_0x553a('0x0'));var _=require(_0x553a('0x1'));var BPromise=require(_0x553a('0x2'));var uuid=require(_0x553a('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x553a('0x4'));var Redis=require(_0x553a('0x5'));var ut=require(_0x553a('0x6'));var config=require(_0x553a('0x7'));var logger=require(_0x553a('0x8'))('dialer');var loggerBooked=require('../../../config/logger')(_0x553a('0x9'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x553a('0xa'));var loggerSyncQueueSummary=require(_0x553a('0x8'))(_0x553a('0xb'));var ami=require('../ami');config[_0x553a('0xc')]=_[_0x553a('0xd')](config[_0x553a('0xc')],{'host':_0x553a('0xe'),'port':0x18eb});var io=require(_0x553a('0xf'))(new Redis(config[_0x553a('0xc')]));var cmHopper=require(_0x553a('0x10'));var cmHopperHistory=require(_0x553a('0x11'));var cmHopperBlack=require(_0x553a('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x553a('0x13'));var History=require(_0x553a('0x14'));var Final=require('./final');var AgentComplete=require(_0x553a('0x15'));var QueueCallerAbandon=require(_0x553a('0x16'));var Hangup=require(_0x553a('0x17'));var ipAgi=process['env'][_0x553a('0x18')]||_0x553a('0x19');var strategy={'rrmemory':_0x553a('0x1a'),'roundrobin':_0x553a('0x1b')};var Sequence=function(){};Sequence['prototype'][_0x553a('0x1c')]=function(_0x4607e0){this[_0x553a('0x1d')]=this['tail']?this[_0x553a('0x1d')][_0x553a('0x1e')](_0x4607e0):_0x4607e0();};function Dialer(_0x5bfbdc,_0x2043d2){this[_0x553a('0x1f')]=new Sequence();this[_0x553a('0x20')]=_0x2043d2;this['voiceQueues']=_0x5bfbdc[_0x553a('0x21')];this[_0x553a('0x22')]=_0x5bfbdc[_0x553a('0x22')];this['agents']=_0x5bfbdc[_0x553a('0x23')];this[_0x553a('0x24')]=_0x5bfbdc['trunks'];this['maxNumberOriginate']=config[_0x553a('0x25')]||0x2;this['channels']={};this[_0x553a('0x26')]={};this[_0x553a('0x27')]={};this[_0x553a('0x28')]={};this['optionPredictive']={};this[_0x553a('0x29')]={};this[_0x553a('0x2a')]={};this[_0x553a('0x2b')]={};this[_0x553a('0x2c')]={};this[_0x553a('0x2d')]={};ami['on'](_0x553a('0x2e'),this[_0x553a('0x2f')][_0x553a('0x30')](this));ami['on'](_0x553a('0x31'),this[_0x553a('0x32')]['bind'](this));ami['on']('originateresponse',this[_0x553a('0x33')][_0x553a('0x30')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x553a('0x30')](this));ami['on']('custom:queuesummary',this[_0x553a('0xb')][_0x553a('0x30')](this));ami['on']('hangup',this[_0x553a('0x34')][_0x553a('0x30')](this));ami['on'](_0x553a('0x35'),this[_0x553a('0x36')][_0x553a('0x30')](this));ami['on']('varset',this[_0x553a('0x37')][_0x553a('0x30')](this));ami['on'](_0x553a('0x38'),this[_0x553a('0x39')][_0x553a('0x30')](this));ami['on'](_0x553a('0x3a'),this['syncQueueStatusComplete'][_0x553a('0x30')](this));this[_0x553a('0x3b')]();this[_0x553a('0x3c')]();}function isNotNull(_0x442f85){return _0x442f85!==null&&!_[_0x553a('0x3d')](_0x442f85);}function checkIsLoggedIn(_0x387b27,_0x575878){return function(){if(_0x575878<=0x0){_0x387b27[_0x553a('0x3e')]='AGENTS_NOT_LOGGED';throw _0x387b27[_0x553a('0x3f')]+_0x553a('0x40');}};}function isActive(_0x6975cd){return _0x6975cd;}function checkIsActive(_0x5d2ae,_0x3bc5d5){return function(){if(!isActive(_0x3bc5d5)){_0x5d2ae[_0x553a('0x3e')]='NOT_ACTIVE';throw _0x5d2ae[_0x553a('0x3f')]+_0x553a('0x41');}};}function checkInterval(_0x495a3b){return function(){if(!isNotNull(_0x495a3b[_0x553a('0x42')])){_0x495a3b[_0x553a('0x3e')]=_0x553a('0x43');throw _0x495a3b[_0x553a('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x495a3b[_0x553a('0x42')]['Intervals'])){_0x495a3b[_0x553a('0x3e')]=_0x553a('0x43');throw _0x495a3b[_0x553a('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x553a('0x44')](_0x495a3b[_0x553a('0x42')][_0x553a('0x45')]))){_0x495a3b['message']=_0x553a('0x43');throw _0x495a3b['name']+_0x553a('0x46');}};}function msgResponse(_0x2fe757,_0x9e4cf3,_0x429f76){return{'action':_0x2fe757,'response':_0x9e4cf3,'message':_0x429f76,'stack':_0x429f76};}function myreject(_0x5213ed){return function(_0x3304a2){return _0x5213ed(msgResponse('[ifTime][Action]',_0x553a('0x47'),JSON[_0x553a('0x48')](_0x3304a2)));};}function getSeconds(_0x2e2efb,_0x222f55){var _0x445fcc=moment(_0x2e2efb)['milliseconds'](0x0);var _0x2fb5ec=moment(_0x222f55)[_0x553a('0x49')](0x0);return _0x445fcc[_0x553a('0x4a')](_0x2fb5ec,'seconds');}function emit(_0x593bd3,_0x50b3ab,_0x354106){io['to'](_0x593bd3)[_0x553a('0x4b')](_0x50b3ab,_0x354106);}function emitVoiceQueueSummary(_0x52c168){if(_0x52c168['type']===_0x553a('0x4c')){var _0x3e1bfe={'id':_0x52c168['id'],'name':_0x52c168[_0x553a('0x3f')],'strategy':_0x52c168[_0x553a('0x4d')],'answered':_0x52c168[_0x553a('0x4e')],'available':_0x52c168[_0x553a('0x4f')],'loggedIn':_0x52c168[_0x553a('0x50')],'pTalking':_0x52c168[_0x553a('0x51')],'sumBillable':_0x52c168[_0x553a('0x52')],'sumDuration':_0x52c168['sumDuration'],'sumHoldTime':_0x52c168[_0x553a('0x53')]||0x0,'talking':_0x52c168[_0x553a('0x54')],'total':_0x52c168[_0x553a('0x55')],'type':_0x52c168[_0x553a('0x56')],'unmanaged':_0x52c168[_0x553a('0x57')],'abandoned':_0x52c168[_0x553a('0x58')],'waiting':_0x52c168[_0x553a('0x59')],'loggedInDb':_0x52c168[_0x553a('0x5a')],'dialActive':_0x52c168[_0x553a('0x5b')],'dialMethod':_0x52c168[_0x553a('0x5c')],'dialOriginateCallerIdName':_0x52c168[_0x553a('0x5d')],'dialOriginateCallerIdNumber':_0x52c168['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x52c168[_0x553a('0x5e')],'dialPrefix':_0x52c168[_0x553a('0x5f')],'outboundAnswerAgiCallsDay':_0x52c168[_0x553a('0x60')],'outboundAnswerCallsDay':_0x52c168[_0x553a('0x61')],'outboundBlacklistCallsDay':_0x52c168[_0x553a('0x62')],'outboundBusyCallsDay':_0x52c168[_0x553a('0x63')],'outboundCongestionCallsDay':_0x52c168[_0x553a('0x64')],'outboundDropCallsDayACS':_0x52c168[_0x553a('0x65')],'outboundDropCallsDayCallersExit':_0x52c168[_0x553a('0x66')],'outboundDropCallsDayTimeout':_0x52c168['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x52c168[_0x553a('0x67')],'outboundNoSuchCallsDay':_0x52c168[_0x553a('0x68')],'outboundOriginateFailureCallsDay':_0x52c168[_0x553a('0x69')],'outboundReCallsDay':_0x52c168['outboundReCallsDay'],'outboundRejectCallsDay':_0x52c168[_0x553a('0x6a')],'outboundUnknownCallsDay':_0x52c168[_0x553a('0x6b')],'predictiveIntervalAnsweredCalls':_0x52c168[_0x553a('0x6c')],'predictiveIntervalAvgHoldtime':_0x52c168[_0x553a('0x6d')],'predictiveIntervalAvgTalktime':_0x52c168[_0x553a('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x52c168['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x52c168[_0x553a('0x6f')],'predictiveIntervalErlangCalls':_0x52c168[_0x553a('0x70')],'predictiveIntervalErlangCallsDroppedCalls':_0x52c168[_0x553a('0x71')],'predictiveIntervalHitRate':_0x52c168['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x52c168['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x52c168['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x52c168['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x52c168['predictiveIntervalTotalCalls'],'message':_0x52c168['message'],'originated':_0x52c168['originated'],'erlangCalls':_0x52c168['erlangCalls'],'erlangCallToSecond':_0x52c168[_0x553a('0x72')],'erlangAbandonmentRate':_0x52c168['erlangAbandonmentRate'],'erlangBusyFactor':_0x52c168[_0x553a('0x73')],'startPredictive':_0x52c168[_0x553a('0x29')],'startProgressive':_0x52c168[_0x553a('0x2a')]};if(_0x52c168[_0x553a('0x74')]){_0x3e1bfe[_0x553a('0x74')]={'id':_0x52c168[_0x553a('0x74')]['id'],'name':_0x52c168['Trunk'][_0x553a('0x3f')],'active':_0x52c168[_0x553a('0x74')][_0x553a('0x75')],'callerid':_0x52c168[_0x553a('0x74')][_0x553a('0x76')]};}if(_0x52c168['Interval']){_0x3e1bfe[_0x553a('0x42')]={'id':_0x52c168[_0x553a('0x42')]['id'],'name':_0x52c168[_0x553a('0x42')][_0x553a('0x3f')]};}var _0x5257cd=md5(JSON[_0x553a('0x48')](_0x3e1bfe));if(_0x52c168[_0x553a('0x4')]!==_0x5257cd){_0x52c168[_0x553a('0x4')]=_0x5257cd;emit(util[_0x553a('0x77')](_0x553a('0x78'),_0x3e1bfe[_0x553a('0x3f')]),'voice_queue:save',_0x3e1bfe);}}}function emitCampaignSummary(_0x598304){if(_0x598304[_0x553a('0x56')]===_0x553a('0x79')){emit(util[_0x553a('0x77')](_0x553a('0x7a'),_0x598304['name']),'campaign:save',_0x598304);}}function checkGetDataPredictive(_0x1605a7){if(isNotNull(_0x1605a7)&&!_['isEmpty'](_0x1605a7)){loggerPredictive[_0x553a('0x7b')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x553a('0x7b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1605a7['predictiveIntervalTotalCalls']);loggerPredictive[_0x553a('0x7b')](_0x553a('0x7c'),_0x1605a7['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x553a('0x7d'),_0x1605a7[_0x553a('0x6f')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x7e'),_0x1605a7[_0x553a('0x7f')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1605a7[_0x553a('0x6d')]);loggerPredictive['info'](_0x553a('0x80'),_0x1605a7[_0x553a('0x6e')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x81'));if(_0x1605a7[_0x553a('0x82')]>0x0){if(!_[_0x553a('0x3d')](_0x1605a7[_0x553a('0x6e')])&&_0x1605a7[_0x553a('0x6e')]>0x0){return!![];}loggerPredictive[_0x553a('0x7b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x553a('0x3d')](_0x1605a7[_0x553a('0x6d')])&&_0x1605a7['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x553a('0x7b')](_0x553a('0x83'));}else{loggerPredictive[_0x553a('0x7b')](_0x553a('0x84'));}}else{loggerPredictive[_0x553a('0x7b')](_0x553a('0x85'));}return![];}function mergeDataErlangB(_0x2d9262){return function(_0xe04378){loggerPredictive['info'](_0x553a('0x86'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe04378[_0x553a('0x87')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x88'),_0xe04378[_0x553a('0x72')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x89'),_0xe04378[_0x553a('0x8a')]);loggerPredictive[_0x553a('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe04378[_0x553a('0x73')]);loggerPredictive[_0x553a('0x7b')](_0x553a('0x89'),_0xe04378['erlangAbandonmentRate']);loggerPredictive[_0x553a('0x7b')](_0x553a('0x81'));_['merge'](_0x2d9262,_0xe04378);};}function getDiff(_0x34e449){var _0x21646f=moment()[_0x553a('0x49')](0x0);var _0x287f6f=moment(_0x34e449)[_0x553a('0x49')](0x0);return _0x21646f[_0x553a('0x4a')](_0x287f6f,_0x553a('0x8b'));}function ifInterval(_0x13e12f,_0x4818a1){if(_[_0x553a('0x3d')](_0x4818a1)){return![];}return getDiff(_0x4818a1)<_0x13e12f*0x3c;}function freeVariablesPredictive(_0xa14231){if(isNotNull(_0xa14231)){if(!_[_0x553a('0x3d')](_0xa14231[_0x553a('0x2a')])){_0xa14231[_0x553a('0x2a')]=undefined;loggerPredictive[_0x553a('0x7b')](_0xa14231[_0x553a('0x3f')],_0x553a('0x8c'));}if(!_['isUndefined'](_0xa14231[_0x553a('0x29')])){_0xa14231[_0x553a('0x29')]=undefined;loggerPredictive[_0x553a('0x7b')](_0xa14231[_0x553a('0x3f')],_0x553a('0x8d'));}if(!_[_0x553a('0x3d')](_0xa14231[_0x553a('0x8e')])){clearInterval(_0xa14231[_0x553a('0x8e')]);_0xa14231[_0x553a('0x8e')]=undefined;loggerPredictive[_0x553a('0x7b')](_0xa14231[_0x553a('0x3f')],_0x553a('0x8f'));}}}function erlangb(_0x5c0a14,_0x244e15){if(_0x244e15===0x0){return 0x0;}var _0x280fa0=0x1;for(var _0x5e4ad3=0x1;_0x5e4ad3<=_0x244e15;_0x5e4ad3+=0x1){_0x280fa0=0x1+_0x280fa0*_0x5e4ad3/_0x5c0a14;}return 0x1/_0x280fa0;}function isVoiceQueueOutbound(_0x3c6a3d){return _0x3c6a3d===_0x553a('0x4c');}function isNotPreview(_0x5ef3d0){return _0x5ef3d0!==_0x553a('0x20');}function isCampaignIvr(_0x5a120e){return _0x5a120e==='ivr';}function getCallerId(_0x29a114,_0x542b2e,_0x4a59cc){if(!_['isUndefined'](_0x4a59cc)&&typeof _0x4a59cc===_0x553a('0x90')&&!_[_0x553a('0x44')](_0x4a59cc)){if(!_[_0x553a('0x3d')](_0x542b2e)&&typeof _0x542b2e===_0x553a('0x90')&&!_[_0x553a('0x44')](_0x542b2e)){return util['format'](_0x553a('0x91'),_0x542b2e,_0x4a59cc);}return util[_0x553a('0x77')](_0x553a('0x91'),_0x4a59cc,_0x4a59cc);}if(!_[_0x553a('0x3d')](_0x29a114)&&typeof _0x29a114===_0x553a('0x90')&&!_[_0x553a('0x44')](_0x29a114)){return _0x29a114;}return _0x553a('0x92');}function loggerCatchQueueSummary(_0x21721c,_0x2e6298){return function(_0xb9de2d){freeVariablesPredictive(_0x2e6298);emitVoiceQueueSummary(_0x2e6298);emitCampaignSummary(_0x2e6298);loggerSyncQueueSummary[_0x553a('0x93')](_0x21721c,util[_0x553a('0x94')](_0xb9de2d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x31d101,_0x455d44){return function(_0x40695a){loggerPredictive['error'](_0x455d44[_0x553a('0x3f')],_0x31d101);loggerPredictive[_0x553a('0x93')](_0x40695a[_0x553a('0x95')]);freeVariablesPredictive(_0x455d44);};}function loggerCatch(_0x1062a5){return function(_0x1ef15e){logger[_0x553a('0x93')](_0x1062a5,util[_0x553a('0x94')](_0x1ef15e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1a42f5){return _0x1a42f5&&!_[_0x553a('0x3d')](_0x1a42f5)&&_0x1a42f5[_0x553a('0x96')]>0x0;}function decremetOriginate(_0xe185e8){if(!_[_0x553a('0x3d')](_0xe185e8)&&_0xe185e8!==null){if(typeof _0xe185e8['originated']!==_0x553a('0x97')){if(_0xe185e8[_0x553a('0x98')]>0x0){_0xe185e8['originated']-=0x1;}else{logger['error'](_0x553a('0x99'));}}}else{logger[_0x553a('0x93')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0xd16b11,_0x483ae5,_0x2b4fa0){if(_0x483ae5>_0x2b4fa0){for(var _0x1e6da9=0x0;_0x1e6da9<_0x483ae5-_0x2b4fa0;_0x1e6da9+=0x1){decremetOriginate(_0xd16b11);}}}function loggerGetContactDialer(_0xb4e9ac,_0x21cb5d,_0x5912f3){return function(_0x2e22d8){checkContactLowerLimitOriginate(_0x21cb5d,_0x5912f3,0x0);logger['error'](_0xb4e9ac,util[_0x553a('0x94')](_0x2e22d8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x496fe9){return function(_0x385d45){if(isNotNull(_0x385d45)&&isNotNull(_0x385d45[0x0])){if(_0x385d45[0x0][_0x553a('0x9a')]>0x0){_0x496fe9['message']=_0x553a('0x9b');logger[_0x553a('0x7b')](_0x553a('0x9c')+_0x496fe9[_0x553a('0x3f')],_0x385d45[0x0][_0x553a('0x9a')],'contacts');}else{_0x496fe9[_0x553a('0x3e')]=_0x553a('0x9d');logger[_0x553a('0x7b')](_0x553a('0x9e')+_0x496fe9[_0x553a('0x3f')]);}}};}function notSendMessagesQueue(_0x4a8c87){if(_0x4a8c87[_0x553a('0x9f')]){freeVariablesPredictive(_0x4a8c87);if(_0x4a8c87[_0x553a('0x98')]===0x0&&_0x4a8c87['talking']===0x0&&_0x4a8c87['waiting']===0x0&&(_0x4a8c87[_0x553a('0x51')]||0x0)===0x0){_0x4a8c87[_0x553a('0x9f')]=![];_0x4a8c87[_0x553a('0x4f')]=0x0;_0x4a8c87['message']=_0x553a('0xa0');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4a8c87[_0x553a('0x3f')],'is\x20not\x20active');}else{_0x4a8c87[_0x553a('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x553a('0x93')](_0x553a('0xa1'),_0x4a8c87[_0x553a('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x4a8c87);}}function notSendMessagesCampaign(_0xbc0627){if(_0xbc0627[_0x553a('0x9f')]){if(_0xbc0627[_0x553a('0x98')]===0x0){_0xbc0627[_0x553a('0x9f')]=![];_0xbc0627[_0x553a('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x553a('0x93')](_0x553a('0xa2'),_0xbc0627[_0x553a('0x3f')],_0x553a('0xa3'));}else{_0xbc0627['message']=_0x553a('0xa4');loggerSyncQueueSummary[_0x553a('0x93')](_0x553a('0xa2'),_0xbc0627[_0x553a('0x3f')],'is\x20disactive');}emitCampaignSummary(_0xbc0627);}}function createObjHistory(_0x498796,_0x174731,_0x331a75,_0x421c23,_0x3f211e){_0x498796[_0x553a('0x3e')]=_0x331a75;var _0x4a8275=new Action(_0x498796,_0x174731);var _0x4f0fc6=new History(_0x4a8275);_0x4f0fc6[_0x553a('0xa5')]=_0x421c23;_0x4f0fc6[_0x553a('0xa6')]=_0x3f211e;_0x4f0fc6[_0x553a('0xa7')]=_0x4a8275['starttime'];return _0x4f0fc6;}Dialer[_0x553a('0xa8')][_0x553a('0x3c')]=function(){var _0x17471d=this;setInterval(function(){_0x17471d[_0x553a('0xa9')](_0x17471d['uniqueId'],_0x553a('0xaa'));_0x17471d['clearZombieChannels'](_0x17471d[_0x553a('0x26')],'[actions]');},0x32c8);};Dialer[_0x553a('0xa8')]['clearZombieChannels']=function(_0x51d10c,_0x162165){var _0x330021=this;for(var _0x3630e0 in _0x51d10c){if(typeof _0x51d10c[_0x3630e0]!==_0x553a('0x97')){this[_0x553a('0x1f')][_0x553a('0x1c')](function(){if(!_[_0x553a('0xab')](_0x51d10c[_0x3630e0])){return ami[_0x553a('0xac')]({'action':_0x553a('0xad'),'channel':_0x51d10c[_0x3630e0][_0x553a('0xae')]})[_0x553a('0xaf')](function(_0x21d642){if(_0x21d642[_0x553a('0x3e')]===_0x553a('0xb0')){setTimeout(function(){if(_0x51d10c[_0x3630e0]&&_0x51d10c[_0x3630e0][_0x553a('0x56')]!==_0x553a('0x79')){_0x330021[_0x553a('0xb1')](_0x330021[_0x553a('0x21')][_0x51d10c[_0x3630e0]['queue']]);logger[_0x553a('0x93')](_0x553a('0xb2'),_0x162165,_0x3630e0,_0x51d10c[_0x3630e0][_0x553a('0xb3')]);delete _0x51d10c[_0x3630e0];}if(_0x51d10c[_0x3630e0]&&_0x51d10c[_0x3630e0][_0x553a('0x56')]===_0x553a('0x79')){_0x330021[_0x553a('0xb1')](_0x330021['campaigns'][_0x51d10c[_0x3630e0]['queue']]);logger[_0x553a('0x93')]('[Dialer][checkChannel][ivr]',_0x162165,_0x3630e0,_0x51d10c[_0x3630e0][_0x553a('0xb3')]);delete _0x51d10c[_0x3630e0];}},0x2328);}});}});}}};Dialer[_0x553a('0xa8')]['countReScheduled']=function(_0x1a5fe8){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper[_0x553a('0xb6')](_0x1a5fe8))[_0x553a('0xaf')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x553a('0xa8')]['checkIsBlackList']=function(_0x470aaf){return BPromise[_0x553a('0xb4')]()['then'](cmHopperBlack['checkIsBlackList'](_0x470aaf))[_0x553a('0xaf')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x553a('0xa8')][_0x553a('0xb7')]=function(_0x115d20){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopperBlack[_0x553a('0xb7')](_0x115d20))[_0x553a('0xaf')](loggerCatch(_0x553a('0xb8')));};Dialer[_0x553a('0xa8')]['averageHandleTime']=function(_0x270b0e){return BPromise[_0x553a('0xb4')]()['then'](cmHopperHistory[_0x553a('0xb9')](_0x270b0e))[_0x553a('0xaf')](loggerCatch(_0x553a('0xba')));};Dialer[_0x553a('0xa8')]['rescheduleContact']=function(_0x1d8313){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper[_0x553a('0xbb')](_0x1d8313))['catch'](loggerCatch(_0x553a('0xbc')));};Dialer[_0x553a('0xa8')][_0x553a('0xbd')]=function(_0x2b926a,_0x157419,_0x3ff8d9){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper[_0x553a('0xbd')](_0x2b926a,_0x157419,_0x3ff8d9))[_0x553a('0xaf')](loggerCatch(_0x553a('0xbe')));};Dialer[_0x553a('0xa8')][_0x553a('0xbf')]=function(_0x95fa83,_0xd15922,_0x4f91ef,_0x24bb1e){return BPromise[_0x553a('0xb4')]()['then'](cmHopper[_0x553a('0xbf')](_0x95fa83,_0xd15922,_0x4f91ef,_0x24bb1e))[_0x553a('0xaf')](loggerCatch(_0x553a('0xc0')));};Dialer[_0x553a('0xa8')][_0x553a('0xc1')]=function(_0x36cf94,_0x5c693b,_0x2534fa){return BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](cmHopper['getContactDialerIvr'](_0x36cf94,_0x5c693b,_0x2534fa))[_0x553a('0xaf')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x553a('0xa8')][_0x553a('0xc2')]=function(_0x50e013){return BPromise[_0x553a('0xb4')]()['then'](voiceQueueRt[_0x553a('0xc2')](_0x50e013))[_0x553a('0xaf')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x553a('0xa8')][_0x553a('0xc3')]=function(_0x10bf55){return BPromise['resolve']()[_0x553a('0xb5')](cmHopper['moveContactManagedDialer'](_0x10bf55))[_0x553a('0xaf')](loggerCatch(_0x553a('0xc4')));};Dialer[_0x553a('0xa8')][_0x553a('0xc5')]=function(_0x1ad367){return BPromise['resolve']()[_0x553a('0xb5')](cmHopperHistory[_0x553a('0xc5')](_0x1ad367))[_0x553a('0xaf')](loggerCatch(_0x553a('0xc6')));};Dialer[_0x553a('0xa8')][_0x553a('0xb1')]=function(_0x5685e4){if(!_[_0x553a('0x3d')](_0x5685e4)&&_0x5685e4!==null){if(typeof _0x5685e4[_0x553a('0x98')]!==_0x553a('0x97')){if(_0x5685e4['originated']>0x0){_0x5685e4[_0x553a('0x98')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x553a('0x93')](_0x553a('0xc7'));}};Dialer[_0x553a('0xa8')][_0x553a('0xc8')]=function(_0x2f8b83,_0x395342){var _0x58af8c=this;return function(_0x1dd9ac){_0x58af8c[_0x553a('0xb1')](_0x395342);logger[_0x553a('0x93')](_0x2f8b83,util[_0x553a('0x94')](_0x1dd9ac,{'showHidden':![],'depth':null}));};};Dialer[_0x553a('0xa8')][_0x553a('0xc9')]=function(_0x4a58ff,_0x11f800,_0x171efb){var _0x228c7f={'state':0x19,'statedesc':_0x553a('0xca')};this[_0x553a('0xb1')](_0x11f800);this['saveInDb'](_[_0x553a('0xcb')](_0x228c7f,_[_0x553a('0xcc')](_0x171efb,['ContactId','ListId','UserId','VoiceQueueId',_0x553a('0xcd')])),'[emptyContact][createHistory]',_0x553a('0xce'));logger['error'](_0x4a58ff);};Dialer['prototype']['isSuccess']=function(_0x22a007){return _0x22a007==='Success';};Dialer[_0x553a('0xa8')][_0x553a('0xcf')]=function(_0x28dcc5){return!_['isUndefined'](_0x28dcc5)&&_0x28dcc5&&!_[_0x553a('0x3d')](_0x28dcc5[_0x553a('0x3f')])&&!_[_0x553a('0x3d')](_0x28dcc5[_0x553a('0x75')])&&_0x28dcc5[_0x553a('0x75')]&&(this[_0x553a('0x24')][util['format'](_0x553a('0xd0'),_0x28dcc5['name'])][_0x553a('0xad')]===_0x553a('0xd1')||this[_0x553a('0x24')][util[_0x553a('0x77')](_0x553a('0xd0'),_0x28dcc5[_0x553a('0x3f')])][_0x553a('0xad')]===_0x553a('0xd2'));};Dialer[_0x553a('0xa8')][_0x553a('0xd3')]=function(_0x109bff,_0x35570e,_0x2beaa6){this[_0x553a('0xc5')](_0x109bff)['catch'](loggerCatch(_0x35570e));this[_0x553a('0xc3')](_0x109bff)[_0x553a('0xaf')](loggerCatch(_0x2beaa6));};Dialer[_0x553a('0xa8')][_0x553a('0x37')]=function(_0x278ad0){var _0x32c0f8=this['uniqueId'][_0x278ad0[_0x553a('0xd4')]];var _0x30bf43;if(!_[_0x553a('0xab')](_0x278ad0)&&!_[_0x553a('0xab')](_0x278ad0['variable'])&&!_[_0x553a('0xab')](_0x278ad0[_0x553a('0xd5')][_0x553a('0xd6')])&&_0x278ad0['exten']===_0x553a('0xd7')&&_0x32c0f8){if(_0x32c0f8['type']!==_0x553a('0x79')&&this['voiceQueues'][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0xd8')]&&_0x278ad0[_0x553a('0xd9')]===_0x553a('0xda')){delete this['uniqueId'][_0x278ad0[_0x553a('0xd4')]];this['updateOriginated'](this[_0x553a('0x21')][_0x32c0f8['queue']]);this['voiceQueues'][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;this[_0x553a('0x21')][_0x32c0f8['queue']][_0x553a('0x60')]+=0x1;_0x30bf43=new Hangup(_0x32c0f8,_0x278ad0);_0x30bf43[_0x553a('0xa5')]=0x12;_0x30bf43[_0x553a('0xa6')]=_0x553a('0xdb');_0x30bf43[_0x553a('0xdc')]=_0x553a('0xdd');ami[_0x553a('0x4b')](_0x553a('0xde'),ut['buildObj'](_0x30bf43,_0x553a('0xdf')));this[_0x553a('0xd3')](_0x30bf43,'[syncHangupInAMD][createHistory]',_0x553a('0xe0'));}if(_0x32c0f8[_0x553a('0x56')]!=='ivr'&&this[_0x553a('0x21')][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0xd8')]&&_0x278ad0[_0x553a('0xd9')]===_0x553a('0xe1')){var _0x4b7f4d=this;return new BPromise(function(_0x1e9b96,_0x235190){delete _0x4b7f4d[_0x553a('0x28')][_0x278ad0[_0x553a('0xd4')]];_0x4b7f4d['updateOriginated'](_0x4b7f4d[_0x553a('0x21')][_0x32c0f8['queue']]);_0x4b7f4d[_0x553a('0x21')][_0x32c0f8[_0x553a('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x4b7f4d[_0x553a('0x21')][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0x60')]+=0x1;var _0x30400e=_0x4b7f4d[_0x553a('0x21')][_0x32c0f8['queue']];var _0x3ea7ab=new Hangup(_0x32c0f8,_0x278ad0);_0x3ea7ab[_0x553a('0xa5')]=0x13;_0x3ea7ab[_0x553a('0xa6')]=_0x553a('0xe2');_0x3ea7ab[_0x553a('0xdc')]=_0x553a('0xdd');_0x3ea7ab[_0x553a('0xe3')]+=0x1;_0x3ea7ab[_0x553a('0xe4')]+=0x1;_0x3ea7ab[_0x553a('0xdf')]=!![];ami[_0x553a('0x4b')]('custom:amd',ut['buildObj'](_0x3ea7ab,_0x553a('0xdf')));_0x4b7f4d[_0x553a('0xc5')](_0x3ea7ab)[_0x553a('0xaf')](loggerCatch(_0x553a('0xe5')));if(_0x3ea7ab[_0x553a('0xe6')]+_0x3ea7ab[_0x553a('0xe7')]+_0x3ea7ab[_0x553a('0xe8')]+_0x3ea7ab['countnosuchnumberretry']+_0x3ea7ab[_0x553a('0xe9')]+_0x3ea7ab[_0x553a('0xea')]+_0x3ea7ab[_0x553a('0xe3')]+_0x3ea7ab['countagentrejectretry']>=_0x30400e['dialGlobalMaxRetry']){_0x4b7f4d[_0x553a('0xeb')](_0x3ea7ab,_0x1e9b96,_0x235190,_0x553a('0xec'));}else{if(_0x3ea7ab['countmachineretry']>=_0x30400e[_0x553a('0xed')]){_0x4b7f4d[_0x553a('0xee')](_0x3ea7ab,_0x1e9b96,_0x235190,_0x553a('0xef'));}else{_0x4b7f4d['rescheduleContact']({'active':![],'countmachineretry':_0x3ea7ab[_0x553a('0xe3')],'scheduledat':moment()[_0x553a('0xf0')](_0x30400e[_0x553a('0xf1')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x3ea7ab[_0x553a('0xf4')],'ListId':_0x3ea7ab[_0x553a('0xf5')],'VoiceQueueId':_0x3ea7ab['VoiceQueueId']||undefined,'CampaignId':_0x3ea7ab['CampaignId']||undefined})[_0x553a('0xaf')](loggerCatch('[rescheduleContact][Machine]'));_0x1e9b96({'reschedule':0x1});}}});}if(_0x32c0f8[_0x553a('0x56')]===_0x553a('0x79')&&this[_0x553a('0x22')][_0x32c0f8[_0x553a('0xb3')]]['dialAMDActive']&&_0x278ad0[_0x553a('0xd9')]===_0x553a('0xda')){delete this[_0x553a('0x28')][_0x278ad0[_0x553a('0xd4')]];this[_0x553a('0xb1')](this[_0x553a('0x22')][_0x32c0f8[_0x553a('0xb3')]]);_0x30bf43=new Hangup(_0x32c0f8,_0x278ad0);_0x30bf43[_0x553a('0xa5')]=0x12;_0x30bf43[_0x553a('0xa6')]=_0x553a('0xdb');_0x30bf43['membername']=_0x553a('0xdd');ami['emit']('custom:amd',ut[_0x553a('0xf6')](_0x30bf43,_0x553a('0xdf')));this[_0x553a('0xd3')](_0x30bf43,'[syncHangupInAMDIvr][createHistory]',_0x553a('0xf7'));}if(_0x32c0f8[_0x553a('0x56')]===_0x553a('0x79')&&this[_0x553a('0x22')][_0x32c0f8['queue']][_0x553a('0xd8')]&&_0x278ad0['value']===_0x553a('0xe1')){var _0x4b7f4d=this;return new BPromise(function(_0x26ea63,_0x25a7a2){delete _0x4b7f4d['uniqueId'][_0x278ad0[_0x553a('0xd4')]];_0x4b7f4d['updateOriginated'](_0x4b7f4d['campaigns'][_0x32c0f8['queue']]);_0x4b7f4d['campaigns'][_0x32c0f8[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;_0x4b7f4d['campaigns'][_0x32c0f8[_0x553a('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x16b927=_0x4b7f4d[_0x553a('0x22')][_0x32c0f8[_0x553a('0xb3')]];var _0x5e8258=new Hangup(_0x32c0f8,_0x278ad0);_0x5e8258[_0x553a('0xa5')]=0x13;_0x5e8258[_0x553a('0xa6')]=_0x553a('0xe2');_0x5e8258[_0x553a('0xdc')]=_0x553a('0xdd');_0x5e8258['countmachineretry']+=0x1;_0x5e8258[_0x553a('0xe4')]+=0x1;_0x5e8258[_0x553a('0xdf')]=!![];ami[_0x553a('0x4b')]('custom:amd',ut[_0x553a('0xf6')](_0x5e8258,'amd'));_0x4b7f4d[_0x553a('0xc5')](_0x5e8258)[_0x553a('0xaf')](loggerCatch(_0x553a('0xe5')));if(_0x5e8258['countbusyretry']+_0x5e8258[_0x553a('0xe7')]+_0x5e8258[_0x553a('0xe8')]+_0x5e8258[_0x553a('0xf8')]+_0x5e8258[_0x553a('0xe9')]+_0x5e8258[_0x553a('0xea')]+_0x5e8258['countmachineretry']+_0x5e8258[_0x553a('0xf9')]>=_0x16b927[_0x553a('0xfa')]){_0x4b7f4d[_0x553a('0xeb')](_0x5e8258,_0x26ea63,_0x25a7a2,'reason19\x20machine....');}else{if(_0x5e8258[_0x553a('0xe3')]>=_0x16b927[_0x553a('0xed')]){_0x4b7f4d[_0x553a('0xee')](_0x5e8258,_0x26ea63,_0x25a7a2,_0x553a('0xef'));}else{_0x4b7f4d[_0x553a('0xbb')]({'active':![],'countmachineretry':_0x5e8258[_0x553a('0xe3')],'scheduledat':moment()[_0x553a('0xf0')](_0x16b927[_0x553a('0xf1')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x5e8258[_0x553a('0xf4')],'ListId':_0x5e8258[_0x553a('0xf5')],'VoiceQueueId':_0x5e8258[_0x553a('0xfb')]||undefined,'CampaignId':_0x5e8258[_0x553a('0xcd')]||undefined})['catch'](loggerCatch(_0x553a('0xfc')));_0x26ea63({'reschedule':0x1});}}});}}};Dialer[_0x553a('0xa8')][_0x553a('0x34')]=function(_0x2344d7){var _0x1d681d=this[_0x553a('0x28')][_0x2344d7[_0x553a('0xd4')]];var _0x2d345d=this;var _0x53dc5d;if(_0x1d681d&&_0x1d681d[_0x553a('0x56')]===_0x553a('0x79')){delete this[_0x553a('0x28')][_0x2344d7['uniqueid']];this[_0x553a('0xb1')](this[_0x553a('0x22')][_0x1d681d[_0x553a('0xb3')]]);this['campaigns'][_0x1d681d[_0x553a('0xb3')]][_0x553a('0xfd')]+=0x1;_0x53dc5d=new Hangup(_0x1d681d,_0x2344d7);this[_0x553a('0xc5')](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xfe')));this[_0x553a('0xc3')](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xff')));}if(_0x1d681d&&_0x1d681d[_0x553a('0x56')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x1d681d['queue']][_0x553a('0x100')])){delete this[_0x553a('0x28')][_0x2344d7[_0x553a('0xd4')]];this['updateOriginated'](this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]]);this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;this['voiceQueues'][_0x1d681d['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x53dc5d=new Hangup(_0x1d681d,_0x2344d7);_0x53dc5d[_0x553a('0xa5')]=0x10;_0x53dc5d[_0x553a('0xa6')]=_0x553a('0x101');_0x53dc5d[_0x553a('0xdc')]='AGI';this[_0x553a('0xc5')](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xfe')));this['moveContactManagedDialer'](_0x53dc5d)[_0x553a('0xaf')](loggerCatch(_0x553a('0xff')));}if(_0x1d681d&&_0x1d681d[_0x553a('0x56')]!==_0x553a('0x79')&&!isNotNull(this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]][_0x553a('0x100')])){delete this[_0x553a('0x28')][_0x2344d7[_0x553a('0xd4')]];this[_0x553a('0xb1')](this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]]);this[_0x553a('0x21')][_0x1d681d[_0x553a('0xb3')]][_0x553a('0x6b')]+=0x1;_0x53dc5d=new Hangup(_0x1d681d,_0x2344d7);_0x53dc5d[_0x553a('0xa5')]=0xc;_0x53dc5d['statedesc']=_0x2344d7['cause-txt'];_0x53dc5d[_0x553a('0xdc')]='Unknow';this['createHistory'](_0x53dc5d)[_0x553a('0xaf')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x53dc5d)['catch'](loggerCatch(_0x553a('0xff')));}};Dialer[_0x553a('0xa8')][_0x553a('0x102')]=function(_0x6ef10f){var _0x4c61c2=this[_0x553a('0x28')][_0x6ef10f[_0x553a('0xd4')]];var _0x1351c2=this;if(this[_0x553a('0x21')][_0x6ef10f['queue']]){if(_0x4c61c2&&_0x4c61c2[_0x553a('0x56')]!==_0x553a('0x79')){delete this[_0x553a('0x28')][_0x6ef10f[_0x553a('0xd4')]];this[_0x553a('0x21')][_0x6ef10f[_0x553a('0xb3')]][_0x553a('0x61')]+=0x1;var _0x53abd8=new AgentComplete(_0x4c61c2,_0x6ef10f);if(_0x6ef10f['reason']===_0x553a('0x103')){_0x53abd8[_0x553a('0x104')]=this[_0x553a('0x21')][_0x6ef10f['queue']][_0x553a('0x105')]&&this[_0x553a('0x21')][_0x6ef10f[_0x553a('0xb3')]][_0x553a('0x106')]?moment()[_0x553a('0x77')](_0x553a('0xf3')):undefined;}this[_0x553a('0xc5')](_0x53abd8)[_0x553a('0xaf')](loggerCatch(_0x553a('0x107')));this[_0x553a('0xc3')](_0x53abd8)['catch'](loggerCatch(_0x553a('0x108')));}}};Dialer[_0x553a('0xa8')]['syncAgentConnect']=function(_0x30649d){if(this[_0x553a('0x21')][_0x30649d[_0x553a('0xb3')]]){if(this[_0x553a('0x28')][_0x30649d['uniqueid']]&&this[_0x553a('0x28')][_0x30649d[_0x553a('0xd4')]]['type']!==_0x553a('0x79')){this[_0x553a('0xb1')](this[_0x553a('0x21')][_0x30649d[_0x553a('0xb3')]]);this[_0x553a('0x28')][_0x30649d[_0x553a('0xd4')]][_0x553a('0x109')]=moment()[_0x553a('0x77')](_0x553a('0xf3'));}}};Dialer['prototype'][_0x553a('0x10a')]=function(_0x4d9344){this[_0x553a('0xc5')](_0x4d9344)[_0x553a('0xaf')](loggerCatch(_0x553a('0x107')));this[_0x553a('0xc3')](_0x4d9344)[_0x553a('0xaf')](loggerCatch(_0x553a('0x10b')));};Dialer[_0x553a('0xa8')][_0x553a('0x32')]=function(_0x82e373){var _0x33a463=this[_0x553a('0x28')][_0x82e373[_0x553a('0xd4')]];var _0x288f32=this;if(this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]]){if(_0x33a463&&_0x33a463[_0x553a('0x56')]!==_0x553a('0x79')){delete this['uniqueId'][_0x82e373['uniqueid']];this[_0x553a('0xb1')](this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]]);_0x33a463['droptime']=moment()[_0x553a('0x77')](_0x553a('0xf3'));var _0x2c3a72=new QueueCallerAbandon(_0x33a463,_0x82e373);if(getSeconds(_0x33a463['droptime'],_0x33a463[_0x553a('0x10c')])>=_0x33a463[_0x553a('0x10d')]){this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x6f')]+=0x1;this[_0x553a('0x21')][_0x82e373['queue']][_0x553a('0x10e')]+=0x1;this['voiceQueues'][_0x82e373['queue']][_0x553a('0x71')]+=0x1;_0x2c3a72['state']=0xa;_0x2c3a72[_0x553a('0xa6')]=_0x553a('0x10f');_0x2c3a72[_0x553a('0x110')]=_0x553a('0x111');_0x2c3a72[_0x553a('0x104')]=this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x105')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2c3a72['countdropretry']+=0x1;_0x2c3a72[_0x553a('0xe4')]+=0x1;if(_0x2c3a72['countdropretry']>=this['voiceQueues'][_0x82e373[_0x553a('0xb3')]]['dialDropMaxRetry']){this[_0x553a('0x10a')](_0x2c3a72);}else{this[_0x553a('0xbb')]({'active':![],'countdropretry':_0x2c3a72[_0x553a('0xe9')],'scheduledat':moment()[_0x553a('0xf0')](this[_0x553a('0x21')][_0x82e373['queue']][_0x553a('0x112')],'minutes')[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33a463[_0x553a('0xf4')],'ListId':_0x33a463[_0x553a('0xf5')],'VoiceQueueId':_0x33a463[_0x553a('0xfb')]||undefined,'CampaignId':_0x33a463[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x113')));var _0x79848d=new History(_0x2c3a72);_0x79848d[_0x553a('0xa5')]=0xa;_0x79848d[_0x553a('0xa6')]=_0x553a('0x10f');_0x79848d[_0x553a('0x114')]=moment()[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x79848d[_0x553a('0xa7')]=_0x79848d[_0x553a('0x114')];_0x79848d[_0x553a('0x115')]=_0x2c3a72[_0x553a('0x115')];_0x79848d[_0x553a('0x116')]=_0x2c3a72[_0x553a('0x116')];this[_0x553a('0xc5')](_0x79848d)[_0x553a('0xaf')](loggerCatch(_0x553a('0x117')));}}else{this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x7f')]+=0x1;this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x66')]+=0x1;_0x2c3a72[_0x553a('0xa5')]=0xb;_0x2c3a72[_0x553a('0xa6')]=_0x553a('0x118');_0x2c3a72['dropreason']=_0x553a('0x119');_0x2c3a72[_0x553a('0xea')]+=0x1;_0x2c3a72[_0x553a('0xe4')]+=0x1;if(_0x2c3a72[_0x553a('0xea')]>=this['voiceQueues'][_0x82e373[_0x553a('0xb3')]][_0x553a('0x11a')]){this[_0x553a('0x10a')](_0x2c3a72);}else{this[_0x553a('0xbb')]({'active':![],'countabandonedretry':_0x2c3a72[_0x553a('0xea')],'scheduledat':moment()[_0x553a('0xf0')](this[_0x553a('0x21')][_0x82e373[_0x553a('0xb3')]][_0x553a('0x11b')],_0x553a('0xf2'))['format'](_0x553a('0xf3')),'ContactId':_0x33a463[_0x553a('0xf4')],'ListId':_0x33a463[_0x553a('0xf5')],'VoiceQueueId':_0x33a463['VoiceQueueId']||undefined,'CampaignId':_0x33a463['CampaignId']||undefined})['catch'](loggerCatch(_0x553a('0x11c')));var _0x79848d=new History(_0x2c3a72);_0x79848d[_0x553a('0xa5')]=0xb;_0x79848d[_0x553a('0xa6')]=_0x553a('0x118');_0x79848d['starttime']=moment()[_0x553a('0x77')](_0x553a('0xf3'));_0x79848d[_0x553a('0xa7')]=_0x79848d[_0x553a('0x114')];_0x79848d[_0x553a('0x115')]=_0x2c3a72[_0x553a('0x115')];_0x79848d[_0x553a('0x116')]=_0x2c3a72['calleridnum'];this[_0x553a('0xc5')](_0x79848d)[_0x553a('0xaf')](loggerCatch(_0x553a('0x11d')));}}}}};Dialer['prototype'][_0x553a('0x36')]=function(_0x4a3fd0){if(this[_0x553a('0x26')][_0x4a3fd0[_0x553a('0xd4')]]){this[_0x553a('0x26')][_0x4a3fd0[_0x553a('0xd4')]][_0x553a('0xae')]=_0x4a3fd0[_0x553a('0xae')];}if(this[_0x553a('0x28')][_0x4a3fd0[_0x553a('0xd4')]]){this['uniqueId'][_0x4a3fd0[_0x553a('0xd4')]][_0x553a('0xae')]=_0x4a3fd0['channel'];}};Dialer[_0x553a('0xa8')]['syncQueueMember']=function(_0x53f96c){if(strategy[this[_0x553a('0x21')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]===_0x553a('0x1b')){if(this[_0x553a('0x26')][_0x53f96c['actionid']]&&_[_0x553a('0xab')](this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]['locked'])&&_0x53f96c[_0x553a('0xad')]==='1'&&_0x53f96c[_0x553a('0x11f')]==='0'){if(this[_0x553a('0x23')][_0x53f96c[_0x553a('0x120')]]){if(!this['agents'][_0x53f96c[_0x553a('0x120')]][_0x553a('0x121')]){this[_0x553a('0x23')][_0x53f96c[_0x553a('0x120')]][_0x553a('0x121')]=!![];this[_0x553a('0x26')][_0x53f96c['actionid']][_0x553a('0x121')]=!![];this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]][_0x553a('0x120')]=_0x53f96c[_0x553a('0x120')];}}}}else if((strategy[this[_0x553a('0x21')][this['actions'][_0x53f96c[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]||'rrmemory')==='rrmemory'){if(this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]){if(this[_0x553a('0x23')][_0x53f96c['stateinterface']]){this['actions'][_0x53f96c['actionid']][_0x553a('0x120')]=_0x53f96c[_0x553a('0x120')];if(_[_0x553a('0xab')](this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]['queue']])){this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]][_0x553a('0xb3')]]=[];}this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]]['queue']][_0x553a('0x122')](_[_0x553a('0xcb')](_[_0x553a('0xcc')](this[_0x553a('0x26')][_0x53f96c[_0x553a('0x11e')]],[_0x553a('0x123'),_0x553a('0x120')]),{'status':_0x53f96c[_0x553a('0xad')],'paused':_0x53f96c['paused']}));}}}};function unlockQueueStatus(_0x27fda4,_0x430ed2){setTimeout(function(){if(_[_0x553a('0x3d')](_0x27fda4[_0x553a('0x124')])){loggerBooked[_0x553a('0x93')](_0x553a('0x125'),_0x430ed2);}_0x27fda4[_0x553a('0x124')]=!![];loggerBooked[_0x553a('0x7b')](_0x553a('0x126'),_0x430ed2,JSON[_0x553a('0x48')](_['pick'](_0x27fda4,[_0x553a('0x3f'),_0x553a('0x124')])));},0x1f3);}Dialer['prototype'][_0x553a('0x127')]=function(_0x5da5b8){var _0x4f34d3=this;var _0x19a0b0=_0x4f34d3[_0x553a('0x21')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8['actionid']][_0x553a('0xb3')]];if(strategy[this['voiceQueues'][this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]===_0x553a('0x1b')){if(this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]&&this[_0x553a('0x26')][_0x5da5b8['actionid']][_0x553a('0x120')]){this[_0x553a('0x20')]['run'](this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0x123')],this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0x120')])[_0x553a('0xaf')](function(_0x44dbfc){logger[_0x553a('0x93')](_0x553a('0x128'),util[_0x553a('0x94')](_0x44dbfc,{'showHidden':![],'depth':null}));})[_0x553a('0x1e')](function(){_0x4f34d3['updateOriginated'](_0x4f34d3[_0x553a('0x21')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]]);_0x4f34d3['agents'][_0x4f34d3['actions'][_0x5da5b8[_0x553a('0x11e')]]['stateinterface']][_0x553a('0x121')]=![];delete _0x4f34d3[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]];unlockQueueStatus(_0x19a0b0);});}else{this[_0x553a('0xb1')](this[_0x553a('0x21')][this['actions'][_0x5da5b8['actionid']][_0x553a('0xb3')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xf4')],'ListId':this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xf5')],'VoiceQueueId':this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xcd')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]];unlockQueueStatus(_0x19a0b0);}}else if((strategy[this[_0x553a('0x21')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x4d')]]||_0x553a('0x1a'))===_0x553a('0x1a')){var _0x482b1a;if(this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]&&!_[_0x553a('0x44')](this[_0x553a('0x2c')][this['actions'][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]])){if(this[_0x553a('0x2d')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8['actionid']][_0x553a('0xb3')]]){this[_0x553a('0x2d')][_0x4f34d3[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']]=this[_0x553a('0x2d')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]]?this[_0x553a('0x2d')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']]:this[_0x553a('0x2c')][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]]?this['queueBooked'][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']][_0x553a('0x129')]||0x0:0x0;}this['queueBooked'][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]][_0x553a('0xb3')]][_0x553a('0x129')]=this['queueBookedRR'][this[_0x553a('0x26')][_0x5da5b8[_0x553a('0x11e')]]['queue']];for(var _0x26c1e0=0x0;_0x26c1e0=0x0;})[_0x553a('0xaf')](myreject(_0x16d363)));}}else{_0x3efd46[_0x553a('0x122')](ami[_0x553a('0xac')]({'action':_0x553a('0x140'),'command':util[_0x553a('0x77')](_0x553a('0x141'),_0x4de4ec,!_[_0x553a('0x3d')](config['timezones'][_0x5d062b])?_0x5d062b:'')})[_0x553a('0xb5')](function(_0x19600c){return _0x19600c[_0x553a('0x144')]['indexOf']('true')>=0x0;})[_0x553a('0xaf')](myreject(_0x16d363)));}BPromise[_0x553a('0x145')](_0x3efd46)['then'](function(_0x5b2789){var _0x3c8428=_['some'](_0x5b2789);if(_0x3c8428){return _0x6ccf2(_0x3c8428);}else{_0x36a44[_0x553a('0x3e')]=_0x52a08e?_0x553a('0x146'):_0x553a('0x147');return _0x16d363(msgResponse(_0x553a('0x148'),_0x553a('0x13b'),_0x553a('0x149')+_0x52a08e+'\x20'+_0x57f5e4+_0x553a('0x14a')+util[_0x553a('0x94')](_0x4de4ec,{'showHidden':![],'depth':null})+_0x553a('0x14b')+_0x5d062b));}})['catch'](function(_0x3556e0){return _0x16d363(msgResponse(_0x553a('0x13a'),_0x553a('0x13b'),JSON[_0x553a('0x48')](_0x3556e0)));});});};Dialer['prototype'][_0x553a('0x14c')]=function(_0x10eba7){var _0xd64027=this;return function(){switch(_0x10eba7[_0x553a('0x5c')]){case _0x553a('0x14d'):freeVariablesPredictive(_0x10eba7);_0xd64027['handlePower'](_0x10eba7,0x1);break;case'power':freeVariablesPredictive(_0x10eba7);_0xd64027[_0x553a('0x14e')](_0x10eba7,_0x10eba7[_0x553a('0x14f')]);break;case _0x553a('0x150'):_0xd64027[_0x553a('0x150')](_0x10eba7);break;case _0x553a('0x9'):freeVariablesPredictive(_0x10eba7);_0xd64027[_0x553a('0x14e')](_0x10eba7,0x1);break;default:freeVariablesPredictive(_0x10eba7);logger[_0x553a('0x93')]('Queue',_0x10eba7[_0x553a('0x3f')],_0x553a('0x151'));}};};Dialer[_0x553a('0xa8')][_0x553a('0x152')]=function(_0x3fbadf){var _0x3c8153=this;return function(){_0x3c8153[_0x553a('0x153')](_0x3fbadf);};};Dialer[_0x553a('0xa8')][_0x553a('0xb')]=function(_0x58adc0){var _0x35a01b=this;if(isNotPreview(_0x58adc0[_0x553a('0x5c')])){if(isVoiceQueueOutbound(_0x58adc0['type'])&&isActive(_0x58adc0[_0x553a('0x5b')])){_0x58adc0[_0x553a('0x9f')]=!![];BPromise[_0x553a('0xb4')]()[_0x553a('0xb5')](checkIsLoggedIn(_0x58adc0,_0x58adc0['loggedIn']))[_0x553a('0xb5')](checkIsActive(_0x58adc0,_0x58adc0[_0x553a('0x5b')]))[_0x553a('0xb5')](checkInterval(_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x154')](_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x138')](_0x58adc0[_0x553a('0x155')],_0x58adc0[_0x553a('0x156')],_0x58adc0['name'],_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x139')](_0x58adc0[_0x553a('0x42')],_0x58adc0[_0x553a('0x156')],_0x58adc0['name'],_0x58adc0))[_0x553a('0xb5')](_0x35a01b[_0x553a('0x14c')](_0x58adc0))['catch'](loggerCatchQueueSummary(_0x553a('0x157'),_0x58adc0));}else{notSendMessagesQueue(_0x58adc0);}}else{freeVariablesPredictive(_0x58adc0);}};Dialer[_0x553a('0xa8')][_0x553a('0x135')]=function(){var _0x372fee=this;var _0x29ddd0;for(var _0x268102 in this[_0x553a('0x22')]){if(typeof this['campaigns'][_0x268102]!==_0x553a('0x97')){_0x29ddd0=this[_0x553a('0x22')][_0x268102];if(isCampaignIvr(_0x29ddd0[_0x553a('0x56')])&&isActive(_0x29ddd0[_0x553a('0x75')])){_0x29ddd0[_0x553a('0x9f')]=!![];BPromise[_0x553a('0xb4')]()['then'](checkIsActive(_0x29ddd0,_0x29ddd0[_0x553a('0x75')]))['then'](checkInterval(_0x29ddd0))[_0x553a('0xb5')](_0x372fee['checkIsTrunkReachable'](_0x29ddd0))[_0x553a('0xb5')](_0x372fee[_0x553a('0x138')](_0x29ddd0[_0x553a('0x155')],_0x29ddd0[_0x553a('0x156')],_0x29ddd0[_0x553a('0x3f')],_0x29ddd0))['then'](_0x372fee[_0x553a('0x139')](_0x29ddd0[_0x553a('0x42')],_0x29ddd0[_0x553a('0x156')],_0x29ddd0[_0x553a('0x3f')],_0x29ddd0))[_0x553a('0xb5')](_0x372fee['launchHandleIvr'](_0x29ddd0))[_0x553a('0xaf')](loggerCatchQueueSummary('[syncCampaigns]',_0x29ddd0));}else{notSendMessagesCampaign(_0x29ddd0);}}}};function getCallerIdRandom(_0x3bdbcb,_0x18305f){var _0x174135;var _0x39699f;var _0x59e8b6;if(_0x18305f<=0x0){_0x18305f=0x1;}_0x174135=new RegExp(_0x553a('0x158')+_0x18305f+'}$');_0x39699f=Math[_0x553a('0x159')](0xa,_0x18305f-0x1);_0x59e8b6=Math[_0x553a('0x159')](0xa,_0x18305f)-0x1;return util[_0x553a('0x77')]('%s',_[_0x553a('0x15a')](_0x3bdbcb,_0x174135,_['random'](_0x39699f,_0x59e8b6)));}function extractCalleridName(_0x4de48a){var _0xaa86d0=_0x4de48a[_0x553a('0x15b')](/"(.*?)"/);return _0xaa86d0?_0xaa86d0[0x1]:_0x4de48a;}function extractCalleridNumber(_0x54bf32){var _0x47c31a=_0x54bf32[_0x553a('0x15b')](/<(.*?)>/);return _0x47c31a?_0x47c31a[0x1]:_0x54bf32;}Dialer[_0x553a('0xa8')][_0x553a('0x15c')]=function(_0x5a04ee,_0x3f9d6d){var _0xa35f93=this;var _0x35dafb=uuid['v4']();this['actions'][_0x35dafb]=new Action(_0x5a04ee,_0x3f9d6d,_0x35dafb);return new BPromise(function(_0x514b72,_0x96529d){if(_['isUndefined'](_0x5a04ee)&&typeof _0x5a04ee!==_0x553a('0x15d')){return _0x96529d(msgResponse('originate',_0x553a('0x13b'),_0x553a('0x15e')));}if(_['isUndefined'](_0x3f9d6d['Contact'][_0x553a('0x15f')])||_0x3f9d6d[_0x553a('0x160')]['phone']===null){return _0x96529d(msgResponse(_0x553a('0x161'),_0x553a('0x13b'),_0x553a('0x162')));}var _0x488c8d={'XMD-CALLERID':_0xa35f93[_0x553a('0x26')][_0x35dafb][_0x553a('0x163')](),'XMD-AGI':_0x5a04ee[_0x553a('0x100')]?util[_0x553a('0x77')](_0x553a('0x164'),ipAgi,_0x5a04ee[_0x553a('0x100')]):'NONE','XMD-AGIAFTER':_0x5a04ee[_0x553a('0x105')]?util['format'](_0x553a('0x164'),ipAgi,_0x5a04ee[_0x553a('0x105')]):'NONE','XMD-QUEUE':_0x5a04ee[_0x553a('0x56')]===_0x553a('0x4c')?util[_0x553a('0x77')](_0x553a('0x165'),_0x5a04ee[_0x553a('0x3f')],_0x5a04ee['dialQueueOptions']||'',_0x5a04ee[_0x553a('0x106')]?'c':'',_0x5a04ee[_0x553a('0x10d')]||0x3):_0x553a('0x166'),'XMD-CONTACTID':_0x3f9d6d[_0x553a('0xf4')],'XMD-CDRTYPE':_0x553a('0x167'),'CALLERID(all)':_0xa35f93[_0x553a('0x26')][_0x35dafb]['getCaller'](),'XMD-AMD':_0x5a04ee[_0x553a('0xd8')]?'ACTIVE':_0x553a('0x166'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5a04ee[_0x553a('0xd8')]){_0x488c8d[_0x553a('0x168')]=_0x5a04ee['dialAMDInitialSilence']||0x9c4;_0x488c8d['XMD-AMDGREETING']=_0x5a04ee[_0x553a('0x169')]||0x5dc;_0x488c8d['XMD-AMDAFTERGREETINGSILENCE']=_0x5a04ee[_0x553a('0x16a')]||0x320;_0x488c8d[_0x553a('0x16b')]=_0x5a04ee['dialAMDTotalAnalysisTime']||0x1388;_0x488c8d[_0x553a('0x16c')]=_0x5a04ee[_0x553a('0x16d')]||0x64;_0x488c8d[_0x553a('0x16e')]=_0x5a04ee['dialAMDBetweenWordsSilence']||0x32;_0x488c8d[_0x553a('0x16f')]=_0x5a04ee[_0x553a('0x170')]||0x3;_0x488c8d[_0x553a('0x171')]=_0x5a04ee['dialAMDSilenceThreshold']||0x100;_0x488c8d['XMD-AMDMAXIMUMWORDLENGTH']=_0x5a04ee['dialAMDMaximumWordLength']||0x1388;}if(_0x5a04ee[_0x553a('0x56')]===_0x553a('0x4c')){_0x488c8d[_0x553a('0x172')]=_0x3f9d6d[_0x553a('0xfb')];}else{_0x488c8d[_0x553a('0x173')]=_0x3f9d6d['CampaignId'];}for(var _0x1972bd in _0x3f9d6d[_0x553a('0x160')]){if(typeof _0x3f9d6d[_0x553a('0x160')][_0x1972bd]!==_0x553a('0x97')){if(isNotNull(_0x3f9d6d['Contact'][_0x1972bd])&&_0x1972bd!=='id'&&_0x1972bd!==_0x553a('0x174')&&_0x1972bd!==_0x553a('0x175')&&_0x1972bd!==_0x553a('0x176')){_0x488c8d[util[_0x553a('0x77')]('%s%s',_0x553a('0x177'),_['toUpper'](_0x1972bd))]=_0x3f9d6d['Contact'][_0x1972bd];}}}var _0x588fc8=_0xa35f93[_0x553a('0xcf')](_0x5a04ee[_0x553a('0x74')])?getCallerId(_0x5a04ee[_0x553a('0x74')]['callerid'],_0x5a04ee[_0x553a('0x5d')],_0x5a04ee[_0x553a('0x178')]>0x0?getCallerIdRandom(_0x5a04ee['dialOriginateCallerIdNumber'],_0x5a04ee['dialRandomLastDigitCallerIdNumber']):_0x5a04ee[_0x553a('0x179')]):getCallerId(_[_0x553a('0xab')](_0x5a04ee[_0x553a('0x136')])?_0x5a04ee['Trunk'][_0x553a('0x76')]:_0x5a04ee[_0x553a('0x136')]['callerid'],_0x5a04ee[_0x553a('0x5d')],_0x5a04ee[_0x553a('0x178')]>0x0?getCallerIdRandom(_0x5a04ee[_0x553a('0x179')],_0x5a04ee['dialRandomLastDigitCallerIdNumber']):_0x5a04ee[_0x553a('0x179')]);if(_0x588fc8){_0x488c8d[_0x553a('0x17a')]=_0xa35f93[_0x553a('0x26')][_0x35dafb][_0x553a('0x17b')]=extractCalleridName(_0x588fc8);_0x488c8d['XMD-ORIGINATECALLERIDNUM']=_0xa35f93[_0x553a('0x26')][_0x35dafb][_0x553a('0x17c')]=extractCalleridNumber(_0x588fc8);}return ami['Action']({'actionid':_0x35dafb,'action':_0x553a('0x161'),'channel':_0xa35f93['isTrunkReachable'](_0x5a04ee[_0x553a('0x74')])?util['format'](_0x553a('0x17d'),_0x5a04ee[_0x553a('0x74')][_0x553a('0x3f')],isNotNull(_0x5a04ee[_0x553a('0x5f')])?_0x5a04ee[_0x553a('0x5f')]['trim']()||'':'',_0x5a04ee['dialCutDigit']>0x0?_0x3f9d6d[_0x553a('0x160')]['phone'][_0x553a('0x17e')](_0x5a04ee['dialCutDigit']):_0x3f9d6d[_0x553a('0x160')]['phone']):util[_0x553a('0x77')]('SIP/%s/%s%s',_[_0x553a('0xab')](_0x5a04ee['TrunkBackup'])?_0x5a04ee[_0x553a('0x74')][_0x553a('0x3f')]:_0x5a04ee[_0x553a('0x136')]['name'],isNotNull(_0x5a04ee[_0x553a('0x5f')])?_0x5a04ee[_0x553a('0x5f')]['trim']()||'':'',_0x5a04ee[_0x553a('0x17f')]>0x0?_0x3f9d6d['Contact']['phone'][_0x553a('0x17e')](_0x5a04ee['dialCutDigit']):_0x3f9d6d[_0x553a('0x160')][_0x553a('0x15f')]),'callerid':_0x588fc8,'Exten':'xcally-motion-dialer','Context':_0x553a('0x180'),'Priority':'1','variable':_0x488c8d,'timeout':(_0x5a04ee[_0x553a('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35dafb})[_0x553a('0xb5')](function(_0x1070d2){return _0x514b72(_0x1070d2);})[_0x553a('0xaf')](function(_0x53bfa0){_0x5a04ee[_0x553a('0x69')]+=0x1;var _0x29b888=new History(_0xa35f93['actions'][_0x35dafb]);logger[_0x553a('0x93')](util[_0x553a('0x77')](_0x553a('0x181'),JSON[_0x553a('0x48')](_0x53bfa0)));_0x29b888[_0x553a('0xa5')]=0xe;_0x29b888['statedesc']=_0x553a('0x182');_0x29b888[_0x553a('0x114')]=moment()[_0x553a('0x77')](_0x553a('0xf3'));_0x29b888[_0x553a('0xa7')]=_0x29b888[_0x553a('0x114')];_0xa35f93['createHistory'](_0x29b888)[_0x553a('0xaf')](loggerCatch(_0x553a('0x183')));_0xa35f93[_0x553a('0xc3')](_0x29b888)[_0x553a('0xaf')](loggerCatch(_0x553a('0x183')))[_0x553a('0x1e')](function(){delete _0xa35f93['actions'][_0x35dafb];return _0x96529d(msgResponse('originate',_0x553a('0x47'),_0x553a('0x184')));});});});};Dialer[_0x553a('0xa8')]['syncOriginateResponse']=function(_0x2bf789){var _0x14a8eb=this[_0x553a('0x26')][_0x2bf789[_0x553a('0x11e')]];if(_0x14a8eb){delete this[_0x553a('0x26')][_0x2bf789[_0x553a('0x11e')]];_0x14a8eb[_0x553a('0x10c')]=moment()['format'](_0x553a('0xf3'));var _0x3bff3e=_0x14a8eb['type']===_0x553a('0x79')?this[_0x553a('0x22')][_0x14a8eb[_0x553a('0xb3')]]:this['voiceQueues'][_0x14a8eb[_0x553a('0x185')]()];if(!this[_0x553a('0x186')](_0x2bf789['response'])){this[_0x553a('0xb1')](_0x3bff3e);return this[_0x553a('0x187')](_0x14a8eb,_0x3bff3e,_0x2bf789)[_0x553a('0xaf')](loggerCatch(_0x553a('0x188')));}this['uniqueId'][_0x2bf789[_0x553a('0xd4')]]=_0x14a8eb;}};Dialer['prototype']['checkRetriveMax']=function(_0x5a6a33,_0x2118d3,_0x1b8ddb){var _0x21114a=new History(_0x2118d3);if(_0x21114a[_0x553a('0xe6')]+_0x21114a[_0x553a('0xe7')]+_0x21114a['countnoanswerretry']+_0x21114a['countnosuchnumberretry']+_0x21114a[_0x553a('0xe9')]+_0x21114a['countabandonedretry']+_0x21114a[_0x553a('0xe3')]+_0x21114a[_0x553a('0xf9')]>=_0x1b8ddb[_0x553a('0xfa')]-0x1){return!![];}switch(_0x5a6a33){case 0x3:if(_0x21114a[_0x553a('0xe8')]>=_0x1b8ddb['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x21114a[_0x553a('0xe8')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x189')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x18a')));break;case 0x5:if(_0x21114a[_0x553a('0xe6')]>=_0x1b8ddb[_0x553a('0x18b')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countbusyretry':_0x21114a[_0x553a('0xe6')]+=0x1,'scheduledat':moment()['add'](_0x1b8ddb['dialBusyRetryFrequency'],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a['ListId'],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x18c')));break;case 0x8:if(_0x21114a[_0x553a('0xe7')]>=_0x1b8ddb[_0x553a('0x18d')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countcongestionretry':_0x21114a[_0x553a('0xe7')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x18e')],_0x553a('0xf2'))['format'](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x21114a[_0x553a('0xf8')]>=_0x1b8ddb[_0x553a('0x18f')]-0x1){return!![];}else{this[_0x553a('0xbb')]({'active':![],'countnosuchnumberretry':_0x21114a['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb['dialNoSuchNumberRetryFrequency'],'minutes')[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21114a['ContactId'],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a['VoiceQueueId']||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x190')));}break;case 0xa:if(_0x21114a['countdropretry']>=_0x1b8ddb[_0x553a('0x191')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x21114a[_0x553a('0xe9')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb['dialDropRetryFrequency'],_0x553a('0xf2'))[_0x553a('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21114a['ContactId'],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x113')));break;case 0xb:if(_0x21114a[_0x553a('0xea')]>=_0x1b8ddb['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countabandonedretry':_0x21114a[_0x553a('0xea')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x11b')],'minutes')[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a['VoiceQueueId']||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x11c')));break;case 0x13:if(_0x21114a[_0x553a('0xe3')]>=_0x1b8ddb[_0x553a('0xed')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countmachineretry':_0x21114a[_0x553a('0xe3')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0xf1')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a[_0x553a('0xf5')],'VoiceQueueId':_0x21114a['VoiceQueueId']||undefined,'CampaignId':_0x21114a['CampaignId']||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0xfc')));break;case 0x14:if(_0x21114a[_0x553a('0xf9')]>=_0x1b8ddb[_0x553a('0x192')]-0x1){return!![];}this[_0x553a('0xbb')]({'active':![],'countagentrejectretry':_0x21114a[_0x553a('0xf9')]+=0x1,'scheduledat':moment()[_0x553a('0xf0')](_0x1b8ddb[_0x553a('0x193')],_0x553a('0xf2'))[_0x553a('0x77')](_0x553a('0xf3')),'ContactId':_0x21114a[_0x553a('0xf4')],'ListId':_0x21114a['ListId'],'VoiceQueueId':_0x21114a[_0x553a('0xfb')]||undefined,'CampaignId':_0x21114a[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x194')));break;default:return!![];}};Dialer['prototype'][_0x553a('0x187')]=function(_0x35ac5f,_0x3ad348,_0x3cc889){var _0x8bf3ef=this;var _0xe19ae9=new History(_0x35ac5f);return new BPromise(function(_0x48cbf7,_0x3ee1d0){if(_[_0x553a('0x3d')](_0x3ad348)&&typeof _0x3ad348!==_0x553a('0x15d')){return _0x3ee1d0(msgResponse(_0x553a('0x195'),_0x553a('0x13b'),_0x553a('0x196')));}if(_[_0x553a('0x3d')](_0x3cc889)&&typeof _0x3cc889!==_0x553a('0x15d')){return _0x3ee1d0(msgResponse(_0x553a('0x195'),_0x553a('0x13b'),_0x553a('0x197')));}switch(_0x3cc889['reason']){case'0':_0x3ad348[_0x553a('0x68')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0x0;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x198');_0xe19ae9[_0x553a('0xf8')]+=0x1;_0xe19ae9['countglobal']+=0x1;ami[_0x553a('0x4b')](_0x553a('0x199'),ut['buildObj'](_0x35ac5f,_0x553a('0x19a')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)['catch'](loggerCatch(_0x553a('0xe5')));if(_0x8bf3ef[_0x553a('0x19b')](0x0,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xf8')]>=_0x3ad348[_0x553a('0x18f')]){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x19c'));}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x19c'));}}break;case'3':_0x3ad348[_0x553a('0x67')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0x3;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x19d');_0xe19ae9[_0x553a('0xe8')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;ami[_0x553a('0x4b')](_0x553a('0x19e'),ut[_0x553a('0xf6')](_0x35ac5f,_0x553a('0x19f')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x8bf3ef[_0x553a('0x19b')](0x3,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe8')]>=_0x3ad348['dialNoAnswerMaxRetry']){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a0'));}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a0'));}}break;case'5':_0x3ad348[_0x553a('0x63')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0x5;_0xe19ae9[_0x553a('0xa6')]='Busy';_0xe19ae9[_0x553a('0xe6')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;ami[_0x553a('0x4b')](_0x553a('0x1a1'),ut[_0x553a('0xf6')](_0x35ac5f,_0x553a('0x1a2')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x8bf3ef[_0x553a('0x19b')](0x5,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe6')]>=_0x3ad348[_0x553a('0x18b')]){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,'reason\x205\x20busy');}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a3'));}}break;case'8':_0x3ad348['outboundCongestionCallsDay']+=0x1;_0xe19ae9['state']=0x8;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x1a4');_0xe19ae9[_0x553a('0xe7')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;ami['emit'](_0x553a('0x1a5'),ut['buildObj'](_0x35ac5f,'congestion'));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch(_0x553a('0x1a6')));if(_0x8bf3ef[_0x553a('0x19b')](0x8,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe7')]>=_0x3ad348['dialCongestionMaxRetry']){_0x8bf3ef['createStateFinal'](_0xe19ae9,_0x48cbf7,_0x3ee1d0,'reason\x208\x20congestion');}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a7'));}}break;case'11':_0x3ad348[_0x553a('0x1a8')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0xb;_0xe19ae9[_0x553a('0xa6')]=_0x553a('0x118');_0xe19ae9[_0x553a('0xea')]+=0x1;_0xe19ae9[_0x553a('0xe4')]+=0x1;_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x8bf3ef[_0x553a('0x19b')](0xb,_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xea')]>=_0x3ad348['dialAbandonedMaxRetry']){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a9'));}else{_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1a9'));}}break;case'20':_0x3ad348[_0x553a('0x6a')]+=0x1;_0xe19ae9['state']=0x14;_0xe19ae9[_0x553a('0xa6')]='AgentReject';_0xe19ae9[_0x553a('0xf9')]+=0x1;_0xe19ae9['countglobal']+=0x1;ami[_0x553a('0x4b')](_0x553a('0x1aa'),ut['buildObj'](_0x35ac5f,_0x553a('0x1ab')));_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch(_0x553a('0x1ac')));if(_0x8bf3ef[_0x553a('0x19b')](0x14,_0x35ac5f,_0x3ad348)){if(_0xe19ae9['countagentrejectretry']>=_0x3ad348[_0x553a('0x192')]){_0x8bf3ef[_0x553a('0xee')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1ad'));}else{_0x8bf3ef['stateGlobal'](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x553a('0x1ad'));}}break;default:_0x3ad348[_0x553a('0x6b')]+=0x1;_0xe19ae9[_0x553a('0xa5')]=0xc;_0xe19ae9[_0x553a('0xa6')]=_0x3cc889[_0x553a('0x1ae')];_0x8bf3ef[_0x553a('0xc5')](_0xe19ae9)[_0x553a('0xaf')](loggerCatch(_0x553a('0x1af')));if(_0x8bf3ef[_0x553a('0x19b')](_0x3cc889['reason'],_0x35ac5f,_0x3ad348)){if(_0xe19ae9[_0x553a('0xe6')]+_0xe19ae9['countcongestionretry']+_0xe19ae9[_0x553a('0xe8')]+_0xe19ae9[_0x553a('0xf8')]+_0xe19ae9[_0x553a('0xe9')]+_0xe19ae9['countabandonedretry']+_0xe19ae9[_0x553a('0xe3')]+_0xe19ae9[_0x553a('0xf9')]>=_0x3ad348['dialGlobalMaxRetry']){_0x8bf3ef[_0x553a('0xeb')](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x3cc889[_0x553a('0x1ae')]);}else{_0x8bf3ef['createStateFinal'](_0xe19ae9,_0x48cbf7,_0x3ee1d0,_0x3cc889[_0x553a('0x1ae')]);}}}});};Dialer[_0x553a('0xa8')][_0x553a('0xeb')]=function(_0x4a51dc,_0x58857b,_0x9a1ac,_0x4487e3){var _0x95c26=new Final(_0x4a51dc);_0x95c26[_0x553a('0xa5')]=0xf;_0x95c26['statedesc']=_0x553a('0x1b0');this[_0x553a('0xee')](_0x95c26,_0x58857b,_0x9a1ac,_0x4487e3);};Dialer['prototype'][_0x553a('0xee')]=function(_0x5bad1d,_0x524a18,_0x1b7123,_0x1d494b){this[_0x553a('0xc3')](_0x5bad1d)['then'](function(){return _0x524a18(msgResponse(_0x553a('0x195'),_0x553a('0x1b1'),_0x1d494b));})[_0x553a('0xaf')](function(){return _0x1b7123(msgResponse(_0x553a('0x1b2'),_0x553a('0x13b'),_0x553a('0x1b3')));});};Dialer['prototype'][_0x553a('0x150')]=function(_0x9905eb){var _0x261ebf=_0x9905eb['dialPredictiveOptimizationPercentage']/0x64;var _0x4f7315=_0x9905eb[_0x553a('0x10e')]/(_0x9905eb[_0x553a('0x10e')]+_0x9905eb[_0x553a('0x61')]);var _0x2beb36=Math[_0x553a('0x1b4')](_0x9905eb['predictiveIntervalAvailable']*(_0x9905eb[_0x553a('0x1b5')]/0x64));var _0x4d3841=Math[_0x553a('0x1b4')](_0x9905eb[_0x553a('0x1b6')]*(_0x9905eb[_0x553a('0x1b7')]/0x64));var _0x28e04f=_0x9905eb['available']+_0x9905eb[_0x553a('0x54')];var _0x28be60=Math[_0x553a('0x1b8')](_0x9905eb[_0x553a('0x87')]*_0x9905eb[_0x553a('0x8a')]*_0x9905eb[_0x553a('0x1b9')]*_0x9905eb['predictiveIntervalMultiplicativeFactor']);if(_[_0x553a('0x3d')](_0x9905eb[_0x553a('0x2a')])){if(!_[_0x553a('0x3d')](_0x9905eb[_0x553a('0x29')])){_0x9905eb[_0x553a('0x29')]=undefined;loggerPredictive[_0x553a('0x93')](_0x553a('0x1ba'),_0x553a('0x1bb'));}if(!_[_0x553a('0x3d')](_0x9905eb['handlePredictive'])){loggerPredictive[_0x553a('0x93')]('[startMethodPredictive][StartProgressive]',_0x553a('0x1bc'));clearInterval(_0x9905eb['handlePredictive']);_0x9905eb[_0x553a('0x8e')]=undefined;}_0x9905eb[_0x553a('0x2a')]=moment()[_0x553a('0x77')](_0x553a('0xf3'));loggerPredictive[_0x553a('0x7b')](_0x9905eb[_0x553a('0x3f')],_0x553a('0x1bd'),_0x9905eb[_0x553a('0x2a')]);this['handlePower'](_0x9905eb,0x1);}else if(ifInterval(_0x9905eb[_0x553a('0x1be')],_0x9905eb['startProgressive'])){this[_0x553a('0x14e')](_0x9905eb,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x9905eb[_0x553a('0x2a')],_0x9905eb[_0x553a('0x3f')]);_0x9905eb[_0x553a('0x87')]=0x0;_0x9905eb[_0x553a('0x71')]=0x0;}else if(_0x261ebf<_0x4f7315&&_0x9905eb['dialPredictiveOptimization']===_0x553a('0x1bf')){freeVariablesPredictive(_0x9905eb);loggerPredictive['info'](_0x553a('0x1c0'),_0x553a('0x1c1'),_0x4f7315,'startProgressive',_0x9905eb[_0x553a('0x3f')]);}else if(_0x28be60<_0x9905eb[_0x553a('0x71')]&&_0x9905eb[_0x553a('0x1c2')]===_0x553a('0x1bf')){freeVariablesPredictive(_0x9905eb);loggerPredictive[_0x553a('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x28be60,_0x553a('0x1c3'),_0x9905eb['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x9905eb['name']);}else if(!ifInterval(_0x9905eb[_0x553a('0x1be')],_0x9905eb[_0x553a('0x2a')])&&_[_0x553a('0x3d')](_0x9905eb['startPredictive'])&&!_['isUndefined'](_0x9905eb[_0x553a('0x2a')])){_0x9905eb['startPredictive']=moment()[_0x553a('0x77')](_0x553a('0xf3'));loggerPredictive[_0x553a('0x7b')](_0x9905eb['name'],_0x553a('0x1c4'),_0x9905eb[_0x553a('0x29')]);this[_0x553a('0x1c5')](_0x9905eb['dialPredictiveInterval'])[_0x553a('0xb5')](this[_0x553a('0x1c6')](_0x9905eb))[_0x553a('0xb5')](mergeDataErlangB(_0x9905eb))['then'](this[_0x553a('0x1c7')](_0x9905eb))[_0x553a('0xaf')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x9905eb));}else if(!ifInterval(_0x9905eb[_0x553a('0x1be')],_0x9905eb[_0x553a('0x29')])){_0x9905eb['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x9905eb[_0x553a('0x29')]=moment()['format'](_0x553a('0xf3'));loggerPredictive['info'](_0x9905eb[_0x553a('0x3f')],_0x553a('0x1c8'),_0x9905eb[_0x553a('0x29')]);clearInterval(_0x9905eb['handlePredictive']);_0x9905eb[_0x553a('0x8e')]=undefined;this[_0x553a('0x1c5')](_0x9905eb[_0x553a('0x1be')])[_0x553a('0xb5')](this['getDataPredictive'](_0x9905eb))[_0x553a('0xb5')](mergeDataErlangB(_0x9905eb))['then'](this[_0x553a('0x1c7')](_0x9905eb))[_0x553a('0xaf')](loggerCatchPredictive(_0x553a('0x1c9'),_0x9905eb));}else if(_0x9905eb[_0x553a('0x1b6')]&&_0x28e04f<_0x9905eb[_0x553a('0x1b6')]-_0x4d3841){freeVariablesPredictive(_0x9905eb);loggerPredictive[_0x553a('0x7b')](_0x9905eb[_0x553a('0x3f')],_0x553a('0x1ca'),_0x28e04f,')\x20are\x20less\x20than\x20threshold\x20(',_0x9905eb['predictiveIntervalAvailable'],'-',_0x4d3841,'=',_0x9905eb['predictiveIntervalAvailable']-_0x4d3841,')');}else if(_0x9905eb[_0x553a('0x1b6')]&&_0x28e04f>_0x9905eb[_0x553a('0x1b6')]+_0x2beb36){freeVariablesPredictive(_0x9905eb);loggerPredictive[_0x553a('0x7b')](_0x9905eb['name'],_0x553a('0x1ca'),_0x28e04f,_0x553a('0x1cb'),_0x9905eb['predictiveIntervalAvailable'],'+',_0x2beb36,'=',_0x9905eb[_0x553a('0x1b6')]+_0x2beb36,')');}};Dialer['prototype'][_0x553a('0x1c6')]=function(_0x2ff73e){var _0x4f5070=this;return function(_0x43fe3b){return new BPromise(function(_0xf76dc3,_0x3857ed){_[_0x553a('0xcb')](_0x2ff73e,_0x43fe3b[0x0]);if(checkGetDataPredictive(_0x43fe3b[0x0])){var _0x1e03af=_0x2ff73e[_0x553a('0x1b6')]=_0x2ff73e[_0x553a('0x54')]+_0x2ff73e[_0x553a('0x4f')];var _0x3b3292=_0x2ff73e[_0x553a('0x1be')]*0x3c;var _0x496fd9=_0x43fe3b[0x0][_0x553a('0x6e')]+_0x43fe3b[0x0]['predictiveIntervalAvgHoldtime'];var _0x51bd23=(_0x43fe3b[0x0][_0x553a('0x6c')]+_0x43fe3b[0x0][_0x553a('0x6f')]+_0x43fe3b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x43fe3b[0x0][_0x553a('0x82')];_0x2ff73e[_0x553a('0x1b9')]=_0x51bd23>0x0?_0x51bd23:0x1;switch(_0x2ff73e[_0x553a('0x1c2')]){case _0x553a('0x1bf'):var _0x530663=_0x2ff73e[_0x553a('0x1cc')]/0x64;return _0x4f5070[_0x553a('0x1cd')](_0x1e03af,_0x3b3292,_0x496fd9,_0x51bd23,_0x530663)['then'](function(_0x126692){return _0xf76dc3(_0x126692);});case _0x553a('0x1ce'):var _0x316c93=_0x2ff73e['dialPredictiveOptimizationPercentage']/0x64;return _0x4f5070['busyFactor'](_0x1e03af,_0x3b3292,_0x496fd9,_0x51bd23,_0x316c93)[_0x553a('0xb5')](function(_0x2a3fc7){return _0xf76dc3(_0x2a3fc7);});default:return _0x3857ed(msgResponse(_0x553a('0x1cf'),_0x553a('0x13b'),_0x553a('0x1d0')));}}else{return _0x3857ed(msgResponse(_0x553a('0x1cf'),_0x553a('0x13b'),'check\x20failure'));}});};};Dialer['prototype'][_0x553a('0x1d1')]=function(_0xbc03a){var _0x50a472=this;return function(_0x498b30){return new BPromise(function(_0x339025,_0x516d15){_[_0x553a('0xcb')](_0xbc03a,_0x498b30[0x0]);if(checkGetDataPredictive(_0x498b30[0x0])){loggerPredictive[_0x553a('0x7b')](JSON[_0x553a('0x48')](_0x498b30[0x0]));if(_0xbc03a[_0x553a('0x1c2')]===_0x553a('0x1bf')){return _0x50a472[_0x553a('0xc2')](_0xbc03a['id'])['then'](function(_0x3e0326){var _0x271469=_0xbc03a[_0x553a('0x50')]-_0x3e0326[0x0]['outboundQueuePauses'];var _0x5a6d8c=_0xbc03a[_0x553a('0x1be')]*0x3c;var _0x100bf1=_0x498b30[0x0]['predictiveIntervalAvgTalktime']+_0x498b30[0x0][_0x553a('0x6d')];var _0x358632=(_0x498b30[0x0][_0x553a('0x6c')]+_0x498b30[0x0][_0x553a('0x6f')]+_0x498b30[0x0][_0x553a('0x7f')])/_0x498b30[0x0][_0x553a('0x82')];var _0x378822=_0xbc03a[_0x553a('0x1cc')]/0x64;_0xbc03a[_0x553a('0x1d2')]=_0x3e0326[0x0][_0x553a('0x1d3')]||0x0;_0xbc03a[_0x553a('0x1b9')]=_0x358632>0x0?_0x358632:0x1;return _0x50a472[_0x553a('0x1cd')](_0x271469,_0x5a6d8c,_0x100bf1,_0x358632,_0x378822);})['then'](function(_0x3fd278){return _0x339025(_0x3fd278);})[_0x553a('0xaf')](function(_0x5ee124){return _0x516d15(msgResponse(_0x553a('0x1d4'),_0x553a('0x13b'),JSON['stringify'](_0x5ee124)));});}if(_0xbc03a[_0x553a('0x1c2')]===_0x553a('0x1ce')){return _0x50a472[_0x553a('0xc2')](_0xbc03a['id'])[_0x553a('0xb5')](function(_0x1140c1){var _0x8d0b42=_0xbc03a[_0x553a('0x50')]-_0x1140c1[0x0][_0x553a('0x1d3')];var _0x2e7ff5=_0xbc03a[_0x553a('0x1be')]*0x3c;var _0x351844=_0x498b30[0x0][_0x553a('0x6e')]+_0x498b30[0x0]['predictiveIntervalAvgHoldtime'];var _0x1206da=(_0x498b30[0x0][_0x553a('0x6c')]+_0x498b30[0x0][_0x553a('0x6f')]+_0x498b30[0x0][_0x553a('0x7f')])/_0x498b30[0x0][_0x553a('0x82')];var _0x15eb58=_0xbc03a[_0x553a('0x1cc')]/0x64;_0xbc03a['predictiveIntervalPauses']=_0x1140c1[0x0]['outboundQueuePauses']||0x0;_0xbc03a['predictiveIntervalHitRate']=_0x1206da>0x0?_0x1206da:0x1;return _0x50a472[_0x553a('0x1d5')](_0x8d0b42,_0x2e7ff5,_0x351844,_0x1206da,_0x15eb58);})['then'](function(_0x27245e){return _0x339025(_0x27245e);})[_0x553a('0xaf')](function(_0x1ae1ce){return _0x516d15(msgResponse(_0x553a('0x1d4'),_0x553a('0x13b'),JSON[_0x553a('0x48')](_0x1ae1ce)));});}}else{return _0x516d15(msgResponse(_0x553a('0x1cf'),_0x553a('0x13b'),'check\x20failure'));}});};};Dialer[_0x553a('0xa8')][_0x553a('0x1c7')]=function(_0x1a26be){var _0x208ef2=this;return function(){var _0x33787c=0x0;var _0x17adc4=Math[_0x553a('0x1b8')](_0x1a26be[_0x553a('0x72')]*0x3e8);if(_0x17adc4>0x0){_0x17adc4=_0x17adc4<0x64?0x64:_0x17adc4;loggerPredictive[_0x553a('0x7b')](_0x1a26be['name'],_0x553a('0x1d6'),_0x17adc4,_0x553a('0x49'));_0x1a26be[_0x553a('0x8e')]=setInterval(function(){_0x208ef2[_0x553a('0x8e')](_0x1a26be);loggerPredictiveCalls[_0x553a('0x7b')]('[handlePredictive]',_0x33787c+=0x1);},_0x17adc4);}else{loggerPredictive[_0x553a('0x7b')](_0x1a26be['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x553a('0xa8')]['checkContactBlack']=function(_0x1aadd4,_0x2c5f5e){var _0x47d228=this;return function(_0x55e9e0){if(_[_0x553a('0x44')](_0x55e9e0)){if(_['isNil'](_0x2c5f5e[_0x553a('0x1d7')])||!_0x2c5f5e[_0x553a('0x1d8')]){if(_0x1aadd4['dialMethod']===_0x553a('0x9')){_0x1aadd4['queueStatusComplete']=_[_0x553a('0x3d')](_0x1aadd4[_0x553a('0x124')])?!![]:_0x1aadd4[_0x553a('0x124')];var _0x1757ce=uuid['v4']();_0x47d228[_0x553a('0x26')][_0x1757ce]=new Action(_0x1aadd4,_0x2c5f5e,_0x1757ce);loggerBooked[_0x553a('0x7b')]('[booked][checkContactBlack]',_0x1757ce,_0x553a('0x1d9'),JSON['stringify'](_0x1aadd4[_0x553a('0x124')]),_0x553a('0x1da'),_0x1aadd4[_0x553a('0x3f')]);if(_0x1aadd4[_0x553a('0x124')]){_0x1aadd4[_0x553a('0x124')]=![];_0x47d228[_0x553a('0x2c')][_0x47d228['actions'][_0x1757ce][_0x553a('0xb3')]]=[];ami['Action']({'actionid':_0x1757ce,'action':_0x553a('0x1db'),'queue':_0x1aadd4[_0x553a('0x3f')]})[_0x553a('0xaf')](function(){_0x47d228[_0x553a('0xb1')](_0x1aadd4);_0x47d228[_0x553a('0xbb')]({'active':![],'ContactId':_0x47d228[_0x553a('0x26')][_0x1757ce]['ContactId'],'ListId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xf5')],'VoiceQueueId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xfb')]||undefined,'CampaignId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x47d228[_0x553a('0x26')][_0x1757ce];});}else{loggerBooked[_0x553a('0x7b')](_0x553a('0x1dc'),JSON[_0x553a('0x48')](_0x1aadd4[_0x553a('0x124')]),_0x553a('0x1da'),_0x1aadd4[_0x553a('0x3f')]);_0x47d228[_0x553a('0xb1')](_0x1aadd4);_0x47d228[_0x553a('0xbb')]({'active':![],'ContactId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xf4')],'ListId':_0x47d228[_0x553a('0x26')][_0x1757ce][_0x553a('0xf5')],'VoiceQueueId':_0x47d228['actions'][_0x1757ce][_0x553a('0xfb')]||undefined,'CampaignId':_0x47d228[_0x553a('0x26')][_0x1757ce]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x47d228[_0x553a('0x26')][_0x1757ce];}}else{return _0x47d228[_0x553a('0x15c')](_0x1aadd4,_0x2c5f5e);}}else{if(getDiff(_0x2c5f5e['scheduledat'])<_0x1aadd4[_0x553a('0x1dd')]*0x3c){if(_0x2c5f5e[_0x553a('0x1de')]&&!_0x2c5f5e['Agent'][_0x553a('0x1df')]){_0x47d228[_0x553a('0x20')][_0x553a('0x12d')](_0x2c5f5e['id'])[_0x553a('0x1e')](function(){_0x47d228[_0x553a('0xb1')](_0x1aadd4);});}else{_0x47d228[_0x553a('0xbd')]({'active':![]},_0x2c5f5e['id'],0x1)[_0x553a('0x1e')](function(){_0x47d228['updateOriginated'](_0x1aadd4);});}}else{_0x1aadd4[_0x553a('0x1e0')]+=0x1;_0x47d228[_0x553a('0xb1')](_0x1aadd4);if(_0x1aadd4['dialRecallInQueue']){_0x47d228['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c5f5e['ContactId'],'ListId':_0x2c5f5e['ListId'],'VoiceQueueId':_0x2c5f5e['VoiceQueueId']||undefined,'CampaignId':_0x2c5f5e[_0x553a('0xcd')]||undefined})[_0x553a('0xaf')](loggerCatch(_0x553a('0x1e1')));_0x47d228[_0x553a('0xc5')](createObjHistory(_0x1aadd4,_0x2c5f5e,'RECALLINQUEUE',0x17,'RecallInQueue'))['catch'](loggerCatch(_0x553a('0x1e2')));}else{_0x47d228[_0x553a('0xd3')](createObjHistory(_0x1aadd4,_0x2c5f5e,_0x553a('0x1e3'),0x16,_0x553a('0x1e4')),_0x553a('0x1e5'),_0x553a('0x1e6'));}}}}else{_0x1aadd4[_0x553a('0x62')]+=0x1;_0x47d228[_0x553a('0xd3')](createObjHistory(_0x1aadd4,_0x2c5f5e,_0x553a('0x1e7'),0xd,_0x553a('0x1e8')),'[Originate][historyBlacklist]',_0x553a('0x1e9'));throw'inBlackList';}};};Dialer[_0x553a('0xa8')][_0x553a('0x153')]=function(_0x18f389){var _0x5c7618=this;var _0x5a3126=_0x18f389[_0x553a('0x1ea')]-_0x18f389[_0x553a('0x98')]-_0x18f389[_0x553a('0x1eb')];emitCampaignSummary(_0x18f389);if(_0x5a3126>0x0){if(_0x5a3126>this[_0x553a('0x25')]){_0x5a3126=this[_0x553a('0x25')];}_0x18f389[_0x553a('0x1eb')]+=_0x5a3126;this[_0x553a('0xc1')](_0x18f389['id'],_0x5a3126,_0x18f389[_0x553a('0x1ec')])[_0x553a('0xb5')](function(_0x4c6d14){_0x18f389['temp']-=_0x5a3126;_0x18f389[_0x553a('0x1eb')]=_0x18f389['temp']>0x0?_0x18f389[_0x553a('0x1eb')]:0x0;if(!checkContactEmpty(_0x4c6d14)){_0x18f389['message']=_0x553a('0x9d');logger[_0x553a('0x7b')](_0x553a('0x1ed')+_0x18f389[_0x553a('0x3f')]);}else{_0x18f389[_0x553a('0x98')]+=_0x4c6d14[_0x553a('0x96')];_0x18f389[_0x553a('0x3e')]=_0x553a('0x1ee');for(var _0x5739ed=0x0;_0x5739ed<_0x4c6d14[_0x553a('0x96')];_0x5739ed+=0x1){_0x18f389[_0x553a('0x1ef')]+=0x1;if(_[_0x553a('0xab')](_0x4c6d14[_0x5739ed])||_['isNil'](_0x4c6d14[_0x5739ed][_0x553a('0x160')])||_[_0x553a('0xab')](_0x4c6d14[_0x5739ed][_0x553a('0x160')][_0x553a('0x15f')])){_0x5c7618[_0x553a('0xc9')](_0x553a('0x1f0'),_0x18f389,_0x4c6d14[_0x5739ed]);}else{_0x5c7618['checkIsBlackListIvr'](_[_0x553a('0xcc')](_0x4c6d14[_0x5739ed],[_0x553a('0xcd'),_0x553a('0x1f1')]))[_0x553a('0xb5')](_0x5c7618['checkContactBlack'](_0x18f389,_0x4c6d14[_0x5739ed]))['catch'](_0x5c7618[_0x553a('0xc8')](_0x553a('0x1f2'),_0x18f389));}}}})[_0x553a('0xaf')](loggerGetContactDialer(_0x553a('0x1f3'),_0x18f389,_0x5a3126));}};Dialer[_0x553a('0xa8')]['handlePower']=function(_0xf3f33e,_0x5a76ab){var _0x2e34cb=this;var _0x3be34e=[];var _0x3b2edb=_0x5a76ab>=0x1?_0x5a76ab:0x1;if(_0xf3f33e[_0x553a('0x5c')]===_0x553a('0x9')){_0x3b2edb=0x1;}var _0x4efdc=Math[_0x553a('0x1b8')](_0xf3f33e[_0x553a('0x4f')]*_0x3b2edb)-_0xf3f33e[_0x553a('0x98')]-_0xf3f33e['temp'];emitVoiceQueueSummary(_0xf3f33e);if(_0xf3f33e[_0x553a('0x1f4')]>0x0){var _0x3a348c=_0xf3f33e[_0x553a('0x1f4')]-_0xf3f33e[_0x553a('0x98')]-_0xf3f33e[_0x553a('0x54')]-_0xf3f33e[_0x553a('0x1eb')]-_0xf3f33e[_0x553a('0x51')];if(_0x4efdc>_0x3a348c){_0x4efdc=_0x3a348c;}}if(_0x4efdc>0x0){if(_0xf3f33e[_0x553a('0x5c')]===_0x553a('0x9')){_0x4efdc=0x1;}if(_0x4efdc>this[_0x553a('0x25')]){_0x4efdc=this['maxNumberOriginate'];}_0xf3f33e[_0x553a('0x1eb')]+=_0x4efdc;for(var _0x2a8173 in this['agents']){if(typeof this[_0x553a('0x23')][_0x2a8173]!==_0x553a('0x97')){if(this['agents'][_0x2a8173]['state']==='not_inuse'&&this[_0x553a('0x23')][_0x2a8173][_0x553a('0xad')]===_0x553a('0xd1')){_0x3be34e[_0x553a('0x122')](this[_0x553a('0x23')][_0x2a8173]['id']);}}}this[_0x553a('0xbf')](_0xf3f33e['id'],_0x3be34e,_0x4efdc,_0xf3f33e[_0x553a('0x1ec')])['then'](function(_0x1126d7){_0xf3f33e['temp']-=_0x4efdc;_0xf3f33e[_0x553a('0x1eb')]=_0xf3f33e[_0x553a('0x1eb')]>0x0?_0xf3f33e[_0x553a('0x1eb')]:0x0;if(!checkContactEmpty(_0x1126d7)){_0x2e34cb['countReScheduled'](_0xf3f33e)[_0x553a('0xb5')](sendMessageReschedule(_0xf3f33e))[_0x553a('0xaf')](loggerCatch(_0x553a('0x1f5')));}else{_0xf3f33e['originated']+=_0x1126d7[_0x553a('0x96')];_0xf3f33e[_0x553a('0x3e')]=_0xf3f33e[_0x553a('0x5c')]===_0x553a('0x9')?_0x553a('0x1f6'):_0x553a('0x1ee');for(var _0x342497=0x0;_0x342497<_0x1126d7['length'];_0x342497+=0x1){if(_['isNil'](_0x1126d7[_0x342497])||_[_0x553a('0xab')](_0x1126d7[_0x342497][_0x553a('0x160')])||_['isNil'](_0x1126d7[_0x342497][_0x553a('0x160')][_0x553a('0x15f')])){_0x2e34cb['emptyContact']('[actionOriginate]\x20',_0xf3f33e,_0x1126d7[_0x342497]);}else{_0x2e34cb[_0x553a('0x1f7')](_['pick'](_0x1126d7[_0x342497],[_0x553a('0xfb'),'Contact.phone']))[_0x553a('0xb5')](_0x2e34cb[_0x553a('0x1f8')](_0xf3f33e,_0x1126d7[_0x342497]))[_0x553a('0xaf')](_0x2e34cb['loggerHandler'](_0x553a('0x1f0'),_0xf3f33e));}}}})[_0x553a('0xaf')](loggerGetContactDialer(_0x553a('0x1f9'),_0xf3f33e,_0x4efdc));}};Dialer['prototype'][_0x553a('0x8e')]=function(_0xfc4ded){if(_0xfc4ded[_0x553a('0x1f4')]>0x0){var _0x249308=_0xfc4ded[_0x553a('0x1f4')]-_0xfc4ded[_0x553a('0x98')]-_0xfc4ded[_0x553a('0x54')];if(_0x249308>0x0){this[_0x553a('0x1fa')](_0xfc4ded);}else{loggerPredictiveCalls[_0x553a('0x7b')](_0x553a('0x1fb'));}}else{this[_0x553a('0x1fa')](_0xfc4ded);}};Dialer[_0x553a('0xa8')]['tryOriginatePredictive']=function(_0x5dd068){var _0x5e00a9=this;var _0x4199c0=[];_0x5dd068['originated']+=0x1;for(var _0x4c0e24 in this[_0x553a('0x23')]){if(typeof this[_0x553a('0x23')][_0x4c0e24]!==_0x553a('0x97')){if(this[_0x553a('0x23')][_0x4c0e24][_0x553a('0xa5')]==='not_inuse'&&this[_0x553a('0x23')][_0x4c0e24][_0x553a('0xad')]===_0x553a('0xd1')){_0x4199c0[_0x553a('0x122')](this[_0x553a('0x23')][_0x4c0e24]['id']);}}}this[_0x553a('0xbf')](_0x5dd068['id'],_0x4199c0,0x1,_0x5dd068['dialOrderByScheduledAt'])[_0x553a('0xb5')](function(_0x41e720){if(!checkContactEmpty(_0x41e720)){checkContactLowerLimitOriginate(_0x5dd068,0x1,0x0);_0x5e00a9[_0x553a('0xb6')](_0x5dd068)[_0x553a('0xb5')](sendMessageReschedule(_0x5dd068))[_0x553a('0xaf')](loggerCatch(_0x553a('0x1f5')));}else{_0x5dd068[_0x553a('0x3e')]=_0x553a('0x1ee');if(_['isNil'](_0x41e720[0x0])||_['isNil'](_0x41e720[0x0][_0x553a('0x160')])||_[_0x553a('0xab')](_0x41e720[0x0][_0x553a('0x160')][_0x553a('0x15f')])){_0x5e00a9[_0x553a('0xc9')](_0x553a('0x1f0'),_0x5dd068,_0x41e720[0x0]);}else{_0x5e00a9[_0x553a('0x1f7')](_[_0x553a('0xcc')](_0x41e720[0x0],[_0x553a('0xfb'),_0x553a('0x1f1')]))[_0x553a('0xb5')](_0x5e00a9['checkContactBlack'](_0x5dd068,_0x41e720[0x0]))[_0x553a('0xaf')](_0x5e00a9[_0x553a('0xc8')](_0x553a('0x1fc'),_0x5dd068));}}})[_0x553a('0xaf')](loggerGetContactDialer(_0x553a('0x1fd'),_0x5dd068,0x1));emitVoiceQueueSummary(_0x5dd068);};Dialer[_0x553a('0xa8')]['abandonmentRate']=function(_0x25f724,_0x34f4ef,_0x53b946,_0x106aa9,_0x5d77af,_0x175776){loggerPredictive[_0x553a('0x7b')](_0x553a('0x1fe'));loggerPredictive[_0x553a('0x7b')](_0x553a('0x1ff'),_0x25f724);loggerPredictive[_0x553a('0x7b')](_0x553a('0x200'),_0x34f4ef);loggerPredictive[_0x553a('0x7b')](_0x553a('0x201'),_0x53b946);loggerPredictive[_0x553a('0x7b')](_0x553a('0x202'),_0x106aa9);loggerPredictive['info'](_0x553a('0x203'),_0x5d77af);loggerPredictive[_0x553a('0x7b')](_0x553a('0x81'));return new BPromise(function(_0x9df0,_0x4dc53a){if(_0x25f724<=0x0||isNaN(_0x25f724)){return _0x4dc53a(msgResponse(_0x553a('0x204'),'Error',_0x553a('0x205')+_0x25f724));}if(_0x53b946<=0x0||isNaN(_0x53b946)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),'Ts\x20=\x20'+_0x53b946));}if(_0x106aa9<=0x0||isNaN(_0x106aa9)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),_0x553a('0x206')+_0x106aa9));}if(_0x34f4ef<=0x0||isNaN(_0x34f4ef)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),_0x553a('0x207')+_0x34f4ef));}if(_0x5d77af<=0x0||isNaN(_0x5d77af)){return _0x4dc53a(msgResponse(_0x553a('0x204'),_0x553a('0x47'),'Amax\x20=\x20'+_0x5d77af));}_0x175776=_0x175776||0x0;var _0x5c4387=0x1/_0x53b946;var _0x13c88a=0x0;var _0x1ed75a=0x0;var _0xf0b116=0x0;var _0x382df5=0x0;for(var _0x5be3f5=0x0;_0xf0b116<_0x5d77af;_0x5be3f5+=0x1){_0x1ed75a=_0x5be3f5/_0x34f4ef;_0x13c88a=(_0x106aa9*_0x1ed75a+_0x175776)/_0x5c4387;_0xf0b116=erlangb(_0x13c88a,_0x25f724);_0x382df5=_0x13c88a/_0x25f724*(0x1-erlangb(_0x13c88a,_0x25f724));}return _0x9df0({'erlangCalls':_0x5be3f5,'erlangCallToSecond':_0x34f4ef/_0x5be3f5,'erlangAbandonmentRate':_0xf0b116,'erlangBusyFactor':_0x382df5});});};Dialer[_0x553a('0xa8')][_0x553a('0x1d5')]=function(_0x69d2c6,_0x2d5860,_0x245c89,_0x3e36b4,_0x208e4f,_0x56f334){loggerPredictive[_0x553a('0x7b')](_0x553a('0x208'));loggerPredictive[_0x553a('0x7b')](_0x553a('0x1ff'),_0x69d2c6);loggerPredictive['info'](_0x553a('0x200'),_0x2d5860);loggerPredictive[_0x553a('0x7b')](_0x553a('0x201'),_0x245c89);loggerPredictive[_0x553a('0x7b')](_0x553a('0x202'),_0x3e36b4);loggerPredictive[_0x553a('0x7b')](_0x553a('0x209'),_0x208e4f);loggerPredictive['info'](_0x553a('0x81'));return new BPromise(function(_0x1557e,_0x1392e9){if(_0x69d2c6<=0x0||isNaN(_0x69d2c6)){return _0x1392e9(msgResponse(_0x553a('0x20a'),'Error',_0x553a('0x205')+_0x69d2c6));}if(_0x245c89<=0x0||isNaN(_0x245c89)){return _0x1392e9(msgResponse(_0x553a('0x20a'),'Error','Ts\x20=\x20'+_0x245c89));}if(_0x3e36b4<=0x0||isNaN(_0x3e36b4)){return _0x1392e9(msgResponse(_0x553a('0x20a'),_0x553a('0x47'),_0x553a('0x206')+_0x3e36b4));}if(_0x2d5860<=0x0||isNaN(_0x2d5860)){return _0x1392e9(msgResponse('[busyFactor]',_0x553a('0x47'),_0x553a('0x207')+_0x2d5860));}if(_0x208e4f<=0x0||isNaN(_0x208e4f)){return _0x1392e9(msgResponse('[busyFactor]',_0x553a('0x47'),'Umin\x20=\x20'+_0x208e4f));}_0x56f334=_0x56f334||0x0;var _0x7bb974=0x1/_0x245c89;var _0x2a3fd1=0x0;var _0x39a8e4=0x0;var _0x1050f9=0x0;var _0x32b350=0x0;for(var _0x5333ca=0x0;_0x32b350<_0x208e4f;_0x5333ca+=0x1){_0x39a8e4=_0x5333ca/_0x2d5860;_0x2a3fd1=(_0x3e36b4*_0x39a8e4+_0x56f334)/_0x7bb974;_0x1050f9=erlangb(_0x2a3fd1,_0x69d2c6);_0x32b350=_0x2a3fd1/_0x69d2c6*(0x1-erlangb(_0x2a3fd1,_0x69d2c6));}return _0x1557e({'erlangCalls':_0x5333ca,'erlangCallToSecond':_0x2d5860/_0x5333ca,'erlangAbandonmentRate':_0x1050f9,'erlangBusyFactor':_0x32b350});});};module[_0x553a('0x20b')]=Dialer; \ No newline at end of file +var _0xa763=['[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAbandonedMaxRetry','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','available','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopperBlack','./history','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','loggedIn','pTalking','sumBillable','talking','total','unmanaged','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','isEmpty','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','loopClearZombieChannels','clearZombieChannels','[uniqueid]','isNil','Action','status','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','variable','xcally-motion-dialer','value','HANGUP','uniqueid','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','ContactId','[rescheduleContact][Machine]','custom:amd','[syncHangupInAMDIvr]','countglobal','stateGlobal','rescheduleContact','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropMaxRetry','add','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','syncQueueMember','strategy','actionid','locked','paused','stateinterface','rrmemory','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','method\x20not\x20recognized','handleIvr','dialTimezone','[syncQueueSummary]','dialGlobalInterval','\x5cw{0,','pow','replace','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','dialer','getCaller','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError'];(function(_0x5bb258,_0x530cef){var _0x73ded0=function(_0x4a2451){while(--_0x4a2451){_0x5bb258['push'](_0x5bb258['shift']());}};_0x73ded0(++_0x530cef);}(_0xa763,0x8c));var _0x3a76=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xa763[_0x3e25c1];return _0x52e7f2;};'use strict';var util=require(_0x3a76('0x0'));var _=require(_0x3a76('0x1'));var BPromise=require(_0x3a76('0x2'));var uuid=require('uuid');var moment=require(_0x3a76('0x3'));var rr=require('rr');var md5=require(_0x3a76('0x4'));var Redis=require(_0x3a76('0x5'));var ut=require(_0x3a76('0x6'));var config=require('../../../config/environment/');var logger=require(_0x3a76('0x7'))('dialer');var loggerBooked=require(_0x3a76('0x7'))(_0x3a76('0x8'));var loggerPredictive=require(_0x3a76('0x7'))(_0x3a76('0x9'));var loggerPredictiveCalls=require(_0x3a76('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x3a76('0x7'))(_0x3a76('0xa'));var ami=require(_0x3a76('0xb'));config[_0x3a76('0xc')]=_['defaults'](config[_0x3a76('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x3a76('0xd'))(new Redis(config[_0x3a76('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x3a76('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x3a76('0xf'));var Final=require('./final');var AgentComplete=require(_0x3a76('0x10'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x3a76('0x11'));var ipAgi=process[_0x3a76('0x12')][_0x3a76('0x13')]||_0x3a76('0x14');var strategy={'rrmemory':'rrmemory','roundrobin':_0x3a76('0x15')};var Sequence=function(){};Sequence['prototype'][_0x3a76('0x16')]=function(_0x180c04){this[_0x3a76('0x17')]=this[_0x3a76('0x17')]?this[_0x3a76('0x17')][_0x3a76('0x18')](_0x180c04):_0x180c04();};function Dialer(_0x1a7948,_0x250b01){this[_0x3a76('0x19')]=new Sequence();this['preview']=_0x250b01;this['voiceQueues']=_0x1a7948[_0x3a76('0x1a')];this['campaigns']=_0x1a7948[_0x3a76('0x1b')];this[_0x3a76('0x1c')]=_0x1a7948[_0x3a76('0x1c')];this[_0x3a76('0x1d')]=_0x1a7948['trunks'];this[_0x3a76('0x1e')]=config[_0x3a76('0x1e')]||0x2;this[_0x3a76('0x1f')]={};this[_0x3a76('0x20')]={};this['contactsId']={};this[_0x3a76('0x21')]={};this[_0x3a76('0x22')]={};this[_0x3a76('0x23')]={};this[_0x3a76('0x24')]={};this[_0x3a76('0x25')]={};this[_0x3a76('0x26')]={};this[_0x3a76('0x27')]={};ami['on'](_0x3a76('0x28'),this[_0x3a76('0x29')][_0x3a76('0x2a')](this));ami['on'](_0x3a76('0x2b'),this['syncQueueCallerAbandon'][_0x3a76('0x2a')](this));ami['on'](_0x3a76('0x2c'),this[_0x3a76('0x2d')]['bind'](this));ami['on'](_0x3a76('0x2e'),this[_0x3a76('0x2f')][_0x3a76('0x2a')](this));ami['on']('custom:queuesummary',this[_0x3a76('0xa')][_0x3a76('0x2a')](this));ami['on'](_0x3a76('0x30'),this[_0x3a76('0x31')]['bind'](this));ami['on'](_0x3a76('0x32'),this['syncNewExten'][_0x3a76('0x2a')](this));ami['on'](_0x3a76('0x33'),this[_0x3a76('0x34')]['bind'](this));ami['on'](_0x3a76('0x35'),this['syncQueueMember'][_0x3a76('0x2a')](this));ami['on'](_0x3a76('0x36'),this[_0x3a76('0x37')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x555ba9){return _0x555ba9!==null&&!_[_0x3a76('0x38')](_0x555ba9);}function checkIsLoggedIn(_0xd6e9b2,_0x5d756f){return function(){if(_0x5d756f<=0x0){_0xd6e9b2['message']=_0x3a76('0x39');throw _0xd6e9b2[_0x3a76('0x3a')]+_0x3a76('0x3b');}};}function isActive(_0x25de04){return _0x25de04;}function checkIsActive(_0x1e94a4,_0x35f1d5){return function(){if(!isActive(_0x35f1d5)){_0x1e94a4[_0x3a76('0x3c')]='NOT_ACTIVE';throw _0x1e94a4[_0x3a76('0x3a')]+_0x3a76('0x3d');}};}function checkInterval(_0x25afdb){return function(){if(!isNotNull(_0x25afdb[_0x3a76('0x3e')])){_0x25afdb[_0x3a76('0x3c')]=_0x3a76('0x3f');throw _0x25afdb['name']+_0x3a76('0x40');}if(!isNotNull(_0x25afdb[_0x3a76('0x3e')][_0x3a76('0x41')])){_0x25afdb['message']='INTERVAL_IS_NULL';throw _0x25afdb[_0x3a76('0x3a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x25afdb['Interval'][_0x3a76('0x41')]))){_0x25afdb[_0x3a76('0x3c')]=_0x3a76('0x3f');throw _0x25afdb[_0x3a76('0x3a')]+_0x3a76('0x40');}};}function msgResponse(_0x101937,_0x3bfb0a,_0x123a2d){return{'action':_0x101937,'response':_0x3bfb0a,'message':_0x123a2d,'stack':_0x123a2d};}function myreject(_0x5af996){return function(_0x141bf5){return _0x5af996(msgResponse(_0x3a76('0x42'),_0x3a76('0x43'),JSON[_0x3a76('0x44')](_0x141bf5)));};}function getSeconds(_0x429afc,_0x4ed79b){var _0x59dcd2=moment(_0x429afc)['milliseconds'](0x0);var _0x3c5e97=moment(_0x4ed79b)[_0x3a76('0x45')](0x0);return _0x59dcd2[_0x3a76('0x46')](_0x3c5e97,_0x3a76('0x47'));}function emit(_0x82781a,_0x822929,_0x3f869b){io['to'](_0x82781a)[_0x3a76('0x48')](_0x822929,_0x3f869b);}function emitVoiceQueueSummary(_0x91b4ae){if(_0x91b4ae[_0x3a76('0x49')]===_0x3a76('0x4a')){var _0xdc79a6={'id':_0x91b4ae['id'],'name':_0x91b4ae[_0x3a76('0x3a')],'strategy':_0x91b4ae['strategy'],'answered':_0x91b4ae[_0x3a76('0x4b')],'available':_0x91b4ae['available'],'loggedIn':_0x91b4ae[_0x3a76('0x4c')],'pTalking':_0x91b4ae[_0x3a76('0x4d')],'sumBillable':_0x91b4ae[_0x3a76('0x4e')],'sumDuration':_0x91b4ae['sumDuration'],'sumHoldTime':_0x91b4ae['sumHoldTime']||0x0,'talking':_0x91b4ae[_0x3a76('0x4f')],'total':_0x91b4ae[_0x3a76('0x50')],'type':_0x91b4ae[_0x3a76('0x49')],'unmanaged':_0x91b4ae[_0x3a76('0x51')],'abandoned':_0x91b4ae['abandoned'],'waiting':_0x91b4ae['waiting'],'loggedInDb':_0x91b4ae[_0x3a76('0x52')],'dialActive':_0x91b4ae[_0x3a76('0x53')],'dialMethod':_0x91b4ae['dialMethod'],'dialOriginateCallerIdName':_0x91b4ae[_0x3a76('0x54')],'dialOriginateCallerIdNumber':_0x91b4ae[_0x3a76('0x55')],'dialOriginateTimeout':_0x91b4ae[_0x3a76('0x56')],'dialPrefix':_0x91b4ae[_0x3a76('0x57')],'outboundAnswerAgiCallsDay':_0x91b4ae[_0x3a76('0x58')],'outboundAnswerCallsDay':_0x91b4ae[_0x3a76('0x59')],'outboundBlacklistCallsDay':_0x91b4ae[_0x3a76('0x5a')],'outboundBusyCallsDay':_0x91b4ae['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x91b4ae[_0x3a76('0x5b')],'outboundDropCallsDayACS':_0x91b4ae[_0x3a76('0x5c')],'outboundDropCallsDayCallersExit':_0x91b4ae[_0x3a76('0x5d')],'outboundDropCallsDayTimeout':_0x91b4ae[_0x3a76('0x5e')],'outboundNoAnswerCallsDay':_0x91b4ae['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x91b4ae[_0x3a76('0x5f')],'outboundOriginateFailureCallsDay':_0x91b4ae['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x91b4ae[_0x3a76('0x60')],'outboundRejectCallsDay':_0x91b4ae[_0x3a76('0x61')],'outboundUnknownCallsDay':_0x91b4ae[_0x3a76('0x62')],'predictiveIntervalAnsweredCalls':_0x91b4ae['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x91b4ae['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x91b4ae[_0x3a76('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0x91b4ae[_0x3a76('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x91b4ae['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x91b4ae[_0x3a76('0x65')],'predictiveIntervalErlangCallsDroppedCalls':_0x91b4ae[_0x3a76('0x66')],'predictiveIntervalHitRate':_0x91b4ae[_0x3a76('0x67')],'predictiveIntervalMultiplicativeFactor':_0x91b4ae[_0x3a76('0x68')],'predictiveIntervalPauses':_0x91b4ae['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x91b4ae[_0x3a76('0x69')],'predictiveIntervalTotalCalls':_0x91b4ae[_0x3a76('0x6a')],'message':_0x91b4ae[_0x3a76('0x3c')],'originated':_0x91b4ae[_0x3a76('0x6b')],'erlangCalls':_0x91b4ae[_0x3a76('0x6c')],'erlangCallToSecond':_0x91b4ae[_0x3a76('0x6d')],'erlangAbandonmentRate':_0x91b4ae[_0x3a76('0x6e')],'erlangBusyFactor':_0x91b4ae[_0x3a76('0x6f')],'startPredictive':_0x91b4ae[_0x3a76('0x23')],'startProgressive':_0x91b4ae[_0x3a76('0x24')]};if(_0x91b4ae[_0x3a76('0x70')]){_0xdc79a6[_0x3a76('0x70')]={'id':_0x91b4ae['Trunk']['id'],'name':_0x91b4ae[_0x3a76('0x70')][_0x3a76('0x3a')],'active':_0x91b4ae[_0x3a76('0x70')][_0x3a76('0x71')],'callerid':_0x91b4ae[_0x3a76('0x70')][_0x3a76('0x72')]};}if(_0x91b4ae['Interval']){_0xdc79a6[_0x3a76('0x3e')]={'id':_0x91b4ae[_0x3a76('0x3e')]['id'],'name':_0x91b4ae[_0x3a76('0x3e')][_0x3a76('0x3a')]};}var _0x1f8e4e=md5(JSON[_0x3a76('0x44')](_0xdc79a6));if(_0x91b4ae[_0x3a76('0x4')]!==_0x1f8e4e){_0x91b4ae[_0x3a76('0x4')]=_0x1f8e4e;emit(util[_0x3a76('0x73')](_0x3a76('0x74'),_0xdc79a6['name']),_0x3a76('0x75'),_0xdc79a6);}}}function emitCampaignSummary(_0x35c6d8){if(_0x35c6d8[_0x3a76('0x49')]===_0x3a76('0x76')){emit(util['format'](_0x3a76('0x77'),_0x35c6d8[_0x3a76('0x3a')]),_0x3a76('0x78'),_0x35c6d8);}}function checkGetDataPredictive(_0x56e772){if(isNotNull(_0x56e772)&&!_['isEmpty'](_0x56e772)){loggerPredictive[_0x3a76('0x79')](_0x3a76('0x7a'));loggerPredictive[_0x3a76('0x79')](_0x3a76('0x7b'),_0x56e772[_0x3a76('0x6a')]);loggerPredictive[_0x3a76('0x79')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x56e772[_0x3a76('0x7c')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x56e772[_0x3a76('0x7d')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x56e772[_0x3a76('0x64')]);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x7e'),_0x56e772[_0x3a76('0x7f')]);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x80'),_0x56e772[_0x3a76('0x63')]);loggerPredictive['info'](_0x3a76('0x81'));if(_0x56e772[_0x3a76('0x6a')]>0x0){if(!_[_0x3a76('0x38')](_0x56e772['predictiveIntervalAvgTalktime'])&&_0x56e772[_0x3a76('0x63')]>0x0){return!![];}loggerPredictive[_0x3a76('0x79')](_0x3a76('0x82'));if(!_[_0x3a76('0x38')](_0x56e772[_0x3a76('0x7f')])&&_0x56e772[_0x3a76('0x7f')]>0x0){return!![];}loggerPredictive[_0x3a76('0x79')](_0x3a76('0x83'));}else{loggerPredictive[_0x3a76('0x79')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x3a76('0x79')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xcd9669){return function(_0xd8e374){loggerPredictive[_0x3a76('0x79')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3a76('0x79')](_0x3a76('0x84'),_0xd8e374[_0x3a76('0x6c')]);loggerPredictive['info'](_0x3a76('0x85'),_0xd8e374[_0x3a76('0x6d')]);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x86'),_0xd8e374[_0x3a76('0x6e')]);loggerPredictive[_0x3a76('0x79')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xd8e374[_0x3a76('0x6f')]);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x86'),_0xd8e374['erlangAbandonmentRate']);loggerPredictive['info']('---------------------------');_[_0x3a76('0x87')](_0xcd9669,_0xd8e374);};}function getDiff(_0x3db238){var _0x515eaa=moment()[_0x3a76('0x45')](0x0);var _0x3f4733=moment(_0x3db238)[_0x3a76('0x45')](0x0);return _0x515eaa['diff'](_0x3f4733,_0x3a76('0x47'));}function ifInterval(_0x37c5a6,_0x4ab37a){if(_['isUndefined'](_0x4ab37a)){return![];}return getDiff(_0x4ab37a)<_0x37c5a6*0x3c;}function freeVariablesPredictive(_0x281cf4){if(isNotNull(_0x281cf4)){if(!_['isUndefined'](_0x281cf4[_0x3a76('0x24')])){_0x281cf4[_0x3a76('0x24')]=undefined;loggerPredictive[_0x3a76('0x79')](_0x281cf4[_0x3a76('0x3a')],_0x3a76('0x88'));}if(!_[_0x3a76('0x38')](_0x281cf4[_0x3a76('0x23')])){_0x281cf4[_0x3a76('0x23')]=undefined;loggerPredictive[_0x3a76('0x79')](_0x281cf4[_0x3a76('0x3a')],_0x3a76('0x89'));}if(!_[_0x3a76('0x38')](_0x281cf4[_0x3a76('0x8a')])){clearInterval(_0x281cf4[_0x3a76('0x8a')]);_0x281cf4['handlePredictive']=undefined;loggerPredictive[_0x3a76('0x79')](_0x281cf4[_0x3a76('0x3a')],_0x3a76('0x8b'));}}}function erlangb(_0x2b7bb2,_0x3d2bc7){if(_0x3d2bc7===0x0){return 0x0;}var _0x3ffc8=0x1;for(var _0xa72542=0x1;_0xa72542<=_0x3d2bc7;_0xa72542+=0x1){_0x3ffc8=0x1+_0x3ffc8*_0xa72542/_0x2b7bb2;}return 0x1/_0x3ffc8;}function isVoiceQueueOutbound(_0x2c0517){return _0x2c0517==='outbound';}function isNotPreview(_0x4bfbb0){return _0x4bfbb0!=='preview';}function isCampaignIvr(_0x4847f7){return _0x4847f7===_0x3a76('0x76');}function getCallerId(_0x3ebe7a,_0x1cdf41,_0x2b4dbc){if(!_[_0x3a76('0x38')](_0x2b4dbc)&&typeof _0x2b4dbc==='string'&&!_[_0x3a76('0x8c')](_0x2b4dbc)){if(!_[_0x3a76('0x38')](_0x1cdf41)&&typeof _0x1cdf41===_0x3a76('0x8d')&&!_[_0x3a76('0x8c')](_0x1cdf41)){return util[_0x3a76('0x73')]('\x22%s\x22\x20<%s>',_0x1cdf41,_0x2b4dbc);}return util[_0x3a76('0x73')](_0x3a76('0x8e'),_0x2b4dbc,_0x2b4dbc);}if(!_[_0x3a76('0x38')](_0x3ebe7a)&&typeof _0x3ebe7a===_0x3a76('0x8d')&&!_[_0x3a76('0x8c')](_0x3ebe7a)){return _0x3ebe7a;}return _0x3a76('0x8f');}function loggerCatchQueueSummary(_0x16c238,_0x43b5b3){return function(_0x14131e){freeVariablesPredictive(_0x43b5b3);emitVoiceQueueSummary(_0x43b5b3);emitCampaignSummary(_0x43b5b3);loggerSyncQueueSummary[_0x3a76('0x90')](_0x16c238,util['inspect'](_0x14131e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x55c585,_0x127123){return function(_0x24dd4d){loggerPredictive[_0x3a76('0x90')](_0x127123[_0x3a76('0x3a')],_0x55c585);loggerPredictive[_0x3a76('0x90')](_0x24dd4d[_0x3a76('0x91')]);freeVariablesPredictive(_0x127123);};}function loggerCatch(_0xb9bebb){return function(_0x214544){logger[_0x3a76('0x90')](_0xb9bebb,util[_0x3a76('0x92')](_0x214544,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x12edfb){return _0x12edfb&&!_[_0x3a76('0x38')](_0x12edfb)&&_0x12edfb[_0x3a76('0x93')]>0x0;}function decremetOriginate(_0x1296e3){if(!_[_0x3a76('0x38')](_0x1296e3)&&_0x1296e3!==null){if(typeof _0x1296e3[_0x3a76('0x6b')]!==_0x3a76('0x94')){if(_0x1296e3['originated']>0x0){_0x1296e3['originated']-=0x1;}else{logger[_0x3a76('0x90')](_0x3a76('0x95'));}}}else{logger[_0x3a76('0x90')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x401883,_0x1a7da8,_0x49e6db){if(_0x1a7da8>_0x49e6db){for(var _0x14504b=0x0;_0x14504b<_0x1a7da8-_0x49e6db;_0x14504b+=0x1){decremetOriginate(_0x401883);}}}function loggerGetContactDialer(_0x91b6aa,_0x243220,_0x4c76c0){return function(_0x37ee0f){checkContactLowerLimitOriginate(_0x243220,_0x4c76c0,0x0);logger[_0x3a76('0x90')](_0x91b6aa,util[_0x3a76('0x92')](_0x37ee0f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3a769d){return function(_0x2e4067){if(isNotNull(_0x2e4067)&&isNotNull(_0x2e4067[0x0])){if(_0x2e4067[0x0]['contactsRescheduled']>0x0){_0x3a769d[_0x3a76('0x3c')]='RESCHEDULED_CONTACTS';logger[_0x3a76('0x79')](_0x3a76('0x96')+_0x3a769d['name'],_0x2e4067[0x0][_0x3a76('0x97')],_0x3a76('0x98'));}else{_0x3a769d[_0x3a76('0x3c')]=_0x3a76('0x99');logger[_0x3a76('0x79')](_0x3a76('0x9a')+_0x3a769d[_0x3a76('0x3a')]);}}};}function notSendMessagesQueue(_0x5b9bb3){if(_0x5b9bb3[_0x3a76('0x9b')]){freeVariablesPredictive(_0x5b9bb3);if(_0x5b9bb3[_0x3a76('0x6b')]===0x0&&_0x5b9bb3[_0x3a76('0x4f')]===0x0&&_0x5b9bb3[_0x3a76('0x9c')]===0x0&&(_0x5b9bb3[_0x3a76('0x4d')]||0x0)===0x0){_0x5b9bb3[_0x3a76('0x9b')]=![];_0x5b9bb3['available']=0x0;_0x5b9bb3[_0x3a76('0x3c')]=_0x3a76('0x9d');loggerSyncQueueSummary['error'](_0x3a76('0x9e'),_0x5b9bb3[_0x3a76('0x3a')],_0x3a76('0x9f'));}else{_0x5b9bb3[_0x3a76('0x3c')]=_0x3a76('0xa0');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5b9bb3[_0x3a76('0x3a')],_0x3a76('0xa1'));}emitVoiceQueueSummary(_0x5b9bb3);}}function notSendMessagesCampaign(_0x1347e1){if(_0x1347e1[_0x3a76('0x9b')]){if(_0x1347e1[_0x3a76('0x6b')]===0x0){_0x1347e1[_0x3a76('0x9b')]=![];_0x1347e1[_0x3a76('0x3c')]=_0x3a76('0x9d');loggerSyncQueueSummary[_0x3a76('0x90')](_0x3a76('0xa2'),_0x1347e1['name'],_0x3a76('0x9f'));}else{_0x1347e1['message']=_0x3a76('0xa0');loggerSyncQueueSummary[_0x3a76('0x90')](_0x3a76('0xa2'),_0x1347e1[_0x3a76('0x3a')],_0x3a76('0xa1'));}emitCampaignSummary(_0x1347e1);}}function createObjHistory(_0x3e3c25,_0x3b84d8,_0x5ed1b2,_0x215b44,_0xc0c403){_0x3e3c25['message']=_0x5ed1b2;var _0x1764a0=new Action(_0x3e3c25,_0x3b84d8);var _0x5f2d83=new History(_0x1764a0);_0x5f2d83[_0x3a76('0xa3')]=_0x215b44;_0x5f2d83[_0x3a76('0xa4')]=_0xc0c403;_0x5f2d83[_0x3a76('0xa5')]=_0x1764a0[_0x3a76('0xa6')];return _0x5f2d83;}Dialer[_0x3a76('0xa7')][_0x3a76('0xa8')]=function(){var _0x3eb790=this;setInterval(function(){_0x3eb790[_0x3a76('0xa9')](_0x3eb790['uniqueId'],_0x3a76('0xaa'));_0x3eb790[_0x3a76('0xa9')](_0x3eb790['actions'],'[actions]');},0x32c8);};Dialer[_0x3a76('0xa7')][_0x3a76('0xa9')]=function(_0x31be80,_0x4a5aab){var _0x5f4c56=this;for(var _0x4661bf in _0x31be80){if(typeof _0x31be80[_0x4661bf]!=='undefined'){this[_0x3a76('0x19')][_0x3a76('0x16')](function(){if(!_[_0x3a76('0xab')](_0x31be80[_0x4661bf])){return ami[_0x3a76('0xac')]({'action':_0x3a76('0xad'),'channel':_0x31be80[_0x4661bf]['channel']})['catch'](function(_0x4a946c){if(_0x4a946c[_0x3a76('0x3c')]===_0x3a76('0xae')){setTimeout(function(){if(_0x31be80[_0x4661bf]&&_0x31be80[_0x4661bf][_0x3a76('0x49')]!==_0x3a76('0x76')){_0x5f4c56[_0x3a76('0xaf')](_0x5f4c56['voiceQueues'][_0x31be80[_0x4661bf]['queue']]);logger[_0x3a76('0x90')](_0x3a76('0xb0'),_0x4a5aab,_0x4661bf,_0x31be80[_0x4661bf][_0x3a76('0xb1')]);delete _0x31be80[_0x4661bf];}if(_0x31be80[_0x4661bf]&&_0x31be80[_0x4661bf][_0x3a76('0x49')]===_0x3a76('0x76')){_0x5f4c56[_0x3a76('0xaf')](_0x5f4c56['campaigns'][_0x31be80[_0x4661bf]['queue']]);logger[_0x3a76('0x90')](_0x3a76('0xb2'),_0x4a5aab,_0x4661bf,_0x31be80[_0x4661bf][_0x3a76('0xb1')]);delete _0x31be80[_0x4661bf];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x27eaab){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopper[_0x3a76('0xb5')](_0x27eaab))[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xb7')));};Dialer[_0x3a76('0xa7')][_0x3a76('0xb8')]=function(_0x471020){return BPromise['resolve']()[_0x3a76('0xb4')](cmHopperBlack['checkIsBlackList'](_0x471020))['catch'](loggerCatch(_0x3a76('0xb9')));};Dialer['prototype'][_0x3a76('0xba')]=function(_0x1f2434){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopperBlack['checkIsBlackListIvr'](_0x1f2434))[_0x3a76('0xb6')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x3a76('0xa7')][_0x3a76('0xbb')]=function(_0x3ddabd){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopperHistory[_0x3a76('0xbc')](_0x3ddabd))[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xbd')));};Dialer[_0x3a76('0xa7')]['rescheduleContact']=function(_0x102542){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopper['rescheduleContact'](_0x102542))[_0x3a76('0xb6')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x3a76('0xa7')][_0x3a76('0xbe')]=function(_0x4cd0e5,_0xe0a1aa,_0x19f381){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopper[_0x3a76('0xbe')](_0x4cd0e5,_0xe0a1aa,_0x19f381))[_0x3a76('0xb6')](loggerCatch('[unlockContact]\x20'));};Dialer['prototype'][_0x3a76('0xbf')]=function(_0x174d9b,_0xb27510,_0x39c425,_0x326ecf){return BPromise['resolve']()[_0x3a76('0xb4')](cmHopper['getContactDialer'](_0x174d9b,_0xb27510,_0x39c425,_0x326ecf))[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xc0')));};Dialer['prototype']['getContactDialerIvr']=function(_0x56e40d,_0x12d3d7,_0x51095f){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopper[_0x3a76('0xc1')](_0x56e40d,_0x12d3d7,_0x51095f))[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xc0')));};Dialer['prototype'][_0x3a76('0xc2')]=function(_0x1f543b){return BPromise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x1f543b))[_0x3a76('0xb6')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x3a76('0xa7')][_0x3a76('0xc3')]=function(_0x2bbf68){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopper[_0x3a76('0xc3')](_0x2bbf68))[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xc4')));};Dialer[_0x3a76('0xa7')][_0x3a76('0xc5')]=function(_0x581ba3){return BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](cmHopperHistory[_0x3a76('0xc5')](_0x581ba3))['catch'](loggerCatch(_0x3a76('0xc6')));};Dialer[_0x3a76('0xa7')]['updateOriginated']=function(_0x7aa08e){if(!_[_0x3a76('0x38')](_0x7aa08e)&&_0x7aa08e!==null){if(typeof _0x7aa08e[_0x3a76('0x6b')]!==_0x3a76('0x94')){if(_0x7aa08e[_0x3a76('0x6b')]>0x0){_0x7aa08e[_0x3a76('0x6b')]-=0x1;}else{logger[_0x3a76('0x90')](_0x3a76('0xc7'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3a76('0xa7')]['loggerHandler']=function(_0x51bddb,_0x204d96){var _0x120ca7=this;return function(_0x4c6155){_0x120ca7[_0x3a76('0xaf')](_0x204d96);logger[_0x3a76('0x90')](_0x51bddb,util[_0x3a76('0x92')](_0x4c6155,{'showHidden':![],'depth':null}));};};Dialer[_0x3a76('0xa7')][_0x3a76('0xc8')]=function(_0x5f1cbd,_0x1c10b3,_0x5b4f77){var _0x5a3fae={'state':0x19,'statedesc':'notFound'};this[_0x3a76('0xaf')](_0x1c10b3);this[_0x3a76('0xc9')](_['merge'](_0x5a3fae,_[_0x3a76('0xca')](_0x5b4f77,['ContactId',_0x3a76('0xcb'),_0x3a76('0xcc'),_0x3a76('0xcd'),_0x3a76('0xce')])),_0x3a76('0xcf'),_0x3a76('0xd0'));logger[_0x3a76('0x90')](_0x5f1cbd);};Dialer[_0x3a76('0xa7')][_0x3a76('0xd1')]=function(_0x1e58e1){return _0x1e58e1===_0x3a76('0xd2');};Dialer[_0x3a76('0xa7')][_0x3a76('0xd3')]=function(_0x399f6a){return!_['isUndefined'](_0x399f6a)&&_0x399f6a&&!_[_0x3a76('0x38')](_0x399f6a[_0x3a76('0x3a')])&&!_[_0x3a76('0x38')](_0x399f6a[_0x3a76('0x71')])&&_0x399f6a['active']&&(this['trunks'][util[_0x3a76('0x73')](_0x3a76('0xd4'),_0x399f6a[_0x3a76('0x3a')])][_0x3a76('0xad')]===_0x3a76('0xd5')||this[_0x3a76('0x1d')][util['format'](_0x3a76('0xd4'),_0x399f6a['name'])][_0x3a76('0xad')]===_0x3a76('0xd6'));};Dialer[_0x3a76('0xa7')]['saveInDb']=function(_0x12641e,_0x478c2c,_0x189eb4){this['createHistory'](_0x12641e)['catch'](loggerCatch(_0x478c2c));this[_0x3a76('0xc3')](_0x12641e)[_0x3a76('0xb6')](loggerCatch(_0x189eb4));};Dialer[_0x3a76('0xa7')]['syncVarSet']=function(_0x137406){var _0x187309=this[_0x3a76('0x21')][_0x137406['uniqueid']];var _0x28a21f;if(!_[_0x3a76('0xab')](_0x137406)&&!_[_0x3a76('0xab')](_0x137406[_0x3a76('0xd7')])&&!_[_0x3a76('0xab')](_0x137406[_0x3a76('0xd7')]['amdstatus'])&&_0x137406['exten']===_0x3a76('0xd8')&&_0x187309){if(_0x187309[_0x3a76('0x49')]!==_0x3a76('0x76')&&this['voiceQueues'][_0x187309[_0x3a76('0xb1')]]['dialAMDActive']&&_0x137406[_0x3a76('0xd9')]===_0x3a76('0xda')){delete this['uniqueId'][_0x137406[_0x3a76('0xdb')]];this[_0x3a76('0xaf')](this[_0x3a76('0x1a')][_0x187309[_0x3a76('0xb1')]]);this[_0x3a76('0x1a')][_0x187309[_0x3a76('0xb1')]][_0x3a76('0x59')]+=0x1;this[_0x3a76('0x1a')][_0x187309['queue']][_0x3a76('0x58')]+=0x1;_0x28a21f=new Hangup(_0x187309,_0x137406);_0x28a21f[_0x3a76('0xa3')]=0x12;_0x28a21f[_0x3a76('0xa4')]=_0x3a76('0xdc');_0x28a21f[_0x3a76('0xdd')]=_0x3a76('0xde');ami[_0x3a76('0x48')]('custom:amd',ut[_0x3a76('0xdf')](_0x28a21f,_0x3a76('0xe0')));this[_0x3a76('0xc9')](_0x28a21f,_0x3a76('0xe1'),'[syncHangupInAMD]');}if(_0x187309[_0x3a76('0x49')]!==_0x3a76('0x76')&&this[_0x3a76('0x1a')][_0x187309['queue']][_0x3a76('0xe2')]&&_0x137406[_0x3a76('0xd9')]===_0x3a76('0xe3')){var _0x188e81=this;return new BPromise(function(_0x47fd2a,_0x4604d9){delete _0x188e81[_0x3a76('0x21')][_0x137406[_0x3a76('0xdb')]];_0x188e81[_0x3a76('0xaf')](_0x188e81[_0x3a76('0x1a')][_0x187309[_0x3a76('0xb1')]]);_0x188e81[_0x3a76('0x1a')][_0x187309[_0x3a76('0xb1')]][_0x3a76('0x59')]+=0x1;_0x188e81['voiceQueues'][_0x187309[_0x3a76('0xb1')]][_0x3a76('0x58')]+=0x1;var _0x20cc50=_0x188e81['voiceQueues'][_0x187309['queue']];var _0x34ec07=new Hangup(_0x187309,_0x137406);_0x34ec07[_0x3a76('0xa3')]=0x13;_0x34ec07[_0x3a76('0xa4')]=_0x3a76('0xe4');_0x34ec07['membername']=_0x3a76('0xde');_0x34ec07[_0x3a76('0xe5')]+=0x1;_0x34ec07['countglobal']+=0x1;_0x34ec07[_0x3a76('0xe0')]=!![];ami[_0x3a76('0x48')]('custom:amd',ut[_0x3a76('0xdf')](_0x34ec07,_0x3a76('0xe0')));_0x188e81['createHistory'](_0x34ec07)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xe6')));if(_0x34ec07['countbusyretry']+_0x34ec07[_0x3a76('0xe7')]+_0x34ec07[_0x3a76('0xe8')]+_0x34ec07[_0x3a76('0xe9')]+_0x34ec07[_0x3a76('0xea')]+_0x34ec07[_0x3a76('0xeb')]+_0x34ec07['countmachineretry']+_0x34ec07[_0x3a76('0xec')]>=_0x20cc50[_0x3a76('0xed')]){_0x188e81['stateGlobal'](_0x34ec07,_0x47fd2a,_0x4604d9,_0x3a76('0xee'));}else{if(_0x34ec07[_0x3a76('0xe5')]>=_0x20cc50[_0x3a76('0xef')]){_0x188e81[_0x3a76('0xf0')](_0x34ec07,_0x47fd2a,_0x4604d9,_0x3a76('0xf1'));}else{_0x188e81['rescheduleContact']({'active':![],'countmachineretry':_0x34ec07[_0x3a76('0xe5')],'scheduledat':moment()['add'](_0x20cc50[_0x3a76('0xf2')],_0x3a76('0xf3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34ec07[_0x3a76('0xf4')],'ListId':_0x34ec07[_0x3a76('0xcb')],'VoiceQueueId':_0x34ec07['VoiceQueueId']||undefined,'CampaignId':_0x34ec07['CampaignId']||undefined})['catch'](loggerCatch(_0x3a76('0xf5')));_0x47fd2a({'reschedule':0x1});}}});}if(_0x187309[_0x3a76('0x49')]==='ivr'&&this['campaigns'][_0x187309['queue']][_0x3a76('0xe2')]&&_0x137406[_0x3a76('0xd9')]===_0x3a76('0xda')){delete this[_0x3a76('0x21')][_0x137406[_0x3a76('0xdb')]];this[_0x3a76('0xaf')](this[_0x3a76('0x1b')][_0x187309[_0x3a76('0xb1')]]);_0x28a21f=new Hangup(_0x187309,_0x137406);_0x28a21f[_0x3a76('0xa3')]=0x12;_0x28a21f[_0x3a76('0xa4')]=_0x3a76('0xdc');_0x28a21f['membername']=_0x3a76('0xde');ami[_0x3a76('0x48')](_0x3a76('0xf6'),ut[_0x3a76('0xdf')](_0x28a21f,'amd'));this[_0x3a76('0xc9')](_0x28a21f,'[syncHangupInAMDIvr][createHistory]',_0x3a76('0xf7'));}if(_0x187309[_0x3a76('0x49')]==='ivr'&&this[_0x3a76('0x1b')][_0x187309['queue']][_0x3a76('0xe2')]&&_0x137406[_0x3a76('0xd9')]===_0x3a76('0xe3')){var _0x188e81=this;return new BPromise(function(_0x248f71,_0x4e8243){delete _0x188e81[_0x3a76('0x21')][_0x137406[_0x3a76('0xdb')]];_0x188e81['updateOriginated'](_0x188e81[_0x3a76('0x1b')][_0x187309[_0x3a76('0xb1')]]);_0x188e81['campaigns'][_0x187309[_0x3a76('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x188e81[_0x3a76('0x1b')][_0x187309[_0x3a76('0xb1')]][_0x3a76('0x58')]+=0x1;var _0x18edee=_0x188e81[_0x3a76('0x1b')][_0x187309[_0x3a76('0xb1')]];var _0x345a01=new Hangup(_0x187309,_0x137406);_0x345a01[_0x3a76('0xa3')]=0x13;_0x345a01[_0x3a76('0xa4')]=_0x3a76('0xe4');_0x345a01['membername']=_0x3a76('0xde');_0x345a01[_0x3a76('0xe5')]+=0x1;_0x345a01[_0x3a76('0xf8')]+=0x1;_0x345a01[_0x3a76('0xe0')]=!![];ami[_0x3a76('0x48')](_0x3a76('0xf6'),ut[_0x3a76('0xdf')](_0x345a01,_0x3a76('0xe0')));_0x188e81['createHistory'](_0x345a01)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xe6')));if(_0x345a01['countbusyretry']+_0x345a01[_0x3a76('0xe7')]+_0x345a01[_0x3a76('0xe8')]+_0x345a01[_0x3a76('0xe9')]+_0x345a01[_0x3a76('0xea')]+_0x345a01['countabandonedretry']+_0x345a01[_0x3a76('0xe5')]+_0x345a01['countagentrejectretry']>=_0x18edee[_0x3a76('0xed')]){_0x188e81[_0x3a76('0xf9')](_0x345a01,_0x248f71,_0x4e8243,'reason19\x20machine....');}else{if(_0x345a01[_0x3a76('0xe5')]>=_0x18edee[_0x3a76('0xef')]){_0x188e81[_0x3a76('0xf0')](_0x345a01,_0x248f71,_0x4e8243,_0x3a76('0xf1'));}else{_0x188e81[_0x3a76('0xfa')]({'active':![],'countmachineretry':_0x345a01[_0x3a76('0xe5')],'scheduledat':moment()['add'](_0x18edee[_0x3a76('0xf2')],'minutes')[_0x3a76('0x73')](_0x3a76('0xfb')),'ContactId':_0x345a01[_0x3a76('0xf4')],'ListId':_0x345a01['ListId'],'VoiceQueueId':_0x345a01[_0x3a76('0xcd')]||undefined,'CampaignId':_0x345a01[_0x3a76('0xce')]||undefined})['catch'](loggerCatch(_0x3a76('0xf5')));_0x248f71({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x3a76('0x31')]=function(_0x8557ec){var _0x3ea808=this[_0x3a76('0x21')][_0x8557ec[_0x3a76('0xdb')]];var _0x448f31=this;var _0x4658cb;if(_0x3ea808&&_0x3ea808[_0x3a76('0x49')]===_0x3a76('0x76')){delete this[_0x3a76('0x21')][_0x8557ec[_0x3a76('0xdb')]];this[_0x3a76('0xaf')](this[_0x3a76('0x1b')][_0x3ea808['queue']]);this[_0x3a76('0x1b')][_0x3ea808['queue']]['ivrAnswerCallsDay']+=0x1;_0x4658cb=new Hangup(_0x3ea808,_0x8557ec);this[_0x3a76('0xc5')](_0x4658cb)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xfc')));this[_0x3a76('0xc3')](_0x4658cb)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x3ea808&&_0x3ea808[_0x3a76('0x49')]!==_0x3a76('0x76')&&isNotNull(this['voiceQueues'][_0x3ea808['queue']][_0x3a76('0xfd')])){delete this['uniqueId'][_0x8557ec[_0x3a76('0xdb')]];this[_0x3a76('0xaf')](this[_0x3a76('0x1a')][_0x3ea808[_0x3a76('0xb1')]]);this[_0x3a76('0x1a')][_0x3ea808[_0x3a76('0xb1')]][_0x3a76('0x59')]+=0x1;this[_0x3a76('0x1a')][_0x3ea808[_0x3a76('0xb1')]][_0x3a76('0x58')]+=0x1;_0x4658cb=new Hangup(_0x3ea808,_0x8557ec);_0x4658cb[_0x3a76('0xa3')]=0x10;_0x4658cb[_0x3a76('0xa4')]=_0x3a76('0xfe');_0x4658cb['membername']=_0x3a76('0xff');this['createHistory'](_0x4658cb)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xfc')));this[_0x3a76('0xc3')](_0x4658cb)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x100')));}if(_0x3ea808&&_0x3ea808[_0x3a76('0x49')]!==_0x3a76('0x76')&&!isNotNull(this[_0x3a76('0x1a')][_0x3ea808[_0x3a76('0xb1')]][_0x3a76('0xfd')])){delete this[_0x3a76('0x21')][_0x8557ec[_0x3a76('0xdb')]];this['updateOriginated'](this[_0x3a76('0x1a')][_0x3ea808[_0x3a76('0xb1')]]);this['voiceQueues'][_0x3ea808[_0x3a76('0xb1')]][_0x3a76('0x62')]+=0x1;_0x4658cb=new Hangup(_0x3ea808,_0x8557ec);_0x4658cb[_0x3a76('0xa3')]=0xc;_0x4658cb[_0x3a76('0xa4')]=_0x8557ec[_0x3a76('0x101')];_0x4658cb[_0x3a76('0xdd')]=_0x3a76('0x102');this[_0x3a76('0xc5')](_0x4658cb)[_0x3a76('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3a76('0xc3')](_0x4658cb)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x100')));}};Dialer[_0x3a76('0xa7')]['syncAgentComplete']=function(_0x16c4fd){var _0x5a936d=this[_0x3a76('0x21')][_0x16c4fd['uniqueid']];var _0x118db5=this;if(this[_0x3a76('0x1a')][_0x16c4fd[_0x3a76('0xb1')]]){if(_0x5a936d&&_0x5a936d['type']!==_0x3a76('0x76')){delete this[_0x3a76('0x21')][_0x16c4fd[_0x3a76('0xdb')]];this[_0x3a76('0x1a')][_0x16c4fd[_0x3a76('0xb1')]][_0x3a76('0x59')]+=0x1;var _0x52d93b=new AgentComplete(_0x5a936d,_0x16c4fd);if(_0x16c4fd[_0x3a76('0x103')]===_0x3a76('0x104')){_0x52d93b[_0x3a76('0x105')]=this[_0x3a76('0x1a')][_0x16c4fd[_0x3a76('0xb1')]]['dialQueueProject2']&&this[_0x3a76('0x1a')][_0x16c4fd[_0x3a76('0xb1')]][_0x3a76('0x106')]?moment()[_0x3a76('0x73')](_0x3a76('0xfb')):undefined;}this[_0x3a76('0xc5')](_0x52d93b)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x107')));this[_0x3a76('0xc3')](_0x52d93b)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x3a76('0xa7')][_0x3a76('0x29')]=function(_0x8fd012){if(this['voiceQueues'][_0x8fd012[_0x3a76('0xb1')]]){if(this['uniqueId'][_0x8fd012['uniqueid']]&&this['uniqueId'][_0x8fd012[_0x3a76('0xdb')]]['type']!==_0x3a76('0x76')){this[_0x3a76('0xaf')](this[_0x3a76('0x1a')][_0x8fd012[_0x3a76('0xb1')]]);this[_0x3a76('0x21')][_0x8fd012[_0x3a76('0xdb')]][_0x3a76('0x108')]=moment()[_0x3a76('0x73')](_0x3a76('0xfb'));}}};Dialer[_0x3a76('0xa7')][_0x3a76('0x109')]=function(_0x3d8745){this[_0x3a76('0xc5')](_0x3d8745)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x107')));this[_0x3a76('0xc3')](_0x3d8745)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x10a')));};Dialer[_0x3a76('0xa7')]['syncQueueCallerAbandon']=function(_0x16820e){var _0x47ed73=this[_0x3a76('0x21')][_0x16820e['uniqueid']];var _0x57bee5=this;if(this[_0x3a76('0x1a')][_0x16820e['queue']]){if(_0x47ed73&&_0x47ed73['type']!==_0x3a76('0x76')){delete this[_0x3a76('0x21')][_0x16820e[_0x3a76('0xdb')]];this['updateOriginated'](this[_0x3a76('0x1a')][_0x16820e[_0x3a76('0xb1')]]);_0x47ed73[_0x3a76('0x10b')]=moment()[_0x3a76('0x73')](_0x3a76('0xfb'));var _0xbb6e1a=new QueueCallerAbandon(_0x47ed73,_0x16820e);if(getSeconds(_0x47ed73[_0x3a76('0x10b')],_0x47ed73[_0x3a76('0x10c')])>=_0x47ed73[_0x3a76('0x10d')]){this[_0x3a76('0x1a')][_0x16820e['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x16820e[_0x3a76('0xb1')]][_0x3a76('0x5e')]+=0x1;this[_0x3a76('0x1a')][_0x16820e[_0x3a76('0xb1')]][_0x3a76('0x66')]+=0x1;_0xbb6e1a[_0x3a76('0xa3')]=0xa;_0xbb6e1a[_0x3a76('0xa4')]=_0x3a76('0x10e');_0xbb6e1a[_0x3a76('0x10f')]=_0x3a76('0x110');_0xbb6e1a['agiafterat']=this[_0x3a76('0x1a')][_0x16820e[_0x3a76('0xb1')]][_0x3a76('0x111')]?moment()[_0x3a76('0x73')](_0x3a76('0xfb')):undefined;_0xbb6e1a[_0x3a76('0xea')]+=0x1;_0xbb6e1a['countglobal']+=0x1;if(_0xbb6e1a[_0x3a76('0xea')]>=this[_0x3a76('0x1a')][_0x16820e[_0x3a76('0xb1')]][_0x3a76('0x112')]){this[_0x3a76('0x109')](_0xbb6e1a);}else{this[_0x3a76('0xfa')]({'active':![],'countdropretry':_0xbb6e1a['countdropretry'],'scheduledat':moment()[_0x3a76('0x113')](this[_0x3a76('0x1a')][_0x16820e[_0x3a76('0xb1')]]['dialDropRetryFrequency'],_0x3a76('0xf3'))[_0x3a76('0x73')](_0x3a76('0xfb')),'ContactId':_0x47ed73['ContactId'],'ListId':_0x47ed73[_0x3a76('0xcb')],'VoiceQueueId':_0x47ed73[_0x3a76('0xcd')]||undefined,'CampaignId':_0x47ed73[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch('[rescheduleContact][Drop]'));var _0x3614a8=new History(_0xbb6e1a);_0x3614a8[_0x3a76('0xa3')]=0xa;_0x3614a8[_0x3a76('0xa4')]=_0x3a76('0x10e');_0x3614a8['starttime']=moment()[_0x3a76('0x73')](_0x3a76('0xfb'));_0x3614a8[_0x3a76('0xa5')]=_0x3614a8[_0x3a76('0xa6')];_0x3614a8[_0x3a76('0x114')]=_0xbb6e1a['calleridname'];_0x3614a8[_0x3a76('0x115')]=_0xbb6e1a['calleridnum'];this[_0x3a76('0xc5')](_0x3614a8)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x116')));}}else{this[_0x3a76('0x1a')][_0x16820e[_0x3a76('0xb1')]][_0x3a76('0x64')]+=0x1;this[_0x3a76('0x1a')][_0x16820e['queue']][_0x3a76('0x5d')]+=0x1;_0xbb6e1a[_0x3a76('0xa3')]=0xb;_0xbb6e1a['statedesc']=_0x3a76('0x117');_0xbb6e1a['dropreason']=_0x3a76('0x118');_0xbb6e1a[_0x3a76('0xeb')]+=0x1;_0xbb6e1a['countglobal']+=0x1;if(_0xbb6e1a['countabandonedretry']>=this[_0x3a76('0x1a')][_0x16820e[_0x3a76('0xb1')]]['dialAbandonedMaxRetry']){this[_0x3a76('0x109')](_0xbb6e1a);}else{this[_0x3a76('0xfa')]({'active':![],'countabandonedretry':_0xbb6e1a[_0x3a76('0xeb')],'scheduledat':moment()[_0x3a76('0x113')](this['voiceQueues'][_0x16820e['queue']][_0x3a76('0x119')],_0x3a76('0xf3'))['format'](_0x3a76('0xfb')),'ContactId':_0x47ed73[_0x3a76('0xf4')],'ListId':_0x47ed73['ListId'],'VoiceQueueId':_0x47ed73[_0x3a76('0xcd')]||undefined,'CampaignId':_0x47ed73[_0x3a76('0xce')]||undefined})['catch'](loggerCatch(_0x3a76('0x11a')));var _0x3614a8=new History(_0xbb6e1a);_0x3614a8['state']=0xb;_0x3614a8[_0x3a76('0xa4')]=_0x3a76('0x117');_0x3614a8[_0x3a76('0xa6')]=moment()[_0x3a76('0x73')](_0x3a76('0xfb'));_0x3614a8[_0x3a76('0xa5')]=_0x3614a8[_0x3a76('0xa6')];_0x3614a8[_0x3a76('0x114')]=_0xbb6e1a[_0x3a76('0x114')];_0x3614a8[_0x3a76('0x115')]=_0xbb6e1a[_0x3a76('0x115')];this[_0x3a76('0xc5')](_0x3614a8)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x11b')));}}}}};Dialer[_0x3a76('0xa7')][_0x3a76('0x11c')]=function(_0x189d96){if(this[_0x3a76('0x20')][_0x189d96[_0x3a76('0xdb')]]){this[_0x3a76('0x20')][_0x189d96[_0x3a76('0xdb')]][_0x3a76('0x11d')]=_0x189d96[_0x3a76('0x11d')];}if(this[_0x3a76('0x21')][_0x189d96[_0x3a76('0xdb')]]){this[_0x3a76('0x21')][_0x189d96['uniqueid']][_0x3a76('0x11d')]=_0x189d96['channel'];}};Dialer[_0x3a76('0xa7')][_0x3a76('0x11e')]=function(_0x5ae2aa){if(strategy[this[_0x3a76('0x1a')][this[_0x3a76('0x20')][_0x5ae2aa['actionid']][_0x3a76('0xb1')]][_0x3a76('0x11f')]]===_0x3a76('0x15')){if(this['actions'][_0x5ae2aa[_0x3a76('0x120')]]&&_[_0x3a76('0xab')](this[_0x3a76('0x20')][_0x5ae2aa[_0x3a76('0x120')]][_0x3a76('0x121')])&&_0x5ae2aa[_0x3a76('0xad')]==='1'&&_0x5ae2aa[_0x3a76('0x122')]==='0'){if(this[_0x3a76('0x1c')][_0x5ae2aa['stateinterface']]){if(!this[_0x3a76('0x1c')][_0x5ae2aa[_0x3a76('0x123')]]['locked']){this['agents'][_0x5ae2aa[_0x3a76('0x123')]][_0x3a76('0x121')]=!![];this['actions'][_0x5ae2aa[_0x3a76('0x120')]]['locked']=!![];this[_0x3a76('0x20')][_0x5ae2aa['actionid']][_0x3a76('0x123')]=_0x5ae2aa[_0x3a76('0x123')];}}}}else if((strategy[this[_0x3a76('0x1a')][this['actions'][_0x5ae2aa['actionid']][_0x3a76('0xb1')]][_0x3a76('0x11f')]]||_0x3a76('0x124'))===_0x3a76('0x124')){if(this[_0x3a76('0x20')][_0x5ae2aa['actionid']]){if(this[_0x3a76('0x1c')][_0x5ae2aa[_0x3a76('0x123')]]){this[_0x3a76('0x20')][_0x5ae2aa[_0x3a76('0x120')]]['stateinterface']=_0x5ae2aa['stateinterface'];if(_[_0x3a76('0xab')](this[_0x3a76('0x26')][this[_0x3a76('0x20')][_0x5ae2aa['actionid']][_0x3a76('0xb1')]])){this[_0x3a76('0x26')][this['actions'][_0x5ae2aa[_0x3a76('0x120')]]['queue']]=[];}this['queueBooked'][this['actions'][_0x5ae2aa[_0x3a76('0x120')]][_0x3a76('0xb1')]][_0x3a76('0x125')](_['merge'](_[_0x3a76('0xca')](this['actions'][_0x5ae2aa[_0x3a76('0x120')]],['idHopper','stateinterface']),{'status':_0x5ae2aa[_0x3a76('0xad')],'paused':_0x5ae2aa[_0x3a76('0x122')]}));}}}};function unlockQueueStatus(_0x3965ff,_0x11b4ff){setTimeout(function(){if(_[_0x3a76('0x38')](_0x3965ff[_0x3a76('0x126')])){loggerBooked[_0x3a76('0x90')](_0x3a76('0x127'),_0x11b4ff);}_0x3965ff[_0x3a76('0x126')]=!![];loggerBooked[_0x3a76('0x79')](_0x3a76('0x128'),_0x11b4ff,JSON['stringify'](_[_0x3a76('0xca')](_0x3965ff,[_0x3a76('0x3a'),_0x3a76('0x126')])));},0x1f3);}Dialer[_0x3a76('0xa7')]['syncQueueStatusComplete']=function(_0x200e11){var _0x3e71a4=this;var _0x90ca18=_0x3e71a4['voiceQueues'][_0x3e71a4['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]];if(strategy[this[_0x3a76('0x1a')][this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]]['strategy']]==='roundrobin'){if(this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]]&&this['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0x123')]){this[_0x3a76('0x129')][_0x3a76('0x12a')](this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0x12b')],this['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0x123')])[_0x3a76('0xb6')](function(_0x470654){logger[_0x3a76('0x90')](_0x3a76('0x12c'),util[_0x3a76('0x92')](_0x470654,{'showHidden':![],'depth':null}));})[_0x3a76('0x18')](function(){_0x3e71a4[_0x3a76('0xaf')](_0x3e71a4['voiceQueues'][_0x3e71a4['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]]);_0x3e71a4[_0x3a76('0x1c')][_0x3e71a4[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0x123')]][_0x3a76('0x121')]=![];delete _0x3e71a4[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]];unlockQueueStatus(_0x90ca18);});}else{this[_0x3a76('0xaf')](this[_0x3a76('0x1a')][this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]]);this[_0x3a76('0xfa')]({'active':![],'ContactId':this['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xf4')],'ListId':this['actions'][_0x200e11['actionid']][_0x3a76('0xcb')],'VoiceQueueId':this[_0x3a76('0x20')][_0x200e11['actionid']][_0x3a76('0xcd')]||undefined,'CampaignId':this['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x200e11[_0x3a76('0x120')]];unlockQueueStatus(_0x90ca18);}}else if((strategy[this[_0x3a76('0x1a')][this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]][_0x3a76('0x11f')]]||_0x3a76('0x124'))===_0x3a76('0x124')){var _0x8ff3f3;if(this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]]&&!_[_0x3a76('0x8c')](this[_0x3a76('0x26')][this['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]])){if(this[_0x3a76('0x27')][_0x3e71a4[_0x3a76('0x20')][_0x200e11['actionid']][_0x3a76('0xb1')]]){this['queueBookedRR'][_0x3e71a4['actions'][_0x200e11[_0x3a76('0x120')]]['queue']]=this['queueBookedRR'][this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]]?this[_0x3a76('0x27')][this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]]:this[_0x3a76('0x26')][this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]]['queue']]?this[_0x3a76('0x26')][this[_0x3a76('0x20')][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]][_0x3a76('0x12d')]||0x0:0x0;}this[_0x3a76('0x26')][this['actions'][_0x200e11[_0x3a76('0x120')]][_0x3a76('0xb1')]]['_rr']=this[_0x3a76('0x27')][this[_0x3a76('0x20')][_0x200e11['actionid']][_0x3a76('0xb1')]];for(var _0x1bc0dc=0x0;_0x1bc0dc=0x0;})[_0x3a76('0xb6')](myreject(_0x12705e)));}}else{_0xeb4d77[_0x3a76('0x125')](ami[_0x3a76('0xac')]({'action':_0x3a76('0x146'),'command':util[_0x3a76('0x73')](_0x3a76('0x147'),_0x4c6ffe,!_[_0x3a76('0x38')](config[_0x3a76('0x144')][_0x3b9491])?_0x3b9491:'')})['then'](function(_0x4fdd67){return _0x4fdd67[_0x3a76('0x149')][_0x3a76('0x14a')](_0x3a76('0x14b'))>=0x0;})['catch'](myreject(_0x12705e)));}BPromise[_0x3a76('0x14c')](_0xeb4d77)['then'](function(_0x46decc){var _0x409f33=_[_0x3a76('0x14d')](_0x46decc);if(_0x409f33){return _0x134dc6(_0x409f33);}else{_0x11e28a['message']=_0x305a5d?_0x3a76('0x14e'):'INTERVAL_IS_OVERTIME';return _0x12705e(msgResponse(_0x3a76('0x14f'),_0x3a76('0x140'),_0x3a76('0x150')+_0x305a5d+'\x20'+_0x5daddc+_0x3a76('0x151')+util['inspect'](_0x4c6ffe,{'showHidden':![],'depth':null})+_0x3a76('0x152')+_0x3b9491));}})[_0x3a76('0xb6')](function(_0x2fb3b8){return _0x12705e(msgResponse('ifTime','Failure',JSON[_0x3a76('0x44')](_0x2fb3b8)));});});};Dialer['prototype'][_0x3a76('0x153')]=function(_0x1cf6d2){var _0x4a7b1e=this;return function(){switch(_0x1cf6d2[_0x3a76('0x154')]){case _0x3a76('0x155'):freeVariablesPredictive(_0x1cf6d2);_0x4a7b1e[_0x3a76('0x156')](_0x1cf6d2,0x1);break;case'power':freeVariablesPredictive(_0x1cf6d2);_0x4a7b1e[_0x3a76('0x156')](_0x1cf6d2,_0x1cf6d2[_0x3a76('0x157')]);break;case _0x3a76('0x9'):_0x4a7b1e[_0x3a76('0x9')](_0x1cf6d2);break;case _0x3a76('0x8'):freeVariablesPredictive(_0x1cf6d2);_0x4a7b1e[_0x3a76('0x156')](_0x1cf6d2,0x1);break;default:freeVariablesPredictive(_0x1cf6d2);logger['error']('Queue',_0x1cf6d2['name'],_0x3a76('0x158'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x3c3e22){var _0x1f9b96=this;return function(){_0x1f9b96[_0x3a76('0x159')](_0x3c3e22);};};Dialer[_0x3a76('0xa7')][_0x3a76('0xa')]=function(_0x13c333){var _0x502a5f=this;if(isNotPreview(_0x13c333['dialMethod'])){if(isVoiceQueueOutbound(_0x13c333[_0x3a76('0x49')])&&isActive(_0x13c333[_0x3a76('0x53')])){_0x13c333[_0x3a76('0x9b')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x13c333,_0x13c333[_0x3a76('0x4c')]))[_0x3a76('0xb4')](checkIsActive(_0x13c333,_0x13c333[_0x3a76('0x53')]))[_0x3a76('0xb4')](checkInterval(_0x13c333))[_0x3a76('0xb4')](_0x502a5f[_0x3a76('0x139')](_0x13c333))['then'](_0x502a5f[_0x3a76('0x13d')](_0x13c333['dialGlobalInterval'],_0x13c333[_0x3a76('0x15a')],_0x13c333[_0x3a76('0x3a')],_0x13c333))['then'](_0x502a5f[_0x3a76('0x13f')](_0x13c333[_0x3a76('0x3e')],_0x13c333[_0x3a76('0x15a')],_0x13c333[_0x3a76('0x3a')],_0x13c333))[_0x3a76('0xb4')](_0x502a5f[_0x3a76('0x153')](_0x13c333))[_0x3a76('0xb6')](loggerCatchQueueSummary(_0x3a76('0x15b'),_0x13c333));}else{notSendMessagesQueue(_0x13c333);}}else{freeVariablesPredictive(_0x13c333);}};Dialer[_0x3a76('0xa7')][_0x3a76('0x138')]=function(){var _0xf70141=this;var _0x217bbb;for(var _0x5ae43a in this['campaigns']){if(typeof this[_0x3a76('0x1b')][_0x5ae43a]!==_0x3a76('0x94')){_0x217bbb=this[_0x3a76('0x1b')][_0x5ae43a];if(isCampaignIvr(_0x217bbb[_0x3a76('0x49')])&&isActive(_0x217bbb[_0x3a76('0x71')])){_0x217bbb[_0x3a76('0x9b')]=!![];BPromise[_0x3a76('0xb3')]()[_0x3a76('0xb4')](checkIsActive(_0x217bbb,_0x217bbb[_0x3a76('0x71')]))['then'](checkInterval(_0x217bbb))['then'](_0xf70141[_0x3a76('0x139')](_0x217bbb))[_0x3a76('0xb4')](_0xf70141['checkIfTime'](_0x217bbb[_0x3a76('0x15c')],_0x217bbb['dialTimezone'],_0x217bbb[_0x3a76('0x3a')],_0x217bbb))[_0x3a76('0xb4')](_0xf70141['checkIfTimeIntervals'](_0x217bbb['Interval'],_0x217bbb['dialTimezone'],_0x217bbb[_0x3a76('0x3a')],_0x217bbb))['then'](_0xf70141['launchHandleIvr'](_0x217bbb))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x217bbb));}else{notSendMessagesCampaign(_0x217bbb);}}}};function getCallerIdRandom(_0x2859bd,_0x14be8d){var _0x46dc48;var _0x514cac;var _0x1d7816;if(_0x14be8d<=0x0){_0x14be8d=0x1;}_0x46dc48=new RegExp(_0x3a76('0x15d')+_0x14be8d+'}$');_0x514cac=Math[_0x3a76('0x15e')](0xa,_0x14be8d-0x1);_0x1d7816=Math[_0x3a76('0x15e')](0xa,_0x14be8d)-0x1;return util[_0x3a76('0x73')]('%s',_[_0x3a76('0x15f')](_0x2859bd,_0x46dc48,_['random'](_0x514cac,_0x1d7816)));}function extractCalleridName(_0x1a0234){var _0x444d4b=_0x1a0234['match'](/"(.*?)"/);return _0x444d4b?_0x444d4b[0x1]:_0x1a0234;}function extractCalleridNumber(_0x560d73){var _0x15b79a=_0x560d73['match'](/<(.*?)>/);return _0x15b79a?_0x15b79a[0x1]:_0x560d73;}Dialer[_0x3a76('0xa7')]['actionOriginate']=function(_0x3cc237,_0x3a8365){var _0x70278d=this;var _0x4788d0=uuid['v4']();this[_0x3a76('0x20')][_0x4788d0]=new Action(_0x3cc237,_0x3a8365,_0x4788d0);return new BPromise(function(_0x2e294f,_0x5e0991){if(_[_0x3a76('0x38')](_0x3cc237)&&typeof _0x3cc237!=='object'){return _0x5e0991(msgResponse('originate','Failure',_0x3a76('0x160')));}if(_[_0x3a76('0x38')](_0x3a8365['Contact'][_0x3a76('0x161')])||_0x3a8365[_0x3a76('0x162')][_0x3a76('0x161')]===null){return _0x5e0991(msgResponse(_0x3a76('0x163'),_0x3a76('0x140'),_0x3a76('0x164')));}var _0x5a609a={'XMD-CALLERID':_0x70278d[_0x3a76('0x20')][_0x4788d0]['getCaller'](),'XMD-AGI':_0x3cc237[_0x3a76('0xfd')]?util[_0x3a76('0x73')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3cc237[_0x3a76('0xfd')]):'NONE','XMD-AGIAFTER':_0x3cc237[_0x3a76('0x111')]?util[_0x3a76('0x73')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3cc237[_0x3a76('0x111')]):'NONE','XMD-QUEUE':_0x3cc237[_0x3a76('0x49')]===_0x3a76('0x4a')?util[_0x3a76('0x73')](_0x3a76('0x165'),_0x3cc237['name'],_0x3cc237[_0x3a76('0x166')]||'',_0x3cc237[_0x3a76('0x106')]?'c':'',_0x3cc237['dialQueueTimeout']||0x3):_0x3a76('0x167'),'XMD-CONTACTID':_0x3a8365[_0x3a76('0xf4')],'XMD-CDRTYPE':_0x3a76('0x168'),'CALLERID(all)':_0x70278d['actions'][_0x4788d0][_0x3a76('0x169')](),'XMD-AMD':_0x3cc237['dialAMDActive']?_0x3a76('0x16a'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3cc237[_0x3a76('0xe2')]){_0x5a609a['XMD-AMDINITIALSILENCE']=_0x3cc237[_0x3a76('0x16b')]||0x9c4;_0x5a609a['XMD-AMDGREETING']=_0x3cc237[_0x3a76('0x16c')]||0x5dc;_0x5a609a[_0x3a76('0x16d')]=_0x3cc237[_0x3a76('0x16e')]||0x320;_0x5a609a[_0x3a76('0x16f')]=_0x3cc237[_0x3a76('0x170')]||0x1388;_0x5a609a['XMD-AMDMINWORDLENGTH']=_0x3cc237[_0x3a76('0x171')]||0x64;_0x5a609a[_0x3a76('0x172')]=_0x3cc237[_0x3a76('0x173')]||0x32;_0x5a609a[_0x3a76('0x174')]=_0x3cc237['dialAMDMaximumNumberOfWords']||0x3;_0x5a609a[_0x3a76('0x175')]=_0x3cc237[_0x3a76('0x176')]||0x100;_0x5a609a[_0x3a76('0x177')]=_0x3cc237[_0x3a76('0x178')]||0x1388;}if(_0x3cc237[_0x3a76('0x49')]===_0x3a76('0x4a')){_0x5a609a[_0x3a76('0x179')]=_0x3a8365[_0x3a76('0xcd')];}else{_0x5a609a[_0x3a76('0x17a')]=_0x3a8365[_0x3a76('0xce')];}for(var _0x43d62c in _0x3a8365[_0x3a76('0x162')]){if(typeof _0x3a8365[_0x3a76('0x162')][_0x43d62c]!=='undefined'){if(isNotNull(_0x3a8365[_0x3a76('0x162')][_0x43d62c])&&_0x43d62c!=='id'&&_0x43d62c!==_0x3a76('0x17b')&&_0x43d62c!=='createdAt'&&_0x43d62c!==_0x3a76('0x17c')){_0x5a609a[util['format']('%s%s',_0x3a76('0x17d'),_['toUpper'](_0x43d62c))]=_0x3a8365[_0x3a76('0x162')][_0x43d62c];}}}var _0x49d195=_0x70278d[_0x3a76('0xd3')](_0x3cc237[_0x3a76('0x70')])?getCallerId(_0x3cc237['Trunk']['callerid'],_0x3cc237[_0x3a76('0x54')],_0x3cc237[_0x3a76('0x17e')]>0x0?getCallerIdRandom(_0x3cc237[_0x3a76('0x55')],_0x3cc237[_0x3a76('0x17e')]):_0x3cc237[_0x3a76('0x55')]):getCallerId(_[_0x3a76('0xab')](_0x3cc237[_0x3a76('0x13a')])?_0x3cc237[_0x3a76('0x70')][_0x3a76('0x72')]:_0x3cc237[_0x3a76('0x13a')][_0x3a76('0x72')],_0x3cc237[_0x3a76('0x54')],_0x3cc237['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3cc237[_0x3a76('0x55')],_0x3cc237[_0x3a76('0x17e')]):_0x3cc237[_0x3a76('0x55')]);if(_0x49d195){_0x5a609a[_0x3a76('0x17f')]=_0x70278d[_0x3a76('0x20')][_0x4788d0]['originatecalleridname']=extractCalleridName(_0x49d195);_0x5a609a[_0x3a76('0x180')]=_0x70278d['actions'][_0x4788d0][_0x3a76('0x181')]=extractCalleridNumber(_0x49d195);}return ami[_0x3a76('0xac')]({'actionid':_0x4788d0,'action':'originate','channel':_0x70278d[_0x3a76('0xd3')](_0x3cc237['Trunk'])?util[_0x3a76('0x73')](_0x3a76('0x182'),_0x3cc237[_0x3a76('0x70')][_0x3a76('0x3a')],isNotNull(_0x3cc237['dialPrefix'])?_0x3cc237['dialPrefix'][_0x3a76('0x183')]()||'':'',_0x3cc237['dialCutDigit']>0x0?_0x3a8365['Contact']['phone'][_0x3a76('0x184')](_0x3cc237['dialCutDigit']):_0x3a8365[_0x3a76('0x162')][_0x3a76('0x161')]):util[_0x3a76('0x73')]('SIP/%s/%s%s',_[_0x3a76('0xab')](_0x3cc237[_0x3a76('0x13a')])?_0x3cc237[_0x3a76('0x70')][_0x3a76('0x3a')]:_0x3cc237[_0x3a76('0x13a')]['name'],isNotNull(_0x3cc237['dialPrefix'])?_0x3cc237[_0x3a76('0x57')][_0x3a76('0x183')]()||'':'',_0x3cc237[_0x3a76('0x185')]>0x0?_0x3a8365['Contact']['phone']['substring'](_0x3cc237['dialCutDigit']):_0x3a8365['Contact'][_0x3a76('0x161')]),'callerid':_0x49d195,'Exten':_0x3a76('0xd8'),'Context':_0x3a76('0x186'),'Priority':'1','variable':_0x5a609a,'timeout':(_0x3cc237[_0x3a76('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4788d0})[_0x3a76('0xb4')](function(_0x42b3b9){return _0x2e294f(_0x42b3b9);})[_0x3a76('0xb6')](function(_0x28db20){_0x3cc237[_0x3a76('0x187')]+=0x1;var _0x530a2e=new History(_0x70278d[_0x3a76('0x20')][_0x4788d0]);logger[_0x3a76('0x90')](util[_0x3a76('0x73')](_0x3a76('0x188'),JSON[_0x3a76('0x44')](_0x28db20)));_0x530a2e[_0x3a76('0xa3')]=0xe;_0x530a2e[_0x3a76('0xa4')]=_0x3a76('0x189');_0x530a2e[_0x3a76('0xa6')]=moment()['format'](_0x3a76('0xfb'));_0x530a2e[_0x3a76('0xa5')]=_0x530a2e[_0x3a76('0xa6')];_0x70278d[_0x3a76('0xc5')](_0x530a2e)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x18a')));_0x70278d[_0x3a76('0xc3')](_0x530a2e)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x18a')))[_0x3a76('0x18')](function(){delete _0x70278d[_0x3a76('0x20')][_0x4788d0];return _0x5e0991(msgResponse(_0x3a76('0x163'),_0x3a76('0x43'),_0x3a76('0x18b')));});});});};Dialer[_0x3a76('0xa7')][_0x3a76('0x2d')]=function(_0x3fcf16){var _0x256ffe=this[_0x3a76('0x20')][_0x3fcf16[_0x3a76('0x120')]];if(_0x256ffe){delete this[_0x3a76('0x20')][_0x3fcf16[_0x3a76('0x120')]];_0x256ffe[_0x3a76('0x10c')]=moment()['format'](_0x3a76('0xfb'));var _0x456b75=_0x256ffe[_0x3a76('0x49')]===_0x3a76('0x76')?this[_0x3a76('0x1b')][_0x256ffe[_0x3a76('0xb1')]]:this[_0x3a76('0x1a')][_0x256ffe[_0x3a76('0x18c')]()];if(!this[_0x3a76('0xd1')](_0x3fcf16[_0x3a76('0x18d')])){this[_0x3a76('0xaf')](_0x456b75);return this[_0x3a76('0x18e')](_0x256ffe,_0x456b75,_0x3fcf16)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x18f')));}this[_0x3a76('0x21')][_0x3fcf16[_0x3a76('0xdb')]]=_0x256ffe;}};Dialer['prototype'][_0x3a76('0x190')]=function(_0x1fbfee,_0x3ec660,_0x5e2820){var _0x552c88=new History(_0x3ec660);if(_0x552c88[_0x3a76('0x191')]+_0x552c88[_0x3a76('0xe7')]+_0x552c88[_0x3a76('0xe8')]+_0x552c88[_0x3a76('0xe9')]+_0x552c88[_0x3a76('0xea')]+_0x552c88[_0x3a76('0xeb')]+_0x552c88[_0x3a76('0xe5')]+_0x552c88[_0x3a76('0xec')]>=_0x5e2820[_0x3a76('0xed')]-0x1){return!![];}switch(_0x1fbfee){case 0x3:if(_0x552c88[_0x3a76('0xe8')]>=_0x5e2820[_0x3a76('0x192')]-0x1){return!![];}this[_0x3a76('0xfa')]({'active':![],'countnoanswerretry':_0x552c88[_0x3a76('0xe8')]+=0x1,'scheduledat':moment()['add'](_0x5e2820[_0x3a76('0x193')],_0x3a76('0xf3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x552c88['ContactId'],'ListId':_0x552c88['ListId'],'VoiceQueueId':_0x552c88[_0x3a76('0xcd')]||undefined,'CampaignId':_0x552c88[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x552c88['countbusyretry']>=_0x5e2820['dialBusyMaxRetry']-0x1){return!![];}this[_0x3a76('0xfa')]({'active':![],'countbusyretry':_0x552c88[_0x3a76('0x191')]+=0x1,'scheduledat':moment()[_0x3a76('0x113')](_0x5e2820[_0x3a76('0x194')],_0x3a76('0xf3'))[_0x3a76('0x73')](_0x3a76('0xfb')),'ContactId':_0x552c88[_0x3a76('0xf4')],'ListId':_0x552c88[_0x3a76('0xcb')],'VoiceQueueId':_0x552c88['VoiceQueueId']||undefined,'CampaignId':_0x552c88[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x195')));break;case 0x8:if(_0x552c88['countcongestionretry']>=_0x5e2820[_0x3a76('0x196')]-0x1){return!![];}this[_0x3a76('0xfa')]({'active':![],'countcongestionretry':_0x552c88['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3a76('0x113')](_0x5e2820[_0x3a76('0x197')],_0x3a76('0xf3'))['format'](_0x3a76('0xfb')),'ContactId':_0x552c88['ContactId'],'ListId':_0x552c88[_0x3a76('0xcb')],'VoiceQueueId':_0x552c88[_0x3a76('0xcd')]||undefined,'CampaignId':_0x552c88[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x198')));break;case 0x0:if(_0x552c88[_0x3a76('0xe9')]>=_0x5e2820[_0x3a76('0x199')]-0x1){return!![];}else{this[_0x3a76('0xfa')]({'active':![],'countnosuchnumberretry':_0x552c88[_0x3a76('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x5e2820['dialNoSuchNumberRetryFrequency'],_0x3a76('0xf3'))['format'](_0x3a76('0xfb')),'ContactId':_0x552c88[_0x3a76('0xf4')],'ListId':_0x552c88[_0x3a76('0xcb')],'VoiceQueueId':_0x552c88[_0x3a76('0xcd')]||undefined,'CampaignId':_0x552c88[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x19a')));}break;case 0xa:if(_0x552c88[_0x3a76('0xea')]>=_0x5e2820['dialDropMaxRetry']-0x1){return!![];}this[_0x3a76('0xfa')]({'active':![],'countdropretry':_0x552c88['countdropretry']+=0x1,'scheduledat':moment()[_0x3a76('0x113')](_0x5e2820[_0x3a76('0x19b')],_0x3a76('0xf3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x552c88[_0x3a76('0xf4')],'ListId':_0x552c88['ListId'],'VoiceQueueId':_0x552c88[_0x3a76('0xcd')]||undefined,'CampaignId':_0x552c88[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x19c')));break;case 0xb:if(_0x552c88[_0x3a76('0xeb')]>=_0x5e2820[_0x3a76('0x19d')]-0x1){return!![];}this[_0x3a76('0xfa')]({'active':![],'countabandonedretry':_0x552c88[_0x3a76('0xeb')]+=0x1,'scheduledat':moment()[_0x3a76('0x113')](_0x5e2820[_0x3a76('0x119')],_0x3a76('0xf3'))['format'](_0x3a76('0xfb')),'ContactId':_0x552c88[_0x3a76('0xf4')],'ListId':_0x552c88[_0x3a76('0xcb')],'VoiceQueueId':_0x552c88[_0x3a76('0xcd')]||undefined,'CampaignId':_0x552c88['CampaignId']||undefined})[_0x3a76('0xb6')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x552c88[_0x3a76('0xe5')]>=_0x5e2820[_0x3a76('0xef')]-0x1){return!![];}this[_0x3a76('0xfa')]({'active':![],'countmachineretry':_0x552c88[_0x3a76('0xe5')]+=0x1,'scheduledat':moment()[_0x3a76('0x113')](_0x5e2820[_0x3a76('0xf2')],_0x3a76('0xf3'))[_0x3a76('0x73')](_0x3a76('0xfb')),'ContactId':_0x552c88[_0x3a76('0xf4')],'ListId':_0x552c88['ListId'],'VoiceQueueId':_0x552c88[_0x3a76('0xcd')]||undefined,'CampaignId':_0x552c88[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x552c88[_0x3a76('0xec')]>=_0x5e2820['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x552c88[_0x3a76('0xec')]+=0x1,'scheduledat':moment()[_0x3a76('0x113')](_0x5e2820['dialAgentRejectRetryFrequency'],'minutes')[_0x3a76('0x73')](_0x3a76('0xfb')),'ContactId':_0x552c88[_0x3a76('0xf4')],'ListId':_0x552c88[_0x3a76('0xcb')],'VoiceQueueId':_0x552c88[_0x3a76('0xcd')]||undefined,'CampaignId':_0x552c88[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x3a76('0x18e')]=function(_0x4afc81,_0x456909,_0x2a2ff7){var _0x29638c=this;var _0x2d727d=new History(_0x4afc81);return new BPromise(function(_0x4ee86d,_0x2f979f){if(_[_0x3a76('0x38')](_0x456909)&&typeof _0x456909!==_0x3a76('0x19e')){return _0x2f979f(msgResponse(_0x3a76('0x19f'),_0x3a76('0x140'),'entity\x20is\x20undefine'));}if(_[_0x3a76('0x38')](_0x2a2ff7)&&typeof _0x2a2ff7!=='object'){return _0x2f979f(msgResponse('[callProgressDetecting]',_0x3a76('0x140'),_0x3a76('0x1a0')));}switch(_0x2a2ff7['reason']){case'0':_0x456909[_0x3a76('0x5f')]+=0x1;_0x2d727d[_0x3a76('0xa3')]=0x0;_0x2d727d[_0x3a76('0xa4')]=_0x3a76('0x1a1');_0x2d727d[_0x3a76('0xe9')]+=0x1;_0x2d727d[_0x3a76('0xf8')]+=0x1;ami['emit'](_0x3a76('0x1a2'),ut[_0x3a76('0xdf')](_0x4afc81,_0x3a76('0x1a3')));_0x29638c['createHistory'](_0x2d727d)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xe6')));if(_0x29638c[_0x3a76('0x190')](0x0,_0x4afc81,_0x456909)){if(_0x2d727d[_0x3a76('0xe9')]>=_0x456909[_0x3a76('0x199')]){_0x29638c[_0x3a76('0xf0')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1a4'));}else{_0x29638c[_0x3a76('0xf9')](_0x2d727d,_0x4ee86d,_0x2f979f,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x456909[_0x3a76('0x1a5')]+=0x1;_0x2d727d['state']=0x3;_0x2d727d[_0x3a76('0xa4')]=_0x3a76('0x1a6');_0x2d727d[_0x3a76('0xe8')]+=0x1;_0x2d727d[_0x3a76('0xf8')]+=0x1;ami[_0x3a76('0x48')]('custom:agentnoanswer',ut['buildObj'](_0x4afc81,_0x3a76('0x1a7')));_0x29638c[_0x3a76('0xc5')](_0x2d727d)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x1a8')));if(_0x29638c[_0x3a76('0x190')](0x3,_0x4afc81,_0x456909)){if(_0x2d727d[_0x3a76('0xe8')]>=_0x456909['dialNoAnswerMaxRetry']){_0x29638c['createStateFinal'](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1a9'));}else{_0x29638c[_0x3a76('0xf9')](_0x2d727d,_0x4ee86d,_0x2f979f,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x456909[_0x3a76('0x1aa')]+=0x1;_0x2d727d[_0x3a76('0xa3')]=0x5;_0x2d727d['statedesc']=_0x3a76('0x1ab');_0x2d727d[_0x3a76('0x191')]+=0x1;_0x2d727d[_0x3a76('0xf8')]+=0x1;ami[_0x3a76('0x48')](_0x3a76('0x1ac'),ut[_0x3a76('0xdf')](_0x4afc81,_0x3a76('0x1ad')));_0x29638c[_0x3a76('0xc5')](_0x2d727d)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x1ae')));if(_0x29638c[_0x3a76('0x190')](0x5,_0x4afc81,_0x456909)){if(_0x2d727d[_0x3a76('0x191')]>=_0x456909[_0x3a76('0x1af')]){_0x29638c[_0x3a76('0xf0')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1b0'));}else{_0x29638c[_0x3a76('0xf9')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1b0'));}}break;case'8':_0x456909[_0x3a76('0x5b')]+=0x1;_0x2d727d['state']=0x8;_0x2d727d[_0x3a76('0xa4')]=_0x3a76('0x1b1');_0x2d727d['countcongestionretry']+=0x1;_0x2d727d[_0x3a76('0xf8')]+=0x1;ami[_0x3a76('0x48')](_0x3a76('0x1b2'),ut[_0x3a76('0xdf')](_0x4afc81,_0x3a76('0x1b3')));_0x29638c[_0x3a76('0xc5')](_0x2d727d)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x1b4')));if(_0x29638c[_0x3a76('0x190')](0x8,_0x4afc81,_0x456909)){if(_0x2d727d[_0x3a76('0xe7')]>=_0x456909['dialCongestionMaxRetry']){_0x29638c[_0x3a76('0xf0')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1b5'));}else{_0x29638c[_0x3a76('0xf9')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1b5'));}}break;case'11':_0x456909[_0x3a76('0x1b6')]+=0x1;_0x2d727d['state']=0xb;_0x2d727d['statedesc']=_0x3a76('0x117');_0x2d727d[_0x3a76('0xeb')]+=0x1;_0x2d727d[_0x3a76('0xf8')]+=0x1;_0x29638c[_0x3a76('0xc5')](_0x2d727d)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x11b')));if(_0x29638c[_0x3a76('0x190')](0xb,_0x4afc81,_0x456909)){if(_0x2d727d['countabandonedretry']>=_0x456909['dialAbandonedMaxRetry']){_0x29638c[_0x3a76('0xf0')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1b7'));}else{_0x29638c['stateGlobal'](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1b7'));}}break;case'20':_0x456909[_0x3a76('0x61')]+=0x1;_0x2d727d['state']=0x14;_0x2d727d['statedesc']='AgentReject';_0x2d727d[_0x3a76('0xec')]+=0x1;_0x2d727d[_0x3a76('0xf8')]+=0x1;ami[_0x3a76('0x48')](_0x3a76('0x1b8'),ut[_0x3a76('0xdf')](_0x4afc81,_0x3a76('0x1b9')));_0x29638c[_0x3a76('0xc5')](_0x2d727d)[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x1ba')));if(_0x29638c[_0x3a76('0x190')](0x14,_0x4afc81,_0x456909)){if(_0x2d727d[_0x3a76('0xec')]>=_0x456909['dialAgentRejectMaxRetry']){_0x29638c[_0x3a76('0xf0')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1bb'));}else{_0x29638c[_0x3a76('0xf9')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x3a76('0x1bb'));}}break;default:_0x456909[_0x3a76('0x62')]+=0x1;_0x2d727d[_0x3a76('0xa3')]=0xc;_0x2d727d[_0x3a76('0xa4')]=_0x2a2ff7[_0x3a76('0x103')];_0x29638c[_0x3a76('0xc5')](_0x2d727d)['catch'](loggerCatch(_0x3a76('0x1bc')));if(_0x29638c[_0x3a76('0x190')](_0x2a2ff7['reason'],_0x4afc81,_0x456909)){if(_0x2d727d['countbusyretry']+_0x2d727d[_0x3a76('0xe7')]+_0x2d727d[_0x3a76('0xe8')]+_0x2d727d['countnosuchnumberretry']+_0x2d727d['countdropretry']+_0x2d727d[_0x3a76('0xeb')]+_0x2d727d[_0x3a76('0xe5')]+_0x2d727d[_0x3a76('0xec')]>=_0x456909['dialGlobalMaxRetry']){_0x29638c[_0x3a76('0xf9')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x2a2ff7[_0x3a76('0x103')]);}else{_0x29638c[_0x3a76('0xf0')](_0x2d727d,_0x4ee86d,_0x2f979f,_0x2a2ff7[_0x3a76('0x103')]);}}}});};Dialer[_0x3a76('0xa7')][_0x3a76('0xf9')]=function(_0x3398c5,_0x134ca8,_0x5f1f69,_0x3cc708){var _0x52c1e1=new Final(_0x3398c5);_0x52c1e1['state']=0xf;_0x52c1e1[_0x3a76('0xa4')]=_0x3a76('0x1bd');this[_0x3a76('0xf0')](_0x52c1e1,_0x134ca8,_0x5f1f69,_0x3cc708);};Dialer[_0x3a76('0xa7')][_0x3a76('0xf0')]=function(_0x491c75,_0x3596bb,_0x258f14,_0x581a6f){this['moveContactManagedDialer'](_0x491c75)[_0x3a76('0xb4')](function(){return _0x3596bb(msgResponse(_0x3a76('0x19f'),_0x3a76('0xd2'),_0x581a6f));})[_0x3a76('0xb6')](function(){return _0x258f14(msgResponse(_0x3a76('0x1be'),_0x3a76('0x140'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x3a76('0x9')]=function(_0xe45418){var _0x14e1fe=_0xe45418[_0x3a76('0x1bf')]/0x64;var _0x45be00=_0xe45418[_0x3a76('0x5e')]/(_0xe45418[_0x3a76('0x5e')]+_0xe45418[_0x3a76('0x59')]);var _0x4c845d=Math[_0x3a76('0x1c0')](_0xe45418[_0x3a76('0x69')]*(_0xe45418[_0x3a76('0x1c1')]/0x64));var _0x4a5154=Math[_0x3a76('0x1c0')](_0xe45418['predictiveIntervalAvailable']*(_0xe45418[_0x3a76('0x1c2')]/0x64));var _0x25254b=_0xe45418['available']+_0xe45418[_0x3a76('0x4f')];var _0x5dc17c=Math['floor'](_0xe45418[_0x3a76('0x6c')]*_0xe45418[_0x3a76('0x6e')]*_0xe45418[_0x3a76('0x67')]*_0xe45418[_0x3a76('0x68')]);if(_[_0x3a76('0x38')](_0xe45418['startProgressive'])){if(!_['isUndefined'](_0xe45418['startPredictive'])){_0xe45418[_0x3a76('0x23')]=undefined;loggerPredictive[_0x3a76('0x90')](_0x3a76('0x1c3'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x3a76('0x38')](_0xe45418['handlePredictive'])){loggerPredictive['error'](_0x3a76('0x1c3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xe45418[_0x3a76('0x8a')]);_0xe45418[_0x3a76('0x8a')]=undefined;}_0xe45418[_0x3a76('0x24')]=moment()[_0x3a76('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3a76('0x79')](_0xe45418[_0x3a76('0x3a')],_0x3a76('0x1c4'),_0xe45418[_0x3a76('0x24')]);this[_0x3a76('0x156')](_0xe45418,0x1);}else if(ifInterval(_0xe45418['dialPredictiveInterval'],_0xe45418[_0x3a76('0x24')])){this['handlePower'](_0xe45418,0x1);loggerPredictiveCalls[_0x3a76('0x79')](_0x3a76('0x1c5'),_0xe45418[_0x3a76('0x24')],_0xe45418[_0x3a76('0x3a')]);_0xe45418[_0x3a76('0x6c')]=0x0;_0xe45418[_0x3a76('0x66')]=0x0;}else if(_0x14e1fe<_0x45be00&&_0xe45418[_0x3a76('0x1c6')]===_0x3a76('0x1c7')){freeVariablesPredictive(_0xe45418);loggerPredictive[_0x3a76('0x79')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x45be00,_0x3a76('0x24'),_0xe45418[_0x3a76('0x3a')]);}else if(_0x5dc17c<_0xe45418[_0x3a76('0x66')]&&_0xe45418[_0x3a76('0x1c6')]===_0x3a76('0x1c7')){freeVariablesPredictive(_0xe45418);loggerPredictive[_0x3a76('0x79')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x3a76('0x1c8'),_0x5dc17c,_0x3a76('0x1c9'),_0xe45418[_0x3a76('0x66')],_0x3a76('0x24'),_0xe45418['name']);}else if(!ifInterval(_0xe45418[_0x3a76('0x1ca')],_0xe45418[_0x3a76('0x24')])&&_[_0x3a76('0x38')](_0xe45418['startPredictive'])&&!_['isUndefined'](_0xe45418[_0x3a76('0x24')])){_0xe45418[_0x3a76('0x23')]=moment()[_0x3a76('0x73')](_0x3a76('0xfb'));loggerPredictive['info'](_0xe45418[_0x3a76('0x3a')],_0x3a76('0x1cb'),_0xe45418['startPredictive']);this[_0x3a76('0xbb')](_0xe45418[_0x3a76('0x1ca')])[_0x3a76('0xb4')](this[_0x3a76('0x1cc')](_0xe45418))[_0x3a76('0xb4')](mergeDataErlangB(_0xe45418))['then'](this[_0x3a76('0x1cd')](_0xe45418))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0xe45418));}else if(!ifInterval(_0xe45418[_0x3a76('0x1ca')],_0xe45418[_0x3a76('0x23')])){_0xe45418[_0x3a76('0x66')]=0x0;_0xe45418[_0x3a76('0x23')]=moment()[_0x3a76('0x73')](_0x3a76('0xfb'));loggerPredictive[_0x3a76('0x79')](_0xe45418[_0x3a76('0x3a')],_0x3a76('0x1ce'),_0xe45418[_0x3a76('0x23')]);clearInterval(_0xe45418[_0x3a76('0x8a')]);_0xe45418['handlePredictive']=undefined;this[_0x3a76('0xbb')](_0xe45418[_0x3a76('0x1ca')])[_0x3a76('0xb4')](this[_0x3a76('0x1cc')](_0xe45418))[_0x3a76('0xb4')](mergeDataErlangB(_0xe45418))[_0x3a76('0xb4')](this[_0x3a76('0x1cd')](_0xe45418))['catch'](loggerCatchPredictive(_0x3a76('0x1cf'),_0xe45418));}else if(_0xe45418['predictiveIntervalAvailable']&&_0x25254b<_0xe45418[_0x3a76('0x69')]-_0x4a5154){freeVariablesPredictive(_0xe45418);loggerPredictive['info'](_0xe45418[_0x3a76('0x3a')],_0x3a76('0x1d0'),_0x25254b,_0x3a76('0x1d1'),_0xe45418[_0x3a76('0x69')],'-',_0x4a5154,'=',_0xe45418[_0x3a76('0x69')]-_0x4a5154,')');}else if(_0xe45418[_0x3a76('0x69')]&&_0x25254b>_0xe45418[_0x3a76('0x69')]+_0x4c845d){freeVariablesPredictive(_0xe45418);loggerPredictive['info'](_0xe45418[_0x3a76('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x25254b,_0x3a76('0x1d2'),_0xe45418[_0x3a76('0x69')],'+',_0x4c845d,'=',_0xe45418['predictiveIntervalAvailable']+_0x4c845d,')');}};Dialer['prototype']['getDataPredictive']=function(_0x25a469){var _0x2828ff=this;return function(_0x2b008a){return new BPromise(function(_0x59ba5c,_0x218947){_[_0x3a76('0x87')](_0x25a469,_0x2b008a[0x0]);if(checkGetDataPredictive(_0x2b008a[0x0])){var _0x2c1019=_0x25a469['predictiveIntervalAvailable']=_0x25a469[_0x3a76('0x4f')]+_0x25a469[_0x3a76('0x1d3')];var _0x4d6004=_0x25a469[_0x3a76('0x1ca')]*0x3c;var _0x58dc4e=_0x2b008a[0x0][_0x3a76('0x63')]+_0x2b008a[0x0][_0x3a76('0x7f')];var _0x5e5fc8=(_0x2b008a[0x0]['predictiveIntervalAnsweredCalls']+_0x2b008a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2b008a[0x0][_0x3a76('0x64')])/_0x2b008a[0x0]['predictiveIntervalTotalCalls'];_0x25a469[_0x3a76('0x67')]=_0x5e5fc8>0x0?_0x5e5fc8:0x1;switch(_0x25a469['dialPredictiveOptimization']){case _0x3a76('0x1c7'):var _0x3d7388=_0x25a469['dialPredictiveOptimizationPercentage']/0x64;return _0x2828ff[_0x3a76('0x1d4')](_0x2c1019,_0x4d6004,_0x58dc4e,_0x5e5fc8,_0x3d7388)[_0x3a76('0xb4')](function(_0xfec46){return _0x59ba5c(_0xfec46);});case _0x3a76('0x1d5'):var _0xfe4c72=_0x25a469[_0x3a76('0x1bf')]/0x64;return _0x2828ff[_0x3a76('0x1d6')](_0x2c1019,_0x4d6004,_0x58dc4e,_0x5e5fc8,_0xfe4c72)[_0x3a76('0xb4')](function(_0x429c97){return _0x59ba5c(_0x429c97);});default:return _0x218947(msgResponse(_0x3a76('0x1d7'),_0x3a76('0x140'),'Unknown\x20Predictive'));}}else{return _0x218947(msgResponse(_0x3a76('0x1d7'),_0x3a76('0x140'),_0x3a76('0x1d8')));}});};};Dialer[_0x3a76('0xa7')][_0x3a76('0x1d9')]=function(_0x53985a){var _0xee79ad=this;return function(_0x448ad4){return new BPromise(function(_0x5a3f23,_0x266fbb){_['merge'](_0x53985a,_0x448ad4[0x0]);if(checkGetDataPredictive(_0x448ad4[0x0])){loggerPredictive['info'](JSON[_0x3a76('0x44')](_0x448ad4[0x0]));if(_0x53985a['dialPredictiveOptimization']==='dropRate'){return _0xee79ad[_0x3a76('0xc2')](_0x53985a['id'])['then'](function(_0x53ec5c){var _0x287c1c=_0x53985a[_0x3a76('0x4c')]-_0x53ec5c[0x0][_0x3a76('0x1da')];var _0x3311e2=_0x53985a['dialPredictiveInterval']*0x3c;var _0x1deb61=_0x448ad4[0x0][_0x3a76('0x63')]+_0x448ad4[0x0]['predictiveIntervalAvgHoldtime'];var _0x2501ac=(_0x448ad4[0x0][_0x3a76('0x7c')]+_0x448ad4[0x0][_0x3a76('0x7d')]+_0x448ad4[0x0][_0x3a76('0x64')])/_0x448ad4[0x0][_0x3a76('0x6a')];var _0x2a0724=_0x53985a[_0x3a76('0x1bf')]/0x64;_0x53985a['predictiveIntervalPauses']=_0x53ec5c[0x0][_0x3a76('0x1da')]||0x0;_0x53985a['predictiveIntervalHitRate']=_0x2501ac>0x0?_0x2501ac:0x1;return _0xee79ad['abandonmentRate'](_0x287c1c,_0x3311e2,_0x1deb61,_0x2501ac,_0x2a0724);})[_0x3a76('0xb4')](function(_0x3adf35){return _0x5a3f23(_0x3adf35);})[_0x3a76('0xb6')](function(_0x8bb5e4){return _0x266fbb(msgResponse(_0x3a76('0x1db'),'Failure',JSON[_0x3a76('0x44')](_0x8bb5e4)));});}if(_0x53985a[_0x3a76('0x1c6')]==='agentBusyFactor'){return _0xee79ad[_0x3a76('0xc2')](_0x53985a['id'])[_0x3a76('0xb4')](function(_0x198a15){var _0x29780c=_0x53985a[_0x3a76('0x4c')]-_0x198a15[0x0][_0x3a76('0x1da')];var _0x13b0fe=_0x53985a[_0x3a76('0x1ca')]*0x3c;var _0x13981a=_0x448ad4[0x0]['predictiveIntervalAvgTalktime']+_0x448ad4[0x0][_0x3a76('0x7f')];var _0x1cc411=(_0x448ad4[0x0][_0x3a76('0x7c')]+_0x448ad4[0x0][_0x3a76('0x7d')]+_0x448ad4[0x0][_0x3a76('0x64')])/_0x448ad4[0x0][_0x3a76('0x6a')];var _0x467855=_0x53985a[_0x3a76('0x1bf')]/0x64;_0x53985a[_0x3a76('0x1dc')]=_0x198a15[0x0][_0x3a76('0x1da')]||0x0;_0x53985a[_0x3a76('0x67')]=_0x1cc411>0x0?_0x1cc411:0x1;return _0xee79ad[_0x3a76('0x1d6')](_0x29780c,_0x13b0fe,_0x13981a,_0x1cc411,_0x467855);})[_0x3a76('0xb4')](function(_0x51679b){return _0x5a3f23(_0x51679b);})[_0x3a76('0xb6')](function(_0x4e9061){return _0x266fbb(msgResponse(_0x3a76('0x1db'),_0x3a76('0x140'),JSON[_0x3a76('0x44')](_0x4e9061)));});}}else{return _0x266fbb(msgResponse(_0x3a76('0x1d7'),_0x3a76('0x140'),_0x3a76('0x1d8')));}});};};Dialer[_0x3a76('0xa7')][_0x3a76('0x1cd')]=function(_0x402f21){var _0x3a1633=this;return function(){var _0x5712ca=0x0;var _0x56d57d=Math['floor'](_0x402f21[_0x3a76('0x6d')]*0x3e8);if(_0x56d57d>0x0){_0x56d57d=_0x56d57d<0x64?0x64:_0x56d57d;loggerPredictive[_0x3a76('0x79')](_0x402f21['name'],'one\x20call\x20every:',_0x56d57d,_0x3a76('0x45'));_0x402f21['handlePredictive']=setInterval(function(){_0x3a1633['handlePredictive'](_0x402f21);loggerPredictiveCalls[_0x3a76('0x79')]('[handlePredictive]',_0x5712ca+=0x1);},_0x56d57d);}else{loggerPredictive[_0x3a76('0x79')](_0x402f21['name'],_0x3a76('0x1dd'));}};};Dialer[_0x3a76('0xa7')][_0x3a76('0x1de')]=function(_0x2aa068,_0x314dbe){var _0x40d736=this;return function(_0x186b3a){if(_[_0x3a76('0x8c')](_0x186b3a)){if(_[_0x3a76('0xab')](_0x314dbe[_0x3a76('0xcc')])||!_0x314dbe[_0x3a76('0x1df')]){if(_0x2aa068['dialMethod']==='booked'){_0x2aa068['queueStatusComplete']=_[_0x3a76('0x38')](_0x2aa068[_0x3a76('0x126')])?!![]:_0x2aa068['queueStatusComplete'];var _0xb2dddb=uuid['v4']();_0x40d736['actions'][_0xb2dddb]=new Action(_0x2aa068,_0x314dbe,_0xb2dddb);loggerBooked[_0x3a76('0x79')](_0x3a76('0x1e0'),_0xb2dddb,'queueStatusComplete:\x20',JSON[_0x3a76('0x44')](_0x2aa068[_0x3a76('0x126')]),'Queue:\x20',_0x2aa068[_0x3a76('0x3a')]);if(_0x2aa068[_0x3a76('0x126')]){_0x2aa068[_0x3a76('0x126')]=![];_0x40d736[_0x3a76('0x26')][_0x40d736[_0x3a76('0x20')][_0xb2dddb][_0x3a76('0xb1')]]=[];ami[_0x3a76('0xac')]({'actionid':_0xb2dddb,'action':_0x3a76('0x1e1'),'queue':_0x2aa068[_0x3a76('0x3a')]})[_0x3a76('0xb6')](function(){_0x40d736[_0x3a76('0xaf')](_0x2aa068);_0x40d736[_0x3a76('0xfa')]({'active':![],'ContactId':_0x40d736['actions'][_0xb2dddb]['ContactId'],'ListId':_0x40d736[_0x3a76('0x20')][_0xb2dddb]['ListId'],'VoiceQueueId':_0x40d736[_0x3a76('0x20')][_0xb2dddb]['VoiceQueueId']||undefined,'CampaignId':_0x40d736[_0x3a76('0x20')][_0xb2dddb][_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x1e2')));delete _0x40d736[_0x3a76('0x20')][_0xb2dddb];});}else{loggerBooked[_0x3a76('0x79')](_0x3a76('0x1e3'),JSON[_0x3a76('0x44')](_0x2aa068[_0x3a76('0x126')]),_0x3a76('0x1e4'),_0x2aa068[_0x3a76('0x3a')]);_0x40d736['updateOriginated'](_0x2aa068);_0x40d736['rescheduleContact']({'active':![],'ContactId':_0x40d736['actions'][_0xb2dddb][_0x3a76('0xf4')],'ListId':_0x40d736[_0x3a76('0x20')][_0xb2dddb][_0x3a76('0xcb')],'VoiceQueueId':_0x40d736[_0x3a76('0x20')][_0xb2dddb][_0x3a76('0xcd')]||undefined,'CampaignId':_0x40d736['actions'][_0xb2dddb][_0x3a76('0xce')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x40d736[_0x3a76('0x20')][_0xb2dddb];}}else{return _0x40d736[_0x3a76('0x1e5')](_0x2aa068,_0x314dbe);}}else{if(getDiff(_0x314dbe['scheduledat'])<_0x2aa068[_0x3a76('0x1e6')]*0x3c){if(_0x314dbe['Agent']&&!_0x314dbe[_0x3a76('0x1e7')][_0x3a76('0x1e8')]){_0x40d736[_0x3a76('0x129')]['run'](_0x314dbe['id'])['finally'](function(){_0x40d736[_0x3a76('0xaf')](_0x2aa068);});}else{_0x40d736[_0x3a76('0xbe')]({'active':![]},_0x314dbe['id'],0x1)['finally'](function(){_0x40d736[_0x3a76('0xaf')](_0x2aa068);});}}else{_0x2aa068[_0x3a76('0x60')]+=0x1;_0x40d736[_0x3a76('0xaf')](_0x2aa068);if(_0x2aa068[_0x3a76('0x1e9')]){_0x40d736[_0x3a76('0xfa')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x314dbe[_0x3a76('0xf4')],'ListId':_0x314dbe[_0x3a76('0xcb')],'VoiceQueueId':_0x314dbe[_0x3a76('0xcd')]||undefined,'CampaignId':_0x314dbe[_0x3a76('0xce')]||undefined})[_0x3a76('0xb6')](loggerCatch(_0x3a76('0x1ea')));_0x40d736[_0x3a76('0xc5')](createObjHistory(_0x2aa068,_0x314dbe,_0x3a76('0x1eb'),0x17,_0x3a76('0x1ec')))['catch'](loggerCatch(_0x3a76('0x1ed')));}else{_0x40d736[_0x3a76('0xc9')](createObjHistory(_0x2aa068,_0x314dbe,_0x3a76('0x1ee'),0x16,_0x3a76('0x1ef')),'[Originate][HistoryRecallClose][historyCatch]',_0x3a76('0x1f0'));}}}}else{_0x2aa068[_0x3a76('0x5a')]+=0x1;_0x40d736[_0x3a76('0xc9')](createObjHistory(_0x2aa068,_0x314dbe,_0x3a76('0x1f1'),0xd,_0x3a76('0x1f2')),_0x3a76('0x1f3'),_0x3a76('0x1f4'));throw _0x3a76('0x1f5');}};};Dialer[_0x3a76('0xa7')]['handleIvr']=function(_0x1dc772){var _0xaad0bd=this;var _0x58aa90=_0x1dc772[_0x3a76('0x1f6')]-_0x1dc772[_0x3a76('0x6b')]-_0x1dc772['temp'];emitCampaignSummary(_0x1dc772);if(_0x58aa90>0x0){if(_0x58aa90>this[_0x3a76('0x1e')]){_0x58aa90=this[_0x3a76('0x1e')];}_0x1dc772[_0x3a76('0x1f7')]+=_0x58aa90;this['getContactDialerIvr'](_0x1dc772['id'],_0x58aa90,_0x1dc772[_0x3a76('0x1f8')])[_0x3a76('0xb4')](function(_0x38a966){_0x1dc772[_0x3a76('0x1f7')]-=_0x58aa90;_0x1dc772[_0x3a76('0x1f7')]=_0x1dc772[_0x3a76('0x1f7')]>0x0?_0x1dc772[_0x3a76('0x1f7')]:0x0;if(!checkContactEmpty(_0x38a966)){_0x1dc772['message']=_0x3a76('0x99');logger['info']('[getContactCampaign2][Empty]'+_0x1dc772['name']);}else{_0x1dc772['originated']+=_0x38a966[_0x3a76('0x93')];_0x1dc772[_0x3a76('0x3c')]=_0x3a76('0x1f9');for(var _0x487787=0x0;_0x487787<_0x38a966[_0x3a76('0x93')];_0x487787+=0x1){_0x1dc772[_0x3a76('0x1fa')]+=0x1;if(_[_0x3a76('0xab')](_0x38a966[_0x487787])||_['isNil'](_0x38a966[_0x487787]['Contact'])||_[_0x3a76('0xab')](_0x38a966[_0x487787]['Contact'][_0x3a76('0x161')])){_0xaad0bd[_0x3a76('0xc8')]('[actionOriginate]\x20',_0x1dc772,_0x38a966[_0x487787]);}else{_0xaad0bd[_0x3a76('0xba')](_['pick'](_0x38a966[_0x487787],['CampaignId',_0x3a76('0x1fb')]))[_0x3a76('0xb4')](_0xaad0bd[_0x3a76('0x1de')](_0x1dc772,_0x38a966[_0x487787]))[_0x3a76('0xb6')](_0xaad0bd[_0x3a76('0x1fc')](_0x3a76('0x1fd'),_0x1dc772));}}}})[_0x3a76('0xb6')](loggerGetContactDialer(_0x3a76('0x1fe'),_0x1dc772,_0x58aa90));}};Dialer[_0x3a76('0xa7')][_0x3a76('0x156')]=function(_0x2ae8df,_0x3507f2){var _0x9c1ee5=this;var _0x3529e2=[];var _0x645fda=_0x3507f2>=0x1?_0x3507f2:0x1;if(_0x2ae8df[_0x3a76('0x154')]===_0x3a76('0x8')){_0x645fda=0x1;}var _0x1cde02=Math[_0x3a76('0x1ff')](_0x2ae8df[_0x3a76('0x1d3')]*_0x645fda)-_0x2ae8df[_0x3a76('0x6b')]-_0x2ae8df[_0x3a76('0x1f7')];emitVoiceQueueSummary(_0x2ae8df);if(_0x2ae8df['dialLimitQueue']>0x0){var _0x3bfe8c=_0x2ae8df[_0x3a76('0x200')]-_0x2ae8df['originated']-_0x2ae8df[_0x3a76('0x4f')]-_0x2ae8df[_0x3a76('0x1f7')]-_0x2ae8df[_0x3a76('0x4d')];if(_0x1cde02>_0x3bfe8c){_0x1cde02=_0x3bfe8c;}}if(_0x1cde02>0x0){if(_0x2ae8df[_0x3a76('0x154')]==='booked'){_0x1cde02=0x1;}if(_0x1cde02>this[_0x3a76('0x1e')]){_0x1cde02=this[_0x3a76('0x1e')];}_0x2ae8df[_0x3a76('0x1f7')]+=_0x1cde02;for(var _0x3432ed in this[_0x3a76('0x1c')]){if(typeof this[_0x3a76('0x1c')][_0x3432ed]!=='undefined'){if(this['agents'][_0x3432ed][_0x3a76('0xa3')]==='not_inuse'&&this['agents'][_0x3432ed][_0x3a76('0xad')]===_0x3a76('0xd5')){_0x3529e2[_0x3a76('0x125')](this['agents'][_0x3432ed]['id']);}}}this['getContactDialer'](_0x2ae8df['id'],_0x3529e2,_0x1cde02,_0x2ae8df[_0x3a76('0x1f8')])[_0x3a76('0xb4')](function(_0x517c40){_0x2ae8df[_0x3a76('0x1f7')]-=_0x1cde02;_0x2ae8df[_0x3a76('0x1f7')]=_0x2ae8df['temp']>0x0?_0x2ae8df[_0x3a76('0x1f7')]:0x0;if(!checkContactEmpty(_0x517c40)){_0x9c1ee5[_0x3a76('0xb5')](_0x2ae8df)['then'](sendMessageReschedule(_0x2ae8df))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x2ae8df[_0x3a76('0x6b')]+=_0x517c40[_0x3a76('0x93')];_0x2ae8df[_0x3a76('0x3c')]=_0x2ae8df[_0x3a76('0x154')]==='booked'?_0x3a76('0x16a'):_0x3a76('0x1f9');for(var _0x8ff1d6=0x0;_0x8ff1d6<_0x517c40[_0x3a76('0x93')];_0x8ff1d6+=0x1){if(_[_0x3a76('0xab')](_0x517c40[_0x8ff1d6])||_['isNil'](_0x517c40[_0x8ff1d6][_0x3a76('0x162')])||_[_0x3a76('0xab')](_0x517c40[_0x8ff1d6]['Contact'][_0x3a76('0x161')])){_0x9c1ee5[_0x3a76('0xc8')](_0x3a76('0x201'),_0x2ae8df,_0x517c40[_0x8ff1d6]);}else{_0x9c1ee5[_0x3a76('0xb8')](_['pick'](_0x517c40[_0x8ff1d6],[_0x3a76('0xcd'),'Contact.phone']))['then'](_0x9c1ee5[_0x3a76('0x1de')](_0x2ae8df,_0x517c40[_0x8ff1d6]))['catch'](_0x9c1ee5[_0x3a76('0x1fc')](_0x3a76('0x201'),_0x2ae8df));}}}})[_0x3a76('0xb6')](loggerGetContactDialer(_0x3a76('0x202'),_0x2ae8df,_0x1cde02));}};Dialer[_0x3a76('0xa7')][_0x3a76('0x8a')]=function(_0x47ec16){if(_0x47ec16['dialLimitQueue']>0x0){var _0x2bf721=_0x47ec16[_0x3a76('0x200')]-_0x47ec16[_0x3a76('0x6b')]-_0x47ec16[_0x3a76('0x4f')];if(_0x2bf721>0x0){this[_0x3a76('0x203')](_0x47ec16);}else{loggerPredictiveCalls['info'](_0x3a76('0x204'));}}else{this[_0x3a76('0x203')](_0x47ec16);}};Dialer[_0x3a76('0xa7')][_0x3a76('0x203')]=function(_0x47fe3d){var _0x3823a8=this;var _0x5c7d86=[];_0x47fe3d[_0x3a76('0x6b')]+=0x1;for(var _0x46e1d1 in this[_0x3a76('0x1c')]){if(typeof this['agents'][_0x46e1d1]!=='undefined'){if(this[_0x3a76('0x1c')][_0x46e1d1]['state']===_0x3a76('0x205')&&this[_0x3a76('0x1c')][_0x46e1d1]['status']===_0x3a76('0xd5')){_0x5c7d86[_0x3a76('0x125')](this[_0x3a76('0x1c')][_0x46e1d1]['id']);}}}this[_0x3a76('0xbf')](_0x47fe3d['id'],_0x5c7d86,0x1,_0x47fe3d[_0x3a76('0x1f8')])['then'](function(_0x286c64){if(!checkContactEmpty(_0x286c64)){checkContactLowerLimitOriginate(_0x47fe3d,0x1,0x0);_0x3823a8['countReScheduled'](_0x47fe3d)['then'](sendMessageReschedule(_0x47fe3d))[_0x3a76('0xb6')](loggerCatch(_0x3a76('0xb7')));}else{_0x47fe3d['message']=_0x3a76('0x1f9');if(_[_0x3a76('0xab')](_0x286c64[0x0])||_[_0x3a76('0xab')](_0x286c64[0x0][_0x3a76('0x162')])||_[_0x3a76('0xab')](_0x286c64[0x0]['Contact'][_0x3a76('0x161')])){_0x3823a8[_0x3a76('0xc8')](_0x3a76('0x201'),_0x47fe3d,_0x286c64[0x0]);}else{_0x3823a8['checkIsBlackList'](_[_0x3a76('0xca')](_0x286c64[0x0],[_0x3a76('0xcd'),_0x3a76('0x1fb')]))[_0x3a76('0xb4')](_0x3823a8[_0x3a76('0x1de')](_0x47fe3d,_0x286c64[0x0]))[_0x3a76('0xb6')](_0x3823a8[_0x3a76('0x1fc')](_0x3a76('0x206'),_0x47fe3d));}}})[_0x3a76('0xb6')](loggerGetContactDialer(_0x3a76('0x207'),_0x47fe3d,0x1));emitVoiceQueueSummary(_0x47fe3d);};Dialer['prototype'][_0x3a76('0x1d4')]=function(_0x913e93,_0x1a6af4,_0x49f73e,_0x502313,_0x4df140,_0x3290b7){loggerPredictive[_0x3a76('0x79')](_0x3a76('0x208'));loggerPredictive[_0x3a76('0x79')](_0x3a76('0x209'),_0x913e93);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x20a'),_0x1a6af4);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x20b'),_0x49f73e);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x20c'),_0x502313);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4df140);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x81'));return new BPromise(function(_0x3ecf88,_0x1f1118){if(_0x913e93<=0x0||isNaN(_0x913e93)){return _0x1f1118(msgResponse(_0x3a76('0x20d'),'Error','m\x20=\x20'+_0x913e93));}if(_0x49f73e<=0x0||isNaN(_0x49f73e)){return _0x1f1118(msgResponse(_0x3a76('0x20d'),_0x3a76('0x43'),_0x3a76('0x20e')+_0x49f73e));}if(_0x502313<=0x0||isNaN(_0x502313)){return _0x1f1118(msgResponse(_0x3a76('0x20d'),_0x3a76('0x43'),_0x3a76('0x20f')+_0x502313));}if(_0x1a6af4<=0x0||isNaN(_0x1a6af4)){return _0x1f1118(msgResponse(_0x3a76('0x20d'),_0x3a76('0x43'),_0x3a76('0x210')+_0x1a6af4));}if(_0x4df140<=0x0||isNaN(_0x4df140)){return _0x1f1118(msgResponse('[abandonmentRate]',_0x3a76('0x43'),'Amax\x20=\x20'+_0x4df140));}_0x3290b7=_0x3290b7||0x0;var _0x4024e6=0x1/_0x49f73e;var _0x328fa8=0x0;var _0x4f8fa1=0x0;var _0x1254ea=0x0;var _0x1f9f26=0x0;for(var _0x5bb7e6=0x0;_0x1254ea<_0x4df140;_0x5bb7e6+=0x1){_0x4f8fa1=_0x5bb7e6/_0x1a6af4;_0x328fa8=(_0x502313*_0x4f8fa1+_0x3290b7)/_0x4024e6;_0x1254ea=erlangb(_0x328fa8,_0x913e93);_0x1f9f26=_0x328fa8/_0x913e93*(0x1-erlangb(_0x328fa8,_0x913e93));}return _0x3ecf88({'erlangCalls':_0x5bb7e6,'erlangCallToSecond':_0x1a6af4/_0x5bb7e6,'erlangAbandonmentRate':_0x1254ea,'erlangBusyFactor':_0x1f9f26});});};Dialer[_0x3a76('0xa7')][_0x3a76('0x1d6')]=function(_0x139f97,_0x317830,_0x28251c,_0x22cf95,_0x35c67f,_0x4c8a38){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x3a76('0x79')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x139f97);loggerPredictive[_0x3a76('0x79')](_0x3a76('0x20a'),_0x317830);loggerPredictive['info'](_0x3a76('0x20b'),_0x28251c);loggerPredictive['info'](_0x3a76('0x20c'),_0x22cf95);loggerPredictive['info'](_0x3a76('0x211'),_0x35c67f);loggerPredictive[_0x3a76('0x79')]('---------------------------');return new BPromise(function(_0x50f16e,_0x1baef0){if(_0x139f97<=0x0||isNaN(_0x139f97)){return _0x1baef0(msgResponse(_0x3a76('0x212'),'Error',_0x3a76('0x213')+_0x139f97));}if(_0x28251c<=0x0||isNaN(_0x28251c)){return _0x1baef0(msgResponse(_0x3a76('0x212'),_0x3a76('0x43'),'Ts\x20=\x20'+_0x28251c));}if(_0x22cf95<=0x0||isNaN(_0x22cf95)){return _0x1baef0(msgResponse(_0x3a76('0x212'),'Error','p\x20=\x20'+_0x22cf95));}if(_0x317830<=0x0||isNaN(_0x317830)){return _0x1baef0(msgResponse(_0x3a76('0x212'),_0x3a76('0x43'),_0x3a76('0x210')+_0x317830));}if(_0x35c67f<=0x0||isNaN(_0x35c67f)){return _0x1baef0(msgResponse(_0x3a76('0x212'),'Error',_0x3a76('0x214')+_0x35c67f));}_0x4c8a38=_0x4c8a38||0x0;var _0x1e5c08=0x1/_0x28251c;var _0x74ff9d=0x0;var _0x3b74fa=0x0;var _0x1bc158=0x0;var _0x78f424=0x0;for(var _0x3462ae=0x0;_0x78f424<_0x35c67f;_0x3462ae+=0x1){_0x3b74fa=_0x3462ae/_0x317830;_0x74ff9d=(_0x22cf95*_0x3b74fa+_0x4c8a38)/_0x1e5c08;_0x1bc158=erlangb(_0x74ff9d,_0x139f97);_0x78f424=_0x74ff9d/_0x139f97*(0x1-erlangb(_0x74ff9d,_0x139f97));}return _0x50f16e({'erlangCalls':_0x3462ae,'erlangCallToSecond':_0x317830/_0x3462ae,'erlangAbandonmentRate':_0x1bc158,'erlangBusyFactor':_0x78f424});});};module[_0x3a76('0x215')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index b027990..f454a1d 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b30=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0b30,0x6b));var _0x00b3=function(_0xbd2d7d,_0x2a9d52){_0xbd2d7d=_0xbd2d7d-0x0;var _0x20454e=_0x0b30[_0xbd2d7d];return _0x20454e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x00b3('0x0'));function getSeconds(_0x3b40b9,_0x1c63ed){var _0x26a051=moment(_0x3b40b9)[_0x00b3('0x1')](0x0);var _0xb9a96d=moment(_0x1c63ed)[_0x00b3('0x1')](0x0);return _0x26a051[_0x00b3('0x2')](_0xb9a96d,_0x00b3('0x3'));}function QueueCallerAbandon(_0xda6b82,_0x357ed1){this['scheduledat']=_0xda6b82[_0x00b3('0x4')];this[_0x00b3('0x5')]=_0xda6b82[_0x00b3('0x5')];this[_0x00b3('0x6')]=_0xda6b82[_0x00b3('0x5')]===_0x00b3('0x7')?_0x00b3('0x8'):_0xda6b82[_0x00b3('0x5')];this[_0x00b3('0x9')]=_0xda6b82[_0x00b3('0x9')];this[_0x00b3('0xa')]=_0xda6b82[_0x00b3('0xa')];this[_0x00b3('0xb')]=_0xda6b82['countnoanswerretry'];this['countglobal']=_0xda6b82[_0x00b3('0x9')]+_0xda6b82[_0x00b3('0xa')]+_0xda6b82[_0x00b3('0xb')]+_0xda6b82[_0x00b3('0xc')]+_0xda6b82[_0x00b3('0xd')]+_0xda6b82[_0x00b3('0xe')]+_0xda6b82[_0x00b3('0xf')]+_0xda6b82[_0x00b3('0x10')];this[_0x00b3('0xc')]=_0xda6b82[_0x00b3('0xc')];this['countdropretry']=_0xda6b82[_0x00b3('0xd')];this[_0x00b3('0xe')]=_0xda6b82[_0x00b3('0xe')];this[_0x00b3('0xf')]=_0xda6b82[_0x00b3('0xf')];this[_0x00b3('0x10')]=_0xda6b82[_0x00b3('0x10')];this[_0x00b3('0x11')]=_0x357ed1[_0x00b3('0x11')];this[_0x00b3('0x12')]=_0xda6b82['name'];this['calleridnum']=_0xda6b82[_0x00b3('0x13')];this[_0x00b3('0x14')]=_0xda6b82['starttime'];this[_0x00b3('0x15')]=_0xda6b82[_0x00b3('0x15')];this[_0x00b3('0x16')]=_0xda6b82[_0x00b3('0x16')];this[_0x00b3('0x17')]=this['droptime'];this['ringtime']=getSeconds(_0xda6b82['responsetime'],_0xda6b82['starttime']);this[_0x00b3('0x18')]=getSeconds(this['droptime'],_0xda6b82['responsetime']);this[_0x00b3('0x19')]=0x0;this[_0x00b3('0x8')]=_0x357ed1[_0x00b3('0x8')];this['membername']=_0x357ed1['connectedlinename'];this[_0x00b3('0x1a')]=_0x357ed1[_0x00b3('0x1a')];this[_0x00b3('0x1b')]=_0xda6b82['callback'];this[_0x00b3('0x1c')]=_0xda6b82[_0x00b3('0x1c')];this[_0x00b3('0x1d')]=_0xda6b82[_0x00b3('0x1d')];this[_0x00b3('0x1e')]=_0xda6b82['recallme'];this['ContactId']=_0xda6b82[_0x00b3('0x1f')];this[_0x00b3('0x20')]=_0xda6b82[_0x00b3('0x20')];this[_0x00b3('0x21')]=_0xda6b82[_0x00b3('0x21')];this[_0x00b3('0x22')]=_0xda6b82[_0x00b3('0x22')];this[_0x00b3('0x23')]=_0xda6b82['CampaignId'];this['originatecalleridnum']=_0xda6b82[_0x00b3('0x24')]||'';this[_0x00b3('0x25')]=_0xda6b82['originatecalleridname']||'';}module[_0x00b3('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x9525=['countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9525,0xbf));var _0x5952=function(_0x227204,_0x32d734){_0x227204=_0x227204-0x0;var _0x31cea=_0x9525[_0x227204];return _0x31cea;};'use strict';var util=require(_0x5952('0x0'));var _=require(_0x5952('0x1'));var moment=require(_0x5952('0x2'));function getSeconds(_0x456dc5,_0x26876b){var _0x14cf31=moment(_0x456dc5)[_0x5952('0x3')](0x0);var _0x30af4e=moment(_0x26876b)['milliseconds'](0x0);return _0x14cf31[_0x5952('0x4')](_0x30af4e,_0x5952('0x5'));}function QueueCallerAbandon(_0x108863,_0x14169d){this[_0x5952('0x6')]=_0x108863[_0x5952('0x6')];this[_0x5952('0x7')]=_0x108863['type'];this[_0x5952('0x8')]=_0x108863['type']===_0x5952('0x9')?_0x5952('0xa'):_0x108863['type'];this[_0x5952('0xb')]=_0x108863['countbusyretry'];this['countcongestionretry']=_0x108863[_0x5952('0xc')];this[_0x5952('0xd')]=_0x108863[_0x5952('0xd')];this[_0x5952('0xe')]=_0x108863[_0x5952('0xb')]+_0x108863[_0x5952('0xc')]+_0x108863[_0x5952('0xd')]+_0x108863['countnosuchnumberretry']+_0x108863[_0x5952('0xf')]+_0x108863[_0x5952('0x10')]+_0x108863[_0x5952('0x11')]+_0x108863['countagentrejectretry'];this[_0x5952('0x12')]=_0x108863[_0x5952('0x12')];this[_0x5952('0xf')]=_0x108863[_0x5952('0xf')];this[_0x5952('0x10')]=_0x108863[_0x5952('0x10')];this['countmachineretry']=_0x108863[_0x5952('0x11')];this[_0x5952('0x13')]=_0x108863['countagentrejectretry'];this['uniqueid']=_0x14169d[_0x5952('0x14')];this[_0x5952('0x15')]=_0x108863[_0x5952('0x16')];this['calleridnum']=_0x108863[_0x5952('0x17')];this[_0x5952('0x18')]=_0x108863[_0x5952('0x18')];this[_0x5952('0x19')]=_0x108863['responsetime'];this[_0x5952('0x1a')]=_0x108863[_0x5952('0x1a')];this[_0x5952('0x1b')]=this[_0x5952('0x1a')];this['ringtime']=getSeconds(_0x108863[_0x5952('0x19')],_0x108863[_0x5952('0x18')]);this['holdtime']=getSeconds(this[_0x5952('0x1a')],_0x108863['responsetime']);this[_0x5952('0x1c')]=0x0;this[_0x5952('0xa')]=_0x14169d['queue'];this[_0x5952('0x1d')]=_0x14169d[_0x5952('0x1e')];this['reason']=_0x14169d['reason'];this['callback']=_0x108863[_0x5952('0x1f')];this[_0x5952('0x20')]=_0x108863[_0x5952('0x20')];this[_0x5952('0x21')]=_0x108863['callbackat'];this['recallme']=_0x108863[_0x5952('0x22')];this[_0x5952('0x23')]=_0x108863[_0x5952('0x23')];this[_0x5952('0x24')]=_0x108863[_0x5952('0x24')];this['UserId']=_0x108863[_0x5952('0x25')];this[_0x5952('0x26')]=_0x108863['VoiceQueueId'];this[_0x5952('0x27')]=_0x108863['CampaignId'];this[_0x5952('0x28')]=_0x108863[_0x5952('0x28')]||'';this[_0x5952('0x29')]=_0x108863[_0x5952('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index cbb2221..7afba10 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17cf=['AttachmentId','util','lodash','moment','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x30584f,_0x4a1f96){var _0x2a31e1=function(_0x48af74){while(--_0x48af74){_0x30584f['push'](_0x30584f['shift']());}};_0x2a31e1(++_0x4a1f96);}(_0x17cf,0x155));var _0xf17c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x17cf[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xf17c('0x0'));var _=require(_0xf17c('0x1'));var moment=require(_0xf17c('0x2'));function Action(_0x251a76,_0x10dba3,_0x5b2b4d){this['uniqueid']=_0x251a76||undefined;this['channel']=util['format']('%s/%s/%s',_0x10dba3['tech'],_0x10dba3[_0xf17c('0x3')][_0xf17c('0x4')],_0x5b2b4d[_0xf17c('0x5')]);this['localstationid']=_0x10dba3[_0xf17c('0x6')];this[_0xf17c('0x7')]=_0x10dba3[_0xf17c('0x7')];this[_0xf17c('0x8')]=_0x5b2b4d[_0xf17c('0x8')];this[_0xf17c('0x9')]=_0x5b2b4d[_0xf17c('0x9')];}module['exports']=Action; \ No newline at end of file +var _0x7527=['uniqueid','channel','format','%s/%s/%s','tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports','lodash','moment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7527,0x1da));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x7752('0x0'));var moment=require(_0x7752('0x1'));function Action(_0x483e12,_0x995485,_0x5eab9a){this[_0x7752('0x2')]=_0x483e12||undefined;this[_0x7752('0x3')]=util[_0x7752('0x4')](_0x7752('0x5'),_0x995485[_0x7752('0x6')],_0x995485['Trunk'][_0x7752('0x7')],_0x5eab9a[_0x7752('0x8')]);this[_0x7752('0x9')]=_0x995485[_0x7752('0x9')];this[_0x7752('0xa')]=_0x995485[_0x7752('0xa')];this['path']=_0x5eab9a[_0x7752('0xb')];this[_0x7752('0xc')]=_0x5eab9a[_0x7752('0xc')];}module[_0x7752('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 9996c05..2abae14 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e48=['filename','info','syncReceiveFax','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','bluebird','moment','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncVarSet','bind','newstate','syncNewState','newexten','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','channels','channel','uniqueid','name','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status'];(function(_0x48d24a,_0x5b3842){var _0x35868f=function(_0x52be39){while(--_0x52be39){_0x48d24a['push'](_0x48d24a['shift']());}};_0x35868f(++_0x5b3842);}(_0x7e48,0xba));var _0x87e4=function(_0x46454e,_0x164847){_0x46454e=_0x46454e-0x0;var _0x2e1076=_0x7e48[_0x46454e];return _0x2e1076;};'use strict';var util=require(_0x87e4('0x0'));var _=require('lodash');var BPromise=require(_0x87e4('0x1'));var uuid=require('uuid');var moment=require(_0x87e4('0x2'));var path=require('path');var tiff2pdf=require(_0x87e4('0x3'));var gs=require(_0x87e4('0x4'));var logger=require('../../../config/logger')(_0x87e4('0x5'));var ami=require(_0x87e4('0x6'));var rpcDb=require(_0x87e4('0x7'));var Channel=require(_0x87e4('0x8'));var ut=require(_0x87e4('0x9'));var Action=require(_0x87e4('0xa'));var faxAccount=require(_0x87e4('0xb'));var attachment=require(_0x87e4('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x137870){this['channels']={};this[_0x87e4('0xd')]=_0x137870[_0x87e4('0xd')];this[_0x87e4('0xe')]=_0x137870[_0x87e4('0xe')];this[_0x87e4('0xf')]={};ami['on'](_0x87e4('0x10'),this['syncNewchannel']['bind'](this));ami['on']('varset',this[_0x87e4('0x11')][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x13'),this[_0x87e4('0x14')][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x15'),this['syncNewExten'][_0x87e4('0x12')](this));ami['on']('faxstatus',this[_0x87e4('0x16')]['bind'](this));ami['on'](_0x87e4('0x17'),this['syncReceiveFax'][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x18'),this[_0x87e4('0x19')][_0x87e4('0x12')](this));ami['on'](_0x87e4('0x1a'),this[_0x87e4('0x1b')][_0x87e4('0x12')](this));}Fax['prototype'][_0x87e4('0x1c')]=function(_0x2fbe45){if(_0x2fbe45[_0x87e4('0x1d')]===_0x87e4('0x1e')){for(var _0x3e6d27 in this['faxAccounts']){if(this[_0x87e4('0xd')][_0x87e4('0x1f')](_0x3e6d27)){if(_0x2fbe45['exten']===this[_0x87e4('0xd')][_0x3e6d27][_0x87e4('0x20')]){this['channels'][_0x2fbe45['uniqueid']]={};this[_0x87e4('0x21')][_0x2fbe45['uniqueid']]['channel']=_0x2fbe45[_0x87e4('0x22')];this[_0x87e4('0x21')][_0x2fbe45[_0x87e4('0x23')]]['id']=this[_0x87e4('0xd')][_0x3e6d27]['id'];this[_0x87e4('0x21')][_0x2fbe45[_0x87e4('0x23')]][_0x87e4('0x24')]=this[_0x87e4('0xd')][_0x3e6d27][_0x87e4('0x24')];logger['info'](_0x2fbe45[_0x87e4('0x23')],_0x87e4('0x25'));}}}}if(this[_0x87e4('0xf')][_0x2fbe45[_0x87e4('0x23')]]){this['channels'][_0x2fbe45[_0x87e4('0x23')]]={};this[_0x87e4('0x21')][_0x2fbe45[_0x87e4('0x23')]][_0x87e4('0x22')]=_0x2fbe45[_0x87e4('0x22')];logger['info'](_0x2fbe45[_0x87e4('0x23')],_0x87e4('0x25'));}};Fax[_0x87e4('0x26')][_0x87e4('0x11')]=function(_0x3ba65a){if(this[_0x87e4('0x21')][_0x3ba65a[_0x87e4('0x23')]]){for(var _0x3ce074 in _0x3ba65a[_0x87e4('0x27')]){if(_0x3ba65a[_0x87e4('0x27')][_0x87e4('0x1f')](_0x3ce074)){this[_0x87e4('0x21')][_0x3ba65a[_0x87e4('0x23')]][_0x3ce074]=_0x3ba65a[_0x87e4('0x28')];}}}};Fax['prototype'][_0x87e4('0x14')]=function(_0xd285ef){if(this['channels'][_0xd285ef[_0x87e4('0x23')]]){this[_0x87e4('0x21')][_0xd285ef[_0x87e4('0x23')]][_0x87e4('0x29')]=_0xd285ef[_0x87e4('0x29')];this['channels'][_0xd285ef['uniqueid']][_0x87e4('0x2a')]=_0xd285ef['channelstatedesc'];}};Fax['prototype'][_0x87e4('0x2b')]=function(_0x36af1f){if(this[_0x87e4('0x21')][_0x36af1f[_0x87e4('0x23')]]){for(var _0x975ffc in _0x36af1f[_0x87e4('0x27')]){if(_0x36af1f[_0x87e4('0x27')]['hasOwnProperty'](_0x975ffc)){this[_0x87e4('0x21')][_0x36af1f[_0x87e4('0x23')]][_0x975ffc]=_0x36af1f[_0x87e4('0x28')];}}}};Fax[_0x87e4('0x26')][_0x87e4('0x16')]=function(_0x5cf53b){if(this[_0x87e4('0x21')][_0x5cf53b['uniqueid']]){this['channels'][_0x5cf53b['uniqueid']][_0x87e4('0x2c')]=_0x5cf53b[_0x87e4('0x2c')];this[_0x87e4('0x21')][_0x5cf53b[_0x87e4('0x23')]][_0x87e4('0x2d')]=_0x5cf53b[_0x87e4('0x2d')];this['channels'][_0x5cf53b[_0x87e4('0x23')]][_0x87e4('0x20')]=_0x5cf53b[_0x87e4('0x20')];this[_0x87e4('0x21')][_0x5cf53b['uniqueid']][_0x87e4('0x2e')]=_0x5cf53b[_0x87e4('0x2e')];logger[_0x87e4('0x2f')](_0x5cf53b[_0x87e4('0x23')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x87e4('0x30')]=function(_0x190a83){var _0x27e0a7=this;if(this['channels'][_0x190a83[_0x87e4('0x23')]]){var _0x327ef1=this['channels'][_0x190a83['uniqueid']]['id'];this[_0x87e4('0x21')][_0x190a83[_0x87e4('0x23')]][_0x87e4('0x31')]=_0x190a83[_0x87e4('0x31')];this[_0x87e4('0x21')][_0x190a83['uniqueid']]['pagestransferred']=_0x190a83[_0x87e4('0x32')];this[_0x87e4('0x21')][_0x190a83[_0x87e4('0x23')]]['localstationid']=_0x190a83['localstationid'];this[_0x87e4('0x21')][_0x190a83['uniqueid']]['resolution']=_0x190a83['resolution'];this[_0x87e4('0x21')][_0x190a83['uniqueid']]['transferrate']=_0x190a83[_0x87e4('0x33')];this[_0x87e4('0x21')][_0x190a83[_0x87e4('0x23')]][_0x87e4('0x2e')]=_0x190a83[_0x87e4('0x2e')];this['channels'][_0x190a83[_0x87e4('0x23')]][_0x87e4('0x34')]=_0x190a83['calleridnum'];if(this[_0x87e4('0x21')][_0x190a83['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x190a83[_0x87e4('0x2e')],_0x87e4('0x35'),function(_0x5b84a9){logger['info'](_0x190a83[_0x87e4('0x23')],'\x20result\x20conversion\x20file\x20',_0x5b84a9[_0x87e4('0x36')]);attachment[_0x87e4('0x37')]({'name':path[_0x87e4('0x38')](_0x190a83[_0x87e4('0x2e')])[_0x87e4('0x24')],'basename':path['parse'](_0x190a83[_0x87e4('0x2e')])[_0x87e4('0x24')]+_0x87e4('0x39'),'type':_0x87e4('0x3a')})[_0x87e4('0x3b')](function(_0x322c49){faxAccount[_0x87e4('0x3c')](_0x327ef1,{'from':_0x190a83[_0x87e4('0x34')],'mapKey':_0x87e4('0x5'),'body':path[_0x87e4('0x38')](_0x190a83[_0x87e4('0x2e')])[_0x87e4('0x24')]+_0x87e4('0x39'),'AttachmentId':_0x322c49['id']})[_0x87e4('0x3d')](function(_0x298afc){logger[_0x87e4('0x3e')](_0x190a83[_0x87e4('0x23')],_0x87e4('0x3f'),JSON[_0x87e4('0x40')](_0x298afc));});})[_0x87e4('0x3d')](function(_0x522d85){logger[_0x87e4('0x3e')](_0x190a83[_0x87e4('0x23')],'\x20receiveFax\x20',JSON[_0x87e4('0x40')](_0x522d85));});});}logger[_0x87e4('0x2f')](_0x190a83[_0x87e4('0x23')],'\x20receiveFax\x20');}};Fax['prototype'][_0x87e4('0x1b')]=function(_0x2867f5){if(this[_0x87e4('0xf')][_0x2867f5['uniqueid']]){_[_0x87e4('0x41')](this[_0x87e4('0x21')][_0x2867f5[_0x87e4('0x23')]],_['pick'](_0x2867f5,[_0x87e4('0x42'),_0x87e4('0x43')]));}};function updateStatus(_0x2b73ad){if(_0x2b73ad[_0x87e4('0x44')]){faxMessage[_0x87e4('0x45')](_0x2b73ad[_0x87e4('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x87e4('0x3b')](function(_0x3e30c9){ut[_0x87e4('0x46')](_0x87e4('0x47'),_0x3e30c9);})[_0x87e4('0x3d')](function(_0x21881c){ut[_0x87e4('0x46')](_0x87e4('0x48'),_0x21881c);});}else{ut[_0x87e4('0x46')](_0x87e4('0x49'));}}Fax[_0x87e4('0x26')][_0x87e4('0x4a')]=function(_0x5ee2e6,_0x5e4f4c,_0x517081){var _0x1764b7=this;var _0x2f80bb={};if(_0x5e4f4c){_0x2f80bb={'read':_0x5e4f4c};}else{_0x2f80bb={'failMessage':_0x517081};}if(this[_0x87e4('0xf')][_0x5ee2e6][_0x87e4('0x44')]){faxMessage['update'](this[_0x87e4('0xf')][_0x5ee2e6][_0x87e4('0x44')],_0x2f80bb)[_0x87e4('0x3b')](function(_0xc61358){ut['logger'](_0x87e4('0x4b'),_0xc61358);})[_0x87e4('0x3d')](function(_0x282ddc){ut['logger'](_0x87e4('0x4c'),_0x282ddc);})[_0x87e4('0x4d')](function(){delete _0x1764b7[_0x87e4('0x21')][_0x5ee2e6];delete _0x1764b7[_0x87e4('0xf')][_0x5ee2e6];});}else{ut[_0x87e4('0x46')](_0x87e4('0x4e'));delete this[_0x87e4('0x21')][_0x5ee2e6];delete this[_0x87e4('0xf')][_0x5ee2e6];}};Fax[_0x87e4('0x26')][_0x87e4('0x19')]=function(_0x758650){var _0x43e060=this;if(this[_0x87e4('0x21')][_0x758650['uniqueid']]){if(this[_0x87e4('0xf')][_0x758650['uniqueid']]){this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]]['id']=this[_0x87e4('0xf')][_0x758650[_0x87e4('0x23')]]['id'];this[_0x87e4('0x21')][_0x758650['uniqueid']]['name']=this['actions'][_0x758650['uniqueid']]['name'];}logger[_0x87e4('0x2f')](_0x758650[_0x87e4('0x23')],this['actions'][_0x758650[_0x87e4('0x23')]]?_0x87e4('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0x87e4('0x40')](this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]]));if(this['actions'][_0x758650[_0x87e4('0x23')]]){if(this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]][_0x87e4('0x50')]>0x0&&this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]]['faxstatus']===_0x87e4('0x51')){this[_0x87e4('0x4a')](_0x758650[_0x87e4('0x23')],!![]);}else{this[_0x87e4('0x4a')](_0x758650['uniqueid'],![],this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]][_0x87e4('0x52')]?_0x87e4('0x53')+this[_0x87e4('0x21')][_0x758650[_0x87e4('0x23')]][_0x87e4('0x52')]:_0x87e4('0x54'));}}}};Fax['prototype'][_0x87e4('0x55')]=function(_0x1017b7){var _0x50ab26=this;return new BPromise(function(_0x46d091,_0x12508d){_0x50ab26[_0x87e4('0x56')](_0x1017b7,_0x50ab26[_0x87e4('0xd')][_0x1017b7[_0x87e4('0x57')]])[_0x87e4('0x3b')](function(_0x508415){ut[_0x87e4('0x46')](_0x87e4('0x58'),_0x508415);_0x46d091(ut[_0x87e4('0x36')](_0x87e4('0x59')));})[_0x87e4('0x3d')](function(_0x569ab6){ut[_0x87e4('0x46')](_0x87e4('0x5a'),_0x569ab6);updateStatus(_0x1017b7);_0x12508d(ut[_0x87e4('0x36')]('Fax\x20failed'));});});};Fax[_0x87e4('0x26')]['checkAfterSend']=function(_0x54da5c){var _0x30f75a=this;return new BPromise(function(_0x58098e,_0x1e7ef2){var _0x1a153b=_0x30f75a[_0x87e4('0x5b')](_0x30f75a[_0x87e4('0xd')][_0x54da5c['FaxAccountId']]['Trunk'],_0x54da5c);if(_0x1a153b[_0x87e4('0x5c')]){_0x58098e(ut[_0x87e4('0x36')](_0x87e4('0x5d')));}else{_0x1e7ef2(ut['message'](_0x1a153b['message']));}});};function originate(_0x4aeaa5,_0x1b1d91,_0x581f79){return new BPromise(function(_0x353ea4,_0x3f5a46){if(_0x581f79){var _0x15273f=util[_0x87e4('0x5e')](_0x87e4('0x5f'),path['parse'](_0x4aeaa5[_0x87e4('0x60')])['name'],_0x4aeaa5[_0x87e4('0x60')]);gs[_0x87e4('0x61')](_0x15273f)[_0x87e4('0x3b')](function(){_0x4aeaa5[_0x87e4('0x60')]=util[_0x87e4('0x5e')](_0x87e4('0x62'),path[_0x87e4('0x38')](_0x4aeaa5['path'])[_0x87e4('0x63')],path['parse'](_0x4aeaa5[_0x87e4('0x60')])[_0x87e4('0x24')]);_0x1b1d91[_0x87e4('0x64')]=_0x4aeaa5['path'];ut[_0x87e4('0x46')](_0x87e4('0x65'),'');ami['Action'](ut['variablesAction'](_0x4aeaa5,_0x1b1d91))[_0x87e4('0x3b')](function(_0x1b4135){_0x353ea4(_0x1b4135);})['catch'](function(_0xd1c547){_0x3f5a46(_0xd1c547);});})['catch'](function(_0x108236){_0x3f5a46(_0x108236);});}else{ami[_0x87e4('0x66')](ut[_0x87e4('0x67')](_0x4aeaa5,_0x1b1d91))[_0x87e4('0x3b')](function(_0xe8fd32){_0x353ea4(_0xe8fd32);})[_0x87e4('0x3d')](function(_0x14e38d){_0x3f5a46(_0x14e38d);});}});}Fax[_0x87e4('0x26')][_0x87e4('0x56')]=function(_0x4b689f,_0x3c9ca8){var _0xe226af=this;return new BPromise(function(_0x5385f0,_0x2dc7df){var _0x2780b2=uuid['v4']();var _0x24abc2=ut[_0x87e4('0x68')](_0x4b689f,_0x3c9ca8);_0xe226af[_0x87e4('0xf')][_0x2780b2]=new Action(_0x2780b2,_0x3c9ca8,_0x4b689f);var _0x2425f8=_0xe226af['actions'][_0x2780b2];if(path[_0x87e4('0x38')](_0x4b689f[_0x87e4('0x60')])[_0x87e4('0x69')]===_0x87e4('0x39')){originate(_0x2425f8,_0x24abc2,!![])[_0x87e4('0x3b')](function(_0x4ecb3e){_0x5385f0(_0x4ecb3e);})['catch'](function(_0xa6ab5e){_0x2dc7df(_0xa6ab5e);});}else{originate(_0x2425f8,_0x24abc2,![])[_0x87e4('0x3b')](function(_0x16b8c1){_0x5385f0(_0x16b8c1);})[_0x87e4('0x3d')](function(_0xe25e96){_0x2dc7df(_0xe25e96);});}});};Fax['prototype'][_0x87e4('0x6a')]=function(_0x523200){return!_[_0x87e4('0x6b')](_0x523200)&&!_[_0x87e4('0x6b')](_0x523200[_0x87e4('0x24')])&&!_[_0x87e4('0x6b')](_0x523200[_0x87e4('0x6c')])&&_0x523200['active']&&!_['isNil'](this[_0x87e4('0xe')][util[_0x87e4('0x5e')]('SIP/%s',_0x523200[_0x87e4('0x24')])])&&!_['isNil'](this['trunks'][util['format'](_0x87e4('0x6d'),_0x523200['name'])][_0x87e4('0x2d')])&&(this[_0x87e4('0xe')][util[_0x87e4('0x5e')]('SIP/%s',_0x523200[_0x87e4('0x24')])][_0x87e4('0x2d')]==='reachable'||this[_0x87e4('0xe')][util[_0x87e4('0x5e')]('SIP/%s',_0x523200[_0x87e4('0x24')])][_0x87e4('0x2d')]===_0x87e4('0x6e'));};Fax[_0x87e4('0x26')][_0x87e4('0x5b')]=function(_0x2a927a,_0x3ce7c4){if(!this[_0x87e4('0x6a')](_0x2a927a)){ut['logger'](_0x87e4('0x6f'),_['isNil'](_0x2a927a)?'':_0x2a927a[_0x87e4('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_['isNil'](_0x3ce7c4[_0x87e4('0x5')])){ut[_0x87e4('0x46')](_0x87e4('0x70'),JSON[_0x87e4('0x40')](_0x3ce7c4));return{'isValid':![],'message':_0x87e4('0x71')};}if(_[_0x87e4('0x6b')](_0x3ce7c4[_0x87e4('0x60')])){ut[_0x87e4('0x46')](_0x87e4('0x72'),JSON['stringify'](_0x3ce7c4));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x87e4('0x73')};};module['exports']=Fax; \ No newline at end of file +var _0x58cf=['unmonitored','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','syncNewExten','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','hasOwnProperty','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable','value','channelstate','channelstatedesc','syncFaxStatus','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable'];(function(_0x50c5ff,_0x540b67){var _0x1e60f6=function(_0x14476c){while(--_0x14476c){_0x50c5ff['push'](_0x50c5ff['shift']());}};_0x1e60f6(++_0x540b67);}(_0x58cf,0x14d));var _0xf58c=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x58cf[_0x53b8e0];return _0x10630c;};'use strict';var util=require(_0xf58c('0x0'));var _=require(_0xf58c('0x1'));var BPromise=require(_0xf58c('0x2'));var uuid=require(_0xf58c('0x3'));var moment=require('moment');var path=require(_0xf58c('0x4'));var tiff2pdf=require(_0xf58c('0x5'));var gs=require(_0xf58c('0x6'));var logger=require(_0xf58c('0x7'))(_0xf58c('0x8'));var ami=require(_0xf58c('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xf58c('0xa'));var ut=require('./util/util');var Action=require(_0xf58c('0xb'));var faxAccount=require(_0xf58c('0xc'));var attachment=require(_0xf58c('0xd'));var faxMessage=require(_0xf58c('0xe'));function Fax(_0x1572de){this[_0xf58c('0xf')]={};this[_0xf58c('0x10')]=_0x1572de[_0xf58c('0x10')];this['trunks']=_0x1572de[_0xf58c('0x11')];this['actions']={};ami['on'](_0xf58c('0x12'),this[_0xf58c('0x13')][_0xf58c('0x14')](this));ami['on'](_0xf58c('0x15'),this['syncVarSet'][_0xf58c('0x14')](this));ami['on'](_0xf58c('0x16'),this[_0xf58c('0x17')]['bind'](this));ami['on']('newexten',this[_0xf58c('0x18')][_0xf58c('0x14')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xf58c('0x14')](this));ami['on'](_0xf58c('0x19'),this[_0xf58c('0x1a')][_0xf58c('0x14')](this));ami['on'](_0xf58c('0x1b'),this[_0xf58c('0x1c')]['bind'](this));ami['on']('originateresponse',this[_0xf58c('0x1d')][_0xf58c('0x14')](this));}Fax[_0xf58c('0x1e')][_0xf58c('0x13')]=function(_0x4ec59d){if(_0x4ec59d[_0xf58c('0x1f')]==='from-voip-provider'){for(var _0xe864da in this[_0xf58c('0x10')]){if(this[_0xf58c('0x10')][_0xf58c('0x20')](_0xe864da)){if(_0x4ec59d['exten']===this[_0xf58c('0x10')][_0xe864da]['localstationid']){this[_0xf58c('0xf')][_0x4ec59d[_0xf58c('0x21')]]={};this['channels'][_0x4ec59d[_0xf58c('0x21')]][_0xf58c('0x22')]=_0x4ec59d[_0xf58c('0x22')];this[_0xf58c('0xf')][_0x4ec59d[_0xf58c('0x21')]]['id']=this['faxAccounts'][_0xe864da]['id'];this['channels'][_0x4ec59d[_0xf58c('0x21')]][_0xf58c('0x23')]=this['faxAccounts'][_0xe864da]['name'];logger[_0xf58c('0x24')](_0x4ec59d[_0xf58c('0x21')],_0xf58c('0x25'));}}}}if(this[_0xf58c('0x26')][_0x4ec59d[_0xf58c('0x21')]]){this[_0xf58c('0xf')][_0x4ec59d[_0xf58c('0x21')]]={};this['channels'][_0x4ec59d[_0xf58c('0x21')]][_0xf58c('0x22')]=_0x4ec59d[_0xf58c('0x22')];logger['info'](_0x4ec59d[_0xf58c('0x21')],_0xf58c('0x25'));}};Fax[_0xf58c('0x1e')][_0xf58c('0x27')]=function(_0x4697ea){if(this[_0xf58c('0xf')][_0x4697ea['uniqueid']]){for(var _0x174fc3 in _0x4697ea[_0xf58c('0x28')]){if(_0x4697ea[_0xf58c('0x28')][_0xf58c('0x20')](_0x174fc3)){this[_0xf58c('0xf')][_0x4697ea['uniqueid']][_0x174fc3]=_0x4697ea[_0xf58c('0x29')];}}}};Fax['prototype'][_0xf58c('0x17')]=function(_0x1f8160){if(this[_0xf58c('0xf')][_0x1f8160['uniqueid']]){this['channels'][_0x1f8160[_0xf58c('0x21')]]['channelstate']=_0x1f8160[_0xf58c('0x2a')];this[_0xf58c('0xf')][_0x1f8160[_0xf58c('0x21')]][_0xf58c('0x2b')]=_0x1f8160[_0xf58c('0x2b')];}};Fax['prototype']['syncNewExten']=function(_0x4d7856){if(this[_0xf58c('0xf')][_0x4d7856[_0xf58c('0x21')]]){for(var _0x1221e7 in _0x4d7856[_0xf58c('0x28')]){if(_0x4d7856['variable'][_0xf58c('0x20')](_0x1221e7)){this[_0xf58c('0xf')][_0x4d7856[_0xf58c('0x21')]][_0x1221e7]=_0x4d7856[_0xf58c('0x29')];}}}};Fax[_0xf58c('0x1e')][_0xf58c('0x2c')]=function(_0x11bcca){if(this[_0xf58c('0xf')][_0x11bcca[_0xf58c('0x21')]]){this['channels'][_0x11bcca[_0xf58c('0x21')]]['operation']=_0x11bcca['operation'];this[_0xf58c('0xf')][_0x11bcca[_0xf58c('0x21')]][_0xf58c('0x2d')]=_0x11bcca[_0xf58c('0x2d')];this[_0xf58c('0xf')][_0x11bcca[_0xf58c('0x21')]][_0xf58c('0x2e')]=_0x11bcca[_0xf58c('0x2e')];this['channels'][_0x11bcca['uniqueid']]['filename']=_0x11bcca[_0xf58c('0x2f')];logger[_0xf58c('0x24')](_0x11bcca[_0xf58c('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0xf58c('0x1e')][_0xf58c('0x1a')]=function(_0x2db0c6){var _0x241510=this;if(this[_0xf58c('0xf')][_0x2db0c6[_0xf58c('0x21')]]){var _0x38088b=this['channels'][_0x2db0c6[_0xf58c('0x21')]]['id'];this[_0xf58c('0xf')][_0x2db0c6[_0xf58c('0x21')]][_0xf58c('0x30')]=_0x2db0c6[_0xf58c('0x30')];this[_0xf58c('0xf')][_0x2db0c6['uniqueid']][_0xf58c('0x31')]=_0x2db0c6[_0xf58c('0x31')];this[_0xf58c('0xf')][_0x2db0c6['uniqueid']][_0xf58c('0x2e')]=_0x2db0c6[_0xf58c('0x2e')];this['channels'][_0x2db0c6['uniqueid']][_0xf58c('0x32')]=_0x2db0c6['resolution'];this[_0xf58c('0xf')][_0x2db0c6[_0xf58c('0x21')]]['transferrate']=_0x2db0c6[_0xf58c('0x33')];this[_0xf58c('0xf')][_0x2db0c6[_0xf58c('0x21')]][_0xf58c('0x2f')]=_0x2db0c6['filename'];this[_0xf58c('0xf')][_0x2db0c6[_0xf58c('0x21')]][_0xf58c('0x34')]=_0x2db0c6[_0xf58c('0x34')];if(this[_0xf58c('0xf')][_0x2db0c6['uniqueid']][_0xf58c('0x31')]>0x0){tiff2pdf(_0x2db0c6[_0xf58c('0x2f')],'/var/opt/motion2/server/files/attachments/',function(_0x56e518){logger['info'](_0x2db0c6['uniqueid'],_0xf58c('0x35'),_0x56e518['message']);attachment[_0xf58c('0x36')]({'name':path[_0xf58c('0x37')](_0x2db0c6['filename'])['name'],'basename':path[_0xf58c('0x37')](_0x2db0c6[_0xf58c('0x2f')])[_0xf58c('0x23')]+_0xf58c('0x38'),'type':'application/pdf'})[_0xf58c('0x39')](function(_0x1ded47){faxAccount[_0xf58c('0x3a')](_0x38088b,{'from':_0x2db0c6['calleridnum'],'mapKey':'fax','body':path['parse'](_0x2db0c6[_0xf58c('0x2f')])[_0xf58c('0x23')]+_0xf58c('0x38'),'AttachmentId':_0x1ded47['id']})[_0xf58c('0x3b')](function(_0xcd6133){logger[_0xf58c('0x3c')](_0x2db0c6[_0xf58c('0x21')],_0xf58c('0x3d'),JSON['stringify'](_0xcd6133));});})['catch'](function(_0x2abdc7){logger['error'](_0x2db0c6[_0xf58c('0x21')],_0xf58c('0x3e'),JSON[_0xf58c('0x3f')](_0x2abdc7));});});}logger[_0xf58c('0x24')](_0x2db0c6['uniqueid'],_0xf58c('0x3e'));}};Fax[_0xf58c('0x1e')][_0xf58c('0x1d')]=function(_0xc9bf6b){if(this['actions'][_0xc9bf6b[_0xf58c('0x21')]]){_[_0xf58c('0x40')](this['channels'][_0xc9bf6b['uniqueid']],_[_0xf58c('0x41')](_0xc9bf6b,['response',_0xf58c('0x42')]));}};function updateStatus(_0x8b3dbb){if(_0x8b3dbb[_0xf58c('0x43')]){faxMessage[_0xf58c('0x44')](_0x8b3dbb[_0xf58c('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x30b355){ut['logger'](_0xf58c('0x45'),_0x30b355);})[_0xf58c('0x3b')](function(_0x519775){ut[_0xf58c('0x46')](_0xf58c('0x47'),_0x519775);});}else{ut[_0xf58c('0x46')](_0xf58c('0x48'));}}Fax['prototype'][_0xf58c('0x49')]=function(_0x3126ba,_0x954997,_0x192036){var _0x2a93b6=this;var _0x7cff11={};if(_0x954997){_0x7cff11={'read':_0x954997};}else{_0x7cff11={'failMessage':_0x192036};}if(this[_0xf58c('0x26')][_0x3126ba][_0xf58c('0x43')]){faxMessage[_0xf58c('0x44')](this[_0xf58c('0x26')][_0x3126ba][_0xf58c('0x43')],_0x7cff11)[_0xf58c('0x39')](function(_0x15b182){ut['logger'](_0xf58c('0x4a'),_0x15b182);})[_0xf58c('0x3b')](function(_0x49dd81){ut[_0xf58c('0x46')]('[Fax][Message][NoUpdate1]',_0x49dd81);})[_0xf58c('0x4b')](function(){delete _0x2a93b6[_0xf58c('0xf')][_0x3126ba];delete _0x2a93b6[_0xf58c('0x26')][_0x3126ba];});}else{ut[_0xf58c('0x46')](_0xf58c('0x4c'));delete this[_0xf58c('0xf')][_0x3126ba];delete this[_0xf58c('0x26')][_0x3126ba];}};Fax[_0xf58c('0x1e')][_0xf58c('0x1c')]=function(_0x7eaf00){var _0x3448d9=this;if(this[_0xf58c('0xf')][_0x7eaf00[_0xf58c('0x21')]]){if(this[_0xf58c('0x26')][_0x7eaf00['uniqueid']]){this[_0xf58c('0xf')][_0x7eaf00[_0xf58c('0x21')]]['id']=this[_0xf58c('0x26')][_0x7eaf00[_0xf58c('0x21')]]['id'];this[_0xf58c('0xf')][_0x7eaf00['uniqueid']][_0xf58c('0x23')]=this['actions'][_0x7eaf00[_0xf58c('0x21')]][_0xf58c('0x23')];}logger[_0xf58c('0x24')](_0x7eaf00['uniqueid'],this[_0xf58c('0x26')][_0x7eaf00[_0xf58c('0x21')]]?'\x20hangup\x20sendFile\x20':_0xf58c('0x4d'),JSON[_0xf58c('0x3f')](this[_0xf58c('0xf')][_0x7eaf00[_0xf58c('0x21')]]));if(this[_0xf58c('0x26')][_0x7eaf00[_0xf58c('0x21')]]){if(this[_0xf58c('0xf')][_0x7eaf00[_0xf58c('0x21')]]['faxpages']>0x0&&this[_0xf58c('0xf')][_0x7eaf00['uniqueid']][_0xf58c('0x4e')]===_0xf58c('0x4f')){this[_0xf58c('0x49')](_0x7eaf00['uniqueid'],!![]);}else{this['updateStatus'](_0x7eaf00[_0xf58c('0x21')],![],this[_0xf58c('0xf')][_0x7eaf00[_0xf58c('0x21')]][_0xf58c('0x50')]?_0xf58c('0x51')+this[_0xf58c('0xf')][_0x7eaf00[_0xf58c('0x21')]][_0xf58c('0x50')]:_0xf58c('0x52'));}}}};Fax[_0xf58c('0x1e')][_0xf58c('0x53')]=function(_0x2dc9c3){var _0x3715d3=this;return new BPromise(function(_0x1408a1,_0x4af479){_0x3715d3[_0xf58c('0x54')](_0x2dc9c3,_0x3715d3['faxAccounts'][_0x2dc9c3[_0xf58c('0x55')]])[_0xf58c('0x39')](function(_0x143071){ut['logger'](_0xf58c('0x56'),_0x143071);_0x1408a1(ut[_0xf58c('0x57')](_0xf58c('0x58')));})[_0xf58c('0x3b')](function(_0x46ccbf){ut[_0xf58c('0x46')](_0xf58c('0x59'),_0x46ccbf);updateStatus(_0x2dc9c3);_0x4af479(ut[_0xf58c('0x57')]('Fax\x20failed'));});});};Fax[_0xf58c('0x1e')]['checkAfterSend']=function(_0x2ef739){var _0x4557d4=this;return new BPromise(function(_0x23bdde,_0x2a3847){var _0x56ad47=_0x4557d4[_0xf58c('0x5a')](_0x4557d4['faxAccounts'][_0x2ef739['FaxAccountId']][_0xf58c('0x5b')],_0x2ef739);if(_0x56ad47[_0xf58c('0x5c')]){_0x23bdde(ut[_0xf58c('0x57')](_0xf58c('0x5d')));}else{_0x2a3847(ut[_0xf58c('0x57')](_0x56ad47['message']));}});};function originate(_0x57dd23,_0x16b4f5,_0x396a03){return new BPromise(function(_0x49861c,_0xdf145e){if(_0x396a03){var _0x1f33cf=util[_0xf58c('0x5e')](_0xf58c('0x5f'),path[_0xf58c('0x37')](_0x57dd23[_0xf58c('0x4')])['name'],_0x57dd23['path']);gs[_0xf58c('0x60')](_0x1f33cf)['then'](function(){_0x57dd23[_0xf58c('0x4')]=util[_0xf58c('0x5e')](_0xf58c('0x61'),path[_0xf58c('0x37')](_0x57dd23['path'])['dir'],path['parse'](_0x57dd23[_0xf58c('0x4')])[_0xf58c('0x23')]);_0x16b4f5[_0xf58c('0x62')]=_0x57dd23['path'];ut[_0xf58c('0x46')]('Convert\x20pdf\x20to\x20tif','');ami[_0xf58c('0x63')](ut['variablesAction'](_0x57dd23,_0x16b4f5))[_0xf58c('0x39')](function(_0x942593){_0x49861c(_0x942593);})['catch'](function(_0xd831c6){_0xdf145e(_0xd831c6);});})[_0xf58c('0x3b')](function(_0x563fcf){_0xdf145e(_0x563fcf);});}else{ami[_0xf58c('0x63')](ut[_0xf58c('0x64')](_0x57dd23,_0x16b4f5))['then'](function(_0x324820){_0x49861c(_0x324820);})['catch'](function(_0x1ba17e){_0xdf145e(_0x1ba17e);});}});}Fax[_0xf58c('0x1e')][_0xf58c('0x54')]=function(_0x1aafcf,_0x24f835){var _0x3fe5eb=this;return new BPromise(function(_0x2c47a2,_0x1b4c6a){var _0xf20d1=uuid['v4']();var _0x3197dd=ut[_0xf58c('0x65')](_0x1aafcf,_0x24f835);_0x3fe5eb[_0xf58c('0x26')][_0xf20d1]=new Action(_0xf20d1,_0x24f835,_0x1aafcf);var _0x208fc0=_0x3fe5eb['actions'][_0xf20d1];if(path[_0xf58c('0x37')](_0x1aafcf['path'])['ext']==='.pdf'){originate(_0x208fc0,_0x3197dd,!![])[_0xf58c('0x39')](function(_0x17694c){_0x2c47a2(_0x17694c);})[_0xf58c('0x3b')](function(_0x25d746){_0x1b4c6a(_0x25d746);});}else{originate(_0x208fc0,_0x3197dd,![])[_0xf58c('0x39')](function(_0xb1af28){_0x2c47a2(_0xb1af28);})[_0xf58c('0x3b')](function(_0x149f10){_0x1b4c6a(_0x149f10);});}});};Fax[_0xf58c('0x1e')][_0xf58c('0x66')]=function(_0x5bc4ed){return!_[_0xf58c('0x67')](_0x5bc4ed)&&!_[_0xf58c('0x67')](_0x5bc4ed[_0xf58c('0x23')])&&!_[_0xf58c('0x67')](_0x5bc4ed[_0xf58c('0x68')])&&_0x5bc4ed['active']&&!_['isNil'](this['trunks'][util[_0xf58c('0x5e')](_0xf58c('0x69'),_0x5bc4ed[_0xf58c('0x23')])])&&!_[_0xf58c('0x67')](this['trunks'][util['format'](_0xf58c('0x69'),_0x5bc4ed['name'])][_0xf58c('0x2d')])&&(this[_0xf58c('0x11')][util['format'](_0xf58c('0x69'),_0x5bc4ed[_0xf58c('0x23')])]['status']===_0xf58c('0x6a')||this['trunks'][util[_0xf58c('0x5e')](_0xf58c('0x69'),_0x5bc4ed[_0xf58c('0x23')])][_0xf58c('0x2d')]===_0xf58c('0x6b'));};Fax[_0xf58c('0x1e')]['checkTrunk']=function(_0x3492d2,_0x16db74){if(!this['isTrunkReachable'](_0x3492d2)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x3492d2)?'':_0x3492d2[_0xf58c('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xf58c('0x67')](_0x16db74[_0xf58c('0x8')])){ut[_0xf58c('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x16db74));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xf58c('0x67')](_0x16db74[_0xf58c('0x4')])){ut[_0xf58c('0x46')](_0xf58c('0x6c'),JSON[_0xf58c('0x3f')](_0x16db74));return{'isValid':![],'message':_0xf58c('0x6d')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8d218d7..c5f4cec 100644 --- a/server/services/ami/fax/rpcDb.js +++ b/server/services/ami/fax/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42ad=['preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x320730,_0x21fff6){var _0x417eb5=function(_0x2bc4dd){while(--_0x2bc4dd){_0x320730['push'](_0x320730['shift']());}};_0x417eb5(++_0x21fff6);}(_0x42ad,0x129));var _0xd42a=function(_0x5f09d3,_0x26677c){_0x5f09d3=_0x5f09d3-0x0;var _0xd95e4d=_0x42ad[_0x5f09d3];return _0xd95e4d;};'use strict';var util=require(_0xd42a('0x0'));var BPromise=require(_0xd42a('0x1'));var logger=require(_0xd42a('0x2'))(_0xd42a('0x3'));var _=require(_0xd42a('0x4'));var faxAccount=require(_0xd42a('0x5'));function loggerCatch(_0x478ceb){return function(_0x47398c){logger[_0xd42a('0x6')](_0x478ceb,util['inspect'](_0x47398c,{'showHidden':![],'depth':null}));};}exports[_0xd42a('0x7')]=function(_0xacdfe0,_0x6cc296){return BPromise[_0xd42a('0x8')]()[_0xd42a('0x9')](faxAccount[_0xd42a('0x7')](_0xacdfe0,_0x6cc296))[_0xd42a('0xa')](loggerCatch(_0xd42a('0xb')));}; \ No newline at end of file +var _0x4bd8=['util','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify','catch'];(function(_0x365a92,_0x169dc7){var _0x3725c1=function(_0x1062b5){while(--_0x1062b5){_0x365a92['push'](_0x365a92['shift']());}};_0x3725c1(++_0x169dc7);}(_0x4bd8,0x158));var _0x84bd=function(_0x420f43,_0x2153ea){_0x420f43=_0x420f43-0x0;var _0x54a8a1=_0x4bd8[_0x420f43];return _0x54a8a1;};'use strict';var util=require(_0x84bd('0x0'));var BPromise=require('bluebird');var logger=require(_0x84bd('0x1'))(_0x84bd('0x2'));var _=require(_0x84bd('0x3'));var faxAccount=require(_0x84bd('0x4'));function loggerCatch(_0x117d76){return function(_0x104b5b){logger['error'](_0x117d76,util[_0x84bd('0x5')](_0x104b5b,{'showHidden':![],'depth':null}));};}exports[_0x84bd('0x6')]=function(_0x3bc03d,_0x4ad2e8){return BPromise['resolve']()['then'](faxAccount[_0x84bd('0x6')](_0x3bc03d,_0x4ad2e8))[_0x84bd('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 3bf8e6b..59f5988 100644 --- a/server/services/ami/fax/util/gs.js +++ b/server/services/ami/fax/util/gs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb827=['info','Exec\x20gs','inspect','../../../../config/logger','bluebird','child_process'];(function(_0x2438da,_0x3f6272){var _0x29f14e=function(_0xc9bb69){while(--_0xc9bb69){_0x2438da['push'](_0x2438da['shift']());}};_0x29f14e(++_0x3f6272);}(_0xb827,0x14d));var _0x7b82=function(_0x56c2dd,_0x3caf73){_0x56c2dd=_0x56c2dd-0x0;var _0x407447=_0xb827[_0x56c2dd];return _0x407447;};'use strict';var util=require('util');var logger=require(_0x7b82('0x0'))('fax');var BPromise=require(_0x7b82('0x1'));var exec=require(_0x7b82('0x2'))['exec'];exports['execute']=function(_0x2d4800){return new BPromise(function(_0x5183e2,_0x105220){exec(_0x2d4800,function(_0x2a8bc3,_0x6b2687,_0x4eadcb){logger[_0x7b82('0x3')](_0x7b82('0x4'),_0x6b2687);if(_0x2a8bc3){logger[_0x7b82('0x3')](_0x7b82('0x4'),'\x20Error\x20:',util[_0x7b82('0x5')](_0x2a8bc3,{'showHidden':![],'depth':null}),_0x6b2687,_0x4eadcb);_0x105220(_0x2a8bc3);}_0x5183e2(_0x6b2687);});});}; \ No newline at end of file +var _0x3b8f=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x3b8f,0x128));var _0xf3b8=function(_0x3ea506,_0x31aced){_0x3ea506=_0x3ea506-0x0;var _0x686330=_0x3b8f[_0x3ea506];return _0x686330;};'use strict';var util=require(_0xf3b8('0x0'));var logger=require('../../../../config/logger')(_0xf3b8('0x1'));var BPromise=require(_0xf3b8('0x2'));var exec=require(_0xf3b8('0x3'))[_0xf3b8('0x4')];exports[_0xf3b8('0x5')]=function(_0x57afd0){return new BPromise(function(_0x2e9dfe,_0x4cb449){exec(_0x57afd0,function(_0x5c9130,_0x2fa9fe,_0x98b169){logger[_0xf3b8('0x6')](_0xf3b8('0x7'),_0x2fa9fe);if(_0x5c9130){logger[_0xf3b8('0x6')](_0xf3b8('0x7'),_0xf3b8('0x8'),util['inspect'](_0x5c9130,{'showHidden':![],'depth':null}),_0x2fa9fe,_0x98b169);_0x4cb449(_0x5c9130);}_0x2e9dfe(_0x2fa9fe);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 5d0f86e..254ae1c 100644 --- a/server/services/ami/fax/util/util.js +++ b/server/services/ami/fax/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f7a=['inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','message','logger','info'];(function(_0x117821,_0xaa1933){var _0x4ae9ff=function(_0x253662){while(--_0x253662){_0x117821['push'](_0x117821['shift']());}};_0x4ae9ff(++_0xaa1933);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2437d4,_0x410a3e){_0x2437d4=_0x2437d4-0x0;var _0x48bfd1=_0x6f7a[_0x2437d4];return _0x48bfd1;};'use strict';var util=require(_0xa6f7('0x0'));var _=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var logger=require(_0xa6f7('0x3'))('fax');exports[_0xa6f7('0x4')]=function(_0x407de3){return{'message':_0x407de3};};exports[_0xa6f7('0x5')]=function(_0x1da6dc,_0x22e529){logger[_0xa6f7('0x6')](_0x1da6dc,util[_0xa6f7('0x7')](_0x22e529,{'showHidden':![],'depth':null}));};exports[_0xa6f7('0x8')]=function(_0x1fdd5f,_0x335aaa){var _0x1a06d1={'XMF-ECM':_0x335aaa['ecm'],'XMF-HEADERINFO':_0x335aaa['headerinfo'],'XMF-MINRATE':_0x335aaa[_0xa6f7('0x9')],'XMF-MAXRATE':_0x335aaa[_0xa6f7('0xa')],'XMF-MODEM':util[_0xa6f7('0xb')](_0xa6f7('0xc'),_0x335aaa[_0xa6f7('0xd')]),'XMF-GATEWAY':_0x335aaa['gateway'],'XMF-FAXDETECT':_0x335aaa['faxdetect'],'XMF-T38TIMEOUT':_0x335aaa[_0xa6f7('0xe')],'XMF-LOCALSTATIONID':_0x335aaa[_0xa6f7('0xf')],'XMF-PATH':_0x1fdd5f['path']};return _0x1a06d1;};exports[_0xa6f7('0x10')]=function(_0x5623bf,_0x315096){return{'actionid':_0x5623bf[_0xa6f7('0x11')],'action':_0xa6f7('0x12'),'channel':_0x5623bf[_0xa6f7('0x13')],'Exten':'xcally-motion-fax','Context':_0xa6f7('0x14'),'Priority':'1','callerid':util['format'](_0xa6f7('0x15'),_0x5623bf[_0xa6f7('0x16')]?_0x5623bf[_0xa6f7('0x16')]:'',_0x5623bf['localstationid']),'variable':_0x315096,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5623bf[_0xa6f7('0x11')]};}; \ No newline at end of file +var _0x3140=['util','lodash','moment','../../../../config/logger','logger','info','inspect','addVariables','ecm','minrate','maxrate','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo'];(function(_0x5338fe,_0x5e71d1){var _0xf0a1be=function(_0x306a01){while(--_0x306a01){_0x5338fe['push'](_0x5338fe['shift']());}};_0xf0a1be(++_0x5e71d1);}(_0x3140,0xaf));var _0x0314=function(_0x2128d3,_0x420dfa){_0x2128d3=_0x2128d3-0x0;var _0x49fa00=_0x3140[_0x2128d3];return _0x49fa00;};'use strict';var util=require(_0x0314('0x0'));var _=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var logger=require(_0x0314('0x3'))('fax');exports['message']=function(_0x285be5){return{'message':_0x285be5};};exports[_0x0314('0x4')]=function(_0x1c0f66,_0x3e4284){logger[_0x0314('0x5')](_0x1c0f66,util[_0x0314('0x6')](_0x3e4284,{'showHidden':![],'depth':null}));};exports[_0x0314('0x7')]=function(_0xf87d26,_0x11ee94){var _0x44762d={'XMF-ECM':_0x11ee94[_0x0314('0x8')],'XMF-HEADERINFO':_0x11ee94['headerinfo'],'XMF-MINRATE':_0x11ee94[_0x0314('0x9')],'XMF-MAXRATE':_0x11ee94[_0x0314('0xa')],'XMF-MODEM':util['format']('\x22%s\x22',_0x11ee94[_0x0314('0xb')]),'XMF-GATEWAY':_0x11ee94['gateway'],'XMF-FAXDETECT':_0x11ee94[_0x0314('0xc')],'XMF-T38TIMEOUT':_0x11ee94[_0x0314('0xd')],'XMF-LOCALSTATIONID':_0x11ee94[_0x0314('0xe')],'XMF-PATH':_0xf87d26[_0x0314('0xf')]};return _0x44762d;};exports[_0x0314('0x10')]=function(_0x3e9964,_0x516448){return{'actionid':_0x3e9964[_0x0314('0x11')],'action':_0x0314('0x12'),'channel':_0x3e9964[_0x0314('0x13')],'Exten':_0x0314('0x14'),'Context':_0x0314('0x15'),'Priority':'1','callerid':util[_0x0314('0x16')](_0x0314('0x17'),_0x3e9964['headerinfo']?_0x3e9964[_0x0314('0x18')]:'',_0x3e9964[_0x0314('0xe')]),'variable':_0x516448,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3e9964[_0x0314('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e260eb9..8db4d70 100644 --- a/server/services/ami/index.js +++ b/server/services/ami/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eba=['log','sync','bluebird','util','moment','./server','./realtime','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports'];(function(_0x275e86,_0x1f3b87){var _0x91cb88=function(_0x26f959){while(--_0x26f959){_0x275e86['push'](_0x275e86['shift']());}};_0x91cb88(++_0x1f3b87);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x1eba[_0x1d5400];return _0x21d9fe;};'use strict';var BPromise=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var server=require(_0xa1eb('0x3'));var Realtime=require(_0xa1eb('0x4'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xa1eb('0x5'));var Dialer=require(_0xa1eb('0x6'));var Preview=require(_0xa1eb('0x7'));var Fax=require(_0xa1eb('0x8'));var user=require(_0xa1eb('0x9'));var voiceQueue=require(_0xa1eb('0xa'));var voiceQueueReport=require(_0xa1eb('0xb'));var voiceCallReport=require(_0xa1eb('0xc'));var trunk=require(_0xa1eb('0xd'));var trigger=require(_0xa1eb('0xe'));var template=require(_0xa1eb('0xf'));var cmHopperHistory=require(_0xa1eb('0x10'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xa1eb('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xa1eb('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xa1eb('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xa1eb('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xa1eb('0x15'));var freshsales=require(_0xa1eb('0x16'));var servicenow=require(_0xa1eb('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa1eb('0x18')](_0xa1eb('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xa1eb('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0xa1eb('0x1a')]())['then'](realtime[_0xa1eb('0x1b')]())[_0xa1eb('0x1c')](user[_0xa1eb('0x1d')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x1e')]())[_0xa1eb('0x1c')](trunk[_0xa1eb('0x1f')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x20')]())['then'](voiceQueue[_0xa1eb('0x21')]())['then'](realtime[_0xa1eb('0x22')]())[_0xa1eb('0x1c')](trigger[_0xa1eb('0x23')]())[_0xa1eb('0x1c')](realtime['initTriggers']())[_0xa1eb('0x1c')](template[_0xa1eb('0x24')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x25')]())[_0xa1eb('0x1c')](zendesk[_0xa1eb('0x26')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x27')]())['then'](salesforce[_0xa1eb('0x28')]())['then'](realtime[_0xa1eb('0x29')]())[_0xa1eb('0x1c')](sugarcrm[_0xa1eb('0x2a')]())[_0xa1eb('0x1c')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xa1eb('0x2b')]())[_0xa1eb('0x1c')](realtime['initFreshdeskAccounts']())[_0xa1eb('0x1c')](desk[_0xa1eb('0x2c')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x2d')]())[_0xa1eb('0x1c')](zoho[_0xa1eb('0x2e')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x2f')]())[_0xa1eb('0x1c')](vtiger[_0xa1eb('0x30')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x31')]())['then'](freshsales[_0xa1eb('0x32')]())[_0xa1eb('0x1c')](realtime['initFreshsalesAccounts']())[_0xa1eb('0x1c')](servicenow['getServicenowAccounts']())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x33')]())['then'](dynamics365[_0xa1eb('0x34')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x35')]())['then'](campaign[_0xa1eb('0x36')]())[_0xa1eb('0x1c')](realtime['initCampaigns']())[_0xa1eb('0x1c')](voiceExtension[_0xa1eb('0x37')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x38')]())[_0xa1eb('0x1c')](faxAccount['getFaxAccounts']())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x39')]())[_0xa1eb('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xa1eb('0x3a')]()[_0xa1eb('0x1c')](voiceQueueReport[_0xa1eb('0x3b')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x3c')]())[_0xa1eb('0x1c')](cmHopperHistory[_0xa1eb('0x3d')]())[_0xa1eb('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xa1eb('0x3e')]())[_0xa1eb('0x1c')](realtime[_0xa1eb('0x3f')]())[_0xa1eb('0x1c')](voiceCallReport[_0xa1eb('0x40')]())['then'](realtime['initVoiceCallReports']())[_0xa1eb('0x1c')](function(_0x2d2890){})['catch'](function(_0x48b23d){console[_0xa1eb('0x41')](_0x48b23d);});}function main(){return server['listen'](realtime,preview,fax)[_0xa1eb('0x1c')](function(_0x534fe4){return initRealtime();})[_0xa1eb('0x1c')](function(){return initParams();})[_0xa1eb('0x1c')](function(){report[_0xa1eb('0x42')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x355839){console[_0xa1eb('0x41')](_0x355839);});}main(); \ No newline at end of file +var _0x0abf=['initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','bluebird','moment','./server','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks'];(function(_0x367054,_0x1debc3){var _0x472454=function(_0x3f4ea7){while(--_0x3f4ea7){_0x367054['push'](_0x367054['shift']());}};_0x472454(++_0x1debc3);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var server=require(_0xf0ab('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xf0ab('0x3'));var Trigger=require('./trigger');var Dialer=require(_0xf0ab('0x4'));var Preview=require(_0xf0ab('0x5'));var Fax=require(_0xf0ab('0x6'));var user=require(_0xf0ab('0x7'));var voiceQueue=require(_0xf0ab('0x8'));var voiceQueueReport=require(_0xf0ab('0x9'));var voiceCallReport=require(_0xf0ab('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xf0ab('0xb'));var template=require(_0xf0ab('0xc'));var cmHopperHistory=require(_0xf0ab('0xd'));var campaign=require(_0xf0ab('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf0ab('0xf'));var zendesk=require(_0xf0ab('0x10'));var salesforce=require(_0xf0ab('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xf0ab('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xf0ab('0x13'));var freshsales=require(_0xf0ab('0x14'));var servicenow=require(_0xf0ab('0x15'));var dynamics365=require(_0xf0ab('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf0ab('0x17')](_0xf0ab('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf0ab('0x17')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf0ab('0x19')]()[_0xf0ab('0x1a')](user[_0xf0ab('0x1b')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x1c')]())[_0xf0ab('0x1a')](user[_0xf0ab('0x1d')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x1e')]())[_0xf0ab('0x1a')](trunk[_0xf0ab('0x1f')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x20')]())[_0xf0ab('0x1a')](voiceQueue[_0xf0ab('0x21')]())['then'](realtime[_0xf0ab('0x22')]())[_0xf0ab('0x1a')](trigger[_0xf0ab('0x23')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x24')]())[_0xf0ab('0x1a')](template[_0xf0ab('0x25')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x26')]())[_0xf0ab('0x1a')](zendesk[_0xf0ab('0x27')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x28')]())[_0xf0ab('0x1a')](salesforce[_0xf0ab('0x29')]())[_0xf0ab('0x1a')](realtime['initSalesforceAccounts']())[_0xf0ab('0x1a')](sugarcrm[_0xf0ab('0x2a')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x2b')]())[_0xf0ab('0x1a')](freshdesk[_0xf0ab('0x2c')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x2d')]())[_0xf0ab('0x1a')](desk[_0xf0ab('0x2e')]())[_0xf0ab('0x1a')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0xf0ab('0x1a')](realtime['initZohoAccounts']())[_0xf0ab('0x1a')](vtiger[_0xf0ab('0x2f')]())['then'](realtime[_0xf0ab('0x30')]())[_0xf0ab('0x1a')](freshsales[_0xf0ab('0x31')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x32')]())['then'](servicenow[_0xf0ab('0x33')]())['then'](realtime['initServicenowAccounts']())[_0xf0ab('0x1a')](dynamics365[_0xf0ab('0x34')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x35')]())[_0xf0ab('0x1a')](campaign[_0xf0ab('0x36')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x37')]())[_0xf0ab('0x1a')](voiceExtension[_0xf0ab('0x38')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x39')]())['then'](faxAccount[_0xf0ab('0x3a')]())[_0xf0ab('0x1a')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xf0ab('0x19')]()[_0xf0ab('0x1a')](voiceQueueReport[_0xf0ab('0x3b')]())['then'](realtime['initVoiceQueueReports']())[_0xf0ab('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xf0ab('0x1a')](realtime['initVoiceQueueHopperHistory']())[_0xf0ab('0x1a')](cmHopperHistory[_0xf0ab('0x3c')]())['then'](realtime['initCampaignHopperHistory']())[_0xf0ab('0x1a')](voiceCallReport[_0xf0ab('0x3d')]())[_0xf0ab('0x1a')](realtime[_0xf0ab('0x3e')]())[_0xf0ab('0x1a')](function(_0x36195d){})[_0xf0ab('0x3f')](function(_0xf8f0f4){console[_0xf0ab('0x40')](_0xf8f0f4);});}function main(){return server[_0xf0ab('0x41')](realtime,preview,fax)[_0xf0ab('0x1a')](function(_0x2ad3e2){return initRealtime();})[_0xf0ab('0x1a')](function(){return initParams();})[_0xf0ab('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xf0ab('0x3f')](function(_0x45c449){console[_0xf0ab('0x40')](_0x45c449);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index a1eddcd..220a57c 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3a6=['phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','format','stateTime','stringify','emit','user:save','user:presence','exports','lodash','util','moment','md5','ioredis','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','address'];(function(_0x502c7b,_0x37231a){var _0x50eaa1=function(_0x25eae7){while(--_0x25eae7){_0x502c7b['push'](_0x502c7b['shift']());}};_0x50eaa1(++_0x37231a);}(_0xe3a6,0x151));var _0x6e3a=function(_0x3b1c91,_0x5215e1){_0x3b1c91=_0x3b1c91-0x0;var _0x1ba0ea=_0xe3a6[_0x3b1c91];return _0x1ba0ea;};'use strict';var _=require(_0x6e3a('0x0'));var util=require(_0x6e3a('0x1'));var moment=require(_0x6e3a('0x2'));var md5=require(_0x6e3a('0x3'));var Redis=require(_0x6e3a('0x4'));var config=require('../../../config/environment');config[_0x6e3a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6e3a('0x6'))(new Redis(config['redis']));function Agent(_0x4b0fdb){this['id']=_0x4b0fdb['id']||0x0;this[_0x6e3a('0x7')]=_0x4b0fdb['name']||'';this['email']=_0x4b0fdb[_0x6e3a('0x8')]||'';this['accountcode']=_0x4b0fdb[_0x6e3a('0x9')]||'';this[_0x6e3a('0xa')]=_0x4b0fdb[_0x6e3a('0xa')]||'';this[_0x6e3a('0xb')]=_0x6e3a('0xc');this['stateTime']=0x0;this['status']=_0x6e3a('0xc');this[_0x6e3a('0xd')]='';this[_0x6e3a('0xe')]='';this[_0x6e3a('0xf')]='';this[_0x6e3a('0x10')]='';this[_0x6e3a('0x11')]=_0x4b0fdb[_0x6e3a('0x11')]||![];this['voiceStatus']=_0x6e3a('0xc');this[_0x6e3a('0x12')]=0x0;this[_0x6e3a('0x13')]='';this[_0x6e3a('0x14')]='';this[_0x6e3a('0x15')]=![];this[_0x6e3a('0x16')]=![];this[_0x6e3a('0x3')]='';}Agent[_0x6e3a('0x17')][_0x6e3a('0x18')]=function(_0x424b93){var _0x2299fe;if(_0x424b93&&_0x424b93[_0x6e3a('0xb')]){_0x2299fe=_0x424b93[_0x6e3a('0xb')][_0x6e3a('0x19')]();switch(_0x2299fe){case _0x6e3a('0x1a'):_0x2299fe=_0x6e3a('0x1b');break;case _0x6e3a('0x1c'):_0x2299fe=_0x6e3a('0x1d');break;}}if(_0x2299fe&&this[_0x6e3a('0x1e')]!==_0x2299fe||_0x424b93[_0x6e3a('0x1f')]){this[_0x6e3a('0x12')]=_['toNumber'](moment()[_0x6e3a('0x20')]('x'));}if(_0x2299fe){this[_0x6e3a('0x1e')]=_0x2299fe;}var _0x4ce05c={'id':this['id'],'name':this[_0x6e3a('0x7')],'email':this[_0x6e3a('0x8')],'accountcode':this['accountcode'],'fullname':this[_0x6e3a('0xa')],'state':this['state'],'stateTime':this[_0x6e3a('0x21')],'status':this['status'],'address':this[_0x6e3a('0xd')],'online':this[_0x6e3a('0x11')],'voiceStatus':this[_0x6e3a('0x1e')],'voiceStatusTime':this[_0x6e3a('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e3a('0x14')],'interface':this[_0x6e3a('0x10')],'onhold':this[_0x6e3a('0x15')]};var _0x3bbf04=md5(JSON[_0x6e3a('0x22')](_0x4ce05c));if(this[_0x6e3a('0x3')]!==_0x3bbf04){this[_0x6e3a('0x3')]=_0x3bbf04;io['to'](util[_0x6e3a('0x20')]('user:%s',_0x4ce05c[_0x6e3a('0x7')]))[_0x6e3a('0x23')](_0x6e3a('0x24'),_0x4ce05c);io[_0x6e3a('0x23')](_0x6e3a('0x25'),_0x4ce05c);}};module[_0x6e3a('0x26')]=Agent; \ No newline at end of file +var _0xab53=['updateStatusRealtime','idle','inuse','talking','statePause','toNumber','voiceStatusCallerIdNumber','interface','onhold','format','user:%s','emit','user:save','user:presence','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','md5','prototype'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xab53,0x1b1));var _0x3ab5=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xab53[_0x49c057];return _0xd8f0e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require(_0x3ab5('0x0'));var config=require(_0x3ab5('0x1'));config[_0x3ab5('0x2')]=_[_0x3ab5('0x3')](config[_0x3ab5('0x2')],{'host':_0x3ab5('0x4'),'port':0x18eb});var io=require(_0x3ab5('0x5'))(new Redis(config[_0x3ab5('0x2')]));function Agent(_0x1bf7b0){this['id']=_0x1bf7b0['id']||0x0;this[_0x3ab5('0x6')]=_0x1bf7b0[_0x3ab5('0x6')]||'';this[_0x3ab5('0x7')]=_0x1bf7b0[_0x3ab5('0x7')]||'';this[_0x3ab5('0x8')]=_0x1bf7b0[_0x3ab5('0x8')]||'';this[_0x3ab5('0x9')]=_0x1bf7b0[_0x3ab5('0x9')]||'';this[_0x3ab5('0xa')]=_0x3ab5('0xb');this[_0x3ab5('0xc')]=0x0;this[_0x3ab5('0xd')]='unknown';this[_0x3ab5('0xe')]='';this[_0x3ab5('0xf')]='';this[_0x3ab5('0x10')]='';this['interface']='';this[_0x3ab5('0x11')]=_0x1bf7b0['online']||![];this[_0x3ab5('0x12')]=_0x3ab5('0xb');this[_0x3ab5('0x13')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x3ab5('0x14')]='';this['onhold']=![];this['local']=![];this[_0x3ab5('0x15')]='';}Agent[_0x3ab5('0x16')][_0x3ab5('0x17')]=function(_0x283f33){var _0x29e309;if(_0x283f33&&_0x283f33[_0x3ab5('0xa')]){_0x29e309=_0x283f33['state']['toLowerCase']();switch(_0x29e309){case'not_inuse':_0x29e309=_0x3ab5('0x18');break;case _0x3ab5('0x19'):_0x29e309=_0x3ab5('0x1a');break;}}if(_0x29e309&&this[_0x3ab5('0x12')]!==_0x29e309||_0x283f33[_0x3ab5('0x1b')]){this[_0x3ab5('0x13')]=_[_0x3ab5('0x1c')](moment()['format']('x'));}if(_0x29e309){this[_0x3ab5('0x12')]=_0x29e309;}var _0x40812d={'id':this['id'],'name':this[_0x3ab5('0x6')],'email':this[_0x3ab5('0x7')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x3ab5('0xe')],'online':this[_0x3ab5('0x11')],'voiceStatus':this[_0x3ab5('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x3ab5('0x1d')],'voiceStatusQueue':this[_0x3ab5('0x14')],'interface':this[_0x3ab5('0x1e')],'onhold':this[_0x3ab5('0x1f')]};var _0x396ccf=md5(JSON['stringify'](_0x40812d));if(this[_0x3ab5('0x15')]!==_0x396ccf){this[_0x3ab5('0x15')]=_0x396ccf;io['to'](util[_0x3ab5('0x20')](_0x3ab5('0x21'),_0x40812d['name']))[_0x3ab5('0x22')](_0x3ab5('0x23'),_0x40812d);io[_0x3ab5('0x22')](_0x3ab5('0x24'),_0x40812d);}};module[_0x3ab5('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8595f4c..2680415 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x414c=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x3b06f2,_0x44187e){var _0x4bf8f4=function(_0x4e6538){while(--_0x4e6538){_0x3b06f2['push'](_0x3b06f2['shift']());}};_0x4bf8f4(++_0x44187e);}(_0x414c,0xda));var _0xc414=function(_0x53e53a,_0x4f2f08){_0x53e53a=_0x53e53a-0x0;var _0x4fe936=_0x414c[_0x53e53a];return _0x4fe936;};'use strict';function Campaign(_0x2cfb6c){this['id']=_0x2cfb6c['id']||0x0;this[_0xc414('0x0')]=_0x2cfb6c[_0xc414('0x0')]||'';this[_0xc414('0x1')]=_0x2cfb6c[_0xc414('0x1')]||_0xc414('0x2');this[_0xc414('0x3')]=0x0;this[_0xc414('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xc414('0x5')]=0x0;this[_0xc414('0x6')]='';this[_0xc414('0x7')]=!![];this[_0xc414('0x8')]=_0x2cfb6c[_0xc414('0x8')];this[_0xc414('0x9')]=_0x2cfb6c['limitCalls'];this[_0xc414('0xa')]=_0x2cfb6c[_0xc414('0xa')]||null;this['dialGlobalInterval']=_0x2cfb6c[_0xc414('0xb')]?_0x2cfb6c['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x2cfb6c[_0xc414('0xc')];this['dialOriginateCallerIdNumber']=_0x2cfb6c[_0xc414('0xd')];this[_0xc414('0xe')]=_0x2cfb6c[_0xc414('0xe')]||0x1e;this[_0xc414('0xf')]=_0x2cfb6c[_0xc414('0xf')];this[_0xc414('0x10')]=_0x2cfb6c[_0xc414('0x10')];this[_0xc414('0x11')]=_0x2cfb6c[_0xc414('0x11')];this['dialBusyRetryFrequency']=_0x2cfb6c['dialBusyRetryFrequency'];this[_0xc414('0x12')]=_0x2cfb6c[_0xc414('0x12')];this['dialNoAnswerRetryFrequency']=_0x2cfb6c['dialNoAnswerRetryFrequency'];this[_0xc414('0x13')]=_0x2cfb6c[_0xc414('0x13')];this[_0xc414('0x14')]=_0x2cfb6c[_0xc414('0x14')]||0x3;this[_0xc414('0x15')]=_0x2cfb6c[_0xc414('0x15')]||0x96;this[_0xc414('0x16')]=_0x2cfb6c[_0xc414('0x16')]||0x3;this[_0xc414('0x17')]=_0x2cfb6c[_0xc414('0x17')]||0x96;this[_0xc414('0x18')]=_0x2cfb6c[_0xc414('0x18')]||0x3;this[_0xc414('0x19')]=_0x2cfb6c[_0xc414('0x19')]||0x96;this[_0xc414('0x1a')]=_0x2cfb6c['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2cfb6c[_0xc414('0x1b')]||0x96;this[_0xc414('0x1c')]=_0x2cfb6c[_0xc414('0x1c')]||0x3;this[_0xc414('0x1d')]=_0x2cfb6c[_0xc414('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x2cfb6c[_0xc414('0x1e')]||'DESC';this[_0xc414('0x1f')]=_0x2cfb6c['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2cfb6c[_0xc414('0x20')]||undefined;this[_0xc414('0x21')]=_0x2cfb6c[_0xc414('0x21')]||undefined;this[_0xc414('0x22')]=_0x2cfb6c[_0xc414('0x22')]?_0x2cfb6c[_0xc414('0x22')]:undefined;this[_0xc414('0x23')]=_0x2cfb6c[_0xc414('0x23')]?_0x2cfb6c[_0xc414('0x23')]:undefined;this['Interval']=_0x2cfb6c[_0xc414('0x24')]?_0x2cfb6c[_0xc414('0x24')]:undefined;this[_0xc414('0x25')]=_0x2cfb6c[_0xc414('0x25')]?_0x2cfb6c['SquareProject']:undefined;this[_0xc414('0x26')]=_0x2cfb6c[_0xc414('0x25')]?_0x2cfb6c[_0xc414('0x25')][_0xc414('0x0')]:undefined;this['dialAMDActive']=_0x2cfb6c[_0xc414('0x27')]||![];this[_0xc414('0x28')]=_0x2cfb6c[_0xc414('0x28')];this[_0xc414('0x29')]=_0x2cfb6c[_0xc414('0x29')];this[_0xc414('0x2a')]=_0x2cfb6c[_0xc414('0x2a')];this[_0xc414('0x2b')]=_0x2cfb6c[_0xc414('0x2b')];this[_0xc414('0x2c')]=_0x2cfb6c[_0xc414('0x2c')];this['dialAMDBetweenWordsSilence']=_0x2cfb6c[_0xc414('0x2d')];this[_0xc414('0x2e')]=_0x2cfb6c[_0xc414('0x2e')];this[_0xc414('0x2f')]=_0x2cfb6c[_0xc414('0x2f')];this['dialAMDMaximumWordLength']=_0x2cfb6c['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x4552=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','dialQueueProject','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls'];(function(_0x576278,_0xc6119a){var _0x59927e=function(_0x215be4){while(--_0x215be4){_0x576278['push'](_0x576278['shift']());}};_0x59927e(++_0xc6119a);}(_0x4552,0x1eb));var _0x2455=function(_0x56d5cf,_0x45f717){_0x56d5cf=_0x56d5cf-0x0;var _0x19d020=_0x4552[_0x56d5cf];return _0x19d020;};'use strict';function Campaign(_0x99d2a1){this['id']=_0x99d2a1['id']||0x0;this[_0x2455('0x0')]=_0x99d2a1[_0x2455('0x0')]||'';this['type']=_0x99d2a1[_0x2455('0x1')]||_0x2455('0x2');this['originated']=0x0;this[_0x2455('0x3')]=0x0;this[_0x2455('0x4')]=0x0;this[_0x2455('0x5')]=0x0;this['message']='';this[_0x2455('0x6')]=!![];this[_0x2455('0x7')]=_0x99d2a1[_0x2455('0x7')];this[_0x2455('0x8')]=_0x99d2a1['limitCalls'];this['dialTimezone']=_0x99d2a1['dialTimezone']||null;this[_0x2455('0x9')]=_0x99d2a1[_0x2455('0x9')]?_0x99d2a1[_0x2455('0x9')]:null;this[_0x2455('0xa')]=_0x99d2a1[_0x2455('0xa')];this['dialOriginateCallerIdNumber']=_0x99d2a1[_0x2455('0xb')];this['dialOriginateTimeout']=_0x99d2a1[_0x2455('0xc')]||0x1e;this[_0x2455('0xd')]=_0x99d2a1['dialCongestionMaxRetry'];this[_0x2455('0xe')]=_0x99d2a1[_0x2455('0xe')];this['dialBusyMaxRetry']=_0x99d2a1[_0x2455('0xf')];this[_0x2455('0x10')]=_0x99d2a1[_0x2455('0x10')];this[_0x2455('0x11')]=_0x99d2a1[_0x2455('0x11')];this[_0x2455('0x12')]=_0x99d2a1[_0x2455('0x12')];this[_0x2455('0x13')]=_0x99d2a1[_0x2455('0x13')];this['dialNoSuchNumberMaxRetry']=_0x99d2a1[_0x2455('0x14')]||0x3;this[_0x2455('0x15')]=_0x99d2a1[_0x2455('0x15')]||0x96;this[_0x2455('0x16')]=_0x99d2a1[_0x2455('0x16')]||0x3;this['dialDropRetryFrequency']=_0x99d2a1[_0x2455('0x17')]||0x96;this[_0x2455('0x18')]=_0x99d2a1['dialAbandonedMaxRetry']||0x3;this[_0x2455('0x19')]=_0x99d2a1[_0x2455('0x19')]||0x96;this['dialMachineMaxRetry']=_0x99d2a1['dialMachineMaxRetry']||0x3;this[_0x2455('0x1a')]=_0x99d2a1['dialMachineRetryFrequency']||0x96;this[_0x2455('0x1b')]=_0x99d2a1[_0x2455('0x1b')]||0x3;this[_0x2455('0x1c')]=_0x99d2a1[_0x2455('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x99d2a1[_0x2455('0x1d')]||_0x2455('0x1e');this[_0x2455('0x1f')]=_0x99d2a1['dialPrefix']||undefined;this[_0x2455('0x20')]=_0x99d2a1[_0x2455('0x20')]||undefined;this[_0x2455('0x21')]=_0x99d2a1[_0x2455('0x21')]||undefined;this[_0x2455('0x22')]=_0x99d2a1[_0x2455('0x22')]?_0x99d2a1['TrunkBackup']:undefined;this['Trunk']=_0x99d2a1[_0x2455('0x23')]?_0x99d2a1[_0x2455('0x23')]:undefined;this[_0x2455('0x24')]=_0x99d2a1['Interval']?_0x99d2a1[_0x2455('0x24')]:undefined;this['SquareProject']=_0x99d2a1['SquareProject']?_0x99d2a1['SquareProject']:undefined;this[_0x2455('0x25')]=_0x99d2a1[_0x2455('0x26')]?_0x99d2a1[_0x2455('0x26')]['name']:undefined;this[_0x2455('0x27')]=_0x99d2a1[_0x2455('0x27')]||![];this[_0x2455('0x28')]=_0x99d2a1[_0x2455('0x28')];this[_0x2455('0x29')]=_0x99d2a1[_0x2455('0x29')];this[_0x2455('0x2a')]=_0x99d2a1[_0x2455('0x2a')];this[_0x2455('0x2b')]=_0x99d2a1[_0x2455('0x2b')];this[_0x2455('0x2c')]=_0x99d2a1[_0x2455('0x2c')];this['dialAMDBetweenWordsSilence']=_0x99d2a1[_0x2455('0x2d')];this[_0x2455('0x2e')]=_0x99d2a1[_0x2455('0x2e')];this[_0x2455('0x2f')]=_0x99d2a1[_0x2455('0x2f')];this[_0x2455('0x30')]=_0x99d2a1[_0x2455('0x30')];}module[_0x2455('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 7978af6..c3dae11 100644 --- a/server/services/ami/model/channel.js +++ b/server/services/ami/model/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06e6=['abandoned','lastapplication','lastdata','duration','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x06e6,0xb0));var _0x606e=function(_0xfc9121,_0x38e193){_0xfc9121=_0xfc9121-0x0;var _0x4e9f47=_0x06e6[_0xfc9121];return _0x4e9f47;};'use strict';function Channel(){this[_0x606e('0x0')]=null;this[_0x606e('0x1')]='';this[_0x606e('0x2')]='';this[_0x606e('0x3')]=0x0;this[_0x606e('0x4')]='';this[_0x606e('0x5')]=undefined;this[_0x606e('0x6')]=undefined;this[_0x606e('0x7')]=0x0;this[_0x606e('0x8')]='';this['uniqueid']=0x0;this[_0x606e('0x9')]=0x0;this[_0x606e('0xa')]=0x0;this['answered']=![];this[_0x606e('0xb')]=null;this[_0x606e('0xc')]=null;this['unmanaged']=![];this[_0x606e('0xd')]=![];this[_0x606e('0xe')]='';this[_0x606e('0xf')]='';this[_0x606e('0x10')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x606e('0x11')]=null;this['tag']=null;this[_0x606e('0x12')]=null;this[_0x606e('0x13')]=![];this[_0x606e('0x14')]=null;this[_0x606e('0x15')]=null;this[_0x606e('0x16')]=[];this[_0x606e('0x17')]=undefined;this[_0x606e('0x18')]=undefined;this[_0x606e('0x19')]=undefined;this[_0x606e('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xafa2=['disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag'];(function(_0x13db30,_0x536d8c){var _0x2980c7=function(_0x3704c3){while(--_0x3704c3){_0x13db30['push'](_0x13db30['shift']());}};_0x2980c7(++_0x536d8c);}(_0xafa2,0xfb));var _0x2afa=function(_0x425da9,_0x29015f){_0x425da9=_0x425da9-0x0;var _0x593136=_0xafa2[_0x425da9];return _0x593136;};'use strict';function Channel(){this[_0x2afa('0x0')]=null;this['channel']='';this[_0x2afa('0x1')]='';this[_0x2afa('0x2')]=0x0;this[_0x2afa('0x3')]='';this['connectedlinenum']=undefined;this[_0x2afa('0x4')]=undefined;this[_0x2afa('0x5')]=0x0;this['context']='';this[_0x2afa('0x6')]=0x0;this[_0x2afa('0x7')]=0x0;this[_0x2afa('0x8')]=0x0;this[_0x2afa('0x9')]=![];this[_0x2afa('0xa')]=null;this['endtime']=null;this[_0x2afa('0xb')]=![];this[_0x2afa('0xc')]=![];this[_0x2afa('0xd')]='';this[_0x2afa('0xe')]='';this[_0x2afa('0xf')]=0x0;this[_0x2afa('0x10')]=0x0;this[_0x2afa('0x11')]=0x0;this['type']=null;this[_0x2afa('0x12')]=null;this[_0x2afa('0x13')]=null;this['monitor']=![];this[_0x2afa('0x14')]=null;this[_0x2afa('0x15')]=null;this['monitors']=[];this[_0x2afa('0x16')]=undefined;this[_0x2afa('0x17')]=undefined;this[_0x2afa('0x18')]=undefined;this[_0x2afa('0x19')]=0x0;}module[_0x2afa('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b7b303b..c61815a 100644 --- a/server/services/ami/model/deskAccount.js +++ b/server/services/ami/model/deskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4403=['serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4403,0x179));var _0x3440=function(_0x3e0394,_0x3226a9){_0x3e0394=_0x3e0394-0x0;var _0x5c7b14=_0x4403[_0x3e0394];return _0x5c7b14;};'use strict';function DeskAccount(_0x5e2430){this['id']=_0x5e2430['id']||0x0;this['name']=_0x5e2430['name']||'';this[_0x3440('0x0')]=_0x5e2430['username']||'';this[_0x3440('0x1')]=_0x5e2430[_0x3440('0x1')]||'';this[_0x3440('0x2')]=_0x5e2430[_0x3440('0x2')]||'';this['password']=_0x5e2430[_0x3440('0x3')]||'';this['consumerKey']=_0x5e2430['consumerKey']||'';this[_0x3440('0x4')]=_0x5e2430[_0x3440('0x4')]||'';this[_0x3440('0x5')]=_0x5e2430['token']||'';this[_0x3440('0x6')]=_0x5e2430['tokenSecret']||'';this[_0x3440('0x7')]=_0x5e2430[_0x3440('0x7')]||'';this[_0x3440('0x8')]=_0x5e2430['serverUrl']||'';this[_0x3440('0x9')]=_0x5e2430[_0x3440('0x9')]||{};}module[_0x3440('0xa')]=DeskAccount; \ No newline at end of file +var _0x1782=['consumerKey','consumerSecret','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x1782,0x188));var _0x2178=function(_0x1e6460,_0x4127e4){_0x1e6460=_0x1e6460-0x0;var _0x5e5316=_0x1782[_0x1e6460];return _0x5e5316;};'use strict';function DeskAccount(_0x36ff70){this['id']=_0x36ff70['id']||0x0;this[_0x2178('0x0')]=_0x36ff70[_0x2178('0x0')]||'';this['username']=_0x36ff70['username']||'';this[_0x2178('0x1')]=_0x36ff70['remoteUri']||'';this[_0x2178('0x2')]=_0x36ff70[_0x2178('0x2')]||'';this['password']=_0x36ff70[_0x2178('0x3')]||'';this['consumerKey']=_0x36ff70[_0x2178('0x4')]||'';this[_0x2178('0x5')]=_0x36ff70[_0x2178('0x5')]||'';this['token']=_0x36ff70['token']||'';this[_0x2178('0x6')]=_0x36ff70[_0x2178('0x6')]||'';this[_0x2178('0x7')]=_0x36ff70[_0x2178('0x7')]||'';this[_0x2178('0x8')]=_0x36ff70[_0x2178('0x8')]||'';this['Configurations']=_0x36ff70[_0x2178('0x9')]||{};}module[_0x2178('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index bcd0a27..9c1eac0 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a80=['username','password','remoteUri','clientId','clientSecret','serverUrl','Configurations','exports','name'];(function(_0x8d8e9c,_0x4ae2ca){var _0x4b64c1=function(_0x540830){while(--_0x540830){_0x8d8e9c['push'](_0x8d8e9c['shift']());}};_0x4b64c1(++_0x4ae2ca);}(_0x0a80,0xc5));var _0x00a8=function(_0x242755,_0x5d109d){_0x242755=_0x242755-0x0;var _0x2914e3=_0x0a80[_0x242755];return _0x2914e3;};'use strict';function Dynamics365Account(_0x2dd7ef){this['id']=_0x2dd7ef['id']||0x0;this[_0x00a8('0x0')]=_0x2dd7ef['name']||'';this[_0x00a8('0x1')]=_0x2dd7ef[_0x00a8('0x1')]||'';this[_0x00a8('0x2')]=_0x2dd7ef[_0x00a8('0x2')]||'';this[_0x00a8('0x3')]=_0x2dd7ef['remoteUri']||'';this['tenantId']=_0x2dd7ef['tenantId']||'';this[_0x00a8('0x4')]=_0x2dd7ef[_0x00a8('0x4')]||'';this[_0x00a8('0x5')]=_0x2dd7ef['clientSecret']||{};this[_0x00a8('0x6')]=_0x2dd7ef[_0x00a8('0x6')]||'';this[_0x00a8('0x7')]=_0x2dd7ef['Configurations']||{};}module[_0x00a8('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x05a3=['serverUrl','Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x4bd5de,_0x48635b){var _0x42782c=function(_0x34d865){while(--_0x34d865){_0x4bd5de['push'](_0x4bd5de['shift']());}};_0x42782c(++_0x48635b);}(_0x05a3,0x146));var _0x305a=function(_0x1ffb1c,_0x1d6dec){_0x1ffb1c=_0x1ffb1c-0x0;var _0x19c3dc=_0x05a3[_0x1ffb1c];return _0x19c3dc;};'use strict';function Dynamics365Account(_0x26582a){this['id']=_0x26582a['id']||0x0;this[_0x305a('0x0')]=_0x26582a[_0x305a('0x0')]||'';this[_0x305a('0x1')]=_0x26582a['username']||'';this['password']=_0x26582a[_0x305a('0x2')]||'';this[_0x305a('0x3')]=_0x26582a[_0x305a('0x3')]||'';this[_0x305a('0x4')]=_0x26582a[_0x305a('0x4')]||'';this['clientId']=_0x26582a[_0x305a('0x5')]||'';this[_0x305a('0x6')]=_0x26582a[_0x305a('0x6')]||{};this[_0x305a('0x7')]=_0x26582a[_0x305a('0x7')]||'';this['Configurations']=_0x26582a[_0x305a('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 7cf0dff..66d9486 100644 --- a/server/services/ami/model/faxAccount.js +++ b/server/services/ami/model/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd889=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports'];(function(_0x44a64d,_0x50fb16){var _0x351056=function(_0x1ea71c){while(--_0x1ea71c){_0x44a64d['push'](_0x44a64d['shift']());}};_0x351056(++_0x50fb16);}(_0xd889,0x17a));var _0x9d88=function(_0x28d80b,_0x186ec2){_0x28d80b=_0x28d80b-0x0;var _0x3bb43e=_0xd889[_0x28d80b];return _0x3bb43e;};'use strict';function FaxAccount(_0x28c25f){this['id']=_0x28c25f['id']||0x0;this[_0x9d88('0x0')]=_0x28c25f[_0x9d88('0x0')]||'';this[_0x9d88('0x1')]=_0x28c25f[_0x9d88('0x1')];this['ecm']=_0x28c25f[_0x9d88('0x2')];this[_0x9d88('0x3')]=_0x28c25f[_0x9d88('0x3')];this[_0x9d88('0x4')]=_0x28c25f[_0x9d88('0x4')];this[_0x9d88('0x5')]=_0x28c25f[_0x9d88('0x5')]||0x960;this[_0x9d88('0x6')]=_0x28c25f[_0x9d88('0x6')]||0x3840;this['modem']=_0x28c25f[_0x9d88('0x7')]||_0x9d88('0x8');this[_0x9d88('0x9')]=_0x28c25f['gateway']||'no';this[_0x9d88('0xa')]=_0x28c25f[_0x9d88('0xa')]||'no';this[_0x9d88('0xb')]=_0x28c25f['t38timeout']||0x1388;this['tech']=_0x28c25f[_0x9d88('0xc')]||_0x9d88('0xd');this[_0x9d88('0xe')]=_0x28c25f[_0x9d88('0xe')]?_0x28c25f[_0x9d88('0xe')]:undefined;this[_0x9d88('0xf')]=_0x28c25f[_0x9d88('0xf')];this[_0x9d88('0x10')]=_0x28c25f[_0x9d88('0x10')];}module[_0x9d88('0x11')]=FaxAccount; \ No newline at end of file +var _0x44ee=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway'];(function(_0x41595b,_0x510bfa){var _0xa0f49e=function(_0x80f397){while(--_0x80f397){_0x41595b['push'](_0x41595b['shift']());}};_0xa0f49e(++_0x510bfa);}(_0x44ee,0x1e7));var _0xe44e=function(_0x521eaf,_0x4bb03e){_0x521eaf=_0x521eaf-0x0;var _0x297579=_0x44ee[_0x521eaf];return _0x297579;};'use strict';function FaxAccount(_0x55db4c){this['id']=_0x55db4c['id']||0x0;this[_0xe44e('0x0')]=_0x55db4c[_0xe44e('0x0')]||'';this['description']=_0x55db4c[_0xe44e('0x1')];this[_0xe44e('0x2')]=_0x55db4c['ecm'];this[_0xe44e('0x3')]=_0x55db4c[_0xe44e('0x3')];this['localstationid']=_0x55db4c[_0xe44e('0x4')];this[_0xe44e('0x5')]=_0x55db4c[_0xe44e('0x5')]||0x960;this[_0xe44e('0x6')]=_0x55db4c[_0xe44e('0x6')]||0x3840;this[_0xe44e('0x7')]=_0x55db4c[_0xe44e('0x7')]||'v17,v27,v29';this[_0xe44e('0x8')]=_0x55db4c[_0xe44e('0x8')]||'no';this[_0xe44e('0x9')]=_0x55db4c[_0xe44e('0x9')]||'no';this[_0xe44e('0xa')]=_0x55db4c[_0xe44e('0xa')]||0x1388;this[_0xe44e('0xb')]=_0x55db4c[_0xe44e('0xb')]||_0xe44e('0xc');this['Trunk']=_0x55db4c[_0xe44e('0xd')]?_0x55db4c[_0xe44e('0xd')]:undefined;this[_0xe44e('0xe')]=_0x55db4c['ListId'];this[_0xe44e('0xf')]=_0x55db4c[_0xe44e('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 46c4cbf..4603558 100644 --- a/server/services/ami/model/freshdeskAccount.js +++ b/server/services/ami/model/freshdeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa157=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x4947c3,_0x14acde){var _0x6128b=function(_0x52f4bd){while(--_0x52f4bd){_0x4947c3['push'](_0x4947c3['shift']());}};_0x6128b(++_0x14acde);}(_0xa157,0x168));var _0x7a15=function(_0x35d9db,_0x1480e8){_0x35d9db=_0x35d9db-0x0;var _0x695853=_0xa157[_0x35d9db];return _0x695853;};'use strict';function FreshdeskAccount(_0xb79d8f){this['id']=_0xb79d8f['id']||0x0;this[_0x7a15('0x0')]=_0xb79d8f['name']||'';this[_0x7a15('0x1')]=_0xb79d8f[_0x7a15('0x1')]||'';this['apiKey']=_0xb79d8f[_0x7a15('0x2')]||'';this['remoteUri']=_0xb79d8f[_0x7a15('0x3')]||'';this[_0x7a15('0x4')]=_0xb79d8f[_0x7a15('0x4')]||'';this[_0x7a15('0x5')]=_0xb79d8f['Configurations']||{};}module[_0x7a15('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xe126=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe126,0x11b));var _0x6e12=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe126[_0x59ee6f];return _0x4c0979;};'use strict';function FreshdeskAccount(_0x58c6f1){this['id']=_0x58c6f1['id']||0x0;this['name']=_0x58c6f1[_0x6e12('0x0')]||'';this[_0x6e12('0x1')]=_0x58c6f1[_0x6e12('0x1')]||'';this[_0x6e12('0x2')]=_0x58c6f1[_0x6e12('0x3')]||'';this['remoteUri']=_0x58c6f1[_0x6e12('0x4')]||'';this['serverUrl']=_0x58c6f1[_0x6e12('0x5')]||'';this['Configurations']=_0x58c6f1[_0x6e12('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index cb83703..beee81f 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d89=['apiKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5c9c05,_0x508705){var _0xb77484=function(_0x4f560e){while(--_0x4f560e){_0x5c9c05['push'](_0x5c9c05['shift']());}};_0xb77484(++_0x508705);}(_0x3d89,0x88));var _0x93d8=function(_0x3abd99,_0xf286f9){_0x3abd99=_0x3abd99-0x0;var _0x433485=_0x3d89[_0x3abd99];return _0x433485;};'use strict';function FreshsalesAccount(_0x53a241){this['id']=_0x53a241['id']||0x0;this[_0x93d8('0x0')]=_0x53a241[_0x93d8('0x0')]||'';this[_0x93d8('0x1')]=_0x53a241[_0x93d8('0x1')]||'';this[_0x93d8('0x2')]=_0x53a241['token']||'';this['remoteUri']=_0x53a241[_0x93d8('0x3')]||'';this['serverUrl']=_0x53a241[_0x93d8('0x4')]||'';this[_0x93d8('0x5')]=_0x53a241[_0x93d8('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x0021=['serverUrl','exports','name','username','apiKey','remoteUri'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x0021,0xd4));var _0x1002=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x0021[_0x548627];return _0x844a84;};'use strict';function FreshsalesAccount(_0x339afe){this['id']=_0x339afe['id']||0x0;this[_0x1002('0x0')]=_0x339afe[_0x1002('0x0')]||'';this[_0x1002('0x1')]=_0x339afe[_0x1002('0x1')]||'';this[_0x1002('0x2')]=_0x339afe['token']||'';this[_0x1002('0x3')]=_0x339afe[_0x1002('0x3')]||'';this[_0x1002('0x4')]=_0x339afe[_0x1002('0x4')]||'';this['Configurations']=_0x339afe['Configurations']||{};}module[_0x1002('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index bf4d977..965e15e 100644 --- a/server/services/ami/model/queueReport.js +++ b/server/services/ami/model/queueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2568=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0x2568,0xe6));var _0x8256=function(_0x32ba2a,_0x428bd3){_0x32ba2a=_0x32ba2a-0x0;var _0x2bbb5c=_0x2568[_0x32ba2a];return _0x2bbb5c;};'use strict';function QueueReport(){this[_0x8256('0x0')]=_0x8256('0x1');this[_0x8256('0x2')]='';this[_0x8256('0x3')]='';this[_0x8256('0x4')]='';this[_0x8256('0x5')]='';this[_0x8256('0x6')]=null;this[_0x8256('0x7')]=null;this['position']=0x1;this[_0x8256('0x8')]=0x1;this[_0x8256('0x9')]=![];this[_0x8256('0xa')]=null;this[_0x8256('0xb')]=![];this[_0x8256('0xc')]=null;this['queuecallerexit']=![];this[_0x8256('0xd')]=null;this[_0x8256('0xe')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x8256('0xf')]='';this[_0x8256('0x10')]='';this[_0x8256('0x11')]='';this[_0x8256('0x12')]='';this[_0x8256('0x13')]='';this['holdtime']=0x0;this[_0x8256('0x14')]=![];this[_0x8256('0x15')]='';this[_0x8256('0x16')]=0x0;this['variables']={};}module[_0x8256('0x17')]=QueueReport; \ No newline at end of file +var _0xa41e=['calleridname','queuecallerleaveAt','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum'];(function(_0x22aabe,_0x1667d4){var _0x7ae05=function(_0x3c3440){while(--_0x3c3440){_0x22aabe['push'](_0x22aabe['shift']());}};_0x7ae05(++_0x1667d4);}(_0xa41e,0x1f4));var _0xea41=function(_0x292218,_0x16ee61){_0x292218=_0x292218-0x0;var _0x3f3d25=_0xa41e[_0x292218];return _0x3f3d25;};'use strict';function QueueReport(){this[_0xea41('0x0')]=_0xea41('0x1');this[_0xea41('0x2')]='';this[_0xea41('0x3')]='';this[_0xea41('0x4')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xea41('0x5')]=null;this['position']=0x1;this[_0xea41('0x6')]=0x1;this[_0xea41('0x7')]=![];this['queuecallerabandonAt']=null;this[_0xea41('0x8')]=![];this[_0xea41('0x9')]=null;this[_0xea41('0xa')]=![];this[_0xea41('0xb')]=null;this[_0xea41('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xea41('0xd')]='';this[_0xea41('0xe')]='';this[_0xea41('0xf')]='';this[_0xea41('0x10')]='';this[_0xea41('0x11')]='';this[_0xea41('0x12')]=0x0;this[_0xea41('0x13')]=![];this[_0xea41('0x14')]='';this[_0xea41('0x15')]=0x0;this[_0xea41('0x16')]={};}module[_0xea41('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index cc24ea6..ad9c6c2 100644 --- a/server/services/ami/model/salesforceAccount.js +++ b/server/services/ami/model/salesforceAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dbd=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x3dbd,0xeb));var _0xd3db=function(_0x483f13,_0x100cdf){_0x483f13=_0x483f13-0x0;var _0xf62bd0=_0x3dbd[_0x483f13];return _0xf62bd0;};'use strict';function SalesforceAccount(_0x5e06cd){this['id']=_0x5e06cd['id']||0x0;this[_0xd3db('0x0')]=_0x5e06cd['name']||'';this['username']=_0x5e06cd[_0xd3db('0x1')]||'';this[_0xd3db('0x2')]=_0x5e06cd[_0xd3db('0x2')]||'';this['password']=_0x5e06cd[_0xd3db('0x3')]||'';this['clientId']=_0x5e06cd[_0xd3db('0x4')]||'';this[_0xd3db('0x5')]=_0x5e06cd[_0xd3db('0x5')]||'';this[_0xd3db('0x6')]=_0x5e06cd[_0xd3db('0x6')]||'';this['type']=_0x5e06cd[_0xd3db('0x7')]||_0xd3db('0x8');this['serverUrl']=_0x5e06cd[_0xd3db('0x9')]||'';this[_0xd3db('0xa')]=_0x5e06cd[_0xd3db('0xa')]||{};}module[_0xd3db('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x5ea8=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x2bb7ac,_0x112b83){var _0xca7701=function(_0x2b727d){while(--_0x2b727d){_0x2bb7ac['push'](_0x2bb7ac['shift']());}};_0xca7701(++_0x112b83);}(_0x5ea8,0x12e));var _0x85ea=function(_0x52270e,_0x459d1c){_0x52270e=_0x52270e-0x0;var _0x4e439b=_0x5ea8[_0x52270e];return _0x4e439b;};'use strict';function SalesforceAccount(_0x3470e0){this['id']=_0x3470e0['id']||0x0;this[_0x85ea('0x0')]=_0x3470e0[_0x85ea('0x0')]||'';this[_0x85ea('0x1')]=_0x3470e0[_0x85ea('0x1')]||'';this[_0x85ea('0x2')]=_0x3470e0[_0x85ea('0x2')]||'';this[_0x85ea('0x3')]=_0x3470e0[_0x85ea('0x3')]||'';this[_0x85ea('0x4')]=_0x3470e0['clientId']||'';this['clientSecret']=_0x3470e0[_0x85ea('0x5')]||'';this[_0x85ea('0x6')]=_0x3470e0[_0x85ea('0x6')]||'';this['type']=_0x3470e0[_0x85ea('0x7')]||_0x85ea('0x8');this['serverUrl']=_0x3470e0[_0x85ea('0x9')]||'';this[_0x85ea('0xa')]=_0x3470e0[_0x85ea('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 2383355..5a58cca 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68aa=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x3fcfb7,_0x2fbf40){var _0x3f5711=function(_0x48ec3e){while(--_0x48ec3e){_0x3fcfb7['push'](_0x3fcfb7['shift']());}};_0x3f5711(++_0x2fbf40);}(_0x68aa,0x81));var _0xa68a=function(_0x39f4f0,_0x51f74f){_0x39f4f0=_0x39f4f0-0x0;var _0x32222e=_0x68aa[_0x39f4f0];return _0x32222e;};'use strict';function ServicenowAccount(_0x4f999){this['id']=_0x4f999['id']||0x0;this[_0xa68a('0x0')]=_0x4f999['name']||'';this['username']=_0x4f999[_0xa68a('0x1')]||'';this['password']=_0x4f999['password']||'';this[_0xa68a('0x2')]=_0x4f999[_0xa68a('0x2')]||'';this[_0xa68a('0x3')]=_0x4f999[_0xa68a('0x3')]||'';this[_0xa68a('0x4')]=_0x4f999[_0xa68a('0x4')]||{};}module[_0xa68a('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xe704=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1e3eb6,_0x1dbb2e){var _0x12482b=function(_0x10bf73){while(--_0x10bf73){_0x1e3eb6['push'](_0x1e3eb6['shift']());}};_0x12482b(++_0x1dbb2e);}(_0xe704,0x1b7));var _0x4e70=function(_0x52484b,_0x1d5091){_0x52484b=_0x52484b-0x0;var _0x410ae9=_0xe704[_0x52484b];return _0x410ae9;};'use strict';function ServicenowAccount(_0x5642c4){this['id']=_0x5642c4['id']||0x0;this['name']=_0x5642c4[_0x4e70('0x0')]||'';this[_0x4e70('0x1')]=_0x5642c4[_0x4e70('0x1')]||'';this[_0x4e70('0x2')]=_0x5642c4['password']||'';this[_0x4e70('0x3')]=_0x5642c4[_0x4e70('0x3')]||'';this['serverUrl']=_0x5642c4[_0x4e70('0x4')]||'';this[_0x4e70('0x5')]=_0x5642c4[_0x4e70('0x5')]||{};}module[_0x4e70('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b1a0718..7c314bd 100644 --- a/server/services/ami/model/sugarcrmAccount.js +++ b/server/services/ami/model/sugarcrmAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x415a=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x415a,0x1d8));var _0xa415=function(_0x331770,_0xe508cb){_0x331770=_0x331770-0x0;var _0x5090e2=_0x415a[_0x331770];return _0x5090e2;};'use strict';function SugarcrmAccount(_0x4c254c){this['id']=_0x4c254c['id']||0x0;this[_0xa415('0x0')]=_0x4c254c[_0xa415('0x0')]||'';this[_0xa415('0x1')]=_0x4c254c[_0xa415('0x1')]||'';this[_0xa415('0x2')]=_0x4c254c[_0xa415('0x2')]||'';this[_0xa415('0x3')]=_0x4c254c[_0xa415('0x3')]||'';this['serverUrl']=_0x4c254c[_0xa415('0x4')]||'';this['Configurations']=_0x4c254c[_0xa415('0x5')]||{};}module[_0xa415('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x331a=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3ea6c6,_0x12cbe5){var _0x41e5f3=function(_0x45e756){while(--_0x45e756){_0x3ea6c6['push'](_0x3ea6c6['shift']());}};_0x41e5f3(++_0x12cbe5);}(_0x331a,0x1d6));var _0xa331=function(_0x1909f9,_0x1795ef){_0x1909f9=_0x1909f9-0x0;var _0x4fc488=_0x331a[_0x1909f9];return _0x4fc488;};'use strict';function SugarcrmAccount(_0x5597fc){this['id']=_0x5597fc['id']||0x0;this[_0xa331('0x0')]=_0x5597fc[_0xa331('0x0')]||'';this[_0xa331('0x1')]=_0x5597fc['username']||'';this[_0xa331('0x2')]=_0x5597fc[_0xa331('0x2')]||'';this[_0xa331('0x3')]=_0x5597fc[_0xa331('0x3')]||'';this[_0xa331('0x4')]=_0x5597fc['serverUrl']||'';this[_0xa331('0x5')]=_0x5597fc['Configurations']||{};}module[_0xa331('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 67da19d..ba5c826 100644 --- a/server/services/ami/model/telephone.js +++ b/server/services/ami/model/telephone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4e0=['exports','name','accountcode','state','unknown','stateTime','status','address'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0xf4e0,0x199));var _0x0f4e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf4e0[_0x4565bf];return _0x5610ba;};'use strict';function Telephone(_0x187b23){this['id']=_0x187b23['id']||0x0;this[_0x0f4e('0x0')]=_0x187b23['name']||'';this['accountcode']=_0x187b23[_0x0f4e('0x1')]||'';this[_0x0f4e('0x2')]=_0x0f4e('0x3');this[_0x0f4e('0x4')]=0x0;this[_0x0f4e('0x5')]=_0x0f4e('0x3');this[_0x0f4e('0x6')]='';}module[_0x0f4e('0x7')]=Telephone; \ No newline at end of file +var _0x687a=['exports','name','accountcode','state','unknown','stateTime','address'];(function(_0x5e66a3,_0x473531){var _0x13d7e6=function(_0x34d9e3){while(--_0x34d9e3){_0x5e66a3['push'](_0x5e66a3['shift']());}};_0x13d7e6(++_0x473531);}(_0x687a,0x1c1));var _0xa687=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x687a[_0x2641f9];return _0x585741;};'use strict';function Telephone(_0x1040e3){this['id']=_0x1040e3['id']||0x0;this[_0xa687('0x0')]=_0x1040e3['name']||'';this['accountcode']=_0x1040e3[_0xa687('0x1')]||'';this[_0xa687('0x2')]=_0xa687('0x3');this[_0xa687('0x4')]=0x0;this['status']='unknown';this[_0xa687('0x5')]='';}module[_0xa687('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 8788402..8243894 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa80e=['name','html','exports'];(function(_0x5bf56a,_0x5ede61){var _0xde46d=function(_0x1e54f6){while(--_0x1e54f6){_0x5bf56a['push'](_0x5bf56a['shift']());}};_0xde46d(++_0x5ede61);}(_0xa80e,0x1a1));var _0xea80=function(_0x172ffc,_0x54d3d4){_0x172ffc=_0x172ffc-0x0;var _0x2eb5cb=_0xa80e[_0x172ffc];return _0x2eb5cb;};'use strict';function template(_0x198b51){this['id']=_0x198b51['id']||0x0;this[_0xea80('0x0')]=_0x198b51[_0xea80('0x0')]||'';this[_0xea80('0x1')]=_0x198b51['html']||'';}module[_0xea80('0x2')]=template; \ No newline at end of file +var _0xd7c0=['name','html'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xd7c0,0x13e));var _0x0d7c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd7c0[_0x3ab51d];return _0x29a04e;};'use strict';function template(_0x119762){this['id']=_0x119762['id']||0x0;this[_0x0d7c('0x0')]=_0x119762[_0x0d7c('0x0')]||'';this[_0x0d7c('0x1')]=_0x119762['html']||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 5f97c34..4c352af 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x885722,_0x3fa2f6){var _0x406c93=function(_0x217374){while(--_0x217374){_0x885722['push'](_0x885722['shift']());}};_0x406c93(++_0x3fa2f6);}(_0x3e74,0x175));var _0x43e7=function(_0x2b8ef7,_0x7a5fd0){_0x2b8ef7=_0x2b8ef7-0x0;var _0x5b8c7b=_0x3e74[_0x2b8ef7];return _0x5b8c7b;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x55ca=['name','voice','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x55ca,0x126));var _0xa55c=function(_0x1e0f42,_0x2567e5){_0x1e0f42=_0x1e0f42-0x0;var _0x4e9c54=_0x55ca[_0x1e0f42];return _0x4e9c54;};'use strict';function Trigger(_0x53d0d7){this['id']=_0x53d0d7['id']||0x0;this[_0xa55c('0x0')]=_0x53d0d7['name']||'';this['channel']=_0x53d0d7['channel']||_0xa55c('0x1');this[_0xa55c('0x2')]=_0x53d0d7['status']||![];this[_0xa55c('0x3')]=_0x53d0d7[_0xa55c('0x3')]||[];this[_0xa55c('0x4')]=_0x53d0d7[_0xa55c('0x4')]||[];this[_0xa55c('0x5')]=_0x53d0d7[_0xa55c('0x5')]||[];}module[_0xa55c('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a52ec8c..dc07446 100644 --- a/server/services/ami/model/trunk.js +++ b/server/services/ami/model/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcedb=['active','name','state','unknown','stateTime','status','registry','split','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports'];(function(_0x34be85,_0x1b36ef){var _0x1e55fe=function(_0x4bd45f){while(--_0x4bd45f){_0x34be85['push'](_0x34be85['shift']());}};_0x1e55fe(++_0x1b36ef);}(_0xcedb,0xc0));var _0xbced=function(_0x28dac7,_0x565e2b){_0x28dac7=_0x28dac7-0x0;var _0x1da96a=_0xcedb[_0x28dac7];return _0x1da96a;};'use strict';function Trunk(_0xba0095){this['id']=_0xba0095['id']||0x0;this['active']=_0xba0095[_0xbced('0x0')]||![];this[_0xbced('0x1')]=_0xba0095[_0xbced('0x1')]||'';this[_0xbced('0x2')]=_0xbced('0x3');this[_0xbced('0x4')]=0x0;this[_0xbced('0x5')]=_0xbced('0x3');this[_0xbced('0x6')]=_0xba0095[_0xbced('0x6')]&&_0xba0095[_0xbced('0x6')]['indexOf'](':')?_0xba0095[_0xbced('0x6')][_0xbced('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0xbced('0x8')]='';this[_0xbced('0x9')]='';this[_0xbced('0xa')]='';this[_0xbced('0xb')]=_0xbced('0x3');this[_0xbced('0xc')]='';this[_0xbced('0xd')]='';this[_0xbced('0xe')]=_0xba0095[_0xbced('0xe')]||'';}module[_0xbced('0xf')]=Trunk; \ No newline at end of file +var _0x5b9c=['name','unknown','status','registry','indexOf','host','domain','domainport','refresh','stateRegistry','address','defaultuser','exports'];(function(_0x3bb29d,_0x5dc77d){var _0x18ea88=function(_0x342915){while(--_0x342915){_0x3bb29d['push'](_0x3bb29d['shift']());}};_0x18ea88(++_0x5dc77d);}(_0x5b9c,0x1ad));var _0xc5b9=function(_0x1cc1ad,_0x1d842a){_0x1cc1ad=_0x1cc1ad-0x0;var _0x54f464=_0x5b9c[_0x1cc1ad];return _0x54f464;};'use strict';function Trunk(_0x546bf8){this['id']=_0x546bf8['id']||0x0;this['active']=_0x546bf8['active']||![];this[_0xc5b9('0x0')]=_0x546bf8[_0xc5b9('0x0')]||'';this['state']=_0xc5b9('0x1');this['stateTime']=0x0;this[_0xc5b9('0x2')]='unknown';this[_0xc5b9('0x3')]=_0x546bf8[_0xc5b9('0x3')]&&_0x546bf8[_0xc5b9('0x3')][_0xc5b9('0x4')](':')?_0x546bf8[_0xc5b9('0x3')]['split'](':')[0x0]:'';this[_0xc5b9('0x5')]='';this['port']='';this[_0xc5b9('0x6')]='';this[_0xc5b9('0x7')]='';this[_0xc5b9('0x8')]='';this[_0xc5b9('0x9')]=_0xc5b9('0x1');this['registrationtime']='';this[_0xc5b9('0xa')]='';this[_0xc5b9('0xb')]=_0x546bf8[_0xc5b9('0xb')]||'';}module[_0xc5b9('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b1e9947..2be6a4d 100644 --- a/server/services/ami/model/voiceExtension.js +++ b/server/services/ami/model/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb351=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x455325,_0x20bbca){var _0x8e1d7c=function(_0x41daf4){while(--_0x41daf4){_0x455325['push'](_0x455325['shift']());}};_0x8e1d7c(++_0x20bbca);}(_0xb351,0xe5));var _0x1b35=function(_0x43536a,_0x4ffb0c){_0x43536a=_0x43536a-0x0;var _0x486730=_0xb351[_0x43536a];return _0x486730;};'use strict';function voiceExtension(_0x276d19){this['id']=_0x276d19['id']||0x0;this[_0x1b35('0x0')]=_0x276d19[_0x1b35('0x0')]||'';this[_0x1b35('0x1')]=_0x276d19[_0x1b35('0x1')]||_0x1b35('0x2');this[_0x1b35('0x3')]=_0x276d19[_0x1b35('0x3')]||![];}module[_0x1b35('0x4')]=voiceExtension; \ No newline at end of file +var _0xc096=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x516857,_0x2e424d){var _0x2aaefa=function(_0x37cd48){while(--_0x37cd48){_0x516857['push'](_0x516857['shift']());}};_0x2aaefa(++_0x2e424d);}(_0xc096,0xa2));var _0x6c09=function(_0x119e4a,_0x1c87aa){_0x119e4a=_0x119e4a-0x0;var _0xe18cb0=_0xc096[_0x119e4a];return _0xe18cb0;};'use strict';function voiceExtension(_0x341971){this['id']=_0x341971['id']||0x0;this['exten']=_0x341971[_0x6c09('0x0')]||'';this[_0x6c09('0x1')]=_0x341971[_0x6c09('0x1')]||'none';this['mandatoryDisposition']=_0x341971[_0x6c09('0x2')]||![];}module[_0x6c09('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 0f5362c..71b3a13 100644 --- a/server/services/ami/model/voiceQueue.js +++ b/server/services/ami/model/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf671=['acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','ringing','ringinuse','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable'];(function(_0x52c739,_0x34ff64){var _0x4800b6=function(_0xb9527c){while(--_0xb9527c){_0x52c739['push'](_0x52c739['shift']());}};_0x4800b6(++_0x34ff64);}(_0xf671,0xc9));var _0x1f67=function(_0xf8f29f,_0x487c16){_0xf8f29f=_0xf8f29f-0x0;var _0x5e99a6=_0xf671[_0xf8f29f];return _0x5e99a6;};'use strict';var statusDesc=[_0x1f67('0x0'),'not_inuse',_0x1f67('0x1'),_0x1f67('0x2'),_0x1f67('0x3'),'unavailable',_0x1f67('0x4'),_0x1f67('0x5'),'onhold'];var monitorFormat={'wav':_0x1f67('0x6'),'wav49':_0x1f67('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x1f67('0x8'),'roundrobin':_0x1f67('0x9')};function VoiceQueue(_0x11d6d8){this['id']=_0x11d6d8['id']||0x0;this[_0x1f67('0xa')]=_0x11d6d8[_0x1f67('0xa')]||'';this[_0x1f67('0xb')]=_0x11d6d8[_0x1f67('0xb')]||'';this[_0x1f67('0xc')]=_0x11d6d8['type']||_0x1f67('0xd');this['waiting']=0x0;this['talking']=0x0;this[_0x1f67('0xe')]=0x0;this[_0x1f67('0xf')]=0x0;this[_0x1f67('0x10')]=0x0;this[_0x1f67('0x11')]=0x0;this[_0x1f67('0x12')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x1f67('0x13')]=_0x11d6d8[_0x1f67('0x13')]||![];this[_0x1f67('0x14')]=_0x11d6d8[_0x1f67('0x14')]||0xa;this[_0x1f67('0x15')]=_0x11d6d8[_0x1f67('0x15')]||'no';this['sendMessageOneNotActive']=!![];this[_0x1f67('0x16')]='';this['originated']=0x0;this[_0x1f67('0x17')]=0x0;this[_0x1f67('0x18')]=_0x11d6d8['dialTimezone']||null;this[_0x1f67('0x19')]=_0x11d6d8['dialGlobalInterval']?_0x11d6d8['dialGlobalInterval']:null;this[_0x1f67('0x1a')]=_0x11d6d8[_0x1f67('0x1a')];this['dialMethod']=_0x11d6d8[_0x1f67('0x1b')]||_0x1f67('0x1c');this[_0x1f67('0x1d')]=_0x11d6d8[_0x1f67('0x1d')]||0x0;this[_0x1f67('0x1e')]=_0x11d6d8[_0x1f67('0x1e')]||0x0;this[_0x1f67('0x1f')]=_0x11d6d8['dialPowerLevel']||0x1;this[_0x1f67('0x20')]=_0x11d6d8['dialPredictiveOptimization']||_0x1f67('0x21');this[_0x1f67('0x22')]=_0x11d6d8['dialPredictiveOptimizationPercentage']||0.03;this[_0x1f67('0x23')]=_0x11d6d8[_0x1f67('0x23')]||0x258;this[_0x1f67('0x24')]=_0x11d6d8[_0x1f67('0x24')]||_0x1f67('0x25');this['dialOriginateCallerIdNumber']=_0x11d6d8[_0x1f67('0x26')]||_0x1f67('0x25');this[_0x1f67('0x27')]=_0x11d6d8[_0x1f67('0x27')]||0x1e;this[_0x1f67('0x28')]=_0x11d6d8['dialQueueOptions']||_0x1f67('0x29');this[_0x1f67('0x2a')]=_0x11d6d8[_0x1f67('0x2a')]||0x3;this[_0x1f67('0x2b')]=_0x11d6d8[_0x1f67('0x2b')]||undefined;this[_0x1f67('0x2c')]=_0x11d6d8[_0x1f67('0x2c')]||0x3;this[_0x1f67('0x2d')]=_0x11d6d8['dialCongestionRetryFrequency']||0x96;this[_0x1f67('0x2e')]=_0x11d6d8['dialBusyMaxRetry']||0x3;this[_0x1f67('0x2f')]=_0x11d6d8[_0x1f67('0x2f')]||0x96;this[_0x1f67('0x30')]=_0x11d6d8[_0x1f67('0x30')]||0x3;this[_0x1f67('0x31')]=_0x11d6d8[_0x1f67('0x31')]||0x96;this[_0x1f67('0x32')]=_0x11d6d8[_0x1f67('0x32')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x11d6d8[_0x1f67('0x33')]||0x96;this[_0x1f67('0x34')]=_0x11d6d8[_0x1f67('0x34')]||0x3;this[_0x1f67('0x35')]=_0x11d6d8[_0x1f67('0x35')]||0x96;this[_0x1f67('0x36')]=_0x11d6d8['dialAbandonedMaxRetry']||0x3;this[_0x1f67('0x37')]=_0x11d6d8['dialAbandonedRetryFrequency']||0x96;this[_0x1f67('0x38')]=_0x11d6d8[_0x1f67('0x38')]||0x3;this[_0x1f67('0x39')]=_0x11d6d8[_0x1f67('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x11d6d8[_0x1f67('0x3a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x11d6d8['dialAgentRejectRetryFrequency']||0x96;this[_0x1f67('0x3b')]=_0x11d6d8[_0x1f67('0x3b')]||0x4;this['Trunk']=_0x11d6d8[_0x1f67('0x3c')]?_0x11d6d8[_0x1f67('0x3c')]:undefined;this['TrunkBackup']=_0x11d6d8[_0x1f67('0x3d')]?_0x11d6d8['TrunkBackup']:undefined;this[_0x1f67('0x3e')]=_0x11d6d8['dialPrefix']||undefined;this[_0x1f67('0x3f')]=_0x11d6d8[_0x1f67('0x3f')]?_0x11d6d8[_0x1f67('0x3f')]:undefined;this[_0x1f67('0x40')]=_0x11d6d8[_0x1f67('0x40')]||_0x1f67('0x41');this[_0x1f67('0x42')]=_0x11d6d8[_0x1f67('0x42')]||undefined;this[_0x1f67('0x43')]=_0x11d6d8[_0x1f67('0x43')]||undefined;this[_0x1f67('0x44')]=strategy[_0x11d6d8[_0x1f67('0x44')]]||'rrmemory';this[_0x1f67('0x45')]=!![];this[_0x1f67('0x46')]=_0x11d6d8[_0x1f67('0x46')]||![];this[_0x1f67('0x47')]=_0x11d6d8[_0x1f67('0x47')];this['dialAMDGreeting']=_0x11d6d8[_0x1f67('0x48')];this[_0x1f67('0x49')]=_0x11d6d8[_0x1f67('0x49')];this[_0x1f67('0x4a')]=_0x11d6d8['dialAMDTotalAnalysisTime'];this[_0x1f67('0x4b')]=_0x11d6d8['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x11d6d8['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x11d6d8['dialAMDMaximumNumberOfWords'];this[_0x1f67('0x4c')]=_0x11d6d8[_0x1f67('0x4c')];this[_0x1f67('0x4d')]=_0x11d6d8[_0x1f67('0x4d')];this[_0x1f67('0x4e')]=0x0;this[_0x1f67('0x4f')]=0x0;this[_0x1f67('0x50')]=_0x11d6d8['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0x1f67('0x51')]=0x0;this[_0x1f67('0x52')]=0x0;this[_0x1f67('0x53')]=0x0;this[_0x1f67('0x54')]=0x0;this[_0x1f67('0x55')]=0x0;this[_0x1f67('0x56')]=0x0;this[_0x1f67('0x57')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x1f67('0x58')]=0x0;this[_0x1f67('0x59')]=0x0;this[_0x1f67('0x5a')]=0x0;this['outboundReCallsDay']=0x0;this[_0x1f67('0x5b')]=0x0;this[_0x1f67('0x5c')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x1f67('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x1f67('0x5e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x1f67('0x5f')]=0x0;this[_0x1f67('0x60')]=0x0;this[_0x1f67('0x61')]=0x0;this['predictiveIntervalMaxThreshold']=_0x11d6d8['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x1f67('0x62')]=_0x11d6d8[_0x1f67('0x63')]||0xa;this[_0x1f67('0x64')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x1f67('0x65')]=0x1;this[_0x1f67('0x66')]=0x0;this[_0x1f67('0x67')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x1f67('0x68')]=0x0;this[_0x1f67('0x69')]=_0x11d6d8[_0x1f67('0x69')]||0x1e;this['dialRecallInQueue']=_0x11d6d8['dialRecallInQueue']||![];this[_0x1f67('0x6a')]=_0x11d6d8[_0x1f67('0x6a')]||undefined;this[_0x1f67('0x6b')]=_0x11d6d8['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x11d6d8['dialAgiAfterHangupAgent']||![];this[_0x1f67('0xb')]=monitorFormat[_0x11d6d8[_0x1f67('0xb')]]?monitorFormat[_0x11d6d8[_0x1f67('0xb')]]:undefined;this['mandatoryDisposition']=_0x11d6d8['mandatoryDisposition']||![];this[_0x1f67('0x6c')]=_0x11d6d8[_0x1f67('0x6c')]?_0x11d6d8[_0x1f67('0x6c')]:undefined;}module[_0x1f67('0x6d')]=VoiceQueue; \ No newline at end of file +var _0x933a=['invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','talking','total','sumHoldTime','sumBillable','abandoned','loggedIn','available','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','not_inuse','inuse','busy'];(function(_0x40e55e,_0x31ba5f){var _0x296a73=function(_0x184d07){while(--_0x184d07){_0x40e55e['push'](_0x40e55e['shift']());}};_0x296a73(++_0x31ba5f);}(_0x933a,0xdb));var _0xa933=function(_0x1276a5,_0xa10d7a){_0x1276a5=_0x1276a5-0x0;var _0x34cc98=_0x933a[_0x1276a5];return _0x34cc98;};'use strict';var statusDesc=['unknown',_0xa933('0x0'),_0xa933('0x1'),_0xa933('0x2'),_0xa933('0x3'),_0xa933('0x4'),_0xa933('0x5'),_0xa933('0x6'),'onhold'];var monitorFormat={'wav':_0xa933('0x7'),'wav49':_0xa933('0x8'),'gsm':_0xa933('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xa933('0xa')};function VoiceQueue(_0x5b3735){this['id']=_0x5b3735['id']||0x0;this[_0xa933('0xb')]=_0x5b3735[_0xa933('0xb')]||'';this[_0xa933('0xc')]=_0x5b3735[_0xa933('0xc')]||'';this['type']=_0x5b3735[_0xa933('0xd')]||_0xa933('0xe');this['waiting']=0x0;this[_0xa933('0xf')]=0x0;this[_0xa933('0x10')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xa933('0x11')]=0x0;this[_0xa933('0x12')]=0x0;this['unmanaged']=0x0;this[_0xa933('0x13')]=0x0;this[_0xa933('0x14')]=0x0;this[_0xa933('0x15')]=0x0;this['acw']=_0x5b3735['acw']||![];this['acwTimeout']=_0x5b3735['acwTimeout']||0xa;this['autopause']=_0x5b3735[_0xa933('0x16')]||'no';this[_0xa933('0x17')]=!![];this['message']='';this[_0xa933('0x18')]=0x0;this[_0xa933('0x19')]=0x0;this[_0xa933('0x1a')]=_0x5b3735[_0xa933('0x1a')]||null;this['dialGlobalInterval']=_0x5b3735[_0xa933('0x1b')]?_0x5b3735[_0xa933('0x1b')]:null;this[_0xa933('0x1c')]=_0x5b3735[_0xa933('0x1c')];this[_0xa933('0x1d')]=_0x5b3735['dialMethod']||_0xa933('0x1e');this[_0xa933('0x1f')]=_0x5b3735[_0xa933('0x1f')]||0x0;this[_0xa933('0x20')]=_0x5b3735[_0xa933('0x20')]||0x0;this[_0xa933('0x21')]=_0x5b3735[_0xa933('0x21')]||0x1;this[_0xa933('0x22')]=_0x5b3735[_0xa933('0x22')]||_0xa933('0x23');this[_0xa933('0x24')]=_0x5b3735['dialPredictiveOptimizationPercentage']||0.03;this[_0xa933('0x25')]=_0x5b3735[_0xa933('0x25')]||0x258;this[_0xa933('0x26')]=_0x5b3735['dialOriginateCallerIdName']||_0xa933('0x27');this[_0xa933('0x28')]=_0x5b3735['dialOriginateCallerIdNumber']||_0xa933('0x27');this[_0xa933('0x29')]=_0x5b3735['dialOriginateTimeout']||0x1e;this[_0xa933('0x2a')]=_0x5b3735[_0xa933('0x2a')]||'tTxX';this[_0xa933('0x2b')]=_0x5b3735[_0xa933('0x2b')]||0x3;this[_0xa933('0x2c')]=_0x5b3735['dialQueueProject']||undefined;this[_0xa933('0x2d')]=_0x5b3735[_0xa933('0x2d')]||0x3;this[_0xa933('0x2e')]=_0x5b3735[_0xa933('0x2e')]||0x96;this[_0xa933('0x2f')]=_0x5b3735[_0xa933('0x2f')]||0x3;this[_0xa933('0x30')]=_0x5b3735[_0xa933('0x30')]||0x96;this[_0xa933('0x31')]=_0x5b3735[_0xa933('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x5b3735['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x5b3735[_0xa933('0x32')]||0x3;this[_0xa933('0x33')]=_0x5b3735[_0xa933('0x33')]||0x96;this['dialDropMaxRetry']=_0x5b3735[_0xa933('0x34')]||0x3;this[_0xa933('0x35')]=_0x5b3735[_0xa933('0x35')]||0x96;this[_0xa933('0x36')]=_0x5b3735[_0xa933('0x36')]||0x3;this[_0xa933('0x37')]=_0x5b3735['dialAbandonedRetryFrequency']||0x96;this[_0xa933('0x38')]=_0x5b3735['dialMachineMaxRetry']||0x3;this[_0xa933('0x39')]=_0x5b3735['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x5b3735[_0xa933('0x3a')]||0x3;this[_0xa933('0x3b')]=_0x5b3735['dialAgentRejectRetryFrequency']||0x96;this[_0xa933('0x3c')]=_0x5b3735['dialGlobalMaxRetry']||0x4;this[_0xa933('0x3d')]=_0x5b3735[_0xa933('0x3d')]?_0x5b3735[_0xa933('0x3d')]:undefined;this[_0xa933('0x3e')]=_0x5b3735[_0xa933('0x3e')]?_0x5b3735[_0xa933('0x3e')]:undefined;this[_0xa933('0x3f')]=_0x5b3735[_0xa933('0x3f')]||undefined;this[_0xa933('0x40')]=_0x5b3735['Interval']?_0x5b3735['Interval']:undefined;this[_0xa933('0x41')]=_0x5b3735[_0xa933('0x41')]||_0xa933('0x42');this['dialRandomLastDigitCallerIdNumber']=_0x5b3735['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xa933('0x43')]=_0x5b3735[_0xa933('0x43')]||undefined;this[_0xa933('0x44')]=strategy[_0x5b3735[_0xa933('0x44')]]||'rrmemory';this['queueStatusComplete']=!![];this[_0xa933('0x45')]=_0x5b3735['dialAMDActive']||![];this[_0xa933('0x46')]=_0x5b3735['dialAMDInitialSilence'];this[_0xa933('0x47')]=_0x5b3735[_0xa933('0x47')];this[_0xa933('0x48')]=_0x5b3735[_0xa933('0x48')];this[_0xa933('0x49')]=_0x5b3735[_0xa933('0x49')];this[_0xa933('0x4a')]=_0x5b3735[_0xa933('0x4a')];this[_0xa933('0x4b')]=_0x5b3735[_0xa933('0x4b')];this[_0xa933('0x4c')]=_0x5b3735['dialAMDMaximumNumberOfWords'];this[_0xa933('0x4d')]=_0x5b3735[_0xa933('0x4d')];this[_0xa933('0x4e')]=_0x5b3735['dialAMDMaximumWordLength'];this[_0xa933('0x4f')]=0x0;this[_0xa933('0x50')]=0x0;this[_0xa933('0x51')]=_0x5b3735[_0xa933('0x51')];this[_0xa933('0x52')]=0x0;this[_0xa933('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xa933('0x54')]=0x0;this[_0xa933('0x55')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xa933('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa933('0x57')]=0x0;this[_0xa933('0x58')]=0x0;this[_0xa933('0x59')]=0x0;this[_0xa933('0x5a')]=0x0;this[_0xa933('0x5b')]=undefined;this[_0xa933('0x5c')]=undefined;this['handlePredictive']=undefined;this[_0xa933('0x5d')]=1.05;this[_0xa933('0x5e')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xa933('0x5f')]=0x0;this[_0xa933('0x60')]=0x0;this[_0xa933('0x61')]=0x0;this[_0xa933('0x62')]=0x0;this[_0xa933('0x63')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x5b3735[_0xa933('0x64')]||0x14;this[_0xa933('0x65')]=_0x5b3735['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xa933('0x66')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xa933('0x67')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x5b3735[_0xa933('0x68')]||0x1e;this[_0xa933('0x69')]=_0x5b3735[_0xa933('0x69')]||![];this[_0xa933('0x6a')]=_0x5b3735[_0xa933('0x6a')]||undefined;this[_0xa933('0x6b')]=_0x5b3735[_0xa933('0x6b')]||![];this[_0xa933('0x6c')]=_0x5b3735[_0xa933('0x6c')]||![];this[_0xa933('0xc')]=monitorFormat[_0x5b3735[_0xa933('0xc')]]?monitorFormat[_0x5b3735[_0xa933('0xc')]]:undefined;this[_0xa933('0x6d')]=_0x5b3735[_0xa933('0x6d')]||![];this[_0xa933('0x6e')]=_0x5b3735[_0xa933('0x6e')]?_0x5b3735[_0xa933('0x6e')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d11a2b3..b5f7c19 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb25e=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0xb25e,0x1db));var _0xeb25=function(_0x317dee,_0x4d7678){_0x317dee=_0x317dee-0x0;var _0x55e187=_0xb25e[_0x317dee];return _0x55e187;};'use strict';function VtigerAccount(_0x2b17ed){this['id']=_0x2b17ed['id']||0x0;this[_0xeb25('0x0')]=_0x2b17ed[_0xeb25('0x0')]||'';this['username']=_0x2b17ed[_0xeb25('0x1')]||'';this[_0xeb25('0x2')]=_0x2b17ed[_0xeb25('0x2')]||'';this[_0xeb25('0x3')]=_0x2b17ed['remoteUri']||'';this[_0xeb25('0x4')]=_0x2b17ed[_0xeb25('0x4')]||'';this[_0xeb25('0x5')]=_0x2b17ed[_0xeb25('0x5')]||{};}module[_0xeb25('0x6')]=VtigerAccount; \ No newline at end of file +var _0x4768=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4768,0x78));var _0x8476=function(_0x2689ec,_0x5de592){_0x2689ec=_0x2689ec-0x0;var _0x1e58bf=_0x4768[_0x2689ec];return _0x1e58bf;};'use strict';function VtigerAccount(_0xddb437){this['id']=_0xddb437['id']||0x0;this[_0x8476('0x0')]=_0xddb437[_0x8476('0x0')]||'';this[_0x8476('0x1')]=_0xddb437[_0x8476('0x1')]||'';this[_0x8476('0x2')]=_0xddb437[_0x8476('0x2')]||'';this[_0x8476('0x3')]=_0xddb437[_0x8476('0x3')]||'';this[_0x8476('0x4')]=_0xddb437[_0x8476('0x4')]||'';this[_0x8476('0x5')]=_0xddb437[_0x8476('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8f84a50..32f87c1 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x27569d,_0x1949fc){_0x27569d=_0x27569d-0x0;var _0x7ec674=_0xdb28[_0x27569d];return _0x7ec674;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x37f6b5,_0x3ee386){_0x37f6b5=_0x37f6b5-0x0;var _0xb9e4a5=_0xadb5[_0x37f6b5];return _0xb9e4a5;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c54b708..0364d99 100644 --- a/server/services/ami/model/zohoAccount.js +++ b/server/services/ami/model/zohoAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0ee=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x129a45,_0x3ee461){var _0x41d56b=function(_0x371275){while(--_0x371275){_0x129a45['push'](_0x129a45['shift']());}};_0x41d56b(++_0x3ee461);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xb0ee[_0x25d386];return _0x857f4a;};'use strict';function ZohoAccount(_0x51102b){this['id']=_0x51102b['id']||0x0;this[_0xeb0e('0x0')]=_0x51102b[_0xeb0e('0x0')]||'';this[_0xeb0e('0x1')]=_0x51102b[_0xeb0e('0x1')]||'';this[_0xeb0e('0x2')]=_0x51102b[_0xeb0e('0x2')]||'';this[_0xeb0e('0x3')]=_0x51102b[_0xeb0e('0x3')]||'';this[_0xeb0e('0x4')]=_0x51102b[_0xeb0e('0x4')]||'';this['clientSecret']=_0x51102b[_0xeb0e('0x5')]||'';this[_0xeb0e('0x6')]=_0x51102b[_0xeb0e('0x6')]||'';this[_0xeb0e('0x7')]=_0x51102b['code']||'';this[_0xeb0e('0x8')]=_0x51102b[_0xeb0e('0x8')]||'';this[_0xeb0e('0x9')]=_0x51102b[_0xeb0e('0x9')]||{};}module[_0xeb0e('0xa')]=ZohoAccount; \ No newline at end of file +var _0xe99c=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x3536dd,_0x14e817){var _0x2203f2=function(_0x4a33c0){while(--_0x4a33c0){_0x3536dd['push'](_0x3536dd['shift']());}};_0x2203f2(++_0x14e817);}(_0xe99c,0x197));var _0xce99=function(_0x1e830c,_0x30cb3c){_0x1e830c=_0x1e830c-0x0;var _0x277c43=_0xe99c[_0x1e830c];return _0x277c43;};'use strict';function ZohoAccount(_0x49a390){this['id']=_0x49a390['id']||0x0;this['name']=_0x49a390[_0xce99('0x0')]||'';this[_0xce99('0x1')]=_0x49a390[_0xce99('0x1')]||'';this[_0xce99('0x2')]=_0x49a390[_0xce99('0x2')]||'';this[_0xce99('0x3')]=_0x49a390['zone']||'';this['clientId']=_0x49a390[_0xce99('0x4')]||'';this['clientSecret']=_0x49a390[_0xce99('0x5')]||'';this['serverUrl']=_0x49a390[_0xce99('0x6')]||'';this[_0xce99('0x7')]=_0x49a390[_0xce99('0x7')]||'';this[_0xce99('0x8')]=_0x49a390[_0xce99('0x8')]||'';this[_0xce99('0x9')]=_0x49a390[_0xce99('0x9')]||{};}module[_0xce99('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index deadb42..d704d72 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45b0=['countmachineretry','countagentrejectretry','callback','callbackuniqueid','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','phone','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0xfa2742,_0x14e2ec){var _0x3d3cf2=function(_0x370776){while(--_0x370776){_0xfa2742['push'](_0xfa2742['shift']());}};_0x3d3cf2(++_0x14e2ec);}(_0x45b0,0x15d));var _0x045b=function(_0x2cb18d,_0x48dfaf){_0x2cb18d=_0x2cb18d-0x0;var _0x4b2b61=_0x45b0[_0x2cb18d];return _0x4b2b61;};'use strict';var util=require(_0x045b('0x0'));var _=require(_0x045b('0x1'));var moment=require(_0x045b('0x2'));function checkNameSurname(_0x3f3d68,_0x47df5e,_0x4c5455){var _0x34f0e3='';if(!_['isNil'](_0x47df5e)&&_0x045b('0x3')===typeof _0x47df5e){_0x34f0e3+=_0x47df5e;}if(!_[_0x045b('0x4')](_0x4c5455)&&_0x045b('0x3')===typeof _0x4c5455){_0x34f0e3+='\x20'+_0x4c5455;}if(_0x34f0e3!==''){return _0x34f0e3;}return _0x3f3d68;}function Action(_0x1edb92,_0x3b5403,_0x28616b,_0x225111,_0x5b65b2){this[_0x045b('0x5')]=_0x28616b||undefined;this[_0x045b('0x6')]=_0x1edb92['id'];this[_0x045b('0x7')]=_0x3b5403['name'];this['type']=_0x3b5403[_0x045b('0x8')];this[_0x045b('0x9')]='queue';this[_0x045b('0xa')]=![];this[_0x045b('0xb')]=_[_0x045b('0x4')](_0x1edb92[_0x045b('0xc')])?undefined:_0x1edb92['Agent']['name'];this[_0x045b('0xd')]=this['membername']?util[_0x045b('0xe')]('SIP/%s',this[_0x045b('0xb')]):_0x225111||undefined;this[_0x045b('0xf')]=checkNameSurname(_0x1edb92['Contact'][_0x045b('0x10')],_0x1edb92[_0x045b('0x11')]['firstName'],_0x1edb92[_0x045b('0x11')][_0x045b('0x12')]);this[_0x045b('0x13')]=_0x1edb92[_0x045b('0x13')]||![];this[_0x045b('0x14')]=_0x1edb92[_0x045b('0x11')][_0x045b('0x10')];this['scheduledat']=_0x1edb92[_0x045b('0x15')];this[_0x045b('0x16')]=_0x1edb92[_0x045b('0x16')]||0x0;this[_0x045b('0x17')]=_0x1edb92[_0x045b('0x17')]||0x0;this['countnoanswerretry']=_0x1edb92[_0x045b('0x18')]||0x0;this[_0x045b('0x19')]=(_0x1edb92[_0x045b('0x16')]||0x0)+(_0x1edb92[_0x045b('0x17')]||0x0)+(_0x1edb92['countnoanswerretry']||0x0)+(_0x1edb92[_0x045b('0x1a')]||0x0)+(_0x1edb92[_0x045b('0x1b')]||0x0)+(_0x1edb92[_0x045b('0x1c')]||0x0)+(_0x1edb92[_0x045b('0x1d')]||0x0)+(_0x1edb92['countagentrejectretry']||0x0);this[_0x045b('0x1a')]=_0x1edb92[_0x045b('0x1a')]||0x0;this[_0x045b('0x1b')]=_0x1edb92[_0x045b('0x1b')]||0x0;this['countabandonedretry']=_0x1edb92[_0x045b('0x1c')]||0x0;this['countmachineretry']=_0x1edb92[_0x045b('0x1d')]||0x0;this['countagentrejectretry']=_0x1edb92[_0x045b('0x1e')]||0x0;this[_0x045b('0x1f')]=_0x1edb92[_0x045b('0x1f')];this['callbackuniqueid']=_0x1edb92[_0x045b('0x20')];this['callbackat']=_0x1edb92['callbackat'];this['recallme']=_0x1edb92['recallme'];this[_0x045b('0x21')]=_0x1edb92[_0x045b('0x21')];this[_0x045b('0x22')]=_0x1edb92[_0x045b('0x22')];this['UserId']=_['isNil'](_0x1edb92[_0x045b('0xc')])?_0x1edb92[_0x045b('0x23')]:_0x1edb92[_0x045b('0xc')]['id'];this[_0x045b('0x24')]=_0x1edb92['VoiceQueueId'];this['originatecalleridnum']='';this[_0x045b('0x25')]='';}Action[_0x045b('0x26')]['getCaller']=function(){return util[_0x045b('0xe')](_0x045b('0x27'),this[_0x045b('0xf')],this[_0x045b('0x28')]);};module[_0x045b('0x29')]=Action; \ No newline at end of file +var _0xfc89=['campaigntype','queue','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','exports','lodash','isNil','string','uniqueid','idContact','type'];(function(_0x3ff01b,_0x342bc0){var _0x550860=function(_0x17a6cc){while(--_0x17a6cc){_0x3ff01b['push'](_0x3ff01b['shift']());}};_0x550860(++_0x342bc0);}(_0xfc89,0x1c6));var _0x9fc8=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xfc89[_0x5c351c];return _0x26f3b3;};'use strict';var util=require('util');var _=require(_0x9fc8('0x0'));var moment=require('moment');function checkNameSurname(_0x2d9a55,_0x335cd7,_0x33a380){var _0x4adbd1='';if(!_[_0x9fc8('0x1')](_0x335cd7)&&_0x9fc8('0x2')===typeof _0x335cd7){_0x4adbd1+=_0x335cd7;}if(!_[_0x9fc8('0x1')](_0x33a380)&&_0x9fc8('0x2')===typeof _0x33a380){_0x4adbd1+='\x20'+_0x33a380;}if(_0x4adbd1!==''){return _0x4adbd1;}return _0x2d9a55;}function Action(_0xbbcdba,_0x2c76f5,_0x4562b0,_0x4c031e,_0x23b91e){this[_0x9fc8('0x3')]=_0x4562b0||undefined;this[_0x9fc8('0x4')]=_0xbbcdba['id'];this['queue']=_0x2c76f5['name'];this[_0x9fc8('0x5')]=_0x2c76f5[_0x9fc8('0x5')];this[_0x9fc8('0x6')]=_0x9fc8('0x7');this[_0x9fc8('0x8')]=![];this[_0x9fc8('0x9')]=_[_0x9fc8('0x1')](_0xbbcdba[_0x9fc8('0xa')])?undefined:_0xbbcdba['Agent'][_0x9fc8('0xb')];this[_0x9fc8('0xc')]=this[_0x9fc8('0x9')]?util[_0x9fc8('0xd')](_0x9fc8('0xe'),this['membername']):_0x4c031e||undefined;this['calleridname']=checkNameSurname(_0xbbcdba[_0x9fc8('0xf')][_0x9fc8('0x10')],_0xbbcdba['Contact'][_0x9fc8('0x11')],_0xbbcdba['Contact'][_0x9fc8('0x12')]);this[_0x9fc8('0x13')]=_0xbbcdba['active']||![];this[_0x9fc8('0x14')]=_0xbbcdba[_0x9fc8('0xf')][_0x9fc8('0x10')];this[_0x9fc8('0x15')]=_0xbbcdba['scheduledat'];this[_0x9fc8('0x16')]=_0xbbcdba[_0x9fc8('0x16')]||0x0;this[_0x9fc8('0x17')]=_0xbbcdba[_0x9fc8('0x17')]||0x0;this[_0x9fc8('0x18')]=_0xbbcdba[_0x9fc8('0x18')]||0x0;this[_0x9fc8('0x19')]=(_0xbbcdba[_0x9fc8('0x16')]||0x0)+(_0xbbcdba[_0x9fc8('0x17')]||0x0)+(_0xbbcdba[_0x9fc8('0x18')]||0x0)+(_0xbbcdba['countnosuchnumberretry']||0x0)+(_0xbbcdba['countdropretry']||0x0)+(_0xbbcdba[_0x9fc8('0x1a')]||0x0)+(_0xbbcdba[_0x9fc8('0x1b')]||0x0)+(_0xbbcdba[_0x9fc8('0x1c')]||0x0);this['countnosuchnumberretry']=_0xbbcdba[_0x9fc8('0x1d')]||0x0;this[_0x9fc8('0x1e')]=_0xbbcdba[_0x9fc8('0x1e')]||0x0;this[_0x9fc8('0x1a')]=_0xbbcdba[_0x9fc8('0x1a')]||0x0;this['countmachineretry']=_0xbbcdba[_0x9fc8('0x1b')]||0x0;this[_0x9fc8('0x1c')]=_0xbbcdba[_0x9fc8('0x1c')]||0x0;this['callback']=_0xbbcdba[_0x9fc8('0x1f')];this[_0x9fc8('0x20')]=_0xbbcdba[_0x9fc8('0x20')];this['callbackat']=_0xbbcdba[_0x9fc8('0x21')];this[_0x9fc8('0x22')]=_0xbbcdba[_0x9fc8('0x22')];this['ContactId']=_0xbbcdba[_0x9fc8('0x23')];this[_0x9fc8('0x24')]=_0xbbcdba[_0x9fc8('0x24')];this[_0x9fc8('0x25')]=_[_0x9fc8('0x1')](_0xbbcdba[_0x9fc8('0xa')])?_0xbbcdba[_0x9fc8('0x25')]:_0xbbcdba[_0x9fc8('0xa')]['id'];this[_0x9fc8('0x26')]=_0xbbcdba[_0x9fc8('0x26')];this[_0x9fc8('0x27')]='';this[_0x9fc8('0x28')]='';}Action[_0x9fc8('0x29')][_0x9fc8('0x2a')]=function(){return util[_0x9fc8('0xd')](_0x9fc8('0x2b'),this[_0x9fc8('0x2c')],this['number']);};module[_0x9fc8('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 39b878c..6b0fb9d 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6953=['[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','unlockAgent','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','\x20Queue','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','disableContact','getContactPreview','recallme','isValid','checkIsBlackList','VoiceQueueId','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','logLookAgent','isFailure','unlockContact','idContact','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','util','lodash','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','prototype','syncCampaigns','dialMethod','booked','clearZombieChannels','hasOwnProperty','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','Action','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','catch','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','countbusyretry','Busy','custom:agentbusy','busy','dialGlobalMaxRetry'];(function(_0x461981,_0x302d72){var _0x212fcd=function(_0x4d0db3){while(--_0x4d0db3){_0x461981['push'](_0x461981['shift']());}};_0x212fcd(++_0x302d72);}(_0x6953,0x91));var _0x3695=function(_0xcf7425,_0x2ec7b4){_0xcf7425=_0xcf7425-0x0;var _0xd76b28=_0x6953[_0xcf7425];return _0xd76b28;};'use strict';var util=require(_0x3695('0x0'));var _=require(_0x3695('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x3695('0x2'));var Redis=require('ioredis');var config=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var loggerAction=require('../../../config/logger')(_0x3695('0x6'));var ami=require('../ami');var rpcDb=require(_0x3695('0x7'));var Action=require(_0x3695('0x8'));var ut=require(_0x3695('0x9'));config[_0x3695('0xa')]=_[_0x3695('0xb')](config['redis'],{'host':_0x3695('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3695('0xa')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xd21435){this['tail']=this[_0x3695('0xd')]?this[_0x3695('0xd')][_0x3695('0xe')](_0xd21435):_0xd21435();};function Preview(_0x149594){this[_0x3695('0xf')]=new Sequence();this[_0x3695('0x10')]=_0x149594['voiceQueues'];this[_0x3695('0x11')]=_0x149594[_0x3695('0x11')];this[_0x3695('0x12')]={};this[_0x3695('0x13')]=_0x149594[_0x3695('0x13')];this[_0x3695('0x14')]=0x0;ami['on'](_0x3695('0x15'),this[_0x3695('0x16')][_0x3695('0x17')](this));ami['on'](_0x3695('0x18'),this[_0x3695('0x19')]['bind'](this));ami['on'](_0x3695('0x1a'),this[_0x3695('0x1b')][_0x3695('0x17')](this));ami['on'](_0x3695('0x1c'),this[_0x3695('0x1d')][_0x3695('0x17')](this));ami['on'](_0x3695('0x1e'),this['syncNewExten'][_0x3695('0x17')](this));ami['on']('varset',this[_0x3695('0x1f')][_0x3695('0x17')](this));ami['on'](_0x3695('0x20'),this[_0x3695('0x21')][_0x3695('0x17')](this));ami['on']('blindtransfer',this[_0x3695('0x22')][_0x3695('0x17')](this));this[_0x3695('0x23')](this[_0x3695('0x10')]);}function emit(_0xc076a9,_0x1ebba8,_0x34b0fc){io['to'](_0xc076a9)[_0x3695('0x24')](_0x1ebba8,_0x34b0fc);}function emitCampaignPreview(_0x1f267a){if(_0x1f267a[_0x3695('0x25')]===_0x3695('0x26')){var _0xf2c747={'id':_0x1f267a['id'],'name':_0x1f267a[_0x3695('0x27')],'strategy':_0x1f267a[_0x3695('0x28')],'answered':_0x1f267a['answered'],'available':_0x1f267a[_0x3695('0x29')],'loggedIn':_0x1f267a[_0x3695('0x2a')],'pTalking':_0x1f267a['pTalking'],'sumBillable':_0x1f267a['sumBillable'],'sumDuration':_0x1f267a[_0x3695('0x2b')],'sumHoldTime':_0x1f267a[_0x3695('0x2c')]||0x0,'talking':_0x1f267a[_0x3695('0x2d')],'total':_0x1f267a[_0x3695('0x2e')],'type':_0x1f267a['type'],'unmanaged':_0x1f267a[_0x3695('0x2f')],'abandoned':_0x1f267a['abandoned'],'waiting':_0x1f267a[_0x3695('0x30')],'loggedInDb':_0x1f267a['loggedInDb'],'dialActive':_0x1f267a[_0x3695('0x31')],'dialMethod':_0x1f267a['dialMethod'],'dialOriginateCallerIdName':_0x1f267a[_0x3695('0x32')],'dialOriginateCallerIdNumber':_0x1f267a[_0x3695('0x33')],'dialOriginateTimeout':_0x1f267a[_0x3695('0x34')],'dialPrefix':_0x1f267a[_0x3695('0x35')],'outboundAnswerAgiCallsDay':_0x1f267a[_0x3695('0x36')],'outboundAnswerCallsDay':_0x1f267a[_0x3695('0x37')],'outboundBlacklistCallsDay':_0x1f267a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1f267a[_0x3695('0x38')],'outboundCongestionCallsDay':_0x1f267a[_0x3695('0x39')],'outboundDropCallsDayACS':_0x1f267a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1f267a[_0x3695('0x3a')],'outboundDropCallsDayTimeout':_0x1f267a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1f267a[_0x3695('0x3b')],'outboundNoSuchCallsDay':_0x1f267a[_0x3695('0x3c')],'outboundOriginateFailureCallsDay':_0x1f267a[_0x3695('0x3d')],'outboundReCallsDay':_0x1f267a[_0x3695('0x3e')],'outboundRejectCallsDay':_0x1f267a[_0x3695('0x3f')],'outboundUnknownCallsDay':_0x1f267a[_0x3695('0x40')],'outboundAbandonedCallsDay':_0x1f267a[_0x3695('0x41')],'predictiveIntervalAnsweredCalls':_0x1f267a[_0x3695('0x42')],'predictiveIntervalAvgHoldtime':_0x1f267a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1f267a[_0x3695('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x1f267a[_0x3695('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x1f267a[_0x3695('0x45')],'predictiveIntervalErlangCalls':_0x1f267a['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1f267a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1f267a[_0x3695('0x46')],'predictiveIntervalMultiplicativeFactor':_0x1f267a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1f267a[_0x3695('0x47')],'predictiveIntervalAvailable':_0x1f267a[_0x3695('0x48')],'predictiveIntervalTotalCalls':_0x1f267a['predictiveIntervalTotalCalls'],'message':_0x1f267a[_0x3695('0x49')],'originated':_0x1f267a['originated'],'erlangCalls':_0x1f267a[_0x3695('0x4a')],'erlangCallToSecond':_0x1f267a[_0x3695('0x4b')],'erlangAbandonmentRate':_0x1f267a[_0x3695('0x4c')],'erlangBusyFactor':_0x1f267a[_0x3695('0x4d')],'startPredictive':_0x1f267a[_0x3695('0x4e')],'startProgressive':_0x1f267a[_0x3695('0x4f')]};if(_0x1f267a['Trunk']){_0xf2c747[_0x3695('0x50')]={'id':_0x1f267a[_0x3695('0x50')]['id'],'name':_0x1f267a['Trunk'][_0x3695('0x27')],'active':_0x1f267a[_0x3695('0x50')]['active'],'callerid':_0x1f267a['Trunk']['callerid']};}if(_0x1f267a['Interval']){_0xf2c747[_0x3695('0x51')]={'id':_0x1f267a[_0x3695('0x51')]['id'],'name':_0x1f267a['Interval'][_0x3695('0x27')]};}var _0x323e21=md5(JSON[_0x3695('0x52')](_0xf2c747));if(_0x1f267a[_0x3695('0x2')]!==_0x323e21){_0x1f267a['md5']=_0x323e21;emit(util['format'](_0x3695('0x53'),_0xf2c747[_0x3695('0x27')]),'voice_queue:save',_0xf2c747);}}}function emitVoiceQueueChannelRemove(_0x12ebe9){logger[_0x3695('0x54')](_0x3695('0x55'),JSON[_0x3695('0x52')](_0x12ebe9));emit(util[_0x3695('0x56')](_0x3695('0x53'),_0x12ebe9[_0x3695('0x27')]),_0x3695('0x57'),_0x12ebe9);io[_0x3695('0x24')](_0x3695('0x58'),_0x12ebe9);}function notSendMessagesQueue(_0x460b49){if(_0x460b49[_0x3695('0x59')]){if(_0x460b49[_0x3695('0x5a')]===0x0&&_0x460b49[_0x3695('0x5b')]===0x0){_0x460b49[_0x3695('0x59')]=![];_0x460b49[_0x3695('0x29')]=0x0;_0x460b49['paused']=0x0;_0x460b49[_0x3695('0x49')]=_0x3695('0x5c');ut[_0x3695('0x5d')](_0x3695('0x5e'),_0x460b49[_0x3695('0x27')]+_0x3695('0x5f'));}else{_0x460b49[_0x3695('0x49')]='IS_DISACTIVED';ut[_0x3695('0x5d')](_0x3695('0x5e'),_0x460b49[_0x3695('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x460b49);}}Preview[_0x3695('0x60')][_0x3695('0x23')]=function(){var _0x3ffc79=this;setInterval(function(){_0x3ffc79[_0x3695('0x61')]();},0x7cf);};Preview[_0x3695('0x60')][_0x3695('0x61')]=function(){var _0x4261d1=this['campaignsPreview'];this[_0x3695('0x14')]+=0x1;for(var _0x49a9d8 in _0x4261d1){if(_0x4261d1['hasOwnProperty'](_0x49a9d8)&&(_0x4261d1[_0x49a9d8][_0x3695('0x62')]==='preview'||_0x4261d1[_0x49a9d8][_0x3695('0x62')]===_0x3695('0x63'))&&_0x4261d1[_0x49a9d8][_0x3695('0x25')]===_0x3695('0x26')){if(this['clockClearZombieChannels']>0x7){this[_0x3695('0x14')]=0x0;this[_0x3695('0x64')]();}}if(_0x4261d1[_0x3695('0x65')](_0x49a9d8)&&_0x4261d1[_0x49a9d8]['dialMethod']===_0x3695('0x5')&&_0x4261d1[_0x49a9d8][_0x3695('0x25')]===_0x3695('0x26')){if(_0x4261d1[_0x49a9d8][_0x3695('0x31')]){this[_0x3695('0x66')](_0x4261d1[_0x49a9d8]);this[_0x3695('0x67')](_0x4261d1[_0x49a9d8]);}else{notSendMessagesQueue(_0x4261d1[_0x49a9d8]);}}}};Preview[_0x3695('0x60')][_0x3695('0x68')]=function(_0x3dd06a){var _0x5d5d70=this;this['sequence'][_0x3695('0x69')](function(){if(!_[_0x3695('0x6a')](_0x5d5d70[_0x3695('0x12')][_0x3dd06a])){loggerAction['info'](_0x3695('0x6b'),_0x3dd06a,_0x3695('0x6c'),_0x5d5d70[_0x3695('0x12')][_0x3dd06a]['queue'],_0x3695('0x6d'),JSON[_0x3695('0x52')](_0x5d5d70[_0x3695('0x10')][_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]]['originated']),_0x3695('0x6f'),JSON[_0x3695('0x52')](_0x5d5d70[_0x3695('0x10')][_0x5d5d70[_0x3695('0x12')][_0x3dd06a]['queue']][_0x3695('0x5b')]),JSON['stringify'](_0x5d5d70['actions'][_0x3dd06a][_0x3695('0x70')]),JSON[_0x3695('0x52')](_[_0x3695('0x71')](_0x5d5d70[_0x3695('0x12')][_0x3dd06a],[_0x3695('0x72'),'UserId','VoiceQueueId','ListId'])));return ami[_0x3695('0x73')]({'action':'status','channel':_0x5d5d70['actions'][_0x3dd06a]['channel']})['catch'](function(_0x3b1c1c){if(_0x3b1c1c[_0x3695('0x49')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5d5d70[_0x3695('0x12')][_0x3dd06a]){ut[_0x3695('0x74')](_0x5d5d70['campaignsPreview'][_0x5d5d70['actions'][_0x3dd06a][_0x3695('0x6e')]],_0x3695('0x75'));if(_0x5d5d70[_0x3695('0x12')][_0x3dd06a]['dialAnswer']===!![]){ut[_0x3695('0x76')](_0x5d5d70[_0x3695('0x10')][_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]],_0x3695('0x75'));ut[_0x3695('0x77')](_0x3695('0x78')+_0x3dd06a,_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]);}ut[_0x3695('0x77')](_0x3695('0x79')+_0x3dd06a,_0x5d5d70[_0x3695('0x12')][_0x3dd06a][_0x3695('0x6e')]);delete _0x5d5d70[_0x3695('0x12')][_0x3dd06a];}},0x2328);}});}});};Preview[_0x3695('0x60')][_0x3695('0x64')]=function(){var _0x441997=this;loggerAction[_0x3695('0x54')](_0x3695('0x7a'),_[_0x3695('0x7b')](this[_0x3695('0x12')]));for(var _0x4148ec in this[_0x3695('0x12')]){if(_0x441997['actions']['hasOwnProperty'](_0x4148ec)){_0x441997[_0x3695('0x68')](_0x4148ec);}}};Preview[_0x3695('0x60')]['recallMe']=function(_0x323411){var _0x43f6f5=this;rpcDb[_0x3695('0x7c')](_0x323411['id'],ut[_0x3695('0x7d')](this[_0x3695('0x13')]))[_0x3695('0x7e')](function(_0x38d20c){if(!_[_0x3695('0x6a')](_0x38d20c)){for(var _0x520fd3=0x0;_0x520fd3<_0x38d20c[_0x3695('0x7f')];_0x520fd3+=0x1){if(ut['getDiff'](_0x38d20c[_0x520fd3][_0x3695('0x80')])<_0x323411[_0x3695('0x81')]*0x3c){if(_0x38d20c[_0x520fd3][_0x3695('0x82')]&&!_0x38d20c[_0x520fd3][_0x3695('0x82')][_0x3695('0x83')]){_0x43f6f5['run'](_0x38d20c[_0x520fd3]['id'])[_0x3695('0x7e')](ut[_0x3695('0x84')](_0x3695('0x85')))['catch'](ut[_0x3695('0x84')](_0x3695('0x85')));}else{rpcDb['disableContact'](_0x38d20c[_0x520fd3]['id']);}}else{var _0x47cd30=new Action(_0x38d20c[_0x520fd3],_0x323411);_0x47cd30[_0x3695('0x86')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x323411[_0x3695('0x3e')]+=0x1;ut[_0x3695('0x87')](_0x47cd30,0x17,_0x3695('0x88'));if(_0x323411[_0x3695('0x89')]){rpcDb[_0x3695('0x8a')](ut['createBody'](_0x38d20c[_0x520fd3]));rpcDb[_0x3695('0x8b')](_0x47cd30,_0x3695('0x8c'));}else{ut[_0x3695('0x87')](_0x47cd30,0x16,'RecallFailedTimeout');rpcDb[_0x3695('0x8b')](_0x47cd30,_0x3695('0x8d'));rpcDb[_0x3695('0x8e')](_0x47cd30,_0x3695('0x8d'));}}}}})[_0x3695('0x8f')](ut[_0x3695('0x84')]('[getContactRecallMe]'));};Preview[_0x3695('0x60')][_0x3695('0x66')]=function(_0x41e8de){_0x41e8de[_0x3695('0x59')]=!![];if(ut[_0x3695('0x90')](_0x41e8de['loggedIn'])){_0x41e8de[_0x3695('0x49')]=_0x3695('0x91');}else if(!ut[_0x3695('0x92')](_0x41e8de[_0x3695('0x31')])){_0x41e8de[_0x3695('0x49')]=_0x3695('0x5c');}else if(!this['isTrunkReachable'](_0x41e8de[_0x3695('0x50')])){if(!this[_0x3695('0x93')](_0x41e8de['TrunkBackup'])){_0x41e8de['message']=_0x3695('0x94');}else{_0x41e8de[_0x3695('0x49')]=_0x3695('0x95');}}else{_0x41e8de['message']=_0x3695('0x95');}emitCampaignPreview(_0x41e8de);};Preview[_0x3695('0x60')][_0x3695('0x96')]=function(_0x46ca05,_0x2f149a,_0x4e8d2a){var _0x41f968=this;var _0x4ed632=this['actions'][_0x2f149a];var _0x47def1=this[_0x3695('0x10')][_0x4ed632[_0x3695('0x6e')]];var _0xfe1cf7;if(_0x47def1){switch(_0x4e8d2a){case'1':_0x47def1[_0x3695('0x3c')]+=0x1;_0x4ed632[_0x3695('0x97')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x0,_0x3695('0x9a'));ami[_0x3695('0x24')](_0x3695('0x9b'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0x9d')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0x9e'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1['dialGlobalMaxRetry']){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,_0x3695('0xa1'));}else{if(_0x4ed632[_0x3695('0x97')]>=_0x47def1[_0x3695('0xa2')]){rpcDb['createCustomerFinal'](_0x4ed632,_0x3695('0xa1'));}else{rpcDb[_0x3695('0xa3')](ut['scheduledAt'](_0x4ed632,'countnosuchnumberretry',_0x47def1[_0x3695('0xa4')]),_0x4ed632['unlockAgent'],_0x4ed632[_0x3695('0xa5')]);}}delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];break;case _0x3695('0xa7'):var _0x75339d=moment()['format'](_0x3695('0xa8'));_0x4ed632[_0x3695('0xa9')]=_0x75339d;_0x4ed632[_0x3695('0xaa')]=_0x75339d;_0x4ed632['dialAnswer']=!![];_0x47def1['pTalking']+=0x1;logger['info'](_0x3695('0xab'),_0x4ed632[_0x3695('0xac')],'\x20Queue',_0x47def1[_0x3695('0x27')],_0x3695('0x6f'),_0x47def1[_0x3695('0x5b')]);ami[_0x3695('0x24')](_0x3695('0xad'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xae'),this[_0x3695('0x10')][_0x4ed632['queue']]));if(_0x47def1[_0x3695('0xaf')]){ami[_0x3695('0x24')](_0x3695('0xb0'),ut[_0x3695('0xb1')](_0x4ed632));}break;case'16':ami[_0x3695('0x24')](_0x3695('0xb2'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xb3'),this['campaignsPreview'][_0x4ed632[_0x3695('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xb3')));_0x47def1[_0x3695('0x37')]+=0x1;_0x47def1[_0x3695('0x2e')]+=0x1;_0x47def1[_0x3695('0xb4')]+=0x1;ut[_0x3695('0x76')](_0x47def1,_0x3695('0xb5'));_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x4,_0x3695('0xb6'));rpcDb[_0x3695('0x8b')](_0x4ed632,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x4ed632,_0x3695('0xb7'));rpcDb[_0x3695('0xb8')](_0x4ed632);_0x47def1[_0x3695('0x2b')]+=_0x4ed632['talktime'];_0x47def1[_0x3695('0xb9')]+=_0x4ed632[_0x3695('0xba')];logger[_0x3695('0x54')]('[syncHangup][talking][decrement]',_0x4ed632[_0x3695('0xac')],'\x20Queue',_0x47def1[_0x3695('0x27')],_0x3695('0x6f'),_0x47def1[_0x3695('0x5b')]);delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];break;case'BUSY':_0x47def1[_0x3695('0x38')]+=0x1;_0x4ed632[_0x3695('0xbb')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x5,_0x3695('0xbc'));ami[_0x3695('0x24')](_0x3695('0xbd'),ut['buildObj'](_0x4ed632,_0x3695('0xbe')));rpcDb['createCustomerHistory'](_0x4ed632,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb['createCustomerFinal'](_0xfe1cf7,_0x3695('0xc0'));}else{if(_0x4ed632['countbusyretry']>=_0x47def1[_0x3695('0xc1')]){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xbb'),_0x47def1['dialBusyRetryFrequency']),_0x4ed632['unlockAgent'],_0x4ed632['activeContact']);}}break;case _0x3695('0xc4'):_0x47def1[_0x3695('0x3b')]+=0x1;_0x4ed632[_0x3695('0xc5')]+=0x1;_0x4ed632['countglobal']=ut['totalGlobal'](_0x4ed632);ut['logCustomer'](_0x4ed632,0x3,'NoAnswer');ami['emit'](_0x3695('0xc6'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xc7')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0xc8'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1['dialGlobalMaxRetry']){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,_0x3695('0xc9'));}else{if(_0x4ed632[_0x3695('0xc5')]>=_0x47def1[_0x3695('0xca')]){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xc8'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xc5'),_0x47def1[_0x3695('0xcb')]),_0x4ed632[_0x3695('0xcc')],_0x4ed632[_0x3695('0xa5')]);}}break;case _0x3695('0xcd'):_0x47def1[_0x3695('0x39')]+=0x1;_0x4ed632[_0x3695('0xce')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x8,_0x3695('0xcf'));ami[_0x3695('0x24')](_0x3695('0xd0'),ut[_0x3695('0x9c')](_0x4ed632,_0x3695('0xd1')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0xd2'));if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,'Global');rpcDb[_0x3695('0x8e')](_0xfe1cf7,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4ed632[_0x3695('0xce')]>=_0x47def1['dialCongestionMaxRetry']){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xd2'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xce'),_0x47def1[_0x3695('0xd3')]),_0x4ed632['unlockAgent'],_0x4ed632[_0x3695('0xa5')]);}}break;case _0x3695('0xd4'):_0x47def1[_0x3695('0x3f')]+=0x1;_0x4ed632[_0x3695('0xd5')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x14,'AgentReject');ami['emit'](_0x3695('0xd6'),ut['buildObj'](_0x4ed632,_0x3695('0xd7')));rpcDb[_0x3695('0x8b')](_0x4ed632,_0x3695('0xd8'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1['dialGlobalMaxRetry']){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0x14,_0x3695('0xd9'));rpcDb['createCustomerFinal'](_0xfe1cf7,_0x3695('0xda'));}else{if(_0x4ed632['countagentrejectretry']>=_0x47def1[_0x3695('0xdb')]){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xda'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,_0x3695('0xd5'),_0x47def1[_0x3695('0xdc')]),_0x4ed632['unlockAgent'],_0x4ed632[_0x3695('0xa5')]);}}break;case _0x3695('0xdd'):_0x47def1[_0x3695('0x41')]+=0x1;_0x4ed632[_0x3695('0xde')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut['logCustomer'](_0x4ed632,0xb,'Abandoned');rpcDb[_0x3695('0x8b')](_0x4ed632,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut['cloneAction'](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb['createCustomerFinal'](_0xfe1cf7,_0x3695('0xdf'));}else{if(_0x4ed632[_0x3695('0xe0')]>=_0x47def1['dialAbandonedMaxRety']){rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xdf'));}else{rpcDb[_0x3695('0xa3')](ut[_0x3695('0xc3')](_0x4ed632,'countabandonedretry',_0x47def1[_0x3695('0xe1')]),_0x4ed632[_0x3695('0xcc')],_0x4ed632[_0x3695('0xa5')]);}}break;case'18':_0x47def1[_0x3695('0x40')]+=0x1;_0x4ed632[_0x3695('0xe2')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut['totalGlobal'](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0x12,_0x46ca05[_0x3695('0xe3')]||_0x46ca05[_0x3695('0xe4')]);ami[_0x3695('0x24')]('custom:amd',ut['buildObj'](_0x4ed632,_0x3695('0xe5')));rpcDb['createCustomerHistory'](_0x4ed632,_0x3695('0xe6'));if(ut[_0x3695('0x99')](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,_0x3695('0xe6'));}else{rpcDb['createCustomerFinal'](_0x4ed632,_0x3695('0xe6'));}delete this['actions'][_0x46ca05[_0x3695('0xa6')]];break;case'19':_0x47def1['outboundUnknownCallsDay']+=0x1;_0x4ed632['countglobal']=ut[_0x3695('0x99')](_0x4ed632);ut['logCustomer'](_0x4ed632,0x13,_0x46ca05[_0x3695('0xe3')]||_0x46ca05[_0x3695('0xe4')]);ami['emit'](_0x3695('0xe7'),ut[_0x3695('0x9c')](_0x4ed632,'amd'));rpcDb['createCustomerHistory'](_0x4ed632,_0x3695('0xe8'));if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut[_0x3695('0x9f')](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x3695('0x8e')](_0x4ed632,_0x3695('0xe8'));}delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];break;default:if(_0x4ed632[_0x3695('0x70')]){ut[_0x3695('0x76')](_0x47def1,_0x3695('0xe9'));ut['loggerError'](_0x3695('0xea')+_0x47def1[_0x3695('0x27')],_0x46ca05);}_0x47def1[_0x3695('0x40')]+=0x1;_0x4ed632[_0x3695('0x98')]=ut[_0x3695('0x99')](_0x4ed632);ut[_0x3695('0x87')](_0x4ed632,0xc,_0x46ca05[_0x3695('0xe3')]||_0x46ca05[_0x3695('0xe4')]);rpcDb['createCustomerHistory'](_0x4ed632,_0x3695('0xeb'));if(ut['totalGlobal'](_0x4ed632)>=_0x47def1[_0x3695('0xbf')]){_0xfe1cf7=ut['cloneAction'](_0x4ed632,0xf,_0x3695('0xa0'));rpcDb[_0x3695('0x8e')](_0xfe1cf7,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3695('0x8e')](_0x4ed632,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x3695('0x12')][_0x46ca05[_0x3695('0xa6')]];}if(!(_0x4ed632[_0x3695('0x70')]&&_0x4e8d2a==='16')){ut[_0x3695('0x74')](_0x47def1,_0x3695('0xec'));logger[_0x3695('0x54')]('[originated][decrement][callProgressDetectingCustomer]',_0x4ed632[_0x3695('0xac')],_0x3695('0xed'),_0x47def1['name'],_0x3695('0x6d'),_0x47def1[_0x3695('0x5a')]);}if(_0x4e8d2a!==_0x3695('0xa7')){delete this['actions'][_0x46ca05['linkedid']];delete this[_0x3695('0x12')][_0x46ca05['destlinkedid']];}}};Preview[_0x3695('0x60')]['callProgressDetectingAgent']=function(_0x287f2d,_0x554a34,_0x458976){if(_[_0x3695('0xee')](_0x554a34)&&'object'!==typeof _0x554a34){return;}if(_['isUndefined'](_0x458976)&&'object'!==typeof _0x458976){return;}switch(_0x458976[_0x3695('0xef')]){case'0':ut[_0x3695('0xf0')](_0x287f2d,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x287f2d,_0x3695('0xf1'));break;case'3':ut[_0x3695('0xf0')](_0x287f2d,0x3,'NoAnswer');rpcDb[_0x3695('0xf2')](_0x287f2d,_0x3695('0xf3'));break;case'5':ut[_0x3695('0xf0')](_0x287f2d,0x5,_0x3695('0xbc'));rpcDb[_0x3695('0xf2')](_0x287f2d,_0x3695('0xf4'));break;case'8':ut[_0x3695('0xf0')](_0x287f2d,0x8,_0x3695('0xcf'));rpcDb['createAgentHistory'](_0x287f2d,_0x3695('0xf5'));break;case'22':ut[_0x3695('0xf0')](_0x287f2d,0x16,'AnswerAGI');rpcDb[_0x3695('0xf2')](_0x287f2d,_0x3695('0xf6'));break;default:ut[_0x3695('0xf0')](_0x287f2d,0xc,_0x458976[_0x3695('0xef')]);rpcDb[_0x3695('0xf2')](_0x287f2d,'[callProgressDetectingAgent][logCongestion]');}ut[_0x3695('0x74')](_0x554a34,_0x3695('0xf7'));logger[_0x3695('0x54')](_0x3695('0xf8'),_0x287f2d['uniqueid'],_0x3695('0xed'),_0x554a34[_0x3695('0x27')],_0x3695('0x6d'),_0x554a34[_0x3695('0x5a')]);delete this[_0x3695('0x12')][_0x287f2d['uniqueid']];};Preview[_0x3695('0x60')][_0x3695('0xf9')]=function(_0xc6fcfe,_0xd00c2,_0x15b654,_0x457f01,_0x106f3d){var _0xd8e854=this;return new BPromise(function(_0x2cdbac,_0x59160d){if(_[_0x3695('0x6a')](_0xd00c2)||_[_0x3695('0x6a')](_0xd00c2['Contact'])||_['isNil'](_0xd00c2[_0x3695('0xfa')][_0x3695('0xfb')])||_[_0x3695('0x6a')](_0xd00c2['VoiceQueueId'])){_0x59160d(ut[_0x3695('0x49')](_0x3695('0xfc'),_0x457f01,_0x106f3d));return;}var _0x4ece50=uuid['v4']();var _0x4fd970=_0xd8e854[_0x3695('0x10')][_0xd00c2[_0x3695('0x6c')][_0x3695('0x27')]];var _0x4c3b9d=_0x15b654?_0xd8e854[_0x3695('0x13')][_0x15b654]['id']:undefined;_0xd8e854['actions'][_0x4ece50]=new Action(_0xd00c2,_0x4fd970,_0x4ece50,_0x15b654,_0x4c3b9d);var _0x3ff010=_0xd8e854[_0x3695('0x12')][_0x4ece50];_0x3ff010['unlockAgent']=_0x457f01;_0x3ff010[_0x3695('0xa5')]=_0x106f3d;_0x3ff010[_0x3695('0xfd')]=_0x15b654;if(_[_0x3695('0xfe')](_0xc6fcfe)){_0xd8e854[_0x3695('0xff')](_0x3ff010,_0x4fd970,_0xd00c2,_0x15b654)['then'](function(_0x52c2ad){logger['info']('[Preview][execCall][success]',_0x3695('0x100')+_0x3ff010[_0x3695('0x6e')]+_0x3695('0x101')+_0x3ff010['idContact'],JSON['stringify'](_0x52c2ad));ami[_0x3695('0x24')](_0x3695('0x102'),ut[_0x3695('0x9c')](_0x3ff010,'called',_0xd8e854[_0x3695('0x10')][_0x3ff010[_0x3695('0x6e')]]));_0x2cdbac(ut[_0x3695('0x49')](_0x3695('0x103')));})[_0x3695('0x8f')](function(_0x4c2121){ut['logger']('[Preview][execCall][failure]',_0x4c2121);_0x59160d(ut[_0x3695('0x49')](_0x3695('0x104'),_0x457f01,_0x106f3d));});}else{_0x4fd970[_0x3695('0x105')]+=0x1;ut[_0x3695('0x106')](_0x3ff010);rpcDb[_0x3695('0x107')](_0x3ff010,'[Blacklist][error]');delete _0xd8e854[_0x3695('0x12')][_0x4ece50];_0x59160d(ut['message'](_0x3695('0x108'),_0x457f01,_0x106f3d));}});};Preview['prototype'][_0x3695('0x93')]=function(_0x767379){return!_[_0x3695('0x6a')](_0x767379)&&!_['isNil'](_0x767379['name'])&&!_['isNil'](_0x767379[_0x3695('0x109')])&&_0x767379[_0x3695('0x109')]&&!_[_0x3695('0x6a')](this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379[_0x3695('0x27')])])&&!_[_0x3695('0x6a')](this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379[_0x3695('0x27')])][_0x3695('0x10b')])&&(this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379[_0x3695('0x27')])]['status']===_0x3695('0x10c')||this[_0x3695('0x11')][util[_0x3695('0x56')](_0x3695('0x10a'),_0x767379['name'])][_0x3695('0x10b')]===_0x3695('0x10d'));};Preview[_0x3695('0x60')]['run']=function(_0x19cdbb,_0x2d2afc){var _0x17c090=this;return new BPromise(function(_0x56dd41,_0x52768a){_0x17c090[_0x3695('0x10e')](_0x19cdbb,_0x2d2afc)['then'](function(_0x598f40){_0x56dd41(_[_0x3695('0x71')](_0x598f40,[_0x3695('0x49')]));})['catch'](function(_0x1b47e6){if(_0x1b47e6[_0x3695('0x10f')]){rpcDb['unlockContact'](_0x19cdbb);}if(_0x1b47e6[_0x3695('0x109')]){rpcDb[_0x3695('0x110')](_0x19cdbb);}_0x52768a(_[_0x3695('0x71')](_0x1b47e6,[_0x3695('0x49')]));});});};Preview[_0x3695('0x60')][_0x3695('0x10e')]=function(_0x9c6ba5,_0x2481c9){var _0x399bfd=this;return new BPromise(function(_0x18cd28,_0xd7d33a){var _0xd79f74,_0x170f71;rpcDb[_0x3695('0x111')](_0x9c6ba5)['then'](function(_0x2b675c){if(!_['isNil'](_0x2b675c[0x0])){_0x170f71=_0x2b675c[0x0][_0x3695('0x112')]?![]:!![];_0xd79f74=_0x2b675c[0x0][_0x3695('0x112')]?!![]:![];_0xd79f74=_0x2481c9?!![]:_0xd79f74;}var _0x4b8ce8=_0x399bfd['validateContact'](_0x2b675c);if(_0x4b8ce8[_0x3695('0x113')]){rpcDb[_0x3695('0x114')](_['pick'](_0x2b675c[0x0],[_0x3695('0x115'),_0x3695('0x116')]))[_0x3695('0x7e')](function(_0x29467a){_0x399bfd[_0x3695('0xf9')](_0x29467a,_0x2b675c[0x0],_0x2481c9,_0x170f71,_0xd79f74)[_0x3695('0x7e')](function(_0x3dd8f0){_0x18cd28(_0x3dd8f0);})[_0x3695('0x8f')](function(_0xe3a87b){_0xd7d33a(_0xe3a87b);});})[_0x3695('0x8f')](function(_0x31e7d3){ut[_0x3695('0x5d')]('[Preview][checkIsBlackList]',_0x31e7d3);_0xd7d33a(ut[_0x3695('0x49')](_0x3695('0x117'),_0x170f71,_0xd79f74));});}else{_0xd7d33a(ut[_0x3695('0x49')](_0x4b8ce8[_0x3695('0x49')],_0x170f71,_0xd79f74));}})[_0x3695('0x8f')](function(_0x1b9285){ut[_0x3695('0x5d')](_0x3695('0x118'),_0x1b9285);_0xd7d33a(ut[_0x3695('0x49')](_0x3695('0x117'),![],!![]));});});};Preview[_0x3695('0x60')][_0x3695('0x119')]=function(_0x1b152f){if(_['isNil'](_0x1b152f)||_[_0x3695('0xfe')](_0x1b152f)||!_['isNil'](_0x1b152f[0x0][_0x3695('0x82')])&&_[_0x3695('0x6a')](_0x1b152f[0x0]['Agent']['name'])){ut[_0x3695('0x5d')](_0x3695('0x11a'),_0x1b152f);return{'isValid':![],'message':_0x3695('0x11b')};}var _0x323ba3=this[_0x3695('0x10')][_0x1b152f[0x0][_0x3695('0x6c')][_0x3695('0x27')]];_0x323ba3['message']='ACTIVE';if(_[_0x3695('0x6a')](_0x323ba3)){ut[_0x3695('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x323ba3);return{'isValid':![],'message':_0x3695('0x11c')};}if(!this[_0x3695('0x93')](_0x323ba3[_0x3695('0x50')])){ut[_0x3695('0x5d')](_0x3695('0x11d'),'campaign\x20Name:\x20'+_0x323ba3[_0x3695('0x27')]+_0x3695('0x11e'));if(!this[_0x3695('0x93')](_0x323ba3[_0x3695('0x11f')])){ut[_0x3695('0x5d')](_0x3695('0x11d'),_0x323ba3[_0x3695('0x27')]+_0x3695('0x120'));return{'isValid':![],'message':_0x3695('0x121')};}}if(!ut[_0x3695('0x92')](_0x323ba3[_0x3695('0x31')])){ut[_0x3695('0x5d')](_0x3695('0x122'),_0x323ba3[_0x3695('0x27')]+_0x3695('0x123'));return{'isValid':![],'message':_0x3695('0x124')+_0x323ba3['name']+_0x3695('0x123')};}return{'isValid':!![],'message':_0x3695('0x125')};};Preview[_0x3695('0x60')][_0x3695('0xff')]=function(_0x39129b,_0x3f388e,_0x562bad,_0x1a6289){var _0x2e2499=this;return new BPromise(function(_0x2fd576,_0x504811){var _0x5809ef=_0x39129b[_0x3695('0xac')];var _0x5c598d=_0x2e2499[_0x3695('0x93')](_0x3f388e[_0x3695('0x50')])?util['format'](_0x3695('0x126'),_0x3f388e['Trunk'][_0x3695('0x27')],_['isNil'](_0x3f388e[_0x3695('0x35')])?'':_0x3f388e[_0x3695('0x35')][_0x3695('0x127')]()||'',_0x3f388e[_0x3695('0x128')]>0x0?_0x562bad[_0x3695('0xfa')][_0x3695('0xfb')][_0x3695('0x129')](_0x3f388e[_0x3695('0x128')]):_0x562bad['Contact'][_0x3695('0xfb')]):util[_0x3695('0x56')](_0x3695('0x126'),_['isNil'](_0x3f388e[_0x3695('0x11f')])?_0x3f388e['Trunk'][_0x3695('0x27')]:_0x3f388e[_0x3695('0x11f')]['name'],_[_0x3695('0x6a')](_0x3f388e[_0x3695('0x35')])?'':_0x3f388e[_0x3695('0x35')][_0x3695('0x127')]()||'',_0x3f388e[_0x3695('0x128')]>0x0?_0x562bad['Contact']['phone'][_0x3695('0x129')](_0x3f388e[_0x3695('0x128')]):_0x562bad[_0x3695('0xfa')][_0x3695('0xfb')]);var _0x30e9dc=_0x2e2499[_0x3695('0x93')](_0x3f388e['Trunk'])?ut[_0x3695('0x12a')](_0x3f388e[_0x3695('0x50')][_0x3695('0x12b')],_0x3f388e['dialOriginateCallerIdName'],_0x3f388e['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x3f388e[_0x3695('0x33')],_0x3f388e[_0x3695('0x12c')]):_0x3f388e['dialOriginateCallerIdNumber']):ut[_0x3695('0x12a')](_[_0x3695('0x6a')](_0x3f388e[_0x3695('0x11f')])?_0x3f388e[_0x3695('0x50')][_0x3695('0x12b')]:_0x3f388e[_0x3695('0x11f')][_0x3695('0x12b')],_0x3f388e['dialOriginateCallerIdName'],_0x3f388e[_0x3695('0x12c')]>0x0?ut[_0x3695('0x12d')](_0x3f388e[_0x3695('0x33')],_0x3f388e['dialRandomLastDigitCallerIdNumber']):_0x3f388e[_0x3695('0x33')]);if(_0x30e9dc){_0x39129b['originatecalleridname']=ut[_0x3695('0x12e')](_0x30e9dc);_0x39129b[_0x3695('0x12f')]=ut[_0x3695('0x130')](_0x30e9dc);}var _0x21d299=ut[_0x3695('0x131')](_0x3f388e,_0x562bad,_0x5c598d,_0x30e9dc,_0x5809ef,_0x39129b);_[_0x3695('0x132')](_0x39129b,ut[_0x3695('0x133')](_0x21d299));_0x39129b[_0x3695('0x86')]=moment()[_0x3695('0x56')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x3695('0x73')](ut[_0x3695('0x134')](_0x39129b,_0x3f388e,_0x21d299,_0x39129b['activeContact'],_0x1a6289))[_0x3695('0x7e')](function(_0x1f8421){_0x3f388e[_0x3695('0x5a')]+=0x1;logger[_0x3695('0x54')]('[originated][increment]',_0x5809ef,'\x20Queue',_0x3f388e['name'],_0x3695('0x6d'),_0x3f388e[_0x3695('0x5a')]);_0x2fd576(_0x1f8421);})['catch'](function(_0x5d0359){ut['logAgent'](_0x39129b,0xe,_0x3695('0x135'));rpcDb['createAgentHistory'](_0x39129b,_0x3695('0x136'));_0x504811(_0x5d0359);});});};Preview[_0x3695('0x60')][_0x3695('0x137')]=function(_0x331e5c){if(this[_0x3695('0x12')][_0x331e5c[_0x3695('0xa6')]]){this['actions'][_0x331e5c[_0x3695('0xa6')]][_0x3695('0x138')]=_0x331e5c[_0x3695('0x138')];}};Preview['prototype']['syncOriginateResponse']=function(_0x34c94f){var _0xcf5bad=this;var _0x1ee6f4=this[_0x3695('0x12')][_0x34c94f['actionid']];if(_0x1ee6f4){if(_0x1ee6f4['lookAgent']&&this[_0x3695('0x13')][_0x1ee6f4['lookAgent']]){ut[_0x3695('0x139')](_0x1ee6f4,this[_0x3695('0x13')][_0x1ee6f4[_0x3695('0xfd')]][_0x3695('0x27')],this[_0x3695('0x13')][_0x1ee6f4[_0x3695('0xfd')]]['id']);}var _0x2a5557=_['clone'](_0x1ee6f4);_0x2a5557[_0x3695('0xa9')]=moment()[_0x3695('0x56')](_0x3695('0xa8'));var _0x3c5f9e=_0xcf5bad['campaignsPreview'][_0x1ee6f4[_0x3695('0x6e')]];if(ut[_0x3695('0x13a')](_0x34c94f['response'])){if(_0x1ee6f4[_0x3695('0xcc')]){rpcDb[_0x3695('0x13b')](_0x1ee6f4['idContact']);}if(_0x1ee6f4[_0x3695('0xa5')]){rpcDb[_0x3695('0x110')](_0x1ee6f4[_0x3695('0x13c')]);}ami[_0x3695('0x24')](_0x3695('0x13d'),ut[_0x3695('0x9c')](_0x1ee6f4,'rejected',this[_0x3695('0x10')][_0x1ee6f4[_0x3695('0x6e')]]));this[_0x3695('0x13e')](_0x2a5557,_0x3c5f9e,_0x34c94f);}else{_0x1ee6f4['starttime']=moment()['format'](_0x3695('0xa8'));ut['logAgent'](_0x2a5557,0x4,_0x3695('0xb6'));rpcDb[_0x3695('0xf2')](_0x2a5557,_0x3695('0x13f'));}}};Preview['prototype'][_0x3695('0x19')]=function(_0x5dd597){var _0x799c35=this;var _0x9dbefe=this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]];var _0x29aa4c;if(_0x9dbefe){_0x29aa4c=this[_0x3695('0x10')][_0x9dbefe[_0x3695('0x6e')]];logger[_0x3695('0x54')]('[syncHangup][talking]',_0x5dd597[_0x3695('0xa6')],_0x3695('0xed'),_0x29aa4c[_0x3695('0x27')],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);}if(this['actions'][_0x5dd597[_0x3695('0xa6')]]&&_0x5dd597[_0x3695('0xa6')]!==_0x5dd597[_0x3695('0xac')]){if(_0x5dd597[_0x3695('0x140')]==='16'&&this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){this['callProgressDetectingCustomer'](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')]);}else if(this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){logger[_0x3695('0x54')](_0x3695('0x141'),_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')],_0x3695('0xed'),_0x29aa4c['name'],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);this[_0x3695('0x96')](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597['cause']);}}else if(_0x9dbefe&&_['isNil'](_0x9dbefe['statedesc'])&&_0x29aa4c[_0x3695('0x142')]&&_0x5dd597['linkedid']===_0x5dd597[_0x3695('0xac')]&&_[_0x3695('0x6a')](_0x5dd597[_0x3695('0xef')])&&_0x5dd597[_0x3695('0x140')]==='16'&&_0x5dd597['channelstate']==='6'&&_[_0x3695('0xee')](_0x9dbefe['transfer'])){if(_0x9dbefe[_0x3695('0xcc')]){rpcDb[_0x3695('0x13b')](_0x9dbefe[_0x3695('0x13c')]);}if(_0x9dbefe['activeContact']){rpcDb[_0x3695('0x110')](_0x9dbefe['idContact']);}_0x5dd597[_0x3695('0xef')]='22';this[_0x3695('0x13e')](_0x9dbefe,_0x29aa4c,_0x5dd597);}else if(_0x9dbefe&&_0x9dbefe[_0x3695('0x143')]){if(_0x5dd597[_0x3695('0x140')]==='16'&&this[_0x3695('0x12')][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){logger[_0x3695('0x54')](_0x3695('0x144'),_0x5dd597['linkedid'],_0x5dd597[_0x3695('0x140')],'\x20Queue',_0x29aa4c[_0x3695('0x27')],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);this[_0x3695('0x96')](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')]);}else if(this['actions'][_0x5dd597[_0x3695('0xa6')]][_0x3695('0x70')]){logger['info'](_0x3695('0x141'),_0x5dd597[_0x3695('0xa6')],_0x5dd597['cause'],'\x20Queue',_0x29aa4c['name'],_0x3695('0x6f'),_0x29aa4c[_0x3695('0x5b')]);this[_0x3695('0x96')](_0x5dd597,_0x5dd597[_0x3695('0xa6')],_0x5dd597[_0x3695('0x140')]);}}};Preview['prototype'][_0x3695('0x1d')]=function(_0x3d29fd){if(this[_0x3695('0x12')][_0x3d29fd[_0x3695('0x145')]]&&_0x3d29fd[_0x3695('0x145')]!==_0x3d29fd[_0x3695('0x146')]){this[_0x3695('0x96')](_0x3d29fd,_0x3d29fd[_0x3695('0x145')],_0x3d29fd['dialstatus']);}};Preview['prototype'][_0x3695('0x1b')]=function(_0x5a59e5){if(this[_0x3695('0x12')][_0x5a59e5[_0x3695('0xa6')]]&&_0x5a59e5[_0x3695('0xa6')]!==_0x5a59e5[_0x3695('0xac')]&&!this[_0x3695('0x12')][_0x5a59e5[_0x3695('0xa6')]][_0x3695('0x70')]){if(_0x5a59e5[_0x3695('0x140')]==='1'){this[_0x3695('0x96')](_0x5a59e5,_0x5a59e5['linkedid'],_0x5a59e5[_0x3695('0x140')]);}}};Preview[_0x3695('0x60')][_0x3695('0x147')]=function(_0x1f914e,_0x1164b7,_0x25c5ef){if(this[_0x3695('0x12')][_0x1f914e]){if(_[_0x3695('0x6a')](this[_0x3695('0x12')][_0x1f914e][_0x3695('0x148')])){this[_0x3695('0x12')][_0x1f914e]['variables']={};}this[_0x3695('0x12')][_0x1f914e][_0x3695('0x148')][_0x1164b7]=_0x25c5ef;}};Preview[_0x3695('0x60')]['syncVarSet']=function(_0x550fae){try{if(!_[_0x3695('0x6a')](_0x550fae)){if(ut['filterKey'](_['keys'](_0x550fae[_0x3695('0x149')])[0x0])){this[_0x3695('0x147')](_0x550fae['uniqueid'],_[_0x3695('0x14a')](_0x550fae[_0x3695('0x149')])[0x0],_0x550fae[_0x3695('0x14b')]);}}}catch(_0x53121c){logger[_0x3695('0x14c')](_0x3695('0x14d'),util[_0x3695('0x14e')](_0x53121c,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x3695('0x21')]=function(_0x1fa0c4){if(_0x1fa0c4){if(this[_0x3695('0x12')][_0x1fa0c4['transfertargetlinkedid']]){this['actions'][_0x1fa0c4['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x3695('0x60')][_0x3695('0x22')]=function(_0x13839b){if(_0x13839b){if(this[_0x3695('0x12')][_0x13839b[_0x3695('0x14f')]]){this[_0x3695('0x12')][_0x13839b[_0x3695('0x14f')]][_0x3695('0x143')]=!![];}}};module[_0x3695('0x150')]=Preview; \ No newline at end of file +var _0x2356=['exports','lodash','bluebird','md5','ioredis','preview','../ami','./rpcDb','./action','redis','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','agents','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangBusyFactor','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','clearZombieChannels','dialActive','setMessage','clearZombieChannel','sequence','isNil','actions','info','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','catch','message','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[action]','size','recallMe','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','complete','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','\x20IdHopper:\x20','idContact','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','Contact','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','unlockContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid'];(function(_0x43be25,_0x3ad30d){var _0x5ee2cc=function(_0x2f8f18){while(--_0x2f8f18){_0x43be25['push'](_0x43be25['shift']());}};_0x5ee2cc(++_0x3ad30d);}(_0x2356,0x14f));var _0x6235=function(_0x35cda2,_0x30d416){_0x35cda2=_0x35cda2-0x0;var _0x12030c=_0x2356[_0x35cda2];return _0x12030c;};'use strict';var util=require('util');var _=require(_0x6235('0x0'));var BPromise=require(_0x6235('0x1'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x6235('0x2'));var Redis=require(_0x6235('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x6235('0x4'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x6235('0x5'));var rpcDb=require(_0x6235('0x6'));var Action=require(_0x6235('0x7'));var ut=require('./util/util');config['redis']=_['defaults'](config[_0x6235('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6235('0x9'))(new Redis(config[_0x6235('0x8')]));var Sequence=function(){};Sequence[_0x6235('0xa')][_0x6235('0xb')]=function(_0x5de19a){this[_0x6235('0xc')]=this[_0x6235('0xc')]?this[_0x6235('0xc')][_0x6235('0xd')](_0x5de19a):_0x5de19a();};function Preview(_0x14342d){this['sequence']=new Sequence();this[_0x6235('0xe')]=_0x14342d[_0x6235('0xf')];this[_0x6235('0x10')]=_0x14342d[_0x6235('0x10')];this['actions']={};this[_0x6235('0x11')]=_0x14342d[_0x6235('0x11')];this['clockClearZombieChannels']=0x0;ami['on'](_0x6235('0x12'),this['syncOriginateResponse'][_0x6235('0x13')](this));ami['on'](_0x6235('0x14'),this['syncHangup'][_0x6235('0x13')](this));ami['on'](_0x6235('0x15'),this[_0x6235('0x16')][_0x6235('0x13')](this));ami['on']('dialend',this[_0x6235('0x17')][_0x6235('0x13')](this));ami['on'](_0x6235('0x18'),this[_0x6235('0x19')][_0x6235('0x13')](this));ami['on'](_0x6235('0x1a'),this[_0x6235('0x1b')][_0x6235('0x13')](this));ami['on'](_0x6235('0x1c'),this[_0x6235('0x1d')]['bind'](this));ami['on'](_0x6235('0x1e'),this[_0x6235('0x1f')]['bind'](this));this['loopCampaigns'](this[_0x6235('0xe')]);}function emit(_0x4f0aa2,_0x5d3872,_0x4eead1){io['to'](_0x4f0aa2)[_0x6235('0x20')](_0x5d3872,_0x4eead1);}function emitCampaignPreview(_0x3e2e24){if(_0x3e2e24[_0x6235('0x21')]===_0x6235('0x22')){var _0x24c057={'id':_0x3e2e24['id'],'name':_0x3e2e24[_0x6235('0x23')],'strategy':_0x3e2e24['strategy'],'answered':_0x3e2e24['answered'],'available':_0x3e2e24[_0x6235('0x24')],'loggedIn':_0x3e2e24['loggedIn'],'pTalking':_0x3e2e24[_0x6235('0x25')],'sumBillable':_0x3e2e24[_0x6235('0x26')],'sumDuration':_0x3e2e24[_0x6235('0x27')],'sumHoldTime':_0x3e2e24[_0x6235('0x28')]||0x0,'talking':_0x3e2e24[_0x6235('0x29')],'total':_0x3e2e24['total'],'type':_0x3e2e24[_0x6235('0x21')],'unmanaged':_0x3e2e24[_0x6235('0x2a')],'abandoned':_0x3e2e24[_0x6235('0x2b')],'waiting':_0x3e2e24[_0x6235('0x2c')],'loggedInDb':_0x3e2e24[_0x6235('0x2d')],'dialActive':_0x3e2e24['dialActive'],'dialMethod':_0x3e2e24['dialMethod'],'dialOriginateCallerIdName':_0x3e2e24['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3e2e24['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3e2e24[_0x6235('0x2e')],'dialPrefix':_0x3e2e24[_0x6235('0x2f')],'outboundAnswerAgiCallsDay':_0x3e2e24[_0x6235('0x30')],'outboundAnswerCallsDay':_0x3e2e24[_0x6235('0x31')],'outboundBlacklistCallsDay':_0x3e2e24[_0x6235('0x32')],'outboundBusyCallsDay':_0x3e2e24[_0x6235('0x33')],'outboundCongestionCallsDay':_0x3e2e24['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3e2e24['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3e2e24['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3e2e24[_0x6235('0x34')],'outboundNoAnswerCallsDay':_0x3e2e24['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3e2e24[_0x6235('0x35')],'outboundOriginateFailureCallsDay':_0x3e2e24[_0x6235('0x36')],'outboundReCallsDay':_0x3e2e24['outboundReCallsDay'],'outboundRejectCallsDay':_0x3e2e24[_0x6235('0x37')],'outboundUnknownCallsDay':_0x3e2e24[_0x6235('0x38')],'outboundAbandonedCallsDay':_0x3e2e24['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3e2e24[_0x6235('0x39')],'predictiveIntervalAvgHoldtime':_0x3e2e24[_0x6235('0x3a')],'predictiveIntervalAvgTalktime':_0x3e2e24[_0x6235('0x3b')],'predictiveIntervalDroppedCallsCallersExit':_0x3e2e24[_0x6235('0x3c')],'predictiveIntervalDroppedCallsTimeout':_0x3e2e24[_0x6235('0x3d')],'predictiveIntervalErlangCalls':_0x3e2e24[_0x6235('0x3e')],'predictiveIntervalErlangCallsDroppedCalls':_0x3e2e24[_0x6235('0x3f')],'predictiveIntervalHitRate':_0x3e2e24[_0x6235('0x40')],'predictiveIntervalMultiplicativeFactor':_0x3e2e24[_0x6235('0x41')],'predictiveIntervalPauses':_0x3e2e24[_0x6235('0x42')],'predictiveIntervalAvailable':_0x3e2e24['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3e2e24[_0x6235('0x43')],'message':_0x3e2e24['message'],'originated':_0x3e2e24['originated'],'erlangCalls':_0x3e2e24[_0x6235('0x44')],'erlangCallToSecond':_0x3e2e24['erlangCallToSecond'],'erlangAbandonmentRate':_0x3e2e24['erlangAbandonmentRate'],'erlangBusyFactor':_0x3e2e24[_0x6235('0x45')],'startPredictive':_0x3e2e24['startPredictive'],'startProgressive':_0x3e2e24['startProgressive']};if(_0x3e2e24[_0x6235('0x46')]){_0x24c057[_0x6235('0x46')]={'id':_0x3e2e24[_0x6235('0x46')]['id'],'name':_0x3e2e24['Trunk'][_0x6235('0x23')],'active':_0x3e2e24[_0x6235('0x46')][_0x6235('0x47')],'callerid':_0x3e2e24['Trunk'][_0x6235('0x48')]};}if(_0x3e2e24['Interval']){_0x24c057[_0x6235('0x49')]={'id':_0x3e2e24[_0x6235('0x49')]['id'],'name':_0x3e2e24[_0x6235('0x49')][_0x6235('0x23')]};}var _0x2820b1=md5(JSON['stringify'](_0x24c057));if(_0x3e2e24[_0x6235('0x2')]!==_0x2820b1){_0x3e2e24['md5']=_0x2820b1;emit(util[_0x6235('0x4a')](_0x6235('0x4b'),_0x24c057[_0x6235('0x23')]),_0x6235('0x4c'),_0x24c057);}}}function emitVoiceQueueChannelRemove(_0x3cc997){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x6235('0x4d')](_0x3cc997));emit(util[_0x6235('0x4a')](_0x6235('0x4b'),_0x3cc997[_0x6235('0x23')]),_0x6235('0x4e'),_0x3cc997);io[_0x6235('0x20')](_0x6235('0x4f'),_0x3cc997);}function notSendMessagesQueue(_0xc3969){if(_0xc3969[_0x6235('0x50')]){if(_0xc3969[_0x6235('0x51')]===0x0&&_0xc3969['pTalking']===0x0){_0xc3969['sendMessageOneNotActive']=![];_0xc3969[_0x6235('0x24')]=0x0;_0xc3969['paused']=0x0;_0xc3969['message']=_0x6235('0x52');ut[_0x6235('0x53')](_0x6235('0x54'),_0xc3969['name']+_0x6235('0x55'));}else{_0xc3969['message']=_0x6235('0x56');ut[_0x6235('0x53')](_0x6235('0x54'),_0xc3969[_0x6235('0x23')]+_0x6235('0x57'));}emitCampaignPreview(_0xc3969);}}Preview[_0x6235('0xa')][_0x6235('0x58')]=function(){var _0x13f974=this;setInterval(function(){_0x13f974['syncCampaigns']();},0x7cf);};Preview['prototype'][_0x6235('0x59')]=function(){var _0x54cbb1=this[_0x6235('0xe')];this[_0x6235('0x5a')]+=0x1;for(var _0x23b28e in _0x54cbb1){if(_0x54cbb1[_0x6235('0x5b')](_0x23b28e)&&(_0x54cbb1[_0x23b28e][_0x6235('0x5c')]===_0x6235('0x4')||_0x54cbb1[_0x23b28e][_0x6235('0x5c')]==='booked')&&_0x54cbb1[_0x23b28e][_0x6235('0x21')]===_0x6235('0x22')){if(this[_0x6235('0x5a')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6235('0x5d')]();}}if(_0x54cbb1[_0x6235('0x5b')](_0x23b28e)&&_0x54cbb1[_0x23b28e][_0x6235('0x5c')]===_0x6235('0x4')&&_0x54cbb1[_0x23b28e][_0x6235('0x21')]===_0x6235('0x22')){if(_0x54cbb1[_0x23b28e][_0x6235('0x5e')]){this[_0x6235('0x5f')](_0x54cbb1[_0x23b28e]);this['recallMe'](_0x54cbb1[_0x23b28e]);}else{notSendMessagesQueue(_0x54cbb1[_0x23b28e]);}}}};Preview[_0x6235('0xa')][_0x6235('0x60')]=function(_0x14f71b){var _0x47e360=this;this[_0x6235('0x61')][_0x6235('0xb')](function(){if(!_[_0x6235('0x62')](_0x47e360[_0x6235('0x63')][_0x14f71b])){loggerAction[_0x6235('0x64')](_0x6235('0x65'),_0x14f71b,_0x6235('0x66'),_0x47e360[_0x6235('0x63')][_0x14f71b][_0x6235('0x67')],'originated:\x20',JSON[_0x6235('0x4d')](_0x47e360['campaignsPreview'][_0x47e360[_0x6235('0x63')][_0x14f71b][_0x6235('0x67')]][_0x6235('0x51')]),'pTalking:\x20',JSON['stringify'](_0x47e360[_0x6235('0xe')][_0x47e360[_0x6235('0x63')][_0x14f71b][_0x6235('0x67')]][_0x6235('0x25')]),JSON['stringify'](_0x47e360[_0x6235('0x63')][_0x14f71b][_0x6235('0x68')]),JSON['stringify'](_[_0x6235('0x69')](_0x47e360['actions'][_0x14f71b],[_0x6235('0x6a'),_0x6235('0x6b'),_0x6235('0x6c'),'ListId'])));return ami[_0x6235('0x6d')]({'action':'status','channel':_0x47e360['actions'][_0x14f71b]['channel']})[_0x6235('0x6e')](function(_0x1d4555){if(_0x1d4555[_0x6235('0x6f')]===_0x6235('0x70')){setTimeout(function(){if(_0x47e360[_0x6235('0x63')][_0x14f71b]){ut[_0x6235('0x71')](_0x47e360[_0x6235('0xe')][_0x47e360['actions'][_0x14f71b][_0x6235('0x67')]],_0x6235('0x72'));if(_0x47e360[_0x6235('0x63')][_0x14f71b][_0x6235('0x68')]===!![]){ut['decrementTalkink'](_0x47e360[_0x6235('0xe')][_0x47e360[_0x6235('0x63')][_0x14f71b][_0x6235('0x67')]],'[clearZombieChannel]');ut[_0x6235('0x73')]('[Dialer][checkChannel][pTalking][Preview]'+_0x14f71b,_0x47e360['actions'][_0x14f71b]['queue']);}ut[_0x6235('0x73')]('[Dialer][checkChannel][Preview]'+_0x14f71b,_0x47e360[_0x6235('0x63')][_0x14f71b][_0x6235('0x67')]);delete _0x47e360[_0x6235('0x63')][_0x14f71b];}},0x2328);}});}});};Preview['prototype'][_0x6235('0x5d')]=function(){var _0x5257cf=this;loggerAction[_0x6235('0x64')](_0x6235('0x74'),_[_0x6235('0x75')](this[_0x6235('0x63')]));for(var _0x76bd9e in this[_0x6235('0x63')]){if(_0x5257cf[_0x6235('0x63')][_0x6235('0x5b')](_0x76bd9e)){_0x5257cf['clearZombieChannel'](_0x76bd9e);}}};Preview[_0x6235('0xa')][_0x6235('0x76')]=function(_0x4cf789){var _0x471e6e=this;rpcDb['getContactRecallMe'](_0x4cf789['id'],ut['agentReadyId'](this[_0x6235('0x11')]))['then'](function(_0x40fe25){if(!_[_0x6235('0x62')](_0x40fe25)){for(var _0x6f743b=0x0;_0x6f743b<_0x40fe25[_0x6235('0x77')];_0x6f743b+=0x1){if(ut[_0x6235('0x78')](_0x40fe25[_0x6f743b][_0x6235('0x79')])<_0x4cf789[_0x6235('0x7a')]*0x3c){if(_0x40fe25[_0x6f743b][_0x6235('0x7b')]&&!_0x40fe25[_0x6f743b][_0x6235('0x7b')][_0x6235('0x7c')]){_0x471e6e[_0x6235('0x7d')](_0x40fe25[_0x6f743b]['id'])[_0x6235('0x7e')](ut[_0x6235('0x7f')](_0x6235('0x80')))[_0x6235('0x6e')](ut[_0x6235('0x7f')]('[RecallMe]'));}else{rpcDb[_0x6235('0x81')](_0x40fe25[_0x6f743b]['id']);}}else{var _0x35ce3f=new Action(_0x40fe25[_0x6f743b],_0x4cf789);_0x35ce3f['starttime']=moment()[_0x6235('0x4a')](_0x6235('0x82'));_0x4cf789['outboundReCallsDay']+=0x1;ut[_0x6235('0x83')](_0x35ce3f,0x17,_0x6235('0x84'));if(_0x4cf789['dialRecallInQueue']){rpcDb[_0x6235('0x85')](ut[_0x6235('0x86')](_0x40fe25[_0x6f743b]));rpcDb[_0x6235('0x87')](_0x35ce3f,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6235('0x83')](_0x35ce3f,0x16,_0x6235('0x88'));rpcDb['createCustomerHistory'](_0x35ce3f,'[HistoryRecallClose]');rpcDb[_0x6235('0x89')](_0x35ce3f,_0x6235('0x8a'));}}}}})[_0x6235('0x6e')](ut[_0x6235('0x7f')](_0x6235('0x8b')));};Preview[_0x6235('0xa')][_0x6235('0x5f')]=function(_0x20dbef){_0x20dbef[_0x6235('0x50')]=!![];if(ut[_0x6235('0x8c')](_0x20dbef[_0x6235('0x8d')])){_0x20dbef[_0x6235('0x6f')]=_0x6235('0x8e');}else if(!ut[_0x6235('0x8f')](_0x20dbef[_0x6235('0x5e')])){_0x20dbef[_0x6235('0x6f')]=_0x6235('0x52');}else if(!this[_0x6235('0x90')](_0x20dbef[_0x6235('0x46')])){if(!this[_0x6235('0x90')](_0x20dbef['TrunkBackup'])){_0x20dbef[_0x6235('0x6f')]=_0x6235('0x91');}else{_0x20dbef[_0x6235('0x6f')]=_0x6235('0x92');}}else{_0x20dbef[_0x6235('0x6f')]=_0x6235('0x92');}emitCampaignPreview(_0x20dbef);};Preview['prototype'][_0x6235('0x93')]=function(_0x522b02,_0x1d7f91,_0x4a9f18){var _0x52529f=this;var _0xfa1b96=this[_0x6235('0x63')][_0x1d7f91];var _0x15f82f=this[_0x6235('0xe')][_0xfa1b96[_0x6235('0x67')]];var _0xd84947;if(_0x15f82f){switch(_0x4a9f18){case'1':_0x15f82f[_0x6235('0x35')]+=0x1;_0xfa1b96['countnosuchnumberretry']+=0x1;_0xfa1b96[_0x6235('0x94')]=ut[_0x6235('0x95')](_0xfa1b96);ut['logCustomer'](_0xfa1b96,0x0,_0x6235('0x96'));ami[_0x6235('0x20')]('custom:agentnosuchnumber',ut[_0x6235('0x97')](_0xfa1b96,_0x6235('0x98')));rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0x99'));if(ut[_0x6235('0x95')](_0xfa1b96)>=_0x15f82f['dialGlobalMaxRetry']){_0xd84947=ut[_0x6235('0x9a')](_0xfa1b96,0xf,_0x6235('0x9b'));rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0x9c'));}else{if(_0xfa1b96[_0x6235('0x9d')]>=_0x15f82f[_0x6235('0x9e')]){rpcDb['createCustomerFinal'](_0xfa1b96,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x6235('0x9f')](ut[_0x6235('0xa0')](_0xfa1b96,_0x6235('0x9d'),_0x15f82f['dialNoSuchNumberRetryFrequency']),_0xfa1b96[_0x6235('0xa1')],_0xfa1b96[_0x6235('0xa2')]);}}delete this['actions'][_0x522b02[_0x6235('0xa3')]];break;case _0x6235('0xa4'):var _0x563d20=moment()[_0x6235('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0xfa1b96[_0x6235('0xa5')]=_0x563d20;_0xfa1b96['answertime']=_0x563d20;_0xfa1b96[_0x6235('0x68')]=!![];_0x15f82f[_0x6235('0x25')]+=0x1;logger['info'](_0x6235('0xa6'),_0xfa1b96[_0x6235('0xa7')],_0x6235('0xa8'),_0x15f82f[_0x6235('0x23')],_0x6235('0xa9'),_0x15f82f[_0x6235('0x25')]);ami[_0x6235('0x20')](_0x6235('0xaa'),ut[_0x6235('0x97')](_0xfa1b96,_0x6235('0xab'),this[_0x6235('0xe')][_0xfa1b96[_0x6235('0x67')]]));if(_0x15f82f[_0x6235('0xac')]){ami[_0x6235('0x20')](_0x6235('0xad'),ut['buildAcw'](_0xfa1b96));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x6235('0x97')](_0xfa1b96,'complete',this[_0x6235('0xe')][_0xfa1b96[_0x6235('0x67')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0xfa1b96,_0x6235('0xae')));_0x15f82f[_0x6235('0x31')]+=0x1;_0x15f82f[_0x6235('0xaf')]+=0x1;_0x15f82f[_0x6235('0xb0')]+=0x1;ut[_0x6235('0xb1')](_0x15f82f,_0x6235('0xb2'));_0xfa1b96[_0x6235('0x94')]=ut[_0x6235('0x95')](_0xfa1b96);ut['logCustomer'](_0xfa1b96,0x4,_0x6235('0xb3'));rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0xb4'));rpcDb[_0x6235('0x89')](_0xfa1b96,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x6235('0xb5')](_0xfa1b96);_0x15f82f[_0x6235('0x27')]+=_0xfa1b96[_0x6235('0xb6')];_0x15f82f[_0x6235('0x26')]+=_0xfa1b96[_0x6235('0xb6')];logger[_0x6235('0x64')](_0x6235('0xb7'),_0xfa1b96[_0x6235('0xa7')],_0x6235('0xa8'),_0x15f82f[_0x6235('0x23')],_0x6235('0xa9'),_0x15f82f[_0x6235('0x25')]);delete this[_0x6235('0x63')][_0x522b02['linkedid']];break;case _0x6235('0xb8'):_0x15f82f[_0x6235('0x33')]+=0x1;_0xfa1b96[_0x6235('0xb9')]+=0x1;_0xfa1b96[_0x6235('0x94')]=ut[_0x6235('0x95')](_0xfa1b96);ut[_0x6235('0x83')](_0xfa1b96,0x5,_0x6235('0xba'));ami['emit'](_0x6235('0xbb'),ut[_0x6235('0x97')](_0xfa1b96,_0x6235('0xbc')));rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0xbd'));if(ut[_0x6235('0x95')](_0xfa1b96)>=_0x15f82f[_0x6235('0xbe')]){_0xd84947=ut['cloneAction'](_0xfa1b96,0xf,_0x6235('0x9b'));rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0xbf'));}else{if(_0xfa1b96['countbusyretry']>=_0x15f82f['dialBusyMaxRetry']){rpcDb[_0x6235('0x89')](_0xfa1b96,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6235('0x9f')](ut['scheduledAt'](_0xfa1b96,_0x6235('0xb9'),_0x15f82f[_0x6235('0xc0')]),_0xfa1b96[_0x6235('0xa1')],_0xfa1b96[_0x6235('0xa2')]);}}break;case'NOANSWER':_0x15f82f['outboundNoAnswerCallsDay']+=0x1;_0xfa1b96[_0x6235('0xc1')]+=0x1;_0xfa1b96[_0x6235('0x94')]=ut[_0x6235('0x95')](_0xfa1b96);ut[_0x6235('0x83')](_0xfa1b96,0x3,_0x6235('0xc2'));ami['emit'](_0x6235('0xc3'),ut['buildObj'](_0xfa1b96,_0x6235('0xc4')));rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0xc5'));if(ut['totalGlobal'](_0xfa1b96)>=_0x15f82f['dialGlobalMaxRetry']){_0xd84947=ut[_0x6235('0x9a')](_0xfa1b96,0xf,'Global');rpcDb[_0x6235('0x89')](_0xd84947,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xfa1b96[_0x6235('0xc1')]>=_0x15f82f[_0x6235('0xc6')]){rpcDb['createCustomerFinal'](_0xfa1b96,_0x6235('0xc5'));}else{rpcDb[_0x6235('0x9f')](ut[_0x6235('0xa0')](_0xfa1b96,'countnoanswerretry',_0x15f82f[_0x6235('0xc7')]),_0xfa1b96[_0x6235('0xa1')],_0xfa1b96['activeContact']);}}break;case _0x6235('0xc8'):_0x15f82f[_0x6235('0xc9')]+=0x1;_0xfa1b96[_0x6235('0xca')]+=0x1;_0xfa1b96['countglobal']=ut['totalGlobal'](_0xfa1b96);ut['logCustomer'](_0xfa1b96,0x8,_0x6235('0xcb'));ami[_0x6235('0x20')](_0x6235('0xcc'),ut[_0x6235('0x97')](_0xfa1b96,_0x6235('0xcd')));rpcDb[_0x6235('0x87')](_0xfa1b96,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x6235('0x95')](_0xfa1b96)>=_0x15f82f[_0x6235('0xbe')]){_0xd84947=ut[_0x6235('0x9a')](_0xfa1b96,0xf,'Global');rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0xce'));}else{if(_0xfa1b96[_0x6235('0xca')]>=_0x15f82f['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0xfa1b96,_0x6235('0xcf'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xfa1b96,_0x6235('0xca'),_0x15f82f[_0x6235('0xc0')]),_0xfa1b96['unlockAgent'],_0xfa1b96[_0x6235('0xa2')]);}}break;case'CANCEL':_0x15f82f[_0x6235('0x37')]+=0x1;_0xfa1b96['countagentrejectretry']+=0x1;_0xfa1b96[_0x6235('0x94')]=ut['totalGlobal'](_0xfa1b96);ut[_0x6235('0x83')](_0xfa1b96,0x14,_0x6235('0xd0'));ami[_0x6235('0x20')](_0x6235('0xd1'),ut[_0x6235('0x97')](_0xfa1b96,_0x6235('0xd2')));rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0xd3'));if(ut[_0x6235('0x95')](_0xfa1b96)>=_0x15f82f['dialGlobalMaxRetry']){_0xd84947=ut['cloneAction'](_0xfa1b96,0x14,'AgentReject');rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0xd4'));}else{if(_0xfa1b96[_0x6235('0xd5')]>=_0x15f82f[_0x6235('0xd6')]){rpcDb['createCustomerFinal'](_0xfa1b96,_0x6235('0xd4'));}else{rpcDb[_0x6235('0x9f')](ut[_0x6235('0xa0')](_0xfa1b96,_0x6235('0xd5'),_0x15f82f['dialAgentRejectRetryFrequency']),_0xfa1b96[_0x6235('0xa1')],_0xfa1b96[_0x6235('0xa2')]);}}break;case _0x6235('0xd7'):_0x15f82f[_0x6235('0xd8')]+=0x1;_0xfa1b96[_0x6235('0xd9')]+=0x1;_0xfa1b96[_0x6235('0x94')]=ut[_0x6235('0x95')](_0xfa1b96);ut['logCustomer'](_0xfa1b96,0xb,_0x6235('0xda'));rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0xdb'));if(ut['totalGlobal'](_0xfa1b96)>=_0x15f82f[_0x6235('0xbe')]){_0xd84947=ut[_0x6235('0x9a')](_0xfa1b96,0xf,_0x6235('0x9b'));rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0xdb'));}else{if(_0xfa1b96[_0x6235('0xdc')]>=_0x15f82f[_0x6235('0xdd')]){rpcDb[_0x6235('0x89')](_0xfa1b96,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x6235('0x9f')](ut[_0x6235('0xa0')](_0xfa1b96,_0x6235('0xd9'),_0x15f82f[_0x6235('0xde')]),_0xfa1b96[_0x6235('0xa1')],_0xfa1b96[_0x6235('0xa2')]);}}break;case'18':_0x15f82f[_0x6235('0x38')]+=0x1;_0xfa1b96[_0x6235('0xdf')]+=0x1;_0xfa1b96['countglobal']=ut['totalGlobal'](_0xfa1b96);ut[_0x6235('0x83')](_0xfa1b96,0x12,_0x522b02['cause-txt']||_0x522b02[_0x6235('0xe0')]);ami['emit']('custom:amd',ut['buildObj'](_0xfa1b96,_0x6235('0xe1')));rpcDb[_0x6235('0x87')](_0xfa1b96,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x6235('0x95')](_0xfa1b96)>=_0x15f82f[_0x6235('0xbe')]){_0xd84947=ut[_0x6235('0x9a')](_0xfa1b96,0xf,_0x6235('0x9b'));rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0xe2'));}else{rpcDb[_0x6235('0x89')](_0xfa1b96,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x6235('0x63')][_0x522b02[_0x6235('0xa3')]];break;case'19':_0x15f82f[_0x6235('0x38')]+=0x1;_0xfa1b96[_0x6235('0x94')]=ut[_0x6235('0x95')](_0xfa1b96);ut[_0x6235('0x83')](_0xfa1b96,0x13,_0x522b02[_0x6235('0xe3')]||_0x522b02['dialstatus']);ami[_0x6235('0x20')](_0x6235('0xe4'),ut[_0x6235('0x97')](_0xfa1b96,_0x6235('0xe1')));rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0xe5'));if(ut[_0x6235('0x95')](_0xfa1b96)>=_0x15f82f[_0x6235('0xbe')]){_0xd84947=ut['cloneAction'](_0xfa1b96,0xf,_0x6235('0x9b'));rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0xe5'));}else{rpcDb[_0x6235('0x89')](_0xfa1b96,'[callProgressDetectingCustomer][machine]');}delete this[_0x6235('0x63')][_0x522b02[_0x6235('0xa3')]];break;default:if(_0xfa1b96['dialAnswer']){ut['decrementTalkink'](_0x15f82f,_0x6235('0xe6'));ut[_0x6235('0x73')](_0x6235('0xe7')+_0x15f82f[_0x6235('0x23')],_0x522b02);}_0x15f82f[_0x6235('0x38')]+=0x1;_0xfa1b96[_0x6235('0x94')]=ut['totalGlobal'](_0xfa1b96);ut[_0x6235('0x83')](_0xfa1b96,0xc,_0x522b02[_0x6235('0xe3')]||_0x522b02[_0x6235('0xe0')]);rpcDb[_0x6235('0x87')](_0xfa1b96,_0x6235('0xe8'));if(ut[_0x6235('0x95')](_0xfa1b96)>=_0x15f82f[_0x6235('0xbe')]){_0xd84947=ut[_0x6235('0x9a')](_0xfa1b96,0xf,_0x6235('0x9b'));rpcDb[_0x6235('0x89')](_0xd84947,_0x6235('0xe9'));}else{rpcDb[_0x6235('0x89')](_0xfa1b96,_0x6235('0xe9'));}delete this[_0x6235('0x63')][_0x522b02[_0x6235('0xa3')]];}if(!(_0xfa1b96[_0x6235('0x68')]&&_0x4a9f18==='16')){ut[_0x6235('0x71')](_0x15f82f,'[callProgressDetectingCustomer]');logger['info'](_0x6235('0xea'),_0xfa1b96[_0x6235('0xa7')],_0x6235('0xa8'),_0x15f82f[_0x6235('0x23')],_0x6235('0xeb'),_0x15f82f[_0x6235('0x51')]);}if(_0x4a9f18!=='ANSWER'){delete this['actions'][_0x522b02['linkedid']];delete this[_0x6235('0x63')][_0x522b02[_0x6235('0xec')]];}}};Preview[_0x6235('0xa')]['callProgressDetectingAgent']=function(_0x5e9600,_0x574b78,_0x47846f){if(_[_0x6235('0xed')](_0x574b78)&&_0x6235('0xee')!==typeof _0x574b78){return;}if(_[_0x6235('0xed')](_0x47846f)&&_0x6235('0xee')!==typeof _0x47846f){return;}switch(_0x47846f[_0x6235('0xef')]){case'0':ut[_0x6235('0xf0')](_0x5e9600,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x5e9600,_0x6235('0xf1'));break;case'3':ut[_0x6235('0xf0')](_0x5e9600,0x3,'NoAnswer');rpcDb[_0x6235('0xf2')](_0x5e9600,_0x6235('0xf3'));break;case'5':ut['logAgent'](_0x5e9600,0x5,_0x6235('0xba'));rpcDb[_0x6235('0xf2')](_0x5e9600,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x5e9600,0x8,'Congestion');rpcDb['createAgentHistory'](_0x5e9600,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x6235('0xf0')](_0x5e9600,0x16,_0x6235('0xf4'));rpcDb['createAgentHistory'](_0x5e9600,_0x6235('0xf5'));break;default:ut[_0x6235('0xf0')](_0x5e9600,0xc,_0x47846f[_0x6235('0xef')]);rpcDb[_0x6235('0xf2')](_0x5e9600,_0x6235('0xf6'));}ut[_0x6235('0x71')](_0x574b78,_0x6235('0xf7'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x5e9600[_0x6235('0xa7')],_0x6235('0xa8'),_0x574b78[_0x6235('0x23')],_0x6235('0xeb'),_0x574b78['originated']);delete this[_0x6235('0x63')][_0x5e9600[_0x6235('0xa7')]];};Preview[_0x6235('0xa')][_0x6235('0xf8')]=function(_0x21470b,_0xf3bfcc,_0x17b417,_0x26cec,_0x4e9f71){var _0x5eda5b=this;return new BPromise(function(_0x2297f7,_0x245541){if(_['isNil'](_0xf3bfcc)||_[_0x6235('0x62')](_0xf3bfcc['Contact'])||_[_0x6235('0x62')](_0xf3bfcc['Contact'][_0x6235('0xf9')])||_['isNil'](_0xf3bfcc['VoiceQueueId'])){_0x245541(ut[_0x6235('0x6f')](_0x6235('0xfa'),_0x26cec,_0x4e9f71));return;}var _0x25245f=uuid['v4']();var _0x107e3c=_0x5eda5b[_0x6235('0xe')][_0xf3bfcc[_0x6235('0x66')][_0x6235('0x23')]];var _0x57eedd=_0x17b417?_0x5eda5b[_0x6235('0x11')][_0x17b417]['id']:undefined;_0x5eda5b[_0x6235('0x63')][_0x25245f]=new Action(_0xf3bfcc,_0x107e3c,_0x25245f,_0x17b417,_0x57eedd);var _0xa85cdb=_0x5eda5b[_0x6235('0x63')][_0x25245f];_0xa85cdb['unlockAgent']=_0x26cec;_0xa85cdb[_0x6235('0xa2')]=_0x4e9f71;_0xa85cdb[_0x6235('0xfb')]=_0x17b417;if(_[_0x6235('0xfc')](_0x21470b)){_0x5eda5b[_0x6235('0xfd')](_0xa85cdb,_0x107e3c,_0xf3bfcc,_0x17b417)[_0x6235('0x7e')](function(_0x19e4bf){logger[_0x6235('0x64')]('[Preview][execCall][success]','Queue:\x20'+_0xa85cdb[_0x6235('0x67')]+_0x6235('0xfe')+_0xa85cdb[_0x6235('0xff')],JSON[_0x6235('0x4d')](_0x19e4bf));ami[_0x6235('0x20')](_0x6235('0x100'),ut[_0x6235('0x97')](_0xa85cdb,_0x6235('0x101'),_0x5eda5b[_0x6235('0xe')][_0xa85cdb[_0x6235('0x67')]]));_0x2297f7(ut['message']('Calling'));})[_0x6235('0x6e')](function(_0x14a08c){ut[_0x6235('0x53')](_0x6235('0x102'),_0x14a08c);_0x245541(ut[_0x6235('0x6f')](_0x6235('0x103'),_0x26cec,_0x4e9f71));});}else{_0x107e3c[_0x6235('0x32')]+=0x1;ut[_0x6235('0x104')](_0xa85cdb);rpcDb[_0x6235('0x105')](_0xa85cdb,_0x6235('0x106'));delete _0x5eda5b[_0x6235('0x63')][_0x25245f];_0x245541(ut[_0x6235('0x6f')](_0x6235('0x107'),_0x26cec,_0x4e9f71));}});};Preview[_0x6235('0xa')][_0x6235('0x90')]=function(_0x523f00){return!_[_0x6235('0x62')](_0x523f00)&&!_[_0x6235('0x62')](_0x523f00[_0x6235('0x23')])&&!_[_0x6235('0x62')](_0x523f00['active'])&&_0x523f00[_0x6235('0x47')]&&!_[_0x6235('0x62')](this[_0x6235('0x10')][util[_0x6235('0x4a')](_0x6235('0x108'),_0x523f00[_0x6235('0x23')])])&&!_['isNil'](this['trunks'][util[_0x6235('0x4a')]('SIP/%s',_0x523f00[_0x6235('0x23')])][_0x6235('0x109')])&&(this[_0x6235('0x10')][util[_0x6235('0x4a')](_0x6235('0x108'),_0x523f00['name'])][_0x6235('0x109')]===_0x6235('0x10a')||this[_0x6235('0x10')][util['format'](_0x6235('0x108'),_0x523f00[_0x6235('0x23')])][_0x6235('0x109')]==='unmonitored');};Preview[_0x6235('0xa')][_0x6235('0x7d')]=function(_0x1cd808,_0x3df069){var _0x50eb88=this;return new BPromise(function(_0x18c801,_0x159bc1){_0x50eb88['execRun'](_0x1cd808,_0x3df069)['then'](function(_0x557b31){_0x18c801(_[_0x6235('0x69')](_0x557b31,[_0x6235('0x6f')]));})['catch'](function(_0x17c4c0){if(_0x17c4c0['unlock']){rpcDb['unlockContact'](_0x1cd808);}if(_0x17c4c0[_0x6235('0x47')]){rpcDb[_0x6235('0x81')](_0x1cd808);}_0x159bc1(_[_0x6235('0x69')](_0x17c4c0,[_0x6235('0x6f')]));});});};Preview['prototype'][_0x6235('0x10b')]=function(_0x113ac5,_0x2c0a90){var _0x2ab4f7=this;return new BPromise(function(_0x3758f1,_0x52105c){var _0x1b45cc,_0x21b66c;rpcDb[_0x6235('0x10c')](_0x113ac5)[_0x6235('0x7e')](function(_0x232b27){if(!_[_0x6235('0x62')](_0x232b27[0x0])){_0x21b66c=_0x232b27[0x0]['recallme']?![]:!![];_0x1b45cc=_0x232b27[0x0][_0x6235('0x10d')]?!![]:![];_0x1b45cc=_0x2c0a90?!![]:_0x1b45cc;}var _0x3682c8=_0x2ab4f7[_0x6235('0x10e')](_0x232b27);if(_0x3682c8[_0x6235('0x10f')]){rpcDb[_0x6235('0x110')](_[_0x6235('0x69')](_0x232b27[0x0],['VoiceQueueId',_0x6235('0x111')]))[_0x6235('0x7e')](function(_0x5e6205){_0x2ab4f7[_0x6235('0xf8')](_0x5e6205,_0x232b27[0x0],_0x2c0a90,_0x21b66c,_0x1b45cc)[_0x6235('0x7e')](function(_0x2c7e1e){_0x3758f1(_0x2c7e1e);})[_0x6235('0x6e')](function(_0x14493e){_0x52105c(_0x14493e);});})[_0x6235('0x6e')](function(_0x1d687b){ut[_0x6235('0x53')](_0x6235('0x112'),_0x1d687b);_0x52105c(ut[_0x6235('0x6f')](_0x6235('0x113'),_0x21b66c,_0x1b45cc));});}else{_0x52105c(ut[_0x6235('0x6f')](_0x3682c8['message'],_0x21b66c,_0x1b45cc));}})['catch'](function(_0x364de9){ut[_0x6235('0x53')](_0x6235('0x114'),_0x364de9);_0x52105c(ut['message'](_0x6235('0x113'),![],!![]));});});};Preview[_0x6235('0xa')][_0x6235('0x10e')]=function(_0x862674){if(_[_0x6235('0x62')](_0x862674)||_[_0x6235('0xfc')](_0x862674)||!_[_0x6235('0x62')](_0x862674[0x0][_0x6235('0x7b')])&&_[_0x6235('0x62')](_0x862674[0x0][_0x6235('0x7b')]['name'])){ut[_0x6235('0x53')](_0x6235('0x115'),_0x862674);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x240a0=this[_0x6235('0xe')][_0x862674[0x0][_0x6235('0x66')][_0x6235('0x23')]];_0x240a0[_0x6235('0x6f')]=_0x6235('0x92');if(_['isNil'](_0x240a0)){ut[_0x6235('0x53')]('[Preview][validateContact][Empty\x20Campaign]',_0x240a0);return{'isValid':![],'message':_0x6235('0x116')};}if(!this[_0x6235('0x90')](_0x240a0[_0x6235('0x46')])){ut['logger'](_0x6235('0x117'),_0x6235('0x118')+_0x240a0[_0x6235('0x23')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x240a0[_0x6235('0x119')])){ut[_0x6235('0x53')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x240a0[_0x6235('0x23')]+_0x6235('0x11a'));return{'isValid':![],'message':_0x6235('0x11b')};}}if(!ut['isActive'](_0x240a0[_0x6235('0x5e')])){ut[_0x6235('0x53')](_0x6235('0x11c'),_0x240a0[_0x6235('0x23')]+_0x6235('0x11d'));return{'isValid':![],'message':_0x6235('0x118')+_0x240a0[_0x6235('0x23')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0x5b0d38,_0xc1db7f,_0x21032f,_0x3ccfb9){var _0x13c036=this;return new BPromise(function(_0x4c7aa0,_0x5d330c){var _0xe579e8=_0x5b0d38['uniqueid'];var _0x1c1a61=_0x13c036[_0x6235('0x90')](_0xc1db7f[_0x6235('0x46')])?util[_0x6235('0x4a')](_0x6235('0x11e'),_0xc1db7f['Trunk'][_0x6235('0x23')],_[_0x6235('0x62')](_0xc1db7f[_0x6235('0x2f')])?'':_0xc1db7f[_0x6235('0x2f')][_0x6235('0x11f')]()||'',_0xc1db7f[_0x6235('0x120')]>0x0?_0x21032f[_0x6235('0x121')]['phone'][_0x6235('0x122')](_0xc1db7f[_0x6235('0x120')]):_0x21032f['Contact'][_0x6235('0xf9')]):util[_0x6235('0x4a')](_0x6235('0x11e'),_[_0x6235('0x62')](_0xc1db7f[_0x6235('0x119')])?_0xc1db7f[_0x6235('0x46')]['name']:_0xc1db7f[_0x6235('0x119')][_0x6235('0x23')],_[_0x6235('0x62')](_0xc1db7f[_0x6235('0x2f')])?'':_0xc1db7f[_0x6235('0x2f')][_0x6235('0x11f')]()||'',_0xc1db7f[_0x6235('0x120')]>0x0?_0x21032f['Contact'][_0x6235('0xf9')][_0x6235('0x122')](_0xc1db7f['dialCutDigit']):_0x21032f[_0x6235('0x121')][_0x6235('0xf9')]);var _0x3e8839=_0x13c036[_0x6235('0x90')](_0xc1db7f['Trunk'])?ut[_0x6235('0x123')](_0xc1db7f['Trunk'][_0x6235('0x48')],_0xc1db7f[_0x6235('0x124')],_0xc1db7f[_0x6235('0x125')]>0x0?ut['getCallerIdRandom'](_0xc1db7f['dialOriginateCallerIdNumber'],_0xc1db7f[_0x6235('0x125')]):_0xc1db7f[_0x6235('0x126')]):ut['getCallerId'](_[_0x6235('0x62')](_0xc1db7f[_0x6235('0x119')])?_0xc1db7f['Trunk'][_0x6235('0x48')]:_0xc1db7f[_0x6235('0x119')][_0x6235('0x48')],_0xc1db7f[_0x6235('0x124')],_0xc1db7f[_0x6235('0x125')]>0x0?ut['getCallerIdRandom'](_0xc1db7f[_0x6235('0x126')],_0xc1db7f[_0x6235('0x125')]):_0xc1db7f['dialOriginateCallerIdNumber']);if(_0x3e8839){_0x5b0d38[_0x6235('0x127')]=ut[_0x6235('0x128')](_0x3e8839);_0x5b0d38[_0x6235('0x129')]=ut['extractCalleridNumber'](_0x3e8839);}var _0x2d1d08=ut[_0x6235('0x12a')](_0xc1db7f,_0x21032f,_0x1c1a61,_0x3e8839,_0xe579e8,_0x5b0d38);_[_0x6235('0x12b')](_0x5b0d38,ut[_0x6235('0x12c')](_0x2d1d08));_0x5b0d38[_0x6235('0x12d')]=moment()[_0x6235('0x4a')](_0x6235('0x82'));ami[_0x6235('0x6d')](ut[_0x6235('0x12e')](_0x5b0d38,_0xc1db7f,_0x2d1d08,_0x5b0d38[_0x6235('0xa2')],_0x3ccfb9))[_0x6235('0x7e')](function(_0x510cd5){_0xc1db7f[_0x6235('0x51')]+=0x1;logger[_0x6235('0x64')](_0x6235('0x12f'),_0xe579e8,'\x20Queue',_0xc1db7f[_0x6235('0x23')],_0x6235('0xeb'),_0xc1db7f['originated']);_0x4c7aa0(_0x510cd5);})['catch'](function(_0x2f912d){ut['logAgent'](_0x5b0d38,0xe,_0x6235('0x130'));rpcDb[_0x6235('0xf2')](_0x5b0d38,_0x6235('0x131'));_0x5d330c(_0x2f912d);});});};Preview['prototype']['syncNewExten']=function(_0x63a1){if(this[_0x6235('0x63')][_0x63a1[_0x6235('0xa3')]]){this[_0x6235('0x63')][_0x63a1[_0x6235('0xa3')]]['channel']=_0x63a1[_0x6235('0x132')];}};Preview[_0x6235('0xa')]['syncOriginateResponse']=function(_0x31d5e5){var _0x11ac15=this;var _0x259fa2=this['actions'][_0x31d5e5[_0x6235('0x133')]];if(_0x259fa2){if(_0x259fa2[_0x6235('0xfb')]&&this[_0x6235('0x11')][_0x259fa2[_0x6235('0xfb')]]){ut[_0x6235('0x134')](_0x259fa2,this['agents'][_0x259fa2[_0x6235('0xfb')]][_0x6235('0x23')],this[_0x6235('0x11')][_0x259fa2[_0x6235('0xfb')]]['id']);}var _0x506b40=_['clone'](_0x259fa2);_0x506b40[_0x6235('0xa5')]=moment()['format'](_0x6235('0x82'));var _0x483000=_0x11ac15[_0x6235('0xe')][_0x259fa2[_0x6235('0x67')]];if(ut['isFailure'](_0x31d5e5['response'])){if(_0x259fa2['unlockAgent']){rpcDb[_0x6235('0x135')](_0x259fa2['idContact']);}if(_0x259fa2[_0x6235('0xa2')]){rpcDb['disableContact'](_0x259fa2[_0x6235('0xff')]);}ami[_0x6235('0x20')](_0x6235('0x136'),ut[_0x6235('0x97')](_0x259fa2,_0x6235('0x137'),this[_0x6235('0xe')][_0x259fa2[_0x6235('0x67')]]));this[_0x6235('0x138')](_0x506b40,_0x483000,_0x31d5e5);}else{_0x259fa2['starttime']=moment()[_0x6235('0x4a')](_0x6235('0x82'));ut['logAgent'](_0x506b40,0x4,'Answer');rpcDb[_0x6235('0xf2')](_0x506b40,_0x6235('0x139'));}}};Preview[_0x6235('0xa')][_0x6235('0x13a')]=function(_0x23430c){var _0x2a3fd2=this;var _0x1f2292=this['actions'][_0x23430c[_0x6235('0xa3')]];var _0x5b6ad5;if(_0x1f2292){_0x5b6ad5=this['campaignsPreview'][_0x1f2292[_0x6235('0x67')]];logger[_0x6235('0x64')](_0x6235('0x13b'),_0x23430c['linkedid'],_0x6235('0xa8'),_0x5b6ad5['name'],_0x6235('0xa9'),_0x5b6ad5[_0x6235('0x25')]);}if(this[_0x6235('0x63')][_0x23430c[_0x6235('0xa3')]]&&_0x23430c[_0x6235('0xa3')]!==_0x23430c[_0x6235('0xa7')]){if(_0x23430c[_0x6235('0x13c')]==='16'&&this['actions'][_0x23430c[_0x6235('0xa3')]][_0x6235('0x68')]){this[_0x6235('0x93')](_0x23430c,_0x23430c[_0x6235('0xa3')],_0x23430c[_0x6235('0x13c')]);}else if(this[_0x6235('0x63')][_0x23430c[_0x6235('0xa3')]]['dialAnswer']){logger['info'](_0x6235('0x13d'),_0x23430c[_0x6235('0xa3')],_0x23430c['cause'],_0x6235('0xa8'),_0x5b6ad5[_0x6235('0x23')],'pTalking:\x20',_0x5b6ad5[_0x6235('0x25')]);this[_0x6235('0x93')](_0x23430c,_0x23430c['linkedid'],_0x23430c[_0x6235('0x13c')]);}}else if(_0x1f2292&&_[_0x6235('0x62')](_0x1f2292[_0x6235('0x13e')])&&_0x5b6ad5[_0x6235('0x13f')]&&_0x23430c[_0x6235('0xa3')]===_0x23430c['uniqueid']&&_[_0x6235('0x62')](_0x23430c['reason'])&&_0x23430c[_0x6235('0x13c')]==='16'&&_0x23430c[_0x6235('0x140')]==='6'&&_[_0x6235('0xed')](_0x1f2292[_0x6235('0x141')])){if(_0x1f2292['unlockAgent']){rpcDb['unlockContact'](_0x1f2292[_0x6235('0xff')]);}if(_0x1f2292['activeContact']){rpcDb['disableContact'](_0x1f2292[_0x6235('0xff')]);}_0x23430c['reason']='22';this[_0x6235('0x138')](_0x1f2292,_0x5b6ad5,_0x23430c);}else if(_0x1f2292&&_0x1f2292['transfer']){if(_0x23430c[_0x6235('0x13c')]==='16'&&this[_0x6235('0x63')][_0x23430c[_0x6235('0xa3')]][_0x6235('0x68')]){logger[_0x6235('0x64')](_0x6235('0x142'),_0x23430c[_0x6235('0xa3')],_0x23430c[_0x6235('0x13c')],'\x20Queue',_0x5b6ad5['name'],_0x6235('0xa9'),_0x5b6ad5[_0x6235('0x25')]);this[_0x6235('0x93')](_0x23430c,_0x23430c[_0x6235('0xa3')],_0x23430c[_0x6235('0x13c')]);}else if(this[_0x6235('0x63')][_0x23430c[_0x6235('0xa3')]][_0x6235('0x68')]){logger[_0x6235('0x64')]('[syncHangup][talking][cause]',_0x23430c['linkedid'],_0x23430c[_0x6235('0x13c')],'\x20Queue',_0x5b6ad5[_0x6235('0x23')],_0x6235('0xa9'),_0x5b6ad5[_0x6235('0x25')]);this['callProgressDetectingCustomer'](_0x23430c,_0x23430c[_0x6235('0xa3')],_0x23430c[_0x6235('0x13c')]);}}};Preview[_0x6235('0xa')][_0x6235('0x17')]=function(_0x1a4fec){if(this[_0x6235('0x63')][_0x1a4fec[_0x6235('0xec')]]&&_0x1a4fec['destlinkedid']!==_0x1a4fec['destuniqueid']){this[_0x6235('0x93')](_0x1a4fec,_0x1a4fec['destlinkedid'],_0x1a4fec[_0x6235('0xe0')]);}};Preview[_0x6235('0xa')][_0x6235('0x16')]=function(_0x2ea2f0){if(this[_0x6235('0x63')][_0x2ea2f0[_0x6235('0xa3')]]&&_0x2ea2f0[_0x6235('0xa3')]!==_0x2ea2f0[_0x6235('0xa7')]&&!this['actions'][_0x2ea2f0[_0x6235('0xa3')]]['dialAnswer']){if(_0x2ea2f0[_0x6235('0x13c')]==='1'){this['callProgressDetectingCustomer'](_0x2ea2f0,_0x2ea2f0[_0x6235('0xa3')],_0x2ea2f0[_0x6235('0x13c')]);}}};Preview[_0x6235('0xa')][_0x6235('0x143')]=function(_0x2e5be4,_0x16f15c,_0x4dfb13){if(this[_0x6235('0x63')][_0x2e5be4]){if(_['isNil'](this[_0x6235('0x63')][_0x2e5be4]['variables'])){this[_0x6235('0x63')][_0x2e5be4]['variables']={};}this[_0x6235('0x63')][_0x2e5be4][_0x6235('0x144')][_0x16f15c]=_0x4dfb13;}};Preview[_0x6235('0xa')][_0x6235('0x1b')]=function(_0x4340b0){try{if(!_[_0x6235('0x62')](_0x4340b0)){if(ut[_0x6235('0x145')](_[_0x6235('0x146')](_0x4340b0[_0x6235('0x147')])[0x0])){this[_0x6235('0x143')](_0x4340b0['uniqueid'],_[_0x6235('0x146')](_0x4340b0['variable'])[0x0],_0x4340b0['value']);}}}catch(_0x2742fe){logger[_0x6235('0x148')](_0x6235('0x149'),util[_0x6235('0x14a')](_0x2742fe,{'showHidden':![],'depth':null}));}};Preview[_0x6235('0xa')][_0x6235('0x1d')]=function(_0x328a09){if(_0x328a09){if(this[_0x6235('0x63')][_0x328a09[_0x6235('0x14b')]]){this[_0x6235('0x63')][_0x328a09['transfertargetlinkedid']][_0x6235('0x141')]=!![];}}};Preview['prototype'][_0x6235('0x1f')]=function(_0x1d18b2){if(_0x1d18b2){if(this['actions'][_0x1d18b2['transfererlinkedid']]){this[_0x6235('0x63')][_0x1d18b2[_0x6235('0x14c')]][_0x6235('0x141')]=!![];}}};module[_0x6235('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 94aa33e..0564e62 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ad3=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','answertime','queuecallercomplete','endtime','membername','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x20b381,_0x18b761){var _0x238ddf=function(_0xa5f7e1){while(--_0xa5f7e1){_0x20b381['push'](_0x20b381['shift']());}};_0x238ddf(++_0x18b761);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x39979b,_0x2111f9){_0x39979b=_0x39979b-0x0;var _0x560b41=_0x5ad3[_0x39979b];return _0x560b41;};'use strict';var util=require(_0x35ad('0x0'));var BPromise=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var _=require('lodash');var cmHopper=require(_0x35ad('0x4'));var cmHopperFinal=require(_0x35ad('0x5'));var cmHopperHistory=require(_0x35ad('0x6'));var cmHopperBlack=require(_0x35ad('0x7'));var voiceQueueRt=require(_0x35ad('0x8'));var agentReportPreview=require(_0x35ad('0x9'));var voiceQueueReport=require(_0x35ad('0xa'));function loggerCatch(_0x436dcb){return function(_0x36c606){logger[_0x35ad('0xb')](_0x436dcb,util['inspect'](_0x36c606,{'showHidden':![],'depth':null}));};}function create(_0x292521){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopperHistory['createHistory'](_0x292521))[_0x35ad('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x5a29e3){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](agentReportPreview['createHistory'](_0x5a29e3))[_0x35ad('0xe')](loggerCatch(_0x35ad('0xf')));}function moveContact(_0x4ad760){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x10')](_0x4ad760,!![]))['catch'](loggerCatch(_0x35ad('0x11')));}exports[_0x35ad('0x12')]=function(_0x595fe8){return BPromise['resolve']()[_0x35ad('0xd')](cmHopperBlack[_0x35ad('0x12')](_0x595fe8))[_0x35ad('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x35ad('0x13')]=function(_0x2ebceb){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper['getContactPreview'](_0x2ebceb))['catch'](loggerCatch(_0x35ad('0x14')));};exports[_0x35ad('0x15')]=function(_0x27efeb,_0x56cb8e){create(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));moveContact(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));};exports[_0x35ad('0x16')]=function(_0x3158a1,_0x3a73c8){createAgent(_0x3158a1)[_0x35ad('0xe')](loggerCatch(_0x3a73c8));};exports['createCustomerHistory']=function(_0xd32a43,_0x2876ad){create(_0xd32a43)['catch'](loggerCatch(_0x2876ad));};exports['createCustomerFinal']=function(_0x3251d9,_0x398853){moveContact(_0x3251d9)['catch'](loggerCatch(_0x398853));};exports[_0x35ad('0x17')]=function(_0x32735e,_0x496620,_0x37c03d){if(_0x496620){_0x32735e[_0x35ad('0x18')]=null;}if(_0x37c03d){_0x32735e[_0x35ad('0x19')]=![];}return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x17')](_0x32735e))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1a')));};exports[_0x35ad('0x1b')]=function(_0xebc6c5){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1b')](_0xebc6c5))['catch'](loggerCatch(_0x35ad('0x1c')));};exports[_0x35ad('0x1d')]=function(_0xa3cb9f){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper['unlockContact']({'UserId':null},_0xa3cb9f,0x1))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1e')));};exports[_0x35ad('0x1f')]=function(_0x1ca61d){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1d')]({'active':![]},_0x1ca61d,0x1))[_0x35ad('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x35ad('0x20')]=function(_0x11da54){var _0x2f8b3={};_0x2f8b3[_0x35ad('0x21')]=_0x11da54[_0x35ad('0x21')];_0x2f8b3['uniqueid']=_0x11da54['uniqueid'];_0x2f8b3[_0x35ad('0x22')]=_0x11da54['calleridnum'];_0x2f8b3[_0x35ad('0x23')]=_0x11da54['calleridname'];_0x2f8b3['queue']=_0x11da54['queue'];_0x2f8b3['queuecallerjoinAt']=_0x11da54[_0x35ad('0x24')];_0x2f8b3['queuecallerleaveAt']=_0x11da54['answertime'];_0x2f8b3[_0x35ad('0x25')]=0x1;_0x2f8b3['queuecallercompleteAt']=_0x11da54[_0x35ad('0x26')];_0x2f8b3['connectedlinename']=_0x11da54[_0x35ad('0x27')];_0x2f8b3['context']=_0x35ad('0x28');_0x2f8b3['exten']=_0x35ad('0x29');_0x2f8b3[_0x35ad('0x2a')]=0x0;_0x2f8b3[_0x35ad('0x2b')]=0x1;_0x2f8b3['lastAssignedTo']=_0x11da54[_0x35ad('0x27')];_0x2f8b3[_0x35ad('0x2c')]=_0x35ad('0x2d');return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](voiceQueueReport['create'](_0x2f8b3))['catch'](loggerCatch(_0x35ad('0x2e')));};exports[_0x35ad('0x2f')]=function(_0x378e2a,_0x1c8a3d){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x2f')](_0x378e2a,_0x1c8a3d))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x30')));};exports[_0x35ad('0x31')]=function(_0x3b7b52){return BPromise['resolve']()['then'](cmHopper[_0x35ad('0x17')](_0x3b7b52,!![],!![]))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x32')));}; \ No newline at end of file +var _0xe015=['../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe015,0x13b));var _0x5e01=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe015[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x5e01('0x0'));var BPromise=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('preview');var _=require('lodash');var cmHopper=require(_0x5e01('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x5e01('0x4'));var cmHopperBlack=require(_0x5e01('0x5'));var voiceQueueRt=require(_0x5e01('0x6'));var agentReportPreview=require(_0x5e01('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1814cb){return function(_0x3d2da2){logger['error'](_0x1814cb,util['inspect'](_0x3d2da2,{'showHidden':![],'depth':null}));};}function create(_0x414f73){return BPromise[_0x5e01('0x8')]()[_0x5e01('0x9')](cmHopperHistory[_0x5e01('0xa')](_0x414f73))[_0x5e01('0xb')](loggerCatch(_0x5e01('0xc')));}function createAgent(_0x5b3938){return BPromise[_0x5e01('0x8')]()['then'](agentReportPreview[_0x5e01('0xa')](_0x5b3938))['catch'](loggerCatch(_0x5e01('0xc')));}function moveContact(_0x406b26){return BPromise['resolve']()[_0x5e01('0x9')](cmHopper[_0x5e01('0xd')](_0x406b26,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x5e01('0xe')]=function(_0x160f79){return BPromise[_0x5e01('0x8')]()[_0x5e01('0x9')](cmHopperBlack[_0x5e01('0xe')](_0x160f79))[_0x5e01('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x5e01('0xf')]=function(_0x5816aa){return BPromise['resolve']()[_0x5e01('0x9')](cmHopper[_0x5e01('0xf')](_0x5816aa))['catch'](loggerCatch(_0x5e01('0x10')));};exports['createHistory']=function(_0x4fb33e,_0x5e4058){create(_0x4fb33e)[_0x5e01('0xb')](loggerCatch(_0x5e4058));moveContact(_0x4fb33e)['catch'](loggerCatch(_0x5e4058));};exports[_0x5e01('0x11')]=function(_0x5eda1d,_0x509c07){createAgent(_0x5eda1d)[_0x5e01('0xb')](loggerCatch(_0x509c07));};exports[_0x5e01('0x12')]=function(_0x4fa1c7,_0xce3f3f){create(_0x4fa1c7)[_0x5e01('0xb')](loggerCatch(_0xce3f3f));};exports[_0x5e01('0x13')]=function(_0x45e543,_0x396cf3){moveContact(_0x45e543)[_0x5e01('0xb')](loggerCatch(_0x396cf3));};exports[_0x5e01('0x14')]=function(_0x153eb1,_0x5f04f1,_0x150ebf){if(_0x5f04f1){_0x153eb1[_0x5e01('0x15')]=null;}if(_0x150ebf){_0x153eb1['active']=![];}return BPromise[_0x5e01('0x8')]()[_0x5e01('0x9')](cmHopper[_0x5e01('0x14')](_0x153eb1))[_0x5e01('0xb')](loggerCatch(_0x5e01('0x16')));};exports[_0x5e01('0x17')]=function(_0x5efff9){return BPromise[_0x5e01('0x8')]()[_0x5e01('0x9')](cmHopper[_0x5e01('0x17')](_0x5efff9))[_0x5e01('0xb')](loggerCatch('[countReScheduled]\x20'));};exports[_0x5e01('0x18')]=function(_0x23264f){return BPromise[_0x5e01('0x8')]()['then'](cmHopper[_0x5e01('0x18')]({'UserId':null},_0x23264f,0x1))[_0x5e01('0xb')](loggerCatch(_0x5e01('0x19')));};exports[_0x5e01('0x1a')]=function(_0x58dc6f){return BPromise['resolve']()[_0x5e01('0x9')](cmHopper['unlockContact']({'active':![]},_0x58dc6f,0x1))[_0x5e01('0xb')](loggerCatch(_0x5e01('0x1b')));};exports[_0x5e01('0x1c')]=function(_0xc26cf8){var _0x592a61={};_0x592a61['type']=_0xc26cf8['type'];_0x592a61['uniqueid']=_0xc26cf8[_0x5e01('0x1d')];_0x592a61['calleridnum']=_0xc26cf8[_0x5e01('0x1e')];_0x592a61[_0x5e01('0x1f')]=_0xc26cf8[_0x5e01('0x1f')];_0x592a61['queue']=_0xc26cf8[_0x5e01('0x20')];_0x592a61[_0x5e01('0x21')]=_0xc26cf8[_0x5e01('0x22')];_0x592a61[_0x5e01('0x23')]=_0xc26cf8['answertime'];_0x592a61['queuecallercomplete']=0x1;_0x592a61[_0x5e01('0x24')]=_0xc26cf8[_0x5e01('0x25')];_0x592a61[_0x5e01('0x26')]=_0xc26cf8[_0x5e01('0x27')];_0x592a61[_0x5e01('0x28')]=_0x5e01('0x29');_0x592a61[_0x5e01('0x2a')]=_0x5e01('0x2b');_0x592a61[_0x5e01('0x2c')]=0x0;_0x592a61[_0x5e01('0x2d')]=0x1;_0x592a61[_0x5e01('0x2e')]=_0xc26cf8[_0x5e01('0x27')];_0x592a61['queuecallerexitreason']=_0x5e01('0x2f');return BPromise[_0x5e01('0x8')]()[_0x5e01('0x9')](voiceQueueReport['create'](_0x592a61))[_0x5e01('0xb')](loggerCatch(_0x5e01('0x30')));};exports['getContactRecallMe']=function(_0x3cc642,_0x2c38af){return BPromise[_0x5e01('0x8')]()['then'](cmHopper[_0x5e01('0x31')](_0x3cc642,_0x2c38af))[_0x5e01('0xb')](loggerCatch(_0x5e01('0x32')));};exports[_0x5e01('0x33')]=function(_0x388b8a){return BPromise[_0x5e01('0x8')]()[_0x5e01('0x9')](cmHopper[_0x5e01('0x14')](_0x388b8a,!![],!![]))[_0x5e01('0xb')](loggerCatch(_0x5e01('0x34')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 4e92d56..c0a6d3a 100644 --- a/server/services/ami/preview/util/util.js +++ b/server/services/ami/preview/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0807=['[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','status','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridname','calleridnum','dialer','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','ringtime','starttime','logLookAgent','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','talktime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0807,0x147));var _0x7080=function(_0x49bd5b,_0x3303d3){_0x49bd5b=_0x49bd5b-0x0;var _0x52507b=_0x0807[_0x49bd5b];return _0x52507b;};'use strict';var util=require('util');var _=require(_0x7080('0x0'));var moment=require(_0x7080('0x1'));var logger=require(_0x7080('0x2'))(_0x7080('0x3'));var ipAgi=process['env'][_0x7080('0x4')]||_0x7080('0x5');function getSeconds(_0x384ef6,_0x719eb1){var _0xcca379=moment(_0x384ef6)[_0x7080('0x6')](0x0);var _0x5d62fe=moment(_0x719eb1)['milliseconds'](0x0);return _0xcca379[_0x7080('0x7')](_0x5d62fe,_0x7080('0x8'));}exports[_0x7080('0x9')]=function(_0x2dc21a){return function(_0xf5ec98){logger[_0x7080('0xa')](_0x2dc21a,util['inspect'](_0xf5ec98,{'showHidden':![],'depth':null}));};};exports[_0x7080('0xb')]=function(_0x480c06,_0x28b063){logger[_0x7080('0xc')](_0x480c06,util[_0x7080('0xd')](_0x28b063,{'showHidden':![],'depth':null}));};exports[_0x7080('0xe')]=function(_0xbd8da3,_0x3852a8){logger[_0x7080('0xa')](_0xbd8da3,util['inspect'](_0x3852a8,{'showHidden':![],'depth':null}));};exports[_0x7080('0xf')]=function(_0x59ae56){return function(_0x178a8b){logger['info'](_0x59ae56,util[_0x7080('0xd')](_0x178a8b,{'showHidden':![],'depth':null}));};};exports[_0x7080('0x10')]=function(_0x1433e6,_0x4c2ec2,_0x105115){return{'message':_0x1433e6,'unlock':_0x4c2ec2,'active':_0x105115};};exports[_0x7080('0x11')]=function(_0x1b9383,_0x24448b,_0x473da3){if(!_[_0x7080('0x12')](_0x473da3)&&_0x7080('0x13')===typeof _0x473da3&&!_[_0x7080('0x14')](_0x473da3)){if(!_['isUndefined'](_0x24448b)&&_0x7080('0x13')===typeof _0x24448b&&!_['isEmpty'](_0x24448b)){return util[_0x7080('0x15')](_0x7080('0x16'),_0x24448b,_0x473da3);}return util[_0x7080('0x15')](_0x7080('0x16'),_0x473da3,_0x473da3);}if(!_[_0x7080('0x12')](_0x1b9383)&&'string'===typeof _0x1b9383&&!_[_0x7080('0x14')](_0x1b9383)){return _0x1b9383;}return _0x7080('0x17');};exports[_0x7080('0x18')]=function(_0x550b0f){if(_[_0x7080('0x19')](_0x550b0f)){return![];}return _0x550b0f;};exports[_0x7080('0x1a')]=function(_0xa6d5df,_0x413094,_0x3f6785,_0x25aaa6,_0x2f61f2,_0x4b2ad1){var _0x5f0572={'XMD-QUEUE':_0x413094['Queue']?_0x413094['Queue'][_0x7080('0x1b')]:'','XMD-CALLERID':_0x25aaa6,'XMD-CALLERID-PREVIEW':_0x4b2ad1?util[_0x7080('0x15')]('\x22%s\x22\x20<%s>',_0x4b2ad1[_0x7080('0x1c')],_0x4b2ad1[_0x7080('0x1d')]):_0x25aaa6,'XMD-DIALID':_0x2f61f2,'XMD-CONTACTID':_0x413094['ContactId'],'XMD-CDRTYPE':_0x7080('0x1e'),'CALLERID(all)':_0x25aaa6,'XMD-VOICEQUEUEID':_0x413094['VoiceQueueId'],'XMD-DIALCHANNEL':_0x3f6785,'XMD-DIALTIMEOUT':_0xa6d5df[_0x7080('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0xa6d5df['dialQueueProject2']?'g':'',_[_0x7080('0x14')](_0xa6d5df['monitor_format'])?'':_0x7080('0x20')),'XMD-DIALURL':_0xa6d5df[_0x7080('0x21')]||'','XMD-AGI':_0xa6d5df[_0x7080('0x22')]?util['format'](_0x7080('0x23'),ipAgi,_0xa6d5df[_0x7080('0x22')]):_0x7080('0x24'),'XMD-AGIAFTER':_0xa6d5df[_0x7080('0x25')]?util['format'](_0x7080('0x23'),ipAgi,_0xa6d5df[_0x7080('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4b2ad1?_0x4b2ad1[_0x7080('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4b2ad1?_0x4b2ad1[_0x7080('0x27')]:'','XMD-DESTINATION':_0x7080('0x28')};if(!_[_0x7080('0x14')](_0xa6d5df[_0x7080('0x29')])){_0x5f0572[util[_0x7080('0x15')]('%s',_0x7080('0x2a'))]=_0xa6d5df[_0x7080('0x29')];_0x5f0572[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2f61f2;}if(_0x413094&&_0x413094[_0x7080('0x2b')]){for(var _0x438cc7 in _0x413094['Contact']){if(_0x413094[_0x7080('0x2b')][_0x7080('0x2c')](_0x438cc7)){if(!_['isNil'](_0x413094['Contact'][_0x438cc7])&&_0x438cc7!=='id'&&_0x438cc7!==_0x7080('0x2d')&&_0x438cc7!==_0x7080('0x2e')&&_0x438cc7!=='updatedAt'){_0x5f0572[util['format'](_0x7080('0x2f'),_0x7080('0x30'),_['toUpper'](_0x438cc7))]=_0x413094['Contact'][_0x438cc7];}}}}return _0x5f0572;};exports[_0x7080('0x31')]=function(_0x4775bf){var _0x240bbb={};for(var _0x18afff in _0x4775bf){if(_0x4775bf[_0x7080('0x2c')](_0x18afff)){_0x240bbb[util[_0x7080('0x15')]('%s',_[_0x7080('0x32')](_0x18afff))]=_0x4775bf[_0x18afff];}}return{'variables':_0x240bbb};};exports[_0x7080('0x33')]=function(_0x1572a0,_0x3e797f){if(!_['isNil'](_0x1572a0)){if(_0x1572a0[_0x7080('0x2c')]('originated')){if(_0x1572a0['originated']>0x0){_0x1572a0[_0x7080('0x34')]-=0x1;}else{logger[_0x7080('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3e797f);}}}else{logger[_0x7080('0xa')](_0x7080('0x35'),_0x3e797f);}};exports[_0x7080('0x36')]=function(_0x14074e){var _0x5aa069=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14074e[_0x7080('0x37')]=0xd;_0x14074e[_0x7080('0x38')]=_0x7080('0x39');_0x14074e['starttime']=_0x5aa069;_0x14074e[_0x7080('0x3a')]=_0x5aa069;_0x14074e[_0x7080('0x3b')]=_0x5aa069;};exports['logAgent']=function(_0x380dac,_0x222498,_0xe55193){var _0x4e04ad=moment()[_0x7080('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x380dac['state']=_0x222498;_0x380dac[_0x7080('0x38')]=_0xe55193;_0x380dac[_0x7080('0x3a')]=_0x4e04ad;_0x380dac[_0x7080('0x3c')]=getSeconds(_0x380dac[_0x7080('0x3a')],_0x380dac[_0x7080('0x3d')]);};exports[_0x7080('0x3e')]=function(_0x1c3e18,_0x296ba5,_0x37216b){_0x1c3e18['membername']=_0x296ba5;_0x1c3e18[_0x7080('0x3f')]=_0x37216b;};exports[_0x7080('0x40')]=function(_0x5dfe5c,_0x819711,_0x127ce9){var _0x52053a=moment()[_0x7080('0x15')](_0x7080('0x41'));_0x5dfe5c[_0x7080('0x37')]=_0x819711;_0x5dfe5c[_0x7080('0x38')]=_0x127ce9;_0x5dfe5c[_0x7080('0x3a')]=_0x5dfe5c[_0x7080('0x3a')]?_0x5dfe5c[_0x7080('0x3a')]:_0x52053a;_0x5dfe5c[_0x7080('0x3b')]=_0x5dfe5c[_0x7080('0x3b')]?_0x5dfe5c[_0x7080('0x3b')]:_0x52053a;_0x5dfe5c[_0x7080('0x3c')]=getSeconds(_0x5dfe5c['responsetime']||0x0,_0x5dfe5c[_0x7080('0x3d')]||0x0);_0x5dfe5c[_0x7080('0x42')]=_0x5dfe5c[_0x7080('0x43')]?getSeconds(_0x5dfe5c[_0x7080('0x3b')],_0x5dfe5c[_0x7080('0x43')]):0x0;};exports[_0x7080('0x44')]=function(_0x53ead5){return _0x53ead5==='Failure';};exports['variablesAction']=function(_0x5aa677,_0x1785ca,_0x5802ba,_0x31b8bd,_0x50e90a){var _0x2cdabb=_0x31b8bd?_0x7080('0x45'):_0x5aa677[_0x7080('0x1c')];_0x2cdabb=_0x50e90a?_0x7080('0x46'):_0x2cdabb;return{'actionid':_0x5aa677[_0x7080('0x47')],'action':_0x7080('0x48'),'channel':_0x5aa677[_0x7080('0x49')],'callerid':util[_0x7080('0x15')](_0x7080('0x16'),_0x2cdabb,_0x5aa677[_0x7080('0x1d')]),'Exten':_0x7080('0x28'),'Context':_0x7080('0x4a'),'Priority':'1','variable':_0x5802ba,'timeout':(_0x1785ca[_0x7080('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5aa677[_0x7080('0x47')]};};exports[_0x7080('0x4c')]=function(_0xfc4295){return _0xfc4295[_0x7080('0x4d')]+_0xfc4295[_0x7080('0x4e')]+_0xfc4295[_0x7080('0x4f')]+_0xfc4295['countagentrejectretry']+_0xfc4295['countnosuchnumberretry'];};exports[_0x7080('0x50')]=function(_0x1387e2){var _0x3dab74=_[_0x7080('0x51')](_0x1387e2);_0x3dab74[_0x7080('0x37')]=0xf;_0x3dab74[_0x7080('0x38')]=_0x7080('0x52');return _0x3dab74;};exports[_0x7080('0x53')]=function(_0x3d6b5d,_0x495f64,_0x53fd0f){var _0x593ac3={};_0x593ac3[_0x495f64]=_0x3d6b5d[_0x495f64];_0x593ac3[_0x7080('0x54')]=![];_0x593ac3[_0x7080('0x55')]=moment()[_0x7080('0x56')](_0x53fd0f,_0x7080('0x57'))[_0x7080('0x15')](_0x7080('0x41'));_0x593ac3[_0x7080('0x58')]=_0x3d6b5d[_0x7080('0x58')];_0x593ac3[_0x7080('0x59')]=_0x3d6b5d[_0x7080('0x59')];_0x593ac3[_0x7080('0x5a')]=_0x3d6b5d['VoiceQueueId']||undefined;return _0x593ac3;};exports[_0x7080('0x5b')]=function(_0x1f55a4,_0x1fc69b){if(!_[_0x7080('0x19')](_0x1f55a4)){if(_0x1f55a4['pTalking']>0x0){_0x1f55a4[_0x7080('0x5c')]-=0x1;}else{logger[_0x7080('0xa')](_0x1fc69b,_0x7080('0x5d'));}}else{logger[_0x7080('0xa')](_0x1fc69b,_0x7080('0x5e'));}};exports[_0x7080('0x5f')]=function(_0x34f1d4){if(_0x34f1d4<=0x0){return!![];}return![];};exports[_0x7080('0x60')]=function(_0x39100f,_0x1cd5a5,_0x40b824){_0x39100f[_0x7080('0x61')]=_0x1cd5a5;_0x39100f[_0x7080('0x1b')]=_0x39100f[_0x7080('0x62')];_0x39100f[_0x7080('0x63')]=_0x39100f[_0x7080('0x49')];if(_0x40b824){_0x39100f[_0x7080('0x64')]=_0x40b824['mandatoryDisposition'];}return _0x39100f;};exports[_0x7080('0x65')]=function(_0x3fee68){var _0x4a869f={};_0x4a869f[_0x7080('0x62')]=_0x3fee68[_0x7080('0x62')];_0x4a869f['interface']=_0x3fee68[_0x7080('0x49')];_0x4a869f['uniqueid']=_0x3fee68[_0x7080('0x47')];return _0x4a869f;};exports['agentReadyId']=function(_0x290372){var _0x14a185=[];for(var _0x1ed029 in _0x290372){if(_0x290372[_0x7080('0x2c')](_0x1ed029)){if(!_['isNil'](_0x290372[_0x1ed029])&&_0x290372[_0x1ed029]['state']==='not_inuse'&&_0x290372[_0x1ed029][_0x7080('0x66')]==='reachable'){_0x14a185[_0x7080('0x67')](_0x290372[_0x1ed029]['id']);}}}return _0x14a185;};exports[_0x7080('0x68')]=function(_0x386f2c){var _0x138f7d=moment()[_0x7080('0x6')](0x0);var _0x102c45=moment(_0x386f2c)['milliseconds'](0x0);return _0x138f7d[_0x7080('0x7')](_0x102c45,_0x7080('0x8'));};exports['createBody']=function(_0x16629a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x16629a[_0x7080('0x58')],'ListId':_0x16629a['ListId'],'VoiceQueueId':_0x16629a[_0x7080('0x5a')]||undefined,'CampaignId':_0x16629a[_0x7080('0x69')]||undefined};};exports[_0x7080('0x6a')]=function(_0x459da9){if(_0x459da9===_0x7080('0x47')||_0x459da9===_0x7080('0x6b')||_0x459da9===_0x7080('0x62')||_0x459da9===_0x7080('0x6c')||_0x459da9===_0x7080('0x6d')||_0x459da9===_0x7080('0x6e')||_0x459da9==='membername'||_0x459da9===_0x7080('0x49')||_0x459da9===_0x7080('0x1c')||_0x459da9==='active'||_0x459da9===_0x7080('0x1d')||_0x459da9==='scheduledat'||_0x459da9==='countbusyretry'||_0x459da9===_0x7080('0x4e')||_0x459da9==='countnoanswerretry'||_0x459da9===_0x7080('0x6f')||_0x459da9===_0x7080('0x70')||_0x459da9==='callbackuniqueid'||_0x459da9===_0x7080('0x71')||_0x459da9===_0x7080('0x72')||_0x459da9==='ContactId'||_0x459da9===_0x7080('0x59')||_0x459da9===_0x7080('0x3f')||_0x459da9===_0x7080('0x5a')||_0x459da9===_0x7080('0x73')||_0x459da9===_0x7080('0x74')||_0x459da9===_0x7080('0x75')||_0x459da9==='xmd-phone'||_0x459da9==='xmd-listid'||_0x459da9==='xmd-dialurl'||_0x459da9===_0x7080('0x76')||_0x459da9===_0x7080('0x77')||_0x459da9==='xmd-dialid'||_0x459da9===_0x7080('0x78')||_0x459da9===_0x7080('0x79')||_0x459da9===_0x7080('0x7a')||_0x459da9===_0x7080('0x7b')||_0x459da9===_0x7080('0x7c')||_0x459da9===_0x7080('0x7d')||_0x459da9===_0x7080('0x7e')||_0x459da9===_0x7080('0x7f')||_0x459da9===_0x7080('0x80')||_0x459da9===_0x7080('0x81')||_0x459da9===_0x7080('0x82')||_0x459da9===_0x7080('0x83')||_0x459da9===_0x7080('0x84')||_0x459da9===_0x7080('0x85')||_0x459da9==='rtpaudioqos'||_0x459da9===_0x7080('0x7f')||_0x459da9==='rtpaudioqosjitter'||_0x459da9===_0x7080('0x81')||_0x459da9===_0x7080('0x82')||_0x459da9===_0x7080('0x83')||_0x459da9===_0x7080('0x84')||_0x459da9==='rtpaudioqosrttbridged'||_0x459da9==='bridgepeer'||_0x459da9===_0x7080('0x86')||_0x459da9===_0x7080('0x37')||_0x459da9===_0x7080('0x38')){return![];}return!![];};exports[_0x7080('0x87')]=function(_0x57ef79,_0x3b2b96){var _0x52b4fb,_0xc4e7a2,_0x596341;if(_0x3b2b96<=0x0){_0x3b2b96=0x1;}_0x52b4fb=new RegExp('\x5cw{0,'+_0x3b2b96+'}$');_0xc4e7a2=Math['pow'](0xa,_0x3b2b96-0x1);_0x596341=Math[_0x7080('0x88')](0xa,_0x3b2b96)-0x1;return util[_0x7080('0x15')]('%s',_[_0x7080('0x89')](_0x57ef79,_0x52b4fb,_[_0x7080('0x8a')](_0xc4e7a2,_0x596341)));};exports['extractCalleridName']=function(_0x3b6778){var _0x2710aa=_0x3b6778['match'](/"(.*?)"/);return _0x2710aa?_0x2710aa[0x1]:_0x3b6778;};exports[_0x7080('0x8b')]=function(_0x1a0f4a){var _0x9415dc=_0x1a0f4a['match'](/<(.*?)>/);return _0x9415dc?_0x9415dc[0x1]:_0x1a0f4a;}; \ No newline at end of file +var _0x801e=['membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','loggerError','logger2','info','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','responsetime','logLookAgent'];(function(_0x5cf3d7,_0x26611b){var _0x318db5=function(_0x18bc6a){while(--_0x18bc6a){_0x5cf3d7['push'](_0x5cf3d7['shift']());}};_0x318db5(++_0x26611b);}(_0x801e,0xeb));var _0xe801=function(_0x15ff62,_0x16dd01){_0x15ff62=_0x15ff62-0x0;var _0x1ef2b3=_0x801e[_0x15ff62];return _0x1ef2b3;};'use strict';var util=require(_0xe801('0x0'));var _=require(_0xe801('0x1'));var moment=require(_0xe801('0x2'));var logger=require(_0xe801('0x3'))(_0xe801('0x4'));var ipAgi=process[_0xe801('0x5')][_0xe801('0x6')]||_0xe801('0x7');function getSeconds(_0x57843d,_0x584c0e){var _0x19e11c=moment(_0x57843d)[_0xe801('0x8')](0x0);var _0x1fd14a=moment(_0x584c0e)['milliseconds'](0x0);return _0x19e11c[_0xe801('0x9')](_0x1fd14a,_0xe801('0xa'));}exports[_0xe801('0xb')]=function(_0x9d66af){return function(_0x3a4f76){logger[_0xe801('0xc')](_0x9d66af,util[_0xe801('0xd')](_0x3a4f76,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x25a1a1,_0x7f1b96){logger['info'](_0x25a1a1,util[_0xe801('0xd')](_0x7f1b96,{'showHidden':![],'depth':null}));};exports[_0xe801('0xe')]=function(_0x11d3bc,_0xe6a0cf){logger[_0xe801('0xc')](_0x11d3bc,util[_0xe801('0xd')](_0xe6a0cf,{'showHidden':![],'depth':null}));};exports[_0xe801('0xf')]=function(_0x593e9b){return function(_0x5c38bc){logger[_0xe801('0x10')](_0x593e9b,util[_0xe801('0xd')](_0x5c38bc,{'showHidden':![],'depth':null}));};};exports[_0xe801('0x11')]=function(_0x3a2145,_0x5b9216,_0x4ae13d){return{'message':_0x3a2145,'unlock':_0x5b9216,'active':_0x4ae13d};};exports['getCallerId']=function(_0x347004,_0xa5a8d2,_0x17ed8e){if(!_[_0xe801('0x12')](_0x17ed8e)&&_0xe801('0x13')===typeof _0x17ed8e&&!_['isEmpty'](_0x17ed8e)){if(!_[_0xe801('0x12')](_0xa5a8d2)&&_0xe801('0x13')===typeof _0xa5a8d2&&!_[_0xe801('0x14')](_0xa5a8d2)){return util[_0xe801('0x15')](_0xe801('0x16'),_0xa5a8d2,_0x17ed8e);}return util['format'](_0xe801('0x16'),_0x17ed8e,_0x17ed8e);}if(!_[_0xe801('0x12')](_0x347004)&&_0xe801('0x13')===typeof _0x347004&&!_[_0xe801('0x14')](_0x347004)){return _0x347004;}return _0xe801('0x17');};exports['isActive']=function(_0x4ebe7d){if(_['isNil'](_0x4ebe7d)){return![];}return _0x4ebe7d;};exports[_0xe801('0x18')]=function(_0x532a89,_0x1c1605,_0x4f7b40,_0x517303,_0x207b82,_0x58054d){var _0x5a538d={'XMD-QUEUE':_0x1c1605['Queue']?_0x1c1605['Queue']['name']:'','XMD-CALLERID':_0x517303,'XMD-CALLERID-PREVIEW':_0x58054d?util[_0xe801('0x15')](_0xe801('0x16'),_0x58054d[_0xe801('0x19')],_0x58054d[_0xe801('0x1a')]):_0x517303,'XMD-DIALID':_0x207b82,'XMD-CONTACTID':_0x1c1605['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x517303,'XMD-VOICEQUEUEID':_0x1c1605[_0xe801('0x1b')],'XMD-DIALCHANNEL':_0x4f7b40,'XMD-DIALTIMEOUT':_0x532a89[_0xe801('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xe801('0x15')](_0xe801('0x1d'),_0x532a89[_0xe801('0x1e')]?'g':'',_['isEmpty'](_0x532a89[_0xe801('0x1f')])?'':_0xe801('0x20')),'XMD-DIALURL':_0x532a89[_0xe801('0x21')]||'','XMD-AGI':_0x532a89[_0xe801('0x22')]?util['format'](_0xe801('0x23'),ipAgi,_0x532a89['dialQueueProject']):_0xe801('0x24'),'XMD-AGIAFTER':_0x532a89[_0xe801('0x1e')]?util[_0xe801('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x532a89[_0xe801('0x1e')]):_0xe801('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x58054d?_0x58054d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x58054d?_0x58054d[_0xe801('0x25')]:'','XMD-DESTINATION':_0xe801('0x26')};if(!_[_0xe801('0x14')](_0x532a89[_0xe801('0x1f')])){_0x5a538d[util[_0xe801('0x15')]('%s',_0xe801('0x27'))]=_0x532a89[_0xe801('0x1f')];_0x5a538d[util[_0xe801('0x15')]('%s',_0xe801('0x28'))]=_0x207b82;}if(_0x1c1605&&_0x1c1605[_0xe801('0x29')]){for(var _0x20ce71 in _0x1c1605[_0xe801('0x29')]){if(_0x1c1605['Contact'][_0xe801('0x2a')](_0x20ce71)){if(!_['isNil'](_0x1c1605[_0xe801('0x29')][_0x20ce71])&&_0x20ce71!=='id'&&_0x20ce71!==_0xe801('0x2b')&&_0x20ce71!=='createdAt'&&_0x20ce71!==_0xe801('0x2c')){_0x5a538d[util[_0xe801('0x15')](_0xe801('0x2d'),_0xe801('0x2e'),_[_0xe801('0x2f')](_0x20ce71))]=_0x1c1605[_0xe801('0x29')][_0x20ce71];}}}}return _0x5a538d;};exports[_0xe801('0x30')]=function(_0x10cd21){var _0x587310={};for(var _0x79a7d4 in _0x10cd21){if(_0x10cd21['hasOwnProperty'](_0x79a7d4)){_0x587310[util[_0xe801('0x15')]('%s',_[_0xe801('0x31')](_0x79a7d4))]=_0x10cd21[_0x79a7d4];}}return{'variables':_0x587310};};exports['updateOriginated']=function(_0x137d30,_0x57f9c5){if(!_['isNil'](_0x137d30)){if(_0x137d30[_0xe801('0x2a')](_0xe801('0x32'))){if(_0x137d30[_0xe801('0x32')]>0x0){_0x137d30[_0xe801('0x32')]-=0x1;}else{logger[_0xe801('0xc')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x57f9c5);}}}else{logger['error'](_0xe801('0x33'),_0x57f9c5);}};exports[_0xe801('0x34')]=function(_0x383cc6){var _0x16c2d7=moment()[_0xe801('0x15')](_0xe801('0x35'));_0x383cc6[_0xe801('0x36')]=0xd;_0x383cc6[_0xe801('0x37')]=_0xe801('0x38');_0x383cc6[_0xe801('0x39')]=_0x16c2d7;_0x383cc6['responsetime']=_0x16c2d7;_0x383cc6[_0xe801('0x3a')]=_0x16c2d7;};exports[_0xe801('0x3b')]=function(_0x326bf7,_0x2a8d09,_0x2736ca){var _0x4a6d5a=moment()[_0xe801('0x15')](_0xe801('0x35'));_0x326bf7[_0xe801('0x36')]=_0x2a8d09;_0x326bf7['statedesc']=_0x2736ca;_0x326bf7['responsetime']=_0x4a6d5a;_0x326bf7[_0xe801('0x3c')]=getSeconds(_0x326bf7[_0xe801('0x3d')],_0x326bf7[_0xe801('0x39')]);};exports[_0xe801('0x3e')]=function(_0x5bed06,_0x200a02,_0x114c9d){_0x5bed06[_0xe801('0x3f')]=_0x200a02;_0x5bed06[_0xe801('0x40')]=_0x114c9d;};exports[_0xe801('0x41')]=function(_0x4ee7e2,_0x1a7994,_0xbd2003){var _0x592526=moment()[_0xe801('0x15')](_0xe801('0x35'));_0x4ee7e2[_0xe801('0x36')]=_0x1a7994;_0x4ee7e2['statedesc']=_0xbd2003;_0x4ee7e2['responsetime']=_0x4ee7e2[_0xe801('0x3d')]?_0x4ee7e2[_0xe801('0x3d')]:_0x592526;_0x4ee7e2[_0xe801('0x3a')]=_0x4ee7e2[_0xe801('0x3a')]?_0x4ee7e2[_0xe801('0x3a')]:_0x592526;_0x4ee7e2[_0xe801('0x3c')]=getSeconds(_0x4ee7e2[_0xe801('0x3d')]||0x0,_0x4ee7e2[_0xe801('0x39')]||0x0);_0x4ee7e2[_0xe801('0x42')]=_0x4ee7e2[_0xe801('0x43')]?getSeconds(_0x4ee7e2[_0xe801('0x3a')],_0x4ee7e2[_0xe801('0x43')]):0x0;};exports[_0xe801('0x44')]=function(_0x115bb3){return _0x115bb3===_0xe801('0x45');};exports[_0xe801('0x46')]=function(_0x54afbb,_0x426c2e,_0x328d82,_0xdc4395,_0x3c8805){var _0x3d1f3e=_0xdc4395?_0xe801('0x47'):_0x54afbb['calleridname'];_0x3d1f3e=_0x3c8805?_0xe801('0x48'):_0x3d1f3e;return{'actionid':_0x54afbb['uniqueid'],'action':_0xe801('0x49'),'channel':_0x54afbb[_0xe801('0x4a')],'callerid':util[_0xe801('0x15')](_0xe801('0x16'),_0x3d1f3e,_0x54afbb[_0xe801('0x1a')]),'Exten':_0xe801('0x26'),'Context':_0xe801('0x4b'),'Priority':'1','variable':_0x328d82,'timeout':(_0x426c2e[_0xe801('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x54afbb[_0xe801('0x4d')]};};exports[_0xe801('0x4e')]=function(_0x3ccae1){return _0x3ccae1[_0xe801('0x4f')]+_0x3ccae1[_0xe801('0x50')]+_0x3ccae1[_0xe801('0x51')]+_0x3ccae1[_0xe801('0x52')]+_0x3ccae1[_0xe801('0x53')];};exports[_0xe801('0x54')]=function(_0x3b5a3e){var _0x2fe877=_[_0xe801('0x55')](_0x3b5a3e);_0x2fe877[_0xe801('0x36')]=0xf;_0x2fe877[_0xe801('0x37')]=_0xe801('0x56');return _0x2fe877;};exports[_0xe801('0x57')]=function(_0x47b0a8,_0x5cb229,_0x2911d8){var _0x3f8430={};_0x3f8430[_0x5cb229]=_0x47b0a8[_0x5cb229];_0x3f8430[_0xe801('0x58')]=![];_0x3f8430[_0xe801('0x59')]=moment()[_0xe801('0x5a')](_0x2911d8,_0xe801('0x5b'))['format'](_0xe801('0x35'));_0x3f8430[_0xe801('0x5c')]=_0x47b0a8[_0xe801('0x5c')];_0x3f8430[_0xe801('0x5d')]=_0x47b0a8[_0xe801('0x5d')];_0x3f8430[_0xe801('0x1b')]=_0x47b0a8[_0xe801('0x1b')]||undefined;return _0x3f8430;};exports[_0xe801('0x5e')]=function(_0xd25622,_0xe01290){if(!_[_0xe801('0x5f')](_0xd25622)){if(_0xd25622[_0xe801('0x60')]>0x0){_0xd25622[_0xe801('0x60')]-=0x1;}else{logger[_0xe801('0xc')](_0xe01290,_0xe801('0x61'));}}else{logger[_0xe801('0xc')](_0xe01290,_0xe801('0x62'));}};exports['IsNotLoggedIn']=function(_0x201487){if(_0x201487<=0x0){return!![];}return![];};exports['buildObj']=function(_0xcf7187,_0x1a6ef3,_0x3446f3){_0xcf7187[_0xe801('0x63')]=_0x1a6ef3;_0xcf7187[_0xe801('0x64')]=_0xcf7187[_0xe801('0x65')];_0xcf7187[_0xe801('0x66')]=_0xcf7187['channelAgent'];if(_0x3446f3){_0xcf7187[_0xe801('0x67')]=_0x3446f3[_0xe801('0x67')];}return _0xcf7187;};exports[_0xe801('0x68')]=function(_0x5c2240){var _0x464f0c={};_0x464f0c[_0xe801('0x65')]=_0x5c2240[_0xe801('0x65')];_0x464f0c['interface']=_0x5c2240[_0xe801('0x4a')];_0x464f0c[_0xe801('0x4d')]=_0x5c2240['uniqueid'];return _0x464f0c;};exports[_0xe801('0x69')]=function(_0x2eac24){var _0x597a7c=[];for(var _0x5793be in _0x2eac24){if(_0x2eac24[_0xe801('0x2a')](_0x5793be)){if(!_[_0xe801('0x5f')](_0x2eac24[_0x5793be])&&_0x2eac24[_0x5793be][_0xe801('0x36')]===_0xe801('0x6a')&&_0x2eac24[_0x5793be][_0xe801('0x6b')]===_0xe801('0x6c')){_0x597a7c[_0xe801('0x6d')](_0x2eac24[_0x5793be]['id']);}}}return _0x597a7c;};exports['getDiff']=function(_0xed4b1d){var _0xabc3a5=moment()['milliseconds'](0x0);var _0x5b67c2=moment(_0xed4b1d)['milliseconds'](0x0);return _0xabc3a5[_0xe801('0x9')](_0x5b67c2,_0xe801('0xa'));};exports[_0xe801('0x6e')]=function(_0x1ac1fd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1ac1fd[_0xe801('0x5c')],'ListId':_0x1ac1fd[_0xe801('0x5d')],'VoiceQueueId':_0x1ac1fd[_0xe801('0x1b')]||undefined,'CampaignId':_0x1ac1fd['CampaignId']||undefined};};exports[_0xe801('0x6f')]=function(_0x268823){if(_0x268823===_0xe801('0x4d')||_0x268823===_0xe801('0x70')||_0x268823==='queue'||_0x268823===_0xe801('0x71')||_0x268823===_0xe801('0x72')||_0x268823===_0xe801('0x73')||_0x268823===_0xe801('0x3f')||_0x268823===_0xe801('0x4a')||_0x268823===_0xe801('0x19')||_0x268823===_0xe801('0x58')||_0x268823==='calleridnum'||_0x268823===_0xe801('0x59')||_0x268823===_0xe801('0x4f')||_0x268823===_0xe801('0x50')||_0x268823==='countnoanswerretry'||_0x268823===_0xe801('0x74')||_0x268823===_0xe801('0x75')||_0x268823===_0xe801('0x76')||_0x268823===_0xe801('0x77')||_0x268823===_0xe801('0x78')||_0x268823===_0xe801('0x5c')||_0x268823==='ListId'||_0x268823===_0xe801('0x40')||_0x268823===_0xe801('0x1b')||_0x268823===_0xe801('0x79')||_0x268823===_0xe801('0x7a')||_0x268823===_0xe801('0x7b')||_0x268823===_0xe801('0x7c')||_0x268823===_0xe801('0x7d')||_0x268823==='xmd-dialurl'||_0x268823===_0xe801('0x7e')||_0x268823===_0xe801('0x7f')||_0x268823===_0xe801('0x80')||_0x268823==='xmd-dialchannel'||_0x268823===_0xe801('0x81')||_0x268823===_0xe801('0x82')||_0x268823===_0xe801('0x83')||_0x268823==='xmd-agiafter'||_0x268823===_0xe801('0x84')||_0x268823===_0xe801('0x85')||_0x268823===_0xe801('0x86')||_0x268823===_0xe801('0x87')||_0x268823===_0xe801('0x88')||_0x268823===_0xe801('0x89')||_0x268823===_0xe801('0x8a')||_0x268823===_0xe801('0x8b')||_0x268823===_0xe801('0x8c')||_0x268823===_0xe801('0x85')||_0x268823===_0xe801('0x86')||_0x268823===_0xe801('0x87')||_0x268823===_0xe801('0x88')||_0x268823==='rtpaudioqosloss'||_0x268823===_0xe801('0x8a')||_0x268823===_0xe801('0x8b')||_0x268823===_0xe801('0x8c')||_0x268823==='bridgepeer'||_0x268823===_0xe801('0x8d')||_0x268823===_0xe801('0x36')||_0x268823===_0xe801('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x49e87b,_0x41636b){var _0x107cc2,_0x17f1ea,_0x2a8428;if(_0x41636b<=0x0){_0x41636b=0x1;}_0x107cc2=new RegExp(_0xe801('0x8e')+_0x41636b+'}$');_0x17f1ea=Math[_0xe801('0x8f')](0xa,_0x41636b-0x1);_0x2a8428=Math[_0xe801('0x8f')](0xa,_0x41636b)-0x1;return util[_0xe801('0x15')]('%s',_[_0xe801('0x90')](_0x49e87b,_0x107cc2,_[_0xe801('0x91')](_0x17f1ea,_0x2a8428)));};exports[_0xe801('0x92')]=function(_0x8f7234){var _0x5647ce=_0x8f7234[_0xe801('0x93')](/"(.*?)"/);return _0x5647ce?_0x5647ce[0x1]:_0x8f7234;};exports[_0xe801('0x94')]=function(_0x5480fc){var _0x374421=_0x5480fc[_0xe801('0x93')](/<(.*?)>/);return _0x374421?_0x374421[0x1]:_0x5480fc;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 75a8896..fc51aa1 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x22e7ee,_0xd43e98){var _0xbf4677=function(_0x52d1ab){while(--_0x52d1ab){_0x22e7ee['push'](_0x22e7ee['shift']());}};_0xbf4677(++_0xd43e98);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4d4326,_0x12cbaa){_0x4d4326=_0x4d4326-0x0;var _0x47266e=_0x5f2f[_0x4d4326];return _0x47266e;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x1a5ee6,_0x51e702){var _0x29af54=function(_0x46d8c4){while(--_0x46d8c4){_0x1a5ee6['push'](_0x1a5ee6['shift']());}};_0x29af54(++_0x51e702);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa5e00c,_0x8b79e6){_0xa5e00c=_0xa5e00c-0x0;var _0x764ee7=_0x5f2f[_0xa5e00c];return _0x764ee7;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d8ce13b..a767a6b 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','name','isUndefined','initTelephones','telephones','length','initTrunks','initTriggers','initTemplates','initFreshdeskAccounts','freshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','SIP/%s','hasOwnProperty','isNil','interface','format'];(function(_0x57ec65,_0x7ad428){var _0x5ca022=function(_0xdc4844){while(--_0xdc4844){_0x57ec65['push'](_0x57ec65['shift']());}};_0x5ca022(++_0x7ad428);}(_0xe14d,0x1ee));var _0xde14=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xe14d[_0x3635ce];return _0x97ecd0;};'use strict';var BPromise=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var _=require(_0xde14('0x2'));var moment=require(_0xde14('0x3'));var Agent=require('../model/agent');var Telephone=require(_0xde14('0x4'));var Trunk=require(_0xde14('0x5'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xde14('0x6'));var Template=require(_0xde14('0x7'));var Campaign=require(_0xde14('0x8'));var VoiceExtension=require(_0xde14('0x9'));var ZendeskAccount=require(_0xde14('0xa'));var SalesforceAccount=require(_0xde14('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xde14('0xc'));var DeskAccount=require(_0xde14('0xd'));var VtigerAccount=require(_0xde14('0xe'));var ServicenowAccount=require(_0xde14('0xf'));var Dynamics365Account=require(_0xde14('0x10'));var FreshsalesAccount=require(_0xde14('0x11'));var FaxAccount=require(_0xde14('0x12'));var Realtime=function(){this[_0xde14('0x13')]={};this['telephones']={};this[_0xde14('0x14')]={};this[_0xde14('0x15')]={};this[_0xde14('0x16')]={};this[_0xde14('0x17')]={};this[_0xde14('0x18')]={};this[_0xde14('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xde14('0x1a')]={};this[_0xde14('0x1b')]={};this[_0xde14('0x1c')]={};this[_0xde14('0x1d')]={};this[_0xde14('0x1e')]={};this[_0xde14('0x1f')]={};this[_0xde14('0x20')]={};this[_0xde14('0x21')]={};this[_0xde14('0x22')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0xde14('0x23')]={};this[_0xde14('0x24')]={};this[_0xde14('0x25')]={};this['dynamics365Accounts']={};this[_0xde14('0x26')]={};this[_0xde14('0x27')]={};};function freeIsNotKey(_0x257390,_0x31902a,_0x3de959){var _0x1b9d4b=_[_0xde14('0x28')](_0x257390,function(_0x6f6eea,_0x3cc317){return _0x6f6eea[_0x3de959];});for(var _0x10c4ab in _0x31902a){if(_0x31902a['hasOwnProperty'](_0x10c4ab)){if(!_0x1b9d4b[_0x10c4ab]){delete _0x31902a[_0x10c4ab];}}}}function freeIsNotKeySip(_0x3f5fcf,_0x3bfc59){var _0x2eb8a8=_[_0xde14('0x28')](_0x3f5fcf,function(_0x4ce69f,_0x394de7){return util['format'](_0xde14('0x29'),_0x4ce69f['name']);});for(var _0xa50687 in _0x3bfc59){if(_0x3bfc59[_0xde14('0x2a')](_0xa50687)){if(!_0x2eb8a8[_0xa50687]){delete _0x3bfc59[_0xa50687];}}}}function freeIsNotKeyAgent(_0x51ee8d,_0x1949ab){var _0x39bdc5=_[_0xde14('0x28')](_0x51ee8d,function(_0x40b648,_0x2dd9e7){var _0xdd8d59=_[_0xde14('0x2b')](_0x40b648[_0xde14('0x2c')])?util[_0xde14('0x2d')](_0xde14('0x29'),_0x40b648['name']):_0x40b648[_0xde14('0x2c')];return _0xdd8d59;});for(var _0x3ce77c in _0x1949ab){if(_0x1949ab[_0xde14('0x2a')](_0x3ce77c)){if(!_0x39bdc5[_0x3ce77c]){delete _0x1949ab[_0x3ce77c];}}}}function clearVoiceCallReports(_0xbd05d6){_0xbd05d6[_0xde14('0x2e')]=0x0;_0xbd05d6[_0xde14('0x2f')]=0x0;_0xbd05d6[_0xde14('0x30')]=0x0;_0xbd05d6[_0xde14('0x31')]=0x0;_0xbd05d6[_0xde14('0x32')]=0x0;}function clearCampaigns(_0x350a78){if(!_['isEmpty'](_0x350a78)){for(var _0x309922 in _0x350a78){if(_0x350a78[_0xde14('0x2a')](_0x309922)){_0x350a78[_0x309922][_0xde14('0x33')]=0x0;_0x350a78[_0x309922][_0xde14('0x34')]=0x0;}}}}function clearVoiceQueues(_0x5d8b4b){if(!_[_0xde14('0x35')](_0x5d8b4b)){for(var _0x2c9822 in _0x5d8b4b){if(_0x5d8b4b[_0xde14('0x2a')](_0x2c9822)){_0x5d8b4b[_0x2c9822]['total']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x2f')]=0x0;_0x5d8b4b[_0x2c9822]['unmanaged']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x36')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x30')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x31')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x32')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x37')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x38')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x39')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3a')]=0x0;_0x5d8b4b[_0x2c9822]['outboundNoSuchCallsDay']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3b')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3c')]=0x0;_0x5d8b4b[_0x2c9822]['outboundDropCallsDayCallersExit']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3d')]=0x0;_0x5d8b4b[_0x2c9822]['outboundOriginateFailureCallsDay']=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3e')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x3f')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x37')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x40')]=0x0;_0x5d8b4b[_0x2c9822][_0xde14('0x41')]=!![];}}}}Realtime['prototype'][_0xde14('0x42')]=function(_0x57b98b,_0x4d4295){for(var _0x280238 in _0x4d4295){if(_0x57b98b[_0xde14('0x2a')](_0x280238)){_0x57b98b[_0x280238]=_0x4d4295[_0x280238];}}};Realtime[_0xde14('0x43')][_0xde14('0x44')]=function(){var _0x2713fb=this;return function(_0xa41c1e){if(_0xa41c1e){freeIsNotKeyAgent(_0xa41c1e,_0x2713fb[_0xde14('0x13')]);for(var _0x32fe83=0x0,_0x33c361={},_0x48d587={};_0x32fe83<_0xa41c1e['length'];_0x32fe83+=0x1){_0x33c361=_0xa41c1e[_0x32fe83];var _0x1c7136=_[_0xde14('0x2b')](_0x33c361[_0xde14('0x2c')])?util[_0xde14('0x2d')](_0xde14('0x29'),_0x33c361[_0xde14('0x45')]):_0x33c361[_0xde14('0x2c')];if(_[_0xde14('0x46')](_0x2713fb[_0xde14('0x13')][_0x1c7136])){_0x2713fb['agents'][_0x1c7136]=new Agent(_0x33c361);}else{_0x2713fb[_0xde14('0x42')](_0x2713fb['agents'][_0x1c7136],_0x33c361);}}}return _0x2713fb['agents'];};};Realtime['prototype'][_0xde14('0x47')]=function(){var _0x258759=this;return function(_0x398f63){if(_0x398f63){freeIsNotKeySip(_0x398f63,_0x258759[_0xde14('0x48')]);for(var _0x1228d8=0x0,_0x8b5bb4={},_0x1e89b6={};_0x1228d8<_0x398f63[_0xde14('0x49')];_0x1228d8+=0x1){_0x8b5bb4=_0x398f63[_0x1228d8];if(_['isUndefined'](_0x258759[_0xde14('0x48')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x8b5bb4[_0xde14('0x45')])])){_0x258759[_0xde14('0x48')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x8b5bb4[_0xde14('0x45')])]=new Telephone(_0x8b5bb4);}else{_0x258759['mergeFromDatabase'](_0x258759[_0xde14('0x48')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x8b5bb4[_0xde14('0x45')])],_0x8b5bb4);}}}return _0x258759['telephones'];};};Realtime['prototype'][_0xde14('0x4a')]=function(){var _0x16e7d1=this;return function(_0xff1bbd){if(_0xff1bbd){freeIsNotKeySip(_0xff1bbd,_0x16e7d1[_0xde14('0x14')]);for(var _0x401f7e=0x0,_0x4c66bc={},_0x24b02c={};_0x401f7e<_0xff1bbd[_0xde14('0x49')];_0x401f7e+=0x1){_0x4c66bc=_0xff1bbd[_0x401f7e];if(_[_0xde14('0x46')](_0x16e7d1['trunks'][util[_0xde14('0x2d')]('SIP/%s',_0x4c66bc[_0xde14('0x45')])])){_0x16e7d1['trunks'][util[_0xde14('0x2d')](_0xde14('0x29'),_0x4c66bc[_0xde14('0x45')])]=new Trunk(_0x4c66bc);}else{_0x16e7d1[_0xde14('0x42')](_0x16e7d1[_0xde14('0x14')][util[_0xde14('0x2d')](_0xde14('0x29'),_0x4c66bc[_0xde14('0x45')])],_0x4c66bc);}}}return _0x16e7d1['trunks'];};};Realtime[_0xde14('0x43')]['initVoiceQueues']=function(){var _0x430b22=this;return function(_0x5ac3f3){if(_0x5ac3f3){freeIsNotKey(_0x5ac3f3,_0x430b22[_0xde14('0x15')],_0xde14('0x45'));for(var _0x437466=0x0,_0x2283b7={},_0x40e7ae={};_0x437466<_0x5ac3f3[_0xde14('0x49')];_0x437466+=0x1){_0x2283b7=_0x5ac3f3[_0x437466];if(_[_0xde14('0x46')](_0x430b22[_0xde14('0x15')][_0x2283b7['name']])){_0x430b22[_0xde14('0x15')][_0x2283b7[_0xde14('0x45')]]=new VoiceQueue(_0x2283b7);}else{_0x430b22[_0xde14('0x42')](_0x430b22[_0xde14('0x15')][_0x2283b7['name']],_0x2283b7);}}}return _0x430b22[_0xde14('0x15')];};};Realtime[_0xde14('0x43')][_0xde14('0x4b')]=function(){var _0xdbdab8=this;return function(_0x39572b){if(_0x39572b){freeIsNotKey(_0x39572b,_0xdbdab8[_0xde14('0x16')],'id');for(var _0x5b5eb5=0x0,_0x26ec08={},_0x518426={};_0x5b5eb5<_0x39572b[_0xde14('0x49')];_0x5b5eb5+=0x1){_0x26ec08=_0x39572b[_0x5b5eb5];if(_[_0xde14('0x46')](_0xdbdab8['triggers'][_0x26ec08['id']])){_0xdbdab8[_0xde14('0x16')][_0x26ec08['id']]=new Trigger(_0x26ec08);}else{_0xdbdab8[_0xde14('0x42')](_0xdbdab8[_0xde14('0x16')][_0x26ec08['id']],_0x26ec08);}}}return _0xdbdab8[_0xde14('0x16')];};};Realtime[_0xde14('0x43')][_0xde14('0x4c')]=function(){var _0x45fa7e=this;return function(_0x51f35f){if(_0x51f35f){freeIsNotKey(_0x51f35f,_0x45fa7e[_0xde14('0x18')],'id');for(var _0x4ffc8c=0x0,_0xfa80c8={},_0x6aa9ab={};_0x4ffc8c<_0x51f35f[_0xde14('0x49')];_0x4ffc8c+=0x1){_0xfa80c8=_0x51f35f[_0x4ffc8c];if(_[_0xde14('0x46')](_0x45fa7e[_0xde14('0x18')][_0xfa80c8['id']])){_0x45fa7e[_0xde14('0x18')][_0xfa80c8['id']]=new Template(_0xfa80c8);}else{_0x45fa7e[_0xde14('0x42')](_0x45fa7e[_0xde14('0x18')][_0xfa80c8['id']],_0xfa80c8);}}}return _0x45fa7e[_0xde14('0x18')];};};Realtime[_0xde14('0x43')]['initZendeskAccounts']=function(){var _0xd37eb6=this;return function(_0x1688c6){if(_0x1688c6){freeIsNotKey(_0x1688c6,_0xd37eb6[_0xde14('0x20')],'id');for(var _0x38d50a=0x0,_0x14b781={},_0x4874ed={};_0x38d50a<_0x1688c6[_0xde14('0x49')];_0x38d50a+=0x1){_0x14b781=_0x1688c6[_0x38d50a];if(_['isUndefined'](_0xd37eb6[_0xde14('0x20')][_0x14b781['id']])){_0xd37eb6[_0xde14('0x20')][_0x14b781['id']]=new ZendeskAccount(_0x14b781);}else{_0xd37eb6[_0xde14('0x42')](_0xd37eb6[_0xde14('0x20')][_0x14b781['id']],_0x14b781);}}}return _0xd37eb6[_0xde14('0x20')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x435964=this;return function(_0x56c3fe){if(_0x56c3fe){freeIsNotKey(_0x56c3fe,_0x435964[_0xde14('0x21')],'id');for(var _0x31111d=0x0,_0x15e2fb={},_0x27c8dd={};_0x31111d<_0x56c3fe[_0xde14('0x49')];_0x31111d+=0x1){_0x15e2fb=_0x56c3fe[_0x31111d];if(_[_0xde14('0x46')](_0x435964[_0xde14('0x21')][_0x15e2fb['id']])){_0x435964[_0xde14('0x21')][_0x15e2fb['id']]=new SalesforceAccount(_0x15e2fb);}else{_0x435964[_0xde14('0x42')](_0x435964['salesforceAccounts'][_0x15e2fb['id']],_0x15e2fb);}}}return _0x435964[_0xde14('0x21')];};};Realtime[_0xde14('0x43')][_0xde14('0x4d')]=function(){var _0x21d226=this;return function(_0x249ccc){if(_0x249ccc){freeIsNotKey(_0x249ccc,_0x21d226['freshdeskAccounts'],'id');for(var _0xb2d69c=0x0,_0x58790d={},_0x6cd665={};_0xb2d69c<_0x249ccc[_0xde14('0x49')];_0xb2d69c+=0x1){_0x58790d=_0x249ccc[_0xb2d69c];if(_[_0xde14('0x46')](_0x21d226[_0xde14('0x4e')][_0x58790d['id']])){_0x21d226[_0xde14('0x4e')][_0x58790d['id']]=new FreshdeskAccount(_0x58790d);}else{_0x21d226[_0xde14('0x42')](_0x21d226[_0xde14('0x4e')][_0x58790d['id']],_0x58790d);}}}return _0x21d226[_0xde14('0x4e')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x593143=this;return function(_0x475671){if(_0x475671){freeIsNotKey(_0x475671,_0x593143['zohoAccounts'],'id');for(var _0x596cd3=0x0,_0xc10000={},_0x20fd21={};_0x596cd3<_0x475671[_0xde14('0x49')];_0x596cd3+=0x1){_0xc10000=_0x475671[_0x596cd3];if(_[_0xde14('0x46')](_0x593143[_0xde14('0x4f')][_0xc10000['id']])){_0x593143[_0xde14('0x4f')][_0xc10000['id']]=new ZohoAccount(_0xc10000);}else{_0x593143[_0xde14('0x42')](_0x593143[_0xde14('0x4f')][_0xc10000['id']],_0xc10000);}}}return _0x593143[_0xde14('0x4f')];};};Realtime['prototype'][_0xde14('0x50')]=function(){var _0x1cfc98=this;return function(_0x2eeeeb){if(_0x2eeeeb){freeIsNotKey(_0x2eeeeb,_0x1cfc98['deskAccounts'],'id');for(var _0x2bd32d=0x0,_0x599adc={},_0xc98b34={};_0x2bd32d<_0x2eeeeb[_0xde14('0x49')];_0x2bd32d+=0x1){_0x599adc=_0x2eeeeb[_0x2bd32d];if(_[_0xde14('0x46')](_0x1cfc98[_0xde14('0x23')][_0x599adc['id']])){_0x1cfc98[_0xde14('0x23')][_0x599adc['id']]=new DeskAccount(_0x599adc);}else{_0x1cfc98[_0xde14('0x42')](_0x1cfc98[_0xde14('0x23')][_0x599adc['id']],_0x599adc);}}}return _0x1cfc98['deskAccounts'];};};Realtime[_0xde14('0x43')][_0xde14('0x51')]=function(){var _0x1a0bb1=this;return function(_0x40fcda){if(_0x40fcda){freeIsNotKey(_0x40fcda,_0x1a0bb1[_0xde14('0x22')],'id');for(var _0x70a2e1=0x0,_0x439118={},_0x4cdf99={};_0x70a2e1<_0x40fcda['length'];_0x70a2e1+=0x1){_0x439118=_0x40fcda[_0x70a2e1];if(_[_0xde14('0x46')](_0x1a0bb1[_0xde14('0x22')][_0x439118['id']])){_0x1a0bb1[_0xde14('0x22')][_0x439118['id']]=new SugarcrmAccount(_0x439118);}else{_0x1a0bb1['mergeFromDatabase'](_0x1a0bb1[_0xde14('0x22')][_0x439118['id']],_0x439118);}}}return _0x1a0bb1[_0xde14('0x22')];};};Realtime[_0xde14('0x43')][_0xde14('0x52')]=function(){var _0x51e8ca=this;return function(_0x567180){if(_0x567180){freeIsNotKey(_0x567180,_0x51e8ca[_0xde14('0x24')],'id');for(var _0x3dcda8=0x0,_0x30f228={},_0x329be2={};_0x3dcda8<_0x567180[_0xde14('0x49')];_0x3dcda8+=0x1){_0x30f228=_0x567180[_0x3dcda8];if(_[_0xde14('0x46')](_0x51e8ca[_0xde14('0x24')][_0x30f228['id']])){_0x51e8ca[_0xde14('0x24')][_0x30f228['id']]=new VtigerAccount(_0x30f228);}else{_0x51e8ca[_0xde14('0x42')](_0x51e8ca[_0xde14('0x24')][_0x30f228['id']],_0x30f228);}}}return _0x51e8ca[_0xde14('0x24')];};};Realtime[_0xde14('0x43')][_0xde14('0x53')]=function(){var _0x42329a=this;return function(_0x6a641f){if(_0x6a641f){freeIsNotKey(_0x6a641f,_0x42329a[_0xde14('0x25')],'id');for(var _0x2656c7=0x0,_0x31ebbd={},_0x439a51={};_0x2656c7<_0x6a641f[_0xde14('0x49')];_0x2656c7+=0x1){_0x31ebbd=_0x6a641f[_0x2656c7];if(_[_0xde14('0x46')](_0x42329a[_0xde14('0x25')][_0x31ebbd['id']])){_0x42329a[_0xde14('0x25')][_0x31ebbd['id']]=new ServicenowAccount(_0x31ebbd);}else{_0x42329a['mergeFromDatabase'](_0x42329a[_0xde14('0x25')][_0x31ebbd['id']],_0x31ebbd);}}}return _0x42329a['servicenowAccounts'];};};Realtime[_0xde14('0x43')]['initDynamics365Accounts']=function(){var _0x3bbbab=this;return function(_0xfa9c8d){if(_0xfa9c8d){freeIsNotKey(_0xfa9c8d,_0x3bbbab[_0xde14('0x54')],'id');for(var _0x5506e1=0x0,_0x5e16e2={},_0x23d3e1={};_0x5506e1<_0xfa9c8d[_0xde14('0x49')];_0x5506e1+=0x1){_0x5e16e2=_0xfa9c8d[_0x5506e1];if(_[_0xde14('0x46')](_0x3bbbab[_0xde14('0x54')][_0x5e16e2['id']])){_0x3bbbab['dynamics365Accounts'][_0x5e16e2['id']]=new Dynamics365Account(_0x5e16e2);}else{_0x3bbbab[_0xde14('0x42')](_0x3bbbab[_0xde14('0x54')][_0x5e16e2['id']],_0x5e16e2);}}}return _0x3bbbab[_0xde14('0x54')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x49dc83=this;return function(_0x58ccb4){if(_0x58ccb4){freeIsNotKey(_0x58ccb4,_0x49dc83[_0xde14('0x26')],'id');for(var _0x30f0f0=0x0,_0x20cee9={},_0x5b1a32={};_0x30f0f0<_0x58ccb4[_0xde14('0x49')];_0x30f0f0+=0x1){_0x20cee9=_0x58ccb4[_0x30f0f0];if(_[_0xde14('0x46')](_0x49dc83[_0xde14('0x26')][_0x20cee9['id']])){_0x49dc83[_0xde14('0x26')][_0x20cee9['id']]=new FreshsalesAccount(_0x20cee9);}else{_0x49dc83[_0xde14('0x42')](_0x49dc83[_0xde14('0x26')][_0x20cee9['id']],_0x20cee9);}}}return _0x49dc83['freshsalesAccounts'];};};Realtime['prototype'][_0xde14('0x55')]=function(){var _0x4474c2=this;return function(_0x54aaa2){for(var _0x103766=0x0;_0x103766<_0x54aaa2[_0xde14('0x49')];_0x103766+=0x1){_[_0xde14('0x56')](_0x4474c2[_0xde14('0x15')][_0x54aaa2[_0x103766][_0xde14('0x45')]],_0x54aaa2[_0x103766]);}return _0x4474c2[_0xde14('0x15')];};};Realtime[_0xde14('0x43')]['initVoiceQueueReports']=function(){var _0x552889=this;return function(_0x4800bf){clearVoiceQueues(_0x552889['voiceQueues']);if(_0x4800bf){_0x4800bf=_[_0xde14('0x57')](_0x4800bf,_0xde14('0x58'));for(var _0x5baa51 in _0x4800bf){if(_0x4800bf['hasOwnProperty'](_0x5baa51)){var _0x350aa8={};for(var _0x25d9d6=0x0;_0x25d9d6<_0x4800bf[_0x5baa51][_0xde14('0x49')];_0x25d9d6+=0x1){var _0x5805ec=_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x59')];if(_0x552889[_0xde14('0x15')][_0x5805ec]){if(_0x4800bf[_0x5baa51][_0x25d9d6]['queuecallerexit']){_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x5a')]+=0x1;}if(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5b')]){_0x552889[_0xde14('0x15')][_0x5805ec]['abandoned']+=0x1;}_0x552889[_0xde14('0x15')][_0x5805ec]['sumHoldTime']+=moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5c')])[_0xde14('0x5d')](moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5e')]),'seconds')||0x0;if(_0x25d9d6===_0x4800bf[_0x5baa51][_0xde14('0x49')]-0x1){_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x31')]+=moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5f')]||_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x60')]||_0x4800bf[_0x5baa51][_0x25d9d6]['queuecallerexitAt'])['diff'](moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5e')]),_0xde14('0x61'))||0x0;_0x552889[_0xde14('0x15')][_0x5805ec]['total']+=0x1;if(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x62')]){_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x2f')]+=0x1;_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x32')]+=moment(_0x4800bf[_0x5baa51][_0x25d9d6][_0xde14('0x5f')])[_0xde14('0x5d')](moment(_0x4800bf[_0x5baa51][_0x25d9d6]['queuecallerleaveAt']),_0xde14('0x61'))||0x0;}}else{_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x31')]+=_0x552889[_0xde14('0x15')][_0x5805ec][_0xde14('0x30')]||0x0;}}}}}}return _0x552889[_0xde14('0x15')];};};Realtime[_0xde14('0x43')]['initVoiceCallReports']=function(){var _0x26fd01=this;return function(_0x1bdeae){clearVoiceCallReports(_0x26fd01['outbound']);if(_0x1bdeae){for(var _0x4543f1=0x0;_0x4543f1<_0x1bdeae['length'];_0x4543f1+=0x1){_0x26fd01[_0xde14('0x19')]['total']+=0x1;_0x26fd01[_0xde14('0x19')][_0xde14('0x31')]+=_0x1bdeae[_0x4543f1][_0xde14('0x63')];if(_0x1bdeae[_0x4543f1][_0xde14('0x64')]===_0xde14('0x65')){_0x26fd01[_0xde14('0x19')]['answered']+=0x1;_0x26fd01[_0xde14('0x19')][_0xde14('0x30')]+=_0x1bdeae[_0x4543f1][_0xde14('0x63')]-_0x1bdeae[_0x4543f1]['billableseconds']||0x0;_0x26fd01[_0xde14('0x19')][_0xde14('0x32')]+=_0x1bdeae[_0x4543f1][_0xde14('0x66')];}}}return _0x26fd01['outbound'];};};Realtime[_0xde14('0x43')][_0xde14('0x67')]=function(){var _0x4324a4=this;return function(_0x4d12ad){if(_0x4d12ad){freeIsNotKey(_0x4d12ad,_0x4324a4['campaigns'],'name');for(var _0x4ffff1=0x0,_0x381d6d={};_0x4ffff1<_0x4d12ad[_0xde14('0x49')];_0x4ffff1+=0x1){_0x381d6d=_0x4d12ad[_0x4ffff1];if(_['isUndefined'](_0x4324a4[_0xde14('0x17')][_0x381d6d[_0xde14('0x45')]])){_0x4324a4[_0xde14('0x17')][_0x381d6d[_0xde14('0x45')]]=new Campaign(_0x381d6d);}else{_0x4324a4[_0xde14('0x42')](_0x4324a4['campaigns'][_0x381d6d[_0xde14('0x45')]],_0x381d6d);_0x4324a4[_0xde14('0x17')][_0x381d6d[_0xde14('0x45')]][_0xde14('0x68')]=_0x381d6d[_0xde14('0x69')]?_0x381d6d[_0xde14('0x69')][_0xde14('0x45')]:undefined;}}}return _0x4324a4[_0xde14('0x17')];};};Realtime['prototype'][_0xde14('0x6a')]=function(){var _0x3f180b=this;return function(_0xd9a97){if(_0xd9a97){freeIsNotKey(_0xd9a97,_0x3f180b[_0xde14('0x1a')],'id');for(var _0x243e5f=0x0,_0x165cc2={};_0x243e5f<_0xd9a97[_0xde14('0x49')];_0x243e5f+=0x1){_0x165cc2=_0xd9a97[_0x243e5f];if(_[_0xde14('0x46')](_0x3f180b['voiceExtensions'][_0x165cc2['id']])){_0x3f180b[_0xde14('0x1a')][_0x165cc2['id']]=new VoiceExtension(_0x165cc2);}else{_0x3f180b[_0xde14('0x42')](_0x3f180b['voiceExtensions'][_0x165cc2['id']],_0x165cc2);}}}return _0x3f180b[_0xde14('0x1a')];};};Realtime[_0xde14('0x43')][_0xde14('0x6b')]=function(){var _0x381477=this;return function(_0x22909b){clearCampaigns(_0x381477[_0xde14('0x17')]);for(var _0x5c562d=0x0;_0x5c562d<_0x22909b[_0xde14('0x49')];_0x5c562d+=0x1){_[_0xde14('0x56')](_0x381477[_0xde14('0x17')][_0x22909b[_0x5c562d][_0xde14('0x45')]],_0x22909b[_0x5c562d]);}return _0x381477[_0xde14('0x17')];};};Realtime[_0xde14('0x43')]['initFaxAccounts']=function(){var _0x56eb76=this;return function(_0x41b62a){if(_0x41b62a){freeIsNotKey(_0x41b62a,_0x56eb76[_0xde14('0x27')],'id');for(var _0x578044=0x0,_0x2f4f8b={},_0x42d41f={};_0x578044<_0x41b62a[_0xde14('0x49')];_0x578044+=0x1){_0x2f4f8b=_0x41b62a[_0x578044];if(_[_0xde14('0x46')](_0x56eb76[_0xde14('0x27')][_0x2f4f8b['id']])){_0x56eb76[_0xde14('0x27')][_0x2f4f8b['id']]=new FaxAccount(_0x2f4f8b);}else{_0x56eb76[_0xde14('0x42')](_0x56eb76[_0xde14('0x27')][_0x2f4f8b['id']],_0x2f4f8b);}}}return _0x56eb76[_0xde14('0x27')];};};module['exports']=Realtime; \ No newline at end of file +var _0xa41a=['initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','templates','outbound','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','initTrunks','isUndefined','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable','initVoiceCallReports','duration','ANSWERED','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions'];(function(_0x509ab7,_0x194364){var _0x2b8f79=function(_0x9f541f){while(--_0x9f541f){_0x509ab7['push'](_0x509ab7['shift']());}};_0x2b8f79(++_0x194364);}(_0xa41a,0x6b));var _0xaa41=function(_0x3259a2,_0x174b02){_0x3259a2=_0x3259a2-0x0;var _0x314467=_0xa41a[_0x3259a2];return _0x314467;};'use strict';var BPromise=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var _=require('lodash');var moment=require(_0xaa41('0x2'));var Agent=require(_0xaa41('0x3'));var Telephone=require(_0xaa41('0x4'));var Trunk=require(_0xaa41('0x5'));var VoiceQueue=require(_0xaa41('0x6'));var Trigger=require(_0xaa41('0x7'));var Template=require(_0xaa41('0x8'));var Campaign=require(_0xaa41('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xaa41('0xa'));var SalesforceAccount=require(_0xaa41('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xaa41('0xc'));var DeskAccount=require(_0xaa41('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xaa41('0xe'));var Dynamics365Account=require(_0xaa41('0xf'));var FreshsalesAccount=require(_0xaa41('0x10'));var FaxAccount=require(_0xaa41('0x11'));var Realtime=function(){this[_0xaa41('0x12')]={};this[_0xaa41('0x13')]={};this[_0xaa41('0x14')]={};this[_0xaa41('0x15')]={};this[_0xaa41('0x16')]={};this['campaigns']={};this[_0xaa41('0x17')]={};this[_0xaa41('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0xaa41('0x19')]={};this['outboundChannels']={};this[_0xaa41('0x1a')]={};this[_0xaa41('0x1b')]={};this[_0xaa41('0x1c')]={};this[_0xaa41('0x1d')]={};this[_0xaa41('0x1e')]={};this['freshdeskAccounts']={};this[_0xaa41('0x1f')]={};this[_0xaa41('0x20')]={};this[_0xaa41('0x21')]={};this[_0xaa41('0x22')]={};this[_0xaa41('0x23')]={};this[_0xaa41('0x24')]={};this[_0xaa41('0x25')]={};};function freeIsNotKey(_0x550ad5,_0x2d868a,_0x16b930){var _0x4210fa=_[_0xaa41('0x26')](_0x550ad5,function(_0x230a6a,_0xd20ddf){return _0x230a6a[_0x16b930];});for(var _0x29efe5 in _0x2d868a){if(_0x2d868a[_0xaa41('0x27')](_0x29efe5)){if(!_0x4210fa[_0x29efe5]){delete _0x2d868a[_0x29efe5];}}}}function freeIsNotKeySip(_0x150ddf,_0x4fe1a4){var _0x5cd936=_[_0xaa41('0x26')](_0x150ddf,function(_0x22de55,_0x35c753){return util['format'](_0xaa41('0x28'),_0x22de55[_0xaa41('0x29')]);});for(var _0x4e768e in _0x4fe1a4){if(_0x4fe1a4['hasOwnProperty'](_0x4e768e)){if(!_0x5cd936[_0x4e768e]){delete _0x4fe1a4[_0x4e768e];}}}}function freeIsNotKeyAgent(_0x1b1910,_0x5d4374){var _0xafd672=_[_0xaa41('0x26')](_0x1b1910,function(_0x3e2175,_0x1f27f3){var _0x1d623c=_['isNil'](_0x3e2175[_0xaa41('0x2a')])?util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x3e2175[_0xaa41('0x29')]):_0x3e2175[_0xaa41('0x2a')];return _0x1d623c;});for(var _0xa1f024 in _0x5d4374){if(_0x5d4374['hasOwnProperty'](_0xa1f024)){if(!_0xafd672[_0xa1f024]){delete _0x5d4374[_0xa1f024];}}}}function clearVoiceCallReports(_0x5795f4){_0x5795f4[_0xaa41('0x2c')]=0x0;_0x5795f4['answered']=0x0;_0x5795f4['sumHoldTime']=0x0;_0x5795f4[_0xaa41('0x2d')]=0x0;_0x5795f4['sumBillable']=0x0;}function clearCampaigns(_0x536bed){if(!_[_0xaa41('0x2e')](_0x536bed)){for(var _0x9c8c21 in _0x536bed){if(_0x536bed[_0xaa41('0x27')](_0x9c8c21)){_0x536bed[_0x9c8c21][_0xaa41('0x2f')]=0x0;_0x536bed[_0x9c8c21][_0xaa41('0x30')]=0x0;}}}}function clearVoiceQueues(_0xa7269f){if(!_['isEmpty'](_0xa7269f)){for(var _0x30a174 in _0xa7269f){if(_0xa7269f[_0xaa41('0x27')](_0x30a174)){_0xa7269f[_0x30a174][_0xaa41('0x2c')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x31')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x32')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x33')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x34')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x2d')]=0x0;_0xa7269f[_0x30a174]['sumBillable']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x35')]=0x0;_0xa7269f[_0x30a174]['outboundNoAnswerCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundBusyCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x36')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x37')]=0x0;_0xa7269f[_0x30a174]['outboundUnknownCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x38')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x39')]=0x0;_0xa7269f[_0x30a174]['outboundBlacklistCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundOriginateFailureCallsDay']=0x0;_0xa7269f[_0x30a174]['outboundRejectCallsDay']=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3a')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x35')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3b')]=0x0;_0xa7269f[_0x30a174][_0xaa41('0x3c')]=!![];}}}}Realtime['prototype'][_0xaa41('0x3d')]=function(_0x45c8fe,_0x3e0204){for(var _0x4de770 in _0x3e0204){if(_0x45c8fe[_0xaa41('0x27')](_0x4de770)){_0x45c8fe[_0x4de770]=_0x3e0204[_0x4de770];}}};Realtime[_0xaa41('0x3e')][_0xaa41('0x3f')]=function(){var _0x57ab80=this;return function(_0x252c62){if(_0x252c62){freeIsNotKeyAgent(_0x252c62,_0x57ab80[_0xaa41('0x12')]);for(var _0x57fe1d=0x0,_0x23eb50={},_0x13b6d4={};_0x57fe1d<_0x252c62[_0xaa41('0x40')];_0x57fe1d+=0x1){_0x23eb50=_0x252c62[_0x57fe1d];var _0x5cec87=_[_0xaa41('0x41')](_0x23eb50['interface'])?util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x23eb50[_0xaa41('0x29')]):_0x23eb50['interface'];if(_['isUndefined'](_0x57ab80['agents'][_0x5cec87])){_0x57ab80[_0xaa41('0x12')][_0x5cec87]=new Agent(_0x23eb50);}else{_0x57ab80[_0xaa41('0x3d')](_0x57ab80[_0xaa41('0x12')][_0x5cec87],_0x23eb50);}}}return _0x57ab80[_0xaa41('0x12')];};};Realtime['prototype']['initTelephones']=function(){var _0x267999=this;return function(_0x5673c){if(_0x5673c){freeIsNotKeySip(_0x5673c,_0x267999[_0xaa41('0x13')]);for(var _0x4e8d2e=0x0,_0xba115a={},_0x203d83={};_0x4e8d2e<_0x5673c[_0xaa41('0x40')];_0x4e8d2e+=0x1){_0xba115a=_0x5673c[_0x4e8d2e];if(_['isUndefined'](_0x267999[_0xaa41('0x13')][util[_0xaa41('0x2b')](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])])){_0x267999['telephones'][util['format'](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])]=new Telephone(_0xba115a);}else{_0x267999['mergeFromDatabase'](_0x267999[_0xaa41('0x13')][util['format'](_0xaa41('0x28'),_0xba115a[_0xaa41('0x29')])],_0xba115a);}}}return _0x267999[_0xaa41('0x13')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x42')]=function(){var _0x12ba1a=this;return function(_0x3ce95c){if(_0x3ce95c){freeIsNotKeySip(_0x3ce95c,_0x12ba1a[_0xaa41('0x14')]);for(var _0x5d9b22=0x0,_0x236ff4={},_0x2abf39={};_0x5d9b22<_0x3ce95c[_0xaa41('0x40')];_0x5d9b22+=0x1){_0x236ff4=_0x3ce95c[_0x5d9b22];if(_[_0xaa41('0x43')](_0x12ba1a[_0xaa41('0x14')][util[_0xaa41('0x2b')]('SIP/%s',_0x236ff4['name'])])){_0x12ba1a[_0xaa41('0x14')][util['format'](_0xaa41('0x28'),_0x236ff4[_0xaa41('0x29')])]=new Trunk(_0x236ff4);}else{_0x12ba1a[_0xaa41('0x3d')](_0x12ba1a[_0xaa41('0x14')][util[_0xaa41('0x2b')](_0xaa41('0x28'),_0x236ff4[_0xaa41('0x29')])],_0x236ff4);}}}return _0x12ba1a['trunks'];};};Realtime[_0xaa41('0x3e')]['initVoiceQueues']=function(){var _0x4dd842=this;return function(_0x361370){if(_0x361370){freeIsNotKey(_0x361370,_0x4dd842['voiceQueues'],'name');for(var _0x5274c9=0x0,_0x3bad48={},_0x525b09={};_0x5274c9<_0x361370[_0xaa41('0x40')];_0x5274c9+=0x1){_0x3bad48=_0x361370[_0x5274c9];if(_[_0xaa41('0x43')](_0x4dd842['voiceQueues'][_0x3bad48['name']])){_0x4dd842[_0xaa41('0x15')][_0x3bad48[_0xaa41('0x29')]]=new VoiceQueue(_0x3bad48);}else{_0x4dd842[_0xaa41('0x3d')](_0x4dd842[_0xaa41('0x15')][_0x3bad48[_0xaa41('0x29')]],_0x3bad48);}}}return _0x4dd842[_0xaa41('0x15')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x44')]=function(){var _0x2fa6ec=this;return function(_0x4e1ac4){if(_0x4e1ac4){freeIsNotKey(_0x4e1ac4,_0x2fa6ec[_0xaa41('0x16')],'id');for(var _0x22d512=0x0,_0x214ca4={},_0x429c1d={};_0x22d512<_0x4e1ac4[_0xaa41('0x40')];_0x22d512+=0x1){_0x214ca4=_0x4e1ac4[_0x22d512];if(_[_0xaa41('0x43')](_0x2fa6ec['triggers'][_0x214ca4['id']])){_0x2fa6ec[_0xaa41('0x16')][_0x214ca4['id']]=new Trigger(_0x214ca4);}else{_0x2fa6ec[_0xaa41('0x3d')](_0x2fa6ec[_0xaa41('0x16')][_0x214ca4['id']],_0x214ca4);}}}return _0x2fa6ec[_0xaa41('0x16')];};};Realtime['prototype'][_0xaa41('0x45')]=function(){var _0x5787f3=this;return function(_0x49fedd){if(_0x49fedd){freeIsNotKey(_0x49fedd,_0x5787f3[_0xaa41('0x17')],'id');for(var _0xe0eec0=0x0,_0x3e16ef={},_0x4ca114={};_0xe0eec0<_0x49fedd[_0xaa41('0x40')];_0xe0eec0+=0x1){_0x3e16ef=_0x49fedd[_0xe0eec0];if(_[_0xaa41('0x43')](_0x5787f3[_0xaa41('0x17')][_0x3e16ef['id']])){_0x5787f3['templates'][_0x3e16ef['id']]=new Template(_0x3e16ef);}else{_0x5787f3[_0xaa41('0x3d')](_0x5787f3[_0xaa41('0x17')][_0x3e16ef['id']],_0x3e16ef);}}}return _0x5787f3[_0xaa41('0x17')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x46')]=function(){var _0x237b8a=this;return function(_0x333a9f){if(_0x333a9f){freeIsNotKey(_0x333a9f,_0x237b8a[_0xaa41('0x1c')],'id');for(var _0x4eab60=0x0,_0x9f0a81={},_0x5bef5f={};_0x4eab60<_0x333a9f['length'];_0x4eab60+=0x1){_0x9f0a81=_0x333a9f[_0x4eab60];if(_[_0xaa41('0x43')](_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']])){_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']]=new ZendeskAccount(_0x9f0a81);}else{_0x237b8a[_0xaa41('0x3d')](_0x237b8a[_0xaa41('0x1c')][_0x9f0a81['id']],_0x9f0a81);}}}return _0x237b8a[_0xaa41('0x1c')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x47')]=function(){var _0x519e39=this;return function(_0xecb54){if(_0xecb54){freeIsNotKey(_0xecb54,_0x519e39[_0xaa41('0x1d')],'id');for(var _0x1d518f=0x0,_0x4f9e92={},_0x2e0f53={};_0x1d518f<_0xecb54[_0xaa41('0x40')];_0x1d518f+=0x1){_0x4f9e92=_0xecb54[_0x1d518f];if(_['isUndefined'](_0x519e39[_0xaa41('0x1d')][_0x4f9e92['id']])){_0x519e39[_0xaa41('0x1d')][_0x4f9e92['id']]=new SalesforceAccount(_0x4f9e92);}else{_0x519e39[_0xaa41('0x3d')](_0x519e39['salesforceAccounts'][_0x4f9e92['id']],_0x4f9e92);}}}return _0x519e39[_0xaa41('0x1d')];};};Realtime[_0xaa41('0x3e')]['initFreshdeskAccounts']=function(){var _0x49789a=this;return function(_0x3745ed){if(_0x3745ed){freeIsNotKey(_0x3745ed,_0x49789a[_0xaa41('0x48')],'id');for(var _0x3a29d2=0x0,_0x4d20c6={},_0x5a76b9={};_0x3a29d2<_0x3745ed[_0xaa41('0x40')];_0x3a29d2+=0x1){_0x4d20c6=_0x3745ed[_0x3a29d2];if(_[_0xaa41('0x43')](_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']])){_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']]=new FreshdeskAccount(_0x4d20c6);}else{_0x49789a['mergeFromDatabase'](_0x49789a[_0xaa41('0x48')][_0x4d20c6['id']],_0x4d20c6);}}}return _0x49789a['freshdeskAccounts'];};};Realtime['prototype'][_0xaa41('0x49')]=function(){var _0x52ae7f=this;return function(_0x3621c0){if(_0x3621c0){freeIsNotKey(_0x3621c0,_0x52ae7f[_0xaa41('0x1f')],'id');for(var _0x169ddf=0x0,_0x5e83e1={},_0x12ba1b={};_0x169ddf<_0x3621c0[_0xaa41('0x40')];_0x169ddf+=0x1){_0x5e83e1=_0x3621c0[_0x169ddf];if(_[_0xaa41('0x43')](_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']])){_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']]=new ZohoAccount(_0x5e83e1);}else{_0x52ae7f[_0xaa41('0x3d')](_0x52ae7f[_0xaa41('0x1f')][_0x5e83e1['id']],_0x5e83e1);}}}return _0x52ae7f[_0xaa41('0x1f')];};};Realtime[_0xaa41('0x3e')]['initDeskAccounts']=function(){var _0x35a09e=this;return function(_0x40cdfc){if(_0x40cdfc){freeIsNotKey(_0x40cdfc,_0x35a09e[_0xaa41('0x20')],'id');for(var _0x5a5a55=0x0,_0x3fe47a={},_0x2caf5c={};_0x5a5a55<_0x40cdfc[_0xaa41('0x40')];_0x5a5a55+=0x1){_0x3fe47a=_0x40cdfc[_0x5a5a55];if(_[_0xaa41('0x43')](_0x35a09e[_0xaa41('0x20')][_0x3fe47a['id']])){_0x35a09e[_0xaa41('0x20')][_0x3fe47a['id']]=new DeskAccount(_0x3fe47a);}else{_0x35a09e[_0xaa41('0x3d')](_0x35a09e['deskAccounts'][_0x3fe47a['id']],_0x3fe47a);}}}return _0x35a09e['deskAccounts'];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x4ec357=this;return function(_0x4a181a){if(_0x4a181a){freeIsNotKey(_0x4a181a,_0x4ec357[_0xaa41('0x1e')],'id');for(var _0x50b598=0x0,_0x576e6e={},_0x24c6f3={};_0x50b598<_0x4a181a[_0xaa41('0x40')];_0x50b598+=0x1){_0x576e6e=_0x4a181a[_0x50b598];if(_[_0xaa41('0x43')](_0x4ec357[_0xaa41('0x1e')][_0x576e6e['id']])){_0x4ec357['sugarcrmAccounts'][_0x576e6e['id']]=new SugarcrmAccount(_0x576e6e);}else{_0x4ec357[_0xaa41('0x3d')](_0x4ec357[_0xaa41('0x1e')][_0x576e6e['id']],_0x576e6e);}}}return _0x4ec357[_0xaa41('0x1e')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4a')]=function(){var _0x41ca40=this;return function(_0x46ebcd){if(_0x46ebcd){freeIsNotKey(_0x46ebcd,_0x41ca40[_0xaa41('0x21')],'id');for(var _0x1795d1=0x0,_0x54344c={},_0x185600={};_0x1795d1<_0x46ebcd[_0xaa41('0x40')];_0x1795d1+=0x1){_0x54344c=_0x46ebcd[_0x1795d1];if(_['isUndefined'](_0x41ca40['vtigerAccounts'][_0x54344c['id']])){_0x41ca40['vtigerAccounts'][_0x54344c['id']]=new VtigerAccount(_0x54344c);}else{_0x41ca40[_0xaa41('0x3d')](_0x41ca40['vtigerAccounts'][_0x54344c['id']],_0x54344c);}}}return _0x41ca40[_0xaa41('0x21')];};};Realtime['prototype'][_0xaa41('0x4b')]=function(){var _0x18d18b=this;return function(_0x4b1ec4){if(_0x4b1ec4){freeIsNotKey(_0x4b1ec4,_0x18d18b[_0xaa41('0x22')],'id');for(var _0x33efc5=0x0,_0x3d150d={},_0x33f5c2={};_0x33efc5<_0x4b1ec4['length'];_0x33efc5+=0x1){_0x3d150d=_0x4b1ec4[_0x33efc5];if(_['isUndefined'](_0x18d18b[_0xaa41('0x22')][_0x3d150d['id']])){_0x18d18b[_0xaa41('0x22')][_0x3d150d['id']]=new ServicenowAccount(_0x3d150d);}else{_0x18d18b['mergeFromDatabase'](_0x18d18b['servicenowAccounts'][_0x3d150d['id']],_0x3d150d);}}}return _0x18d18b[_0xaa41('0x22')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4c')]=function(){var _0xbeafb5=this;return function(_0x3dbe37){if(_0x3dbe37){freeIsNotKey(_0x3dbe37,_0xbeafb5['dynamics365Accounts'],'id');for(var _0x475ceb=0x0,_0x4c61d0={},_0x5062db={};_0x475ceb<_0x3dbe37['length'];_0x475ceb+=0x1){_0x4c61d0=_0x3dbe37[_0x475ceb];if(_[_0xaa41('0x43')](_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']])){_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']]=new Dynamics365Account(_0x4c61d0);}else{_0xbeafb5['mergeFromDatabase'](_0xbeafb5[_0xaa41('0x23')][_0x4c61d0['id']],_0x4c61d0);}}}return _0xbeafb5[_0xaa41('0x23')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4d')]=function(){var _0x457515=this;return function(_0x3ffbf8){if(_0x3ffbf8){freeIsNotKey(_0x3ffbf8,_0x457515[_0xaa41('0x24')],'id');for(var _0x50a53b=0x0,_0x1d2978={},_0x3031e5={};_0x50a53b<_0x3ffbf8[_0xaa41('0x40')];_0x50a53b+=0x1){_0x1d2978=_0x3ffbf8[_0x50a53b];if(_[_0xaa41('0x43')](_0x457515['freshsalesAccounts'][_0x1d2978['id']])){_0x457515[_0xaa41('0x24')][_0x1d2978['id']]=new FreshsalesAccount(_0x1d2978);}else{_0x457515['mergeFromDatabase'](_0x457515[_0xaa41('0x24')][_0x1d2978['id']],_0x1d2978);}}}return _0x457515[_0xaa41('0x24')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x4e')]=function(){var _0x491cad=this;return function(_0xf456c1){for(var _0x1a4197=0x0;_0x1a4197<_0xf456c1[_0xaa41('0x40')];_0x1a4197+=0x1){_[_0xaa41('0x4f')](_0x491cad['voiceQueues'][_0xf456c1[_0x1a4197][_0xaa41('0x29')]],_0xf456c1[_0x1a4197]);}return _0x491cad['voiceQueues'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x50')]=function(){var _0x574316=this;return function(_0x1ac05e){clearVoiceQueues(_0x574316[_0xaa41('0x15')]);if(_0x1ac05e){_0x1ac05e=_[_0xaa41('0x51')](_0x1ac05e,_0xaa41('0x52'));for(var _0x1c5df8 in _0x1ac05e){if(_0x1ac05e[_0xaa41('0x27')](_0x1c5df8)){var _0x384aba={};for(var _0x297ec6=0x0;_0x297ec6<_0x1ac05e[_0x1c5df8][_0xaa41('0x40')];_0x297ec6+=0x1){var _0x3d4f1e=_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x53')];if(_0x574316['voiceQueues'][_0x3d4f1e]){if(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x54')]){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x32')]+=0x1;}if(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerabandon']){_0x574316['voiceQueues'][_0x3d4f1e][_0xaa41('0x33')]+=0x1;}_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumHoldTime']+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x55')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerjoinAt']),_0xaa41('0x57'))||0x0;if(_0x297ec6===_0x1ac05e[_0x1c5df8][_0xaa41('0x40')]-0x1){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x2d')]+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x58')]||_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x59')]||_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x5a')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerjoinAt']),'seconds')||0x0;_0x574316[_0xaa41('0x15')][_0x3d4f1e]['total']+=0x1;if(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x5b')]){_0x574316[_0xaa41('0x15')][_0x3d4f1e][_0xaa41('0x31')]+=0x1;_0x574316['voiceQueues'][_0x3d4f1e][_0xaa41('0x5c')]+=moment(_0x1ac05e[_0x1c5df8][_0x297ec6][_0xaa41('0x58')])[_0xaa41('0x56')](moment(_0x1ac05e[_0x1c5df8][_0x297ec6]['queuecallerleaveAt']),_0xaa41('0x57'))||0x0;}}else{_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumDuration']+=_0x574316[_0xaa41('0x15')][_0x3d4f1e]['sumHoldTime']||0x0;}}}}}}return _0x574316['voiceQueues'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x5d')]=function(){var _0x5eded3=this;return function(_0x5a8cb0){clearVoiceCallReports(_0x5eded3[_0xaa41('0x18')]);if(_0x5a8cb0){for(var _0x1726ec=0x0;_0x1726ec<_0x5a8cb0[_0xaa41('0x40')];_0x1726ec+=0x1){_0x5eded3[_0xaa41('0x18')]['total']+=0x1;_0x5eded3[_0xaa41('0x18')][_0xaa41('0x2d')]+=_0x5a8cb0[_0x1726ec][_0xaa41('0x5e')];if(_0x5a8cb0[_0x1726ec]['disposition']===_0xaa41('0x5f')){_0x5eded3[_0xaa41('0x18')][_0xaa41('0x31')]+=0x1;_0x5eded3['outbound'][_0xaa41('0x34')]+=_0x5a8cb0[_0x1726ec]['duration']-_0x5a8cb0[_0x1726ec]['billableseconds']||0x0;_0x5eded3[_0xaa41('0x18')][_0xaa41('0x5c')]+=_0x5a8cb0[_0x1726ec]['billableseconds'];}}}return _0x5eded3[_0xaa41('0x18')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x60')]=function(){var _0x531fd4=this;return function(_0x292384){if(_0x292384){freeIsNotKey(_0x292384,_0x531fd4[_0xaa41('0x61')],_0xaa41('0x29'));for(var _0x16dcac=0x0,_0x38f5d0={};_0x16dcac<_0x292384['length'];_0x16dcac+=0x1){_0x38f5d0=_0x292384[_0x16dcac];if(_[_0xaa41('0x43')](_0x531fd4['campaigns'][_0x38f5d0[_0xaa41('0x29')]])){_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]]=new Campaign(_0x38f5d0);}else{_0x531fd4[_0xaa41('0x3d')](_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]],_0x38f5d0);_0x531fd4[_0xaa41('0x61')][_0x38f5d0[_0xaa41('0x29')]][_0xaa41('0x62')]=_0x38f5d0[_0xaa41('0x63')]?_0x38f5d0[_0xaa41('0x63')]['name']:undefined;}}}return _0x531fd4[_0xaa41('0x61')];};};Realtime[_0xaa41('0x3e')]['initVoiceExtensions']=function(){var _0x2961bc=this;return function(_0x543ab4){if(_0x543ab4){freeIsNotKey(_0x543ab4,_0x2961bc[_0xaa41('0x64')],'id');for(var _0xb44b1f=0x0,_0x472eb3={};_0xb44b1f<_0x543ab4[_0xaa41('0x40')];_0xb44b1f+=0x1){_0x472eb3=_0x543ab4[_0xb44b1f];if(_[_0xaa41('0x43')](_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']])){_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']]=new VoiceExtension(_0x472eb3);}else{_0x2961bc['mergeFromDatabase'](_0x2961bc[_0xaa41('0x64')][_0x472eb3['id']],_0x472eb3);}}}return _0x2961bc[_0xaa41('0x64')];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x65')]=function(){var _0x585ce7=this;return function(_0x2e4d3f){clearCampaigns(_0x585ce7['campaigns']);for(var _0x23d90e=0x0;_0x23d90e<_0x2e4d3f[_0xaa41('0x40')];_0x23d90e+=0x1){_[_0xaa41('0x4f')](_0x585ce7[_0xaa41('0x61')][_0x2e4d3f[_0x23d90e][_0xaa41('0x29')]],_0x2e4d3f[_0x23d90e]);}return _0x585ce7['campaigns'];};};Realtime[_0xaa41('0x3e')][_0xaa41('0x66')]=function(){var _0x5819ac=this;return function(_0x44743b){if(_0x44743b){freeIsNotKey(_0x44743b,_0x5819ac[_0xaa41('0x25')],'id');for(var _0x455571=0x0,_0x20184e={},_0x298533={};_0x455571<_0x44743b[_0xaa41('0x40')];_0x455571+=0x1){_0x20184e=_0x44743b[_0x455571];if(_[_0xaa41('0x43')](_0x5819ac[_0xaa41('0x25')][_0x20184e['id']])){_0x5819ac['faxAccounts'][_0x20184e['id']]=new FaxAccount(_0x20184e);}else{_0x5819ac[_0xaa41('0x3d')](_0x5819ac[_0xaa41('0x25')][_0x20184e['id']],_0x20184e);}}}return _0x5819ac[_0xaa41('0x25')];};};module[_0xaa41('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 644d740..f09a84f 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9567=['voiceQueueReport','length','connectedlinenum','assigned','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','destinationchannel','channel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','calleridnum','transfers','linkedid','transfereelinkedid','uniqueid','create','monitor','monitors','monitorFilename','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','transfererlinkedid','attendedTransfer','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format'];(function(_0x40d100,_0x129c67){var _0xde28af=function(_0x42a26a){while(--_0x42a26a){_0x40d100['push'](_0x40d100['shift']());}};_0xde28af(++_0x129c67);}(_0x9567,0x1ee));var _0x7956=function(_0x1b3f6b,_0x2f82b1){_0x1b3f6b=_0x1b3f6b-0x0;var _0x4d398f=_0x9567[_0x1b3f6b];return _0x4d398f;};'use strict';var _=require(_0x7956('0x0'));var moment=require(_0x7956('0x1'));var util=require(_0x7956('0x2'));var config=require(_0x7956('0x3'));var ami=require(_0x7956('0x4'));var RpcVoiceAgentReport=require(_0x7956('0x5'));var RpcVoiceCallReport=require(_0x7956('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x7956('0x7'));var RpcVoiceQueueReport=require(_0x7956('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x7956('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x7956('0xa'));var VoiceDialReport=require(_0x7956('0xb'));var UserReport=require(_0x7956('0xc'));function Report(_0x21a129){this[_0x7956('0xd')]=_0x21a129;this[_0x7956('0xe')]=_0x21a129['agents'];this[_0x7956('0xf')]=_0x21a129[_0x7956('0xf')];}Report[_0x7956('0x10')][_0x7956('0x11')]=function(_0x279aab){var _0x1b09b9=new VoiceQueueReport(this['realtime']);var _0xc657f=new VoiceAgentReport(this[_0x7956('0xd')]);var _0xc05b1d=new VoiceDialReport(this[_0x7956('0xd')]);var _0x41cad0=new VoiceCallReport(this[_0x7956('0xd')]);var _0x451e7c=new UserReport(this['realtime']);if(config[_0x7956('0x12')]&&config['xdr'][_0x7956('0x13')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x7956('0x14')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0x7956('0x15'),this[_0x7956('0x16')][_0x7956('0x14')](this));ami['on'](_0x7956('0x17'),this[_0x7956('0x18')][_0x7956('0x14')](this));ami['on'](_0x7956('0x19'),this[_0x7956('0x1a')][_0x7956('0x14')](this));ami['on'](_0x7956('0x1b'),this['attendedTransfer'][_0x7956('0x14')](this));}};Report[_0x7956('0x10')][_0x7956('0x1c')]=function(_0x37ebdd){var _0xee4522;_0xee4522=_[_0x7956('0x1d')](this['agents'],function(_0x84bd20){return _0x84bd20[_0x7956('0x1e')]==_0x37ebdd||_0x84bd20[_0x7956('0x1f')]==_0x37ebdd;});if(_['isNil'](_0xee4522)){var _0x323e3d=_[_0x7956('0x1d')](this[_0x7956('0xf')],function(_0x15a29b){return _0x15a29b[_0x7956('0x1e')]==_0x37ebdd||_0x15a29b[_0x7956('0x1f')]==_0x37ebdd;});if(_0x323e3d){_0xee4522=_[_0x7956('0x1d')](this[_0x7956('0xe')],function(_0x347032){return _0x347032[_0x7956('0x20')]==util[_0x7956('0x21')]('SIP/%s',_0x323e3d[_0x7956('0x1f')]);});}}return _0xee4522;};Report[_0x7956('0x10')][_0x7956('0x22')]=function(_0x54eeb9){for(var _0x5bede5=0x0;_0x5bede5<_0x54eeb9[_0x7956('0x23')];_0x5bede5+=0x1){var _0xbe74e1=this[_0x7956('0x1c')](_0x54eeb9[_0x5bede5][_0x7956('0x24')]);if(_0xbe74e1){_0x54eeb9[_0x5bede5][_0x7956('0x1e')]=_0xbe74e1['accountcode'];_0x54eeb9[_0x5bede5][_0x7956('0x25')]=!![];_0x54eeb9[_0x5bede5]['lastAssignedTo']=_0xbe74e1[_0x7956('0x1f')];_0x54eeb9[_0x5bede5][_0x7956('0x20')]=_[_0x7956('0x26')](_0xbe74e1[_0x7956('0x20')])?util[_0x7956('0x21')]('SIP/%s',_0xbe74e1[_0x7956('0x1f')]):_0xbe74e1['interface'];if(_0x54eeb9[_0x5bede5][_0x7956('0x27')]){_0x54eeb9[_0x5bede5][_0x7956('0x28')]=moment()[_0x7956('0x21')](_0x7956('0x29'));}if(_0x54eeb9[_0x5bede5][_0x7956('0x2a')]){_0x54eeb9[_0x5bede5][_0x7956('0x2b')]=moment()['format'](_0x7956('0x29'));}RpcMemberReport[_0x7956('0x22')](_0x54eeb9[_0x5bede5]);}RpcVoiceQueueReport['create'](_0x54eeb9[_0x5bede5]);}};function extractCalleridNumber(_0x3e495b){var _0x2f4a14=_0x3e495b[_0x7956('0x2c')](/<(.*?)>/);return _0x2f4a14?_0x2f4a14[0x1]:_0x3e495b;}Report['prototype'][_0x7956('0x2d')]=function(_0x4adaa2){_0x4adaa2[_0x7956('0x2e')]=_0x4adaa2['destination']||_0x4adaa2[_0x7956('0x2f')];if(_0x4adaa2[_0x7956('0x30')]==_0x7956('0x31')){_0x4adaa2[_0x7956('0x32')]=_0x7956('0x33');_0x4adaa2[_0x7956('0x34')]=_0x4adaa2[_0x7956('0x33')];if(_0x4adaa2[_0x7956('0x35')]==_0x7956('0x36')){_0x4adaa2[_0x7956('0x1e')]='';_0x4adaa2['destination']=extractCalleridNumber(_0x4adaa2[_0x7956('0x37')]);}else if(_0x4adaa2['context']==_0x7956('0x38')){if(_0x4adaa2['destination']=='xcally-motion-preview'){_0x4adaa2[_0x7956('0x2e')]=extractCalleridNumber(_0x4adaa2[_0x7956('0x39')]);_0x4adaa2['calleridnum']=_0x4adaa2['originatecalleridnum'];_0x4adaa2[_0x7956('0x3a')]=[_0x4adaa2[_0x7956('0x3b')],_0x4adaa2[_0x7956('0x3b')]=_0x4adaa2[_0x7956('0x3a')]][0x0];_0x4adaa2[_0x7956('0x37')]=_0x4adaa2[_0x7956('0x39')];}else{_0x4adaa2['destination']=_0x4adaa2['calleridnum'];_0x4adaa2['calleridnum']=_0x4adaa2[_0x7956('0x3c')];if(_0x4adaa2[_0x7956('0x3d')]==_0x7956('0x3e')){_0x4adaa2['accountcode']=_0x4adaa2[_0x7956('0x24')];}else{_0x4adaa2[_0x7956('0x1e')]='';}}}}else{_0x4adaa2['callerid']=util[_0x7956('0x21')](_0x7956('0x3f'),_0x4adaa2[_0x7956('0x40')],_0x4adaa2[_0x7956('0x41')]);}if(RpcVoiceTransferReport[_0x7956('0x42')][_0x4adaa2[_0x7956('0x43')]]){var _0x447150=RpcVoiceTransferReport[_0x7956('0x42')][_0x4adaa2[_0x7956('0x43')]];_0x447150[_0x7956('0x44')]=_0x4adaa2[_0x7956('0x45')];RpcVoiceTransferReport['blindTransfer'](_0x447150);delete RpcVoiceTransferReport['transfers'][_0x4adaa2[_0x7956('0x43')]];}RpcVoiceCallReport[_0x7956('0x46')](_0x4adaa2);if(_0x4adaa2[_0x7956('0x47')]){for(var _0x3fb79a=0x0;_0x3fb79a<_0x4adaa2[_0x7956('0x48')][_0x7956('0x23')];_0x3fb79a+=0x1){_0x4adaa2[_0x7956('0x49')]=_0x4adaa2[_0x7956('0x48')][_0x3fb79a]['filename'];_0x4adaa2['createdAt']=_0x4adaa2[_0x7956('0x48')][_0x3fb79a]['createdAt'];if(_0x4adaa2[_0x7956('0x2f')]=='xcally-motion-preview'){_0x4adaa2[_0x7956('0x41')]=_0x4adaa2['connectedlinenum'];_0x4adaa2[_0x7956('0x40')]=_0x4adaa2['connectedlinename'];_0x4adaa2['connectedlinenum']=_0x4adaa2[_0x7956('0x1e')];_0x4adaa2[_0x7956('0x4a')]=_0x4adaa2[_0x7956('0x4b')];_0x4adaa2[_0x7956('0x2f')]=_0x4adaa2['originatecalleridnum'];}else if(_0x4adaa2['exten']==_0x7956('0x4c')){_0x4adaa2[_0x7956('0x41')]=_0x4adaa2['destination'];_0x4adaa2[_0x7956('0x2f')]=_0x4adaa2[_0x7956('0x3c')];}RpcVoiceRecording[_0x7956('0x46')](_0x4adaa2);}}};Report[_0x7956('0x10')][_0x7956('0x16')]=function(_0x21011e){if(_[_0x7956('0x4d')](_0x21011e)){_0x21011e[_0x7956('0x4e')](function(_0x3c5cc6){RpcVoiceAgentReport[_0x7956('0x46')](_0x3c5cc6);});}else{RpcVoiceAgentReport[_0x7956('0x46')](_0x21011e);}};Report[_0x7956('0x10')]['voiceDialReport']=function(_0x3a3f38){RpcVoiceDialReport[_0x7956('0x46')](_0x3a3f38);var _0x5a43ef;var _0x8a47b6;var _0x2d8323=_0x3a3f38['channel'];if(_[_0x7956('0x4f')](_0x2d8323,'Local')){_0x8a47b6=_0x2d8323[_0x7956('0x50')](_0x2d8323[_0x7956('0x51')]('/')+0x1,_0x2d8323[_0x7956('0x51')]('@'));_0x5a43ef=_[_0x7956('0x1d')](this[_0x7956('0xe')],function(_0x217c74){return _0x217c74[_0x7956('0x52')]==_0x8a47b6||_0x217c74[_0x7956('0x53')]==_0x8a47b6||_0x217c74['accountcode']==_0x8a47b6;});}else{_0x8a47b6=_0x2d8323[_0x7956('0x50')](_0x2d8323['indexOf']('/')+0x1,_0x2d8323[_0x7956('0x54')]('-'));_0x5a43ef=this[_0x7956('0x1c')](_0x8a47b6);}if(_0x5a43ef){_0x3a3f38[_0x7956('0x20')]=_[_0x7956('0x26')](_0x5a43ef[_0x7956('0x20')])?util[_0x7956('0x21')](_0x7956('0x55'),_0x5a43ef['name']):_0x5a43ef['interface'];_0x3a3f38[_0x7956('0x4b')]=_0x5a43ef[_0x7956('0x1f')];_0x3a3f38[_0x7956('0x1e')]=_0x5a43ef['accountcode'];RpcMemberReport['voiceDialReport'](_0x3a3f38);}};Report[_0x7956('0x10')][_0x7956('0x1a')]=function(_0x4e359e){RpcVoiceTransferReport[_0x7956('0x42')][_0x4e359e[_0x7956('0x56')]]=_0x4e359e;};Report[_0x7956('0x10')][_0x7956('0x57')]=function(_0x1c41a1){RpcVoiceTransferReport[_0x7956('0x57')](_0x1c41a1);};module['exports']=Report; \ No newline at end of file +var _0x07dd=['voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','telephones','format','SIP/%s','assigned','lastAssignedTo','interface','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','dialer','lastapplication','lastdata','queue','context','xcally-motion-preview','calleridpreview','originatecalleridnum','channel','callerid','calleridnum','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitor','monitors','length','monitorFilename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','lodash','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','disabled'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x07dd,0xef));var _0xd07d=function(_0x28590a,_0x13c5c2){_0x28590a=_0x28590a-0x0;var _0x1b236a=_0x07dd[_0x28590a];return _0x1b236a;};'use strict';var _=require(_0xd07d('0x0'));var moment=require('moment');var util=require(_0xd07d('0x1'));var config=require('../../../config/environment');var ami=require(_0xd07d('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xd07d('0x3'));var RpcVoiceDialReport=require(_0xd07d('0x4'));var RpcMemberReport=require(_0xd07d('0x5'));var RpcVoiceQueueReport=require(_0xd07d('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xd07d('0x7'));var VoiceQueueReport=require(_0xd07d('0x8'));var VoiceCallReport=require(_0xd07d('0x9'));var VoiceAgentReport=require(_0xd07d('0xa'));var VoiceDialReport=require(_0xd07d('0xb'));var UserReport=require(_0xd07d('0xc'));function Report(_0x1a70b8){this[_0xd07d('0xd')]=_0x1a70b8;this[_0xd07d('0xe')]=_0x1a70b8['agents'];this['telephones']=_0x1a70b8['telephones'];}Report[_0xd07d('0xf')][_0xd07d('0x10')]=function(_0x5ebf4f){var _0x24a497=new VoiceQueueReport(this[_0xd07d('0xd')]);var _0x2458ec=new VoiceAgentReport(this[_0xd07d('0xd')]);var _0x329254=new VoiceDialReport(this[_0xd07d('0xd')]);var _0x644dae=new VoiceCallReport(this['realtime']);var _0x4e2b06=new UserReport(this['realtime']);if(config[_0xd07d('0x11')]&&config[_0xd07d('0x11')][_0xd07d('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xd07d('0x13')][_0xd07d('0x14')](this));ami['on'](_0xd07d('0x15'),this[_0xd07d('0x16')]['bind'](this));ami['on'](_0xd07d('0x17'),this[_0xd07d('0x18')][_0xd07d('0x14')](this));ami['on'](_0xd07d('0x19'),this[_0xd07d('0x1a')]['bind'](this));ami['on'](_0xd07d('0x1b'),this['blindTransfer'][_0xd07d('0x14')](this));ami['on'](_0xd07d('0x1c'),this[_0xd07d('0x1d')][_0xd07d('0x14')](this));}};Report['prototype'][_0xd07d('0x1e')]=function(_0x4abe42){var _0x5bc9d4;_0x5bc9d4=_[_0xd07d('0x1f')](this['agents'],function(_0x32d01a){return _0x32d01a[_0xd07d('0x20')]==_0x4abe42||_0x32d01a[_0xd07d('0x21')]==_0x4abe42;});if(_['isNil'](_0x5bc9d4)){var _0x3e639e=_[_0xd07d('0x1f')](this[_0xd07d('0x22')],function(_0x2e86bb){return _0x2e86bb[_0xd07d('0x20')]==_0x4abe42||_0x2e86bb[_0xd07d('0x21')]==_0x4abe42;});if(_0x3e639e){_0x5bc9d4=_[_0xd07d('0x1f')](this[_0xd07d('0xe')],function(_0x42f66d){return _0x42f66d['interface']==util[_0xd07d('0x23')](_0xd07d('0x24'),_0x3e639e[_0xd07d('0x21')]);});}}return _0x5bc9d4;};Report[_0xd07d('0xf')][_0xd07d('0x13')]=function(_0x4e0ec2){for(var _0x2c5529=0x0;_0x2c5529<_0x4e0ec2['length'];_0x2c5529+=0x1){var _0x4f608e=this['findAgent'](_0x4e0ec2[_0x2c5529]['connectedlinenum']);if(_0x4f608e){_0x4e0ec2[_0x2c5529][_0xd07d('0x20')]=_0x4f608e[_0xd07d('0x20')];_0x4e0ec2[_0x2c5529][_0xd07d('0x25')]=!![];_0x4e0ec2[_0x2c5529][_0xd07d('0x26')]=_0x4f608e[_0xd07d('0x21')];_0x4e0ec2[_0x2c5529][_0xd07d('0x27')]=_[_0xd07d('0x28')](_0x4f608e[_0xd07d('0x27')])?util['format']('SIP/%s',_0x4f608e[_0xd07d('0x21')]):_0x4f608e[_0xd07d('0x27')];if(_0x4e0ec2[_0x2c5529][_0xd07d('0x29')]){_0x4e0ec2[_0x2c5529][_0xd07d('0x2a')]=moment()[_0xd07d('0x23')](_0xd07d('0x2b'));}if(_0x4e0ec2[_0x2c5529][_0xd07d('0x2c')]){_0x4e0ec2[_0x2c5529][_0xd07d('0x2d')]=moment()[_0xd07d('0x23')](_0xd07d('0x2b'));}RpcMemberReport[_0xd07d('0x13')](_0x4e0ec2[_0x2c5529]);}RpcVoiceQueueReport[_0xd07d('0x2e')](_0x4e0ec2[_0x2c5529]);}};function extractCalleridNumber(_0x362ead){var _0x3e19ec=_0x362ead[_0xd07d('0x2f')](/<(.*?)>/);return _0x3e19ec?_0x3e19ec[0x1]:_0x362ead;}Report[_0xd07d('0xf')][_0xd07d('0x16')]=function(_0x32c6b8){_0x32c6b8[_0xd07d('0x30')]=_0x32c6b8[_0xd07d('0x30')]||_0x32c6b8['exten'];if(_0x32c6b8['type']==_0xd07d('0x31')){_0x32c6b8[_0xd07d('0x32')]='queue';_0x32c6b8[_0xd07d('0x33')]=_0x32c6b8[_0xd07d('0x34')];if(_0x32c6b8['context']=='from-voip-provider'){_0x32c6b8[_0xd07d('0x20')]='';_0x32c6b8[_0xd07d('0x30')]=extractCalleridNumber(_0x32c6b8['callerid']);}else if(_0x32c6b8[_0xd07d('0x35')]=='from-sip'){if(_0x32c6b8[_0xd07d('0x30')]==_0xd07d('0x36')){_0x32c6b8['destination']=extractCalleridNumber(_0x32c6b8[_0xd07d('0x37')]);_0x32c6b8['calleridnum']=_0x32c6b8[_0xd07d('0x38')];_0x32c6b8['destinationchannel']=[_0x32c6b8[_0xd07d('0x39')],_0x32c6b8[_0xd07d('0x39')]=_0x32c6b8['destinationchannel']][0x0];_0x32c6b8[_0xd07d('0x3a')]=_0x32c6b8['calleridpreview'];}else{_0x32c6b8[_0xd07d('0x30')]=_0x32c6b8[_0xd07d('0x3b')];_0x32c6b8['calleridnum']=_0x32c6b8['originatecalleridnum'];if(_0x32c6b8[_0xd07d('0x3c')]==_0xd07d('0x3d')){_0x32c6b8[_0xd07d('0x20')]=_0x32c6b8[_0xd07d('0x3e')];}else{_0x32c6b8[_0xd07d('0x20')]='';}}}}else{_0x32c6b8[_0xd07d('0x3a')]=util[_0xd07d('0x23')](_0xd07d('0x3f'),_0x32c6b8[_0xd07d('0x40')],_0x32c6b8[_0xd07d('0x3b')]);}if(RpcVoiceTransferReport[_0xd07d('0x41')][_0x32c6b8[_0xd07d('0x42')]]){var _0x3efd86=RpcVoiceTransferReport['transfers'][_0x32c6b8[_0xd07d('0x42')]];_0x3efd86[_0xd07d('0x43')]=_0x32c6b8[_0xd07d('0x44')];RpcVoiceTransferReport[_0xd07d('0x45')](_0x3efd86);delete RpcVoiceTransferReport['transfers'][_0x32c6b8[_0xd07d('0x42')]];}RpcVoiceCallReport['create'](_0x32c6b8);if(_0x32c6b8[_0xd07d('0x46')]){for(var _0x4d1415=0x0;_0x4d1415<_0x32c6b8[_0xd07d('0x47')][_0xd07d('0x48')];_0x4d1415+=0x1){_0x32c6b8[_0xd07d('0x49')]=_0x32c6b8[_0xd07d('0x47')][_0x4d1415]['filename'];_0x32c6b8['createdAt']=_0x32c6b8[_0xd07d('0x47')][_0x4d1415][_0xd07d('0x4a')];if(_0x32c6b8[_0xd07d('0x4b')]=='xcally-motion-preview'){_0x32c6b8['calleridnum']=_0x32c6b8[_0xd07d('0x3e')];_0x32c6b8[_0xd07d('0x40')]=_0x32c6b8[_0xd07d('0x4c')];_0x32c6b8['connectedlinenum']=_0x32c6b8['accountcode'];_0x32c6b8[_0xd07d('0x4c')]=_0x32c6b8[_0xd07d('0x4d')];_0x32c6b8[_0xd07d('0x4b')]=_0x32c6b8[_0xd07d('0x38')];}else if(_0x32c6b8[_0xd07d('0x4b')]==_0xd07d('0x4e')){_0x32c6b8[_0xd07d('0x3b')]=_0x32c6b8['destination'];_0x32c6b8[_0xd07d('0x4b')]=_0x32c6b8[_0xd07d('0x38')];}RpcVoiceRecording[_0xd07d('0x2e')](_0x32c6b8);}}};Report[_0xd07d('0xf')][_0xd07d('0x18')]=function(_0x474397){if(_['isArray'](_0x474397)){_0x474397['forEach'](function(_0x39e8ca){RpcVoiceAgentReport[_0xd07d('0x2e')](_0x39e8ca);});}else{RpcVoiceAgentReport[_0xd07d('0x2e')](_0x474397);}};Report['prototype'][_0xd07d('0x1a')]=function(_0x4f16a0){RpcVoiceDialReport[_0xd07d('0x2e')](_0x4f16a0);var _0x391d12;var _0x5d745b;var _0x3292e4=_0x4f16a0['channel'];if(_[_0xd07d('0x4f')](_0x3292e4,_0xd07d('0x50'))){_0x5d745b=_0x3292e4[_0xd07d('0x51')](_0x3292e4[_0xd07d('0x52')]('/')+0x1,_0x3292e4[_0xd07d('0x52')]('@'));_0x391d12=_[_0xd07d('0x1f')](this[_0xd07d('0xe')],function(_0x362696){return _0x362696[_0xd07d('0x53')]==_0x5d745b||_0x362696[_0xd07d('0x54')]==_0x5d745b||_0x362696[_0xd07d('0x20')]==_0x5d745b;});}else{_0x5d745b=_0x3292e4[_0xd07d('0x51')](_0x3292e4[_0xd07d('0x52')]('/')+0x1,_0x3292e4[_0xd07d('0x55')]('-'));_0x391d12=this[_0xd07d('0x1e')](_0x5d745b);}if(_0x391d12){_0x4f16a0[_0xd07d('0x27')]=_['isNil'](_0x391d12['interface'])?util[_0xd07d('0x23')](_0xd07d('0x24'),_0x391d12[_0xd07d('0x21')]):_0x391d12[_0xd07d('0x27')];_0x4f16a0['membername']=_0x391d12[_0xd07d('0x21')];_0x4f16a0['accountcode']=_0x391d12[_0xd07d('0x20')];RpcMemberReport[_0xd07d('0x1a')](_0x4f16a0);}};Report['prototype'][_0xd07d('0x45')]=function(_0x439cfe){RpcVoiceTransferReport['transfers'][_0x439cfe['transfererlinkedid']]=_0x439cfe;};Report[_0xd07d('0xf')][_0xd07d('0x1d')]=function(_0x17ecb2){RpcVoiceTransferReport[_0xd07d('0x1d')](_0x17ecb2);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index e9934e0..fce3928 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf933=['device','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','phone','local','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:save','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s'];(function(_0x26e2f4,_0x7fdf9){var _0x472524=function(_0x5e5b0b){while(--_0x5e5b0b){_0x26e2f4['push'](_0x26e2f4['shift']());}};_0x472524(++_0x7fdf9);}(_0xf933,0x17b));var _0x3f93=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0xf933[_0x409deb];return _0x15a4f7;};'use strict';var _=require(_0x3f93('0x0'));var moment=require(_0x3f93('0x1'));var util=require(_0x3f93('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x3f93('0x3'));var logger=require('../../../config/logger')(_0x3f93('0x4'));var ami=require(_0x3f93('0x5'));config[_0x3f93('0x6')]=_['defaults'](config[_0x3f93('0x6')],{'host':_0x3f93('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f93('0x6')]));function UserReport(_0x34e72b){this[_0x3f93('0x8')]=_0x34e72b[_0x3f93('0x8')];this[_0x3f93('0x9')]=_0x34e72b[_0x3f93('0x9')];this[_0x3f93('0xa')]=_0x34e72b['telephones'];ami['on'](_0x3f93('0xb'),this[_0x3f93('0xc')][_0x3f93('0xd')](this));ami['on'](_0x3f93('0xe'),this['syncRegistry']['bind'](this));ami['on'](_0x3f93('0xf'),this[_0x3f93('0x10')][_0x3f93('0xd')](this));ami['on'](_0x3f93('0x11'),this['syncPeerStatus'][_0x3f93('0xd')](this));return this[_0x3f93('0x12')]();}function showSipRegistrations(){Promise[_0x3f93('0x13')]()[_0x3f93('0x14')](ami['actionSipShowRegistry']())[_0x3f93('0x15')](function(_0x1c2d8a){logger[_0x3f93('0x16')](_0x3f93('0x17'),util['inspect'](_0x1c2d8a,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()['then'](ami[_0x3f93('0x18')]())[_0x3f93('0x15')](function(_0x2965a4){logger['error']('[userReport][devicestatelist]',util[_0x3f93('0x19')](_0x2965a4,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3f93('0x13')]()['then'](ami[_0x3f93('0x1a')]())[_0x3f93('0x15')](function(_0x4bb962){logger[_0x3f93('0x16')](_0x3f93('0x1b'),util['inspect'](_0x4bb962,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x3f93('0x13')]()['then'](showSipRegistrations())[_0x3f93('0x14')](listDeviceStates())[_0x3f93('0x14')](showPeersStatus());},0x32c8);};UserReport[_0x3f93('0x1c')][_0x3f93('0x1d')]=function(_0x2cb56d){return _0x2cb56d!==null&&!_[_0x3f93('0x1e')](_0x2cb56d);};UserReport[_0x3f93('0x1c')][_0x3f93('0x1f')]=function(_0xf9b900,_0x2aaf5b,_0x2d3f99){io['to'](_0xf9b900)['emit'](_0x2aaf5b,_0x2d3f99);};UserReport[_0x3f93('0x1c')]['syncRegistry']=function(_0x3d5585){try{if(this[_0x3f93('0x1d')](_0x3d5585)){logger[_0x3f93('0x20')](_0x3f93('0x21'),_0x3d5585[_0x3f93('0x22')],_0x3d5585[_0x3f93('0x23')]);logger[_0x3f93('0x24')](_0x3f93('0x25'),util[_0x3f93('0x19')](_0x3d5585,{'showHidden':![],'depth':null}));var _0x124b91=_[_0x3f93('0x26')](this['trunks'],{'defaultuser':_0x3d5585['username']});if(_0x124b91){_0x3d5585[_0x3f93('0x27')]=_0x3d5585['state'];_['merge'](_0x124b91,_[_0x3f93('0x28')](_0x3d5585,['event',_0x3f93('0x29'),_0x3f93('0x22'),_0x3f93('0x23')]));logger[_0x3f93('0x24')](_0x3f93('0x2a'),util[_0x3f93('0x19')](_0x124b91,{'showHidden':![],'depth':null}));this['emit'](util[_0x3f93('0x2b')]('trunk:%s',_0x124b91[_0x3f93('0x2c')]),_0x3f93('0x2d'),_0x124b91);}}}catch(_0x382d9b){logger[_0x3f93('0x16')](_0x3f93('0x25'),util[_0x3f93('0x19')](_0x382d9b,{'showHidden':![],'depth':null}));}};UserReport[_0x3f93('0x1c')]['syncDeviceState']=function(_0x3f623d){try{if(this[_0x3f93('0x1d')](_0x3f623d)){logger[_0x3f93('0x20')](_0x3f93('0x2e'),_0x3f623d[_0x3f93('0x2f')],_0x3f623d[_0x3f93('0x23')]);logger[_0x3f93('0x24')]('[userReport][devicestatechange]',util[_0x3f93('0x19')](_0x3f623d,{'showHidden':![],'depth':null}));if(this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]){if(!this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['local']||_0x3f623d['state'][_0x3f93('0x30')]()==_0x3f93('0x31')){this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['local']=![];if(this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]]['state']!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x32')]=_[_0x3f93('0x33')](moment()[_0x3f93('0x2b')]('x'));}this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]=_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]();this[_0x3f93('0x9')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x34')](_0x3f623d);}}else if(this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]]){if(this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]]['stateTime']=_[_0x3f93('0x33')](moment()[_0x3f93('0x2b')]('x'));}this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x23')]=_0x3f623d[_0x3f93('0x23')]['toLowerCase']();logger[_0x3f93('0x24')](_0x3f93('0x35'),util[_0x3f93('0x19')](this['telephones'][_0x3f623d['device']],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')](_0x3f93('0x36'),this[_0x3f93('0xa')][_0x3f623d[_0x3f93('0x2f')]][_0x3f93('0x2c')]),'telephone:save',this[_0x3f93('0xa')][_0x3f623d['device']]);}else if(this['trunks'][_0x3f623d[_0x3f93('0x2f')]]){if(this[_0x3f93('0x8')][_0x3f623d['device']]['state']!==_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]()){this[_0x3f93('0x8')][_0x3f623d[_0x3f93('0x2f')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x3f623d['device']][_0x3f93('0x23')]=_0x3f623d['state'][_0x3f93('0x30')]();logger[_0x3f93('0x24')](_0x3f93('0x37'),util[_0x3f93('0x19')](this[_0x3f93('0x8')][_0x3f623d[_0x3f93('0x2f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('trunk:%s',this[_0x3f93('0x8')][_0x3f623d['device']][_0x3f93('0x2c')]),_0x3f93('0x2d'),this[_0x3f93('0x8')][_0x3f623d['device']]);}else if(_[_0x3f93('0x38')](_0x3f623d[_0x3f93('0x2f')],'Local')){var _0x23e868=_0x3f623d[_0x3f93('0x2f')];var _0x99980f=_0x23e868[_0x3f93('0x39')](_0x23e868[_0x3f93('0x3a')]('/')+0x1,_0x23e868[_0x3f93('0x3a')]('@'));var _0x57ac99=_[_0x3f93('0x26')](this[_0x3f93('0x9')],function(_0xe51853){return _0xe51853['mobile']==_0x99980f||_0xe51853[_0x3f93('0x3b')]==_0x99980f||_0xe51853['accountcode']==_0x99980f;});if(_0x57ac99){if(_0x57ac99[_0x3f93('0x23')]!==_0x3f623d['state']['toLowerCase']()){_0x57ac99[_0x3f93('0x32')]=_['toNumber'](moment()[_0x3f93('0x2b')]('x'));}_0x57ac99['state']=_0x3f623d[_0x3f93('0x23')][_0x3f93('0x30')]();_0x57ac99[_0x3f93('0x3c')]=!![];_0x57ac99[_0x3f93('0x34')](_0x3f623d);}}}}catch(_0x4b38b5){logger[_0x3f93('0x16')]('[userReport][devicestatechange]',util[_0x3f93('0x19')](_0x4b38b5,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x3f93('0x3d')]=function(_0x4330cb){try{if(this[_0x3f93('0x1d')](_0x4330cb)&&this['isNotNull'](_0x4330cb[_0x3f93('0x11')])){logger[_0x3f93('0x20')](_0x3f93('0x3e'),_0x4330cb[_0x3f93('0x3f')],_0x4330cb[_0x3f93('0x40')],_0x4330cb[_0x3f93('0x11')]);logger[_0x3f93('0x24')](_0x3f93('0x41'),util['inspect'](_0x4330cb,{'showHidden':![],'depth':null}));if(this['agents'][_0x4330cb[_0x3f93('0x3f')]]){if(!this[_0x3f93('0x9')][_0x4330cb['peer']]['local']||_0x4330cb[_0x3f93('0x11')][_0x3f93('0x30')]()==_0x3f93('0x42')){this['agents'][_0x4330cb[_0x3f93('0x3f')]]['local']=![];this['agents'][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x43')]=_0x4330cb['peerstatus'][_0x3f93('0x30')]();this[_0x3f93('0x9')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x40')]=_0x4330cb[_0x3f93('0x40')];this[_0x3f93('0x9')][_0x4330cb['peer']][_0x3f93('0x34')](_0x4330cb);}}else if(this['telephones'][_0x4330cb[_0x3f93('0x3f')]]){this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x43')]=_0x4330cb[_0x3f93('0x11')][_0x3f93('0x30')]();this[_0x3f93('0xa')][_0x4330cb['peer']]['address']=_0x4330cb[_0x3f93('0x40')];logger['debug'](_0x3f93('0x44'),util[_0x3f93('0x19')](this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('telephone:%s',this[_0x3f93('0xa')][_0x4330cb['peer']][_0x3f93('0x2c')]),_0x3f93('0x45'),this[_0x3f93('0xa')][_0x4330cb[_0x3f93('0x3f')]]);}else if(this['trunks'][_0x4330cb['peer']]){this[_0x3f93('0x8')][_0x4330cb['peer']][_0x3f93('0x43')]=_0x4330cb['peerstatus'][_0x3f93('0x30')]();this[_0x3f93('0x8')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x40')]=_0x4330cb[_0x3f93('0x40')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x3f93('0x19')](this['trunks'][_0x4330cb[_0x3f93('0x3f')]],{'showHidden':![],'depth':null}));this[_0x3f93('0x1f')](util[_0x3f93('0x2b')]('trunk:%s',this[_0x3f93('0x8')][_0x4330cb[_0x3f93('0x3f')]][_0x3f93('0x2c')]),'trunk:save',this['trunks'][_0x4330cb[_0x3f93('0x3f')]]);}}}catch(_0x5ef731){logger[_0x3f93('0x16')]('[userReport][peerstatus]',util[_0x3f93('0x19')](_0x5ef731,{'showHidden':![],'depth':null}));}};module[_0x3f93('0x46')]=UserReport; \ No newline at end of file +var _0xdc11=['phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','address','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','trunk:save','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','resolve','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','then','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','stateRegistry','merge','omit','event','actionid','format','trunk:%s','name','device','state','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','find','mobile'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdc11,0x1cd));var _0x1dc1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc11[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dc1('0x0'));var moment=require(_0x1dc1('0x1'));var util=require('util');var Redis=require(_0x1dc1('0x2'));var BPromise=require(_0x1dc1('0x3'));var config=require(_0x1dc1('0x4'));var logger=require(_0x1dc1('0x5'))(_0x1dc1('0x6'));var ami=require('../ami');config['redis']=_[_0x1dc1('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1dc1('0x8'))(new Redis(config['redis']));function UserReport(_0x15b367){this[_0x1dc1('0x9')]=_0x15b367[_0x1dc1('0x9')];this[_0x1dc1('0xa')]=_0x15b367[_0x1dc1('0xa')];this[_0x1dc1('0xb')]=_0x15b367[_0x1dc1('0xb')];ami['on'](_0x1dc1('0xc'),this[_0x1dc1('0xd')][_0x1dc1('0xe')](this));ami['on'](_0x1dc1('0xf'),this[_0x1dc1('0xd')][_0x1dc1('0xe')](this));ami['on'](_0x1dc1('0x10'),this[_0x1dc1('0x11')][_0x1dc1('0xe')](this));ami['on'](_0x1dc1('0x12'),this['syncPeerStatus'][_0x1dc1('0xe')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x1dc1('0x13')]()['then'](ami['actionSipShowRegistry']())['catch'](function(_0x56caf1){logger[_0x1dc1('0x14')](_0x1dc1('0x15'),util[_0x1dc1('0x16')](_0x56caf1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1dc1('0x13')]()['then'](ami[_0x1dc1('0x17')]())['catch'](function(_0x3c812c){logger[_0x1dc1('0x14')](_0x1dc1('0x18'),util[_0x1dc1('0x16')](_0x3c812c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x1dc1('0x13')]()[_0x1dc1('0x19')](ami[_0x1dc1('0x1a')]())[_0x1dc1('0x1b')](function(_0x293322){logger[_0x1dc1('0x14')](_0x1dc1('0x1c'),util[_0x1dc1('0x16')](_0x293322,{'showHidden':![],'depth':null}));});}UserReport[_0x1dc1('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x1dc1('0x13')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x1dc1('0x19')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x1dc1('0x1e')]=function(_0x483bce){return _0x483bce!==null&&!_[_0x1dc1('0x1f')](_0x483bce);};UserReport[_0x1dc1('0x1d')][_0x1dc1('0x20')]=function(_0x61c640,_0x151be1,_0x4c05a4){io['to'](_0x61c640)[_0x1dc1('0x20')](_0x151be1,_0x4c05a4);};UserReport['prototype'][_0x1dc1('0xd')]=function(_0x5e8396){try{if(this[_0x1dc1('0x1e')](_0x5e8396)){logger[_0x1dc1('0x21')](_0x1dc1('0x22'),_0x5e8396[_0x1dc1('0x23')],_0x5e8396['state']);logger[_0x1dc1('0x24')](_0x1dc1('0x25'),util[_0x1dc1('0x16')](_0x5e8396,{'showHidden':![],'depth':null}));var _0x4f9891=_['find'](this[_0x1dc1('0x9')],{'defaultuser':_0x5e8396[_0x1dc1('0x23')]});if(_0x4f9891){_0x5e8396[_0x1dc1('0x26')]=_0x5e8396['state'];_[_0x1dc1('0x27')](_0x4f9891,_[_0x1dc1('0x28')](_0x5e8396,[_0x1dc1('0x29'),_0x1dc1('0x2a'),_0x1dc1('0x23'),'state']));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x1dc1('0x16')](_0x4f9891,{'showHidden':![],'depth':null}));this[_0x1dc1('0x20')](util[_0x1dc1('0x2b')](_0x1dc1('0x2c'),_0x4f9891[_0x1dc1('0x2d')]),'trunk:save',_0x4f9891);}}}catch(_0xb7896a){logger[_0x1dc1('0x14')](_0x1dc1('0x25'),util[_0x1dc1('0x16')](_0xb7896a,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1dc1('0x11')]=function(_0x7deb37){try{if(this[_0x1dc1('0x1e')](_0x7deb37)){logger[_0x1dc1('0x21')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x7deb37[_0x1dc1('0x2e')],_0x7deb37[_0x1dc1('0x2f')]);logger[_0x1dc1('0x24')](_0x1dc1('0x30'),util[_0x1dc1('0x16')](_0x7deb37,{'showHidden':![],'depth':null}));if(this['agents'][_0x7deb37['device']]){if(!this['agents'][_0x7deb37[_0x1dc1('0x2e')]]['local']||_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]()==_0x1dc1('0x32')){this[_0x1dc1('0xa')][_0x7deb37['device']][_0x1dc1('0x33')]=![];if(this[_0x1dc1('0xa')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]!==_0x7deb37['state'][_0x1dc1('0x31')]()){this[_0x1dc1('0xa')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x34')]=_['toNumber'](moment()['format']('x'));}this[_0x1dc1('0xa')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]=_0x7deb37['state'][_0x1dc1('0x31')]();this['agents'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x35')](_0x7deb37);}}else if(this['telephones'][_0x7deb37[_0x1dc1('0x2e')]]){if(this['telephones'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]!==_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]()){this[_0x1dc1('0xb')][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x34')]=_[_0x1dc1('0x36')](moment()['format']('x'));}this['telephones'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2f')]=_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]();logger[_0x1dc1('0x24')](_0x1dc1('0x37'),util[_0x1dc1('0x16')](this[_0x1dc1('0xb')][_0x7deb37[_0x1dc1('0x2e')]],{'showHidden':![],'depth':null}));this[_0x1dc1('0x20')](util[_0x1dc1('0x2b')](_0x1dc1('0x38'),this[_0x1dc1('0xb')][_0x7deb37[_0x1dc1('0x2e')]]['name']),_0x1dc1('0x39'),this['telephones'][_0x7deb37[_0x1dc1('0x2e')]]);}else if(this[_0x1dc1('0x9')][_0x7deb37[_0x1dc1('0x2e')]]){if(this[_0x1dc1('0x9')][_0x7deb37['device']][_0x1dc1('0x2f')]!==_0x7deb37[_0x1dc1('0x2f')]['toLowerCase']()){this[_0x1dc1('0x9')][_0x7deb37['device']][_0x1dc1('0x34')]=_['toNumber'](moment()[_0x1dc1('0x2b')]('x'));}this[_0x1dc1('0x9')][_0x7deb37[_0x1dc1('0x2e')]]['state']=_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]();logger['debug'](_0x1dc1('0x3a'),util[_0x1dc1('0x16')](this[_0x1dc1('0x9')][_0x7deb37['device']],{'showHidden':![],'depth':null}));this[_0x1dc1('0x20')](util[_0x1dc1('0x2b')](_0x1dc1('0x2c'),this['trunks'][_0x7deb37[_0x1dc1('0x2e')]][_0x1dc1('0x2d')]),'trunk:save',this[_0x1dc1('0x9')][_0x7deb37[_0x1dc1('0x2e')]]);}else if(_[_0x1dc1('0x3b')](_0x7deb37[_0x1dc1('0x2e')],_0x1dc1('0x3c'))){var _0x1bee2e=_0x7deb37[_0x1dc1('0x2e')];var _0x2d54fc=_0x1bee2e['substring'](_0x1bee2e[_0x1dc1('0x3d')]('/')+0x1,_0x1bee2e[_0x1dc1('0x3d')]('@'));var _0x2867b9=_[_0x1dc1('0x3e')](this[_0x1dc1('0xa')],function(_0x4c8885){return _0x4c8885[_0x1dc1('0x3f')]==_0x2d54fc||_0x4c8885[_0x1dc1('0x40')]==_0x2d54fc||_0x4c8885[_0x1dc1('0x41')]==_0x2d54fc;});if(_0x2867b9){if(_0x2867b9['state']!==_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]()){_0x2867b9[_0x1dc1('0x34')]=_[_0x1dc1('0x36')](moment()['format']('x'));}_0x2867b9[_0x1dc1('0x2f')]=_0x7deb37[_0x1dc1('0x2f')][_0x1dc1('0x31')]();_0x2867b9['local']=!![];_0x2867b9[_0x1dc1('0x35')](_0x7deb37);}}}}catch(_0x20e682){logger['error'](_0x1dc1('0x30'),util['inspect'](_0x20e682,{'showHidden':![],'depth':null}));}};UserReport[_0x1dc1('0x1d')][_0x1dc1('0x42')]=function(_0x2a47b6){try{if(this['isNotNull'](_0x2a47b6)&&this[_0x1dc1('0x1e')](_0x2a47b6[_0x1dc1('0x12')])){logger['info'](_0x1dc1('0x43'),_0x2a47b6[_0x1dc1('0x44')],_0x2a47b6['address'],_0x2a47b6[_0x1dc1('0x12')]);logger[_0x1dc1('0x24')](_0x1dc1('0x45'),util[_0x1dc1('0x16')](_0x2a47b6,{'showHidden':![],'depth':null}));if(this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]]){if(!this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x33')]||_0x2a47b6[_0x1dc1('0x12')]['toLowerCase']()=='registered'){this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x33')]=![];this[_0x1dc1('0xa')][_0x2a47b6[_0x1dc1('0x44')]]['status']=_0x2a47b6['peerstatus'][_0x1dc1('0x31')]();this['agents'][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x46')]=_0x2a47b6[_0x1dc1('0x46')];this['agents'][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x35')](_0x2a47b6);}}else if(this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]]){this['telephones'][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x47')]=_0x2a47b6['peerstatus'][_0x1dc1('0x31')]();this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]][_0x1dc1('0x46')]=_0x2a47b6[_0x1dc1('0x46')];logger[_0x1dc1('0x24')](_0x1dc1('0x48'),util[_0x1dc1('0x16')](this['telephones'][_0x2a47b6[_0x1dc1('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x1dc1('0x38'),this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]]['name']),_0x1dc1('0x39'),this[_0x1dc1('0xb')][_0x2a47b6[_0x1dc1('0x44')]]);}else if(this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]){this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]['status']=_0x2a47b6['peerstatus']['toLowerCase']();this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]['address']=_0x2a47b6[_0x1dc1('0x46')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x1dc1('0x16')](this['trunks'][_0x2a47b6[_0x1dc1('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1dc1('0x2b')]('trunk:%s',this['trunks'][_0x2a47b6[_0x1dc1('0x44')]]['name']),_0x1dc1('0x49'),this[_0x1dc1('0x9')][_0x2a47b6[_0x1dc1('0x44')]]);}}}catch(_0x4d2686){logger['error'](_0x1dc1('0x45'),util[_0x1dc1('0x16')](_0x4d2686,{'showHidden':![],'depth':null}));}};module[_0x1dc1('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d4faf40..a31e799 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7907=['[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','moment','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','queuecallerabandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','event','privilege','custom:agentcalled','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcomplete','agentcompleteAt','transfer','talktime','acw','acwTimeout','agentacw','omit','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','reason','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','syncMusicOnHoldStop'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x7907,0x12d));var _0x7790=function(_0x37c4bb,_0x35760d){_0x37c4bb=_0x37c4bb-0x0;var _0x20d01e=_0x7907[_0x37c4bb];return _0x20d01e;};'use strict';var _=require('lodash');var moment=require(_0x7790('0x0'));var util=require('util');var Redis=require(_0x7790('0x1'));var config=require('../../../config/environment');var logger=require(_0x7790('0x2'))(_0x7790('0x3'));var ami=require('../ami');config[_0x7790('0x4')]=_[_0x7790('0x5')](config[_0x7790('0x4')],{'host':_0x7790('0x6'),'port':0x18eb});var io=require(_0x7790('0x7'))(new Redis(config[_0x7790('0x4')]));function VoiceAgentReport(_0x18f3cf){this[_0x7790('0x8')]={};this[_0x7790('0x9')]=_0x18f3cf[_0x7790('0x9')];this[_0x7790('0xa')]=_0x18f3cf[_0x7790('0xa')];this[_0x7790('0xb')]={};ami['on'](_0x7790('0xc'),this[_0x7790('0xd')][_0x7790('0xe')](this));ami['on']('agentconnect',this[_0x7790('0xf')][_0x7790('0xe')](this));ami['on'](_0x7790('0x10'),this['syncAgentRingNoAnswer'][_0x7790('0xe')](this));ami['on'](_0x7790('0x11'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('agentcomplete',this[_0x7790('0x12')][_0x7790('0xe')](this));ami['on'](_0x7790('0x13'),this[_0x7790('0x14')]['bind'](this));ami['on'](_0x7790('0x15'),this[_0x7790('0x16')][_0x7790('0xe')](this));ami['on'](_0x7790('0x17'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x7790('0x18'),this['syncMusicOnHoldStop'][_0x7790('0xe')](this));ami['on'](_0x7790('0x19'),this[_0x7790('0x1a')][_0x7790('0xe')](this));ami['on'](_0x7790('0x1b'),this['syncBlindTransfer'][_0x7790('0xe')](this));}VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x1d')]=function(_0x4c81bd,_0x8c62ca,_0x2f40b9){io['to'](_0x4c81bd)[_0x7790('0x1d')](_0x8c62ca,_0x2f40b9);};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x1e')]=function(_0x5d75e0){return _0x5d75e0!==null&&!_['isUndefined'](_0x5d75e0);};VoiceAgentReport['prototype'][_0x7790('0xd')]=function(_0x511521){try{if(this['isNotNull'](_0x511521)){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x511521['uniqueid'],_0x511521[_0x7790('0x20')],_0x511521[_0x7790('0x21')]);logger[_0x7790('0x22')](_0x7790('0x23'),_0x511521['uniqueid'],util[_0x7790('0x24')](_0x511521,{'showHidden':![],'depth':null}));if(_[_0x7790('0x25')](this[_0x7790('0x8')][_0x511521[_0x7790('0x26')]])){this[_0x7790('0x8')][_0x511521[_0x7790('0x26')]]={};}if(_[_0x7790('0x25')](this['channels'][_0x511521[_0x7790('0x26')]][_0x511521[_0x7790('0x21')]])){this[_0x7790('0x8')][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]]={'agentcalledAt':moment()[_0x7790('0x27')](_0x7790('0x28')),'lastevent':_0x7790('0x29'),'mandatoryDisposition':this['voiceQueues'][_0x511521[_0x7790('0x2a')]]?this['voiceQueues'][_0x511521[_0x7790('0x2a')]][_0x7790('0x2b')]||![]:![],'type':this[_0x7790('0x9')][_0x511521[_0x7790('0x2a')]]?this[_0x7790('0x9')][_0x511521[_0x7790('0x2a')]][_0x7790('0x2c')]||_0x7790('0x2d'):_0x7790('0x2d'),'variables':this[_0x7790('0xb')][_0x511521[_0x7790('0x26')]]};}_['merge'](this['channels'][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]],_['omit'](_0x511521,[_0x7790('0x2e'),_0x7790('0x2f')]));logger[_0x7790('0x22')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x511521[_0x7790('0x26')],util['inspect'](this['channels'][_0x511521[_0x7790('0x26')]][_0x511521[_0x7790('0x21')]],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x30'),this['channels'][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x511521[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x511521[_0x7790('0x26')]][_0x511521[_0x7790('0x21')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x7790('0x27')]('user:%s',_0x511521[_0x7790('0x20')]),_0x7790('0x31'),this[_0x7790('0x8')][_0x511521['uniqueid']][_0x511521[_0x7790('0x21')]]);}}catch(_0x4b1473){logger[_0x7790('0x32')](_0x7790('0x33'),_0x511521['uniqueid'],util[_0x7790('0x24')](_0x4b1473,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7790('0xf')]=function(_0x44def2){try{if(this[_0x7790('0x1e')](_0x44def2)){if(this['channels'][_0x44def2[_0x7790('0x26')]]){logger['debug'](_0x7790('0x34'),_0x44def2[_0x7790('0x26')],util['inspect'](_0x44def2,{'showHidden':![],'depth':null}));for(var _0x58fd42 in this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]]){if(this['channels'][_0x44def2['uniqueid']][_0x7790('0x35')](_0x58fd42)){if(_0x44def2['destuniqueid']===_0x58fd42){logger[_0x7790('0x1f')](_0x7790('0x36'),_0x44def2[_0x7790('0x26')],_0x44def2['membername'],_0x44def2[_0x7790('0x21')]);this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x37')]=moment()[_0x7790('0x27')](_0x7790('0x28'));this['channels'][_0x44def2['uniqueid']][_0x58fd42][_0x7790('0x38')]=_0x44def2[_0x7790('0x38')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x39')]=_0x44def2['connectedlinenum'];this['channels'][_0x44def2['uniqueid']][_0x58fd42][_0x7790('0x3a')]=_0x44def2[_0x7790('0x3a')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3b')]=_0x44def2[_0x7790('0x3b')];this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3c')]=_0x44def2[_0x7790('0x3c')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3d')]=_0x7790('0x3e');_[_0x7790('0x3f')](this[_0x7790('0xa')][_0x44def2[_0x7790('0x40')]],_[_0x7790('0x41')](_0x44def2,[_0x7790('0x2a'),_0x7790('0x42')]));logger[_0x7790('0x22')](_0x7790('0x43'),_0x44def2[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x44def2['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x44'),this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x44def2[_0x7790('0x21')]]);logger[_0x7790('0x22')](_0x7790('0x45'),_0x44def2[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x44def2[_0x7790('0x21')]],{'showHidden':![],'depth':null}));this[_0x7790('0x1d')](util[_0x7790('0x27')](_0x7790('0x46'),_0x44def2['membername']),_0x7790('0x47'),this['channels'][_0x44def2['uniqueid']][_0x44def2[_0x7790('0x21')]]);}else if(!this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x10')]&&!this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42]['agentcomplete']){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x44def2[_0x7790('0x26')],this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42]['membername'],_0x58fd42);this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42]['agentringnoanswer']=!![];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x48')]=moment()['format'](_0x7790('0x28'));this['channels'][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x49')]=_0x44def2[_0x7790('0x21')];this[_0x7790('0x8')][_0x44def2['uniqueid']][_0x58fd42][_0x7790('0x4a')]=_0x44def2[_0x7790('0x20')];this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42][_0x7790('0x3d')]=_0x7790('0x4b');this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42]['reason']=_0x7790('0x4b');logger[_0x7790('0x22')](_0x7790('0x4c'),_0x44def2[_0x7790('0x26')],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42],{'showHidden':![],'depth':null}));ami['emit'](_0x7790('0x4d'),this[_0x7790('0x8')][_0x44def2[_0x7790('0x26')]][_0x58fd42]);}}}}}}catch(_0x505d7d){logger[_0x7790('0x32')](_0x7790('0x4e'),_0x44def2[_0x7790('0x26')],util[_0x7790('0x24')](_0x505d7d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x4f')]=function(_0x46fea1){try{if(this[_0x7790('0x1e')](_0x46fea1)){logger[_0x7790('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x46fea1[_0x7790('0x26')],util[_0x7790('0x24')](_0x46fea1,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]]&&this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1[_0x7790('0x21')]]){logger['info'](_0x7790('0x50'),_0x46fea1[_0x7790('0x26')],_0x46fea1[_0x7790('0x20')],_0x46fea1['destuniqueid']);this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1['destuniqueid']][_0x7790('0x10')]=!![];this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]][_0x46fea1['destuniqueid']][_0x7790('0x48')]=moment()[_0x7790('0x27')](_0x7790('0x28'));this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]][_0x46fea1[_0x7790('0x21')]]['lastevent']=_0x7790('0x51');this[_0x7790('0x8')][_0x46fea1[_0x7790('0x26')]][_0x46fea1['destuniqueid']]['reason']=_0x7790('0x51');logger[_0x7790('0x22')](_0x7790('0x52'),_0x46fea1['uniqueid'],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1[_0x7790('0x21')]],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')]('custom:agentringnoanswer',this[_0x7790('0x8')][_0x46fea1['uniqueid']][_0x46fea1[_0x7790('0x21')]]);}}}catch(_0x82f533){logger[_0x7790('0x32')](_0x7790('0x53'),_0x46fea1[_0x7790('0x26')],util['inspect'](_0x82f533,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x54')]=function(_0x280d06){try{if(this[_0x7790('0x1e')](_0x280d06)){logger[_0x7790('0x22')](_0x7790('0x55'),_0x280d06[_0x7790('0x26')],util['inspect'](_0x280d06,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]]){for(var _0x367161 in this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]]){if(this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x7790('0x35')](_0x367161)&&!this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x10')]&&!this[_0x7790('0x8')][_0x280d06['uniqueid']][_0x367161]['agentcomplete']){logger[_0x7790('0x1f')](_0x7790('0x56'),_0x280d06[_0x7790('0x26')],this['channels'][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x20')],_0x367161);this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x10')]=!![];this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161]['agentringnoanswerAt']=moment()['format'](_0x7790('0x28'));this['channels'][_0x280d06[_0x7790('0x26')]][_0x367161][_0x7790('0x3d')]='abandoned';this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161]['reason']=_0x7790('0x57');logger[_0x7790('0x22')](_0x7790('0x58'),_0x280d06[_0x7790('0x26')],util['inspect'](this[_0x7790('0x8')][_0x280d06['uniqueid']][_0x367161],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x59'),this[_0x7790('0x8')][_0x280d06[_0x7790('0x26')]][_0x367161]);}}}}}catch(_0x475a84){logger[_0x7790('0x32')](_0x7790('0x5a'),_0x280d06['uniqueid'],util['inspect'](_0x475a84,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')]['syncAgentComplete']=function(_0x2481dd){try{if(this[_0x7790('0x1e')](_0x2481dd)){logger[_0x7790('0x22')](_0x7790('0x5b'),_0x2481dd[_0x7790('0x26')],util[_0x7790('0x24')](_0x2481dd,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]]){for(var _0x49dd29 in this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]]){if(this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]]['hasOwnProperty'](_0x49dd29)){if(this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x37')]&&!this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x5c')]){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2481dd[_0x7790('0x26')],this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x20')],_0x49dd29);this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x5c')]=!![];this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29][_0x7790('0x5d')]=moment()[_0x7790('0x27')](_0x7790('0x28'));this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29][_0x7790('0x3d')]='complete';this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29]['reason']=_0x2481dd['reason']==_0x7790('0x5e')?'agent':_0x2481dd['reason'];this['channels'][_0x2481dd[_0x7790('0x26')]][_0x49dd29][_0x7790('0x5f')]=_0x2481dd[_0x7790('0x5f')];if(this[_0x7790('0x9')][_0x2481dd[_0x7790('0x2a')]]&&this[_0x7790('0x9')][_0x2481dd[_0x7790('0x2a')]][_0x7790('0x60')]){this['channels'][_0x2481dd[_0x7790('0x26')]][_0x49dd29]['acwtime']=this[_0x7790('0x9')][_0x2481dd['queue']][_0x7790('0x61')];this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29][_0x7790('0x62')]=!![];}this[_0x7790('0xa')][_0x2481dd[_0x7790('0x40')]]=_[_0x7790('0x63')](this[_0x7790('0xa')][_0x2481dd[_0x7790('0x40')]],['queue',_0x7790('0x42')]);logger[_0x7790('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x2481dd['uniqueid'],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x2481dd['uniqueid']][_0x49dd29],{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x64'),this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29]);logger[_0x7790('0x22')](_0x7790('0x65'),_0x2481dd[_0x7790('0x26')],util[_0x7790('0x24')](this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29],{'showHidden':![],'depth':null}));this[_0x7790('0x1d')](util[_0x7790('0x27')]('user:%s',_0x2481dd[_0x7790('0x20')]),_0x7790('0x66'),this[_0x7790('0x8')][_0x2481dd[_0x7790('0x26')]][_0x49dd29]);}}}}}}catch(_0x3b0b85){logger[_0x7790('0x32')](_0x7790('0x67'),_0x2481dd[_0x7790('0x26')],util[_0x7790('0x24')](_0x3b0b85,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')]['syncVarSet']=function(_0x5c4a0f){try{if(this[_0x7790('0x1e')](_0x5c4a0f)){logger[_0x7790('0x22')](_0x7790('0x68'),_0x5c4a0f[_0x7790('0x26')],util[_0x7790('0x24')](_0x5c4a0f,{'showHidden':![],'depth':null}));this[_0x7790('0x69')](_0x5c4a0f['uniqueid'],_[_0x7790('0x6a')](_0x5c4a0f[_0x7790('0x6b')])[0x0],_0x5c4a0f['value']);if(this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]]){for(var _0x186e52 in this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]]){if(this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x7790('0x35')](_0x186e52)){logger[_0x7790('0x1f')](_0x7790('0x6c'),_0x5c4a0f[_0x7790('0x26')],_0x186e52,_['keys'](_0x5c4a0f[_0x7790('0x6b')])[0x0],_0x5c4a0f['value']);if(_['isUndefined'](this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x186e52][_0x7790('0xb')])){this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x186e52][_0x7790('0xb')]={};}this[_0x7790('0x8')][_0x5c4a0f[_0x7790('0x26')]][_0x186e52][_0x7790('0xb')]=this[_0x7790('0xb')][_0x5c4a0f['uniqueid']];}}}}}catch(_0x1b72e8){logger[_0x7790('0x32')]('[%s][voiceAgentReport][varset]',_0x5c4a0f['uniqueid'],util[_0x7790('0x24')](_0x1b72e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')]['addVariable']=function(_0x27f9ef,_0x4d7164,_0x23918e){var _0x48e260=[_0x7790('0x6d'),_0x7790('0x6e'),_0x7790('0x6f'),_0x7790('0x70'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x7790('0x71'),_0x7790('0x72'),_0x7790('0x73'),_0x7790('0x74'),_0x7790('0x75'),_0x7790('0x76'),_0x7790('0x77'),_0x7790('0x78'),'membername',_0x7790('0x79'),'memberrealtime'];if(!_[_0x7790('0x7a')](_0x4d7164)&&!_[_0x7790('0x7b')](_0x48e260,_0x4d7164)){if(_[_0x7790('0x25')](this['variables'][_0x27f9ef])){this[_0x7790('0xb')][_0x27f9ef]={};}this[_0x7790('0xb')][_0x27f9ef][_0x4d7164]=_0x23918e;}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x16')]=function(_0x20a3b5){try{if(this[_0x7790('0x1e')](_0x20a3b5)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x20a3b5[_0x7790('0x26')],util[_0x7790('0x24')](_0x20a3b5,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]){for(var _0x2fb141 in this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]){if(this['channels'][_0x20a3b5[_0x7790('0x26')]][_0x7790('0x35')](_0x2fb141)){if(this['channels'][_0x20a3b5['uniqueid']][_0x2fb141][_0x7790('0x7c')]=='transfer'&&this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]][_0x2fb141][_0x7790('0x5c')]){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x20a3b5[_0x7790('0x26')],_0x2fb141);this[_0x7790('0x8')][_0x20a3b5['uniqueid']][_0x2fb141]['agentcompleteAt']=moment()['format'](_0x7790('0x28'));}}}logger[_0x7790('0x22')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x20a3b5[_0x7790('0x26')],util[_0x7790('0x24')](_[_0x7790('0x7d')](this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x7790('0x1d')](_0x7790('0x7e'),_[_0x7790('0x7d')](this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]]));delete this[_0x7790('0x8')][_0x20a3b5[_0x7790('0x26')]];}if(this[_0x7790('0xb')][_0x20a3b5[_0x7790('0x26')]]){delete this[_0x7790('0xb')][_0x20a3b5[_0x7790('0x26')]];}}}catch(_0x3b45c0){logger[_0x7790('0x32')](_0x7790('0x7f'),_0x20a3b5[_0x7790('0x26')],util['inspect'](_0x3b45c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x1a')]=function(_0x23632a){try{if(this[_0x7790('0x1e')](_0x23632a)){logger[_0x7790('0x22')](_0x7790('0x80'),_0x23632a['uniqueid'],util[_0x7790('0x24')](_0x23632a,{'showHidden':![],'depth':null}));if(this[_0x7790('0x8')][_0x23632a['transfereeuniqueid']]){for(var _0x4cec78 in this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]]){if(this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x7790('0x35')](_0x4cec78)){if(_0x23632a[_0x7790('0x82')]===_0x4cec78){logger['info'](_0x7790('0x83'),_0x23632a[_0x7790('0x26')],this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78][_0x7790('0x20')],_0x4cec78);var _0x1d4691=moment();this['channels'][_0x23632a['transfereeuniqueid']][_0x4cec78]['agentcomplete']=!![];this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78]['agentcompleteAt']=moment()[_0x7790('0x27')](_0x7790('0x28'));this['channels'][_0x23632a[_0x7790('0x81')]][_0x4cec78][_0x7790('0x3d')]=_0x7790('0x84');this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78]['reason']=_0x7790('0x5e');this[_0x7790('0x8')][_0x23632a[_0x7790('0x81')]][_0x4cec78]['talktime']=_0x1d4691[_0x7790('0x85')](this['channels'][_0x23632a['transfereeuniqueid']][_0x4cec78]['agentconnectAt'],_0x7790('0x86'));}}}}if(this[_0x7790('0x8')][_0x23632a[_0x7790('0x87')]]){var _0x355632=this[_0x7790('0x8')][_0x23632a[_0x7790('0x87')]];this[_0x7790('0x8')][_0x23632a['secondtransfereruniqueid']]=this[_0x7790('0x8')][_0x23632a['transfereeuniqueid']];this[_0x7790('0x8')][_0x23632a['transfereeuniqueid']]=_0x355632;}}}catch(_0x5693a6){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x23632a[_0x7790('0x26')],util['inspect'](_0x5693a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x88')]=function(_0x25ca03){try{if(this['isNotNull'](_0x25ca03)){logger[_0x7790('0x22')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x25ca03[_0x7790('0x26')],util['inspect'](_0x25ca03,{'showHidden':![],'depth':null}));if(this['channels'][_0x25ca03['transfereeuniqueid']]){for(var _0x5299c1 in this['channels'][_0x25ca03[_0x7790('0x81')]]){if(this['channels'][_0x25ca03[_0x7790('0x81')]][_0x7790('0x35')](_0x5299c1)){if(_0x25ca03[_0x7790('0x89')]===_0x5299c1){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x25ca03[_0x7790('0x26')],this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x20')],_0x5299c1);var _0x35f65d=moment();this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1]['agentcomplete']=!![];this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1]['agentcompleteAt']=_0x35f65d;this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x3d')]='complete';this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x7c')]=_0x7790('0x5e');this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1][_0x7790('0x5f')]=_0x35f65d[_0x7790('0x85')](this[_0x7790('0x8')][_0x25ca03[_0x7790('0x81')]][_0x5299c1]['agentconnectAt'],_0x7790('0x86'));}}}}}}catch(_0x1f78ed){logger[_0x7790('0x32')](_0x7790('0x8a'),_0x25ca03[_0x7790('0x26')],util[_0x7790('0x24')](_0x1f78ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7790('0x1c')][_0x7790('0x8b')]=function(_0x18ed19){var _0x3c0c6a='';try{if(this[_0x7790('0x1e')](_0x18ed19)){logger[_0x7790('0x22')](_0x7790('0x8c'),_0x18ed19[_0x7790('0x26')],util[_0x7790('0x24')](_0x18ed19,{'showHidden':![],'depth':null}));if(_0x18ed19['channel']){_0x3c0c6a=_0x18ed19[_0x7790('0x8d')][_0x7790('0x8e')](0x0,_0x18ed19[_0x7790('0x8d')][_0x7790('0x8f')]('-'));if(this['agents'][_0x3c0c6a]){logger[_0x7790('0x1f')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x18ed19['uniqueid'],_0x3c0c6a);this['agents'][_0x3c0c6a][_0x7790('0x90')]=!![];}}}}catch(_0x47f8c6){logger[_0x7790('0x32')]('[%s][voiceAgentReport][musiconholdstart]',_0x18ed19[_0x7790('0x26')],util[_0x7790('0x24')](_0x47f8c6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7790('0x91')]=function(_0x82ac02){var _0x27755c='';try{if(this['isNotNull'](_0x82ac02)){logger[_0x7790('0x22')](_0x7790('0x92'),_0x82ac02[_0x7790('0x26')],util[_0x7790('0x24')](_0x82ac02,{'showHidden':![],'depth':null}));if(_0x82ac02['channel']){_0x27755c=_0x82ac02[_0x7790('0x8d')][_0x7790('0x8e')](0x0,_0x82ac02[_0x7790('0x8d')][_0x7790('0x8f')]('-'));if(this['agents'][_0x27755c]){logger['info'](_0x7790('0x93'),_0x82ac02[_0x7790('0x26')],_0x27755c);this[_0x7790('0xa')][_0x27755c]['onhold']=![];}}}}catch(_0x5f155a){logger[_0x7790('0x32')]('[%s][voiceAgentReport][musiconholdstop]',_0x82ac02[_0x7790('0x26')],util[_0x7790('0x24')](_0x5f155a,{'showHidden':![],'depth':null}));}};module[_0x7790('0x94')]=VoiceAgentReport; \ No newline at end of file +var _0xf3c9=['variable','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStop','syncAttendedTransfer','emit','isNotNull','isUndefined','prototype','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','keys'];(function(_0x1c6422,_0x1216b3){var _0xce5fa1=function(_0x52f486){while(--_0x52f486){_0x1c6422['push'](_0x1c6422['shift']());}};_0xce5fa1(++_0x1216b3);}(_0xf3c9,0xc4));var _0x9f3c=function(_0x4cbfcc,_0x387bca){_0x4cbfcc=_0x4cbfcc-0x0;var _0x45cad9=_0xf3c9[_0x4cbfcc];return _0x45cad9;};'use strict';var _=require(_0x9f3c('0x0'));var moment=require(_0x9f3c('0x1'));var util=require(_0x9f3c('0x2'));var Redis=require(_0x9f3c('0x3'));var config=require(_0x9f3c('0x4'));var logger=require(_0x9f3c('0x5'))(_0x9f3c('0x6'));var ami=require(_0x9f3c('0x7'));config[_0x9f3c('0x8')]=_[_0x9f3c('0x9')](config[_0x9f3c('0x8')],{'host':_0x9f3c('0xa'),'port':0x18eb});var io=require(_0x9f3c('0xb'))(new Redis(config['redis']));function VoiceAgentReport(_0x2b39d0){this[_0x9f3c('0xc')]={};this[_0x9f3c('0xd')]=_0x2b39d0[_0x9f3c('0xd')];this[_0x9f3c('0xe')]=_0x2b39d0['agents'];this[_0x9f3c('0xf')]={};ami['on'](_0x9f3c('0x10'),this[_0x9f3c('0x11')][_0x9f3c('0x12')](this));ami['on'](_0x9f3c('0x13'),this[_0x9f3c('0x14')][_0x9f3c('0x12')](this));ami['on'](_0x9f3c('0x15'),this[_0x9f3c('0x16')][_0x9f3c('0x12')](this));ami['on']('queuecallerabandon',this[_0x9f3c('0x17')][_0x9f3c('0x12')](this));ami['on']('agentcomplete',this[_0x9f3c('0x18')][_0x9f3c('0x12')](this));ami['on'](_0x9f3c('0x19'),this[_0x9f3c('0x1a')][_0x9f3c('0x12')](this));ami['on'](_0x9f3c('0x1b'),this['syncHangup'][_0x9f3c('0x12')](this));ami['on'](_0x9f3c('0x1c'),this['syncMusicOnHoldStart'][_0x9f3c('0x12')](this));ami['on']('musiconholdstop',this[_0x9f3c('0x1d')][_0x9f3c('0x12')](this));ami['on']('attendedtransfer',this[_0x9f3c('0x1e')][_0x9f3c('0x12')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x9f3c('0x12')](this));}VoiceAgentReport['prototype'][_0x9f3c('0x1f')]=function(_0x4cf85d,_0x52394d,_0x259c3a){io['to'](_0x4cf85d)[_0x9f3c('0x1f')](_0x52394d,_0x259c3a);};VoiceAgentReport['prototype'][_0x9f3c('0x20')]=function(_0xcf780c){return _0xcf780c!==null&&!_[_0x9f3c('0x21')](_0xcf780c);};VoiceAgentReport[_0x9f3c('0x22')]['syncAgentCalled']=function(_0x1b6d9f){try{if(this[_0x9f3c('0x20')](_0x1b6d9f)){logger[_0x9f3c('0x23')](_0x9f3c('0x24'),_0x1b6d9f[_0x9f3c('0x25')],_0x1b6d9f[_0x9f3c('0x26')],_0x1b6d9f[_0x9f3c('0x27')]);logger[_0x9f3c('0x28')](_0x9f3c('0x29'),_0x1b6d9f[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x1b6d9f,{'showHidden':![],'depth':null}));if(_[_0x9f3c('0x21')](this[_0x9f3c('0xc')][_0x1b6d9f['uniqueid']])){this['channels'][_0x1b6d9f[_0x9f3c('0x25')]]={};}if(_['isUndefined'](this['channels'][_0x1b6d9f['uniqueid']][_0x1b6d9f[_0x9f3c('0x27')]])){this[_0x9f3c('0xc')][_0x1b6d9f['uniqueid']][_0x1b6d9f['destuniqueid']]={'agentcalledAt':moment()['format'](_0x9f3c('0x2b')),'lastevent':_0x9f3c('0x2c'),'mandatoryDisposition':this[_0x9f3c('0xd')][_0x1b6d9f[_0x9f3c('0x2d')]]?this['voiceQueues'][_0x1b6d9f['queue']]['mandatoryDisposition']||![]:![],'type':this[_0x9f3c('0xd')][_0x1b6d9f[_0x9f3c('0x2d')]]?this[_0x9f3c('0xd')][_0x1b6d9f[_0x9f3c('0x2d')]][_0x9f3c('0x2e')]||_0x9f3c('0x2f'):_0x9f3c('0x2f'),'variables':this[_0x9f3c('0xf')][_0x1b6d9f[_0x9f3c('0x25')]]};}_['merge'](this[_0x9f3c('0xc')][_0x1b6d9f[_0x9f3c('0x25')]][_0x1b6d9f['destuniqueid']],_[_0x9f3c('0x30')](_0x1b6d9f,[_0x9f3c('0x31'),'privilege']));logger[_0x9f3c('0x28')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x1b6d9f[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](this[_0x9f3c('0xc')][_0x1b6d9f['uniqueid']][_0x1b6d9f[_0x9f3c('0x27')]],{'showHidden':![],'depth':null}));ami[_0x9f3c('0x1f')](_0x9f3c('0x32'),this['channels'][_0x1b6d9f['uniqueid']][_0x1b6d9f['destuniqueid']]);logger[_0x9f3c('0x28')](_0x9f3c('0x33'),_0x1b6d9f[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](this[_0x9f3c('0xc')][_0x1b6d9f['uniqueid']][_0x1b6d9f['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x9f3c('0x1f')](util[_0x9f3c('0x34')](_0x9f3c('0x35'),_0x1b6d9f['membername']),_0x9f3c('0x36'),this[_0x9f3c('0xc')][_0x1b6d9f[_0x9f3c('0x25')]][_0x1b6d9f[_0x9f3c('0x27')]]);}}catch(_0x460def){logger[_0x9f3c('0x37')]('[%s][voiceAgentReport][agentcalled]',_0x1b6d9f['uniqueid'],util[_0x9f3c('0x2a')](_0x460def,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9f3c('0x22')][_0x9f3c('0x14')]=function(_0x3fa22e){try{if(this[_0x9f3c('0x20')](_0x3fa22e)){if(this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]]){logger['debug'](_0x9f3c('0x38'),_0x3fa22e[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x3fa22e,{'showHidden':![],'depth':null}));for(var _0xb27c69 in this['channels'][_0x3fa22e[_0x9f3c('0x25')]]){if(this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0x9f3c('0x39')](_0xb27c69)){if(_0x3fa22e['destuniqueid']===_0xb27c69){logger[_0x9f3c('0x23')](_0x9f3c('0x3a'),_0x3fa22e['uniqueid'],_0x3fa22e['membername'],_0x3fa22e[_0x9f3c('0x27')]);this['channels'][_0x3fa22e['uniqueid']][_0xb27c69]['agentconnectAt']=moment()[_0x9f3c('0x34')](_0x9f3c('0x2b'));this['channels'][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69][_0x9f3c('0x3b')]=_0x3fa22e[_0x9f3c('0x3b')];this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69][_0x9f3c('0x3c')]=_0x3fa22e[_0x9f3c('0x3c')];this['channels'][_0x3fa22e['uniqueid']][_0xb27c69][_0x9f3c('0x3d')]=_0x3fa22e[_0x9f3c('0x3d')];this['channels'][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69][_0x9f3c('0x3e')]=_0x3fa22e['destchannelstatedesc'];this['channels'][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69][_0x9f3c('0x3f')]=_0x3fa22e[_0x9f3c('0x3f')];this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69]['lastevent']=_0x9f3c('0x40');_['merge'](this[_0x9f3c('0xe')][_0x3fa22e[_0x9f3c('0x41')]],_['pick'](_0x3fa22e,['queue',_0x9f3c('0x42')]));logger[_0x9f3c('0x28')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x3fa22e['uniqueid'],util['inspect'](this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0x3fa22e[_0x9f3c('0x27')]],{'showHidden':![],'depth':null}));ami['emit'](_0x9f3c('0x43'),this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0x3fa22e[_0x9f3c('0x27')]]);logger[_0x9f3c('0x28')](_0x9f3c('0x44'),_0x3fa22e[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](this[_0x9f3c('0xc')][_0x3fa22e['uniqueid']][_0x3fa22e[_0x9f3c('0x27')]],{'showHidden':![],'depth':null}));this[_0x9f3c('0x1f')](util['format'](_0x9f3c('0x35'),_0x3fa22e['membername']),'user:agentconnect',this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0x3fa22e[_0x9f3c('0x27')]]);}else if(!this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69][_0x9f3c('0x15')]&&!this[_0x9f3c('0xc')][_0x3fa22e['uniqueid']][_0xb27c69][_0x9f3c('0x45')]){logger[_0x9f3c('0x23')](_0x9f3c('0x46'),_0x3fa22e[_0x9f3c('0x25')],this['channels'][_0x3fa22e['uniqueid']][_0xb27c69][_0x9f3c('0x26')],_0xb27c69);this['channels'][_0x3fa22e['uniqueid']][_0xb27c69][_0x9f3c('0x15')]=!![];this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69]['agentringnoanswerAt']=moment()[_0x9f3c('0x34')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69]['answeredelsewheredestinationuniqueid']=_0x3fa22e['destuniqueid'];this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69]['answeredelsewheremembername']=_0x3fa22e[_0x9f3c('0x26')];this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69]['lastevent']='answered_elsewhere';this[_0x9f3c('0xc')][_0x3fa22e['uniqueid']][_0xb27c69][_0x9f3c('0x47')]=_0x9f3c('0x48');logger[_0x9f3c('0x28')](_0x9f3c('0x49'),_0x3fa22e[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](this[_0x9f3c('0xc')][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69],{'showHidden':![],'depth':null}));ami[_0x9f3c('0x1f')]('custom:agentansweredelsewhere',this['channels'][_0x3fa22e[_0x9f3c('0x25')]][_0xb27c69]);}}}}}}catch(_0x3ae75b){logger[_0x9f3c('0x37')](_0x9f3c('0x4a'),_0x3fa22e[_0x9f3c('0x25')],util['inspect'](_0x3ae75b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9f3c('0x22')][_0x9f3c('0x16')]=function(_0x5dc3d3){try{if(this[_0x9f3c('0x20')](_0x5dc3d3)){logger[_0x9f3c('0x28')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5dc3d3[_0x9f3c('0x25')],util['inspect'](_0x5dc3d3,{'showHidden':![],'depth':null}));if(this[_0x9f3c('0xc')][_0x5dc3d3[_0x9f3c('0x25')]]&&this[_0x9f3c('0xc')][_0x5dc3d3['uniqueid']][_0x5dc3d3['destuniqueid']]){logger[_0x9f3c('0x23')](_0x9f3c('0x4b'),_0x5dc3d3[_0x9f3c('0x25')],_0x5dc3d3[_0x9f3c('0x26')],_0x5dc3d3[_0x9f3c('0x27')]);this[_0x9f3c('0xc')][_0x5dc3d3['uniqueid']][_0x5dc3d3[_0x9f3c('0x27')]][_0x9f3c('0x15')]=!![];this['channels'][_0x5dc3d3[_0x9f3c('0x25')]][_0x5dc3d3[_0x9f3c('0x27')]]['agentringnoanswerAt']=moment()[_0x9f3c('0x34')](_0x9f3c('0x2b'));this[_0x9f3c('0xc')][_0x5dc3d3[_0x9f3c('0x25')]][_0x5dc3d3[_0x9f3c('0x27')]][_0x9f3c('0x4c')]='rejected';this[_0x9f3c('0xc')][_0x5dc3d3['uniqueid']][_0x5dc3d3[_0x9f3c('0x27')]]['reason']=_0x9f3c('0x4d');logger[_0x9f3c('0x28')](_0x9f3c('0x4e'),_0x5dc3d3[_0x9f3c('0x25')],util['inspect'](this[_0x9f3c('0xc')][_0x5dc3d3['uniqueid']][_0x5dc3d3[_0x9f3c('0x27')]],{'showHidden':![],'depth':null}));ami[_0x9f3c('0x1f')](_0x9f3c('0x4f'),this[_0x9f3c('0xc')][_0x5dc3d3['uniqueid']][_0x5dc3d3[_0x9f3c('0x27')]]);}}}catch(_0x11ecbd){logger[_0x9f3c('0x37')](_0x9f3c('0x50'),_0x5dc3d3[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x11ecbd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9f3c('0x17')]=function(_0x428af2){try{if(this['isNotNull'](_0x428af2)){logger['debug'](_0x9f3c('0x51'),_0x428af2[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x428af2,{'showHidden':![],'depth':null}));if(this[_0x9f3c('0xc')][_0x428af2[_0x9f3c('0x25')]]){for(var _0x572ed1 in this[_0x9f3c('0xc')][_0x428af2['uniqueid']]){if(this['channels'][_0x428af2[_0x9f3c('0x25')]][_0x9f3c('0x39')](_0x572ed1)&&!this['channels'][_0x428af2['uniqueid']][_0x572ed1][_0x9f3c('0x15')]&&!this[_0x9f3c('0xc')][_0x428af2[_0x9f3c('0x25')]][_0x572ed1][_0x9f3c('0x45')]){logger['info'](_0x9f3c('0x52'),_0x428af2[_0x9f3c('0x25')],this[_0x9f3c('0xc')][_0x428af2[_0x9f3c('0x25')]][_0x572ed1][_0x9f3c('0x26')],_0x572ed1);this[_0x9f3c('0xc')][_0x428af2[_0x9f3c('0x25')]][_0x572ed1]['agentringnoanswer']=!![];this[_0x9f3c('0xc')][_0x428af2['uniqueid']][_0x572ed1][_0x9f3c('0x53')]=moment()['format'](_0x9f3c('0x2b'));this[_0x9f3c('0xc')][_0x428af2['uniqueid']][_0x572ed1]['lastevent']='abandoned';this[_0x9f3c('0xc')][_0x428af2[_0x9f3c('0x25')]][_0x572ed1]['reason']=_0x9f3c('0x54');logger[_0x9f3c('0x28')](_0x9f3c('0x55'),_0x428af2[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](this[_0x9f3c('0xc')][_0x428af2[_0x9f3c('0x25')]][_0x572ed1],{'showHidden':![],'depth':null}));ami[_0x9f3c('0x1f')](_0x9f3c('0x56'),this[_0x9f3c('0xc')][_0x428af2['uniqueid']][_0x572ed1]);}}}}}catch(_0x142d17){logger[_0x9f3c('0x37')](_0x9f3c('0x57'),_0x428af2['uniqueid'],util['inspect'](_0x142d17,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9f3c('0x18')]=function(_0x284371){try{if(this[_0x9f3c('0x20')](_0x284371)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x284371[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x284371,{'showHidden':![],'depth':null}));if(this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]]){for(var _0x5a56ad in this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]]){if(this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x9f3c('0x39')](_0x5a56ad)){if(this[_0x9f3c('0xc')][_0x284371['uniqueid']][_0x5a56ad][_0x9f3c('0x58')]&&!this[_0x9f3c('0xc')][_0x284371['uniqueid']][_0x5a56ad][_0x9f3c('0x45')]){logger[_0x9f3c('0x23')](_0x9f3c('0x59'),_0x284371[_0x9f3c('0x25')],this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad]['membername'],_0x5a56ad);this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad][_0x9f3c('0x45')]=!![];this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad][_0x9f3c('0x5a')]=moment()[_0x9f3c('0x34')](_0x9f3c('0x2b'));this['channels'][_0x284371[_0x9f3c('0x25')]][_0x5a56ad][_0x9f3c('0x4c')]=_0x9f3c('0x5b');this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad][_0x9f3c('0x47')]=_0x284371[_0x9f3c('0x47')]=='transfer'?_0x9f3c('0x5c'):_0x284371[_0x9f3c('0x47')];this[_0x9f3c('0xc')][_0x284371['uniqueid']][_0x5a56ad][_0x9f3c('0x5d')]=_0x284371[_0x9f3c('0x5d')];if(this[_0x9f3c('0xd')][_0x284371[_0x9f3c('0x2d')]]&&this[_0x9f3c('0xd')][_0x284371[_0x9f3c('0x2d')]][_0x9f3c('0x5e')]){this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad][_0x9f3c('0x5f')]=this['voiceQueues'][_0x284371['queue']][_0x9f3c('0x60')];this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad][_0x9f3c('0x61')]=!![];}this[_0x9f3c('0xe')][_0x284371[_0x9f3c('0x41')]]=_[_0x9f3c('0x30')](this[_0x9f3c('0xe')][_0x284371[_0x9f3c('0x41')]],[_0x9f3c('0x2d'),_0x9f3c('0x42')]);logger[_0x9f3c('0x28')](_0x9f3c('0x62'),_0x284371['uniqueid'],util[_0x9f3c('0x2a')](this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad],{'showHidden':![],'depth':null}));ami['emit'](_0x9f3c('0x63'),this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad]);logger[_0x9f3c('0x28')](_0x9f3c('0x64'),_0x284371['uniqueid'],util[_0x9f3c('0x2a')](this[_0x9f3c('0xc')][_0x284371[_0x9f3c('0x25')]][_0x5a56ad],{'showHidden':![],'depth':null}));this[_0x9f3c('0x1f')](util[_0x9f3c('0x34')](_0x9f3c('0x35'),_0x284371[_0x9f3c('0x26')]),_0x9f3c('0x65'),this[_0x9f3c('0xc')][_0x284371['uniqueid']][_0x5a56ad]);}}}}}}catch(_0x551970){logger[_0x9f3c('0x37')]('[%s][voiceAgentReport][agentcomplete]',_0x284371[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x551970,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9f3c('0x22')][_0x9f3c('0x1a')]=function(_0x5403d3){try{if(this[_0x9f3c('0x20')](_0x5403d3)){logger[_0x9f3c('0x28')](_0x9f3c('0x66'),_0x5403d3[_0x9f3c('0x25')],util['inspect'](_0x5403d3,{'showHidden':![],'depth':null}));this['addVariable'](_0x5403d3[_0x9f3c('0x25')],_['keys'](_0x5403d3['variable'])[0x0],_0x5403d3['value']);if(this['channels'][_0x5403d3[_0x9f3c('0x25')]]){for(var _0x3272bb in this[_0x9f3c('0xc')][_0x5403d3['uniqueid']]){if(this['channels'][_0x5403d3[_0x9f3c('0x25')]][_0x9f3c('0x39')](_0x3272bb)){logger[_0x9f3c('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x5403d3[_0x9f3c('0x25')],_0x3272bb,_[_0x9f3c('0x67')](_0x5403d3[_0x9f3c('0x68')])[0x0],_0x5403d3[_0x9f3c('0x69')]);if(_[_0x9f3c('0x21')](this['channels'][_0x5403d3[_0x9f3c('0x25')]][_0x3272bb][_0x9f3c('0xf')])){this[_0x9f3c('0xc')][_0x5403d3[_0x9f3c('0x25')]][_0x3272bb][_0x9f3c('0xf')]={};}this['channels'][_0x5403d3[_0x9f3c('0x25')]][_0x3272bb][_0x9f3c('0xf')]=this[_0x9f3c('0xf')][_0x5403d3[_0x9f3c('0x25')]];}}}}}catch(_0x4d0047){logger['error'](_0x9f3c('0x6a'),_0x5403d3[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x4d0047,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9f3c('0x22')][_0x9f3c('0x6b')]=function(_0x17022a,_0x348ce4,_0x3be4a9){var _0x3f4d67=[_0x9f3c('0x6c'),_0x9f3c('0x6d'),_0x9f3c('0x6e'),'rtpaudioqosjitterbridged',_0x9f3c('0x6f'),'rtpaudioqoslossbridged',_0x9f3c('0x70'),_0x9f3c('0x71'),_0x9f3c('0x72'),_0x9f3c('0x73'),_0x9f3c('0x74'),_0x9f3c('0x75'),_0x9f3c('0x76'),'memberdynamic','memberinterface',_0x9f3c('0x77'),_0x9f3c('0x26'),_0x9f3c('0x78'),_0x9f3c('0x79')];if(!_[_0x9f3c('0x7a')](_0x348ce4)&&!_['includes'](_0x3f4d67,_0x348ce4)){if(_[_0x9f3c('0x21')](this['variables'][_0x17022a])){this[_0x9f3c('0xf')][_0x17022a]={};}this[_0x9f3c('0xf')][_0x17022a][_0x348ce4]=_0x3be4a9;}};VoiceAgentReport[_0x9f3c('0x22')][_0x9f3c('0x7b')]=function(_0x13ec8e){try{if(this[_0x9f3c('0x20')](_0x13ec8e)){logger['debug'](_0x9f3c('0x7c'),_0x13ec8e[_0x9f3c('0x25')],util['inspect'](_0x13ec8e,{'showHidden':![],'depth':null}));if(this[_0x9f3c('0xc')][_0x13ec8e[_0x9f3c('0x25')]]){for(var _0x3ccc84 in this[_0x9f3c('0xc')][_0x13ec8e[_0x9f3c('0x25')]]){if(this[_0x9f3c('0xc')][_0x13ec8e[_0x9f3c('0x25')]][_0x9f3c('0x39')](_0x3ccc84)){if(this[_0x9f3c('0xc')][_0x13ec8e[_0x9f3c('0x25')]][_0x3ccc84]['reason']==_0x9f3c('0x7d')&&this[_0x9f3c('0xc')][_0x13ec8e[_0x9f3c('0x25')]][_0x3ccc84]['agentcomplete']){logger['info'](_0x9f3c('0x7e'),_0x13ec8e[_0x9f3c('0x25')],_0x3ccc84);this[_0x9f3c('0xc')][_0x13ec8e[_0x9f3c('0x25')]][_0x3ccc84][_0x9f3c('0x5a')]=moment()[_0x9f3c('0x34')](_0x9f3c('0x2b'));}}}logger[_0x9f3c('0x28')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x13ec8e['uniqueid'],util['inspect'](_[_0x9f3c('0x7f')](this['channels'][_0x13ec8e[_0x9f3c('0x25')]]),{'showHidden':![],'depth':null}));ami[_0x9f3c('0x1f')](_0x9f3c('0x80'),_[_0x9f3c('0x7f')](this['channels'][_0x13ec8e['uniqueid']]));delete this[_0x9f3c('0xc')][_0x13ec8e[_0x9f3c('0x25')]];}if(this[_0x9f3c('0xf')][_0x13ec8e[_0x9f3c('0x25')]]){delete this['variables'][_0x13ec8e['uniqueid']];}}}catch(_0x356daa){logger['error']('[%s][voiceAgentReport][hangup]',_0x13ec8e[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x356daa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9f3c('0x22')]['syncAttendedTransfer']=function(_0xcc838){try{if(this['isNotNull'](_0xcc838)){logger[_0x9f3c('0x28')](_0x9f3c('0x81'),_0xcc838['uniqueid'],util[_0x9f3c('0x2a')](_0xcc838,{'showHidden':![],'depth':null}));if(this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]]){for(var _0x105d83 in this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]]){if(this[_0x9f3c('0xc')][_0xcc838['transfereeuniqueid']]['hasOwnProperty'](_0x105d83)){if(_0xcc838[_0x9f3c('0x83')]===_0x105d83){logger[_0x9f3c('0x23')](_0x9f3c('0x84'),_0xcc838[_0x9f3c('0x25')],this[_0x9f3c('0xc')][_0xcc838['transfereeuniqueid']][_0x105d83][_0x9f3c('0x26')],_0x105d83);var _0x204099=moment();this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]][_0x105d83][_0x9f3c('0x45')]=!![];this[_0x9f3c('0xc')][_0xcc838['transfereeuniqueid']][_0x105d83][_0x9f3c('0x5a')]=moment()[_0x9f3c('0x34')](_0x9f3c('0x2b'));this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]][_0x105d83][_0x9f3c('0x4c')]=_0x9f3c('0x5b');this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]][_0x105d83][_0x9f3c('0x47')]=_0x9f3c('0x7d');this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]][_0x105d83]['talktime']=_0x204099[_0x9f3c('0x85')](this['channels'][_0xcc838['transfereeuniqueid']][_0x105d83][_0x9f3c('0x58')],_0x9f3c('0x86'));}}}}if(this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x87')]]){var _0x2c9fb7=this['channels'][_0xcc838[_0x9f3c('0x87')]];this['channels'][_0xcc838['secondtransfereruniqueid']]=this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]];this[_0x9f3c('0xc')][_0xcc838[_0x9f3c('0x82')]]=_0x2c9fb7;}}}catch(_0xd9210b){logger[_0x9f3c('0x37')](_0x9f3c('0x88'),_0xcc838['uniqueid'],util[_0x9f3c('0x2a')](_0xd9210b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9f3c('0x22')][_0x9f3c('0x89')]=function(_0x26c7af){try{if(this[_0x9f3c('0x20')](_0x26c7af)){logger[_0x9f3c('0x28')](_0x9f3c('0x8a'),_0x26c7af[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x26c7af,{'showHidden':![],'depth':null}));if(this[_0x9f3c('0xc')][_0x26c7af[_0x9f3c('0x82')]]){for(var _0xca5a75 in this['channels'][_0x26c7af['transfereeuniqueid']]){if(this[_0x9f3c('0xc')][_0x26c7af[_0x9f3c('0x82')]][_0x9f3c('0x39')](_0xca5a75)){if(_0x26c7af[_0x9f3c('0x8b')]===_0xca5a75){logger[_0x9f3c('0x23')](_0x9f3c('0x8c'),_0x26c7af[_0x9f3c('0x25')],this['channels'][_0x26c7af[_0x9f3c('0x82')]][_0xca5a75]['membername'],_0xca5a75);var _0x1cc8b8=moment();this[_0x9f3c('0xc')][_0x26c7af[_0x9f3c('0x82')]][_0xca5a75][_0x9f3c('0x45')]=!![];this[_0x9f3c('0xc')][_0x26c7af[_0x9f3c('0x82')]][_0xca5a75][_0x9f3c('0x5a')]=_0x1cc8b8;this[_0x9f3c('0xc')][_0x26c7af[_0x9f3c('0x82')]][_0xca5a75][_0x9f3c('0x4c')]=_0x9f3c('0x5b');this[_0x9f3c('0xc')][_0x26c7af[_0x9f3c('0x82')]][_0xca5a75][_0x9f3c('0x47')]=_0x9f3c('0x7d');this['channels'][_0x26c7af[_0x9f3c('0x82')]][_0xca5a75]['talktime']=_0x1cc8b8[_0x9f3c('0x85')](this[_0x9f3c('0xc')][_0x26c7af[_0x9f3c('0x82')]][_0xca5a75][_0x9f3c('0x58')],_0x9f3c('0x86'));}}}}}}catch(_0x5f1810){logger[_0x9f3c('0x37')](_0x9f3c('0x8d'),_0x26c7af[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x5f1810,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9f3c('0x8e')]=function(_0x5ef4e9){var _0x5031bd='';try{if(this['isNotNull'](_0x5ef4e9)){logger[_0x9f3c('0x28')](_0x9f3c('0x8f'),_0x5ef4e9[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x5ef4e9,{'showHidden':![],'depth':null}));if(_0x5ef4e9[_0x9f3c('0x90')]){_0x5031bd=_0x5ef4e9[_0x9f3c('0x90')]['substring'](0x0,_0x5ef4e9[_0x9f3c('0x90')]['lastIndexOf']('-'));if(this['agents'][_0x5031bd]){logger[_0x9f3c('0x23')](_0x9f3c('0x91'),_0x5ef4e9['uniqueid'],_0x5031bd);this[_0x9f3c('0xe')][_0x5031bd]['onhold']=!![];}}}}catch(_0x33f7a0){logger[_0x9f3c('0x37')]('[%s][voiceAgentReport][musiconholdstart]',_0x5ef4e9[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x33f7a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9f3c('0x22')][_0x9f3c('0x1d')]=function(_0x1effb4){var _0x37c5d4='';try{if(this[_0x9f3c('0x20')](_0x1effb4)){logger[_0x9f3c('0x28')](_0x9f3c('0x92'),_0x1effb4[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x1effb4,{'showHidden':![],'depth':null}));if(_0x1effb4[_0x9f3c('0x90')]){_0x37c5d4=_0x1effb4[_0x9f3c('0x90')][_0x9f3c('0x93')](0x0,_0x1effb4[_0x9f3c('0x90')][_0x9f3c('0x94')]('-'));if(this[_0x9f3c('0xe')][_0x37c5d4]){logger['info'](_0x9f3c('0x95'),_0x1effb4[_0x9f3c('0x25')],_0x37c5d4);this[_0x9f3c('0xe')][_0x37c5d4]['onhold']=![];}}}}catch(_0x5079b8){logger[_0x9f3c('0x37')]('[%s][voiceAgentReport][musiconholdstop]',_0x1effb4[_0x9f3c('0x25')],util[_0x9f3c('0x2a')](_0x5079b8,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 9400fe1..35237de 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5530=['syncNewState','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','syncNewChannel','debug','channel','OutgoingSpoolFailed','exten','starttime','format','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','emit','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','.wav49','replace','.WAV','monitorFilename','find','isNil','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','diff','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','stopRecordingOnTransfer','Action','catch','StopMixMonitor','destinationchannel','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/logger','../ami','../rpc/setting','not_inuse','inuse','busy','invalid','ringinuse','onhold','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','BUSY','defaults','localhost','socket.io-emitter','redis','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0x5530,0xa7));var _0x0553=function(_0x1a34c3,_0x4e2475){_0x1a34c3=_0x1a34c3-0x0;var _0x37fc3e=_0x5530[_0x1a34c3];return _0x37fc3e;};'use strict';var BPromise=require(_0x0553('0x0'));var _=require('lodash');var moment=require(_0x0553('0x1'));var util=require(_0x0553('0x2'));var path=require(_0x0553('0x3'));var Redis=require(_0x0553('0x4'));var config=require('../../../config/environment');var logger=require(_0x0553('0x5'))('ami');var ami=require(_0x0553('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x0553('0x7'));var statusDesc=['unknown',_0x0553('0x8'),_0x0553('0x9'),_0x0553('0xa'),_0x0553('0xb'),'unavailable','ringing',_0x0553('0xc'),_0x0553('0xd')];var applications=[_0x0553('0xe'),_0x0553('0xf'),_0x0553('0x10'),_0x0553('0x11'),_0x0553('0x12'),'voicemail'];var dispositions=['NO\x20ANSWER',_0x0553('0x13'),_0x0553('0x13'),_0x0553('0x14'),_0x0553('0x14'),_0x0553('0x14'),_0x0553('0x15'),_0x0553('0x16'),_0x0553('0x13'),_0x0553('0x13'),_0x0553('0x13')];var actions={};config['redis']=_[_0x0553('0x17')](config['redis'],{'host':_0x0553('0x18'),'port':0x18eb});var io=require(_0x0553('0x19'))(new Redis(config[_0x0553('0x1a')]));function VoiceCallReport(_0x5cea27){this[_0x0553('0x1b')]=_0x5cea27['channels'];this['agents']=_0x5cea27[_0x0553('0x1c')];this[_0x0553('0x1d')]={};ami['on'](_0x0553('0x1e'),this[_0x0553('0x1f')][_0x0553('0x20')](this));ami['on'](_0x0553('0x21'),this[_0x0553('0x1f')]['bind'](this));ami['on'](_0x0553('0x22'),this['syncNewChannel'][_0x0553('0x20')](this));ami['on'](_0x0553('0x23'),this[_0x0553('0x24')][_0x0553('0x20')](this));ami['on']('varset',this['syncVarSet'][_0x0553('0x20')](this));ami['on'](_0x0553('0x25'),this[_0x0553('0x26')][_0x0553('0x20')](this));ami['on']('newcallerid',this[_0x0553('0x27')]['bind'](this));ami['on'](_0x0553('0x28'),this[_0x0553('0x29')]['bind'](this));ami['on'](_0x0553('0x2a'),this[_0x0553('0x2b')][_0x0553('0x20')](this));ami['on']('musiconholdstart',this[_0x0553('0x2c')][_0x0553('0x20')](this));ami['on'](_0x0553('0x2d'),this[_0x0553('0x2e')][_0x0553('0x20')](this));try{logger[_0x0553('0x2f')](_0x0553('0x30'));ami[_0x0553('0x31')]();}catch(_0x26ad9b){logger[_0x0553('0x32')](_0x0553('0x33'),util[_0x0553('0x34')](_0x26ad9b,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x0553('0x35')]=function(_0xf40d1b){return _0xf40d1b!==null&&!_[_0x0553('0x36')](_0xf40d1b);};VoiceCallReport[_0x0553('0x37')]['emit']=function(_0x54b12a,_0x4ba145,_0x14f389){io['to'](_0x54b12a)['emit'](_0x4ba145,_0x14f389);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x366b5d){try{if(this[_0x0553('0x35')](_0x366b5d)){logger[_0x0553('0x2f')](_0x0553('0x38'),_0x366b5d[_0x0553('0x39')],_0x366b5d[_0x0553('0x3a')],_0x366b5d['calleridnum']);logger['debug'](_0x0553('0x3b'),_0x366b5d[_0x0553('0x39')],util[_0x0553('0x34')](_0x366b5d,{'showHidden':![],'depth':null}));if(_0x366b5d[_0x0553('0x39')]===_0x366b5d[_0x0553('0x3c')]){if(!_[_0x0553('0x36')](this[_0x0553('0x1b')][_0x366b5d[_0x0553('0x39')]])){_[_0x0553('0x3d')](this['channels'][_0x366b5d[_0x0553('0x39')]],_[_0x0553('0x3e')](_0x366b5d,_[_0x0553('0x3f')](this['channels'][_0x366b5d[_0x0553('0x39')]])));}}}}catch(_0x3d360c){logger[_0x0553('0x32')]('[%s][voiceCallReport][newcallerid]',_0x366b5d['uniqueid'],util[_0x0553('0x34')](_0x3d360c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x40')]=function(_0x2867b5){try{if(this[_0x0553('0x35')](_0x2867b5)){logger[_0x0553('0x41')]('[%s][voiceCallReport][newchannel]\x20event:',_0x2867b5[_0x0553('0x39')],util[_0x0553('0x34')](_0x2867b5,{'showHidden':![],'depth':null}));if(_0x2867b5[_0x0553('0x39')]===_0x2867b5['linkedid']&&_0x2867b5[_0x0553('0x42')]!=_0x0553('0x43')){if(_[_0x0553('0x36')](this[_0x0553('0x1b')][_0x2867b5['uniqueid']])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x2867b5[_0x0553('0x39')],_0x2867b5['context'],_0x2867b5[_0x0553('0x44')]);this['channels'][_0x2867b5[_0x0553('0x39')]]=new Channel();this[_0x0553('0x1b')][_0x2867b5[_0x0553('0x39')]][_0x0553('0x45')]=moment()[_0x0553('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0553('0x1b')][_0x2867b5['uniqueid']][_0x0553('0x47')]=dispositions[_[_0x0553('0x48')](_0x2867b5[_0x0553('0x49')])];_['merge'](this['channels'][_0x2867b5['uniqueid']],_[_0x0553('0x3e')](_0x2867b5,_['keys'](this[_0x0553('0x1b')][_0x2867b5[_0x0553('0x39')]])));if(_0x2867b5[_0x0553('0x4a')]===_0x0553('0x4b')){if(this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]){this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x4d')]=_0x2867b5[_0x0553('0x44')];logger[_0x0553('0x41')](_0x0553('0x4e'),_0x2867b5[_0x0553('0x39')],util[_0x0553('0x34')]({'destaccountcode':this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x4f')],'destconnectedlinenum':_0x2867b5[_0x0553('0x44')]},{'showHidden':![],'depth':null}));this[_0x0553('0x50')](util['format'](_0x0553('0x51'),this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x52')]),_0x0553('0x53'),{'destaccountcode':this[_0x0553('0x1c')][_0x2867b5[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2867b5[_0x0553('0x44')]});}}}}}}catch(_0x4f090c){logger[_0x0553('0x32')](_0x0553('0x54'),_0x2867b5['uniqueid'],util[_0x0553('0x34')](_0x4f090c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0553('0x1f')]=function(_0x47c0b5){try{if(this[_0x0553('0x35')](_0x47c0b5)){logger[_0x0553('0x41')](_0x0553('0x55'),_0x47c0b5[_0x0553('0x39')],util['inspect'](_0x47c0b5,{'showHidden':![],'depth':null}));if(_0x47c0b5[_0x0553('0x39')]===_0x47c0b5['linkedid']&&_0x47c0b5[_0x0553('0x44')]!='h'&&_0x47c0b5[_0x0553('0x42')]!=_0x0553('0x43')){_0x47c0b5[_0x0553('0x56')]=_0x47c0b5[_0x0553('0x56')][_0x0553('0x57')]();_0x47c0b5[_0x0553('0x58')]=(_0x47c0b5[_0x0553('0x59')]||_0x47c0b5['applicationdata'])[_0x0553('0x57')]();logger[_0x0553('0x2f')](_0x0553('0x5a'),_0x47c0b5[_0x0553('0x39')],_0x47c0b5['application'],_0x47c0b5[_0x0553('0x58')]);if(_[_0x0553('0x36')](this['channels'][_0x47c0b5[_0x0553('0x39')]])){this['channels'][_0x47c0b5[_0x0553('0x39')]]=new Channel();this[_0x0553('0x1b')][_0x47c0b5['uniqueid']][_0x0553('0x45')]=_0x47c0b5['duration']?moment()[_0x0553('0x5b')](moment[_0x0553('0x5c')](_0x47c0b5[_0x0553('0x5c')])[_0x0553('0x5d')](),'seconds')[_0x0553('0x46')](_0x0553('0x5e')):moment()[_0x0553('0x46')](_0x0553('0x5e'));this[_0x0553('0x1b')][_0x47c0b5['uniqueid']][_0x0553('0x47')]=_0x0553('0x14');}_[_0x0553('0x3d')](this[_0x0553('0x1b')][_0x47c0b5[_0x0553('0x39')]],_[_0x0553('0x3e')](_0x47c0b5,_['keys'](this[_0x0553('0x1b')][_0x47c0b5['uniqueid']])));if(_[_0x0553('0x5f')](applications,_0x47c0b5['application'])){this[_0x0553('0x1b')][_0x47c0b5['uniqueid']][_0x0553('0x60')]=_0x47c0b5[_0x0553('0x56')];this[_0x0553('0x1b')][_0x47c0b5[_0x0553('0x39')]][_0x0553('0x61')]=_0x47c0b5['applicationdata'];if(_0x47c0b5['application']===_0x0553('0xe')&&_[_0x0553('0x62')](_0x47c0b5[_0x0553('0x58')],_0x0553('0x63'))){var _0x193f1b=_0x47c0b5['applicationdata'][_0x0553('0x4c')]('=');var _0x142cfd=_0x193f1b[0x0]['match'](/cdr\((.*)\)/);if(_0x142cfd){this[_0x0553('0x1b')][_0x47c0b5[_0x0553('0x39')]][_0x142cfd[0x1]]=_0x193f1b[0x1];}}else if(_0x47c0b5[_0x0553('0x56')]==='queue'){this['channels'][_0x47c0b5[_0x0553('0x39')]][_0x0553('0xf')]=_0x47c0b5['applicationdata'][_0x0553('0x4c')](',')[0x0];}}}}}catch(_0x46da72){logger['error']('[%s][voiceCallReport][newexten]',_0x47c0b5[_0x0553('0x39')],util[_0x0553('0x34')](_0x46da72,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0553('0x24')]=function(_0x1fa50f){try{if(this[_0x0553('0x35')](_0x1fa50f)){logger[_0x0553('0x2f')](_0x0553('0x64'),_0x1fa50f[_0x0553('0x39')],_0x1fa50f[_0x0553('0x3c')],_0x1fa50f['calleridname'],_0x1fa50f[_0x0553('0x65')]);logger[_0x0553('0x41')](_0x0553('0x66'),_0x1fa50f[_0x0553('0x39')],util['inspect'](_0x1fa50f,{'showHidden':![],'depth':null}));if(_0x1fa50f[_0x0553('0x39')]!==_0x1fa50f['linkedid']){if(this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]){if(_0x1fa50f[_0x0553('0x49')]==='6'){if(!this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x67')]){var _0x528e7e=moment();this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x67')]=!![];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x68')]=_0x528e7e['format'](_0x0553('0x5e'));if(this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['starttime']){this['channels'][_0x1fa50f['linkedid']][_0x0553('0x69')]=_0x528e7e['diff'](this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['starttime'],_0x0553('0x5d'));}}this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x3c')]=_0x1fa50f[_0x0553('0x39')];if(_0x1fa50f[_0x0553('0x65')]!==_0x0553('0x6a')){this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['connectedlinenum']=_0x1fa50f[_0x0553('0x65')];}this['channels'][_0x1fa50f[_0x0553('0x3c')]]['connectedlinename']=_0x1fa50f[_0x0553('0x3a')];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['destinationchannel']=_0x1fa50f[_0x0553('0x42')];this[_0x0553('0x1b')][_0x1fa50f['linkedid']][_0x0553('0x47')]=dispositions[_['toNumber'](_0x1fa50f[_0x0553('0x49')])];if(this['agents'][_0x1fa50f['channel']['split']('-')[0x0]]){this['channels'][_0x1fa50f[_0x0553('0x3c')]][_0x0553('0x6b')]=this['agents'][_0x1fa50f[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]['id'];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x3c')]]['membername']=this[_0x0553('0x1c')][_0x1fa50f['channel'][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x52')];}}}}else{if(this['channels'][_0x1fa50f[_0x0553('0x39')]]){if(_0x1fa50f[_0x0553('0x49')]==='6'){if(this[_0x0553('0x1c')][_0x1fa50f['channel']['split']('-')[0x0]]){this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x39')]][_0x0553('0x6b')]=this['agents'][_0x1fa50f['channel']['split']('-')[0x0]]['id'];this[_0x0553('0x1b')][_0x1fa50f[_0x0553('0x39')]]['membername']=this[_0x0553('0x1c')][_0x1fa50f[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]['name'];}}}}}}catch(_0x377dfc){logger[_0x0553('0x32')](_0x0553('0x6c'),_0x1fa50f[_0x0553('0x39')],util[_0x0553('0x34')](_0x377dfc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x6d')]=function(_0x4daa5,_0x101299){try{if(this[_0x0553('0x1b')][_0x4daa5]){logger[_0x0553('0x2f')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x4daa5,_0x101299);this[_0x0553('0x1b')][_0x4daa5]['monitor']=!![];if(_['endsWith'](_0x101299,_0x0553('0x6e'))){_0x101299=_0x101299[_0x0553('0x6f')]('.wav49',_0x0553('0x70'));}this[_0x0553('0x1b')][_0x4daa5][_0x0553('0x71')]=_0x101299;var _0x1519c2=_[_0x0553('0x72')](this[_0x0553('0x1b')][_0x4daa5]['monitors'],{'filename':_0x101299});if(_[_0x0553('0x73')](_0x1519c2)){this['channels'][_0x4daa5][_0x0553('0x74')][_0x0553('0x75')]({'filename':_0x101299,'createdAt':moment()[_0x0553('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x0553('0x76')});}}}catch(_0x37b5a5){logger[_0x0553('0x32')](_0x0553('0x77'),_0x4daa5,util[_0x0553('0x34')](_0x37b5a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x78')]=function(_0x138f66){try{if(this[_0x0553('0x35')](_0x138f66)){logger[_0x0553('0x41')](_0x0553('0x79'),_0x138f66[_0x0553('0x39')],util['inspect'](_0x138f66,{'showHidden':![],'depth':null}));if(this['channels'][_0x138f66[_0x0553('0x39')]]&&_0x138f66[_0x0553('0x42')]!='OutgoingSpoolFailed'){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')])){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x7b')])){logger[_0x0553('0x2f')](_0x0553('0x7c'),_0x138f66['uniqueid'],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x6d')](_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x7e')])){logger['info'](_0x0553('0x7f'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0x65')]=_0x138f66['value'];}else if(this['isNotNull'](_0x138f66[_0x0553('0x7a')]['xmd-callerid'])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66['uniqueid']][_0x0553('0x80')]=_0x138f66[_0x0553('0x7d')];}else if(this[_0x0553('0x35')](_0x138f66['variable'][_0x0553('0x81')])){logger['info'](_0x0553('0x82'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0x83')]=_0x138f66['value'];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')]['xmd-queue'])){logger[_0x0553('0x2f')](_0x0553('0x84'),_0x138f66[_0x0553('0x39')],_0x138f66['value'][_0x0553('0x4c')](',')[0x0]);this[_0x0553('0x1b')][_0x138f66['uniqueid']][_0x0553('0xf')]=_0x138f66[_0x0553('0x7d')][_0x0553('0x4c')](',')[0x0];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x85')])){logger[_0x0553('0x2f')](_0x0553('0x86'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]]['originatecalleridnum']=_0x138f66[_0x0553('0x7d')];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x87')])){logger[_0x0553('0x2f')](_0x0553('0x88'),_0x138f66['uniqueid'],_0x138f66[_0x0553('0x7d')]);this['channels'][_0x138f66['uniqueid']][_0x0553('0x89')]=_0x138f66[_0x0553('0x7d')];}else if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')]['xmd-callerid-preview'])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x138f66['uniqueid'],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66['uniqueid']][_0x0553('0x8a')]=_0x138f66[_0x0553('0x7d')];}else if(this['isNotNull'](_0x138f66[_0x0553('0x7a')][_0x0553('0x8b')])){logger[_0x0553('0x2f')](_0x0553('0x8c'),_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0xf')]=_0x138f66[_0x0553('0x7d')];}else if(this['isNotNull'](_0x138f66[_0x0553('0x7a')][_0x0553('0x8d')])){logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x138f66[_0x0553('0x39')],_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x39')]][_0x0553('0x8e')]=_0x138f66[_0x0553('0x7d')];}}}else if(this[_0x0553('0x35')](_0x138f66['variable'][_0x0553('0x7b')])){if(_0x138f66[_0x0553('0x7d')]){var _0x1b4926=path[_0x0553('0x8f')](_0x138f66[_0x0553('0x7d')])[_0x0553('0x52')];logger[_0x0553('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x1b4926,_0x138f66[_0x0553('0x7d')]);this[_0x0553('0x6d')](_0x1b4926,_0x138f66[_0x0553('0x7d')]);}}else if(this[_0x0553('0x1b')][_0x138f66['linkedid']]){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')])){if(this[_0x0553('0x35')](_0x138f66[_0x0553('0x7a')][_0x0553('0x8d')])){logger[_0x0553('0x2f')](_0x0553('0x90'),_0x138f66[_0x0553('0x3c')],_0x138f66['value']);this[_0x0553('0x1b')][_0x138f66[_0x0553('0x3c')]][_0x0553('0x91')]=_0x138f66[_0x0553('0x7d')];}}}}}catch(_0x1fb932){logger[_0x0553('0x32')](_0x0553('0x92'),_0x138f66[_0x0553('0x39')],util[_0x0553('0x34')](_0x1fb932,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x26')]=function(_0x179327){try{if(this[_0x0553('0x35')](_0x179327)){logger[_0x0553('0x41')](_0x0553('0x93'),_0x179327[_0x0553('0x39')],util[_0x0553('0x34')](_0x179327,{'showHidden':![],'depth':null}));if(this['channels'][_0x179327[_0x0553('0x39')]]){logger[_0x0553('0x2f')](_0x0553('0x94'),_0x179327[_0x0553('0x39')],_0x179327['cause-txt']);var _0x17c46e=moment();this[_0x0553('0x1b')][_0x179327['uniqueid']][_0x0553('0x95')]=_0x17c46e[_0x0553('0x46')](_0x0553('0x5e'));this[_0x0553('0x1b')][_0x179327['uniqueid']]['duration']=_0x17c46e[_0x0553('0x96')](this[_0x0553('0x1b')][_0x179327['uniqueid']][_0x0553('0x45')],_0x0553('0x5d'));if(this['channels'][_0x179327[_0x0553('0x39')]]['answered']){this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['billableseconds']=_0x17c46e[_0x0553('0x96')](this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['answertime'],_0x0553('0x5d'));this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['holdtime']=this['channels'][_0x179327['uniqueid']][_0x0553('0x5c')]-this[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]][_0x0553('0x97')];}if(_0x179327[_0x0553('0x4a')]==='from-sip'){if(this[_0x0553('0x1c')][_0x179327[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]]){this[_0x0553('0x1c')][_0x179327['channel'][_0x0553('0x4c')]('-')[0x0]]=_[_0x0553('0x98')](this['agents'][_0x179327[_0x0553('0x42')]['split']('-')[0x0]],[_0x0553('0x4d')]);logger['debug'](_0x0553('0x99'),_0x179327[_0x0553('0x39')],util[_0x0553('0x34')]({'destaccountcode':this[_0x0553('0x1c')][_0x179327[_0x0553('0x42')][_0x0553('0x4c')]('-')[0x0]][_0x0553('0x4f')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x0553('0x46')](_0x0553('0x51'),this[_0x0553('0x1c')][_0x179327[_0x0553('0x42')]['split']('-')[0x0]][_0x0553('0x52')]),_0x0553('0x9a'),{'destaccountcode':this['agents'][_0x179327[_0x0553('0x42')]['split']('-')[0x0]]['accountcode']});}}var _0x930bde=this;Promise[_0x0553('0x9b')]()[_0x0553('0x9c')](function(){var _0x53c8f6=_0x930bde[_0x0553('0x1b')][_0x179327['uniqueid']];if(typeof _0x53c8f6[_0x0553('0x9d')]===_0x0553('0x9e'))return;if(_[_0x0553('0x9f')](_0x53c8f6[_0x0553('0x74')]))return;return RpcSetting['getSettings']()[_0x0553('0x9c')](function(_0x14317f){if(!_0x14317f[_0x0553('0xa0')])return;return Promise['resolve']()[_0x0553('0x9c')](function(){return ami[_0x0553('0xa1')]({'action':'StopMixMonitor','channel':_0x53c8f6[_0x0553('0x42')]})[_0x0553('0xa2')](function(){});})[_0x0553('0x9c')](function(){return ami[_0x0553('0xa1')]({'action':_0x0553('0xa3'),'channel':_0x53c8f6[_0x0553('0xa4')]})[_0x0553('0xa2')](function(){})[_0x0553('0xa5')](function(){var _0x37af8c=_0x930bde['agents'][_0x53c8f6['destinationchannel'][_0x0553('0x4c')]('-')[0x0]];if(!_0x37af8c)return;io[_0x0553('0x50')](_0x0553('0xa6'),{'agentId':_0x37af8c['id'],'uniqueid':_0x53c8f6[_0x0553('0x39')]});});});});})['then'](function(){if(_0x179327['event']===_0x0553('0xa7')){_0x930bde['blindTransfers'][_0x179327['uniqueid']]=_0x930bde['channels'][_0x179327[_0x0553('0x39')]];}else{if(_0x930bde['channels'][_0x179327['uniqueid']][_0x0553('0x83')]===_0x0553('0xa8')&&_0x930bde[_0x0553('0x1d')][_0x179327[_0x0553('0x39')]]){_0x930bde['channels'][_0x179327[_0x0553('0x39')]][_0x0553('0x39')]=[_0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['linkedid'],_0x930bde['channels'][_0x179327['uniqueid']]['linkedid']=_0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]]['uniqueid']][0x0];delete _0x930bde[_0x0553('0x1d')][_0x179327['uniqueid']];}}logger[_0x0553('0x41')](_0x0553('0xa9'),_0x179327['uniqueid'],util[_0x0553('0x34')](_0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]],{'showHidden':![],'depth':null}));ami[_0x0553('0x50')](_0x0553('0xaa'),_0x930bde[_0x0553('0x1b')][_0x179327['uniqueid']]);delete _0x930bde[_0x0553('0x1b')][_0x179327[_0x0553('0x39')]];});}}}catch(_0x452720){logger[_0x0553('0x32')](_0x0553('0xab'),_0x179327[_0x0553('0x39')],util['inspect'](_0x452720,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x29')]=function(_0x23b338){try{if(this[_0x0553('0x35')](_0x23b338)){logger['info'](_0x0553('0xac'),_0x23b338[_0x0553('0x39')],_0x23b338[_0x0553('0xad')],_0x23b338[_0x0553('0xae')]);logger[_0x0553('0x41')](_0x0553('0xaf'),_0x23b338[_0x0553('0x39')],util[_0x0553('0x34')](_0x23b338,{'showHidden':![],'depth':null}));if(this['channels'][_0x23b338[_0x0553('0xb0')]]){this['channels'][_0x23b338[_0x0553('0xb0')]][_0x0553('0xb1')]=_0x23b338[_0x0553('0xad')];this['channels'][_0x23b338[_0x0553('0xb0')]][_0x0553('0xb2')]=_0x23b338[_0x0553('0xae')];if(this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]]){var _0xc9a547=this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]];this['channels'][_0x23b338['secondtransfereruniqueid']]=this[_0x0553('0x1b')][_0x23b338['transfereeuniqueid']];this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb0')]]=_0xc9a547;}}else if(this['channels'][_0x23b338['transfertargetuniqueid']]){this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb4')]]['transfercalleridnum']=_0x23b338[_0x0553('0xad')];this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb4')]][_0x0553('0xb2')]=_0x23b338[_0x0553('0xae')];if(this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb5')]]){var _0xc9a547=this['channels'][_0x23b338['origtransfereruniqueid']];this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb5')]]=this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb4')]];this['channels'][_0x23b338[_0x0553('0xb4')]]=_0xc9a547;}}if((this['channels'][_0x23b338[_0x0553('0xb5')]]||this['channels'][_0x23b338[_0x0553('0xb6')]])&&this[_0x0553('0x1b')][_0x23b338['secondtransfereruniqueid']]){var _0x71c695=_[_0x0553('0xb7')]([this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb5')]],this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb6')]],this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]]],function(_0x360ca1){return _0x360ca1&&_0x360ca1[_0x0553('0x83')]===_0x0553('0xa8')&&_0x360ca1[_0x0553('0xb8')];});if(_0x71c695){if(this[_0x0553('0x1b')][_0x23b338['origtransfereruniqueid']])this[_0x0553('0x1b')][_0x23b338['origtransfereruniqueid']][_0x0553('0x9d')]=_0x0553('0xb9');if(this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb6')]])this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb6')]]['transferType']=_0x0553('0xb9');this[_0x0553('0x1b')][_0x23b338[_0x0553('0xb3')]]['transferType']=_0x0553('0xb9');}}}}catch(_0x4a13da){logger[_0x0553('0x32')](_0x0553('0xba'),_0x23b338[_0x0553('0x39')],util['inspect'](_0x4a13da,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0553('0x2b')]=function(_0x306b81){try{if(this[_0x0553('0x35')](_0x306b81)){logger[_0x0553('0x2f')](_0x0553('0xbb'),_0x306b81['uniqueid'],_0x306b81['transfereecalleridnum'],_0x306b81[_0x0553('0xbc')]);logger[_0x0553('0x41')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x306b81[_0x0553('0x39')],util[_0x0553('0x34')](_0x306b81,{'showHidden':![],'depth':null}));if(this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]]){this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]][_0x0553('0xb1')]=_0x306b81[_0x0553('0xbd')];this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]][_0x0553('0xb2')]=_0x306b81[_0x0553('0xbc')];this[_0x0553('0x1b')][_0x306b81[_0x0553('0xb0')]][_0x0553('0x9d')]='BLIND';this[_0x0553('0x26')]({'event':'BlindTransfer','uniqueid':_0x306b81[_0x0553('0xb0')],'context':_0x306b81[_0x0553('0x4a')],'channel':_0x306b81[_0x0553('0xbe')]});}else{this['channels'][_0x306b81[_0x0553('0xbf')]][_0x0553('0x9d')]=_0x0553('0xc0');}}}catch(_0x42bef4){logger['error'](_0x0553('0xc1'),_0x306b81[_0x0553('0x39')],util['inspect'](_0x42bef4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x2c')]=function(_0x5aff20){try{if(this[_0x0553('0x35')](_0x5aff20)){logger[_0x0553('0x41')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x5aff20['uniqueid'],util[_0x0553('0x34')](_0x5aff20,{'showHidden':![],'depth':null}));if(this['channels'][_0x5aff20[_0x0553('0x39')]]){if(!_[_0x0553('0x73')](this[_0x0553('0x1b')][_0x5aff20[_0x0553('0x39')]][_0x0553('0x68')])){this[_0x0553('0x1b')][_0x5aff20[_0x0553('0x39')]][_0x0553('0xc2')]=moment()[_0x0553('0x46')](_0x0553('0x5e'));logger[_0x0553('0x2f')](_0x0553('0xc3'),_0x5aff20['uniqueid'],this['channels'][_0x5aff20[_0x0553('0x39')]]['mohstarttime']);}}}}catch(_0x52f8fa){logger[_0x0553('0x32')](_0x0553('0xc4'),_0x5aff20[_0x0553('0x39')],util[_0x0553('0x34')](_0x52f8fa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0553('0x37')][_0x0553('0x2e')]=function(_0x403d14){try{if(this[_0x0553('0x35')](_0x403d14)){logger[_0x0553('0x41')](_0x0553('0xc5'),_0x403d14[_0x0553('0x39')],util[_0x0553('0x34')](_0x403d14,{'showHidden':![],'depth':null}));if(this['channels'][_0x403d14['uniqueid']]){if(!_['isNil'](this[_0x0553('0x1b')][_0x403d14[_0x0553('0x39')]][_0x0553('0xc2')])){this['channels'][_0x403d14[_0x0553('0x39')]][_0x0553('0xc6')]+=moment()[_0x0553('0xc7')](0x0)['diff'](this[_0x0553('0x1b')][_0x403d14[_0x0553('0x39')]][_0x0553('0xc2')],'seconds');logger[_0x0553('0x2f')](_0x0553('0xc8'),_0x403d14['uniqueid'],this[_0x0553('0x1b')][_0x403d14[_0x0553('0x39')]][_0x0553('0xc6')]);delete this['channels'][_0x403d14[_0x0553('0x39')]][_0x0553('0xc2')];}}}}catch(_0x544d99){logger['error'](_0x0553('0xc9'),_0x403d14[_0x0553('0x39')],util[_0x0553('0x34')](_0x544d99,{'showHidden':![],'depth':null}));}};module[_0x0553('0xca')]=VoiceCallReport; \ No newline at end of file +var _0xe829=['rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','callerid','xmd-cdrtype','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','stopRecordingOnTransfer','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','onhold','set','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','varset','syncVarSet','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','linkedid','merge','pick','[%s][voiceCallReport][newcallerid]','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','keys','from-sip','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','disposition','lastapplication','cdr(','match','queue','[%s][voiceCallReport][newexten]','channelstate','answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','syncMixMonitorFilename','monitor','.wav49','replace','monitors','isNil','push'];(function(_0x22d202,_0xfcd670){var _0x3cb212=function(_0xafd594){while(--_0xafd594){_0x22d202['push'](_0x22d202['shift']());}};_0x3cb212(++_0xfcd670);}(_0xe829,0x1d8));var _0x9e82=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0xe829[_0x53417c];return _0x49407d;};'use strict';var BPromise=require(_0x9e82('0x0'));var _=require(_0x9e82('0x1'));var moment=require(_0x9e82('0x2'));var util=require('util');var path=require('path');var Redis=require(_0x9e82('0x3'));var config=require(_0x9e82('0x4'));var logger=require(_0x9e82('0x5'))(_0x9e82('0x6'));var ami=require(_0x9e82('0x7'));var Channel=require(_0x9e82('0x8'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x9e82('0x9'),_0x9e82('0xa'),_0x9e82('0xb'),_0x9e82('0xc'),_0x9e82('0xd'),'unavailable',_0x9e82('0xe'),'ringinuse',_0x9e82('0xf')];var applications=[_0x9e82('0x10'),'queue','agi',_0x9e82('0x11'),_0x9e82('0x12'),_0x9e82('0x13')];var dispositions=[_0x9e82('0x14'),_0x9e82('0x15'),_0x9e82('0x15'),_0x9e82('0x14'),_0x9e82('0x14'),_0x9e82('0x14'),_0x9e82('0x16'),_0x9e82('0x17'),_0x9e82('0x15'),'FAILED','FAILED'];var actions={};config[_0x9e82('0x18')]=_[_0x9e82('0x19')](config[_0x9e82('0x18')],{'host':_0x9e82('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9e82('0x18')]));function VoiceCallReport(_0xfa4802){this[_0x9e82('0x1b')]=_0xfa4802[_0x9e82('0x1b')];this['agents']=_0xfa4802[_0x9e82('0x1c')];this[_0x9e82('0x1d')]={};ami['on'](_0x9e82('0x1e'),this[_0x9e82('0x1f')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x9e82('0x20')](this));ami['on'](_0x9e82('0x21'),this[_0x9e82('0x22')][_0x9e82('0x20')](this));ami['on'](_0x9e82('0x23'),this['syncNewState'][_0x9e82('0x20')](this));ami['on'](_0x9e82('0x24'),this[_0x9e82('0x25')][_0x9e82('0x20')](this));ami['on']('hangup',this['syncHangup'][_0x9e82('0x20')](this));ami['on'](_0x9e82('0x26'),this[_0x9e82('0x27')][_0x9e82('0x20')](this));ami['on'](_0x9e82('0x28'),this[_0x9e82('0x29')]['bind'](this));ami['on'](_0x9e82('0x2a'),this[_0x9e82('0x2b')][_0x9e82('0x20')](this));ami['on'](_0x9e82('0x2c'),this[_0x9e82('0x2d')]['bind'](this));ami['on'](_0x9e82('0x2e'),this['syncMusicOnHoldStop'][_0x9e82('0x20')](this));try{logger['info'](_0x9e82('0x2f'));ami[_0x9e82('0x30')]();}catch(_0x2ff9ae){logger[_0x9e82('0x31')](_0x9e82('0x32'),util[_0x9e82('0x33')](_0x2ff9ae,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x9e82('0x34')][_0x9e82('0x35')]=function(_0xbcc412){return _0xbcc412!==null&&!_[_0x9e82('0x36')](_0xbcc412);};VoiceCallReport[_0x9e82('0x34')]['emit']=function(_0x3d7932,_0x280939,_0x221ac0){io['to'](_0x3d7932)[_0x9e82('0x37')](_0x280939,_0x221ac0);};VoiceCallReport[_0x9e82('0x34')][_0x9e82('0x27')]=function(_0xd3db2a){try{if(this[_0x9e82('0x35')](_0xd3db2a)){logger[_0x9e82('0x38')](_0x9e82('0x39'),_0xd3db2a[_0x9e82('0x3a')],_0xd3db2a[_0x9e82('0x3b')],_0xd3db2a[_0x9e82('0x3c')]);logger[_0x9e82('0x3d')]('[%s][voiceCallReport][newcallerid]\x20event:',_0xd3db2a['uniqueid'],util[_0x9e82('0x33')](_0xd3db2a,{'showHidden':![],'depth':null}));if(_0xd3db2a[_0x9e82('0x3a')]===_0xd3db2a[_0x9e82('0x3e')]){if(!_[_0x9e82('0x36')](this[_0x9e82('0x1b')][_0xd3db2a[_0x9e82('0x3a')]])){_[_0x9e82('0x3f')](this[_0x9e82('0x1b')][_0xd3db2a[_0x9e82('0x3a')]],_[_0x9e82('0x40')](_0xd3db2a,_['keys'](this[_0x9e82('0x1b')][_0xd3db2a[_0x9e82('0x3a')]])));}}}}catch(_0x5747a5){logger[_0x9e82('0x31')](_0x9e82('0x41'),_0xd3db2a[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x5747a5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')][_0x9e82('0x22')]=function(_0x2fe280){try{if(this['isNotNull'](_0x2fe280)){logger[_0x9e82('0x3d')]('[%s][voiceCallReport][newchannel]\x20event:',_0x2fe280['uniqueid'],util[_0x9e82('0x33')](_0x2fe280,{'showHidden':![],'depth':null}));if(_0x2fe280[_0x9e82('0x3a')]===_0x2fe280[_0x9e82('0x3e')]&&_0x2fe280[_0x9e82('0x42')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x9e82('0x1b')][_0x2fe280[_0x9e82('0x3a')]])){logger[_0x9e82('0x38')](_0x9e82('0x43'),_0x2fe280[_0x9e82('0x3a')],_0x2fe280[_0x9e82('0x44')],_0x2fe280[_0x9e82('0x45')]);this[_0x9e82('0x1b')][_0x2fe280[_0x9e82('0x3a')]]=new Channel();this[_0x9e82('0x1b')][_0x2fe280['uniqueid']][_0x9e82('0x46')]=moment()[_0x9e82('0x47')](_0x9e82('0x48'));this[_0x9e82('0x1b')][_0x2fe280[_0x9e82('0x3a')]]['disposition']=dispositions[_['toNumber'](_0x2fe280['channelstate'])];_['merge'](this[_0x9e82('0x1b')][_0x2fe280[_0x9e82('0x3a')]],_[_0x9e82('0x40')](_0x2fe280,_[_0x9e82('0x49')](this[_0x9e82('0x1b')][_0x2fe280['uniqueid']])));if(_0x2fe280['context']===_0x9e82('0x4a')){if(this[_0x9e82('0x1c')][_0x2fe280[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]]){this['agents'][_0x2fe280[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]][_0x9e82('0x4c')]=_0x2fe280['exten'];logger['debug'](_0x9e82('0x4d'),_0x2fe280['uniqueid'],util[_0x9e82('0x33')]({'destaccountcode':this[_0x9e82('0x1c')][_0x2fe280['channel'][_0x9e82('0x4b')]('-')[0x0]][_0x9e82('0x4e')],'destconnectedlinenum':_0x2fe280[_0x9e82('0x45')]},{'showHidden':![],'depth':null}));this[_0x9e82('0x37')](util[_0x9e82('0x47')](_0x9e82('0x4f'),this['agents'][_0x2fe280[_0x9e82('0x42')]['split']('-')[0x0]][_0x9e82('0x50')]),_0x9e82('0x51'),{'destaccountcode':this[_0x9e82('0x1c')][_0x2fe280[_0x9e82('0x42')]['split']('-')[0x0]][_0x9e82('0x4e')],'destconnectedlinenum':_0x2fe280[_0x9e82('0x45')]});}}}}}}catch(_0x42bc9c){logger['error'](_0x9e82('0x52'),_0x2fe280[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x42bc9c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')][_0x9e82('0x1f')]=function(_0x545db3){try{if(this[_0x9e82('0x35')](_0x545db3)){logger[_0x9e82('0x3d')](_0x9e82('0x53'),_0x545db3[_0x9e82('0x3a')],util['inspect'](_0x545db3,{'showHidden':![],'depth':null}));if(_0x545db3['uniqueid']===_0x545db3[_0x9e82('0x3e')]&&_0x545db3[_0x9e82('0x45')]!='h'&&_0x545db3[_0x9e82('0x42')]!=_0x9e82('0x54')){_0x545db3[_0x9e82('0x55')]=_0x545db3['application'][_0x9e82('0x56')]();_0x545db3[_0x9e82('0x57')]=(_0x545db3[_0x9e82('0x58')]||_0x545db3[_0x9e82('0x57')])['toLowerCase']();logger['info'](_0x9e82('0x59'),_0x545db3['uniqueid'],_0x545db3['application'],_0x545db3[_0x9e82('0x57')]);if(_[_0x9e82('0x36')](this[_0x9e82('0x1b')][_0x545db3[_0x9e82('0x3a')]])){this[_0x9e82('0x1b')][_0x545db3[_0x9e82('0x3a')]]=new Channel();this[_0x9e82('0x1b')][_0x545db3[_0x9e82('0x3a')]][_0x9e82('0x46')]=_0x545db3[_0x9e82('0x5a')]?moment()[_0x9e82('0x5b')](moment[_0x9e82('0x5a')](_0x545db3['duration'])[_0x9e82('0x5c')](),'seconds')[_0x9e82('0x47')](_0x9e82('0x48')):moment()['format'](_0x9e82('0x48'));this[_0x9e82('0x1b')][_0x545db3['uniqueid']][_0x9e82('0x5d')]=_0x9e82('0x14');}_[_0x9e82('0x3f')](this[_0x9e82('0x1b')][_0x545db3[_0x9e82('0x3a')]],_['pick'](_0x545db3,_['keys'](this[_0x9e82('0x1b')][_0x545db3['uniqueid']])));if(_['includes'](applications,_0x545db3[_0x9e82('0x55')])){this[_0x9e82('0x1b')][_0x545db3[_0x9e82('0x3a')]][_0x9e82('0x5e')]=_0x545db3[_0x9e82('0x55')];this[_0x9e82('0x1b')][_0x545db3[_0x9e82('0x3a')]]['lastdata']=_0x545db3[_0x9e82('0x57')];if(_0x545db3[_0x9e82('0x55')]==='set'&&_['startsWith'](_0x545db3[_0x9e82('0x57')],_0x9e82('0x5f'))){var _0x2ed5ef=_0x545db3[_0x9e82('0x57')][_0x9e82('0x4b')]('=');var _0xf2723=_0x2ed5ef[0x0][_0x9e82('0x60')](/cdr\((.*)\)/);if(_0xf2723){this[_0x9e82('0x1b')][_0x545db3['uniqueid']][_0xf2723[0x1]]=_0x2ed5ef[0x1];}}else if(_0x545db3['application']===_0x9e82('0x61')){this[_0x9e82('0x1b')][_0x545db3[_0x9e82('0x3a')]][_0x9e82('0x61')]=_0x545db3[_0x9e82('0x57')]['split'](',')[0x0];}}}}}catch(_0x1a1882){logger[_0x9e82('0x31')](_0x9e82('0x62'),_0x545db3[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x1a1882,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')]['syncNewState']=function(_0x440abe){try{if(this[_0x9e82('0x35')](_0x440abe)){logger[_0x9e82('0x38')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x440abe['uniqueid'],_0x440abe[_0x9e82('0x3e')],_0x440abe[_0x9e82('0x3b')],_0x440abe['calleridnum']);logger[_0x9e82('0x3d')]('[%s][voiceCallReport][newstate]\x20event:',_0x440abe[_0x9e82('0x3a')],util['inspect'](_0x440abe,{'showHidden':![],'depth':null}));if(_0x440abe[_0x9e82('0x3a')]!==_0x440abe[_0x9e82('0x3e')]){if(this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]]){if(_0x440abe[_0x9e82('0x63')]==='6'){if(!this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x64')]){var _0xc57647=moment();this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x64')]=!![];this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x65')]=_0xc57647[_0x9e82('0x47')](_0x9e82('0x48'));if(this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x46')]){this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x66')]=_0xc57647[_0x9e82('0x67')](this['channels'][_0x440abe['linkedid']][_0x9e82('0x46')],'seconds');}}this['channels'][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x3e')]=_0x440abe[_0x9e82('0x3a')];if(_0x440abe['calleridnum']!=='xcally-motion-preview'){this[_0x9e82('0x1b')][_0x440abe['linkedid']][_0x9e82('0x68')]=_0x440abe[_0x9e82('0x3c')];}this['channels'][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x69')]=_0x440abe[_0x9e82('0x3b')];this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x6a')]=_0x440abe[_0x9e82('0x42')];this['channels'][_0x440abe['linkedid']][_0x9e82('0x5d')]=dispositions[_['toNumber'](_0x440abe[_0x9e82('0x63')])];if(this[_0x9e82('0x1c')][_0x440abe['channel']['split']('-')[0x0]]){this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3e')]][_0x9e82('0x6b')]=this[_0x9e82('0x1c')][_0x440abe[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]]['id'];this[_0x9e82('0x1b')][_0x440abe['linkedid']][_0x9e82('0x6c')]=this[_0x9e82('0x1c')][_0x440abe[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]][_0x9e82('0x50')];}}}}else{if(this[_0x9e82('0x1b')][_0x440abe['uniqueid']]){if(_0x440abe[_0x9e82('0x63')]==='6'){if(this[_0x9e82('0x1c')][_0x440abe[_0x9e82('0x42')]['split']('-')[0x0]]){this['channels'][_0x440abe[_0x9e82('0x3a')]][_0x9e82('0x6b')]=this[_0x9e82('0x1c')][_0x440abe[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]]['id'];this[_0x9e82('0x1b')][_0x440abe[_0x9e82('0x3a')]][_0x9e82('0x6c')]=this[_0x9e82('0x1c')][_0x440abe[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]][_0x9e82('0x50')];}}}}}}catch(_0x11c29b){logger['error']('[%s][voiceCallReport][newstate]',_0x440abe[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x11c29b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9e82('0x6d')]=function(_0x5a36d5,_0x2ab59f){try{if(this[_0x9e82('0x1b')][_0x5a36d5]){logger[_0x9e82('0x38')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5a36d5,_0x2ab59f);this[_0x9e82('0x1b')][_0x5a36d5][_0x9e82('0x6e')]=!![];if(_['endsWith'](_0x2ab59f,_0x9e82('0x6f'))){_0x2ab59f=_0x2ab59f[_0x9e82('0x70')](_0x9e82('0x6f'),'.WAV');}this[_0x9e82('0x1b')][_0x5a36d5]['monitorFilename']=_0x2ab59f;var _0x281edf=_['find'](this[_0x9e82('0x1b')][_0x5a36d5][_0x9e82('0x71')],{'filename':_0x2ab59f});if(_[_0x9e82('0x72')](_0x281edf)){this[_0x9e82('0x1b')][_0x5a36d5][_0x9e82('0x71')][_0x9e82('0x73')]({'filename':_0x2ab59f,'createdAt':moment()[_0x9e82('0x47')](_0x9e82('0x48')),'mixmonitorid':'','status':_0x9e82('0x74')});}}}catch(_0x1dcb34){logger[_0x9e82('0x31')](_0x9e82('0x75'),_0x5a36d5,util[_0x9e82('0x33')](_0x1dcb34,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')][_0x9e82('0x25')]=function(_0x14a626){try{if(this[_0x9e82('0x35')](_0x14a626)){logger['debug']('[%s][voiceCallReport][varset]\x20event:',_0x14a626[_0x9e82('0x3a')],util['inspect'](_0x14a626,{'showHidden':![],'depth':null}));if(this[_0x9e82('0x1b')][_0x14a626[_0x9e82('0x3a')]]&&_0x14a626['channel']!=_0x9e82('0x54')){if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')])){if(this[_0x9e82('0x35')](_0x14a626['variable'][_0x9e82('0x77')])){logger[_0x9e82('0x38')](_0x9e82('0x78'),_0x14a626['uniqueid'],_0x14a626[_0x9e82('0x79')]);this[_0x9e82('0x6d')](_0x14a626[_0x9e82('0x3a')],_0x14a626[_0x9e82('0x79')]);}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')][_0x9e82('0x7a')])){logger[_0x9e82('0x38')](_0x9e82('0x7b'),_0x14a626['uniqueid'],_0x14a626['value']);this[_0x9e82('0x1b')][_0x14a626['uniqueid']][_0x9e82('0x3c')]=_0x14a626[_0x9e82('0x79')];}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')]['xmd-callerid'])){logger[_0x9e82('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x14a626[_0x9e82('0x3a')],_0x14a626[_0x9e82('0x79')]);this[_0x9e82('0x1b')][_0x14a626['uniqueid']][_0x9e82('0x7c')]=_0x14a626['value'];}else if(this[_0x9e82('0x35')](_0x14a626['variable'][_0x9e82('0x7d')])){logger[_0x9e82('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x14a626[_0x9e82('0x3a')],_0x14a626[_0x9e82('0x79')]);this['channels'][_0x14a626[_0x9e82('0x3a')]][_0x9e82('0x7e')]=_0x14a626[_0x9e82('0x79')];}else if(this['isNotNull'](_0x14a626[_0x9e82('0x76')][_0x9e82('0x7f')])){logger[_0x9e82('0x38')](_0x9e82('0x80'),_0x14a626[_0x9e82('0x3a')],_0x14a626['value'][_0x9e82('0x4b')](',')[0x0]);this[_0x9e82('0x1b')][_0x14a626[_0x9e82('0x3a')]][_0x9e82('0x61')]=_0x14a626['value']['split'](',')[0x0];}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')][_0x9e82('0x81')])){logger[_0x9e82('0x38')](_0x9e82('0x82'),_0x14a626['uniqueid'],_0x14a626['value']);this['channels'][_0x14a626[_0x9e82('0x3a')]][_0x9e82('0x83')]=_0x14a626[_0x9e82('0x79')];}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')][_0x9e82('0x84')])){logger[_0x9e82('0x38')](_0x9e82('0x85'),_0x14a626['uniqueid'],_0x14a626[_0x9e82('0x79')]);this[_0x9e82('0x1b')][_0x14a626[_0x9e82('0x3a')]][_0x9e82('0x86')]=_0x14a626['value'];}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')][_0x9e82('0x87')])){logger[_0x9e82('0x38')](_0x9e82('0x88'),_0x14a626['uniqueid'],_0x14a626[_0x9e82('0x79')]);this['channels'][_0x14a626[_0x9e82('0x3a')]][_0x9e82('0x89')]=_0x14a626[_0x9e82('0x79')];}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')][_0x9e82('0x8a')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x14a626['uniqueid'],_0x14a626[_0x9e82('0x79')]);this[_0x9e82('0x1b')][_0x14a626[_0x9e82('0x3a')]]['queue']=_0x14a626[_0x9e82('0x79')];}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')][_0x9e82('0x8b')])){logger[_0x9e82('0x38')](_0x9e82('0x8c'),_0x14a626[_0x9e82('0x3a')],_0x14a626[_0x9e82('0x79')]);this[_0x9e82('0x1b')][_0x14a626[_0x9e82('0x3a')]]['sipcalluniqueid']=_0x14a626[_0x9e82('0x79')];}}}else if(this[_0x9e82('0x35')](_0x14a626[_0x9e82('0x76')][_0x9e82('0x77')])){if(_0x14a626[_0x9e82('0x79')]){var _0x570257=path[_0x9e82('0x8d')](_0x14a626[_0x9e82('0x79')])[_0x9e82('0x50')];logger[_0x9e82('0x38')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x570257,_0x14a626[_0x9e82('0x79')]);this[_0x9e82('0x6d')](_0x570257,_0x14a626[_0x9e82('0x79')]);}}else if(this[_0x9e82('0x1b')][_0x14a626['linkedid']]){if(this['isNotNull'](_0x14a626[_0x9e82('0x76')])){if(this['isNotNull'](_0x14a626[_0x9e82('0x76')][_0x9e82('0x8b')])){logger[_0x9e82('0x38')](_0x9e82('0x8c'),_0x14a626['linkedid'],_0x14a626[_0x9e82('0x79')]);this[_0x9e82('0x1b')][_0x14a626[_0x9e82('0x3e')]][_0x9e82('0x8e')]=_0x14a626[_0x9e82('0x79')];}}}}}catch(_0x4b9b98){logger['error'](_0x9e82('0x8f'),_0x14a626[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x4b9b98,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')][_0x9e82('0x90')]=function(_0x5cc69f){try{if(this[_0x9e82('0x35')](_0x5cc69f)){logger[_0x9e82('0x3d')](_0x9e82('0x91'),_0x5cc69f[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x5cc69f,{'showHidden':![],'depth':null}));if(this[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]]){logger[_0x9e82('0x38')](_0x9e82('0x92'),_0x5cc69f[_0x9e82('0x3a')],_0x5cc69f['cause-txt']);var _0xf3b1ff=moment();this[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]][_0x9e82('0x93')]=_0xf3b1ff['format'](_0x9e82('0x48'));this[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]][_0x9e82('0x5a')]=_0xf3b1ff[_0x9e82('0x67')](this[_0x9e82('0x1b')][_0x5cc69f['uniqueid']]['starttime'],_0x9e82('0x5c'));if(this[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]][_0x9e82('0x64')]){this[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]][_0x9e82('0x94')]=_0xf3b1ff[_0x9e82('0x67')](this[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]]['answertime'],'seconds');this[_0x9e82('0x1b')][_0x5cc69f['uniqueid']]['holdtime']=this[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]]['duration']-this['channels'][_0x5cc69f[_0x9e82('0x3a')]][_0x9e82('0x94')];}if(_0x5cc69f[_0x9e82('0x44')]===_0x9e82('0x4a')){if(this[_0x9e82('0x1c')][_0x5cc69f[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]]){this['agents'][_0x5cc69f['channel'][_0x9e82('0x4b')]('-')[0x0]]=_[_0x9e82('0x95')](this[_0x9e82('0x1c')][_0x5cc69f[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]],[_0x9e82('0x4c')]);logger['debug'](_0x9e82('0x96'),_0x5cc69f[_0x9e82('0x3a')],util['inspect']({'destaccountcode':this[_0x9e82('0x1c')][_0x5cc69f[_0x9e82('0x42')][_0x9e82('0x4b')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x9e82('0x37')](util[_0x9e82('0x47')](_0x9e82('0x4f'),this['agents'][_0x5cc69f[_0x9e82('0x42')]['split']('-')[0x0]][_0x9e82('0x50')]),_0x9e82('0x97'),{'destaccountcode':this[_0x9e82('0x1c')][_0x5cc69f['channel']['split']('-')[0x0]][_0x9e82('0x4e')]});}}var _0x56e7a8=this;Promise[_0x9e82('0x98')]()[_0x9e82('0x99')](function(){var _0x25a7c5=_0x56e7a8['channels'][_0x5cc69f[_0x9e82('0x3a')]];if(typeof _0x25a7c5[_0x9e82('0x9a')]===_0x9e82('0x9b'))return;if(_[_0x9e82('0x9c')](_0x25a7c5[_0x9e82('0x71')]))return;return RpcSetting['getSettings']()[_0x9e82('0x99')](function(_0x256826){if(!_0x256826[_0x9e82('0x9d')])return;return Promise[_0x9e82('0x98')]()['then'](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x25a7c5[_0x9e82('0x42')]})[_0x9e82('0x9e')](function(){});})['then'](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x25a7c5[_0x9e82('0x6a')]})[_0x9e82('0x9e')](function(){})[_0x9e82('0x9f')](function(){var _0x3b3819=_0x56e7a8[_0x9e82('0x1c')][_0x25a7c5['destinationchannel'][_0x9e82('0x4b')]('-')[0x0]];if(!_0x3b3819)return;io[_0x9e82('0x37')](_0x9e82('0xa0'),{'agentId':_0x3b3819['id'],'uniqueid':_0x25a7c5[_0x9e82('0x3a')]});});});});})[_0x9e82('0x99')](function(){if(_0x5cc69f['event']===_0x9e82('0xa1')){_0x56e7a8[_0x9e82('0x1d')][_0x5cc69f['uniqueid']]=_0x56e7a8['channels'][_0x5cc69f[_0x9e82('0x3a')]];}else{if(_0x56e7a8['channels'][_0x5cc69f[_0x9e82('0x3a')]]['type']===_0x9e82('0xa2')&&_0x56e7a8[_0x9e82('0x1d')][_0x5cc69f[_0x9e82('0x3a')]]){_0x56e7a8[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]][_0x9e82('0x3a')]=[_0x56e7a8[_0x9e82('0x1b')][_0x5cc69f['uniqueid']]['linkedid'],_0x56e7a8[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]][_0x9e82('0x3e')]=_0x56e7a8['channels'][_0x5cc69f['uniqueid']][_0x9e82('0x3a')]][0x0];delete _0x56e7a8[_0x9e82('0x1d')][_0x5cc69f[_0x9e82('0x3a')]];}}logger[_0x9e82('0x3d')](_0x9e82('0xa3'),_0x5cc69f[_0x9e82('0x3a')],util['inspect'](_0x56e7a8[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]],{'showHidden':![],'depth':null}));ami[_0x9e82('0x37')](_0x9e82('0xa4'),_0x56e7a8[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]]);delete _0x56e7a8[_0x9e82('0x1b')][_0x5cc69f[_0x9e82('0x3a')]];});}}}catch(_0x3ee74b){logger[_0x9e82('0x31')](_0x9e82('0xa5'),_0x5cc69f['uniqueid'],util[_0x9e82('0x33')](_0x3ee74b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')][_0x9e82('0x29')]=function(_0xd6f34c){try{if(this['isNotNull'](_0xd6f34c)){logger['info'](_0x9e82('0xa6'),_0xd6f34c[_0x9e82('0x3a')],_0xd6f34c[_0x9e82('0xa7')],_0xd6f34c[_0x9e82('0xa8')]);logger[_0x9e82('0x3d')](_0x9e82('0xa9'),_0xd6f34c['uniqueid'],util['inspect'](_0xd6f34c,{'showHidden':![],'depth':null}));if(this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaa')]]){this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaa')]]['transfercalleridnum']=_0xd6f34c[_0x9e82('0xa7')];this['channels'][_0xd6f34c['transfereeuniqueid']][_0x9e82('0xab')]=_0xd6f34c[_0x9e82('0xa8')];if(this['channels'][_0xd6f34c['secondtransfereruniqueid']]){var _0x1409f3=this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xac')]];this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xac')]]=this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaa')]];this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaa')]]=_0x1409f3;}}else if(this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xad')]]){this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xad')]][_0x9e82('0xae')]=_0xd6f34c['origtransferercalleridnum'];this['channels'][_0xd6f34c[_0x9e82('0xad')]][_0x9e82('0xab')]=_0xd6f34c['transfertargetcalleridnum'];if(this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaf')]]){var _0x1409f3=this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaf')]];this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaf')]]=this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xad')]];this['channels'][_0xd6f34c[_0x9e82('0xad')]]=_0x1409f3;}}if((this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaf')]]||this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xb0')]])&&this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xac')]]){var _0x42dee9=_[_0x9e82('0xb1')]([this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaf')]],this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xb0')]],this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xac')]]],function(_0x278eb9){return _0x278eb9&&_0x278eb9['type']===_0x9e82('0xa2')&&_0x278eb9[_0x9e82('0xb2')];});if(_0x42dee9){if(this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaf')]])this[_0x9e82('0x1b')][_0xd6f34c[_0x9e82('0xaf')]]['transferType']=_0x9e82('0xb3');if(this['channels'][_0xd6f34c['origtransfererlinkedid']])this[_0x9e82('0x1b')][_0xd6f34c['origtransfererlinkedid']][_0x9e82('0x9a')]='ATTENDED';this['channels'][_0xd6f34c['secondtransfereruniqueid']]['transferType']=_0x9e82('0xb3');}}}}catch(_0x5b6f94){logger[_0x9e82('0x31')](_0x9e82('0xb4'),_0xd6f34c['uniqueid'],util['inspect'](_0x5b6f94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')]['syncBlindTransfer']=function(_0x436f5c){try{if(this[_0x9e82('0x35')](_0x436f5c)){logger[_0x9e82('0x38')](_0x9e82('0xb5'),_0x436f5c['uniqueid'],_0x436f5c[_0x9e82('0xb6')],_0x436f5c[_0x9e82('0xb7')]);logger[_0x9e82('0x3d')](_0x9e82('0xb8'),_0x436f5c[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x436f5c,{'showHidden':![],'depth':null}));if(this['channels'][_0x436f5c[_0x9e82('0xaa')]]){this[_0x9e82('0x1b')][_0x436f5c[_0x9e82('0xaa')]]['transfercalleridnum']=_0x436f5c['transfereecalleridnum'];this[_0x9e82('0x1b')][_0x436f5c['transfereeuniqueid']][_0x9e82('0xab')]=_0x436f5c[_0x9e82('0xb7')];this[_0x9e82('0x1b')][_0x436f5c[_0x9e82('0xaa')]][_0x9e82('0x9a')]=_0x9e82('0xb9');this[_0x9e82('0x90')]({'event':_0x9e82('0xa1'),'uniqueid':_0x436f5c['transfereeuniqueid'],'context':_0x436f5c[_0x9e82('0x44')],'channel':_0x436f5c['transfererchannel']});}else{this[_0x9e82('0x1b')][_0x436f5c[_0x9e82('0xba')]]['transferType']=_0x9e82('0xb9');}}}catch(_0x29d105){logger[_0x9e82('0x31')](_0x9e82('0xbb'),_0x436f5c['uniqueid'],util[_0x9e82('0x33')](_0x29d105,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')]['syncMusicOnHoldStart']=function(_0xb59eef){try{if(this[_0x9e82('0x35')](_0xb59eef)){logger[_0x9e82('0x3d')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0xb59eef['uniqueid'],util['inspect'](_0xb59eef,{'showHidden':![],'depth':null}));if(this['channels'][_0xb59eef['uniqueid']]){if(!_['isNil'](this[_0x9e82('0x1b')][_0xb59eef[_0x9e82('0x3a')]]['answertime'])){this[_0x9e82('0x1b')][_0xb59eef[_0x9e82('0x3a')]][_0x9e82('0xbc')]=moment()[_0x9e82('0x47')](_0x9e82('0x48'));logger['info'](_0x9e82('0xbd'),_0xb59eef[_0x9e82('0x3a')],this[_0x9e82('0x1b')][_0xb59eef[_0x9e82('0x3a')]][_0x9e82('0xbc')]);}}}}catch(_0x484fa5){logger['error'](_0x9e82('0xbe'),_0xb59eef[_0x9e82('0x3a')],util[_0x9e82('0x33')](_0x484fa5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9e82('0x34')]['syncMusicOnHoldStop']=function(_0x119db9){try{if(this[_0x9e82('0x35')](_0x119db9)){logger[_0x9e82('0x3d')](_0x9e82('0xbf'),_0x119db9['uniqueid'],util[_0x9e82('0x33')](_0x119db9,{'showHidden':![],'depth':null}));if(this[_0x9e82('0x1b')][_0x119db9['uniqueid']]){if(!_[_0x9e82('0x72')](this[_0x9e82('0x1b')][_0x119db9[_0x9e82('0x3a')]][_0x9e82('0xbc')])){this[_0x9e82('0x1b')][_0x119db9[_0x9e82('0x3a')]][_0x9e82('0xc0')]+=moment()[_0x9e82('0xc1')](0x0)[_0x9e82('0x67')](this[_0x9e82('0x1b')][_0x119db9[_0x9e82('0x3a')]][_0x9e82('0xbc')],_0x9e82('0x5c'));logger['info'](_0x9e82('0xc2'),_0x119db9[_0x9e82('0x3a')],this['channels'][_0x119db9[_0x9e82('0x3a')]]['mohtime']);delete this[_0x9e82('0x1b')][_0x119db9[_0x9e82('0x3a')]]['mohstarttime'];}}}}catch(_0x49c1b8){logger['error']('[%s][voiceCallReport][musiconholdstop]',_0x119db9['uniqueid'],util['inspect'](_0x49c1b8,{'showHidden':![],'depth':null}));}};module[_0x9e82('0xc3')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 06737ae..e3b7ab1 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5093=['membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinename','answertime','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','variable','value','outboundrouteid','isUndefined','keys','error','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','seconds','lastevent','complete','total','answered','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','debug','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called'];(function(_0x521084,_0x2684ff){var _0x238363=function(_0x55b73b){while(--_0x55b73b){_0x521084['push'](_0x521084['shift']());}};_0x238363(++_0x2684ff);}(_0x5093,0xae));var _0x3509=function(_0x5a6d3b,_0x15a93b){_0x5a6d3b=_0x5a6d3b-0x0;var _0x3aaf17=_0x5093[_0x5a6d3b];return _0x3aaf17;};'use strict';var _=require(_0x3509('0x0'));var moment=require(_0x3509('0x1'));var util=require(_0x3509('0x2'));var Redis=require(_0x3509('0x3'));var config=require(_0x3509('0x4'));var logger=require(_0x3509('0x5'))(_0x3509('0x6'));var ami=require(_0x3509('0x7'));config['redis']=_[_0x3509('0x8')](config[_0x3509('0x9')],{'host':_0x3509('0xa'),'port':0x18eb});var io=require(_0x3509('0xb'))(new Redis(config[_0x3509('0x9')]));function VoiceDialReport(_0x2b117f){this[_0x3509('0xc')]=_0x2b117f[_0x3509('0xd')];this[_0x3509('0xe')]=_0x2b117f[_0x3509('0xe')];this[_0x3509('0xf')]={};ami['on'](_0x3509('0x10'),this[_0x3509('0x11')][_0x3509('0x12')](this));ami['on'](_0x3509('0x13'),this[_0x3509('0x14')][_0x3509('0x12')](this));ami['on']('varset',this[_0x3509('0x15')][_0x3509('0x12')](this));ami['on'](_0x3509('0x16'),this[_0x3509('0x17')][_0x3509('0x12')](this));}VoiceDialReport[_0x3509('0x18')][_0x3509('0x19')]=function(_0x414801){return _0x414801!==null&&!_['isUndefined'](_0x414801);};VoiceDialReport['prototype'][_0x3509('0x1a')]=function(_0x3c89a4,_0x6882a1,_0x1b7a25){io['to'](_0x3c89a4)[_0x3509('0x1a')](_0x6882a1,_0x1b7a25);};VoiceDialReport['prototype'][_0x3509('0x11')]=function(_0x13bcd7){try{if(this[_0x3509('0x19')](_0x13bcd7)){logger[_0x3509('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x13bcd7[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x13bcd7,{'showHidden':![],'depth':null}));if(this['channels'][_0x13bcd7[_0x3509('0x1c')]]){_[_0x3509('0x1e')](this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]],{'starttime':moment()[_0x3509('0x1f')](_0x3509('0x20')),'lastevent':_0x3509('0x21'),'interface':_0x13bcd7['channel'][_0x3509('0x22')](0x0,_0x13bcd7[_0x3509('0x23')]['lastIndexOf']('-')),'membername':_0x13bcd7['channel'][_0x3509('0x22')](_0x13bcd7[_0x3509('0x23')][_0x3509('0x24')]('/')+0x1,_0x13bcd7[_0x3509('0x23')]['lastIndexOf']('-'))},_[_0x3509('0x25')](_0x13bcd7,[_0x3509('0x26'),'privilege']));logger['info'](_0x3509('0x27'),_0x13bcd7[_0x3509('0x1c')],this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]][_0x3509('0x28')],this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]][_0x3509('0x29')]);logger[_0x3509('0x1b')](_0x3509('0x2a'),_0x13bcd7[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),_0x3509('0x2c'),this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]]);logger[_0x3509('0x1b')](_0x3509('0x2d'),_0x13bcd7[_0x3509('0x1c')],util['inspect'](this[_0x3509('0xc')][_0x13bcd7[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x2e'),this[_0x3509('0xc')][_0x13bcd7['uniqueid']]);}}}catch(_0x4e28c6){logger['error'](_0x3509('0x2f'),_0x13bcd7[_0x3509('0x1c')],util['inspect'](_0x4e28c6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3509('0x18')][_0x3509('0x14')]=function(_0x2e848c){try{if(this[_0x3509('0x19')](_0x2e848c)){logger[_0x3509('0x1b')](_0x3509('0x30'),_0x2e848c[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x2e848c,{'showHidden':![],'depth':null}));if(this[_0x3509('0xc')][_0x2e848c['uniqueid']]){this[_0x3509('0xc')][_0x2e848c['uniqueid']][_0x3509('0x31')]=_0x2e848c[_0x3509('0x31')];if(_0x2e848c[_0x3509('0x31')]===_0x3509('0x32')){this[_0x3509('0xc')][_0x2e848c['uniqueid']]['connectedlinenum']=_0x2e848c['connectedlinenum'];this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]][_0x3509('0x33')]=_0x2e848c[_0x3509('0x33')];this[_0x3509('0xc')][_0x2e848c['uniqueid']][_0x3509('0x34')]=moment()[_0x3509('0x1f')](_0x3509('0x20'));this[_0x3509('0xc')][_0x2e848c['uniqueid']]['lastevent']='connect';logger[_0x3509('0x35')](_0x3509('0x36'),_0x2e848c[_0x3509('0x1c')],_0x2e848c[_0x3509('0x23')]['substring'](_0x2e848c['channel'][_0x3509('0x24')]('/')+0x1,_0x2e848c['channel'][_0x3509('0x24')]('-')));logger[_0x3509('0x1b')](_0x3509('0x37'),_0x2e848c['uniqueid'],util['inspect'](this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x38'),this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2e848c[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x2e848c['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x3509('0x2c'),this[_0x3509('0xc')][_0x2e848c[_0x3509('0x1c')]]);}}}catch(_0x15b566){logger['error'](_0x3509('0x39'),_0x2e848c[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x15b566,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x33732f){try{if(this[_0x3509('0x19')](_0x33732f)){logger[_0x3509('0x1b')]('[%s][voiceDialReport][varset]\x20event:',_0x33732f[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x33732f,{'showHidden':![],'depth':null}));this['addVariable'](_0x33732f['uniqueid'],_['keys'](_0x33732f[_0x3509('0x3a')])[0x0],_0x33732f[_0x3509('0x3b')]);if(this['isNotNull'](_0x33732f['variable'])&&this[_0x3509('0x19')](_0x33732f[_0x3509('0x3a')][_0x3509('0x3c')])){if(_[_0x3509('0x3d')](this[_0x3509('0xc')][_0x33732f[_0x3509('0x1c')]])){this[_0x3509('0xc')][_0x33732f['uniqueid']]={'routeId':_0x33732f[_0x3509('0x3b')],'variables':this[_0x3509('0xf')][_0x33732f[_0x3509('0x1c')]]};logger[_0x3509('0x35')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x33732f[_0x3509('0x1c')],_0x33732f[_0x3509('0x3a')][_0x3509('0x3c')],_[_0x3509('0x3e')](_0x33732f[_0x3509('0x3a')])[0x0],_0x33732f[_0x3509('0x3b')]);logger[_0x3509('0x1b')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x33732f[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x33732f[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),_0x3509('0x2c'),this['channels'][_0x33732f[_0x3509('0x1c')]]);}}}}catch(_0x2ccde8){logger[_0x3509('0x3f')]('[%s][voiceDialReport][varset]',_0x33732f[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x2ccde8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3509('0x18')][_0x3509('0x40')]=function(_0x210b41,_0x1069a0,_0x39c09c){var _0x4f21b0=[_0x3509('0x41'),_0x3509('0x42'),_0x3509('0x43'),_0x3509('0x44'),_0x3509('0x45'),_0x3509('0x46'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x3509('0x47'),_0x3509('0x48'),_0x3509('0x49'),_0x3509('0x4a'),_0x3509('0x4b'),_0x3509('0x4c'),_0x3509('0x4d'),_0x3509('0x4e'),_0x3509('0x28'),_0x3509('0x4f'),_0x3509('0x50')];if(!_[_0x3509('0x51')](_0x1069a0)&&!_['includes'](_0x4f21b0,_0x1069a0)){if(_[_0x3509('0x3d')](this[_0x3509('0xf')][_0x210b41])){this[_0x3509('0xf')][_0x210b41]={};}this[_0x3509('0xf')][_0x210b41][_0x1069a0]=_0x39c09c;}};VoiceDialReport[_0x3509('0x18')][_0x3509('0x17')]=function(_0x2b6434){try{if(this[_0x3509('0x19')](_0x2b6434)){logger[_0x3509('0x1b')](_0x3509('0x52'),_0x2b6434[_0x3509('0x1c')],util[_0x3509('0x1d')](_0x2b6434,{'showHidden':![],'depth':null}));if(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]){logger[_0x3509('0x35')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x2b6434['uniqueid'],_0x2b6434[_0x3509('0x53')]);this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x54')]=moment()[_0x3509('0x1f')](_0x3509('0x20'));this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]['duration']=moment(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x54')])[_0x3509('0x55')](this['channels'][_0x2b6434[_0x3509('0x1c')]]['starttime'],_0x3509('0x56'));this['channels'][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x57')]=_0x3509('0x58');this['outbound'][_0x3509('0x59')]+=0x1;if(this[_0x3509('0xc')][_0x2b6434['uniqueid']][_0x3509('0x34')]){this[_0x3509('0xe')][_0x3509('0x5a')]+=0x1;this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]['holdtime']=moment(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]['answertime'])['diff'](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x5b')],'seconds');this['channels'][_0x2b6434['uniqueid']][_0x3509('0x5c')]=moment(this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x54')])['diff'](this['channels'][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x34')],_0x3509('0x56'));this[_0x3509('0xe')][_0x3509('0x5d')]+=this[_0x3509('0xc')][_0x2b6434['uniqueid']][_0x3509('0x5e')]||0x0;this[_0x3509('0xe')][_0x3509('0x5f')]+=this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]][_0x3509('0x5c')];}this[_0x3509('0xe')]['sumDuration']+=this[_0x3509('0xc')][_0x2b6434['uniqueid']][_0x3509('0x60')];logger[_0x3509('0x1b')](_0x3509('0x61'),_0x2b6434['uniqueid'],util['inspect'](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x62'),this[_0x3509('0xc')][_0x2b6434['uniqueid']]);logger[_0x3509('0x1b')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2b6434[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x3509('0x1a')](_0x3509('0x63'),this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]);logger[_0x3509('0x1b')](_0x3509('0x64'),_0x2b6434[_0x3509('0x1c')],util['inspect'](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),'voice_outbound:save',this[_0x3509('0xe')]);logger['info'](_0x3509('0x65'),JSON[_0x3509('0x66')](this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]));logger[_0x3509('0x1b')](_0x3509('0x67'),_0x2b6434[_0x3509('0x1c')],util[_0x3509('0x1d')](this[_0x3509('0xc')][_0x2b6434['uniqueid']],{'showHidden':![],'depth':null}));this[_0x3509('0x1a')](_0x3509('0x2b'),_0x3509('0x68'),this[_0x3509('0xc')][_0x2b6434[_0x3509('0x1c')]]);delete this['channels'][_0x2b6434[_0x3509('0x1c')]];}else if(this[_0x3509('0xc')][_0x2b6434['linkedid']]){this[_0x3509('0xc')][_0x2b6434[_0x3509('0x69')]][_0x3509('0x1c')]=this[_0x3509('0xc')][_0x2b6434[_0x3509('0x69')]][_0x3509('0x6a')];}if(this['variables'][_0x2b6434['uniqueid']]){delete this[_0x3509('0xf')][_0x2b6434['uniqueid']];}}}catch(_0x5ead73){logger[_0x3509('0x3f')]('[%s][voiceDialReport][hangup]',_0x2b6434['uniqueid'],util[_0x3509('0x1d')](_0x5ead73,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xee11=['diff','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncVarSet','hangup','isNotNull','isUndefined','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','called','channel','substring','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','addVariable','variable','value','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','starttime','seconds','complete','total','answered','answertime'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xee11,0x1c9));var _0x1ee1=function(_0x30861a,_0x337deb){_0x30861a=_0x30861a-0x0;var _0xa37ad6=_0xee11[_0x30861a];return _0xa37ad6;};'use strict';var _=require(_0x1ee1('0x0'));var moment=require(_0x1ee1('0x1'));var util=require('util');var Redis=require(_0x1ee1('0x2'));var config=require(_0x1ee1('0x3'));var logger=require(_0x1ee1('0x4'))(_0x1ee1('0x5'));var ami=require(_0x1ee1('0x6'));config[_0x1ee1('0x7')]=_[_0x1ee1('0x8')](config[_0x1ee1('0x7')],{'host':_0x1ee1('0x9'),'port':0x18eb});var io=require(_0x1ee1('0xa'))(new Redis(config[_0x1ee1('0x7')]));function VoiceDialReport(_0x6f75fb){this[_0x1ee1('0xb')]=_0x6f75fb[_0x1ee1('0xc')];this['outbound']=_0x6f75fb[_0x1ee1('0xd')];this[_0x1ee1('0xe')]={};ami['on'](_0x1ee1('0xf'),this[_0x1ee1('0x10')][_0x1ee1('0x11')](this));ami['on'](_0x1ee1('0x12'),this['syncDialEnd']['bind'](this));ami['on']('varset',this[_0x1ee1('0x13')][_0x1ee1('0x11')](this));ami['on'](_0x1ee1('0x14'),this['syncHangup'][_0x1ee1('0x11')](this));}VoiceDialReport['prototype'][_0x1ee1('0x15')]=function(_0x1e75c6){return _0x1e75c6!==null&&!_[_0x1ee1('0x16')](_0x1e75c6);};VoiceDialReport[_0x1ee1('0x17')][_0x1ee1('0x18')]=function(_0xc1892e,_0x3df6a8,_0x31d8d9){io['to'](_0xc1892e)[_0x1ee1('0x18')](_0x3df6a8,_0x31d8d9);};VoiceDialReport[_0x1ee1('0x17')][_0x1ee1('0x10')]=function(_0x1eb8d1){try{if(this[_0x1ee1('0x15')](_0x1eb8d1)){logger['debug'](_0x1ee1('0x19'),_0x1eb8d1[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](_0x1eb8d1,{'showHidden':![],'depth':null}));if(this[_0x1ee1('0xb')][_0x1eb8d1[_0x1ee1('0x1a')]]){_['merge'](this[_0x1ee1('0xb')][_0x1eb8d1[_0x1ee1('0x1a')]],{'starttime':moment()[_0x1ee1('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x1ee1('0x1d'),'interface':_0x1eb8d1[_0x1ee1('0x1e')][_0x1ee1('0x1f')](0x0,_0x1eb8d1[_0x1ee1('0x1e')]['lastIndexOf']('-')),'membername':_0x1eb8d1[_0x1ee1('0x1e')][_0x1ee1('0x1f')](_0x1eb8d1['channel'][_0x1ee1('0x20')]('/')+0x1,_0x1eb8d1[_0x1ee1('0x1e')][_0x1ee1('0x20')]('-'))},_['omit'](_0x1eb8d1,[_0x1ee1('0x21'),_0x1ee1('0x22')]));logger[_0x1ee1('0x23')](_0x1ee1('0x24'),_0x1eb8d1['uniqueid'],this['channels'][_0x1eb8d1[_0x1ee1('0x1a')]][_0x1ee1('0x25')],this[_0x1ee1('0xb')][_0x1eb8d1[_0x1ee1('0x1a')]][_0x1ee1('0x26')]);logger[_0x1ee1('0x27')](_0x1ee1('0x28'),_0x1eb8d1[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](this[_0x1ee1('0xb')][_0x1eb8d1[_0x1ee1('0x1a')]],{'showHidden':![],'depth':null}));this[_0x1ee1('0x18')](_0x1ee1('0x29'),_0x1ee1('0x2a'),this[_0x1ee1('0xb')][_0x1eb8d1['uniqueid']]);logger[_0x1ee1('0x27')](_0x1ee1('0x2b'),_0x1eb8d1[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](this[_0x1ee1('0xb')][_0x1eb8d1[_0x1ee1('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x1ee1('0x2c'),this[_0x1ee1('0xb')][_0x1eb8d1[_0x1ee1('0x1a')]]);}}}catch(_0x1d5fc2){logger[_0x1ee1('0x2d')](_0x1ee1('0x2e'),_0x1eb8d1[_0x1ee1('0x1a')],util['inspect'](_0x1d5fc2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1ee1('0x17')][_0x1ee1('0x2f')]=function(_0x46e446){try{if(this[_0x1ee1('0x15')](_0x46e446)){logger[_0x1ee1('0x27')](_0x1ee1('0x30'),_0x46e446[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](_0x46e446,{'showHidden':![],'depth':null}));if(this[_0x1ee1('0xb')][_0x46e446[_0x1ee1('0x1a')]]){this[_0x1ee1('0xb')][_0x46e446['uniqueid']][_0x1ee1('0x31')]=_0x46e446[_0x1ee1('0x31')];if(_0x46e446[_0x1ee1('0x31')]===_0x1ee1('0x32')){this[_0x1ee1('0xb')][_0x46e446[_0x1ee1('0x1a')]][_0x1ee1('0x33')]=_0x46e446[_0x1ee1('0x33')];this['channels'][_0x46e446[_0x1ee1('0x1a')]]['connectedlinename']=_0x46e446[_0x1ee1('0x34')];this[_0x1ee1('0xb')][_0x46e446[_0x1ee1('0x1a')]]['answertime']=moment()[_0x1ee1('0x1c')](_0x1ee1('0x35'));this[_0x1ee1('0xb')][_0x46e446['uniqueid']][_0x1ee1('0x36')]='connect';logger[_0x1ee1('0x23')](_0x1ee1('0x37'),_0x46e446[_0x1ee1('0x1a')],_0x46e446[_0x1ee1('0x1e')]['substring'](_0x46e446[_0x1ee1('0x1e')][_0x1ee1('0x20')]('/')+0x1,_0x46e446['channel'][_0x1ee1('0x20')]('-')));logger[_0x1ee1('0x27')](_0x1ee1('0x38'),_0x46e446[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](this['channels'][_0x46e446['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x1ee1('0x39'),this['channels'][_0x46e446['uniqueid']]);}logger[_0x1ee1('0x27')](_0x1ee1('0x3a'),_0x46e446['uniqueid'],util[_0x1ee1('0x1b')](this[_0x1ee1('0xb')][_0x46e446[_0x1ee1('0x1a')]],{'showHidden':![],'depth':null}));this[_0x1ee1('0x18')](_0x1ee1('0x29'),_0x1ee1('0x2a'),this['channels'][_0x46e446['uniqueid']]);}}}catch(_0x2cab8c){logger[_0x1ee1('0x2d')](_0x1ee1('0x3b'),_0x46e446[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](_0x2cab8c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1ee1('0x17')][_0x1ee1('0x13')]=function(_0xf5dabb){try{if(this[_0x1ee1('0x15')](_0xf5dabb)){logger[_0x1ee1('0x27')]('[%s][voiceDialReport][varset]\x20event:',_0xf5dabb[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](_0xf5dabb,{'showHidden':![],'depth':null}));this[_0x1ee1('0x3c')](_0xf5dabb['uniqueid'],_['keys'](_0xf5dabb[_0x1ee1('0x3d')])[0x0],_0xf5dabb[_0x1ee1('0x3e')]);if(this[_0x1ee1('0x15')](_0xf5dabb[_0x1ee1('0x3d')])&&this[_0x1ee1('0x15')](_0xf5dabb[_0x1ee1('0x3d')][_0x1ee1('0x3f')])){if(_[_0x1ee1('0x16')](this[_0x1ee1('0xb')][_0xf5dabb['uniqueid']])){this[_0x1ee1('0xb')][_0xf5dabb[_0x1ee1('0x1a')]]={'routeId':_0xf5dabb[_0x1ee1('0x3e')],'variables':this[_0x1ee1('0xe')][_0xf5dabb[_0x1ee1('0x1a')]]};logger[_0x1ee1('0x23')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0xf5dabb[_0x1ee1('0x1a')],_0xf5dabb[_0x1ee1('0x3d')][_0x1ee1('0x3f')],_[_0x1ee1('0x40')](_0xf5dabb['variable'])[0x0],_0xf5dabb[_0x1ee1('0x3e')]);logger['debug'](_0x1ee1('0x41'),_0xf5dabb[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](this[_0x1ee1('0xb')][_0xf5dabb['uniqueid']],{'showHidden':![],'depth':null}));this[_0x1ee1('0x18')](_0x1ee1('0x29'),'voice_outbound_channel:save',this[_0x1ee1('0xb')][_0xf5dabb[_0x1ee1('0x1a')]]);}}}}catch(_0x288fc7){logger['error']('[%s][voiceDialReport][varset]',_0xf5dabb['uniqueid'],util[_0x1ee1('0x1b')](_0x288fc7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1ee1('0x17')][_0x1ee1('0x3c')]=function(_0x4b2855,_0x41a44b,_0x140cb5){var _0x47c425=[_0x1ee1('0x42'),_0x1ee1('0x43'),'rtpaudioqosjitter',_0x1ee1('0x44'),_0x1ee1('0x45'),_0x1ee1('0x46'),_0x1ee1('0x47'),_0x1ee1('0x48'),'sipcallid',_0x1ee1('0x49'),_0x1ee1('0x4a'),_0x1ee1('0x4b'),_0x1ee1('0x4c'),_0x1ee1('0x4d'),_0x1ee1('0x4e'),_0x1ee1('0x4f'),_0x1ee1('0x25'),_0x1ee1('0x50'),'memberrealtime'];if(!_[_0x1ee1('0x51')](_0x41a44b)&&!_[_0x1ee1('0x52')](_0x47c425,_0x41a44b)){if(_[_0x1ee1('0x16')](this['variables'][_0x4b2855])){this['variables'][_0x4b2855]={};}this['variables'][_0x4b2855][_0x41a44b]=_0x140cb5;}};VoiceDialReport[_0x1ee1('0x17')][_0x1ee1('0x53')]=function(_0x415d81){try{if(this[_0x1ee1('0x15')](_0x415d81)){logger[_0x1ee1('0x27')](_0x1ee1('0x54'),_0x415d81[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](_0x415d81,{'showHidden':![],'depth':null}));if(this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]]){logger['info'](_0x1ee1('0x55'),_0x415d81[_0x1ee1('0x1a')],_0x415d81['cause-txt']);this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x56')]=moment()['format'](_0x1ee1('0x35'));this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]]['duration']=moment(this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x56')])['diff'](this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x57')],_0x1ee1('0x58'));this['channels'][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x36')]=_0x1ee1('0x59');this['outbound'][_0x1ee1('0x5a')]+=0x1;if(this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]]['answertime']){this[_0x1ee1('0xd')][_0x1ee1('0x5b')]+=0x1;this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]]['holdtime']=moment(this['channels'][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x5c')])[_0x1ee1('0x5d')](this[_0x1ee1('0xb')][_0x415d81['uniqueid']][_0x1ee1('0x57')],_0x1ee1('0x58'));this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x5e')]=moment(this['channels'][_0x415d81['uniqueid']][_0x1ee1('0x56')])[_0x1ee1('0x5d')](this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x5c')],_0x1ee1('0x58'));this['outbound'][_0x1ee1('0x5f')]+=this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x60')]||0x0;this['outbound'][_0x1ee1('0x61')]+=this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x5e')];}this[_0x1ee1('0xd')][_0x1ee1('0x62')]+=this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]][_0x1ee1('0x63')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x415d81['uniqueid'],util['inspect'](this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]]);logger['debug'](_0x1ee1('0x64'),_0x415d81[_0x1ee1('0x1a')],util[_0x1ee1('0x1b')](this['channels'][_0x415d81[_0x1ee1('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x1ee1('0x18')](_0x1ee1('0x65'),this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]]);logger[_0x1ee1('0x27')](_0x1ee1('0x66'),_0x415d81[_0x1ee1('0x1a')],util['inspect'](this['channels'][_0x415d81[_0x1ee1('0x1a')]],{'showHidden':![],'depth':null}));this[_0x1ee1('0x18')](_0x1ee1('0x29'),_0x1ee1('0x67'),this[_0x1ee1('0xd')]);logger[_0x1ee1('0x23')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x1ee1('0x68')](this['channels'][_0x415d81[_0x1ee1('0x1a')]]));logger['debug'](_0x1ee1('0x69'),_0x415d81['uniqueid'],util[_0x1ee1('0x1b')](this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]],{'showHidden':![],'depth':null}));this[_0x1ee1('0x18')]('voice:outbound',_0x1ee1('0x6a'),this[_0x1ee1('0xb')][_0x415d81['uniqueid']]);delete this[_0x1ee1('0xb')][_0x415d81[_0x1ee1('0x1a')]];}else if(this['channels'][_0x415d81[_0x1ee1('0x6b')]]){this[_0x1ee1('0xb')][_0x415d81['linkedid']][_0x1ee1('0x1a')]=this['channels'][_0x415d81[_0x1ee1('0x6b')]][_0x1ee1('0x6c')];}if(this['variables'][_0x415d81[_0x1ee1('0x1a')]]){delete this[_0x1ee1('0xe')][_0x415d81[_0x1ee1('0x1a')]];}}}catch(_0x31f492){logger[_0x1ee1('0x2d')]('[%s][voiceDialReport][hangup]',_0x415d81['uniqueid'],util[_0x1ee1('0x1b')](_0x31f492,{'showHidden':![],'depth':null}));}};module[_0x1ee1('0x6d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 1f5f96c..898ed76 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9990=['unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','custom:voiceQueueReport','transfereeuniqueid','transferuniqueid','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','BLINDTRANSFER','extension','context','transfererchannel','isNil','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','moment','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','agents','channels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','Action','status','channel','message','No\x20such\x20channel','inspect','queueReports','error','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','catch','[voiceQueueReport][queues]','loopQueueSummary','then','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','queuecallerjoinAt','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','push','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','toLowerCase','local/','linkedid','add','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','agentcomplete','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','queuestatus','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','diff','seconds','milliseconds','answered','queuecallercompleteAt'];(function(_0x1faf53,_0x4cb24b){var _0x27d873=function(_0x36dba5){while(--_0x36dba5){_0x1faf53['push'](_0x1faf53['shift']());}};_0x27d873(++_0x4cb24b);}(_0x9990,0xf6));var _0x0999=function(_0xc82f28,_0x24e29a){_0xc82f28=_0xc82f28-0x0;var _0x5608b1=_0x9990[_0xc82f28];return _0x5608b1;};'use strict';var _=require('lodash');var moment=require(_0x0999('0x0'));var util=require(_0x0999('0x1'));var md5=require(_0x0999('0x2'));var Redis=require(_0x0999('0x3'));var config=require(_0x0999('0x4'));var logger=require(_0x0999('0x5'))(_0x0999('0x6'));var ami=require(_0x0999('0x7'));var QueueReport=require('../model/queueReport');config[_0x0999('0x8')]=_[_0x0999('0x9')](config[_0x0999('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0999('0xa'))(new Redis(config[_0x0999('0x8')]));var Sequence=function(){};Sequence[_0x0999('0xb')][_0x0999('0xc')]=function(_0x384a4e){this[_0x0999('0xd')]=this[_0x0999('0xd')]?this['tail'][_0x0999('0xe')](_0x384a4e):_0x384a4e();};function VoiceQueueReport(_0x3073d3){this[_0x0999('0xf')]=new Sequence();this['queueReports']={};this[_0x0999('0x10')]=_0x3073d3[_0x0999('0x10')];this[_0x0999('0x11')]=_0x3073d3['queueChannels'];this[_0x0999('0x12')]=_0x3073d3['voiceQueues'];this[_0x0999('0x13')]=!![];this[_0x0999('0x14')]=_0x3073d3[_0x0999('0x14')];this[_0x0999('0x15')]={};ami['on'](_0x0999('0x16'),this['syncQueueSummary'][_0x0999('0x17')](this));ami['on'](_0x0999('0x18'),this[_0x0999('0x19')][_0x0999('0x17')](this));ami['on'](_0x0999('0x1a'),this['syncQueueCallerJoin'][_0x0999('0x17')](this));ami['on'](_0x0999('0x1b'),this[_0x0999('0x1c')][_0x0999('0x17')](this));ami['on'](_0x0999('0x1d'),this[_0x0999('0x1e')][_0x0999('0x17')](this));ami['on']('agentcomplete',this[_0x0999('0x1f')][_0x0999('0x17')](this));ami['on']('agentconnect',this[_0x0999('0x20')][_0x0999('0x17')](this));ami['on']('varset',this[_0x0999('0x21')][_0x0999('0x17')](this));ami['on'](_0x0999('0x22'),this[_0x0999('0x23')][_0x0999('0x17')](this));ami['on'](_0x0999('0x24'),this[_0x0999('0x25')][_0x0999('0x17')](this));ami['on'](_0x0999('0x26'),this['syncMusicOnHoldStart'][_0x0999('0x17')](this));ami['on'](_0x0999('0x27'),this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x0999('0x28'),this[_0x0999('0x29')][_0x0999('0x17')](this));ami['on'](_0x0999('0x2a'),this[_0x0999('0x2b')][_0x0999('0x17')](this));this['loopQueueSummary']();this[_0x0999('0x2c')]();}function clearChannels(_0x5f4611){if(!_[_0x0999('0x2d')](_0x5f4611)){for(var _0x5618b3 in _0x5f4611){if(_0x5f4611[_0x0999('0x2e')](_0x5618b3)){delete _0x5f4611[_0x5618b3];}}}}function clearCampaigns(_0x106669){if(!_[_0x0999('0x2d')](_0x106669)){for(var _0x317127 in _0x106669){if(_0x106669['hasOwnProperty'](_0x317127)){_0x106669[_0x317127]['originated']=0x0;}}}}function clearVoiceQueues(_0x1cc734){if(!_['isEmpty'](_0x1cc734)){for(var _0x353b0a in _0x1cc734){if(_0x1cc734['hasOwnProperty'](_0x353b0a)){_0x1cc734[_0x353b0a][_0x0999('0x2f')]=0x0;_0x1cc734[_0x353b0a][_0x0999('0x30')]=0x0;_0x1cc734[_0x353b0a][_0x0999('0x31')]=0x0;_0x1cc734[_0x353b0a][_0x0999('0x32')]=0x0;_0x1cc734[_0x353b0a][_0x0999('0x33')]=!![];}}}}function clearAgentBooked(_0x155d79){if(!_[_0x0999('0x2d')](_0x155d79)){for(var _0x5c9fb4 in _0x155d79){if(_0x155d79[_0x0999('0x2e')](_0x5c9fb4)){_0x155d79[_0x5c9fb4][_0x0999('0x34')]=!![];}}}}VoiceQueueReport[_0x0999('0xb')][_0x0999('0x35')]=function(){var _0x22a801=this;for(var _0x552f69 in this[_0x0999('0x11')]){if(this[_0x0999('0x11')][_0x0999('0x2e')](_0x552f69)&&!this['channels'][_0x552f69]['switch']){this[_0x0999('0xf')][_0x0999('0xc')](function(){if(!_['isNil'](_0x22a801[_0x0999('0x11')][_0x552f69])){return ami[_0x0999('0x36')]({'action':_0x0999('0x37'),'channel':_0x22a801['channels'][_0x552f69][_0x0999('0x38')]})['catch'](function(_0x38cd21){if(_0x38cd21[_0x0999('0x39')]===_0x0999('0x3a')){setTimeout(function(){if(_0x22a801[_0x0999('0x11')][_0x552f69]){delete _0x22a801[_0x0999('0x11')][_0x552f69];logger['error']('[%s][voiceQueueReport][checkChannel]',_0x552f69,util[_0x0999('0x3b')](_0x38cd21,{'showHidden':![],'depth':null}));}if(_0x22a801[_0x0999('0x3c')][_0x552f69]){delete _0x22a801[_0x0999('0x3c')][_0x552f69];logger[_0x0999('0x3d')]('[%s][voiceQueueReport][checkQueueReport]',_0x552f69,util[_0x0999('0x3b')](_0x38cd21,{'showHidden':![],'depth':null}));}if(_0x22a801[_0x0999('0x15')][_0x552f69]){delete _0x22a801['variables'][_0x552f69];logger[_0x0999('0x3d')](_0x0999('0x3e'),_0x552f69,util[_0x0999('0x3b')](_0x38cd21,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x25')]=function(){logger[_0x0999('0x3d')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x0999('0x11')]);this['clearQueueReport'](this[_0x0999('0x3c')]);clearAgentBooked(this[_0x0999('0x10')]);clearVoiceQueues(this[_0x0999('0x12')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x3f')]=function(_0x408f3c){var _0x699e1c=this;if(!_[_0x0999('0x2d')](_0x408f3c)){for(var _0x32eedc in _0x408f3c){if(_0x408f3c[_0x0999('0x2e')](_0x32eedc)){_0x699e1c[_0x0999('0x40')](_0x408f3c[_0x32eedc],_0x0999('0x41'));delete _0x408f3c[_0x32eedc];}}}};VoiceQueueReport[_0x0999('0xb')]['emit']=function(_0x4224d0,_0x22da38,_0x557358){io['to'](_0x4224d0)[_0x0999('0x42')](_0x22da38,_0x557358);};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x43')]=function(_0xb96f4a,_0x41da42){logger['debug'](_0x0999('0x44')+_0x41da42+_0x0999('0x45'),_0xb96f4a[_0x0999('0x46')],util['inspect'](_0xb96f4a,{'showHidden':![],'depth':null}));this[_0x0999('0x42')](util[_0x0999('0x47')](_0x0999('0x48'),_0xb96f4a[_0x0999('0x49')]),_0x0999('0x4a'),_0xb96f4a);io[_0x0999('0x42')](_0x0999('0x4b'),_0xb96f4a);};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x40')]=function(_0x2c4c6e,_0x18ccae){logger[_0x0999('0x4c')]('[%s][voiceQueueReport]['+_0x18ccae+_0x0999('0x4d'),_0x2c4c6e[_0x0999('0x46')],util['inspect'](_0x2c4c6e,{'showHidden':![],'depth':null}));this['emit'](util[_0x0999('0x47')]('voice:queue:%s',_0x2c4c6e['name']),_0x0999('0x4e'),_0x2c4c6e);io[_0x0999('0x42')](_0x0999('0x4f'),_0x2c4c6e);};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x50')]=function(_0x3df62c,_0x2be18e){if(_0x3df62c[_0x0999('0x51')]===_0x0999('0x52')){var _0x1782eb={'id':_0x3df62c['id'],'name':_0x3df62c[_0x0999('0x49')],'strategy':_0x3df62c['strategy'],'answered':_0x3df62c['answered'],'available':_0x3df62c[_0x0999('0x53')],'loggedIn':_0x3df62c[_0x0999('0x54')],'pTalking':_0x3df62c[_0x0999('0x31')],'sumBillable':_0x3df62c[_0x0999('0x55')],'sumDuration':_0x3df62c[_0x0999('0x56')],'sumHoldTime':_0x3df62c[_0x0999('0x57')]||0x0,'talking':_0x3df62c[_0x0999('0x30')],'total':_0x3df62c[_0x0999('0x58')],'type':_0x3df62c['type'],'unmanaged':_0x3df62c['unmanaged'],'abandoned':_0x3df62c[_0x0999('0x59')],'waiting':_0x3df62c[_0x0999('0x32')]};if(_0x3df62c['Trunk']){_0x1782eb[_0x0999('0x5a')]={'id':_0x3df62c['Trunk']['id'],'name':_0x3df62c['Trunk'][_0x0999('0x49')],'active':_0x3df62c[_0x0999('0x5a')][_0x0999('0x5b')],'callerid':_0x3df62c[_0x0999('0x5a')][_0x0999('0x5c')]};}if(_0x3df62c[_0x0999('0x5d')]){_0x1782eb[_0x0999('0x5d')]={'id':_0x3df62c[_0x0999('0x5d')]['id'],'name':_0x3df62c[_0x0999('0x5d')]['name']};}var _0x2ee544=md5(JSON[_0x0999('0x5e')](_0x1782eb));if(_0x3df62c[_0x0999('0x2')]!==_0x2ee544){_0x3df62c[_0x0999('0x2')]=_0x2ee544;logger[_0x0999('0x4c')](_0x0999('0x5f')+_0x2be18e+_0x0999('0x60'),util[_0x0999('0x3b')](_0x1782eb,{'showHidden':![],'depth':null}));this[_0x0999('0x42')](util['format'](_0x0999('0x48'),_0x1782eb['name']),_0x0999('0x61'),_0x1782eb);}}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x62')]=function(_0x3f2cbe){return _0x3f2cbe!==null&&!_[_0x0999('0x63')](_0x3f2cbe);};VoiceQueueReport['prototype'][_0x0999('0x2c')]=function(){var _0x35e247=this;setInterval(function(){_0x35e247[_0x0999('0x35')]();ami[_0x0999('0x36')]({'action':_0x0999('0x64')})[_0x0999('0x65')](function(_0x563869){logger[_0x0999('0x3d')](_0x0999('0x66'),util[_0x0999('0x3b')](_0x563869,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x67')]=function(){var _0x2995ef=this;setInterval(function(){if(_0x2995ef[_0x0999('0x13')]){return ami['Action']({'action':_0x0999('0x16')})[_0x0999('0x68')](function(_0x7039aa){_0x2995ef[_0x0999('0x13')]=![];})['catch'](function(_0x2a1769){logger[_0x0999('0x3d')](_0x0999('0x69'),util['inspect'](_0x2a1769,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x6a')]=function(_0x43194e){try{if(this['isNotNull'](_0x43194e)&&this[_0x0999('0x62')](_0x43194e[_0x0999('0x6b')])){logger[_0x0999('0x4c')](_0x0999('0x6c'),util[_0x0999('0x3b')](_0x43194e,{'showHidden':![],'depth':null}));if(this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]]){logger[_0x0999('0x6d')](_0x0999('0x6e'),_0x43194e['queue']);var _0x1a05fc=_[_0x0999('0x6f')](this[_0x0999('0x11')],_0x0999('0x6b'))[_0x43194e[_0x0999('0x6b')]]||0x0;var _0x4d86d4=_0x1a05fc-_0x43194e['callers'];if(this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]]['waiting']!==_['toNumber'](_0x43194e['callers'])||this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]][_0x0999('0x54')]!==_[_0x0999('0x70')](_0x43194e[_0x0999('0x71')])||this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]][_0x0999('0x53')]!==_[_0x0999('0x70')](_0x43194e['available'])||this[_0x0999('0x12')][_0x43194e['queue']][_0x0999('0x30')]!==_0x4d86d4){this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]][_0x0999('0x32')]=_[_0x0999('0x70')](_0x43194e['callers']);this['voiceQueues'][_0x43194e[_0x0999('0x6b')]][_0x0999('0x54')]=_[_0x0999('0x70')](_0x43194e[_0x0999('0x71')]);this[_0x0999('0x12')][_0x43194e['queue']][_0x0999('0x53')]=_[_0x0999('0x70')](_0x43194e[_0x0999('0x53')]);this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]][_0x0999('0x30')]=_0x4d86d4>0x0?_0x4d86d4:0x0;this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]][_0x0999('0x30')]=this[_0x0999('0x12')][_0x43194e['queue']][_0x0999('0x30')]>_[_0x0999('0x70')](_0x43194e['loggedin'])?_[_0x0999('0x70')](_0x43194e[_0x0999('0x71')]):this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]]['talking'];this[_0x0999('0x50')](this[_0x0999('0x12')][_0x43194e[_0x0999('0x6b')]],'queuesummary');}logger['debug'](_0x0999('0x72'),util[_0x0999('0x3b')](this[_0x0999('0x12')][_0x43194e['queue']],{'showHidden':![],'depth':null}));ami[_0x0999('0x42')](_0x0999('0x73'),this[_0x0999('0x12')][_0x43194e['queue']]);}}}catch(_0x5cdd52){logger[_0x0999('0x3d')](_0x0999('0x69'),util[_0x0999('0x3b')](_0x5cdd52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x19')]=function(_0x5e10bf){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x0999('0x3b')](_0x5e10bf,{'showHidden':![],'depth':null}));this[_0x0999('0x13')]=!![];};VoiceQueueReport[_0x0999('0xb')]['syncQueueCallerJoin']=function(_0x40473d){try{if(this[_0x0999('0x62')](_0x40473d)){logger[_0x0999('0x4c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x40473d[_0x0999('0x46')],util[_0x0999('0x3b')](_0x40473d,{'showHidden':![],'depth':null}));if(_[_0x0999('0x63')](this['queueReports'][_0x40473d['uniqueid']])){this[_0x0999('0x3c')][_0x40473d['uniqueid']]=[];this[_0x0999('0x11')][_0x40473d['uniqueid']]={};}var _0x189f3f=new QueueReport();_0x189f3f[_0x0999('0x49')]=_0x40473d[_0x0999('0x6b')];_0x189f3f['type']=this[_0x0999('0x12')][_0x189f3f['name']]&&this[_0x0999('0x12')][_0x189f3f[_0x0999('0x49')]][_0x0999('0x51')]?this[_0x0999('0x12')][_0x189f3f[_0x0999('0x49')]][_0x0999('0x51')]||_0x0999('0x52'):_0x0999('0x52');_0x189f3f[_0x0999('0x6b')]=_0x40473d[_0x0999('0x6b')];_0x189f3f[_0x0999('0x74')]=moment()[_0x0999('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x189f3f[_0x0999('0x75')]=_0x40473d[_0x0999('0x75')];_0x189f3f['count']=_0x40473d[_0x0999('0x76')];_0x189f3f[_0x0999('0x46')]=_0x40473d[_0x0999('0x46')];logger[_0x0999('0x6d')](_0x0999('0x77'),_0x189f3f[_0x0999('0x49')],_0x189f3f[_0x0999('0x51')]);_[_0x0999('0x78')](_0x189f3f,_[_0x0999('0x79')](_0x40473d,_['keys'](_0x189f3f)));this[_0x0999('0x3c')][_0x40473d['uniqueid']][_0x0999('0x7a')](_0x189f3f);this[_0x0999('0x11')][_0x40473d[_0x0999('0x46')]]=_0x189f3f;this[_0x0999('0x43')](_0x189f3f,_0x0999('0x1a'));}}catch(_0x48ba0d){logger[_0x0999('0x3d')]('[%s][voiceQueueReport][queuecallerjoin]',_0x40473d[_0x0999('0x46')],util[_0x0999('0x3b')](_0x48ba0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x1c')]=function(_0xe47622){try{if(this[_0x0999('0x62')](_0xe47622)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0xe47622[_0x0999('0x46')],util[_0x0999('0x3b')](_0xe47622,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xe47622[_0x0999('0x46')]]){var _0x1d7821=_[_0x0999('0x7b')](this['queueReports'][_0xe47622[_0x0999('0x46')]]);_0x1d7821[_0x0999('0x7c')]=![];_0x1d7821['queuecallercompleteAt']=null;_0x1d7821[_0x0999('0x7d')]=_0xe47622[_0x0999('0x7d')];_0x1d7821['originalposition']=_0xe47622[_0x0999('0x7e')];_0x1d7821[_0x0999('0x1b')]=!![];_0x1d7821[_0x0999('0x7f')]=moment()['format'](_0x0999('0x80'));_0x1d7821['queuecallerexitreason']='ABANDONED';_0x1d7821[_0x0999('0x81')]=null;logger['info'](_0x0999('0x82'),_0x1d7821[_0x0999('0x49')],_0x1d7821[_0x0999('0x51')]);this[_0x0999('0x11')][_0xe47622[_0x0999('0x46')]]=_0x1d7821;this[_0x0999('0x40')](_0x1d7821,_0x0999('0x1b'));}}}catch(_0x5d4de3){logger[_0x0999('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0xe47622['uniqueid'],util[_0x0999('0x3b')](_0x5d4de3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x1e')]=function(_0x5d002c){try{if(this['isNotNull'](_0x5d002c)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x5d002c[_0x0999('0x46')],util[_0x0999('0x3b')](_0x5d002c,{'showHidden':![],'depth':null}));if(this[_0x0999('0x3c')][_0x5d002c['uniqueid']]){var _0x8270f7=_[_0x0999('0x7b')](this[_0x0999('0x3c')][_0x5d002c[_0x0999('0x46')]]);_0x8270f7[_0x0999('0x83')]=moment()['format'](_0x0999('0x80'));_0x8270f7['connectedlinenum']=_0x5d002c[_0x0999('0x84')];_0x8270f7[_0x0999('0x85')]=_0x5d002c[_0x0999('0x85')];logger[_0x0999('0x6d')](_0x0999('0x86'),_0x8270f7[_0x0999('0x49')],_0x8270f7[_0x0999('0x51')],_0x5d002c[_0x0999('0x84')],_0x5d002c[_0x0999('0x85')]);this[_0x0999('0x11')][_0x5d002c['uniqueid']]=_0x8270f7;this[_0x0999('0x43')](_0x8270f7,_0x0999('0x1d'));}}}catch(_0x17d9ec){logger[_0x0999('0x3d')](_0x0999('0x87'),_0x5d002c[_0x0999('0x46')],util[_0x0999('0x3b')](_0x17d9ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x20')]=function(_0x10c2c6){try{if(this[_0x0999('0x62')](_0x10c2c6)){logger[_0x0999('0x4c')](_0x0999('0x88'),_0x10c2c6[_0x0999('0x46')],util[_0x0999('0x3b')](_0x10c2c6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x10c2c6[_0x0999('0x46')]]){var _0x247221=_['last'](this[_0x0999('0x3c')][_0x10c2c6[_0x0999('0x46')]]);_0x247221[_0x0999('0x7c')]=!![];_0x247221[_0x0999('0x89')]=_0x0999('0x8a');logger[_0x0999('0x6d')](_0x0999('0x8b'),_0x247221[_0x0999('0x49')],_0x247221['type']);}}}catch(_0x1ede04){logger['error'](_0x0999('0x88'),_0x10c2c6['uniqueid'],util[_0x0999('0x3b')](_0x1ede04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x1f')]=function(_0x14bf9c){try{if(this[_0x0999('0x62')](_0x14bf9c)){logger[_0x0999('0x4c')](_0x0999('0x8c'),_0x14bf9c['uniqueid'],util[_0x0999('0x3b')](_0x14bf9c,{'showHidden':![],'depth':null}));if(this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x46')]]){var _0x2e2b27=_['last'](this[_0x0999('0x3c')][_0x14bf9c['uniqueid']]);_0x2e2b27[_0x0999('0x1b')]=![];_0x2e2b27[_0x0999('0x7f')]=null;_0x2e2b27[_0x0999('0x8d')]=!![];_0x2e2b27['lastAssignedTo']=_0x14bf9c[_0x0999('0x8e')];_0x2e2b27[_0x0999('0x7d')]=_0x14bf9c[_0x0999('0x7d')];_0x2e2b27['queuecallercomplete']=!![];_0x2e2b27[_0x0999('0x8f')]=![];_0x2e2b27[_0x0999('0x90')]=null;if(!_0x2e2b27[_0x0999('0x91')]){if(_0x14bf9c[_0x0999('0x92')]=='transfer'){_0x2e2b27[_0x0999('0x89')]=_0x0999('0x93');logger[_0x0999('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2e2b27[_0x0999('0x49')],_0x2e2b27['type']);}else{if(_['startsWith'](_0x14bf9c[_0x0999('0x38')][_0x0999('0x94')](),_0x0999('0x95'))){if(this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]]){var _0x55aca9=_[_0x0999('0x7b')](this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]]);_0x55aca9[_0x0999('0x7c')]=![];_0x55aca9[_0x0999('0x8f')]=!![];_0x55aca9['queuecallerexitAt']=moment(_0x2e2b27[_0x0999('0x74')])[_0x0999('0x97')](_0x14bf9c['holdtime'],'seconds')[_0x0999('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x55aca9['queuecallerexitreason']=_0x0999('0x98');_0x55aca9['transfer']=!![];_0x55aca9[_0x0999('0x99')]=_0x0999('0x9a');_0x55aca9[_0x0999('0x9b')]=_0x14bf9c[_0x0999('0x9c')];_0x55aca9['transferuniqueid']=_0x14bf9c[_0x0999('0x46')];logger[_0x0999('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x55aca9[_0x0999('0x49')],_0x55aca9['type']);var _0x50e697=this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]];this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x96')]]=this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x46')]];this[_0x0999('0x3c')][_0x14bf9c[_0x0999('0x46')]]=_0x50e697;}}else{_0x2e2b27[_0x0999('0x89')]='COMPLETEDBY'+_0x14bf9c[_0x0999('0x92')]['toUpperCase']();logger[_0x0999('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x2e2b27['name'],_0x2e2b27[_0x0999('0x51')],_0x2e2b27['queuecallerexitreason']);}}}this[_0x0999('0x11')][_0x14bf9c[_0x0999('0x46')]]=_0x2e2b27;this[_0x0999('0x40')](_0x2e2b27,_0x0999('0x9d'));}}}catch(_0x208b17){logger[_0x0999('0x3d')](_0x0999('0x8c'),_0x14bf9c[_0x0999('0x46')],util[_0x0999('0x3b')](_0x208b17,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x21')]=function(_0xcc3b62){try{if(this[_0x0999('0x62')](_0xcc3b62)){logger[_0x0999('0x4c')](_0x0999('0x9e'),_0xcc3b62[_0x0999('0x46')],util[_0x0999('0x3b')](_0xcc3b62,{'showHidden':![],'depth':null}));this[_0x0999('0x9f')](_0xcc3b62[_0x0999('0x46')],_[_0x0999('0xa0')](_0xcc3b62[_0x0999('0xa1')])[0x0],_0xcc3b62[_0x0999('0xa2')]);if(this[_0x0999('0x3c')][_0xcc3b62['uniqueid']]){var _0x52e2f8=_['last'](this['queueReports'][_0xcc3b62[_0x0999('0x46')]]);if(_0x52e2f8){if(this[_0x0999('0x62')](_0xcc3b62[_0x0999('0xa1')])&&this[_0x0999('0x62')](_0xcc3b62['variable'][_0x0999('0xa3')])){switch(_0xcc3b62[_0x0999('0xa2')]){case'CONTINUE':_0x52e2f8['queuecallerexit']=![];_0x52e2f8[_0x0999('0x90')]=null;break;case'TIMEOUT':_0x52e2f8[_0x0999('0xa4')]=_0x0999('0xa5');_0x52e2f8[_0x0999('0x8f')]=!![];_0x52e2f8[_0x0999('0x90')]=moment()['format'](_0x0999('0x80'));_0x52e2f8[_0x0999('0x83')]=moment()['format'](_0x0999('0x80'));logger[_0x0999('0x4c')](_0x0999('0xa6'),_0xcc3b62[_0x0999('0x46')],util[_0x0999('0x3b')](_0x52e2f8,{'showHidden':![],'depth':null}));ami[_0x0999('0x42')]('custom:timeout',_0x52e2f8);break;default:_0x52e2f8[_0x0999('0x8f')]=!![];_0x52e2f8[_0x0999('0x90')]=moment()[_0x0999('0x47')](_0x0999('0x80'));_0x52e2f8[_0x0999('0x83')]=moment()[_0x0999('0x47')](_0x0999('0x80'));}_0x52e2f8[_0x0999('0x1b')]=![];_0x52e2f8[_0x0999('0x7f')]=null;_0x52e2f8[_0x0999('0x89')]=_0xcc3b62[_0x0999('0xa2')];this[_0x0999('0x11')][_0xcc3b62[_0x0999('0x46')]]=_0x52e2f8;this[_0x0999('0x40')](_0x52e2f8,_0x0999('0xa7'));}else if(this['isNotNull'](_0xcc3b62[_0x0999('0xa1')])&&this['isNotNull'](_0xcc3b62[_0x0999('0xa1')][_0x0999('0xa8')])){if(!_0x52e2f8[_0x0999('0x1b')]){_0x52e2f8[_0x0999('0x8f')]=!![];_0x52e2f8[_0x0999('0x90')]=moment()[_0x0999('0x47')](_0x0999('0x80'));_0x52e2f8[_0x0999('0x89')]=_0x0999('0xa9');_0x52e2f8[_0x0999('0x83')]=moment()['format'](_0x0999('0x80'));this[_0x0999('0x11')][_0xcc3b62[_0x0999('0x46')]]=_0x52e2f8;}}logger[_0x0999('0x6d')](_0x0999('0xaa'),_0xcc3b62[_0x0999('0x46')],_0x52e2f8[_0x0999('0x49')],_0x52e2f8[_0x0999('0x51')],_[_0x0999('0xa0')](_0xcc3b62[_0x0999('0xa1')])[0x0],_0xcc3b62[_0x0999('0xa2')]);_0x52e2f8[_0x0999('0x15')]=this[_0x0999('0x15')][_0xcc3b62[_0x0999('0x46')]];}}}}catch(_0x38e78c){logger[_0x0999('0x3d')](_0x0999('0x9e'),_0xcc3b62[_0x0999('0x46')],util[_0x0999('0x3b')](_0x38e78c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x9f')]=function(_0x5b0bb0,_0x5ef802,_0x17054a){var _0x1b7047=[_0x0999('0xab'),_0x0999('0xac'),_0x0999('0xad'),'rtpaudioqosjitterbridged',_0x0999('0xae'),_0x0999('0xaf'),'rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri',_0x0999('0xb0'),'bridgepvtcallid','membercalls',_0x0999('0xb1'),_0x0999('0xb2'),_0x0999('0xb3'),'membername',_0x0999('0xb4'),_0x0999('0xb5')];if(!_['isNil'](_0x5ef802)&&!_[_0x0999('0xb6')](_0x1b7047,_0x5ef802)){if(_[_0x0999('0x63')](this['variables'][_0x5b0bb0])){this[_0x0999('0x15')][_0x5b0bb0]={};}this['variables'][_0x5b0bb0][_0x5ef802]=_0x17054a;}};VoiceQueueReport[_0x0999('0xb')][_0x0999('0x23')]=function(_0x4f721f){try{if(this[_0x0999('0x62')](_0x4f721f)){logger[_0x0999('0x4c')](_0x0999('0xb7'),_0x4f721f[_0x0999('0x46')],util[_0x0999('0x3b')](_0x4f721f,{'showHidden':![],'depth':null}));if(this[_0x0999('0x3c')][_0x4f721f[_0x0999('0x46')]]){for(var _0x22bcd0=0x0,_0x5bbc4d={};_0x22bcd00x0?_0x14240b:0x0;this[_0x3fc0('0x11')][_0x397434[_0x3fc0('0x6b')]][_0x3fc0('0x59')]=this['voiceQueues'][_0x397434[_0x3fc0('0x6b')]][_0x3fc0('0x59')]>_[_0x3fc0('0x70')](_0x397434[_0x3fc0('0x71')])?_[_0x3fc0('0x70')](_0x397434[_0x3fc0('0x71')]):this[_0x3fc0('0x11')][_0x397434[_0x3fc0('0x6b')]][_0x3fc0('0x59')];this['emitVoiceQueueSummary'](this[_0x3fc0('0x11')][_0x397434[_0x3fc0('0x6b')]],_0x3fc0('0x14'));}logger[_0x3fc0('0x48')](_0x3fc0('0x73'),util['inspect'](this[_0x3fc0('0x11')][_0x397434[_0x3fc0('0x6b')]],{'showHidden':![],'depth':null}));ami[_0x3fc0('0x47')](_0x3fc0('0x74'),this[_0x3fc0('0x11')][_0x397434[_0x3fc0('0x6b')]]);}}}catch(_0x1da3dc){logger[_0x3fc0('0x3f')](_0x3fc0('0x69'),util[_0x3fc0('0x41')](_0x1da3dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3fc0('0xb')]['syncQueueSummaryComplete']=function(_0x431206){logger['debug'](_0x3fc0('0x75'),util[_0x3fc0('0x41')](_0x431206,{'showHidden':![],'depth':null}));this[_0x3fc0('0x67')]=!![];};VoiceQueueReport[_0x3fc0('0xb')]['syncQueueCallerJoin']=function(_0x596b9a){try{if(this[_0x3fc0('0x63')](_0x596b9a)){logger[_0x3fc0('0x48')]('[%s][voiceQueueReport][queuecallerjoin]',_0x596b9a[_0x3fc0('0x76')],util[_0x3fc0('0x41')](_0x596b9a,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3fc0('0xe')][_0x596b9a[_0x3fc0('0x76')]])){this[_0x3fc0('0xe')][_0x596b9a['uniqueid']]=[];this[_0x3fc0('0x36')][_0x596b9a[_0x3fc0('0x76')]]={};}var _0x30fd71=new QueueReport();_0x30fd71['name']=_0x596b9a['queue'];_0x30fd71[_0x3fc0('0x5a')]=this[_0x3fc0('0x11')][_0x30fd71[_0x3fc0('0x4d')]]&&this[_0x3fc0('0x11')][_0x30fd71[_0x3fc0('0x4d')]]['type']?this[_0x3fc0('0x11')][_0x30fd71[_0x3fc0('0x4d')]][_0x3fc0('0x5a')]||'inbound':'inbound';_0x30fd71[_0x3fc0('0x6b')]=_0x596b9a['queue'];_0x30fd71[_0x3fc0('0x77')]=moment()[_0x3fc0('0x4b')](_0x3fc0('0x78'));_0x30fd71[_0x3fc0('0x79')]=_0x596b9a['position'];_0x30fd71['count']=_0x596b9a[_0x3fc0('0x7a')];_0x30fd71[_0x3fc0('0x76')]=_0x596b9a[_0x3fc0('0x76')];logger[_0x3fc0('0x7b')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x30fd71[_0x3fc0('0x4d')],_0x30fd71[_0x3fc0('0x5a')]);_['merge'](_0x30fd71,_[_0x3fc0('0x7c')](_0x596b9a,_['keys'](_0x30fd71)));this[_0x3fc0('0xe')][_0x596b9a[_0x3fc0('0x76')]]['push'](_0x30fd71);this[_0x3fc0('0x36')][_0x596b9a[_0x3fc0('0x76')]]=_0x30fd71;this[_0x3fc0('0x7d')](_0x30fd71,'queuecallerjoin');}}catch(_0x20bc6a){logger[_0x3fc0('0x3f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x596b9a['uniqueid'],util[_0x3fc0('0x41')](_0x20bc6a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3fc0('0x7e')]=function(_0xe9630e){try{if(this[_0x3fc0('0x63')](_0xe9630e)){logger[_0x3fc0('0x48')]('[%s][voiceQueueReport][queuecallerabandon]',_0xe9630e[_0x3fc0('0x76')],util[_0x3fc0('0x41')](_0xe9630e,{'showHidden':![],'depth':null}));if(this[_0x3fc0('0xe')][_0xe9630e[_0x3fc0('0x76')]]){var _0xd1bbba=_['last'](this[_0x3fc0('0xe')][_0xe9630e['uniqueid']]);_0xd1bbba[_0x3fc0('0x7f')]=![];_0xd1bbba[_0x3fc0('0x80')]=null;_0xd1bbba[_0x3fc0('0x81')]=_0xe9630e[_0x3fc0('0x81')];_0xd1bbba['originalposition']=_0xe9630e['originalposition'];_0xd1bbba[_0x3fc0('0x1a')]=!![];_0xd1bbba[_0x3fc0('0x82')]=moment()[_0x3fc0('0x4b')](_0x3fc0('0x78'));_0xd1bbba[_0x3fc0('0x83')]='ABANDONED';_0xd1bbba[_0x3fc0('0x84')]=null;logger[_0x3fc0('0x7b')](_0x3fc0('0x85'),_0xd1bbba[_0x3fc0('0x4d')],_0xd1bbba[_0x3fc0('0x5a')]);this[_0x3fc0('0x36')][_0xe9630e['uniqueid']]=_0xd1bbba;this[_0x3fc0('0x46')](_0xd1bbba,_0x3fc0('0x1a'));}}}catch(_0x4cce9e){logger[_0x3fc0('0x3f')](_0x3fc0('0x86'),_0xe9630e['uniqueid'],util[_0x3fc0('0x41')](_0x4cce9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3fc0('0xb')][_0x3fc0('0x1c')]=function(_0x9a6d45){try{if(this[_0x3fc0('0x63')](_0x9a6d45)){logger[_0x3fc0('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x9a6d45['uniqueid'],util['inspect'](_0x9a6d45,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x9a6d45[_0x3fc0('0x76')]]){var _0x2d7d37=_[_0x3fc0('0x87')](this[_0x3fc0('0xe')][_0x9a6d45[_0x3fc0('0x76')]]);_0x2d7d37['queuecallerleaveAt']=moment()[_0x3fc0('0x4b')](_0x3fc0('0x78'));_0x2d7d37[_0x3fc0('0x88')]=_0x9a6d45[_0x3fc0('0x88')];_0x2d7d37[_0x3fc0('0x89')]=_0x9a6d45[_0x3fc0('0x89')];logger[_0x3fc0('0x7b')](_0x3fc0('0x8a'),_0x2d7d37[_0x3fc0('0x4d')],_0x2d7d37[_0x3fc0('0x5a')],_0x9a6d45['connectedlinenum'],_0x9a6d45[_0x3fc0('0x89')]);this[_0x3fc0('0x36')][_0x9a6d45[_0x3fc0('0x76')]]=_0x2d7d37;this[_0x3fc0('0x7d')](_0x2d7d37,_0x3fc0('0x1b'));}}}catch(_0x38bdf7){logger[_0x3fc0('0x3f')](_0x3fc0('0x8b'),_0x9a6d45[_0x3fc0('0x76')],util[_0x3fc0('0x41')](_0x38bdf7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3fc0('0xb')]['syncAgentConnect']=function(_0x3e3fae){try{if(this['isNotNull'](_0x3e3fae)){logger[_0x3fc0('0x48')](_0x3fc0('0x8c'),_0x3e3fae[_0x3fc0('0x76')],util['inspect'](_0x3e3fae,{'showHidden':![],'depth':null}));if(this[_0x3fc0('0xe')][_0x3e3fae[_0x3fc0('0x76')]]){var _0x40955c=_['last'](this['queueReports'][_0x3e3fae[_0x3fc0('0x76')]]);_0x40955c[_0x3fc0('0x7f')]=!![];_0x40955c['queuecallerexitreason']=_0x3fc0('0x8d');logger[_0x3fc0('0x7b')](_0x3fc0('0x8e'),_0x40955c['name'],_0x40955c[_0x3fc0('0x5a')]);}}}catch(_0x35310c){logger['error'](_0x3fc0('0x8c'),_0x3e3fae['uniqueid'],util[_0x3fc0('0x41')](_0x35310c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3fc0('0xb')][_0x3fc0('0x8f')]=function(_0x106986){try{if(this[_0x3fc0('0x63')](_0x106986)){logger[_0x3fc0('0x48')](_0x3fc0('0x90'),_0x106986[_0x3fc0('0x76')],util['inspect'](_0x106986,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x106986[_0x3fc0('0x76')]]){var _0x8118c4=_['last'](this[_0x3fc0('0xe')][_0x106986[_0x3fc0('0x76')]]);_0x8118c4['queuecallerabandon']=![];_0x8118c4['queuecallerabandonAt']=null;_0x8118c4[_0x3fc0('0x91')]=!![];_0x8118c4[_0x3fc0('0x84')]=_0x106986['membername'];_0x8118c4['holdtime']=_0x106986[_0x3fc0('0x81')];_0x8118c4[_0x3fc0('0x7f')]=!![];_0x8118c4[_0x3fc0('0x92')]=![];_0x8118c4[_0x3fc0('0x93')]=null;if(!_0x8118c4[_0x3fc0('0x94')]){if(_0x106986[_0x3fc0('0x95')]==_0x3fc0('0x94')){_0x8118c4[_0x3fc0('0x83')]=_0x3fc0('0x96');logger[_0x3fc0('0x7b')](_0x3fc0('0x97'),_0x8118c4['name'],_0x8118c4[_0x3fc0('0x5a')]);}else{if(_[_0x3fc0('0x98')](_0x106986[_0x3fc0('0x3b')][_0x3fc0('0x99')](),'local/')){if(this[_0x3fc0('0xe')][_0x106986[_0x3fc0('0x9a')]]){var _0x13244b=_[_0x3fc0('0x87')](this[_0x3fc0('0xe')][_0x106986[_0x3fc0('0x9a')]]);_0x13244b[_0x3fc0('0x7f')]=![];_0x13244b['queuecallerexit']=!![];_0x13244b[_0x3fc0('0x93')]=moment(_0x8118c4[_0x3fc0('0x77')])[_0x3fc0('0x9b')](_0x106986['holdtime'],_0x3fc0('0x9c'))[_0x3fc0('0x4b')](_0x3fc0('0x78'));_0x13244b[_0x3fc0('0x83')]='FORWARDTRANSFER';_0x13244b[_0x3fc0('0x94')]=!![];_0x13244b[_0x3fc0('0x9d')]=_0x3fc0('0x9e');_0x13244b['transferexten']=_0x106986['destexten'];_0x13244b[_0x3fc0('0x9f')]=_0x106986[_0x3fc0('0x76')];logger[_0x3fc0('0x7b')](_0x3fc0('0xa0'),_0x13244b[_0x3fc0('0x4d')],_0x13244b[_0x3fc0('0x5a')]);var _0x184f31=this[_0x3fc0('0xe')][_0x106986['linkedid']];this[_0x3fc0('0xe')][_0x106986[_0x3fc0('0x9a')]]=this[_0x3fc0('0xe')][_0x106986[_0x3fc0('0x76')]];this['queueReports'][_0x106986[_0x3fc0('0x76')]]=_0x184f31;}}else{_0x8118c4[_0x3fc0('0x83')]=_0x3fc0('0xa1')+_0x106986[_0x3fc0('0x95')][_0x3fc0('0xa2')]();logger[_0x3fc0('0x7b')](_0x3fc0('0xa3'),_0x8118c4['name'],_0x8118c4[_0x3fc0('0x5a')],_0x8118c4[_0x3fc0('0x83')]);}}}this['channels'][_0x106986[_0x3fc0('0x76')]]=_0x8118c4;this[_0x3fc0('0x46')](_0x8118c4,_0x3fc0('0x1d'));}}}catch(_0x29ac18){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x106986[_0x3fc0('0x76')],util[_0x3fc0('0x41')](_0x29ac18,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3fc0('0xb')]['syncVarSet']=function(_0x3a3b7e){try{if(this['isNotNull'](_0x3a3b7e)){logger['debug']('[%s][voiceQueueReport][varset]',_0x3a3b7e['uniqueid'],util[_0x3fc0('0x41')](_0x3a3b7e,{'showHidden':![],'depth':null}));this[_0x3fc0('0xa4')](_0x3a3b7e[_0x3fc0('0x76')],_[_0x3fc0('0xa5')](_0x3a3b7e[_0x3fc0('0xa6')])[0x0],_0x3a3b7e[_0x3fc0('0xa7')]);if(this[_0x3fc0('0xe')][_0x3a3b7e[_0x3fc0('0x76')]]){var _0x16f48a=_[_0x3fc0('0x87')](this[_0x3fc0('0xe')][_0x3a3b7e['uniqueid']]);if(_0x16f48a){if(this['isNotNull'](_0x3a3b7e['variable'])&&this[_0x3fc0('0x63')](_0x3a3b7e['variable'][_0x3fc0('0xa8')])){switch(_0x3a3b7e[_0x3fc0('0xa7')]){case'CONTINUE':_0x16f48a[_0x3fc0('0x92')]=![];_0x16f48a['queuecallerexitAt']=null;break;case _0x3fc0('0xa9'):_0x16f48a['lastevent']='timeout';_0x16f48a['queuecallerexit']=!![];_0x16f48a['queuecallerexitAt']=moment()[_0x3fc0('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x16f48a[_0x3fc0('0xaa')]=moment()[_0x3fc0('0x4b')](_0x3fc0('0x78'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3a3b7e[_0x3fc0('0x76')],util[_0x3fc0('0x41')](_0x16f48a,{'showHidden':![],'depth':null}));ami[_0x3fc0('0x47')]('custom:timeout',_0x16f48a);break;default:_0x16f48a[_0x3fc0('0x92')]=!![];_0x16f48a['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x16f48a[_0x3fc0('0xaa')]=moment()[_0x3fc0('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x16f48a[_0x3fc0('0x1a')]=![];_0x16f48a[_0x3fc0('0x82')]=null;_0x16f48a[_0x3fc0('0x83')]=_0x3a3b7e['value'];this['channels'][_0x3a3b7e[_0x3fc0('0x76')]]=_0x16f48a;this[_0x3fc0('0x46')](_0x16f48a,_0x3fc0('0x1f'));}else if(this[_0x3fc0('0x63')](_0x3a3b7e['variable'])&&this[_0x3fc0('0x63')](_0x3a3b7e[_0x3fc0('0xa6')][_0x3fc0('0xab')])){if(!_0x16f48a[_0x3fc0('0x1a')]){_0x16f48a[_0x3fc0('0x92')]=!![];_0x16f48a['queuecallerexitAt']=moment()[_0x3fc0('0x4b')](_0x3fc0('0x78'));_0x16f48a[_0x3fc0('0x83')]=_0x3fc0('0xac');_0x16f48a['queuecallerleaveAt']=moment()[_0x3fc0('0x4b')](_0x3fc0('0x78'));this['channels'][_0x3a3b7e['uniqueid']]=_0x16f48a;}}logger[_0x3fc0('0x7b')](_0x3fc0('0xad'),_0x3a3b7e['uniqueid'],_0x16f48a[_0x3fc0('0x4d')],_0x16f48a[_0x3fc0('0x5a')],_[_0x3fc0('0xa5')](_0x3a3b7e[_0x3fc0('0xa6')])[0x0],_0x3a3b7e[_0x3fc0('0xa7')]);_0x16f48a[_0x3fc0('0x13')]=this[_0x3fc0('0x13')][_0x3a3b7e['uniqueid']];}}}}catch(_0x4aa967){logger[_0x3fc0('0x3f')]('[%s][voiceQueueReport][varset]',_0x3a3b7e[_0x3fc0('0x76')],util[_0x3fc0('0x41')](_0x4aa967,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3fc0('0xa4')]=function(_0x225f59,_0x130efd,_0x2a47e0){var _0x6a3d0e=[_0x3fc0('0xae'),_0x3fc0('0xaf'),_0x3fc0('0xb0'),_0x3fc0('0xb1'),_0x3fc0('0xb2'),_0x3fc0('0xb3'),_0x3fc0('0xb4'),_0x3fc0('0xb5'),_0x3fc0('0xb6'),'sipuri',_0x3fc0('0xb7'),_0x3fc0('0xb8'),'membercalls',_0x3fc0('0xb9'),_0x3fc0('0xba'),_0x3fc0('0xbb'),_0x3fc0('0xbc'),_0x3fc0('0xbd'),_0x3fc0('0xbe')];if(!_[_0x3fc0('0x39')](_0x130efd)&&!_['includes'](_0x6a3d0e,_0x130efd)){if(_[_0x3fc0('0xbf')](this[_0x3fc0('0x13')][_0x225f59])){this[_0x3fc0('0x13')][_0x225f59]={};}this[_0x3fc0('0x13')][_0x225f59][_0x130efd]=_0x2a47e0;}};VoiceQueueReport['prototype'][_0x3fc0('0x22')]=function(_0x2dd71e){try{if(this[_0x3fc0('0x63')](_0x2dd71e)){logger[_0x3fc0('0x48')]('[%s][voiceQueueReport][hangup]',_0x2dd71e[_0x3fc0('0x76')],util[_0x3fc0('0x41')](_0x2dd71e,{'showHidden':![],'depth':null}));if(this[_0x3fc0('0xe')][_0x2dd71e[_0x3fc0('0x76')]]){for(var _0x47c9f8=0x0,_0xafc6d5={};_0x47c9f8=0x0?moment(_0x5522e2[_0xcb3a('0x16')])[_0xcb3a('0xe')](_0x5522e2[_0xcb3a('0x17')],_0xcb3a('0x18')):null,'data1':_0xcb3a('0x19'),'data2':_0x5522e2[_0xcb3a('0x12')],'data3':_0x5522e2['exten'],'data4':_0x5522e2['dialstring']||null,'role':_0xcb3a('0x11'),'internal':_0x5522e2['accountcode']?_[_0xcb3a('0x1a')](_0x5522e2['accountcode']):undefined,'uniqueid':_0x5522e2['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xc7a0=['uniqueid','voiceDialReport','membername','endtime','starttime','outbound','exten','dialstring','CreateMemberReport','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber'];(function(_0x2b922b,_0x46b8e2){var _0xaadcf5=function(_0x103e8e){while(--_0x103e8e){_0x2b922b['push'](_0x2b922b['shift']());}};_0xaadcf5(++_0x46b8e2);}(_0xc7a0,0x13f));var _0x0c7a=function(_0x1a963d,_0x44f500){_0x1a963d=_0x1a963d-0x0;var _0x36d6c1=_0xc7a0[_0x1a963d];return _0x36d6c1;};'use strict';var moment=require('moment');var _=require(_0x0c7a('0x0'));var util=require(_0x0c7a('0x1'));var client=require('../client');exports[_0x0c7a('0x2')]=function(_0x5671be){var _0x39036c=_0x5671be[_0x0c7a('0x3')]||_0x5671be[_0x0c7a('0x4')];return client[_0x0c7a('0x5')]('CreateMemberReport',{'body':{'channel':_0x0c7a('0x6'),'membername':_0x5671be['lastAssignedTo'],'interface':_[_0x0c7a('0x7')](_0x5671be[_0x0c7a('0x8')])?util[_0x0c7a('0x9')](_0x0c7a('0xa'),_0x5671be[_0x0c7a('0xb')]):_0x5671be[_0x0c7a('0x8')],'type':_0x0c7a('0xc'),'enterAt':_0x5671be[_0x0c7a('0xd')],'exitAt':_0x39036c,'duration':moment(_0x39036c)[_0x0c7a('0xe')](_0x5671be['queuecallerleaveAt'],_0x0c7a('0xf')),'data1':_0x0c7a('0x10'),'data2':_0x5671be[_0x0c7a('0x11')],'data3':_0x5671be['exten'],'data4':null,'data5':_0x5671be[_0x0c7a('0x12')],'role':_0x0c7a('0x13'),'internal':_0x5671be[_0x0c7a('0x14')]?_[_0x0c7a('0x15')](_0x5671be['accountcode']):undefined,'uniqueid':_0x5671be[_0x0c7a('0x16')]},'log':'CreateMemberReport'});};exports[_0x0c7a('0x17')]=function(_0x4379be){return client['Request']('CreateMemberReport',{'body':{'channel':_0x0c7a('0x6'),'membername':_0x4379be[_0x0c7a('0x18')],'interface':_0x4379be[_0x0c7a('0x8')],'type':_0x0c7a('0xc'),'enterAt':_0x4379be['starttime'],'exitAt':_0x4379be[_0x0c7a('0x19')],'duration':moment(_0x4379be['endtime'])[_0x0c7a('0xe')](_0x4379be[_0x0c7a('0x1a')],_0x0c7a('0xf'))>=0x0?moment(_0x4379be[_0x0c7a('0x19')])[_0x0c7a('0xe')](_0x4379be[_0x0c7a('0x1a')],_0x0c7a('0xf')):null,'data1':_0x0c7a('0x1b'),'data2':_0x4379be[_0x0c7a('0x14')],'data3':_0x4379be[_0x0c7a('0x1c')],'data4':_0x4379be[_0x0c7a('0x1d')]||null,'role':_0x0c7a('0x13'),'internal':_0x4379be['accountcode']?_[_0x0c7a('0x15')](_0x4379be[_0x0c7a('0x14')]):undefined,'uniqueid':_0x4379be['uniqueid']},'log':_0x0c7a('0x1e')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 528499b..6631daa 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe205=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x405baa,_0x1fcaff){var _0x5c1cae=function(_0x386e59){while(--_0x386e59){_0x405baa['push'](_0x405baa['shift']());}};_0x5c1cae(++_0x1fcaff);}(_0xe205,0xa7));var _0x5e20=function(_0x10d236,_0x549f96){_0x10d236=_0x10d236-0x0;var _0xfaf110=_0xe205[_0x10d236];return _0xfaf110;};'use strict';var client=require(_0x5e20('0x0'));exports[_0x5e20('0x1')]=function(){return client[_0x5e20('0x2')](_0x5e20('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5e20('0x4')]},'log':_0x5e20('0x5')});}; \ No newline at end of file +var _0x2547=['GetSettings','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2547,0x1cd));var _0x7254=function(_0x491093,_0x398b2a){_0x491093=_0x491093-0x0;var _0x2295e9=_0x2547[_0x491093];return _0x2295e9;};'use strict';var client=require('../client');exports[_0x7254('0x0')]=function(){return client[_0x7254('0x1')](_0x7254('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7254('0x3')]},'log':_0x7254('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ae0a36d..35a6911 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6599=['getTemplates','Request','GetTemplate','html'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x6599,0xb0));var _0x9659=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x6599[_0x4492af];return _0x216729;};'use strict';var client=require('../client');exports[_0x9659('0x0')]=function(_0x2aa407){return function(_0x6e313e){return client[_0x9659('0x1')](_0x9659('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x9659('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x04b8=['html','getTemplates','Request','name'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x04b8,0x159));var _0x804b=function(_0x2bb04c,_0x212323){_0x2bb04c=_0x2bb04c-0x0;var _0x2c38c=_0x04b8[_0x2bb04c];return _0x2c38c;};'use strict';var client=require('../client');exports[_0x804b('0x0')]=function(_0x49c1b2){return function(_0x241a4f){return client[_0x804b('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x804b('0x2'),_0x804b('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b9b283b..ea32603 100644 --- a/server/services/ami/rpc/trigger.js +++ b/server/services/ami/rpc/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x622e=['AllConditions','field','operator','value','Actions','action','data1','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition'];(function(_0x3d01c4,_0x14ba7c){var _0x21bfeb=function(_0x6ede0e){while(--_0x6ede0e){_0x3d01c4['push'](_0x3d01c4['shift']());}};_0x21bfeb(++_0x14ba7c);}(_0x622e,0x65));var _0xe622=function(_0x1c6dcf,_0x2018b2){_0x1c6dcf=_0x1c6dcf-0x0;var _0x4990ae=_0x622e[_0x1c6dcf];return _0x4990ae;};'use strict';var client=require(_0xe622('0x0'));exports[_0xe622('0x1')]=function(_0x51499e){return function(_0x447a7d){return client[_0xe622('0x2')](_0xe622('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe622('0x4'),_0xe622('0x5')],'include':[{'model':_0xe622('0x6'),'as':_0xe622('0x7'),'attributes':['id',_0xe622('0x8'),_0xe622('0x9'),'value']},{'model':_0xe622('0x6'),'as':'AnyConditions','attributes':['id',_0xe622('0x8'),_0xe622('0x9'),_0xe622('0xa')]},{'model':'Action','as':_0xe622('0xb'),'attributes':['id',_0xe622('0xc'),_0xe622('0xd'),'data2',_0xe622('0xe'),_0xe622('0xf'),_0xe622('0x10'),'data6',_0xe622('0x11')]}]},'log':_0xe622('0x3')});};}; \ No newline at end of file +var _0x1d31=['field','operator','value','Condition','AnyConditions','Action','Actions','data2','data6','data7','GetTrigger','Request','name','channel','status'];(function(_0x4c2f17,_0x5c6821){var _0x20919e=function(_0x31eef7){while(--_0x31eef7){_0x4c2f17['push'](_0x4c2f17['shift']());}};_0x20919e(++_0x5c6821);}(_0x1d31,0x137));var _0x11d3=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x1d31[_0x4063a4];return _0x17908d;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x109f08){return function(_0x5a2d74){return client[_0x11d3('0x0')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x11d3('0x1'),_0x11d3('0x2'),_0x11d3('0x3')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x11d3('0x4'),_0x11d3('0x5'),_0x11d3('0x6')]},{'model':_0x11d3('0x7'),'as':_0x11d3('0x8'),'attributes':['id',_0x11d3('0x4'),_0x11d3('0x5'),_0x11d3('0x6')]},{'model':_0x11d3('0x9'),'as':_0x11d3('0xa'),'attributes':['id','action','data1',_0x11d3('0xb'),'data3','data4','data5',_0x11d3('0xc'),_0x11d3('0xd')]}]},'log':_0x11d3('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index cf2bb6c..a6165d7 100644 --- a/server/services/ami/rpc/trunk.js +++ b/server/services/ami/rpc/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc539=['Request','name','registry','defaultuser'];(function(_0x20e555,_0x40aea6){var _0x182077=function(_0x1d0d69){while(--_0x1d0d69){_0x20e555['push'](_0x20e555['shift']());}};_0x182077(++_0x40aea6);}(_0xc539,0x164));var _0x9c53=function(_0x3fbb57,_0x20e015){_0x3fbb57=_0x3fbb57-0x0;var _0x29da3d=_0xc539[_0x3fbb57];return _0x29da3d;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x5148fe){return function(_0x24cff1){return client[_0x9c53('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9c53('0x1'),_0x9c53('0x2'),_0x9c53('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xf916=['name','registry','defaultuser','GetTrunk'];(function(_0x16a6ab,_0x19b0b7){var _0x45fdca=function(_0x3520cf){while(--_0x3520cf){_0x16a6ab['push'](_0x16a6ab['shift']());}};_0x45fdca(++_0x19b0b7);}(_0xf916,0x16c));var _0x6f91=function(_0x48918f,_0xc04b98){_0x48918f=_0x48918f-0x0;var _0x4a62dd=_0xf916[_0x48918f];return _0x4a62dd;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x5e1b32){return function(_0x10f653){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6f91('0x0'),_0x6f91('0x1'),_0x6f91('0x2')]},'log':_0x6f91('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c47f36e..8fa157a 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e3d=['telephone','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','email','lastLoginAt','../client','Request','agent','name','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','interface','GetUser'];(function(_0x5f5ae0,_0x59e44a){var _0x2bb754=function(_0x12a90b){while(--_0x12a90b){_0x5f5ae0['push'](_0x5f5ae0['shift']());}};_0x2bb754(++_0x59e44a);}(_0x9e3d,0x112));var _0xd9e3=function(_0x5e3fd8,_0x25faf4){_0x5e3fd8=_0x5e3fd8-0x0;var _0x3ba5c8=_0x9e3d[_0x5e3fd8];return _0x3ba5c8;};'use strict';var client=require(_0xd9e3('0x0'));exports['getAgents']=function(){return function(){return client[_0xd9e3('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0xd9e3('0x2')},'attributes':['id',_0xd9e3('0x3'),'email',_0xd9e3('0x4'),_0xd9e3('0x5'),_0xd9e3('0x6'),'lastLoginAt',_0xd9e3('0x7'),_0xd9e3('0x8'),_0xd9e3('0x9'),_0xd9e3('0xa'),_0xd9e3('0xb'),_0xd9e3('0xc')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xd9e3('0xd'),{'options':{'raw':!![],'where':{'role':_0xd9e3('0xe')},'attributes':['id',_0xd9e3('0x3'),'accountcode','internal']},'log':_0xd9e3('0xf')});};};exports[_0xd9e3('0x10')]=function(_0x3fca2a,_0x27a52a,_0x256a19){return client[_0xd9e3('0x1')](_0xd9e3('0x11'),{'body':{'type':_0x27a52a,'uniqueid':_0x256a19},'options':{'where':{'id':_0x3fca2a['id']}},'log':_0xd9e3('0x10')});};exports[_0xd9e3('0x12')]=function(_0x13a90d){return client[_0xd9e3('0x1')](_0xd9e3('0x13'),{'body':{},'options':{'where':{'id':_0x13a90d['id']}},'log':'savePause'});};exports[_0xd9e3('0x14')]=function(_0x560889){return client['Request'](_0xd9e3('0x15'),{'options':{'raw':![],'where':{'role':_0xd9e3('0x2'),'id':_0x560889},'attributes':['id',_0xd9e3('0x3'),_0xd9e3('0x16'),_0xd9e3('0x4'),_0xd9e3('0x5'),'online',_0xd9e3('0x17'),_0xd9e3('0x7'),_0xd9e3('0x8'),'voicePause','interface']},'log':_0xd9e3('0x14')});}; \ No newline at end of file +var _0x9639=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','agent','email','../client','Request','GetUser','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones','telephone'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9639,0x1c0));var _0x9963=function(_0x3c8bf4,_0x1cd8c9){_0x3c8bf4=_0x3c8bf4-0x0;var _0x1767c0=_0x9639[_0x3c8bf4];return _0x1767c0;};'use strict';var client=require(_0x9963('0x0'));exports['getAgents']=function(){return function(){return client[_0x9963('0x1')](_0x9963('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name','email',_0x9963('0x3'),_0x9963('0x4'),_0x9963('0x5'),_0x9963('0x6'),_0x9963('0x7'),_0x9963('0x8'),_0x9963('0x9'),_0x9963('0xa'),_0x9963('0xb'),'interface']},'log':'getAgents'});};};exports[_0x9963('0xc')]=function(){return function(){return client[_0x9963('0x1')](_0x9963('0x2'),{'options':{'raw':!![],'where':{'role':_0x9963('0xd')},'attributes':['id','name',_0x9963('0x3'),_0x9963('0xe')]},'log':'getTelephones'});};};exports[_0x9963('0xf')]=function(_0x494b84,_0x23bce2,_0x1db156){return client[_0x9963('0x1')](_0x9963('0x10'),{'body':{'type':_0x23bce2,'uniqueid':_0x1db156},'options':{'where':{'id':_0x494b84['id']}},'log':_0x9963('0xf')});};exports[_0x9963('0x11')]=function(_0x30b8ac){return client[_0x9963('0x1')](_0x9963('0x12'),{'body':{},'options':{'where':{'id':_0x30b8ac['id']}},'log':'savePause'});};exports[_0x9963('0x13')]=function(_0x384acf){return client[_0x9963('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x9963('0x14'),'id':_0x384acf},'attributes':['id','name',_0x9963('0x15'),'accountcode',_0x9963('0x4'),'online',_0x9963('0x6'),_0x9963('0x7'),'lastPauseAt',_0x9963('0x9'),'interface']},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f58e8e5..63ab82d 100644 --- a/server/services/ami/rpc/voiceAgentReport.js +++ b/server/services/ami/rpc/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a92=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x5b46df,_0x21ce32){var _0x157311=function(_0x599206){while(--_0x599206){_0x5b46df['push'](_0x5b46df['shift']());}};_0x157311(++_0x21ce32);}(_0x7a92,0x1bc));var _0x27a9=function(_0x1d779f,_0x340938){_0x1d779f=_0x1d779f-0x0;var _0x2936da=_0x7a92[_0x1d779f];return _0x2936da;};'use strict';var client=require(_0x27a9('0x0'));exports[_0x27a9('0x1')]=function(_0x479ea6){return client[_0x27a9('0x2')](_0x27a9('0x3'),{'body':_0x479ea6,'log':_0x27a9('0x3')});};exports[_0x27a9('0x4')]=function(_0x386ee5,_0x338804,_0x3e694f){return client[_0x27a9('0x2')](_0x27a9('0x5'),{'body':_0x386ee5,'options':{'where':{'uniqueid':_0x338804,'interface':_0x3e694f,'agentcomplete':!![]}},'log':_0x27a9('0x5')});}; \ No newline at end of file +var _0x851e=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x851e,0x1e8));var _0xe851=function(_0xfe3aed,_0x1558b2){_0xfe3aed=_0xfe3aed-0x0;var _0x8cbbc2=_0x851e[_0xfe3aed];return _0x8cbbc2;};'use strict';var client=require(_0xe851('0x0'));exports[_0xe851('0x1')]=function(_0x2bc74b){return client['Request']('CreateVoiceAgentReport',{'body':_0x2bc74b,'log':_0xe851('0x2')});};exports[_0xe851('0x3')]=function(_0x16b38a,_0x326b34,_0xe50306){return client['Request'](_0xe851('0x4'),{'body':_0x16b38a,'options':{'where':{'uniqueid':_0x326b34,'interface':_0xe50306,'agentcomplete':!![]}},'log':_0xe851('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index afba77c..8e6f387 100644 --- a/server/services/ami/rpc/voiceCallReport.js +++ b/server/services/ami/rpc/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3702=['../client','create','Request','merge','context','callerid','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash'];(function(_0x4670e,_0x19e50c){var _0xab329a=function(_0x4fc5ba){while(--_0x4fc5ba){_0x4670e['push'](_0x4670e['shift']());}};_0xab329a(++_0x19e50c);}(_0x3702,0x165));var _0x2370=function(_0x571727,_0x491caa){_0x571727=_0x571727-0x0;var _0x50e401=_0x3702[_0x571727];return _0x50e401;};'use strict';var moment=require(_0x2370('0x0'));var util=require(_0x2370('0x1'));var _=require(_0x2370('0x2'));var client=require(_0x2370('0x3'));exports[_0x2370('0x4')]=function(_0x489ac2){return client[_0x2370('0x5')]('CreateVoiceCallReport',{'body':_[_0x2370('0x6')](_0x489ac2,{'source':_0x489ac2['calleridnum'],'destinationcontext':_0x489ac2[_0x2370('0x7')],'callerid':_0x489ac2[_0x2370('0x8')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x2370('0x9'),{'options':{'where':{'type':[_0x2370('0xa')],'createdAt':{'$between':[moment()[_0x2370('0xb')](_0x2370('0xc'))[_0x2370('0xd')](_0x2370('0xe')),moment()['endOf']('day')[_0x2370('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x2370('0xf'),_0x2370('0x10'),_0x2370('0x11'),_0x2370('0x12')]},'log':_0x2370('0x13')});};}; \ No newline at end of file +var _0x1481=['type','duration','billableseconds','moment','lodash','../client','Request','merge','context','callerid','DOCUMENTATION','CreateVoiceCallReport','GetVoiceCallReport','outbound','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1481,0x16b));var _0x1148=function(_0x588002,_0x52717f){_0x588002=_0x588002-0x0;var _0x544906=_0x1481[_0x588002];return _0x544906;};'use strict';var moment=require(_0x1148('0x0'));var util=require('util');var _=require(_0x1148('0x1'));var client=require(_0x1148('0x2'));exports['create']=function(_0x5f5cea){return client[_0x1148('0x3')]('CreateVoiceCallReport',{'body':_[_0x1148('0x4')](_0x5f5cea,{'source':_0x5f5cea['calleridnum'],'destinationcontext':_0x5f5cea[_0x1148('0x5')],'callerid':_0x5f5cea[_0x1148('0x6')],'amaflags':_0x1148('0x7')}),'log':_0x1148('0x8')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x1148('0x9'),{'options':{'where':{'type':[_0x1148('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x1148('0xb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1148('0xc')](_0x1148('0xb'))[_0x1148('0xd')](_0x1148('0xe'))]}},'attributes':[_0x1148('0xf'),'disposition',_0x1148('0x10'),_0x1148('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 67bc7f7..4fc37ad 100644 --- a/server/services/ami/rpc/voiceDialReport.js +++ b/server/services/ami/rpc/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7cad=['create','CreateVoiceDialReport','../client'];(function(_0x171586,_0x36730f){var _0x1e6319=function(_0x36ca93){while(--_0x36ca93){_0x171586['push'](_0x171586['shift']());}};_0x1e6319(++_0x36730f);}(_0x7cad,0x83));var _0xd7ca=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7cad[_0x1969a7];return _0x3d665f;};'use strict';var client=require(_0xd7ca('0x0'));exports[_0xd7ca('0x1')]=function(_0x474bb4){return client['Request'](_0xd7ca('0x2'),{'body':_0x474bb4,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xb7ba=['CreateVoiceDialReport','../client','create','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7ba,0x1a5));var _0xab7b=function(_0x2a76fa,_0x1cee7d){_0x2a76fa=_0x2a76fa-0x0;var _0x2d2442=_0xb7ba[_0x2a76fa];return _0x2d2442;};'use strict';var client=require(_0xab7b('0x0'));exports[_0xab7b('0x1')]=function(_0x46f7d2){return client[_0xab7b('0x2')]('CreateVoiceDialReport',{'body':_0x46f7d2,'log':_0xab7b('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index b0708c6..3ab85ae 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f6a=['getVoiceExtensions','../client','GetVoiceExtension','exten','recordingFormat'];(function(_0x4341e0,_0x143636){var _0x4f8e71=function(_0x7a124c){while(--_0x7a124c){_0x4341e0['push'](_0x4341e0['shift']());}};_0x4f8e71(++_0x143636);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x56238a,_0x420c40){_0x56238a=_0x56238a-0x0;var _0xf68503=_0x5f6a[_0x56238a];return _0xf68503;};'use strict';var client=require(_0xa5f6('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xa5f6('0x1'),{'options':{'raw':!![],'attributes':['id',_0xa5f6('0x2'),_0xa5f6('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xa5f6('0x4')});};}; \ No newline at end of file +var _0x40ac=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client','Request'];(function(_0x5e1f45,_0x45795d){var _0xa9d684=function(_0x3bd8e9){while(--_0x3bd8e9){_0x5e1f45['push'](_0x5e1f45['shift']());}};_0xa9d684(++_0x45795d);}(_0x40ac,0x1de));var _0xc40a=function(_0x5d04d1,_0x31d44f){_0x5d04d1=_0x5d04d1-0x0;var _0x4b8e13=_0x40ac[_0x5d04d1];return _0x4b8e13;};'use strict';var client=require(_0xc40a('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xc40a('0x1')](_0xc40a('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc40a('0x3'),_0xc40a('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc40a('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index af6a2ff..6e667e2 100644 --- a/server/services/ami/rpc/voiceQueue.js +++ b/server/services/ami/rpc/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc69=['dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x1ffdad,_0x255ded){var _0x46e785=function(_0x555af4){while(--_0x555af4){_0x1ffdad['push'](_0x1ffdad['shift']());}};_0x46e785(++_0x255ded);}(_0xcc69,0x111));var _0x9cc6=function(_0x2a4291,_0x53bdd8){_0x2a4291=_0x2a4291-0x0;var _0xf91cbe=_0xcc69[_0x2a4291];return _0xf91cbe;};'use strict';var client=require(_0x9cc6('0x0'));exports[_0x9cc6('0x1')]=function(){return function(){return client[_0x9cc6('0x2')](_0x9cc6('0x3'),{'options':{'raw':![],'attributes':['id',_0x9cc6('0x4'),_0x9cc6('0x5'),_0x9cc6('0x6'),_0x9cc6('0x7'),_0x9cc6('0x8'),_0x9cc6('0x9'),_0x9cc6('0xa'),_0x9cc6('0xb'),_0x9cc6('0xc'),_0x9cc6('0xd'),_0x9cc6('0xe'),_0x9cc6('0xf'),_0x9cc6('0x10'),_0x9cc6('0x11'),'dialOriginateCallerIdName',_0x9cc6('0x12'),_0x9cc6('0x13'),_0x9cc6('0x14'),_0x9cc6('0x15'),'dialQueueProject',_0x9cc6('0x16'),_0x9cc6('0x17'),_0x9cc6('0x18'),'dialBusyRetryFrequency',_0x9cc6('0x19'),_0x9cc6('0x1a'),_0x9cc6('0x1b'),_0x9cc6('0x1c'),'dialGlobalInterval',_0x9cc6('0x1d'),_0x9cc6('0x1e'),_0x9cc6('0x1f'),_0x9cc6('0x20'),_0x9cc6('0x21'),_0x9cc6('0x22'),_0x9cc6('0x23'),_0x9cc6('0x24'),_0x9cc6('0x25'),_0x9cc6('0x26'),'dialAMDSilenceThreshold',_0x9cc6('0x27'),_0x9cc6('0x28'),_0x9cc6('0x29'),'dialRecallInQueue','dialOrderByScheduledAt',_0x9cc6('0x2a'),_0x9cc6('0x2b'),_0x9cc6('0x2c'),_0x9cc6('0x8'),_0x9cc6('0x2d'),_0x9cc6('0x2e'),_0x9cc6('0x2f'),_0x9cc6('0x30'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x9cc6('0x31'),_0x9cc6('0x32'),_0x9cc6('0x33'),_0x9cc6('0x34'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x9cc6('0x35'),_0x9cc6('0x36'),_0x9cc6('0x37'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x9cc6('0x38'),'as':_0x9cc6('0x38'),'attributes':['id','name',_0x9cc6('0x39'),_0x9cc6('0x3a')]},{'model':_0x9cc6('0x3b'),'as':_0x9cc6('0x3c'),'attributes':['id',_0x9cc6('0x4')]},{'model':_0x9cc6('0x38'),'as':_0x9cc6('0x3d'),'attributes':['id',_0x9cc6('0x4'),'callerid','active']},{'model':_0x9cc6('0x3e'),'as':'Interval','attributes':['id',_0x9cc6('0x4')],'include':[{'model':_0x9cc6('0x3e'),'as':_0x9cc6('0x3f'),'attributes':['id',_0x9cc6('0x4'),_0x9cc6('0x40')]}]}]},'log':_0x9cc6('0x1')});};}; \ No newline at end of file +var _0x1d9f=['dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy'];(function(_0x2ed395,_0x24323b){var _0x14a5eb=function(_0x12a09b){while(--_0x12a09b){_0x2ed395['push'](_0x2ed395['shift']());}};_0x14a5eb(++_0x24323b);}(_0x1d9f,0x18f));var _0xf1d9=function(_0x48396f,_0x2303c2){_0x48396f=_0x48396f-0x0;var _0x37cb9e=_0x1d9f[_0x48396f];return _0x37cb9e;};'use strict';var client=require(_0xf1d9('0x0'));exports[_0xf1d9('0x1')]=function(){return function(){return client[_0xf1d9('0x2')](_0xf1d9('0x3'),{'options':{'raw':![],'attributes':['id',_0xf1d9('0x4'),_0xf1d9('0x5'),_0xf1d9('0x6'),_0xf1d9('0x7'),_0xf1d9('0x8'),_0xf1d9('0x9'),_0xf1d9('0xa'),'dialMethod','dialLimitChannel',_0xf1d9('0xb'),_0xf1d9('0xc'),_0xf1d9('0xd'),_0xf1d9('0xe'),'dialPredictiveInterval',_0xf1d9('0xf'),_0xf1d9('0x10'),_0xf1d9('0x11'),_0xf1d9('0x12'),'dialQueueTimeout',_0xf1d9('0x13'),'dialCongestionMaxRetry',_0xf1d9('0x14'),_0xf1d9('0x15'),_0xf1d9('0x16'),_0xf1d9('0x17'),'dialNoAnswerRetryFrequency',_0xf1d9('0x18'),_0xf1d9('0x19'),'dialGlobalInterval',_0xf1d9('0x1a'),'dialCheckDuplicateType','dialAMDActive',_0xf1d9('0x1b'),'dialAMDGreeting',_0xf1d9('0x1c'),_0xf1d9('0x1d'),_0xf1d9('0x1e'),_0xf1d9('0x1f'),_0xf1d9('0x20'),_0xf1d9('0x21'),_0xf1d9('0x22'),'timeout',_0xf1d9('0x23'),_0xf1d9('0x24'),_0xf1d9('0x25'),_0xf1d9('0x26'),_0xf1d9('0x27'),_0xf1d9('0x28'),_0xf1d9('0x8'),_0xf1d9('0x29'),_0xf1d9('0x2a'),_0xf1d9('0x2b'),_0xf1d9('0x2c'),_0xf1d9('0x2d'),_0xf1d9('0x2e'),_0xf1d9('0x2f'),_0xf1d9('0x30'),'dialAbandonedRetryFrequency',_0xf1d9('0x31'),_0xf1d9('0x32'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0xf1d9('0x33'),_0xf1d9('0x34'),_0xf1d9('0x35')],'include':[{'model':_0xf1d9('0x36'),'as':_0xf1d9('0x36'),'attributes':['id',_0xf1d9('0x4'),'callerid',_0xf1d9('0x37')]},{'model':_0xf1d9('0x38'),'as':_0xf1d9('0x39'),'attributes':['id',_0xf1d9('0x4')]},{'model':_0xf1d9('0x36'),'as':_0xf1d9('0x3a'),'attributes':['id','name',_0xf1d9('0x3b'),_0xf1d9('0x37')]},{'model':_0xf1d9('0x3c'),'as':_0xf1d9('0x3c'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xf1d9('0x3d'),'attributes':['id',_0xf1d9('0x4'),_0xf1d9('0x3e')]}]}]},'log':_0xf1d9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e73543a..4450d8b 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa94f=['GetVoiceQueueReport','startOf','format','endOf','day','uniqueid','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerabandon','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xa94f,0x14e));var _0xfa94=function(_0x27d616,_0x251ce7){_0x27d616=_0x27d616-0x0;var _0xcd15e7=_0xa94f[_0x27d616];return _0xcd15e7;};'use strict';var moment=require(_0xfa94('0x0'));var _=require(_0xfa94('0x1'));var client=require('../client');exports[_0xfa94('0x2')]=function(_0x4d056b){return client[_0xfa94('0x3')](_0xfa94('0x4'),{'body':_0x4d056b,'log':'CreateVoiceQueueReport'});};exports[_0xfa94('0x5')]=function(){return function(){return client[_0xfa94('0x3')](_0xfa94('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xfa94('0x7')]('day')[_0xfa94('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xfa94('0x9')](_0xfa94('0xa'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xfa94('0xb'),'queue','queuecallerjoinAt',_0xfa94('0xc'),_0xfa94('0xd'),'queuecallercompleteAt',_0xfa94('0xe'),'queuecallerexitAt',_0xfa94('0xf'),'queuecallerabandonAt']},'log':_0xfa94('0x10')});};}; \ No newline at end of file +var _0xf6f0=['queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x23ab3c,_0x556cd2){var _0xd43ff0=function(_0x58740b){while(--_0x58740b){_0x23ab3c['push'](_0x23ab3c['shift']());}};_0xd43ff0(++_0x556cd2);}(_0xf6f0,0xd6));var _0x0f6f=function(_0x19fec1,_0x1cc62f){_0x19fec1=_0x19fec1-0x0;var _0x29cd35=_0xf6f0[_0x19fec1];return _0x29cd35;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0x0f6f('0x0'));exports['create']=function(_0x3eb4ba){return client[_0x0f6f('0x1')]('CreateVoiceQueueReport',{'body':_0x3eb4ba,'log':_0x0f6f('0x2')});};exports[_0x0f6f('0x3')]=function(){return function(){return client[_0x0f6f('0x1')](_0x0f6f('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0f6f('0x5')](_0x0f6f('0x6'))[_0x0f6f('0x7')](_0x0f6f('0x8')),moment()[_0x0f6f('0x9')](_0x0f6f('0x6'))[_0x0f6f('0x7')](_0x0f6f('0x8'))]}},'attributes':['uniqueid',_0x0f6f('0xa'),_0x0f6f('0xb'),'queuecallerleaveAt',_0x0f6f('0xc'),_0x0f6f('0xd'),_0x0f6f('0xe'),_0x0f6f('0xf'),_0x0f6f('0x10'),_0x0f6f('0x11')]},'log':_0x0f6f('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index fa15b75..f935521 100644 --- a/server/services/ami/rpc/voiceQueueRt.js +++ b/server/services/ami/rpc/voiceQueueRt.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x219f=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x37bab4,_0x20fa8c){var _0x8a57d8=function(_0x44ddd3){while(--_0x44ddd3){_0x37bab4['push'](_0x37bab4['shift']());}};_0x8a57d8(++_0x20fa8c);}(_0x219f,0x18d));var _0xf219=function(_0x5a3c0b,_0x221fed){_0x5a3c0b=_0x5a3c0b-0x0;var _0x18e542=_0x219f[_0x5a3c0b];return _0x18e542;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x19fe43){return function(){return client['Request'](_0xf219('0x0'),{'options':{'where':{'VoiceQueueId':_0x19fe43,'paused':!![]},'raw':!![]},'log':_0xf219('0x1')});};}; \ No newline at end of file +var _0x70ff=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x70ff,0x123));var _0xf70f=function(_0xbcb6,_0x8e00a9){_0xbcb6=_0xbcb6-0x0;var _0x58899b=_0x70ff[_0xbcb6];return _0x58899b;};'use strict';var client=require('../client');exports[_0xf70f('0x0')]=function(_0x59ae2d){return function(){return client['Request'](_0xf70f('0x1'),{'options':{'where':{'VoiceQueueId':_0x59ae2d,'paused':!![]},'raw':!![]},'log':_0xf70f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3cf10ba..f1d3616 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x625e=['../client','create','Request','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x5efa07,_0x59d23f){var _0x262a7b=function(_0x22e52f){while(--_0x22e52f){_0x5efa07['push'](_0x5efa07['shift']());}};_0x262a7b(++_0x59d23f);}(_0x625e,0xf4));var _0xe625=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0x625e[_0x9b5bb2];return _0x2e1e92;};'use strict';var _=require(_0xe625('0x0'));var client=require(_0xe625('0x1'));exports[_0xe625('0x2')]=function(_0x3ed81f){return client[_0xe625('0x3')](_0xe625('0x4'),{'body':_[_0xe625('0x5')](_0x3ed81f,{'value':_0x3ed81f[_0xe625('0x6')]}),'log':_0xe625('0x4')});}; \ No newline at end of file +var _0x4e31=['CreateVoiceRecording','monitorFilename','lodash','../client','Request'];(function(_0x409da8,_0x10565f){var _0x1aced9=function(_0x3261f8){while(--_0x3261f8){_0x409da8['push'](_0x409da8['shift']());}};_0x1aced9(++_0x10565f);}(_0x4e31,0x7a));var _0x14e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4e31[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x14e3('0x0'));var client=require(_0x14e3('0x1'));exports['create']=function(_0x38d040){return client[_0x14e3('0x2')](_0x14e3('0x3'),{'body':_['merge'](_0x38d040,{'value':_0x38d040[_0x14e3('0x4')]}),'log':_0x14e3('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a71b0bf..44438b9 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3dd=['CreateVoiceTransferReport','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers'];(function(_0x1235a3,_0x2c5f21){var _0x326c4f=function(_0x44e80a){while(--_0x44e80a){_0x1235a3['push'](_0x1235a3['shift']());}};_0x326c4f(++_0x2c5f21);}(_0xd3dd,0x1ba));var _0xdd3d=function(_0x351e48,_0xbe7950){_0x351e48=_0x351e48-0x0;var _0xd3b768=_0xd3dd[_0x351e48];return _0xd3b768;};'use strict';var client=require(_0xdd3d('0x0'));exports[_0xdd3d('0x1')]={};exports['blindTransfer']=function(_0x140bb9){return client['Request'](_0xdd3d('0x2'),{'body':{'result':_0x140bb9['result'],'transfererchannel':_0x140bb9['transfererchannel'],'transferercalleridnum':_0x140bb9['transferercalleridnum'],'transferercalleridname':_0x140bb9[_0xdd3d('0x3')],'transfererconnectedlinenum':_0x140bb9[_0xdd3d('0x4')],'transfererconnectedlinename':_0x140bb9['transfererconnectedlinename'],'transfereraccountcode':_0x140bb9[_0xdd3d('0x5')],'transferercontext':_0x140bb9[_0xdd3d('0x6')],'transfererexten':_0x140bb9['transfererexten'],'transfererlinkedid':_0x140bb9[_0xdd3d('0x7')],'transfereechannel':_0x140bb9[_0xdd3d('0x8')],'transfereecalleridnum':_0x140bb9[_0xdd3d('0x9')],'transfereecalleridname':_0x140bb9['transfereecalleridname'],'transfereeconnectedlinenum':_0x140bb9[_0xdd3d('0xa')],'transfereeconnectedlinename':_0x140bb9[_0xdd3d('0xb')],'transfereeaccountcode':_0x140bb9['transfereeaccountcode'],'transfereecontext':_0x140bb9['transfereecontext'],'transfereeexten':_0x140bb9[_0xdd3d('0xc')],'transfereelinkedid':_0x140bb9[_0xdd3d('0xd')],'isexternal':_0x140bb9[_0xdd3d('0xe')],'context':_0x140bb9[_0xdd3d('0xf')],'extension':_0x140bb9[_0xdd3d('0x10')],'type':_0xdd3d('0x11')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x153965){return client[_0xdd3d('0x12')]('CreateVoiceTransferReport',{'body':{'result':_0x153965[_0xdd3d('0x13')],'transfererchannel':_0x153965[_0xdd3d('0x14')],'transferercalleridnum':_0x153965[_0xdd3d('0x15')],'transferercalleridname':_0x153965[_0xdd3d('0x16')],'transfererconnectedlinenum':_0x153965[_0xdd3d('0x17')],'transfererconnectedlinename':_0x153965[_0xdd3d('0x18')],'transfereraccountcode':_0x153965['origtransfereraccountcode'],'transferercontext':_0x153965[_0xdd3d('0x19')],'transfererexten':_0x153965[_0xdd3d('0x1a')],'transfererlinkedid':_0x153965['origtransfererlinkedid'],'transfereechannel':_0x153965[_0xdd3d('0x1b')],'transfereecalleridnum':_0x153965[_0xdd3d('0x1c')],'transfereecalleridname':_0x153965[_0xdd3d('0x1d')],'transfereeconnectedlinenum':_0x153965[_0xdd3d('0x1e')],'transfereeconnectedlinename':_0x153965[_0xdd3d('0x1f')],'transfereeaccountcode':_0x153965[_0xdd3d('0x20')],'transfereecontext':_0x153965['transfertargetcontext'],'transfereeexten':_0x153965[_0xdd3d('0x21')],'transfereelinkedid':_0x153965[_0xdd3d('0x22')],'isexternal':_0x153965[_0xdd3d('0xe')],'context':_0x153965['origtransferercontext'],'extension':_0x153965[_0xdd3d('0x23')],'type':_0xdd3d('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xc433=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc433,0x8d));var _0x3c43=function(_0x4e215b,_0x597fbc){_0x4e215b=_0x4e215b-0x0;var _0x56d77a=_0xc433[_0x4e215b];return _0x56d77a;};'use strict';var client=require(_0x3c43('0x0'));exports['transfers']={};exports[_0x3c43('0x1')]=function(_0x3d2d25){return client[_0x3c43('0x2')](_0x3c43('0x3'),{'body':{'result':_0x3d2d25[_0x3c43('0x4')],'transfererchannel':_0x3d2d25[_0x3c43('0x5')],'transferercalleridnum':_0x3d2d25[_0x3c43('0x6')],'transferercalleridname':_0x3d2d25[_0x3c43('0x7')],'transfererconnectedlinenum':_0x3d2d25[_0x3c43('0x8')],'transfererconnectedlinename':_0x3d2d25[_0x3c43('0x9')],'transfereraccountcode':_0x3d2d25['transfereraccountcode'],'transferercontext':_0x3d2d25[_0x3c43('0xa')],'transfererexten':_0x3d2d25[_0x3c43('0xb')],'transfererlinkedid':_0x3d2d25[_0x3c43('0xc')],'transfereechannel':_0x3d2d25[_0x3c43('0xd')],'transfereecalleridnum':_0x3d2d25[_0x3c43('0xe')],'transfereecalleridname':_0x3d2d25['transfereecalleridname'],'transfereeconnectedlinenum':_0x3d2d25[_0x3c43('0xf')],'transfereeconnectedlinename':_0x3d2d25[_0x3c43('0x10')],'transfereeaccountcode':_0x3d2d25[_0x3c43('0x11')],'transfereecontext':_0x3d2d25[_0x3c43('0x12')],'transfereeexten':_0x3d2d25[_0x3c43('0x13')],'transfereelinkedid':_0x3d2d25[_0x3c43('0x14')],'isexternal':_0x3d2d25[_0x3c43('0x15')],'context':_0x3d2d25['context'],'extension':_0x3d2d25[_0x3c43('0x16')],'type':_0x3c43('0x17')},'log':_0x3c43('0x3')});};exports[_0x3c43('0x18')]=function(_0x1ca663){return client[_0x3c43('0x2')](_0x3c43('0x3'),{'body':{'result':_0x1ca663[_0x3c43('0x4')],'transfererchannel':_0x1ca663[_0x3c43('0x19')],'transferercalleridnum':_0x1ca663[_0x3c43('0x1a')],'transferercalleridname':_0x1ca663[_0x3c43('0x1b')],'transfererconnectedlinenum':_0x1ca663[_0x3c43('0x1c')],'transfererconnectedlinename':_0x1ca663[_0x3c43('0x1d')],'transfereraccountcode':_0x1ca663[_0x3c43('0x1e')],'transferercontext':_0x1ca663[_0x3c43('0x1f')],'transfererexten':_0x1ca663[_0x3c43('0x20')],'transfererlinkedid':_0x1ca663[_0x3c43('0x21')],'transfereechannel':_0x1ca663[_0x3c43('0x22')],'transfereecalleridnum':_0x1ca663['transfertargetcalleridnum'],'transfereecalleridname':_0x1ca663[_0x3c43('0x23')],'transfereeconnectedlinenum':_0x1ca663[_0x3c43('0x24')],'transfereeconnectedlinename':_0x1ca663[_0x3c43('0x25')],'transfereeaccountcode':_0x1ca663['transfertargetaccountcode'],'transfereecontext':_0x1ca663[_0x3c43('0x26')],'transfereeexten':_0x1ca663[_0x3c43('0x27')],'transfereelinkedid':_0x1ca663['transfertargetlinkedid'],'isexternal':_0x1ca663['isexternal'],'context':_0x1ca663[_0x3c43('0x28')],'extension':_0x1ca663[_0x3c43('0x29')],'type':'attended'},'log':_0x3c43('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 076126c..cb022d7 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe40a=['originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','Interval','push','length','find','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','agents','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','SIP','name','timers','timer','updateAcw','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','keys','module','action','Reload','then','message','catch','error','pick','Action','voiceQueues','hasOwnProperty','strategy','answered','pTalking','sumDuration','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x547b53,_0x5ea6cb){var _0x166225=function(_0x17487a){while(--_0x17487a){_0x547b53['push'](_0x547b53['shift']());}};_0x166225(++_0x5ea6cb);}(_0xe40a,0x14e));var _0xae40=function(_0x13c1ec,_0x32783){_0x13c1ec=_0x13c1ec-0x0;var _0x3c4752=_0xe40a[_0x13c1ec];return _0x3c4752;};'use strict';var _=require(_0xae40('0x0'));var util=require('util');var jayson=require(_0xae40('0x1'));var schema=require(_0xae40('0x2'));var BPromise=require(_0xae40('0x3'));var moment=require(_0xae40('0x4'));var config=require(_0xae40('0x5'));var properties=require(_0xae40('0x6'));var ami=require(_0xae40('0x7'));exports[_0xae40('0x8')]=function(_0x4d1d7b,_0x2aa8f5,_0x4bbae9){return new BPromise(function(_0x34dbe9,_0x29ca9f){var _0x16ab1d={'QueuePause':function(_0x8b40ea){return new Promise(function(_0x1eb955,_0x2e0d0c){var _0x3f3792=util[_0xae40('0x9')]('%s/%s',_0xae40('0xa'),_0x8b40ea[_0xae40('0xb')]);if(_0x4d1d7b['timers']&&_0x4d1d7b[_0xae40('0xc')][_0x3f3792]&&_0x4d1d7b[_0xae40('0xc')][_0x3f3792][_0xae40('0xd')]){_0x4d1d7b[_0xae40('0xc')][_0x3f3792][_0xae40('0xe')]();}if(_0x4d1d7b['agents'][_0x3f3792]){_0x4d1d7b['agents'][_0x3f3792][_0xae40('0xf')]({'statePause':_0x8b40ea[_0xae40('0x10')]?!![]:![]});}_0x1eb955({'code':0xc8,'message':_0xae40('0x11')});});},'Reload':function(_0x4b0b7d){var _0x3b5ecb=this;return new Promise(function(_0x227403,_0x4f4ba7){if(ami[_0xae40('0x12')]()==![]){return _0x4f4ba7(_0x3b5ecb['error'](0x1f4,[config['asterisk']['ip'],config[_0xae40('0x13')][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}_0x4b0b7d=_['pick'](_0x4b0b7d,_[_0xae40('0x17')](properties[_0xae40('0x18')]));_0x4b0b7d[_0xae40('0x19')]=_0xae40('0x1a');return ami['Action'](_0x4b0b7d)[_0xae40('0x1b')](function(_0x3e4b88){_0x227403({'code':0xc8,'message':_0x3e4b88[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x450cba){_0x4f4ba7(_0x3b5ecb[_0xae40('0x1e')](0x1f5,_0x450cba[_0xae40('0x1c')]));});});},'Command':function(_0x4d66a7){var _0x3bf1db=this;return new Promise(function(_0xb719d6,_0xe23ce){if(ami[_0xae40('0x12')]()==![]){return _0xe23ce(_0x3bf1db[_0xae40('0x1e')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}_0x4d66a7=_[_0xae40('0x1f')](_0x4d66a7,'command');_0x4d66a7[_0xae40('0x19')]='Command';return ami[_0xae40('0x20')](_0x4d66a7)[_0xae40('0x1b')](function(_0x53ae01){_0xb719d6({'code':0xc8,'message':_0x53ae01['content']});})[_0xae40('0x1d')](function(_0x5757f5){_0xe23ce(_0x3bf1db['error'](0x1f5,_0x5757f5[_0xae40('0x1c')]));});});},'VoiceQueues':function(_0x118a2e){return new Promise(function(_0xd4f3fb,_0x54b718){var _0x28c5c3=[];for(var _0x19a14d in _0x4d1d7b[_0xae40('0x21')]){if(_0x4d1d7b[_0xae40('0x21')][_0xae40('0x22')](_0x19a14d)){var _0x1f0156=_0x4d1d7b['voiceQueues'][_0x19a14d];var _0x2a4af7={'id':_0x1f0156['id'],'name':_0x1f0156[_0xae40('0xb')],'strategy':_0x1f0156[_0xae40('0x23')],'answered':_0x1f0156[_0xae40('0x24')],'available':_0x1f0156['available'],'loggedIn':_0x1f0156['loggedIn'],'pTalking':_0x1f0156[_0xae40('0x25')],'sumBillable':_0x1f0156['sumBillable'],'sumDuration':_0x1f0156[_0xae40('0x26')],'sumHoldTime':_0x1f0156['sumHoldTime']||0x0,'talking':_0x1f0156[_0xae40('0x27')],'total':_0x1f0156[_0xae40('0x28')],'type':_0x1f0156[_0xae40('0x29')],'unmanaged':_0x1f0156[_0xae40('0x2a')],'abandoned':_0x1f0156[_0xae40('0x2b')],'waiting':_0x1f0156[_0xae40('0x2c')],'loggedInDb':_0x1f0156[_0xae40('0x2d')]};if(_0x1f0156['type']===_0xae40('0x2e')){_0x2a4af7[_0xae40('0x2f')]=_0x1f0156[_0xae40('0x2f')];_0x2a4af7[_0xae40('0x30')]=_0x1f0156[_0xae40('0x30')];_0x2a4af7[_0xae40('0x31')]=_0x1f0156['dialOriginateCallerIdName'];_0x2a4af7[_0xae40('0x32')]=_0x1f0156[_0xae40('0x32')];_0x2a4af7['dialOriginateTimeout']=_0x1f0156[_0xae40('0x33')];_0x2a4af7[_0xae40('0x34')]=_0x1f0156[_0xae40('0x34')];_0x2a4af7[_0xae40('0x35')]=_0x1f0156[_0xae40('0x35')];_0x2a4af7[_0xae40('0x36')]=_0x1f0156[_0xae40('0x36')];_0x2a4af7[_0xae40('0x37')]=_0x1f0156[_0xae40('0x37')];_0x2a4af7[_0xae40('0x38')]=_0x1f0156[_0xae40('0x38')];_0x2a4af7[_0xae40('0x39')]=_0x1f0156['outboundBusyCallsDay'];_0x2a4af7['outboundCongestionCallsDay']=_0x1f0156[_0xae40('0x3a')];_0x2a4af7[_0xae40('0x3b')]=_0x1f0156[_0xae40('0x3b')];_0x2a4af7[_0xae40('0x3c')]=_0x1f0156[_0xae40('0x3c')];_0x2a4af7['outboundDropCallsDayTimeout']=_0x1f0156[_0xae40('0x3d')];_0x2a4af7[_0xae40('0x3e')]=_0x1f0156[_0xae40('0x3e')];_0x2a4af7[_0xae40('0x3f')]=_0x1f0156['outboundNoSuchCallsDay'];_0x2a4af7[_0xae40('0x40')]=_0x1f0156[_0xae40('0x40')];_0x2a4af7[_0xae40('0x41')]=_0x1f0156['outboundReCallsDay'];_0x2a4af7[_0xae40('0x42')]=_0x1f0156[_0xae40('0x42')];_0x2a4af7[_0xae40('0x43')]=_0x1f0156[_0xae40('0x43')];_0x2a4af7['predictiveIntervalAnsweredCalls']=_0x1f0156[_0xae40('0x44')];_0x2a4af7[_0xae40('0x45')]=_0x1f0156['predictiveIntervalAvgHoldtime'];_0x2a4af7[_0xae40('0x46')]=_0x1f0156[_0xae40('0x46')];_0x2a4af7[_0xae40('0x47')]=_0x1f0156[_0xae40('0x47')];_0x2a4af7[_0xae40('0x48')]=_0x1f0156[_0xae40('0x48')];_0x2a4af7[_0xae40('0x49')]=_0x1f0156[_0xae40('0x49')];_0x2a4af7[_0xae40('0x4a')]=_0x1f0156[_0xae40('0x4a')];_0x2a4af7[_0xae40('0x4b')]=_0x1f0156[_0xae40('0x4b')];_0x2a4af7[_0xae40('0x4c')]=_0x1f0156[_0xae40('0x4c')];_0x2a4af7[_0xae40('0x4d')]=_0x1f0156[_0xae40('0x4d')];_0x2a4af7[_0xae40('0x4e')]=_0x1f0156['predictiveIntervalAvailable'];_0x2a4af7[_0xae40('0x4f')]=_0x1f0156['predictiveIntervalTotalCalls'];_0x2a4af7[_0xae40('0x1c')]=_0x1f0156[_0xae40('0x1c')];_0x2a4af7[_0xae40('0x50')]=_0x1f0156[_0xae40('0x50')];_0x2a4af7[_0xae40('0x51')]=_0x1f0156[_0xae40('0x51')];_0x2a4af7['erlangCallToSecond']=_0x1f0156[_0xae40('0x52')];_0x2a4af7['erlangAbandonmentRate']=_0x1f0156[_0xae40('0x53')];_0x2a4af7[_0xae40('0x54')]=_0x1f0156[_0xae40('0x54')];_0x2a4af7['startPredictive']=_0x1f0156['startPredictive'];_0x2a4af7['startProgressive']=_0x1f0156[_0xae40('0x55')];}if(_0x1f0156[_0xae40('0x56')]){_0x2a4af7[_0xae40('0x56')]={'id':_0x1f0156['Trunk']['id'],'name':_0x1f0156[_0xae40('0x56')][_0xae40('0xb')],'active':_0x1f0156[_0xae40('0x56')]['active'],'callerid':_0x1f0156[_0xae40('0x56')]['callerid']};}if(_0x1f0156[_0xae40('0x57')]){_0x2a4af7['Interval']={'id':_0x1f0156[_0xae40('0x57')]['id'],'name':_0x1f0156[_0xae40('0x57')][_0xae40('0xb')]};}_0x28c5c3[_0xae40('0x58')](_0x2a4af7);}}_0xd4f3fb({'count':_0x28c5c3[_0xae40('0x59')],'rows':_0x28c5c3});});},'UpdateVoiceQueue':function(_0xd58556){return new Promise(function(_0xdd06ab,_0x192bf4){var _0x1d042a=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x21')],{'id':parseInt(_0xd58556['id'])});var _0x5cdc14=_['omit'](_0xd58556,['id']);if(_0x1d042a){for(var _0x509eda in _0x5cdc14){if(typeof _0x5cdc14[_0x509eda]!==_0xae40('0x5b')&&typeof _0x1d042a[_0x509eda]!==_0xae40('0x5b')){_0x1d042a[_0x509eda]=_0x5cdc14[_0x509eda];}}_0xdd06ab(_0x1d042a);}else{_0x192bf4();}});},'VoiceChannels':function(_0x32f2cc){return new Promise(function(_0x432128,_0x470227){var _0x1392fa=_[_0xae40('0x5c')](_0x4d1d7b[_0xae40('0x5d')]);_0x432128({'count':_0x1392fa[_0xae40('0x59')],'rows':_0x1392fa});});},'VoiceChannelMixMonitor':function(_0x572d8a){var _0x4cdf4e=this;return new Promise(function(_0x2846e2,_0x387a4a){if(ami['isConnected']()==![]){return _0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f4,[config[_0xae40('0x13')]['ip'],config[_0xae40('0x13')][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}var _0xa20a97=schema(properties[_0xae40('0x5e')])[_0xae40('0x2')](_0x572d8a);if(_0xa20a97[_0xae40('0x59')]>0x0){return _0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f4,_[_0xae40('0x5f')](_0xa20a97,_0xae40('0x1c'))[_0xae40('0x16')](',\x20')));}var _0x2fd5c2=_['find'](_0x4d1d7b[_0xae40('0x5d')],{'uniqueid':_0x572d8a[_0xae40('0x60')]});if(_0x2fd5c2&&_0x2fd5c2[_0xae40('0x61')]){var _0x10bbd7=util[_0xae40('0x9')](_0xae40('0x62'),_0x572d8a['filename']||_0x572d8a[_0xae40('0x60')],_0x572d8a['format']||_0xae40('0x63'));return ami['Action']({'action':'MixMonitor','channel':_0x2fd5c2[_0xae40('0x61')],'file':_0x10bbd7,'options':_0xae40('0x64')})[_0xae40('0x1b')](function(_0x2a1200){var _0x249d6f=_[_0xae40('0x5a')](_0x2fd5c2[_0xae40('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x10bbd7[_0xae40('0x66')]()});if(_[_0xae40('0x67')](_0x249d6f)){_0x2fd5c2[_0xae40('0x65')][_0xae40('0x58')]({'filename':_0xae40('0x68')+_0x10bbd7['toLowerCase'](),'createdAt':moment()[_0xae40('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x2a1200[_0xae40('0x69')],'status':'rec'});}else{_0x249d6f[_0xae40('0x69')]=_0x2a1200[_0xae40('0x69')];_0x249d6f[_0xae40('0x6a')]='rec';}_0x2846e2({'code':0xc8,'message':[_0x572d8a[_0xae40('0x60')],_0xae40('0x6b'),_0x2a1200[_0xae40('0x69')]][_0xae40('0x16')]('\x20'),'mixmonitorid':_0x2a1200[_0xae40('0x69')]});})[_0xae40('0x1d')](function(_0x18d963){_0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f5,[_0x572d8a[_0xae40('0x60')],_0x18d963[_0xae40('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0x387a4a(_0x4cdf4e[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0xf283cb){var _0x20353c=this;return new Promise(function(_0x43d88c,_0x2e713d){if(ami[_0xae40('0x12')]()==![]){return _0x2e713d(_0x20353c['error'](0x1f4,[config[_0xae40('0x13')]['ip'],config[_0xae40('0x13')][_0xae40('0x14')],_0xae40('0x15')][_0xae40('0x16')]('\x20')));}var _0x304551=schema(properties[_0xae40('0x5e')])[_0xae40('0x2')](_0xf283cb);if(_0x304551[_0xae40('0x59')]>0x0){return _0x2e713d(_0x20353c[_0xae40('0x1e')](0x1f4,_['map'](_0x304551,_0xae40('0x1c'))[_0xae40('0x16')](',\x20')));}var _0xe4868=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x5d')],{'uniqueid':_0xf283cb[_0xae40('0x60')]});if(_0xe4868){return BPromise[_0xae40('0x6d')]()['then'](function(){if(_0xe4868[_0xae40('0x61')]){return ami[_0xae40('0x20')]({'action':_0xae40('0x6e'),'channel':_0xe4868[_0xae40('0x61')],'mixmonitorid':_0xf283cb[_0xae40('0x69')]})[_0xae40('0x1d')](function(_0x7c2e83){});}})[_0xae40('0x1b')](function(){if(_0xe4868['destinationchannel']){return ami['Action']({'action':_0xae40('0x6e'),'channel':_0xe4868[_0xae40('0x6f')],'mixmonitorid':_0xf283cb['mixmonitorid']})[_0xae40('0x1d')](function(_0x40aad4){});}})[_0xae40('0x1b')](function(_0x61a258){var _0x5630ba=_[_0xae40('0x5a')](_0xe4868[_0xae40('0x65')],{'mixmonitorid':_0xf283cb[_0xae40('0x69')]});if(_0x5630ba){_0x5630ba[_0xae40('0x6a')]=_0xae40('0x70');}})[_0xae40('0x1b')](function(){var _0x18ed44=util['format'](_0xae40('0x62'),_0xf283cb[_0xae40('0x71')]||_0xf283cb[_0xae40('0x60')],_0xf283cb[_0xae40('0x9')]||_0xae40('0x63'));var _0x592395=_[_0xae40('0x5a')](_0xe4868[_0xae40('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x18ed44[_0xae40('0x66')]()});if(_0x592395){_0x592395[_0xae40('0x6a')]='stop';}})['then'](function(){_0x43d88c({'code':0xc8,'message':[_0xf283cb[_0xae40('0x60')],_0xae40('0x72')][_0xae40('0x16')]('\x20')});})[_0xae40('0x1d')](function(_0xb0957a){_0x2e713d(_0x20353c[_0xae40('0x1e')](0x1f5,[_0xf283cb[_0xae40('0x60')],_0xb0957a[_0xae40('0x1c')][_0xae40('0x66')]()][_0xae40('0x16')]('\x20')));});}else{return _0x2e713d(_0x20353c[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceQueuesChannels':function(_0x26edd0){return new Promise(function(_0x33d517,_0x46da13){var _0x77a14b=_['values'](_0x4d1d7b[_0xae40('0x73')]);_0x33d517({'count':_0x77a14b[_0xae40('0x59')],'rows':_0x77a14b});});},'VoiceQueuesChannel':function(_0x4b34f0){var _0x3b5697=this;return new Promise(function(_0x4081e9,_0x27eaf4){var _0x245d14=schema(properties[_0xae40('0x74')])[_0xae40('0x2')](_0x4b34f0);if(_0x245d14['length']>0x0){return _0x27eaf4(_0x3b5697[_0xae40('0x1e')](0x1f4,_['map'](_0x245d14,_0xae40('0x1c'))[_0xae40('0x16')](',\x20')));}var _0x326fda=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x73')],{'uniqueid':_0x4b34f0[_0xae40('0x60')]});if(_0x326fda){_0x4081e9(_0x326fda);}else{return _0x27eaf4(_0x3b5697[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x8b6245){var _0x263472=this;return new Promise(function(_0x2568f7,_0x2cd2bb){if(ami[_0xae40('0x12')]()==![]){return _0x2cd2bb(_0x263472['error'](0x1f4,[config['asterisk']['ip'],config[_0xae40('0x13')][_0xae40('0x14')],'ami\x20disconnected'][_0xae40('0x16')]('\x20')));}var _0x58b4e0=schema(properties[_0xae40('0x75')])[_0xae40('0x2')](_0x8b6245);if(_0x58b4e0[_0xae40('0x59')]>0x0){return _0x2cd2bb(_0x263472['error'](0x1f4,_[_0xae40('0x5f')](_0x58b4e0,_0xae40('0x1c'))['join'](',\x20')));}var _0x3f52b0=_['find'](_0x4d1d7b['queueChannels'],{'uniqueid':_0x8b6245[_0xae40('0x60')]});if(_0x3f52b0&&_0x3f52b0['channel']){return ami['Action']({'action':_0xae40('0x76'),'channel':_0x3f52b0[_0xae40('0x61')]})[_0xae40('0x1b')](function(_0x62fb4b){_0x2568f7({'code':0xc8,'message':[_0x8b6245['uniqueid'],_0x62fb4b[_0xae40('0x1c')][_0xae40('0x66')]()]['join']('\x20')});})[_0xae40('0x1d')](function(_0x3a7562){_0x2cd2bb(_0x263472[_0xae40('0x1e')](0x1f5,[_0x8b6245[_0xae40('0x60')],_0x3a7562[_0xae40('0x1c')][_0xae40('0x66')]()][_0xae40('0x16')]('\x20')));});}else{return _0x2cd2bb(_0x263472[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x2300a0){var _0x26957c=this;return new Promise(function(_0x394cd0,_0x128e87){if(ami['isConnected']()==![]){return _0x128e87(_0x26957c['error'](0x1f4,[config[_0xae40('0x13')]['ip'],config[_0xae40('0x13')][_0xae40('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x344594=schema(properties['voicequeuechannelredirect'])[_0xae40('0x2')](_0x2300a0);if(_0x344594['length']>0x0){return _0x128e87(_0x26957c['error'](0x1f4,_[_0xae40('0x5f')](_0x344594,'message')[_0xae40('0x16')](',\x20')));}var _0x333178=_[_0xae40('0x5a')](_0x4d1d7b[_0xae40('0x73')],{'uniqueid':_0x2300a0['uniqueid']});if(_0x333178&&_0x333178[_0xae40('0x61')]){return ami[_0xae40('0x20')]({'action':'Redirect','channel':_0x333178[_0xae40('0x61')],'exten':_0x2300a0[_0xae40('0x77')],'context':_0x2300a0[_0xae40('0x78')]||_0x333178['context'],'priority':0x1})[_0xae40('0x1b')](function(_0x369850){_0x394cd0({'code':0xc8,'message':[_0x2300a0[_0xae40('0x60')],_0x369850[_0xae40('0x1c')]['toLowerCase']()][_0xae40('0x16')]('\x20')});})[_0xae40('0x1d')](function(_0x4203c5){_0x128e87(_0x26957c[_0xae40('0x1e')](0x1f5,[_0x2300a0['uniqueid'],_0x4203c5['message'][_0xae40('0x66')]()][_0xae40('0x16')]('\x20')));});}else{return _0x128e87(_0x26957c[_0xae40('0x1e')](0x1f5,_0xae40('0x6c')));}});},'Agents':function(_0x2c42a1){return new Promise(function(_0x1973df,_0x8fac36){var _0x3b4edb=_['values'](_0x4d1d7b[_0xae40('0x79')]);_0x1973df({'count':_0x3b4edb[_0xae40('0x59')],'rows':_0x3b4edb});});},'Telephones':function(_0x399e78){return new Promise(function(_0x58b0cc,_0x4abef2){var _0x51ae5b=_[_0xae40('0x5c')](_0x4d1d7b['telephones']);_0x58b0cc({'count':_0x51ae5b[_0xae40('0x59')],'rows':_0x51ae5b});});},'Trunks':function(_0x4f8e5c){return new Promise(function(_0x5ba6bd,_0x2161d9){var _0x489aaf=_['values'](_0x4d1d7b[_0xae40('0x7a')]);_0x5ba6bd({'count':_0x489aaf[_0xae40('0x59')],'rows':_0x489aaf});});},'OutboundChannels':function(_0x5487b9){return new Promise(function(_0xb14ee9,_0x21acf4){var _0x3623d0=_['values'](_0x4d1d7b[_0xae40('0x7b')]);_0xb14ee9({'count':_0x3623d0[_0xae40('0x59')],'rows':_0x3623d0});});},'Outbound':function(_0x3f6d67){return new Promise(function(_0x49010c,_0x5db03c){_0x49010c(_0x4d1d7b[_0xae40('0x2e')]);});},'Campaigns':function(_0x281929){return new Promise(function(_0x2e1379,_0x31cfff){var _0x4b378c=_['values'](_0x4d1d7b[_0xae40('0x7c')]);_0x2e1379({'count':_0x4b378c[_0xae40('0x59')],'rows':_0x4b378c});});},'VoiceQueuesPreview':function(_0x41720c){var _0x1a6d4b=this;return new Promise(function(_0x14efd0,_0x554b7c){_0x2aa8f5[_0xae40('0x7d')](_0x41720c['id'])[_0xae40('0x1b')](function(_0x3d1a23){_0x14efd0({'code':0xc8,'message':_0x3d1a23[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x23fca5){_0x554b7c(_0x1a6d4b[_0xae40('0x1e')](0x1f4,_0x23fca5[_0xae40('0x1c')]));});});},'EventManager':function(_0x1215e2){var _0x4be072=this;return new Promise(function(_0x70987e,_0xb29ef8){if(!_0x1215e2['event']){return _0xb29ef8(_0x4be072['error'](0x1f4,_0xae40('0x7e')));}ami[_0xae40('0x7f')](_0xae40('0x80')+_0x1215e2[_0xae40('0x81')],_0x1215e2[_0xae40('0x1c')]);_0x70987e({'code':0xc8,'message':_0x1215e2});});},'FaxAccounts':function(_0xe3256a){return new Promise(function(_0x13326f,_0x3f9c26){var _0x37f26e=_[_0xae40('0x5c')](_0x4d1d7b[_0xae40('0x82')]);_0x13326f({'count':_0x37f26e['length'],'rows':_0x37f26e});});},'SendFax':function(_0x51db9d){var _0x598418=this;return new Promise(function(_0x21cd5a,_0x1006f6){_0x4bbae9[_0xae40('0x83')](_0x51db9d)['then'](function(_0x408893){_0x21cd5a({'code':0xc8,'message':_0x408893[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x4bf1fa){_0x1006f6(_0x598418[_0xae40('0x1e')](0x1f4,_0x4bf1fa[_0xae40('0x1c')]));});});},'CheckAfterSend':function(_0x3f2c76){var _0x20bc6b=this;return new Promise(function(_0x13a556,_0x5b3eeb){_0x4bbae9[_0xae40('0x84')](_0x3f2c76)['then'](function(_0x2ac76e){_0x13a556({'code':0xc8,'message':_0x2ac76e[_0xae40('0x1c')]});})[_0xae40('0x1d')](function(_0x5d4aa5){_0x5b3eeb(_0x20bc6b['error'](0x1f4,_0x5d4aa5[_0xae40('0x1c')]));});});}};var _0x1817ce=jayson[_0xae40('0x85')](_0x16ab1d)[_0xae40('0x86')]();_0x1817ce['on'](_0xae40('0x1e'),function(_0x35f7be){return _0x29ca9f(_0x35f7be);});_0x1817ce[_0xae40('0x8')](0x232a,'127.0.0.1',function(){console[_0xae40('0x87')](_0xae40('0x88'),0x232a);return _0x34dbe9(_0xae40('0x89')+0x232a);});});}; \ No newline at end of file +var _0x0280=['erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','undefined','values','channels','username','voicechannel','validate','length','find','uniqueid','channel','%s.%s','format','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','status','stop','wav','StopMixMonitor\x20Success','voicequeuechannel','map','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','listen','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','../../../config/environment','../properties','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','message','catch','error','isConnected','asterisk','Command','then','content','voiceQueues','strategy','pTalking','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated'];(function(_0x72f9b6,_0x10eaa3){var _0x23b099=function(_0x2ca740){while(--_0x2ca740){_0x72f9b6['push'](_0x72f9b6['shift']());}};_0x23b099(++_0x10eaa3);}(_0x0280,0xc4));var _0x0028=function(_0x2f1ec9,_0x6dd078){_0x2f1ec9=_0x2f1ec9-0x0;var _0x7c967e=_0x0280[_0x2f1ec9];return _0x7c967e;};'use strict';var _=require('lodash');var util=require(_0x0028('0x0'));var jayson=require(_0x0028('0x1'));var schema=require('validate');var BPromise=require(_0x0028('0x2'));var moment=require('moment');var config=require(_0x0028('0x3'));var properties=require(_0x0028('0x4'));var ami=require('../ami');exports['listen']=function(_0x26f312,_0x4829db,_0x5a9c0a){return new BPromise(function(_0x1940de,_0x366a07){var _0x3ee407={'QueuePause':function(_0x444647){return new Promise(function(_0x571801,_0xb49837){var _0x95613a=util['format'](_0x0028('0x5'),_0x0028('0x6'),_0x444647[_0x0028('0x7')]);if(_0x26f312[_0x0028('0x8')]&&_0x26f312[_0x0028('0x8')][_0x95613a]&&_0x26f312['timers'][_0x95613a][_0x0028('0x9')]){_0x26f312['timers'][_0x95613a][_0x0028('0xa')]();}if(_0x26f312[_0x0028('0xb')][_0x95613a]){_0x26f312[_0x0028('0xb')][_0x95613a][_0x0028('0xc')]({'statePause':_0x444647[_0x0028('0xd')]?!![]:![]});}_0x571801({'code':0xc8,'message':_0x0028('0xe')});});},'Reload':function(_0x190abd){var _0x2e7a32=this;return new Promise(function(_0x273fda,_0x4f620d){if(ami['isConnected']()==![]){return _0x4f620d(_0x2e7a32['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x0028('0xf')][_0x0028('0x10')]('\x20')));}_0x190abd=_[_0x0028('0x11')](_0x190abd,_[_0x0028('0x12')](properties[_0x0028('0x13')]));_0x190abd[_0x0028('0x14')]=_0x0028('0x15');return ami[_0x0028('0x16')](_0x190abd)['then'](function(_0x137cac){_0x273fda({'code':0xc8,'message':_0x137cac[_0x0028('0x17')]});})[_0x0028('0x18')](function(_0x4959af){_0x4f620d(_0x2e7a32[_0x0028('0x19')](0x1f5,_0x4959af[_0x0028('0x17')]));});});},'Command':function(_0x2675cd){var _0x2ea76c=this;return new Promise(function(_0x133b89,_0x332f5d){if(ami[_0x0028('0x1a')]()==![]){return _0x332f5d(_0x2ea76c[_0x0028('0x19')](0x1f4,[config[_0x0028('0x1b')]['ip'],config[_0x0028('0x1b')]['username'],_0x0028('0xf')][_0x0028('0x10')]('\x20')));}_0x2675cd=_[_0x0028('0x11')](_0x2675cd,'command');_0x2675cd['action']=_0x0028('0x1c');return ami[_0x0028('0x16')](_0x2675cd)[_0x0028('0x1d')](function(_0x568656){_0x133b89({'code':0xc8,'message':_0x568656[_0x0028('0x1e')]});})[_0x0028('0x18')](function(_0x2f5114){_0x332f5d(_0x2ea76c[_0x0028('0x19')](0x1f5,_0x2f5114[_0x0028('0x17')]));});});},'VoiceQueues':function(_0x1b9b43){return new Promise(function(_0x391930,_0x3c7f11){var _0x30b255=[];for(var _0x1c04b9 in _0x26f312['voiceQueues']){if(_0x26f312['voiceQueues']['hasOwnProperty'](_0x1c04b9)){var _0x1ed8ed=_0x26f312[_0x0028('0x1f')][_0x1c04b9];var _0x20dbe6={'id':_0x1ed8ed['id'],'name':_0x1ed8ed[_0x0028('0x7')],'strategy':_0x1ed8ed[_0x0028('0x20')],'answered':_0x1ed8ed['answered'],'available':_0x1ed8ed['available'],'loggedIn':_0x1ed8ed['loggedIn'],'pTalking':_0x1ed8ed[_0x0028('0x21')],'sumBillable':_0x1ed8ed[_0x0028('0x22')],'sumDuration':_0x1ed8ed['sumDuration'],'sumHoldTime':_0x1ed8ed[_0x0028('0x23')]||0x0,'talking':_0x1ed8ed['talking'],'total':_0x1ed8ed[_0x0028('0x24')],'type':_0x1ed8ed['type'],'unmanaged':_0x1ed8ed[_0x0028('0x25')],'abandoned':_0x1ed8ed[_0x0028('0x26')],'waiting':_0x1ed8ed[_0x0028('0x27')],'loggedInDb':_0x1ed8ed[_0x0028('0x28')]};if(_0x1ed8ed[_0x0028('0x29')]===_0x0028('0x2a')){_0x20dbe6[_0x0028('0x2b')]=_0x1ed8ed[_0x0028('0x2b')];_0x20dbe6['dialMethod']=_0x1ed8ed[_0x0028('0x2c')];_0x20dbe6['dialOriginateCallerIdName']=_0x1ed8ed['dialOriginateCallerIdName'];_0x20dbe6[_0x0028('0x2d')]=_0x1ed8ed[_0x0028('0x2d')];_0x20dbe6['dialOriginateTimeout']=_0x1ed8ed[_0x0028('0x2e')];_0x20dbe6[_0x0028('0x2f')]=_0x1ed8ed['dialPrefix'];_0x20dbe6[_0x0028('0x30')]=_0x1ed8ed['temp'];_0x20dbe6['outboundAnswerAgiCallsDay']=_0x1ed8ed[_0x0028('0x31')];_0x20dbe6['outboundAnswerCallsDay']=_0x1ed8ed[_0x0028('0x32')];_0x20dbe6['outboundBlacklistCallsDay']=_0x1ed8ed[_0x0028('0x33')];_0x20dbe6['outboundBusyCallsDay']=_0x1ed8ed[_0x0028('0x34')];_0x20dbe6[_0x0028('0x35')]=_0x1ed8ed['outboundCongestionCallsDay'];_0x20dbe6[_0x0028('0x36')]=_0x1ed8ed[_0x0028('0x36')];_0x20dbe6[_0x0028('0x37')]=_0x1ed8ed[_0x0028('0x37')];_0x20dbe6[_0x0028('0x38')]=_0x1ed8ed[_0x0028('0x38')];_0x20dbe6[_0x0028('0x39')]=_0x1ed8ed['outboundNoAnswerCallsDay'];_0x20dbe6[_0x0028('0x3a')]=_0x1ed8ed[_0x0028('0x3a')];_0x20dbe6[_0x0028('0x3b')]=_0x1ed8ed[_0x0028('0x3b')];_0x20dbe6['outboundReCallsDay']=_0x1ed8ed[_0x0028('0x3c')];_0x20dbe6[_0x0028('0x3d')]=_0x1ed8ed[_0x0028('0x3d')];_0x20dbe6['outboundUnknownCallsDay']=_0x1ed8ed['outboundUnknownCallsDay'];_0x20dbe6[_0x0028('0x3e')]=_0x1ed8ed[_0x0028('0x3e')];_0x20dbe6['predictiveIntervalAvgHoldtime']=_0x1ed8ed[_0x0028('0x3f')];_0x20dbe6[_0x0028('0x40')]=_0x1ed8ed['predictiveIntervalAvgTalktime'];_0x20dbe6[_0x0028('0x41')]=_0x1ed8ed['predictiveIntervalDroppedCallsCallersExit'];_0x20dbe6[_0x0028('0x42')]=_0x1ed8ed[_0x0028('0x42')];_0x20dbe6['predictiveIntervalErlangCalls']=_0x1ed8ed[_0x0028('0x43')];_0x20dbe6[_0x0028('0x44')]=_0x1ed8ed[_0x0028('0x44')];_0x20dbe6['predictiveIntervalHitRate']=_0x1ed8ed['predictiveIntervalHitRate'];_0x20dbe6[_0x0028('0x45')]=_0x1ed8ed['predictiveIntervalMultiplicativeFactor'];_0x20dbe6['predictiveIntervalPauses']=_0x1ed8ed[_0x0028('0x46')];_0x20dbe6[_0x0028('0x47')]=_0x1ed8ed[_0x0028('0x47')];_0x20dbe6['predictiveIntervalTotalCalls']=_0x1ed8ed[_0x0028('0x48')];_0x20dbe6[_0x0028('0x17')]=_0x1ed8ed['message'];_0x20dbe6[_0x0028('0x49')]=_0x1ed8ed[_0x0028('0x49')];_0x20dbe6[_0x0028('0x4a')]=_0x1ed8ed[_0x0028('0x4a')];_0x20dbe6[_0x0028('0x4b')]=_0x1ed8ed[_0x0028('0x4b')];_0x20dbe6[_0x0028('0x4c')]=_0x1ed8ed[_0x0028('0x4c')];_0x20dbe6[_0x0028('0x4d')]=_0x1ed8ed[_0x0028('0x4d')];_0x20dbe6[_0x0028('0x4e')]=_0x1ed8ed[_0x0028('0x4e')];_0x20dbe6['startProgressive']=_0x1ed8ed[_0x0028('0x4f')];}if(_0x1ed8ed['Trunk']){_0x20dbe6[_0x0028('0x50')]={'id':_0x1ed8ed[_0x0028('0x50')]['id'],'name':_0x1ed8ed[_0x0028('0x50')][_0x0028('0x7')],'active':_0x1ed8ed[_0x0028('0x50')][_0x0028('0x51')],'callerid':_0x1ed8ed[_0x0028('0x50')][_0x0028('0x52')]};}if(_0x1ed8ed[_0x0028('0x53')]){_0x20dbe6[_0x0028('0x53')]={'id':_0x1ed8ed[_0x0028('0x53')]['id'],'name':_0x1ed8ed['Interval'][_0x0028('0x7')]};}_0x30b255[_0x0028('0x54')](_0x20dbe6);}}_0x391930({'count':_0x30b255['length'],'rows':_0x30b255});});},'UpdateVoiceQueue':function(_0x84c3fa){return new Promise(function(_0x5e864c,_0x487133){var _0x394689=_['find'](_0x26f312[_0x0028('0x1f')],{'id':parseInt(_0x84c3fa['id'])});var _0x451551=_['omit'](_0x84c3fa,['id']);if(_0x394689){for(var _0x51f911 in _0x451551){if(typeof _0x451551[_0x51f911]!==_0x0028('0x55')&&typeof _0x394689[_0x51f911]!==_0x0028('0x55')){_0x394689[_0x51f911]=_0x451551[_0x51f911];}}_0x5e864c(_0x394689);}else{_0x487133();}});},'VoiceChannels':function(_0x4ad914){return new Promise(function(_0xb24592,_0x2e373a){var _0x11ceed=_[_0x0028('0x56')](_0x26f312[_0x0028('0x57')]);_0xb24592({'count':_0x11ceed['length'],'rows':_0x11ceed});});},'VoiceChannelMixMonitor':function(_0x1c246b){var _0x213125=this;return new Promise(function(_0x157509,_0x396bb3){if(ami['isConnected']()==![]){return _0x396bb3(_0x213125[_0x0028('0x19')](0x1f4,[config['asterisk']['ip'],config[_0x0028('0x1b')][_0x0028('0x58')],'ami\x20disconnected'][_0x0028('0x10')]('\x20')));}var _0x20b1f9=schema(properties[_0x0028('0x59')])[_0x0028('0x5a')](_0x1c246b);if(_0x20b1f9[_0x0028('0x5b')]>0x0){return _0x396bb3(_0x213125[_0x0028('0x19')](0x1f4,_['map'](_0x20b1f9,_0x0028('0x17'))[_0x0028('0x10')](',\x20')));}var _0x4c5612=_[_0x0028('0x5c')](_0x26f312[_0x0028('0x57')],{'uniqueid':_0x1c246b[_0x0028('0x5d')]});if(_0x4c5612&&_0x4c5612[_0x0028('0x5e')]){var _0x297209=util['format'](_0x0028('0x5f'),_0x1c246b['filename']||_0x1c246b[_0x0028('0x5d')],_0x1c246b[_0x0028('0x60')]||'wav');return ami['Action']({'action':_0x0028('0x61'),'channel':_0x4c5612[_0x0028('0x5e')],'file':_0x297209,'options':_0x0028('0x62')})['then'](function(_0x5de90f){var _0x3aade4=_[_0x0028('0x5c')](_0x4c5612[_0x0028('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x297209[_0x0028('0x64')]()});if(_[_0x0028('0x65')](_0x3aade4)){_0x4c5612[_0x0028('0x63')]['push']({'filename':_0x0028('0x66')+_0x297209[_0x0028('0x64')](),'createdAt':moment()[_0x0028('0x60')](_0x0028('0x67')),'mixmonitorid':_0x5de90f['mixmonitorid'],'status':'rec'});}else{_0x3aade4[_0x0028('0x68')]=_0x5de90f[_0x0028('0x68')];_0x3aade4['status']='rec';}_0x157509({'code':0xc8,'message':[_0x1c246b['uniqueid'],'MixMonitor\x20Success',_0x5de90f['mixmonitorid']][_0x0028('0x10')]('\x20'),'mixmonitorid':_0x5de90f[_0x0028('0x68')]});})[_0x0028('0x18')](function(_0x521d51){_0x396bb3(_0x213125[_0x0028('0x19')](0x1f5,[_0x1c246b['uniqueid'],_0x521d51[_0x0028('0x17')][_0x0028('0x64')]()]['join']('\x20')));});}else{return _0x396bb3(_0x213125[_0x0028('0x19')](0x1f5,_0x0028('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x4d2652){var _0x21192b=this;return new Promise(function(_0x393a1e,_0x258d3e){if(ami[_0x0028('0x1a')]()==![]){return _0x258d3e(_0x21192b['error'](0x1f4,[config[_0x0028('0x1b')]['ip'],config[_0x0028('0x1b')][_0x0028('0x58')],_0x0028('0xf')]['join']('\x20')));}var _0x5625b1=schema(properties[_0x0028('0x59')])[_0x0028('0x5a')](_0x4d2652);if(_0x5625b1[_0x0028('0x5b')]>0x0){return _0x258d3e(_0x21192b[_0x0028('0x19')](0x1f4,_['map'](_0x5625b1,_0x0028('0x17'))[_0x0028('0x10')](',\x20')));}var _0x4503c4=_[_0x0028('0x5c')](_0x26f312['channels'],{'uniqueid':_0x4d2652[_0x0028('0x5d')]});if(_0x4503c4){return BPromise[_0x0028('0x6a')]()[_0x0028('0x1d')](function(){if(_0x4503c4[_0x0028('0x5e')]){return ami[_0x0028('0x16')]({'action':'StopMixMonitor','channel':_0x4503c4[_0x0028('0x5e')],'mixmonitorid':_0x4d2652[_0x0028('0x68')]})[_0x0028('0x18')](function(_0x1f9ab1){});}})[_0x0028('0x1d')](function(){if(_0x4503c4[_0x0028('0x6b')]){return ami[_0x0028('0x16')]({'action':'StopMixMonitor','channel':_0x4503c4[_0x0028('0x6b')],'mixmonitorid':_0x4d2652[_0x0028('0x68')]})[_0x0028('0x18')](function(_0xc32d7){});}})[_0x0028('0x1d')](function(_0x4bc07a){var _0x46a4ea=_[_0x0028('0x5c')](_0x4503c4[_0x0028('0x63')],{'mixmonitorid':_0x4d2652['mixmonitorid']});if(_0x46a4ea){_0x46a4ea[_0x0028('0x6c')]=_0x0028('0x6d');}})['then'](function(){var _0x110121=util[_0x0028('0x60')](_0x0028('0x5f'),_0x4d2652['filename']||_0x4d2652[_0x0028('0x5d')],_0x4d2652[_0x0028('0x60')]||_0x0028('0x6e'));var _0x45c97e=_[_0x0028('0x5c')](_0x4503c4[_0x0028('0x63')],{'filename':_0x0028('0x66')+_0x110121[_0x0028('0x64')]()});if(_0x45c97e){_0x45c97e[_0x0028('0x6c')]=_0x0028('0x6d');}})[_0x0028('0x1d')](function(){_0x393a1e({'code':0xc8,'message':[_0x4d2652[_0x0028('0x5d')],_0x0028('0x6f')][_0x0028('0x10')]('\x20')});})[_0x0028('0x18')](function(_0x3e3366){_0x258d3e(_0x21192b[_0x0028('0x19')](0x1f5,[_0x4d2652['uniqueid'],_0x3e3366[_0x0028('0x17')][_0x0028('0x64')]()][_0x0028('0x10')]('\x20')));});}else{return _0x258d3e(_0x21192b[_0x0028('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5873da){return new Promise(function(_0x3649e5,_0x3fe6bb){var _0x8f4644=_['values'](_0x26f312['queueChannels']);_0x3649e5({'count':_0x8f4644[_0x0028('0x5b')],'rows':_0x8f4644});});},'VoiceQueuesChannel':function(_0x2de782){var _0x3a9178=this;return new Promise(function(_0x35a512,_0xdb05f1){var _0x4fc834=schema(properties[_0x0028('0x70')])['validate'](_0x2de782);if(_0x4fc834[_0x0028('0x5b')]>0x0){return _0xdb05f1(_0x3a9178[_0x0028('0x19')](0x1f4,_[_0x0028('0x71')](_0x4fc834,'message')['join'](',\x20')));}var _0x486855=_[_0x0028('0x5c')](_0x26f312[_0x0028('0x72')],{'uniqueid':_0x2de782[_0x0028('0x5d')]});if(_0x486855){_0x35a512(_0x486855);}else{return _0xdb05f1(_0x3a9178[_0x0028('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x326ba1){var _0xb5d577=this;return new Promise(function(_0x169b61,_0x4b42ec){if(ami[_0x0028('0x1a')]()==![]){return _0x4b42ec(_0xb5d577[_0x0028('0x19')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x0028('0x58')],'ami\x20disconnected']['join']('\x20')));}var _0x5d97ab=schema(properties[_0x0028('0x73')])[_0x0028('0x5a')](_0x326ba1);if(_0x5d97ab[_0x0028('0x5b')]>0x0){return _0x4b42ec(_0xb5d577[_0x0028('0x19')](0x1f4,_['map'](_0x5d97ab,_0x0028('0x17'))[_0x0028('0x10')](',\x20')));}var _0x2ff966=_[_0x0028('0x5c')](_0x26f312[_0x0028('0x72')],{'uniqueid':_0x326ba1[_0x0028('0x5d')]});if(_0x2ff966&&_0x2ff966[_0x0028('0x5e')]){return ami[_0x0028('0x16')]({'action':_0x0028('0x74'),'channel':_0x2ff966['channel']})[_0x0028('0x1d')](function(_0x26326c){_0x169b61({'code':0xc8,'message':[_0x326ba1[_0x0028('0x5d')],_0x26326c[_0x0028('0x17')][_0x0028('0x64')]()][_0x0028('0x10')]('\x20')});})[_0x0028('0x18')](function(_0x5d2983){_0x4b42ec(_0xb5d577[_0x0028('0x19')](0x1f5,[_0x326ba1[_0x0028('0x5d')],_0x5d2983[_0x0028('0x17')][_0x0028('0x64')]()]['join']('\x20')));});}else{return _0x4b42ec(_0xb5d577[_0x0028('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x46efae){var _0x3d4e51=this;return new Promise(function(_0x1c66ee,_0x3445a4){if(ami[_0x0028('0x1a')]()==![]){return _0x3445a4(_0x3d4e51[_0x0028('0x19')](0x1f4,[config[_0x0028('0x1b')]['ip'],config[_0x0028('0x1b')][_0x0028('0x58')],_0x0028('0xf')][_0x0028('0x10')]('\x20')));}var _0x24c1dd=schema(properties[_0x0028('0x75')])[_0x0028('0x5a')](_0x46efae);if(_0x24c1dd[_0x0028('0x5b')]>0x0){return _0x3445a4(_0x3d4e51[_0x0028('0x19')](0x1f4,_[_0x0028('0x71')](_0x24c1dd,_0x0028('0x17'))[_0x0028('0x10')](',\x20')));}var _0x3f3436=_[_0x0028('0x5c')](_0x26f312[_0x0028('0x72')],{'uniqueid':_0x46efae['uniqueid']});if(_0x3f3436&&_0x3f3436[_0x0028('0x5e')]){return ami[_0x0028('0x16')]({'action':_0x0028('0x76'),'channel':_0x3f3436[_0x0028('0x5e')],'exten':_0x46efae[_0x0028('0x77')],'context':_0x46efae[_0x0028('0x78')]||_0x3f3436['context'],'priority':0x1})['then'](function(_0x4344c1){_0x1c66ee({'code':0xc8,'message':[_0x46efae[_0x0028('0x5d')],_0x4344c1[_0x0028('0x17')]['toLowerCase']()][_0x0028('0x10')]('\x20')});})[_0x0028('0x18')](function(_0x1e3f62){_0x3445a4(_0x3d4e51[_0x0028('0x19')](0x1f5,[_0x46efae[_0x0028('0x5d')],_0x1e3f62[_0x0028('0x17')][_0x0028('0x64')]()][_0x0028('0x10')]('\x20')));});}else{return _0x3445a4(_0x3d4e51[_0x0028('0x19')](0x1f5,_0x0028('0x69')));}});},'Agents':function(_0x2d7eb3){return new Promise(function(_0x489c8b,_0x29daeb){var _0x3bda0d=_[_0x0028('0x56')](_0x26f312['agents']);_0x489c8b({'count':_0x3bda0d['length'],'rows':_0x3bda0d});});},'Telephones':function(_0x5d6f23){return new Promise(function(_0x333c6b,_0x3b1227){var _0x560809=_['values'](_0x26f312['telephones']);_0x333c6b({'count':_0x560809[_0x0028('0x5b')],'rows':_0x560809});});},'Trunks':function(_0x1eafa8){return new Promise(function(_0x576337,_0x469d16){var _0x41c61e=_[_0x0028('0x56')](_0x26f312['trunks']);_0x576337({'count':_0x41c61e[_0x0028('0x5b')],'rows':_0x41c61e});});},'OutboundChannels':function(_0x24561d){return new Promise(function(_0x1bf7a6,_0x4261b1){var _0x19a772=_[_0x0028('0x56')](_0x26f312[_0x0028('0x79')]);_0x1bf7a6({'count':_0x19a772[_0x0028('0x5b')],'rows':_0x19a772});});},'Outbound':function(_0x545afe){return new Promise(function(_0x374cd8,_0x576174){_0x374cd8(_0x26f312[_0x0028('0x2a')]);});},'Campaigns':function(_0x1d5e59){return new Promise(function(_0x38e9de,_0xa71f1c){var _0x4fee8e=_[_0x0028('0x56')](_0x26f312[_0x0028('0x7a')]);_0x38e9de({'count':_0x4fee8e[_0x0028('0x5b')],'rows':_0x4fee8e});});},'VoiceQueuesPreview':function(_0xcccbac){var _0x3da95b=this;return new Promise(function(_0x24d72a,_0x39cd47){_0x4829db[_0x0028('0x7b')](_0xcccbac['id'])[_0x0028('0x1d')](function(_0x17267c){_0x24d72a({'code':0xc8,'message':_0x17267c[_0x0028('0x17')]});})[_0x0028('0x18')](function(_0x2aaa51){_0x39cd47(_0x3da95b['error'](0x1f4,_0x2aaa51[_0x0028('0x17')]));});});},'EventManager':function(_0x27b00d){var _0x27d1ab=this;return new Promise(function(_0x1ef5d6,_0x3b15da){if(!_0x27b00d[_0x0028('0x7c')]){return _0x3b15da(_0x27d1ab[_0x0028('0x19')](0x1f4,_0x0028('0x7d')));}ami[_0x0028('0x7e')](_0x0028('0x7f')+_0x27b00d['event'],_0x27b00d[_0x0028('0x17')]);_0x1ef5d6({'code':0xc8,'message':_0x27b00d});});},'FaxAccounts':function(_0x1481fe){return new Promise(function(_0xf2ec9d,_0x41c78c){var _0x4eb034=_[_0x0028('0x56')](_0x26f312[_0x0028('0x80')]);_0xf2ec9d({'count':_0x4eb034[_0x0028('0x5b')],'rows':_0x4eb034});});},'SendFax':function(_0x35f6c3){var _0x233380=this;return new Promise(function(_0x1baa7b,_0x130bd2){_0x5a9c0a[_0x0028('0x81')](_0x35f6c3)['then'](function(_0x4a4f7d){_0x1baa7b({'code':0xc8,'message':_0x4a4f7d['message']});})[_0x0028('0x18')](function(_0x39f914){_0x130bd2(_0x233380[_0x0028('0x19')](0x1f4,_0x39f914['message']));});});},'CheckAfterSend':function(_0xb77493){var _0x251f08=this;return new Promise(function(_0x3336ab,_0x1dd8af){_0x5a9c0a[_0x0028('0x82')](_0xb77493)[_0x0028('0x1d')](function(_0x3a556e){_0x3336ab({'code':0xc8,'message':_0x3a556e[_0x0028('0x17')]});})[_0x0028('0x18')](function(_0x1d8036){_0x1dd8af(_0x251f08['error'](0x1f4,_0x1d8036[_0x0028('0x17')]));});});}};var _0x4dad0f=jayson['server'](_0x3ee407)[_0x0028('0x83')]();_0x4dad0f['on'](_0x0028('0x19'),function(_0x3740ab){return _0x366a07(_0x3740ab);});_0x4dad0f[_0x0028('0x84')](0x232a,'127.0.0.1',function(){console['log'](_0x0028('0x85'),0x232a);return _0x1940de(_0x0028('0x86')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 5e3b948..4068940 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd93f=['../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','socket.io-emitter','[CM][%s][%s]','emit','exec','data1','data2','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','getContacts','then','isEmpty','info','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','format','user:%s','name','trigger:%s','toLowerCase','merge','length','lodash','bluebird','ioredis','util'];(function(_0x26fa87,_0x1621f5){var _0x2fca7d=function(_0x4141f2){while(--_0x4141f2){_0x26fa87['push'](_0x26fa87['shift']());}};_0x2fca7d(++_0x1621f5);}(_0xd93f,0xa1));var _0xfd93=function(_0x5abf7a,_0x4d16bb){_0x5abf7a=_0x5abf7a-0x0;var _0x17350f=_0xd93f[_0x5abf7a];return _0x17350f;};'use strict';var _=require(_0xfd93('0x0'));var BPromise=require(_0xfd93('0x1'));var Redis=require(_0xfd93('0x2'));var util=require(_0xfd93('0x3'));var config=require('../../../../config/environment');var logger=require(_0xfd93('0x4'))(_0xfd93('0x5'));var cmContactRpc=require(_0xfd93('0x6'));config['redis']=_[_0xfd93('0x7')](config[_0xfd93('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xfd93('0x9'))(new Redis(config[_0xfd93('0x8')]));function emit(_0x3af9a3,_0x4ca4b1,_0x2d77d5,_0x379e1d,_0xa25a4e){logger['info'](_0xfd93('0xa'),_0x3af9a3,_0x4ca4b1['id'],_0x2d77d5,_0x379e1d,JSON['stringify'](_0xa25a4e));io['to'](_0x2d77d5)[_0xfd93('0xb')](_0x379e1d,_0xa25a4e);}exports[_0xfd93('0xc')]=function(_0x3591e6,_0x175d83,_0x24e6ea,_0x2521de){var _0x26fe17,_0x983a3f;var _0x3b32cd={};var _0x339a61=Number(_0x24e6ea[_0xfd93('0xd')]);var _0x4c7b33=_0x24e6ea['data2']?Boolean(Number(_0x24e6ea[_0xfd93('0xe')])):![];var _0x384a72;if(_0x2521de['xmd-contactid']){_0x3b32cd['id']=_0x2521de['xmd-contactid'];}if(!_0x3b32cd['id']){_0x3b32cd[_0xfd93('0xf')]=_0x339a61;_0x384a72=_0x24e6ea[_0xfd93('0x10')]&&_0x24e6ea[_0xfd93('0x10')]!=='0'?_0x24e6ea[_0xfd93('0x10')][_0xfd93('0x11')](','):[_0xfd93('0x12')];_0x3b32cd[_0xfd93('0x13')]=_[_0xfd93('0x14')](_0x384a72,function(_0x34592c){var _0x1123b4={};_0x1123b4[_0x34592c]=_0x2521de[_0xfd93('0x15')]?_0x2521de[_0xfd93('0x16')]:_0x2521de[_0xfd93('0x17')];return _0x1123b4;});}var _0x30935b=['id',_0xfd93('0x18'),_0xfd93('0x19'),'phone',_0xfd93('0x1a'),'fax',_0xfd93('0xf'),_0xfd93('0x1b'),_0xfd93('0x1c'),_0xfd93('0x1d')];var _0xcd1737=_[_0xfd93('0x1e')](_0x30935b,_0x384a72);BPromise['resolve']()['then'](cmContactRpc[_0xfd93('0x1f')]({'attributes':_0xcd1737,'where':_0x3b32cd}))[_0xfd93('0x20')](function(_0x370567){_0x983a3f=_0x370567;if(!_[_0xfd93('0x21')](_0x983a3f)){if(_0x983a3f['length']===0x1){_0x26fe17=_0x983a3f[0x0];logger[_0xfd93('0x22')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2521de[_0xfd93('0x23')],_0x175d83['id'],_0x26fe17['id']);}else{logger[_0xfd93('0x22')](_0xfd93('0x24'),_0x2521de['uniqueid'],_0x175d83['id'],_['map'](_0x983a3f,'id')[_0xfd93('0x25')](','));}return;}else{logger[_0xfd93('0x22')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2521de[_0xfd93('0x23')],_0x175d83['id']);var _0x39b1ca={'ListId':_0x339a61};var _0xf9b77c=_0x24e6ea['data4']&&_0x24e6ea[_0xfd93('0x26')]!=='0'?_0x24e6ea['data4']:_0xfd93('0x12');if(_0x4c7b33){logger[_0xfd93('0x22')](_0xfd93('0x27'),_0x2521de[_0xfd93('0x23')],_0x175d83['id']);_0x39b1ca[_0xf9b77c]=_['isNil'](_0x2521de[_0xfd93('0x15')])?_0x2521de[_0xfd93('0x17')]:_0x2521de[_0xfd93('0x16')];if(_['isNil'](_0x2521de['routeId'])){_0x39b1ca[_0xfd93('0x18')]=_0x2521de[_0xfd93('0x28')]&&_0x2521de[_0xfd93('0x28')]!==_0xfd93('0x29')?_0x2521de['calleridname']:_0xfd93('0x2a');}else{_0x39b1ca['firstName']=_0x2521de['destcalleridname']&&_0x2521de[_0xfd93('0x2b')]!==_0xfd93('0x29')?_0x2521de[_0xfd93('0x2b')]:_0xfd93('0x2a');}return BPromise[_0xfd93('0x2c')]()['then'](cmContactRpc['createContact'](_0x39b1ca))[_0xfd93('0x20')](function(_0x422c9c){_0x26fe17=_0x422c9c;_0x983a3f[_0xfd93('0x2d')](_0x422c9c);if(_0x26fe17){logger[_0xfd93('0x22')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2521de[_0xfd93('0x23')],_0x175d83['id'],_0x26fe17['id']);}return;});}else{logger['info'](_0xfd93('0x2e'),_0x2521de['uniqueid'],_0x175d83['id']);_0x39b1ca[_0xf9b77c]=_[_0xfd93('0x2f')](_0x2521de[_0xfd93('0x15')])?_0x2521de[_0xfd93('0x17')]:_0x2521de['destcalleridnum'];if(_['isNil'](_0x2521de[_0xfd93('0x15')])){_0x39b1ca[_0xfd93('0x18')]=_0x2521de[_0xfd93('0x28')]&&_0x2521de[_0xfd93('0x28')]!==_0xfd93('0x29')?_0x2521de[_0xfd93('0x28')]:_0xfd93('0x2a');}else{_0x39b1ca['firstName']=_0x2521de['destcalleridname']&&_0x2521de[_0xfd93('0x2b')]!==''?_0x2521de[_0xfd93('0x2b')]:_0xfd93('0x2a');}_0x26fe17=_0x39b1ca;_0x983a3f[_0xfd93('0x2d')](_0x39b1ca);return;}}})[_0xfd93('0x20')](function(){if(_0x3591e6){emit(_0x2521de[_0xfd93('0x23')],_0x175d83,util[_0xfd93('0x30')](_0xfd93('0x31'),_0x3591e6[_0xfd93('0x32')]),util[_0xfd93('0x30')](_0xfd93('0x33'),_0x24e6ea['action'][_0xfd93('0x34')]()),{'evt':_[_0xfd93('0x35')](_0x2521de,{'autoCreate':_0x4c7b33}),'contact':_0x26fe17===undefined?{}:_0x26fe17,'contacts':_0x983a3f[_0xfd93('0x36')]===0x0?undefined:_0x983a3f});}});}; \ No newline at end of file +var _0xc62c=['bluebird','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','fax','scheduledAt','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','firstName','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','trigger:%s','action','toLowerCase','lodash'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc62c,0x1e5));var _0xcc62=function(_0x33155e,_0x769a03){_0x33155e=_0x33155e-0x0;var _0x3f58b2=_0xc62c[_0x33155e];return _0x3f58b2;};'use strict';var _=require(_0xcc62('0x0'));var BPromise=require(_0xcc62('0x1'));var Redis=require(_0xcc62('0x2'));var util=require(_0xcc62('0x3'));var config=require(_0xcc62('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xcc62('0x5'));config[_0xcc62('0x6')]=_[_0xcc62('0x7')](config[_0xcc62('0x6')],{'host':_0xcc62('0x8'),'port':0x18eb});var io=require(_0xcc62('0x9'))(new Redis(config['redis']));function emit(_0x4d7296,_0x47c6de,_0x451d3e,_0x2bc8fe,_0x2ea4f2){logger['info'](_0xcc62('0xa'),_0x4d7296,_0x47c6de['id'],_0x451d3e,_0x2bc8fe,JSON[_0xcc62('0xb')](_0x2ea4f2));io['to'](_0x451d3e)[_0xcc62('0xc')](_0x2bc8fe,_0x2ea4f2);}exports[_0xcc62('0xd')]=function(_0x26b3a5,_0x5be23c,_0x1c86db,_0x9b1cca){var _0x29d55c,_0x5b2a22;var _0x44ca47={};var _0x52f7e3=Number(_0x1c86db[_0xcc62('0xe')]);var _0x580a94=_0x1c86db[_0xcc62('0xf')]?Boolean(Number(_0x1c86db[_0xcc62('0xf')])):![];var _0x2b29d7;if(_0x9b1cca['xmd-contactid']){_0x44ca47['id']=_0x9b1cca[_0xcc62('0x10')];}if(!_0x44ca47['id']){_0x44ca47[_0xcc62('0x11')]=_0x52f7e3;_0x2b29d7=_0x1c86db[_0xcc62('0x12')]&&_0x1c86db['data3']!=='0'?_0x1c86db[_0xcc62('0x12')][_0xcc62('0x13')](','):[_0xcc62('0x14')];_0x44ca47[_0xcc62('0x15')]=_[_0xcc62('0x16')](_0x2b29d7,function(_0x3833e6){var _0x4c2b9a={};_0x4c2b9a[_0x3833e6]=_0x9b1cca[_0xcc62('0x17')]?_0x9b1cca[_0xcc62('0x18')]:_0x9b1cca[_0xcc62('0x19')];return _0x4c2b9a;});}var _0x4a0f87=['id','firstName',_0xcc62('0x1a'),_0xcc62('0x14'),'mobile',_0xcc62('0x1b'),_0xcc62('0x11'),'createdAt',_0xcc62('0x1c'),'updatedAt'];var _0x5ea5c0=_['union'](_0x4a0f87,_0x2b29d7);BPromise['resolve']()[_0xcc62('0x1d')](cmContactRpc[_0xcc62('0x1e')]({'attributes':_0x5ea5c0,'where':_0x44ca47}))[_0xcc62('0x1d')](function(_0x236127){_0x5b2a22=_0x236127;if(!_[_0xcc62('0x1f')](_0x5b2a22)){if(_0x5b2a22[_0xcc62('0x20')]===0x1){_0x29d55c=_0x5b2a22[0x0];logger[_0xcc62('0x21')](_0xcc62('0x22'),_0x9b1cca[_0xcc62('0x23')],_0x5be23c['id'],_0x29d55c['id']);}else{logger[_0xcc62('0x21')](_0xcc62('0x24'),_0x9b1cca['uniqueid'],_0x5be23c['id'],_['map'](_0x5b2a22,'id')[_0xcc62('0x25')](','));}return;}else{logger[_0xcc62('0x21')](_0xcc62('0x26'),_0x9b1cca[_0xcc62('0x23')],_0x5be23c['id']);var _0x39fc8a={'ListId':_0x52f7e3};var _0x400e64=_0x1c86db[_0xcc62('0x27')]&&_0x1c86db['data4']!=='0'?_0x1c86db[_0xcc62('0x27')]:'phone';if(_0x580a94){logger[_0xcc62('0x21')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x9b1cca['uniqueid'],_0x5be23c['id']);_0x39fc8a[_0x400e64]=_['isNil'](_0x9b1cca[_0xcc62('0x17')])?_0x9b1cca[_0xcc62('0x19')]:_0x9b1cca[_0xcc62('0x18')];if(_[_0xcc62('0x28')](_0x9b1cca[_0xcc62('0x17')])){_0x39fc8a[_0xcc62('0x29')]=_0x9b1cca[_0xcc62('0x2a')]&&_0x9b1cca['calleridname']!==_0xcc62('0x2b')?_0x9b1cca['calleridname']:_0xcc62('0x2c');}else{_0x39fc8a['firstName']=_0x9b1cca[_0xcc62('0x2d')]&&_0x9b1cca[_0xcc62('0x2d')]!==''?_0x9b1cca[_0xcc62('0x2d')]:_0xcc62('0x2c');}return BPromise[_0xcc62('0x2e')]()['then'](cmContactRpc[_0xcc62('0x2f')](_0x39fc8a))[_0xcc62('0x1d')](function(_0xda7846){_0x29d55c=_0xda7846;_0x5b2a22[_0xcc62('0x30')](_0xda7846);if(_0x29d55c){logger['info'](_0xcc62('0x31'),_0x9b1cca['uniqueid'],_0x5be23c['id'],_0x29d55c['id']);}return;});}else{logger[_0xcc62('0x21')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x9b1cca['uniqueid'],_0x5be23c['id']);_0x39fc8a[_0x400e64]=_[_0xcc62('0x28')](_0x9b1cca[_0xcc62('0x17')])?_0x9b1cca[_0xcc62('0x19')]:_0x9b1cca[_0xcc62('0x18')];if(_['isNil'](_0x9b1cca[_0xcc62('0x17')])){_0x39fc8a[_0xcc62('0x29')]=_0x9b1cca[_0xcc62('0x2a')]&&_0x9b1cca[_0xcc62('0x2a')]!==_0xcc62('0x2b')?_0x9b1cca[_0xcc62('0x2a')]:'Unknown';}else{_0x39fc8a[_0xcc62('0x29')]=_0x9b1cca[_0xcc62('0x2d')]&&_0x9b1cca[_0xcc62('0x2d')]!==_0xcc62('0x2b')?_0x9b1cca[_0xcc62('0x2d')]:_0xcc62('0x2c');}_0x29d55c=_0x39fc8a;_0x5b2a22['push'](_0x39fc8a);return;}}})[_0xcc62('0x1d')](function(){if(_0x26b3a5){emit(_0x9b1cca[_0xcc62('0x23')],_0x5be23c,util['format']('user:%s',_0x26b3a5['name']),util[_0xcc62('0x32')](_0xcc62('0x33'),_0x1c86db[_0xcc62('0x34')][_0xcc62('0x35')]()),{'evt':_['merge'](_0x9b1cca,{'autoCreate':_0x580a94}),'contact':_0x29d55c===undefined?{}:_0x29d55c,'contacts':_0x5b2a22['length']===0x0?undefined:_0x5b2a22});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5a3e06b..1fa32d7 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ad7=['custom:newinteraction','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','status','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','data2','render','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','600','data6','winApplication','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','exec','queue','routeId','urlforward','script','parse','query','search','replace','AllConditions','checkConditions','AnyConditions','some','channel','field','account','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','message','event','agent','membername','lastevent','exports','lodash','url','mustache','./urlforward','./cmContact','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect'];(function(_0x5da0d4,_0x3b9dec){var _0x5f609c=function(_0x14e691){while(--_0x14e691){_0x5da0d4['push'](_0x5da0d4['shift']());}};_0x5f609c(++_0x3b9dec);}(_0x9ad7,0x19f));var _0x79ad=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x9ad7[_0x4b2863];return _0x567d67;};'use strict';var util=require('util');var _=require(_0x79ad('0x0'));var url=require(_0x79ad('0x1'));var Mustache=require(_0x79ad('0x2'));var Redis=require('ioredis');var urlforward=require(_0x79ad('0x3'));var integration=require('./integration');var cmContact=require(_0x79ad('0x4'));var script=require('./script');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x79ad('0x5'));var ami=require(_0x79ad('0x6'));config[_0x79ad('0x7')]=_[_0x79ad('0x8')](config[_0x79ad('0x7')],{'host':_0x79ad('0x9'),'port':0x18eb});var io=require(_0x79ad('0xa'))(new Redis(config['redis']));var operators={'equals':function(_0x22a107,_0x25bfa5){return _0x22a107==_0x25bfa5;},'not_equals':function(_0x49a86e,_0x5e6fb7){return _0x49a86e!=_0x5e6fb7;}};var barAndWebActions=[_0x79ad('0xb'),_0x79ad('0x1'),_0x79ad('0xc')];function Trigger(_0x5b7990){this[_0x79ad('0xd')]=_0x5b7990[_0x79ad('0xd')];this[_0x79ad('0xe')]=_0x5b7990['agents'];this['voiceQueues']=_0x5b7990[_0x79ad('0xf')];this[_0x79ad('0x10')]=_0x5b7990[_0x79ad('0x10')];this[_0x79ad('0x11')]=_0x5b7990['voiceExtensions'];this[_0x79ad('0x12')]=_0x5b7990[_0x79ad('0x12')];this['freshdeskAccounts']=_0x5b7990['freshdeskAccounts'];this[_0x79ad('0x13')]=_0x5b7990[_0x79ad('0x13')];this[_0x79ad('0x14')]=_0x5b7990['sugarcrmAccounts'];this[_0x79ad('0x15')]=_0x5b7990[_0x79ad('0x15')];this['deskAccounts']=_0x5b7990[_0x79ad('0x16')];this[_0x79ad('0x17')]=_0x5b7990[_0x79ad('0x17')];this[_0x79ad('0x18')]=_0x5b7990[_0x79ad('0x18')];this[_0x79ad('0x19')]=_0x5b7990[_0x79ad('0x19')];this[_0x79ad('0x1a')]=_0x5b7990[_0x79ad('0x1a')];this[_0x79ad('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x79ad('0x13')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x79ad('0x15')],'desk':this[_0x79ad('0x16')],'vtiger':this[_0x79ad('0x17')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x79ad('0x1a')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x1d'),this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x1f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x79ad('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x79ad('0x21'),this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));ami['on']('custom:agentnoanswer',this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x22'),this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x23'),this['syncCustomEvent'][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x24'),this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));ami['on']('custom:amd',this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x25'),this[_0x79ad('0x1e')]['bind'](this));ami['on'](_0x79ad('0x26'),this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));ami['on']('custom:dialbegin',this[_0x79ad('0x27')][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x28'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this['syncAgentDial']['bind'](this));ami['on'](_0x79ad('0x29'),this['syncCustomEvent'][_0x79ad('0x1c')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x2a'),this[_0x79ad('0x1e')]['bind'](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0x79ad('0x1c')](this));ami['on'](_0x79ad('0x2b'),this[_0x79ad('0x1e')][_0x79ad('0x1c')](this));}Trigger[_0x79ad('0x2c')][_0x79ad('0x2d')]=function(_0x438bec,_0x16ac2c,_0x2fd247){logger[_0x79ad('0x2e')](_0x438bec,_0x16ac2c,JSON[_0x79ad('0x2f')](_0x2fd247));io['to'](_0x438bec)['emit'](_0x16ac2c,_0x2fd247);};Trigger[_0x79ad('0x2c')][_0x79ad('0x1e')]=function(_0x1a7efa){var _0x10c5e5=_[_0x79ad('0x30')](_0x1a7efa);this[_0x79ad('0x31')](_0x10c5e5);};Trigger['prototype'][_0x79ad('0x27')]=function(_0x58f13a){if(this['agents'][_0x58f13a[_0x79ad('0x32')]]){this['syncCustomEvent'](_0x58f13a);}};Trigger['prototype']['checkTriggers']=function(_0x1984eb){var _0x14fd1f;for(var _0x60eabe in this['triggers']){if(this[_0x79ad('0xd')]['hasOwnProperty'](_0x60eabe)){if(this[_0x79ad('0xd')][_0x60eabe][_0x79ad('0x33')]){_0x14fd1f=this[_0x79ad('0x34')](this[_0x79ad('0xd')][_0x60eabe],_0x1984eb);if(_0x14fd1f){_[_0x79ad('0x35')](_0x1984eb,_0x1984eb[_0x79ad('0x36')]);for(var _0x150c99=0x0,_0x573aaa,_0x19055e,_0x3e2d9b;_0x150c990x0){_0x5b8fc7=_[_0xb1dc('0x2a')](_0x4bdefc,_0x54bdb3);}return _0x5b8fc7;}function getCustomFields(_0x3b7b9c,_0x28b6f7){var _0x5ecadb=[];var _0x1e9b1={'custom_fields':{}};if(_0x3b7b9c[_0xb1dc('0x29')]>0x0){_[_0xb1dc('0x2b')](_0x3b7b9c,function(_0x820c2c){if(_['includes'](['string',_0xb1dc('0x2c')],_0x820c2c[_0xb1dc('0x2d')])&&_0x820c2c[_0xb1dc('0x2e')]&&!_0x820c2c[_0xb1dc('0x2f')]){_0x1e9b1[_0x820c2c[_0xb1dc('0x2e')][_0xb1dc('0x30')]()]=_0x820c2c[_0xb1dc('0x31')]['toString']();}else if(_[_0xb1dc('0x32')]([_0xb1dc('0x33'),_0xb1dc('0x2c')],_0x820c2c[_0xb1dc('0x2d')])&&_0x820c2c[_0xb1dc('0x34')]&&_0x820c2c[_0xb1dc('0x2f')]){_0x1e9b1[_0xb1dc('0x35')][_0x820c2c[_0xb1dc('0x34')]]=_0x820c2c[_0xb1dc('0x31')]['toString']();}else if(_0x820c2c[_0xb1dc('0x2d')]===_0xb1dc('0x36')&&_0x820c2c['variableName']&&_0x820c2c[_0xb1dc('0x34')]&&_0x820c2c[_0xb1dc('0x2f')]){_0x28b6f7[_0x820c2c[_0xb1dc('0x37')]]&&(_0x1e9b1[_0xb1dc('0x35')][_0x820c2c['idField']]=_0x28b6f7[_0x820c2c['variableName']][_0xb1dc('0x23')]());}else if(_0x820c2c[_0xb1dc('0x2d')]===_0xb1dc('0x38')&&_0x820c2c['Variable']&&_0x820c2c[_0xb1dc('0x39')][_0xb1dc('0x3a')]&&_0x820c2c[_0xb1dc('0x34')]&&_0x820c2c[_0xb1dc('0x2f')]){_0x28b6f7[_0x820c2c[_0xb1dc('0x39')][_0xb1dc('0x3a')][_0xb1dc('0x30')]()]&&(_0x1e9b1[_0xb1dc('0x35')][_0x820c2c[_0xb1dc('0x34')]]=_0x28b6f7[_0x820c2c[_0xb1dc('0x39')][_0xb1dc('0x3a')][_0xb1dc('0x30')]()][_0xb1dc('0x23')]());}});}if(_0x1e9b1[_0xb1dc('0x3b')]){_0x1e9b1[_0xb1dc('0x3b')]=Number(_0x1e9b1[_0xb1dc('0x3b')]);}return _0x1e9b1;}function getTicket(_0x13f902,_0x4cad35,_0x4dd202,_0x3c263a,_0x49774a){logger['info'](_0xb1dc('0x3c'));var _0x46392c=_['merge']({'subject':intUtil[_0xb1dc('0x3d')](_0x3c263a['Subjects'],_0x49774a,'\x20'),'type':_0xb1dc('0x3e'),'status':_0xb1dc('0x3f'),'labels':[_0xb1dc('0x40'),_0xb1dc('0x41'),_0xb1dc('0x42')][_0xb1dc('0x43')](getTags(_0x3c263a[_0xb1dc('0x44')],_0xb1dc('0x3a'))),'description':intUtil[_0xb1dc('0x3d')](_0x3c263a['Descriptions'],_0x49774a,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xb1dc('0x45'),_0x4cad35['id']),'class':_0xb1dc('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0x3c263a[_0xb1dc('0x47')],_0x49774a,'\x0a')}},getCustomFields(_0x3c263a['Fields'],_0x49774a));return request({'uri':util[_0xb1dc('0x10')](_0xb1dc('0x48'),_0x13f902['remoteUri'],_0x4dd202['id']),'method':_0xb1dc('0x28'),'body':_0x46392c});}exports['queue']=function(_0x2801b8,_0x459f4f,_0x45c90d,_0x2ba067,_0x3d28db,_0x452e18){var _0x313a84,_0x557dee;_0x452e18[_0xb1dc('0x11')]=intUtil[_0xb1dc('0x49')](_0x452e18[_0xb1dc('0x11')]);_0x452e18[_0xb1dc('0x4a')]=intUtil['stripTrailingSlash'](_0x452e18['serverUrl']);if(_0x3d28db&&_0x3d28db[_0xb1dc('0x4b')]){logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x4d'));_0x459f4f[_0xb1dc('0x4e')]=util[_0xb1dc('0x10')](_0xb1dc('0x4f'),_0x452e18['serverUrl'],_0x459f4f['uniqueid'],md5(_0x459f4f[_0xb1dc('0x50')]));}else{_0x459f4f['recordingURL']='';}headers['Authorization']=getAuth(_0x452e18);return getUser(_0x452e18,_0x2ba067[_0xb1dc('0x51')])[_0xb1dc('0x12')](function(_0x385eaa){_0x313a84=_0x385eaa;logger[_0xb1dc('0xe')]('The\x20User\x20ID\x20is:',_0x313a84['id']);return getEndUser(_0x452e18,_0x459f4f['calleridname'],_0x459f4f[_0xb1dc('0x52')]);})['then'](function(_0xf1c5f7){_0x557dee=_0xf1c5f7;logger[_0xb1dc('0xe')](_0xb1dc('0x53'),_0x557dee['id']);return getTicket(_0x452e18,_0x313a84,_0x557dee,_0x45c90d,_0x459f4f);})[_0xb1dc('0x12')](function(_0x30d56f){if(_0x30d56f){logger[_0xb1dc('0xe')](_0xb1dc('0x54'));logger[_0xb1dc('0xe')](_0xb1dc('0x55'),_0x30d56f['id']);switch(_0x452e18[_0xb1dc('0x2d')]){case _0xb1dc('0x56'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x57'));emit(util[_0xb1dc('0x10')]('user:%s',_0x2ba067[_0xb1dc('0x3a')]),_0xb1dc('0x58'),{'recordId':_0x30d56f['id']});break;case _0xb1dc('0x59'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x5a'));emit(util[_0xb1dc('0x10')](_0xb1dc('0x5b'),_0x2ba067[_0xb1dc('0x3a')]),'trigger:browser:url',{'uri':util[_0xb1dc('0x10')]('https://xcally.desk.com/web/agent/case/%d',_0x30d56f['id'])});break;default:logger[_0xb1dc('0x5c')](_0xb1dc('0x4c'),_0xb1dc('0x5d'));}}})[_0xb1dc('0x5e')](function(_0x1b32c6){console[_0xb1dc('0x5c')](_0x1b32c6);logger['error'](_0xb1dc('0x4c'),JSON[_0xb1dc('0x5f')](_0x1b32c6));});};exports[_0xb1dc('0x60')]=function(_0x4d6b91,_0x39cba2,_0x44c06f,_0x2c876b,_0x5085c4,_0x455d12,_0x3404aa){var _0x2be5d4,_0x1fa127;_0x455d12[_0xb1dc('0x11')]=intUtil[_0xb1dc('0x49')](_0x455d12[_0xb1dc('0x11')]);_0x455d12[_0xb1dc('0x4a')]=intUtil[_0xb1dc('0x49')](_0x455d12[_0xb1dc('0x4a')]);if(_0x3404aa&&_0x3404aa[_0xb1dc('0x61')]&&_0x3404aa[_0xb1dc('0x61')]!=='none'){logger['info'](_0xb1dc('0x62'),_0xb1dc('0x4d'));_0x39cba2['recordingURL']=util[_0xb1dc('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x455d12[_0xb1dc('0x4a')],_0x39cba2[_0xb1dc('0x50')],md5(_0x39cba2['uniqueid']));}headers[_0xb1dc('0x63')]=getAuth(_0x455d12);return getUser(_0x455d12,_0x2c876b[_0xb1dc('0x51')])['then'](function(_0x39813b){_0x2be5d4=_0x39813b;logger[_0xb1dc('0xe')]('The\x20User\x20ID\x20is:',_0x2be5d4['id']);return getEndUser(_0x455d12,_0x39cba2[_0xb1dc('0x64')],_0x39cba2[_0xb1dc('0x65')]);})['then'](function(_0x2ef21d){_0x1fa127=_0x2ef21d;logger[_0xb1dc('0xe')](_0xb1dc('0x53'),_0x1fa127['id']);return getTicket(_0x455d12,_0x2be5d4,_0x1fa127,_0x44c06f,_0x39cba2);})['then'](function(_0x803524){if(_0x803524){logger[_0xb1dc('0xe')](_0xb1dc('0x54'));logger[_0xb1dc('0xe')](_0xb1dc('0x55'),_0x803524['id']);switch(_0x455d12[_0xb1dc('0x2d')]){case _0xb1dc('0x56'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x57'));emit(util[_0xb1dc('0x10')]('user:%s',_0x2c876b[_0xb1dc('0x3a')]),'trigger:desk:display',{'recordId':_0x803524['id']});break;case _0xb1dc('0x59'):logger[_0xb1dc('0xe')](_0xb1dc('0x4c'),_0xb1dc('0x5a'));emit(util[_0xb1dc('0x10')](_0xb1dc('0x5b'),_0x2c876b['name']),_0xb1dc('0x66'),{'uri':util[_0xb1dc('0x10')](_0xb1dc('0x67'),_0x455d12[_0xb1dc('0x11')],_0x803524['id'])});break;default:logger[_0xb1dc('0x5c')](_0xb1dc('0x62'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb1dc('0x5e')](function(_0x3e8846){logger[_0xb1dc('0x5c')]('[OUTBOUND]',JSON[_0xb1dc('0x5f')](_0x3e8846));});};exports[_0xb1dc('0x68')]=function(_0x2bb8f0,_0x498b10,_0x507cd8,_0x1a2fb8,_0x4c7f08,_0x48dcf3){var _0x3436b9,_0x4bd237;_0x48dcf3['remoteUri']=intUtil[_0xb1dc('0x49')](_0x48dcf3['remoteUri']);_0x48dcf3['serverUrl']=intUtil['stripTrailingSlash'](_0x48dcf3['serverUrl']);if(_0x4c7f08&&_0x4c7f08[_0xb1dc('0x4b')]){logger[_0xb1dc('0xe')]('['+_0x498b10[_0xb1dc('0x69')][_0xb1dc('0x6a')]()+']',_0xb1dc('0x4d'));_0x498b10[_0xb1dc('0x4e')]=util[_0xb1dc('0x10')](_0xb1dc('0x4f'),_0x48dcf3['serverUrl'],_0x498b10[_0xb1dc('0x50')],md5(_0x498b10[_0xb1dc('0x50')]));}else{_0x498b10[_0xb1dc('0x4e')]='';}headers[_0xb1dc('0x63')]=getAuth(_0x48dcf3);return getUser(_0x48dcf3)[_0xb1dc('0x12')](function(_0x4192d4){_0x3436b9=_0x4192d4;logger['info']('The\x20User\x20ID\x20is:',_0x3436b9['id']);return getEndUser(_0x48dcf3,_0x498b10[_0xb1dc('0x6b')],_0x498b10[_0xb1dc('0x52')]);})[_0xb1dc('0x12')](function(_0x82e17a){_0x4bd237=_0x82e17a;logger['info'](_0xb1dc('0x53'),_0x4bd237['id']);return getTicket(_0x48dcf3,_0x3436b9,_0x4bd237,_0x507cd8,_0x498b10);})[_0xb1dc('0x12')](function(_0x30ffb4){if(_0x30ffb4){logger[_0xb1dc('0xe')](_0xb1dc('0x54'));logger[_0xb1dc('0xe')](_0xb1dc('0x55'),_0x30ffb4['id']);}})[_0xb1dc('0x5e')](function(_0x13591f){logger['error']('['+_0x498b10[_0xb1dc('0x69')][_0xb1dc('0x6a')]()+']',JSON[_0xb1dc('0x5f')](_0x13591f));});}; \ No newline at end of file +var _0x59f7=['%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','GET','authType','basic','username','password','token','Basic\x20%s','base64','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','length','forEach','string','picklist','type','nameField','toLowerCase','content','toString','includes','idField','customField','custom_fields','variable','variableName','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','Motion','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum'];(function(_0x4f2e0f,_0x47bed2){var _0x5e7522=function(_0x2811ad){while(--_0x2811ad){_0x4f2e0f['push'](_0x4f2e0f['shift']());}};_0x5e7522(++_0x47bed2);}(_0x59f7,0xe4));var _0x759f=function(_0x528c30,_0x12256a){_0x528c30=_0x528c30-0x0;var _0x5ebc24=_0x59f7[_0x528c30];return _0x5ebc24;};'use strict';var _=require(_0x759f('0x0'));var rp=require('request-promise');var md5=require(_0x759f('0x1'));var util=require(_0x759f('0x2'));var Redis=require(_0x759f('0x3'));var intUtil=require(_0x759f('0x4'));var config=require('../../../../config/environment');var logger=require(_0x759f('0x5'))(_0x759f('0x6'));config['redis']=_[_0x759f('0x7')](config[_0x759f('0x8')],{'host':_0x759f('0x9'),'port':0x18eb});var io=require(_0x759f('0xa'))(new Redis(config[_0x759f('0x8')]));function emit(_0x25b0a3,_0x2ee0d4,_0x1af660){io['to'](_0x25b0a3)[_0x759f('0xb')](_0x2ee0d4,_0x1af660);}var headers={'Content-Type':_0x759f('0xc'),'Accept':_0x759f('0xc')};function getUser(_0x9dd65b,_0xd4adc1){if(intUtil[_0x759f('0xd')](_0xd4adc1)===!![]){logger[_0x759f('0xe')](_0x759f('0xf'),_0xd4adc1);return request({'uri':util[_0x759f('0x10')]('%s/users',_0x9dd65b[_0x759f('0x11')])})[_0x759f('0x12')](function(_0x39f85d){if(_0x39f85d[_0x759f('0x13')]){return _[_0x759f('0x14')](_0x39f85d[_0x759f('0x15')]['entries'],{'email':_0xd4adc1});}})[_0x759f('0x12')](function(_0x2a6f62){if(_0x2a6f62){logger[_0x759f('0xe')](_0x759f('0x16'));return _0x2a6f62;}else{logger['info'](_0x759f('0x17'));return request({'uri':util[_0x759f('0x10')]('%s/users/me',_0x9dd65b[_0x759f('0x11')])});}});}else{logger['info'](_0x759f('0x18'));return request({'uri':util['format'](_0x759f('0x19'),_0x9dd65b[_0x759f('0x11')])});}}function request(_0x29a430){logger[_0x759f('0x1a')](_0x759f('0x1b'),JSON['stringify'](_0x29a430));return rp(_[_0x759f('0x7')](_0x29a430,{'method':_0x759f('0x1c'),'headers':headers,'json':!![]}));}function getAuth(_0x4e2a72){var _0x15d11f;if(_0x4e2a72[_0x759f('0x1d')]===_0x759f('0x1e')){_0x15d11f=util['format']('%s:%s',_0x4e2a72[_0x759f('0x1f')],_0x4e2a72[_0x759f('0x20')]);}else if(_0x4e2a72['authType']==='token'){_0x15d11f=util['format']('%s/token:%s',_0x4e2a72[_0x759f('0x1f')],_0x4e2a72[_0x759f('0x21')]);}return util[_0x759f('0x10')](_0x759f('0x22'),new Buffer(_0x15d11f)['toString'](_0x759f('0x23')));}function getEndUser(_0x3b8438,_0x1db05f,_0x1f992e){logger['info']('Searching\x20enduser\x20with\x20phone',_0x1f992e);return request({'uri':util['format'](_0x759f('0x24'),_0x3b8438['remoteUri']),'qs':{'phone':_0x1f992e}})[_0x759f('0x12')](function(_0x5ae7fa){if(_0x5ae7fa[_0x759f('0x13')]){logger[_0x759f('0xe')](_0x759f('0x25'));return _0x5ae7fa['_embedded']['entries'][0x0];}else{logger[_0x759f('0xe')](_0x759f('0x26'));return request({'uri':util[_0x759f('0x10')](_0x759f('0x27'),_0x3b8438[_0x759f('0x11')]),'method':_0x759f('0x28'),'body':{'first_name':_0x1db05f,'title':_0x1db05f,'phone_numbers':[{'type':_0x759f('0x29'),'value':_0x1f992e}]}});}});}function getTags(_0x5635bc,_0x3e166d){var _0x2a47d8=[];if(_0x5635bc&&_0x5635bc[_0x759f('0x2a')]>0x0){_0x2a47d8=_['map'](_0x5635bc,_0x3e166d);}return _0x2a47d8;}function getCustomFields(_0x4af4d4,_0x68d012){var _0x297500=[];var _0x2f4d33={'custom_fields':{}};if(_0x4af4d4['length']>0x0){_[_0x759f('0x2b')](_0x4af4d4,function(_0x550956){if(_['includes']([_0x759f('0x2c'),_0x759f('0x2d')],_0x550956[_0x759f('0x2e')])&&_0x550956[_0x759f('0x2f')]&&!_0x550956['customField']){_0x2f4d33[_0x550956['nameField'][_0x759f('0x30')]()]=_0x550956[_0x759f('0x31')][_0x759f('0x32')]();}else if(_[_0x759f('0x33')]([_0x759f('0x2c'),_0x759f('0x2d')],_0x550956['type'])&&_0x550956[_0x759f('0x34')]&&_0x550956[_0x759f('0x35')]){_0x2f4d33[_0x759f('0x36')][_0x550956['idField']]=_0x550956[_0x759f('0x31')][_0x759f('0x32')]();}else if(_0x550956[_0x759f('0x2e')]===_0x759f('0x37')&&_0x550956[_0x759f('0x38')]&&_0x550956['idField']&&_0x550956[_0x759f('0x35')]){_0x68d012[_0x550956[_0x759f('0x38')]]&&(_0x2f4d33[_0x759f('0x36')][_0x550956['idField']]=_0x68d012[_0x550956[_0x759f('0x38')]]['toString']());}else if(_0x550956['type']==='customVariable'&&_0x550956[_0x759f('0x39')]&&_0x550956[_0x759f('0x39')][_0x759f('0x3a')]&&_0x550956[_0x759f('0x34')]&&_0x550956[_0x759f('0x35')]){_0x68d012[_0x550956[_0x759f('0x39')]['name'][_0x759f('0x30')]()]&&(_0x2f4d33['custom_fields'][_0x550956[_0x759f('0x34')]]=_0x68d012[_0x550956[_0x759f('0x39')][_0x759f('0x3a')][_0x759f('0x30')]()][_0x759f('0x32')]());}});}if(_0x2f4d33[_0x759f('0x3b')]){_0x2f4d33[_0x759f('0x3b')]=Number(_0x2f4d33[_0x759f('0x3b')]);}return _0x2f4d33;}function getTicket(_0x36449b,_0x20e0e3,_0x3613ad,_0x455361,_0x3d49c0){logger[_0x759f('0xe')](_0x759f('0x3c'));var _0x2df80d=_[_0x759f('0x3d')]({'subject':intUtil[_0x759f('0x3e')](_0x455361[_0x759f('0x3f')],_0x3d49c0,'\x20'),'type':_0x759f('0x40'),'status':_0x759f('0x41'),'labels':['xCALLY',_0x759f('0x42'),_0x759f('0x43')][_0x759f('0x44')](getTags(_0x455361[_0x759f('0x45')],_0x759f('0x3a'))),'description':intUtil[_0x759f('0x3e')](_0x455361[_0x759f('0x46')],_0x3d49c0,'\x0a'),'_links':{'assigned_user':{'href':util[_0x759f('0x10')](_0x759f('0x47'),_0x20e0e3['id']),'class':_0x759f('0x48')}},'message':{'direction':'in','body':intUtil[_0x759f('0x3e')](_0x455361[_0x759f('0x46')],_0x3d49c0,'\x0a')}},getCustomFields(_0x455361[_0x759f('0x49')],_0x3d49c0));return request({'uri':util[_0x759f('0x10')](_0x759f('0x4a'),_0x36449b[_0x759f('0x11')],_0x3613ad['id']),'method':_0x759f('0x28'),'body':_0x2df80d});}exports[_0x759f('0x4b')]=function(_0x1906ef,_0x5af624,_0x248084,_0x1baff7,_0x501ec5,_0x3b2fb4){var _0x2daa26,_0xfbbea4;_0x3b2fb4[_0x759f('0x11')]=intUtil[_0x759f('0x4c')](_0x3b2fb4['remoteUri']);_0x3b2fb4[_0x759f('0x4d')]=intUtil[_0x759f('0x4c')](_0x3b2fb4[_0x759f('0x4d')]);if(_0x501ec5&&_0x501ec5[_0x759f('0x4e')]){logger[_0x759f('0xe')](_0x759f('0x4f'),'Recording\x20is\x20enabled!');_0x5af624[_0x759f('0x50')]=util[_0x759f('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b2fb4['serverUrl'],_0x5af624[_0x759f('0x51')],md5(_0x5af624['uniqueid']));}else{_0x5af624[_0x759f('0x50')]='';}headers[_0x759f('0x52')]=getAuth(_0x3b2fb4);return getUser(_0x3b2fb4,_0x1baff7[_0x759f('0x53')])[_0x759f('0x12')](function(_0x5b3b20){_0x2daa26=_0x5b3b20;logger[_0x759f('0xe')](_0x759f('0x54'),_0x2daa26['id']);return getEndUser(_0x3b2fb4,_0x5af624[_0x759f('0x55')],_0x5af624[_0x759f('0x56')]);})['then'](function(_0xf65fff){_0xfbbea4=_0xf65fff;logger[_0x759f('0xe')](_0x759f('0x57'),_0xfbbea4['id']);return getTicket(_0x3b2fb4,_0x2daa26,_0xfbbea4,_0x248084,_0x5af624);})[_0x759f('0x12')](function(_0x4e192b){if(_0x4e192b){logger[_0x759f('0xe')](_0x759f('0x58'));logger[_0x759f('0xe')](_0x759f('0x59'),_0x4e192b['id']);switch(_0x3b2fb4[_0x759f('0x2e')]){case _0x759f('0x5a'):logger[_0x759f('0xe')](_0x759f('0x4f'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x759f('0x10')]('user:%s',_0x1baff7['name']),_0x759f('0x5b'),{'recordId':_0x4e192b['id']});break;case _0x759f('0x5c'):logger['info'](_0x759f('0x4f'),_0x759f('0x5d'));emit(util[_0x759f('0x10')](_0x759f('0x5e'),_0x1baff7[_0x759f('0x3a')]),_0x759f('0x5f'),{'uri':util['format'](_0x759f('0x60'),_0x4e192b['id'])});break;default:logger[_0x759f('0x61')](_0x759f('0x4f'),_0x759f('0x62'));}}})[_0x759f('0x63')](function(_0x515a46){console[_0x759f('0x61')](_0x515a46);logger[_0x759f('0x61')](_0x759f('0x4f'),JSON[_0x759f('0x64')](_0x515a46));});};exports[_0x759f('0x65')]=function(_0x24d70a,_0x26116b,_0x37cc3d,_0x588829,_0x2faa5d,_0x39408f,_0x66c02c){var _0x3b83e4,_0x5ed59d;_0x39408f[_0x759f('0x11')]=intUtil[_0x759f('0x4c')](_0x39408f[_0x759f('0x11')]);_0x39408f[_0x759f('0x4d')]=intUtil['stripTrailingSlash'](_0x39408f[_0x759f('0x4d')]);if(_0x66c02c&&_0x66c02c[_0x759f('0x66')]&&_0x66c02c[_0x759f('0x66')]!=='none'){logger[_0x759f('0xe')](_0x759f('0x67'),_0x759f('0x68'));_0x26116b[_0x759f('0x50')]=util[_0x759f('0x10')](_0x759f('0x69'),_0x39408f[_0x759f('0x4d')],_0x26116b[_0x759f('0x51')],md5(_0x26116b[_0x759f('0x51')]));}headers[_0x759f('0x52')]=getAuth(_0x39408f);return getUser(_0x39408f,_0x588829[_0x759f('0x53')])[_0x759f('0x12')](function(_0x4567b5){_0x3b83e4=_0x4567b5;logger[_0x759f('0xe')](_0x759f('0x54'),_0x3b83e4['id']);return getEndUser(_0x39408f,_0x26116b[_0x759f('0x6a')],_0x26116b[_0x759f('0x6b')]);})[_0x759f('0x12')](function(_0x31e409){_0x5ed59d=_0x31e409;logger['info'](_0x759f('0x57'),_0x5ed59d['id']);return getTicket(_0x39408f,_0x3b83e4,_0x5ed59d,_0x37cc3d,_0x26116b);})[_0x759f('0x12')](function(_0x5a70da){if(_0x5a70da){logger[_0x759f('0xe')](_0x759f('0x58'));logger[_0x759f('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5a70da['id']);switch(_0x39408f[_0x759f('0x2e')]){case _0x759f('0x5a'):logger[_0x759f('0xe')](_0x759f('0x4f'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x759f('0x10')](_0x759f('0x5e'),_0x588829[_0x759f('0x3a')]),_0x759f('0x5b'),{'recordId':_0x5a70da['id']});break;case'newTab':logger['info']('[QUEUE]',_0x759f('0x5d'));emit(util[_0x759f('0x10')]('user:%s',_0x588829[_0x759f('0x3a')]),'trigger:browser:url',{'uri':util[_0x759f('0x10')](_0x759f('0x6c'),_0x39408f[_0x759f('0x11')],_0x5a70da['id'])});break;default:logger['error'](_0x759f('0x67'),_0x759f('0x62'));}}})[_0x759f('0x63')](function(_0xc52757){logger['error'](_0x759f('0x67'),JSON[_0x759f('0x64')](_0xc52757));});};exports[_0x759f('0x6d')]=function(_0x45ec7e,_0x5d277b,_0x835770,_0x102108,_0xcbcdc1,_0xc37ab8){var _0x1bdd5b,_0xe445b1;_0xc37ab8[_0x759f('0x11')]=intUtil['stripTrailingSlash'](_0xc37ab8['remoteUri']);_0xc37ab8[_0x759f('0x4d')]=intUtil[_0x759f('0x4c')](_0xc37ab8[_0x759f('0x4d')]);if(_0xcbcdc1&&_0xcbcdc1[_0x759f('0x4e')]){logger[_0x759f('0xe')]('['+_0x5d277b[_0x759f('0x6e')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5d277b[_0x759f('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc37ab8['serverUrl'],_0x5d277b['uniqueid'],md5(_0x5d277b[_0x759f('0x51')]));}else{_0x5d277b[_0x759f('0x50')]='';}headers['Authorization']=getAuth(_0xc37ab8);return getUser(_0xc37ab8)[_0x759f('0x12')](function(_0x11ee5e){_0x1bdd5b=_0x11ee5e;logger[_0x759f('0xe')](_0x759f('0x54'),_0x1bdd5b['id']);return getEndUser(_0xc37ab8,_0x5d277b[_0x759f('0x55')],_0x5d277b[_0x759f('0x56')]);})[_0x759f('0x12')](function(_0x5b2450){_0xe445b1=_0x5b2450;logger['info'](_0x759f('0x57'),_0xe445b1['id']);return getTicket(_0xc37ab8,_0x1bdd5b,_0xe445b1,_0x835770,_0x5d277b);})['then'](function(_0x4833b5){if(_0x4833b5){logger[_0x759f('0xe')](_0x759f('0x58'));logger[_0x759f('0xe')](_0x759f('0x59'),_0x4833b5['id']);}})[_0x759f('0x63')](function(_0x3a7d10){logger[_0x759f('0x61')]('['+_0x5d277b[_0x759f('0x6e')][_0x759f('0x6f')]()+']',JSON[_0x759f('0x64')](_0x3a7d10));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 0c21c54..cb347d9 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba18=['password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','value','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','type','nameField','customField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/systemusers(','Fields','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri'];(function(_0x4719ec,_0x321779){var _0x48e0da=function(_0x452d68){while(--_0x452d68){_0x4719ec['push'](_0x4719ec['shift']());}};_0x48e0da(++_0x321779);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var BPromise=require(_0x8ba1('0x1'));var rp=require(_0x8ba1('0x2'));var util=require(_0x8ba1('0x3'));var intUtil=require(_0x8ba1('0x4'));var md5=require(_0x8ba1('0x5'));var Redis=require(_0x8ba1('0x6'));var logger=require(_0x8ba1('0x7'))('dynamics365');var config=require(_0x8ba1('0x8'));config[_0x8ba1('0x9')]=_[_0x8ba1('0xa')](config[_0x8ba1('0x9')],{'host':_0x8ba1('0xb'),'port':0x18eb});var io=require(_0x8ba1('0xc'))(new Redis(config['redis']));function getAuthToken(_0x3a87eb,_0x3d1fe7,_0x4dc6c4){var _0x49709e={'method':'POST','uri':_0x3d1fe7,'form':{'client_id':_0x3a87eb[_0x8ba1('0xd')],'resource':_0x3a87eb[_0x8ba1('0xe')],'username':_0x3a87eb['username'],'password':_0x3a87eb[_0x8ba1('0xf')],'grant_type':_0x8ba1('0xf'),'client_secret':_0x3a87eb[_0x8ba1('0x10')]},'json':!![]};return rp(_0x49709e)[_0x8ba1('0x11')](function(_0x447ac0){return _0x447ac0['access_token'];})[_0x8ba1('0x12')](function(_0x2bad04){logger[_0x8ba1('0x13')]('['+[_0x4dc6c4[_0x8ba1('0x14')]()]+_0x8ba1('0x15'));return _0x2bad04[_0x8ba1('0x16')];});}function getUser(_0x58e32b,_0x108541,_0x44a40a,_0x2e81d1,_0xca53c4,_0x4c8d5c){return new BPromise(function(_0x53a141,_0x5c04b7){return getAuthToken(_0x108541,_0x2e81d1,_0x4c8d5c)[_0x8ba1('0x11')](function(_0x398f40){var _0x5a3a8a={'method':_0x8ba1('0x17'),'uri':_0xca53c4+_0x8ba1('0x18'),'headers':{'Authorization':_0x8ba1('0x19')+_0x398f40,'OData-Version':_0x8ba1('0x1a')},'json':!![]};return rp(_0x5a3a8a);})[_0x8ba1('0x11')](function(_0x19ade9){var _0x245929=_0x19ade9['value'];var _0x4c6325=![];var _0x1a48fa=null;if(!_[_0x8ba1('0x1b')](_0x44a40a)){if(intUtil['validateEmail'](_0x44a40a[_0x8ba1('0x1c')])){_0x58e32b[_0x8ba1('0x1d')]=_0x44a40a[_0x8ba1('0x1c')];for(_0x1a48fa=0x0;_0x1a48fa<_0x245929[_0x8ba1('0x1e')];_0x1a48fa++){if(_0x245929[_0x1a48fa][_0x8ba1('0x1f')]===_0x44a40a[_0x8ba1('0x1c')]&&!_0x245929[_0x1a48fa]['isdisabled']){_0x4c6325=!![];logger[_0x8ba1('0x20')]('['+[_0x4c8d5c['toUpperCase']()]+_0x8ba1('0x21')+_0x245929[_0x1a48fa][_0x8ba1('0x22')]+'!');_0x58e32b[_0x8ba1('0x23')]=_0x245929[_0x1a48fa][_0x8ba1('0x22')];}}}}if(!_0x4c6325){logger['info']('['+[_0x4c8d5c[_0x8ba1('0x14')]()]+_0x8ba1('0x24'));_0x58e32b[_0x8ba1('0x1d')]=_0x108541[_0x8ba1('0x25')];for(_0x1a48fa=0x0;_0x1a48fa<_0x245929[_0x8ba1('0x1e')];_0x1a48fa++){if(_0x245929[_0x1a48fa][_0x8ba1('0x1f')]===_0x108541[_0x8ba1('0x25')]){_0x58e32b[_0x8ba1('0x23')]=_0x245929[_0x1a48fa][_0x8ba1('0x22')];}}}_0x53a141(_0x58e32b);})[_0x8ba1('0x12')](function(_0x3b205c){_0x5c04b7(_0x3b205c['message']);});});}function createEndUser(_0x5c924e,_0x41c2bb,_0x1ccd44,_0x56aef2,_0x2baa80,_0xef508d){return new BPromise(function(_0x2b1f46,_0x326460){return getAuthToken(_0x41c2bb,_0x1ccd44,_0xef508d)[_0x8ba1('0x11')](function(_0x8d8220){var _0x2acf1c=_0xef508d[_0x8ba1('0x26')]()===_0x8ba1('0x27')?_0x2baa80[_0x8ba1('0x28')]:_0x2baa80[_0x8ba1('0x29')];var _0x136eef={'method':_0x8ba1('0x2a'),'uri':_0x56aef2+_0x8ba1('0x2b'),'body':{'telephone1':_0x2acf1c,'fullname':_0x2acf1c,'firstname':_0x2acf1c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5c924e[_0x8ba1('0x23')]+')'},'headers':{'Authorization':_0x8ba1('0x19')+_0x8d8220,'OData-Version':_0x8ba1('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x136eef);})[_0x8ba1('0x11')](function(_0x243a0a){var _0x24bf95=_0x243a0a['headers'][_0x8ba1('0x2c')];var _0x2af152=_0x24bf95['substring'](_0x24bf95[_0x8ba1('0x2d')]('(')+0x1,_0x24bf95['lastIndexOf'](')'));_0x5c924e[_0x8ba1('0x2e')]=_0x2af152;_0x2b1f46(_0x5c924e);})[_0x8ba1('0x12')](function(_0x53e668){_0x326460(_0x53e668[_0x8ba1('0x16')]);});});}function getEndUser(_0x40b97c,_0x2de2e4,_0x3da8d4,_0x1376e8,_0x58d923,_0x26d845){return new BPromise(function(_0x174528,_0x14ee0c){return getAuthToken(_0x2de2e4,_0x3da8d4,_0x26d845)[_0x8ba1('0x11')](function(_0x2313e8){var _0x2abd37={'method':_0x8ba1('0x17'),'uri':_0x1376e8+_0x8ba1('0x2f'),'headers':{'Authorization':'Bearer\x20'+_0x2313e8,'If-None-Match':null,'OData-Version':_0x8ba1('0x1a')},'json':!![]};return rp(_0x2abd37);})[_0x8ba1('0x11')](function(_0x2a8f04){var _0x1e6093=null;if(_0x2a8f04){var _0x43fa60=_0x2a8f04[_0x8ba1('0x30')];var _0x215656=![];for(_0x1e6093=0x0;_0x1e6093<_0x43fa60[_0x8ba1('0x1e')];_0x1e6093++){var _0x6117aa=_0x26d845[_0x8ba1('0x26')]()==='outbound'?_0x58d923[_0x8ba1('0x28')]:_0x58d923[_0x8ba1('0x29')];if(_0x43fa60[_0x1e6093][_0x8ba1('0x31')]===_0x6117aa){_0x215656=!![];_0x40b97c[_0x8ba1('0x2e')]=_0x43fa60[_0x1e6093][_0x8ba1('0x32')];}}if(_0x215656){_0x174528(_0x40b97c);}else{return createEndUser(_0x40b97c,_0x2de2e4,_0x3da8d4,_0x1376e8,_0x58d923,_0x26d845)[_0x8ba1('0x11')](function(_0x3034aa){logger[_0x8ba1('0x20')]('['+[_0x26d845[_0x8ba1('0x14')]()]+_0x8ba1('0x33'),_0x3034aa['enduserId']);_0x174528(_0x3034aa);});}}else{return createEndUser(_0x40b97c,_0x2de2e4,_0x3da8d4,_0x1376e8,_0x58d923,_0x26d845)['then'](function(_0x11ce52){logger[_0x8ba1('0x20')]('['+[_0x26d845[_0x8ba1('0x14')]()]+_0x8ba1('0x34'),_0x11ce52[_0x8ba1('0x2e')]);_0x174528(_0x11ce52);});}});});}function getCustomFields(_0xa65f6d,_0x414412,_0x64bf9e){var _0x2506f0={};if(_0xa65f6d[_0x8ba1('0x1e')]>0x0){_[_0x8ba1('0x35')](_0xa65f6d,function(_0xb653bf){if(_[_0x8ba1('0x36')]([_0x8ba1('0x37'),'picklist'],_0xb653bf[_0x8ba1('0x38')])&&_0xb653bf[_0x8ba1('0x39')]&&!_0xb653bf[_0x8ba1('0x3a')]){var _0x1fc16a=_0xb653bf['idField']['toLowerCase']();var _0x2ac7bc=_0x1fc16a[_0x8ba1('0x3b')](0x0,_0x1fc16a[_0x8ba1('0x3c')]('_'));var _0x3430d4=_0x1fc16a[_0x8ba1('0x3b')](_0x1fc16a['indexOf']('_')+0x1);if(_0x2ac7bc===_0x64bf9e){_0x2506f0[_0x3430d4]=_0xb653bf[_0x8ba1('0x3d')];}}});}return _0x2506f0;}function getTicket(_0x171054,_0x16bdb1,_0x5b02d8,_0x1e5376,_0x4374db,_0x3ab683,_0x30109d){return new BPromise(function(_0x34b0c3,_0x3bb4dc){var _0x523c1b;return getAuthToken(_0x16bdb1,_0x5b02d8,_0x30109d)[_0x8ba1('0x11')](function(_0x4d1ba2){if(_0x3ab683[_0x8ba1('0x3e')]===_0x8ba1('0x3f')){_0x523c1b={'method':_0x8ba1('0x2a'),'uri':_0x1e5376+_0x8ba1('0x40'),'body':Object[_0x8ba1('0x41')]({},{'title':intUtil[_0x8ba1('0x42')](_0x3ab683['Subjects'],_0x4374db,'\x20'),'description':intUtil[_0x8ba1('0x42')](_0x3ab683[_0x8ba1('0x43')],_0x4374db,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x171054['enduserId']+')','ownerid@odata.bind':_0x8ba1('0x44')+_0x171054[_0x8ba1('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x3ab683[_0x8ba1('0x45')],_0x4374db,_0x3ab683[_0x8ba1('0x3e')])),'headers':{'Authorization':_0x8ba1('0x19')+_0x4d1ba2,'OData-Version':_0x8ba1('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3ab683[_0x8ba1('0x3e')]===_0x8ba1('0x46')){_0x523c1b={'method':_0x8ba1('0x2a'),'uri':_0x1e5376+_0x8ba1('0x47'),'body':Object[_0x8ba1('0x41')]({},{'subject':intUtil[_0x8ba1('0x42')](_0x3ab683[_0x8ba1('0x48')],_0x4374db,'\x20'),'phonenumber':String(_0x4374db['calleridnum']),'description':intUtil[_0x8ba1('0x42')](_0x3ab683[_0x8ba1('0x43')],_0x4374db,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8ba1('0x49')+_0x171054[_0x8ba1('0x2e')]+')','ownerid@odata.bind':_0x8ba1('0x44')+_0x171054[_0x8ba1('0x23')]+')','directioncode':_0x171054[_0x8ba1('0x4a')]===_0x8ba1('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8ba1('0x44')+_0x171054[_0x8ba1('0x23')]+')','participationtypemask':_0x171054[_0x8ba1('0x4a')]===_0x8ba1('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x8ba1('0x49')+_0x171054[_0x8ba1('0x2e')]+')','participationtypemask':_0x171054['callDirection']===_0x8ba1('0x4b')?0x1:0x2}]},getCustomFields(_0x3ab683[_0x8ba1('0x45')],_0x4374db,_0x3ab683['ticketType'])),'headers':{'Authorization':_0x8ba1('0x19')+_0x4d1ba2,'OData-Version':_0x8ba1('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x523c1b);})[_0x8ba1('0x11')](function(_0x210977){var _0x10fc3c=_0x210977['headers']['odata-entityid'];var _0x28f2ab=_0x10fc3c[_0x8ba1('0x3b')](_0x10fc3c['lastIndexOf']('(')+0x1,_0x10fc3c[_0x8ba1('0x2d')](')'));_0x171054[_0x8ba1('0x4c')]=_0x28f2ab;_0x34b0c3(_0x171054);})[_0x8ba1('0x12')](function(_0x4d93b2){_0x3bb4dc(_0x4d93b2[_0x8ba1('0x16')]);});});}function emit(_0x463dac,_0x1cac6b,_0x4fe2fd,_0x368e59){var _0x4209fb={'uri':util[_0x8ba1('0x4d')](_0x8ba1('0x4e'),_0x463dac,_0x4fe2fd,_0x368e59)};io['to'](util['format'](_0x8ba1('0x4f'),_0x1cac6b))[_0x8ba1('0x50')](_0x8ba1('0x51'),_0x4209fb);}exports['cs']=function(_0x2e1aeb,_0x33cdfb,_0x5f4ac3,_0xfb78ed,_0x3d1979,_0x19dcde,_0x3da484,_0x557452){var _0x405c5e={};_0x19dcde[_0x8ba1('0xe')]=intUtil[_0x8ba1('0x52')](_0x19dcde[_0x8ba1('0xe')]);_0x19dcde[_0x8ba1('0x53')]=intUtil[_0x8ba1('0x52')](_0x19dcde['serverUrl']);_0x405c5e[_0x8ba1('0x4a')]=_0x557452==='queue'||_0x557452==='unmanaged'?_0x8ba1('0x4b'):'outbound';var _0x352ff3=util[_0x8ba1('0x4d')]('%s/api/data/v9.0/',_0x19dcde[_0x8ba1('0xe')]);var _0x573cc8=util['format'](_0x8ba1('0x54'),_0x19dcde['tenantId']);var _0x36f41a=util[_0x8ba1('0x4d')](_0x8ba1('0x55'),_0x19dcde[_0x8ba1('0x53')],_0x33cdfb[_0x8ba1('0x56')],md5(_0x33cdfb[_0x8ba1('0x56')]));if(_0x3d1979&&_0x3d1979['monitor_format']){logger[_0x8ba1('0x20')]('[QUEUE]',_0x8ba1('0x57'));_0x33cdfb['recordingURL']=_0x36f41a;}else if(_0x3da484&&_0x3da484[_0x8ba1('0x58')]&&_0x3da484['recordingFormat']!==_0x8ba1('0x59')){logger[_0x8ba1('0x20')](_0x8ba1('0x5a'),_0x8ba1('0x57'));_0x33cdfb[_0x8ba1('0x5b')]=_0x36f41a;}else{_0x33cdfb['recordingURL']='';}return getUser(_0x405c5e,_0x19dcde,_0xfb78ed,_0x573cc8,_0x352ff3,_0x557452)['then'](function(_0x597d49){logger['info']('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x5c'),_0x597d49[_0x8ba1('0x23')]);logger[_0x8ba1('0x20')]('['+_0x557452['toUpperCase']()+_0x8ba1('0x5d'),_0x597d49[_0x8ba1('0x1d')]);return getEndUser(_0x597d49,_0x19dcde,_0x573cc8,_0x352ff3,_0x33cdfb,_0x557452);})[_0x8ba1('0x11')](function(_0x21cc83){logger['info']('['+_0x557452['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x21cc83[_0x8ba1('0x2e')]);logger['info']('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x5e'),_0x33cdfb[_0x8ba1('0x29')]);return getTicket(_0x21cc83,_0x19dcde,_0x573cc8,_0x352ff3,_0x33cdfb,_0x5f4ac3,_0x557452);})['then'](function(_0x3cadb5){logger['info'](util[_0x8ba1('0x4d')]('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x5f'),_0x5f4ac3[_0x8ba1('0x3e')],_0x3cadb5[_0x8ba1('0x4c')]));logger[_0x8ba1('0x20')](util[_0x8ba1('0x4d')]('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x60'),_0x557452));if(_0x557452!=='unmanaged'){logger[_0x8ba1('0x20')]('['+_0x557452[_0x8ba1('0x14')]()+']',_0x8ba1('0x61'));emit(_0x19dcde[_0x8ba1('0xe')],_0xfb78ed[_0x8ba1('0x62')],_0x5f4ac3[_0x8ba1('0x3e')],_0x3cadb5['ticketId']);}})[_0x8ba1('0x12')](function(_0x3332e5){logger['error']('['+_0x557452[_0x8ba1('0x14')]()+_0x8ba1('0x63'),util[_0x8ba1('0x64')](_0x3332e5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf9d5=['POST','clientId','remoteUri','password','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userEmail','then','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','userId','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','4.0','value','toLowerCase','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','assign','callDirection','queue','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter'];(function(_0x64cfdd,_0xdad39c){var _0x1ad419=function(_0x588cab){while(--_0x588cab){_0x64cfdd['push'](_0x64cfdd['shift']());}};_0x1ad419(++_0xdad39c);}(_0xf9d5,0x122));var _0x5f9d=function(_0x592919,_0x52d8f5){_0x592919=_0x592919-0x0;var _0x1d413f=_0xf9d5[_0x592919];return _0x1d413f;};'use strict';var _=require('lodash');var BPromise=require(_0x5f9d('0x0'));var rp=require(_0x5f9d('0x1'));var util=require('util');var intUtil=require(_0x5f9d('0x2'));var md5=require(_0x5f9d('0x3'));var Redis=require(_0x5f9d('0x4'));var logger=require(_0x5f9d('0x5'))(_0x5f9d('0x6'));var config=require(_0x5f9d('0x7'));config[_0x5f9d('0x8')]=_['defaults'](config[_0x5f9d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5f9d('0x9'))(new Redis(config[_0x5f9d('0x8')]));function getAuthToken(_0x4fb9f7,_0x3420b2,_0x23e865){var _0x46e265={'method':_0x5f9d('0xa'),'uri':_0x3420b2,'form':{'client_id':_0x4fb9f7[_0x5f9d('0xb')],'resource':_0x4fb9f7[_0x5f9d('0xc')],'username':_0x4fb9f7['username'],'password':_0x4fb9f7[_0x5f9d('0xd')],'grant_type':_0x5f9d('0xd'),'client_secret':_0x4fb9f7['clientSecret']},'json':!![]};return rp(_0x46e265)['then'](function(_0x26938c){return _0x26938c[_0x5f9d('0xe')];})[_0x5f9d('0xf')](function(_0x4c3b1a){logger[_0x5f9d('0x10')]('['+[_0x23e865[_0x5f9d('0x11')]()]+_0x5f9d('0x12'));return _0x4c3b1a[_0x5f9d('0x13')];});}function getUser(_0x550655,_0x5d42fd,_0x3450a8,_0x234902,_0x5aacdc,_0x8e2381){return new BPromise(function(_0x3ae401,_0x57cb1a){return getAuthToken(_0x5d42fd,_0x234902,_0x8e2381)['then'](function(_0x2f0154){var _0x334cea={'method':_0x5f9d('0x14'),'uri':_0x5aacdc+_0x5f9d('0x15'),'headers':{'Authorization':_0x5f9d('0x16')+_0x2f0154,'OData-Version':'4.0'},'json':!![]};return rp(_0x334cea);})['then'](function(_0x54bd00){var _0x3d8370=_0x54bd00['value'];var _0x432f1a=![];var _0x48448e=null;if(!_[_0x5f9d('0x17')](_0x3450a8)){if(intUtil[_0x5f9d('0x18')](_0x3450a8[_0x5f9d('0x19')])){_0x550655['userEmail']=_0x3450a8[_0x5f9d('0x19')];for(_0x48448e=0x0;_0x48448e<_0x3d8370[_0x5f9d('0x1a')];_0x48448e++){if(_0x3d8370[_0x48448e][_0x5f9d('0x1b')]===_0x3450a8[_0x5f9d('0x19')]&&!_0x3d8370[_0x48448e][_0x5f9d('0x1c')]){_0x432f1a=!![];logger[_0x5f9d('0x1d')]('['+[_0x8e2381[_0x5f9d('0x11')]()]+_0x5f9d('0x1e')+_0x3d8370[_0x48448e][_0x5f9d('0x1f')]+'!');_0x550655['userId']=_0x3d8370[_0x48448e]['systemuserid'];}}}}if(!_0x432f1a){logger['info']('['+[_0x8e2381[_0x5f9d('0x11')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x550655[_0x5f9d('0x20')]=_0x5d42fd['username'];for(_0x48448e=0x0;_0x48448e<_0x3d8370[_0x5f9d('0x1a')];_0x48448e++){if(_0x3d8370[_0x48448e]['internalemailaddress']===_0x5d42fd['username']){_0x550655['userId']=_0x3d8370[_0x48448e][_0x5f9d('0x1f')];}}}_0x3ae401(_0x550655);})[_0x5f9d('0xf')](function(_0x45c333){_0x57cb1a(_0x45c333[_0x5f9d('0x13')]);});});}function createEndUser(_0x542bbc,_0x379d2d,_0x272b93,_0x190402,_0x74f212,_0x2d097f){return new BPromise(function(_0x14aaca,_0x2d66cc){return getAuthToken(_0x379d2d,_0x272b93,_0x2d097f)[_0x5f9d('0x21')](function(_0x3b1efc){var _0x1ec773=_0x2d097f['toLowerCase']()===_0x5f9d('0x22')?_0x74f212[_0x5f9d('0x23')]:_0x74f212[_0x5f9d('0x24')];var _0x13cc7c={'method':_0x5f9d('0xa'),'uri':_0x190402+_0x5f9d('0x25'),'body':{'telephone1':_0x1ec773,'fullname':_0x1ec773,'firstname':_0x1ec773,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5f9d('0x26')+_0x542bbc[_0x5f9d('0x27')]+')'},'headers':{'Authorization':_0x5f9d('0x16')+_0x3b1efc,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x13cc7c);})['then'](function(_0x4ba714){var _0x118f77=_0x4ba714['headers'][_0x5f9d('0x28')];var _0x49fe67=_0x118f77[_0x5f9d('0x29')](_0x118f77['lastIndexOf']('(')+0x1,_0x118f77[_0x5f9d('0x2a')](')'));_0x542bbc[_0x5f9d('0x2b')]=_0x49fe67;_0x14aaca(_0x542bbc);})[_0x5f9d('0xf')](function(_0x3b4933){_0x2d66cc(_0x3b4933[_0x5f9d('0x13')]);});});}function getEndUser(_0x5a8b7d,_0x42ba29,_0x480fdf,_0xf30420,_0x4822bc,_0x299736){return new BPromise(function(_0x20f1ba,_0x5d3fe6){return getAuthToken(_0x42ba29,_0x480fdf,_0x299736)[_0x5f9d('0x21')](function(_0x97826c){var _0x36a6bc={'method':'GET','uri':_0xf30420+_0x5f9d('0x2c'),'headers':{'Authorization':_0x5f9d('0x16')+_0x97826c,'If-None-Match':null,'OData-Version':_0x5f9d('0x2d')},'json':!![]};return rp(_0x36a6bc);})[_0x5f9d('0x21')](function(_0x3377af){var _0x506869=null;if(_0x3377af){var _0x3f9687=_0x3377af[_0x5f9d('0x2e')];var _0xb14b3f=![];for(_0x506869=0x0;_0x506869<_0x3f9687[_0x5f9d('0x1a')];_0x506869++){var _0x2eecee=_0x299736[_0x5f9d('0x2f')]()==='outbound'?_0x4822bc[_0x5f9d('0x23')]:_0x4822bc[_0x5f9d('0x24')];if(_0x3f9687[_0x506869][_0x5f9d('0x30')]===_0x2eecee){_0xb14b3f=!![];_0x5a8b7d['enduserId']=_0x3f9687[_0x506869]['contactid'];}}if(_0xb14b3f){_0x20f1ba(_0x5a8b7d);}else{return createEndUser(_0x5a8b7d,_0x42ba29,_0x480fdf,_0xf30420,_0x4822bc,_0x299736)[_0x5f9d('0x21')](function(_0x310d2b){logger[_0x5f9d('0x1d')]('['+[_0x299736[_0x5f9d('0x11')]()]+_0x5f9d('0x31'),_0x310d2b['enduserId']);_0x20f1ba(_0x310d2b);});}}else{return createEndUser(_0x5a8b7d,_0x42ba29,_0x480fdf,_0xf30420,_0x4822bc,_0x299736)['then'](function(_0x43b7b9){logger[_0x5f9d('0x1d')]('['+[_0x299736['toUpperCase']()]+_0x5f9d('0x32'),_0x43b7b9['enduserId']);_0x20f1ba(_0x43b7b9);});}});});}function getCustomFields(_0x340db4,_0x178b9d,_0x55595b){var _0x6fb378={};if(_0x340db4[_0x5f9d('0x1a')]>0x0){_[_0x5f9d('0x33')](_0x340db4,function(_0x4cbce2){if(_[_0x5f9d('0x34')]([_0x5f9d('0x35'),_0x5f9d('0x36')],_0x4cbce2[_0x5f9d('0x37')])&&_0x4cbce2[_0x5f9d('0x38')]&&!_0x4cbce2[_0x5f9d('0x39')]){var _0x114a69=_0x4cbce2[_0x5f9d('0x3a')][_0x5f9d('0x2f')]();var _0x41fb22=_0x114a69[_0x5f9d('0x29')](0x0,_0x114a69[_0x5f9d('0x3b')]('_'));var _0x43e5a2=_0x114a69[_0x5f9d('0x29')](_0x114a69[_0x5f9d('0x3b')]('_')+0x1);if(_0x41fb22===_0x55595b){_0x6fb378[_0x43e5a2]=_0x4cbce2[_0x5f9d('0x3c')];}}});}return _0x6fb378;}function getTicket(_0x45ba15,_0x1590b5,_0xf02211,_0x21b5d1,_0x27795a,_0x270ae8,_0x2a8c73){return new BPromise(function(_0x19f933,_0x13d343){var _0x9afb54;return getAuthToken(_0x1590b5,_0xf02211,_0x2a8c73)[_0x5f9d('0x21')](function(_0x1fd561){if(_0x270ae8[_0x5f9d('0x3d')]===_0x5f9d('0x3e')){_0x9afb54={'method':'POST','uri':_0x21b5d1+_0x5f9d('0x3f'),'body':Object['assign']({},{'title':intUtil[_0x5f9d('0x40')](_0x270ae8[_0x5f9d('0x41')],_0x27795a,'\x20'),'description':intUtil[_0x5f9d('0x40')](_0x270ae8[_0x5f9d('0x42')],_0x27795a,'\x0a'),'customerid_contact@odata.bind':_0x5f9d('0x43')+_0x45ba15[_0x5f9d('0x2b')]+')','ownerid@odata.bind':_0x5f9d('0x26')+_0x45ba15['userId']+')','caseorigincode':'1'},getCustomFields(_0x270ae8[_0x5f9d('0x44')],_0x27795a,_0x270ae8[_0x5f9d('0x3d')])),'headers':{'Authorization':_0x5f9d('0x16')+_0x1fd561,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x270ae8[_0x5f9d('0x3d')]==='phonecall'){_0x9afb54={'method':_0x5f9d('0xa'),'uri':_0x21b5d1+_0x5f9d('0x45'),'body':Object[_0x5f9d('0x46')]({},{'subject':intUtil['getString'](_0x270ae8['Subjects'],_0x27795a,'\x20'),'phonenumber':String(_0x27795a[_0x5f9d('0x24')]),'description':intUtil[_0x5f9d('0x40')](_0x270ae8['Descriptions'],_0x27795a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5f9d('0x43')+_0x45ba15['enduserId']+')','ownerid@odata.bind':_0x5f9d('0x26')+_0x45ba15[_0x5f9d('0x27')]+')','directioncode':_0x45ba15[_0x5f9d('0x47')]===_0x5f9d('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5f9d('0x26')+_0x45ba15[_0x5f9d('0x27')]+')','participationtypemask':_0x45ba15[_0x5f9d('0x47')]===_0x5f9d('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x5f9d('0x43')+_0x45ba15[_0x5f9d('0x2b')]+')','participationtypemask':_0x45ba15['callDirection']===_0x5f9d('0x48')?0x1:0x2}]},getCustomFields(_0x270ae8[_0x5f9d('0x44')],_0x27795a,_0x270ae8['ticketType'])),'headers':{'Authorization':_0x5f9d('0x16')+_0x1fd561,'OData-Version':_0x5f9d('0x2d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x9afb54);})[_0x5f9d('0x21')](function(_0x40cca6){var _0xc9a152=_0x40cca6[_0x5f9d('0x49')][_0x5f9d('0x28')];var _0x30153b=_0xc9a152['substring'](_0xc9a152['lastIndexOf']('(')+0x1,_0xc9a152[_0x5f9d('0x2a')](')'));_0x45ba15[_0x5f9d('0x4a')]=_0x30153b;_0x19f933(_0x45ba15);})[_0x5f9d('0xf')](function(_0x101616){_0x13d343(_0x101616[_0x5f9d('0x13')]);});});}function emit(_0x222a69,_0x3a38d6,_0x257b50,_0x36ee8e){var _0x53da50={'uri':util['format'](_0x5f9d('0x4b'),_0x222a69,_0x257b50,_0x36ee8e)};io['to'](util[_0x5f9d('0x4c')](_0x5f9d('0x4d'),_0x3a38d6))[_0x5f9d('0x4e')](_0x5f9d('0x4f'),_0x53da50);}exports['cs']=function(_0x1dc9ec,_0x2a8598,_0x15170d,_0x44c714,_0x1f95eb,_0x48b18c,_0x4e2814,_0x250d06){var _0x12e1ef={};_0x48b18c[_0x5f9d('0xc')]=intUtil['stripTrailingSlash'](_0x48b18c[_0x5f9d('0xc')]);_0x48b18c['serverUrl']=intUtil[_0x5f9d('0x50')](_0x48b18c['serverUrl']);_0x12e1ef['callDirection']=_0x250d06===_0x5f9d('0x48')||_0x250d06==='unmanaged'?_0x5f9d('0x48'):_0x5f9d('0x22');var _0x353993=util[_0x5f9d('0x4c')](_0x5f9d('0x51'),_0x48b18c[_0x5f9d('0xc')]);var _0x5963b9=util[_0x5f9d('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x48b18c[_0x5f9d('0x52')]);var _0x5d0cda=util['format'](_0x5f9d('0x53'),_0x48b18c[_0x5f9d('0x54')],_0x2a8598[_0x5f9d('0x55')],md5(_0x2a8598[_0x5f9d('0x55')]));if(_0x1f95eb&&_0x1f95eb['monitor_format']){logger['info'](_0x5f9d('0x56'),_0x5f9d('0x57'));_0x2a8598[_0x5f9d('0x58')]=_0x5d0cda;}else if(_0x4e2814&&_0x4e2814[_0x5f9d('0x59')]&&_0x4e2814[_0x5f9d('0x59')]!=='none'){logger[_0x5f9d('0x1d')]('[OUTBOUND]',_0x5f9d('0x57'));_0x2a8598[_0x5f9d('0x58')]=_0x5d0cda;}else{_0x2a8598[_0x5f9d('0x58')]='';}return getUser(_0x12e1ef,_0x48b18c,_0x44c714,_0x5963b9,_0x353993,_0x250d06)[_0x5f9d('0x21')](function(_0x530158){logger[_0x5f9d('0x1d')]('['+_0x250d06[_0x5f9d('0x11')]()+_0x5f9d('0x5a'),_0x530158[_0x5f9d('0x27')]);logger['info']('['+_0x250d06[_0x5f9d('0x11')]()+_0x5f9d('0x5b'),_0x530158[_0x5f9d('0x20')]);return getEndUser(_0x530158,_0x48b18c,_0x5963b9,_0x353993,_0x2a8598,_0x250d06);})[_0x5f9d('0x21')](function(_0x42fcdc){logger[_0x5f9d('0x1d')]('['+_0x250d06[_0x5f9d('0x11')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x42fcdc[_0x5f9d('0x2b')]);logger[_0x5f9d('0x1d')]('['+_0x250d06[_0x5f9d('0x11')]()+_0x5f9d('0x5c'),_0x2a8598[_0x5f9d('0x24')]);return getTicket(_0x42fcdc,_0x48b18c,_0x5963b9,_0x353993,_0x2a8598,_0x15170d,_0x250d06);})[_0x5f9d('0x21')](function(_0x28eaab){logger[_0x5f9d('0x1d')](util[_0x5f9d('0x4c')]('['+_0x250d06[_0x5f9d('0x11')]()+_0x5f9d('0x5d'),_0x15170d[_0x5f9d('0x3d')],_0x28eaab['ticketId']));logger[_0x5f9d('0x1d')](util[_0x5f9d('0x4c')]('['+_0x250d06[_0x5f9d('0x11')]()+_0x5f9d('0x5e'),_0x250d06));if(_0x250d06!==_0x5f9d('0x5f')){logger['info']('['+_0x250d06[_0x5f9d('0x11')]()+']',_0x5f9d('0x60'));emit(_0x48b18c[_0x5f9d('0xc')],_0x44c714[_0x5f9d('0x61')],_0x15170d[_0x5f9d('0x3d')],_0x28eaab['ticketId']);}})[_0x5f9d('0xf')](function(_0x39cd97){logger[_0x5f9d('0x10')]('['+_0x250d06[_0x5f9d('0x11')]()+_0x5f9d('0x62'),util[_0x5f9d('0x63')](_0x39cd97,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 07fa0c0..335fb38 100644 --- a/server/services/ami/trigger/integration/freshdesk.js +++ b/server/services/ami/trigger/integration/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e81=['picklist','type','nameField','content','string','idField','customField','variable','variableName','push','customVariable','Variable','name','toLowerCase','queue','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridnum','error','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','Tags','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes'];(function(_0x34885c,_0x5241ab){var _0x2381e1=function(_0x341818){while(--_0x341818){_0x34885c['push'](_0x34885c['shift']());}};_0x2381e1(++_0x5241ab);}(_0x0e81,0x1a4));var _0x10e8=function(_0x7c1a5d,_0x4bcb22){_0x7c1a5d=_0x7c1a5d-0x0;var _0x1cceb3=_0x0e81[_0x7c1a5d];return _0x1cceb3;};'use strict';var _=require(_0x10e8('0x0'));var rp=require(_0x10e8('0x1'));var md5=require('md5');var util=require(_0x10e8('0x2'));var Redis=require(_0x10e8('0x3'));var intUtil=require(_0x10e8('0x4'));var config=require(_0x10e8('0x5'));var logger=require('../../../../config/logger')(_0x10e8('0x6'));config[_0x10e8('0x7')]=_[_0x10e8('0x8')](config[_0x10e8('0x7')],{'host':_0x10e8('0x9'),'port':0x18eb});var io=require(_0x10e8('0xa'))(new Redis(config[_0x10e8('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x10e8('0xb')};function emit(_0x51fb61,_0x296bbe,_0x115851){io['to'](_0x51fb61)[_0x10e8('0xc')](_0x296bbe,_0x115851);}function getTicket(_0x3b2360,_0x1df86d,_0x351dea,_0x57d704,_0x1bb305){logger[_0x10e8('0xd')](_0x10e8('0xe'));var _0x3ca569=_[_0x10e8('0xf')]({'responder_id':_0x1df86d['id'],'requester_id':_0x351dea['id'],'name':util[_0x10e8('0x10')](_0x10e8('0x11'),_0x1bb305[_0x10e8('0x12')]),'phone':_0x1bb305[_0x10e8('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x10e8('0x14')](_0x57d704['Subjects'],_0x1bb305,'\x20'),'description':intUtil[_0x10e8('0x14')](_0x57d704[_0x10e8('0x15')],_0x1bb305,'
'),'tags':getTags(_0x57d704[_0x10e8('0x16')],'name')},getCustomFields(_0x57d704[_0x10e8('0x17')],_0x1bb305));_0x3ca569['custom_fields']=_[_0x10e8('0x18')](_[_0x10e8('0x19')](_0x3ca569[_0x10e8('0x1a')],'id'),_0x10e8('0x1b'));return request({'uri':util[_0x10e8('0x10')](_0x10e8('0x1c'),_0x3b2360[_0x10e8('0x1d')]),'method':_0x10e8('0x1e'),'body':_0x3ca569})[_0x10e8('0x1f')](function(_0x53308c){logger['info'](_0x10e8('0x20'));return _0x53308c;});}function getUser(_0x596f59,_0x47beaf){if(intUtil[_0x10e8('0x21')](_0x47beaf)){return request({'uri':util['format']('%s/api/v2/agents',_0x596f59[_0x10e8('0x1d')]),'qs':{'email':_0x47beaf}})[_0x10e8('0x1f')](function(_0x45f16c){if(_0x45f16c[_0x10e8('0x22')]){logger[_0x10e8('0xd')](_0x10e8('0x23'));return _['find'](_0x45f16c,function(_0xb7e26d){return _0xb7e26d[_0x10e8('0x24')]['email']===_0x47beaf;});}else{logger[_0x10e8('0xd')](_0x10e8('0x25'));return request({'uri':util['format'](_0x10e8('0x26'),_0x596f59[_0x10e8('0x1d')])})[_0x10e8('0x1f')](function(_0x233c65){logger[_0x10e8('0xd')](_0x10e8('0x27'));return _0x233c65;});}});}else{logger['info'](_0x10e8('0x28'));return request({'uri':util[_0x10e8('0x10')](_0x10e8('0x26'),_0x596f59['remoteUri'])})['then'](function(_0x4cca28){logger[_0x10e8('0xd')](_0x10e8('0x27'));return _0x4cca28;});}}function getEndUser(_0x25ae21,_0x4e07f0,_0x457701){logger[_0x10e8('0xd')]('Searching\x20enduser\x20with\x20phone',_0x457701);return request({'uri':util['format'](_0x10e8('0x29'),_0x25ae21[_0x10e8('0x1d')]),'qs':{'phone':_0x457701}})[_0x10e8('0x1f')](function(_0x326eb9){if(_0x326eb9['length']){logger[_0x10e8('0xd')](_0x10e8('0x2a'));return _['find'](_0x326eb9,{'phone':_0x457701});}else{logger[_0x10e8('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x10e8('0x10')]('%s/api/v2/contacts',_0x25ae21[_0x10e8('0x1d')]),'method':_0x10e8('0x1e'),'body':{'name':_0x4e07f0,'phone':_0x457701}})[_0x10e8('0x1f')](function(_0x1b31d4){logger[_0x10e8('0xd')](_0x10e8('0x2b'));return _0x1b31d4;});}});}function getAuth(_0x234cb0){return util[_0x10e8('0x10')](_0x10e8('0x2c'),new Buffer(_0x234cb0[_0x10e8('0x2d')]+':X')[_0x10e8('0x2e')](_0x10e8('0x2f')));}function request(_0x240c6a){logger[_0x10e8('0x30')](_0x10e8('0x31'),JSON[_0x10e8('0x32')](_0x240c6a));return rp(_[_0x10e8('0x8')](_0x240c6a,{'method':_0x10e8('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x58aa48,_0x2e9200){var _0x360107=[];if(_0x58aa48&&_0x58aa48[_0x10e8('0x22')]>0x0){_0x360107=_[_0x10e8('0x34')](_0x58aa48,_0x2e9200);}return _0x360107;}function getCustomFields(_0x1ecef0,_0xc54d1){var _0x174fe3=[];var _0x1e8a6e={'custom_fields':[]};if(_0x1ecef0[_0x10e8('0x22')]>0x0){_[_0x10e8('0x35')](_0x1ecef0,function(_0x5d4559){if(_[_0x10e8('0x36')](['string',_0x10e8('0x37')],_0x5d4559[_0x10e8('0x38')])&&_0x5d4559[_0x10e8('0x39')]&&!_0x5d4559['customField']){_0x1e8a6e[_0x5d4559['nameField']['toLowerCase']()]=_0x5d4559[_0x10e8('0x3a')][_0x10e8('0x2e')]();}else if(_[_0x10e8('0x36')]([_0x10e8('0x3b'),_0x10e8('0x37')],_0x5d4559[_0x10e8('0x38')])&&_0x5d4559[_0x10e8('0x3c')]&&_0x5d4559[_0x10e8('0x3d')]){_0x1e8a6e[_0x10e8('0x1a')]['push']({'id':_0x5d4559[_0x10e8('0x3c')],'value':_0x5d4559[_0x10e8('0x3a')][_0x10e8('0x2e')]()});}else if(_0x5d4559[_0x10e8('0x38')]===_0x10e8('0x3e')&&_0x5d4559[_0x10e8('0x3f')]&&_0x5d4559[_0x10e8('0x3c')]&&_0x5d4559[_0x10e8('0x3d')]){_0xc54d1[_0x5d4559[_0x10e8('0x3f')]]&&_0x1e8a6e['custom_fields'][_0x10e8('0x40')]({'id':_0x5d4559[_0x10e8('0x3c')],'value':_0xc54d1[_0x5d4559[_0x10e8('0x3f')]]['toString']()});}else if(_0x5d4559[_0x10e8('0x38')]===_0x10e8('0x41')&&_0x5d4559['Variable']&&_0x5d4559[_0x10e8('0x42')][_0x10e8('0x43')]&&_0x5d4559[_0x10e8('0x3c')]&&_0x5d4559[_0x10e8('0x3d')]){_0xc54d1[_0x5d4559[_0x10e8('0x42')][_0x10e8('0x43')][_0x10e8('0x44')]()]&&_0x1e8a6e[_0x10e8('0x1a')][_0x10e8('0x40')]({'id':_0x5d4559[_0x10e8('0x3c')],'value':_0xc54d1[_0x5d4559[_0x10e8('0x42')][_0x10e8('0x43')][_0x10e8('0x44')]()][_0x10e8('0x2e')]()});}});}return _0x1e8a6e;}exports[_0x10e8('0x45')]=function(_0x3ea273,_0x529117,_0x20cffe,_0x3d540f,_0x29b357,_0x489789){var _0xcc4c85,_0x215400;_0x489789[_0x10e8('0x1d')]=intUtil['stripTrailingSlash'](_0x489789[_0x10e8('0x1d')]);_0x489789[_0x10e8('0x46')]=intUtil['stripTrailingSlash'](_0x489789[_0x10e8('0x46')]);if(_0x29b357&&_0x29b357['monitor_format']){logger[_0x10e8('0xd')](_0x10e8('0x47'),'Recording\x20is\x20enabled!');_0x529117['recordingURL']=util[_0x10e8('0x10')](_0x10e8('0x48'),_0x489789[_0x10e8('0x46')],_0x529117['uniqueid'],md5(_0x529117[_0x10e8('0x49')]));}else{_0x529117[_0x10e8('0x4a')]='';}headers['Authorization']=getAuth(_0x489789);return getUser(_0x489789,_0x3d540f[_0x10e8('0x4b')])[_0x10e8('0x1f')](function(_0x5c300b){_0xcc4c85=_0x5c300b;logger[_0x10e8('0xd')]('The\x20User\x20ID\x20is:',_0xcc4c85['id']);return getEndUser(_0x489789,_0x529117[_0x10e8('0x12')],_0x529117['calleridnum']);})[_0x10e8('0x1f')](function(_0x578903){_0x215400=_0x578903;logger[_0x10e8('0xd')](_0x10e8('0x4c'),_0x215400['id']);return getTicket(_0x489789,_0xcc4c85,_0x215400,_0x20cffe,_0x529117);})['then'](function(_0x31e841){if(_0x31e841&&_0x31e841['id']){logger[_0x10e8('0xd')](_0x10e8('0x20'));logger['info'](_0x10e8('0x4d'),_0x31e841['id']);logger['info']('[QUEUE]',_0x10e8('0x4e'));emit(util['format'](_0x10e8('0x4f'),_0x3d540f[_0x10e8('0x43')]),_0x10e8('0x50'),{'uri':util['format'](_0x10e8('0x51'),_0x489789[_0x10e8('0x1d')],_0x31e841['id'])});}})[_0x10e8('0x52')](function(_0x1d067b){logger['error'](_0x10e8('0x47'),JSON[_0x10e8('0x32')](_0x1d067b));});};exports[_0x10e8('0x53')]=function(_0x4e830f,_0x19947c,_0x254a17,_0x13ef13,_0x3e6d46,_0x507b74,_0x54a835){var _0x36a764,_0x4a3a15;_0x507b74['remoteUri']=intUtil[_0x10e8('0x54')](_0x507b74[_0x10e8('0x1d')]);_0x507b74['serverUrl']=intUtil[_0x10e8('0x54')](_0x507b74[_0x10e8('0x46')]);if(_0x54a835&&_0x54a835[_0x10e8('0x55')]&&_0x54a835[_0x10e8('0x55')]!==_0x10e8('0x56')){logger['info'](_0x10e8('0x57'),'Recording\x20is\x20enabled!');_0x19947c[_0x10e8('0x4a')]=util['format'](_0x10e8('0x48'),_0x507b74[_0x10e8('0x46')],_0x19947c[_0x10e8('0x49')],md5(_0x19947c[_0x10e8('0x49')]));}headers[_0x10e8('0x58')]=getAuth(_0x507b74);return getUser(_0x507b74,_0x13ef13[_0x10e8('0x4b')])[_0x10e8('0x1f')](function(_0x5d7c94){_0x36a764=_0x5d7c94;logger[_0x10e8('0xd')](_0x10e8('0x59'),_0x36a764['id']);return getEndUser(_0x507b74,_0x19947c['destcalleridname'],_0x19947c[_0x10e8('0x5a')]);})[_0x10e8('0x1f')](function(_0x15bf4d){_0x4a3a15=_0x15bf4d;logger[_0x10e8('0xd')](_0x10e8('0x4c'),_0x4a3a15['id']);return getTicket(_0x507b74,_0x36a764,_0x4a3a15,_0x254a17,_0x19947c);})['then'](function(_0x264feb){if(_0x264feb&&_0x264feb['id']){logger[_0x10e8('0xd')]('Ticket\x20created!');logger[_0x10e8('0xd')](_0x10e8('0x4d'),_0x264feb['id']);logger[_0x10e8('0xd')]('[OUTBOUND]',_0x10e8('0x4e'));emit(util[_0x10e8('0x10')]('user:%s',_0x13ef13['name']),'trigger:browser:url',{'uri':util[_0x10e8('0x10')]('%s/helpdesk/tickets/%d',_0x507b74['remoteUri'],_0x264feb['id'])});}})['catch'](function(_0x33c9d5){logger[_0x10e8('0x5b')](_0x10e8('0x57'),JSON[_0x10e8('0x32')](_0x33c9d5));});};exports['unmanaged']=function(_0x1d556a,_0x4bca20,_0x21d886,_0x4e532c,_0x2f29b6,_0xcdbdfc){var _0x395d69,_0x722963;_0xcdbdfc[_0x10e8('0x1d')]=intUtil[_0x10e8('0x54')](_0xcdbdfc[_0x10e8('0x1d')]);_0xcdbdfc[_0x10e8('0x46')]=intUtil[_0x10e8('0x54')](_0xcdbdfc[_0x10e8('0x46')]);if(_0x2f29b6&&_0x2f29b6['monitor_format']){logger['info']('['+_0x4bca20[_0x10e8('0x5c')][_0x10e8('0x5d')]()+']',_0x10e8('0x5e'));_0x4bca20[_0x10e8('0x4a')]=util['format'](_0x10e8('0x48'),_0xcdbdfc[_0x10e8('0x46')],_0x4bca20[_0x10e8('0x49')],md5(_0x4bca20[_0x10e8('0x49')]));}else{_0x4bca20[_0x10e8('0x4a')]='';}headers[_0x10e8('0x58')]=getAuth(_0xcdbdfc);return getUser(_0xcdbdfc,'')[_0x10e8('0x1f')](function(_0x2662a2){_0x395d69=_0x2662a2;logger[_0x10e8('0xd')](_0x10e8('0x59'),_0x395d69['id']);return getEndUser(_0xcdbdfc,_0x4bca20[_0x10e8('0x12')],_0x4bca20[_0x10e8('0x13')]);})[_0x10e8('0x1f')](function(_0x3f4c7e){_0x722963=_0x3f4c7e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x722963['id']);return getTicket(_0xcdbdfc,_0x395d69,_0x722963,_0x21d886,_0x4bca20);})[_0x10e8('0x1f')](function(_0x16c223){if(_0x16c223){logger[_0x10e8('0xd')]('Ticket\x20created!');logger[_0x10e8('0xd')](_0x10e8('0x4d'),_0x16c223['id']);}})['catch'](function(_0x443e34){logger[_0x10e8('0x5b')]('['+_0x4bca20[_0x10e8('0x5c')][_0x10e8('0x5d')]()+']',JSON['stringify'](_0x443e34));});}; \ No newline at end of file +var _0xb126=['uniqueid','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','stringify','outbound','recordingFormat','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','%s/helpdesk/tickets/%d','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','freshdesk','defaults','localhost','redis','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','info','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','debug','[HTTP]','map','forEach','picklist','type','nameField','customField','toLowerCase','content','includes','string','idField','push','toString','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0xf252cb,_0x1793c5){var _0x296810=function(_0x2ddf57){while(--_0x2ddf57){_0xf252cb['push'](_0xf252cb['shift']());}};_0x296810(++_0x1793c5);}(_0xb126,0x76));var _0x6b12=function(_0x47483e,_0x49cc8e){_0x47483e=_0x47483e-0x0;var _0x54af5a=_0xb126[_0x47483e];return _0x54af5a;};'use strict';var _=require(_0x6b12('0x0'));var rp=require(_0x6b12('0x1'));var md5=require(_0x6b12('0x2'));var util=require(_0x6b12('0x3'));var Redis=require(_0x6b12('0x4'));var intUtil=require(_0x6b12('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x6b12('0x6'));config['redis']=_[_0x6b12('0x7')](config['redis'],{'host':_0x6b12('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6b12('0x9')]));var headers={'Content-Type':_0x6b12('0xa'),'Accept':'application/json'};function emit(_0x3d6dec,_0x3353bf,_0x30cae4){io['to'](_0x3d6dec)[_0x6b12('0xb')](_0x3353bf,_0x30cae4);}function getTicket(_0x5f57d4,_0x33292e,_0x5d4217,_0x223685,_0x39721f){logger['info'](_0x6b12('0xc'));var _0x500f53=_[_0x6b12('0xd')]({'responder_id':_0x33292e['id'],'requester_id':_0x5d4217['id'],'name':util[_0x6b12('0xe')](_0x6b12('0xf'),_0x39721f[_0x6b12('0x10')]),'phone':_0x39721f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6b12('0x11')](_0x223685[_0x6b12('0x12')],_0x39721f,'\x20'),'description':intUtil[_0x6b12('0x11')](_0x223685[_0x6b12('0x13')],_0x39721f,_0x6b12('0x14')),'tags':getTags(_0x223685[_0x6b12('0x15')],_0x6b12('0x16'))},getCustomFields(_0x223685[_0x6b12('0x17')],_0x39721f));_0x500f53[_0x6b12('0x18')]=_[_0x6b12('0x19')](_['keyBy'](_0x500f53['custom_fields'],'id'),_0x6b12('0x1a'));return request({'uri':util['format'](_0x6b12('0x1b'),_0x5f57d4[_0x6b12('0x1c')]),'method':_0x6b12('0x1d'),'body':_0x500f53})[_0x6b12('0x1e')](function(_0x2bded5){logger[_0x6b12('0x1f')]('Ticket\x20created!');return _0x2bded5;});}function getUser(_0x9b17f,_0x5d7c03){if(intUtil[_0x6b12('0x20')](_0x5d7c03)){return request({'uri':util[_0x6b12('0xe')](_0x6b12('0x21'),_0x9b17f[_0x6b12('0x1c')]),'qs':{'email':_0x5d7c03}})['then'](function(_0x65a3d3){if(_0x65a3d3[_0x6b12('0x22')]){logger['info'](_0x6b12('0x23'));return _['find'](_0x65a3d3,function(_0x54f3ed){return _0x54f3ed[_0x6b12('0x24')]['email']===_0x5d7c03;});}else{logger[_0x6b12('0x1f')](_0x6b12('0x25'));return request({'uri':util[_0x6b12('0xe')](_0x6b12('0x26'),_0x9b17f['remoteUri'])})[_0x6b12('0x1e')](function(_0x13f1d9){logger[_0x6b12('0x1f')](_0x6b12('0x27'));return _0x13f1d9;});}});}else{logger[_0x6b12('0x1f')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6b12('0xe')](_0x6b12('0x26'),_0x9b17f[_0x6b12('0x1c')])})[_0x6b12('0x1e')](function(_0x1aad0d){logger['info'](_0x6b12('0x27'));return _0x1aad0d;});}}function getEndUser(_0x139579,_0x2bae1f,_0x5c2801){logger['info'](_0x6b12('0x28'),_0x5c2801);return request({'uri':util[_0x6b12('0xe')]('%s/api/v2/contacts',_0x139579[_0x6b12('0x1c')]),'qs':{'phone':_0x5c2801}})[_0x6b12('0x1e')](function(_0x369b6f){if(_0x369b6f[_0x6b12('0x22')]){logger[_0x6b12('0x1f')](_0x6b12('0x29'));return _['find'](_0x369b6f,{'phone':_0x5c2801});}else{logger[_0x6b12('0x1f')](_0x6b12('0x2a'));return request({'uri':util[_0x6b12('0xe')](_0x6b12('0x2b'),_0x139579[_0x6b12('0x1c')]),'method':_0x6b12('0x1d'),'body':{'name':_0x2bae1f,'phone':_0x5c2801}})['then'](function(_0x45e32a){logger[_0x6b12('0x1f')](_0x6b12('0x2c'));return _0x45e32a;});}});}function getAuth(_0x5221d4){return util[_0x6b12('0xe')](_0x6b12('0x2d'),new Buffer(_0x5221d4['apiKey']+':X')['toString']('base64'));}function request(_0x1f3a1f){logger[_0x6b12('0x2e')](_0x6b12('0x2f'),JSON['stringify'](_0x1f3a1f));return rp(_[_0x6b12('0x7')](_0x1f3a1f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1df838,_0x2d2495){var _0x4c034b=[];if(_0x1df838&&_0x1df838[_0x6b12('0x22')]>0x0){_0x4c034b=_[_0x6b12('0x30')](_0x1df838,_0x2d2495);}return _0x4c034b;}function getCustomFields(_0x1aa42b,_0x559f8a){var _0x1a0249=[];var _0x36e1e7={'custom_fields':[]};if(_0x1aa42b[_0x6b12('0x22')]>0x0){_[_0x6b12('0x31')](_0x1aa42b,function(_0xaf81e9){if(_['includes'](['string',_0x6b12('0x32')],_0xaf81e9[_0x6b12('0x33')])&&_0xaf81e9[_0x6b12('0x34')]&&!_0xaf81e9[_0x6b12('0x35')]){_0x36e1e7[_0xaf81e9['nameField'][_0x6b12('0x36')]()]=_0xaf81e9[_0x6b12('0x37')]['toString']();}else if(_[_0x6b12('0x38')]([_0x6b12('0x39'),'picklist'],_0xaf81e9[_0x6b12('0x33')])&&_0xaf81e9[_0x6b12('0x3a')]&&_0xaf81e9['customField']){_0x36e1e7[_0x6b12('0x18')][_0x6b12('0x3b')]({'id':_0xaf81e9['idField'],'value':_0xaf81e9[_0x6b12('0x37')][_0x6b12('0x3c')]()});}else if(_0xaf81e9[_0x6b12('0x33')]==='variable'&&_0xaf81e9[_0x6b12('0x3d')]&&_0xaf81e9[_0x6b12('0x3a')]&&_0xaf81e9['customField']){_0x559f8a[_0xaf81e9['variableName']]&&_0x36e1e7[_0x6b12('0x18')][_0x6b12('0x3b')]({'id':_0xaf81e9[_0x6b12('0x3a')],'value':_0x559f8a[_0xaf81e9['variableName']]['toString']()});}else if(_0xaf81e9[_0x6b12('0x33')]===_0x6b12('0x3e')&&_0xaf81e9[_0x6b12('0x3f')]&&_0xaf81e9['Variable'][_0x6b12('0x16')]&&_0xaf81e9[_0x6b12('0x3a')]&&_0xaf81e9[_0x6b12('0x35')]){_0x559f8a[_0xaf81e9[_0x6b12('0x3f')][_0x6b12('0x16')]['toLowerCase']()]&&_0x36e1e7['custom_fields']['push']({'id':_0xaf81e9[_0x6b12('0x3a')],'value':_0x559f8a[_0xaf81e9['Variable'][_0x6b12('0x16')]['toLowerCase']()][_0x6b12('0x3c')]()});}});}return _0x36e1e7;}exports[_0x6b12('0x40')]=function(_0x5e2733,_0x2fe011,_0x4568fa,_0x37df83,_0x46a465,_0x56c85d){var _0x228dd0,_0x14efe8;_0x56c85d[_0x6b12('0x1c')]=intUtil[_0x6b12('0x41')](_0x56c85d[_0x6b12('0x1c')]);_0x56c85d[_0x6b12('0x42')]=intUtil[_0x6b12('0x41')](_0x56c85d['serverUrl']);if(_0x46a465&&_0x46a465[_0x6b12('0x43')]){logger[_0x6b12('0x1f')](_0x6b12('0x44'),_0x6b12('0x45'));_0x2fe011[_0x6b12('0x46')]=util[_0x6b12('0xe')](_0x6b12('0x47'),_0x56c85d['serverUrl'],_0x2fe011[_0x6b12('0x48')],md5(_0x2fe011[_0x6b12('0x48')]));}else{_0x2fe011[_0x6b12('0x46')]='';}headers[_0x6b12('0x49')]=getAuth(_0x56c85d);return getUser(_0x56c85d,_0x37df83['email'])[_0x6b12('0x1e')](function(_0x53cb5d){_0x228dd0=_0x53cb5d;logger[_0x6b12('0x1f')]('The\x20User\x20ID\x20is:',_0x228dd0['id']);return getEndUser(_0x56c85d,_0x2fe011['calleridname'],_0x2fe011[_0x6b12('0x4a')]);})[_0x6b12('0x1e')](function(_0x36ec26){_0x14efe8=_0x36ec26;logger[_0x6b12('0x1f')](_0x6b12('0x4b'),_0x14efe8['id']);return getTicket(_0x56c85d,_0x228dd0,_0x14efe8,_0x4568fa,_0x2fe011);})['then'](function(_0x367a24){if(_0x367a24&&_0x367a24['id']){logger['info'](_0x6b12('0x4c'));logger[_0x6b12('0x1f')](_0x6b12('0x4d'),_0x367a24['id']);logger['info'](_0x6b12('0x44'),_0x6b12('0x4e'));emit(util[_0x6b12('0xe')](_0x6b12('0x4f'),_0x37df83['name']),'trigger:browser:url',{'uri':util[_0x6b12('0xe')]('%s/helpdesk/tickets/%d',_0x56c85d[_0x6b12('0x1c')],_0x367a24['id'])});}})[_0x6b12('0x50')](function(_0x25c26e){logger['error'](_0x6b12('0x44'),JSON[_0x6b12('0x51')](_0x25c26e));});};exports[_0x6b12('0x52')]=function(_0x54c2ab,_0x1345e5,_0x3df6fa,_0x1ff04e,_0xf6173a,_0x36c981,_0x11e031){var _0x2aa658,_0x49402a;_0x36c981[_0x6b12('0x1c')]=intUtil[_0x6b12('0x41')](_0x36c981[_0x6b12('0x1c')]);_0x36c981[_0x6b12('0x42')]=intUtil[_0x6b12('0x41')](_0x36c981[_0x6b12('0x42')]);if(_0x11e031&&_0x11e031[_0x6b12('0x53')]&&_0x11e031[_0x6b12('0x53')]!=='none'){logger[_0x6b12('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1345e5[_0x6b12('0x46')]=util[_0x6b12('0xe')](_0x6b12('0x47'),_0x36c981[_0x6b12('0x42')],_0x1345e5[_0x6b12('0x48')],md5(_0x1345e5['uniqueid']));}headers[_0x6b12('0x49')]=getAuth(_0x36c981);return getUser(_0x36c981,_0x1ff04e[_0x6b12('0x54')])[_0x6b12('0x1e')](function(_0x583060){_0x2aa658=_0x583060;logger[_0x6b12('0x1f')](_0x6b12('0x55'),_0x2aa658['id']);return getEndUser(_0x36c981,_0x1345e5[_0x6b12('0x56')],_0x1345e5[_0x6b12('0x57')]);})[_0x6b12('0x1e')](function(_0x4ee8bb){_0x49402a=_0x4ee8bb;logger[_0x6b12('0x1f')](_0x6b12('0x4b'),_0x49402a['id']);return getTicket(_0x36c981,_0x2aa658,_0x49402a,_0x3df6fa,_0x1345e5);})[_0x6b12('0x1e')](function(_0x2ca2e7){if(_0x2ca2e7&&_0x2ca2e7['id']){logger[_0x6b12('0x1f')](_0x6b12('0x4c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2ca2e7['id']);logger['info'](_0x6b12('0x58'),_0x6b12('0x4e'));emit(util[_0x6b12('0xe')](_0x6b12('0x4f'),_0x1ff04e[_0x6b12('0x16')]),_0x6b12('0x59'),{'uri':util[_0x6b12('0xe')](_0x6b12('0x5a'),_0x36c981[_0x6b12('0x1c')],_0x2ca2e7['id'])});}})['catch'](function(_0x26bb3e){logger[_0x6b12('0x5b')](_0x6b12('0x58'),JSON[_0x6b12('0x51')](_0x26bb3e));});};exports[_0x6b12('0x5c')]=function(_0x1062f7,_0x465acb,_0x53d800,_0x9bd30e,_0x8aaf9e,_0x2f7ad0){var _0x5b8019,_0xe34f51;_0x2f7ad0['remoteUri']=intUtil[_0x6b12('0x41')](_0x2f7ad0[_0x6b12('0x1c')]);_0x2f7ad0['serverUrl']=intUtil['stripTrailingSlash'](_0x2f7ad0[_0x6b12('0x42')]);if(_0x8aaf9e&&_0x8aaf9e['monitor_format']){logger[_0x6b12('0x1f')]('['+_0x465acb[_0x6b12('0x5d')]['toUpperCase']()+']',_0x6b12('0x45'));_0x465acb[_0x6b12('0x46')]=util[_0x6b12('0xe')](_0x6b12('0x47'),_0x2f7ad0[_0x6b12('0x42')],_0x465acb[_0x6b12('0x48')],md5(_0x465acb[_0x6b12('0x48')]));}else{_0x465acb['recordingURL']='';}headers[_0x6b12('0x49')]=getAuth(_0x2f7ad0);return getUser(_0x2f7ad0,'')[_0x6b12('0x1e')](function(_0x304775){_0x5b8019=_0x304775;logger[_0x6b12('0x1f')](_0x6b12('0x55'),_0x5b8019['id']);return getEndUser(_0x2f7ad0,_0x465acb[_0x6b12('0x10')],_0x465acb[_0x6b12('0x4a')]);})['then'](function(_0xf2b2bd){_0xe34f51=_0xf2b2bd;logger[_0x6b12('0x1f')](_0x6b12('0x4b'),_0xe34f51['id']);return getTicket(_0x2f7ad0,_0x5b8019,_0xe34f51,_0x53d800,_0x465acb);})['then'](function(_0x1b9a83){if(_0x1b9a83){logger[_0x6b12('0x1f')](_0x6b12('0x4c'));logger['info'](_0x6b12('0x4d'),_0x1b9a83['id']);}})['catch'](function(_0x338c6e){logger[_0x6b12('0x5b')]('['+_0x465acb['lastevent'][_0x6b12('0x5e')]()+']',JSON[_0x6b12('0x51')](_0x338c6e));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index eba6a90..f09a629 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ca9=['adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','User\x20found:','userId','Admin\x20selected','userEmail','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','POST','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','calleridnum','callDirection','queue','unmanaged','outbound','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail'];(function(_0x5e91ff,_0x4db464){var _0x1ce6b6=function(_0x8fdd29){while(--_0x8fdd29){_0x5e91ff['push'](_0x5e91ff['shift']());}};_0x1ce6b6(++_0x4db464);}(_0x8ca9,0x9c));var _0x98ca=function(_0x54f1dd,_0x43f45a){_0x54f1dd=_0x54f1dd-0x0;var _0x460649=_0x8ca9[_0x54f1dd];return _0x460649;};'use strict';var _=require(_0x98ca('0x0'));var rp=require(_0x98ca('0x1'));var md5=require(_0x98ca('0x2'));var util=require(_0x98ca('0x3'));var moment=require(_0x98ca('0x4'));var Promise=require(_0x98ca('0x5'));var Redis=require(_0x98ca('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x98ca('0x7'))('freshsales');config[_0x98ca('0x8')]=_['defaults'](config[_0x98ca('0x8')],{'host':_0x98ca('0x9'),'port':0x18eb});var io=require(_0x98ca('0xa'))(new Redis(config[_0x98ca('0x8')]));function getAdminId(_0x323c95,_0x28a37a,_0x162bd0,_0x210234){return new Promise(function(_0x277c29,_0x404cc1){var _0x572858=![];var _0x2074fb={'method':_0x98ca('0xb'),'uri':_0x210234+_0x98ca('0xc'),'json':!![]};_0x2074fb[_0x98ca('0xd')]=_0x162bd0;logger[_0x98ca('0xe')](_0x98ca('0xf'));return rp(_0x2074fb)[_0x98ca('0x10')](function(_0x496b46){if(_0x496b46){var _0x16221a=_0x496b46[_0x98ca('0x11')];var _0xba3887=null;for(_0xba3887=0x0;_0xba3887<_0x16221a[_0x98ca('0x12')];_0xba3887++){if(_0x16221a[_0xba3887]['email']===_0x323c95[_0x98ca('0x13')]){_0x323c95[_0x98ca('0x14')]=_0x16221a[_0xba3887]['id'];_0x572858=!![];}}if(_0x572858){logger[_0x98ca('0xe')](_0x98ca('0x15'),_0x323c95[_0x98ca('0x14')]);_0x277c29(_0x323c95);}else{_0x404cc1({'statusCode':0x194,'message':_0x98ca('0x16')});}}else{_0x404cc1({'statusCode':0x194,'message':_0x98ca('0x16')});}})['catch'](function(_0x330713){logger[_0x98ca('0x17')]('['+[_0x28a37a[_0x98ca('0x18')]()]+']',_0x330713[_0x98ca('0x19')]);_0x404cc1(_0x330713);});});}function getUser(_0x52e9c8,_0x238c1a,_0x3c2f65){return function(_0xe9f8ad){return new Promise(function(_0x1ce43a,_0x4523bb){var _0x3ca209={'method':_0x98ca('0xb'),'uri':_0x3c2f65+_0x98ca('0xc'),'json':!![]};_0x3ca209[_0x98ca('0xd')]=_0x238c1a;logger[_0x98ca('0xe')](_0x98ca('0x1a'));return rp(_0x3ca209)['then'](function(_0x626b37){if(_0x626b37){var _0x49298d=_0x626b37[_0x98ca('0x11')];var _0x2fe568=![];var _0x50f8b4=null;if(_0xe9f8ad['agentEmail']!==null){logger[_0x98ca('0xe')](_0x98ca('0x1b'),_0xe9f8ad[_0x98ca('0x1c')]);_0xe9f8ad['userEmail']=_0xe9f8ad[_0x98ca('0x1c')];for(_0x50f8b4=0x0;_0x50f8b4<_0x49298d[_0x98ca('0x12')];_0x50f8b4++){if(_0x49298d[_0x50f8b4]['email']===_0xe9f8ad[_0x98ca('0x1c')]){_0x2fe568=!![];_0xe9f8ad['userId']=_0x49298d[_0x50f8b4]['id'];logger[_0x98ca('0xe')](_0x98ca('0x1d'),_0xe9f8ad[_0x98ca('0x1e')]);}}}if(!_0x2fe568){logger[_0x98ca('0xe')](_0x98ca('0x1f'));_0xe9f8ad[_0x98ca('0x20')]=_0xe9f8ad[_0x98ca('0x13')];_0xe9f8ad['userId']=_0xe9f8ad[_0x98ca('0x14')];_0x2fe568=!![];}if(_0x2fe568){_0x1ce43a(_0xe9f8ad);}else{_0x4523bb({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4523bb({'statusCode':0x194,'message':_0x98ca('0x16')});}})[_0x98ca('0x21')](function(_0x5eb829){logger[_0x98ca('0x17')]('['+[_0x52e9c8['toUpperCase']()]+']',_0x5eb829[_0x98ca('0x19')]);_0x4523bb(_0x5eb829);});});};}function searchContact(_0x4f48db,_0x5bf77d,_0x14bfb4,_0x540f45){return new Promise(function(_0x342a83,_0x35b920){var _0x13f766={'method':_0x98ca('0xb'),'headers':_0x5bf77d,'uri':_0x4f48db+_0x98ca('0x22')+_0x540f45+_0x98ca('0x23')+_0x14bfb4+_0x98ca('0x24'),'json':!![]};rp(_0x13f766)[_0x98ca('0x10')](function(_0x447881){var _0x4f2406=_[_0x98ca('0x25')](_0x447881['contacts'][_0x98ca('0x26')],[_0x14bfb4,_0x540f45]);_0x342a83(_0x4f2406);})[_0x98ca('0x21')](function(_0x4d43fd){_0x35b920(_0x4d43fd);});});}function getEndUser(_0x4aaa89,_0x5adf7d,_0x4b37b4){return function(_0x3990d7){return new Promise(function(_0x4f1622,_0x2aaf39){logger['info'](util[_0x98ca('0x27')](_0x98ca('0x28'),_0x3990d7['contactNumber']));searchContact(_0x4b37b4,_0x5adf7d,_0x98ca('0x29'),_0x3990d7[_0x98ca('0x2a')])['then'](function(_0x356cf5){if(_0x356cf5){_0x3990d7[_0x98ca('0x2b')]=_0x356cf5['id'];logger['info'](_0x98ca('0x2c'),_0x3990d7[_0x98ca('0x2b')]);return _0x4f1622(_0x3990d7);}searchContact(_0x4b37b4,_0x5adf7d,_0x98ca('0x2d'),_0x3990d7[_0x98ca('0x2a')])[_0x98ca('0x10')](function(_0x47b1c1){if(_0x47b1c1){_0x3990d7[_0x98ca('0x2b')]=_0x47b1c1['id'];logger[_0x98ca('0xe')]('Contact\x20found\x20work_number:',_0x3990d7[_0x98ca('0x2b')]);return _0x4f1622(_0x3990d7);}createEndUser(_0x3990d7,_0x4aaa89,_0x5adf7d,_0x4b37b4)[_0x98ca('0x10')](function(_0x2d5012){logger['info'](_0x98ca('0x2e'),_0x2d5012[_0x98ca('0x2b')]);return _0x4f1622(_0x2d5012);});});})[_0x98ca('0x21')](function(_0x4c354b){_0x2aaf39(_0x4c354b);});});};}function createEndUser(_0x3a7515,_0x1910ae,_0x10cbe0,_0x48be6c){return new Promise(function(_0x4d7329,_0x167a3e){var _0xe77d02=moment();var _0x3b13f9={'method':'POST','uri':_0x48be6c+_0x98ca('0x2f'),'body':{'contact':{'last_name':_0x3a7515[_0x98ca('0x2a')],'work_number':_0x3a7515[_0x98ca('0x2a')],'mobile_number':_0x3a7515['contactNumber'],'owner_id':_0x3a7515[_0x98ca('0x1e')],'created_at':_0xe77d02[_0x98ca('0x27')](_0x98ca('0x30'))}},'json':!![]};_0x3b13f9[_0x98ca('0xd')]=_0x10cbe0;logger[_0x98ca('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3b13f9)['then'](function(_0x4b811b){_0x3a7515[_0x98ca('0x2b')]=_0x4b811b[_0x98ca('0x31')]['id'];_0x4d7329(_0x3a7515);})[_0x98ca('0x21')](function(_0x1e3d4b){logger[_0x98ca('0x17')]('['+[_0x1910ae[_0x98ca('0x18')]()]+']',_0x1e3d4b[_0x98ca('0x19')]);_0x167a3e(_0x1e3d4b['message']);});});}function getTicket(_0x4900ed,_0x1782e0,_0x24e1cf,_0x31424f,_0x382989){return function(_0x17fdc7){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x5c0d50,_0x4e71a7){var _0x16a6d0=moment();var _0x914606={'method':_0x98ca('0x32'),'uri':_0x24e1cf+'/api/tasks','body':{'title':intUtil['getString'](_0x31424f[_0x98ca('0x33')],_0x382989,'\x20'),'description':intUtil[_0x98ca('0x34')](_0x31424f[_0x98ca('0x35')],_0x382989,'\x0a'),'owner_id':_0x17fdc7[_0x98ca('0x1e')],'creater_id':_0x17fdc7[_0x98ca('0x14')],'targetable_id':_0x17fdc7[_0x98ca('0x2b')],'targetable_type':_0x98ca('0x36'),'created_at':_0x16a6d0[_0x98ca('0x27')](_0x98ca('0x30')),'due_date':_0x16a6d0[_0x98ca('0x37')](0x1e,'m')[_0x98ca('0x27')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x914606[_0x98ca('0xd')]=_0x1782e0;return rp(_0x914606)[_0x98ca('0x10')](function(_0x46cb63){_0x17fdc7[_0x98ca('0x38')]=_0x46cb63[_0x98ca('0x39')]['id'];logger[_0x98ca('0xe')](_0x98ca('0x3a'),_0x17fdc7[_0x98ca('0x38')]);_0x5c0d50(_0x17fdc7);})[_0x98ca('0x21')](function(_0x50c459){logger[_0x98ca('0x17')]('['+[_0x4900ed[_0x98ca('0x18')]()]+']',_0x50c459['message']);_0x4e71a7(_0x50c459[_0x98ca('0x19')]);});});};}function emit(_0x4f2444,_0x3946b3,_0x39f4fd){var _0x6a9045={'uri':_0x4f2444+_0x98ca('0x3b')+_0x39f4fd};io['to'](util[_0x98ca('0x27')](_0x98ca('0x3c'),_0x3946b3))[_0x98ca('0x3d')](_0x98ca('0x3e'),_0x6a9045);}exports['cs']=function(_0x2c7d53,_0x42a53d,_0x15971f,_0xece1d7,_0x5c77e1,_0x51bb5a,_0x1fa4f8,_0x40498f){var _0x19dc39={};var _0x4d5bf0={'Authorization':_0x98ca('0x3f')+_0x51bb5a[_0x98ca('0x40')]};_0x51bb5a[_0x98ca('0x41')]=intUtil[_0x98ca('0x42')](_0x51bb5a[_0x98ca('0x41')]);_0x51bb5a[_0x98ca('0x43')]=intUtil[_0x98ca('0x42')](_0x51bb5a['serverUrl']);var _0x5d1b20=_0x51bb5a['remoteUri'];_0x19dc39[_0x98ca('0x13')]=_0x51bb5a[_0x98ca('0x44')];_0x19dc39[_0x98ca('0x2a')]=_0x40498f[_0x98ca('0x45')]()==='outbound'?_0x42a53d['destcalleridnum']:_0x42a53d[_0x98ca('0x46')];_0x19dc39[_0x98ca('0x47')]=_0x40498f===_0x98ca('0x48')||_0x40498f===_0x98ca('0x49')?_0x98ca('0x48'):_0x98ca('0x4a');if(_0xece1d7){_0x19dc39[_0x98ca('0x1c')]=_0xece1d7[_0x98ca('0x4b')];}var _0x10a31a=util[_0x98ca('0x27')](_0x98ca('0x4c'),_0x51bb5a[_0x98ca('0x43')],_0x42a53d[_0x98ca('0x4d')],md5(_0x42a53d['uniqueid']));if(_0x5c77e1&&_0x5c77e1[_0x98ca('0x4e')]){logger['info'](_0x98ca('0x4f'),_0x98ca('0x50'));_0x42a53d[_0x98ca('0x51')]=_0x10a31a;}else if(_0x1fa4f8&&_0x1fa4f8[_0x98ca('0x52')]&&_0x1fa4f8[_0x98ca('0x52')]!=='none'){logger[_0x98ca('0xe')](_0x98ca('0x53'),'Recording\x20is\x20enabled!');_0x42a53d[_0x98ca('0x51')]=_0x10a31a;}else{_0x42a53d[_0x98ca('0x51')]='';}return getAdminId(_0x19dc39,_0x40498f,_0x4d5bf0,_0x5d1b20)[_0x98ca('0x10')](getUser(_0x40498f,_0x4d5bf0,_0x5d1b20))['then'](getEndUser(_0x40498f,_0x4d5bf0,_0x5d1b20))[_0x98ca('0x10')](getTicket(_0x40498f,_0x4d5bf0,_0x5d1b20,_0x15971f,_0x42a53d))[_0x98ca('0x10')](function(_0x55af07){logger[_0x98ca('0xe')](util[_0x98ca('0x27')](_0x98ca('0x54'),_0x55af07[_0x98ca('0x38')]));if(_0x40498f!==_0x98ca('0x49')){logger[_0x98ca('0xe')]('['+[_0x40498f[_0x98ca('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5d1b20,_0xece1d7[_0x98ca('0x55')],_0x55af07[_0x98ca('0x2b')]);}})[_0x98ca('0x21')](function(_0x47d650){logger['error']('['+[_0x40498f[_0x98ca('0x18')]()]+_0x98ca('0x56'),util[_0x98ca('0x57')](_0x47d650,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1cb9=['monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','catch','message','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','callDirection','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1cb9,0x14e));var _0x91cb=function(_0x481395,_0x336299){_0x481395=_0x481395-0x0;var _0x34e08a=_0x1cb9[_0x481395];return _0x34e08a;};'use strict';var _=require(_0x91cb('0x0'));var rp=require('request-promise');var md5=require(_0x91cb('0x1'));var util=require(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var Promise=require(_0x91cb('0x4'));var Redis=require('ioredis');var intUtil=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var logger=require('../../../../config/logger')(_0x91cb('0x7'));config[_0x91cb('0x8')]=_[_0x91cb('0x9')](config[_0x91cb('0x8')],{'host':_0x91cb('0xa'),'port':0x18eb});var io=require(_0x91cb('0xb'))(new Redis(config['redis']));function getAdminId(_0x15c517,_0x5bda2f,_0x2fdfce,_0x4cf9ed){return new Promise(function(_0xa43e7a,_0x317df0){var _0x45317f=![];var _0x4a631d={'method':_0x91cb('0xc'),'uri':_0x4cf9ed+_0x91cb('0xd'),'json':!![]};_0x4a631d[_0x91cb('0xe')]=_0x2fdfce;logger[_0x91cb('0xf')](_0x91cb('0x10'));return rp(_0x4a631d)[_0x91cb('0x11')](function(_0x530d92){if(_0x530d92){var _0x3c1f56=_0x530d92[_0x91cb('0x12')];var _0x4ba2f2=null;for(_0x4ba2f2=0x0;_0x4ba2f2<_0x3c1f56[_0x91cb('0x13')];_0x4ba2f2++){if(_0x3c1f56[_0x4ba2f2][_0x91cb('0x14')]===_0x15c517[_0x91cb('0x15')]){_0x15c517[_0x91cb('0x16')]=_0x3c1f56[_0x4ba2f2]['id'];_0x45317f=!![];}}if(_0x45317f){logger['info']('Admin\x20found:',_0x15c517[_0x91cb('0x16')]);_0xa43e7a(_0x15c517);}else{_0x317df0({'statusCode':0x194,'message':_0x91cb('0x17')});}}else{_0x317df0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x576369){logger[_0x91cb('0x18')]('['+[_0x5bda2f[_0x91cb('0x19')]()]+']',_0x576369['message']);_0x317df0(_0x576369);});});}function getUser(_0x238f11,_0x135890,_0x4f1554){return function(_0xc594e3){return new Promise(function(_0x139f4b,_0x1cd34b){var _0xcd1a78={'method':'GET','uri':_0x4f1554+_0x91cb('0xd'),'json':!![]};_0xcd1a78[_0x91cb('0xe')]=_0x135890;logger['info'](_0x91cb('0x1a'));return rp(_0xcd1a78)['then'](function(_0x55042a){if(_0x55042a){var _0x281ff3=_0x55042a[_0x91cb('0x12')];var _0x56e409=![];var _0x51a1d5=null;if(_0xc594e3['agentEmail']!==null){logger[_0x91cb('0xf')](_0x91cb('0x1b'),_0xc594e3[_0x91cb('0x1c')]);_0xc594e3[_0x91cb('0x1d')]=_0xc594e3['agentEmail'];for(_0x51a1d5=0x0;_0x51a1d5<_0x281ff3[_0x91cb('0x13')];_0x51a1d5++){if(_0x281ff3[_0x51a1d5][_0x91cb('0x14')]===_0xc594e3[_0x91cb('0x1c')]){_0x56e409=!![];_0xc594e3['userId']=_0x281ff3[_0x51a1d5]['id'];logger[_0x91cb('0xf')](_0x91cb('0x1e'),_0xc594e3[_0x91cb('0x1f')]);}}}if(!_0x56e409){logger[_0x91cb('0xf')](_0x91cb('0x20'));_0xc594e3[_0x91cb('0x1d')]=_0xc594e3[_0x91cb('0x15')];_0xc594e3[_0x91cb('0x1f')]=_0xc594e3[_0x91cb('0x16')];_0x56e409=!![];}if(_0x56e409){_0x139f4b(_0xc594e3);}else{_0x1cd34b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1cd34b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x91cb('0x21')](function(_0x554350){logger[_0x91cb('0x18')]('['+[_0x238f11[_0x91cb('0x19')]()]+']',_0x554350[_0x91cb('0x22')]);_0x1cd34b(_0x554350);});});};}function searchContact(_0x5595c5,_0x9b26a6,_0x4f5a7b,_0x4572f6){return new Promise(function(_0x308e8c,_0x3b3ee6){var _0x2fb473={'method':_0x91cb('0xc'),'headers':_0x9b26a6,'uri':_0x5595c5+'/api/lookup?q='+_0x4572f6+_0x91cb('0x23')+_0x4f5a7b+'&entities=contact','json':!![]};rp(_0x2fb473)[_0x91cb('0x11')](function(_0x30204e){var _0x445fe1=_['find'](_0x30204e[_0x91cb('0x24')][_0x91cb('0x24')],[_0x4f5a7b,_0x4572f6]);_0x308e8c(_0x445fe1);})[_0x91cb('0x21')](function(_0x361e4c){_0x3b3ee6(_0x361e4c);});});}function getEndUser(_0xf296bc,_0x3dab18,_0x1e5bf1){return function(_0x3bbde3){return new Promise(function(_0x1a10b1,_0x5e6ed3){logger[_0x91cb('0xf')](util[_0x91cb('0x25')](_0x91cb('0x26'),_0x3bbde3[_0x91cb('0x27')]));searchContact(_0x1e5bf1,_0x3dab18,_0x91cb('0x28'),_0x3bbde3['contactNumber'])[_0x91cb('0x11')](function(_0x74b443){if(_0x74b443){_0x3bbde3[_0x91cb('0x29')]=_0x74b443['id'];logger[_0x91cb('0xf')](_0x91cb('0x2a'),_0x3bbde3['endUserId']);return _0x1a10b1(_0x3bbde3);}searchContact(_0x1e5bf1,_0x3dab18,_0x91cb('0x2b'),_0x3bbde3['contactNumber'])['then'](function(_0x479968){if(_0x479968){_0x3bbde3[_0x91cb('0x29')]=_0x479968['id'];logger['info'](_0x91cb('0x2c'),_0x3bbde3['endUserId']);return _0x1a10b1(_0x3bbde3);}createEndUser(_0x3bbde3,_0xf296bc,_0x3dab18,_0x1e5bf1)['then'](function(_0x2ec8e1){logger[_0x91cb('0xf')](_0x91cb('0x2d'),_0x2ec8e1[_0x91cb('0x29')]);return _0x1a10b1(_0x2ec8e1);});});})[_0x91cb('0x21')](function(_0x4b0ca6){_0x5e6ed3(_0x4b0ca6);});});};}function createEndUser(_0x8beb3a,_0x3ddc0b,_0x13a5ea,_0x8496a3){return new Promise(function(_0x486a89,_0x5953f6){var _0x1eed21=moment();var _0x135bf1={'method':'POST','uri':_0x8496a3+_0x91cb('0x2e'),'body':{'contact':{'last_name':_0x8beb3a[_0x91cb('0x27')],'work_number':_0x8beb3a['contactNumber'],'mobile_number':_0x8beb3a[_0x91cb('0x27')],'owner_id':_0x8beb3a[_0x91cb('0x1f')],'created_at':_0x1eed21['format'](_0x91cb('0x2f'))}},'json':!![]};_0x135bf1['headers']=_0x13a5ea;logger[_0x91cb('0xf')](_0x91cb('0x30'));return rp(_0x135bf1)[_0x91cb('0x11')](function(_0x279ad5){_0x8beb3a[_0x91cb('0x29')]=_0x279ad5[_0x91cb('0x31')]['id'];_0x486a89(_0x8beb3a);})['catch'](function(_0xa90111){logger[_0x91cb('0x18')]('['+[_0x3ddc0b['toUpperCase']()]+']',_0xa90111[_0x91cb('0x22')]);_0x5953f6(_0xa90111['message']);});});}function getTicket(_0x2c6102,_0x2eac87,_0x2b4bac,_0x174794,_0x5e98c4){return function(_0x435fff){logger[_0x91cb('0xf')](_0x91cb('0x32'));return new Promise(function(_0x37e777,_0x42a7f3){var _0x2b8162=moment();var _0x451463={'method':_0x91cb('0x33'),'uri':_0x2b4bac+_0x91cb('0x34'),'body':{'title':intUtil[_0x91cb('0x35')](_0x174794['Subjects'],_0x5e98c4,'\x20'),'description':intUtil[_0x91cb('0x35')](_0x174794['Descriptions'],_0x5e98c4,'\x0a'),'owner_id':_0x435fff[_0x91cb('0x1f')],'creater_id':_0x435fff['adminId'],'targetable_id':_0x435fff[_0x91cb('0x29')],'targetable_type':'Contact','created_at':_0x2b8162[_0x91cb('0x25')](_0x91cb('0x2f')),'due_date':_0x2b8162[_0x91cb('0x36')](0x1e,'m')[_0x91cb('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x451463[_0x91cb('0xe')]=_0x2eac87;return rp(_0x451463)[_0x91cb('0x11')](function(_0x57e26d){_0x435fff[_0x91cb('0x37')]=_0x57e26d[_0x91cb('0x38')]['id'];logger[_0x91cb('0xf')](_0x91cb('0x39'),_0x435fff[_0x91cb('0x37')]);_0x37e777(_0x435fff);})[_0x91cb('0x21')](function(_0x17d319){logger[_0x91cb('0x18')]('['+[_0x2c6102[_0x91cb('0x19')]()]+']',_0x17d319['message']);_0x42a7f3(_0x17d319[_0x91cb('0x22')]);});});};}function emit(_0x3e20d1,_0x2b7323,_0x470996){var _0x3314cc={'uri':_0x3e20d1+_0x91cb('0x3a')+_0x470996};io['to'](util[_0x91cb('0x25')](_0x91cb('0x3b'),_0x2b7323))['emit'](_0x91cb('0x3c'),_0x3314cc);}exports['cs']=function(_0x46caf1,_0x2b8b7f,_0x3b8cfd,_0x4da300,_0x9dae06,_0x1aa461,_0x4fad1b,_0x212473){var _0x47cdb7={};var _0x2c419b={'Authorization':'Token\x20token='+_0x1aa461['apiKey']};_0x1aa461['remoteUri']=intUtil[_0x91cb('0x3d')](_0x1aa461[_0x91cb('0x3e')]);_0x1aa461[_0x91cb('0x3f')]=intUtil[_0x91cb('0x3d')](_0x1aa461[_0x91cb('0x3f')]);var _0x56d4b9=_0x1aa461['remoteUri'];_0x47cdb7[_0x91cb('0x15')]=_0x1aa461[_0x91cb('0x40')];_0x47cdb7[_0x91cb('0x27')]=_0x212473[_0x91cb('0x41')]()==='outbound'?_0x2b8b7f['destcalleridnum']:_0x2b8b7f['calleridnum'];_0x47cdb7[_0x91cb('0x42')]=_0x212473==='queue'||_0x212473===_0x91cb('0x43')?'queue':_0x91cb('0x44');if(_0x4da300){_0x47cdb7[_0x91cb('0x1c')]=_0x4da300[_0x91cb('0x14')];}var _0x649976=util[_0x91cb('0x25')](_0x91cb('0x45'),_0x1aa461[_0x91cb('0x3f')],_0x2b8b7f[_0x91cb('0x46')],md5(_0x2b8b7f[_0x91cb('0x46')]));if(_0x9dae06&&_0x9dae06[_0x91cb('0x47')]){logger[_0x91cb('0xf')]('[QUEUE]',_0x91cb('0x48'));_0x2b8b7f[_0x91cb('0x49')]=_0x649976;}else if(_0x4fad1b&&_0x4fad1b['recordingFormat']&&_0x4fad1b[_0x91cb('0x4a')]!==_0x91cb('0x4b')){logger['info'](_0x91cb('0x4c'),_0x91cb('0x48'));_0x2b8b7f[_0x91cb('0x49')]=_0x649976;}else{_0x2b8b7f[_0x91cb('0x49')]='';}return getAdminId(_0x47cdb7,_0x212473,_0x2c419b,_0x56d4b9)[_0x91cb('0x11')](getUser(_0x212473,_0x2c419b,_0x56d4b9))[_0x91cb('0x11')](getEndUser(_0x212473,_0x2c419b,_0x56d4b9))[_0x91cb('0x11')](getTicket(_0x212473,_0x2c419b,_0x56d4b9,_0x3b8cfd,_0x2b8b7f))[_0x91cb('0x11')](function(_0x3320bd){logger[_0x91cb('0xf')](util[_0x91cb('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3320bd[_0x91cb('0x37')]));if(_0x212473!=='unmanaged'){logger[_0x91cb('0xf')]('['+[_0x212473['toUpperCase']()]+']',_0x91cb('0x4d'));emit(_0x56d4b9,_0x4da300[_0x91cb('0x4e')],_0x3320bd[_0x91cb('0x29')]);}})['catch'](function(_0xe49d42){logger[_0x91cb('0x18')]('['+[_0x212473['toUpperCase']()]+_0x91cb('0x4f'),util[_0x91cb('0x50')](_0xe49d42,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 7ff369e..39276e7 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data2','util','./zendesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3'];(function(_0x28baf4,_0x2a52f8){var _0x2931dd=function(_0x25c942){while(--_0x25c942){_0x28baf4['push'](_0x28baf4['shift']());}};_0x2931dd(++_0x2a52f8);}(_0xda3f,0xec));var _0xfda3=function(_0x32a65e,_0x2d72d8){_0x32a65e=_0x32a65e-0x0;var _0xf6902f=_0xda3f[_0x32a65e];return _0xf6902f;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var zendesk=require(_0xfda3('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xfda3('0x2'));var desk=require('./desk');var vtiger=require(_0xfda3('0x3'));var servicenow=require(_0xfda3('0x4'));var dynamics365=require('./dynamics365');var freshsales=require(_0xfda3('0x5'));var integrations=[_0xfda3('0x6'),'salesforce','sugarcrm',_0xfda3('0x7'),_0xfda3('0x8'),_0xfda3('0x9'),_0xfda3('0xa'),_0xfda3('0xb'),_0xfda3('0xc'),_0xfda3('0xd')];exports[_0xfda3('0xe')]=function(_0xdc5b45,_0x14d549,_0x102643,_0x4713ba,_0x4d7841,_0xe933f5){if(_0x102643){if(_[_0xfda3('0xf')](integrations,_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]())){try{var _0x1443f4=null;var _0x4b77ea='';var _0x583125=_0x102643[_0xdc5b45['data1'][_0xfda3('0x11')]()];if(_0x583125){var _0x1e7a55=_0x583125[_0xdc5b45['data2']];if(_0x1e7a55){var _0x501588=_['find'](_0x1e7a55[_0xfda3('0x12')],{'id':parseInt(_0xdc5b45[_0xfda3('0x13')],0xa)});if(_0x501588){if(_0x4713ba){if(_0x4d7841&&_0x14d549['queue']){_0x4b77ea='queue';}else if(_0x14d549['routeId']){_0x4b77ea=_0xfda3('0x14');}else{console[_0xfda3('0x15')](_0xfda3('0x16'),_0x14d549);}}else{_0x4b77ea=_0xfda3('0x17');}switch(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]()){case _0xfda3('0x6'):zendesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x18'):salesforce[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x19'):sugarcrm[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x7'):freshdesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case'zoho':zoho[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x9'):desk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xa'):vtiger[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xc'):freshsales['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case _0xfda3('0xd'):servicenow['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case'dynamics365':dynamics365['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;default:console[_0xfda3('0x15')](_0xfda3('0x1a'));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45['data1']['toLowerCase']());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x13')]));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x1f')]));}}else{}}catch(_0x4ae9b9){console[_0xfda3('0x1c')](_0x4ae9b9);}}}}; \ No newline at end of file +var _0x087b=['format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','error','[EXEC]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x087b,0x11a));var _0xb087=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x087b[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xb087('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xb087('0x3'));var desk=require(_0xb087('0x4'));var vtiger=require(_0xb087('0x5'));var servicenow=require(_0xb087('0x6'));var dynamics365=require(_0xb087('0x7'));var freshsales=require(_0xb087('0x8'));var integrations=[_0xb087('0x9'),_0xb087('0xa'),_0xb087('0xb'),_0xb087('0xc'),_0xb087('0xd'),_0xb087('0xe'),_0xb087('0xf'),_0xb087('0x10'),_0xb087('0x11'),_0xb087('0x12')];exports[_0xb087('0x13')]=function(_0x583d25,_0x244abc,_0x108451,_0x903a16,_0x3bce7a,_0x3b45c1){if(_0x108451){if(_[_0xb087('0x14')](integrations,_0x583d25[_0xb087('0x15')]['toLowerCase']())){try{var _0x189e2b=null;var _0x31f977='';var _0x323656=_0x108451[_0x583d25['data1'][_0xb087('0x16')]()];if(_0x323656){var _0x3f145e=_0x323656[_0x583d25[_0xb087('0x17')]];if(_0x3f145e){var _0x46410b=_[_0xb087('0x18')](_0x3f145e[_0xb087('0x19')],{'id':parseInt(_0x583d25[_0xb087('0x1a')],0xa)});if(_0x46410b){if(_0x903a16){if(_0x3bce7a&&_0x244abc[_0xb087('0x1b')]){_0x31f977=_0xb087('0x1b');}else if(_0x244abc[_0xb087('0x1c')]){_0x31f977='outbound';}else{console[_0xb087('0x1d')](_0xb087('0x1e'),_0x244abc);}}else{_0x31f977='unmanaged';}switch(_0x583d25[_0xb087('0x15')][_0xb087('0x16')]()){case _0xb087('0x9'):zendesk[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case'salesforce':salesforce[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xb'):sugarcrm[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xc'):freshdesk[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xd'):zoho[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xe'):desk[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case'vtiger':vtiger[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0x11'):freshsales['cs'](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1,_0x31f977);break;case _0xb087('0x12'):servicenow['cs'](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1,_0x31f977);break;case _0xb087('0x10'):dynamics365['cs'](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1,_0x31f977);break;default:console[_0xb087('0x1d')]('unknown\x20integration');}}else{_0x189e2b=require('../../../../config/logger')(_0x583d25['data1']['toLowerCase']());_0x189e2b[_0xb087('0x1f')](_0xb087('0x20'),util[_0xb087('0x21')](_0xb087('0x22'),_0x583d25[_0xb087('0x15')][_0xb087('0x16')](),_0x583d25[_0xb087('0x1a')]));}}else{_0x189e2b=require('../../../../config/logger')(_0x583d25[_0xb087('0x15')][_0xb087('0x16')]());_0x189e2b[_0xb087('0x1f')](_0xb087('0x20'),util[_0xb087('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x583d25[_0xb087('0x15')][_0xb087('0x16')](),_0x583d25['data2']));}}else{}}catch(_0x5a2dc6){console['error'](_0x5a2dc6);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 4a7f48a..52e3fc9 100644 --- a/server/services/ami/trigger/integration/salesforce.js +++ b/server/services/ami/trigger/integration/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfbf=['No\x20Company','upperFirst','create','forEach','includes','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','Fields','lastevent','lodash','request-promise','moment','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','utc','endUserType','WhoId','account','WhatId','ContactId','AccountId','sobject','isNil','validateEmail','User','execute','then','length','find','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','info','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','additionalSearchAccount','Account','contact','lead','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xbfbf,0x134));var _0xfbfb=function(_0x43ea38,_0x467b21){_0x43ea38=_0x43ea38-0x0;var _0x3ae839=_0xbfbf[_0x43ea38];return _0x3ae839;};'use strict';var _=require(_0xfbfb('0x0'));var rp=require(_0xfbfb('0x1'));var moment=require(_0xfbfb('0x2'));var BPromise=require(_0xfbfb('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xfbfb('0x4'));var Redis=require(_0xfbfb('0x5'));var intUtil=require(_0xfbfb('0x6'));var config=require(_0xfbfb('0x7'));var logger=require(_0xfbfb('0x8'))(_0xfbfb('0x9'));config[_0xfbfb('0xa')]=_[_0xfbfb('0xb')](config['redis'],{'host':_0xfbfb('0xc'),'port':0x18eb});var io=require(_0xfbfb('0xd'))(new Redis(config[_0xfbfb('0xa')]));function emit(_0x244da8,_0xb1c8b2,_0x3cb0e5){io['to'](_0x244da8)[_0xfbfb('0xe')](_0xb1c8b2,_0x3cb0e5);}function getTicket(_0x36e85a,_0x132357,_0x9cb0f,_0x1e3f5d,_0x2475c5,_0x4d7b4f,_0x21350e,_0x7d9b2e){var _0x1cd907=Object['assign']({},{'OwnerId':_0x132357['id'],'Subject':intUtil[_0xfbfb('0xf')](_0x1e3f5d[_0xfbfb('0x10')],_0x2475c5,'\x20'),'Description':intUtil['getString'](_0x1e3f5d[_0xfbfb('0x11')],_0x2475c5,'\x0a')},getCustomFields(_0x4d7b4f,_0x2475c5));if(_0x9cb0f){if(_0x1e3f5d[_0xfbfb('0x12')]==='Task'){_0x1cd907['ActivityDate']=moment[_0xfbfb('0x13')]();_0x1cd907['IsReminderSet']=![];_0x1cd907['IsRecurrence']=![];if(_0x9cb0f[_0xfbfb('0x14')]==='contact'||_0x9cb0f[_0xfbfb('0x14')]==='lead'){_0x1cd907[_0xfbfb('0x15')]=_0x9cb0f['id'];}else if(_0x9cb0f[_0xfbfb('0x14')]===_0xfbfb('0x16')){_0x1cd907[_0xfbfb('0x17')]=_0x9cb0f['id'];}}else if(_0x1e3f5d[_0xfbfb('0x12')]==='Case'){if(_0x9cb0f[_0xfbfb('0x14')]==='contact'){_0x1cd907[_0xfbfb('0x18')]=_0x9cb0f['id'];}else if(_0x9cb0f['endUserType']===_0xfbfb('0x16')){_0x1cd907[_0xfbfb('0x19')]=_0x9cb0f['id'];}else if(_0x9cb0f[_0xfbfb('0x14')]==='lead'&&_0x1e3f5d['leadId']){_0x1cd907[_0x1e3f5d['leadId']]=_0x9cb0f['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x21350e[_0xfbfb('0x1a')](_0x1e3f5d[_0xfbfb('0x12')])['create'](_0x1cd907);}function getUser(_0x2b09a9,_0x2a6e7c,_0x1517eb){if(!_[_0xfbfb('0x1b')](_0x2a6e7c)&&intUtil[_0xfbfb('0x1c')](_0x2a6e7c)){var _0x3f489d={'Email':_0x2a6e7c};var _0x322ef1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1517eb[_0xfbfb('0x1a')](_0xfbfb('0x1d'))['find'](_0x3f489d,_0x322ef1)[_0xfbfb('0x1e')]()[_0xfbfb('0x1f')](function(_0x2d14c9){if(_0x2d14c9[_0xfbfb('0x20')]){var _0x161c90=_[_0xfbfb('0x21')](_0x2d14c9,function(_0x28810c){return _0x28810c[_0xfbfb('0x22')]===_0x2a6e7c;});if(_0x161c90){logger['info'](_0xfbfb('0x23'),_0x2a6e7c);return BPromise[_0xfbfb('0x24')]({'id':_0x161c90['Id'],'name':_0x161c90[_0xfbfb('0x25')]});}}else{logger['info'](_0xfbfb('0x26'),_0x2a6e7c);return _0x1517eb[_0xfbfb('0x27')]()[_0xfbfb('0x1f')](function(_0x4403ce){return BPromise['resolve']({'id':_0x4403ce[_0xfbfb('0x28')],'name':_0x4403ce[_0xfbfb('0x29')]});});}});}else{logger[_0xfbfb('0x2a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2a6e7c);return _0x1517eb[_0xfbfb('0x27')]()[_0xfbfb('0x1f')](function(_0x3e70ec){return BPromise[_0xfbfb('0x24')]({'id':_0x3e70ec[_0xfbfb('0x28')],'name':_0x3e70ec[_0xfbfb('0x29')]});});}}function getEndUser(_0x4cafb7,_0x24dedc,_0x38408e,_0x14748c,_0x405148){var _0x1f8cad={'$or':{'Phone':_0x14748c}};var _0x17be87={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfbfb('0x24')]()[_0xfbfb('0x1f')](function(){logger[_0xfbfb('0x2a')](_0xfbfb('0x2b'),_0x14748c,_0x24dedc[_0xfbfb('0x2c')]);switch(_0x24dedc['moduleSearch']){case _0xfbfb('0x2d'):var _0x345b68=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x2f')]){var _0x498bb2={};_0x498bb2[_0x24dedc['additionalSearchContact']]=_0x14748c;_[_0xfbfb('0x30')](_0x345b68[_0xfbfb('0x31')],_0x498bb2);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x32'))[_0xfbfb('0x21')](_0x345b68,_0x17be87)[_0xfbfb('0x1e')]()[_0xfbfb('0x1f')](function(_0x4022b8){if(_0x4022b8&&_0x4022b8[_0xfbfb('0x20')]){return _0x4022b8;}else{var _0xcd3021=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x33')]){var _0x23161e={};_0x23161e[_0x24dedc[_0xfbfb('0x33')]]=_0x14748c;_[_0xfbfb('0x30')](_0xcd3021[_0xfbfb('0x31')],_0x23161e);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x34'))[_0xfbfb('0x21')](_0xcd3021,_0x17be87);}});case'account_contact_lead':var _0x80383f=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x35')]){var _0x498bb2={};_0x498bb2[_0x24dedc[_0xfbfb('0x35')]]=_0x14748c;_[_0xfbfb('0x30')](_0x80383f['$or'],_0x498bb2);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x36'))[_0xfbfb('0x21')](_0x80383f,_0x17be87)['execute']()['then'](function(_0x433fb1){if(_0x433fb1&&_0x433fb1['length']){return _0x433fb1;}else{var _0x21ab41=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x2f')]){var _0x2efd86={};_0x2efd86[_0x24dedc[_0xfbfb('0x2f')]]=_0x14748c;_[_0xfbfb('0x30')](_0x21ab41[_0xfbfb('0x31')],_0x2efd86);}return _0x405148[_0xfbfb('0x1a')](_0xfbfb('0x32'))[_0xfbfb('0x21')](_0x21ab41,_0x17be87)[_0xfbfb('0x1f')](function(_0x798ee8){if(_0x798ee8&&_0x798ee8[_0xfbfb('0x20')]){return _0x798ee8;}else{var _0x503c47=_['cloneDeep'](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x33')]){var _0x449bd1={};_0x449bd1[_0x24dedc[_0xfbfb('0x33')]]=_0x14748c;_[_0xfbfb('0x30')](_0x503c47[_0xfbfb('0x31')],_0x449bd1);}return _0x405148['sobject']('Lead')[_0xfbfb('0x21')](_0x503c47,_0x17be87);}});}});case _0xfbfb('0x37'):var _0x345b68=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc[_0xfbfb('0x2f')]){var _0x498bb2={};_0x498bb2[_0x24dedc[_0xfbfb('0x2f')]]=_0x14748c;_[_0xfbfb('0x30')](_0x345b68[_0xfbfb('0x31')],_0x498bb2);}return _0x405148[_0xfbfb('0x1a')]('Contact')[_0xfbfb('0x21')](_0x345b68,_0x17be87)['execute']();case _0xfbfb('0x38'):var _0x111268=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc['additionalSearchLead']){var _0x498bb2={};_0x498bb2[_0x24dedc['additionalSearchLead']]=_0x14748c;_[_0xfbfb('0x30')](_0x111268['$or'],_0x498bb2);}return _0x405148['sobject'](_0xfbfb('0x34'))[_0xfbfb('0x21')](_0x111268,_0x17be87);case _0xfbfb('0x16'):var _0x80383f=_[_0xfbfb('0x2e')](_0x1f8cad);if(_0x24dedc['additionalSearchAccount']){var _0x498bb2={};_0x498bb2[_0x24dedc[_0xfbfb('0x35')]]=_0x14748c;_['merge'](_0x80383f['$or'],_0x498bb2);}return _0x405148['sobject']('Account')[_0xfbfb('0x21')](_0x80383f,_0x17be87);default:return null;}})[_0xfbfb('0x1f')](function(_0x2dd9df){if(_0x2dd9df&&_0x2dd9df[_0xfbfb('0x20')]){var _0x135414=_[_0xfbfb('0x39')](_0x2dd9df);if(_0x135414){return BPromise[_0xfbfb('0x24')]({'id':_0x135414['Id'],'name':_0x135414[_0xfbfb('0x25')],'phone':_0x135414['Phone'],'endUserType':_0x135414['attributes'][_0xfbfb('0x3a')][_0xfbfb('0x3b')]()});}}})[_0xfbfb('0x1f')](function(_0x5d8560){if(_0x5d8560){logger[_0xfbfb('0x2a')](_0xfbfb('0x3c'),_0x5d8560[_0xfbfb('0x14')],_0x14748c);return BPromise['resolve'](_0x5d8560);}else{logger[_0xfbfb('0x2a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x14748c);var _0xa326e={'Phone':_0x14748c};if(_0x24dedc['moduleCreate']){if(_0x24dedc[_0xfbfb('0x3d')]===_0xfbfb('0x37')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x14748c,_0x24dedc[_0xfbfb('0x3d')]);_0xa326e[_0xfbfb('0x3e')]=_0x38408e!==_0xfbfb('0x3f')?_0x38408e:util[_0xfbfb('0x40')]('Caller\x20-\x20%s',_0x14748c);}else if(_0x24dedc['moduleCreate']===_0xfbfb('0x38')){logger[_0xfbfb('0x2a')](_0xfbfb('0x41'),_0x14748c,_0x24dedc[_0xfbfb('0x3d')]);_0xa326e[_0xfbfb('0x3e')]=_0x38408e!==_0xfbfb('0x3f')?_0x38408e:util['format']('Caller\x20-\x20%s',_0x14748c);_0xa326e[_0xfbfb('0x42')]=_0xfbfb('0x43');}else if(_0x24dedc[_0xfbfb('0x3d')]===_0xfbfb('0x16')){logger[_0xfbfb('0x2a')](_0xfbfb('0x41'),_0x14748c,_0x24dedc[_0xfbfb('0x3d')]);_0xa326e[_0xfbfb('0x25')]=_0x38408e!==''?_0x38408e:util[_0xfbfb('0x40')]('Caller\x20-\x20%s',_0x14748c);}else{return null;}}return _0x405148[_0xfbfb('0x1a')](_[_0xfbfb('0x44')](_0x24dedc['moduleCreate']))[_0xfbfb('0x45')](_0xa326e)['then'](function(_0x50123d){return BPromise[_0xfbfb('0x24')]({'id':_0x50123d['id'],'endUserType':_0x24dedc[_0xfbfb('0x3d')]});});}});}function getCustomFields(_0x27ec11,_0x45529a){var _0x20bd19={};if(_0x27ec11[_0xfbfb('0x20')]>0x0){_[_0xfbfb('0x46')](_0x27ec11,function(_0x4039be){if(_[_0xfbfb('0x47')](['string',_0xfbfb('0x48')],_0x4039be[_0xfbfb('0x3a')])&&_0x4039be[_0xfbfb('0x49')]){_0x20bd19[_0x4039be[_0xfbfb('0x49')]]=_0x4039be[_0xfbfb('0x4a')]['toString']();}else if(_0x4039be['type']===_0xfbfb('0x4b')&&_0x4039be['variableName']&&_0x4039be['idField']){_0x45529a[_0x4039be['variableName']]&&(_0x20bd19[_0x4039be[_0xfbfb('0x49')]]=_0x45529a[_0x4039be[_0xfbfb('0x4c')]][_0xfbfb('0x4d')]());}else if(_0x4039be['type']===_0xfbfb('0x4e')&&_0x4039be['Variable']&&_0x4039be[_0xfbfb('0x4f')][_0xfbfb('0x50')]&&_0x4039be[_0xfbfb('0x49')]){_0x45529a[_0x4039be[_0xfbfb('0x4f')][_0xfbfb('0x50')][_0xfbfb('0x3b')]()]&&(_0x20bd19[_0x4039be[_0xfbfb('0x49')]]=_0x45529a[_0x4039be[_0xfbfb('0x4f')]['name'][_0xfbfb('0x3b')]()][_0xfbfb('0x4d')]());}});}return _0x20bd19;}function getConnection(_0x2beb2e){var _0x10b60c=_0x2beb2e[_0xfbfb('0x51')][_0xfbfb('0x52')](_0x2beb2e['securityToken']);var _0x1103be=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2beb2e[_0xfbfb('0x53')]||_0xfbfb('0x54'),'clientId':_0x2beb2e['clientId'],'clientSecret':_0x2beb2e[_0xfbfb('0x55')]}});return _0x1103be[_0xfbfb('0x56')](_0x2beb2e[_0xfbfb('0x57')],_0x10b60c)[_0xfbfb('0x1f')](function(){logger[_0xfbfb('0x2a')](_0xfbfb('0x58'));return _0x1103be;});}exports[_0xfbfb('0x59')]=function(_0x9d1630,_0x3546da,_0x3017ee,_0x149565,_0x7d54d3,_0x3abf57){var _0x250177,_0x4e3c80,_0x417256,_0x142167;_0x3abf57[_0xfbfb('0x5a')]=intUtil['stripTrailingSlash'](_0x3abf57[_0xfbfb('0x5a')]);_0x3abf57['remoteUri']=intUtil[_0xfbfb('0x5b')](_0x3abf57['remoteUri']);if(_0x7d54d3&&_0x7d54d3[_0xfbfb('0x5c')]){logger['info'](_0xfbfb('0x5d'),_0xfbfb('0x5e'));_0x3546da[_0xfbfb('0x5f')]=util[_0xfbfb('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3abf57[_0xfbfb('0x5a')],_0x3546da[_0xfbfb('0x60')],md5(_0x3546da[_0xfbfb('0x60')]));}else{_0x3546da['recordingURL']='';}return getConnection(_0x3abf57)[_0xfbfb('0x1f')](function(_0x1b901e){_0x142167=_0x1b901e;return getUser(_0x3abf57,_0x149565['email'],_0x142167);})[_0xfbfb('0x1f')](function(_0x1c20e1){_0x250177=_0x1c20e1;return getEndUser(_0x3abf57,_0x3017ee,_0x3546da[_0xfbfb('0x61')],_0x3546da['calleridnum'],_0x142167);})[_0xfbfb('0x1f')](function(_0x3610ab){_0x4e3c80=_0x3610ab;return getTicket(_0x3abf57,_0x250177,_0x4e3c80,_0x3017ee,_0x3546da,_0x3017ee['Fields'],_0x142167,_0xfbfb('0x59'));})['then'](function(_0x5926db){_0x417256=_0x5926db;logger['info'](_0xfbfb('0x62'),_0x417256['id']);logger['info'](_0xfbfb('0x63'),_0x417256['id'],_0x149565[_0xfbfb('0x50')],_0x3abf57[_0xfbfb('0x3a')]);switch(_0x3abf57[_0xfbfb('0x3a')]){case _0xfbfb('0x64'):emit(util['format'](_0xfbfb('0x65'),_0x149565[_0xfbfb('0x50')]),_0xfbfb('0x66'),{'recordId':_0x417256['id']});break;case _0xfbfb('0x67'):emit(util['format'](_0xfbfb('0x65'),_0x149565[_0xfbfb('0x50')]),_0xfbfb('0x68'),{'uri':util['format'](_0xfbfb('0x69'),_0x142167['instanceUrl'],_0x417256['id'])});break;default:logger['error'](_0xfbfb('0x6a'));}})[_0xfbfb('0x6b')](function(_0x3e6254){logger[_0xfbfb('0x6c')](_0xfbfb('0x5d'),_0x3e6254);});};exports['outbound']=function(_0x549f70,_0x4e36fd,_0x121aa9,_0x37597a,_0x5a7d23,_0x2a1fda,_0x1a0139){var _0x39878b,_0x519a00,_0x54c701,_0x2ed31e;_0x2a1fda[_0xfbfb('0x5a')]=intUtil[_0xfbfb('0x5b')](_0x2a1fda[_0xfbfb('0x5a')]);_0x2a1fda['remoteUri']=intUtil[_0xfbfb('0x5b')](_0x2a1fda['remoteUri']);if(_0x1a0139&&_0x1a0139[_0xfbfb('0x6d')]&&_0x1a0139['recordingFormat']!==_0xfbfb('0x6e')){logger['info']('[OUTBOUND]',_0xfbfb('0x5e'));_0x4e36fd[_0xfbfb('0x5f')]=util[_0xfbfb('0x40')](_0xfbfb('0x6f'),_0x2a1fda[_0xfbfb('0x5a')],_0x4e36fd['uniqueid'],md5(_0x4e36fd[_0xfbfb('0x60')]));}return getConnection(_0x2a1fda)[_0xfbfb('0x1f')](function(_0x3360ea){_0x2ed31e=_0x3360ea;return getUser(_0x2a1fda,_0x37597a[_0xfbfb('0x70')],_0x2ed31e);})['then'](function(_0x3b549e){_0x39878b=_0x3b549e;return getEndUser(_0x2a1fda,_0x121aa9,_0x4e36fd[_0xfbfb('0x71')],_0x4e36fd[_0xfbfb('0x72')],_0x2ed31e);})['then'](function(_0x293a32){_0x519a00=_0x293a32;return getTicket(_0x2a1fda,_0x39878b,_0x519a00,_0x121aa9,_0x4e36fd,_0x121aa9['Fields'],_0x2ed31e,_0xfbfb('0x73'));})[_0xfbfb('0x1f')](function(_0x138e74){_0x54c701=_0x138e74;logger['info'](_0xfbfb('0x74'),_0x54c701['id']);logger['info'](_0xfbfb('0x75'),_0x54c701['id'],_0x37597a['name'],_0x2a1fda[_0xfbfb('0x3a')]);switch(_0x2a1fda[_0xfbfb('0x3a')]){case _0xfbfb('0x64'):emit(util[_0xfbfb('0x40')](_0xfbfb('0x65'),_0x37597a['name']),_0xfbfb('0x66'),{'recordId':_0x54c701['id']});break;case _0xfbfb('0x67'):emit(util[_0xfbfb('0x40')](_0xfbfb('0x65'),_0x37597a['name']),_0xfbfb('0x68'),{'uri':util[_0xfbfb('0x40')](_0xfbfb('0x69'),_0x2ed31e['instanceUrl'],_0x54c701['id'])});break;default:logger[_0xfbfb('0x6c')]('[OUTBOUND]',_0xfbfb('0x76'));}})[_0xfbfb('0x6b')](function(_0x4e82a0){logger[_0xfbfb('0x6c')](_0xfbfb('0x77'),_0x4e82a0);});};exports[_0xfbfb('0x78')]=function(_0x555d7e,_0x3fab2e,_0x52f963,_0x537b93,_0x1d0600,_0x40026f){var _0x6bbf83,_0x4b2a2c,_0x187b87,_0x474598;_0x40026f[_0xfbfb('0x5a')]=intUtil[_0xfbfb('0x5b')](_0x40026f[_0xfbfb('0x5a')]);_0x40026f[_0xfbfb('0x53')]=intUtil[_0xfbfb('0x5b')](_0x40026f['remoteUri']);if(_0x1d0600&&_0x1d0600[_0xfbfb('0x5c')]){logger[_0xfbfb('0x2a')]('['+_0x3fab2e['lastevent'][_0xfbfb('0x79')]()+']','Recording\x20is\x20enabled!');_0x3fab2e[_0xfbfb('0x5f')]=util[_0xfbfb('0x40')](_0xfbfb('0x6f'),_0x40026f['serverUrl'],_0x3fab2e[_0xfbfb('0x60')],md5(_0x3fab2e[_0xfbfb('0x60')]));}else{_0x3fab2e[_0xfbfb('0x5f')]='';}return getConnection(_0x40026f)['then'](function(_0x1f964d){_0x474598=_0x1f964d;if(!_[_0xfbfb('0x1b')](_0x537b93)){return getUser(_0x40026f,_0x537b93['name'],_0x474598);}else{return getUser(_0x40026f,null,_0x474598);}})['then'](function(_0x1e32b6){_0x6bbf83=_0x1e32b6;return getEndUser(_0x40026f,_0x52f963,_0x3fab2e[_0xfbfb('0x61')],_0x3fab2e[_0xfbfb('0x7a')],_0x474598);})['then'](function(_0x4385ab){_0x4b2a2c=_0x4385ab;return getTicket(_0x40026f,_0x6bbf83,_0x4b2a2c,_0x52f963,_0x3fab2e,_0x52f963[_0xfbfb('0x7b')],_0x474598);})[_0xfbfb('0x1f')](function(_0x5cd04d){_0x187b87=_0x5cd04d;logger[_0xfbfb('0x2a')]('['+_0x3fab2e[_0xfbfb('0x7c')][_0xfbfb('0x79')]()+']\x20Ticket\x20%s\x20created.',_0x187b87['id']);logger[_0xfbfb('0x2a')]('['+_0x3fab2e[_0xfbfb('0x7c')][_0xfbfb('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x40026f[_0xfbfb('0x3a')]);})[_0xfbfb('0x6b')](function(_0x392bff){logger[_0xfbfb('0x6c')]('['+_0x3fab2e[_0xfbfb('0x7c')][_0xfbfb('0x79')]()+']',_0x392bff);});}; \ No newline at end of file +var _0x5b22=['recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','socket.io-emitter','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','additionalSearchContact','$or','Contact','length','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','lead','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','format','Company','No\x20Company','upperFirst','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]'];(function(_0x28d96f,_0x28d8bf){var _0x377433=function(_0x34e251){while(--_0x34e251){_0x28d96f['push'](_0x28d96f['shift']());}};_0x377433(++_0x28d8bf);}(_0x5b22,0x1a8));var _0x25b2=function(_0x3a87b7,_0x1c21bc){_0x3a87b7=_0x3a87b7-0x0;var _0x4e8a78=_0x5b22[_0x3a87b7];return _0x4e8a78;};'use strict';var _=require(_0x25b2('0x0'));var rp=require(_0x25b2('0x1'));var moment=require(_0x25b2('0x2'));var BPromise=require('bluebird');var md5=require(_0x25b2('0x3'));var jsforce=require(_0x25b2('0x4'));var util=require('util');var Redis=require(_0x25b2('0x5'));var intUtil=require(_0x25b2('0x6'));var config=require(_0x25b2('0x7'));var logger=require(_0x25b2('0x8'))(_0x25b2('0x9'));config['redis']=_[_0x25b2('0xa')](config[_0x25b2('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x25b2('0xc'))(new Redis(config[_0x25b2('0xb')]));function emit(_0x43d0a1,_0x242251,_0x13adac){io['to'](_0x43d0a1)['emit'](_0x242251,_0x13adac);}function getTicket(_0x37ab04,_0x451b7a,_0x5b9b94,_0x54c509,_0x5e64fe,_0x469981,_0x1e61f2,_0x42b23a){var _0x24d482=Object[_0x25b2('0xd')]({},{'OwnerId':_0x451b7a['id'],'Subject':intUtil[_0x25b2('0xe')](_0x54c509['Subjects'],_0x5e64fe,'\x20'),'Description':intUtil[_0x25b2('0xe')](_0x54c509[_0x25b2('0xf')],_0x5e64fe,'\x0a')},getCustomFields(_0x469981,_0x5e64fe));if(_0x5b9b94){if(_0x54c509[_0x25b2('0x10')]===_0x25b2('0x11')){_0x24d482[_0x25b2('0x12')]=moment[_0x25b2('0x13')]();_0x24d482[_0x25b2('0x14')]=![];_0x24d482[_0x25b2('0x15')]=![];if(_0x5b9b94[_0x25b2('0x16')]===_0x25b2('0x17')||_0x5b9b94[_0x25b2('0x16')]==='lead'){_0x24d482[_0x25b2('0x18')]=_0x5b9b94['id'];}else if(_0x5b9b94[_0x25b2('0x16')]===_0x25b2('0x19')){_0x24d482[_0x25b2('0x1a')]=_0x5b9b94['id'];}}else if(_0x54c509[_0x25b2('0x10')]===_0x25b2('0x1b')){if(_0x5b9b94[_0x25b2('0x16')]===_0x25b2('0x17')){_0x24d482['ContactId']=_0x5b9b94['id'];}else if(_0x5b9b94['endUserType']===_0x25b2('0x19')){_0x24d482['AccountId']=_0x5b9b94['id'];}else if(_0x5b9b94[_0x25b2('0x16')]==='lead'&&_0x54c509['leadId']){_0x24d482[_0x54c509[_0x25b2('0x1c')]]=_0x5b9b94['id'];}else{logger[_0x25b2('0x1d')](_0x25b2('0x1e'));}}}return _0x1e61f2[_0x25b2('0x1f')](_0x54c509[_0x25b2('0x10')])[_0x25b2('0x20')](_0x24d482);}function getUser(_0x1241e5,_0x41ca93,_0x2a4ffd){if(!_[_0x25b2('0x21')](_0x41ca93)&&intUtil[_0x25b2('0x22')](_0x41ca93)){var _0x108478={'Email':_0x41ca93};var _0x3bdc7f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2a4ffd['sobject'](_0x25b2('0x23'))[_0x25b2('0x24')](_0x108478,_0x3bdc7f)[_0x25b2('0x25')]()[_0x25b2('0x26')](function(_0x4150c4){if(_0x4150c4['length']){var _0xc92be1=_[_0x25b2('0x24')](_0x4150c4,function(_0x39eddb){return _0x39eddb[_0x25b2('0x27')]===_0x41ca93;});if(_0xc92be1){logger[_0x25b2('0x1d')](_0x25b2('0x28'),_0x41ca93);return BPromise[_0x25b2('0x29')]({'id':_0xc92be1['Id'],'name':_0xc92be1[_0x25b2('0x2a')]});}}else{logger[_0x25b2('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x41ca93);return _0x2a4ffd[_0x25b2('0x2b')]()[_0x25b2('0x26')](function(_0x145d3a){return BPromise[_0x25b2('0x29')]({'id':_0x145d3a[_0x25b2('0x2c')],'name':_0x145d3a[_0x25b2('0x2d')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x41ca93);return _0x2a4ffd[_0x25b2('0x2b')]()[_0x25b2('0x26')](function(_0x140ce6){return BPromise['resolve']({'id':_0x140ce6[_0x25b2('0x2c')],'name':_0x140ce6[_0x25b2('0x2d')]});});}}function getEndUser(_0x3eec5b,_0x59fd85,_0x73c4f7,_0x283bfc,_0x74c0fd){var _0x38e1bc={'$or':{'Phone':_0x283bfc}};var _0x528dcc={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x25b2('0x29')]()[_0x25b2('0x26')](function(){logger[_0x25b2('0x1d')](_0x25b2('0x2e'),_0x283bfc,_0x59fd85['moduleSearch']);switch(_0x59fd85['moduleSearch']){case _0x25b2('0x2f'):var _0x4921e3=_['cloneDeep'](_0x38e1bc);if(_0x59fd85['additionalSearchContact']){var _0x108a23={};_0x108a23[_0x59fd85[_0x25b2('0x30')]]=_0x283bfc;_['merge'](_0x4921e3[_0x25b2('0x31')],_0x108a23);}return _0x74c0fd['sobject'](_0x25b2('0x32'))[_0x25b2('0x24')](_0x4921e3,_0x528dcc)[_0x25b2('0x25')]()['then'](function(_0x38741e){if(_0x38741e&&_0x38741e[_0x25b2('0x33')]){return _0x38741e;}else{var _0x4292f6=_[_0x25b2('0x34')](_0x38e1bc);if(_0x59fd85['additionalSearchLead']){var _0x2aeb54={};_0x2aeb54[_0x59fd85[_0x25b2('0x35')]]=_0x283bfc;_[_0x25b2('0x36')](_0x4292f6[_0x25b2('0x31')],_0x2aeb54);}return _0x74c0fd[_0x25b2('0x1f')](_0x25b2('0x37'))[_0x25b2('0x24')](_0x4292f6,_0x528dcc);}});case _0x25b2('0x38'):var _0x50312a=_[_0x25b2('0x34')](_0x38e1bc);if(_0x59fd85[_0x25b2('0x39')]){var _0x108a23={};_0x108a23[_0x59fd85[_0x25b2('0x39')]]=_0x283bfc;_['merge'](_0x50312a[_0x25b2('0x31')],_0x108a23);}return _0x74c0fd['sobject'](_0x25b2('0x3a'))[_0x25b2('0x24')](_0x50312a,_0x528dcc)[_0x25b2('0x25')]()[_0x25b2('0x26')](function(_0x438603){if(_0x438603&&_0x438603[_0x25b2('0x33')]){return _0x438603;}else{var _0x88cc44=_[_0x25b2('0x34')](_0x38e1bc);if(_0x59fd85[_0x25b2('0x30')]){var _0x3b3691={};_0x3b3691[_0x59fd85[_0x25b2('0x30')]]=_0x283bfc;_[_0x25b2('0x36')](_0x88cc44['$or'],_0x3b3691);}return _0x74c0fd[_0x25b2('0x1f')](_0x25b2('0x32'))['find'](_0x88cc44,_0x528dcc)[_0x25b2('0x26')](function(_0x5ebfdd){if(_0x5ebfdd&&_0x5ebfdd[_0x25b2('0x33')]){return _0x5ebfdd;}else{var _0x1a8d71=_[_0x25b2('0x34')](_0x38e1bc);if(_0x59fd85[_0x25b2('0x35')]){var _0x1c9711={};_0x1c9711[_0x59fd85[_0x25b2('0x35')]]=_0x283bfc;_[_0x25b2('0x36')](_0x1a8d71['$or'],_0x1c9711);}return _0x74c0fd[_0x25b2('0x1f')](_0x25b2('0x37'))[_0x25b2('0x24')](_0x1a8d71,_0x528dcc);}});}});case _0x25b2('0x17'):var _0x4921e3=_[_0x25b2('0x34')](_0x38e1bc);if(_0x59fd85[_0x25b2('0x30')]){var _0x108a23={};_0x108a23[_0x59fd85[_0x25b2('0x30')]]=_0x283bfc;_[_0x25b2('0x36')](_0x4921e3[_0x25b2('0x31')],_0x108a23);}return _0x74c0fd[_0x25b2('0x1f')](_0x25b2('0x32'))['find'](_0x4921e3,_0x528dcc)[_0x25b2('0x25')]();case _0x25b2('0x3b'):var _0x212f5a=_[_0x25b2('0x34')](_0x38e1bc);if(_0x59fd85[_0x25b2('0x35')]){var _0x108a23={};_0x108a23[_0x59fd85[_0x25b2('0x35')]]=_0x283bfc;_['merge'](_0x212f5a[_0x25b2('0x31')],_0x108a23);}return _0x74c0fd[_0x25b2('0x1f')]('Lead')['find'](_0x212f5a,_0x528dcc);case'account':var _0x50312a=_[_0x25b2('0x34')](_0x38e1bc);if(_0x59fd85[_0x25b2('0x39')]){var _0x108a23={};_0x108a23[_0x59fd85[_0x25b2('0x39')]]=_0x283bfc;_[_0x25b2('0x36')](_0x50312a['$or'],_0x108a23);}return _0x74c0fd['sobject'](_0x25b2('0x3a'))['find'](_0x50312a,_0x528dcc);default:return null;}})[_0x25b2('0x26')](function(_0x1942fd){if(_0x1942fd&&_0x1942fd[_0x25b2('0x33')]){var _0x24959f=_[_0x25b2('0x3c')](_0x1942fd);if(_0x24959f){return BPromise[_0x25b2('0x29')]({'id':_0x24959f['Id'],'name':_0x24959f[_0x25b2('0x2a')],'phone':_0x24959f[_0x25b2('0x3d')],'endUserType':_0x24959f['attributes'][_0x25b2('0x3e')][_0x25b2('0x3f')]()});}}})[_0x25b2('0x26')](function(_0x4c3287){if(_0x4c3287){logger[_0x25b2('0x1d')](_0x25b2('0x40'),_0x4c3287[_0x25b2('0x16')],_0x283bfc);return BPromise[_0x25b2('0x29')](_0x4c3287);}else{logger[_0x25b2('0x1d')](_0x25b2('0x41'),_0x283bfc);var _0x5ad3b4={'Phone':_0x283bfc};if(_0x59fd85[_0x25b2('0x42')]){if(_0x59fd85[_0x25b2('0x42')]==='contact'){logger[_0x25b2('0x1d')](_0x25b2('0x43'),_0x283bfc,_0x59fd85[_0x25b2('0x42')]);_0x5ad3b4['LastName']=_0x73c4f7!==_0x25b2('0x44')?_0x73c4f7:util['format'](_0x25b2('0x45'),_0x283bfc);}else if(_0x59fd85[_0x25b2('0x42')]===_0x25b2('0x3b')){logger['info'](_0x25b2('0x43'),_0x283bfc,_0x59fd85[_0x25b2('0x42')]);_0x5ad3b4[_0x25b2('0x46')]=_0x73c4f7!==_0x25b2('0x44')?_0x73c4f7:util[_0x25b2('0x47')](_0x25b2('0x45'),_0x283bfc);_0x5ad3b4[_0x25b2('0x48')]=_0x25b2('0x49');}else if(_0x59fd85[_0x25b2('0x42')]===_0x25b2('0x19')){logger[_0x25b2('0x1d')](_0x25b2('0x43'),_0x283bfc,_0x59fd85[_0x25b2('0x42')]);_0x5ad3b4[_0x25b2('0x2a')]=_0x73c4f7!==_0x25b2('0x44')?_0x73c4f7:util[_0x25b2('0x47')](_0x25b2('0x45'),_0x283bfc);}else{return null;}}return _0x74c0fd[_0x25b2('0x1f')](_[_0x25b2('0x4a')](_0x59fd85[_0x25b2('0x42')]))[_0x25b2('0x20')](_0x5ad3b4)['then'](function(_0x38e533){return BPromise[_0x25b2('0x29')]({'id':_0x38e533['id'],'endUserType':_0x59fd85[_0x25b2('0x42')]});});}});}function getCustomFields(_0x4d832c,_0x2c3a56){var _0x2e9fc7={};if(_0x4d832c[_0x25b2('0x33')]>0x0){_['forEach'](_0x4d832c,function(_0x1c519c){if(_[_0x25b2('0x4b')]([_0x25b2('0x4c'),_0x25b2('0x4d')],_0x1c519c[_0x25b2('0x3e')])&&_0x1c519c[_0x25b2('0x4e')]){_0x2e9fc7[_0x1c519c[_0x25b2('0x4e')]]=_0x1c519c[_0x25b2('0x4f')][_0x25b2('0x50')]();}else if(_0x1c519c[_0x25b2('0x3e')]===_0x25b2('0x51')&&_0x1c519c[_0x25b2('0x52')]&&_0x1c519c[_0x25b2('0x4e')]){_0x2c3a56[_0x1c519c[_0x25b2('0x52')]]&&(_0x2e9fc7[_0x1c519c[_0x25b2('0x4e')]]=_0x2c3a56[_0x1c519c[_0x25b2('0x52')]][_0x25b2('0x50')]());}else if(_0x1c519c[_0x25b2('0x3e')]===_0x25b2('0x53')&&_0x1c519c['Variable']&&_0x1c519c[_0x25b2('0x54')][_0x25b2('0x55')]&&_0x1c519c[_0x25b2('0x4e')]){_0x2c3a56[_0x1c519c['Variable'][_0x25b2('0x55')]['toLowerCase']()]&&(_0x2e9fc7[_0x1c519c['idField']]=_0x2c3a56[_0x1c519c['Variable']['name'][_0x25b2('0x3f')]()][_0x25b2('0x50')]());}});}return _0x2e9fc7;}function getConnection(_0x33e2db){var _0x249254=_0x33e2db['password'][_0x25b2('0x56')](_0x33e2db[_0x25b2('0x57')]);var _0x281e79=new jsforce[(_0x25b2('0x58'))]({'oauth2':{'loginUrl':_0x33e2db[_0x25b2('0x59')]||_0x25b2('0x5a'),'clientId':_0x33e2db[_0x25b2('0x5b')],'clientSecret':_0x33e2db[_0x25b2('0x5c')]}});return _0x281e79[_0x25b2('0x5d')](_0x33e2db[_0x25b2('0x5e')],_0x249254)[_0x25b2('0x26')](function(){logger[_0x25b2('0x1d')]('Connection\x20established.');return _0x281e79;});}exports[_0x25b2('0x5f')]=function(_0x435f88,_0x13cb24,_0x314336,_0xb154d8,_0x18a676,_0x3e8b00){var _0x1dc1c0,_0x967869,_0x353bed,_0x10b871;_0x3e8b00[_0x25b2('0x60')]=intUtil[_0x25b2('0x61')](_0x3e8b00[_0x25b2('0x60')]);_0x3e8b00[_0x25b2('0x59')]=intUtil['stripTrailingSlash'](_0x3e8b00[_0x25b2('0x59')]);if(_0x18a676&&_0x18a676[_0x25b2('0x62')]){logger[_0x25b2('0x1d')](_0x25b2('0x63'),'Recording\x20is\x20enabled!');_0x13cb24[_0x25b2('0x64')]=util[_0x25b2('0x47')](_0x25b2('0x65'),_0x3e8b00['serverUrl'],_0x13cb24[_0x25b2('0x66')],md5(_0x13cb24['uniqueid']));}else{_0x13cb24[_0x25b2('0x64')]='';}return getConnection(_0x3e8b00)[_0x25b2('0x26')](function(_0x4ce479){_0x10b871=_0x4ce479;return getUser(_0x3e8b00,_0xb154d8[_0x25b2('0x67')],_0x10b871);})[_0x25b2('0x26')](function(_0x3484c7){_0x1dc1c0=_0x3484c7;return getEndUser(_0x3e8b00,_0x314336,_0x13cb24[_0x25b2('0x68')],_0x13cb24[_0x25b2('0x69')],_0x10b871);})[_0x25b2('0x26')](function(_0xe7d81f){_0x967869=_0xe7d81f;return getTicket(_0x3e8b00,_0x1dc1c0,_0x967869,_0x314336,_0x13cb24,_0x314336[_0x25b2('0x6a')],_0x10b871,_0x25b2('0x5f'));})[_0x25b2('0x26')](function(_0x5deb41){_0x353bed=_0x5deb41;logger[_0x25b2('0x1d')](_0x25b2('0x6b'),_0x353bed['id']);logger[_0x25b2('0x1d')](_0x25b2('0x6c'),_0x353bed['id'],_0xb154d8[_0x25b2('0x55')],_0x3e8b00['type']);switch(_0x3e8b00['type']){case _0x25b2('0x6d'):emit(util[_0x25b2('0x47')](_0x25b2('0x6e'),_0xb154d8[_0x25b2('0x55')]),_0x25b2('0x6f'),{'recordId':_0x353bed['id']});break;case'newTab':emit(util[_0x25b2('0x47')](_0x25b2('0x6e'),_0xb154d8['name']),_0x25b2('0x70'),{'uri':util['format']('%s/%s/e',_0x10b871[_0x25b2('0x71')],_0x353bed['id'])});break;default:logger[_0x25b2('0x72')](_0x25b2('0x73'));}})[_0x25b2('0x74')](function(_0x5f4c8a){logger[_0x25b2('0x72')](_0x25b2('0x63'),_0x5f4c8a);});};exports['outbound']=function(_0x33d05e,_0x36b1be,_0x7cabf9,_0x204d51,_0x3cee72,_0x290af4,_0x3da103){var _0x8dd6be,_0x25c309,_0x3ee15c,_0x2c2e5f;_0x290af4['serverUrl']=intUtil[_0x25b2('0x61')](_0x290af4['serverUrl']);_0x290af4['remoteUri']=intUtil[_0x25b2('0x61')](_0x290af4[_0x25b2('0x59')]);if(_0x3da103&&_0x3da103['recordingFormat']&&_0x3da103['recordingFormat']!==_0x25b2('0x75')){logger[_0x25b2('0x1d')](_0x25b2('0x76'),_0x25b2('0x77'));_0x36b1be['recordingURL']=util[_0x25b2('0x47')](_0x25b2('0x65'),_0x290af4[_0x25b2('0x60')],_0x36b1be[_0x25b2('0x66')],md5(_0x36b1be[_0x25b2('0x66')]));}return getConnection(_0x290af4)[_0x25b2('0x26')](function(_0x354497){_0x2c2e5f=_0x354497;return getUser(_0x290af4,_0x204d51[_0x25b2('0x67')],_0x2c2e5f);})[_0x25b2('0x26')](function(_0x26b1c8){_0x8dd6be=_0x26b1c8;return getEndUser(_0x290af4,_0x7cabf9,_0x36b1be['destcalleridname'],_0x36b1be[_0x25b2('0x78')],_0x2c2e5f);})[_0x25b2('0x26')](function(_0x4b328a){_0x25c309=_0x4b328a;return getTicket(_0x290af4,_0x8dd6be,_0x25c309,_0x7cabf9,_0x36b1be,_0x7cabf9['Fields'],_0x2c2e5f,_0x25b2('0x79'));})[_0x25b2('0x26')](function(_0x1e36d8){_0x3ee15c=_0x1e36d8;logger['info'](_0x25b2('0x7a'),_0x3ee15c['id']);logger[_0x25b2('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3ee15c['id'],_0x204d51[_0x25b2('0x55')],_0x290af4[_0x25b2('0x3e')]);switch(_0x290af4[_0x25b2('0x3e')]){case _0x25b2('0x6d'):emit(util[_0x25b2('0x47')](_0x25b2('0x6e'),_0x204d51[_0x25b2('0x55')]),_0x25b2('0x6f'),{'recordId':_0x3ee15c['id']});break;case _0x25b2('0x7b'):emit(util[_0x25b2('0x47')](_0x25b2('0x6e'),_0x204d51[_0x25b2('0x55')]),_0x25b2('0x70'),{'uri':util[_0x25b2('0x47')](_0x25b2('0x7c'),_0x2c2e5f[_0x25b2('0x71')],_0x3ee15c['id'])});break;default:logger[_0x25b2('0x72')](_0x25b2('0x76'),_0x25b2('0x7d'));}})[_0x25b2('0x74')](function(_0x299477){logger[_0x25b2('0x72')](_0x25b2('0x76'),_0x299477);});};exports[_0x25b2('0x7e')]=function(_0x339630,_0x547f0c,_0x13f5a2,_0x5deb93,_0x375d64,_0x7a0b74){var _0x37fb15,_0x501511,_0x239869,_0x109699;_0x7a0b74[_0x25b2('0x60')]=intUtil[_0x25b2('0x61')](_0x7a0b74[_0x25b2('0x60')]);_0x7a0b74[_0x25b2('0x59')]=intUtil['stripTrailingSlash'](_0x7a0b74[_0x25b2('0x59')]);if(_0x375d64&&_0x375d64[_0x25b2('0x62')]){logger[_0x25b2('0x1d')]('['+_0x547f0c[_0x25b2('0x7f')][_0x25b2('0x80')]()+']',_0x25b2('0x77'));_0x547f0c[_0x25b2('0x64')]=util[_0x25b2('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x7a0b74['serverUrl'],_0x547f0c[_0x25b2('0x66')],md5(_0x547f0c['uniqueid']));}else{_0x547f0c['recordingURL']='';}return getConnection(_0x7a0b74)[_0x25b2('0x26')](function(_0x4fc0ad){_0x109699=_0x4fc0ad;if(!_[_0x25b2('0x21')](_0x5deb93)){return getUser(_0x7a0b74,_0x5deb93[_0x25b2('0x55')],_0x109699);}else{return getUser(_0x7a0b74,null,_0x109699);}})[_0x25b2('0x26')](function(_0x19297f){_0x37fb15=_0x19297f;return getEndUser(_0x7a0b74,_0x13f5a2,_0x547f0c['calleridname'],_0x547f0c[_0x25b2('0x69')],_0x109699);})[_0x25b2('0x26')](function(_0x47a31a){_0x501511=_0x47a31a;return getTicket(_0x7a0b74,_0x37fb15,_0x501511,_0x13f5a2,_0x547f0c,_0x13f5a2[_0x25b2('0x6a')],_0x109699);})[_0x25b2('0x26')](function(_0x36da3b){_0x239869=_0x36da3b;logger['info']('['+_0x547f0c[_0x25b2('0x7f')][_0x25b2('0x80')]()+_0x25b2('0x81'),_0x239869['id']);logger[_0x25b2('0x1d')]('['+_0x547f0c['lastevent'][_0x25b2('0x80')]()+_0x25b2('0x82'),_0x7a0b74[_0x25b2('0x3e')]);})[_0x25b2('0x74')](function(_0x37651a){logger[_0x25b2('0x72')]('['+_0x547f0c['lastevent'][_0x25b2('0x80')]()+']',_0x37651a);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 66dbc3c..cf27264 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36ee=['calleridnum','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','toLowerCase','content','toString','picklist','variable','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xe36e('0x0'));var util=require('util');var md5=require(_0xe36e('0x1'));var Redis=require(_0xe36e('0x2'));var intUtil=require(_0xe36e('0x3'));var config=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));config[_0xe36e('0x7')]=_[_0xe36e('0x8')](config[_0xe36e('0x7')],{'host':_0xe36e('0x9'),'port':0x18eb});var io=require(_0xe36e('0xa'))(new Redis(config[_0xe36e('0x7')]));function getAdminUser(_0x51b4bd,_0x74b4b7,_0x4aebdd,_0x2236e9,_0x123c16,_0x46f239){return new Promise(function(_0x47ce3a,_0xf119e4){var _0x48981b={'method':_0xe36e('0xb'),'uri':_0x2236e9+_0xe36e('0xc')+'&'+_0x123c16+'&'+_0x46f239,'auth':_0x74b4b7,'json':!![]};return rp(_0x48981b)[_0xe36e('0xd')](function(_0x2ad6fd){if(_0x2ad6fd[_0xe36e('0xe')][_0xe36e('0xf')]>0x0){_0x4aebdd[_0xe36e('0x10')]=_0x2ad6fd[_0xe36e('0xe')][0x0]['sys_id'];}logger[_0xe36e('0x11')]('['+[_0x51b4bd[_0xe36e('0x12')]()]+_0xe36e('0x13'),_0x4aebdd);_0x47ce3a(_0x4aebdd);})[_0xe36e('0x14')](function(_0x5c3f3c){logger[_0xe36e('0x15')]('['+[_0x51b4bd['toUpperCase']()]+']',_0x5c3f3c['message']);_0xf119e4(_0x5c3f3c[_0xe36e('0x16')]);});});}function getUser(_0x300f21,_0x26fb37,_0x278135,_0xd6828e,_0x924cd5){return function(_0x2096f6){logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x17'),_0x2096f6);return new Promise(function(_0x5792e8,_0x333554){if(intUtil[_0xe36e('0x18')](_0x2096f6['userEmail'])){var _0x21d9a3={'method':'GET','uri':_0x278135+_0xe36e('0x19')+_0x2096f6[_0xe36e('0x1a')]+'&'+_0xd6828e+'&'+_0x924cd5,'auth':_0x26fb37,'json':!![]};logger['info']('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x1b'),_0x21d9a3);return rp(_0x21d9a3)[_0xe36e('0xd')](function(_0x597331){logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x1c'),_0x597331);if(_0x597331[_0xe36e('0xe')][_0xe36e('0xf')]>0x0&&String(_0x597331[_0xe36e('0xe')][0x0]['active'])===_0xe36e('0x1d')){_0x2096f6[_0xe36e('0x1e')]=_0x597331[_0xe36e('0xe')][0x0][_0xe36e('0x1f')];}else{_0x2096f6[_0xe36e('0x1e')]=_0x2096f6['adminId'];_0x2096f6['userEmail']=_0x2096f6[_0xe36e('0x20')];}logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+_0xe36e('0x21'),_0x2096f6);_0x5792e8(_0x2096f6);})[_0xe36e('0x14')](function(_0x1507f9){logger[_0xe36e('0x15')]('['+[_0x300f21['toUpperCase']()]+']',_0x1507f9[_0xe36e('0x16')]);_0x333554(_0x1507f9[_0xe36e('0x16')]);});}else{logger[_0xe36e('0x11')]('['+[_0x300f21[_0xe36e('0x12')]()]+']\x20using\x20admin\x20profile');_0x2096f6[_0xe36e('0x1e')]=_0x2096f6['adminId'];_0x2096f6[_0xe36e('0x1a')]=_0x2096f6['adminEmail'];_0x5792e8(_0x2096f6);}});};}function createEndUser(_0x19f001,_0x5884cb,_0x410504,_0x4c5d98,_0x3b1045){logger['info']('['+[_0x19f001['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x410504);return new Promise(function(_0x5b5d53,_0x203fa2){var _0x1fc639={'method':'POST','uri':_0x4c5d98+'sys_user?'+_0x3b1045,'body':{'user_name':_0x410504[_0xe36e('0x22')],'roles':_0xe36e('0x23'),'first_name':_0x410504[_0xe36e('0x22')],'active':_0xe36e('0x1d'),'date_format':_0xe36e('0x24'),'phone':_0x410504[_0xe36e('0x22')]},'auth':_0x5884cb,'json':!![]};return rp(_0x1fc639)['then'](function(_0xb98e78){logger[_0xe36e('0x11')]('['+[_0x19f001['toUpperCase']()]+_0xe36e('0x25'),_0xb98e78[_0xe36e('0xe')]);_0x410504[_0xe36e('0x26')]=_0xb98e78[_0xe36e('0xe')][_0xe36e('0x1f')];_0x5b5d53(_0x410504);})[_0xe36e('0x14')](function(_0xfe4ee8){logger[_0xe36e('0x15')]('['+[_0x19f001[_0xe36e('0x12')]()]+']',_0xfe4ee8[_0xe36e('0x16')]);_0x203fa2(_0xfe4ee8[_0xe36e('0x16')]);});});}function getEndUser(_0x4c0c46,_0x4507b9,_0x59231e,_0x4a717e,_0x81cf9a){return function(_0x4f620d){logger[_0xe36e('0x11')]('['+[_0x4c0c46[_0xe36e('0x12')]()]+_0xe36e('0x27'),_0x4f620d);return new Promise(function(_0x235437,_0x4a6a2b){var _0x56135c={'method':_0xe36e('0xb'),'uri':_0x59231e+_0xe36e('0x28')+_0x4f620d[_0xe36e('0x22')]+'&'+_0x4a717e+'&'+_0x81cf9a,'auth':_0x4507b9,'json':!![]};return rp(_0x56135c)[_0xe36e('0xd')](function(_0x51894c){if(_0x51894c[_0xe36e('0xe')][_0xe36e('0xf')]>0x0){_0x4f620d[_0xe36e('0x26')]=_0x51894c['result'][0x0][_0xe36e('0x1f')];logger[_0xe36e('0x11')]('['+[_0x4c0c46['toUpperCase']()]+_0xe36e('0x29'),_0x4f620d);_0x235437(_0x4f620d);}else{return createEndUser(_0x4c0c46,_0x4507b9,_0x4f620d,_0x59231e,_0x4a717e)[_0xe36e('0xd')](function(_0x3a95d7){logger[_0xe36e('0x11')]('['+[_0x4c0c46[_0xe36e('0x12')]()]+_0xe36e('0x2a'),_0x3a95d7);_0x235437(_0x3a95d7);});}})[_0xe36e('0x14')](function(_0x20877d){logger[_0xe36e('0x15')]('['+[_0x4c0c46[_0xe36e('0x12')]()]+']',_0x20877d[_0xe36e('0x16')]);_0x4a6a2b(_0x20877d[_0xe36e('0x16')]);});});};}function getCustomFields(_0x3c4703,_0x5f396c){var _0x23d36e={};if(_0x3c4703[_0xe36e('0xf')]>0x0){_[_0xe36e('0x2b')](_0x3c4703,function(_0x11ee1d){if(_[_0xe36e('0x2c')](['string','picklist'],_0x11ee1d[_0xe36e('0x2d')])&&_0x11ee1d[_0xe36e('0x2e')]&&!_0x11ee1d[_0xe36e('0x2f')]){_0x23d36e[_0x11ee1d[_0xe36e('0x2e')][_0xe36e('0x30')]()]=_0x11ee1d[_0xe36e('0x31')][_0xe36e('0x32')]();}else if(_[_0xe36e('0x2c')](['string',_0xe36e('0x33')],_0x11ee1d[_0xe36e('0x2d')])&&_0x11ee1d['idField']&&_0x11ee1d[_0xe36e('0x2f')]){_0x23d36e[_0x11ee1d['idField'][_0xe36e('0x30')]()]=_0x11ee1d[_0xe36e('0x31')][_0xe36e('0x32')]();}else if(_0x11ee1d[_0xe36e('0x2d')]===_0xe36e('0x34')&&_0x11ee1d['variableName']&&_0x11ee1d[_0xe36e('0x35')]&&_0x11ee1d[_0xe36e('0x2f')]){_0x23d36e[_0x11ee1d[_0xe36e('0x35')][_0xe36e('0x30')]()]=_0x5f396c[_0x11ee1d[_0xe36e('0x36')]][_0xe36e('0x32')]();}else if(_0x11ee1d['type']===_0xe36e('0x37')&&_0x11ee1d[_0xe36e('0x38')]&&_0x11ee1d[_0xe36e('0x38')][_0xe36e('0x39')]&&_0x11ee1d[_0xe36e('0x35')]&&_0x11ee1d['customField']){_0x23d36e[_0x11ee1d[_0xe36e('0x35')][_0xe36e('0x30')]()]=_0x5f396c[_0x11ee1d[_0xe36e('0x38')][_0xe36e('0x39')][_0xe36e('0x30')]()][_0xe36e('0x32')]();}});}return _0x23d36e;}function getTicket(_0x229b36,_0x455cf9,_0x43c2d4,_0x52e744,_0x56956c,_0x101098){return function(_0x5e75da){logger[_0xe36e('0x11')]('['+[_0x229b36[_0xe36e('0x12')]()]+_0xe36e('0x3a'),_0x5e75da);return new Promise(function(_0x25aa09,_0x51641c){var _0x15c846=_0x229b36[_0xe36e('0x30')]()==='outbound'?_0x5e75da[_0xe36e('0x1e')]:_0x5e75da[_0xe36e('0x26')];var _0x2c26e6={'method':_0xe36e('0x3b'),'uri':_0x43c2d4+_0xe36e('0x3c')+'?'+_0x101098,'body':Object[_0xe36e('0x3d')]({},{'active':_0xe36e('0x1d'),'caller_id':_0x15c846,'assigned_to':_0x5e75da[_0xe36e('0x1e')],'short_description':intUtil[_0xe36e('0x3e')](_0x52e744[_0xe36e('0x3f')],_0x56956c,'\x20'),'description':intUtil[_0xe36e('0x3e')](_0x52e744[_0xe36e('0x40')],_0x56956c,'\x0a')},getCustomFields(_0x52e744[_0xe36e('0x41')],_0x56956c)),'auth':_0x455cf9,'json':!![]};return rp(_0x2c26e6)[_0xe36e('0xd')](function(_0x17d8da){logger['info']('['+[_0x229b36[_0xe36e('0x12')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x17d8da['result']);_0x5e75da[_0xe36e('0x42')]=_0x17d8da[_0xe36e('0xe')]['sys_id'];_0x5e75da[_0xe36e('0x43')]=_0x17d8da[_0xe36e('0xe')][_0xe36e('0x44')];logger[_0xe36e('0x11')]('['+[_0x229b36[_0xe36e('0x12')]()]+_0xe36e('0x45'),_0x5e75da);_0x25aa09(_0x5e75da);})[_0xe36e('0x14')](function(_0x41e10d){logger[_0xe36e('0x15')]('['+[_0x229b36['toUpperCase']()]+']',_0x41e10d[_0xe36e('0x16')]);_0x51641c(_0x41e10d[_0xe36e('0x16')]);});});};}function createRemoteTag(_0x546509,_0x1d0fac,_0x1da952,_0x3e1040){return new Promise(function(_0x206f75,_0x3770bd){var _0x53758e={'method':'POST','uri':_0x1da952+'label'+'?'+_0x3e1040,'body':{'short_description':_0x546509,'global':!![],'active':!![],'name':_0x546509},'auth':_0x1d0fac,'json':!![]};return rp(_0x53758e)['then'](function(_0x47605d){var _0x2fab4c=_0x47605d[_0xe36e('0xe')][_0xe36e('0x1f')];_0x206f75(_0x2fab4c);});});}function getRemoteTag(_0x9025cd,_0x2e0ef2,_0x7c3766,_0x17965c,_0x2493c3){return new Promise(function(_0x5045e6,_0x3385ea){var _0x478138={'method':'GET','uri':_0x7c3766+_0xe36e('0x46')+_0xe36e('0x47')+_0x9025cd+'&'+_0x17965c,'auth':_0x2e0ef2,'json':!![]};return rp(_0x478138)[_0xe36e('0xd')](function(_0x443154){if(_0x443154[_0xe36e('0xe')][_0xe36e('0xf')]>0x0){var _0x3cf731=_0x443154[_0xe36e('0xe')][0x0][_0xe36e('0x1f')];_0x5045e6(_0x3cf731);}else{return createRemoteTag(_0x9025cd,_0x2e0ef2,_0x7c3766,_0x17965c)[_0xe36e('0xd')](function(_0x56718a){_0x5045e6(_0x56718a);});}});});}function assignTagToIncident(_0x2cf7fc,_0x389e91,_0x6f979f,_0x3512ec,_0x3e4860){return new Promise(function(_0x3c78ea,_0x275142){var _0x14738a={'method':_0xe36e('0x3b'),'uri':_0x6f979f+_0xe36e('0x48')+'?'+_0x3e4860,'body':{'label':_0x2cf7fc,'table':_0xe36e('0x3c'),'id_type':_0xe36e('0x49'),'table_key':_0x3512ec[_0xe36e('0x42')],'title':_0xe36e('0x4a')+_0x3512ec['ticketNumber'],'id_display':_0x3512ec[_0xe36e('0x43')]},'auth':_0x389e91,'json':!![]};return rp(_0x14738a)[_0xe36e('0xd')](function(_0x49336b){_0x3c78ea();})[_0xe36e('0x14')](function(){_0x3c78ea();});});}function manageTags(_0x41bad0,_0x180dc3,_0x355a02,_0x1d8542,_0x34a2c3,_0x49deab,_0x3db651){return new Promise(function(_0x5b7185,_0x3b8ed8){var _0x1fc1e5=[];_0x180dc3[_0xe36e('0x2b')](function(_0x4148d0){_0x1fc1e5[_0xe36e('0x4b')](getRemoteTag(_0x4148d0,_0x355a02,_0x1d8542,_0x49deab,_0x3db651));});return Promise[_0xe36e('0x4c')](_0x1fc1e5)[_0xe36e('0xd')](function(_0xfea627){if(_0xfea627['length']){logger[_0xe36e('0x11')]('['+[_0x41bad0[_0xe36e('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0xfea627);var _0x3068e1=[];_0xfea627[_0xe36e('0x2b')](function(_0x1813d7){_0x3068e1[_0xe36e('0x4b')](assignTagToIncident(_0x1813d7,_0x355a02,_0x1d8542,_0x34a2c3,_0x49deab));});return Promise[_0xe36e('0x4c')](_0x3068e1)[_0xe36e('0xd')](function(){_0x5b7185();})[_0xe36e('0x14')](function(){_0x5b7185();});}else{_0x5b7185();}});});}function getTags(_0x48ff05,_0x2d34fc,_0x319006,_0x4289e2,_0x1b7268,_0x1fd5d1){return function(_0x43d8c2){return new Promise(function(_0xc1daf8,_0x441d87){var _0x42d246=[];var _0xeab452=_0x4289e2[_0xe36e('0x4d')];if(_0xeab452&&_0xeab452['length']>0x0){_0x42d246=_[_0xe36e('0x4e')](_0xeab452,_0xe36e('0x39'));}if(_0x42d246[_0xe36e('0xf')]>0x0){return manageTags(_0x48ff05,_0x42d246,_0x2d34fc,_0x319006,_0x43d8c2,_0x1b7268,_0x1fd5d1)[_0xe36e('0xd')](function(){_0xc1daf8(_0x43d8c2);});}else{_0xc1daf8(_0x43d8c2);}});};}function emit(_0x5ca608,_0x4a5b41,_0x324d26){var _0x55911b='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xe36e('0x4f')+'%255EORDERBYDESCnumber';var _0x2cbd78={'uri':_0x5ca608+_0xe36e('0x50')+_0x324d26+_0x55911b};io['to'](util[_0xe36e('0x51')](_0xe36e('0x52'),_0x4a5b41))[_0xe36e('0x53')](_0xe36e('0x54'),_0x2cbd78);}exports['cs']=function(_0x11e610,_0x14a9b4,_0x2a26f4,_0x5e7c92,_0x7b9501,_0x54f14c,_0x13ad07,_0x517c2a){var _0x3080ad={};var _0x209e45={'user':_0x54f14c[_0xe36e('0x55')],'pass':_0x54f14c[_0xe36e('0x56')]};var _0x483e06='sysparm_limit=1';var _0x5cccb7=_0xe36e('0x57');_0x54f14c[_0xe36e('0x58')]=intUtil[_0xe36e('0x59')](_0x54f14c[_0xe36e('0x58')]);_0x54f14c[_0xe36e('0x5a')]=intUtil['stripTrailingSlash'](_0x54f14c[_0xe36e('0x5a')]);var _0x1e216c=util['format'](_0xe36e('0x5b'),_0x54f14c['remoteUri']);_0x3080ad[_0xe36e('0x1a')]=!_[_0xe36e('0x5c')](_0x5e7c92)?_0x5e7c92[_0xe36e('0x5d')]:null;_0x3080ad[_0xe36e('0x20')]=_0x54f14c['email'];_0x3080ad[_0xe36e('0x22')]=_0x517c2a['toLowerCase']()==='outbound'?_0x14a9b4[_0xe36e('0x5e')]:_0x14a9b4[_0xe36e('0x5f')];_0x3080ad['callDirection']=_0x517c2a==='queue'||_0x517c2a===_0xe36e('0x60')?'queue':_0xe36e('0x61');var _0x36ddc0=util[_0xe36e('0x51')](_0xe36e('0x62'),_0x54f14c[_0xe36e('0x5a')],_0x14a9b4[_0xe36e('0x63')],md5(_0x14a9b4['uniqueid']));if(_0x7b9501&&_0x7b9501[_0xe36e('0x64')]){logger[_0xe36e('0x11')](_0xe36e('0x65'),_0xe36e('0x66'));_0x14a9b4['recordingURL']=_0x36ddc0;}else if(_0x13ad07&&_0x13ad07[_0xe36e('0x67')]&&_0x13ad07[_0xe36e('0x67')]!==_0xe36e('0x68')){logger[_0xe36e('0x11')]('[OUTBOUND]',_0xe36e('0x66'));_0x14a9b4['recordingURL']=_0x36ddc0;}else{_0x14a9b4[_0xe36e('0x69')]='';}return getAdminUser(_0x517c2a,_0x209e45,_0x3080ad,_0x1e216c,_0x5cccb7,_0x483e06)['then'](getUser(_0x517c2a,_0x209e45,_0x1e216c,_0x5cccb7,_0x483e06))[_0xe36e('0xd')](getEndUser(_0x517c2a,_0x209e45,_0x1e216c,_0x5cccb7,_0x483e06))['then'](getTicket(_0x517c2a,_0x209e45,_0x1e216c,_0x2a26f4,_0x14a9b4,_0x5cccb7))['then'](function(_0x2c2ce0){logger[_0xe36e('0x11')](util[_0xe36e('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2c2ce0[_0xe36e('0x42')]));logger[_0xe36e('0x11')](util['format'](_0xe36e('0x6a'),_0x517c2a));if(_0x517c2a!==_0xe36e('0x60')){logger[_0xe36e('0x11')]('['+[_0x517c2a['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x54f14c[_0xe36e('0x58')],_0x5e7c92[_0xe36e('0x39')],_0x2c2ce0[_0xe36e('0x42')]);}})[_0xe36e('0x14')](function(_0x411305){logger['error']('['+[_0x517c2a[_0xe36e('0x12')]()]+_0xe36e('0x6b'),util[_0xe36e('0x6c')](_0x411305,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2542=['%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','remoteUri','stripTrailingSlash','serverUrl','isNil','email','calleridnum','queue','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','toString','includes','idField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x2542,0x169));var _0x2254=function(_0x1eb1b9,_0x11fa82){_0x1eb1b9=_0x1eb1b9-0x0;var _0x1624bf=_0x2542[_0x1eb1b9];return _0x1624bf;};'use strict';var _=require(_0x2254('0x0'));var Promise=require(_0x2254('0x1'));var rp=require(_0x2254('0x2'));var util=require(_0x2254('0x3'));var md5=require('md5');var Redis=require(_0x2254('0x4'));var intUtil=require('./util');var config=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));config[_0x2254('0x8')]=_[_0x2254('0x9')](config['redis'],{'host':_0x2254('0xa'),'port':0x18eb});var io=require(_0x2254('0xb'))(new Redis(config[_0x2254('0x8')]));function getAdminUser(_0x3c45ec,_0x1637ad,_0x477b47,_0x263459,_0xbf1c18,_0xb395da){return new Promise(function(_0x1ae415,_0x38fb2b){var _0x5b1ab9={'method':_0x2254('0xc'),'uri':_0x263459+_0x2254('0xd')+'&'+_0xbf1c18+'&'+_0xb395da,'auth':_0x1637ad,'json':!![]};return rp(_0x5b1ab9)[_0x2254('0xe')](function(_0x143c90){if(_0x143c90['result']['length']>0x0){_0x477b47[_0x2254('0xf')]=_0x143c90[_0x2254('0x10')][0x0][_0x2254('0x11')];}logger[_0x2254('0x12')]('['+[_0x3c45ec[_0x2254('0x13')]()]+_0x2254('0x14'),_0x477b47);_0x1ae415(_0x477b47);})['catch'](function(_0x439238){logger[_0x2254('0x15')]('['+[_0x3c45ec['toUpperCase']()]+']',_0x439238[_0x2254('0x16')]);_0x38fb2b(_0x439238[_0x2254('0x16')]);});});}function getUser(_0xfb23cb,_0x145272,_0x26285a,_0xbc5548,_0x50f137){return function(_0x18baf4){logger['info']('['+[_0xfb23cb[_0x2254('0x13')]()]+_0x2254('0x17'),_0x18baf4);return new Promise(function(_0x170ffa,_0x25f8b2){if(intUtil[_0x2254('0x18')](_0x18baf4[_0x2254('0x19')])){var _0x497724={'method':'GET','uri':_0x26285a+'sys_user?sysparm_query=email%3D'+_0x18baf4[_0x2254('0x19')]+'&'+_0xbc5548+'&'+_0x50f137,'auth':_0x145272,'json':!![]};logger[_0x2254('0x12')]('['+[_0xfb23cb[_0x2254('0x13')]()]+_0x2254('0x1a'),_0x497724);return rp(_0x497724)[_0x2254('0xe')](function(_0x2339bc){logger['info']('['+[_0xfb23cb[_0x2254('0x13')]()]+_0x2254('0x1b'),_0x2339bc);if(_0x2339bc[_0x2254('0x10')]['length']>0x0&&String(_0x2339bc['result'][0x0]['active'])===_0x2254('0x1c')){_0x18baf4[_0x2254('0x1d')]=_0x2339bc[_0x2254('0x10')][0x0]['sys_id'];}else{_0x18baf4['userId']=_0x18baf4['adminId'];_0x18baf4['userEmail']=_0x18baf4['adminEmail'];}logger['info']('['+[_0xfb23cb[_0x2254('0x13')]()]+_0x2254('0x1e'),_0x18baf4);_0x170ffa(_0x18baf4);})[_0x2254('0x1f')](function(_0x265467){logger[_0x2254('0x15')]('['+[_0xfb23cb[_0x2254('0x13')]()]+']',_0x265467['message']);_0x25f8b2(_0x265467['message']);});}else{logger[_0x2254('0x12')]('['+[_0xfb23cb['toUpperCase']()]+_0x2254('0x20'));_0x18baf4[_0x2254('0x1d')]=_0x18baf4[_0x2254('0xf')];_0x18baf4[_0x2254('0x19')]=_0x18baf4[_0x2254('0x21')];_0x170ffa(_0x18baf4);}});};}function createEndUser(_0x482688,_0x1a8a0d,_0x2a789b,_0x21285d,_0x37af8b){logger[_0x2254('0x12')]('['+[_0x482688[_0x2254('0x13')]()]+_0x2254('0x22'),_0x2a789b);return new Promise(function(_0x22e791,_0x29975f){var _0x221db9={'method':_0x2254('0x23'),'uri':_0x21285d+_0x2254('0x24')+_0x37af8b,'body':{'user_name':_0x2a789b[_0x2254('0x25')],'roles':_0x2254('0x26'),'first_name':_0x2a789b[_0x2254('0x25')],'active':_0x2254('0x1c'),'date_format':_0x2254('0x27'),'phone':_0x2a789b[_0x2254('0x25')]},'auth':_0x1a8a0d,'json':!![]};return rp(_0x221db9)[_0x2254('0xe')](function(_0x4e3658){logger[_0x2254('0x12')]('['+[_0x482688[_0x2254('0x13')]()]+_0x2254('0x28'),_0x4e3658[_0x2254('0x10')]);_0x2a789b[_0x2254('0x29')]=_0x4e3658[_0x2254('0x10')][_0x2254('0x11')];_0x22e791(_0x2a789b);})[_0x2254('0x1f')](function(_0x5b84ce){logger['error']('['+[_0x482688[_0x2254('0x13')]()]+']',_0x5b84ce[_0x2254('0x16')]);_0x29975f(_0x5b84ce['message']);});});}function getEndUser(_0x240d4e,_0x135e7c,_0x21df8c,_0x16d8f3,_0x538e7b){return function(_0x4a2df0){logger[_0x2254('0x12')]('['+[_0x240d4e['toUpperCase']()]+_0x2254('0x2a'),_0x4a2df0);return new Promise(function(_0x10d749,_0x2ba6a1){var _0x141ddc={'method':_0x2254('0xc'),'uri':_0x21df8c+_0x2254('0x2b')+_0x4a2df0[_0x2254('0x25')]+'&'+_0x16d8f3+'&'+_0x538e7b,'auth':_0x135e7c,'json':!![]};return rp(_0x141ddc)['then'](function(_0x3234d4){if(_0x3234d4[_0x2254('0x10')][_0x2254('0x2c')]>0x0){_0x4a2df0[_0x2254('0x29')]=_0x3234d4[_0x2254('0x10')][0x0][_0x2254('0x11')];logger[_0x2254('0x12')]('['+[_0x240d4e[_0x2254('0x13')]()]+_0x2254('0x2d'),_0x4a2df0);_0x10d749(_0x4a2df0);}else{return createEndUser(_0x240d4e,_0x135e7c,_0x4a2df0,_0x21df8c,_0x16d8f3)[_0x2254('0xe')](function(_0x4f33de){logger[_0x2254('0x12')]('['+[_0x240d4e[_0x2254('0x13')]()]+_0x2254('0x2e'),_0x4f33de);_0x10d749(_0x4f33de);});}})[_0x2254('0x1f')](function(_0x4c7cc3){logger[_0x2254('0x15')]('['+[_0x240d4e[_0x2254('0x13')]()]+']',_0x4c7cc3[_0x2254('0x16')]);_0x2ba6a1(_0x4c7cc3[_0x2254('0x16')]);});});};}function getCustomFields(_0x216199,_0x2602db){var _0x423377={};if(_0x216199[_0x2254('0x2c')]>0x0){_['forEach'](_0x216199,function(_0x362ad1){if(_['includes']([_0x2254('0x2f'),_0x2254('0x30')],_0x362ad1[_0x2254('0x31')])&&_0x362ad1[_0x2254('0x32')]&&!_0x362ad1[_0x2254('0x33')]){_0x423377[_0x362ad1[_0x2254('0x32')][_0x2254('0x34')]()]=_0x362ad1['content'][_0x2254('0x35')]();}else if(_[_0x2254('0x36')]([_0x2254('0x2f'),_0x2254('0x30')],_0x362ad1[_0x2254('0x31')])&&_0x362ad1['idField']&&_0x362ad1[_0x2254('0x33')]){_0x423377[_0x362ad1[_0x2254('0x37')][_0x2254('0x34')]()]=_0x362ad1[_0x2254('0x38')][_0x2254('0x35')]();}else if(_0x362ad1['type']===_0x2254('0x39')&&_0x362ad1['variableName']&&_0x362ad1[_0x2254('0x37')]&&_0x362ad1[_0x2254('0x33')]){_0x423377[_0x362ad1[_0x2254('0x37')][_0x2254('0x34')]()]=_0x2602db[_0x362ad1[_0x2254('0x3a')]][_0x2254('0x35')]();}else if(_0x362ad1[_0x2254('0x31')]===_0x2254('0x3b')&&_0x362ad1[_0x2254('0x3c')]&&_0x362ad1[_0x2254('0x3c')][_0x2254('0x3d')]&&_0x362ad1[_0x2254('0x37')]&&_0x362ad1[_0x2254('0x33')]){_0x423377[_0x362ad1['idField'][_0x2254('0x34')]()]=_0x2602db[_0x362ad1[_0x2254('0x3c')][_0x2254('0x3d')]['toLowerCase']()][_0x2254('0x35')]();}});}return _0x423377;}function getTicket(_0x1c087b,_0x400bb3,_0xfdb855,_0x2e6603,_0x470241,_0x1f69bb){return function(_0x3c685e){logger[_0x2254('0x12')]('['+[_0x1c087b['toUpperCase']()]+_0x2254('0x3e'),_0x3c685e);return new Promise(function(_0x405eb2,_0x2c3055){var _0x32515f=_0x1c087b[_0x2254('0x34')]()===_0x2254('0x3f')?_0x3c685e[_0x2254('0x1d')]:_0x3c685e[_0x2254('0x29')];var _0x3ac691={'method':_0x2254('0x23'),'uri':_0xfdb855+'incident'+'?'+_0x1f69bb,'body':Object[_0x2254('0x40')]({},{'active':_0x2254('0x1c'),'caller_id':_0x32515f,'assigned_to':_0x3c685e['userId'],'short_description':intUtil[_0x2254('0x41')](_0x2e6603[_0x2254('0x42')],_0x470241,'\x20'),'description':intUtil[_0x2254('0x41')](_0x2e6603[_0x2254('0x43')],_0x470241,'\x0a')},getCustomFields(_0x2e6603['Fields'],_0x470241)),'auth':_0x400bb3,'json':!![]};return rp(_0x3ac691)[_0x2254('0xe')](function(_0x4219a8){logger['info']('['+[_0x1c087b[_0x2254('0x13')]()]+_0x2254('0x44'),_0x4219a8[_0x2254('0x10')]);_0x3c685e[_0x2254('0x45')]=_0x4219a8['result'][_0x2254('0x11')];_0x3c685e[_0x2254('0x46')]=_0x4219a8[_0x2254('0x10')]['number'];logger['info']('['+[_0x1c087b[_0x2254('0x13')]()]+_0x2254('0x47'),_0x3c685e);_0x405eb2(_0x3c685e);})['catch'](function(_0x1cf2a0){logger['error']('['+[_0x1c087b['toUpperCase']()]+']',_0x1cf2a0[_0x2254('0x16')]);_0x2c3055(_0x1cf2a0[_0x2254('0x16')]);});});};}function createRemoteTag(_0x3be0f3,_0x2bfec4,_0x3c6f6c,_0x593f63){return new Promise(function(_0x5eceb9,_0x1bd988){var _0x5e3fbc={'method':_0x2254('0x23'),'uri':_0x3c6f6c+_0x2254('0x48')+'?'+_0x593f63,'body':{'short_description':_0x3be0f3,'global':!![],'active':!![],'name':_0x3be0f3},'auth':_0x2bfec4,'json':!![]};return rp(_0x5e3fbc)[_0x2254('0xe')](function(_0x2fe9a7){var _0x49c60d=_0x2fe9a7[_0x2254('0x10')][_0x2254('0x11')];_0x5eceb9(_0x49c60d);});});}function getRemoteTag(_0x49fe68,_0x4ec44b,_0x1a2973,_0x591705,_0x2cc59c){return new Promise(function(_0x305ace,_0x2ef4a0){var _0x2cdcf1={'method':_0x2254('0xc'),'uri':_0x1a2973+'label'+'?sysparm_query=name%3D'+_0x49fe68+'&'+_0x591705,'auth':_0x4ec44b,'json':!![]};return rp(_0x2cdcf1)[_0x2254('0xe')](function(_0x5b1bd8){if(_0x5b1bd8[_0x2254('0x10')]['length']>0x0){var _0x4da493=_0x5b1bd8['result'][0x0][_0x2254('0x11')];_0x305ace(_0x4da493);}else{return createRemoteTag(_0x49fe68,_0x4ec44b,_0x1a2973,_0x591705)[_0x2254('0xe')](function(_0x1d4b90){_0x305ace(_0x1d4b90);});}});});}function assignTagToIncident(_0x3ea2d9,_0x13606e,_0x1cf757,_0x14b1ba,_0x25137c){return new Promise(function(_0x17673e,_0x40aa48){var _0x2e68b5={'method':_0x2254('0x23'),'uri':_0x1cf757+_0x2254('0x49')+'?'+_0x25137c,'body':{'label':_0x3ea2d9,'table':_0x2254('0x4a'),'id_type':_0x2254('0x4b'),'table_key':_0x14b1ba[_0x2254('0x45')],'title':_0x2254('0x4c')+_0x14b1ba[_0x2254('0x46')],'id_display':_0x14b1ba[_0x2254('0x46')]},'auth':_0x13606e,'json':!![]};return rp(_0x2e68b5)['then'](function(_0x329378){_0x17673e();})[_0x2254('0x1f')](function(){_0x17673e();});});}function manageTags(_0x3b1aae,_0x38be3b,_0x4c966a,_0x494347,_0x471fdd,_0x423c17,_0x1d73a3){return new Promise(function(_0x2eb345,_0x1021b2){var _0x53b55b=[];_0x38be3b[_0x2254('0x4d')](function(_0x2d8a53){_0x53b55b[_0x2254('0x4e')](getRemoteTag(_0x2d8a53,_0x4c966a,_0x494347,_0x423c17,_0x1d73a3));});return Promise['all'](_0x53b55b)['then'](function(_0x21bcd4){if(_0x21bcd4['length']){logger[_0x2254('0x12')]('['+[_0x3b1aae[_0x2254('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x21bcd4);var _0x3c091e=[];_0x21bcd4[_0x2254('0x4d')](function(_0x4d30a5){_0x3c091e[_0x2254('0x4e')](assignTagToIncident(_0x4d30a5,_0x4c966a,_0x494347,_0x471fdd,_0x423c17));});return Promise[_0x2254('0x4f')](_0x3c091e)['then'](function(){_0x2eb345();})['catch'](function(){_0x2eb345();});}else{_0x2eb345();}});});}function getTags(_0xde4e7,_0xa159a4,_0x486b82,_0x506d95,_0x48406e,_0x53fca8){return function(_0x1d880f){return new Promise(function(_0x5d0229,_0x1cabab){var _0x7bdd46=[];var _0xaa9767=_0x506d95[_0x2254('0x50')];if(_0xaa9767&&_0xaa9767['length']>0x0){_0x7bdd46=_[_0x2254('0x51')](_0xaa9767,'name');}if(_0x7bdd46[_0x2254('0x2c')]>0x0){return manageTags(_0xde4e7,_0x7bdd46,_0xa159a4,_0x486b82,_0x1d880f,_0x48406e,_0x53fca8)[_0x2254('0xe')](function(){_0x5d0229(_0x1d880f);});}else{_0x5d0229(_0x1d880f);}});};}function emit(_0x5ed07f,_0x43211c,_0x23a889){var _0x521111=_0x2254('0x52')+_0x2254('0x53')+_0x2254('0x54')+_0x2254('0x55');var _0x4f77e5={'uri':_0x5ed07f+_0x2254('0x56')+_0x23a889+_0x521111};io['to'](util[_0x2254('0x57')]('user:%s',_0x43211c))[_0x2254('0x58')](_0x2254('0x59'),_0x4f77e5);}exports['cs']=function(_0x49d611,_0x242e15,_0x566805,_0x7075b1,_0x516595,_0x3cbd35,_0x1f95b2,_0x5e86d3){var _0x334d31={};var _0x4c91ec={'user':_0x3cbd35[_0x2254('0x5a')],'pass':_0x3cbd35[_0x2254('0x5b')]};var _0x38294d='sysparm_limit=1';var _0x14c384='sysparm_display_value=true';_0x3cbd35[_0x2254('0x5c')]=intUtil[_0x2254('0x5d')](_0x3cbd35['remoteUri']);_0x3cbd35['serverUrl']=intUtil[_0x2254('0x5d')](_0x3cbd35[_0x2254('0x5e')]);var _0x451520=util[_0x2254('0x57')]('%s/api/now/table/',_0x3cbd35[_0x2254('0x5c')]);_0x334d31[_0x2254('0x19')]=!_[_0x2254('0x5f')](_0x7075b1)?_0x7075b1[_0x2254('0x60')]:null;_0x334d31['adminEmail']=_0x3cbd35[_0x2254('0x60')];_0x334d31[_0x2254('0x25')]=_0x5e86d3['toLowerCase']()===_0x2254('0x3f')?_0x242e15['destcalleridnum']:_0x242e15[_0x2254('0x61')];_0x334d31['callDirection']=_0x5e86d3==='queue'||_0x5e86d3==='unmanaged'?_0x2254('0x62'):'outbound';var _0x20c5ef=util[_0x2254('0x57')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3cbd35[_0x2254('0x5e')],_0x242e15[_0x2254('0x63')],md5(_0x242e15[_0x2254('0x63')]));if(_0x516595&&_0x516595[_0x2254('0x64')]){logger[_0x2254('0x12')](_0x2254('0x65'),'Recording\x20is\x20enabled!');_0x242e15['recordingURL']=_0x20c5ef;}else if(_0x1f95b2&&_0x1f95b2[_0x2254('0x66')]&&_0x1f95b2[_0x2254('0x66')]!==_0x2254('0x67')){logger[_0x2254('0x12')](_0x2254('0x68'),_0x2254('0x69'));_0x242e15[_0x2254('0x6a')]=_0x20c5ef;}else{_0x242e15[_0x2254('0x6a')]='';}return getAdminUser(_0x5e86d3,_0x4c91ec,_0x334d31,_0x451520,_0x14c384,_0x38294d)[_0x2254('0xe')](getUser(_0x5e86d3,_0x4c91ec,_0x451520,_0x14c384,_0x38294d))[_0x2254('0xe')](getEndUser(_0x5e86d3,_0x4c91ec,_0x451520,_0x14c384,_0x38294d))['then'](getTicket(_0x5e86d3,_0x4c91ec,_0x451520,_0x566805,_0x242e15,_0x14c384))[_0x2254('0xe')](function(_0x40cd61){logger['info'](util[_0x2254('0x57')]('The\x20ticket\x20ID\x20is:\x20%s',_0x40cd61[_0x2254('0x45')]));logger[_0x2254('0x12')](util['format'](_0x2254('0x6b'),_0x5e86d3));if(_0x5e86d3!=='unmanaged'){logger[_0x2254('0x12')]('['+[_0x5e86d3[_0x2254('0x13')]()]+']',_0x2254('0x6c'));emit(_0x3cbd35[_0x2254('0x5c')],_0x7075b1['name'],_0x40cd61[_0x2254('0x45')]);}})[_0x2254('0x1f')](function(_0x1ebc68){logger[_0x2254('0x15')]('['+[_0x5e86d3['toUpperCase']()]+_0x2254('0x6d'),util[_0x2254('0x6e')](_0x1ebc68,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 77bd96c..944e925 100644 --- a/server/services/ami/trigger/integration/sugarcrm.js +++ b/server/services/ami/trigger/integration/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e41=['[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','unmanaged','lastevent','toUpperCase','calleridnum','users','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','Creating\x20new\x20ticket...','Subjects','assigned_user_id','description','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','format','phone_home','find','Enduser\x20found!','resolve','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','content','type','variable','custom_fields','customVariable','Variable','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format'];(function(_0x599e61,_0x2d9c55){var _0x3415ab=function(_0x4e0baa){while(--_0x4e0baa){_0x599e61['push'](_0x599e61['shift']());}};_0x3415ab(++_0x2d9c55);}(_0x1e41,0x11c));var _0x11e4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1e41[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var rp=require(_0x11e4('0x0'));var BPromise=require(_0x11e4('0x1'));var md5=require('md5');var util=require(_0x11e4('0x2'));var Redis=require(_0x11e4('0x3'));var intUtil=require(_0x11e4('0x4'));var config=require(_0x11e4('0x5'));var logger=require('../../../../config/logger')(_0x11e4('0x6'));config[_0x11e4('0x7')]=_[_0x11e4('0x8')](config['redis'],{'host':_0x11e4('0x9'),'port':0x18eb});var io=require(_0x11e4('0xa'))(new Redis(config[_0x11e4('0x7')]));var def={'method':_0x11e4('0xb'),'json':!![]};function emit(_0x15ca35,_0x153e81,_0x10d05d){io['to'](_0x15ca35)['emit'](_0x153e81,_0x10d05d);}function getTicket(_0x3c1a5c,_0x1cc183,_0x2af972,_0x1c6896,_0x2e0ae7,_0x178022,_0x269d64,_0x213562){logger['info'](_0x11e4('0xc'));var _0x34c1c7=new Date();var _0x744a8a=[{'name':'name','value':intUtil['getString'](_0x1c6896[_0x11e4('0xd')],_0x2e0ae7,'\x20')},{'name':_0x11e4('0xe'),'value':_0x1cc183['id']},{'name':'created_by','value':_0x1cc183['id']},{'name':_0x11e4('0xf'),'value':intUtil[_0x11e4('0x10')](_0x1c6896[_0x11e4('0x11')],_0x2e0ae7,'\x0a')},{'name':_0x11e4('0x12'),'value':_0x34c1c7[_0x11e4('0x13')]()[_0x11e4('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x11e4('0x15'),'value':'0'},{'name':_0x11e4('0x16'),'value':'15'},{'name':_0x11e4('0x17'),'value':_0x2af972['id']},{'name':'parent_type','value':_0x11e4('0x18')},{'name':_0x11e4('0x19'),'value':_0x2af972[_0x11e4('0x1a')]},{'name':_0x11e4('0x1b'),'value':_0x213562}];if(_0x178022['length']){_['forEach'](_0x178022,function(_0xaddca2){if(_0x2e0ae7[_0xaddca2[_0x11e4('0x1c')]]){_0x744a8a[_0x11e4('0x1d')]({'name':_0xaddca2[_0x11e4('0x1e')],'value':_0x2e0ae7[_0xaddca2['variableName']]});}});}return request({'form':{'method':_0x11e4('0x1f'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x269d64['id'],'module_name':_0x11e4('0x22'),'name_value_list':_0x744a8a})}});}function getAuth(_0x37e46b){return util['format'](_0x11e4('0x23'),new Buffer(_0x37e46b[_0x11e4('0x24')]+':X')[_0x11e4('0x25')](_0x11e4('0x26')));}function getServerInfo(_0x424206){return request({'form':{'method':_0x11e4('0x27'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x424206['id']})}});}function getUser(_0x2f4bf5,_0x224f0f,_0x3ee634){if(!_[_0x11e4('0x28')](_0x224f0f)){logger[_0x11e4('0x29')](_0x11e4('0x2a'),_0x224f0f);return request({'form':{'method':_0x11e4('0x2b'),'input_type':'JSON','response_type':_0x11e4('0x20'),'rest_data':JSON['stringify']({'session':_0x3ee634['id'],'module_name':_0x11e4('0x2c'),'query':util['format'](_0x11e4('0x2d'),_0x224f0f),'order_by':'','offset':'0','select_fields':['id',_0x11e4('0x1a'),_0x11e4('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x11e4('0x2f')](function(_0x171b83){if(_0x171b83[_0x11e4('0x30')][_0x11e4('0x31')]){var _0xd078ed=_['find'](_0x171b83['entry_list'],function(_0x538786){return _0x538786[_0x11e4('0x32')][_0x11e4('0x2e')][_0x11e4('0x33')]===_0x224f0f;});if(_0xd078ed){logger['info'](_0x11e4('0x34'));return BPromise['resolve']({'id':_0xd078ed[_0x11e4('0x32')]['id'][_0x11e4('0x33')],'name':_0xd078ed[_0x11e4('0x32')][_0x11e4('0x1a')]['value']});}}logger['info'](_0x11e4('0x35'));return BPromise['resolve']({'id':_0x3ee634['name_value_list'][_0x11e4('0x36')]['value'],'name':_0x3ee634[_0x11e4('0x32')][_0x11e4('0x2e')][_0x11e4('0x33')]});});}else{logger[_0x11e4('0x29')](_0x11e4('0x37'));return BPromise['resolve']({'id':_0x3ee634[_0x11e4('0x32')][_0x11e4('0x36')][_0x11e4('0x33')],'name':_0x3ee634[_0x11e4('0x32')][_0x11e4('0x2e')][_0x11e4('0x33')]});}}function getEndUser(_0x11cba5,_0x2ed75d,_0x5f139b,_0x45f248){logger['info'](_0x11e4('0x38'),_0x5f139b);return request({'form':{'method':_0x11e4('0x2b'),'input_type':_0x11e4('0x20'),'response_type':'JSON','rest_data':JSON[_0x11e4('0x21')]({'session':_0x45f248['id'],'module_name':_0x11e4('0x18'),'query':util[_0x11e4('0x39')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x5f139b),'order_by':'','offset':'0','select_fields':['id',_0x11e4('0x1a'),_0x11e4('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x11e4('0x2f')](function(_0x31354e){if(_0x31354e[_0x11e4('0x30')][_0x11e4('0x31')]){var _0x31b425=_[_0x11e4('0x3b')](_0x31354e['entry_list'],function(_0x562dda){return _0x562dda[_0x11e4('0x32')][_0x11e4('0x3a')][_0x11e4('0x33')]===_0x5f139b;});if(_0x31b425){logger[_0x11e4('0x29')](_0x11e4('0x3c'));return BPromise[_0x11e4('0x3d')]({'id':_0x31b425[_0x11e4('0x32')]['id']['value'],'name':_0x31b425[_0x11e4('0x32')][_0x11e4('0x1a')][_0x11e4('0x33')],'phone':_0x31b425['name_value_list'][_0x11e4('0x3a')][_0x11e4('0x33')]});}}else{logger[_0x11e4('0x29')](_0x11e4('0x3e'));return request({'form':{'method':_0x11e4('0x1f'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x45f248['id'],'module_name':_0x11e4('0x18'),'name_value_list':[{'name':_0x11e4('0x3f'),'value':_0x2ed75d!==''?_0x2ed75d:util[_0x11e4('0x39')](_0x11e4('0x40'),_0x5f139b)},{'name':_0x11e4('0x3a'),'value':_0x5f139b}]})}})[_0x11e4('0x2f')](function(_0x55e1e8){logger['info'](_0x11e4('0x41'));return BPromise[_0x11e4('0x3d')]({'id':_0x55e1e8['id'],'name':_0x55e1e8[_0x11e4('0x30')][_0x11e4('0x3f')][_0x11e4('0x33')],'phone':_0x55e1e8[_0x11e4('0x30')][_0x11e4('0x3a')][_0x11e4('0x33')]});});}});}function request(_0x4bc275){logger[_0x11e4('0x42')](_0x11e4('0x43'),JSON['stringify'](_0x4bc275));return rp(_[_0x11e4('0x44')](def,_0x4bc275));}function getTags(_0x4a0877,_0xde09c1){var _0x50feb2=[];if(_0x4a0877&&_0x4a0877[_0x11e4('0x31')]>0x0){_0x50feb2=_[_0x11e4('0x45')](_0x4a0877,_0xde09c1);}return _0x50feb2;}function getCustomFields(_0x54db06,_0x148691){var _0x42bc8b=[];var _0x25f48f={'custom_fields':[]};if(_0x54db06[_0x11e4('0x31')]>0x0){_[_0x11e4('0x46')](_0x54db06,function(_0x26cea8){if(_0x26cea8['type']===_0x11e4('0x47')&&_0x26cea8[_0x11e4('0x48')]&&!_0x26cea8[_0x11e4('0x49')]){_0x25f48f[_0x26cea8[_0x11e4('0x48')][_0x11e4('0x4a')]()]=_0x26cea8[_0x11e4('0x4b')][_0x11e4('0x25')]();}else if(_0x26cea8['type']==='string'&&_0x26cea8[_0x11e4('0x1e')]&&_0x26cea8[_0x11e4('0x49')]){_0x25f48f['custom_fields'][_0x11e4('0x1d')]({'id':_0x26cea8[_0x11e4('0x1e')],'value':_0x26cea8[_0x11e4('0x4b')][_0x11e4('0x25')]()});}else if(_0x26cea8[_0x11e4('0x4c')]===_0x11e4('0x4d')&&_0x26cea8[_0x11e4('0x1c')]&&_0x26cea8['idField']&&_0x26cea8['customField']){_0x148691[_0x26cea8[_0x11e4('0x1c')]]&&_0x25f48f[_0x11e4('0x4e')][_0x11e4('0x1d')]({'id':_0x26cea8[_0x11e4('0x1e')],'value':_0x148691[_0x26cea8[_0x11e4('0x1c')]]['toString']()});}else if(_0x26cea8[_0x11e4('0x4c')]===_0x11e4('0x4f')&&_0x26cea8['Variable']&&_0x26cea8['Variable'][_0x11e4('0x1a')]&&_0x26cea8[_0x11e4('0x1e')]&&_0x26cea8['customField']){_0x148691[_0x26cea8[_0x11e4('0x50')][_0x11e4('0x1a')][_0x11e4('0x4a')]()]&&_0x25f48f[_0x11e4('0x4e')][_0x11e4('0x1d')]({'id':_0x26cea8[_0x11e4('0x1e')],'value':_0x148691[_0x26cea8[_0x11e4('0x50')][_0x11e4('0x1a')][_0x11e4('0x4a')]()][_0x11e4('0x25')]()});}});}return _0x25f48f;}function getConnection(_0x416e6d){return request({'method':_0x11e4('0xb'),'form':{'method':'login','input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x416e6d[_0x11e4('0x51')],'password':_0x416e6d[_0x11e4('0x52')],'encryption':'PLAIN'},'application':_0x11e4('0x53')})}})[_0x11e4('0x2f')](function(_0x22daa0){var _0x37f8a4=_0x22daa0;if(_0x37f8a4['id']){def[_0x11e4('0x54')]=_0x37f8a4['id'];return BPromise[_0x11e4('0x3d')](_0x37f8a4);}else{throw new Error(util['format'](_0x11e4('0x55'),_0x416e6d['id']));}});}function setRelationship(_0x52430c,_0x4e7e36,_0x2fdd3e,_0x5b1916){return request({'form':{'method':_0x11e4('0x56'),'input_type':_0x11e4('0x20'),'response_type':_0x11e4('0x20'),'rest_data':JSON[_0x11e4('0x21')]({'session':_0x52430c['id'],'module_name':_0x11e4('0x22'),'module_id':_0x2fdd3e['id'],'link_field_name':_0x5b1916,'related_ids':[_0x4e7e36['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x11e4('0x57')]=function(_0x2c329c,_0x7b51e6,_0x3e5a33,_0x53d0b9,_0x4288cc,_0x147336){var _0x2bdf70,_0x3d5738,_0xb2a8ff,_0x33251d;_0x147336[_0x11e4('0x58')]=intUtil['stripTrailingSlash'](_0x147336[_0x11e4('0x58')]);_0x147336[_0x11e4('0x59')]=intUtil[_0x11e4('0x5a')](_0x147336[_0x11e4('0x59')]);def[_0x11e4('0x5b')]=util[_0x11e4('0x39')](_0x11e4('0x5c'),_0x147336['remoteUri']);if(_0x4288cc&&_0x4288cc[_0x11e4('0x5d')]){logger[_0x11e4('0x29')](_0x11e4('0x5e'),_0x11e4('0x5f'));_0x7b51e6['recordingURL']=util['format'](_0x11e4('0x60'),_0x147336[_0x11e4('0x59')],_0x7b51e6[_0x11e4('0x61')],md5(_0x7b51e6['uniqueid']));}else{_0x7b51e6[_0x11e4('0x62')]='';}return getConnection(_0x147336)[_0x11e4('0x2f')](function(_0x39fcb8){_0x33251d=_0x39fcb8;return getUser(_0x147336,_0x53d0b9['name'],_0x33251d);})[_0x11e4('0x2f')](function(_0xc1d738){_0x2bdf70=_0xc1d738;logger[_0x11e4('0x29')]('The\x20User\x20ID\x20is:',_0x2bdf70['id']);return getEndUser(_0x147336,_0x7b51e6[_0x11e4('0x63')],_0x7b51e6['calleridnum'],_0x33251d);})[_0x11e4('0x2f')](function(_0x1fae32){_0x3d5738=_0x1fae32;logger[_0x11e4('0x29')](_0x11e4('0x64'),_0x3d5738['id']);return getTicket(_0x147336,_0x2bdf70,_0x3d5738,_0x3e5a33,_0x7b51e6,_0x3e5a33[_0x11e4('0x65')],_0x33251d,'Inbound');})[_0x11e4('0x2f')](function(_0x271312){_0xb2a8ff=_0x271312;logger[_0x11e4('0x29')](_0x11e4('0x66'));logger['info'](_0x11e4('0x67'),_0xb2a8ff['id']);return setRelationship(_0x33251d,_0x2bdf70,_0xb2a8ff,'users');})[_0x11e4('0x2f')](function(){return setRelationship(_0x33251d,_0x3d5738,_0xb2a8ff,'contacts');})[_0x11e4('0x2f')](function(){return getServerInfo(_0x33251d);})['then'](function(_0x57928d){var _0x464661=parseInt(_0x57928d[_0x11e4('0x68')][_0x11e4('0x69')](0x0));var _0x3be963=util[_0x11e4('0x39')](_0x11e4('0x6a'),_0x147336[_0x11e4('0x58')],_0xb2a8ff['id']);if(_0x464661>0x6){_0x3be963=util['format'](_0x11e4('0x6b'),_0x147336[_0x11e4('0x58')],_0xb2a8ff['id']);}logger['info'](_0x11e4('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x11e4('0x39')](_0x11e4('0x6c'),_0x53d0b9[_0x11e4('0x1a')]),'trigger:browser:url',{'uri':_0x3be963});})['catch'](function(_0x2ed5fa){logger['error'](_0x11e4('0x5e'),JSON['stringify'](_0x2ed5fa));});};exports[_0x11e4('0x6d')]=function(_0x5a0a57,_0x5954bb,_0x40fa30,_0x43d8de,_0x4e8a3e,_0x211607,_0x3ad275){var _0x402b4a,_0x489009,_0x338635,_0x46de8f;_0x211607['remoteUri']=intUtil[_0x11e4('0x5a')](_0x211607[_0x11e4('0x58')]);_0x211607[_0x11e4('0x59')]=intUtil[_0x11e4('0x5a')](_0x211607[_0x11e4('0x59')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x211607[_0x11e4('0x58')]);if(_0x3ad275&&_0x3ad275[_0x11e4('0x6e')]&&_0x3ad275[_0x11e4('0x6e')]!==_0x11e4('0x6f')){logger[_0x11e4('0x29')](_0x11e4('0x70'),_0x11e4('0x5f'));_0x5954bb['recordingURL']=util[_0x11e4('0x39')](_0x11e4('0x60'),_0x211607[_0x11e4('0x59')],_0x5954bb[_0x11e4('0x61')],md5(_0x5954bb[_0x11e4('0x61')]));}return getConnection(_0x211607)[_0x11e4('0x2f')](function(_0x15df67){_0x46de8f=_0x15df67;return getUser(_0x211607,_0x43d8de[_0x11e4('0x1a')],_0x46de8f);})[_0x11e4('0x2f')](function(_0x3aae42){_0x402b4a=_0x3aae42;logger[_0x11e4('0x29')](_0x11e4('0x71'),_0x402b4a['id']);return getEndUser(_0x211607,_0x5954bb[_0x11e4('0x72')],_0x5954bb[_0x11e4('0x73')],_0x46de8f);})[_0x11e4('0x2f')](function(_0x497cf0){_0x489009=_0x497cf0;logger[_0x11e4('0x29')](_0x11e4('0x64'),_0x489009['id']);return getTicket(_0x211607,_0x402b4a,_0x489009,_0x40fa30,_0x5954bb,_0x40fa30['Fields'],_0x46de8f,'Outbound');})[_0x11e4('0x2f')](function(_0x543d32){_0x338635=_0x543d32;logger[_0x11e4('0x29')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x338635['id']);return setRelationship(_0x46de8f,_0x402b4a,_0x338635,'users');})[_0x11e4('0x2f')](function(){return setRelationship(_0x46de8f,_0x489009,_0x338635,_0x11e4('0x74'));})[_0x11e4('0x2f')](function(){return getServerInfo(_0x46de8f);})['then'](function(_0x4d761b){var _0x3428af=parseInt(_0x4d761b[_0x11e4('0x68')][_0x11e4('0x69')](0x0));var _0x28b287=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x211607[_0x11e4('0x58')],_0x338635['id']);if(_0x3428af>0x6){_0x28b287=util['format'](_0x11e4('0x6b'),_0x211607[_0x11e4('0x58')],_0x338635['id']);}logger[_0x11e4('0x29')](_0x11e4('0x70'),_0x11e4('0x75'));emit(util[_0x11e4('0x39')](_0x11e4('0x6c'),_0x43d8de[_0x11e4('0x1a')]),_0x11e4('0x76'),{'uri':_0x28b287});})[_0x11e4('0x77')](function(_0x1fec04){logger[_0x11e4('0x78')]('[OUTBOUND]',JSON[_0x11e4('0x21')](_0x1fec04));});};exports[_0x11e4('0x79')]=function(_0x17bf40,_0x341c3a,_0x20c51c,_0x303d39,_0x436be9,_0x12b035){var _0x367a3b,_0x131f80,_0x24c65c,_0x478186;_0x12b035['remoteUri']=intUtil[_0x11e4('0x5a')](_0x12b035[_0x11e4('0x58')]);_0x12b035[_0x11e4('0x59')]=intUtil[_0x11e4('0x5a')](_0x12b035[_0x11e4('0x59')]);def[_0x11e4('0x5b')]=util[_0x11e4('0x39')](_0x11e4('0x5c'),_0x12b035['remoteUri']);if(_0x436be9&&_0x436be9[_0x11e4('0x5d')]){logger['info']('['+_0x341c3a[_0x11e4('0x7a')][_0x11e4('0x7b')]()+']',_0x11e4('0x5f'));_0x341c3a[_0x11e4('0x62')]=util[_0x11e4('0x39')](_0x11e4('0x60'),_0x12b035['serverUrl'],_0x341c3a[_0x11e4('0x61')],md5(_0x341c3a[_0x11e4('0x61')]));}else{_0x341c3a[_0x11e4('0x62')]='';}return getConnection(_0x12b035)[_0x11e4('0x2f')](function(_0x3c1679){_0x478186=_0x3c1679;if(!_[_0x11e4('0x28')](_0x303d39)){return getUser(_0x12b035,_0x303d39['name'],_0x478186);}else{return getUser(_0x12b035,null,_0x478186);}})[_0x11e4('0x2f')](function(_0x2041aa){_0x367a3b=_0x2041aa;logger['info'](_0x11e4('0x71'),_0x367a3b['id']);return getEndUser(_0x12b035,_0x341c3a['calleridname'],_0x341c3a[_0x11e4('0x7c')],_0x478186);})[_0x11e4('0x2f')](function(_0x429643){_0x131f80=_0x429643;logger[_0x11e4('0x29')](_0x11e4('0x64'),_0x131f80['id']);return getTicket(_0x12b035,_0x367a3b,_0x131f80,_0x20c51c,_0x341c3a,_0x20c51c['Fields'],_0x478186,'Inbound');})[_0x11e4('0x2f')](function(_0x16ef26){_0x24c65c=_0x16ef26;logger['info'](_0x11e4('0x66'));logger['info'](_0x11e4('0x67'),_0x24c65c['id']);return setRelationship(_0x478186,_0x367a3b,_0x24c65c,_0x11e4('0x7d'));})[_0x11e4('0x2f')](function(){return setRelationship(_0x478186,_0x131f80,_0x24c65c,_0x11e4('0x74'));})[_0x11e4('0x2f')](function(){return getServerInfo(_0x478186);})[_0x11e4('0x77')](function(_0x3ec9ea){logger[_0x11e4('0x78')]('['+_0x341c3a[_0x11e4('0x7a')][_0x11e4('0x7b')]()+']',JSON[_0x11e4('0x21')](_0x3ec9ea));});}; \ No newline at end of file +var _0x59b9=['base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','customField','content','push','variable','custom_fields','customVariable','Variable','toLowerCase','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Outbound','The\x20Ticket\x20ID\x20is:','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','toUpperCase','lastevent','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','forEach','variableName','idField','set_entry','JSON','format','Basic\x20%s','apiKey','toString'];(function(_0x209e64,_0x4c4f0f){var _0x3edd85=function(_0xfe3eb6){while(--_0xfe3eb6){_0x209e64['push'](_0x209e64['shift']());}};_0x3edd85(++_0x4c4f0f);}(_0x59b9,0x15b));var _0x959b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x59b9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x959b('0x0'));var rp=require('request-promise');var BPromise=require(_0x959b('0x1'));var md5=require(_0x959b('0x2'));var util=require(_0x959b('0x3'));var Redis=require(_0x959b('0x4'));var intUtil=require(_0x959b('0x5'));var config=require(_0x959b('0x6'));var logger=require(_0x959b('0x7'))('sugarcrm');config['redis']=_[_0x959b('0x8')](config[_0x959b('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x959b('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x4a82e5,_0x44793a,_0x3b14e0){io['to'](_0x4a82e5)[_0x959b('0xa')](_0x44793a,_0x3b14e0);}function getTicket(_0x230ec4,_0xfe635a,_0x153fd1,_0xbc247e,_0x3668ea,_0x5582b2,_0xa2a1ee,_0x105568){logger[_0x959b('0xb')]('Creating\x20new\x20ticket...');var _0x560fc8=new Date();var _0x17391c=[{'name':_0x959b('0xc'),'value':intUtil[_0x959b('0xd')](_0xbc247e[_0x959b('0xe')],_0x3668ea,'\x20')},{'name':_0x959b('0xf'),'value':_0xfe635a['id']},{'name':_0x959b('0x10'),'value':_0xfe635a['id']},{'name':_0x959b('0x11'),'value':intUtil[_0x959b('0xd')](_0xbc247e[_0x959b('0x12')],_0x3668ea,'\x0a')},{'name':_0x959b('0x13'),'value':_0x560fc8[_0x959b('0x14')]()['slice'](0x0,0x13)[_0x959b('0x15')]('T','\x20')},{'name':_0x959b('0x16'),'value':'0'},{'name':_0x959b('0x17'),'value':'15'},{'name':_0x959b('0x18'),'value':_0x153fd1['id']},{'name':_0x959b('0x19'),'value':'Contacts'},{'name':_0x959b('0x1a'),'value':_0x153fd1['name']},{'name':'direction','value':_0x105568}];if(_0x5582b2[_0x959b('0x1b')]){_[_0x959b('0x1c')](_0x5582b2,function(_0x4b44a1){if(_0x3668ea[_0x4b44a1[_0x959b('0x1d')]]){_0x17391c['push']({'name':_0x4b44a1[_0x959b('0x1e')],'value':_0x3668ea[_0x4b44a1[_0x959b('0x1d')]]});}});}return request({'form':{'method':_0x959b('0x1f'),'input_type':'JSON','response_type':_0x959b('0x20'),'rest_data':JSON['stringify']({'session':_0xa2a1ee['id'],'module_name':'Calls','name_value_list':_0x17391c})}});}function getAuth(_0x153e1d){return util[_0x959b('0x21')](_0x959b('0x22'),new Buffer(_0x153e1d[_0x959b('0x23')]+':X')[_0x959b('0x24')](_0x959b('0x25')));}function getServerInfo(_0x46230a){return request({'form':{'method':_0x959b('0x26'),'input_type':_0x959b('0x20'),'response_type':_0x959b('0x20'),'rest_data':JSON[_0x959b('0x27')]({'session':_0x46230a['id']})}});}function getUser(_0x248eae,_0x3c9497,_0x5627c6){if(!_[_0x959b('0x28')](_0x3c9497)){logger['info'](_0x959b('0x29'),_0x3c9497);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x959b('0x20'),'rest_data':JSON[_0x959b('0x27')]({'session':_0x5627c6['id'],'module_name':_0x959b('0x2a'),'query':util[_0x959b('0x21')](_0x959b('0x2b'),_0x3c9497),'order_by':'','offset':'0','select_fields':['id','name',_0x959b('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x959b('0x2d')](function(_0x4924cb){if(_0x4924cb['entry_list'][_0x959b('0x1b')]){var _0x3b1d4b=_[_0x959b('0x2e')](_0x4924cb['entry_list'],function(_0x55c3ec){return _0x55c3ec[_0x959b('0x2f')]['user_name'][_0x959b('0x30')]===_0x3c9497;});if(_0x3b1d4b){logger[_0x959b('0xb')](_0x959b('0x31'));return BPromise['resolve']({'id':_0x3b1d4b['name_value_list']['id'][_0x959b('0x30')],'name':_0x3b1d4b['name_value_list'][_0x959b('0xc')][_0x959b('0x30')]});}}logger[_0x959b('0xb')](_0x959b('0x32'));return BPromise[_0x959b('0x33')]({'id':_0x5627c6['name_value_list'][_0x959b('0x34')][_0x959b('0x30')],'name':_0x5627c6[_0x959b('0x2f')][_0x959b('0x2c')][_0x959b('0x30')]});});}else{logger['info'](_0x959b('0x35'));return BPromise[_0x959b('0x33')]({'id':_0x5627c6[_0x959b('0x2f')][_0x959b('0x34')]['value'],'name':_0x5627c6[_0x959b('0x2f')][_0x959b('0x2c')]['value']});}}function getEndUser(_0x226981,_0x5903dd,_0x5b1948,_0x482951){logger[_0x959b('0xb')](_0x959b('0x36'),_0x5b1948);return request({'form':{'method':_0x959b('0x37'),'input_type':_0x959b('0x20'),'response_type':_0x959b('0x20'),'rest_data':JSON[_0x959b('0x27')]({'session':_0x482951['id'],'module_name':_0x959b('0x38'),'query':util[_0x959b('0x21')](_0x959b('0x39'),_0x5b1948),'order_by':'','offset':'0','select_fields':['id',_0x959b('0xc'),_0x959b('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x959b('0x2d')](function(_0x10cfd3){if(_0x10cfd3[_0x959b('0x3b')][_0x959b('0x1b')]){var _0x39e351=_[_0x959b('0x2e')](_0x10cfd3[_0x959b('0x3b')],function(_0x20ddcb){return _0x20ddcb['name_value_list'][_0x959b('0x3a')][_0x959b('0x30')]===_0x5b1948;});if(_0x39e351){logger[_0x959b('0xb')](_0x959b('0x3c'));return BPromise[_0x959b('0x33')]({'id':_0x39e351['name_value_list']['id'][_0x959b('0x30')],'name':_0x39e351['name_value_list']['name'][_0x959b('0x30')],'phone':_0x39e351['name_value_list'][_0x959b('0x3a')][_0x959b('0x30')]});}}else{logger[_0x959b('0xb')](_0x959b('0x3d'));return request({'form':{'method':_0x959b('0x1f'),'input_type':_0x959b('0x20'),'response_type':_0x959b('0x20'),'rest_data':JSON[_0x959b('0x27')]({'session':_0x482951['id'],'module_name':'Contacts','name_value_list':[{'name':_0x959b('0x3e'),'value':_0x5903dd!==_0x959b('0x3f')?_0x5903dd:util['format'](_0x959b('0x40'),_0x5b1948)},{'name':'phone_home','value':_0x5b1948}]})}})[_0x959b('0x2d')](function(_0x5da875){logger[_0x959b('0xb')]('Enduser\x20created.');return BPromise[_0x959b('0x33')]({'id':_0x5da875['id'],'name':_0x5da875[_0x959b('0x3b')][_0x959b('0x3e')][_0x959b('0x30')],'phone':_0x5da875[_0x959b('0x3b')]['phone_home']['value']});});}});}function request(_0x1705ab){logger[_0x959b('0x41')](_0x959b('0x42'),JSON[_0x959b('0x27')](_0x1705ab));return rp(_[_0x959b('0x43')](def,_0x1705ab));}function getTags(_0x41cd20,_0x3752eb){var _0x71c12e=[];if(_0x41cd20&&_0x41cd20['length']>0x0){_0x71c12e=_[_0x959b('0x44')](_0x41cd20,_0x3752eb);}return _0x71c12e;}function getCustomFields(_0x754344,_0x57abef){var _0x2823d9=[];var _0x34f1db={'custom_fields':[]};if(_0x754344[_0x959b('0x1b')]>0x0){_[_0x959b('0x1c')](_0x754344,function(_0x2c285b){if(_0x2c285b[_0x959b('0x45')]===_0x959b('0x46')&&_0x2c285b[_0x959b('0x47')]&&!_0x2c285b[_0x959b('0x48')]){_0x34f1db[_0x2c285b[_0x959b('0x47')]['toLowerCase']()]=_0x2c285b[_0x959b('0x49')][_0x959b('0x24')]();}else if(_0x2c285b[_0x959b('0x45')]===_0x959b('0x46')&&_0x2c285b[_0x959b('0x1e')]&&_0x2c285b[_0x959b('0x48')]){_0x34f1db['custom_fields'][_0x959b('0x4a')]({'id':_0x2c285b[_0x959b('0x1e')],'value':_0x2c285b['content'][_0x959b('0x24')]()});}else if(_0x2c285b[_0x959b('0x45')]===_0x959b('0x4b')&&_0x2c285b[_0x959b('0x1d')]&&_0x2c285b[_0x959b('0x1e')]&&_0x2c285b[_0x959b('0x48')]){_0x57abef[_0x2c285b[_0x959b('0x1d')]]&&_0x34f1db[_0x959b('0x4c')]['push']({'id':_0x2c285b[_0x959b('0x1e')],'value':_0x57abef[_0x2c285b[_0x959b('0x1d')]][_0x959b('0x24')]()});}else if(_0x2c285b[_0x959b('0x45')]===_0x959b('0x4d')&&_0x2c285b[_0x959b('0x4e')]&&_0x2c285b[_0x959b('0x4e')][_0x959b('0xc')]&&_0x2c285b[_0x959b('0x1e')]&&_0x2c285b[_0x959b('0x48')]){_0x57abef[_0x2c285b[_0x959b('0x4e')][_0x959b('0xc')][_0x959b('0x4f')]()]&&_0x34f1db[_0x959b('0x4c')][_0x959b('0x4a')]({'id':_0x2c285b['idField'],'value':_0x57abef[_0x2c285b[_0x959b('0x4e')][_0x959b('0xc')][_0x959b('0x4f')]()][_0x959b('0x24')]()});}});}return _0x34f1db;}function getConnection(_0x927dd6){return request({'method':_0x959b('0x50'),'form':{'method':_0x959b('0x51'),'input_type':_0x959b('0x20'),'response_type':_0x959b('0x20'),'rest_data':JSON[_0x959b('0x27')]({'user_auth':{'user_name':_0x927dd6[_0x959b('0x52')],'password':_0x927dd6[_0x959b('0x53')],'encryption':'PLAIN'},'application':_0x959b('0x54')})}})[_0x959b('0x2d')](function(_0x1ea5b1){var _0x2c2b73=_0x1ea5b1;if(_0x2c2b73['id']){def[_0x959b('0x55')]=_0x2c2b73['id'];return BPromise[_0x959b('0x33')](_0x2c2b73);}else{throw new Error(util[_0x959b('0x21')](_0x959b('0x56'),_0x927dd6['id']));}});}function setRelationship(_0x2967db,_0x23d870,_0x40ce4e,_0xc1e3c5){return request({'form':{'method':_0x959b('0x57'),'input_type':_0x959b('0x20'),'response_type':'JSON','rest_data':JSON[_0x959b('0x27')]({'session':_0x2967db['id'],'module_name':_0x959b('0x58'),'module_id':_0x40ce4e['id'],'link_field_name':_0xc1e3c5,'related_ids':[_0x23d870['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x959b('0x59')]=function(_0x35e6c3,_0x58da5f,_0x2af1fe,_0xabc5c2,_0x66e2cd,_0x363958){var _0xa14dae,_0x57de3b,_0x36585b,_0x24a436;_0x363958[_0x959b('0x5a')]=intUtil[_0x959b('0x5b')](_0x363958[_0x959b('0x5a')]);_0x363958[_0x959b('0x5c')]=intUtil[_0x959b('0x5b')](_0x363958[_0x959b('0x5c')]);def[_0x959b('0x5d')]=util[_0x959b('0x21')](_0x959b('0x5e'),_0x363958['remoteUri']);if(_0x66e2cd&&_0x66e2cd[_0x959b('0x5f')]){logger[_0x959b('0xb')](_0x959b('0x60'),_0x959b('0x61'));_0x58da5f[_0x959b('0x62')]=util[_0x959b('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x363958[_0x959b('0x5c')],_0x58da5f[_0x959b('0x63')],md5(_0x58da5f[_0x959b('0x63')]));}else{_0x58da5f[_0x959b('0x62')]='';}return getConnection(_0x363958)[_0x959b('0x2d')](function(_0x2097f2){_0x24a436=_0x2097f2;return getUser(_0x363958,_0xabc5c2[_0x959b('0xc')],_0x24a436);})['then'](function(_0x13832e){_0xa14dae=_0x13832e;logger[_0x959b('0xb')](_0x959b('0x64'),_0xa14dae['id']);return getEndUser(_0x363958,_0x58da5f[_0x959b('0x65')],_0x58da5f[_0x959b('0x66')],_0x24a436);})[_0x959b('0x2d')](function(_0x2e6df4){_0x57de3b=_0x2e6df4;logger[_0x959b('0xb')](_0x959b('0x67'),_0x57de3b['id']);return getTicket(_0x363958,_0xa14dae,_0x57de3b,_0x2af1fe,_0x58da5f,_0x2af1fe[_0x959b('0x68')],_0x24a436,_0x959b('0x69'));})['then'](function(_0x12c3f1){_0x36585b=_0x12c3f1;logger[_0x959b('0xb')](_0x959b('0x6a'));logger[_0x959b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x36585b['id']);return setRelationship(_0x24a436,_0xa14dae,_0x36585b,_0x959b('0x6b'));})[_0x959b('0x2d')](function(){return setRelationship(_0x24a436,_0x57de3b,_0x36585b,'contacts');})[_0x959b('0x2d')](function(){return getServerInfo(_0x24a436);})[_0x959b('0x2d')](function(_0x4a83b5){var _0x12c680=parseInt(_0x4a83b5[_0x959b('0x6c')][_0x959b('0x6d')](0x0));var _0x2da9ea=util[_0x959b('0x21')](_0x959b('0x6e'),_0x363958[_0x959b('0x5a')],_0x36585b['id']);if(_0x12c680>0x6){_0x2da9ea=util[_0x959b('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x363958['remoteUri'],_0x36585b['id']);}logger[_0x959b('0xb')](_0x959b('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x959b('0x6f'),_0xabc5c2[_0x959b('0xc')]),_0x959b('0x70'),{'uri':_0x2da9ea});})['catch'](function(_0x290205){logger[_0x959b('0x71')](_0x959b('0x60'),JSON[_0x959b('0x27')](_0x290205));});};exports[_0x959b('0x72')]=function(_0x229daf,_0x5dcc4d,_0x1f915e,_0x12682b,_0x33c66c,_0x334065,_0x21dcca){var _0x2c8daf,_0x592aeb,_0x17b26a,_0xc9a54e;_0x334065[_0x959b('0x5a')]=intUtil['stripTrailingSlash'](_0x334065['remoteUri']);_0x334065['serverUrl']=intUtil[_0x959b('0x5b')](_0x334065['serverUrl']);def[_0x959b('0x5d')]=util[_0x959b('0x21')](_0x959b('0x5e'),_0x334065[_0x959b('0x5a')]);if(_0x21dcca&&_0x21dcca[_0x959b('0x73')]&&_0x21dcca['recordingFormat']!==_0x959b('0x74')){logger[_0x959b('0xb')](_0x959b('0x75'),_0x959b('0x61'));_0x5dcc4d[_0x959b('0x62')]=util['format'](_0x959b('0x76'),_0x334065[_0x959b('0x5c')],_0x5dcc4d[_0x959b('0x63')],md5(_0x5dcc4d['uniqueid']));}return getConnection(_0x334065)[_0x959b('0x2d')](function(_0x3dd109){_0xc9a54e=_0x3dd109;return getUser(_0x334065,_0x12682b[_0x959b('0xc')],_0xc9a54e);})[_0x959b('0x2d')](function(_0x40c236){_0x2c8daf=_0x40c236;logger[_0x959b('0xb')](_0x959b('0x64'),_0x2c8daf['id']);return getEndUser(_0x334065,_0x5dcc4d[_0x959b('0x77')],_0x5dcc4d['destcalleridnum'],_0xc9a54e);})[_0x959b('0x2d')](function(_0x354873){_0x592aeb=_0x354873;logger[_0x959b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x592aeb['id']);return getTicket(_0x334065,_0x2c8daf,_0x592aeb,_0x1f915e,_0x5dcc4d,_0x1f915e[_0x959b('0x68')],_0xc9a54e,_0x959b('0x78'));})[_0x959b('0x2d')](function(_0x2979cb){_0x17b26a=_0x2979cb;logger[_0x959b('0xb')](_0x959b('0x6a'));logger['info'](_0x959b('0x79'),_0x17b26a['id']);return setRelationship(_0xc9a54e,_0x2c8daf,_0x17b26a,_0x959b('0x6b'));})[_0x959b('0x2d')](function(){return setRelationship(_0xc9a54e,_0x592aeb,_0x17b26a,_0x959b('0x7a'));})['then'](function(){return getServerInfo(_0xc9a54e);})[_0x959b('0x2d')](function(_0x5248e2){var _0x48dab6=parseInt(_0x5248e2['version'][_0x959b('0x6d')](0x0));var _0x562cbc=util[_0x959b('0x21')](_0x959b('0x6e'),_0x334065['remoteUri'],_0x17b26a['id']);if(_0x48dab6>0x6){_0x562cbc=util[_0x959b('0x21')](_0x959b('0x7b'),_0x334065['remoteUri'],_0x17b26a['id']);}logger[_0x959b('0xb')](_0x959b('0x75'),_0x959b('0x7c'));emit(util['format']('user:%s',_0x12682b['name']),_0x959b('0x70'),{'uri':_0x562cbc});})[_0x959b('0x7d')](function(_0x2ac5c0){logger[_0x959b('0x71')](_0x959b('0x75'),JSON[_0x959b('0x27')](_0x2ac5c0));});};exports['unmanaged']=function(_0x5ef2b7,_0x87b5df,_0x298f96,_0x6f3dc6,_0x140987,_0x291e8b){var _0x3d28cd,_0x2bf4c2,_0x1265c7,_0x16e259;_0x291e8b[_0x959b('0x5a')]=intUtil[_0x959b('0x5b')](_0x291e8b[_0x959b('0x5a')]);_0x291e8b[_0x959b('0x5c')]=intUtil[_0x959b('0x5b')](_0x291e8b['serverUrl']);def[_0x959b('0x5d')]=util[_0x959b('0x21')](_0x959b('0x5e'),_0x291e8b[_0x959b('0x5a')]);if(_0x140987&&_0x140987['monitor_format']){logger['info']('['+_0x87b5df['lastevent'][_0x959b('0x7e')]()+']',_0x959b('0x61'));_0x87b5df[_0x959b('0x62')]=util[_0x959b('0x21')](_0x959b('0x76'),_0x291e8b['serverUrl'],_0x87b5df[_0x959b('0x63')],md5(_0x87b5df[_0x959b('0x63')]));}else{_0x87b5df[_0x959b('0x62')]='';}return getConnection(_0x291e8b)[_0x959b('0x2d')](function(_0x276b30){_0x16e259=_0x276b30;if(!_[_0x959b('0x28')](_0x6f3dc6)){return getUser(_0x291e8b,_0x6f3dc6['name'],_0x16e259);}else{return getUser(_0x291e8b,null,_0x16e259);}})[_0x959b('0x2d')](function(_0x4a61e7){_0x3d28cd=_0x4a61e7;logger[_0x959b('0xb')](_0x959b('0x64'),_0x3d28cd['id']);return getEndUser(_0x291e8b,_0x87b5df[_0x959b('0x65')],_0x87b5df[_0x959b('0x66')],_0x16e259);})[_0x959b('0x2d')](function(_0x15d599){_0x2bf4c2=_0x15d599;logger[_0x959b('0xb')](_0x959b('0x67'),_0x2bf4c2['id']);return getTicket(_0x291e8b,_0x3d28cd,_0x2bf4c2,_0x298f96,_0x87b5df,_0x298f96[_0x959b('0x68')],_0x16e259,'Inbound');})[_0x959b('0x2d')](function(_0x566bb8){_0x1265c7=_0x566bb8;logger[_0x959b('0xb')](_0x959b('0x6a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x1265c7['id']);return setRelationship(_0x16e259,_0x3d28cd,_0x1265c7,'users');})[_0x959b('0x2d')](function(){return setRelationship(_0x16e259,_0x2bf4c2,_0x1265c7,_0x959b('0x7a'));})[_0x959b('0x2d')](function(){return getServerInfo(_0x16e259);})[_0x959b('0x7d')](function(_0x5b2164){logger[_0x959b('0x71')]('['+_0x87b5df[_0x959b('0x7f')][_0x959b('0x7e')]()+']',JSON[_0x959b('0x27')](_0x5b2164));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index e3463d0..f65af28 100644 --- a/server/services/ami/trigger/integration/util.js +++ b/server/services/ami/trigger/integration/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f74=['customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','stripTrailingSlash','lastIndexOf','validateEmail','isNil','lodash','util','getString','sortBy','length','type','content','variable','variableName','push','toString'];(function(_0x327cbf,_0x114362){var _0x409cb8=function(_0x34f0a1){while(--_0x34f0a1){_0x327cbf['push'](_0x327cbf['shift']());}};_0x409cb8(++_0x114362);}(_0x4f74,0xf9));var _0x44f7=function(_0x536068,_0x3de52c){_0x536068=_0x536068-0x0;var _0x4a5db2=_0x4f74[_0x536068];return _0x4a5db2;};'use strict';var _=require(_0x44f7('0x0'));var util=require(_0x44f7('0x1'));exports[_0x44f7('0x2')]=function(_0x481881,_0x5d363c,_0x41bee1){var _0xd7eecc=[];if(_0x481881['length']>0x0){var _0xd24703=_[_0x44f7('0x3')](_0x481881,['id']);for(var _0x3d986d=0x0;_0x3d986d<_0xd24703[_0x44f7('0x4')];_0x3d986d++){var _0xdd2328=_0xd24703[_0x3d986d];if(_0xdd2328[_0x44f7('0x5')]==='string'){_0xd7eecc['push'](_0xdd2328[_0x44f7('0x6')]);}else if(_0xdd2328[_0x44f7('0x5')]===_0x44f7('0x7')&&_0xdd2328[_0x44f7('0x8')]){_0x5d363c[_0xdd2328[_0x44f7('0x8')]]&&_0xd7eecc[_0x44f7('0x9')](_0x5d363c[_0xdd2328['variableName']][_0x44f7('0xa')]());}else if(_0xdd2328[_0x44f7('0x5')]===_0x44f7('0xb')&&_0xdd2328['Variable']&&_0xdd2328[_0x44f7('0xc')][_0x44f7('0xd')]){_0x5d363c[_0xdd2328[_0x44f7('0xc')][_0x44f7('0xd')]['toLowerCase']()]&&_0xd7eecc[_0x44f7('0x9')](_0x5d363c[_0xdd2328['Variable'][_0x44f7('0xd')][_0x44f7('0xe')]()][_0x44f7('0xa')]());}else if(_0xdd2328[_0x44f7('0x5')]===_0x44f7('0xf')){if(_0xdd2328[_0x44f7('0x10')]===_0x44f7('0x11')&&_0xdd2328[_0x44f7('0x12')]){_0xd7eecc[_0x44f7('0x9')](util[_0x44f7('0x13')](_0x44f7('0x14'),_0xdd2328[_0x44f7('0x12')],_0xdd2328[_0x44f7('0x15')]));}else if(_0xdd2328['keyType']===_0x44f7('0x7')&&_0xdd2328[_0x44f7('0x8')]&&_0xdd2328['key']){_0x5d363c[_0xdd2328[_0x44f7('0x8')]]&&_0xd7eecc['push'](util[_0x44f7('0x13')]('%s:\x20%s',_0xdd2328[_0x44f7('0x12')],_0x5d363c[_0xdd2328[_0x44f7('0x8')]]));}else if(_0xdd2328[_0x44f7('0x10')]===_0x44f7('0xb')&&_0xdd2328[_0x44f7('0xc')]&&_0xdd2328['Variable'][_0x44f7('0xd')]&&_0xdd2328['key']){_0x5d363c[_0xdd2328['Variable'][_0x44f7('0xd')][_0x44f7('0xe')]()]&&_0xd7eecc['push'](util['format']('%s:\x20%s',_0xdd2328['key'],_0x5d363c[_0xdd2328['Variable'][_0x44f7('0xd')][_0x44f7('0xe')]()]));}}}}return _0xd7eecc['join'](_0x41bee1);};exports[_0x44f7('0x16')]=function(_0x20b3b2){var _0x412543=_0x20b3b2['slice'](-0x1);if(_0x412543==='/'){_0x20b3b2=_0x20b3b2['substring'](0x0,_0x20b3b2[_0x44f7('0x17')](_0x412543));}return _0x20b3b2;};exports[_0x44f7('0x18')]=function(_0x3db718){if(!_[_0x44f7('0x19')](_0x3db718)&&_0x3db718!==''){var _0x190c40=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x190c40['test'](String(_0x3db718)[_0x44f7('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xf2f5=['variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','slice','substring','test','lodash','util','getString','length','sortBy','type','string','push','content','variable'];(function(_0x5500ea,_0x4446ed){var _0x7b9f5b=function(_0x54f657){while(--_0x54f657){_0x5500ea['push'](_0x5500ea['shift']());}};_0x7b9f5b(++_0x4446ed);}(_0xf2f5,0x154));var _0x5f2f=function(_0x35dec3,_0x26389e){_0x35dec3=_0x35dec3-0x0;var _0x4f89a6=_0xf2f5[_0x35dec3];return _0x4f89a6;};'use strict';var _=require(_0x5f2f('0x0'));var util=require(_0x5f2f('0x1'));exports[_0x5f2f('0x2')]=function(_0x3e6c8a,_0x119f05,_0x3e2536){var _0x3f7a26=[];if(_0x3e6c8a[_0x5f2f('0x3')]>0x0){var _0x2aeeb6=_[_0x5f2f('0x4')](_0x3e6c8a,['id']);for(var _0x5ac410=0x0;_0x5ac410<_0x2aeeb6[_0x5f2f('0x3')];_0x5ac410++){var _0x239337=_0x2aeeb6[_0x5ac410];if(_0x239337[_0x5f2f('0x5')]===_0x5f2f('0x6')){_0x3f7a26[_0x5f2f('0x7')](_0x239337[_0x5f2f('0x8')]);}else if(_0x239337[_0x5f2f('0x5')]===_0x5f2f('0x9')&&_0x239337[_0x5f2f('0xa')]){_0x119f05[_0x239337[_0x5f2f('0xa')]]&&_0x3f7a26[_0x5f2f('0x7')](_0x119f05[_0x239337['variableName']][_0x5f2f('0xb')]());}else if(_0x239337[_0x5f2f('0x5')]==='customVariable'&&_0x239337['Variable']&&_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')]){_0x119f05[_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')][_0x5f2f('0xe')]()]&&_0x3f7a26[_0x5f2f('0x7')](_0x119f05[_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')][_0x5f2f('0xe')]()]['toString']());}else if(_0x239337[_0x5f2f('0x5')]===_0x5f2f('0xf')){if(_0x239337[_0x5f2f('0x10')]==='string'&&_0x239337[_0x5f2f('0x11')]){_0x3f7a26['push'](util[_0x5f2f('0x12')]('%s:\x20%s',_0x239337['key'],_0x239337['keyContent']));}else if(_0x239337[_0x5f2f('0x10')]===_0x5f2f('0x9')&&_0x239337[_0x5f2f('0xa')]&&_0x239337[_0x5f2f('0x11')]){_0x119f05[_0x239337[_0x5f2f('0xa')]]&&_0x3f7a26[_0x5f2f('0x7')](util[_0x5f2f('0x12')](_0x5f2f('0x13'),_0x239337[_0x5f2f('0x11')],_0x119f05[_0x239337['variableName']]));}else if(_0x239337['keyType']==='customVariable'&&_0x239337[_0x5f2f('0xc')]&&_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')]&&_0x239337['key']){_0x119f05[_0x239337[_0x5f2f('0xc')][_0x5f2f('0xd')]['toLowerCase']()]&&_0x3f7a26[_0x5f2f('0x7')](util[_0x5f2f('0x12')](_0x5f2f('0x13'),_0x239337[_0x5f2f('0x11')],_0x119f05[_0x239337[_0x5f2f('0xc')]['name'][_0x5f2f('0xe')]()]));}}}}return _0x3f7a26[_0x5f2f('0x14')](_0x3e2536);};exports[_0x5f2f('0x15')]=function(_0x492b55){var _0x1ebb78=_0x492b55[_0x5f2f('0x16')](-0x1);if(_0x1ebb78==='/'){_0x492b55=_0x492b55[_0x5f2f('0x17')](0x0,_0x492b55['lastIndexOf'](_0x1ebb78));}return _0x492b55;};exports['validateEmail']=function(_0x5a0254){if(!_['isNil'](_0x5a0254)&&_0x5a0254!==''){var _0x3b048a=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x3b048a[_0x5f2f('0x18')](String(_0x5a0254)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index baefe2b..da47775 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb12a=['lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridname','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','socket.io-emitter','emit','length','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','create','username','sessionName','HelpDesk','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','format','%s/webservice.php','remoteUri','query','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Contacts','Enduser\x20created.','accessKey','getchallenge','POST','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:'];(function(_0x5f083d,_0x24edd9){var _0x29a0f2=function(_0x1064d9){while(--_0x1064d9){_0x5f083d['push'](_0x5f083d['shift']());}};_0x29a0f2(++_0x24edd9);}(_0xb12a,0x145));var _0xab12=function(_0x5ebad0,_0x32efad){_0x5ebad0=_0x5ebad0-0x0;var _0x1e838d=_0xb12a[_0x5ebad0];return _0x1e838d;};'use strict';var _=require(_0xab12('0x0'));var rp=require(_0xab12('0x1'));var BPromise=require(_0xab12('0x2'));var md5=require(_0xab12('0x3'));var util=require(_0xab12('0x4'));var Redis=require(_0xab12('0x5'));var intUtil=require(_0xab12('0x6'));var config=require(_0xab12('0x7'));var logger=require(_0xab12('0x8'))(_0xab12('0x9'));config['redis']=_['defaults'](config[_0xab12('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xab12('0xb'))(new Redis(config['redis']));function emit(_0x2bcb8f,_0x478469,_0x186896){io['to'](_0x2bcb8f)[_0xab12('0xc')](_0x478469,_0x186896);}function getCustomFields(_0x4c3f90,_0x46dc59){var _0x8fb3d={};if(_0x4c3f90[_0xab12('0xd')]>0x0){_[_0xab12('0xe')](_0x4c3f90,function(_0x389d07){if(_['includes']([_0xab12('0xf'),_0xab12('0x10')],_0x389d07[_0xab12('0x11')])&&_0x389d07[_0xab12('0x12')]){_0x8fb3d[_0x389d07[_0xab12('0x12')]]=_0x389d07[_0xab12('0x13')][_0xab12('0x14')]();}else if(_0x389d07[_0xab12('0x11')]===_0xab12('0x15')&&_0x389d07[_0xab12('0x16')]&&_0x389d07[_0xab12('0x12')]&&_0x46dc59[_0x389d07[_0xab12('0x16')]]){_0x8fb3d[_0x389d07['idField']]=_0x46dc59[_0x389d07[_0xab12('0x16')]][_0xab12('0x14')]();}else if(_0x389d07[_0xab12('0x11')]===_0xab12('0x17')&&_0x389d07[_0xab12('0x18')]&&_0x389d07['Variable'][_0xab12('0x19')]&&_0x389d07[_0xab12('0x12')]&&_0x46dc59[_0x389d07[_0xab12('0x18')][_0xab12('0x19')]['toLowerCase']()]){_0x8fb3d[_0x389d07[_0xab12('0x12')]]=_0x46dc59[_0x389d07[_0xab12('0x18')][_0xab12('0x19')][_0xab12('0x1a')]()][_0xab12('0x14')]();}});}return _0x8fb3d;}function createTicket(_0x4cd4e9,_0x4a52ef,_0x3ce2d0,_0x4ff4aa,_0x382eeb,_0x1bdf68,_0x4395cb){logger[_0xab12('0x1b')](_0xab12('0x1c'));var _0x5e9c40=_[_0xab12('0x1d')]({'parent_id':'','assigned_user_id':_0x4a52ef['id'],'ticketpriorities':_0xab12('0x1e'),'ticketstatus':_0xab12('0x1f'),'ticket_title':intUtil[_0xab12('0x20')](_0x4ff4aa[_0xab12('0x21')],_0x382eeb,'\x20'),'description':intUtil[_0xab12('0x20')](_0x4ff4aa[_0xab12('0x22')],_0x382eeb,'\x0a'),'contact_id':_0x3ce2d0['id']},getCustomFields(_0x1bdf68,_0x382eeb));var _0x48cc30={'method':'POST','uri':util['format']('%s/webservice.php',_0x4cd4e9['remoteUri']),'form':{'operation':_0xab12('0x23'),'username':_0x4cd4e9[_0xab12('0x24')],'sessionName':_0x4395cb[_0xab12('0x25')],'elementType':_0xab12('0x26'),'element':JSON['stringify'](_0x5e9c40)},'json':!![]};return request(_0x48cc30)[_0xab12('0x27')](function(_0x3f1212){if(_0x3f1212[_0xab12('0x28')]){return BPromise[_0xab12('0x29')]({'id':_0x3f1212[_0xab12('0x2a')]['id']});}else{throw new Error(util['format'](_0xab12('0x2b'),JSON[_0xab12('0x2c')](_0x3f1212[_0xab12('0x2d')])));}})[_0xab12('0x2e')](function(_0x4bdd96){var _0x1988b4=_0x4bdd96[_0xab12('0x2f')]||0x1f4;logger[_0xab12('0x2d')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xab12('0x30'),_0x1988b4,JSON[_0xab12('0x2c')](_0x4bdd96));});}function getUser(_0x1a3465,_0x346105,_0x4ffb0b){if(intUtil[_0xab12('0x31')](_0x346105)){logger['info'](_0xab12('0x32'),_0x346105);return request({'method':_0xab12('0x33'),'uri':util[_0xab12('0x34')](_0xab12('0x35'),_0x1a3465[_0xab12('0x36')]),'qs':{'operation':_0xab12('0x37'),'username':_0x1a3465[_0xab12('0x24')],'sessionName':_0x4ffb0b[_0xab12('0x25')],'query':util[_0xab12('0x34')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x346105)},'json':!![]})[_0xab12('0x27')](function(_0x21f3ce){if(_0x21f3ce[_0xab12('0x28')]&&_0x21f3ce[_0xab12('0x2a')][_0xab12('0xd')]){logger[_0xab12('0x1b')]('Agent\x20found!');return BPromise[_0xab12('0x29')]({'id':_0x21f3ce[_0xab12('0x2a')][0x0]['id'],'email':_0x21f3ce[_0xab12('0x2a')][0x0][_0xab12('0x38')],'name':_0x21f3ce[_0xab12('0x2a')][0x0][_0xab12('0x39')]+'\x20'+_0x21f3ce['result'][_0xab12('0x3a')]});}else{logger['info'](_0xab12('0x3b'));return BPromise[_0xab12('0x29')]({'id':_0x4ffb0b[_0xab12('0x3c')],'email':_0x1a3465[_0xab12('0x24')],'name':_0xab12('0x3d')});}})[_0xab12('0x2e')](function(_0x1f04ec){var _0x471234=_0x1f04ec[_0xab12('0x2f')]||0x1f4;logger[_0xab12('0x2d')](_0xab12('0x3e'),_0xab12('0x3f'),_0x471234,JSON[_0xab12('0x2c')](_0x1f04ec));});}else{logger[_0xab12('0x1b')](_0xab12('0x3b'));return BPromise[_0xab12('0x29')]({'id':_0x4ffb0b[_0xab12('0x3c')],'email':_0x1a3465[_0xab12('0x24')],'name':_0xab12('0x3d')})[_0xab12('0x2e')](function(_0x169591){var _0x462ee1=_0x169591[_0xab12('0x2f')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x462ee1,JSON[_0xab12('0x2c')](_0x169591));});}}function getEndUser(_0x3e0af1,_0x88cb09,_0x47c520,_0xea882e){logger[_0xab12('0x1b')](_0xab12('0x40'),_0x47c520);return request({'method':_0xab12('0x33'),'uri':util[_0xab12('0x34')](_0xab12('0x35'),_0x3e0af1[_0xab12('0x36')]),'qs':{'operation':_0xab12('0x37'),'username':_0x3e0af1[_0xab12('0x24')],'sessionName':_0xea882e['sessionName'],'query':util[_0xab12('0x34')](_0xab12('0x41'),_0x47c520,_0x47c520,_0x47c520,_0x47c520,_0x47c520)},'json':!![]})[_0xab12('0x27')](function(_0x2ef39a){if(_0x2ef39a[_0xab12('0x28')]&&_0x2ef39a['result'][_0xab12('0xd')]){logger[_0xab12('0x1b')](_0xab12('0x42'));return BPromise['resolve']({'id':_0x2ef39a[_0xab12('0x2a')][0x0]['id'],'name':_0x2ef39a[_0xab12('0x2a')][0x0][_0xab12('0x43')]+'\x20'+_0x2ef39a['result'][0x0][_0xab12('0x44')],'phone':_0x47c520});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0xab12('0x34')]('%s/webservice.php',_0x3e0af1[_0xab12('0x36')]),'form':{'operation':_0xab12('0x23'),'sessionName':_0xea882e['sessionName'],'elementType':_0xab12('0x45'),'element':JSON['stringify']({'lastname':_0x88cb09,'phone':_0x47c520,'assigned_user_id':'\x20'})},'json':!![]})[_0xab12('0x27')](function(_0x1674e7){logger['info'](_0xab12('0x46'));return BPromise['resolve']({'id':_0x1674e7[_0xab12('0x2a')]['id'],'name':_0x1674e7[_0xab12('0x2a')][_0xab12('0x44')],'phone':_0x1674e7[_0xab12('0x2a')]['phone']});})['catch'](function(_0x11b7ba){var _0x3cc1c6=_0x11b7ba['statusCode']||0x1f4;logger[_0xab12('0x2d')](_0xab12('0x3e'),'getEndUser',_0x3cc1c6,JSON[_0xab12('0x2c')](_0x11b7ba));});}});}function getConnection(_0x14a96a){var _0x1a29ab=_0x14a96a[_0xab12('0x24')];var _0x3de648=_0x14a96a[_0xab12('0x47')];return request({'method':_0xab12('0x33'),'uri':util['format'](_0xab12('0x35'),_0x14a96a[_0xab12('0x36')]),'qs':{'operation':_0xab12('0x48'),'username':_0x1a29ab},'json':!![]})['then'](function(_0x1fb944){if(_0x1fb944['success']){return request({'method':_0xab12('0x49'),'uri':util[_0xab12('0x34')](_0xab12('0x35'),_0x14a96a[_0xab12('0x36')]),'form':{'operation':_0xab12('0x4a'),'username':_0x1a29ab,'accessKey':md5(_0x1fb944['result'][_0xab12('0x4b')]+_0x3de648)},'json':!![]});}})[_0xab12('0x27')](function(_0x46de13){if(_0x46de13[_0xab12('0x28')]){return BPromise[_0xab12('0x29')](_0x46de13[_0xab12('0x2a')]);}else{throw new Error(util[_0xab12('0x34')](_0xab12('0x4c'),_0x14a96a['id']));}})[_0xab12('0x2e')](function(_0x4bc751){var _0x522cf6=_0x4bc751['statusCode']||0x1f4;logger[_0xab12('0x2d')](_0xab12('0x3e'),_0xab12('0x4d'),_0x522cf6,JSON[_0xab12('0x2c')](_0x4bc751));});}function request(_0x5e4e60){logger[_0xab12('0x1b')](_0xab12('0x4e'),JSON[_0xab12('0x2c')](_0x5e4e60));return rp(_0x5e4e60);}exports[_0xab12('0x4f')]=function(_0x4ca825,_0x57ed63,_0x2ab8f9,_0x5f53fe,_0x532177,_0x49f410){var _0x1cf6f5,_0x4b4ac5,_0x3caa1a,_0x58617b;_0x49f410[_0xab12('0x36')]=intUtil['stripTrailingSlash'](_0x49f410[_0xab12('0x36')]);if(_0x532177&&_0x532177[_0xab12('0x50')]){logger[_0xab12('0x1b')](_0xab12('0x51'),'Recording\x20is\x20enabled!');_0x57ed63['recordingURL']=util[_0xab12('0x34')](_0xab12('0x52'),_0x49f410[_0xab12('0x53')],_0x57ed63[_0xab12('0x54')],md5(_0x57ed63[_0xab12('0x54')]));}else{_0x57ed63[_0xab12('0x55')]='';}return getConnection(_0x49f410)[_0xab12('0x27')](function(_0x121553){_0x58617b=_0x121553;return getUser(_0x49f410,_0x5f53fe[_0xab12('0x56')],_0x58617b);})[_0xab12('0x27')](function(_0xf0d53d){_0x1cf6f5=_0xf0d53d;logger[_0xab12('0x1b')]('The\x20User\x20ID\x20is:',_0x1cf6f5['id']);return getEndUser(_0x49f410,_0x57ed63['calleridname'],_0x57ed63[_0xab12('0x57')],_0x58617b);})[_0xab12('0x27')](function(_0x253172){_0x4b4ac5=_0x253172;logger[_0xab12('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x4b4ac5['id']);return createTicket(_0x49f410,_0x1cf6f5,_0x4b4ac5,_0x2ab8f9,_0x57ed63,_0x2ab8f9[_0xab12('0x58')],_0x58617b);})[_0xab12('0x27')](function(_0x337227){_0x3caa1a=_0x337227;logger[_0xab12('0x1b')](_0xab12('0x59'));logger[_0xab12('0x1b')](_0xab12('0x5a'),_0x3caa1a['id']);var _0x1cfcde=util[_0xab12('0x34')](_0xab12('0x5b'),_0x49f410[_0xab12('0x36')],_[_0xab12('0x5c')](_0x3caa1a['id'],'x')[0x1]);logger[_0xab12('0x1b')](_0xab12('0x51'),_0xab12('0x5d'));emit(util[_0xab12('0x34')]('user:%s',_0x5f53fe[_0xab12('0x19')]),_0xab12('0x5e'),{'uri':_0x1cfcde});})[_0xab12('0x2e')](function(_0x2fa298){logger['error'](_0xab12('0x51'),JSON['stringify'](_0x2fa298));});};exports[_0xab12('0x5f')]=function(_0x1ef9f4,_0x511a1c,_0x136e0e,_0x509511,_0x464f16,_0x545948,_0x4262ad){var _0x3128e3,_0x599bfc,_0x5a6ccf,_0x356740;_0x545948[_0xab12('0x36')]=intUtil[_0xab12('0x60')](_0x545948[_0xab12('0x36')]);_0x545948[_0xab12('0x53')]=intUtil[_0xab12('0x60')](_0x545948[_0xab12('0x53')]);if(_0x4262ad&&_0x4262ad[_0xab12('0x61')]&&_0x4262ad[_0xab12('0x61')]!==_0xab12('0x62')){logger['info'](_0xab12('0x63'),'Recording\x20is\x20enabled!');_0x511a1c['recordingURL']=util[_0xab12('0x34')](_0xab12('0x52'),_0x545948[_0xab12('0x53')],_0x511a1c[_0xab12('0x54')],md5(_0x511a1c[_0xab12('0x54')]));}return getConnection(_0x545948)['then'](function(_0x5b9d96){_0x356740=_0x5b9d96;return getUser(_0x545948,_0x509511['email'],_0x356740);})['then'](function(_0x22ea21){_0x3128e3=_0x22ea21;logger[_0xab12('0x1b')](_0xab12('0x64'),_0x3128e3['id']);return getEndUser(_0x545948,_0x511a1c[_0xab12('0x65')],_0x511a1c['destcalleridnum'],_0x356740);})[_0xab12('0x27')](function(_0x4296c7){_0x599bfc=_0x4296c7;logger['info'](_0xab12('0x66'),_0x599bfc['id']);return createTicket(_0x545948,_0x3128e3,_0x599bfc,_0x136e0e,_0x511a1c,_0x136e0e['Fields'],_0x356740);})[_0xab12('0x27')](function(_0x252190){_0x5a6ccf=_0x252190;logger['info'](_0xab12('0x59'));logger[_0xab12('0x1b')](_0xab12('0x5a'),_0x5a6ccf['id']);var _0x64e6cd=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x545948[_0xab12('0x36')],_[_0xab12('0x5c')](_0x5a6ccf['id'],'x')[0x1]);logger[_0xab12('0x1b')](_0xab12('0x63'),_0xab12('0x5d'));emit(util[_0xab12('0x34')]('user:%s',_0x509511[_0xab12('0x19')]),_0xab12('0x5e'),{'uri':_0x64e6cd});})['catch'](function(_0x4d1381){logger[_0xab12('0x2d')]('[OUTBOUND]',JSON[_0xab12('0x2c')](_0x4d1381));});};exports['unmanaged']=function(_0xba1887,_0x2ec8c6,_0x27dd6b,_0x3cd4e1,_0x5dde58,_0x548815){var _0x5ec6e2,_0x3917a7,_0x5d8c75,_0x3c36f9;_0x548815['remoteUri']=intUtil[_0xab12('0x60')](_0x548815[_0xab12('0x36')]);_0x548815[_0xab12('0x53')]=intUtil[_0xab12('0x60')](_0x548815[_0xab12('0x53')]);if(_0x5dde58&&_0x5dde58['monitor_format']){logger[_0xab12('0x1b')]('['+_0x2ec8c6[_0xab12('0x67')][_0xab12('0x68')]()+']',_0xab12('0x69'));_0x2ec8c6[_0xab12('0x55')]=util[_0xab12('0x34')](_0xab12('0x52'),_0x548815[_0xab12('0x53')],_0x2ec8c6[_0xab12('0x54')],md5(_0x2ec8c6[_0xab12('0x54')]));}else{_0x2ec8c6[_0xab12('0x55')]='';}return getConnection(_0x548815)['then'](function(_0x5454c5){_0x3c36f9=_0x5454c5;return getUser(_0x548815,'',_0x3c36f9);})[_0xab12('0x27')](function(_0x11d7ee){_0x5ec6e2=_0x11d7ee;logger[_0xab12('0x1b')]('The\x20User\x20ID\x20is:',_0x5ec6e2['id']);return getEndUser(_0x548815,_0x2ec8c6[_0xab12('0x6a')],_0x2ec8c6[_0xab12('0x57')],_0x3c36f9);})[_0xab12('0x27')](function(_0x8c9d0f){_0x3917a7=_0x8c9d0f;logger[_0xab12('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x3917a7['id']);return createTicket(_0x548815,_0x5ec6e2,_0x3917a7,_0x27dd6b,_0x2ec8c6,_0x27dd6b[_0xab12('0x58')],_0x3c36f9);})['then'](function(_0x4735e5){_0x5d8c75=_0x4735e5;logger[_0xab12('0x1b')](_0xab12('0x59'));logger[_0xab12('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x5d8c75['id']);})[_0xab12('0x2e')](function(_0x8328ec){logger[_0xab12('0x2d')]('['+_0x2ec8c6[_0xab12('0x67')]['toUpperCase']()+']',JSON[_0xab12('0x2c')](_0x8328ec));});}; \ No newline at end of file +var _0x6fba=['[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','sessionName','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','create','Contacts','phone','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','user:%s','trigger:browser:url','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','Ticket\x20created!','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','length','includes','string','picklist','type','idField','variable','variableName','toString','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','format','%s/webservice.php','remoteUri','HelpDesk','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','catch','statusCode','error','createTicket','validateEmail','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x6fba,0x97));var _0xa6fb=function(_0x2421ce,_0x270a64){_0x2421ce=_0x2421ce-0x0;var _0x3a28f9=_0x6fba[_0x2421ce];return _0x3a28f9;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xa6fb('0x0'));var intUtil=require(_0xa6fb('0x1'));var config=require(_0xa6fb('0x2'));var logger=require(_0xa6fb('0x3'))('vTiger');config['redis']=_[_0xa6fb('0x4')](config[_0xa6fb('0x5')],{'host':_0xa6fb('0x6'),'port':0x18eb});var io=require(_0xa6fb('0x7'))(new Redis(config[_0xa6fb('0x5')]));function emit(_0x44d1b6,_0x4ab390,_0x1fbd2a){io['to'](_0x44d1b6)[_0xa6fb('0x8')](_0x4ab390,_0x1fbd2a);}function getCustomFields(_0x2746ee,_0x491880){var _0x557b01={};if(_0x2746ee[_0xa6fb('0x9')]>0x0){_['forEach'](_0x2746ee,function(_0x44190a){if(_[_0xa6fb('0xa')]([_0xa6fb('0xb'),_0xa6fb('0xc')],_0x44190a[_0xa6fb('0xd')])&&_0x44190a['idField']){_0x557b01[_0x44190a[_0xa6fb('0xe')]]=_0x44190a['content']['toString']();}else if(_0x44190a[_0xa6fb('0xd')]===_0xa6fb('0xf')&&_0x44190a['variableName']&&_0x44190a[_0xa6fb('0xe')]&&_0x491880[_0x44190a[_0xa6fb('0x10')]]){_0x557b01[_0x44190a[_0xa6fb('0xe')]]=_0x491880[_0x44190a[_0xa6fb('0x10')]][_0xa6fb('0x11')]();}else if(_0x44190a[_0xa6fb('0xd')]==='customVariable'&&_0x44190a[_0xa6fb('0x12')]&&_0x44190a[_0xa6fb('0x12')][_0xa6fb('0x13')]&&_0x44190a[_0xa6fb('0xe')]&&_0x491880[_0x44190a[_0xa6fb('0x12')][_0xa6fb('0x13')][_0xa6fb('0x14')]()]){_0x557b01[_0x44190a[_0xa6fb('0xe')]]=_0x491880[_0x44190a[_0xa6fb('0x12')]['name']['toLowerCase']()][_0xa6fb('0x11')]();}});}return _0x557b01;}function createTicket(_0x1b4bbe,_0x193b40,_0x19728e,_0x1f81e2,_0x4c37dd,_0x102d92,_0x301da0){logger[_0xa6fb('0x15')](_0xa6fb('0x16'));var _0x4d9514=_[_0xa6fb('0x17')]({'parent_id':'','assigned_user_id':_0x193b40['id'],'ticketpriorities':_0xa6fb('0x18'),'ticketstatus':_0xa6fb('0x19'),'ticket_title':intUtil[_0xa6fb('0x1a')](_0x1f81e2['Subjects'],_0x4c37dd,'\x20'),'description':intUtil[_0xa6fb('0x1a')](_0x1f81e2[_0xa6fb('0x1b')],_0x4c37dd,'\x0a'),'contact_id':_0x19728e['id']},getCustomFields(_0x102d92,_0x4c37dd));var _0x7a324d={'method':'POST','uri':util[_0xa6fb('0x1c')](_0xa6fb('0x1d'),_0x1b4bbe[_0xa6fb('0x1e')]),'form':{'operation':'create','username':_0x1b4bbe['username'],'sessionName':_0x301da0['sessionName'],'elementType':_0xa6fb('0x1f'),'element':JSON['stringify'](_0x4d9514)},'json':!![]};return request(_0x7a324d)['then'](function(_0x26be24){if(_0x26be24[_0xa6fb('0x20')]){return BPromise['resolve']({'id':_0x26be24[_0xa6fb('0x21')]['id']});}else{throw new Error(util[_0xa6fb('0x1c')](_0xa6fb('0x22'),JSON[_0xa6fb('0x23')](_0x26be24['error'])));}})[_0xa6fb('0x24')](function(_0x1c6455){var _0x79c165=_0x1c6455[_0xa6fb('0x25')]||0x1f4;logger[_0xa6fb('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa6fb('0x27'),_0x79c165,JSON['stringify'](_0x1c6455));});}function getUser(_0x18d8f8,_0x178ec6,_0x131ea5){if(intUtil[_0xa6fb('0x28')](_0x178ec6)){logger[_0xa6fb('0x15')]('Getting\x20agent\x20with\x20email',_0x178ec6);return request({'method':'GET','uri':util[_0xa6fb('0x1c')](_0xa6fb('0x1d'),_0x18d8f8[_0xa6fb('0x1e')]),'qs':{'operation':'query','username':_0x18d8f8[_0xa6fb('0x29')],'sessionName':_0x131ea5['sessionName'],'query':util[_0xa6fb('0x1c')](_0xa6fb('0x2a'),_0x178ec6)},'json':!![]})[_0xa6fb('0x2b')](function(_0x576d32){if(_0x576d32['success']&&_0x576d32[_0xa6fb('0x21')][_0xa6fb('0x9')]){logger['info'](_0xa6fb('0x2c'));return BPromise['resolve']({'id':_0x576d32[_0xa6fb('0x21')][0x0]['id'],'email':_0x576d32[_0xa6fb('0x21')][0x0][_0xa6fb('0x2d')],'name':_0x576d32[_0xa6fb('0x21')][0x0]['first_name']+'\x20'+_0x576d32['result'][_0xa6fb('0x2e')]});}else{logger['info'](_0xa6fb('0x2f'));return BPromise[_0xa6fb('0x30')]({'id':_0x131ea5[_0xa6fb('0x31')],'email':_0x18d8f8[_0xa6fb('0x29')],'name':_0xa6fb('0x32')});}})['catch'](function(_0x3b91ba){var _0x421a9c=_0x3b91ba[_0xa6fb('0x25')]||0x1f4;logger[_0xa6fb('0x26')](_0xa6fb('0x33'),_0xa6fb('0x34'),_0x421a9c,JSON['stringify'](_0x3b91ba));});}else{logger['info'](_0xa6fb('0x2f'));return BPromise['resolve']({'id':_0x131ea5['userId'],'email':_0x18d8f8[_0xa6fb('0x29')],'name':_0xa6fb('0x32')})[_0xa6fb('0x24')](function(_0x30ef96){var _0x5da166=_0x30ef96[_0xa6fb('0x25')]||0x1f4;logger[_0xa6fb('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x5da166,JSON['stringify'](_0x30ef96));});}}function getEndUser(_0x16473f,_0x25efe4,_0x254e39,_0x23198d){logger[_0xa6fb('0x15')](_0xa6fb('0x35'),_0x254e39);return request({'method':_0xa6fb('0x36'),'uri':util[_0xa6fb('0x1c')](_0xa6fb('0x1d'),_0x16473f['remoteUri']),'qs':{'operation':_0xa6fb('0x37'),'username':_0x16473f['username'],'sessionName':_0x23198d[_0xa6fb('0x38')],'query':util[_0xa6fb('0x1c')](_0xa6fb('0x39'),_0x254e39,_0x254e39,_0x254e39,_0x254e39,_0x254e39)},'json':!![]})[_0xa6fb('0x2b')](function(_0x2a9105){if(_0x2a9105['success']&&_0x2a9105[_0xa6fb('0x21')][_0xa6fb('0x9')]){logger[_0xa6fb('0x15')](_0xa6fb('0x3a'));return BPromise[_0xa6fb('0x30')]({'id':_0x2a9105['result'][0x0]['id'],'name':_0x2a9105[_0xa6fb('0x21')][0x0]['firstname']+'\x20'+_0x2a9105[_0xa6fb('0x21')][0x0][_0xa6fb('0x3b')],'phone':_0x254e39});}else{logger[_0xa6fb('0x15')](_0xa6fb('0x3c'));return request({'method':_0xa6fb('0x3d'),'uri':util['format'](_0xa6fb('0x1d'),_0x16473f['remoteUri']),'form':{'operation':_0xa6fb('0x3e'),'sessionName':_0x23198d['sessionName'],'elementType':_0xa6fb('0x3f'),'element':JSON['stringify']({'lastname':_0x25efe4,'phone':_0x254e39,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x502e96){logger[_0xa6fb('0x15')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x502e96[_0xa6fb('0x21')]['id'],'name':_0x502e96['result'][_0xa6fb('0x3b')],'phone':_0x502e96[_0xa6fb('0x21')][_0xa6fb('0x40')]});})[_0xa6fb('0x24')](function(_0x479796){var _0x3ea099=_0x479796['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xa6fb('0x41'),_0x3ea099,JSON[_0xa6fb('0x23')](_0x479796));});}});}function getConnection(_0x461369){var _0x29e7b7=_0x461369[_0xa6fb('0x29')];var _0x2baa41=_0x461369[_0xa6fb('0x42')];return request({'method':'GET','uri':util[_0xa6fb('0x1c')](_0xa6fb('0x1d'),_0x461369[_0xa6fb('0x1e')]),'qs':{'operation':_0xa6fb('0x43'),'username':_0x29e7b7},'json':!![]})['then'](function(_0x1b0f1b){if(_0x1b0f1b[_0xa6fb('0x20')]){return request({'method':_0xa6fb('0x3d'),'uri':util[_0xa6fb('0x1c')]('%s/webservice.php',_0x461369[_0xa6fb('0x1e')]),'form':{'operation':_0xa6fb('0x44'),'username':_0x29e7b7,'accessKey':md5(_0x1b0f1b[_0xa6fb('0x21')]['token']+_0x2baa41)},'json':!![]});}})[_0xa6fb('0x2b')](function(_0x32e14f){if(_0x32e14f['success']){return BPromise[_0xa6fb('0x30')](_0x32e14f[_0xa6fb('0x21')]);}else{throw new Error(util[_0xa6fb('0x1c')](_0xa6fb('0x45'),_0x461369['id']));}})[_0xa6fb('0x24')](function(_0x21ce06){var _0x13072d=_0x21ce06[_0xa6fb('0x25')]||0x1f4;logger[_0xa6fb('0x26')](_0xa6fb('0x33'),'getConnection',_0x13072d,JSON[_0xa6fb('0x23')](_0x21ce06));});}function request(_0x5ee37d){logger[_0xa6fb('0x15')](_0xa6fb('0x46'),JSON[_0xa6fb('0x23')](_0x5ee37d));return rp(_0x5ee37d);}exports[_0xa6fb('0x47')]=function(_0x937140,_0x2259f3,_0x4963b1,_0x515dc1,_0x5983ea,_0x1c6457){var _0x5d3631,_0x3714ee,_0x8bad4d,_0x44cd7c;_0x1c6457[_0xa6fb('0x1e')]=intUtil[_0xa6fb('0x48')](_0x1c6457['remoteUri']);if(_0x5983ea&&_0x5983ea['monitor_format']){logger['info'](_0xa6fb('0x49'),'Recording\x20is\x20enabled!');_0x2259f3['recordingURL']=util[_0xa6fb('0x1c')](_0xa6fb('0x4a'),_0x1c6457[_0xa6fb('0x4b')],_0x2259f3['uniqueid'],md5(_0x2259f3[_0xa6fb('0x4c')]));}else{_0x2259f3[_0xa6fb('0x4d')]='';}return getConnection(_0x1c6457)[_0xa6fb('0x2b')](function(_0x4a9141){_0x44cd7c=_0x4a9141;return getUser(_0x1c6457,_0x515dc1[_0xa6fb('0x4e')],_0x44cd7c);})[_0xa6fb('0x2b')](function(_0x5802b6){_0x5d3631=_0x5802b6;logger[_0xa6fb('0x15')](_0xa6fb('0x4f'),_0x5d3631['id']);return getEndUser(_0x1c6457,_0x2259f3[_0xa6fb('0x50')],_0x2259f3[_0xa6fb('0x51')],_0x44cd7c);})[_0xa6fb('0x2b')](function(_0x4cf456){_0x3714ee=_0x4cf456;logger[_0xa6fb('0x15')](_0xa6fb('0x52'),_0x3714ee['id']);return createTicket(_0x1c6457,_0x5d3631,_0x3714ee,_0x4963b1,_0x2259f3,_0x4963b1[_0xa6fb('0x53')],_0x44cd7c);})[_0xa6fb('0x2b')](function(_0x37f55c){_0x8bad4d=_0x37f55c;logger[_0xa6fb('0x15')]('Ticket\x20created!');logger['info'](_0xa6fb('0x54'),_0x8bad4d['id']);var _0x4abdb2=util[_0xa6fb('0x1c')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1c6457[_0xa6fb('0x1e')],_[_0xa6fb('0x55')](_0x8bad4d['id'],'x')[0x1]);logger[_0xa6fb('0x15')](_0xa6fb('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa6fb('0x1c')](_0xa6fb('0x56'),_0x515dc1[_0xa6fb('0x13')]),_0xa6fb('0x57'),{'uri':_0x4abdb2});})[_0xa6fb('0x24')](function(_0x17fe3){logger[_0xa6fb('0x26')](_0xa6fb('0x49'),JSON[_0xa6fb('0x23')](_0x17fe3));});};exports[_0xa6fb('0x58')]=function(_0x1f87da,_0x1361f4,_0x23b01a,_0x4a16b5,_0x70cf88,_0x292091,_0x368726){var _0x2eb05c,_0x24d44d,_0x55c8db,_0x5278df;_0x292091[_0xa6fb('0x1e')]=intUtil[_0xa6fb('0x48')](_0x292091['remoteUri']);_0x292091[_0xa6fb('0x4b')]=intUtil['stripTrailingSlash'](_0x292091[_0xa6fb('0x4b')]);if(_0x368726&&_0x368726['recordingFormat']&&_0x368726[_0xa6fb('0x59')]!==_0xa6fb('0x5a')){logger[_0xa6fb('0x15')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1361f4['recordingURL']=util[_0xa6fb('0x1c')](_0xa6fb('0x4a'),_0x292091[_0xa6fb('0x4b')],_0x1361f4[_0xa6fb('0x4c')],md5(_0x1361f4[_0xa6fb('0x4c')]));}return getConnection(_0x292091)['then'](function(_0x5161a2){_0x5278df=_0x5161a2;return getUser(_0x292091,_0x4a16b5[_0xa6fb('0x4e')],_0x5278df);})[_0xa6fb('0x2b')](function(_0x372af2){_0x2eb05c=_0x372af2;logger[_0xa6fb('0x15')](_0xa6fb('0x4f'),_0x2eb05c['id']);return getEndUser(_0x292091,_0x1361f4[_0xa6fb('0x5b')],_0x1361f4[_0xa6fb('0x5c')],_0x5278df);})['then'](function(_0x5aecfd){_0x24d44d=_0x5aecfd;logger['info'](_0xa6fb('0x52'),_0x24d44d['id']);return createTicket(_0x292091,_0x2eb05c,_0x24d44d,_0x23b01a,_0x1361f4,_0x23b01a['Fields'],_0x5278df);})[_0xa6fb('0x2b')](function(_0x168388){_0x55c8db=_0x168388;logger[_0xa6fb('0x15')]('Ticket\x20created!');logger[_0xa6fb('0x15')](_0xa6fb('0x54'),_0x55c8db['id']);var _0x5f4ac6=util[_0xa6fb('0x1c')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x292091[_0xa6fb('0x1e')],_['split'](_0x55c8db['id'],'x')[0x1]);logger[_0xa6fb('0x15')]('[OUTBOUND]',_0xa6fb('0x5d'));emit(util['format'](_0xa6fb('0x56'),_0x4a16b5[_0xa6fb('0x13')]),_0xa6fb('0x57'),{'uri':_0x5f4ac6});})[_0xa6fb('0x24')](function(_0x304e75){logger['error'](_0xa6fb('0x5e'),JSON[_0xa6fb('0x23')](_0x304e75));});};exports[_0xa6fb('0x5f')]=function(_0x66d4d3,_0x1f5f52,_0x441733,_0x39ad9c,_0x56827a,_0x533c78){var _0x4ca548,_0x64bab3,_0x1b8103,_0x310519;_0x533c78['remoteUri']=intUtil['stripTrailingSlash'](_0x533c78[_0xa6fb('0x1e')]);_0x533c78['serverUrl']=intUtil['stripTrailingSlash'](_0x533c78[_0xa6fb('0x4b')]);if(_0x56827a&&_0x56827a[_0xa6fb('0x60')]){logger[_0xa6fb('0x15')]('['+_0x1f5f52[_0xa6fb('0x61')][_0xa6fb('0x62')]()+']',_0xa6fb('0x63'));_0x1f5f52[_0xa6fb('0x4d')]=util[_0xa6fb('0x1c')](_0xa6fb('0x4a'),_0x533c78[_0xa6fb('0x4b')],_0x1f5f52[_0xa6fb('0x4c')],md5(_0x1f5f52[_0xa6fb('0x4c')]));}else{_0x1f5f52['recordingURL']='';}return getConnection(_0x533c78)[_0xa6fb('0x2b')](function(_0x5000f4){_0x310519=_0x5000f4;return getUser(_0x533c78,'',_0x310519);})[_0xa6fb('0x2b')](function(_0x3bf91f){_0x4ca548=_0x3bf91f;logger[_0xa6fb('0x15')](_0xa6fb('0x4f'),_0x4ca548['id']);return getEndUser(_0x533c78,_0x1f5f52[_0xa6fb('0x50')],_0x1f5f52[_0xa6fb('0x51')],_0x310519);})['then'](function(_0x2abd8c){_0x64bab3=_0x2abd8c;logger[_0xa6fb('0x15')]('The\x20Enduser\x20ID\x20is:',_0x64bab3['id']);return createTicket(_0x533c78,_0x4ca548,_0x64bab3,_0x441733,_0x1f5f52,_0x441733[_0xa6fb('0x53')],_0x310519);})['then'](function(_0x268224){_0x1b8103=_0x268224;logger[_0xa6fb('0x15')](_0xa6fb('0x64'));logger['info'](_0xa6fb('0x54'),_0x1b8103['id']);})['catch'](function(_0x4205bf){logger[_0xa6fb('0x26')]('['+_0x1f5f52[_0xa6fb('0x61')][_0xa6fb('0x62')]()+']',JSON['stringify'](_0x4205bf));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 22e710e..0eff551 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe26c=['Basic\x20%s','toString','debug','[HTTP]','stringify','GET','length','forEach','string','type','nameField','customField','toLowerCase','content','custom_fields','variable','variableName','idField','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','calleridname','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','defaults','localhost','redis','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0xe26c,0x11c));var _0xce26=function(_0x3b9e9c,_0x7d0c30){_0x3b9e9c=_0x3b9e9c-0x0;var _0x483ff8=_0xe26c[_0x3b9e9c];return _0x483ff8;};'use strict';var _=require(_0xce26('0x0'));var rp=require('request-promise');var md5=require(_0xce26('0x1'));var util=require(_0xce26('0x2'));var Redis=require(_0xce26('0x3'));var intUtil=require(_0xce26('0x4'));var config=require(_0xce26('0x5'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0xce26('0x6')](config['redis'],{'host':_0xce26('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce26('0x8')]));function emit(_0x59467a,_0x4be837,_0x54e6bf){io['to'](_0x59467a)[_0xce26('0x9')](_0x4be837,_0x54e6bf);}var headers={'Content-Type':_0xce26('0xa'),'Accept':'application/json'};function getTicket(_0x433376,_0x39e9da,_0x1ce800,_0x10cc0b,_0x10f6b4){logger[_0xce26('0xb')](_0xce26('0xc'));return request({'uri':util['format'](_0xce26('0xd'),_0x433376[_0xce26('0xe')]),'method':_0xce26('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x1ce800['id'],'submitter_id':_0x39e9da?_0x39e9da['id']:undefined,'assignee_id':_0x39e9da?_0x39e9da['id']:undefined,'tags':getTags(_0x10cc0b[_0xce26('0x10')],_0xce26('0x11')),'subject':intUtil[_0xce26('0x12')](_0x10cc0b[_0xce26('0x13')],_0x10f6b4,'\x20'),'description':intUtil[_0xce26('0x12')](_0x10cc0b[_0xce26('0x14')],_0x10f6b4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xce26('0x12')](_0x10cc0b['Descriptions'],_0x10f6b4,'\x0a')}},getCustomFields(_0x10cc0b[_0xce26('0x15')],_0x10f6b4))}})[_0xce26('0x16')](function(_0x506dd7){logger[_0xce26('0xb')]('Ticket\x20created!');return _0x506dd7[_0xce26('0x17')];});}function getUser(_0x4477c7,_0xa01b21){if(intUtil[_0xce26('0x18')](_0xa01b21)){logger['info'](_0xce26('0x19'),_0xa01b21);return request({'uri':util[_0xce26('0x1a')](_0xce26('0x1b'),_0x4477c7[_0xce26('0xe')]),'qs':{'query':util[_0xce26('0x1a')](_0xce26('0x1c'),_0xa01b21)}})['then'](function(_0x4f117f){if(_0x4f117f[_0xce26('0x1d')]){logger['info'](_0xce26('0x1e'));return _['find'](_0x4f117f['results'],{'email':_0xa01b21,'role':_0xce26('0x1f')});}else{logger[_0xce26('0xb')](_0xce26('0x20'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x21'),_0x4477c7[_0xce26('0xe')])})[_0xce26('0x16')](function(_0x588c46){logger[_0xce26('0xb')](_0xce26('0x22'));return _0x588c46[_0xce26('0x23')];});}});}else{logger[_0xce26('0xb')](_0xce26('0x20'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x21'),_0x4477c7[_0xce26('0xe')])})['then'](function(_0xa84e0e){logger[_0xce26('0xb')](_0xce26('0x22'));return _0xa84e0e[_0xce26('0x23')];});}}function getEndUser(_0x11c7c6,_0x3a78c5,_0x262027){logger[_0xce26('0xb')](_0xce26('0x24'),_0x262027);return request({'uri':util[_0xce26('0x1a')]('%s/search.json',_0x11c7c6[_0xce26('0xe')]),'qs':{'query':util['format'](_0xce26('0x25'),_0x262027)}})[_0xce26('0x16')](function(_0x9aade4){var _0x4e4fed;if(_0x9aade4['results']['length']){_0x9aade4[_0xce26('0x26')]=_[_0xce26('0x27')](_0x9aade4[_0xce26('0x26')],{'suspended':![],'role':_0xce26('0x28')});if(_0x9aade4[_0xce26('0x26')]['length']){_0x4e4fed=_[_0xce26('0x29')](_0x9aade4[_0xce26('0x26')]);}}if(_0x4e4fed){logger[_0xce26('0xb')](_0xce26('0x2a'));return _0x4e4fed;}else{logger[_0xce26('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xce26('0x1a')](_0xce26('0x2b'),_0x11c7c6['remoteUri']),'method':'POST','body':{'user':{'role':_0xce26('0x28'),'name':util[_0xce26('0x1a')](_0xce26('0x2c'),_0x3a78c5||_0x262027),'phone':_0x262027}}})[_0xce26('0x16')](function(_0x5b7a79){logger['info'](_0xce26('0x2d'));return _0x5b7a79[_0xce26('0x23')];});}});}function getAuth(_0x397f80){var _0x4f1638;if(_0x397f80[_0xce26('0x2e')]===_0xce26('0x2f')){_0x4f1638=util['format'](_0xce26('0x30'),_0x397f80[_0xce26('0x31')],_0x397f80['password']);}else if(_0x397f80['authType']===_0xce26('0x32')){_0x4f1638=util[_0xce26('0x1a')](_0xce26('0x33'),_0x397f80[_0xce26('0x31')],_0x397f80['token']);}return util['format'](_0xce26('0x34'),new Buffer(_0x4f1638)[_0xce26('0x35')]('base64'));}function request(_0x56dd4f){logger[_0xce26('0x36')](_0xce26('0x37'),JSON[_0xce26('0x38')](_0x56dd4f));return rp(_[_0xce26('0x6')](_0x56dd4f,{'method':_0xce26('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x77c4bd,_0x1ff889){var _0x4e1017=[];if(_0x77c4bd&&_0x77c4bd['length']>0x0){_0x4e1017=_['map'](_0x77c4bd,_0x1ff889);}return _0x4e1017;}function getCustomFields(_0x1b171e,_0x38c27f){var _0x12fb03=[];var _0x44446a={'custom_fields':[]};if(_0x1b171e[_0xce26('0x3a')]>0x0){_[_0xce26('0x3b')](_0x1b171e,function(_0x3b4d4c){if(_['includes']([_0xce26('0x3c'),'picklist'],_0x3b4d4c[_0xce26('0x3d')])&&_0x3b4d4c[_0xce26('0x3e')]&&!_0x3b4d4c[_0xce26('0x3f')]){_0x44446a[_0x3b4d4c[_0xce26('0x3e')][_0xce26('0x40')]()]=_0x3b4d4c[_0xce26('0x41')][_0xce26('0x35')]();}else if(_['includes']([_0xce26('0x3c'),'picklist'],_0x3b4d4c['type'])&&_0x3b4d4c['idField']&&_0x3b4d4c['customField']){_0x44446a[_0xce26('0x42')]['push']({'id':_0x3b4d4c['idField'],'value':_0x3b4d4c[_0xce26('0x41')][_0xce26('0x35')]()});}else if(_0x3b4d4c['type']===_0xce26('0x43')&&_0x3b4d4c[_0xce26('0x44')]&&_0x3b4d4c[_0xce26('0x45')]&&_0x3b4d4c['customField']){_0x38c27f[_0x3b4d4c[_0xce26('0x44')]]&&_0x44446a[_0xce26('0x42')][_0xce26('0x46')]({'id':_0x3b4d4c[_0xce26('0x45')],'value':_0x38c27f[_0x3b4d4c['variableName']][_0xce26('0x35')]()});}else if(_0x3b4d4c[_0xce26('0x3d')]==='customVariable'&&_0x3b4d4c[_0xce26('0x47')]&&_0x3b4d4c[_0xce26('0x47')][_0xce26('0x11')]&&_0x3b4d4c[_0xce26('0x45')]&&_0x3b4d4c[_0xce26('0x3f')]){_0x38c27f[_0x3b4d4c[_0xce26('0x47')][_0xce26('0x11')][_0xce26('0x40')]()]&&_0x44446a[_0xce26('0x42')]['push']({'id':_0x3b4d4c['idField'],'value':_0x38c27f[_0x3b4d4c['Variable'][_0xce26('0x11')][_0xce26('0x40')]()][_0xce26('0x35')]()});}});}return _0x44446a;}exports[_0xce26('0x48')]=function(_0x3ef794,_0x3d1b75,_0x1e8e7c,_0x3893a4,_0x2585b1,_0x14b8a0){var _0x186dd4,_0x5ceea2;_0x14b8a0['remoteUri']=intUtil[_0xce26('0x49')](_0x14b8a0[_0xce26('0xe')]);_0x14b8a0[_0xce26('0x4a')]=intUtil[_0xce26('0x49')](_0x14b8a0[_0xce26('0x4a')]);if(_0x2585b1&&_0x2585b1[_0xce26('0x4b')]){logger[_0xce26('0xb')](_0xce26('0x4c'),_0xce26('0x4d'));_0x3d1b75['recordingURL']=util[_0xce26('0x1a')](_0xce26('0x4e'),_0x14b8a0[_0xce26('0x4a')],_0x3d1b75['uniqueid'],md5(_0x3d1b75[_0xce26('0x4f')]));}else{_0x3d1b75[_0xce26('0x50')]='';}headers['Authorization']=getAuth(_0x14b8a0);return getUser(_0x14b8a0,_0x3893a4['email'])[_0xce26('0x16')](function(_0x503536){_0x186dd4=_0x503536;logger[_0xce26('0xb')](_0xce26('0x51'),_0x186dd4['id']);return getEndUser(_0x14b8a0,_0x3d1b75['calleridname'],_0x3d1b75['calleridnum']);})['then'](function(_0x8bb57b){_0x5ceea2=_0x8bb57b;logger[_0xce26('0xb')](_0xce26('0x52'),_0x5ceea2['id']);return getTicket(_0x14b8a0,_0x186dd4,_0x5ceea2,_0x1e8e7c,_0x3d1b75);})[_0xce26('0x16')](function(_0x251c3b){if(_0x251c3b){logger[_0xce26('0xb')](_0xce26('0x53'),_0x251c3b['id']);switch(_0x14b8a0[_0xce26('0x3d')]){case _0xce26('0x54'):logger['info'](_0xce26('0x4c'),_0xce26('0x55'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x56'),_0x14b8a0['remoteUri'],_0x186dd4['id'],_0x251c3b['id']),'method':_0xce26('0xf')});case _0xce26('0x57'):logger[_0xce26('0xb')](_0xce26('0x4c'),_0xce26('0x58'));emit(util[_0xce26('0x1a')](_0xce26('0x59'),_0x3893a4['name']),_0xce26('0x5a'),{'uri':util[_0xce26('0x1a')](_0xce26('0x5b'),_0x14b8a0[_0xce26('0xe')][_0xce26('0x5c')]('/api/v2',''),_0x251c3b['id'])});break;default:logger[_0xce26('0x5d')](_0xce26('0x4c'),_0xce26('0x5e'));}}})[_0xce26('0x5f')](function(_0x10afd4){logger['error'](_0xce26('0x60'),util['inspect'](_0x10afd4,{'showHidden':!![],'depth':null}));});};exports[_0xce26('0x61')]=function(_0x47da83,_0x3cece6,_0x32b82e,_0x3f1857,_0x3c96af,_0x2d493f,_0x159db3){var _0x579e41,_0x5d0685;_0x2d493f[_0xce26('0xe')]=intUtil[_0xce26('0x49')](_0x2d493f[_0xce26('0xe')]);_0x2d493f[_0xce26('0x4a')]=intUtil[_0xce26('0x49')](_0x2d493f[_0xce26('0x4a')]);if(_0x159db3&&_0x159db3['recordingFormat']&&_0x159db3[_0xce26('0x62')]!==_0xce26('0x63')){logger['info'](_0xce26('0x64'),_0xce26('0x4d'));_0x3cece6[_0xce26('0x50')]=util[_0xce26('0x1a')](_0xce26('0x4e'),_0x2d493f['serverUrl'],_0x3cece6[_0xce26('0x4f')],md5(_0x3cece6[_0xce26('0x4f')]));}headers[_0xce26('0x65')]=getAuth(_0x2d493f);return getUser(_0x2d493f,_0x3f1857[_0xce26('0x66')])[_0xce26('0x16')](function(_0x25af47){_0x579e41=_0x25af47;logger[_0xce26('0xb')](_0xce26('0x51'),_0x579e41['id']);return getEndUser(_0x2d493f,_0x3cece6[_0xce26('0x67')],_0x3cece6['destcalleridnum']);})[_0xce26('0x16')](function(_0xc16c5a){_0x5d0685=_0xc16c5a;logger[_0xce26('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5d0685['id']);return getTicket(_0x2d493f,_0x579e41,_0x5d0685,_0x32b82e,_0x3cece6);})[_0xce26('0x16')](function(_0x80d54f){if(_0x80d54f){logger[_0xce26('0xb')](_0xce26('0x53'),_0x80d54f['id']);switch(_0x2d493f[_0xce26('0x3d')]){case _0xce26('0x54'):logger[_0xce26('0xb')]('[OUTBOUND]',_0xce26('0x55'));return request({'uri':util[_0xce26('0x1a')](_0xce26('0x56'),_0x2d493f[_0xce26('0xe')],_0x579e41['id'],_0x80d54f['id']),'method':'POST'});case'newTab':logger[_0xce26('0xb')]('[OUTBOUND]',_0xce26('0x58'));emit(util['format']('user:%s',_0x3f1857[_0xce26('0x11')]),_0xce26('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x2d493f[_0xce26('0xe')][_0xce26('0x5c')]('/api/v2',''),_0x80d54f['id'])});break;default:logger[_0xce26('0x5d')](_0xce26('0x64'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0xd257b4){logger[_0xce26('0x5d')](_0xce26('0x68'),util[_0xce26('0x69')](_0xd257b4,{'showHidden':!![],'depth':null}));});};exports[_0xce26('0x6a')]=function(_0x1a3126,_0x46bdf2,_0x6b4820,_0x5944fd,_0x5af5ff,_0x1e62c0){var _0x4d751d,_0x52171b;_0x1e62c0['remoteUri']=intUtil[_0xce26('0x49')](_0x1e62c0[_0xce26('0xe')]);_0x1e62c0['serverUrl']=intUtil[_0xce26('0x49')](_0x1e62c0[_0xce26('0x4a')]);if(_0x5af5ff&&_0x5af5ff['monitor_format']){logger['info']('['+_0x46bdf2['lastevent'][_0xce26('0x6b')]()+']','Recording\x20is\x20enabled!');_0x46bdf2[_0xce26('0x50')]=util[_0xce26('0x1a')](_0xce26('0x4e'),_0x1e62c0[_0xce26('0x4a')],_0x46bdf2[_0xce26('0x4f')],md5(_0x46bdf2[_0xce26('0x4f')]));}else{_0x46bdf2['recordingURL']='';}headers['Authorization']=getAuth(_0x1e62c0);return getUser(_0x1e62c0)['then'](function(_0x11068a){_0x4d751d=_0x11068a;logger[_0xce26('0xb')]('The\x20User\x20ID\x20is:',_0x4d751d['id']);return getEndUser(_0x1e62c0,_0x46bdf2[_0xce26('0x6c')],_0x46bdf2[_0xce26('0x6d')]);})[_0xce26('0x16')](function(_0x5cbe8e){_0x52171b=_0x5cbe8e;logger[_0xce26('0xb')]('The\x20Enduser\x20ID\x20is:',_0x52171b['id']);return getTicket(_0x1e62c0,_0x4d751d,_0x52171b,_0x6b4820,_0x46bdf2);})[_0xce26('0x16')](function(_0xcaec1d){if(_0xcaec1d){logger[_0xce26('0xb')]('The\x20Ticket\x20ID\x20is:',_0xcaec1d['id']);}})[_0xce26('0x5f')](function(_0x14ef6a){logger['error']('['+_0x46bdf2[_0xce26('0x6e')][_0xce26('0x6b')]()+']'+_0xce26('0x6f'),util[_0xce26('0x69')](_0x14ef6a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x442b=['emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','base64','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','custom_fields','push','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','user:%s','%s/agent/tickets/%s','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x814ac1,_0x34435b){var _0x29ed15=function(_0x3f155a){while(--_0x3f155a){_0x814ac1['push'](_0x814ac1['shift']());}};_0x29ed15(++_0x34435b);}(_0x442b,0x1a8));var _0xb442=function(_0x2a8ee9,_0x476744){_0x2a8ee9=_0x2a8ee9-0x0;var _0x508aa2=_0x442b[_0x2a8ee9];return _0x508aa2;};'use strict';var _=require(_0xb442('0x0'));var rp=require(_0xb442('0x1'));var md5=require(_0xb442('0x2'));var util=require(_0xb442('0x3'));var Redis=require(_0xb442('0x4'));var intUtil=require(_0xb442('0x5'));var config=require(_0xb442('0x6'));var logger=require(_0xb442('0x7'))('zendesk');config[_0xb442('0x8')]=_[_0xb442('0x9')](config[_0xb442('0x8')],{'host':_0xb442('0xa'),'port':0x18eb});var io=require(_0xb442('0xb'))(new Redis(config[_0xb442('0x8')]));function emit(_0xa79b53,_0x29b01f,_0x4023c9){io['to'](_0xa79b53)[_0xb442('0xc')](_0x29b01f,_0x4023c9);}var headers={'Content-Type':'application/json','Accept':_0xb442('0xd')};function getTicket(_0x54c001,_0x15c156,_0x481f21,_0x2d3e2b,_0x2adfac){logger[_0xb442('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xb442('0xf')](_0xb442('0x10'),_0x54c001[_0xb442('0x11')]),'method':_0xb442('0x12'),'body':{'ticket':_[_0xb442('0x13')]({'requester_id':_0x481f21['id'],'submitter_id':_0x15c156?_0x15c156['id']:undefined,'assignee_id':_0x15c156?_0x15c156['id']:undefined,'tags':getTags(_0x2d3e2b['Tags'],_0xb442('0x14')),'subject':intUtil[_0xb442('0x15')](_0x2d3e2b['Subjects'],_0x2adfac,'\x20'),'description':intUtil[_0xb442('0x15')](_0x2d3e2b[_0xb442('0x16')],_0x2adfac,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb442('0x15')](_0x2d3e2b[_0xb442('0x16')],_0x2adfac,'\x0a')}},getCustomFields(_0x2d3e2b['Fields'],_0x2adfac))}})[_0xb442('0x17')](function(_0x50f990){logger[_0xb442('0xe')](_0xb442('0x18'));return _0x50f990[_0xb442('0x19')];});}function getUser(_0x1569ec,_0x3062c9){if(intUtil[_0xb442('0x1a')](_0x3062c9)){logger[_0xb442('0xe')]('Getting\x20agent\x20with\x20email',_0x3062c9);return request({'uri':util[_0xb442('0xf')](_0xb442('0x1b'),_0x1569ec['remoteUri']),'qs':{'query':util[_0xb442('0xf')](_0xb442('0x1c'),_0x3062c9)}})['then'](function(_0xb314a1){if(_0xb314a1[_0xb442('0x1d')]){logger[_0xb442('0xe')](_0xb442('0x1e'));return _[_0xb442('0x1f')](_0xb314a1[_0xb442('0x20')],{'email':_0x3062c9,'role':_0xb442('0x21')});}else{logger[_0xb442('0xe')](_0xb442('0x22'));return request({'uri':util['format'](_0xb442('0x23'),_0x1569ec[_0xb442('0x11')])})[_0xb442('0x17')](function(_0x3d2983){logger[_0xb442('0xe')](_0xb442('0x24'));return _0x3d2983[_0xb442('0x25')];});}});}else{logger[_0xb442('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb442('0xf')]('%s/users/me.json',_0x1569ec[_0xb442('0x11')])})[_0xb442('0x17')](function(_0x135c9c){logger[_0xb442('0xe')]('Admin\x20account\x20selected.');return _0x135c9c['user'];});}}function getEndUser(_0x25f22c,_0x2600fe,_0x3d9470){logger['info'](_0xb442('0x26'),_0x3d9470);return request({'uri':util['format'](_0xb442('0x1b'),_0x25f22c[_0xb442('0x11')]),'qs':{'query':util[_0xb442('0xf')](_0xb442('0x27'),_0x3d9470)}})[_0xb442('0x17')](function(_0x255dc1){var _0x5c8e90;if(_0x255dc1['results']['length']){_0x255dc1[_0xb442('0x20')]=_[_0xb442('0x28')](_0x255dc1[_0xb442('0x20')],{'suspended':![],'role':_0xb442('0x29')});if(_0x255dc1[_0xb442('0x20')][_0xb442('0x2a')]){_0x5c8e90=_['first'](_0x255dc1[_0xb442('0x20')]);}}if(_0x5c8e90){logger[_0xb442('0xe')]('Enduser\x20found!');return _0x5c8e90;}else{logger[_0xb442('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xb442('0x2b'),_0x25f22c['remoteUri']),'method':_0xb442('0x12'),'body':{'user':{'role':_0xb442('0x29'),'name':util[_0xb442('0xf')](_0xb442('0x2c'),_0x2600fe||_0x3d9470),'phone':_0x3d9470}}})[_0xb442('0x17')](function(_0x5e4c3b){logger['info'](_0xb442('0x2d'));return _0x5e4c3b[_0xb442('0x25')];});}});}function getAuth(_0x2bae29){var _0x11705f;if(_0x2bae29['authType']===_0xb442('0x2e')){_0x11705f=util[_0xb442('0xf')](_0xb442('0x2f'),_0x2bae29[_0xb442('0x30')],_0x2bae29[_0xb442('0x2e')]);}else if(_0x2bae29[_0xb442('0x31')]==='token'){_0x11705f=util[_0xb442('0xf')](_0xb442('0x32'),_0x2bae29[_0xb442('0x30')],_0x2bae29['token']);}return util[_0xb442('0xf')]('Basic\x20%s',new Buffer(_0x11705f)['toString'](_0xb442('0x33')));}function request(_0x48d6e8){logger['debug'](_0xb442('0x34'),JSON['stringify'](_0x48d6e8));return rp(_[_0xb442('0x9')](_0x48d6e8,{'method':_0xb442('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x4a478b,_0x5148fc){var _0x2b0812=[];if(_0x4a478b&&_0x4a478b[_0xb442('0x2a')]>0x0){_0x2b0812=_[_0xb442('0x36')](_0x4a478b,_0x5148fc);}return _0x2b0812;}function getCustomFields(_0x2e05d6,_0xe03e34){var _0x25c4da=[];var _0x472728={'custom_fields':[]};if(_0x2e05d6[_0xb442('0x2a')]>0x0){_[_0xb442('0x37')](_0x2e05d6,function(_0x70e928){if(_[_0xb442('0x38')](['string',_0xb442('0x39')],_0x70e928[_0xb442('0x3a')])&&_0x70e928[_0xb442('0x3b')]&&!_0x70e928[_0xb442('0x3c')]){_0x472728[_0x70e928[_0xb442('0x3b')][_0xb442('0x3d')]()]=_0x70e928[_0xb442('0x3e')][_0xb442('0x3f')]();}else if(_[_0xb442('0x38')](['string',_0xb442('0x39')],_0x70e928[_0xb442('0x3a')])&&_0x70e928[_0xb442('0x40')]&&_0x70e928['customField']){_0x472728['custom_fields']['push']({'id':_0x70e928['idField'],'value':_0x70e928[_0xb442('0x3e')][_0xb442('0x3f')]()});}else if(_0x70e928[_0xb442('0x3a')]===_0xb442('0x41')&&_0x70e928['variableName']&&_0x70e928[_0xb442('0x40')]&&_0x70e928[_0xb442('0x3c')]){_0xe03e34[_0x70e928['variableName']]&&_0x472728[_0xb442('0x42')][_0xb442('0x43')]({'id':_0x70e928[_0xb442('0x40')],'value':_0xe03e34[_0x70e928[_0xb442('0x44')]][_0xb442('0x3f')]()});}else if(_0x70e928[_0xb442('0x3a')]===_0xb442('0x45')&&_0x70e928[_0xb442('0x46')]&&_0x70e928[_0xb442('0x46')][_0xb442('0x14')]&&_0x70e928[_0xb442('0x40')]&&_0x70e928[_0xb442('0x3c')]){_0xe03e34[_0x70e928['Variable'][_0xb442('0x14')][_0xb442('0x3d')]()]&&_0x472728[_0xb442('0x42')][_0xb442('0x43')]({'id':_0x70e928[_0xb442('0x40')],'value':_0xe03e34[_0x70e928[_0xb442('0x46')]['name'][_0xb442('0x3d')]()][_0xb442('0x3f')]()});}});}return _0x472728;}exports['queue']=function(_0x2e9300,_0x5284b8,_0x568a86,_0x53be83,_0x3a735d,_0x5af412){var _0x84214d,_0x1caa2a;_0x5af412['remoteUri']=intUtil[_0xb442('0x47')](_0x5af412[_0xb442('0x11')]);_0x5af412['serverUrl']=intUtil['stripTrailingSlash'](_0x5af412[_0xb442('0x48')]);if(_0x3a735d&&_0x3a735d[_0xb442('0x49')]){logger['info'](_0xb442('0x4a'),_0xb442('0x4b'));_0x5284b8['recordingURL']=util[_0xb442('0xf')](_0xb442('0x4c'),_0x5af412[_0xb442('0x48')],_0x5284b8['uniqueid'],md5(_0x5284b8[_0xb442('0x4d')]));}else{_0x5284b8['recordingURL']='';}headers[_0xb442('0x4e')]=getAuth(_0x5af412);return getUser(_0x5af412,_0x53be83[_0xb442('0x4f')])[_0xb442('0x17')](function(_0x399524){_0x84214d=_0x399524;logger[_0xb442('0xe')](_0xb442('0x50'),_0x84214d['id']);return getEndUser(_0x5af412,_0x5284b8[_0xb442('0x51')],_0x5284b8['calleridnum']);})['then'](function(_0x589fbe){_0x1caa2a=_0x589fbe;logger['info'](_0xb442('0x52'),_0x1caa2a['id']);return getTicket(_0x5af412,_0x84214d,_0x1caa2a,_0x568a86,_0x5284b8);})['then'](function(_0x7c1cca){if(_0x7c1cca){logger['info'](_0xb442('0x53'),_0x7c1cca['id']);switch(_0x5af412[_0xb442('0x3a')]){case _0xb442('0x54'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xb442('0x55'),_0x5af412[_0xb442('0x11')],_0x84214d['id'],_0x7c1cca['id']),'method':_0xb442('0x12')});case _0xb442('0x56'):logger[_0xb442('0xe')](_0xb442('0x4a'),_0xb442('0x57'));emit(util[_0xb442('0xf')]('user:%s',_0x53be83[_0xb442('0x14')]),_0xb442('0x58'),{'uri':util[_0xb442('0xf')]('%s/agent/tickets/%s',_0x5af412[_0xb442('0x11')][_0xb442('0x59')](_0xb442('0x5a'),''),_0x7c1cca['id'])});break;default:logger[_0xb442('0x5b')](_0xb442('0x4a'),_0xb442('0x5c'));}}})[_0xb442('0x5d')](function(_0x47e07b){logger[_0xb442('0x5b')](_0xb442('0x5e'),util[_0xb442('0x5f')](_0x47e07b,{'showHidden':!![],'depth':null}));});};exports[_0xb442('0x60')]=function(_0x5634e9,_0x2086e9,_0x260f94,_0xeff2aa,_0x168b7b,_0x2da6d9,_0x84e9e9){var _0x30bb72,_0x229c5c;_0x2da6d9[_0xb442('0x11')]=intUtil[_0xb442('0x47')](_0x2da6d9[_0xb442('0x11')]);_0x2da6d9[_0xb442('0x48')]=intUtil[_0xb442('0x47')](_0x2da6d9['serverUrl']);if(_0x84e9e9&&_0x84e9e9[_0xb442('0x61')]&&_0x84e9e9['recordingFormat']!==_0xb442('0x62')){logger[_0xb442('0xe')](_0xb442('0x63'),_0xb442('0x4b'));_0x2086e9[_0xb442('0x64')]=util[_0xb442('0xf')](_0xb442('0x4c'),_0x2da6d9[_0xb442('0x48')],_0x2086e9[_0xb442('0x4d')],md5(_0x2086e9[_0xb442('0x4d')]));}headers[_0xb442('0x4e')]=getAuth(_0x2da6d9);return getUser(_0x2da6d9,_0xeff2aa[_0xb442('0x4f')])['then'](function(_0x594066){_0x30bb72=_0x594066;logger[_0xb442('0xe')](_0xb442('0x50'),_0x30bb72['id']);return getEndUser(_0x2da6d9,_0x2086e9[_0xb442('0x65')],_0x2086e9[_0xb442('0x66')]);})[_0xb442('0x17')](function(_0x4172b7){_0x229c5c=_0x4172b7;logger['info'](_0xb442('0x52'),_0x229c5c['id']);return getTicket(_0x2da6d9,_0x30bb72,_0x229c5c,_0x260f94,_0x2086e9);})[_0xb442('0x17')](function(_0x484656){if(_0x484656){logger[_0xb442('0xe')](_0xb442('0x53'),_0x484656['id']);switch(_0x2da6d9['type']){case _0xb442('0x54'):logger[_0xb442('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb442('0xf')](_0xb442('0x55'),_0x2da6d9[_0xb442('0x11')],_0x30bb72['id'],_0x484656['id']),'method':_0xb442('0x12')});case'newTab':logger[_0xb442('0xe')](_0xb442('0x63'),_0xb442('0x57'));emit(util[_0xb442('0xf')](_0xb442('0x67'),_0xeff2aa[_0xb442('0x14')]),_0xb442('0x58'),{'uri':util[_0xb442('0xf')](_0xb442('0x68'),_0x2da6d9[_0xb442('0x11')][_0xb442('0x59')](_0xb442('0x5a'),''),_0x484656['id'])});break;default:logger['error']('[OUTBOUND]',_0xb442('0x5c'));}}})[_0xb442('0x5d')](function(_0x4f6028){logger[_0xb442('0x5b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb442('0x5f')](_0x4f6028,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x34c5a0,_0x2fc86a,_0x1faef6,_0x5e4fcf,_0x401f4f,_0x5ad2d9){var _0x52bb4b,_0xfe3db7;_0x5ad2d9[_0xb442('0x11')]=intUtil['stripTrailingSlash'](_0x5ad2d9[_0xb442('0x11')]);_0x5ad2d9[_0xb442('0x48')]=intUtil[_0xb442('0x47')](_0x5ad2d9['serverUrl']);if(_0x401f4f&&_0x401f4f[_0xb442('0x49')]){logger[_0xb442('0xe')]('['+_0x2fc86a[_0xb442('0x69')][_0xb442('0x6a')]()+']',_0xb442('0x4b'));_0x2fc86a[_0xb442('0x64')]=util[_0xb442('0xf')](_0xb442('0x4c'),_0x5ad2d9['serverUrl'],_0x2fc86a[_0xb442('0x4d')],md5(_0x2fc86a['uniqueid']));}else{_0x2fc86a[_0xb442('0x64')]='';}headers['Authorization']=getAuth(_0x5ad2d9);return getUser(_0x5ad2d9)[_0xb442('0x17')](function(_0x7a0345){_0x52bb4b=_0x7a0345;logger[_0xb442('0xe')]('The\x20User\x20ID\x20is:',_0x52bb4b['id']);return getEndUser(_0x5ad2d9,_0x2fc86a['calleridname'],_0x2fc86a[_0xb442('0x6b')]);})[_0xb442('0x17')](function(_0x1628e6){_0xfe3db7=_0x1628e6;logger['info'](_0xb442('0x52'),_0xfe3db7['id']);return getTicket(_0x5ad2d9,_0x52bb4b,_0xfe3db7,_0x1faef6,_0x2fc86a);})['then'](function(_0x25a0ee){if(_0x25a0ee){logger[_0xb442('0xe')](_0xb442('0x53'),_0x25a0ee['id']);}})[_0xb442('0x5d')](function(_0x54afa5){logger[_0xb442('0x5b')]('['+_0x2fc86a[_0xb442('0x69')][_0xb442('0x6a')]()+']'+_0xb442('0x6c'),util[_0xb442('0x5f')](_0x54afa5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 240c1d1..ce8e494 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e54=['recordingFormat','none','/api/voice/recordings/','uniqueid','destcalleridname','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','lastevent','toUpperCase','/downloads?type=uniqueid&token=','calleridname','calleridnum','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','refresh_token','expires_in','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','user','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash'];(function(_0xb05a5b,_0x427f98){var _0x144ef4=function(_0x42a280){while(--_0x42a280){_0xb05a5b['push'](_0xb05a5b['shift']());}};_0x144ef4(++_0x427f98);}(_0x2e54,0x1dd));var _0x42e5=function(_0x14cef5,_0x3c911d){_0x14cef5=_0x14cef5-0x0;var _0x1fa574=_0x2e54[_0x14cef5];return _0x1fa574;};'use strict';var _=require(_0x42e5('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x42e5('0x1'));var intUtil=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var Redis=require(_0x42e5('0x4'));var BPromise=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var logger=require(_0x42e5('0x7'))('zoho');config[_0x42e5('0x8')]=_[_0x42e5('0x9')](config[_0x42e5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x42e5('0xa'))(new Redis(config['redis']));function emit(_0x335b92,_0x490b99,_0x3a8494){io['to'](_0x335b92)[_0x42e5('0xb')](_0x490b99,_0x3a8494);}function request(_0x10ee5a){logger[_0x42e5('0xc')](_0x42e5('0xd'),JSON[_0x42e5('0xe')](_0x10ee5a));return rp(_0x10ee5a);}function getCustomFields(_0xe1ab4b,_0x2fa2f0){var _0x197752={};if(_0xe1ab4b['length']>0x0){_[_0x42e5('0xf')](_0xe1ab4b,function(_0x28b3b3){if(_['includes']([_0x42e5('0x10'),_0x42e5('0x11')],_0x28b3b3[_0x42e5('0x12')])&&_0x28b3b3[_0x42e5('0x13')]){_0x197752[_0x28b3b3[_0x42e5('0x13')]]=_0x28b3b3[_0x42e5('0x14')][_0x42e5('0x15')]();}else if(_0x28b3b3[_0x42e5('0x12')]===_0x42e5('0x16')&&_0x28b3b3[_0x42e5('0x17')]&&_0x28b3b3['idField']&&_0x2fa2f0[_0x28b3b3[_0x42e5('0x17')]]){_0x197752[_0x28b3b3[_0x42e5('0x13')]]=_0x2fa2f0[_0x28b3b3[_0x42e5('0x17')]][_0x42e5('0x15')]();}else if(_0x28b3b3[_0x42e5('0x12')]===_0x42e5('0x18')&&_0x28b3b3[_0x42e5('0x19')]&&_0x28b3b3[_0x42e5('0x19')][_0x42e5('0x1a')]&&_0x28b3b3[_0x42e5('0x13')]&&_0x2fa2f0[_0x28b3b3[_0x42e5('0x19')][_0x42e5('0x1a')][_0x42e5('0x1b')]()]){_0x197752[_0x28b3b3[_0x42e5('0x13')]]=_0x2fa2f0[_0x28b3b3['Variable'][_0x42e5('0x1a')]['toLowerCase']()]['toString']();}});}return _0x197752;}function getName(_0x14d16d){if(_0x14d16d[_0x42e5('0x1c')]('\x20')>0x0){var _0x5a1de2=_0x14d16d[_0x42e5('0x1d')](/ (.+)/);if(_0x5a1de2[0x1]){return _0x5a1de2;}}return[_0x14d16d,_0x14d16d];}var accountsTokens={};function getAccessToken(_0x39a3e2){return new Promise(function(_0x1c2169,_0x3fde76){if(!_[_0x42e5('0x1e')](accountsTokens[_0x39a3e2['id']])&&!_[_0x42e5('0x1e')](accountsTokens[_0x39a3e2['id']][_0x42e5('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x39a3e2['id']]['expires_in'])){_0x1c2169(accountsTokens[_0x39a3e2['id']][_0x42e5('0x1f')]);}}var _0x52d319;switch(_0x39a3e2[_0x42e5('0x20')]){case'US':_0x52d319=_0x42e5('0x21');break;case'AU':_0x52d319=_0x42e5('0x22');break;case'EU':_0x52d319=_0x42e5('0x23');break;case'IN':_0x52d319=_0x42e5('0x24');break;case'CN':_0x52d319='https://accounts.zoho.com.cn';break;default:_0x52d319=_0x42e5('0x23');break;}var _0xf29221={'method':_0x42e5('0x25'),'uri':_0x52d319+_0x42e5('0x26'),'qs':{'refresh_token':_0x39a3e2[_0x42e5('0x27')],'client_id':_0x39a3e2['clientId'],'client_secret':_0x39a3e2['clientSecret'],'grant_type':_0x42e5('0x28')},'json':!![]};return rp(_0xf29221)['then'](function(_0x56f812){accountsTokens[_0x39a3e2['id']]={'access_token':_0x56f812[_0x42e5('0x1f')],'expires_in':moment()['add'](_0x56f812[_0x42e5('0x29')],_0x42e5('0x2a'))};_0x1c2169(_0x56f812[_0x42e5('0x1f')]);})[_0x42e5('0x2b')](function(_0x27ae27){logger[_0x42e5('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x27ae27[_0x42e5('0x2d')]);_0x3fde76(_0x27ae27);});});}function getUser(_0x201d9e,_0x39f763,_0x2c53d4,_0x1d22ba){logger[_0x42e5('0x2e')](_0x42e5('0x2f'));return request({'method':_0x42e5('0x30'),'uri':util[_0x42e5('0x31')](_0x42e5('0x32'),_0x39f763),'qs':{'type':_0x42e5('0x33')},'headers':{'Authorization':_0x42e5('0x34')+_0x201d9e},'json':!![]})[_0x42e5('0x35')](function(_0x599750){if(_0x599750[_0x42e5('0x36')]){var _0xf5a3dc=-0x1;if(_[_0x42e5('0x37')](_0x599750[_0x42e5('0x36')])){if(!_['isNil'](_0x1d22ba)){_0xf5a3dc=_['findIndex'](_0x599750[_0x42e5('0x36')],function(_0x59f8d6){return _0x59f8d6[_0x42e5('0x38')]===_0x1d22ba;});}if(_0xf5a3dc>=0x0){logger['info'](_0x42e5('0x39'));}else{logger[_0x42e5('0x2e')](_0x42e5('0x3a'));_0xf5a3dc=_['findIndex'](_0x599750[_0x42e5('0x36')],function(_0x3a8d1c){return _0x3a8d1c['profile'][_0x42e5('0x1a')]==='Administrator';});}return _0x599750[_0x42e5('0x36')][_0xf5a3dc];}else{if(_0x599750[_0x42e5('0x3b')][_0x42e5('0x3c')][_0x42e5('0x1a')]===_0x42e5('0x3d')){logger[_0x42e5('0x2e')](_0x42e5('0x3a'));user=_0x599750['user'];return user;}else{logger['error'](_0x42e5('0x3e'),JSON[_0x42e5('0xe')](_0x599750));throw new Error(_0x42e5('0x3f')+JSON['stringify'](_0x599750));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x599750));throw new Error(_0x42e5('0x3f')+JSON[_0x42e5('0xe')](_0x599750));}})[_0x42e5('0x2b')](function(_0xedb7bc){console[_0x42e5('0x2c')](_0xedb7bc);});}function getZohoUser(_0x2a6e9c,_0x24a208){return new BPromise(function(_0x11060d,_0x59bc8d){request(_0x2a6e9c)[_0x42e5('0x35')](function(_0x587832){var _0x470338=null;if(_0x587832){_0x470338=_0x587832[_0x42e5('0x40')][0x0];_0x470338[_0x42e5('0x41')]=_0x24a208;}_0x11060d(_0x470338);})[_0x42e5('0x2b')](function(_0x251dd9){_0x59bc8d(_0x251dd9);});});}function createEndUser(_0x162679,_0xd5e7f5,_0x5ab9b8,_0x20f372,_0x356ff6,_0x5362c8){var _0x5ab9b8=getName(_0x5ab9b8);return request({'method':'POST','uri':'https://www.zohoapis.'+_0xd5e7f5+'/crm/v2/'+_[_0x42e5('0x42')](_0x5362c8[_0x42e5('0x43')])+'s','body':{'data':[{'Last_Name':_0x5ab9b8[0x1],'First_Name':_0x5ab9b8[0x0],'Phone':_0x20f372,'Owner':{'name':!_[_0x42e5('0x1e')](_0x356ff6[_0x42e5('0x44')][_0x42e5('0x1a')])?_0x356ff6[_0x42e5('0x44')][_0x42e5('0x1a')]:!_['isNil'](_0x356ff6[_0x42e5('0x45')])?_0x356ff6[_0x42e5('0x45')]+'\x20'+_0x356ff6['last_name']:_0x356ff6[_0x42e5('0x46')],'id':_0x356ff6['id']}}]},'headers':{'Authorization':_0x42e5('0x34')+_0x162679},'json':!![]})['then'](function(_0x33054f){if(_0x33054f&&_0x33054f[_0x42e5('0x40')][0x0][_0x42e5('0x47')]===_0x42e5('0x48')){var _0x424304=_0x33054f['data'][0x0][_0x42e5('0x49')];_0x424304[_0x42e5('0x41')]=_[_0x42e5('0x42')](_0x5362c8[_0x42e5('0x43')])+'s';return _0x424304;}logger['error'](_0x42e5('0x3e'),JSON[_0x42e5('0xe')](data));throw new Error(_0x42e5('0x4a')+JSON[_0x42e5('0xe')](data));})[_0x42e5('0x2b')](function(_0x68ad9b){console[_0x42e5('0x4b')](_0x42e5('0x4c'),_0x68ad9b);});}function getEndUser(_0x54c75b,_0x43f3ee,_0x5b27f6,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4){var _0x3d2fea={'method':_0x42e5('0x30'),'uri':'','headers':{'Authorization':_0x42e5('0x34')+_0x54c75b},'json':!![]};switch(_0x36a6a4[_0x42e5('0x4d')]){case'contact_lead':_0x3d2fea[_0x42e5('0x4e')]=_0x42e5('0x4f')+_0x43f3ee+_0x42e5('0x50')+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,_0x42e5('0x51'))[_0x42e5('0x35')](function(_0xc8de4d){if(_0xc8de4d)return _0xc8de4d;_0x3d2fea[_0x42e5('0x4e')]=_0x42e5('0x4f')+_0x43f3ee+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,_0x42e5('0x52'))[_0x42e5('0x35')](function(_0x3616f4){if(_0x3616f4)return _0x3616f4;if(_0x36a6a4[_0x42e5('0x43')]!=_0x42e5('0x53')){return createEndUser(_0x54c75b,_0x43f3ee,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4);}else{return{};}});});break;case _0x42e5('0x54'):_0x3d2fea[_0x42e5('0x4e')]=_0x42e5('0x4f')+_0x43f3ee+_0x42e5('0x50')+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,'Contacts')[_0x42e5('0x35')](function(_0x56ef4b){if(_0x56ef4b)return _0x56ef4b;if(_0x36a6a4[_0x42e5('0x43')]!=_0x42e5('0x53')){return createEndUser(_0x54c75b,_0x43f3ee,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4);}else{return{};}});break;case _0x42e5('0x55'):_0x3d2fea['uri']='https://www.zohoapis.'+_0x43f3ee+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1e4fa0+'))';return getZohoUser(_0x3d2fea,_0x42e5('0x52'))[_0x42e5('0x35')](function(_0x11fd3c){if(_0x11fd3c)return _0x11fd3c;if(_0x36a6a4[_0x42e5('0x43')]!='nothing'){return createEndUser(_0x54c75b,_0x43f3ee,_0x4b4dd6,_0x1e4fa0,_0x47441a,_0x36a6a4);}else{return{};}});break;}}function getCall(_0x3ae9de,_0x26782e,_0x18cedc,_0x504110,_0x34e169,_0x5070aa,_0x319088,_0x2583cd){logger['info'](_0x42e5('0x56'));var _0x18509a={};_0x18509a[_0x42e5('0x57')]={'name':!_[_0x42e5('0x1e')](_0x504110[_0x42e5('0x44')][_0x42e5('0x1a')])&&!_[_0x42e5('0x1e')](_0x504110[_0x42e5('0x3c')][_0x42e5('0x1a')])&&_0x504110[_0x42e5('0x3c')]['name']===_0x42e5('0x58')?_0x504110[_0x42e5('0x44')][_0x42e5('0x1a')]:!_[_0x42e5('0x1e')](_0x504110[_0x42e5('0x45')])?_0x504110['first_name']+'\x20'+_0x504110[_0x42e5('0x46')]:_0x504110[_0x42e5('0x46')],'id':_0x504110['id']};_0x18509a[_0x42e5('0x59')]=intUtil[_0x42e5('0x5a')](_0x5070aa['Subjects'],_0x319088,'\x20');_0x18509a['Description']=intUtil['getString'](_0x5070aa[_0x42e5('0x5b')],_0x319088,'\x0a');if(_0x34e169[_0x42e5('0x41')]==='Contacts'){_0x18509a[_0x42e5('0x5c')]={'name':!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5d')])?_0x34e169[_0x42e5('0x5d')]:!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5e')])?_0x34e169[_0x42e5('0x5e')]+'\x20'+_0x34e169[_0x42e5('0x5f')]:_0x34e169[_0x42e5('0x5f')],'id':_0x34e169['id']};}if(_0x34e169['enduserType']===_0x42e5('0x52')){_0x18509a['What_Id']={'name':!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5d')])?_0x34e169[_0x42e5('0x5d')]:!_[_0x42e5('0x1e')](_0x34e169[_0x42e5('0x5e')])?_0x34e169[_0x42e5('0x5e')]+'\x20'+_0x34e169[_0x42e5('0x5f')]:_0x34e169[_0x42e5('0x5f')],'id':_0x34e169['id']};_0x18509a[_0x42e5('0x60')]=_[_0x42e5('0x42')](_0x34e169[_0x42e5('0x41')]);}if(_0x319088['talktime']){_0x18509a[_0x42e5('0x61')]=moment['utc'](parseInt(_0x319088[_0x42e5('0x62')])*0x3e8)['format'](_0x42e5('0x63'));}else if(_0x319088[_0x42e5('0x64')]&&_0x319088['endtime']){_0x18509a[_0x42e5('0x61')]=moment[_0x42e5('0x65')](moment(_0x319088['endtime'],_0x42e5('0x66'))[_0x42e5('0x67')](moment(_0x319088['starttime'],_0x42e5('0x66'))))[_0x42e5('0x31')](_0x42e5('0x63'));}switch(_0x319088['lastevent']){case _0x42e5('0x68'):_0x18509a[_0x42e5('0x69')]=_0x42e5('0x6a');break;case _0x42e5('0x6b'):case'connect':_0x18509a[_0x42e5('0x69')]='Answered';break;case _0x42e5('0x6c'):_0x18509a[_0x42e5('0x69')]=_0x42e5('0x6d');break;case _0x42e5('0x6e'):_0x18509a[_0x42e5('0x69')]=_0x42e5('0x6f');break;case _0x42e5('0x70'):_0x18509a['Call_Result']=_0x42e5('0x71');default:}_0x18509a[_0x42e5('0x72')]=(_0x2583cd===_0x42e5('0x73')?moment(_0x319088[_0x42e5('0x74')])[_0x42e5('0x31')](_0x42e5('0x66')):moment(_0x319088[_0x42e5('0x75')])[_0x42e5('0x31')](_0x42e5('0x66')))||moment()['format'](_0x42e5('0x66'));_0x18509a[_0x42e5('0x76')]=_0x2583cd||_0x42e5('0x77');_0x18509a=_[_0x42e5('0x78')](_0x18509a,getCustomFields(_0x5070aa['Fields'],_0x319088));return request({'method':_0x42e5('0x25'),'uri':_0x42e5('0x4f')+_0x26782e+_0x42e5('0x79'),'headers':{'Authorization':_0x42e5('0x34')+_0x3ae9de},'body':{'data':[_0x18509a]},'json':!![]})['then'](function(_0x5cbc4c){if(_0x5cbc4c&&_0x5cbc4c['data'][0x0][_0x42e5('0x47')]===_0x42e5('0x48')){logger[_0x42e5('0x2e')](_0x42e5('0x7a'));return{'id':_0x5cbc4c[_0x42e5('0x40')][0x0][_0x42e5('0x49')]['id']};}})[_0x42e5('0x2b')](function(_0x3cc383){logger[_0x42e5('0x2e')]('err',_0x3cc383[_0x42e5('0x2d')]);console[_0x42e5('0x4b')](_0x42e5('0x7b'),_0x3cc383);});}exports[_0x42e5('0x7c')]=function(_0x365d6b,_0x2c1978,_0x209d84,_0x147613,_0x4d5357,_0x548f8a){var _0x22025c,_0x201650,_0x50e69c;_0x548f8a['host']=intUtil['stripTrailingSlash'](_0x548f8a[_0x42e5('0x7d')]);_0x548f8a[_0x42e5('0x7e')]=intUtil['stripTrailingSlash'](_0x548f8a[_0x42e5('0x7e')]);if(_0x4d5357&&_0x4d5357[_0x42e5('0x7f')]){logger['info'](_0x42e5('0x80'),_0x42e5('0x81'));_0x2c1978['recordingURL']=_0x548f8a[_0x42e5('0x7e')]+'/api/voice/recordings/'+_0x2c1978['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x2c1978['uniqueid']);}else{_0x2c1978[_0x42e5('0x82')]='';}var _0x234e29=_0x548f8a['host']===_0x42e5('0x83')?'eu':_0x42e5('0x84');return getAccessToken(_0x548f8a)[_0x42e5('0x35')](function(_0x290010){_0x50e69c=_0x290010;return getUser(_0x50e69c,_0x234e29,_0x548f8a,_0x147613[_0x42e5('0x38')]);})[_0x42e5('0x35')](function(_0x53f9df){_0x22025c=_0x53f9df;logger[_0x42e5('0x2e')](_0x42e5('0x85'),_0x22025c['id']);return getEndUser(_0x50e69c,_0x234e29,_0x548f8a,_0x2c1978['calleridname'],_0x2c1978['calleridnum'],_0x22025c,_0x209d84);})[_0x42e5('0x35')](function(_0xfa822e){_0x201650=_0xfa822e;return getCall(_0x50e69c,_0x234e29,_0x548f8a,_0x22025c,_0x201650,_0x209d84,_0x2c1978,_0x42e5('0x77'));})[_0x42e5('0x35')](function(_0x1e2fa7){if(_0x1e2fa7){logger[_0x42e5('0x2e')](_0x42e5('0x86'),_0x1e2fa7['id']);logger['info']('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x42e5('0x87'),_0x147613[_0x42e5('0x1a')]),'trigger:browser:url',{'uri':_0x42e5('0x88')+_0x548f8a['host']+_0x42e5('0x89')+_0x1e2fa7['id']});}})[_0x42e5('0x2b')](function(_0x3493d4){logger[_0x42e5('0x2c')](_0x42e5('0x80'),JSON[_0x42e5('0xe')](_0x3493d4));});};exports[_0x42e5('0x73')]=function(_0xea3650,_0x1a9adb,_0x3b308f,_0x1ee9b2,_0x78573b,_0x20cf62,_0x168faa){var _0x1f2352,_0x459abf,_0x349f93;_0x20cf62[_0x42e5('0x7d')]=intUtil['stripTrailingSlash'](_0x20cf62[_0x42e5('0x7d')]);_0x20cf62[_0x42e5('0x7e')]=intUtil[_0x42e5('0x8a')](_0x20cf62[_0x42e5('0x7e')]);if(_0x168faa&&_0x168faa[_0x42e5('0x8b')]&&_0x168faa[_0x42e5('0x8b')]!==_0x42e5('0x8c')){logger[_0x42e5('0x2e')]('[OUTBOUND]',_0x42e5('0x81'));_0x1a9adb[_0x42e5('0x82')]=_0x20cf62[_0x42e5('0x7e')]+_0x42e5('0x8d')+_0x1a9adb[_0x42e5('0x8e')]+'/downloads?type=uniqueid&token='+md5(_0x1a9adb['uniqueid']);}var _0xc06672=_0x20cf62[_0x42e5('0x7d')]===_0x42e5('0x83')?'eu':_0x42e5('0x84');return getAccessToken(_0x20cf62)[_0x42e5('0x35')](function(_0x2ff615){_0x349f93=_0x2ff615;return getUser(_0x349f93,_0xc06672,_0x20cf62,_0x1ee9b2[_0x42e5('0x38')]);})[_0x42e5('0x35')](function(_0x301a0f){_0x1f2352=_0x301a0f;logger['info'](_0x42e5('0x85'),_0x1f2352['id']);return getEndUser(_0x349f93,_0xc06672,_0x20cf62,_0x1a9adb[_0x42e5('0x8f')],_0x1a9adb['destcalleridnum'],_0x1f2352,_0x3b308f);})[_0x42e5('0x35')](function(_0x44d9ff){_0x459abf=_0x44d9ff;return getCall(_0x349f93,_0xc06672,_0x20cf62,_0x1f2352,_0x459abf,_0x3b308f,_0x1a9adb,_0x42e5('0x90'));})[_0x42e5('0x35')](function(_0x5318c9){if(_0x5318c9){logger['info']('The\x20Call\x20ID\x20is:',_0x5318c9['id']);logger[_0x42e5('0x2e')](_0x42e5('0x91'),_0x42e5('0x92'));emit(util[_0x42e5('0x31')](_0x42e5('0x87'),_0x1ee9b2[_0x42e5('0x1a')]),_0x42e5('0x93'),{'uri':'https://crm.'+_0x20cf62[_0x42e5('0x7d')]+_0x42e5('0x89')+_0x5318c9['id']});}})[_0x42e5('0x2b')](function(_0x516416){logger[_0x42e5('0x2c')]('[OUTBOUND]',JSON['stringify'](_0x516416));});};exports[_0x42e5('0x94')]=function(_0x1e1d32,_0x3859a7,_0x4b1fc4,_0x5e64a9,_0xf5d30f,_0x585793){var _0x49e2f9,_0x786950,_0x3ff124;_0x585793['host']=intUtil[_0x42e5('0x8a')](_0x585793[_0x42e5('0x7d')]);_0x585793[_0x42e5('0x7e')]=intUtil[_0x42e5('0x8a')](_0x585793[_0x42e5('0x7e')]);if(_0xf5d30f&&_0xf5d30f[_0x42e5('0x7f')]){logger['info']('['+_0x3859a7[_0x42e5('0x95')][_0x42e5('0x96')]()+']',_0x42e5('0x81'));_0x3859a7['recordingURL']=_0x585793[_0x42e5('0x7e')]+_0x42e5('0x8d')+_0x3859a7['uniqueid']+_0x42e5('0x97')+md5(_0x3859a7[_0x42e5('0x8e')]);}else{_0x3859a7[_0x42e5('0x82')]='';}var _0x4a1bb8=_0x585793[_0x42e5('0x7d')]===_0x42e5('0x83')?'eu':'com';return getAccessToken(_0x585793)['then'](function(_0x3a539d){_0x3ff124=_0x3a539d;return getUser(_0x3ff124,_0x4a1bb8,_0x585793);})['then'](function(_0x290083){_0x49e2f9=_0x290083;logger[_0x42e5('0x2e')](_0x42e5('0x85'),_0x49e2f9['id']);return getEndUser(_0x3ff124,_0x4a1bb8,_0x585793,_0x3859a7[_0x42e5('0x98')],_0x3859a7[_0x42e5('0x99')],_0x49e2f9,_0x4b1fc4);})['then'](function(_0xeee19d){_0x786950=_0xeee19d;return getCall(_0x3ff124,_0x4a1bb8,_0x585793,_0x49e2f9,_0x786950,_0x4b1fc4,_0x3859a7,_0x42e5('0x77'));})[_0x42e5('0x35')](function(_0x4e1188){if(_0x4e1188){logger[_0x42e5('0x2e')](_0x42e5('0x86'),_0x4e1188['id']);}})[_0x42e5('0x2b')](function(_0x23800){logger['error']('['+_0x3859a7[_0x42e5('0x95')]['toUpperCase']()+']',JSON['stringify'](_0x23800));});}; \ No newline at end of file +var _0x1d2d=['last_name','SUCCESS','data','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','Contacts','lead','Leads','nothing','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','com','calleridname','lodash','request-promise','md5','util','./util','ioredis','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name'];(function(_0x9efe0,_0x1e7272){var _0x232a0f=function(_0x377439){while(--_0x377439){_0x9efe0['push'](_0x9efe0['shift']());}};_0x232a0f(++_0x1e7272);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x21084d,_0x584027){_0x21084d=_0x21084d-0x0;var _0x2e0af6=_0x1d2d[_0x21084d];return _0x2e0af6;};'use strict';var _=require(_0xd1d2('0x0'));var rp=require(_0xd1d2('0x1'));var md5=require(_0xd1d2('0x2'));var util=require(_0xd1d2('0x3'));var intUtil=require(_0xd1d2('0x4'));var moment=require('moment');var Redis=require(_0xd1d2('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xd1d2('0x6'))(_0xd1d2('0x7'));config[_0xd1d2('0x8')]=_[_0xd1d2('0x9')](config[_0xd1d2('0x8')],{'host':_0xd1d2('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd1d2('0x8')]));function emit(_0x21bc28,_0x35735f,_0x37ff2a){io['to'](_0x21bc28)[_0xd1d2('0xb')](_0x35735f,_0x37ff2a);}function request(_0x59e484){logger[_0xd1d2('0xc')](_0xd1d2('0xd'),JSON[_0xd1d2('0xe')](_0x59e484));return rp(_0x59e484);}function getCustomFields(_0x353f9b,_0x900ec){var _0x227d7f={};if(_0x353f9b[_0xd1d2('0xf')]>0x0){_['forEach'](_0x353f9b,function(_0x41fcb5){if(_[_0xd1d2('0x10')]([_0xd1d2('0x11'),_0xd1d2('0x12')],_0x41fcb5[_0xd1d2('0x13')])&&_0x41fcb5[_0xd1d2('0x14')]){_0x227d7f[_0x41fcb5[_0xd1d2('0x14')]]=_0x41fcb5[_0xd1d2('0x15')][_0xd1d2('0x16')]();}else if(_0x41fcb5[_0xd1d2('0x13')]==='variable'&&_0x41fcb5[_0xd1d2('0x17')]&&_0x41fcb5[_0xd1d2('0x14')]&&_0x900ec[_0x41fcb5[_0xd1d2('0x17')]]){_0x227d7f[_0x41fcb5['idField']]=_0x900ec[_0x41fcb5[_0xd1d2('0x17')]][_0xd1d2('0x16')]();}else if(_0x41fcb5[_0xd1d2('0x13')]===_0xd1d2('0x18')&&_0x41fcb5[_0xd1d2('0x19')]&&_0x41fcb5[_0xd1d2('0x19')][_0xd1d2('0x1a')]&&_0x41fcb5['idField']&&_0x900ec[_0x41fcb5['Variable'][_0xd1d2('0x1a')]['toLowerCase']()]){_0x227d7f[_0x41fcb5[_0xd1d2('0x14')]]=_0x900ec[_0x41fcb5[_0xd1d2('0x19')][_0xd1d2('0x1a')][_0xd1d2('0x1b')]()]['toString']();}});}return _0x227d7f;}function getName(_0x4f1201){if(_0x4f1201[_0xd1d2('0x1c')]('\x20')>0x0){var _0x5d6125=_0x4f1201['split'](/ (.+)/);if(_0x5d6125[0x1]){return _0x5d6125;}}return[_0x4f1201,_0x4f1201];}var accountsTokens={};function getAccessToken(_0x1ab67c){return new Promise(function(_0x27e26b,_0x3414ce){if(!_[_0xd1d2('0x1d')](accountsTokens[_0x1ab67c['id']])&&!_['isNil'](accountsTokens[_0x1ab67c['id']][_0xd1d2('0x1e')])){if(moment()[_0xd1d2('0x1f')](accountsTokens[_0x1ab67c['id']][_0xd1d2('0x20')])){_0x27e26b(accountsTokens[_0x1ab67c['id']]['access_token']);}}var _0x59e72c;switch(_0x1ab67c[_0xd1d2('0x21')]){case'US':_0x59e72c=_0xd1d2('0x22');break;case'AU':_0x59e72c=_0xd1d2('0x23');break;case'EU':_0x59e72c=_0xd1d2('0x24');break;case'IN':_0x59e72c=_0xd1d2('0x25');break;case'CN':_0x59e72c=_0xd1d2('0x26');break;default:_0x59e72c=_0xd1d2('0x24');break;}var _0x5df4af={'method':_0xd1d2('0x27'),'uri':_0x59e72c+_0xd1d2('0x28'),'qs':{'refresh_token':_0x1ab67c[_0xd1d2('0x29')],'client_id':_0x1ab67c[_0xd1d2('0x2a')],'client_secret':_0x1ab67c[_0xd1d2('0x2b')],'grant_type':_0xd1d2('0x2c')},'json':!![]};return rp(_0x5df4af)[_0xd1d2('0x2d')](function(_0x34faf7){accountsTokens[_0x1ab67c['id']]={'access_token':_0x34faf7[_0xd1d2('0x1e')],'expires_in':moment()[_0xd1d2('0x2e')](_0x34faf7[_0xd1d2('0x20')],'seconds')};_0x27e26b(_0x34faf7['access_token']);})[_0xd1d2('0x2f')](function(_0x442375){logger[_0xd1d2('0x30')](_0xd1d2('0x31'),_0x442375[_0xd1d2('0x32')]);_0x3414ce(_0x442375);});});}function getUser(_0x48ade1,_0x39d694,_0x41171c,_0x383947){logger['info'](_0xd1d2('0x33'));return request({'method':_0xd1d2('0x34'),'uri':util[_0xd1d2('0x35')]('https://www.zohoapis.%s/crm/v2/users',_0x39d694),'qs':{'type':_0xd1d2('0x36')},'headers':{'Authorization':_0xd1d2('0x37')+_0x48ade1},'json':!![]})[_0xd1d2('0x2d')](function(_0x2690e2){if(_0x2690e2[_0xd1d2('0x38')]){var _0x14d661=-0x1;if(_[_0xd1d2('0x39')](_0x2690e2[_0xd1d2('0x38')])){if(!_[_0xd1d2('0x1d')](_0x383947)){_0x14d661=_[_0xd1d2('0x3a')](_0x2690e2[_0xd1d2('0x38')],function(_0x1246d3){return _0x1246d3[_0xd1d2('0x3b')]===_0x383947;});}if(_0x14d661>=0x0){logger[_0xd1d2('0x3c')](_0xd1d2('0x3d'));}else{logger[_0xd1d2('0x3c')](_0xd1d2('0x3e'));_0x14d661=_[_0xd1d2('0x3a')](_0x2690e2['users'],function(_0x1541ff){return _0x1541ff[_0xd1d2('0x3f')][_0xd1d2('0x1a')]==='Administrator';});}return _0x2690e2[_0xd1d2('0x38')][_0x14d661];}else{if(_0x2690e2['user']['profile'][_0xd1d2('0x1a')]===_0xd1d2('0x40')){logger[_0xd1d2('0x3c')](_0xd1d2('0x3e'));user=_0x2690e2[_0xd1d2('0x41')];return user;}else{logger[_0xd1d2('0x30')]('The\x20failing\x20result\x20is',JSON[_0xd1d2('0xe')](_0x2690e2));throw new Error(_0xd1d2('0x42')+JSON['stringify'](_0x2690e2));}}}else{logger[_0xd1d2('0x30')](_0xd1d2('0x43'),JSON[_0xd1d2('0xe')](_0x2690e2));throw new Error(_0xd1d2('0x42')+JSON['stringify'](_0x2690e2));}})['catch'](function(_0x2fd2c5){console['error'](_0x2fd2c5);});}function getZohoUser(_0x55b3d4,_0x55b1a4){return new BPromise(function(_0x43e70f,_0x5747bb){request(_0x55b3d4)[_0xd1d2('0x2d')](function(_0x4e7640){var _0x47996a=null;if(_0x4e7640){_0x47996a=_0x4e7640['data'][0x0];_0x47996a[_0xd1d2('0x44')]=_0x55b1a4;}_0x43e70f(_0x47996a);})[_0xd1d2('0x2f')](function(_0x3637f6){_0x5747bb(_0x3637f6);});});}function createEndUser(_0x3d7edc,_0x33ba30,_0xb5bec2,_0x178f8b,_0x38bf16,_0x2d930d){var _0xb5bec2=getName(_0xb5bec2);return request({'method':_0xd1d2('0x27'),'uri':_0xd1d2('0x45')+_0x33ba30+_0xd1d2('0x46')+_[_0xd1d2('0x47')](_0x2d930d['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xb5bec2[0x1],'First_Name':_0xb5bec2[0x0],'Phone':_0x178f8b,'Owner':{'name':!_['isNil'](_0x38bf16[_0xd1d2('0x48')][_0xd1d2('0x1a')])?_0x38bf16[_0xd1d2('0x48')]['name']:!_['isNil'](_0x38bf16[_0xd1d2('0x49')])?_0x38bf16[_0xd1d2('0x49')]+'\x20'+_0x38bf16['last_name']:_0x38bf16[_0xd1d2('0x4a')],'id':_0x38bf16['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3d7edc},'json':!![]})['then'](function(_0x21eb24){if(_0x21eb24&&_0x21eb24['data'][0x0]['code']===_0xd1d2('0x4b')){var _0x320fa4=_0x21eb24[_0xd1d2('0x4c')][0x0]['details'];_0x320fa4[_0xd1d2('0x44')]=_[_0xd1d2('0x47')](_0x2d930d[_0xd1d2('0x4d')])+'s';return _0x320fa4;}logger[_0xd1d2('0x30')]('The\x20failing\x20result\x20is',JSON[_0xd1d2('0xe')](data));throw new Error(_0xd1d2('0x4e')+JSON['stringify'](data));})[_0xd1d2('0x2f')](function(_0x5d8456){console[_0xd1d2('0x4f')](_0xd1d2('0x50'),_0x5d8456);});}function getEndUser(_0xe8d484,_0xed5351,_0x1fd2fc,_0x52bf9a,_0x51e82a,_0x422fb9,_0x104712){var _0x5d8ef2={'method':_0xd1d2('0x34'),'uri':'','headers':{'Authorization':_0xd1d2('0x37')+_0xe8d484},'json':!![]};switch(_0x104712[_0xd1d2('0x51')]){case _0xd1d2('0x52'):_0x5d8ef2[_0xd1d2('0x53')]=_0xd1d2('0x45')+_0xed5351+_0xd1d2('0x54')+_0x51e82a+'))';return getZohoUser(_0x5d8ef2,'Contacts')[_0xd1d2('0x2d')](function(_0xc10c10){if(_0xc10c10)return _0xc10c10;_0x5d8ef2['uri']=_0xd1d2('0x45')+_0xed5351+_0xd1d2('0x55')+_0x51e82a+'))';return getZohoUser(_0x5d8ef2,'Leads')['then'](function(_0x3d4fe3){if(_0x3d4fe3)return _0x3d4fe3;if(_0x104712[_0xd1d2('0x4d')]!='nothing'){return createEndUser(_0xe8d484,_0xed5351,_0x52bf9a,_0x51e82a,_0x422fb9,_0x104712);}else{return{};}});});break;case _0xd1d2('0x56'):_0x5d8ef2[_0xd1d2('0x53')]=_0xd1d2('0x45')+_0xed5351+_0xd1d2('0x54')+_0x51e82a+'))';return getZohoUser(_0x5d8ef2,_0xd1d2('0x57'))['then'](function(_0x4dd22e){if(_0x4dd22e)return _0x4dd22e;if(_0x104712[_0xd1d2('0x4d')]!='nothing'){return createEndUser(_0xe8d484,_0xed5351,_0x52bf9a,_0x51e82a,_0x422fb9,_0x104712);}else{return{};}});break;case _0xd1d2('0x58'):_0x5d8ef2[_0xd1d2('0x53')]='https://www.zohoapis.'+_0xed5351+_0xd1d2('0x55')+_0x51e82a+'))';return getZohoUser(_0x5d8ef2,_0xd1d2('0x59'))['then'](function(_0x56069f){if(_0x56069f)return _0x56069f;if(_0x104712[_0xd1d2('0x4d')]!=_0xd1d2('0x5a')){return createEndUser(_0xe8d484,_0xed5351,_0x52bf9a,_0x51e82a,_0x422fb9,_0x104712);}else{return{};}});break;}}function getCall(_0x187de4,_0xfd8024,_0xa013ce,_0x34a793,_0x1f6150,_0x3411c8,_0x33e332,_0x5e15cb){logger[_0xd1d2('0x3c')]('Creating\x20new\x20call...');var _0x55c44f={};_0x55c44f[_0xd1d2('0x5b')]={'name':!_[_0xd1d2('0x1d')](_0x34a793[_0xd1d2('0x48')][_0xd1d2('0x1a')])&&!_[_0xd1d2('0x1d')](_0x34a793[_0xd1d2('0x3f')][_0xd1d2('0x1a')])&&_0x34a793[_0xd1d2('0x3f')][_0xd1d2('0x1a')]===_0xd1d2('0x5c')?_0x34a793[_0xd1d2('0x48')][_0xd1d2('0x1a')]:!_[_0xd1d2('0x1d')](_0x34a793['first_name'])?_0x34a793['first_name']+'\x20'+_0x34a793[_0xd1d2('0x4a')]:_0x34a793[_0xd1d2('0x4a')],'id':_0x34a793['id']};_0x55c44f[_0xd1d2('0x5d')]=intUtil[_0xd1d2('0x5e')](_0x3411c8[_0xd1d2('0x5f')],_0x33e332,'\x20');_0x55c44f[_0xd1d2('0x60')]=intUtil[_0xd1d2('0x5e')](_0x3411c8[_0xd1d2('0x61')],_0x33e332,'\x0a');if(_0x1f6150[_0xd1d2('0x44')]===_0xd1d2('0x57')){_0x55c44f[_0xd1d2('0x62')]={'name':!_['isNil'](_0x1f6150['Full_Name'])?_0x1f6150[_0xd1d2('0x63')]:!_[_0xd1d2('0x1d')](_0x1f6150[_0xd1d2('0x64')])?_0x1f6150[_0xd1d2('0x64')]+'\x20'+_0x1f6150['Last_Name']:_0x1f6150[_0xd1d2('0x65')],'id':_0x1f6150['id']};}if(_0x1f6150[_0xd1d2('0x44')]===_0xd1d2('0x59')){_0x55c44f[_0xd1d2('0x66')]={'name':!_[_0xd1d2('0x1d')](_0x1f6150[_0xd1d2('0x63')])?_0x1f6150[_0xd1d2('0x63')]:!_['isNil'](_0x1f6150[_0xd1d2('0x64')])?_0x1f6150[_0xd1d2('0x64')]+'\x20'+_0x1f6150[_0xd1d2('0x65')]:_0x1f6150['Last_Name'],'id':_0x1f6150['id']};_0x55c44f['$se_module']=_[_0xd1d2('0x47')](_0x1f6150[_0xd1d2('0x44')]);}if(_0x33e332[_0xd1d2('0x67')]){_0x55c44f[_0xd1d2('0x68')]=moment['utc'](parseInt(_0x33e332[_0xd1d2('0x67')])*0x3e8)[_0xd1d2('0x35')](_0xd1d2('0x69'));}else if(_0x33e332['answertime']&&_0x33e332[_0xd1d2('0x6a')]){_0x55c44f[_0xd1d2('0x68')]=moment['utc'](moment(_0x33e332[_0xd1d2('0x6a')],_0xd1d2('0x6b'))[_0xd1d2('0x6c')](moment(_0x33e332[_0xd1d2('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0xd1d2('0x35')](_0xd1d2('0x69'));}switch(_0x33e332[_0xd1d2('0x6e')]){case _0xd1d2('0x6f'):_0x55c44f[_0xd1d2('0x70')]='Called';break;case'complete':case'connect':_0x55c44f['Call_Result']='Answered';break;case _0xd1d2('0x71'):_0x55c44f[_0xd1d2('0x70')]=_0xd1d2('0x72');break;case'abandoned':_0x55c44f[_0xd1d2('0x70')]=_0xd1d2('0x73');break;case _0xd1d2('0x74'):_0x55c44f['Call_Result']=_0xd1d2('0x75');default:}_0x55c44f[_0xd1d2('0x76')]=(_0x5e15cb===_0xd1d2('0x77')?moment(_0x33e332[_0xd1d2('0x6d')])[_0xd1d2('0x35')](_0xd1d2('0x6b')):moment(_0x33e332['agentcalledAt'])[_0xd1d2('0x35')](_0xd1d2('0x6b')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x55c44f[_0xd1d2('0x78')]=_0x5e15cb||_0xd1d2('0x79');_0x55c44f=_[_0xd1d2('0x7a')](_0x55c44f,getCustomFields(_0x3411c8[_0xd1d2('0x7b')],_0x33e332));return request({'method':'POST','uri':_0xd1d2('0x45')+_0xfd8024+_0xd1d2('0x7c'),'headers':{'Authorization':_0xd1d2('0x37')+_0x187de4},'body':{'data':[_0x55c44f]},'json':!![]})[_0xd1d2('0x2d')](function(_0x5d537e){if(_0x5d537e&&_0x5d537e[_0xd1d2('0x4c')][0x0][_0xd1d2('0x7d')]===_0xd1d2('0x4b')){logger['info'](_0xd1d2('0x7e'));return{'id':_0x5d537e[_0xd1d2('0x4c')][0x0]['details']['id']};}})[_0xd1d2('0x2f')](function(_0x32ae30){logger[_0xd1d2('0x3c')](_0xd1d2('0x7f'),_0x32ae30[_0xd1d2('0x32')]);console['log'](_0xd1d2('0x7f'),_0x32ae30);});}exports['queue']=function(_0x4ec2e1,_0x5b4ab1,_0x502432,_0x89ec63,_0x5ed30b,_0x37591f){var _0x52dd76,_0x3451a0,_0x3ef29d;_0x37591f[_0xd1d2('0x80')]=intUtil[_0xd1d2('0x81')](_0x37591f[_0xd1d2('0x80')]);_0x37591f[_0xd1d2('0x82')]=intUtil['stripTrailingSlash'](_0x37591f[_0xd1d2('0x82')]);if(_0x5ed30b&&_0x5ed30b[_0xd1d2('0x83')]){logger[_0xd1d2('0x3c')](_0xd1d2('0x84'),_0xd1d2('0x85'));_0x5b4ab1[_0xd1d2('0x86')]=_0x37591f[_0xd1d2('0x82')]+_0xd1d2('0x87')+_0x5b4ab1[_0xd1d2('0x88')]+_0xd1d2('0x89')+md5(_0x5b4ab1['uniqueid']);}else{_0x5b4ab1[_0xd1d2('0x86')]='';}var _0x428200=_0x37591f[_0xd1d2('0x80')]===_0xd1d2('0x8a')?'eu':'com';return getAccessToken(_0x37591f)[_0xd1d2('0x2d')](function(_0x28958d){_0x3ef29d=_0x28958d;return getUser(_0x3ef29d,_0x428200,_0x37591f,_0x89ec63[_0xd1d2('0x3b')]);})['then'](function(_0x2fffe5){_0x52dd76=_0x2fffe5;logger[_0xd1d2('0x3c')]('The\x20User\x20ID\x20is:',_0x52dd76['id']);return getEndUser(_0x3ef29d,_0x428200,_0x37591f,_0x5b4ab1['calleridname'],_0x5b4ab1[_0xd1d2('0x8b')],_0x52dd76,_0x502432);})[_0xd1d2('0x2d')](function(_0x3fbd87){_0x3451a0=_0x3fbd87;return getCall(_0x3ef29d,_0x428200,_0x37591f,_0x52dd76,_0x3451a0,_0x502432,_0x5b4ab1,_0xd1d2('0x79'));})[_0xd1d2('0x2d')](function(_0x32edc9){if(_0x32edc9){logger[_0xd1d2('0x3c')]('The\x20Call\x20ID\x20is:',_0x32edc9['id']);logger[_0xd1d2('0x3c')](_0xd1d2('0x84'),_0xd1d2('0x8c'));emit(util[_0xd1d2('0x35')](_0xd1d2('0x8d'),_0x89ec63[_0xd1d2('0x1a')]),_0xd1d2('0x8e'),{'uri':_0xd1d2('0x8f')+_0x37591f[_0xd1d2('0x80')]+_0xd1d2('0x90')+_0x32edc9['id']});}})[_0xd1d2('0x2f')](function(_0x162249){logger[_0xd1d2('0x30')](_0xd1d2('0x84'),JSON['stringify'](_0x162249));});};exports[_0xd1d2('0x77')]=function(_0x134f94,_0x2c9743,_0x21dde8,_0x20a3f0,_0x32c294,_0x34ffe2,_0x2954c0){var _0x1c0082,_0x431057,_0x66fa57;_0x34ffe2[_0xd1d2('0x80')]=intUtil[_0xd1d2('0x81')](_0x34ffe2['host']);_0x34ffe2[_0xd1d2('0x82')]=intUtil[_0xd1d2('0x81')](_0x34ffe2[_0xd1d2('0x82')]);if(_0x2954c0&&_0x2954c0[_0xd1d2('0x91')]&&_0x2954c0[_0xd1d2('0x91')]!==_0xd1d2('0x92')){logger[_0xd1d2('0x3c')](_0xd1d2('0x93'),_0xd1d2('0x85'));_0x2c9743[_0xd1d2('0x86')]=_0x34ffe2[_0xd1d2('0x82')]+_0xd1d2('0x87')+_0x2c9743['uniqueid']+_0xd1d2('0x89')+md5(_0x2c9743[_0xd1d2('0x88')]);}var _0x279dcb=_0x34ffe2[_0xd1d2('0x80')]===_0xd1d2('0x8a')?'eu':'com';return getAccessToken(_0x34ffe2)[_0xd1d2('0x2d')](function(_0x3d816c){_0x66fa57=_0x3d816c;return getUser(_0x66fa57,_0x279dcb,_0x34ffe2,_0x20a3f0[_0xd1d2('0x3b')]);})[_0xd1d2('0x2d')](function(_0x48f20e){_0x1c0082=_0x48f20e;logger[_0xd1d2('0x3c')](_0xd1d2('0x94'),_0x1c0082['id']);return getEndUser(_0x66fa57,_0x279dcb,_0x34ffe2,_0x2c9743[_0xd1d2('0x95')],_0x2c9743[_0xd1d2('0x96')],_0x1c0082,_0x21dde8);})[_0xd1d2('0x2d')](function(_0x18bd6d){_0x431057=_0x18bd6d;return getCall(_0x66fa57,_0x279dcb,_0x34ffe2,_0x1c0082,_0x431057,_0x21dde8,_0x2c9743,_0xd1d2('0x97'));})['then'](function(_0xb03875){if(_0xb03875){logger[_0xd1d2('0x3c')](_0xd1d2('0x98'),_0xb03875['id']);logger[_0xd1d2('0x3c')](_0xd1d2('0x93'),_0xd1d2('0x8c'));emit(util[_0xd1d2('0x35')](_0xd1d2('0x8d'),_0x20a3f0[_0xd1d2('0x1a')]),_0xd1d2('0x8e'),{'uri':_0xd1d2('0x8f')+_0x34ffe2[_0xd1d2('0x80')]+_0xd1d2('0x90')+_0xb03875['id']});}})[_0xd1d2('0x2f')](function(_0x4d71b0){logger[_0xd1d2('0x30')](_0xd1d2('0x93'),JSON['stringify'](_0x4d71b0));});};exports[_0xd1d2('0x99')]=function(_0x56e2ab,_0xa6df47,_0x2b5f7d,_0x1b9180,_0x362279,_0x2f586e){var _0x3e3e7e,_0x1489e5,_0x1d7add;_0x2f586e['host']=intUtil['stripTrailingSlash'](_0x2f586e[_0xd1d2('0x80')]);_0x2f586e['serverUrl']=intUtil['stripTrailingSlash'](_0x2f586e[_0xd1d2('0x82')]);if(_0x362279&&_0x362279[_0xd1d2('0x83')]){logger['info']('['+_0xa6df47[_0xd1d2('0x6e')][_0xd1d2('0x9a')]()+']',_0xd1d2('0x85'));_0xa6df47[_0xd1d2('0x86')]=_0x2f586e[_0xd1d2('0x82')]+_0xd1d2('0x87')+_0xa6df47[_0xd1d2('0x88')]+'/downloads?type=uniqueid&token='+md5(_0xa6df47[_0xd1d2('0x88')]);}else{_0xa6df47['recordingURL']='';}var _0x1fb0a2=_0x2f586e['host']===_0xd1d2('0x8a')?'eu':_0xd1d2('0x9b');return getAccessToken(_0x2f586e)[_0xd1d2('0x2d')](function(_0x274eb7){_0x1d7add=_0x274eb7;return getUser(_0x1d7add,_0x1fb0a2,_0x2f586e);})[_0xd1d2('0x2d')](function(_0x8d095a){_0x3e3e7e=_0x8d095a;logger[_0xd1d2('0x3c')]('The\x20User\x20ID\x20is:',_0x3e3e7e['id']);return getEndUser(_0x1d7add,_0x1fb0a2,_0x2f586e,_0xa6df47[_0xd1d2('0x9c')],_0xa6df47[_0xd1d2('0x8b')],_0x3e3e7e,_0x2b5f7d);})[_0xd1d2('0x2d')](function(_0x3a7107){_0x1489e5=_0x3a7107;return getCall(_0x1d7add,_0x1fb0a2,_0x2f586e,_0x3e3e7e,_0x1489e5,_0x2b5f7d,_0xa6df47,'Inbound');})[_0xd1d2('0x2d')](function(_0x235e2a){if(_0x235e2a){logger[_0xd1d2('0x3c')]('The\x20Call\x20ID\x20is:',_0x235e2a['id']);}})[_0xd1d2('0x2f')](function(_0x309715){logger[_0xd1d2('0x30')]('['+_0xa6df47[_0xd1d2('0x6e')][_0xd1d2('0x9a')]()+']',JSON['stringify'](_0x309715));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index cfbbac7..c4ade48 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x43f369,_0x47c3fd){var _0x5187f6=function(_0xb7d29e){while(--_0xb7d29e){_0x43f369['push'](_0x43f369['shift']());}};_0x5187f6(++_0x47c3fd);}(_0x7a54,0x106));var _0x47a5=function(_0x43b8dc,_0x1f80e3){_0x43b8dc=_0x43b8dc-0x0;var _0x1c6e3f=_0x7a54[_0x43b8dc];return _0x1c6e3f;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3154c4,_0x11b44c){var _0x3330e3=function(_0x1e0125){while(--_0x1e0125){_0x3154c4['push'](_0x3154c4['shift']());}};_0x3330e3(++_0x11b44c);}(_0x7a54,0x106));var _0x47a5=function(_0xbc8335,_0x2eb8f7){_0xbc8335=_0xbc8335-0x0;var _0x1a2ff7=_0x7a54[_0xbc8335];return _0x1a2ff7;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index ccb3a3c..40e00e0 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x12261b,_0x1311f3){var _0x1cb9eb=function(_0x1aa0f4){while(--_0x1aa0f4){_0x12261b['push'](_0x12261b['shift']());}};_0x1cb9eb(++_0x1311f3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x24f430,_0x523751){_0x24f430=_0x24f430-0x0;var _0x23cc82=_0x5f2f[_0x24f430];return _0x23cc82;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x2b8416,_0x5ca23){var _0x44ba05=function(_0x2f63b9){while(--_0x2f63b9){_0x2b8416['push'](_0x2b8416['shift']());}};_0x44ba05(++_0x5ca23);}(_0xb10b,0x12a));var _0xbb10=function(_0x545e64,_0x356844){_0x545e64=_0x545e64-0x0;var _0x13dbef=_0xb10b[_0x545e64];return _0x13dbef;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7ccf9bf..aea54ef 100644 --- a/server/services/email/client.js +++ b/server/services/email/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe002=['debug','rpc','error','routing','message','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xe002,0xf7));var _0x2e00=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0xe002[_0x10dc64];return _0x9cf98d;};'use strict';var jayson=require(_0x2e00('0x0'));var BPromise=require(_0x2e00('0x1'));var logger=require(_0x2e00('0x2'))('routing');var client=jayson[_0x2e00('0x3')][_0x2e00('0x4')]({'port':0x2329});client[_0x2e00('0x5')]=function(_0x5ea0f5,_0x34f964){return new BPromise(function(_0xba44f2,_0x2cb0ac){return client[_0x2e00('0x6')](_0x5ea0f5,_0x34f964)[_0x2e00('0x7')](function(_0x120155){logger[_0x2e00('0x8')](_0x2e00('0x9'),'routing',_0x5ea0f5,_0x34f964,_0x120155);if(_0x120155[_0x2e00('0xa')]){logger[_0x2e00('0xa')]('rpc',_0x2e00('0xb'),_0x5ea0f5,_0x120155[_0x2e00('0xa')][_0x2e00('0xc')],_0x34f964);return _0x2cb0ac(_0x120155[_0x2e00('0xa')]['message']);}else{return _0xba44f2(_0x120155['result']);}})[_0x2e00('0xd')](function(_0x217799){logger[_0x2e00('0xa')]('rpc',_0x2e00('0xb'),_0x5ea0f5,_0x217799,_0x34f964);return _0x2cb0ac(_0x217799);});});};module[_0x2e00('0xe')]=client; \ No newline at end of file +var _0x0d64=['../../config/logger','routing','http','Request','request','then','debug','rpc','error','message','result','jayson/promise'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x0d64,0x77));var _0x40d6=function(_0xd1a252,_0x16396f){_0xd1a252=_0xd1a252-0x0;var _0x560ee1=_0x0d64[_0xd1a252];return _0x560ee1;};'use strict';var jayson=require(_0x40d6('0x0'));var BPromise=require('bluebird');var logger=require(_0x40d6('0x1'))(_0x40d6('0x2'));var client=jayson['client'][_0x40d6('0x3')]({'port':0x2329});client[_0x40d6('0x4')]=function(_0x59340b,_0x1c9abe){return new BPromise(function(_0xa5722b,_0x1b6003){return client[_0x40d6('0x5')](_0x59340b,_0x1c9abe)[_0x40d6('0x6')](function(_0x2b8aae){logger[_0x40d6('0x7')](_0x40d6('0x8'),_0x40d6('0x2'),_0x59340b,_0x1c9abe,_0x2b8aae);if(_0x2b8aae[_0x40d6('0x9')]){logger[_0x40d6('0x9')](_0x40d6('0x8'),'routing',_0x59340b,_0x2b8aae['error'][_0x40d6('0xa')],_0x1c9abe);return _0x1b6003(_0x2b8aae['error'][_0x40d6('0xa')]);}else{return _0xa5722b(_0x2b8aae[_0x40d6('0xb')]);}})['catch'](function(_0x145e9e){logger['error'](_0x40d6('0x8'),'routing',_0x59340b,_0x145e9e,_0x1c9abe);return _0x1b6003(_0x145e9e);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5c09c5c..1be29db 100644 --- a/server/services/email/index.js +++ b/server/services/email/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1022=['./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0xfe8cd0,_0x382599){var _0x2874e2=function(_0xb2cd5d){while(--_0xb2cd5d){_0xfe8cd0['push'](_0xfe8cd0['shift']());}};_0x2874e2(++_0x382599);}(_0x1022,0x1db));var _0x2102=function(_0x210b8c,_0xd76f59){_0x210b8c=_0x210b8c-0x0;var _0xf39efa=_0x1022[_0x210b8c];return _0xf39efa;};'use strict';var BPromise=require(_0x2102('0x0'));var server=require(_0x2102('0x1'));var Realtime=require(_0x2102('0x2'));var EmailChannel=require(_0x2102('0x3'));var mailAccount=require(_0x2102('0x4'));var setting=require(_0x2102('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x2102('0x6')](mailAccount[_0x2102('0x7')]())[_0x2102('0x6')](realtime[_0x2102('0x8')]())[_0x2102('0x6')](function(){email[_0x2102('0x9')](realtime[_0x2102('0xa')]);return realtime;});}function main(){return server[_0x2102('0xb')](realtime,email)[_0x2102('0x6')](function(){return initRealtime();})[_0x2102('0x6')](function(){return setting[_0x2102('0xc')]();})[_0x2102('0x6')](function(_0x327cd3){return setInterval(initRealtime,_0x327cd3[_0x2102('0xd')]*0x3e8);})['catch'](function(_0x1ab2f1){console[_0x2102('0xe')](_0x1ab2f1);});}main(); \ No newline at end of file +var _0x4ec0=['bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','log'];(function(_0x2f47f1,_0x17f6a7){var _0x1e2329=function(_0x8f5900){while(--_0x8f5900){_0x2f47f1['push'](_0x2f47f1['shift']());}};_0x1e2329(++_0x17f6a7);}(_0x4ec0,0xc4));var _0x04ec=function(_0x2ac1e8,_0x2116f4){_0x2ac1e8=_0x2ac1e8-0x0;var _0x58cc93=_0x4ec0[_0x2ac1e8];return _0x58cc93;};'use strict';var BPromise=require(_0x04ec('0x0'));var server=require(_0x04ec('0x1'));var Realtime=require(_0x04ec('0x2'));var EmailChannel=require(_0x04ec('0x3'));var mailAccount=require(_0x04ec('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x04ec('0x5')]()[_0x04ec('0x6')](mailAccount[_0x04ec('0x7')]())[_0x04ec('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0x04ec('0x8')](realtime[_0x04ec('0x9')]);return realtime;});}function main(){return server[_0x04ec('0xa')](realtime,email)[_0x04ec('0x6')](function(){return initRealtime();})[_0x04ec('0x6')](function(){return setting['getSettings']();})[_0x04ec('0x6')](function(_0x241466){return setInterval(initRealtime,_0x241466[_0x04ec('0xb')]*0x3e8);})[_0x04ec('0xc')](function(_0x1c91ec){console[_0x04ec('0xd')](_0x1c91ec);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index b47c8be..84b02ec 100644 --- a/server/services/email/lib/email.js +++ b/server/services/email/lib/email.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa265=['sendMail','smtp','send','Smtp','verify','verified','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','key','active','status','Imap','messageStatus','isNil','md5','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapEnd','error','disabled','handleImapBox','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError'];(function(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0xa265,0x16b));var _0x5a26=function(_0x294df2,_0x5c96e6){_0x294df2=_0x294df2-0x0;var _0x2ef934=_0xa265[_0x294df2];return _0x2ef934;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x5a26('0x0'));var md5=require('md5');var Redis=require(_0x5a26('0x1'));var config=require(_0x5a26('0x2'));var logger=require(_0x5a26('0x3'))(_0x5a26('0x4'));config['redis']=_[_0x5a26('0x5')](config['redis'],{'host':_0x5a26('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x5a26('0x7'));var EmailSmtp=require(_0x5a26('0x8'));var mailAccount=require(_0x5a26('0x9'));var md5Accounts={};function EmailChannel(_0x2b1fa0){logger[_0x5a26('0xa')]('start\x20email\x20channel');this['mailAccounts']=_0x2b1fa0[_0x5a26('0xb')];this[_0x5a26('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x5a26('0xd')][_0x5a26('0xe')]=function(_0x4bf027){var _0x1aeda5=this['mailAccounts'][_0x4bf027];var _0x333f6c={'id':_0x1aeda5['id'],'name':_0x1aeda5[_0x5a26('0xf')],'key':_0x1aeda5[_0x5a26('0x10')],'active':_0x1aeda5[_0x5a26('0x11')],'Imap':{'status':_0x1aeda5['Imap'][_0x5a26('0x12')],'messageStatus':_0x1aeda5[_0x5a26('0x13')][_0x5a26('0x14')],'total':_0x1aeda5[_0x5a26('0x13')]['total']}};if(_[_0x5a26('0x15')](md5Accounts[_0x4bf027])){md5Accounts[_0x4bf027]={};}var _0x1a8160=md5(JSON['stringify'](_0x333f6c));if(md5Accounts[_0x4bf027][_0x5a26('0x16')]!==_0x1a8160){md5Accounts[_0x4bf027][_0x5a26('0x16')]=_0x1a8160;io['emit'](_0x5a26('0x17'),_0x333f6c);}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x18')]=function(_0x4bbe7c){for(var _0x38bbad in _0x4bbe7c){if(_0x4bbe7c[_0x5a26('0x19')](_0x38bbad)){if(_0x4bbe7c[_0x38bbad][_0x5a26('0x13')]&&_0x4bbe7c[_0x38bbad][_0x5a26('0x11')]){var _0x2d1498=_0x4bbe7c[_0x38bbad]['Imap'];if(!this[_0x5a26('0xc')][_0x5a26('0x19')](_0x2d1498['id'])){this[_0x5a26('0xc')][_0x2d1498['id']]=new EmailImap(_0x2d1498,_0x4bbe7c[_0x38bbad][_0x5a26('0x4')]);this['imapAccounts'][_0x2d1498['id']]['on'](_0x5a26('0x1a'),this['handleImapBox'][_0x5a26('0x1b')](this,_0x38bbad));this[_0x5a26('0xc')][_0x2d1498['id']]['on'](_0x5a26('0x4'),this[_0x5a26('0x1c')][_0x5a26('0x1b')](this,_0x38bbad));this[_0x5a26('0xc')][_0x2d1498['id']]['on'](_0x5a26('0x1d'),this[_0x5a26('0x1e')][_0x5a26('0x1b')](this,_0x38bbad));this[_0x5a26('0xc')][_0x2d1498['id']]['on'](_0x5a26('0x1f'),this['handleImapError'][_0x5a26('0x1b')](this,_0x38bbad));}}else{if(_[_0x5a26('0x15')](this[_0x5a26('0xb')][_0x38bbad]['Imap'])){this[_0x5a26('0xb')][_0x38bbad][_0x5a26('0x13')]={};}this[_0x5a26('0xb')][_0x38bbad][_0x5a26('0x13')][_0x5a26('0x12')]=_0x5a26('0x20');this[_0x5a26('0xb')][_0x38bbad][_0x5a26('0x13')][_0x5a26('0x14')]='';this[_0x5a26('0xe')](_0x38bbad);}}}};EmailChannel['prototype'][_0x5a26('0x21')]=function(_0x26c1bc,_0x512514){if(this[_0x5a26('0xb')][_0x26c1bc]){this[_0x5a26('0xb')][_0x26c1bc][_0x5a26('0x13')][_0x5a26('0x12')]=_0x5a26('0x22');this[_0x5a26('0xb')][_0x26c1bc][_0x5a26('0x13')][_0x5a26('0x14')]=_0x512514[_0x5a26('0xf')];if(_0x512514['messages']){this[_0x5a26('0xb')][_0x26c1bc][_0x5a26('0x13')][_0x5a26('0x23')]=_0x512514['messages']['total'];}return this['emit'](_0x26c1bc);}};EmailChannel[_0x5a26('0xd')]['handleImapEmail']=function(_0x525806,_0x35fd78){logger[_0x5a26('0xa')](_0x5a26('0x24'),_0x35fd78[_0x5a26('0x25')],_0x35fd78[_0x5a26('0x26')],_0x35fd78['from'],_0x525806);if(this[_0x5a26('0xb')][_0x525806]){return mailAccount['notify'](_0x525806,_0x35fd78)[_0x5a26('0x27')](function(_0x697d13){if(_0x697d13){logger[_0x5a26('0xa')](_0x5a26('0x28'));}})[_0x5a26('0x29')](function(_0x429220){logger[_0x5a26('0x1f')](_0x5a26('0x2a'),JSON['stringify'](_0x429220));});}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x1e')]=function(_0x57bdc4){if(this[_0x5a26('0xb')][_0x57bdc4]&&this[_0x5a26('0xb')][_0x57bdc4][_0x5a26('0x13')]){if(this[_0x5a26('0xc')][this[_0x5a26('0xb')][_0x57bdc4]['Imap']['id']]){delete this[_0x5a26('0xc')][this[_0x5a26('0xb')][_0x57bdc4][_0x5a26('0x13')]['id']];}this[_0x5a26('0xb')][_0x57bdc4][_0x5a26('0x13')][_0x5a26('0x2b')]=moment();this[_0x5a26('0xe')](_0x57bdc4);}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x2c')]=function(_0x4faa78,_0x1be5ad){if(this['mailAccounts'][_0x4faa78]){this[_0x5a26('0xb')][_0x4faa78][_0x5a26('0x13')][_0x5a26('0x12')]=_0x5a26('0x1f');this[_0x5a26('0xb')][_0x4faa78][_0x5a26('0x13')][_0x5a26('0x14')]=_0x1be5ad;return this[_0x5a26('0xe')](_0x4faa78);}};EmailChannel[_0x5a26('0xd')][_0x5a26('0x2d')]=function(_0x459f68,_0x48dfab){return this[_0x5a26('0x2e')][_0x5a26('0x2f')](_0x459f68,_0x48dfab);};EmailChannel[_0x5a26('0xd')]['verifySmtp']=function(_0x15414b){var _0x18a076=this;if(this['mailAccounts'][_0x15414b['id']]){if(_['isNil'](this[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')])){this['mailAccounts'][_0x15414b['id']][_0x5a26('0x30')]={};}this[_0x5a26('0xb')][_0x15414b['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x266b3b,_0x4010b0){return _0x18a076['smtp'][_0x5a26('0x31')](_0x15414b)['then'](function(_0x42ec11){_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')]['status']=_0x5a26('0x32');_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')][_0x5a26('0x14')]='';_0x18a076[_0x5a26('0xe')](_0x15414b['id']);_0x266b3b(_0x42ec11);})[_0x5a26('0x29')](function(_0x1f0cc6){_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')][_0x5a26('0x12')]='error';_0x18a076[_0x5a26('0xb')][_0x15414b['id']][_0x5a26('0x30')][_0x5a26('0x14')]=_0x1f0cc6;_0x18a076[_0x5a26('0xe')](_0x15414b['id']);_0x4010b0(_0x1f0cc6);});});}return this[_0x5a26('0x2e')][_0x5a26('0x31')](_0x15414b);};module['exports']=EmailChannel; \ No newline at end of file +var _0xf377=['Smtp','smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','emit','name','key','Imap','messageStatus','total','isNil','stringify','prototype','refresh','hasOwnProperty','active','handleImapBox','bind','handleImapEmail','handleImapError','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','status','send','verifySmtp'];(function(_0x35b5e3,_0xa50391){var _0x3a7cff=function(_0xd83327){while(--_0xd83327){_0x35b5e3['push'](_0x35b5e3['shift']());}};_0x3a7cff(++_0xa50391);}(_0xf377,0x18d));var _0x7f37=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf377[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7f37('0x0'));var moment=require(_0x7f37('0x1'));var BPromise=require(_0x7f37('0x2'));var md5=require(_0x7f37('0x3'));var Redis=require(_0x7f37('0x4'));var config=require(_0x7f37('0x5'));var logger=require(_0x7f37('0x6'))(_0x7f37('0x7'));config[_0x7f37('0x8')]=_[_0x7f37('0x9')](config[_0x7f37('0x8')],{'host':_0x7f37('0xa'),'port':0x18eb});var io=require(_0x7f37('0xb'))(new Redis(config[_0x7f37('0x8')]));var EmailImap=require(_0x7f37('0xc'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x7f37('0xd'));var md5Accounts={};function EmailChannel(_0x34ee92){logger['info'](_0x7f37('0xe'));this[_0x7f37('0xf')]=_0x34ee92[_0x7f37('0xf')];this[_0x7f37('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x7f37('0x11')]=function(_0x16f799){var _0x4f11c2=this[_0x7f37('0xf')][_0x16f799];var _0x212fde={'id':_0x4f11c2['id'],'name':_0x4f11c2[_0x7f37('0x12')],'key':_0x4f11c2[_0x7f37('0x13')],'active':_0x4f11c2['active'],'Imap':{'status':_0x4f11c2[_0x7f37('0x14')]['status'],'messageStatus':_0x4f11c2['Imap'][_0x7f37('0x15')],'total':_0x4f11c2[_0x7f37('0x14')][_0x7f37('0x16')]}};if(_[_0x7f37('0x17')](md5Accounts[_0x16f799])){md5Accounts[_0x16f799]={};}var _0x5d7997=md5(JSON[_0x7f37('0x18')](_0x212fde));if(md5Accounts[_0x16f799]['md5']!==_0x5d7997){md5Accounts[_0x16f799][_0x7f37('0x3')]=_0x5d7997;io['emit']('mailAccount:update',_0x212fde);}};EmailChannel[_0x7f37('0x19')][_0x7f37('0x1a')]=function(_0x5f0751){for(var _0x25c1de in _0x5f0751){if(_0x5f0751[_0x7f37('0x1b')](_0x25c1de)){if(_0x5f0751[_0x25c1de]['Imap']&&_0x5f0751[_0x25c1de][_0x7f37('0x1c')]){var _0x379505=_0x5f0751[_0x25c1de][_0x7f37('0x14')];if(!this[_0x7f37('0x10')][_0x7f37('0x1b')](_0x379505['id'])){this[_0x7f37('0x10')][_0x379505['id']]=new EmailImap(_0x379505,_0x5f0751[_0x25c1de][_0x7f37('0x7')]);this[_0x7f37('0x10')][_0x379505['id']]['on']('box',this[_0x7f37('0x1d')][_0x7f37('0x1e')](this,_0x25c1de));this[_0x7f37('0x10')][_0x379505['id']]['on']('email',this[_0x7f37('0x1f')][_0x7f37('0x1e')](this,_0x25c1de));this['imapAccounts'][_0x379505['id']]['on']('end',this['handleImapEnd'][_0x7f37('0x1e')](this,_0x25c1de));this[_0x7f37('0x10')][_0x379505['id']]['on']('error',this[_0x7f37('0x20')][_0x7f37('0x1e')](this,_0x25c1de));}}else{if(_[_0x7f37('0x17')](this[_0x7f37('0xf')][_0x25c1de][_0x7f37('0x14')])){this[_0x7f37('0xf')][_0x25c1de][_0x7f37('0x14')]={};}this[_0x7f37('0xf')][_0x25c1de][_0x7f37('0x14')]['status']='disabled';this[_0x7f37('0xf')][_0x25c1de][_0x7f37('0x14')][_0x7f37('0x15')]='';this[_0x7f37('0x11')](_0x25c1de);}}}};EmailChannel[_0x7f37('0x19')]['handleImapBox']=function(_0x186636,_0x97db97){if(this[_0x7f37('0xf')][_0x186636]){this[_0x7f37('0xf')][_0x186636][_0x7f37('0x14')]['status']=_0x7f37('0x21');this[_0x7f37('0xf')][_0x186636]['Imap'][_0x7f37('0x15')]=_0x97db97[_0x7f37('0x12')];if(_0x97db97['messages']){this[_0x7f37('0xf')][_0x186636][_0x7f37('0x14')][_0x7f37('0x16')]=_0x97db97[_0x7f37('0x22')][_0x7f37('0x16')];}return this[_0x7f37('0x11')](_0x186636);}};EmailChannel[_0x7f37('0x19')]['handleImapEmail']=function(_0x5e38ff,_0x61be4b){logger[_0x7f37('0x23')](_0x7f37('0x24'),_0x61be4b[_0x7f37('0x25')],_0x61be4b[_0x7f37('0x26')],_0x61be4b[_0x7f37('0x27')],_0x5e38ff);if(this[_0x7f37('0xf')][_0x5e38ff]){return mailAccount[_0x7f37('0x28')](_0x5e38ff,_0x61be4b)[_0x7f37('0x29')](function(_0x2d2bc3){if(_0x2d2bc3){logger[_0x7f37('0x23')](_0x7f37('0x2a'));}})[_0x7f37('0x2b')](function(_0x519ba5){logger[_0x7f37('0x2c')](_0x7f37('0x2d'),JSON[_0x7f37('0x18')](_0x519ba5));});}};EmailChannel['prototype'][_0x7f37('0x2e')]=function(_0x422b28){if(this[_0x7f37('0xf')][_0x422b28]&&this[_0x7f37('0xf')][_0x422b28][_0x7f37('0x14')]){if(this[_0x7f37('0x10')][this[_0x7f37('0xf')][_0x422b28][_0x7f37('0x14')]['id']]){delete this[_0x7f37('0x10')][this[_0x7f37('0xf')][_0x422b28][_0x7f37('0x14')]['id']];}this[_0x7f37('0xf')][_0x422b28][_0x7f37('0x14')][_0x7f37('0x2f')]=moment();this[_0x7f37('0x11')](_0x422b28);}};EmailChannel[_0x7f37('0x19')][_0x7f37('0x20')]=function(_0x4f1d58,_0x53cbb0){if(this[_0x7f37('0xf')][_0x4f1d58]){this[_0x7f37('0xf')][_0x4f1d58][_0x7f37('0x14')][_0x7f37('0x30')]=_0x7f37('0x2c');this[_0x7f37('0xf')][_0x4f1d58][_0x7f37('0x14')]['messageStatus']=_0x53cbb0;return this[_0x7f37('0x11')](_0x4f1d58);}};EmailChannel[_0x7f37('0x19')]['sendMail']=function(_0x337a4d,_0x1f5f58){return this['smtp'][_0x7f37('0x31')](_0x337a4d,_0x1f5f58);};EmailChannel[_0x7f37('0x19')][_0x7f37('0x32')]=function(_0x4c7a19){var _0x29237e=this;if(this['mailAccounts'][_0x4c7a19['id']]){if(_[_0x7f37('0x17')](this[_0x7f37('0xf')][_0x4c7a19['id']][_0x7f37('0x33')])){this['mailAccounts'][_0x4c7a19['id']][_0x7f37('0x33')]={};}this[_0x7f37('0xf')][_0x4c7a19['id']][_0x7f37('0x33')][_0x7f37('0x2f')]=moment();return new BPromise(function(_0x374f96,_0x19b394){return _0x29237e[_0x7f37('0x34')][_0x7f37('0x35')](_0x4c7a19)['then'](function(_0x3316f3){_0x29237e['mailAccounts'][_0x4c7a19['id']][_0x7f37('0x33')]['status']=_0x7f37('0x36');_0x29237e[_0x7f37('0xf')][_0x4c7a19['id']][_0x7f37('0x33')]['messageStatus']='';_0x29237e[_0x7f37('0x11')](_0x4c7a19['id']);_0x374f96(_0x3316f3);})[_0x7f37('0x2b')](function(_0x535b51){_0x29237e[_0x7f37('0xf')][_0x4c7a19['id']][_0x7f37('0x33')][_0x7f37('0x30')]=_0x7f37('0x2c');_0x29237e['mailAccounts'][_0x4c7a19['id']][_0x7f37('0x33')][_0x7f37('0x15')]=_0x535b51;_0x29237e['emit'](_0x4c7a19['id']);_0x19b394(_0x535b51);});});}return this[_0x7f37('0x34')]['verify'](_0x4c7a19);};module[_0x7f37('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index edce6ec..336be5f 100644 --- a/server/services/email/lib/imap.js +++ b/server/services/email/lib/imap.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a60=['end','prototype','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','ready','bind','handleEnd','error','handleError','connTimeout','authTimeout','authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','handleReady','handleOpenBox','emit','box','readUnseen','handleCloseBox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1a60,0x196));var _0x01a6=function(_0x26c763,_0x412182){_0x26c763=_0x26c763-0x0;var _0x1f832a=_0x1a60[_0x26c763];return _0x1f832a;};'use strict';var fs=require('fs');var path=require(_0x01a6('0x0'));var util=require(_0x01a6('0x1'));var Imap=require(_0x01a6('0x2'));var _=require(_0x01a6('0x3'));var rs=require(_0x01a6('0x4'));var simpleParser=require(_0x01a6('0x5'))[_0x01a6('0x6')];var Iconv=require(_0x01a6('0x7'))[_0x01a6('0x8')];var EventEmitter=require(_0x01a6('0x9'))[_0x01a6('0xa')];var utils=require(_0x01a6('0xb'));var logger=require('../../../config/logger')(_0x01a6('0xc'));function EmailImap(_0xb555da,_0x51ab67){this[_0x01a6('0xd')]=_0x01a6('0xe');this[_0x01a6('0xf')]=this[_0x01a6('0x10')](_0xb555da,_0x51ab67);this[_0x01a6('0x2')]=new Imap(this[_0x01a6('0xf')]);this[_0x01a6('0x2')][_0x01a6('0x11')](_0x01a6('0x12'),this['handleReady'][_0x01a6('0x13')](this));this['imap'][_0x01a6('0x11')]('end',this[_0x01a6('0x14')][_0x01a6('0x13')](this));this['imap']['on'](_0x01a6('0x15'),this[_0x01a6('0x16')]['bind'](this));this[_0x01a6('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x01a6('0x10')]=function(_0x2edf8a,_0x52f36e){var _0x24b15c={'connTimeout':_0x2edf8a[_0x01a6('0x17')]?_0x2edf8a[_0x01a6('0x17')]*0x3e8:0x2710,'authTimeout':_0x2edf8a[_0x01a6('0x18')]?_0x2edf8a[_0x01a6('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x2edf8a['service'])){if(_0x2edf8a[_0x01a6('0x19')]){_0x24b15c[_0x01a6('0x1a')]=_0x2edf8a['user'];_0x24b15c['password']=_0x2edf8a[_0x01a6('0x1b')];}_0x24b15c[_0x01a6('0x1c')]=_0x2edf8a[_0x01a6('0x1c')];_0x24b15c[_0x01a6('0x1d')]=_0x2edf8a[_0x01a6('0x1d')]||0x3e1;if(_0x2edf8a[_0x01a6('0x1e')]){_0x24b15c['tls']=!![];}else{_0x24b15c['tls']=![];_0x24b15c[_0x01a6('0x1f')]=_0x01a6('0x20');}}else{_0x24b15c[_0x01a6('0x1a')]=_0x2edf8a['user'];_0x24b15c[_0x01a6('0x1b')]=_0x2edf8a[_0x01a6('0x1b')];_0x24b15c[_0x01a6('0x1c')]=utils[_0x01a6('0x21')](_0x2edf8a[_0x01a6('0x22')]);_0x24b15c[_0x01a6('0x1d')]=0x3e1;_0x24b15c[_0x01a6('0x1e')]=!![];}_0x24b15c['email']=_0x52f36e||_0x2edf8a['user']||_0x01a6('0x23');return _0x24b15c;};EmailImap['prototype'][_0x01a6('0x24')]=function(){this['imap']['openBox'](this[_0x01a6('0xd')],![],this['handleOpenBox']['bind'](this));};EmailImap['prototype'][_0x01a6('0x25')]=function(_0x1637ad,_0x4ca132){if(_0x1637ad){this[_0x01a6('0x16')](_0x1637ad,!![]);}else{this[_0x01a6('0x26')](_0x01a6('0x27'),_0x4ca132);this[_0x01a6('0x28')]();}};EmailImap['prototype'][_0x01a6('0x29')]=function(_0x56ccb8){if(_0x56ccb8){this[_0x01a6('0x16')](_0x56ccb8,!![]);}else{this[_0x01a6('0x2')][_0x01a6('0x2a')]();}};EmailImap[_0x01a6('0x2b')][_0x01a6('0x28')]=function(){this[_0x01a6('0x2')]['search']([_0x01a6('0x2c')],this[_0x01a6('0x2d')]['bind'](this));};EmailImap[_0x01a6('0x2b')][_0x01a6('0x2d')]=function(_0x51bab4,_0x3d9bd6){if(_0x51bab4){this[_0x01a6('0x16')](_0x51bab4,!![]);}else{if(_0x3d9bd6[_0x01a6('0x2e')]){try{var _0x65254b=this[_0x01a6('0x2')][_0x01a6('0x2f')](_0x3d9bd6,{'bodies':'','markSeen':!![]});_0x65254b['on'](_0x01a6('0x30'),this[_0x01a6('0x31')][_0x01a6('0x13')](this));_0x65254b[_0x01a6('0x11')](_0x01a6('0x15'),this[_0x01a6('0x32')][_0x01a6('0x13')](this));_0x65254b[_0x01a6('0x11')](_0x01a6('0x2a'),this['handleFetchEnd']['bind'](this));}catch(_0x40da83){logger['error'](_0x40da83);}}else{this[_0x01a6('0x2')][_0x01a6('0x33')](!![],this[_0x01a6('0x29')][_0x01a6('0x13')](this));}}};EmailImap[_0x01a6('0x2b')][_0x01a6('0x31')]=function(_0x518877,_0x40c8d9){_0x518877['on'](_0x01a6('0x34'),this[_0x01a6('0x35')]['bind'](this));_0x518877[_0x01a6('0x11')](_0x01a6('0x36'),this[_0x01a6('0x37')]['bind'](this));_0x518877['once'](_0x01a6('0x2a'),this[_0x01a6('0x38')]['bind'](this));};EmailImap[_0x01a6('0x2b')]['handleMessageBody']=function(_0x5a6f47,_0xc0ee80){simpleParser(_0x5a6f47,{'Iconv':Iconv},this[_0x01a6('0x39')][_0x01a6('0x13')](this));};EmailImap[_0x01a6('0x2b')]['handleMessageAttributes']=function(_0x5d9d2a){};EmailImap[_0x01a6('0x2b')][_0x01a6('0x38')]=function(){};EmailImap[_0x01a6('0x2b')][_0x01a6('0x39')]=function(_0x3740b0,_0x352969){if(_0x3740b0){logger[_0x01a6('0x15')](_0x3740b0);}else{var _0x2c31d8=this;utils[_0x01a6('0x3a')](this[_0x01a6('0xf')],_0x352969,function(_0x4daa1c){_0x2c31d8[_0x01a6('0x26')]('email',_0x4daa1c);});}};EmailImap['prototype'][_0x01a6('0x3b')]=function(){this[_0x01a6('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x01a6('0x13')](this));};EmailImap[_0x01a6('0x2b')]['handleFetchError']=function(_0x1a137f){this[_0x01a6('0x16')](_0x1a137f);this[_0x01a6('0x2')][_0x01a6('0x33')](!![],this[_0x01a6('0x29')][_0x01a6('0x13')](this));};EmailImap[_0x01a6('0x2b')]['handleEnd']=function(){this['emit'](_0x01a6('0x2a'));};EmailImap[_0x01a6('0x2b')][_0x01a6('0x16')]=function(_0x14a53d,_0x34115d){logger[_0x01a6('0x15')](_0x01a6('0x16'),this['account']['email'],JSON[_0x01a6('0x3c')](_0x14a53d));var _0x4921c3='';if(_0x14a53d){if(_0x14a53d['textCode']){_0x4921c3=_0x14a53d[_0x01a6('0x3d')];}else{for(var _0x406d69 in _0x14a53d){if(_0x14a53d['hasOwnProperty'](_0x406d69)){_0x4921c3+=_[_0x01a6('0x3e')](_0x406d69)+':\x20'+_0x14a53d[_0x406d69]+'\x0a';}}}}if(_0x34115d){this['imap'][_0x01a6('0x2a')]();}else{this[_0x01a6('0x26')](_0x01a6('0x15'),_0x4921c3);this[_0x01a6('0x26')](_0x01a6('0x2a'));}};module[_0x01a6('0x3f')]=EmailImap; \ No newline at end of file +var _0xbef1=['../../../config/logger','email','mailbox','INBOX','imap','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','account','stringify','textCode','hasOwnProperty','upperFirst','path','util','mailparser','iconv','Iconv','events','EventEmitter','./utils'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbef1,0x1a3));var _0x1bef=function(_0x51d56b,_0x53e939){_0x51d56b=_0x51d56b-0x0;var _0x1bfdb6=_0xbef1[_0x51d56b];return _0x1bfdb6;};'use strict';var fs=require('fs');var path=require(_0x1bef('0x0'));var util=require(_0x1bef('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x1bef('0x2'))['simpleParser'];var Iconv=require(_0x1bef('0x3'))[_0x1bef('0x4')];var EventEmitter=require(_0x1bef('0x5'))[_0x1bef('0x6')];var utils=require(_0x1bef('0x7'));var logger=require(_0x1bef('0x8'))(_0x1bef('0x9'));function EmailImap(_0x451713,_0x3d85f9){this[_0x1bef('0xa')]=_0x1bef('0xb');this['account']=this['getAccount'](_0x451713,_0x3d85f9);this[_0x1bef('0xc')]=new Imap(this['account']);this[_0x1bef('0xc')]['once'](_0x1bef('0xd'),this[_0x1bef('0xe')][_0x1bef('0xf')](this));this[_0x1bef('0xc')][_0x1bef('0x10')](_0x1bef('0x11'),this[_0x1bef('0x12')][_0x1bef('0xf')](this));this[_0x1bef('0xc')]['on'](_0x1bef('0x13'),this[_0x1bef('0x14')]['bind'](this));this['imap']['connect']();}util[_0x1bef('0x15')](EmailImap,EventEmitter);EmailImap[_0x1bef('0x16')][_0x1bef('0x17')]=function(_0x301efb,_0x57d626){var _0x529ab4={'connTimeout':_0x301efb[_0x1bef('0x18')]?_0x301efb[_0x1bef('0x18')]*0x3e8:0x2710,'authTimeout':_0x301efb[_0x1bef('0x19')]?_0x301efb[_0x1bef('0x19')]*0x3e8:0x1388};if(_[_0x1bef('0x1a')](_0x301efb[_0x1bef('0x1b')])){if(_0x301efb['authentication']){_0x529ab4[_0x1bef('0x1c')]=_0x301efb['user'];_0x529ab4[_0x1bef('0x1d')]=_0x301efb[_0x1bef('0x1d')];}_0x529ab4[_0x1bef('0x1e')]=_0x301efb['host'];_0x529ab4[_0x1bef('0x1f')]=_0x301efb[_0x1bef('0x1f')]||0x3e1;if(_0x301efb[_0x1bef('0x20')]){_0x529ab4[_0x1bef('0x20')]=!![];}else{_0x529ab4[_0x1bef('0x20')]=![];_0x529ab4[_0x1bef('0x21')]=_0x1bef('0x22');}}else{_0x529ab4['user']=_0x301efb['user'];_0x529ab4['password']=_0x301efb[_0x1bef('0x1d')];_0x529ab4[_0x1bef('0x1e')]=utils[_0x1bef('0x23')](_0x301efb['service']);_0x529ab4[_0x1bef('0x1f')]=0x3e1;_0x529ab4[_0x1bef('0x20')]=!![];}_0x529ab4[_0x1bef('0x9')]=_0x57d626||_0x301efb['user']||'anonymous@xcally.com';return _0x529ab4;};EmailImap['prototype'][_0x1bef('0xe')]=function(){this['imap'][_0x1bef('0x24')](this[_0x1bef('0xa')],![],this[_0x1bef('0x25')][_0x1bef('0xf')](this));};EmailImap[_0x1bef('0x16')]['handleOpenBox']=function(_0x1445cd,_0x5da079){if(_0x1445cd){this[_0x1bef('0x14')](_0x1445cd,!![]);}else{this[_0x1bef('0x26')](_0x1bef('0x27'),_0x5da079);this['readUnseen']();}};EmailImap[_0x1bef('0x16')][_0x1bef('0x28')]=function(_0x25d985){if(_0x25d985){this[_0x1bef('0x14')](_0x25d985,!![]);}else{this[_0x1bef('0xc')]['end']();}};EmailImap['prototype'][_0x1bef('0x29')]=function(){this['imap'][_0x1bef('0x2a')]([_0x1bef('0x2b')],this[_0x1bef('0x2c')]['bind'](this));};EmailImap[_0x1bef('0x16')][_0x1bef('0x2c')]=function(_0x499112,_0x540a44){if(_0x499112){this[_0x1bef('0x14')](_0x499112,!![]);}else{if(_0x540a44['length']){try{var _0x22f891=this[_0x1bef('0xc')][_0x1bef('0x2d')](_0x540a44,{'bodies':'','markSeen':!![]});_0x22f891['on'](_0x1bef('0x2e'),this[_0x1bef('0x2f')][_0x1bef('0xf')](this));_0x22f891[_0x1bef('0x10')](_0x1bef('0x13'),this['handleFetchError'][_0x1bef('0xf')](this));_0x22f891[_0x1bef('0x10')](_0x1bef('0x11'),this[_0x1bef('0x30')]['bind'](this));}catch(_0x28179d){logger[_0x1bef('0x13')](_0x28179d);}}else{this[_0x1bef('0xc')][_0x1bef('0x31')](!![],this['handleCloseBox'][_0x1bef('0xf')](this));}}};EmailImap[_0x1bef('0x16')][_0x1bef('0x2f')]=function(_0x3e4e3d,_0x5962e7){_0x3e4e3d['on'](_0x1bef('0x32'),this[_0x1bef('0x33')][_0x1bef('0xf')](this));_0x3e4e3d['once'](_0x1bef('0x34'),this['handleMessageAttributes'][_0x1bef('0xf')](this));_0x3e4e3d[_0x1bef('0x10')](_0x1bef('0x11'),this[_0x1bef('0x35')][_0x1bef('0xf')](this));};EmailImap[_0x1bef('0x16')][_0x1bef('0x33')]=function(_0x4b356b,_0x40da4b){simpleParser(_0x4b356b,{'Iconv':Iconv},this[_0x1bef('0x36')][_0x1bef('0xf')](this));};EmailImap[_0x1bef('0x16')]['handleMessageAttributes']=function(_0x31f256){};EmailImap[_0x1bef('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x1bef('0x16')][_0x1bef('0x36')]=function(_0x16097a,_0x4fc1a6){if(_0x16097a){logger[_0x1bef('0x13')](_0x16097a);}else{var _0x4e7364=this;utils[_0x1bef('0x37')](this[_0x1bef('0x38')],_0x4fc1a6,function(_0x5ec40e){_0x4e7364['emit'](_0x1bef('0x9'),_0x5ec40e);});}};EmailImap[_0x1bef('0x16')][_0x1bef('0x30')]=function(){this[_0x1bef('0xc')][_0x1bef('0x31')](!![],this[_0x1bef('0x28')]['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0xd3d5da){this['handleError'](_0xd3d5da);this[_0x1bef('0xc')][_0x1bef('0x31')](!![],this['handleCloseBox'][_0x1bef('0xf')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x1bef('0x26')](_0x1bef('0x11'));};EmailImap[_0x1bef('0x16')][_0x1bef('0x14')]=function(_0x43e9ab,_0x1dfde6){logger['error'](_0x1bef('0x14'),this[_0x1bef('0x38')][_0x1bef('0x9')],JSON[_0x1bef('0x39')](_0x43e9ab));var _0x54e517='';if(_0x43e9ab){if(_0x43e9ab['textCode']){_0x54e517=_0x43e9ab[_0x1bef('0x3a')];}else{for(var _0x2f3158 in _0x43e9ab){if(_0x43e9ab[_0x1bef('0x3b')](_0x2f3158)){_0x54e517+=_[_0x1bef('0x3c')](_0x2f3158)+':\x20'+_0x43e9ab[_0x2f3158]+'\x0a';}}}}if(_0x1dfde6){this[_0x1bef('0xc')]['end']();}else{this[_0x1bef('0x26')]('error',_0x54e517);this[_0x1bef('0x26')](_0x1bef('0x11'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index bd427ed..39cb2a1 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b82=['createTransport','use','sendMail','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x5e9274,_0x39ab73){var _0x3772ba=function(_0x3a250b){while(--_0x3a250b){_0x5e9274['push'](_0x5e9274['shift']());}};_0x3772ba(++_0x39ab73);}(_0x9b82,0xdd));var _0x29b8=function(_0x49f96a,_0x12c940){_0x49f96a=_0x49f96a-0x0;var _0x410067=_0x9b82[_0x49f96a];return _0x410067;};'use strict';var nodemailer=require(_0x29b8('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x29b8('0x1'));function EmailSmtp(){}EmailSmtp[_0x29b8('0x2')]['send']=function(_0xf34419,_0x6214bb){return new BPromise(function(_0x2e4b55,_0x262a1b){var _0x508ce6=nodemailer[_0x29b8('0x3')](_0xf34419);_0x508ce6[_0x29b8('0x4')]('compile',inlineBase64());_0x508ce6[_0x29b8('0x5')](_0x6214bb,function(_0x4a80f4,_0x40395b){if(_0x4a80f4){_0x262a1b(_0x4a80f4['toString']());}else{_0x2e4b55(_0x40395b);}});});};EmailSmtp[_0x29b8('0x2')]['verify']=function(_0x535b4c){return new BPromise(function(_0x54e94a,_0x16c721){var _0x3a10ec=nodemailer[_0x29b8('0x3')](_0x535b4c);_0x3a10ec['verify'](function(_0x379847,_0x157bb4){if(_0x379847){_0x16c721(_0x379847['toString']());}else{if(_0x157bb4){_0x54e94a(_0x157bb4);}else{_0x16c721(_0x29b8('0x6'));}}});});};module[_0x29b8('0x7')]=EmailSmtp; \ No newline at end of file +var _0x2d6b=['Not\x20verifired','exports','nodemailer','bluebird','send','createTransport','use','compile','sendMail','toString','prototype','verify'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x2d6b,0x1d6));var _0xb2d6=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x2d6b[_0x15c421];return _0x5e5ed5;};'use strict';var nodemailer=require(_0xb2d6('0x0'));var BPromise=require(_0xb2d6('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0xb2d6('0x2')]=function(_0x504a50,_0x1afefe){return new BPromise(function(_0x6f2744,_0x14ee64){var _0x1af70b=nodemailer[_0xb2d6('0x3')](_0x504a50);_0x1af70b[_0xb2d6('0x4')](_0xb2d6('0x5'),inlineBase64());_0x1af70b[_0xb2d6('0x6')](_0x1afefe,function(_0xb8f6a1,_0x2b4721){if(_0xb8f6a1){_0x14ee64(_0xb8f6a1[_0xb2d6('0x7')]());}else{_0x6f2744(_0x2b4721);}});});};EmailSmtp[_0xb2d6('0x8')][_0xb2d6('0x9')]=function(_0x549e3b){return new BPromise(function(_0x32b122,_0x513703){var _0x186cfa=nodemailer[_0xb2d6('0x3')](_0x549e3b);_0x186cfa[_0xb2d6('0x9')](function(_0x59e036,_0x14c3e){if(_0x59e036){_0x513703(_0x59e036[_0xb2d6('0x7')]());}else{if(_0x14c3e){_0x32b122(_0x14c3e);}else{_0x513703(_0xb2d6('0xa'));}}});});};module[_0xb2d6('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 4c8509a..519d23f 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4aea=['@xcally.com','html','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originCc','includes','originTo','bcc','attachments','attach','attachment','attachment-','format','now','root','server/files/attachments/','writeFileSync','contentType','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','name','split','slice','join','Anonymous','length','pop','isEmpty','anonymous'];(function(_0x8dd4a7,_0x138f55){var _0x2fec84=function(_0x4d0f1c){while(--_0x4d0f1c){_0x8dd4a7['push'](_0x8dd4a7['shift']());}};_0x2fec84(++_0x138f55);}(_0x4aea,0xc3));var _0xa4ae=function(_0x1fc89a,_0x4a1ae7){_0x1fc89a=_0x1fc89a-0x0;var _0x4b08d3=_0x4aea[_0x1fc89a];return _0x4b08d3;};'use strict';var _=require(_0xa4ae('0x0'));var moment=require(_0xa4ae('0x1'));var random=require(_0xa4ae('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xa4ae('0x3'));var tnef=require(_0xa4ae('0x4'));var logger=require(_0xa4ae('0x5'))(_0xa4ae('0x6'));var config=require(_0xa4ae('0x7'));function getAddress(_0x3da0e5){var _0x23e26a=_[_0xa4ae('0x8')](_0x3da0e5[_0xa4ae('0x9')]);return _0x23e26a&&_0x23e26a[_0xa4ae('0xa')]?_0x23e26a[_0xa4ae('0xa')]:'anonymous'+random[_0xa4ae('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x118941){var _0x4979ce=_[_0xa4ae('0x8')](_0x118941['value']);if(_0x4979ce&&_0x4979ce['name']){var _0x287ecf=_0x4979ce[_0xa4ae('0xc')][_0xa4ae('0xd')](/\s+/);return _0x287ecf['length']?_0x287ecf[_0xa4ae('0xe')](0x0,-0x1)[_0xa4ae('0xf')]('\x20'):_0x4979ce[_0xa4ae('0xc')];}return _0xa4ae('0x10');}function getLastName(_0x882fa4){var _0x40c016=_[_0xa4ae('0x8')](_0x882fa4[_0xa4ae('0x9')]);if(_0x40c016&&_0x40c016[_0xa4ae('0xc')]){var _0x33c0e2=_0x40c016['name'][_0xa4ae('0xd')](/\s+/);return _0x33c0e2[_0xa4ae('0x11')]>0x1?_0x33c0e2[_0xa4ae('0x12')]():'';}return'';}function getMails(_0x4b920e,_0x13e79d){var _0xe5eb6f='';for(var _0x3d8b99=0x0;_0x3d8b99<_0x13e79d['value']['length'];_0x3d8b99+=0x1){if(_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]!==_0x4b920e){if(!_[_0xa4ae('0x13')](_0xe5eb6f)){_0xe5eb6f+=',';}_0xe5eb6f+=_0x13e79d['value'][_0x3d8b99][_0xa4ae('0xc')]||_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]||'';_0xe5eb6f+='\x20<';_0xe5eb6f+=_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]?_0x13e79d[_0xa4ae('0x9')][_0x3d8b99][_0xa4ae('0xa')]:_0xa4ae('0x14')+random[_0xa4ae('0xb')](0x6)+_0xa4ae('0x15');_0xe5eb6f+='>';}}return _0xe5eb6f;}function parseEmail(_0x5a0a38,_0x1dc467,_0x148a81){if(_0x1dc467[_0xa4ae('0x16')]){var _0x190713=/)<[^<]*)*<\/script>/gi;while(_0x190713['test'](_0x1dc467[_0xa4ae('0x16')])){_0x1dc467['html']=_0x1dc467[_0xa4ae('0x16')]['replace'](_0x190713,'');}if(_0x1dc467['html']['includes'](_0xa4ae('0x17'))){var _0x7c4a42=[];_0x1dc467['attachments'][_0xa4ae('0x18')](_0x311fc=>{_0x7c4a42[_0xa4ae('0x19')](_0x311fc[_0xa4ae('0x1a')]);});var _0x59c53e=/]+>/g;var _0x13a6c2=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x13a7d4=_0x1dc467[_0xa4ae('0x16')]['replace'](_0x13a6c2,_0xa4ae('0x1b'));var _0x2f5619=_0x13a7d4[_0xa4ae('0x1c')](_0x59c53e,'_IMG');for(let _0x19abd7=0x0;_0x19abd7<_0x7c4a42[_0xa4ae('0x11')];_0x19abd7++){var _0xf79eb5=_0x2f5619[_0xa4ae('0x1c')]('_IMG',_0xa4ae('0x1d')+_0x7c4a42[_0x19abd7]+_0xa4ae('0x1e'));_0x2f5619=_0xf79eb5;}_0x1dc467[_0xa4ae('0x16')]=_0x2f5619;}_0x148a81[_0xa4ae('0x1f')]=_0x1dc467[_0xa4ae('0x16')];}else{_0x148a81[_0xa4ae('0x1f')]=_0x1dc467[_0xa4ae('0x20')];}if(_0x148a81['body']){_0x148a81[_0xa4ae('0x1f')]=_0x148a81[_0xa4ae('0x1f')][_0xa4ae('0x1c')](/Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','head','address','anonymous','generate','@xcally.com','name','split','length','slice','value','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x5a5b7d[_0xbec8('0xf')]():'';}return'';}function getMails(_0x4b8bd3,_0x411e1c){var _0x3ceefd='';for(var _0x2410dd=0x0;_0x2410dd<_0x411e1c['value'][_0xbec8('0xc')];_0x2410dd+=0x1){if(_0x411e1c[_0xbec8('0xe')][_0x2410dd][_0xbec8('0x6')]!==_0x4b8bd3){if(!_[_0xbec8('0x10')](_0x3ceefd)){_0x3ceefd+=',';}_0x3ceefd+=_0x411e1c[_0xbec8('0xe')][_0x2410dd][_0xbec8('0xa')]||_0x411e1c[_0xbec8('0xe')][_0x2410dd][_0xbec8('0x6')]||'';_0x3ceefd+='\x20<';_0x3ceefd+=_0x411e1c[_0xbec8('0xe')][_0x2410dd][_0xbec8('0x6')]?_0x411e1c[_0xbec8('0xe')][_0x2410dd]['address']:_0xbec8('0x7')+random[_0xbec8('0x8')](0x6)+_0xbec8('0x9');_0x3ceefd+='>';}}return _0x3ceefd;}function parseEmail(_0x735baa,_0x4872fd,_0x1cbf04){if(_0x4872fd[_0xbec8('0x11')]){var _0x1865c1=/)<[^<]*)*<\/script>/gi;while(_0x1865c1[_0xbec8('0x12')](_0x4872fd[_0xbec8('0x11')])){_0x4872fd[_0xbec8('0x11')]=_0x4872fd[_0xbec8('0x11')][_0xbec8('0x13')](_0x1865c1,'');}if(_0x4872fd[_0xbec8('0x11')][_0xbec8('0x14')](_0xbec8('0x15'))){var _0x1f178c=[];_0x4872fd['attachments'][_0xbec8('0x16')](_0x56b5ef=>{_0x1f178c['push'](_0x56b5ef['filename']);});var _0x4a11b9=/]+>/g;var _0x2802fa=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x59a303=_0x4872fd[_0xbec8('0x11')]['replace'](_0x2802fa,_0xbec8('0x17'));var _0x5ae8b4=_0x59a303[_0xbec8('0x13')](_0x4a11b9,_0xbec8('0x18'));for(let _0x3510f5=0x0;_0x3510f5<_0x1f178c['length'];_0x3510f5++){var _0x27c280=_0x5ae8b4['replace'](_0xbec8('0x18'),_0xbec8('0x19')+_0x1f178c[_0x3510f5]+_0xbec8('0x1a'));_0x5ae8b4=_0x27c280;}_0x4872fd[_0xbec8('0x11')]=_0x5ae8b4;}_0x1cbf04[_0xbec8('0x1b')]=_0x4872fd[_0xbec8('0x11')];}else{_0x1cbf04[_0xbec8('0x1b')]=_0x4872fd[_0xbec8('0x1c')];}if(_0x1cbf04[_0xbec8('0x1b')]){_0x1cbf04['body']=_0x1cbf04[_0xbec8('0x1b')][_0xbec8('0x13')](/0x0){if(this[_0x37c3d1+_0x014a('0x27')]>0x0&&this[_0x37c3d1+'CurrentCapacity']>=this[_0x37c3d1+_0x014a('0x27')]){return'maxcapacity';}else{return _0x014a('0x28');}}else{return _0x014a('0x29');}};Agent[_0x014a('0x24')][_0x014a('0x23')]=function(){var _0x2b3c10=[_0x014a('0x2a'),_0x014a('0x2b'),_0x014a('0x2c'),_0x014a('0x2d'),'sms',_0x014a('0x2e')];for(var _0x5358e9=0x0;_0x5358e9<_0x2b3c10[_0x014a('0x2f')];_0x5358e9+=0x1){var _0x28701e=this['getChannelStatus'](_0x2b3c10[_0x5358e9]);if(this[_0x2b3c10[_0x5358e9]+'Status']!==_0x28701e){this[_0x2b3c10[_0x5358e9]+_0x014a('0x30')]=_[_0x014a('0x31')](moment()[_0x014a('0x32')]('x'));}this[_0x2b3c10[_0x5358e9]+'Status']=_0x28701e;}var _0x183f19={'id':this['id'],'name':this[_0x014a('0x6')],'online':this['online'],'voicePause':this[_0x014a('0x8')],'chatPause':this[_0x014a('0x33')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x014a('0x34')],'openchannelPause':this[_0x014a('0xb')],'chatStatus':this[_0x014a('0xc')],'chatStatusTime':this[_0x014a('0xd')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x014a('0xf')],'mailStatus':this[_0x014a('0x10')],'mailStatusTime':this[_0x014a('0x12')],'mailCapacity':this[_0x014a('0x13')],'mailCurrentCapacity':this[_0x014a('0x14')],'faxStatus':this[_0x014a('0x15')],'faxStatusTime':this[_0x014a('0x35')],'faxCapacity':this[_0x014a('0x16')],'faxCurrentCapacity':this[_0x014a('0x36')],'smsStatus':this[_0x014a('0x17')],'smsStatusTime':this[_0x014a('0x37')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x014a('0x19')],'whatsappStatus':this[_0x014a('0x1a')],'whatsappStatusTime':this[_0x014a('0x1b')],'whatsappCapacity':this[_0x014a('0x1c')],'whatsappCurrentCapacity':this[_0x014a('0x1d')],'openchannelStatus':this[_0x014a('0x1e')],'openchannelStatusTime':this[_0x014a('0x1f')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x014a('0x38')],'busy':this[_0x014a('0x21')],'busyQueue':this['busyQueue']};var _0x415f83=md5(JSON[_0x014a('0x39')](_0x183f19));if(this[_0x014a('0x1')]!==_0x415f83){this[_0x014a('0x1')]=_0x415f83;io[_0x014a('0x3a')](_0x014a('0x3b'),_0x183f19);}};module[_0x014a('0x3c')]=Agent; \ No newline at end of file +var _0x8d05=['mailPause','faxPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','working','idle','prototype','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','chatStatus','busy','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause'];(function(_0x328059,_0x53aca8){var _0x1315a0=function(_0x30123b){while(--_0x30123b){_0x328059['push'](_0x328059['shift']());}};_0x1315a0(++_0x53aca8);}(_0x8d05,0xe8));var _0x58d0=function(_0x2cb52a,_0x3a10d3){_0x2cb52a=_0x2cb52a-0x0;var _0x46035a=_0x8d05[_0x2cb52a];return _0x46035a;};'use strict';var _=require(_0x58d0('0x0'));var moment=require(_0x58d0('0x1'));var md5=require(_0x58d0('0x2'));var Redis=require(_0x58d0('0x3'));var config=require(_0x58d0('0x4'));config['redis']=_['defaults'](config[_0x58d0('0x5')],{'host':_0x58d0('0x6'),'port':0x18eb});var io=require(_0x58d0('0x7'))(new Redis(config[_0x58d0('0x5')]));function Agent(_0x5adebc){this['id']=_0x5adebc['id']||0x0;this[_0x58d0('0x8')]=_0x5adebc[_0x58d0('0x8')]||'';this['online']=_0x5adebc[_0x58d0('0x9')]||!![];this['voicePause']=_0x5adebc[_0x58d0('0xa')]||![];this[_0x58d0('0xb')]=_0x5adebc[_0x58d0('0xb')]||![];this[_0x58d0('0xc')]=_0x5adebc[_0x58d0('0xc')]||![];this['faxPause']=_0x5adebc[_0x58d0('0xd')]||![];this[_0x58d0('0xe')]=_0x5adebc['smsPause']||![];this[_0x58d0('0xf')]=_0x5adebc[_0x58d0('0xf')]||![];this['chatStatus']='unknown';this[_0x58d0('0x10')]=0x0;this[_0x58d0('0x11')]=_0x5adebc[_0x58d0('0x11')]||0x0;this[_0x58d0('0x12')]=0x0;this[_0x58d0('0x13')]=_0x58d0('0x14');this[_0x58d0('0x15')]=0x0;this[_0x58d0('0x16')]=_0x5adebc[_0x58d0('0x16')]||0x0;this[_0x58d0('0x17')]=0x0;this[_0x58d0('0x18')]=_0x58d0('0x14');this[_0x58d0('0x19')]=0x0;this[_0x58d0('0x1a')]=_0x5adebc[_0x58d0('0x1a')]||0x0;this[_0x58d0('0x1b')]=0x0;this[_0x58d0('0x1c')]=_0x58d0('0x14');this[_0x58d0('0x1d')]=0x0;this['smsCapacity']=_0x5adebc[_0x58d0('0x1e')]||0x0;this[_0x58d0('0x1f')]=0x0;this[_0x58d0('0x20')]=_0x58d0('0x14');this[_0x58d0('0x21')]=0x0;this[_0x58d0('0x22')]=_0x5adebc[_0x58d0('0x22')]||0x0;this[_0x58d0('0x23')]=0x0;this[_0x58d0('0x24')]=_0x58d0('0x14');this[_0x58d0('0x25')]=0x0;this[_0x58d0('0x26')]=_0x5adebc[_0x58d0('0x26')]||0x0;this[_0x58d0('0x27')]=0x0;this['busy']=![];this[_0x58d0('0x28')]=undefined;this[_0x58d0('0x2')]='';this[_0x58d0('0x29')]();}Agent['prototype'][_0x58d0('0x2a')]=function(_0x22a3c1){if(this[_0x22a3c1+_0x58d0('0x2b')]>0x0){if(this[_0x22a3c1+'Capacity']>0x0&&this[_0x22a3c1+_0x58d0('0x2b')]>=this[_0x22a3c1+'Capacity']){return'maxcapacity';}else{return _0x58d0('0x2c');}}else{return _0x58d0('0x2d');}};Agent[_0x58d0('0x2e')][_0x58d0('0x29')]=function(){var _0x5388ef=[_0x58d0('0x2f'),_0x58d0('0x30'),_0x58d0('0x31'),'fax',_0x58d0('0x32'),_0x58d0('0x33')];for(var _0x5e6e63=0x0;_0x5e6e63<_0x5388ef[_0x58d0('0x34')];_0x5e6e63+=0x1){var _0xa55350=this[_0x58d0('0x2a')](_0x5388ef[_0x5e6e63]);if(this[_0x5388ef[_0x5e6e63]+_0x58d0('0x35')]!==_0xa55350){this[_0x5388ef[_0x5e6e63]+_0x58d0('0x36')]=_['toNumber'](moment()['format']('x'));}this[_0x5388ef[_0x5e6e63]+_0x58d0('0x35')]=_0xa55350;}var _0x18dec5={'id':this['id'],'name':this[_0x58d0('0x8')],'online':this[_0x58d0('0x9')],'voicePause':this[_0x58d0('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x58d0('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x58d0('0xd')],'openchannelPause':this[_0x58d0('0xf')],'chatStatus':this[_0x58d0('0x37')],'chatStatusTime':this[_0x58d0('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x58d0('0x12')],'mailStatus':this[_0x58d0('0x13')],'mailStatusTime':this[_0x58d0('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x58d0('0x17')],'faxStatus':this[_0x58d0('0x18')],'faxStatusTime':this[_0x58d0('0x19')],'faxCapacity':this[_0x58d0('0x1a')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x58d0('0x1c')],'smsStatusTime':this[_0x58d0('0x1d')],'smsCapacity':this[_0x58d0('0x1e')],'smsCurrentCapacity':this[_0x58d0('0x1f')],'whatsappStatus':this[_0x58d0('0x20')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x58d0('0x22')],'whatsappCurrentCapacity':this[_0x58d0('0x23')],'openchannelStatus':this[_0x58d0('0x24')],'openchannelStatusTime':this[_0x58d0('0x25')],'openchannelCapacity':this[_0x58d0('0x26')],'openchannelCurrentCapacity':this[_0x58d0('0x27')],'busy':this[_0x58d0('0x38')],'busyQueue':this[_0x58d0('0x28')]};var _0x2f6c10=md5(JSON[_0x58d0('0x39')](_0x18dec5));if(this['md5']!==_0x2f6c10){this[_0x58d0('0x2')]=_0x2f6c10;io[_0x58d0('0x3a')](_0x58d0('0x3b'),_0x18dec5);}};module[_0x58d0('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 04f3cd1..bf4db8e 100644 --- a/server/services/routing/model/chatQueue.js +++ b/server/services/routing/model/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3666=['Agents','mapAgentsId','_rr','loggedIn','paused','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','md5','updateRouting','updateRealtime','prototype','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3666,0xd7));var _0x6366=function(_0x14047b,_0x393d87){_0x14047b=_0x14047b-0x0;var _0x4298cc=_0x3666[_0x14047b];return _0x4298cc;};'use strict';var _=require(_0x6366('0x0'));var md5=require('md5');var util=require(_0x6366('0x1'));var Redis=require('ioredis');var config=require(_0x6366('0x2'));config[_0x6366('0x3')]=_[_0x6366('0x4')](config[_0x6366('0x3')],{'host':_0x6366('0x5'),'port':0x18eb});var io=require(_0x6366('0x6'))(new Redis(config[_0x6366('0x3')]));function ChatQueue(_0x50945e){this['id']=_0x50945e['id']||0x0;this[_0x6366('0x7')]=_0x50945e[_0x6366('0x7')]||'';this[_0x6366('0x8')]=_0x50945e[_0x6366('0x8')]||0xa;this[_0x6366('0x9')]=_0x50945e[_0x6366('0x9')]||_0x6366('0xa');this['Agents']=_0x50945e['Agents'];this['mapAgentsId']={};this[_0x6366('0xb')]=0x0;this[_0x6366('0xc')]='';this[_0x6366('0xd')]();this[_0x6366('0xe')]();}ChatQueue[_0x6366('0xf')]['updateRouting']=function(){var _0x30da1d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x6366('0x10')](this[_0x6366('0x11')],'id');this[_0x6366('0x12')][_0x6366('0x13')]=_0x30da1d;};ChatQueue['prototype'][_0x6366('0xe')]=function(){this[_0x6366('0x14')]=0x0;this[_0x6366('0x15')]=0x0;for(var _0x56dc51=0x0;_0x56dc51=0x0?this[_0x6366('0x17')]:0x0;var _0x46ff54={'id':this['id'],'available':this[_0x6366('0x17')],'loggedIn':this[_0x6366('0x14')],'name':this[_0x6366('0x7')],'paused':this[_0x6366('0x15')],'waiting':this[_0x6366('0xb')]};var _0x89752=md5(JSON[_0x6366('0x18')](_0x46ff54));if(this[_0x6366('0xc')]!==_0x89752){this['md5']=_0x89752;io['to'](util[_0x6366('0x19')](_0x6366('0x1a'),_0x46ff54['name']))['emit'](_0x6366('0x1b'),_0x46ff54);}};module[_0x6366('0x1c')]=ChatQueue; \ No newline at end of file +var _0xd468=['emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','available','stringify','format','chat:queue:%s'];(function(_0x5cf68b,_0x18841c){var _0x6a3040=function(_0x4e2580){while(--_0x4e2580){_0x5cf68b['push'](_0x5cf68b['shift']());}};_0x6a3040(++_0x18841c);}(_0xd468,0x1df));var _0x8d46=function(_0x43673c,_0x4b569b){_0x43673c=_0x43673c-0x0;var _0x34512e=_0xd468[_0x43673c];return _0x34512e;};'use strict';var _=require(_0x8d46('0x0'));var md5=require(_0x8d46('0x1'));var util=require(_0x8d46('0x2'));var Redis=require(_0x8d46('0x3'));var config=require(_0x8d46('0x4'));config[_0x8d46('0x5')]=_[_0x8d46('0x6')](config[_0x8d46('0x5')],{'host':_0x8d46('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x2783fb){this['id']=_0x2783fb['id']||0x0;this[_0x8d46('0x8')]=_0x2783fb[_0x8d46('0x8')]||'';this[_0x8d46('0x9')]=_0x2783fb[_0x8d46('0x9')]||0xa;this['strategy']=_0x2783fb['strategy']||_0x8d46('0xa');this['Agents']=_0x2783fb[_0x8d46('0xb')];this['mapAgentsId']={};this[_0x8d46('0xc')]=0x0;this['md5']='';this[_0x8d46('0xd')]();this[_0x8d46('0xe')]();}ChatQueue[_0x8d46('0xf')][_0x8d46('0xd')]=function(){var _0x496dff=this[_0x8d46('0x10')][_0x8d46('0x11')];this[_0x8d46('0x10')]=_[_0x8d46('0x12')](this[_0x8d46('0xb')],'id');this[_0x8d46('0x10')][_0x8d46('0x11')]=_0x496dff;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x8d46('0x13')]=0x0;this['paused']=0x0;for(var _0x247e7a=0x0;_0x247e7a=0x0?this['available']:0x0;var _0x3f91a1={'id':this['id'],'available':this[_0x8d46('0x15')],'loggedIn':this[_0x8d46('0x13')],'name':this[_0x8d46('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x13c09b=md5(JSON[_0x8d46('0x16')](_0x3f91a1));if(this[_0x8d46('0x1')]!==_0x13c09b){this['md5']=_0x13c09b;io['to'](util[_0x8d46('0x17')](_0x8d46('0x18'),_0x3f91a1['name']))[_0x8d46('0x19')](_0x8d46('0x1a'),_0x3f91a1);}};module[_0x8d46('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index de9109b..98bfd6f 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x19897e,_0x3e961e){var _0x474883=function(_0x149a11){while(--_0x149a11){_0x19897e['push'](_0x19897e['shift']());}};_0x474883(++_0x3e961e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x38575b,_0x2e53db){var _0x1a0821=function(_0x49cb48){while(--_0x49cb48){_0x38575b['push'](_0x38575b['shift']());}};_0x1a0821(++_0x2e53db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b40bc3d..d3e8c82 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd89=['name','Intervals','exports'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0xfd89,0xb1));var _0x9fd8=function(_0x22f8b3,_0x11ff32){_0x22f8b3=_0x22f8b3-0x0;var _0x51ddff=_0xfd89[_0x22f8b3];return _0x51ddff;};'use strict';function Interval(_0x9dc01){this['id']=_0x9dc01['id']||0x0;this[_0x9fd8('0x0')]=_0x9dc01['name']||'';this[_0x9fd8('0x1')]=_0x9dc01[_0x9fd8('0x1')]||{};}module[_0x9fd8('0x2')]=Interval; \ No newline at end of file +var _0x4fca=['Intervals','exports','name'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x4fca,0x167));var _0xa4fc=function(_0x48fa90,_0x196754){_0x48fa90=_0x48fa90-0x0;var _0x1329d0=_0x4fca[_0x48fa90];return _0x1329d0;};'use strict';function Interval(_0x527321){this['id']=_0x527321['id']||0x0;this['name']=_0x527321[_0xa4fc('0x0')]||'';this[_0xa4fc('0x1')]=_0x527321[_0xa4fc('0x1')]||{};}module[_0xa4fc('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 99bff8c..652e325 100644 --- a/server/services/routing/model/mailQueue.js +++ b/server/services/routing/model/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9a8=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','length','online','mailPause','available','paused','stringify','md5','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','ioredis','redis','defaults','localhost'];(function(_0x7ab1ff,_0x551d4c){var _0xddf90a=function(_0x245e92){while(--_0x245e92){_0x7ab1ff['push'](_0x7ab1ff['shift']());}};_0xddf90a(++_0x551d4c);}(_0xf9a8,0x1bd));var _0x8f9a=function(_0x3f1f9c,_0x4358e6){_0x3f1f9c=_0x3f1f9c-0x0;var _0x31090e=_0xf9a8[_0x3f1f9c];return _0x31090e;};'use strict';var _=require(_0x8f9a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x8f9a('0x1'));var config=require('../../../config/environment');config[_0x8f9a('0x2')]=_[_0x8f9a('0x3')](config['redis'],{'host':_0x8f9a('0x4'),'port':0x18eb});var io=require(_0x8f9a('0x5'))(new Redis(config[_0x8f9a('0x2')]));function MailQueue(_0x4e9e7c){this['id']=_0x4e9e7c['id']||0x0;this['name']=_0x4e9e7c[_0x8f9a('0x6')]||'';this[_0x8f9a('0x7')]=_0x4e9e7c['timeout']||0xa;this['strategy']=_0x4e9e7c[_0x8f9a('0x8')]||'beepall';this[_0x8f9a('0x9')]=_0x4e9e7c[_0x8f9a('0x9')];this[_0x8f9a('0xa')]={};this[_0x8f9a('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype'][_0x8f9a('0xc')]=function(){var _0x1e3e85=this[_0x8f9a('0xa')][_0x8f9a('0xd')];this[_0x8f9a('0xa')]=_[_0x8f9a('0xe')](this[_0x8f9a('0x9')],'id');this['mapAgentsId'][_0x8f9a('0xd')]=_0x1e3e85;};MailQueue[_0x8f9a('0xf')][_0x8f9a('0x10')]=function(){this[_0x8f9a('0x11')]=0x0;this['paused']=0x0;for(var _0x2fd2a7=0x0;_0x2fd2a7=0x0?this[_0x8f9a('0x15')]:0x0;var _0x3d9d52={'id':this['id'],'available':this[_0x8f9a('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x8f9a('0x6')],'paused':this[_0x8f9a('0x16')],'waiting':this[_0x8f9a('0xb')]};var _0x1d1750=md5(JSON[_0x8f9a('0x17')](_0x3d9d52));if(this[_0x8f9a('0x18')]!==_0x1d1750){this[_0x8f9a('0x18')]=_0x1d1750;io['to'](util[_0x8f9a('0x19')](_0x8f9a('0x1a'),_0x3d9d52['name']))[_0x8f9a('0x1b')](_0x8f9a('0x1c'),_0x3d9d52);}};module[_0x8f9a('0x1d')]=MailQueue; \ No newline at end of file +var _0x2d07=['beepall','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','paused','length','online','mailPause','available','loggedIn','emit','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x21418e,_0x2b940a){var _0x56c161=function(_0x55ca67){while(--_0x55ca67){_0x21418e['push'](_0x21418e['shift']());}};_0x56c161(++_0x2b940a);}(_0x2d07,0x13a));var _0x72d0=function(_0x371f33,_0x278a69){_0x371f33=_0x371f33-0x0;var _0x246c96=_0x2d07[_0x371f33];return _0x246c96;};'use strict';var _=require(_0x72d0('0x0'));var md5=require(_0x72d0('0x1'));var util=require('util');var Redis=require(_0x72d0('0x2'));var config=require(_0x72d0('0x3'));config['redis']=_[_0x72d0('0x4')](config[_0x72d0('0x5')],{'host':_0x72d0('0x6'),'port':0x18eb});var io=require(_0x72d0('0x7'))(new Redis(config[_0x72d0('0x5')]));function MailQueue(_0x352a30){this['id']=_0x352a30['id']||0x0;this['name']=_0x352a30[_0x72d0('0x8')]||'';this[_0x72d0('0x9')]=_0x352a30[_0x72d0('0x9')]||0xa;this['strategy']=_0x352a30['strategy']||_0x72d0('0xa');this['Agents']=_0x352a30['Agents'];this['mapAgentsId']={};this[_0x72d0('0xb')]=0x0;this[_0x72d0('0x1')]='';this[_0x72d0('0xc')]();this[_0x72d0('0xd')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4dbd4f=this[_0x72d0('0xe')][_0x72d0('0xf')];this[_0x72d0('0xe')]=_[_0x72d0('0x10')](this[_0x72d0('0x11')],'id');this['mapAgentsId'][_0x72d0('0xf')]=_0x4dbd4f;};MailQueue[_0x72d0('0x12')][_0x72d0('0xd')]=function(){this['loggedIn']=0x0;this[_0x72d0('0x13')]=0x0;for(var _0xe75447=0x0;_0xe75447=0x0?this[_0x72d0('0x17')]:0x0;var _0x4a9367={'id':this['id'],'available':this[_0x72d0('0x17')],'loggedIn':this[_0x72d0('0x18')],'name':this[_0x72d0('0x8')],'paused':this[_0x72d0('0x13')],'waiting':this[_0x72d0('0xb')]};var _0x1adbc1=md5(JSON['stringify'](_0x4a9367));if(this[_0x72d0('0x1')]!==_0x1adbc1){this['md5']=_0x1adbc1;io['to'](util['format']('mail:queue:%s',_0x4a9367[_0x72d0('0x8')]))[_0x72d0('0x19')]('mail_queue:save',_0x4a9367);}};module[_0x72d0('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7ef77d4..142ed1a 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0894=['map','loggedIn','paused','length','online','openchannelPause','available','stringify','md5','openchannel:queue:%s','emit','openchannel_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0894,0x143));var _0x4089=function(_0x4f97c9,_0x55f9c4){_0x4f97c9=_0x4f97c9-0x0;var _0x386dce=_0x0894[_0x4f97c9];return _0x386dce;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x4089('0x0'));var Redis=require(_0x4089('0x1'));var config=require(_0x4089('0x2'));config[_0x4089('0x3')]=_[_0x4089('0x4')](config[_0x4089('0x3')],{'host':_0x4089('0x5'),'port':0x18eb});var io=require(_0x4089('0x6'))(new Redis(config[_0x4089('0x3')]));function OpenchannelQueue(_0x3e1ae2){this['id']=_0x3e1ae2['id']||0x0;this[_0x4089('0x7')]=_0x3e1ae2[_0x4089('0x7')]||'';this[_0x4089('0x8')]=_0x3e1ae2[_0x4089('0x8')]||0xa;this[_0x4089('0x9')]=_0x3e1ae2[_0x4089('0x9')]||_0x4089('0xa');this['Agents']=_0x3e1ae2[_0x4089('0xb')];this[_0x4089('0xc')]={};this[_0x4089('0xd')]=0x0;this['md5']='';this[_0x4089('0xe')]();this[_0x4089('0xf')]();}OpenchannelQueue[_0x4089('0x10')]['updateRouting']=function(){var _0x4041fb=this['mapAgentsId'][_0x4089('0x11')];this[_0x4089('0xc')]=_[_0x4089('0x12')](this[_0x4089('0xb')],'id');this[_0x4089('0xc')][_0x4089('0x11')]=_0x4041fb;};OpenchannelQueue['prototype']['updateRealtime']=function(){this[_0x4089('0x13')]=0x0;this[_0x4089('0x14')]=0x0;for(var _0x22f74a=0x0;_0x22f74a=0x0?this[_0x4089('0x18')]:0x0;var _0x1b6b9b={'id':this['id'],'available':this[_0x4089('0x18')],'loggedIn':this[_0x4089('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4089('0xd')]};var _0x1955d0=md5(JSON[_0x4089('0x19')](_0x1b6b9b));if(this[_0x4089('0x1a')]!==_0x1955d0){this[_0x4089('0x1a')]=_0x1955d0;io['to'](util['format'](_0x4089('0x1b'),_0x1b6b9b['name']))[_0x4089('0x1c')](_0x4089('0x1d'),_0x1b6b9b);}};module[_0x4089('0x1e')]=OpenchannelQueue; \ No newline at end of file +var _0x018d=['mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x341732,_0x5dd432){var _0x4bf177=function(_0x1f94cc){while(--_0x1f94cc){_0x341732['push'](_0x341732['shift']());}};_0x4bf177(++_0x5dd432);}(_0x018d,0x16e));var _0xd018=function(_0x2293bb,_0x12da5f){_0x2293bb=_0x2293bb-0x0;var _0x1fdff6=_0x018d[_0x2293bb];return _0x1fdff6;};'use strict';var _=require(_0xd018('0x0'));var md5=require(_0xd018('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xd018('0x2'));config['redis']=_[_0xd018('0x3')](config[_0xd018('0x4')],{'host':_0xd018('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x3541d6){this['id']=_0x3541d6['id']||0x0;this[_0xd018('0x6')]=_0x3541d6['name']||'';this[_0xd018('0x7')]=_0x3541d6[_0xd018('0x7')]||0xa;this['strategy']=_0x3541d6[_0xd018('0x8')]||_0xd018('0x9');this[_0xd018('0xa')]=_0x3541d6[_0xd018('0xa')];this[_0xd018('0xb')]={};this[_0xd018('0xc')]=0x0;this['md5']='';this[_0xd018('0xd')]();this[_0xd018('0xe')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0xf0349=this[_0xd018('0xb')][_0xd018('0xf')];this[_0xd018('0xb')]=_[_0xd018('0x10')](this[_0xd018('0xa')],'id');this[_0xd018('0xb')][_0xd018('0xf')]=_0xf0349;};OpenchannelQueue['prototype'][_0xd018('0xe')]=function(){this[_0xd018('0x11')]=0x0;this[_0xd018('0x12')]=0x0;for(var _0x3bbecb=0x0;_0x3bbecb=0x0?this[_0xd018('0x16')]:0x0;var _0x3abd57={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd018('0x11')],'name':this[_0xd018('0x6')],'paused':this[_0xd018('0x12')],'waiting':this['waiting']};var _0x59140f=md5(JSON[_0xd018('0x17')](_0x3abd57));if(this['md5']!==_0x59140f){this[_0xd018('0x1')]=_0x59140f;io['to'](util[_0xd018('0x18')](_0xd018('0x19'),_0x3abd57[_0xd018('0x6')]))[_0xd018('0x1a')](_0xd018('0x1b'),_0x3abd57);}};module[_0xd018('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c28369d..73db343 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0xb10b,0x12a));var _0xbb10=function(_0x3700fd,_0x5bd346){_0x3700fd=_0x3700fd-0x0;var _0x4ffb6c=_0xb10b[_0x3700fd];return _0x4ffb6c;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x5481a4,_0xddc43a){var _0x51fd1e=function(_0x41ffe6){while(--_0x41ffe6){_0x5481a4['push'](_0x5481a4['shift']());}};_0x51fd1e(++_0xddc43a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 2d39e1e..881bfc8 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c47=['mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x8c47,0x16f));var _0x78c4=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8c47[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x78c4('0x0'));var Redis=require(_0x78c4('0x1'));var config=require(_0x78c4('0x2'));config[_0x78c4('0x3')]=_[_0x78c4('0x4')](config[_0x78c4('0x3')],{'host':_0x78c4('0x5'),'port':0x18eb});var io=require(_0x78c4('0x6'))(new Redis(config[_0x78c4('0x3')]));function WhatsappQueue(_0x53bd03){this['id']=_0x53bd03['id']||0x0;this[_0x78c4('0x7')]=_0x53bd03[_0x78c4('0x7')]||'';this[_0x78c4('0x8')]=_0x53bd03['timeout']||0xa;this['strategy']=_0x53bd03['strategy']||_0x78c4('0x9');this[_0x78c4('0xa')]=_0x53bd03['Agents'];this[_0x78c4('0xb')]={};this[_0x78c4('0xc')]=0x0;this[_0x78c4('0xd')]='';this[_0x78c4('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x78c4('0xf')]['updateRouting']=function(){var _0x5b81e9=this['mapAgentsId'][_0x78c4('0x10')];this[_0x78c4('0xb')]=_['map'](this[_0x78c4('0xa')],'id');this[_0x78c4('0xb')][_0x78c4('0x10')]=_0x5b81e9;};WhatsappQueue['prototype'][_0x78c4('0x11')]=function(){this[_0x78c4('0x12')]=0x0;this[_0x78c4('0x13')]=0x0;for(var _0x52632b=0x0;_0x52632b=0x0?this[_0x78c4('0x16')]:0x0;var _0x437b94={'id':this['id'],'available':this['available'],'loggedIn':this[_0x78c4('0x12')],'name':this[_0x78c4('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x39be51=md5(JSON[_0x78c4('0x17')](_0x437b94));if(this[_0x78c4('0xd')]!==_0x39be51){this[_0x78c4('0xd')]=_0x39be51;io['to'](util[_0x78c4('0x18')](_0x78c4('0x19'),_0x437b94[_0x78c4('0x7')]))['emit'](_0x78c4('0x1a'),_0x437b94);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xe44e=['_rr','loggedIn','length','whatsappPause','paused','available','format','whatsapp:queue:%s','whatsapp_queue:save','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting'];(function(_0x5c2fa9,_0x17e72d){var _0x392f05=function(_0x460871){while(--_0x460871){_0x5c2fa9['push'](_0x5c2fa9['shift']());}};_0x392f05(++_0x17e72d);}(_0xe44e,0x8b));var _0xee44=function(_0x18c2d2,_0x59b969){_0x18c2d2=_0x18c2d2-0x0;var _0x1d4339=_0xe44e[_0x18c2d2];return _0x1d4339;};'use strict';var _=require('lodash');var md5=require(_0xee44('0x0'));var util=require(_0xee44('0x1'));var Redis=require('ioredis');var config=require(_0xee44('0x2'));config[_0xee44('0x3')]=_[_0xee44('0x4')](config['redis'],{'host':_0xee44('0x5'),'port':0x18eb});var io=require(_0xee44('0x6'))(new Redis(config[_0xee44('0x3')]));function WhatsappQueue(_0x24104e){this['id']=_0x24104e['id']||0x0;this[_0xee44('0x7')]=_0x24104e[_0xee44('0x7')]||'';this['timeout']=_0x24104e[_0xee44('0x8')]||0xa;this['strategy']=_0x24104e[_0xee44('0x9')]||_0xee44('0xa');this[_0xee44('0xb')]=_0x24104e['Agents'];this[_0xee44('0xc')]={};this[_0xee44('0xd')]=0x0;this[_0xee44('0x0')]='';this['updateRouting']();this[_0xee44('0xe')]();}WhatsappQueue[_0xee44('0xf')][_0xee44('0x10')]=function(){var _0x452d1c=this['mapAgentsId'][_0xee44('0x11')];this['mapAgentsId']=_['map'](this[_0xee44('0xb')],'id');this[_0xee44('0xc')][_0xee44('0x11')]=_0x452d1c;};WhatsappQueue['prototype'][_0xee44('0xe')]=function(){this[_0xee44('0x12')]=0x0;this['paused']=0x0;for(var _0x116a99=0x0;_0x116a99=0x0?this[_0xee44('0x16')]:0x0;var _0x458b2c={'id':this['id'],'available':this[_0xee44('0x16')],'loggedIn':this[_0xee44('0x12')],'name':this[_0xee44('0x7')],'paused':this['paused'],'waiting':this[_0xee44('0xd')]};var _0x532d9f=md5(JSON['stringify'](_0x458b2c));if(this[_0xee44('0x0')]!==_0x532d9f){this[_0xee44('0x0')]=_0x532d9f;io['to'](util[_0xee44('0x17')](_0xee44('0x18'),_0x458b2c[_0xee44('0x7')]))['emit'](_0xee44('0x19'),_0x458b2c);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 311edbd..da6720b 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1cb9,0x14e));var _0x91cb=function(_0xb9afc0,_0x222202){_0xb9afc0=_0xb9afc0-0x0;var _0x5c8812=_0x1cb9[_0xb9afc0];return _0x5c8812;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file +var _0x6aa7=['agents','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','intervals','isUndefined','updateRealtime','initChatQueues','updateRouting','initMailQueues','mailQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x6aa7,0x178));var _0x76aa=function(_0x2517f2,_0x766c17){_0x2517f2=_0x2517f2-0x0;var _0x323ba7=_0x6aa7[_0x2517f2];return _0x323ba7;};'use strict';var BPromise=require(_0x76aa('0x0'));var util=require('util');var _=require(_0x76aa('0x1'));var moment=require(_0x76aa('0x2'));var Agent=require(_0x76aa('0x3'));var Interval=require(_0x76aa('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x76aa('0x5'));var SmsQueue=require(_0x76aa('0x6'));var MailQueue=require(_0x76aa('0x7'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0x76aa('0x8')]={};this['intervals']={};this[_0x76aa('0x9')]={};this[_0x76aa('0xa')]={};this[_0x76aa('0xb')]={};this['mailQueues']={};this[_0x76aa('0xc')]={};this[_0x76aa('0xd')]={};this[_0x76aa('0xe')]={};this['mailQueuesWaitingInteractions']={};this[_0x76aa('0xf')]={};this[_0x76aa('0x10')]={};this[_0x76aa('0x11')]={};this[_0x76aa('0x12')]={};};function freeIsNotKey(_0x37f1ab,_0x128435,_0x2c5075){var _0x8dc35c=_[_0x76aa('0x13')](_0x37f1ab,function(_0x17a417,_0x5e5f47){return _0x17a417[_0x2c5075];});for(var _0x112c39 in _0x128435){if(_0x128435['hasOwnProperty'](_0x112c39)){if(!_0x8dc35c[_0x112c39]){delete _0x128435[_0x112c39];}}}}Realtime[_0x76aa('0x14')][_0x76aa('0x15')]=function(_0x3f8f6b,_0x8e44ed){for(var _0x10432c in _0x8e44ed){if(_0x3f8f6b['hasOwnProperty'](_0x10432c)){_0x3f8f6b[_0x10432c]=_0x8e44ed[_0x10432c];}}};Realtime['prototype'][_0x76aa('0x16')]=function(){var _0x4cfc34=this;return function(_0x180d92){if(_0x180d92){freeIsNotKey(_0x180d92,_0x4cfc34[_0x76aa('0x8')],'id');for(var _0x5cf594=0x0,_0x2111c7={},_0x550d9a={};_0x5cf594<_0x180d92[_0x76aa('0x17')];_0x5cf594+=0x1){_0x2111c7=_0x180d92[_0x5cf594];if(_['isUndefined'](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']])){_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']]=new Agent(_0x2111c7);}else{_0x4cfc34[_0x76aa('0x15')](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']],_0x2111c7);}}}return _0x4cfc34[_0x76aa('0x8')];};};Realtime[_0x76aa('0x14')]['initIntervals']=function(){var _0x5d6202=this;return function(_0x256636){if(_0x256636){freeIsNotKey(_0x256636,_0x5d6202[_0x76aa('0x18')],'id');for(var _0xf0711=0x0,_0x15b931={},_0x15109b={};_0xf0711<_0x256636[_0x76aa('0x17')];_0xf0711+=0x1){_0x15b931=_0x256636[_0xf0711];if(_[_0x76aa('0x19')](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']])){_0x5d6202[_0x76aa('0x18')][_0x15b931['id']]=new Interval(_0x15b931);}else{_0x5d6202['mergeFromDatabase'](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']],_0x15b931);}}}return _0x5d6202[_0x76aa('0x18')];};};Realtime[_0x76aa('0x14')]['initOpenchannelQueues']=function(){var _0x41463a=this;return function(_0x189cb6){if(_0x189cb6){freeIsNotKey(_0x189cb6,_0x41463a[_0x76aa('0x9')],'id');for(var _0x2bd2c6=0x0,_0x29c50c={},_0xc1044c={};_0x2bd2c6<_0x189cb6[_0x76aa('0x17')];_0x2bd2c6+=0x1){_0x29c50c=_0x189cb6[_0x2bd2c6];if(_[_0x76aa('0x19')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']])){_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]=new OpenchannelQueue(_0x29c50c);}else{_0x41463a[_0x76aa('0x15')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']],_0x29c50c);}_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]['updateRouting']();_0x41463a[_0x76aa('0x9')][_0x29c50c['id']][_0x76aa('0x1a')]();}}return _0x41463a[_0x76aa('0x9')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1b')]=function(){var _0x2f9316=this;return function(_0x25a803){if(_0x25a803){freeIsNotKey(_0x25a803,_0x2f9316[_0x76aa('0xa')],'id');for(var _0xd12a99=0x0,_0x1bdc3d={},_0x545b06={};_0xd12a99<_0x25a803[_0x76aa('0x17')];_0xd12a99+=0x1){_0x1bdc3d=_0x25a803[_0xd12a99];if(_['isUndefined'](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']])){_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']]=new ChatQueue(_0x1bdc3d);}else{_0x2f9316[_0x76aa('0x15')](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']],_0x1bdc3d);}_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1c')]();_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1a')]();}}return _0x2f9316[_0x76aa('0xa')];};};Realtime[_0x76aa('0x14')]['initSmsQueues']=function(){var _0x430ad6=this;return function(_0x5532c7){if(_0x5532c7){freeIsNotKey(_0x5532c7,_0x430ad6[_0x76aa('0xb')],'id');for(var _0x928ccf=0x0,_0x458ac3={},_0x38ecd1={};_0x928ccf<_0x5532c7[_0x76aa('0x17')];_0x928ccf+=0x1){_0x458ac3=_0x5532c7[_0x928ccf];if(_['isUndefined'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']])){_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']]=new SmsQueue(_0x458ac3);}else{_0x430ad6['mergeFromDatabase'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']],_0x458ac3);}_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1c')]();_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1a')]();}}return _0x430ad6['smsQueues'];};};Realtime['prototype'][_0x76aa('0x1d')]=function(){var _0x282c56=this;return function(_0x198fcb){if(_0x198fcb){freeIsNotKey(_0x198fcb,_0x282c56[_0x76aa('0x1e')],'id');for(var _0x595a0f=0x0,_0x592596={},_0xdb18d3={};_0x595a0f<_0x198fcb[_0x76aa('0x17')];_0x595a0f+=0x1){_0x592596=_0x198fcb[_0x595a0f];if(_[_0x76aa('0x19')](_0x282c56[_0x76aa('0x1e')][_0x592596['id']])){_0x282c56[_0x76aa('0x1e')][_0x592596['id']]=new MailQueue(_0x592596);}else{_0x282c56['mergeFromDatabase'](_0x282c56[_0x76aa('0x1e')][_0x592596['id']],_0x592596);}_0x282c56['mailQueues'][_0x592596['id']]['updateRouting']();_0x282c56[_0x76aa('0x1e')][_0x592596['id']][_0x76aa('0x1a')]();}}return _0x282c56[_0x76aa('0x1e')];};};Realtime[_0x76aa('0x14')]['initFaxQueues']=function(){var _0x401c07=this;return function(_0x1c22f7){if(_0x1c22f7){freeIsNotKey(_0x1c22f7,_0x401c07[_0x76aa('0xc')],'id');for(var _0x4e131a=0x0,_0x113770={},_0x1638db={};_0x4e131a<_0x1c22f7[_0x76aa('0x17')];_0x4e131a+=0x1){_0x113770=_0x1c22f7[_0x4e131a];if(_[_0x76aa('0x19')](_0x401c07[_0x76aa('0xc')][_0x113770['id']])){_0x401c07[_0x76aa('0xc')][_0x113770['id']]=new FaxQueue(_0x113770);}else{_0x401c07[_0x76aa('0x15')](_0x401c07[_0x76aa('0xc')][_0x113770['id']],_0x113770);}_0x401c07[_0x76aa('0xc')][_0x113770['id']]['updateRouting']();_0x401c07[_0x76aa('0xc')][_0x113770['id']][_0x76aa('0x1a')]();}}return _0x401c07[_0x76aa('0xc')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1f')]=function(){var _0x2957aa=this;return function(_0x572fdb){if(_0x572fdb){freeIsNotKey(_0x572fdb,_0x2957aa['whatsappQueues'],'id');for(var _0x153a47=0x0,_0x262906={},_0x426454={};_0x153a47<_0x572fdb[_0x76aa('0x17')];_0x153a47+=0x1){_0x262906=_0x572fdb[_0x153a47];if(_['isUndefined'](_0x2957aa[_0x76aa('0xd')][_0x262906['id']])){_0x2957aa[_0x76aa('0xd')][_0x262906['id']]=new WhatsappQueue(_0x262906);}else{_0x2957aa[_0x76aa('0x15')](_0x2957aa[_0x76aa('0xd')][_0x262906['id']],_0x262906);}_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRouting']();_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRealtime']();}}return _0x2957aa[_0x76aa('0xd')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ad00703..9c749e4 100644 --- a/server/services/routing/rpc/chatInteraction.js +++ b/server/services/routing/rpc/chatInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe191=['update','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','../client'];(function(_0xa29be2,_0x5a1015){var _0x5ef0d3=function(_0x28a563){while(--_0x28a563){_0xa29be2['push'](_0xa29be2['shift']());}};_0x5ef0d3(++_0x5a1015);}(_0xe191,0x125));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1e19('0x0'));exports[_0x1e19('0x1')]=function(_0x3ba0b3,_0x5b7dd5){return client[_0x1e19('0x2')](_0x1e19('0x3'),{'body':_0x5b7dd5,'options':{'where':{'id':_0x3ba0b3}},'log':_0x1e19('0x4')});};exports['addTags']=function(_0xcb76f2,_0x44c066){return client[_0x1e19('0x2')](_0x1e19('0x5'),{'body':_0x44c066,'options':{'where':{'id':_0xcb76f2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x5641=['../client','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x22dd2b,_0x3b116a){var _0x2c816c=function(_0x4f2765){while(--_0x4f2765){_0x22dd2b['push'](_0x22dd2b['shift']());}};_0x2c816c(++_0x3b116a);}(_0x5641,0x1f1));var _0x1564=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x5641[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x1564('0x0'));exports['update']=function(_0x423197,_0x1d9a11){return client['Request'](_0x1564('0x1'),{'body':_0x1d9a11,'options':{'where':{'id':_0x423197}},'log':_0x1564('0x2')});};exports[_0x1564('0x3')]=function(_0x5ad7d9,_0x998ab){return client[_0x1564('0x4')](_0x1564('0x5'),{'body':_0x998ab,'options':{'where':{'id':_0x5ad7d9}},'log':_0x1564('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f28c89d..c663dc0 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5a4=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0xe5a4,0x154));var _0x4e5a=function(_0x19fc35,_0x34adf9){_0x19fc35=_0x19fc35-0x0;var _0x55ce9d=_0xe5a4[_0x19fc35];return _0x55ce9d;};'use strict';var client=require(_0x4e5a('0x0'));exports[_0x4e5a('0x1')]=function(_0x12cd79){return client['Request'](_0x4e5a('0x2'),{'body':_0x12cd79,'log':_0x4e5a('0x3')});}; \ No newline at end of file +var _0xc138=['../client','Request','createChatMessage'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0xc138,0x186));var _0x8c13=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc138[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x8c13('0x0'));exports['create']=function(_0x2f91a0){return client[_0x8c13('0x1')]('CreateChatMessage',{'body':_0x2f91a0,'log':_0x8c13('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 2f27b1f..128ba3d 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2d8=['GetChatQueue','name','timeout','strategy','User','online','chatPause','../client','getChatQueues','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb2d8,0x10b));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8b2d('0x0'));exports[_0x8b2d('0x1')]=function(){return function(){return client[_0x8b2d('0x2')](_0x8b2d('0x3'),{'options':{'raw':![],'attributes':['id',_0x8b2d('0x4'),_0x8b2d('0x5'),_0x8b2d('0x6')],'include':[{'model':_0x8b2d('0x7'),'as':'Agents','attributes':['id',_0x8b2d('0x4'),_0x8b2d('0x8'),_0x8b2d('0x9')]}]},'log':_0x8b2d('0x1')});};}; \ No newline at end of file +var _0xd4aa=['Request','GetChatQueue','name','User','online','chatPause','../client','getChatQueues'];(function(_0x57f5fb,_0x3966b0){var _0x161a64=function(_0x47b9bf){while(--_0x47b9bf){_0x57f5fb['push'](_0x57f5fb['shift']());}};_0x161a64(++_0x3966b0);}(_0xd4aa,0x96));var _0xad4a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xd4aa[_0x160c73];return _0xd9302;};'use strict';var client=require(_0xad4a('0x0'));exports[_0xad4a('0x1')]=function(){return function(){return client[_0xad4a('0x2')](_0xad4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xad4a('0x4'),'timeout','strategy'],'include':[{'model':_0xad4a('0x5'),'as':'Agents','attributes':['id',_0xad4a('0x4'),_0xad4a('0x6'),_0xad4a('0x7')]}]},'log':_0xad4a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 46aff9e..7f3330f 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39b3=['DESC','../client','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x459566,_0x292550){var _0x203344=function(_0x58ff0d){while(--_0x58ff0d){_0x459566['push'](_0x459566['shift']());}};_0x203344(++_0x292550);}(_0x39b3,0xc9));var _0x339b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x39b3[_0xbb091];return _0x467a04;};'use strict';var client=require(_0x339b('0x0'));exports['create']=function(_0x57b94f){return client[_0x339b('0x1')]('CreateChatQueueReport',{'body':_0x57b94f,'log':_0x339b('0x2')});};exports['update']=function(_0x3427e1,_0x3c4a53){return client[_0x339b('0x1')](_0x339b('0x3'),{'body':_0x3c4a53,'options':{'where':{'uniqueid':_0x3427e1},'order':[['id',_0x339b('0x4')]],'limit':0x1},'log':_0x339b('0x3')});}; \ No newline at end of file +var _0x9b83=['../client','create','Request','CreateChatQueueReport','update','DESC'];(function(_0x3bf684,_0x43609f){var _0x46504d=function(_0x34afe1){while(--_0x34afe1){_0x3bf684['push'](_0x3bf684['shift']());}};_0x46504d(++_0x43609f);}(_0x9b83,0x84));var _0x39b8=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x9b83[_0x432fca];return _0x3adba4;};'use strict';var client=require(_0x39b8('0x0'));exports[_0x39b8('0x1')]=function(_0x193462){return client[_0x39b8('0x2')](_0x39b8('0x3'),{'body':_0x193462,'log':_0x39b8('0x3')});};exports[_0x39b8('0x4')]=function(_0x317506,_0x2fdfef){return client[_0x39b8('0x2')]('UpdateChatQueueReport',{'body':_0x2fdfef,'options':{'where':{'uniqueid':_0x317506},'order':[['id',_0x39b8('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 1506326..ef449db 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5c9=['UpdateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5c9,0x1a1));var _0x9f5c=function(_0x19ec47,_0x256e68){_0x19ec47=_0x19ec47-0x0;var _0x3f8205=_0xf5c9[_0x19ec47];return _0x3f8205;};'use strict';var client=require(_0x9f5c('0x0'));exports[_0x9f5c('0x1')]=function(_0x22e20,_0x20482c){return client[_0x9f5c('0x2')](_0x9f5c('0x3'),{'body':_0x20482c,'options':{'where':{'id':_0x22e20}},'log':'updateFaxInteraction'});};exports['addTags']=function(_0x203b64,_0x55d2ce){return client[_0x9f5c('0x2')](_0x9f5c('0x4'),{'body':_0x55d2ce,'options':{'where':{'id':_0x203b64}},'log':_0x9f5c('0x5')});}; \ No newline at end of file +var _0x126b=['update','Request','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x126b,0x19c));var _0xb126=function(_0x7b652,_0x575a62){_0x7b652=_0x7b652-0x0;var _0x1797fd=_0x126b[_0x7b652];return _0x1797fd;};'use strict';var client=require(_0xb126('0x0'));exports[_0xb126('0x1')]=function(_0x3445dc,_0x3c801c){return client[_0xb126('0x2')]('UpdateFaxInteraction',{'body':_0x3c801c,'options':{'where':{'id':_0x3445dc}},'log':_0xb126('0x3')});};exports[_0xb126('0x4')]=function(_0x4b8ae6,_0xfc8869){return client[_0xb126('0x2')](_0xb126('0x5'),{'body':_0xfc8869,'options':{'where':{'id':_0x4b8ae6}},'log':_0xb126('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index afe4d17..08c7dea 100644 --- a/server/services/routing/rpc/faxMessage.js +++ b/server/services/routing/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5dc3=['../client','Request','createFaxMessage'];(function(_0x2f19a1,_0x81718d){var _0x112701=function(_0x59db76){while(--_0x59db76){_0x2f19a1['push'](_0x2f19a1['shift']());}};_0x112701(++_0x81718d);}(_0x5dc3,0x189));var _0x35dc=function(_0xc1d691,_0x166b6e){_0xc1d691=_0xc1d691-0x0;var _0x16ac7=_0x5dc3[_0xc1d691];return _0x16ac7;};'use strict';var client=require(_0x35dc('0x0'));exports['create']=function(_0x4e71be){return client[_0x35dc('0x1')]('CreateFaxMessage',{'body':_0x4e71be,'log':_0x35dc('0x2')});}; \ No newline at end of file +var _0x80ca=['create','Request','CreateFaxMessage'];(function(_0x5ab054,_0xcbfe74){var _0x348290=function(_0x75ef7e){while(--_0x75ef7e){_0x5ab054['push'](_0x5ab054['shift']());}};_0x348290(++_0xcbfe74);}(_0x80ca,0x198));var _0xa80c=function(_0x3f8cda,_0x4759b4){_0x3f8cda=_0x3f8cda-0x0;var _0x3bb502=_0x80ca[_0x3f8cda];return _0x3bb502;};'use strict';var client=require('../client');exports[_0xa80c('0x0')]=function(_0x15f9c6){return client[_0xa80c('0x1')](_0xa80c('0x2'),{'body':_0x15f9c6,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d9ee374..8608e2a 100644 --- a/server/services/routing/rpc/faxQueue.js +++ b/server/services/routing/rpc/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0275=['Request','name','strategy','Agents','online','faxPause','getFaxQueues'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x0275,0xf5));var _0x5027=function(_0x359b2d,_0x3f9375){_0x359b2d=_0x359b2d-0x0;var _0x2a3356=_0x0275[_0x359b2d];return _0x2a3356;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x5027('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x5027('0x1'),'timeout',_0x5027('0x2')],'include':[{'model':'User','as':_0x5027('0x3'),'attributes':['id',_0x5027('0x1'),_0x5027('0x4'),_0x5027('0x5')]}]},'log':_0x5027('0x6')});};}; \ No newline at end of file +var _0x61c3=['User','Agents','name','online','faxPause','../client','getFaxQueues','GetFaxQueue','timeout','strategy'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x61c3,0xc3));var _0x361c=function(_0xc06e76,_0x5f2514){_0xc06e76=_0xc06e76-0x0;var _0x1387f3=_0x61c3[_0xc06e76];return _0x1387f3;};'use strict';var client=require(_0x361c('0x0'));exports[_0x361c('0x1')]=function(){return function(){return client['Request'](_0x361c('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x361c('0x3'),_0x361c('0x4')],'include':[{'model':_0x361c('0x5'),'as':_0x361c('0x6'),'attributes':['id',_0x361c('0x7'),_0x361c('0x8'),_0x361c('0x9')]}]},'log':_0x361c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index ba368ba..f4031c5 100644 --- a/server/services/routing/rpc/faxQueueReport.js +++ b/server/services/routing/rpc/faxQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b9e=['update','DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport'];(function(_0x3bf73e,_0x382e8d){var _0x2ec4a7=function(_0x426bb3){while(--_0x426bb3){_0x3bf73e['push'](_0x3bf73e['shift']());}};_0x2ec4a7(++_0x382e8d);}(_0x6b9e,0x16b));var _0xe6b9=function(_0x41e2e3,_0x25d722){_0x41e2e3=_0x41e2e3-0x0;var _0x20cc85=_0x6b9e[_0x41e2e3];return _0x20cc85;};'use strict';var client=require('../client');exports[_0xe6b9('0x0')]=function(_0x3e5a89){return client[_0xe6b9('0x1')]('CreateFaxQueueReport',{'body':_0x3e5a89,'log':_0xe6b9('0x2')});};exports[_0xe6b9('0x3')]=function(_0x487bfd,_0x719f0){return client[_0xe6b9('0x1')]('UpdateFaxQueueReport',{'body':_0x719f0,'options':{'where':{'uniqueid':_0x487bfd},'order':[['id',_0xe6b9('0x4')]],'limit':0x1},'log':_0xe6b9('0x5')});}; \ No newline at end of file +var _0x44e8=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x44e8,0xd7));var _0x844e=function(_0x2ac166,_0x239cd9){_0x2ac166=_0x2ac166-0x0;var _0x2ab0e1=_0x44e8[_0x2ac166];return _0x2ab0e1;};'use strict';var client=require(_0x844e('0x0'));exports['create']=function(_0x4f0e7f){return client[_0x844e('0x1')](_0x844e('0x2'),{'body':_0x4f0e7f,'log':_0x844e('0x2')});};exports[_0x844e('0x3')]=function(_0x49ce1b,_0x3a8b3c){return client[_0x844e('0x1')](_0x844e('0x4'),{'body':_0x3a8b3c,'options':{'where':{'uniqueid':_0x49ce1b},'order':[['id',_0x844e('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2d179fb..ce7125d 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cf8=['interval','../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x1730df,_0x1497eb){var _0x4f3834=function(_0x36b2b2){while(--_0x36b2b2){_0x1730df['push'](_0x1730df['shift']());}};_0x4f3834(++_0x1497eb);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x272ea6,_0x3f0673){_0x272ea6=_0x272ea6-0x0;var _0x43ef03=_0x4cf8[_0x272ea6];return _0x43ef03;};'use strict';var client=require(_0x84cf('0x0'));exports[_0x84cf('0x1')]=function(){return function(){return client[_0x84cf('0x2')](_0x84cf('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x84cf('0x4')],'include':[{'model':_0x84cf('0x5'),'as':_0x84cf('0x6'),'attributes':['id',_0x84cf('0x4'),_0x84cf('0x7')]}]},'log':_0x84cf('0x1')});};}; \ No newline at end of file +var _0x2547=['Request','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0x2547,0x1cd));var _0x7254=function(_0x53f9eb,_0x1d2a88){_0x53f9eb=_0x53f9eb-0x0;var _0x13e93a=_0x2547[_0x53f9eb];return _0x13e93a;};'use strict';var client=require('../client');exports[_0x7254('0x0')]=function(){return function(){return client[_0x7254('0x1')](_0x7254('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7254('0x3')],'include':[{'model':_0x7254('0x4'),'as':_0x7254('0x5'),'attributes':['id',_0x7254('0x3'),_0x7254('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b3405f8..42ba7e4 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd505=['../client','update','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x2aeb2d,_0x416ed9){var _0xdf886c=function(_0x2a93c5){while(--_0x2a93c5){_0x2aeb2d['push'](_0x2aeb2d['shift']());}};_0xdf886c(++_0x416ed9);}(_0xd505,0x15e));var _0x5d50=function(_0x5981e1,_0x123263){_0x5981e1=_0x5981e1-0x0;var _0x34088d=_0xd505[_0x5981e1];return _0x34088d;};'use strict';var client=require(_0x5d50('0x0'));exports[_0x5d50('0x1')]=function(_0x54ccd6,_0x4f4778){return client['Request']('UpdateMailInteraction',{'body':_0x4f4778,'options':{'where':{'id':_0x54ccd6}},'log':'updateMailInteraction'});};exports[_0x5d50('0x2')]=function(_0x144e39,_0x397aff){return client['Request'](_0x5d50('0x3'),{'body':_0x397aff,'options':{'where':{'id':_0x144e39}},'log':_0x5d50('0x4')});}; \ No newline at end of file +var _0xca60=['AddTagsToMailInteraction','update','Request'];(function(_0x343da3,_0x263947){var _0x2c6df9=function(_0x1a6f09){while(--_0x1a6f09){_0x343da3['push'](_0x343da3['shift']());}};_0x2c6df9(++_0x263947);}(_0xca60,0x6d));var _0x0ca6=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xca60[_0x47e93d];return _0xe86c46;};'use strict';var client=require('../client');exports[_0x0ca6('0x0')]=function(_0x8ff030,_0x4c88f4){return client[_0x0ca6('0x1')]('UpdateMailInteraction',{'body':_0x4c88f4,'options':{'where':{'id':_0x8ff030}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x49b6ff,_0xfa2a0c){return client[_0x0ca6('0x1')](_0x0ca6('0x2'),{'body':_0xfa2a0c,'options':{'where':{'id':_0x49b6ff}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b624d7a..17ea533 100644 --- a/server/services/routing/rpc/mailMessage.js +++ b/server/services/routing/rpc/mailMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fca=['Request','CreateMailMessage','../client'];(function(_0x4281e6,_0x5da03f){var _0x2afb4d=function(_0x331a96){while(--_0x331a96){_0x4281e6['push'](_0x4281e6['shift']());}};_0x2afb4d(++_0x5da03f);}(_0x0fca,0x116));var _0xa0fc=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0fca[_0x199572];return _0x13cfa3;};'use strict';var client=require(_0xa0fc('0x0'));exports['create']=function(_0x52db70){return client[_0xa0fc('0x1')](_0xa0fc('0x2'),{'body':_0x52db70,'log':'createMailMessage'});}; \ No newline at end of file +var _0xc229=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x2e2680,_0x3229c4){var _0x14fde2=function(_0x53dada){while(--_0x53dada){_0x2e2680['push'](_0x2e2680['shift']());}};_0x14fde2(++_0x3229c4);}(_0xc229,0x154));var _0x9c22=function(_0x4ed0ff,_0x1170e0){_0x4ed0ff=_0x4ed0ff-0x0;var _0x2e7745=_0xc229[_0x4ed0ff];return _0x2e7745;};'use strict';var client=require(_0x9c22('0x0'));exports[_0x9c22('0x1')]=function(_0x3ffeee){return client['Request'](_0x9c22('0x2'),{'body':_0x3ffeee,'log':_0x9c22('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index afffd56..cdae49f 100644 --- a/server/services/routing/rpc/mailQueue.js +++ b/server/services/routing/rpc/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38b4=['Request','GetMailQueue','timeout','strategy','name','online','mailPause','../client','getMailQueues'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x38b4,0x181));var _0x438b=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x38b4[_0x34bf97];return _0x292719;};'use strict';var client=require(_0x438b('0x0'));exports[_0x438b('0x1')]=function(){return function(){return client[_0x438b('0x2')](_0x438b('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x438b('0x4'),_0x438b('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x438b('0x6'),_0x438b('0x7'),_0x438b('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x39ac=['../client','getMailQueues','Request','name','strategy','User','Agents','online','mailPause'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x39ac,0x14d));var _0xc39a=function(_0xfd2aef,_0x5dc8aa){_0xfd2aef=_0xfd2aef-0x0;var _0x3dc991=_0x39ac[_0xfd2aef];return _0x3dc991;};'use strict';var client=require(_0xc39a('0x0'));exports[_0xc39a('0x1')]=function(){return function(){return client[_0xc39a('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc39a('0x3'),'timeout',_0xc39a('0x4')],'include':[{'model':_0xc39a('0x5'),'as':_0xc39a('0x6'),'attributes':['id','name',_0xc39a('0x7'),_0xc39a('0x8')]}]},'log':_0xc39a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 932809d..1349850 100644 --- a/server/services/routing/rpc/mailQueueReport.js +++ b/server/services/routing/rpc/mailQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80b2=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x80b2,0x1c2));var _0x280b=function(_0x181981,_0x3bfa9a){_0x181981=_0x181981-0x0;var _0x5cd059=_0x80b2[_0x181981];return _0x5cd059;};'use strict';var client=require(_0x280b('0x0'));exports[_0x280b('0x1')]=function(_0x403949){return client[_0x280b('0x2')](_0x280b('0x3'),{'body':_0x403949,'log':_0x280b('0x3')});};exports[_0x280b('0x4')]=function(_0x1d55c5,_0x417dff){return client['Request'](_0x280b('0x5'),{'body':_0x417dff,'options':{'where':{'uniqueid':_0x1d55c5},'order':[['id','DESC']],'limit':0x1},'log':_0x280b('0x5')});}; \ No newline at end of file +var _0xecf1=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x5b7632,_0x421b15){var _0x281896=function(_0x2e26c0){while(--_0x2e26c0){_0x5b7632['push'](_0x5b7632['shift']());}};_0x281896(++_0x421b15);}(_0xecf1,0xf8));var _0x1ecf=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0xecf1[_0x557f5f];return _0x196eba;};'use strict';var client=require(_0x1ecf('0x0'));exports[_0x1ecf('0x1')]=function(_0x2c47ff){return client[_0x1ecf('0x2')](_0x1ecf('0x3'),{'body':_0x2c47ff,'log':_0x1ecf('0x3')});};exports[_0x1ecf('0x4')]=function(_0x3a3c8b,_0x4d618d){return client[_0x1ecf('0x2')](_0x1ecf('0x5'),{'body':_0x4d618d,'options':{'where':{'uniqueid':_0x3a3c8b},'order':[['id',_0x1ecf('0x6')]],'limit':0x1},'log':_0x1ecf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 06761f2..29c8b85 100644 --- a/server/services/routing/rpc/openchannelInteraction.js +++ b/server/services/routing/rpc/openchannelInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eeb=['Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x501b6e,_0x526091){var _0x3756b9=function(_0x266021){while(--_0x266021){_0x501b6e['push'](_0x501b6e['shift']());}};_0x3756b9(++_0x526091);}(_0x0eeb,0x1f1));var _0xb0ee=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0eeb[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0xb0ee('0x0'));exports['update']=function(_0x2aef15,_0x5c13c1){return client[_0xb0ee('0x1')]('UpdateOpenchannelInteraction',{'body':_0x5c13c1,'options':{'where':{'id':_0x2aef15}},'log':_0xb0ee('0x2')});};exports[_0xb0ee('0x3')]=function(_0x114483,_0x4bc3b4){return client[_0xb0ee('0x1')](_0xb0ee('0x4'),{'body':_0x4bc3b4,'options':{'where':{'id':_0x114483}},'log':_0xb0ee('0x5')});}; \ No newline at end of file +var _0xfd3e=['UpdateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0x4fcaf1,_0x59fa8b){var _0x509afb=function(_0x3019c1){while(--_0x3019c1){_0x4fcaf1['push'](_0x4fcaf1['shift']());}};_0x509afb(++_0x59fa8b);}(_0xfd3e,0xb1));var _0xefd3=function(_0x35abf8,_0x385d62){_0x35abf8=_0x35abf8-0x0;var _0x1f68a4=_0xfd3e[_0x35abf8];return _0x1f68a4;};'use strict';var client=require(_0xefd3('0x0'));exports[_0xefd3('0x1')]=function(_0x52191e,_0x3accad){return client[_0xefd3('0x2')](_0xefd3('0x3'),{'body':_0x3accad,'options':{'where':{'id':_0x52191e}},'log':'updateOpenchannelInteraction'});};exports[_0xefd3('0x4')]=function(_0x3bf181,_0x3ddfa2){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x3ddfa2,'options':{'where':{'id':_0x3bf181}},'log':_0xefd3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 60f3a1c..5ab4220 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb5=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0bb5,0x148));var _0x50bb=function(_0x33e415,_0x337c17){_0x33e415=_0x33e415-0x0;var _0x53900e=_0x0bb5[_0x33e415];return _0x53900e;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(_0x5e61cf){return client['Request'](_0x50bb('0x2'),{'body':_0x5e61cf,'log':_0x50bb('0x3')});}; \ No newline at end of file +var _0x00bb=['CreateOpenchannelMessage','../client','create'];(function(_0x24dfd2,_0x504fac){var _0x3abda1=function(_0x55bc85){while(--_0x55bc85){_0x24dfd2['push'](_0x24dfd2['shift']());}};_0x3abda1(++_0x504fac);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0xb00b('0x0'));exports[_0xb00b('0x1')]=function(_0x468a51){return client['Request'](_0xb00b('0x2'),{'body':_0x468a51,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index be4f002..09aedb2 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85f4=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x85f4,0xf3));var _0x485f=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x85f4[_0x4709c0];return _0x13348b;};'use strict';var client=require(_0x485f('0x0'));exports[_0x485f('0x1')]=function(){return function(){return client[_0x485f('0x2')](_0x485f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x485f('0x4'),_0x485f('0x5')],'include':[{'model':_0x485f('0x6'),'as':_0x485f('0x7'),'attributes':['id','name',_0x485f('0x8'),_0x485f('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x86b5=['User','Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy'];(function(_0x11940a,_0x35d554){var _0x1ac00c=function(_0x5ec451){while(--_0x5ec451){_0x11940a['push'](_0x11940a['shift']());}};_0x1ac00c(++_0x35d554);}(_0x86b5,0x14b));var _0x586b=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x86b5[_0xe719ec];return _0x4842a1;};'use strict';var client=require('../client');exports[_0x586b('0x0')]=function(){return function(){return client[_0x586b('0x1')](_0x586b('0x2'),{'options':{'raw':![],'attributes':['id',_0x586b('0x3'),'timeout',_0x586b('0x4')],'include':[{'model':_0x586b('0x5'),'as':_0x586b('0x6'),'attributes':['id','name',_0x586b('0x7'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c4fa0bb..a534021 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1e0=['UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport'];(function(_0x25efc1,_0x562953){var _0x2b55f1=function(_0x1cb20c){while(--_0x1cb20c){_0x25efc1['push'](_0x25efc1['shift']());}};_0x2b55f1(++_0x562953);}(_0xe1e0,0x1b2));var _0x0e1e=function(_0x1207cf,_0x2d1d49){_0x1207cf=_0x1207cf-0x0;var _0x116c44=_0xe1e0[_0x1207cf];return _0x116c44;};'use strict';var client=require(_0x0e1e('0x0'));exports['create']=function(_0x2b1e4f){return client['Request'](_0x0e1e('0x1'),{'body':_0x2b1e4f,'log':_0x0e1e('0x1')});};exports['update']=function(_0x33ada2,_0x27beec){return client['Request'](_0x0e1e('0x2'),{'body':_0x27beec,'options':{'where':{'uniqueid':_0x33ada2},'order':[['id',_0x0e1e('0x3')]],'limit':0x1},'log':_0x0e1e('0x2')});}; \ No newline at end of file +var _0xc98a=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x53cfb9,_0x10bfb6){var _0x5072c7=function(_0x2120d7){while(--_0x2120d7){_0x53cfb9['push'](_0x53cfb9['shift']());}};_0x5072c7(++_0x10bfb6);}(_0xc98a,0x168));var _0xac98=function(_0x19f432,_0x32ce04){_0x19f432=_0x19f432-0x0;var _0x1f03de=_0xc98a[_0x19f432];return _0x1f03de;};'use strict';var client=require(_0xac98('0x0'));exports[_0xac98('0x1')]=function(_0x43eb85){return client[_0xac98('0x2')]('CreateOpenchannelQueueReport',{'body':_0x43eb85,'log':_0xac98('0x3')});};exports[_0xac98('0x4')]=function(_0x4dfad1,_0x51410e){return client[_0xac98('0x2')](_0xac98('0x5'),{'body':_0x51410e,'options':{'where':{'uniqueid':_0x4dfad1},'order':[['id',_0xac98('0x6')]],'limit':0x1},'log':_0xac98('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index dc89f5e..5b7cda9 100644 --- a/server/services/routing/rpc/smsInteraction.js +++ b/server/services/routing/rpc/smsInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2678=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x47b69f,_0x3f1696){var _0x56f392=function(_0x195f60){while(--_0x195f60){_0x47b69f['push'](_0x47b69f['shift']());}};_0x56f392(++_0x3f1696);}(_0x2678,0x1bb));var _0x8267=function(_0x364739,_0x4181a4){_0x364739=_0x364739-0x0;var _0x2a51bd=_0x2678[_0x364739];return _0x2a51bd;};'use strict';var client=require('../client');exports[_0x8267('0x0')]=function(_0x14a078,_0x25b9dc){return client['Request']('UpdateSmsInteraction',{'body':_0x25b9dc,'options':{'where':{'id':_0x14a078}},'log':'updateSmsInteraction'});};exports[_0x8267('0x1')]=function(_0x30fa94,_0x1f1d79){return client['Request'](_0x8267('0x2'),{'body':_0x1f1d79,'options':{'where':{'id':_0x30fa94}},'log':_0x8267('0x3')});}; \ No newline at end of file +var _0x0db8=['addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0x0db8,0x1cd));var _0x80db=function(_0x3f85b3,_0x5870a3){_0x3f85b3=_0x3f85b3-0x0;var _0x741189=_0x0db8[_0x3f85b3];return _0x741189;};'use strict';var client=require(_0x80db('0x0'));exports['update']=function(_0x30e68d,_0x20511c){return client[_0x80db('0x1')](_0x80db('0x2'),{'body':_0x20511c,'options':{'where':{'id':_0x30e68d}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x13ae1d,_0x23227c){return client['Request']('AddTagsToSmsInteraction',{'body':_0x23227c,'options':{'where':{'id':_0x13ae1d}},'log':_0x80db('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0897749..a640982 100644 --- a/server/services/routing/rpc/smsMessage.js +++ b/server/services/routing/rpc/smsMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x170f=['CreateSmsMessage','../client','create','Request'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0x170f,0x65));var _0xf170=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x170f[_0x2a5099];return _0x2802f1;};'use strict';var client=require(_0xf170('0x0'));exports[_0xf170('0x1')]=function(_0x43c655){return client[_0xf170('0x2')](_0xf170('0x3'),{'body':_0x43c655,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xf344=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x43027f,_0x5a6411){var _0x3a6287=function(_0x57d03b){while(--_0x57d03b){_0x43027f['push'](_0x43027f['shift']());}};_0x3a6287(++_0x5a6411);}(_0xf344,0x98));var _0x4f34=function(_0x206d08,_0xc5ddfa){_0x206d08=_0x206d08-0x0;var _0x55bfbc=_0xf344[_0x206d08];return _0x55bfbc;};'use strict';var client=require(_0x4f34('0x0'));exports[_0x4f34('0x1')]=function(_0x39d950){return client[_0x4f34('0x2')](_0x4f34('0x3'),{'body':_0x39d950,'log':_0x4f34('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a3f6680..99a33e3 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x531f=['Agents','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','User'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x531f,0x16a));var _0xf531=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x531f[_0x4bb145];return _0x4db596;};'use strict';var client=require(_0xf531('0x0'));exports[_0xf531('0x1')]=function(){return function(){return client[_0xf531('0x2')](_0xf531('0x3'),{'options':{'raw':![],'attributes':['id',_0xf531('0x4'),_0xf531('0x5'),'strategy'],'include':[{'model':_0xf531('0x6'),'as':_0xf531('0x7'),'attributes':['id','name','online',_0xf531('0x8')]}]},'log':_0xf531('0x1')});};}; \ No newline at end of file +var _0x6c58=['../client','getSmsQueues','Request','GetSmsQueue','timeout','Agents','name','online','smsPause'];(function(_0x5ae31a,_0x2f5d53){var _0x978bad=function(_0x408eaa){while(--_0x408eaa){_0x5ae31a['push'](_0x5ae31a['shift']());}};_0x978bad(++_0x2f5d53);}(_0x6c58,0x1ef));var _0x86c5=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x6c58[_0xbe200f];return _0x192597;};'use strict';var client=require(_0x86c5('0x0'));exports[_0x86c5('0x1')]=function(){return function(){return client[_0x86c5('0x2')](_0x86c5('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x86c5('0x4'),'strategy'],'include':[{'model':'User','as':_0x86c5('0x5'),'attributes':['id',_0x86c5('0x6'),_0x86c5('0x7'),_0x86c5('0x8')]}]},'log':_0x86c5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index aaf8c19..0b006ce 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2edc=['DESC','../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1e9b87,_0x3dbea4){var _0x5e801a=function(_0x5cc15e){while(--_0x5cc15e){_0x1e9b87['push'](_0x1e9b87['shift']());}};_0x5e801a(++_0x3dbea4);}(_0x2edc,0x1d5));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc2ed('0x0'));exports['create']=function(_0xbc6d78){return client[_0xc2ed('0x1')](_0xc2ed('0x2'),{'body':_0xbc6d78,'log':'CreateSmsQueueReport'});};exports[_0xc2ed('0x3')]=function(_0x5f09f7,_0x44ca1a){return client[_0xc2ed('0x1')](_0xc2ed('0x4'),{'body':_0x44ca1a,'options':{'where':{'uniqueid':_0x5f09f7},'order':[['id',_0xc2ed('0x5')]],'limit':0x1},'log':_0xc2ed('0x4')});}; \ No newline at end of file +var _0xc022=['UpdateSmsQueueReport','create','Request','CreateSmsQueueReport','update'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xc022,0x173));var _0x2c02=function(_0x4fd812,_0x575915){_0x4fd812=_0x4fd812-0x0;var _0x6064b5=_0xc022[_0x4fd812];return _0x6064b5;};'use strict';var client=require('../client');exports[_0x2c02('0x0')]=function(_0x125ca8){return client[_0x2c02('0x1')](_0x2c02('0x2'),{'body':_0x125ca8,'log':_0x2c02('0x2')});};exports[_0x2c02('0x3')]=function(_0x55b3be,_0x736bd1){return client['Request'](_0x2c02('0x4'),{'body':_0x736bd1,'options':{'where':{'uniqueid':_0x55b3be},'order':[['id','DESC']],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 590c34b..1575b2d 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab75=['../client','getAgents','GetUser','agent','name','voicePause','chatPause','mailPause','faxPause','smsPause','smsCapacity','whatsappCapacity'];(function(_0x2ff876,_0x3fbaad){var _0x115882=function(_0xf961ff){while(--_0xf961ff){_0x2ff876['push'](_0x2ff876['shift']());}};_0x115882(++_0x3fbaad);}(_0xab75,0x1c8));var _0x5ab7=function(_0x89498d,_0x5c5d93){_0x89498d=_0x89498d-0x0;var _0x36197b=_0xab75[_0x89498d];return _0x36197b;};'use strict';var client=require(_0x5ab7('0x0'));exports[_0x5ab7('0x1')]=function(){return function(){return client['Request'](_0x5ab7('0x2'),{'options':{'raw':!![],'where':{'role':_0x5ab7('0x3')},'attributes':['id',_0x5ab7('0x4'),'online','pauseType','lastPauseAt',_0x5ab7('0x5'),_0x5ab7('0x6'),_0x5ab7('0x7'),_0x5ab7('0x8'),_0x5ab7('0x9'),'whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity',_0x5ab7('0xa'),_0x5ab7('0xb'),'openchannelCapacity']},'log':_0x5ab7('0x1')});};}; \ No newline at end of file +var _0x0e05=['voicePause','mailPause','faxPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','../client','Request','agent','online','pauseType','lastPauseAt'];(function(_0x374c7d,_0x2078d8){var _0x1f18aa=function(_0x2e4bfa){while(--_0x2e4bfa){_0x374c7d['push'](_0x374c7d['shift']());}};_0x1f18aa(++_0x2078d8);}(_0x0e05,0xca));var _0x50e0=function(_0x33c2ee,_0xd17ad3){_0x33c2ee=_0x33c2ee-0x0;var _0x20869a=_0x0e05[_0x33c2ee];return _0x20869a;};'use strict';var client=require(_0x50e0('0x0'));exports['getAgents']=function(){return function(){return client[_0x50e0('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x50e0('0x2')},'attributes':['id','name',_0x50e0('0x3'),_0x50e0('0x4'),_0x50e0('0x5'),_0x50e0('0x6'),'chatPause',_0x50e0('0x7'),_0x50e0('0x8'),'smsPause',_0x50e0('0x9'),_0x50e0('0xa'),_0x50e0('0xb'),_0x50e0('0xc'),_0x50e0('0xd'),'smsCapacity',_0x50e0('0xe'),_0x50e0('0xf')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 37aa020..7c510c3 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x057a=['updateWhatsappInteraction','addTags','../client','update','Request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x057a,0x1a6));var _0xa057=function(_0x5193aa,_0xbaf0ed){_0x5193aa=_0x5193aa-0x0;var _0x8c52c5=_0x057a[_0x5193aa];return _0x8c52c5;};'use strict';var client=require(_0xa057('0x0'));exports[_0xa057('0x1')]=function(_0x32f0b5,_0x50bfcd){return client[_0xa057('0x2')]('UpdateWhatsappInteraction',{'body':_0x50bfcd,'options':{'where':{'id':_0x32f0b5}},'log':_0xa057('0x3')});};exports[_0xa057('0x4')]=function(_0x5481b7,_0x2320cf){return client[_0xa057('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x2320cf,'options':{'where':{'id':_0x5481b7}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x3685=['addTags','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3c4bbc,_0x575cf5){var _0x411c40=function(_0x18d155){while(--_0x18d155){_0x3c4bbc['push'](_0x3c4bbc['shift']());}};_0x411c40(++_0x575cf5);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x5368('0x0'));exports['update']=function(_0x31ec8e,_0x581fe7){return client[_0x5368('0x1')](_0x5368('0x2'),{'body':_0x581fe7,'options':{'where':{'id':_0x31ec8e}},'log':_0x5368('0x3')});};exports[_0x5368('0x4')]=function(_0x271e21,_0x2c9c35){return client[_0x5368('0x1')](_0x5368('0x5'),{'body':_0x2c9c35,'options':{'where':{'id':_0x271e21}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b9b1b4d..98f7592 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ed0=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x408735,_0x32e450){var _0x2a867b=function(_0x5f4ba9){while(--_0x5f4ba9){_0x408735['push'](_0x408735['shift']());}};_0x2a867b(++_0x32e450);}(_0x0ed0,0xed));var _0x00ed=function(_0x2be4c1,_0x51b618){_0x2be4c1=_0x2be4c1-0x0;var _0x213efd=_0x0ed0[_0x2be4c1];return _0x213efd;};'use strict';var client=require(_0x00ed('0x0'));exports['create']=function(_0x435c8a){return client['Request'](_0x00ed('0x1'),{'body':_0x435c8a,'log':_0x00ed('0x2')});}; \ No newline at end of file +var _0x74bf=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x74bf,0x1e8));var _0xf74b=function(_0xeda0e0,_0x1a03bd){_0xeda0e0=_0xeda0e0-0x0;var _0x254df2=_0x74bf[_0xeda0e0];return _0x254df2;};'use strict';var client=require('../client');exports[_0xf74b('0x0')]=function(_0x46a751){return client[_0xf74b('0x1')](_0xf74b('0x2'),{'body':_0x46a751,'log':_0xf74b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 66bcd9b..170c49b 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55f1=['Agents','whatsappPause','../client','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x10b4b6,_0x27ca42){var _0x44d9d8=function(_0x4b6417){while(--_0x4b6417){_0x10b4b6['push'](_0x10b4b6['shift']());}};_0x44d9d8(++_0x27ca42);}(_0x55f1,0x9b));var _0x155f=function(_0x28be74,_0x4b822d){_0x28be74=_0x28be74-0x0;var _0x272e0b=_0x55f1[_0x28be74];return _0x272e0b;};'use strict';var client=require(_0x155f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x155f('0x1')](_0x155f('0x2'),{'options':{'raw':![],'attributes':['id',_0x155f('0x3'),_0x155f('0x4'),_0x155f('0x5')],'include':[{'model':_0x155f('0x6'),'as':_0x155f('0x7'),'attributes':['id','name','online',_0x155f('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xbfcc=['getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','strategy','whatsappPause'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0xbfcc[_0x9a3e0f];return _0x3d2a9a;};'use strict';var client=require(_0xcbfc('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xcbfc('0x1'),{'options':{'raw':![],'attributes':['id',_0xcbfc('0x2'),_0xcbfc('0x3'),_0xcbfc('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xcbfc('0x5')]}]},'log':_0xcbfc('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 682eac3..8c246b5 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39b8=['Request','DESC','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update'];(function(_0x57ce90,_0x519e42){var _0x562661=function(_0x5b5a0f){while(--_0x5b5a0f){_0x57ce90['push'](_0x57ce90['shift']());}};_0x562661(++_0x519e42);}(_0x39b8,0x18b));var _0x839b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39b8[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x839b('0x0'));exports[_0x839b('0x1')]=function(_0x59cc87){return client['Request'](_0x839b('0x2'),{'body':_0x59cc87,'log':_0x839b('0x2')});};exports[_0x839b('0x3')]=function(_0x4fc292,_0x364def){return client[_0x839b('0x4')]('UpdateWhatsappQueueReport',{'body':_0x364def,'options':{'where':{'uniqueid':_0x4fc292},'order':[['id',_0x839b('0x5')]],'limit':0x1},'log':_0x839b('0x6')});}; \ No newline at end of file +var _0xa0f0=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x3c29ee,_0x38133b){var _0x12da96=function(_0xa5999a){while(--_0xa5999a){_0x3c29ee['push'](_0x3c29ee['shift']());}};_0x12da96(++_0x38133b);}(_0xa0f0,0x10b));var _0x0a0f=function(_0x76ad1b,_0x4632c4){_0x76ad1b=_0x76ad1b-0x0;var _0x221617=_0xa0f0[_0x76ad1b];return _0x221617;};'use strict';var client=require(_0x0a0f('0x0'));exports[_0x0a0f('0x1')]=function(_0x24027d){return client[_0x0a0f('0x2')](_0x0a0f('0x3'),{'body':_0x24027d,'log':_0x0a0f('0x3')});};exports[_0x0a0f('0x4')]=function(_0x59a035,_0x22179e){return client[_0x0a0f('0x2')](_0x0a0f('0x5'),{'body':_0x22179e,'options':{'where':{'uniqueid':_0x59a035},'order':[['id',_0x0a0f('0x6')]],'limit':0x1},'log':_0x0a0f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 5559243..7afd8b0 100644 --- a/server/services/routing/server/applications/agent.js +++ b/server/services/routing/server/applications/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e18=['lodash','util','seq-queue','../../../../config/logger','routing','./strategy','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','length','error','map','message','join','find','agents','timeout','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate'];(function(_0x26c4b8,_0x4e4ef7){var _0x543a20=function(_0x1a8e22){while(--_0x1a8e22){_0x26c4b8['push'](_0x26c4b8['shift']());}};_0x543a20(++_0x4e4ef7);}(_0x1e18,0x1b1));var _0x81e1=function(_0xccdde3,_0x4786bb){_0xccdde3=_0xccdde3-0x0;var _0x3e3a29=_0x1e18[_0xccdde3];return _0x3e3a29;};'use strict';var schema=require(_0x81e1('0x0'));var _=require(_0x81e1('0x1'));var util=require(_0x81e1('0x2'));var seqqueue=require(_0x81e1('0x3'));var logger=require(_0x81e1('0x4'))(_0x81e1('0x5'));var strategy=require(_0x81e1('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x81e1('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x22369d,_0x5e560d,_0x31eb0d){return logger[_0x81e1('0x8')](util[_0x81e1('0x9')](_0x81e1('0xa'),_0x22369d,_0x5e560d[_0x81e1('0xb')],_0x31eb0d));}function handleFindAgent(_0xc0c8f){return function(_0x3a565c){return _0x3a565c['name']['toLowerCase']()===_0xc0c8f['toLowerCase']();};}exports['consequence']=function(_0x2e0ff5,_0x4e5d86,_0x4aa4aa,_0x56358f){return function(_0x2a01dc){try{var _0x2af651={'name':_0x4e5d86[0x0],'timeout':_0x4e5d86[0x1]};var _0x44f6d1=queue[_0x81e1('0x0')](_0x2af651,{'typecast':!![]});if(_0x44f6d1[_0x81e1('0xc')]){logger[_0x81e1('0xd')]('[%s][AGENT]\x20%s',_0x2e0ff5,_[_0x81e1('0xe')](_0x44f6d1,_0x81e1('0xf'))[_0x81e1('0x10')](',\x20'));_0x2a01dc['stop']();}else{var _0x11fe02=_[_0x81e1('0x11')](_0x4aa4aa[_0x81e1('0x12')],handleFindAgent(_0x2af651[_0x81e1('0xb')]));if(_0x11fe02){var _0x88f5de=(_0x2af651[_0x81e1('0x13')]||0xa)*0x3e8;var _0x391eea,_0x3c1a53;var _0x5b7c69=seqqueue[_0x81e1('0x14')](_0x88f5de);_0x5b7c69['id']=_0x2e0ff5;_0x5b7c69['atimeout']=_0x88f5de;_0x5b7c69[_0x81e1('0x15')]=_0x56358f[_0x81e1('0x15')];writeLog(_0x2e0ff5,_0x11fe02,util['format']('START:%s',_0x88f5de));_0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5]['on'](_0x81e1('0x17'),function(){logger['info'](_0x81e1('0x18'),_0x2e0ff5);clearTimeout(_0x3c1a53);_0x3c1a53=undefined;_0x5b7c69[_0x81e1('0x19')]();if(_0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5]){delete _0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5];}_0x2a01dc[_0x81e1('0x1a')]();});_0x4aa4aa['rules'][_0x2e0ff5]['on']('complete',function(){if(_0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5]){delete _0x4aa4aa[_0x81e1('0x16')][_0x2e0ff5];}});_0x3c1a53=setTimeout(function(){logger['info'](_0x81e1('0x1b'),_0x2e0ff5);clearTimeout(_0x3c1a53);_0x5b7c69[_0x81e1('0x19')]();_0x2a01dc[_0x81e1('0x1c')]();},_0x88f5de);strategy['agent'](_0x5b7c69,_0x11fe02,_0x4aa4aa,_0x56358f);}else{logger[_0x81e1('0xd')](_0x81e1('0x1d'),_0x2e0ff5,_0x2af651[_0x81e1('0xb')]);_0x2a01dc[_0x81e1('0x1a')]();}}}catch(_0x3322d7){console['log'](_0x3322d7);logger[_0x81e1('0xd')](_0x81e1('0x1e'),_0x2e0ff5,_0x3322d7['stack']);_0x2a01dc[_0x81e1('0x1a')]();}};}; \ No newline at end of file +var _0xa610=['createQueue','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','join','stop','find','agents','timeout'];(function(_0x57fa83,_0x40f86a){var _0x32df91=function(_0x2bf67b){while(--_0x2bf67b){_0x57fa83['push'](_0x57fa83['shift']());}};_0x32df91(++_0x40f86a);}(_0xa610,0x82));var _0x0a61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa610[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x0a61('0x0'));var _=require(_0x0a61('0x1'));var util=require(_0x0a61('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x0a61('0x3'))(_0x0a61('0x4'));var strategy=require(_0x0a61('0x5'));var queue=schema({'name':{'type':_0x0a61('0x6'),'required':!![],'message':_0x0a61('0x7')},'timeout':{'type':'number','message':_0x0a61('0x8')}});function writeLog(_0x45014e,_0x1a7b61,_0xbcb7b4){return logger[_0x0a61('0x9')](util[_0x0a61('0xa')](_0x0a61('0xb'),_0x45014e,_0x1a7b61[_0x0a61('0xc')],_0xbcb7b4));}function handleFindAgent(_0x1d5ce5){return function(_0x459a69){return _0x459a69['name']['toLowerCase']()===_0x1d5ce5[_0x0a61('0xd')]();};}exports[_0x0a61('0xe')]=function(_0x34cb58,_0x4a2d65,_0x41d652,_0x13840f){return function(_0x26ea64){try{var _0x3cd3b1={'name':_0x4a2d65[0x0],'timeout':_0x4a2d65[0x1]};var _0x39a218=queue['validate'](_0x3cd3b1,{'typecast':!![]});if(_0x39a218[_0x0a61('0xf')]){logger['error']('[%s][AGENT]\x20%s',_0x34cb58,_[_0x0a61('0x10')](_0x39a218,'message')[_0x0a61('0x11')](',\x20'));_0x26ea64[_0x0a61('0x12')]();}else{var _0x1833d0=_[_0x0a61('0x13')](_0x41d652[_0x0a61('0x14')],handleFindAgent(_0x3cd3b1[_0x0a61('0xc')]));if(_0x1833d0){var _0x50b0cb=(_0x3cd3b1[_0x0a61('0x15')]||0xa)*0x3e8;var _0x1cce3c,_0xe3e027;var _0x13b9bd=seqqueue[_0x0a61('0x16')](_0x50b0cb);_0x13b9bd['id']=_0x34cb58;_0x13b9bd['atimeout']=_0x50b0cb;_0x13b9bd[_0x0a61('0x17')]=_0x13840f['channel'];writeLog(_0x34cb58,_0x1833d0,util[_0x0a61('0xa')](_0x0a61('0x18'),_0x50b0cb));_0x41d652['rules'][_0x34cb58]['on'](_0x0a61('0x19'),function(){logger['info'](_0x0a61('0x1a'),_0x34cb58);clearTimeout(_0xe3e027);_0xe3e027=undefined;_0x13b9bd[_0x0a61('0x1b')]();if(_0x41d652[_0x0a61('0x1c')][_0x34cb58]){delete _0x41d652[_0x0a61('0x1c')][_0x34cb58];}_0x26ea64[_0x0a61('0x12')]();});_0x41d652[_0x0a61('0x1c')][_0x34cb58]['on'](_0x0a61('0x1d'),function(){if(_0x41d652[_0x0a61('0x1c')][_0x34cb58]){delete _0x41d652[_0x0a61('0x1c')][_0x34cb58];}});_0xe3e027=setTimeout(function(){logger['info'](_0x0a61('0x1e'),_0x34cb58);clearTimeout(_0xe3e027);_0x13b9bd[_0x0a61('0x1b')]();_0x26ea64[_0x0a61('0x1f')]();},_0x50b0cb);strategy[_0x0a61('0x20')](_0x13b9bd,_0x1833d0,_0x41d652,_0x13840f);}else{logger[_0x0a61('0x21')](_0x0a61('0x22'),_0x34cb58,_0x3cd3b1[_0x0a61('0xc')]);_0x26ea64[_0x0a61('0x12')]();}}}catch(_0x1b684e){console[_0x0a61('0x23')](_0x1b684e);logger[_0x0a61('0x21')](_0x0a61('0x24'),_0x34cb58,_0x1b684e[_0x0a61('0x25')]);_0x26ea64['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index ccb5c71..94b04be 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd92f=['next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','then','info','catch','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','amazonlex','message','providerName','stringify','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd92f,0x7c));var _0xfd92=function(_0x380cda,_0x3ed2e6){_0x380cda=_0x380cda-0x0;var _0x44ebb5=_0xd92f[_0x380cda];return _0x44ebb5;};'use strict';var _=require(_0xfd92('0x0'));var moment=require(_0xfd92('0x1'));var AWS=require(_0xfd92('0x2'));var utils=require(_0xfd92('0x3'));var logger=require('../../../../config/logger')(_0xfd92('0x4'));var rpc={'chatMessage':require(_0xfd92('0x5')),'openchannelMessage':require(_0xfd92('0x6')),'mailMessage':require(_0xfd92('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfd92('0x8')),'whatsappMessage':require(_0xfd92('0x9'))};exports['consequence']=function(_0x49e171,_0x13139f){return function(_0x1c1d43){try{if(!_[_0xfd92('0xa')](this[_0xfd92('0xb')][_0xfd92('0xc')])){logger['info'](_0xfd92('0xd'),_0x49e171,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1c1d43[_0xfd92('0xe')]();}var _0x3a77e3={'ContactId':this['contact']['id'],'sentAt':moment()[_0xfd92('0xf')](_0xfd92('0x10')),'direction':_0xfd92('0x11')};if(this['channel']==='sms'||this[_0xfd92('0x12')]===_0xfd92('0x13')){_0x3a77e3[_0xfd92('0x14')]=this['interaction'][_0xfd92('0x14')];}var _0x384621=this[_0xfd92('0x12')];if(_0x384621==='chat'){_0x3a77e3[_0xfd92('0x15')]=this[_0xfd92('0x16')]['id'];}else{_0x3a77e3[_[_0xfd92('0x17')](_0x384621)+_0xfd92('0x18')]=this[_0xfd92('0x16')]['id'];}_0x3a77e3[_[_0xfd92('0x17')](_0x384621)+_0xfd92('0x19')]=this[_0xfd92('0xb')]['id'];if(this['interaction'][_0xfd92('0x1a')]){var _0x209157=_0x13139f[0x4];if(!_['isEmpty'](_0x209157)){_0x3a77e3[_0xfd92('0x1b')]=utils[_0xfd92('0x1c')](_0x209157,this);return rpc[_0x384621+_0xfd92('0x1d')]['create'](_0x3a77e3)[_0xfd92('0x1e')](function(_0x1111f0){logger[_0xfd92('0x1f')](_0xfd92('0xd'),_0x49e171,_0x3a77e3['body']);})[_0xfd92('0x20')](function(_0xfaaf35){logger[_0xfd92('0x21')](_0xfd92('0xd'),_0x49e171,JSON['stringify'](_0xfaaf35));})[_0xfd92('0x22')](function(){logger[_0xfd92('0x1f')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x49e171);_0x1c1d43[_0xfd92('0x23')]();});}else{logger[_0xfd92('0x1f')](_0xfd92('0x24'),_0x49e171);_0x1c1d43[_0xfd92('0x23')]();}}else{var _0x452162=this;var _0x4af4da=new AWS[(_0xfd92('0x25'))]({'accessKeyId':_0x13139f[0x0],'secretAccessKey':_0x13139f[0x1],'region':_0x13139f[0x2]});var _0x57b1af={'botAlias':'$LATEST','botName':_0x13139f[0x3],'inputText':this['message'][_0xfd92('0x1b')],'userId':this[_0xfd92('0x12')]+':'+this[_0xfd92('0xb')]['id'][_0xfd92('0x26')]()};_0x4af4da['postText'](_0x57b1af,function(_0x3a9abb,_0x134031){if(_0x3a9abb){logger[_0xfd92('0x21')](_0xfd92('0xd'),_0x49e171,_0x3a9abb['message']);_0x1c1d43[_0xfd92('0xe')]();}else if(_0x134031&&_0x134031['message']){_0x452162['body'][_0xfd92('0x27')]=_0x134031;_0x3a77e3[_0xfd92('0x1b')]=_0x134031[_0xfd92('0x28')];_0x3a77e3[_0xfd92('0x29')]=_0xfd92('0x27');_0x3a77e3['providerResponse']=JSON[_0xfd92('0x2a')](_0x134031);return rpc[_0x384621+_0xfd92('0x1d')][_0xfd92('0x2b')](_0x3a77e3)['then'](function(_0x338892){logger['info'](_0xfd92('0xd'),_0x49e171,_0x3a77e3[_0xfd92('0x1b')]);if(_0x134031[_0xfd92('0x2c')]==_0xfd92('0x2d')){_0x1c1d43[_0xfd92('0xe')]();}else{_0x1c1d43[_0xfd92('0x23')]();}})[_0xfd92('0x20')](function(_0x4a1226){logger[_0xfd92('0x21')](_0xfd92('0xd'),_0x49e171,JSON[_0xfd92('0x2a')](_0x4a1226));_0x1c1d43[_0xfd92('0xe')]();});}else{_0x1c1d43['next']();}});}}catch(_0x3422d4){logger['error'](_0xfd92('0xd'),_0x49e171,JSON[_0xfd92('0x2a')](_0x3422d4));_0x1c1d43[_0xfd92('0x23')]();}};}; \ No newline at end of file +var _0x64c2=['catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','isEmpty','getMustacheRender','create','then','error','stringify','finally','stop','$LATEST','body','channel','toString','postText','message','amazonlex','providerResponse','dialogState','Failed'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x64c2,0xc5));var _0x264c=function(_0x3faa27,_0x378fc8){_0x3faa27=_0x3faa27-0x0;var _0x185ebf=_0x64c2[_0x3faa27];return _0x185ebf;};'use strict';var _=require(_0x264c('0x0'));var moment=require(_0x264c('0x1'));var AWS=require(_0x264c('0x2'));var utils=require(_0x264c('0x3'));var logger=require(_0x264c('0x4'))(_0x264c('0x5'));var rpc={'chatMessage':require(_0x264c('0x6')),'openchannelMessage':require(_0x264c('0x7')),'mailMessage':require(_0x264c('0x8')),'smsMessage':require(_0x264c('0x9')),'faxMessage':require(_0x264c('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x264c('0xb')]=function(_0x14da9c,_0x589426){return function(_0x23e03c){try{if(!_[_0x264c('0xc')](this['interaction']['UserId'])){logger[_0x264c('0xd')](_0x264c('0xe'),_0x14da9c,_0x264c('0xf'));return _0x23e03c[_0x264c('0x10')]();}var _0x2b290b={'ContactId':this[_0x264c('0x11')]['id'],'sentAt':moment()[_0x264c('0x12')](_0x264c('0x13')),'direction':_0x264c('0x14')};if(this['channel']===_0x264c('0x15')||this['channel']==='whatsapp'){_0x2b290b[_0x264c('0x16')]=this['interaction'][_0x264c('0x16')];}var _0x305d6a=this['channel'];if(_0x305d6a===_0x264c('0x17')){_0x2b290b[_0x264c('0x18')]=this[_0x264c('0x19')]['id'];}else{_0x2b290b[_[_0x264c('0x1a')](_0x305d6a)+_0x264c('0x1b')]=this[_0x264c('0x19')]['id'];}_0x2b290b[_[_0x264c('0x1a')](_0x305d6a)+_0x264c('0x1c')]=this[_0x264c('0x1d')]['id'];if(this[_0x264c('0x1d')]['created']){var _0x3ccb27=_0x589426[0x4];if(!_[_0x264c('0x1e')](_0x3ccb27)){_0x2b290b['body']=utils[_0x264c('0x1f')](_0x3ccb27,this);return rpc[_0x305d6a+'Message'][_0x264c('0x20')](_0x2b290b)[_0x264c('0x21')](function(_0x15a62a){logger['info'](_0x264c('0xe'),_0x14da9c,_0x2b290b['body']);})['catch'](function(_0xbf62f2){logger[_0x264c('0x22')](_0x264c('0xe'),_0x14da9c,JSON[_0x264c('0x23')](_0xbf62f2));})[_0x264c('0x24')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x14da9c);_0x23e03c[_0x264c('0x25')]();});}else{logger[_0x264c('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x14da9c);_0x23e03c[_0x264c('0x25')]();}}else{var _0x49c1a1=this;var _0x4f6790=new AWS['LexRuntime']({'accessKeyId':_0x589426[0x0],'secretAccessKey':_0x589426[0x1],'region':_0x589426[0x2]});var _0x213e73={'botAlias':_0x264c('0x26'),'botName':_0x589426[0x3],'inputText':this['message'][_0x264c('0x27')],'userId':this[_0x264c('0x28')]+':'+this[_0x264c('0x1d')]['id'][_0x264c('0x29')]()};_0x4f6790[_0x264c('0x2a')](_0x213e73,function(_0x58046f,_0x431288){if(_0x58046f){logger[_0x264c('0x22')](_0x264c('0xe'),_0x14da9c,_0x58046f[_0x264c('0x2b')]);_0x23e03c[_0x264c('0x10')]();}else if(_0x431288&&_0x431288[_0x264c('0x2b')]){_0x49c1a1[_0x264c('0x27')][_0x264c('0x2c')]=_0x431288;_0x2b290b[_0x264c('0x27')]=_0x431288[_0x264c('0x2b')];_0x2b290b['providerName']=_0x264c('0x2c');_0x2b290b[_0x264c('0x2d')]=JSON['stringify'](_0x431288);return rpc[_0x305d6a+'Message'][_0x264c('0x20')](_0x2b290b)[_0x264c('0x21')](function(_0x477293){logger['info'](_0x264c('0xe'),_0x14da9c,_0x2b290b[_0x264c('0x27')]);if(_0x431288[_0x264c('0x2e')]==_0x264c('0x2f')){_0x23e03c[_0x264c('0x10')]();}else{_0x23e03c[_0x264c('0x25')]();}})[_0x264c('0x30')](function(_0x5282fb){logger[_0x264c('0x22')](_0x264c('0xe'),_0x14da9c,JSON[_0x264c('0x23')](_0x5282fb));_0x23e03c['next']();});}else{_0x23e03c['next']();}});}}catch(_0x3c3a4c){logger['error'](_0x264c('0xe'),_0x14da9c,JSON[_0x264c('0x23')](_0x3c3a4c));_0x23e03c[_0x264c('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 52226e3..1d0c710 100644 --- a/server/services/routing/server/applications/autoreply.js +++ b/server/services/routing/server/applications/autoreply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a12=['getMustacheRender','message','from','phone','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','mail','Smtp','service','host','port','secure','authentication','auth','pass','inReplyTo','html','replace',''+_[_0x27a1('0x2f')](_0x455a8f[_0x27a1('0x17')],'';_0x455a8f[_0x27a1('0x31')]={'Auto-Submitted':_0x27a1('0x32'),'X-Auto-Response-Suppress':_0x27a1('0x33'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x21c37e,_0x455a8f)[_0x27a1('0x34')](function(_0x4c16cc){logger['info'](_0x27a1('0x35'),_0x2ccadb);_0x455a8f[_0x27a1('0x36')]=_0x4c16cc[_0x27a1('0x19')][_0x27a1('0x36')];return rpc[_0x56a122+_0x27a1('0x37')][_0x27a1('0x38')](_0x455a8f);})[_0x27a1('0x34')](function(_0x3b14d6){logger['info']('[%s][AUTOREPLY]\x20%s',_0x2ccadb,JSON['stringify'](_0x3b14d6));})[_0x27a1('0x39')](function(_0xcdbe1c){logger[_0x27a1('0x3a')](_0x27a1('0x3b'),_0x2ccadb,JSON['stringify'](_0xcdbe1c));})['finally'](function(){_0x4a4e2c[_0x27a1('0x11')]();});}else{return rpc[this[_0x27a1('0x12')]+_0x27a1('0x37')][_0x27a1('0x38')](_0x455a8f)[_0x27a1('0x34')](function(_0x6fe6c0){logger[_0x27a1('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x2ccadb,_0x455a8f['body']);})[_0x27a1('0x39')](function(_0x1b26a){logger[_0x27a1('0x3a')]('[%s][AUTOREPLY]\x20%s',_0x2ccadb,JSON[_0x27a1('0x3d')](_0x1b26a));})[_0x27a1('0x3e')](function(){_0x4a4e2c[_0x27a1('0x11')]();});}}}catch(_0x1358c8){logger['error'](_0x27a1('0xf'),_0x2ccadb,JSON[_0x27a1('0x3d')](_0x1358c8));_0x4a4e2c[_0x27a1('0x3f')]();}};}; \ No newline at end of file +var _0x8c8c=['secure','authentication','user','pass','inReplyTo','messageId','','replace','';_0x2fbfd6['headers']={'Auto-Submitted':_0xc8c8('0x30'),'X-Auto-Response-Suppress':_0xc8c8('0x31'),'Precedence':_0xc8c8('0x32')};return mailRpc[_0xc8c8('0x33')](_0x15371b,_0x2fbfd6)[_0xc8c8('0x34')](function(_0x15441e){logger[_0xc8c8('0xd')](_0xc8c8('0x35'),_0x5180ce);_0x2fbfd6[_0xc8c8('0x2b')]=_0x15441e[_0xc8c8('0x17')][_0xc8c8('0x2b')];return rpc[_0x1c6d9d+_0xc8c8('0x36')][_0xc8c8('0x37')](_0x2fbfd6);})[_0xc8c8('0x34')](function(_0x33616c){logger['info'](_0xc8c8('0xe'),_0x5180ce,JSON[_0xc8c8('0x38')](_0x33616c));})['catch'](function(_0x385413){logger[_0xc8c8('0x39')]('[RPC][%s][AUTOREPLY]\x20%s',_0x5180ce,JSON[_0xc8c8('0x38')](_0x385413));})[_0xc8c8('0x3a')](function(){_0x2bad6d[_0xc8c8('0xf')]();});}else{return rpc[this['channel']+'Message'][_0xc8c8('0x37')](_0x2fbfd6)[_0xc8c8('0x34')](function(_0x27d00b){logger[_0xc8c8('0xd')](_0xc8c8('0xe'),_0x5180ce,_0x2fbfd6[_0xc8c8('0x15')]);})[_0xc8c8('0x3b')](function(_0x505bc0){logger[_0xc8c8('0x39')](_0xc8c8('0xe'),_0x5180ce,JSON[_0xc8c8('0x38')](_0x505bc0));})['finally'](function(){_0x2bad6d[_0xc8c8('0xf')]();});}}}catch(_0x427e92){logger[_0xc8c8('0x39')](_0xc8c8('0xe'),_0x5180ce,JSON[_0xc8c8('0x38')](_0x427e92));_0x2bad6d[_0xc8c8('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 4a6539e..ea9de81 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1354=['finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x2e66e2,_0x305398){var _0x347108=function(_0xb3d8e9){while(--_0xb3d8e9){_0x2e66e2['push'](_0x2e66e2['shift']());}};_0x347108(++_0x305398);}(_0x1354,0x95));var _0x4135=function(_0x3f787e,_0x951303){_0x3f787e=_0x3f787e-0x0;var _0x26242d=_0x1354[_0x3f787e];return _0x26242d;};'use strict';var moment=require(_0x4135('0x0'));var logger=require(_0x4135('0x1'))(_0x4135('0x2'));var rpc={'chatInteraction':require(_0x4135('0x3')),'openchannelInteraction':require(_0x4135('0x4')),'smsInteraction':require(_0x4135('0x5')),'mailInteraction':require(_0x4135('0x6')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4135('0x7'))};exports[_0x4135('0x8')]=function(_0x202042,_0x4a8e27,_0x14ff47,_0x2bcd68){return function(_0x5e355d){try{logger[_0x4135('0x9')](_0x4135('0xa'),_0x202042,_0x4a8e27[0x0]);var _0x3e7ae3={'closed':0x1,'closedAt':moment()['format'](_0x4135('0xb')),'closeReason':'system','disposition':_0x4a8e27[0x0]};if(rpc[_0x2bcd68[_0x4135('0xc')]+_0x4135('0xd')]){rpc[_0x2bcd68[_0x4135('0xc')]+_0x4135('0xd')]['update'](_0x2bcd68[_0x4135('0xe')]['id'],_0x3e7ae3)['then'](function(_0x59e387){logger[_0x4135('0x9')](_0x4135('0xf'),_0x202042,_0x2bcd68[_0x4135('0xe')]['id']);})['catch'](function(_0x307e6f){logger[_0x4135('0x10')](_0x4135('0x11'),_0x202042,JSON[_0x4135('0x12')](_0x307e6f));})[_0x4135('0x13')](function(){_0x5e355d[_0x4135('0x14')]();});}}catch(_0x54f954){logger['error'](_0x4135('0x11'),_0x202042,JSON[_0x4135('0x12')](_0x54f954));_0x5e355d[_0x4135('0x14')]();}};}; \ No newline at end of file +var _0xcde7=['channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x548218,_0x53d838){var _0xff1adb=function(_0x2e02e0){while(--_0x2e02e0){_0x548218['push'](_0x548218['shift']());}};_0xff1adb(++_0x53d838);}(_0xcde7,0x65));var _0x7cde=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcde7[_0x19950b];return _0x3c6b41;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x7cde('0x0'));var rpc={'chatInteraction':require(_0x7cde('0x1')),'openchannelInteraction':require(_0x7cde('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x7cde('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x7cde('0x4')]=function(_0x5824bf,_0x18529,_0x293f70,_0xbaa4b3){return function(_0x15b9ec){try{logger['info'](_0x7cde('0x5'),_0x5824bf,_0x18529[0x0]);var _0x512fae={'closed':0x1,'closedAt':moment()[_0x7cde('0x6')](_0x7cde('0x7')),'closeReason':_0x7cde('0x8'),'disposition':_0x18529[0x0]};if(rpc[_0xbaa4b3[_0x7cde('0x9')]+'Interaction']){rpc[_0xbaa4b3[_0x7cde('0x9')]+_0x7cde('0xa')][_0x7cde('0xb')](_0xbaa4b3[_0x7cde('0xc')]['id'],_0x512fae)[_0x7cde('0xd')](function(_0xde5f38){logger[_0x7cde('0xe')](_0x7cde('0xf'),_0x5824bf,_0xbaa4b3[_0x7cde('0xc')]['id']);})[_0x7cde('0x10')](function(_0x5f127e){logger[_0x7cde('0x11')](_0x7cde('0x12'),_0x5824bf,JSON[_0x7cde('0x13')](_0x5f127e));})[_0x7cde('0x14')](function(){_0x15b9ec[_0x7cde('0x15')]();});}}catch(_0x27e8dc){logger[_0x7cde('0x11')](_0x7cde('0x12'),_0x5824bf,JSON[_0x7cde('0x13')](_0x27e8dc));_0x15b9ec['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 588f1f3..a404116 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfe9=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','providerName','endConversation','lodash','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x227126,_0x5b3514){var _0x456ded=function(_0x2b40f7){while(--_0x2b40f7){_0x227126['push'](_0x227126['shift']());}};_0x456ded(++_0x5b3514);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x37452b,_0x4c800e){_0x37452b=_0x37452b-0x0;var _0xedc13c=_0xdfe9[_0x37452b];return _0xedc13c;};'use strict';var _=require(_0x9dfe('0x0'));var moment=require('moment');var apiai=require(_0x9dfe('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x9dfe('0x2'))(_0x9dfe('0x3'));var rpc={'chatMessage':require(_0x9dfe('0x4')),'openchannelMessage':require(_0x9dfe('0x5')),'mailMessage':require(_0x9dfe('0x6')),'smsMessage':require(_0x9dfe('0x7')),'faxMessage':require(_0x9dfe('0x8')),'whatsappMessage':require(_0x9dfe('0x9'))};exports[_0x9dfe('0xa')]=function(_0x3471f0,_0x13b6f8){return function(_0x5e0faf){try{if(!_[_0x9dfe('0xb')](this[_0x9dfe('0xc')][_0x9dfe('0xd')])){logger[_0x9dfe('0xe')](_0x9dfe('0xf'),_0x3471f0,_0x9dfe('0x10'));return _0x5e0faf[_0x9dfe('0x11')]();}var _0xaed877={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9dfe('0x12')](_0x9dfe('0x13')),'direction':_0x9dfe('0x14')};if(this[_0x9dfe('0x15')]==='sms'||this['channel']===_0x9dfe('0x16')){_0xaed877[_0x9dfe('0x17')]=this['interaction']['phone'];}var _0x5d9256=this[_0x9dfe('0x15')];if(_0x5d9256===_0x9dfe('0x18')){_0xaed877[_0x9dfe('0x19')]=this[_0x9dfe('0x1a')]['id'];}else{_0xaed877[_[_0x9dfe('0x1b')](_0x5d9256)+_0x9dfe('0x1c')]=this[_0x9dfe('0x1a')]['id'];}_0xaed877[_[_0x9dfe('0x1b')](_0x5d9256)+_0x9dfe('0x1d')]=this['interaction']['id'];if(this['interaction'][_0x9dfe('0x1e')]){var _0x4be792=_0x13b6f8[0x2];if(!_[_0x9dfe('0x1f')](_0x4be792)){_0xaed877[_0x9dfe('0x20')]=utils[_0x9dfe('0x21')](_0x4be792,this);return rpc[_0x5d9256+_0x9dfe('0x22')][_0x9dfe('0x23')](_0xaed877)[_0x9dfe('0x24')](function(_0x5c7158){logger[_0x9dfe('0xe')](_0x9dfe('0xf'),_0x3471f0,_0xaed877[_0x9dfe('0x20')]);})[_0x9dfe('0x25')](function(_0x2ebbc4){logger[_0x9dfe('0x26')](_0x9dfe('0xf'),_0x3471f0,JSON[_0x9dfe('0x27')](_0x2ebbc4));})[_0x9dfe('0x28')](function(){logger[_0x9dfe('0xe')](_0x9dfe('0x29'),_0x3471f0);_0x5e0faf[_0x9dfe('0x2a')]();});}else{logger[_0x9dfe('0xe')](_0x9dfe('0x2b'),_0x3471f0);_0x5e0faf['stop']();}}else{var _0x484f22=this;var _0x35cb5c=apiai(_0x13b6f8[0x0],{'language':_0x13b6f8[0x1]||'en'});return _0x35cb5c[_0x9dfe('0x2c')](this[_0x9dfe('0x2d')][_0x9dfe('0x20')],{'sessionId':md5(this[_0x9dfe('0xc')]['id'])})[_0x9dfe('0x24')](function(_0x3354b7){_0x484f22[_0x9dfe('0x20')][_0x9dfe('0x2e')]=_0x3354b7;_0xaed877[_0x9dfe('0x20')]=_0x3354b7[_0x9dfe('0x2f')]['fulfillment']['speech'];_0xaed877[_0x9dfe('0x30')]=_0x9dfe('0x2e');_0xaed877['providerResponse']=JSON[_0x9dfe('0x27')](_0x3354b7);return rpc[_0x5d9256+_0x9dfe('0x22')][_0x9dfe('0x23')](_0xaed877)['then'](function(_0x2fba44){logger[_0x9dfe('0xe')](_0x9dfe('0xf'),_0x3471f0,_0xaed877[_0x9dfe('0x20')]);if(_0x3354b7[_0x9dfe('0x2f')]['metadata'][_0x9dfe('0x31')]){_0x5e0faf['next']();}else{_0x5e0faf[_0x9dfe('0x2a')]();}})[_0x9dfe('0x25')](function(_0x796981){logger[_0x9dfe('0x26')](_0x9dfe('0xf'),_0x3471f0,JSON[_0x9dfe('0x27')](_0x796981));_0x5e0faf[_0x9dfe('0x11')]();});})[_0x9dfe('0x25')](function(_0x4de29c){logger['error'](_0x9dfe('0xf'),_0x3471f0,_0x4de29c['message']);_0x5e0faf[_0x9dfe('0x11')]();});}}catch(_0x22e72f){logger[_0x9dfe('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x3471f0,JSON[_0x9dfe('0x27')](_0x22e72f));_0x5e0faf[_0x9dfe('0x2a')]();}};}; \ No newline at end of file +var _0x8ed3=['whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','Message','create','then','info','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','textRequest','message','dialogflow','result','fulfillment','providerResponse','metadata','endConversation','stop','stringify','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8ed3,0x1d4));var _0x38ed=function(_0x33dde6,_0x2c422a){_0x33dde6=_0x33dde6-0x0;var _0x5610d0=_0x8ed3[_0x33dde6];return _0x5610d0;};'use strict';var _=require(_0x38ed('0x0'));var moment=require(_0x38ed('0x1'));var apiai=require('apiai-promise');var md5=require(_0x38ed('0x2'));var utils=require(_0x38ed('0x3'));var logger=require(_0x38ed('0x4'))(_0x38ed('0x5'));var rpc={'chatMessage':require(_0x38ed('0x6')),'openchannelMessage':require(_0x38ed('0x7')),'mailMessage':require(_0x38ed('0x8')),'smsMessage':require(_0x38ed('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x38ed('0xa'))};exports[_0x38ed('0xb')]=function(_0x217547,_0x490acd){return function(_0x666c87){try{if(!_[_0x38ed('0xc')](this[_0x38ed('0xd')]['UserId'])){logger['info'](_0x38ed('0xe'),_0x217547,_0x38ed('0xf'));return _0x666c87[_0x38ed('0x10')]();}var _0x26c216={'ContactId':this[_0x38ed('0x11')]['id'],'sentAt':moment()[_0x38ed('0x12')](_0x38ed('0x13')),'direction':'out'};if(this['channel']===_0x38ed('0x14')||this[_0x38ed('0x15')]===_0x38ed('0x16')){_0x26c216[_0x38ed('0x17')]=this[_0x38ed('0xd')][_0x38ed('0x17')];}var _0x4e8dbb=this[_0x38ed('0x15')];if(_0x4e8dbb==='chat'){_0x26c216[_0x38ed('0x18')]=this['account']['id'];}else{_0x26c216[_[_0x38ed('0x19')](_0x4e8dbb)+_0x38ed('0x1a')]=this[_0x38ed('0x1b')]['id'];}_0x26c216[_[_0x38ed('0x19')](_0x4e8dbb)+_0x38ed('0x1c')]=this[_0x38ed('0xd')]['id'];if(this[_0x38ed('0xd')][_0x38ed('0x1d')]){var _0x25bda5=_0x490acd[0x2];if(!_['isEmpty'](_0x25bda5)){_0x26c216[_0x38ed('0x1e')]=utils['getMustacheRender'](_0x25bda5,this);return rpc[_0x4e8dbb+_0x38ed('0x1f')][_0x38ed('0x20')](_0x26c216)[_0x38ed('0x21')](function(_0x273d53){logger[_0x38ed('0x22')](_0x38ed('0xe'),_0x217547,_0x26c216[_0x38ed('0x1e')]);})[_0x38ed('0x23')](function(_0x158a54){logger[_0x38ed('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x217547,JSON['stringify'](_0x158a54));})[_0x38ed('0x25')](function(){logger[_0x38ed('0x22')](_0x38ed('0x26'),_0x217547);_0x666c87['stop']();});}else{logger[_0x38ed('0x22')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x217547);_0x666c87['stop']();}}else{var _0xea7451=this;var _0x1d47c7=apiai(_0x490acd[0x0],{'language':_0x490acd[0x1]||'en'});return _0x1d47c7[_0x38ed('0x27')](this[_0x38ed('0x28')]['body'],{'sessionId':md5(this[_0x38ed('0xd')]['id'])})[_0x38ed('0x21')](function(_0x47e64b){_0xea7451[_0x38ed('0x1e')][_0x38ed('0x29')]=_0x47e64b;_0x26c216[_0x38ed('0x1e')]=_0x47e64b[_0x38ed('0x2a')][_0x38ed('0x2b')]['speech'];_0x26c216['providerName']=_0x38ed('0x29');_0x26c216[_0x38ed('0x2c')]=JSON['stringify'](_0x47e64b);return rpc[_0x4e8dbb+_0x38ed('0x1f')][_0x38ed('0x20')](_0x26c216)['then'](function(_0x2fd7f6){logger[_0x38ed('0x22')](_0x38ed('0xe'),_0x217547,_0x26c216[_0x38ed('0x1e')]);if(_0x47e64b[_0x38ed('0x2a')][_0x38ed('0x2d')][_0x38ed('0x2e')]){_0x666c87[_0x38ed('0x10')]();}else{_0x666c87[_0x38ed('0x2f')]();}})['catch'](function(_0x2f06f9){logger['error'](_0x38ed('0xe'),_0x217547,JSON[_0x38ed('0x30')](_0x2f06f9));_0x666c87[_0x38ed('0x10')]();});})['catch'](function(_0xc15955){logger[_0x38ed('0x24')](_0x38ed('0xe'),_0x217547,_0xc15955['message']);_0x666c87[_0x38ed('0x10')]();});}}catch(_0x151a57){logger[_0x38ed('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x217547,JSON[_0x38ed('0x30')](_0x151a57));_0x666c87[_0x38ed('0x2f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index e3267fb..485a3e0 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6b1=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','then','stringify','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','length','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','lodash','dialogflow','md5','moment','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x5a00d8,_0x1063dc){var _0x354ca2=function(_0x1edd6f){while(--_0x1edd6f){_0x5a00d8['push'](_0x5a00d8['shift']());}};_0x354ca2(++_0x1063dc);}(_0xd6b1,0x10f));var _0x1d6b=function(_0x658401,_0x1af24e){_0x658401=_0x658401-0x0;var _0x1318a6=_0xd6b1[_0x658401];return _0x1318a6;};'use strict';var _=require(_0x1d6b('0x0'));var dialogflow=require(_0x1d6b('0x1'));var md5=require(_0x1d6b('0x2'));var moment=require(_0x1d6b('0x3'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x1d6b('0x4'));var utils=require(_0x1d6b('0x5'));var rpc={'chatMessage':require(_0x1d6b('0x6')),'openchannelMessage':require(_0x1d6b('0x7')),'mailMessage':require(_0x1d6b('0x8')),'smsMessage':require(_0x1d6b('0x9')),'faxMessage':require(_0x1d6b('0xa')),'whatsappMessage':require(_0x1d6b('0xb'))};function createMessage(_0x1bc4b5,_0x75869f,_0x26feb5,_0x15fe70){return new Promise(function(_0x353d70,_0x769459){var _0x4885b7=_[_0x1d6b('0xc')](_0x26feb5);_0x4885b7[_0x1d6b('0xd')]=_0x15fe70;return rpc[_0x75869f+'Message'][_0x1d6b('0xe')](_0x4885b7)['then'](function(){logger[_0x1d6b('0xf')](_0x1d6b('0x10'),_0x1bc4b5,_0x4885b7[_0x1d6b('0xd')]);_0x353d70();})[_0x1d6b('0x11')](function(_0x14c3ca){logger[_0x1d6b('0x12')](_0x1d6b('0x10'),_0x1bc4b5,JSON['stringify'](_0x14c3ca));_0x769459(_0x14c3ca);});});}exports['consequence']=function(_0x297f22,_0x28a2cb){return function(_0x3e98d7){try{if(!_['isNil'](this[_0x1d6b('0x13')]['UserId'])){logger['info'](_0x1d6b('0x10'),_0x297f22,_0x1d6b('0x14'));return _0x3e98d7[_0x1d6b('0x15')]();}var _0x45a5cc={'ContactId':this[_0x1d6b('0x16')]['id'],'sentAt':moment()['format'](_0x1d6b('0x17')),'direction':_0x1d6b('0x18')};if(this[_0x1d6b('0x19')]===_0x1d6b('0x1a')||this['channel']===_0x1d6b('0x1b')){_0x45a5cc[_0x1d6b('0x1c')]=this[_0x1d6b('0x13')]['phone'];}var _0x416fe8=this[_0x1d6b('0x19')];if(_0x416fe8===_0x1d6b('0x1d')){_0x45a5cc[_0x1d6b('0x1e')]=this[_0x1d6b('0x1f')]['id'];}else{_0x45a5cc[_[_0x1d6b('0x20')](_0x416fe8)+_0x1d6b('0x21')]=this['account']['id'];}_0x45a5cc[_[_0x1d6b('0x20')](_0x416fe8)+_0x1d6b('0x22')]=this[_0x1d6b('0x13')]['id'];if(this[_0x1d6b('0x13')][_0x1d6b('0x23')]){var _0x89bbe9=_0x28a2cb[0x4];if(!_['isEmpty'](_0x89bbe9)){_0x45a5cc[_0x1d6b('0xd')]=utils[_0x1d6b('0x24')](_0x89bbe9,this);return rpc[_0x416fe8+'Message'][_0x1d6b('0xe')](_0x45a5cc)[_0x1d6b('0x25')](function(_0xd90a35){logger['info'](_0x1d6b('0x10'),_0x297f22,_0x45a5cc['body']);})[_0x1d6b('0x11')](function(_0x5adf1b){logger[_0x1d6b('0x12')](_0x1d6b('0x10'),_0x297f22,JSON[_0x1d6b('0x26')](_0x5adf1b));})[_0x1d6b('0x27')](function(){logger[_0x1d6b('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x297f22);_0x3e98d7[_0x1d6b('0x28')]();});}else{logger['info'](_0x1d6b('0x29'),_0x297f22);_0x3e98d7['stop']();}}else{var _0x4a1ac9=this;var _0x5057b3=_0x28a2cb[0x2][_0x1d6b('0x2a')](/\\n/g,'\x0a');var _0xb3de30={'credentials':{'private_key':_0x5057b3,'client_email':_0x28a2cb[0x1]}};var _0x167503=new dialogflow[(_0x1d6b('0x2b'))](_0xb3de30);var _0x39d9ad=_0x167503['sessionPath'](_0x28a2cb[0x0],md5(_0x4a1ac9[_0x1d6b('0x13')]['id']));var _0x243834={'session':_0x39d9ad,'queryInput':{'text':{'text':_0x4a1ac9[_0x1d6b('0x2c')][_0x1d6b('0xd')],'languageCode':_0x28a2cb[0x3]||'en'}}};return _0x167503[_0x1d6b('0x2d')](_0x243834)[_0x1d6b('0x25')](function(_0x46c48b){if(_0x46c48b&&_0x46c48b[_0x1d6b('0x2e')]){_0x4a1ac9[_0x1d6b('0xd')]['dialogflowV2']=_0x46c48b;var _0x594b69=_0x46c48b[0x0];var _0x15508c=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')]&&_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')]['fields']?_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')][_0x1d6b('0x31')]['end_conversation'][_0x1d6b('0x32')]:![];_0x4a1ac9[_0x1d6b('0xd')]['DIALOGFLOWV2_ACTION']=_0x594b69[_0x1d6b('0x2f')]['action'];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x33')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x34')];_0x4a1ac9[_0x1d6b('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x594b69['queryResult']['diagnosticInfo']&&_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')][_0x1d6b('0x31')]?_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x30')]['fields'][_0x1d6b('0x35')][_0x1d6b('0x32')]:![];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x36')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x37')]['name'];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x38')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x37')][_0x1d6b('0x39')];_0x4a1ac9['body'][_0x1d6b('0x3a')]=_0x594b69[_0x1d6b('0x2f')]['intent'][_0x1d6b('0x3b')];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x3c')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x3d')];_0x4a1ac9[_0x1d6b('0xd')][_0x1d6b('0x3e')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x3f')];_0x4a1ac9['body'][_0x1d6b('0x40')]=_0x594b69[_0x1d6b('0x2f')][_0x1d6b('0x41')];_0x45a5cc['providerName']='dialogflowV2';_0x45a5cc[_0x1d6b('0x42')]=JSON[_0x1d6b('0x26')](_0x46c48b);var _0x2a9fc1=[];for(var _0x272c9e=0x0;_0x272c9e<_0x46c48b[_0x1d6b('0x2e')];_0x272c9e++){var _0x26bf52=_0x46c48b[_0x272c9e];if(_0x26bf52&&_0x26bf52['queryResult']&&_0x26bf52[_0x1d6b('0x2f')][_0x1d6b('0x43')]){_0x2a9fc1[_0x1d6b('0x44')](createMessage(_0x297f22,_0x416fe8,_0x45a5cc,_0x26bf52[_0x1d6b('0x2f')]['fulfillmentText']));}}return Promise[_0x1d6b('0x45')](_0x2a9fc1)[_0x1d6b('0x25')](function(){if(_0x15508c){_0x3e98d7[_0x1d6b('0x15')]();}else{_0x3e98d7[_0x1d6b('0x28')]();}})[_0x1d6b('0x11')](function(_0x2d654b){logger[_0x1d6b('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x297f22,JSON[_0x1d6b('0x26')](_0x2d654b));_0x3e98d7[_0x1d6b('0x15')]();});}})[_0x1d6b('0x11')](function(_0x45c833){logger['error'](_0x1d6b('0x10'),_0x297f22,_0x45c833['message']);_0x3e98d7[_0x1d6b('0x15')]();});}}catch(_0x205805){logger['error'](_0x1d6b('0x10'),_0x297f22,JSON['stringify'](_0x205805));_0x3e98d7[_0x1d6b('0x28')]();}};}; \ No newline at end of file +var _0xecb6=['detectIntent','length','dialogflowV2','queryResult','fields','diagnosticInfo','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','boolValue','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','providerResponse','fulfillmentText','push','all','next','stop','message','lodash','dialogflow','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath'];(function(_0x2921fe,_0x3cbff2){var _0x506707=function(_0x12089e){while(--_0x12089e){_0x2921fe['push'](_0x2921fe['shift']());}};_0x506707(++_0x3cbff2);}(_0xecb6,0xaa));var _0x6ecb=function(_0x3dc686,_0x12d9bb){_0x3dc686=_0x3dc686-0x0;var _0x45a816=_0xecb6[_0x3dc686];return _0x45a816;};'use strict';var _=require(_0x6ecb('0x0'));var dialogflow=require(_0x6ecb('0x1'));var md5=require('md5');var moment=require(_0x6ecb('0x2'));var Promise=require(_0x6ecb('0x3'));var logger=require(_0x6ecb('0x4'))('routing');var utils=require(_0x6ecb('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6ecb('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6ecb('0x7')),'faxMessage':require(_0x6ecb('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x33c244,_0x837f09,_0x40580f,_0x3b3ce9){return new Promise(function(_0x261cc1,_0x50b268){var _0xfe6d18=_[_0x6ecb('0x9')](_0x40580f);_0xfe6d18[_0x6ecb('0xa')]=_0x3b3ce9;return rpc[_0x837f09+_0x6ecb('0xb')][_0x6ecb('0xc')](_0xfe6d18)[_0x6ecb('0xd')](function(){logger[_0x6ecb('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x33c244,_0xfe6d18[_0x6ecb('0xa')]);_0x261cc1();})[_0x6ecb('0xf')](function(_0x57e3dc){logger[_0x6ecb('0x10')](_0x6ecb('0x11'),_0x33c244,JSON[_0x6ecb('0x12')](_0x57e3dc));_0x50b268(_0x57e3dc);});});}exports[_0x6ecb('0x13')]=function(_0x5dc9b6,_0x19f8f5){return function(_0x106aa6){try{if(!_[_0x6ecb('0x14')](this[_0x6ecb('0x15')][_0x6ecb('0x16')])){logger[_0x6ecb('0xe')](_0x6ecb('0x11'),_0x5dc9b6,_0x6ecb('0x17'));return _0x106aa6['next']();}var _0x4d544f={'ContactId':this[_0x6ecb('0x18')]['id'],'sentAt':moment()['format'](_0x6ecb('0x19')),'direction':_0x6ecb('0x1a')};if(this[_0x6ecb('0x1b')]===_0x6ecb('0x1c')||this[_0x6ecb('0x1b')]===_0x6ecb('0x1d')){_0x4d544f[_0x6ecb('0x1e')]=this[_0x6ecb('0x15')][_0x6ecb('0x1e')];}var _0x37c90e=this[_0x6ecb('0x1b')];if(_0x37c90e==='chat'){_0x4d544f[_0x6ecb('0x1f')]=this[_0x6ecb('0x20')]['id'];}else{_0x4d544f[_[_0x6ecb('0x21')](_0x37c90e)+_0x6ecb('0x22')]=this[_0x6ecb('0x20')]['id'];}_0x4d544f[_[_0x6ecb('0x21')](_0x37c90e)+_0x6ecb('0x23')]=this[_0x6ecb('0x15')]['id'];if(this[_0x6ecb('0x15')][_0x6ecb('0x24')]){var _0x3e4dcb=_0x19f8f5[0x4];if(!_['isEmpty'](_0x3e4dcb)){_0x4d544f[_0x6ecb('0xa')]=utils[_0x6ecb('0x25')](_0x3e4dcb,this);return rpc[_0x37c90e+_0x6ecb('0xb')][_0x6ecb('0xc')](_0x4d544f)['then'](function(_0x3f929a){logger[_0x6ecb('0xe')](_0x6ecb('0x11'),_0x5dc9b6,_0x4d544f[_0x6ecb('0xa')]);})[_0x6ecb('0xf')](function(_0x750d2e){logger['error'](_0x6ecb('0x11'),_0x5dc9b6,JSON[_0x6ecb('0x12')](_0x750d2e));})[_0x6ecb('0x26')](function(){logger['info'](_0x6ecb('0x27'),_0x5dc9b6);_0x106aa6['stop']();});}else{logger['info'](_0x6ecb('0x28'),_0x5dc9b6);_0x106aa6['stop']();}}else{var _0x8f0652=this;var _0x3b5232=_0x19f8f5[0x2]['replace'](/\\n/g,'\x0a');var _0x29367d={'credentials':{'private_key':_0x3b5232,'client_email':_0x19f8f5[0x1]}};var _0x117e10=new dialogflow[(_0x6ecb('0x29'))](_0x29367d);var _0x3995cb=_0x117e10[_0x6ecb('0x2a')](_0x19f8f5[0x0],md5(_0x8f0652['interaction']['id']));var _0x5304be={'session':_0x3995cb,'queryInput':{'text':{'text':_0x8f0652['message'][_0x6ecb('0xa')],'languageCode':_0x19f8f5[0x3]||'en'}}};return _0x117e10[_0x6ecb('0x2b')](_0x5304be)[_0x6ecb('0xd')](function(_0x45d3ba){if(_0x45d3ba&&_0x45d3ba[_0x6ecb('0x2c')]){_0x8f0652['body'][_0x6ecb('0x2d')]=_0x45d3ba;var _0x54cd0b=_0x45d3ba[0x0];var _0x29881f=_0x54cd0b[_0x6ecb('0x2e')]['diagnosticInfo']&&_0x54cd0b['queryResult']['diagnosticInfo'][_0x6ecb('0x2f')]?_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x30')][_0x6ecb('0x2f')]['end_conversation']['boolValue']:![];_0x8f0652['body'][_0x6ecb('0x31')]=_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x32')];_0x8f0652[_0x6ecb('0xa')][_0x6ecb('0x33')]=_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x34')];_0x8f0652[_0x6ecb('0xa')][_0x6ecb('0x35')]=_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x30')]&&_0x54cd0b['queryResult']['diagnosticInfo'][_0x6ecb('0x2f')]?_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x30')][_0x6ecb('0x2f')][_0x6ecb('0x36')][_0x6ecb('0x37')]:![];_0x8f0652[_0x6ecb('0xa')]['DIALOGFLOWV2_INTENTNAME']=_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x38')][_0x6ecb('0x39')];_0x8f0652[_0x6ecb('0xa')][_0x6ecb('0x3a')]=_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x38')]['displayName'];_0x8f0652[_0x6ecb('0xa')][_0x6ecb('0x3b')]=_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x38')][_0x6ecb('0x3c')];_0x8f0652[_0x6ecb('0xa')][_0x6ecb('0x3d')]=_0x54cd0b['queryResult']['languageCode'];_0x8f0652[_0x6ecb('0xa')]['DIALOGFLOWV2_QUERYTEXT']=_0x54cd0b[_0x6ecb('0x2e')][_0x6ecb('0x3e')];_0x8f0652['body'][_0x6ecb('0x3f')]=_0x54cd0b[_0x6ecb('0x2e')]['intentDetectionConfidence'];_0x4d544f['providerName']=_0x6ecb('0x2d');_0x4d544f[_0x6ecb('0x40')]=JSON['stringify'](_0x45d3ba);var _0x376d9c=[];for(var _0xa7d86c=0x0;_0xa7d86c<_0x45d3ba[_0x6ecb('0x2c')];_0xa7d86c++){var _0x165a56=_0x45d3ba[_0xa7d86c];if(_0x165a56&&_0x165a56[_0x6ecb('0x2e')]&&_0x165a56[_0x6ecb('0x2e')][_0x6ecb('0x41')]){_0x376d9c[_0x6ecb('0x42')](createMessage(_0x5dc9b6,_0x37c90e,_0x4d544f,_0x165a56[_0x6ecb('0x2e')][_0x6ecb('0x41')]));}}return Promise[_0x6ecb('0x43')](_0x376d9c)[_0x6ecb('0xd')](function(){if(_0x29881f){_0x106aa6[_0x6ecb('0x44')]();}else{_0x106aa6[_0x6ecb('0x45')]();}})[_0x6ecb('0xf')](function(_0x550941){logger[_0x6ecb('0x10')](_0x6ecb('0x11'),_0x5dc9b6,JSON['stringify'](_0x550941));_0x106aa6[_0x6ecb('0x44')]();});}})[_0x6ecb('0xf')](function(_0x4e1012){logger['error'](_0x6ecb('0x11'),_0x5dc9b6,_0x4e1012[_0x6ecb('0x46')]);_0x106aa6[_0x6ecb('0x44')]();});}}catch(_0x51440e){logger['error'](_0x6ecb('0x11'),_0x5dc9b6,JSON[_0x6ecb('0x12')](_0x51440e));_0x106aa6[_0x6ecb('0x45')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 427bf16..a461ac2 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14e2=['replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x14e2,0xdb));var _0x214e=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x14e2[_0x128450];return _0x4d80ed;};'use strict';var schema=require('validate');var _=require(_0x214e('0x0'));var htmlToText=require(_0x214e('0x1'));var utils=require(_0x214e('0x2'));var logger=require(_0x214e('0x3'))(_0x214e('0x4'));var gotoif=schema({'condition':{'type':_0x214e('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x214e('0x6')},'priorityFalse':{'type':_0x214e('0x7'),'message':_0x214e('0x8')}});exports[_0x214e('0x9')]=function(_0x52f20c,_0x5b8963){return function(_0x43d2a9){try{var _0x477866={'condition':htmlToText[_0x214e('0xa')](utils[_0x214e('0xb')](_0x5b8963[0x0],this),{'wordwrap':![]})[_0x214e('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5b8963[0x1],'priorityFalse':_0x5b8963[0x2]};var _0x36d5d5=gotoif[_0x214e('0xd')](_0x477866,{'typecast':!![]});if(_0x36d5d5[_0x214e('0xe')]){logger[_0x214e('0xf')](_0x214e('0x10'),_0x52f20c,_[_0x214e('0x11')](_0x36d5d5,_0x214e('0x12'))[_0x214e('0x13')](',\x20'));_0x43d2a9['stop']();}else{try{var _0x44ada0=eval('('+_0x477866[_0x214e('0x14')]+')');var _0x4f4630=_0x44ada0?_0x477866[_0x214e('0x15')]:_0x477866[_0x214e('0x16')];logger[_0x214e('0x17')](_0x214e('0x18'),_0x52f20c,_0x477866[_0x214e('0x14')],_0x44ada0,_0x4f4630||_0x214e('0x19'));if(_0x4f4630){var _0x1f2d9b=_[_0x214e('0x1a')](_0x43d2a9[_0x214e('0x1b')](),{'p':_0x4f4630});if(_0x1f2d9b>=0x0){logger[_0x214e('0x17')](_0x214e('0x1c'),_0x52f20c,_0x4f4630||'next',_0x1f2d9b);_0x43d2a9[_0x214e('0x19')](_0x1f2d9b);}else{logger['info'](_0x214e('0x1d'),_0x52f20c,_0x4f4630||_0x214e('0x19'));_0x43d2a9[_0x214e('0x1e')]();}}else{_0x43d2a9[_0x214e('0x19')]();}}catch(_0xd6193b){logger[_0x214e('0xf')](_0x214e('0x1f'),_0x52f20c,_0xd6193b['message']);_0x43d2a9['stop']();}}}catch(_0x413296){logger[_0x214e('0xf')]('[%s][GOTOIF]\x20%s',_0x52f20c,JSON[_0x214e('0x20')](_0x413296));_0x43d2a9['stop']();}};}; \ No newline at end of file +var _0xf3be=['html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate'];(function(_0x5e8d8b,_0x3defdb){var _0xc38051=function(_0x12dca7){while(--_0x12dca7){_0x5e8d8b['push'](_0x5e8d8b['shift']());}};_0xc38051(++_0x3defdb);}(_0xf3be,0xe7));var _0xef3b=function(_0x29613c,_0x10fa68){_0x29613c=_0x29613c-0x0;var _0x188189=_0xf3be[_0x29613c];return _0x188189;};'use strict';var schema=require(_0xef3b('0x0'));var _=require('lodash');var htmlToText=require(_0xef3b('0x1'));var utils=require(_0xef3b('0x2'));var logger=require(_0xef3b('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xef3b('0x4'),'required':!![],'message':_0xef3b('0x5')},'priorityTrue':{'type':_0xef3b('0x6'),'message':_0xef3b('0x7')},'priorityFalse':{'type':'number','message':_0xef3b('0x8')}});exports[_0xef3b('0x9')]=function(_0x3157e9,_0x8d4735){return function(_0x344761){try{var _0x2d2e8d={'condition':htmlToText[_0xef3b('0xa')](utils[_0xef3b('0xb')](_0x8d4735[0x0],this),{'wordwrap':![]})[_0xef3b('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x8d4735[0x1],'priorityFalse':_0x8d4735[0x2]};var _0x59ea33=gotoif[_0xef3b('0x0')](_0x2d2e8d,{'typecast':!![]});if(_0x59ea33[_0xef3b('0xd')]){logger[_0xef3b('0xe')](_0xef3b('0xf'),_0x3157e9,_['map'](_0x59ea33,_0xef3b('0x10'))[_0xef3b('0x11')](',\x20'));_0x344761[_0xef3b('0x12')]();}else{try{var _0x3c6749=eval('('+_0x2d2e8d['condition']+')');var _0x1e18cd=_0x3c6749?_0x2d2e8d[_0xef3b('0x13')]:_0x2d2e8d[_0xef3b('0x14')];logger[_0xef3b('0x15')](_0xef3b('0x16'),_0x3157e9,_0x2d2e8d['condition'],_0x3c6749,_0x1e18cd||_0xef3b('0x17'));if(_0x1e18cd){var _0x591208=_['findIndex'](_0x344761[_0xef3b('0x18')](),{'p':_0x1e18cd});if(_0x591208>=0x0){logger[_0xef3b('0x15')](_0xef3b('0x19'),_0x3157e9,_0x1e18cd||_0xef3b('0x17'),_0x591208);_0x344761[_0xef3b('0x17')](_0x591208);}else{logger[_0xef3b('0x15')](_0xef3b('0x1a'),_0x3157e9,_0x1e18cd||_0xef3b('0x17'));_0x344761[_0xef3b('0x12')]();}}else{_0x344761[_0xef3b('0x17')]();}}catch(_0x3cd630){logger[_0xef3b('0xe')](_0xef3b('0x1b'),_0x3157e9,_0x3cd630[_0xef3b('0x10')]);_0x344761[_0xef3b('0x12')]();}}}catch(_0x35e770){logger['error'](_0xef3b('0xf'),_0x3157e9,JSON[_0xef3b('0x1c')](_0x35e770));_0x344761[_0xef3b('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 6df35df..a3910f5 100644 --- a/server/services/routing/server/applications/gotop.js +++ b/server/services/routing/server/applications/gotop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b35=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','consequence','length','error','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0xda1001,_0x50c948){var _0x1b6534=function(_0x3b58ea){while(--_0x3b58ea){_0xda1001['push'](_0xda1001['shift']());}};_0x1b6534(++_0x50c948);}(_0x4b35,0xcd));var _0x54b3=function(_0xb61065,_0x159992){_0xb61065=_0xb61065-0x0;var _0x3f3fcb=_0x4b35[_0xb61065];return _0x3f3fcb;};'use strict';var schema=require(_0x54b3('0x0'));var _=require(_0x54b3('0x1'));var logger=require('../../../../config/logger')(_0x54b3('0x2'));var gotop=schema({'priority':{'type':_0x54b3('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x54b3('0x4')]=function(_0x491335,_0x15dd75){return function(_0x494add){try{var _0x37154e={'priority':_0x15dd75[0x0]};var _0x464614=gotop['validate'](_0x37154e,{'typecast':!![]});if(_0x464614[_0x54b3('0x5')]){logger[_0x54b3('0x6')]('[%s][GOTOP]\x20%s',_0x491335,_[_0x54b3('0x7')](_0x464614,_0x54b3('0x8'))[_0x54b3('0x9')](',\x20'));_0x494add[_0x54b3('0xa')]();}else{logger[_0x54b3('0xb')](_0x54b3('0xc'),_0x491335,_0x37154e[_0x54b3('0xd')]);if(_0x37154e[_0x54b3('0xd')]){var _0x469e65=_[_0x54b3('0xe')](_0x494add[_0x54b3('0xf')](),{'p':_0x37154e[_0x54b3('0xd')]});if(_0x469e65>=0x0){logger['info'](_0x54b3('0x10'),_0x491335,_0x37154e[_0x54b3('0xd')]||_0x54b3('0x11'),_0x469e65);_0x494add[_0x54b3('0x11')](_0x469e65);}else{logger[_0x54b3('0xb')](_0x54b3('0x12'),_0x491335,_0x37154e[_0x54b3('0xd')]||_0x54b3('0x11'));_0x494add[_0x54b3('0xa')]();}}else{_0x494add['next']();}}}catch(_0x1886e6){logger[_0x54b3('0x6')]('[%s][GOTOP]\x20%s',_0x491335,JSON[_0x54b3('0x13')](_0x1886e6));_0x494add[_0x54b3('0xa')]();}};}; \ No newline at end of file +var _0xca01=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','stop','info'];(function(_0x4ec7a0,_0x36d7b9){var _0xa74dae=function(_0x1312e9){while(--_0x1312e9){_0x4ec7a0['push'](_0x4ec7a0['shift']());}};_0xa74dae(++_0x36d7b9);}(_0xca01,0x182));var _0x1ca0=function(_0x26dec8,_0x5761af){_0x26dec8=_0x26dec8-0x0;var _0x33ac92=_0xca01[_0x26dec8];return _0x33ac92;};'use strict';var schema=require('validate');var _=require(_0x1ca0('0x0'));var logger=require(_0x1ca0('0x1'))(_0x1ca0('0x2'));var gotop=schema({'priority':{'type':_0x1ca0('0x3'),'required':!![],'message':_0x1ca0('0x4')}});exports[_0x1ca0('0x5')]=function(_0x2db802,_0x2264d9){return function(_0x33b7e0){try{var _0x3fafe5={'priority':_0x2264d9[0x0]};var _0x3be9b3=gotop[_0x1ca0('0x6')](_0x3fafe5,{'typecast':!![]});if(_0x3be9b3[_0x1ca0('0x7')]){logger[_0x1ca0('0x8')](_0x1ca0('0x9'),_0x2db802,_[_0x1ca0('0xa')](_0x3be9b3,_0x1ca0('0xb'))['join'](',\x20'));_0x33b7e0[_0x1ca0('0xc')]();}else{logger[_0x1ca0('0xd')](_0x1ca0('0xe'),_0x2db802,_0x3fafe5['priority']);if(_0x3fafe5[_0x1ca0('0xf')]){var _0x10a409=_[_0x1ca0('0x10')](_0x33b7e0[_0x1ca0('0x11')](),{'p':_0x3fafe5[_0x1ca0('0xf')]});if(_0x10a409>=0x0){logger[_0x1ca0('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2db802,_0x3fafe5[_0x1ca0('0xf')]||_0x1ca0('0x12'),_0x10a409);_0x33b7e0['next'](_0x10a409);}else{logger[_0x1ca0('0xd')](_0x1ca0('0x13'),_0x2db802,_0x3fafe5['priority']||_0x1ca0('0x12'));_0x33b7e0[_0x1ca0('0xc')]();}}else{_0x33b7e0['next']();}}}catch(_0x534413){logger[_0x1ca0('0x8')](_0x1ca0('0x9'),_0x2db802,JSON['stringify'](_0x534413));_0x33b7e0['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index d8a7c2a..42d8d41 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb55c=['stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0xb55c,0x187));var _0xcb55=function(_0x41e018,_0x54cb55){_0x41e018=_0x41e018-0x0;var _0x52327d=_0xb55c[_0x41e018];return _0x52327d;};'use strict';var _=require(_0xcb55('0x0'));var utils=require(_0xcb55('0x1'));var logger=require(_0xcb55('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcb55('0x3')),'mailMessage':require(_0xcb55('0x4')),'smsMessage':require(_0xcb55('0x5')),'faxMessage':require(_0xcb55('0x6')),'whatsappMessage':require(_0xcb55('0x7'))};exports[_0xcb55('0x8')]=function(_0x9ea5a7,_0x28b257){return function(_0x3bcb46){try{var _0xb001f7={'body':utils['getMustacheRender'](_0x28b257[0x0],this),'ContactId':this[_0xcb55('0x9')]['id']};if(this[_0xcb55('0xa')]===_0xcb55('0xb')){_0xb001f7['ChatWebsiteId']=this[_0xcb55('0xc')]['id'];}else{_0xb001f7[_[_0xcb55('0xd')](this[_0xcb55('0xa')])+_0xcb55('0xe')]=this[_0xcb55('0xc')]['id'];}_0xb001f7[_[_0xcb55('0xd')](this[_0xcb55('0xa')])+_0xcb55('0xf')]=this[_0xcb55('0x10')]['id'];if(rpc[this[_0xcb55('0xa')]+_0xcb55('0x11')]){return rpc[this[_0xcb55('0xa')]+_0xcb55('0x11')][_0xcb55('0x12')](_0xb001f7)[_0xcb55('0x13')](function(_0x7e2cfc){logger[_0xcb55('0x14')](_0xcb55('0x15'),_0x9ea5a7,_0xb001f7['body']);_0x3bcb46[_0xcb55('0x16')]();})[_0xcb55('0x17')](function(_0x74c02a){logger['error'](_0xcb55('0x15'),_0x9ea5a7,JSON[_0xcb55('0x18')](_0x74c02a));_0x3bcb46[_0xcb55('0x19')]();});}}catch(_0x38d896){logger['error'](_0xcb55('0x15'),_0x9ea5a7,JSON[_0xcb55('0x18')](_0x38d896));_0x3bcb46['stop']();}};}; \ No newline at end of file +var _0x2883=['error','stringify','stop','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','getMustacheRender','contact','ChatWebsiteId','account','upperFirst','channel','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2883,0xfd));var _0x3288=function(_0x2470ae,_0x1635b9){_0x2470ae=_0x2470ae-0x0;var _0x5dea95=_0x2883[_0x2470ae];return _0x5dea95;};'use strict';var _=require(_0x3288('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3288('0x1'));var rpc={'chatMessage':require(_0x3288('0x2')),'openchannelMessage':require(_0x3288('0x3')),'mailMessage':require(_0x3288('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3288('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x14ae9b,_0x5a9668){return function(_0x1334ff){try{var _0xfd8b2c={'body':utils[_0x3288('0x6')](_0x5a9668[0x0],this),'ContactId':this[_0x3288('0x7')]['id']};if(this['channel']==='chat'){_0xfd8b2c[_0x3288('0x8')]=this[_0x3288('0x9')]['id'];}else{_0xfd8b2c[_[_0x3288('0xa')](this[_0x3288('0xb')])+'AccountId']=this[_0x3288('0x9')]['id'];}_0xfd8b2c[_[_0x3288('0xa')](this['channel'])+_0x3288('0xc')]=this[_0x3288('0xd')]['id'];if(rpc[this[_0x3288('0xb')]+_0x3288('0xe')]){return rpc[this[_0x3288('0xb')]+_0x3288('0xe')][_0x3288('0xf')](_0xfd8b2c)[_0x3288('0x10')](function(_0x437904){logger[_0x3288('0x11')](_0x3288('0x12'),_0x14ae9b,_0xfd8b2c[_0x3288('0x13')]);_0x1334ff[_0x3288('0x14')]();})[_0x3288('0x15')](function(_0x3ee79f){logger[_0x3288('0x16')]('[%s][MESSAGE]\x20%s',_0x14ae9b,JSON[_0x3288('0x17')](_0x3ee79f));_0x1334ff[_0x3288('0x18')]();});}}catch(_0x9b48a1){logger[_0x3288('0x16')](_0x3288('0x12'),_0x14ae9b,JSON[_0x3288('0x17')](_0x9b48a1));_0x1334ff['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 13c807e..6a19c31 100644 --- a/server/services/routing/server/applications/noop.js +++ b/server/services/routing/server/applications/noop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb881=['info','[%s][NOOP]\x20%s','getMustacheRender','next','stop','./utils','../../../../config/logger','consequence'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xb881,0x105));var _0x1b88=function(_0x4ca89a,_0x33ffb8){_0x4ca89a=_0x4ca89a-0x0;var _0xfeb04d=_0xb881[_0x4ca89a];return _0xfeb04d;};'use strict';var utils=require(_0x1b88('0x0'));var logger=require(_0x1b88('0x1'))('routing');exports[_0x1b88('0x2')]=function(_0x320ae4,_0x2f55b7){return function(_0xb55927){try{logger[_0x1b88('0x3')](_0x1b88('0x4'),_0x320ae4,utils[_0x1b88('0x5')](_0x2f55b7[0x0],this));_0xb55927[_0x1b88('0x6')]();}catch(_0x83be27){logger['error'](_0x1b88('0x4'),_0x320ae4,JSON['stringify'](_0x83be27));_0xb55927[_0x1b88('0x7')]();}};}; \ No newline at end of file +var _0x4f6e=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0x4f6e,0xbc));var _0xe4f6=function(_0x2ce9c3,_0x20a165){_0x2ce9c3=_0x2ce9c3-0x0;var _0x109b3a=_0x4f6e[_0x2ce9c3];return _0x109b3a;};'use strict';var utils=require(_0xe4f6('0x0'));var logger=require(_0xe4f6('0x1'))(_0xe4f6('0x2'));exports['consequence']=function(_0x53a4b0,_0x2d0ae8){return function(_0x34ee65){try{logger[_0xe4f6('0x3')](_0xe4f6('0x4'),_0x53a4b0,utils[_0xe4f6('0x5')](_0x2d0ae8[0x0],this));_0x34ee65[_0xe4f6('0x6')]();}catch(_0x59753e){logger[_0xe4f6('0x7')](_0xe4f6('0x4'),_0x53a4b0,JSON[_0xe4f6('0x8')](_0x59753e));_0x34ee65[_0xe4f6('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 1404fb1..80f5d25 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x104525,_0x28e579){var _0x3318ab=function(_0x93d5b2){while(--_0x93d5b2){_0x104525['push'](_0x104525['shift']());}};_0x3318ab(++_0x28e579);}(_0x55ca,0x126));var _0xa55c=function(_0x59b9d3,_0x384472){_0x59b9d3=_0x59b9d3-0x0;var _0x171163=_0x55ca[_0x59b9d3];return _0x171163;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x25f436,_0x27b47a){var _0x367113=function(_0xdd6494){while(--_0xdd6494){_0x25f436['push'](_0x25f436['shift']());}};_0x367113(++_0x27b47a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 71649ec..bff0237 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a2e=['busy','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','info','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x5be613,_0x1469db){var _0x2a20fc=function(_0x35e8fe){while(--_0x35e8fe){_0x5be613['push'](_0x5be613['shift']());}};_0x2a20fc(++_0x1469db);}(_0x7a2e,0x69));var _0xe7a2=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7a2e[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var uuid=require(_0xe7a2('0x0'));var util=require(_0xe7a2('0x1'));var logger=require(_0xe7a2('0x2'))(_0xe7a2('0x3'));var Agent=function(_0x3654aa,_0x1786e0,_0x5af18f,_0x453290){this[_0xe7a2('0x4')]=uuid['v4']();this[_0xe7a2('0x5')]=_0x3654aa;this[_0xe7a2('0x6')]=_0x1786e0;this[_0xe7a2('0x7')]=_0x5af18f;this[_0xe7a2('0x3')]=_0x453290;this[_0xe7a2('0x5')][_0xe7a2('0x8')](this[_0xe7a2('0x9')][_0xe7a2('0xa')](this),this[_0xe7a2('0xb')][_0xe7a2('0xa')](this));this[_0xe7a2('0x5')]['on'](_0xe7a2('0xc'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xe7a2('0xd'),this[_0xe7a2('0xe')][_0xe7a2('0xa')](this));};Agent[_0xe7a2('0xf')][_0xe7a2('0x8')]=function(){this[_0xe7a2('0x5')][_0xe7a2('0x8')](this[_0xe7a2('0x9')][_0xe7a2('0xa')](this),this[_0xe7a2('0xb')]['bind'](this));};Agent['prototype'][_0xe7a2('0xe')]=function(){this[_0xe7a2('0xb')](!![]);};Agent[_0xe7a2('0xf')][_0xe7a2('0x9')]=function(_0x3c1e26){logger['info'](_0xe7a2('0x10'),this[_0xe7a2('0x5')]['id'],this['agent']['id']);if(_[_0xe7a2('0x11')](this[_0xe7a2('0x7')][_0xe7a2('0x12')][this['agent']['id']])){logger['info'](_0xe7a2('0x13'),this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x6')]['id']);setTimeout(this[_0xe7a2('0x8')][_0xe7a2('0xa')](this),0x3e8);}else{if(this[_0xe7a2('0x3')]['forcedOwnership']||util[_0xe7a2('0x14')](this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],this[_0xe7a2('0x5')][_0xe7a2('0x15')],![])){this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']]['busy']=!![];this[_0xe7a2('0x7')][_0xe7a2('0x12')][this['agent']['id']][_0xe7a2('0x16')]=undefined;util[_0xe7a2('0x17')](this[_0xe7a2('0x4')],this['squeue']['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],null,this[_0xe7a2('0x3')]);util[_0xe7a2('0x18')](this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this['agent']['id']],_0xe7a2('0x19')+(this['routing'][_0xe7a2('0x1a')]?_0xe7a2('0x1b'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xe7a2('0x6')]['id']);setTimeout(this[_0xe7a2('0x8')]['bind'](this),0x3e8);}}};Agent[_0xe7a2('0xf')][_0xe7a2('0xb')]=function(_0x56bf7d){if(_[_0xe7a2('0x11')](this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']])){return logger[_0xe7a2('0x1c')](_0xe7a2('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger[_0xe7a2('0x1c')](_0xe7a2('0x1d'),this[_0xe7a2('0x5')]['id'],this['agent']['id']);util[_0xe7a2('0x1e')](this['notificationId'],this[_0xe7a2('0x5')]['id'],this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],null,this[_0xe7a2('0x3')]);this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']][_0xe7a2('0x1f')]=![];this[_0xe7a2('0x7')][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']]['busyQueue']=undefined;util['writeLog'](this[_0xe7a2('0x5')]['id'],this['realtime'][_0xe7a2('0x12')][this[_0xe7a2('0x6')]['id']],_0x56bf7d?_0xe7a2('0x20'):_0xe7a2('0x21'));}if(!_0x56bf7d){setTimeout(this[_0xe7a2('0x8')][_0xe7a2('0xa')](this),0x3e8);}};function agent(_0x357f4f,_0x517f5a,_0x1e192d,_0x5f0165){return new Agent(_0x357f4f,_0x517f5a,_0x1e192d,_0x5f0165);}module['exports']=agent; \ No newline at end of file +var _0xa571=['busy','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa571,0x83));var _0x1a57=function(_0x27c732,_0xc6e5d2){_0x27c732=_0x27c732-0x0;var _0x1ba2e8=_0xa571[_0x27c732];return _0x1ba2e8;};'use strict';var _=require(_0x1a57('0x0'));var uuid=require(_0x1a57('0x1'));var util=require(_0x1a57('0x2'));var logger=require(_0x1a57('0x3'))(_0x1a57('0x4'));var Agent=function(_0x29a31a,_0x16cdc3,_0xef1cb9,_0x261369){this[_0x1a57('0x5')]=uuid['v4']();this['squeue']=_0x29a31a;this['agent']=_0x16cdc3;this[_0x1a57('0x6')]=_0xef1cb9;this['routing']=_0x261369;this[_0x1a57('0x7')][_0x1a57('0x8')](this[_0x1a57('0x9')][_0x1a57('0xa')](this),this[_0x1a57('0xb')][_0x1a57('0xa')](this));this[_0x1a57('0x7')]['on'](_0x1a57('0xc'),this[_0x1a57('0xb')][_0x1a57('0xa')](this));this['squeue']['on'](_0x1a57('0xd'),this[_0x1a57('0xe')][_0x1a57('0xa')](this));};Agent['prototype']['push']=function(){this[_0x1a57('0x7')][_0x1a57('0x8')](this[_0x1a57('0x9')][_0x1a57('0xa')](this),this[_0x1a57('0xb')][_0x1a57('0xa')](this));};Agent[_0x1a57('0xf')][_0x1a57('0xe')]=function(){this[_0x1a57('0xb')](!![]);};Agent['prototype']['handleRun']=function(_0x27b014){logger[_0x1a57('0x10')](_0x1a57('0x11'),this[_0x1a57('0x7')]['id'],this[_0x1a57('0x12')]['id']);if(_['isNil'](this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']])){logger[_0x1a57('0x10')](_0x1a57('0x14'),this[_0x1a57('0x7')]['id'],this[_0x1a57('0x12')]['id']);setTimeout(this[_0x1a57('0x8')]['bind'](this),0x3e8);}else{if(this[_0x1a57('0x4')]['forcedOwnership']||util[_0x1a57('0x15')](this[_0x1a57('0x7')]['id'],this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']],this[_0x1a57('0x7')]['channel'],![])){this[_0x1a57('0x6')][_0x1a57('0x13')][this['agent']['id']]['busy']=!![];this[_0x1a57('0x6')][_0x1a57('0x13')][this['agent']['id']]['busyQueue']=undefined;util[_0x1a57('0x16')](this[_0x1a57('0x5')],this[_0x1a57('0x7')]['id'],this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']],null,this['routing']);util[_0x1a57('0x17')](this['squeue']['id'],this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']],_0x1a57('0x18')+(this['routing'][_0x1a57('0x19')]?_0x1a57('0x1a'):''));}else{logger['info'](_0x1a57('0x1b'),this[_0x1a57('0x7')]['id'],this['agent']['id']);setTimeout(this[_0x1a57('0x8')][_0x1a57('0xa')](this),0x3e8);}}};Agent[_0x1a57('0xf')]['handleTimeout']=function(_0x44a177){if(_['isNil'](this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']])){return logger[_0x1a57('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1a57('0x7')]['id'],this['agent']['id']);}else{logger[_0x1a57('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x1a57('0x12')]['id']);util[_0x1a57('0x1c')](this[_0x1a57('0x5')],this[_0x1a57('0x7')]['id'],this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']],null,this[_0x1a57('0x4')]);this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']][_0x1a57('0x1d')]=![];this[_0x1a57('0x6')]['agents'][this[_0x1a57('0x12')]['id']]['busyQueue']=undefined;util[_0x1a57('0x17')](this['squeue']['id'],this[_0x1a57('0x6')][_0x1a57('0x13')][this[_0x1a57('0x12')]['id']],_0x44a177?_0x1a57('0x1e'):'TIMEOUT');}if(!_0x44a177){setTimeout(this['push'][_0x1a57('0xa')](this),0x3e8);}};function agent(_0x573b6d,_0x3a6b9f,_0x53aa34,_0x1d9ae5){return new Agent(_0x573b6d,_0x3a6b9f,_0x53aa34,_0x1d9ae5);}module[_0x1a57('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index ef634a4..4d28331 100644 --- a/server/services/routing/server/applications/strategy/beepall.js +++ b/server/services/routing/server/applications/strategy/beepall.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb108=['agents','info','isAgentAvailable','channel','writeLog','RINGING','busy','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','busyQueue','lodash','uuid','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0xb108,0x11f));var _0x8b10=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb108[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x8b10('0x0'));var uuid=require(_0x8b10('0x1'));var util=require('./util');var logger=require(_0x8b10('0x2'))(_0x8b10('0x3'));var Beepall=function(_0xe15671,_0x2003df,_0xacb599,_0x264e85){this[_0x8b10('0x4')]=uuid['v4']();this['squeue']=_0xe15671;this[_0x8b10('0x5')]=_0x2003df;this[_0x8b10('0x6')]=_0xacb599;this[_0x8b10('0x3')]=_0x264e85;this[_0x8b10('0x7')][_0x8b10('0x8')](this[_0x8b10('0x9')][_0x8b10('0xa')](this),this[_0x8b10('0xb')][_0x8b10('0xa')](this));this[_0x8b10('0x7')]['on'](_0x8b10('0xc'),this['handleTimeout'][_0x8b10('0xa')](this));this[_0x8b10('0x7')]['on'](_0x8b10('0xd'),this[_0x8b10('0xe')][_0x8b10('0xa')](this));};Beepall['prototype']['push']=function(){this['squeue'][_0x8b10('0x8')](this[_0x8b10('0x9')][_0x8b10('0xa')](this),this[_0x8b10('0xb')]['bind'](this));};Beepall['prototype'][_0x8b10('0xe')]=function(_0x18d24f){this['handleTimeout'](!![]);};Beepall[_0x8b10('0xf')][_0x8b10('0x9')]=function(_0x535bc8){var _0x26928e=!![];if(!_['isNil'](this[_0x8b10('0x5')])&&!_[_0x8b10('0x10')](this['queue']['Agents'])&&this[_0x8b10('0x5')][_0x8b10('0x11')][_0x8b10('0x12')]>0x0){for(var _0x4a42b4=0x0,_0x59055f;_0x4a42b40x0){for(var _0x3481e5=0x0,_0x15202a;_0x3481e50x0&&_0x53995e[_0x497c06+_0x9178('0x28')]>=_0x53995e[_0x497c06+_0x9178('0x27')]){writeLog(_0x428118,_0x53995e,_0x497c06['toUpperCase']()+_0x9178('0x29'));return![];}}return!![];};exports[_0x9178('0x2a')]=function(_0x5c39ed,_0x417faf,_0x14fa42,_0x39d309,_0x2b977b){return sendNotification(!![],_0x5c39ed,_0x417faf,_0x14fa42,_0x39d309,_0x2b977b);};exports[_0x9178('0x2b')]=function(_0x3b2487,_0x5d9747,_0x267f42,_0x47201c,_0x553a32){return sendNotification(![],_0x3b2487,_0x5d9747,_0x267f42,_0x47201c,_0x553a32);};exports[_0x9178('0x2c')]=writeLog; \ No newline at end of file +var _0x3f40=['notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','notification:%s','save','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account'];(function(_0x4a7dd9,_0x5b3a26){var _0x4eafe5=function(_0x1e6ba7){while(--_0x1e6ba7){_0x4a7dd9['push'](_0x4a7dd9['shift']());}};_0x4eafe5(++_0x5b3a26);}(_0x3f40,0xbb));var _0x03f4=function(_0x33acfb,_0x5a2522){_0x33acfb=_0x33acfb-0x0;var _0x4785d7=_0x3f40[_0x33acfb];return _0x4785d7;};'use strict';var _=require(_0x03f4('0x0'));var util=require(_0x03f4('0x1'));var utils=require(_0x03f4('0x2'));var Mustache=require('mustache');var Redis=require(_0x03f4('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x03f4('0x4'))(_0x03f4('0x5'));config[_0x03f4('0x6')]=_[_0x03f4('0x7')](config['redis'],{'host':_0x03f4('0x8'),'port':0x18eb});var io=require(_0x03f4('0x9'))(new Redis(config[_0x03f4('0x6')]));function emit(_0xa627c5,_0x31cb26,_0x2992b4){io['to'](_0xa627c5)[_0x03f4('0xa')](_0x31cb26,_0x2992b4);}function sendNotification(_0x5e7836,_0x2099fd,_0x2e3a89,_0x50eb6a,_0x50abe8,_0x2fc430){io['to'](util[_0x03f4('0xb')](_0x03f4('0xc'),_0x50eb6a[_0x03f4('0xd')]))[_0x03f4('0xa')](_0x03f4('0xe'),_0x50eb6a);var _0x3f1383=_0x2fc430||{};var _0x54b704=_0x2e3a89[_0x03f4('0xf')]('.');var _0x22b3bd={'uniqueid':_0x2099fd,'channel':_0x54b704[0x0],'id':_0x54b704[0x1],'title':_0x54b704[0x0]+_0x03f4('0x10'),'interactionId':_0x54b704[0x2],'queue':_0x50abe8?_0x50abe8['name']:null,'sound':_0x3f1383[_0x03f4('0x11')][_0x03f4('0x12')],'shake':_0x3f1383[_0x03f4('0x11')][_0x03f4('0x13')]};try{if(!_0x3f1383['body']){_0x3f1383['body']={};}if(_0x50abe8){_0x3f1383[_0x03f4('0x14')][_0x03f4('0x15')]=_0x50abe8;}else if(_0x3f1383[_0x03f4('0x14')][_0x03f4('0x15')]){delete _0x3f1383[_0x03f4('0x14')][_0x03f4('0x15')];}_0x22b3bd[_0x03f4('0x16')]=utils[_0x03f4('0x17')](_0x3f1383[_0x03f4('0x11')][_0x03f4('0x18')],_0x3f1383);}catch(_0x21e81b){_0x22b3bd[_0x03f4('0x16')]=_0x03f4('0x19');logger['error'](util['format']('[%s][QUEUE]\x20%s',_0x2099fd,_0x21e81b['message']));}io['to'](util['format']('user:%s',_0x50eb6a['name']))[_0x03f4('0xa')](util[_0x03f4('0xb')](_0x03f4('0x1a'),_0x5e7836?_0x03f4('0x1b'):'remove'),_0x22b3bd);}function writeLog(_0x4d2963,_0x51cbe6,_0x2ca887){return logger['info'](util[_0x03f4('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4d2963,_0x51cbe6[_0x03f4('0xd')],_0x2ca887));}exports[_0x03f4('0x1c')]=function(_0x2e7b6b,_0x3feb7a,_0x2f3840,_0x115ffc){if(_0x3feb7a[_0x03f4('0x1d')]){writeLog(_0x2e7b6b,_0x3feb7a,'BUSY');return![];}if(!_0x3feb7a[_0x03f4('0x1e')]){writeLog(_0x2e7b6b,_0x3feb7a,_0x03f4('0x1f'));return![];}if(_0x3feb7a[_0x2f3840+_0x03f4('0x20')]){writeLog(_0x2e7b6b,_0x3feb7a,_0x03f4('0x21'));return![];}if(_0x115ffc&&_0x3feb7a[_0x03f4('0x22')](_0x2f3840+_0x03f4('0x23'))&&_0x3feb7a[_0x03f4('0x22')](_0x2f3840+_0x03f4('0x24'))){if(_0x3feb7a[_0x2f3840+_0x03f4('0x23')]>0x0&&_0x3feb7a[_0x2f3840+_0x03f4('0x24')]>=_0x3feb7a[_0x2f3840+_0x03f4('0x23')]){writeLog(_0x2e7b6b,_0x3feb7a,_0x2f3840[_0x03f4('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x03f4('0x26')]=function(_0x4fc412,_0x20ef9f,_0x51a879,_0x59c06c,_0x4cfe61){return sendNotification(!![],_0x4fc412,_0x20ef9f,_0x51a879,_0x59c06c,_0x4cfe61);};exports[_0x03f4('0x27')]=function(_0xec912,_0x331ace,_0x1f8e62,_0xd0d6c4,_0x36e719){return sendNotification(![],_0xec912,_0x331ace,_0x1f8e62,_0xd0d6c4,_0x36e719);};exports[_0x03f4('0x28')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 15353e3..26330f4 100644 --- a/server/services/routing/server/applications/system.js +++ b/server/services/routing/server/applications/system.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x776d=['join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs','lodash','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message'];(function(_0x4a0d6f,_0x53e88c){var _0x60aba3=function(_0x18b8e7){while(--_0x18b8e7){_0x4a0d6f['push'](_0x4a0d6f['shift']());}};_0x60aba3(++_0x53e88c);}(_0x776d,0xdc));var _0xd776=function(_0x5bd83a,_0x4b5367){_0x5bd83a=_0x5bd83a-0x0;var _0x358f2d=_0x776d[_0x5bd83a];return _0x358f2d;};'use strict';var schema=require(_0xd776('0x0'));var sh=require(_0xd776('0x1'));var _=require(_0xd776('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd776('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xd776('0x4')}});exports[_0xd776('0x5')]=function(_0x5b9193,_0x1f9d5a){return function(_0x17b317){try{var _0x1c67b4={'command':_0x1f9d5a[0x0]};var _0x36f0cc=system[_0xd776('0x0')](_0x1c67b4,{'typecast':!![]});if(_0x36f0cc['length']){logger[_0xd776('0x6')](_0xd776('0x7'),_0x5b9193,_[_0xd776('0x8')](_0x36f0cc,_0xd776('0x9'))[_0xd776('0xa')](',\x20'));logger['info'](_0xd776('0xb'),_0x5b9193);_0x17b317[_0xd776('0xc')]();}else{var _0x444d6d=this;var _0x5a274e=utils[_0xd776('0xd')](_0x1f9d5a[0x0],this);logger[_0xd776('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5b9193,_0x5a274e);sh[_0xd776('0xf')](_[_0xd776('0x10')](_0x5a274e),function(_0x249f89,_0x400677){logger[_0xd776('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5b9193,_0x249f89);if(_0x249f89==0x0){var _0x40d0cf=_0x400677[_0xd776('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xd776('0x12')](_0x1f9d5a[0x1])||_[_0xd776('0x13')](_0x1f9d5a[0x1])){logger[_0xd776('0xe')](_0xd776('0x14'),_0x5b9193);_0x444d6d[_0xd776('0x15')][_0x1f9d5a[0x1]]=_0x40d0cf;}else{logger[_0xd776('0xe')](_0xd776('0x16'),_0x5b9193,_0x1f9d5a[0x1],_0x40d0cf);_0x444d6d[_0xd776('0x15')][_0x1f9d5a[0x1]]=_0x40d0cf;}}_0x17b317[_0xd776('0xc')]();});}}catch(_0x531000){logger[_0xd776('0x6')](_0xd776('0x7'),_0x5b9193,_['isObject'](_0x531000)?JSON['stringify'](_0x531000):_0x531000);logger[_0xd776('0xe')](_0xd776('0xb'),_0x5b9193);_0x17b317['next']();}};}; \ No newline at end of file +var _0x198e=['stringify','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','body','isObject'];(function(_0x1ef71d,_0x453e87){var _0x5bd739=function(_0x595a8a){while(--_0x595a8a){_0x1ef71d['push'](_0x1ef71d['shift']());}};_0x5bd739(++_0x453e87);}(_0x198e,0x1cf));var _0xe198=function(_0x39fae8,_0x5bf5fc){_0x39fae8=_0x39fae8-0x0;var _0x4bb84c=_0x198e[_0x39fae8];return _0x4bb84c;};'use strict';var schema=require(_0xe198('0x0'));var sh=require(_0xe198('0x1'));var _=require(_0xe198('0x2'));var utils=require('./utils');var logger=require(_0xe198('0x3'))(_0xe198('0x4'));var system=schema({'command':{'type':_0xe198('0x5'),'required':!![],'message':_0xe198('0x6')}});exports[_0xe198('0x7')]=function(_0x207e7b,_0xd5bfe0){return function(_0x2c56b7){try{var _0x26f48b={'command':_0xd5bfe0[0x0]};var _0x1ecafb=system[_0xe198('0x0')](_0x26f48b,{'typecast':!![]});if(_0x1ecafb[_0xe198('0x8')]){logger[_0xe198('0x9')](_0xe198('0xa'),_0x207e7b,_['map'](_0x1ecafb,'message')[_0xe198('0xb')](',\x20'));logger[_0xe198('0xc')](_0xe198('0xd'),_0x207e7b);_0x2c56b7[_0xe198('0xe')]();}else{var _0x24ff46=this;var _0x1e4d35=utils[_0xe198('0xf')](_0xd5bfe0[0x0],this);logger[_0xe198('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x207e7b,_0x1e4d35);sh['exec'](_['trim'](_0x1e4d35),function(_0x35b283,_0x329351){logger[_0xe198('0xc')](_0xe198('0x10'),_0x207e7b,_0x35b283);if(_0x35b283==0x0){var _0x11620c=_0x329351['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xe198('0x11')](_0xd5bfe0[0x1])||_[_0xe198('0x12')](_0xd5bfe0[0x1])){logger[_0xe198('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x207e7b);_0x24ff46[_0xe198('0x13')][_0xd5bfe0[0x1]]=_0x11620c;}else{logger[_0xe198('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x207e7b,_0xd5bfe0[0x1],_0x11620c);_0x24ff46[_0xe198('0x13')][_0xd5bfe0[0x1]]=_0x11620c;}}_0x2c56b7[_0xe198('0xe')]();});}}catch(_0x2cfe22){logger[_0xe198('0x9')](_0xe198('0xa'),_0x207e7b,_[_0xe198('0x14')](_0x2cfe22)?JSON[_0xe198('0x15')](_0x2cfe22):_0x2cfe22);logger[_0xe198('0xc')](_0xe198('0xd'),_0x207e7b);_0x2c56b7[_0xe198('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 5773a67..ae541f6 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa313=['map','message','next','channel','Interaction','addTags','interaction','then','info','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s'];(function(_0x4e6668,_0x55889c){var _0x2092d5=function(_0x36ab60){while(--_0x36ab60){_0x4e6668['push'](_0x4e6668['shift']());}};_0x2092d5(++_0x55889c);}(_0xa313,0x74));var _0x3a31=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xa313[_0x5179a5];return _0x15c8ce;};'use strict';var schema=require(_0x3a31('0x0'));var _=require(_0x3a31('0x1'));var rpc={'chatInteraction':require(_0x3a31('0x2')),'openchannelInteraction':require(_0x3a31('0x3')),'smsInteraction':require(_0x3a31('0x4')),'mailInteraction':require(_0x3a31('0x5')),'faxInteraction':require(_0x3a31('0x6')),'whatsappInteraction':require(_0x3a31('0x7'))};var logger=require('../../../../config/logger')(_0x3a31('0x8'));var tag=schema({'tag':{'type':_0x3a31('0x9'),'required':!![],'message':_0x3a31('0xa')}});exports['consequence']=function(_0x2f9d7d,_0x248cfc,_0x564439,_0x509fa5){return function(_0x486b90){try{var _0xcd973c={'tag':_0x248cfc[0x0]};var _0x1c7221=tag['validate'](_0xcd973c,{'typecast':!![]});if(_0x1c7221[_0x3a31('0xb')]){logger[_0x3a31('0xc')](_0x3a31('0xd'),_0x2f9d7d,_[_0x3a31('0xe')](_0x1c7221,_0x3a31('0xf'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2f9d7d);_0x486b90[_0x3a31('0x10')]();}else{var _0x4c8502={'ids':[_0x248cfc[0x0]]};if(rpc[_0x509fa5[_0x3a31('0x11')]+_0x3a31('0x12')]){rpc[_0x509fa5['channel']+'Interaction'][_0x3a31('0x13')](_0x509fa5[_0x3a31('0x14')]['id'],_0x4c8502)[_0x3a31('0x15')](function(_0x40f6db){logger[_0x3a31('0x16')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2f9d7d,_0x248cfc[0x1],_0x509fa5[_0x3a31('0x11')],_0x509fa5[_0x3a31('0x14')]['id']);})['catch'](function(_0x4e52ee){logger[_0x3a31('0xc')](_0x3a31('0xd'),_0x2f9d7d,JSON[_0x3a31('0x17')](_0x4e52ee));logger[_0x3a31('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2f9d7d);})[_0x3a31('0x18')](function(){_0x486b90['next']();});}}}catch(_0x2d8ec2){logger['error']('[%s][TAG]\x20%s',_0x2f9d7d,_[_0x3a31('0x19')](_0x2d8ec2)?JSON[_0x3a31('0x17')](_0x2d8ec2):_0x2d8ec2);logger[_0x3a31('0x16')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2f9d7d);_0x486b90[_0x3a31('0x10')]();}};}; \ No newline at end of file +var _0xa72f=['info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa72f,0x164));var _0xfa72=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0xa72f[_0x4f9d26];return _0x57debc;};'use strict';var schema=require(_0xfa72('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xfa72('0x1')),'smsInteraction':require(_0xfa72('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xfa72('0x3')),'whatsappInteraction':require(_0xfa72('0x4'))};var logger=require(_0xfa72('0x5'))(_0xfa72('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xfa72('0x7')}});exports['consequence']=function(_0x2a3408,_0x2c010f,_0x4202fa,_0x5cad84){return function(_0x9b36c8){try{var _0x44c48a={'tag':_0x2c010f[0x0]};var _0xa09c25=tag['validate'](_0x44c48a,{'typecast':!![]});if(_0xa09c25[_0xfa72('0x8')]){logger[_0xfa72('0x9')](_0xfa72('0xa'),_0x2a3408,_['map'](_0xa09c25,_0xfa72('0xb'))[_0xfa72('0xc')](',\x20'));logger['info'](_0xfa72('0xd'),_0x2a3408);_0x9b36c8[_0xfa72('0xe')]();}else{var _0x18461d={'ids':[_0x2c010f[0x0]]};if(rpc[_0x5cad84[_0xfa72('0xf')]+_0xfa72('0x10')]){rpc[_0x5cad84[_0xfa72('0xf')]+_0xfa72('0x10')][_0xfa72('0x11')](_0x5cad84['interaction']['id'],_0x18461d)[_0xfa72('0x12')](function(_0x2a53ae){logger[_0xfa72('0x13')](_0xfa72('0x14'),_0x2a3408,_0x2c010f[0x1],_0x5cad84['channel'],_0x5cad84[_0xfa72('0x15')]['id']);})['catch'](function(_0x4a074d){logger[_0xfa72('0x9')](_0xfa72('0xa'),_0x2a3408,JSON[_0xfa72('0x16')](_0x4a074d));logger['info'](_0xfa72('0xd'),_0x2a3408);})[_0xfa72('0x17')](function(){_0x9b36c8['next']();});}}}catch(_0x3c23bc){logger['error'](_0xfa72('0xa'),_0x2a3408,_[_0xfa72('0x18')](_0x3c23bc)?JSON[_0xfa72('0x16')](_0x3c23bc):_0x3c23bc);logger['info'](_0xfa72('0xd'),_0x2a3408);_0x9b36c8[_0xfa72('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 7de2bcb..d4de78e 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf0=['axios','tough-cookie','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','replace','\x20-\x20','push','?params=','urlOnRing','title','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','result','logged','channelId=','&sessionId=','&data=','then','parse','next','catch','log','validate','shelljs','request-promise'];(function(_0x2fb0b5,_0x2ed4e1){var _0x5256af=function(_0x59be79){while(--_0x59be79){_0x2fb0b5['push'](_0x2fb0b5['shift']());}};_0x5256af(++_0x2ed4e1);}(_0xfcf0,0x138));var _0x0fcf=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xfcf0[_0x5aa373];return _0x590e8e;};'use strict';var schema=require(_0x0fcf('0x0'));var sh=require(_0x0fcf('0x1'));var _=require('lodash');var rp=require(_0x0fcf('0x2'));var axios=require(_0x0fcf('0x3'));var tough=require(_0x0fcf('0x4'));var utils=require(_0x0fcf('0x5'));const {session}=require('passport');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var system=schema({'command':{'type':_0x0fcf('0x8'),'required':!![],'message':_0x0fcf('0x9')}});var arr=[];exports[_0x0fcf('0xa')]=function(_0x1a7b03,_0x61bbb9){return function(_0x2dfdf8){var _0x50c575=_0x61bbb9[0xa];var _0x1388d1=_0x61bbb9[0xb];var _0x6ced94=_0x61bbb9[0xc];var _0xa9e007=_0x61bbb9[0xd];var _0x4de593=_0x61bbb9[0xe];var _0x69a840=_0x61bbb9[0xf][_0x0fcf('0xb')](/\n/g,_0x0fcf('0xc'));var _0x4b3923=_0x61bbb9[0x10][_0x0fcf('0xb')](/\n/g,'\x20');if(!arr['includes'](_0x1388d1)){arr[_0x0fcf('0xd')](_0x1388d1);var _0x2317cf='';var _0x201a58=_0x61bbb9[0x3];var _0x48619c=_0x61bbb9[0x4];var _0x5f40fb=_0x61bbb9[0x1];var _0x29336a=_0x61bbb9[0x0];var _0x3c999e={};_0x3c999e['urlOnAnswer']=_0x61bbb9[0x8]+_0x0fcf('0xe')+_0x6ced94+'|'+_0x50c575+'|'+_0xa9e007+'|'+_0x1388d1+'|'+_0x4de593;_0x3c999e[_0x0fcf('0xf')]=_0x61bbb9[0x7]+_0x0fcf('0xe')+_0x6ced94+'|'+_0x50c575+'|'+_0xa9e007+'|'+_0x1388d1+'|'+_0x4de593+'|'+_0x69a840+'|'+_0x4b3923;_0x3c999e[_0x0fcf('0x10')]=_0x61bbb9[0x9];var _0x25fadc={};_0x25fadc['jsonrpc']=_0x0fcf('0x11');_0x25fadc[_0x0fcf('0x12')]=_0x0fcf('0x13');var _0x5e867f=[];_0x5e867f[_0x0fcf('0xd')](_0x61bbb9[0x2]);_0x5e867f[_0x0fcf('0xd')](_0x61bbb9[0x5]);_0x5e867f[_0x0fcf('0xd')](_0x61bbb9[0x6]);_0x25fadc[_0x0fcf('0x14')]=_0x5e867f;_0x25fadc['id']=0x1;var _0x48dd53=JSON[_0x0fcf('0x15')](_0x25fadc);var _0x2f8289={'encoding':_0x0fcf('0x16'),'method':_0x0fcf('0x17'),'timeout':0x2710,'url':_0x201a58,'headers':{'Content-Type':_0x0fcf('0x18')},'body':_0x48dd53};return rp(_0x2f8289)['then'](function(_0x18ea32){const _0x1a8f58=JSON['parse'](_0x18ea32);if(_0x1a8f58[_0x0fcf('0x19')][_0x0fcf('0x1a')]){var _0x4da7e3=_0x1388d1;_0x2317cf=_0x1a8f58[_0x0fcf('0x19')]['accessToken'];var _0x3fc9e6=_0x0fcf('0x1b')+_0x5f40fb+'&serviceId='+_0x29336a+_0x0fcf('0x1c')+_0x4da7e3+_0x0fcf('0x1d')+JSON[_0x0fcf('0x15')](_0x3c999e);var _0x5c459c=_0x48619c+'?'+_0x3fc9e6;return rp(_0x5c459c)[_0x0fcf('0x1e')](function(_0x1dafc8){const _0x196d30=JSON[_0x0fcf('0x1f')](_0x1dafc8);});}_0x2dfdf8[_0x0fcf('0x20')]();})[_0x0fcf('0x21')](function(_0x5841a9){console[_0x0fcf('0x22')](_0x5841a9);});}else _0x2dfdf8[_0x0fcf('0x20')]();};}; \ No newline at end of file +var _0x96f2=['urlOnRing','?params=','title','2.0','stringify','utf8','POST','application/json-rpc','result','logged','channelId=','&serviceId=','&data=','parse','validate','lodash','request-promise','axios','./utils','passport','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','replace','\x20-\x20','includes','push'];(function(_0x456b27,_0x3c4ec8){var _0x248c7d=function(_0x314131){while(--_0x314131){_0x456b27['push'](_0x456b27['shift']());}};_0x248c7d(++_0x3c4ec8);}(_0x96f2,0xb0));var _0x296f=function(_0x1ae866,_0x4d3a2a){_0x1ae866=_0x1ae866-0x0;var _0x1aafc0=_0x96f2[_0x1ae866];return _0x1aafc0;};'use strict';var schema=require(_0x296f('0x0'));var sh=require('shelljs');var _=require(_0x296f('0x1'));var rp=require(_0x296f('0x2'));var axios=require(_0x296f('0x3'));var tough=require('tough-cookie');var utils=require(_0x296f('0x4'));const {session}=require(_0x296f('0x5'));var logger=require(_0x296f('0x6'))('routing');var system=schema({'command':{'type':_0x296f('0x7'),'required':!![],'message':_0x296f('0x8')}});var arr=[];exports['consequence']=function(_0x4c55c7,_0x164031){return function(_0x1d019f){var _0x2dc0ca=_0x164031[0xa];var _0x28f708=_0x164031[0xb];var _0x30ed43=_0x164031[0xc];var _0xc50d49=_0x164031[0xd];var _0x29e904=_0x164031[0xe];var _0x3ea699=_0x164031[0xf][_0x296f('0x9')](/\n/g,_0x296f('0xa'));var _0x593fd9=_0x164031[0x10][_0x296f('0x9')](/\n/g,'\x20');if(!arr[_0x296f('0xb')](_0x28f708)){arr[_0x296f('0xc')](_0x28f708);var _0x59c65d='';var _0x2e2307=_0x164031[0x3];var _0x26fc62=_0x164031[0x4];var _0x1800af=_0x164031[0x1];var _0x28dad3=_0x164031[0x0];var _0x5710ac={};_0x5710ac['urlOnAnswer']=_0x164031[0x8]+'?params='+_0x30ed43+'|'+_0x2dc0ca+'|'+_0xc50d49+'|'+_0x28f708+'|'+_0x29e904;_0x5710ac[_0x296f('0xd')]=_0x164031[0x7]+_0x296f('0xe')+_0x30ed43+'|'+_0x2dc0ca+'|'+_0xc50d49+'|'+_0x28f708+'|'+_0x29e904+'|'+_0x3ea699+'|'+_0x593fd9;_0x5710ac[_0x296f('0xf')]=_0x164031[0x9];var _0xe843fc={};_0xe843fc['jsonrpc']=_0x296f('0x10');_0xe843fc['method']='login';var _0x367e03=[];_0x367e03[_0x296f('0xc')](_0x164031[0x2]);_0x367e03[_0x296f('0xc')](_0x164031[0x5]);_0x367e03[_0x296f('0xc')](_0x164031[0x6]);_0xe843fc['params']=_0x367e03;_0xe843fc['id']=0x1;var _0x4a2aaa=JSON[_0x296f('0x11')](_0xe843fc);var _0x47b588={'encoding':_0x296f('0x12'),'method':_0x296f('0x13'),'timeout':0x2710,'url':_0x2e2307,'headers':{'Content-Type':_0x296f('0x14')},'body':_0x4a2aaa};return rp(_0x47b588)['then'](function(_0xcc2b48){const _0x3b7db8=JSON['parse'](_0xcc2b48);if(_0x3b7db8[_0x296f('0x15')][_0x296f('0x16')]){var _0x51498d=_0x28f708;_0x59c65d=_0x3b7db8[_0x296f('0x15')]['accessToken'];var _0x132005=_0x296f('0x17')+_0x1800af+_0x296f('0x18')+_0x28dad3+'&sessionId='+_0x51498d+_0x296f('0x19')+JSON[_0x296f('0x11')](_0x5710ac);var _0x2ca4b2=_0x26fc62+'?'+_0x132005;return rp(_0x2ca4b2)['then'](function(_0x2a9a1c){const _0x108c9b=JSON[_0x296f('0x1a')](_0x2a9a1c);});}_0x1d019f['next']();})['catch'](function(_0x12abfb){console['log'](_0x12abfb);});}else _0x1d019f['next']();};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 23c82f2..c7ae865 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x899a=['merge','body','contact','message','interaction','list','mustache','lodash'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x899a,0x1b6));var _0xa899=function(_0x15322f,_0x1df4f9){_0x15322f=_0x15322f-0x0;var _0x2bcb76=_0x899a[_0x15322f];return _0x2bcb76;};'use strict';var Mustache=require(_0xa899('0x0'));var _=require(_0xa899('0x1'));module['exports']={'getMustacheRender':function(_0x26e9a7,_0x3f08ab){return Mustache['render'](_0x26e9a7,_[_0xa899('0x2')](_0x3f08ab[_0xa899('0x3')],{'contact':_0x3f08ab[_0xa899('0x4')],'message':_0x3f08ab[_0xa899('0x5')],'account':_0x3f08ab['account'],'interaction':_0x3f08ab[_0xa899('0x6')],'list':_0x3f08ab[_0xa899('0x7')]}))||'';}}; \ No newline at end of file +var _0x89f7=['merge','contact','message','account','interaction','mustache','lodash','exports'];(function(_0x17578e,_0x3a97dd){var _0x4368b4=function(_0x42c6ee){while(--_0x42c6ee){_0x17578e['push'](_0x17578e['shift']());}};_0x4368b4(++_0x3a97dd);}(_0x89f7,0x105));var _0x789f=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x89f7[_0x585ee5];return _0x470808;};'use strict';var Mustache=require(_0x789f('0x0'));var _=require(_0x789f('0x1'));module[_0x789f('0x2')]={'getMustacheRender':function(_0x4b81a3,_0x2e09ac){return Mustache['render'](_0x4b81a3,_[_0x789f('0x3')](_0x2e09ac['body'],{'contact':_0x2e09ac[_0x789f('0x4')],'message':_0x2e09ac[_0x789f('0x5')],'account':_0x2e09ac[_0x789f('0x6')],'interaction':_0x2e09ac[_0x789f('0x7')],'list':_0x2e09ac['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 51d5764..0e45824 100644 --- a/server/services/routing/server/index.js +++ b/server/services/routing/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','join','dialogflowv2','amazonlex','TagId','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','app','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues'];(function(_0x2b11f3,_0x496304){var _0x5caba3=function(_0x34249e){while(--_0x34249e){_0x2b11f3['push'](_0x2b11f3['shift']());}};_0x5caba3(++_0x496304);}(_0x2d17,0x17e));var _0x72d1=function(_0x143100,_0x447c51){_0x143100=_0x143100-0x0;var _0x1e926e=_0x2d17[_0x143100];return _0x1e926e;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x72d1('0x2'));var BPromise=require(_0x72d1('0x3'));var uuid=require('uuid');var config=require(_0x72d1('0x4'));var logger=require(_0x72d1('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x72d1('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x72d1('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x72d1('0x8')),'whatsappQueueReport':require(_0x72d1('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x477264,_0x422f5a,_0x19e248){return util['format'](_0x72d1('0xa'),_0x477264,_0x422f5a||0x0,_0x19e248||0x0);}function getIntervals(_0x288362,_0x283775){var _0x593c91=[];if(!_[_0x72d1('0xb')](_0x283775[_0x72d1('0xc')])&&!_[_0x72d1('0xb')](_0x288362[_0x283775[_0x72d1('0xc')]])&&!_[_0x72d1('0xb')](_0x288362[_0x283775[_0x72d1('0xc')]][_0x72d1('0xd')])){_0x593c91=_[_0x72d1('0xe')](_0x288362[_0x283775[_0x72d1('0xc')]][_0x72d1('0xd')],'interval');}else if(!_[_0x72d1('0xb')](_0x283775[_0x72d1('0xf')])){_0x593c91=[_0x283775[_0x72d1('0xf')]];}return _0x593c91;}exports[_0x72d1('0x10')]=function(_0x22ac6f){_0x22ac6f[_0x72d1('0x11')]={};return new BPromise(function(_0x143718,_0x383bb){var _0x172fae={'Start':function(_0x3f190f){var _0x21c85e=this;return new Promise(function(_0x23a238,_0x8d458){if(_0x3f190f){try{var _0x491af4=[];var _0x46fa3d=getId(_0x3f190f['channel'],_0x3f190f[_0x72d1('0x12')]?_0x3f190f[_0x72d1('0x12')]['id']:0x0,_0x3f190f['interaction']?_0x3f190f[_0x72d1('0x13')]['id']:0x0);if(_0x3f190f[_0x72d1('0x14')]&&_[_0x72d1('0x15')](_0x3f190f['applications'])&&_0x3f190f['applications'][_0x72d1('0x16')]){for(var _0x10d464=0x0;_0x10d464<_0x3f190f[_0x72d1('0x14')][_0x72d1('0x16')];_0x10d464+=0x1){var _0x8d6890=_0x3f190f[_0x72d1('0x14')][_0x10d464];if(fs[_0x72d1('0x17')](path['join'](__dirname,_0x72d1('0x14'),_0x8d6890['app']+'.js'))){var _0x5b85cc=[];switch(_0x8d6890['app'][_0x72d1('0x18')]()){case _0x72d1('0x19'):var _0x573c98=_0x8d6890[_0x72d1('0x1a')][_0x72d1('0x1b')](',');if(_0x3f190f[_0x72d1('0x1c')]===_0x72d1('0x1d')){_0x5b85cc[_0x72d1('0x1e')](_0x573c98[0x0]);_0x5b85cc['push'](_0x573c98[0x1]);_0x5b85cc['push'](_0x573c98[_0x72d1('0x1f')](0x2,_0x573c98[_0x72d1('0x16')])[_0x72d1('0x20')](','));}else{_0x5b85cc[_0x72d1('0x1e')](_0x573c98[0x0]);_0x5b85cc[_0x72d1('0x1e')](_0x573c98[_0x72d1('0x1f')](0x1,_0x573c98[_0x72d1('0x16')])['join'](','));}break;case'dialogflow':var _0x1ba258=_0x8d6890['appdata'][_0x72d1('0x1b')](',');_0x5b85cc[_0x72d1('0x1e')](_0x1ba258[0x0]);_0x5b85cc[_0x72d1('0x1e')](_0x1ba258[0x1]);_0x5b85cc['push'](_0x1ba258[_0x72d1('0x1f')](0x2,_0x1ba258['length'])[_0x72d1('0x20')](','));break;case _0x72d1('0x21'):var _0x32588f=_0x8d6890[_0x72d1('0x1a')]['split'](',');_0x5b85cc[_0x72d1('0x1e')](_0x32588f[0x0]);_0x5b85cc['push'](_0x32588f[0x1]);_0x5b85cc[_0x72d1('0x1e')](_0x32588f[0x2]);_0x5b85cc[_0x72d1('0x1e')](_0x32588f[0x3]);_0x5b85cc['push'](_0x32588f[_0x72d1('0x1f')](0x4,_0x32588f[_0x72d1('0x16')])[_0x72d1('0x20')](','));break;case _0x72d1('0x22'):var _0x379c00=_0x8d6890['appdata'][_0x72d1('0x1b')](',');_0x5b85cc[_0x72d1('0x1e')](_0x379c00[0x0]);_0x5b85cc[_0x72d1('0x1e')](_0x379c00[0x1]);_0x5b85cc['push'](_0x379c00[0x2]);_0x5b85cc[_0x72d1('0x1e')](_0x379c00[0x3]);_0x5b85cc[_0x72d1('0x1e')](_0x379c00['slice'](0x4,_0x379c00[_0x72d1('0x16')])[_0x72d1('0x20')](','));break;case _0x72d1('0x12'):_0x5b85cc['push'](_0x8d6890[_0x72d1('0x1a')]);break;case'tag':_0x5b85cc[_0x72d1('0x1e')](_0x8d6890[_0x72d1('0x23')]);_0x5b85cc[_0x72d1('0x1e')](_0x8d6890[_0x72d1('0x1a')]);break;default:_0x5b85cc=_[_0x72d1('0xb')](_0x8d6890[_0x72d1('0x1a')])?[]:_0x8d6890[_0x72d1('0x1a')][_0x72d1('0x1b')](',');}var _0x4006b9={'id':util[_0x72d1('0x24')](_0x72d1('0x25'),_0x46fa3d,_0x8d6890['id'],_0x8d6890['app']),'condition':require(_0x72d1('0x26'))[_0x72d1('0x27')](_0x46fa3d,getIntervals(_0x22ac6f[_0x72d1('0x28')],_0x8d6890),_0x22ac6f),'consequence':require(_0x72d1('0x29')+_0x8d6890['app'])[_0x72d1('0x2a')](_0x46fa3d,_0x5b85cc,_0x22ac6f,_0x3f190f),'p':_0x8d6890[_0x72d1('0x2b')]||0x0};logger[_0x72d1('0x2c')]('Push\x20new\x20rule',_0x4006b9['id'],_0x72d1('0x2d'),getIntervals(_0x22ac6f[_0x72d1('0x28')],_0x8d6890)[_0x72d1('0x20')]('\x20|\x20'));_0x491af4[_0x72d1('0x1e')](_0x4006b9);}else{logger[_0x72d1('0x2e')](_0x72d1('0x2f'),path['join'](__dirname,_0x72d1('0x14'),_0x8d6890[_0x72d1('0x30')]+_0x72d1('0x31')));}}_0x22ac6f[_0x72d1('0x11')][_0x46fa3d]=new RuleEngine(_0x491af4);_0x22ac6f[_0x72d1('0x11')][_0x46fa3d][_0x72d1('0x32')](_0x3f190f,function(_0xd7ec0f){logger['info'](_0x72d1('0x33'),JSON[_0x72d1('0x34')](_0xd7ec0f[_0x72d1('0x35')]));if(_0x22ac6f[_0x72d1('0x11')][_0x46fa3d]){_0x22ac6f[_0x72d1('0x11')][_0x46fa3d][_0x72d1('0x36')](_0x72d1('0x37'));}});return _0x23a238({'code':0xc8,'message':_0x3f190f});}else{logger[_0x72d1('0x2c')]('No\x20applications\x20to\x20execute');return _0x23a238({'code':0xc8,'message':_0x3f190f});}}catch(_0x44d5b2){logger[_0x72d1('0x2e')](_0x44d5b2[_0x72d1('0x38')]);return _0x8d458(_0x21c85e[_0x72d1('0x2e')](0x1f4,_0x44d5b2));}}return _0x8d458(_0x72d1('0x39'));});},'AcceptMessage':function(_0x88b9b9){var _0xb911fa=this;return new Promise(function(_0x3620df,_0x5620f0){if(_0x88b9b9['agent']&&_0x88b9b9[_0x72d1('0x3a')]['id']){if(_0x22ac6f[_0x72d1('0x3b')][_0x88b9b9[_0x72d1('0x3a')]['id']]){_0x22ac6f[_0x72d1('0x3b')][_0x88b9b9['agent']['id']][_0x72d1('0x3c')]=![];_0x22ac6f[_0x72d1('0x3b')][_0x88b9b9['agent']['id']][_0x72d1('0x3d')]=undefined;}}if(_0x88b9b9['message']&&_0x88b9b9[_0x72d1('0x12')]['id']){try{var _0x281da1=getId(_0x88b9b9['channel'],_0x88b9b9[_0x72d1('0x12')]?_0x88b9b9['message']['id']:0x0,_0x88b9b9['interaction']?_0x88b9b9['interaction']['id']:0x0);if(_0x22ac6f[_0x72d1('0x11')][_0x281da1]){_0x22ac6f['rules'][_0x281da1][_0x72d1('0x36')](_0x72d1('0x3e'));if(rpc[_0x88b9b9[_0x72d1('0x1c')]+'QueueReport']){rpc[_0x88b9b9['channel']+_0x72d1('0x3f')]['update'](_0x281da1,{'UserId':_0x88b9b9['message'][_0x72d1('0x40')]})[_0x72d1('0x41')](function(_0x2d75cc){logger['error']('error\x20update\x20queue\x20report');});}}return _0x3620df({'code':0xc8,'message':_0x88b9b9});}catch(_0x52365c){logger['error'](_0x52365c[_0x72d1('0x38')]);return _0x5620f0(_0xb911fa[_0x72d1('0x2e')](0x1f4,_0x52365c));}}logger[_0x72d1('0x2e')](_0x72d1('0x42'));return _0x5620f0(_0xb911fa[_0x72d1('0x2e')](0x1f4,_0x72d1('0x42')));});},'RejectMessage':function(_0x1d1465){var _0x5924c=this;return new Promise(function(_0x1e2c11,_0x5f121f){if(_0x1d1465[_0x72d1('0x3a')]&&_0x1d1465[_0x72d1('0x3a')]['id']){try{if(_0x22ac6f[_0x72d1('0x3b')][_0x1d1465['agent']['id']]){_0x22ac6f[_0x72d1('0x3b')][_0x1d1465[_0x72d1('0x3a')]['id']][_0x72d1('0x3c')]=![];_0x22ac6f['agents'][_0x1d1465[_0x72d1('0x3a')]['id']][_0x72d1('0x3d')]=undefined;}return _0x1e2c11({'code':0xc8,'message':_0x1d1465});}catch(_0x343da3){logger[_0x72d1('0x2e')](_0x343da3['stack']);return _0x5f121f(_0x5924c['error'](0x1f4,_0x343da3));}}logger[_0x72d1('0x2e')](_0x72d1('0x42'));return _0x5f121f(_0x5924c[_0x72d1('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x402a04){var _0xee3c52=this;return new Promise(function(_0x32673e,_0x463670){if(_0x402a04[_0x72d1('0x1c')]&&_0x402a04[_0x72d1('0x13')]&&_0x402a04[_0x72d1('0x13')]['id']){try{var _0xebe855=getId(_0x402a04[_0x72d1('0x1c')],_0x402a04[_0x72d1('0x12')]?_0x402a04[_0x72d1('0x12')]['id']:0x0,_0x402a04['interaction']?_0x402a04[_0x72d1('0x13')]['id']:0x0);if(_0x22ac6f['rules'][_0xebe855]){_0x22ac6f['rules'][_0xebe855][_0x72d1('0x36')]('end');}return _0x32673e({'code':0xc8,'message':_0x402a04});}catch(_0x3c880e){logger[_0x72d1('0x2e')](_0x3c880e[_0x72d1('0x38')]);return _0x463670(_0xee3c52[_0x72d1('0x2e')](0x1f4,_0x3c880e));}}logger[_0x72d1('0x2e')](_0x72d1('0x42'));return _0x463670(_0xee3c52[_0x72d1('0x2e')](0x1f4,_0x72d1('0x42')));});},'AgentCapacity':function(_0x204699){var _0x189fec=this;return new Promise(function(_0x14f9de,_0x52102e){if(_0x22ac6f[_0x72d1('0x3b')][_0x72d1('0x43')](_0x204699['id'])){for(var _0x2e821c in _0x204699['capacity']){if(_0x204699['capacity'][_0x72d1('0x43')](_0x2e821c)){if(_0x22ac6f[_0x72d1('0x3b')][_0x204699['id']][_0x72d1('0x43')](_0x2e821c+_0x72d1('0x44'))){_0x22ac6f[_0x72d1('0x3b')][_0x204699['id']][_0x2e821c+'CurrentCapacity']=parseInt(_0x204699[_0x72d1('0x45')][_0x2e821c],0xa);}}}_0x22ac6f['agents'][_0x204699['id']][_0x72d1('0x46')]();return _0x14f9de({'code':0xc8,'message':_0x22ac6f[_0x72d1('0x3b')][_0x204699['id']]});}else{return _0x52102e(_0x189fec[_0x72d1('0x2e')](0x1f4,_0x72d1('0x47')));}});},'Agents':function(_0x2ff81f){return new Promise(function(_0x223321,_0x30a819){var _0x2f07c1=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x3b')]);_0x223321({'count':_0x2f07c1[_0x72d1('0x16')],'rows':_0x2f07c1});});},'ChatQueues':function(_0x13056c){return new Promise(function(_0x333020,_0x315774){var _0x40bf4e=[];for(var _0x229ae6 in _0x22ac6f[_0x72d1('0x49')]){if(_0x22ac6f['chatQueues'][_0x72d1('0x43')](_0x229ae6)){var _0x3dceb7=_0x22ac6f[_0x72d1('0x49')][_0x229ae6];var _0x277b06={'id':_0x3dceb7['id'],'available':_0x3dceb7[_0x72d1('0x4a')],'loggedIn':_0x3dceb7[_0x72d1('0x4b')],'name':_0x3dceb7['name'],'paused':_0x3dceb7[_0x72d1('0x4c')],'waiting':_0x3dceb7[_0x72d1('0x4d')]};_0x40bf4e[_0x72d1('0x1e')](_0x277b06);}}_0x333020({'count':_0x40bf4e['length'],'rows':_0x40bf4e});});},'MailQueues':function(_0x4f68bb){return new Promise(function(_0x1e4f2f,_0x5f4614){var _0x28896f=[];for(var _0x359176 in _0x22ac6f[_0x72d1('0x4e')]){if(_0x22ac6f[_0x72d1('0x4e')][_0x72d1('0x43')](_0x359176)){var _0x389f5c=_0x22ac6f[_0x72d1('0x4e')][_0x359176];var _0xdc5141={'id':_0x389f5c['id'],'available':_0x389f5c[_0x72d1('0x4a')],'loggedIn':_0x389f5c['loggedIn'],'name':_0x389f5c['name'],'paused':_0x389f5c[_0x72d1('0x4c')],'waiting':_0x389f5c[_0x72d1('0x4d')]};_0x28896f[_0x72d1('0x1e')](_0xdc5141);}}_0x1e4f2f({'count':_0x28896f['length'],'rows':_0x28896f});});},'OpenchannelQueues':function(_0x31bfda){return new Promise(function(_0x333671,_0x554eeb){var _0x39d7f9=[];for(var _0x5a8442 in _0x22ac6f[_0x72d1('0x4f')]){if(_0x22ac6f[_0x72d1('0x4f')][_0x72d1('0x43')](_0x5a8442)){var _0x34fe3b=_0x22ac6f[_0x72d1('0x4f')][_0x5a8442];var _0x7925ec={'id':_0x34fe3b['id'],'available':_0x34fe3b[_0x72d1('0x4a')],'loggedIn':_0x34fe3b[_0x72d1('0x4b')],'name':_0x34fe3b[_0x72d1('0x50')],'paused':_0x34fe3b[_0x72d1('0x4c')],'waiting':_0x34fe3b['waiting']};_0x39d7f9['push'](_0x7925ec);}}_0x333671({'count':_0x39d7f9[_0x72d1('0x16')],'rows':_0x39d7f9});});},'SmsQueues':function(_0x277d4b){return new Promise(function(_0x268194,_0x162e33){var _0x2ae8c9=[];for(var _0x5c5866 in _0x22ac6f[_0x72d1('0x51')]){if(_0x22ac6f[_0x72d1('0x51')]['hasOwnProperty'](_0x5c5866)){var _0x837b6b=_0x22ac6f['smsQueues'][_0x5c5866];var _0x475016={'id':_0x837b6b['id'],'available':_0x837b6b[_0x72d1('0x4a')],'loggedIn':_0x837b6b['loggedIn'],'name':_0x837b6b['name'],'paused':_0x837b6b[_0x72d1('0x4c')],'waiting':_0x837b6b[_0x72d1('0x4d')]};_0x2ae8c9[_0x72d1('0x1e')](_0x475016);}}_0x268194({'count':_0x2ae8c9[_0x72d1('0x16')],'rows':_0x2ae8c9});});},'FaxQueues':function(_0x3f17d0){return new Promise(function(_0x54388a,_0x27d3be){var _0x574b6e=[];for(var _0x2d24f0 in _0x22ac6f[_0x72d1('0x52')]){if(_0x22ac6f[_0x72d1('0x52')]['hasOwnProperty'](_0x2d24f0)){var _0x61b30b=_0x22ac6f['faxQueues'][_0x2d24f0];var _0x78efb8={'id':_0x61b30b['id'],'available':_0x61b30b[_0x72d1('0x4a')],'loggedIn':_0x61b30b['loggedIn'],'name':_0x61b30b[_0x72d1('0x50')],'paused':_0x61b30b[_0x72d1('0x4c')],'waiting':_0x61b30b['waiting']};_0x574b6e[_0x72d1('0x1e')](_0x78efb8);}}_0x54388a({'count':_0x574b6e[_0x72d1('0x16')],'rows':_0x574b6e});});},'WhatsappQueues':function(_0xfeeb18){return new Promise(function(_0x132a43,_0x4a52ec){var _0x5ba1eb=[];for(var _0x532298 in _0x22ac6f[_0x72d1('0x53')]){if(_0x22ac6f[_0x72d1('0x53')][_0x72d1('0x43')](_0x532298)){var _0x240159=_0x22ac6f[_0x72d1('0x53')][_0x532298];var _0x3de4a6={'id':_0x240159['id'],'available':_0x240159['available'],'loggedIn':_0x240159['loggedIn'],'name':_0x240159[_0x72d1('0x50')],'paused':_0x240159[_0x72d1('0x4c')],'waiting':_0x240159[_0x72d1('0x4d')]};_0x5ba1eb[_0x72d1('0x1e')](_0x3de4a6);}}_0x132a43({'count':_0x5ba1eb[_0x72d1('0x16')],'rows':_0x5ba1eb});});},'ChatQueuesWaitingInteractions':function(_0x422391){return new Promise(function(_0x50d377,_0x23f0e3){var _0x4511a4=_[_0x72d1('0x48')](_0x22ac6f['chatQueuesWaitingInteractions']);_0x50d377({'count':_0x4511a4[_0x72d1('0x16')],'rows':_0x4511a4});});},'MailQueuesWaitingInteractions':function(_0x3d63f7){return new Promise(function(_0x37489e,_0x3dd2c1){var _0x3cc6b0=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x54')]);_0x37489e({'count':_0x3cc6b0[_0x72d1('0x16')],'rows':_0x3cc6b0});});},'OpenchannelQueuesWaitingInteractions':function(_0x4f6135){return new Promise(function(_0x317ad4,_0x14530a){var _0x24f5eb=_[_0x72d1('0x48')](_0x22ac6f['openchannelQueuesWaitingInteractions']);_0x317ad4({'count':_0x24f5eb['length'],'rows':_0x24f5eb});});},'SmsQueuesWaitingInteractions':function(_0x19080a){return new Promise(function(_0x2932bb,_0x5020b7){var _0x41728d=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x55')]);_0x2932bb({'count':_0x41728d[_0x72d1('0x16')],'rows':_0x41728d});});},'FaxQueuesWaitingInteractions':function(_0x35b9bb){return new Promise(function(_0x1d1e22,_0x39c1e6){var _0xaacd06=_['values'](_0x22ac6f[_0x72d1('0x56')]);_0x1d1e22({'count':_0xaacd06[_0x72d1('0x16')],'rows':_0xaacd06});});},'WhatsappQueuesWaitingInteractions':function(_0x38bfd3){return new Promise(function(_0x3cbe00,_0x11b1a0){var _0x25e08f=_[_0x72d1('0x48')](_0x22ac6f[_0x72d1('0x57')]);_0x3cbe00({'count':_0x25e08f['length'],'rows':_0x25e08f});});}};var _0x47585e=jayson[_0x72d1('0x58')](_0x172fae)[_0x72d1('0x59')]();_0x47585e['on'](_0x72d1('0x2e'),function(_0x2330c7){logger[_0x72d1('0x2e')](JSON['stringify'](_0x2330c7));return _0x383bb(_0x2330c7);});_0x47585e[_0x72d1('0x10')](0x232c,_0x72d1('0x5a'),function(){console['log'](_0x72d1('0x5b'),0x232c);return _0x143718(_0x72d1('0x5c')+0x232c);});});}; \ No newline at end of file +var _0xe5d5=['interaction','applications','isArray','length','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflowv2','amazonlex','tag','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','name','paused','waiting','mailQueues','available','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','bluebird','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe5d5,0x156));var _0x5e5d=function(_0x16d316,_0x198875){_0x16d316=_0x16d316-0x0;var _0x4b7f7f=_0xe5d5[_0x16d316];return _0x4b7f7f;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x5e5d('0x0'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x5e5d('0x1'));var uuid=require('uuid');var config=require(_0x5e5d('0x2'));var logger=require('../../../config/logger')(_0x5e5d('0x3'));var rpc={'openchannelQueueReport':require(_0x5e5d('0x4')),'mailQueueReport':require(_0x5e5d('0x5')),'chatQueueReport':require(_0x5e5d('0x6')),'smsQueueReport':require(_0x5e5d('0x7')),'faxQueueReport':require(_0x5e5d('0x8')),'whatsappQueueReport':require(_0x5e5d('0x9'))};var RuleEngine=require(_0x5e5d('0xa'));function getId(_0x23de8d,_0x131a59,_0x11973c){return util[_0x5e5d('0xb')](_0x5e5d('0xc'),_0x23de8d,_0x131a59||0x0,_0x11973c||0x0);}function getIntervals(_0x5d3a3b,_0x59917b){var _0x32d041=[];if(!_['isNil'](_0x59917b[_0x5e5d('0xd')])&&!_[_0x5e5d('0xe')](_0x5d3a3b[_0x59917b['IntervalId']])&&!_[_0x5e5d('0xe')](_0x5d3a3b[_0x59917b[_0x5e5d('0xd')]][_0x5e5d('0xf')])){_0x32d041=_[_0x5e5d('0x10')](_0x5d3a3b[_0x59917b['IntervalId']]['Intervals'],_0x5e5d('0x11'));}else if(!_[_0x5e5d('0xe')](_0x59917b['interval'])){_0x32d041=[_0x59917b[_0x5e5d('0x11')]];}return _0x32d041;}exports[_0x5e5d('0x12')]=function(_0x5a4474){_0x5a4474[_0x5e5d('0x13')]={};return new BPromise(function(_0x3402cf,_0x5a5258){var _0x5a8457={'Start':function(_0x5bf617){var _0x1a3e5c=this;return new Promise(function(_0x3dfb7e,_0x79e8c1){if(_0x5bf617){try{var _0x1e2d44=[];var _0x566dab=getId(_0x5bf617[_0x5e5d('0x14')],_0x5bf617[_0x5e5d('0x15')]?_0x5bf617[_0x5e5d('0x15')]['id']:0x0,_0x5bf617[_0x5e5d('0x16')]?_0x5bf617[_0x5e5d('0x16')]['id']:0x0);if(_0x5bf617[_0x5e5d('0x17')]&&_[_0x5e5d('0x18')](_0x5bf617[_0x5e5d('0x17')])&&_0x5bf617['applications'][_0x5e5d('0x19')]){for(var _0x1ceea7=0x0;_0x1ceea7<_0x5bf617[_0x5e5d('0x17')][_0x5e5d('0x19')];_0x1ceea7+=0x1){var _0xd3b6d6=_0x5bf617[_0x5e5d('0x17')][_0x1ceea7];if(fs['existsSync'](path[_0x5e5d('0x1a')](__dirname,'applications',_0xd3b6d6[_0x5e5d('0x1b')]+_0x5e5d('0x1c')))){var _0x3c5dd0=[];switch(_0xd3b6d6['app'][_0x5e5d('0x1d')]()){case'autoreply':var _0x35b65a=_0xd3b6d6[_0x5e5d('0x1e')][_0x5e5d('0x1f')](',');if(_0x5bf617['channel']==='mail'){_0x3c5dd0[_0x5e5d('0x20')](_0x35b65a[0x0]);_0x3c5dd0[_0x5e5d('0x20')](_0x35b65a[0x1]);_0x3c5dd0['push'](_0x35b65a['slice'](0x2,_0x35b65a[_0x5e5d('0x19')])[_0x5e5d('0x1a')](','));}else{_0x3c5dd0[_0x5e5d('0x20')](_0x35b65a[0x0]);_0x3c5dd0['push'](_0x35b65a[_0x5e5d('0x21')](0x1,_0x35b65a['length'])[_0x5e5d('0x1a')](','));}break;case'dialogflow':var _0x15abf2=_0xd3b6d6[_0x5e5d('0x1e')][_0x5e5d('0x1f')](',');_0x3c5dd0[_0x5e5d('0x20')](_0x15abf2[0x0]);_0x3c5dd0[_0x5e5d('0x20')](_0x15abf2[0x1]);_0x3c5dd0[_0x5e5d('0x20')](_0x15abf2[_0x5e5d('0x21')](0x2,_0x15abf2['length'])[_0x5e5d('0x1a')](','));break;case _0x5e5d('0x22'):var _0x3442c1=_0xd3b6d6[_0x5e5d('0x1e')][_0x5e5d('0x1f')](',');_0x3c5dd0[_0x5e5d('0x20')](_0x3442c1[0x0]);_0x3c5dd0[_0x5e5d('0x20')](_0x3442c1[0x1]);_0x3c5dd0[_0x5e5d('0x20')](_0x3442c1[0x2]);_0x3c5dd0[_0x5e5d('0x20')](_0x3442c1[0x3]);_0x3c5dd0['push'](_0x3442c1[_0x5e5d('0x21')](0x4,_0x3442c1['length'])['join'](','));break;case _0x5e5d('0x23'):var _0x1f948b=_0xd3b6d6[_0x5e5d('0x1e')][_0x5e5d('0x1f')](',');_0x3c5dd0[_0x5e5d('0x20')](_0x1f948b[0x0]);_0x3c5dd0['push'](_0x1f948b[0x1]);_0x3c5dd0[_0x5e5d('0x20')](_0x1f948b[0x2]);_0x3c5dd0[_0x5e5d('0x20')](_0x1f948b[0x3]);_0x3c5dd0[_0x5e5d('0x20')](_0x1f948b[_0x5e5d('0x21')](0x4,_0x1f948b[_0x5e5d('0x19')])[_0x5e5d('0x1a')](','));break;case _0x5e5d('0x15'):_0x3c5dd0['push'](_0xd3b6d6[_0x5e5d('0x1e')]);break;case _0x5e5d('0x24'):_0x3c5dd0['push'](_0xd3b6d6['TagId']);_0x3c5dd0[_0x5e5d('0x20')](_0xd3b6d6[_0x5e5d('0x1e')]);break;default:_0x3c5dd0=_[_0x5e5d('0xe')](_0xd3b6d6[_0x5e5d('0x1e')])?[]:_0xd3b6d6[_0x5e5d('0x1e')][_0x5e5d('0x1f')](',');}var _0x5a5696={'id':util[_0x5e5d('0xb')]('%s:%s:%s',_0x566dab,_0xd3b6d6['id'],_0xd3b6d6[_0x5e5d('0x1b')]),'condition':require(_0x5e5d('0x25'))[_0x5e5d('0x26')](_0x566dab,getIntervals(_0x5a4474[_0x5e5d('0x27')],_0xd3b6d6),_0x5a4474),'consequence':require(_0x5e5d('0x28')+_0xd3b6d6['app'])[_0x5e5d('0x29')](_0x566dab,_0x3c5dd0,_0x5a4474,_0x5bf617),'p':_0xd3b6d6[_0x5e5d('0x2a')]||0x0};logger['info'](_0x5e5d('0x2b'),_0x5a5696['id'],'on\x20interval',getIntervals(_0x5a4474[_0x5e5d('0x27')],_0xd3b6d6)[_0x5e5d('0x1a')](_0x5e5d('0x2c')));_0x1e2d44[_0x5e5d('0x20')](_0x5a5696);}else{logger[_0x5e5d('0x2d')](_0x5e5d('0x2e'),path[_0x5e5d('0x1a')](__dirname,_0x5e5d('0x17'),_0xd3b6d6[_0x5e5d('0x1b')]+_0x5e5d('0x1c')));}}_0x5a4474[_0x5e5d('0x13')][_0x566dab]=new RuleEngine(_0x1e2d44);_0x5a4474[_0x5e5d('0x13')][_0x566dab]['execute'](_0x5bf617,function(_0x272150){logger[_0x5e5d('0x2f')](_0x5e5d('0x30'),JSON[_0x5e5d('0x31')](_0x272150[_0x5e5d('0x32')]));if(_0x5a4474[_0x5e5d('0x13')][_0x566dab]){_0x5a4474['rules'][_0x566dab][_0x5e5d('0x33')](_0x5e5d('0x34'));}});return _0x3dfb7e({'code':0xc8,'message':_0x5bf617});}else{logger['info'](_0x5e5d('0x35'));return _0x3dfb7e({'code':0xc8,'message':_0x5bf617});}}catch(_0x38698e){logger[_0x5e5d('0x2d')](_0x38698e[_0x5e5d('0x36')]);return _0x79e8c1(_0x1a3e5c[_0x5e5d('0x2d')](0x1f4,_0x38698e));}}return _0x79e8c1(_0x5e5d('0x37'));});},'AcceptMessage':function(_0x577faa){var _0x502aac=this;return new Promise(function(_0x1032bc,_0x58fe19){if(_0x577faa[_0x5e5d('0x38')]&&_0x577faa['agent']['id']){if(_0x5a4474['agents'][_0x577faa[_0x5e5d('0x38')]['id']]){_0x5a4474['agents'][_0x577faa['agent']['id']][_0x5e5d('0x39')]=![];_0x5a4474[_0x5e5d('0x3a')][_0x577faa[_0x5e5d('0x38')]['id']][_0x5e5d('0x3b')]=undefined;}}if(_0x577faa[_0x5e5d('0x15')]&&_0x577faa[_0x5e5d('0x15')]['id']){try{var _0x583e4f=getId(_0x577faa['channel'],_0x577faa['message']?_0x577faa[_0x5e5d('0x15')]['id']:0x0,_0x577faa['interaction']?_0x577faa[_0x5e5d('0x16')]['id']:0x0);if(_0x5a4474[_0x5e5d('0x13')][_0x583e4f]){_0x5a4474['rules'][_0x583e4f][_0x5e5d('0x33')](_0x5e5d('0x3c'));if(rpc[_0x577faa['channel']+_0x5e5d('0x3d')]){rpc[_0x577faa[_0x5e5d('0x14')]+_0x5e5d('0x3d')][_0x5e5d('0x3e')](_0x583e4f,{'UserId':_0x577faa[_0x5e5d('0x15')]['UserId']})[_0x5e5d('0x3f')](function(_0x404df8){logger[_0x5e5d('0x2d')](_0x5e5d('0x40'));});}}return _0x1032bc({'code':0xc8,'message':_0x577faa});}catch(_0x6bf443){logger[_0x5e5d('0x2d')](_0x6bf443[_0x5e5d('0x36')]);return _0x58fe19(_0x502aac[_0x5e5d('0x2d')](0x1f4,_0x6bf443));}}logger['error'](_0x5e5d('0x41'));return _0x58fe19(_0x502aac[_0x5e5d('0x2d')](0x1f4,_0x5e5d('0x41')));});},'RejectMessage':function(_0x5d6369){var _0x11159c=this;return new Promise(function(_0xd724a7,_0x5efa97){if(_0x5d6369[_0x5e5d('0x38')]&&_0x5d6369[_0x5e5d('0x38')]['id']){try{if(_0x5a4474[_0x5e5d('0x3a')][_0x5d6369['agent']['id']]){_0x5a4474[_0x5e5d('0x3a')][_0x5d6369[_0x5e5d('0x38')]['id']][_0x5e5d('0x39')]=![];_0x5a4474[_0x5e5d('0x3a')][_0x5d6369[_0x5e5d('0x38')]['id']]['busyQueue']=undefined;}return _0xd724a7({'code':0xc8,'message':_0x5d6369});}catch(_0x1e2738){logger['error'](_0x1e2738['stack']);return _0x5efa97(_0x11159c[_0x5e5d('0x2d')](0x1f4,_0x1e2738));}}logger['error'](_0x5e5d('0x41'));return _0x5efa97(_0x11159c[_0x5e5d('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3bf4c7){var _0x1a6160=this;return new Promise(function(_0x4f092e,_0x4f69ca){if(_0x3bf4c7[_0x5e5d('0x14')]&&_0x3bf4c7[_0x5e5d('0x16')]&&_0x3bf4c7['interaction']['id']){try{var _0x25065c=getId(_0x3bf4c7[_0x5e5d('0x14')],_0x3bf4c7[_0x5e5d('0x15')]?_0x3bf4c7['message']['id']:0x0,_0x3bf4c7[_0x5e5d('0x16')]?_0x3bf4c7[_0x5e5d('0x16')]['id']:0x0);if(_0x5a4474[_0x5e5d('0x13')][_0x25065c]){_0x5a4474['rules'][_0x25065c][_0x5e5d('0x33')](_0x5e5d('0x3c'));}return _0x4f092e({'code':0xc8,'message':_0x3bf4c7});}catch(_0x2764cf){logger['error'](_0x2764cf['stack']);return _0x4f69ca(_0x1a6160['error'](0x1f4,_0x2764cf));}}logger[_0x5e5d('0x2d')]('message\x20is\x20empty');return _0x4f69ca(_0x1a6160[_0x5e5d('0x2d')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1233e5){var _0x55a335=this;return new Promise(function(_0x3e32df,_0x183a48){if(_0x5a4474['agents'][_0x5e5d('0x42')](_0x1233e5['id'])){for(var _0x5584aa in _0x1233e5['capacity']){if(_0x1233e5['capacity'][_0x5e5d('0x42')](_0x5584aa)){if(_0x5a4474[_0x5e5d('0x3a')][_0x1233e5['id']]['hasOwnProperty'](_0x5584aa+_0x5e5d('0x43'))){_0x5a4474[_0x5e5d('0x3a')][_0x1233e5['id']][_0x5584aa+_0x5e5d('0x43')]=parseInt(_0x1233e5[_0x5e5d('0x44')][_0x5584aa],0xa);}}}_0x5a4474[_0x5e5d('0x3a')][_0x1233e5['id']][_0x5e5d('0x45')]();return _0x3e32df({'code':0xc8,'message':_0x5a4474['agents'][_0x1233e5['id']]});}else{return _0x183a48(_0x55a335[_0x5e5d('0x2d')](0x1f4,_0x5e5d('0x46')));}});},'Agents':function(_0x543739){return new Promise(function(_0x4ed2fb,_0x29a32c){var _0x1971d6=_[_0x5e5d('0x47')](_0x5a4474[_0x5e5d('0x3a')]);_0x4ed2fb({'count':_0x1971d6[_0x5e5d('0x19')],'rows':_0x1971d6});});},'ChatQueues':function(_0x5a80ed){return new Promise(function(_0x3ba251,_0x5bd936){var _0x50521b=[];for(var _0x46950c in _0x5a4474[_0x5e5d('0x48')]){if(_0x5a4474[_0x5e5d('0x48')][_0x5e5d('0x42')](_0x46950c)){var _0xf5ccbe=_0x5a4474['chatQueues'][_0x46950c];var _0x37b6bf={'id':_0xf5ccbe['id'],'available':_0xf5ccbe['available'],'loggedIn':_0xf5ccbe['loggedIn'],'name':_0xf5ccbe[_0x5e5d('0x49')],'paused':_0xf5ccbe[_0x5e5d('0x4a')],'waiting':_0xf5ccbe[_0x5e5d('0x4b')]};_0x50521b[_0x5e5d('0x20')](_0x37b6bf);}}_0x3ba251({'count':_0x50521b[_0x5e5d('0x19')],'rows':_0x50521b});});},'MailQueues':function(_0x3965f6){return new Promise(function(_0x49c4cc,_0x2d2063){var _0x34b114=[];for(var _0x3bc311 in _0x5a4474[_0x5e5d('0x4c')]){if(_0x5a4474[_0x5e5d('0x4c')]['hasOwnProperty'](_0x3bc311)){var _0x25c463=_0x5a4474[_0x5e5d('0x4c')][_0x3bc311];var _0xb3148e={'id':_0x25c463['id'],'available':_0x25c463[_0x5e5d('0x4d')],'loggedIn':_0x25c463[_0x5e5d('0x4e')],'name':_0x25c463[_0x5e5d('0x49')],'paused':_0x25c463['paused'],'waiting':_0x25c463['waiting']};_0x34b114[_0x5e5d('0x20')](_0xb3148e);}}_0x49c4cc({'count':_0x34b114[_0x5e5d('0x19')],'rows':_0x34b114});});},'OpenchannelQueues':function(_0x3b9e9c){return new Promise(function(_0x2eca48,_0x33c8b0){var _0x51d3f6=[];for(var _0x47e2ad in _0x5a4474[_0x5e5d('0x4f')]){if(_0x5a4474['openchannelQueues'][_0x5e5d('0x42')](_0x47e2ad)){var _0xa6212=_0x5a4474['openchannelQueues'][_0x47e2ad];var _0x92a71={'id':_0xa6212['id'],'available':_0xa6212[_0x5e5d('0x4d')],'loggedIn':_0xa6212['loggedIn'],'name':_0xa6212[_0x5e5d('0x49')],'paused':_0xa6212[_0x5e5d('0x4a')],'waiting':_0xa6212[_0x5e5d('0x4b')]};_0x51d3f6[_0x5e5d('0x20')](_0x92a71);}}_0x2eca48({'count':_0x51d3f6['length'],'rows':_0x51d3f6});});},'SmsQueues':function(_0x5f305a){return new Promise(function(_0x57728d,_0x3402f9){var _0x330c30=[];for(var _0x4bb8c8 in _0x5a4474['smsQueues']){if(_0x5a4474[_0x5e5d('0x50')][_0x5e5d('0x42')](_0x4bb8c8)){var _0xa99b8=_0x5a4474[_0x5e5d('0x50')][_0x4bb8c8];var _0x1b4238={'id':_0xa99b8['id'],'available':_0xa99b8[_0x5e5d('0x4d')],'loggedIn':_0xa99b8['loggedIn'],'name':_0xa99b8['name'],'paused':_0xa99b8[_0x5e5d('0x4a')],'waiting':_0xa99b8[_0x5e5d('0x4b')]};_0x330c30['push'](_0x1b4238);}}_0x57728d({'count':_0x330c30[_0x5e5d('0x19')],'rows':_0x330c30});});},'FaxQueues':function(_0x45bd02){return new Promise(function(_0x359a02,_0x308a85){var _0x34c8d3=[];for(var _0x19b345 in _0x5a4474[_0x5e5d('0x51')]){if(_0x5a4474[_0x5e5d('0x51')][_0x5e5d('0x42')](_0x19b345)){var _0x5a1dd8=_0x5a4474[_0x5e5d('0x51')][_0x19b345];var _0x53b2e4={'id':_0x5a1dd8['id'],'available':_0x5a1dd8[_0x5e5d('0x4d')],'loggedIn':_0x5a1dd8[_0x5e5d('0x4e')],'name':_0x5a1dd8[_0x5e5d('0x49')],'paused':_0x5a1dd8[_0x5e5d('0x4a')],'waiting':_0x5a1dd8['waiting']};_0x34c8d3[_0x5e5d('0x20')](_0x53b2e4);}}_0x359a02({'count':_0x34c8d3[_0x5e5d('0x19')],'rows':_0x34c8d3});});},'WhatsappQueues':function(_0x4c99a6){return new Promise(function(_0x5d887e,_0x59c7f1){var _0x4a4640=[];for(var _0x4b089b in _0x5a4474[_0x5e5d('0x52')]){if(_0x5a4474['whatsappQueues'][_0x5e5d('0x42')](_0x4b089b)){var _0x1192da=_0x5a4474[_0x5e5d('0x52')][_0x4b089b];var _0x14a117={'id':_0x1192da['id'],'available':_0x1192da['available'],'loggedIn':_0x1192da[_0x5e5d('0x4e')],'name':_0x1192da[_0x5e5d('0x49')],'paused':_0x1192da[_0x5e5d('0x4a')],'waiting':_0x1192da[_0x5e5d('0x4b')]};_0x4a4640[_0x5e5d('0x20')](_0x14a117);}}_0x5d887e({'count':_0x4a4640['length'],'rows':_0x4a4640});});},'ChatQueuesWaitingInteractions':function(_0x319922){return new Promise(function(_0x3e374d,_0x262790){var _0x1d1b63=_[_0x5e5d('0x47')](_0x5a4474[_0x5e5d('0x53')]);_0x3e374d({'count':_0x1d1b63[_0x5e5d('0x19')],'rows':_0x1d1b63});});},'MailQueuesWaitingInteractions':function(_0x383a30){return new Promise(function(_0x5825ca,_0x555e58){var _0x1a482a=_[_0x5e5d('0x47')](_0x5a4474[_0x5e5d('0x54')]);_0x5825ca({'count':_0x1a482a[_0x5e5d('0x19')],'rows':_0x1a482a});});},'OpenchannelQueuesWaitingInteractions':function(_0x5c9374){return new Promise(function(_0x855260,_0x269272){var _0xbebb50=_['values'](_0x5a4474['openchannelQueuesWaitingInteractions']);_0x855260({'count':_0xbebb50[_0x5e5d('0x19')],'rows':_0xbebb50});});},'SmsQueuesWaitingInteractions':function(_0x1b0843){return new Promise(function(_0x5af2eb,_0x4dcd3b){var _0x1c1837=_[_0x5e5d('0x47')](_0x5a4474[_0x5e5d('0x55')]);_0x5af2eb({'count':_0x1c1837['length'],'rows':_0x1c1837});});},'FaxQueuesWaitingInteractions':function(_0x96b120){return new Promise(function(_0x9e448e,_0x54e9b6){var _0x1b61d2=_['values'](_0x5a4474[_0x5e5d('0x56')]);_0x9e448e({'count':_0x1b61d2[_0x5e5d('0x19')],'rows':_0x1b61d2});});},'WhatsappQueuesWaitingInteractions':function(_0x5c34a3){return new Promise(function(_0xd29bb7,_0x14895c){var _0x2562ab=_[_0x5e5d('0x47')](_0x5a4474['whatsappQueuesWaitingInteractions']);_0xd29bb7({'count':_0x2562ab['length'],'rows':_0x2562ab});});}};var _0x7ef2ae=jayson[_0x5e5d('0x57')](_0x5a8457)[_0x5e5d('0x58')]();_0x7ef2ae['on'](_0x5e5d('0x2d'),function(_0x9ce6e8){logger[_0x5e5d('0x2d')](JSON[_0x5e5d('0x31')](_0x9ce6e8));return _0x5a5258(_0x9ce6e8);});_0x7ef2ae['listen'](0x232c,_0x5e5d('0x59'),function(){console['log'](_0x5e5d('0x5a'),0x232c);return _0x3402cf('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index eb80da1..d7b7923 100644 --- a/server/services/routing/server/interval.js +++ b/server/services/routing/server/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x392a=['result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','../../../config/logger','routing','client','http','then','error','message'];(function(_0x2af077,_0x498f4a){var _0x5f27a5=function(_0x1695c0){while(--_0x1695c0){_0x2af077['push'](_0x2af077['shift']());}};_0x5f27a5(++_0x498f4a);}(_0x392a,0xe0));var _0xa392=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x392a[_0x46698a];return _0x356db0;};'use strict';var util=require('util');var BPromise=require(_0xa392('0x0'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xa392('0x1'))(_0xa392('0x2'));var client=jayson[_0xa392('0x3')][_0xa392('0x4')]({'port':0x232a});function request(_0x1ad329,_0x48a9ca){return new BPromise(function(_0x253c7f,_0x3b2a35){return client['request'](_0x1ad329,_0x48a9ca)[_0xa392('0x5')](function(_0x4d16a9){if(_0x4d16a9[_0xa392('0x6')]){return _0x3b2a35(_0x4d16a9[_0xa392('0x6')][_0xa392('0x7')]);}else{return _0x253c7f(_0x4d16a9[_0xa392('0x8')]);}})[_0xa392('0x9')](function(_0x406dff){return _0x3b2a35(_0x406dff);});});}exports[_0xa392('0xa')]=function(_0x47f6a3,_0x18379c,_0x2aad18){return function(_0x319498){if(_0x2aad18['rules']&&!_0x2aad18['rules'][_0x47f6a3]){logger[_0xa392('0xb')](_0xa392('0xc'),_0x47f6a3);return _0x319498[_0xa392('0xd')]();}var _0x316722=[];for(var _0x4dd008=0x0;_0x4dd008<_0x18379c[_0xa392('0xe')];_0x4dd008+=0x1){_0x316722[_0xa392('0xf')](request(_0xa392('0x10'),{'command':util['format'](_0xa392('0x11'),_0x18379c[_0x4dd008])})[_0xa392('0x5')](function(_0x5bfada){return _0x5bfada&&_0x5bfada[_0xa392('0x7')]&&_0x5bfada[_0xa392('0x7')][_0xa392('0x12')](_0xa392('0x13'))>=0x0?!![]:![];})[_0xa392('0x9')](function(_0x5b9762){logger[_0xa392('0x6')](_0xa392('0x14'),_0x47f6a3,_0x18379c[_0x4dd008]);}));}BPromise[_0xa392('0x15')](_0x316722)[_0xa392('0x5')](function(_0x276f55){var _0x2de450=_[_0xa392('0x16')](_0x276f55);logger['info'](_0xa392('0x17'),_0x47f6a3,_0x18379c[_0xa392('0x18')]('\x20|\x20'),_0x2de450);_0x319498[_0xa392('0x19')](_0x2de450);})['catch'](function(_0x176b0b){console[_0xa392('0x1a')](_0x176b0b);logger[_0xa392('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x47f6a3,_0x18379c[_0xa392('0x18')](_0xa392('0x1b')),_0x176b0b[_0xa392('0x1c')]);_0x319498[_0xa392('0xd')]();});};}; \ No newline at end of file +var _0xa051=['routing','client','http','request','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','lodash','../../../config/logger'];(function(_0x1a4cdf,_0x14e563){var _0x4bbdc4=function(_0x2fef2f){while(--_0x2fef2f){_0x1a4cdf['push'](_0x1a4cdf['shift']());}};_0x4bbdc4(++_0x14e563);}(_0xa051,0xfc));var _0x1a05=function(_0x123c7e,_0x23d3b5){_0x123c7e=_0x123c7e-0x0;var _0x1f9cbc=_0xa051[_0x123c7e];return _0x1f9cbc;};'use strict';var util=require(_0x1a05('0x0'));var BPromise=require(_0x1a05('0x1'));var jayson=require('jayson/promise');var _=require(_0x1a05('0x2'));var logger=require(_0x1a05('0x3'))(_0x1a05('0x4'));var client=jayson[_0x1a05('0x5')][_0x1a05('0x6')]({'port':0x232a});function request(_0x611600,_0x26c0a0){return new BPromise(function(_0x40df68,_0x5b2341){return client[_0x1a05('0x7')](_0x611600,_0x26c0a0)['then'](function(_0x2642ae){if(_0x2642ae[_0x1a05('0x8')]){return _0x5b2341(_0x2642ae[_0x1a05('0x8')][_0x1a05('0x9')]);}else{return _0x40df68(_0x2642ae[_0x1a05('0xa')]);}})[_0x1a05('0xb')](function(_0x41d850){return _0x5b2341(_0x41d850);});});}exports[_0x1a05('0xc')]=function(_0x3cb48e,_0x2eed13,_0x10af0d){return function(_0x5c868b){if(_0x10af0d['rules']&&!_0x10af0d[_0x1a05('0xd')][_0x3cb48e]){logger[_0x1a05('0xe')](_0x1a05('0xf'),_0x3cb48e);return _0x5c868b[_0x1a05('0x10')]();}var _0x51730b=[];for(var _0x5c698b=0x0;_0x5c698b<_0x2eed13[_0x1a05('0x11')];_0x5c698b+=0x1){_0x51730b[_0x1a05('0x12')](request(_0x1a05('0x13'),{'command':util['format']('iftime\x20%s',_0x2eed13[_0x5c698b])})[_0x1a05('0x14')](function(_0x3ecf8e){return _0x3ecf8e&&_0x3ecf8e[_0x1a05('0x9')]&&_0x3ecf8e['message'][_0x1a05('0x15')](_0x1a05('0x16'))>=0x0?!![]:![];})[_0x1a05('0xb')](function(_0x27ad76){logger[_0x1a05('0x8')](_0x1a05('0x17'),_0x3cb48e,_0x2eed13[_0x5c698b]);}));}BPromise[_0x1a05('0x18')](_0x51730b)[_0x1a05('0x14')](function(_0x3e70e9){var _0x82e7cd=_[_0x1a05('0x19')](_0x3e70e9);logger[_0x1a05('0xe')](_0x1a05('0x1a'),_0x3cb48e,_0x2eed13[_0x1a05('0x1b')](_0x1a05('0x1c')),_0x82e7cd);_0x5c868b[_0x1a05('0x1d')](_0x82e7cd);})[_0x1a05('0xb')](function(_0x4d2dd1){console[_0x1a05('0x1e')](_0x4d2dd1);logger[_0x1a05('0x8')](_0x1a05('0x1a'),_0x3cb48e,_0x2eed13['join'](_0x1a05('0x1c')),_0x4d2dd1[_0x1a05('0x1f')]);_0x5c868b[_0x1a05('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a23fad1..d353d7a 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab06=['agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','[%s][agents][hangup]','./utils','info','format','uniqueid','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','then','type'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0xab06,0x197));var _0x6ab0=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xab06[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6ab0('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1ada99,_0x3276e4){utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1ada99[_0x6ab0('0x3')],_0x1ada99['channel'],_0x1ada99['queue'],_0x1ada99[_0x6ab0('0x4')],_0x1ada99[_0x6ab0('0x5')],_0x1ada99[_0x6ab0('0x6')],_0x1ada99[_0x6ab0('0x7')],_0x1ada99[_0x6ab0('0x8')]));if(_0x1ada99['queue']){utils[_0x6ab0('0x9')](_0x1ada99[_0x6ab0('0xa')])[_0x6ab0('0xb')](function(_0x5641d8){if(_0x5641d8){_0x1ada99[_0x6ab0('0xc')]=_0x5641d8[_0x6ab0('0xc')];_0x1ada99[_0x6ab0('0xd')]=_0x1ada99[_0x6ab0('0xe')]?_0x5641d8[_0x6ab0('0xf')]:![];_0x1ada99[_0x6ab0('0x10')]=_0x1ada99['agentacw']?_0x5641d8['acwTimeout']:0x0;}utils[_0x6ab0('0x11')](_0x6ab0('0x12'),_0x1ada99);});}else{utils[_0x6ab0('0x11')](_0x6ab0('0x12'),_0x1ada99);}if(_0x3276e4){delete transfers[_0x1ada99['uniqueid']];}else{delete agents[_0x1ada99[_0x6ab0('0x13')]];}}exports['agentcalled']=function(_0x6943c6){try{utils[_0x6ab0('0x14')](util['format'](_0x6ab0('0x15'),_0x6943c6[_0x6ab0('0x3')]),_0x6943c6);agents[_0x6943c6[_0x6ab0('0x13')]]=_0x6943c6;agents[_0x6943c6[_0x6ab0('0x13')]][_0x6ab0('0x16')]=utils[_0x6ab0('0x17')]();agents[_0x6943c6['destuniqueid']]['lastevent']=_0x6ab0('0x18');agents[_0x6943c6['destuniqueid']][_0x6ab0('0x7')]=null;agents[_0x6943c6[_0x6ab0('0x13')]]['connectedlinename']=null;utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x19'),_0x6943c6[_0x6ab0('0x3')],agents[_0x6943c6['destuniqueid']][_0x6ab0('0x4')],_0x6943c6[_0x6ab0('0x13')]));}catch(_0x1c2a98){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')]('[%s][agents][agentcalled]',_0x6943c6['uniqueid']),_0x1c2a98);}};exports[_0x6ab0('0x1b')]=function(_0x32129e){try{if(!_[_0x6ab0('0x1c')](agents[_0x32129e[_0x6ab0('0x13')]])){utils[_0x6ab0('0x14')](util['format']('[%s][agents][agentringnoanswer]',_0x32129e['uniqueid']),_0x32129e);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x1d'),_0x32129e['uniqueid'],agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x4')],_0x32129e['destuniqueid']));agents[_0x32129e['destuniqueid']][_0x6ab0('0x1b')]=!![];agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x1e')]=utils[_0x6ab0('0x17')]();agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x8')]=_0x6ab0('0x1f');agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x20')]='timeout';agents[_0x32129e[_0x6ab0('0x13')]][_0x6ab0('0x21')]=_0x32129e[_0x6ab0('0x22')]?parseInt(_0x32129e['ringtime'])/0x3e8:0x0;agents[_0x32129e['destuniqueid']]['talktime']=0x0;unanswered[_0x6ab0('0x23')](_0x32129e[_0x6ab0('0x13')]);}}catch(_0x64b2ea){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x24'),_0x32129e[_0x6ab0('0x3')]),_0x64b2ea);}};exports[_0x6ab0('0x25')]=function(_0x17a587){try{_[_0x6ab0('0x26')](agents,function(_0x50cdcf,_0x4bdddc){if(_0x50cdcf[_0x6ab0('0x3')]==_0x17a587[_0x6ab0('0x3')]&&!_[_0x6ab0('0x27')](unanswered,_0x50cdcf[_0x6ab0('0x13')])){utils[_0x6ab0('0x14')](util[_0x6ab0('0x2')](_0x6ab0('0x28'),_0x17a587[_0x6ab0('0x3')]),_0x17a587);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x17a587[_0x6ab0('0x3')],_0x50cdcf['membername'],_0x50cdcf['destuniqueid']));_0x50cdcf[_0x6ab0('0x1b')]=!![];_0x50cdcf['agentringnoanswerAt']=utils[_0x6ab0('0x17')]();_0x50cdcf[_0x6ab0('0x8')]=_0x6ab0('0x29');_0x50cdcf[_0x6ab0('0x20')]='abandoned';_0x50cdcf[_0x6ab0('0x21')]=_0x17a587['holdtime'];_0x50cdcf[_0x6ab0('0x2a')]=0x0;writeDB(_0x50cdcf);}});}catch(_0xd316c2){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')]('[%s][agents][queuecallerabandon]',_0x17a587[_0x6ab0('0x3')]),_0xd316c2);}};exports[_0x6ab0('0x2b')]=function(_0x2e9a89){try{if(agents[_0x2e9a89['destuniqueid']]){utils[_0x6ab0('0x14')](util['format'](_0x6ab0('0x2c'),_0x2e9a89[_0x6ab0('0x3')]),_0x2e9a89);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x2d'),_0x2e9a89[_0x6ab0('0x3')],agents[_0x2e9a89['destuniqueid']]['membername'],_0x2e9a89[_0x6ab0('0x13')]));agents[_0x2e9a89[_0x6ab0('0x13')]][_0x6ab0('0x2e')]=utils['now']();agents[_0x2e9a89['destuniqueid']][_0x6ab0('0x7')]=_0x2e9a89[_0x6ab0('0x7')];agents[_0x2e9a89[_0x6ab0('0x13')]]['connectedlinename']=_0x2e9a89['connectedlinename'];agents[_0x2e9a89[_0x6ab0('0x13')]][_0x6ab0('0x21')]=_0x2e9a89['ringtime'];agents[_0x2e9a89[_0x6ab0('0x13')]]['lastevent']=_0x6ab0('0x2f');_[_0x6ab0('0x26')](agents,function(_0x5a29b5,_0x5f5ae0){if(_0x5a29b5['destuniqueid']!=_0x2e9a89[_0x6ab0('0x13')]&&_0x5a29b5[_0x6ab0('0x3')]==_0x2e9a89[_0x6ab0('0x3')]){_0x5a29b5['talktime']=0x0;_0x5a29b5['holdtime']=_0x2e9a89[_0x6ab0('0x22')];_0x5a29b5[_0x6ab0('0x1b')]=!![];_0x5a29b5[_0x6ab0('0x1e')]=utils[_0x6ab0('0x17')]();_0x5a29b5[_0x6ab0('0x8')]=_0x6ab0('0x30');_0x5a29b5[_0x6ab0('0x20')]=_0x6ab0('0x30');_0x5a29b5[_0x6ab0('0x31')]=_0x2e9a89['destuniqueid'];_0x5a29b5[_0x6ab0('0x32')]=_0x2e9a89[_0x6ab0('0x4')];writeDB(_0x5a29b5);}});}}catch(_0x3695e6){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x2c'),_0x2e9a89[_0x6ab0('0x3')]),_0x3695e6);}};exports[_0x6ab0('0xe')]=function(_0x315a18){try{if(!_[_0x6ab0('0x1c')](agents[_0x315a18['destuniqueid']])){utils[_0x6ab0('0x14')](util[_0x6ab0('0x2')]('[%s][agents][agentcomplete]',_0x315a18[_0x6ab0('0x3')]),_0x315a18);utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x33'),_0x315a18[_0x6ab0('0x3')],agents[_0x315a18['destuniqueid']][_0x6ab0('0x4')],_0x315a18[_0x6ab0('0x13')]));agents[_0x315a18['destuniqueid']][_0x6ab0('0xe')]=!![];agents[_0x315a18[_0x6ab0('0x13')]]['agentcompleteAt']=utils[_0x6ab0('0x17')]();agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x2a')]=utils[_0x6ab0('0x34')](agents[_0x315a18[_0x6ab0('0x13')]]['agentcompleteAt'],agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x2e')]);agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x20')]=_0x315a18['reason'];agents[_0x315a18[_0x6ab0('0x13')]][_0x6ab0('0x8')]=_0x6ab0('0x35');writeDB(agents[_0x315a18[_0x6ab0('0x13')]]);}}catch(_0x5da028){utils[_0x6ab0('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x315a18[_0x6ab0('0x3')]),_0x5da028);}};exports[_0x6ab0('0x36')]=function(_0x28dbfa){try{if(!_[_0x6ab0('0x1c')](agents[_0x28dbfa[_0x6ab0('0x37')]])){utils[_0x6ab0('0x14')](util[_0x6ab0('0x2')](_0x6ab0('0x38'),_0x28dbfa[_0x6ab0('0x3')]),_0x28dbfa);utils['info'](util[_0x6ab0('0x2')](_0x6ab0('0x39'),_0x28dbfa[_0x6ab0('0x3')],agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x4')],agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3')]));agents[_0x28dbfa['transfereruniqueid']][_0x6ab0('0x3a')]=!![];agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3b')]=_0x6ab0('0x3c');agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3d')]=_0x28dbfa[_0x6ab0('0x3e')];agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3f')]=agents[_0x28dbfa[_0x6ab0('0x37')]][_0x6ab0('0x3')];}}catch(_0x44d42a){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x38'),_0x28dbfa['uniqueid']),_0x44d42a);}};exports['attendedtransfer']=function(_0x2b3508){try{utils[_0x6ab0('0x14')](util['format'](_0x6ab0('0x40'),_0x2b3508[_0x6ab0('0x41')]),_0x2b3508);if(_0x2b3508['origtransfereruniqueid']==_0x2b3508[_0x6ab0('0x42')]){if(!_['isNil'](agents[_0x2b3508['secondtransfereruniqueid']])){utils[_0x6ab0('0x1')](util['format'](_0x6ab0('0x43'),_0x2b3508[_0x6ab0('0x41')],agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x4')]));agents[_0x2b3508[_0x6ab0('0x44')]]['transfer']=!![];agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x3b')]=_0x6ab0('0x45');agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x3d')]=_0x2b3508[_0x6ab0('0x46')];agents[_0x2b3508['secondtransfereruniqueid']][_0x6ab0('0x3f')]=_0x2b3508[_0x6ab0('0x41')];}if(_0x2b3508['transfereeuniqueid']&&agents[_0x2b3508['transfereeuniqueid']]){agents[_0x2b3508[_0x6ab0('0x47')]][_0x6ab0('0x48')]=0x1;transfers[_0x2b3508[_0x6ab0('0x47')]]=_[_0x6ab0('0x49')](agents[_0x2b3508[_0x6ab0('0x47')]]);transfers[_0x2b3508['transfereeuniqueid']][_0x6ab0('0x6')]=agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x6')];transfers[_0x2b3508['transfereeuniqueid']][_0x6ab0('0x4a')]=agents[_0x2b3508[_0x6ab0('0x44')]][_0x6ab0('0x4a')];transfers[_0x2b3508[_0x6ab0('0x47')]][_0x6ab0('0x16')]=utils['now']();transfers[_0x2b3508['transfereeuniqueid']][_0x6ab0('0x2e')]=utils[_0x6ab0('0x17')]();transfers[_0x2b3508[_0x6ab0('0x47')]]['holdtime']=0x0;transfers[_0x2b3508[_0x6ab0('0x47')]][_0x6ab0('0x48')]=0x2;}}else if(_0x2b3508[_0x6ab0('0x44')]==_0x2b3508[_0x6ab0('0x4b')]){if(!_[_0x6ab0('0x1c')](agents[_0x2b3508['origtransfereruniqueid']])){utils[_0x6ab0('0x1')](util[_0x6ab0('0x2')](_0x6ab0('0x43'),_0x2b3508['origtransfereruniqueid'],agents[_0x2b3508['origtransfereruniqueid']][_0x6ab0('0x4')]));agents[_0x2b3508['origtransfereruniqueid']]['transfer']=!![];agents[_0x2b3508[_0x6ab0('0x41')]]['transfertype']=_0x6ab0('0x45');agents[_0x2b3508['origtransfereruniqueid']][_0x6ab0('0x3d')]=_0x2b3508['secondtransfererexten'];agents[_0x2b3508[_0x6ab0('0x41')]][_0x6ab0('0x3f')]=_0x2b3508[_0x6ab0('0x44')];}if(_0x2b3508['transfertargetuniqueid']&&agents[_0x2b3508[_0x6ab0('0x4c')]]){agents[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x48')]=0x1;transfers[_0x2b3508[_0x6ab0('0x4c')]]=_[_0x6ab0('0x49')](agents[_0x2b3508['transfertargetuniqueid']]);transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x6')]=agents[_0x2b3508[_0x6ab0('0x41')]][_0x6ab0('0x6')];transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x4a')]=agents[_0x2b3508[_0x6ab0('0x41')]]['calleridname'];transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x16')]=utils[_0x6ab0('0x17')]();transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x2e')]=utils[_0x6ab0('0x17')]();transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x21')]=0x0;transfers[_0x2b3508[_0x6ab0('0x4c')]][_0x6ab0('0x48')]=0x2;}}}catch(_0x5bcd49){utils[_0x6ab0('0x1a')](util['format'](_0x6ab0('0x40'),_0x2b3508['origtransfereruniqueid']),_0x5bcd49);}};exports['hangup']=function(_0x12226c){try{utils[_0x6ab0('0x14')](util['format']('[%s][agents][hangup]',_0x12226c[_0x6ab0('0x3')]),_0x12226c);if(agents[_0x12226c[_0x6ab0('0x3')]]&&agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]===_0x6ab0('0x1f')){if(_0x12226c[_0x6ab0('0x4d')]==='21'){agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]=_0x6ab0('0x4e');agents[_0x12226c['uniqueid']]['lastevent']='rejected';}utils[_0x6ab0('0x1')](util['format'](_0x6ab0('0x4f'),_0x12226c[_0x6ab0('0x3')],agents[_0x12226c['uniqueid']]['membername'],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]));writeDB(agents[_0x12226c[_0x6ab0('0x3')]]);var _0x1ebd96=unanswered[_0x6ab0('0x50')](_0x12226c[_0x6ab0('0x3')]);if(_0x1ebd96>-0x1){unanswered[_0x6ab0('0x51')](_0x1ebd96,0x1);}}if(transfers[_0x12226c[_0x6ab0('0x3')]]){transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0xe')]=!![];transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x52')]=utils[_0x6ab0('0x17')]();transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2a')]=utils[_0x6ab0('0x34')](transfers[_0x12226c['uniqueid']][_0x6ab0('0x52')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2e')]);transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]='agent';transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]=_0x6ab0('0x35');utils['info'](util[_0x6ab0('0x2')](_0x6ab0('0x4f'),_0x12226c[_0x6ab0('0x3')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x4')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')],transfers[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]));writeDB(transfers[_0x12226c[_0x6ab0('0x3')]],!![]);}if(agents[_0x12226c[_0x6ab0('0x3')]]&&agents[_0x12226c['uniqueid']][_0x6ab0('0x2e')]){agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0xe')]=!![];agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x52')]=utils['now']();agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2a')]=utils[_0x6ab0('0x34')](agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x52')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x2e')]);agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')]=agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x3a')]?_0x6ab0('0x3a'):'agent';agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]='complete';utils[_0x6ab0('0x1')](util['format'](_0x6ab0('0x4f'),_0x12226c[_0x6ab0('0x3')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x4')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x20')],agents[_0x12226c[_0x6ab0('0x3')]][_0x6ab0('0x8')]));writeDB(agents[_0x12226c[_0x6ab0('0x3')]]);}}catch(_0x4712d2){utils[_0x6ab0('0x1a')](util[_0x6ab0('0x2')](_0x6ab0('0x53'),_0x12226c[_0x6ab0('0x3')]),_0x4712d2);}}; \ No newline at end of file +var _0xcf36=['answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connect','forIn'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0xcf36,0x18a));var _0x6cf3=function(_0x3c0609,_0xb9d5a9){_0x3c0609=_0x3c0609-0x0;var _0xc19645=_0xcf36[_0x3c0609];return _0xc19645;};'use strict';var _=require(_0x6cf3('0x0'));var util=require(_0x6cf3('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5cb860,_0x47a324){utils[_0x6cf3('0x2')](util[_0x6cf3('0x3')](_0x6cf3('0x4'),_0x5cb860[_0x6cf3('0x5')],_0x5cb860['channel'],_0x5cb860[_0x6cf3('0x6')],_0x5cb860[_0x6cf3('0x7')],_0x5cb860[_0x6cf3('0x8')],_0x5cb860[_0x6cf3('0x9')],_0x5cb860['connectedlinenum'],_0x5cb860['lastevent']));if(_0x5cb860[_0x6cf3('0x6')]){utils[_0x6cf3('0xa')](_0x5cb860[_0x6cf3('0x6')])[_0x6cf3('0xb')](function(_0x5ca3c8){if(_0x5ca3c8){_0x5cb860[_0x6cf3('0xc')]=_0x5ca3c8[_0x6cf3('0xc')];_0x5cb860[_0x6cf3('0xd')]=_0x5cb860[_0x6cf3('0xe')]?_0x5ca3c8['acw']:![];_0x5cb860[_0x6cf3('0xf')]=_0x5cb860['agentacw']?_0x5ca3c8[_0x6cf3('0x10')]:0x0;}utils[_0x6cf3('0x11')]('CreateVoiceAgentReport',_0x5cb860);});}else{utils[_0x6cf3('0x11')](_0x6cf3('0x12'),_0x5cb860);}if(_0x47a324){delete transfers[_0x5cb860[_0x6cf3('0x5')]];}else{delete agents[_0x5cb860[_0x6cf3('0x13')]];}}exports[_0x6cf3('0x14')]=function(_0x531535){try{utils[_0x6cf3('0x15')](util[_0x6cf3('0x3')](_0x6cf3('0x16'),_0x531535[_0x6cf3('0x5')]),_0x531535);agents[_0x531535[_0x6cf3('0x13')]]=_0x531535;agents[_0x531535[_0x6cf3('0x13')]][_0x6cf3('0x17')]=utils[_0x6cf3('0x18')]();agents[_0x531535[_0x6cf3('0x13')]]['lastevent']=_0x6cf3('0x19');agents[_0x531535[_0x6cf3('0x13')]]['connectedlinenum']=null;agents[_0x531535['destuniqueid']][_0x6cf3('0x1a')]=null;utils['info'](util[_0x6cf3('0x3')](_0x6cf3('0x1b'),_0x531535[_0x6cf3('0x5')],agents[_0x531535[_0x6cf3('0x13')]][_0x6cf3('0x7')],_0x531535[_0x6cf3('0x13')]));}catch(_0x2c6f78){utils[_0x6cf3('0x1c')](util['format'](_0x6cf3('0x16'),_0x531535[_0x6cf3('0x5')]),_0x2c6f78);}};exports['agentringnoanswer']=function(_0x3c7fed){try{if(!_['isNil'](agents[_0x3c7fed[_0x6cf3('0x13')]])){utils[_0x6cf3('0x15')](util['format'](_0x6cf3('0x1d'),_0x3c7fed[_0x6cf3('0x5')]),_0x3c7fed);utils[_0x6cf3('0x2')](util['format'](_0x6cf3('0x1e'),_0x3c7fed[_0x6cf3('0x5')],agents[_0x3c7fed['destuniqueid']]['membername'],_0x3c7fed['destuniqueid']));agents[_0x3c7fed[_0x6cf3('0x13')]][_0x6cf3('0x1f')]=!![];agents[_0x3c7fed['destuniqueid']][_0x6cf3('0x20')]=utils[_0x6cf3('0x18')]();agents[_0x3c7fed[_0x6cf3('0x13')]][_0x6cf3('0x21')]=_0x6cf3('0x22');agents[_0x3c7fed[_0x6cf3('0x13')]][_0x6cf3('0x23')]=_0x6cf3('0x22');agents[_0x3c7fed[_0x6cf3('0x13')]][_0x6cf3('0x24')]=_0x3c7fed['ringtime']?parseInt(_0x3c7fed[_0x6cf3('0x25')])/0x3e8:0x0;agents[_0x3c7fed[_0x6cf3('0x13')]][_0x6cf3('0x26')]=0x0;unanswered[_0x6cf3('0x27')](_0x3c7fed[_0x6cf3('0x13')]);}}catch(_0x7337da){utils[_0x6cf3('0x1c')](util['format'](_0x6cf3('0x1d'),_0x3c7fed[_0x6cf3('0x5')]),_0x7337da);}};exports[_0x6cf3('0x28')]=function(_0x356ed7){try{_['forIn'](agents,function(_0x2fc4d0,_0x3834d2){if(_0x2fc4d0[_0x6cf3('0x5')]==_0x356ed7[_0x6cf3('0x5')]&&!_[_0x6cf3('0x29')](unanswered,_0x2fc4d0[_0x6cf3('0x13')])){utils[_0x6cf3('0x15')](util[_0x6cf3('0x3')](_0x6cf3('0x2a'),_0x356ed7[_0x6cf3('0x5')]),_0x356ed7);utils[_0x6cf3('0x2')](util[_0x6cf3('0x3')](_0x6cf3('0x2b'),_0x356ed7['uniqueid'],_0x2fc4d0[_0x6cf3('0x7')],_0x2fc4d0[_0x6cf3('0x13')]));_0x2fc4d0[_0x6cf3('0x1f')]=!![];_0x2fc4d0['agentringnoanswerAt']=utils[_0x6cf3('0x18')]();_0x2fc4d0['lastevent']=_0x6cf3('0x2c');_0x2fc4d0[_0x6cf3('0x23')]='abandoned';_0x2fc4d0['holdtime']=_0x356ed7['holdtime'];_0x2fc4d0[_0x6cf3('0x26')]=0x0;writeDB(_0x2fc4d0);}});}catch(_0x58847f){utils['error'](util['format']('[%s][agents][queuecallerabandon]',_0x356ed7[_0x6cf3('0x5')]),_0x58847f);}};exports[_0x6cf3('0x2d')]=function(_0x36e606){try{if(agents[_0x36e606[_0x6cf3('0x13')]]){utils[_0x6cf3('0x15')](util['format']('[%s][agents][agentconnect]',_0x36e606['uniqueid']),_0x36e606);utils['info'](util['format'](_0x6cf3('0x2e'),_0x36e606['uniqueid'],agents[_0x36e606[_0x6cf3('0x13')]]['membername'],_0x36e606[_0x6cf3('0x13')]));agents[_0x36e606[_0x6cf3('0x13')]][_0x6cf3('0x2f')]=utils[_0x6cf3('0x18')]();agents[_0x36e606[_0x6cf3('0x13')]][_0x6cf3('0x30')]=_0x36e606['connectedlinenum'];agents[_0x36e606[_0x6cf3('0x13')]][_0x6cf3('0x1a')]=_0x36e606[_0x6cf3('0x1a')];agents[_0x36e606['destuniqueid']][_0x6cf3('0x24')]=_0x36e606['ringtime'];agents[_0x36e606['destuniqueid']][_0x6cf3('0x21')]=_0x6cf3('0x31');_[_0x6cf3('0x32')](agents,function(_0x338563,_0x4fde82){if(_0x338563[_0x6cf3('0x13')]!=_0x36e606[_0x6cf3('0x13')]&&_0x338563[_0x6cf3('0x5')]==_0x36e606[_0x6cf3('0x5')]){_0x338563['talktime']=0x0;_0x338563[_0x6cf3('0x24')]=_0x36e606[_0x6cf3('0x25')];_0x338563[_0x6cf3('0x1f')]=!![];_0x338563[_0x6cf3('0x20')]=utils[_0x6cf3('0x18')]();_0x338563['lastevent']=_0x6cf3('0x33');_0x338563[_0x6cf3('0x23')]=_0x6cf3('0x33');_0x338563[_0x6cf3('0x34')]=_0x36e606['destuniqueid'];_0x338563[_0x6cf3('0x35')]=_0x36e606[_0x6cf3('0x7')];writeDB(_0x338563);}});}}catch(_0x3a3d5b){utils['error'](util[_0x6cf3('0x3')](_0x6cf3('0x36'),_0x36e606[_0x6cf3('0x5')]),_0x3a3d5b);}};exports['agentcomplete']=function(_0x507cda){try{if(!_['isNil'](agents[_0x507cda['destuniqueid']])){utils[_0x6cf3('0x15')](util[_0x6cf3('0x3')]('[%s][agents][agentcomplete]',_0x507cda['uniqueid']),_0x507cda);utils['info'](util[_0x6cf3('0x3')](_0x6cf3('0x37'),_0x507cda[_0x6cf3('0x5')],agents[_0x507cda[_0x6cf3('0x13')]]['membername'],_0x507cda['destuniqueid']));agents[_0x507cda[_0x6cf3('0x13')]][_0x6cf3('0xe')]=!![];agents[_0x507cda[_0x6cf3('0x13')]][_0x6cf3('0x38')]=utils[_0x6cf3('0x18')]();agents[_0x507cda[_0x6cf3('0x13')]][_0x6cf3('0x26')]=utils['diffTime'](agents[_0x507cda[_0x6cf3('0x13')]][_0x6cf3('0x38')],agents[_0x507cda[_0x6cf3('0x13')]][_0x6cf3('0x2f')]);agents[_0x507cda[_0x6cf3('0x13')]][_0x6cf3('0x23')]=_0x507cda[_0x6cf3('0x23')];agents[_0x507cda['destuniqueid']]['lastevent']=_0x6cf3('0x39');writeDB(agents[_0x507cda[_0x6cf3('0x13')]]);}}catch(_0x37ad19){utils[_0x6cf3('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x507cda['uniqueid']),_0x37ad19);}};exports['blindtransfer']=function(_0x5b2877){try{if(!_[_0x6cf3('0x3a')](agents[_0x5b2877[_0x6cf3('0x3b')]])){utils['debug'](util[_0x6cf3('0x3')](_0x6cf3('0x3c'),_0x5b2877[_0x6cf3('0x5')]),_0x5b2877);utils[_0x6cf3('0x2')](util['format'](_0x6cf3('0x3d'),_0x5b2877[_0x6cf3('0x5')],agents[_0x5b2877[_0x6cf3('0x3b')]][_0x6cf3('0x7')],agents[_0x5b2877[_0x6cf3('0x3b')]][_0x6cf3('0x5')]));agents[_0x5b2877[_0x6cf3('0x3b')]][_0x6cf3('0x3e')]=!![];agents[_0x5b2877[_0x6cf3('0x3b')]]['transfertype']=_0x6cf3('0x3f');agents[_0x5b2877[_0x6cf3('0x3b')]]['transferexten']=_0x5b2877[_0x6cf3('0x40')];agents[_0x5b2877['transfereruniqueid']][_0x6cf3('0x41')]=agents[_0x5b2877[_0x6cf3('0x3b')]][_0x6cf3('0x5')];}}catch(_0x4cf72e){utils[_0x6cf3('0x1c')](util[_0x6cf3('0x3')](_0x6cf3('0x3c'),_0x5b2877['uniqueid']),_0x4cf72e);}};exports[_0x6cf3('0x42')]=function(_0x4fadcb){try{utils[_0x6cf3('0x15')](util[_0x6cf3('0x3')](_0x6cf3('0x43'),_0x4fadcb[_0x6cf3('0x44')]),_0x4fadcb);if(_0x4fadcb[_0x6cf3('0x44')]==_0x4fadcb[_0x6cf3('0x45')]){if(!_['isNil'](agents[_0x4fadcb[_0x6cf3('0x46')]])){utils[_0x6cf3('0x2')](util['format'](_0x6cf3('0x47'),_0x4fadcb[_0x6cf3('0x44')],agents[_0x4fadcb[_0x6cf3('0x46')]][_0x6cf3('0x7')]));agents[_0x4fadcb['secondtransfereruniqueid']][_0x6cf3('0x3e')]=!![];agents[_0x4fadcb['secondtransfereruniqueid']]['transfertype']=_0x6cf3('0x48');agents[_0x4fadcb[_0x6cf3('0x46')]][_0x6cf3('0x49')]=_0x4fadcb[_0x6cf3('0x4a')];agents[_0x4fadcb[_0x6cf3('0x46')]][_0x6cf3('0x41')]=_0x4fadcb['origtransfereruniqueid'];}if(_0x4fadcb[_0x6cf3('0x4b')]&&agents[_0x4fadcb[_0x6cf3('0x4b')]]){agents[_0x4fadcb['transfereeuniqueid']][_0x6cf3('0x4c')]=0x1;transfers[_0x4fadcb[_0x6cf3('0x4b')]]=_['clone'](agents[_0x4fadcb[_0x6cf3('0x4b')]]);transfers[_0x4fadcb[_0x6cf3('0x4b')]][_0x6cf3('0x9')]=agents[_0x4fadcb[_0x6cf3('0x46')]][_0x6cf3('0x9')];transfers[_0x4fadcb[_0x6cf3('0x4b')]][_0x6cf3('0x4d')]=agents[_0x4fadcb[_0x6cf3('0x46')]][_0x6cf3('0x4d')];transfers[_0x4fadcb[_0x6cf3('0x4b')]][_0x6cf3('0x17')]=utils['now']();transfers[_0x4fadcb[_0x6cf3('0x4b')]]['agentconnectAt']=utils[_0x6cf3('0x18')]();transfers[_0x4fadcb['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x4fadcb[_0x6cf3('0x4b')]][_0x6cf3('0x4c')]=0x2;}}else if(_0x4fadcb[_0x6cf3('0x46')]==_0x4fadcb[_0x6cf3('0x4e')]){if(!_['isNil'](agents[_0x4fadcb[_0x6cf3('0x44')]])){utils['info'](util[_0x6cf3('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x4fadcb[_0x6cf3('0x44')],agents[_0x4fadcb['origtransfereruniqueid']][_0x6cf3('0x7')]));agents[_0x4fadcb[_0x6cf3('0x44')]][_0x6cf3('0x3e')]=!![];agents[_0x4fadcb[_0x6cf3('0x44')]]['transfertype']='ATTENDED';agents[_0x4fadcb[_0x6cf3('0x44')]][_0x6cf3('0x49')]=_0x4fadcb[_0x6cf3('0x4f')];agents[_0x4fadcb[_0x6cf3('0x44')]]['transferuniqueid']=_0x4fadcb[_0x6cf3('0x46')];}if(_0x4fadcb[_0x6cf3('0x50')]&&agents[_0x4fadcb['transfertargetuniqueid']]){agents[_0x4fadcb[_0x6cf3('0x50')]][_0x6cf3('0x4c')]=0x1;transfers[_0x4fadcb['transfertargetuniqueid']]=_['clone'](agents[_0x4fadcb[_0x6cf3('0x50')]]);transfers[_0x4fadcb['transfertargetuniqueid']][_0x6cf3('0x9')]=agents[_0x4fadcb[_0x6cf3('0x44')]]['calleridnum'];transfers[_0x4fadcb[_0x6cf3('0x50')]][_0x6cf3('0x4d')]=agents[_0x4fadcb['origtransfereruniqueid']][_0x6cf3('0x4d')];transfers[_0x4fadcb[_0x6cf3('0x50')]][_0x6cf3('0x17')]=utils[_0x6cf3('0x18')]();transfers[_0x4fadcb[_0x6cf3('0x50')]][_0x6cf3('0x2f')]=utils['now']();transfers[_0x4fadcb[_0x6cf3('0x50')]][_0x6cf3('0x24')]=0x0;transfers[_0x4fadcb[_0x6cf3('0x50')]][_0x6cf3('0x4c')]=0x2;}}}catch(_0x399afa){utils['error'](util['format'](_0x6cf3('0x43'),_0x4fadcb[_0x6cf3('0x44')]),_0x399afa);}};exports[_0x6cf3('0x51')]=function(_0x23a879){try{utils[_0x6cf3('0x15')](util[_0x6cf3('0x3')]('[%s][agents][hangup]',_0x23a879[_0x6cf3('0x5')]),_0x23a879);if(agents[_0x23a879['uniqueid']]&&agents[_0x23a879[_0x6cf3('0x5')]]['reason']===_0x6cf3('0x22')){if(_0x23a879['cause']==='21'){agents[_0x23a879[_0x6cf3('0x5')]]['reason']=_0x6cf3('0x52');agents[_0x23a879[_0x6cf3('0x5')]]['lastevent']='rejected';}utils[_0x6cf3('0x2')](util[_0x6cf3('0x3')](_0x6cf3('0x53'),_0x23a879['uniqueid'],agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x7')],agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x23')],agents[_0x23a879['uniqueid']][_0x6cf3('0x21')]));writeDB(agents[_0x23a879[_0x6cf3('0x5')]]);var _0x1faef7=unanswered[_0x6cf3('0x54')](_0x23a879[_0x6cf3('0x5')]);if(_0x1faef7>-0x1){unanswered[_0x6cf3('0x55')](_0x1faef7,0x1);}}if(transfers[_0x23a879[_0x6cf3('0x5')]]){transfers[_0x23a879['uniqueid']][_0x6cf3('0xe')]=!![];transfers[_0x23a879['uniqueid']][_0x6cf3('0x38')]=utils['now']();transfers[_0x23a879[_0x6cf3('0x5')]]['talktime']=utils[_0x6cf3('0x56')](transfers[_0x23a879[_0x6cf3('0x5')]]['agentcompleteAt'],transfers[_0x23a879['uniqueid']][_0x6cf3('0x2f')]);transfers[_0x23a879['uniqueid']][_0x6cf3('0x23')]=_0x6cf3('0x57');transfers[_0x23a879[_0x6cf3('0x5')]]['lastevent']=_0x6cf3('0x39');utils[_0x6cf3('0x2')](util['format'](_0x6cf3('0x53'),_0x23a879[_0x6cf3('0x5')],transfers[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x7')],transfers[_0x23a879[_0x6cf3('0x5')]]['reason'],transfers[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x21')]));writeDB(transfers[_0x23a879[_0x6cf3('0x5')]],!![]);}if(agents[_0x23a879[_0x6cf3('0x5')]]&&agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x2f')]){agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0xe')]=!![];agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x38')]=utils[_0x6cf3('0x18')]();agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x26')]=utils[_0x6cf3('0x56')](agents[_0x23a879['uniqueid']]['agentcompleteAt'],agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x2f')]);agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x23')]=agents[_0x23a879['uniqueid']][_0x6cf3('0x3e')]?'transfer':_0x6cf3('0x57');agents[_0x23a879[_0x6cf3('0x5')]]['lastevent']=_0x6cf3('0x39');utils[_0x6cf3('0x2')](util[_0x6cf3('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x23a879['uniqueid'],agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x7')],agents[_0x23a879[_0x6cf3('0x5')]]['reason'],agents[_0x23a879[_0x6cf3('0x5')]][_0x6cf3('0x21')]));writeDB(agents[_0x23a879[_0x6cf3('0x5')]]);}}catch(_0x2f6cf1){utils[_0x6cf3('0x1c')](util['format'](_0x6cf3('0x58'),_0x23a879[_0x6cf3('0x5')]),_0x2f6cf1);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 797e868..c89c2a5 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9e9=['set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface','calleridnum','connectedlinenum','getUserByInternal','then','request','CreateVoiceCallReport','debug','format','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','channelstate','hangup','callerid','calleridname','cause-txt','duration','diffTime','starttime','billableseconds','answertime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','xmd-originatecalleridnum','value','variable','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xe9e9,0x1c1));var _0x9e9e=function(_0x447779,_0x279ecd){_0x447779=_0x447779-0x0;var _0x122a93=_0xe9e9[_0x447779];return _0x122a93;};'use strict';var _=require(_0x9e9e('0x0'));var util=require(_0x9e9e('0x1'));var utils=require(_0x9e9e('0x2'));var transfers=require(_0x9e9e('0x3'));var dispositions=[_0x9e9e('0x4'),_0x9e9e('0x5'),_0x9e9e('0x5'),_0x9e9e('0x4'),_0x9e9e('0x4'),_0x9e9e('0x4'),_0x9e9e('0x6'),_0x9e9e('0x7'),'FAILED',_0x9e9e('0x5'),_0x9e9e('0x5')];var channels={};function writeDB(_0x5e0d08){var _0x116526;if(transfers[_0x9e9e('0x8')][_0x5e0d08[_0x9e9e('0x9')]]){_0x116526=_0x5e0d08[_0x9e9e('0x9')];_0x5e0d08['uniqueid']=transfers[_0x9e9e('0x8')][_0x5e0d08[_0x9e9e('0x9')]][_0x9e9e('0xa')];}utils['info'](util['format'](_0x9e9e('0xb'),_0x5e0d08[_0x9e9e('0x9')],_0x5e0d08['channel'],_0x5e0d08[_0x9e9e('0xc')],_0x5e0d08['membername'],_0x5e0d08[_0x9e9e('0xd')],_0x5e0d08[_0x9e9e('0xe')],_0x5e0d08[_0x9e9e('0xf')],_0x5e0d08['lastevent']));if(_0x5e0d08['accountcode']){utils[_0x9e9e('0x10')](_0x5e0d08['accountcode'])[_0x9e9e('0x11')](function(_0x4f208c){if(_0x4f208c){_0x5e0d08['UserId']=_0x4f208c['id'];}utils[_0x9e9e('0x12')](_0x9e9e('0x13'),_0x5e0d08);});}else{utils[_0x9e9e('0x12')]('CreateVoiceCallReport',_0x5e0d08);}if(channels[_0x5e0d08[_0x9e9e('0x9')]]){delete channels[_0x5e0d08['uniqueid']];}else if(_0x116526&&channels[_0x116526]){delete transfers[_0x9e9e('0x8')][_0x116526];delete channels[_0x116526];}}exports['newchannel']=function(_0x1916b2){try{utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x16'),_0x1916b2[_0x9e9e('0x9')]),_0x1916b2);if(_0x1916b2[_0x9e9e('0x9')]==_0x1916b2[_0x9e9e('0x17')]&&_0x1916b2[_0x9e9e('0x18')]!=_0x9e9e('0x19')){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x1b'),_0x1916b2[_0x9e9e('0x9')],_0x1916b2[_0x9e9e('0x1c')],_0x1916b2[_0x9e9e('0x1d')]));channels[_0x1916b2[_0x9e9e('0x9')]]={'uniqueid':_0x1916b2[_0x9e9e('0x9')],'accountcode':_0x1916b2[_0x9e9e('0x1e')],'source':_0x1916b2['calleridnum'],'destination':_0x1916b2[_0x9e9e('0x1d')],'destinationcontext':_0x1916b2['context'],'channel':_0x1916b2['channel'],'starttime':utils[_0x9e9e('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x9e9e('0x20')};}}catch(_0xdf2749){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x16'),_0x1916b2[_0x9e9e('0x9')]),_0xdf2749);}};exports[_0x9e9e('0x22')]=function(_0x2e7ebf){try{utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x23'),_0x2e7ebf[_0x9e9e('0x9')]),_0x2e7ebf);if(!_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x9')]])&&_0x2e7ebf['channelstate']==0x6){utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x25'),_0x2e7ebf[_0x9e9e('0x9')],_0x2e7ebf[_0x9e9e('0x1c')],_0x2e7ebf[_0x9e9e('0x18')]));if(_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x9')]]['systemanswertime'])){channels[_0x2e7ebf[_0x9e9e('0x9')]][_0x9e9e('0x26')]=utils[_0x9e9e('0x1f')]();}}else if(!_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x17')]])&&_0x2e7ebf['channelstate']==0x6&&_0x2e7ebf['context']!=_0x9e9e('0x27')){utils['info'](util['format'](_0x9e9e('0x28'),_0x2e7ebf['uniqueid'],_0x2e7ebf[_0x9e9e('0x17')],_0x2e7ebf['context'],_0x2e7ebf[_0x9e9e('0x18')]));channels[_0x2e7ebf['linkedid']][_0x9e9e('0x1e')]=_0x2e7ebf[_0x9e9e('0x1e')];channels[_0x2e7ebf[_0x9e9e('0x17')]][_0x9e9e('0x29')]=_0x2e7ebf[_0x9e9e('0x18')];if(_[_0x9e9e('0x24')](channels[_0x2e7ebf[_0x9e9e('0x17')]]['answertime'])){channels[_0x2e7ebf[_0x9e9e('0x17')]]['answertime']=utils[_0x9e9e('0x1f')]();}channels[_0x2e7ebf['linkedid']][_0x9e9e('0x2a')]=dispositions[_['toNumber'](_0x2e7ebf[_0x9e9e('0x2b')])]||_0x9e9e('0x6');}}catch(_0x1ea4bb){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x23'),_0x2e7ebf[_0x9e9e('0x9')]),_0x1ea4bb);}};exports[_0x9e9e('0x2c')]=function(_0x205553){try{if(!_[_0x9e9e('0x24')](channels[_0x205553[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')]('[%s][calls][hangup]',_0x205553[_0x9e9e('0x9')]),_0x205553);if(_[_0x9e9e('0x24')](channels[_0x205553['uniqueid']][_0x9e9e('0x2d')])){channels[_0x205553['uniqueid']][_0x9e9e('0x2d')]=_0x205553[_0x9e9e('0x2e')]+'\x20<'+_0x205553['calleridnum']+'>';}utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x205553[_0x9e9e('0x9')],channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x2d')],_0x205553[_0x9e9e('0x2f')]));channels[_0x205553[_0x9e9e('0x9')]]['endtime']=utils[_0x9e9e('0x1f')]();channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x30')]=utils[_0x9e9e('0x31')](channels[_0x205553[_0x9e9e('0x9')]]['endtime'],channels[_0x205553['uniqueid']][_0x9e9e('0x32')]);channels[_0x205553['uniqueid']][_0x9e9e('0x33')]=channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x34')]?utils[_0x9e9e('0x31')](channels[_0x205553[_0x9e9e('0x9')]]['endtime'],channels[_0x205553[_0x9e9e('0x9')]][_0x9e9e('0x34')]):0x0;writeDB(channels[_0x205553[_0x9e9e('0x9')]]);}}catch(_0x183912){utils['error'](util[_0x9e9e('0x15')]('[%s][calls][hangup]',_0x205553['uniqueid']),_0x183912);}};exports[_0x9e9e('0x35')]=function(_0x154cae){try{if(!_['isNil'](channels[_0x154cae['localtwolinkedid']])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x36'),_0x154cae[_0x9e9e('0x37')]),_0x154cae);if(channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x18')]==_0x154cae[_0x9e9e('0x39')]){utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x3a'),_0x154cae['origtransfereruniqueid'],_0x154cae['localtwolinkedid'],_0x154cae[_0x9e9e('0x3b')]));channels[_0x154cae['localtwolinkedid']][_0x9e9e('0x29')]=_0x154cae[_0x9e9e('0x3b')];channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x3c')]=_0x9e9e('0x3d');}else if(channels[_0x154cae['localtwolinkedid']][_0x9e9e('0x18')]=_0x154cae[_0x9e9e('0x3e')]){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x154cae['origtransfereruniqueid'],_0x154cae[_0x9e9e('0x38')],_0x154cae[_0x9e9e('0x3f')]));channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x29')]=_0x154cae[_0x9e9e('0x3f')];channels[_0x154cae[_0x9e9e('0x38')]][_0x9e9e('0x3c')]=_0x9e9e('0x3d');}}}catch(_0x4f76e7){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x36'),_0x154cae[_0x9e9e('0x37')]),_0x4f76e7);}};exports[_0x9e9e('0x40')]=function(_0x111fe7){try{if(!_['isNil'](channels[_0x111fe7[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')]('[%s][calls][musiconholdstart]',_0x111fe7[_0x9e9e('0x9')]),_0x111fe7);channels[_0x111fe7[_0x9e9e('0x9')]][_0x9e9e('0x41')]=utils[_0x9e9e('0x1f')]();utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x42'),_0x111fe7[_0x9e9e('0x9')],channels[_0x111fe7['uniqueid']][_0x9e9e('0x41')]));}}catch(_0x394985){utils['error'](util[_0x9e9e('0x15')]('[%s][calls][musiconholdstart]',_0x111fe7[_0x9e9e('0x9')]),_0x394985);}};exports[_0x9e9e('0x43')]=function(_0x55d68f){try{if(!_[_0x9e9e('0x24')](channels[_0x55d68f[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util[_0x9e9e('0x15')](_0x9e9e('0x44'),_0x55d68f[_0x9e9e('0x9')]),_0x55d68f);if(!_['isNil'](channels[_0x55d68f[_0x9e9e('0x9')]][_0x9e9e('0x41')])){channels[_0x55d68f['uniqueid']][_0x9e9e('0x45')]+=utils['diffTime'](utils['now'](),channels[_0x55d68f['uniqueid']][_0x9e9e('0x41')]);utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x55d68f[_0x9e9e('0x9')],channels[_0x55d68f[_0x9e9e('0x9')]][_0x9e9e('0x45')]));delete channels[_0x55d68f[_0x9e9e('0x9')]][_0x9e9e('0x41')];}}}catch(_0x348002){utils['error'](util['format'](_0x9e9e('0x44'),_0x55d68f[_0x9e9e('0x9')]),_0x348002);}};exports[_0x9e9e('0x46')]=function(_0xe7aa4e){try{if(!_[_0x9e9e('0x24')](channels[_0xe7aa4e[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util['format']('[%s][calls][varset]',_0xe7aa4e[_0x9e9e('0x9')]),_0xe7aa4e);if(!_[_0x9e9e('0x24')](_0xe7aa4e['variable'][_0x9e9e('0x47')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]]['source']=_0xe7aa4e[_0x9e9e('0x48')];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')]['xmd-phone'])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x4a')]=_0xe7aa4e['value'];channels[_0xe7aa4e['uniqueid']][_0x9e9e('0x2d')]='\x22'+_0xe7aa4e[_0x9e9e('0x48')]+_0x9e9e('0x4b')+_0xe7aa4e['value']+'>';}if(!_['isNil'](_0xe7aa4e[_0x9e9e('0x49')]['xmd-callerid-preview'])||!_['isNil'](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x4c')])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x4d'),_0xe7aa4e[_0x9e9e('0x9')],!_[_0x9e9e('0x24')](_0xe7aa4e['variable'][_0x9e9e('0x4e')])?_0x9e9e('0x4e'):'xmd-callerid',_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e['uniqueid']][_0x9e9e('0x2d')]=_0xe7aa4e['value'];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x4f')])||!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x50')])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xe7aa4e[_0x9e9e('0x9')],!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x4f')])?_0x9e9e('0x4f'):_0x9e9e('0x50'),_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x51')]=_0x9e9e('0x52');channels[_0xe7aa4e[_0x9e9e('0x9')]]['lastdata']=_0xe7aa4e[_0x9e9e('0x48')];channels[_0xe7aa4e[_0x9e9e('0x9')]]['queue']=!![];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x53')])){utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x54'),_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x55')]=_0xe7aa4e[_0x9e9e('0x48')];}if(!_[_0x9e9e('0x24')](_0xe7aa4e['variable'][_0x9e9e('0x56')])){utils['info'](util['format'](_0x9e9e('0x57'),_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e['value']));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x58')]=_0xe7aa4e[_0x9e9e('0x48')];}if(!_[_0x9e9e('0x24')](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x59')])){utils[_0x9e9e('0x1a')](util[_0x9e9e('0x15')](_0x9e9e('0x5a'),_0xe7aa4e['uniqueid'],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e[_0x9e9e('0x9')]][_0x9e9e('0x5b')]=_0xe7aa4e[_0x9e9e('0x48')];}if(!_['isNil'](_0xe7aa4e[_0x9e9e('0x49')][_0x9e9e('0x5c')])){utils['info'](util['format'](_0x9e9e('0x5d'),_0xe7aa4e[_0x9e9e('0x9')],_0xe7aa4e[_0x9e9e('0x48')]));channels[_0xe7aa4e['uniqueid']][_0x9e9e('0x5c')]=_0xe7aa4e[_0x9e9e('0x48')];}}}catch(_0xd580dd){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x5e'),_0xe7aa4e[_0x9e9e('0x9')]),_0xd580dd);}};exports[_0x9e9e('0x5f')]=function(_0x3b6ef0){try{if(!_[_0x9e9e('0x24')](channels[_0x3b6ef0[_0x9e9e('0x9')]])){utils[_0x9e9e('0x14')](util['format'](_0x9e9e('0x60'),_0x3b6ef0['uniqueid']),_0x3b6ef0);utils['info'](util[_0x9e9e('0x15')](_0x9e9e('0x61'),_0x3b6ef0[_0x9e9e('0x9')],_0x3b6ef0[_0x9e9e('0x62')],_0x3b6ef0[_0x9e9e('0x63')]));if(_0x3b6ef0[_0x9e9e('0x62')][_0x9e9e('0x64')]()==_0x9e9e('0x65')&&_[_0x9e9e('0x66')](_0x3b6ef0[_0x9e9e('0x63')][_0x9e9e('0x64')](),_0x9e9e('0x67'))){var _0x4e7149=_0x3b6ef0[_0x9e9e('0x63')][_0x9e9e('0x68')]('=');var _0x3e4345=_0x4e7149[0x0]['substring'](_0x4e7149[0x0][_0x9e9e('0x69')]('(')+0x1,_0x4e7149[0x0][_0x9e9e('0x69')](')'));var _0x585c09=_0x4e7149[0x1];channels[_0x3b6ef0[_0x9e9e('0x9')]][_0x3e4345]=_0x585c09;}if(!_[_0x9e9e('0x6a')](['hangup',_0x9e9e('0x6b'),_0x9e9e('0x6c'),'set',_0x9e9e('0x6d')],_0x3b6ef0['application'][_0x9e9e('0x64')]())){channels[_0x3b6ef0[_0x9e9e('0x9')]]['lastapplication']=_0x3b6ef0[_0x9e9e('0x62')];channels[_0x3b6ef0[_0x9e9e('0x9')]]['lastdata']=_0x3b6ef0[_0x9e9e('0x63')];}}}catch(_0x26dc6c){utils[_0x9e9e('0x21')](util[_0x9e9e('0x15')](_0x9e9e('0x60'),_0x3b6ef0['uniqueid']),_0x26dc6c);}}; \ No newline at end of file +var _0xb93b=['xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','execif','gotoif','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','exten','now','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','channel','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','isNil','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0xb93b,0x165));var _0xbb93=function(_0x497d39,_0x2fef30){_0x497d39=_0x497d39-0x0;var _0x4a9d8f=_0xb93b[_0x497d39];return _0x4a9d8f;};'use strict';var _=require(_0xbb93('0x0'));var util=require(_0xbb93('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0xbb93('0x2'),_0xbb93('0x3'),_0xbb93('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0xbb93('0x2'),_0xbb93('0x4'),_0xbb93('0x5'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0xc2e6ee){var _0x6edfba;if(transfers[_0xbb93('0x6')][_0xc2e6ee[_0xbb93('0x7')]]){_0x6edfba=_0xc2e6ee[_0xbb93('0x7')];_0xc2e6ee['uniqueid']=transfers[_0xbb93('0x6')][_0xc2e6ee[_0xbb93('0x7')]][_0xbb93('0x8')];}utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0xb'),_0xc2e6ee[_0xbb93('0x7')],_0xc2e6ee['channel'],_0xc2e6ee[_0xbb93('0xc')],_0xc2e6ee[_0xbb93('0xd')],_0xc2e6ee['interface'],_0xc2e6ee['calleridnum'],_0xc2e6ee[_0xbb93('0xe')],_0xc2e6ee[_0xbb93('0xf')]));if(_0xc2e6ee[_0xbb93('0x10')]){utils['getUserByInternal'](_0xc2e6ee[_0xbb93('0x10')])[_0xbb93('0x11')](function(_0x4a1b6f){if(_0x4a1b6f){_0xc2e6ee[_0xbb93('0x12')]=_0x4a1b6f['id'];}utils[_0xbb93('0x13')](_0xbb93('0x14'),_0xc2e6ee);});}else{utils['request'](_0xbb93('0x14'),_0xc2e6ee);}if(channels[_0xc2e6ee['uniqueid']]){delete channels[_0xc2e6ee['uniqueid']];}else if(_0x6edfba&&channels[_0x6edfba]){delete transfers[_0xbb93('0x6')][_0x6edfba];delete channels[_0x6edfba];}}exports[_0xbb93('0x15')]=function(_0x1873f5){try{utils[_0xbb93('0x16')](util[_0xbb93('0xa')](_0xbb93('0x17'),_0x1873f5[_0xbb93('0x7')]),_0x1873f5);if(_0x1873f5[_0xbb93('0x7')]==_0x1873f5[_0xbb93('0x18')]&&_0x1873f5['channel']!=_0xbb93('0x19')){utils['info'](util['format'](_0xbb93('0x1a'),_0x1873f5[_0xbb93('0x7')],_0x1873f5[_0xbb93('0x1b')],_0x1873f5['exten']));channels[_0x1873f5[_0xbb93('0x7')]]={'uniqueid':_0x1873f5[_0xbb93('0x7')],'accountcode':_0x1873f5[_0xbb93('0x10')],'source':_0x1873f5[_0xbb93('0x1c')],'destination':_0x1873f5[_0xbb93('0x1d')],'destinationcontext':_0x1873f5['context'],'channel':_0x1873f5['channel'],'starttime':utils[_0xbb93('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0xebc4a7){utils[_0xbb93('0x1f')](util[_0xbb93('0xa')](_0xbb93('0x17'),_0x1873f5['uniqueid']),_0xebc4a7);}};exports[_0xbb93('0x20')]=function(_0x14bf83){try{utils[_0xbb93('0x16')](util[_0xbb93('0xa')](_0xbb93('0x21'),_0x14bf83[_0xbb93('0x7')]),_0x14bf83);if(!_['isNil'](channels[_0x14bf83[_0xbb93('0x7')]])&&_0x14bf83[_0xbb93('0x22')]==0x6){utils['info'](util[_0xbb93('0xa')](_0xbb93('0x23'),_0x14bf83[_0xbb93('0x7')],_0x14bf83[_0xbb93('0x1b')],_0x14bf83[_0xbb93('0x24')]));if(_['isNil'](channels[_0x14bf83[_0xbb93('0x7')]][_0xbb93('0x25')])){channels[_0x14bf83[_0xbb93('0x7')]][_0xbb93('0x25')]=utils['now']();}}else if(!_['isNil'](channels[_0x14bf83['linkedid']])&&_0x14bf83['channelstate']==0x6&&_0x14bf83[_0xbb93('0x1b')]!=_0xbb93('0x26')){utils['info'](util[_0xbb93('0xa')](_0xbb93('0x27'),_0x14bf83[_0xbb93('0x7')],_0x14bf83[_0xbb93('0x18')],_0x14bf83['context'],_0x14bf83[_0xbb93('0x24')]));channels[_0x14bf83['linkedid']][_0xbb93('0x10')]=_0x14bf83[_0xbb93('0x10')];channels[_0x14bf83[_0xbb93('0x18')]]['destinationchannel']=_0x14bf83[_0xbb93('0x24')];if(_['isNil'](channels[_0x14bf83['linkedid']]['answertime'])){channels[_0x14bf83[_0xbb93('0x18')]][_0xbb93('0x28')]=utils[_0xbb93('0x1e')]();}channels[_0x14bf83[_0xbb93('0x18')]][_0xbb93('0x29')]=dispositions[_[_0xbb93('0x2a')](_0x14bf83[_0xbb93('0x22')])]||'ANSWERED';}}catch(_0x36176b){utils[_0xbb93('0x1f')](util[_0xbb93('0xa')](_0xbb93('0x21'),_0x14bf83[_0xbb93('0x7')]),_0x36176b);}};exports[_0xbb93('0x2b')]=function(_0x5a4e22){try{if(!_[_0xbb93('0x2c')](channels[_0x5a4e22['uniqueid']])){utils[_0xbb93('0x16')](util[_0xbb93('0xa')](_0xbb93('0x2d'),_0x5a4e22[_0xbb93('0x7')]),_0x5a4e22);if(_['isNil'](channels[_0x5a4e22['uniqueid']][_0xbb93('0x2e')])){channels[_0x5a4e22['uniqueid']][_0xbb93('0x2e')]=_0x5a4e22[_0xbb93('0x2f')]+'\x20<'+_0x5a4e22[_0xbb93('0x1c')]+'>';}utils[_0xbb93('0x9')](util['format'](_0xbb93('0x30'),_0x5a4e22[_0xbb93('0x7')],channels[_0x5a4e22[_0xbb93('0x7')]][_0xbb93('0x2e')],_0x5a4e22['cause-txt']));channels[_0x5a4e22[_0xbb93('0x7')]]['endtime']=utils[_0xbb93('0x1e')]();channels[_0x5a4e22[_0xbb93('0x7')]][_0xbb93('0x31')]=utils[_0xbb93('0x32')](channels[_0x5a4e22[_0xbb93('0x7')]][_0xbb93('0x33')],channels[_0x5a4e22['uniqueid']]['starttime']);channels[_0x5a4e22[_0xbb93('0x7')]]['billableseconds']=channels[_0x5a4e22[_0xbb93('0x7')]][_0xbb93('0x28')]?utils[_0xbb93('0x32')](channels[_0x5a4e22[_0xbb93('0x7')]][_0xbb93('0x33')],channels[_0x5a4e22[_0xbb93('0x7')]][_0xbb93('0x28')]):0x0;writeDB(channels[_0x5a4e22[_0xbb93('0x7')]]);}}catch(_0x456466){utils['error'](util[_0xbb93('0xa')](_0xbb93('0x2d'),_0x5a4e22[_0xbb93('0x7')]),_0x456466);}};exports[_0xbb93('0x34')]=function(_0x4f05ed){try{if(!_[_0xbb93('0x2c')](channels[_0x4f05ed[_0xbb93('0x35')]])){utils[_0xbb93('0x16')](util[_0xbb93('0xa')](_0xbb93('0x36'),_0x4f05ed[_0xbb93('0x37')]),_0x4f05ed);if(channels[_0x4f05ed[_0xbb93('0x35')]][_0xbb93('0x24')]==_0x4f05ed[_0xbb93('0x38')]){utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0x39'),_0x4f05ed[_0xbb93('0x37')],_0x4f05ed[_0xbb93('0x35')],_0x4f05ed[_0xbb93('0x3a')]));channels[_0x4f05ed[_0xbb93('0x35')]][_0xbb93('0x3b')]=_0x4f05ed[_0xbb93('0x3a')];channels[_0x4f05ed[_0xbb93('0x35')]][_0xbb93('0x3c')]=_0xbb93('0x3d');}else if(channels[_0x4f05ed[_0xbb93('0x35')]][_0xbb93('0x24')]=_0x4f05ed['transfertargetchannel']){utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0x39'),_0x4f05ed[_0xbb93('0x37')],_0x4f05ed[_0xbb93('0x35')],_0x4f05ed['origtransfererchannel']));channels[_0x4f05ed[_0xbb93('0x35')]][_0xbb93('0x3b')]=_0x4f05ed[_0xbb93('0x3e')];channels[_0x4f05ed[_0xbb93('0x35')]][_0xbb93('0x3c')]=_0xbb93('0x3d');}}}catch(_0x334b02){utils[_0xbb93('0x1f')](util[_0xbb93('0xa')](_0xbb93('0x36'),_0x4f05ed[_0xbb93('0x37')]),_0x334b02);}};exports[_0xbb93('0x3f')]=function(_0x456b10){try{if(!_[_0xbb93('0x2c')](channels[_0x456b10['uniqueid']])){utils[_0xbb93('0x16')](util[_0xbb93('0xa')](_0xbb93('0x40'),_0x456b10[_0xbb93('0x7')]),_0x456b10);channels[_0x456b10[_0xbb93('0x7')]][_0xbb93('0x41')]=utils[_0xbb93('0x1e')]();utils['info'](util[_0xbb93('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x456b10[_0xbb93('0x7')],channels[_0x456b10[_0xbb93('0x7')]][_0xbb93('0x41')]));}}catch(_0x1eca00){utils['error'](util[_0xbb93('0xa')]('[%s][calls][musiconholdstart]',_0x456b10[_0xbb93('0x7')]),_0x1eca00);}};exports[_0xbb93('0x42')]=function(_0x4949c4){try{if(!_[_0xbb93('0x2c')](channels[_0x4949c4[_0xbb93('0x7')]])){utils['debug'](util[_0xbb93('0xa')](_0xbb93('0x43'),_0x4949c4[_0xbb93('0x7')]),_0x4949c4);if(!_['isNil'](channels[_0x4949c4[_0xbb93('0x7')]][_0xbb93('0x41')])){channels[_0x4949c4[_0xbb93('0x7')]][_0xbb93('0x44')]+=utils[_0xbb93('0x32')](utils[_0xbb93('0x1e')](),channels[_0x4949c4[_0xbb93('0x7')]]['musiconholdstartAt']);utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0x45'),_0x4949c4['uniqueid'],channels[_0x4949c4[_0xbb93('0x7')]]['mohtime']));delete channels[_0x4949c4[_0xbb93('0x7')]][_0xbb93('0x41')];}}}catch(_0x3d626f){utils[_0xbb93('0x1f')](util[_0xbb93('0xa')](_0xbb93('0x43'),_0x4949c4[_0xbb93('0x7')]),_0x3d626f);}};exports[_0xbb93('0x46')]=function(_0x4d53b7){try{if(!_[_0xbb93('0x2c')](channels[_0x4d53b7['uniqueid']])){utils[_0xbb93('0x16')](util[_0xbb93('0xa')](_0xbb93('0x47'),_0x4d53b7['uniqueid']),_0x4d53b7);if(!_['isNil'](_0x4d53b7[_0xbb93('0x48')]['xmd-originatecalleridnum'])){utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0x49'),_0x4d53b7[_0xbb93('0x7')],_0x4d53b7['value']));channels[_0x4d53b7[_0xbb93('0x7')]][_0xbb93('0x4a')]=_0x4d53b7[_0xbb93('0x4b')];}if(!_[_0xbb93('0x2c')](_0x4d53b7['variable'][_0xbb93('0x4c')])){utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0x4d'),_0x4d53b7[_0xbb93('0x7')],_0x4d53b7['value']));channels[_0x4d53b7['uniqueid']]['destination']=_0x4d53b7[_0xbb93('0x4b')];channels[_0x4d53b7[_0xbb93('0x7')]]['callerid']='\x22'+_0x4d53b7[_0xbb93('0x4b')]+_0xbb93('0x4e')+_0x4d53b7[_0xbb93('0x4b')]+'>';}if(!_[_0xbb93('0x2c')](_0x4d53b7[_0xbb93('0x48')][_0xbb93('0x4f')])||!_[_0xbb93('0x2c')](_0x4d53b7[_0xbb93('0x48')][_0xbb93('0x50')])){utils[_0xbb93('0x9')](util[_0xbb93('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4d53b7[_0xbb93('0x7')],!_[_0xbb93('0x2c')](_0x4d53b7[_0xbb93('0x48')][_0xbb93('0x4f')])?_0xbb93('0x4f'):_0xbb93('0x50'),_0x4d53b7[_0xbb93('0x4b')]));channels[_0x4d53b7[_0xbb93('0x7')]]['callerid']=_0x4d53b7[_0xbb93('0x4b')];}if(!_[_0xbb93('0x2c')](_0x4d53b7[_0xbb93('0x48')][_0xbb93('0x51')])||!_['isNil'](_0x4d53b7[_0xbb93('0x48')][_0xbb93('0x52')])){utils['info'](util[_0xbb93('0xa')](_0xbb93('0x53'),_0x4d53b7[_0xbb93('0x7')],!_[_0xbb93('0x2c')](_0x4d53b7['variable'][_0xbb93('0x51')])?_0xbb93('0x51'):'xmcs-queue',_0x4d53b7[_0xbb93('0x4b')]));channels[_0x4d53b7[_0xbb93('0x7')]][_0xbb93('0x54')]=_0xbb93('0x55');channels[_0x4d53b7[_0xbb93('0x7')]][_0xbb93('0x56')]=_0x4d53b7[_0xbb93('0x4b')];channels[_0x4d53b7[_0xbb93('0x7')]]['queue']=!![];}if(!_[_0xbb93('0x2c')](_0x4d53b7[_0xbb93('0x48')]['xmd-contactid'])){utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0x57'),_0x4d53b7[_0xbb93('0x7')],_0x4d53b7[_0xbb93('0x4b')]));channels[_0x4d53b7['uniqueid']]['ContactId']=_0x4d53b7['value'];}if(!_[_0xbb93('0x2c')](_0x4d53b7['variable'][_0xbb93('0x58')])){utils[_0xbb93('0x9')](util[_0xbb93('0xa')](_0xbb93('0x59'),_0x4d53b7['uniqueid'],_0x4d53b7['value']));channels[_0x4d53b7[_0xbb93('0x7')]][_0xbb93('0x5a')]=_0x4d53b7[_0xbb93('0x4b')];}if(!_[_0xbb93('0x2c')](_0x4d53b7['variable'][_0xbb93('0x5b')])){utils['info'](util['format'](_0xbb93('0x5c'),_0x4d53b7[_0xbb93('0x7')],_0x4d53b7['value']));channels[_0x4d53b7['uniqueid']]['routeid']=_0x4d53b7[_0xbb93('0x4b')];}if(!_[_0xbb93('0x2c')](_0x4d53b7[_0xbb93('0x48')]['sipcallid'])){utils[_0xbb93('0x9')](util[_0xbb93('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x4d53b7['uniqueid'],_0x4d53b7[_0xbb93('0x4b')]));channels[_0x4d53b7[_0xbb93('0x7')]][_0xbb93('0x5d')]=_0x4d53b7[_0xbb93('0x4b')];}}}catch(_0xa2b1ac){utils[_0xbb93('0x1f')](util[_0xbb93('0xa')](_0xbb93('0x47'),_0x4d53b7[_0xbb93('0x7')]),_0xa2b1ac);}};exports[_0xbb93('0x5e')]=function(_0x5117ac){try{if(!_[_0xbb93('0x2c')](channels[_0x5117ac['uniqueid']])){utils[_0xbb93('0x16')](util[_0xbb93('0xa')](_0xbb93('0x5f'),_0x5117ac[_0xbb93('0x7')]),_0x5117ac);utils[_0xbb93('0x9')](util['format'](_0xbb93('0x60'),_0x5117ac[_0xbb93('0x7')],_0x5117ac[_0xbb93('0x61')],_0x5117ac[_0xbb93('0x62')]));if(_0x5117ac[_0xbb93('0x61')]['toLowerCase']()==_0xbb93('0x63')&&_[_0xbb93('0x64')](_0x5117ac[_0xbb93('0x62')][_0xbb93('0x65')](),_0xbb93('0x66'))){var _0x3228f5=_0x5117ac[_0xbb93('0x62')][_0xbb93('0x67')]('=');var _0x111cac=_0x3228f5[0x0][_0xbb93('0x68')](_0x3228f5[0x0][_0xbb93('0x69')]('(')+0x1,_0x3228f5[0x0][_0xbb93('0x69')](')'));var _0x1aa666=_0x3228f5[0x1];channels[_0x5117ac[_0xbb93('0x7')]][_0x111cac]=_0x1aa666;}if(!_[_0xbb93('0x6a')]([_0xbb93('0x2b'),'noop',_0xbb93('0x6b'),'set',_0xbb93('0x6c')],_0x5117ac[_0xbb93('0x61')][_0xbb93('0x65')]())){channels[_0x5117ac[_0xbb93('0x7')]]['lastapplication']=_0x5117ac[_0xbb93('0x61')];channels[_0x5117ac[_0xbb93('0x7')]][_0xbb93('0x56')]=_0x5117ac['appdata'];}}}catch(_0x23725d){utils['error'](util[_0xbb93('0xa')]('[%s][calls][newexten]',_0x5117ac[_0xbb93('0x7')]),_0x23725d);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 49a97d4..c91d483 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7949=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','[core]\x20connected','[core]\x20shutdown'];(function(_0x52de74,_0x152687){var _0x33113e=function(_0x182424){while(--_0x182424){_0x52de74['push'](_0x52de74['shift']());}};_0x33113e(++_0x152687);}(_0x7949,0x152));var _0x9794=function(_0x4e692d,_0x320ce5){_0x4e692d=_0x4e692d-0x0;var _0x49b78d=_0x7949[_0x4e692d];return _0x49b78d;};'use strict';var utils=require('./utils');exports[_0x9794('0x0')]=function(){utils['info'](_0x9794('0x1'));};exports['shutdown']=function(){utils['info'](_0x9794('0x2'));};exports[_0x9794('0x3')]=function(){utils[_0x9794('0x4')](_0x9794('0x5'));};exports['error']=function(_0x516510){utils[_0x9794('0x6')](_0x9794('0x7'),_0x516510);};exports[_0x9794('0x8')]=function(){utils[_0x9794('0x4')](_0x9794('0x9'));};exports[_0x9794('0xa')]=function(_0x3722a2){}; \ No newline at end of file +var _0x8c9d=['error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x4b85d5,_0x9c90f3){var _0x159269=function(_0x4171dd){while(--_0x4171dd){_0x4b85d5['push'](_0x4b85d5['shift']());}};_0x159269(++_0x9c90f3);}(_0x8c9d,0x131));var _0xd8c9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c9d[_0x20a584];return _0x4b41a8;};'use strict';var utils=require('./utils');exports[_0xd8c9('0x0')]=function(){utils[_0xd8c9('0x1')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xd8c9('0x1')](_0xd8c9('0x2'));};exports[_0xd8c9('0x3')]=function(){utils['info'](_0xd8c9('0x4'));};exports[_0xd8c9('0x5')]=function(_0x43423d){utils[_0xd8c9('0x5')](_0xd8c9('0x6'),_0x43423d);};exports[_0xd8c9('0x7')]=function(){utils['info'](_0xd8c9('0x8'));};exports[_0xd8c9('0x9')]=function(_0x391d8c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f9a8d21..2b65d7f 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7129=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','billableseconds','endtime','lodash','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','debug','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','dialstatus','ANSWER','assign','answertime','now'];(function(_0x4dad15,_0x30f850){var _0x4dda5e=function(_0x5e3f9a){while(--_0x5e3f9a){_0x4dad15['push'](_0x4dad15['shift']());}};_0x4dda5e(++_0x30f850);}(_0x7129,0x70));var _0x9712=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7129[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x9712('0x0'));var util=require('util');var utils=require(_0x9712('0x1'));var dials={};function writeDB(_0x515cae){utils[_0x9712('0x2')](util[_0x9712('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x515cae[_0x9712('0x4')],_0x515cae[_0x9712('0x5')],_0x515cae[_0x9712('0x6')],_0x515cae[_0x9712('0x7')],_0x515cae[_0x9712('0x8')],_0x515cae['dialstatus']));utils[_0x9712('0x9')](_0x9712('0xa'),_0x515cae);delete dials[_0x515cae[_0x9712('0x4')]];}exports[_0x9712('0xb')]=function(_0x389080){try{utils['debug'](util['format'](_0x9712('0xc'),_0x389080[_0x9712('0x4')]),_0x389080);utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0xd'),_0x389080[_0x9712('0x4')],_0x389080[_0x9712('0xe')],_0x389080[_0x9712('0xf')]));if(_0x389080[_0x9712('0xe')][_0x9712('0x10')]()=='set'&&_[_0x9712('0x11')](_0x389080['appdata']['toLowerCase'](),_0x9712('0x12'))){var _0x2407b7=_0x389080[_0x9712('0xf')]['split']('=');dials[_0x389080[_0x9712('0x4')]]={'routeId':_0x2407b7[0x1]};}}catch(_0x52d104){utils[_0x9712('0x13')](util[_0x9712('0x3')]('[%s][dials][newexten]',_0x389080[_0x9712('0x4')]),_0x52d104);}};exports[_0x9712('0x14')]=function(_0x3bd67f){try{utils[_0x9712('0x15')](util[_0x9712('0x3')]('[%s][dials][varset]',_0x3bd67f[_0x9712('0x4')]),_0x3bd67f);if(!_[_0x9712('0x16')](_0x3bd67f[_0x9712('0x17')]['outboundrouteid'])){utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0x18'),_0x3bd67f[_0x9712('0x4')],_0x3bd67f[_0x9712('0x19')]));dials[_0x3bd67f[_0x9712('0x4')]]={'routeId':_0x3bd67f['value']};}}catch(_0x174486){utils[_0x9712('0x13')](util[_0x9712('0x3')]('[%s][dials][varset]',_0x3bd67f[_0x9712('0x4')]),_0x174486);}};exports[_0x9712('0x1a')]=function(_0x41697b){try{if(!_['isNil'](dials[_0x41697b[_0x9712('0x4')]])){utils[_0x9712('0x15')](util[_0x9712('0x3')]('[%s][dials][dialbegin]',_0x41697b['uniqueid']),_0x41697b);dials[_0x41697b[_0x9712('0x4')]]=_['assign'](dials[_0x41697b[_0x9712('0x4')]],_0x41697b);dials[_0x41697b[_0x9712('0x4')]][_0x9712('0x1b')]=utils['now']();dials[_0x41697b[_0x9712('0x4')]][_0x9712('0x1c')]=_0x9712('0x1d');utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0x1e'),_0x41697b['uniqueid'],dials[_0x41697b['uniqueid']]['starttime']));}}catch(_0x197f84){utils[_0x9712('0x13')](util[_0x9712('0x3')](_0x9712('0x1f'),_0x41697b[_0x9712('0x4')]),_0x197f84);}};exports[_0x9712('0x20')]=function(_0xced040){try{if(!_[_0x9712('0x16')](dials[_0xced040[_0x9712('0x4')]])){utils[_0x9712('0x15')](util[_0x9712('0x3')]('[%s][dials][dialend]',_0xced040['uniqueid']),_0xced040);dials[_0xced040['uniqueid']][_0x9712('0x21')]=_0xced040[_0x9712('0x21')];if(_0xced040[_0x9712('0x21')]==_0x9712('0x22')){dials[_0xced040['uniqueid']]=_[_0x9712('0x23')](dials[_0xced040['uniqueid']],_0xced040);dials[_0xced040[_0x9712('0x4')]][_0x9712('0x24')]=utils[_0x9712('0x25')]();dials[_0xced040[_0x9712('0x4')]]['lastevent']='connect';utils['info'](util['format'](_0x9712('0x26'),_0xced040[_0x9712('0x4')],_0xced040[_0x9712('0x21')],dials[_0xced040[_0x9712('0x4')]][_0x9712('0x24')]));}else{utils[_0x9712('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0xced040['uniqueid'],_0xced040[_0x9712('0x21')]));}}}catch(_0x458371){utils[_0x9712('0x13')](util[_0x9712('0x3')](_0x9712('0x27'),_0xced040[_0x9712('0x4')]),_0x458371);}};exports['hangup']=function(_0x146f17){try{if(!_['isNil'](dials[_0x146f17[_0x9712('0x4')]])){utils[_0x9712('0x15')](util['format'](_0x9712('0x28'),_0x146f17[_0x9712('0x4')]),_0x146f17);utils[_0x9712('0x2')](util[_0x9712('0x3')](_0x9712('0x29'),_0x146f17['uniqueid'],_0x146f17['calleridnum'],_0x146f17[_0x9712('0x2a')],_0x146f17[_0x9712('0x2b')]));dials[_0x146f17[_0x9712('0x4')]]=_[_0x9712('0x23')](dials[_0x146f17[_0x9712('0x4')]],{'endtime':utils[_0x9712('0x25')](),'lastevent':_0x9712('0x2c')});dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x2d')]=utils[_0x9712('0x2e')](dials[_0x146f17['uniqueid']]['endtime'],dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x1b')]);dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x2f')]=utils[_0x9712('0x2e')](dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x24')]||dials[_0x146f17[_0x9712('0x4')]]['endtime'],dials[_0x146f17[_0x9712('0x4')]]['starttime']);dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x30')]=dials[_0x146f17['uniqueid']][_0x9712('0x24')]?utils[_0x9712('0x2e')](dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x31')],dials[_0x146f17[_0x9712('0x4')]][_0x9712('0x24')]):0x0;writeDB(dials[_0x146f17[_0x9712('0x4')]]);}}catch(_0x28b44f){utils[_0x9712('0x13')](util[_0x9712('0x3')]('[%s][dials][hangup]',_0x146f17[_0x9712('0x4')]),_0x28b44f);}}; \ No newline at end of file +var _0x277d=['[%s][dials][hangup]','complete','duration','starttime','holdtime','endtime','billableseconds','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','debug','format','[%s][dials][newexten]','info','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup'];(function(_0x3de01a,_0xcc1fd4){var _0x43f31e=function(_0xf8e692){while(--_0xf8e692){_0x3de01a['push'](_0x3de01a['shift']());}};_0x43f31e(++_0xcc1fd4);}(_0x277d,0x67));var _0xd277=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x277d[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xd277('0x0'));var dials={};function writeDB(_0x7f7eb7){utils['info'](util['format'](_0xd277('0x1'),_0x7f7eb7[_0xd277('0x2')],_0x7f7eb7[_0xd277('0x3')],_0x7f7eb7[_0xd277('0x4')],_0x7f7eb7[_0xd277('0x5')],_0x7f7eb7[_0xd277('0x6')],_0x7f7eb7[_0xd277('0x7')]));utils['request'](_0xd277('0x8'),_0x7f7eb7);delete dials[_0x7f7eb7['uniqueid']];}exports['newexten']=function(_0x58973e){try{utils[_0xd277('0x9')](util[_0xd277('0xa')](_0xd277('0xb'),_0x58973e[_0xd277('0x2')]),_0x58973e);utils[_0xd277('0xc')](util[_0xd277('0xa')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x58973e[_0xd277('0x2')],_0x58973e[_0xd277('0xd')],_0x58973e['appdata']));if(_0x58973e['application'][_0xd277('0xe')]()=='set'&&_[_0xd277('0xf')](_0x58973e[_0xd277('0x10')][_0xd277('0xe')](),_0xd277('0x11'))){var _0x531089=_0x58973e['appdata'][_0xd277('0x12')]('=');dials[_0x58973e['uniqueid']]={'routeId':_0x531089[0x1]};}}catch(_0x5e750d){utils[_0xd277('0x13')](util[_0xd277('0xa')](_0xd277('0xb'),_0x58973e[_0xd277('0x2')]),_0x5e750d);}};exports[_0xd277('0x14')]=function(_0x52d01e){try{utils[_0xd277('0x9')](util['format'](_0xd277('0x15'),_0x52d01e[_0xd277('0x2')]),_0x52d01e);if(!_[_0xd277('0x16')](_0x52d01e[_0xd277('0x17')]['outboundrouteid'])){utils[_0xd277('0xc')](util[_0xd277('0xa')](_0xd277('0x18'),_0x52d01e['uniqueid'],_0x52d01e[_0xd277('0x19')]));dials[_0x52d01e[_0xd277('0x2')]]={'routeId':_0x52d01e[_0xd277('0x19')]};}}catch(_0x5404f3){utils['error'](util[_0xd277('0xa')](_0xd277('0x15'),_0x52d01e[_0xd277('0x2')]),_0x5404f3);}};exports[_0xd277('0x1a')]=function(_0x157990){try{if(!_[_0xd277('0x16')](dials[_0x157990[_0xd277('0x2')]])){utils['debug'](util[_0xd277('0xa')](_0xd277('0x1b'),_0x157990[_0xd277('0x2')]),_0x157990);dials[_0x157990[_0xd277('0x2')]]=_['assign'](dials[_0x157990[_0xd277('0x2')]],_0x157990);dials[_0x157990[_0xd277('0x2')]]['starttime']=utils['now']();dials[_0x157990['uniqueid']][_0xd277('0x1c')]=_0xd277('0x1d');utils[_0xd277('0xc')](util[_0xd277('0xa')](_0xd277('0x1e'),_0x157990[_0xd277('0x2')],dials[_0x157990['uniqueid']]['starttime']));}}catch(_0x479b45){utils[_0xd277('0x13')](util[_0xd277('0xa')](_0xd277('0x1b'),_0x157990[_0xd277('0x2')]),_0x479b45);}};exports[_0xd277('0x1f')]=function(_0x3c717e){try{if(!_[_0xd277('0x16')](dials[_0x3c717e[_0xd277('0x2')]])){utils['debug'](util[_0xd277('0xa')](_0xd277('0x20'),_0x3c717e['uniqueid']),_0x3c717e);dials[_0x3c717e[_0xd277('0x2')]][_0xd277('0x7')]=_0x3c717e['dialstatus'];if(_0x3c717e[_0xd277('0x7')]==_0xd277('0x21')){dials[_0x3c717e[_0xd277('0x2')]]=_[_0xd277('0x22')](dials[_0x3c717e[_0xd277('0x2')]],_0x3c717e);dials[_0x3c717e[_0xd277('0x2')]]['answertime']=utils[_0xd277('0x23')]();dials[_0x3c717e['uniqueid']][_0xd277('0x1c')]=_0xd277('0x24');utils[_0xd277('0xc')](util[_0xd277('0xa')](_0xd277('0x25'),_0x3c717e[_0xd277('0x2')],_0x3c717e[_0xd277('0x7')],dials[_0x3c717e['uniqueid']][_0xd277('0x26')]));}else{utils[_0xd277('0xc')](util['format'](_0xd277('0x27'),_0x3c717e[_0xd277('0x2')],_0x3c717e['dialstatus']));}}}catch(_0x4d2bee){utils[_0xd277('0x13')](util[_0xd277('0xa')](_0xd277('0x20'),_0x3c717e[_0xd277('0x2')]),_0x4d2bee);}};exports[_0xd277('0x28')]=function(_0x20e761){try{if(!_['isNil'](dials[_0x20e761[_0xd277('0x2')]])){utils[_0xd277('0x9')](util['format'](_0xd277('0x29'),_0x20e761[_0xd277('0x2')]),_0x20e761);utils[_0xd277('0xc')](util[_0xd277('0xa')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x20e761[_0xd277('0x2')],_0x20e761['calleridnum'],_0x20e761['calleridname'],_0x20e761['cause-txt']));dials[_0x20e761[_0xd277('0x2')]]=_[_0xd277('0x22')](dials[_0x20e761[_0xd277('0x2')]],{'endtime':utils['now'](),'lastevent':_0xd277('0x2a')});dials[_0x20e761[_0xd277('0x2')]][_0xd277('0x2b')]=utils['diffTime'](dials[_0x20e761[_0xd277('0x2')]]['endtime'],dials[_0x20e761['uniqueid']][_0xd277('0x2c')]);dials[_0x20e761[_0xd277('0x2')]][_0xd277('0x2d')]=utils['diffTime'](dials[_0x20e761[_0xd277('0x2')]][_0xd277('0x26')]||dials[_0x20e761[_0xd277('0x2')]][_0xd277('0x2e')],dials[_0x20e761['uniqueid']][_0xd277('0x2c')]);dials[_0x20e761[_0xd277('0x2')]][_0xd277('0x2f')]=dials[_0x20e761[_0xd277('0x2')]]['answertime']?utils['diffTime'](dials[_0x20e761[_0xd277('0x2')]][_0xd277('0x2e')],dials[_0x20e761[_0xd277('0x2')]][_0xd277('0x26')]):0x0;writeDB(dials[_0x20e761[_0xd277('0x2')]]);}}catch(_0x2f6d73){utils[_0xd277('0x13')](util[_0xd277('0xa')](_0xd277('0x29'),_0x20e761[_0xd277('0x2')]),_0x2f6d73);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b73240c..b01bd49 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbea=['./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller'];(function(_0x411b89,_0x45a648){var _0x3be7c5=function(_0x12dda4){while(--_0x12dda4){_0x411b89['push'](_0x411b89['shift']());}};_0x3be7c5(++_0x45a648);}(_0xdbea,0x104));var _0xadbe=function(_0x2eb950,_0x2a5064){_0x2eb950=_0x2eb950-0x0;var _0x4268c7=_0xdbea[_0x2eb950];return _0x4268c7;};var AsteriskManager=require(_0xadbe('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xadbe('0x1'));var ami=new AsteriskManager(config[_0xadbe('0x2')][_0xadbe('0x3')],config[_0xadbe('0x2')]['ip'],config[_0xadbe('0x2')]['username'],config['asterisk'][_0xadbe('0x4')],!![]);ami[_0xadbe('0x5')]();if(config[_0xadbe('0x6')]&&config[_0xadbe('0x6')][_0xadbe('0x7')]){utils[_0xadbe('0x8')](_0xadbe('0x9'));}else{var agents=require(_0xadbe('0xa'));var calls=require(_0xadbe('0xb'));var queues=require(_0xadbe('0xc'));var recordings=require(_0xadbe('0xd'));var members=require(_0xadbe('0xe'));var dials=require(_0xadbe('0xf'));var transfers=require(_0xadbe('0x10'));var core=require(_0xadbe('0x11'));ami['on'](_0xadbe('0x12'),core[_0xadbe('0x12')]);ami['on'](_0xadbe('0x13'),core[_0xadbe('0x13')]);ami['on'](_0xadbe('0x14'),core[_0xadbe('0x14')]);ami['on'](_0xadbe('0x15'),core[_0xadbe('0x15')]);ami['on'](_0xadbe('0x16'),core[_0xadbe('0x16')]);ami['on']('managerevent',core[_0xadbe('0x17')]);ami['on'](_0xadbe('0x18'),function(_0x3d6efc){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x1b'),_0x3d6efc[_0xadbe('0x1c')]),_0x3d6efc);members[_0xadbe('0x18')](_0x3d6efc);}catch(_0x5287ae){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x1b'),_0x3d6efc[_0xadbe('0x1c')]),_0x5287ae);}});ami['on'](_0xadbe('0x1d'),function(_0xd0a966){try{utils[_0xadbe('0x19')](util['format']('[%s][index][agentcalled]',_0xd0a966[_0xadbe('0x1e')]),_0xd0a966);agents[_0xadbe('0x1d')](_0xd0a966);}catch(_0x350792){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x1f'),_0xd0a966['uniqueid']),_0x350792);}});ami['on'](_0xadbe('0x20'),function(_0x1d2a3c){try{utils[_0xadbe('0x19')](util['format'](_0xadbe('0x21'),_0x1d2a3c[_0xadbe('0x1e')]),_0x1d2a3c);agents['agentringnoanswer'](_0x1d2a3c);}catch(_0x487b6a){utils['error'](util[_0xadbe('0x1a')](_0xadbe('0x21'),_0x1d2a3c['uniqueid']),_0x487b6a);}});ami['on']('agentconnect',function(_0x3fbc37){try{utils[_0xadbe('0x19')](util['format'](_0xadbe('0x22'),_0x3fbc37[_0xadbe('0x1e')]),_0x3fbc37);agents[_0xadbe('0x23')](_0x3fbc37);queues[_0xadbe('0x23')](_0x3fbc37);}catch(_0x584401){utils[_0xadbe('0x15')](util['format'](_0xadbe('0x22'),_0x3fbc37['uniqueid']),_0x584401);}});ami['on'](_0xadbe('0x24'),function(_0x2b3d4c){try{utils[_0xadbe('0x19')](util['format']('[%s][index][agentcomplete]',_0x2b3d4c[_0xadbe('0x1e')]),_0x2b3d4c);agents['agentcomplete'](_0x2b3d4c);queues['agentcomplete'](_0x2b3d4c);members[_0xadbe('0x24')](_0x2b3d4c);}catch(_0x340724){utils[_0xadbe('0x15')](util['format'](_0xadbe('0x25'),_0x2b3d4c[_0xadbe('0x1e')]),_0x340724);}});ami['on'](_0xadbe('0x26'),function(_0x412215){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x27'),_0x412215[_0xadbe('0x1e')]),_0x412215);agents['queuecallerabandon'](_0x412215);queues[_0xadbe('0x26')](_0x412215);}catch(_0x1a7185){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x27'),_0x412215[_0xadbe('0x1e')]),_0x1a7185);}});ami['on'](_0xadbe('0x28'),function(_0x47e46d){try{utils['debug'](util[_0xadbe('0x1a')](_0xadbe('0x29'),_0x47e46d['uniqueid']),_0x47e46d);queues[_0xadbe('0x28')](_0x47e46d);recordings['queuecallerjoin'](_0x47e46d);}catch(_0x339901){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x29'),_0x47e46d[_0xadbe('0x1e')]),_0x339901);}});ami['on'](_0xadbe('0x2a'),function(_0x250ce7){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x2b'),_0x250ce7[_0xadbe('0x1e')]),_0x250ce7);queues['queuecallerleave'](_0x250ce7);}catch(_0x1052b8){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x2b'),_0x250ce7['uniqueid']),_0x1052b8);}});ami['on']('musiconholdstart',function(_0x3ca022){try{utils['debug'](util[_0xadbe('0x1a')](_0xadbe('0x2c'),_0x3ca022[_0xadbe('0x1e')]),_0x3ca022);queues[_0xadbe('0x2d')](_0x3ca022);calls[_0xadbe('0x2d')](_0x3ca022);}catch(_0x545d70){utils['error'](util[_0xadbe('0x1a')](_0xadbe('0x2c'),_0x3ca022[_0xadbe('0x1e')]),_0x545d70);}});ami['on'](_0xadbe('0x2e'),function(_0x337ab5){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x2f'),_0x337ab5[_0xadbe('0x1e')]),_0x337ab5);queues[_0xadbe('0x2e')](_0x337ab5);calls[_0xadbe('0x2e')](_0x337ab5);}catch(_0x384bf0){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x2f'),_0x337ab5[_0xadbe('0x1e')]),_0x384bf0);}});ami['on'](_0xadbe('0x30'),function(_0x3872dd){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')]('[%s][index][newstate]',_0x3872dd[_0xadbe('0x1e')]),_0x3872dd);calls['newstate'](_0x3872dd);recordings[_0xadbe('0x30')](_0x3872dd);}catch(_0x1f74cc){utils[_0xadbe('0x15')](util['format'](_0xadbe('0x31'),_0x3872dd[_0xadbe('0x1e')]),_0x1f74cc);}});ami['on']('hangup',function(_0x55aaed){try{utils['debug'](util[_0xadbe('0x1a')](_0xadbe('0x32'),_0x55aaed[_0xadbe('0x1e')]),_0x55aaed);calls[_0xadbe('0x33')](_0x55aaed);recordings['hangup'](_0x55aaed);dials['hangup'](_0x55aaed);agents[_0xadbe('0x33')](_0x55aaed);queues['hangup'](_0x55aaed);}catch(_0x48c0fb){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x32'),_0x55aaed[_0xadbe('0x1e')]),_0x48c0fb);}});ami['on'](_0xadbe('0x34'),function(_0x12d977){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x35'),_0x12d977['uniqueid']),_0x12d977);members[_0xadbe('0x34')](_0x12d977);}catch(_0x3256c4){utils[_0xadbe('0x15')](util['format']('[%s][index][cdr]',_0x12d977[_0xadbe('0x1e')]),_0x3256c4);}});ami['on'](_0xadbe('0x36'),function(_0x28647d){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x37'),_0x28647d[_0xadbe('0x1e')]),_0x28647d);queues[_0xadbe('0x36')](_0x28647d);agents[_0xadbe('0x36')](_0x28647d);transfers[_0xadbe('0x36')](_0x28647d);}catch(_0x5e4f86){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x37'),_0x28647d['uniqueid']),_0x5e4f86);}});ami['on'](_0xadbe('0x38'),function(_0x2ed393){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x39'),_0x2ed393[_0xadbe('0x3a')]),_0x2ed393);queues['attendedtransfer'](_0x2ed393);transfers['attendedtransfer'](_0x2ed393);agents[_0xadbe('0x38')](_0x2ed393);calls[_0xadbe('0x38')](_0x2ed393);}catch(_0x3b6908){utils[_0xadbe('0x15')](util['format']('[%s][index][attendedtransfer]',_0x2ed393['origtransfereruniqueid']),_0x3b6908);}});ami['on']('varset',function(_0x21c1c8){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x3b'),_0x21c1c8[_0xadbe('0x1e')]),_0x21c1c8);queues[_0xadbe('0x3c')](_0x21c1c8);recordings[_0xadbe('0x3c')](_0x21c1c8);calls[_0xadbe('0x3c')](_0x21c1c8);dials[_0xadbe('0x3c')](_0x21c1c8);}catch(_0x19211d){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x3b'),_0x21c1c8['uniqueid']),_0x19211d);}});ami['on'](_0xadbe('0x3d'),function(_0x4977b5){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')](_0xadbe('0x3e'),_0x4977b5[_0xadbe('0x1e')]),_0x4977b5);calls[_0xadbe('0x3d')](_0x4977b5);recordings[_0xadbe('0x3d')](_0x4977b5);dials[_0xadbe('0x3d')](_0x4977b5);}catch(_0x4a7aa5){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')]('[%s][index][newexten]',_0x4977b5[_0xadbe('0x1e')]),_0x4a7aa5);}});ami['on'](_0xadbe('0x3f'),function(_0x36e506){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x36e506[_0xadbe('0x1e')]),_0x36e506);calls['newchannel'](_0x36e506);recordings['newchannel'](_0x36e506);}catch(_0x56d7cd){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')]('[%s][index][newchannel]',_0x36e506[_0xadbe('0x1e')]),_0x56d7cd);}});ami['on']('dialbegin',function(_0x110e08){try{utils[_0xadbe('0x19')](util[_0xadbe('0x1a')]('[%s][index][dialbegin]',_0x110e08[_0xadbe('0x1e')]),_0x110e08);dials[_0xadbe('0x40')](_0x110e08);}catch(_0x1e18b5){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x41'),_0x110e08[_0xadbe('0x1e')]),_0x1e18b5);}});ami['on'](_0xadbe('0x42'),function(_0x59b244){try{utils[_0xadbe('0x19')](util['format']('[%s][index][dialend]',_0x59b244[_0xadbe('0x1e')]),_0x59b244);dials[_0xadbe('0x42')](_0x59b244);}catch(_0x4e083c){utils[_0xadbe('0x15')](util[_0xadbe('0x1a')](_0xadbe('0x43'),_0x59b244[_0xadbe('0x1e')]),_0x4e083c);}});} \ No newline at end of file +var _0x07a4=['[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','./utils','util','port','asterisk','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','debug','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel'];(function(_0x525c90,_0x1fe2da){var _0x16f1a9=function(_0x4186f8){while(--_0x4186f8){_0x525c90['push'](_0x525c90['shift']());}};_0x16f1a9(++_0x1fe2da);}(_0x07a4,0x178));var _0x407a=function(_0x33eeee,_0x2c5c2f){_0x33eeee=_0x33eeee-0x0;var _0x1a97a5=_0x07a4[_0x33eeee];return _0x1a97a5;};var AsteriskManager=require(_0x407a('0x0'));var config=require('../../config/environment');var utils=require(_0x407a('0x1'));var util=require(_0x407a('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x407a('0x3')],config[_0x407a('0x4')]['ip'],config[_0x407a('0x4')]['username'],config[_0x407a('0x4')][_0x407a('0x5')],!![]);ami[_0x407a('0x6')]();if(config['xdr']&&config[_0x407a('0x7')][_0x407a('0x8')]){utils[_0x407a('0x9')](_0x407a('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x407a('0xb'));var members=require('./members.controller');var dials=require(_0x407a('0xc'));var transfers=require(_0x407a('0xd'));var core=require(_0x407a('0xe'));ami['on'](_0x407a('0xf'),core[_0x407a('0xf')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x407a('0x10'),core[_0x407a('0x10')]);ami['on'](_0x407a('0x11'),core[_0x407a('0x11')]);ami['on']('close',core[_0x407a('0x12')]);ami['on']('managerevent',core['managerevent']);ami['on']('devicestatechange',function(_0x48b5ae){try{utils[_0x407a('0x13')](util[_0x407a('0x14')](_0x407a('0x15'),_0x48b5ae[_0x407a('0x16')]),_0x48b5ae);members[_0x407a('0x17')](_0x48b5ae);}catch(_0x32f323){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x15'),_0x48b5ae[_0x407a('0x16')]),_0x32f323);}});ami['on'](_0x407a('0x18'),function(_0x1ed72b){try{utils[_0x407a('0x13')](util['format'](_0x407a('0x19'),_0x1ed72b['uniqueid']),_0x1ed72b);agents[_0x407a('0x18')](_0x1ed72b);}catch(_0x36e724){utils[_0x407a('0x11')](util[_0x407a('0x14')]('[%s][index][agentcalled]',_0x1ed72b[_0x407a('0x1a')]),_0x36e724);}});ami['on'](_0x407a('0x1b'),function(_0x4f5186){try{utils[_0x407a('0x13')](util[_0x407a('0x14')]('[%s][index][agentringnoanswer]',_0x4f5186[_0x407a('0x1a')]),_0x4f5186);agents[_0x407a('0x1b')](_0x4f5186);}catch(_0x646313){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x1c'),_0x4f5186[_0x407a('0x1a')]),_0x646313);}});ami['on']('agentconnect',function(_0x593a35){try{utils[_0x407a('0x13')](util['format'](_0x407a('0x1d'),_0x593a35[_0x407a('0x1a')]),_0x593a35);agents[_0x407a('0x1e')](_0x593a35);queues[_0x407a('0x1e')](_0x593a35);}catch(_0x3e03a7){utils['error'](util[_0x407a('0x14')](_0x407a('0x1d'),_0x593a35['uniqueid']),_0x3e03a7);}});ami['on'](_0x407a('0x1f'),function(_0x4a4ed1){try{utils[_0x407a('0x13')](util[_0x407a('0x14')](_0x407a('0x20'),_0x4a4ed1[_0x407a('0x1a')]),_0x4a4ed1);agents['agentcomplete'](_0x4a4ed1);queues[_0x407a('0x1f')](_0x4a4ed1);members[_0x407a('0x1f')](_0x4a4ed1);}catch(_0x4f11ed){utils['error'](util[_0x407a('0x14')](_0x407a('0x20'),_0x4a4ed1[_0x407a('0x1a')]),_0x4f11ed);}});ami['on']('queuecallerabandon',function(_0xcb09ba){try{utils['debug'](util[_0x407a('0x14')]('[%s][index][queuecallerabandon]',_0xcb09ba[_0x407a('0x1a')]),_0xcb09ba);agents[_0x407a('0x21')](_0xcb09ba);queues[_0x407a('0x21')](_0xcb09ba);}catch(_0x169b6b){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x22'),_0xcb09ba[_0x407a('0x1a')]),_0x169b6b);}});ami['on']('queuecallerjoin',function(_0x5cf3a1){try{utils['debug'](util['format']('[%s][index][queuecallerjoin]',_0x5cf3a1[_0x407a('0x1a')]),_0x5cf3a1);queues[_0x407a('0x23')](_0x5cf3a1);recordings[_0x407a('0x23')](_0x5cf3a1);}catch(_0x2f472d){utils[_0x407a('0x11')](util['format']('[%s][index][queuecallerjoin]',_0x5cf3a1['uniqueid']),_0x2f472d);}});ami['on'](_0x407a('0x24'),function(_0x4ebcce){try{utils[_0x407a('0x13')](util[_0x407a('0x14')](_0x407a('0x25'),_0x4ebcce[_0x407a('0x1a')]),_0x4ebcce);queues[_0x407a('0x24')](_0x4ebcce);}catch(_0x167152){utils['error'](util[_0x407a('0x14')](_0x407a('0x25'),_0x4ebcce[_0x407a('0x1a')]),_0x167152);}});ami['on']('musiconholdstart',function(_0x3324f8){try{utils['debug'](util['format'](_0x407a('0x26'),_0x3324f8[_0x407a('0x1a')]),_0x3324f8);queues[_0x407a('0x27')](_0x3324f8);calls['musiconholdstart'](_0x3324f8);}catch(_0x82c085){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x26'),_0x3324f8['uniqueid']),_0x82c085);}});ami['on'](_0x407a('0x28'),function(_0x3abeff){try{utils[_0x407a('0x13')](util[_0x407a('0x14')]('[%s][index][musiconholdstop]',_0x3abeff[_0x407a('0x1a')]),_0x3abeff);queues[_0x407a('0x28')](_0x3abeff);calls[_0x407a('0x28')](_0x3abeff);}catch(_0xa6633d){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x29'),_0x3abeff[_0x407a('0x1a')]),_0xa6633d);}});ami['on'](_0x407a('0x2a'),function(_0x51e00e){try{utils[_0x407a('0x13')](util['format'](_0x407a('0x2b'),_0x51e00e[_0x407a('0x1a')]),_0x51e00e);calls['newstate'](_0x51e00e);recordings[_0x407a('0x2a')](_0x51e00e);}catch(_0x34ed08){utils[_0x407a('0x11')](util[_0x407a('0x14')]('[%s][index][newstate]',_0x51e00e[_0x407a('0x1a')]),_0x34ed08);}});ami['on'](_0x407a('0x2c'),function(_0x21023c){try{utils['debug'](util[_0x407a('0x14')](_0x407a('0x2d'),_0x21023c[_0x407a('0x1a')]),_0x21023c);calls[_0x407a('0x2c')](_0x21023c);recordings[_0x407a('0x2c')](_0x21023c);dials[_0x407a('0x2c')](_0x21023c);agents['hangup'](_0x21023c);queues[_0x407a('0x2c')](_0x21023c);}catch(_0x148191){utils[_0x407a('0x11')](util[_0x407a('0x14')]('[%s][index][hangup]',_0x21023c[_0x407a('0x1a')]),_0x148191);}});ami['on'](_0x407a('0x2e'),function(_0x3742f4){try{utils[_0x407a('0x13')](util[_0x407a('0x14')](_0x407a('0x2f'),_0x3742f4[_0x407a('0x1a')]),_0x3742f4);members[_0x407a('0x2e')](_0x3742f4);}catch(_0xfbfee2){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x2f'),_0x3742f4[_0x407a('0x1a')]),_0xfbfee2);}});ami['on']('blindtransfer',function(_0x248f41){try{utils[_0x407a('0x13')](util[_0x407a('0x14')]('[%s][index][blindtransfer]',_0x248f41['uniqueid']),_0x248f41);queues[_0x407a('0x30')](_0x248f41);agents['blindtransfer'](_0x248f41);transfers[_0x407a('0x30')](_0x248f41);}catch(_0x3687c5){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x31'),_0x248f41[_0x407a('0x1a')]),_0x3687c5);}});ami['on'](_0x407a('0x32'),function(_0x4985e3){try{utils['debug'](util['format'](_0x407a('0x33'),_0x4985e3[_0x407a('0x34')]),_0x4985e3);queues[_0x407a('0x32')](_0x4985e3);transfers[_0x407a('0x32')](_0x4985e3);agents[_0x407a('0x32')](_0x4985e3);calls[_0x407a('0x32')](_0x4985e3);}catch(_0x41c2a4){utils[_0x407a('0x11')](util['format']('[%s][index][attendedtransfer]',_0x4985e3['origtransfereruniqueid']),_0x41c2a4);}});ami['on'](_0x407a('0x35'),function(_0x4aa31e){try{utils[_0x407a('0x13')](util[_0x407a('0x14')](_0x407a('0x36'),_0x4aa31e[_0x407a('0x1a')]),_0x4aa31e);queues[_0x407a('0x35')](_0x4aa31e);recordings[_0x407a('0x35')](_0x4aa31e);calls[_0x407a('0x35')](_0x4aa31e);dials['varset'](_0x4aa31e);}catch(_0x4f4265){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x36'),_0x4aa31e[_0x407a('0x1a')]),_0x4f4265);}});ami['on'](_0x407a('0x37'),function(_0x4232c3){try{utils[_0x407a('0x13')](util[_0x407a('0x14')](_0x407a('0x38'),_0x4232c3['uniqueid']),_0x4232c3);calls[_0x407a('0x37')](_0x4232c3);recordings['newexten'](_0x4232c3);dials['newexten'](_0x4232c3);}catch(_0x5f5aa0){utils[_0x407a('0x11')](util['format'](_0x407a('0x38'),_0x4232c3['uniqueid']),_0x5f5aa0);}});ami['on'](_0x407a('0x39'),function(_0x3fb985){try{utils[_0x407a('0x13')](util[_0x407a('0x14')](_0x407a('0x3a'),_0x3fb985[_0x407a('0x1a')]),_0x3fb985);calls[_0x407a('0x39')](_0x3fb985);recordings[_0x407a('0x39')](_0x3fb985);}catch(_0x4749ce){utils[_0x407a('0x11')](util[_0x407a('0x14')](_0x407a('0x3a'),_0x3fb985[_0x407a('0x1a')]),_0x4749ce);}});ami['on'](_0x407a('0x3b'),function(_0x46fab2){try{utils[_0x407a('0x13')](util[_0x407a('0x14')]('[%s][index][dialbegin]',_0x46fab2[_0x407a('0x1a')]),_0x46fab2);dials[_0x407a('0x3b')](_0x46fab2);}catch(_0x49a57d){utils[_0x407a('0x11')](util['format'](_0x407a('0x3c'),_0x46fab2[_0x407a('0x1a')]),_0x49a57d);}});ami['on']('dialend',function(_0x314063){try{utils[_0x407a('0x13')](util['format'](_0x407a('0x3d'),_0x314063['uniqueid']),_0x314063);dials['dialend'](_0x314063);}catch(_0x1501db){utils[_0x407a('0x11')](util['format'](_0x407a('0x3d'),_0x314063[_0x407a('0x1a')]),_0x1501db);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8d6bb63..cb1865b 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd82=['destinationchannel','destination','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0xdd82,0xd6));var _0x2dd8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdd82[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x2dd8('0x0'));var utils=require(_0x2dd8('0x1'));var members={};var exclude=[_0x2dd8('0x2'),_0x2dd8('0x3')];function writeDB(_0x51bb53){utils[_0x2dd8('0x4')](util[_0x2dd8('0x5')](_0x2dd8('0x6'),_0x51bb53[_0x2dd8('0x7')],_0x51bb53[_0x2dd8('0x8')],_0x51bb53[_0x2dd8('0x9')],_0x51bb53[_0x2dd8('0xa')],_0x51bb53[_0x2dd8('0xb')],_0x51bb53[_0x2dd8('0xc')]));if(_0x51bb53['interface']){utils[_0x2dd8('0xd')](_0x51bb53[_0x2dd8('0x8')])[_0x2dd8('0xe')](function(_0x3b2919){if(_0x3b2919){_0x51bb53[_0x2dd8('0xb')]=_0x3b2919[_0x2dd8('0xf')];_0x51bb53[_0x2dd8('0x10')]=_0x3b2919[_0x2dd8('0x10')];utils[_0x2dd8('0x11')]('CreateMemberReport',_0x51bb53);}else{utils[_0x2dd8('0x12')](_0x51bb53[_0x2dd8('0x8')][_0x2dd8('0x13')]('/')[0x1])[_0x2dd8('0xe')](function(_0x3cd4b1){if(_0x3cd4b1){_0x51bb53[_0x2dd8('0xb')]=_0x3cd4b1[_0x2dd8('0xf')];_0x51bb53[_0x2dd8('0x10')]=_0x3cd4b1[_0x2dd8('0x10')];utils[_0x2dd8('0x11')](_0x2dd8('0x14'),_0x51bb53);}});}})[_0x2dd8('0x15')](function(_0x1940f7){utils[_0x2dd8('0x16')](util[_0x2dd8('0x5')](_0x2dd8('0x17'),_0x51bb53[_0x2dd8('0x7')]),_0x1940f7);});}delete members[_0x51bb53[_0x2dd8('0x8')]];}function startsWith(_0x3052e9,_0xc4382a){return _['some'](_0x3052e9,function(_0x108aaf){return _['startsWith'](_0xc4382a,_0x108aaf);});}exports[_0x2dd8('0x18')]=function(_0x1a43c4){try{utils[_0x2dd8('0x19')](util[_0x2dd8('0x5')](_0x2dd8('0x1a'),members[_0x1a43c4[_0x2dd8('0x1b')]]?members[_0x1a43c4[_0x2dd8('0x1b')]]['uniqueid']:_0x1a43c4['device']),_0x1a43c4);utils[_0x2dd8('0x4')](util[_0x2dd8('0x5')](_0x2dd8('0x1c'),members[_0x1a43c4[_0x2dd8('0x1b')]]?members[_0x1a43c4[_0x2dd8('0x1b')]][_0x2dd8('0x7')]:_0x1a43c4[_0x2dd8('0x1b')],_0x1a43c4['state'],_0x1a43c4['device']));switch(_0x1a43c4[_0x2dd8('0x1d')]){case _0x2dd8('0x1e'):case _0x2dd8('0x1f'):if(!startsWith(exclude,_0x1a43c4[_0x2dd8('0x1b')])){members[_0x1a43c4[_0x2dd8('0x1b')]]={'channel':'voice','interface':_0x1a43c4[_0x2dd8('0x1b')],'type':'TALKING','enterAt':utils[_0x2dd8('0x20')](),'role':_0x2dd8('0x21')};}break;case _0x2dd8('0x22'):if(!_[_0x2dd8('0x23')](members[_0x1a43c4[_0x2dd8('0x1b')]])){members[_0x1a43c4['device']]['exitAt']=utils[_0x2dd8('0x20')]();members[_0x1a43c4[_0x2dd8('0x1b')]][_0x2dd8('0x24')]=utils[_0x2dd8('0x25')](members[_0x1a43c4['device']][_0x2dd8('0x26')],members[_0x1a43c4[_0x2dd8('0x1b')]][_0x2dd8('0x27')]);if(members[_0x1a43c4[_0x2dd8('0x1b')]]['uniqueid']){writeDB(members[_0x1a43c4[_0x2dd8('0x1b')]]);}}break;default:break;}}catch(_0x1c5943){utils['error'](util[_0x2dd8('0x5')](_0x2dd8('0x1a'),members[_0x1a43c4[_0x2dd8('0x1b')]]?members[_0x1a43c4['device']][_0x2dd8('0x7')]:_0x1a43c4[_0x2dd8('0x1b')]),_0x1c5943);}};exports[_0x2dd8('0x28')]=function(_0x34fc3e){try{if(!_[_0x2dd8('0x23')](members[_0x34fc3e[_0x2dd8('0x8')]])){utils[_0x2dd8('0x19')](util[_0x2dd8('0x5')](_0x2dd8('0x29'),_0x34fc3e[_0x2dd8('0x7')]),_0x34fc3e);utils[_0x2dd8('0x4')](util[_0x2dd8('0x5')](_0x2dd8('0x2a'),_0x34fc3e[_0x2dd8('0x7')],_0x34fc3e[_0x2dd8('0x8')],_0x34fc3e['queue']));members[_0x34fc3e[_0x2dd8('0x8')]]=_[_0x2dd8('0x2b')](members[_0x34fc3e[_0x2dd8('0x8')]],{'data4':_0x34fc3e[_0x2dd8('0x2c')],'uniqueid':_0x34fc3e[_0x2dd8('0x7')]});}}catch(_0x4646b1){utils[_0x2dd8('0x16')](util[_0x2dd8('0x5')](_0x2dd8('0x29'),_0x34fc3e[_0x2dd8('0x7')]),_0x4646b1);}};exports[_0x2dd8('0x2d')]=function(_0x12704b){try{utils[_0x2dd8('0x19')](util[_0x2dd8('0x5')](_0x2dd8('0x2e'),_0x12704b[_0x2dd8('0x7')]),_0x12704b);if(_0x12704b[_0x2dd8('0x9')]){var _0x448448=_0x12704b[_0x2dd8('0x9')][_0x2dd8('0x13')]('-')[0x0];if(!_[_0x2dd8('0x23')](members[_0x448448])){members[_0x448448]=_[_0x2dd8('0x2b')](members[_0x448448],{'data1':members[_0x448448]['data1']||_0x12704b[_0x2dd8('0xc')],'data2':members[_0x448448][_0x2dd8('0xa')]||_0x12704b[_0x2dd8('0x2f')],'data3':members[_0x448448][_0x2dd8('0x30')]||_0x12704b['destination'],'uniqueid':members[_0x448448][_0x2dd8('0x7')]||_0x12704b[_0x2dd8('0x7')]});utils['info'](util[_0x2dd8('0x5')](_0x2dd8('0x31'),_0x12704b[_0x2dd8('0x7')],members[_0x448448][_0x2dd8('0x32')],members[_0x448448][_0x2dd8('0xa')],members[_0x448448][_0x2dd8('0x30')]));if(members[_0x448448][_0x2dd8('0x26')]){writeDB(members[_0x448448]);}}}if(_0x12704b['destinationchannel']){var _0x2946e2=_0x12704b[_0x2dd8('0x33')][_0x2dd8('0x13')]('-')[0x0];if(!_[_0x2dd8('0x23')](members[_0x2946e2])){members[_0x2946e2]=_['assign'](members[_0x2946e2],{'data1':members[_0x2946e2][_0x2dd8('0x32')]||_0x12704b[_0x2dd8('0xc')],'data2':members[_0x2946e2][_0x2dd8('0xa')]||_0x12704b['source'],'data3':members[_0x2946e2]['data3']||_0x12704b[_0x2dd8('0x34')],'uniqueid':members[_0x2946e2]['uniqueid']||_0x12704b[_0x2dd8('0x7')]});utils['info'](util[_0x2dd8('0x5')](_0x2dd8('0x31'),_0x12704b[_0x2dd8('0x7')],members[_0x2946e2][_0x2dd8('0x32')],members[_0x2946e2][_0x2dd8('0xa')],members[_0x2946e2][_0x2dd8('0x30')]));if(members[_0x2946e2][_0x2dd8('0x26')]){writeDB(members[_0x2946e2]);}}}}catch(_0x3f72f0){utils[_0x2dd8('0x16')](util['format'](_0x2dd8('0x2e'),_0x12704b['uniqueid']),_0x3f72f0);}}; \ No newline at end of file +var _0x47fb=['then','name','internal','request','CreateMemberReport','split','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','isNil','exitAt','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','debug','[%s][members][cdr]','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','type','getUserByInterface','interface'];(function(_0x1b7950,_0x7ebb41){var _0x24da53=function(_0x23c0c0){while(--_0x23c0c0){_0x1b7950['push'](_0x1b7950['shift']());}};_0x24da53(++_0x7ebb41);}(_0x47fb,0x130));var _0xb47f=function(_0x5dca1a,_0x27ef06){_0x5dca1a=_0x5dca1a-0x0;var _0x1303e3=_0x47fb[_0x5dca1a];return _0x1303e3;};'use strict';var _=require(_0xb47f('0x0'));var util=require(_0xb47f('0x1'));var utils=require(_0xb47f('0x2'));var members={};var exclude=[_0xb47f('0x3'),_0xb47f('0x4')];function writeDB(_0x4cdc47){utils['info'](util[_0xb47f('0x5')](_0xb47f('0x6'),_0x4cdc47[_0xb47f('0x7')],_0x4cdc47['interface'],_0x4cdc47[_0xb47f('0x8')],_0x4cdc47[_0xb47f('0x9')],_0x4cdc47[_0xb47f('0xa')],_0x4cdc47[_0xb47f('0xb')]));if(_0x4cdc47['interface']){utils[_0xb47f('0xc')](_0x4cdc47[_0xb47f('0xd')])[_0xb47f('0xe')](function(_0x1df6eb){if(_0x1df6eb){_0x4cdc47['membername']=_0x1df6eb[_0xb47f('0xf')];_0x4cdc47[_0xb47f('0x10')]=_0x1df6eb[_0xb47f('0x10')];utils[_0xb47f('0x11')](_0xb47f('0x12'),_0x4cdc47);}else{utils['getUserByName'](_0x4cdc47[_0xb47f('0xd')][_0xb47f('0x13')]('/')[0x1])[_0xb47f('0xe')](function(_0x448342){if(_0x448342){_0x4cdc47['membername']=_0x448342[_0xb47f('0xf')];_0x4cdc47[_0xb47f('0x10')]=_0x448342[_0xb47f('0x10')];utils[_0xb47f('0x11')]('CreateMemberReport',_0x4cdc47);}});}})[_0xb47f('0x14')](function(_0x594e74){utils['error'](util[_0xb47f('0x5')](_0xb47f('0x15'),_0x4cdc47['uniqueid']),_0x594e74);});}delete members[_0x4cdc47[_0xb47f('0xd')]];}function startsWith(_0x207d81,_0x44866c){return _[_0xb47f('0x16')](_0x207d81,function(_0x36866a){return _[_0xb47f('0x17')](_0x44866c,_0x36866a);});}exports[_0xb47f('0x18')]=function(_0x16d17a){try{utils['debug'](util['format'](_0xb47f('0x19'),members[_0x16d17a[_0xb47f('0x1a')]]?members[_0x16d17a['device']][_0xb47f('0x7')]:_0x16d17a[_0xb47f('0x1a')]),_0x16d17a);utils[_0xb47f('0x1b')](util[_0xb47f('0x5')](_0xb47f('0x1c'),members[_0x16d17a['device']]?members[_0x16d17a['device']][_0xb47f('0x7')]:_0x16d17a[_0xb47f('0x1a')],_0x16d17a['state'],_0x16d17a['device']));switch(_0x16d17a[_0xb47f('0x1d')]){case _0xb47f('0x1e'):case _0xb47f('0x1f'):if(!startsWith(exclude,_0x16d17a[_0xb47f('0x1a')])){members[_0x16d17a[_0xb47f('0x1a')]]={'channel':_0xb47f('0x20'),'interface':_0x16d17a['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0xb47f('0x21')};}break;case'NOT_INUSE':if(!_[_0xb47f('0x22')](members[_0x16d17a[_0xb47f('0x1a')]])){members[_0x16d17a[_0xb47f('0x1a')]][_0xb47f('0x23')]=utils['now']();members[_0x16d17a[_0xb47f('0x1a')]]['duration']=utils[_0xb47f('0x24')](members[_0x16d17a['device']][_0xb47f('0x23')],members[_0x16d17a[_0xb47f('0x1a')]][_0xb47f('0x25')]);if(members[_0x16d17a[_0xb47f('0x1a')]][_0xb47f('0x7')]){writeDB(members[_0x16d17a['device']]);}}break;default:break;}}catch(_0x376814){utils[_0xb47f('0x26')](util[_0xb47f('0x5')]('[%s][members][devicestatechange]',members[_0x16d17a[_0xb47f('0x1a')]]?members[_0x16d17a[_0xb47f('0x1a')]]['uniqueid']:_0x16d17a[_0xb47f('0x1a')]),_0x376814);}};exports[_0xb47f('0x27')]=function(_0x17ab65){try{if(!_[_0xb47f('0x22')](members[_0x17ab65[_0xb47f('0xd')]])){utils['debug'](util[_0xb47f('0x5')](_0xb47f('0x28'),_0x17ab65[_0xb47f('0x7')]),_0x17ab65);utils[_0xb47f('0x1b')](util[_0xb47f('0x5')](_0xb47f('0x29'),_0x17ab65[_0xb47f('0x7')],_0x17ab65[_0xb47f('0xd')],_0x17ab65[_0xb47f('0x2a')]));members[_0x17ab65['interface']]=_['assign'](members[_0x17ab65[_0xb47f('0xd')]],{'data4':_0x17ab65['queue'],'uniqueid':_0x17ab65[_0xb47f('0x7')]});}}catch(_0x5e1a13){utils['error'](util[_0xb47f('0x5')](_0xb47f('0x28'),_0x17ab65[_0xb47f('0x7')]),_0x5e1a13);}};exports[_0xb47f('0x2b')]=function(_0x1a64b6){try{utils[_0xb47f('0x2c')](util[_0xb47f('0x5')](_0xb47f('0x2d'),_0x1a64b6[_0xb47f('0x7')]),_0x1a64b6);if(_0x1a64b6['channel']){var _0x34f1b0=_0x1a64b6[_0xb47f('0x8')]['split']('-')[0x0];if(!_[_0xb47f('0x22')](members[_0x34f1b0])){members[_0x34f1b0]=_[_0xb47f('0x2e')](members[_0x34f1b0],{'data1':members[_0x34f1b0][_0xb47f('0x2f')]||_0x1a64b6['type'],'data2':members[_0x34f1b0][_0xb47f('0x9')]||_0x1a64b6[_0xb47f('0x30')],'data3':members[_0x34f1b0]['data3']||_0x1a64b6[_0xb47f('0x31')],'uniqueid':members[_0x34f1b0]['uniqueid']||_0x1a64b6[_0xb47f('0x7')]});utils[_0xb47f('0x1b')](util[_0xb47f('0x5')](_0xb47f('0x32'),_0x1a64b6['uniqueid'],members[_0x34f1b0]['data1'],members[_0x34f1b0][_0xb47f('0x9')],members[_0x34f1b0][_0xb47f('0x33')]));if(members[_0x34f1b0][_0xb47f('0x23')]){writeDB(members[_0x34f1b0]);}}}if(_0x1a64b6['destinationchannel']){var _0x4ecb2b=_0x1a64b6[_0xb47f('0x34')][_0xb47f('0x13')]('-')[0x0];if(!_[_0xb47f('0x22')](members[_0x4ecb2b])){members[_0x4ecb2b]=_[_0xb47f('0x2e')](members[_0x4ecb2b],{'data1':members[_0x4ecb2b][_0xb47f('0x2f')]||_0x1a64b6[_0xb47f('0xb')],'data2':members[_0x4ecb2b]['data2']||_0x1a64b6[_0xb47f('0x30')],'data3':members[_0x4ecb2b][_0xb47f('0x33')]||_0x1a64b6['destination'],'uniqueid':members[_0x4ecb2b][_0xb47f('0x7')]||_0x1a64b6['uniqueid']});utils[_0xb47f('0x1b')](util[_0xb47f('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1a64b6['uniqueid'],members[_0x4ecb2b][_0xb47f('0x2f')],members[_0x4ecb2b][_0xb47f('0x9')],members[_0x4ecb2b]['data3']));if(members[_0x4ecb2b][_0xb47f('0x23')]){writeDB(members[_0x4ecb2b]);}}}}catch(_0x4e8118){utils[_0xb47f('0x26')](util[_0xb47f('0x5')](_0xb47f('0x2d'),_0x1a64b6[_0xb47f('0x7')]),_0x4e8118);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 86bd2c7..f39e99e 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb96d=['queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','agentconnect','destaccountcode','assigned','membername','agentcomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','ATTENDEDTRANSFER','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','queuestatus','value','queuecallerabandon','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinename','queuecallerleave','holdtime','diffTime'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb96d,0x9e));var _0xdb96=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xb96d[_0x28669c];return _0x4a3af6;};'use strict';var _=require('lodash');var util=require(_0xdb96('0x0'));var utils=require(_0xdb96('0x1'));var queues={};function writeDB(_0x36f0ce){utils['info'](util[_0xdb96('0x2')](_0xdb96('0x3'),_0x36f0ce[_0xdb96('0x4')],_0x36f0ce['channel'],_0x36f0ce['queue'],_0x36f0ce[_0xdb96('0x5')],_0x36f0ce[_0xdb96('0x6')],_0x36f0ce[_0xdb96('0x7')],_0x36f0ce[_0xdb96('0x8')]));if(_0x36f0ce['queue']){utils[_0xdb96('0x9')](_0x36f0ce[_0xdb96('0xa')])['then'](function(_0x3384b4){if(_0x3384b4){_0x36f0ce['type']=_0x3384b4[_0xdb96('0xb')];}utils[_0xdb96('0xc')]('CreateVoiceQueueReport',_0x36f0ce);});}else{utils[_0xdb96('0xc')](_0xdb96('0xd'),_0x36f0ce);}if(_0x36f0ce['transfereduniqueid']){delete queues[_0x36f0ce[_0xdb96('0xe')]];}else{delete queues[_0x36f0ce[_0xdb96('0x4')]];}}exports[_0xdb96('0xf')]=function(_0x1d4c0c){try{utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x10'),_0x1d4c0c[_0xdb96('0x4')]),_0x1d4c0c);utils['info'](util[_0xdb96('0x2')](_0xdb96('0x11'),_0x1d4c0c[_0xdb96('0x4')],_0x1d4c0c[_0xdb96('0xa')],_0x1d4c0c[_0xdb96('0x12')]));queues[_0x1d4c0c[_0xdb96('0x4')]]=_[_0xdb96('0x13')](_0x1d4c0c,{'originalposition':_0x1d4c0c[_0xdb96('0x12')],'queuecallerjoinAt':utils[_0xdb96('0x14')](),'mohtime':0x0});}catch(_0x745780){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x10'),_0x1d4c0c['uniqueid']),_0x745780);}};exports[_0xdb96('0x16')]=function(_0x2a766e){try{if(!_[_0xdb96('0x17')](queues[_0x2a766e[_0xdb96('0x4')]])){utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x18'),_0x2a766e[_0xdb96('0x4')]),_0x2a766e);if(queues[_0x2a766e['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x2a766e[_0xdb96('0x4')]]['queuecallerabandon']&&!queues[_0x2a766e['uniqueid']][_0xdb96('0x19')]){queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x1a')]=!![];queues[_0x2a766e[_0xdb96('0x4')]]['queuecallercompleteAt']=utils[_0xdb96('0x14')]();queues[_0x2a766e['uniqueid']][_0xdb96('0x8')]=_0xdb96('0x1b');}utils['info'](util[_0xdb96('0x2')](_0xdb96('0x1c'),_0x2a766e[_0xdb96('0x4')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x8')]));writeDB(queues[_0x2a766e['uniqueid']]);}else if(queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0xe')]){utils[_0xdb96('0x1e')](util['format'](_0xdb96('0x1f'),_0x2a766e[_0xdb96('0x4')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0xe')]));queues[queues[_0x2a766e[_0xdb96('0x4')]][_0xdb96('0xe')]]=queues[_0x2a766e[_0xdb96('0x4')]];queues[queues[_0x2a766e['uniqueid']][_0xdb96('0xe')]][_0xdb96('0x20')]=0x2;delete queues[_0x2a766e['uniqueid']];}}}catch(_0x372bca){utils[_0xdb96('0x15')](util['format'](_0xdb96('0x18'),_0x2a766e[_0xdb96('0x4')]),_0x372bca);}};exports[_0xdb96('0x21')]=function(_0x1317b8){try{utils[_0xdb96('0x22')](util[_0xdb96('0x2')](_0xdb96('0x23'),_0x1317b8['uniqueid']),_0x1317b8);if(!_[_0xdb96('0x17')](_0x1317b8[_0xdb96('0x24')][_0xdb96('0x25')])&&_0x1317b8[_0xdb96('0x26')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xdb96('0x17')](queues[_0x1317b8[_0xdb96('0x4')]])){queues[_0x1317b8['uniqueid']][_0xdb96('0x27')]=![];queues[_0x1317b8['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1317b8['uniqueid']]['queuecallerexit']=!![];queues[_0x1317b8[_0xdb96('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x8')]=_0x1317b8[_0xdb96('0x26')][_0xdb96('0x28')]();utils['info'](util[_0xdb96('0x2')](_0xdb96('0x29'),_0x1317b8[_0xdb96('0x4')],queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x1d')],_0x1317b8['value'],queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x8')]));writeDB(queues[_0x1317b8[_0xdb96('0x4')]]);}}else if(!_[_0xdb96('0x17')](_0x1317b8[_0xdb96('0x24')][_0xdb96('0x2a')])){if(!_[_0xdb96('0x17')](queues[_0x1317b8['uniqueid']])&&!queues[_0x1317b8['uniqueid']]['queuecallerabandon']){queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x27')]=![];queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x2b')]=null;queues[_0x1317b8['uniqueid']][_0xdb96('0x19')]=!![];queues[_0x1317b8['uniqueid']]['queuecallerexitAt']=utils[_0xdb96('0x14')]();queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x8')]=_0xdb96('0x2c');utils['info'](util[_0xdb96('0x2')](_0xdb96('0x2d'),_0x1317b8[_0xdb96('0x4')],queues[_0x1317b8[_0xdb96('0x4')]][_0xdb96('0x1d')],_0x1317b8['value'],queues[_0x1317b8[_0xdb96('0x4')]]['queuecallerexitreason']));}}}catch(_0x13507d){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x23'),_0x1317b8[_0xdb96('0x4')]),_0x13507d);}};exports['queuecallerabandon']=function(_0xb2ed0b){try{if(!_['isNil'](queues[_0xb2ed0b[_0xdb96('0x4')]])){utils[_0xdb96('0x22')](util['format']('[%s][queues][queuecallerabandon]',_0xb2ed0b[_0xdb96('0x4')]),_0xb2ed0b);queues[_0xb2ed0b[_0xdb96('0x4')]][_0xdb96('0x19')]=![];queues[_0xb2ed0b[_0xdb96('0x4')]][_0xdb96('0x2e')]=null;queues[_0xb2ed0b[_0xdb96('0x4')]]['queuecallerabandon']=!![];queues[_0xb2ed0b[_0xdb96('0x4')]]['queuecallerabandonAt']=utils[_0xdb96('0x14')]();queues[_0xb2ed0b['uniqueid']]['queuecallerexitreason']=_0xdb96('0x2f');utils['info'](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0xb2ed0b['uniqueid'],queues[_0xb2ed0b[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0xb2ed0b['uniqueid']][_0xdb96('0x8')]));}}catch(_0x2cc46a){utils[_0xdb96('0x15')](util['format'](_0xdb96('0x30'),_0xb2ed0b[_0xdb96('0x4')]),_0x2cc46a);}};exports['queuecallerleave']=function(_0x2be486){try{if(!_[_0xdb96('0x17')](queues[_0x2be486[_0xdb96('0x4')]])){utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x31'),_0x2be486[_0xdb96('0x4')]),_0x2be486);utils['info'](util[_0xdb96('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2be486[_0xdb96('0x4')],queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x1d')],_0x2be486['connectedlinenum'],_0x2be486[_0xdb96('0x32')]));queues[_0x2be486['uniqueid']][_0xdb96('0x33')]=!![];queues[_0x2be486['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x34')]=utils[_0xdb96('0x35')](queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x36')],queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x37')]);queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x12')]=_0x2be486[_0xdb96('0x12')];queues[_0x2be486[_0xdb96('0x4')]]['count']=_0x2be486[_0xdb96('0x38')];queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x39')]=_0x2be486[_0xdb96('0x39')];queues[_0x2be486[_0xdb96('0x4')]][_0xdb96('0x32')]=_0x2be486[_0xdb96('0x32')];}}catch(_0x4c7943){utils['error'](util[_0xdb96('0x2')](_0xdb96('0x31'),_0x2be486[_0xdb96('0x4')]),_0x4c7943);}};exports[_0xdb96('0x3a')]=function(_0x1a4217){try{if(!_[_0xdb96('0x17')](queues[_0x1a4217['uniqueid']])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')]('[%s][queues][agentconnect]',_0x1a4217[_0xdb96('0x4')]),_0x1a4217);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x1a4217[_0xdb96('0x4')],queues[_0x1a4217['uniqueid']][_0xdb96('0x1d')],_0x1a4217['membername'],_0x1a4217[_0xdb96('0x3b')]));queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x27')]=![];queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x27')]=![];queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x2b')]=null;queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x19')]=![];queues[_0x1a4217['uniqueid']][_0xdb96('0x8')]=null;queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x2e')]=null;queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x3c')]=!![];queues[_0x1a4217[_0xdb96('0x4')]][_0xdb96('0x7')]=_0x1a4217[_0xdb96('0x3b')];queues[_0x1a4217[_0xdb96('0x4')]]['lastAssignedTo']=_0x1a4217[_0xdb96('0x3d')];}}catch(_0x15558e){utils[_0xdb96('0x15')](util[_0xdb96('0x2')]('[%s][queues][agentconnect]',_0x1a4217[_0xdb96('0x4')]),_0x15558e);}};exports[_0xdb96('0x3e')]=function(_0x18ed1b){try{if(!_[_0xdb96('0x17')](queues[_0x18ed1b[_0xdb96('0x4')]])){if(queues[_0x18ed1b[_0xdb96('0x4')]]['queuecallerleaveAt']){utils[_0xdb96('0x22')](util['format']('[%s][queues][agentcomplete]',_0x18ed1b[_0xdb96('0x4')]),_0x18ed1b);queues[_0x18ed1b[_0xdb96('0x4')]]['queuecallerabandon']=![];queues[_0x18ed1b['uniqueid']][_0xdb96('0x27')]=![];queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x2b')]=null;queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x19')]=![];queues[_0x18ed1b['uniqueid']][_0xdb96('0x2e')]=null;queues[_0x18ed1b[_0xdb96('0x4')]]['assigned']=!![];queues[_0x18ed1b[_0xdb96('0x4')]]['lastAssignedTo']=_0x18ed1b['membername'];queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x1a')]=!![];queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x3f')]=utils['now']();if(_0x18ed1b[_0xdb96('0x40')]==_0xdb96('0x41')){if(!queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x41')]){queues[_0x18ed1b['uniqueid']]['queuecallerexitreason']=_0xdb96('0x42');}}else{queues[_0x18ed1b[_0xdb96('0x4')]][_0xdb96('0x8')]=_0xdb96('0x43')+_0x18ed1b['reason'][_0xdb96('0x28')]();}utils['info'](util['format'](_0xdb96('0x44'),_0x18ed1b[_0xdb96('0x4')],queues[_0x18ed1b[_0xdb96('0x4')]]['name'],_0x18ed1b[_0xdb96('0x3d')],queues[_0x18ed1b['uniqueid']][_0xdb96('0x8')]));writeDB(queues[_0x18ed1b[_0xdb96('0x4')]]);}}}catch(_0x3e3f1a){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x45'),_0x18ed1b[_0xdb96('0x4')]),_0x3e3f1a);}};exports[_0xdb96('0x46')]=function(_0x436946){try{if(!_[_0xdb96('0x17')](queues[_0x436946[_0xdb96('0x47')]])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')](_0xdb96('0x48'),_0x436946[_0xdb96('0x4')]),_0x436946);queues[_0x436946[_0xdb96('0x47')]][_0xdb96('0x41')]=!![];queues[_0x436946[_0xdb96('0x47')]]['transfertype']=_0xdb96('0x49');queues[_0x436946[_0xdb96('0x47')]][_0xdb96('0x4a')]=_0x436946[_0xdb96('0x4b')];queues[_0x436946[_0xdb96('0x47')]][_0xdb96('0x4c')]=_0x436946[_0xdb96('0x47')];queues[_0x436946[_0xdb96('0x47')]]['queuecallerexitreason']=_0xdb96('0x4d');utils[_0xdb96('0x1e')](util['format'](_0xdb96('0x4e'),_0x436946[_0xdb96('0x4')],queues[_0x436946[_0xdb96('0x47')]]['name'],_0x436946[_0xdb96('0x47')],_0x436946['extension']));}}catch(_0x462dde){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x48'),_0x436946[_0xdb96('0x4')]),_0x462dde);}};exports[_0xdb96('0x4f')]=function(_0x38b197){try{utils['debug'](util[_0xdb96('0x2')](_0xdb96('0x50'),_0x38b197[_0xdb96('0x51')]),_0x38b197);if(_0x38b197[_0xdb96('0x51')]==_0x38b197[_0xdb96('0x52')]){if(!_[_0xdb96('0x17')](queues[_0x38b197['secondtransfererlinkedid']])){utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x53'),_0x38b197['origtransfereruniqueid'],queues[_0x38b197['secondtransfererlinkedid']][_0xdb96('0x1d')],_0x38b197[_0xdb96('0x54')]));queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x41')]=!![];queues[_0x38b197[_0xdb96('0x55')]]['transfertype']=_0xdb96('0x56');queues[_0x38b197[_0xdb96('0x55')]]['transferexten']=_0x38b197[_0xdb96('0x54')];queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x4c')]=_0x38b197[_0xdb96('0x51')];queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xdb96('0x17')](queues[_0x38b197['origtransfererlinkedid']])){if(_0x38b197[_0xdb96('0x57')]&&queues[_0x38b197['transfereelinkedid']]){queues[_0x38b197[_0xdb96('0x57')]][_0xdb96('0x20')]=0x1;queues[_0x38b197[_0xdb96('0x47')]]=_[_0xdb96('0x58')](queues[_0x38b197[_0xdb96('0x57')]]);queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0xe')]=_0x38b197[_0xdb96('0x59')];queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x20')]=0x2;queues[_0x38b197[_0xdb96('0x47')]]['calleridnum']=queues[_0x38b197[_0xdb96('0x55')]]['calleridnum'];queues[_0x38b197[_0xdb96('0x47')]]['calleridname']=queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x5a')];queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x37')]=utils[_0xdb96('0x14')]();queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x36')]=utils['now']();queues[_0x38b197[_0xdb96('0x47')]]['holdtime']=0x0;queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x5b')]=0x0;utils['info'](util[_0xdb96('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x38b197[_0xdb96('0x51')],queues[_0x38b197['transfereeuniqueid']][_0xdb96('0x1d')],queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x6')],queues[_0x38b197[_0xdb96('0x47')]][_0xdb96('0x5a')]));}else{utils['info'](util['format'](_0xdb96('0x5c'),_0x38b197[_0xdb96('0x51')],queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x1d')],_0x38b197[_0xdb96('0x55')]));queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0xe')]=_0x38b197[_0xdb96('0x55')];}}}else if(_0x38b197[_0xdb96('0x5d')]==_0x38b197[_0xdb96('0x55')]){if(!_[_0xdb96('0x17')](queues[_0x38b197['origtransfererlinkedid']])){utils['info'](util['format'](_0xdb96('0x5e'),_0x38b197[_0xdb96('0x51')],queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x1d')],_0x38b197[_0xdb96('0x5d')],_0x38b197[_0xdb96('0x5f')]));queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x41')]=!![];queues[_0x38b197['origtransfererlinkedid']][_0xdb96('0x60')]=_0xdb96('0x56');queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x4a')]=_0x38b197['secondtransfererexten'];queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x4c')]=_0x38b197['secondtransfereruniqueid'];queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x8')]=_0xdb96('0x61');}if(!_[_0xdb96('0x17')](queues[_0x38b197[_0xdb96('0x55')]])){if(_0x38b197[_0xdb96('0x62')]&&queues[_0x38b197['transfertargetlinkedid']]){queues[_0x38b197[_0xdb96('0x62')]][_0xdb96('0x20')]=0x1;queues[_0x38b197['transfertargetuniqueid']]=_[_0xdb96('0x58')](queues[_0x38b197[_0xdb96('0x62')]]);queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0xe')]=_0x38b197['transfertargetuniqueid'];queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x20')]=0x2;queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x6')]=queues[_0x38b197[_0xdb96('0x52')]]['calleridnum'];queues[_0x38b197['transfertargetuniqueid']][_0xdb96('0x5a')]=queues[_0x38b197[_0xdb96('0x52')]][_0xdb96('0x5a')];queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x37')]=utils[_0xdb96('0x14')]();queues[_0x38b197['transfertargetuniqueid']][_0xdb96('0x36')]=utils['now']();queues[_0x38b197['transfertargetuniqueid']][_0xdb96('0x34')]=0x0;queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x5b')]=0x0;utils['info'](util[_0xdb96('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x38b197['origtransfereruniqueid'],queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x1d')],queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0xe')],queues[_0x38b197[_0xdb96('0x59')]]['calleridnum'],queues[_0x38b197[_0xdb96('0x59')]][_0xdb96('0x5a')]));}else{utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x5c'),_0x38b197[_0xdb96('0x51')],queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0x1d')],_0x38b197['origtransfererlinkedid']));queues[_0x38b197[_0xdb96('0x55')]][_0xdb96('0xe')]=_0x38b197[_0xdb96('0x52')];}}}}catch(_0x3af79f){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x50'),_0x38b197[_0xdb96('0x51')]),_0x3af79f);}};exports[_0xdb96('0x63')]=function(_0x130c36){try{if(!_[_0xdb96('0x17')](queues[_0x130c36['uniqueid']])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')]('[%s][queues][musiconholdstart]',_0x130c36[_0xdb96('0x4')]),_0x130c36);queues[_0x130c36[_0xdb96('0x4')]]['musiconholdstartAt']=utils[_0xdb96('0x14')]();utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x64'),_0x130c36[_0xdb96('0x4')],queues[_0x130c36[_0xdb96('0x4')]][_0xdb96('0x1d')],queues[_0x130c36[_0xdb96('0x4')]][_0xdb96('0x65')]));}}catch(_0x917b72){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x66'),_0x130c36[_0xdb96('0x4')]),_0x917b72);}};exports[_0xdb96('0x67')]=function(_0x5c2178){try{if(!_['isNil'](queues[_0x5c2178[_0xdb96('0x4')]])){if(!_['isNil'](queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x65')])){utils[_0xdb96('0x22')](util[_0xdb96('0x2')]('[%s][queues][musiconholdstop]',_0x5c2178['uniqueid']),_0x5c2178);queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x5b')]+=utils[_0xdb96('0x35')](utils[_0xdb96('0x14')](),queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x65')]);utils[_0xdb96('0x1e')](util[_0xdb96('0x2')](_0xdb96('0x68'),_0x5c2178[_0xdb96('0x4')],queues[_0x5c2178[_0xdb96('0x4')]]['name'],queues[_0x5c2178[_0xdb96('0x4')]]['mohtime']));delete queues[_0x5c2178[_0xdb96('0x4')]][_0xdb96('0x65')];}}}catch(_0x5d3ff0){utils[_0xdb96('0x15')](util[_0xdb96('0x2')](_0xdb96('0x69'),_0x5c2178['uniqueid']),_0x5d3ff0);}}; \ No newline at end of file +var _0xb2af=['transfertargetlinkedid','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','queuecallerexitAt','now','toUpperCase','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED'];(function(_0x22cfb4,_0x116ace){var _0x10a8c2=function(_0x1a5e71){while(--_0x1a5e71){_0x22cfb4['push'](_0x22cfb4['shift']());}};_0x10a8c2(++_0x116ace);}(_0xb2af,0xd2));var _0xfb2a=function(_0xd15bfb,_0x5a0284){_0xd15bfb=_0xd15bfb-0x0;var _0x2704ac=_0xb2af[_0xd15bfb];return _0x2704ac;};'use strict';var _=require(_0xfb2a('0x0'));var util=require(_0xfb2a('0x1'));var utils=require(_0xfb2a('0x2'));var queues={};function writeDB(_0x52856c){utils['info'](util[_0xfb2a('0x3')](_0xfb2a('0x4'),_0x52856c[_0xfb2a('0x5')],_0x52856c[_0xfb2a('0x6')],_0x52856c[_0xfb2a('0x7')],_0x52856c['lastAssignedTo'],_0x52856c[_0xfb2a('0x8')],_0x52856c[_0xfb2a('0x9')],_0x52856c[_0xfb2a('0xa')]));if(_0x52856c['queue']){utils[_0xfb2a('0xb')](_0x52856c[_0xfb2a('0x7')])[_0xfb2a('0xc')](function(_0x55bb4e){if(_0x55bb4e){_0x52856c[_0xfb2a('0xd')]=_0x55bb4e[_0xfb2a('0xd')];}utils[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x52856c);});}else{utils[_0xfb2a('0xe')](_0xfb2a('0xf'),_0x52856c);}if(_0x52856c[_0xfb2a('0x10')]){delete queues[_0x52856c[_0xfb2a('0x10')]];}else{delete queues[_0x52856c[_0xfb2a('0x5')]];}}exports[_0xfb2a('0x11')]=function(_0x39af6b){try{utils[_0xfb2a('0x12')](util['format']('[%s][queues][queuecallerjoin]',_0x39af6b['uniqueid']),_0x39af6b);utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')](_0xfb2a('0x14'),_0x39af6b[_0xfb2a('0x5')],_0x39af6b['queue'],_0x39af6b[_0xfb2a('0x15')]));queues[_0x39af6b['uniqueid']]=_['assign'](_0x39af6b,{'originalposition':_0x39af6b[_0xfb2a('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x55ab68){utils[_0xfb2a('0x16')](util[_0xfb2a('0x3')](_0xfb2a('0x17'),_0x39af6b[_0xfb2a('0x5')]),_0x55ab68);}};exports[_0xfb2a('0x18')]=function(_0xc85abf){try{if(!_[_0xfb2a('0x19')](queues[_0xc85abf[_0xfb2a('0x5')]])){utils[_0xfb2a('0x12')](util['format'](_0xfb2a('0x1a'),_0xc85abf[_0xfb2a('0x5')]),_0xc85abf);if(queues[_0xc85abf[_0xfb2a('0x5')]][_0xfb2a('0x1b')]){if(!queues[_0xc85abf['uniqueid']][_0xfb2a('0x1c')]&&!queues[_0xc85abf['uniqueid']][_0xfb2a('0x1d')]){queues[_0xc85abf[_0xfb2a('0x5')]][_0xfb2a('0x1e')]=!![];queues[_0xc85abf['uniqueid']]['queuecallercompleteAt']=utils['now']();queues[_0xc85abf['uniqueid']][_0xfb2a('0xa')]=_0xfb2a('0x1f');}utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')](_0xfb2a('0x20'),_0xc85abf[_0xfb2a('0x5')],queues[_0xc85abf[_0xfb2a('0x5')]][_0xfb2a('0x21')],queues[_0xc85abf[_0xfb2a('0x5')]][_0xfb2a('0xa')]));writeDB(queues[_0xc85abf['uniqueid']]);}else if(queues[_0xc85abf[_0xfb2a('0x5')]]['transfereduniqueid']){utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0xc85abf[_0xfb2a('0x5')],queues[_0xc85abf[_0xfb2a('0x5')]]['name'],queues[_0xc85abf[_0xfb2a('0x5')]][_0xfb2a('0x10')]));queues[queues[_0xc85abf['uniqueid']][_0xfb2a('0x10')]]=queues[_0xc85abf[_0xfb2a('0x5')]];queues[queues[_0xc85abf[_0xfb2a('0x5')]][_0xfb2a('0x10')]][_0xfb2a('0x22')]=0x2;delete queues[_0xc85abf[_0xfb2a('0x5')]];}}}catch(_0x35a7cc){utils[_0xfb2a('0x16')](util[_0xfb2a('0x3')](_0xfb2a('0x1a'),_0xc85abf['uniqueid']),_0x35a7cc);}};exports[_0xfb2a('0x23')]=function(_0x3a4861){try{utils[_0xfb2a('0x12')](util[_0xfb2a('0x3')](_0xfb2a('0x24'),_0x3a4861[_0xfb2a('0x5')]),_0x3a4861);if(!_[_0xfb2a('0x19')](_0x3a4861[_0xfb2a('0x25')]['queuestatus'])&&_0x3a4861[_0xfb2a('0x26')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xfb2a('0x19')](queues[_0x3a4861[_0xfb2a('0x5')]])){queues[_0x3a4861[_0xfb2a('0x5')]]['queuecallerabandon']=![];queues[_0x3a4861[_0xfb2a('0x5')]]['queuecallerabandonAt']=null;queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x1d')]=!![];queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x27')]=utils[_0xfb2a('0x28')]();queues[_0x3a4861[_0xfb2a('0x5')]]['queuecallerexitreason']=_0x3a4861['value'][_0xfb2a('0x29')]();utils[_0xfb2a('0x13')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3a4861[_0xfb2a('0x5')],queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x21')],_0x3a4861[_0xfb2a('0x26')],queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0xa')]));writeDB(queues[_0x3a4861['uniqueid']]);}}else if(!_[_0xfb2a('0x19')](_0x3a4861[_0xfb2a('0x25')][_0xfb2a('0x2a')])){if(!_[_0xfb2a('0x19')](queues[_0x3a4861[_0xfb2a('0x5')]])&&!queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x1c')]){queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x1c')]=![];queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x2b')]=null;queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x1d')]=!![];queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x27')]=utils[_0xfb2a('0x28')]();queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0xa')]=_0xfb2a('0x2c');utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')](_0xfb2a('0x2d'),_0x3a4861[_0xfb2a('0x5')],queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0x21')],_0x3a4861[_0xfb2a('0x26')],queues[_0x3a4861[_0xfb2a('0x5')]][_0xfb2a('0xa')]));}}}catch(_0x2e4b2f){utils['error'](util[_0xfb2a('0x3')](_0xfb2a('0x24'),_0x3a4861[_0xfb2a('0x5')]),_0x2e4b2f);}};exports[_0xfb2a('0x1c')]=function(_0x18cb08){try{if(!_[_0xfb2a('0x19')](queues[_0x18cb08['uniqueid']])){utils[_0xfb2a('0x12')](util[_0xfb2a('0x3')](_0xfb2a('0x2e'),_0x18cb08['uniqueid']),_0x18cb08);queues[_0x18cb08[_0xfb2a('0x5')]][_0xfb2a('0x1d')]=![];queues[_0x18cb08[_0xfb2a('0x5')]][_0xfb2a('0x27')]=null;queues[_0x18cb08['uniqueid']][_0xfb2a('0x1c')]=!![];queues[_0x18cb08[_0xfb2a('0x5')]][_0xfb2a('0x2b')]=utils[_0xfb2a('0x28')]();queues[_0x18cb08[_0xfb2a('0x5')]][_0xfb2a('0xa')]=_0xfb2a('0x2f');utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x18cb08['uniqueid'],queues[_0x18cb08['uniqueid']][_0xfb2a('0x21')],queues[_0x18cb08[_0xfb2a('0x5')]]['queuecallerexitreason']));}}catch(_0x5bcf5e){utils['error'](util[_0xfb2a('0x3')](_0xfb2a('0x2e'),_0x18cb08[_0xfb2a('0x5')]),_0x5bcf5e);}};exports[_0xfb2a('0x30')]=function(_0x4ba252){try{if(!_[_0xfb2a('0x19')](queues[_0x4ba252[_0xfb2a('0x5')]])){utils[_0xfb2a('0x12')](util['format']('[%s][queues][queuecallerleave]',_0x4ba252['uniqueid']),_0x4ba252);utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')](_0xfb2a('0x31'),_0x4ba252[_0xfb2a('0x5')],queues[_0x4ba252[_0xfb2a('0x5')]][_0xfb2a('0x21')],_0x4ba252[_0xfb2a('0x32')],_0x4ba252[_0xfb2a('0x33')]));queues[_0x4ba252[_0xfb2a('0x5')]]['queuecallerleave']=!![];queues[_0x4ba252['uniqueid']]['queuecallerleaveAt']=utils[_0xfb2a('0x28')]();queues[_0x4ba252['uniqueid']][_0xfb2a('0x34')]=utils['diffTime'](queues[_0x4ba252['uniqueid']][_0xfb2a('0x1b')],queues[_0x4ba252[_0xfb2a('0x5')]]['queuecallerjoinAt']);queues[_0x4ba252[_0xfb2a('0x5')]][_0xfb2a('0x15')]=_0x4ba252[_0xfb2a('0x15')];queues[_0x4ba252['uniqueid']][_0xfb2a('0x35')]=_0x4ba252[_0xfb2a('0x35')];queues[_0x4ba252['uniqueid']]['connectedlinenum']=_0x4ba252[_0xfb2a('0x32')];queues[_0x4ba252[_0xfb2a('0x5')]][_0xfb2a('0x33')]=_0x4ba252['connectedlinename'];}}catch(_0x1ea4c7){utils[_0xfb2a('0x16')](util[_0xfb2a('0x3')]('[%s][queues][queuecallerleave]',_0x4ba252[_0xfb2a('0x5')]),_0x1ea4c7);}};exports['agentconnect']=function(_0x4c42d4){try{if(!_[_0xfb2a('0x19')](queues[_0x4c42d4[_0xfb2a('0x5')]])){utils['debug'](util[_0xfb2a('0x3')](_0xfb2a('0x36'),_0x4c42d4[_0xfb2a('0x5')]),_0x4c42d4);utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')](_0xfb2a('0x37'),_0x4c42d4[_0xfb2a('0x5')],queues[_0x4c42d4[_0xfb2a('0x5')]][_0xfb2a('0x21')],_0x4c42d4[_0xfb2a('0x38')],_0x4c42d4[_0xfb2a('0x39')]));queues[_0x4c42d4[_0xfb2a('0x5')]][_0xfb2a('0x1c')]=![];queues[_0x4c42d4['uniqueid']][_0xfb2a('0x1c')]=![];queues[_0x4c42d4[_0xfb2a('0x5')]][_0xfb2a('0x2b')]=null;queues[_0x4c42d4[_0xfb2a('0x5')]][_0xfb2a('0x1d')]=![];queues[_0x4c42d4[_0xfb2a('0x5')]]['queuecallerexitreason']=null;queues[_0x4c42d4[_0xfb2a('0x5')]][_0xfb2a('0x27')]=null;queues[_0x4c42d4[_0xfb2a('0x5')]][_0xfb2a('0x3a')]=!![];queues[_0x4c42d4['uniqueid']]['accountcode']=_0x4c42d4['destaccountcode'];queues[_0x4c42d4[_0xfb2a('0x5')]][_0xfb2a('0x3b')]=_0x4c42d4['membername'];}}catch(_0x5a44ac){utils['error'](util[_0xfb2a('0x3')](_0xfb2a('0x36'),_0x4c42d4['uniqueid']),_0x5a44ac);}};exports[_0xfb2a('0x3c')]=function(_0x1ca196){try{if(!_[_0xfb2a('0x19')](queues[_0x1ca196['uniqueid']])){if(queues[_0x1ca196[_0xfb2a('0x5')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0xfb2a('0x3d'),_0x1ca196['uniqueid']),_0x1ca196);queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0x1c')]=![];queues[_0x1ca196[_0xfb2a('0x5')]]['queuecallerabandon']=![];queues[_0x1ca196[_0xfb2a('0x5')]]['queuecallerabandonAt']=null;queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0x1d')]=![];queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0x27')]=null;queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0x3a')]=!![];queues[_0x1ca196[_0xfb2a('0x5')]]['lastAssignedTo']=_0x1ca196[_0xfb2a('0x38')];queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0x1e')]=!![];queues[_0x1ca196['uniqueid']]['queuecallercompleteAt']=utils[_0xfb2a('0x28')]();if(_0x1ca196[_0xfb2a('0x3e')]==_0xfb2a('0x3f')){if(!queues[_0x1ca196['uniqueid']][_0xfb2a('0x3f')]){queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0xa')]=_0xfb2a('0x40');}}else{queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0xa')]=_0xfb2a('0x41')+_0x1ca196[_0xfb2a('0x3e')]['toUpperCase']();}utils['info'](util[_0xfb2a('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1ca196['uniqueid'],queues[_0x1ca196[_0xfb2a('0x5')]]['name'],_0x1ca196[_0xfb2a('0x38')],queues[_0x1ca196[_0xfb2a('0x5')]][_0xfb2a('0xa')]));writeDB(queues[_0x1ca196[_0xfb2a('0x5')]]);}}}catch(_0x31895c){utils['error'](util['format'](_0xfb2a('0x3d'),_0x1ca196['uniqueid']),_0x31895c);}};exports[_0xfb2a('0x42')]=function(_0x2f1b51){try{if(!_[_0xfb2a('0x19')](queues[_0x2f1b51[_0xfb2a('0x43')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x2f1b51[_0xfb2a('0x5')]),_0x2f1b51);queues[_0x2f1b51[_0xfb2a('0x43')]][_0xfb2a('0x3f')]=!![];queues[_0x2f1b51['transfereeuniqueid']][_0xfb2a('0x44')]=_0xfb2a('0x45');queues[_0x2f1b51[_0xfb2a('0x43')]][_0xfb2a('0x46')]=_0x2f1b51['extension'];queues[_0x2f1b51[_0xfb2a('0x43')]][_0xfb2a('0x47')]=_0x2f1b51[_0xfb2a('0x43')];queues[_0x2f1b51[_0xfb2a('0x43')]][_0xfb2a('0xa')]=_0xfb2a('0x48');utils['info'](util[_0xfb2a('0x3')](_0xfb2a('0x49'),_0x2f1b51[_0xfb2a('0x5')],queues[_0x2f1b51[_0xfb2a('0x43')]][_0xfb2a('0x21')],_0x2f1b51[_0xfb2a('0x43')],_0x2f1b51[_0xfb2a('0x4a')]));}}catch(_0x32125c){utils[_0xfb2a('0x16')](util[_0xfb2a('0x3')](_0xfb2a('0x4b'),_0x2f1b51[_0xfb2a('0x5')]),_0x32125c);}};exports['attendedtransfer']=function(_0x30c0ad){try{utils[_0xfb2a('0x12')](util[_0xfb2a('0x3')](_0xfb2a('0x4c'),_0x30c0ad[_0xfb2a('0x4d')]),_0x30c0ad);if(_0x30c0ad[_0xfb2a('0x4d')]==_0x30c0ad[_0xfb2a('0x4e')]){if(!_['isNil'](queues[_0x30c0ad[_0xfb2a('0x4f')]])){utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x30c0ad[_0xfb2a('0x4d')],queues[_0x30c0ad[_0xfb2a('0x4f')]][_0xfb2a('0x21')],_0x30c0ad[_0xfb2a('0x50')]));queues[_0x30c0ad[_0xfb2a('0x4f')]][_0xfb2a('0x3f')]=!![];queues[_0x30c0ad[_0xfb2a('0x4f')]][_0xfb2a('0x44')]='ATTENDED';queues[_0x30c0ad[_0xfb2a('0x4f')]][_0xfb2a('0x46')]=_0x30c0ad['origtransfererexten'];queues[_0x30c0ad['secondtransfererlinkedid']]['transferuniqueid']=_0x30c0ad['origtransfereruniqueid'];queues[_0x30c0ad[_0xfb2a('0x4f')]]['queuecallerexitreason']=_0xfb2a('0x51');}if(!_[_0xfb2a('0x19')](queues[_0x30c0ad[_0xfb2a('0x4e')]])){if(_0x30c0ad['transfereelinkedid']&&queues[_0x30c0ad[_0xfb2a('0x52')]]){queues[_0x30c0ad['transfereelinkedid']][_0xfb2a('0x22')]=0x1;queues[_0x30c0ad['transfereeuniqueid']]=_['clone'](queues[_0x30c0ad[_0xfb2a('0x52')]]);queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x10')]=_0x30c0ad[_0xfb2a('0x53')];queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x22')]=0x2;queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x8')]=queues[_0x30c0ad[_0xfb2a('0x4f')]][_0xfb2a('0x8')];queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x54')]=queues[_0x30c0ad[_0xfb2a('0x4f')]]['calleridname'];queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x55')]=utils[_0xfb2a('0x28')]();queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x1b')]=utils[_0xfb2a('0x28')]();queues[_0x30c0ad[_0xfb2a('0x43')]]['holdtime']=0x0;queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x56')]=0x0;utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')](_0xfb2a('0x57'),_0x30c0ad[_0xfb2a('0x4d')],queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x21')],queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x8')],queues[_0x30c0ad[_0xfb2a('0x43')]][_0xfb2a('0x54')]));}else{utils[_0xfb2a('0x13')](util['format'](_0xfb2a('0x58'),_0x30c0ad[_0xfb2a('0x4d')],queues[_0x30c0ad[_0xfb2a('0x4e')]][_0xfb2a('0x21')],_0x30c0ad['secondtransfererlinkedid']));queues[_0x30c0ad[_0xfb2a('0x4e')]][_0xfb2a('0x10')]=_0x30c0ad[_0xfb2a('0x4f')];}}}else if(_0x30c0ad[_0xfb2a('0x59')]==_0x30c0ad[_0xfb2a('0x4f')]){if(!_[_0xfb2a('0x19')](queues[_0x30c0ad[_0xfb2a('0x4e')]])){utils[_0xfb2a('0x13')](util['format'](_0xfb2a('0x5a'),_0x30c0ad[_0xfb2a('0x4d')],queues[_0x30c0ad['origtransfererlinkedid']][_0xfb2a('0x21')],_0x30c0ad[_0xfb2a('0x59')],_0x30c0ad[_0xfb2a('0x5b')]));queues[_0x30c0ad['origtransfererlinkedid']][_0xfb2a('0x3f')]=!![];queues[_0x30c0ad['origtransfererlinkedid']][_0xfb2a('0x44')]=_0xfb2a('0x5c');queues[_0x30c0ad[_0xfb2a('0x4e')]]['transferexten']=_0x30c0ad['secondtransfererexten'];queues[_0x30c0ad[_0xfb2a('0x4e')]][_0xfb2a('0x47')]=_0x30c0ad[_0xfb2a('0x59')];queues[_0x30c0ad['origtransfererlinkedid']][_0xfb2a('0xa')]=_0xfb2a('0x51');}if(!_['isNil'](queues[_0x30c0ad[_0xfb2a('0x4f')]])){if(_0x30c0ad['transfertargetlinkedid']&&queues[_0x30c0ad[_0xfb2a('0x5d')]]){queues[_0x30c0ad[_0xfb2a('0x5d')]][_0xfb2a('0x22')]=0x1;queues[_0x30c0ad[_0xfb2a('0x53')]]=_['clone'](queues[_0x30c0ad[_0xfb2a('0x5d')]]);queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x10')]=_0x30c0ad['transfertargetuniqueid'];queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x22')]=0x2;queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x8')]=queues[_0x30c0ad[_0xfb2a('0x4e')]][_0xfb2a('0x8')];queues[_0x30c0ad['transfertargetuniqueid']][_0xfb2a('0x54')]=queues[_0x30c0ad[_0xfb2a('0x4e')]][_0xfb2a('0x54')];queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x55')]=utils[_0xfb2a('0x28')]();queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x1b')]=utils[_0xfb2a('0x28')]();queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x34')]=0x0;queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x56')]=0x0;utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x30c0ad['origtransfereruniqueid'],queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x21')],queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x10')],queues[_0x30c0ad[_0xfb2a('0x53')]]['calleridnum'],queues[_0x30c0ad[_0xfb2a('0x53')]][_0xfb2a('0x54')]));}else{utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x30c0ad[_0xfb2a('0x4d')],queues[_0x30c0ad[_0xfb2a('0x4f')]][_0xfb2a('0x21')],_0x30c0ad[_0xfb2a('0x4e')]));queues[_0x30c0ad[_0xfb2a('0x4f')]][_0xfb2a('0x10')]=_0x30c0ad[_0xfb2a('0x4e')];}}}}catch(_0x41b398){utils[_0xfb2a('0x16')](util[_0xfb2a('0x3')](_0xfb2a('0x4c'),_0x30c0ad[_0xfb2a('0x4d')]),_0x41b398);}};exports[_0xfb2a('0x5e')]=function(_0x272495){try{if(!_[_0xfb2a('0x19')](queues[_0x272495['uniqueid']])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x272495[_0xfb2a('0x5')]),_0x272495);queues[_0x272495[_0xfb2a('0x5')]][_0xfb2a('0x5f')]=utils[_0xfb2a('0x28')]();utils[_0xfb2a('0x13')](util[_0xfb2a('0x3')](_0xfb2a('0x60'),_0x272495[_0xfb2a('0x5')],queues[_0x272495[_0xfb2a('0x5')]][_0xfb2a('0x21')],queues[_0x272495[_0xfb2a('0x5')]][_0xfb2a('0x5f')]));}}catch(_0x159975){utils[_0xfb2a('0x16')](util[_0xfb2a('0x3')](_0xfb2a('0x61'),_0x272495[_0xfb2a('0x5')]),_0x159975);}};exports['musiconholdstop']=function(_0x1b5daa){try{if(!_['isNil'](queues[_0x1b5daa['uniqueid']])){if(!_[_0xfb2a('0x19')](queues[_0x1b5daa[_0xfb2a('0x5')]][_0xfb2a('0x5f')])){utils[_0xfb2a('0x12')](util[_0xfb2a('0x3')]('[%s][queues][musiconholdstop]',_0x1b5daa[_0xfb2a('0x5')]),_0x1b5daa);queues[_0x1b5daa[_0xfb2a('0x5')]][_0xfb2a('0x56')]+=utils[_0xfb2a('0x62')](utils[_0xfb2a('0x28')](),queues[_0x1b5daa[_0xfb2a('0x5')]][_0xfb2a('0x5f')]);utils[_0xfb2a('0x13')](util['format'](_0xfb2a('0x63'),_0x1b5daa[_0xfb2a('0x5')],queues[_0x1b5daa[_0xfb2a('0x5')]][_0xfb2a('0x21')],queues[_0x1b5daa[_0xfb2a('0x5')]][_0xfb2a('0x56')]));delete queues[_0x1b5daa['uniqueid']]['musiconholdstartAt'];}}}catch(_0x576dbb){utils[_0xfb2a('0x16')](util[_0xfb2a('0x3')](_0xfb2a('0x64'),_0x1b5daa[_0xfb2a('0x5')]),_0x576dbb);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 8104165..fcfbe93 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8278=['[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','info','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','context','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','linkedid','find','monitors','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin'];(function(_0x47794f,_0x12c9b3){var _0x2ca51d=function(_0x43deb3){while(--_0x43deb3){_0x47794f['push'](_0x47794f['shift']());}};_0x2ca51d(++_0x12c9b3);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var utils=require(_0x8827('0x2'));var recordings={};function writeDB(_0x36bb50){utils['info'](util['format'](_0x8827('0x3'),_0x36bb50[_0x8827('0x4')]));if(_0x36bb50[_0x8827('0x5')]){utils[_0x8827('0x6')](_0x36bb50['accountcode'])[_0x8827('0x7')](function(_0x4342d7){if(_0x4342d7){_0x36bb50[_0x8827('0x8')]=_0x4342d7[_0x8827('0x9')];_0x36bb50[_0x8827('0xa')]=_0x4342d7['id'];}utils[_0x8827('0xb')](_0x8827('0xc'),_0x36bb50);});}else{utils[_0x8827('0xb')](_0x8827('0xc'),_0x36bb50);}}exports[_0x8827('0xd')]=function(_0x3c1ba6){try{utils[_0x8827('0xe')](util[_0x8827('0xf')]('[%s][recordings][newchannel]',_0x3c1ba6[_0x8827('0x4')]),_0x3c1ba6);if(_0x3c1ba6[_0x8827('0x4')]==_0x3c1ba6['linkedid']){utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3c1ba6[_0x8827('0x4')],_0x3c1ba6['context'],_0x3c1ba6['exten']));recordings[_0x3c1ba6[_0x8827('0x4')]]={'uniqueid':_0x3c1ba6[_0x8827('0x4')],'accountcode':_0x3c1ba6[_0x8827('0x5')],'exten':_0x3c1ba6[_0x8827('0x11')],'context':_0x3c1ba6['context'],'channel':_0x3c1ba6[_0x8827('0x12')],'monitors':[]};}}catch(_0xc0b479){utils[_0x8827('0x13')](util[_0x8827('0xf')](_0x8827('0x14'),_0x3c1ba6[_0x8827('0x4')]),_0xc0b479);}};exports[_0x8827('0x15')]=function(_0x560fba){try{utils[_0x8827('0xe')](util[_0x8827('0xf')](_0x8827('0x16'),_0x560fba['uniqueid']),_0x560fba);if(!_[_0x8827('0x17')](recordings[_0x560fba[_0x8827('0x4')]])&&_0x560fba[_0x8827('0x18')]==0x6){utils['info'](util['format'](_0x8827('0x19'),_0x560fba[_0x8827('0x4')],_0x560fba['context'],_0x560fba['channel']));}else if(!_[_0x8827('0x17')](recordings[_0x560fba['linkedid']])&&_0x560fba['channelstate']==0x6&&_0x560fba['context']!=_0x8827('0x1a')){utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x560fba[_0x8827('0x4')],_0x560fba['linkedid'],_0x560fba[_0x8827('0x1b')],_0x560fba[_0x8827('0x12')]));recordings[_0x560fba['linkedid']]['accountcode']=_0x560fba[_0x8827('0x5')];}}catch(_0x5226fc){utils[_0x8827('0x13')](util['format'](_0x8827('0x16'),_0x560fba[_0x8827('0x4')]),_0x5226fc);}};exports[_0x8827('0x1c')]=function(_0x531b8c){try{if(!_[_0x8827('0x17')](_0x531b8c[_0x8827('0x1d')])&&!_[_0x8827('0x17')](_0x531b8c['variable'][_0x8827('0x1e')])){utils['debug'](util[_0x8827('0xf')](_0x8827('0x1f'),_0x531b8c['uniqueid']),_0x531b8c);utils[_0x8827('0x10')](util[_0x8827('0xf')](_0x8827('0x20'),_0x531b8c[_0x8827('0x4')],_0x531b8c[_0x8827('0x1d')],_0x531b8c[_0x8827('0x21')]));if(_['endsWith'](_0x531b8c['value'],_0x8827('0x22'))){_0x531b8c['value']=_0x531b8c[_0x8827('0x21')][_0x8827('0x23')]('.wav49','.WAV');}if(recordings[_0x531b8c[_0x8827('0x24')]]){var _0x5e03ec=_[_0x8827('0x25')](recordings[_0x531b8c[_0x8827('0x24')]][_0x8827('0x26')],{'value':_0x531b8c[_0x8827('0x21')]});if(_['isNil'](_0x5e03ec)){recordings[_0x531b8c[_0x8827('0x24')]]['monitors']['push']({'value':_0x531b8c[_0x8827('0x21')]});}}}}catch(_0x27891a){utils[_0x8827('0x13')](util[_0x8827('0xf')]('[%s][recordings][varset]',_0x531b8c[_0x8827('0x4')]),_0x27891a);}};exports[_0x8827('0x27')]=function(_0x463629){try{if(!_['isNil'](recordings[_0x463629[_0x8827('0x4')]])){utils['debug'](util[_0x8827('0xf')](_0x8827('0x28'),_0x463629['uniqueid']),_0x463629);utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x463629['uniqueid'],_0x463629[_0x8827('0x29')],_0x463629[_0x8827('0x2a')],_0x463629['cause-txt']));recordings[_0x463629['uniqueid']]['calleridnum']=_0x463629[_0x8827('0x29')];recordings[_0x463629['uniqueid']][_0x8827('0x2a')]=_0x463629[_0x8827('0x2a')];recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x2b')]=_0x463629[_0x8827('0x2b')];recordings[_0x463629[_0x8827('0x4')]]['connectedlinename']=_0x463629[_0x8827('0x2c')];if(recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x2d')]=='outbound'&&recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x5')]){recordings[_0x463629['uniqueid']]['connectedlinenum']=recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x5')];recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x2c')]='';}recordings[_0x463629[_0x8827('0x4')]][_0x8827('0x26')][_0x8827('0x2e')](function(_0x47d058){var _0x1c0499=_['clone'](recordings[_0x463629[_0x8827('0x4')]]);_0x1c0499[_0x8827('0x21')]=_0x47d058[_0x8827('0x21')];writeDB(_0x1c0499);});delete recordings[_0x463629[_0x8827('0x4')]];}}catch(_0x10ad56){utils[_0x8827('0x13')](util[_0x8827('0xf')](_0x8827('0x28'),_0x463629[_0x8827('0x4')]),_0x10ad56);}};exports[_0x8827('0x2f')]=function(_0x533fae){try{if(!_['isNil'](recordings[_0x533fae[_0x8827('0x4')]])){utils[_0x8827('0xe')](util[_0x8827('0xf')](_0x8827('0x30'),_0x533fae[_0x8827('0x4')]),_0x533fae);utils[_0x8827('0x10')](util[_0x8827('0xf')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x533fae['uniqueid'],_0x533fae[_0x8827('0x31')],_0x533fae['appdata']));if(_0x533fae[_0x8827('0x31')][_0x8827('0x32')]()==_0x8827('0x33')&&_[_0x8827('0x34')](_0x533fae[_0x8827('0x35')]['toLowerCase'](),'cdr')){var _0x262a27=_0x533fae[_0x8827('0x35')][_0x8827('0x36')]('=');var _0x32accd=_0x262a27[0x0][_0x8827('0x37')](_0x262a27[0x0][_0x8827('0x38')]('(')+0x1,_0x262a27[0x0]['lastIndexOf'](')'));var _0x1ac32f=_0x262a27[0x1];recordings[_0x533fae[_0x8827('0x4')]][_0x32accd]=_0x1ac32f;}}}catch(_0x171010){utils['error'](util[_0x8827('0xf')]('[%s][recordings][newexten]',_0x533fae[_0x8827('0x4')]),_0x171010);}};exports[_0x8827('0x39')]=function(_0x344e00){try{if(!_['isNil'](recordings[_0x344e00['uniqueid']])){utils[_0x8827('0xe')](util['format'](_0x8827('0x3a'),_0x344e00[_0x8827('0x4')]),_0x344e00);utils['info'](util[_0x8827('0xf')](_0x8827('0x3b'),_0x344e00[_0x8827('0x4')],_0x344e00[_0x8827('0x3c')]));recordings[_0x344e00[_0x8827('0x4')]]['queue']=_0x344e00[_0x8827('0x3c')];}}catch(_0x19ad4a){utils['error'](util['format'](_0x8827('0x3a'),_0x344e00[_0x8827('0x4')]),_0x19ad4a);}}; \ No newline at end of file +var _0x699a=['then','membername','name','UserId','request','debug','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','error','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','replace','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode'];(function(_0x2a8dc4,_0x355558){var _0x19a90f=function(_0xbfc3c0){while(--_0xbfc3c0){_0x2a8dc4['push'](_0x2a8dc4['shift']());}};_0x19a90f(++_0x355558);}(_0x699a,0x12a));var _0xa699=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x699a[_0x3fb030];return _0xd6899b;};'use strict';var _=require(_0xa699('0x0'));var util=require(_0xa699('0x1'));var utils=require(_0xa699('0x2'));var recordings={};function writeDB(_0x310c1b){utils['info'](util[_0xa699('0x3')](_0xa699('0x4'),_0x310c1b[_0xa699('0x5')]));if(_0x310c1b['accountcode']){utils['getUserByInternal'](_0x310c1b[_0xa699('0x6')])[_0xa699('0x7')](function(_0x5e4564){if(_0x5e4564){_0x310c1b[_0xa699('0x8')]=_0x5e4564[_0xa699('0x9')];_0x310c1b[_0xa699('0xa')]=_0x5e4564['id'];}utils[_0xa699('0xb')]('CreateVoiceRecording',_0x310c1b);});}else{utils[_0xa699('0xb')]('CreateVoiceRecording',_0x310c1b);}}exports['newchannel']=function(_0x1b1c3e){try{utils[_0xa699('0xc')](util[_0xa699('0x3')]('[%s][recordings][newchannel]',_0x1b1c3e[_0xa699('0x5')]),_0x1b1c3e);if(_0x1b1c3e['uniqueid']==_0x1b1c3e[_0xa699('0xd')]){utils[_0xa699('0xe')](util['format'](_0xa699('0xf'),_0x1b1c3e[_0xa699('0x5')],_0x1b1c3e[_0xa699('0x10')],_0x1b1c3e[_0xa699('0x11')]));recordings[_0x1b1c3e['uniqueid']]={'uniqueid':_0x1b1c3e[_0xa699('0x5')],'accountcode':_0x1b1c3e[_0xa699('0x6')],'exten':_0x1b1c3e['exten'],'context':_0x1b1c3e[_0xa699('0x10')],'channel':_0x1b1c3e['channel'],'monitors':[]};}}catch(_0x1ee738){utils['error'](util[_0xa699('0x3')](_0xa699('0x12'),_0x1b1c3e[_0xa699('0x5')]),_0x1ee738);}};exports[_0xa699('0x13')]=function(_0x51645f){try{utils['debug'](util[_0xa699('0x3')](_0xa699('0x14'),_0x51645f[_0xa699('0x5')]),_0x51645f);if(!_[_0xa699('0x15')](recordings[_0x51645f[_0xa699('0x5')]])&&_0x51645f[_0xa699('0x16')]==0x6){utils[_0xa699('0xe')](util[_0xa699('0x3')](_0xa699('0x17'),_0x51645f['uniqueid'],_0x51645f[_0xa699('0x10')],_0x51645f[_0xa699('0x18')]));}else if(!_['isNil'](recordings[_0x51645f['linkedid']])&&_0x51645f[_0xa699('0x16')]==0x6&&_0x51645f[_0xa699('0x10')]!=_0xa699('0x19')){utils[_0xa699('0xe')](util[_0xa699('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x51645f['uniqueid'],_0x51645f[_0xa699('0xd')],_0x51645f[_0xa699('0x10')],_0x51645f[_0xa699('0x18')]));recordings[_0x51645f[_0xa699('0xd')]]['accountcode']=_0x51645f[_0xa699('0x6')];}}catch(_0x58b640){utils[_0xa699('0x1a')](util[_0xa699('0x3')](_0xa699('0x14'),_0x51645f[_0xa699('0x5')]),_0x58b640);}};exports[_0xa699('0x1b')]=function(_0x2595dc){try{if(!_[_0xa699('0x15')](_0x2595dc['variable'])&&!_['isNil'](_0x2595dc[_0xa699('0x1c')]['mixmonitor_filename'])){utils[_0xa699('0xc')](util[_0xa699('0x3')](_0xa699('0x1d'),_0x2595dc[_0xa699('0x5')]),_0x2595dc);utils['info'](util[_0xa699('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2595dc[_0xa699('0x5')],_0x2595dc[_0xa699('0x1c')],_0x2595dc[_0xa699('0x1e')]));if(_[_0xa699('0x1f')](_0x2595dc[_0xa699('0x1e')],_0xa699('0x20'))){_0x2595dc[_0xa699('0x1e')]=_0x2595dc[_0xa699('0x1e')][_0xa699('0x21')](_0xa699('0x20'),'.WAV');}if(recordings[_0x2595dc[_0xa699('0xd')]]){var _0x204de2=_[_0xa699('0x22')](recordings[_0x2595dc[_0xa699('0xd')]]['monitors'],{'value':_0x2595dc[_0xa699('0x1e')]});if(_[_0xa699('0x15')](_0x204de2)){recordings[_0x2595dc[_0xa699('0xd')]][_0xa699('0x23')]['push']({'value':_0x2595dc[_0xa699('0x1e')]});}}}}catch(_0x3c88dd){utils[_0xa699('0x1a')](util[_0xa699('0x3')](_0xa699('0x1d'),_0x2595dc[_0xa699('0x5')]),_0x3c88dd);}};exports[_0xa699('0x24')]=function(_0x9ed120){try{if(!_[_0xa699('0x15')](recordings[_0x9ed120[_0xa699('0x5')]])){utils['debug'](util[_0xa699('0x3')](_0xa699('0x25'),_0x9ed120[_0xa699('0x5')]),_0x9ed120);utils[_0xa699('0xe')](util[_0xa699('0x3')](_0xa699('0x26'),_0x9ed120[_0xa699('0x5')],_0x9ed120['calleridnum'],_0x9ed120[_0xa699('0x27')],_0x9ed120[_0xa699('0x28')]));recordings[_0x9ed120[_0xa699('0x5')]][_0xa699('0x29')]=_0x9ed120[_0xa699('0x29')];recordings[_0x9ed120[_0xa699('0x5')]][_0xa699('0x27')]=_0x9ed120['calleridname'];recordings[_0x9ed120['uniqueid']][_0xa699('0x2a')]=_0x9ed120[_0xa699('0x2a')];recordings[_0x9ed120[_0xa699('0x5')]][_0xa699('0x2b')]=_0x9ed120[_0xa699('0x2b')];if(recordings[_0x9ed120[_0xa699('0x5')]][_0xa699('0x2c')]==_0xa699('0x2d')&&recordings[_0x9ed120[_0xa699('0x5')]]['accountcode']){recordings[_0x9ed120[_0xa699('0x5')]][_0xa699('0x2a')]=recordings[_0x9ed120[_0xa699('0x5')]][_0xa699('0x6')];recordings[_0x9ed120[_0xa699('0x5')]][_0xa699('0x2b')]='';}recordings[_0x9ed120['uniqueid']]['monitors'][_0xa699('0x2e')](function(_0x2dff2e){var _0x5081d0=_[_0xa699('0x2f')](recordings[_0x9ed120[_0xa699('0x5')]]);_0x5081d0[_0xa699('0x1e')]=_0x2dff2e[_0xa699('0x1e')];writeDB(_0x5081d0);});delete recordings[_0x9ed120[_0xa699('0x5')]];}}catch(_0x2ead8f){utils['error'](util[_0xa699('0x3')](_0xa699('0x25'),_0x9ed120[_0xa699('0x5')]),_0x2ead8f);}};exports[_0xa699('0x30')]=function(_0xb9a3c4){try{if(!_['isNil'](recordings[_0xb9a3c4[_0xa699('0x5')]])){utils['debug'](util[_0xa699('0x3')](_0xa699('0x31'),_0xb9a3c4[_0xa699('0x5')]),_0xb9a3c4);utils['info'](util[_0xa699('0x3')](_0xa699('0x32'),_0xb9a3c4[_0xa699('0x5')],_0xb9a3c4[_0xa699('0x33')],_0xb9a3c4[_0xa699('0x34')]));if(_0xb9a3c4['application']['toLowerCase']()=='set'&&_['startsWith'](_0xb9a3c4[_0xa699('0x34')][_0xa699('0x35')](),'cdr')){var _0x5548e1=_0xb9a3c4[_0xa699('0x34')][_0xa699('0x36')]('=');var _0x43023d=_0x5548e1[0x0][_0xa699('0x37')](_0x5548e1[0x0]['lastIndexOf']('(')+0x1,_0x5548e1[0x0][_0xa699('0x38')](')'));var _0x270dd4=_0x5548e1[0x1];recordings[_0xb9a3c4[_0xa699('0x5')]][_0x43023d]=_0x270dd4;}}}catch(_0xcf65ca){utils[_0xa699('0x1a')](util['format'](_0xa699('0x31'),_0xb9a3c4[_0xa699('0x5')]),_0xcf65ca);}};exports[_0xa699('0x39')]=function(_0x37a1de){try{if(!_['isNil'](recordings[_0x37a1de[_0xa699('0x5')]])){utils['debug'](util[_0xa699('0x3')](_0xa699('0x3a'),_0x37a1de['uniqueid']),_0x37a1de);utils['info'](util['format'](_0xa699('0x3b'),_0x37a1de[_0xa699('0x5')],_0x37a1de[_0xa699('0x3c')]));recordings[_0x37a1de[_0xa699('0x5')]][_0xa699('0x3c')]=_0x37a1de[_0xa699('0x3c')];}}catch(_0x288930){utils['error'](util[_0xa699('0x3')]('[%s][recordings][queuecallerjoin]',_0x37a1de[_0xa699('0x5')]),_0x288930);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f62306e..69e1673 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a59=['attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','assign','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','error'];(function(_0x4d0899,_0x208802){var _0x5142de=function(_0x272e14){while(--_0x272e14){_0x4d0899['push'](_0x4d0899['shift']());}};_0x5142de(++_0x208802);}(_0x3a59,0x172));var _0x93a5=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x3a59[_0x22e9fe];return _0x47cd19;};'use strict';var _=require(_0x93a5('0x0'));var util=require(_0x93a5('0x1'));var utils=require(_0x93a5('0x2'));function writeDB(_0x35eb3d){utils[_0x93a5('0x3')](util[_0x93a5('0x4')](_0x93a5('0x5'),_0x35eb3d[_0x93a5('0x6')]==='attended'?_0x35eb3d[_0x93a5('0x7')]:_0x35eb3d['uniqueid'],_0x35eb3d[_0x93a5('0x6')]));utils[_0x93a5('0x8')](_0x93a5('0x9'),_0x35eb3d);}exports[_0x93a5('0xa')]={};exports[_0x93a5('0xb')]=function(_0x207ba3){try{utils[_0x93a5('0xc')](util[_0x93a5('0x4')](_0x93a5('0xd'),_0x207ba3[_0x93a5('0xe')]),_0x207ba3);utils[_0x93a5('0x3')](util[_0x93a5('0x4')](_0x93a5('0xf'),_0x207ba3[_0x93a5('0xe')],_0x207ba3['transferercalleridnum'],_0x207ba3[_0x93a5('0x10')],_0x207ba3['transfereecalleridnum'],_0x207ba3[_0x93a5('0x11')]));_0x207ba3[_0x93a5('0x6')]='blind';exports[_0x93a5('0xa')][_0x207ba3[_0x93a5('0x12')]]=_0x207ba3;writeDB(_0x207ba3);}catch(_0x10f2e1){utils[_0x93a5('0x13')](util[_0x93a5('0x4')]('[%s][transfers][blindtransfer]',_0x207ba3['uniqueid']),_0x10f2e1);}};exports[_0x93a5('0x14')]=function(_0x6bc17f){try{utils[_0x93a5('0xc')](util[_0x93a5('0x4')](_0x93a5('0x15'),_0x6bc17f[_0x93a5('0x7')]),_0x6bc17f);utils[_0x93a5('0x3')](util[_0x93a5('0x4')](_0x93a5('0x16'),_0x6bc17f[_0x93a5('0x7')],_0x6bc17f[_0x93a5('0x17')],_0x6bc17f[_0x93a5('0x18')],_0x6bc17f['transfertargetcalleridnum'],_0x6bc17f[_0x93a5('0x19')]));_0x6bc17f=_['assign'](_0x6bc17f,{'transfererchannel':_0x6bc17f['origtransfererchannel'],'transferercalleridnum':_0x6bc17f[_0x93a5('0x17')],'transferercalleridname':_0x6bc17f[_0x93a5('0x18')],'transfererconnectedlinenum':_0x6bc17f[_0x93a5('0x1a')],'transfererconnectedlinename':_0x6bc17f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x6bc17f[_0x93a5('0x1b')],'transferercontext':_0x6bc17f[_0x93a5('0x1c')],'transfererexten':_0x6bc17f[_0x93a5('0x1d')],'transfererlinkedid':_0x6bc17f[_0x93a5('0x1e')],'context':_0x6bc17f[_0x93a5('0x1f')],'extension':_0x6bc17f['origtransfererexten'],'type':_0x93a5('0x20')});if(_[_0x93a5('0x21')](_0x6bc17f[_0x93a5('0x22')])){_0x6bc17f=_[_0x93a5('0x23')](_0x6bc17f,{'transfereechannel':_0x6bc17f['transfertargetchannel'],'transfereecalleridnum':_0x6bc17f['transfertargetcalleridnum'],'transfereecalleridname':_0x6bc17f[_0x93a5('0x19')],'transfereeconnectedlinenum':_0x6bc17f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x6bc17f[_0x93a5('0x24')],'transfereeaccountcode':_0x6bc17f[_0x93a5('0x25')],'transfereecontext':_0x6bc17f['transfertargetcontext'],'transfereeexten':_0x6bc17f[_0x93a5('0x26')],'transfereelinkedid':_0x6bc17f['transfertargetlinkedid']});}writeDB(_0x6bc17f);}catch(_0x1d1081){utils[_0x93a5('0x13')](util[_0x93a5('0x4')](_0x93a5('0x15'),_0x6bc17f[_0x93a5('0x7')]),_0x1d1081);}}; \ No newline at end of file +var _0x84f9=['origtransfereraccountcode','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x84f9,0x163));var _0x984f=function(_0xb3d93f,_0x170e7b){_0xb3d93f=_0xb3d93f-0x0;var _0x4719f4=_0x84f9[_0xb3d93f];return _0x4719f4;};'use strict';var _=require(_0x984f('0x0'));var util=require('util');var utils=require(_0x984f('0x1'));function writeDB(_0xcda2d1){utils[_0x984f('0x2')](util[_0x984f('0x3')](_0x984f('0x4'),_0xcda2d1[_0x984f('0x5')]===_0x984f('0x6')?_0xcda2d1[_0x984f('0x7')]:_0xcda2d1[_0x984f('0x8')],_0xcda2d1['type']));utils[_0x984f('0x9')](_0x984f('0xa'),_0xcda2d1);}exports[_0x984f('0xb')]={};exports['blindtransfer']=function(_0xc3f93f){try{utils[_0x984f('0xc')](util[_0x984f('0x3')](_0x984f('0xd'),_0xc3f93f[_0x984f('0x8')]),_0xc3f93f);utils['info'](util[_0x984f('0x3')](_0x984f('0xe'),_0xc3f93f['uniqueid'],_0xc3f93f[_0x984f('0xf')],_0xc3f93f[_0x984f('0x10')],_0xc3f93f[_0x984f('0x11')],_0xc3f93f[_0x984f('0x12')]));_0xc3f93f[_0x984f('0x5')]=_0x984f('0x13');exports['blinds'][_0xc3f93f[_0x984f('0x14')]]=_0xc3f93f;writeDB(_0xc3f93f);}catch(_0x3abf2c){utils[_0x984f('0x15')](util['format'](_0x984f('0xd'),_0xc3f93f[_0x984f('0x8')]),_0x3abf2c);}};exports[_0x984f('0x16')]=function(_0x5007fa){try{utils[_0x984f('0xc')](util[_0x984f('0x3')](_0x984f('0x17'),_0x5007fa['origtransfereruniqueid']),_0x5007fa);utils[_0x984f('0x2')](util[_0x984f('0x3')](_0x984f('0x18'),_0x5007fa[_0x984f('0x7')],_0x5007fa[_0x984f('0x19')],_0x5007fa[_0x984f('0x1a')],_0x5007fa[_0x984f('0x1b')],_0x5007fa[_0x984f('0x1c')]));_0x5007fa=_[_0x984f('0x1d')](_0x5007fa,{'transfererchannel':_0x5007fa[_0x984f('0x1e')],'transferercalleridnum':_0x5007fa[_0x984f('0x19')],'transferercalleridname':_0x5007fa[_0x984f('0x1a')],'transfererconnectedlinenum':_0x5007fa['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5007fa[_0x984f('0x1f')],'transfereraccountcode':_0x5007fa[_0x984f('0x20')],'transferercontext':_0x5007fa['secondtransferercontext'],'transfererexten':_0x5007fa['secondtransfererexten'],'transfererlinkedid':_0x5007fa['origtransfererlinkedid'],'context':_0x5007fa[_0x984f('0x21')],'extension':_0x5007fa[_0x984f('0x22')],'type':_0x984f('0x6')});if(_[_0x984f('0x23')](_0x5007fa[_0x984f('0x24')])){_0x5007fa=_[_0x984f('0x1d')](_0x5007fa,{'transfereechannel':_0x5007fa[_0x984f('0x25')],'transfereecalleridnum':_0x5007fa[_0x984f('0x1b')],'transfereecalleridname':_0x5007fa[_0x984f('0x1c')],'transfereeconnectedlinenum':_0x5007fa[_0x984f('0x26')],'transfereeconnectedlinename':_0x5007fa[_0x984f('0x27')],'transfereeaccountcode':_0x5007fa[_0x984f('0x28')],'transfereecontext':_0x5007fa[_0x984f('0x29')],'transfereeexten':_0x5007fa[_0x984f('0x2a')],'transfereelinkedid':_0x5007fa['transfertargetlinkedid']});}writeDB(_0x5007fa);}catch(_0x103fe7){utils[_0x984f('0x15')](util[_0x984f('0x3')]('[%s][transfers][attendedtransfer]',_0x5007fa[_0x984f('0x7')]),_0x103fe7);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a4c7c31..38ac2b6 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb10b,0x12a));var _0xbb10=function(_0x161e88,_0x49ce5e){_0x161e88=_0x161e88-0x0;var _0x40ee62=_0xb10b[_0x161e88];return _0x40ee62;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb10b,0x12a));var _0xbb10=function(_0x2de4e6,_0x2dbab4){_0x2de4e6=_0x2de4e6-0x0;var _0x156984=_0xb10b[_0x2de4e6];return _0x156984;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file